diff --git a/org/drip/analytics/cashflow/Bullet.java b/org/drip/analytics/cashflow/Bullet.java deleted file mode 100644 index 04ac7a7..0000000 --- a/org/drip/analytics/cashflow/Bullet.java +++ /dev/null @@ -1,457 +0,0 @@ - -package org.drip.analytics.cashflow; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * Bullet holds the point realizations for the latent states relevant to terminal valuation of a bullet cash - * flow. - * - * @author Lakshmi Krishnamurthy - */ - -public class Bullet { - - /* - * Date Fields - */ - - private int _iPayDate = java.lang.Integer.MIN_VALUE; - private int _iFXFixingDate = java.lang.Integer.MIN_VALUE; - private int _iTerminalDate = java.lang.Integer.MIN_VALUE; - - /* - * Period Latent State Identification Support Fields - */ - - private java.lang.String _strPayCurrency = ""; - private java.lang.String _strCouponCurrency = ""; - private org.drip.state.identifier.CreditLabel _creditLabel = null; - - /* - * Period Cash Extensive Fields - */ - - private double _dblBaseNotional = java.lang.Double.NaN; - private org.drip.quant.common.Array2D _notlSchedule = null; - - private org.drip.analytics.output.ConvexityAdjustment convexityAdjustment ( - final int iValueDate, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - org.drip.state.identifier.CreditLabel creditLabel = creditLabel(); - - org.drip.state.identifier.FundingLabel fundingLabel = fundingLabel(); - - org.drip.state.identifier.FXLabel fxLabel = fxLabel(); - - org.drip.analytics.output.ConvexityAdjustment convAdj = new - org.drip.analytics.output.ConvexityAdjustment(); - - try { - if (!convAdj.setCreditFunding (null != csqs ? java.lang.Math.exp - (org.drip.analytics.support.OptionHelper.IntegratedCrossVolQuanto (csqs.creditVolatility - (creditLabel), csqs.fundingVolatility (fundingLabel), csqs.creditFundingCorrelation - (creditLabel, fundingLabel), iValueDate, _iPayDate)) : 1.)) - return null; - - if (!convAdj.setCreditFX (null != csqs && isFXMTM() ? java.lang.Math.exp - (org.drip.analytics.support.OptionHelper.IntegratedCrossVolQuanto (csqs.creditVolatility - (creditLabel), csqs.fxVolatility (fxLabel), csqs.creditFXCorrelation (creditLabel, - fxLabel), iValueDate, _iPayDate)) : 1.)) - return null; - - if (!convAdj.setFundingFX (null != csqs && isFXMTM() ? java.lang.Math.exp - (org.drip.analytics.support.OptionHelper.IntegratedCrossVolQuanto (csqs.fundingVolatility - (fundingLabel), csqs.fxVolatility (fxLabel), csqs.fundingFXCorrelation (fundingLabel, - fxLabel), iValueDate, _iPayDate)) : 1.)) - return null; - - return convAdj; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Bullet instance from the specified parameters - * - * @param iTerminalDate Period End Date - * @param iPayDate Period Pay Date - * @param iFXFixingDate The FX Fixing Date for non-MTM'ed Cash-flow - * @param dblBaseNotional Coupon Period Base Notional - * @param notlSchedule Coupon Period Notional Schedule - * @param strPayCurrency Pay Currency - * @param strCouponCurrency Coupon Currency - * @param creditLabel The Credit Label - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public Bullet ( - final int iTerminalDate, - final int iPayDate, - final int iFXFixingDate, - final double dblBaseNotional, - final org.drip.quant.common.Array2D notlSchedule, - final java.lang.String strPayCurrency, - final java.lang.String strCouponCurrency, - final org.drip.state.identifier.CreditLabel creditLabel) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblBaseNotional = dblBaseNotional) || null == - (_strPayCurrency = strPayCurrency) || _strPayCurrency.isEmpty() || null == (_strCouponCurrency = - strCouponCurrency) || _strCouponCurrency.isEmpty()) - throw new java.lang.Exception ("Bullet ctr: Invalid inputs"); - - _iPayDate = iPayDate; - _creditLabel = creditLabel; - _iFXFixingDate = iFXFixingDate; - _iTerminalDate = iTerminalDate; - - if (null == (_notlSchedule = notlSchedule)) - _notlSchedule = org.drip.quant.common.Array2D.BulletSchedule(); - } - - /** - * Return the Terminal Date - * - * @return Terminal Date - */ - - public int terminalDate() - { - return _iTerminalDate; - } - - /** - * Return the period Pay Date - * - * @return Period Pay Date - */ - - public int payDate() - { - return _iPayDate; - } - - /** - * Return the period FX Fixing Date - * - * @return Period FX Fixing Date - */ - - public int fxFixingDate() - { - return _iFXFixingDate; - } - - /** - * Coupon Period FX - * - * @param csqs Market Parameters - * - * @return The Period FX - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double fx ( - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - throws java.lang.Exception - { - org.drip.state.identifier.FXLabel fxLabel = fxLabel(); - - if (null == fxLabel) return 1.; - - if (null == csqs) throw new java.lang.Exception ("Bullet::fx => Invalid Inputs"); - - if (!isFXMTM()) return csqs.fixing (_iFXFixingDate, fxLabel); - - org.drip.state.fx.FXCurve fxfc = csqs.fxState (fxLabel); - - if (null == fxfc) - throw new java.lang.Exception ("Bullet::fx => No Curve for " + fxLabel.fullyQualifiedName()); - - return fxfc.fx (_iPayDate); - } - - /** - * Is this Cash Flow FX MTM'ed? - * - * @return true - FX MTM is on (i.e., FX is not driven by fixing) - */ - - public boolean isFXMTM() - { - return java.lang.Integer.MIN_VALUE != _iFXFixingDate; - } - - /** - * Retrieve the Pay Currency - * - * @return The Pay Currency - */ - - public java.lang.String payCurrency() - { - return _strPayCurrency; - } - - /** - * Retrieve the Coupon Currency - * - * @return The Coupon Currency - */ - - public java.lang.String couponCurrency() - { - return _strCouponCurrency; - } - - /** - * Get the Base Notional - * - * @return Base Notional - */ - - public double baseNotional() - { - return _dblBaseNotional; - } - - /** - * Get the Notional Schedule - * - * @return Notional Schedule - */ - - public org.drip.quant.common.Array2D notionalSchedule() - { - return _notlSchedule; - } - - /** - * Notional Corresponding to the specified Date - * - * @param iDate The Specified Date - * - * @return The Corresponding to the specified Date - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double notional ( - final int iDate) - throws java.lang.Exception - { - return _dblBaseNotional * (null == _notlSchedule ? 1. : _notlSchedule.y (iDate)); - } - - /** - * Notional Aggregated over the specified Dates - * - * @param iDate1 The Date #1 - * @param iDate2 The Date #2 - * - * @return The Notional Aggregated over the specified Dates - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double notional ( - final int iDate1, - final int iDate2) - throws java.lang.Exception - { - return _dblBaseNotional * (null == _notlSchedule ? 1. : _notlSchedule.y (iDate1, iDate2)); - } - - /** - * Return the Collateral Label - * - * @return The Collateral Label - */ - - public org.drip.state.identifier.CollateralLabel collateralLabel() - { - return org.drip.state.identifier.CollateralLabel.Standard (_strPayCurrency); - } - - /** - * Return the Credit Label - * - * @return The Credit Label - */ - - public org.drip.state.identifier.CreditLabel creditLabel() - { - return _creditLabel; - } - - /** - * Return the Funding Label - * - * @return The Funding Label - */ - - public org.drip.state.identifier.FundingLabel fundingLabel() - { - return org.drip.state.identifier.FundingLabel.Standard (_strPayCurrency); - } - - /** - * Return the FX Label - * - * @return The FX Label - */ - - public org.drip.state.identifier.FXLabel fxLabel() - { - return _strPayCurrency.equalsIgnoreCase (_strCouponCurrency) ? null : - org.drip.state.identifier.FXLabel.Standard (_strPayCurrency + "/" + _strCouponCurrency); - } - - /** - * Compute the Metrics at the Specified Valuation Date - * - * @param iValueDate Valuation Date - * @param csqs The Market Curve Surface/Quote Set - * - * @return The Metrics at the specified Valuation Date - */ - - public org.drip.analytics.output.BulletMetrics metrics ( - final int iValueDate, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - double dblDF = 1.; - double dblSurvival = 1.; - - org.drip.state.identifier.FXLabel fxLabel = fxLabel(); - - org.drip.state.identifier.FundingLabel fundingLabel = fundingLabel(); - - org.drip.state.credit.CreditCurve cc = null == csqs ? null : csqs.creditState (_creditLabel); - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = null == csqs ? null : csqs.fundingState - (fundingLabel); - - try { - double dblFX = fx (csqs); - - if (null != dcFunding) dblDF = dcFunding.df (_iPayDate); - - if (null != cc) dblSurvival = cc.survival (_iPayDate); - - return new org.drip.analytics.output.BulletMetrics (_iTerminalDate, _iPayDate, notional - (_iTerminalDate), dblSurvival, dblDF, dblFX, convexityAdjustment (iValueDate, csqs), - _creditLabel, fundingLabel, fxLabel); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Funding Predictor/Response Constraint - * - * @param iValueDate The Valuation Date - * @param csqs The Market Curve Surface/Quote Set - * @param pqs Product Quote Set - * - * @return The Funding Predictor/Response Constraint - */ - - public org.drip.state.estimator.PredictorResponseWeightConstraint fundingPRWC ( - final int iValueDate, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.product.calib.ProductQuoteSet pqs) - { - if (null == pqs) return null; - - double dblPV = 0.; - - org.drip.state.estimator.PredictorResponseWeightConstraint prwc = new - org.drip.state.estimator.PredictorResponseWeightConstraint(); - - org.drip.analytics.output.BulletMetrics bm = metrics (iValueDate, csqs); - - if (null == bm) return null; - - java.util.Map mapDiscountFactorLoading = - bm.discountFactorFundingLoading (pqs.fundingLabel()); - - if (null != mapDiscountFactorLoading && 0 != mapDiscountFactorLoading.size()) { - for (java.util.Map.Entry meDiscountFactorLoading : - mapDiscountFactorLoading.entrySet()) { - int iDateAnchor = meDiscountFactorLoading.getKey(); - - double dblDiscountFactorFundingLoading = meDiscountFactorLoading.getValue(); - - if (!prwc.addPredictorResponseWeight (iDateAnchor, dblDiscountFactorFundingLoading)) - return null; - - if (!prwc.addDResponseWeightDManifestMeasure ("PV", iDateAnchor, - dblDiscountFactorFundingLoading)) - return null; - } - } else - dblPV -= bm.annuity(); - - if (!prwc.updateValue (dblPV)) return null; - - if (!prwc.updateDValueDManifestMeasure ("PV", 1.)) return null; - - return prwc; - } -} diff --git a/org/drip/analytics/cashflow/ComposableUnitFixedPeriod.java b/org/drip/analytics/cashflow/ComposableUnitFixedPeriod.java deleted file mode 100644 index 462db58..0000000 --- a/org/drip/analytics/cashflow/ComposableUnitFixedPeriod.java +++ /dev/null @@ -1,103 +0,0 @@ - -package org.drip.analytics.cashflow; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ComposableUnitFixedPeriod contains the fixed cash flow periods' composable sub period details. Currently - * it holds the accrual start date, the accrual end date, the fixed coupon, the basis spread, coupon and - * accrual day counts, and the EOM adjustment flags. - * - * @author Lakshmi Krishnamurthy - */ - -public class ComposableUnitFixedPeriod extends org.drip.analytics.cashflow.ComposableUnitPeriod { - private org.drip.param.period.ComposableFixedUnitSetting _cufs = null; - - /** - * The ComposableUnitFixedPeriod constructor - * - * @param iStartDate Accrual Start Date - * @param iEndDate Accrual End Date - * @param ucas Unit Coupon/Accrual Setting - * @param cufs Composable Unit Fixed Setting - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ComposableUnitFixedPeriod ( - final int iStartDate, - final int iEndDate, - final org.drip.param.period.UnitCouponAccrualSetting ucas, - final org.drip.param.period.ComposableFixedUnitSetting cufs) - throws java.lang.Exception - { - super (iStartDate, iEndDate, cufs.tenor(), ucas); - - if (null == (_cufs = cufs)) - throw new java.lang.Exception ("ComposableUnitFixedPeriod ctr: Invalid Inputs"); - } - - @Override public double baseRate ( - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - throws java.lang.Exception - { - return _cufs.fixedCoupon(); - } - - @Override public double basis() - { - return _cufs.basis(); - } - - @Override public java.lang.String couponCurrency() - { - return _cufs.couponCurrency(); - } -} diff --git a/org/drip/analytics/cashflow/ComposableUnitFloatingPeriod.java b/org/drip/analytics/cashflow/ComposableUnitFloatingPeriod.java deleted file mode 100644 index 030a2bc..0000000 --- a/org/drip/analytics/cashflow/ComposableUnitFloatingPeriod.java +++ /dev/null @@ -1,201 +0,0 @@ - -package org.drip.analytics.cashflow; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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 models 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. - */ - -/** - * ComposableUnitFloatingPeriod contains the cash flow periods' composable sub period details. Currently it - * holds the accrual start date, the accrual end date, the fixing date, the spread over the index, and the - * corresponding reference index period. - * - * @author Lakshmi Krishnamurthy - */ - -public class ComposableUnitFloatingPeriod extends org.drip.analytics.cashflow.ComposableUnitPeriod { - private double _dblSpread = java.lang.Double.NaN; - private org.drip.analytics.cashflow.ReferenceIndexPeriod _refIndexPeriod = null; - - private org.drip.analytics.date.JulianDate lookBackProjectionDate ( - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.market.definition.OvernightIndex oisIndex) - { - int iSkipBackDay = 0; - org.drip.analytics.date.JulianDate dtFixing = null; - - org.drip.state.identifier.ForwardLabel forwardLabel = _refIndexPeriod.forwardLabel(); - - org.drip.market.definition.FloaterIndex floaterIndex = forwardLabel.floaterIndex(); - - int iLookBackProjectionWindow = oisIndex.publicationLag(); - - try { - dtFixing = new org.drip.analytics.date.JulianDate (_refIndexPeriod.fixingDate()); - - while (iSkipBackDay <= iLookBackProjectionWindow) { - if (csqs.available (dtFixing, forwardLabel)) return dtFixing; - - if (null == (dtFixing = dtFixing.subtractBusDays (1, floaterIndex.calendar()))) return null; - - iSkipBackDay += 1; - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * The ComposableUnitFloatingPeriod constructor - * - * @param iStartDate Accrual Start Date - * @param iEndDate Accrual End Date - * @param strTenor The Composable Period Tenor - * @param refIndexPeriod The Reference Index Period - * @param dblSpread The Floater Spread - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ComposableUnitFloatingPeriod ( - final int iStartDate, - final int iEndDate, - final java.lang.String strTenor, - final org.drip.analytics.cashflow.ReferenceIndexPeriod refIndexPeriod, - final double dblSpread) - throws java.lang.Exception - { - super (iStartDate, iEndDate, strTenor, refIndexPeriod.forwardLabel().ucas()); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblSpread = dblSpread)) - throw new java.lang.Exception ("ComposableUnitFloatingPeriod ctr: Invalid Inputs"); - - _refIndexPeriod = refIndexPeriod; - } - - /** - * Retrieve the Reference Rate for the Floating Period - * - * @param csqs The Market Curve and Surface - * - * @return The Reference Rate for the Floating Period - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - @Override public double baseRate ( - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - throws java.lang.Exception - { - if (null == csqs) return java.lang.Double.NaN; - - org.drip.state.identifier.ForwardLabel forwardLabel = _refIndexPeriod.forwardLabel(); - - org.drip.market.definition.FloaterIndex floaterIndex = forwardLabel.floaterIndex(); - - if (!(floaterIndex instanceof org.drip.market.definition.OvernightIndex)) { - int iFixingDate = _refIndexPeriod.fixingDate(); - - if (csqs.available (iFixingDate, forwardLabel)) - return csqs.fixing (iFixingDate, forwardLabel); - } else { - org.drip.analytics.date.JulianDate dtValidFixing = lookBackProjectionDate (csqs, - (org.drip.market.definition.OvernightIndex) floaterIndex); - - if (null != dtValidFixing) return csqs.fixing (dtValidFixing, forwardLabel); - } - - int iReferencePeriodEndDate = _refIndexPeriod.endDate(); - - org.drip.state.forward.ForwardRateEstimator fre = csqs.forwardState (forwardLabel); - - if (null != fre) return fre.forward (iReferencePeriodEndDate); - - java.lang.String strForwardCurrency = forwardLabel.currency(); - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqs.fundingState - (org.drip.state.identifier.FundingLabel.Standard (strForwardCurrency)); - - if (null == dcFunding) - throw new java.lang.Exception - ("ComposableUnitFloatingPeriod::baseRate => Cannot locate Funding Curve " + - strForwardCurrency); - - int iEpochDate = dcFunding.epoch().julian(); - - int iReferencePeriodStartDate = _refIndexPeriod.startDate(); - - if (iEpochDate > iReferencePeriodStartDate) - iReferencePeriodEndDate = new org.drip.analytics.date.JulianDate (iReferencePeriodStartDate = - iEpochDate).addTenor (forwardLabel.tenor()).julian(); - - return dcFunding.libor (iReferencePeriodStartDate, iReferencePeriodEndDate, _refIndexPeriod.dcf()); - } - - @Override public double basis() - { - return _dblSpread; - } - - @Override public java.lang.String couponCurrency() - { - return _refIndexPeriod.forwardLabel().currency(); - } - - /** - * Retrieve the Reference Index Period - * - * @return The Reference Index Period - */ - - public org.drip.analytics.cashflow.ReferenceIndexPeriod referenceIndexPeriod() - { - return _refIndexPeriod; - } -} diff --git a/org/drip/analytics/cashflow/ComposableUnitPeriod.java b/org/drip/analytics/cashflow/ComposableUnitPeriod.java deleted file mode 100644 index 62229ed..0000000 --- a/org/drip/analytics/cashflow/ComposableUnitPeriod.java +++ /dev/null @@ -1,335 +0,0 @@ - -package org.drip.analytics.cashflow; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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 models 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. - */ - -/** - * ComposableUnitPeriod contains the cash flow periods' composable unit period details. Currently it - * holds the accrual start date, the accrual end date, the fixed coupon, the basis spread, coupon and - * accrual day counts, and the EOM adjustment flags. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class ComposableUnitPeriod { - - /** - * Node is to the Left of the Period - */ - - public static final int NODE_LEFT_OF_SEGMENT = 1; - - /** - * Node is Inside the Period - */ - - public static final int NODE_INSIDE_SEGMENT = 2; - - /** - * Node is to the Right of the Period - */ - - public static final int NODE_RIGHT_OF_SEGMENT = 4; - - private int _iFreq = -1; - private java.lang.String _strTenor = ""; - private int _iEndDate = java.lang.Integer.MIN_VALUE; - private int _iStartDate = java.lang.Integer.MIN_VALUE; - private double _dblFullCouponDCF = java.lang.Double.NaN; - private org.drip.param.period.UnitCouponAccrualSetting _ucas = null; - - protected ComposableUnitPeriod ( - final int iStartDate, - final int iEndDate, - final java.lang.String strTenor, - final org.drip.param.period.UnitCouponAccrualSetting ucas) - throws java.lang.Exception - { - if ((_iStartDate = iStartDate) >= (_iEndDate = iEndDate) || null == (_strTenor = strTenor) || - strTenor.isEmpty() || null == (_ucas = ucas)) - throw new java.lang.Exception ("ComposableUnitPeriod ctr: Invalid Inputs"); - - _iFreq = org.drip.analytics.support.Helper.TenorToFreq (_strTenor); - - _dblFullCouponDCF = _ucas.couponDCFOffOfFreq() ? 1. / _iFreq : - org.drip.analytics.daycount.Convention.YearFraction (_iStartDate, _iEndDate, _ucas.couponDC(), - _ucas.couponEOMAdjustment(), null, _ucas.calendar()); - } - - /** - * Retrieve the Accrual Start Date - * - * @return The Accrual Start Date - */ - - public int startDate() - { - return _iStartDate; - } - - /** - * Retrieve the Accrual End Date - * - * @return The Accrual End Date - */ - - public int endDate() - { - return _iEndDate; - } - - /** - * Retrieve the Coupon Frequency - * - * @return The Coupon Frequency - */ - - public int freq() - { - return _iFreq; - } - - /** - * Retrieve the Coupon Day Count - * - * @return The Coupon Day Count - */ - - public java.lang.String couponDC() - { - return _ucas.couponDC(); - } - - /** - * Retrieve the Coupon EOM Adjustment Flag - * - * @return The Coupon EOM Adjustment Flag - */ - - public boolean couponEOMAdjustment() - { - return _ucas.couponEOMAdjustment(); - } - - /** - * Retrieve the Accrual Day Count - * - * @return The Accrual Day Count - */ - - public java.lang.String accrualDC() - { - return _ucas.accrualDC(); - } - - /** - * Retrieve the Accrual EOM Adjustment Flag - * - * @return The Accrual EOM Adjustment Flag - */ - - public boolean accrualEOMAdjustment() - { - return _ucas.accrualEOMAdjustment(); - } - - /** - * Retrieve the Flag indicating whether Coupon DCF is computed off of the DCF Flag - * - * @return true - The Flag indicating whether Coupon DCF is computed off of the DCF Flag - */ - - public boolean couponDCFOffOfFreq() - { - return _ucas.couponDCFOffOfFreq(); - } - - /** - * Retrieve the Calendar - * - * @return The Calendar - */ - - public java.lang.String calendar() - { - return _ucas.calendar(); - } - - /** - * Retrieve the Accrual Compounding Rule - * - * @return The Accrual Compounding Rule - */ - - public int accrualCompoundingRule() - { - return _ucas.accrualCompoundingRule(); - } - - /** - * Retrieve the Period Full Coupon DCF - * - * @return The Period Full Coupon DCF - */ - - public double fullCouponDCF() - { - return _dblFullCouponDCF; - } - - /** - * Convert the Coupon Frequency into a Tenor - * - * @return The Coupon Frequency converted into a Tenor - */ - - public java.lang.String tenor() - { - return _strTenor; - } - - /** - * Place the Date Node Location in relation to the segment Location - * - * @param iDateNode The Node Ordinate - * - * @return One of NODE_LEFT_OF_SEGMENT, NODE_RIGHT_OF_SEGMENT, or NODE_INSIDE_SEGMENT - */ - - public int dateLocation ( - final int iDateNode) - { - if (iDateNode < _iStartDate) return NODE_LEFT_OF_SEGMENT; - - if (iDateNode > _iEndDate) return NODE_RIGHT_OF_SEGMENT; - - return NODE_INSIDE_SEGMENT; - } - - /** - * Get the Period Accrual Day Count Fraction to an Accrual End Date - * - * @param iAccrualEnd Accrual End Date - * - * @return The Accrual DCF - * - * @throws java.lang.Exception Thrown if inputs are invalid, or if the date does not lie within the - * period - */ - - public double accrualDCF ( - final int iAccrualEnd) - throws java.lang.Exception - { - if (NODE_INSIDE_SEGMENT != dateLocation (iAccrualEnd)) - throw new java.lang.Exception - ("ComposableUnitPeriod::accrualDCF => Invalid in-period accrual date!"); - - org.drip.analytics.daycount.ActActDCParams aap = new org.drip.analytics.daycount.ActActDCParams - (_iFreq, _iEndDate - _iStartDate); - - java.lang.String strAccrualDC = accrualDC(); - - java.lang.String strCalendar = calendar(); - - boolean bAccrualEOMAdjustment = accrualEOMAdjustment(); - - return org.drip.analytics.daycount.Convention.YearFraction (_iStartDate, iAccrualEnd, strAccrualDC, - bAccrualEOMAdjustment, aap, strCalendar) / org.drip.analytics.daycount.Convention.YearFraction - (_iStartDate, _iEndDate, strAccrualDC, bAccrualEOMAdjustment, aap, strCalendar) * - _dblFullCouponDCF; - } - - /** - * Get the Period Full Coupon Rate - * - * @param csqs The Market Curve and Surface - * - * @return The Period Full Coupon Rate - * - * @throws java.lang.Exception Thrown if the full Coupon Rate cannot be calculated - */ - - public double fullCouponRate ( - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - throws java.lang.Exception - { - return baseRate (csqs) + basis(); - } - - /** - * Get the Period Base Coupon Rate - * - * @param csqs The Market Curve and Surface - * - * @return The Period Base Coupon Rate - * - * @throws java.lang.Exception Thrown if the base Coupon Rate cannot be calculated - */ - - public abstract double baseRate ( - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - throws java.lang.Exception; - - /** - * Get the Period Coupon Basis - * - * @return The Period Coupon Basis - */ - - public abstract double basis(); - - /** - * Get the Period Coupon Currency - * - * @return The Period Coupon Currency - */ - - public abstract java.lang.String couponCurrency(); -} diff --git a/org/drip/analytics/cashflow/CompositeFixedPeriod.java b/org/drip/analytics/cashflow/CompositeFixedPeriod.java deleted file mode 100644 index a83ef87..0000000 --- a/org/drip/analytics/cashflow/CompositeFixedPeriod.java +++ /dev/null @@ -1,121 +0,0 @@ - -package org.drip.analytics.cashflow; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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 models 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. - */ - -/** - * CompositeFixedPeriod implements the composed fixed coupon period functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class CompositeFixedPeriod extends org.drip.analytics.cashflow.CompositePeriod { - - /** - * CompositeFixedPeriod Constructor - * - * @param cps Composite Period Setting Instance - * @param lsCUP List of Composable Unit Fixed Periods - * - * @throws java.lang.Exception Thrown if the Accrual Compounding Rule is invalid - */ - - public CompositeFixedPeriod ( - final org.drip.param.period.CompositePeriodSetting cps, - final java.util.List lsCUP) - throws java.lang.Exception - { - super (cps, lsCUP); - } - - @Override public org.drip.product.calib.CompositePeriodQuoteSet periodQuoteSet ( - final org.drip.product.calib.ProductQuoteSet pqs, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - if (null == pqs || !(pqs instanceof org.drip.product.calib.FixedStreamQuoteSet)) return null; - - org.drip.product.calib.FixedStreamQuoteSet fsqs = (org.drip.product.calib.FixedStreamQuoteSet) - pqs; - - org.drip.analytics.cashflow.ComposableUnitPeriod cup = periods().get (0); - - try { - org.drip.product.calib.CompositePeriodQuoteSet cpqs = new - org.drip.product.calib.CompositePeriodQuoteSet (pqs.lss()); - - if (!cpqs.setBaseRate (fsqs.containsCoupon() ? fsqs.coupon() : cup.baseRate (csqs))) return null; - - if (!cpqs.setBasis (fsqs.containsCouponBasis() ? fsqs.couponBasis() : basis())) return null; - - return cpqs; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public double basisQuote ( - final org.drip.product.calib.ProductQuoteSet pqs) - { - double dblBasis = basis(); - - if (null == pqs || !(pqs instanceof org.drip.product.calib.FixedStreamQuoteSet)) return dblBasis; - - org.drip.product.calib.FixedStreamQuoteSet fsqs = (org.drip.product.calib.FixedStreamQuoteSet) pqs; - - try { - if (fsqs.containsCouponBasis()) return fsqs.couponBasis(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return dblBasis; - } -} diff --git a/org/drip/analytics/cashflow/CompositeFloatingPeriod.java b/org/drip/analytics/cashflow/CompositeFloatingPeriod.java deleted file mode 100644 index e29aa08..0000000 --- a/org/drip/analytics/cashflow/CompositeFloatingPeriod.java +++ /dev/null @@ -1,120 +0,0 @@ - -package org.drip.analytics.cashflow; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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 models 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. - */ - -/** - * CompositeFloatingPeriod implements the composite floating coupon period functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class CompositeFloatingPeriod extends org.drip.analytics.cashflow.CompositePeriod { - - /** - * CompositeFloatingPeriod Constructor - * - * @param cps Composite Period Setting Instance - * @param lsCUP List of Composable Unit Fixed Periods - * - * @throws java.lang.Exception Thrown if the Accrual Compounding Rule is invalid - */ - - public CompositeFloatingPeriod ( - final org.drip.param.period.CompositePeriodSetting cps, - final java.util.List lsCUP) - throws java.lang.Exception - { - super (cps, lsCUP); - } - - @Override public org.drip.product.calib.CompositePeriodQuoteSet periodQuoteSet ( - final org.drip.product.calib.ProductQuoteSet pqs, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - if (null == pqs || !(pqs instanceof org.drip.product.calib.FloatingStreamQuoteSet)) return null; - - org.drip.product.calib.FloatingStreamQuoteSet fsqs = (org.drip.product.calib.FloatingStreamQuoteSet) - pqs; - - try { - org.drip.product.calib.CompositePeriodQuoteSet cpqs = new - org.drip.product.calib.CompositePeriodQuoteSet (pqs.lss()); - - if (fsqs.containsForwardRate() && !cpqs.setBaseRate (fsqs.forwardRate())) return null; - - if (!cpqs.setBasis (fsqs.containsSpread() ? fsqs.spread() : basis())) return null; - - return cpqs; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public double basisQuote ( - final org.drip.product.calib.ProductQuoteSet pqs) - { - double dblBasis = basis(); - - if (null == pqs || !(pqs instanceof org.drip.product.calib.FloatingStreamQuoteSet)) return dblBasis; - - org.drip.product.calib.FloatingStreamQuoteSet fsqs = (org.drip.product.calib.FloatingStreamQuoteSet) - pqs; - - try { - if (fsqs.containsSpread()) return fsqs.spread(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return dblBasis; - } -} diff --git a/org/drip/analytics/cashflow/CompositePeriod.java b/org/drip/analytics/cashflow/CompositePeriod.java deleted file mode 100644 index c9261e0..0000000 --- a/org/drip/analytics/cashflow/CompositePeriod.java +++ /dev/null @@ -1,1485 +0,0 @@ - -package org.drip.analytics.cashflow; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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 models 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. - */ - -/** - * CompositePeriod implements the composite coupon period functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class CompositePeriod { - private int _iFreq = -1; - private java.lang.String _strTenor = ""; - private int _iAccrualCompoundingRule = -1; - private java.lang.String _strPayCurrency = ""; - private int _iPayDate = java.lang.Integer.MIN_VALUE; - private double _dblBaseNotional = java.lang.Double.NaN; - private org.drip.quant.common.Array2D _fsCoupon = null; - private org.drip.quant.common.Array2D _fsNotional = null; - private org.drip.state.identifier.CreditLabel _creditLabel = null; - private org.drip.param.period.FixingSetting _fxFixingSetting = null; - private java.util.List _lsCUP = null; - - protected CompositePeriod ( - final org.drip.param.period.CompositePeriodSetting cps, - final java.util.List lsCUP) - throws java.lang.Exception - { - if (null == cps || null == (_lsCUP = lsCUP) || 0 == _lsCUP.size()) - throw new java.lang.Exception ("CompositePeriod ctr: Invalid Inputs"); - - _iFreq = cps.freq(); - - _strTenor = cps.tenor(); - - org.drip.analytics.daycount.DateAdjustParams dapPay = cps.dapPay(); - - org.drip.analytics.cashflow.ComposableUnitPeriod cupFinal = _lsCUP.get (_lsCUP.size() - 1); - - _iAccrualCompoundingRule = cupFinal.accrualCompoundingRule(); - - _iPayDate = cupFinal.endDate(); - - if (null != dapPay) _iPayDate = dapPay.roll (_iPayDate); - - _strPayCurrency = cps.payCurrency(); - - _dblBaseNotional = cps.baseNotional(); - - _fxFixingSetting = cps.fxFixingSetting(); - - _creditLabel = cps.creditLabel(); - - _fsNotional = cps.notionalSchedule(); - - _fsCoupon = cps.couponSchedule(); - } - - /** - * Retrieve the List of Composable Periods - * - * @return The List of Composable Periods - */ - - public java.util.List periods() - { - return _lsCUP; - } - - /** - * Period Start Date - * - * @return The Period Start Date - */ - - public int startDate() - { - return _lsCUP.get (0).startDate(); - } - - /** - * Period End Date - * - * @return The Period End Date - */ - - public int endDate() - { - return _lsCUP.get (_lsCUP.size() - 1).endDate(); - } - - /** - * Check whether the supplied Date is inside the Period specified - * - * @param iDate Date - * - * @return TRUE - The specified Date is inside the Period - */ - - public boolean contains ( - final int iDate) - { - return iDate >= startDate() && iDate <= endDate(); - } - - /** - * Return the Unit Period to which the Date belongs - * - * @param iDate Date - * - * @return The Unit Period to which the Date belongs - */ - - public org.drip.analytics.cashflow.ComposableUnitPeriod enclosingCUP ( - final int iDate) - { - if (!contains (iDate)) return null; - - for (org.drip.analytics.cashflow.ComposableUnitPeriod cup : _lsCUP) { - int iDateLocation = cup.dateLocation (iDate); - - if (org.drip.analytics.cashflow.ComposableUnitFixedPeriod.NODE_INSIDE_SEGMENT == iDateLocation) - return cup; - } - - return null; - } - - /** - * Retrieve the Accrual Compounding Rule - * - * @return The Accrual Compounding Rule - */ - - public int accrualCompoundingRule() - { - return _iAccrualCompoundingRule; - } - - /** - * Return the Period Pay Date - * - * @return Period Pay Date - */ - - public int payDate() - { - return _iPayDate; - } - - /** - * Return the Period FX Fixing Date - * - * @return Period FX Fixing Date - * - * @throws java.lang.Exception Thrown if FX Fixing Date cannot be generated - */ - - public int fxFixingDate() - throws java.lang.Exception - { - if (null == _fxFixingSetting) return _iPayDate; - - int iUnadjustedFixingDate = java.lang.Integer.MIN_VALUE; - - int iFixingType = _fxFixingSetting.type(); - - if (org.drip.param.period.FixingSetting.FIXING_COMPOSITE_PERIOD_END == iFixingType) - iUnadjustedFixingDate = endDate(); - else if (org.drip.param.period.FixingSetting.FIXING_COMPOSITE_PERIOD_START == iFixingType) - iUnadjustedFixingDate = startDate(); - else if (org.drip.param.period.FixingSetting.FIXING_PRESET_STATIC == iFixingType) - iUnadjustedFixingDate = _fxFixingSetting.staticDate(); - - org.drip.analytics.daycount.DateAdjustParams dapFixing = _fxFixingSetting.dap(); - - if (null == dapFixing) return iUnadjustedFixingDate; - - return dapFixing.roll (iUnadjustedFixingDate); - } - - /** - * Is this Cash Flow FX MTM'ed? - * - * @return TRUE - FX MTM is on (i.e., FX is not driven by fixing) - */ - - public boolean isFXMTM() - { - return null == _fxFixingSetting; - } - - /** - * Coupon Period FX - * - * @param csqs Market Parameters - * - * @return The Period FX - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double fx ( - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - throws java.lang.Exception - { - org.drip.state.identifier.FXLabel fxLabel = fxLabel(); - - if (null == fxLabel) return 1.; - - if (null == csqs) throw new java.lang.Exception ("CompositePeriod::fx => Invalid Inputs"); - - if (!isFXMTM()) return csqs.fixing (fxFixingDate(), fxLabel); - - org.drip.state.fx.FXCurve fxfc = csqs.fxState (fxLabel); - - if (null == fxfc) - throw new java.lang.Exception ("CompositePeriod::fx => No Curve for " + - fxLabel.fullyQualifiedName()); - - return fxfc.fx (_iPayDate); - } - - /** - * Retrieve the Coupon Frequency - * - * @return The Coupon Frequency - */ - - public int freq() - { - return _iFreq; - } - - /** - * Convert the Coupon Frequency into a Tenor - * - * @return The Coupon Frequency converted into a Tenor - */ - - public java.lang.String tenor() - { - if (null != _strTenor && !_strTenor.isEmpty()) return _strTenor; - - int iTenorInMonths = 12 / freq() ; - - return 1 == iTenorInMonths || 2 == iTenorInMonths || 3 == iTenorInMonths || 6 == iTenorInMonths || 12 - == iTenorInMonths ? iTenorInMonths + "M" : "ON"; - } - - /** - * Retrieve the Pay Currency - * - * @return The Pay Currency - */ - - public java.lang.String payCurrency() - { - return _strPayCurrency; - } - - /** - * Retrieve the Coupon Currency - * - * @return The Coupon Currency - */ - - public java.lang.String couponCurrency() - { - return _lsCUP.get (0).couponCurrency(); - } - - /** - * Period Basis - * - * @return The Period Basis - */ - - public double basis() - { - return _lsCUP.get (0).basis(); - } - - /** - * Coupon Period Survival Probability - * - * @param csqs Market Parameters - * - * @return The Period Survival Probability - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double survival ( - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - throws java.lang.Exception - { - org.drip.state.identifier.CreditLabel creditLabel = creditLabel(); - - if (null == creditLabel) return 1.; - - if (null == csqs) throw new java.lang.Exception ("CompositePeriod::survival => Invalid Inputs"); - - org.drip.state.credit.CreditCurve cc = csqs.creditState (creditLabel); - - if (null == cc) - throw new java.lang.Exception ("CompositePeriod::survival => No Curve for " + - creditLabel.fullyQualifiedName()); - - return cc.survival (_iPayDate); - } - - /** - * Coupon Period Discount Factor - * - * @param csqs Market Parameters - * - * @return The Period Discount Factor - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double df ( - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - throws java.lang.Exception - { - org.drip.state.identifier.FundingLabel fundingLabel = fundingLabel(); - - if (null == csqs) throw new java.lang.Exception ("CompositePeriod::df => Invalid Inputs"); - - org.drip.state.discount.MergedDiscountForwardCurve dc = csqs.fundingState (fundingLabel); - - if (null == dc) - throw new java.lang.Exception ("CompositePeriod::df => No Curve for " + - fundingLabel.fullyQualifiedName()); - - return dc.df (_iPayDate); - } - - /** - * Get the Period Base Notional - * - * @return Period Base Notional - */ - - public double baseNotional() - { - return _dblBaseNotional; - } - - /** - * Get the period Notional Schedule - * - * @return Period Notional Schedule - */ - - public org.drip.quant.common.Array2D notionalSchedule() - { - return _fsNotional; - } - - /** - * Coupon Period Notional Corresponding to the specified Date - * - * @param iDate The Specified Date - * - * @return The Period Notional Corresponding to the specified Date - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double notional ( - final int iDate) - throws java.lang.Exception - { - if (!contains (iDate)) - throw new java.lang.Exception ("CompositePeriod::notional => Invalid Inputs: " + iDate + " [" + - startDate() + " => " + endDate() + "]"); - - return _dblBaseNotional * (null == _fsNotional ? 1. : _fsNotional.y (iDate)); - } - - /** - * Coupon Period Notional Aggregated over the specified Dates - * - * @param iDate1 The Date #1 - * @param iDate2 The Date #2 - * - * @return The Period Notional Aggregated over the specified Dates - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double notional ( - final int iDate1, - final int iDate2) - throws java.lang.Exception - { - if (!contains (iDate1) || !contains (iDate2)) - throw new java.lang.Exception ("CompositePeriod::notional => Invalid Dates"); - - return _dblBaseNotional * (null == _fsNotional ? 1. : _fsNotional.y (iDate1, iDate2)); - } - - /** - * Get the period Coupon Schedule - * - * @return Period Coupon Schedule - */ - - public org.drip.quant.common.Array2D couponSchedule() - { - return _fsCoupon; - } - - /** - * Period Coupon Schedule Factor Corresponding to the specified Date - * - * @param iDate The Specified Date - * - * @return The Period Coupon Schedule Factor Corresponding to the specified Date - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double couponFactor ( - final int iDate) - throws java.lang.Exception - { - if (!contains (iDate)) - throw new java.lang.Exception ("CompositePeriod::couponFactor => Invalid Inputs"); - - return null == _fsCoupon ? 1. : _fsCoupon.y (iDate); - } - - /** - * Period Coupon Schedule Factor Aggregated over the specified Dates - * - * @param iDate1 The Date #1 - * @param iDate2 The Date #2 - * - * @return The Period Coupon Schedule Factor Aggregated over the specified Dates - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double couponFactor ( - final int iDate1, - final int iDate2) - throws java.lang.Exception - { - if (!contains (iDate1) || !contains (iDate2)) - throw new java.lang.Exception ("CompositePeriod::couponFactor => Invalid Dates"); - - return null == _fsCoupon ? 1. : _fsCoupon.y (iDate1, iDate2); - } - - /** - * Return the Collateral Label - * - * @return The Collateral Label - */ - - public org.drip.state.identifier.CollateralLabel collateralLabel() - { - return org.drip.state.identifier.CollateralLabel.Standard (_strPayCurrency); - } - - /** - * Return the Credit Label - * - * @return The Credit Label - */ - - public org.drip.state.identifier.CreditLabel creditLabel() - { - return _creditLabel; - } - - /** - * Return the Forward Label - * - * @return The Forward Label - */ - - public org.drip.state.identifier.ForwardLabel forwardLabel() - { - org.drip.analytics.cashflow.ComposableUnitPeriod cp = _lsCUP.get (0); - - if (cp instanceof org.drip.analytics.cashflow.ComposableUnitFixedPeriod) return null; - - return ((org.drip.analytics.cashflow.ComposableUnitFloatingPeriod) - cp).referenceIndexPeriod().forwardLabel(); - } - - /** - * Return the Funding Label - * - * @return The Funding Label - */ - - public org.drip.state.identifier.FundingLabel fundingLabel() - { - return org.drip.state.identifier.FundingLabel.Standard (_strPayCurrency); - } - - /** - * Return the FX Label - * - * @return The FX Label - */ - - public org.drip.state.identifier.FXLabel fxLabel() - { - java.lang.String strCouponCurrency = couponCurrency(); - - return _strPayCurrency.equalsIgnoreCase (strCouponCurrency) ? null : - org.drip.state.identifier.FXLabel.Standard (_strPayCurrency + "/" + strCouponCurrency); - } - - /** - * Compute the Convexity Adjustment for the composable periods that use arithmetic compounding using the - * specified value date using the market data provided - * - * @param iValueDate The Valuation Date - * @param csqs The Market Curves/Surface - * - * @return The List of Convexity Adjustments - */ - - public java.util.List periodWiseConvexityAdjustment ( - final int iValueDate, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - java.util.List lsConvAdj = new - java.util.ArrayList(); - - if (null == csqs || iValueDate >= _iPayDate) { - for (int i = 0; i < _lsCUP.size(); ++i) - lsConvAdj.add (new org.drip.analytics.output.ConvexityAdjustment()); - - return lsConvAdj; - } - - org.drip.state.identifier.CreditLabel creditLabel = creditLabel(); - - org.drip.state.identifier.ForwardLabel forwardLabel = forwardLabel(); - - org.drip.state.identifier.FundingLabel fundingLabel = fundingLabel(); - - org.drip.state.identifier.FXLabel fxLabel = fxLabel(); - - org.drip.state.volatility.VolatilityCurve vcCredit = csqs.creditVolatility (creditLabel); - - org.drip.state.volatility.VolatilityCurve vcForward = csqs.forwardVolatility (forwardLabel); - - org.drip.state.volatility.VolatilityCurve vcFunding = csqs.fundingVolatility (fundingLabel); - - org.drip.state.volatility.VolatilityCurve vcFX = csqs.fxVolatility (fxLabel); - - org.drip.function.definition.R1ToR1 auCreditForwardCorr = csqs.creditForwardCorrelation (creditLabel, - forwardLabel); - - org.drip.function.definition.R1ToR1 auForwardFundingCorr = csqs.forwardFundingCorrelation - (forwardLabel, fundingLabel); - - org.drip.function.definition.R1ToR1 auForwardFXCorr = csqs.forwardFXCorrelation (forwardLabel, - fxLabel); - - try { - double dblCreditFundingConvexityAdjustment = java.lang.Math.exp - (org.drip.analytics.support.OptionHelper.IntegratedCrossVolQuanto (vcCredit, vcFunding, - csqs.creditFundingCorrelation (creditLabel, fundingLabel), iValueDate, _iPayDate)); - - double dblCreditFXConvexityAdjustment = isFXMTM() ? java.lang.Math.exp - (org.drip.analytics.support.OptionHelper.IntegratedCrossVolQuanto (vcCredit, vcFX, - csqs.creditFXCorrelation (creditLabel, fxLabel), iValueDate, _iPayDate)) : 1.; - - double dblFundingFXConvexityAdjustment = isFXMTM() ? java.lang.Math.exp - (org.drip.analytics.support.OptionHelper.IntegratedCrossVolQuanto (vcFunding, vcFX, - csqs.fundingFXCorrelation (fundingLabel, fxLabel), iValueDate, _iPayDate)): 1.; - - for (org.drip.analytics.cashflow.ComposableUnitPeriod cup : _lsCUP) { - org.drip.analytics.output.ConvexityAdjustment convAdj = new - org.drip.analytics.output.ConvexityAdjustment(); - - if (!convAdj.setCreditFunding (dblCreditFundingConvexityAdjustment) || !convAdj.setCreditFX - (dblCreditFXConvexityAdjustment) || !convAdj.setFundingFX - (dblFundingFXConvexityAdjustment)) - return null; - - if (null != forwardLabel) { - if (!(cup instanceof org.drip.analytics.cashflow.ComposableUnitFloatingPeriod)) - return null; - - int iFixingDate = ((org.drip.analytics.cashflow.ComposableUnitFloatingPeriod) - cup).referenceIndexPeriod().fixingDate(); - - if (!convAdj.setCreditForward (iValueDate < iFixingDate ? java.lang.Math.exp - (org.drip.analytics.support.OptionHelper.IntegratedCrossVolQuanto (vcCredit, - vcForward, auCreditForwardCorr, iValueDate, iFixingDate)) : 1.)) - return null; - - if (!convAdj.setForwardFunding (iValueDate < iFixingDate ? java.lang.Math.exp - (org.drip.analytics.support.OptionHelper.IntegratedCrossVolQuanto (vcForward, - vcFunding, auForwardFundingCorr, iValueDate, iFixingDate)) : 1.)) - return null; - - if (!convAdj.setForwardFX (isFXMTM() && iValueDate < iFixingDate ? java.lang.Math.exp - (org.drip.analytics.support.OptionHelper.IntegratedCrossVolQuanto (vcForward, vcFX, - auForwardFXCorr, iValueDate, iFixingDate)) : 1.)) - return null; - } - - lsConvAdj.add (convAdj); - } - - return lsConvAdj; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Convexity Adjustment for the composable periods that use geometric compounding using the - * specified value date using the market data provided - * - * @param iValueDate The Valuation Date - * @param csqs The Market Curves/Surface - * - * @return The Convexity Adjustment - */ - - public org.drip.analytics.output.ConvexityAdjustment terminalConvexityAdjustment ( - final int iValueDate, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - if (null == csqs || iValueDate >= _iPayDate) - return new org.drip.analytics.output.ConvexityAdjustment(); - - org.drip.state.identifier.CreditLabel creditLabel = creditLabel(); - - org.drip.state.identifier.ForwardLabel forwardLabel = forwardLabel(); - - org.drip.state.identifier.FundingLabel fundingLabel = fundingLabel(); - - org.drip.state.identifier.FXLabel fxLabel = fxLabel(); - - org.drip.state.volatility.VolatilityCurve vcCredit = csqs.creditVolatility (creditLabel); - - org.drip.state.volatility.VolatilityCurve vcForward = csqs.forwardVolatility (forwardLabel); - - org.drip.state.volatility.VolatilityCurve vcFunding = csqs.fundingVolatility (fundingLabel); - - org.drip.state.volatility.VolatilityCurve vcFX = csqs.fxVolatility (fxLabel); - - org.drip.analytics.output.ConvexityAdjustment convAdj = new - org.drip.analytics.output.ConvexityAdjustment(); - - try { - if (!convAdj.setCreditFunding (java.lang.Math.exp - (org.drip.analytics.support.OptionHelper.IntegratedCrossVolQuanto (vcCredit, vcFunding, - csqs.creditFundingCorrelation (creditLabel, fundingLabel), iValueDate, _iPayDate)))) - return null; - - if (isFXMTM() && !convAdj.setCreditFX (java.lang.Math.exp - (org.drip.analytics.support.OptionHelper.IntegratedCrossVolQuanto (vcCredit, vcFX, - csqs.creditFXCorrelation (creditLabel, fxLabel), iValueDate, _iPayDate)))) - return null; - - if (isFXMTM() && !convAdj.setFundingFX (java.lang.Math.exp - (org.drip.analytics.support.OptionHelper.IntegratedCrossVolQuanto (vcFunding, vcFX, - csqs.fundingFXCorrelation (fundingLabel, fxLabel), iValueDate, _iPayDate)))) - return null; - - if (null == forwardLabel) return convAdj; - - org.drip.analytics.cashflow.ComposableUnitPeriod cup = _lsCUP.get (0); - - if (!(cup instanceof org.drip.analytics.cashflow.ComposableUnitFloatingPeriod)) return null; - - int iFixingDate = ((org.drip.analytics.cashflow.ComposableUnitFloatingPeriod) - cup).referenceIndexPeriod().fixingDate(); - - if (iValueDate < iFixingDate) { - if (!convAdj.setCreditForward (java.lang.Math.exp - (org.drip.analytics.support.OptionHelper.IntegratedCrossVolQuanto (vcCredit, vcForward, - csqs.creditForwardCorrelation (creditLabel, forwardLabel), iValueDate, - iFixingDate)))) - return null; - - if (!convAdj.setForwardFunding (java.lang.Math.exp - (org.drip.analytics.support.OptionHelper.IntegratedCrossVolQuanto (vcForward, vcFunding, - csqs.forwardFundingCorrelation (forwardLabel, fundingLabel), iValueDate, - iFixingDate)))) - return null; - - if (isFXMTM() && !convAdj.setForwardFX (java.lang.Math.exp - (org.drip.analytics.support.OptionHelper.IntegratedCrossVolQuanto (vcForward, vcFX, - csqs.forwardFXCorrelation (forwardLabel, fxLabel), iValueDate, iFixingDate)))) - return null; - } - - return convAdj; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Unit Period Convexity Measures - * - * @param iValueDate Valuation Date - * @param csqs The Market Curve Surface/Quote Set - * - * @return The Unit Period Convexity Measures - */ - - public java.util.List unitPeriodConvexityMetrics ( - final int iValueDate, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - java.util.List lsUPCM = new - java.util.ArrayList(); - - int iNumPeriodUnit = _lsCUP.size(); - - try { - if (org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_ARITHMETIC == - _iAccrualCompoundingRule) { - java.util.List lsConvAdj = - periodWiseConvexityAdjustment (iValueDate, csqs); - - if (null == lsConvAdj || iNumPeriodUnit != lsConvAdj.size()) return null; - - for (int i = 0; i < iNumPeriodUnit; ++i) { - org.drip.analytics.cashflow.ComposableUnitPeriod cup = _lsCUP.get (i); - - lsUPCM.add (new org.drip.analytics.output.UnitPeriodConvexityMetrics (cup.startDate(), - cup.endDate(), lsConvAdj.get (i))); - } - } else if (org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - == _iAccrualCompoundingRule) - lsUPCM.add (new org.drip.analytics.output.UnitPeriodConvexityMetrics (startDate(), endDate(), - terminalConvexityAdjustment (iValueDate, csqs))); - - return lsUPCM; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Full Period Coupon Measures - * - * @param iValueDate Valuation Date - * @param csqs The Market Curve Surface/Quote Set - * - * @return The Full Period Coupon Measures - */ - - public org.drip.analytics.output.CompositePeriodCouponMetrics couponMetrics ( - final int iValueDate, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - if (!org.drip.quant.common.NumberUtil.IsValid (iValueDate)) return null; - - java.util.List lsUPM = new - java.util.ArrayList(); - - int iNumPeriodUnit = _lsCUP.size(); - - try { - if (org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_ARITHMETIC == - _iAccrualCompoundingRule) { - java.util.List lsConvAdj = - periodWiseConvexityAdjustment (iValueDate, csqs); - - if (null == lsConvAdj || iNumPeriodUnit != lsConvAdj.size()) return null; - - for (int i = 0; i < iNumPeriodUnit; ++i) { - org.drip.analytics.cashflow.ComposableUnitPeriod cup = _lsCUP.get (i); - - lsUPM.add (new org.drip.analytics.output.UnitPeriodMetrics (cup.startDate(), - cup.endDate(), cup.fullCouponDCF(), cup.fullCouponRate (csqs), lsConvAdj.get (i))); - } - } else if (org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - == _iAccrualCompoundingRule) { - double dblDCF = 0.; - double dblUnitAccrual = 1.; - - for (int i = 0; i < iNumPeriodUnit; ++i) { - org.drip.analytics.cashflow.ComposableUnitPeriod cup = _lsCUP.get (i); - - double dblPeriodDCF = cup.fullCouponDCF(); - - dblDCF += dblPeriodDCF; - - dblUnitAccrual *= (1. + cup.fullCouponRate (csqs) * dblPeriodDCF); - } - - lsUPM.add (new org.drip.analytics.output.UnitPeriodMetrics (startDate(), endDate(), dblDCF, - (dblUnitAccrual - 1.) / dblDCF, terminalConvexityAdjustment (iValueDate, csqs))); - } - - return org.drip.analytics.output.CompositePeriodCouponMetrics.Create (lsUPM); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Coupon Accrual DCF to the specified Accrual End Date - * - * @param iValueDate The Valuation Date - * - * @return The Coupon Accrual DCF to the specified Accrual End Date - * - * @throws java.lang.Exception Thrown if the Accrual DCF cannot be calculated - */ - - public double accrualDCF ( - final int iValueDate) - throws java.lang.Exception - { - if (!contains (iValueDate)) return 0.; - - int iNumPeriodUnit = _lsCUP.size(); - - double dblAccrualDCF = 0.; - - for (int i = 0; i < iNumPeriodUnit; ++i) { - org.drip.analytics.cashflow.ComposableUnitPeriod cup = _lsCUP.get (i); - - int iDateLocation = cup.dateLocation (iValueDate); - - if (org.drip.analytics.cashflow.ComposableUnitFixedPeriod.NODE_INSIDE_SEGMENT == iDateLocation) - dblAccrualDCF += cup.accrualDCF (iValueDate); - else if (org.drip.analytics.cashflow.ComposableUnitFixedPeriod.NODE_RIGHT_OF_SEGMENT == - iDateLocation) - dblAccrualDCF += cup.fullCouponDCF(); - } - - return dblAccrualDCF; - } - - /** - * Compute the Full Coupon DCF - * - * @return The Full Coupon Accrual DCF - * - * @throws java.lang.Exception Thrown if the Full Coupon DCF cannot be calculated - */ - - public double couponDCF() - throws java.lang.Exception - { - int iNumPeriodUnit = _lsCUP.size(); - - double dblAccrualDCF = 0.; - - for (int i = 0; i < iNumPeriodUnit; ++i) - dblAccrualDCF += _lsCUP.get (i).fullCouponDCF(); - - return dblAccrualDCF; - } - - /** - * Compute the Coupon Accrual Measures to the specified Accrual End Date - * - * @param iValueDate The Valuation Date - * @param csqs The Market Curve Surface/Quote Set - * - * @return The Coupon Accrual Measures to the specified Accrual End Date - */ - - public org.drip.analytics.output.CompositePeriodAccrualMetrics accrualMetrics ( - final int iValueDate, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - try { - if (!contains (iValueDate)) return null; - - java.util.List lsUPM = new - java.util.ArrayList(); - - int iNumPeriodUnit = _lsCUP.size(); - - int iResetDate = java.lang.Integer.MIN_VALUE; - - if (org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_ARITHMETIC == - _iAccrualCompoundingRule) { - java.util.List lsConvAdj = - periodWiseConvexityAdjustment (iValueDate, csqs); - - if (null == lsConvAdj || iNumPeriodUnit != lsConvAdj.size()) return null; - - for (int i = 0; i < iNumPeriodUnit; ++i) { - org.drip.analytics.cashflow.ComposableUnitPeriod cup = _lsCUP.get (i); - - int iDateLocation = cup.dateLocation (iValueDate); - - if (org.drip.analytics.cashflow.ComposableUnitFixedPeriod.NODE_INSIDE_SEGMENT == - iDateLocation) { - if (cup instanceof org.drip.analytics.cashflow.ComposableUnitFloatingPeriod) - iResetDate = ((org.drip.analytics.cashflow.ComposableUnitFloatingPeriod) - cup).referenceIndexPeriod().fixingDate(); - - lsUPM.add (new org.drip.analytics.output.UnitPeriodMetrics (cup.startDate(), - iValueDate, cup.accrualDCF (iValueDate), cup.fullCouponRate (csqs), lsConvAdj.get - (i))); - } else if (org.drip.analytics.cashflow.ComposableUnitFixedPeriod.NODE_RIGHT_OF_SEGMENT == - iDateLocation) { - if (cup instanceof org.drip.analytics.cashflow.ComposableUnitFloatingPeriod) - iResetDate = ((org.drip.analytics.cashflow.ComposableUnitFloatingPeriod) - cup).referenceIndexPeriod().fixingDate(); - - lsUPM.add (new org.drip.analytics.output.UnitPeriodMetrics (cup.startDate(), - cup.endDate(), cup.fullCouponDCF(), cup.fullCouponRate (csqs), lsConvAdj.get - (i))); - } - } - } else if (org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - == _iAccrualCompoundingRule) { - double dblAccrualDCF = 0.; - double dblUnitAccrual = 1.; - - for (int i = 0; i < iNumPeriodUnit; ++i) { - org.drip.analytics.cashflow.ComposableUnitPeriod cup = _lsCUP.get (i); - - int iDateLocation = cup.dateLocation (iValueDate); - - if (org.drip.analytics.cashflow.ComposableUnitFixedPeriod.NODE_INSIDE_SEGMENT == - iDateLocation) { - double dblPeriodAccrualDCF = cup.accrualDCF (iValueDate); - - dblAccrualDCF += dblPeriodAccrualDCF; - - dblUnitAccrual *= (1. + cup.fullCouponRate (csqs) * dblPeriodAccrualDCF); - - if (cup instanceof org.drip.analytics.cashflow.ComposableUnitFloatingPeriod) - iResetDate = ((org.drip.analytics.cashflow.ComposableUnitFloatingPeriod) - cup).referenceIndexPeriod().fixingDate(); - } else if (org.drip.analytics.cashflow.ComposableUnitFixedPeriod.NODE_RIGHT_OF_SEGMENT == - iDateLocation) { - double dblPeriodDCF = cup.fullCouponDCF(); - - dblAccrualDCF += dblPeriodDCF; - - dblUnitAccrual *= (1. + cup.fullCouponRate (csqs) * dblPeriodDCF); - - if (cup instanceof org.drip.analytics.cashflow.ComposableUnitFloatingPeriod) - iResetDate = ((org.drip.analytics.cashflow.ComposableUnitFloatingPeriod) - cup).referenceIndexPeriod().fixingDate(); - } - } - - if (0. < dblAccrualDCF) - lsUPM.add (new org.drip.analytics.output.UnitPeriodMetrics (startDate(), iValueDate, - dblAccrualDCF, (dblUnitAccrual - 1.) / dblAccrualDCF, terminalConvexityAdjustment - (iValueDate, csqs))); - } - - return 0 == lsUPM.size() ? null : org.drip.analytics.output.CompositePeriodAccrualMetrics.Create - (iResetDate, lsUPM); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create a set of loss period measures - * - * @param comp Component for which the measures are to be generated - * @param valParams ValuationParams from which the periods are generated - * @param pricerParams PricerParams that control the generation characteristics - * @param iWorkoutDate Double JulianDate representing the absolute end of all the generated periods - * @param csqs Market Parameters - * - * @return The Generated Loss Quadrature Metrics - */ - - public java.util.List lossMetrics ( - final org.drip.product.definition.CreditComponent comp, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final int iWorkoutDate, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - if (null == comp || null == valParams || null == pricerParams || null == csqs || null == - csqs.creditState (comp.creditLabel()) || startDate() > iWorkoutDate) - return null; - - org.drip.state.discount.MergedDiscountForwardCurve dc = csqs.fundingState - (org.drip.state.identifier.FundingLabel.Standard (_strPayCurrency)); - - if (null == dc) return null; - - int iDiscretizationScheme = pricerParams.discretizationScheme(); - - int iEndDate = endDate(); - - int iPeriodEndDate = iEndDate < iWorkoutDate ? iEndDate : iWorkoutDate; - java.util.List lsLQM = null; - - if (org.drip.param.pricer.CreditPricerParams.PERIOD_DISCRETIZATION_DAY_STEP == iDiscretizationScheme - && (null == (lsLQM = - org.drip.analytics.support.LossQuadratureGenerator.GenerateDayStepLossPeriods (comp, - valParams, this, iPeriodEndDate, pricerParams.unitSize(), csqs)) || 0 == lsLQM.size())) - return null; - - if (org.drip.param.pricer.CreditPricerParams.PERIOD_DISCRETIZATION_PERIOD_STEP == - iDiscretizationScheme && (null == (lsLQM = - org.drip.analytics.support.LossQuadratureGenerator.GeneratePeriodUnitLossPeriods (comp, - valParams, this, iPeriodEndDate, pricerParams.unitSize(), csqs)) || 0 == lsLQM.size())) - return null; - - if (org.drip.param.pricer.CreditPricerParams.PERIOD_DISCRETIZATION_FULL_COUPON == - iDiscretizationScheme && (null == (lsLQM = - org.drip.analytics.support.LossQuadratureGenerator.GenerateWholeLossPeriods (comp, valParams, - this, iPeriodEndDate, csqs)) || 0 == lsLQM.size())) - return null; - - return lsLQM; - } - - /** - * Generate the Forward Predictor/Response Constraint - * - * @param iValueDate The Valuation Date - * @param csqs The Market Curve Surface/Quote Set - * @param pqs Product Quote Set - * - * @return The Forward Predictor/Response Constraint - */ - - public org.drip.state.estimator.PredictorResponseWeightConstraint forwardPRWC ( - final int iValueDate, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.product.calib.ProductQuoteSet pqs) - { - if (null == pqs) return null; - - double dblDF = java.lang.Double.NaN; - double dblFX = java.lang.Double.NaN; - double dblBasis = java.lang.Double.NaN; - double dblAccrued = java.lang.Double.NaN; - double dblBaseRate = java.lang.Double.NaN; - double dblNotional = java.lang.Double.NaN; - double dblSurvival = java.lang.Double.NaN; - - org.drip.product.calib.CompositePeriodQuoteSet cpqs = periodQuoteSet (pqs, csqs); - - try { - dblDF = df (csqs); - - dblFX = fx (csqs); - - dblSurvival = survival (csqs); - - int iEndDate = endDate(); - - dblBasis = cpqs.containsBasis() ? cpqs.basis() : 0.; - - dblBaseRate = cpqs.containsBaseRate() ? cpqs.baseRate() : 0.; - - dblNotional = notional (iEndDate) * couponFactor (iEndDate); - - dblAccrued = dblNotional * dblFX * accrualDCF (iValueDate) * (dblBaseRate + dblBasis); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.analytics.output.CompositePeriodCouponMetrics cpm = couponMetrics (iValueDate, csqs); - - if (null == cpm) return null; - - org.drip.state.estimator.PredictorResponseWeightConstraint prwc = new - org.drip.state.estimator.PredictorResponseWeightConstraint(); - - org.drip.state.identifier.ForwardLabel forwardLabel = forwardLabel(); - - if (null == forwardLabel) { - for (org.drip.analytics.output.UnitPeriodMetrics upm : cpm.unitMetrics()) { - if (!prwc.updateValue (-1. * dblNotional * dblFX * upm.dcf() * (dblBaseRate + dblBasis) * - dblSurvival * dblDF * upm.convAdj().cumulative())) - return null; - } - - if (!prwc.updateValue (dblAccrued)) return null; - } else if (!forwardLabel.match (pqs.forwardLabel())) { - java.util.List lsUPM = cpm.unitMetrics(); - - for (int i = 0; i < lsUPM.size(); ++i) { - org.drip.analytics.output.UnitPeriodMetrics upm = lsUPM.get (i); - - try { - if (!prwc.updateValue (-1. * dblNotional * dblFX * upm.dcf() * (_lsCUP.get (i).baseRate - (csqs) + dblBasis) * dblSurvival * dblDF * upm.convAdj().cumulative())) - return null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - if (!prwc.updateValue (dblAccrued)) return null; - } else { - for (org.drip.analytics.output.UnitPeriodMetrics upm : cpm.unitMetrics()) { - int iDateAnchor = upm.endDate(); - - if (cpqs.containsBaseRate()) { - if (!prwc.addPredictorResponseWeight (iDateAnchor, 1.)) return null; - - if (!prwc.addDResponseWeightDManifestMeasure ("PV", iDateAnchor, 1.)) return null; - } else { - double dblForwardLoading = dblNotional * dblFX * upm.dcf() * dblSurvival * dblDF * - upm.convAdj().cumulative(); - - if (!prwc.addPredictorResponseWeight (iDateAnchor, dblForwardLoading)) return null; - - if (!prwc.addDResponseWeightDManifestMeasure ("PV", iDateAnchor, dblForwardLoading)) - return null; - - if (!prwc.updateValue (-1. * dblForwardLoading * dblBasis)) return null; - } - } - - if (!prwc.updateValue (cpqs.containsBaseRate() ? dblBaseRate : dblAccrued)) return null; - } - - if (!prwc.updateDValueDManifestMeasure ("PV", 1.)) return null; - - return prwc; - } - - /** - * Generate the Funding Predictor/Response Constraint - * - * @param iValueDate The Valuation Date - * @param csqs The Market Curve Surface/Quote Set - * @param pqs Product Quote Set - * - * @return The Funding Predictor/Response Constraint - */ - - public org.drip.state.estimator.PredictorResponseWeightConstraint fundingPRWC ( - final int iValueDate, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.product.calib.ProductQuoteSet pqs) - { - if (null == pqs) return null; - - double dblDF = java.lang.Double.NaN; - double dblFX = java.lang.Double.NaN; - double dblBasis = java.lang.Double.NaN; - double dblAccrued = java.lang.Double.NaN; - double dblBaseRate = java.lang.Double.NaN; - double dblNotional = java.lang.Double.NaN; - double dblSurvival = java.lang.Double.NaN; - - org.drip.product.calib.CompositePeriodQuoteSet cpqs = periodQuoteSet (pqs, csqs); - - try { - dblFX = fx (csqs); - - dblSurvival = survival (csqs); - - dblBasis = cpqs.containsBasis() ? cpqs.basis() : 0.; - - dblBaseRate = cpqs.containsBaseRate() ? cpqs.baseRate() : 0.; - - dblNotional = notional (_iPayDate) * couponFactor (_iPayDate); - - dblAccrued = dblNotional * dblFX * accrualDCF (iValueDate) * (dblBaseRate + dblBasis); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.analytics.output.CompositePeriodCouponMetrics cpm = couponMetrics (iValueDate, csqs); - - if (null == cpm) return null; - - org.drip.state.estimator.PredictorResponseWeightConstraint prwc = new - org.drip.state.estimator.PredictorResponseWeightConstraint(); - - org.drip.state.identifier.FundingLabel fundingLabel = fundingLabel(); - - if (!fundingLabel.match (pqs.fundingLabel())) { - try { - dblDF = df (csqs); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (org.drip.analytics.output.UnitPeriodMetrics upm : cpm.unitMetrics()) { - if (!prwc.updateValue (-1. * dblNotional * dblFX * upm.dcf() * (dblBaseRate + dblBasis) * - dblSurvival * dblDF * upm.convAdj().cumulative())) - return null; - } - } else { - for (org.drip.analytics.output.UnitPeriodMetrics upm : cpm.unitMetrics()) { - double dblFundingLoading = dblNotional * dblFX * upm.dcf() * (dblBaseRate + dblBasis) * - dblSurvival * upm.convAdj().cumulative(); - - if (!prwc.addPredictorResponseWeight (_iPayDate, dblFundingLoading)) return null; - - if (!prwc.addDResponseWeightDManifestMeasure ("PV", _iPayDate, dblFundingLoading)) - return null; - } - } - - if (!prwc.updateValue (dblAccrued)) return null; - - if (!prwc.updateDValueDManifestMeasure ("PV", 1.)) return null; - - return prwc; - } - - /** - * Generate the Merged Forward/Funding Predictor/Response Constraint - * - * @param iValueDate The Valuation Date - * @param csqs The Market Curve Surface/Quote Set - * @param pqs Product Quote Set - * - * @return The Merged Forward/Funding Predictor/Response Constraint - */ - - public org.drip.state.estimator.PredictorResponseWeightConstraint forwardFundingPRWC ( - final int iValueDate, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.product.calib.ProductQuoteSet pqs) - { - if (null == pqs) return null; - - org.drip.state.identifier.ForwardLabel forwardLabel = forwardLabel(); - - if (null == forwardLabel || !fundingLabel().match (pqs.fundingLabel())) - return fundingPRWC (iValueDate, csqs, pqs); - - double dblFX = java.lang.Double.NaN; - double dblAccrued = java.lang.Double.NaN; - double dblNotional = java.lang.Double.NaN; - double dblSurvival = java.lang.Double.NaN; - - org.drip.product.calib.CompositePeriodQuoteSet cpqs = periodQuoteSet (pqs, csqs); - - try { - dblFX = fx (csqs); - - dblSurvival = survival (csqs); - - dblNotional = notional (_iPayDate) * couponFactor (_iPayDate); - - dblAccrued = accrualDCF (iValueDate) * cpqs.basis() * dblNotional * dblFX; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.state.estimator.PredictorResponseWeightConstraint prwc = new - org.drip.state.estimator.PredictorResponseWeightConstraint(); - - if (cpqs.containsBaseRate()) { - int iStartDate = startDate(); - - int iEndDate = endDate(); - - org.drip.analytics.cashflow.ComposableUnitPeriod cup = _lsCUP.get (0); - - try { - double dblForwardDF = 1. / (1. + org.drip.analytics.daycount.Convention.YearFraction - (iStartDate, iEndDate, cup.couponDC(), false, null, cup.calendar()) * cpqs.baseRate()); - - if (!prwc.addPredictorResponseWeight (iStartDate, dblNotional * dblForwardDF)) return null; - - if (!prwc.addDResponseWeightDManifestMeasure ("PV", iStartDate, dblNotional * dblForwardDF)) - return null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (!prwc.addPredictorResponseWeight (iEndDate, -1. * dblNotional)) return null; - - if (!prwc.addDResponseWeightDManifestMeasure ("PV", iEndDate, -1. * dblNotional)) return null; - } else { - java.util.List lsUPCM = - unitPeriodConvexityMetrics (iValueDate, csqs); - - if (null == lsUPCM || 0 == lsUPCM.size()) return null; - - for (org.drip.analytics.output.UnitPeriodConvexityMetrics upcm : lsUPCM) { - double dblFundingLoading = dblNotional * dblFX * dblSurvival * upcm.convAdj().cumulative(); - - int iStartDate = upcm.startDate(); - - int iEndDate = upcm.endDate(); - - if (!prwc.addPredictorResponseWeight (iStartDate, dblFundingLoading)) return null; - - if (!prwc.addPredictorResponseWeight (iEndDate, -1. * dblFundingLoading)) return null; - - if (!prwc.addDResponseWeightDManifestMeasure ("PV", iStartDate, dblFundingLoading)) - return null; - - if (!prwc.addDResponseWeightDManifestMeasure ("PV", iEndDate, -1. * dblFundingLoading)) - return null; - } - - if (!prwc.updateValue (dblAccrued)) return null; - } - - if (!prwc.updateDValueDManifestMeasure ("PV", 1.)) return null; - - if (!prwc.addMergeLabel (forwardLabel)) return null; - - return prwc; - } - - /** - * Generate the FX Predictor/Response Constraint - * - * @param iValueDate The Valuation Date - * @param csqs The Market Curve Surface/Quote Set - * @param pqs Product Quote Set - * - * @return The FX Predictor/Response Constraint - */ - - public org.drip.state.estimator.PredictorResponseWeightConstraint fxPRWC ( - final int iValueDate, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.product.calib.ProductQuoteSet pqs) - { - if (null == pqs) return null; - - int iEndDate = endDate(); - - if (iValueDate > iEndDate) return null; - - org.drip.state.identifier.FXLabel fxLabel = fxLabel(); - - if (null == fxLabel || !fxLabel.match (pqs.fxLabel())) return null; - - org.drip.state.estimator.PredictorResponseWeightConstraint prwc = new - org.drip.state.estimator.PredictorResponseWeightConstraint(); - - if (!prwc.addPredictorResponseWeight (iEndDate, 1.)) return null; - - if (!prwc.addDResponseWeightDManifestMeasure ("Outright", iEndDate, 1.)) return null; - - return prwc; - } - - /** - * Generate the Volatility Predictor/Response Constraint - * - * @param iValueDate The Valuation Date - * @param csqs The Market Curve Surface/Quote Set - * @param pqs Product Quote Set - * - * @return The Volatility Predictor/Response Constraint - */ - - public org.drip.state.estimator.PredictorResponseWeightConstraint volatilityPRWC ( - final int iValueDate, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.product.calib.ProductQuoteSet pqs) - { - if (null == pqs) return null; - - int iEndDate = endDate(); - - if (iValueDate > iEndDate) return null; - - org.drip.state.identifier.VolatilityLabel volLabel = pqs.volatilityLabel(); - - if (null == volLabel) return null; - - org.drip.state.identifier.ForwardLabel forwardLabel = forwardLabel(); - - if (null == forwardLabel || !forwardLabel.match (volLabel.underlyingLatentState())) return null; - - org.drip.state.estimator.PredictorResponseWeightConstraint prwc = new - org.drip.state.estimator.PredictorResponseWeightConstraint(); - - if (!prwc.addPredictorResponseWeight (iEndDate, 1.)) return null; - - if (!prwc.addDResponseWeightDManifestMeasure ("OptionPV", iEndDate, 1.)) return null; - - return prwc; - } - - /** - * Retrieve the Period Calibration Quotes from the specified product quote set - * - * @param pqs The Product Quote Set - * @param csqs The Market Curve Surface/Quote Set - * - * @return The Composed Period Quote Set - */ - - public abstract org.drip.product.calib.CompositePeriodQuoteSet periodQuoteSet ( - final org.drip.product.calib.ProductQuoteSet pqs, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs); - - /** - * Retrieve the Period Calibration Basis Quote from the specified product quote set - * - * @param pqs The Product Quote Set - * - * @return The Period Calibration Basis Quote - */ - - public abstract double basisQuote ( - final org.drip.product.calib.ProductQuoteSet pqs); -} diff --git a/org/drip/analytics/cashflow/LossQuadratureMetrics.java b/org/drip/analytics/cashflow/LossQuadratureMetrics.java deleted file mode 100644 index 680559c..0000000 --- a/org/drip/analytics/cashflow/LossQuadratureMetrics.java +++ /dev/null @@ -1,282 +0,0 @@ - -package org.drip.analytics.cashflow; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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 models 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. - */ - -/** - * LossPeriodCurveFactors is an implementation of the period class enhanced by the loss period measures. It - * exports the following functionality: - * - * - Start/end survival probabilities, period effective notional/recovery/discount factor - * - Serialization into and de-serialization out of byte arrays - * - * @author Lakshmi Krishnamurthy - */ - -public class LossQuadratureMetrics { - private int _iEndDate = java.lang.Integer.MIN_VALUE; - private int _iStartDate = java.lang.Integer.MIN_VALUE; - private double _dblAccrualDCF = java.lang.Double.NaN; - private double _dblEffectiveDF = java.lang.Double.NaN; - private double _dblEndSurvival = java.lang.Double.NaN; - private double _dblStartSurvival = java.lang.Double.NaN; - private double _dblEffectiveNotional = java.lang.Double.NaN; - private double _dblEffectiveRecovery = java.lang.Double.NaN; - - /** - * Create an Instance of the LossPeriodCurveFactors using the Period's Dates and Curves to generate the - * Curve Measures - * - * @param iStartDate Period Start Date - * @param iEndDate Period End Date - * @param dblAccrualDCF Period's Accrual Day Count Fraction - * @param dblEffectiveNotional Period's Effective Notional - * @param dblEffectiveRecovery Period's Effective Recovery - * @param dc Discount Curve - * @param cc Credit Curve - * @param iDefaultLag Default Pay Lag - * - * @return LossPeriodCurveFactors instance - */ - - public static final LossQuadratureMetrics MakeDefaultPeriod ( - final int iStartDate, - final int iEndDate, - final double dblAccrualDCF, - final double dblEffectiveNotional, - final double dblEffectiveRecovery, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.state.credit.CreditCurve cc, - final int iDefaultLag) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblAccrualDCF) || - !org.drip.quant.common.NumberUtil.IsValid (dblEffectiveNotional) || - !org.drip.quant.common.NumberUtil.IsValid (dblEffectiveRecovery) || null == dc || null == cc) - return null; - - try { - return new LossQuadratureMetrics (iStartDate, iEndDate, cc.survival (iStartDate), cc.survival - (iEndDate), dblAccrualDCF, dblEffectiveNotional, dblEffectiveRecovery, dc.effectiveDF - (iStartDate + iDefaultLag, iEndDate + iDefaultLag)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create a LossPeriodCurveFactors instance from the period dates and the curve measures - * - * @param iStartDate Period Start Date - * @param iEndDate Period End Date - * @param dblAccrualDCF Period's Accrual Day Count Fraction - * @param dblEffectiveNotional Period's Effective Notional - * @param dc Discount Curve - * @param cc Credit Curve - * @param iDefaultLag Default Pay Lag - * - * @return LossPeriodCurveFactors instance - */ - - public static final LossQuadratureMetrics MakeDefaultPeriod ( - final int iStartDate, - final int iEndDate, - final double dblAccrualDCF, - final double dblEffectiveNotional, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.state.credit.CreditCurve cc, - final int iDefaultLag) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblAccrualDCF) || - !org.drip.quant.common.NumberUtil.IsValid (dblEffectiveNotional) || null == dc || null == cc) - return null; - - try { - return new LossQuadratureMetrics (iStartDate, iEndDate, cc.survival (iStartDate), cc.survival - (iEndDate), dblAccrualDCF, dblEffectiveNotional, cc.effectiveRecovery (iStartDate + - iDefaultLag, iEndDate + iDefaultLag), dc.effectiveDF (iStartDate + iDefaultLag, iEndDate - + iDefaultLag)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Elaborate LossPeriodCurveFactors constructor - * - * @param iStartDate Period Start Date - * @param iEndDate Period End Date - * @param dblStartSurvival Period Start Survival - * @param dblEndSurvival Period End Survival - * @param dblAccrualDCF Period Accrual DCF - * @param dblEffectiveNotional Period Effective Notional - * @param dblEffectiveRecovery Period Effective Recovery - * @param dblEffectiveDF Period Effective Discount Factor - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public LossQuadratureMetrics ( - final int iStartDate, - final int iEndDate, - final double dblStartSurvival, - final double dblEndSurvival, - final double dblAccrualDCF, - final double dblEffectiveNotional, - final double dblEffectiveRecovery, - final double dblEffectiveDF) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblStartSurvival = dblStartSurvival) || - !org.drip.quant.common.NumberUtil.IsValid (_dblEndSurvival = dblEndSurvival) || - !org.drip.quant.common.NumberUtil.IsValid (_dblAccrualDCF = dblAccrualDCF) || - !org.drip.quant.common.NumberUtil.IsValid (_dblEffectiveNotional = dblEffectiveNotional) - || !org.drip.quant.common.NumberUtil.IsValid (_dblEffectiveRecovery = - dblEffectiveRecovery) || !org.drip.quant.common.NumberUtil.IsValid - (_dblEffectiveDF = dblEffectiveDF)) - throw new java.lang.Exception ("LossPeriodCurveFactors ctr: Invalid params"); - - _iEndDate = iEndDate; - _iStartDate = iStartDate; - } - - /** - * Period Start Date - * - * @return Period Start Date - */ - - public int startDate() - { - return _iStartDate; - } - - /** - * Survival Probability at the period beginning - * - * @return Survival Probability at the period beginning - */ - - public double startSurvival() - { - return _dblStartSurvival; - } - - /** - * Period End Date - * - * @return Period End Date - */ - - public int endDate() - { - return _iEndDate; - } - - /** - * Survival at the period end - * - * @return Survival at the period end - */ - - public double endSurvival() - { - return _dblEndSurvival; - } - - /** - * Get the period's effective notional - * - * @return Period's effective notional - */ - - public double effectiveNotional() - { - return _dblEffectiveNotional; - } - - /** - * Get the period's effective recovery - * - * @return Period's effective recovery - */ - - public double effectiveRecovery() - { - return _dblEffectiveRecovery; - } - - /** - * Get the period's effective discount factor - * - * @return Period's effective discount factor - */ - - public double effectiveDF() - { - return _dblEffectiveDF; - } - - /** - * Get the period's Accrual Day Count Fraction - * - * @return Period's Accrual Day Count Fraction - */ - - public double accrualDCF() - { - return _dblAccrualDCF; - } -} diff --git a/org/drip/analytics/cashflow/ReferenceIndexPeriod.java b/org/drip/analytics/cashflow/ReferenceIndexPeriod.java deleted file mode 100644 index 31486b3..0000000 --- a/org/drip/analytics/cashflow/ReferenceIndexPeriod.java +++ /dev/null @@ -1,151 +0,0 @@ - -package org.drip.analytics.cashflow; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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 models 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. - */ - -/** - * ReferenceIndexPeriod contains the cash flow period details. Currently it holds the start date, the end - * date, the fixing date, and the reference floating index if any. - * - * @author Lakshmi Krishnamurthy - */ - -public class ReferenceIndexPeriod { - private double _dblDCF = java.lang.Double.NaN; - private int _iEndDate = java.lang.Integer.MIN_VALUE; - private int _iStartDate = java.lang.Integer.MIN_VALUE; - private int _iFixingDate = java.lang.Integer.MIN_VALUE; - private org.drip.state.identifier.ForwardLabel _forwardLabel = null; - - /** - * The ReferenceIndexPeriod constructor - * - * @param iStartDate The Reference Period Start Date - * @param iEndDate The Reference Period End Date - * @param forwardLabel The Period Forward Label - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ReferenceIndexPeriod ( - final int iStartDate, - final int iEndDate, - final org.drip.state.identifier.ForwardLabel forwardLabel) - throws java.lang.Exception - { - if ((_iEndDate = iEndDate) <= (_iStartDate = iStartDate) || null == (_forwardLabel = forwardLabel)) - throw new java.lang.Exception ("ReferenceIndexPeriod ctr: Invalid Inputs"); - - org.drip.analytics.daycount.DateAdjustParams dapFixing = - _forwardLabel.floaterIndex().spotLagDAPBackward(); - - _iFixingDate = null == dapFixing ? iStartDate : dapFixing.roll (iStartDate); - - org.drip.param.period.UnitCouponAccrualSetting ucas = _forwardLabel.ucas(); - - _dblDCF = ucas.couponDCFOffOfFreq() ? 1. / ucas.freq() : - org.drip.analytics.daycount.Convention.YearFraction (_iStartDate, _iEndDate, ucas.couponDC(), - ucas.couponEOMAdjustment(), null, ucas.calendar()); - } - - /** - * Reference Period Start Date - * - * @return The Reference Period Start Date - */ - - public int startDate() - { - return _iStartDate; - } - - /** - * Reference Period End Date - * - * @return The Reference Period End Date - */ - - public int endDate() - { - return _iEndDate; - } - - /** - * Reference Period Fixing Date - * - * @return The Reference Period Fixing Date - */ - - public int fixingDate() - { - return _iFixingDate; - } - - /** - * Retrieve the Forward Label - * - * @return The Forward Label - */ - - public org.drip.state.identifier.ForwardLabel forwardLabel() - { - return _forwardLabel; - } - - /** - * Retrieve the Reference Period Day Count Fraction - * - * @return The Reference Period Day Count Fraction - */ - - public double dcf() - { - return _dblDCF; - } -} diff --git a/org/drip/analytics/date/DateTime.java b/org/drip/analytics/date/DateTime.java deleted file mode 100644 index cc3fdfa..0000000 --- a/org/drip/analytics/date/DateTime.java +++ /dev/null @@ -1,128 +0,0 @@ - -package org.drip.analytics.date; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * This class provides the representation of the instantiation-time date and time objects. It provides the - * following functionality: - * - Instantiation-time and Explicit Date/Time Construction - * - Retrieval of Date/Time Fields - * - Serialization/De-serialization to and from Byte Arrays - * - * @author Lakshmi Krishnamurthy - */ - -public class DateTime { - private long _lTime = 0L; - private double _dblDate = java.lang.Double.NaN; - - /** - * Default constructor initializes the time and date to the current time and current date. - * - * @throws java.lang.Exception Thrown if the DateTime Instance cnnot be created - */ - - public DateTime() - throws java.lang.Exception - { - _lTime = System.nanoTime(); - - java.util.Date dtNow = new java.util.Date(); - - _dblDate = org.drip.analytics.date.DateUtil.ToJulian (org.drip.analytics.date.DateUtil.Year (dtNow), - org.drip.analytics.date.DateUtil.Month (dtNow), org.drip.analytics.date.DateUtil.Day (dtNow)); - } - - /** - * Constructs DateTime from separate date and time inputs - * - * @param dblDate Date - * @param lTime Time - * - * @throws java.lang.Exception Thrown on Invalid Inputs - */ - - public DateTime ( - final double dblDate, - final long lTime) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblDate)) - throw new java.lang.Exception ("DateTime ctr: Invalid Inputs!"); - - _lTime = lTime; - _dblDate = dblDate; - } - - /** - * Retrieve the Date - * - * @return date - */ - - public double date() - { - return _dblDate; - } - - /** - * Retrieve the time - * - * @return time - */ - - public long time() - { - return _lTime; - } -} diff --git a/org/drip/analytics/date/DateUtil.java b/org/drip/analytics/date/DateUtil.java deleted file mode 100644 index bce5006..0000000 --- a/org/drip/analytics/date/DateUtil.java +++ /dev/null @@ -1,1201 +0,0 @@ - -package org.drip.analytics.date; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * DateUtil contains Various Utilities for manipulating Date. The Julian Date - Gregorian Date Inter - * Conversion follows the following References: - * - * 1) Fliegel, H. F., and T. C. van Flandern (1968): A Machine Algorithm for Processing Calendar Dates, - * Communications of the ACM 11 657. - * - * 2) Fenton, D. (2001): Julian to Calendar Date Conversion, - * http://mathforum.org/library/drmath/view/51907.html. - * - * @author Lakshmi Krishnamurthy - */ - -public class DateUtil { - - /** - * HALF_SECOND Constant for Julian Date Construction - */ - - public static double HALFSECOND = 0.5; - - /** - * JGREG Constant for Julian Date Construction - */ - - public static int JGREG = 15 + 31 * (10 + 12 * 1582); - - /** - * LEFT_INCLUDE includes the start date in the Feb29 check - */ - - public static final int LEFT_INCLUDE = 1; - - /** - * RIGHT_INCLUDE includes the end date in the Feb29 check - */ - - public static final int RIGHT_INCLUDE = 2; - - /** - * Days of the week - Monday - */ - - public static final int MONDAY = 0; - - /** - * Days of the week - Tuesday - */ - - public static final int TUESDAY = 1; - - /** - * Days of the week - Wednesday - */ - - public static final int WEDNESDAY = 2; - - /** - * Days of the week - Thursday - */ - - public static final int THURSDAY = 3; - - /** - * Days of the week - Friday - */ - - public static final int FRIDAY = 4; - - /** - * Days of the week - Saturday - */ - - public static final int SATURDAY = 5; - - /** - * Days of the week - Sunday - */ - - public static final int SUNDAY = 6; - - /** - * Integer Month - January - */ - - public static final int JANUARY = 1; - - /** - * Integer Month - February - */ - - public static final int FEBRUARY = 2; - - /** - * Integer Month - March - */ - - public static final int MARCH = 3; - - /** - * Integer Month - April - */ - - public static final int APRIL = 4; - - /** - * Integer Month - May - */ - - public static final int MAY = 5; - - /** - * Integer Month - June - */ - - public static final int JUNE = 6; - - /** - * Integer Month - July - */ - - public static final int JULY = 7; - - /** - * Integer Month - August - */ - - public static final int AUGUST = 8; - - /** - * Integer Month - September - */ - - public static final int SEPTEMBER = 9; - - /** - * Integer Month - October - */ - - public static final int OCTOBER = 10; - - /** - * Integer Month - November - */ - - public static final int NOVEMBER = 11; - - /** - * Integer Month - December - */ - - public static final int DECEMBER = 12; - - /** - * Convert YMD to an Integer Julian Date. - * - * @param iYear Year - * @param iMonth Month - * @param iDay Day - * - * @return Integer representing the Julian Date - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public static int ToJulian ( - final int iYear, - final int iMonth, - final int iDay) - throws java.lang.Exception - { - if (0 > iYear || 0 > iMonth || 0 > iDay) - throw new java.lang.Exception ("DateUtil::ToJulian => Invalid Inputs"); - - int iM1 = (iMonth - 14) / 12; - int iY1 = iYear + 4800; - return 1461 * (iY1 + iM1) / 4 + 367 * (iMonth - 2 - 12 * iM1) / 12 - - (3 * ((iY1 + iM1 + 100) / 100)) / 4 + iDay - 32075; - } - - /** - * Create an YYYY/MM/DD String from the Input Julian Integer - * - * @param iJulian Integer representing Julian Date - * - * @return YYYY/MM/DD Date String - */ - - public static java.lang.String YYYYMMDD ( - final int iJulian) - { - int iP = iJulian + 68569; - int iQ = 4 * iP / 146097; - int iR = iP - (146097 * iQ + 3) / 4; - int iS = 4000 * (iR + 1) / 1461001; - int iT = iR - (1461 * iS / 4) + 31; - int iU = 80 * iT / 2447; - int iV = iU / 11; - int iY = 100 * (iQ - 49) + iS + iV; - int iM = iU + 2 - 12 * iV; - int iD = iT - (2447 * iU / 80); - - return "" + iY + "/" + org.drip.quant.common.FormatUtil.FormatDouble (iM, 2, 0, 1., false) + "/" + - org.drip.quant.common.FormatUtil.FormatDouble (iD, 2, 0, 1., false); - } - - /** - * Create an DD/MMM/YYYY String from the Input Julian Integer - * - * @param iJulian Integer representing Julian Date - * - * @return DD/MMM/YYYY Date String - */ - - public static java.lang.String DDMMMYYYY ( - final int iJulian) - { - int iP = iJulian + 68569; - int iQ = 4 * iP / 146097; - int iR = iP - (146097 * iQ + 3) / 4; - int iS = 4000 * (iR + 1) / 1461001; - int iT = iR - (1461 * iS / 4) + 31; - int iU = 80 * iT / 2447; - int iV = iU / 11; - int iY = 100 * (iQ - 49) + iS + iV; - int iM = iU + 2 - 12 * iV; - int iD = iT - (2447 * iU / 80); - - return org.drip.quant.common.FormatUtil.FormatDouble (iD, 2, 0, 1., false) + "-" + MonthTrigram (iM) - + "-" + iY; - } - - /** - * Return the Year corresponding to the Julian Date - * - * @param iJulian Integer representing Julian Date - * - * @return integer representing the month - * - * @throws java.lang.Exception Thrown if the Input Date in invalid - */ - - public static int Year ( - final int iJulian) - throws java.lang.Exception - { - int iP = iJulian + 68569; - int iQ = 4 * iP / 146097; - int iR = iP - (146097 * iQ + 3) / 4; - int iS = 4000 * (iR + 1) / 1461001; - int iT = iR - (1461 * iS / 4) + 31; - int iU = 80 * iT / 2447; - int iV = iU / 11; - return 100 * (iQ - 49) + iS + iV; - } - - /** - * Return the Month given the Julian Date represented by the Integer. - * - * @param iJulian Integer representing Julian Date - * - * @return Integer representing the Month - * - * @throws java.lang.Exception Thrown if the Input Date is invalid - */ - - public static int Month ( - final int iJulian) - throws java.lang.Exception - { - int iP = iJulian + 68569; - int iQ = 4 * iP / 146097; - int iR = iP - (146097 * iQ + 3) / 4; - int iS = 4000 * (iR + 1) / 1461001; - int iT = iR - (1461 * iS / 4) + 31; - int iU = 80 * iT / 2447; - int iV = iU / 11; - return iU + 2 - 12 * iV; - } - - /** - * Return the Date given the Julian Date represented by the Integer. - * - * @param iJulian Integer representing Julian Date - * - * @return Integer representing the Date - * - * @throws java.lang.Exception Thrown if the Input Date is invalid - */ - - public static int Date ( - final int iJulian) - throws java.lang.Exception - { - int iP = iJulian + 68569; - int iQ = 4 * iP / 146097; - int iR = iP - (146097 * iQ + 3) / 4; - int iS = 4000 * (iR + 1) / 1461001; - int iT = iR - (1461 * iS / 4) + 31; - int iU = 80 * iT / 2447; - return iT - (2447 * iU / 80); - } - - /** - * Return the Vintage corresponding to the Julian Date - * - * @param iJulian Integer representing Julian Date - * - * @return String Representing the Vintage - */ - - public static java.lang.String Vintage ( - final int iJulian) - { - int iP = iJulian + 68569; - int iQ = 4 * iP / 146097; - int iR = iP - (146097 * iQ + 3) / 4; - int iS = 4000 * (iR + 1) / 1461001; - int iT = iR - (1461 * iS / 4) + 31; - int iU = 80 * iT / 2447; - int iV = iU / 11; - int iY = 100 * (iQ - 49) + iS + iV; - int iM = iU + 2 - 12 * iV; - - return MonthTrigram (iM) + "-" + iY; - } - - /** - * Number of Days elapsed in the Year represented by the given Julian Date - * - * @param iDate Integer representing Julian Date - * - * @return Integer representing the Number of Days in the Current Year - * - * @throws java.lang.Exception Thrown if the Input Date is invalid - */ - - public static final int DaysElapsed ( - final int iDate) - throws java.lang.Exception - { - return iDate - ToJulian (Year (iDate), JANUARY, 1); - } - - /** - * Number of Days remaining in the Year represented by the given Julian Date - * - * @param iDate Integer representing Julian Date - * - * @return Integer representing the Number of Days remaining in the Current Year - * - * @throws java.lang.Exception Thrown if the Input Date is invalid - */ - - public static final int DaysRemaining ( - final int iDate) - throws java.lang.Exception - { - return ToJulian (Year (iDate), DECEMBER, 31) - iDate; - } - - /** - * Indicate if the Year of the given Julian Date is a Leap Year - * - * @param iDate Input Date - * - * @return TRUE - Date falls on a Leap Year - * - * @throws java.lang.Exception Thrown if Input is invalid - */ - - public static final boolean IsLeapYear ( - final int iDate) - throws java.lang.Exception - { - return 0 == (Year (iDate) % 4); - } - - /** - * Indicate whether there is at least One Leap Day between 2 given Dates - * - * @param iStartDate The Start Date - * @param iEndDate The End Date - * @param iIncludeSide INCLUDE_LEFT or INCLUDE_RIGHT indicating whether the starting date, the ending - * date, or both dates are to be included - * - * @return TRUE - There is at least One Feb29 between the Dates - * - * @throws java.lang.Exception If inputs are invalid - */ - - public static final boolean ContainsFeb29 ( - final int iStartDate, - final int iEndDate, - final int iIncludeSide) - throws java.lang.Exception - { - if (iStartDate >= iEndDate) return false; - - int iLeftDate = iStartDate; - int iRightDate = iEndDate; - - if (0 == (iIncludeSide & LEFT_INCLUDE)) ++iLeftDate; - - if (0 == (iIncludeSide & RIGHT_INCLUDE)) --iRightDate; - - for (int iDate = iLeftDate; iDate <= iRightDate; ++iDate) { - if (FEBRUARY == Month (iDate) && 29 == Date (iDate)) return true; - } - - return false; - } - - /** - * Calculate how many Leap Days exist between the 2 given Dates - * - * @param iStartDate The Start Date - * @param iEndDate The End Date - * @param iIncludeSide INCLUDE_LEFT or INCLUDE_RIGHT indicating whether the starting date, the ending - * date, or both dates are to be included - * - * @return Number of Leap Days - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public static final int NumFeb29 ( - final int iStartDate, - final int iEndDate, - final int iIncludeSide) - throws java.lang.Exception - { - int iNumFeb29 = 0; - boolean bLoop = true; - int iDate = iStartDate; - - while (bLoop) { - int iPeriodEndDate = iDate + 365; - - if (iPeriodEndDate > iEndDate) { - bLoop = false; - iPeriodEndDate = iEndDate; - } - - if (ContainsFeb29 (iDate, iPeriodEndDate, iIncludeSide)) ++iNumFeb29; - - iDate = iPeriodEndDate; - } - - return iNumFeb29; - } - - /** - * Return the English word corresponding to the input integer month - * - * @param iMonth Integer representing the month - * - * @return String of the English word - */ - - public static final java.lang.String MonthChar ( - final int iMonth) - { - if (JANUARY == iMonth) return "January"; - - if (FEBRUARY == iMonth) return "February"; - - if (MARCH == iMonth) return "March"; - - if (APRIL == iMonth) return "April"; - - if (MAY == iMonth) return "May"; - - if (JUNE == iMonth) return "June"; - - if (JULY == iMonth) return "July"; - - if (AUGUST == iMonth) return "August"; - - if (SEPTEMBER == iMonth) return "September"; - - if (OCTOBER == iMonth) return "October"; - - if (NOVEMBER == iMonth) return "November"; - - if (DECEMBER == iMonth) return "December"; - - return null; - } - - /** - * Return the Month Trigram corresponding to the Input Integer Month - * - * @param iMonth Integer representing the Month - * - * @return String representing the Month Trigram (used, e.g., in Oracle DB) - */ - - public static java.lang.String MonthTrigram ( - final int iMonth) - { - if (JANUARY == iMonth) return "JAN"; - - if (FEBRUARY == iMonth) return "FEB"; - - if (MARCH == iMonth) return "MAR"; - - if (APRIL == iMonth) return "APR"; - - if (MAY == iMonth) return "MAY"; - - if (JUNE == iMonth) return "JUN"; - - if (JULY == iMonth) return "JUL"; - - if (AUGUST == iMonth) return "AUG"; - - if (SEPTEMBER == iMonth) return "SEP"; - - if (OCTOBER == iMonth) return "OCT"; - - if (NOVEMBER == iMonth) return "NOV"; - - if (DECEMBER == iMonth) return "DEC"; - - return null; - } - - /** - * Convert the month trigram/word to the corresponding month integer - * - * @param strMonth Month trigram or English Word - * - * @return Integer representing the Month - * - * @throws java.lang.Exception Thrown on Invalid Input Month - */ - - public static final int MonthFromMonthChars ( - final java.lang.String strMonth) - throws java.lang.Exception - { - if (null == strMonth || strMonth.isEmpty()) - throw new java.lang.Exception ("DateUtil::MonthFromMonthChars => Invalid Month!"); - - if (strMonth.equalsIgnoreCase ("JAN") || strMonth.equalsIgnoreCase ("JANUARY")) return JANUARY; - - if (strMonth.equalsIgnoreCase ("FEB") || strMonth.equalsIgnoreCase ("FEBRUARY")) return FEBRUARY; - - if (strMonth.equalsIgnoreCase ("MAR") || strMonth.equalsIgnoreCase ("MARCH")) return MARCH; - - if (strMonth.equalsIgnoreCase ("APR") || strMonth.equalsIgnoreCase ("APRIL")) return APRIL; - - if (strMonth.equalsIgnoreCase ("MAY")) return MAY; - - if (strMonth.equalsIgnoreCase ("JUN") || strMonth.equalsIgnoreCase ("JUNE")) return JUNE; - - if (strMonth.equalsIgnoreCase ("JUL") || strMonth.equalsIgnoreCase ("JULY")) return JULY; - - if (strMonth.equalsIgnoreCase ("AUG") || strMonth.equalsIgnoreCase ("AUGUST")) return AUGUST; - - if (strMonth.equalsIgnoreCase ("SEP") || strMonth.equalsIgnoreCase ("SEPTEMBER") || - strMonth.equalsIgnoreCase ("SEPT")) - return SEPTEMBER; - - if (strMonth.equalsIgnoreCase ("OCT") || strMonth.equalsIgnoreCase ("OCTOBER")) return OCTOBER; - - if (strMonth.equalsIgnoreCase ("NOV") || strMonth.equalsIgnoreCase ("NOVEMBER")) return NOVEMBER; - - if (strMonth.equalsIgnoreCase ("DEC") || strMonth.equalsIgnoreCase ("DECEMBER")) return DECEMBER; - - throw new java.lang.Exception ("DateUtil::MonthFromMonthChars => Invalid Month: " + strMonth); - } - - /** - * Get the English word for day corresponding to the input integer - * - * @param iDay Integer representing the day - * - * @return String representing the English word for the day - */ - - public static java.lang.String DayChars ( - final int iDay) - { - if (MONDAY == iDay) return "Monday"; - - if (TUESDAY == iDay) return "Tuesday"; - - if (WEDNESDAY == iDay) return "Wednesday"; - - if (THURSDAY == iDay) return "Thursday"; - - if (FRIDAY == iDay) return "Friday"; - - if (SATURDAY == iDay) return "Saturday"; - - if (SUNDAY == iDay) return "Sunday"; - - return ""; - } - - /** - * Get the maximum number of days in the given month and year - * - * @param iMonth Integer representing the month - * @param iYear Integer representing the year - * - * @return Integer representing the maximum days - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public static final int DaysInMonth ( - final int iMonth, - final int iYear) - throws java.lang.Exception - { - if (JANUARY == iMonth) return 31; - - if (FEBRUARY == iMonth) return 0 == (iYear % 4) ? 29 : 28; - - if (MARCH == iMonth) return 31; - - if (APRIL == iMonth) return 30; - - if (MAY == iMonth) return 31; - - if (JUNE == iMonth) return 30; - - if (JULY == iMonth) return 31; - - if (AUGUST == iMonth) return 31; - - if (SEPTEMBER == iMonth) return 30; - - if (OCTOBER == iMonth) return 31; - - if (NOVEMBER == iMonth) return 30; - - if (DECEMBER == iMonth) return 31; - - throw new java.lang.Exception ("DateUtil::DaysInMonth => Invalid Month: " + iMonth); - } - - /** - * Indicate if the given Date corresponds to a Month End - * - * @param iDate The Date - * - * @return TRUE - Date Corresponds to EOM - * - * @throws java.lang.Exception Thrown if input date is invalid - */ - - public static final boolean IsEOM ( - final int iDate) - throws java.lang.Exception - { - return Date (iDate) == DaysInMonth (Month (iDate), Year (iDate)) ? true : false; - } - - /** - * Create a JulianDate from the Year/Month/Date - * - * @param iYear Year - * @param iMonth Month - * @param iDate Date - * - * @return Julian Date corresponding to the specified Year/Month/Date - */ - - public static final org.drip.analytics.date.JulianDate CreateFromYMD ( - final int iYear, - final int iMonth, - final int iDate) - { - try { - return new org.drip.analytics.date.JulianDate (ToJulian (iYear, iMonth, iDate)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Return a Julian Date corresponding to Today - * - * @return JulianDate corresponding to Today - */ - - public static final org.drip.analytics.date.JulianDate Today() - { - java.util.Date dtNow = new java.util.Date(); - - try { - return CreateFromYMD (Year (dtNow), Month (dtNow), Day (dtNow)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create a JulianDate from a String containing the Date in the DDMMMYYYY Format - * - * @param strDate String containing the Date in the DDMMMYYYY Format - * - * @return The JulianDate Instance - */ - - public static final JulianDate CreateFromDDMMMYYYY ( - final java.lang.String strDate) - { - if (null == strDate || strDate.isEmpty()) return null; - - java.lang.String[] astrParts = strDate.split ("-"); - - if (3 != astrParts.length) return null; - - try { - return CreateFromYMD (new java.lang.Integer (astrParts[2]), MonthFromMonthChars (astrParts[1]), - new java.lang.Integer (astrParts[0])); - } catch (java.lang.Exception e) { - } - - return null; - } - - /** - * Create a JulianDate from a String containing Date in the DDMMYYYY Format - * - * @param strMDY String containing Date in the MM/DD/YYYY Format - * @param strDelim String Delimiter - * - * @return The JulianDate Instance - */ - - public static final org.drip.analytics.date.JulianDate CreateFromMDY ( - final java.lang.String strMDY, - final java.lang.String strDelim) - { - if (null == strMDY || strMDY.isEmpty() || null == strDelim || strDelim.isEmpty()) return null; - - java.lang.String[] astrParts = strMDY.split (strDelim); - - if (3 != astrParts.length) return null; - - try { - return CreateFromYMD (new java.lang.Integer (astrParts[2]), new java.lang.Integer (astrParts[0]), - new java.lang.Integer (astrParts[1])); - } catch (java.lang.Exception e) { - } - - return null; - } - - /** - * Create a JulianDate from a String containing Date in the YYYYMMDD Format - * - * @param strYMD String containing Date in the YYYYMMDD Format - * @param strDelim String Delimiter - * - * @return The JulianDate Instance - */ - - public static final org.drip.analytics.date.JulianDate CreateFromYMD ( - final java.lang.String strYMD, - final java.lang.String strDelim) - { - if (null == strYMD || strYMD.isEmpty() || null == strDelim || strDelim.isEmpty()) return null; - - java.lang.String[] astrParts = strYMD.split (strDelim); - - if (3 != astrParts.length) return null; - - try { - return CreateFromYMD (new java.lang.Integer (astrParts[0]), new java.lang.Integer (astrParts[1]), - new java.lang.Integer (astrParts[2])); - } catch (java.lang.Exception e) { - } - - return null; - } - - /** - * Return the Day of the Week corresponding to the java.util.Date Instance - * - * @param dt The java.util.Date Instance - * - * @return The Day Of The Week - * - * @throws java.lang.Exception Thrown if Input Date is invalid - */ - - public static final int DayOfTheWeek ( - final java.util.Date dt) - throws java.lang.Exception - { - if (null == dt) throw new java.lang.Exception ("DateUtil::DayOfTheWeek => Invalid Date"); - - java.util.Calendar cal = java.util.Calendar.getInstance(); - - cal.setTime (dt); - - return cal.get (java.util.Calendar.DAY_OF_WEEK); - } - - /** - * Return the Day corresponding to the java.util.Date Instance - * - * @param dt The java.util.Date Instance - * - * @return The Day - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public static final int Day ( - final java.util.Date dt) - throws java.lang.Exception - { - if (null == dt) throw new java.lang.Exception ("DateUtil::Day => Invalid Date"); - - java.util.Calendar cal = java.util.Calendar.getInstance(); - - cal.setTime (dt); - - return cal.get (java.util.Calendar.DATE); - } - - /** - * Return the Month corresponding to the java.util.Date Instance. 1 is January, and 12 is December - * - * @param dt The java.util.Date Instance - * - * @return The Month - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public static final int Month ( - final java.util.Date dt) - throws java.lang.Exception - { - if (null == dt) throw new java.lang.Exception ("DateUtil::Month => Invalid Date"); - - java.util.Calendar cal = java.util.Calendar.getInstance(); - - cal.setTime (dt); - - return cal.get (java.util.Calendar.MONTH) + 1; - } - - /** - * Return the Year corresponding to the java.util.Date Instance - * - * @param dt The java.util.Date Instance - * - * @return The Year - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public static final int Year ( - final java.util.Date dt) - throws java.lang.Exception - { - if (null == dt) throw new java.lang.Exception ("DateUtil::Year => Invalid Date"); - - java.util.Calendar cal = java.util.Calendar.getInstance(); - - cal.setTime (dt); - - return cal.get (java.util.Calendar.YEAR); - } - - /** - * Create an Oracle Date Trigram from a YYYYMMDD String - * - * @param strYYYYMMDD Date String in the YYYYMMDD Format. - * - * @return Oracle Date Trigram String - */ - - public static java.lang.String MakeOracleDateFromYYYYMMDD ( - final java.lang.String strYYYYMMDD) - { - if (null == strYYYYMMDD || strYYYYMMDD.isEmpty()) return null; - - try { - return strYYYYMMDD.substring (6) + "-" + MonthTrigram ((new java.lang.Integer - (strYYYYMMDD.substring (4, 6))).intValue()) + "-" + strYYYYMMDD.substring (0, 4); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Oracle date trigram from a Bloomberg date string - * - * @param strBBGDate Bloomberg date string - * - * @return Oracle date trigram string - */ - - public static java.lang.String MakeOracleDateFromBBGDate ( - final java.lang.String strBBGDate) - { - if (null == strBBGDate || strBBGDate.isEmpty()) return null; - - java.util.StringTokenizer st = new java.util.StringTokenizer (strBBGDate, "/"); - - try { - java.lang.String strMonth = MonthTrigram (new java.lang.Integer (st.nextToken())); - - if (null == strMonth) return null; - - return st.nextToken() + "-" + strMonth + "-" + st.nextToken(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create a JulianDate from the java Date - * - * @param dt Java Date input - * - * @return JulianDate output - */ - - public static final org.drip.analytics.date.JulianDate MakeJulianFromRSEntry ( - final java.util.Date dt) - { - if (null == dt) return null; - - try { - return CreateFromYMD (Year (dt), Month (dt), Day (dt)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve a Java Date Instance from the Julian Date Instance - * - * @param dt Julian Date Instance - * - * @return The Java Date Instance - */ - - public static final java.util.Date JavaDateFromJulianDate ( - final org.drip.analytics.date.JulianDate dt) - { - if (null == dt) return null; - - java.util.Calendar cal = java.util.Calendar.getInstance(); - - int iDate = dt.julian(); - - try { - cal.set (Year (iDate), Month (iDate) - 1, Date (iDate)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return cal.getTime(); - } - - /** - * Create a JulianDate from the DD MMM YY - * - * @param strDDMMMYY Java Date input as delimited DD MMM YY - * @param strDelim Delimiter - * - * @return JulianDate output - */ - - public static final org.drip.analytics.date.JulianDate MakeJulianFromDDMMMYY ( - final java.lang.String strDDMMMYY, - final java.lang.String strDelim) - { - if (null == strDDMMMYY || strDDMMMYY.isEmpty() || null == strDelim || strDelim.isEmpty()) - return null; - - java.lang.String[] astrDMY = strDDMMMYY.split (strDelim); - - if (null == astrDMY || 3 != astrDMY.length) return null; - - try { - return CreateFromYMD (2000 + new java.lang.Integer (astrDMY[2].trim()), MonthFromMonthChars - (astrDMY[1].trim()), new java.lang.Integer (astrDMY[0].trim())); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create a JulianDate from the YYYY MM DD - * - * @param strYYYYMMDD Java Date input as delimited YYYY MM DD - * @param strDelim Delimiter - * - * @return JulianDate output - */ - - public static final org.drip.analytics.date.JulianDate MakeJulianFromYYYYMMDD ( - final java.lang.String strYYYYMMDD, - final java.lang.String strDelim) - { - if (null == strYYYYMMDD || strYYYYMMDD.isEmpty() || null == strDelim || strDelim.isEmpty()) - return null; - - java.lang.String[] astrYYYYMMDD = strYYYYMMDD.split (strDelim); - - if (null == astrYYYYMMDD || 3 != astrYYYYMMDD.length) return null; - - try { - return CreateFromYMD (new java.lang.Integer (astrYYYYMMDD[0].trim()), new java.lang.Integer - (astrYYYYMMDD[1].trim()), new java.lang.Integer (astrYYYYMMDD[2].trim())); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create a JulianDate from Bloomberg date string - * - * @param strBBGDate Bloomberg date string - * - * @return The new JulianDate - */ - - public static final org.drip.analytics.date.JulianDate MakeJulianDateFromBBGDate ( - final java.lang.String strBBGDate) - { - if (null == strBBGDate || strBBGDate.isEmpty()) return null; - - java.lang.String[] astrFields = strBBGDate.split ("/"); - - if (3 != astrFields.length) return null; - - try { - return CreateFromYMD ((int) new java.lang.Double (astrFields[2].trim()).doubleValue(), (int) new - java.lang.Double (astrFields[0].trim()).doubleValue(), (int) new java.lang.Double - (astrFields[1].trim()).doubleValue()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Month corresponding to the Month Digit Code - * - * @param ch The Month Digit Code - * - * @return The Month corresponding to the Month Digit Code - * - * @throws java.lang.Exception Thrown if the Digit Code is Invalid - */ - - public static final int MonthFromCode ( - final char ch) - throws java.lang.Exception - { - if ('F' == ch) return JANUARY; - - if ('G' == ch) return FEBRUARY; - - if ('H' == ch) return MARCH; - - if ('J' == ch) return APRIL; - - if ('K' == ch) return MAY; - - if ('M' == ch) return JUNE; - - if ('N' == ch) return JULY; - - if ('Q' == ch) return AUGUST; - - if ('U' == ch) return SEPTEMBER; - - if ('V' == ch) return OCTOBER; - - if ('X' == ch) return NOVEMBER; - - if ('Z' == ch) return DECEMBER; - - throw new java.lang.Exception ("DateUtil::MonthFromCode => Invalid Character: " + ch); - } - - /** - * Retrieve the Digit Code corresponding to the Month - * - * @param iMonth The Month - * - * @return The Digit Code corresponding to the Month - * - * @throws java.lang.Exception Thrown if the Digit Code cannot be computed - */ - - public static final char CodeFromMonth ( - final int iMonth) - throws java.lang.Exception - { - if (JANUARY == iMonth) return 'F'; - - if (FEBRUARY == iMonth) return 'G'; - - if (MARCH == iMonth) return 'H'; - - if (APRIL == iMonth) return 'J'; - - if (MAY == iMonth) return 'K'; - - if (JUNE == iMonth) return 'M'; - - if (JULY == iMonth) return 'N'; - - if (AUGUST == iMonth) return 'Q'; - - if (SEPTEMBER == iMonth) return 'U'; - - if (OCTOBER == iMonth) return 'V'; - - if (NOVEMBER == iMonth) return 'X'; - - if (DECEMBER == iMonth) return 'Z'; - - throw new java.lang.Exception ("DateUtil::CodeFromMonth => Invalid Month: " + iMonth); - } -} diff --git a/org/drip/analytics/date/JulianDate.java b/org/drip/analytics/date/JulianDate.java deleted file mode 100644 index 5888be2..0000000 --- a/org/drip/analytics/date/JulianDate.java +++ /dev/null @@ -1,636 +0,0 @@ - -package org.drip.analytics.date; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * Class provides a comprehensive representation of Julian date and date manipulation functionality. It - * exports the following functionality: - * - Explicit date construction, as well as date construction from several input string formats/today - * - Date Addition/Adjustment/Elapsed/Difference, add/subtract days/weeks/months/years and tenor codes - * - Leap Year Functionality (number of leap days in the given interval, is the given year a leap year etc.) - * - Generate the subsequent IMM date (CME IMM date, CDS/Credit ISDA IMM date etc) - * - Year/Month/Day in numbers/characters - * - Days Elapsed/Remaining, is EOM - * - Comparison with the Other, equals/hash-code/comparator - * - Export the date to a variety of date formats (Oracle, Julian, Bloomberg) - * - Serialization/De-serialization to and from Byte Arrays - * - * @author Lakshmi Krishnamurthy - */ - -public class JulianDate implements java.lang.Comparable { - private int _iJulian = java.lang.Integer.MIN_VALUE; - - /** - * Create JulianDate from an Integer Julian Date Instance - * - * @param iJulian Julian Date Integer Instance - */ - - public JulianDate ( - final int iJulian) - { - _iJulian = iJulian; - } - - /** - * Return the Integer Julian Date - * - * @return The Integer Julian Date - */ - - public int julian() - { - return _iJulian; - } - - /** - * Add the given Number of Days and return a JulianDate Instance - * - * @param iDays Number of Days to be added - * - * @return The new JulianDate - */ - - public JulianDate addDays ( - final int iDays) - { - try { - return new JulianDate (_iJulian + iDays); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Subtract the given Number of Days and return the JulianDate Instance - * - * @param iDays Number of days to be subtracted - * - * @return The JulianDate Instance - */ - - public JulianDate subtractDays ( - final int iDays) - { - try { - return new JulianDate (_iJulian - iDays); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Add the given Number of Business Days and return a new JulianDate Instance - * - * @param iDays Number of Days to be subtracted - * - * @param strCalendarSet String representing the Calendar Set containing the Business Days - * - * @return The new JulianDate Instance - */ - - public JulianDate addBusDays ( - final int iDays, - final java.lang.String strCalendarSet) - { - int iNumDaysToAdd = iDays; - int iAdjusted = _iJulian; - - try { - while (0 < iNumDaysToAdd--) { - ++iAdjusted; - - while (org.drip.analytics.daycount.Convention.IsHoliday (iAdjusted, strCalendarSet)) - ++iAdjusted; - } - - while (org.drip.analytics.daycount.Convention.IsHoliday (iAdjusted, strCalendarSet)) ++iAdjusted; - - return new JulianDate (iAdjusted); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Subtract the given Number of Business Days and return a new JulianDate Instance - * - * @param iDays Number of Days to be subtracted - * - * @param strCalendarSet String representing the Calendar Set containing the Business Days - * - * @return The new JulianDate Instance - */ - - public JulianDate subtractBusDays ( - final int iDays, - final java.lang.String strCalendarSet) - { - int iNumDaysToAdd = iDays; - int iDateAdjusted = _iJulian; - - try { - while (0 < iNumDaysToAdd--) { - --iDateAdjusted; - - while (org.drip.analytics.daycount.Convention.IsHoliday (iDateAdjusted, strCalendarSet)) - --iDateAdjusted; - } - - while (org.drip.analytics.daycount.Convention.IsHoliday (iDateAdjusted, strCalendarSet)) - --iDateAdjusted; - - return new JulianDate (iDateAdjusted); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Add the given Number of Years and return a new JulianDate Instance - * - * @param iNumYears Number of Years to be added - * - * @return The New JulianDate Instance - */ - - public JulianDate addYears ( - final int iNumYears) - { - int iP = _iJulian + 68569; - int iQ = 4 * iP / 146097; - int iR = iP - (146097 * iQ + 3) / 4; - int iS = 4000 * (iR + 1) / 1461001; - int iT = iR - (1461 * iS / 4) + 31; - int iU = 80 * iT / 2447; - int iV = iU / 11; - int iY = 100 * (iQ - 49) + iS + iV; - int iM = iU + 2 - 12 * iV; - int iD = iT - (2447 * iU / 80); - - try { - return org.drip.analytics.date.DateUtil.CreateFromYMD (iY + iNumYears, iM, iD); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Add the given Number of Months and return a New JulianDate Instance - * - * @param iNumMonths Number of Months to be added - * - * @return The new JulianDate Instance - */ - - public JulianDate addMonths ( - final int iNumMonths) - { - int iP = _iJulian + 68569; - int iQ = 4 * iP / 146097; - int iR = iP - (146097 * iQ + 3) / 4; - int iS = 4000 * (iR + 1) / 1461001; - int iT = iR - (1461 * iS / 4) + 31; - int iU = 80 * iT / 2447; - int iV = iU / 11; - int iYear = 100 * (iQ - 49) + iS + iV; - int iMonth = iU + 2 - 12 * iV + iNumMonths; - int iDate = iT - (2447 * iU / 80); - - while (12 < iMonth) { - ++iYear; - iMonth -= 12; - } - - while (0 >= iMonth) { - --iYear; - iMonth += 12; - } - - try { - int iDaysInMonth = org.drip.analytics.date.DateUtil.DaysInMonth (iMonth, iYear); - - while (iDate > iDaysInMonth) - --iDate; - - return org.drip.analytics.date.DateUtil.CreateFromYMD (iYear, iMonth, iDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the First Rates Futures IMM Date from this JulianDate - * - * @param iNumRollMonths Number of Months to Roll - * - * @return The IMM JulianDate Instance - */ - - public JulianDate nextRatesFuturesIMM ( - final int iNumRollMonths) - { - int iP = _iJulian + 68569; - int iQ = 4 * iP / 146097; - int iR = iP - (146097 * iQ + 3) / 4; - int iS = 4000 * (iR + 1) / 1461001; - int iT = iR - (1461 * iS / 4) + 31; - int iU = 80 * iT / 2447; - int iV = iU / 11; - int iYear = 100 * (iQ - 49) + iS + iV; - int iMonth = iU + 2 - 12 * iV; - int iDate = iT - (2447 * iU / 80); - - if (15 <= iDate) { - if (12 < ++iMonth) { - ++iYear; - iMonth -= 12; - } - } - - while (0 != iMonth % iNumRollMonths) ++iMonth; - - try { - return org.drip.analytics.date.DateUtil.CreateFromYMD (iYear, iMonth, 15); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the First Bond Futures IMM Date from this JulianDate according to the specified Calendar - * - * @param iNumRollMonths Number of Months to Roll - * @param strCalendar Holiday Calendar - * - * @return The IMM JulianDate Instance - */ - - public JulianDate nextBondFuturesIMM ( - final int iNumRollMonths, - final java.lang.String strCalendar) - { - int iP = _iJulian + 68569; - int iQ = 4 * iP / 146097; - int iR = iP - (146097 * iQ + 3) / 4; - int iS = 4000 * (iR + 1) / 1461001; - int iT = iR - (1461 * iS / 4) + 31; - int iU = 80 * iT / 2447; - int iV = iU / 11; - int iYear = 100 * (iQ - 49) + iS + iV; - int iMonth = iU + 2 - 12 * iV; - - while (0 != iMonth % iNumRollMonths) ++iMonth; - - try { - return org.drip.analytics.date.DateUtil.CreateFromYMD (iYear, iMonth, - org.drip.analytics.date.DateUtil.DaysInMonth (iMonth, iYear)); - - /* return org.drip.analytics.date.DateUtil.CreateFromYMD (iYear, iMonth, - org.drip.analytics.date.DateUtil.DaysInMonth (iMonth, iYear)).subtractBusDays (8, - strCalendar); */ - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the First Credit IMM roll date from this JulianDate - * - * @param iNumRollMonths Number of Months to Roll - * - * @return The IMM JulianDate Instance - */ - - public JulianDate nextCreditIMM ( - final int iNumRollMonths) - { - int iP = _iJulian + 68569; - int iQ = 4 * iP / 146097; - int iR = iP - (146097 * iQ + 3) / 4; - int iS = 4000 * (iR + 1) / 1461001; - int iT = iR - (1461 * iS / 4) + 31; - int iU = 80 * iT / 2447; - int iV = iU / 11; - int iYear = 100 * (iQ - 49) + iS + iV; - int iMonth = iU + 2 - 12 * iV; - int iDate = iT - (2447 * iU / 80); - - if (20 <= iDate) { - if (12 < ++iMonth) { - ++iYear; - iMonth -= 12; - } - } - - while (0 != iMonth % iNumRollMonths) ++iMonth; - - try { - return org.drip.analytics.date.DateUtil.CreateFromYMD (iYear, iMonth, 20); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Add the tenor to the JulianDate to create a new date - * - * @param strTenorIn String representing the Input Tenor to add - * - * @return The new JulianDate - */ - - public JulianDate addTenor ( - final java.lang.String strTenorIn) - { - if (null == strTenorIn || strTenorIn.isEmpty()) return null; - - java.lang.String strTenor = "ON".equalsIgnoreCase (strTenorIn) ? "1D" : strTenorIn; - - int iNumChar = strTenor.length(); - - char chTenor = strTenor.charAt (iNumChar - 1); - - int iTimeUnit = -1; - - try { - iTimeUnit = new java.lang.Integer (strTenor.substring (0, iNumChar - 1)); - } catch (java.lang.Exception e) { - System.out.println ("Bad time unit " + iTimeUnit + " in tenor " + strTenor); - - return null; - } - - if ('d' == chTenor || 'D' == chTenor) return addDays (iTimeUnit); - - if ('w' == chTenor || 'W' == chTenor) return addDays (iTimeUnit * 7); - - if ('l' == chTenor || 'L' == chTenor) return addDays (iTimeUnit * 28); - - if ('m' == chTenor || 'M' == chTenor) return addMonths (iTimeUnit); - - if ('y' == chTenor || 'Y' == chTenor) return addYears (iTimeUnit); - - System.out.println ("Unknown tenor format " + strTenor); - - return null; - } - - /** - * Add the Tenor to the JulianDate and Adjust it to create a new Instance - * - * @param strTenor The Tenor - * @param strCalendarSet The Holiday Calendar Set - * - * @return The new JulianDate Instance - */ - - public JulianDate addTenorAndAdjust ( - final java.lang.String strTenor, - final java.lang.String strCalendarSet) - { - JulianDate dtNew = addTenor (strTenor); - - if (null == dtNew) return null; - - try { - return new JulianDate (org.drip.analytics.daycount.Convention.RollDate (dtNew.julian(), - org.drip.analytics.daycount.Convention.DATE_ROLL_FOLLOWING, strCalendarSet, 1)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Subtract the tenor to the JulianDate to create a new date - * - * @param strTenorIn String representing the tenor to add - * - * @return The new JulianDate - */ - - public JulianDate subtractTenor ( - final java.lang.String strTenorIn) - { - if (null == strTenorIn || strTenorIn.isEmpty()) return null; - - java.lang.String strTenor = "ON".equalsIgnoreCase (strTenorIn) ? "1D" : strTenorIn; - - int iNumChar = strTenor.length(); - - char chTenor = strTenor.charAt (iNumChar - 1); - - int iTimeUnit = -1; - - try { - iTimeUnit = new java.lang.Integer (strTenor.substring (0, iNumChar - 1)); - } catch (java.lang.Exception e) { - System.out.println ("Bad time unit " + iTimeUnit + " in tenor " + strTenor); - - return null; - } - - if ('d' == chTenor || 'D' == chTenor) return addDays (-iTimeUnit); - - if ('w' == chTenor || 'W' == chTenor) return addDays (-iTimeUnit * 7); - - if ('l' == chTenor || 'L' == chTenor) return addDays (-iTimeUnit * 28); - - if ('m' == chTenor || 'M' == chTenor) return addMonths (-iTimeUnit); - - if ('y' == chTenor || 'Y' == chTenor) return addYears (-iTimeUnit); - - return null; - } - - /** - * Subtract the tenor to the JulianDate to create a new business date - * - * @param strTenor The Tenor - * @param strCalendarSet The Holiday Calendar Set - * - * @return The new JulianDate - */ - - public JulianDate subtractTenorAndAdjust ( - final java.lang.String strTenor, - final java.lang.String strCalendarSet) - { - JulianDate dtNew = subtractTenor (strTenor); - - if (null == dtNew) return null; - - try { - return new JulianDate (org.drip.analytics.daycount.Convention.RollDate (dtNew.julian(), - org.drip.analytics.daycount.Convention.DATE_ROLL_FOLLOWING, strCalendarSet, 1)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Difference in Days between the Current and the Input Dates - * - * @param dt Input Date - * - * @return The Difference - * - * @throws java.lang.Exception Thrown if Input Date is Invalid - */ - - public int daysDiff ( - final JulianDate dt) - throws java.lang.Exception - { - if (null == dt) throw new java.lang.Exception ("JulianDate::daysDiff => Invalid Input!"); - - return _iJulian - dt.julian(); - } - - /** - * Return a Trigram Representation of the Date - * - * @return String representing the Trigram Representation of Date - */ - - public java.lang.String toOracleDate() - { - try { - return DateUtil.Date (_iJulian) + "-" + org.drip.analytics.date.DateUtil.MonthTrigram - (org.drip.analytics.date.DateUtil.Month (_iJulian)) + "-" + - org.drip.analytics.date.DateUtil.Year (_iJulian); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Return a Representation of Date as YYYYMMDD - * - * @param strDelimIn Field Delimiter - * - * @return String of the YYYYMMDD Representation of Date - */ - - public java.lang.String toYYYYMMDD ( - final java.lang.String strDelimIn) - { - java.lang.String strDelim = null == strDelimIn ? "" : strDelimIn; - - try { - return org.drip.quant.common.FormatUtil.FormatDouble (DateUtil.Year (_iJulian), 4, 0, 1.) + - strDelim + org.drip.quant.common.FormatUtil.FormatDouble - (org.drip.analytics.date.DateUtil.Month (_iJulian), 2, 0, 1.) + strDelim + - org.drip.quant.common.FormatUtil.FormatDouble (DateUtil.Date (_iJulian), 2, 0, 1.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public boolean equals ( - final java.lang.Object o) - { - if (!(o instanceof JulianDate)) return false; - - return _iJulian == ((JulianDate) o)._iJulian; - } - - @Override public int hashCode() - { - long lBits = java.lang.Double.doubleToLongBits (_iJulian); - - return (int) (lBits ^ (lBits >>> 32)); - } - - @Override public java.lang.String toString() - { - return org.drip.analytics.date.DateUtil.DDMMMYYYY (_iJulian); - } - - @Override public int compareTo ( - final JulianDate dtOther) - { - if (_iJulian > dtOther._iJulian) return 1; - - if (_iJulian < dtOther._iJulian) return -1; - - return 0; - } -} diff --git a/org/drip/analytics/daycount/ActActDCParams.java b/org/drip/analytics/daycount/ActActDCParams.java deleted file mode 100644 index b786589..0000000 --- a/org/drip/analytics/daycount/ActActDCParams.java +++ /dev/null @@ -1,129 +0,0 @@ - -package org.drip.analytics.daycount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * This class contains parameters to represent Act/Act day count. It exports the following functionality: - * - Frequency/Start/End Date Fields - * - Serialization/De-serialization to and from Byte Arrays - * - * @author Lakshmi Krishnamurthy - */ - -public class ActActDCParams { - private int _iFreq = 0; - private int _iNumDays = -1; - - /** - * Construct an ActActDCParams from the specified Frequency - * - * @param iFreq The Frequency - * - * @return The ActActDCParams Instance - */ - - public static final ActActDCParams FromFrequency ( - final int iFreq) - { - try { - return new ActActDCParams (iFreq, (int) (365.25 / iFreq)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Constructs an ActActDCParams instance from the corresponding parameters - * - * @param iFreq Frequency - * @param iNumDays Number of Days in the Period - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public ActActDCParams ( - final int iFreq, - final int iNumDays) - throws java.lang.Exception - { - _iFreq = iFreq; - - if (0 >= (_iFreq = iFreq) || !org.drip.quant.common.NumberUtil.IsValid (_iNumDays = iNumDays) || - 0 >= _iNumDays) - throw new java.lang.Exception ("ActActDCParams ctr: Invalid inputs"); - } - - /** - * Retrieve the Frequency - * - * @return The Frequency - */ - - public int freq() - { - return _iFreq; - } - - /** - * Number of Days in the Act/Act Period - * - * @return The Number of Days in the Act/Act Period - */ - - public int days() - { - return _iNumDays; - } -} diff --git a/org/drip/analytics/daycount/Convention.java b/org/drip/analytics/daycount/Convention.java deleted file mode 100644 index 45fc975..0000000 --- a/org/drip/analytics/daycount/Convention.java +++ /dev/null @@ -1,921 +0,0 @@ - -package org.drip.analytics.daycount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * This class contains flags that indicate where the holidays are loaded from, as well as the holiday types - * and load rules. It exports the following date related functionality: - * - Add business days according to the specified calendar - * - The Year Fraction between any 2 days given the day count type and the holiday calendar - * - Adjust/roll to the next working day according to the adjustment rule - * - Holiday Functions - is the given day a holiday/business day, the number and the set of - * holidays/business days between 2 days. - * - Calendars and Day counts - Available set of day count conventions and calendars, and the weekend days - * corresponding to a given calendar. - * - * @author Lakshmi Krishnamurthy - */ - -public class Convention { - - /** - * Date Roll Actual - */ - - public static final int DATE_ROLL_ACTUAL = 0; - - /** - * Date Roll Following - */ - - public static final int DATE_ROLL_FOLLOWING = 1; - - /** - * Date Roll Modified Following - */ - - public static final int DATE_ROLL_MODIFIED_FOLLOWING = 2; - - /** - * Date Roll Modified Following Bi-monthly - */ - - public static final int DATE_ROLL_MODIFIED_FOLLOWING_BIMONTHLY = 4; - - /** - * Date Roll Previous - */ - - public static final int DATE_ROLL_PREVIOUS = 8; - - /** - * Date Roll Modified Previous - */ - - public static final int DATE_ROLL_MODIFIED_PREVIOUS = 16; - - /** - * Week Day Holiday - */ - - public static final int WEEKDAY_HOLS = 1; - - /** - * Week End Holiday - */ - - public static final int WEEKEND_HOLS = 2; - - private static final int INIT_FROM_HOLS_DB = 1; - private static final int INIT_FROM_HOLS_XML = 2; - private static final int INIT_FROM_HOLS_SOURCE = 4; - - private static int s_iInitHols = INIT_FROM_HOLS_SOURCE; - private static org.drip.analytics.support.CaseInsensitiveTreeMap - s_mapLocHols = null; - - private static - org.drip.analytics.support.CaseInsensitiveTreeMap - s_mapDCCalc = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private static final boolean UpdateDCCalcMap ( - final org.drip.analytics.daycount.DCFCalculator dcfCalc) - { - for (java.lang.String strDC : dcfCalc.alternateNames()) - s_mapDCCalc.put (strDC, dcfCalc); - - return true; - } - - private static final boolean SetDCCalc() - { - if (!UpdateDCCalcMap (new org.drip.analytics.daycount.DC1_1())) return false; - - if (!UpdateDCCalcMap (new org.drip.analytics.daycount.DC28_360())) return false; - - if (!UpdateDCCalcMap (new org.drip.analytics.daycount.DC30_360())) return false; - - if (!UpdateDCCalcMap (new org.drip.analytics.daycount.DC30_365())) return false; - - if (!UpdateDCCalcMap (new org.drip.analytics.daycount.DC30_Act())) return false; - - if (!UpdateDCCalcMap (new org.drip.analytics.daycount.DC30E_360())) return false; - - if (!UpdateDCCalcMap (new org.drip.analytics.daycount.DC30E_360_ISDA())) return false; - - if (!UpdateDCCalcMap (new org.drip.analytics.daycount.DC30EPLUS_360_ISDA())) return false; - - if (!UpdateDCCalcMap (new org.drip.analytics.daycount.DCAct_360())) return false; - - if (!UpdateDCCalcMap (new org.drip.analytics.daycount.DCAct_364())) return false; - - if (!UpdateDCCalcMap (new org.drip.analytics.daycount.DCAct_365())) return false; - - if (!UpdateDCCalcMap (new org.drip.analytics.daycount.DCAct_365L())) return false; - - if (!UpdateDCCalcMap (new org.drip.analytics.daycount.DCAct_Act())) return false; - - if (!UpdateDCCalcMap (new org.drip.analytics.daycount.DCAct_Act_ISDA())) return false; - - if (!UpdateDCCalcMap (new org.drip.analytics.daycount.DCAct_Act_UST())) return false; - - if (!UpdateDCCalcMap (new org.drip.analytics.daycount.DCNL_360())) return false; - - if (!UpdateDCCalcMap (new org.drip.analytics.daycount.DCNL_365())) return false; - - return UpdateDCCalcMap (new org.drip.analytics.daycount.DCNL_Act()); - } - - private static final boolean AddLH ( - final org.drip.analytics.holset.LocationHoliday lh, - final org.drip.analytics.support.CaseInsensitiveTreeMap mapHols) - { - if (null == lh || null == mapHols) return false; - - java.lang.String strLocation = lh.getHolidayLoc(); - - org.drip.analytics.eventday.Locale locHols = lh.getHolidaySet(); - - if (null == locHols || null == strLocation || strLocation.isEmpty()) return false; - - mapHols.put (strLocation, locHols); - - return true; - } - - private static final org.drip.analytics.support.CaseInsensitiveTreeMap - SetHolsFromSource() - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapHols = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - AddLH (new org.drip.analytics.holset.AEDHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.ANGHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.ARAHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.ARFHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.ARNHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.ARPHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.ARSHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.ATSHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.AUDHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.AZMHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.BAKHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.BBDHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.BEFHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.BGLHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.BHDHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.BMDHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.BRCHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.BRLHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.BSDHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.CADHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.CAEHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.CERHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.CFFHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.CHFHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.CLFHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.CLUHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.CNYHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.COFHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.CONHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.COPHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.CRCHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.CYPHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.CZKHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.DEMHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.DKKHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.DOPHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.DTFHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.ECSHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.EEKHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.EGPHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.ESBHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.ESPHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.ESTHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.EUBHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.EURHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.GBPHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.GELHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.GFRHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.GRDHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.HKDHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.HRKHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.HUFHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.IBRHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.IDRHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.IEPHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.IGPHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.ILSHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.INRHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.IPCHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.ITLHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.JMDHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.JPYHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.KPWHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.KRWHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.KWDHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.KYDHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.KZTHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.LKRHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.LTLHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.LUFHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.LUXHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.LVLHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.MDLHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.MIXHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.MKDHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.MXCHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.MXNHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.MXPHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.MXVHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.MYRHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.NLGHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.NOKHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.NZDHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.PABHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.PEFHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.PENHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.PESHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.PHPHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.PLNHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.PLZHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.PTEHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.QEFHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.RUBHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.RURHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.SARHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.SEKHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.SGDHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.SITHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.SKKHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.SVCHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.TABHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.TGTHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.THBHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.TRLHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.TRYHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.TWDHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.UAHHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.USDHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.USVHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.UVRHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.UYUHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.UYUHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.VACHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.VEBHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.VEFHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.VNDHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.XDRHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.XEUHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.ZALHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.ZARHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.ZUSHoliday(), mapHols); - - AddLH (new org.drip.analytics.holset.ZWDHoliday(), mapHols); - - return mapHols; - } - - private static final boolean LocationHoliday ( - final java.lang.String strCalendarSet, - final int iDate, - final int iHolType) - { - if (null == strCalendarSet || strCalendarSet.isEmpty() || 0 >= iDate) return false; - - java.lang.String[] astrCalendars = strCalendarSet.split (","); - - for (java.lang.String strCalendar : astrCalendars) { - if (null != strCalendar && null != s_mapLocHols.get (strCalendar)) { - org.drip.analytics.eventday.Locale lh = s_mapLocHols.get (strCalendar); - - if (null == lh) continue; - - if (0 != (WEEKEND_HOLS & iHolType) && null != lh.weekendDays() && lh.weekendDays().isWeekend - (iDate)) - return true; - - if (null == lh.holidays() || 0 == (WEEKDAY_HOLS & iHolType)) continue; - - for (org.drip.analytics.eventday.Base hol : lh.holidays()) { - try { - if (null != hol && iDate == hol.dateInYear (org.drip.analytics.date.DateUtil.Year - (iDate), true)) - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - } - } - } - - return false; - } - - /** - * Initialize the day count basis object from the calendar set - * - * @param strCalendarSetLoc The calendar set - * - * @return Success (true) Failure (false) - */ - - public static final boolean Init ( - final java.lang.String strCalendarSetLoc) - { - if (!SetDCCalc()) return false; - - if (INIT_FROM_HOLS_SOURCE == s_iInitHols) { - if (null == (s_mapLocHols = SetHolsFromSource())) return false; - - return true; - } - - try { - if (INIT_FROM_HOLS_XML == s_iInitHols) - s_mapLocHols = org.drip.param.config.ConfigLoader.LoadHolidayCalendars (strCalendarSetLoc); - else if (INIT_FROM_HOLS_DB == s_iInitHols) - s_mapLocHols = org.drip.param.config.ConfigLoader.LoadHolidayCalendarsFromDB - (strCalendarSetLoc); - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - if (null == s_mapLocHols && null == (s_mapLocHols = SetHolsFromSource())) return false; - - return false; - } - - /** - * Retrieve the set of holiday locations - * - * @return Set of holiday locations - */ - - public static final java.util.Set HolidayLocations() - { - return s_mapLocHols.keySet(); - } - - /** - * Get the week end days for the given holiday calendar set - * - * @param strCalendarSet Holiday calendar set - * - * @return Array of days indicating the week day union - */ - - public static final int[] WeekendDays ( - final java.lang.String strCalendarSet) - { - if (null == strCalendarSet || strCalendarSet.isEmpty()) return null; - - java.lang.String[] astrCalendars = strCalendarSet.split (","); - - java.util.Set si = new java.util.HashSet(); - - for (java.lang.String strCalendar : astrCalendars) { - if (null != strCalendar && null != s_mapLocHols.get (strCalendar)) { - org.drip.analytics.eventday.Locale lh = s_mapLocHols.get (strCalendar); - - if (null == lh || null == lh.weekendDays() || null == lh.weekendDays().days()) continue; - - for (int i : lh.weekendDays().days()) - si.add (i); - } - } - - int j = 0; - - int[] aiWkend = new int[si.size()]; - - for (int iHol : si) - aiWkend[j++] = iHol; - - return aiWkend; - } - - /** - * Get all available DRIP day count conventions - * - * @return Available DRIP day count conventions - */ - - public static final java.lang.String AvailableDC() - { - java.lang.StringBuffer sbDCSet = new java.lang.StringBuffer(); - - for (java.lang.String strDC : s_mapDCCalc.keySet()) - sbDCSet.append (strDC + " | "); - - return sbDCSet.toString(); - } - - /** - * Calculate the Accrual Fraction in Years between 2 given Dates for the given Day Count Convention and - * the other Parameters - * - * @param iStartDate Start Date - * @param iEndDate End Date - * @param strDayCount Day Count Convention - * @param bApplyEOMAdj Apply End-of-Month Adjustment (TRUE) - * @param actactParams ActActParams - * @param strCalendar Holiday Calendar - * - * @return Accrual Fraction in Years - * - * @throws java.lang.Exception Thrown if the Accrual Fraction cannot be calculated - */ - - public static final double YearFraction ( - final int iStartDate, - final int iEndDate, - final java.lang.String strDayCount, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - if ("BUS252".equalsIgnoreCase (strDayCount) || "BUS DAYS252".equalsIgnoreCase (strDayCount) || - "BUS/252".equalsIgnoreCase (strDayCount)) - return BusinessDays (iStartDate, iEndDate, strCalendar) / 252.; - - org.drip.analytics.daycount.DCFCalculator dcfCalc = s_mapDCCalc.get (strDayCount); - - if (null != dcfCalc) - return dcfCalc.yearFraction (iStartDate, iEndDate, bApplyEOMAdj, actactParams, strCalendar); - - System.out.println ("Convention::YearFraction => Unknown DC: " + strDayCount + - "; defaulting to Actual/365.25"); - - return 1. * (iEndDate - iStartDate) / 365.25; - } - - /** - * Calculate the Days Accrued between 2 given Dates for the given Day Count Convention and the other - * Parameters - * - * @param iStartDate Start Date - * @param iEndDate End Date - * @param strDayCount Day Count Convention - * @param bApplyEOMAdj Apply End-of-Month Adjustment (TRUE) - * @param actactParams ActActParams - * @param strCalendar Holiday Calendar - * - * @return Number of Days Accrued - * - * @throws java.lang.Exception Thrown if the Accrual Days cannot be calculated - */ - - public static final int DaysAccrued ( - final int iStartDate, - final int iEndDate, - final java.lang.String strDayCount, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - if ("BUS252".equalsIgnoreCase (strDayCount) || "BUS DAYS252".equalsIgnoreCase (strDayCount) || - "BUS/252".equalsIgnoreCase (strDayCount)) - return BusinessDays (iStartDate, iEndDate, strCalendar); - - org.drip.analytics.daycount.DCFCalculator dcfCalc = s_mapDCCalc.get (strDayCount); - - if (null != dcfCalc) - return dcfCalc.daysAccrued (iStartDate, iEndDate, bApplyEOMAdj, actactParams, strCalendar); - - return iEndDate - iStartDate; - } - - /** - * Roll the given Date in accordance with the Roll Mode and the Calendar Set - * - * @param iDate Date to be Rolled - * @param iRollMode Roll Mode (one of DR_ACT, DR_FOLL, DR_MOD_FOLL, DR_PREV, or DR_MOD_PREV) - * @param strCalendarSet Calendar Set to calculate the Holidays by - * @param iNumDaysToRoll The Number of Days to Roll - * - * @return The Rolled Date - * - * @throws java.lang.Exception Thrown if the date cannot be rolled - */ - - public static final int RollDate ( - final int iDate, - final int iRollMode, - final java.lang.String strCalendarSet, - int iNumDaysToRoll) - throws java.lang.Exception - { - if (0 > iNumDaysToRoll) throw new java.lang.Exception ("Convention::RollDate => Invalid Inputs"); - - if (null == strCalendarSet || strCalendarSet.isEmpty() || DATE_ROLL_ACTUAL == iRollMode) - return iDate + iNumDaysToRoll; - - int iRolledDate = iDate; - - while (0 != iNumDaysToRoll) { - if (DATE_ROLL_FOLLOWING == iRollMode || DATE_ROLL_MODIFIED_FOLLOWING == iRollMode || - DATE_ROLL_MODIFIED_FOLLOWING_BIMONTHLY == iRollMode) { - while (IsHoliday (iRolledDate, strCalendarSet)) - ++iRolledDate; - } else if (DATE_ROLL_PREVIOUS == iRollMode || DATE_ROLL_MODIFIED_PREVIOUS == iRollMode) { - while (IsHoliday (iRolledDate, strCalendarSet)) - --iRolledDate; - } - - --iNumDaysToRoll; - } - - if (DATE_ROLL_MODIFIED_FOLLOWING == iRollMode) { - if (org.drip.analytics.date.DateUtil.Month (iDate) != org.drip.analytics.date.DateUtil.Month - (iRolledDate)) { - while (IsHoliday (iRolledDate, strCalendarSet)) - --iRolledDate; - } - } - - if (DATE_ROLL_MODIFIED_FOLLOWING_BIMONTHLY == iRollMode) { - int iOriginalDay = org.drip.analytics.date.DateUtil.Date (iDate); - - int iRolledDay = org.drip.analytics.date.DateUtil.Date (iRolledDate); - - if ((15 < iOriginalDay && 15 > iRolledDay) || (15 > iOriginalDay && 15 < iRolledDay)) { - while (IsHoliday (iRolledDate, strCalendarSet)) - --iRolledDate; - } - } - - if (DATE_ROLL_MODIFIED_PREVIOUS == iRollMode) { - if (org.drip.analytics.date.DateUtil.Month (iDate) != org.drip.analytics.date.DateUtil.Month - (iRolledDate)) { - while (IsHoliday (iRolledDate, strCalendarSet)) - ++iRolledDate; - } - } - - return iRolledDate; - } - - /** - * Indicate whether the given Date is a Holiday in the specified Location(s) - * - * @param iDate Date - * @param strCalendar Location Calendar Set - * @param iHolType WEEKDAY_HOLS or WEEKEND_HOLS - * - * @return TRUE - it is a Holiday - */ - - public static final boolean IsHoliday ( - final int iDate, - final java.lang.String strCalendar, - final int iHolType) - { - return LocationHoliday ((null == strCalendar || strCalendar.isEmpty() || "".equalsIgnoreCase - (strCalendar)) ? "USD" : strCalendar, iDate, iHolType); - } - - /** - * Indicates whether the given Date is a Holiday in the specified Location(s) - * - * @param iDate Date - * @param strCalendar Location Calendar Set - * - * @return TRUE - it is a Holiday - */ - - public static final boolean IsHoliday ( - final int iDate, - final java.lang.String strCalendar) - { - return IsHoliday (iDate, strCalendar, WEEKDAY_HOLS | WEEKEND_HOLS); - } - - /** - * Calculate the Number of Business Days between the Start and the End Dates - * - * @param iStartDate Start Date - * @param iEndDate End Date - * @param strCalendar Holiday Calendar Set - * - * @return The Number of Business Days - * - * @throws java.lang.Exception Thrown if it cannot be evaluated - */ - - public static final int BusinessDays ( - final int iStartDate, - final int iEndDate, - final java.lang.String strCalendar) - throws java.lang.Exception - { - if (iStartDate > iEndDate) - throw new java.lang.Exception ("Convention::BusinessDays => Invalid Inputs"); - - if (iStartDate == iEndDate) return 0; - - int iNumBusDays = 0; - int iDate = iStartDate + 1; - - while (iDate <= iEndDate) { - if (!IsHoliday (iDate, strCalendar)) ++iNumBusDays; - - ++iDate; - } - - return iNumBusDays; - } - - /** - * Calculate the Set of Holidays between the Start and the End Dates - * - * @param iStartDate Start Date - * @param iEndDate End Date - * @param strCalendar Holiday Calendar Set - * - * @return The Set of Holidays - */ - - public static final java.util.List HolidaySet ( - final int iStartDate, - final int iEndDate, - final java.lang.String strCalendar) - { - java.util.List lsHolidays = new java.util.ArrayList(); - - int iLastDate = iEndDate; - int iFirstDate = iStartDate; - - if (iFirstDate > iLastDate) { - iLastDate = iStartDate; - iFirstDate = iEndDate; - } - - while (iFirstDate != iLastDate) { - try { - if (IsHoliday (iFirstDate, strCalendar)) lsHolidays.add (iFirstDate); - - ++iFirstDate; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - } - - return lsHolidays; - } - - /** - * Calculate the Number of Holidays between the Start and the End Dates - * - * @param iStartDate Start Date - * @param iEndDate End Date - * @param strCalendar Holiday Calendar Set - * - * @return The Number of Holidays - */ - - public static final int Holidays ( - final int iStartDate, - final int iEndDate, - final java.lang.String strCalendar) - { - int iNumHolidays = 0; - int iLastDate = iEndDate; - int iFirstDate = iStartDate; - - if (iFirstDate > iLastDate) { - iLastDate = iStartDate; - iFirstDate = iEndDate; - } - - while (iFirstDate != iLastDate) { - if (IsHoliday (iFirstDate++, strCalendar)) ++iNumHolidays; - } - - return iStartDate > iEndDate ? -1 * iNumHolidays : iNumHolidays; - } - - /** - * Adjust the given Date in Accordance with the Adjustment Mode and the Calendar Set - * - * @param iDate Date to be Adjusted - * @param strCalendar Calendar Set to calculate the Holidays by - * @param iAdjustMode Adjustment Mode (one of DR_ACT, DR_FOLL, DR_MOD_FOLL, DR_PREV, or DR_MOD_PREV - * - * @return The Adjusted Date - */ - - public static final int Adjust ( - final int iDate, - final java.lang.String strCalendar, - final int iAdjustMode) - { - int iDateAdjusted = iDate; - - while (IsHoliday (iDateAdjusted, strCalendar)) ++iDateAdjusted; - - return iDateAdjusted; - } - - /** - * Add the specified Number of Business Days and Adjust According to the Calendar Set - * - * @param iDate Date to be Adjusted - * @param iNumDays Number of Days to Add - * @param strCalendar Calendar Set to calculate the Holidays by - * - * @return The Adjusted Date - */ - - public static final int AddBusinessDays ( - final int iDate, - final int iNumDays, - final java.lang.String strCalendar) - { - int iAdjustedDate = iDate; - int iNumDaysIncremented = 0; - - while (iNumDaysIncremented < iNumDays) { - iAdjustedDate = Adjust (iAdjustedDate + 1, strCalendar, DATE_ROLL_FOLLOWING); - - iNumDaysIncremented += 1; - } - - return iAdjustedDate; - } -} diff --git a/org/drip/analytics/daycount/DC1_1.java b/org/drip/analytics/daycount/DC1_1.java deleted file mode 100644 index e53becf..0000000 --- a/org/drip/analytics/daycount/DC1_1.java +++ /dev/null @@ -1,99 +0,0 @@ - -package org.drip.analytics.daycount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * This class implements the 1/1 day count convention. - * - * @author Lakshmi Krishnamurthy - */ - -public class DC1_1 implements org.drip.analytics.daycount.DCFCalculator { - - /** - * Empty DC1_1 constructor - */ - - public DC1_1() - { - } - - @Override public java.lang.String baseCalculationType() - { - return "DC1_1"; - } - - @Override public java.lang.String[] alternateNames() - { - return new java.lang.String[] {"1/1", "DC1_1"}; - } - - @Override public double yearFraction ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - return 1.; - } - - @Override public int daysAccrued ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - return 365; - } -} diff --git a/org/drip/analytics/daycount/DC28_360.java b/org/drip/analytics/daycount/DC28_360.java deleted file mode 100644 index 802fb43..0000000 --- a/org/drip/analytics/daycount/DC28_360.java +++ /dev/null @@ -1,119 +0,0 @@ - -package org.drip.analytics.daycount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * This class implements the 28/360 day count convention. - * - * @author Lakshmi Krishnamurthy - */ - -public class DC28_360 implements org.drip.analytics.daycount.DCFCalculator { - - /** - * Empty DC28_360 constructor - */ - - public DC28_360() - { - } - - @Override public java.lang.String baseCalculationType() - { - return "DC28_360"; - } - - @Override public java.lang.String[] alternateNames() - { - return new java.lang.String[] {"28/360", "DC28_360"}; - } - - @Override public double yearFraction ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA30_360 (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DC28_360::yearFraction => Cannot create DateEOMAdjustment!"); - - return (360.* (org.drip.analytics.date.DateUtil.Year (iEndDate) - - org.drip.analytics.date.DateUtil.Year (iStartDate)) + 28. * - (org.drip.analytics.date.DateUtil.Month (iEndDate) - org.drip.analytics.date.DateUtil.Month - (iStartDate)) + (org.drip.analytics.date.DateUtil.Date (iEndDate) - - org.drip.analytics.date.DateUtil.Date (iStartDate) + dm.posterior() - dm.anterior())) - / 360.; - } - - @Override public int daysAccrued ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA30_360 (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DC28_360::daysAccrued => Cannot create DateEOMAdjustment!"); - - return 360 * (org.drip.analytics.date.DateUtil.Year (iEndDate) - - org.drip.analytics.date.DateUtil.Year (iStartDate)) + 28 * - (org.drip.analytics.date.DateUtil.Month (iEndDate) - org.drip.analytics.date.DateUtil.Month - (iStartDate)) + (org.drip.analytics.date.DateUtil.Date (iEndDate) - - org.drip.analytics.date.DateUtil.Date (iStartDate) + dm.posterior() - dm.anterior()); - } -} diff --git a/org/drip/analytics/daycount/DC30EPLUS_360_ISDA.java b/org/drip/analytics/daycount/DC30EPLUS_360_ISDA.java deleted file mode 100644 index cb89923..0000000 --- a/org/drip/analytics/daycount/DC30EPLUS_360_ISDA.java +++ /dev/null @@ -1,122 +0,0 @@ - -package org.drip.analytics.daycount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * This class implements the 30E+/360 ISDA day count convention. - * - * @author Lakshmi Krishnamurthy - */ - -public class DC30EPLUS_360_ISDA implements org.drip.analytics.daycount.DCFCalculator { - - /** - * Empty DC30EPLUS_360_ISDA constructor - */ - - public DC30EPLUS_360_ISDA() - { - } - - @Override public java.lang.String baseCalculationType() - { - return "DC30EPLUS_360_ISDA"; - } - - @Override public java.lang.String[] alternateNames() - { - return new java.lang.String[] {"30E+/360", "30E+/360 ISDA", "30E+/360 (ISDA)", "DC30EPLUS_360_ISDA"}; - } - - @Override public double yearFraction ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA30EPLUS_360_ISDA (iStartDate, iEndDate, - bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DC30EPLUS_360::yearFraction => Cannot create DateEOMAdjustment!"); - - return (360. * (org.drip.analytics.date.DateUtil.Year (iEndDate) - - org.drip.analytics.date.DateUtil.Year (iStartDate)) + 30. * - (org.drip.analytics.date.DateUtil.Month (iEndDate) - org.drip.analytics.date.DateUtil.Month - (iStartDate)) + (org.drip.analytics.date.DateUtil.Date (iEndDate) - - org.drip.analytics.date.DateUtil.Date (iStartDate)) + dm.posterior() - dm.anterior()) - / 360.; - } - - @Override public int daysAccrued ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA30EPLUS_360_ISDA (iStartDate, iEndDate, - bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DC30EPLUS_360::daysAccrued => Cannot create DateEOMAdjustment!"); - - return 360 * (org.drip.analytics.date.DateUtil.Year (iEndDate) - - org.drip.analytics.date.DateUtil.Year (iStartDate)) + 30 * - (org.drip.analytics.date.DateUtil.Month (iEndDate) - org.drip.analytics.date.DateUtil.Month - (iStartDate)) + (org.drip.analytics.date.DateUtil.Date (iEndDate) - - org.drip.analytics.date.DateUtil.Date (iStartDate)) + dm.posterior() - dm.anterior(); - } -} diff --git a/org/drip/analytics/daycount/DC30E_360.java b/org/drip/analytics/daycount/DC30E_360.java deleted file mode 100644 index e0c3651..0000000 --- a/org/drip/analytics/daycount/DC30E_360.java +++ /dev/null @@ -1,123 +0,0 @@ - -package org.drip.analytics.daycount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * This class implements the 30E/360 day count convention. - * - * @author Lakshmi Krishnamurthy - */ - -public class DC30E_360 implements org.drip.analytics.daycount.DCFCalculator { - - /** - * Empty DC30E_360 constructor - */ - - public DC30E_360() - { - } - - @Override public java.lang.String baseCalculationType() - { - return "DC30E_360"; - } - - @Override public java.lang.String[] alternateNames() - { - return new java.lang.String[] {"30E/360", "30/360 ICMA", "30S/360", "Eurobond basis", - "Eurobond basis (ISDA 2006)", "Special German", "ISMA 30/360", "30E/360 ISDA", - "Eurobond basis (ISDA 2000)", "German", "German:30/360", "Ger:30/360", "ISDA SWAPS:30/360", - "ISDA 30E/360", "DC30E_360"}; - } - - @Override public double yearFraction ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA30E_360 (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DC30E_360::yearFraction => Cannot create DateEOMAdjustment!"); - - return (360. * (org.drip.analytics.date.DateUtil.Year (iEndDate) - - org.drip.analytics.date.DateUtil.Year (iStartDate)) + 30. * - (org.drip.analytics.date.DateUtil.Month (iEndDate) - org.drip.analytics.date.DateUtil.Month - (iStartDate)) + (org.drip.analytics.date.DateUtil.Date (iEndDate) - - org.drip.analytics.date.DateUtil.Date (iStartDate)) + dm.posterior() - dm.anterior()) - / 360.; - } - - @Override public int daysAccrued ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA30E_360 (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DC30E_360::daysAccrued => Cannot create DateEOMAdjustment!"); - - return 360 * (org.drip.analytics.date.DateUtil.Year (iEndDate) - - org.drip.analytics.date.DateUtil.Year (iStartDate)) + 30 * - (org.drip.analytics.date.DateUtil.Month (iEndDate) - org.drip.analytics.date.DateUtil.Month - (iStartDate)) + (org.drip.analytics.date.DateUtil.Date (iEndDate) - - org.drip.analytics.date.DateUtil.Date (iStartDate)) + dm.posterior() - dm.anterior(); - } -} diff --git a/org/drip/analytics/daycount/DC30E_360_ISDA.java b/org/drip/analytics/daycount/DC30E_360_ISDA.java deleted file mode 100644 index 79180aa..0000000 --- a/org/drip/analytics/daycount/DC30E_360_ISDA.java +++ /dev/null @@ -1,120 +0,0 @@ - -package org.drip.analytics.daycount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * This class implements the 30E/360 ISDA day count convention. - * - * @author Lakshmi Krishnamurthy - */ - -public class DC30E_360_ISDA implements org.drip.analytics.daycount.DCFCalculator { - - /** - * Empty DC30E_360_ISDA constructor - */ - - public DC30E_360_ISDA() - { - } - - @Override public java.lang.String baseCalculationType() - { - return "DC30E_360_ISDA"; - } - - @Override public java.lang.String[] alternateNames() - { - return new java.lang.String[] {"ISMA-30/360", "30E/360 ISDA", "30E/360 (ISDA)", "DC30E_360_ISDA"}; - } - - @Override public double yearFraction ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA30E_360_ISDA (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DC30E_360::yearFraction => Cannot create DateEOMAdjustment!"); - - return (360. * (org.drip.analytics.date.DateUtil.Year (iEndDate) - - org.drip.analytics.date.DateUtil.Year (iStartDate)) + 30. * - (org.drip.analytics.date.DateUtil.Month (iEndDate) - org.drip.analytics.date.DateUtil.Month - (iStartDate)) + (org.drip.analytics.date.DateUtil.Date (iEndDate) - - org.drip.analytics.date.DateUtil.Date (iStartDate)) + dm.posterior() - dm.anterior()) - / 360.; - } - - @Override public int daysAccrued ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA30E_360_ISDA (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DC30E_360::daysAccrued => Cannot create DateEOMAdjustment!"); - - return 360 * (org.drip.analytics.date.DateUtil.Year (iEndDate) - - org.drip.analytics.date.DateUtil.Year (iStartDate)) + 30 * - (org.drip.analytics.date.DateUtil.Month (iEndDate) - org.drip.analytics.date.DateUtil.Month - (iStartDate)) + (org.drip.analytics.date.DateUtil.Date (iEndDate) - - org.drip.analytics.date.DateUtil.Date (iStartDate)) + dm.posterior() - dm.anterior(); - } -} diff --git a/org/drip/analytics/daycount/DC30_360.java b/org/drip/analytics/daycount/DC30_360.java deleted file mode 100644 index 6bc4b6a..0000000 --- a/org/drip/analytics/daycount/DC30_360.java +++ /dev/null @@ -1,121 +0,0 @@ - -package org.drip.analytics.daycount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * This class implements the 30/360 day count convention. - * - * @author Lakshmi Krishnamurthy - */ - -public class DC30_360 implements org.drip.analytics.daycount.DCFCalculator { - - /** - * Empty DC30_360 constructor - */ - - public DC30_360() - { - } - - @Override public java.lang.String baseCalculationType() - { - return "DC30_360"; - } - - @Override public java.lang.String[] alternateNames() - { - return new java.lang.String[] {"30/360", "30U/360", "Bond basis", "30/360 US", "US MUNI: 30/360", - "MUNI30/360", "ISDA30/360", "DC30_360"}; - } - - @Override public double yearFraction ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA30_360 (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DC30_360::yearFraction => Cannot create DateEOMAdjustment!"); - - return (360.* (org.drip.analytics.date.DateUtil.Year (iEndDate) - - org.drip.analytics.date.DateUtil.Year (iStartDate)) + 30. * - (org.drip.analytics.date.DateUtil.Month (iEndDate) - org.drip.analytics.date.DateUtil.Month - (iStartDate)) + (org.drip.analytics.date.DateUtil.Date (iEndDate) - - org.drip.analytics.date.DateUtil.Date (iStartDate) + dm.posterior() - dm.anterior())) - / 360.; - } - - @Override public int daysAccrued ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA30_360 (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DC30_360::daysAccrued => Cannot create DateEOMAdjustment!"); - - return 360 * (org.drip.analytics.date.DateUtil.Year (iEndDate) - - org.drip.analytics.date.DateUtil.Year (iStartDate)) + 30 * - (org.drip.analytics.date.DateUtil.Month (iEndDate) - org.drip.analytics.date.DateUtil.Month - (iStartDate)) + (org.drip.analytics.date.DateUtil.Date (iEndDate) - - org.drip.analytics.date.DateUtil.Date (iStartDate) + dm.posterior() - dm.anterior()); - } -} diff --git a/org/drip/analytics/daycount/DC30_365.java b/org/drip/analytics/daycount/DC30_365.java deleted file mode 100644 index 362f9b9..0000000 --- a/org/drip/analytics/daycount/DC30_365.java +++ /dev/null @@ -1,120 +0,0 @@ - -package org.drip.analytics.daycount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * This Class Implements the 30/365 Day Count Convention. - * - * @author Lakshmi Krishnamurthy - */ - -public class DC30_365 implements org.drip.analytics.daycount.DCFCalculator { - - /** - * Empty DC30_365 constructor - */ - - public DC30_365() - { - } - - @Override public java.lang.String baseCalculationType() - { - return "DC30_365"; - } - - @Override public java.lang.String[] alternateNames() - { - return new java.lang.String[] {"30/365", "ISMA 30/365", "ISDA SWAPS:30/365", "ISDA30/365", - "ISDA 30E/365", "DC30_365"}; - } - - @Override public double yearFraction ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA30_365 (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DC30_365::yearFraction => Cannot create DateEOMAdjustment!"); - - return (365.* (org.drip.analytics.date.DateUtil.Year (iEndDate) - - org.drip.analytics.date.DateUtil.Year (iStartDate)) + 30. * - (org.drip.analytics.date.DateUtil.Month (iEndDate) - org.drip.analytics.date.DateUtil.Month - (iStartDate) + dm.posterior() - dm.anterior()) + (org.drip.analytics.date.DateUtil.Date - (iEndDate) - org.drip.analytics.date.DateUtil.Date (iStartDate))) / 365.; - } - - @Override public int daysAccrued ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA30_365 (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DC30_365::daysAccrued => Cannot create DateEOMAdjustment!"); - - return 365 * (org.drip.analytics.date.DateUtil.Year (iEndDate) - - org.drip.analytics.date.DateUtil.Year (iStartDate)) + 30 * - (org.drip.analytics.date.DateUtil.Month (iEndDate) - org.drip.analytics.date.DateUtil.Month - (iStartDate) + dm.posterior() - dm.anterior()) + (org.drip.analytics.date.DateUtil.Date - (iEndDate) - org.drip.analytics.date.DateUtil.Date (iStartDate)); - } -} diff --git a/org/drip/analytics/daycount/DC30_Act.java b/org/drip/analytics/daycount/DC30_Act.java deleted file mode 100644 index 40623c8..0000000 --- a/org/drip/analytics/daycount/DC30_Act.java +++ /dev/null @@ -1,126 +0,0 @@ - -package org.drip.analytics.daycount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * This class implements the 30/Act day count convention. - * - * @author Lakshmi Krishnamurthy - */ - -public class DC30_Act implements org.drip.analytics.daycount.DCFCalculator { - - /** - * Empty DC30_Act constructor - */ - - public DC30_Act() - { - } - - @Override public java.lang.String baseCalculationType() - { - return "DC30_Act"; - } - - @Override public java.lang.String[] alternateNames() - { - return new java.lang.String[] {"ISMA 30/Act", "30/Act", "ISDA SWAPS:30/Act", "ISDA30/Act", - "ISDA 30E/ACT", "DC30_Act"}; - } - - @Override public double yearFraction ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - if (null == actactParams) - throw new java.lang.Exception ("DC30_Act::yearFraction => Invalid actact Params!"); - - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DC30_Act::yearFraction => Cannot create DateEOMAdjustment!"); - - return org.drip.analytics.date.DateUtil.Year (iEndDate) - org.drip.analytics.date.DateUtil.Year - (iStartDate) + (30. * (org.drip.analytics.date.DateUtil.Month (iEndDate) - - org.drip.analytics.date.DateUtil.Month (iStartDate)) + (org.drip.analytics.date.DateUtil.Date - (iEndDate) - org.drip.analytics.date.DateUtil.Date (iStartDate) + dm.posterior() - - dm.anterior())) / actactParams.freq() / actactParams.days(); - } - - @Override public int daysAccrued ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - if (null == actactParams) - throw new java.lang.Exception ("DC30_Act::daysAccrued => Invalid actact Params!"); - - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DC30_Act::daysAccrued => Cannot create DateEOMAdjustment!"); - - return 360 * (org.drip.analytics.date.DateUtil.Year (iEndDate) - - org.drip.analytics.date.DateUtil.Year (iStartDate)) + 30 * - (org.drip.analytics.date.DateUtil.Month (iEndDate) - org.drip.analytics.date.DateUtil.Month - (iStartDate)) + org.drip.analytics.date.DateUtil.Date (iEndDate) - - org.drip.analytics.date.DateUtil.Date (iStartDate) + dm.posterior() - dm.anterior(); - } -} diff --git a/org/drip/analytics/daycount/DCAct_360.java b/org/drip/analytics/daycount/DCAct_360.java deleted file mode 100644 index d599aff..0000000 --- a/org/drip/analytics/daycount/DCAct_360.java +++ /dev/null @@ -1,112 +0,0 @@ - -package org.drip.analytics.daycount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * This class implements the Act/360 day count convention. - * - * @author Lakshmi Krishnamurthy - */ - -public class DCAct_360 implements org.drip.analytics.daycount.DCFCalculator { - - /** - * Empty DCAct_360 constructor - */ - - public DCAct_360() - { - } - - @Override public java.lang.String baseCalculationType() - { - return "DCAct_360"; - } - - @Override public java.lang.String[] alternateNames() - { - return new java.lang.String[] {"Actual/360 Fixed", "Act/360", "A/360", "French", "US:WIB Act/360", - "DCAct_360"}; - } - - @Override public double yearFraction ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DCAct_360::yearFraction => Cannot create DateEOMAdjustment!"); - - return 1. * (iEndDate - iStartDate + dm.posterior() - dm.anterior()) / 360.; - } - - @Override public int daysAccrued ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DCAct_360::daysAccrued => Cannot create DateEOMAdjustment!"); - - return iEndDate - iStartDate + dm.posterior() - dm.anterior(); - } -} diff --git a/org/drip/analytics/daycount/DCAct_364.java b/org/drip/analytics/daycount/DCAct_364.java deleted file mode 100644 index 0f20e33..0000000 --- a/org/drip/analytics/daycount/DCAct_364.java +++ /dev/null @@ -1,123 +0,0 @@ - -package org.drip.analytics.daycount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * This class implements the Act/364 day count convention. - * - * @author Lakshmi Krishnamurthy - */ - -public class DCAct_364 implements org.drip.analytics.daycount.DCFCalculator { - - /** - * Empty DCAct_364 constructor - */ - - public DCAct_364() - { - } - - @Override public java.lang.String baseCalculationType() - { - return "DCAct_364"; - } - - @Override public java.lang.String[] alternateNames() - { - return new java.lang.String[] {"Act/364", "DCAct_364"}; - } - - @Override public double yearFraction ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DCAct_364::yearFraction => Cannot create DateEOMAdjustment!"); - - return 1. * (iEndDate - iStartDate + dm.posterior() - dm.anterior()) / 364.; - } - - @Override public int daysAccrued ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DCAct_364::daysAccrued => Cannot create DateEOMAdjustment!"); - - int iDaysAccrued = 0; - - int iStartYear = org.drip.analytics.date.DateUtil.Year (iStartDate); - - int iEndYear = org.drip.analytics.date.DateUtil.Year (iEndDate); - - if (iEndYear == iStartYear) iDaysAccrued -= 364; - - for (int iYear = iStartYear + 1; iYear < iEndYear; ++iYear) - iDaysAccrued += 364; - - return iDaysAccrued + org.drip.analytics.date.DateUtil.DaysRemaining (iStartDate) - dm.anterior() + - org.drip.analytics.date.DateUtil.DaysElapsed (iEndDate) + dm.posterior(); - } -} diff --git a/org/drip/analytics/daycount/DCAct_365.java b/org/drip/analytics/daycount/DCAct_365.java deleted file mode 100644 index 05e5730..0000000 --- a/org/drip/analytics/daycount/DCAct_365.java +++ /dev/null @@ -1,112 +0,0 @@ - -package org.drip.analytics.daycount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * This class implements the Act/365 day count convention. - * - * @author Lakshmi Krishnamurthy - */ - -public class DCAct_365 implements org.drip.analytics.daycount.DCFCalculator { - - /** - * Empty DCAct_365 constructor - */ - - public DCAct_365() - { - } - - @Override public java.lang.String baseCalculationType() - { - return "DCAct_365"; - } - - @Override public java.lang.String[] alternateNames() - { - return new java.lang.String[] {"Actual/365 Fixed", "Act/365 Fixed", "A/365 Fixed", "A/365F", - "English", "Act/365", "DCAct_365"}; - } - - @Override public double yearFraction ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DCAct_365::yearFraction => Cannot create DateEOMAdjustment!"); - - return 1. * (iEndDate - iStartDate + dm.posterior() - dm.anterior()) / 365.; - } - - @Override public int daysAccrued ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DCAct_365::daysAccrued => Cannot create DateEOMAdjustment!"); - - return iEndDate - iStartDate + dm.posterior() - dm.anterior(); - } -} diff --git a/org/drip/analytics/daycount/DCAct_365L.java b/org/drip/analytics/daycount/DCAct_365L.java deleted file mode 100644 index 7858343..0000000 --- a/org/drip/analytics/daycount/DCAct_365L.java +++ /dev/null @@ -1,137 +0,0 @@ - -package org.drip.analytics.daycount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * This class implements the Act/365L day count convention. - * - * @author Lakshmi Krishnamurthy - */ - -public class DCAct_365L implements org.drip.analytics.daycount.DCFCalculator { - - /** - * Empty DCAct_365L constructor - */ - - public DCAct_365L() - { - } - - @Override public java.lang.String baseCalculationType() - { - return "DCAct_365L"; - } - - @Override public java.lang.String[] alternateNames() - { - return new java.lang.String[] {"Act/365L", "Actual/365L", "ISMA-Year", "Actual/Actual AFB", - "DCAct_365L"}; - } - - @Override public double yearFraction ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - if (null == actactParams) - throw new java.lang.Exception ("DCAct_365L::yearFraction => Invalid actact Params!"); - - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DCAct_365L::yearFraction => Cannot create DateEOMAdjustment!"); - - if (1 == actactParams.freq()) { - if (org.drip.analytics.date.DateUtil.ContainsFeb29 (iStartDate, iEndDate, - org.drip.analytics.date.DateUtil.RIGHT_INCLUDE)) - return 1. * (iEndDate - iStartDate + dm.posterior() - dm.anterior()) / 366.; - - return 1. * (iEndDate - iStartDate + dm.posterior() - dm.anterior()) / 365.; - } - - if (org.drip.analytics.date.DateUtil.IsLeapYear (iEndDate)) - return 1. * (iEndDate - iStartDate + dm.posterior() - dm.anterior()) / 366.; - - return 1. * (iEndDate - iStartDate + dm.posterior() - dm.anterior()) / 365.; - } - - @Override public int daysAccrued ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - if (null == actactParams) - throw new java.lang.Exception ("DCAct_365L::daysAccrued => Invalid actact Params!"); - - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DCAct_365L::daysAccrued => Cannot create DateEOMAdjustment!"); - - if (1 == actactParams.freq()) { - if (org.drip.analytics.date.DateUtil.ContainsFeb29 (iStartDate, iEndDate, - org.drip.analytics.date.DateUtil.RIGHT_INCLUDE)) - return iEndDate - iStartDate + dm.posterior() - dm.anterior(); - - return iEndDate - iStartDate + dm.posterior() - dm.anterior(); - } - - return iEndDate - iStartDate + dm.posterior() - dm.anterior(); - } -} diff --git a/org/drip/analytics/daycount/DCAct_Act.java b/org/drip/analytics/daycount/DCAct_Act.java deleted file mode 100644 index afbe0fb..0000000 --- a/org/drip/analytics/daycount/DCAct_Act.java +++ /dev/null @@ -1,163 +0,0 @@ - -package org.drip.analytics.daycount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * This class implements the Act/Act day count convention. - * - * @author Lakshmi Krishnamurthy - */ - -public class DCAct_Act implements org.drip.analytics.daycount.DCFCalculator { - - /** - * Empty DCAct_Act constructor - */ - - public DCAct_Act() - { - } - - @Override public java.lang.String baseCalculationType() - { - return "DCAct_Act"; - } - - @Override public java.lang.String[] alternateNames() - { - return new java.lang.String[] {"Actual/Actual", "Actual/Actual ICMA", "Act/Act", "Act/Act ICMA", - "ISMA-99", "Act/Act ISMA", "DCAct_Act"}; - } - - @Override public double yearFraction ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - double dblDCF = 0.; - int iNumLeapDays = 0; - int iNumNonLeapDays = 0; - - int iYearStart = org.drip.analytics.date.DateUtil.Year (iStartDate); - - int iYearEnd = org.drip.analytics.date.DateUtil.Year (iEndDate); - - if (iYearStart == iYearEnd) - return org.drip.analytics.date.DateUtil.IsLeapYear (iStartDate) ? (iEndDate - iStartDate) / 366. - : (iEndDate - iStartDate) / 365.; - - if (org.drip.analytics.date.DateUtil.IsLeapYear (iStartDate)) - iNumLeapDays += org.drip.analytics.date.DateUtil.DaysRemaining (iStartDate); - else - iNumNonLeapDays += org.drip.analytics.date.DateUtil.DaysRemaining (iStartDate); - - if (org.drip.analytics.date.DateUtil.IsLeapYear (iEndDate)) - iNumLeapDays += org.drip.analytics.date.DateUtil.DaysElapsed (iEndDate); - else - iNumNonLeapDays += org.drip.analytics.date.DateUtil.DaysElapsed (iEndDate); - - for (int iYear = iYearStart + 1; iYear < iYearEnd; ++iYear) { - int iYearJan1 = org.drip.analytics.date.DateUtil.ToJulian (iYear, - org.drip.analytics.date.DateUtil.JANUARY, 1); - - if (org.drip.analytics.date.DateUtil.IsLeapYear (iYearJan1)) - iNumLeapDays += 366; - else - iNumNonLeapDays += 365; - } - - return dblDCF + (((double) (iNumLeapDays)) / 366.) + (((double) (iNumNonLeapDays)) / 365.); - } - - @Override public int daysAccrued ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - int iNumLeapDays = 0; - int iNumNonLeapDays = 0; - - int iYearStart = org.drip.analytics.date.DateUtil.Year (iStartDate); - - int iYearEnd = org.drip.analytics.date.DateUtil.Year (iEndDate); - - if (iYearStart == iYearEnd) return iEndDate - iStartDate; - - if (org.drip.analytics.date.DateUtil.IsLeapYear (iStartDate)) - iNumLeapDays += org.drip.analytics.date.DateUtil.DaysRemaining (iStartDate); - else - iNumNonLeapDays += org.drip.analytics.date.DateUtil.DaysRemaining (iStartDate); - - if (org.drip.analytics.date.DateUtil.IsLeapYear (iEndDate)) - iNumLeapDays += org.drip.analytics.date.DateUtil.DaysElapsed (iEndDate); - else - iNumNonLeapDays += org.drip.analytics.date.DateUtil.DaysElapsed (iEndDate); - - for (int iYear = iYearStart + 1; iYear < iYearEnd; ++iYear) { - int iYearJan1 = org.drip.analytics.date.DateUtil.ToJulian (iYear, - org.drip.analytics.date.DateUtil.JANUARY, 1); - - if (org.drip.analytics.date.DateUtil.IsLeapYear (iYearJan1)) - iNumLeapDays += 366; - else - iNumNonLeapDays += 365; - } - - return iNumLeapDays + iNumNonLeapDays; - } -} diff --git a/org/drip/analytics/daycount/DCAct_Act_ISDA.java b/org/drip/analytics/daycount/DCAct_Act_ISDA.java deleted file mode 100644 index 036ddc2..0000000 --- a/org/drip/analytics/daycount/DCAct_Act_ISDA.java +++ /dev/null @@ -1,129 +0,0 @@ - -package org.drip.analytics.daycount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * This class implements the ISDA Act/Act day count convention. - * - * @author Lakshmi Krishnamurthy - */ - -public class DCAct_Act_ISDA implements org.drip.analytics.daycount.DCFCalculator { - - /** - * Empty DCAct_Act_ISDA constructor - */ - - public DCAct_Act_ISDA() - { - } - - @Override public java.lang.String baseCalculationType() - { - return "DCAct_Act_ISDA"; - } - - @Override public java.lang.String[] alternateNames() - { - return new java.lang.String[] {"Actual/Actual ISDA", "Act/Act ISDA", "US:WIT Act/Act", - "DCAct_Act_ISDA"}; - } - - @Override public double yearFraction ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DCAct_Act_ISDA::yearFraction => Cannot create DateEOMAdjustment!"); - - return 1. * ((org.drip.analytics.date.DateUtil.DaysRemaining (iStartDate) - dm.anterior()) / - (org.drip.analytics.date.DateUtil.IsLeapYear (iStartDate) ? 366. : 365.)) + - ((org.drip.analytics.date.DateUtil.DaysElapsed (iEndDate) + dm.posterior()) / - (org.drip.analytics.date.DateUtil.IsLeapYear (iEndDate) ? 366. : 365.)) + - org.drip.analytics.date.DateUtil.Year (iEndDate) - - org.drip.analytics.date.DateUtil.Year (iStartDate) - 1; - } - - @Override public int daysAccrued ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DCAct_Act_ISDA::daysAccrued => Cannot create DateEOMAdjustment!"); - - int iDaysAccrued = 0; - - int iStartYear = org.drip.analytics.date.DateUtil.Year (iStartDate); - - int iEndYear = org.drip.analytics.date.DateUtil.Year (iEndDate); - - if (iEndYear == iStartYear) iDaysAccrued -= 0 == iEndYear % 4 ? 366 : 365; - - for (int iYear = iStartYear + 1; iYear < iEndYear; ++iYear) - iDaysAccrued += 0 == iYear % 4 ? 366 : 365; - - return iDaysAccrued + org.drip.analytics.date.DateUtil.DaysRemaining (iStartDate) - dm.anterior() + - org.drip.analytics.date.DateUtil.DaysElapsed (iEndDate) + dm.posterior(); - } -} diff --git a/org/drip/analytics/daycount/DCAct_Act_UST.java b/org/drip/analytics/daycount/DCAct_Act_UST.java deleted file mode 100644 index 1ef77dd..0000000 --- a/org/drip/analytics/daycount/DCAct_Act_UST.java +++ /dev/null @@ -1,105 +0,0 @@ - -package org.drip.analytics.daycount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * This class implements the US Treasury Bond Act/Act Day Count Convention. - * - * @author Lakshmi Krishnamurthy - */ - -public class DCAct_Act_UST implements org.drip.analytics.daycount.DCFCalculator { - - /** - * Empty DCAct_Act_UST constructor - */ - - public DCAct_Act_UST() - { - } - - @Override public java.lang.String baseCalculationType() - { - return "DCAct_Act_UST"; - } - - @Override public java.lang.String[] alternateNames() - { - return new java.lang.String[] {"Actual/Actual UST", "Act/Act UST", "DCAct_Act_UST"}; - } - - @Override public double yearFraction ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - if (null == actactParams || iEndDate < iStartDate) - throw new java.lang.Exception ("DCAct_Act_UST::daysAccrued => Invalid Inputs! " + iStartDate + - " | " + iEndDate); - - return 1. * (iEndDate - iStartDate) / actactParams.days(); - } - - @Override public int daysAccrued ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - if (iEndDate < iStartDate) - throw new java.lang.Exception ("DCAct_Act_UST::daysAccrued => Invalid Inputs!"); - - return iEndDate - iStartDate; - } -} diff --git a/org/drip/analytics/daycount/DCFCalculator.java b/org/drip/analytics/daycount/DCFCalculator.java deleted file mode 100644 index b10acec..0000000 --- a/org/drip/analytics/daycount/DCFCalculator.java +++ /dev/null @@ -1,122 +0,0 @@ - -package org.drip.analytics.daycount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * This interface is the stub for all the day count convention functionality. It exposes the base/alternate - * day count convention names, the year-fraction and the days accrued. - * - * @author Lakshmi Krishnamurthy - */ - -public interface DCFCalculator { - - /** - * Retrieves the base calculation type corresponding to the DCF Calculator - * - * @return Name of the base calculation type - */ - - public abstract java.lang.String baseCalculationType(); - - /** - * Retrieves the full set of alternate names corresponding to the DCF Calculator - * - * @return Array of alternate names - */ - - public abstract java.lang.String[] alternateNames(); - - /** - * Calculates the accrual fraction in years between 2 given days - * - * @param iStartDate Start Date - * @param iEndDate End Date - * @param bApplyEOMAdj Apply end-of-month adjustment (true) - * @param actactParams ActActParams - * @param strCalendar Holiday Calendar - * - * @return Accrual Fraction in years - * - * @throws java.lang.Exception Thrown if the accrual fraction cannot be calculated - */ - - public abstract double yearFraction ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception; - - /** - * Calculates the number of days accrued between the two given days - * - * @param iStartDate Start Date - * @param iEndDate End Date - * @param bApplyEOMAdj Apply end-of-month adjustment (true) - * @param actactParams ActActParams - * @param strCalendar Holiday Calendar - * - * @return Accrual Fraction in years - * - * @throws java.lang.Exception Thrown if the accrual fraction cannot be calculated - */ - - public abstract int daysAccrued ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception; -} diff --git a/org/drip/analytics/daycount/DCNL_360.java b/org/drip/analytics/daycount/DCNL_360.java deleted file mode 100644 index 0330029..0000000 --- a/org/drip/analytics/daycount/DCNL_360.java +++ /dev/null @@ -1,115 +0,0 @@ - -package org.drip.analytics.daycount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * This class implements the NL/360 day count convention. - * - * @author Lakshmi Krishnamurthy - */ - -public class DCNL_360 implements org.drip.analytics.daycount.DCFCalculator { - - /** - * Empty DCNL_360 constructor - */ - - public DCNL_360() - { - } - - @Override public java.lang.String baseCalculationType() - { - return "DCNL_360"; - } - - @Override public java.lang.String[] alternateNames() - { - return new java.lang.String[] {"NL/360", "DCNL_360"}; - } - - @Override public double yearFraction ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DCNL_360::yearFraction => Cannot create DateEOMAdjustment!"); - - return 1. * (iEndDate - iStartDate + dm.posterior() - dm.anterior() - - org.drip.analytics.date.DateUtil.NumFeb29 (iStartDate, iEndDate, - org.drip.analytics.date.DateUtil.RIGHT_INCLUDE)) / 360.; - } - - @Override public int daysAccrued ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DCNL_360::daysAccrued => Cannot create DateEOMAdjustment!"); - - return iEndDate - iStartDate + dm.posterior() - dm.anterior() - - org.drip.analytics.date.DateUtil.NumFeb29 (iStartDate, iEndDate, - org.drip.analytics.date.DateUtil.RIGHT_INCLUDE); - } -} diff --git a/org/drip/analytics/daycount/DCNL_365.java b/org/drip/analytics/daycount/DCNL_365.java deleted file mode 100644 index d021035..0000000 --- a/org/drip/analytics/daycount/DCNL_365.java +++ /dev/null @@ -1,113 +0,0 @@ - -package org.drip.analytics.daycount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * This class implements the NL/365 day count convention. - * - * @author Lakshmi Krishnamurthy - */ - -public class DCNL_365 implements org.drip.analytics.daycount.DCFCalculator { - - /** - * Empty DCNL_365 constructor - */ - - public DCNL_365() - { - } - - @Override public java.lang.String baseCalculationType() - { - return "DCNL_365"; - } - - @Override public java.lang.String[] alternateNames() - { - return new java.lang.String[] {"Actual/365 JGB", "Actual/365 JGB (NL)", "NL/365", "DCNL_365"}; - } - - @Override public double yearFraction ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DCNL_365::yearFraction => Cannot create DateEOMAdjustment!"); - - return 1. * (iEndDate - iStartDate - org.drip.analytics.date.DateUtil.NumFeb29 (iStartDate, iEndDate, - org.drip.analytics.date.DateUtil.RIGHT_INCLUDE) + dm.posterior() - dm.anterior()) / 365.; - } - - @Override public int daysAccrued ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DCNL_365::daysAccrued => Cannot create DateEOMAdjustment!"); - - return iEndDate - iStartDate - org.drip.analytics.date.DateUtil.NumFeb29 (iStartDate, iEndDate, - org.drip.analytics.date.DateUtil.RIGHT_INCLUDE) + dm.posterior() - dm.anterior(); - } -} diff --git a/org/drip/analytics/daycount/DCNL_Act.java b/org/drip/analytics/daycount/DCNL_Act.java deleted file mode 100644 index b938fef..0000000 --- a/org/drip/analytics/daycount/DCNL_Act.java +++ /dev/null @@ -1,121 +0,0 @@ - -package org.drip.analytics.daycount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * This class implements the NL/Act day count convention. - * - * @author Lakshmi Krishnamurthy - */ - -public class DCNL_Act implements org.drip.analytics.daycount.DCFCalculator { - - /** - * Empty DCNL_Act constructor - */ - - public DCNL_Act() - { - } - - @Override public java.lang.String baseCalculationType() - { - return "DCNL_Act"; - } - - @Override public java.lang.String[] alternateNames() - { - return new java.lang.String[] {"NL/Act", "DCNL_Act"}; - } - - @Override public double yearFraction ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - if (null == actactParams) - throw new java.lang.Exception ("DCNL_Act::yearFraction => Invalid ActActDCParams!"); - - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DCNL_Act::yearFraction => Cannot create DateEOMAdjustment!"); - - return 1. * (iEndDate - iStartDate + dm.posterior() - dm.anterior() - - org.drip.analytics.date.DateUtil.NumFeb29 (iStartDate, iEndDate, - org.drip.analytics.date.DateUtil.RIGHT_INCLUDE)) / actactParams.freq() / actactParams.days(); - } - - @Override public int daysAccrued ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj, - final ActActDCParams actactParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - if (null == actactParams) - throw new java.lang.Exception ("DCNL_Act::daysAccrued =>: Invalid ActActDCParams!"); - - DateEOMAdjustment dm = DateEOMAdjustment.MakeDEOMA (iStartDate, iEndDate, bApplyEOMAdj); - - if (null == dm) - throw new java.lang.Exception ("DCNL_Act::daysAccrued => Cannot create DateEOMAdjustment!"); - - return iEndDate - iStartDate + dm.posterior() - dm.anterior() - - org.drip.analytics.date.DateUtil.NumFeb29 (iStartDate, iEndDate, - org.drip.analytics.date.DateUtil.RIGHT_INCLUDE); - } -} diff --git a/org/drip/analytics/daycount/DateAdjustParams.java b/org/drip/analytics/daycount/DateAdjustParams.java deleted file mode 100644 index 8fd2e63..0000000 --- a/org/drip/analytics/daycount/DateAdjustParams.java +++ /dev/null @@ -1,125 +0,0 @@ - -package org.drip.analytics.daycount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * This class contains the parameters needed for adjusting dates. It exports the following functionality: - * - Accessor for holiday calendar and adjustment type - * - Serialization/De-serialization to and from Byte Arrays - * - * @author Lakshmi Krishnamurthy - */ - -public class DateAdjustParams { - private int _iRollMode = 0; - private int _iNumDaysToRoll = -1; - private java.lang.String _strCalendar = ""; - - /** - * Create a DateAdjustParams instance from the roll mode and the calendar - * - * @param iRollMode Roll Mode - * @param iNumDaysToRoll Number of Days to Roll - * @param strCalendar Calendar - */ - - public DateAdjustParams ( - final int iRollMode, - final int iNumDaysToRoll, - final java.lang.String strCalendar) - { - _iRollMode = iRollMode; - _strCalendar = strCalendar; - _iNumDaysToRoll = iNumDaysToRoll; - } - - /** - * Retrieve the Roll Mode - * - * @return The Roll Mode - */ - - public int rollMode() - { - return _iRollMode; - } - - /** - * Retrieve the Roll Holiday Calendar - * - * @return The Roll Holiday Calendar - */ - - public java.lang.String calendar() - { - return _strCalendar; - } - - /** - * Roll the given Date - * - * @param iDate date - * - * @return The Rolled Date - * - * @throws java.lang.Exception Thrown if the input day is invalid - */ - - public int roll ( - final int iDate) - throws java.lang.Exception - { - return org.drip.analytics.daycount.Convention.RollDate (iDate, _iRollMode, _strCalendar, - _iNumDaysToRoll); - } -} diff --git a/org/drip/analytics/daycount/DateEOMAdjustment.java b/org/drip/analytics/daycount/DateEOMAdjustment.java deleted file mode 100644 index f935d68..0000000 --- a/org/drip/analytics/daycount/DateEOMAdjustment.java +++ /dev/null @@ -1,325 +0,0 @@ - -package org.drip.analytics.daycount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * This class holds the applicable adjustments for a given date pair. It exposes the following functionality: - * - Static Methods for creating 30/360, 30/365, and EOMA Date Adjustments - * - Export Anterior and Posterior EOM Adjustments - * - * @author Lakshmi Krishnamurthy - */ - -public class DateEOMAdjustment { - private int _iD1Adj = 0; - private int _iD2Adj = 0; - - /** - * Construct a DateEOMAdjustment Instance for the 30/365 Day Count - * - * @param iStartDate Start Date - * @param iEndDate End Date - * @param bApplyEOMAdj TRUE - Apply EOM Adjustment - * - * @return DateEOMAdjustment Instance - */ - - public static final DateEOMAdjustment MakeDEOMA30_365 ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj) - { - DateEOMAdjustment dm = new DateEOMAdjustment(); - - if (!bApplyEOMAdj) return dm; - - if (iEndDate > iStartDate) return null; - - try { - if (org.drip.analytics.date.DateUtil.FEBRUARY == org.drip.analytics.date.DateUtil.Month - (iStartDate) && org.drip.analytics.date.DateUtil.IsEOM (iStartDate) && - org.drip.analytics.date.DateUtil.FEBRUARY == org.drip.analytics.date.DateUtil.Month - (iEndDate) && org.drip.analytics.date.DateUtil.IsEOM (iEndDate)) - dm._iD2Adj = (28 == org.drip.analytics.date.DateUtil.DaysInMonth - (org.drip.analytics.date.DateUtil.Month (iEndDate), - org.drip.analytics.date.DateUtil.Year (iEndDate)) ? 2 : 1); - - if (org.drip.analytics.date.DateUtil.FEBRUARY == org.drip.analytics.date.DateUtil.Month - (iStartDate) && org.drip.analytics.date.DateUtil.IsEOM (iStartDate)) - dm._iD1Adj = (28 == org.drip.analytics.date.DateUtil.DaysInMonth - (org.drip.analytics.date.DateUtil.Month (iStartDate), - org.drip.analytics.date.DateUtil.Year (iStartDate)) ? 2 : 1); - - if (31 == org.drip.analytics.date.DateUtil.Date (iEndDate) + dm._iD2Adj && (30 == - org.drip.analytics.date.DateUtil.Date (iStartDate) + dm._iD1Adj || 31 == - org.drip.analytics.date.DateUtil.Date (iStartDate) + dm._iD1Adj)) - dm._iD2Adj -= 1; - - if (31 == org.drip.analytics.date.DateUtil.Date (iStartDate) + dm._iD1Adj) dm._iD1Adj -= 1; - - return dm; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a DateEOMAdjustment Instance for the 30/360 Day Count - * - * @param iStartDate Start Date - * @param iEndDate End Date - * @param bApplyEOMAdj TRUE - Apply EOM Adjustment - * - * @return DateEOMAdjustment Instance - */ - - public static final DateEOMAdjustment MakeDEOMA30_360 ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj) - { - DateEOMAdjustment dm = new DateEOMAdjustment(); - - if (!bApplyEOMAdj) return dm; - - try { - if (31 == org.drip.analytics.date.DateUtil.Date (iStartDate)) dm._iD1Adj -= 1; - - if (!org.drip.analytics.date.DateUtil.IsLeapYear (iStartDate)) { - if (org.drip.analytics.date.DateUtil.FEBRUARY == org.drip.analytics.date.DateUtil.Month - (iStartDate) && 28 == org.drip.analytics.date.DateUtil.Date (iStartDate)) - dm._iD1Adj += 2; - } else { - if (org.drip.analytics.date.DateUtil.FEBRUARY == org.drip.analytics.date.DateUtil.Month - (iStartDate) && 29 == org.drip.analytics.date.DateUtil.Date (iStartDate)) - dm._iD1Adj += 1; - } - - if (31 == org.drip.analytics.date.DateUtil.Date (iEndDate) && (30 == - org.drip.analytics.date.DateUtil.Date (iStartDate) || 31 == - org.drip.analytics.date.DateUtil.Date (iStartDate))) - dm._iD2Adj -= 1; - - return dm; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a DateEOMAdjustment Instance for all other Day Counts - * - * @param iStartDate Start Date - * @param iEndDate End Date - * @param bApplyEOMAdj TRUE - Apply EOM Adjustment - * - * @return DateEOMAdjustment Instance - */ - - public static final DateEOMAdjustment MakeDEOMA ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj) - { - DateEOMAdjustment dm = new DateEOMAdjustment(); - - if (!bApplyEOMAdj) return dm; - - try { - if (bApplyEOMAdj) { - if (org.drip.analytics.date.DateUtil.IsEOM (iStartDate)) - dm._iD1Adj = 30 - org.drip.analytics.date.DateUtil.Date (iStartDate); - - if (org.drip.analytics.date.DateUtil.IsEOM (iEndDate) && - (org.drip.analytics.date.DateUtil.FEBRUARY != org.drip.analytics.date.DateUtil.Month - (iEndDate))) - dm._iD2Adj = 30 - org.drip.analytics.date.DateUtil.Date (iEndDate); - } - - return dm; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a DateEOMAdjustment Instance for the 30E/360 Day Count - * - * @param iStartDate Start Date - * @param iEndDate End Date - * @param bApplyEOMAdj TRUE - Apply EOM Adjustment - * - * @return DateEOMAdjustment Instance - */ - - public static final DateEOMAdjustment MakeDEOMA30E_360 ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj) - { - DateEOMAdjustment dm = new DateEOMAdjustment(); - - if (!bApplyEOMAdj) return dm; - - try { - if (bApplyEOMAdj) { - if (31 == org.drip.analytics.date.DateUtil.Date (iStartDate)) dm._iD1Adj = -1; - - if (31 == org.drip.analytics.date.DateUtil.Date (iEndDate)) dm._iD2Adj = -1; - } - - return dm; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a DateEOMAdjustment Instance for the 30E/360 ISDA Day Count - * - * @param iStartDate Start Date - * @param iEndDate End Date - * @param bApplyEOMAdj TRUE - Apply EOM Adjustment - * - * @return DateEOMAdjustment instance - */ - - public static final DateEOMAdjustment MakeDEOMA30E_360_ISDA ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj) - { - DateEOMAdjustment dm = new DateEOMAdjustment(); - - if (!bApplyEOMAdj) return dm; - - try { - if (bApplyEOMAdj) { - if (org.drip.analytics.date.DateUtil.IsEOM (iStartDate)) - dm._iD1Adj = 30 - org.drip.analytics.date.DateUtil.Date (iStartDate); - - if (org.drip.analytics.date.DateUtil.IsEOM (iEndDate)) - dm._iD2Adj = 30 - org.drip.analytics.date.DateUtil.Date (iEndDate); - } - - return dm; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a DateEOMAdjustment Instance for the 30E+/360 ISDA Day Count - * - * @param iStartDate Start Date - * @param iEndDate End Date - * @param bApplyEOMAdj TRUE - Apply EOM Adjustment - * - * @return DateEOMAdjustment instance - */ - - public static final DateEOMAdjustment MakeDEOMA30EPLUS_360_ISDA ( - final int iStartDate, - final int iEndDate, - final boolean bApplyEOMAdj) - { - DateEOMAdjustment dm = new DateEOMAdjustment(); - - if (!bApplyEOMAdj) return dm; - - try { - if (bApplyEOMAdj) { - if (31 == org.drip.analytics.date.DateUtil.Date (iStartDate)) dm._iD1Adj = -1; - - if (31 == org.drip.analytics.date.DateUtil.Date (iStartDate)) dm._iD2Adj = +1; - } - - return dm; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Anterior Date Adjustment - * - * @return The Anterior Date Adjustment - */ - - public int anterior() - { - return _iD1Adj; - } - - /** - * Retrieve the Posterior Date Adjustment - * - * @return The Posterior Date Adjustment - */ - - public int posterior() - { - return _iD2Adj; - } -} diff --git a/org/drip/analytics/definition/Curve.java b/org/drip/analytics/definition/Curve.java deleted file mode 100644 index e13b29e..0000000 --- a/org/drip/analytics/definition/Curve.java +++ /dev/null @@ -1,120 +0,0 @@ - -package org.drip.analytics.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * Curve extends the Latent State to abstract the functionality required among all financial curve. It - * exposes the following functionality: - * - Set the Epoch and the Identifiers - * - Set up/retrieve the Calibration Inputs - * - Retrieve the Latent State Metric Measures - * - * @author Lakshmi Krishnamurthy - */ - -public interface Curve extends org.drip.state.representation.LatentState { - - /** - * Get the Curve Latent State Identifier Label - * - * @return The Curve Latent State Identifier Label - */ - - public abstract org.drip.state.identifier.LatentStateLabel label(); - - /** - * Get the Epoch Date - * - * @return The Epoch Date - */ - - public abstract org.drip.analytics.date.JulianDate epoch(); - - /** - * Get the Currency - * - * @return Currency - */ - - public abstract java.lang.String currency(); - - /** - * Set the Curve Construction Input Set Parameters - * - * @param ccis The Curve Construction Input Set Parameters - * - * @return TRUE - Inputs successfully Set - */ - - public boolean setCCIS ( - final org.drip.analytics.input.CurveConstructionInputSet ccis); - - /** - * Retrieve the Calibration Components - * - * @return Array of Calibration Components - */ - - public abstract org.drip.product.definition.CalibratableComponent[] calibComp(); - - /** - * Retrieve the Manifest Measure Map of the given Instrument used to construct the Curve - * - * @param strInstrumentCode The Calibration Instrument's Code whose Manifest Measure Map is sought - * - * @return The Manifest Measure Map of the given Instrument used to construct the Curve - */ - - public abstract org.drip.analytics.support.CaseInsensitiveTreeMap manifestMeasure ( - final java.lang.String strInstrumentCode); -} diff --git a/org/drip/analytics/definition/ExplicitBootCurve.java b/org/drip/analytics/definition/ExplicitBootCurve.java deleted file mode 100644 index 22c24f3..0000000 --- a/org/drip/analytics/definition/ExplicitBootCurve.java +++ /dev/null @@ -1,100 +0,0 @@ - -package org.drip.analytics.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * In ExplicitBootCurve, the segment boundaries explicitly line up with the instrument maturity boundaries. - * This feature is exploited in building a boot-strappable curve. Functionality is provides set the Latent - * State at the Explicit Node, adjust the Latent State at the given Node, or set a common Flat Value across - * all Nodes. - * - * @author Lakshmi Krishnamurthy - */ - -public interface ExplicitBootCurve extends org.drip.analytics.definition.Curve { - - /** - * Set the Value/Slope at the Node specified by the Index - * - * @param iIndex Node Index - * @param dblValue Node Value - * - * @return Success (true), failure (false) - */ - - public abstract boolean setNodeValue ( - final int iIndex, - final double dblValue); - - /** - * Bump the node value at the node specified the index by the value - * - * @param iIndex node index - * @param dblValue node bump value - * - * @return Success (true), failure (false) - */ - - public abstract boolean bumpNodeValue ( - final int iIndex, - final double dblValue); - - /** - * Set the flat value across all the nodes - * - * @param dblValue node value - * - * @return Success (true), failure (false) - */ - - public abstract boolean setFlatValue ( - final double dblValue); -} diff --git a/org/drip/analytics/definition/LatentStateStatic.java b/org/drip/analytics/definition/LatentStateStatic.java deleted file mode 100644 index 4325f8e..0000000 --- a/org/drip/analytics/definition/LatentStateStatic.java +++ /dev/null @@ -1,191 +0,0 @@ - -package org.drip.analytics.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * LatentStateStatic contains the Analytics Latent STate Static/Textual Identifiers. - * - * @author Lakshmi Krishnamurthy - */ - -public class LatentStateStatic { - - /** - * Forward Latent State - */ - - public static final java.lang.String LATENT_STATE_FORWARD = "LATENT_STATE_FORWARD"; - - /** - * Forward Latent State Quantification Metric - Forward Rate - */ - - public static final java.lang.String FORWARD_QM_FORWARD_RATE = "FORWARD_QM_FORWARD_RATE"; - - /** - * Forward Latent State Quantification Metric - LIBOR Rate - */ - - public static final java.lang.String FORWARD_QM_LIBOR_RATE = "FORWARD_QM_LIBOR_RATE"; - - /** - * Forward Latent State Quantification Metric - Shifted Forward Rate - */ - - public static final java.lang.String FORWARD_QM_SHIFTED_FORWARD_RATE = "FORWARD_QM_SHIFTED_FORWARD_RATE"; - - /** - * Forward Latent State Quantification Metric - Instantaneous Forward Rate - */ - - public static final java.lang.String FORWARD_QM_INSTANTANEOUS_FORWARD_RATE = - "FORWARD_QM_INSTANTANEOUS_FORWARD_RATE"; - - /** - * Forward Latent State Quantification Metric - Continuously Compounded Forward Rate - */ - - public static final java.lang.String FORWARD_QM_CONTINUOUSLY_COMPOUNDED_FORWARD_RATE = - "FORWARD_QM_CONTINUOUSLY_COMPOUNDED_FORWARD_RATE"; - - /** - * Forward Latent State Quantification Metric - Instantaneous Effective Annual Forward Rate - */ - - public static final java.lang.String FORWARD_QM_INSTANTANEOUS_EFFECTIVE_FORWARD_RATE = - "FORWARD_QM_EFFECTIVE_ANNUAL_FORWARD_RATE"; - - /** - * Forward Latent State Quantification Metric - Instantaneous Nominal Annual Forward Rate - */ - - public static final java.lang.String FORWARD_QM_INSTANTANEOUS_NOMINAL_FORWARD_RATE = - "FORWARD_QM_NOMINAL_ANNUAL_FORWARD_RATE"; - - /** - * Funding Latent State - */ - - public static final java.lang.String LATENT_STATE_FUNDING = "LATENT_STATE_FUNDING"; - - /** - * Discount Latent State Quantification Metric - Discount Factor - */ - - public static final java.lang.String DISCOUNT_QM_DISCOUNT_FACTOR = "DISCOUNT_QM_DISCOUNT_FACTOR"; - - /** - * Discount Latent State Quantification Metric - Zero Rate - */ - - public static final java.lang.String DISCOUNT_QM_ZERO_RATE = "DISCOUNT_QM_ZERO_RATE"; - - /** - * Discount Latent State Quantification Metric - Compounded Short Rate - */ - - public static final java.lang.String DISCOUNT_QM_COMPOUNDED_SHORT_RATE = - "DISCOUNT_QM_COMPOUNDED_SHORT_RATE"; - - /** - * Discount Latent State Quantification Metric - Forward Rate - */ - - public static final java.lang.String DISCOUNT_QM_FORWARD_RATE = "DISCOUNT_QM_FORWARD_RATE"; - - /** - * Govvie Latent State - */ - - public static final java.lang.String LATENT_STATE_GOVVIE = "LATENT_STATE_GOVVIE"; - - /** - * Govvie Latent State Quantification Metric - Treasury Benchmark Yield - */ - - public static final java.lang.String GOVVIE_QM_YIELD = "GOVVIE_QM_YIELD"; - - /** - * FX Latent State - */ - - public static final java.lang.String LATENT_STATE_FX = "LATENT_STATE_FX"; - - /** - * FX Latent State Quantification Metric - FX Forward Outright - */ - - public static final java.lang.String FX_QM_FORWARD_OUTRIGHT = "FX_QM_FORWARD_OUTRIGHT"; - - /** - * Volatility Latent State - */ - - public static final java.lang.String LATENT_STATE_VOLATILITY = "LATENT_STATE_VOLATILITY"; - - /** - * Volatility Latent State Quantification Metric - SABR Volatility - */ - - public static final java.lang.String VOLATILITY_QM_SABR_VOLATILITY = "VOLATILITY_QM_SABR_VOLATILITY"; - - /** - * Volatility Latent State Quantification Metric - Lognormal Volatility - */ - - public static final java.lang.String VOLATILITY_QM_LOGNORMAL_VOLATILITY = - "VOLATILITY_QM_LOGNORMAL_VOLATILITY"; - - /** - * Volatility Latent State Quantification Metric - Normal Volatility - */ - - public static final java.lang.String VOLATILITY_QM_NORMAL_VOLATILITY = "VOLATILITY_QM_NORMAL_VOLATILITY"; -} diff --git a/org/drip/analytics/definition/MarketSurface.java b/org/drip/analytics/definition/MarketSurface.java deleted file mode 100644 index 56dd982..0000000 --- a/org/drip/analytics/definition/MarketSurface.java +++ /dev/null @@ -1,222 +0,0 @@ - -package org.drip.analytics.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * MarketSurface exposes the stub that implements the market surface that holds the latent state's - * Evolution parameters. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class MarketSurface implements org.drip.analytics.definition.Curve { - protected java.lang.String _strCurrency = ""; - protected int _iEpochDate = java.lang.Integer.MIN_VALUE; - protected org.drip.state.identifier.CustomLabel _label = null; - - protected MarketSurface ( - final int iEpochDate, - final org.drip.state.identifier.CustomLabel label, - final java.lang.String strCurrency) - throws java.lang.Exception - { - if (null == (_strCurrency = strCurrency) || _strCurrency.isEmpty()) - throw new java.lang.Exception ("MarketSurface ctr: Invalid Inputs"); - - _iEpochDate = iEpochDate; - } - - @Override public org.drip.state.identifier.LatentStateLabel label() - { - return _label; - } - - @Override public java.lang.String currency() - { - return _strCurrency; - } - - @Override public org.drip.analytics.date.JulianDate epoch() - { - try { - return new org.drip.analytics.date.JulianDate (_iEpochDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public boolean setCCIS ( - final org.drip.analytics.input.CurveConstructionInputSet ccis) - { - return false; - } - - @Override public org.drip.product.definition.CalibratableComponent[] calibComp() - { - return null; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap manifestMeasure ( - final java.lang.String strInstr) - { - return null; - } - - @Override public org.drip.state.representation.LatentState parallelShiftManifestMeasure ( - final java.lang.String strManifestMeasure, - final double dblShift) - { - return null; - } - - @Override public org.drip.state.representation.LatentState shiftManifestMeasure ( - final int iSpanIndex, - final java.lang.String strManifestMeasure, - final double dblShift) - { - return null; - } - - @Override public org.drip.state.representation.LatentState customTweakManifestMeasure ( - final java.lang.String strManifestMeasure, - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - return null; - } - - @Override public org.drip.state.representation.LatentState parallelShiftQuantificationMetric ( - final double dblShift) - { - return null; - } - - @Override public org.drip.state.representation.LatentState customTweakQuantificationMetric ( - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - return null; - } - - /** - * Get the Market Node given the X and the Y Ordinates - * - * @param dblX X - * @param dblY Y - * - * @return The Latent State Metric Value evaluated from the Surface - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public abstract double node ( - final double dblX, - final double dblY) - throws java.lang.Exception; - - /** - * Get the Market Node given the Strike and the Tenor - * - * @param dblStrike The Strike - * @param strTenor The Maturity Tenor - * - * @return The Volatility evaluated from the Volatility Surface - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double node ( - final double dblStrike, - final java.lang.String strTenor) - throws java.lang.Exception - { - if (null == strTenor || strTenor.isEmpty()) - throw new java.lang.Exception ("MarketSurface::node => Invalid Inputs"); - - return node (dblStrike, epoch().addTenor (strTenor).julian()); - } - - /** - * Extract the Term Structure Constructed at the X Anchor Node - * - * @param dblXAnchor The X Anchor Node - * - * @return The Term Structure Constructed at the X Anchor Node - */ - - public abstract org.drip.analytics.definition.NodeStructure xAnchorTermStructure ( - final double dblXAnchor); - - /** - * Extract the Term Structure Constructed at the Y Anchor Node - * - * @param dblYAnchor The Y Anchor - * - * @return The Term Structure Constructed at the Y Anchor Node - */ - - public abstract org.drip.analytics.definition.NodeStructure yAnchorTermStructure ( - final double dblYAnchor); - - /** - * Extract the Term Structure Constructed at the Maturity Anchor Tenor - * - * @param strTenorAnchor The Anchor Tenor - * - * @return The Term Structure Constructed at the Maturity Anchor Tenor - */ - - public org.drip.analytics.definition.NodeStructure maturityAnchorTermStructure ( - final java.lang.String strTenorAnchor) - { - return null == strTenorAnchor || strTenorAnchor.isEmpty() ? null : yAnchorTermStructure - (epoch().addTenor (strTenorAnchor).julian()); - } -} diff --git a/org/drip/analytics/definition/NodeStructure.java b/org/drip/analytics/definition/NodeStructure.java deleted file mode 100644 index 6521e82..0000000 --- a/org/drip/analytics/definition/NodeStructure.java +++ /dev/null @@ -1,260 +0,0 @@ - -package org.drip.analytics.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * NodeStructure exposes the stub that implements the latent state's Node Structure (e.g., a Deterministic - * Term Structure) - by Construction, this is expected to be non-local. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class NodeStructure implements org.drip.analytics.definition.Curve { - protected java.lang.String _strName = ""; - protected java.lang.String _strCurrency = ""; - protected int _iEpochDate = java.lang.Integer.MIN_VALUE; - protected org.drip.state.identifier.LatentStateLabel _label = null; - - protected NodeStructure ( - final int iEpochDate, - final org.drip.state.identifier.LatentStateLabel label, - final java.lang.String strCurrency) - throws java.lang.Exception - { - if (null == (_label = label) || null == (_strCurrency = strCurrency) || _strCurrency.isEmpty()) - throw new java.lang.Exception ("NodeStructure ctr: Invalid Inputs"); - - _iEpochDate = iEpochDate; - } - - @Override public org.drip.state.identifier.LatentStateLabel label() - { - return _label; - } - - @Override public java.lang.String currency() - { - return _strCurrency; - } - - @Override public org.drip.analytics.date.JulianDate epoch() - { - try { - return new org.drip.analytics.date.JulianDate (_iEpochDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public boolean setCCIS ( - final org.drip.analytics.input.CurveConstructionInputSet ccis) - { - return false; - } - - @Override public org.drip.product.definition.CalibratableComponent[] calibComp() - { - return null; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap manifestMeasure ( - final java.lang.String strInstr) - { - return null; - } - - @Override public org.drip.state.representation.LatentState parallelShiftManifestMeasure ( - final java.lang.String strManifestMeasure, - final double dblShift) - { - return null; - } - - @Override public org.drip.state.representation.LatentState shiftManifestMeasure ( - final int iSpanIndex, - final java.lang.String strManifestMeasure, - final double dblShift) - { - return null; - } - - @Override public org.drip.state.representation.LatentState customTweakManifestMeasure ( - final java.lang.String strManifestMeasure, - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - return null; - } - - @Override public org.drip.state.representation.LatentState parallelShiftQuantificationMetric ( - final double dblShift) - { - return null; - } - - @Override public org.drip.state.representation.LatentState customTweakQuantificationMetric ( - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - return null; - } - - /** - * Get the Market Node at the given Predictor Ordinate - * - * @param iPredictorOrdinate The Predictor Ordinate - * - * @return The Node evaluated from the Term Structure - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public abstract double node ( - final int iPredictorOrdinate) - throws java.lang.Exception; - - /** - * Get the Market Node Derivative at the given Predictor Ordinate - * - * @param iPredictorOrdinate The Predictor Ordinate - * @param iOrder Order of the Derivative - * - * @return The Node Derivative evaluated from the Term Structure - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public abstract double nodeDerivative ( - final int iPredictorOrdinate, - final int iOrder) - throws java.lang.Exception; - - /** - * Get the Market Node at the given Maturity - * - * @param dt The Julian Maturity Date - * - * @return The Node evaluated from the Term Structure - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double node ( - final org.drip.analytics.date.JulianDate dt) - throws java.lang.Exception - { - if (null == dt) throw new java.lang.Exception ("NodeStructure::node => Invalid Inputs"); - - return node (dt.julian()); - } - - /** - * Get the Market Node at the given Maturity - * - * @param strTenor The Maturity Tenor - * - * @return The Node evaluated from the Term Structure - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double node ( - final java.lang.String strTenor) - throws java.lang.Exception - { - if (null == strTenor || strTenor.isEmpty()) - throw new java.lang.Exception ("NodeStructure::node => Invalid Inputs"); - - return node (epoch().addTenor (strTenor).julian()); - } - - /** - * Get the Market Node Derivative at the given Maturity - * - * @param dt The Julian Maturity Date - * @param iOrder Order of the Derivative - * - * @return The Node Derivative evaluated from the Term Structure - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double nodeDerivative ( - final org.drip.analytics.date.JulianDate dt, - final int iOrder) - throws java.lang.Exception - { - if (null == dt) throw new java.lang.Exception ("TermStructure::nodeDerivative => Invalid Inputs"); - - return nodeDerivative (dt.julian(), iOrder); - } - - /** - * Get the Market Node Derivative at the given Maturity - * - * @param strTenor The Maturity Tenor - * @param iOrder Order of the Derivative - * - * @return The Node Derivative evaluated from the Term Structure - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double nodeDerivative ( - final java.lang.String strTenor, - final int iOrder) - throws java.lang.Exception - { - if (null == strTenor || strTenor.isEmpty()) - throw new java.lang.Exception ("TermStructure::nodeDerivative => Invalid Inputs"); - - return nodeDerivative (epoch().addTenor (strTenor).julian(), iOrder); - } -} diff --git a/org/drip/analytics/definition/Turn.java b/org/drip/analytics/definition/Turn.java deleted file mode 100644 index c2479d5..0000000 --- a/org/drip/analytics/definition/Turn.java +++ /dev/null @@ -1,118 +0,0 @@ - -package org.drip.analytics.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * Turn implements rate spread at discrete time spans. It contains the turn amount and the start/end turn - * spans. - * - * @author Lakshmi Krishnamurthy - */ - -public class Turn { - private double _dblSpread = java.lang.Double.NaN; - private int _iStartDate = java.lang.Integer.MIN_VALUE; - private int _iFinishDate = java.lang.Integer.MIN_VALUE; - - /** - * Turn Constructor - * - * @param iStartDate Turn Period Start Date - * @param iFinishDate Turn Period Finish Date - * @param dblSpread Turn Period Spread - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public Turn ( - final int iStartDate, - final int iFinishDate, - final double dblSpread) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblSpread = dblSpread) || (_iFinishDate = - iFinishDate) <= (_iStartDate = iStartDate)) - throw new java.lang.Exception ("Turn Ctr: Invalid Inputs"); - } - - /** - * Retrieve the Start Date - * - * @return The Start Date - */ - - public int startDate() - { - return _iStartDate; - } - - /** - * Retrieve the Finish Date - * - * @return The Finish Date - */ - - public int finishDate() - { - return _iFinishDate; - } - - /** - * Retrieve the Spread - * - * @return The Spread - */ - - public double spread() - { - return _dblSpread; - } -} diff --git a/org/drip/analytics/eventday/Base.java b/org/drip/analytics/eventday/Base.java deleted file mode 100644 index 85bb940..0000000 --- a/org/drip/analytics/eventday/Base.java +++ /dev/null @@ -1,131 +0,0 @@ - -package org.drip.analytics.eventday; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * Base is an abstraction around holiday and description. Abstract function generates an optional - * adjustment for weekends in a given year. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class Base { - private java.lang.String _strDescription = ""; - - /** - * Constructs the Base instance from the description - * - * @param strDescription Holiday Description - */ - - public Base ( - final java.lang.String strDescription) - { - _strDescription = strDescription; - } - - /** - * Roll the date to a non-holiday according to the rule specified - * - * @param iDate Date to be rolled - * @param bBalkOnYearShift Throw an exception if the year change happens - * @param wkend Object representing the weekend days - * - * @return The Adjusted Date - * - * @throws java.lang.Exception Thrown if the holiday cannot be rolled - */ - - public static final int rollHoliday ( - final int iDate, - final boolean bBalkOnYearShift, - final Weekend wkend) - throws java.lang.Exception - { - int iRolledDate = iDate; - - if (null != wkend && wkend.isLeftWeekend (iDate)) iRolledDate = iDate - 1; - - if (null != wkend && wkend.isRightWeekend (iDate)) iRolledDate = iDate + 1; - - if (bBalkOnYearShift & org.drip.analytics.date.DateUtil.Year (iDate) != - org.drip.analytics.date.DateUtil.Year (iRolledDate)) - throw new java.lang.Exception ("Base::rollHoliday => Invalid Inputs"); - - return iRolledDate; - } - - /** - * Return the description - * - * @return Description - */ - - public java.lang.String description() - { - return _strDescription; - } - - /** - * Generate the full date specific to the input year - * - * @param iYear Input Year - * @param bAdjusted Whether adjustment is desired - * - * @return The full date - */ - - public abstract int dateInYear ( - final int iYear, - final boolean bAdjusted); -} diff --git a/org/drip/analytics/eventday/DateInMonth.java b/org/drip/analytics/eventday/DateInMonth.java deleted file mode 100644 index f0f7fe3..0000000 --- a/org/drip/analytics/eventday/DateInMonth.java +++ /dev/null @@ -1,264 +0,0 @@ - -package org.drip.analytics.eventday; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * DateInMonth exports Functionality that generates the specific Event Date inside of the specified - * Month/Year. - * - * @author Lakshmi Krishnamurthy - */ - -public class DateInMonth { - - /** - * Instance Date Generation Rules - Generate from Lag from Front/Back - */ - - public static final int INSTANCE_GENERATOR_RULE_EDGE_LAG = 1; - - /** - * Instance Date Generation Rule - Generate from Specified Day in Week/Week in Month - */ - - public static final int INSTANCE_GENERATOR_RULE_WEEK_DAY = 2; - - /** - * Instance Date Generation Rule - Generate Using the Specific Day of the Month - */ - - public static final int INSTANCE_GENERATOR_RULE_SPECIFIC_DAY_OF_MONTH = 3; - - private int _iLag = -1; - private int _iDayOfWeek = -1; - private int _iWeekInMonth = -1; - private boolean _bFromBack = false; - private int _iSpecificDayInMonth = -1; - private int _iInstanceGeneratorRule = -1; - - /** - * DateInMonth Constructor - * - * @param iInstanceGeneratorRule Instance Generation Rule - * @param bFromBack TRUE - Apply Rules from Back of EOM - * @param iLag The Lag - * @param iDayOfWeek Day of Week - * @param iWeekInMonth Week in the Month - * @param iSpecificDayInMonth Specific Daye In Month - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public DateInMonth ( - final int iInstanceGeneratorRule, - final boolean bFromBack, - final int iLag, - final int iDayOfWeek, - final int iWeekInMonth, - final int iSpecificDayInMonth) - throws java.lang.Exception - { - _bFromBack = bFromBack; - - if (INSTANCE_GENERATOR_RULE_EDGE_LAG == (_iInstanceGeneratorRule = iInstanceGeneratorRule)) { - if (0 > (_iLag = iLag)) throw new java.lang.Exception ("DateInMonth ctr: Invalid Inputs"); - } else if (INSTANCE_GENERATOR_RULE_WEEK_DAY == _iInstanceGeneratorRule) { - _iDayOfWeek = iDayOfWeek; - _iWeekInMonth = iWeekInMonth; - } else - _iSpecificDayInMonth = iSpecificDayInMonth; - } - - /** - * Retrieve the Instance Generation Rule - * - * @return The Instance Generation Rule - */ - - public int instanceGenerator() - { - return _iInstanceGeneratorRule; - } - - /** - * Retrieve the Flag indicating whether the Lag is from the Front/Back - * - * @return TRUE - The Lag is from the Back. - */ - - public boolean fromBack() - { - return _bFromBack; - } - - /** - * Retrieve the Date Lag - * - * @return The Date Lag - */ - - public int lag() - { - return _iLag; - } - - /** - * Retrieve the Week In Month - * - * @return The Week In Month - */ - - public int weekInMonth() - { - return _iWeekInMonth; - } - - /** - * Retrieve the Day Of Week - * - * @return The Day Of Week - */ - - public int dayOfWeek() - { - return _iDayOfWeek; - } - - /** - * Retrieve the Specific Day in Month - * - * @return The Specific Day in Month - */ - - public int specificDayInMonth() - { - return _iSpecificDayInMonth; - } - - /** - * Generate the Particular Day of the Year, the Month, according to the Calendar - * - * @param iYear Target Year - * @param iMonth Target Month - * @param strCalendar Target Calendar - * - * @return The Particular Day - */ - - public org.drip.analytics.date.JulianDate instanceDay ( - final int iYear, - final int iMonth, - final java.lang.String strCalendar) - { - try { - if (INSTANCE_GENERATOR_RULE_EDGE_LAG == _iInstanceGeneratorRule) { - if (_bFromBack) { - org.drip.analytics.date.JulianDate dtBase = - org.drip.analytics.date.DateUtil.CreateFromYMD (iYear, iMonth, - org.drip.analytics.date.DateUtil.DaysInMonth (iMonth, iYear)); - - return null == dtBase ? null : dtBase.subtractBusDays (_iLag, strCalendar); - } - - org.drip.analytics.date.JulianDate dtBase = org.drip.analytics.date.DateUtil.CreateFromYMD - (iYear, iMonth, 1); - - return null == dtBase ? null : dtBase.addBusDays (_iLag, strCalendar); - } - - if (INSTANCE_GENERATOR_RULE_WEEK_DAY == _iInstanceGeneratorRule) { - if (_bFromBack) { - org.drip.analytics.date.JulianDate dtEOM = org.drip.analytics.date.DateUtil.CreateFromYMD - (iYear, iMonth, org.drip.analytics.date.DateUtil.DaysInMonth (iMonth, iYear)); - - if (null == dtEOM) return null; - - while (_iDayOfWeek != org.drip.analytics.date.DateUtil.Day - (org.drip.analytics.date.DateUtil.JavaDateFromJulianDate (dtEOM))) - dtEOM = dtEOM.subtractDays (1); - - org.drip.analytics.date.JulianDate dtUnadjusted = dtEOM.subtractDays (_iWeekInMonth * 7); - - return null == dtUnadjusted ? null : dtUnadjusted.subtractBusDays (0, strCalendar); - } - - org.drip.analytics.date.JulianDate dtSOM = org.drip.analytics.date.DateUtil.CreateFromYMD - (iYear, iMonth, 1); - - if (null == dtSOM) return null; - - while (_iDayOfWeek != org.drip.analytics.date.DateUtil.Day - (org.drip.analytics.date.DateUtil.JavaDateFromJulianDate (dtSOM))) - dtSOM = dtSOM.addDays (1); - - org.drip.analytics.date.JulianDate dtUnadjusted = dtSOM.addDays (_iWeekInMonth * 7); - - return null == dtUnadjusted ? null : dtUnadjusted.addBusDays (0, strCalendar); - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.analytics.date.JulianDate dtBase = org.drip.analytics.date.DateUtil.CreateFromYMD (iYear, - iMonth, _iSpecificDayInMonth); - - if (null == dtBase) return null; - - return _bFromBack ? dtBase.subtractBusDays (0, strCalendar) : dtBase.addBusDays (0, strCalendar); - } - - @Override public java.lang.String toString() - { - return "[DateInMonth => Instance Generator Rule: " + _iInstanceGeneratorRule + " | From Back Flag: " - + _bFromBack + " | Day Of Week: " + _iDayOfWeek + " | Week In Month: " + _iWeekInMonth + - " | Specific Day In Month: " + _iSpecificDayInMonth + " | Lag: " + _iLag + "]"; - } -} diff --git a/org/drip/analytics/eventday/Fixed.java b/org/drip/analytics/eventday/Fixed.java deleted file mode 100644 index 1db6a40..0000000 --- a/org/drip/analytics/eventday/Fixed.java +++ /dev/null @@ -1,103 +0,0 @@ - -package org.drip.analytics.eventday; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * Fixed contains the fixed holiday’s date and month. Holidays are generated on a per-year basis by applying - * the year, and by adjusting the date generated. - * - * @author Lakshmi Krishnamurthy - */ - -public class Fixed extends Base { - private int _iDay = 0; - private int _iMonth = 0; - private Weekend _wkend = null; - - /** - * Construct the object from the day, month, weekend, and description - * - * @param iDay Day - * @param iMonth Month - * @param wkend Weekend Object - * @param strDescription Description - */ - - public Fixed ( - final int iDay, - final int iMonth, - final Weekend wkend, - final java.lang.String strDescription) - { - super (strDescription); - - _iDay = iDay; - _wkend = wkend; - _iMonth = iMonth; - } - - @Override public int dateInYear ( - final int iYear, - final boolean bAdjust) - { - int iDate = org.drip.analytics.date.DateUtil.CreateFromYMD (iYear, _iMonth, _iDay).julian(); - - try { - if (bAdjust) return Base.rollHoliday (iDate, true, _wkend); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return iDate; - } -} diff --git a/org/drip/analytics/eventday/Locale.java b/org/drip/analytics/eventday/Locale.java deleted file mode 100644 index 4e73a53..0000000 --- a/org/drip/analytics/eventday/Locale.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.analytics.eventday; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * Locale contains the set of regular holidays and the weekend holidays for a location. It also provides the - * functionality to add custom holidays and weekends. - * - * @author Lakshmi Krishnamurthy - */ - -public class Locale { - private Weekend _wkend = null; - - private java.util.Set _setHolidays = new java.util.HashSet(); - - /** - * Construct an empty LocHolidays instance - */ - - public Locale() - { - } - - /** - * Add the array of weekend days - * - * @param aiDays Array of weekend days - * - * @return Succeeded (true), failure (false) - */ - - public boolean addWeekend ( - final int[] aiDays) - { - try { - return null != (_wkend = new Weekend (aiDays)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - /** - * Add the regular SATURDAY/SUNDAY weekend - * - * @return Succeeded (true), failure (false) - */ - - public boolean addStandardWeekend() - { - _wkend = Weekend.StandardWeekend(); - - return true; - } - - /** - * Add the given date as a static holiday - * - * @param dt Date - * @param strDescription Description - * - * @return Succeeded (true), failure (false) - */ - - public boolean addStaticHoliday ( - final org.drip.analytics.date.JulianDate dt, - final java.lang.String strDescription) - { - if (null == dt) return false; - - try { - _setHolidays.add (new Static (dt, strDescription)); - - return true; - } catch (java.lang.Exception e) { - System.out.println (e.getMessage()); - } - - return false; - } - - /** - * Add the given string date as a static holiday - * - * @param strDate Date string - * @param strDescription Description - * - * @return Succeeded (true), failure (false) - */ - - public boolean addStaticHoliday ( - final java.lang.String strDate, - final java.lang.String strDescription) - { - if (null == strDate || strDate.isEmpty()) return false; - - org.drip.analytics.date.JulianDate dtStaticHoliday = - org.drip.analytics.date.DateUtil.CreateFromDDMMMYYYY (strDate); - - if (null == dtStaticHoliday) return false; - - return addStaticHoliday (dtStaticHoliday, strDescription); - } - - /** - * Add a fixed holiday from the day and month - * - * @param iDay Day - * @param iMonth Month - * @param strDescription Description - * - * @return Succeeded (true), failure (false) - */ - - public boolean addFixedHoliday ( - final int iDay, - final int iMonth, - final java.lang.String strDescription) - { - _setHolidays.add (new Fixed (iDay, iMonth, _wkend, strDescription)); - - return true; - } - - /** - * Add a floating holiday from the week in month, the day in week, the month, and whether holidays are - * calculated from front/back. - * - * @param iWeekInMonth Week in the Month - * @param iWeekDay Day in the week - * @param iMonth Month - * @param bFromFront Holidays are calculated from the start of the month (True) - * @param strDescription Description - * - * @return Succeeded (true), failure (false) - */ - - public boolean addFloatingHoliday ( - final int iWeekInMonth, - final int iWeekDay, - final int iMonth, - final boolean bFromFront, - final java.lang.String strDescription) - { - _setHolidays.add (new Variable (iWeekInMonth, iWeekDay, iMonth, bFromFront, _wkend, - strDescription)); - - return true; - } - - /** - * Return the weekend - * - * @return Weekend - */ - - public Weekend weekendDays() - { - return _wkend; - } - - /** - * Return the set of week day holidays - * - * @return Set of hoidays - */ - - public java.util.Set holidays() - { - return _setHolidays; - } -} diff --git a/org/drip/analytics/eventday/Static.java b/org/drip/analytics/eventday/Static.java deleted file mode 100644 index 2e8cb4d..0000000 --- a/org/drip/analytics/eventday/Static.java +++ /dev/null @@ -1,118 +0,0 @@ - -package org.drip.analytics.eventday; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * Static implements a complete date as a specific holiday. - * - * @author Lakshmi Krishnamurthy - */ - -public class Static extends Base { - private int _iDate = java.lang.Integer.MIN_VALUE; - - /** - * Create a static holiday from the date string and the description - * - * @param strDate Date string - * @param strDescription Description - * - * @return StaticHoliday instance - */ - - public static final Static CreateFromDateDescription ( - final java.lang.String strDate, - final java.lang.String strDescription) - { - org.drip.analytics.date.JulianDate dtHol = org.drip.analytics.date.DateUtil.CreateFromDDMMMYYYY - (strDate); - - if (null == dtHol) return null; - - try { - return new Static (dtHol, strDescription); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a static holiday from the date and the description - * - * @param dt Date - * @param strDescription Description - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public Static ( - final org.drip.analytics.date.JulianDate dt, - final java.lang.String strDescription) - throws java.lang.Exception - { - super (strDescription); - - if (null == dt) throw new java.lang.Exception ("Static ctr: Null date into Static Holiday"); - - _iDate = dt.julian(); - } - - @Override public int dateInYear ( - final int iYear, - final boolean bAdjusted) - { - return _iDate; - } -} diff --git a/org/drip/analytics/eventday/Variable.java b/org/drip/analytics/eventday/Variable.java deleted file mode 100644 index d7c50bc..0000000 --- a/org/drip/analytics/eventday/Variable.java +++ /dev/null @@ -1,122 +0,0 @@ - -package org.drip.analytics.eventday; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * Variable class contains the rule characterizing the variable holiday’s month, day in week, week in month, - * and the weekend days. Specific holidays in the given year are generated using these rules. - * - * @author Lakshmi Krishnamurthy - */ - -public class Variable extends Base { - private int _iMonth = 0; - private int _iWeekDay = 0; - private int _iWeekInMonth = 0; - private boolean _bFromFront = true; - private org.drip.analytics.eventday.Weekend _wkend = null; - - /** - * Construct the object from the week, day, month, from front/back, week end, and description - * - * @param iWeekInMonth Week of the Month - * @param iWeekDay Day of the Week - * @param iMonth Month - * @param bFromFront From Front (true), Back (false) - * @param wkend Weekend - * @param strDescription Description - */ - - public Variable ( - final int iWeekInMonth, - final int iWeekDay, - final int iMonth, - final boolean bFromFront, - final Weekend wkend, - final java.lang.String strDescription) - { - super (strDescription); - - _wkend = wkend; - _iMonth = iMonth; - _iWeekDay = iWeekDay; - _bFromFront = bFromFront; - _iWeekInMonth = iWeekInMonth; - } - - @Override public int dateInYear ( - final int iYear, - final boolean bAdjustForWeekend) - { - int iDate = java.lang.Integer.MIN_VALUE; - - try { - if (_bFromFront) - iDate = (org.drip.analytics.date.DateUtil.CreateFromYMD (iYear, _iMonth, - _iWeekDay)).julian() + (7 * (_iWeekInMonth - 1)); - else { - iDate = (org.drip.analytics.date.DateUtil.CreateFromYMD (iYear, _iMonth, - org.drip.analytics.date.DateUtil.DaysInMonth (_iMonth, iYear))).julian() - (7 * - (_iWeekInMonth - 1)); - - while (_iWeekDay != (iDate % 7)) --iDate; - } - - if (bAdjustForWeekend) return Base.rollHoliday (iDate, true, _wkend); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return iDate; - } -} diff --git a/org/drip/analytics/eventday/Weekend.java b/org/drip/analytics/eventday/Weekend.java deleted file mode 100644 index a4c7b67..0000000 --- a/org/drip/analytics/eventday/Weekend.java +++ /dev/null @@ -1,167 +0,0 @@ - -package org.drip.analytics.eventday; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * Weekend holds the left and the right weekend days. It provides functionality to retrieve them, check if - * the given day is a weekend, and serialize/de-serialize weekend days. - * - * @author Lakshmi Krishnamurthy - */ - -public class Weekend { - private int[] _aiDay = null; - - /** - * Create a Weekend Instance with SATURDAY and SUNDAY - * - * @return Weekend object - */ - - public static final Weekend StandardWeekend() - { - try { - return new Weekend (new int[] {org.drip.analytics.date.DateUtil.SUNDAY, - org.drip.analytics.date.DateUtil.SATURDAY}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create the weekend instance object from the array of the weekend days - * - * @param aiDay Array of the weekend days - * - * @throws java.lang.Exception Thrown if cannot properly de-serialize Weekend - */ - - public Weekend ( - final int[] aiDay) - throws java.lang.Exception - { - if (null == aiDay) throw new java.lang.Exception ("Weekend ctr: Invalid Inputs"); - - int iNumWeekendDays = aiDay.length;; - - if (0 == iNumWeekendDays) throw new java.lang.Exception ("Weekend ctr: Invalid Inputs"); - - _aiDay = new int[iNumWeekendDays]; - - for (int i = 0; i < iNumWeekendDays; ++i) - _aiDay[i] = aiDay[i]; - } - - /** - * Retrieve the weekend days - * - * @return Array of the weekend days - */ - - public int[] days() - { - return _aiDay; - } - - /** - * Is the given date a left weekend day - * - * @param iDate Date - * - * @return True (Left weekend day) - */ - - public boolean isLeftWeekend ( - final int iDate) - { - if (null == _aiDay || 0 == _aiDay.length) return false; - - if (_aiDay[0] == (iDate % 7)) return true; - - return false; - } - - /** - * Is the given date a right weekend day - * - * @param dblDate Date - * - * @return True (Right weekend day) - */ - - public boolean isRightWeekend ( - final double dblDate) - { - if (null == _aiDay || 1 >= _aiDay.length) return false; - - if (_aiDay[1] == (dblDate % 7)) return true; - - return false; - } - - /** - * Is the given date a weekend day - * - * @param iDate Date - * - * @return True (Weekend day) - */ - - public boolean isWeekend ( - final int iDate) - { - return isLeftWeekend (iDate) || isRightWeekend (iDate); - } -} diff --git a/org/drip/analytics/holset/AEDHoliday.java b/org/drip/analytics/holset/AEDHoliday.java deleted file mode 100644 index 820310a..0000000 --- a/org/drip/analytics/holset/AEDHoliday.java +++ /dev/null @@ -1,1403 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class AEDHoliday implements org.drip.analytics.holset.LocationHoliday { - public AEDHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "AED"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-1998", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("29-JAN-1998", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("31-JAN-1998", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-FEB-1998", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("04-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-APR-1998", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("26-APR-1998", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("27-APR-1998", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("04-JUL-1998", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("05-JUL-1998", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("06-JUL-1998", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("06-AUG-1998", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("14-NOV-1998", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("15-NOV-1998", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("16-NOV-1998", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("02-DEC-1998", "National Day"); - - lh.addStaticHoliday ("03-DEC-1998", "National Day"); - - lh.addStaticHoliday ("02-JAN-1999", "New Years Day Observed"); - - lh.addStaticHoliday ("17-JAN-1999", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("18-JAN-1999", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("19-JAN-1999", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("20-JAN-1999", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("21-JAN-1999", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("25-MAR-1999", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("27-MAR-1999", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-MAR-1999", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-MAR-1999", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("30-MAR-1999", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("15-APR-1999", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("17-APR-1999", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("24-JUN-1999", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("26-JUN-1999", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("07-AUG-1999", "Accession of HH Sheikh Zayed Observed"); - - lh.addStaticHoliday ("03-NOV-1999", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("04-NOV-1999", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("02-DEC-1999", "National Day"); - - lh.addStaticHoliday ("04-DEC-1999", "National Day Observed"); - - lh.addStaticHoliday ("01-JAN-2000", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("08-JAN-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("09-JAN-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("10-JAN-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("13-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("14-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("15-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-APR-2000", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("05-APR-2000", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("06-APR-2000", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("13-JUN-2000", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("14-JUN-2000", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("15-JUN-2000", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2000", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("23-OCT-2000", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("24-OCT-2000", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("25-OCT-2000", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2000", "National Day"); - - lh.addStaticHoliday ("03-DEC-2000", "National Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-DEC-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("27-DEC-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("28-DEC-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-MAR-2001", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("25-MAR-2001", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("26-MAR-2001", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("02-JUN-2001", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("03-JUN-2001", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("04-JUN-2001", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2001", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("13-OCT-2001", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("14-OCT-2001", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2001", "National Day"); - - lh.addStaticHoliday ("03-DEC-2001", "National Day"); - - lh.addStaticHoliday ("15-DEC-2001", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2001", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("17-DEC-2001", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("18-DEC-2001", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("20-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("21-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("14-MAR-2002", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("16-MAR-2002", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("23-MAY-2002", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("25-MAY-2002", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2002", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("02-OCT-2002", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("03-OCT-2002", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2002", "National Day"); - - lh.addStaticHoliday ("03-DEC-2002", "National Day"); - - lh.addStaticHoliday ("04-DEC-2002", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("05-DEC-2002", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("07-DEC-2002", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("08-DEC-2002", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("09-FEB-2003", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-FEB-2003", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-FEB-2003", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("12-FEB-2003", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-FEB-2003", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-MAR-2003", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("04-MAR-2003", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("05-MAR-2003", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("12-MAY-2003", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("13-MAY-2003", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("14-MAY-2003", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2003", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("21-SEP-2003", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("22-SEP-2003", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("23-SEP-2003", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("23-NOV-2003", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("24-NOV-2003", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("25-NOV-2003", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-NOV-2003", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("27-NOV-2003", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2003", "National Day"); - - lh.addStaticHoliday ("03-DEC-2003", "National Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("29-JAN-2004", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("31-JAN-2004", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-FEB-2004", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-FEB-2004", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-FEB-2004", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-FEB-2004", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("21-FEB-2004", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("01-MAY-2004", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("02-MAY-2004", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("07-AUG-2004", "Accession of HH Sheikh Zayed Observed"); - - lh.addStaticHoliday ("11-SEP-2004", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("12-SEP-2004", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("13-NOV-2004", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("14-NOV-2004", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("15-NOV-2004", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("16-NOV-2004", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2004", "National Day"); - - lh.addStaticHoliday ("04-DEC-2004", "National Day Observed"); - - lh.addStaticHoliday ("01-JAN-2005", "New Years Day"); - - lh.addStaticHoliday ("18-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("22-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-FEB-2005", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("09-FEB-2005", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("10-FEB-2005", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("19-APR-2005", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("20-APR-2005", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("21-APR-2005", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2005", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("30-AUG-2005", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("31-AUG-2005", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("01-SEP-2005", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("01-NOV-2005", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-NOV-2005", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("03-NOV-2005", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("05-NOV-2005", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("03-DEC-2005", "National Day"); - - lh.addStaticHoliday ("04-DEC-2005", "National Day Observed"); - - lh.addStaticHoliday ("01-JAN-2006", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("12-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-JAN-2006", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("30-JAN-2006", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("31-JAN-2006", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("09-APR-2006", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("10-APR-2006", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("11-APR-2006", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2006", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("19-AUG-2006", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("20-AUG-2006", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("21-AUG-2006", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("22-OCT-2006", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("23-OCT-2006", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("24-OCT-2006", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("25-OCT-2006", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-OCT-2006", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2006", "National Day"); - - lh.addStaticHoliday ("03-DEC-2006", "National Day"); - - lh.addStaticHoliday ("28-DEC-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("30-DEC-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("31-DEC-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-JAN-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-JAN-2007", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("20-JAN-2007", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("29-MAR-2007", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("31-MAR-2007", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2007", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("08-AUG-2007", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("09-AUG-2007", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("11-OCT-2007", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("13-OCT-2007", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("14-OCT-2007", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("15-OCT-2007", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2007", "National Day"); - - lh.addStaticHoliday ("03-DEC-2007", "National Day"); - - lh.addStaticHoliday ("17-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("22-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2008", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("09-JAN-2008", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("10-JAN-2008", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("18-MAR-2008", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("19-MAR-2008", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("20-MAR-2008", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("28-JUL-2008", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("29-JUL-2008", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("30-JUL-2008", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2008", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("29-SEP-2008", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("30-SEP-2008", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-OCT-2008", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-OCT-2008", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2008", "National Day"); - - lh.addStaticHoliday ("03-DEC-2008", "National Day"); - - lh.addStaticHoliday ("06-DEC-2008", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-DEC-2008", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-DEC-2008", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-DEC-2008", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-DEC-2008", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("27-DEC-2008", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("28-DEC-2008", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("29-DEC-2008", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("07-MAR-2009", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("08-MAR-2009", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("09-MAR-2009", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("18-JUL-2009", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("19-JUL-2009", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("20-JUL-2009", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2009", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("19-SEP-2009", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("20-SEP-2009", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("21-SEP-2009", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("22-SEP-2009", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("24-NOV-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-NOV-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("26-NOV-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-NOV-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-NOV-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2009", "National Day"); - - lh.addStaticHoliday ("03-DEC-2009", "National Day"); - - lh.addStaticHoliday ("16-DEC-2009", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("17-DEC-2009", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("02-JAN-2010", "New Years Day Observed"); - - lh.addStaticHoliday ("24-FEB-2010", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("25-FEB-2010", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("07-JUL-2010", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("08-JUL-2010", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("07-AUG-2010", "Accession of HH Sheikh Zayed Observed"); - - lh.addStaticHoliday ("08-SEP-2010", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("09-SEP-2010", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("11-SEP-2010", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("12-SEP-2010", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("14-NOV-2010", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("15-NOV-2010", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-NOV-2010", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-NOV-2010", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-NOV-2010", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2010", "National Day"); - - lh.addStaticHoliday ("04-DEC-2010", "National Day Observed"); - - lh.addStaticHoliday ("05-DEC-2010", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("06-DEC-2010", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("07-DEC-2010", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2011", "New Years Day"); - - lh.addStaticHoliday ("13-FEB-2011", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("14-FEB-2011", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("15-FEB-2011", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("26-JUN-2011", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("27-JUN-2011", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("28-JUN-2011", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2011", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("28-AUG-2011", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("29-AUG-2011", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("30-AUG-2011", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("31-AUG-2011", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-SEP-2011", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("03-NOV-2011", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-NOV-2011", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-NOV-2011", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-NOV-2011", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-NOV-2011", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-NOV-2011", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("26-NOV-2011", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("03-DEC-2011", "National Day"); - - lh.addStaticHoliday ("04-DEC-2011", "National Day Observed"); - - lh.addStaticHoliday ("01-JAN-2012", "New Years Day"); - - lh.addStaticHoliday ("04-FEB-2012", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("05-FEB-2012", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("16-JUN-2012", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("17-JUN-2012", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2012", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("18-AUG-2012", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("19-AUG-2012", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("20-AUG-2012", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("21-AUG-2012", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("23-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("27-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-NOV-2012", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("14-NOV-2012", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("15-NOV-2012", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2012", "National Day"); - - lh.addStaticHoliday ("03-DEC-2012", "National Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("22-JAN-2013", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("23-JAN-2013", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("24-JAN-2013", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("04-JUN-2013", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("05-JUN-2013", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("06-JUN-2013", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2013", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("07-AUG-2013", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("08-AUG-2013", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("10-AUG-2013", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("12-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("14-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("15-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-NOV-2013", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("04-NOV-2013", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("05-NOV-2013", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2013", "National Day"); - - lh.addStaticHoliday ("03-DEC-2013", "National Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2014", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("13-JAN-2014", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("14-JAN-2014", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("24-MAY-2014", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("25-MAY-2014", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("26-MAY-2014", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("27-JUL-2014", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("28-JUL-2014", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("29-JUL-2014", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("30-JUL-2014", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("31-JUL-2014", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2014", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("02-OCT-2014", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-OCT-2014", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-OCT-2014", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-OCT-2014", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-OCT-2014", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-OCT-2014", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("25-OCT-2014", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2014", "National Day"); - - lh.addStaticHoliday ("03-DEC-2014", "National Day"); - - lh.addStaticHoliday ("01-JAN-2015", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("03-JAN-2015", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("14-MAY-2015", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("16-MAY-2015", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("16-JUL-2015", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("18-JUL-2015", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("19-JUL-2015", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("20-JUL-2015", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2015", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("21-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("22-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("26-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-OCT-2015", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("14-OCT-2015", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("15-OCT-2015", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2015", "National Day"); - - lh.addStaticHoliday ("03-DEC-2015", "National Day"); - - lh.addStaticHoliday ("22-DEC-2015", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("23-DEC-2015", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("24-DEC-2015", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("02-JAN-2016", "New Years Day Observed"); - - lh.addStaticHoliday ("02-MAY-2016", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("03-MAY-2016", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("04-MAY-2016", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("04-JUL-2016", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("05-JUL-2016", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("06-JUL-2016", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("07-JUL-2016", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2016", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("10-SEP-2016", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-SEP-2016", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("12-SEP-2016", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-SEP-2016", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("14-SEP-2016", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-OCT-2016", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("02-OCT-2016", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("03-OCT-2016", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("03-DEC-2016", "National Day"); - - lh.addStaticHoliday ("04-DEC-2016", "National Day Observed"); - - lh.addStaticHoliday ("10-DEC-2016", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("11-DEC-2016", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("12-DEC-2016", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2017", "New Years Day"); - - lh.addStaticHoliday ("22-APR-2017", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("23-APR-2017", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("24-APR-2017", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("24-JUN-2017", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("25-JUN-2017", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-JUN-2017", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("27-JUN-2017", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2017", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("29-AUG-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("30-AUG-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("31-AUG-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-SEP-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-SEP-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-SEP-2017", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("21-SEP-2017", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("29-NOV-2017", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("30-NOV-2017", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2017", "National Day"); - - lh.addStaticHoliday ("03-DEC-2017", "National Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("11-APR-2018", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("12-APR-2018", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("13-JUN-2018", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("14-JUN-2018", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("16-JUN-2018", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("17-JUN-2018", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2018", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("19-AUG-2018", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-AUG-2018", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("21-AUG-2018", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("22-AUG-2018", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-AUG-2018", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-SEP-2018", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("10-SEP-2018", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("11-SEP-2018", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("18-NOV-2018", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("19-NOV-2018", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("20-NOV-2018", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2018", "National Day"); - - lh.addStaticHoliday ("03-DEC-2018", "National Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("31-MAR-2019", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("01-APR-2019", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("02-APR-2019", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("03-JUN-2019", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("04-JUN-2019", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("05-JUN-2019", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("06-JUN-2019", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2019", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("08-AUG-2019", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-AUG-2019", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-AUG-2019", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("12-AUG-2019", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-AUG-2019", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-AUG-2019", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("31-AUG-2019", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("07-NOV-2019", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("09-NOV-2019", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2019", "National Day"); - - lh.addStaticHoliday ("03-DEC-2019", "National Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("19-MAR-2020", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("21-MAR-2020", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("23-MAY-2020", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("24-MAY-2020", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("25-MAY-2020", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-MAY-2020", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("28-JUL-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-JUL-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("30-JUL-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-AUG-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-AUG-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2020", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("18-AUG-2020", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("19-AUG-2020", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("20-AUG-2020", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("27-OCT-2020", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("28-OCT-2020", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("29-OCT-2020", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2020", "National Day"); - - lh.addStaticHoliday ("03-DEC-2020", "National Day"); - - lh.addStaticHoliday ("02-JAN-2021", "New Years Day Observed"); - - lh.addStaticHoliday ("09-MAR-2021", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("10-MAR-2021", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("11-MAR-2021", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("11-MAY-2021", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("12-MAY-2021", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("13-MAY-2021", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("15-MAY-2021", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("17-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("21-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("22-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-AUG-2021", "Accession of HH Sheikh Zayed Observed"); - - lh.addStaticHoliday ("08-AUG-2021", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("09-AUG-2021", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("10-AUG-2021", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("16-OCT-2021", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("17-OCT-2021", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("18-OCT-2021", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2021", "National Day"); - - lh.addStaticHoliday ("04-DEC-2021", "National Day Observed"); - - lh.addStaticHoliday ("01-JAN-2022", "New Years Day"); - - lh.addStaticHoliday ("26-FEB-2022", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("27-FEB-2022", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("28-FEB-2022", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("30-APR-2022", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-MAY-2022", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-MAY-2022", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("03-MAY-2022", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("04-MAY-2022", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("06-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-JUL-2022", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("30-JUL-2022", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2022", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("06-OCT-2022", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("08-OCT-2022", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("03-DEC-2022", "National Day"); - - lh.addStaticHoliday ("04-DEC-2022", "National Day Observed"); - - lh.addStaticHoliday ("01-JAN-2023", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2023", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("18-FEB-2023", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("20-APR-2023", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("22-APR-2023", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("23-APR-2023", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("24-APR-2023", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-JUN-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("27-JUN-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-JUN-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-JUN-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-JUL-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-JUL-2023", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("18-JUL-2023", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("19-JUL-2023", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2023", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("25-SEP-2023", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("26-SEP-2023", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("27-SEP-2023", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2023", "National Day"); - - lh.addStaticHoliday ("03-DEC-2023", "National Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2024", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("06-FEB-2024", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("07-FEB-2024", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("08-APR-2024", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("09-APR-2024", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("10-APR-2024", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("11-APR-2024", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("15-JUN-2024", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-JUN-2024", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-JUN-2024", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-JUN-2024", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-JUN-2024", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-JUL-2024", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("07-JUL-2024", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2024", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("14-SEP-2024", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("15-SEP-2024", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2024", "National Day"); - - lh.addStaticHoliday ("03-DEC-2024", "National Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("25-JAN-2025", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("26-JAN-2025", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("27-JAN-2025", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("29-MAR-2025", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("30-MAR-2025", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("31-MAR-2025", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-APR-2025", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-APR-2025", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("03-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-JUN-2025", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("25-JUN-2025", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("26-JUN-2025", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2025", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("02-SEP-2025", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("03-SEP-2025", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("04-SEP-2025", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2025", "National Day"); - - lh.addStaticHoliday ("03-DEC-2025", "National Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("14-JAN-2026", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("15-JAN-2026", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("18-MAR-2026", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("19-MAR-2026", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("21-MAR-2026", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("22-MAR-2026", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("24-MAY-2026", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-MAY-2026", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("26-MAY-2026", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("27-MAY-2026", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-MAY-2026", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("14-JUN-2026", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("15-JUN-2026", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("16-JUN-2026", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2026", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("23-AUG-2026", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("24-AUG-2026", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("25-AUG-2026", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2026", "National Day"); - - lh.addStaticHoliday ("03-DEC-2026", "National Day"); - - lh.addStaticHoliday ("02-JAN-2027", "New Years Day Observed"); - - lh.addStaticHoliday ("03-JAN-2027", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("04-JAN-2027", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("05-JAN-2027", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("08-MAR-2027", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("09-MAR-2027", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("10-MAR-2027", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("11-MAR-2027", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("15-MAY-2027", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-MAY-2027", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-MAY-2027", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-MAY-2027", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-MAY-2027", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-JUN-2027", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("06-JUN-2027", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("07-AUG-2027", "Accession of HH Sheikh Zayed Observed"); - - lh.addStaticHoliday ("14-AUG-2027", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("15-AUG-2027", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2027", "National Day"); - - lh.addStaticHoliday ("04-DEC-2027", "National Day Observed"); - - lh.addStaticHoliday ("23-DEC-2027", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("25-DEC-2027", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2028", "New Years Day"); - - lh.addStaticHoliday ("26-FEB-2028", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("27-FEB-2028", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("28-FEB-2028", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("29-FEB-2028", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-MAY-2028", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-MAY-2028", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-MAY-2028", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-MAY-2028", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-MAY-2028", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-MAY-2028", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("24-MAY-2028", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("25-MAY-2028", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("01-AUG-2028", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("02-AUG-2028", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("03-AUG-2028", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2028", "Accession of HH Sheikh Zayed"); - - lh.addStaticHoliday ("02-DEC-2028", "National Day"); - - lh.addStaticHoliday ("03-DEC-2028", "National Day"); - - lh.addStaticHoliday ("11-DEC-2028", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("12-DEC-2028", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("13-DEC-2028", "Ascension of Muhammad Holiday Period"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/ANGHoliday.java b/org/drip/analytics/holset/ANGHoliday.java deleted file mode 100644 index 1ba9637..0000000 --- a/org/drip/analytics/holset/ANGHoliday.java +++ /dev/null @@ -1,611 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class ANGHoliday implements org.drip.analytics.holset.LocationHoliday { - public ANGHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "ANG"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("23-FEB-1998", "Carnival Monday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-1998", "Coronation Day"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-1998", "Ascension Day"); - - lh.addStaticHoliday ("02-JUL-1998", "Curacao Flag Day"); - - lh.addStaticHoliday ("21-OCT-1998", "Antilles Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("15-FEB-1999", "Carnival Monday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-1999", "Coronation Day"); - - lh.addStaticHoliday ("13-MAY-1999", "Ascension Day"); - - lh.addStaticHoliday ("02-JUL-1999", "Curacao Flag Day"); - - lh.addStaticHoliday ("21-OCT-1999", "Antilles Day"); - - lh.addStaticHoliday ("06-MAR-2000", "Carnival Monday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("01-JUN-2000", "Ascension Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("26-FEB-2001", "Carnival Monday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2001", "Coronation Day"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2001", "Ascension Day"); - - lh.addStaticHoliday ("02-JUL-2001", "Curacao Flag Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2002", "Carnival Monday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2002", "Coronation Day"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2002", "Ascension Day"); - - lh.addStaticHoliday ("02-JUL-2002", "Curacao Flag Day"); - - lh.addStaticHoliday ("21-OCT-2002", "Antilles Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2003", "Carnival Monday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2003", "Coronation Day"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2003", "Ascension Day"); - - lh.addStaticHoliday ("02-JUL-2003", "Curacao Flag Day"); - - lh.addStaticHoliday ("21-OCT-2003", "Antilles Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("23-FEB-2004", "Carnival Monday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2004", "Coronation Day"); - - lh.addStaticHoliday ("20-MAY-2004", "Ascension Day"); - - lh.addStaticHoliday ("02-JUL-2004", "Curacao Flag Day"); - - lh.addStaticHoliday ("21-OCT-2004", "Antilles Day"); - - lh.addStaticHoliday ("07-FEB-2005", "Carnival Monday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2005", "Ascension Day"); - - lh.addStaticHoliday ("21-OCT-2005", "Antilles Day"); - - lh.addStaticHoliday ("26-DEC-2005", "Boxing Day"); - - lh.addStaticHoliday ("27-FEB-2006", "Carnival Monday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2006", "Ascension Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("19-FEB-2007", "Carnival Monday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2007", "Coronation Day"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2007", "Ascension Day"); - - lh.addStaticHoliday ("02-JUL-2007", "Curacao Flag Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("04-FEB-2008", "Carnival Monday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2008", "Coronation Day"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("02-JUL-2008", "Curacao Flag Day"); - - lh.addStaticHoliday ("21-OCT-2008", "Antilles Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("23-FEB-2009", "Carnival Monday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2009", "Coronation Day"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2009", "Ascension Day"); - - lh.addStaticHoliday ("02-JUL-2009", "Curacao Flag Day"); - - lh.addStaticHoliday ("21-OCT-2009", "Antilles Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("15-FEB-2010", "Carnival Monday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2010", "Coronation Day"); - - lh.addStaticHoliday ("13-MAY-2010", "Ascension Day"); - - lh.addStaticHoliday ("02-JUL-2010", "Curacao Flag Day"); - - lh.addStaticHoliday ("21-OCT-2010", "Antilles Day"); - - lh.addStaticHoliday ("07-MAR-2011", "Carnival Monday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("02-JUN-2011", "Ascension Day"); - - lh.addStaticHoliday ("21-OCT-2011", "Antilles Day"); - - lh.addStaticHoliday ("26-DEC-2011", "Boxing Day"); - - lh.addStaticHoliday ("20-FEB-2012", "Carnival Monday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2012", "Coronation Day"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2012", "Ascension Day"); - - lh.addStaticHoliday ("02-JUL-2012", "Curacao Flag Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2013", "Carnival Monday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2013", "Coronation Day"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2013", "Ascension Day"); - - lh.addStaticHoliday ("02-JUL-2013", "Curacao Flag Day"); - - lh.addStaticHoliday ("21-OCT-2013", "Antilles Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2014", "Carnival Monday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2014", "Coronation Day"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2014", "Ascension Day"); - - lh.addStaticHoliday ("02-JUL-2014", "Curacao Flag Day"); - - lh.addStaticHoliday ("21-OCT-2014", "Antilles Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2015", "Carnival Monday"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2015", "Coronation Day"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("14-MAY-2015", "Ascension Day"); - - lh.addStaticHoliday ("02-JUL-2015", "Curacao Flag Day"); - - lh.addStaticHoliday ("21-OCT-2015", "Antilles Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2016", "Carnival Monday"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2016", "Ascension Day"); - - lh.addStaticHoliday ("21-OCT-2016", "Antilles Day"); - - lh.addStaticHoliday ("26-DEC-2016", "Boxing Day"); - - lh.addStaticHoliday ("27-FEB-2017", "Carnival Monday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2017", "Ascension Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("12-FEB-2018", "Carnival Monday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2018", "Coronation Day"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("10-MAY-2018", "Ascension Day"); - - lh.addStaticHoliday ("02-JUL-2018", "Curacao Flag Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("04-MAR-2019", "Carnival Monday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2019", "Coronation Day"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2019", "Ascension Day"); - - lh.addStaticHoliday ("02-JUL-2019", "Curacao Flag Day"); - - lh.addStaticHoliday ("21-OCT-2019", "Antilles Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("24-FEB-2020", "Carnival Monday"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2020", "Coronation Day"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2020", "Ascension Day"); - - lh.addStaticHoliday ("02-JUL-2020", "Curacao Flag Day"); - - lh.addStaticHoliday ("21-OCT-2020", "Antilles Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("15-FEB-2021", "Carnival Monday"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2021", "Coronation Day"); - - lh.addStaticHoliday ("13-MAY-2021", "Ascension Day"); - - lh.addStaticHoliday ("02-JUL-2021", "Curacao Flag Day"); - - lh.addStaticHoliday ("21-OCT-2021", "Antilles Day"); - - lh.addStaticHoliday ("28-FEB-2022", "Carnival Monday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("26-MAY-2022", "Ascension Day"); - - lh.addStaticHoliday ("21-OCT-2022", "Antilles Day"); - - lh.addStaticHoliday ("26-DEC-2022", "Boxing Day"); - - lh.addStaticHoliday ("20-FEB-2023", "Carnival Monday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("18-MAY-2023", "Ascension Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("12-FEB-2024", "Carnival Monday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2024", "Coronation Day"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2024", "Ascension Day"); - - lh.addStaticHoliday ("02-JUL-2024", "Curacao Flag Day"); - - lh.addStaticHoliday ("21-OCT-2024", "Antilles Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2025", "Carnival Monday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2025", "Coronation Day"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2025", "Ascension Day"); - - lh.addStaticHoliday ("02-JUL-2025", "Curacao Flag Day"); - - lh.addStaticHoliday ("21-OCT-2025", "Antilles Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2026", "Carnival Monday"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2026", "Coronation Day"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("14-MAY-2026", "Ascension Day"); - - lh.addStaticHoliday ("02-JUL-2026", "Curacao Flag Day"); - - lh.addStaticHoliday ("21-OCT-2026", "Antilles Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2027", "Carnival Monday"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2027", "Coronation Day"); - - lh.addStaticHoliday ("06-MAY-2027", "Ascension Day"); - - lh.addStaticHoliday ("02-JUL-2027", "Curacao Flag Day"); - - lh.addStaticHoliday ("21-OCT-2027", "Antilles Day"); - - lh.addStaticHoliday ("28-FEB-2028", "Carnival Monday"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2028", "Ascension Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Boxing Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/ARAHoliday.java b/org/drip/analytics/holset/ARAHoliday.java deleted file mode 100644 index ab843e2..0000000 --- a/org/drip/analytics/holset/ARAHoliday.java +++ /dev/null @@ -1,725 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class ARAHoliday implements org.drip.analytics.holset.LocationHoliday { - public ARAHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "ARA"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1997", "New Years Day"); - - lh.addStaticHoliday ("27-MAR-1997", "Holy Thursday"); - - lh.addStaticHoliday ("28-MAR-1997", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1997", "Labour Day"); - - lh.addStaticHoliday ("09-JUN-1997", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("16-JUN-1997", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-1997", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-1997", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("08-DEC-1997", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-1997", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-1997", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("09-APR-1998", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-1998", "Liberation Day"); - - lh.addStaticHoliday ("08-JUN-1998", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("15-JUN-1998", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-1998", "Independence Day"); - - lh.addStaticHoliday ("17-AUG-1998", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("12-OCT-1998", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-1998", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-1998", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-1999", "Liberation Day"); - - lh.addStaticHoliday ("14-JUN-1999", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("21-JUN-1999", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-1999", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-1999", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("11-OCT-1999", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-1999", "Immaculate Conception"); - - lh.addStaticHoliday ("31-DEC-1999", "Last Weekday of the Year"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2000", "Liberation Day"); - - lh.addStaticHoliday ("19-JUN-2000", "Flag Day"); - - lh.addStaticHoliday ("21-AUG-2000", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("16-OCT-2000", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2000", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2000", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2001", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2001", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2001", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2001", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("15-OCT-2001", "Day of the Race Observed"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2001", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("10-JUN-2002", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("17-JUN-2002", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2002", "Independence Day"); - - lh.addStaticHoliday ("19-AUG-2002", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2002", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("09-JUN-2003", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("16-JUN-2003", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2003", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-2003", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2003", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2004", "Liberation Day"); - - lh.addStaticHoliday ("14-JUN-2004", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("21-JUN-2004", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2004", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2004", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("11-OCT-2004", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2004", "Immaculate Conception"); - - lh.addStaticHoliday ("31-DEC-2004", "Last Weekday of the Year"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2005", "Liberation Day"); - - lh.addStaticHoliday ("13-JUN-2005", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("20-JUN-2005", "Flag Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("10-OCT-2005", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2005", "Immaculate Conception"); - - lh.addStaticHoliday ("30-DEC-2005", "Last Weekday of the Year"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2006", "Liberation Day"); - - lh.addStaticHoliday ("19-JUN-2006", "Flag Day"); - - lh.addStaticHoliday ("21-AUG-2006", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("16-OCT-2006", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2006", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2006", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2007", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2007", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2007", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2007", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("15-OCT-2007", "Day of the Race Observed"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2007", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("09-JUN-2008", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("16-JUN-2008", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2008", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-2008", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2008", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2009", "Liberation Day"); - - lh.addStaticHoliday ("08-JUN-2009", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("15-JUN-2009", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2009", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2009", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2009", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2009", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2010", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2010", "Liberation Day"); - - lh.addStaticHoliday ("14-JUN-2010", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("21-JUN-2010", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2010", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2010", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("11-OCT-2010", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2010", "Immaculate Conception"); - - lh.addStaticHoliday ("31-DEC-2010", "Last Weekday of the Year"); - - lh.addStaticHoliday ("21-APR-2011", "Holy Thursday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2011", "Liberation Day"); - - lh.addStaticHoliday ("13-JUN-2011", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("20-JUN-2011", "Flag Day"); - - lh.addStaticHoliday ("15-AUG-2011", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("10-OCT-2011", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2011", "Immaculate Conception"); - - lh.addStaticHoliday ("30-DEC-2011", "Last Weekday of the Year"); - - lh.addStaticHoliday ("05-APR-2012", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2012", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2012", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2012", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2012", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("15-OCT-2012", "Day of the Race Observed"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2012", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2013", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("10-JUN-2013", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("17-JUN-2013", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2013", "Independence Day"); - - lh.addStaticHoliday ("19-AUG-2013", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2013", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("17-APR-2014", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("09-JUN-2014", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("16-JUN-2014", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2014", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-2014", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("08-DEC-2014", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2014", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2015", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2015", "Liberation Day"); - - lh.addStaticHoliday ("08-JUN-2015", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("15-JUN-2015", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2015", "Independence Day"); - - lh.addStaticHoliday ("17-AUG-2015", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("12-OCT-2015", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2015", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2015", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2016", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2016", "Liberation Day"); - - lh.addStaticHoliday ("13-JUN-2016", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("20-JUN-2016", "Flag Day"); - - lh.addStaticHoliday ("15-AUG-2016", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("10-OCT-2016", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2016", "Immaculate Conception"); - - lh.addStaticHoliday ("30-DEC-2016", "Last Weekday of the Year"); - - lh.addStaticHoliday ("13-APR-2017", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2017", "Liberation Day"); - - lh.addStaticHoliday ("19-JUN-2017", "Flag Day"); - - lh.addStaticHoliday ("21-AUG-2017", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("16-OCT-2017", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2017", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2017", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2018", "Holy Thursday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2018", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2018", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2018", "Independence Day"); - - lh.addStaticHoliday ("15-OCT-2018", "Day of the Race Observed"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2018", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2019", "Holy Thursday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("10-JUN-2019", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("17-JUN-2019", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2019", "Independence Day"); - - lh.addStaticHoliday ("19-AUG-2019", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2019", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2020", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2020", "Liberation Day"); - - lh.addStaticHoliday ("08-JUN-2020", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("15-JUN-2020", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2020", "Independence Day"); - - lh.addStaticHoliday ("17-AUG-2020", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("12-OCT-2020", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2020", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2020", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2021", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2021", "Liberation Day"); - - lh.addStaticHoliday ("14-JUN-2021", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("21-JUN-2021", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2021", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2021", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("11-OCT-2021", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2021", "Immaculate Conception"); - - lh.addStaticHoliday ("31-DEC-2021", "Last Weekday of the Year"); - - lh.addStaticHoliday ("14-APR-2022", "Holy Thursday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2022", "Liberation Day"); - - lh.addStaticHoliday ("13-JUN-2022", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("20-JUN-2022", "Flag Day"); - - lh.addStaticHoliday ("15-AUG-2022", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("10-OCT-2022", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2022", "Immaculate Conception"); - - lh.addStaticHoliday ("30-DEC-2022", "Last Weekday of the Year"); - - lh.addStaticHoliday ("06-APR-2023", "Holy Thursday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2023", "Liberation Day"); - - lh.addStaticHoliday ("19-JUN-2023", "Flag Day"); - - lh.addStaticHoliday ("21-AUG-2023", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("16-OCT-2023", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2023", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2023", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2024", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("10-JUN-2024", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("17-JUN-2024", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2024", "Independence Day"); - - lh.addStaticHoliday ("19-AUG-2024", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2024", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("17-APR-2025", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("09-JUN-2025", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("16-JUN-2025", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2025", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-2025", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("08-DEC-2025", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2025", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2026", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2026", "Liberation Day"); - - lh.addStaticHoliday ("08-JUN-2026", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("15-JUN-2026", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2026", "Independence Day"); - - lh.addStaticHoliday ("17-AUG-2026", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("12-OCT-2026", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2026", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2026", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("25-MAR-2027", "Holy Thursday"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2027", "Liberation Day"); - - lh.addStaticHoliday ("14-JUN-2027", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("21-JUN-2027", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2027", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2027", "Anniversary of the Death of Ge"); - - lh.addStaticHoliday ("11-OCT-2027", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2027", "Immaculate Conception"); - - lh.addStaticHoliday ("31-DEC-2027", "Last Weekday of the Year"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/ARFHoliday.java b/org/drip/analytics/holset/ARFHoliday.java deleted file mode 100644 index e75da9c..0000000 --- a/org/drip/analytics/holset/ARFHoliday.java +++ /dev/null @@ -1,1489 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class ARFHoliday implements org.drip.analytics.holset.LocationHoliday { - public ARFHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "ARF"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-1999", "Liberation Day"); - - lh.addStaticHoliday ("14-JUN-1999", "Malvinas Islands Memorial Day Observed"); - - lh.addStaticHoliday ("21-JUN-1999", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-1999", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-1999", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("11-OCT-1999", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-1999", "Immaculate Conception"); - - lh.addStaticHoliday ("31-DEC-1999", "Last Weekday of the Year"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2000", "Liberation Day"); - - lh.addStaticHoliday ("19-JUN-2000", "Flag Day"); - - lh.addStaticHoliday ("21-AUG-2000", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("16-OCT-2000", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2000", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2000", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2000", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2001", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2001", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2001", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2001", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2001", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("08-OCT-2001", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2001", "Bank Holiday"); - - lh.addStaticHoliday ("21-DEC-2001", "Special Holiday"); - - lh.addStaticHoliday ("24-DEC-2001", "Special Holiday"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Special Holiday"); - - lh.addStaticHoliday ("31-DEC-2001", "Special Holiday"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2002", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("17-JUN-2002", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2002", "Independence Day"); - - lh.addStaticHoliday ("19-AUG-2002", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("31-MAR-2003", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("16-JUN-2003", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2003", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-2003", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("13-OCT-2003", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2003", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2003", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("05-APR-2004", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2004", "Liberation Day"); - - lh.addStaticHoliday ("21-JUN-2004", "Flag Day"); - - lh.addStaticHoliday ("02-JUL-2004", "Special Holiday"); - - lh.addStaticHoliday ("05-JUL-2004", "Special Holiday"); - - lh.addStaticHoliday ("09-JUL-2004", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2004", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("11-OCT-2004", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2004", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2005", "Liberation Day"); - - lh.addStaticHoliday ("20-JUN-2005", "Flag Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("10-OCT-2005", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2005", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2006", "Memorial Day"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2006", "Liberation Day"); - - lh.addStaticHoliday ("19-JUN-2006", "Flag Day"); - - lh.addStaticHoliday ("21-AUG-2006", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("16-OCT-2006", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2006", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2006", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2007", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2007", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2007", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2007", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2007", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("15-OCT-2007", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2007", "Bank Holiday"); - - lh.addStaticHoliday ("24-DEC-2007", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2007", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Memorial Day"); - - lh.addStaticHoliday ("02-APR-2008", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("16-JUN-2008", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2008", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-2008", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("06-NOV-2008", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2009", "Memorial Day"); - - lh.addStaticHoliday ("02-APR-2009", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2009", "Liberation Day"); - - lh.addStaticHoliday ("15-JUN-2009", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2009", "Independence Day"); - - lh.addStaticHoliday ("17-AUG-2009", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("12-OCT-2009", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2009", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2009", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2010", "Memorial Day"); - - lh.addStaticHoliday ("01-APR-2010", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2010", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("24-MAY-2010", "Bank Holiday"); - - lh.addStaticHoliday ("25-MAY-2010", "Liberation Day"); - - lh.addStaticHoliday ("21-JUN-2010", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2010", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2010", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("11-OCT-2010", "Day of the Race"); - - lh.addStaticHoliday ("27-OCT-2010", "Buenos Aires bank holidays"); - - lh.addStaticHoliday ("08-DEC-2010", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2011", "Memorial Day"); - - lh.addStaticHoliday ("21-APR-2011", "Holy Thursday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2011", "Liberation Day"); - - lh.addStaticHoliday ("20-JUN-2011", "Flag Day"); - - lh.addStaticHoliday ("15-AUG-2011", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("10-OCT-2011", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2011", "Immaculate Conception"); - - lh.addStaticHoliday ("02-APR-2012", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("05-APR-2012", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2012", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2012", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2012", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2012", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("15-OCT-2012", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2012", "Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "ARS"); - - lh.addStaticHoliday ("28-MAR-2013", "ARS"); - - lh.addStaticHoliday ("29-MAR-2013", "ARS"); - - lh.addStaticHoliday ("02-APR-2013", "ARS"); - - lh.addStaticHoliday ("01-MAY-2013", "ARS"); - - lh.addStaticHoliday ("17-JUN-2013", "ARS"); - - lh.addStaticHoliday ("09-JUL-2013", "ARS"); - - lh.addStaticHoliday ("19-AUG-2013", "ARS"); - - lh.addStaticHoliday ("14-OCT-2013", "ARS"); - - lh.addStaticHoliday ("06-NOV-2013", "ARS"); - - lh.addStaticHoliday ("25-DEC-2013", "ARS"); - - lh.addStaticHoliday ("01-JAN-2014", "ARS"); - - lh.addStaticHoliday ("24-MAR-2014", "ARS"); - - lh.addStaticHoliday ("02-APR-2014", "ARS"); - - lh.addStaticHoliday ("17-APR-2014", "ARS"); - - lh.addStaticHoliday ("18-APR-2014", "ARS"); - - lh.addStaticHoliday ("01-MAY-2014", "ARS"); - - lh.addStaticHoliday ("16-JUN-2014", "ARS"); - - lh.addStaticHoliday ("09-JUL-2014", "ARS"); - - lh.addStaticHoliday ("18-AUG-2014", "ARS"); - - lh.addStaticHoliday ("13-OCT-2014", "ARS"); - - lh.addStaticHoliday ("06-NOV-2014", "ARS"); - - lh.addStaticHoliday ("08-DEC-2014", "ARS"); - - lh.addStaticHoliday ("25-DEC-2014", "ARS"); - - lh.addStaticHoliday ("01-JAN-2015", "ARS"); - - lh.addStaticHoliday ("24-MAR-2015", "ARS"); - - lh.addStaticHoliday ("02-APR-2015", "ARS"); - - lh.addStaticHoliday ("03-APR-2015", "ARS"); - - lh.addStaticHoliday ("01-MAY-2015", "ARS"); - - lh.addStaticHoliday ("25-MAY-2015", "ARS"); - - lh.addStaticHoliday ("15-JUN-2015", "ARS"); - - lh.addStaticHoliday ("09-JUL-2015", "ARS"); - - lh.addStaticHoliday ("17-AUG-2015", "ARS"); - - lh.addStaticHoliday ("12-OCT-2015", "ARS"); - - lh.addStaticHoliday ("06-NOV-2015", "ARS"); - - lh.addStaticHoliday ("08-DEC-2015", "ARS"); - - lh.addStaticHoliday ("25-DEC-2015", "ARS"); - - lh.addStaticHoliday ("01-JAN-2016", "ARS"); - - lh.addStaticHoliday ("24-MAR-2016", "ARS"); - - lh.addStaticHoliday ("25-MAR-2016", "ARS"); - - lh.addStaticHoliday ("25-MAY-2016", "ARS"); - - lh.addStaticHoliday ("20-JUN-2016", "ARS"); - - lh.addStaticHoliday ("15-AUG-2016", "ARS"); - - lh.addStaticHoliday ("10-OCT-2016", "ARS"); - - lh.addStaticHoliday ("08-DEC-2016", "ARS"); - - lh.addStaticHoliday ("24-MAR-2017", "ARS"); - - lh.addStaticHoliday ("13-APR-2017", "ARS"); - - lh.addStaticHoliday ("14-APR-2017", "ARS"); - - lh.addStaticHoliday ("01-MAY-2017", "ARS"); - - lh.addStaticHoliday ("25-MAY-2017", "ARS"); - - lh.addStaticHoliday ("19-JUN-2017", "ARS"); - - lh.addStaticHoliday ("21-AUG-2017", "ARS"); - - lh.addStaticHoliday ("16-OCT-2017", "ARS"); - - lh.addStaticHoliday ("06-NOV-2017", "ARS"); - - lh.addStaticHoliday ("08-DEC-2017", "ARS"); - - lh.addStaticHoliday ("25-DEC-2017", "ARS"); - - lh.addStaticHoliday ("01-JAN-2018", "ARS"); - - lh.addStaticHoliday ("29-MAR-2018", "ARS"); - - lh.addStaticHoliday ("30-MAR-2018", "ARS"); - - lh.addStaticHoliday ("02-APR-2018", "ARS"); - - lh.addStaticHoliday ("01-MAY-2018", "ARS"); - - lh.addStaticHoliday ("25-MAY-2018", "ARS"); - - lh.addStaticHoliday ("18-JUN-2018", "ARS"); - - lh.addStaticHoliday ("09-JUL-2018", "ARS"); - - lh.addStaticHoliday ("20-AUG-2018", "ARS"); - - lh.addStaticHoliday ("15-OCT-2018", "ARS"); - - lh.addStaticHoliday ("06-NOV-2018", "ARS"); - - lh.addStaticHoliday ("25-DEC-2018", "ARS"); - - lh.addStaticHoliday ("01-JAN-2019", "ARS"); - - lh.addStaticHoliday ("02-APR-2019", "ARS"); - - lh.addStaticHoliday ("18-APR-2019", "ARS"); - - lh.addStaticHoliday ("19-APR-2019", "ARS"); - - lh.addStaticHoliday ("01-MAY-2019", "ARS"); - - lh.addStaticHoliday ("17-JUN-2019", "ARS"); - - lh.addStaticHoliday ("09-JUL-2019", "ARS"); - - lh.addStaticHoliday ("19-AUG-2019", "ARS"); - - lh.addStaticHoliday ("14-OCT-2019", "ARS"); - - lh.addStaticHoliday ("06-NOV-2019", "ARS"); - - lh.addStaticHoliday ("25-DEC-2019", "ARS"); - - lh.addStaticHoliday ("01-JAN-2020", "ARS"); - - lh.addStaticHoliday ("24-MAR-2020", "ARS"); - - lh.addStaticHoliday ("02-APR-2020", "ARS"); - - lh.addStaticHoliday ("09-APR-2020", "ARS"); - - lh.addStaticHoliday ("10-APR-2020", "ARS"); - - lh.addStaticHoliday ("01-MAY-2020", "ARS"); - - lh.addStaticHoliday ("25-MAY-2020", "ARS"); - - lh.addStaticHoliday ("15-JUN-2020", "ARS"); - - lh.addStaticHoliday ("09-JUL-2020", "ARS"); - - lh.addStaticHoliday ("17-AUG-2020", "ARS"); - - lh.addStaticHoliday ("12-OCT-2020", "ARS"); - - lh.addStaticHoliday ("06-NOV-2020", "ARS"); - - lh.addStaticHoliday ("08-DEC-2020", "ARS"); - - lh.addStaticHoliday ("25-DEC-2020", "ARS"); - - lh.addStaticHoliday ("01-JAN-2021", "ARS"); - - lh.addStaticHoliday ("24-MAR-2021", "ARS"); - - lh.addStaticHoliday ("01-APR-2021", "ARS"); - - lh.addStaticHoliday ("02-APR-2021", "ARS"); - - lh.addStaticHoliday ("25-MAY-2021", "ARS"); - - lh.addStaticHoliday ("21-JUN-2021", "ARS"); - - lh.addStaticHoliday ("09-JUL-2021", "ARS"); - - lh.addStaticHoliday ("16-AUG-2021", "ARS"); - - lh.addStaticHoliday ("11-OCT-2021", "ARS"); - - lh.addStaticHoliday ("08-DEC-2021", "ARS"); - - lh.addStaticHoliday ("24-MAR-2022", "ARS"); - - lh.addStaticHoliday ("14-APR-2022", "ARS"); - - lh.addStaticHoliday ("15-APR-2022", "ARS"); - - lh.addStaticHoliday ("25-MAY-2022", "ARS"); - - lh.addStaticHoliday ("20-JUN-2022", "ARS"); - - lh.addStaticHoliday ("15-AUG-2022", "ARS"); - - lh.addStaticHoliday ("10-OCT-2022", "ARS"); - - lh.addStaticHoliday ("08-DEC-2022", "ARS"); - - lh.addStaticHoliday ("24-MAR-2023", "ARS"); - - lh.addStaticHoliday ("06-APR-2023", "ARS"); - - lh.addStaticHoliday ("07-APR-2023", "ARS"); - - lh.addStaticHoliday ("01-MAY-2023", "ARS"); - - lh.addStaticHoliday ("25-MAY-2023", "ARS"); - - lh.addStaticHoliday ("19-JUN-2023", "ARS"); - - lh.addStaticHoliday ("21-AUG-2023", "ARS"); - - lh.addStaticHoliday ("16-OCT-2023", "ARS"); - - lh.addStaticHoliday ("06-NOV-2023", "ARS"); - - lh.addStaticHoliday ("08-DEC-2023", "ARS"); - - lh.addStaticHoliday ("25-DEC-2023", "ARS"); - - lh.addStaticHoliday ("01-JAN-2024", "ARS"); - - lh.addStaticHoliday ("28-MAR-2024", "ARS"); - - lh.addStaticHoliday ("29-MAR-2024", "ARS"); - - lh.addStaticHoliday ("02-APR-2024", "ARS"); - - lh.addStaticHoliday ("01-MAY-2024", "ARS"); - - lh.addStaticHoliday ("17-JUN-2024", "ARS"); - - lh.addStaticHoliday ("09-JUL-2024", "ARS"); - - lh.addStaticHoliday ("19-AUG-2024", "ARS"); - - lh.addStaticHoliday ("14-OCT-2024", "ARS"); - - lh.addStaticHoliday ("06-NOV-2024", "ARS"); - - lh.addStaticHoliday ("25-DEC-2024", "ARS"); - - lh.addStaticHoliday ("01-JAN-2025", "ARS"); - - lh.addStaticHoliday ("24-MAR-2025", "ARS"); - - lh.addStaticHoliday ("02-APR-2025", "ARS"); - - lh.addStaticHoliday ("17-APR-2025", "ARS"); - - lh.addStaticHoliday ("18-APR-2025", "ARS"); - - lh.addStaticHoliday ("01-MAY-2025", "ARS"); - - lh.addStaticHoliday ("16-JUN-2025", "ARS"); - - lh.addStaticHoliday ("09-JUL-2025", "ARS"); - - lh.addStaticHoliday ("18-AUG-2025", "ARS"); - - lh.addStaticHoliday ("13-OCT-2025", "ARS"); - - lh.addStaticHoliday ("06-NOV-2025", "ARS"); - - lh.addStaticHoliday ("08-DEC-2025", "ARS"); - - lh.addStaticHoliday ("25-DEC-2025", "ARS"); - - lh.addStaticHoliday ("01-JAN-2026", "ARS"); - - lh.addStaticHoliday ("24-MAR-2026", "ARS"); - - lh.addStaticHoliday ("02-APR-2026", "ARS"); - - lh.addStaticHoliday ("03-APR-2026", "ARS"); - - lh.addStaticHoliday ("01-MAY-2026", "ARS"); - - lh.addStaticHoliday ("25-MAY-2026", "ARS"); - - lh.addStaticHoliday ("15-JUN-2026", "ARS"); - - lh.addStaticHoliday ("09-JUL-2026", "ARS"); - - lh.addStaticHoliday ("17-AUG-2026", "ARS"); - - lh.addStaticHoliday ("12-OCT-2026", "ARS"); - - lh.addStaticHoliday ("06-NOV-2026", "ARS"); - - lh.addStaticHoliday ("08-DEC-2026", "ARS"); - - lh.addStaticHoliday ("25-DEC-2026", "ARS"); - - lh.addStaticHoliday ("01-JAN-2027", "ARS"); - - lh.addStaticHoliday ("24-MAR-2027", "ARS"); - - lh.addStaticHoliday ("25-MAR-2027", "ARS"); - - lh.addStaticHoliday ("26-MAR-2027", "ARS"); - - lh.addStaticHoliday ("02-APR-2027", "ARS"); - - lh.addStaticHoliday ("25-MAY-2027", "ARS"); - - lh.addStaticHoliday ("21-JUN-2027", "ARS"); - - lh.addStaticHoliday ("09-JUL-2027", "ARS"); - - lh.addStaticHoliday ("16-AUG-2027", "ARS"); - - lh.addStaticHoliday ("11-OCT-2027", "ARS"); - - lh.addStaticHoliday ("08-DEC-2027", "ARS"); - - lh.addStaticHoliday ("24-MAR-2028", "ARS"); - - lh.addStaticHoliday ("13-APR-2028", "ARS"); - - lh.addStaticHoliday ("14-APR-2028", "ARS"); - - lh.addStaticHoliday ("01-MAY-2028", "ARS"); - - lh.addStaticHoliday ("25-MAY-2028", "ARS"); - - lh.addStaticHoliday ("19-JUN-2028", "ARS"); - - lh.addStaticHoliday ("21-AUG-2028", "ARS"); - - lh.addStaticHoliday ("16-OCT-2028", "ARS"); - - lh.addStaticHoliday ("06-NOV-2028", "ARS"); - - lh.addStaticHoliday ("08-DEC-2028", "ARS"); - - lh.addStaticHoliday ("25-DEC-2028", "ARS"); - - lh.addStaticHoliday ("01-JAN-2029", "ARS"); - - lh.addStaticHoliday ("29-MAR-2029", "ARS"); - - lh.addStaticHoliday ("30-MAR-2029", "ARS"); - - lh.addStaticHoliday ("02-APR-2029", "ARS"); - - lh.addStaticHoliday ("01-MAY-2029", "ARS"); - - lh.addStaticHoliday ("25-MAY-2029", "ARS"); - - lh.addStaticHoliday ("18-JUN-2029", "ARS"); - - lh.addStaticHoliday ("09-JUL-2029", "ARS"); - - lh.addStaticHoliday ("20-AUG-2029", "ARS"); - - lh.addStaticHoliday ("15-OCT-2029", "ARS"); - - lh.addStaticHoliday ("06-NOV-2029", "ARS"); - - lh.addStaticHoliday ("25-DEC-2029", "ARS"); - - lh.addStaticHoliday ("01-JAN-2030", "ARS"); - - lh.addStaticHoliday ("02-APR-2030", "ARS"); - - lh.addStaticHoliday ("18-APR-2030", "ARS"); - - lh.addStaticHoliday ("19-APR-2030", "ARS"); - - lh.addStaticHoliday ("01-MAY-2030", "ARS"); - - lh.addStaticHoliday ("17-JUN-2030", "ARS"); - - lh.addStaticHoliday ("09-JUL-2030", "ARS"); - - lh.addStaticHoliday ("19-AUG-2030", "ARS"); - - lh.addStaticHoliday ("14-OCT-2030", "ARS"); - - lh.addStaticHoliday ("06-NOV-2030", "ARS"); - - lh.addStaticHoliday ("25-DEC-2030", "ARS"); - - lh.addStaticHoliday ("01-JAN-2031", "ARS"); - - lh.addStaticHoliday ("24-MAR-2031", "ARS"); - - lh.addStaticHoliday ("02-APR-2031", "ARS"); - - lh.addStaticHoliday ("10-APR-2031", "ARS"); - - lh.addStaticHoliday ("11-APR-2031", "ARS"); - - lh.addStaticHoliday ("01-MAY-2031", "ARS"); - - lh.addStaticHoliday ("16-JUN-2031", "ARS"); - - lh.addStaticHoliday ("09-JUL-2031", "ARS"); - - lh.addStaticHoliday ("18-AUG-2031", "ARS"); - - lh.addStaticHoliday ("13-OCT-2031", "ARS"); - - lh.addStaticHoliday ("06-NOV-2031", "ARS"); - - lh.addStaticHoliday ("08-DEC-2031", "ARS"); - - lh.addStaticHoliday ("25-DEC-2031", "ARS"); - - lh.addStaticHoliday ("01-JAN-2032", "ARS"); - - lh.addStaticHoliday ("24-MAR-2032", "ARS"); - - lh.addStaticHoliday ("25-MAR-2032", "ARS"); - - lh.addStaticHoliday ("26-MAR-2032", "ARS"); - - lh.addStaticHoliday ("02-APR-2032", "ARS"); - - lh.addStaticHoliday ("25-MAY-2032", "ARS"); - - lh.addStaticHoliday ("21-JUN-2032", "ARS"); - - lh.addStaticHoliday ("09-JUL-2032", "ARS"); - - lh.addStaticHoliday ("16-AUG-2032", "ARS"); - - lh.addStaticHoliday ("11-OCT-2032", "ARS"); - - lh.addStaticHoliday ("08-DEC-2032", "ARS"); - - lh.addStaticHoliday ("24-MAR-2033", "ARS"); - - lh.addStaticHoliday ("14-APR-2033", "ARS"); - - lh.addStaticHoliday ("15-APR-2033", "ARS"); - - lh.addStaticHoliday ("25-MAY-2033", "ARS"); - - lh.addStaticHoliday ("20-JUN-2033", "ARS"); - - lh.addStaticHoliday ("15-AUG-2033", "ARS"); - - lh.addStaticHoliday ("10-OCT-2033", "ARS"); - - lh.addStaticHoliday ("08-DEC-2033", "ARS"); - - lh.addStaticHoliday ("24-MAR-2034", "ARS"); - - lh.addStaticHoliday ("06-APR-2034", "ARS"); - - lh.addStaticHoliday ("07-APR-2034", "ARS"); - - lh.addStaticHoliday ("01-MAY-2034", "ARS"); - - lh.addStaticHoliday ("25-MAY-2034", "ARS"); - - lh.addStaticHoliday ("19-JUN-2034", "ARS"); - - lh.addStaticHoliday ("21-AUG-2034", "ARS"); - - lh.addStaticHoliday ("16-OCT-2034", "ARS"); - - lh.addStaticHoliday ("06-NOV-2034", "ARS"); - - lh.addStaticHoliday ("08-DEC-2034", "ARS"); - - lh.addStaticHoliday ("25-DEC-2034", "ARS"); - - lh.addStaticHoliday ("01-JAN-2035", "ARS"); - - lh.addStaticHoliday ("22-MAR-2035", "ARS"); - - lh.addStaticHoliday ("23-MAR-2035", "ARS"); - - lh.addStaticHoliday ("02-APR-2035", "ARS"); - - lh.addStaticHoliday ("01-MAY-2035", "ARS"); - - lh.addStaticHoliday ("25-MAY-2035", "ARS"); - - lh.addStaticHoliday ("18-JUN-2035", "ARS"); - - lh.addStaticHoliday ("09-JUL-2035", "ARS"); - - lh.addStaticHoliday ("20-AUG-2035", "ARS"); - - lh.addStaticHoliday ("15-OCT-2035", "ARS"); - - lh.addStaticHoliday ("06-NOV-2035", "ARS"); - - lh.addStaticHoliday ("25-DEC-2035", "ARS"); - - lh.addStaticHoliday ("01-JAN-2036", "ARS"); - - lh.addStaticHoliday ("24-MAR-2036", "ARS"); - - lh.addStaticHoliday ("02-APR-2036", "ARS"); - - lh.addStaticHoliday ("10-APR-2036", "ARS"); - - lh.addStaticHoliday ("11-APR-2036", "ARS"); - - lh.addStaticHoliday ("01-MAY-2036", "ARS"); - - lh.addStaticHoliday ("16-JUN-2036", "ARS"); - - lh.addStaticHoliday ("09-JUL-2036", "ARS"); - - lh.addStaticHoliday ("18-AUG-2036", "ARS"); - - lh.addStaticHoliday ("13-OCT-2036", "ARS"); - - lh.addStaticHoliday ("06-NOV-2036", "ARS"); - - lh.addStaticHoliday ("08-DEC-2036", "ARS"); - - lh.addStaticHoliday ("25-DEC-2036", "ARS"); - - lh.addStaticHoliday ("01-JAN-2037", "ARS"); - - lh.addStaticHoliday ("24-MAR-2037", "ARS"); - - lh.addStaticHoliday ("02-APR-2037", "ARS"); - - lh.addStaticHoliday ("03-APR-2037", "ARS"); - - lh.addStaticHoliday ("01-MAY-2037", "ARS"); - - lh.addStaticHoliday ("25-MAY-2037", "ARS"); - - lh.addStaticHoliday ("15-JUN-2037", "ARS"); - - lh.addStaticHoliday ("09-JUL-2037", "ARS"); - - lh.addStaticHoliday ("17-AUG-2037", "ARS"); - - lh.addStaticHoliday ("12-OCT-2037", "ARS"); - - lh.addStaticHoliday ("06-NOV-2037", "ARS"); - - lh.addStaticHoliday ("08-DEC-2037", "ARS"); - - lh.addStaticHoliday ("25-DEC-2037", "ARS"); - - lh.addStaticHoliday ("01-JAN-2038", "ARS"); - - lh.addStaticHoliday ("24-MAR-2038", "ARS"); - - lh.addStaticHoliday ("02-APR-2038", "ARS"); - - lh.addStaticHoliday ("22-APR-2038", "ARS"); - - lh.addStaticHoliday ("23-APR-2038", "ARS"); - - lh.addStaticHoliday ("25-MAY-2038", "ARS"); - - lh.addStaticHoliday ("21-JUN-2038", "ARS"); - - lh.addStaticHoliday ("09-JUL-2038", "ARS"); - - lh.addStaticHoliday ("16-AUG-2038", "ARS"); - - lh.addStaticHoliday ("11-OCT-2038", "ARS"); - - lh.addStaticHoliday ("08-DEC-2038", "ARS"); - - lh.addStaticHoliday ("24-MAR-2039", "ARS"); - - lh.addStaticHoliday ("07-APR-2039", "ARS"); - - lh.addStaticHoliday ("08-APR-2039", "ARS"); - - lh.addStaticHoliday ("25-MAY-2039", "ARS"); - - lh.addStaticHoliday ("20-JUN-2039", "ARS"); - - lh.addStaticHoliday ("15-AUG-2039", "ARS"); - - lh.addStaticHoliday ("10-OCT-2039", "ARS"); - - lh.addStaticHoliday ("08-DEC-2039", "ARS"); - - lh.addStaticHoliday ("29-MAR-2040", "ARS"); - - lh.addStaticHoliday ("30-MAR-2040", "ARS"); - - lh.addStaticHoliday ("02-APR-2040", "ARS"); - - lh.addStaticHoliday ("01-MAY-2040", "ARS"); - - lh.addStaticHoliday ("25-MAY-2040", "ARS"); - - lh.addStaticHoliday ("18-JUN-2040", "ARS"); - - lh.addStaticHoliday ("09-JUL-2040", "ARS"); - - lh.addStaticHoliday ("20-AUG-2040", "ARS"); - - lh.addStaticHoliday ("15-OCT-2040", "ARS"); - - lh.addStaticHoliday ("06-NOV-2040", "ARS"); - - lh.addStaticHoliday ("25-DEC-2040", "ARS"); - - lh.addStaticHoliday ("01-JAN-2041", "ARS"); - - lh.addStaticHoliday ("02-APR-2041", "ARS"); - - lh.addStaticHoliday ("18-APR-2041", "ARS"); - - lh.addStaticHoliday ("19-APR-2041", "ARS"); - - lh.addStaticHoliday ("01-MAY-2041", "ARS"); - - lh.addStaticHoliday ("17-JUN-2041", "ARS"); - - lh.addStaticHoliday ("09-JUL-2041", "ARS"); - - lh.addStaticHoliday ("19-AUG-2041", "ARS"); - - lh.addStaticHoliday ("14-OCT-2041", "ARS"); - - lh.addStaticHoliday ("06-NOV-2041", "ARS"); - - lh.addStaticHoliday ("25-DEC-2041", "ARS"); - - lh.addStaticHoliday ("01-JAN-2042", "ARS"); - - lh.addStaticHoliday ("24-MAR-2042", "ARS"); - - lh.addStaticHoliday ("02-APR-2042", "ARS"); - - lh.addStaticHoliday ("03-APR-2042", "ARS"); - - lh.addStaticHoliday ("04-APR-2042", "ARS"); - - lh.addStaticHoliday ("01-MAY-2042", "ARS"); - - lh.addStaticHoliday ("16-JUN-2042", "ARS"); - - lh.addStaticHoliday ("09-JUL-2042", "ARS"); - - lh.addStaticHoliday ("18-AUG-2042", "ARS"); - - lh.addStaticHoliday ("13-OCT-2042", "ARS"); - - lh.addStaticHoliday ("06-NOV-2042", "ARS"); - - lh.addStaticHoliday ("08-DEC-2042", "ARS"); - - lh.addStaticHoliday ("25-DEC-2042", "ARS"); - - lh.addStaticHoliday ("01-JAN-2043", "ARS"); - - lh.addStaticHoliday ("24-MAR-2043", "ARS"); - - lh.addStaticHoliday ("26-MAR-2043", "ARS"); - - lh.addStaticHoliday ("27-MAR-2043", "ARS"); - - lh.addStaticHoliday ("02-APR-2043", "ARS"); - - lh.addStaticHoliday ("01-MAY-2043", "ARS"); - - lh.addStaticHoliday ("25-MAY-2043", "ARS"); - - lh.addStaticHoliday ("15-JUN-2043", "ARS"); - - lh.addStaticHoliday ("09-JUL-2043", "ARS"); - - lh.addStaticHoliday ("17-AUG-2043", "ARS"); - - lh.addStaticHoliday ("12-OCT-2043", "ARS"); - - lh.addStaticHoliday ("06-NOV-2043", "ARS"); - - lh.addStaticHoliday ("08-DEC-2043", "ARS"); - - lh.addStaticHoliday ("25-DEC-2043", "ARS"); - - lh.addStaticHoliday ("01-JAN-2044", "ARS"); - - lh.addStaticHoliday ("24-MAR-2044", "ARS"); - - lh.addStaticHoliday ("14-APR-2044", "ARS"); - - lh.addStaticHoliday ("15-APR-2044", "ARS"); - - lh.addStaticHoliday ("25-MAY-2044", "ARS"); - - lh.addStaticHoliday ("20-JUN-2044", "ARS"); - - lh.addStaticHoliday ("15-AUG-2044", "ARS"); - - lh.addStaticHoliday ("10-OCT-2044", "ARS"); - - lh.addStaticHoliday ("08-DEC-2044", "ARS"); - - lh.addStaticHoliday ("24-MAR-2045", "ARS"); - - lh.addStaticHoliday ("06-APR-2045", "ARS"); - - lh.addStaticHoliday ("07-APR-2045", "ARS"); - - lh.addStaticHoliday ("01-MAY-2045", "ARS"); - - lh.addStaticHoliday ("25-MAY-2045", "ARS"); - - lh.addStaticHoliday ("19-JUN-2045", "ARS"); - - lh.addStaticHoliday ("21-AUG-2045", "ARS"); - - lh.addStaticHoliday ("16-OCT-2045", "ARS"); - - lh.addStaticHoliday ("06-NOV-2045", "ARS"); - - lh.addStaticHoliday ("08-DEC-2045", "ARS"); - - lh.addStaticHoliday ("25-DEC-2045", "ARS"); - - lh.addStaticHoliday ("01-JAN-2046", "ARS"); - - lh.addStaticHoliday ("22-MAR-2046", "ARS"); - - lh.addStaticHoliday ("23-MAR-2046", "ARS"); - - lh.addStaticHoliday ("02-APR-2046", "ARS"); - - lh.addStaticHoliday ("01-MAY-2046", "ARS"); - - lh.addStaticHoliday ("25-MAY-2046", "ARS"); - - lh.addStaticHoliday ("18-JUN-2046", "ARS"); - - lh.addStaticHoliday ("09-JUL-2046", "ARS"); - - lh.addStaticHoliday ("20-AUG-2046", "ARS"); - - lh.addStaticHoliday ("15-OCT-2046", "ARS"); - - lh.addStaticHoliday ("06-NOV-2046", "ARS"); - - lh.addStaticHoliday ("25-DEC-2046", "ARS"); - - lh.addStaticHoliday ("01-JAN-2047", "ARS"); - - lh.addStaticHoliday ("02-APR-2047", "ARS"); - - lh.addStaticHoliday ("11-APR-2047", "ARS"); - - lh.addStaticHoliday ("12-APR-2047", "ARS"); - - lh.addStaticHoliday ("01-MAY-2047", "ARS"); - - lh.addStaticHoliday ("17-JUN-2047", "ARS"); - - lh.addStaticHoliday ("09-JUL-2047", "ARS"); - - lh.addStaticHoliday ("19-AUG-2047", "ARS"); - - lh.addStaticHoliday ("14-OCT-2047", "ARS"); - - lh.addStaticHoliday ("06-NOV-2047", "ARS"); - - lh.addStaticHoliday ("25-DEC-2047", "ARS"); - - lh.addStaticHoliday ("01-JAN-2048", "ARS"); - - lh.addStaticHoliday ("24-MAR-2048", "ARS"); - - lh.addStaticHoliday ("02-APR-2048", "ARS"); - - lh.addStaticHoliday ("03-APR-2048", "ARS"); - - lh.addStaticHoliday ("01-MAY-2048", "ARS"); - - lh.addStaticHoliday ("25-MAY-2048", "ARS"); - - lh.addStaticHoliday ("15-JUN-2048", "ARS"); - - lh.addStaticHoliday ("09-JUL-2048", "ARS"); - - lh.addStaticHoliday ("17-AUG-2048", "ARS"); - - lh.addStaticHoliday ("12-OCT-2048", "ARS"); - - lh.addStaticHoliday ("06-NOV-2048", "ARS"); - - lh.addStaticHoliday ("08-DEC-2048", "ARS"); - - lh.addStaticHoliday ("25-DEC-2048", "ARS"); - - lh.addStaticHoliday ("01-JAN-2049", "ARS"); - - lh.addStaticHoliday ("24-MAR-2049", "ARS"); - - lh.addStaticHoliday ("02-APR-2049", "ARS"); - - lh.addStaticHoliday ("15-APR-2049", "ARS"); - - lh.addStaticHoliday ("16-APR-2049", "ARS"); - - lh.addStaticHoliday ("25-MAY-2049", "ARS"); - - lh.addStaticHoliday ("21-JUN-2049", "ARS"); - - lh.addStaticHoliday ("09-JUL-2049", "ARS"); - - lh.addStaticHoliday ("16-AUG-2049", "ARS"); - - lh.addStaticHoliday ("11-OCT-2049", "ARS"); - - lh.addStaticHoliday ("08-DEC-2049", "ARS"); - - lh.addStaticHoliday ("24-MAR-2050", "ARS"); - - lh.addStaticHoliday ("07-APR-2050", "ARS"); - - lh.addStaticHoliday ("08-APR-2050", "ARS"); - - lh.addStaticHoliday ("25-MAY-2050", "ARS"); - - lh.addStaticHoliday ("20-JUN-2050", "ARS"); - - lh.addStaticHoliday ("15-AUG-2050", "ARS"); - - lh.addStaticHoliday ("10-OCT-2050", "ARS"); - - lh.addStaticHoliday ("08-DEC-2050", "ARS"); - - lh.addStaticHoliday ("24-MAR-2051", "ARS"); - - lh.addStaticHoliday ("30-MAR-2051", "ARS"); - - lh.addStaticHoliday ("31-MAR-2051", "ARS"); - - lh.addStaticHoliday ("01-MAY-2051", "ARS"); - - lh.addStaticHoliday ("25-MAY-2051", "ARS"); - - lh.addStaticHoliday ("19-JUN-2051", "ARS"); - - lh.addStaticHoliday ("21-AUG-2051", "ARS"); - - lh.addStaticHoliday ("16-OCT-2051", "ARS"); - - lh.addStaticHoliday ("06-NOV-2051", "ARS"); - - lh.addStaticHoliday ("08-DEC-2051", "ARS"); - - lh.addStaticHoliday ("25-DEC-2051", "ARS"); - - lh.addStaticHoliday ("01-JAN-2052", "ARS"); - - lh.addStaticHoliday ("02-APR-2052", "ARS"); - - lh.addStaticHoliday ("18-APR-2052", "ARS"); - - lh.addStaticHoliday ("19-APR-2052", "ARS"); - - lh.addStaticHoliday ("01-MAY-2052", "ARS"); - - lh.addStaticHoliday ("17-JUN-2052", "ARS"); - - lh.addStaticHoliday ("09-JUL-2052", "ARS"); - - lh.addStaticHoliday ("19-AUG-2052", "ARS"); - - lh.addStaticHoliday ("14-OCT-2052", "ARS"); - - lh.addStaticHoliday ("06-NOV-2052", "ARS"); - - lh.addStaticHoliday ("25-DEC-2052", "ARS"); - - lh.addStaticHoliday ("01-JAN-2053", "ARS"); - - lh.addStaticHoliday ("24-MAR-2053", "ARS"); - - lh.addStaticHoliday ("02-APR-2053", "ARS"); - - lh.addStaticHoliday ("03-APR-2053", "ARS"); - - lh.addStaticHoliday ("04-APR-2053", "ARS"); - - lh.addStaticHoliday ("01-MAY-2053", "ARS"); - - lh.addStaticHoliday ("16-JUN-2053", "ARS"); - - lh.addStaticHoliday ("09-JUL-2053", "ARS"); - - lh.addStaticHoliday ("18-AUG-2053", "ARS"); - - lh.addStaticHoliday ("13-OCT-2053", "ARS"); - - lh.addStaticHoliday ("06-NOV-2053", "ARS"); - - lh.addStaticHoliday ("08-DEC-2053", "ARS"); - - lh.addStaticHoliday ("25-DEC-2053", "ARS"); - - lh.addStaticHoliday ("01-JAN-2054", "ARS"); - - lh.addStaticHoliday ("24-MAR-2054", "ARS"); - - lh.addStaticHoliday ("26-MAR-2054", "ARS"); - - lh.addStaticHoliday ("27-MAR-2054", "ARS"); - - lh.addStaticHoliday ("02-APR-2054", "ARS"); - - lh.addStaticHoliday ("01-MAY-2054", "ARS"); - - lh.addStaticHoliday ("25-MAY-2054", "ARS"); - - lh.addStaticHoliday ("15-JUN-2054", "ARS"); - - lh.addStaticHoliday ("09-JUL-2054", "ARS"); - - lh.addStaticHoliday ("17-AUG-2054", "ARS"); - - lh.addStaticHoliday ("12-OCT-2054", "ARS"); - - lh.addStaticHoliday ("06-NOV-2054", "ARS"); - - lh.addStaticHoliday ("08-DEC-2054", "ARS"); - - lh.addStaticHoliday ("25-DEC-2054", "ARS"); - - lh.addStaticHoliday ("01-JAN-2055", "ARS"); - - lh.addStaticHoliday ("24-MAR-2055", "ARS"); - - lh.addStaticHoliday ("02-APR-2055", "ARS"); - - lh.addStaticHoliday ("15-APR-2055", "ARS"); - - lh.addStaticHoliday ("16-APR-2055", "ARS"); - - lh.addStaticHoliday ("25-MAY-2055", "ARS"); - - lh.addStaticHoliday ("21-JUN-2055", "ARS"); - - lh.addStaticHoliday ("09-JUL-2055", "ARS"); - - lh.addStaticHoliday ("16-AUG-2055", "ARS"); - - lh.addStaticHoliday ("11-OCT-2055", "ARS"); - - lh.addStaticHoliday ("08-DEC-2055", "ARS"); - - lh.addStaticHoliday ("24-MAR-2056", "ARS"); - - lh.addStaticHoliday ("30-MAR-2056", "ARS"); - - lh.addStaticHoliday ("31-MAR-2056", "ARS"); - - lh.addStaticHoliday ("01-MAY-2056", "ARS"); - - lh.addStaticHoliday ("25-MAY-2056", "ARS"); - - lh.addStaticHoliday ("19-JUN-2056", "ARS"); - - lh.addStaticHoliday ("21-AUG-2056", "ARS"); - - lh.addStaticHoliday ("16-OCT-2056", "ARS"); - - lh.addStaticHoliday ("06-NOV-2056", "ARS"); - - lh.addStaticHoliday ("08-DEC-2056", "ARS"); - - lh.addStaticHoliday ("25-DEC-2056", "ARS"); - - lh.addStaticHoliday ("01-JAN-2057", "ARS"); - - lh.addStaticHoliday ("02-APR-2057", "ARS"); - - lh.addStaticHoliday ("19-APR-2057", "ARS"); - - lh.addStaticHoliday ("20-APR-2057", "ARS"); - - lh.addStaticHoliday ("01-MAY-2057", "ARS"); - - lh.addStaticHoliday ("25-MAY-2057", "ARS"); - - lh.addStaticHoliday ("18-JUN-2057", "ARS"); - - lh.addStaticHoliday ("09-JUL-2057", "ARS"); - - lh.addStaticHoliday ("20-AUG-2057", "ARS"); - - lh.addStaticHoliday ("15-OCT-2057", "ARS"); - - lh.addStaticHoliday ("06-NOV-2057", "ARS"); - - lh.addStaticHoliday ("25-DEC-2057", "ARS"); - - lh.addStaticHoliday ("01-JAN-2058", "ARS"); - - lh.addStaticHoliday ("02-APR-2058", "ARS"); - - lh.addStaticHoliday ("11-APR-2058", "ARS"); - - lh.addStaticHoliday ("12-APR-2058", "ARS"); - - lh.addStaticHoliday ("01-MAY-2058", "ARS"); - - lh.addStaticHoliday ("17-JUN-2058", "ARS"); - - lh.addStaticHoliday ("09-JUL-2058", "ARS"); - - lh.addStaticHoliday ("19-AUG-2058", "ARS"); - - lh.addStaticHoliday ("14-OCT-2058", "ARS"); - - lh.addStaticHoliday ("06-NOV-2058", "ARS"); - - lh.addStaticHoliday ("25-DEC-2058", "ARS"); - - lh.addStaticHoliday ("01-JAN-2059", "ARS"); - - lh.addStaticHoliday ("24-MAR-2059", "ARS"); - - lh.addStaticHoliday ("27-MAR-2059", "ARS"); - - lh.addStaticHoliday ("28-MAR-2059", "ARS"); - - lh.addStaticHoliday ("02-APR-2059", "ARS"); - - lh.addStaticHoliday ("01-MAY-2059", "ARS"); - - lh.addStaticHoliday ("16-JUN-2059", "ARS"); - - lh.addStaticHoliday ("09-JUL-2059", "ARS"); - - lh.addStaticHoliday ("18-AUG-2059", "ARS"); - - lh.addStaticHoliday ("13-OCT-2059", "ARS"); - - lh.addStaticHoliday ("06-NOV-2059", "ARS"); - - lh.addStaticHoliday ("08-DEC-2059", "ARS"); - - lh.addStaticHoliday ("25-DEC-2059", "ARS"); - - lh.addStaticHoliday ("01-JAN-2060", "ARS"); - - lh.addStaticHoliday ("24-MAR-2060", "ARS"); - - lh.addStaticHoliday ("02-APR-2060", "ARS"); - - lh.addStaticHoliday ("15-APR-2060", "ARS"); - - lh.addStaticHoliday ("16-APR-2060", "ARS"); - - lh.addStaticHoliday ("25-MAY-2060", "ARS"); - - lh.addStaticHoliday ("21-JUN-2060", "ARS"); - - lh.addStaticHoliday ("09-JUL-2060", "ARS"); - - lh.addStaticHoliday ("16-AUG-2060", "ARS"); - - lh.addStaticHoliday ("11-OCT-2060", "ARS"); - - lh.addStaticHoliday ("08-DEC-2060", "ARS"); - - lh.addStaticHoliday ("24-MAR-2061", "ARS"); - - lh.addStaticHoliday ("07-APR-2061", "ARS"); - - lh.addStaticHoliday ("08-APR-2061", "ARS"); - - lh.addStaticHoliday ("25-MAY-2061", "ARS"); - - lh.addStaticHoliday ("20-JUN-2061", "ARS"); - - lh.addStaticHoliday ("15-AUG-2061", "ARS"); - - lh.addStaticHoliday ("10-OCT-2061", "ARS"); - - lh.addStaticHoliday ("08-DEC-2061", "ARS"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/ARNHoliday.java b/org/drip/analytics/holset/ARNHoliday.java deleted file mode 100644 index b5bdf2b..0000000 --- a/org/drip/analytics/holset/ARNHoliday.java +++ /dev/null @@ -1,1489 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class ARNHoliday implements org.drip.analytics.holset.LocationHoliday { - public ARNHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "ARN"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-1999", "Liberation Day"); - - lh.addStaticHoliday ("14-JUN-1999", "Malvinas Islands Memorial Day Observed"); - - lh.addStaticHoliday ("21-JUN-1999", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-1999", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-1999", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("11-OCT-1999", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-1999", "Immaculate Conception"); - - lh.addStaticHoliday ("31-DEC-1999", "Last Weekday of the Year"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2000", "Liberation Day"); - - lh.addStaticHoliday ("19-JUN-2000", "Flag Day"); - - lh.addStaticHoliday ("21-AUG-2000", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("16-OCT-2000", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2000", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2000", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2000", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2001", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2001", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2001", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2001", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2001", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("08-OCT-2001", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2001", "Bank Holiday"); - - lh.addStaticHoliday ("21-DEC-2001", "Special Holiday"); - - lh.addStaticHoliday ("24-DEC-2001", "Special Holiday"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Special Holiday"); - - lh.addStaticHoliday ("31-DEC-2001", "Special Holiday"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2002", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("17-JUN-2002", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2002", "Independence Day"); - - lh.addStaticHoliday ("19-AUG-2002", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("31-MAR-2003", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("16-JUN-2003", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2003", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-2003", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("13-OCT-2003", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2003", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2003", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("05-APR-2004", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2004", "Liberation Day"); - - lh.addStaticHoliday ("21-JUN-2004", "Flag Day"); - - lh.addStaticHoliday ("02-JUL-2004", "Special Holiday"); - - lh.addStaticHoliday ("05-JUL-2004", "Special Holiday"); - - lh.addStaticHoliday ("09-JUL-2004", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2004", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("11-OCT-2004", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2004", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2005", "Liberation Day"); - - lh.addStaticHoliday ("20-JUN-2005", "Flag Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("10-OCT-2005", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2005", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2006", "Memorial Day"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2006", "Liberation Day"); - - lh.addStaticHoliday ("19-JUN-2006", "Flag Day"); - - lh.addStaticHoliday ("21-AUG-2006", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("16-OCT-2006", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2006", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2006", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2007", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2007", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2007", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2007", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2007", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("15-OCT-2007", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2007", "Bank Holiday"); - - lh.addStaticHoliday ("24-DEC-2007", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2007", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Memorial Day"); - - lh.addStaticHoliday ("02-APR-2008", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("16-JUN-2008", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2008", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-2008", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("06-NOV-2008", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2009", "Memorial Day"); - - lh.addStaticHoliday ("02-APR-2009", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2009", "Liberation Day"); - - lh.addStaticHoliday ("15-JUN-2009", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2009", "Independence Day"); - - lh.addStaticHoliday ("17-AUG-2009", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("12-OCT-2009", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2009", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2009", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2010", "Memorial Day"); - - lh.addStaticHoliday ("01-APR-2010", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2010", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("24-MAY-2010", "Bank Holiday"); - - lh.addStaticHoliday ("25-MAY-2010", "Liberation Day"); - - lh.addStaticHoliday ("21-JUN-2010", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2010", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2010", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("11-OCT-2010", "Day of the Race"); - - lh.addStaticHoliday ("27-OCT-2010", "Buenos Aires bank holidays"); - - lh.addStaticHoliday ("08-DEC-2010", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2011", "Memorial Day"); - - lh.addStaticHoliday ("21-APR-2011", "Holy Thursday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2011", "Liberation Day"); - - lh.addStaticHoliday ("20-JUN-2011", "Flag Day"); - - lh.addStaticHoliday ("15-AUG-2011", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("10-OCT-2011", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2011", "Immaculate Conception"); - - lh.addStaticHoliday ("02-APR-2012", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("05-APR-2012", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2012", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2012", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2012", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2012", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("15-OCT-2012", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2012", "Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "ARS"); - - lh.addStaticHoliday ("28-MAR-2013", "ARS"); - - lh.addStaticHoliday ("29-MAR-2013", "ARS"); - - lh.addStaticHoliday ("02-APR-2013", "ARS"); - - lh.addStaticHoliday ("01-MAY-2013", "ARS"); - - lh.addStaticHoliday ("17-JUN-2013", "ARS"); - - lh.addStaticHoliday ("09-JUL-2013", "ARS"); - - lh.addStaticHoliday ("19-AUG-2013", "ARS"); - - lh.addStaticHoliday ("14-OCT-2013", "ARS"); - - lh.addStaticHoliday ("06-NOV-2013", "ARS"); - - lh.addStaticHoliday ("25-DEC-2013", "ARS"); - - lh.addStaticHoliday ("01-JAN-2014", "ARS"); - - lh.addStaticHoliday ("24-MAR-2014", "ARS"); - - lh.addStaticHoliday ("02-APR-2014", "ARS"); - - lh.addStaticHoliday ("17-APR-2014", "ARS"); - - lh.addStaticHoliday ("18-APR-2014", "ARS"); - - lh.addStaticHoliday ("01-MAY-2014", "ARS"); - - lh.addStaticHoliday ("16-JUN-2014", "ARS"); - - lh.addStaticHoliday ("09-JUL-2014", "ARS"); - - lh.addStaticHoliday ("18-AUG-2014", "ARS"); - - lh.addStaticHoliday ("13-OCT-2014", "ARS"); - - lh.addStaticHoliday ("06-NOV-2014", "ARS"); - - lh.addStaticHoliday ("08-DEC-2014", "ARS"); - - lh.addStaticHoliday ("25-DEC-2014", "ARS"); - - lh.addStaticHoliday ("01-JAN-2015", "ARS"); - - lh.addStaticHoliday ("24-MAR-2015", "ARS"); - - lh.addStaticHoliday ("02-APR-2015", "ARS"); - - lh.addStaticHoliday ("03-APR-2015", "ARS"); - - lh.addStaticHoliday ("01-MAY-2015", "ARS"); - - lh.addStaticHoliday ("25-MAY-2015", "ARS"); - - lh.addStaticHoliday ("15-JUN-2015", "ARS"); - - lh.addStaticHoliday ("09-JUL-2015", "ARS"); - - lh.addStaticHoliday ("17-AUG-2015", "ARS"); - - lh.addStaticHoliday ("12-OCT-2015", "ARS"); - - lh.addStaticHoliday ("06-NOV-2015", "ARS"); - - lh.addStaticHoliday ("08-DEC-2015", "ARS"); - - lh.addStaticHoliday ("25-DEC-2015", "ARS"); - - lh.addStaticHoliday ("01-JAN-2016", "ARS"); - - lh.addStaticHoliday ("24-MAR-2016", "ARS"); - - lh.addStaticHoliday ("25-MAR-2016", "ARS"); - - lh.addStaticHoliday ("25-MAY-2016", "ARS"); - - lh.addStaticHoliday ("20-JUN-2016", "ARS"); - - lh.addStaticHoliday ("15-AUG-2016", "ARS"); - - lh.addStaticHoliday ("10-OCT-2016", "ARS"); - - lh.addStaticHoliday ("08-DEC-2016", "ARS"); - - lh.addStaticHoliday ("24-MAR-2017", "ARS"); - - lh.addStaticHoliday ("13-APR-2017", "ARS"); - - lh.addStaticHoliday ("14-APR-2017", "ARS"); - - lh.addStaticHoliday ("01-MAY-2017", "ARS"); - - lh.addStaticHoliday ("25-MAY-2017", "ARS"); - - lh.addStaticHoliday ("19-JUN-2017", "ARS"); - - lh.addStaticHoliday ("21-AUG-2017", "ARS"); - - lh.addStaticHoliday ("16-OCT-2017", "ARS"); - - lh.addStaticHoliday ("06-NOV-2017", "ARS"); - - lh.addStaticHoliday ("08-DEC-2017", "ARS"); - - lh.addStaticHoliday ("25-DEC-2017", "ARS"); - - lh.addStaticHoliday ("01-JAN-2018", "ARS"); - - lh.addStaticHoliday ("29-MAR-2018", "ARS"); - - lh.addStaticHoliday ("30-MAR-2018", "ARS"); - - lh.addStaticHoliday ("02-APR-2018", "ARS"); - - lh.addStaticHoliday ("01-MAY-2018", "ARS"); - - lh.addStaticHoliday ("25-MAY-2018", "ARS"); - - lh.addStaticHoliday ("18-JUN-2018", "ARS"); - - lh.addStaticHoliday ("09-JUL-2018", "ARS"); - - lh.addStaticHoliday ("20-AUG-2018", "ARS"); - - lh.addStaticHoliday ("15-OCT-2018", "ARS"); - - lh.addStaticHoliday ("06-NOV-2018", "ARS"); - - lh.addStaticHoliday ("25-DEC-2018", "ARS"); - - lh.addStaticHoliday ("01-JAN-2019", "ARS"); - - lh.addStaticHoliday ("02-APR-2019", "ARS"); - - lh.addStaticHoliday ("18-APR-2019", "ARS"); - - lh.addStaticHoliday ("19-APR-2019", "ARS"); - - lh.addStaticHoliday ("01-MAY-2019", "ARS"); - - lh.addStaticHoliday ("17-JUN-2019", "ARS"); - - lh.addStaticHoliday ("09-JUL-2019", "ARS"); - - lh.addStaticHoliday ("19-AUG-2019", "ARS"); - - lh.addStaticHoliday ("14-OCT-2019", "ARS"); - - lh.addStaticHoliday ("06-NOV-2019", "ARS"); - - lh.addStaticHoliday ("25-DEC-2019", "ARS"); - - lh.addStaticHoliday ("01-JAN-2020", "ARS"); - - lh.addStaticHoliday ("24-MAR-2020", "ARS"); - - lh.addStaticHoliday ("02-APR-2020", "ARS"); - - lh.addStaticHoliday ("09-APR-2020", "ARS"); - - lh.addStaticHoliday ("10-APR-2020", "ARS"); - - lh.addStaticHoliday ("01-MAY-2020", "ARS"); - - lh.addStaticHoliday ("25-MAY-2020", "ARS"); - - lh.addStaticHoliday ("15-JUN-2020", "ARS"); - - lh.addStaticHoliday ("09-JUL-2020", "ARS"); - - lh.addStaticHoliday ("17-AUG-2020", "ARS"); - - lh.addStaticHoliday ("12-OCT-2020", "ARS"); - - lh.addStaticHoliday ("06-NOV-2020", "ARS"); - - lh.addStaticHoliday ("08-DEC-2020", "ARS"); - - lh.addStaticHoliday ("25-DEC-2020", "ARS"); - - lh.addStaticHoliday ("01-JAN-2021", "ARS"); - - lh.addStaticHoliday ("24-MAR-2021", "ARS"); - - lh.addStaticHoliday ("01-APR-2021", "ARS"); - - lh.addStaticHoliday ("02-APR-2021", "ARS"); - - lh.addStaticHoliday ("25-MAY-2021", "ARS"); - - lh.addStaticHoliday ("21-JUN-2021", "ARS"); - - lh.addStaticHoliday ("09-JUL-2021", "ARS"); - - lh.addStaticHoliday ("16-AUG-2021", "ARS"); - - lh.addStaticHoliday ("11-OCT-2021", "ARS"); - - lh.addStaticHoliday ("08-DEC-2021", "ARS"); - - lh.addStaticHoliday ("24-MAR-2022", "ARS"); - - lh.addStaticHoliday ("14-APR-2022", "ARS"); - - lh.addStaticHoliday ("15-APR-2022", "ARS"); - - lh.addStaticHoliday ("25-MAY-2022", "ARS"); - - lh.addStaticHoliday ("20-JUN-2022", "ARS"); - - lh.addStaticHoliday ("15-AUG-2022", "ARS"); - - lh.addStaticHoliday ("10-OCT-2022", "ARS"); - - lh.addStaticHoliday ("08-DEC-2022", "ARS"); - - lh.addStaticHoliday ("24-MAR-2023", "ARS"); - - lh.addStaticHoliday ("06-APR-2023", "ARS"); - - lh.addStaticHoliday ("07-APR-2023", "ARS"); - - lh.addStaticHoliday ("01-MAY-2023", "ARS"); - - lh.addStaticHoliday ("25-MAY-2023", "ARS"); - - lh.addStaticHoliday ("19-JUN-2023", "ARS"); - - lh.addStaticHoliday ("21-AUG-2023", "ARS"); - - lh.addStaticHoliday ("16-OCT-2023", "ARS"); - - lh.addStaticHoliday ("06-NOV-2023", "ARS"); - - lh.addStaticHoliday ("08-DEC-2023", "ARS"); - - lh.addStaticHoliday ("25-DEC-2023", "ARS"); - - lh.addStaticHoliday ("01-JAN-2024", "ARS"); - - lh.addStaticHoliday ("28-MAR-2024", "ARS"); - - lh.addStaticHoliday ("29-MAR-2024", "ARS"); - - lh.addStaticHoliday ("02-APR-2024", "ARS"); - - lh.addStaticHoliday ("01-MAY-2024", "ARS"); - - lh.addStaticHoliday ("17-JUN-2024", "ARS"); - - lh.addStaticHoliday ("09-JUL-2024", "ARS"); - - lh.addStaticHoliday ("19-AUG-2024", "ARS"); - - lh.addStaticHoliday ("14-OCT-2024", "ARS"); - - lh.addStaticHoliday ("06-NOV-2024", "ARS"); - - lh.addStaticHoliday ("25-DEC-2024", "ARS"); - - lh.addStaticHoliday ("01-JAN-2025", "ARS"); - - lh.addStaticHoliday ("24-MAR-2025", "ARS"); - - lh.addStaticHoliday ("02-APR-2025", "ARS"); - - lh.addStaticHoliday ("17-APR-2025", "ARS"); - - lh.addStaticHoliday ("18-APR-2025", "ARS"); - - lh.addStaticHoliday ("01-MAY-2025", "ARS"); - - lh.addStaticHoliday ("16-JUN-2025", "ARS"); - - lh.addStaticHoliday ("09-JUL-2025", "ARS"); - - lh.addStaticHoliday ("18-AUG-2025", "ARS"); - - lh.addStaticHoliday ("13-OCT-2025", "ARS"); - - lh.addStaticHoliday ("06-NOV-2025", "ARS"); - - lh.addStaticHoliday ("08-DEC-2025", "ARS"); - - lh.addStaticHoliday ("25-DEC-2025", "ARS"); - - lh.addStaticHoliday ("01-JAN-2026", "ARS"); - - lh.addStaticHoliday ("24-MAR-2026", "ARS"); - - lh.addStaticHoliday ("02-APR-2026", "ARS"); - - lh.addStaticHoliday ("03-APR-2026", "ARS"); - - lh.addStaticHoliday ("01-MAY-2026", "ARS"); - - lh.addStaticHoliday ("25-MAY-2026", "ARS"); - - lh.addStaticHoliday ("15-JUN-2026", "ARS"); - - lh.addStaticHoliday ("09-JUL-2026", "ARS"); - - lh.addStaticHoliday ("17-AUG-2026", "ARS"); - - lh.addStaticHoliday ("12-OCT-2026", "ARS"); - - lh.addStaticHoliday ("06-NOV-2026", "ARS"); - - lh.addStaticHoliday ("08-DEC-2026", "ARS"); - - lh.addStaticHoliday ("25-DEC-2026", "ARS"); - - lh.addStaticHoliday ("01-JAN-2027", "ARS"); - - lh.addStaticHoliday ("24-MAR-2027", "ARS"); - - lh.addStaticHoliday ("25-MAR-2027", "ARS"); - - lh.addStaticHoliday ("26-MAR-2027", "ARS"); - - lh.addStaticHoliday ("02-APR-2027", "ARS"); - - lh.addStaticHoliday ("25-MAY-2027", "ARS"); - - lh.addStaticHoliday ("21-JUN-2027", "ARS"); - - lh.addStaticHoliday ("09-JUL-2027", "ARS"); - - lh.addStaticHoliday ("16-AUG-2027", "ARS"); - - lh.addStaticHoliday ("11-OCT-2027", "ARS"); - - lh.addStaticHoliday ("08-DEC-2027", "ARS"); - - lh.addStaticHoliday ("24-MAR-2028", "ARS"); - - lh.addStaticHoliday ("13-APR-2028", "ARS"); - - lh.addStaticHoliday ("14-APR-2028", "ARS"); - - lh.addStaticHoliday ("01-MAY-2028", "ARS"); - - lh.addStaticHoliday ("25-MAY-2028", "ARS"); - - lh.addStaticHoliday ("19-JUN-2028", "ARS"); - - lh.addStaticHoliday ("21-AUG-2028", "ARS"); - - lh.addStaticHoliday ("16-OCT-2028", "ARS"); - - lh.addStaticHoliday ("06-NOV-2028", "ARS"); - - lh.addStaticHoliday ("08-DEC-2028", "ARS"); - - lh.addStaticHoliday ("25-DEC-2028", "ARS"); - - lh.addStaticHoliday ("01-JAN-2029", "ARS"); - - lh.addStaticHoliday ("29-MAR-2029", "ARS"); - - lh.addStaticHoliday ("30-MAR-2029", "ARS"); - - lh.addStaticHoliday ("02-APR-2029", "ARS"); - - lh.addStaticHoliday ("01-MAY-2029", "ARS"); - - lh.addStaticHoliday ("25-MAY-2029", "ARS"); - - lh.addStaticHoliday ("18-JUN-2029", "ARS"); - - lh.addStaticHoliday ("09-JUL-2029", "ARS"); - - lh.addStaticHoliday ("20-AUG-2029", "ARS"); - - lh.addStaticHoliday ("15-OCT-2029", "ARS"); - - lh.addStaticHoliday ("06-NOV-2029", "ARS"); - - lh.addStaticHoliday ("25-DEC-2029", "ARS"); - - lh.addStaticHoliday ("01-JAN-2030", "ARS"); - - lh.addStaticHoliday ("02-APR-2030", "ARS"); - - lh.addStaticHoliday ("18-APR-2030", "ARS"); - - lh.addStaticHoliday ("19-APR-2030", "ARS"); - - lh.addStaticHoliday ("01-MAY-2030", "ARS"); - - lh.addStaticHoliday ("17-JUN-2030", "ARS"); - - lh.addStaticHoliday ("09-JUL-2030", "ARS"); - - lh.addStaticHoliday ("19-AUG-2030", "ARS"); - - lh.addStaticHoliday ("14-OCT-2030", "ARS"); - - lh.addStaticHoliday ("06-NOV-2030", "ARS"); - - lh.addStaticHoliday ("25-DEC-2030", "ARS"); - - lh.addStaticHoliday ("01-JAN-2031", "ARS"); - - lh.addStaticHoliday ("24-MAR-2031", "ARS"); - - lh.addStaticHoliday ("02-APR-2031", "ARS"); - - lh.addStaticHoliday ("10-APR-2031", "ARS"); - - lh.addStaticHoliday ("11-APR-2031", "ARS"); - - lh.addStaticHoliday ("01-MAY-2031", "ARS"); - - lh.addStaticHoliday ("16-JUN-2031", "ARS"); - - lh.addStaticHoliday ("09-JUL-2031", "ARS"); - - lh.addStaticHoliday ("18-AUG-2031", "ARS"); - - lh.addStaticHoliday ("13-OCT-2031", "ARS"); - - lh.addStaticHoliday ("06-NOV-2031", "ARS"); - - lh.addStaticHoliday ("08-DEC-2031", "ARS"); - - lh.addStaticHoliday ("25-DEC-2031", "ARS"); - - lh.addStaticHoliday ("01-JAN-2032", "ARS"); - - lh.addStaticHoliday ("24-MAR-2032", "ARS"); - - lh.addStaticHoliday ("25-MAR-2032", "ARS"); - - lh.addStaticHoliday ("26-MAR-2032", "ARS"); - - lh.addStaticHoliday ("02-APR-2032", "ARS"); - - lh.addStaticHoliday ("25-MAY-2032", "ARS"); - - lh.addStaticHoliday ("21-JUN-2032", "ARS"); - - lh.addStaticHoliday ("09-JUL-2032", "ARS"); - - lh.addStaticHoliday ("16-AUG-2032", "ARS"); - - lh.addStaticHoliday ("11-OCT-2032", "ARS"); - - lh.addStaticHoliday ("08-DEC-2032", "ARS"); - - lh.addStaticHoliday ("24-MAR-2033", "ARS"); - - lh.addStaticHoliday ("14-APR-2033", "ARS"); - - lh.addStaticHoliday ("15-APR-2033", "ARS"); - - lh.addStaticHoliday ("25-MAY-2033", "ARS"); - - lh.addStaticHoliday ("20-JUN-2033", "ARS"); - - lh.addStaticHoliday ("15-AUG-2033", "ARS"); - - lh.addStaticHoliday ("10-OCT-2033", "ARS"); - - lh.addStaticHoliday ("08-DEC-2033", "ARS"); - - lh.addStaticHoliday ("24-MAR-2034", "ARS"); - - lh.addStaticHoliday ("06-APR-2034", "ARS"); - - lh.addStaticHoliday ("07-APR-2034", "ARS"); - - lh.addStaticHoliday ("01-MAY-2034", "ARS"); - - lh.addStaticHoliday ("25-MAY-2034", "ARS"); - - lh.addStaticHoliday ("19-JUN-2034", "ARS"); - - lh.addStaticHoliday ("21-AUG-2034", "ARS"); - - lh.addStaticHoliday ("16-OCT-2034", "ARS"); - - lh.addStaticHoliday ("06-NOV-2034", "ARS"); - - lh.addStaticHoliday ("08-DEC-2034", "ARS"); - - lh.addStaticHoliday ("25-DEC-2034", "ARS"); - - lh.addStaticHoliday ("01-JAN-2035", "ARS"); - - lh.addStaticHoliday ("22-MAR-2035", "ARS"); - - lh.addStaticHoliday ("23-MAR-2035", "ARS"); - - lh.addStaticHoliday ("02-APR-2035", "ARS"); - - lh.addStaticHoliday ("01-MAY-2035", "ARS"); - - lh.addStaticHoliday ("25-MAY-2035", "ARS"); - - lh.addStaticHoliday ("18-JUN-2035", "ARS"); - - lh.addStaticHoliday ("09-JUL-2035", "ARS"); - - lh.addStaticHoliday ("20-AUG-2035", "ARS"); - - lh.addStaticHoliday ("15-OCT-2035", "ARS"); - - lh.addStaticHoliday ("06-NOV-2035", "ARS"); - - lh.addStaticHoliday ("25-DEC-2035", "ARS"); - - lh.addStaticHoliday ("01-JAN-2036", "ARS"); - - lh.addStaticHoliday ("24-MAR-2036", "ARS"); - - lh.addStaticHoliday ("02-APR-2036", "ARS"); - - lh.addStaticHoliday ("10-APR-2036", "ARS"); - - lh.addStaticHoliday ("11-APR-2036", "ARS"); - - lh.addStaticHoliday ("01-MAY-2036", "ARS"); - - lh.addStaticHoliday ("16-JUN-2036", "ARS"); - - lh.addStaticHoliday ("09-JUL-2036", "ARS"); - - lh.addStaticHoliday ("18-AUG-2036", "ARS"); - - lh.addStaticHoliday ("13-OCT-2036", "ARS"); - - lh.addStaticHoliday ("06-NOV-2036", "ARS"); - - lh.addStaticHoliday ("08-DEC-2036", "ARS"); - - lh.addStaticHoliday ("25-DEC-2036", "ARS"); - - lh.addStaticHoliday ("01-JAN-2037", "ARS"); - - lh.addStaticHoliday ("24-MAR-2037", "ARS"); - - lh.addStaticHoliday ("02-APR-2037", "ARS"); - - lh.addStaticHoliday ("03-APR-2037", "ARS"); - - lh.addStaticHoliday ("01-MAY-2037", "ARS"); - - lh.addStaticHoliday ("25-MAY-2037", "ARS"); - - lh.addStaticHoliday ("15-JUN-2037", "ARS"); - - lh.addStaticHoliday ("09-JUL-2037", "ARS"); - - lh.addStaticHoliday ("17-AUG-2037", "ARS"); - - lh.addStaticHoliday ("12-OCT-2037", "ARS"); - - lh.addStaticHoliday ("06-NOV-2037", "ARS"); - - lh.addStaticHoliday ("08-DEC-2037", "ARS"); - - lh.addStaticHoliday ("25-DEC-2037", "ARS"); - - lh.addStaticHoliday ("01-JAN-2038", "ARS"); - - lh.addStaticHoliday ("24-MAR-2038", "ARS"); - - lh.addStaticHoliday ("02-APR-2038", "ARS"); - - lh.addStaticHoliday ("22-APR-2038", "ARS"); - - lh.addStaticHoliday ("23-APR-2038", "ARS"); - - lh.addStaticHoliday ("25-MAY-2038", "ARS"); - - lh.addStaticHoliday ("21-JUN-2038", "ARS"); - - lh.addStaticHoliday ("09-JUL-2038", "ARS"); - - lh.addStaticHoliday ("16-AUG-2038", "ARS"); - - lh.addStaticHoliday ("11-OCT-2038", "ARS"); - - lh.addStaticHoliday ("08-DEC-2038", "ARS"); - - lh.addStaticHoliday ("24-MAR-2039", "ARS"); - - lh.addStaticHoliday ("07-APR-2039", "ARS"); - - lh.addStaticHoliday ("08-APR-2039", "ARS"); - - lh.addStaticHoliday ("25-MAY-2039", "ARS"); - - lh.addStaticHoliday ("20-JUN-2039", "ARS"); - - lh.addStaticHoliday ("15-AUG-2039", "ARS"); - - lh.addStaticHoliday ("10-OCT-2039", "ARS"); - - lh.addStaticHoliday ("08-DEC-2039", "ARS"); - - lh.addStaticHoliday ("29-MAR-2040", "ARS"); - - lh.addStaticHoliday ("30-MAR-2040", "ARS"); - - lh.addStaticHoliday ("02-APR-2040", "ARS"); - - lh.addStaticHoliday ("01-MAY-2040", "ARS"); - - lh.addStaticHoliday ("25-MAY-2040", "ARS"); - - lh.addStaticHoliday ("18-JUN-2040", "ARS"); - - lh.addStaticHoliday ("09-JUL-2040", "ARS"); - - lh.addStaticHoliday ("20-AUG-2040", "ARS"); - - lh.addStaticHoliday ("15-OCT-2040", "ARS"); - - lh.addStaticHoliday ("06-NOV-2040", "ARS"); - - lh.addStaticHoliday ("25-DEC-2040", "ARS"); - - lh.addStaticHoliday ("01-JAN-2041", "ARS"); - - lh.addStaticHoliday ("02-APR-2041", "ARS"); - - lh.addStaticHoliday ("18-APR-2041", "ARS"); - - lh.addStaticHoliday ("19-APR-2041", "ARS"); - - lh.addStaticHoliday ("01-MAY-2041", "ARS"); - - lh.addStaticHoliday ("17-JUN-2041", "ARS"); - - lh.addStaticHoliday ("09-JUL-2041", "ARS"); - - lh.addStaticHoliday ("19-AUG-2041", "ARS"); - - lh.addStaticHoliday ("14-OCT-2041", "ARS"); - - lh.addStaticHoliday ("06-NOV-2041", "ARS"); - - lh.addStaticHoliday ("25-DEC-2041", "ARS"); - - lh.addStaticHoliday ("01-JAN-2042", "ARS"); - - lh.addStaticHoliday ("24-MAR-2042", "ARS"); - - lh.addStaticHoliday ("02-APR-2042", "ARS"); - - lh.addStaticHoliday ("03-APR-2042", "ARS"); - - lh.addStaticHoliday ("04-APR-2042", "ARS"); - - lh.addStaticHoliday ("01-MAY-2042", "ARS"); - - lh.addStaticHoliday ("16-JUN-2042", "ARS"); - - lh.addStaticHoliday ("09-JUL-2042", "ARS"); - - lh.addStaticHoliday ("18-AUG-2042", "ARS"); - - lh.addStaticHoliday ("13-OCT-2042", "ARS"); - - lh.addStaticHoliday ("06-NOV-2042", "ARS"); - - lh.addStaticHoliday ("08-DEC-2042", "ARS"); - - lh.addStaticHoliday ("25-DEC-2042", "ARS"); - - lh.addStaticHoliday ("01-JAN-2043", "ARS"); - - lh.addStaticHoliday ("24-MAR-2043", "ARS"); - - lh.addStaticHoliday ("26-MAR-2043", "ARS"); - - lh.addStaticHoliday ("27-MAR-2043", "ARS"); - - lh.addStaticHoliday ("02-APR-2043", "ARS"); - - lh.addStaticHoliday ("01-MAY-2043", "ARS"); - - lh.addStaticHoliday ("25-MAY-2043", "ARS"); - - lh.addStaticHoliday ("15-JUN-2043", "ARS"); - - lh.addStaticHoliday ("09-JUL-2043", "ARS"); - - lh.addStaticHoliday ("17-AUG-2043", "ARS"); - - lh.addStaticHoliday ("12-OCT-2043", "ARS"); - - lh.addStaticHoliday ("06-NOV-2043", "ARS"); - - lh.addStaticHoliday ("08-DEC-2043", "ARS"); - - lh.addStaticHoliday ("25-DEC-2043", "ARS"); - - lh.addStaticHoliday ("01-JAN-2044", "ARS"); - - lh.addStaticHoliday ("24-MAR-2044", "ARS"); - - lh.addStaticHoliday ("14-APR-2044", "ARS"); - - lh.addStaticHoliday ("15-APR-2044", "ARS"); - - lh.addStaticHoliday ("25-MAY-2044", "ARS"); - - lh.addStaticHoliday ("20-JUN-2044", "ARS"); - - lh.addStaticHoliday ("15-AUG-2044", "ARS"); - - lh.addStaticHoliday ("10-OCT-2044", "ARS"); - - lh.addStaticHoliday ("08-DEC-2044", "ARS"); - - lh.addStaticHoliday ("24-MAR-2045", "ARS"); - - lh.addStaticHoliday ("06-APR-2045", "ARS"); - - lh.addStaticHoliday ("07-APR-2045", "ARS"); - - lh.addStaticHoliday ("01-MAY-2045", "ARS"); - - lh.addStaticHoliday ("25-MAY-2045", "ARS"); - - lh.addStaticHoliday ("19-JUN-2045", "ARS"); - - lh.addStaticHoliday ("21-AUG-2045", "ARS"); - - lh.addStaticHoliday ("16-OCT-2045", "ARS"); - - lh.addStaticHoliday ("06-NOV-2045", "ARS"); - - lh.addStaticHoliday ("08-DEC-2045", "ARS"); - - lh.addStaticHoliday ("25-DEC-2045", "ARS"); - - lh.addStaticHoliday ("01-JAN-2046", "ARS"); - - lh.addStaticHoliday ("22-MAR-2046", "ARS"); - - lh.addStaticHoliday ("23-MAR-2046", "ARS"); - - lh.addStaticHoliday ("02-APR-2046", "ARS"); - - lh.addStaticHoliday ("01-MAY-2046", "ARS"); - - lh.addStaticHoliday ("25-MAY-2046", "ARS"); - - lh.addStaticHoliday ("18-JUN-2046", "ARS"); - - lh.addStaticHoliday ("09-JUL-2046", "ARS"); - - lh.addStaticHoliday ("20-AUG-2046", "ARS"); - - lh.addStaticHoliday ("15-OCT-2046", "ARS"); - - lh.addStaticHoliday ("06-NOV-2046", "ARS"); - - lh.addStaticHoliday ("25-DEC-2046", "ARS"); - - lh.addStaticHoliday ("01-JAN-2047", "ARS"); - - lh.addStaticHoliday ("02-APR-2047", "ARS"); - - lh.addStaticHoliday ("11-APR-2047", "ARS"); - - lh.addStaticHoliday ("12-APR-2047", "ARS"); - - lh.addStaticHoliday ("01-MAY-2047", "ARS"); - - lh.addStaticHoliday ("17-JUN-2047", "ARS"); - - lh.addStaticHoliday ("09-JUL-2047", "ARS"); - - lh.addStaticHoliday ("19-AUG-2047", "ARS"); - - lh.addStaticHoliday ("14-OCT-2047", "ARS"); - - lh.addStaticHoliday ("06-NOV-2047", "ARS"); - - lh.addStaticHoliday ("25-DEC-2047", "ARS"); - - lh.addStaticHoliday ("01-JAN-2048", "ARS"); - - lh.addStaticHoliday ("24-MAR-2048", "ARS"); - - lh.addStaticHoliday ("02-APR-2048", "ARS"); - - lh.addStaticHoliday ("03-APR-2048", "ARS"); - - lh.addStaticHoliday ("01-MAY-2048", "ARS"); - - lh.addStaticHoliday ("25-MAY-2048", "ARS"); - - lh.addStaticHoliday ("15-JUN-2048", "ARS"); - - lh.addStaticHoliday ("09-JUL-2048", "ARS"); - - lh.addStaticHoliday ("17-AUG-2048", "ARS"); - - lh.addStaticHoliday ("12-OCT-2048", "ARS"); - - lh.addStaticHoliday ("06-NOV-2048", "ARS"); - - lh.addStaticHoliday ("08-DEC-2048", "ARS"); - - lh.addStaticHoliday ("25-DEC-2048", "ARS"); - - lh.addStaticHoliday ("01-JAN-2049", "ARS"); - - lh.addStaticHoliday ("24-MAR-2049", "ARS"); - - lh.addStaticHoliday ("02-APR-2049", "ARS"); - - lh.addStaticHoliday ("15-APR-2049", "ARS"); - - lh.addStaticHoliday ("16-APR-2049", "ARS"); - - lh.addStaticHoliday ("25-MAY-2049", "ARS"); - - lh.addStaticHoliday ("21-JUN-2049", "ARS"); - - lh.addStaticHoliday ("09-JUL-2049", "ARS"); - - lh.addStaticHoliday ("16-AUG-2049", "ARS"); - - lh.addStaticHoliday ("11-OCT-2049", "ARS"); - - lh.addStaticHoliday ("08-DEC-2049", "ARS"); - - lh.addStaticHoliday ("24-MAR-2050", "ARS"); - - lh.addStaticHoliday ("07-APR-2050", "ARS"); - - lh.addStaticHoliday ("08-APR-2050", "ARS"); - - lh.addStaticHoliday ("25-MAY-2050", "ARS"); - - lh.addStaticHoliday ("20-JUN-2050", "ARS"); - - lh.addStaticHoliday ("15-AUG-2050", "ARS"); - - lh.addStaticHoliday ("10-OCT-2050", "ARS"); - - lh.addStaticHoliday ("08-DEC-2050", "ARS"); - - lh.addStaticHoliday ("24-MAR-2051", "ARS"); - - lh.addStaticHoliday ("30-MAR-2051", "ARS"); - - lh.addStaticHoliday ("31-MAR-2051", "ARS"); - - lh.addStaticHoliday ("01-MAY-2051", "ARS"); - - lh.addStaticHoliday ("25-MAY-2051", "ARS"); - - lh.addStaticHoliday ("19-JUN-2051", "ARS"); - - lh.addStaticHoliday ("21-AUG-2051", "ARS"); - - lh.addStaticHoliday ("16-OCT-2051", "ARS"); - - lh.addStaticHoliday ("06-NOV-2051", "ARS"); - - lh.addStaticHoliday ("08-DEC-2051", "ARS"); - - lh.addStaticHoliday ("25-DEC-2051", "ARS"); - - lh.addStaticHoliday ("01-JAN-2052", "ARS"); - - lh.addStaticHoliday ("02-APR-2052", "ARS"); - - lh.addStaticHoliday ("18-APR-2052", "ARS"); - - lh.addStaticHoliday ("19-APR-2052", "ARS"); - - lh.addStaticHoliday ("01-MAY-2052", "ARS"); - - lh.addStaticHoliday ("17-JUN-2052", "ARS"); - - lh.addStaticHoliday ("09-JUL-2052", "ARS"); - - lh.addStaticHoliday ("19-AUG-2052", "ARS"); - - lh.addStaticHoliday ("14-OCT-2052", "ARS"); - - lh.addStaticHoliday ("06-NOV-2052", "ARS"); - - lh.addStaticHoliday ("25-DEC-2052", "ARS"); - - lh.addStaticHoliday ("01-JAN-2053", "ARS"); - - lh.addStaticHoliday ("24-MAR-2053", "ARS"); - - lh.addStaticHoliday ("02-APR-2053", "ARS"); - - lh.addStaticHoliday ("03-APR-2053", "ARS"); - - lh.addStaticHoliday ("04-APR-2053", "ARS"); - - lh.addStaticHoliday ("01-MAY-2053", "ARS"); - - lh.addStaticHoliday ("16-JUN-2053", "ARS"); - - lh.addStaticHoliday ("09-JUL-2053", "ARS"); - - lh.addStaticHoliday ("18-AUG-2053", "ARS"); - - lh.addStaticHoliday ("13-OCT-2053", "ARS"); - - lh.addStaticHoliday ("06-NOV-2053", "ARS"); - - lh.addStaticHoliday ("08-DEC-2053", "ARS"); - - lh.addStaticHoliday ("25-DEC-2053", "ARS"); - - lh.addStaticHoliday ("01-JAN-2054", "ARS"); - - lh.addStaticHoliday ("24-MAR-2054", "ARS"); - - lh.addStaticHoliday ("26-MAR-2054", "ARS"); - - lh.addStaticHoliday ("27-MAR-2054", "ARS"); - - lh.addStaticHoliday ("02-APR-2054", "ARS"); - - lh.addStaticHoliday ("01-MAY-2054", "ARS"); - - lh.addStaticHoliday ("25-MAY-2054", "ARS"); - - lh.addStaticHoliday ("15-JUN-2054", "ARS"); - - lh.addStaticHoliday ("09-JUL-2054", "ARS"); - - lh.addStaticHoliday ("17-AUG-2054", "ARS"); - - lh.addStaticHoliday ("12-OCT-2054", "ARS"); - - lh.addStaticHoliday ("06-NOV-2054", "ARS"); - - lh.addStaticHoliday ("08-DEC-2054", "ARS"); - - lh.addStaticHoliday ("25-DEC-2054", "ARS"); - - lh.addStaticHoliday ("01-JAN-2055", "ARS"); - - lh.addStaticHoliday ("24-MAR-2055", "ARS"); - - lh.addStaticHoliday ("02-APR-2055", "ARS"); - - lh.addStaticHoliday ("15-APR-2055", "ARS"); - - lh.addStaticHoliday ("16-APR-2055", "ARS"); - - lh.addStaticHoliday ("25-MAY-2055", "ARS"); - - lh.addStaticHoliday ("21-JUN-2055", "ARS"); - - lh.addStaticHoliday ("09-JUL-2055", "ARS"); - - lh.addStaticHoliday ("16-AUG-2055", "ARS"); - - lh.addStaticHoliday ("11-OCT-2055", "ARS"); - - lh.addStaticHoliday ("08-DEC-2055", "ARS"); - - lh.addStaticHoliday ("24-MAR-2056", "ARS"); - - lh.addStaticHoliday ("30-MAR-2056", "ARS"); - - lh.addStaticHoliday ("31-MAR-2056", "ARS"); - - lh.addStaticHoliday ("01-MAY-2056", "ARS"); - - lh.addStaticHoliday ("25-MAY-2056", "ARS"); - - lh.addStaticHoliday ("19-JUN-2056", "ARS"); - - lh.addStaticHoliday ("21-AUG-2056", "ARS"); - - lh.addStaticHoliday ("16-OCT-2056", "ARS"); - - lh.addStaticHoliday ("06-NOV-2056", "ARS"); - - lh.addStaticHoliday ("08-DEC-2056", "ARS"); - - lh.addStaticHoliday ("25-DEC-2056", "ARS"); - - lh.addStaticHoliday ("01-JAN-2057", "ARS"); - - lh.addStaticHoliday ("02-APR-2057", "ARS"); - - lh.addStaticHoliday ("19-APR-2057", "ARS"); - - lh.addStaticHoliday ("20-APR-2057", "ARS"); - - lh.addStaticHoliday ("01-MAY-2057", "ARS"); - - lh.addStaticHoliday ("25-MAY-2057", "ARS"); - - lh.addStaticHoliday ("18-JUN-2057", "ARS"); - - lh.addStaticHoliday ("09-JUL-2057", "ARS"); - - lh.addStaticHoliday ("20-AUG-2057", "ARS"); - - lh.addStaticHoliday ("15-OCT-2057", "ARS"); - - lh.addStaticHoliday ("06-NOV-2057", "ARS"); - - lh.addStaticHoliday ("25-DEC-2057", "ARS"); - - lh.addStaticHoliday ("01-JAN-2058", "ARS"); - - lh.addStaticHoliday ("02-APR-2058", "ARS"); - - lh.addStaticHoliday ("11-APR-2058", "ARS"); - - lh.addStaticHoliday ("12-APR-2058", "ARS"); - - lh.addStaticHoliday ("01-MAY-2058", "ARS"); - - lh.addStaticHoliday ("17-JUN-2058", "ARS"); - - lh.addStaticHoliday ("09-JUL-2058", "ARS"); - - lh.addStaticHoliday ("19-AUG-2058", "ARS"); - - lh.addStaticHoliday ("14-OCT-2058", "ARS"); - - lh.addStaticHoliday ("06-NOV-2058", "ARS"); - - lh.addStaticHoliday ("25-DEC-2058", "ARS"); - - lh.addStaticHoliday ("01-JAN-2059", "ARS"); - - lh.addStaticHoliday ("24-MAR-2059", "ARS"); - - lh.addStaticHoliday ("27-MAR-2059", "ARS"); - - lh.addStaticHoliday ("28-MAR-2059", "ARS"); - - lh.addStaticHoliday ("02-APR-2059", "ARS"); - - lh.addStaticHoliday ("01-MAY-2059", "ARS"); - - lh.addStaticHoliday ("16-JUN-2059", "ARS"); - - lh.addStaticHoliday ("09-JUL-2059", "ARS"); - - lh.addStaticHoliday ("18-AUG-2059", "ARS"); - - lh.addStaticHoliday ("13-OCT-2059", "ARS"); - - lh.addStaticHoliday ("06-NOV-2059", "ARS"); - - lh.addStaticHoliday ("08-DEC-2059", "ARS"); - - lh.addStaticHoliday ("25-DEC-2059", "ARS"); - - lh.addStaticHoliday ("01-JAN-2060", "ARS"); - - lh.addStaticHoliday ("24-MAR-2060", "ARS"); - - lh.addStaticHoliday ("02-APR-2060", "ARS"); - - lh.addStaticHoliday ("15-APR-2060", "ARS"); - - lh.addStaticHoliday ("16-APR-2060", "ARS"); - - lh.addStaticHoliday ("25-MAY-2060", "ARS"); - - lh.addStaticHoliday ("21-JUN-2060", "ARS"); - - lh.addStaticHoliday ("09-JUL-2060", "ARS"); - - lh.addStaticHoliday ("16-AUG-2060", "ARS"); - - lh.addStaticHoliday ("11-OCT-2060", "ARS"); - - lh.addStaticHoliday ("08-DEC-2060", "ARS"); - - lh.addStaticHoliday ("24-MAR-2061", "ARS"); - - lh.addStaticHoliday ("07-APR-2061", "ARS"); - - lh.addStaticHoliday ("08-APR-2061", "ARS"); - - lh.addStaticHoliday ("25-MAY-2061", "ARS"); - - lh.addStaticHoliday ("20-JUN-2061", "ARS"); - - lh.addStaticHoliday ("15-AUG-2061", "ARS"); - - lh.addStaticHoliday ("10-OCT-2061", "ARS"); - - lh.addStaticHoliday ("08-DEC-2061", "ARS"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/ARPHoliday.java b/org/drip/analytics/holset/ARPHoliday.java deleted file mode 100644 index 74610af..0000000 --- a/org/drip/analytics/holset/ARPHoliday.java +++ /dev/null @@ -1,727 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class ARPHoliday implements org.drip.analytics.holset.LocationHoliday { - public ARPHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "ARP"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("09-APR-1998", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-1998", "Liberation Day"); - - lh.addStaticHoliday ("08-JUN-1998", "Malvinas Islands Memorial Day Observed"); - - lh.addStaticHoliday ("15-JUN-1998", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-1998", "Independence Day"); - - lh.addStaticHoliday ("17-AUG-1998", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("12-OCT-1998", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-1998", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-1998", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-1999", "Liberation Day"); - - lh.addStaticHoliday ("14-JUN-1999", "Malvinas Islands Memorial Day Observed"); - - lh.addStaticHoliday ("21-JUN-1999", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-1999", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-1999", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("11-OCT-1999", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-1999", "Immaculate Conception"); - - lh.addStaticHoliday ("31-DEC-1999", "Last Weekday of the Year"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2000", "Liberation Day"); - - lh.addStaticHoliday ("19-JUN-2000", "Flag Day"); - - lh.addStaticHoliday ("21-AUG-2000", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("16-OCT-2000", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2000", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2000", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2001", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2001", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2001", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2001", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("15-OCT-2001", "Day of the Race Observed"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2001", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("10-JUN-2002", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("17-JUN-2002", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2002", "Independence Day"); - - lh.addStaticHoliday ("19-AUG-2002", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2002", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("09-JUN-2003", "Malvinas Islands Memorial Day Observed"); - - lh.addStaticHoliday ("16-JUN-2003", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2003", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-2003", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2003", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2004", "Liberation Day"); - - lh.addStaticHoliday ("14-JUN-2004", "Malvinas Islands Memorial Day Observed"); - - lh.addStaticHoliday ("21-JUN-2004", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2004", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2004", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("11-OCT-2004", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2004", "Immaculate Conception"); - - lh.addStaticHoliday ("31-DEC-2004", "Last Weekday of the Year"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2005", "Liberation Day"); - - lh.addStaticHoliday ("13-JUN-2005", "Malvinas Islands Memorial Day Observed"); - - lh.addStaticHoliday ("20-JUN-2005", "Flag Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("10-OCT-2005", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2005", "Immaculate Conception"); - - lh.addStaticHoliday ("30-DEC-2005", "Last Weekday of the Year"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2006", "Liberation Day"); - - lh.addStaticHoliday ("19-JUN-2006", "Flag Day"); - - lh.addStaticHoliday ("21-AUG-2006", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("16-OCT-2006", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2006", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2006", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2007", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2007", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2007", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2007", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("15-OCT-2007", "Day of the Race Observed"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2007", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("09-JUN-2008", "Malvinas Islands Memorial Day Observed"); - - lh.addStaticHoliday ("16-JUN-2008", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2008", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-2008", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2008", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2009", "Liberation Day"); - - lh.addStaticHoliday ("08-JUN-2009", "Malvinas Islands Memorial Day Observed"); - - lh.addStaticHoliday ("15-JUN-2009", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2009", "Independence Day"); - - lh.addStaticHoliday ("17-AUG-2009", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("12-OCT-2009", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2009", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2009", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2010", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2010", "Liberation Day"); - - lh.addStaticHoliday ("14-JUN-2010", "Malvinas Islands Memorial Day Observed"); - - lh.addStaticHoliday ("21-JUN-2010", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2010", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2010", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("11-OCT-2010", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2010", "Immaculate Conception"); - - lh.addStaticHoliday ("31-DEC-2010", "Last Weekday of the Year"); - - lh.addStaticHoliday ("21-APR-2011", "Holy Thursday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2011", "Liberation Day"); - - lh.addStaticHoliday ("13-JUN-2011", "Malvinas Islands Memorial Day Observed"); - - lh.addStaticHoliday ("20-JUN-2011", "Flag Day"); - - lh.addStaticHoliday ("15-AUG-2011", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("10-OCT-2011", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2011", "Immaculate Conception"); - - lh.addStaticHoliday ("30-DEC-2011", "Last Weekday of the Year"); - - lh.addStaticHoliday ("05-APR-2012", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2012", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2012", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2012", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2012", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("15-OCT-2012", "Day of the Race Observed"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2012", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2013", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("10-JUN-2013", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("17-JUN-2013", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2013", "Independence Day"); - - lh.addStaticHoliday ("19-AUG-2013", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2013", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("17-APR-2014", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("09-JUN-2014", "Malvinas Islands Memorial Day Observed"); - - lh.addStaticHoliday ("16-JUN-2014", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2014", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-2014", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("08-DEC-2014", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2014", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2015", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2015", "Liberation Day"); - - lh.addStaticHoliday ("08-JUN-2015", "Malvinas Islands Memorial Day Observed"); - - lh.addStaticHoliday ("15-JUN-2015", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2015", "Independence Day"); - - lh.addStaticHoliday ("17-AUG-2015", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("12-OCT-2015", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2015", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2015", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2016", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2016", "Liberation Day"); - - lh.addStaticHoliday ("13-JUN-2016", "Malvinas Islands Memorial Day Observed"); - - lh.addStaticHoliday ("20-JUN-2016", "Flag Day"); - - lh.addStaticHoliday ("15-AUG-2016", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("10-OCT-2016", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2016", "Immaculate Conception"); - - lh.addStaticHoliday ("30-DEC-2016", "Last Weekday of the Year"); - - lh.addStaticHoliday ("13-APR-2017", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2017", "Liberation Day"); - - lh.addStaticHoliday ("19-JUN-2017", "Flag Day"); - - lh.addStaticHoliday ("21-AUG-2017", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("16-OCT-2017", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2017", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2017", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2018", "Holy Thursday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2018", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2018", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2018", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2018", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("15-OCT-2018", "Day of the Race Observed"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2018", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2019", "Holy Thursday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("10-JUN-2019", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("17-JUN-2019", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2019", "Independence Day"); - - lh.addStaticHoliday ("19-AUG-2019", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2019", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2020", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2020", "Liberation Day"); - - lh.addStaticHoliday ("08-JUN-2020", "Malvinas Islands Memorial Day Observed"); - - lh.addStaticHoliday ("15-JUN-2020", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2020", "Independence Day"); - - lh.addStaticHoliday ("17-AUG-2020", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("12-OCT-2020", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2020", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2020", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2021", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2021", "Liberation Day"); - - lh.addStaticHoliday ("14-JUN-2021", "Malvinas Islands Memorial Day Observed"); - - lh.addStaticHoliday ("21-JUN-2021", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2021", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2021", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("11-OCT-2021", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2021", "Immaculate Conception"); - - lh.addStaticHoliday ("31-DEC-2021", "Last Weekday of the Year"); - - lh.addStaticHoliday ("14-APR-2022", "Holy Thursday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2022", "Liberation Day"); - - lh.addStaticHoliday ("13-JUN-2022", "Malvinas Islands Memorial Day Observed"); - - lh.addStaticHoliday ("20-JUN-2022", "Flag Day"); - - lh.addStaticHoliday ("15-AUG-2022", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("10-OCT-2022", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2022", "Immaculate Conception"); - - lh.addStaticHoliday ("30-DEC-2022", "Last Weekday of the Year"); - - lh.addStaticHoliday ("06-APR-2023", "Holy Thursday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2023", "Liberation Day"); - - lh.addStaticHoliday ("19-JUN-2023", "Flag Day"); - - lh.addStaticHoliday ("21-AUG-2023", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("16-OCT-2023", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2023", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2023", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2024", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("10-JUN-2024", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("17-JUN-2024", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2024", "Independence Day"); - - lh.addStaticHoliday ("19-AUG-2024", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2024", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("17-APR-2025", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("09-JUN-2025", "Malvinas Islands Memorial Day Observed"); - - lh.addStaticHoliday ("16-JUN-2025", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2025", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-2025", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("08-DEC-2025", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2025", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2026", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2026", "Liberation Day"); - - lh.addStaticHoliday ("08-JUN-2026", "Malvinas Islands Memorial Day Observed"); - - lh.addStaticHoliday ("15-JUN-2026", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2026", "Independence Day"); - - lh.addStaticHoliday ("17-AUG-2026", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("12-OCT-2026", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2026", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2026", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("25-MAR-2027", "Holy Thursday"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2027", "Liberation Day"); - - lh.addStaticHoliday ("14-JUN-2027", "Malvinas Islands Memorial Day Observed"); - - lh.addStaticHoliday ("21-JUN-2027", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2027", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2027", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("11-OCT-2027", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2027", "Immaculate Conception"); - - lh.addStaticHoliday ("31-DEC-2027", "Last Weekday of the Year"); - - lh.addStaticHoliday ("13-APR-2028", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2028", "Liberation Day"); - - lh.addStaticHoliday ("19-JUN-2028", "Flag Day"); - - lh.addStaticHoliday ("21-AUG-2028", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("16-OCT-2028", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-2028", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2028", "Last Weekday of the Year"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/ARSHoliday.java b/org/drip/analytics/holset/ARSHoliday.java deleted file mode 100644 index 3e6d631..0000000 --- a/org/drip/analytics/holset/ARSHoliday.java +++ /dev/null @@ -1,1501 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class ARSHoliday implements org.drip.analytics.holset.LocationHoliday { - public ARSHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "ARS"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-1999", "Liberation Day"); - - lh.addStaticHoliday ("14-JUN-1999", "Malvinas Islands Memorial Day Observed"); - - lh.addStaticHoliday ("21-JUN-1999", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-1999", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-1999", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("11-OCT-1999", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-1999", "Immaculate Conception"); - - lh.addStaticHoliday ("31-DEC-1999", "Last Weekday of the Year"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2000", "Liberation Day"); - - lh.addStaticHoliday ("19-JUN-2000", "Flag Day"); - - lh.addStaticHoliday ("21-AUG-2000", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("16-OCT-2000", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2000", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2000", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2000", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2001", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2001", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2001", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2001", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2001", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("08-OCT-2001", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2001", "Bank Holiday"); - - lh.addStaticHoliday ("21-DEC-2001", "Special Holiday"); - - lh.addStaticHoliday ("24-DEC-2001", "Special Holiday"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Special Holiday"); - - lh.addStaticHoliday ("31-DEC-2001", "Special Holiday"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2002", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("17-JUN-2002", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2002", "Independence Day"); - - lh.addStaticHoliday ("19-AUG-2002", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("31-MAR-2003", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("16-JUN-2003", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2003", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-2003", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("13-OCT-2003", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2003", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2003", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("05-APR-2004", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2004", "Liberation Day"); - - lh.addStaticHoliday ("21-JUN-2004", "Flag Day"); - - lh.addStaticHoliday ("02-JUL-2004", "Special Holiday"); - - lh.addStaticHoliday ("05-JUL-2004", "Special Holiday"); - - lh.addStaticHoliday ("09-JUL-2004", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2004", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("11-OCT-2004", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2004", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2005", "Liberation Day"); - - lh.addStaticHoliday ("20-JUN-2005", "Flag Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("10-OCT-2005", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2005", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2006", "Memorial Day"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2006", "Liberation Day"); - - lh.addStaticHoliday ("19-JUN-2006", "Flag Day"); - - lh.addStaticHoliday ("21-AUG-2006", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("16-OCT-2006", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2006", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2006", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2007", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2007", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2007", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2007", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2007", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("15-OCT-2007", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2007", "Bank Holiday"); - - lh.addStaticHoliday ("24-DEC-2007", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2007", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Memorial Day"); - - lh.addStaticHoliday ("02-APR-2008", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("16-JUN-2008", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2008", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-2008", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("06-NOV-2008", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2009", "Memorial Day"); - - lh.addStaticHoliday ("02-APR-2009", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2009", "Liberation Day"); - - lh.addStaticHoliday ("15-JUN-2009", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2009", "Independence Day"); - - lh.addStaticHoliday ("17-AUG-2009", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("12-OCT-2009", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2009", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2009", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2010", "Memorial Day"); - - lh.addStaticHoliday ("01-APR-2010", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2010", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("24-MAY-2010", "Bank Holiday"); - - lh.addStaticHoliday ("25-MAY-2010", "Liberation Day"); - - lh.addStaticHoliday ("21-JUN-2010", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2010", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2010", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("11-OCT-2010", "Day of the Race"); - - lh.addStaticHoliday ("27-OCT-2010", "Buenos Aires bank holidays"); - - lh.addStaticHoliday ("22-NOV-2010", "ARS holidays"); - - lh.addStaticHoliday ("08-DEC-2010", "Immaculate Conception"); - - lh.addStaticHoliday ("07-MAR-2011", "New Holiday"); - - lh.addStaticHoliday ("08-MAR-2011", "New Holiday"); - - lh.addStaticHoliday ("24-MAR-2011", "Memorial Day"); - - lh.addStaticHoliday ("25-MAR-2011", "Memorial Day"); - - lh.addStaticHoliday ("21-APR-2011", "Holy Thursday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2011", "Liberation Day"); - - lh.addStaticHoliday ("20-JUN-2011", "Flag Day"); - - lh.addStaticHoliday ("15-AUG-2011", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("22-AUG-2011", "Holiday"); - - lh.addStaticHoliday ("10-OCT-2011", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2011", "Immaculate Conception"); - - lh.addStaticHoliday ("09-DEC-2011", "New Holiday"); - - lh.addStaticHoliday ("02-APR-2012", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("05-APR-2012", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2012", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2012", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2012", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2012", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("15-OCT-2012", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2012", "Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "ARS"); - - lh.addStaticHoliday ("28-MAR-2013", "ARS"); - - lh.addStaticHoliday ("29-MAR-2013", "ARS"); - - lh.addStaticHoliday ("02-APR-2013", "ARS"); - - lh.addStaticHoliday ("01-MAY-2013", "ARS"); - - lh.addStaticHoliday ("17-JUN-2013", "ARS"); - - lh.addStaticHoliday ("09-JUL-2013", "ARS"); - - lh.addStaticHoliday ("19-AUG-2013", "ARS"); - - lh.addStaticHoliday ("14-OCT-2013", "ARS"); - - lh.addStaticHoliday ("06-NOV-2013", "ARS"); - - lh.addStaticHoliday ("25-DEC-2013", "ARS"); - - lh.addStaticHoliday ("01-JAN-2014", "ARS"); - - lh.addStaticHoliday ("24-MAR-2014", "ARS"); - - lh.addStaticHoliday ("02-APR-2014", "ARS"); - - lh.addStaticHoliday ("17-APR-2014", "ARS"); - - lh.addStaticHoliday ("18-APR-2014", "ARS"); - - lh.addStaticHoliday ("01-MAY-2014", "ARS"); - - lh.addStaticHoliday ("16-JUN-2014", "ARS"); - - lh.addStaticHoliday ("09-JUL-2014", "ARS"); - - lh.addStaticHoliday ("18-AUG-2014", "ARS"); - - lh.addStaticHoliday ("13-OCT-2014", "ARS"); - - lh.addStaticHoliday ("06-NOV-2014", "ARS"); - - lh.addStaticHoliday ("08-DEC-2014", "ARS"); - - lh.addStaticHoliday ("25-DEC-2014", "ARS"); - - lh.addStaticHoliday ("01-JAN-2015", "ARS"); - - lh.addStaticHoliday ("24-MAR-2015", "ARS"); - - lh.addStaticHoliday ("02-APR-2015", "ARS"); - - lh.addStaticHoliday ("03-APR-2015", "ARS"); - - lh.addStaticHoliday ("01-MAY-2015", "ARS"); - - lh.addStaticHoliday ("25-MAY-2015", "ARS"); - - lh.addStaticHoliday ("15-JUN-2015", "ARS"); - - lh.addStaticHoliday ("09-JUL-2015", "ARS"); - - lh.addStaticHoliday ("17-AUG-2015", "ARS"); - - lh.addStaticHoliday ("12-OCT-2015", "ARS"); - - lh.addStaticHoliday ("06-NOV-2015", "ARS"); - - lh.addStaticHoliday ("08-DEC-2015", "ARS"); - - lh.addStaticHoliday ("25-DEC-2015", "ARS"); - - lh.addStaticHoliday ("01-JAN-2016", "ARS"); - - lh.addStaticHoliday ("24-MAR-2016", "ARS"); - - lh.addStaticHoliday ("25-MAR-2016", "ARS"); - - lh.addStaticHoliday ("25-MAY-2016", "ARS"); - - lh.addStaticHoliday ("20-JUN-2016", "ARS"); - - lh.addStaticHoliday ("15-AUG-2016", "ARS"); - - lh.addStaticHoliday ("10-OCT-2016", "ARS"); - - lh.addStaticHoliday ("08-DEC-2016", "ARS"); - - lh.addStaticHoliday ("24-MAR-2017", "ARS"); - - lh.addStaticHoliday ("13-APR-2017", "ARS"); - - lh.addStaticHoliday ("14-APR-2017", "ARS"); - - lh.addStaticHoliday ("01-MAY-2017", "ARS"); - - lh.addStaticHoliday ("25-MAY-2017", "ARS"); - - lh.addStaticHoliday ("19-JUN-2017", "ARS"); - - lh.addStaticHoliday ("21-AUG-2017", "ARS"); - - lh.addStaticHoliday ("16-OCT-2017", "ARS"); - - lh.addStaticHoliday ("06-NOV-2017", "ARS"); - - lh.addStaticHoliday ("08-DEC-2017", "ARS"); - - lh.addStaticHoliday ("25-DEC-2017", "ARS"); - - lh.addStaticHoliday ("01-JAN-2018", "ARS"); - - lh.addStaticHoliday ("29-MAR-2018", "ARS"); - - lh.addStaticHoliday ("30-MAR-2018", "ARS"); - - lh.addStaticHoliday ("02-APR-2018", "ARS"); - - lh.addStaticHoliday ("01-MAY-2018", "ARS"); - - lh.addStaticHoliday ("25-MAY-2018", "ARS"); - - lh.addStaticHoliday ("18-JUN-2018", "ARS"); - - lh.addStaticHoliday ("09-JUL-2018", "ARS"); - - lh.addStaticHoliday ("20-AUG-2018", "ARS"); - - lh.addStaticHoliday ("15-OCT-2018", "ARS"); - - lh.addStaticHoliday ("06-NOV-2018", "ARS"); - - lh.addStaticHoliday ("25-DEC-2018", "ARS"); - - lh.addStaticHoliday ("01-JAN-2019", "ARS"); - - lh.addStaticHoliday ("02-APR-2019", "ARS"); - - lh.addStaticHoliday ("18-APR-2019", "ARS"); - - lh.addStaticHoliday ("19-APR-2019", "ARS"); - - lh.addStaticHoliday ("01-MAY-2019", "ARS"); - - lh.addStaticHoliday ("17-JUN-2019", "ARS"); - - lh.addStaticHoliday ("09-JUL-2019", "ARS"); - - lh.addStaticHoliday ("19-AUG-2019", "ARS"); - - lh.addStaticHoliday ("14-OCT-2019", "ARS"); - - lh.addStaticHoliday ("06-NOV-2019", "ARS"); - - lh.addStaticHoliday ("25-DEC-2019", "ARS"); - - lh.addStaticHoliday ("01-JAN-2020", "ARS"); - - lh.addStaticHoliday ("24-MAR-2020", "ARS"); - - lh.addStaticHoliday ("02-APR-2020", "ARS"); - - lh.addStaticHoliday ("09-APR-2020", "ARS"); - - lh.addStaticHoliday ("10-APR-2020", "ARS"); - - lh.addStaticHoliday ("01-MAY-2020", "ARS"); - - lh.addStaticHoliday ("25-MAY-2020", "ARS"); - - lh.addStaticHoliday ("15-JUN-2020", "ARS"); - - lh.addStaticHoliday ("09-JUL-2020", "ARS"); - - lh.addStaticHoliday ("17-AUG-2020", "ARS"); - - lh.addStaticHoliday ("12-OCT-2020", "ARS"); - - lh.addStaticHoliday ("06-NOV-2020", "ARS"); - - lh.addStaticHoliday ("08-DEC-2020", "ARS"); - - lh.addStaticHoliday ("25-DEC-2020", "ARS"); - - lh.addStaticHoliday ("01-JAN-2021", "ARS"); - - lh.addStaticHoliday ("24-MAR-2021", "ARS"); - - lh.addStaticHoliday ("01-APR-2021", "ARS"); - - lh.addStaticHoliday ("02-APR-2021", "ARS"); - - lh.addStaticHoliday ("25-MAY-2021", "ARS"); - - lh.addStaticHoliday ("21-JUN-2021", "ARS"); - - lh.addStaticHoliday ("09-JUL-2021", "ARS"); - - lh.addStaticHoliday ("16-AUG-2021", "ARS"); - - lh.addStaticHoliday ("11-OCT-2021", "ARS"); - - lh.addStaticHoliday ("08-DEC-2021", "ARS"); - - lh.addStaticHoliday ("24-MAR-2022", "ARS"); - - lh.addStaticHoliday ("14-APR-2022", "ARS"); - - lh.addStaticHoliday ("15-APR-2022", "ARS"); - - lh.addStaticHoliday ("25-MAY-2022", "ARS"); - - lh.addStaticHoliday ("20-JUN-2022", "ARS"); - - lh.addStaticHoliday ("15-AUG-2022", "ARS"); - - lh.addStaticHoliday ("10-OCT-2022", "ARS"); - - lh.addStaticHoliday ("08-DEC-2022", "ARS"); - - lh.addStaticHoliday ("24-MAR-2023", "ARS"); - - lh.addStaticHoliday ("06-APR-2023", "ARS"); - - lh.addStaticHoliday ("07-APR-2023", "ARS"); - - lh.addStaticHoliday ("01-MAY-2023", "ARS"); - - lh.addStaticHoliday ("25-MAY-2023", "ARS"); - - lh.addStaticHoliday ("19-JUN-2023", "ARS"); - - lh.addStaticHoliday ("21-AUG-2023", "ARS"); - - lh.addStaticHoliday ("16-OCT-2023", "ARS"); - - lh.addStaticHoliday ("06-NOV-2023", "ARS"); - - lh.addStaticHoliday ("08-DEC-2023", "ARS"); - - lh.addStaticHoliday ("25-DEC-2023", "ARS"); - - lh.addStaticHoliday ("01-JAN-2024", "ARS"); - - lh.addStaticHoliday ("28-MAR-2024", "ARS"); - - lh.addStaticHoliday ("29-MAR-2024", "ARS"); - - lh.addStaticHoliday ("02-APR-2024", "ARS"); - - lh.addStaticHoliday ("01-MAY-2024", "ARS"); - - lh.addStaticHoliday ("17-JUN-2024", "ARS"); - - lh.addStaticHoliday ("09-JUL-2024", "ARS"); - - lh.addStaticHoliday ("19-AUG-2024", "ARS"); - - lh.addStaticHoliday ("14-OCT-2024", "ARS"); - - lh.addStaticHoliday ("06-NOV-2024", "ARS"); - - lh.addStaticHoliday ("25-DEC-2024", "ARS"); - - lh.addStaticHoliday ("01-JAN-2025", "ARS"); - - lh.addStaticHoliday ("24-MAR-2025", "ARS"); - - lh.addStaticHoliday ("02-APR-2025", "ARS"); - - lh.addStaticHoliday ("17-APR-2025", "ARS"); - - lh.addStaticHoliday ("18-APR-2025", "ARS"); - - lh.addStaticHoliday ("01-MAY-2025", "ARS"); - - lh.addStaticHoliday ("16-JUN-2025", "ARS"); - - lh.addStaticHoliday ("09-JUL-2025", "ARS"); - - lh.addStaticHoliday ("18-AUG-2025", "ARS"); - - lh.addStaticHoliday ("13-OCT-2025", "ARS"); - - lh.addStaticHoliday ("06-NOV-2025", "ARS"); - - lh.addStaticHoliday ("08-DEC-2025", "ARS"); - - lh.addStaticHoliday ("25-DEC-2025", "ARS"); - - lh.addStaticHoliday ("01-JAN-2026", "ARS"); - - lh.addStaticHoliday ("24-MAR-2026", "ARS"); - - lh.addStaticHoliday ("02-APR-2026", "ARS"); - - lh.addStaticHoliday ("03-APR-2026", "ARS"); - - lh.addStaticHoliday ("01-MAY-2026", "ARS"); - - lh.addStaticHoliday ("25-MAY-2026", "ARS"); - - lh.addStaticHoliday ("15-JUN-2026", "ARS"); - - lh.addStaticHoliday ("09-JUL-2026", "ARS"); - - lh.addStaticHoliday ("17-AUG-2026", "ARS"); - - lh.addStaticHoliday ("12-OCT-2026", "ARS"); - - lh.addStaticHoliday ("06-NOV-2026", "ARS"); - - lh.addStaticHoliday ("08-DEC-2026", "ARS"); - - lh.addStaticHoliday ("25-DEC-2026", "ARS"); - - lh.addStaticHoliday ("01-JAN-2027", "ARS"); - - lh.addStaticHoliday ("24-MAR-2027", "ARS"); - - lh.addStaticHoliday ("25-MAR-2027", "ARS"); - - lh.addStaticHoliday ("26-MAR-2027", "ARS"); - - lh.addStaticHoliday ("02-APR-2027", "ARS"); - - lh.addStaticHoliday ("25-MAY-2027", "ARS"); - - lh.addStaticHoliday ("21-JUN-2027", "ARS"); - - lh.addStaticHoliday ("09-JUL-2027", "ARS"); - - lh.addStaticHoliday ("16-AUG-2027", "ARS"); - - lh.addStaticHoliday ("11-OCT-2027", "ARS"); - - lh.addStaticHoliday ("08-DEC-2027", "ARS"); - - lh.addStaticHoliday ("24-MAR-2028", "ARS"); - - lh.addStaticHoliday ("13-APR-2028", "ARS"); - - lh.addStaticHoliday ("14-APR-2028", "ARS"); - - lh.addStaticHoliday ("01-MAY-2028", "ARS"); - - lh.addStaticHoliday ("25-MAY-2028", "ARS"); - - lh.addStaticHoliday ("19-JUN-2028", "ARS"); - - lh.addStaticHoliday ("21-AUG-2028", "ARS"); - - lh.addStaticHoliday ("16-OCT-2028", "ARS"); - - lh.addStaticHoliday ("06-NOV-2028", "ARS"); - - lh.addStaticHoliday ("08-DEC-2028", "ARS"); - - lh.addStaticHoliday ("25-DEC-2028", "ARS"); - - lh.addStaticHoliday ("01-JAN-2029", "ARS"); - - lh.addStaticHoliday ("29-MAR-2029", "ARS"); - - lh.addStaticHoliday ("30-MAR-2029", "ARS"); - - lh.addStaticHoliday ("02-APR-2029", "ARS"); - - lh.addStaticHoliday ("01-MAY-2029", "ARS"); - - lh.addStaticHoliday ("25-MAY-2029", "ARS"); - - lh.addStaticHoliday ("18-JUN-2029", "ARS"); - - lh.addStaticHoliday ("09-JUL-2029", "ARS"); - - lh.addStaticHoliday ("20-AUG-2029", "ARS"); - - lh.addStaticHoliday ("15-OCT-2029", "ARS"); - - lh.addStaticHoliday ("06-NOV-2029", "ARS"); - - lh.addStaticHoliday ("25-DEC-2029", "ARS"); - - lh.addStaticHoliday ("01-JAN-2030", "ARS"); - - lh.addStaticHoliday ("02-APR-2030", "ARS"); - - lh.addStaticHoliday ("18-APR-2030", "ARS"); - - lh.addStaticHoliday ("19-APR-2030", "ARS"); - - lh.addStaticHoliday ("01-MAY-2030", "ARS"); - - lh.addStaticHoliday ("17-JUN-2030", "ARS"); - - lh.addStaticHoliday ("09-JUL-2030", "ARS"); - - lh.addStaticHoliday ("19-AUG-2030", "ARS"); - - lh.addStaticHoliday ("14-OCT-2030", "ARS"); - - lh.addStaticHoliday ("06-NOV-2030", "ARS"); - - lh.addStaticHoliday ("25-DEC-2030", "ARS"); - - lh.addStaticHoliday ("01-JAN-2031", "ARS"); - - lh.addStaticHoliday ("24-MAR-2031", "ARS"); - - lh.addStaticHoliday ("02-APR-2031", "ARS"); - - lh.addStaticHoliday ("10-APR-2031", "ARS"); - - lh.addStaticHoliday ("11-APR-2031", "ARS"); - - lh.addStaticHoliday ("01-MAY-2031", "ARS"); - - lh.addStaticHoliday ("16-JUN-2031", "ARS"); - - lh.addStaticHoliday ("09-JUL-2031", "ARS"); - - lh.addStaticHoliday ("18-AUG-2031", "ARS"); - - lh.addStaticHoliday ("13-OCT-2031", "ARS"); - - lh.addStaticHoliday ("06-NOV-2031", "ARS"); - - lh.addStaticHoliday ("08-DEC-2031", "ARS"); - - lh.addStaticHoliday ("25-DEC-2031", "ARS"); - - lh.addStaticHoliday ("01-JAN-2032", "ARS"); - - lh.addStaticHoliday ("24-MAR-2032", "ARS"); - - lh.addStaticHoliday ("25-MAR-2032", "ARS"); - - lh.addStaticHoliday ("26-MAR-2032", "ARS"); - - lh.addStaticHoliday ("02-APR-2032", "ARS"); - - lh.addStaticHoliday ("25-MAY-2032", "ARS"); - - lh.addStaticHoliday ("21-JUN-2032", "ARS"); - - lh.addStaticHoliday ("09-JUL-2032", "ARS"); - - lh.addStaticHoliday ("16-AUG-2032", "ARS"); - - lh.addStaticHoliday ("11-OCT-2032", "ARS"); - - lh.addStaticHoliday ("08-DEC-2032", "ARS"); - - lh.addStaticHoliday ("24-MAR-2033", "ARS"); - - lh.addStaticHoliday ("14-APR-2033", "ARS"); - - lh.addStaticHoliday ("15-APR-2033", "ARS"); - - lh.addStaticHoliday ("25-MAY-2033", "ARS"); - - lh.addStaticHoliday ("20-JUN-2033", "ARS"); - - lh.addStaticHoliday ("15-AUG-2033", "ARS"); - - lh.addStaticHoliday ("10-OCT-2033", "ARS"); - - lh.addStaticHoliday ("08-DEC-2033", "ARS"); - - lh.addStaticHoliday ("24-MAR-2034", "ARS"); - - lh.addStaticHoliday ("06-APR-2034", "ARS"); - - lh.addStaticHoliday ("07-APR-2034", "ARS"); - - lh.addStaticHoliday ("01-MAY-2034", "ARS"); - - lh.addStaticHoliday ("25-MAY-2034", "ARS"); - - lh.addStaticHoliday ("19-JUN-2034", "ARS"); - - lh.addStaticHoliday ("21-AUG-2034", "ARS"); - - lh.addStaticHoliday ("16-OCT-2034", "ARS"); - - lh.addStaticHoliday ("06-NOV-2034", "ARS"); - - lh.addStaticHoliday ("08-DEC-2034", "ARS"); - - lh.addStaticHoliday ("25-DEC-2034", "ARS"); - - lh.addStaticHoliday ("01-JAN-2035", "ARS"); - - lh.addStaticHoliday ("22-MAR-2035", "ARS"); - - lh.addStaticHoliday ("23-MAR-2035", "ARS"); - - lh.addStaticHoliday ("02-APR-2035", "ARS"); - - lh.addStaticHoliday ("01-MAY-2035", "ARS"); - - lh.addStaticHoliday ("25-MAY-2035", "ARS"); - - lh.addStaticHoliday ("18-JUN-2035", "ARS"); - - lh.addStaticHoliday ("09-JUL-2035", "ARS"); - - lh.addStaticHoliday ("20-AUG-2035", "ARS"); - - lh.addStaticHoliday ("15-OCT-2035", "ARS"); - - lh.addStaticHoliday ("06-NOV-2035", "ARS"); - - lh.addStaticHoliday ("25-DEC-2035", "ARS"); - - lh.addStaticHoliday ("01-JAN-2036", "ARS"); - - lh.addStaticHoliday ("24-MAR-2036", "ARS"); - - lh.addStaticHoliday ("02-APR-2036", "ARS"); - - lh.addStaticHoliday ("10-APR-2036", "ARS"); - - lh.addStaticHoliday ("11-APR-2036", "ARS"); - - lh.addStaticHoliday ("01-MAY-2036", "ARS"); - - lh.addStaticHoliday ("16-JUN-2036", "ARS"); - - lh.addStaticHoliday ("09-JUL-2036", "ARS"); - - lh.addStaticHoliday ("18-AUG-2036", "ARS"); - - lh.addStaticHoliday ("13-OCT-2036", "ARS"); - - lh.addStaticHoliday ("06-NOV-2036", "ARS"); - - lh.addStaticHoliday ("08-DEC-2036", "ARS"); - - lh.addStaticHoliday ("25-DEC-2036", "ARS"); - - lh.addStaticHoliday ("01-JAN-2037", "ARS"); - - lh.addStaticHoliday ("24-MAR-2037", "ARS"); - - lh.addStaticHoliday ("02-APR-2037", "ARS"); - - lh.addStaticHoliday ("03-APR-2037", "ARS"); - - lh.addStaticHoliday ("01-MAY-2037", "ARS"); - - lh.addStaticHoliday ("25-MAY-2037", "ARS"); - - lh.addStaticHoliday ("15-JUN-2037", "ARS"); - - lh.addStaticHoliday ("09-JUL-2037", "ARS"); - - lh.addStaticHoliday ("17-AUG-2037", "ARS"); - - lh.addStaticHoliday ("12-OCT-2037", "ARS"); - - lh.addStaticHoliday ("06-NOV-2037", "ARS"); - - lh.addStaticHoliday ("08-DEC-2037", "ARS"); - - lh.addStaticHoliday ("25-DEC-2037", "ARS"); - - lh.addStaticHoliday ("01-JAN-2038", "ARS"); - - lh.addStaticHoliday ("24-MAR-2038", "ARS"); - - lh.addStaticHoliday ("02-APR-2038", "ARS"); - - lh.addStaticHoliday ("22-APR-2038", "ARS"); - - lh.addStaticHoliday ("23-APR-2038", "ARS"); - - lh.addStaticHoliday ("25-MAY-2038", "ARS"); - - lh.addStaticHoliday ("21-JUN-2038", "ARS"); - - lh.addStaticHoliday ("09-JUL-2038", "ARS"); - - lh.addStaticHoliday ("16-AUG-2038", "ARS"); - - lh.addStaticHoliday ("11-OCT-2038", "ARS"); - - lh.addStaticHoliday ("08-DEC-2038", "ARS"); - - lh.addStaticHoliday ("24-MAR-2039", "ARS"); - - lh.addStaticHoliday ("07-APR-2039", "ARS"); - - lh.addStaticHoliday ("08-APR-2039", "ARS"); - - lh.addStaticHoliday ("25-MAY-2039", "ARS"); - - lh.addStaticHoliday ("20-JUN-2039", "ARS"); - - lh.addStaticHoliday ("15-AUG-2039", "ARS"); - - lh.addStaticHoliday ("10-OCT-2039", "ARS"); - - lh.addStaticHoliday ("08-DEC-2039", "ARS"); - - lh.addStaticHoliday ("29-MAR-2040", "ARS"); - - lh.addStaticHoliday ("30-MAR-2040", "ARS"); - - lh.addStaticHoliday ("02-APR-2040", "ARS"); - - lh.addStaticHoliday ("01-MAY-2040", "ARS"); - - lh.addStaticHoliday ("25-MAY-2040", "ARS"); - - lh.addStaticHoliday ("18-JUN-2040", "ARS"); - - lh.addStaticHoliday ("09-JUL-2040", "ARS"); - - lh.addStaticHoliday ("20-AUG-2040", "ARS"); - - lh.addStaticHoliday ("15-OCT-2040", "ARS"); - - lh.addStaticHoliday ("06-NOV-2040", "ARS"); - - lh.addStaticHoliday ("25-DEC-2040", "ARS"); - - lh.addStaticHoliday ("01-JAN-2041", "ARS"); - - lh.addStaticHoliday ("02-APR-2041", "ARS"); - - lh.addStaticHoliday ("18-APR-2041", "ARS"); - - lh.addStaticHoliday ("19-APR-2041", "ARS"); - - lh.addStaticHoliday ("01-MAY-2041", "ARS"); - - lh.addStaticHoliday ("17-JUN-2041", "ARS"); - - lh.addStaticHoliday ("09-JUL-2041", "ARS"); - - lh.addStaticHoliday ("19-AUG-2041", "ARS"); - - lh.addStaticHoliday ("14-OCT-2041", "ARS"); - - lh.addStaticHoliday ("06-NOV-2041", "ARS"); - - lh.addStaticHoliday ("25-DEC-2041", "ARS"); - - lh.addStaticHoliday ("01-JAN-2042", "ARS"); - - lh.addStaticHoliday ("24-MAR-2042", "ARS"); - - lh.addStaticHoliday ("02-APR-2042", "ARS"); - - lh.addStaticHoliday ("03-APR-2042", "ARS"); - - lh.addStaticHoliday ("04-APR-2042", "ARS"); - - lh.addStaticHoliday ("01-MAY-2042", "ARS"); - - lh.addStaticHoliday ("16-JUN-2042", "ARS"); - - lh.addStaticHoliday ("09-JUL-2042", "ARS"); - - lh.addStaticHoliday ("18-AUG-2042", "ARS"); - - lh.addStaticHoliday ("13-OCT-2042", "ARS"); - - lh.addStaticHoliday ("06-NOV-2042", "ARS"); - - lh.addStaticHoliday ("08-DEC-2042", "ARS"); - - lh.addStaticHoliday ("25-DEC-2042", "ARS"); - - lh.addStaticHoliday ("01-JAN-2043", "ARS"); - - lh.addStaticHoliday ("24-MAR-2043", "ARS"); - - lh.addStaticHoliday ("26-MAR-2043", "ARS"); - - lh.addStaticHoliday ("27-MAR-2043", "ARS"); - - lh.addStaticHoliday ("02-APR-2043", "ARS"); - - lh.addStaticHoliday ("01-MAY-2043", "ARS"); - - lh.addStaticHoliday ("25-MAY-2043", "ARS"); - - lh.addStaticHoliday ("15-JUN-2043", "ARS"); - - lh.addStaticHoliday ("09-JUL-2043", "ARS"); - - lh.addStaticHoliday ("17-AUG-2043", "ARS"); - - lh.addStaticHoliday ("12-OCT-2043", "ARS"); - - lh.addStaticHoliday ("06-NOV-2043", "ARS"); - - lh.addStaticHoliday ("08-DEC-2043", "ARS"); - - lh.addStaticHoliday ("25-DEC-2043", "ARS"); - - lh.addStaticHoliday ("01-JAN-2044", "ARS"); - - lh.addStaticHoliday ("24-MAR-2044", "ARS"); - - lh.addStaticHoliday ("14-APR-2044", "ARS"); - - lh.addStaticHoliday ("15-APR-2044", "ARS"); - - lh.addStaticHoliday ("25-MAY-2044", "ARS"); - - lh.addStaticHoliday ("20-JUN-2044", "ARS"); - - lh.addStaticHoliday ("15-AUG-2044", "ARS"); - - lh.addStaticHoliday ("10-OCT-2044", "ARS"); - - lh.addStaticHoliday ("08-DEC-2044", "ARS"); - - lh.addStaticHoliday ("24-MAR-2045", "ARS"); - - lh.addStaticHoliday ("06-APR-2045", "ARS"); - - lh.addStaticHoliday ("07-APR-2045", "ARS"); - - lh.addStaticHoliday ("01-MAY-2045", "ARS"); - - lh.addStaticHoliday ("25-MAY-2045", "ARS"); - - lh.addStaticHoliday ("19-JUN-2045", "ARS"); - - lh.addStaticHoliday ("21-AUG-2045", "ARS"); - - lh.addStaticHoliday ("16-OCT-2045", "ARS"); - - lh.addStaticHoliday ("06-NOV-2045", "ARS"); - - lh.addStaticHoliday ("08-DEC-2045", "ARS"); - - lh.addStaticHoliday ("25-DEC-2045", "ARS"); - - lh.addStaticHoliday ("01-JAN-2046", "ARS"); - - lh.addStaticHoliday ("22-MAR-2046", "ARS"); - - lh.addStaticHoliday ("23-MAR-2046", "ARS"); - - lh.addStaticHoliday ("02-APR-2046", "ARS"); - - lh.addStaticHoliday ("01-MAY-2046", "ARS"); - - lh.addStaticHoliday ("25-MAY-2046", "ARS"); - - lh.addStaticHoliday ("18-JUN-2046", "ARS"); - - lh.addStaticHoliday ("09-JUL-2046", "ARS"); - - lh.addStaticHoliday ("20-AUG-2046", "ARS"); - - lh.addStaticHoliday ("15-OCT-2046", "ARS"); - - lh.addStaticHoliday ("06-NOV-2046", "ARS"); - - lh.addStaticHoliday ("25-DEC-2046", "ARS"); - - lh.addStaticHoliday ("01-JAN-2047", "ARS"); - - lh.addStaticHoliday ("02-APR-2047", "ARS"); - - lh.addStaticHoliday ("11-APR-2047", "ARS"); - - lh.addStaticHoliday ("12-APR-2047", "ARS"); - - lh.addStaticHoliday ("01-MAY-2047", "ARS"); - - lh.addStaticHoliday ("17-JUN-2047", "ARS"); - - lh.addStaticHoliday ("09-JUL-2047", "ARS"); - - lh.addStaticHoliday ("19-AUG-2047", "ARS"); - - lh.addStaticHoliday ("14-OCT-2047", "ARS"); - - lh.addStaticHoliday ("06-NOV-2047", "ARS"); - - lh.addStaticHoliday ("25-DEC-2047", "ARS"); - - lh.addStaticHoliday ("01-JAN-2048", "ARS"); - - lh.addStaticHoliday ("24-MAR-2048", "ARS"); - - lh.addStaticHoliday ("02-APR-2048", "ARS"); - - lh.addStaticHoliday ("03-APR-2048", "ARS"); - - lh.addStaticHoliday ("01-MAY-2048", "ARS"); - - lh.addStaticHoliday ("25-MAY-2048", "ARS"); - - lh.addStaticHoliday ("15-JUN-2048", "ARS"); - - lh.addStaticHoliday ("09-JUL-2048", "ARS"); - - lh.addStaticHoliday ("17-AUG-2048", "ARS"); - - lh.addStaticHoliday ("12-OCT-2048", "ARS"); - - lh.addStaticHoliday ("06-NOV-2048", "ARS"); - - lh.addStaticHoliday ("08-DEC-2048", "ARS"); - - lh.addStaticHoliday ("25-DEC-2048", "ARS"); - - lh.addStaticHoliday ("01-JAN-2049", "ARS"); - - lh.addStaticHoliday ("24-MAR-2049", "ARS"); - - lh.addStaticHoliday ("02-APR-2049", "ARS"); - - lh.addStaticHoliday ("15-APR-2049", "ARS"); - - lh.addStaticHoliday ("16-APR-2049", "ARS"); - - lh.addStaticHoliday ("25-MAY-2049", "ARS"); - - lh.addStaticHoliday ("21-JUN-2049", "ARS"); - - lh.addStaticHoliday ("09-JUL-2049", "ARS"); - - lh.addStaticHoliday ("16-AUG-2049", "ARS"); - - lh.addStaticHoliday ("11-OCT-2049", "ARS"); - - lh.addStaticHoliday ("08-DEC-2049", "ARS"); - - lh.addStaticHoliday ("24-MAR-2050", "ARS"); - - lh.addStaticHoliday ("07-APR-2050", "ARS"); - - lh.addStaticHoliday ("08-APR-2050", "ARS"); - - lh.addStaticHoliday ("25-MAY-2050", "ARS"); - - lh.addStaticHoliday ("20-JUN-2050", "ARS"); - - lh.addStaticHoliday ("15-AUG-2050", "ARS"); - - lh.addStaticHoliday ("10-OCT-2050", "ARS"); - - lh.addStaticHoliday ("08-DEC-2050", "ARS"); - - lh.addStaticHoliday ("24-MAR-2051", "ARS"); - - lh.addStaticHoliday ("30-MAR-2051", "ARS"); - - lh.addStaticHoliday ("31-MAR-2051", "ARS"); - - lh.addStaticHoliday ("01-MAY-2051", "ARS"); - - lh.addStaticHoliday ("25-MAY-2051", "ARS"); - - lh.addStaticHoliday ("19-JUN-2051", "ARS"); - - lh.addStaticHoliday ("21-AUG-2051", "ARS"); - - lh.addStaticHoliday ("16-OCT-2051", "ARS"); - - lh.addStaticHoliday ("06-NOV-2051", "ARS"); - - lh.addStaticHoliday ("08-DEC-2051", "ARS"); - - lh.addStaticHoliday ("25-DEC-2051", "ARS"); - - lh.addStaticHoliday ("01-JAN-2052", "ARS"); - - lh.addStaticHoliday ("02-APR-2052", "ARS"); - - lh.addStaticHoliday ("18-APR-2052", "ARS"); - - lh.addStaticHoliday ("19-APR-2052", "ARS"); - - lh.addStaticHoliday ("01-MAY-2052", "ARS"); - - lh.addStaticHoliday ("17-JUN-2052", "ARS"); - - lh.addStaticHoliday ("09-JUL-2052", "ARS"); - - lh.addStaticHoliday ("19-AUG-2052", "ARS"); - - lh.addStaticHoliday ("14-OCT-2052", "ARS"); - - lh.addStaticHoliday ("06-NOV-2052", "ARS"); - - lh.addStaticHoliday ("25-DEC-2052", "ARS"); - - lh.addStaticHoliday ("01-JAN-2053", "ARS"); - - lh.addStaticHoliday ("24-MAR-2053", "ARS"); - - lh.addStaticHoliday ("02-APR-2053", "ARS"); - - lh.addStaticHoliday ("03-APR-2053", "ARS"); - - lh.addStaticHoliday ("04-APR-2053", "ARS"); - - lh.addStaticHoliday ("01-MAY-2053", "ARS"); - - lh.addStaticHoliday ("16-JUN-2053", "ARS"); - - lh.addStaticHoliday ("09-JUL-2053", "ARS"); - - lh.addStaticHoliday ("18-AUG-2053", "ARS"); - - lh.addStaticHoliday ("13-OCT-2053", "ARS"); - - lh.addStaticHoliday ("06-NOV-2053", "ARS"); - - lh.addStaticHoliday ("08-DEC-2053", "ARS"); - - lh.addStaticHoliday ("25-DEC-2053", "ARS"); - - lh.addStaticHoliday ("01-JAN-2054", "ARS"); - - lh.addStaticHoliday ("24-MAR-2054", "ARS"); - - lh.addStaticHoliday ("26-MAR-2054", "ARS"); - - lh.addStaticHoliday ("27-MAR-2054", "ARS"); - - lh.addStaticHoliday ("02-APR-2054", "ARS"); - - lh.addStaticHoliday ("01-MAY-2054", "ARS"); - - lh.addStaticHoliday ("25-MAY-2054", "ARS"); - - lh.addStaticHoliday ("15-JUN-2054", "ARS"); - - lh.addStaticHoliday ("09-JUL-2054", "ARS"); - - lh.addStaticHoliday ("17-AUG-2054", "ARS"); - - lh.addStaticHoliday ("12-OCT-2054", "ARS"); - - lh.addStaticHoliday ("06-NOV-2054", "ARS"); - - lh.addStaticHoliday ("08-DEC-2054", "ARS"); - - lh.addStaticHoliday ("25-DEC-2054", "ARS"); - - lh.addStaticHoliday ("01-JAN-2055", "ARS"); - - lh.addStaticHoliday ("24-MAR-2055", "ARS"); - - lh.addStaticHoliday ("02-APR-2055", "ARS"); - - lh.addStaticHoliday ("15-APR-2055", "ARS"); - - lh.addStaticHoliday ("16-APR-2055", "ARS"); - - lh.addStaticHoliday ("25-MAY-2055", "ARS"); - - lh.addStaticHoliday ("21-JUN-2055", "ARS"); - - lh.addStaticHoliday ("09-JUL-2055", "ARS"); - - lh.addStaticHoliday ("16-AUG-2055", "ARS"); - - lh.addStaticHoliday ("11-OCT-2055", "ARS"); - - lh.addStaticHoliday ("08-DEC-2055", "ARS"); - - lh.addStaticHoliday ("24-MAR-2056", "ARS"); - - lh.addStaticHoliday ("30-MAR-2056", "ARS"); - - lh.addStaticHoliday ("31-MAR-2056", "ARS"); - - lh.addStaticHoliday ("01-MAY-2056", "ARS"); - - lh.addStaticHoliday ("25-MAY-2056", "ARS"); - - lh.addStaticHoliday ("19-JUN-2056", "ARS"); - - lh.addStaticHoliday ("21-AUG-2056", "ARS"); - - lh.addStaticHoliday ("16-OCT-2056", "ARS"); - - lh.addStaticHoliday ("06-NOV-2056", "ARS"); - - lh.addStaticHoliday ("08-DEC-2056", "ARS"); - - lh.addStaticHoliday ("25-DEC-2056", "ARS"); - - lh.addStaticHoliday ("01-JAN-2057", "ARS"); - - lh.addStaticHoliday ("02-APR-2057", "ARS"); - - lh.addStaticHoliday ("19-APR-2057", "ARS"); - - lh.addStaticHoliday ("20-APR-2057", "ARS"); - - lh.addStaticHoliday ("01-MAY-2057", "ARS"); - - lh.addStaticHoliday ("25-MAY-2057", "ARS"); - - lh.addStaticHoliday ("18-JUN-2057", "ARS"); - - lh.addStaticHoliday ("09-JUL-2057", "ARS"); - - lh.addStaticHoliday ("20-AUG-2057", "ARS"); - - lh.addStaticHoliday ("15-OCT-2057", "ARS"); - - lh.addStaticHoliday ("06-NOV-2057", "ARS"); - - lh.addStaticHoliday ("25-DEC-2057", "ARS"); - - lh.addStaticHoliday ("01-JAN-2058", "ARS"); - - lh.addStaticHoliday ("02-APR-2058", "ARS"); - - lh.addStaticHoliday ("11-APR-2058", "ARS"); - - lh.addStaticHoliday ("12-APR-2058", "ARS"); - - lh.addStaticHoliday ("01-MAY-2058", "ARS"); - - lh.addStaticHoliday ("17-JUN-2058", "ARS"); - - lh.addStaticHoliday ("09-JUL-2058", "ARS"); - - lh.addStaticHoliday ("19-AUG-2058", "ARS"); - - lh.addStaticHoliday ("14-OCT-2058", "ARS"); - - lh.addStaticHoliday ("06-NOV-2058", "ARS"); - - lh.addStaticHoliday ("25-DEC-2058", "ARS"); - - lh.addStaticHoliday ("01-JAN-2059", "ARS"); - - lh.addStaticHoliday ("24-MAR-2059", "ARS"); - - lh.addStaticHoliday ("27-MAR-2059", "ARS"); - - lh.addStaticHoliday ("28-MAR-2059", "ARS"); - - lh.addStaticHoliday ("02-APR-2059", "ARS"); - - lh.addStaticHoliday ("01-MAY-2059", "ARS"); - - lh.addStaticHoliday ("16-JUN-2059", "ARS"); - - lh.addStaticHoliday ("09-JUL-2059", "ARS"); - - lh.addStaticHoliday ("18-AUG-2059", "ARS"); - - lh.addStaticHoliday ("13-OCT-2059", "ARS"); - - lh.addStaticHoliday ("06-NOV-2059", "ARS"); - - lh.addStaticHoliday ("08-DEC-2059", "ARS"); - - lh.addStaticHoliday ("25-DEC-2059", "ARS"); - - lh.addStaticHoliday ("01-JAN-2060", "ARS"); - - lh.addStaticHoliday ("24-MAR-2060", "ARS"); - - lh.addStaticHoliday ("02-APR-2060", "ARS"); - - lh.addStaticHoliday ("15-APR-2060", "ARS"); - - lh.addStaticHoliday ("16-APR-2060", "ARS"); - - lh.addStaticHoliday ("25-MAY-2060", "ARS"); - - lh.addStaticHoliday ("21-JUN-2060", "ARS"); - - lh.addStaticHoliday ("09-JUL-2060", "ARS"); - - lh.addStaticHoliday ("16-AUG-2060", "ARS"); - - lh.addStaticHoliday ("11-OCT-2060", "ARS"); - - lh.addStaticHoliday ("08-DEC-2060", "ARS"); - - lh.addStaticHoliday ("24-MAR-2061", "ARS"); - - lh.addStaticHoliday ("07-APR-2061", "ARS"); - - lh.addStaticHoliday ("08-APR-2061", "ARS"); - - lh.addStaticHoliday ("25-MAY-2061", "ARS"); - - lh.addStaticHoliday ("20-JUN-2061", "ARS"); - - lh.addStaticHoliday ("15-AUG-2061", "ARS"); - - lh.addStaticHoliday ("10-OCT-2061", "ARS"); - - lh.addStaticHoliday ("08-DEC-2061", "ARS"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/ATSHoliday.java b/org/drip/analytics/holset/ATSHoliday.java deleted file mode 100644 index ef67818..0000000 --- a/org/drip/analytics/holset/ATSHoliday.java +++ /dev/null @@ -1,749 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class ATSHoliday implements org.drip.analytics.holset.LocationHoliday { - public ATSHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "ATS"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1998", "Epiphany"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-1998", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-1998", "Whit Monday"); - - lh.addStaticHoliday ("11-JUN-1998", "Corpus Christi"); - - lh.addStaticHoliday ("26-OCT-1998", "National Holiday"); - - lh.addStaticHoliday ("08-DEC-1998", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-1998", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1999", "Epiphany"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-1999", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-1999", "Whit Monday"); - - lh.addStaticHoliday ("03-JUN-1999", "Corpus Christi"); - - lh.addStaticHoliday ("26-OCT-1999", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-1999", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-1999", "Christmas Eve"); - - lh.addStaticHoliday ("06-JAN-2000", "Epiphany"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("01-JUN-2000", "Ascension Day"); - - lh.addStaticHoliday ("12-JUN-2000", "Whit Monday"); - - lh.addStaticHoliday ("22-JUN-2000", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2000", "Assumption Day"); - - lh.addStaticHoliday ("26-OCT-2000", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2000", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2001", "Ascension Day"); - - lh.addStaticHoliday ("04-JUN-2001", "Whit Monday"); - - lh.addStaticHoliday ("14-JUN-2001", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2001", "Assumption Day"); - - lh.addStaticHoliday ("26-OCT-2001", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2001", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2002", "Ascension Day"); - - lh.addStaticHoliday ("20-MAY-2002", "Whit Monday"); - - lh.addStaticHoliday ("30-MAY-2002", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2002", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2002", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2003", "Epiphany"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2003", "Ascension Day"); - - lh.addStaticHoliday ("09-JUN-2003", "Whit Monday"); - - lh.addStaticHoliday ("19-JUN-2003", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2003", "Assumption Day"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2003", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2004", "Epiphany"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("20-MAY-2004", "Ascension Day"); - - lh.addStaticHoliday ("31-MAY-2004", "Whit Monday"); - - lh.addStaticHoliday ("10-JUN-2004", "Corpus Christi"); - - lh.addStaticHoliday ("26-OCT-2004", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2004", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2004", "Christmas Eve"); - - lh.addStaticHoliday ("06-JAN-2005", "Epiphany"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2005", "Ascension Day"); - - lh.addStaticHoliday ("16-MAY-2005", "Whit Monday"); - - lh.addStaticHoliday ("26-MAY-2005", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("26-OCT-2005", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2005", "Immaculate Conception"); - - lh.addStaticHoliday ("26-DEC-2005", "St. Stephens Day"); - - lh.addStaticHoliday ("06-JAN-2006", "Epiphany"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2006", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2006", "Whit Monday"); - - lh.addStaticHoliday ("15-JUN-2006", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2006", "Assumption Day"); - - lh.addStaticHoliday ("26-OCT-2006", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2006", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2007", "Ascension Day"); - - lh.addStaticHoliday ("28-MAY-2007", "Whit Monday"); - - lh.addStaticHoliday ("07-JUN-2007", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2007", "Assumption Day"); - - lh.addStaticHoliday ("26-OCT-2007", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2007", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("12-MAY-2008", "Whit Monday"); - - lh.addStaticHoliday ("22-MAY-2008", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2008", "Assumption Day"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2008", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2009", "Epiphany"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2009", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-2009", "Whit Monday"); - - lh.addStaticHoliday ("11-JUN-2009", "Corpus Christi"); - - lh.addStaticHoliday ("26-OCT-2009", "National Holiday"); - - lh.addStaticHoliday ("08-DEC-2009", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2009", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2010", "Epiphany"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-2010", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-2010", "Whit Monday"); - - lh.addStaticHoliday ("03-JUN-2010", "Corpus Christi"); - - lh.addStaticHoliday ("26-OCT-2010", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2010", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2010", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2010", "Christmas Eve"); - - lh.addStaticHoliday ("06-JAN-2011", "Epiphany"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("02-JUN-2011", "Ascension Day"); - - lh.addStaticHoliday ("13-JUN-2011", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2011", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2011", "Assumption Day"); - - lh.addStaticHoliday ("26-OCT-2011", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2011", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2011", "Immaculate Conception"); - - lh.addStaticHoliday ("26-DEC-2011", "St. Stephens Day"); - - lh.addStaticHoliday ("06-JAN-2012", "Epiphany"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2012", "Ascension Day"); - - lh.addStaticHoliday ("28-MAY-2012", "Whit Monday"); - - lh.addStaticHoliday ("07-JUN-2012", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2012", "Assumption Day"); - - lh.addStaticHoliday ("26-OCT-2012", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2012", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2012", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2013", "Ascension Day"); - - lh.addStaticHoliday ("20-MAY-2013", "Whit Monday"); - - lh.addStaticHoliday ("30-MAY-2013", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2013", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2013", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2013", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2014", "Epiphany"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2014", "Ascension Day"); - - lh.addStaticHoliday ("09-JUN-2014", "Whit Monday"); - - lh.addStaticHoliday ("19-JUN-2014", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2014", "Assumption Day"); - - lh.addStaticHoliday ("08-DEC-2014", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2014", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2015", "Epiphany"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("14-MAY-2015", "Ascension Day"); - - lh.addStaticHoliday ("25-MAY-2015", "Whit Monday"); - - lh.addStaticHoliday ("04-JUN-2015", "Corpus Christi"); - - lh.addStaticHoliday ("26-OCT-2015", "National Holiday"); - - lh.addStaticHoliday ("08-DEC-2015", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2015", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2016", "Epiphany"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2016", "Ascension Day"); - - lh.addStaticHoliday ("16-MAY-2016", "Whit Monday"); - - lh.addStaticHoliday ("26-MAY-2016", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2016", "Assumption Day"); - - lh.addStaticHoliday ("26-OCT-2016", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2016", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2016", "Immaculate Conception"); - - lh.addStaticHoliday ("26-DEC-2016", "St. Stephens Day"); - - lh.addStaticHoliday ("06-JAN-2017", "Epiphany"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2017", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2017", "Whit Monday"); - - lh.addStaticHoliday ("15-JUN-2017", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2017", "Assumption Day"); - - lh.addStaticHoliday ("26-OCT-2017", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2017", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2017", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("10-MAY-2018", "Ascension Day"); - - lh.addStaticHoliday ("21-MAY-2018", "Whit Monday"); - - lh.addStaticHoliday ("31-MAY-2018", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2018", "Assumption Day"); - - lh.addStaticHoliday ("26-OCT-2018", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2018", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2018", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2019", "Ascension Day"); - - lh.addStaticHoliday ("10-JUN-2019", "Whit Monday"); - - lh.addStaticHoliday ("20-JUN-2019", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2019", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2019", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2019", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2020", "Epiphany"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2020", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-2020", "Whit Monday"); - - lh.addStaticHoliday ("11-JUN-2020", "Corpus Christi"); - - lh.addStaticHoliday ("26-OCT-2020", "National Holiday"); - - lh.addStaticHoliday ("08-DEC-2020", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2020", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2021", "Epiphany"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-2021", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-2021", "Whit Monday"); - - lh.addStaticHoliday ("03-JUN-2021", "Corpus Christi"); - - lh.addStaticHoliday ("26-OCT-2021", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2021", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2021", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2021", "Christmas Eve"); - - lh.addStaticHoliday ("06-JAN-2022", "Epiphany"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("26-MAY-2022", "Ascension Day"); - - lh.addStaticHoliday ("06-JUN-2022", "Whit Monday"); - - lh.addStaticHoliday ("16-JUN-2022", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2022", "Assumption Day"); - - lh.addStaticHoliday ("26-OCT-2022", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2022", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2022", "Immaculate Conception"); - - lh.addStaticHoliday ("26-DEC-2022", "St. Stephens Day"); - - lh.addStaticHoliday ("06-JAN-2023", "Epiphany"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("18-MAY-2023", "Ascension Day"); - - lh.addStaticHoliday ("29-MAY-2023", "Whit Monday"); - - lh.addStaticHoliday ("08-JUN-2023", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2023", "Assumption Day"); - - lh.addStaticHoliday ("26-OCT-2023", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2023", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2023", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2024", "Ascension Day"); - - lh.addStaticHoliday ("20-MAY-2024", "Whit Monday"); - - lh.addStaticHoliday ("30-MAY-2024", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2024", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2024", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2024", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2025", "Epiphany"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2025", "Ascension Day"); - - lh.addStaticHoliday ("09-JUN-2025", "Whit Monday"); - - lh.addStaticHoliday ("19-JUN-2025", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2025", "Assumption Day"); - - lh.addStaticHoliday ("08-DEC-2025", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2025", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2026", "Epiphany"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("14-MAY-2026", "Ascension Day"); - - lh.addStaticHoliday ("25-MAY-2026", "Whit Monday"); - - lh.addStaticHoliday ("04-JUN-2026", "Corpus Christi"); - - lh.addStaticHoliday ("26-OCT-2026", "National Holiday"); - - lh.addStaticHoliday ("08-DEC-2026", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2026", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2027", "Epiphany"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("06-MAY-2027", "Ascension Day"); - - lh.addStaticHoliday ("17-MAY-2027", "Whit Monday"); - - lh.addStaticHoliday ("27-MAY-2027", "Corpus Christi"); - - lh.addStaticHoliday ("26-OCT-2027", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2027", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2027", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2027", "Christmas Eve"); - - lh.addStaticHoliday ("06-JAN-2028", "Epiphany"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2028", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2028", "Whit Monday"); - - lh.addStaticHoliday ("15-JUN-2028", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2028", "Assumption Day"); - - lh.addStaticHoliday ("26-OCT-2028", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2028", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2028", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "St. Stephens Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/AUDHoliday.java b/org/drip/analytics/holset/AUDHoliday.java deleted file mode 100644 index 59d7dda..0000000 --- a/org/drip/analytics/holset/AUDHoliday.java +++ /dev/null @@ -1,1315 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class AUDHoliday implements org.drip.analytics.holset.LocationHoliday { - public AUDHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "AUD"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-1999", "Australia Day"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("26-APR-1999", "Anzac Day Observed"); - - lh.addStaticHoliday ("14-JUN-1999", "Queens Birthday"); - - lh.addStaticHoliday ("02-AUG-1999", "Bank Holiday"); - - lh.addStaticHoliday ("04-OCT-1999", "Labour Day"); - - lh.addStaticHoliday ("27-DEC-1999", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-1999", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2000", "New Years Day Observed"); - - lh.addStaticHoliday ("26-JAN-2000", "Australia Day"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2000", "Anzac Day"); - - lh.addStaticHoliday ("12-JUN-2000", "Queens Birthday"); - - lh.addStaticHoliday ("07-AUG-2000", "Bank Holiday"); - - lh.addStaticHoliday ("02-OCT-2000", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2001", "Australia Day"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2001", "Anzac Day"); - - lh.addStaticHoliday ("11-JUN-2001", "Queens Birthday"); - - lh.addStaticHoliday ("06-AUG-2001", "Bank Holiday"); - - lh.addStaticHoliday ("01-OCT-2001", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-2002", "Australia Day"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2002", "Anzac Day"); - - lh.addStaticHoliday ("10-JUN-2002", "Queens Birthday"); - - lh.addStaticHoliday ("05-AUG-2002", "Bank Holiday"); - - lh.addStaticHoliday ("07-OCT-2002", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("27-JAN-2003", "Australia Day Observed"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2003", "Anzac Day"); - - lh.addStaticHoliday ("09-JUN-2003", "Queens Birthday"); - - lh.addStaticHoliday ("04-AUG-2003", "Bank Holiday"); - - lh.addStaticHoliday ("06-OCT-2003", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2004", "Australia Day"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("14-JUN-2004", "Queens Birthday"); - - lh.addStaticHoliday ("02-AUG-2004", "Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2004", "Christmas Day"); - - lh.addStaticHoliday ("27-DEC-2004", "Boxing Day"); - - lh.addStaticHoliday ("28-DEC-2004", "National Holiday"); - - lh.addStaticHoliday ("03-JAN-2005", "New Years Day Observed"); - - lh.addStaticHoliday ("26-JAN-2005", "Australia Day"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2005", "Anzac Day"); - - lh.addStaticHoliday ("13-JUN-2005", "Queens Birthday"); - - lh.addStaticHoliday ("26-DEC-2005", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2005", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("26-JAN-2006", "Australia Day"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2006", "Anzac Day"); - - lh.addStaticHoliday ("12-JUN-2006", "Queens Birthday"); - - lh.addStaticHoliday ("07-AUG-2006", "Bank Holiday"); - - lh.addStaticHoliday ("02-OCT-2006", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2007", "Australia Day"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2007", "Anzac Day"); - - lh.addStaticHoliday ("11-JUN-2007", "Queens Birthday"); - - lh.addStaticHoliday ("06-AUG-2007", "Bank Holiday"); - - lh.addStaticHoliday ("07-SEP-2007", "Special Holiday"); - - lh.addStaticHoliday ("01-OCT-2007", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-2008", "Australia Day Observed"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2008", "Anzac Day"); - - lh.addStaticHoliday ("06-OCT-2008", "Labor Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2009", "Australia Day"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("08-JUN-2009", "Queens Birthday"); - - lh.addStaticHoliday ("03-AUG-2009", "Bank Holiday"); - - lh.addStaticHoliday ("05-OCT-2009", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2009", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2010", "Australia Day"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("26-APR-2010", "Anzac Day Observed"); - - lh.addStaticHoliday ("14-JUN-2010", "Queens Birthday"); - - lh.addStaticHoliday ("02-AUG-2010", "Bank Holiday"); - - lh.addStaticHoliday ("04-OCT-2010", "Labour Day"); - - lh.addStaticHoliday ("27-DEC-2010", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2010", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2011", "New Years Day Observed"); - - lh.addStaticHoliday ("26-JAN-2011", "Australia Day"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("26-APR-2011", "Anzac Day Observed"); - - lh.addStaticHoliday ("13-JUN-2011", "Queens Birthday"); - - lh.addStaticHoliday ("01-AUG-2011", "Bank Holiday"); - - lh.addStaticHoliday ("03-OCT-2011", "Labour Day"); - - lh.addStaticHoliday ("26-DEC-2011", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2011", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("26-JAN-2012", "Australia Day"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2012", "Anzac Day"); - - lh.addStaticHoliday ("11-JUN-2012", "Queens Birthday"); - - lh.addStaticHoliday ("06-AUG-2012", "Bank Holiday"); - - lh.addStaticHoliday ("01-OCT-2012", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-2013", "Australia Day Observed"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2013", "Anzac Day"); - - lh.addStaticHoliday ("10-JUN-2013", "Queens Birthday"); - - lh.addStaticHoliday ("05-AUG-2013", "Bank Holiday"); - - lh.addStaticHoliday ("07-OCT-2013", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("27-JAN-2014", "Australia Day Observed"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2014", "Anzac Day"); - - lh.addStaticHoliday ("09-JUN-2014", "Queens Birthday"); - - lh.addStaticHoliday ("04-AUG-2014", "Bank Holiday"); - - lh.addStaticHoliday ("06-OCT-2014", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2015", "Australia Day"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("08-JUN-2015", "Queens Birthday"); - - lh.addStaticHoliday ("03-AUG-2015", "Bank Holiday"); - - lh.addStaticHoliday ("05-OCT-2015", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2015", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2016", "Australia Day"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2016", "Anzac Day"); - - lh.addStaticHoliday ("13-JUN-2016", "Queens Birthday"); - - lh.addStaticHoliday ("01-AUG-2016", "Bank Holiday"); - - lh.addStaticHoliday ("03-OCT-2016", "Labour Day"); - - lh.addStaticHoliday ("26-DEC-2016", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2016", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("26-JAN-2017", "Australia Day"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2017", "Anzac Day"); - - lh.addStaticHoliday ("12-JUN-2017", "Queens Birthday"); - - lh.addStaticHoliday ("07-AUG-2017", "Bank Holiday"); - - lh.addStaticHoliday ("02-OCT-2017", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2018", "Australia Day"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2018", "Anzac Day"); - - lh.addStaticHoliday ("11-JUN-2018", "Queens Birthday"); - - lh.addStaticHoliday ("06-AUG-2018", "Bank Holiday"); - - lh.addStaticHoliday ("01-OCT-2018", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-2019", "Australia Day Observed"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2019", "Anzac Day"); - - lh.addStaticHoliday ("10-JUN-2019", "Queens Birthday"); - - lh.addStaticHoliday ("05-AUG-2019", "Bank Holiday"); - - lh.addStaticHoliday ("07-OCT-2019", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("27-JAN-2020", "Australia Day Observed"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("08-JUN-2020", "Queens Birthday"); - - lh.addStaticHoliday ("03-AUG-2020", "Bank Holiday"); - - lh.addStaticHoliday ("05-OCT-2020", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2020", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2021", "Australia Day"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("26-APR-2021", "Anzac Day Observed"); - - lh.addStaticHoliday ("14-JUN-2021", "Queens Birthday"); - - lh.addStaticHoliday ("02-AUG-2021", "Bank Holiday"); - - lh.addStaticHoliday ("04-OCT-2021", "Labour Day"); - - lh.addStaticHoliday ("27-DEC-2021", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2021", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2022", "New Years Day Observed"); - - lh.addStaticHoliday ("26-JAN-2022", "Australia Day"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2022", "Anzac Day"); - - lh.addStaticHoliday ("13-JUN-2022", "Queens Birthday"); - - lh.addStaticHoliday ("01-AUG-2022", "Bank Holiday"); - - lh.addStaticHoliday ("03-OCT-2022", "Labour Day"); - - lh.addStaticHoliday ("26-DEC-2022", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2022", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("26-JAN-2023", "Australia Day"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2023", "Anzac Day"); - - lh.addStaticHoliday ("12-JUN-2023", "Queens Birthday"); - - lh.addStaticHoliday ("07-AUG-2023", "Bank Holiday"); - - lh.addStaticHoliday ("02-OCT-2023", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2024", "Australia Day"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2024", "Anzac Day"); - - lh.addStaticHoliday ("10-JUN-2024", "Queens Birthday"); - - lh.addStaticHoliday ("05-AUG-2024", "Bank Holiday"); - - lh.addStaticHoliday ("07-OCT-2024", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("27-JAN-2025", "Australia Day Observed"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2025", "Anzac Day"); - - lh.addStaticHoliday ("09-JUN-2025", "Queens Birthday"); - - lh.addStaticHoliday ("04-AUG-2025", "Bank Holiday"); - - lh.addStaticHoliday ("06-OCT-2025", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2026", "Australia Day"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("08-JUN-2026", "Queens Birthday"); - - lh.addStaticHoliday ("03-AUG-2026", "Bank Holiday"); - - lh.addStaticHoliday ("05-OCT-2026", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2026", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2027", "Australia Day"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("26-APR-2027", "Anzac Day Observed"); - - lh.addStaticHoliday ("14-JUN-2027", "Queens Birthday"); - - lh.addStaticHoliday ("02-AUG-2027", "Bank Holiday"); - - lh.addStaticHoliday ("04-OCT-2027", "Labour Day"); - - lh.addStaticHoliday ("27-DEC-2027", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2027", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2028", "New Years Day Observed"); - - lh.addStaticHoliday ("26-JAN-2028", "Australia Day"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2028", "Anzac Day"); - - lh.addStaticHoliday ("12-JUN-2028", "Queens Birthday"); - - lh.addStaticHoliday ("07-AUG-2028", "Bank Holiday"); - - lh.addStaticHoliday ("02-OCT-2028", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2029", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2029", "Australia Day"); - - lh.addStaticHoliday ("30-MAR-2029", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2029", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2029", "Anzac Day"); - - lh.addStaticHoliday ("11-JUN-2029", "Queens Birthday"); - - lh.addStaticHoliday ("06-AUG-2029", "Bank Holiday"); - - lh.addStaticHoliday ("01-OCT-2029", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2029", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2029", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2030", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-2030", "Australia Day Observed"); - - lh.addStaticHoliday ("19-APR-2030", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2030", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2030", "Anzac Day"); - - lh.addStaticHoliday ("10-JUN-2030", "Queens Birthday"); - - lh.addStaticHoliday ("05-AUG-2030", "Bank Holiday"); - - lh.addStaticHoliday ("07-OCT-2030", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2030", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2030", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2031", "New Years Day"); - - lh.addStaticHoliday ("27-JAN-2031", "Australia Day Observed"); - - lh.addStaticHoliday ("11-APR-2031", "Good Friday"); - - lh.addStaticHoliday ("14-APR-2031", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2031", "Anzac Day"); - - lh.addStaticHoliday ("09-JUN-2031", "Queens Birthday"); - - lh.addStaticHoliday ("04-AUG-2031", "Bank Holiday"); - - lh.addStaticHoliday ("06-OCT-2031", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2031", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2031", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2032", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2032", "Australia Day"); - - lh.addStaticHoliday ("26-MAR-2032", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2032", "Easter Monday"); - - lh.addStaticHoliday ("26-APR-2032", "Anzac Day Observed"); - - lh.addStaticHoliday ("14-JUN-2032", "Queens Birthday"); - - lh.addStaticHoliday ("02-AUG-2032", "Bank Holiday"); - - lh.addStaticHoliday ("04-OCT-2032", "Labour Day"); - - lh.addStaticHoliday ("27-DEC-2032", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2032", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2033", "New Years Day Observed"); - - lh.addStaticHoliday ("26-JAN-2033", "Australia Day"); - - lh.addStaticHoliday ("15-APR-2033", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2033", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2033", "Anzac Day"); - - lh.addStaticHoliday ("13-JUN-2033", "Queens Birthday"); - - lh.addStaticHoliday ("01-AUG-2033", "Bank Holiday"); - - lh.addStaticHoliday ("03-OCT-2033", "Labour Day"); - - lh.addStaticHoliday ("26-DEC-2033", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2033", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2034", "New Years Day Observed"); - - lh.addStaticHoliday ("26-JAN-2034", "Australia Day"); - - lh.addStaticHoliday ("07-APR-2034", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2034", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2034", "Anzac Day"); - - lh.addStaticHoliday ("12-JUN-2034", "Queens Birthday"); - - lh.addStaticHoliday ("07-AUG-2034", "Bank Holiday"); - - lh.addStaticHoliday ("02-OCT-2034", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2034", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2034", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2035", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2035", "Australia Day"); - - lh.addStaticHoliday ("23-MAR-2035", "Good Friday"); - - lh.addStaticHoliday ("26-MAR-2035", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2035", "Anzac Day"); - - lh.addStaticHoliday ("11-JUN-2035", "Queens Birthday"); - - lh.addStaticHoliday ("06-AUG-2035", "Bank Holiday"); - - lh.addStaticHoliday ("01-OCT-2035", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2035", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2035", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2036", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-2036", "Australia Day Observed"); - - lh.addStaticHoliday ("11-APR-2036", "Good Friday"); - - lh.addStaticHoliday ("14-APR-2036", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2036", "Anzac Day"); - - lh.addStaticHoliday ("09-JUN-2036", "Queens Birthday"); - - lh.addStaticHoliday ("04-AUG-2036", "Bank Holiday"); - - lh.addStaticHoliday ("06-OCT-2036", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2036", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2036", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2037", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2037", "Australia Day"); - - lh.addStaticHoliday ("03-APR-2037", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2037", "Easter Monday"); - - lh.addStaticHoliday ("08-JUN-2037", "Queens Birthday"); - - lh.addStaticHoliday ("03-AUG-2037", "Bank Holiday"); - - lh.addStaticHoliday ("05-OCT-2037", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2037", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2037", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2038", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2038", "Australia Day"); - - lh.addStaticHoliday ("23-APR-2038", "Good Friday"); - - lh.addStaticHoliday ("26-APR-2038", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-2038", "Anzac Day Observed"); - - lh.addStaticHoliday ("14-JUN-2038", "Queens Birthday"); - - lh.addStaticHoliday ("02-AUG-2038", "Bank Holiday"); - - lh.addStaticHoliday ("04-OCT-2038", "Labour Day"); - - lh.addStaticHoliday ("27-DEC-2038", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2038", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2039", "New Years Day Observed"); - - lh.addStaticHoliday ("26-JAN-2039", "Australia Day"); - - lh.addStaticHoliday ("08-APR-2039", "Good Friday"); - - lh.addStaticHoliday ("11-APR-2039", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2039", "Anzac Day"); - - lh.addStaticHoliday ("13-JUN-2039", "Queens Birthday"); - - lh.addStaticHoliday ("01-AUG-2039", "Bank Holiday"); - - lh.addStaticHoliday ("03-OCT-2039", "Labour Day"); - - lh.addStaticHoliday ("26-DEC-2039", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2039", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2040", "New Years Day Observed"); - - lh.addStaticHoliday ("26-JAN-2040", "Australia Day"); - - lh.addStaticHoliday ("30-MAR-2040", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2040", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2040", "Anzac Day"); - - lh.addStaticHoliday ("11-JUN-2040", "Queens Birthday"); - - lh.addStaticHoliday ("06-AUG-2040", "Bank Holiday"); - - lh.addStaticHoliday ("01-OCT-2040", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2040", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2040", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2041", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-2041", "Australia Day Observed"); - - lh.addStaticHoliday ("19-APR-2041", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2041", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2041", "Anzac Day"); - - lh.addStaticHoliday ("10-JUN-2041", "Queens Birthday"); - - lh.addStaticHoliday ("05-AUG-2041", "Bank Holiday"); - - lh.addStaticHoliday ("07-OCT-2041", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2041", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2041", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2042", "New Years Day"); - - lh.addStaticHoliday ("27-JAN-2042", "Australia Day Observed"); - - lh.addStaticHoliday ("04-APR-2042", "Good Friday"); - - lh.addStaticHoliday ("07-APR-2042", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2042", "Anzac Day"); - - lh.addStaticHoliday ("09-JUN-2042", "Queens Birthday"); - - lh.addStaticHoliday ("04-AUG-2042", "Bank Holiday"); - - lh.addStaticHoliday ("06-OCT-2042", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2042", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2042", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2043", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2043", "Australia Day"); - - lh.addStaticHoliday ("27-MAR-2043", "Good Friday"); - - lh.addStaticHoliday ("30-MAR-2043", "Easter Monday"); - - lh.addStaticHoliday ("08-JUN-2043", "Queens Birthday"); - - lh.addStaticHoliday ("03-AUG-2043", "Bank Holiday"); - - lh.addStaticHoliday ("05-OCT-2043", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2043", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2043", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2044", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2044", "Australia Day"); - - lh.addStaticHoliday ("15-APR-2044", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2044", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2044", "Anzac Day"); - - lh.addStaticHoliday ("13-JUN-2044", "Queens Birthday"); - - lh.addStaticHoliday ("01-AUG-2044", "Bank Holiday"); - - lh.addStaticHoliday ("03-OCT-2044", "Labour Day"); - - lh.addStaticHoliday ("26-DEC-2044", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2044", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2045", "New Years Day Observed"); - - lh.addStaticHoliday ("26-JAN-2045", "Australia Day"); - - lh.addStaticHoliday ("07-APR-2045", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2045", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2045", "Anzac Day"); - - lh.addStaticHoliday ("12-JUN-2045", "Queens Birthday"); - - lh.addStaticHoliday ("07-AUG-2045", "Bank Holiday"); - - lh.addStaticHoliday ("02-OCT-2045", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2045", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2045", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2046", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2046", "Australia Day"); - - lh.addStaticHoliday ("23-MAR-2046", "Good Friday"); - - lh.addStaticHoliday ("26-MAR-2046", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2046", "Anzac Day"); - - lh.addStaticHoliday ("11-JUN-2046", "Queens Birthday"); - - lh.addStaticHoliday ("06-AUG-2046", "Bank Holiday"); - - lh.addStaticHoliday ("01-OCT-2046", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2046", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2046", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2047", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-2047", "Australia Day Observed"); - - lh.addStaticHoliday ("12-APR-2047", "Good Friday"); - - lh.addStaticHoliday ("15-APR-2047", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2047", "Anzac Day"); - - lh.addStaticHoliday ("10-JUN-2047", "Queens Birthday"); - - lh.addStaticHoliday ("05-AUG-2047", "Bank Holiday"); - - lh.addStaticHoliday ("07-OCT-2047", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2047", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2047", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2048", "New Years Day"); - - lh.addStaticHoliday ("27-JAN-2048", "Australia Day Observed"); - - lh.addStaticHoliday ("03-APR-2048", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2048", "Easter Monday"); - - lh.addStaticHoliday ("08-JUN-2048", "Queens Birthday"); - - lh.addStaticHoliday ("03-AUG-2048", "Bank Holiday"); - - lh.addStaticHoliday ("05-OCT-2048", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2048", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2048", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2049", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2049", "Australia Day"); - - lh.addStaticHoliday ("16-APR-2049", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2049", "Easter Monday"); - - lh.addStaticHoliday ("26-APR-2049", "Anzac Day Observed"); - - lh.addStaticHoliday ("14-JUN-2049", "Queens Birthday"); - - lh.addStaticHoliday ("02-AUG-2049", "Bank Holiday"); - - lh.addStaticHoliday ("04-OCT-2049", "Labour Day"); - - lh.addStaticHoliday ("27-DEC-2049", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2049", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2050", "New Years Day Observed"); - - lh.addStaticHoliday ("26-JAN-2050", "Australia Day"); - - lh.addStaticHoliday ("08-APR-2050", "Good Friday"); - - lh.addStaticHoliday ("11-APR-2050", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2050", "Anzac Day"); - - lh.addStaticHoliday ("13-JUN-2050", "Queens Birthday"); - - lh.addStaticHoliday ("01-AUG-2050", "Bank Holiday"); - - lh.addStaticHoliday ("03-OCT-2050", "Labour Day"); - - lh.addStaticHoliday ("26-DEC-2050", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2050", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2051", "New Years Day Observed"); - - lh.addStaticHoliday ("26-JAN-2051", "Australia Day"); - - lh.addStaticHoliday ("31-MAR-2051", "Good Friday"); - - lh.addStaticHoliday ("03-APR-2051", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2051", "Anzac Day"); - - lh.addStaticHoliday ("12-JUN-2051", "Queens Birthday"); - - lh.addStaticHoliday ("07-AUG-2051", "Bank Holiday"); - - lh.addStaticHoliday ("02-OCT-2051", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2051", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2051", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2052", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2052", "Australia Day"); - - lh.addStaticHoliday ("19-APR-2052", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2052", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2052", "Anzac Day"); - - lh.addStaticHoliday ("10-JUN-2052", "Queens Birthday"); - - lh.addStaticHoliday ("05-AUG-2052", "Bank Holiday"); - - lh.addStaticHoliday ("07-OCT-2052", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2052", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2052", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2053", "New Years Day"); - - lh.addStaticHoliday ("27-JAN-2053", "Australia Day Observed"); - - lh.addStaticHoliday ("04-APR-2053", "Good Friday"); - - lh.addStaticHoliday ("07-APR-2053", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2053", "Anzac Day"); - - lh.addStaticHoliday ("09-JUN-2053", "Queens Birthday"); - - lh.addStaticHoliday ("04-AUG-2053", "Bank Holiday"); - - lh.addStaticHoliday ("06-OCT-2053", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2053", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2053", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2054", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2054", "Australia Day"); - - lh.addStaticHoliday ("27-MAR-2054", "Good Friday"); - - lh.addStaticHoliday ("30-MAR-2054", "Easter Monday"); - - lh.addStaticHoliday ("08-JUN-2054", "Queens Birthday"); - - lh.addStaticHoliday ("03-AUG-2054", "Bank Holiday"); - - lh.addStaticHoliday ("05-OCT-2054", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2054", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2054", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2055", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2055", "Australia Day"); - - lh.addStaticHoliday ("16-APR-2055", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2055", "Easter Monday"); - - lh.addStaticHoliday ("26-APR-2055", "Anzac Day Observed"); - - lh.addStaticHoliday ("14-JUN-2055", "Queens Birthday"); - - lh.addStaticHoliday ("02-AUG-2055", "Bank Holiday"); - - lh.addStaticHoliday ("04-OCT-2055", "Labour Day"); - - lh.addStaticHoliday ("27-DEC-2055", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2055", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2056", "New Years Day Observed"); - - lh.addStaticHoliday ("26-JAN-2056", "Australia Day"); - - lh.addStaticHoliday ("31-MAR-2056", "Good Friday"); - - lh.addStaticHoliday ("03-APR-2056", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2056", "Anzac Day"); - - lh.addStaticHoliday ("12-JUN-2056", "Queens Birthday"); - - lh.addStaticHoliday ("07-AUG-2056", "Bank Holiday"); - - lh.addStaticHoliday ("02-OCT-2056", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2056", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2056", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2057", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2057", "Australia Day"); - - lh.addStaticHoliday ("20-APR-2057", "Good Friday"); - - lh.addStaticHoliday ("23-APR-2057", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2057", "Anzac Day"); - - lh.addStaticHoliday ("11-JUN-2057", "Queens Birthday"); - - lh.addStaticHoliday ("06-AUG-2057", "Bank Holiday"); - - lh.addStaticHoliday ("01-OCT-2057", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2057", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2057", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2058", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-2058", "Australia Day Observed"); - - lh.addStaticHoliday ("12-APR-2058", "Good Friday"); - - lh.addStaticHoliday ("15-APR-2058", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2058", "Anzac Day"); - - lh.addStaticHoliday ("10-JUN-2058", "Queens Birthday"); - - lh.addStaticHoliday ("05-AUG-2058", "Bank Holiday"); - - lh.addStaticHoliday ("07-OCT-2058", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2058", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2058", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2059", "New Years Day"); - - lh.addStaticHoliday ("27-JAN-2059", "Australia Day Observed"); - - lh.addStaticHoliday ("28-MAR-2059", "Good Friday"); - - lh.addStaticHoliday ("31-MAR-2059", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2059", "Anzac Day"); - - lh.addStaticHoliday ("09-JUN-2059", "Queens Birthday"); - - lh.addStaticHoliday ("04-AUG-2059", "Bank Holiday"); - - lh.addStaticHoliday ("06-OCT-2059", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2059", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2059", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2060", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2060", "Australia Day"); - - lh.addStaticHoliday ("16-APR-2060", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2060", "Easter Monday"); - - lh.addStaticHoliday ("26-APR-2060", "Anzac Day Observed"); - - lh.addStaticHoliday ("14-JUN-2060", "Queens Birthday"); - - lh.addStaticHoliday ("02-AUG-2060", "Bank Holiday"); - - lh.addStaticHoliday ("04-OCT-2060", "Labour Day"); - - lh.addStaticHoliday ("27-DEC-2060", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2060", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2061", "New Years Day Observed"); - - lh.addStaticHoliday ("26-JAN-2061", "Australia Day"); - - lh.addStaticHoliday ("08-APR-2061", "Good Friday"); - - lh.addStaticHoliday ("11-APR-2061", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2061", "Anzac Day"); - - lh.addStaticHoliday ("13-JUN-2061", "Queens Birthday"); - - lh.addStaticHoliday ("01-AUG-2061", "Bank Holiday"); - - lh.addStaticHoliday ("03-OCT-2061", "Labour Day"); - - lh.addStaticHoliday ("26-DEC-2061", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2061", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2062", "New Years Day Observed"); - - lh.addStaticHoliday ("26-JAN-2062", "Australia Day"); - - lh.addStaticHoliday ("24-MAR-2062", "Good Friday"); - - lh.addStaticHoliday ("27-MAR-2062", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2062", "Anzac Day"); - - lh.addStaticHoliday ("12-JUN-2062", "Queens Birthday"); - - lh.addStaticHoliday ("07-AUG-2062", "Bank Holiday"); - - lh.addStaticHoliday ("02-OCT-2062", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2062", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2062", "Boxing Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/AZMHoliday.java b/org/drip/analytics/holset/AZMHoliday.java deleted file mode 100644 index 3a8a41c..0000000 --- a/org/drip/analytics/holset/AZMHoliday.java +++ /dev/null @@ -1,717 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class AZMHoliday implements org.drip.analytics.holset.LocationHoliday { - public AZMHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "AZM"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-1998", "Memorial Day"); - - lh.addStaticHoliday ("30-JAN-1998", "Ramazan Bayram"); - - lh.addStaticHoliday ("20-MAR-1998", "Nau-Ruz"); - - lh.addStaticHoliday ("07-APR-1998", "Gurban Bayram"); - - lh.addStaticHoliday ("28-MAY-1998", "Republic Day"); - - lh.addStaticHoliday ("15-JUN-1998", "Day of National Rescue"); - - lh.addStaticHoliday ("09-OCT-1998", "Armed Forces Day"); - - lh.addStaticHoliday ("12-NOV-1998", "Constitution Day"); - - lh.addStaticHoliday ("17-NOV-1998", "Day of National Revival"); - - lh.addStaticHoliday ("31-DEC-1998", "Day of National Revival"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-1999", "Ramazan Bayram"); - - lh.addStaticHoliday ("20-JAN-1999", "Memorial Day"); - - lh.addStaticHoliday ("08-MAR-1999", "Womens Day"); - - lh.addStaticHoliday ("28-MAY-1999", "Republic Day"); - - lh.addStaticHoliday ("15-JUN-1999", "Day of National Rescue"); - - lh.addStaticHoliday ("18-OCT-1999", "Independence Day"); - - lh.addStaticHoliday ("12-NOV-1999", "Constitution Day"); - - lh.addStaticHoliday ("17-NOV-1999", "Day of National Revival"); - - lh.addStaticHoliday ("31-DEC-1999", "Day of National Revival"); - - lh.addStaticHoliday ("20-JAN-2000", "Memorial Day"); - - lh.addStaticHoliday ("08-MAR-2000", "Womens Day"); - - lh.addStaticHoliday ("16-MAR-2000", "Gurban Bayram"); - - lh.addStaticHoliday ("20-MAR-2000", "Nau-Ruz"); - - lh.addStaticHoliday ("21-MAR-2000", "Nau-Ruz"); - - lh.addStaticHoliday ("09-MAY-2000", "Victory Day"); - - lh.addStaticHoliday ("15-JUN-2000", "Day of National Rescue"); - - lh.addStaticHoliday ("09-OCT-2000", "Armed Forces Day"); - - lh.addStaticHoliday ("18-OCT-2000", "Independence Day"); - - lh.addStaticHoliday ("17-NOV-2000", "Day of National Revival"); - - lh.addStaticHoliday ("27-DEC-2000", "Ramazan Bayram"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("06-MAR-2001", "Gurban Bayram"); - - lh.addStaticHoliday ("08-MAR-2001", "Womens Day"); - - lh.addStaticHoliday ("20-MAR-2001", "Nau-Ruz"); - - lh.addStaticHoliday ("21-MAR-2001", "Nau-Ruz"); - - lh.addStaticHoliday ("09-MAY-2001", "Victory Day"); - - lh.addStaticHoliday ("28-MAY-2001", "Republic Day"); - - lh.addStaticHoliday ("15-JUN-2001", "Day of National Rescue"); - - lh.addStaticHoliday ("09-OCT-2001", "Armed Forces Day"); - - lh.addStaticHoliday ("18-OCT-2001", "Independence Day"); - - lh.addStaticHoliday ("12-NOV-2001", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2001", "Day of National Revival"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("08-MAR-2002", "Womens Day"); - - lh.addStaticHoliday ("20-MAR-2002", "Nau-Ruz"); - - lh.addStaticHoliday ("21-MAR-2002", "Nau-Ruz"); - - lh.addStaticHoliday ("09-MAY-2002", "Victory Day"); - - lh.addStaticHoliday ("28-MAY-2002", "Republic Day"); - - lh.addStaticHoliday ("09-OCT-2002", "Armed Forces Day"); - - lh.addStaticHoliday ("18-OCT-2002", "Independence Day"); - - lh.addStaticHoliday ("12-NOV-2002", "Constitution Day"); - - lh.addStaticHoliday ("06-DEC-2002", "Ramazan Bayram"); - - lh.addStaticHoliday ("31-DEC-2002", "Day of National Revival"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2003", "Memorial Day"); - - lh.addStaticHoliday ("12-FEB-2003", "Gurban Bayram"); - - lh.addStaticHoliday ("20-MAR-2003", "Nau-Ruz"); - - lh.addStaticHoliday ("21-MAR-2003", "Nau-Ruz"); - - lh.addStaticHoliday ("09-MAY-2003", "Victory Day"); - - lh.addStaticHoliday ("28-MAY-2003", "Republic Day"); - - lh.addStaticHoliday ("09-OCT-2003", "Armed Forces Day"); - - lh.addStaticHoliday ("12-NOV-2003", "Constitution Day"); - - lh.addStaticHoliday ("17-NOV-2003", "Day of National Revival"); - - lh.addStaticHoliday ("25-NOV-2003", "Ramazan Bayram"); - - lh.addStaticHoliday ("31-DEC-2003", "Day of National Revival"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2004", "Memorial Day"); - - lh.addStaticHoliday ("08-MAR-2004", "Womens Day"); - - lh.addStaticHoliday ("28-MAY-2004", "Republic Day"); - - lh.addStaticHoliday ("15-JUN-2004", "Day of National Rescue"); - - lh.addStaticHoliday ("18-OCT-2004", "Independence Day"); - - lh.addStaticHoliday ("12-NOV-2004", "Constitution Day"); - - lh.addStaticHoliday ("17-NOV-2004", "Day of National Revival"); - - lh.addStaticHoliday ("31-DEC-2004", "Day of National Revival"); - - lh.addStaticHoliday ("20-JAN-2005", "Memorial Day"); - - lh.addStaticHoliday ("21-JAN-2005", "Gurban Bayram"); - - lh.addStaticHoliday ("08-MAR-2005", "Womens Day"); - - lh.addStaticHoliday ("21-MAR-2005", "Nau-Ruz"); - - lh.addStaticHoliday ("09-MAY-2005", "Victory Day"); - - lh.addStaticHoliday ("15-JUN-2005", "Day of National Rescue"); - - lh.addStaticHoliday ("18-OCT-2005", "Independence Day"); - - lh.addStaticHoliday ("03-NOV-2005", "Ramazan Bayram"); - - lh.addStaticHoliday ("17-NOV-2005", "Day of National Revival"); - - lh.addStaticHoliday ("10-JAN-2006", "Gurban Bayram"); - - lh.addStaticHoliday ("20-JAN-2006", "Memorial Day"); - - lh.addStaticHoliday ("08-MAR-2006", "Womens Day"); - - lh.addStaticHoliday ("20-MAR-2006", "Nau-Ruz"); - - lh.addStaticHoliday ("21-MAR-2006", "Nau-Ruz"); - - lh.addStaticHoliday ("09-MAY-2006", "Victory Day"); - - lh.addStaticHoliday ("15-JUN-2006", "Day of National Rescue"); - - lh.addStaticHoliday ("09-OCT-2006", "Armed Forces Day"); - - lh.addStaticHoliday ("18-OCT-2006", "Independence Day"); - - lh.addStaticHoliday ("24-OCT-2006", "Ramazan Bayram"); - - lh.addStaticHoliday ("17-NOV-2006", "Day of National Revival"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("08-MAR-2007", "Womens Day"); - - lh.addStaticHoliday ("20-MAR-2007", "Nau-Ruz"); - - lh.addStaticHoliday ("21-MAR-2007", "Nau-Ruz"); - - lh.addStaticHoliday ("09-MAY-2007", "Victory Day"); - - lh.addStaticHoliday ("28-MAY-2007", "Republic Day"); - - lh.addStaticHoliday ("15-JUN-2007", "Day of National Rescue"); - - lh.addStaticHoliday ("09-OCT-2007", "Armed Forces Day"); - - lh.addStaticHoliday ("18-OCT-2007", "Independence Day"); - - lh.addStaticHoliday ("12-NOV-2007", "Constitution Day"); - - lh.addStaticHoliday ("20-DEC-2007", "Gurban Bayram"); - - lh.addStaticHoliday ("31-DEC-2007", "Day of National Revival"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("20-MAR-2008", "Nau-Ruz"); - - lh.addStaticHoliday ("21-MAR-2008", "Nau-Ruz"); - - lh.addStaticHoliday ("09-MAY-2008", "Victory Day"); - - lh.addStaticHoliday ("28-MAY-2008", "Republic Day"); - - lh.addStaticHoliday ("01-OCT-2008", "Ramazan Bayram"); - - lh.addStaticHoliday ("09-OCT-2008", "Armed Forces Day"); - - lh.addStaticHoliday ("12-NOV-2008", "Constitution Day"); - - lh.addStaticHoliday ("17-NOV-2008", "Day of National Revival"); - - lh.addStaticHoliday ("08-DEC-2008", "Gurban Bayram"); - - lh.addStaticHoliday ("31-DEC-2008", "Day of National Revival"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2009", "Memorial Day"); - - lh.addStaticHoliday ("20-MAR-2009", "Nau-Ruz"); - - lh.addStaticHoliday ("28-MAY-2009", "Republic Day"); - - lh.addStaticHoliday ("15-JUN-2009", "Day of National Rescue"); - - lh.addStaticHoliday ("09-OCT-2009", "Armed Forces Day"); - - lh.addStaticHoliday ("12-NOV-2009", "Constitution Day"); - - lh.addStaticHoliday ("17-NOV-2009", "Day of National Revival"); - - lh.addStaticHoliday ("27-NOV-2009", "Gurban Bayram"); - - lh.addStaticHoliday ("31-DEC-2009", "Day of National Revival"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2010", "Memorial Day"); - - lh.addStaticHoliday ("08-MAR-2010", "Womens Day"); - - lh.addStaticHoliday ("28-MAY-2010", "Republic Day"); - - lh.addStaticHoliday ("15-JUN-2010", "Day of National Rescue"); - - lh.addStaticHoliday ("10-SEP-2010", "Ramazan Bayram"); - - lh.addStaticHoliday ("18-OCT-2010", "Independence Day"); - - lh.addStaticHoliday ("12-NOV-2010", "Constitution Day"); - - lh.addStaticHoliday ("17-NOV-2010", "Day of National Revival"); - - lh.addStaticHoliday ("31-DEC-2010", "Day of National Revival"); - - lh.addStaticHoliday ("20-JAN-2011", "Memorial Day"); - - lh.addStaticHoliday ("08-MAR-2011", "Womens Day"); - - lh.addStaticHoliday ("21-MAR-2011", "Nau-Ruz"); - - lh.addStaticHoliday ("09-MAY-2011", "Victory Day"); - - lh.addStaticHoliday ("15-JUN-2011", "Day of National Rescue"); - - lh.addStaticHoliday ("30-AUG-2011", "Ramazan Bayram"); - - lh.addStaticHoliday ("18-OCT-2011", "Independence Day"); - - lh.addStaticHoliday ("17-NOV-2011", "Day of National Revival"); - - lh.addStaticHoliday ("20-JAN-2012", "Memorial Day"); - - lh.addStaticHoliday ("08-MAR-2012", "Womens Day"); - - lh.addStaticHoliday ("20-MAR-2012", "Nau-Ruz"); - - lh.addStaticHoliday ("21-MAR-2012", "Nau-Ruz"); - - lh.addStaticHoliday ("09-MAY-2012", "Victory Day"); - - lh.addStaticHoliday ("28-MAY-2012", "Republic Day"); - - lh.addStaticHoliday ("15-JUN-2012", "Day of National Rescue"); - - lh.addStaticHoliday ("09-OCT-2012", "Armed Forces Day"); - - lh.addStaticHoliday ("18-OCT-2012", "Independence Day"); - - lh.addStaticHoliday ("26-OCT-2012", "Gurban Bayram"); - - lh.addStaticHoliday ("12-NOV-2012", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2012", "Day of National Revival"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("08-MAR-2013", "Womens Day"); - - lh.addStaticHoliday ("20-MAR-2013", "Nau-Ruz"); - - lh.addStaticHoliday ("21-MAR-2013", "Nau-Ruz"); - - lh.addStaticHoliday ("09-MAY-2013", "Victory Day"); - - lh.addStaticHoliday ("28-MAY-2013", "Republic Day"); - - lh.addStaticHoliday ("08-AUG-2013", "Ramazan Bayram"); - - lh.addStaticHoliday ("09-OCT-2013", "Armed Forces Day"); - - lh.addStaticHoliday ("15-OCT-2013", "Gurban Bayram"); - - lh.addStaticHoliday ("18-OCT-2013", "Independence Day"); - - lh.addStaticHoliday ("12-NOV-2013", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2013", "Day of National Revival"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2014", "Memorial Day"); - - lh.addStaticHoliday ("20-MAR-2014", "Nau-Ruz"); - - lh.addStaticHoliday ("21-MAR-2014", "Nau-Ruz"); - - lh.addStaticHoliday ("09-MAY-2014", "Victory Day"); - - lh.addStaticHoliday ("28-MAY-2014", "Republic Day"); - - lh.addStaticHoliday ("29-JUL-2014", "Ramazan Bayram"); - - lh.addStaticHoliday ("09-OCT-2014", "Armed Forces Day"); - - lh.addStaticHoliday ("12-NOV-2014", "Constitution Day"); - - lh.addStaticHoliday ("17-NOV-2014", "Day of National Revival"); - - lh.addStaticHoliday ("31-DEC-2014", "Day of National Revival"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2015", "Memorial Day"); - - lh.addStaticHoliday ("20-MAR-2015", "Nau-Ruz"); - - lh.addStaticHoliday ("28-MAY-2015", "Republic Day"); - - lh.addStaticHoliday ("15-JUN-2015", "Day of National Rescue"); - - lh.addStaticHoliday ("24-SEP-2015", "Gurban Bayram"); - - lh.addStaticHoliday ("09-OCT-2015", "Armed Forces Day"); - - lh.addStaticHoliday ("12-NOV-2015", "Constitution Day"); - - lh.addStaticHoliday ("17-NOV-2015", "Day of National Revival"); - - lh.addStaticHoliday ("31-DEC-2015", "Day of National Revival"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2016", "Memorial Day"); - - lh.addStaticHoliday ("08-MAR-2016", "Womens Day"); - - lh.addStaticHoliday ("21-MAR-2016", "Nau-Ruz"); - - lh.addStaticHoliday ("09-MAY-2016", "Victory Day"); - - lh.addStaticHoliday ("15-JUN-2016", "Day of National Rescue"); - - lh.addStaticHoliday ("06-JUL-2016", "Ramazan Bayram"); - - lh.addStaticHoliday ("12-SEP-2016", "Gurban Bayram"); - - lh.addStaticHoliday ("18-OCT-2016", "Independence Day"); - - lh.addStaticHoliday ("17-NOV-2016", "Day of National Revival"); - - lh.addStaticHoliday ("20-JAN-2017", "Memorial Day"); - - lh.addStaticHoliday ("08-MAR-2017", "Womens Day"); - - lh.addStaticHoliday ("20-MAR-2017", "Nau-Ruz"); - - lh.addStaticHoliday ("21-MAR-2017", "Nau-Ruz"); - - lh.addStaticHoliday ("09-MAY-2017", "Victory Day"); - - lh.addStaticHoliday ("15-JUN-2017", "Day of National Rescue"); - - lh.addStaticHoliday ("01-SEP-2017", "Gurban Bayram"); - - lh.addStaticHoliday ("09-OCT-2017", "Armed Forces Day"); - - lh.addStaticHoliday ("18-OCT-2017", "Independence Day"); - - lh.addStaticHoliday ("17-NOV-2017", "Day of National Revival"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("08-MAR-2018", "Womens Day"); - - lh.addStaticHoliday ("20-MAR-2018", "Nau-Ruz"); - - lh.addStaticHoliday ("21-MAR-2018", "Nau-Ruz"); - - lh.addStaticHoliday ("09-MAY-2018", "Victory Day"); - - lh.addStaticHoliday ("28-MAY-2018", "Republic Day"); - - lh.addStaticHoliday ("15-JUN-2018", "Day of National Rescue"); - - lh.addStaticHoliday ("22-AUG-2018", "Gurban Bayram"); - - lh.addStaticHoliday ("09-OCT-2018", "Armed Forces Day"); - - lh.addStaticHoliday ("18-OCT-2018", "Independence Day"); - - lh.addStaticHoliday ("12-NOV-2018", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2018", "Day of National Revival"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("08-MAR-2019", "Womens Day"); - - lh.addStaticHoliday ("20-MAR-2019", "Nau-Ruz"); - - lh.addStaticHoliday ("21-MAR-2019", "Nau-Ruz"); - - lh.addStaticHoliday ("09-MAY-2019", "Victory Day"); - - lh.addStaticHoliday ("28-MAY-2019", "Republic Day"); - - lh.addStaticHoliday ("05-JUN-2019", "Ramazan Bayram"); - - lh.addStaticHoliday ("09-OCT-2019", "Armed Forces Day"); - - lh.addStaticHoliday ("18-OCT-2019", "Independence Day"); - - lh.addStaticHoliday ("12-NOV-2019", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2019", "Day of National Revival"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2020", "Memorial Day"); - - lh.addStaticHoliday ("20-MAR-2020", "Nau-Ruz"); - - lh.addStaticHoliday ("28-MAY-2020", "Republic Day"); - - lh.addStaticHoliday ("15-JUN-2020", "Day of National Rescue"); - - lh.addStaticHoliday ("31-JUL-2020", "Gurban Bayram"); - - lh.addStaticHoliday ("09-OCT-2020", "Armed Forces Day"); - - lh.addStaticHoliday ("12-NOV-2020", "Constitution Day"); - - lh.addStaticHoliday ("17-NOV-2020", "Day of National Revival"); - - lh.addStaticHoliday ("31-DEC-2020", "Day of National Revival"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2021", "Memorial Day"); - - lh.addStaticHoliday ("08-MAR-2021", "Womens Day"); - - lh.addStaticHoliday ("13-MAY-2021", "Ramazan Bayram"); - - lh.addStaticHoliday ("28-MAY-2021", "Republic Day"); - - lh.addStaticHoliday ("15-JUN-2021", "Day of National Rescue"); - - lh.addStaticHoliday ("20-JUL-2021", "Gurban Bayram"); - - lh.addStaticHoliday ("18-OCT-2021", "Independence Day"); - - lh.addStaticHoliday ("12-NOV-2021", "Constitution Day"); - - lh.addStaticHoliday ("17-NOV-2021", "Day of National Revival"); - - lh.addStaticHoliday ("31-DEC-2021", "Day of National Revival"); - - lh.addStaticHoliday ("20-JAN-2022", "Memorial Day"); - - lh.addStaticHoliday ("08-MAR-2022", "Womens Day"); - - lh.addStaticHoliday ("21-MAR-2022", "Nau-Ruz"); - - lh.addStaticHoliday ("02-MAY-2022", "Ramazan Bayram"); - - lh.addStaticHoliday ("09-MAY-2022", "Victory Day"); - - lh.addStaticHoliday ("15-JUN-2022", "Day of National Rescue"); - - lh.addStaticHoliday ("18-OCT-2022", "Independence Day"); - - lh.addStaticHoliday ("17-NOV-2022", "Day of National Revival"); - - lh.addStaticHoliday ("20-JAN-2023", "Memorial Day"); - - lh.addStaticHoliday ("08-MAR-2023", "Womens Day"); - - lh.addStaticHoliday ("20-MAR-2023", "Nau-Ruz"); - - lh.addStaticHoliday ("21-MAR-2023", "Nau-Ruz"); - - lh.addStaticHoliday ("09-MAY-2023", "Victory Day"); - - lh.addStaticHoliday ("15-JUN-2023", "Day of National Rescue"); - - lh.addStaticHoliday ("29-JUN-2023", "Gurban Bayram"); - - lh.addStaticHoliday ("09-OCT-2023", "Armed Forces Day"); - - lh.addStaticHoliday ("18-OCT-2023", "Independence Day"); - - lh.addStaticHoliday ("17-NOV-2023", "Day of National Revival"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("08-MAR-2024", "Womens Day"); - - lh.addStaticHoliday ("20-MAR-2024", "Nau-Ruz"); - - lh.addStaticHoliday ("21-MAR-2024", "Nau-Ruz"); - - lh.addStaticHoliday ("10-APR-2024", "Ramazan Bayram"); - - lh.addStaticHoliday ("09-MAY-2024", "Victory Day"); - - lh.addStaticHoliday ("28-MAY-2024", "Republic Day"); - - lh.addStaticHoliday ("17-JUN-2024", "Gurban Bayram"); - - lh.addStaticHoliday ("09-OCT-2024", "Armed Forces Day"); - - lh.addStaticHoliday ("18-OCT-2024", "Independence Day"); - - lh.addStaticHoliday ("12-NOV-2024", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2024", "Day of National Revival"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2025", "Memorial Day"); - - lh.addStaticHoliday ("20-MAR-2025", "Nau-Ruz"); - - lh.addStaticHoliday ("21-MAR-2025", "Nau-Ruz"); - - lh.addStaticHoliday ("31-MAR-2025", "Ramazan Bayram"); - - lh.addStaticHoliday ("09-MAY-2025", "Victory Day"); - - lh.addStaticHoliday ("28-MAY-2025", "Republic Day"); - - lh.addStaticHoliday ("06-JUN-2025", "Gurban Bayram"); - - lh.addStaticHoliday ("09-OCT-2025", "Armed Forces Day"); - - lh.addStaticHoliday ("12-NOV-2025", "Constitution Day"); - - lh.addStaticHoliday ("17-NOV-2025", "Day of National Revival"); - - lh.addStaticHoliday ("31-DEC-2025", "Day of National Revival"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2026", "Memorial Day"); - - lh.addStaticHoliday ("20-MAR-2026", "Nau-Ruz"); - - lh.addStaticHoliday ("27-MAY-2026", "Gurban Bayram"); - - lh.addStaticHoliday ("28-MAY-2026", "Republic Day"); - - lh.addStaticHoliday ("15-JUN-2026", "Day of National Rescue"); - - lh.addStaticHoliday ("09-OCT-2026", "Armed Forces Day"); - - lh.addStaticHoliday ("12-NOV-2026", "Constitution Day"); - - lh.addStaticHoliday ("17-NOV-2026", "Day of National Revival"); - - lh.addStaticHoliday ("31-DEC-2026", "Day of National Revival"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2027", "Memorial Day"); - - lh.addStaticHoliday ("08-MAR-2027", "Womens Day"); - - lh.addStaticHoliday ("10-MAR-2027", "Ramazan Bayram"); - - lh.addStaticHoliday ("17-MAY-2027", "Gurban Bayram"); - - lh.addStaticHoliday ("28-MAY-2027", "Republic Day"); - - lh.addStaticHoliday ("15-JUN-2027", "Day of National Rescue"); - - lh.addStaticHoliday ("18-OCT-2027", "Independence Day"); - - lh.addStaticHoliday ("12-NOV-2027", "Constitution Day"); - - lh.addStaticHoliday ("17-NOV-2027", "Day of National Revival"); - - lh.addStaticHoliday ("31-DEC-2027", "Day of National Revival"); - - lh.addStaticHoliday ("20-JAN-2028", "Memorial Day"); - - lh.addStaticHoliday ("08-MAR-2028", "Womens Day"); - - lh.addStaticHoliday ("20-MAR-2028", "Nau-Ruz"); - - lh.addStaticHoliday ("21-MAR-2028", "Nau-Ruz"); - - lh.addStaticHoliday ("05-MAY-2028", "Gurban Bayram"); - - lh.addStaticHoliday ("09-MAY-2028", "Victory Day"); - - lh.addStaticHoliday ("15-JUN-2028", "Day of National Rescue"); - - lh.addStaticHoliday ("09-OCT-2028", "Armed Forces Day"); - - lh.addStaticHoliday ("18-OCT-2028", "Independence Day"); - - lh.addStaticHoliday ("17-NOV-2028", "Day of National Revival"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/BAKHoliday.java b/org/drip/analytics/holset/BAKHoliday.java deleted file mode 100644 index e66d0c3..0000000 --- a/org/drip/analytics/holset/BAKHoliday.java +++ /dev/null @@ -1,337 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class BAKHoliday implements org.drip.analytics.holset.LocationHoliday { - public BAKHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "BAK"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1991", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-1991", "Martin Luther"); - - lh.addStaticHoliday ("18-FEB-1991", "Presidents Day"); - - lh.addStaticHoliday ("27-MAY-1991", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-1991", "Independence"); - - lh.addStaticHoliday ("02-SEP-1991", "Labor Day"); - - lh.addStaticHoliday ("14-OCT-1991", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-1991", "Veterans Day"); - - lh.addStaticHoliday ("28-NOV-1991", "Thanksgiving"); - - lh.addStaticHoliday ("25-DEC-1991", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1992", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-1992", "Martin Luther"); - - lh.addStaticHoliday ("17-FEB-1992", "Presidents Day"); - - lh.addStaticHoliday ("25-MAY-1992", "Memorial Day"); - - lh.addStaticHoliday ("07-SEP-1992", "Labor Day"); - - lh.addStaticHoliday ("12-OCT-1992", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-1992", "Veterans Day"); - - lh.addStaticHoliday ("26-NOV-1992", "Thanksgiving"); - - lh.addStaticHoliday ("25-DEC-1992", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1993", "New Years Day"); - - lh.addStaticHoliday ("18-JAN-1993", "Martin Luther"); - - lh.addStaticHoliday ("15-FEB-1993", "Presidents Day"); - - lh.addStaticHoliday ("31-MAY-1993", "Memorial Day"); - - lh.addStaticHoliday ("05-JUL-1993", "Independence"); - - lh.addStaticHoliday ("06-SEP-1993", "Labor Day"); - - lh.addStaticHoliday ("11-OCT-1993", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-1993", "Veterans Day"); - - lh.addStaticHoliday ("25-NOV-1993", "Thanksgiving"); - - lh.addStaticHoliday ("24-DEC-1993", "Christmas Day"); - - lh.addStaticHoliday ("03-JAN-1994", "New Years Day"); - - lh.addStaticHoliday ("17-JAN-1994", "Martin Luther"); - - lh.addStaticHoliday ("21-FEB-1994", "Presidents Day"); - - lh.addStaticHoliday ("30-MAY-1994", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-1994", "Independence"); - - lh.addStaticHoliday ("05-SEP-1994", "Labor Day"); - - lh.addStaticHoliday ("10-OCT-1994", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-1994", "Veterans Day"); - - lh.addStaticHoliday ("24-NOV-1994", "Thanksgiving"); - - lh.addStaticHoliday ("26-DEC-1994", "Christmas Day"); - - lh.addStaticHoliday ("02-JAN-1995", "New Years Day"); - - lh.addStaticHoliday ("16-JAN-1995", "Martin Luther"); - - lh.addStaticHoliday ("20-FEB-1995", "Presidents Day"); - - lh.addStaticHoliday ("29-MAY-1995", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-1995", "Independence"); - - lh.addStaticHoliday ("04-SEP-1995", "Labor Day"); - - lh.addStaticHoliday ("09-OCT-1995", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-1995", "Veterans Day"); - - lh.addStaticHoliday ("23-NOV-1995", "Thanksgiving"); - - lh.addStaticHoliday ("25-DEC-1995", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1996", "New Years Day"); - - lh.addStaticHoliday ("15-JAN-1996", "Martin Luther"); - - lh.addStaticHoliday ("16-JAN-1996", "Martin Luther"); - - lh.addStaticHoliday ("19-FEB-1996", "Presidents Day"); - - lh.addStaticHoliday ("27-MAY-1996", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-1996", "Independence"); - - lh.addStaticHoliday ("02-SEP-1996", "Labor Day"); - - lh.addStaticHoliday ("14-OCT-1996", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-1996", "Veterans Day"); - - lh.addStaticHoliday ("28-NOV-1996", "Thanksgiving"); - - lh.addStaticHoliday ("25-DEC-1996", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1997", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-1997", "Martin Luther"); - - lh.addStaticHoliday ("17-FEB-1997", "Presidents Day"); - - lh.addStaticHoliday ("26-MAY-1997", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-1997", "Independence Day"); - - lh.addStaticHoliday ("01-SEP-1997", "Labor Day"); - - lh.addStaticHoliday ("13-OCT-1997", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-1997", "Veterans Day"); - - lh.addStaticHoliday ("27-NOV-1997", "Thanksgiving"); - - lh.addStaticHoliday ("25-DEC-1997", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-1998", "Martin Luther"); - - lh.addStaticHoliday ("16-FEB-1998", "Presidents Day"); - - lh.addStaticHoliday ("25-MAY-1998", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-1998", "Independence Day"); - - lh.addStaticHoliday ("07-SEP-1998", "Labor Day"); - - lh.addStaticHoliday ("12-OCT-1998", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-1998", "Veterans Day"); - - lh.addStaticHoliday ("26-NOV-1998", "Thanksgiving"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("18-JAN-1999", "Martin Luther King"); - - lh.addStaticHoliday ("15-FEB-1999", "Presidents Day"); - - lh.addStaticHoliday ("31-MAY-1999", "Memorial Day"); - - lh.addStaticHoliday ("05-JUL-1999", "Independence"); - - lh.addStaticHoliday ("06-SEP-1999", "Labor Day"); - - lh.addStaticHoliday ("11-OCT-1999", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-1999", "Veterans Day"); - - lh.addStaticHoliday ("25-NOV-1999", "Thanksgiving"); - - lh.addStaticHoliday ("24-DEC-1999", "Christmas Day"); - - lh.addStaticHoliday ("03-JAN-2000", "New Years Day"); - - lh.addStaticHoliday ("17-JAN-2000", "Martin Luther"); - - lh.addStaticHoliday ("21-FEB-2000", "Presidents Day"); - - lh.addStaticHoliday ("29-MAY-2000", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2000", "Independence"); - - lh.addStaticHoliday ("04-SEP-2000", "Labor Day"); - - lh.addStaticHoliday ("09-OCT-2000", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2000", "Veterans Day"); - - lh.addStaticHoliday ("23-NOV-2000", "Thanksgiving"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("15-JAN-2001", "Martin Luther King"); - - lh.addStaticHoliday ("19-FEB-2001", "Presidents Day"); - - lh.addStaticHoliday ("28-MAY-2001", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2001", "Independence Day"); - - lh.addStaticHoliday ("03-SEP-2001", "Labor Day"); - - lh.addStaticHoliday ("08-OCT-2001", "Columbus Day"); - - lh.addStaticHoliday ("12-NOV-2001", "Veterans Day"); - - lh.addStaticHoliday ("22-NOV-2001", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2002", "Martin Luther King"); - - lh.addStaticHoliday ("18-FEB-2002", "Presidents Day"); - - lh.addStaticHoliday ("27-MAY-2002", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2002", "Independence Day"); - - lh.addStaticHoliday ("02-SEP-2002", "Labor Day"); - - lh.addStaticHoliday ("11-NOV-2002", "Veterans Day"); - - lh.addStaticHoliday ("28-NOV-2002", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Dy"); - - lh.addStaticHoliday ("20-JAN-2003", "Martin Luther King"); - - lh.addStaticHoliday ("17-FEB-2003", "Presidents Day"); - - lh.addStaticHoliday ("26-MAY-2003", "Memorial day"); - - lh.addStaticHoliday ("04-JUL-2003", "Independence Day"); - - lh.addStaticHoliday ("01-SEP-2003", "Labor Day"); - - lh.addStaticHoliday ("13-OCT-2003", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2003", "Veterans Day"); - - lh.addStaticHoliday ("27-NOV-2003", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2004", "Martin Luther King"); - - lh.addStaticHoliday ("16-FEB-2004", "Presidents Day"); - - lh.addStaticHoliday ("31-MAY-2004", "Memoril day"); - - lh.addStaticHoliday ("05-JUL-2004", "Independence Day"); - - lh.addStaticHoliday ("06-SEP-2004", "Labor Day"); - - lh.addStaticHoliday ("11-OCT-2004", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2004", "Veterans Day"); - - lh.addStaticHoliday ("25-NOV-2004", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2004", "Christmas Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/BBDHoliday.java b/org/drip/analytics/holset/BBDHoliday.java deleted file mode 100644 index 756194b..0000000 --- a/org/drip/analytics/holset/BBDHoliday.java +++ /dev/null @@ -1,737 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class BBDHoliday implements org.drip.analytics.holset.LocationHoliday { - public BBDHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "BBD"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-1998", "Errol Barrow Day"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("01-JUN-1998", "Whit Monday"); - - lh.addStaticHoliday ("03-AUG-1998", "Kadooment Day"); - - lh.addStaticHoliday ("05-OCT-1998", "United Nations Day"); - - lh.addStaticHoliday ("30-NOV-1998", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-1999", "Errol Barrow Day"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("24-MAY-1999", "Whit Monday"); - - lh.addStaticHoliday ("02-AUG-1999", "Kadooment Day"); - - lh.addStaticHoliday ("03-AUG-1999", "Emancipation Day Observed"); - - lh.addStaticHoliday ("04-OCT-1999", "United Nations Day"); - - lh.addStaticHoliday ("30-NOV-1999", "Independence Day"); - - lh.addStaticHoliday ("27-DEC-1999", "Boxing Day Observed"); - - lh.addStaticHoliday ("21-JAN-2000", "Errol Barrow Day"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("12-JUN-2000", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2000", "Emancipation Day"); - - lh.addStaticHoliday ("07-AUG-2000", "Kadooment Day"); - - lh.addStaticHoliday ("02-OCT-2000", "United Nations Day"); - - lh.addStaticHoliday ("30-NOV-2000", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("22-JAN-2001", "Errol Barrow Day Observed"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("04-JUN-2001", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2001", "Emancipation Day"); - - lh.addStaticHoliday ("06-AUG-2001", "Kadooment Day"); - - lh.addStaticHoliday ("01-OCT-2001", "United Nations Day"); - - lh.addStaticHoliday ("30-NOV-2001", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2002", "Errol Barrow Day"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("20-MAY-2002", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2002", "Emancipation Day"); - - lh.addStaticHoliday ("05-AUG-2002", "Kadooment Day"); - - lh.addStaticHoliday ("07-OCT-2002", "United Nations Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2003", "Errol Barrow Day"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("09-JUN-2003", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2003", "Emancipation Day"); - - lh.addStaticHoliday ("04-AUG-2003", "Kadooment Day"); - - lh.addStaticHoliday ("06-OCT-2003", "United Nations Day"); - - lh.addStaticHoliday ("01-DEC-2003", "Independence Day Observed"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2004", "Errol Barrow Day"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("31-MAY-2004", "Whit Monday"); - - lh.addStaticHoliday ("02-AUG-2004", "Kadooment Day"); - - lh.addStaticHoliday ("03-AUG-2004", "Emancipation Day Observed"); - - lh.addStaticHoliday ("04-OCT-2004", "United Nations Day"); - - lh.addStaticHoliday ("30-NOV-2004", "Independence Day"); - - lh.addStaticHoliday ("27-DEC-2004", "Boxing Day Observed"); - - lh.addStaticHoliday ("21-JAN-2005", "Errol Barrow Day"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2005", "Labour Day Observed"); - - lh.addStaticHoliday ("16-MAY-2005", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2005", "Kadooment Day"); - - lh.addStaticHoliday ("02-AUG-2005", "Emancipation Day Observed"); - - lh.addStaticHoliday ("03-OCT-2005", "United Nations Day"); - - lh.addStaticHoliday ("30-NOV-2005", "Independence Day"); - - lh.addStaticHoliday ("26-DEC-2005", "Boxing Day"); - - lh.addStaticHoliday ("27-DEC-2005", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("05-JUN-2006", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2006", "Emancipation Day"); - - lh.addStaticHoliday ("07-AUG-2006", "Kadooment Day"); - - lh.addStaticHoliday ("02-OCT-2006", "United Nations Day"); - - lh.addStaticHoliday ("30-NOV-2006", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("22-JAN-2007", "Errol Barrow Day Observed"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("28-MAY-2007", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2007", "Emancipation Day"); - - lh.addStaticHoliday ("06-AUG-2007", "Kadooment Day"); - - lh.addStaticHoliday ("01-OCT-2007", "United Nations Day"); - - lh.addStaticHoliday ("30-NOV-2007", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2008", "Errol Barrow Day"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("12-MAY-2008", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2008", "Emancipation Day"); - - lh.addStaticHoliday ("04-AUG-2008", "Kadooment Day"); - - lh.addStaticHoliday ("06-OCT-2008", "United Nations Day"); - - lh.addStaticHoliday ("01-DEC-2008", "Independence Day Observed"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2009", "Errol Barrow Day"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("01-JUN-2009", "Whit Monday"); - - lh.addStaticHoliday ("03-AUG-2009", "Kadooment Day"); - - lh.addStaticHoliday ("05-OCT-2009", "United Nations Day"); - - lh.addStaticHoliday ("30-NOV-2009", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2010", "Errol Barrow Day"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("24-MAY-2010", "Whit Monday"); - - lh.addStaticHoliday ("02-AUG-2010", "Kadooment Day"); - - lh.addStaticHoliday ("03-AUG-2010", "Emancipation Day Observed"); - - lh.addStaticHoliday ("04-OCT-2010", "United Nations Day"); - - lh.addStaticHoliday ("30-NOV-2010", "Independence Day"); - - lh.addStaticHoliday ("27-DEC-2010", "Boxing Day Observed"); - - lh.addStaticHoliday ("21-JAN-2011", "Errol Barrow Day"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2011", "Labour Day Observed"); - - lh.addStaticHoliday ("13-JUN-2011", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2011", "Kadooment Day"); - - lh.addStaticHoliday ("02-AUG-2011", "Emancipation Day Observed"); - - lh.addStaticHoliday ("03-OCT-2011", "United Nations Day"); - - lh.addStaticHoliday ("30-NOV-2011", "Independence Day"); - - lh.addStaticHoliday ("26-DEC-2011", "Boxing Day"); - - lh.addStaticHoliday ("27-DEC-2011", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("28-MAY-2012", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2012", "Emancipation Day"); - - lh.addStaticHoliday ("06-AUG-2012", "Kadooment Day"); - - lh.addStaticHoliday ("01-OCT-2012", "United Nations Day"); - - lh.addStaticHoliday ("30-NOV-2012", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2013", "Errol Barrow Day"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("20-MAY-2013", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2013", "Emancipation Day"); - - lh.addStaticHoliday ("05-AUG-2013", "Kadooment Day"); - - lh.addStaticHoliday ("07-OCT-2013", "United Nations Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2014", "Errol Barrow Day"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("09-JUN-2014", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2014", "Emancipation Day"); - - lh.addStaticHoliday ("04-AUG-2014", "Kadooment Day"); - - lh.addStaticHoliday ("06-OCT-2014", "United Nations Day"); - - lh.addStaticHoliday ("01-DEC-2014", "Independence Day Observed"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2015", "Errol Barrow Day"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2015", "Whit Monday"); - - lh.addStaticHoliday ("03-AUG-2015", "Kadooment Day"); - - lh.addStaticHoliday ("05-OCT-2015", "United Nations Day"); - - lh.addStaticHoliday ("30-NOV-2015", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2016", "Errol Barrow Day"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2016", "Labour Day Observed"); - - lh.addStaticHoliday ("16-MAY-2016", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2016", "Kadooment Day"); - - lh.addStaticHoliday ("02-AUG-2016", "Emancipation Day Observed"); - - lh.addStaticHoliday ("03-OCT-2016", "United Nations Day"); - - lh.addStaticHoliday ("30-NOV-2016", "Independence Day"); - - lh.addStaticHoliday ("26-DEC-2016", "Boxing Day"); - - lh.addStaticHoliday ("27-DEC-2016", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("05-JUN-2017", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2017", "Emancipation Day"); - - lh.addStaticHoliday ("07-AUG-2017", "Kadooment Day"); - - lh.addStaticHoliday ("02-OCT-2017", "United Nations Day"); - - lh.addStaticHoliday ("30-NOV-2017", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("22-JAN-2018", "Errol Barrow Day Observed"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2018", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2018", "Emancipation Day"); - - lh.addStaticHoliday ("06-AUG-2018", "Kadooment Day"); - - lh.addStaticHoliday ("01-OCT-2018", "United Nations Day"); - - lh.addStaticHoliday ("30-NOV-2018", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2019", "Errol Barrow Day"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("10-JUN-2019", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2019", "Emancipation Day"); - - lh.addStaticHoliday ("05-AUG-2019", "Kadooment Day"); - - lh.addStaticHoliday ("07-OCT-2019", "United Nations Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2020", "Errol Barrow Day"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("01-JUN-2020", "Whit Monday"); - - lh.addStaticHoliday ("03-AUG-2020", "Kadooment Day"); - - lh.addStaticHoliday ("05-OCT-2020", "United Nations Day"); - - lh.addStaticHoliday ("30-NOV-2020", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2021", "Errol Barrow Day"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("24-MAY-2021", "Whit Monday"); - - lh.addStaticHoliday ("02-AUG-2021", "Kadooment Day"); - - lh.addStaticHoliday ("03-AUG-2021", "Emancipation Day Observed"); - - lh.addStaticHoliday ("04-OCT-2021", "United Nations Day"); - - lh.addStaticHoliday ("30-NOV-2021", "Independence Day"); - - lh.addStaticHoliday ("27-DEC-2021", "Boxing Day Observed"); - - lh.addStaticHoliday ("21-JAN-2022", "Errol Barrow Day"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2022", "Labour Day Observed"); - - lh.addStaticHoliday ("06-JUN-2022", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2022", "Kadooment Day"); - - lh.addStaticHoliday ("02-AUG-2022", "Emancipation Day Observed"); - - lh.addStaticHoliday ("03-OCT-2022", "United Nations Day"); - - lh.addStaticHoliday ("30-NOV-2022", "Independence Day"); - - lh.addStaticHoliday ("26-DEC-2022", "Boxing Day"); - - lh.addStaticHoliday ("27-DEC-2022", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2023", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2023", "Emancipation Day"); - - lh.addStaticHoliday ("07-AUG-2023", "Kadooment Day"); - - lh.addStaticHoliday ("02-OCT-2023", "United Nations Day"); - - lh.addStaticHoliday ("30-NOV-2023", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("22-JAN-2024", "Errol Barrow Day Observed"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("20-MAY-2024", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2024", "Emancipation Day"); - - lh.addStaticHoliday ("05-AUG-2024", "Kadooment Day"); - - lh.addStaticHoliday ("07-OCT-2024", "United Nations Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2025", "Errol Barrow Day"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("09-JUN-2025", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2025", "Emancipation Day"); - - lh.addStaticHoliday ("04-AUG-2025", "Kadooment Day"); - - lh.addStaticHoliday ("06-OCT-2025", "United Nations Day"); - - lh.addStaticHoliday ("01-DEC-2025", "Independence Day Observed"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2026", "Errol Barrow Day"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2026", "Whit Monday"); - - lh.addStaticHoliday ("03-AUG-2026", "Kadooment Day"); - - lh.addStaticHoliday ("05-OCT-2026", "United Nations Day"); - - lh.addStaticHoliday ("30-NOV-2026", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2027", "Errol Barrow Day"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("17-MAY-2027", "Whit Monday"); - - lh.addStaticHoliday ("02-AUG-2027", "Kadooment Day"); - - lh.addStaticHoliday ("03-AUG-2027", "Emancipation Day Observed"); - - lh.addStaticHoliday ("04-OCT-2027", "United Nations Day"); - - lh.addStaticHoliday ("30-NOV-2027", "Independence Day"); - - lh.addStaticHoliday ("27-DEC-2027", "Boxing Day Observed"); - - lh.addStaticHoliday ("21-JAN-2028", "Errol Barrow Day"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("05-JUN-2028", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2028", "Emancipation Day"); - - lh.addStaticHoliday ("07-AUG-2028", "Kadooment Day"); - - lh.addStaticHoliday ("02-OCT-2028", "United Nations Day"); - - lh.addStaticHoliday ("30-NOV-2028", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Boxing Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/BEFHoliday.java b/org/drip/analytics/holset/BEFHoliday.java deleted file mode 100644 index 7c2bafe..0000000 --- a/org/drip/analytics/holset/BEFHoliday.java +++ /dev/null @@ -1,775 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class BEFHoliday implements org.drip.analytics.holset.LocationHoliday { - public BEFHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "BEF"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-1998", "Ascension Day"); - - lh.addStaticHoliday ("22-MAY-1998", "Bank Holiday"); - - lh.addStaticHoliday ("01-JUN-1998", "Whit Monday"); - - lh.addStaticHoliday ("21-JUL-1998", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-1998", "Bridging Day"); - - lh.addStaticHoliday ("02-NOV-1998", "Bridging Day"); - - lh.addStaticHoliday ("11-NOV-1998", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-1999", "Bridging Day"); - - lh.addStaticHoliday ("13-MAY-1999", "Ascension Day"); - - lh.addStaticHoliday ("14-MAY-1999", "Bank Holiday"); - - lh.addStaticHoliday ("24-MAY-1999", "Whit Monday"); - - lh.addStaticHoliday ("21-JUL-1999", "National Holiday"); - - lh.addStaticHoliday ("16-AUG-1999", "Bridging Day"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-1999", "Armistice Day"); - - lh.addStaticHoliday ("27-DEC-1999", "Bridging Day"); - - lh.addStaticHoliday ("03-JAN-2000", "Bridging Day"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("01-JUN-2000", "Ascension Day"); - - lh.addStaticHoliday ("02-JUN-2000", "Bank Holiday"); - - lh.addStaticHoliday ("12-JUN-2000", "Whit Monday"); - - lh.addStaticHoliday ("21-JUL-2000", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2000", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2000", "Bridging Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2001", "Ascension Day"); - - lh.addStaticHoliday ("25-MAY-2001", "Bank Holiday"); - - lh.addStaticHoliday ("04-JUN-2001", "Whit Monday"); - - lh.addStaticHoliday ("23-JUL-2001", "Bridging Day"); - - lh.addStaticHoliday ("15-AUG-2001", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("12-NOV-2001", "Bridging Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2002", "Ascension Day"); - - lh.addStaticHoliday ("10-MAY-2002", "Bank Holiday"); - - lh.addStaticHoliday ("20-MAY-2002", "Whit Monday"); - - lh.addStaticHoliday ("22-JUL-2002", "Bridging Day"); - - lh.addStaticHoliday ("15-AUG-2002", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2002", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2003", "Ascension Day"); - - lh.addStaticHoliday ("30-MAY-2003", "Bank Holiday"); - - lh.addStaticHoliday ("09-JUN-2003", "Whit Monday"); - - lh.addStaticHoliday ("21-JUL-2003", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2003", "Assumption Day"); - - lh.addStaticHoliday ("03-NOV-2003", "Bridging Day"); - - lh.addStaticHoliday ("11-NOV-2003", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2004", "Bridging Day"); - - lh.addStaticHoliday ("20-MAY-2004", "Ascension Day"); - - lh.addStaticHoliday ("21-MAY-2004", "Bank Holiday"); - - lh.addStaticHoliday ("31-MAY-2004", "Whit Monday"); - - lh.addStaticHoliday ("21-JUL-2004", "National Holiday"); - - lh.addStaticHoliday ("16-AUG-2004", "Bridging Day"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2004", "Armistice Day"); - - lh.addStaticHoliday ("27-DEC-2004", "Bridging Day"); - - lh.addStaticHoliday ("03-JAN-2005", "Bridging Day"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2005", "Bridging Day"); - - lh.addStaticHoliday ("05-MAY-2005", "Ascension Day"); - - lh.addStaticHoliday ("06-MAY-2005", "Bank Holiday"); - - lh.addStaticHoliday ("16-MAY-2005", "Whit Monday"); - - lh.addStaticHoliday ("21-JUL-2005", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2005", "Armistice Day"); - - lh.addStaticHoliday ("26-DEC-2005", "Bridging Day"); - - lh.addStaticHoliday ("02-JAN-2006", "Bridging Day"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2006", "Ascension Day"); - - lh.addStaticHoliday ("26-MAY-2006", "Bank Holiday"); - - lh.addStaticHoliday ("05-JUN-2006", "Whit Monday"); - - lh.addStaticHoliday ("21-JUL-2006", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2006", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2006", "Bridging Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2007", "Ascension Day"); - - lh.addStaticHoliday ("18-MAY-2007", "Bank Holiday"); - - lh.addStaticHoliday ("28-MAY-2007", "Whit Monday"); - - lh.addStaticHoliday ("23-JUL-2007", "Bridging Day"); - - lh.addStaticHoliday ("15-AUG-2007", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("12-NOV-2007", "Bridging Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2008", "Bank Holiday"); - - lh.addStaticHoliday ("12-MAY-2008", "Whit Monday"); - - lh.addStaticHoliday ("21-JUL-2008", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2008", "Assumption Day"); - - lh.addStaticHoliday ("03-NOV-2008", "Bridging Day"); - - lh.addStaticHoliday ("11-NOV-2008", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2009", "Ascension Day"); - - lh.addStaticHoliday ("22-MAY-2009", "Bank Holiday"); - - lh.addStaticHoliday ("01-JUN-2009", "Whit Monday"); - - lh.addStaticHoliday ("21-JUL-2009", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-2009", "Bridging Day"); - - lh.addStaticHoliday ("02-NOV-2009", "Bridging Day"); - - lh.addStaticHoliday ("11-NOV-2009", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2010", "Bridging Day"); - - lh.addStaticHoliday ("13-MAY-2010", "Ascension Day"); - - lh.addStaticHoliday ("14-MAY-2010", "Bank Holiday"); - - lh.addStaticHoliday ("24-MAY-2010", "Whit Monday"); - - lh.addStaticHoliday ("21-JUL-2010", "National Holiday"); - - lh.addStaticHoliday ("16-AUG-2010", "Bridging Day"); - - lh.addStaticHoliday ("01-NOV-2010", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2010", "Armistice Day"); - - lh.addStaticHoliday ("27-DEC-2010", "Bridging Day"); - - lh.addStaticHoliday ("03-JAN-2011", "Bridging Day"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2011", "Bridging Day"); - - lh.addStaticHoliday ("02-JUN-2011", "Ascension Day"); - - lh.addStaticHoliday ("03-JUN-2011", "Bank Holiday"); - - lh.addStaticHoliday ("13-JUN-2011", "Whit Monday"); - - lh.addStaticHoliday ("21-JUL-2011", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2011", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2011", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2011", "Armistice Day"); - - lh.addStaticHoliday ("26-DEC-2011", "Bridging Day"); - - lh.addStaticHoliday ("02-JAN-2012", "Bridging Day"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2012", "Ascension Day"); - - lh.addStaticHoliday ("18-MAY-2012", "Bank Holiday"); - - lh.addStaticHoliday ("28-MAY-2012", "Whit Monday"); - - lh.addStaticHoliday ("23-JUL-2012", "Bridging Day"); - - lh.addStaticHoliday ("15-AUG-2012", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2012", "All Saints Day"); - - lh.addStaticHoliday ("12-NOV-2012", "Bridging Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2013", "Ascension Day"); - - lh.addStaticHoliday ("10-MAY-2013", "Bank Holiday"); - - lh.addStaticHoliday ("20-MAY-2013", "Whit Monday"); - - lh.addStaticHoliday ("22-JUL-2013", "Bridging Day"); - - lh.addStaticHoliday ("15-AUG-2013", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2013", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2013", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2014", "Ascension Day"); - - lh.addStaticHoliday ("30-MAY-2014", "Bank Holiday"); - - lh.addStaticHoliday ("09-JUN-2014", "Whit Monday"); - - lh.addStaticHoliday ("21-JUL-2014", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2014", "Assumption Day"); - - lh.addStaticHoliday ("03-NOV-2014", "Bridging Day"); - - lh.addStaticHoliday ("11-NOV-2014", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("14-MAY-2015", "Ascension Day"); - - lh.addStaticHoliday ("15-MAY-2015", "Bank Holiday"); - - lh.addStaticHoliday ("25-MAY-2015", "Whit Monday"); - - lh.addStaticHoliday ("21-JUL-2015", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-2015", "Bridging Day"); - - lh.addStaticHoliday ("02-NOV-2015", "Bridging Day"); - - lh.addStaticHoliday ("11-NOV-2015", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2016", "Bridging Day"); - - lh.addStaticHoliday ("05-MAY-2016", "Ascension Day"); - - lh.addStaticHoliday ("06-MAY-2016", "Bank Holiday"); - - lh.addStaticHoliday ("16-MAY-2016", "Whit Monday"); - - lh.addStaticHoliday ("21-JUL-2016", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2016", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2016", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2016", "Armistice Day"); - - lh.addStaticHoliday ("26-DEC-2016", "Bridging Day"); - - lh.addStaticHoliday ("02-JAN-2017", "Bridging Day"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2017", "Ascension Day"); - - lh.addStaticHoliday ("26-MAY-2017", "Bank Holiday"); - - lh.addStaticHoliday ("05-JUN-2017", "Whit Monday"); - - lh.addStaticHoliday ("21-JUL-2017", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2017", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2017", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2017", "Bridging Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("10-MAY-2018", "Ascension Day"); - - lh.addStaticHoliday ("11-MAY-2018", "Bank Holiday"); - - lh.addStaticHoliday ("21-MAY-2018", "Whit Monday"); - - lh.addStaticHoliday ("23-JUL-2018", "Bridging Day"); - - lh.addStaticHoliday ("15-AUG-2018", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2018", "All Saints Day"); - - lh.addStaticHoliday ("12-NOV-2018", "Bridging Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2019", "Ascension Day"); - - lh.addStaticHoliday ("31-MAY-2019", "Bank Holiday"); - - lh.addStaticHoliday ("10-JUN-2019", "Whit Monday"); - - lh.addStaticHoliday ("22-JUL-2019", "Bridging Day"); - - lh.addStaticHoliday ("15-AUG-2019", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2019", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2019", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2020", "Ascension Day"); - - lh.addStaticHoliday ("22-MAY-2020", "Bank Holiday"); - - lh.addStaticHoliday ("01-JUN-2020", "Whit Monday"); - - lh.addStaticHoliday ("21-JUL-2020", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-2020", "Bridging Day"); - - lh.addStaticHoliday ("02-NOV-2020", "Bridging Day"); - - lh.addStaticHoliday ("11-NOV-2020", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2021", "Bridging Day"); - - lh.addStaticHoliday ("13-MAY-2021", "Ascension Day"); - - lh.addStaticHoliday ("14-MAY-2021", "Bank Holiday"); - - lh.addStaticHoliday ("24-MAY-2021", "Whit Monday"); - - lh.addStaticHoliday ("21-JUL-2021", "National Holiday"); - - lh.addStaticHoliday ("16-AUG-2021", "Bridging Day"); - - lh.addStaticHoliday ("01-NOV-2021", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2021", "Armistice Day"); - - lh.addStaticHoliday ("27-DEC-2021", "Bridging Day"); - - lh.addStaticHoliday ("03-JAN-2022", "Bridging Day"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2022", "Bridging Day"); - - lh.addStaticHoliday ("26-MAY-2022", "Ascension Day"); - - lh.addStaticHoliday ("27-MAY-2022", "Bank Holiday"); - - lh.addStaticHoliday ("06-JUN-2022", "Whit Monday"); - - lh.addStaticHoliday ("21-JUL-2022", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2022", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2022", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2022", "Armistice Day"); - - lh.addStaticHoliday ("26-DEC-2022", "Bridging Day"); - - lh.addStaticHoliday ("02-JAN-2023", "Bridging Day"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("18-MAY-2023", "Ascension Day"); - - lh.addStaticHoliday ("19-MAY-2023", "Bank Holiday"); - - lh.addStaticHoliday ("29-MAY-2023", "Whit Monday"); - - lh.addStaticHoliday ("21-JUL-2023", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2023", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2023", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2023", "Bridging Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2024", "Ascension Day"); - - lh.addStaticHoliday ("10-MAY-2024", "Bank Holiday"); - - lh.addStaticHoliday ("20-MAY-2024", "Whit Monday"); - - lh.addStaticHoliday ("22-JUL-2024", "Bridging Day"); - - lh.addStaticHoliday ("15-AUG-2024", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2024", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2024", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2025", "Ascension Day"); - - lh.addStaticHoliday ("30-MAY-2025", "Bank Holiday"); - - lh.addStaticHoliday ("09-JUN-2025", "Whit Monday"); - - lh.addStaticHoliday ("21-JUL-2025", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2025", "Assumption Day"); - - lh.addStaticHoliday ("03-NOV-2025", "Bridging Day"); - - lh.addStaticHoliday ("11-NOV-2025", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("14-MAY-2026", "Ascension Day"); - - lh.addStaticHoliday ("15-MAY-2026", "Bank Holiday"); - - lh.addStaticHoliday ("25-MAY-2026", "Whit Monday"); - - lh.addStaticHoliday ("21-JUL-2026", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-2026", "Bridging Day"); - - lh.addStaticHoliday ("02-NOV-2026", "Bridging Day"); - - lh.addStaticHoliday ("11-NOV-2026", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2027", "Bridging Day"); - - lh.addStaticHoliday ("06-MAY-2027", "Ascension Day"); - - lh.addStaticHoliday ("07-MAY-2027", "Bank Holiday"); - - lh.addStaticHoliday ("17-MAY-2027", "Whit Monday"); - - lh.addStaticHoliday ("21-JUL-2027", "National Holiday"); - - lh.addStaticHoliday ("16-AUG-2027", "Bridging Day"); - - lh.addStaticHoliday ("01-NOV-2027", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2027", "Armistice Day"); - - lh.addStaticHoliday ("27-DEC-2027", "Bridging Day"); - - lh.addStaticHoliday ("03-JAN-2028", "Bridging Day"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2028", "Ascension Day"); - - lh.addStaticHoliday ("26-MAY-2028", "Bank Holiday"); - - lh.addStaticHoliday ("05-JUN-2028", "Whit Monday"); - - lh.addStaticHoliday ("21-JUL-2028", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2028", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2028", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2028", "Bridging Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Bridging Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/BGLHoliday.java b/org/drip/analytics/holset/BGLHoliday.java deleted file mode 100644 index d163970..0000000 --- a/org/drip/analytics/holset/BGLHoliday.java +++ /dev/null @@ -1,383 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class BGLHoliday implements org.drip.analytics.holset.LocationHoliday { - public BGLHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "BGL"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-1998", "Liberation Day"); - - lh.addStaticHoliday ("20-APR-1998", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-1999", "Liberation Day"); - - lh.addStaticHoliday ("12-APR-1999", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("24-MAY-1999", "Education Day"); - - lh.addStaticHoliday ("03-MAR-2000", "Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2000", "Education Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("16-APR-2001", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2001", "Education Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2002", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("24-MAY-2002", "Education Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2003", "Liberation Day"); - - lh.addStaticHoliday ("28-APR-2003", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2004", "Liberation Day"); - - lh.addStaticHoliday ("12-APR-2004", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("24-MAY-2004", "Education Day"); - - lh.addStaticHoliday ("03-MAR-2005", "Liberation Day"); - - lh.addStaticHoliday ("02-MAY-2005", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("24-MAY-2005", "Education Day"); - - lh.addStaticHoliday ("26-DEC-2005", "Boxing Day"); - - lh.addStaticHoliday ("03-MAR-2006", "Liberation Day"); - - lh.addStaticHoliday ("24-APR-2006", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2006", "Education Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2007", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2007", "Education Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2008", "Liberation Day"); - - lh.addStaticHoliday ("28-APR-2008", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2009", "Liberation Day"); - - lh.addStaticHoliday ("20-APR-2009", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2010", "Liberation Day"); - - lh.addStaticHoliday ("05-APR-2010", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("24-MAY-2010", "Education Day"); - - lh.addStaticHoliday ("03-MAR-2011", "Liberation Day"); - - lh.addStaticHoliday ("25-APR-2011", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("24-MAY-2011", "Education Day"); - - lh.addStaticHoliday ("26-DEC-2011", "Boxing Day"); - - lh.addStaticHoliday ("16-APR-2012", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2012", "Education Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2013", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("24-MAY-2013", "Education Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2014", "Liberation Day"); - - lh.addStaticHoliday ("21-APR-2014", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2015", "Liberation Day"); - - lh.addStaticHoliday ("13-APR-2015", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2016", "Liberation Day"); - - lh.addStaticHoliday ("02-MAY-2016", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("24-MAY-2016", "Education Day"); - - lh.addStaticHoliday ("26-DEC-2016", "Boxing Day"); - - lh.addStaticHoliday ("03-MAR-2017", "Liberation Day"); - - lh.addStaticHoliday ("17-APR-2017", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2017", "Education Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2018", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2018", "Education Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("29-APR-2019", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2019", "Education Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2020", "Liberation Day"); - - lh.addStaticHoliday ("20-APR-2020", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2021", "Liberation Day"); - - lh.addStaticHoliday ("03-MAY-2021", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("24-MAY-2021", "Education Day"); - - lh.addStaticHoliday ("03-MAR-2022", "Liberation Day"); - - lh.addStaticHoliday ("25-APR-2022", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("24-MAY-2022", "Education Day"); - - lh.addStaticHoliday ("26-DEC-2022", "Boxing Day"); - - lh.addStaticHoliday ("03-MAR-2023", "Liberation Day"); - - lh.addStaticHoliday ("17-APR-2023", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2023", "Education Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2024", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("24-MAY-2024", "Education Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2025", "Liberation Day"); - - lh.addStaticHoliday ("21-APR-2025", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2026", "Liberation Day"); - - lh.addStaticHoliday ("13-APR-2026", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2027", "Liberation Day"); - - lh.addStaticHoliday ("03-MAY-2027", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("24-MAY-2027", "Education Day"); - - lh.addStaticHoliday ("03-MAR-2028", "Liberation Day"); - - lh.addStaticHoliday ("17-APR-2028", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2028", "Education Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Boxing Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/BHDHoliday.java b/org/drip/analytics/holset/BHDHoliday.java deleted file mode 100644 index 204d143..0000000 --- a/org/drip/analytics/holset/BHDHoliday.java +++ /dev/null @@ -1,1269 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class BHDHoliday implements org.drip.analytics.holset.LocationHoliday { - public BHDHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "BHD"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-1998", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("29-JAN-1998", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("31-JAN-1998", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-FEB-1998", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("05-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-APR-1998", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("26-APR-1998", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("27-APR-1998", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("05-MAY-1998", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("06-MAY-1998", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("07-MAY-1998", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("04-JUL-1998", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("05-JUL-1998", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("06-JUL-1998", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("16-DEC-1998", "National Day"); - - lh.addStaticHoliday ("02-JAN-1999", "New Years Day Observed"); - - lh.addStaticHoliday ("17-JAN-1999", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("18-JAN-1999", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("19-JAN-1999", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("20-JAN-1999", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("21-JAN-1999", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("27-MAR-1999", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-MAR-1999", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-MAR-1999", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("30-MAR-1999", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("15-APR-1999", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("17-APR-1999", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("25-APR-1999", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("26-APR-1999", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("27-APR-1999", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("28-APR-1999", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("24-JUN-1999", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("26-JUN-1999", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("16-DEC-1999", "National Day"); - - lh.addStaticHoliday ("01-JAN-2000", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("08-JAN-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("09-JAN-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("10-JAN-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("14-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("15-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-APR-2000", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("05-APR-2000", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("06-APR-2000", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("15-APR-2000", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("16-APR-2000", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("17-APR-2000", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("13-JUN-2000", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("14-JUN-2000", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("15-JUN-2000", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2000", "National Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-DEC-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("27-DEC-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("28-DEC-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("04-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-MAR-2001", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("25-MAR-2001", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("26-MAR-2001", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("03-APR-2001", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("04-APR-2001", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("05-APR-2001", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("02-JUN-2001", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("03-JUN-2001", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("04-JUN-2001", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("15-DEC-2001", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2001", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("17-DEC-2001", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("18-DEC-2001", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("21-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("14-MAR-2002", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("16-MAR-2002", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("24-MAR-2002", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("25-MAR-2002", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("26-MAR-2002", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("27-MAR-2002", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("23-MAY-2002", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("25-MAY-2002", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("04-DEC-2002", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("05-DEC-2002", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("07-DEC-2002", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("08-DEC-2002", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2002", "National Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("10-FEB-2003", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-FEB-2003", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("12-FEB-2003", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-FEB-2003", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-MAR-2003", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("04-MAR-2003", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("05-MAR-2003", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("13-MAR-2003", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("15-MAR-2003", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("16-MAR-2003", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("12-MAY-2003", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("13-MAY-2003", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("14-MAY-2003", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("23-NOV-2003", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("24-NOV-2003", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("25-NOV-2003", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-NOV-2003", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("27-NOV-2003", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2003", "National Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("31-JAN-2004", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-FEB-2004", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-FEB-2004", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-FEB-2004", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-FEB-2004", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("21-FEB-2004", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("29-FEB-2004", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("01-MAR-2004", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("02-MAR-2004", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("03-MAR-2004", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("01-MAY-2004", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("02-MAY-2004", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("13-NOV-2004", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("14-NOV-2004", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("15-NOV-2004", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("16-NOV-2004", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2004", "National Day"); - - lh.addStaticHoliday ("01-JAN-2005", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("22-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-FEB-2005", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("09-FEB-2005", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("10-FEB-2005", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("19-FEB-2005", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("20-FEB-2005", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("21-FEB-2005", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("19-APR-2005", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("20-APR-2005", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("21-APR-2005", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("01-NOV-2005", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-NOV-2005", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("03-NOV-2005", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("05-NOV-2005", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("17-DEC-2005", "National Day Observed"); - - lh.addStaticHoliday ("01-JAN-2006", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("12-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-JAN-2006", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("30-JAN-2006", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("31-JAN-2006", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("08-FEB-2006", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("09-FEB-2006", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("11-FEB-2006", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("09-APR-2006", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("10-APR-2006", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("11-APR-2006", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("22-OCT-2006", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("23-OCT-2006", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("24-OCT-2006", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("25-OCT-2006", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-OCT-2006", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2006", "National Day"); - - lh.addStaticHoliday ("30-DEC-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("31-DEC-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-JAN-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-JAN-2007", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("20-JAN-2007", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("28-JAN-2007", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("29-JAN-2007", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("30-JAN-2007", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("31-JAN-2007", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("29-MAR-2007", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("31-MAR-2007", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("11-OCT-2007", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("13-OCT-2007", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("14-OCT-2007", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("15-OCT-2007", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2007", "National Day"); - - lh.addStaticHoliday ("18-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("22-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2008", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("09-JAN-2008", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("10-JAN-2008", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("19-JAN-2008", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("20-JAN-2008", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("21-JAN-2008", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("18-MAR-2008", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("19-MAR-2008", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("20-MAR-2008", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("29-SEP-2008", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("30-SEP-2008", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-OCT-2008", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-OCT-2008", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("06-DEC-2008", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-DEC-2008", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-DEC-2008", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-DEC-2008", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-DEC-2008", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2008", "National Day"); - - lh.addStaticHoliday ("27-DEC-2008", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("28-DEC-2008", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("29-DEC-2008", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2009", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("07-JAN-2009", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("08-JAN-2009", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("07-MAR-2009", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("08-MAR-2009", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("09-MAR-2009", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("19-SEP-2009", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("20-SEP-2009", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("21-SEP-2009", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("22-SEP-2009", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("25-NOV-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("26-NOV-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-NOV-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-NOV-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2009", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("17-DEC-2009", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("26-DEC-2009", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("27-DEC-2009", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("28-DEC-2009", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("29-DEC-2009", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("02-JAN-2010", "New Years Day Observed"); - - lh.addStaticHoliday ("24-FEB-2010", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("25-FEB-2010", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("08-SEP-2010", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("09-SEP-2010", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("11-SEP-2010", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("12-SEP-2010", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("15-NOV-2010", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-NOV-2010", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-NOV-2010", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-NOV-2010", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-DEC-2010", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("06-DEC-2010", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("07-DEC-2010", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("15-DEC-2010", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2010", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("18-DEC-2010", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2011", "New Years Day"); - - lh.addStaticHoliday ("13-FEB-2011", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("14-FEB-2011", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("15-FEB-2011", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("28-AUG-2011", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("29-AUG-2011", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("30-AUG-2011", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("31-AUG-2011", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-SEP-2011", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("05-NOV-2011", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-NOV-2011", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-NOV-2011", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-NOV-2011", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-NOV-2011", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("26-NOV-2011", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("04-DEC-2011", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("05-DEC-2011", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("06-DEC-2011", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("07-DEC-2011", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("17-DEC-2011", "National Day Observed"); - - lh.addStaticHoliday ("01-JAN-2012", "New Years Day"); - - lh.addStaticHoliday ("04-FEB-2012", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("05-FEB-2012", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("18-AUG-2012", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("19-AUG-2012", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("20-AUG-2012", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("21-AUG-2012", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("24-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("27-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-NOV-2012", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("14-NOV-2012", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("15-NOV-2012", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("24-NOV-2012", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("25-NOV-2012", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("26-NOV-2012", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2012", "National Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("22-JAN-2013", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("23-JAN-2013", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("24-JAN-2013", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2013", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("07-AUG-2013", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("08-AUG-2013", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("10-AUG-2013", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("13-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("14-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("15-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-NOV-2013", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("04-NOV-2013", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("05-NOV-2013", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("13-NOV-2013", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("14-NOV-2013", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("16-NOV-2013", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2013", "National Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2014", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("13-JAN-2014", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("14-JAN-2014", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("27-JUL-2014", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("28-JUL-2014", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("29-JUL-2014", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("30-JUL-2014", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("31-JUL-2014", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("04-OCT-2014", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-OCT-2014", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-OCT-2014", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-OCT-2014", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-OCT-2014", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("25-OCT-2014", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("02-NOV-2014", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("03-NOV-2014", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("04-NOV-2014", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("05-NOV-2014", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2014", "National Day"); - - lh.addStaticHoliday ("01-JAN-2015", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("03-JAN-2015", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("16-JUL-2015", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("18-JUL-2015", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("19-JUL-2015", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("20-JUL-2015", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("22-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("26-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-OCT-2015", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("14-OCT-2015", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("15-OCT-2015", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("24-OCT-2015", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("25-OCT-2015", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("26-OCT-2015", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2015", "National Day"); - - lh.addStaticHoliday ("22-DEC-2015", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("23-DEC-2015", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("24-DEC-2015", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("02-JAN-2016", "New Years Day Observed"); - - lh.addStaticHoliday ("04-JUL-2016", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("05-JUL-2016", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("06-JUL-2016", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("07-JUL-2016", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("10-SEP-2016", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-SEP-2016", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("12-SEP-2016", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-SEP-2016", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("14-SEP-2016", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-OCT-2016", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("02-OCT-2016", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("03-OCT-2016", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("11-OCT-2016", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("12-OCT-2016", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("13-OCT-2016", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("10-DEC-2016", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("11-DEC-2016", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("12-DEC-2016", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("17-DEC-2016", "National Day Observed"); - - lh.addStaticHoliday ("01-JAN-2017", "New Years Day"); - - lh.addStaticHoliday ("24-JUN-2017", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("25-JUN-2017", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-JUN-2017", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("27-JUN-2017", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("30-AUG-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("31-AUG-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-SEP-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-SEP-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-SEP-2017", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("21-SEP-2017", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("30-SEP-2017", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("01-OCT-2017", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("02-OCT-2017", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("03-OCT-2017", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("29-NOV-2017", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("30-NOV-2017", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2017", "National Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("13-JUN-2018", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("14-JUN-2018", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("16-JUN-2018", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("17-JUN-2018", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("20-AUG-2018", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("21-AUG-2018", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("22-AUG-2018", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-AUG-2018", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-SEP-2018", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("10-SEP-2018", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("11-SEP-2018", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("19-SEP-2018", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("20-SEP-2018", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("22-SEP-2018", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("18-NOV-2018", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("19-NOV-2018", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("20-NOV-2018", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2018", "National Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("03-JUN-2019", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("04-JUN-2019", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("05-JUN-2019", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("06-JUN-2019", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("10-AUG-2019", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-AUG-2019", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("12-AUG-2019", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-AUG-2019", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-AUG-2019", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("31-AUG-2019", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("08-SEP-2019", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("09-SEP-2019", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("10-SEP-2019", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("11-SEP-2019", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("07-NOV-2019", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("09-NOV-2019", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2019", "National Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("23-MAY-2020", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("24-MAY-2020", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("25-MAY-2020", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-MAY-2020", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("29-JUL-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("30-JUL-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-AUG-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-AUG-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-AUG-2020", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("19-AUG-2020", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("20-AUG-2020", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("29-AUG-2020", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("30-AUG-2020", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("31-AUG-2020", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("27-OCT-2020", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("28-OCT-2020", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("29-OCT-2020", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2020", "National Day"); - - lh.addStaticHoliday ("02-JAN-2021", "New Years Day Observed"); - - lh.addStaticHoliday ("11-MAY-2021", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("12-MAY-2021", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("13-MAY-2021", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("15-MAY-2021", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("18-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("21-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("22-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-AUG-2021", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("09-AUG-2021", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("10-AUG-2021", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("18-AUG-2021", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("19-AUG-2021", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("21-AUG-2021", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("16-OCT-2021", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("17-OCT-2021", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("18-OCT-2021", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2021", "National Day"); - - lh.addStaticHoliday ("01-JAN-2022", "New Years Day"); - - lh.addStaticHoliday ("30-APR-2022", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-MAY-2022", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-MAY-2022", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("03-MAY-2022", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("04-MAY-2022", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("07-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-JUL-2022", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("30-JUL-2022", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("07-AUG-2022", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("08-AUG-2022", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("09-AUG-2022", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("10-AUG-2022", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("06-OCT-2022", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("08-OCT-2022", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("17-DEC-2022", "National Day Observed"); - - lh.addStaticHoliday ("01-JAN-2023", "New Years Day"); - - lh.addStaticHoliday ("20-APR-2023", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("22-APR-2023", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("23-APR-2023", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("24-APR-2023", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("27-JUN-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-JUN-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-JUN-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-JUL-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-JUL-2023", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("18-JUL-2023", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("19-JUL-2023", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("27-JUL-2023", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("29-JUL-2023", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("30-JUL-2023", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("25-SEP-2023", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("26-SEP-2023", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("27-SEP-2023", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2023", "National Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("08-APR-2024", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("09-APR-2024", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("10-APR-2024", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("11-APR-2024", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("15-JUN-2024", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-JUN-2024", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-JUN-2024", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-JUN-2024", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-JUN-2024", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-JUL-2024", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("07-JUL-2024", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("15-JUL-2024", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("16-JUL-2024", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("17-JUL-2024", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("18-JUL-2024", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("14-SEP-2024", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("15-SEP-2024", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2024", "National Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2025", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("30-MAR-2025", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("31-MAR-2025", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-APR-2025", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-APR-2025", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("04-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-JUN-2025", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("25-JUN-2025", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("26-JUN-2025", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("05-JUL-2025", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("06-JUL-2025", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("07-JUL-2025", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("02-SEP-2025", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("03-SEP-2025", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("04-SEP-2025", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2025", "National Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("18-MAR-2026", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("19-MAR-2026", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("21-MAR-2026", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("22-MAR-2026", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("25-MAY-2026", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("26-MAY-2026", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("27-MAY-2026", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-MAY-2026", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("14-JUN-2026", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("15-JUN-2026", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("16-JUN-2026", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("24-JUN-2026", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("25-JUN-2026", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("27-JUN-2026", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("23-AUG-2026", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("24-AUG-2026", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("25-AUG-2026", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2026", "National Day"); - - lh.addStaticHoliday ("02-JAN-2027", "New Years Day Observed"); - - lh.addStaticHoliday ("08-MAR-2027", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("09-MAR-2027", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("10-MAR-2027", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("11-MAR-2027", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("15-MAY-2027", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-MAY-2027", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-MAY-2027", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-MAY-2027", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-MAY-2027", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-JUN-2027", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("06-JUN-2027", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("14-JUN-2027", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("15-JUN-2027", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("16-JUN-2027", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("17-JUN-2027", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("14-AUG-2027", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("15-AUG-2027", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2027", "National Day"); - - lh.addStaticHoliday ("01-JAN-2028", "New Years Day"); - - lh.addStaticHoliday ("26-FEB-2028", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("27-FEB-2028", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("28-FEB-2028", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("29-FEB-2028", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("03-MAY-2028", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-MAY-2028", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-MAY-2028", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-MAY-2028", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-MAY-2028", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("24-MAY-2028", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("25-MAY-2028", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("03-JUN-2028", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("04-JUN-2028", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("05-JUN-2028", "Ashoora Holiday Period"); - - lh.addStaticHoliday ("01-AUG-2028", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("02-AUG-2028", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("03-AUG-2028", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2028", "National Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/BMDHoliday.java b/org/drip/analytics/holset/BMDHoliday.java deleted file mode 100644 index 14c2f58..0000000 --- a/org/drip/analytics/holset/BMDHoliday.java +++ /dev/null @@ -1,679 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class BMDHoliday implements org.drip.analytics.holset.LocationHoliday { - public BMDHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "BMD"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-1998", "Bermuda Day Observed"); - - lh.addStaticHoliday ("15-JUN-1998", "Queens Birthday"); - - lh.addStaticHoliday ("30-JUL-1998", "Cup Match Day"); - - lh.addStaticHoliday ("31-JUL-1998", "Somers Day"); - - lh.addStaticHoliday ("07-SEP-1998", "Labour Day"); - - lh.addStaticHoliday ("11-NOV-1998", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-1998", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-1999", "Bermuda Day"); - - lh.addStaticHoliday ("21-JUN-1999", "Queens Birthday"); - - lh.addStaticHoliday ("29-JUL-1999", "Cup Match Day"); - - lh.addStaticHoliday ("30-JUL-1999", "Somers Day"); - - lh.addStaticHoliday ("06-SEP-1999", "Labour Day"); - - lh.addStaticHoliday ("11-NOV-1999", "Remembrance Day"); - - lh.addStaticHoliday ("27-DEC-1999", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-1999", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2000", "New Years Day Observed"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2000", "Bermuda Day"); - - lh.addStaticHoliday ("19-JUN-2000", "Queens Birthday"); - - lh.addStaticHoliday ("03-AUG-2000", "Cup Match Day"); - - lh.addStaticHoliday ("04-AUG-2000", "Somers Day"); - - lh.addStaticHoliday ("04-SEP-2000", "Labour Day"); - - lh.addStaticHoliday ("13-NOV-2000", "Remembrance Day Observed"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2001", "Bermuda Day"); - - lh.addStaticHoliday ("18-JUN-2001", "Queens Birthday"); - - lh.addStaticHoliday ("02-AUG-2001", "Cup Match Day"); - - lh.addStaticHoliday ("03-AUG-2001", "Somers Day"); - - lh.addStaticHoliday ("03-SEP-2001", "Labour Day"); - - lh.addStaticHoliday ("12-NOV-2001", "Remembrance Day Observed"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2002", "Bermuda Day"); - - lh.addStaticHoliday ("17-JUN-2002", "Queens Birthday"); - - lh.addStaticHoliday ("01-AUG-2002", "Cup Match Day"); - - lh.addStaticHoliday ("02-AUG-2002", "Somers Day"); - - lh.addStaticHoliday ("02-SEP-2002", "Labour Day"); - - lh.addStaticHoliday ("11-NOV-2002", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("26-MAY-2003", "Bermuda Day Observed"); - - lh.addStaticHoliday ("16-JUN-2003", "Queens Birthday"); - - lh.addStaticHoliday ("31-JUL-2003", "Cup Match Day"); - - lh.addStaticHoliday ("01-AUG-2003", "Somers Day"); - - lh.addStaticHoliday ("01-SEP-2003", "Labour Day"); - - lh.addStaticHoliday ("11-NOV-2003", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2004", "Bermuda Day"); - - lh.addStaticHoliday ("21-JUN-2004", "Queens Birthday"); - - lh.addStaticHoliday ("29-JUL-2004", "Cup Match Day"); - - lh.addStaticHoliday ("30-JUL-2004", "Somers Day"); - - lh.addStaticHoliday ("06-SEP-2004", "Labour Day"); - - lh.addStaticHoliday ("11-NOV-2004", "Remembrance Day"); - - lh.addStaticHoliday ("27-DEC-2004", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2004", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2005", "New Years Day Observed"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2005", "Bermuda Day"); - - lh.addStaticHoliday ("20-JUN-2005", "Queens Birthday"); - - lh.addStaticHoliday ("28-JUL-2005", "Cup Match Day"); - - lh.addStaticHoliday ("29-JUL-2005", "Somers Day"); - - lh.addStaticHoliday ("05-SEP-2005", "Labour Day"); - - lh.addStaticHoliday ("11-NOV-2005", "Remembrance Day"); - - lh.addStaticHoliday ("26-DEC-2005", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2005", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2006", "Bermuda Day"); - - lh.addStaticHoliday ("19-JUN-2006", "Queens Birthday"); - - lh.addStaticHoliday ("03-AUG-2006", "Cup Match Day"); - - lh.addStaticHoliday ("04-AUG-2006", "Somers Day"); - - lh.addStaticHoliday ("04-SEP-2006", "Labour Day"); - - lh.addStaticHoliday ("13-NOV-2006", "Remembrance Day Observed"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2007", "Bermuda Day"); - - lh.addStaticHoliday ("18-JUN-2007", "Queens Birthday"); - - lh.addStaticHoliday ("02-AUG-2007", "Cup Match Day"); - - lh.addStaticHoliday ("03-AUG-2007", "Somers Day"); - - lh.addStaticHoliday ("03-SEP-2007", "Labour Day"); - - lh.addStaticHoliday ("12-NOV-2007", "Remembrance Day Observed"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("26-MAY-2008", "Bermuda Day Observed"); - - lh.addStaticHoliday ("16-JUN-2008", "Queens Birthday"); - - lh.addStaticHoliday ("31-JUL-2008", "Cup Match Day"); - - lh.addStaticHoliday ("01-AUG-2008", "Somers Day"); - - lh.addStaticHoliday ("01-SEP-2008", "Labour Day"); - - lh.addStaticHoliday ("11-NOV-2008", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2009", "Bermuda Day Observed"); - - lh.addStaticHoliday ("15-JUN-2009", "Queens Birthday"); - - lh.addStaticHoliday ("30-JUL-2009", "Cup Match Day"); - - lh.addStaticHoliday ("31-JUL-2009", "Somers Day"); - - lh.addStaticHoliday ("07-SEP-2009", "Labour Day"); - - lh.addStaticHoliday ("11-NOV-2009", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2009", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2010", "Bermuda Day"); - - lh.addStaticHoliday ("21-JUN-2010", "Queens Birthday"); - - lh.addStaticHoliday ("29-JUL-2010", "Cup Match Day"); - - lh.addStaticHoliday ("30-JUL-2010", "Somers Day"); - - lh.addStaticHoliday ("06-SEP-2010", "Labour Day"); - - lh.addStaticHoliday ("11-NOV-2010", "Remembrance Day"); - - lh.addStaticHoliday ("27-DEC-2010", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2010", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2011", "New Years Day Observed"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2011", "Bermuda Day"); - - lh.addStaticHoliday ("20-JUN-2011", "Queens Birthday"); - - lh.addStaticHoliday ("28-JUL-2011", "Cup Match Day"); - - lh.addStaticHoliday ("29-JUL-2011", "Somers Day"); - - lh.addStaticHoliday ("05-SEP-2011", "Labour Day"); - - lh.addStaticHoliday ("11-NOV-2011", "Remembrance Day"); - - lh.addStaticHoliday ("26-DEC-2011", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2011", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2012", "Bermuda Day"); - - lh.addStaticHoliday ("18-JUN-2012", "Queens Birthday"); - - lh.addStaticHoliday ("02-AUG-2012", "Cup Match Day"); - - lh.addStaticHoliday ("03-AUG-2012", "Somers Day"); - - lh.addStaticHoliday ("03-SEP-2012", "Labour Day"); - - lh.addStaticHoliday ("12-NOV-2012", "Remembrance Day Observed"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2013", "Bermuda Day"); - - lh.addStaticHoliday ("17-JUN-2013", "Queens Birthday"); - - lh.addStaticHoliday ("01-AUG-2013", "Cup Match Day"); - - lh.addStaticHoliday ("02-AUG-2013", "Somers Day"); - - lh.addStaticHoliday ("02-SEP-2013", "Labour Day"); - - lh.addStaticHoliday ("11-NOV-2013", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("26-MAY-2014", "Bermuda Day Observed"); - - lh.addStaticHoliday ("16-JUN-2014", "Queens Birthday"); - - lh.addStaticHoliday ("31-JUL-2014", "Cup Match Day"); - - lh.addStaticHoliday ("01-AUG-2014", "Somers Day"); - - lh.addStaticHoliday ("01-SEP-2014", "Labour Day"); - - lh.addStaticHoliday ("11-NOV-2014", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2015", "Bermuda Day Observed"); - - lh.addStaticHoliday ("15-JUN-2015", "Queens Birthday"); - - lh.addStaticHoliday ("30-JUL-2015", "Cup Match Day"); - - lh.addStaticHoliday ("31-JUL-2015", "Somers Day"); - - lh.addStaticHoliday ("07-SEP-2015", "Labour Day"); - - lh.addStaticHoliday ("11-NOV-2015", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2015", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2016", "Bermuda Day"); - - lh.addStaticHoliday ("20-JUN-2016", "Queens Birthday"); - - lh.addStaticHoliday ("28-JUL-2016", "Cup Match Day"); - - lh.addStaticHoliday ("29-JUL-2016", "Somers Day"); - - lh.addStaticHoliday ("05-SEP-2016", "Labour Day"); - - lh.addStaticHoliday ("11-NOV-2016", "Remembrance Day"); - - lh.addStaticHoliday ("26-DEC-2016", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2016", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2017", "Bermuda Day"); - - lh.addStaticHoliday ("19-JUN-2017", "Queens Birthday"); - - lh.addStaticHoliday ("03-AUG-2017", "Cup Match Day"); - - lh.addStaticHoliday ("04-AUG-2017", "Somers Day"); - - lh.addStaticHoliday ("04-SEP-2017", "Labour Day"); - - lh.addStaticHoliday ("13-NOV-2017", "Remembrance Day Observed"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2018", "Bermuda Day"); - - lh.addStaticHoliday ("18-JUN-2018", "Queens Birthday"); - - lh.addStaticHoliday ("02-AUG-2018", "Cup Match Day"); - - lh.addStaticHoliday ("03-AUG-2018", "Somers Day"); - - lh.addStaticHoliday ("03-SEP-2018", "Labour Day"); - - lh.addStaticHoliday ("12-NOV-2018", "Remembrance Day Observed"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2019", "Bermuda Day"); - - lh.addStaticHoliday ("17-JUN-2019", "Queens Birthday"); - - lh.addStaticHoliday ("01-AUG-2019", "Cup Match Day"); - - lh.addStaticHoliday ("02-AUG-2019", "Somers Day"); - - lh.addStaticHoliday ("02-SEP-2019", "Labour Day"); - - lh.addStaticHoliday ("11-NOV-2019", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2020", "Bermuda Day Observed"); - - lh.addStaticHoliday ("15-JUN-2020", "Queens Birthday"); - - lh.addStaticHoliday ("30-JUL-2020", "Cup Match Day"); - - lh.addStaticHoliday ("31-JUL-2020", "Somers Day"); - - lh.addStaticHoliday ("07-SEP-2020", "Labour Day"); - - lh.addStaticHoliday ("11-NOV-2020", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2020", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2021", "Bermuda Day"); - - lh.addStaticHoliday ("21-JUN-2021", "Queens Birthday"); - - lh.addStaticHoliday ("29-JUL-2021", "Cup Match Day"); - - lh.addStaticHoliday ("30-JUL-2021", "Somers Day"); - - lh.addStaticHoliday ("06-SEP-2021", "Labour Day"); - - lh.addStaticHoliday ("11-NOV-2021", "Remembrance Day"); - - lh.addStaticHoliday ("27-DEC-2021", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2021", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2022", "New Years Day Observed"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2022", "Bermuda Day"); - - lh.addStaticHoliday ("20-JUN-2022", "Queens Birthday"); - - lh.addStaticHoliday ("28-JUL-2022", "Cup Match Day"); - - lh.addStaticHoliday ("29-JUL-2022", "Somers Day"); - - lh.addStaticHoliday ("05-SEP-2022", "Labour Day"); - - lh.addStaticHoliday ("11-NOV-2022", "Remembrance Day"); - - lh.addStaticHoliday ("26-DEC-2022", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2022", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2023", "Bermuda Day"); - - lh.addStaticHoliday ("19-JUN-2023", "Queens Birthday"); - - lh.addStaticHoliday ("03-AUG-2023", "Cup Match Day"); - - lh.addStaticHoliday ("04-AUG-2023", "Somers Day"); - - lh.addStaticHoliday ("04-SEP-2023", "Labour Day"); - - lh.addStaticHoliday ("13-NOV-2023", "Remembrance Day Observed"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2024", "Bermuda Day"); - - lh.addStaticHoliday ("17-JUN-2024", "Queens Birthday"); - - lh.addStaticHoliday ("01-AUG-2024", "Cup Match Day"); - - lh.addStaticHoliday ("02-AUG-2024", "Somers Day"); - - lh.addStaticHoliday ("02-SEP-2024", "Labour Day"); - - lh.addStaticHoliday ("11-NOV-2024", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("26-MAY-2025", "Bermuda Day Observed"); - - lh.addStaticHoliday ("16-JUN-2025", "Queens Birthday"); - - lh.addStaticHoliday ("31-JUL-2025", "Cup Match Day"); - - lh.addStaticHoliday ("01-AUG-2025", "Somers Day"); - - lh.addStaticHoliday ("01-SEP-2025", "Labour Day"); - - lh.addStaticHoliday ("11-NOV-2025", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2026", "Bermuda Day Observed"); - - lh.addStaticHoliday ("15-JUN-2026", "Queens Birthday"); - - lh.addStaticHoliday ("30-JUL-2026", "Cup Match Day"); - - lh.addStaticHoliday ("31-JUL-2026", "Somers Day"); - - lh.addStaticHoliday ("07-SEP-2026", "Labour Day"); - - lh.addStaticHoliday ("11-NOV-2026", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2026", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2027", "Bermuda Day"); - - lh.addStaticHoliday ("21-JUN-2027", "Queens Birthday"); - - lh.addStaticHoliday ("29-JUL-2027", "Cup Match Day"); - - lh.addStaticHoliday ("30-JUL-2027", "Somers Day"); - - lh.addStaticHoliday ("06-SEP-2027", "Labour Day"); - - lh.addStaticHoliday ("11-NOV-2027", "Remembrance Day"); - - lh.addStaticHoliday ("27-DEC-2027", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2027", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2028", "New Years Day Observed"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2028", "Bermuda Day"); - - lh.addStaticHoliday ("19-JUN-2028", "Queens Birthday"); - - lh.addStaticHoliday ("03-AUG-2028", "Cup Match Day"); - - lh.addStaticHoliday ("04-AUG-2028", "Somers Day"); - - lh.addStaticHoliday ("04-SEP-2028", "Labour Day"); - - lh.addStaticHoliday ("13-NOV-2028", "Remembrance Day Observed"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Boxing Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/BRCHoliday.java b/org/drip/analytics/holset/BRCHoliday.java deleted file mode 100644 index a59b0ce..0000000 --- a/org/drip/analytics/holset/BRCHoliday.java +++ /dev/null @@ -1,739 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class BRCHoliday implements org.drip.analytics.holset.LocationHoliday { - public BRCHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "BRC"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("03-OCT-1996", "Election Day in 1996"); - - lh.addStaticHoliday ("01-JAN-1997", "New Years Day"); - - lh.addStaticHoliday ("10-FEB-1997", "Carnival Monday"); - - lh.addStaticHoliday ("11-FEB-1997", "Carnival Tuesday"); - - lh.addStaticHoliday ("27-MAR-1997", "Holy Thursday"); - - lh.addStaticHoliday ("28-MAR-1997", "Good Friday"); - - lh.addStaticHoliday ("21-APR-1997", "Independence Hero Tiradentes D"); - - lh.addStaticHoliday ("01-MAY-1997", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-1997", "Corpus Christi"); - - lh.addStaticHoliday ("25-DEC-1997", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("23-FEB-1998", "Carnival Monday"); - - lh.addStaticHoliday ("24-FEB-1998", "Carnival Tuesday"); - - lh.addStaticHoliday ("09-APR-1998", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("21-APR-1998", "Independence Hero Tiradentes D"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("11-JUN-1998", "Corpus Christi"); - - lh.addStaticHoliday ("07-SEP-1998", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-1998", "Day of Our Lady Aparecida"); - - lh.addStaticHoliday ("02-NOV-1998", "All Souls Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("25-JAN-1999", "Foundation Day for Sao Paulo"); - - lh.addStaticHoliday ("15-FEB-1999", "Carnival Monday"); - - lh.addStaticHoliday ("16-FEB-1999", "Carnival Tuesday"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("21-APR-1999", "Independence Hero Tiradentes D"); - - lh.addStaticHoliday ("03-JUN-1999", "Corpus Christi"); - - lh.addStaticHoliday ("07-SEP-1999", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-1999", "Day of Our Lady Aparecida"); - - lh.addStaticHoliday ("02-NOV-1999", "All Souls Day"); - - lh.addStaticHoliday ("15-NOV-1999", "Proclamation of the Republic"); - - lh.addStaticHoliday ("25-JAN-2000", "Foundation Day for Sao Paulo"); - - lh.addStaticHoliday ("06-MAR-2000", "Carnival Monday"); - - lh.addStaticHoliday ("07-MAR-2000", "Carnival Tuesday"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Independence Hero Tiradentes D"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("22-JUN-2000", "Corpus Christi"); - - lh.addStaticHoliday ("07-SEP-2000", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2000", "Day of Our Lady Aparecida"); - - lh.addStaticHoliday ("02-NOV-2000", "All Souls Day"); - - lh.addStaticHoliday ("15-NOV-2000", "Proclamation of the Republic"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("25-JAN-2001", "Foundation Day for Sao Paulo"); - - lh.addStaticHoliday ("26-FEB-2001", "Carnival Monday"); - - lh.addStaticHoliday ("27-FEB-2001", "Carnival Tuesday"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("14-JUN-2001", "Corpus Christi"); - - lh.addStaticHoliday ("07-SEP-2001", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2001", "Day of Our Lady Aparecida"); - - lh.addStaticHoliday ("02-NOV-2001", "All Souls Day"); - - lh.addStaticHoliday ("15-NOV-2001", "Proclamation of the Republic"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("25-JAN-2002", "Foundation Day for Sao Paulo"); - - lh.addStaticHoliday ("11-FEB-2002", "Carnival Monday"); - - lh.addStaticHoliday ("12-FEB-2002", "Carnival Tuesday"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2002", "Corpus Christi"); - - lh.addStaticHoliday ("15-NOV-2002", "Proclamation of the Republic"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2003", "Carnival Monday"); - - lh.addStaticHoliday ("04-MAR-2003", "Carnival Tuesday"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2003", "Independence Hero Tiradentes D"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("19-JUN-2003", "Corpus Christi"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("23-FEB-2004", "Carnival Monday"); - - lh.addStaticHoliday ("24-FEB-2004", "Carnival Tuesday"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2004", "Independence Hero Tiradentes D"); - - lh.addStaticHoliday ("10-JUN-2004", "Corpus Christi"); - - lh.addStaticHoliday ("07-SEP-2004", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2004", "Day of Our Lady Aparecida"); - - lh.addStaticHoliday ("02-NOV-2004", "All Souls Day"); - - lh.addStaticHoliday ("15-NOV-2004", "Proclamation of the Republic"); - - lh.addStaticHoliday ("25-JAN-2005", "Foundation Day for Sao Paulo"); - - lh.addStaticHoliday ("07-FEB-2005", "Carnival Monday"); - - lh.addStaticHoliday ("08-FEB-2005", "Carnival Tuesday"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2005", "Independence Hero Tiradentes D"); - - lh.addStaticHoliday ("26-MAY-2005", "Corpus Christi"); - - lh.addStaticHoliday ("07-SEP-2005", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2005", "Day of Our Lady Aparecida"); - - lh.addStaticHoliday ("02-NOV-2005", "All Souls Day"); - - lh.addStaticHoliday ("15-NOV-2005", "Proclamation of the Republic"); - - lh.addStaticHoliday ("25-JAN-2006", "Foundation Day for Sao Paulo"); - - lh.addStaticHoliday ("27-FEB-2006", "Carnival Monday"); - - lh.addStaticHoliday ("28-FEB-2006", "Carnival Tuesday"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2006", "Independence Hero Tiradentes D"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("15-JUN-2006", "Corpus Christi"); - - lh.addStaticHoliday ("07-SEP-2006", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2006", "Day of Our Lady Aparecida"); - - lh.addStaticHoliday ("02-NOV-2006", "All Souls Day"); - - lh.addStaticHoliday ("15-NOV-2006", "Proclamation of the Republic"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("25-JAN-2007", "Foundation Day for Sao Paulo"); - - lh.addStaticHoliday ("19-FEB-2007", "Carnival Monday"); - - lh.addStaticHoliday ("20-FEB-2007", "Carnival Tuesday"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("07-JUN-2007", "Corpus Christi"); - - lh.addStaticHoliday ("07-SEP-2007", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2007", "Day of Our Lady Aparecida"); - - lh.addStaticHoliday ("02-NOV-2007", "All Souls Day"); - - lh.addStaticHoliday ("15-NOV-2007", "Proclamation of the Republic"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("25-JAN-2008", "Foundation Day for Sao Paulo"); - - lh.addStaticHoliday ("04-FEB-2008", "Carnival Monday"); - - lh.addStaticHoliday ("05-FEB-2008", "Carnival Tuesday"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2008", "Independence Hero Tiradentes D"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("22-MAY-2008", "Corpus Christi"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("23-FEB-2009", "Carnival Monday"); - - lh.addStaticHoliday ("24-FEB-2009", "Carnival Tuesday"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2009", "Independence Hero Tiradentes D"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("11-JUN-2009", "Corpus Christi"); - - lh.addStaticHoliday ("07-SEP-2009", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2009", "Day of Our Lady Aparecida"); - - lh.addStaticHoliday ("02-NOV-2009", "All Souls Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("25-JAN-2010", "Foundation Day for Sao Paulo"); - - lh.addStaticHoliday ("15-FEB-2010", "Carnival Monday"); - - lh.addStaticHoliday ("16-FEB-2010", "Carnival Tuesday"); - - lh.addStaticHoliday ("01-APR-2010", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2010", "Independence Hero Tiradentes D"); - - lh.addStaticHoliday ("03-JUN-2010", "Corpus Christi"); - - lh.addStaticHoliday ("07-SEP-2010", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2010", "Day of Our Lady Aparecida"); - - lh.addStaticHoliday ("02-NOV-2010", "All Souls Day"); - - lh.addStaticHoliday ("15-NOV-2010", "Proclamation of the Republic"); - - lh.addStaticHoliday ("25-JAN-2011", "Foundation Day for Sao Paulo"); - - lh.addStaticHoliday ("07-MAR-2011", "Carnival Monday"); - - lh.addStaticHoliday ("08-MAR-2011", "Carnival Tuesday"); - - lh.addStaticHoliday ("21-APR-2011", "Independence Hero Tiradentes D"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("23-JUN-2011", "Corpus Christi"); - - lh.addStaticHoliday ("07-SEP-2011", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2011", "Day of Our Lady Aparecida"); - - lh.addStaticHoliday ("02-NOV-2011", "All Souls Day"); - - lh.addStaticHoliday ("15-NOV-2011", "Proclamation of the Republic"); - - lh.addStaticHoliday ("25-JAN-2012", "Foundation Day for Sao Paulo"); - - lh.addStaticHoliday ("20-FEB-2012", "Carnival Monday"); - - lh.addStaticHoliday ("21-FEB-2012", "Carnival Tuesday"); - - lh.addStaticHoliday ("05-APR-2012", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("07-JUN-2012", "Corpus Christi"); - - lh.addStaticHoliday ("07-SEP-2012", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2012", "Day of Our Lady Aparecida"); - - lh.addStaticHoliday ("02-NOV-2012", "All Souls Day"); - - lh.addStaticHoliday ("15-NOV-2012", "Proclamation of the Republic"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("25-JAN-2013", "Foundation Day for Sao Paulo"); - - lh.addStaticHoliday ("11-FEB-2013", "Carnival Monday"); - - lh.addStaticHoliday ("12-FEB-2013", "Carnival Tuesday"); - - lh.addStaticHoliday ("28-MAR-2013", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2013", "Corpus Christi"); - - lh.addStaticHoliday ("15-NOV-2013", "Proclamation of the Republic"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2014", "Carnival Monday"); - - lh.addStaticHoliday ("04-MAR-2014", "Carnival Tuesday"); - - lh.addStaticHoliday ("17-APR-2014", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2014", "Independence Hero Tiradentes D"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("19-JUN-2014", "Corpus Christi"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2015", "Carnival Monday"); - - lh.addStaticHoliday ("17-FEB-2015", "Carnival Tuesday"); - - lh.addStaticHoliday ("02-APR-2015", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2015", "Independence Hero Tiradentes D"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("04-JUN-2015", "Corpus Christi"); - - lh.addStaticHoliday ("07-SEP-2015", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2015", "Day of Our Lady Aparecida"); - - lh.addStaticHoliday ("02-NOV-2015", "All Souls Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("25-JAN-2016", "Foundation Day for Sao Paulo"); - - lh.addStaticHoliday ("08-FEB-2016", "Carnival Monday"); - - lh.addStaticHoliday ("09-FEB-2016", "Carnival Tuesday"); - - lh.addStaticHoliday ("24-MAR-2016", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2016", "Independence Hero Tiradentes D"); - - lh.addStaticHoliday ("26-MAY-2016", "Corpus Christi"); - - lh.addStaticHoliday ("07-SEP-2016", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2016", "Day of Our Lady Aparecida"); - - lh.addStaticHoliday ("02-NOV-2016", "All Souls Day"); - - lh.addStaticHoliday ("15-NOV-2016", "Proclamation of the Republic"); - - lh.addStaticHoliday ("25-JAN-2017", "Foundation Day for Sao Paulo"); - - lh.addStaticHoliday ("27-FEB-2017", "Carnival Monday"); - - lh.addStaticHoliday ("28-FEB-2017", "Carnival Tuesday"); - - lh.addStaticHoliday ("13-APR-2017", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2017", "Independence Hero Tiradentes D"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("15-JUN-2017", "Corpus Christi"); - - lh.addStaticHoliday ("07-SEP-2017", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2017", "Day of Our Lady Aparecida"); - - lh.addStaticHoliday ("02-NOV-2017", "All Souls Day"); - - lh.addStaticHoliday ("15-NOV-2017", "Proclamation of the Republic"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("25-JAN-2018", "Foundation Day for Sao Paulo"); - - lh.addStaticHoliday ("12-FEB-2018", "Carnival Monday"); - - lh.addStaticHoliday ("13-FEB-2018", "Carnival Tuesday"); - - lh.addStaticHoliday ("29-MAR-2018", "Holy Thursday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("31-MAY-2018", "Corpus Christi"); - - lh.addStaticHoliday ("07-SEP-2018", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2018", "Day of Our Lady Aparecida"); - - lh.addStaticHoliday ("02-NOV-2018", "All Souls Day"); - - lh.addStaticHoliday ("15-NOV-2018", "Proclamation of the Republic"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("25-JAN-2019", "Foundation Day for Sao Paulo"); - - lh.addStaticHoliday ("04-MAR-2019", "Carnival Monday"); - - lh.addStaticHoliday ("05-MAR-2019", "Carnival Tuesday"); - - lh.addStaticHoliday ("18-APR-2019", "Holy Thursday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("20-JUN-2019", "Corpus Christi"); - - lh.addStaticHoliday ("15-NOV-2019", "Proclamation of the Republic"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("24-FEB-2020", "Carnival Monday"); - - lh.addStaticHoliday ("25-FEB-2020", "Carnival Tuesday"); - - lh.addStaticHoliday ("09-APR-2020", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2020", "Independence Hero Tiradentes D"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("11-JUN-2020", "Corpus Christi"); - - lh.addStaticHoliday ("07-SEP-2020", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2020", "Day of Our Lady Aparecida"); - - lh.addStaticHoliday ("02-NOV-2020", "All Souls Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("25-JAN-2021", "Foundation Day for Sao Paulo"); - - lh.addStaticHoliday ("15-FEB-2021", "Carnival Monday"); - - lh.addStaticHoliday ("16-FEB-2021", "Carnival Tuesday"); - - lh.addStaticHoliday ("01-APR-2021", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2021", "Independence Hero Tiradentes D"); - - lh.addStaticHoliday ("03-JUN-2021", "Corpus Christi"); - - lh.addStaticHoliday ("07-SEP-2021", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2021", "Day of Our Lady Aparecida"); - - lh.addStaticHoliday ("02-NOV-2021", "All Souls Day"); - - lh.addStaticHoliday ("15-NOV-2021", "Proclamation of the Republic"); - - lh.addStaticHoliday ("25-JAN-2022", "Foundation Day for Sao Paulo"); - - lh.addStaticHoliday ("28-FEB-2022", "Carnival Monday"); - - lh.addStaticHoliday ("01-MAR-2022", "Carnival Tuesday"); - - lh.addStaticHoliday ("14-APR-2022", "Holy Thursday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2022", "Independence Hero Tiradentes D"); - - lh.addStaticHoliday ("16-JUN-2022", "Corpus Christi"); - - lh.addStaticHoliday ("07-SEP-2022", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2022", "Day of Our Lady Aparecida"); - - lh.addStaticHoliday ("02-NOV-2022", "All Souls Day"); - - lh.addStaticHoliday ("15-NOV-2022", "Proclamation of the Republic"); - - lh.addStaticHoliday ("25-JAN-2023", "Foundation Day for Sao Paulo"); - - lh.addStaticHoliday ("20-FEB-2023", "Carnival Monday"); - - lh.addStaticHoliday ("21-FEB-2023", "Carnival Tuesday"); - - lh.addStaticHoliday ("06-APR-2023", "Holy Thursday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2023", "Independence Hero Tiradentes D"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("08-JUN-2023", "Corpus Christi"); - - lh.addStaticHoliday ("07-SEP-2023", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2023", "Day of Our Lady Aparecida"); - - lh.addStaticHoliday ("02-NOV-2023", "All Souls Day"); - - lh.addStaticHoliday ("15-NOV-2023", "Proclamation of the Republic"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("25-JAN-2024", "Foundation Day for Sao Paulo"); - - lh.addStaticHoliday ("12-FEB-2024", "Carnival Monday"); - - lh.addStaticHoliday ("13-FEB-2024", "Carnival Tuesday"); - - lh.addStaticHoliday ("28-MAR-2024", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2024", "Corpus Christi"); - - lh.addStaticHoliday ("15-NOV-2024", "Proclamation of the Republic"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2025", "Carnival Monday"); - - lh.addStaticHoliday ("04-MAR-2025", "Carnival Tuesday"); - - lh.addStaticHoliday ("17-APR-2025", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2025", "Independence Hero Tiradentes D"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("19-JUN-2025", "Corpus Christi"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2026", "Carnival Monday"); - - lh.addStaticHoliday ("17-FEB-2026", "Carnival Tuesday"); - - lh.addStaticHoliday ("02-APR-2026", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2026", "Independence Hero Tiradentes D"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("04-JUN-2026", "Corpus Christi"); - - lh.addStaticHoliday ("07-SEP-2026", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2026", "Day of Our Lady Aparecida"); - - lh.addStaticHoliday ("02-NOV-2026", "All Souls Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/BRLHoliday.java b/org/drip/analytics/holset/BRLHoliday.java deleted file mode 100644 index 5f6fb09..0000000 --- a/org/drip/analytics/holset/BRLHoliday.java +++ /dev/null @@ -1,983 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class BRLHoliday implements org.drip.analytics.holset.LocationHoliday { - public BRLHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "BRL"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("25-DEC-2005", ""); - - lh.addStaticHoliday ("01-JAN-2006", ""); - - lh.addStaticHoliday ("27-FEB-2006", ""); - - lh.addStaticHoliday ("28-FEB-2006", ""); - - lh.addStaticHoliday ("14-APR-2006", ""); - - lh.addStaticHoliday ("21-APR-2006", ""); - - lh.addStaticHoliday ("01-MAY-2006", ""); - - lh.addStaticHoliday ("15-JUN-2006", ""); - - lh.addStaticHoliday ("07-SEP-2006", ""); - - lh.addStaticHoliday ("12-OCT-2006", ""); - - lh.addStaticHoliday ("02-NOV-2006", ""); - - lh.addStaticHoliday ("15-NOV-2006", ""); - - lh.addStaticHoliday ("25-DEC-2006", ""); - - lh.addStaticHoliday ("01-JAN-2007", ""); - - lh.addStaticHoliday ("19-FEB-2007", ""); - - lh.addStaticHoliday ("20-FEB-2007", ""); - - lh.addStaticHoliday ("06-APR-2007", ""); - - lh.addStaticHoliday ("21-APR-2007", ""); - - lh.addStaticHoliday ("01-MAY-2007", ""); - - lh.addStaticHoliday ("07-JUN-2007", ""); - - lh.addStaticHoliday ("07-SEP-2007", ""); - - lh.addStaticHoliday ("12-OCT-2007", ""); - - lh.addStaticHoliday ("02-NOV-2007", ""); - - lh.addStaticHoliday ("15-NOV-2007", ""); - - lh.addStaticHoliday ("25-DEC-2007", ""); - - lh.addStaticHoliday ("01-JAN-2008", ""); - - lh.addStaticHoliday ("04-FEB-2008", ""); - - lh.addStaticHoliday ("05-FEB-2008", ""); - - lh.addStaticHoliday ("21-MAR-2008", ""); - - lh.addStaticHoliday ("21-APR-2008", ""); - - lh.addStaticHoliday ("01-MAY-2008", ""); - - lh.addStaticHoliday ("22-MAY-2008", ""); - - lh.addStaticHoliday ("07-SEP-2008", ""); - - lh.addStaticHoliday ("12-OCT-2008", ""); - - lh.addStaticHoliday ("02-NOV-2008", ""); - - lh.addStaticHoliday ("15-NOV-2008", ""); - - lh.addStaticHoliday ("25-DEC-2008", ""); - - lh.addStaticHoliday ("01-JAN-2009", ""); - - lh.addStaticHoliday ("23-FEB-2009", ""); - - lh.addStaticHoliday ("24-FEB-2009", ""); - - lh.addStaticHoliday ("10-APR-2009", ""); - - lh.addStaticHoliday ("21-APR-2009", ""); - - lh.addStaticHoliday ("01-MAY-2009", ""); - - lh.addStaticHoliday ("11-JUN-2009", ""); - - lh.addStaticHoliday ("07-SEP-2009", ""); - - lh.addStaticHoliday ("12-OCT-2009", ""); - - lh.addStaticHoliday ("02-NOV-2009", ""); - - lh.addStaticHoliday ("15-NOV-2009", ""); - - lh.addStaticHoliday ("25-DEC-2009", ""); - - lh.addStaticHoliday ("01-JAN-2010", ""); - - lh.addStaticHoliday ("15-FEB-2010", ""); - - lh.addStaticHoliday ("16-FEB-2010", ""); - - lh.addStaticHoliday ("02-APR-2010", ""); - - lh.addStaticHoliday ("21-APR-2010", ""); - - lh.addStaticHoliday ("01-MAY-2010", ""); - - lh.addStaticHoliday ("03-JUN-2010", ""); - - lh.addStaticHoliday ("07-SEP-2010", ""); - - lh.addStaticHoliday ("12-OCT-2010", ""); - - lh.addStaticHoliday ("02-NOV-2010", ""); - - lh.addStaticHoliday ("15-NOV-2010", ""); - - lh.addStaticHoliday ("25-DEC-2010", ""); - - lh.addStaticHoliday ("01-JAN-2011", ""); - - lh.addStaticHoliday ("07-MAR-2011", ""); - - lh.addStaticHoliday ("08-MAR-2011", ""); - - lh.addStaticHoliday ("21-APR-2011", ""); - - lh.addStaticHoliday ("22-APR-2011", ""); - - lh.addStaticHoliday ("01-MAY-2011", ""); - - lh.addStaticHoliday ("23-JUN-2011", ""); - - lh.addStaticHoliday ("07-SEP-2011", ""); - - lh.addStaticHoliday ("12-OCT-2011", ""); - - lh.addStaticHoliday ("02-NOV-2011", ""); - - lh.addStaticHoliday ("15-NOV-2011", ""); - - lh.addStaticHoliday ("25-DEC-2011", ""); - - lh.addStaticHoliday ("01-JAN-2012", ""); - - lh.addStaticHoliday ("20-FEB-2012", ""); - - lh.addStaticHoliday ("21-FEB-2012", ""); - - lh.addStaticHoliday ("06-APR-2012", ""); - - lh.addStaticHoliday ("21-APR-2012", ""); - - lh.addStaticHoliday ("01-MAY-2012", ""); - - lh.addStaticHoliday ("07-JUN-2012", ""); - - lh.addStaticHoliday ("07-SEP-2012", ""); - - lh.addStaticHoliday ("12-OCT-2012", ""); - - lh.addStaticHoliday ("02-NOV-2012", ""); - - lh.addStaticHoliday ("15-NOV-2012", ""); - - lh.addStaticHoliday ("25-DEC-2012", ""); - - lh.addStaticHoliday ("01-JAN-2013", ""); - - lh.addStaticHoliday ("11-FEB-2013", ""); - - lh.addStaticHoliday ("12-FEB-2013", ""); - - lh.addStaticHoliday ("29-MAR-2013", ""); - - lh.addStaticHoliday ("21-APR-2013", ""); - - lh.addStaticHoliday ("01-MAY-2013", ""); - - lh.addStaticHoliday ("30-MAY-2013", ""); - - lh.addStaticHoliday ("07-SEP-2013", ""); - - lh.addStaticHoliday ("12-OCT-2013", ""); - - lh.addStaticHoliday ("02-NOV-2013", ""); - - lh.addStaticHoliday ("15-NOV-2013", ""); - - lh.addStaticHoliday ("25-DEC-2013", ""); - - lh.addStaticHoliday ("01-JAN-2014", ""); - - lh.addStaticHoliday ("03-MAR-2014", ""); - - lh.addStaticHoliday ("04-MAR-2014", ""); - - lh.addStaticHoliday ("18-APR-2014", ""); - - lh.addStaticHoliday ("21-APR-2014", ""); - - lh.addStaticHoliday ("01-MAY-2014", ""); - - lh.addStaticHoliday ("19-JUN-2014", ""); - - lh.addStaticHoliday ("07-SEP-2014", ""); - - lh.addStaticHoliday ("12-OCT-2014", ""); - - lh.addStaticHoliday ("02-NOV-2014", ""); - - lh.addStaticHoliday ("15-NOV-2014", ""); - - lh.addStaticHoliday ("25-DEC-2014", ""); - - lh.addStaticHoliday ("01-JAN-2015", ""); - - lh.addStaticHoliday ("16-FEB-2015", ""); - - lh.addStaticHoliday ("17-FEB-2015", ""); - - lh.addStaticHoliday ("03-APR-2015", ""); - - lh.addStaticHoliday ("21-APR-2015", ""); - - lh.addStaticHoliday ("01-MAY-2015", ""); - - lh.addStaticHoliday ("04-JUN-2015", ""); - - lh.addStaticHoliday ("07-SEP-2015", ""); - - lh.addStaticHoliday ("12-OCT-2015", ""); - - lh.addStaticHoliday ("02-NOV-2015", ""); - - lh.addStaticHoliday ("15-NOV-2015", ""); - - lh.addStaticHoliday ("25-DEC-2015", ""); - - lh.addStaticHoliday ("01-JAN-2016", ""); - - lh.addStaticHoliday ("08-FEB-2016", ""); - - lh.addStaticHoliday ("09-FEB-2016", ""); - - lh.addStaticHoliday ("25-MAR-2016", ""); - - lh.addStaticHoliday ("21-APR-2016", ""); - - lh.addStaticHoliday ("01-MAY-2016", ""); - - lh.addStaticHoliday ("26-MAY-2016", ""); - - lh.addStaticHoliday ("07-SEP-2016", ""); - - lh.addStaticHoliday ("12-OCT-2016", ""); - - lh.addStaticHoliday ("02-NOV-2016", ""); - - lh.addStaticHoliday ("15-NOV-2016", ""); - - lh.addStaticHoliday ("25-DEC-2016", ""); - - lh.addStaticHoliday ("01-JAN-2017", ""); - - lh.addStaticHoliday ("27-FEB-2017", ""); - - lh.addStaticHoliday ("28-FEB-2017", ""); - - lh.addStaticHoliday ("14-APR-2017", ""); - - lh.addStaticHoliday ("21-APR-2017", ""); - - lh.addStaticHoliday ("01-MAY-2017", ""); - - lh.addStaticHoliday ("15-JUN-2017", ""); - - lh.addStaticHoliday ("07-SEP-2017", ""); - - lh.addStaticHoliday ("12-OCT-2017", ""); - - lh.addStaticHoliday ("02-NOV-2017", ""); - - lh.addStaticHoliday ("15-NOV-2017", ""); - - lh.addStaticHoliday ("25-DEC-2017", ""); - - lh.addStaticHoliday ("01-JAN-2018", ""); - - lh.addStaticHoliday ("12-FEB-2018", ""); - - lh.addStaticHoliday ("13-FEB-2018", ""); - - lh.addStaticHoliday ("30-MAR-2018", ""); - - lh.addStaticHoliday ("21-APR-2018", ""); - - lh.addStaticHoliday ("01-MAY-2018", ""); - - lh.addStaticHoliday ("31-MAY-2018", ""); - - lh.addStaticHoliday ("07-SEP-2018", ""); - - lh.addStaticHoliday ("12-OCT-2018", ""); - - lh.addStaticHoliday ("02-NOV-2018", ""); - - lh.addStaticHoliday ("15-NOV-2018", ""); - - lh.addStaticHoliday ("25-DEC-2018", ""); - - lh.addStaticHoliday ("01-JAN-2019", ""); - - lh.addStaticHoliday ("04-MAR-2019", ""); - - lh.addStaticHoliday ("05-MAR-2019", ""); - - lh.addStaticHoliday ("19-APR-2019", ""); - - lh.addStaticHoliday ("21-APR-2019", ""); - - lh.addStaticHoliday ("01-MAY-2019", ""); - - lh.addStaticHoliday ("20-JUN-2019", ""); - - lh.addStaticHoliday ("07-SEP-2019", ""); - - lh.addStaticHoliday ("12-OCT-2019", ""); - - lh.addStaticHoliday ("02-NOV-2019", ""); - - lh.addStaticHoliday ("15-NOV-2019", ""); - - lh.addStaticHoliday ("25-DEC-2019", ""); - - lh.addStaticHoliday ("01-JAN-2020", ""); - - lh.addStaticHoliday ("24-FEB-2020", ""); - - lh.addStaticHoliday ("25-FEB-2020", ""); - - lh.addStaticHoliday ("10-APR-2020", ""); - - lh.addStaticHoliday ("21-APR-2020", ""); - - lh.addStaticHoliday ("01-MAY-2020", ""); - - lh.addStaticHoliday ("11-JUN-2020", ""); - - lh.addStaticHoliday ("07-SEP-2020", ""); - - lh.addStaticHoliday ("12-OCT-2020", ""); - - lh.addStaticHoliday ("02-NOV-2020", ""); - - lh.addStaticHoliday ("15-NOV-2020", ""); - - lh.addStaticHoliday ("25-DEC-2020", ""); - - lh.addStaticHoliday ("01-JAN-2021", ""); - - lh.addStaticHoliday ("15-FEB-2021", ""); - - lh.addStaticHoliday ("16-FEB-2021", ""); - - lh.addStaticHoliday ("02-APR-2021", ""); - - lh.addStaticHoliday ("21-APR-2021", ""); - - lh.addStaticHoliday ("01-MAY-2021", ""); - - lh.addStaticHoliday ("03-JUN-2021", ""); - - lh.addStaticHoliday ("07-SEP-2021", ""); - - lh.addStaticHoliday ("12-OCT-2021", ""); - - lh.addStaticHoliday ("02-NOV-2021", ""); - - lh.addStaticHoliday ("15-NOV-2021", ""); - - lh.addStaticHoliday ("25-DEC-2021", ""); - - lh.addStaticHoliday ("01-JAN-2022", ""); - - lh.addStaticHoliday ("28-FEB-2022", ""); - - lh.addStaticHoliday ("01-MAR-2022", ""); - - lh.addStaticHoliday ("15-APR-2022", ""); - - lh.addStaticHoliday ("21-APR-2022", ""); - - lh.addStaticHoliday ("01-MAY-2022", ""); - - lh.addStaticHoliday ("16-JUN-2022", ""); - - lh.addStaticHoliday ("07-SEP-2022", ""); - - lh.addStaticHoliday ("12-OCT-2022", ""); - - lh.addStaticHoliday ("02-NOV-2022", ""); - - lh.addStaticHoliday ("15-NOV-2022", ""); - - lh.addStaticHoliday ("25-DEC-2022", ""); - - lh.addStaticHoliday ("01-JAN-2023", ""); - - lh.addStaticHoliday ("20-FEB-2023", ""); - - lh.addStaticHoliday ("21-FEB-2023", ""); - - lh.addStaticHoliday ("07-APR-2023", ""); - - lh.addStaticHoliday ("21-APR-2023", ""); - - lh.addStaticHoliday ("01-MAY-2023", ""); - - lh.addStaticHoliday ("08-JUN-2023", ""); - - lh.addStaticHoliday ("07-SEP-2023", ""); - - lh.addStaticHoliday ("12-OCT-2023", ""); - - lh.addStaticHoliday ("02-NOV-2023", ""); - - lh.addStaticHoliday ("15-NOV-2023", ""); - - lh.addStaticHoliday ("25-DEC-2023", ""); - - lh.addStaticHoliday ("01-JAN-2024", ""); - - lh.addStaticHoliday ("12-FEB-2024", ""); - - lh.addStaticHoliday ("13-FEB-2024", ""); - - lh.addStaticHoliday ("29-MAR-2024", ""); - - lh.addStaticHoliday ("21-APR-2024", ""); - - lh.addStaticHoliday ("01-MAY-2024", ""); - - lh.addStaticHoliday ("30-MAY-2024", ""); - - lh.addStaticHoliday ("07-SEP-2024", ""); - - lh.addStaticHoliday ("12-OCT-2024", ""); - - lh.addStaticHoliday ("02-NOV-2024", ""); - - lh.addStaticHoliday ("15-NOV-2024", ""); - - lh.addStaticHoliday ("25-DEC-2024", ""); - - lh.addStaticHoliday ("01-JAN-2025", ""); - - lh.addStaticHoliday ("03-MAR-2025", ""); - - lh.addStaticHoliday ("04-MAR-2025", ""); - - lh.addStaticHoliday ("18-APR-2025", ""); - - lh.addStaticHoliday ("21-APR-2025", ""); - - lh.addStaticHoliday ("01-MAY-2025", ""); - - lh.addStaticHoliday ("19-JUN-2025", ""); - - lh.addStaticHoliday ("07-SEP-2025", ""); - - lh.addStaticHoliday ("12-OCT-2025", ""); - - lh.addStaticHoliday ("02-NOV-2025", ""); - - lh.addStaticHoliday ("15-NOV-2025", ""); - - lh.addStaticHoliday ("25-DEC-2025", ""); - - lh.addStaticHoliday ("01-JAN-2026", ""); - - lh.addStaticHoliday ("16-FEB-2026", ""); - - lh.addStaticHoliday ("17-FEB-2026", ""); - - lh.addStaticHoliday ("03-APR-2026", ""); - - lh.addStaticHoliday ("21-APR-2026", ""); - - lh.addStaticHoliday ("01-MAY-2026", ""); - - lh.addStaticHoliday ("04-JUN-2026", ""); - - lh.addStaticHoliday ("07-SEP-2026", ""); - - lh.addStaticHoliday ("12-OCT-2026", ""); - - lh.addStaticHoliday ("02-NOV-2026", ""); - - lh.addStaticHoliday ("15-NOV-2026", ""); - - lh.addStaticHoliday ("25-DEC-2026", ""); - - lh.addStaticHoliday ("01-JAN-2027", ""); - - lh.addStaticHoliday ("08-FEB-2027", ""); - - lh.addStaticHoliday ("09-FEB-2027", ""); - - lh.addStaticHoliday ("26-MAR-2027", ""); - - lh.addStaticHoliday ("21-APR-2027", ""); - - lh.addStaticHoliday ("01-MAY-2027", ""); - - lh.addStaticHoliday ("27-MAY-2027", ""); - - lh.addStaticHoliday ("07-SEP-2027", ""); - - lh.addStaticHoliday ("12-OCT-2027", ""); - - lh.addStaticHoliday ("02-NOV-2027", ""); - - lh.addStaticHoliday ("15-NOV-2027", ""); - - lh.addStaticHoliday ("25-DEC-2027", ""); - - lh.addStaticHoliday ("01-JAN-2028", ""); - - lh.addStaticHoliday ("28-FEB-2028", ""); - - lh.addStaticHoliday ("29-FEB-2028", ""); - - lh.addStaticHoliday ("14-APR-2028", ""); - - lh.addStaticHoliday ("21-APR-2028", ""); - - lh.addStaticHoliday ("01-MAY-2028", ""); - - lh.addStaticHoliday ("15-JUN-2028", ""); - - lh.addStaticHoliday ("07-SEP-2028", ""); - - lh.addStaticHoliday ("12-OCT-2028", ""); - - lh.addStaticHoliday ("02-NOV-2028", ""); - - lh.addStaticHoliday ("15-NOV-2028", ""); - - lh.addStaticHoliday ("25-DEC-2028", ""); - - lh.addStaticHoliday ("01-JAN-2029", ""); - - lh.addStaticHoliday ("12-FEB-2029", ""); - - lh.addStaticHoliday ("13-FEB-2029", ""); - - lh.addStaticHoliday ("30-MAR-2029", ""); - - lh.addStaticHoliday ("21-APR-2029", ""); - - lh.addStaticHoliday ("01-MAY-2029", ""); - - lh.addStaticHoliday ("31-MAY-2029", ""); - - lh.addStaticHoliday ("07-SEP-2029", ""); - - lh.addStaticHoliday ("12-OCT-2029", ""); - - lh.addStaticHoliday ("02-NOV-2029", ""); - - lh.addStaticHoliday ("15-NOV-2029", ""); - - lh.addStaticHoliday ("25-DEC-2029", ""); - - lh.addStaticHoliday ("01-JAN-2030", ""); - - lh.addStaticHoliday ("04-MAR-2030", ""); - - lh.addStaticHoliday ("05-MAR-2030", ""); - - lh.addStaticHoliday ("19-APR-2030", ""); - - lh.addStaticHoliday ("21-APR-2030", ""); - - lh.addStaticHoliday ("01-MAY-2030", ""); - - lh.addStaticHoliday ("20-JUN-2030", ""); - - lh.addStaticHoliday ("07-SEP-2030", ""); - - lh.addStaticHoliday ("12-OCT-2030", ""); - - lh.addStaticHoliday ("02-NOV-2030", ""); - - lh.addStaticHoliday ("15-NOV-2030", ""); - - lh.addStaticHoliday ("25-DEC-2030", ""); - - lh.addStaticHoliday ("01-JAN-2031", ""); - - lh.addStaticHoliday ("24-FEB-2031", ""); - - lh.addStaticHoliday ("25-FEB-2031", ""); - - lh.addStaticHoliday ("11-APR-2031", ""); - - lh.addStaticHoliday ("21-APR-2031", ""); - - lh.addStaticHoliday ("01-MAY-2031", ""); - - lh.addStaticHoliday ("12-JUN-2031", ""); - - lh.addStaticHoliday ("07-SEP-2031", ""); - - lh.addStaticHoliday ("12-OCT-2031", ""); - - lh.addStaticHoliday ("02-NOV-2031", ""); - - lh.addStaticHoliday ("15-NOV-2031", ""); - - lh.addStaticHoliday ("25-DEC-2031", ""); - - lh.addStaticHoliday ("01-JAN-2032", ""); - - lh.addStaticHoliday ("09-FEB-2032", ""); - - lh.addStaticHoliday ("10-FEB-2032", ""); - - lh.addStaticHoliday ("26-MAR-2032", ""); - - lh.addStaticHoliday ("21-APR-2032", ""); - - lh.addStaticHoliday ("27-MAY-2032", ""); - - lh.addStaticHoliday ("07-SEP-2032", ""); - - lh.addStaticHoliday ("12-OCT-2032", ""); - - lh.addStaticHoliday ("02-NOV-2032", ""); - - lh.addStaticHoliday ("15-NOV-2032", ""); - - lh.addStaticHoliday ("28-FEB-2033", ""); - - lh.addStaticHoliday ("01-MAR-2033", ""); - - lh.addStaticHoliday ("15-APR-2033", ""); - - lh.addStaticHoliday ("21-APR-2033", ""); - - lh.addStaticHoliday ("16-JUN-2033", ""); - - lh.addStaticHoliday ("07-SEP-2033", ""); - - lh.addStaticHoliday ("12-OCT-2033", ""); - - lh.addStaticHoliday ("02-NOV-2033", ""); - - lh.addStaticHoliday ("15-NOV-2033", ""); - - lh.addStaticHoliday ("20-FEB-2034", ""); - - lh.addStaticHoliday ("21-FEB-2034", ""); - - lh.addStaticHoliday ("07-APR-2034", ""); - - lh.addStaticHoliday ("21-APR-2034", ""); - - lh.addStaticHoliday ("01-MAY-2034", ""); - - lh.addStaticHoliday ("08-JUN-2034", ""); - - lh.addStaticHoliday ("07-SEP-2034", ""); - - lh.addStaticHoliday ("12-OCT-2034", ""); - - lh.addStaticHoliday ("02-NOV-2034", ""); - - lh.addStaticHoliday ("15-NOV-2034", ""); - - lh.addStaticHoliday ("25-DEC-2034", ""); - - lh.addStaticHoliday ("01-JAN-2035", ""); - - lh.addStaticHoliday ("05-FEB-2035", ""); - - lh.addStaticHoliday ("06-FEB-2035", ""); - - lh.addStaticHoliday ("23-MAR-2035", ""); - - lh.addStaticHoliday ("01-MAY-2035", ""); - - lh.addStaticHoliday ("24-MAY-2035", ""); - - lh.addStaticHoliday ("07-SEP-2035", ""); - - lh.addStaticHoliday ("12-OCT-2035", ""); - - lh.addStaticHoliday ("02-NOV-2035", ""); - - lh.addStaticHoliday ("15-NOV-2035", ""); - - lh.addStaticHoliday ("25-DEC-2035", ""); - - lh.addStaticHoliday ("01-JAN-2036", ""); - - lh.addStaticHoliday ("25-FEB-2036", ""); - - lh.addStaticHoliday ("26-FEB-2036", ""); - - lh.addStaticHoliday ("11-APR-2036", ""); - - lh.addStaticHoliday ("21-APR-2036", ""); - - lh.addStaticHoliday ("01-MAY-2036", ""); - - lh.addStaticHoliday ("12-JUN-2036", ""); - - lh.addStaticHoliday ("25-DEC-2036", ""); - - lh.addStaticHoliday ("01-JAN-2037", ""); - - lh.addStaticHoliday ("16-FEB-2037", ""); - - lh.addStaticHoliday ("17-FEB-2037", ""); - - lh.addStaticHoliday ("03-APR-2037", ""); - - lh.addStaticHoliday ("21-APR-2037", ""); - - lh.addStaticHoliday ("01-MAY-2037", ""); - - lh.addStaticHoliday ("04-JUN-2037", ""); - - lh.addStaticHoliday ("07-SEP-2037", ""); - - lh.addStaticHoliday ("12-OCT-2037", ""); - - lh.addStaticHoliday ("02-NOV-2037", ""); - - lh.addStaticHoliday ("25-DEC-2037", ""); - - lh.addStaticHoliday ("01-JAN-2038", ""); - - lh.addStaticHoliday ("08-MAR-2038", ""); - - lh.addStaticHoliday ("09-MAR-2038", ""); - - lh.addStaticHoliday ("21-APR-2038", ""); - - lh.addStaticHoliday ("23-APR-2038", ""); - - lh.addStaticHoliday ("24-JUN-2038", ""); - - lh.addStaticHoliday ("07-SEP-2038", ""); - - lh.addStaticHoliday ("12-OCT-2038", ""); - - lh.addStaticHoliday ("02-NOV-2038", ""); - - lh.addStaticHoliday ("15-NOV-2038", ""); - - lh.addStaticHoliday ("21-FEB-2039", ""); - - lh.addStaticHoliday ("22-FEB-2039", ""); - - lh.addStaticHoliday ("08-APR-2039", ""); - - lh.addStaticHoliday ("21-APR-2039", ""); - - lh.addStaticHoliday ("09-JUN-2039", ""); - - lh.addStaticHoliday ("07-SEP-2039", ""); - - lh.addStaticHoliday ("12-OCT-2039", ""); - - lh.addStaticHoliday ("02-NOV-2039", ""); - - lh.addStaticHoliday ("15-NOV-2039", ""); - - lh.addStaticHoliday ("13-FEB-2040", ""); - - lh.addStaticHoliday ("14-FEB-2040", ""); - - lh.addStaticHoliday ("30-MAR-2040", ""); - - lh.addStaticHoliday ("01-MAY-2040", ""); - - lh.addStaticHoliday ("31-MAY-2040", ""); - - lh.addStaticHoliday ("07-SEP-2040", ""); - - lh.addStaticHoliday ("12-OCT-2040", ""); - - lh.addStaticHoliday ("02-NOV-2040", ""); - - lh.addStaticHoliday ("15-NOV-2040", ""); - - lh.addStaticHoliday ("25-DEC-2040", ""); - - lh.addStaticHoliday ("01-JAN-2041", ""); - - lh.addStaticHoliday ("04-MAR-2041", ""); - - lh.addStaticHoliday ("05-MAR-2041", ""); - - lh.addStaticHoliday ("19-APR-2041", ""); - - lh.addStaticHoliday ("01-MAY-2041", ""); - - lh.addStaticHoliday ("20-JUN-2041", ""); - - lh.addStaticHoliday ("15-NOV-2041", ""); - - lh.addStaticHoliday ("25-DEC-2041", ""); - - lh.addStaticHoliday ("01-JAN-2042", ""); - - lh.addStaticHoliday ("17-FEB-2042", ""); - - lh.addStaticHoliday ("18-FEB-2042", ""); - - lh.addStaticHoliday ("04-APR-2042", ""); - - lh.addStaticHoliday ("21-APR-2042", ""); - - lh.addStaticHoliday ("01-MAY-2042", ""); - - lh.addStaticHoliday ("05-JUN-2042", ""); - - lh.addStaticHoliday ("25-DEC-2042", ""); - - lh.addStaticHoliday ("01-JAN-2043", ""); - - lh.addStaticHoliday ("09-FEB-2043", ""); - - lh.addStaticHoliday ("10-FEB-2043", ""); - - lh.addStaticHoliday ("27-MAR-2043", ""); - - lh.addStaticHoliday ("21-APR-2043", ""); - - lh.addStaticHoliday ("01-MAY-2043", ""); - - lh.addStaticHoliday ("28-MAY-2043", ""); - - lh.addStaticHoliday ("07-SEP-2043", ""); - - lh.addStaticHoliday ("12-OCT-2043", ""); - - lh.addStaticHoliday ("02-NOV-2043", ""); - - lh.addStaticHoliday ("25-DEC-2043", ""); - - lh.addStaticHoliday ("01-JAN-2044", ""); - - lh.addStaticHoliday ("29-FEB-2044", ""); - - lh.addStaticHoliday ("01-MAR-2044", ""); - - lh.addStaticHoliday ("15-APR-2044", ""); - - lh.addStaticHoliday ("21-APR-2044", ""); - - lh.addStaticHoliday ("16-JUN-2044", ""); - - lh.addStaticHoliday ("07-SEP-2044", ""); - - lh.addStaticHoliday ("12-OCT-2044", ""); - - lh.addStaticHoliday ("02-NOV-2044", ""); - - lh.addStaticHoliday ("15-NOV-2044", ""); - - lh.addStaticHoliday ("20-FEB-2045", ""); - - lh.addStaticHoliday ("21-FEB-2045", ""); - - lh.addStaticHoliday ("07-APR-2045", ""); - - lh.addStaticHoliday ("21-APR-2045", ""); - - lh.addStaticHoliday ("01-MAY-2045", ""); - - lh.addStaticHoliday ("08-JUN-2045", ""); - - lh.addStaticHoliday ("07-SEP-2045", ""); - - lh.addStaticHoliday ("12-OCT-2045", ""); - - lh.addStaticHoliday ("02-NOV-2045", ""); - - lh.addStaticHoliday ("15-NOV-2045", ""); - - lh.addStaticHoliday ("25-DEC-2045", ""); - - lh.addStaticHoliday ("01-JAN-2046", ""); - - lh.addStaticHoliday ("05-FEB-2046", ""); - - lh.addStaticHoliday ("06-FEB-2046", ""); - - lh.addStaticHoliday ("23-MAR-2046", ""); - - lh.addStaticHoliday ("01-MAY-2046", ""); - - lh.addStaticHoliday ("24-MAY-2046", ""); - - lh.addStaticHoliday ("07-SEP-2046", ""); - - lh.addStaticHoliday ("12-OCT-2046", ""); - - lh.addStaticHoliday ("02-NOV-2046", ""); - - lh.addStaticHoliday ("15-NOV-2046", ""); - - lh.addStaticHoliday ("25-DEC-2046", ""); - - lh.addStaticHoliday ("null", ""); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/BSDHoliday.java b/org/drip/analytics/holset/BSDHoliday.java deleted file mode 100644 index 8016968..0000000 --- a/org/drip/analytics/holset/BSDHoliday.java +++ /dev/null @@ -1,679 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class BSDHoliday implements org.drip.analytics.holset.LocationHoliday { - public BSDHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "BSD"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("01-JUN-1998", "Whit Monday"); - - lh.addStaticHoliday ("05-JUN-1998", "Labour Day"); - - lh.addStaticHoliday ("10-JUL-1998", "Independence Day"); - - lh.addStaticHoliday ("03-AUG-1998", "Emancipation Day"); - - lh.addStaticHoliday ("12-OCT-1998", "Discovery Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-1998", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("24-MAY-1999", "Whit Monday"); - - lh.addStaticHoliday ("04-JUN-1999", "Labour Day"); - - lh.addStaticHoliday ("12-JUL-1999", "Independence Day Observed"); - - lh.addStaticHoliday ("02-AUG-1999", "Emancipation Day"); - - lh.addStaticHoliday ("12-OCT-1999", "Discovery Day"); - - lh.addStaticHoliday ("27-DEC-1999", "Boxing Day Observed"); - - lh.addStaticHoliday ("28-DEC-1999", "Christmas Day Observed"); - - lh.addStaticHoliday ("03-JAN-2000", "New Years Day Observed"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("02-JUN-2000", "Labour Day"); - - lh.addStaticHoliday ("12-JUN-2000", "Whit Monday"); - - lh.addStaticHoliday ("10-JUL-2000", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2000", "Emancipation Day"); - - lh.addStaticHoliday ("12-OCT-2000", "Discovery Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("01-JUN-2001", "Labour Day"); - - lh.addStaticHoliday ("04-JUN-2001", "Whit Monday"); - - lh.addStaticHoliday ("10-JUL-2001", "Independence Day"); - - lh.addStaticHoliday ("06-AUG-2001", "Emancipation Day"); - - lh.addStaticHoliday ("12-OCT-2001", "Discovery Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("20-MAY-2002", "Whit Monday"); - - lh.addStaticHoliday ("07-JUN-2002", "Labour Day"); - - lh.addStaticHoliday ("10-JUL-2002", "Independence Day"); - - lh.addStaticHoliday ("05-AUG-2002", "Emancipation Day"); - - lh.addStaticHoliday ("14-OCT-2002", "Discovery Day Observed"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("06-JUN-2003", "Labour Day"); - - lh.addStaticHoliday ("09-JUN-2003", "Whit Monday"); - - lh.addStaticHoliday ("10-JUL-2003", "Independence Day"); - - lh.addStaticHoliday ("04-AUG-2003", "Emancipation Day"); - - lh.addStaticHoliday ("13-OCT-2003", "Discovery Day Observed"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("31-MAY-2004", "Whit Monday"); - - lh.addStaticHoliday ("04-JUN-2004", "Labour Day"); - - lh.addStaticHoliday ("12-JUL-2004", "Independence Day Observed"); - - lh.addStaticHoliday ("02-AUG-2004", "Emancipation Day"); - - lh.addStaticHoliday ("12-OCT-2004", "Discovery Day"); - - lh.addStaticHoliday ("27-DEC-2004", "Boxing Day Observed"); - - lh.addStaticHoliday ("28-DEC-2004", "Christmas Day Observed"); - - lh.addStaticHoliday ("03-JAN-2005", "New Years Day Observed"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("16-MAY-2005", "Whit Monday"); - - lh.addStaticHoliday ("03-JUN-2005", "Labour Day"); - - lh.addStaticHoliday ("11-JUL-2005", "Independence Day Observed"); - - lh.addStaticHoliday ("01-AUG-2005", "Emancipation Day"); - - lh.addStaticHoliday ("12-OCT-2005", "Discovery Day"); - - lh.addStaticHoliday ("26-DEC-2005", "Boxing Day"); - - lh.addStaticHoliday ("27-DEC-2005", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("02-JUN-2006", "Labour Day"); - - lh.addStaticHoliday ("05-JUN-2006", "Whit Monday"); - - lh.addStaticHoliday ("10-JUL-2006", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2006", "Emancipation Day"); - - lh.addStaticHoliday ("12-OCT-2006", "Discovery Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("28-MAY-2007", "Whit Monday"); - - lh.addStaticHoliday ("01-JUN-2007", "Labour Day"); - - lh.addStaticHoliday ("10-JUL-2007", "Independence Day"); - - lh.addStaticHoliday ("06-AUG-2007", "Emancipation Day"); - - lh.addStaticHoliday ("12-OCT-2007", "Discovery Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("12-MAY-2008", "Whit Monday"); - - lh.addStaticHoliday ("06-JUN-2008", "Labour Day"); - - lh.addStaticHoliday ("10-JUL-2008", "Independence Day"); - - lh.addStaticHoliday ("04-AUG-2008", "Emancipation Day"); - - lh.addStaticHoliday ("13-OCT-2008", "Discovery Day Observed"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("01-JUN-2009", "Whit Monday"); - - lh.addStaticHoliday ("05-JUN-2009", "Labour Day"); - - lh.addStaticHoliday ("10-JUL-2009", "Independence Day"); - - lh.addStaticHoliday ("03-AUG-2009", "Emancipation Day"); - - lh.addStaticHoliday ("12-OCT-2009", "Discovery Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2009", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("24-MAY-2010", "Whit Monday"); - - lh.addStaticHoliday ("04-JUN-2010", "Labour Day"); - - lh.addStaticHoliday ("12-JUL-2010", "Independence Day Observed"); - - lh.addStaticHoliday ("02-AUG-2010", "Emancipation Day"); - - lh.addStaticHoliday ("12-OCT-2010", "Discovery Day"); - - lh.addStaticHoliday ("27-DEC-2010", "Boxing Day Observed"); - - lh.addStaticHoliday ("28-DEC-2010", "Christmas Day Observed"); - - lh.addStaticHoliday ("03-JAN-2011", "New Years Day Observed"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("03-JUN-2011", "Labour Day"); - - lh.addStaticHoliday ("13-JUN-2011", "Whit Monday"); - - lh.addStaticHoliday ("11-JUL-2011", "Independence Day Observed"); - - lh.addStaticHoliday ("01-AUG-2011", "Emancipation Day"); - - lh.addStaticHoliday ("12-OCT-2011", "Discovery Day"); - - lh.addStaticHoliday ("26-DEC-2011", "Boxing Day"); - - lh.addStaticHoliday ("27-DEC-2011", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("28-MAY-2012", "Whit Monday"); - - lh.addStaticHoliday ("01-JUN-2012", "Labour Day"); - - lh.addStaticHoliday ("10-JUL-2012", "Independence Day"); - - lh.addStaticHoliday ("06-AUG-2012", "Emancipation Day"); - - lh.addStaticHoliday ("12-OCT-2012", "Discovery Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("20-MAY-2013", "Whit Monday"); - - lh.addStaticHoliday ("07-JUN-2013", "Labour Day"); - - lh.addStaticHoliday ("10-JUL-2013", "Independence Day"); - - lh.addStaticHoliday ("05-AUG-2013", "Emancipation Day"); - - lh.addStaticHoliday ("14-OCT-2013", "Discovery Day Observed"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("06-JUN-2014", "Labour Day"); - - lh.addStaticHoliday ("09-JUN-2014", "Whit Monday"); - - lh.addStaticHoliday ("10-JUL-2014", "Independence Day"); - - lh.addStaticHoliday ("04-AUG-2014", "Emancipation Day"); - - lh.addStaticHoliday ("13-OCT-2014", "Discovery Day Observed"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("25-MAY-2015", "Whit Monday"); - - lh.addStaticHoliday ("05-JUN-2015", "Labour Day"); - - lh.addStaticHoliday ("10-JUL-2015", "Independence Day"); - - lh.addStaticHoliday ("03-AUG-2015", "Emancipation Day"); - - lh.addStaticHoliday ("12-OCT-2015", "Discovery Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2015", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("16-MAY-2016", "Whit Monday"); - - lh.addStaticHoliday ("03-JUN-2016", "Labour Day"); - - lh.addStaticHoliday ("11-JUL-2016", "Independence Day Observed"); - - lh.addStaticHoliday ("01-AUG-2016", "Emancipation Day"); - - lh.addStaticHoliday ("12-OCT-2016", "Discovery Day"); - - lh.addStaticHoliday ("26-DEC-2016", "Boxing Day"); - - lh.addStaticHoliday ("27-DEC-2016", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("02-JUN-2017", "Labour Day"); - - lh.addStaticHoliday ("05-JUN-2017", "Whit Monday"); - - lh.addStaticHoliday ("10-JUL-2017", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2017", "Emancipation Day"); - - lh.addStaticHoliday ("12-OCT-2017", "Discovery Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("21-MAY-2018", "Whit Monday"); - - lh.addStaticHoliday ("01-JUN-2018", "Labour Day"); - - lh.addStaticHoliday ("10-JUL-2018", "Independence Day"); - - lh.addStaticHoliday ("06-AUG-2018", "Emancipation Day"); - - lh.addStaticHoliday ("12-OCT-2018", "Discovery Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("07-JUN-2019", "Labour Day"); - - lh.addStaticHoliday ("10-JUN-2019", "Whit Monday"); - - lh.addStaticHoliday ("10-JUL-2019", "Independence Day"); - - lh.addStaticHoliday ("05-AUG-2019", "Emancipation Day"); - - lh.addStaticHoliday ("14-OCT-2019", "Discovery Day Observed"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("01-JUN-2020", "Whit Monday"); - - lh.addStaticHoliday ("05-JUN-2020", "Labour Day"); - - lh.addStaticHoliday ("10-JUL-2020", "Independence Day"); - - lh.addStaticHoliday ("03-AUG-2020", "Emancipation Day"); - - lh.addStaticHoliday ("12-OCT-2020", "Discovery Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2020", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("24-MAY-2021", "Whit Monday"); - - lh.addStaticHoliday ("04-JUN-2021", "Labour Day"); - - lh.addStaticHoliday ("12-JUL-2021", "Independence Day Observed"); - - lh.addStaticHoliday ("02-AUG-2021", "Emancipation Day"); - - lh.addStaticHoliday ("12-OCT-2021", "Discovery Day"); - - lh.addStaticHoliday ("27-DEC-2021", "Boxing Day Observed"); - - lh.addStaticHoliday ("28-DEC-2021", "Christmas Day Observed"); - - lh.addStaticHoliday ("03-JAN-2022", "New Years Day Observed"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("03-JUN-2022", "Labour Day"); - - lh.addStaticHoliday ("06-JUN-2022", "Whit Monday"); - - lh.addStaticHoliday ("11-JUL-2022", "Independence Day Observed"); - - lh.addStaticHoliday ("01-AUG-2022", "Emancipation Day"); - - lh.addStaticHoliday ("12-OCT-2022", "Discovery Day"); - - lh.addStaticHoliday ("26-DEC-2022", "Boxing Day"); - - lh.addStaticHoliday ("27-DEC-2022", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("29-MAY-2023", "Whit Monday"); - - lh.addStaticHoliday ("02-JUN-2023", "Labour Day"); - - lh.addStaticHoliday ("10-JUL-2023", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2023", "Emancipation Day"); - - lh.addStaticHoliday ("12-OCT-2023", "Discovery Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("20-MAY-2024", "Whit Monday"); - - lh.addStaticHoliday ("07-JUN-2024", "Labour Day"); - - lh.addStaticHoliday ("10-JUL-2024", "Independence Day"); - - lh.addStaticHoliday ("05-AUG-2024", "Emancipation Day"); - - lh.addStaticHoliday ("14-OCT-2024", "Discovery Day Observed"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("06-JUN-2025", "Labour Day"); - - lh.addStaticHoliday ("09-JUN-2025", "Whit Monday"); - - lh.addStaticHoliday ("10-JUL-2025", "Independence Day"); - - lh.addStaticHoliday ("04-AUG-2025", "Emancipation Day"); - - lh.addStaticHoliday ("13-OCT-2025", "Discovery Day Observed"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("25-MAY-2026", "Whit Monday"); - - lh.addStaticHoliday ("05-JUN-2026", "Labour Day"); - - lh.addStaticHoliday ("10-JUL-2026", "Independence Day"); - - lh.addStaticHoliday ("03-AUG-2026", "Emancipation Day"); - - lh.addStaticHoliday ("12-OCT-2026", "Discovery Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2026", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("17-MAY-2027", "Whit Monday"); - - lh.addStaticHoliday ("04-JUN-2027", "Labour Day"); - - lh.addStaticHoliday ("12-JUL-2027", "Independence Day Observed"); - - lh.addStaticHoliday ("02-AUG-2027", "Emancipation Day"); - - lh.addStaticHoliday ("12-OCT-2027", "Discovery Day"); - - lh.addStaticHoliday ("27-DEC-2027", "Boxing Day Observed"); - - lh.addStaticHoliday ("28-DEC-2027", "Christmas Day Observed"); - - lh.addStaticHoliday ("03-JAN-2028", "New Years Day Observed"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("02-JUN-2028", "Labour Day"); - - lh.addStaticHoliday ("05-JUN-2028", "Whit Monday"); - - lh.addStaticHoliday ("10-JUL-2028", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2028", "Emancipation Day"); - - lh.addStaticHoliday ("12-OCT-2028", "Discovery Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Boxing Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/CADHoliday.java b/org/drip/analytics/holset/CADHoliday.java deleted file mode 100644 index 699053f..0000000 --- a/org/drip/analytics/holset/CADHoliday.java +++ /dev/null @@ -1,679 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class CADHoliday implements org.drip.analytics.holset.LocationHoliday { - public CADHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "CAD"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("18-MAY-1998", "Victoria Day"); - - lh.addStaticHoliday ("01-JUL-1998", "Canada Day"); - - lh.addStaticHoliday ("03-AUG-1998", "Civic Holiday"); - - lh.addStaticHoliday ("07-SEP-1998", "Labour Day"); - - lh.addStaticHoliday ("12-OCT-1998", "Thanksgiving Day"); - - lh.addStaticHoliday ("11-NOV-1998", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-1998", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-1999", "Victoria Day"); - - lh.addStaticHoliday ("01-JUL-1999", "Canada Day"); - - lh.addStaticHoliday ("02-AUG-1999", "Civic Holiday"); - - lh.addStaticHoliday ("06-SEP-1999", "Labour Day"); - - lh.addStaticHoliday ("11-OCT-1999", "Thanksgiving Day"); - - lh.addStaticHoliday ("11-NOV-1999", "Remembrance Day"); - - lh.addStaticHoliday ("27-DEC-1999", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-1999", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2000", "New Years Day Observed"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("22-MAY-2000", "Victoria Day"); - - lh.addStaticHoliday ("03-JUL-2000", "Canada Day Observed"); - - lh.addStaticHoliday ("07-AUG-2000", "Civic Holiday"); - - lh.addStaticHoliday ("04-SEP-2000", "Labour Day"); - - lh.addStaticHoliday ("09-OCT-2000", "Thanksgiving Day"); - - lh.addStaticHoliday ("13-NOV-2000", "Remembrance Day Observed"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("21-MAY-2001", "Victoria Day"); - - lh.addStaticHoliday ("02-JUL-2001", "Canada Day Observed"); - - lh.addStaticHoliday ("06-AUG-2001", "Civic Holiday"); - - lh.addStaticHoliday ("03-SEP-2001", "Labour Day"); - - lh.addStaticHoliday ("08-OCT-2001", "Thanksgiving Day"); - - lh.addStaticHoliday ("12-NOV-2001", "Remembrance Day Observed"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("20-MAY-2002", "Victoria Day"); - - lh.addStaticHoliday ("01-JUL-2002", "Canada Day"); - - lh.addStaticHoliday ("05-AUG-2002", "Civic Holiday"); - - lh.addStaticHoliday ("02-SEP-2002", "Labour Day"); - - lh.addStaticHoliday ("14-OCT-2002", "Thanksgiving Day"); - - lh.addStaticHoliday ("11-NOV-2002", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("19-MAY-2003", "Victoria Day"); - - lh.addStaticHoliday ("01-JUL-2003", "Canada Day"); - - lh.addStaticHoliday ("04-AUG-2003", "Civic Holiday"); - - lh.addStaticHoliday ("01-SEP-2003", "Labour Day"); - - lh.addStaticHoliday ("13-OCT-2003", "Thanksgiving Day"); - - lh.addStaticHoliday ("11-NOV-2003", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2004", "Victoria Day"); - - lh.addStaticHoliday ("01-JUL-2004", "Canada Day"); - - lh.addStaticHoliday ("02-AUG-2004", "Civic Holiday"); - - lh.addStaticHoliday ("06-SEP-2004", "Labour Day"); - - lh.addStaticHoliday ("11-OCT-2004", "Thanksgiving Day"); - - lh.addStaticHoliday ("11-NOV-2004", "Remembrance Day"); - - lh.addStaticHoliday ("27-DEC-2004", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2004", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2005", "New Years Day Observed"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("23-MAY-2005", "Victoria Day"); - - lh.addStaticHoliday ("01-JUL-2005", "Canada Day"); - - lh.addStaticHoliday ("01-AUG-2005", "Civic Holiday"); - - lh.addStaticHoliday ("05-SEP-2005", "Labour Day"); - - lh.addStaticHoliday ("10-OCT-2005", "Thanksgiving Day"); - - lh.addStaticHoliday ("11-NOV-2005", "Remembrance Day"); - - lh.addStaticHoliday ("26-DEC-2005", "Boxing Day"); - - lh.addStaticHoliday ("27-DEC-2005", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("22-MAY-2006", "Victoria Day"); - - lh.addStaticHoliday ("03-JUL-2006", "Canada Day Observed"); - - lh.addStaticHoliday ("07-AUG-2006", "Civic Holiday"); - - lh.addStaticHoliday ("04-SEP-2006", "Labour Day"); - - lh.addStaticHoliday ("09-OCT-2006", "Thanksgiving Day"); - - lh.addStaticHoliday ("13-NOV-2006", "Remembrance Day Observed"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("21-MAY-2007", "Victoria Day"); - - lh.addStaticHoliday ("02-JUL-2007", "Canada Day Observed"); - - lh.addStaticHoliday ("06-AUG-2007", "Civic Holiday"); - - lh.addStaticHoliday ("03-SEP-2007", "Labour Day"); - - lh.addStaticHoliday ("08-OCT-2007", "Thanksgiving Day"); - - lh.addStaticHoliday ("12-NOV-2007", "Remembrance Day Observed"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("19-MAY-2008", "Victoria Day"); - - lh.addStaticHoliday ("01-JUL-2008", "Canada Day"); - - lh.addStaticHoliday ("04-AUG-2008", "Civic Holiday"); - - lh.addStaticHoliday ("01-SEP-2008", "Labour Day"); - - lh.addStaticHoliday ("13-OCT-2008", "Thanksgiving Day"); - - lh.addStaticHoliday ("11-NOV-2008", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("18-MAY-2009", "Victoria Day"); - - lh.addStaticHoliday ("01-JUL-2009", "Canada Day"); - - lh.addStaticHoliday ("03-AUG-2009", "Civic Holiday"); - - lh.addStaticHoliday ("07-SEP-2009", "Labour Day"); - - lh.addStaticHoliday ("12-OCT-2009", "Thanksgiving Day"); - - lh.addStaticHoliday ("11-NOV-2009", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2009", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2010", "Victoria Day"); - - lh.addStaticHoliday ("01-JUL-2010", "Canada Day"); - - lh.addStaticHoliday ("02-AUG-2010", "Civic Holiday"); - - lh.addStaticHoliday ("06-SEP-2010", "Labour Day"); - - lh.addStaticHoliday ("11-OCT-2010", "Thanksgiving Day"); - - lh.addStaticHoliday ("11-NOV-2010", "Remembrance Day"); - - lh.addStaticHoliday ("27-DEC-2010", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2010", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2011", "New Years Day Observed"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("23-MAY-2011", "Victoria Day"); - - lh.addStaticHoliday ("01-JUL-2011", "Canada Day"); - - lh.addStaticHoliday ("01-AUG-2011", "Civic Holiday"); - - lh.addStaticHoliday ("05-SEP-2011", "Labour Day"); - - lh.addStaticHoliday ("10-OCT-2011", "Thanksgiving Day"); - - lh.addStaticHoliday ("11-NOV-2011", "Remembrance Day"); - - lh.addStaticHoliday ("26-DEC-2011", "Boxing Day"); - - lh.addStaticHoliday ("27-DEC-2011", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("21-MAY-2012", "Victoria Day"); - - lh.addStaticHoliday ("02-JUL-2012", "Canada Day Observed"); - - lh.addStaticHoliday ("06-AUG-2012", "Civic Holiday"); - - lh.addStaticHoliday ("03-SEP-2012", "Labour Day"); - - lh.addStaticHoliday ("08-OCT-2012", "Thanksgiving Day"); - - lh.addStaticHoliday ("12-NOV-2012", "Remembrance Day Observed"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("20-MAY-2013", "Victoria Day"); - - lh.addStaticHoliday ("01-JUL-2013", "Canada Day"); - - lh.addStaticHoliday ("05-AUG-2013", "Civic Holiday"); - - lh.addStaticHoliday ("02-SEP-2013", "Labour Day"); - - lh.addStaticHoliday ("14-OCT-2013", "Thanksgiving Day"); - - lh.addStaticHoliday ("11-NOV-2013", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("19-MAY-2014", "Victoria Day"); - - lh.addStaticHoliday ("01-JUL-2014", "Canada Day"); - - lh.addStaticHoliday ("04-AUG-2014", "Civic Holiday"); - - lh.addStaticHoliday ("01-SEP-2014", "Labour Day"); - - lh.addStaticHoliday ("13-OCT-2014", "Thanksgiving Day"); - - lh.addStaticHoliday ("11-NOV-2014", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("18-MAY-2015", "Victoria Day"); - - lh.addStaticHoliday ("01-JUL-2015", "Canada Day"); - - lh.addStaticHoliday ("03-AUG-2015", "Civic Holiday"); - - lh.addStaticHoliday ("07-SEP-2015", "Labour Day"); - - lh.addStaticHoliday ("12-OCT-2015", "Thanksgiving Day"); - - lh.addStaticHoliday ("11-NOV-2015", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2015", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("23-MAY-2016", "Victoria Day"); - - lh.addStaticHoliday ("01-JUL-2016", "Canada Day"); - - lh.addStaticHoliday ("01-AUG-2016", "Civic Holiday"); - - lh.addStaticHoliday ("05-SEP-2016", "Labour Day"); - - lh.addStaticHoliday ("10-OCT-2016", "Thanksgiving Day"); - - lh.addStaticHoliday ("11-NOV-2016", "Remembrance Day"); - - lh.addStaticHoliday ("26-DEC-2016", "Boxing Day"); - - lh.addStaticHoliday ("27-DEC-2016", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("22-MAY-2017", "Victoria Day"); - - lh.addStaticHoliday ("03-JUL-2017", "Canada Day Observed"); - - lh.addStaticHoliday ("07-AUG-2017", "Civic Holiday"); - - lh.addStaticHoliday ("04-SEP-2017", "Labour Day"); - - lh.addStaticHoliday ("09-OCT-2017", "Thanksgiving Day"); - - lh.addStaticHoliday ("13-NOV-2017", "Remembrance Day Observed"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("21-MAY-2018", "Victoria Day"); - - lh.addStaticHoliday ("02-JUL-2018", "Canada Day Observed"); - - lh.addStaticHoliday ("06-AUG-2018", "Civic Holiday"); - - lh.addStaticHoliday ("03-SEP-2018", "Labour Day"); - - lh.addStaticHoliday ("08-OCT-2018", "Thanksgiving Day"); - - lh.addStaticHoliday ("12-NOV-2018", "Remembrance Day Observed"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("20-MAY-2019", "Victoria Day"); - - lh.addStaticHoliday ("01-JUL-2019", "Canada Day"); - - lh.addStaticHoliday ("05-AUG-2019", "Civic Holiday"); - - lh.addStaticHoliday ("02-SEP-2019", "Labour Day"); - - lh.addStaticHoliday ("14-OCT-2019", "Thanksgiving Day"); - - lh.addStaticHoliday ("11-NOV-2019", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("18-MAY-2020", "Victoria Day"); - - lh.addStaticHoliday ("01-JUL-2020", "Canada Day"); - - lh.addStaticHoliday ("03-AUG-2020", "Civic Holiday"); - - lh.addStaticHoliday ("07-SEP-2020", "Labour Day"); - - lh.addStaticHoliday ("12-OCT-2020", "Thanksgiving Day"); - - lh.addStaticHoliday ("11-NOV-2020", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2020", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2021", "Victoria Day"); - - lh.addStaticHoliday ("01-JUL-2021", "Canada Day"); - - lh.addStaticHoliday ("02-AUG-2021", "Civic Holiday"); - - lh.addStaticHoliday ("06-SEP-2021", "Labour Day"); - - lh.addStaticHoliday ("11-OCT-2021", "Thanksgiving Day"); - - lh.addStaticHoliday ("11-NOV-2021", "Remembrance Day"); - - lh.addStaticHoliday ("27-DEC-2021", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2021", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2022", "New Years Day Observed"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("23-MAY-2022", "Victoria Day"); - - lh.addStaticHoliday ("01-JUL-2022", "Canada Day"); - - lh.addStaticHoliday ("01-AUG-2022", "Civic Holiday"); - - lh.addStaticHoliday ("05-SEP-2022", "Labour Day"); - - lh.addStaticHoliday ("10-OCT-2022", "Thanksgiving Day"); - - lh.addStaticHoliday ("11-NOV-2022", "Remembrance Day"); - - lh.addStaticHoliday ("26-DEC-2022", "Boxing Day"); - - lh.addStaticHoliday ("27-DEC-2022", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("22-MAY-2023", "Victoria Day"); - - lh.addStaticHoliday ("03-JUL-2023", "Canada Day Observed"); - - lh.addStaticHoliday ("07-AUG-2023", "Civic Holiday"); - - lh.addStaticHoliday ("04-SEP-2023", "Labour Day"); - - lh.addStaticHoliday ("09-OCT-2023", "Thanksgiving Day"); - - lh.addStaticHoliday ("13-NOV-2023", "Remembrance Day Observed"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("20-MAY-2024", "Victoria Day"); - - lh.addStaticHoliday ("01-JUL-2024", "Canada Day"); - - lh.addStaticHoliday ("05-AUG-2024", "Civic Holiday"); - - lh.addStaticHoliday ("02-SEP-2024", "Labour Day"); - - lh.addStaticHoliday ("14-OCT-2024", "Thanksgiving Day"); - - lh.addStaticHoliday ("11-NOV-2024", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("19-MAY-2025", "Victoria Day"); - - lh.addStaticHoliday ("01-JUL-2025", "Canada Day"); - - lh.addStaticHoliday ("04-AUG-2025", "Civic Holiday"); - - lh.addStaticHoliday ("01-SEP-2025", "Labour Day"); - - lh.addStaticHoliday ("13-OCT-2025", "Thanksgiving Day"); - - lh.addStaticHoliday ("11-NOV-2025", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("18-MAY-2026", "Victoria Day"); - - lh.addStaticHoliday ("01-JUL-2026", "Canada Day"); - - lh.addStaticHoliday ("03-AUG-2026", "Civic Holiday"); - - lh.addStaticHoliday ("07-SEP-2026", "Labour Day"); - - lh.addStaticHoliday ("12-OCT-2026", "Thanksgiving Day"); - - lh.addStaticHoliday ("11-NOV-2026", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2026", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2027", "Victoria Day"); - - lh.addStaticHoliday ("01-JUL-2027", "Canada Day"); - - lh.addStaticHoliday ("02-AUG-2027", "Civic Holiday"); - - lh.addStaticHoliday ("06-SEP-2027", "Labour Day"); - - lh.addStaticHoliday ("11-OCT-2027", "Thanksgiving Day"); - - lh.addStaticHoliday ("11-NOV-2027", "Remembrance Day"); - - lh.addStaticHoliday ("27-DEC-2027", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2027", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2028", "New Years Day Observed"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("22-MAY-2028", "Victoria Day"); - - lh.addStaticHoliday ("03-JUL-2028", "Canada Day Observed"); - - lh.addStaticHoliday ("07-AUG-2028", "Civic Holiday"); - - lh.addStaticHoliday ("04-SEP-2028", "Labour Day"); - - lh.addStaticHoliday ("09-OCT-2028", "Thanksgiving Day"); - - lh.addStaticHoliday ("13-NOV-2028", "Remembrance Day Observed"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Boxing Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/CAEHoliday.java b/org/drip/analytics/holset/CAEHoliday.java deleted file mode 100644 index 86edd5c..0000000 --- a/org/drip/analytics/holset/CAEHoliday.java +++ /dev/null @@ -1,301 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class CAEHoliday implements org.drip.analytics.holset.LocationHoliday { - public CAEHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "CAE"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("14-APR-1995", "holiday"); - - lh.addStaticHoliday ("22-MAY-1995", "holiday"); - - lh.addStaticHoliday ("30-MAY-1995", "holiday"); - - lh.addStaticHoliday ("07-AUG-1995", "holiday"); - - lh.addStaticHoliday ("04-SEP-1995", "holiday"); - - lh.addStaticHoliday ("09-OCT-1995", "holiday"); - - lh.addStaticHoliday ("13-NOV-1995", "holiday"); - - lh.addStaticHoliday ("25-DEC-1995", "holiday"); - - lh.addStaticHoliday ("26-DEC-1995", "holiday"); - - lh.addStaticHoliday ("27-DEC-1995", "holiday"); - - lh.addStaticHoliday ("02-JAN-1996", "holiday"); - - lh.addStaticHoliday ("03-JAN-1996", "holiday"); - - lh.addStaticHoliday ("05-APR-1996", "holiday"); - - lh.addStaticHoliday ("27-MAY-1996", "holiday"); - - lh.addStaticHoliday ("30-MAY-1996", "holiday"); - - lh.addStaticHoliday ("24-JUN-1996", "holiday"); - - lh.addStaticHoliday ("01-JUL-1996", "holiday"); - - lh.addStaticHoliday ("05-AUG-1996", "holiday"); - - lh.addStaticHoliday ("02-SEP-1996", "holiday"); - - lh.addStaticHoliday ("14-OCT-1996", "holiday"); - - lh.addStaticHoliday ("11-NOV-1996", "holiday"); - - lh.addStaticHoliday ("25-DEC-1996", "holiday"); - - lh.addStaticHoliday ("26-DEC-1996", "holiday"); - - lh.addStaticHoliday ("27-DEC-1996", "holiday"); - - lh.addStaticHoliday ("02-JAN-1997", "holiday"); - - lh.addStaticHoliday ("03-JAN-1997", "holiday"); - - lh.addStaticHoliday ("28-MAR-1997", "holiday"); - - lh.addStaticHoliday ("26-MAY-1997", "holiday"); - - lh.addStaticHoliday ("30-MAY-1997", "holiday"); - - lh.addStaticHoliday ("24-JUN-1997", "holiday"); - - lh.addStaticHoliday ("01-JUL-1997", "holiday"); - - lh.addStaticHoliday ("04-AUG-1997", "holiday"); - - lh.addStaticHoliday ("01-SEP-1997", "holiday"); - - lh.addStaticHoliday ("13-OCT-1997", "holiday"); - - lh.addStaticHoliday ("11-NOV-1997", "holiday"); - - lh.addStaticHoliday ("25-DEC-1997", "holiday"); - - lh.addStaticHoliday ("26-DEC-1997", "holiday"); - - lh.addStaticHoliday ("29-DEC-1997", "holiday"); - - lh.addStaticHoliday ("02-JAN-1998", "holiday"); - - lh.addStaticHoliday ("10-APR-1998", "holiday"); - - lh.addStaticHoliday ("25-MAY-1998", "holiday"); - - lh.addStaticHoliday ("24-JUN-1998", "holiday"); - - lh.addStaticHoliday ("01-JUL-1998", "holiday"); - - lh.addStaticHoliday ("03-AUG-1998", "holiday"); - - lh.addStaticHoliday ("07-SEP-1998", "holiday"); - - lh.addStaticHoliday ("12-OCT-1998", "holiday"); - - lh.addStaticHoliday ("11-NOV-1998", "holiday"); - - lh.addStaticHoliday ("25-DEC-1998", "holiday"); - - lh.addStaticHoliday ("28-DEC-1998", "holiday"); - - lh.addStaticHoliday ("02-APR-1999", "holiday"); - - lh.addStaticHoliday ("24-MAY-1999", "holiday"); - - lh.addStaticHoliday ("31-MAY-1999", "holiday"); - - lh.addStaticHoliday ("24-JUN-1999", "holiday"); - - lh.addStaticHoliday ("01-JUL-1999", "holiday"); - - lh.addStaticHoliday ("02-AUG-1999", "holiday"); - - lh.addStaticHoliday ("06-SEP-1999", "holiday"); - - lh.addStaticHoliday ("11-OCT-1999", "holiday"); - - lh.addStaticHoliday ("11-NOV-1999", "holiday"); - - lh.addStaticHoliday ("27-DEC-1999", "holiday"); - - lh.addStaticHoliday ("03-JAN-2000", "holiday"); - - lh.addStaticHoliday ("21-APR-2000", "holiday"); - - lh.addStaticHoliday ("22-MAY-2000", "holiday"); - - lh.addStaticHoliday ("30-MAY-2000", "holiday"); - - lh.addStaticHoliday ("07-AUG-2000", "holiday"); - - lh.addStaticHoliday ("04-SEP-2000", "holiday"); - - lh.addStaticHoliday ("09-OCT-2000", "holiday"); - - lh.addStaticHoliday ("13-NOV-2000", "holiday"); - - lh.addStaticHoliday ("25-DEC-2000", "holiday"); - - lh.addStaticHoliday ("26-DEC-2000", "holiday"); - - lh.addStaticHoliday ("27-DEC-2000", "holiday"); - - lh.addStaticHoliday ("02-JAN-2001", "holiday"); - - lh.addStaticHoliday ("03-JAN-2001", "holiday"); - - lh.addStaticHoliday ("13-APR-2001", "holiday"); - - lh.addStaticHoliday ("28-MAY-2001", "holiday"); - - lh.addStaticHoliday ("30-MAY-2001", "holiday"); - - lh.addStaticHoliday ("06-AUG-2001", "holiday"); - - lh.addStaticHoliday ("03-SEP-2001", "holiday"); - - lh.addStaticHoliday ("08-OCT-2001", "holiday"); - - lh.addStaticHoliday ("12-NOV-2001", "holiday"); - - lh.addStaticHoliday ("25-DEC-2001", "holiday"); - - lh.addStaticHoliday ("26-DEC-2001", "holiday"); - - lh.addStaticHoliday ("27-DEC-2001", "holiday"); - - lh.addStaticHoliday ("02-JAN-2002", "holiday"); - - lh.addStaticHoliday ("03-JAN-2002", "holiday"); - - lh.addStaticHoliday ("27-MAY-2002", "holiday"); - - lh.addStaticHoliday ("30-MAY-2002", "holiday"); - - lh.addStaticHoliday ("24-JUN-2002", "holiday"); - - lh.addStaticHoliday ("01-JUL-2002", "holiday"); - - lh.addStaticHoliday ("05-AUG-2002", "holiday"); - - lh.addStaticHoliday ("02-SEP-2002", "holiday"); - - lh.addStaticHoliday ("14-OCT-2002", "holiday"); - - lh.addStaticHoliday ("11-NOV-2002", "holiday"); - - lh.addStaticHoliday ("25-DEC-2002", "holiday"); - - lh.addStaticHoliday ("26-DEC-2002", "holiday"); - - lh.addStaticHoliday ("27-DEC-2002", "holiday"); - - lh.addStaticHoliday ("02-JAN-2003", "holiday"); - - lh.addStaticHoliday ("03-JAN-2003", "holiday"); - - lh.addStaticHoliday ("18-APR-2003", "holiday"); - - lh.addStaticHoliday ("26-MAY-2003", "holiday"); - - lh.addStaticHoliday ("30-MAY-2003", "holiday"); - - lh.addStaticHoliday ("24-JUN-2003", "holiday"); - - lh.addStaticHoliday ("01-JUL-2003", "holiday"); - - lh.addStaticHoliday ("04-AUG-2003", "holiday"); - - lh.addStaticHoliday ("01-SEP-2003", "holiday"); - - lh.addStaticHoliday ("13-OCT-2003", "holiday"); - - lh.addStaticHoliday ("11-NOV-2003", "holiday"); - - lh.addStaticHoliday ("25-DEC-2003", "holiday"); - - lh.addStaticHoliday ("26-DEC-2003", "holiday"); - - lh.addStaticHoliday ("29-DEC-2003", "holiday"); - - lh.addStaticHoliday ("02-JAN-2004", "holiday"); - - lh.addStaticHoliday ("09-APR-2004", "holiday"); - - lh.addStaticHoliday ("24-MAY-2004", "holiday"); - - lh.addStaticHoliday ("31-MAY-2004", "holiday"); - - lh.addStaticHoliday ("24-JUN-2004", "holiday"); - - lh.addStaticHoliday ("01-JUL-2004", "holiday"); - - lh.addStaticHoliday ("02-AUG-2004", "holiday"); - - lh.addStaticHoliday ("06-SEP-2004", "holiday"); - - lh.addStaticHoliday ("11-OCT-2004", "holiday"); - - lh.addStaticHoliday ("11-NOV-2004", "holiday"); - - lh.addStaticHoliday ("27-DEC-2004", "holiday"); - - lh.addStaticHoliday ("03-JAN-2005", "holiday"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/CERHoliday.java b/org/drip/analytics/holset/CERHoliday.java deleted file mode 100644 index 0e1af01..0000000 --- a/org/drip/analytics/holset/CERHoliday.java +++ /dev/null @@ -1,1369 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class CERHoliday implements org.drip.analytics.holset.LocationHoliday { - public CERHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "CER"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-1999", "Liberation Day"); - - lh.addStaticHoliday ("14-JUN-1999", "Malvinas Islands Memorial Day Observed"); - - lh.addStaticHoliday ("21-JUN-1999", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-1999", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-1999", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("11-OCT-1999", "Day of the Race Observed"); - - lh.addStaticHoliday ("08-DEC-1999", "Immaculate Conception"); - - lh.addStaticHoliday ("31-DEC-1999", "Last Weekday of the Year"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2000", "Liberation Day"); - - lh.addStaticHoliday ("19-JUN-2000", "Flag Day"); - - lh.addStaticHoliday ("21-AUG-2000", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("16-OCT-2000", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2000", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2000", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2000", "Last Weekday of the Year"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2001", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2001", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2001", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2001", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2001", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("08-OCT-2001", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2001", "Bank Holiday"); - - lh.addStaticHoliday ("21-DEC-2001", "Special Holiday"); - - lh.addStaticHoliday ("24-DEC-2001", "Special Holiday"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Special Holiday"); - - lh.addStaticHoliday ("31-DEC-2001", "Special Holiday"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2002", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("17-JUN-2002", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2002", "Independence Day"); - - lh.addStaticHoliday ("19-AUG-2002", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("31-MAR-2003", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("16-JUN-2003", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2003", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-2003", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("13-OCT-2003", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2003", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2003", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("05-APR-2004", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2004", "Liberation Day"); - - lh.addStaticHoliday ("21-JUN-2004", "Flag Day"); - - lh.addStaticHoliday ("02-JUL-2004", "Special Holiday"); - - lh.addStaticHoliday ("05-JUL-2004", "Special Holiday"); - - lh.addStaticHoliday ("09-JUL-2004", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2004", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("11-OCT-2004", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2004", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2005", "Liberation Day"); - - lh.addStaticHoliday ("20-JUN-2005", "Flag Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("10-OCT-2005", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2005", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2006", "Memorial Day"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2006", "Liberation Day"); - - lh.addStaticHoliday ("19-JUN-2006", "Flag Day"); - - lh.addStaticHoliday ("21-AUG-2006", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("16-OCT-2006", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2006", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2006", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2007", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2007", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2007", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2007", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2007", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("15-OCT-2007", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2007", "Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Memorial Day"); - - lh.addStaticHoliday ("02-APR-2008", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("16-JUN-2008", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2008", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-2008", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("06-NOV-2008", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2009", "Memorial Day"); - - lh.addStaticHoliday ("02-APR-2009", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2009", "Liberation Day"); - - lh.addStaticHoliday ("15-JUN-2009", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2009", "Independence Day"); - - lh.addStaticHoliday ("17-AUG-2009", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("12-OCT-2009", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2009", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2009", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2010", "Memorial Day"); - - lh.addStaticHoliday ("01-APR-2010", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2010", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("25-MAY-2010", "Liberation Day"); - - lh.addStaticHoliday ("21-JUN-2010", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2010", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2010", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("11-OCT-2010", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2010", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2011", "Memorial Day"); - - lh.addStaticHoliday ("21-APR-2011", "Holy Thursday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2011", "Liberation Day"); - - lh.addStaticHoliday ("20-JUN-2011", "Flag Day"); - - lh.addStaticHoliday ("15-AUG-2011", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("10-OCT-2011", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2011", "Immaculate Conception"); - - lh.addStaticHoliday ("02-APR-2012", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("05-APR-2012", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2012", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2012", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2012", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2012", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("15-OCT-2012", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2012", "Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2013", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2013", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("17-JUN-2013", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2013", "Independence Day"); - - lh.addStaticHoliday ("19-AUG-2013", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("06-NOV-2013", "Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2014", "Memorial Day"); - - lh.addStaticHoliday ("02-APR-2014", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("17-APR-2014", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("16-JUN-2014", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2014", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-2014", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("06-NOV-2014", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2014", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2015", "Memorial Day"); - - lh.addStaticHoliday ("02-APR-2015", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2015", "Liberation Day"); - - lh.addStaticHoliday ("15-JUN-2015", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2015", "Independence Day"); - - lh.addStaticHoliday ("17-AUG-2015", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("12-OCT-2015", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2015", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2015", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2016", "Memorial Day"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2016", "Liberation Day"); - - lh.addStaticHoliday ("20-JUN-2016", "Flag Day"); - - lh.addStaticHoliday ("15-AUG-2016", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("10-OCT-2016", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2016", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2017", "Memorial Day"); - - lh.addStaticHoliday ("13-APR-2017", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2017", "Liberation Day"); - - lh.addStaticHoliday ("19-JUN-2017", "Flag Day"); - - lh.addStaticHoliday ("21-AUG-2017", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("16-OCT-2017", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2017", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2017", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2018", "Holy Thursday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2018", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2018", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2018", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2018", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2018", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("15-OCT-2018", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2018", "Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2019", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("18-APR-2019", "Holy Thursday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("17-JUN-2019", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2019", "Independence Day"); - - lh.addStaticHoliday ("19-AUG-2019", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("06-NOV-2019", "Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2020", "Memorial Day"); - - lh.addStaticHoliday ("02-APR-2020", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("09-APR-2020", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2020", "Liberation Day"); - - lh.addStaticHoliday ("15-JUN-2020", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2020", "Independence Day"); - - lh.addStaticHoliday ("17-AUG-2020", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("12-OCT-2020", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2020", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2020", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2021", "Memorial Day"); - - lh.addStaticHoliday ("01-APR-2021", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2021", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("25-MAY-2021", "Liberation Day"); - - lh.addStaticHoliday ("21-JUN-2021", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2021", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2021", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("11-OCT-2021", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2021", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2022", "Memorial Day"); - - lh.addStaticHoliday ("14-APR-2022", "Holy Thursday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2022", "Liberation Day"); - - lh.addStaticHoliday ("20-JUN-2022", "Flag Day"); - - lh.addStaticHoliday ("15-AUG-2022", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("10-OCT-2022", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2022", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2023", "Memorial Day"); - - lh.addStaticHoliday ("06-APR-2023", "Holy Thursday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2023", "Liberation Day"); - - lh.addStaticHoliday ("19-JUN-2023", "Flag Day"); - - lh.addStaticHoliday ("21-AUG-2023", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("16-OCT-2023", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2023", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2023", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2024", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2024", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("17-JUN-2024", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2024", "Independence Day"); - - lh.addStaticHoliday ("19-AUG-2024", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("06-NOV-2024", "Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2025", "Memorial Day"); - - lh.addStaticHoliday ("02-APR-2025", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("17-APR-2025", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("16-JUN-2025", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2025", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-2025", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("06-NOV-2025", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2025", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2026", "Memorial Day"); - - lh.addStaticHoliday ("02-APR-2026", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2026", "Liberation Day"); - - lh.addStaticHoliday ("15-JUN-2026", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2026", "Independence Day"); - - lh.addStaticHoliday ("17-AUG-2026", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("12-OCT-2026", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2026", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2026", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2027", "Memorial Day"); - - lh.addStaticHoliday ("25-MAR-2027", "Holy Thursday"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2027", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("25-MAY-2027", "Liberation Day"); - - lh.addStaticHoliday ("21-JUN-2027", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2027", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2027", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("11-OCT-2027", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2027", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2028", "Memorial Day"); - - lh.addStaticHoliday ("13-APR-2028", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2028", "Liberation Day"); - - lh.addStaticHoliday ("19-JUN-2028", "Flag Day"); - - lh.addStaticHoliday ("21-AUG-2028", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("16-OCT-2028", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2028", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2028", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2029", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2029", "Holy Thursday"); - - lh.addStaticHoliday ("30-MAR-2029", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2029", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("01-MAY-2029", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2029", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2029", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2029", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2029", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("15-OCT-2029", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2029", "Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2029", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2030", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2030", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("18-APR-2030", "Holy Thursday"); - - lh.addStaticHoliday ("19-APR-2030", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2030", "Labour Day"); - - lh.addStaticHoliday ("17-JUN-2030", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2030", "Independence Day"); - - lh.addStaticHoliday ("19-AUG-2030", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("06-NOV-2030", "Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2030", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2031", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2031", "Memorial Day"); - - lh.addStaticHoliday ("02-APR-2031", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("10-APR-2031", "Holy Thursday"); - - lh.addStaticHoliday ("11-APR-2031", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2031", "Labour Day"); - - lh.addStaticHoliday ("16-JUN-2031", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2031", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-2031", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("06-NOV-2031", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2031", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2031", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2032", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2032", "Memorial Day"); - - lh.addStaticHoliday ("25-MAR-2032", "Holy Thursday"); - - lh.addStaticHoliday ("26-MAR-2032", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2032", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("25-MAY-2032", "Liberation Day"); - - lh.addStaticHoliday ("21-JUN-2032", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2032", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2032", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("11-OCT-2032", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2032", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2033", "Memorial Day"); - - lh.addStaticHoliday ("14-APR-2033", "Holy Thursday"); - - lh.addStaticHoliday ("15-APR-2033", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2033", "Liberation Day"); - - lh.addStaticHoliday ("20-JUN-2033", "Flag Day"); - - lh.addStaticHoliday ("15-AUG-2033", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("10-OCT-2033", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2033", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2034", "Memorial Day"); - - lh.addStaticHoliday ("06-APR-2034", "Holy Thursday"); - - lh.addStaticHoliday ("07-APR-2034", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2034", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2034", "Liberation Day"); - - lh.addStaticHoliday ("19-JUN-2034", "Flag Day"); - - lh.addStaticHoliday ("21-AUG-2034", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("16-OCT-2034", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2034", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2034", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2034", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2035", "New Years Day"); - - lh.addStaticHoliday ("22-MAR-2035", "Holy Thursday"); - - lh.addStaticHoliday ("23-MAR-2035", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2035", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("01-MAY-2035", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2035", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2035", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2035", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2035", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("15-OCT-2035", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2035", "Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2035", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2036", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2036", "Memorial Day"); - - lh.addStaticHoliday ("02-APR-2036", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("10-APR-2036", "Holy Thursday"); - - lh.addStaticHoliday ("11-APR-2036", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2036", "Labour Day"); - - lh.addStaticHoliday ("16-JUN-2036", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2036", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-2036", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("06-NOV-2036", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2036", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2036", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2037", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2037", "Memorial Day"); - - lh.addStaticHoliday ("02-APR-2037", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("03-APR-2037", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2037", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2037", "Liberation Day"); - - lh.addStaticHoliday ("15-JUN-2037", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2037", "Independence Day"); - - lh.addStaticHoliday ("17-AUG-2037", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("12-OCT-2037", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2037", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2037", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2037", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2038", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2038", "Memorial Day"); - - lh.addStaticHoliday ("02-APR-2038", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("22-APR-2038", "Holy Thursday"); - - lh.addStaticHoliday ("23-APR-2038", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2038", "Liberation Day"); - - lh.addStaticHoliday ("21-JUN-2038", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2038", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2038", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("11-OCT-2038", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2038", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2039", "Memorial Day"); - - lh.addStaticHoliday ("07-APR-2039", "Holy Thursday"); - - lh.addStaticHoliday ("08-APR-2039", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2039", "Liberation Day"); - - lh.addStaticHoliday ("20-JUN-2039", "Flag Day"); - - lh.addStaticHoliday ("15-AUG-2039", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("10-OCT-2039", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2039", "Immaculate Conception"); - - lh.addStaticHoliday ("29-MAR-2040", "Holy Thursday"); - - lh.addStaticHoliday ("30-MAR-2040", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2040", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("01-MAY-2040", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2040", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2040", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2040", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2040", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("15-OCT-2040", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2040", "Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2040", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2041", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2041", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("18-APR-2041", "Holy Thursday"); - - lh.addStaticHoliday ("19-APR-2041", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2041", "Labour Day"); - - lh.addStaticHoliday ("17-JUN-2041", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2041", "Independence Day"); - - lh.addStaticHoliday ("19-AUG-2041", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("06-NOV-2041", "Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2041", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2042", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2042", "Memorial Day"); - - lh.addStaticHoliday ("02-APR-2042", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("03-APR-2042", "Holy Thursday"); - - lh.addStaticHoliday ("04-APR-2042", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2042", "Labour Day"); - - lh.addStaticHoliday ("16-JUN-2042", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2042", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-2042", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("06-NOV-2042", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2042", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2042", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2043", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2043", "Memorial Day"); - - lh.addStaticHoliday ("26-MAR-2043", "Holy Thursday"); - - lh.addStaticHoliday ("27-MAR-2043", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2043", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("01-MAY-2043", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2043", "Liberation Day"); - - lh.addStaticHoliday ("15-JUN-2043", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2043", "Independence Day"); - - lh.addStaticHoliday ("17-AUG-2043", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("12-OCT-2043", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2043", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2043", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2043", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2044", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2044", "Memorial Day"); - - lh.addStaticHoliday ("14-APR-2044", "Holy Thursday"); - - lh.addStaticHoliday ("15-APR-2044", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2044", "Liberation Day"); - - lh.addStaticHoliday ("20-JUN-2044", "Flag Day"); - - lh.addStaticHoliday ("15-AUG-2044", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("10-OCT-2044", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2044", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2045", "Memorial Day"); - - lh.addStaticHoliday ("06-APR-2045", "Holy Thursday"); - - lh.addStaticHoliday ("07-APR-2045", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2045", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2045", "Liberation Day"); - - lh.addStaticHoliday ("19-JUN-2045", "Flag Day"); - - lh.addStaticHoliday ("21-AUG-2045", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("16-OCT-2045", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2045", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2045", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2045", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2046", "New Years Day"); - - lh.addStaticHoliday ("22-MAR-2046", "Holy Thursday"); - - lh.addStaticHoliday ("23-MAR-2046", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2046", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("01-MAY-2046", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2046", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2046", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2046", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2046", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("15-OCT-2046", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2046", "Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2046", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2047", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2047", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("11-APR-2047", "Holy Thursday"); - - lh.addStaticHoliday ("12-APR-2047", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2047", "Labour Day"); - - lh.addStaticHoliday ("17-JUN-2047", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2047", "Independence Day"); - - lh.addStaticHoliday ("19-AUG-2047", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("06-NOV-2047", "Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2047", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2048", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2048", "Memorial Day"); - - lh.addStaticHoliday ("02-APR-2048", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("03-APR-2048", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2048", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2048", "Liberation Day"); - - lh.addStaticHoliday ("15-JUN-2048", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2048", "Independence Day"); - - lh.addStaticHoliday ("17-AUG-2048", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("12-OCT-2048", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2048", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2048", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2048", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2049", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2049", "Memorial Day"); - - lh.addStaticHoliday ("02-APR-2049", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("15-APR-2049", "Holy Thursday"); - - lh.addStaticHoliday ("16-APR-2049", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2049", "Liberation Day"); - - lh.addStaticHoliday ("21-JUN-2049", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2049", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2049", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("11-OCT-2049", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2049", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2050", "Memorial Day"); - - lh.addStaticHoliday ("07-APR-2050", "Holy Thursday"); - - lh.addStaticHoliday ("08-APR-2050", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2050", "Liberation Day"); - - lh.addStaticHoliday ("20-JUN-2050", "Flag Day"); - - lh.addStaticHoliday ("15-AUG-2050", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("10-OCT-2050", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2050", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2051", "Memorial Day"); - - lh.addStaticHoliday ("30-MAR-2051", "Holy Thursday"); - - lh.addStaticHoliday ("31-MAR-2051", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2051", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2051", "Liberation Day"); - - lh.addStaticHoliday ("19-JUN-2051", "Flag Day"); - - lh.addStaticHoliday ("21-AUG-2051", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("16-OCT-2051", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2051", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2051", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2051", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2052", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2052", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("18-APR-2052", "Holy Thursday"); - - lh.addStaticHoliday ("19-APR-2052", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2052", "Labour Day"); - - lh.addStaticHoliday ("17-JUN-2052", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2052", "Independence Day"); - - lh.addStaticHoliday ("19-AUG-2052", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("06-NOV-2052", "Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2052", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2053", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2053", "Memorial Day"); - - lh.addStaticHoliday ("02-APR-2053", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("03-APR-2053", "Holy Thursday"); - - lh.addStaticHoliday ("04-APR-2053", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2053", "Labour Day"); - - lh.addStaticHoliday ("16-JUN-2053", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2053", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-2053", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("06-NOV-2053", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2053", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2053", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2054", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2054", "Memorial Day"); - - lh.addStaticHoliday ("26-MAR-2054", "Holy Thursday"); - - lh.addStaticHoliday ("27-MAR-2054", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2054", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("01-MAY-2054", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2054", "Liberation Day"); - - lh.addStaticHoliday ("15-JUN-2054", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2054", "Independence Day"); - - lh.addStaticHoliday ("17-AUG-2054", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("12-OCT-2054", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2054", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2054", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2054", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2055", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2055", "Memorial Day"); - - lh.addStaticHoliday ("02-APR-2055", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("15-APR-2055", "Holy Thursday"); - - lh.addStaticHoliday ("16-APR-2055", "Good Friday"); - - lh.addStaticHoliday ("25-MAY-2055", "Liberation Day"); - - lh.addStaticHoliday ("21-JUN-2055", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2055", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2055", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("11-OCT-2055", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-2055", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2056", "Memorial Day"); - - lh.addStaticHoliday ("30-MAR-2056", "Holy Thursday"); - - lh.addStaticHoliday ("31-MAR-2056", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2056", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2056", "Liberation Day"); - - lh.addStaticHoliday ("19-JUN-2056", "Flag Day"); - - lh.addStaticHoliday ("21-AUG-2056", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("16-OCT-2056", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2056", "Bank Holiday"); - - lh.addStaticHoliday ("08-DEC-2056", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2056", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2057", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2057", "Malvinas Islands Memorial Day"); - - lh.addStaticHoliday ("19-APR-2057", "Holy Thursday"); - - lh.addStaticHoliday ("20-APR-2057", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2057", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2057", "Liberation Day"); - - lh.addStaticHoliday ("18-JUN-2057", "Flag Day"); - - lh.addStaticHoliday ("09-JUL-2057", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2057", "Anniversary of the Death of General San Martin"); - - lh.addStaticHoliday ("15-OCT-2057", "Day of the Race"); - - lh.addStaticHoliday ("06-NOV-2057", "Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2057", "Christmas Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/CFFHoliday.java b/org/drip/analytics/holset/CFFHoliday.java deleted file mode 100644 index 5c347c6..0000000 --- a/org/drip/analytics/holset/CFFHoliday.java +++ /dev/null @@ -1,1457 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class CFFHoliday implements org.drip.analytics.holset.LocationHoliday { - public CFFHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "CFF"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-1998", "Battle of Iquique Day"); - - lh.addStaticHoliday ("11-JUN-1998", "Corpus Christi"); - - lh.addStaticHoliday ("29-JUN-1998", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("11-SEP-1998", "Liberation Day"); - - lh.addStaticHoliday ("18-SEP-1998", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-1998", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-1998", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("21-MAY-1999", "Battle of Iquique Day"); - - lh.addStaticHoliday ("03-JUN-1999", "Corpus Christi"); - - lh.addStaticHoliday ("29-JUN-1999", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("12-OCT-1999", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-1999", "Immaculate Conception"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("22-JUN-2000", "Corpus Christi"); - - lh.addStaticHoliday ("29-JUN-2000", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("15-AUG-2000", "Assumption Day"); - - lh.addStaticHoliday ("11-SEP-2000", "Liberation Day"); - - lh.addStaticHoliday ("18-SEP-2000", "Independence Day"); - - lh.addStaticHoliday ("19-SEP-2000", "Armed Forces Day"); - - lh.addStaticHoliday ("12-OCT-2000", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2000", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2001", "Battle of Iquique Day"); - - lh.addStaticHoliday ("14-JUN-2001", "Corpus Christi"); - - lh.addStaticHoliday ("29-JUN-2001", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("15-AUG-2001", "Assumption Day"); - - lh.addStaticHoliday ("11-SEP-2001", "Liberation Day"); - - lh.addStaticHoliday ("18-SEP-2001", "Independence Day"); - - lh.addStaticHoliday ("19-SEP-2001", "Armed Forces Day"); - - lh.addStaticHoliday ("12-OCT-2001", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2002", "Battle of Iquique Day"); - - lh.addStaticHoliday ("30-MAY-2002", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2002", "Assumption Day"); - - lh.addStaticHoliday ("11-SEP-2002", "Liberation Day"); - - lh.addStaticHoliday ("18-SEP-2002", "Independence Day"); - - lh.addStaticHoliday ("19-SEP-2002", "Armed Forces Day"); - - lh.addStaticHoliday ("01-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2003", "Battle of Iquique Day"); - - lh.addStaticHoliday ("19-JUN-2003", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2003", "Assumption Day"); - - lh.addStaticHoliday ("11-SEP-2003", "Liberation Day"); - - lh.addStaticHoliday ("18-SEP-2003", "Independence Day"); - - lh.addStaticHoliday ("19-SEP-2003", "Armed Forces Day"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("21-MAY-2004", "Battle of Iquique Day"); - - lh.addStaticHoliday ("10-JUN-2004", "Corpus Christi"); - - lh.addStaticHoliday ("29-JUN-2004", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("12-OCT-2004", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2004", "Immaculate Conception"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("26-MAY-2005", "Corpus Christi"); - - lh.addStaticHoliday ("29-JUN-2005", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("19-SEP-2005", "Armed Forces Day"); - - lh.addStaticHoliday ("12-OCT-2005", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2005", "Immaculate Conception"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("15-JUN-2006", "Corpus Christi"); - - lh.addStaticHoliday ("29-JUN-2006", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("15-AUG-2006", "Assumption Day"); - - lh.addStaticHoliday ("11-SEP-2006", "Liberation Day"); - - lh.addStaticHoliday ("18-SEP-2006", "Independence Day"); - - lh.addStaticHoliday ("19-SEP-2006", "Armed Forces Day"); - - lh.addStaticHoliday ("12-OCT-2006", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2006", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2007", "Battle of Iquique Day"); - - lh.addStaticHoliday ("02-JUL-2007", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("16-JUL-2007", "Virgen Del Carmen"); - - lh.addStaticHoliday ("15-AUG-2007", "Assumption Day"); - - lh.addStaticHoliday ("17-SEP-2007", "One off holiday"); - - lh.addStaticHoliday ("18-SEP-2007", "Independence Day"); - - lh.addStaticHoliday ("19-SEP-2007", "Armed Forces Day"); - - lh.addStaticHoliday ("15-OCT-2007", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2007", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2008", "Battle of Iquique Day"); - - lh.addStaticHoliday ("15-AUG-2008", "Assumption Day"); - - lh.addStaticHoliday ("18-SEP-2008", "Independence Day"); - - lh.addStaticHoliday ("19-SEP-2008", "Armed Forces Day"); - - lh.addStaticHoliday ("31-OCT-2008", "National Evangelical Date"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2008", "Day before New Year"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2009", "Battle of Iquique Day"); - - lh.addStaticHoliday ("29-JUN-2009", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("16-JUL-2009", "Birgen Del Carmen Day"); - - lh.addStaticHoliday ("18-SEP-2009", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2009", "Day of the Race"); - - lh.addStaticHoliday ("31-OCT-2009", "National Evangelical Date"); - - lh.addStaticHoliday ("08-DEC-2009", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2009", "New Years Eve Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2010", "CLP"); - - lh.addStaticHoliday ("02-APR-2010", "CLP"); - - lh.addStaticHoliday ("21-MAY-2010", "CLP"); - - lh.addStaticHoliday ("28-JUN-2010", "CLP"); - - lh.addStaticHoliday ("16-JUL-2010", "CLP"); - - lh.addStaticHoliday ("11-OCT-2010", "CLP"); - - lh.addStaticHoliday ("01-NOV-2010", "CLP"); - - lh.addStaticHoliday ("08-DEC-2010", "CLP"); - - lh.addStaticHoliday ("31-DEC-2010", "CLP"); - - lh.addStaticHoliday ("22-APR-2011", "CLP"); - - lh.addStaticHoliday ("27-JUN-2011", "CLP"); - - lh.addStaticHoliday ("15-AUG-2011", "CLP"); - - lh.addStaticHoliday ("19-SEP-2011", "CLP"); - - lh.addStaticHoliday ("10-OCT-2011", "CLP"); - - lh.addStaticHoliday ("31-OCT-2011", "CLP"); - - lh.addStaticHoliday ("01-NOV-2011", "CLP"); - - lh.addStaticHoliday ("08-DEC-2011", "CLP"); - - lh.addStaticHoliday ("06-APR-2012", "CLP"); - - lh.addStaticHoliday ("01-MAY-2012", "CLP"); - - lh.addStaticHoliday ("21-MAY-2012", "CLP"); - - lh.addStaticHoliday ("02-JUL-2012", "CLP"); - - lh.addStaticHoliday ("16-JUL-2012", "CLP"); - - lh.addStaticHoliday ("15-AUG-2012", "CLP"); - - lh.addStaticHoliday ("18-SEP-2012", "CLP"); - - lh.addStaticHoliday ("19-SEP-2012", "CLP"); - - lh.addStaticHoliday ("15-OCT-2012", "CLP"); - - lh.addStaticHoliday ("01-NOV-2012", "CLP"); - - lh.addStaticHoliday ("02-NOV-2012", "CLP"); - - lh.addStaticHoliday ("25-DEC-2012", "CLP"); - - lh.addStaticHoliday ("31-DEC-2012", "CLP"); - - lh.addStaticHoliday ("01-JAN-2013", "CLP"); - - lh.addStaticHoliday ("29-MAR-2013", "CLP"); - - lh.addStaticHoliday ("01-MAY-2013", "CLP"); - - lh.addStaticHoliday ("21-MAY-2013", "CLP"); - - lh.addStaticHoliday ("16-JUL-2013", "CLP"); - - lh.addStaticHoliday ("15-AUG-2013", "CLP"); - - lh.addStaticHoliday ("18-SEP-2013", "CLP"); - - lh.addStaticHoliday ("19-SEP-2013", "CLP"); - - lh.addStaticHoliday ("31-OCT-2013", "CLP"); - - lh.addStaticHoliday ("01-NOV-2013", "CLP"); - - lh.addStaticHoliday ("25-DEC-2013", "CLP"); - - lh.addStaticHoliday ("31-DEC-2013", "CLP"); - - lh.addStaticHoliday ("01-JAN-2014", "CLP"); - - lh.addStaticHoliday ("18-APR-2014", "CLP"); - - lh.addStaticHoliday ("01-MAY-2014", "CLP"); - - lh.addStaticHoliday ("21-MAY-2014", "CLP"); - - lh.addStaticHoliday ("16-JUL-2014", "CLP"); - - lh.addStaticHoliday ("15-AUG-2014", "CLP"); - - lh.addStaticHoliday ("18-SEP-2014", "CLP"); - - lh.addStaticHoliday ("19-SEP-2014", "CLP"); - - lh.addStaticHoliday ("31-OCT-2014", "CLP"); - - lh.addStaticHoliday ("08-DEC-2014", "CLP"); - - lh.addStaticHoliday ("25-DEC-2014", "CLP"); - - lh.addStaticHoliday ("31-DEC-2014", "CLP"); - - lh.addStaticHoliday ("01-JAN-2015", "CLP"); - - lh.addStaticHoliday ("03-APR-2015", "CLP"); - - lh.addStaticHoliday ("01-MAY-2015", "CLP"); - - lh.addStaticHoliday ("21-MAY-2015", "CLP"); - - lh.addStaticHoliday ("29-JUN-2015", "CLP"); - - lh.addStaticHoliday ("16-JUL-2015", "CLP"); - - lh.addStaticHoliday ("18-SEP-2015", "CLP"); - - lh.addStaticHoliday ("12-OCT-2015", "CLP"); - - lh.addStaticHoliday ("08-DEC-2015", "CLP"); - - lh.addStaticHoliday ("25-DEC-2015", "CLP"); - - lh.addStaticHoliday ("31-DEC-2015", "CLP"); - - lh.addStaticHoliday ("01-JAN-2016", "CLP"); - - lh.addStaticHoliday ("25-MAR-2016", "CLP"); - - lh.addStaticHoliday ("27-JUN-2016", "CLP"); - - lh.addStaticHoliday ("15-AUG-2016", "CLP"); - - lh.addStaticHoliday ("19-SEP-2016", "CLP"); - - lh.addStaticHoliday ("10-OCT-2016", "CLP"); - - lh.addStaticHoliday ("31-OCT-2016", "CLP"); - - lh.addStaticHoliday ("01-NOV-2016", "CLP"); - - lh.addStaticHoliday ("08-DEC-2016", "CLP"); - - lh.addStaticHoliday ("14-APR-2017", "CLP"); - - lh.addStaticHoliday ("01-MAY-2017", "CLP"); - - lh.addStaticHoliday ("26-JUN-2017", "CLP"); - - lh.addStaticHoliday ("15-AUG-2017", "CLP"); - - lh.addStaticHoliday ("18-SEP-2017", "CLP"); - - lh.addStaticHoliday ("19-SEP-2017", "CLP"); - - lh.addStaticHoliday ("09-OCT-2017", "CLP"); - - lh.addStaticHoliday ("27-OCT-2017", "CLP"); - - lh.addStaticHoliday ("01-NOV-2017", "CLP"); - - lh.addStaticHoliday ("08-DEC-2017", "CLP"); - - lh.addStaticHoliday ("25-DEC-2017", "CLP"); - - lh.addStaticHoliday ("01-JAN-2018", "CLP"); - - lh.addStaticHoliday ("30-MAR-2018", "CLP"); - - lh.addStaticHoliday ("01-MAY-2018", "CLP"); - - lh.addStaticHoliday ("21-MAY-2018", "CLP"); - - lh.addStaticHoliday ("02-JUL-2018", "CLP"); - - lh.addStaticHoliday ("16-JUL-2018", "CLP"); - - lh.addStaticHoliday ("15-AUG-2018", "CLP"); - - lh.addStaticHoliday ("18-SEP-2018", "CLP"); - - lh.addStaticHoliday ("19-SEP-2018", "CLP"); - - lh.addStaticHoliday ("15-OCT-2018", "CLP"); - - lh.addStaticHoliday ("01-NOV-2018", "CLP"); - - lh.addStaticHoliday ("02-NOV-2018", "CLP"); - - lh.addStaticHoliday ("25-DEC-2018", "CLP"); - - lh.addStaticHoliday ("31-DEC-2018", "CLP"); - - lh.addStaticHoliday ("01-JAN-2019", "CLP"); - - lh.addStaticHoliday ("19-APR-2019", "CLP"); - - lh.addStaticHoliday ("01-MAY-2019", "CLP"); - - lh.addStaticHoliday ("21-MAY-2019", "CLP"); - - lh.addStaticHoliday ("16-JUL-2019", "CLP"); - - lh.addStaticHoliday ("15-AUG-2019", "CLP"); - - lh.addStaticHoliday ("18-SEP-2019", "CLP"); - - lh.addStaticHoliday ("19-SEP-2019", "CLP"); - - lh.addStaticHoliday ("31-OCT-2019", "CLP"); - - lh.addStaticHoliday ("01-NOV-2019", "CLP"); - - lh.addStaticHoliday ("25-DEC-2019", "CLP"); - - lh.addStaticHoliday ("31-DEC-2019", "CLP"); - - lh.addStaticHoliday ("01-JAN-2020", "CLP"); - - lh.addStaticHoliday ("10-APR-2020", "CLP"); - - lh.addStaticHoliday ("01-MAY-2020", "CLP"); - - lh.addStaticHoliday ("21-MAY-2020", "CLP"); - - lh.addStaticHoliday ("29-JUN-2020", "CLP"); - - lh.addStaticHoliday ("16-JUL-2020", "CLP"); - - lh.addStaticHoliday ("18-SEP-2020", "CLP"); - - lh.addStaticHoliday ("12-OCT-2020", "CLP"); - - lh.addStaticHoliday ("08-DEC-2020", "CLP"); - - lh.addStaticHoliday ("25-DEC-2020", "CLP"); - - lh.addStaticHoliday ("31-DEC-2020", "CLP"); - - lh.addStaticHoliday ("01-JAN-2021", "CLP"); - - lh.addStaticHoliday ("02-APR-2021", "CLP"); - - lh.addStaticHoliday ("21-MAY-2021", "CLP"); - - lh.addStaticHoliday ("28-JUN-2021", "CLP"); - - lh.addStaticHoliday ("16-JUL-2021", "CLP"); - - lh.addStaticHoliday ("12-OCT-2021", "CLP"); - - lh.addStaticHoliday ("01-NOV-2021", "CLP"); - - lh.addStaticHoliday ("08-DEC-2021", "CLP"); - - lh.addStaticHoliday ("31-DEC-2021", "CLP"); - - lh.addStaticHoliday ("15-APR-2022", "CLP"); - - lh.addStaticHoliday ("27-JUN-2022", "CLP"); - - lh.addStaticHoliday ("15-AUG-2022", "CLP"); - - lh.addStaticHoliday ("19-SEP-2022", "CLP"); - - lh.addStaticHoliday ("10-OCT-2022", "CLP"); - - lh.addStaticHoliday ("31-OCT-2022", "CLP"); - - lh.addStaticHoliday ("01-NOV-2022", "CLP"); - - lh.addStaticHoliday ("08-DEC-2022", "CLP"); - - lh.addStaticHoliday ("07-APR-2023", "CLP"); - - lh.addStaticHoliday ("01-MAY-2023", "CLP"); - - lh.addStaticHoliday ("26-JUN-2023", "CLP"); - - lh.addStaticHoliday ("15-AUG-2023", "CLP"); - - lh.addStaticHoliday ("18-SEP-2023", "CLP"); - - lh.addStaticHoliday ("19-SEP-2023", "CLP"); - - lh.addStaticHoliday ("09-OCT-2023", "CLP"); - - lh.addStaticHoliday ("27-OCT-2023", "CLP"); - - lh.addStaticHoliday ("01-NOV-2023", "CLP"); - - lh.addStaticHoliday ("08-DEC-2023", "CLP"); - - lh.addStaticHoliday ("25-DEC-2023", "CLP"); - - lh.addStaticHoliday ("01-JAN-2024", "CLP"); - - lh.addStaticHoliday ("29-MAR-2024", "CLP"); - - lh.addStaticHoliday ("01-MAY-2024", "CLP"); - - lh.addStaticHoliday ("21-MAY-2024", "CLP"); - - lh.addStaticHoliday ("16-JUL-2024", "CLP"); - - lh.addStaticHoliday ("15-AUG-2024", "CLP"); - - lh.addStaticHoliday ("18-SEP-2024", "CLP"); - - lh.addStaticHoliday ("19-SEP-2024", "CLP"); - - lh.addStaticHoliday ("31-OCT-2024", "CLP"); - - lh.addStaticHoliday ("01-NOV-2024", "CLP"); - - lh.addStaticHoliday ("25-DEC-2024", "CLP"); - - lh.addStaticHoliday ("31-DEC-2024", "CLP"); - - lh.addStaticHoliday ("01-JAN-2025", "CLP"); - - lh.addStaticHoliday ("18-APR-2025", "CLP"); - - lh.addStaticHoliday ("01-MAY-2025", "CLP"); - - lh.addStaticHoliday ("21-MAY-2025", "CLP"); - - lh.addStaticHoliday ("16-JUL-2025", "CLP"); - - lh.addStaticHoliday ("15-AUG-2025", "CLP"); - - lh.addStaticHoliday ("18-SEP-2025", "CLP"); - - lh.addStaticHoliday ("19-SEP-2025", "CLP"); - - lh.addStaticHoliday ("31-OCT-2025", "CLP"); - - lh.addStaticHoliday ("08-DEC-2025", "CLP"); - - lh.addStaticHoliday ("25-DEC-2025", "CLP"); - - lh.addStaticHoliday ("31-DEC-2025", "CLP"); - - lh.addStaticHoliday ("01-JAN-2026", "CLP"); - - lh.addStaticHoliday ("03-APR-2026", "CLP"); - - lh.addStaticHoliday ("01-MAY-2026", "CLP"); - - lh.addStaticHoliday ("21-MAY-2026", "CLP"); - - lh.addStaticHoliday ("29-JUN-2026", "CLP"); - - lh.addStaticHoliday ("16-JUL-2026", "CLP"); - - lh.addStaticHoliday ("18-SEP-2026", "CLP"); - - lh.addStaticHoliday ("12-OCT-2026", "CLP"); - - lh.addStaticHoliday ("08-DEC-2026", "CLP"); - - lh.addStaticHoliday ("25-DEC-2026", "CLP"); - - lh.addStaticHoliday ("31-DEC-2026", "CLP"); - - lh.addStaticHoliday ("01-JAN-2027", "CLP"); - - lh.addStaticHoliday ("26-MAR-2027", "CLP"); - - lh.addStaticHoliday ("21-MAY-2027", "CLP"); - - lh.addStaticHoliday ("28-JUN-2027", "CLP"); - - lh.addStaticHoliday ("16-JUL-2027", "CLP"); - - lh.addStaticHoliday ("11-OCT-2027", "CLP"); - - lh.addStaticHoliday ("01-NOV-2027", "CLP"); - - lh.addStaticHoliday ("08-DEC-2027", "CLP"); - - lh.addStaticHoliday ("31-DEC-2027", "CLP"); - - lh.addStaticHoliday ("14-APR-2028", "CLP"); - - lh.addStaticHoliday ("01-MAY-2028", "CLP"); - - lh.addStaticHoliday ("26-JUN-2028", "CLP"); - - lh.addStaticHoliday ("15-AUG-2028", "CLP"); - - lh.addStaticHoliday ("18-SEP-2028", "CLP"); - - lh.addStaticHoliday ("19-SEP-2028", "CLP"); - - lh.addStaticHoliday ("09-OCT-2028", "CLP"); - - lh.addStaticHoliday ("27-OCT-2028", "CLP"); - - lh.addStaticHoliday ("01-NOV-2028", "CLP"); - - lh.addStaticHoliday ("08-DEC-2028", "CLP"); - - lh.addStaticHoliday ("25-DEC-2028", "CLP"); - - lh.addStaticHoliday ("01-JAN-2029", "CLP"); - - lh.addStaticHoliday ("30-MAR-2029", "CLP"); - - lh.addStaticHoliday ("01-MAY-2029", "CLP"); - - lh.addStaticHoliday ("21-MAY-2029", "CLP"); - - lh.addStaticHoliday ("02-JUL-2029", "CLP"); - - lh.addStaticHoliday ("16-JUL-2029", "CLP"); - - lh.addStaticHoliday ("15-AUG-2029", "CLP"); - - lh.addStaticHoliday ("18-SEP-2029", "CLP"); - - lh.addStaticHoliday ("19-SEP-2029", "CLP"); - - lh.addStaticHoliday ("15-OCT-2029", "CLP"); - - lh.addStaticHoliday ("01-NOV-2029", "CLP"); - - lh.addStaticHoliday ("02-NOV-2029", "CLP"); - - lh.addStaticHoliday ("25-DEC-2029", "CLP"); - - lh.addStaticHoliday ("31-DEC-2029", "CLP"); - - lh.addStaticHoliday ("01-JAN-2030", "CLP"); - - lh.addStaticHoliday ("19-APR-2030", "CLP"); - - lh.addStaticHoliday ("01-MAY-2030", "CLP"); - - lh.addStaticHoliday ("21-MAY-2030", "CLP"); - - lh.addStaticHoliday ("16-JUL-2030", "CLP"); - - lh.addStaticHoliday ("15-AUG-2030", "CLP"); - - lh.addStaticHoliday ("18-SEP-2030", "CLP"); - - lh.addStaticHoliday ("19-SEP-2030", "CLP"); - - lh.addStaticHoliday ("31-OCT-2030", "CLP"); - - lh.addStaticHoliday ("01-NOV-2030", "CLP"); - - lh.addStaticHoliday ("25-DEC-2030", "CLP"); - - lh.addStaticHoliday ("31-DEC-2030", "CLP"); - - lh.addStaticHoliday ("01-JAN-2031", "CLP"); - - lh.addStaticHoliday ("11-APR-2031", "CLP"); - - lh.addStaticHoliday ("01-MAY-2031", "CLP"); - - lh.addStaticHoliday ("21-MAY-2031", "CLP"); - - lh.addStaticHoliday ("16-JUL-2031", "CLP"); - - lh.addStaticHoliday ("15-AUG-2031", "CLP"); - - lh.addStaticHoliday ("18-SEP-2031", "CLP"); - - lh.addStaticHoliday ("19-SEP-2031", "CLP"); - - lh.addStaticHoliday ("31-OCT-2031", "CLP"); - - lh.addStaticHoliday ("08-DEC-2031", "CLP"); - - lh.addStaticHoliday ("25-DEC-2031", "CLP"); - - lh.addStaticHoliday ("31-DEC-2031", "CLP"); - - lh.addStaticHoliday ("01-JAN-2032", "CLP"); - - lh.addStaticHoliday ("26-MAR-2032", "CLP"); - - lh.addStaticHoliday ("21-MAY-2032", "CLP"); - - lh.addStaticHoliday ("28-JUN-2032", "CLP"); - - lh.addStaticHoliday ("16-JUL-2032", "CLP"); - - lh.addStaticHoliday ("11-OCT-2032", "CLP"); - - lh.addStaticHoliday ("01-NOV-2032", "CLP"); - - lh.addStaticHoliday ("08-DEC-2032", "CLP"); - - lh.addStaticHoliday ("31-DEC-2032", "CLP"); - - lh.addStaticHoliday ("15-APR-2033", "CLP"); - - lh.addStaticHoliday ("27-JUN-2033", "CLP"); - - lh.addStaticHoliday ("15-AUG-2033", "CLP"); - - lh.addStaticHoliday ("19-SEP-2033", "CLP"); - - lh.addStaticHoliday ("10-OCT-2033", "CLP"); - - lh.addStaticHoliday ("31-OCT-2033", "CLP"); - - lh.addStaticHoliday ("01-NOV-2033", "CLP"); - - lh.addStaticHoliday ("08-DEC-2033", "CLP"); - - lh.addStaticHoliday ("07-APR-2034", "CLP"); - - lh.addStaticHoliday ("01-MAY-2034", "CLP"); - - lh.addStaticHoliday ("26-JUN-2034", "CLP"); - - lh.addStaticHoliday ("15-AUG-2034", "CLP"); - - lh.addStaticHoliday ("18-SEP-2034", "CLP"); - - lh.addStaticHoliday ("19-SEP-2034", "CLP"); - - lh.addStaticHoliday ("09-OCT-2034", "CLP"); - - lh.addStaticHoliday ("27-OCT-2034", "CLP"); - - lh.addStaticHoliday ("01-NOV-2034", "CLP"); - - lh.addStaticHoliday ("08-DEC-2034", "CLP"); - - lh.addStaticHoliday ("25-DEC-2034", "CLP"); - - lh.addStaticHoliday ("01-JAN-2035", "CLP"); - - lh.addStaticHoliday ("23-MAR-2035", "CLP"); - - lh.addStaticHoliday ("01-MAY-2035", "CLP"); - - lh.addStaticHoliday ("21-MAY-2035", "CLP"); - - lh.addStaticHoliday ("02-JUL-2035", "CLP"); - - lh.addStaticHoliday ("16-JUL-2035", "CLP"); - - lh.addStaticHoliday ("15-AUG-2035", "CLP"); - - lh.addStaticHoliday ("18-SEP-2035", "CLP"); - - lh.addStaticHoliday ("19-SEP-2035", "CLP"); - - lh.addStaticHoliday ("15-OCT-2035", "CLP"); - - lh.addStaticHoliday ("01-NOV-2035", "CLP"); - - lh.addStaticHoliday ("02-NOV-2035", "CLP"); - - lh.addStaticHoliday ("25-DEC-2035", "CLP"); - - lh.addStaticHoliday ("31-DEC-2035", "CLP"); - - lh.addStaticHoliday ("01-JAN-2036", "CLP"); - - lh.addStaticHoliday ("11-APR-2036", "CLP"); - - lh.addStaticHoliday ("01-MAY-2036", "CLP"); - - lh.addStaticHoliday ("21-MAY-2036", "CLP"); - - lh.addStaticHoliday ("16-JUL-2036", "CLP"); - - lh.addStaticHoliday ("15-AUG-2036", "CLP"); - - lh.addStaticHoliday ("18-SEP-2036", "CLP"); - - lh.addStaticHoliday ("19-SEP-2036", "CLP"); - - lh.addStaticHoliday ("31-OCT-2036", "CLP"); - - lh.addStaticHoliday ("08-DEC-2036", "CLP"); - - lh.addStaticHoliday ("25-DEC-2036", "CLP"); - - lh.addStaticHoliday ("31-DEC-2036", "CLP"); - - lh.addStaticHoliday ("01-JAN-2037", "CLP"); - - lh.addStaticHoliday ("03-APR-2037", "CLP"); - - lh.addStaticHoliday ("01-MAY-2037", "CLP"); - - lh.addStaticHoliday ("21-MAY-2037", "CLP"); - - lh.addStaticHoliday ("29-JUN-2037", "CLP"); - - lh.addStaticHoliday ("16-JUL-2037", "CLP"); - - lh.addStaticHoliday ("18-SEP-2037", "CLP"); - - lh.addStaticHoliday ("12-OCT-2037", "CLP"); - - lh.addStaticHoliday ("08-DEC-2037", "CLP"); - - lh.addStaticHoliday ("25-DEC-2037", "CLP"); - - lh.addStaticHoliday ("31-DEC-2037", "CLP"); - - lh.addStaticHoliday ("01-JAN-2038", "CLP"); - - lh.addStaticHoliday ("23-APR-2038", "CLP"); - - lh.addStaticHoliday ("21-MAY-2038", "CLP"); - - lh.addStaticHoliday ("28-JUN-2038", "CLP"); - - lh.addStaticHoliday ("16-JUL-2038", "CLP"); - - lh.addStaticHoliday ("11-OCT-2038", "CLP"); - - lh.addStaticHoliday ("01-NOV-2038", "CLP"); - - lh.addStaticHoliday ("08-DEC-2038", "CLP"); - - lh.addStaticHoliday ("31-DEC-2038", "CLP"); - - lh.addStaticHoliday ("08-APR-2039", "CLP"); - - lh.addStaticHoliday ("27-JUN-2039", "CLP"); - - lh.addStaticHoliday ("15-AUG-2039", "CLP"); - - lh.addStaticHoliday ("19-SEP-2039", "CLP"); - - lh.addStaticHoliday ("10-OCT-2039", "CLP"); - - lh.addStaticHoliday ("31-OCT-2039", "CLP"); - - lh.addStaticHoliday ("01-NOV-2039", "CLP"); - - lh.addStaticHoliday ("08-DEC-2039", "CLP"); - - lh.addStaticHoliday ("30-MAR-2040", "CLP"); - - lh.addStaticHoliday ("01-MAY-2040", "CLP"); - - lh.addStaticHoliday ("21-MAY-2040", "CLP"); - - lh.addStaticHoliday ("02-JUL-2040", "CLP"); - - lh.addStaticHoliday ("16-JUL-2040", "CLP"); - - lh.addStaticHoliday ("15-AUG-2040", "CLP"); - - lh.addStaticHoliday ("18-SEP-2040", "CLP"); - - lh.addStaticHoliday ("19-SEP-2040", "CLP"); - - lh.addStaticHoliday ("15-OCT-2040", "CLP"); - - lh.addStaticHoliday ("01-NOV-2040", "CLP"); - - lh.addStaticHoliday ("02-NOV-2040", "CLP"); - - lh.addStaticHoliday ("25-DEC-2040", "CLP"); - - lh.addStaticHoliday ("31-DEC-2040", "CLP"); - - lh.addStaticHoliday ("01-JAN-2041", "CLP"); - - lh.addStaticHoliday ("19-APR-2041", "CLP"); - - lh.addStaticHoliday ("01-MAY-2041", "CLP"); - - lh.addStaticHoliday ("21-MAY-2041", "CLP"); - - lh.addStaticHoliday ("16-JUL-2041", "CLP"); - - lh.addStaticHoliday ("15-AUG-2041", "CLP"); - - lh.addStaticHoliday ("18-SEP-2041", "CLP"); - - lh.addStaticHoliday ("19-SEP-2041", "CLP"); - - lh.addStaticHoliday ("31-OCT-2041", "CLP"); - - lh.addStaticHoliday ("01-NOV-2041", "CLP"); - - lh.addStaticHoliday ("25-DEC-2041", "CLP"); - - lh.addStaticHoliday ("31-DEC-2041", "CLP"); - - lh.addStaticHoliday ("01-JAN-2042", "CLP"); - - lh.addStaticHoliday ("04-APR-2042", "CLP"); - - lh.addStaticHoliday ("01-MAY-2042", "CLP"); - - lh.addStaticHoliday ("21-MAY-2042", "CLP"); - - lh.addStaticHoliday ("16-JUL-2042", "CLP"); - - lh.addStaticHoliday ("15-AUG-2042", "CLP"); - - lh.addStaticHoliday ("18-SEP-2042", "CLP"); - - lh.addStaticHoliday ("19-SEP-2042", "CLP"); - - lh.addStaticHoliday ("31-OCT-2042", "CLP"); - - lh.addStaticHoliday ("08-DEC-2042", "CLP"); - - lh.addStaticHoliday ("25-DEC-2042", "CLP"); - - lh.addStaticHoliday ("31-DEC-2042", "CLP"); - - lh.addStaticHoliday ("01-JAN-2043", "CLP"); - - lh.addStaticHoliday ("27-MAR-2043", "CLP"); - - lh.addStaticHoliday ("01-MAY-2043", "CLP"); - - lh.addStaticHoliday ("21-MAY-2043", "CLP"); - - lh.addStaticHoliday ("29-JUN-2043", "CLP"); - - lh.addStaticHoliday ("16-JUL-2043", "CLP"); - - lh.addStaticHoliday ("18-SEP-2043", "CLP"); - - lh.addStaticHoliday ("12-OCT-2043", "CLP"); - - lh.addStaticHoliday ("08-DEC-2043", "CLP"); - - lh.addStaticHoliday ("25-DEC-2043", "CLP"); - - lh.addStaticHoliday ("31-DEC-2043", "CLP"); - - lh.addStaticHoliday ("01-JAN-2044", "CLP"); - - lh.addStaticHoliday ("15-APR-2044", "CLP"); - - lh.addStaticHoliday ("27-JUN-2044", "CLP"); - - lh.addStaticHoliday ("15-AUG-2044", "CLP"); - - lh.addStaticHoliday ("19-SEP-2044", "CLP"); - - lh.addStaticHoliday ("10-OCT-2044", "CLP"); - - lh.addStaticHoliday ("31-OCT-2044", "CLP"); - - lh.addStaticHoliday ("01-NOV-2044", "CLP"); - - lh.addStaticHoliday ("08-DEC-2044", "CLP"); - - lh.addStaticHoliday ("07-APR-2045", "CLP"); - - lh.addStaticHoliday ("01-MAY-2045", "CLP"); - - lh.addStaticHoliday ("26-JUN-2045", "CLP"); - - lh.addStaticHoliday ("15-AUG-2045", "CLP"); - - lh.addStaticHoliday ("18-SEP-2045", "CLP"); - - lh.addStaticHoliday ("19-SEP-2045", "CLP"); - - lh.addStaticHoliday ("09-OCT-2045", "CLP"); - - lh.addStaticHoliday ("27-OCT-2045", "CLP"); - - lh.addStaticHoliday ("01-NOV-2045", "CLP"); - - lh.addStaticHoliday ("08-DEC-2045", "CLP"); - - lh.addStaticHoliday ("25-DEC-2045", "CLP"); - - lh.addStaticHoliday ("01-JAN-2046", "CLP"); - - lh.addStaticHoliday ("23-MAR-2046", "CLP"); - - lh.addStaticHoliday ("01-MAY-2046", "CLP"); - - lh.addStaticHoliday ("21-MAY-2046", "CLP"); - - lh.addStaticHoliday ("02-JUL-2046", "CLP"); - - lh.addStaticHoliday ("16-JUL-2046", "CLP"); - - lh.addStaticHoliday ("15-AUG-2046", "CLP"); - - lh.addStaticHoliday ("18-SEP-2046", "CLP"); - - lh.addStaticHoliday ("19-SEP-2046", "CLP"); - - lh.addStaticHoliday ("15-OCT-2046", "CLP"); - - lh.addStaticHoliday ("01-NOV-2046", "CLP"); - - lh.addStaticHoliday ("02-NOV-2046", "CLP"); - - lh.addStaticHoliday ("25-DEC-2046", "CLP"); - - lh.addStaticHoliday ("31-DEC-2046", "CLP"); - - lh.addStaticHoliday ("01-JAN-2047", "CLP"); - - lh.addStaticHoliday ("12-APR-2047", "CLP"); - - lh.addStaticHoliday ("01-MAY-2047", "CLP"); - - lh.addStaticHoliday ("21-MAY-2047", "CLP"); - - lh.addStaticHoliday ("16-JUL-2047", "CLP"); - - lh.addStaticHoliday ("15-AUG-2047", "CLP"); - - lh.addStaticHoliday ("18-SEP-2047", "CLP"); - - lh.addStaticHoliday ("19-SEP-2047", "CLP"); - - lh.addStaticHoliday ("31-OCT-2047", "CLP"); - - lh.addStaticHoliday ("01-NOV-2047", "CLP"); - - lh.addStaticHoliday ("25-DEC-2047", "CLP"); - - lh.addStaticHoliday ("31-DEC-2047", "CLP"); - - lh.addStaticHoliday ("01-JAN-2048", "CLP"); - - lh.addStaticHoliday ("03-APR-2048", "CLP"); - - lh.addStaticHoliday ("01-MAY-2048", "CLP"); - - lh.addStaticHoliday ("21-MAY-2048", "CLP"); - - lh.addStaticHoliday ("29-JUN-2048", "CLP"); - - lh.addStaticHoliday ("16-JUL-2048", "CLP"); - - lh.addStaticHoliday ("18-SEP-2048", "CLP"); - - lh.addStaticHoliday ("12-OCT-2048", "CLP"); - - lh.addStaticHoliday ("08-DEC-2048", "CLP"); - - lh.addStaticHoliday ("25-DEC-2048", "CLP"); - - lh.addStaticHoliday ("31-DEC-2048", "CLP"); - - lh.addStaticHoliday ("01-JAN-2049", "CLP"); - - lh.addStaticHoliday ("16-APR-2049", "CLP"); - - lh.addStaticHoliday ("21-MAY-2049", "CLP"); - - lh.addStaticHoliday ("28-JUN-2049", "CLP"); - - lh.addStaticHoliday ("16-JUL-2049", "CLP"); - - lh.addStaticHoliday ("11-OCT-2049", "CLP"); - - lh.addStaticHoliday ("01-NOV-2049", "CLP"); - - lh.addStaticHoliday ("08-DEC-2049", "CLP"); - - lh.addStaticHoliday ("31-DEC-2049", "CLP"); - - lh.addStaticHoliday ("08-APR-2050", "CLP"); - - lh.addStaticHoliday ("27-JUN-2050", "CLP"); - - lh.addStaticHoliday ("15-AUG-2050", "CLP"); - - lh.addStaticHoliday ("19-SEP-2050", "CLP"); - - lh.addStaticHoliday ("10-OCT-2050", "CLP"); - - lh.addStaticHoliday ("31-OCT-2050", "CLP"); - - lh.addStaticHoliday ("01-NOV-2050", "CLP"); - - lh.addStaticHoliday ("08-DEC-2050", "CLP"); - - lh.addStaticHoliday ("31-MAR-2051", "CLP"); - - lh.addStaticHoliday ("01-MAY-2051", "CLP"); - - lh.addStaticHoliday ("26-JUN-2051", "CLP"); - - lh.addStaticHoliday ("15-AUG-2051", "CLP"); - - lh.addStaticHoliday ("18-SEP-2051", "CLP"); - - lh.addStaticHoliday ("19-SEP-2051", "CLP"); - - lh.addStaticHoliday ("09-OCT-2051", "CLP"); - - lh.addStaticHoliday ("27-OCT-2051", "CLP"); - - lh.addStaticHoliday ("01-NOV-2051", "CLP"); - - lh.addStaticHoliday ("08-DEC-2051", "CLP"); - - lh.addStaticHoliday ("25-DEC-2051", "CLP"); - - lh.addStaticHoliday ("01-JAN-2052", "CLP"); - - lh.addStaticHoliday ("19-APR-2052", "CLP"); - - lh.addStaticHoliday ("01-MAY-2052", "CLP"); - - lh.addStaticHoliday ("21-MAY-2052", "CLP"); - - lh.addStaticHoliday ("16-JUL-2052", "CLP"); - - lh.addStaticHoliday ("15-AUG-2052", "CLP"); - - lh.addStaticHoliday ("18-SEP-2052", "CLP"); - - lh.addStaticHoliday ("19-SEP-2052", "CLP"); - - lh.addStaticHoliday ("31-OCT-2052", "CLP"); - - lh.addStaticHoliday ("01-NOV-2052", "CLP"); - - lh.addStaticHoliday ("25-DEC-2052", "CLP"); - - lh.addStaticHoliday ("31-DEC-2052", "CLP"); - - lh.addStaticHoliday ("01-JAN-2053", "CLP"); - - lh.addStaticHoliday ("04-APR-2053", "CLP"); - - lh.addStaticHoliday ("01-MAY-2053", "CLP"); - - lh.addStaticHoliday ("21-MAY-2053", "CLP"); - - lh.addStaticHoliday ("16-JUL-2053", "CLP"); - - lh.addStaticHoliday ("15-AUG-2053", "CLP"); - - lh.addStaticHoliday ("18-SEP-2053", "CLP"); - - lh.addStaticHoliday ("19-SEP-2053", "CLP"); - - lh.addStaticHoliday ("31-OCT-2053", "CLP"); - - lh.addStaticHoliday ("08-DEC-2053", "CLP"); - - lh.addStaticHoliday ("25-DEC-2053", "CLP"); - - lh.addStaticHoliday ("31-DEC-2053", "CLP"); - - lh.addStaticHoliday ("01-JAN-2054", "CLP"); - - lh.addStaticHoliday ("27-MAR-2054", "CLP"); - - lh.addStaticHoliday ("01-MAY-2054", "CLP"); - - lh.addStaticHoliday ("21-MAY-2054", "CLP"); - - lh.addStaticHoliday ("29-JUN-2054", "CLP"); - - lh.addStaticHoliday ("16-JUL-2054", "CLP"); - - lh.addStaticHoliday ("18-SEP-2054", "CLP"); - - lh.addStaticHoliday ("12-OCT-2054", "CLP"); - - lh.addStaticHoliday ("08-DEC-2054", "CLP"); - - lh.addStaticHoliday ("25-DEC-2054", "CLP"); - - lh.addStaticHoliday ("31-DEC-2054", "CLP"); - - lh.addStaticHoliday ("01-JAN-2055", "CLP"); - - lh.addStaticHoliday ("16-APR-2055", "CLP"); - - lh.addStaticHoliday ("21-MAY-2055", "CLP"); - - lh.addStaticHoliday ("28-JUN-2055", "CLP"); - - lh.addStaticHoliday ("16-JUL-2055", "CLP"); - - lh.addStaticHoliday ("11-OCT-2055", "CLP"); - - lh.addStaticHoliday ("01-NOV-2055", "CLP"); - - lh.addStaticHoliday ("08-DEC-2055", "CLP"); - - lh.addStaticHoliday ("31-DEC-2055", "CLP"); - - lh.addStaticHoliday ("31-MAR-2056", "CLP"); - - lh.addStaticHoliday ("01-MAY-2056", "CLP"); - - lh.addStaticHoliday ("26-JUN-2056", "CLP"); - - lh.addStaticHoliday ("15-AUG-2056", "CLP"); - - lh.addStaticHoliday ("18-SEP-2056", "CLP"); - - lh.addStaticHoliday ("19-SEP-2056", "CLP"); - - lh.addStaticHoliday ("09-OCT-2056", "CLP"); - - lh.addStaticHoliday ("27-OCT-2056", "CLP"); - - lh.addStaticHoliday ("01-NOV-2056", "CLP"); - - lh.addStaticHoliday ("08-DEC-2056", "CLP"); - - lh.addStaticHoliday ("25-DEC-2056", "CLP"); - - lh.addStaticHoliday ("01-JAN-2057", "CLP"); - - lh.addStaticHoliday ("20-APR-2057", "CLP"); - - lh.addStaticHoliday ("01-MAY-2057", "CLP"); - - lh.addStaticHoliday ("21-MAY-2057", "CLP"); - - lh.addStaticHoliday ("02-JUL-2057", "CLP"); - - lh.addStaticHoliday ("16-JUL-2057", "CLP"); - - lh.addStaticHoliday ("15-AUG-2057", "CLP"); - - lh.addStaticHoliday ("18-SEP-2057", "CLP"); - - lh.addStaticHoliday ("19-SEP-2057", "CLP"); - - lh.addStaticHoliday ("15-OCT-2057", "CLP"); - - lh.addStaticHoliday ("01-NOV-2057", "CLP"); - - lh.addStaticHoliday ("02-NOV-2057", "CLP"); - - lh.addStaticHoliday ("25-DEC-2057", "CLP"); - - lh.addStaticHoliday ("31-DEC-2057", "CLP"); - - lh.addStaticHoliday ("01-JAN-2058", "CLP"); - - lh.addStaticHoliday ("12-APR-2058", "CLP"); - - lh.addStaticHoliday ("01-MAY-2058", "CLP"); - - lh.addStaticHoliday ("21-MAY-2058", "CLP"); - - lh.addStaticHoliday ("16-JUL-2058", "CLP"); - - lh.addStaticHoliday ("15-AUG-2058", "CLP"); - - lh.addStaticHoliday ("18-SEP-2058", "CLP"); - - lh.addStaticHoliday ("19-SEP-2058", "CLP"); - - lh.addStaticHoliday ("31-OCT-2058", "CLP"); - - lh.addStaticHoliday ("01-NOV-2058", "CLP"); - - lh.addStaticHoliday ("25-DEC-2058", "CLP"); - - lh.addStaticHoliday ("31-DEC-2058", "CLP"); - - lh.addStaticHoliday ("01-JAN-2059", "CLP"); - - lh.addStaticHoliday ("28-MAR-2059", "CLP"); - - lh.addStaticHoliday ("01-MAY-2059", "CLP"); - - lh.addStaticHoliday ("21-MAY-2059", "CLP"); - - lh.addStaticHoliday ("16-JUL-2059", "CLP"); - - lh.addStaticHoliday ("15-AUG-2059", "CLP"); - - lh.addStaticHoliday ("18-SEP-2059", "CLP"); - - lh.addStaticHoliday ("19-SEP-2059", "CLP"); - - lh.addStaticHoliday ("31-OCT-2059", "CLP"); - - lh.addStaticHoliday ("08-DEC-2059", "CLP"); - - lh.addStaticHoliday ("25-DEC-2059", "CLP"); - - lh.addStaticHoliday ("31-DEC-2059", "CLP"); - - lh.addStaticHoliday ("01-JAN-2060", "CLP"); - - lh.addStaticHoliday ("16-APR-2060", "CLP"); - - lh.addStaticHoliday ("21-MAY-2060", "CLP"); - - lh.addStaticHoliday ("28-JUN-2060", "CLP"); - - lh.addStaticHoliday ("16-JUL-2060", "CLP"); - - lh.addStaticHoliday ("11-OCT-2060", "CLP"); - - lh.addStaticHoliday ("01-NOV-2060", "CLP"); - - lh.addStaticHoliday ("08-DEC-2060", "CLP"); - - lh.addStaticHoliday ("31-DEC-2060", "CLP"); - - lh.addStaticHoliday ("08-APR-2061", "CLP"); - - lh.addStaticHoliday ("27-JUN-2061", "CLP"); - - lh.addStaticHoliday ("15-AUG-2061", "CLP"); - - lh.addStaticHoliday ("19-SEP-2061", "CLP"); - - lh.addStaticHoliday ("10-OCT-2061", "CLP"); - - lh.addStaticHoliday ("31-OCT-2061", "CLP"); - - lh.addStaticHoliday ("01-NOV-2061", "CLP"); - - lh.addStaticHoliday ("08-DEC-2061", "CLP"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/CHFHoliday.java b/org/drip/analytics/holset/CHFHoliday.java deleted file mode 100644 index a1a882f..0000000 --- a/org/drip/analytics/holset/CHFHoliday.java +++ /dev/null @@ -1,563 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class CHFHoliday implements org.drip.analytics.holset.LocationHoliday { - public CHFHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "CHF"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-1998", "Berchtoldstag"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-1998", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-1998", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-1999", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-1999", "Whit Monday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("01-JUN-2000", "Ascension Day"); - - lh.addStaticHoliday ("12-JUN-2000", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2000", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2001", "Berchtoldstag"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2001", "Ascension Day"); - - lh.addStaticHoliday ("04-JUN-2001", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2001", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2002", "Berchtoldstag"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2002", "Ascension Day"); - - lh.addStaticHoliday ("20-MAY-2002", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2002", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2003", "Berchtoldstag"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2003", "Ascension Day"); - - lh.addStaticHoliday ("09-JUN-2003", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2003", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2004", "Berchtoldstag"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("20-MAY-2004", "Ascension Day"); - - lh.addStaticHoliday ("31-MAY-2004", "Whit Monday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2005", "Ascension Day"); - - lh.addStaticHoliday ("16-MAY-2005", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2005", "National Holiday"); - - lh.addStaticHoliday ("26-DEC-2005", "St. Stephens Day"); - - lh.addStaticHoliday ("02-JAN-2006", "Berchtoldstag"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2006", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2006", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2006", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2007", "Berchtoldstag"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2007", "Ascension Day"); - - lh.addStaticHoliday ("28-MAY-2007", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2007", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2008", "Berchtoldstag"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("12-MAY-2008", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2008", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2009", "Berchtoldstag"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2009", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-2009", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-2010", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-2010", "Whit Monday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("02-JUN-2011", "Ascension Day"); - - lh.addStaticHoliday ("13-JUN-2011", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2011", "National Holiday"); - - lh.addStaticHoliday ("26-DEC-2011", "St. Stephens Day"); - - lh.addStaticHoliday ("02-JAN-2012", "Berchtoldstag"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2012", "Ascension Day"); - - lh.addStaticHoliday ("28-MAY-2012", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2012", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2013", "Berchtoldstag"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2013", "Ascension Day"); - - lh.addStaticHoliday ("20-MAY-2013", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2013", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2014", "Berchtoldstag"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2014", "Ascension Day"); - - lh.addStaticHoliday ("09-JUN-2014", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2014", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2015", "Berchtoldstag"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("14-MAY-2015", "Ascension Day"); - - lh.addStaticHoliday ("25-MAY-2015", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2016", "Ascension Day"); - - lh.addStaticHoliday ("16-MAY-2016", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2016", "National Holiday"); - - lh.addStaticHoliday ("26-DEC-2016", "St. Stephens Day"); - - lh.addStaticHoliday ("02-JAN-2017", "Berchtoldstag"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2017", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2017", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2017", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2018", "Berchtoldstag"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("10-MAY-2018", "Ascension Day"); - - lh.addStaticHoliday ("21-MAY-2018", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2018", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2019", "Berchtoldstag"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2019", "Ascension Day"); - - lh.addStaticHoliday ("10-JUN-2019", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2019", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2020", "Berchtoldstag"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2020", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-2020", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-2021", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-2021", "Whit Monday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("26-MAY-2022", "Ascension Day"); - - lh.addStaticHoliday ("06-JUN-2022", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2022", "National Holiday"); - - lh.addStaticHoliday ("26-DEC-2022", "St. Stephens Day"); - - lh.addStaticHoliday ("02-JAN-2023", "Berchtoldstag"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("18-MAY-2023", "Ascension Day"); - - lh.addStaticHoliday ("29-MAY-2023", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2023", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2024", "Berchtoldstag"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2024", "Ascension Day"); - - lh.addStaticHoliday ("20-MAY-2024", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2024", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2025", "Berchtoldstag"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2025", "Ascension Day"); - - lh.addStaticHoliday ("09-JUN-2025", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2025", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2026", "Berchtoldstag"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("14-MAY-2026", "Ascension Day"); - - lh.addStaticHoliday ("25-MAY-2026", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("06-MAY-2027", "Ascension Day"); - - lh.addStaticHoliday ("17-MAY-2027", "Whit Monday"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2028", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2028", "Whit Monday"); - - lh.addStaticHoliday ("01-AUG-2028", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "St. Stephens Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/CLFHoliday.java b/org/drip/analytics/holset/CLFHoliday.java deleted file mode 100644 index 9f5fe92..0000000 --- a/org/drip/analytics/holset/CLFHoliday.java +++ /dev/null @@ -1,1463 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class CLFHoliday implements org.drip.analytics.holset.LocationHoliday { - public CLFHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "CLF"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-1998", "Battle of Iquique Day"); - - lh.addStaticHoliday ("11-JUN-1998", "Corpus Christi"); - - lh.addStaticHoliday ("29-JUN-1998", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("11-SEP-1998", "Liberation Day"); - - lh.addStaticHoliday ("18-SEP-1998", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-1998", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-1998", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("21-MAY-1999", "Battle of Iquique Day"); - - lh.addStaticHoliday ("03-JUN-1999", "Corpus Christi"); - - lh.addStaticHoliday ("29-JUN-1999", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("12-OCT-1999", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-1999", "Immaculate Conception"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("22-JUN-2000", "Corpus Christi"); - - lh.addStaticHoliday ("29-JUN-2000", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("15-AUG-2000", "Assumption Day"); - - lh.addStaticHoliday ("11-SEP-2000", "Liberation Day"); - - lh.addStaticHoliday ("18-SEP-2000", "Independence Day"); - - lh.addStaticHoliday ("19-SEP-2000", "Armed Forces Day"); - - lh.addStaticHoliday ("12-OCT-2000", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2000", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2001", "Battle of Iquique Day"); - - lh.addStaticHoliday ("14-JUN-2001", "Corpus Christi"); - - lh.addStaticHoliday ("29-JUN-2001", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("15-AUG-2001", "Assumption Day"); - - lh.addStaticHoliday ("11-SEP-2001", "Liberation Day"); - - lh.addStaticHoliday ("18-SEP-2001", "Independence Day"); - - lh.addStaticHoliday ("19-SEP-2001", "Armed Forces Day"); - - lh.addStaticHoliday ("12-OCT-2001", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2002", "Battle of Iquique Day"); - - lh.addStaticHoliday ("30-MAY-2002", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2002", "Assumption Day"); - - lh.addStaticHoliday ("11-SEP-2002", "Liberation Day"); - - lh.addStaticHoliday ("18-SEP-2002", "Independence Day"); - - lh.addStaticHoliday ("19-SEP-2002", "Armed Forces Day"); - - lh.addStaticHoliday ("01-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2003", "Battle of Iquique Day"); - - lh.addStaticHoliday ("19-JUN-2003", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2003", "Assumption Day"); - - lh.addStaticHoliday ("11-SEP-2003", "Liberation Day"); - - lh.addStaticHoliday ("18-SEP-2003", "Independence Day"); - - lh.addStaticHoliday ("19-SEP-2003", "Armed Forces Day"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("21-MAY-2004", "Battle of Iquique Day"); - - lh.addStaticHoliday ("10-JUN-2004", "Corpus Christi"); - - lh.addStaticHoliday ("29-JUN-2004", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("12-OCT-2004", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2004", "Immaculate Conception"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("26-MAY-2005", "Corpus Christi"); - - lh.addStaticHoliday ("29-JUN-2005", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("19-SEP-2005", "Armed Forces Day"); - - lh.addStaticHoliday ("12-OCT-2005", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2005", "Immaculate Conception"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("15-JUN-2006", "Corpus Christi"); - - lh.addStaticHoliday ("29-JUN-2006", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("15-AUG-2006", "Assumption Day"); - - lh.addStaticHoliday ("11-SEP-2006", "Liberation Day"); - - lh.addStaticHoliday ("18-SEP-2006", "Independence Day"); - - lh.addStaticHoliday ("19-SEP-2006", "Armed Forces Day"); - - lh.addStaticHoliday ("12-OCT-2006", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2006", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2007", "Battle of Iquique Day"); - - lh.addStaticHoliday ("02-JUL-2007", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("16-JUL-2007", "Virgen Del Carmen"); - - lh.addStaticHoliday ("15-AUG-2007", "Assumption Day"); - - lh.addStaticHoliday ("17-SEP-2007", "One off holiday"); - - lh.addStaticHoliday ("18-SEP-2007", "Independence Day"); - - lh.addStaticHoliday ("19-SEP-2007", "Armed Forces Day"); - - lh.addStaticHoliday ("15-OCT-2007", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2007", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2008", "Battle of Iquique Day"); - - lh.addStaticHoliday ("15-AUG-2008", "Assumption Day"); - - lh.addStaticHoliday ("18-SEP-2008", "Independence Day"); - - lh.addStaticHoliday ("19-SEP-2008", "Armed Forces Day"); - - lh.addStaticHoliday ("31-OCT-2008", "National Evangelical Date"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2008", "Day before New Year"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2009", "Battle of Iquique Day"); - - lh.addStaticHoliday ("29-JUN-2009", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("16-JUL-2009", "Birgen Del Carmen Day"); - - lh.addStaticHoliday ("18-SEP-2009", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2009", "Day of the Race"); - - lh.addStaticHoliday ("31-OCT-2009", "National Evangelical Date"); - - lh.addStaticHoliday ("08-DEC-2009", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2009", "New Years Eve Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2010", "CLP"); - - lh.addStaticHoliday ("02-APR-2010", "CLP"); - - lh.addStaticHoliday ("21-MAY-2010", "CLP"); - - lh.addStaticHoliday ("28-JUN-2010", "CLP"); - - lh.addStaticHoliday ("16-JUL-2010", "CLP"); - - lh.addStaticHoliday ("17-SEP-2010", "CLP"); - - lh.addStaticHoliday ("20-SEP-2010", "CLP"); - - lh.addStaticHoliday ("11-OCT-2010", "CLP"); - - lh.addStaticHoliday ("01-NOV-2010", "CLP"); - - lh.addStaticHoliday ("08-DEC-2010", "CLP"); - - lh.addStaticHoliday ("31-DEC-2010", "CLP"); - - lh.addStaticHoliday ("22-APR-2011", "CLP"); - - lh.addStaticHoliday ("27-JUN-2011", "CLP"); - - lh.addStaticHoliday ("15-AUG-2011", "CLP"); - - lh.addStaticHoliday ("19-SEP-2011", "CLP"); - - lh.addStaticHoliday ("10-OCT-2011", "CLP"); - - lh.addStaticHoliday ("31-OCT-2011", "CLP"); - - lh.addStaticHoliday ("01-NOV-2011", "CLP"); - - lh.addStaticHoliday ("08-DEC-2011", "CLP"); - - lh.addStaticHoliday ("06-APR-2012", "CLP"); - - lh.addStaticHoliday ("01-MAY-2012", "CLP"); - - lh.addStaticHoliday ("21-MAY-2012", "CLP"); - - lh.addStaticHoliday ("02-JUL-2012", "CLP"); - - lh.addStaticHoliday ("16-JUL-2012", "CLP"); - - lh.addStaticHoliday ("15-AUG-2012", "CLP"); - - lh.addStaticHoliday ("17-SEP-2012", "Independence Day"); - - lh.addStaticHoliday ("18-SEP-2012", "CLP"); - - lh.addStaticHoliday ("19-SEP-2012", "CLP"); - - lh.addStaticHoliday ("15-OCT-2012", "CLP"); - - lh.addStaticHoliday ("01-NOV-2012", "CLP"); - - lh.addStaticHoliday ("02-NOV-2012", "CLP"); - - lh.addStaticHoliday ("25-DEC-2012", "CLP"); - - lh.addStaticHoliday ("31-DEC-2012", "CLP"); - - lh.addStaticHoliday ("01-JAN-2013", "CLP"); - - lh.addStaticHoliday ("29-MAR-2013", "CLP"); - - lh.addStaticHoliday ("01-MAY-2013", "CLP"); - - lh.addStaticHoliday ("21-MAY-2013", "CLP"); - - lh.addStaticHoliday ("16-JUL-2013", "CLP"); - - lh.addStaticHoliday ("15-AUG-2013", "CLP"); - - lh.addStaticHoliday ("18-SEP-2013", "CLP"); - - lh.addStaticHoliday ("19-SEP-2013", "CLP"); - - lh.addStaticHoliday ("31-OCT-2013", "CLP"); - - lh.addStaticHoliday ("01-NOV-2013", "CLP"); - - lh.addStaticHoliday ("25-DEC-2013", "CLP"); - - lh.addStaticHoliday ("31-DEC-2013", "CLP"); - - lh.addStaticHoliday ("01-JAN-2014", "CLP"); - - lh.addStaticHoliday ("18-APR-2014", "CLP"); - - lh.addStaticHoliday ("01-MAY-2014", "CLP"); - - lh.addStaticHoliday ("21-MAY-2014", "CLP"); - - lh.addStaticHoliday ("16-JUL-2014", "CLP"); - - lh.addStaticHoliday ("15-AUG-2014", "CLP"); - - lh.addStaticHoliday ("18-SEP-2014", "CLP"); - - lh.addStaticHoliday ("19-SEP-2014", "CLP"); - - lh.addStaticHoliday ("31-OCT-2014", "CLP"); - - lh.addStaticHoliday ("08-DEC-2014", "CLP"); - - lh.addStaticHoliday ("25-DEC-2014", "CLP"); - - lh.addStaticHoliday ("31-DEC-2014", "CLP"); - - lh.addStaticHoliday ("01-JAN-2015", "CLP"); - - lh.addStaticHoliday ("03-APR-2015", "CLP"); - - lh.addStaticHoliday ("01-MAY-2015", "CLP"); - - lh.addStaticHoliday ("21-MAY-2015", "CLP"); - - lh.addStaticHoliday ("29-JUN-2015", "CLP"); - - lh.addStaticHoliday ("16-JUL-2015", "CLP"); - - lh.addStaticHoliday ("18-SEP-2015", "CLP"); - - lh.addStaticHoliday ("12-OCT-2015", "CLP"); - - lh.addStaticHoliday ("08-DEC-2015", "CLP"); - - lh.addStaticHoliday ("25-DEC-2015", "CLP"); - - lh.addStaticHoliday ("31-DEC-2015", "CLP"); - - lh.addStaticHoliday ("01-JAN-2016", "CLP"); - - lh.addStaticHoliday ("25-MAR-2016", "CLP"); - - lh.addStaticHoliday ("27-JUN-2016", "CLP"); - - lh.addStaticHoliday ("15-AUG-2016", "CLP"); - - lh.addStaticHoliday ("19-SEP-2016", "CLP"); - - lh.addStaticHoliday ("10-OCT-2016", "CLP"); - - lh.addStaticHoliday ("31-OCT-2016", "CLP"); - - lh.addStaticHoliday ("01-NOV-2016", "CLP"); - - lh.addStaticHoliday ("08-DEC-2016", "CLP"); - - lh.addStaticHoliday ("14-APR-2017", "CLP"); - - lh.addStaticHoliday ("01-MAY-2017", "CLP"); - - lh.addStaticHoliday ("26-JUN-2017", "CLP"); - - lh.addStaticHoliday ("15-AUG-2017", "CLP"); - - lh.addStaticHoliday ("18-SEP-2017", "CLP"); - - lh.addStaticHoliday ("19-SEP-2017", "CLP"); - - lh.addStaticHoliday ("09-OCT-2017", "CLP"); - - lh.addStaticHoliday ("27-OCT-2017", "CLP"); - - lh.addStaticHoliday ("01-NOV-2017", "CLP"); - - lh.addStaticHoliday ("08-DEC-2017", "CLP"); - - lh.addStaticHoliday ("25-DEC-2017", "CLP"); - - lh.addStaticHoliday ("01-JAN-2018", "CLP"); - - lh.addStaticHoliday ("30-MAR-2018", "CLP"); - - lh.addStaticHoliday ("01-MAY-2018", "CLP"); - - lh.addStaticHoliday ("21-MAY-2018", "CLP"); - - lh.addStaticHoliday ("02-JUL-2018", "CLP"); - - lh.addStaticHoliday ("16-JUL-2018", "CLP"); - - lh.addStaticHoliday ("15-AUG-2018", "CLP"); - - lh.addStaticHoliday ("18-SEP-2018", "CLP"); - - lh.addStaticHoliday ("19-SEP-2018", "CLP"); - - lh.addStaticHoliday ("15-OCT-2018", "CLP"); - - lh.addStaticHoliday ("01-NOV-2018", "CLP"); - - lh.addStaticHoliday ("02-NOV-2018", "CLP"); - - lh.addStaticHoliday ("25-DEC-2018", "CLP"); - - lh.addStaticHoliday ("31-DEC-2018", "CLP"); - - lh.addStaticHoliday ("01-JAN-2019", "CLP"); - - lh.addStaticHoliday ("19-APR-2019", "CLP"); - - lh.addStaticHoliday ("01-MAY-2019", "CLP"); - - lh.addStaticHoliday ("21-MAY-2019", "CLP"); - - lh.addStaticHoliday ("16-JUL-2019", "CLP"); - - lh.addStaticHoliday ("15-AUG-2019", "CLP"); - - lh.addStaticHoliday ("18-SEP-2019", "CLP"); - - lh.addStaticHoliday ("19-SEP-2019", "CLP"); - - lh.addStaticHoliday ("31-OCT-2019", "CLP"); - - lh.addStaticHoliday ("01-NOV-2019", "CLP"); - - lh.addStaticHoliday ("25-DEC-2019", "CLP"); - - lh.addStaticHoliday ("31-DEC-2019", "CLP"); - - lh.addStaticHoliday ("01-JAN-2020", "CLP"); - - lh.addStaticHoliday ("10-APR-2020", "CLP"); - - lh.addStaticHoliday ("01-MAY-2020", "CLP"); - - lh.addStaticHoliday ("21-MAY-2020", "CLP"); - - lh.addStaticHoliday ("29-JUN-2020", "CLP"); - - lh.addStaticHoliday ("16-JUL-2020", "CLP"); - - lh.addStaticHoliday ("18-SEP-2020", "CLP"); - - lh.addStaticHoliday ("12-OCT-2020", "CLP"); - - lh.addStaticHoliday ("08-DEC-2020", "CLP"); - - lh.addStaticHoliday ("25-DEC-2020", "CLP"); - - lh.addStaticHoliday ("31-DEC-2020", "CLP"); - - lh.addStaticHoliday ("01-JAN-2021", "CLP"); - - lh.addStaticHoliday ("02-APR-2021", "CLP"); - - lh.addStaticHoliday ("21-MAY-2021", "CLP"); - - lh.addStaticHoliday ("28-JUN-2021", "CLP"); - - lh.addStaticHoliday ("16-JUL-2021", "CLP"); - - lh.addStaticHoliday ("12-OCT-2021", "CLP"); - - lh.addStaticHoliday ("01-NOV-2021", "CLP"); - - lh.addStaticHoliday ("08-DEC-2021", "CLP"); - - lh.addStaticHoliday ("31-DEC-2021", "CLP"); - - lh.addStaticHoliday ("15-APR-2022", "CLP"); - - lh.addStaticHoliday ("27-JUN-2022", "CLP"); - - lh.addStaticHoliday ("15-AUG-2022", "CLP"); - - lh.addStaticHoliday ("19-SEP-2022", "CLP"); - - lh.addStaticHoliday ("10-OCT-2022", "CLP"); - - lh.addStaticHoliday ("31-OCT-2022", "CLP"); - - lh.addStaticHoliday ("01-NOV-2022", "CLP"); - - lh.addStaticHoliday ("08-DEC-2022", "CLP"); - - lh.addStaticHoliday ("07-APR-2023", "CLP"); - - lh.addStaticHoliday ("01-MAY-2023", "CLP"); - - lh.addStaticHoliday ("26-JUN-2023", "CLP"); - - lh.addStaticHoliday ("15-AUG-2023", "CLP"); - - lh.addStaticHoliday ("18-SEP-2023", "CLP"); - - lh.addStaticHoliday ("19-SEP-2023", "CLP"); - - lh.addStaticHoliday ("09-OCT-2023", "CLP"); - - lh.addStaticHoliday ("27-OCT-2023", "CLP"); - - lh.addStaticHoliday ("01-NOV-2023", "CLP"); - - lh.addStaticHoliday ("08-DEC-2023", "CLP"); - - lh.addStaticHoliday ("25-DEC-2023", "CLP"); - - lh.addStaticHoliday ("01-JAN-2024", "CLP"); - - lh.addStaticHoliday ("29-MAR-2024", "CLP"); - - lh.addStaticHoliday ("01-MAY-2024", "CLP"); - - lh.addStaticHoliday ("21-MAY-2024", "CLP"); - - lh.addStaticHoliday ("16-JUL-2024", "CLP"); - - lh.addStaticHoliday ("15-AUG-2024", "CLP"); - - lh.addStaticHoliday ("18-SEP-2024", "CLP"); - - lh.addStaticHoliday ("19-SEP-2024", "CLP"); - - lh.addStaticHoliday ("31-OCT-2024", "CLP"); - - lh.addStaticHoliday ("01-NOV-2024", "CLP"); - - lh.addStaticHoliday ("25-DEC-2024", "CLP"); - - lh.addStaticHoliday ("31-DEC-2024", "CLP"); - - lh.addStaticHoliday ("01-JAN-2025", "CLP"); - - lh.addStaticHoliday ("18-APR-2025", "CLP"); - - lh.addStaticHoliday ("01-MAY-2025", "CLP"); - - lh.addStaticHoliday ("21-MAY-2025", "CLP"); - - lh.addStaticHoliday ("16-JUL-2025", "CLP"); - - lh.addStaticHoliday ("15-AUG-2025", "CLP"); - - lh.addStaticHoliday ("18-SEP-2025", "CLP"); - - lh.addStaticHoliday ("19-SEP-2025", "CLP"); - - lh.addStaticHoliday ("31-OCT-2025", "CLP"); - - lh.addStaticHoliday ("08-DEC-2025", "CLP"); - - lh.addStaticHoliday ("25-DEC-2025", "CLP"); - - lh.addStaticHoliday ("31-DEC-2025", "CLP"); - - lh.addStaticHoliday ("01-JAN-2026", "CLP"); - - lh.addStaticHoliday ("03-APR-2026", "CLP"); - - lh.addStaticHoliday ("01-MAY-2026", "CLP"); - - lh.addStaticHoliday ("21-MAY-2026", "CLP"); - - lh.addStaticHoliday ("29-JUN-2026", "CLP"); - - lh.addStaticHoliday ("16-JUL-2026", "CLP"); - - lh.addStaticHoliday ("18-SEP-2026", "CLP"); - - lh.addStaticHoliday ("12-OCT-2026", "CLP"); - - lh.addStaticHoliday ("08-DEC-2026", "CLP"); - - lh.addStaticHoliday ("25-DEC-2026", "CLP"); - - lh.addStaticHoliday ("31-DEC-2026", "CLP"); - - lh.addStaticHoliday ("01-JAN-2027", "CLP"); - - lh.addStaticHoliday ("26-MAR-2027", "CLP"); - - lh.addStaticHoliday ("21-MAY-2027", "CLP"); - - lh.addStaticHoliday ("28-JUN-2027", "CLP"); - - lh.addStaticHoliday ("16-JUL-2027", "CLP"); - - lh.addStaticHoliday ("11-OCT-2027", "CLP"); - - lh.addStaticHoliday ("01-NOV-2027", "CLP"); - - lh.addStaticHoliday ("08-DEC-2027", "CLP"); - - lh.addStaticHoliday ("31-DEC-2027", "CLP"); - - lh.addStaticHoliday ("14-APR-2028", "CLP"); - - lh.addStaticHoliday ("01-MAY-2028", "CLP"); - - lh.addStaticHoliday ("26-JUN-2028", "CLP"); - - lh.addStaticHoliday ("15-AUG-2028", "CLP"); - - lh.addStaticHoliday ("18-SEP-2028", "CLP"); - - lh.addStaticHoliday ("19-SEP-2028", "CLP"); - - lh.addStaticHoliday ("09-OCT-2028", "CLP"); - - lh.addStaticHoliday ("27-OCT-2028", "CLP"); - - lh.addStaticHoliday ("01-NOV-2028", "CLP"); - - lh.addStaticHoliday ("08-DEC-2028", "CLP"); - - lh.addStaticHoliday ("25-DEC-2028", "CLP"); - - lh.addStaticHoliday ("01-JAN-2029", "CLP"); - - lh.addStaticHoliday ("30-MAR-2029", "CLP"); - - lh.addStaticHoliday ("01-MAY-2029", "CLP"); - - lh.addStaticHoliday ("21-MAY-2029", "CLP"); - - lh.addStaticHoliday ("02-JUL-2029", "CLP"); - - lh.addStaticHoliday ("16-JUL-2029", "CLP"); - - lh.addStaticHoliday ("15-AUG-2029", "CLP"); - - lh.addStaticHoliday ("18-SEP-2029", "CLP"); - - lh.addStaticHoliday ("19-SEP-2029", "CLP"); - - lh.addStaticHoliday ("15-OCT-2029", "CLP"); - - lh.addStaticHoliday ("01-NOV-2029", "CLP"); - - lh.addStaticHoliday ("02-NOV-2029", "CLP"); - - lh.addStaticHoliday ("25-DEC-2029", "CLP"); - - lh.addStaticHoliday ("31-DEC-2029", "CLP"); - - lh.addStaticHoliday ("01-JAN-2030", "CLP"); - - lh.addStaticHoliday ("19-APR-2030", "CLP"); - - lh.addStaticHoliday ("01-MAY-2030", "CLP"); - - lh.addStaticHoliday ("21-MAY-2030", "CLP"); - - lh.addStaticHoliday ("16-JUL-2030", "CLP"); - - lh.addStaticHoliday ("15-AUG-2030", "CLP"); - - lh.addStaticHoliday ("18-SEP-2030", "CLP"); - - lh.addStaticHoliday ("19-SEP-2030", "CLP"); - - lh.addStaticHoliday ("31-OCT-2030", "CLP"); - - lh.addStaticHoliday ("01-NOV-2030", "CLP"); - - lh.addStaticHoliday ("25-DEC-2030", "CLP"); - - lh.addStaticHoliday ("31-DEC-2030", "CLP"); - - lh.addStaticHoliday ("01-JAN-2031", "CLP"); - - lh.addStaticHoliday ("11-APR-2031", "CLP"); - - lh.addStaticHoliday ("01-MAY-2031", "CLP"); - - lh.addStaticHoliday ("21-MAY-2031", "CLP"); - - lh.addStaticHoliday ("16-JUL-2031", "CLP"); - - lh.addStaticHoliday ("15-AUG-2031", "CLP"); - - lh.addStaticHoliday ("18-SEP-2031", "CLP"); - - lh.addStaticHoliday ("19-SEP-2031", "CLP"); - - lh.addStaticHoliday ("31-OCT-2031", "CLP"); - - lh.addStaticHoliday ("08-DEC-2031", "CLP"); - - lh.addStaticHoliday ("25-DEC-2031", "CLP"); - - lh.addStaticHoliday ("31-DEC-2031", "CLP"); - - lh.addStaticHoliday ("01-JAN-2032", "CLP"); - - lh.addStaticHoliday ("26-MAR-2032", "CLP"); - - lh.addStaticHoliday ("21-MAY-2032", "CLP"); - - lh.addStaticHoliday ("28-JUN-2032", "CLP"); - - lh.addStaticHoliday ("16-JUL-2032", "CLP"); - - lh.addStaticHoliday ("11-OCT-2032", "CLP"); - - lh.addStaticHoliday ("01-NOV-2032", "CLP"); - - lh.addStaticHoliday ("08-DEC-2032", "CLP"); - - lh.addStaticHoliday ("31-DEC-2032", "CLP"); - - lh.addStaticHoliday ("15-APR-2033", "CLP"); - - lh.addStaticHoliday ("27-JUN-2033", "CLP"); - - lh.addStaticHoliday ("15-AUG-2033", "CLP"); - - lh.addStaticHoliday ("19-SEP-2033", "CLP"); - - lh.addStaticHoliday ("10-OCT-2033", "CLP"); - - lh.addStaticHoliday ("31-OCT-2033", "CLP"); - - lh.addStaticHoliday ("01-NOV-2033", "CLP"); - - lh.addStaticHoliday ("08-DEC-2033", "CLP"); - - lh.addStaticHoliday ("07-APR-2034", "CLP"); - - lh.addStaticHoliday ("01-MAY-2034", "CLP"); - - lh.addStaticHoliday ("26-JUN-2034", "CLP"); - - lh.addStaticHoliday ("15-AUG-2034", "CLP"); - - lh.addStaticHoliday ("18-SEP-2034", "CLP"); - - lh.addStaticHoliday ("19-SEP-2034", "CLP"); - - lh.addStaticHoliday ("09-OCT-2034", "CLP"); - - lh.addStaticHoliday ("27-OCT-2034", "CLP"); - - lh.addStaticHoliday ("01-NOV-2034", "CLP"); - - lh.addStaticHoliday ("08-DEC-2034", "CLP"); - - lh.addStaticHoliday ("25-DEC-2034", "CLP"); - - lh.addStaticHoliday ("01-JAN-2035", "CLP"); - - lh.addStaticHoliday ("23-MAR-2035", "CLP"); - - lh.addStaticHoliday ("01-MAY-2035", "CLP"); - - lh.addStaticHoliday ("21-MAY-2035", "CLP"); - - lh.addStaticHoliday ("02-JUL-2035", "CLP"); - - lh.addStaticHoliday ("16-JUL-2035", "CLP"); - - lh.addStaticHoliday ("15-AUG-2035", "CLP"); - - lh.addStaticHoliday ("18-SEP-2035", "CLP"); - - lh.addStaticHoliday ("19-SEP-2035", "CLP"); - - lh.addStaticHoliday ("15-OCT-2035", "CLP"); - - lh.addStaticHoliday ("01-NOV-2035", "CLP"); - - lh.addStaticHoliday ("02-NOV-2035", "CLP"); - - lh.addStaticHoliday ("25-DEC-2035", "CLP"); - - lh.addStaticHoliday ("31-DEC-2035", "CLP"); - - lh.addStaticHoliday ("01-JAN-2036", "CLP"); - - lh.addStaticHoliday ("11-APR-2036", "CLP"); - - lh.addStaticHoliday ("01-MAY-2036", "CLP"); - - lh.addStaticHoliday ("21-MAY-2036", "CLP"); - - lh.addStaticHoliday ("16-JUL-2036", "CLP"); - - lh.addStaticHoliday ("15-AUG-2036", "CLP"); - - lh.addStaticHoliday ("18-SEP-2036", "CLP"); - - lh.addStaticHoliday ("19-SEP-2036", "CLP"); - - lh.addStaticHoliday ("31-OCT-2036", "CLP"); - - lh.addStaticHoliday ("08-DEC-2036", "CLP"); - - lh.addStaticHoliday ("25-DEC-2036", "CLP"); - - lh.addStaticHoliday ("31-DEC-2036", "CLP"); - - lh.addStaticHoliday ("01-JAN-2037", "CLP"); - - lh.addStaticHoliday ("03-APR-2037", "CLP"); - - lh.addStaticHoliday ("01-MAY-2037", "CLP"); - - lh.addStaticHoliday ("21-MAY-2037", "CLP"); - - lh.addStaticHoliday ("29-JUN-2037", "CLP"); - - lh.addStaticHoliday ("16-JUL-2037", "CLP"); - - lh.addStaticHoliday ("18-SEP-2037", "CLP"); - - lh.addStaticHoliday ("12-OCT-2037", "CLP"); - - lh.addStaticHoliday ("08-DEC-2037", "CLP"); - - lh.addStaticHoliday ("25-DEC-2037", "CLP"); - - lh.addStaticHoliday ("31-DEC-2037", "CLP"); - - lh.addStaticHoliday ("01-JAN-2038", "CLP"); - - lh.addStaticHoliday ("23-APR-2038", "CLP"); - - lh.addStaticHoliday ("21-MAY-2038", "CLP"); - - lh.addStaticHoliday ("28-JUN-2038", "CLP"); - - lh.addStaticHoliday ("16-JUL-2038", "CLP"); - - lh.addStaticHoliday ("11-OCT-2038", "CLP"); - - lh.addStaticHoliday ("01-NOV-2038", "CLP"); - - lh.addStaticHoliday ("08-DEC-2038", "CLP"); - - lh.addStaticHoliday ("31-DEC-2038", "CLP"); - - lh.addStaticHoliday ("08-APR-2039", "CLP"); - - lh.addStaticHoliday ("27-JUN-2039", "CLP"); - - lh.addStaticHoliday ("15-AUG-2039", "CLP"); - - lh.addStaticHoliday ("19-SEP-2039", "CLP"); - - lh.addStaticHoliday ("10-OCT-2039", "CLP"); - - lh.addStaticHoliday ("31-OCT-2039", "CLP"); - - lh.addStaticHoliday ("01-NOV-2039", "CLP"); - - lh.addStaticHoliday ("08-DEC-2039", "CLP"); - - lh.addStaticHoliday ("30-MAR-2040", "CLP"); - - lh.addStaticHoliday ("01-MAY-2040", "CLP"); - - lh.addStaticHoliday ("21-MAY-2040", "CLP"); - - lh.addStaticHoliday ("02-JUL-2040", "CLP"); - - lh.addStaticHoliday ("16-JUL-2040", "CLP"); - - lh.addStaticHoliday ("15-AUG-2040", "CLP"); - - lh.addStaticHoliday ("18-SEP-2040", "CLP"); - - lh.addStaticHoliday ("19-SEP-2040", "CLP"); - - lh.addStaticHoliday ("15-OCT-2040", "CLP"); - - lh.addStaticHoliday ("01-NOV-2040", "CLP"); - - lh.addStaticHoliday ("02-NOV-2040", "CLP"); - - lh.addStaticHoliday ("25-DEC-2040", "CLP"); - - lh.addStaticHoliday ("31-DEC-2040", "CLP"); - - lh.addStaticHoliday ("01-JAN-2041", "CLP"); - - lh.addStaticHoliday ("19-APR-2041", "CLP"); - - lh.addStaticHoliday ("01-MAY-2041", "CLP"); - - lh.addStaticHoliday ("21-MAY-2041", "CLP"); - - lh.addStaticHoliday ("16-JUL-2041", "CLP"); - - lh.addStaticHoliday ("15-AUG-2041", "CLP"); - - lh.addStaticHoliday ("18-SEP-2041", "CLP"); - - lh.addStaticHoliday ("19-SEP-2041", "CLP"); - - lh.addStaticHoliday ("31-OCT-2041", "CLP"); - - lh.addStaticHoliday ("01-NOV-2041", "CLP"); - - lh.addStaticHoliday ("25-DEC-2041", "CLP"); - - lh.addStaticHoliday ("31-DEC-2041", "CLP"); - - lh.addStaticHoliday ("01-JAN-2042", "CLP"); - - lh.addStaticHoliday ("04-APR-2042", "CLP"); - - lh.addStaticHoliday ("01-MAY-2042", "CLP"); - - lh.addStaticHoliday ("21-MAY-2042", "CLP"); - - lh.addStaticHoliday ("16-JUL-2042", "CLP"); - - lh.addStaticHoliday ("15-AUG-2042", "CLP"); - - lh.addStaticHoliday ("18-SEP-2042", "CLP"); - - lh.addStaticHoliday ("19-SEP-2042", "CLP"); - - lh.addStaticHoliday ("31-OCT-2042", "CLP"); - - lh.addStaticHoliday ("08-DEC-2042", "CLP"); - - lh.addStaticHoliday ("25-DEC-2042", "CLP"); - - lh.addStaticHoliday ("31-DEC-2042", "CLP"); - - lh.addStaticHoliday ("01-JAN-2043", "CLP"); - - lh.addStaticHoliday ("27-MAR-2043", "CLP"); - - lh.addStaticHoliday ("01-MAY-2043", "CLP"); - - lh.addStaticHoliday ("21-MAY-2043", "CLP"); - - lh.addStaticHoliday ("29-JUN-2043", "CLP"); - - lh.addStaticHoliday ("16-JUL-2043", "CLP"); - - lh.addStaticHoliday ("18-SEP-2043", "CLP"); - - lh.addStaticHoliday ("12-OCT-2043", "CLP"); - - lh.addStaticHoliday ("08-DEC-2043", "CLP"); - - lh.addStaticHoliday ("25-DEC-2043", "CLP"); - - lh.addStaticHoliday ("31-DEC-2043", "CLP"); - - lh.addStaticHoliday ("01-JAN-2044", "CLP"); - - lh.addStaticHoliday ("15-APR-2044", "CLP"); - - lh.addStaticHoliday ("27-JUN-2044", "CLP"); - - lh.addStaticHoliday ("15-AUG-2044", "CLP"); - - lh.addStaticHoliday ("19-SEP-2044", "CLP"); - - lh.addStaticHoliday ("10-OCT-2044", "CLP"); - - lh.addStaticHoliday ("31-OCT-2044", "CLP"); - - lh.addStaticHoliday ("01-NOV-2044", "CLP"); - - lh.addStaticHoliday ("08-DEC-2044", "CLP"); - - lh.addStaticHoliday ("07-APR-2045", "CLP"); - - lh.addStaticHoliday ("01-MAY-2045", "CLP"); - - lh.addStaticHoliday ("26-JUN-2045", "CLP"); - - lh.addStaticHoliday ("15-AUG-2045", "CLP"); - - lh.addStaticHoliday ("18-SEP-2045", "CLP"); - - lh.addStaticHoliday ("19-SEP-2045", "CLP"); - - lh.addStaticHoliday ("09-OCT-2045", "CLP"); - - lh.addStaticHoliday ("27-OCT-2045", "CLP"); - - lh.addStaticHoliday ("01-NOV-2045", "CLP"); - - lh.addStaticHoliday ("08-DEC-2045", "CLP"); - - lh.addStaticHoliday ("25-DEC-2045", "CLP"); - - lh.addStaticHoliday ("01-JAN-2046", "CLP"); - - lh.addStaticHoliday ("23-MAR-2046", "CLP"); - - lh.addStaticHoliday ("01-MAY-2046", "CLP"); - - lh.addStaticHoliday ("21-MAY-2046", "CLP"); - - lh.addStaticHoliday ("02-JUL-2046", "CLP"); - - lh.addStaticHoliday ("16-JUL-2046", "CLP"); - - lh.addStaticHoliday ("15-AUG-2046", "CLP"); - - lh.addStaticHoliday ("18-SEP-2046", "CLP"); - - lh.addStaticHoliday ("19-SEP-2046", "CLP"); - - lh.addStaticHoliday ("15-OCT-2046", "CLP"); - - lh.addStaticHoliday ("01-NOV-2046", "CLP"); - - lh.addStaticHoliday ("02-NOV-2046", "CLP"); - - lh.addStaticHoliday ("25-DEC-2046", "CLP"); - - lh.addStaticHoliday ("31-DEC-2046", "CLP"); - - lh.addStaticHoliday ("01-JAN-2047", "CLP"); - - lh.addStaticHoliday ("12-APR-2047", "CLP"); - - lh.addStaticHoliday ("01-MAY-2047", "CLP"); - - lh.addStaticHoliday ("21-MAY-2047", "CLP"); - - lh.addStaticHoliday ("16-JUL-2047", "CLP"); - - lh.addStaticHoliday ("15-AUG-2047", "CLP"); - - lh.addStaticHoliday ("18-SEP-2047", "CLP"); - - lh.addStaticHoliday ("19-SEP-2047", "CLP"); - - lh.addStaticHoliday ("31-OCT-2047", "CLP"); - - lh.addStaticHoliday ("01-NOV-2047", "CLP"); - - lh.addStaticHoliday ("25-DEC-2047", "CLP"); - - lh.addStaticHoliday ("31-DEC-2047", "CLP"); - - lh.addStaticHoliday ("01-JAN-2048", "CLP"); - - lh.addStaticHoliday ("03-APR-2048", "CLP"); - - lh.addStaticHoliday ("01-MAY-2048", "CLP"); - - lh.addStaticHoliday ("21-MAY-2048", "CLP"); - - lh.addStaticHoliday ("29-JUN-2048", "CLP"); - - lh.addStaticHoliday ("16-JUL-2048", "CLP"); - - lh.addStaticHoliday ("18-SEP-2048", "CLP"); - - lh.addStaticHoliday ("12-OCT-2048", "CLP"); - - lh.addStaticHoliday ("08-DEC-2048", "CLP"); - - lh.addStaticHoliday ("25-DEC-2048", "CLP"); - - lh.addStaticHoliday ("31-DEC-2048", "CLP"); - - lh.addStaticHoliday ("01-JAN-2049", "CLP"); - - lh.addStaticHoliday ("16-APR-2049", "CLP"); - - lh.addStaticHoliday ("21-MAY-2049", "CLP"); - - lh.addStaticHoliday ("28-JUN-2049", "CLP"); - - lh.addStaticHoliday ("16-JUL-2049", "CLP"); - - lh.addStaticHoliday ("11-OCT-2049", "CLP"); - - lh.addStaticHoliday ("01-NOV-2049", "CLP"); - - lh.addStaticHoliday ("08-DEC-2049", "CLP"); - - lh.addStaticHoliday ("31-DEC-2049", "CLP"); - - lh.addStaticHoliday ("08-APR-2050", "CLP"); - - lh.addStaticHoliday ("27-JUN-2050", "CLP"); - - lh.addStaticHoliday ("15-AUG-2050", "CLP"); - - lh.addStaticHoliday ("19-SEP-2050", "CLP"); - - lh.addStaticHoliday ("10-OCT-2050", "CLP"); - - lh.addStaticHoliday ("31-OCT-2050", "CLP"); - - lh.addStaticHoliday ("01-NOV-2050", "CLP"); - - lh.addStaticHoliday ("08-DEC-2050", "CLP"); - - lh.addStaticHoliday ("31-MAR-2051", "CLP"); - - lh.addStaticHoliday ("01-MAY-2051", "CLP"); - - lh.addStaticHoliday ("26-JUN-2051", "CLP"); - - lh.addStaticHoliday ("15-AUG-2051", "CLP"); - - lh.addStaticHoliday ("18-SEP-2051", "CLP"); - - lh.addStaticHoliday ("19-SEP-2051", "CLP"); - - lh.addStaticHoliday ("09-OCT-2051", "CLP"); - - lh.addStaticHoliday ("27-OCT-2051", "CLP"); - - lh.addStaticHoliday ("01-NOV-2051", "CLP"); - - lh.addStaticHoliday ("08-DEC-2051", "CLP"); - - lh.addStaticHoliday ("25-DEC-2051", "CLP"); - - lh.addStaticHoliday ("01-JAN-2052", "CLP"); - - lh.addStaticHoliday ("19-APR-2052", "CLP"); - - lh.addStaticHoliday ("01-MAY-2052", "CLP"); - - lh.addStaticHoliday ("21-MAY-2052", "CLP"); - - lh.addStaticHoliday ("16-JUL-2052", "CLP"); - - lh.addStaticHoliday ("15-AUG-2052", "CLP"); - - lh.addStaticHoliday ("18-SEP-2052", "CLP"); - - lh.addStaticHoliday ("19-SEP-2052", "CLP"); - - lh.addStaticHoliday ("31-OCT-2052", "CLP"); - - lh.addStaticHoliday ("01-NOV-2052", "CLP"); - - lh.addStaticHoliday ("25-DEC-2052", "CLP"); - - lh.addStaticHoliday ("31-DEC-2052", "CLP"); - - lh.addStaticHoliday ("01-JAN-2053", "CLP"); - - lh.addStaticHoliday ("04-APR-2053", "CLP"); - - lh.addStaticHoliday ("01-MAY-2053", "CLP"); - - lh.addStaticHoliday ("21-MAY-2053", "CLP"); - - lh.addStaticHoliday ("16-JUL-2053", "CLP"); - - lh.addStaticHoliday ("15-AUG-2053", "CLP"); - - lh.addStaticHoliday ("18-SEP-2053", "CLP"); - - lh.addStaticHoliday ("19-SEP-2053", "CLP"); - - lh.addStaticHoliday ("31-OCT-2053", "CLP"); - - lh.addStaticHoliday ("08-DEC-2053", "CLP"); - - lh.addStaticHoliday ("25-DEC-2053", "CLP"); - - lh.addStaticHoliday ("31-DEC-2053", "CLP"); - - lh.addStaticHoliday ("01-JAN-2054", "CLP"); - - lh.addStaticHoliday ("27-MAR-2054", "CLP"); - - lh.addStaticHoliday ("01-MAY-2054", "CLP"); - - lh.addStaticHoliday ("21-MAY-2054", "CLP"); - - lh.addStaticHoliday ("29-JUN-2054", "CLP"); - - lh.addStaticHoliday ("16-JUL-2054", "CLP"); - - lh.addStaticHoliday ("18-SEP-2054", "CLP"); - - lh.addStaticHoliday ("12-OCT-2054", "CLP"); - - lh.addStaticHoliday ("08-DEC-2054", "CLP"); - - lh.addStaticHoliday ("25-DEC-2054", "CLP"); - - lh.addStaticHoliday ("31-DEC-2054", "CLP"); - - lh.addStaticHoliday ("01-JAN-2055", "CLP"); - - lh.addStaticHoliday ("16-APR-2055", "CLP"); - - lh.addStaticHoliday ("21-MAY-2055", "CLP"); - - lh.addStaticHoliday ("28-JUN-2055", "CLP"); - - lh.addStaticHoliday ("16-JUL-2055", "CLP"); - - lh.addStaticHoliday ("11-OCT-2055", "CLP"); - - lh.addStaticHoliday ("01-NOV-2055", "CLP"); - - lh.addStaticHoliday ("08-DEC-2055", "CLP"); - - lh.addStaticHoliday ("31-DEC-2055", "CLP"); - - lh.addStaticHoliday ("31-MAR-2056", "CLP"); - - lh.addStaticHoliday ("01-MAY-2056", "CLP"); - - lh.addStaticHoliday ("26-JUN-2056", "CLP"); - - lh.addStaticHoliday ("15-AUG-2056", "CLP"); - - lh.addStaticHoliday ("18-SEP-2056", "CLP"); - - lh.addStaticHoliday ("19-SEP-2056", "CLP"); - - lh.addStaticHoliday ("09-OCT-2056", "CLP"); - - lh.addStaticHoliday ("27-OCT-2056", "CLP"); - - lh.addStaticHoliday ("01-NOV-2056", "CLP"); - - lh.addStaticHoliday ("08-DEC-2056", "CLP"); - - lh.addStaticHoliday ("25-DEC-2056", "CLP"); - - lh.addStaticHoliday ("01-JAN-2057", "CLP"); - - lh.addStaticHoliday ("20-APR-2057", "CLP"); - - lh.addStaticHoliday ("01-MAY-2057", "CLP"); - - lh.addStaticHoliday ("21-MAY-2057", "CLP"); - - lh.addStaticHoliday ("02-JUL-2057", "CLP"); - - lh.addStaticHoliday ("16-JUL-2057", "CLP"); - - lh.addStaticHoliday ("15-AUG-2057", "CLP"); - - lh.addStaticHoliday ("18-SEP-2057", "CLP"); - - lh.addStaticHoliday ("19-SEP-2057", "CLP"); - - lh.addStaticHoliday ("15-OCT-2057", "CLP"); - - lh.addStaticHoliday ("01-NOV-2057", "CLP"); - - lh.addStaticHoliday ("02-NOV-2057", "CLP"); - - lh.addStaticHoliday ("25-DEC-2057", "CLP"); - - lh.addStaticHoliday ("31-DEC-2057", "CLP"); - - lh.addStaticHoliday ("01-JAN-2058", "CLP"); - - lh.addStaticHoliday ("12-APR-2058", "CLP"); - - lh.addStaticHoliday ("01-MAY-2058", "CLP"); - - lh.addStaticHoliday ("21-MAY-2058", "CLP"); - - lh.addStaticHoliday ("16-JUL-2058", "CLP"); - - lh.addStaticHoliday ("15-AUG-2058", "CLP"); - - lh.addStaticHoliday ("18-SEP-2058", "CLP"); - - lh.addStaticHoliday ("19-SEP-2058", "CLP"); - - lh.addStaticHoliday ("31-OCT-2058", "CLP"); - - lh.addStaticHoliday ("01-NOV-2058", "CLP"); - - lh.addStaticHoliday ("25-DEC-2058", "CLP"); - - lh.addStaticHoliday ("31-DEC-2058", "CLP"); - - lh.addStaticHoliday ("01-JAN-2059", "CLP"); - - lh.addStaticHoliday ("28-MAR-2059", "CLP"); - - lh.addStaticHoliday ("01-MAY-2059", "CLP"); - - lh.addStaticHoliday ("21-MAY-2059", "CLP"); - - lh.addStaticHoliday ("16-JUL-2059", "CLP"); - - lh.addStaticHoliday ("15-AUG-2059", "CLP"); - - lh.addStaticHoliday ("18-SEP-2059", "CLP"); - - lh.addStaticHoliday ("19-SEP-2059", "CLP"); - - lh.addStaticHoliday ("31-OCT-2059", "CLP"); - - lh.addStaticHoliday ("08-DEC-2059", "CLP"); - - lh.addStaticHoliday ("25-DEC-2059", "CLP"); - - lh.addStaticHoliday ("31-DEC-2059", "CLP"); - - lh.addStaticHoliday ("01-JAN-2060", "CLP"); - - lh.addStaticHoliday ("16-APR-2060", "CLP"); - - lh.addStaticHoliday ("21-MAY-2060", "CLP"); - - lh.addStaticHoliday ("28-JUN-2060", "CLP"); - - lh.addStaticHoliday ("16-JUL-2060", "CLP"); - - lh.addStaticHoliday ("11-OCT-2060", "CLP"); - - lh.addStaticHoliday ("01-NOV-2060", "CLP"); - - lh.addStaticHoliday ("08-DEC-2060", "CLP"); - - lh.addStaticHoliday ("31-DEC-2060", "CLP"); - - lh.addStaticHoliday ("08-APR-2061", "CLP"); - - lh.addStaticHoliday ("27-JUN-2061", "CLP"); - - lh.addStaticHoliday ("15-AUG-2061", "CLP"); - - lh.addStaticHoliday ("19-SEP-2061", "CLP"); - - lh.addStaticHoliday ("10-OCT-2061", "CLP"); - - lh.addStaticHoliday ("31-OCT-2061", "CLP"); - - lh.addStaticHoliday ("01-NOV-2061", "CLP"); - - lh.addStaticHoliday ("08-DEC-2061", "CLP"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/CLUHoliday.java b/org/drip/analytics/holset/CLUHoliday.java deleted file mode 100644 index 42a51e3..0000000 --- a/org/drip/analytics/holset/CLUHoliday.java +++ /dev/null @@ -1,1457 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class CLUHoliday implements org.drip.analytics.holset.LocationHoliday { - public CLUHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "CLU"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-1998", "Battle of Iquique Day"); - - lh.addStaticHoliday ("11-JUN-1998", "Corpus Christi"); - - lh.addStaticHoliday ("29-JUN-1998", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("11-SEP-1998", "Liberation Day"); - - lh.addStaticHoliday ("18-SEP-1998", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-1998", "Day of the Race"); - - lh.addStaticHoliday ("08-DEC-1998", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("21-MAY-1999", "Battle of Iquique Day"); - - lh.addStaticHoliday ("03-JUN-1999", "Corpus Christi"); - - lh.addStaticHoliday ("29-JUN-1999", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("12-OCT-1999", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-1999", "Immaculate Conception"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("22-JUN-2000", "Corpus Christi"); - - lh.addStaticHoliday ("29-JUN-2000", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("15-AUG-2000", "Assumption Day"); - - lh.addStaticHoliday ("11-SEP-2000", "Liberation Day"); - - lh.addStaticHoliday ("18-SEP-2000", "Independence Day"); - - lh.addStaticHoliday ("19-SEP-2000", "Armed Forces Day"); - - lh.addStaticHoliday ("12-OCT-2000", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2000", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2001", "Battle of Iquique Day"); - - lh.addStaticHoliday ("14-JUN-2001", "Corpus Christi"); - - lh.addStaticHoliday ("29-JUN-2001", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("15-AUG-2001", "Assumption Day"); - - lh.addStaticHoliday ("11-SEP-2001", "Liberation Day"); - - lh.addStaticHoliday ("18-SEP-2001", "Independence Day"); - - lh.addStaticHoliday ("19-SEP-2001", "Armed Forces Day"); - - lh.addStaticHoliday ("12-OCT-2001", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2002", "Battle of Iquique Day"); - - lh.addStaticHoliday ("30-MAY-2002", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2002", "Assumption Day"); - - lh.addStaticHoliday ("11-SEP-2002", "Liberation Day"); - - lh.addStaticHoliday ("18-SEP-2002", "Independence Day"); - - lh.addStaticHoliday ("19-SEP-2002", "Armed Forces Day"); - - lh.addStaticHoliday ("01-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2003", "Battle of Iquique Day"); - - lh.addStaticHoliday ("19-JUN-2003", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2003", "Assumption Day"); - - lh.addStaticHoliday ("11-SEP-2003", "Liberation Day"); - - lh.addStaticHoliday ("18-SEP-2003", "Independence Day"); - - lh.addStaticHoliday ("19-SEP-2003", "Armed Forces Day"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("21-MAY-2004", "Battle of Iquique Day"); - - lh.addStaticHoliday ("10-JUN-2004", "Corpus Christi"); - - lh.addStaticHoliday ("29-JUN-2004", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("12-OCT-2004", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2004", "Immaculate Conception"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("26-MAY-2005", "Corpus Christi"); - - lh.addStaticHoliday ("29-JUN-2005", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("19-SEP-2005", "Armed Forces Day"); - - lh.addStaticHoliday ("12-OCT-2005", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2005", "Immaculate Conception"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("15-JUN-2006", "Corpus Christi"); - - lh.addStaticHoliday ("29-JUN-2006", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("15-AUG-2006", "Assumption Day"); - - lh.addStaticHoliday ("11-SEP-2006", "Liberation Day"); - - lh.addStaticHoliday ("18-SEP-2006", "Independence Day"); - - lh.addStaticHoliday ("19-SEP-2006", "Armed Forces Day"); - - lh.addStaticHoliday ("12-OCT-2006", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2006", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2007", "Battle of Iquique Day"); - - lh.addStaticHoliday ("02-JUL-2007", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("16-JUL-2007", "Virgen Del Carmen"); - - lh.addStaticHoliday ("15-AUG-2007", "Assumption Day"); - - lh.addStaticHoliday ("17-SEP-2007", "One off holiday"); - - lh.addStaticHoliday ("18-SEP-2007", "Independence Day"); - - lh.addStaticHoliday ("19-SEP-2007", "Armed Forces Day"); - - lh.addStaticHoliday ("15-OCT-2007", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2007", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2008", "Battle of Iquique Day"); - - lh.addStaticHoliday ("15-AUG-2008", "Assumption Day"); - - lh.addStaticHoliday ("18-SEP-2008", "Independence Day"); - - lh.addStaticHoliday ("19-SEP-2008", "Armed Forces Day"); - - lh.addStaticHoliday ("31-OCT-2008", "National Evangelical Date"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2008", "Day before New Year"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2009", "Battle of Iquique Day"); - - lh.addStaticHoliday ("29-JUN-2009", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("16-JUL-2009", "Birgen Del Carmen Day"); - - lh.addStaticHoliday ("18-SEP-2009", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2009", "Day of the Race"); - - lh.addStaticHoliday ("31-OCT-2009", "National Evangelical Date"); - - lh.addStaticHoliday ("08-DEC-2009", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2009", "New Years Eve Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2010", "CLP"); - - lh.addStaticHoliday ("02-APR-2010", "CLP"); - - lh.addStaticHoliday ("21-MAY-2010", "CLP"); - - lh.addStaticHoliday ("28-JUN-2010", "CLP"); - - lh.addStaticHoliday ("16-JUL-2010", "CLP"); - - lh.addStaticHoliday ("11-OCT-2010", "CLP"); - - lh.addStaticHoliday ("01-NOV-2010", "CLP"); - - lh.addStaticHoliday ("08-DEC-2010", "CLP"); - - lh.addStaticHoliday ("31-DEC-2010", "CLP"); - - lh.addStaticHoliday ("22-APR-2011", "CLP"); - - lh.addStaticHoliday ("27-JUN-2011", "CLP"); - - lh.addStaticHoliday ("15-AUG-2011", "CLP"); - - lh.addStaticHoliday ("19-SEP-2011", "CLP"); - - lh.addStaticHoliday ("10-OCT-2011", "CLP"); - - lh.addStaticHoliday ("31-OCT-2011", "CLP"); - - lh.addStaticHoliday ("01-NOV-2011", "CLP"); - - lh.addStaticHoliday ("08-DEC-2011", "CLP"); - - lh.addStaticHoliday ("06-APR-2012", "CLP"); - - lh.addStaticHoliday ("01-MAY-2012", "CLP"); - - lh.addStaticHoliday ("21-MAY-2012", "CLP"); - - lh.addStaticHoliday ("02-JUL-2012", "CLP"); - - lh.addStaticHoliday ("16-JUL-2012", "CLP"); - - lh.addStaticHoliday ("15-AUG-2012", "CLP"); - - lh.addStaticHoliday ("18-SEP-2012", "CLP"); - - lh.addStaticHoliday ("19-SEP-2012", "CLP"); - - lh.addStaticHoliday ("15-OCT-2012", "CLP"); - - lh.addStaticHoliday ("01-NOV-2012", "CLP"); - - lh.addStaticHoliday ("02-NOV-2012", "CLP"); - - lh.addStaticHoliday ("25-DEC-2012", "CLP"); - - lh.addStaticHoliday ("31-DEC-2012", "CLP"); - - lh.addStaticHoliday ("01-JAN-2013", "CLP"); - - lh.addStaticHoliday ("29-MAR-2013", "CLP"); - - lh.addStaticHoliday ("01-MAY-2013", "CLP"); - - lh.addStaticHoliday ("21-MAY-2013", "CLP"); - - lh.addStaticHoliday ("16-JUL-2013", "CLP"); - - lh.addStaticHoliday ("15-AUG-2013", "CLP"); - - lh.addStaticHoliday ("18-SEP-2013", "CLP"); - - lh.addStaticHoliday ("19-SEP-2013", "CLP"); - - lh.addStaticHoliday ("31-OCT-2013", "CLP"); - - lh.addStaticHoliday ("01-NOV-2013", "CLP"); - - lh.addStaticHoliday ("25-DEC-2013", "CLP"); - - lh.addStaticHoliday ("31-DEC-2013", "CLP"); - - lh.addStaticHoliday ("01-JAN-2014", "CLP"); - - lh.addStaticHoliday ("18-APR-2014", "CLP"); - - lh.addStaticHoliday ("01-MAY-2014", "CLP"); - - lh.addStaticHoliday ("21-MAY-2014", "CLP"); - - lh.addStaticHoliday ("16-JUL-2014", "CLP"); - - lh.addStaticHoliday ("15-AUG-2014", "CLP"); - - lh.addStaticHoliday ("18-SEP-2014", "CLP"); - - lh.addStaticHoliday ("19-SEP-2014", "CLP"); - - lh.addStaticHoliday ("31-OCT-2014", "CLP"); - - lh.addStaticHoliday ("08-DEC-2014", "CLP"); - - lh.addStaticHoliday ("25-DEC-2014", "CLP"); - - lh.addStaticHoliday ("31-DEC-2014", "CLP"); - - lh.addStaticHoliday ("01-JAN-2015", "CLP"); - - lh.addStaticHoliday ("03-APR-2015", "CLP"); - - lh.addStaticHoliday ("01-MAY-2015", "CLP"); - - lh.addStaticHoliday ("21-MAY-2015", "CLP"); - - lh.addStaticHoliday ("29-JUN-2015", "CLP"); - - lh.addStaticHoliday ("16-JUL-2015", "CLP"); - - lh.addStaticHoliday ("18-SEP-2015", "CLP"); - - lh.addStaticHoliday ("12-OCT-2015", "CLP"); - - lh.addStaticHoliday ("08-DEC-2015", "CLP"); - - lh.addStaticHoliday ("25-DEC-2015", "CLP"); - - lh.addStaticHoliday ("31-DEC-2015", "CLP"); - - lh.addStaticHoliday ("01-JAN-2016", "CLP"); - - lh.addStaticHoliday ("25-MAR-2016", "CLP"); - - lh.addStaticHoliday ("27-JUN-2016", "CLP"); - - lh.addStaticHoliday ("15-AUG-2016", "CLP"); - - lh.addStaticHoliday ("19-SEP-2016", "CLP"); - - lh.addStaticHoliday ("10-OCT-2016", "CLP"); - - lh.addStaticHoliday ("31-OCT-2016", "CLP"); - - lh.addStaticHoliday ("01-NOV-2016", "CLP"); - - lh.addStaticHoliday ("08-DEC-2016", "CLP"); - - lh.addStaticHoliday ("14-APR-2017", "CLP"); - - lh.addStaticHoliday ("01-MAY-2017", "CLP"); - - lh.addStaticHoliday ("26-JUN-2017", "CLP"); - - lh.addStaticHoliday ("15-AUG-2017", "CLP"); - - lh.addStaticHoliday ("18-SEP-2017", "CLP"); - - lh.addStaticHoliday ("19-SEP-2017", "CLP"); - - lh.addStaticHoliday ("09-OCT-2017", "CLP"); - - lh.addStaticHoliday ("27-OCT-2017", "CLP"); - - lh.addStaticHoliday ("01-NOV-2017", "CLP"); - - lh.addStaticHoliday ("08-DEC-2017", "CLP"); - - lh.addStaticHoliday ("25-DEC-2017", "CLP"); - - lh.addStaticHoliday ("01-JAN-2018", "CLP"); - - lh.addStaticHoliday ("30-MAR-2018", "CLP"); - - lh.addStaticHoliday ("01-MAY-2018", "CLP"); - - lh.addStaticHoliday ("21-MAY-2018", "CLP"); - - lh.addStaticHoliday ("02-JUL-2018", "CLP"); - - lh.addStaticHoliday ("16-JUL-2018", "CLP"); - - lh.addStaticHoliday ("15-AUG-2018", "CLP"); - - lh.addStaticHoliday ("18-SEP-2018", "CLP"); - - lh.addStaticHoliday ("19-SEP-2018", "CLP"); - - lh.addStaticHoliday ("15-OCT-2018", "CLP"); - - lh.addStaticHoliday ("01-NOV-2018", "CLP"); - - lh.addStaticHoliday ("02-NOV-2018", "CLP"); - - lh.addStaticHoliday ("25-DEC-2018", "CLP"); - - lh.addStaticHoliday ("31-DEC-2018", "CLP"); - - lh.addStaticHoliday ("01-JAN-2019", "CLP"); - - lh.addStaticHoliday ("19-APR-2019", "CLP"); - - lh.addStaticHoliday ("01-MAY-2019", "CLP"); - - lh.addStaticHoliday ("21-MAY-2019", "CLP"); - - lh.addStaticHoliday ("16-JUL-2019", "CLP"); - - lh.addStaticHoliday ("15-AUG-2019", "CLP"); - - lh.addStaticHoliday ("18-SEP-2019", "CLP"); - - lh.addStaticHoliday ("19-SEP-2019", "CLP"); - - lh.addStaticHoliday ("31-OCT-2019", "CLP"); - - lh.addStaticHoliday ("01-NOV-2019", "CLP"); - - lh.addStaticHoliday ("25-DEC-2019", "CLP"); - - lh.addStaticHoliday ("31-DEC-2019", "CLP"); - - lh.addStaticHoliday ("01-JAN-2020", "CLP"); - - lh.addStaticHoliday ("10-APR-2020", "CLP"); - - lh.addStaticHoliday ("01-MAY-2020", "CLP"); - - lh.addStaticHoliday ("21-MAY-2020", "CLP"); - - lh.addStaticHoliday ("29-JUN-2020", "CLP"); - - lh.addStaticHoliday ("16-JUL-2020", "CLP"); - - lh.addStaticHoliday ("18-SEP-2020", "CLP"); - - lh.addStaticHoliday ("12-OCT-2020", "CLP"); - - lh.addStaticHoliday ("08-DEC-2020", "CLP"); - - lh.addStaticHoliday ("25-DEC-2020", "CLP"); - - lh.addStaticHoliday ("31-DEC-2020", "CLP"); - - lh.addStaticHoliday ("01-JAN-2021", "CLP"); - - lh.addStaticHoliday ("02-APR-2021", "CLP"); - - lh.addStaticHoliday ("21-MAY-2021", "CLP"); - - lh.addStaticHoliday ("28-JUN-2021", "CLP"); - - lh.addStaticHoliday ("16-JUL-2021", "CLP"); - - lh.addStaticHoliday ("12-OCT-2021", "CLP"); - - lh.addStaticHoliday ("01-NOV-2021", "CLP"); - - lh.addStaticHoliday ("08-DEC-2021", "CLP"); - - lh.addStaticHoliday ("31-DEC-2021", "CLP"); - - lh.addStaticHoliday ("15-APR-2022", "CLP"); - - lh.addStaticHoliday ("27-JUN-2022", "CLP"); - - lh.addStaticHoliday ("15-AUG-2022", "CLP"); - - lh.addStaticHoliday ("19-SEP-2022", "CLP"); - - lh.addStaticHoliday ("10-OCT-2022", "CLP"); - - lh.addStaticHoliday ("31-OCT-2022", "CLP"); - - lh.addStaticHoliday ("01-NOV-2022", "CLP"); - - lh.addStaticHoliday ("08-DEC-2022", "CLP"); - - lh.addStaticHoliday ("07-APR-2023", "CLP"); - - lh.addStaticHoliday ("01-MAY-2023", "CLP"); - - lh.addStaticHoliday ("26-JUN-2023", "CLP"); - - lh.addStaticHoliday ("15-AUG-2023", "CLP"); - - lh.addStaticHoliday ("18-SEP-2023", "CLP"); - - lh.addStaticHoliday ("19-SEP-2023", "CLP"); - - lh.addStaticHoliday ("09-OCT-2023", "CLP"); - - lh.addStaticHoliday ("27-OCT-2023", "CLP"); - - lh.addStaticHoliday ("01-NOV-2023", "CLP"); - - lh.addStaticHoliday ("08-DEC-2023", "CLP"); - - lh.addStaticHoliday ("25-DEC-2023", "CLP"); - - lh.addStaticHoliday ("01-JAN-2024", "CLP"); - - lh.addStaticHoliday ("29-MAR-2024", "CLP"); - - lh.addStaticHoliday ("01-MAY-2024", "CLP"); - - lh.addStaticHoliday ("21-MAY-2024", "CLP"); - - lh.addStaticHoliday ("16-JUL-2024", "CLP"); - - lh.addStaticHoliday ("15-AUG-2024", "CLP"); - - lh.addStaticHoliday ("18-SEP-2024", "CLP"); - - lh.addStaticHoliday ("19-SEP-2024", "CLP"); - - lh.addStaticHoliday ("31-OCT-2024", "CLP"); - - lh.addStaticHoliday ("01-NOV-2024", "CLP"); - - lh.addStaticHoliday ("25-DEC-2024", "CLP"); - - lh.addStaticHoliday ("31-DEC-2024", "CLP"); - - lh.addStaticHoliday ("01-JAN-2025", "CLP"); - - lh.addStaticHoliday ("18-APR-2025", "CLP"); - - lh.addStaticHoliday ("01-MAY-2025", "CLP"); - - lh.addStaticHoliday ("21-MAY-2025", "CLP"); - - lh.addStaticHoliday ("16-JUL-2025", "CLP"); - - lh.addStaticHoliday ("15-AUG-2025", "CLP"); - - lh.addStaticHoliday ("18-SEP-2025", "CLP"); - - lh.addStaticHoliday ("19-SEP-2025", "CLP"); - - lh.addStaticHoliday ("31-OCT-2025", "CLP"); - - lh.addStaticHoliday ("08-DEC-2025", "CLP"); - - lh.addStaticHoliday ("25-DEC-2025", "CLP"); - - lh.addStaticHoliday ("31-DEC-2025", "CLP"); - - lh.addStaticHoliday ("01-JAN-2026", "CLP"); - - lh.addStaticHoliday ("03-APR-2026", "CLP"); - - lh.addStaticHoliday ("01-MAY-2026", "CLP"); - - lh.addStaticHoliday ("21-MAY-2026", "CLP"); - - lh.addStaticHoliday ("29-JUN-2026", "CLP"); - - lh.addStaticHoliday ("16-JUL-2026", "CLP"); - - lh.addStaticHoliday ("18-SEP-2026", "CLP"); - - lh.addStaticHoliday ("12-OCT-2026", "CLP"); - - lh.addStaticHoliday ("08-DEC-2026", "CLP"); - - lh.addStaticHoliday ("25-DEC-2026", "CLP"); - - lh.addStaticHoliday ("31-DEC-2026", "CLP"); - - lh.addStaticHoliday ("01-JAN-2027", "CLP"); - - lh.addStaticHoliday ("26-MAR-2027", "CLP"); - - lh.addStaticHoliday ("21-MAY-2027", "CLP"); - - lh.addStaticHoliday ("28-JUN-2027", "CLP"); - - lh.addStaticHoliday ("16-JUL-2027", "CLP"); - - lh.addStaticHoliday ("11-OCT-2027", "CLP"); - - lh.addStaticHoliday ("01-NOV-2027", "CLP"); - - lh.addStaticHoliday ("08-DEC-2027", "CLP"); - - lh.addStaticHoliday ("31-DEC-2027", "CLP"); - - lh.addStaticHoliday ("14-APR-2028", "CLP"); - - lh.addStaticHoliday ("01-MAY-2028", "CLP"); - - lh.addStaticHoliday ("26-JUN-2028", "CLP"); - - lh.addStaticHoliday ("15-AUG-2028", "CLP"); - - lh.addStaticHoliday ("18-SEP-2028", "CLP"); - - lh.addStaticHoliday ("19-SEP-2028", "CLP"); - - lh.addStaticHoliday ("09-OCT-2028", "CLP"); - - lh.addStaticHoliday ("27-OCT-2028", "CLP"); - - lh.addStaticHoliday ("01-NOV-2028", "CLP"); - - lh.addStaticHoliday ("08-DEC-2028", "CLP"); - - lh.addStaticHoliday ("25-DEC-2028", "CLP"); - - lh.addStaticHoliday ("01-JAN-2029", "CLP"); - - lh.addStaticHoliday ("30-MAR-2029", "CLP"); - - lh.addStaticHoliday ("01-MAY-2029", "CLP"); - - lh.addStaticHoliday ("21-MAY-2029", "CLP"); - - lh.addStaticHoliday ("02-JUL-2029", "CLP"); - - lh.addStaticHoliday ("16-JUL-2029", "CLP"); - - lh.addStaticHoliday ("15-AUG-2029", "CLP"); - - lh.addStaticHoliday ("18-SEP-2029", "CLP"); - - lh.addStaticHoliday ("19-SEP-2029", "CLP"); - - lh.addStaticHoliday ("15-OCT-2029", "CLP"); - - lh.addStaticHoliday ("01-NOV-2029", "CLP"); - - lh.addStaticHoliday ("02-NOV-2029", "CLP"); - - lh.addStaticHoliday ("25-DEC-2029", "CLP"); - - lh.addStaticHoliday ("31-DEC-2029", "CLP"); - - lh.addStaticHoliday ("01-JAN-2030", "CLP"); - - lh.addStaticHoliday ("19-APR-2030", "CLP"); - - lh.addStaticHoliday ("01-MAY-2030", "CLP"); - - lh.addStaticHoliday ("21-MAY-2030", "CLP"); - - lh.addStaticHoliday ("16-JUL-2030", "CLP"); - - lh.addStaticHoliday ("15-AUG-2030", "CLP"); - - lh.addStaticHoliday ("18-SEP-2030", "CLP"); - - lh.addStaticHoliday ("19-SEP-2030", "CLP"); - - lh.addStaticHoliday ("31-OCT-2030", "CLP"); - - lh.addStaticHoliday ("01-NOV-2030", "CLP"); - - lh.addStaticHoliday ("25-DEC-2030", "CLP"); - - lh.addStaticHoliday ("31-DEC-2030", "CLP"); - - lh.addStaticHoliday ("01-JAN-2031", "CLP"); - - lh.addStaticHoliday ("11-APR-2031", "CLP"); - - lh.addStaticHoliday ("01-MAY-2031", "CLP"); - - lh.addStaticHoliday ("21-MAY-2031", "CLP"); - - lh.addStaticHoliday ("16-JUL-2031", "CLP"); - - lh.addStaticHoliday ("15-AUG-2031", "CLP"); - - lh.addStaticHoliday ("18-SEP-2031", "CLP"); - - lh.addStaticHoliday ("19-SEP-2031", "CLP"); - - lh.addStaticHoliday ("31-OCT-2031", "CLP"); - - lh.addStaticHoliday ("08-DEC-2031", "CLP"); - - lh.addStaticHoliday ("25-DEC-2031", "CLP"); - - lh.addStaticHoliday ("31-DEC-2031", "CLP"); - - lh.addStaticHoliday ("01-JAN-2032", "CLP"); - - lh.addStaticHoliday ("26-MAR-2032", "CLP"); - - lh.addStaticHoliday ("21-MAY-2032", "CLP"); - - lh.addStaticHoliday ("28-JUN-2032", "CLP"); - - lh.addStaticHoliday ("16-JUL-2032", "CLP"); - - lh.addStaticHoliday ("11-OCT-2032", "CLP"); - - lh.addStaticHoliday ("01-NOV-2032", "CLP"); - - lh.addStaticHoliday ("08-DEC-2032", "CLP"); - - lh.addStaticHoliday ("31-DEC-2032", "CLP"); - - lh.addStaticHoliday ("15-APR-2033", "CLP"); - - lh.addStaticHoliday ("27-JUN-2033", "CLP"); - - lh.addStaticHoliday ("15-AUG-2033", "CLP"); - - lh.addStaticHoliday ("19-SEP-2033", "CLP"); - - lh.addStaticHoliday ("10-OCT-2033", "CLP"); - - lh.addStaticHoliday ("31-OCT-2033", "CLP"); - - lh.addStaticHoliday ("01-NOV-2033", "CLP"); - - lh.addStaticHoliday ("08-DEC-2033", "CLP"); - - lh.addStaticHoliday ("07-APR-2034", "CLP"); - - lh.addStaticHoliday ("01-MAY-2034", "CLP"); - - lh.addStaticHoliday ("26-JUN-2034", "CLP"); - - lh.addStaticHoliday ("15-AUG-2034", "CLP"); - - lh.addStaticHoliday ("18-SEP-2034", "CLP"); - - lh.addStaticHoliday ("19-SEP-2034", "CLP"); - - lh.addStaticHoliday ("09-OCT-2034", "CLP"); - - lh.addStaticHoliday ("27-OCT-2034", "CLP"); - - lh.addStaticHoliday ("01-NOV-2034", "CLP"); - - lh.addStaticHoliday ("08-DEC-2034", "CLP"); - - lh.addStaticHoliday ("25-DEC-2034", "CLP"); - - lh.addStaticHoliday ("01-JAN-2035", "CLP"); - - lh.addStaticHoliday ("23-MAR-2035", "CLP"); - - lh.addStaticHoliday ("01-MAY-2035", "CLP"); - - lh.addStaticHoliday ("21-MAY-2035", "CLP"); - - lh.addStaticHoliday ("02-JUL-2035", "CLP"); - - lh.addStaticHoliday ("16-JUL-2035", "CLP"); - - lh.addStaticHoliday ("15-AUG-2035", "CLP"); - - lh.addStaticHoliday ("18-SEP-2035", "CLP"); - - lh.addStaticHoliday ("19-SEP-2035", "CLP"); - - lh.addStaticHoliday ("15-OCT-2035", "CLP"); - - lh.addStaticHoliday ("01-NOV-2035", "CLP"); - - lh.addStaticHoliday ("02-NOV-2035", "CLP"); - - lh.addStaticHoliday ("25-DEC-2035", "CLP"); - - lh.addStaticHoliday ("31-DEC-2035", "CLP"); - - lh.addStaticHoliday ("01-JAN-2036", "CLP"); - - lh.addStaticHoliday ("11-APR-2036", "CLP"); - - lh.addStaticHoliday ("01-MAY-2036", "CLP"); - - lh.addStaticHoliday ("21-MAY-2036", "CLP"); - - lh.addStaticHoliday ("16-JUL-2036", "CLP"); - - lh.addStaticHoliday ("15-AUG-2036", "CLP"); - - lh.addStaticHoliday ("18-SEP-2036", "CLP"); - - lh.addStaticHoliday ("19-SEP-2036", "CLP"); - - lh.addStaticHoliday ("31-OCT-2036", "CLP"); - - lh.addStaticHoliday ("08-DEC-2036", "CLP"); - - lh.addStaticHoliday ("25-DEC-2036", "CLP"); - - lh.addStaticHoliday ("31-DEC-2036", "CLP"); - - lh.addStaticHoliday ("01-JAN-2037", "CLP"); - - lh.addStaticHoliday ("03-APR-2037", "CLP"); - - lh.addStaticHoliday ("01-MAY-2037", "CLP"); - - lh.addStaticHoliday ("21-MAY-2037", "CLP"); - - lh.addStaticHoliday ("29-JUN-2037", "CLP"); - - lh.addStaticHoliday ("16-JUL-2037", "CLP"); - - lh.addStaticHoliday ("18-SEP-2037", "CLP"); - - lh.addStaticHoliday ("12-OCT-2037", "CLP"); - - lh.addStaticHoliday ("08-DEC-2037", "CLP"); - - lh.addStaticHoliday ("25-DEC-2037", "CLP"); - - lh.addStaticHoliday ("31-DEC-2037", "CLP"); - - lh.addStaticHoliday ("01-JAN-2038", "CLP"); - - lh.addStaticHoliday ("23-APR-2038", "CLP"); - - lh.addStaticHoliday ("21-MAY-2038", "CLP"); - - lh.addStaticHoliday ("28-JUN-2038", "CLP"); - - lh.addStaticHoliday ("16-JUL-2038", "CLP"); - - lh.addStaticHoliday ("11-OCT-2038", "CLP"); - - lh.addStaticHoliday ("01-NOV-2038", "CLP"); - - lh.addStaticHoliday ("08-DEC-2038", "CLP"); - - lh.addStaticHoliday ("31-DEC-2038", "CLP"); - - lh.addStaticHoliday ("08-APR-2039", "CLP"); - - lh.addStaticHoliday ("27-JUN-2039", "CLP"); - - lh.addStaticHoliday ("15-AUG-2039", "CLP"); - - lh.addStaticHoliday ("19-SEP-2039", "CLP"); - - lh.addStaticHoliday ("10-OCT-2039", "CLP"); - - lh.addStaticHoliday ("31-OCT-2039", "CLP"); - - lh.addStaticHoliday ("01-NOV-2039", "CLP"); - - lh.addStaticHoliday ("08-DEC-2039", "CLP"); - - lh.addStaticHoliday ("30-MAR-2040", "CLP"); - - lh.addStaticHoliday ("01-MAY-2040", "CLP"); - - lh.addStaticHoliday ("21-MAY-2040", "CLP"); - - lh.addStaticHoliday ("02-JUL-2040", "CLP"); - - lh.addStaticHoliday ("16-JUL-2040", "CLP"); - - lh.addStaticHoliday ("15-AUG-2040", "CLP"); - - lh.addStaticHoliday ("18-SEP-2040", "CLP"); - - lh.addStaticHoliday ("19-SEP-2040", "CLP"); - - lh.addStaticHoliday ("15-OCT-2040", "CLP"); - - lh.addStaticHoliday ("01-NOV-2040", "CLP"); - - lh.addStaticHoliday ("02-NOV-2040", "CLP"); - - lh.addStaticHoliday ("25-DEC-2040", "CLP"); - - lh.addStaticHoliday ("31-DEC-2040", "CLP"); - - lh.addStaticHoliday ("01-JAN-2041", "CLP"); - - lh.addStaticHoliday ("19-APR-2041", "CLP"); - - lh.addStaticHoliday ("01-MAY-2041", "CLP"); - - lh.addStaticHoliday ("21-MAY-2041", "CLP"); - - lh.addStaticHoliday ("16-JUL-2041", "CLP"); - - lh.addStaticHoliday ("15-AUG-2041", "CLP"); - - lh.addStaticHoliday ("18-SEP-2041", "CLP"); - - lh.addStaticHoliday ("19-SEP-2041", "CLP"); - - lh.addStaticHoliday ("31-OCT-2041", "CLP"); - - lh.addStaticHoliday ("01-NOV-2041", "CLP"); - - lh.addStaticHoliday ("25-DEC-2041", "CLP"); - - lh.addStaticHoliday ("31-DEC-2041", "CLP"); - - lh.addStaticHoliday ("01-JAN-2042", "CLP"); - - lh.addStaticHoliday ("04-APR-2042", "CLP"); - - lh.addStaticHoliday ("01-MAY-2042", "CLP"); - - lh.addStaticHoliday ("21-MAY-2042", "CLP"); - - lh.addStaticHoliday ("16-JUL-2042", "CLP"); - - lh.addStaticHoliday ("15-AUG-2042", "CLP"); - - lh.addStaticHoliday ("18-SEP-2042", "CLP"); - - lh.addStaticHoliday ("19-SEP-2042", "CLP"); - - lh.addStaticHoliday ("31-OCT-2042", "CLP"); - - lh.addStaticHoliday ("08-DEC-2042", "CLP"); - - lh.addStaticHoliday ("25-DEC-2042", "CLP"); - - lh.addStaticHoliday ("31-DEC-2042", "CLP"); - - lh.addStaticHoliday ("01-JAN-2043", "CLP"); - - lh.addStaticHoliday ("27-MAR-2043", "CLP"); - - lh.addStaticHoliday ("01-MAY-2043", "CLP"); - - lh.addStaticHoliday ("21-MAY-2043", "CLP"); - - lh.addStaticHoliday ("29-JUN-2043", "CLP"); - - lh.addStaticHoliday ("16-JUL-2043", "CLP"); - - lh.addStaticHoliday ("18-SEP-2043", "CLP"); - - lh.addStaticHoliday ("12-OCT-2043", "CLP"); - - lh.addStaticHoliday ("08-DEC-2043", "CLP"); - - lh.addStaticHoliday ("25-DEC-2043", "CLP"); - - lh.addStaticHoliday ("31-DEC-2043", "CLP"); - - lh.addStaticHoliday ("01-JAN-2044", "CLP"); - - lh.addStaticHoliday ("15-APR-2044", "CLP"); - - lh.addStaticHoliday ("27-JUN-2044", "CLP"); - - lh.addStaticHoliday ("15-AUG-2044", "CLP"); - - lh.addStaticHoliday ("19-SEP-2044", "CLP"); - - lh.addStaticHoliday ("10-OCT-2044", "CLP"); - - lh.addStaticHoliday ("31-OCT-2044", "CLP"); - - lh.addStaticHoliday ("01-NOV-2044", "CLP"); - - lh.addStaticHoliday ("08-DEC-2044", "CLP"); - - lh.addStaticHoliday ("07-APR-2045", "CLP"); - - lh.addStaticHoliday ("01-MAY-2045", "CLP"); - - lh.addStaticHoliday ("26-JUN-2045", "CLP"); - - lh.addStaticHoliday ("15-AUG-2045", "CLP"); - - lh.addStaticHoliday ("18-SEP-2045", "CLP"); - - lh.addStaticHoliday ("19-SEP-2045", "CLP"); - - lh.addStaticHoliday ("09-OCT-2045", "CLP"); - - lh.addStaticHoliday ("27-OCT-2045", "CLP"); - - lh.addStaticHoliday ("01-NOV-2045", "CLP"); - - lh.addStaticHoliday ("08-DEC-2045", "CLP"); - - lh.addStaticHoliday ("25-DEC-2045", "CLP"); - - lh.addStaticHoliday ("01-JAN-2046", "CLP"); - - lh.addStaticHoliday ("23-MAR-2046", "CLP"); - - lh.addStaticHoliday ("01-MAY-2046", "CLP"); - - lh.addStaticHoliday ("21-MAY-2046", "CLP"); - - lh.addStaticHoliday ("02-JUL-2046", "CLP"); - - lh.addStaticHoliday ("16-JUL-2046", "CLP"); - - lh.addStaticHoliday ("15-AUG-2046", "CLP"); - - lh.addStaticHoliday ("18-SEP-2046", "CLP"); - - lh.addStaticHoliday ("19-SEP-2046", "CLP"); - - lh.addStaticHoliday ("15-OCT-2046", "CLP"); - - lh.addStaticHoliday ("01-NOV-2046", "CLP"); - - lh.addStaticHoliday ("02-NOV-2046", "CLP"); - - lh.addStaticHoliday ("25-DEC-2046", "CLP"); - - lh.addStaticHoliday ("31-DEC-2046", "CLP"); - - lh.addStaticHoliday ("01-JAN-2047", "CLP"); - - lh.addStaticHoliday ("12-APR-2047", "CLP"); - - lh.addStaticHoliday ("01-MAY-2047", "CLP"); - - lh.addStaticHoliday ("21-MAY-2047", "CLP"); - - lh.addStaticHoliday ("16-JUL-2047", "CLP"); - - lh.addStaticHoliday ("15-AUG-2047", "CLP"); - - lh.addStaticHoliday ("18-SEP-2047", "CLP"); - - lh.addStaticHoliday ("19-SEP-2047", "CLP"); - - lh.addStaticHoliday ("31-OCT-2047", "CLP"); - - lh.addStaticHoliday ("01-NOV-2047", "CLP"); - - lh.addStaticHoliday ("25-DEC-2047", "CLP"); - - lh.addStaticHoliday ("31-DEC-2047", "CLP"); - - lh.addStaticHoliday ("01-JAN-2048", "CLP"); - - lh.addStaticHoliday ("03-APR-2048", "CLP"); - - lh.addStaticHoliday ("01-MAY-2048", "CLP"); - - lh.addStaticHoliday ("21-MAY-2048", "CLP"); - - lh.addStaticHoliday ("29-JUN-2048", "CLP"); - - lh.addStaticHoliday ("16-JUL-2048", "CLP"); - - lh.addStaticHoliday ("18-SEP-2048", "CLP"); - - lh.addStaticHoliday ("12-OCT-2048", "CLP"); - - lh.addStaticHoliday ("08-DEC-2048", "CLP"); - - lh.addStaticHoliday ("25-DEC-2048", "CLP"); - - lh.addStaticHoliday ("31-DEC-2048", "CLP"); - - lh.addStaticHoliday ("01-JAN-2049", "CLP"); - - lh.addStaticHoliday ("16-APR-2049", "CLP"); - - lh.addStaticHoliday ("21-MAY-2049", "CLP"); - - lh.addStaticHoliday ("28-JUN-2049", "CLP"); - - lh.addStaticHoliday ("16-JUL-2049", "CLP"); - - lh.addStaticHoliday ("11-OCT-2049", "CLP"); - - lh.addStaticHoliday ("01-NOV-2049", "CLP"); - - lh.addStaticHoliday ("08-DEC-2049", "CLP"); - - lh.addStaticHoliday ("31-DEC-2049", "CLP"); - - lh.addStaticHoliday ("08-APR-2050", "CLP"); - - lh.addStaticHoliday ("27-JUN-2050", "CLP"); - - lh.addStaticHoliday ("15-AUG-2050", "CLP"); - - lh.addStaticHoliday ("19-SEP-2050", "CLP"); - - lh.addStaticHoliday ("10-OCT-2050", "CLP"); - - lh.addStaticHoliday ("31-OCT-2050", "CLP"); - - lh.addStaticHoliday ("01-NOV-2050", "CLP"); - - lh.addStaticHoliday ("08-DEC-2050", "CLP"); - - lh.addStaticHoliday ("31-MAR-2051", "CLP"); - - lh.addStaticHoliday ("01-MAY-2051", "CLP"); - - lh.addStaticHoliday ("26-JUN-2051", "CLP"); - - lh.addStaticHoliday ("15-AUG-2051", "CLP"); - - lh.addStaticHoliday ("18-SEP-2051", "CLP"); - - lh.addStaticHoliday ("19-SEP-2051", "CLP"); - - lh.addStaticHoliday ("09-OCT-2051", "CLP"); - - lh.addStaticHoliday ("27-OCT-2051", "CLP"); - - lh.addStaticHoliday ("01-NOV-2051", "CLP"); - - lh.addStaticHoliday ("08-DEC-2051", "CLP"); - - lh.addStaticHoliday ("25-DEC-2051", "CLP"); - - lh.addStaticHoliday ("01-JAN-2052", "CLP"); - - lh.addStaticHoliday ("19-APR-2052", "CLP"); - - lh.addStaticHoliday ("01-MAY-2052", "CLP"); - - lh.addStaticHoliday ("21-MAY-2052", "CLP"); - - lh.addStaticHoliday ("16-JUL-2052", "CLP"); - - lh.addStaticHoliday ("15-AUG-2052", "CLP"); - - lh.addStaticHoliday ("18-SEP-2052", "CLP"); - - lh.addStaticHoliday ("19-SEP-2052", "CLP"); - - lh.addStaticHoliday ("31-OCT-2052", "CLP"); - - lh.addStaticHoliday ("01-NOV-2052", "CLP"); - - lh.addStaticHoliday ("25-DEC-2052", "CLP"); - - lh.addStaticHoliday ("31-DEC-2052", "CLP"); - - lh.addStaticHoliday ("01-JAN-2053", "CLP"); - - lh.addStaticHoliday ("04-APR-2053", "CLP"); - - lh.addStaticHoliday ("01-MAY-2053", "CLP"); - - lh.addStaticHoliday ("21-MAY-2053", "CLP"); - - lh.addStaticHoliday ("16-JUL-2053", "CLP"); - - lh.addStaticHoliday ("15-AUG-2053", "CLP"); - - lh.addStaticHoliday ("18-SEP-2053", "CLP"); - - lh.addStaticHoliday ("19-SEP-2053", "CLP"); - - lh.addStaticHoliday ("31-OCT-2053", "CLP"); - - lh.addStaticHoliday ("08-DEC-2053", "CLP"); - - lh.addStaticHoliday ("25-DEC-2053", "CLP"); - - lh.addStaticHoliday ("31-DEC-2053", "CLP"); - - lh.addStaticHoliday ("01-JAN-2054", "CLP"); - - lh.addStaticHoliday ("27-MAR-2054", "CLP"); - - lh.addStaticHoliday ("01-MAY-2054", "CLP"); - - lh.addStaticHoliday ("21-MAY-2054", "CLP"); - - lh.addStaticHoliday ("29-JUN-2054", "CLP"); - - lh.addStaticHoliday ("16-JUL-2054", "CLP"); - - lh.addStaticHoliday ("18-SEP-2054", "CLP"); - - lh.addStaticHoliday ("12-OCT-2054", "CLP"); - - lh.addStaticHoliday ("08-DEC-2054", "CLP"); - - lh.addStaticHoliday ("25-DEC-2054", "CLP"); - - lh.addStaticHoliday ("31-DEC-2054", "CLP"); - - lh.addStaticHoliday ("01-JAN-2055", "CLP"); - - lh.addStaticHoliday ("16-APR-2055", "CLP"); - - lh.addStaticHoliday ("21-MAY-2055", "CLP"); - - lh.addStaticHoliday ("28-JUN-2055", "CLP"); - - lh.addStaticHoliday ("16-JUL-2055", "CLP"); - - lh.addStaticHoliday ("11-OCT-2055", "CLP"); - - lh.addStaticHoliday ("01-NOV-2055", "CLP"); - - lh.addStaticHoliday ("08-DEC-2055", "CLP"); - - lh.addStaticHoliday ("31-DEC-2055", "CLP"); - - lh.addStaticHoliday ("31-MAR-2056", "CLP"); - - lh.addStaticHoliday ("01-MAY-2056", "CLP"); - - lh.addStaticHoliday ("26-JUN-2056", "CLP"); - - lh.addStaticHoliday ("15-AUG-2056", "CLP"); - - lh.addStaticHoliday ("18-SEP-2056", "CLP"); - - lh.addStaticHoliday ("19-SEP-2056", "CLP"); - - lh.addStaticHoliday ("09-OCT-2056", "CLP"); - - lh.addStaticHoliday ("27-OCT-2056", "CLP"); - - lh.addStaticHoliday ("01-NOV-2056", "CLP"); - - lh.addStaticHoliday ("08-DEC-2056", "CLP"); - - lh.addStaticHoliday ("25-DEC-2056", "CLP"); - - lh.addStaticHoliday ("01-JAN-2057", "CLP"); - - lh.addStaticHoliday ("20-APR-2057", "CLP"); - - lh.addStaticHoliday ("01-MAY-2057", "CLP"); - - lh.addStaticHoliday ("21-MAY-2057", "CLP"); - - lh.addStaticHoliday ("02-JUL-2057", "CLP"); - - lh.addStaticHoliday ("16-JUL-2057", "CLP"); - - lh.addStaticHoliday ("15-AUG-2057", "CLP"); - - lh.addStaticHoliday ("18-SEP-2057", "CLP"); - - lh.addStaticHoliday ("19-SEP-2057", "CLP"); - - lh.addStaticHoliday ("15-OCT-2057", "CLP"); - - lh.addStaticHoliday ("01-NOV-2057", "CLP"); - - lh.addStaticHoliday ("02-NOV-2057", "CLP"); - - lh.addStaticHoliday ("25-DEC-2057", "CLP"); - - lh.addStaticHoliday ("31-DEC-2057", "CLP"); - - lh.addStaticHoliday ("01-JAN-2058", "CLP"); - - lh.addStaticHoliday ("12-APR-2058", "CLP"); - - lh.addStaticHoliday ("01-MAY-2058", "CLP"); - - lh.addStaticHoliday ("21-MAY-2058", "CLP"); - - lh.addStaticHoliday ("16-JUL-2058", "CLP"); - - lh.addStaticHoliday ("15-AUG-2058", "CLP"); - - lh.addStaticHoliday ("18-SEP-2058", "CLP"); - - lh.addStaticHoliday ("19-SEP-2058", "CLP"); - - lh.addStaticHoliday ("31-OCT-2058", "CLP"); - - lh.addStaticHoliday ("01-NOV-2058", "CLP"); - - lh.addStaticHoliday ("25-DEC-2058", "CLP"); - - lh.addStaticHoliday ("31-DEC-2058", "CLP"); - - lh.addStaticHoliday ("01-JAN-2059", "CLP"); - - lh.addStaticHoliday ("28-MAR-2059", "CLP"); - - lh.addStaticHoliday ("01-MAY-2059", "CLP"); - - lh.addStaticHoliday ("21-MAY-2059", "CLP"); - - lh.addStaticHoliday ("16-JUL-2059", "CLP"); - - lh.addStaticHoliday ("15-AUG-2059", "CLP"); - - lh.addStaticHoliday ("18-SEP-2059", "CLP"); - - lh.addStaticHoliday ("19-SEP-2059", "CLP"); - - lh.addStaticHoliday ("31-OCT-2059", "CLP"); - - lh.addStaticHoliday ("08-DEC-2059", "CLP"); - - lh.addStaticHoliday ("25-DEC-2059", "CLP"); - - lh.addStaticHoliday ("31-DEC-2059", "CLP"); - - lh.addStaticHoliday ("01-JAN-2060", "CLP"); - - lh.addStaticHoliday ("16-APR-2060", "CLP"); - - lh.addStaticHoliday ("21-MAY-2060", "CLP"); - - lh.addStaticHoliday ("28-JUN-2060", "CLP"); - - lh.addStaticHoliday ("16-JUL-2060", "CLP"); - - lh.addStaticHoliday ("11-OCT-2060", "CLP"); - - lh.addStaticHoliday ("01-NOV-2060", "CLP"); - - lh.addStaticHoliday ("08-DEC-2060", "CLP"); - - lh.addStaticHoliday ("31-DEC-2060", "CLP"); - - lh.addStaticHoliday ("08-APR-2061", "CLP"); - - lh.addStaticHoliday ("27-JUN-2061", "CLP"); - - lh.addStaticHoliday ("15-AUG-2061", "CLP"); - - lh.addStaticHoliday ("19-SEP-2061", "CLP"); - - lh.addStaticHoliday ("10-OCT-2061", "CLP"); - - lh.addStaticHoliday ("31-OCT-2061", "CLP"); - - lh.addStaticHoliday ("01-NOV-2061", "CLP"); - - lh.addStaticHoliday ("08-DEC-2061", "CLP"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/CNYHoliday.java b/org/drip/analytics/holset/CNYHoliday.java deleted file mode 100644 index 26098f5..0000000 --- a/org/drip/analytics/holset/CNYHoliday.java +++ /dev/null @@ -1,2163 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class CNYHoliday implements org.drip.analytics.holset.LocationHoliday { - public CNYHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "CNY"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-1999", "Chinese New Year"); - - lh.addStaticHoliday ("17-FEB-1999", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("18-FEB-1999", "Third Day of Chinese New Year"); - - lh.addStaticHoliday ("19-FEB-1999", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("20-FEB-1999", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("22-FEB-1999", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("01-MAY-1999", "Labour Day"); - - lh.addStaticHoliday ("01-OCT-1999", "National Day"); - - lh.addStaticHoliday ("02-OCT-1999", "National Day"); - - lh.addStaticHoliday ("20-DEC-1999", "Special Holiday"); - - lh.addStaticHoliday ("31-DEC-1999", "BANK HOLIDAY"); - - lh.addStaticHoliday ("03-JAN-2000", "New Years Day Observed"); - - lh.addStaticHoliday ("07-FEB-2000", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("08-FEB-2000", "Third Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("09-FEB-2000", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("10-FEB-2000", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("11-FEB-2000", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("04-MAY-2000", "Bridging Day"); - - lh.addStaticHoliday ("05-MAY-2000", "Bridging Day"); - - lh.addStaticHoliday ("02-OCT-2000", "National Day"); - - lh.addStaticHoliday ("03-OCT-2000", "National Day"); - - lh.addStaticHoliday ("04-OCT-2000", "National Day Observed"); - - lh.addStaticHoliday ("05-OCT-2000", "Bridging Day"); - - lh.addStaticHoliday ("06-OCT-2000", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("24-JAN-2001", "Chinese New Year"); - - lh.addStaticHoliday ("25-JAN-2001", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("26-JAN-2001", "Third Day of Chinese New Year"); - - lh.addStaticHoliday ("29-JAN-2001", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("30-JAN-2001", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("04-MAY-2001", "BANK HOLIDAY"); - - lh.addStaticHoliday ("07-MAY-2001", "BANK HOLIDAY"); - - lh.addStaticHoliday ("01-OCT-2001", "National Day"); - - lh.addStaticHoliday ("02-OCT-2001", "National Day"); - - lh.addStaticHoliday ("03-OCT-2001", "National Day"); - - lh.addStaticHoliday ("04-OCT-2001", "National Day"); - - lh.addStaticHoliday ("05-OCT-2001", "National Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2002", "New Years Holiday"); - - lh.addStaticHoliday ("03-JAN-2002", "New Years Holiday"); - - lh.addStaticHoliday ("12-FEB-2002", "Chinese New Year"); - - lh.addStaticHoliday ("13-FEB-2002", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("14-FEB-2002", "Third Day of Chinese New Year"); - - lh.addStaticHoliday ("15-FEB-2002", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("18-FEB-2002", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("07-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("01-OCT-2002", "National Day"); - - lh.addStaticHoliday ("02-OCT-2002", "National Day"); - - lh.addStaticHoliday ("03-OCT-2002", "National Day"); - - lh.addStaticHoliday ("04-OCT-2002", "National Day"); - - lh.addStaticHoliday ("07-OCT-2002", "National Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("03-FEB-2003", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("04-FEB-2003", "Third Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("05-FEB-2003", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("06-FEB-2003", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("07-FEB-2003", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("01-OCT-2003", "National Day"); - - lh.addStaticHoliday ("02-OCT-2003", "National Day"); - - lh.addStaticHoliday ("03-OCT-2003", "National Day"); - - lh.addStaticHoliday ("06-OCT-2003", "National Day"); - - lh.addStaticHoliday ("07-OCT-2003", "National Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("22-JAN-2004", "Chinese New Year"); - - lh.addStaticHoliday ("23-JAN-2004", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("26-JAN-2004", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("27-JAN-2004", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("28-JAN-2004", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("03-MAY-2004", "Labour Day"); - - lh.addStaticHoliday ("04-MAY-2004", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2004", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2004", "Labour Day"); - - lh.addStaticHoliday ("07-MAY-2004", "Labour Day"); - - lh.addStaticHoliday ("01-OCT-2004", "National Day"); - - lh.addStaticHoliday ("04-OCT-2004", "National Day"); - - lh.addStaticHoliday ("05-OCT-2004", "National Day"); - - lh.addStaticHoliday ("06-OCT-2004", "National Day"); - - lh.addStaticHoliday ("07-OCT-2004", "National Day"); - - lh.addStaticHoliday ("03-JAN-2005", "New Years Day Observed"); - - lh.addStaticHoliday ("09-FEB-2005", "Chinese New Year"); - - lh.addStaticHoliday ("10-FEB-2005", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("11-FEB-2005", "Third Day of Chinese New Year"); - - lh.addStaticHoliday ("14-FEB-2005", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("15-FEB-2005", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("02-MAY-2005", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2005", "Labour Day"); - - lh.addStaticHoliday ("04-MAY-2005", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2005", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2005", "Labour Day"); - - lh.addStaticHoliday ("03-OCT-2005", "National Day"); - - lh.addStaticHoliday ("04-OCT-2005", "National Day"); - - lh.addStaticHoliday ("05-OCT-2005", "National Day"); - - lh.addStaticHoliday ("06-OCT-2005", "National Day"); - - lh.addStaticHoliday ("07-OCT-2005", "National Day"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("03-JAN-2006", "New Years Holiday"); - - lh.addStaticHoliday ("30-JAN-2006", "Chinese New Year Observed"); - - lh.addStaticHoliday ("31-JAN-2006", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("01-FEB-2006", "Third Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("02-FEB-2006", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("03-FEB-2006", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("04-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("02-OCT-2006", "National Day"); - - lh.addStaticHoliday ("03-OCT-2006", "National Day"); - - lh.addStaticHoliday ("04-OCT-2006", "National Day"); - - lh.addStaticHoliday ("05-OCT-2006", "National Day"); - - lh.addStaticHoliday ("06-OCT-2006", "National Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2007", "New Years Holiday"); - - lh.addStaticHoliday ("03-JAN-2007", "New Years Holiday"); - - lh.addStaticHoliday ("19-FEB-2007", "Chinese New Year Observed"); - - lh.addStaticHoliday ("20-FEB-2007", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("21-FEB-2007", "Third Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("22-FEB-2007", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("23-FEB-2007", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("04-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("07-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("01-OCT-2007", "National Day"); - - lh.addStaticHoliday ("02-OCT-2007", "National Day"); - - lh.addStaticHoliday ("03-OCT-2007", "National Day"); - - lh.addStaticHoliday ("04-OCT-2007", "National Day"); - - lh.addStaticHoliday ("05-OCT-2007", "National Day"); - - lh.addStaticHoliday ("31-DEC-2007", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("06-FEB-2008", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("07-FEB-2008", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("08-FEB-2008", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("11-FEB-2008", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("12-FEB-2008", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-APR-2008", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2008", "Bank Holiday"); - - lh.addStaticHoliday ("09-JUN-2008", "Tuen Ng Festival Observed"); - - lh.addStaticHoliday ("15-SEP-2008", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("29-SEP-2008", "National Day"); - - lh.addStaticHoliday ("30-SEP-2008", "National Day"); - - lh.addStaticHoliday ("01-OCT-2008", "National Day"); - - lh.addStaticHoliday ("02-OCT-2008", "National Day"); - - lh.addStaticHoliday ("03-OCT-2008", "National Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2009", "New Years Holiday"); - - lh.addStaticHoliday ("26-JAN-2009", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("27-JAN-2009", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("28-JAN-2009", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("29-JAN-2009", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("30-JAN-2009", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("06-APR-2009", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("28-MAY-2009", "Tuen Ng Festival"); - - lh.addStaticHoliday ("29-MAY-2009", "Bank Holiday"); - - lh.addStaticHoliday ("01-OCT-2009", "National Day"); - - lh.addStaticHoliday ("02-OCT-2009", "National Day"); - - lh.addStaticHoliday ("05-OCT-2009", "National Day"); - - lh.addStaticHoliday ("06-OCT-2009", "National Day"); - - lh.addStaticHoliday ("07-OCT-2009", "National Day"); - - lh.addStaticHoliday ("08-OCT-2009", "National Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("15-FEB-2010", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("16-FEB-2010", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("17-FEB-2010", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("18-FEB-2010", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("19-FEB-2010", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("05-APR-2010", "Ching Ming Festival"); - - lh.addStaticHoliday ("03-MAY-2010", "Labour Day Observed"); - - lh.addStaticHoliday ("14-JUN-2010", "Bank Holiday"); - - lh.addStaticHoliday ("15-JUN-2010", "Bank Holiday"); - - lh.addStaticHoliday ("16-JUN-2010", "Tuen Ng Festival"); - - lh.addStaticHoliday ("22-SEP-2010", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("23-SEP-2010", "Bank Holiday"); - - lh.addStaticHoliday ("24-SEP-2010", "Bank Holiday"); - - lh.addStaticHoliday ("01-OCT-2010", "National Day"); - - lh.addStaticHoliday ("04-OCT-2010", "Bank Holiday"); - - lh.addStaticHoliday ("05-OCT-2010", "Bank Holiday"); - - lh.addStaticHoliday ("06-OCT-2010", "Bank Holiday"); - - lh.addStaticHoliday ("07-OCT-2010", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2011", "New Years Day Observed"); - - lh.addStaticHoliday ("02-FEB-2011", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("03-FEB-2011", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-FEB-2011", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("07-FEB-2011", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("08-FEB-2011", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-APR-2011", "Bank Holiday"); - - lh.addStaticHoliday ("05-APR-2011", "Ching Ming Festival"); - - lh.addStaticHoliday ("02-MAY-2011", "Labour Day Observed"); - - lh.addStaticHoliday ("06-JUN-2011", "Tuen Ng Festival"); - - lh.addStaticHoliday ("12-SEP-2011", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("03-OCT-2011", "National Day"); - - lh.addStaticHoliday ("04-OCT-2011", "National Day"); - - lh.addStaticHoliday ("05-OCT-2011", "National Day"); - - lh.addStaticHoliday ("06-OCT-2011", "National Day"); - - lh.addStaticHoliday ("07-OCT-2011", "National Day"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("23-JAN-2012", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("24-JAN-2012", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("25-JAN-2012", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("26-JAN-2012", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("27-JAN-2012", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-APR-2012", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("25-JUN-2012", "Tuen Ng Festival Observed"); - - lh.addStaticHoliday ("01-OCT-2012", "National Day"); - - lh.addStaticHoliday ("02-OCT-2012", "National Day"); - - lh.addStaticHoliday ("03-OCT-2012", "National Day"); - - lh.addStaticHoliday ("04-OCT-2012", "National Day"); - - lh.addStaticHoliday ("05-OCT-2012", "National Day"); - - lh.addStaticHoliday ("31-DEC-2012", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2013", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("12-FEB-2013", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("13-FEB-2013", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("14-FEB-2013", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("15-FEB-2013", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-APR-2013", "Ching Ming Festival"); - - lh.addStaticHoliday ("05-APR-2013", "Bank Holiday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("10-JUN-2013", "Bank Holiday"); - - lh.addStaticHoliday ("11-JUN-2013", "Bank Holiday"); - - lh.addStaticHoliday ("12-JUN-2013", "Tuen Ng Festival"); - - lh.addStaticHoliday ("19-SEP-2013", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("30-SEP-2013", "National Day"); - - lh.addStaticHoliday ("01-OCT-2013", "National Day"); - - lh.addStaticHoliday ("02-OCT-2013", "National Day"); - - lh.addStaticHoliday ("03-OCT-2013", "National Day"); - - lh.addStaticHoliday ("04-OCT-2013", "National Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("30-JAN-2014", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("31-JAN-2014", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("03-FEB-2014", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-FEB-2014", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("05-FEB-2014", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("07-APR-2014", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2014", "Bank Holiday"); - - lh.addStaticHoliday ("02-JUN-2014", "Tuen Ng Festival"); - - lh.addStaticHoliday ("08-SEP-2014", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("29-SEP-2014", "National Day"); - - lh.addStaticHoliday ("30-SEP-2014", "National Day"); - - lh.addStaticHoliday ("01-OCT-2014", "National Day"); - - lh.addStaticHoliday ("02-OCT-2014", "National Day"); - - lh.addStaticHoliday ("03-OCT-2014", "National Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2015", "New Years Holiday"); - - lh.addStaticHoliday ("18-FEB-2015", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("19-FEB-2015", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("20-FEB-2015", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("23-FEB-2015", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("24-FEB-2015", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("06-APR-2015", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("22-JUN-2015", "Tuen Ng Festival Observed"); - - lh.addStaticHoliday ("28-SEP-2015", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2015", "National Day"); - - lh.addStaticHoliday ("02-OCT-2015", "National Day"); - - lh.addStaticHoliday ("05-OCT-2015", "National Day"); - - lh.addStaticHoliday ("06-OCT-2015", "National Day"); - - lh.addStaticHoliday ("07-OCT-2015", "National Day"); - - lh.addStaticHoliday ("08-OCT-2015", "National Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2016", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("09-FEB-2016", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("10-FEB-2016", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("11-FEB-2016", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("12-FEB-2016", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-APR-2016", "Ching Ming Festival"); - - lh.addStaticHoliday ("02-MAY-2016", "Labour Day Observed"); - - lh.addStaticHoliday ("09-JUN-2016", "Tuen Ng Festival"); - - lh.addStaticHoliday ("10-JUN-2016", "Bank Holiday"); - - lh.addStaticHoliday ("15-SEP-2016", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("03-OCT-2016", "National Day"); - - lh.addStaticHoliday ("04-OCT-2016", "National Day"); - - lh.addStaticHoliday ("05-OCT-2016", "National Day"); - - lh.addStaticHoliday ("06-OCT-2016", "National Day"); - - lh.addStaticHoliday ("07-OCT-2016", "National Day"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("27-JAN-2017", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("30-JAN-2017", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("31-JAN-2017", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("01-FEB-2017", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("02-FEB-2017", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("03-APR-2017", "Bank Holiday"); - - lh.addStaticHoliday ("04-APR-2017", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2017", "Bank Holiday"); - - lh.addStaticHoliday ("30-MAY-2017", "Tuen Ng Festival"); - - lh.addStaticHoliday ("02-OCT-2017", "National Day"); - - lh.addStaticHoliday ("03-OCT-2017", "National Day"); - - lh.addStaticHoliday ("04-OCT-2017", "National Day"); - - lh.addStaticHoliday ("05-OCT-2017", "National Day"); - - lh.addStaticHoliday ("06-OCT-2017", "National Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("15-FEB-2018", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("16-FEB-2018", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("19-FEB-2018", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("20-FEB-2018", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("21-FEB-2018", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("05-APR-2018", "Ching Ming Festival"); - - lh.addStaticHoliday ("06-APR-2018", "Bank Holiday"); - - lh.addStaticHoliday ("30-APR-2018", "Bank Holiday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("18-JUN-2018", "Tuen Ng Festival"); - - lh.addStaticHoliday ("24-SEP-2018", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2018", "National Day"); - - lh.addStaticHoliday ("02-OCT-2018", "National Day"); - - lh.addStaticHoliday ("03-OCT-2018", "National Day"); - - lh.addStaticHoliday ("04-OCT-2018", "National Day"); - - lh.addStaticHoliday ("05-OCT-2018", "National Day"); - - lh.addStaticHoliday ("31-DEC-2018", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("04-FEB-2019", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("05-FEB-2019", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("06-FEB-2019", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("07-FEB-2019", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("08-FEB-2019", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("05-APR-2019", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("07-JUN-2019", "Tuen Ng Festival"); - - lh.addStaticHoliday ("13-SEP-2019", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("30-SEP-2019", "National Day"); - - lh.addStaticHoliday ("01-OCT-2019", "National Day"); - - lh.addStaticHoliday ("02-OCT-2019", "National Day"); - - lh.addStaticHoliday ("03-OCT-2019", "National Day"); - - lh.addStaticHoliday ("04-OCT-2019", "National Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("24-JAN-2020", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("27-JAN-2020", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("28-JAN-2020", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("29-JAN-2020", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("30-JAN-2020", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("06-APR-2020", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("25-JUN-2020", "Tuen Ng Festival"); - - lh.addStaticHoliday ("26-JUN-2020", "Bank Holiday"); - - lh.addStaticHoliday ("01-OCT-2020", "National Day"); - - lh.addStaticHoliday ("02-OCT-2020", "National Day"); - - lh.addStaticHoliday ("05-OCT-2020", "National Day"); - - lh.addStaticHoliday ("06-OCT-2020", "National Day"); - - lh.addStaticHoliday ("07-OCT-2020", "National Day"); - - lh.addStaticHoliday ("08-OCT-2020", "National Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2021", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("12-FEB-2021", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("15-FEB-2021", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("16-FEB-2021", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("17-FEB-2021", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("05-APR-2021", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("03-MAY-2021", "Labour Day Observed"); - - lh.addStaticHoliday ("14-JUN-2021", "Tuen Ng Festival"); - - lh.addStaticHoliday ("21-SEP-2021", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2021", "National Day"); - - lh.addStaticHoliday ("04-OCT-2021", "National Day"); - - lh.addStaticHoliday ("05-OCT-2021", "National Day"); - - lh.addStaticHoliday ("06-OCT-2021", "National Day"); - - lh.addStaticHoliday ("07-OCT-2021", "National Day"); - - lh.addStaticHoliday ("03-JAN-2022", "New Years Day Observed"); - - lh.addStaticHoliday ("31-JAN-2022", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("01-FEB-2022", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("02-FEB-2022", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("03-FEB-2022", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-FEB-2022", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-APR-2022", "Bank Holiday"); - - lh.addStaticHoliday ("05-APR-2022", "Ching Ming Festival"); - - lh.addStaticHoliday ("02-MAY-2022", "Labour Day Observed"); - - lh.addStaticHoliday ("03-JUN-2022", "Tuen Ng Festival"); - - lh.addStaticHoliday ("12-SEP-2022", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("03-OCT-2022", "National Day"); - - lh.addStaticHoliday ("04-OCT-2022", "National Day"); - - lh.addStaticHoliday ("05-OCT-2022", "National Day"); - - lh.addStaticHoliday ("06-OCT-2022", "National Day"); - - lh.addStaticHoliday ("07-OCT-2022", "National Day"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("23-JAN-2023", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("24-JAN-2023", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("25-JAN-2023", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("26-JAN-2023", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("27-JAN-2023", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("05-APR-2023", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("22-JUN-2023", "Tuen Ng Festival"); - - lh.addStaticHoliday ("23-JUN-2023", "Bank Holiday"); - - lh.addStaticHoliday ("29-SEP-2023", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("02-OCT-2023", "National Day"); - - lh.addStaticHoliday ("03-OCT-2023", "National Day"); - - lh.addStaticHoliday ("04-OCT-2023", "National Day"); - - lh.addStaticHoliday ("05-OCT-2023", "National Day"); - - lh.addStaticHoliday ("06-OCT-2023", "National Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("09-FEB-2024", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("12-FEB-2024", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("13-FEB-2024", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("14-FEB-2024", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("15-FEB-2024", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-APR-2024", "Ching Ming Festival"); - - lh.addStaticHoliday ("05-APR-2024", "Bank Holiday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("10-JUN-2024", "Tuen Ng Festival"); - - lh.addStaticHoliday ("17-SEP-2024", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("30-SEP-2024", "National Day"); - - lh.addStaticHoliday ("01-OCT-2024", "National Day"); - - lh.addStaticHoliday ("02-OCT-2024", "National Day"); - - lh.addStaticHoliday ("03-OCT-2024", "National Day"); - - lh.addStaticHoliday ("04-OCT-2024", "National Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-2025", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("29-JAN-2025", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("30-JAN-2025", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("31-JAN-2025", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("03-FEB-2025", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-APR-2025", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2025", "Bank Holiday"); - - lh.addStaticHoliday ("02-JUN-2025", "Tuen Ng Festival Observed"); - - lh.addStaticHoliday ("29-SEP-2025", "National Day"); - - lh.addStaticHoliday ("30-SEP-2025", "National Day"); - - lh.addStaticHoliday ("01-OCT-2025", "National Day"); - - lh.addStaticHoliday ("02-OCT-2025", "National Day"); - - lh.addStaticHoliday ("03-OCT-2025", "National Day"); - - lh.addStaticHoliday ("06-OCT-2025", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2026", "New Years Holiday"); - - lh.addStaticHoliday ("16-FEB-2026", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("17-FEB-2026", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("18-FEB-2026", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("19-FEB-2026", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("20-FEB-2026", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("06-APR-2026", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("19-JUN-2026", "Tuen Ng Festival"); - - lh.addStaticHoliday ("25-SEP-2026", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2026", "National Day"); - - lh.addStaticHoliday ("02-OCT-2026", "National Day"); - - lh.addStaticHoliday ("05-OCT-2026", "National Day"); - - lh.addStaticHoliday ("06-OCT-2026", "National Day"); - - lh.addStaticHoliday ("07-OCT-2026", "National Day"); - - lh.addStaticHoliday ("08-OCT-2026", "National Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2027", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("08-FEB-2027", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("09-FEB-2027", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("10-FEB-2027", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("11-FEB-2027", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("05-APR-2027", "Ching Ming Festival"); - - lh.addStaticHoliday ("03-MAY-2027", "Labour Day Observed"); - - lh.addStaticHoliday ("07-JUN-2027", "Bank Holiday"); - - lh.addStaticHoliday ("08-JUN-2027", "Bank Holiday"); - - lh.addStaticHoliday ("09-JUN-2027", "Tuen Ng Festival"); - - lh.addStaticHoliday ("15-SEP-2027", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("16-SEP-2027", "Bank Holiday"); - - lh.addStaticHoliday ("17-SEP-2027", "Bank Holiday"); - - lh.addStaticHoliday ("01-OCT-2027", "National Day"); - - lh.addStaticHoliday ("04-OCT-2027", "National Day"); - - lh.addStaticHoliday ("05-OCT-2027", "National Day"); - - lh.addStaticHoliday ("06-OCT-2027", "National Day"); - - lh.addStaticHoliday ("07-OCT-2027", "National Day"); - - lh.addStaticHoliday ("03-JAN-2028", "New Years Day Observed"); - - lh.addStaticHoliday ("25-JAN-2028", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("26-JAN-2028", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("27-JAN-2028", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("28-JAN-2028", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("31-JAN-2028", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("03-APR-2028", "Bank Holiday"); - - lh.addStaticHoliday ("04-APR-2028", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2028", "Tuen Ng Festival Observed"); - - lh.addStaticHoliday ("02-OCT-2028", "National Day"); - - lh.addStaticHoliday ("03-OCT-2028", "National Day"); - - lh.addStaticHoliday ("04-OCT-2028", "National Day"); - - lh.addStaticHoliday ("05-OCT-2028", "National Day"); - - lh.addStaticHoliday ("06-OCT-2028", "National Day"); - - lh.addStaticHoliday ("01-JAN-2029", "New Years Day"); - - lh.addStaticHoliday ("12-FEB-2029", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("13-FEB-2029", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("14-FEB-2029", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("15-FEB-2029", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("16-FEB-2029", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-APR-2029", "Ching Ming Festival"); - - lh.addStaticHoliday ("30-APR-2029", "Bank Holiday"); - - lh.addStaticHoliday ("01-MAY-2029", "Labour Day"); - - lh.addStaticHoliday ("18-JUN-2029", "Tuen Ng Festival Observed"); - - lh.addStaticHoliday ("24-SEP-2029", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2029", "National Day"); - - lh.addStaticHoliday ("02-OCT-2029", "National Day"); - - lh.addStaticHoliday ("03-OCT-2029", "National Day"); - - lh.addStaticHoliday ("04-OCT-2029", "National Day"); - - lh.addStaticHoliday ("05-OCT-2029", "National Day"); - - lh.addStaticHoliday ("31-DEC-2029", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2030", "New Years Day"); - - lh.addStaticHoliday ("04-FEB-2030", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("05-FEB-2030", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("06-FEB-2030", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("07-FEB-2030", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("08-FEB-2030", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("05-APR-2030", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2030", "Labour Day"); - - lh.addStaticHoliday ("03-JUN-2030", "Bank Holiday"); - - lh.addStaticHoliday ("04-JUN-2030", "Bank Holiday"); - - lh.addStaticHoliday ("05-JUN-2030", "Tuen Ng Festival"); - - lh.addStaticHoliday ("12-SEP-2030", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("30-SEP-2030", "National Day"); - - lh.addStaticHoliday ("01-OCT-2030", "National Day"); - - lh.addStaticHoliday ("02-OCT-2030", "National Day"); - - lh.addStaticHoliday ("03-OCT-2030", "National Day"); - - lh.addStaticHoliday ("04-OCT-2030", "National Day"); - - lh.addStaticHoliday ("01-JAN-2031", "New Years Day"); - - lh.addStaticHoliday ("22-JAN-2031", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("23-JAN-2031", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("24-JAN-2031", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("27-JAN-2031", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("28-JAN-2031", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("07-APR-2031", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("01-MAY-2031", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2031", "Bank Holiday"); - - lh.addStaticHoliday ("23-JUN-2031", "Bank Holiday"); - - lh.addStaticHoliday ("24-JUN-2031", "Tuen Ng Festival"); - - lh.addStaticHoliday ("29-SEP-2031", "National Day"); - - lh.addStaticHoliday ("30-SEP-2031", "National Day"); - - lh.addStaticHoliday ("01-OCT-2031", "National Day"); - - lh.addStaticHoliday ("02-OCT-2031", "National Day"); - - lh.addStaticHoliday ("03-OCT-2031", "National Day"); - - lh.addStaticHoliday ("01-JAN-2032", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2032", "New Years Holiday"); - - lh.addStaticHoliday ("10-FEB-2032", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("11-FEB-2032", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("12-FEB-2032", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("13-FEB-2032", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("16-FEB-2032", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("05-APR-2032", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("03-MAY-2032", "Labour Day Observed"); - - lh.addStaticHoliday ("14-JUN-2032", "Tuen Ng Festival Observed"); - - lh.addStaticHoliday ("20-SEP-2032", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2032", "National Day"); - - lh.addStaticHoliday ("04-OCT-2032", "National Day"); - - lh.addStaticHoliday ("05-OCT-2032", "National Day"); - - lh.addStaticHoliday ("06-OCT-2032", "National Day"); - - lh.addStaticHoliday ("07-OCT-2032", "National Day"); - - lh.addStaticHoliday ("03-JAN-2033", "New Years Day Observed"); - - lh.addStaticHoliday ("31-JAN-2033", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("01-FEB-2033", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("02-FEB-2033", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("03-FEB-2033", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-FEB-2033", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-APR-2033", "Ching Ming Festival"); - - lh.addStaticHoliday ("02-MAY-2033", "Labour Day Observed"); - - lh.addStaticHoliday ("30-MAY-2033", "Bank Holiday"); - - lh.addStaticHoliday ("31-MAY-2033", "Bank Holiday"); - - lh.addStaticHoliday ("01-JUN-2033", "Tuen Ng Festival"); - - lh.addStaticHoliday ("08-SEP-2033", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("03-OCT-2033", "National Day"); - - lh.addStaticHoliday ("04-OCT-2033", "National Day"); - - lh.addStaticHoliday ("05-OCT-2033", "National Day"); - - lh.addStaticHoliday ("06-OCT-2033", "National Day"); - - lh.addStaticHoliday ("07-OCT-2033", "National Day"); - - lh.addStaticHoliday ("02-JAN-2034", "New Years Day Observed"); - - lh.addStaticHoliday ("20-FEB-2034", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("21-FEB-2034", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("22-FEB-2034", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("23-FEB-2034", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("24-FEB-2034", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("05-APR-2034", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2034", "Labour Day"); - - lh.addStaticHoliday ("19-JUN-2034", "Bank Holiday"); - - lh.addStaticHoliday ("20-JUN-2034", "Tuen Ng Festival"); - - lh.addStaticHoliday ("27-SEP-2034", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("28-SEP-2034", "Bank Holiday"); - - lh.addStaticHoliday ("29-SEP-2034", "Bank Holiday"); - - lh.addStaticHoliday ("02-OCT-2034", "National Day"); - - lh.addStaticHoliday ("03-OCT-2034", "National Day"); - - lh.addStaticHoliday ("04-OCT-2034", "National Day"); - - lh.addStaticHoliday ("05-OCT-2034", "National Day"); - - lh.addStaticHoliday ("06-OCT-2034", "National Day"); - - lh.addStaticHoliday ("01-JAN-2035", "New Years Day"); - - lh.addStaticHoliday ("07-FEB-2035", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("08-FEB-2035", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("09-FEB-2035", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("12-FEB-2035", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("13-FEB-2035", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("05-APR-2035", "Ching Ming Festival"); - - lh.addStaticHoliday ("06-APR-2035", "Bank Holiday"); - - lh.addStaticHoliday ("30-APR-2035", "Bank Holiday"); - - lh.addStaticHoliday ("01-MAY-2035", "Labour Day"); - - lh.addStaticHoliday ("11-JUN-2035", "Tuen Ng Festival Observed"); - - lh.addStaticHoliday ("17-SEP-2035", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2035", "National Day"); - - lh.addStaticHoliday ("02-OCT-2035", "National Day"); - - lh.addStaticHoliday ("03-OCT-2035", "National Day"); - - lh.addStaticHoliday ("04-OCT-2035", "National Day"); - - lh.addStaticHoliday ("05-OCT-2035", "National Day"); - - lh.addStaticHoliday ("31-DEC-2035", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2036", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-2036", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("29-JAN-2036", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("30-JAN-2036", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("31-JAN-2036", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("01-FEB-2036", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-APR-2036", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2036", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2036", "Bank Holiday"); - - lh.addStaticHoliday ("30-MAY-2036", "Tuen Ng Festival"); - - lh.addStaticHoliday ("29-SEP-2036", "National Day"); - - lh.addStaticHoliday ("30-SEP-2036", "National Day"); - - lh.addStaticHoliday ("01-OCT-2036", "National Day"); - - lh.addStaticHoliday ("02-OCT-2036", "National Day"); - - lh.addStaticHoliday ("03-OCT-2036", "National Day"); - - lh.addStaticHoliday ("06-OCT-2036", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-JAN-2037", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2037", "New Years Holiday"); - - lh.addStaticHoliday ("16-FEB-2037", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("17-FEB-2037", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("18-FEB-2037", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("19-FEB-2037", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("20-FEB-2037", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("06-APR-2037", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("01-MAY-2037", "Labour Day"); - - lh.addStaticHoliday ("18-JUN-2037", "Tuen Ng Festival"); - - lh.addStaticHoliday ("19-JUN-2037", "Bank Holiday"); - - lh.addStaticHoliday ("24-SEP-2037", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2037", "National Day"); - - lh.addStaticHoliday ("02-OCT-2037", "National Day"); - - lh.addStaticHoliday ("05-OCT-2037", "National Day"); - - lh.addStaticHoliday ("06-OCT-2037", "National Day"); - - lh.addStaticHoliday ("07-OCT-2037", "National Day"); - - lh.addStaticHoliday ("08-OCT-2037", "National Day"); - - lh.addStaticHoliday ("01-JAN-2038", "New Years Day"); - - lh.addStaticHoliday ("03-FEB-2038", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-FEB-2038", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("05-FEB-2038", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("08-FEB-2038", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("09-FEB-2038", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("05-APR-2038", "Ching Ming Festival"); - - lh.addStaticHoliday ("03-MAY-2038", "Labour Day Observed"); - - lh.addStaticHoliday ("07-JUN-2038", "Tuen Ng Festival"); - - lh.addStaticHoliday ("13-SEP-2038", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2038", "National Day"); - - lh.addStaticHoliday ("04-OCT-2038", "National Day"); - - lh.addStaticHoliday ("05-OCT-2038", "National Day"); - - lh.addStaticHoliday ("06-OCT-2038", "National Day"); - - lh.addStaticHoliday ("07-OCT-2038", "National Day"); - - lh.addStaticHoliday ("03-JAN-2039", "New Years Day Observed"); - - lh.addStaticHoliday ("24-JAN-2039", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("25-JAN-2039", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("26-JAN-2039", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("27-JAN-2039", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("28-JAN-2039", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-APR-2039", "Bank Holiday"); - - lh.addStaticHoliday ("05-APR-2039", "Ching Ming Festival"); - - lh.addStaticHoliday ("02-MAY-2039", "Labour Day Observed"); - - lh.addStaticHoliday ("27-MAY-2039", "Tuen Ng Festival"); - - lh.addStaticHoliday ("03-OCT-2039", "National Day"); - - lh.addStaticHoliday ("04-OCT-2039", "National Day"); - - lh.addStaticHoliday ("05-OCT-2039", "National Day"); - - lh.addStaticHoliday ("06-OCT-2039", "National Day"); - - lh.addStaticHoliday ("07-OCT-2039", "National Day"); - - lh.addStaticHoliday ("02-JAN-2040", "New Years Day Observed"); - - lh.addStaticHoliday ("13-FEB-2040", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("14-FEB-2040", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("15-FEB-2040", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("16-FEB-2040", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("17-FEB-2040", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-APR-2040", "Ching Ming Festival"); - - lh.addStaticHoliday ("30-APR-2040", "Bank Holiday"); - - lh.addStaticHoliday ("01-MAY-2040", "Labour Day"); - - lh.addStaticHoliday ("14-JUN-2040", "Tuen Ng Festival"); - - lh.addStaticHoliday ("15-JUN-2040", "Bank Holiday"); - - lh.addStaticHoliday ("20-SEP-2040", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2040", "National Day"); - - lh.addStaticHoliday ("02-OCT-2040", "National Day"); - - lh.addStaticHoliday ("03-OCT-2040", "National Day"); - - lh.addStaticHoliday ("04-OCT-2040", "National Day"); - - lh.addStaticHoliday ("05-OCT-2040", "National Day"); - - lh.addStaticHoliday ("31-DEC-2040", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2041", "New Years Day"); - - lh.addStaticHoliday ("31-JAN-2041", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("01-FEB-2041", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-FEB-2041", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("05-FEB-2041", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("06-FEB-2041", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-APR-2041", "Ching Ming Festival"); - - lh.addStaticHoliday ("05-APR-2041", "Bank Holiday"); - - lh.addStaticHoliday ("01-MAY-2041", "Labour Day"); - - lh.addStaticHoliday ("03-JUN-2041", "Tuen Ng Festival"); - - lh.addStaticHoliday ("10-SEP-2041", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("30-SEP-2041", "National Day"); - - lh.addStaticHoliday ("01-OCT-2041", "National Day"); - - lh.addStaticHoliday ("02-OCT-2041", "National Day"); - - lh.addStaticHoliday ("03-OCT-2041", "National Day"); - - lh.addStaticHoliday ("04-OCT-2041", "National Day"); - - lh.addStaticHoliday ("01-JAN-2042", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2042", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("22-JAN-2042", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("23-JAN-2042", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("24-JAN-2042", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("27-JAN-2042", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-APR-2042", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2042", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2042", "Bank Holiday"); - - lh.addStaticHoliday ("23-JUN-2042", "Tuen Ng Festival Observed"); - - lh.addStaticHoliday ("29-SEP-2042", "National Day"); - - lh.addStaticHoliday ("30-SEP-2042", "National Day"); - - lh.addStaticHoliday ("01-OCT-2042", "National Day"); - - lh.addStaticHoliday ("02-OCT-2042", "National Day"); - - lh.addStaticHoliday ("03-OCT-2042", "National Day"); - - lh.addStaticHoliday ("01-JAN-2043", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2043", "New Years Holiday"); - - lh.addStaticHoliday ("09-FEB-2043", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("10-FEB-2043", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("11-FEB-2043", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("12-FEB-2043", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("13-FEB-2043", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("06-APR-2043", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("01-MAY-2043", "Labour Day"); - - lh.addStaticHoliday ("11-JUN-2043", "Tuen Ng Festival"); - - lh.addStaticHoliday ("12-JUN-2043", "Bank Holiday"); - - lh.addStaticHoliday ("17-SEP-2043", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2043", "National Day"); - - lh.addStaticHoliday ("02-OCT-2043", "National Day"); - - lh.addStaticHoliday ("05-OCT-2043", "National Day"); - - lh.addStaticHoliday ("06-OCT-2043", "National Day"); - - lh.addStaticHoliday ("07-OCT-2043", "National Day"); - - lh.addStaticHoliday ("08-OCT-2043", "National Day"); - - lh.addStaticHoliday ("01-JAN-2044", "New Years Day"); - - lh.addStaticHoliday ("29-JAN-2044", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("01-FEB-2044", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("02-FEB-2044", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("03-FEB-2044", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-FEB-2044", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-APR-2044", "Ching Ming Festival"); - - lh.addStaticHoliday ("02-MAY-2044", "Labour Day Observed"); - - lh.addStaticHoliday ("30-MAY-2044", "Bank Holiday"); - - lh.addStaticHoliday ("31-MAY-2044", "Tuen Ng Festival"); - - lh.addStaticHoliday ("03-OCT-2044", "National Day"); - - lh.addStaticHoliday ("04-OCT-2044", "National Day"); - - lh.addStaticHoliday ("05-OCT-2044", "National Day"); - - lh.addStaticHoliday ("06-OCT-2044", "National Day"); - - lh.addStaticHoliday ("07-OCT-2044", "National Day"); - - lh.addStaticHoliday ("02-JAN-2045", "New Years Day Observed"); - - lh.addStaticHoliday ("16-FEB-2045", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("17-FEB-2045", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("20-FEB-2045", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("21-FEB-2045", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("22-FEB-2045", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("03-APR-2045", "Bank Holiday"); - - lh.addStaticHoliday ("04-APR-2045", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2045", "Labour Day"); - - lh.addStaticHoliday ("19-JUN-2045", "Tuen Ng Festival"); - - lh.addStaticHoliday ("25-SEP-2045", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("02-OCT-2045", "National Day"); - - lh.addStaticHoliday ("03-OCT-2045", "National Day"); - - lh.addStaticHoliday ("04-OCT-2045", "National Day"); - - lh.addStaticHoliday ("05-OCT-2045", "National Day"); - - lh.addStaticHoliday ("06-OCT-2045", "National Day"); - - lh.addStaticHoliday ("01-JAN-2046", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2046", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("06-FEB-2046", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("07-FEB-2046", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("08-FEB-2046", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("09-FEB-2046", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-APR-2046", "Ching Ming Festival"); - - lh.addStaticHoliday ("30-APR-2046", "Bank Holiday"); - - lh.addStaticHoliday ("01-MAY-2046", "Labour Day"); - - lh.addStaticHoliday ("08-JUN-2046", "Tuen Ng Festival"); - - lh.addStaticHoliday ("17-SEP-2046", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2046", "National Day"); - - lh.addStaticHoliday ("02-OCT-2046", "National Day"); - - lh.addStaticHoliday ("03-OCT-2046", "National Day"); - - lh.addStaticHoliday ("04-OCT-2046", "National Day"); - - lh.addStaticHoliday ("05-OCT-2046", "National Day"); - - lh.addStaticHoliday ("31-DEC-2046", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2047", "New Years Day"); - - lh.addStaticHoliday ("25-JAN-2047", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("28-JAN-2047", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("29-JAN-2047", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("30-JAN-2047", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("31-JAN-2047", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("05-APR-2047", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2047", "Labour Day"); - - lh.addStaticHoliday ("27-MAY-2047", "Bank Holiday"); - - lh.addStaticHoliday ("28-MAY-2047", "Bank Holiday"); - - lh.addStaticHoliday ("29-MAY-2047", "Tuen Ng Festival"); - - lh.addStaticHoliday ("30-SEP-2047", "National Day"); - - lh.addStaticHoliday ("01-OCT-2047", "National Day"); - - lh.addStaticHoliday ("02-OCT-2047", "National Day"); - - lh.addStaticHoliday ("03-OCT-2047", "National Day"); - - lh.addStaticHoliday ("04-OCT-2047", "National Day"); - - lh.addStaticHoliday ("01-JAN-2048", "New Years Day"); - - lh.addStaticHoliday ("13-FEB-2048", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("14-FEB-2048", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("17-FEB-2048", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("18-FEB-2048", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("19-FEB-2048", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("06-APR-2048", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("01-MAY-2048", "Labour Day"); - - lh.addStaticHoliday ("15-JUN-2048", "Tuen Ng Festival"); - - lh.addStaticHoliday ("22-SEP-2048", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2048", "National Day"); - - lh.addStaticHoliday ("02-OCT-2048", "National Day"); - - lh.addStaticHoliday ("05-OCT-2048", "National Day"); - - lh.addStaticHoliday ("06-OCT-2048", "National Day"); - - lh.addStaticHoliday ("07-OCT-2048", "National Day"); - - lh.addStaticHoliday ("08-OCT-2048", "National Day"); - - lh.addStaticHoliday ("01-JAN-2049", "New Years Day"); - - lh.addStaticHoliday ("01-FEB-2049", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("02-FEB-2049", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("03-FEB-2049", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-FEB-2049", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("05-FEB-2049", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("05-APR-2049", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("03-MAY-2049", "Labour Day Observed"); - - lh.addStaticHoliday ("04-JUN-2049", "Tuen Ng Festival"); - - lh.addStaticHoliday ("13-SEP-2049", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2049", "National Day"); - - lh.addStaticHoliday ("04-OCT-2049", "National Day"); - - lh.addStaticHoliday ("05-OCT-2049", "National Day"); - - lh.addStaticHoliday ("06-OCT-2049", "National Day"); - - lh.addStaticHoliday ("07-OCT-2049", "National Day"); - - lh.addStaticHoliday ("03-JAN-2050", "New Years Day Observed"); - - lh.addStaticHoliday ("24-JAN-2050", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("25-JAN-2050", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("26-JAN-2050", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("27-JAN-2050", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("28-JAN-2050", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-APR-2050", "Ching Ming Festival"); - - lh.addStaticHoliday ("02-MAY-2050", "Labour Day Observed"); - - lh.addStaticHoliday ("23-JUN-2050", "Tuen Ng Festival"); - - lh.addStaticHoliday ("24-JUN-2050", "Bank Holiday"); - - lh.addStaticHoliday ("30-SEP-2050", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("03-OCT-2050", "National Day"); - - lh.addStaticHoliday ("04-OCT-2050", "National Day"); - - lh.addStaticHoliday ("05-OCT-2050", "National Day"); - - lh.addStaticHoliday ("06-OCT-2050", "National Day"); - - lh.addStaticHoliday ("07-OCT-2050", "National Day"); - - lh.addStaticHoliday ("02-JAN-2051", "New Years Day Observed"); - - lh.addStaticHoliday ("10-FEB-2051", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("13-FEB-2051", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("14-FEB-2051", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("15-FEB-2051", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("16-FEB-2051", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("05-APR-2051", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2051", "Labour Day"); - - lh.addStaticHoliday ("12-JUN-2051", "Bank Holiday"); - - lh.addStaticHoliday ("13-JUN-2051", "Tuen Ng Festival"); - - lh.addStaticHoliday ("19-SEP-2051", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("02-OCT-2051", "National Day"); - - lh.addStaticHoliday ("03-OCT-2051", "National Day"); - - lh.addStaticHoliday ("04-OCT-2051", "National Day"); - - lh.addStaticHoliday ("05-OCT-2051", "National Day"); - - lh.addStaticHoliday ("06-OCT-2051", "National Day"); - - lh.addStaticHoliday ("01-JAN-2052", "New Years Day"); - - lh.addStaticHoliday ("31-JAN-2052", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("01-FEB-2052", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("02-FEB-2052", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("05-FEB-2052", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("06-FEB-2052", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-APR-2052", "Ching Ming Festival"); - - lh.addStaticHoliday ("05-APR-2052", "Bank Holiday"); - - lh.addStaticHoliday ("01-MAY-2052", "Labour Day"); - - lh.addStaticHoliday ("03-JUN-2052", "Tuen Ng Festival Observed"); - - lh.addStaticHoliday ("09-SEP-2052", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("30-SEP-2052", "National Day"); - - lh.addStaticHoliday ("01-OCT-2052", "National Day"); - - lh.addStaticHoliday ("02-OCT-2052", "National Day"); - - lh.addStaticHoliday ("03-OCT-2052", "National Day"); - - lh.addStaticHoliday ("04-OCT-2052", "National Day"); - - lh.addStaticHoliday ("01-JAN-2053", "New Years Day"); - - lh.addStaticHoliday ("18-FEB-2053", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("19-FEB-2053", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("20-FEB-2053", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("21-FEB-2053", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("24-FEB-2053", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-APR-2053", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2053", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2053", "Bank Holiday"); - - lh.addStaticHoliday ("20-JUN-2053", "Tuen Ng Festival"); - - lh.addStaticHoliday ("26-SEP-2053", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("29-SEP-2053", "National Day"); - - lh.addStaticHoliday ("30-SEP-2053", "National Day"); - - lh.addStaticHoliday ("01-OCT-2053", "National Day"); - - lh.addStaticHoliday ("02-OCT-2053", "National Day"); - - lh.addStaticHoliday ("03-OCT-2053", "National Day"); - - lh.addStaticHoliday ("01-JAN-2054", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2054", "New Years Holiday"); - - lh.addStaticHoliday ("09-FEB-2054", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("10-FEB-2054", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("11-FEB-2054", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("12-FEB-2054", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("13-FEB-2054", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("06-APR-2054", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("01-MAY-2054", "Labour Day"); - - lh.addStaticHoliday ("08-JUN-2054", "Bank Holiday"); - - lh.addStaticHoliday ("09-JUN-2054", "Bank Holiday"); - - lh.addStaticHoliday ("10-JUN-2054", "Tuen Ng Festival"); - - lh.addStaticHoliday ("16-SEP-2054", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("17-SEP-2054", "Bank Holiday"); - - lh.addStaticHoliday ("18-SEP-2054", "Bank Holiday"); - - lh.addStaticHoliday ("01-OCT-2054", "National Day"); - - lh.addStaticHoliday ("02-OCT-2054", "National Day"); - - lh.addStaticHoliday ("05-OCT-2054", "National Day"); - - lh.addStaticHoliday ("06-OCT-2054", "National Day"); - - lh.addStaticHoliday ("07-OCT-2054", "National Day"); - - lh.addStaticHoliday ("08-OCT-2054", "National Day"); - - lh.addStaticHoliday ("01-JAN-2055", "New Years Day"); - - lh.addStaticHoliday ("27-JAN-2055", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("28-JAN-2055", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("29-JAN-2055", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("01-FEB-2055", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("02-FEB-2055", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("05-APR-2055", "Ching Ming Festival"); - - lh.addStaticHoliday ("03-MAY-2055", "Labour Day Observed"); - - lh.addStaticHoliday ("31-MAY-2055", "Tuen Ng Festival Observed"); - - lh.addStaticHoliday ("01-OCT-2055", "National Day"); - - lh.addStaticHoliday ("04-OCT-2055", "National Day"); - - lh.addStaticHoliday ("05-OCT-2055", "National Day"); - - lh.addStaticHoliday ("06-OCT-2055", "National Day"); - - lh.addStaticHoliday ("07-OCT-2055", "National Day"); - - lh.addStaticHoliday ("03-JAN-2056", "New Years Day Observed"); - - lh.addStaticHoliday ("14-FEB-2056", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("15-FEB-2056", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("16-FEB-2056", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("17-FEB-2056", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("18-FEB-2056", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("03-APR-2056", "Bank Holiday"); - - lh.addStaticHoliday ("04-APR-2056", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2056", "Labour Day"); - - lh.addStaticHoliday ("19-JUN-2056", "Tuen Ng Festival Observed"); - - lh.addStaticHoliday ("25-SEP-2056", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("02-OCT-2056", "National Day"); - - lh.addStaticHoliday ("03-OCT-2056", "National Day"); - - lh.addStaticHoliday ("04-OCT-2056", "National Day"); - - lh.addStaticHoliday ("05-OCT-2056", "National Day"); - - lh.addStaticHoliday ("06-OCT-2056", "National Day"); - - lh.addStaticHoliday ("01-JAN-2057", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2057", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("06-FEB-2057", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("07-FEB-2057", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("08-FEB-2057", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("09-FEB-2057", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-APR-2057", "Ching Ming Festival"); - - lh.addStaticHoliday ("30-APR-2057", "Bank Holiday"); - - lh.addStaticHoliday ("01-MAY-2057", "Labour Day"); - - lh.addStaticHoliday ("04-JUN-2057", "Bank Holiday"); - - lh.addStaticHoliday ("05-JUN-2057", "Bank Holiday"); - - lh.addStaticHoliday ("06-JUN-2057", "Tuen Ng Festival"); - - lh.addStaticHoliday ("13-SEP-2057", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2057", "National Day"); - - lh.addStaticHoliday ("02-OCT-2057", "National Day"); - - lh.addStaticHoliday ("03-OCT-2057", "National Day"); - - lh.addStaticHoliday ("04-OCT-2057", "National Day"); - - lh.addStaticHoliday ("05-OCT-2057", "National Day"); - - lh.addStaticHoliday ("31-DEC-2057", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2058", "New Years Day"); - - lh.addStaticHoliday ("23-JAN-2058", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("24-JAN-2058", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("25-JAN-2058", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("28-JAN-2058", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("29-JAN-2058", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-APR-2058", "Ching Ming Festival"); - - lh.addStaticHoliday ("05-APR-2058", "Bank Holiday"); - - lh.addStaticHoliday ("01-MAY-2058", "Labour Day"); - - lh.addStaticHoliday ("24-JUN-2058", "Bank Holiday"); - - lh.addStaticHoliday ("25-JUN-2058", "Tuen Ng Festival"); - - lh.addStaticHoliday ("30-SEP-2058", "National Day"); - - lh.addStaticHoliday ("01-OCT-2058", "National Day"); - - lh.addStaticHoliday ("02-OCT-2058", "National Day"); - - lh.addStaticHoliday ("03-OCT-2058", "National Day"); - - lh.addStaticHoliday ("04-OCT-2058", "National Day"); - - lh.addStaticHoliday ("01-JAN-2059", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2059", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("12-FEB-2059", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("13-FEB-2059", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("14-FEB-2059", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("17-FEB-2059", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("07-APR-2059", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("01-MAY-2059", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2059", "Bank Holiday"); - - lh.addStaticHoliday ("16-JUN-2059", "Tuen Ng Festival Observed"); - - lh.addStaticHoliday ("22-SEP-2059", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("29-SEP-2059", "National Day"); - - lh.addStaticHoliday ("30-SEP-2059", "National Day"); - - lh.addStaticHoliday ("01-OCT-2059", "National Day"); - - lh.addStaticHoliday ("02-OCT-2059", "National Day"); - - lh.addStaticHoliday ("03-OCT-2059", "National Day"); - - lh.addStaticHoliday ("01-JAN-2060", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2060", "New Years Holiday"); - - lh.addStaticHoliday ("02-FEB-2060", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("03-FEB-2060", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-FEB-2060", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("05-FEB-2060", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("06-FEB-2060", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("05-APR-2060", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("03-MAY-2060", "Labour Day Observed"); - - lh.addStaticHoliday ("03-JUN-2060", "Tuen Ng Festival"); - - lh.addStaticHoliday ("04-JUN-2060", "Bank Holiday"); - - lh.addStaticHoliday ("09-SEP-2060", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2060", "National Day"); - - lh.addStaticHoliday ("04-OCT-2060", "National Day"); - - lh.addStaticHoliday ("05-OCT-2060", "National Day"); - - lh.addStaticHoliday ("06-OCT-2060", "National Day"); - - lh.addStaticHoliday ("07-OCT-2060", "National Day"); - - lh.addStaticHoliday ("03-JAN-2061", "New Years Day Observed"); - - lh.addStaticHoliday ("20-JAN-2061", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("21-JAN-2061", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("24-JAN-2061", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("25-JAN-2061", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("26-JAN-2061", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("04-APR-2061", "Ching Ming Festival"); - - lh.addStaticHoliday ("02-MAY-2061", "Labour Day Observed"); - - lh.addStaticHoliday ("20-JUN-2061", "Bank Holiday"); - - lh.addStaticHoliday ("21-JUN-2061", "Bank Holiday"); - - lh.addStaticHoliday ("22-JUN-2061", "Tuen Ng Festival"); - - lh.addStaticHoliday ("28-SEP-2061", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("29-SEP-2061", "Bank Holiday"); - - lh.addStaticHoliday ("30-SEP-2061", "Bank Holiday"); - - lh.addStaticHoliday ("03-OCT-2061", "National Day"); - - lh.addStaticHoliday ("04-OCT-2061", "National Day"); - - lh.addStaticHoliday ("05-OCT-2061", "National Day"); - - lh.addStaticHoliday ("06-OCT-2061", "National Day"); - - lh.addStaticHoliday ("07-OCT-2061", "National Day"); - - lh.addStaticHoliday ("02-JAN-2062", "New Years Day Observed"); - - lh.addStaticHoliday ("08-FEB-2062", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("09-FEB-2062", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("10-FEB-2062", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("13-FEB-2062", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("14-FEB-2062", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("03-APR-2062", "Bank Holiday"); - - lh.addStaticHoliday ("04-APR-2062", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2062", "Labour Day"); - - lh.addStaticHoliday ("12-JUN-2062", "Tuen Ng Festival Observed"); - - lh.addStaticHoliday ("18-SEP-2062", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("02-OCT-2062", "National Day"); - - lh.addStaticHoliday ("03-OCT-2062", "National Day"); - - lh.addStaticHoliday ("04-OCT-2062", "National Day"); - - lh.addStaticHoliday ("05-OCT-2062", "National Day"); - - lh.addStaticHoliday ("06-OCT-2062", "National Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/COFHoliday.java b/org/drip/analytics/holset/COFHoliday.java deleted file mode 100644 index 0604bd8..0000000 --- a/org/drip/analytics/holset/COFHoliday.java +++ /dev/null @@ -1,2099 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class COFHoliday implements org.drip.analytics.holset.LocationHoliday { - public COFHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "COF"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-1998", "Epiphany"); - - lh.addStaticHoliday ("23-MAR-1998", "St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-1998", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labor Day"); - - lh.addStaticHoliday ("25-MAY-1998", "Ascension Day Observed"); - - lh.addStaticHoliday ("15-JUN-1998", "Corpus Christi Observed"); - - lh.addStaticHoliday ("22-JUN-1998", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("29-JUN-1998", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-1998", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-1998", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-1998", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-1998", "Columbus Day"); - - lh.addStaticHoliday ("02-NOV-1998", "All Saints Day"); - - lh.addStaticHoliday ("16-NOV-1998", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-1998", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-1999", "Epiphany"); - - lh.addStaticHoliday ("22-MAR-1999", "St. Josephs Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("17-MAY-1999", "Ascension Day Observed"); - - lh.addStaticHoliday ("07-JUN-1999", "Corpus Christi Observed"); - - lh.addStaticHoliday ("14-JUN-1999", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("05-JUL-1999", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-1999", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-1999", "Assumption Day"); - - lh.addStaticHoliday ("18-OCT-1999", "Columbus Day"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("15-NOV-1999", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-1999", "Immaculate Conception"); - - lh.addStaticHoliday ("10-JAN-2000", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2000", "St. Josephs Day"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labor Day"); - - lh.addStaticHoliday ("05-JUN-2000", "Ascension Day Observed"); - - lh.addStaticHoliday ("26-JUN-2000", "Corpus Christi Observed"); - - lh.addStaticHoliday ("03-JUL-2000", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2000", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2000", "National Holiday"); - - lh.addStaticHoliday ("21-AUG-2000", "Assumption Day"); - - lh.addStaticHoliday ("16-OCT-2000", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2000", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2000", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2001", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2001", "St. Josephs Day"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labor Day"); - - lh.addStaticHoliday ("28-MAY-2001", "Ascension Day Observed"); - - lh.addStaticHoliday ("18-JUN-2001", "Corpus Christi Observed"); - - lh.addStaticHoliday ("25-JUN-2001", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("02-JUL-2001", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2001", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2001", "National Holiday"); - - lh.addStaticHoliday ("20-AUG-2001", "Assumption Day"); - - lh.addStaticHoliday ("15-OCT-2001", "Columbus Day"); - - lh.addStaticHoliday ("05-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("12-NOV-2001", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2002", "Epiphany"); - - lh.addStaticHoliday ("25-MAR-2002", "St. Josephs Day"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labor Day"); - - lh.addStaticHoliday ("13-MAY-2002", "Ascension Day Observed"); - - lh.addStaticHoliday ("03-JUN-2002", "Corpus Christi Observed"); - - lh.addStaticHoliday ("10-JUN-2002", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("01-JUL-2002", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2002", "National Holiday"); - - lh.addStaticHoliday ("19-AUG-2002", "Assumption Day"); - - lh.addStaticHoliday ("14-OCT-2002", "Columbus Day"); - - lh.addStaticHoliday ("04-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2002", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2003", "Epiphany"); - - lh.addStaticHoliday ("24-MAR-2003", "St. Josephs Day"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labor Day"); - - lh.addStaticHoliday ("02-JUN-2003", "Ascension Day Observed"); - - lh.addStaticHoliday ("23-JUN-2003", "Corpus Christi Observed"); - - lh.addStaticHoliday ("30-JUN-2003", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2003", "National Holiday"); - - lh.addStaticHoliday ("18-AUG-2003", "Assumption Day"); - - lh.addStaticHoliday ("13-OCT-2003", "Columbus Day"); - - lh.addStaticHoliday ("03-NOV-2003", "All Saints Day"); - - lh.addStaticHoliday ("17-NOV-2003", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2004", "Epiphany"); - - lh.addStaticHoliday ("22-MAR-2004", "St. Josephs Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2004", "Ascension Day Observed"); - - lh.addStaticHoliday ("14-JUN-2004", "Corpus Christi Observed"); - - lh.addStaticHoliday ("21-JUN-2004", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("05-JUL-2004", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2004", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2004", "Assumption Day"); - - lh.addStaticHoliday ("18-OCT-2004", "Columbus Day"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("15-NOV-2004", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2004", "Immaculate Conception"); - - lh.addStaticHoliday ("10-JAN-2005", "Epiphany"); - - lh.addStaticHoliday ("21-MAR-2005", "St. Josephs Day"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("09-MAY-2005", "Ascension Day Observed"); - - lh.addStaticHoliday ("30-MAY-2005", "Corpus Christi Observed"); - - lh.addStaticHoliday ("06-JUN-2005", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("04-JUL-2005", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2005", "Independence Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("17-OCT-2005", "Columbus Day"); - - lh.addStaticHoliday ("07-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("14-NOV-2005", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2005", "Immaculate Conception"); - - lh.addStaticHoliday ("09-JAN-2006", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2006", "St. Josephs Day"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labor Day"); - - lh.addStaticHoliday ("29-MAY-2006", "Ascension Day Observed"); - - lh.addStaticHoliday ("19-JUN-2006", "Corpus Christi Observed"); - - lh.addStaticHoliday ("26-JUN-2006", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("03-JUL-2006", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2006", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2006", "National Holiday"); - - lh.addStaticHoliday ("21-AUG-2006", "Assumption Day"); - - lh.addStaticHoliday ("16-OCT-2006", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2006", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2006", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2007", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2007", "St. Josephs Day"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labor Day"); - - lh.addStaticHoliday ("21-MAY-2007", "Ascension Day Observed"); - - lh.addStaticHoliday ("11-JUN-2007", "Corpus Christi Observed"); - - lh.addStaticHoliday ("18-JUN-2007", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("02-JUL-2007", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2007", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2007", "National Holiday"); - - lh.addStaticHoliday ("20-AUG-2007", "Assumption Day"); - - lh.addStaticHoliday ("15-OCT-2007", "Columbus Day"); - - lh.addStaticHoliday ("05-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("12-NOV-2007", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2007", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2007", "New Years day Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2008", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "St. Josephs Day"); - - lh.addStaticHoliday ("01-MAY-2008", "Labor Day"); - - lh.addStaticHoliday ("05-MAY-2008", "Ascension Day Observed"); - - lh.addStaticHoliday ("26-MAY-2008", "Corpus Christi Observed"); - - lh.addStaticHoliday ("02-JUN-2008", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("30-JUN-2008", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2008", "National Holiday"); - - lh.addStaticHoliday ("18-AUG-2008", "Assumption Day"); - - lh.addStaticHoliday ("13-OCT-2008", "Columbus Day"); - - lh.addStaticHoliday ("03-NOV-2008", "All Saints Day"); - - lh.addStaticHoliday ("17-NOV-2008", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2008", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2009", "Epiphany"); - - lh.addStaticHoliday ("23-MAR-2009", "St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labor Day"); - - lh.addStaticHoliday ("25-MAY-2009", "Ascension Day Observed"); - - lh.addStaticHoliday ("15-JUN-2009", "Corpus Christi Observed"); - - lh.addStaticHoliday ("22-JUN-2009", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("29-JUN-2009", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2009", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2009", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-2009", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2009", "Columbus Day"); - - lh.addStaticHoliday ("02-NOV-2009", "All Saints Day"); - - lh.addStaticHoliday ("16-NOV-2009", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2009", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2009", "New Years Eve Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2010", "COP"); - - lh.addStaticHoliday ("11-JAN-2010", "COP"); - - lh.addStaticHoliday ("22-MAR-2010", "COP"); - - lh.addStaticHoliday ("01-APR-2010", "COP"); - - lh.addStaticHoliday ("02-APR-2010", "COP"); - - lh.addStaticHoliday ("17-MAY-2010", "COP"); - - lh.addStaticHoliday ("07-JUN-2010", "COP"); - - lh.addStaticHoliday ("14-JUN-2010", "COP"); - - lh.addStaticHoliday ("05-JUL-2010", "COP"); - - lh.addStaticHoliday ("20-JUL-2010", "COP"); - - lh.addStaticHoliday ("16-AUG-2010", "COP"); - - lh.addStaticHoliday ("18-OCT-2010", "COP"); - - lh.addStaticHoliday ("01-NOV-2010", "COP"); - - lh.addStaticHoliday ("15-NOV-2010", "COP"); - - lh.addStaticHoliday ("08-DEC-2010", "COP"); - - lh.addStaticHoliday ("10-JAN-2011", "COP"); - - lh.addStaticHoliday ("21-MAR-2011", "COP"); - - lh.addStaticHoliday ("21-APR-2011", "COP"); - - lh.addStaticHoliday ("22-APR-2011", "COP"); - - lh.addStaticHoliday ("06-JUN-2011", "COP"); - - lh.addStaticHoliday ("27-JUN-2011", "COP"); - - lh.addStaticHoliday ("04-JUL-2011", "COP"); - - lh.addStaticHoliday ("20-JUL-2011", "COP"); - - lh.addStaticHoliday ("15-AUG-2011", "COP"); - - lh.addStaticHoliday ("17-OCT-2011", "COP"); - - lh.addStaticHoliday ("07-NOV-2011", "COP"); - - lh.addStaticHoliday ("14-NOV-2011", "COP"); - - lh.addStaticHoliday ("08-DEC-2011", "COP"); - - lh.addStaticHoliday ("09-JAN-2012", "COP"); - - lh.addStaticHoliday ("19-MAR-2012", "COP"); - - lh.addStaticHoliday ("05-APR-2012", "COP"); - - lh.addStaticHoliday ("06-APR-2012", "COP"); - - lh.addStaticHoliday ("01-MAY-2012", "COP"); - - lh.addStaticHoliday ("21-MAY-2012", "COP"); - - lh.addStaticHoliday ("11-JUN-2012", "COP"); - - lh.addStaticHoliday ("18-JUN-2012", "COP"); - - lh.addStaticHoliday ("02-JUL-2012", "COP"); - - lh.addStaticHoliday ("20-JUL-2012", "COP"); - - lh.addStaticHoliday ("07-AUG-2012", "COP"); - - lh.addStaticHoliday ("20-AUG-2012", "COP"); - - lh.addStaticHoliday ("15-OCT-2012", "COP"); - - lh.addStaticHoliday ("05-NOV-2012", "COP"); - - lh.addStaticHoliday ("12-NOV-2012", "COP"); - - lh.addStaticHoliday ("25-DEC-2012", "COP"); - - lh.addStaticHoliday ("01-JAN-2013", "COP"); - - lh.addStaticHoliday ("07-JAN-2013", "COP"); - - lh.addStaticHoliday ("25-MAR-2013", "COP"); - - lh.addStaticHoliday ("28-MAR-2013", "COP"); - - lh.addStaticHoliday ("29-MAR-2013", "COP"); - - lh.addStaticHoliday ("01-MAY-2013", "COP"); - - lh.addStaticHoliday ("13-MAY-2013", "COP"); - - lh.addStaticHoliday ("03-JUN-2013", "COP"); - - lh.addStaticHoliday ("10-JUN-2013", "COP"); - - lh.addStaticHoliday ("01-JUL-2013", "COP"); - - lh.addStaticHoliday ("07-AUG-2013", "COP"); - - lh.addStaticHoliday ("19-AUG-2013", "COP"); - - lh.addStaticHoliday ("14-OCT-2013", "COP"); - - lh.addStaticHoliday ("04-NOV-2013", "COP"); - - lh.addStaticHoliday ("11-NOV-2013", "COP"); - - lh.addStaticHoliday ("25-DEC-2013", "COP"); - - lh.addStaticHoliday ("01-JAN-2014", "COP"); - - lh.addStaticHoliday ("06-JAN-2014", "COP"); - - lh.addStaticHoliday ("24-MAR-2014", "COP"); - - lh.addStaticHoliday ("17-APR-2014", "COP"); - - lh.addStaticHoliday ("18-APR-2014", "COP"); - - lh.addStaticHoliday ("01-MAY-2014", "COP"); - - lh.addStaticHoliday ("02-JUN-2014", "COP"); - - lh.addStaticHoliday ("23-JUN-2014", "COP"); - - lh.addStaticHoliday ("30-JUN-2014", "COP"); - - lh.addStaticHoliday ("07-AUG-2014", "COP"); - - lh.addStaticHoliday ("18-AUG-2014", "COP"); - - lh.addStaticHoliday ("13-OCT-2014", "COP"); - - lh.addStaticHoliday ("03-NOV-2014", "COP"); - - lh.addStaticHoliday ("17-NOV-2014", "COP"); - - lh.addStaticHoliday ("08-DEC-2014", "COP"); - - lh.addStaticHoliday ("25-DEC-2014", "COP"); - - lh.addStaticHoliday ("01-JAN-2015", "COP"); - - lh.addStaticHoliday ("12-JAN-2015", "COP"); - - lh.addStaticHoliday ("23-MAR-2015", "COP"); - - lh.addStaticHoliday ("02-APR-2015", "COP"); - - lh.addStaticHoliday ("03-APR-2015", "COP"); - - lh.addStaticHoliday ("01-MAY-2015", "COP"); - - lh.addStaticHoliday ("18-MAY-2015", "COP"); - - lh.addStaticHoliday ("08-JUN-2015", "COP"); - - lh.addStaticHoliday ("15-JUN-2015", "COP"); - - lh.addStaticHoliday ("29-JUN-2015", "COP"); - - lh.addStaticHoliday ("20-JUL-2015", "COP"); - - lh.addStaticHoliday ("07-AUG-2015", "COP"); - - lh.addStaticHoliday ("17-AUG-2015", "COP"); - - lh.addStaticHoliday ("12-OCT-2015", "COP"); - - lh.addStaticHoliday ("02-NOV-2015", "COP"); - - lh.addStaticHoliday ("16-NOV-2015", "COP"); - - lh.addStaticHoliday ("08-DEC-2015", "COP"); - - lh.addStaticHoliday ("25-DEC-2015", "COP"); - - lh.addStaticHoliday ("01-JAN-2016", "COP"); - - lh.addStaticHoliday ("11-JAN-2016", "COP"); - - lh.addStaticHoliday ("21-MAR-2016", "COP"); - - lh.addStaticHoliday ("24-MAR-2016", "COP"); - - lh.addStaticHoliday ("25-MAR-2016", "COP"); - - lh.addStaticHoliday ("09-MAY-2016", "COP"); - - lh.addStaticHoliday ("30-MAY-2016", "COP"); - - lh.addStaticHoliday ("06-JUN-2016", "COP"); - - lh.addStaticHoliday ("04-JUL-2016", "COP"); - - lh.addStaticHoliday ("20-JUL-2016", "COP"); - - lh.addStaticHoliday ("15-AUG-2016", "COP"); - - lh.addStaticHoliday ("17-OCT-2016", "COP"); - - lh.addStaticHoliday ("07-NOV-2016", "COP"); - - lh.addStaticHoliday ("14-NOV-2016", "COP"); - - lh.addStaticHoliday ("08-DEC-2016", "COP"); - - lh.addStaticHoliday ("09-JAN-2017", "COP"); - - lh.addStaticHoliday ("20-MAR-2017", "COP"); - - lh.addStaticHoliday ("13-APR-2017", "COP"); - - lh.addStaticHoliday ("14-APR-2017", "COP"); - - lh.addStaticHoliday ("01-MAY-2017", "COP"); - - lh.addStaticHoliday ("29-MAY-2017", "COP"); - - lh.addStaticHoliday ("19-JUN-2017", "COP"); - - lh.addStaticHoliday ("26-JUN-2017", "COP"); - - lh.addStaticHoliday ("03-JUL-2017", "COP"); - - lh.addStaticHoliday ("20-JUL-2017", "COP"); - - lh.addStaticHoliday ("07-AUG-2017", "COP"); - - lh.addStaticHoliday ("21-AUG-2017", "COP"); - - lh.addStaticHoliday ("16-OCT-2017", "COP"); - - lh.addStaticHoliday ("06-NOV-2017", "COP"); - - lh.addStaticHoliday ("13-NOV-2017", "COP"); - - lh.addStaticHoliday ("08-DEC-2017", "COP"); - - lh.addStaticHoliday ("25-DEC-2017", "COP"); - - lh.addStaticHoliday ("01-JAN-2018", "COP"); - - lh.addStaticHoliday ("08-JAN-2018", "COP"); - - lh.addStaticHoliday ("19-MAR-2018", "COP"); - - lh.addStaticHoliday ("29-MAR-2018", "COP"); - - lh.addStaticHoliday ("30-MAR-2018", "COP"); - - lh.addStaticHoliday ("01-MAY-2018", "COP"); - - lh.addStaticHoliday ("14-MAY-2018", "COP"); - - lh.addStaticHoliday ("04-JUN-2018", "COP"); - - lh.addStaticHoliday ("11-JUN-2018", "COP"); - - lh.addStaticHoliday ("02-JUL-2018", "COP"); - - lh.addStaticHoliday ("20-JUL-2018", "COP"); - - lh.addStaticHoliday ("07-AUG-2018", "COP"); - - lh.addStaticHoliday ("20-AUG-2018", "COP"); - - lh.addStaticHoliday ("15-OCT-2018", "COP"); - - lh.addStaticHoliday ("05-NOV-2018", "COP"); - - lh.addStaticHoliday ("12-NOV-2018", "COP"); - - lh.addStaticHoliday ("25-DEC-2018", "COP"); - - lh.addStaticHoliday ("01-JAN-2019", "COP"); - - lh.addStaticHoliday ("07-JAN-2019", "COP"); - - lh.addStaticHoliday ("25-MAR-2019", "COP"); - - lh.addStaticHoliday ("18-APR-2019", "COP"); - - lh.addStaticHoliday ("19-APR-2019", "COP"); - - lh.addStaticHoliday ("01-MAY-2019", "COP"); - - lh.addStaticHoliday ("03-JUN-2019", "COP"); - - lh.addStaticHoliday ("24-JUN-2019", "COP"); - - lh.addStaticHoliday ("01-JUL-2019", "COP"); - - lh.addStaticHoliday ("07-AUG-2019", "COP"); - - lh.addStaticHoliday ("19-AUG-2019", "COP"); - - lh.addStaticHoliday ("14-OCT-2019", "COP"); - - lh.addStaticHoliday ("04-NOV-2019", "COP"); - - lh.addStaticHoliday ("11-NOV-2019", "COP"); - - lh.addStaticHoliday ("25-DEC-2019", "COP"); - - lh.addStaticHoliday ("01-JAN-2020", "COP"); - - lh.addStaticHoliday ("06-JAN-2020", "COP"); - - lh.addStaticHoliday ("23-MAR-2020", "COP"); - - lh.addStaticHoliday ("09-APR-2020", "COP"); - - lh.addStaticHoliday ("10-APR-2020", "COP"); - - lh.addStaticHoliday ("01-MAY-2020", "COP"); - - lh.addStaticHoliday ("25-MAY-2020", "COP"); - - lh.addStaticHoliday ("15-JUN-2020", "COP"); - - lh.addStaticHoliday ("22-JUN-2020", "COP"); - - lh.addStaticHoliday ("29-JUN-2020", "COP"); - - lh.addStaticHoliday ("20-JUL-2020", "COP"); - - lh.addStaticHoliday ("07-AUG-2020", "COP"); - - lh.addStaticHoliday ("17-AUG-2020", "COP"); - - lh.addStaticHoliday ("12-OCT-2020", "COP"); - - lh.addStaticHoliday ("02-NOV-2020", "COP"); - - lh.addStaticHoliday ("16-NOV-2020", "COP"); - - lh.addStaticHoliday ("08-DEC-2020", "COP"); - - lh.addStaticHoliday ("25-DEC-2020", "COP"); - - lh.addStaticHoliday ("01-JAN-2021", "COP"); - - lh.addStaticHoliday ("11-JAN-2021", "COP"); - - lh.addStaticHoliday ("22-MAR-2021", "COP"); - - lh.addStaticHoliday ("01-APR-2021", "COP"); - - lh.addStaticHoliday ("02-APR-2021", "COP"); - - lh.addStaticHoliday ("17-MAY-2021", "COP"); - - lh.addStaticHoliday ("07-JUN-2021", "COP"); - - lh.addStaticHoliday ("14-JUN-2021", "COP"); - - lh.addStaticHoliday ("05-JUL-2021", "COP"); - - lh.addStaticHoliday ("20-JUL-2021", "COP"); - - lh.addStaticHoliday ("16-AUG-2021", "COP"); - - lh.addStaticHoliday ("18-OCT-2021", "COP"); - - lh.addStaticHoliday ("01-NOV-2021", "COP"); - - lh.addStaticHoliday ("15-NOV-2021", "COP"); - - lh.addStaticHoliday ("08-DEC-2021", "COP"); - - lh.addStaticHoliday ("10-JAN-2022", "COP"); - - lh.addStaticHoliday ("21-MAR-2022", "COP"); - - lh.addStaticHoliday ("14-APR-2022", "COP"); - - lh.addStaticHoliday ("15-APR-2022", "COP"); - - lh.addStaticHoliday ("30-MAY-2022", "COP"); - - lh.addStaticHoliday ("20-JUN-2022", "COP"); - - lh.addStaticHoliday ("27-JUN-2022", "COP"); - - lh.addStaticHoliday ("04-JUL-2022", "COP"); - - lh.addStaticHoliday ("20-JUL-2022", "COP"); - - lh.addStaticHoliday ("15-AUG-2022", "COP"); - - lh.addStaticHoliday ("17-OCT-2022", "COP"); - - lh.addStaticHoliday ("07-NOV-2022", "COP"); - - lh.addStaticHoliday ("14-NOV-2022", "COP"); - - lh.addStaticHoliday ("08-DEC-2022", "COP"); - - lh.addStaticHoliday ("09-JAN-2023", "COP"); - - lh.addStaticHoliday ("20-MAR-2023", "COP"); - - lh.addStaticHoliday ("06-APR-2023", "COP"); - - lh.addStaticHoliday ("07-APR-2023", "COP"); - - lh.addStaticHoliday ("01-MAY-2023", "COP"); - - lh.addStaticHoliday ("22-MAY-2023", "COP"); - - lh.addStaticHoliday ("12-JUN-2023", "COP"); - - lh.addStaticHoliday ("19-JUN-2023", "COP"); - - lh.addStaticHoliday ("03-JUL-2023", "COP"); - - lh.addStaticHoliday ("20-JUL-2023", "COP"); - - lh.addStaticHoliday ("07-AUG-2023", "COP"); - - lh.addStaticHoliday ("21-AUG-2023", "COP"); - - lh.addStaticHoliday ("16-OCT-2023", "COP"); - - lh.addStaticHoliday ("06-NOV-2023", "COP"); - - lh.addStaticHoliday ("13-NOV-2023", "COP"); - - lh.addStaticHoliday ("08-DEC-2023", "COP"); - - lh.addStaticHoliday ("25-DEC-2023", "COP"); - - lh.addStaticHoliday ("01-JAN-2024", "COP"); - - lh.addStaticHoliday ("08-JAN-2024", "COP"); - - lh.addStaticHoliday ("25-MAR-2024", "COP"); - - lh.addStaticHoliday ("28-MAR-2024", "COP"); - - lh.addStaticHoliday ("29-MAR-2024", "COP"); - - lh.addStaticHoliday ("01-MAY-2024", "COP"); - - lh.addStaticHoliday ("13-MAY-2024", "COP"); - - lh.addStaticHoliday ("03-JUN-2024", "COP"); - - lh.addStaticHoliday ("10-JUN-2024", "COP"); - - lh.addStaticHoliday ("01-JUL-2024", "COP"); - - lh.addStaticHoliday ("07-AUG-2024", "COP"); - - lh.addStaticHoliday ("19-AUG-2024", "COP"); - - lh.addStaticHoliday ("14-OCT-2024", "COP"); - - lh.addStaticHoliday ("04-NOV-2024", "COP"); - - lh.addStaticHoliday ("11-NOV-2024", "COP"); - - lh.addStaticHoliday ("25-DEC-2024", "COP"); - - lh.addStaticHoliday ("01-JAN-2025", "COP"); - - lh.addStaticHoliday ("06-JAN-2025", "COP"); - - lh.addStaticHoliday ("24-MAR-2025", "COP"); - - lh.addStaticHoliday ("17-APR-2025", "COP"); - - lh.addStaticHoliday ("18-APR-2025", "COP"); - - lh.addStaticHoliday ("01-MAY-2025", "COP"); - - lh.addStaticHoliday ("02-JUN-2025", "COP"); - - lh.addStaticHoliday ("23-JUN-2025", "COP"); - - lh.addStaticHoliday ("30-JUN-2025", "COP"); - - lh.addStaticHoliday ("07-AUG-2025", "COP"); - - lh.addStaticHoliday ("18-AUG-2025", "COP"); - - lh.addStaticHoliday ("13-OCT-2025", "COP"); - - lh.addStaticHoliday ("03-NOV-2025", "COP"); - - lh.addStaticHoliday ("17-NOV-2025", "COP"); - - lh.addStaticHoliday ("08-DEC-2025", "COP"); - - lh.addStaticHoliday ("25-DEC-2025", "COP"); - - lh.addStaticHoliday ("01-JAN-2026", "COP"); - - lh.addStaticHoliday ("12-JAN-2026", "COP"); - - lh.addStaticHoliday ("23-MAR-2026", "COP"); - - lh.addStaticHoliday ("02-APR-2026", "COP"); - - lh.addStaticHoliday ("03-APR-2026", "COP"); - - lh.addStaticHoliday ("01-MAY-2026", "COP"); - - lh.addStaticHoliday ("18-MAY-2026", "COP"); - - lh.addStaticHoliday ("08-JUN-2026", "COP"); - - lh.addStaticHoliday ("15-JUN-2026", "COP"); - - lh.addStaticHoliday ("29-JUN-2026", "COP"); - - lh.addStaticHoliday ("20-JUL-2026", "COP"); - - lh.addStaticHoliday ("07-AUG-2026", "COP"); - - lh.addStaticHoliday ("17-AUG-2026", "COP"); - - lh.addStaticHoliday ("12-OCT-2026", "COP"); - - lh.addStaticHoliday ("02-NOV-2026", "COP"); - - lh.addStaticHoliday ("16-NOV-2026", "COP"); - - lh.addStaticHoliday ("08-DEC-2026", "COP"); - - lh.addStaticHoliday ("25-DEC-2026", "COP"); - - lh.addStaticHoliday ("01-JAN-2027", "COP"); - - lh.addStaticHoliday ("11-JAN-2027", "COP"); - - lh.addStaticHoliday ("22-MAR-2027", "COP"); - - lh.addStaticHoliday ("25-MAR-2027", "COP"); - - lh.addStaticHoliday ("26-MAR-2027", "COP"); - - lh.addStaticHoliday ("10-MAY-2027", "COP"); - - lh.addStaticHoliday ("31-MAY-2027", "COP"); - - lh.addStaticHoliday ("07-JUN-2027", "COP"); - - lh.addStaticHoliday ("05-JUL-2027", "COP"); - - lh.addStaticHoliday ("20-JUL-2027", "COP"); - - lh.addStaticHoliday ("16-AUG-2027", "COP"); - - lh.addStaticHoliday ("18-OCT-2027", "COP"); - - lh.addStaticHoliday ("01-NOV-2027", "COP"); - - lh.addStaticHoliday ("15-NOV-2027", "COP"); - - lh.addStaticHoliday ("08-DEC-2027", "COP"); - - lh.addStaticHoliday ("10-JAN-2028", "COP"); - - lh.addStaticHoliday ("20-MAR-2028", "COP"); - - lh.addStaticHoliday ("13-APR-2028", "COP"); - - lh.addStaticHoliday ("14-APR-2028", "COP"); - - lh.addStaticHoliday ("01-MAY-2028", "COP"); - - lh.addStaticHoliday ("29-MAY-2028", "COP"); - - lh.addStaticHoliday ("19-JUN-2028", "COP"); - - lh.addStaticHoliday ("26-JUN-2028", "COP"); - - lh.addStaticHoliday ("03-JUL-2028", "COP"); - - lh.addStaticHoliday ("20-JUL-2028", "COP"); - - lh.addStaticHoliday ("07-AUG-2028", "COP"); - - lh.addStaticHoliday ("21-AUG-2028", "COP"); - - lh.addStaticHoliday ("16-OCT-2028", "COP"); - - lh.addStaticHoliday ("06-NOV-2028", "COP"); - - lh.addStaticHoliday ("13-NOV-2028", "COP"); - - lh.addStaticHoliday ("08-DEC-2028", "COP"); - - lh.addStaticHoliday ("25-DEC-2028", "COP"); - - lh.addStaticHoliday ("01-JAN-2029", "COP"); - - lh.addStaticHoliday ("08-JAN-2029", "COP"); - - lh.addStaticHoliday ("19-MAR-2029", "COP"); - - lh.addStaticHoliday ("29-MAR-2029", "COP"); - - lh.addStaticHoliday ("30-MAR-2029", "COP"); - - lh.addStaticHoliday ("01-MAY-2029", "COP"); - - lh.addStaticHoliday ("14-MAY-2029", "COP"); - - lh.addStaticHoliday ("04-JUN-2029", "COP"); - - lh.addStaticHoliday ("11-JUN-2029", "COP"); - - lh.addStaticHoliday ("02-JUL-2029", "COP"); - - lh.addStaticHoliday ("20-JUL-2029", "COP"); - - lh.addStaticHoliday ("07-AUG-2029", "COP"); - - lh.addStaticHoliday ("20-AUG-2029", "COP"); - - lh.addStaticHoliday ("15-OCT-2029", "COP"); - - lh.addStaticHoliday ("05-NOV-2029", "COP"); - - lh.addStaticHoliday ("12-NOV-2029", "COP"); - - lh.addStaticHoliday ("25-DEC-2029", "COP"); - - lh.addStaticHoliday ("01-JAN-2030", "COP"); - - lh.addStaticHoliday ("07-JAN-2030", "COP"); - - lh.addStaticHoliday ("25-MAR-2030", "COP"); - - lh.addStaticHoliday ("18-APR-2030", "COP"); - - lh.addStaticHoliday ("19-APR-2030", "COP"); - - lh.addStaticHoliday ("01-MAY-2030", "COP"); - - lh.addStaticHoliday ("03-JUN-2030", "COP"); - - lh.addStaticHoliday ("24-JUN-2030", "COP"); - - lh.addStaticHoliday ("01-JUL-2030", "COP"); - - lh.addStaticHoliday ("07-AUG-2030", "COP"); - - lh.addStaticHoliday ("19-AUG-2030", "COP"); - - lh.addStaticHoliday ("14-OCT-2030", "COP"); - - lh.addStaticHoliday ("04-NOV-2030", "COP"); - - lh.addStaticHoliday ("11-NOV-2030", "COP"); - - lh.addStaticHoliday ("25-DEC-2030", "COP"); - - lh.addStaticHoliday ("01-JAN-2031", "COP"); - - lh.addStaticHoliday ("06-JAN-2031", "COP"); - - lh.addStaticHoliday ("24-MAR-2031", "COP"); - - lh.addStaticHoliday ("10-APR-2031", "COP"); - - lh.addStaticHoliday ("11-APR-2031", "COP"); - - lh.addStaticHoliday ("01-MAY-2031", "COP"); - - lh.addStaticHoliday ("26-MAY-2031", "COP"); - - lh.addStaticHoliday ("16-JUN-2031", "COP"); - - lh.addStaticHoliday ("23-JUN-2031", "COP"); - - lh.addStaticHoliday ("30-JUN-2031", "COP"); - - lh.addStaticHoliday ("07-AUG-2031", "COP"); - - lh.addStaticHoliday ("18-AUG-2031", "COP"); - - lh.addStaticHoliday ("13-OCT-2031", "COP"); - - lh.addStaticHoliday ("03-NOV-2031", "COP"); - - lh.addStaticHoliday ("17-NOV-2031", "COP"); - - lh.addStaticHoliday ("08-DEC-2031", "COP"); - - lh.addStaticHoliday ("25-DEC-2031", "COP"); - - lh.addStaticHoliday ("01-JAN-2032", "COP"); - - lh.addStaticHoliday ("12-JAN-2032", "COP"); - - lh.addStaticHoliday ("22-MAR-2032", "COP"); - - lh.addStaticHoliday ("25-MAR-2032", "COP"); - - lh.addStaticHoliday ("26-MAR-2032", "COP"); - - lh.addStaticHoliday ("10-MAY-2032", "COP"); - - lh.addStaticHoliday ("31-MAY-2032", "COP"); - - lh.addStaticHoliday ("07-JUN-2032", "COP"); - - lh.addStaticHoliday ("05-JUL-2032", "COP"); - - lh.addStaticHoliday ("20-JUL-2032", "COP"); - - lh.addStaticHoliday ("16-AUG-2032", "COP"); - - lh.addStaticHoliday ("18-OCT-2032", "COP"); - - lh.addStaticHoliday ("01-NOV-2032", "COP"); - - lh.addStaticHoliday ("15-NOV-2032", "COP"); - - lh.addStaticHoliday ("08-DEC-2032", "COP"); - - lh.addStaticHoliday ("10-JAN-2033", "COP"); - - lh.addStaticHoliday ("21-MAR-2033", "COP"); - - lh.addStaticHoliday ("14-APR-2033", "COP"); - - lh.addStaticHoliday ("15-APR-2033", "COP"); - - lh.addStaticHoliday ("30-MAY-2033", "COP"); - - lh.addStaticHoliday ("20-JUN-2033", "COP"); - - lh.addStaticHoliday ("27-JUN-2033", "COP"); - - lh.addStaticHoliday ("04-JUL-2033", "COP"); - - lh.addStaticHoliday ("20-JUL-2033", "COP"); - - lh.addStaticHoliday ("15-AUG-2033", "COP"); - - lh.addStaticHoliday ("17-OCT-2033", "COP"); - - lh.addStaticHoliday ("07-NOV-2033", "COP"); - - lh.addStaticHoliday ("14-NOV-2033", "COP"); - - lh.addStaticHoliday ("08-DEC-2033", "COP"); - - lh.addStaticHoliday ("09-JAN-2034", "COP"); - - lh.addStaticHoliday ("20-MAR-2034", "COP"); - - lh.addStaticHoliday ("06-APR-2034", "COP"); - - lh.addStaticHoliday ("07-APR-2034", "COP"); - - lh.addStaticHoliday ("01-MAY-2034", "COP"); - - lh.addStaticHoliday ("22-MAY-2034", "COP"); - - lh.addStaticHoliday ("12-JUN-2034", "COP"); - - lh.addStaticHoliday ("19-JUN-2034", "COP"); - - lh.addStaticHoliday ("03-JUL-2034", "COP"); - - lh.addStaticHoliday ("20-JUL-2034", "COP"); - - lh.addStaticHoliday ("07-AUG-2034", "COP"); - - lh.addStaticHoliday ("21-AUG-2034", "COP"); - - lh.addStaticHoliday ("16-OCT-2034", "COP"); - - lh.addStaticHoliday ("06-NOV-2034", "COP"); - - lh.addStaticHoliday ("13-NOV-2034", "COP"); - - lh.addStaticHoliday ("08-DEC-2034", "COP"); - - lh.addStaticHoliday ("25-DEC-2034", "COP"); - - lh.addStaticHoliday ("01-JAN-2035", "COP"); - - lh.addStaticHoliday ("08-JAN-2035", "COP"); - - lh.addStaticHoliday ("19-MAR-2035", "COP"); - - lh.addStaticHoliday ("22-MAR-2035", "COP"); - - lh.addStaticHoliday ("23-MAR-2035", "COP"); - - lh.addStaticHoliday ("01-MAY-2035", "COP"); - - lh.addStaticHoliday ("07-MAY-2035", "COP"); - - lh.addStaticHoliday ("28-MAY-2035", "COP"); - - lh.addStaticHoliday ("04-JUN-2035", "COP"); - - lh.addStaticHoliday ("02-JUL-2035", "COP"); - - lh.addStaticHoliday ("20-JUL-2035", "COP"); - - lh.addStaticHoliday ("07-AUG-2035", "COP"); - - lh.addStaticHoliday ("20-AUG-2035", "COP"); - - lh.addStaticHoliday ("15-OCT-2035", "COP"); - - lh.addStaticHoliday ("05-NOV-2035", "COP"); - - lh.addStaticHoliday ("12-NOV-2035", "COP"); - - lh.addStaticHoliday ("25-DEC-2035", "COP"); - - lh.addStaticHoliday ("01-JAN-2036", "COP"); - - lh.addStaticHoliday ("07-JAN-2036", "COP"); - - lh.addStaticHoliday ("24-MAR-2036", "COP"); - - lh.addStaticHoliday ("10-APR-2036", "COP"); - - lh.addStaticHoliday ("11-APR-2036", "COP"); - - lh.addStaticHoliday ("01-MAY-2036", "COP"); - - lh.addStaticHoliday ("26-MAY-2036", "COP"); - - lh.addStaticHoliday ("16-JUN-2036", "COP"); - - lh.addStaticHoliday ("23-JUN-2036", "COP"); - - lh.addStaticHoliday ("30-JUN-2036", "COP"); - - lh.addStaticHoliday ("07-AUG-2036", "COP"); - - lh.addStaticHoliday ("18-AUG-2036", "COP"); - - lh.addStaticHoliday ("13-OCT-2036", "COP"); - - lh.addStaticHoliday ("03-NOV-2036", "COP"); - - lh.addStaticHoliday ("17-NOV-2036", "COP"); - - lh.addStaticHoliday ("08-DEC-2036", "COP"); - - lh.addStaticHoliday ("25-DEC-2036", "COP"); - - lh.addStaticHoliday ("01-JAN-2037", "COP"); - - lh.addStaticHoliday ("12-JAN-2037", "COP"); - - lh.addStaticHoliday ("23-MAR-2037", "COP"); - - lh.addStaticHoliday ("02-APR-2037", "COP"); - - lh.addStaticHoliday ("03-APR-2037", "COP"); - - lh.addStaticHoliday ("01-MAY-2037", "COP"); - - lh.addStaticHoliday ("18-MAY-2037", "COP"); - - lh.addStaticHoliday ("08-JUN-2037", "COP"); - - lh.addStaticHoliday ("15-JUN-2037", "COP"); - - lh.addStaticHoliday ("29-JUN-2037", "COP"); - - lh.addStaticHoliday ("20-JUL-2037", "COP"); - - lh.addStaticHoliday ("07-AUG-2037", "COP"); - - lh.addStaticHoliday ("17-AUG-2037", "COP"); - - lh.addStaticHoliday ("12-OCT-2037", "COP"); - - lh.addStaticHoliday ("02-NOV-2037", "COP"); - - lh.addStaticHoliday ("16-NOV-2037", "COP"); - - lh.addStaticHoliday ("08-DEC-2037", "COP"); - - lh.addStaticHoliday ("25-DEC-2037", "COP"); - - lh.addStaticHoliday ("01-JAN-2038", "COP"); - - lh.addStaticHoliday ("11-JAN-2038", "COP"); - - lh.addStaticHoliday ("22-MAR-2038", "COP"); - - lh.addStaticHoliday ("22-APR-2038", "COP"); - - lh.addStaticHoliday ("23-APR-2038", "COP"); - - lh.addStaticHoliday ("07-JUN-2038", "COP"); - - lh.addStaticHoliday ("28-JUN-2038", "COP"); - - lh.addStaticHoliday ("05-JUL-2038", "COP"); - - lh.addStaticHoliday ("20-JUL-2038", "COP"); - - lh.addStaticHoliday ("16-AUG-2038", "COP"); - - lh.addStaticHoliday ("18-OCT-2038", "COP"); - - lh.addStaticHoliday ("01-NOV-2038", "COP"); - - lh.addStaticHoliday ("15-NOV-2038", "COP"); - - lh.addStaticHoliday ("08-DEC-2038", "COP"); - - lh.addStaticHoliday ("10-JAN-2039", "COP"); - - lh.addStaticHoliday ("21-MAR-2039", "COP"); - - lh.addStaticHoliday ("07-APR-2039", "COP"); - - lh.addStaticHoliday ("08-APR-2039", "COP"); - - lh.addStaticHoliday ("23-MAY-2039", "COP"); - - lh.addStaticHoliday ("13-JUN-2039", "COP"); - - lh.addStaticHoliday ("20-JUN-2039", "COP"); - - lh.addStaticHoliday ("04-JUL-2039", "COP"); - - lh.addStaticHoliday ("20-JUL-2039", "COP"); - - lh.addStaticHoliday ("15-AUG-2039", "COP"); - - lh.addStaticHoliday ("17-OCT-2039", "COP"); - - lh.addStaticHoliday ("07-NOV-2039", "COP"); - - lh.addStaticHoliday ("14-NOV-2039", "COP"); - - lh.addStaticHoliday ("08-DEC-2039", "COP"); - - lh.addStaticHoliday ("09-JAN-2040", "COP"); - - lh.addStaticHoliday ("19-MAR-2040", "COP"); - - lh.addStaticHoliday ("29-MAR-2040", "COP"); - - lh.addStaticHoliday ("30-MAR-2040", "COP"); - - lh.addStaticHoliday ("01-MAY-2040", "COP"); - - lh.addStaticHoliday ("14-MAY-2040", "COP"); - - lh.addStaticHoliday ("04-JUN-2040", "COP"); - - lh.addStaticHoliday ("11-JUN-2040", "COP"); - - lh.addStaticHoliday ("02-JUL-2040", "COP"); - - lh.addStaticHoliday ("20-JUL-2040", "COP"); - - lh.addStaticHoliday ("07-AUG-2040", "COP"); - - lh.addStaticHoliday ("20-AUG-2040", "COP"); - - lh.addStaticHoliday ("15-OCT-2040", "COP"); - - lh.addStaticHoliday ("05-NOV-2040", "COP"); - - lh.addStaticHoliday ("12-NOV-2040", "COP"); - - lh.addStaticHoliday ("25-DEC-2040", "COP"); - - lh.addStaticHoliday ("01-JAN-2041", "COP"); - - lh.addStaticHoliday ("07-JAN-2041", "COP"); - - lh.addStaticHoliday ("25-MAR-2041", "COP"); - - lh.addStaticHoliday ("18-APR-2041", "COP"); - - lh.addStaticHoliday ("19-APR-2041", "COP"); - - lh.addStaticHoliday ("01-MAY-2041", "COP"); - - lh.addStaticHoliday ("03-JUN-2041", "COP"); - - lh.addStaticHoliday ("24-JUN-2041", "COP"); - - lh.addStaticHoliday ("01-JUL-2041", "COP"); - - lh.addStaticHoliday ("07-AUG-2041", "COP"); - - lh.addStaticHoliday ("19-AUG-2041", "COP"); - - lh.addStaticHoliday ("14-OCT-2041", "COP"); - - lh.addStaticHoliday ("04-NOV-2041", "COP"); - - lh.addStaticHoliday ("11-NOV-2041", "COP"); - - lh.addStaticHoliday ("25-DEC-2041", "COP"); - - lh.addStaticHoliday ("01-JAN-2042", "COP"); - - lh.addStaticHoliday ("06-JAN-2042", "COP"); - - lh.addStaticHoliday ("24-MAR-2042", "COP"); - - lh.addStaticHoliday ("03-APR-2042", "COP"); - - lh.addStaticHoliday ("04-APR-2042", "COP"); - - lh.addStaticHoliday ("01-MAY-2042", "COP"); - - lh.addStaticHoliday ("19-MAY-2042", "COP"); - - lh.addStaticHoliday ("09-JUN-2042", "COP"); - - lh.addStaticHoliday ("16-JUN-2042", "COP"); - - lh.addStaticHoliday ("30-JUN-2042", "COP"); - - lh.addStaticHoliday ("07-AUG-2042", "COP"); - - lh.addStaticHoliday ("18-AUG-2042", "COP"); - - lh.addStaticHoliday ("13-OCT-2042", "COP"); - - lh.addStaticHoliday ("03-NOV-2042", "COP"); - - lh.addStaticHoliday ("17-NOV-2042", "COP"); - - lh.addStaticHoliday ("08-DEC-2042", "COP"); - - lh.addStaticHoliday ("25-DEC-2042", "COP"); - - lh.addStaticHoliday ("01-JAN-2043", "COP"); - - lh.addStaticHoliday ("12-JAN-2043", "COP"); - - lh.addStaticHoliday ("23-MAR-2043", "COP"); - - lh.addStaticHoliday ("26-MAR-2043", "COP"); - - lh.addStaticHoliday ("27-MAR-2043", "COP"); - - lh.addStaticHoliday ("01-MAY-2043", "COP"); - - lh.addStaticHoliday ("11-MAY-2043", "COP"); - - lh.addStaticHoliday ("01-JUN-2043", "COP"); - - lh.addStaticHoliday ("08-JUN-2043", "COP"); - - lh.addStaticHoliday ("29-JUN-2043", "COP"); - - lh.addStaticHoliday ("20-JUL-2043", "COP"); - - lh.addStaticHoliday ("07-AUG-2043", "COP"); - - lh.addStaticHoliday ("17-AUG-2043", "COP"); - - lh.addStaticHoliday ("12-OCT-2043", "COP"); - - lh.addStaticHoliday ("02-NOV-2043", "COP"); - - lh.addStaticHoliday ("16-NOV-2043", "COP"); - - lh.addStaticHoliday ("08-DEC-2043", "COP"); - - lh.addStaticHoliday ("25-DEC-2043", "COP"); - - lh.addStaticHoliday ("01-JAN-2044", "COP"); - - lh.addStaticHoliday ("11-JAN-2044", "COP"); - - lh.addStaticHoliday ("21-MAR-2044", "COP"); - - lh.addStaticHoliday ("14-APR-2044", "COP"); - - lh.addStaticHoliday ("15-APR-2044", "COP"); - - lh.addStaticHoliday ("30-MAY-2044", "COP"); - - lh.addStaticHoliday ("20-JUN-2044", "COP"); - - lh.addStaticHoliday ("27-JUN-2044", "COP"); - - lh.addStaticHoliday ("04-JUL-2044", "COP"); - - lh.addStaticHoliday ("20-JUL-2044", "COP"); - - lh.addStaticHoliday ("15-AUG-2044", "COP"); - - lh.addStaticHoliday ("17-OCT-2044", "COP"); - - lh.addStaticHoliday ("07-NOV-2044", "COP"); - - lh.addStaticHoliday ("14-NOV-2044", "COP"); - - lh.addStaticHoliday ("08-DEC-2044", "COP"); - - lh.addStaticHoliday ("09-JAN-2045", "COP"); - - lh.addStaticHoliday ("20-MAR-2045", "COP"); - - lh.addStaticHoliday ("06-APR-2045", "COP"); - - lh.addStaticHoliday ("07-APR-2045", "COP"); - - lh.addStaticHoliday ("01-MAY-2045", "COP"); - - lh.addStaticHoliday ("22-MAY-2045", "COP"); - - lh.addStaticHoliday ("12-JUN-2045", "COP"); - - lh.addStaticHoliday ("19-JUN-2045", "COP"); - - lh.addStaticHoliday ("03-JUL-2045", "COP"); - - lh.addStaticHoliday ("20-JUL-2045", "COP"); - - lh.addStaticHoliday ("07-AUG-2045", "COP"); - - lh.addStaticHoliday ("21-AUG-2045", "COP"); - - lh.addStaticHoliday ("16-OCT-2045", "COP"); - - lh.addStaticHoliday ("06-NOV-2045", "COP"); - - lh.addStaticHoliday ("13-NOV-2045", "COP"); - - lh.addStaticHoliday ("08-DEC-2045", "COP"); - - lh.addStaticHoliday ("25-DEC-2045", "COP"); - - lh.addStaticHoliday ("01-JAN-2046", "COP"); - - lh.addStaticHoliday ("08-JAN-2046", "COP"); - - lh.addStaticHoliday ("19-MAR-2046", "COP"); - - lh.addStaticHoliday ("22-MAR-2046", "COP"); - - lh.addStaticHoliday ("23-MAR-2046", "COP"); - - lh.addStaticHoliday ("01-MAY-2046", "COP"); - - lh.addStaticHoliday ("07-MAY-2046", "COP"); - - lh.addStaticHoliday ("28-MAY-2046", "COP"); - - lh.addStaticHoliday ("04-JUN-2046", "COP"); - - lh.addStaticHoliday ("02-JUL-2046", "COP"); - - lh.addStaticHoliday ("20-JUL-2046", "COP"); - - lh.addStaticHoliday ("07-AUG-2046", "COP"); - - lh.addStaticHoliday ("20-AUG-2046", "COP"); - - lh.addStaticHoliday ("15-OCT-2046", "COP"); - - lh.addStaticHoliday ("05-NOV-2046", "COP"); - - lh.addStaticHoliday ("12-NOV-2046", "COP"); - - lh.addStaticHoliday ("25-DEC-2046", "COP"); - - lh.addStaticHoliday ("01-JAN-2047", "COP"); - - lh.addStaticHoliday ("07-JAN-2047", "COP"); - - lh.addStaticHoliday ("25-MAR-2047", "COP"); - - lh.addStaticHoliday ("11-APR-2047", "COP"); - - lh.addStaticHoliday ("12-APR-2047", "COP"); - - lh.addStaticHoliday ("01-MAY-2047", "COP"); - - lh.addStaticHoliday ("27-MAY-2047", "COP"); - - lh.addStaticHoliday ("17-JUN-2047", "COP"); - - lh.addStaticHoliday ("24-JUN-2047", "COP"); - - lh.addStaticHoliday ("01-JUL-2047", "COP"); - - lh.addStaticHoliday ("07-AUG-2047", "COP"); - - lh.addStaticHoliday ("19-AUG-2047", "COP"); - - lh.addStaticHoliday ("14-OCT-2047", "COP"); - - lh.addStaticHoliday ("04-NOV-2047", "COP"); - - lh.addStaticHoliday ("11-NOV-2047", "COP"); - - lh.addStaticHoliday ("25-DEC-2047", "COP"); - - lh.addStaticHoliday ("01-JAN-2048", "COP"); - - lh.addStaticHoliday ("06-JAN-2048", "COP"); - - lh.addStaticHoliday ("23-MAR-2048", "COP"); - - lh.addStaticHoliday ("02-APR-2048", "COP"); - - lh.addStaticHoliday ("03-APR-2048", "COP"); - - lh.addStaticHoliday ("01-MAY-2048", "COP"); - - lh.addStaticHoliday ("18-MAY-2048", "COP"); - - lh.addStaticHoliday ("08-JUN-2048", "COP"); - - lh.addStaticHoliday ("15-JUN-2048", "COP"); - - lh.addStaticHoliday ("29-JUN-2048", "COP"); - - lh.addStaticHoliday ("20-JUL-2048", "COP"); - - lh.addStaticHoliday ("07-AUG-2048", "COP"); - - lh.addStaticHoliday ("17-AUG-2048", "COP"); - - lh.addStaticHoliday ("12-OCT-2048", "COP"); - - lh.addStaticHoliday ("02-NOV-2048", "COP"); - - lh.addStaticHoliday ("16-NOV-2048", "COP"); - - lh.addStaticHoliday ("08-DEC-2048", "COP"); - - lh.addStaticHoliday ("25-DEC-2048", "COP"); - - lh.addStaticHoliday ("01-JAN-2049", "COP"); - - lh.addStaticHoliday ("11-JAN-2049", "COP"); - - lh.addStaticHoliday ("22-MAR-2049", "COP"); - - lh.addStaticHoliday ("15-APR-2049", "COP"); - - lh.addStaticHoliday ("16-APR-2049", "COP"); - - lh.addStaticHoliday ("31-MAY-2049", "COP"); - - lh.addStaticHoliday ("21-JUN-2049", "COP"); - - lh.addStaticHoliday ("28-JUN-2049", "COP"); - - lh.addStaticHoliday ("05-JUL-2049", "COP"); - - lh.addStaticHoliday ("20-JUL-2049", "COP"); - - lh.addStaticHoliday ("16-AUG-2049", "COP"); - - lh.addStaticHoliday ("18-OCT-2049", "COP"); - - lh.addStaticHoliday ("01-NOV-2049", "COP"); - - lh.addStaticHoliday ("15-NOV-2049", "COP"); - - lh.addStaticHoliday ("08-DEC-2049", "COP"); - - lh.addStaticHoliday ("10-JAN-2050", "COP"); - - lh.addStaticHoliday ("21-MAR-2050", "COP"); - - lh.addStaticHoliday ("07-APR-2050", "COP"); - - lh.addStaticHoliday ("08-APR-2050", "COP"); - - lh.addStaticHoliday ("23-MAY-2050", "COP"); - - lh.addStaticHoliday ("13-JUN-2050", "COP"); - - lh.addStaticHoliday ("20-JUN-2050", "COP"); - - lh.addStaticHoliday ("04-JUL-2050", "COP"); - - lh.addStaticHoliday ("20-JUL-2050", "COP"); - - lh.addStaticHoliday ("15-AUG-2050", "COP"); - - lh.addStaticHoliday ("17-OCT-2050", "COP"); - - lh.addStaticHoliday ("07-NOV-2050", "COP"); - - lh.addStaticHoliday ("14-NOV-2050", "COP"); - - lh.addStaticHoliday ("08-DEC-2050", "COP"); - - lh.addStaticHoliday ("09-JAN-2051", "COP"); - - lh.addStaticHoliday ("20-MAR-2051", "COP"); - - lh.addStaticHoliday ("30-MAR-2051", "COP"); - - lh.addStaticHoliday ("31-MAR-2051", "COP"); - - lh.addStaticHoliday ("01-MAY-2051", "COP"); - - lh.addStaticHoliday ("15-MAY-2051", "COP"); - - lh.addStaticHoliday ("05-JUN-2051", "COP"); - - lh.addStaticHoliday ("12-JUN-2051", "COP"); - - lh.addStaticHoliday ("03-JUL-2051", "COP"); - - lh.addStaticHoliday ("20-JUL-2051", "COP"); - - lh.addStaticHoliday ("07-AUG-2051", "COP"); - - lh.addStaticHoliday ("21-AUG-2051", "COP"); - - lh.addStaticHoliday ("16-OCT-2051", "COP"); - - lh.addStaticHoliday ("06-NOV-2051", "COP"); - - lh.addStaticHoliday ("13-NOV-2051", "COP"); - - lh.addStaticHoliday ("08-DEC-2051", "COP"); - - lh.addStaticHoliday ("25-DEC-2051", "COP"); - - lh.addStaticHoliday ("01-JAN-2052", "COP"); - - lh.addStaticHoliday ("08-JAN-2052", "COP"); - - lh.addStaticHoliday ("25-MAR-2052", "COP"); - - lh.addStaticHoliday ("18-APR-2052", "COP"); - - lh.addStaticHoliday ("19-APR-2052", "COP"); - - lh.addStaticHoliday ("01-MAY-2052", "COP"); - - lh.addStaticHoliday ("03-JUN-2052", "COP"); - - lh.addStaticHoliday ("24-JUN-2052", "COP"); - - lh.addStaticHoliday ("01-JUL-2052", "COP"); - - lh.addStaticHoliday ("07-AUG-2052", "COP"); - - lh.addStaticHoliday ("19-AUG-2052", "COP"); - - lh.addStaticHoliday ("14-OCT-2052", "COP"); - - lh.addStaticHoliday ("04-NOV-2052", "COP"); - - lh.addStaticHoliday ("11-NOV-2052", "COP"); - - lh.addStaticHoliday ("25-DEC-2052", "COP"); - - lh.addStaticHoliday ("01-JAN-2053", "COP"); - - lh.addStaticHoliday ("06-JAN-2053", "COP"); - - lh.addStaticHoliday ("24-MAR-2053", "COP"); - - lh.addStaticHoliday ("03-APR-2053", "COP"); - - lh.addStaticHoliday ("04-APR-2053", "COP"); - - lh.addStaticHoliday ("01-MAY-2053", "COP"); - - lh.addStaticHoliday ("19-MAY-2053", "COP"); - - lh.addStaticHoliday ("09-JUN-2053", "COP"); - - lh.addStaticHoliday ("16-JUN-2053", "COP"); - - lh.addStaticHoliday ("30-JUN-2053", "COP"); - - lh.addStaticHoliday ("07-AUG-2053", "COP"); - - lh.addStaticHoliday ("18-AUG-2053", "COP"); - - lh.addStaticHoliday ("13-OCT-2053", "COP"); - - lh.addStaticHoliday ("03-NOV-2053", "COP"); - - lh.addStaticHoliday ("17-NOV-2053", "COP"); - - lh.addStaticHoliday ("08-DEC-2053", "COP"); - - lh.addStaticHoliday ("25-DEC-2053", "COP"); - - lh.addStaticHoliday ("01-JAN-2054", "COP"); - - lh.addStaticHoliday ("12-JAN-2054", "COP"); - - lh.addStaticHoliday ("23-MAR-2054", "COP"); - - lh.addStaticHoliday ("26-MAR-2054", "COP"); - - lh.addStaticHoliday ("27-MAR-2054", "COP"); - - lh.addStaticHoliday ("01-MAY-2054", "COP"); - - lh.addStaticHoliday ("11-MAY-2054", "COP"); - - lh.addStaticHoliday ("01-JUN-2054", "COP"); - - lh.addStaticHoliday ("08-JUN-2054", "COP"); - - lh.addStaticHoliday ("29-JUN-2054", "COP"); - - lh.addStaticHoliday ("20-JUL-2054", "COP"); - - lh.addStaticHoliday ("07-AUG-2054", "COP"); - - lh.addStaticHoliday ("17-AUG-2054", "COP"); - - lh.addStaticHoliday ("12-OCT-2054", "COP"); - - lh.addStaticHoliday ("02-NOV-2054", "COP"); - - lh.addStaticHoliday ("16-NOV-2054", "COP"); - - lh.addStaticHoliday ("08-DEC-2054", "COP"); - - lh.addStaticHoliday ("25-DEC-2054", "COP"); - - lh.addStaticHoliday ("01-JAN-2055", "COP"); - - lh.addStaticHoliday ("11-JAN-2055", "COP"); - - lh.addStaticHoliday ("22-MAR-2055", "COP"); - - lh.addStaticHoliday ("15-APR-2055", "COP"); - - lh.addStaticHoliday ("16-APR-2055", "COP"); - - lh.addStaticHoliday ("31-MAY-2055", "COP"); - - lh.addStaticHoliday ("21-JUN-2055", "COP"); - - lh.addStaticHoliday ("28-JUN-2055", "COP"); - - lh.addStaticHoliday ("05-JUL-2055", "COP"); - - lh.addStaticHoliday ("20-JUL-2055", "COP"); - - lh.addStaticHoliday ("16-AUG-2055", "COP"); - - lh.addStaticHoliday ("18-OCT-2055", "COP"); - - lh.addStaticHoliday ("01-NOV-2055", "COP"); - - lh.addStaticHoliday ("15-NOV-2055", "COP"); - - lh.addStaticHoliday ("08-DEC-2055", "COP"); - - lh.addStaticHoliday ("10-JAN-2056", "COP"); - - lh.addStaticHoliday ("20-MAR-2056", "COP"); - - lh.addStaticHoliday ("30-MAR-2056", "COP"); - - lh.addStaticHoliday ("31-MAR-2056", "COP"); - - lh.addStaticHoliday ("01-MAY-2056", "COP"); - - lh.addStaticHoliday ("15-MAY-2056", "COP"); - - lh.addStaticHoliday ("05-JUN-2056", "COP"); - - lh.addStaticHoliday ("12-JUN-2056", "COP"); - - lh.addStaticHoliday ("03-JUL-2056", "COP"); - - lh.addStaticHoliday ("20-JUL-2056", "COP"); - - lh.addStaticHoliday ("07-AUG-2056", "COP"); - - lh.addStaticHoliday ("21-AUG-2056", "COP"); - - lh.addStaticHoliday ("16-OCT-2056", "COP"); - - lh.addStaticHoliday ("06-NOV-2056", "COP"); - - lh.addStaticHoliday ("13-NOV-2056", "COP"); - - lh.addStaticHoliday ("08-DEC-2056", "COP"); - - lh.addStaticHoliday ("25-DEC-2056", "COP"); - - lh.addStaticHoliday ("01-JAN-2057", "COP"); - - lh.addStaticHoliday ("08-JAN-2057", "COP"); - - lh.addStaticHoliday ("19-MAR-2057", "COP"); - - lh.addStaticHoliday ("19-APR-2057", "COP"); - - lh.addStaticHoliday ("20-APR-2057", "COP"); - - lh.addStaticHoliday ("01-MAY-2057", "COP"); - - lh.addStaticHoliday ("04-JUN-2057", "COP"); - - lh.addStaticHoliday ("25-JUN-2057", "COP"); - - lh.addStaticHoliday ("02-JUL-2057", "COP"); - - lh.addStaticHoliday ("20-JUL-2057", "COP"); - - lh.addStaticHoliday ("07-AUG-2057", "COP"); - - lh.addStaticHoliday ("20-AUG-2057", "COP"); - - lh.addStaticHoliday ("15-OCT-2057", "COP"); - - lh.addStaticHoliday ("05-NOV-2057", "COP"); - - lh.addStaticHoliday ("12-NOV-2057", "COP"); - - lh.addStaticHoliday ("25-DEC-2057", "COP"); - - lh.addStaticHoliday ("01-JAN-2058", "COP"); - - lh.addStaticHoliday ("07-JAN-2058", "COP"); - - lh.addStaticHoliday ("25-MAR-2058", "COP"); - - lh.addStaticHoliday ("11-APR-2058", "COP"); - - lh.addStaticHoliday ("12-APR-2058", "COP"); - - lh.addStaticHoliday ("01-MAY-2058", "COP"); - - lh.addStaticHoliday ("27-MAY-2058", "COP"); - - lh.addStaticHoliday ("17-JUN-2058", "COP"); - - lh.addStaticHoliday ("24-JUN-2058", "COP"); - - lh.addStaticHoliday ("01-JUL-2058", "COP"); - - lh.addStaticHoliday ("07-AUG-2058", "COP"); - - lh.addStaticHoliday ("19-AUG-2058", "COP"); - - lh.addStaticHoliday ("14-OCT-2058", "COP"); - - lh.addStaticHoliday ("04-NOV-2058", "COP"); - - lh.addStaticHoliday ("11-NOV-2058", "COP"); - - lh.addStaticHoliday ("25-DEC-2058", "COP"); - - lh.addStaticHoliday ("01-JAN-2059", "COP"); - - lh.addStaticHoliday ("06-JAN-2059", "COP"); - - lh.addStaticHoliday ("24-MAR-2059", "COP"); - - lh.addStaticHoliday ("27-MAR-2059", "COP"); - - lh.addStaticHoliday ("28-MAR-2059", "COP"); - - lh.addStaticHoliday ("01-MAY-2059", "COP"); - - lh.addStaticHoliday ("12-MAY-2059", "COP"); - - lh.addStaticHoliday ("02-JUN-2059", "COP"); - - lh.addStaticHoliday ("09-JUN-2059", "COP"); - - lh.addStaticHoliday ("30-JUN-2059", "COP"); - - lh.addStaticHoliday ("07-AUG-2059", "COP"); - - lh.addStaticHoliday ("18-AUG-2059", "COP"); - - lh.addStaticHoliday ("13-OCT-2059", "COP"); - - lh.addStaticHoliday ("03-NOV-2059", "COP"); - - lh.addStaticHoliday ("17-NOV-2059", "COP"); - - lh.addStaticHoliday ("08-DEC-2059", "COP"); - - lh.addStaticHoliday ("25-DEC-2059", "COP"); - - lh.addStaticHoliday ("01-JAN-2060", "COP"); - - lh.addStaticHoliday ("12-JAN-2060", "COP"); - - lh.addStaticHoliday ("22-MAR-2060", "COP"); - - lh.addStaticHoliday ("15-APR-2060", "COP"); - - lh.addStaticHoliday ("16-APR-2060", "COP"); - - lh.addStaticHoliday ("31-MAY-2060", "COP"); - - lh.addStaticHoliday ("21-JUN-2060", "COP"); - - lh.addStaticHoliday ("28-JUN-2060", "COP"); - - lh.addStaticHoliday ("05-JUL-2060", "COP"); - - lh.addStaticHoliday ("20-JUL-2060", "COP"); - - lh.addStaticHoliday ("16-AUG-2060", "COP"); - - lh.addStaticHoliday ("18-OCT-2060", "COP"); - - lh.addStaticHoliday ("01-NOV-2060", "COP"); - - lh.addStaticHoliday ("15-NOV-2060", "COP"); - - lh.addStaticHoliday ("08-DEC-2060", "COP"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/CONHoliday.java b/org/drip/analytics/holset/CONHoliday.java deleted file mode 100644 index d3f8d79..0000000 --- a/org/drip/analytics/holset/CONHoliday.java +++ /dev/null @@ -1,2099 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:06 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class CONHoliday implements org.drip.analytics.holset.LocationHoliday { - public CONHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "CON"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-1998", "Epiphany"); - - lh.addStaticHoliday ("23-MAR-1998", "St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-1998", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labor Day"); - - lh.addStaticHoliday ("25-MAY-1998", "Ascension Day Observed"); - - lh.addStaticHoliday ("15-JUN-1998", "Corpus Christi Observed"); - - lh.addStaticHoliday ("22-JUN-1998", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("29-JUN-1998", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-1998", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-1998", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-1998", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-1998", "Columbus Day"); - - lh.addStaticHoliday ("02-NOV-1998", "All Saints Day"); - - lh.addStaticHoliday ("16-NOV-1998", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-1998", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-1999", "Epiphany"); - - lh.addStaticHoliday ("22-MAR-1999", "St. Josephs Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("17-MAY-1999", "Ascension Day Observed"); - - lh.addStaticHoliday ("07-JUN-1999", "Corpus Christi Observed"); - - lh.addStaticHoliday ("14-JUN-1999", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("05-JUL-1999", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-1999", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-1999", "Assumption Day"); - - lh.addStaticHoliday ("18-OCT-1999", "Columbus Day"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("15-NOV-1999", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-1999", "Immaculate Conception"); - - lh.addStaticHoliday ("10-JAN-2000", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2000", "St. Josephs Day"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labor Day"); - - lh.addStaticHoliday ("05-JUN-2000", "Ascension Day Observed"); - - lh.addStaticHoliday ("26-JUN-2000", "Corpus Christi Observed"); - - lh.addStaticHoliday ("03-JUL-2000", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2000", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2000", "National Holiday"); - - lh.addStaticHoliday ("21-AUG-2000", "Assumption Day"); - - lh.addStaticHoliday ("16-OCT-2000", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2000", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2000", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2001", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2001", "St. Josephs Day"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labor Day"); - - lh.addStaticHoliday ("28-MAY-2001", "Ascension Day Observed"); - - lh.addStaticHoliday ("18-JUN-2001", "Corpus Christi Observed"); - - lh.addStaticHoliday ("25-JUN-2001", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("02-JUL-2001", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2001", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2001", "National Holiday"); - - lh.addStaticHoliday ("20-AUG-2001", "Assumption Day"); - - lh.addStaticHoliday ("15-OCT-2001", "Columbus Day"); - - lh.addStaticHoliday ("05-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("12-NOV-2001", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2002", "Epiphany"); - - lh.addStaticHoliday ("25-MAR-2002", "St. Josephs Day"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labor Day"); - - lh.addStaticHoliday ("13-MAY-2002", "Ascension Day Observed"); - - lh.addStaticHoliday ("03-JUN-2002", "Corpus Christi Observed"); - - lh.addStaticHoliday ("10-JUN-2002", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("01-JUL-2002", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2002", "National Holiday"); - - lh.addStaticHoliday ("19-AUG-2002", "Assumption Day"); - - lh.addStaticHoliday ("14-OCT-2002", "Columbus Day"); - - lh.addStaticHoliday ("04-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2002", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2003", "Epiphany"); - - lh.addStaticHoliday ("24-MAR-2003", "St. Josephs Day"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labor Day"); - - lh.addStaticHoliday ("02-JUN-2003", "Ascension Day Observed"); - - lh.addStaticHoliday ("23-JUN-2003", "Corpus Christi Observed"); - - lh.addStaticHoliday ("30-JUN-2003", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2003", "National Holiday"); - - lh.addStaticHoliday ("18-AUG-2003", "Assumption Day"); - - lh.addStaticHoliday ("13-OCT-2003", "Columbus Day"); - - lh.addStaticHoliday ("03-NOV-2003", "All Saints Day"); - - lh.addStaticHoliday ("17-NOV-2003", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2004", "Epiphany"); - - lh.addStaticHoliday ("22-MAR-2004", "St. Josephs Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2004", "Ascension Day Observed"); - - lh.addStaticHoliday ("14-JUN-2004", "Corpus Christi Observed"); - - lh.addStaticHoliday ("21-JUN-2004", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("05-JUL-2004", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2004", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2004", "Assumption Day"); - - lh.addStaticHoliday ("18-OCT-2004", "Columbus Day"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("15-NOV-2004", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2004", "Immaculate Conception"); - - lh.addStaticHoliday ("10-JAN-2005", "Epiphany"); - - lh.addStaticHoliday ("21-MAR-2005", "St. Josephs Day"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("09-MAY-2005", "Ascension Day Observed"); - - lh.addStaticHoliday ("30-MAY-2005", "Corpus Christi Observed"); - - lh.addStaticHoliday ("06-JUN-2005", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("04-JUL-2005", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2005", "Independence Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("17-OCT-2005", "Columbus Day"); - - lh.addStaticHoliday ("07-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("14-NOV-2005", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2005", "Immaculate Conception"); - - lh.addStaticHoliday ("09-JAN-2006", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2006", "St. Josephs Day"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labor Day"); - - lh.addStaticHoliday ("29-MAY-2006", "Ascension Day Observed"); - - lh.addStaticHoliday ("19-JUN-2006", "Corpus Christi Observed"); - - lh.addStaticHoliday ("26-JUN-2006", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("03-JUL-2006", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2006", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2006", "National Holiday"); - - lh.addStaticHoliday ("21-AUG-2006", "Assumption Day"); - - lh.addStaticHoliday ("16-OCT-2006", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2006", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2006", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2007", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2007", "St. Josephs Day"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labor Day"); - - lh.addStaticHoliday ("21-MAY-2007", "Ascension Day Observed"); - - lh.addStaticHoliday ("11-JUN-2007", "Corpus Christi Observed"); - - lh.addStaticHoliday ("18-JUN-2007", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("02-JUL-2007", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2007", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2007", "National Holiday"); - - lh.addStaticHoliday ("20-AUG-2007", "Assumption Day"); - - lh.addStaticHoliday ("15-OCT-2007", "Columbus Day"); - - lh.addStaticHoliday ("05-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("12-NOV-2007", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2007", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2007", "New Years day Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2008", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "St. Josephs Day"); - - lh.addStaticHoliday ("01-MAY-2008", "Labor Day"); - - lh.addStaticHoliday ("05-MAY-2008", "Ascension Day Observed"); - - lh.addStaticHoliday ("26-MAY-2008", "Corpus Christi Observed"); - - lh.addStaticHoliday ("02-JUN-2008", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("30-JUN-2008", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2008", "National Holiday"); - - lh.addStaticHoliday ("18-AUG-2008", "Assumption Day"); - - lh.addStaticHoliday ("13-OCT-2008", "Columbus Day"); - - lh.addStaticHoliday ("03-NOV-2008", "All Saints Day"); - - lh.addStaticHoliday ("17-NOV-2008", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2008", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2009", "Epiphany"); - - lh.addStaticHoliday ("23-MAR-2009", "St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labor Day"); - - lh.addStaticHoliday ("25-MAY-2009", "Ascension Day Observed"); - - lh.addStaticHoliday ("15-JUN-2009", "Corpus Christi Observed"); - - lh.addStaticHoliday ("22-JUN-2009", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("29-JUN-2009", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2009", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2009", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-2009", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2009", "Columbus Day"); - - lh.addStaticHoliday ("02-NOV-2009", "All Saints Day"); - - lh.addStaticHoliday ("16-NOV-2009", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2009", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2009", "New Years Eve Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2010", "COP"); - - lh.addStaticHoliday ("11-JAN-2010", "COP"); - - lh.addStaticHoliday ("22-MAR-2010", "COP"); - - lh.addStaticHoliday ("01-APR-2010", "COP"); - - lh.addStaticHoliday ("02-APR-2010", "COP"); - - lh.addStaticHoliday ("17-MAY-2010", "COP"); - - lh.addStaticHoliday ("07-JUN-2010", "COP"); - - lh.addStaticHoliday ("14-JUN-2010", "COP"); - - lh.addStaticHoliday ("05-JUL-2010", "COP"); - - lh.addStaticHoliday ("20-JUL-2010", "COP"); - - lh.addStaticHoliday ("16-AUG-2010", "COP"); - - lh.addStaticHoliday ("18-OCT-2010", "COP"); - - lh.addStaticHoliday ("01-NOV-2010", "COP"); - - lh.addStaticHoliday ("15-NOV-2010", "COP"); - - lh.addStaticHoliday ("08-DEC-2010", "COP"); - - lh.addStaticHoliday ("10-JAN-2011", "COP"); - - lh.addStaticHoliday ("21-MAR-2011", "COP"); - - lh.addStaticHoliday ("21-APR-2011", "COP"); - - lh.addStaticHoliday ("22-APR-2011", "COP"); - - lh.addStaticHoliday ("06-JUN-2011", "COP"); - - lh.addStaticHoliday ("27-JUN-2011", "COP"); - - lh.addStaticHoliday ("04-JUL-2011", "COP"); - - lh.addStaticHoliday ("20-JUL-2011", "COP"); - - lh.addStaticHoliday ("15-AUG-2011", "COP"); - - lh.addStaticHoliday ("17-OCT-2011", "COP"); - - lh.addStaticHoliday ("07-NOV-2011", "COP"); - - lh.addStaticHoliday ("14-NOV-2011", "COP"); - - lh.addStaticHoliday ("08-DEC-2011", "COP"); - - lh.addStaticHoliday ("09-JAN-2012", "COP"); - - lh.addStaticHoliday ("19-MAR-2012", "COP"); - - lh.addStaticHoliday ("05-APR-2012", "COP"); - - lh.addStaticHoliday ("06-APR-2012", "COP"); - - lh.addStaticHoliday ("01-MAY-2012", "COP"); - - lh.addStaticHoliday ("21-MAY-2012", "COP"); - - lh.addStaticHoliday ("11-JUN-2012", "COP"); - - lh.addStaticHoliday ("18-JUN-2012", "COP"); - - lh.addStaticHoliday ("02-JUL-2012", "COP"); - - lh.addStaticHoliday ("20-JUL-2012", "COP"); - - lh.addStaticHoliday ("07-AUG-2012", "COP"); - - lh.addStaticHoliday ("20-AUG-2012", "COP"); - - lh.addStaticHoliday ("15-OCT-2012", "COP"); - - lh.addStaticHoliday ("05-NOV-2012", "COP"); - - lh.addStaticHoliday ("12-NOV-2012", "COP"); - - lh.addStaticHoliday ("25-DEC-2012", "COP"); - - lh.addStaticHoliday ("01-JAN-2013", "COP"); - - lh.addStaticHoliday ("07-JAN-2013", "COP"); - - lh.addStaticHoliday ("25-MAR-2013", "COP"); - - lh.addStaticHoliday ("28-MAR-2013", "COP"); - - lh.addStaticHoliday ("29-MAR-2013", "COP"); - - lh.addStaticHoliday ("01-MAY-2013", "COP"); - - lh.addStaticHoliday ("13-MAY-2013", "COP"); - - lh.addStaticHoliday ("03-JUN-2013", "COP"); - - lh.addStaticHoliday ("10-JUN-2013", "COP"); - - lh.addStaticHoliday ("01-JUL-2013", "COP"); - - lh.addStaticHoliday ("07-AUG-2013", "COP"); - - lh.addStaticHoliday ("19-AUG-2013", "COP"); - - lh.addStaticHoliday ("14-OCT-2013", "COP"); - - lh.addStaticHoliday ("04-NOV-2013", "COP"); - - lh.addStaticHoliday ("11-NOV-2013", "COP"); - - lh.addStaticHoliday ("25-DEC-2013", "COP"); - - lh.addStaticHoliday ("01-JAN-2014", "COP"); - - lh.addStaticHoliday ("06-JAN-2014", "COP"); - - lh.addStaticHoliday ("24-MAR-2014", "COP"); - - lh.addStaticHoliday ("17-APR-2014", "COP"); - - lh.addStaticHoliday ("18-APR-2014", "COP"); - - lh.addStaticHoliday ("01-MAY-2014", "COP"); - - lh.addStaticHoliday ("02-JUN-2014", "COP"); - - lh.addStaticHoliday ("23-JUN-2014", "COP"); - - lh.addStaticHoliday ("30-JUN-2014", "COP"); - - lh.addStaticHoliday ("07-AUG-2014", "COP"); - - lh.addStaticHoliday ("18-AUG-2014", "COP"); - - lh.addStaticHoliday ("13-OCT-2014", "COP"); - - lh.addStaticHoliday ("03-NOV-2014", "COP"); - - lh.addStaticHoliday ("17-NOV-2014", "COP"); - - lh.addStaticHoliday ("08-DEC-2014", "COP"); - - lh.addStaticHoliday ("25-DEC-2014", "COP"); - - lh.addStaticHoliday ("01-JAN-2015", "COP"); - - lh.addStaticHoliday ("12-JAN-2015", "COP"); - - lh.addStaticHoliday ("23-MAR-2015", "COP"); - - lh.addStaticHoliday ("02-APR-2015", "COP"); - - lh.addStaticHoliday ("03-APR-2015", "COP"); - - lh.addStaticHoliday ("01-MAY-2015", "COP"); - - lh.addStaticHoliday ("18-MAY-2015", "COP"); - - lh.addStaticHoliday ("08-JUN-2015", "COP"); - - lh.addStaticHoliday ("15-JUN-2015", "COP"); - - lh.addStaticHoliday ("29-JUN-2015", "COP"); - - lh.addStaticHoliday ("20-JUL-2015", "COP"); - - lh.addStaticHoliday ("07-AUG-2015", "COP"); - - lh.addStaticHoliday ("17-AUG-2015", "COP"); - - lh.addStaticHoliday ("12-OCT-2015", "COP"); - - lh.addStaticHoliday ("02-NOV-2015", "COP"); - - lh.addStaticHoliday ("16-NOV-2015", "COP"); - - lh.addStaticHoliday ("08-DEC-2015", "COP"); - - lh.addStaticHoliday ("25-DEC-2015", "COP"); - - lh.addStaticHoliday ("01-JAN-2016", "COP"); - - lh.addStaticHoliday ("11-JAN-2016", "COP"); - - lh.addStaticHoliday ("21-MAR-2016", "COP"); - - lh.addStaticHoliday ("24-MAR-2016", "COP"); - - lh.addStaticHoliday ("25-MAR-2016", "COP"); - - lh.addStaticHoliday ("09-MAY-2016", "COP"); - - lh.addStaticHoliday ("30-MAY-2016", "COP"); - - lh.addStaticHoliday ("06-JUN-2016", "COP"); - - lh.addStaticHoliday ("04-JUL-2016", "COP"); - - lh.addStaticHoliday ("20-JUL-2016", "COP"); - - lh.addStaticHoliday ("15-AUG-2016", "COP"); - - lh.addStaticHoliday ("17-OCT-2016", "COP"); - - lh.addStaticHoliday ("07-NOV-2016", "COP"); - - lh.addStaticHoliday ("14-NOV-2016", "COP"); - - lh.addStaticHoliday ("08-DEC-2016", "COP"); - - lh.addStaticHoliday ("09-JAN-2017", "COP"); - - lh.addStaticHoliday ("20-MAR-2017", "COP"); - - lh.addStaticHoliday ("13-APR-2017", "COP"); - - lh.addStaticHoliday ("14-APR-2017", "COP"); - - lh.addStaticHoliday ("01-MAY-2017", "COP"); - - lh.addStaticHoliday ("29-MAY-2017", "COP"); - - lh.addStaticHoliday ("19-JUN-2017", "COP"); - - lh.addStaticHoliday ("26-JUN-2017", "COP"); - - lh.addStaticHoliday ("03-JUL-2017", "COP"); - - lh.addStaticHoliday ("20-JUL-2017", "COP"); - - lh.addStaticHoliday ("07-AUG-2017", "COP"); - - lh.addStaticHoliday ("21-AUG-2017", "COP"); - - lh.addStaticHoliday ("16-OCT-2017", "COP"); - - lh.addStaticHoliday ("06-NOV-2017", "COP"); - - lh.addStaticHoliday ("13-NOV-2017", "COP"); - - lh.addStaticHoliday ("08-DEC-2017", "COP"); - - lh.addStaticHoliday ("25-DEC-2017", "COP"); - - lh.addStaticHoliday ("01-JAN-2018", "COP"); - - lh.addStaticHoliday ("08-JAN-2018", "COP"); - - lh.addStaticHoliday ("19-MAR-2018", "COP"); - - lh.addStaticHoliday ("29-MAR-2018", "COP"); - - lh.addStaticHoliday ("30-MAR-2018", "COP"); - - lh.addStaticHoliday ("01-MAY-2018", "COP"); - - lh.addStaticHoliday ("14-MAY-2018", "COP"); - - lh.addStaticHoliday ("04-JUN-2018", "COP"); - - lh.addStaticHoliday ("11-JUN-2018", "COP"); - - lh.addStaticHoliday ("02-JUL-2018", "COP"); - - lh.addStaticHoliday ("20-JUL-2018", "COP"); - - lh.addStaticHoliday ("07-AUG-2018", "COP"); - - lh.addStaticHoliday ("20-AUG-2018", "COP"); - - lh.addStaticHoliday ("15-OCT-2018", "COP"); - - lh.addStaticHoliday ("05-NOV-2018", "COP"); - - lh.addStaticHoliday ("12-NOV-2018", "COP"); - - lh.addStaticHoliday ("25-DEC-2018", "COP"); - - lh.addStaticHoliday ("01-JAN-2019", "COP"); - - lh.addStaticHoliday ("07-JAN-2019", "COP"); - - lh.addStaticHoliday ("25-MAR-2019", "COP"); - - lh.addStaticHoliday ("18-APR-2019", "COP"); - - lh.addStaticHoliday ("19-APR-2019", "COP"); - - lh.addStaticHoliday ("01-MAY-2019", "COP"); - - lh.addStaticHoliday ("03-JUN-2019", "COP"); - - lh.addStaticHoliday ("24-JUN-2019", "COP"); - - lh.addStaticHoliday ("01-JUL-2019", "COP"); - - lh.addStaticHoliday ("07-AUG-2019", "COP"); - - lh.addStaticHoliday ("19-AUG-2019", "COP"); - - lh.addStaticHoliday ("14-OCT-2019", "COP"); - - lh.addStaticHoliday ("04-NOV-2019", "COP"); - - lh.addStaticHoliday ("11-NOV-2019", "COP"); - - lh.addStaticHoliday ("25-DEC-2019", "COP"); - - lh.addStaticHoliday ("01-JAN-2020", "COP"); - - lh.addStaticHoliday ("06-JAN-2020", "COP"); - - lh.addStaticHoliday ("23-MAR-2020", "COP"); - - lh.addStaticHoliday ("09-APR-2020", "COP"); - - lh.addStaticHoliday ("10-APR-2020", "COP"); - - lh.addStaticHoliday ("01-MAY-2020", "COP"); - - lh.addStaticHoliday ("25-MAY-2020", "COP"); - - lh.addStaticHoliday ("15-JUN-2020", "COP"); - - lh.addStaticHoliday ("22-JUN-2020", "COP"); - - lh.addStaticHoliday ("29-JUN-2020", "COP"); - - lh.addStaticHoliday ("20-JUL-2020", "COP"); - - lh.addStaticHoliday ("07-AUG-2020", "COP"); - - lh.addStaticHoliday ("17-AUG-2020", "COP"); - - lh.addStaticHoliday ("12-OCT-2020", "COP"); - - lh.addStaticHoliday ("02-NOV-2020", "COP"); - - lh.addStaticHoliday ("16-NOV-2020", "COP"); - - lh.addStaticHoliday ("08-DEC-2020", "COP"); - - lh.addStaticHoliday ("25-DEC-2020", "COP"); - - lh.addStaticHoliday ("01-JAN-2021", "COP"); - - lh.addStaticHoliday ("11-JAN-2021", "COP"); - - lh.addStaticHoliday ("22-MAR-2021", "COP"); - - lh.addStaticHoliday ("01-APR-2021", "COP"); - - lh.addStaticHoliday ("02-APR-2021", "COP"); - - lh.addStaticHoliday ("17-MAY-2021", "COP"); - - lh.addStaticHoliday ("07-JUN-2021", "COP"); - - lh.addStaticHoliday ("14-JUN-2021", "COP"); - - lh.addStaticHoliday ("05-JUL-2021", "COP"); - - lh.addStaticHoliday ("20-JUL-2021", "COP"); - - lh.addStaticHoliday ("16-AUG-2021", "COP"); - - lh.addStaticHoliday ("18-OCT-2021", "COP"); - - lh.addStaticHoliday ("01-NOV-2021", "COP"); - - lh.addStaticHoliday ("15-NOV-2021", "COP"); - - lh.addStaticHoliday ("08-DEC-2021", "COP"); - - lh.addStaticHoliday ("10-JAN-2022", "COP"); - - lh.addStaticHoliday ("21-MAR-2022", "COP"); - - lh.addStaticHoliday ("14-APR-2022", "COP"); - - lh.addStaticHoliday ("15-APR-2022", "COP"); - - lh.addStaticHoliday ("30-MAY-2022", "COP"); - - lh.addStaticHoliday ("20-JUN-2022", "COP"); - - lh.addStaticHoliday ("27-JUN-2022", "COP"); - - lh.addStaticHoliday ("04-JUL-2022", "COP"); - - lh.addStaticHoliday ("20-JUL-2022", "COP"); - - lh.addStaticHoliday ("15-AUG-2022", "COP"); - - lh.addStaticHoliday ("17-OCT-2022", "COP"); - - lh.addStaticHoliday ("07-NOV-2022", "COP"); - - lh.addStaticHoliday ("14-NOV-2022", "COP"); - - lh.addStaticHoliday ("08-DEC-2022", "COP"); - - lh.addStaticHoliday ("09-JAN-2023", "COP"); - - lh.addStaticHoliday ("20-MAR-2023", "COP"); - - lh.addStaticHoliday ("06-APR-2023", "COP"); - - lh.addStaticHoliday ("07-APR-2023", "COP"); - - lh.addStaticHoliday ("01-MAY-2023", "COP"); - - lh.addStaticHoliday ("22-MAY-2023", "COP"); - - lh.addStaticHoliday ("12-JUN-2023", "COP"); - - lh.addStaticHoliday ("19-JUN-2023", "COP"); - - lh.addStaticHoliday ("03-JUL-2023", "COP"); - - lh.addStaticHoliday ("20-JUL-2023", "COP"); - - lh.addStaticHoliday ("07-AUG-2023", "COP"); - - lh.addStaticHoliday ("21-AUG-2023", "COP"); - - lh.addStaticHoliday ("16-OCT-2023", "COP"); - - lh.addStaticHoliday ("06-NOV-2023", "COP"); - - lh.addStaticHoliday ("13-NOV-2023", "COP"); - - lh.addStaticHoliday ("08-DEC-2023", "COP"); - - lh.addStaticHoliday ("25-DEC-2023", "COP"); - - lh.addStaticHoliday ("01-JAN-2024", "COP"); - - lh.addStaticHoliday ("08-JAN-2024", "COP"); - - lh.addStaticHoliday ("25-MAR-2024", "COP"); - - lh.addStaticHoliday ("28-MAR-2024", "COP"); - - lh.addStaticHoliday ("29-MAR-2024", "COP"); - - lh.addStaticHoliday ("01-MAY-2024", "COP"); - - lh.addStaticHoliday ("13-MAY-2024", "COP"); - - lh.addStaticHoliday ("03-JUN-2024", "COP"); - - lh.addStaticHoliday ("10-JUN-2024", "COP"); - - lh.addStaticHoliday ("01-JUL-2024", "COP"); - - lh.addStaticHoliday ("07-AUG-2024", "COP"); - - lh.addStaticHoliday ("19-AUG-2024", "COP"); - - lh.addStaticHoliday ("14-OCT-2024", "COP"); - - lh.addStaticHoliday ("04-NOV-2024", "COP"); - - lh.addStaticHoliday ("11-NOV-2024", "COP"); - - lh.addStaticHoliday ("25-DEC-2024", "COP"); - - lh.addStaticHoliday ("01-JAN-2025", "COP"); - - lh.addStaticHoliday ("06-JAN-2025", "COP"); - - lh.addStaticHoliday ("24-MAR-2025", "COP"); - - lh.addStaticHoliday ("17-APR-2025", "COP"); - - lh.addStaticHoliday ("18-APR-2025", "COP"); - - lh.addStaticHoliday ("01-MAY-2025", "COP"); - - lh.addStaticHoliday ("02-JUN-2025", "COP"); - - lh.addStaticHoliday ("23-JUN-2025", "COP"); - - lh.addStaticHoliday ("30-JUN-2025", "COP"); - - lh.addStaticHoliday ("07-AUG-2025", "COP"); - - lh.addStaticHoliday ("18-AUG-2025", "COP"); - - lh.addStaticHoliday ("13-OCT-2025", "COP"); - - lh.addStaticHoliday ("03-NOV-2025", "COP"); - - lh.addStaticHoliday ("17-NOV-2025", "COP"); - - lh.addStaticHoliday ("08-DEC-2025", "COP"); - - lh.addStaticHoliday ("25-DEC-2025", "COP"); - - lh.addStaticHoliday ("01-JAN-2026", "COP"); - - lh.addStaticHoliday ("12-JAN-2026", "COP"); - - lh.addStaticHoliday ("23-MAR-2026", "COP"); - - lh.addStaticHoliday ("02-APR-2026", "COP"); - - lh.addStaticHoliday ("03-APR-2026", "COP"); - - lh.addStaticHoliday ("01-MAY-2026", "COP"); - - lh.addStaticHoliday ("18-MAY-2026", "COP"); - - lh.addStaticHoliday ("08-JUN-2026", "COP"); - - lh.addStaticHoliday ("15-JUN-2026", "COP"); - - lh.addStaticHoliday ("29-JUN-2026", "COP"); - - lh.addStaticHoliday ("20-JUL-2026", "COP"); - - lh.addStaticHoliday ("07-AUG-2026", "COP"); - - lh.addStaticHoliday ("17-AUG-2026", "COP"); - - lh.addStaticHoliday ("12-OCT-2026", "COP"); - - lh.addStaticHoliday ("02-NOV-2026", "COP"); - - lh.addStaticHoliday ("16-NOV-2026", "COP"); - - lh.addStaticHoliday ("08-DEC-2026", "COP"); - - lh.addStaticHoliday ("25-DEC-2026", "COP"); - - lh.addStaticHoliday ("01-JAN-2027", "COP"); - - lh.addStaticHoliday ("11-JAN-2027", "COP"); - - lh.addStaticHoliday ("22-MAR-2027", "COP"); - - lh.addStaticHoliday ("25-MAR-2027", "COP"); - - lh.addStaticHoliday ("26-MAR-2027", "COP"); - - lh.addStaticHoliday ("10-MAY-2027", "COP"); - - lh.addStaticHoliday ("31-MAY-2027", "COP"); - - lh.addStaticHoliday ("07-JUN-2027", "COP"); - - lh.addStaticHoliday ("05-JUL-2027", "COP"); - - lh.addStaticHoliday ("20-JUL-2027", "COP"); - - lh.addStaticHoliday ("16-AUG-2027", "COP"); - - lh.addStaticHoliday ("18-OCT-2027", "COP"); - - lh.addStaticHoliday ("01-NOV-2027", "COP"); - - lh.addStaticHoliday ("15-NOV-2027", "COP"); - - lh.addStaticHoliday ("08-DEC-2027", "COP"); - - lh.addStaticHoliday ("10-JAN-2028", "COP"); - - lh.addStaticHoliday ("20-MAR-2028", "COP"); - - lh.addStaticHoliday ("13-APR-2028", "COP"); - - lh.addStaticHoliday ("14-APR-2028", "COP"); - - lh.addStaticHoliday ("01-MAY-2028", "COP"); - - lh.addStaticHoliday ("29-MAY-2028", "COP"); - - lh.addStaticHoliday ("19-JUN-2028", "COP"); - - lh.addStaticHoliday ("26-JUN-2028", "COP"); - - lh.addStaticHoliday ("03-JUL-2028", "COP"); - - lh.addStaticHoliday ("20-JUL-2028", "COP"); - - lh.addStaticHoliday ("07-AUG-2028", "COP"); - - lh.addStaticHoliday ("21-AUG-2028", "COP"); - - lh.addStaticHoliday ("16-OCT-2028", "COP"); - - lh.addStaticHoliday ("06-NOV-2028", "COP"); - - lh.addStaticHoliday ("13-NOV-2028", "COP"); - - lh.addStaticHoliday ("08-DEC-2028", "COP"); - - lh.addStaticHoliday ("25-DEC-2028", "COP"); - - lh.addStaticHoliday ("01-JAN-2029", "COP"); - - lh.addStaticHoliday ("08-JAN-2029", "COP"); - - lh.addStaticHoliday ("19-MAR-2029", "COP"); - - lh.addStaticHoliday ("29-MAR-2029", "COP"); - - lh.addStaticHoliday ("30-MAR-2029", "COP"); - - lh.addStaticHoliday ("01-MAY-2029", "COP"); - - lh.addStaticHoliday ("14-MAY-2029", "COP"); - - lh.addStaticHoliday ("04-JUN-2029", "COP"); - - lh.addStaticHoliday ("11-JUN-2029", "COP"); - - lh.addStaticHoliday ("02-JUL-2029", "COP"); - - lh.addStaticHoliday ("20-JUL-2029", "COP"); - - lh.addStaticHoliday ("07-AUG-2029", "COP"); - - lh.addStaticHoliday ("20-AUG-2029", "COP"); - - lh.addStaticHoliday ("15-OCT-2029", "COP"); - - lh.addStaticHoliday ("05-NOV-2029", "COP"); - - lh.addStaticHoliday ("12-NOV-2029", "COP"); - - lh.addStaticHoliday ("25-DEC-2029", "COP"); - - lh.addStaticHoliday ("01-JAN-2030", "COP"); - - lh.addStaticHoliday ("07-JAN-2030", "COP"); - - lh.addStaticHoliday ("25-MAR-2030", "COP"); - - lh.addStaticHoliday ("18-APR-2030", "COP"); - - lh.addStaticHoliday ("19-APR-2030", "COP"); - - lh.addStaticHoliday ("01-MAY-2030", "COP"); - - lh.addStaticHoliday ("03-JUN-2030", "COP"); - - lh.addStaticHoliday ("24-JUN-2030", "COP"); - - lh.addStaticHoliday ("01-JUL-2030", "COP"); - - lh.addStaticHoliday ("07-AUG-2030", "COP"); - - lh.addStaticHoliday ("19-AUG-2030", "COP"); - - lh.addStaticHoliday ("14-OCT-2030", "COP"); - - lh.addStaticHoliday ("04-NOV-2030", "COP"); - - lh.addStaticHoliday ("11-NOV-2030", "COP"); - - lh.addStaticHoliday ("25-DEC-2030", "COP"); - - lh.addStaticHoliday ("01-JAN-2031", "COP"); - - lh.addStaticHoliday ("06-JAN-2031", "COP"); - - lh.addStaticHoliday ("24-MAR-2031", "COP"); - - lh.addStaticHoliday ("10-APR-2031", "COP"); - - lh.addStaticHoliday ("11-APR-2031", "COP"); - - lh.addStaticHoliday ("01-MAY-2031", "COP"); - - lh.addStaticHoliday ("26-MAY-2031", "COP"); - - lh.addStaticHoliday ("16-JUN-2031", "COP"); - - lh.addStaticHoliday ("23-JUN-2031", "COP"); - - lh.addStaticHoliday ("30-JUN-2031", "COP"); - - lh.addStaticHoliday ("07-AUG-2031", "COP"); - - lh.addStaticHoliday ("18-AUG-2031", "COP"); - - lh.addStaticHoliday ("13-OCT-2031", "COP"); - - lh.addStaticHoliday ("03-NOV-2031", "COP"); - - lh.addStaticHoliday ("17-NOV-2031", "COP"); - - lh.addStaticHoliday ("08-DEC-2031", "COP"); - - lh.addStaticHoliday ("25-DEC-2031", "COP"); - - lh.addStaticHoliday ("01-JAN-2032", "COP"); - - lh.addStaticHoliday ("12-JAN-2032", "COP"); - - lh.addStaticHoliday ("22-MAR-2032", "COP"); - - lh.addStaticHoliday ("25-MAR-2032", "COP"); - - lh.addStaticHoliday ("26-MAR-2032", "COP"); - - lh.addStaticHoliday ("10-MAY-2032", "COP"); - - lh.addStaticHoliday ("31-MAY-2032", "COP"); - - lh.addStaticHoliday ("07-JUN-2032", "COP"); - - lh.addStaticHoliday ("05-JUL-2032", "COP"); - - lh.addStaticHoliday ("20-JUL-2032", "COP"); - - lh.addStaticHoliday ("16-AUG-2032", "COP"); - - lh.addStaticHoliday ("18-OCT-2032", "COP"); - - lh.addStaticHoliday ("01-NOV-2032", "COP"); - - lh.addStaticHoliday ("15-NOV-2032", "COP"); - - lh.addStaticHoliday ("08-DEC-2032", "COP"); - - lh.addStaticHoliday ("10-JAN-2033", "COP"); - - lh.addStaticHoliday ("21-MAR-2033", "COP"); - - lh.addStaticHoliday ("14-APR-2033", "COP"); - - lh.addStaticHoliday ("15-APR-2033", "COP"); - - lh.addStaticHoliday ("30-MAY-2033", "COP"); - - lh.addStaticHoliday ("20-JUN-2033", "COP"); - - lh.addStaticHoliday ("27-JUN-2033", "COP"); - - lh.addStaticHoliday ("04-JUL-2033", "COP"); - - lh.addStaticHoliday ("20-JUL-2033", "COP"); - - lh.addStaticHoliday ("15-AUG-2033", "COP"); - - lh.addStaticHoliday ("17-OCT-2033", "COP"); - - lh.addStaticHoliday ("07-NOV-2033", "COP"); - - lh.addStaticHoliday ("14-NOV-2033", "COP"); - - lh.addStaticHoliday ("08-DEC-2033", "COP"); - - lh.addStaticHoliday ("09-JAN-2034", "COP"); - - lh.addStaticHoliday ("20-MAR-2034", "COP"); - - lh.addStaticHoliday ("06-APR-2034", "COP"); - - lh.addStaticHoliday ("07-APR-2034", "COP"); - - lh.addStaticHoliday ("01-MAY-2034", "COP"); - - lh.addStaticHoliday ("22-MAY-2034", "COP"); - - lh.addStaticHoliday ("12-JUN-2034", "COP"); - - lh.addStaticHoliday ("19-JUN-2034", "COP"); - - lh.addStaticHoliday ("03-JUL-2034", "COP"); - - lh.addStaticHoliday ("20-JUL-2034", "COP"); - - lh.addStaticHoliday ("07-AUG-2034", "COP"); - - lh.addStaticHoliday ("21-AUG-2034", "COP"); - - lh.addStaticHoliday ("16-OCT-2034", "COP"); - - lh.addStaticHoliday ("06-NOV-2034", "COP"); - - lh.addStaticHoliday ("13-NOV-2034", "COP"); - - lh.addStaticHoliday ("08-DEC-2034", "COP"); - - lh.addStaticHoliday ("25-DEC-2034", "COP"); - - lh.addStaticHoliday ("01-JAN-2035", "COP"); - - lh.addStaticHoliday ("08-JAN-2035", "COP"); - - lh.addStaticHoliday ("19-MAR-2035", "COP"); - - lh.addStaticHoliday ("22-MAR-2035", "COP"); - - lh.addStaticHoliday ("23-MAR-2035", "COP"); - - lh.addStaticHoliday ("01-MAY-2035", "COP"); - - lh.addStaticHoliday ("07-MAY-2035", "COP"); - - lh.addStaticHoliday ("28-MAY-2035", "COP"); - - lh.addStaticHoliday ("04-JUN-2035", "COP"); - - lh.addStaticHoliday ("02-JUL-2035", "COP"); - - lh.addStaticHoliday ("20-JUL-2035", "COP"); - - lh.addStaticHoliday ("07-AUG-2035", "COP"); - - lh.addStaticHoliday ("20-AUG-2035", "COP"); - - lh.addStaticHoliday ("15-OCT-2035", "COP"); - - lh.addStaticHoliday ("05-NOV-2035", "COP"); - - lh.addStaticHoliday ("12-NOV-2035", "COP"); - - lh.addStaticHoliday ("25-DEC-2035", "COP"); - - lh.addStaticHoliday ("01-JAN-2036", "COP"); - - lh.addStaticHoliday ("07-JAN-2036", "COP"); - - lh.addStaticHoliday ("24-MAR-2036", "COP"); - - lh.addStaticHoliday ("10-APR-2036", "COP"); - - lh.addStaticHoliday ("11-APR-2036", "COP"); - - lh.addStaticHoliday ("01-MAY-2036", "COP"); - - lh.addStaticHoliday ("26-MAY-2036", "COP"); - - lh.addStaticHoliday ("16-JUN-2036", "COP"); - - lh.addStaticHoliday ("23-JUN-2036", "COP"); - - lh.addStaticHoliday ("30-JUN-2036", "COP"); - - lh.addStaticHoliday ("07-AUG-2036", "COP"); - - lh.addStaticHoliday ("18-AUG-2036", "COP"); - - lh.addStaticHoliday ("13-OCT-2036", "COP"); - - lh.addStaticHoliday ("03-NOV-2036", "COP"); - - lh.addStaticHoliday ("17-NOV-2036", "COP"); - - lh.addStaticHoliday ("08-DEC-2036", "COP"); - - lh.addStaticHoliday ("25-DEC-2036", "COP"); - - lh.addStaticHoliday ("01-JAN-2037", "COP"); - - lh.addStaticHoliday ("12-JAN-2037", "COP"); - - lh.addStaticHoliday ("23-MAR-2037", "COP"); - - lh.addStaticHoliday ("02-APR-2037", "COP"); - - lh.addStaticHoliday ("03-APR-2037", "COP"); - - lh.addStaticHoliday ("01-MAY-2037", "COP"); - - lh.addStaticHoliday ("18-MAY-2037", "COP"); - - lh.addStaticHoliday ("08-JUN-2037", "COP"); - - lh.addStaticHoliday ("15-JUN-2037", "COP"); - - lh.addStaticHoliday ("29-JUN-2037", "COP"); - - lh.addStaticHoliday ("20-JUL-2037", "COP"); - - lh.addStaticHoliday ("07-AUG-2037", "COP"); - - lh.addStaticHoliday ("17-AUG-2037", "COP"); - - lh.addStaticHoliday ("12-OCT-2037", "COP"); - - lh.addStaticHoliday ("02-NOV-2037", "COP"); - - lh.addStaticHoliday ("16-NOV-2037", "COP"); - - lh.addStaticHoliday ("08-DEC-2037", "COP"); - - lh.addStaticHoliday ("25-DEC-2037", "COP"); - - lh.addStaticHoliday ("01-JAN-2038", "COP"); - - lh.addStaticHoliday ("11-JAN-2038", "COP"); - - lh.addStaticHoliday ("22-MAR-2038", "COP"); - - lh.addStaticHoliday ("22-APR-2038", "COP"); - - lh.addStaticHoliday ("23-APR-2038", "COP"); - - lh.addStaticHoliday ("07-JUN-2038", "COP"); - - lh.addStaticHoliday ("28-JUN-2038", "COP"); - - lh.addStaticHoliday ("05-JUL-2038", "COP"); - - lh.addStaticHoliday ("20-JUL-2038", "COP"); - - lh.addStaticHoliday ("16-AUG-2038", "COP"); - - lh.addStaticHoliday ("18-OCT-2038", "COP"); - - lh.addStaticHoliday ("01-NOV-2038", "COP"); - - lh.addStaticHoliday ("15-NOV-2038", "COP"); - - lh.addStaticHoliday ("08-DEC-2038", "COP"); - - lh.addStaticHoliday ("10-JAN-2039", "COP"); - - lh.addStaticHoliday ("21-MAR-2039", "COP"); - - lh.addStaticHoliday ("07-APR-2039", "COP"); - - lh.addStaticHoliday ("08-APR-2039", "COP"); - - lh.addStaticHoliday ("23-MAY-2039", "COP"); - - lh.addStaticHoliday ("13-JUN-2039", "COP"); - - lh.addStaticHoliday ("20-JUN-2039", "COP"); - - lh.addStaticHoliday ("04-JUL-2039", "COP"); - - lh.addStaticHoliday ("20-JUL-2039", "COP"); - - lh.addStaticHoliday ("15-AUG-2039", "COP"); - - lh.addStaticHoliday ("17-OCT-2039", "COP"); - - lh.addStaticHoliday ("07-NOV-2039", "COP"); - - lh.addStaticHoliday ("14-NOV-2039", "COP"); - - lh.addStaticHoliday ("08-DEC-2039", "COP"); - - lh.addStaticHoliday ("09-JAN-2040", "COP"); - - lh.addStaticHoliday ("19-MAR-2040", "COP"); - - lh.addStaticHoliday ("29-MAR-2040", "COP"); - - lh.addStaticHoliday ("30-MAR-2040", "COP"); - - lh.addStaticHoliday ("01-MAY-2040", "COP"); - - lh.addStaticHoliday ("14-MAY-2040", "COP"); - - lh.addStaticHoliday ("04-JUN-2040", "COP"); - - lh.addStaticHoliday ("11-JUN-2040", "COP"); - - lh.addStaticHoliday ("02-JUL-2040", "COP"); - - lh.addStaticHoliday ("20-JUL-2040", "COP"); - - lh.addStaticHoliday ("07-AUG-2040", "COP"); - - lh.addStaticHoliday ("20-AUG-2040", "COP"); - - lh.addStaticHoliday ("15-OCT-2040", "COP"); - - lh.addStaticHoliday ("05-NOV-2040", "COP"); - - lh.addStaticHoliday ("12-NOV-2040", "COP"); - - lh.addStaticHoliday ("25-DEC-2040", "COP"); - - lh.addStaticHoliday ("01-JAN-2041", "COP"); - - lh.addStaticHoliday ("07-JAN-2041", "COP"); - - lh.addStaticHoliday ("25-MAR-2041", "COP"); - - lh.addStaticHoliday ("18-APR-2041", "COP"); - - lh.addStaticHoliday ("19-APR-2041", "COP"); - - lh.addStaticHoliday ("01-MAY-2041", "COP"); - - lh.addStaticHoliday ("03-JUN-2041", "COP"); - - lh.addStaticHoliday ("24-JUN-2041", "COP"); - - lh.addStaticHoliday ("01-JUL-2041", "COP"); - - lh.addStaticHoliday ("07-AUG-2041", "COP"); - - lh.addStaticHoliday ("19-AUG-2041", "COP"); - - lh.addStaticHoliday ("14-OCT-2041", "COP"); - - lh.addStaticHoliday ("04-NOV-2041", "COP"); - - lh.addStaticHoliday ("11-NOV-2041", "COP"); - - lh.addStaticHoliday ("25-DEC-2041", "COP"); - - lh.addStaticHoliday ("01-JAN-2042", "COP"); - - lh.addStaticHoliday ("06-JAN-2042", "COP"); - - lh.addStaticHoliday ("24-MAR-2042", "COP"); - - lh.addStaticHoliday ("03-APR-2042", "COP"); - - lh.addStaticHoliday ("04-APR-2042", "COP"); - - lh.addStaticHoliday ("01-MAY-2042", "COP"); - - lh.addStaticHoliday ("19-MAY-2042", "COP"); - - lh.addStaticHoliday ("09-JUN-2042", "COP"); - - lh.addStaticHoliday ("16-JUN-2042", "COP"); - - lh.addStaticHoliday ("30-JUN-2042", "COP"); - - lh.addStaticHoliday ("07-AUG-2042", "COP"); - - lh.addStaticHoliday ("18-AUG-2042", "COP"); - - lh.addStaticHoliday ("13-OCT-2042", "COP"); - - lh.addStaticHoliday ("03-NOV-2042", "COP"); - - lh.addStaticHoliday ("17-NOV-2042", "COP"); - - lh.addStaticHoliday ("08-DEC-2042", "COP"); - - lh.addStaticHoliday ("25-DEC-2042", "COP"); - - lh.addStaticHoliday ("01-JAN-2043", "COP"); - - lh.addStaticHoliday ("12-JAN-2043", "COP"); - - lh.addStaticHoliday ("23-MAR-2043", "COP"); - - lh.addStaticHoliday ("26-MAR-2043", "COP"); - - lh.addStaticHoliday ("27-MAR-2043", "COP"); - - lh.addStaticHoliday ("01-MAY-2043", "COP"); - - lh.addStaticHoliday ("11-MAY-2043", "COP"); - - lh.addStaticHoliday ("01-JUN-2043", "COP"); - - lh.addStaticHoliday ("08-JUN-2043", "COP"); - - lh.addStaticHoliday ("29-JUN-2043", "COP"); - - lh.addStaticHoliday ("20-JUL-2043", "COP"); - - lh.addStaticHoliday ("07-AUG-2043", "COP"); - - lh.addStaticHoliday ("17-AUG-2043", "COP"); - - lh.addStaticHoliday ("12-OCT-2043", "COP"); - - lh.addStaticHoliday ("02-NOV-2043", "COP"); - - lh.addStaticHoliday ("16-NOV-2043", "COP"); - - lh.addStaticHoliday ("08-DEC-2043", "COP"); - - lh.addStaticHoliday ("25-DEC-2043", "COP"); - - lh.addStaticHoliday ("01-JAN-2044", "COP"); - - lh.addStaticHoliday ("11-JAN-2044", "COP"); - - lh.addStaticHoliday ("21-MAR-2044", "COP"); - - lh.addStaticHoliday ("14-APR-2044", "COP"); - - lh.addStaticHoliday ("15-APR-2044", "COP"); - - lh.addStaticHoliday ("30-MAY-2044", "COP"); - - lh.addStaticHoliday ("20-JUN-2044", "COP"); - - lh.addStaticHoliday ("27-JUN-2044", "COP"); - - lh.addStaticHoliday ("04-JUL-2044", "COP"); - - lh.addStaticHoliday ("20-JUL-2044", "COP"); - - lh.addStaticHoliday ("15-AUG-2044", "COP"); - - lh.addStaticHoliday ("17-OCT-2044", "COP"); - - lh.addStaticHoliday ("07-NOV-2044", "COP"); - - lh.addStaticHoliday ("14-NOV-2044", "COP"); - - lh.addStaticHoliday ("08-DEC-2044", "COP"); - - lh.addStaticHoliday ("09-JAN-2045", "COP"); - - lh.addStaticHoliday ("20-MAR-2045", "COP"); - - lh.addStaticHoliday ("06-APR-2045", "COP"); - - lh.addStaticHoliday ("07-APR-2045", "COP"); - - lh.addStaticHoliday ("01-MAY-2045", "COP"); - - lh.addStaticHoliday ("22-MAY-2045", "COP"); - - lh.addStaticHoliday ("12-JUN-2045", "COP"); - - lh.addStaticHoliday ("19-JUN-2045", "COP"); - - lh.addStaticHoliday ("03-JUL-2045", "COP"); - - lh.addStaticHoliday ("20-JUL-2045", "COP"); - - lh.addStaticHoliday ("07-AUG-2045", "COP"); - - lh.addStaticHoliday ("21-AUG-2045", "COP"); - - lh.addStaticHoliday ("16-OCT-2045", "COP"); - - lh.addStaticHoliday ("06-NOV-2045", "COP"); - - lh.addStaticHoliday ("13-NOV-2045", "COP"); - - lh.addStaticHoliday ("08-DEC-2045", "COP"); - - lh.addStaticHoliday ("25-DEC-2045", "COP"); - - lh.addStaticHoliday ("01-JAN-2046", "COP"); - - lh.addStaticHoliday ("08-JAN-2046", "COP"); - - lh.addStaticHoliday ("19-MAR-2046", "COP"); - - lh.addStaticHoliday ("22-MAR-2046", "COP"); - - lh.addStaticHoliday ("23-MAR-2046", "COP"); - - lh.addStaticHoliday ("01-MAY-2046", "COP"); - - lh.addStaticHoliday ("07-MAY-2046", "COP"); - - lh.addStaticHoliday ("28-MAY-2046", "COP"); - - lh.addStaticHoliday ("04-JUN-2046", "COP"); - - lh.addStaticHoliday ("02-JUL-2046", "COP"); - - lh.addStaticHoliday ("20-JUL-2046", "COP"); - - lh.addStaticHoliday ("07-AUG-2046", "COP"); - - lh.addStaticHoliday ("20-AUG-2046", "COP"); - - lh.addStaticHoliday ("15-OCT-2046", "COP"); - - lh.addStaticHoliday ("05-NOV-2046", "COP"); - - lh.addStaticHoliday ("12-NOV-2046", "COP"); - - lh.addStaticHoliday ("25-DEC-2046", "COP"); - - lh.addStaticHoliday ("01-JAN-2047", "COP"); - - lh.addStaticHoliday ("07-JAN-2047", "COP"); - - lh.addStaticHoliday ("25-MAR-2047", "COP"); - - lh.addStaticHoliday ("11-APR-2047", "COP"); - - lh.addStaticHoliday ("12-APR-2047", "COP"); - - lh.addStaticHoliday ("01-MAY-2047", "COP"); - - lh.addStaticHoliday ("27-MAY-2047", "COP"); - - lh.addStaticHoliday ("17-JUN-2047", "COP"); - - lh.addStaticHoliday ("24-JUN-2047", "COP"); - - lh.addStaticHoliday ("01-JUL-2047", "COP"); - - lh.addStaticHoliday ("07-AUG-2047", "COP"); - - lh.addStaticHoliday ("19-AUG-2047", "COP"); - - lh.addStaticHoliday ("14-OCT-2047", "COP"); - - lh.addStaticHoliday ("04-NOV-2047", "COP"); - - lh.addStaticHoliday ("11-NOV-2047", "COP"); - - lh.addStaticHoliday ("25-DEC-2047", "COP"); - - lh.addStaticHoliday ("01-JAN-2048", "COP"); - - lh.addStaticHoliday ("06-JAN-2048", "COP"); - - lh.addStaticHoliday ("23-MAR-2048", "COP"); - - lh.addStaticHoliday ("02-APR-2048", "COP"); - - lh.addStaticHoliday ("03-APR-2048", "COP"); - - lh.addStaticHoliday ("01-MAY-2048", "COP"); - - lh.addStaticHoliday ("18-MAY-2048", "COP"); - - lh.addStaticHoliday ("08-JUN-2048", "COP"); - - lh.addStaticHoliday ("15-JUN-2048", "COP"); - - lh.addStaticHoliday ("29-JUN-2048", "COP"); - - lh.addStaticHoliday ("20-JUL-2048", "COP"); - - lh.addStaticHoliday ("07-AUG-2048", "COP"); - - lh.addStaticHoliday ("17-AUG-2048", "COP"); - - lh.addStaticHoliday ("12-OCT-2048", "COP"); - - lh.addStaticHoliday ("02-NOV-2048", "COP"); - - lh.addStaticHoliday ("16-NOV-2048", "COP"); - - lh.addStaticHoliday ("08-DEC-2048", "COP"); - - lh.addStaticHoliday ("25-DEC-2048", "COP"); - - lh.addStaticHoliday ("01-JAN-2049", "COP"); - - lh.addStaticHoliday ("11-JAN-2049", "COP"); - - lh.addStaticHoliday ("22-MAR-2049", "COP"); - - lh.addStaticHoliday ("15-APR-2049", "COP"); - - lh.addStaticHoliday ("16-APR-2049", "COP"); - - lh.addStaticHoliday ("31-MAY-2049", "COP"); - - lh.addStaticHoliday ("21-JUN-2049", "COP"); - - lh.addStaticHoliday ("28-JUN-2049", "COP"); - - lh.addStaticHoliday ("05-JUL-2049", "COP"); - - lh.addStaticHoliday ("20-JUL-2049", "COP"); - - lh.addStaticHoliday ("16-AUG-2049", "COP"); - - lh.addStaticHoliday ("18-OCT-2049", "COP"); - - lh.addStaticHoliday ("01-NOV-2049", "COP"); - - lh.addStaticHoliday ("15-NOV-2049", "COP"); - - lh.addStaticHoliday ("08-DEC-2049", "COP"); - - lh.addStaticHoliday ("10-JAN-2050", "COP"); - - lh.addStaticHoliday ("21-MAR-2050", "COP"); - - lh.addStaticHoliday ("07-APR-2050", "COP"); - - lh.addStaticHoliday ("08-APR-2050", "COP"); - - lh.addStaticHoliday ("23-MAY-2050", "COP"); - - lh.addStaticHoliday ("13-JUN-2050", "COP"); - - lh.addStaticHoliday ("20-JUN-2050", "COP"); - - lh.addStaticHoliday ("04-JUL-2050", "COP"); - - lh.addStaticHoliday ("20-JUL-2050", "COP"); - - lh.addStaticHoliday ("15-AUG-2050", "COP"); - - lh.addStaticHoliday ("17-OCT-2050", "COP"); - - lh.addStaticHoliday ("07-NOV-2050", "COP"); - - lh.addStaticHoliday ("14-NOV-2050", "COP"); - - lh.addStaticHoliday ("08-DEC-2050", "COP"); - - lh.addStaticHoliday ("09-JAN-2051", "COP"); - - lh.addStaticHoliday ("20-MAR-2051", "COP"); - - lh.addStaticHoliday ("30-MAR-2051", "COP"); - - lh.addStaticHoliday ("31-MAR-2051", "COP"); - - lh.addStaticHoliday ("01-MAY-2051", "COP"); - - lh.addStaticHoliday ("15-MAY-2051", "COP"); - - lh.addStaticHoliday ("05-JUN-2051", "COP"); - - lh.addStaticHoliday ("12-JUN-2051", "COP"); - - lh.addStaticHoliday ("03-JUL-2051", "COP"); - - lh.addStaticHoliday ("20-JUL-2051", "COP"); - - lh.addStaticHoliday ("07-AUG-2051", "COP"); - - lh.addStaticHoliday ("21-AUG-2051", "COP"); - - lh.addStaticHoliday ("16-OCT-2051", "COP"); - - lh.addStaticHoliday ("06-NOV-2051", "COP"); - - lh.addStaticHoliday ("13-NOV-2051", "COP"); - - lh.addStaticHoliday ("08-DEC-2051", "COP"); - - lh.addStaticHoliday ("25-DEC-2051", "COP"); - - lh.addStaticHoliday ("01-JAN-2052", "COP"); - - lh.addStaticHoliday ("08-JAN-2052", "COP"); - - lh.addStaticHoliday ("25-MAR-2052", "COP"); - - lh.addStaticHoliday ("18-APR-2052", "COP"); - - lh.addStaticHoliday ("19-APR-2052", "COP"); - - lh.addStaticHoliday ("01-MAY-2052", "COP"); - - lh.addStaticHoliday ("03-JUN-2052", "COP"); - - lh.addStaticHoliday ("24-JUN-2052", "COP"); - - lh.addStaticHoliday ("01-JUL-2052", "COP"); - - lh.addStaticHoliday ("07-AUG-2052", "COP"); - - lh.addStaticHoliday ("19-AUG-2052", "COP"); - - lh.addStaticHoliday ("14-OCT-2052", "COP"); - - lh.addStaticHoliday ("04-NOV-2052", "COP"); - - lh.addStaticHoliday ("11-NOV-2052", "COP"); - - lh.addStaticHoliday ("25-DEC-2052", "COP"); - - lh.addStaticHoliday ("01-JAN-2053", "COP"); - - lh.addStaticHoliday ("06-JAN-2053", "COP"); - - lh.addStaticHoliday ("24-MAR-2053", "COP"); - - lh.addStaticHoliday ("03-APR-2053", "COP"); - - lh.addStaticHoliday ("04-APR-2053", "COP"); - - lh.addStaticHoliday ("01-MAY-2053", "COP"); - - lh.addStaticHoliday ("19-MAY-2053", "COP"); - - lh.addStaticHoliday ("09-JUN-2053", "COP"); - - lh.addStaticHoliday ("16-JUN-2053", "COP"); - - lh.addStaticHoliday ("30-JUN-2053", "COP"); - - lh.addStaticHoliday ("07-AUG-2053", "COP"); - - lh.addStaticHoliday ("18-AUG-2053", "COP"); - - lh.addStaticHoliday ("13-OCT-2053", "COP"); - - lh.addStaticHoliday ("03-NOV-2053", "COP"); - - lh.addStaticHoliday ("17-NOV-2053", "COP"); - - lh.addStaticHoliday ("08-DEC-2053", "COP"); - - lh.addStaticHoliday ("25-DEC-2053", "COP"); - - lh.addStaticHoliday ("01-JAN-2054", "COP"); - - lh.addStaticHoliday ("12-JAN-2054", "COP"); - - lh.addStaticHoliday ("23-MAR-2054", "COP"); - - lh.addStaticHoliday ("26-MAR-2054", "COP"); - - lh.addStaticHoliday ("27-MAR-2054", "COP"); - - lh.addStaticHoliday ("01-MAY-2054", "COP"); - - lh.addStaticHoliday ("11-MAY-2054", "COP"); - - lh.addStaticHoliday ("01-JUN-2054", "COP"); - - lh.addStaticHoliday ("08-JUN-2054", "COP"); - - lh.addStaticHoliday ("29-JUN-2054", "COP"); - - lh.addStaticHoliday ("20-JUL-2054", "COP"); - - lh.addStaticHoliday ("07-AUG-2054", "COP"); - - lh.addStaticHoliday ("17-AUG-2054", "COP"); - - lh.addStaticHoliday ("12-OCT-2054", "COP"); - - lh.addStaticHoliday ("02-NOV-2054", "COP"); - - lh.addStaticHoliday ("16-NOV-2054", "COP"); - - lh.addStaticHoliday ("08-DEC-2054", "COP"); - - lh.addStaticHoliday ("25-DEC-2054", "COP"); - - lh.addStaticHoliday ("01-JAN-2055", "COP"); - - lh.addStaticHoliday ("11-JAN-2055", "COP"); - - lh.addStaticHoliday ("22-MAR-2055", "COP"); - - lh.addStaticHoliday ("15-APR-2055", "COP"); - - lh.addStaticHoliday ("16-APR-2055", "COP"); - - lh.addStaticHoliday ("31-MAY-2055", "COP"); - - lh.addStaticHoliday ("21-JUN-2055", "COP"); - - lh.addStaticHoliday ("28-JUN-2055", "COP"); - - lh.addStaticHoliday ("05-JUL-2055", "COP"); - - lh.addStaticHoliday ("20-JUL-2055", "COP"); - - lh.addStaticHoliday ("16-AUG-2055", "COP"); - - lh.addStaticHoliday ("18-OCT-2055", "COP"); - - lh.addStaticHoliday ("01-NOV-2055", "COP"); - - lh.addStaticHoliday ("15-NOV-2055", "COP"); - - lh.addStaticHoliday ("08-DEC-2055", "COP"); - - lh.addStaticHoliday ("10-JAN-2056", "COP"); - - lh.addStaticHoliday ("20-MAR-2056", "COP"); - - lh.addStaticHoliday ("30-MAR-2056", "COP"); - - lh.addStaticHoliday ("31-MAR-2056", "COP"); - - lh.addStaticHoliday ("01-MAY-2056", "COP"); - - lh.addStaticHoliday ("15-MAY-2056", "COP"); - - lh.addStaticHoliday ("05-JUN-2056", "COP"); - - lh.addStaticHoliday ("12-JUN-2056", "COP"); - - lh.addStaticHoliday ("03-JUL-2056", "COP"); - - lh.addStaticHoliday ("20-JUL-2056", "COP"); - - lh.addStaticHoliday ("07-AUG-2056", "COP"); - - lh.addStaticHoliday ("21-AUG-2056", "COP"); - - lh.addStaticHoliday ("16-OCT-2056", "COP"); - - lh.addStaticHoliday ("06-NOV-2056", "COP"); - - lh.addStaticHoliday ("13-NOV-2056", "COP"); - - lh.addStaticHoliday ("08-DEC-2056", "COP"); - - lh.addStaticHoliday ("25-DEC-2056", "COP"); - - lh.addStaticHoliday ("01-JAN-2057", "COP"); - - lh.addStaticHoliday ("08-JAN-2057", "COP"); - - lh.addStaticHoliday ("19-MAR-2057", "COP"); - - lh.addStaticHoliday ("19-APR-2057", "COP"); - - lh.addStaticHoliday ("20-APR-2057", "COP"); - - lh.addStaticHoliday ("01-MAY-2057", "COP"); - - lh.addStaticHoliday ("04-JUN-2057", "COP"); - - lh.addStaticHoliday ("25-JUN-2057", "COP"); - - lh.addStaticHoliday ("02-JUL-2057", "COP"); - - lh.addStaticHoliday ("20-JUL-2057", "COP"); - - lh.addStaticHoliday ("07-AUG-2057", "COP"); - - lh.addStaticHoliday ("20-AUG-2057", "COP"); - - lh.addStaticHoliday ("15-OCT-2057", "COP"); - - lh.addStaticHoliday ("05-NOV-2057", "COP"); - - lh.addStaticHoliday ("12-NOV-2057", "COP"); - - lh.addStaticHoliday ("25-DEC-2057", "COP"); - - lh.addStaticHoliday ("01-JAN-2058", "COP"); - - lh.addStaticHoliday ("07-JAN-2058", "COP"); - - lh.addStaticHoliday ("25-MAR-2058", "COP"); - - lh.addStaticHoliday ("11-APR-2058", "COP"); - - lh.addStaticHoliday ("12-APR-2058", "COP"); - - lh.addStaticHoliday ("01-MAY-2058", "COP"); - - lh.addStaticHoliday ("27-MAY-2058", "COP"); - - lh.addStaticHoliday ("17-JUN-2058", "COP"); - - lh.addStaticHoliday ("24-JUN-2058", "COP"); - - lh.addStaticHoliday ("01-JUL-2058", "COP"); - - lh.addStaticHoliday ("07-AUG-2058", "COP"); - - lh.addStaticHoliday ("19-AUG-2058", "COP"); - - lh.addStaticHoliday ("14-OCT-2058", "COP"); - - lh.addStaticHoliday ("04-NOV-2058", "COP"); - - lh.addStaticHoliday ("11-NOV-2058", "COP"); - - lh.addStaticHoliday ("25-DEC-2058", "COP"); - - lh.addStaticHoliday ("01-JAN-2059", "COP"); - - lh.addStaticHoliday ("06-JAN-2059", "COP"); - - lh.addStaticHoliday ("24-MAR-2059", "COP"); - - lh.addStaticHoliday ("27-MAR-2059", "COP"); - - lh.addStaticHoliday ("28-MAR-2059", "COP"); - - lh.addStaticHoliday ("01-MAY-2059", "COP"); - - lh.addStaticHoliday ("12-MAY-2059", "COP"); - - lh.addStaticHoliday ("02-JUN-2059", "COP"); - - lh.addStaticHoliday ("09-JUN-2059", "COP"); - - lh.addStaticHoliday ("30-JUN-2059", "COP"); - - lh.addStaticHoliday ("07-AUG-2059", "COP"); - - lh.addStaticHoliday ("18-AUG-2059", "COP"); - - lh.addStaticHoliday ("13-OCT-2059", "COP"); - - lh.addStaticHoliday ("03-NOV-2059", "COP"); - - lh.addStaticHoliday ("17-NOV-2059", "COP"); - - lh.addStaticHoliday ("08-DEC-2059", "COP"); - - lh.addStaticHoliday ("25-DEC-2059", "COP"); - - lh.addStaticHoliday ("01-JAN-2060", "COP"); - - lh.addStaticHoliday ("12-JAN-2060", "COP"); - - lh.addStaticHoliday ("22-MAR-2060", "COP"); - - lh.addStaticHoliday ("15-APR-2060", "COP"); - - lh.addStaticHoliday ("16-APR-2060", "COP"); - - lh.addStaticHoliday ("31-MAY-2060", "COP"); - - lh.addStaticHoliday ("21-JUN-2060", "COP"); - - lh.addStaticHoliday ("28-JUN-2060", "COP"); - - lh.addStaticHoliday ("05-JUL-2060", "COP"); - - lh.addStaticHoliday ("20-JUL-2060", "COP"); - - lh.addStaticHoliday ("16-AUG-2060", "COP"); - - lh.addStaticHoliday ("18-OCT-2060", "COP"); - - lh.addStaticHoliday ("01-NOV-2060", "COP"); - - lh.addStaticHoliday ("15-NOV-2060", "COP"); - - lh.addStaticHoliday ("08-DEC-2060", "COP"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/COPHoliday.java b/org/drip/analytics/holset/COPHoliday.java deleted file mode 100644 index 3c3eb5b..0000000 --- a/org/drip/analytics/holset/COPHoliday.java +++ /dev/null @@ -1,2101 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class COPHoliday implements org.drip.analytics.holset.LocationHoliday { - public COPHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "COP"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-1998", "Epiphany"); - - lh.addStaticHoliday ("23-MAR-1998", "St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-1998", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labor Day"); - - lh.addStaticHoliday ("25-MAY-1998", "Ascension Day Observed"); - - lh.addStaticHoliday ("15-JUN-1998", "Corpus Christi Observed"); - - lh.addStaticHoliday ("22-JUN-1998", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("29-JUN-1998", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-1998", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-1998", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-1998", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-1998", "Columbus Day"); - - lh.addStaticHoliday ("02-NOV-1998", "All Saints Day"); - - lh.addStaticHoliday ("16-NOV-1998", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-1998", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-1999", "Epiphany"); - - lh.addStaticHoliday ("22-MAR-1999", "St. Josephs Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("17-MAY-1999", "Ascension Day Observed"); - - lh.addStaticHoliday ("07-JUN-1999", "Corpus Christi Observed"); - - lh.addStaticHoliday ("14-JUN-1999", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("05-JUL-1999", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-1999", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-1999", "Assumption Day"); - - lh.addStaticHoliday ("18-OCT-1999", "Columbus Day"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("15-NOV-1999", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-1999", "Immaculate Conception"); - - lh.addStaticHoliday ("10-JAN-2000", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2000", "St. Josephs Day"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labor Day"); - - lh.addStaticHoliday ("05-JUN-2000", "Ascension Day Observed"); - - lh.addStaticHoliday ("26-JUN-2000", "Corpus Christi Observed"); - - lh.addStaticHoliday ("03-JUL-2000", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2000", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2000", "National Holiday"); - - lh.addStaticHoliday ("21-AUG-2000", "Assumption Day"); - - lh.addStaticHoliday ("16-OCT-2000", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2000", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2000", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2001", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2001", "St. Josephs Day"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labor Day"); - - lh.addStaticHoliday ("28-MAY-2001", "Ascension Day Observed"); - - lh.addStaticHoliday ("18-JUN-2001", "Corpus Christi Observed"); - - lh.addStaticHoliday ("25-JUN-2001", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("02-JUL-2001", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2001", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2001", "National Holiday"); - - lh.addStaticHoliday ("20-AUG-2001", "Assumption Day"); - - lh.addStaticHoliday ("15-OCT-2001", "Columbus Day"); - - lh.addStaticHoliday ("05-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("12-NOV-2001", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2002", "Epiphany"); - - lh.addStaticHoliday ("25-MAR-2002", "St. Josephs Day"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labor Day"); - - lh.addStaticHoliday ("13-MAY-2002", "Ascension Day Observed"); - - lh.addStaticHoliday ("03-JUN-2002", "Corpus Christi Observed"); - - lh.addStaticHoliday ("10-JUN-2002", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("01-JUL-2002", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2002", "National Holiday"); - - lh.addStaticHoliday ("19-AUG-2002", "Assumption Day"); - - lh.addStaticHoliday ("14-OCT-2002", "Columbus Day"); - - lh.addStaticHoliday ("04-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2002", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2003", "Epiphany"); - - lh.addStaticHoliday ("24-MAR-2003", "St. Josephs Day"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labor Day"); - - lh.addStaticHoliday ("02-JUN-2003", "Ascension Day Observed"); - - lh.addStaticHoliday ("23-JUN-2003", "Corpus Christi Observed"); - - lh.addStaticHoliday ("30-JUN-2003", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2003", "National Holiday"); - - lh.addStaticHoliday ("18-AUG-2003", "Assumption Day"); - - lh.addStaticHoliday ("13-OCT-2003", "Columbus Day"); - - lh.addStaticHoliday ("03-NOV-2003", "All Saints Day"); - - lh.addStaticHoliday ("17-NOV-2003", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2004", "Epiphany"); - - lh.addStaticHoliday ("22-MAR-2004", "St. Josephs Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2004", "Ascension Day Observed"); - - lh.addStaticHoliday ("14-JUN-2004", "Corpus Christi Observed"); - - lh.addStaticHoliday ("21-JUN-2004", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("05-JUL-2004", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2004", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2004", "Assumption Day"); - - lh.addStaticHoliday ("18-OCT-2004", "Columbus Day"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("15-NOV-2004", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2004", "Immaculate Conception"); - - lh.addStaticHoliday ("10-JAN-2005", "Epiphany"); - - lh.addStaticHoliday ("21-MAR-2005", "St. Josephs Day"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("09-MAY-2005", "Ascension Day Observed"); - - lh.addStaticHoliday ("30-MAY-2005", "Corpus Christi Observed"); - - lh.addStaticHoliday ("06-JUN-2005", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("04-JUL-2005", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2005", "Independence Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("17-OCT-2005", "Columbus Day"); - - lh.addStaticHoliday ("07-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("14-NOV-2005", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2005", "Immaculate Conception"); - - lh.addStaticHoliday ("09-JAN-2006", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2006", "St. Josephs Day"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labor Day"); - - lh.addStaticHoliday ("29-MAY-2006", "Ascension Day Observed"); - - lh.addStaticHoliday ("19-JUN-2006", "Corpus Christi Observed"); - - lh.addStaticHoliday ("26-JUN-2006", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("03-JUL-2006", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2006", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2006", "National Holiday"); - - lh.addStaticHoliday ("21-AUG-2006", "Assumption Day"); - - lh.addStaticHoliday ("16-OCT-2006", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2006", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2006", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2007", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2007", "St. Josephs Day"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labor Day"); - - lh.addStaticHoliday ("21-MAY-2007", "Ascension Day Observed"); - - lh.addStaticHoliday ("11-JUN-2007", "Corpus Christi Observed"); - - lh.addStaticHoliday ("18-JUN-2007", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("02-JUL-2007", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2007", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2007", "National Holiday"); - - lh.addStaticHoliday ("20-AUG-2007", "Assumption Day"); - - lh.addStaticHoliday ("15-OCT-2007", "Columbus Day"); - - lh.addStaticHoliday ("05-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("12-NOV-2007", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2007", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2007", "New Years day Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2008", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "St. Josephs Day"); - - lh.addStaticHoliday ("01-MAY-2008", "Labor Day"); - - lh.addStaticHoliday ("05-MAY-2008", "Ascension Day Observed"); - - lh.addStaticHoliday ("26-MAY-2008", "Corpus Christi Observed"); - - lh.addStaticHoliday ("02-JUN-2008", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("30-JUN-2008", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2008", "National Holiday"); - - lh.addStaticHoliday ("18-AUG-2008", "Assumption Day"); - - lh.addStaticHoliday ("13-OCT-2008", "Columbus Day"); - - lh.addStaticHoliday ("03-NOV-2008", "All Saints Day"); - - lh.addStaticHoliday ("17-NOV-2008", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2008", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2009", "Epiphany"); - - lh.addStaticHoliday ("23-MAR-2009", "St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labor Day"); - - lh.addStaticHoliday ("25-MAY-2009", "Ascension Day Observed"); - - lh.addStaticHoliday ("15-JUN-2009", "Corpus Christi Observed"); - - lh.addStaticHoliday ("22-JUN-2009", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("29-JUN-2009", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2009", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2009", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-2009", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2009", "Columbus Day"); - - lh.addStaticHoliday ("02-NOV-2009", "All Saints Day"); - - lh.addStaticHoliday ("16-NOV-2009", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2009", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2009", "New Years Eve Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2010", "COP"); - - lh.addStaticHoliday ("11-JAN-2010", "COP"); - - lh.addStaticHoliday ("22-MAR-2010", "COP"); - - lh.addStaticHoliday ("01-APR-2010", "COP"); - - lh.addStaticHoliday ("02-APR-2010", "COP"); - - lh.addStaticHoliday ("17-MAY-2010", "COP"); - - lh.addStaticHoliday ("07-JUN-2010", "COP"); - - lh.addStaticHoliday ("14-JUN-2010", "COP"); - - lh.addStaticHoliday ("05-JUL-2010", "COP"); - - lh.addStaticHoliday ("20-JUL-2010", "COP"); - - lh.addStaticHoliday ("16-AUG-2010", "COP"); - - lh.addStaticHoliday ("18-OCT-2010", "COP"); - - lh.addStaticHoliday ("01-NOV-2010", "COP"); - - lh.addStaticHoliday ("15-NOV-2010", "COP"); - - lh.addStaticHoliday ("08-DEC-2010", "COP"); - - lh.addStaticHoliday ("31-DEC-2010", "COP"); - - lh.addStaticHoliday ("10-JAN-2011", "COP"); - - lh.addStaticHoliday ("21-MAR-2011", "COP"); - - lh.addStaticHoliday ("21-APR-2011", "COP"); - - lh.addStaticHoliday ("22-APR-2011", "COP"); - - lh.addStaticHoliday ("06-JUN-2011", "COP"); - - lh.addStaticHoliday ("27-JUN-2011", "COP"); - - lh.addStaticHoliday ("04-JUL-2011", "COP"); - - lh.addStaticHoliday ("20-JUL-2011", "COP"); - - lh.addStaticHoliday ("15-AUG-2011", "COP"); - - lh.addStaticHoliday ("17-OCT-2011", "COP"); - - lh.addStaticHoliday ("07-NOV-2011", "COP"); - - lh.addStaticHoliday ("14-NOV-2011", "COP"); - - lh.addStaticHoliday ("08-DEC-2011", "COP"); - - lh.addStaticHoliday ("09-JAN-2012", "COP"); - - lh.addStaticHoliday ("19-MAR-2012", "COP"); - - lh.addStaticHoliday ("05-APR-2012", "COP"); - - lh.addStaticHoliday ("06-APR-2012", "COP"); - - lh.addStaticHoliday ("01-MAY-2012", "COP"); - - lh.addStaticHoliday ("21-MAY-2012", "COP"); - - lh.addStaticHoliday ("11-JUN-2012", "COP"); - - lh.addStaticHoliday ("18-JUN-2012", "COP"); - - lh.addStaticHoliday ("02-JUL-2012", "COP"); - - lh.addStaticHoliday ("20-JUL-2012", "COP"); - - lh.addStaticHoliday ("07-AUG-2012", "COP"); - - lh.addStaticHoliday ("20-AUG-2012", "COP"); - - lh.addStaticHoliday ("15-OCT-2012", "COP"); - - lh.addStaticHoliday ("05-NOV-2012", "COP"); - - lh.addStaticHoliday ("12-NOV-2012", "COP"); - - lh.addStaticHoliday ("25-DEC-2012", "COP"); - - lh.addStaticHoliday ("01-JAN-2013", "COP"); - - lh.addStaticHoliday ("07-JAN-2013", "COP"); - - lh.addStaticHoliday ("25-MAR-2013", "COP"); - - lh.addStaticHoliday ("28-MAR-2013", "COP"); - - lh.addStaticHoliday ("29-MAR-2013", "COP"); - - lh.addStaticHoliday ("01-MAY-2013", "COP"); - - lh.addStaticHoliday ("13-MAY-2013", "COP"); - - lh.addStaticHoliday ("03-JUN-2013", "COP"); - - lh.addStaticHoliday ("10-JUN-2013", "COP"); - - lh.addStaticHoliday ("01-JUL-2013", "COP"); - - lh.addStaticHoliday ("07-AUG-2013", "COP"); - - lh.addStaticHoliday ("19-AUG-2013", "COP"); - - lh.addStaticHoliday ("14-OCT-2013", "COP"); - - lh.addStaticHoliday ("04-NOV-2013", "COP"); - - lh.addStaticHoliday ("11-NOV-2013", "COP"); - - lh.addStaticHoliday ("25-DEC-2013", "COP"); - - lh.addStaticHoliday ("01-JAN-2014", "COP"); - - lh.addStaticHoliday ("06-JAN-2014", "COP"); - - lh.addStaticHoliday ("24-MAR-2014", "COP"); - - lh.addStaticHoliday ("17-APR-2014", "COP"); - - lh.addStaticHoliday ("18-APR-2014", "COP"); - - lh.addStaticHoliday ("01-MAY-2014", "COP"); - - lh.addStaticHoliday ("02-JUN-2014", "COP"); - - lh.addStaticHoliday ("23-JUN-2014", "COP"); - - lh.addStaticHoliday ("30-JUN-2014", "COP"); - - lh.addStaticHoliday ("07-AUG-2014", "COP"); - - lh.addStaticHoliday ("18-AUG-2014", "COP"); - - lh.addStaticHoliday ("13-OCT-2014", "COP"); - - lh.addStaticHoliday ("03-NOV-2014", "COP"); - - lh.addStaticHoliday ("17-NOV-2014", "COP"); - - lh.addStaticHoliday ("08-DEC-2014", "COP"); - - lh.addStaticHoliday ("25-DEC-2014", "COP"); - - lh.addStaticHoliday ("01-JAN-2015", "COP"); - - lh.addStaticHoliday ("12-JAN-2015", "COP"); - - lh.addStaticHoliday ("23-MAR-2015", "COP"); - - lh.addStaticHoliday ("02-APR-2015", "COP"); - - lh.addStaticHoliday ("03-APR-2015", "COP"); - - lh.addStaticHoliday ("01-MAY-2015", "COP"); - - lh.addStaticHoliday ("18-MAY-2015", "COP"); - - lh.addStaticHoliday ("08-JUN-2015", "COP"); - - lh.addStaticHoliday ("15-JUN-2015", "COP"); - - lh.addStaticHoliday ("29-JUN-2015", "COP"); - - lh.addStaticHoliday ("20-JUL-2015", "COP"); - - lh.addStaticHoliday ("07-AUG-2015", "COP"); - - lh.addStaticHoliday ("17-AUG-2015", "COP"); - - lh.addStaticHoliday ("12-OCT-2015", "COP"); - - lh.addStaticHoliday ("02-NOV-2015", "COP"); - - lh.addStaticHoliday ("16-NOV-2015", "COP"); - - lh.addStaticHoliday ("08-DEC-2015", "COP"); - - lh.addStaticHoliday ("25-DEC-2015", "COP"); - - lh.addStaticHoliday ("01-JAN-2016", "COP"); - - lh.addStaticHoliday ("11-JAN-2016", "COP"); - - lh.addStaticHoliday ("21-MAR-2016", "COP"); - - lh.addStaticHoliday ("24-MAR-2016", "COP"); - - lh.addStaticHoliday ("25-MAR-2016", "COP"); - - lh.addStaticHoliday ("09-MAY-2016", "COP"); - - lh.addStaticHoliday ("30-MAY-2016", "COP"); - - lh.addStaticHoliday ("06-JUN-2016", "COP"); - - lh.addStaticHoliday ("04-JUL-2016", "COP"); - - lh.addStaticHoliday ("20-JUL-2016", "COP"); - - lh.addStaticHoliday ("15-AUG-2016", "COP"); - - lh.addStaticHoliday ("17-OCT-2016", "COP"); - - lh.addStaticHoliday ("07-NOV-2016", "COP"); - - lh.addStaticHoliday ("14-NOV-2016", "COP"); - - lh.addStaticHoliday ("08-DEC-2016", "COP"); - - lh.addStaticHoliday ("09-JAN-2017", "COP"); - - lh.addStaticHoliday ("20-MAR-2017", "COP"); - - lh.addStaticHoliday ("13-APR-2017", "COP"); - - lh.addStaticHoliday ("14-APR-2017", "COP"); - - lh.addStaticHoliday ("01-MAY-2017", "COP"); - - lh.addStaticHoliday ("29-MAY-2017", "COP"); - - lh.addStaticHoliday ("19-JUN-2017", "COP"); - - lh.addStaticHoliday ("26-JUN-2017", "COP"); - - lh.addStaticHoliday ("03-JUL-2017", "COP"); - - lh.addStaticHoliday ("20-JUL-2017", "COP"); - - lh.addStaticHoliday ("07-AUG-2017", "COP"); - - lh.addStaticHoliday ("21-AUG-2017", "COP"); - - lh.addStaticHoliday ("16-OCT-2017", "COP"); - - lh.addStaticHoliday ("06-NOV-2017", "COP"); - - lh.addStaticHoliday ("13-NOV-2017", "COP"); - - lh.addStaticHoliday ("08-DEC-2017", "COP"); - - lh.addStaticHoliday ("25-DEC-2017", "COP"); - - lh.addStaticHoliday ("01-JAN-2018", "COP"); - - lh.addStaticHoliday ("08-JAN-2018", "COP"); - - lh.addStaticHoliday ("19-MAR-2018", "COP"); - - lh.addStaticHoliday ("29-MAR-2018", "COP"); - - lh.addStaticHoliday ("30-MAR-2018", "COP"); - - lh.addStaticHoliday ("01-MAY-2018", "COP"); - - lh.addStaticHoliday ("14-MAY-2018", "COP"); - - lh.addStaticHoliday ("04-JUN-2018", "COP"); - - lh.addStaticHoliday ("11-JUN-2018", "COP"); - - lh.addStaticHoliday ("02-JUL-2018", "COP"); - - lh.addStaticHoliday ("20-JUL-2018", "COP"); - - lh.addStaticHoliday ("07-AUG-2018", "COP"); - - lh.addStaticHoliday ("20-AUG-2018", "COP"); - - lh.addStaticHoliday ("15-OCT-2018", "COP"); - - lh.addStaticHoliday ("05-NOV-2018", "COP"); - - lh.addStaticHoliday ("12-NOV-2018", "COP"); - - lh.addStaticHoliday ("25-DEC-2018", "COP"); - - lh.addStaticHoliday ("01-JAN-2019", "COP"); - - lh.addStaticHoliday ("07-JAN-2019", "COP"); - - lh.addStaticHoliday ("25-MAR-2019", "COP"); - - lh.addStaticHoliday ("18-APR-2019", "COP"); - - lh.addStaticHoliday ("19-APR-2019", "COP"); - - lh.addStaticHoliday ("01-MAY-2019", "COP"); - - lh.addStaticHoliday ("03-JUN-2019", "COP"); - - lh.addStaticHoliday ("24-JUN-2019", "COP"); - - lh.addStaticHoliday ("01-JUL-2019", "COP"); - - lh.addStaticHoliday ("07-AUG-2019", "COP"); - - lh.addStaticHoliday ("19-AUG-2019", "COP"); - - lh.addStaticHoliday ("14-OCT-2019", "COP"); - - lh.addStaticHoliday ("04-NOV-2019", "COP"); - - lh.addStaticHoliday ("11-NOV-2019", "COP"); - - lh.addStaticHoliday ("25-DEC-2019", "COP"); - - lh.addStaticHoliday ("01-JAN-2020", "COP"); - - lh.addStaticHoliday ("06-JAN-2020", "COP"); - - lh.addStaticHoliday ("23-MAR-2020", "COP"); - - lh.addStaticHoliday ("09-APR-2020", "COP"); - - lh.addStaticHoliday ("10-APR-2020", "COP"); - - lh.addStaticHoliday ("01-MAY-2020", "COP"); - - lh.addStaticHoliday ("25-MAY-2020", "COP"); - - lh.addStaticHoliday ("15-JUN-2020", "COP"); - - lh.addStaticHoliday ("22-JUN-2020", "COP"); - - lh.addStaticHoliday ("29-JUN-2020", "COP"); - - lh.addStaticHoliday ("20-JUL-2020", "COP"); - - lh.addStaticHoliday ("07-AUG-2020", "COP"); - - lh.addStaticHoliday ("17-AUG-2020", "COP"); - - lh.addStaticHoliday ("12-OCT-2020", "COP"); - - lh.addStaticHoliday ("02-NOV-2020", "COP"); - - lh.addStaticHoliday ("16-NOV-2020", "COP"); - - lh.addStaticHoliday ("08-DEC-2020", "COP"); - - lh.addStaticHoliday ("25-DEC-2020", "COP"); - - lh.addStaticHoliday ("01-JAN-2021", "COP"); - - lh.addStaticHoliday ("11-JAN-2021", "COP"); - - lh.addStaticHoliday ("22-MAR-2021", "COP"); - - lh.addStaticHoliday ("01-APR-2021", "COP"); - - lh.addStaticHoliday ("02-APR-2021", "COP"); - - lh.addStaticHoliday ("17-MAY-2021", "COP"); - - lh.addStaticHoliday ("07-JUN-2021", "COP"); - - lh.addStaticHoliday ("14-JUN-2021", "COP"); - - lh.addStaticHoliday ("05-JUL-2021", "COP"); - - lh.addStaticHoliday ("20-JUL-2021", "COP"); - - lh.addStaticHoliday ("16-AUG-2021", "COP"); - - lh.addStaticHoliday ("18-OCT-2021", "COP"); - - lh.addStaticHoliday ("01-NOV-2021", "COP"); - - lh.addStaticHoliday ("15-NOV-2021", "COP"); - - lh.addStaticHoliday ("08-DEC-2021", "COP"); - - lh.addStaticHoliday ("10-JAN-2022", "COP"); - - lh.addStaticHoliday ("21-MAR-2022", "COP"); - - lh.addStaticHoliday ("14-APR-2022", "COP"); - - lh.addStaticHoliday ("15-APR-2022", "COP"); - - lh.addStaticHoliday ("30-MAY-2022", "COP"); - - lh.addStaticHoliday ("20-JUN-2022", "COP"); - - lh.addStaticHoliday ("27-JUN-2022", "COP"); - - lh.addStaticHoliday ("04-JUL-2022", "COP"); - - lh.addStaticHoliday ("20-JUL-2022", "COP"); - - lh.addStaticHoliday ("15-AUG-2022", "COP"); - - lh.addStaticHoliday ("17-OCT-2022", "COP"); - - lh.addStaticHoliday ("07-NOV-2022", "COP"); - - lh.addStaticHoliday ("14-NOV-2022", "COP"); - - lh.addStaticHoliday ("08-DEC-2022", "COP"); - - lh.addStaticHoliday ("09-JAN-2023", "COP"); - - lh.addStaticHoliday ("20-MAR-2023", "COP"); - - lh.addStaticHoliday ("06-APR-2023", "COP"); - - lh.addStaticHoliday ("07-APR-2023", "COP"); - - lh.addStaticHoliday ("01-MAY-2023", "COP"); - - lh.addStaticHoliday ("22-MAY-2023", "COP"); - - lh.addStaticHoliday ("12-JUN-2023", "COP"); - - lh.addStaticHoliday ("19-JUN-2023", "COP"); - - lh.addStaticHoliday ("03-JUL-2023", "COP"); - - lh.addStaticHoliday ("20-JUL-2023", "COP"); - - lh.addStaticHoliday ("07-AUG-2023", "COP"); - - lh.addStaticHoliday ("21-AUG-2023", "COP"); - - lh.addStaticHoliday ("16-OCT-2023", "COP"); - - lh.addStaticHoliday ("06-NOV-2023", "COP"); - - lh.addStaticHoliday ("13-NOV-2023", "COP"); - - lh.addStaticHoliday ("08-DEC-2023", "COP"); - - lh.addStaticHoliday ("25-DEC-2023", "COP"); - - lh.addStaticHoliday ("01-JAN-2024", "COP"); - - lh.addStaticHoliday ("08-JAN-2024", "COP"); - - lh.addStaticHoliday ("25-MAR-2024", "COP"); - - lh.addStaticHoliday ("28-MAR-2024", "COP"); - - lh.addStaticHoliday ("29-MAR-2024", "COP"); - - lh.addStaticHoliday ("01-MAY-2024", "COP"); - - lh.addStaticHoliday ("13-MAY-2024", "COP"); - - lh.addStaticHoliday ("03-JUN-2024", "COP"); - - lh.addStaticHoliday ("10-JUN-2024", "COP"); - - lh.addStaticHoliday ("01-JUL-2024", "COP"); - - lh.addStaticHoliday ("07-AUG-2024", "COP"); - - lh.addStaticHoliday ("19-AUG-2024", "COP"); - - lh.addStaticHoliday ("14-OCT-2024", "COP"); - - lh.addStaticHoliday ("04-NOV-2024", "COP"); - - lh.addStaticHoliday ("11-NOV-2024", "COP"); - - lh.addStaticHoliday ("25-DEC-2024", "COP"); - - lh.addStaticHoliday ("01-JAN-2025", "COP"); - - lh.addStaticHoliday ("06-JAN-2025", "COP"); - - lh.addStaticHoliday ("24-MAR-2025", "COP"); - - lh.addStaticHoliday ("17-APR-2025", "COP"); - - lh.addStaticHoliday ("18-APR-2025", "COP"); - - lh.addStaticHoliday ("01-MAY-2025", "COP"); - - lh.addStaticHoliday ("02-JUN-2025", "COP"); - - lh.addStaticHoliday ("23-JUN-2025", "COP"); - - lh.addStaticHoliday ("30-JUN-2025", "COP"); - - lh.addStaticHoliday ("07-AUG-2025", "COP"); - - lh.addStaticHoliday ("18-AUG-2025", "COP"); - - lh.addStaticHoliday ("13-OCT-2025", "COP"); - - lh.addStaticHoliday ("03-NOV-2025", "COP"); - - lh.addStaticHoliday ("17-NOV-2025", "COP"); - - lh.addStaticHoliday ("08-DEC-2025", "COP"); - - lh.addStaticHoliday ("25-DEC-2025", "COP"); - - lh.addStaticHoliday ("01-JAN-2026", "COP"); - - lh.addStaticHoliday ("12-JAN-2026", "COP"); - - lh.addStaticHoliday ("23-MAR-2026", "COP"); - - lh.addStaticHoliday ("02-APR-2026", "COP"); - - lh.addStaticHoliday ("03-APR-2026", "COP"); - - lh.addStaticHoliday ("01-MAY-2026", "COP"); - - lh.addStaticHoliday ("18-MAY-2026", "COP"); - - lh.addStaticHoliday ("08-JUN-2026", "COP"); - - lh.addStaticHoliday ("15-JUN-2026", "COP"); - - lh.addStaticHoliday ("29-JUN-2026", "COP"); - - lh.addStaticHoliday ("20-JUL-2026", "COP"); - - lh.addStaticHoliday ("07-AUG-2026", "COP"); - - lh.addStaticHoliday ("17-AUG-2026", "COP"); - - lh.addStaticHoliday ("12-OCT-2026", "COP"); - - lh.addStaticHoliday ("02-NOV-2026", "COP"); - - lh.addStaticHoliday ("16-NOV-2026", "COP"); - - lh.addStaticHoliday ("08-DEC-2026", "COP"); - - lh.addStaticHoliday ("25-DEC-2026", "COP"); - - lh.addStaticHoliday ("01-JAN-2027", "COP"); - - lh.addStaticHoliday ("11-JAN-2027", "COP"); - - lh.addStaticHoliday ("22-MAR-2027", "COP"); - - lh.addStaticHoliday ("25-MAR-2027", "COP"); - - lh.addStaticHoliday ("26-MAR-2027", "COP"); - - lh.addStaticHoliday ("10-MAY-2027", "COP"); - - lh.addStaticHoliday ("31-MAY-2027", "COP"); - - lh.addStaticHoliday ("07-JUN-2027", "COP"); - - lh.addStaticHoliday ("05-JUL-2027", "COP"); - - lh.addStaticHoliday ("20-JUL-2027", "COP"); - - lh.addStaticHoliday ("16-AUG-2027", "COP"); - - lh.addStaticHoliday ("18-OCT-2027", "COP"); - - lh.addStaticHoliday ("01-NOV-2027", "COP"); - - lh.addStaticHoliday ("15-NOV-2027", "COP"); - - lh.addStaticHoliday ("08-DEC-2027", "COP"); - - lh.addStaticHoliday ("10-JAN-2028", "COP"); - - lh.addStaticHoliday ("20-MAR-2028", "COP"); - - lh.addStaticHoliday ("13-APR-2028", "COP"); - - lh.addStaticHoliday ("14-APR-2028", "COP"); - - lh.addStaticHoliday ("01-MAY-2028", "COP"); - - lh.addStaticHoliday ("29-MAY-2028", "COP"); - - lh.addStaticHoliday ("19-JUN-2028", "COP"); - - lh.addStaticHoliday ("26-JUN-2028", "COP"); - - lh.addStaticHoliday ("03-JUL-2028", "COP"); - - lh.addStaticHoliday ("20-JUL-2028", "COP"); - - lh.addStaticHoliday ("07-AUG-2028", "COP"); - - lh.addStaticHoliday ("21-AUG-2028", "COP"); - - lh.addStaticHoliday ("16-OCT-2028", "COP"); - - lh.addStaticHoliday ("06-NOV-2028", "COP"); - - lh.addStaticHoliday ("13-NOV-2028", "COP"); - - lh.addStaticHoliday ("08-DEC-2028", "COP"); - - lh.addStaticHoliday ("25-DEC-2028", "COP"); - - lh.addStaticHoliday ("01-JAN-2029", "COP"); - - lh.addStaticHoliday ("08-JAN-2029", "COP"); - - lh.addStaticHoliday ("19-MAR-2029", "COP"); - - lh.addStaticHoliday ("29-MAR-2029", "COP"); - - lh.addStaticHoliday ("30-MAR-2029", "COP"); - - lh.addStaticHoliday ("01-MAY-2029", "COP"); - - lh.addStaticHoliday ("14-MAY-2029", "COP"); - - lh.addStaticHoliday ("04-JUN-2029", "COP"); - - lh.addStaticHoliday ("11-JUN-2029", "COP"); - - lh.addStaticHoliday ("02-JUL-2029", "COP"); - - lh.addStaticHoliday ("20-JUL-2029", "COP"); - - lh.addStaticHoliday ("07-AUG-2029", "COP"); - - lh.addStaticHoliday ("20-AUG-2029", "COP"); - - lh.addStaticHoliday ("15-OCT-2029", "COP"); - - lh.addStaticHoliday ("05-NOV-2029", "COP"); - - lh.addStaticHoliday ("12-NOV-2029", "COP"); - - lh.addStaticHoliday ("25-DEC-2029", "COP"); - - lh.addStaticHoliday ("01-JAN-2030", "COP"); - - lh.addStaticHoliday ("07-JAN-2030", "COP"); - - lh.addStaticHoliday ("25-MAR-2030", "COP"); - - lh.addStaticHoliday ("18-APR-2030", "COP"); - - lh.addStaticHoliday ("19-APR-2030", "COP"); - - lh.addStaticHoliday ("01-MAY-2030", "COP"); - - lh.addStaticHoliday ("03-JUN-2030", "COP"); - - lh.addStaticHoliday ("24-JUN-2030", "COP"); - - lh.addStaticHoliday ("01-JUL-2030", "COP"); - - lh.addStaticHoliday ("07-AUG-2030", "COP"); - - lh.addStaticHoliday ("19-AUG-2030", "COP"); - - lh.addStaticHoliday ("14-OCT-2030", "COP"); - - lh.addStaticHoliday ("04-NOV-2030", "COP"); - - lh.addStaticHoliday ("11-NOV-2030", "COP"); - - lh.addStaticHoliday ("25-DEC-2030", "COP"); - - lh.addStaticHoliday ("01-JAN-2031", "COP"); - - lh.addStaticHoliday ("06-JAN-2031", "COP"); - - lh.addStaticHoliday ("24-MAR-2031", "COP"); - - lh.addStaticHoliday ("10-APR-2031", "COP"); - - lh.addStaticHoliday ("11-APR-2031", "COP"); - - lh.addStaticHoliday ("01-MAY-2031", "COP"); - - lh.addStaticHoliday ("26-MAY-2031", "COP"); - - lh.addStaticHoliday ("16-JUN-2031", "COP"); - - lh.addStaticHoliday ("23-JUN-2031", "COP"); - - lh.addStaticHoliday ("30-JUN-2031", "COP"); - - lh.addStaticHoliday ("07-AUG-2031", "COP"); - - lh.addStaticHoliday ("18-AUG-2031", "COP"); - - lh.addStaticHoliday ("13-OCT-2031", "COP"); - - lh.addStaticHoliday ("03-NOV-2031", "COP"); - - lh.addStaticHoliday ("17-NOV-2031", "COP"); - - lh.addStaticHoliday ("08-DEC-2031", "COP"); - - lh.addStaticHoliday ("25-DEC-2031", "COP"); - - lh.addStaticHoliday ("01-JAN-2032", "COP"); - - lh.addStaticHoliday ("12-JAN-2032", "COP"); - - lh.addStaticHoliday ("22-MAR-2032", "COP"); - - lh.addStaticHoliday ("25-MAR-2032", "COP"); - - lh.addStaticHoliday ("26-MAR-2032", "COP"); - - lh.addStaticHoliday ("10-MAY-2032", "COP"); - - lh.addStaticHoliday ("31-MAY-2032", "COP"); - - lh.addStaticHoliday ("07-JUN-2032", "COP"); - - lh.addStaticHoliday ("05-JUL-2032", "COP"); - - lh.addStaticHoliday ("20-JUL-2032", "COP"); - - lh.addStaticHoliday ("16-AUG-2032", "COP"); - - lh.addStaticHoliday ("18-OCT-2032", "COP"); - - lh.addStaticHoliday ("01-NOV-2032", "COP"); - - lh.addStaticHoliday ("15-NOV-2032", "COP"); - - lh.addStaticHoliday ("08-DEC-2032", "COP"); - - lh.addStaticHoliday ("10-JAN-2033", "COP"); - - lh.addStaticHoliday ("21-MAR-2033", "COP"); - - lh.addStaticHoliday ("14-APR-2033", "COP"); - - lh.addStaticHoliday ("15-APR-2033", "COP"); - - lh.addStaticHoliday ("30-MAY-2033", "COP"); - - lh.addStaticHoliday ("20-JUN-2033", "COP"); - - lh.addStaticHoliday ("27-JUN-2033", "COP"); - - lh.addStaticHoliday ("04-JUL-2033", "COP"); - - lh.addStaticHoliday ("20-JUL-2033", "COP"); - - lh.addStaticHoliday ("15-AUG-2033", "COP"); - - lh.addStaticHoliday ("17-OCT-2033", "COP"); - - lh.addStaticHoliday ("07-NOV-2033", "COP"); - - lh.addStaticHoliday ("14-NOV-2033", "COP"); - - lh.addStaticHoliday ("08-DEC-2033", "COP"); - - lh.addStaticHoliday ("09-JAN-2034", "COP"); - - lh.addStaticHoliday ("20-MAR-2034", "COP"); - - lh.addStaticHoliday ("06-APR-2034", "COP"); - - lh.addStaticHoliday ("07-APR-2034", "COP"); - - lh.addStaticHoliday ("01-MAY-2034", "COP"); - - lh.addStaticHoliday ("22-MAY-2034", "COP"); - - lh.addStaticHoliday ("12-JUN-2034", "COP"); - - lh.addStaticHoliday ("19-JUN-2034", "COP"); - - lh.addStaticHoliday ("03-JUL-2034", "COP"); - - lh.addStaticHoliday ("20-JUL-2034", "COP"); - - lh.addStaticHoliday ("07-AUG-2034", "COP"); - - lh.addStaticHoliday ("21-AUG-2034", "COP"); - - lh.addStaticHoliday ("16-OCT-2034", "COP"); - - lh.addStaticHoliday ("06-NOV-2034", "COP"); - - lh.addStaticHoliday ("13-NOV-2034", "COP"); - - lh.addStaticHoliday ("08-DEC-2034", "COP"); - - lh.addStaticHoliday ("25-DEC-2034", "COP"); - - lh.addStaticHoliday ("01-JAN-2035", "COP"); - - lh.addStaticHoliday ("08-JAN-2035", "COP"); - - lh.addStaticHoliday ("19-MAR-2035", "COP"); - - lh.addStaticHoliday ("22-MAR-2035", "COP"); - - lh.addStaticHoliday ("23-MAR-2035", "COP"); - - lh.addStaticHoliday ("01-MAY-2035", "COP"); - - lh.addStaticHoliday ("07-MAY-2035", "COP"); - - lh.addStaticHoliday ("28-MAY-2035", "COP"); - - lh.addStaticHoliday ("04-JUN-2035", "COP"); - - lh.addStaticHoliday ("02-JUL-2035", "COP"); - - lh.addStaticHoliday ("20-JUL-2035", "COP"); - - lh.addStaticHoliday ("07-AUG-2035", "COP"); - - lh.addStaticHoliday ("20-AUG-2035", "COP"); - - lh.addStaticHoliday ("15-OCT-2035", "COP"); - - lh.addStaticHoliday ("05-NOV-2035", "COP"); - - lh.addStaticHoliday ("12-NOV-2035", "COP"); - - lh.addStaticHoliday ("25-DEC-2035", "COP"); - - lh.addStaticHoliday ("01-JAN-2036", "COP"); - - lh.addStaticHoliday ("07-JAN-2036", "COP"); - - lh.addStaticHoliday ("24-MAR-2036", "COP"); - - lh.addStaticHoliday ("10-APR-2036", "COP"); - - lh.addStaticHoliday ("11-APR-2036", "COP"); - - lh.addStaticHoliday ("01-MAY-2036", "COP"); - - lh.addStaticHoliday ("26-MAY-2036", "COP"); - - lh.addStaticHoliday ("16-JUN-2036", "COP"); - - lh.addStaticHoliday ("23-JUN-2036", "COP"); - - lh.addStaticHoliday ("30-JUN-2036", "COP"); - - lh.addStaticHoliday ("07-AUG-2036", "COP"); - - lh.addStaticHoliday ("18-AUG-2036", "COP"); - - lh.addStaticHoliday ("13-OCT-2036", "COP"); - - lh.addStaticHoliday ("03-NOV-2036", "COP"); - - lh.addStaticHoliday ("17-NOV-2036", "COP"); - - lh.addStaticHoliday ("08-DEC-2036", "COP"); - - lh.addStaticHoliday ("25-DEC-2036", "COP"); - - lh.addStaticHoliday ("01-JAN-2037", "COP"); - - lh.addStaticHoliday ("12-JAN-2037", "COP"); - - lh.addStaticHoliday ("23-MAR-2037", "COP"); - - lh.addStaticHoliday ("02-APR-2037", "COP"); - - lh.addStaticHoliday ("03-APR-2037", "COP"); - - lh.addStaticHoliday ("01-MAY-2037", "COP"); - - lh.addStaticHoliday ("18-MAY-2037", "COP"); - - lh.addStaticHoliday ("08-JUN-2037", "COP"); - - lh.addStaticHoliday ("15-JUN-2037", "COP"); - - lh.addStaticHoliday ("29-JUN-2037", "COP"); - - lh.addStaticHoliday ("20-JUL-2037", "COP"); - - lh.addStaticHoliday ("07-AUG-2037", "COP"); - - lh.addStaticHoliday ("17-AUG-2037", "COP"); - - lh.addStaticHoliday ("12-OCT-2037", "COP"); - - lh.addStaticHoliday ("02-NOV-2037", "COP"); - - lh.addStaticHoliday ("16-NOV-2037", "COP"); - - lh.addStaticHoliday ("08-DEC-2037", "COP"); - - lh.addStaticHoliday ("25-DEC-2037", "COP"); - - lh.addStaticHoliday ("01-JAN-2038", "COP"); - - lh.addStaticHoliday ("11-JAN-2038", "COP"); - - lh.addStaticHoliday ("22-MAR-2038", "COP"); - - lh.addStaticHoliday ("22-APR-2038", "COP"); - - lh.addStaticHoliday ("23-APR-2038", "COP"); - - lh.addStaticHoliday ("07-JUN-2038", "COP"); - - lh.addStaticHoliday ("28-JUN-2038", "COP"); - - lh.addStaticHoliday ("05-JUL-2038", "COP"); - - lh.addStaticHoliday ("20-JUL-2038", "COP"); - - lh.addStaticHoliday ("16-AUG-2038", "COP"); - - lh.addStaticHoliday ("18-OCT-2038", "COP"); - - lh.addStaticHoliday ("01-NOV-2038", "COP"); - - lh.addStaticHoliday ("15-NOV-2038", "COP"); - - lh.addStaticHoliday ("08-DEC-2038", "COP"); - - lh.addStaticHoliday ("10-JAN-2039", "COP"); - - lh.addStaticHoliday ("21-MAR-2039", "COP"); - - lh.addStaticHoliday ("07-APR-2039", "COP"); - - lh.addStaticHoliday ("08-APR-2039", "COP"); - - lh.addStaticHoliday ("23-MAY-2039", "COP"); - - lh.addStaticHoliday ("13-JUN-2039", "COP"); - - lh.addStaticHoliday ("20-JUN-2039", "COP"); - - lh.addStaticHoliday ("04-JUL-2039", "COP"); - - lh.addStaticHoliday ("20-JUL-2039", "COP"); - - lh.addStaticHoliday ("15-AUG-2039", "COP"); - - lh.addStaticHoliday ("17-OCT-2039", "COP"); - - lh.addStaticHoliday ("07-NOV-2039", "COP"); - - lh.addStaticHoliday ("14-NOV-2039", "COP"); - - lh.addStaticHoliday ("08-DEC-2039", "COP"); - - lh.addStaticHoliday ("09-JAN-2040", "COP"); - - lh.addStaticHoliday ("19-MAR-2040", "COP"); - - lh.addStaticHoliday ("29-MAR-2040", "COP"); - - lh.addStaticHoliday ("30-MAR-2040", "COP"); - - lh.addStaticHoliday ("01-MAY-2040", "COP"); - - lh.addStaticHoliday ("14-MAY-2040", "COP"); - - lh.addStaticHoliday ("04-JUN-2040", "COP"); - - lh.addStaticHoliday ("11-JUN-2040", "COP"); - - lh.addStaticHoliday ("02-JUL-2040", "COP"); - - lh.addStaticHoliday ("20-JUL-2040", "COP"); - - lh.addStaticHoliday ("07-AUG-2040", "COP"); - - lh.addStaticHoliday ("20-AUG-2040", "COP"); - - lh.addStaticHoliday ("15-OCT-2040", "COP"); - - lh.addStaticHoliday ("05-NOV-2040", "COP"); - - lh.addStaticHoliday ("12-NOV-2040", "COP"); - - lh.addStaticHoliday ("25-DEC-2040", "COP"); - - lh.addStaticHoliday ("01-JAN-2041", "COP"); - - lh.addStaticHoliday ("07-JAN-2041", "COP"); - - lh.addStaticHoliday ("25-MAR-2041", "COP"); - - lh.addStaticHoliday ("18-APR-2041", "COP"); - - lh.addStaticHoliday ("19-APR-2041", "COP"); - - lh.addStaticHoliday ("01-MAY-2041", "COP"); - - lh.addStaticHoliday ("03-JUN-2041", "COP"); - - lh.addStaticHoliday ("24-JUN-2041", "COP"); - - lh.addStaticHoliday ("01-JUL-2041", "COP"); - - lh.addStaticHoliday ("07-AUG-2041", "COP"); - - lh.addStaticHoliday ("19-AUG-2041", "COP"); - - lh.addStaticHoliday ("14-OCT-2041", "COP"); - - lh.addStaticHoliday ("04-NOV-2041", "COP"); - - lh.addStaticHoliday ("11-NOV-2041", "COP"); - - lh.addStaticHoliday ("25-DEC-2041", "COP"); - - lh.addStaticHoliday ("01-JAN-2042", "COP"); - - lh.addStaticHoliday ("06-JAN-2042", "COP"); - - lh.addStaticHoliday ("24-MAR-2042", "COP"); - - lh.addStaticHoliday ("03-APR-2042", "COP"); - - lh.addStaticHoliday ("04-APR-2042", "COP"); - - lh.addStaticHoliday ("01-MAY-2042", "COP"); - - lh.addStaticHoliday ("19-MAY-2042", "COP"); - - lh.addStaticHoliday ("09-JUN-2042", "COP"); - - lh.addStaticHoliday ("16-JUN-2042", "COP"); - - lh.addStaticHoliday ("30-JUN-2042", "COP"); - - lh.addStaticHoliday ("07-AUG-2042", "COP"); - - lh.addStaticHoliday ("18-AUG-2042", "COP"); - - lh.addStaticHoliday ("13-OCT-2042", "COP"); - - lh.addStaticHoliday ("03-NOV-2042", "COP"); - - lh.addStaticHoliday ("17-NOV-2042", "COP"); - - lh.addStaticHoliday ("08-DEC-2042", "COP"); - - lh.addStaticHoliday ("25-DEC-2042", "COP"); - - lh.addStaticHoliday ("01-JAN-2043", "COP"); - - lh.addStaticHoliday ("12-JAN-2043", "COP"); - - lh.addStaticHoliday ("23-MAR-2043", "COP"); - - lh.addStaticHoliday ("26-MAR-2043", "COP"); - - lh.addStaticHoliday ("27-MAR-2043", "COP"); - - lh.addStaticHoliday ("01-MAY-2043", "COP"); - - lh.addStaticHoliday ("11-MAY-2043", "COP"); - - lh.addStaticHoliday ("01-JUN-2043", "COP"); - - lh.addStaticHoliday ("08-JUN-2043", "COP"); - - lh.addStaticHoliday ("29-JUN-2043", "COP"); - - lh.addStaticHoliday ("20-JUL-2043", "COP"); - - lh.addStaticHoliday ("07-AUG-2043", "COP"); - - lh.addStaticHoliday ("17-AUG-2043", "COP"); - - lh.addStaticHoliday ("12-OCT-2043", "COP"); - - lh.addStaticHoliday ("02-NOV-2043", "COP"); - - lh.addStaticHoliday ("16-NOV-2043", "COP"); - - lh.addStaticHoliday ("08-DEC-2043", "COP"); - - lh.addStaticHoliday ("25-DEC-2043", "COP"); - - lh.addStaticHoliday ("01-JAN-2044", "COP"); - - lh.addStaticHoliday ("11-JAN-2044", "COP"); - - lh.addStaticHoliday ("21-MAR-2044", "COP"); - - lh.addStaticHoliday ("14-APR-2044", "COP"); - - lh.addStaticHoliday ("15-APR-2044", "COP"); - - lh.addStaticHoliday ("30-MAY-2044", "COP"); - - lh.addStaticHoliday ("20-JUN-2044", "COP"); - - lh.addStaticHoliday ("27-JUN-2044", "COP"); - - lh.addStaticHoliday ("04-JUL-2044", "COP"); - - lh.addStaticHoliday ("20-JUL-2044", "COP"); - - lh.addStaticHoliday ("15-AUG-2044", "COP"); - - lh.addStaticHoliday ("17-OCT-2044", "COP"); - - lh.addStaticHoliday ("07-NOV-2044", "COP"); - - lh.addStaticHoliday ("14-NOV-2044", "COP"); - - lh.addStaticHoliday ("08-DEC-2044", "COP"); - - lh.addStaticHoliday ("09-JAN-2045", "COP"); - - lh.addStaticHoliday ("20-MAR-2045", "COP"); - - lh.addStaticHoliday ("06-APR-2045", "COP"); - - lh.addStaticHoliday ("07-APR-2045", "COP"); - - lh.addStaticHoliday ("01-MAY-2045", "COP"); - - lh.addStaticHoliday ("22-MAY-2045", "COP"); - - lh.addStaticHoliday ("12-JUN-2045", "COP"); - - lh.addStaticHoliday ("19-JUN-2045", "COP"); - - lh.addStaticHoliday ("03-JUL-2045", "COP"); - - lh.addStaticHoliday ("20-JUL-2045", "COP"); - - lh.addStaticHoliday ("07-AUG-2045", "COP"); - - lh.addStaticHoliday ("21-AUG-2045", "COP"); - - lh.addStaticHoliday ("16-OCT-2045", "COP"); - - lh.addStaticHoliday ("06-NOV-2045", "COP"); - - lh.addStaticHoliday ("13-NOV-2045", "COP"); - - lh.addStaticHoliday ("08-DEC-2045", "COP"); - - lh.addStaticHoliday ("25-DEC-2045", "COP"); - - lh.addStaticHoliday ("01-JAN-2046", "COP"); - - lh.addStaticHoliday ("08-JAN-2046", "COP"); - - lh.addStaticHoliday ("19-MAR-2046", "COP"); - - lh.addStaticHoliday ("22-MAR-2046", "COP"); - - lh.addStaticHoliday ("23-MAR-2046", "COP"); - - lh.addStaticHoliday ("01-MAY-2046", "COP"); - - lh.addStaticHoliday ("07-MAY-2046", "COP"); - - lh.addStaticHoliday ("28-MAY-2046", "COP"); - - lh.addStaticHoliday ("04-JUN-2046", "COP"); - - lh.addStaticHoliday ("02-JUL-2046", "COP"); - - lh.addStaticHoliday ("20-JUL-2046", "COP"); - - lh.addStaticHoliday ("07-AUG-2046", "COP"); - - lh.addStaticHoliday ("20-AUG-2046", "COP"); - - lh.addStaticHoliday ("15-OCT-2046", "COP"); - - lh.addStaticHoliday ("05-NOV-2046", "COP"); - - lh.addStaticHoliday ("12-NOV-2046", "COP"); - - lh.addStaticHoliday ("25-DEC-2046", "COP"); - - lh.addStaticHoliday ("01-JAN-2047", "COP"); - - lh.addStaticHoliday ("07-JAN-2047", "COP"); - - lh.addStaticHoliday ("25-MAR-2047", "COP"); - - lh.addStaticHoliday ("11-APR-2047", "COP"); - - lh.addStaticHoliday ("12-APR-2047", "COP"); - - lh.addStaticHoliday ("01-MAY-2047", "COP"); - - lh.addStaticHoliday ("27-MAY-2047", "COP"); - - lh.addStaticHoliday ("17-JUN-2047", "COP"); - - lh.addStaticHoliday ("24-JUN-2047", "COP"); - - lh.addStaticHoliday ("01-JUL-2047", "COP"); - - lh.addStaticHoliday ("07-AUG-2047", "COP"); - - lh.addStaticHoliday ("19-AUG-2047", "COP"); - - lh.addStaticHoliday ("14-OCT-2047", "COP"); - - lh.addStaticHoliday ("04-NOV-2047", "COP"); - - lh.addStaticHoliday ("11-NOV-2047", "COP"); - - lh.addStaticHoliday ("25-DEC-2047", "COP"); - - lh.addStaticHoliday ("01-JAN-2048", "COP"); - - lh.addStaticHoliday ("06-JAN-2048", "COP"); - - lh.addStaticHoliday ("23-MAR-2048", "COP"); - - lh.addStaticHoliday ("02-APR-2048", "COP"); - - lh.addStaticHoliday ("03-APR-2048", "COP"); - - lh.addStaticHoliday ("01-MAY-2048", "COP"); - - lh.addStaticHoliday ("18-MAY-2048", "COP"); - - lh.addStaticHoliday ("08-JUN-2048", "COP"); - - lh.addStaticHoliday ("15-JUN-2048", "COP"); - - lh.addStaticHoliday ("29-JUN-2048", "COP"); - - lh.addStaticHoliday ("20-JUL-2048", "COP"); - - lh.addStaticHoliday ("07-AUG-2048", "COP"); - - lh.addStaticHoliday ("17-AUG-2048", "COP"); - - lh.addStaticHoliday ("12-OCT-2048", "COP"); - - lh.addStaticHoliday ("02-NOV-2048", "COP"); - - lh.addStaticHoliday ("16-NOV-2048", "COP"); - - lh.addStaticHoliday ("08-DEC-2048", "COP"); - - lh.addStaticHoliday ("25-DEC-2048", "COP"); - - lh.addStaticHoliday ("01-JAN-2049", "COP"); - - lh.addStaticHoliday ("11-JAN-2049", "COP"); - - lh.addStaticHoliday ("22-MAR-2049", "COP"); - - lh.addStaticHoliday ("15-APR-2049", "COP"); - - lh.addStaticHoliday ("16-APR-2049", "COP"); - - lh.addStaticHoliday ("31-MAY-2049", "COP"); - - lh.addStaticHoliday ("21-JUN-2049", "COP"); - - lh.addStaticHoliday ("28-JUN-2049", "COP"); - - lh.addStaticHoliday ("05-JUL-2049", "COP"); - - lh.addStaticHoliday ("20-JUL-2049", "COP"); - - lh.addStaticHoliday ("16-AUG-2049", "COP"); - - lh.addStaticHoliday ("18-OCT-2049", "COP"); - - lh.addStaticHoliday ("01-NOV-2049", "COP"); - - lh.addStaticHoliday ("15-NOV-2049", "COP"); - - lh.addStaticHoliday ("08-DEC-2049", "COP"); - - lh.addStaticHoliday ("10-JAN-2050", "COP"); - - lh.addStaticHoliday ("21-MAR-2050", "COP"); - - lh.addStaticHoliday ("07-APR-2050", "COP"); - - lh.addStaticHoliday ("08-APR-2050", "COP"); - - lh.addStaticHoliday ("23-MAY-2050", "COP"); - - lh.addStaticHoliday ("13-JUN-2050", "COP"); - - lh.addStaticHoliday ("20-JUN-2050", "COP"); - - lh.addStaticHoliday ("04-JUL-2050", "COP"); - - lh.addStaticHoliday ("20-JUL-2050", "COP"); - - lh.addStaticHoliday ("15-AUG-2050", "COP"); - - lh.addStaticHoliday ("17-OCT-2050", "COP"); - - lh.addStaticHoliday ("07-NOV-2050", "COP"); - - lh.addStaticHoliday ("14-NOV-2050", "COP"); - - lh.addStaticHoliday ("08-DEC-2050", "COP"); - - lh.addStaticHoliday ("09-JAN-2051", "COP"); - - lh.addStaticHoliday ("20-MAR-2051", "COP"); - - lh.addStaticHoliday ("30-MAR-2051", "COP"); - - lh.addStaticHoliday ("31-MAR-2051", "COP"); - - lh.addStaticHoliday ("01-MAY-2051", "COP"); - - lh.addStaticHoliday ("15-MAY-2051", "COP"); - - lh.addStaticHoliday ("05-JUN-2051", "COP"); - - lh.addStaticHoliday ("12-JUN-2051", "COP"); - - lh.addStaticHoliday ("03-JUL-2051", "COP"); - - lh.addStaticHoliday ("20-JUL-2051", "COP"); - - lh.addStaticHoliday ("07-AUG-2051", "COP"); - - lh.addStaticHoliday ("21-AUG-2051", "COP"); - - lh.addStaticHoliday ("16-OCT-2051", "COP"); - - lh.addStaticHoliday ("06-NOV-2051", "COP"); - - lh.addStaticHoliday ("13-NOV-2051", "COP"); - - lh.addStaticHoliday ("08-DEC-2051", "COP"); - - lh.addStaticHoliday ("25-DEC-2051", "COP"); - - lh.addStaticHoliday ("01-JAN-2052", "COP"); - - lh.addStaticHoliday ("08-JAN-2052", "COP"); - - lh.addStaticHoliday ("25-MAR-2052", "COP"); - - lh.addStaticHoliday ("18-APR-2052", "COP"); - - lh.addStaticHoliday ("19-APR-2052", "COP"); - - lh.addStaticHoliday ("01-MAY-2052", "COP"); - - lh.addStaticHoliday ("03-JUN-2052", "COP"); - - lh.addStaticHoliday ("24-JUN-2052", "COP"); - - lh.addStaticHoliday ("01-JUL-2052", "COP"); - - lh.addStaticHoliday ("07-AUG-2052", "COP"); - - lh.addStaticHoliday ("19-AUG-2052", "COP"); - - lh.addStaticHoliday ("14-OCT-2052", "COP"); - - lh.addStaticHoliday ("04-NOV-2052", "COP"); - - lh.addStaticHoliday ("11-NOV-2052", "COP"); - - lh.addStaticHoliday ("25-DEC-2052", "COP"); - - lh.addStaticHoliday ("01-JAN-2053", "COP"); - - lh.addStaticHoliday ("06-JAN-2053", "COP"); - - lh.addStaticHoliday ("24-MAR-2053", "COP"); - - lh.addStaticHoliday ("03-APR-2053", "COP"); - - lh.addStaticHoliday ("04-APR-2053", "COP"); - - lh.addStaticHoliday ("01-MAY-2053", "COP"); - - lh.addStaticHoliday ("19-MAY-2053", "COP"); - - lh.addStaticHoliday ("09-JUN-2053", "COP"); - - lh.addStaticHoliday ("16-JUN-2053", "COP"); - - lh.addStaticHoliday ("30-JUN-2053", "COP"); - - lh.addStaticHoliday ("07-AUG-2053", "COP"); - - lh.addStaticHoliday ("18-AUG-2053", "COP"); - - lh.addStaticHoliday ("13-OCT-2053", "COP"); - - lh.addStaticHoliday ("03-NOV-2053", "COP"); - - lh.addStaticHoliday ("17-NOV-2053", "COP"); - - lh.addStaticHoliday ("08-DEC-2053", "COP"); - - lh.addStaticHoliday ("25-DEC-2053", "COP"); - - lh.addStaticHoliday ("01-JAN-2054", "COP"); - - lh.addStaticHoliday ("12-JAN-2054", "COP"); - - lh.addStaticHoliday ("23-MAR-2054", "COP"); - - lh.addStaticHoliday ("26-MAR-2054", "COP"); - - lh.addStaticHoliday ("27-MAR-2054", "COP"); - - lh.addStaticHoliday ("01-MAY-2054", "COP"); - - lh.addStaticHoliday ("11-MAY-2054", "COP"); - - lh.addStaticHoliday ("01-JUN-2054", "COP"); - - lh.addStaticHoliday ("08-JUN-2054", "COP"); - - lh.addStaticHoliday ("29-JUN-2054", "COP"); - - lh.addStaticHoliday ("20-JUL-2054", "COP"); - - lh.addStaticHoliday ("07-AUG-2054", "COP"); - - lh.addStaticHoliday ("17-AUG-2054", "COP"); - - lh.addStaticHoliday ("12-OCT-2054", "COP"); - - lh.addStaticHoliday ("02-NOV-2054", "COP"); - - lh.addStaticHoliday ("16-NOV-2054", "COP"); - - lh.addStaticHoliday ("08-DEC-2054", "COP"); - - lh.addStaticHoliday ("25-DEC-2054", "COP"); - - lh.addStaticHoliday ("01-JAN-2055", "COP"); - - lh.addStaticHoliday ("11-JAN-2055", "COP"); - - lh.addStaticHoliday ("22-MAR-2055", "COP"); - - lh.addStaticHoliday ("15-APR-2055", "COP"); - - lh.addStaticHoliday ("16-APR-2055", "COP"); - - lh.addStaticHoliday ("31-MAY-2055", "COP"); - - lh.addStaticHoliday ("21-JUN-2055", "COP"); - - lh.addStaticHoliday ("28-JUN-2055", "COP"); - - lh.addStaticHoliday ("05-JUL-2055", "COP"); - - lh.addStaticHoliday ("20-JUL-2055", "COP"); - - lh.addStaticHoliday ("16-AUG-2055", "COP"); - - lh.addStaticHoliday ("18-OCT-2055", "COP"); - - lh.addStaticHoliday ("01-NOV-2055", "COP"); - - lh.addStaticHoliday ("15-NOV-2055", "COP"); - - lh.addStaticHoliday ("08-DEC-2055", "COP"); - - lh.addStaticHoliday ("10-JAN-2056", "COP"); - - lh.addStaticHoliday ("20-MAR-2056", "COP"); - - lh.addStaticHoliday ("30-MAR-2056", "COP"); - - lh.addStaticHoliday ("31-MAR-2056", "COP"); - - lh.addStaticHoliday ("01-MAY-2056", "COP"); - - lh.addStaticHoliday ("15-MAY-2056", "COP"); - - lh.addStaticHoliday ("05-JUN-2056", "COP"); - - lh.addStaticHoliday ("12-JUN-2056", "COP"); - - lh.addStaticHoliday ("03-JUL-2056", "COP"); - - lh.addStaticHoliday ("20-JUL-2056", "COP"); - - lh.addStaticHoliday ("07-AUG-2056", "COP"); - - lh.addStaticHoliday ("21-AUG-2056", "COP"); - - lh.addStaticHoliday ("16-OCT-2056", "COP"); - - lh.addStaticHoliday ("06-NOV-2056", "COP"); - - lh.addStaticHoliday ("13-NOV-2056", "COP"); - - lh.addStaticHoliday ("08-DEC-2056", "COP"); - - lh.addStaticHoliday ("25-DEC-2056", "COP"); - - lh.addStaticHoliday ("01-JAN-2057", "COP"); - - lh.addStaticHoliday ("08-JAN-2057", "COP"); - - lh.addStaticHoliday ("19-MAR-2057", "COP"); - - lh.addStaticHoliday ("19-APR-2057", "COP"); - - lh.addStaticHoliday ("20-APR-2057", "COP"); - - lh.addStaticHoliday ("01-MAY-2057", "COP"); - - lh.addStaticHoliday ("04-JUN-2057", "COP"); - - lh.addStaticHoliday ("25-JUN-2057", "COP"); - - lh.addStaticHoliday ("02-JUL-2057", "COP"); - - lh.addStaticHoliday ("20-JUL-2057", "COP"); - - lh.addStaticHoliday ("07-AUG-2057", "COP"); - - lh.addStaticHoliday ("20-AUG-2057", "COP"); - - lh.addStaticHoliday ("15-OCT-2057", "COP"); - - lh.addStaticHoliday ("05-NOV-2057", "COP"); - - lh.addStaticHoliday ("12-NOV-2057", "COP"); - - lh.addStaticHoliday ("25-DEC-2057", "COP"); - - lh.addStaticHoliday ("01-JAN-2058", "COP"); - - lh.addStaticHoliday ("07-JAN-2058", "COP"); - - lh.addStaticHoliday ("25-MAR-2058", "COP"); - - lh.addStaticHoliday ("11-APR-2058", "COP"); - - lh.addStaticHoliday ("12-APR-2058", "COP"); - - lh.addStaticHoliday ("01-MAY-2058", "COP"); - - lh.addStaticHoliday ("27-MAY-2058", "COP"); - - lh.addStaticHoliday ("17-JUN-2058", "COP"); - - lh.addStaticHoliday ("24-JUN-2058", "COP"); - - lh.addStaticHoliday ("01-JUL-2058", "COP"); - - lh.addStaticHoliday ("07-AUG-2058", "COP"); - - lh.addStaticHoliday ("19-AUG-2058", "COP"); - - lh.addStaticHoliday ("14-OCT-2058", "COP"); - - lh.addStaticHoliday ("04-NOV-2058", "COP"); - - lh.addStaticHoliday ("11-NOV-2058", "COP"); - - lh.addStaticHoliday ("25-DEC-2058", "COP"); - - lh.addStaticHoliday ("01-JAN-2059", "COP"); - - lh.addStaticHoliday ("06-JAN-2059", "COP"); - - lh.addStaticHoliday ("24-MAR-2059", "COP"); - - lh.addStaticHoliday ("27-MAR-2059", "COP"); - - lh.addStaticHoliday ("28-MAR-2059", "COP"); - - lh.addStaticHoliday ("01-MAY-2059", "COP"); - - lh.addStaticHoliday ("12-MAY-2059", "COP"); - - lh.addStaticHoliday ("02-JUN-2059", "COP"); - - lh.addStaticHoliday ("09-JUN-2059", "COP"); - - lh.addStaticHoliday ("30-JUN-2059", "COP"); - - lh.addStaticHoliday ("07-AUG-2059", "COP"); - - lh.addStaticHoliday ("18-AUG-2059", "COP"); - - lh.addStaticHoliday ("13-OCT-2059", "COP"); - - lh.addStaticHoliday ("03-NOV-2059", "COP"); - - lh.addStaticHoliday ("17-NOV-2059", "COP"); - - lh.addStaticHoliday ("08-DEC-2059", "COP"); - - lh.addStaticHoliday ("25-DEC-2059", "COP"); - - lh.addStaticHoliday ("01-JAN-2060", "COP"); - - lh.addStaticHoliday ("12-JAN-2060", "COP"); - - lh.addStaticHoliday ("22-MAR-2060", "COP"); - - lh.addStaticHoliday ("15-APR-2060", "COP"); - - lh.addStaticHoliday ("16-APR-2060", "COP"); - - lh.addStaticHoliday ("31-MAY-2060", "COP"); - - lh.addStaticHoliday ("21-JUN-2060", "COP"); - - lh.addStaticHoliday ("28-JUN-2060", "COP"); - - lh.addStaticHoliday ("05-JUL-2060", "COP"); - - lh.addStaticHoliday ("20-JUL-2060", "COP"); - - lh.addStaticHoliday ("16-AUG-2060", "COP"); - - lh.addStaticHoliday ("18-OCT-2060", "COP"); - - lh.addStaticHoliday ("01-NOV-2060", "COP"); - - lh.addStaticHoliday ("15-NOV-2060", "COP"); - - lh.addStaticHoliday ("08-DEC-2060", "COP"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/CRCHoliday.java b/org/drip/analytics/holset/CRCHoliday.java deleted file mode 100644 index 63454d5..0000000 --- a/org/drip/analytics/holset/CRCHoliday.java +++ /dev/null @@ -1,711 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class CRCHoliday implements org.drip.analytics.holset.LocationHoliday { - public CRCHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "CRC"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("09-APR-1998", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labor Day"); - - lh.addStaticHoliday ("15-SEP-1998", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-1998", "Culture Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-1998", "National Holiday"); - - lh.addStaticHoliday ("30-DEC-1998", "National Holiday"); - - lh.addStaticHoliday ("31-DEC-1998", "National Holiday"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("02-AUG-1999", "Lady of the Angels Day"); - - lh.addStaticHoliday ("15-SEP-1999", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-1999", "Culture Day"); - - lh.addStaticHoliday ("29-DEC-1999", "National Holiday"); - - lh.addStaticHoliday ("30-DEC-1999", "National Holiday"); - - lh.addStaticHoliday ("31-DEC-1999", "National Holiday"); - - lh.addStaticHoliday ("11-APR-2000", "Heroes Day"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labor Day"); - - lh.addStaticHoliday ("25-JUL-2000", "Guanacaste Annexation Day"); - - lh.addStaticHoliday ("02-AUG-2000", "Lady of the Angels Day"); - - lh.addStaticHoliday ("15-AUG-2000", "Mothers Day"); - - lh.addStaticHoliday ("15-SEP-2000", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2000", "Culture Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2000", "National Holiday"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("11-APR-2001", "Heroes Day"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labor Day"); - - lh.addStaticHoliday ("25-JUL-2001", "Guanacaste Annexation Day"); - - lh.addStaticHoliday ("02-AUG-2001", "Lady of the Angels Day"); - - lh.addStaticHoliday ("15-AUG-2001", "Mothers Day"); - - lh.addStaticHoliday ("12-OCT-2001", "Culture Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2001", "National Holiday"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("11-APR-2002", "Heroes Day"); - - lh.addStaticHoliday ("01-MAY-2002", "Labor Day"); - - lh.addStaticHoliday ("25-JUL-2002", "Guanacaste Annexation Day"); - - lh.addStaticHoliday ("02-AUG-2002", "Lady of the Angels Day"); - - lh.addStaticHoliday ("15-AUG-2002", "Mothers Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2002", "National Holiday"); - - lh.addStaticHoliday ("31-DEC-2002", "National Holiday"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("11-APR-2003", "Heroes Day"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labor Day"); - - lh.addStaticHoliday ("25-JUL-2003", "Guanacaste Annexation Day"); - - lh.addStaticHoliday ("15-AUG-2003", "Mothers Day"); - - lh.addStaticHoliday ("15-SEP-2003", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2003", "National Holiday"); - - lh.addStaticHoliday ("30-DEC-2003", "National Holiday"); - - lh.addStaticHoliday ("31-DEC-2003", "National Holiday"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("02-AUG-2004", "Lady of the Angels Day"); - - lh.addStaticHoliday ("15-SEP-2004", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2004", "Culture Day"); - - lh.addStaticHoliday ("29-DEC-2004", "National Holiday"); - - lh.addStaticHoliday ("30-DEC-2004", "National Holiday"); - - lh.addStaticHoliday ("31-DEC-2004", "National Holiday"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("11-APR-2005", "Heroes Day"); - - lh.addStaticHoliday ("25-JUL-2005", "Guanacaste Annexation Day"); - - lh.addStaticHoliday ("02-AUG-2005", "Lady of the Angels Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Mothers Day"); - - lh.addStaticHoliday ("15-SEP-2005", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2005", "Culture Day"); - - lh.addStaticHoliday ("29-DEC-2005", "National Holiday"); - - lh.addStaticHoliday ("30-DEC-2005", "National Holiday"); - - lh.addStaticHoliday ("11-APR-2006", "Heroes Day"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labor Day"); - - lh.addStaticHoliday ("25-JUL-2006", "Guanacaste Annexation Day"); - - lh.addStaticHoliday ("02-AUG-2006", "Lady of the Angels Day"); - - lh.addStaticHoliday ("15-AUG-2006", "Mothers Day"); - - lh.addStaticHoliday ("15-SEP-2006", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2006", "Culture Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2006", "National Holiday"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("11-APR-2007", "Heroes Day"); - - lh.addStaticHoliday ("01-MAY-2007", "Labor Day"); - - lh.addStaticHoliday ("25-JUL-2007", "Guanacaste Annexation Day"); - - lh.addStaticHoliday ("02-AUG-2007", "Lady of the Angels Day"); - - lh.addStaticHoliday ("15-AUG-2007", "Mothers Day"); - - lh.addStaticHoliday ("12-OCT-2007", "Culture Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2007", "National Holiday"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("11-APR-2008", "Heroes Day"); - - lh.addStaticHoliday ("01-MAY-2008", "Labor Day"); - - lh.addStaticHoliday ("25-JUL-2008", "Guanacaste Annexation Day"); - - lh.addStaticHoliday ("15-AUG-2008", "Mothers Day"); - - lh.addStaticHoliday ("15-SEP-2008", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2008", "National Holiday"); - - lh.addStaticHoliday ("30-DEC-2008", "National Holiday"); - - lh.addStaticHoliday ("31-DEC-2008", "National Holiday"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labor Day"); - - lh.addStaticHoliday ("15-SEP-2009", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2009", "Culture Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2009", "National Holiday"); - - lh.addStaticHoliday ("30-DEC-2009", "National Holiday"); - - lh.addStaticHoliday ("31-DEC-2009", "National Holiday"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2010", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("02-AUG-2010", "Lady of the Angels Day"); - - lh.addStaticHoliday ("15-SEP-2010", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2010", "Culture Day"); - - lh.addStaticHoliday ("29-DEC-2010", "National Holiday"); - - lh.addStaticHoliday ("30-DEC-2010", "National Holiday"); - - lh.addStaticHoliday ("31-DEC-2010", "National Holiday"); - - lh.addStaticHoliday ("11-APR-2011", "Heroes Day"); - - lh.addStaticHoliday ("21-APR-2011", "Holy Thursday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-JUL-2011", "Guanacaste Annexation Day"); - - lh.addStaticHoliday ("02-AUG-2011", "Lady of the Angels Day"); - - lh.addStaticHoliday ("15-AUG-2011", "Mothers Day"); - - lh.addStaticHoliday ("15-SEP-2011", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2011", "Culture Day"); - - lh.addStaticHoliday ("29-DEC-2011", "National Holiday"); - - lh.addStaticHoliday ("30-DEC-2011", "National Holiday"); - - lh.addStaticHoliday ("05-APR-2012", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("11-APR-2012", "Heroes Day"); - - lh.addStaticHoliday ("01-MAY-2012", "Labor Day"); - - lh.addStaticHoliday ("25-JUL-2012", "Guanacaste Annexation Day"); - - lh.addStaticHoliday ("02-AUG-2012", "Lady of the Angels Day"); - - lh.addStaticHoliday ("15-AUG-2012", "Mothers Day"); - - lh.addStaticHoliday ("12-OCT-2012", "Culture Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2012", "National Holiday"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2013", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("11-APR-2013", "Heroes Day"); - - lh.addStaticHoliday ("01-MAY-2013", "Labor Day"); - - lh.addStaticHoliday ("25-JUL-2013", "Guanacaste Annexation Day"); - - lh.addStaticHoliday ("02-AUG-2013", "Lady of the Angels Day"); - - lh.addStaticHoliday ("15-AUG-2013", "Mothers Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2013", "National Holiday"); - - lh.addStaticHoliday ("31-DEC-2013", "National Holiday"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("11-APR-2014", "Heroes Day"); - - lh.addStaticHoliday ("17-APR-2014", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labor Day"); - - lh.addStaticHoliday ("25-JUL-2014", "Guanacaste Annexation Day"); - - lh.addStaticHoliday ("15-AUG-2014", "Mothers Day"); - - lh.addStaticHoliday ("15-SEP-2014", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2014", "National Holiday"); - - lh.addStaticHoliday ("30-DEC-2014", "National Holiday"); - - lh.addStaticHoliday ("31-DEC-2014", "National Holiday"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2015", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labor Day"); - - lh.addStaticHoliday ("15-SEP-2015", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2015", "Culture Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2015", "National Holiday"); - - lh.addStaticHoliday ("30-DEC-2015", "National Holiday"); - - lh.addStaticHoliday ("31-DEC-2015", "National Holiday"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2016", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("11-APR-2016", "Heroes Day"); - - lh.addStaticHoliday ("25-JUL-2016", "Guanacaste Annexation Day"); - - lh.addStaticHoliday ("02-AUG-2016", "Lady of the Angels Day"); - - lh.addStaticHoliday ("15-AUG-2016", "Mothers Day"); - - lh.addStaticHoliday ("15-SEP-2016", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2016", "Culture Day"); - - lh.addStaticHoliday ("29-DEC-2016", "National Holiday"); - - lh.addStaticHoliday ("30-DEC-2016", "National Holiday"); - - lh.addStaticHoliday ("11-APR-2017", "Heroes Day"); - - lh.addStaticHoliday ("13-APR-2017", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labor Day"); - - lh.addStaticHoliday ("25-JUL-2017", "Guanacaste Annexation Day"); - - lh.addStaticHoliday ("02-AUG-2017", "Lady of the Angels Day"); - - lh.addStaticHoliday ("15-AUG-2017", "Mothers Day"); - - lh.addStaticHoliday ("15-SEP-2017", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2017", "Culture Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2017", "National Holiday"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2018", "Holy Thursday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("11-APR-2018", "Heroes Day"); - - lh.addStaticHoliday ("01-MAY-2018", "Labor Day"); - - lh.addStaticHoliday ("25-JUL-2018", "Guanacaste Annexation Day"); - - lh.addStaticHoliday ("02-AUG-2018", "Lady of the Angels Day"); - - lh.addStaticHoliday ("15-AUG-2018", "Mothers Day"); - - lh.addStaticHoliday ("12-OCT-2018", "Culture Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2018", "National Holiday"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("11-APR-2019", "Heroes Day"); - - lh.addStaticHoliday ("18-APR-2019", "Holy Thursday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labor Day"); - - lh.addStaticHoliday ("25-JUL-2019", "Guanacaste Annexation Day"); - - lh.addStaticHoliday ("02-AUG-2019", "Lady of the Angels Day"); - - lh.addStaticHoliday ("15-AUG-2019", "Mothers Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2019", "National Holiday"); - - lh.addStaticHoliday ("31-DEC-2019", "National Holiday"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2020", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labor Day"); - - lh.addStaticHoliday ("15-SEP-2020", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2020", "Culture Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2020", "National Holiday"); - - lh.addStaticHoliday ("30-DEC-2020", "National Holiday"); - - lh.addStaticHoliday ("31-DEC-2020", "National Holiday"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2021", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("02-AUG-2021", "Lady of the Angels Day"); - - lh.addStaticHoliday ("15-SEP-2021", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2021", "Culture Day"); - - lh.addStaticHoliday ("29-DEC-2021", "National Holiday"); - - lh.addStaticHoliday ("30-DEC-2021", "National Holiday"); - - lh.addStaticHoliday ("31-DEC-2021", "National Holiday"); - - lh.addStaticHoliday ("11-APR-2022", "Heroes Day"); - - lh.addStaticHoliday ("14-APR-2022", "Holy Thursday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("25-JUL-2022", "Guanacaste Annexation Day"); - - lh.addStaticHoliday ("02-AUG-2022", "Lady of the Angels Day"); - - lh.addStaticHoliday ("15-AUG-2022", "Mothers Day"); - - lh.addStaticHoliday ("15-SEP-2022", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2022", "Culture Day"); - - lh.addStaticHoliday ("29-DEC-2022", "National Holiday"); - - lh.addStaticHoliday ("30-DEC-2022", "National Holiday"); - - lh.addStaticHoliday ("06-APR-2023", "Holy Thursday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("11-APR-2023", "Heroes Day"); - - lh.addStaticHoliday ("01-MAY-2023", "Labor Day"); - - lh.addStaticHoliday ("25-JUL-2023", "Guanacaste Annexation Day"); - - lh.addStaticHoliday ("02-AUG-2023", "Lady of the Angels Day"); - - lh.addStaticHoliday ("15-AUG-2023", "Mothers Day"); - - lh.addStaticHoliday ("15-SEP-2023", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2023", "Culture Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2023", "National Holiday"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2024", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("11-APR-2024", "Heroes Day"); - - lh.addStaticHoliday ("01-MAY-2024", "Labor Day"); - - lh.addStaticHoliday ("25-JUL-2024", "Guanacaste Annexation Day"); - - lh.addStaticHoliday ("02-AUG-2024", "Lady of the Angels Day"); - - lh.addStaticHoliday ("15-AUG-2024", "Mothers Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2024", "National Holiday"); - - lh.addStaticHoliday ("31-DEC-2024", "National Holiday"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("11-APR-2025", "Heroes Day"); - - lh.addStaticHoliday ("17-APR-2025", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labor Day"); - - lh.addStaticHoliday ("25-JUL-2025", "Guanacaste Annexation Day"); - - lh.addStaticHoliday ("15-AUG-2025", "Mothers Day"); - - lh.addStaticHoliday ("15-SEP-2025", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2025", "National Holiday"); - - lh.addStaticHoliday ("30-DEC-2025", "National Holiday"); - - lh.addStaticHoliday ("31-DEC-2025", "National Holiday"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2026", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labor Day"); - - lh.addStaticHoliday ("15-SEP-2026", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2026", "Culture Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2026", "National Holiday"); - - lh.addStaticHoliday ("30-DEC-2026", "National Holiday"); - - lh.addStaticHoliday ("31-DEC-2026", "National Holiday"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("25-MAR-2027", "Holy Thursday"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("02-AUG-2027", "Lady of the Angels Day"); - - lh.addStaticHoliday ("15-SEP-2027", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2027", "Culture Day"); - - lh.addStaticHoliday ("29-DEC-2027", "National Holiday"); - - lh.addStaticHoliday ("30-DEC-2027", "National Holiday"); - - lh.addStaticHoliday ("31-DEC-2027", "National Holiday"); - - lh.addStaticHoliday ("11-APR-2028", "Heroes Day"); - - lh.addStaticHoliday ("13-APR-2028", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labor Day"); - - lh.addStaticHoliday ("25-JUL-2028", "Guanacaste Annexation Day"); - - lh.addStaticHoliday ("02-AUG-2028", "Lady of the Angels Day"); - - lh.addStaticHoliday ("15-AUG-2028", "Mothers Day"); - - lh.addStaticHoliday ("15-SEP-2028", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2028", "Culture Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2028", "National Holiday"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/CYPHoliday.java b/org/drip/analytics/holset/CYPHoliday.java deleted file mode 100644 index 6f54066..0000000 --- a/org/drip/analytics/holset/CYPHoliday.java +++ /dev/null @@ -1,805 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class CYPHoliday implements org.drip.analytics.holset.LocationHoliday { - public CYPHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "CYP"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1998", "Epiphany"); - - lh.addStaticHoliday ("02-MAR-1998", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-1998", "Greek Independence Day"); - - lh.addStaticHoliday ("01-APR-1998", "Cyprus National Day"); - - lh.addStaticHoliday ("17-APR-1998", "Orthodox Good Friday"); - - lh.addStaticHoliday ("20-APR-1998", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("21-APR-1998", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("01-MAY-1998", "Workers Day"); - - lh.addStaticHoliday ("08-JUN-1998", "Whit Monday"); - - lh.addStaticHoliday ("01-OCT-1998", "Cyprus Independence Day"); - - lh.addStaticHoliday ("28-OCT-1998", "Greek National Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1999", "Epiphany"); - - lh.addStaticHoliday ("22-FEB-1999", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-1999", "Greek Independence Day"); - - lh.addStaticHoliday ("01-APR-1999", "Cyprus National Day"); - - lh.addStaticHoliday ("09-APR-1999", "Orthodox Good Friday"); - - lh.addStaticHoliday ("12-APR-1999", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("13-APR-1999", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("31-MAY-1999", "Whit Monday"); - - lh.addStaticHoliday ("01-OCT-1999", "Cyprus Independence Day"); - - lh.addStaticHoliday ("28-OCT-1999", "Greek National Day"); - - lh.addStaticHoliday ("06-JAN-2000", "Epiphany"); - - lh.addStaticHoliday ("13-MAR-2000", "Monday in Lent"); - - lh.addStaticHoliday ("28-APR-2000", "Orthodox Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Workers Day"); - - lh.addStaticHoliday ("02-MAY-2000", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("19-JUN-2000", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2000", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("26-FEB-2001", "Monday in Lent"); - - lh.addStaticHoliday ("13-APR-2001", "Orthodox Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("17-APR-2001", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("01-MAY-2001", "Workers Day"); - - lh.addStaticHoliday ("04-JUN-2001", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2001", "Assumption Day"); - - lh.addStaticHoliday ("01-OCT-2001", "Cyprus Independence Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("18-MAR-2002", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2002", "Greek Independence Day"); - - lh.addStaticHoliday ("01-APR-2002", "Cyprus National Day"); - - lh.addStaticHoliday ("01-MAY-2002", "Workers Day"); - - lh.addStaticHoliday ("03-MAY-2002", "Orthodox Good Friday"); - - lh.addStaticHoliday ("06-MAY-2002", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("07-MAY-2002", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("24-JUN-2002", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2002", "Assumption Day"); - - lh.addStaticHoliday ("01-OCT-2002", "Cyprus Independence Day"); - - lh.addStaticHoliday ("28-OCT-2002", "Greek National Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2003", "Epiphany"); - - lh.addStaticHoliday ("10-MAR-2003", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2003", "Greek Independence Day"); - - lh.addStaticHoliday ("01-APR-2003", "Cyprus National Day"); - - lh.addStaticHoliday ("25-APR-2003", "Orthodox Good Friday"); - - lh.addStaticHoliday ("28-APR-2003", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("29-APR-2003", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("01-MAY-2003", "Workers Day"); - - lh.addStaticHoliday ("16-JUN-2003", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2003", "Assumption Day"); - - lh.addStaticHoliday ("01-OCT-2003", "Cyprus Independence Day"); - - lh.addStaticHoliday ("28-OCT-2003", "Greek National Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2004", "Epiphany"); - - lh.addStaticHoliday ("23-FEB-2004", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2004", "Greek Independence Day"); - - lh.addStaticHoliday ("01-APR-2004", "Cyprus National Day"); - - lh.addStaticHoliday ("09-APR-2004", "Orthodox Good Friday"); - - lh.addStaticHoliday ("12-APR-2004", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("13-APR-2004", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("31-MAY-2004", "Whit Monday"); - - lh.addStaticHoliday ("01-OCT-2004", "Cyprus Independence Day"); - - lh.addStaticHoliday ("28-OCT-2004", "Greek National Day"); - - lh.addStaticHoliday ("06-JAN-2005", "Epiphany"); - - lh.addStaticHoliday ("14-MAR-2005", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2005", "Greek Independence Day"); - - lh.addStaticHoliday ("01-APR-2005", "Cyprus National Day"); - - lh.addStaticHoliday ("29-APR-2005", "Orthodox Good Friday"); - - lh.addStaticHoliday ("02-MAY-2005", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2005", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("20-JUN-2005", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("28-OCT-2005", "Greek National Day"); - - lh.addStaticHoliday ("26-DEC-2005", "Boxing Day"); - - lh.addStaticHoliday ("06-JAN-2006", "Epiphany"); - - lh.addStaticHoliday ("06-MAR-2006", "Monday in Lent"); - - lh.addStaticHoliday ("21-APR-2006", "Orthodox Good Friday"); - - lh.addStaticHoliday ("24-APR-2006", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("25-APR-2006", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("01-MAY-2006", "Workers Day"); - - lh.addStaticHoliday ("12-JUN-2006", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2006", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("19-FEB-2007", "Monday in Lent"); - - lh.addStaticHoliday ("06-APR-2007", "Orthodox Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("10-APR-2007", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("01-MAY-2007", "Workers Day"); - - lh.addStaticHoliday ("28-MAY-2007", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2007", "Assumption Day"); - - lh.addStaticHoliday ("01-OCT-2007", "Cyprus Independence Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("10-MAR-2008", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2008", "Greek Independence Day"); - - lh.addStaticHoliday ("01-APR-2008", "Cyprus National Day"); - - lh.addStaticHoliday ("25-APR-2008", "Orthodox Good Friday"); - - lh.addStaticHoliday ("28-APR-2008", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("29-APR-2008", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("01-MAY-2008", "Workers Day"); - - lh.addStaticHoliday ("16-JUN-2008", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2008", "Assumption Day"); - - lh.addStaticHoliday ("01-OCT-2008", "Cyprus Independence Day"); - - lh.addStaticHoliday ("28-OCT-2008", "Greek National Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2009", "Epiphany"); - - lh.addStaticHoliday ("02-MAR-2009", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2009", "Greek Independence Day"); - - lh.addStaticHoliday ("01-APR-2009", "Cyprus National Day"); - - lh.addStaticHoliday ("17-APR-2009", "Orthodox Good Friday"); - - lh.addStaticHoliday ("20-APR-2009", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("21-APR-2009", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("01-MAY-2009", "Workers Day"); - - lh.addStaticHoliday ("08-JUN-2009", "Whit Monday"); - - lh.addStaticHoliday ("01-OCT-2009", "Cyprus Independence Day"); - - lh.addStaticHoliday ("28-OCT-2009", "Greek National Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2010", "Epiphany"); - - lh.addStaticHoliday ("15-FEB-2010", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2010", "Greek Independence Day"); - - lh.addStaticHoliday ("01-APR-2010", "Cyprus National Day"); - - lh.addStaticHoliday ("02-APR-2010", "Orthodox Good Friday"); - - lh.addStaticHoliday ("05-APR-2010", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("06-APR-2010", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("24-MAY-2010", "Whit Monday"); - - lh.addStaticHoliday ("01-OCT-2010", "Cyprus Independence Day"); - - lh.addStaticHoliday ("28-OCT-2010", "Greek National Day"); - - lh.addStaticHoliday ("06-JAN-2011", "Epiphany"); - - lh.addStaticHoliday ("07-MAR-2011", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2011", "Greek Independence Day"); - - lh.addStaticHoliday ("01-APR-2011", "Cyprus National Day"); - - lh.addStaticHoliday ("22-APR-2011", "Orthodox Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("26-APR-2011", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("13-JUN-2011", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2011", "Assumption Day"); - - lh.addStaticHoliday ("28-OCT-2011", "Greek National Day"); - - lh.addStaticHoliday ("26-DEC-2011", "Boxing Day"); - - lh.addStaticHoliday ("06-JAN-2012", "Epiphany"); - - lh.addStaticHoliday ("27-FEB-2012", "Monday in Lent"); - - lh.addStaticHoliday ("13-APR-2012", "Orthodox Good Friday"); - - lh.addStaticHoliday ("16-APR-2012", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("17-APR-2012", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("01-MAY-2012", "Workers Day"); - - lh.addStaticHoliday ("04-JUN-2012", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2012", "Assumption Day"); - - lh.addStaticHoliday ("01-OCT-2012", "Cyprus Independence Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("18-MAR-2013", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2013", "Greek Independence Day"); - - lh.addStaticHoliday ("01-APR-2013", "Cyprus National Day"); - - lh.addStaticHoliday ("01-MAY-2013", "Workers Day"); - - lh.addStaticHoliday ("03-MAY-2013", "Orthodox Good Friday"); - - lh.addStaticHoliday ("06-MAY-2013", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("07-MAY-2013", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("24-JUN-2013", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2013", "Assumption Day"); - - lh.addStaticHoliday ("01-OCT-2013", "Cyprus Independence Day"); - - lh.addStaticHoliday ("28-OCT-2013", "Greek National Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2014", "Epiphany"); - - lh.addStaticHoliday ("03-MAR-2014", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2014", "Greek Independence Day"); - - lh.addStaticHoliday ("01-APR-2014", "Cyprus National Day"); - - lh.addStaticHoliday ("18-APR-2014", "Orthodox Good Friday"); - - lh.addStaticHoliday ("21-APR-2014", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("22-APR-2014", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("01-MAY-2014", "Workers Day"); - - lh.addStaticHoliday ("09-JUN-2014", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2014", "Assumption Day"); - - lh.addStaticHoliday ("01-OCT-2014", "Cyprus Independence Day"); - - lh.addStaticHoliday ("28-OCT-2014", "Greek National Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2015", "Epiphany"); - - lh.addStaticHoliday ("23-FEB-2015", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2015", "Greek Independence Day"); - - lh.addStaticHoliday ("01-APR-2015", "Cyprus National Day"); - - lh.addStaticHoliday ("10-APR-2015", "Orthodox Good Friday"); - - lh.addStaticHoliday ("13-APR-2015", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("14-APR-2015", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("01-MAY-2015", "Workers Day"); - - lh.addStaticHoliday ("01-JUN-2015", "Whit Monday"); - - lh.addStaticHoliday ("01-OCT-2015", "Cyprus Independence Day"); - - lh.addStaticHoliday ("28-OCT-2015", "Greek National Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2016", "Epiphany"); - - lh.addStaticHoliday ("14-MAR-2016", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2016", "Greek Independence Day"); - - lh.addStaticHoliday ("01-APR-2016", "Cyprus National Day"); - - lh.addStaticHoliday ("29-APR-2016", "Orthodox Good Friday"); - - lh.addStaticHoliday ("02-MAY-2016", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2016", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("20-JUN-2016", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2016", "Assumption Day"); - - lh.addStaticHoliday ("28-OCT-2016", "Greek National Day"); - - lh.addStaticHoliday ("26-DEC-2016", "Boxing Day"); - - lh.addStaticHoliday ("06-JAN-2017", "Epiphany"); - - lh.addStaticHoliday ("27-FEB-2017", "Monday in Lent"); - - lh.addStaticHoliday ("14-APR-2017", "Orthodox Good Friday"); - - lh.addStaticHoliday ("17-APR-2017", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("18-APR-2017", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("01-MAY-2017", "Workers Day"); - - lh.addStaticHoliday ("05-JUN-2017", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2017", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("19-FEB-2018", "Monday in Lent"); - - lh.addStaticHoliday ("06-APR-2018", "Orthodox Good Friday"); - - lh.addStaticHoliday ("09-APR-2018", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("10-APR-2018", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("01-MAY-2018", "Workers Day"); - - lh.addStaticHoliday ("28-MAY-2018", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2018", "Assumption Day"); - - lh.addStaticHoliday ("01-OCT-2018", "Cyprus Independence Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("11-MAR-2019", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2019", "Greek Independence Day"); - - lh.addStaticHoliday ("01-APR-2019", "Cyprus National Day"); - - lh.addStaticHoliday ("26-APR-2019", "Orthodox Good Friday"); - - lh.addStaticHoliday ("29-APR-2019", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("30-APR-2019", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("01-MAY-2019", "Workers Day"); - - lh.addStaticHoliday ("17-JUN-2019", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2019", "Assumption Day"); - - lh.addStaticHoliday ("01-OCT-2019", "Cyprus Independence Day"); - - lh.addStaticHoliday ("28-OCT-2019", "Greek National Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2020", "Epiphany"); - - lh.addStaticHoliday ("02-MAR-2020", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2020", "Greek Independence Day"); - - lh.addStaticHoliday ("01-APR-2020", "Cyprus National Day"); - - lh.addStaticHoliday ("17-APR-2020", "Orthodox Good Friday"); - - lh.addStaticHoliday ("20-APR-2020", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("21-APR-2020", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("01-MAY-2020", "Workers Day"); - - lh.addStaticHoliday ("08-JUN-2020", "Whit Monday"); - - lh.addStaticHoliday ("01-OCT-2020", "Cyprus Independence Day"); - - lh.addStaticHoliday ("28-OCT-2020", "Greek National Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2021", "Epiphany"); - - lh.addStaticHoliday ("15-MAR-2021", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2021", "Greek Independence Day"); - - lh.addStaticHoliday ("01-APR-2021", "Cyprus National Day"); - - lh.addStaticHoliday ("30-APR-2021", "Orthodox Good Friday"); - - lh.addStaticHoliday ("03-MAY-2021", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("04-MAY-2021", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("21-JUN-2021", "Whit Monday"); - - lh.addStaticHoliday ("01-OCT-2021", "Cyprus Independence Day"); - - lh.addStaticHoliday ("28-OCT-2021", "Greek National Day"); - - lh.addStaticHoliday ("06-JAN-2022", "Epiphany"); - - lh.addStaticHoliday ("07-MAR-2022", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2022", "Greek Independence Day"); - - lh.addStaticHoliday ("01-APR-2022", "Cyprus National Day"); - - lh.addStaticHoliday ("22-APR-2022", "Orthodox Good Friday"); - - lh.addStaticHoliday ("25-APR-2022", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("26-APR-2022", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("13-JUN-2022", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2022", "Assumption Day"); - - lh.addStaticHoliday ("28-OCT-2022", "Greek National Day"); - - lh.addStaticHoliday ("26-DEC-2022", "Boxing Day"); - - lh.addStaticHoliday ("06-JAN-2023", "Epiphany"); - - lh.addStaticHoliday ("27-FEB-2023", "Monday in Lent"); - - lh.addStaticHoliday ("14-APR-2023", "Orthodox Good Friday"); - - lh.addStaticHoliday ("17-APR-2023", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("18-APR-2023", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("01-MAY-2023", "Workers Day"); - - lh.addStaticHoliday ("05-JUN-2023", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2023", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("18-MAR-2024", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2024", "Greek Independence Day"); - - lh.addStaticHoliday ("01-APR-2024", "Cyprus National Day"); - - lh.addStaticHoliday ("01-MAY-2024", "Workers Day"); - - lh.addStaticHoliday ("03-MAY-2024", "Orthodox Good Friday"); - - lh.addStaticHoliday ("06-MAY-2024", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("07-MAY-2024", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("24-JUN-2024", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2024", "Assumption Day"); - - lh.addStaticHoliday ("01-OCT-2024", "Cyprus Independence Day"); - - lh.addStaticHoliday ("28-OCT-2024", "Greek National Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2025", "Epiphany"); - - lh.addStaticHoliday ("03-MAR-2025", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2025", "Greek Independence Day"); - - lh.addStaticHoliday ("01-APR-2025", "Cyprus National Day"); - - lh.addStaticHoliday ("18-APR-2025", "Orthodox Good Friday"); - - lh.addStaticHoliday ("21-APR-2025", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("22-APR-2025", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("01-MAY-2025", "Workers Day"); - - lh.addStaticHoliday ("09-JUN-2025", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2025", "Assumption Day"); - - lh.addStaticHoliday ("01-OCT-2025", "Cyprus Independence Day"); - - lh.addStaticHoliday ("28-OCT-2025", "Greek National Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2026", "Epiphany"); - - lh.addStaticHoliday ("23-FEB-2026", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2026", "Greek Independence Day"); - - lh.addStaticHoliday ("01-APR-2026", "Cyprus National Day"); - - lh.addStaticHoliday ("10-APR-2026", "Orthodox Good Friday"); - - lh.addStaticHoliday ("13-APR-2026", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("14-APR-2026", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("01-MAY-2026", "Workers Day"); - - lh.addStaticHoliday ("01-JUN-2026", "Whit Monday"); - - lh.addStaticHoliday ("01-OCT-2026", "Cyprus Independence Day"); - - lh.addStaticHoliday ("28-OCT-2026", "Greek National Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2027", "Epiphany"); - - lh.addStaticHoliday ("15-MAR-2027", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2027", "Greek Independence Day"); - - lh.addStaticHoliday ("01-APR-2027", "Cyprus National Day"); - - lh.addStaticHoliday ("30-APR-2027", "Orthodox Good Friday"); - - lh.addStaticHoliday ("03-MAY-2027", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("04-MAY-2027", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("21-JUN-2027", "Whit Monday"); - - lh.addStaticHoliday ("01-OCT-2027", "Cyprus Independence Day"); - - lh.addStaticHoliday ("28-OCT-2027", "Greek National Day"); - - lh.addStaticHoliday ("06-JAN-2028", "Epiphany"); - - lh.addStaticHoliday ("28-FEB-2028", "Monday in Lent"); - - lh.addStaticHoliday ("14-APR-2028", "Orthodox Good Friday"); - - lh.addStaticHoliday ("17-APR-2028", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("18-APR-2028", "Orthodox Easter Tuesday"); - - lh.addStaticHoliday ("01-MAY-2028", "Workers Day"); - - lh.addStaticHoliday ("05-JUN-2028", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2028", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Boxing Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/CZKHoliday.java b/org/drip/analytics/holset/CZKHoliday.java deleted file mode 100644 index e7aa9b5..0000000 --- a/org/drip/analytics/holset/CZKHoliday.java +++ /dev/null @@ -1,517 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class CZKHoliday implements org.drip.analytics.holset.LocationHoliday { - public CZKHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "CZK"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-1998", "Victoria Day"); - - lh.addStaticHoliday ("06-JUL-1998", "Jan Hus Day"); - - lh.addStaticHoliday ("28-OCT-1998", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-1998", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("05-JUL-1999", "Day of Cyril and Metodej"); - - lh.addStaticHoliday ("06-JUL-1999", "Jan Hus Day"); - - lh.addStaticHoliday ("28-OCT-1999", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-1999", "Christmas Eve"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2000", "Victoria Day"); - - lh.addStaticHoliday ("05-JUL-2000", "Day of Cyril and Metodej"); - - lh.addStaticHoliday ("06-JUL-2000", "Jan Hus Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2001", "Victoria Day"); - - lh.addStaticHoliday ("05-JUL-2001", "Day of Cyril and Metodej"); - - lh.addStaticHoliday ("06-JUL-2001", "Jan Hus Day"); - - lh.addStaticHoliday ("24-DEC-2001", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2002", "Victoria Day"); - - lh.addStaticHoliday ("05-JUL-2002", "Day of Cyril and Metodej"); - - lh.addStaticHoliday ("28-OCT-2002", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2002", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2003", "Victoria Day"); - - lh.addStaticHoliday ("28-OCT-2003", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2003", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("05-JUL-2004", "Day of Cyril and Metodej"); - - lh.addStaticHoliday ("06-JUL-2004", "Jan Hus Day"); - - lh.addStaticHoliday ("28-OCT-2004", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2004", "Christmas Eve"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("05-JUL-2005", "Day of Cyril and Metodej"); - - lh.addStaticHoliday ("06-JUL-2005", "Jan Hus Day"); - - lh.addStaticHoliday ("28-OCT-2005", "Independence Day"); - - lh.addStaticHoliday ("26-DEC-2005", "St. Stephens Day"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2006", "Victoria Day"); - - lh.addStaticHoliday ("05-JUL-2006", "Day of Cyril and Metodej"); - - lh.addStaticHoliday ("06-JUL-2006", "Jan Hus Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2007", "Victoria Day"); - - lh.addStaticHoliday ("05-JUL-2007", "Day of Cyril and Metodej"); - - lh.addStaticHoliday ("06-JUL-2007", "Jan Hus Day"); - - lh.addStaticHoliday ("24-DEC-2007", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2008", "Victoria Day"); - - lh.addStaticHoliday ("28-OCT-2008", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2008", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2009", "Victoria Day"); - - lh.addStaticHoliday ("06-JUL-2009", "Jan Hus Day"); - - lh.addStaticHoliday ("28-OCT-2009", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2009", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("05-JUL-2010", "Day of Cyril and Metodej"); - - lh.addStaticHoliday ("06-JUL-2010", "Jan Hus Day"); - - lh.addStaticHoliday ("28-OCT-2010", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2010", "Christmas Eve"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("05-JUL-2011", "Day of Cyril and Metodej"); - - lh.addStaticHoliday ("06-JUL-2011", "Jan Hus Day"); - - lh.addStaticHoliday ("28-OCT-2011", "Independence Day"); - - lh.addStaticHoliday ("26-DEC-2011", "St. Stephens Day"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2012", "Victoria Day"); - - lh.addStaticHoliday ("05-JUL-2012", "Day of Cyril and Metodej"); - - lh.addStaticHoliday ("06-JUL-2012", "Jan Hus Day"); - - lh.addStaticHoliday ("24-DEC-2012", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2013", "Victoria Day"); - - lh.addStaticHoliday ("05-JUL-2013", "Day of Cyril and Metodej"); - - lh.addStaticHoliday ("28-OCT-2013", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2013", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2014", "Victoria Day"); - - lh.addStaticHoliday ("28-OCT-2014", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2014", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2015", "Victoria Day"); - - lh.addStaticHoliday ("06-JUL-2015", "Jan Hus Day"); - - lh.addStaticHoliday ("28-OCT-2015", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2015", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("05-JUL-2016", "Day of Cyril and Metodej"); - - lh.addStaticHoliday ("06-JUL-2016", "Jan Hus Day"); - - lh.addStaticHoliday ("28-OCT-2016", "Independence Day"); - - lh.addStaticHoliday ("26-DEC-2016", "St. Stephens Day"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2017", "Victoria Day"); - - lh.addStaticHoliday ("05-JUL-2017", "Day of Cyril and Metodej"); - - lh.addStaticHoliday ("06-JUL-2017", "Jan Hus Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2018", "Victoria Day"); - - lh.addStaticHoliday ("05-JUL-2018", "Day of Cyril and Metodej"); - - lh.addStaticHoliday ("06-JUL-2018", "Jan Hus Day"); - - lh.addStaticHoliday ("24-DEC-2018", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2019", "Victoria Day"); - - lh.addStaticHoliday ("05-JUL-2019", "Day of Cyril and Metodej"); - - lh.addStaticHoliday ("28-OCT-2019", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2019", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2020", "Victoria Day"); - - lh.addStaticHoliday ("06-JUL-2020", "Jan Hus Day"); - - lh.addStaticHoliday ("28-OCT-2020", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2020", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("05-JUL-2021", "Day of Cyril and Metodej"); - - lh.addStaticHoliday ("06-JUL-2021", "Jan Hus Day"); - - lh.addStaticHoliday ("28-OCT-2021", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2021", "Christmas Eve"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("05-JUL-2022", "Day of Cyril and Metodej"); - - lh.addStaticHoliday ("06-JUL-2022", "Jan Hus Day"); - - lh.addStaticHoliday ("28-OCT-2022", "Independence Day"); - - lh.addStaticHoliday ("26-DEC-2022", "St. Stephens Day"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2023", "Victoria Day"); - - lh.addStaticHoliday ("05-JUL-2023", "Day of Cyril and Metodej"); - - lh.addStaticHoliday ("06-JUL-2023", "Jan Hus Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2024", "Victoria Day"); - - lh.addStaticHoliday ("05-JUL-2024", "Day of Cyril and Metodej"); - - lh.addStaticHoliday ("28-OCT-2024", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2024", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2025", "Victoria Day"); - - lh.addStaticHoliday ("28-OCT-2025", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2025", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2026", "Victoria Day"); - - lh.addStaticHoliday ("06-JUL-2026", "Jan Hus Day"); - - lh.addStaticHoliday ("28-OCT-2026", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2026", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("05-JUL-2027", "Day of Cyril and Metodej"); - - lh.addStaticHoliday ("06-JUL-2027", "Jan Hus Day"); - - lh.addStaticHoliday ("28-OCT-2027", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2027", "Christmas Eve"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2028", "Victoria Day"); - - lh.addStaticHoliday ("05-JUL-2028", "Day of Cyril and Metodej"); - - lh.addStaticHoliday ("06-JUL-2028", "Jan Hus Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "St. Stephens Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/DEMHoliday.java b/org/drip/analytics/holset/DEMHoliday.java deleted file mode 100644 index 11eb38c..0000000 --- a/org/drip/analytics/holset/DEMHoliday.java +++ /dev/null @@ -1,777 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class DEMHoliday implements org.drip.analytics.holset.LocationHoliday { - public DEMHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "DEM"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("23-FEB-1998", "Shrove Monday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-1998", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-1998", "Whit Monday"); - - lh.addStaticHoliday ("11-JUN-1998", "Corpus Christi"); - - lh.addStaticHoliday ("24-DEC-1998", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-1998", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("15-FEB-1999", "Shrove Monday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-1999", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-1999", "Whit Monday"); - - lh.addStaticHoliday ("03-JUN-1999", "Corpus Christi"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-1999", "Christmas Eve"); - - lh.addStaticHoliday ("31-DEC-1999", "New Years Eve"); - - lh.addStaticHoliday ("06-MAR-2000", "Shrove Monday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("01-JUN-2000", "Ascension Day"); - - lh.addStaticHoliday ("12-JUN-2000", "Whit Monday"); - - lh.addStaticHoliday ("22-JUN-2000", "Corpus Christi"); - - lh.addStaticHoliday ("03-OCT-2000", "Day of Unity"); - - lh.addStaticHoliday ("01-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("26-FEB-2001", "Shrove Monday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2001", "Ascension Day"); - - lh.addStaticHoliday ("04-JUN-2001", "Whit Monday"); - - lh.addStaticHoliday ("14-JUN-2001", "Corpus Christi"); - - lh.addStaticHoliday ("03-OCT-2001", "Day of Unity"); - - lh.addStaticHoliday ("01-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2001", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "St. Stephens Day"); - - lh.addStaticHoliday ("31-DEC-2001", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2002", "Shrove Monday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2002", "Ascension Day"); - - lh.addStaticHoliday ("20-MAY-2002", "Whit Monday"); - - lh.addStaticHoliday ("30-MAY-2002", "Corpus Christi"); - - lh.addStaticHoliday ("03-OCT-2002", "Day of Unity"); - - lh.addStaticHoliday ("01-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2002", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "St. Stephens Day"); - - lh.addStaticHoliday ("31-DEC-2002", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2003", "Shrove Monday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2003", "Ascension Day"); - - lh.addStaticHoliday ("09-JUN-2003", "Whit Monday"); - - lh.addStaticHoliday ("19-JUN-2003", "Corpus Christi"); - - lh.addStaticHoliday ("03-OCT-2003", "Day of Unity"); - - lh.addStaticHoliday ("24-DEC-2003", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "St. Stephens Day"); - - lh.addStaticHoliday ("31-DEC-2003", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("23-FEB-2004", "Shrove Monday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("20-MAY-2004", "Ascension Day"); - - lh.addStaticHoliday ("31-MAY-2004", "Whit Monday"); - - lh.addStaticHoliday ("10-JUN-2004", "Corpus Christi"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2004", "Christmas Eve"); - - lh.addStaticHoliday ("31-DEC-2004", "New Years Eve"); - - lh.addStaticHoliday ("07-FEB-2005", "Shrove Monday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2005", "Ascension Day"); - - lh.addStaticHoliday ("16-MAY-2005", "Whit Monday"); - - lh.addStaticHoliday ("26-MAY-2005", "Corpus Christi"); - - lh.addStaticHoliday ("03-OCT-2005", "Day of Unity"); - - lh.addStaticHoliday ("01-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("26-DEC-2005", "St. Stephens Day"); - - lh.addStaticHoliday ("27-FEB-2006", "Shrove Monday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2006", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2006", "Whit Monday"); - - lh.addStaticHoliday ("15-JUN-2006", "Corpus Christi"); - - lh.addStaticHoliday ("03-OCT-2006", "Day of Unity"); - - lh.addStaticHoliday ("01-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("19-FEB-2007", "Shrove Monday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2007", "Ascension Day"); - - lh.addStaticHoliday ("28-MAY-2007", "Whit Monday"); - - lh.addStaticHoliday ("07-JUN-2007", "Corpus Christi"); - - lh.addStaticHoliday ("03-OCT-2007", "Day of Unity"); - - lh.addStaticHoliday ("01-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2007", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "St. Stephens Day"); - - lh.addStaticHoliday ("31-DEC-2007", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("04-FEB-2008", "Shrove Monday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("12-MAY-2008", "Whit Monday"); - - lh.addStaticHoliday ("22-MAY-2008", "Corpus Christi"); - - lh.addStaticHoliday ("03-OCT-2008", "Day of Unity"); - - lh.addStaticHoliday ("24-DEC-2008", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "St. Stephens Day"); - - lh.addStaticHoliday ("31-DEC-2008", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("23-FEB-2009", "Shrove Monday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2009", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-2009", "Whit Monday"); - - lh.addStaticHoliday ("11-JUN-2009", "Corpus Christi"); - - lh.addStaticHoliday ("24-DEC-2009", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2009", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("15-FEB-2010", "Shrove Monday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-2010", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-2010", "Whit Monday"); - - lh.addStaticHoliday ("03-JUN-2010", "Corpus Christi"); - - lh.addStaticHoliday ("01-NOV-2010", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2010", "Christmas Eve"); - - lh.addStaticHoliday ("31-DEC-2010", "New Years Eve"); - - lh.addStaticHoliday ("07-MAR-2011", "Shrove Monday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("02-JUN-2011", "Ascension Day"); - - lh.addStaticHoliday ("13-JUN-2011", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2011", "Corpus Christi"); - - lh.addStaticHoliday ("03-OCT-2011", "Day of Unity"); - - lh.addStaticHoliday ("01-NOV-2011", "All Saints Day"); - - lh.addStaticHoliday ("26-DEC-2011", "St. Stephens Day"); - - lh.addStaticHoliday ("20-FEB-2012", "Shrove Monday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2012", "Ascension Day"); - - lh.addStaticHoliday ("28-MAY-2012", "Whit Monday"); - - lh.addStaticHoliday ("07-JUN-2012", "Corpus Christi"); - - lh.addStaticHoliday ("03-OCT-2012", "Day of Unity"); - - lh.addStaticHoliday ("01-NOV-2012", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2012", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "St. Stephens Day"); - - lh.addStaticHoliday ("31-DEC-2012", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2013", "Shrove Monday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2013", "Ascension Day"); - - lh.addStaticHoliday ("20-MAY-2013", "Whit Monday"); - - lh.addStaticHoliday ("30-MAY-2013", "Corpus Christi"); - - lh.addStaticHoliday ("03-OCT-2013", "Day of Unity"); - - lh.addStaticHoliday ("01-NOV-2013", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2013", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "St. Stephens Day"); - - lh.addStaticHoliday ("31-DEC-2013", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2014", "Shrove Monday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2014", "Ascension Day"); - - lh.addStaticHoliday ("09-JUN-2014", "Whit Monday"); - - lh.addStaticHoliday ("19-JUN-2014", "Corpus Christi"); - - lh.addStaticHoliday ("03-OCT-2014", "Day of Unity"); - - lh.addStaticHoliday ("24-DEC-2014", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "St. Stephens Day"); - - lh.addStaticHoliday ("31-DEC-2014", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2015", "Shrove Monday"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("14-MAY-2015", "Ascension Day"); - - lh.addStaticHoliday ("25-MAY-2015", "Whit Monday"); - - lh.addStaticHoliday ("04-JUN-2015", "Corpus Christi"); - - lh.addStaticHoliday ("24-DEC-2015", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2015", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2016", "Shrove Monday"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2016", "Ascension Day"); - - lh.addStaticHoliday ("16-MAY-2016", "Whit Monday"); - - lh.addStaticHoliday ("26-MAY-2016", "Corpus Christi"); - - lh.addStaticHoliday ("03-OCT-2016", "Day of Unity"); - - lh.addStaticHoliday ("01-NOV-2016", "All Saints Day"); - - lh.addStaticHoliday ("26-DEC-2016", "St. Stephens Day"); - - lh.addStaticHoliday ("27-FEB-2017", "Shrove Monday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2017", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2017", "Whit Monday"); - - lh.addStaticHoliday ("15-JUN-2017", "Corpus Christi"); - - lh.addStaticHoliday ("03-OCT-2017", "Day of Unity"); - - lh.addStaticHoliday ("01-NOV-2017", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("12-FEB-2018", "Shrove Monday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("10-MAY-2018", "Ascension Day"); - - lh.addStaticHoliday ("21-MAY-2018", "Whit Monday"); - - lh.addStaticHoliday ("31-MAY-2018", "Corpus Christi"); - - lh.addStaticHoliday ("03-OCT-2018", "Day of Unity"); - - lh.addStaticHoliday ("01-NOV-2018", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2018", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "St. Stephens Day"); - - lh.addStaticHoliday ("31-DEC-2018", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("04-MAR-2019", "Shrove Monday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2019", "Ascension Day"); - - lh.addStaticHoliday ("10-JUN-2019", "Whit Monday"); - - lh.addStaticHoliday ("20-JUN-2019", "Corpus Christi"); - - lh.addStaticHoliday ("03-OCT-2019", "Day of Unity"); - - lh.addStaticHoliday ("01-NOV-2019", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2019", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "St. Stephens Day"); - - lh.addStaticHoliday ("31-DEC-2019", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("24-FEB-2020", "Shrove Monday"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2020", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-2020", "Whit Monday"); - - lh.addStaticHoliday ("11-JUN-2020", "Corpus Christi"); - - lh.addStaticHoliday ("24-DEC-2020", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2020", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("15-FEB-2021", "Shrove Monday"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-2021", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-2021", "Whit Monday"); - - lh.addStaticHoliday ("03-JUN-2021", "Corpus Christi"); - - lh.addStaticHoliday ("01-NOV-2021", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2021", "Christmas Eve"); - - lh.addStaticHoliday ("31-DEC-2021", "New Years Eve"); - - lh.addStaticHoliday ("28-FEB-2022", "Shrove Monday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("26-MAY-2022", "Ascension Day"); - - lh.addStaticHoliday ("06-JUN-2022", "Whit Monday"); - - lh.addStaticHoliday ("16-JUN-2022", "Corpus Christi"); - - lh.addStaticHoliday ("03-OCT-2022", "Day of Unity"); - - lh.addStaticHoliday ("01-NOV-2022", "All Saints Day"); - - lh.addStaticHoliday ("26-DEC-2022", "St. Stephens Day"); - - lh.addStaticHoliday ("20-FEB-2023", "Shrove Monday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("18-MAY-2023", "Ascension Day"); - - lh.addStaticHoliday ("29-MAY-2023", "Whit Monday"); - - lh.addStaticHoliday ("08-JUN-2023", "Corpus Christi"); - - lh.addStaticHoliday ("03-OCT-2023", "Day of Unity"); - - lh.addStaticHoliday ("01-NOV-2023", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("12-FEB-2024", "Shrove Monday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2024", "Ascension Day"); - - lh.addStaticHoliday ("20-MAY-2024", "Whit Monday"); - - lh.addStaticHoliday ("30-MAY-2024", "Corpus Christi"); - - lh.addStaticHoliday ("03-OCT-2024", "Day of Unity"); - - lh.addStaticHoliday ("01-NOV-2024", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2024", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "St. Stephens Day"); - - lh.addStaticHoliday ("31-DEC-2024", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2025", "Shrove Monday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2025", "Ascension Day"); - - lh.addStaticHoliday ("09-JUN-2025", "Whit Monday"); - - lh.addStaticHoliday ("19-JUN-2025", "Corpus Christi"); - - lh.addStaticHoliday ("03-OCT-2025", "Day of Unity"); - - lh.addStaticHoliday ("24-DEC-2025", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "St. Stephens Day"); - - lh.addStaticHoliday ("31-DEC-2025", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2026", "Shrove Monday"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("14-MAY-2026", "Ascension Day"); - - lh.addStaticHoliday ("25-MAY-2026", "Whit Monday"); - - lh.addStaticHoliday ("04-JUN-2026", "Corpus Christi"); - - lh.addStaticHoliday ("24-DEC-2026", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2026", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2027", "Shrove Monday"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("06-MAY-2027", "Ascension Day"); - - lh.addStaticHoliday ("17-MAY-2027", "Whit Monday"); - - lh.addStaticHoliday ("27-MAY-2027", "Corpus Christi"); - - lh.addStaticHoliday ("01-NOV-2027", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2027", "Christmas Eve"); - - lh.addStaticHoliday ("31-DEC-2027", "New Years Eve"); - - lh.addStaticHoliday ("28-FEB-2028", "Shrove Monday"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2028", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2028", "Whit Monday"); - - lh.addStaticHoliday ("15-JUN-2028", "Corpus Christi"); - - lh.addStaticHoliday ("03-OCT-2028", "Day of Unity"); - - lh.addStaticHoliday ("01-NOV-2028", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "St. Stephens Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/DKKHoliday.java b/org/drip/analytics/holset/DKKHoliday.java deleted file mode 100644 index 4e4a506..0000000 --- a/org/drip/analytics/holset/DKKHoliday.java +++ /dev/null @@ -1,643 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class DKKHoliday implements org.drip.analytics.holset.LocationHoliday { - public DKKHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "DKK"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("09-APR-1998", "Maundy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("08-MAY-1998", "General Prayer Day"); - - lh.addStaticHoliday ("21-MAY-1998", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-1998", "Whit Monday"); - - lh.addStaticHoliday ("05-JUN-1998", "Constitution Day"); - - lh.addStaticHoliday ("24-DEC-1998", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("01-APR-1999", "Maundy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-1999", "General Prayer Day"); - - lh.addStaticHoliday ("13-MAY-1999", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-1999", "Whit Monday"); - - lh.addStaticHoliday ("24-DEC-1999", "Christmas Eve"); - - lh.addStaticHoliday ("20-APR-2000", "Maundy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("19-MAY-2000", "General Prayer Day"); - - lh.addStaticHoliday ("01-JUN-2000", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2000", "Constitution Day"); - - lh.addStaticHoliday ("12-JUN-2000", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("12-APR-2001", "Maundy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("11-MAY-2001", "General Prayer Day"); - - lh.addStaticHoliday ("24-MAY-2001", "Ascension Day"); - - lh.addStaticHoliday ("04-JUN-2001", "Whit Monday"); - - lh.addStaticHoliday ("05-JUN-2001", "Constitution Day"); - - lh.addStaticHoliday ("24-DEC-2001", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2002", "Maundy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("26-APR-2002", "General Prayer Day"); - - lh.addStaticHoliday ("09-MAY-2002", "Ascension Day"); - - lh.addStaticHoliday ("20-MAY-2002", "Whit Monday"); - - lh.addStaticHoliday ("05-JUN-2002", "Constitution Day"); - - lh.addStaticHoliday ("24-DEC-2002", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("17-APR-2003", "Maundy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("16-MAY-2003", "General Prayer Day"); - - lh.addStaticHoliday ("29-MAY-2003", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2003", "Constitution Day"); - - lh.addStaticHoliday ("09-JUN-2003", "Whit Monday"); - - lh.addStaticHoliday ("24-DEC-2003", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("08-APR-2004", "Maundy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("07-MAY-2004", "General Prayer Day"); - - lh.addStaticHoliday ("20-MAY-2004", "Ascension Day"); - - lh.addStaticHoliday ("31-MAY-2004", "Whit Monday"); - - lh.addStaticHoliday ("24-DEC-2004", "Christmas Eve"); - - lh.addStaticHoliday ("24-MAR-2005", "Maundy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("22-APR-2005", "General Prayer Day"); - - lh.addStaticHoliday ("05-MAY-2005", "Ascension Day"); - - lh.addStaticHoliday ("16-MAY-2005", "Whit Monday"); - - lh.addStaticHoliday ("26-DEC-2005", "Boxing Day"); - - lh.addStaticHoliday ("13-APR-2006", "Maundy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("12-MAY-2006", "General Prayer Day"); - - lh.addStaticHoliday ("25-MAY-2006", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2006", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("05-APR-2007", "Maundy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("04-MAY-2007", "General Prayer Day"); - - lh.addStaticHoliday ("17-MAY-2007", "Ascension Day"); - - lh.addStaticHoliday ("28-MAY-2007", "Whit Monday"); - - lh.addStaticHoliday ("05-JUN-2007", "Constitution Day"); - - lh.addStaticHoliday ("24-DEC-2007", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("20-MAR-2008", "Maundy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("18-APR-2008", "General Prayer Day"); - - lh.addStaticHoliday ("01-MAY-2008", "Ascension Day"); - - lh.addStaticHoliday ("12-MAY-2008", "Whit Monday"); - - lh.addStaticHoliday ("05-JUN-2008", "Constitution Day"); - - lh.addStaticHoliday ("24-DEC-2008", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2009", "Maundy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("08-MAY-2009", "General Prayer Day"); - - lh.addStaticHoliday ("21-MAY-2009", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-2009", "Whit Monday"); - - lh.addStaticHoliday ("05-JUN-2009", "Constitution Day"); - - lh.addStaticHoliday ("24-DEC-2009", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2010", "Maundy Thursday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2010", "General Prayer Day"); - - lh.addStaticHoliday ("13-MAY-2010", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-2010", "Whit Monday"); - - lh.addStaticHoliday ("24-DEC-2010", "Christmas Eve"); - - lh.addStaticHoliday ("21-APR-2011", "Maundy Thursday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("20-MAY-2011", "General Prayer Day"); - - lh.addStaticHoliday ("02-JUN-2011", "Ascension Day"); - - lh.addStaticHoliday ("13-JUN-2011", "Whit Monday"); - - lh.addStaticHoliday ("26-DEC-2011", "Boxing Day"); - - lh.addStaticHoliday ("05-APR-2012", "Maundy Thursday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("04-MAY-2012", "General Prayer Day"); - - lh.addStaticHoliday ("17-MAY-2012", "Ascension Day"); - - lh.addStaticHoliday ("28-MAY-2012", "Whit Monday"); - - lh.addStaticHoliday ("05-JUN-2012", "Constitution Day"); - - lh.addStaticHoliday ("24-DEC-2012", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2013", "Maundy Thursday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("26-APR-2013", "General Prayer Day"); - - lh.addStaticHoliday ("09-MAY-2013", "Ascension Day"); - - lh.addStaticHoliday ("20-MAY-2013", "Whit Monday"); - - lh.addStaticHoliday ("05-JUN-2013", "Constitution Day"); - - lh.addStaticHoliday ("24-DEC-2013", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("17-APR-2014", "Maundy Thursday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("16-MAY-2014", "General Prayer Day"); - - lh.addStaticHoliday ("29-MAY-2014", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2014", "Constitution Day"); - - lh.addStaticHoliday ("09-JUN-2014", "Whit Monday"); - - lh.addStaticHoliday ("24-DEC-2014", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2015", "Maundy Thursday"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2015", "General Prayer Day"); - - lh.addStaticHoliday ("14-MAY-2015", "Ascension Day"); - - lh.addStaticHoliday ("25-MAY-2015", "Whit Monday"); - - lh.addStaticHoliday ("05-JUN-2015", "Constitution Day"); - - lh.addStaticHoliday ("24-DEC-2015", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2016", "Maundy Thursday"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("22-APR-2016", "General Prayer Day"); - - lh.addStaticHoliday ("05-MAY-2016", "Ascension Day"); - - lh.addStaticHoliday ("16-MAY-2016", "Whit Monday"); - - lh.addStaticHoliday ("26-DEC-2016", "Boxing Day"); - - lh.addStaticHoliday ("13-APR-2017", "Maundy Thursday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("12-MAY-2017", "General Prayer Day"); - - lh.addStaticHoliday ("25-MAY-2017", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2017", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2018", "Maundy Thursday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-2018", "General Prayer Day"); - - lh.addStaticHoliday ("10-MAY-2018", "Ascension Day"); - - lh.addStaticHoliday ("21-MAY-2018", "Whit Monday"); - - lh.addStaticHoliday ("05-JUN-2018", "Constitution Day"); - - lh.addStaticHoliday ("24-DEC-2018", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2019", "Maundy Thursday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("17-MAY-2019", "General Prayer Day"); - - lh.addStaticHoliday ("30-MAY-2019", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2019", "Constitution Day"); - - lh.addStaticHoliday ("10-JUN-2019", "Whit Monday"); - - lh.addStaticHoliday ("24-DEC-2019", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2020", "Maundy Thursday"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("08-MAY-2020", "General Prayer Day"); - - lh.addStaticHoliday ("21-MAY-2020", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-2020", "Whit Monday"); - - lh.addStaticHoliday ("05-JUN-2020", "Constitution Day"); - - lh.addStaticHoliday ("24-DEC-2020", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2021", "Maundy Thursday"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2021", "General Prayer Day"); - - lh.addStaticHoliday ("13-MAY-2021", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-2021", "Whit Monday"); - - lh.addStaticHoliday ("24-DEC-2021", "Christmas Eve"); - - lh.addStaticHoliday ("14-APR-2022", "Maundy Thursday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-2022", "General Prayer Day"); - - lh.addStaticHoliday ("26-MAY-2022", "Ascension Day"); - - lh.addStaticHoliday ("06-JUN-2022", "Whit Monday"); - - lh.addStaticHoliday ("26-DEC-2022", "Boxing Day"); - - lh.addStaticHoliday ("06-APR-2023", "Maundy Thursday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2023", "General Prayer Day"); - - lh.addStaticHoliday ("18-MAY-2023", "Ascension Day"); - - lh.addStaticHoliday ("29-MAY-2023", "Whit Monday"); - - lh.addStaticHoliday ("05-JUN-2023", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2024", "Maundy Thursday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("26-APR-2024", "General Prayer Day"); - - lh.addStaticHoliday ("09-MAY-2024", "Ascension Day"); - - lh.addStaticHoliday ("20-MAY-2024", "Whit Monday"); - - lh.addStaticHoliday ("05-JUN-2024", "Constitution Day"); - - lh.addStaticHoliday ("24-DEC-2024", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("17-APR-2025", "Maundy Thursday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("16-MAY-2025", "General Prayer Day"); - - lh.addStaticHoliday ("29-MAY-2025", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2025", "Constitution Day"); - - lh.addStaticHoliday ("09-JUN-2025", "Whit Monday"); - - lh.addStaticHoliday ("24-DEC-2025", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2026", "Maundy Thursday"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2026", "General Prayer Day"); - - lh.addStaticHoliday ("14-MAY-2026", "Ascension Day"); - - lh.addStaticHoliday ("25-MAY-2026", "Whit Monday"); - - lh.addStaticHoliday ("05-JUN-2026", "Constitution Day"); - - lh.addStaticHoliday ("24-DEC-2026", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("25-MAR-2027", "Maundy Thursday"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("23-APR-2027", "General Prayer Day"); - - lh.addStaticHoliday ("06-MAY-2027", "Ascension Day"); - - lh.addStaticHoliday ("17-MAY-2027", "Whit Monday"); - - lh.addStaticHoliday ("24-DEC-2027", "Christmas Eve"); - - lh.addStaticHoliday ("13-APR-2028", "Maundy Thursday"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("12-MAY-2028", "General Prayer Day"); - - lh.addStaticHoliday ("25-MAY-2028", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2028", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Boxing Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/DOPHoliday.java b/org/drip/analytics/holset/DOPHoliday.java deleted file mode 100644 index cbcca25..0000000 --- a/org/drip/analytics/holset/DOPHoliday.java +++ /dev/null @@ -1,649 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class DOPHoliday implements org.drip.analytics.holset.LocationHoliday { - public DOPHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "DOP"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1998", "Epiphany"); - - lh.addStaticHoliday ("21-JAN-1998", "Our Lady of Altagracia Day"); - - lh.addStaticHoliday ("26-JAN-1998", "Duartes Day"); - - lh.addStaticHoliday ("27-FEB-1998", "Independence Day"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labor Day"); - - lh.addStaticHoliday ("11-JUN-1998", "Corpus Christi"); - - lh.addStaticHoliday ("24-SEP-1998", "Our Lady of Mercedes Day"); - - lh.addStaticHoliday ("06-NOV-1998", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1999", "Epiphany"); - - lh.addStaticHoliday ("21-JAN-1999", "Our Lady of Altagracia Day"); - - lh.addStaticHoliday ("26-JAN-1999", "Duartes Day"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("03-JUN-1999", "Corpus Christi"); - - lh.addStaticHoliday ("16-AUG-1999", "Restoration Day"); - - lh.addStaticHoliday ("24-SEP-1999", "Our Lady of Mercedes Day"); - - lh.addStaticHoliday ("06-JAN-2000", "Epiphany"); - - lh.addStaticHoliday ("21-JAN-2000", "Our Lady of Altagracia Day"); - - lh.addStaticHoliday ("26-JAN-2000", "Duartes Day"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labor Day"); - - lh.addStaticHoliday ("16-MAY-2000", "Election Day"); - - lh.addStaticHoliday ("22-JUN-2000", "Corpus Christi"); - - lh.addStaticHoliday ("16-AUG-2000", "Restoration Day"); - - lh.addStaticHoliday ("06-NOV-2000", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2001", "Duartes Day"); - - lh.addStaticHoliday ("27-FEB-2001", "Independence Day"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labor Day"); - - lh.addStaticHoliday ("14-JUN-2001", "Corpus Christi"); - - lh.addStaticHoliday ("16-AUG-2001", "Restoration Day"); - - lh.addStaticHoliday ("24-SEP-2001", "Our Lady of Mercedes Day"); - - lh.addStaticHoliday ("06-NOV-2001", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2002", "Our Lady of Altagracia Day"); - - lh.addStaticHoliday ("27-FEB-2002", "Independence Day"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labor Day"); - - lh.addStaticHoliday ("16-MAY-2002", "Election Day"); - - lh.addStaticHoliday ("30-MAY-2002", "Corpus Christi"); - - lh.addStaticHoliday ("16-AUG-2002", "Restoration Day"); - - lh.addStaticHoliday ("24-SEP-2002", "Our Lady of Mercedes Day"); - - lh.addStaticHoliday ("06-NOV-2002", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2003", "Epiphany"); - - lh.addStaticHoliday ("21-JAN-2003", "Our Lady of Altagracia Day"); - - lh.addStaticHoliday ("27-FEB-2003", "Independence Day"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labor Day"); - - lh.addStaticHoliday ("19-JUN-2003", "Corpus Christi"); - - lh.addStaticHoliday ("24-SEP-2003", "Our Lady of Mercedes Day"); - - lh.addStaticHoliday ("06-NOV-2003", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2004", "Epiphany"); - - lh.addStaticHoliday ("21-JAN-2004", "Our Lady of Altagracia Day"); - - lh.addStaticHoliday ("26-JAN-2004", "Duartes Day"); - - lh.addStaticHoliday ("27-FEB-2004", "Independence Day"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("10-JUN-2004", "Corpus Christi"); - - lh.addStaticHoliday ("16-AUG-2004", "Restoration Day"); - - lh.addStaticHoliday ("24-SEP-2004", "Our Lady of Mercedes Day"); - - lh.addStaticHoliday ("06-JAN-2005", "Epiphany"); - - lh.addStaticHoliday ("21-JAN-2005", "Our Lady of Altagracia Day"); - - lh.addStaticHoliday ("26-JAN-2005", "Duartes Day"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("26-MAY-2005", "Corpus Christi"); - - lh.addStaticHoliday ("16-AUG-2005", "Restoration Day"); - - lh.addStaticHoliday ("06-JAN-2006", "Epiphany"); - - lh.addStaticHoliday ("26-JAN-2006", "Duartes Day"); - - lh.addStaticHoliday ("27-FEB-2006", "Independence Day"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labor Day"); - - lh.addStaticHoliday ("16-MAY-2006", "Election Day"); - - lh.addStaticHoliday ("15-JUN-2006", "Corpus Christi"); - - lh.addStaticHoliday ("16-AUG-2006", "Restoration Day"); - - lh.addStaticHoliday ("06-NOV-2006", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2007", "Duartes Day"); - - lh.addStaticHoliday ("27-FEB-2007", "Independence Day"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labor Day"); - - lh.addStaticHoliday ("07-JUN-2007", "Corpus Christi"); - - lh.addStaticHoliday ("16-AUG-2007", "Restoration Day"); - - lh.addStaticHoliday ("24-SEP-2007", "Our Lady of Mercedes Day"); - - lh.addStaticHoliday ("06-NOV-2007", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2008", "Our Lady of Altagracia Day"); - - lh.addStaticHoliday ("27-FEB-2008", "Independence Day"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labor Day"); - - lh.addStaticHoliday ("16-MAY-2008", "Election Day"); - - lh.addStaticHoliday ("22-MAY-2008", "Corpus Christi"); - - lh.addStaticHoliday ("24-SEP-2008", "Our Lady of Mercedes Day"); - - lh.addStaticHoliday ("06-NOV-2008", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2009", "Epiphany"); - - lh.addStaticHoliday ("21-JAN-2009", "Our Lady of Altagracia Day"); - - lh.addStaticHoliday ("26-JAN-2009", "Duartes Day"); - - lh.addStaticHoliday ("27-FEB-2009", "Independence Day"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labor Day"); - - lh.addStaticHoliday ("11-JUN-2009", "Corpus Christi"); - - lh.addStaticHoliday ("24-SEP-2009", "Our Lady of Mercedes Day"); - - lh.addStaticHoliday ("06-NOV-2009", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2010", "Epiphany"); - - lh.addStaticHoliday ("21-JAN-2010", "Our Lady of Altagracia Day"); - - lh.addStaticHoliday ("26-JAN-2010", "Duartes Day"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("03-JUN-2010", "Corpus Christi"); - - lh.addStaticHoliday ("16-AUG-2010", "Restoration Day"); - - lh.addStaticHoliday ("24-SEP-2010", "Our Lady of Mercedes Day"); - - lh.addStaticHoliday ("06-JAN-2011", "Epiphany"); - - lh.addStaticHoliday ("21-JAN-2011", "Our Lady of Altagracia Day"); - - lh.addStaticHoliday ("26-JAN-2011", "Duartes Day"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("23-JUN-2011", "Corpus Christi"); - - lh.addStaticHoliday ("16-AUG-2011", "Restoration Day"); - - lh.addStaticHoliday ("06-JAN-2012", "Epiphany"); - - lh.addStaticHoliday ("26-JAN-2012", "Duartes Day"); - - lh.addStaticHoliday ("27-FEB-2012", "Independence Day"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labor Day"); - - lh.addStaticHoliday ("16-MAY-2012", "Election Day"); - - lh.addStaticHoliday ("07-JUN-2012", "Corpus Christi"); - - lh.addStaticHoliday ("16-AUG-2012", "Restoration Day"); - - lh.addStaticHoliday ("24-SEP-2012", "Our Lady of Mercedes Day"); - - lh.addStaticHoliday ("06-NOV-2012", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2013", "Our Lady of Altagracia Day"); - - lh.addStaticHoliday ("27-FEB-2013", "Independence Day"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labor Day"); - - lh.addStaticHoliday ("30-MAY-2013", "Corpus Christi"); - - lh.addStaticHoliday ("16-AUG-2013", "Restoration Day"); - - lh.addStaticHoliday ("24-SEP-2013", "Our Lady of Mercedes Day"); - - lh.addStaticHoliday ("06-NOV-2013", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2014", "Epiphany"); - - lh.addStaticHoliday ("21-JAN-2014", "Our Lady of Altagracia Day"); - - lh.addStaticHoliday ("27-FEB-2014", "Independence Day"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labor Day"); - - lh.addStaticHoliday ("16-MAY-2014", "Election Day"); - - lh.addStaticHoliday ("19-JUN-2014", "Corpus Christi"); - - lh.addStaticHoliday ("24-SEP-2014", "Our Lady of Mercedes Day"); - - lh.addStaticHoliday ("06-NOV-2014", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2015", "Epiphany"); - - lh.addStaticHoliday ("21-JAN-2015", "Our Lady of Altagracia Day"); - - lh.addStaticHoliday ("26-JAN-2015", "Duartes Day"); - - lh.addStaticHoliday ("27-FEB-2015", "Independence Day"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labor Day"); - - lh.addStaticHoliday ("04-JUN-2015", "Corpus Christi"); - - lh.addStaticHoliday ("24-SEP-2015", "Our Lady of Mercedes Day"); - - lh.addStaticHoliday ("06-NOV-2015", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2016", "Epiphany"); - - lh.addStaticHoliday ("21-JAN-2016", "Our Lady of Altagracia Day"); - - lh.addStaticHoliday ("26-JAN-2016", "Duartes Day"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("16-MAY-2016", "Election Day"); - - lh.addStaticHoliday ("26-MAY-2016", "Corpus Christi"); - - lh.addStaticHoliday ("16-AUG-2016", "Restoration Day"); - - lh.addStaticHoliday ("06-JAN-2017", "Epiphany"); - - lh.addStaticHoliday ("26-JAN-2017", "Duartes Day"); - - lh.addStaticHoliday ("27-FEB-2017", "Independence Day"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labor Day"); - - lh.addStaticHoliday ("15-JUN-2017", "Corpus Christi"); - - lh.addStaticHoliday ("16-AUG-2017", "Restoration Day"); - - lh.addStaticHoliday ("06-NOV-2017", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2018", "Duartes Day"); - - lh.addStaticHoliday ("27-FEB-2018", "Independence Day"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labor Day"); - - lh.addStaticHoliday ("16-MAY-2018", "Election Day"); - - lh.addStaticHoliday ("31-MAY-2018", "Corpus Christi"); - - lh.addStaticHoliday ("16-AUG-2018", "Restoration Day"); - - lh.addStaticHoliday ("24-SEP-2018", "Our Lady of Mercedes Day"); - - lh.addStaticHoliday ("06-NOV-2018", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2019", "Our Lady of Altagracia Day"); - - lh.addStaticHoliday ("27-FEB-2019", "Independence Day"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labor Day"); - - lh.addStaticHoliday ("20-JUN-2019", "Corpus Christi"); - - lh.addStaticHoliday ("16-AUG-2019", "Restoration Day"); - - lh.addStaticHoliday ("24-SEP-2019", "Our Lady of Mercedes Day"); - - lh.addStaticHoliday ("06-NOV-2019", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2020", "Epiphany"); - - lh.addStaticHoliday ("21-JAN-2020", "Our Lady of Altagracia Day"); - - lh.addStaticHoliday ("27-FEB-2020", "Independence Day"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labor Day"); - - lh.addStaticHoliday ("11-JUN-2020", "Corpus Christi"); - - lh.addStaticHoliday ("24-SEP-2020", "Our Lady of Mercedes Day"); - - lh.addStaticHoliday ("06-NOV-2020", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2021", "Epiphany"); - - lh.addStaticHoliday ("21-JAN-2021", "Our Lady of Altagracia Day"); - - lh.addStaticHoliday ("26-JAN-2021", "Duartes Day"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("03-JUN-2021", "Corpus Christi"); - - lh.addStaticHoliday ("16-AUG-2021", "Restoration Day"); - - lh.addStaticHoliday ("24-SEP-2021", "Our Lady of Mercedes Day"); - - lh.addStaticHoliday ("06-JAN-2022", "Epiphany"); - - lh.addStaticHoliday ("21-JAN-2022", "Our Lady of Altagracia Day"); - - lh.addStaticHoliday ("26-JAN-2022", "Duartes Day"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("16-MAY-2022", "Election Day"); - - lh.addStaticHoliday ("16-JUN-2022", "Corpus Christi"); - - lh.addStaticHoliday ("16-AUG-2022", "Restoration Day"); - - lh.addStaticHoliday ("06-JAN-2023", "Epiphany"); - - lh.addStaticHoliday ("26-JAN-2023", "Duartes Day"); - - lh.addStaticHoliday ("27-FEB-2023", "Independence Day"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labor Day"); - - lh.addStaticHoliday ("08-JUN-2023", "Corpus Christi"); - - lh.addStaticHoliday ("16-AUG-2023", "Restoration Day"); - - lh.addStaticHoliday ("06-NOV-2023", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2024", "Duartes Day"); - - lh.addStaticHoliday ("27-FEB-2024", "Independence Day"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labor Day"); - - lh.addStaticHoliday ("16-MAY-2024", "Election Day"); - - lh.addStaticHoliday ("30-MAY-2024", "Corpus Christi"); - - lh.addStaticHoliday ("16-AUG-2024", "Restoration Day"); - - lh.addStaticHoliday ("24-SEP-2024", "Our Lady of Mercedes Day"); - - lh.addStaticHoliday ("06-NOV-2024", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2025", "Epiphany"); - - lh.addStaticHoliday ("21-JAN-2025", "Our Lady of Altagracia Day"); - - lh.addStaticHoliday ("27-FEB-2025", "Independence Day"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labor Day"); - - lh.addStaticHoliday ("19-JUN-2025", "Corpus Christi"); - - lh.addStaticHoliday ("24-SEP-2025", "Our Lady of Mercedes Day"); - - lh.addStaticHoliday ("06-NOV-2025", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2026", "Epiphany"); - - lh.addStaticHoliday ("21-JAN-2026", "Our Lady of Altagracia Day"); - - lh.addStaticHoliday ("26-JAN-2026", "Duartes Day"); - - lh.addStaticHoliday ("27-FEB-2026", "Independence Day"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labor Day"); - - lh.addStaticHoliday ("04-JUN-2026", "Corpus Christi"); - - lh.addStaticHoliday ("24-SEP-2026", "Our Lady of Mercedes Day"); - - lh.addStaticHoliday ("06-NOV-2026", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2027", "Epiphany"); - - lh.addStaticHoliday ("21-JAN-2027", "Our Lady of Altagracia Day"); - - lh.addStaticHoliday ("26-JAN-2027", "Duartes Day"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("27-MAY-2027", "Corpus Christi"); - - lh.addStaticHoliday ("16-AUG-2027", "Restoration Day"); - - lh.addStaticHoliday ("24-SEP-2027", "Our Lady of Mercedes Day"); - - lh.addStaticHoliday ("06-JAN-2028", "Epiphany"); - - lh.addStaticHoliday ("21-JAN-2028", "Our Lady of Altagracia Day"); - - lh.addStaticHoliday ("26-JAN-2028", "Duartes Day"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labor Day"); - - lh.addStaticHoliday ("16-MAY-2028", "Election Day"); - - lh.addStaticHoliday ("15-JUN-2028", "Corpus Christi"); - - lh.addStaticHoliday ("16-AUG-2028", "Restoration Day"); - - lh.addStaticHoliday ("06-NOV-2028", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/DTFHoliday.java b/org/drip/analytics/holset/DTFHoliday.java deleted file mode 100644 index a9dee8f..0000000 --- a/org/drip/analytics/holset/DTFHoliday.java +++ /dev/null @@ -1,1063 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class DTFHoliday implements org.drip.analytics.holset.LocationHoliday { - public DTFHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "DTF"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-1998", "Epiphany"); - - lh.addStaticHoliday ("23-MAR-1998", "St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-1998", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labor Day"); - - lh.addStaticHoliday ("25-MAY-1998", "Ascension Day Observed"); - - lh.addStaticHoliday ("15-JUN-1998", "Corpus Christi Observed"); - - lh.addStaticHoliday ("22-JUN-1998", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("29-JUN-1998", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-1998", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-1998", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-1998", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-1998", "Columbus Day"); - - lh.addStaticHoliday ("02-NOV-1998", "All Saints Day"); - - lh.addStaticHoliday ("16-NOV-1998", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-1998", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-1999", "Epiphany"); - - lh.addStaticHoliday ("22-MAR-1999", "St. Josephs Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("17-MAY-1999", "Ascension Day Observed"); - - lh.addStaticHoliday ("07-JUN-1999", "Corpus Christi Observed"); - - lh.addStaticHoliday ("14-JUN-1999", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("05-JUL-1999", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-1999", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-1999", "Assumption Day"); - - lh.addStaticHoliday ("18-OCT-1999", "Columbus Day"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("15-NOV-1999", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-1999", "Immaculate Conception"); - - lh.addStaticHoliday ("10-JAN-2000", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2000", "St. Josephs Day"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labor Day"); - - lh.addStaticHoliday ("05-JUN-2000", "Ascension Day Observed"); - - lh.addStaticHoliday ("26-JUN-2000", "Corpus Christi Observed"); - - lh.addStaticHoliday ("03-JUL-2000", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2000", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2000", "National Holiday"); - - lh.addStaticHoliday ("21-AUG-2000", "Assumption Day"); - - lh.addStaticHoliday ("16-OCT-2000", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2000", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2000", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2001", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2001", "St. Josephs Day"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labor Day"); - - lh.addStaticHoliday ("28-MAY-2001", "Ascension Day Observed"); - - lh.addStaticHoliday ("18-JUN-2001", "Corpus Christi Observed"); - - lh.addStaticHoliday ("25-JUN-2001", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("02-JUL-2001", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2001", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2001", "National Holiday"); - - lh.addStaticHoliday ("20-AUG-2001", "Assumption Day"); - - lh.addStaticHoliday ("15-OCT-2001", "Columbus Day"); - - lh.addStaticHoliday ("05-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("12-NOV-2001", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2002", "Epiphany"); - - lh.addStaticHoliday ("25-MAR-2002", "St. Josephs Day"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labor Day"); - - lh.addStaticHoliday ("13-MAY-2002", "Ascension Day Observed"); - - lh.addStaticHoliday ("03-JUN-2002", "Corpus Christi Observed"); - - lh.addStaticHoliday ("10-JUN-2002", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("01-JUL-2002", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2002", "National Holiday"); - - lh.addStaticHoliday ("19-AUG-2002", "Assumption Day"); - - lh.addStaticHoliday ("14-OCT-2002", "Columbus Day"); - - lh.addStaticHoliday ("04-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2002", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2003", "Epiphany"); - - lh.addStaticHoliday ("24-MAR-2003", "St. Josephs Day"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labor Day"); - - lh.addStaticHoliday ("02-JUN-2003", "Ascension Day Observed"); - - lh.addStaticHoliday ("23-JUN-2003", "Corpus Christi Observed"); - - lh.addStaticHoliday ("30-JUN-2003", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2003", "National Holiday"); - - lh.addStaticHoliday ("18-AUG-2003", "Assumption Day"); - - lh.addStaticHoliday ("13-OCT-2003", "Columbus Day"); - - lh.addStaticHoliday ("03-NOV-2003", "All Saints Day"); - - lh.addStaticHoliday ("17-NOV-2003", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2004", "Epiphany"); - - lh.addStaticHoliday ("22-MAR-2004", "St. Josephs Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2004", "Ascension Day Observed"); - - lh.addStaticHoliday ("14-JUN-2004", "Corpus Christi Observed"); - - lh.addStaticHoliday ("21-JUN-2004", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("05-JUL-2004", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2004", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2004", "Assumption Day"); - - lh.addStaticHoliday ("18-OCT-2004", "Columbus Day"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("15-NOV-2004", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2004", "Immaculate Conception"); - - lh.addStaticHoliday ("10-JAN-2005", "Epiphany"); - - lh.addStaticHoliday ("21-MAR-2005", "St. Josephs Day"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("09-MAY-2005", "Ascension Day Observed"); - - lh.addStaticHoliday ("30-MAY-2005", "Corpus Christi Observed"); - - lh.addStaticHoliday ("06-JUN-2005", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("04-JUL-2005", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2005", "Independence Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("17-OCT-2005", "Columbus Day"); - - lh.addStaticHoliday ("07-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("14-NOV-2005", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2005", "Immaculate Conception"); - - lh.addStaticHoliday ("09-JAN-2006", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2006", "St. Josephs Day"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labor Day"); - - lh.addStaticHoliday ("29-MAY-2006", "Ascension Day Observed"); - - lh.addStaticHoliday ("19-JUN-2006", "Corpus Christi Observed"); - - lh.addStaticHoliday ("26-JUN-2006", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("03-JUL-2006", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2006", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2006", "National Holiday"); - - lh.addStaticHoliday ("21-AUG-2006", "Assumption Day"); - - lh.addStaticHoliday ("16-OCT-2006", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2006", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2006", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2007", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2007", "St. Josephs Day"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labor Day"); - - lh.addStaticHoliday ("21-MAY-2007", "Ascension Day Observed"); - - lh.addStaticHoliday ("11-JUN-2007", "Corpus Christi Observed"); - - lh.addStaticHoliday ("18-JUN-2007", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("02-JUL-2007", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2007", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2007", "National Holiday"); - - lh.addStaticHoliday ("20-AUG-2007", "Assumption Day"); - - lh.addStaticHoliday ("15-OCT-2007", "Columbus Day"); - - lh.addStaticHoliday ("05-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("12-NOV-2007", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2007", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2007", "New Years day Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2008", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "St. Josephs Day"); - - lh.addStaticHoliday ("01-MAY-2008", "Labor Day"); - - lh.addStaticHoliday ("05-MAY-2008", "Ascension Day Observed"); - - lh.addStaticHoliday ("26-MAY-2008", "Corpus Christi Observed"); - - lh.addStaticHoliday ("02-JUN-2008", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("30-JUN-2008", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2008", "National Holiday"); - - lh.addStaticHoliday ("18-AUG-2008", "Assumption Day"); - - lh.addStaticHoliday ("13-OCT-2008", "Columbus Day"); - - lh.addStaticHoliday ("03-NOV-2008", "All Saints Day"); - - lh.addStaticHoliday ("17-NOV-2008", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2009", "Epiphany"); - - lh.addStaticHoliday ("23-MAR-2009", "St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labor Day"); - - lh.addStaticHoliday ("25-MAY-2009", "Ascension Day Observed"); - - lh.addStaticHoliday ("15-JUN-2009", "Corpus Christi Observed"); - - lh.addStaticHoliday ("22-JUN-2009", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("29-JUN-2009", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2009", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2009", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-2009", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2009", "Columbus Day"); - - lh.addStaticHoliday ("02-NOV-2009", "All Saints Day"); - - lh.addStaticHoliday ("16-NOV-2009", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2009", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2010", "Epiphany"); - - lh.addStaticHoliday ("22-MAR-2010", "St. Josephs Day"); - - lh.addStaticHoliday ("01-APR-2010", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("17-MAY-2010", "Ascension Day Observed"); - - lh.addStaticHoliday ("07-JUN-2010", "Corpus Christi Observed"); - - lh.addStaticHoliday ("14-JUN-2010", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("05-JUL-2010", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2010", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2010", "Assumption Day"); - - lh.addStaticHoliday ("18-OCT-2010", "Columbus Day"); - - lh.addStaticHoliday ("01-NOV-2010", "All Saints Day"); - - lh.addStaticHoliday ("15-NOV-2010", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2010", "Immaculate Conception"); - - lh.addStaticHoliday ("10-JAN-2011", "Epiphany"); - - lh.addStaticHoliday ("21-MAR-2011", "St. Josephs Day"); - - lh.addStaticHoliday ("21-APR-2011", "Holy Thursday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("06-JUN-2011", "Ascension Day Observed"); - - lh.addStaticHoliday ("27-JUN-2011", "Corpus Christi Observed"); - - lh.addStaticHoliday ("04-JUL-2011", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2011", "Independence Day"); - - lh.addStaticHoliday ("15-AUG-2011", "Assumption Day"); - - lh.addStaticHoliday ("17-OCT-2011", "Columbus Day"); - - lh.addStaticHoliday ("07-NOV-2011", "All Saints Day"); - - lh.addStaticHoliday ("14-NOV-2011", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2011", "Immaculate Conception"); - - lh.addStaticHoliday ("09-JAN-2012", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2012", "St. Josephs Day"); - - lh.addStaticHoliday ("05-APR-2012", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labor Day"); - - lh.addStaticHoliday ("21-MAY-2012", "Ascension Day Observed"); - - lh.addStaticHoliday ("11-JUN-2012", "Corpus Christi Observed"); - - lh.addStaticHoliday ("18-JUN-2012", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("02-JUL-2012", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2012", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2012", "National Holiday"); - - lh.addStaticHoliday ("20-AUG-2012", "Assumption Day"); - - lh.addStaticHoliday ("15-OCT-2012", "Columbus Day"); - - lh.addStaticHoliday ("05-NOV-2012", "All Saints Day"); - - lh.addStaticHoliday ("12-NOV-2012", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2013", "Epiphany"); - - lh.addStaticHoliday ("25-MAR-2013", "St. Josephs Day"); - - lh.addStaticHoliday ("28-MAR-2013", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labor Day"); - - lh.addStaticHoliday ("13-MAY-2013", "Ascension Day Observed"); - - lh.addStaticHoliday ("03-JUN-2013", "Corpus Christi Observed"); - - lh.addStaticHoliday ("10-JUN-2013", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("01-JUL-2013", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2013", "National Holiday"); - - lh.addStaticHoliday ("19-AUG-2013", "Assumption Day"); - - lh.addStaticHoliday ("14-OCT-2013", "Columbus Day"); - - lh.addStaticHoliday ("04-NOV-2013", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2013", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2014", "Epiphany"); - - lh.addStaticHoliday ("24-MAR-2014", "St. Josephs Day"); - - lh.addStaticHoliday ("17-APR-2014", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labor Day"); - - lh.addStaticHoliday ("02-JUN-2014", "Ascension Day Observed"); - - lh.addStaticHoliday ("23-JUN-2014", "Corpus Christi Observed"); - - lh.addStaticHoliday ("30-JUN-2014", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2014", "National Holiday"); - - lh.addStaticHoliday ("18-AUG-2014", "Assumption Day"); - - lh.addStaticHoliday ("13-OCT-2014", "Columbus Day"); - - lh.addStaticHoliday ("03-NOV-2014", "All Saints Day"); - - lh.addStaticHoliday ("17-NOV-2014", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2014", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2015", "Epiphany"); - - lh.addStaticHoliday ("23-MAR-2015", "St. Josephs Day"); - - lh.addStaticHoliday ("02-APR-2015", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labor Day"); - - lh.addStaticHoliday ("18-MAY-2015", "Ascension Day Observed"); - - lh.addStaticHoliday ("08-JUN-2015", "Corpus Christi Observed"); - - lh.addStaticHoliday ("15-JUN-2015", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("29-JUN-2015", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2015", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2015", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-2015", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2015", "Columbus Day"); - - lh.addStaticHoliday ("02-NOV-2015", "All Saints Day"); - - lh.addStaticHoliday ("16-NOV-2015", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2015", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2016", "Epiphany"); - - lh.addStaticHoliday ("21-MAR-2016", "St. Josephs Day"); - - lh.addStaticHoliday ("24-MAR-2016", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("09-MAY-2016", "Ascension Day Observed"); - - lh.addStaticHoliday ("30-MAY-2016", "Corpus Christi Observed"); - - lh.addStaticHoliday ("06-JUN-2016", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("04-JUL-2016", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2016", "Independence Day"); - - lh.addStaticHoliday ("15-AUG-2016", "Assumption Day"); - - lh.addStaticHoliday ("17-OCT-2016", "Columbus Day"); - - lh.addStaticHoliday ("07-NOV-2016", "All Saints Day"); - - lh.addStaticHoliday ("14-NOV-2016", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2016", "Immaculate Conception"); - - lh.addStaticHoliday ("09-JAN-2017", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2017", "St. Josephs Day"); - - lh.addStaticHoliday ("13-APR-2017", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labor Day"); - - lh.addStaticHoliday ("29-MAY-2017", "Ascension Day Observed"); - - lh.addStaticHoliday ("19-JUN-2017", "Corpus Christi Observed"); - - lh.addStaticHoliday ("26-JUN-2017", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("03-JUL-2017", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2017", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2017", "National Holiday"); - - lh.addStaticHoliday ("21-AUG-2017", "Assumption Day"); - - lh.addStaticHoliday ("16-OCT-2017", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2017", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2017", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2017", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2018", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2018", "St. Josephs Day"); - - lh.addStaticHoliday ("29-MAR-2018", "Holy Thursday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labor Day"); - - lh.addStaticHoliday ("14-MAY-2018", "Ascension Day Observed"); - - lh.addStaticHoliday ("04-JUN-2018", "Corpus Christi Observed"); - - lh.addStaticHoliday ("11-JUN-2018", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("02-JUL-2018", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2018", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2018", "National Holiday"); - - lh.addStaticHoliday ("20-AUG-2018", "Assumption Day"); - - lh.addStaticHoliday ("15-OCT-2018", "Columbus Day"); - - lh.addStaticHoliday ("05-NOV-2018", "All Saints Day"); - - lh.addStaticHoliday ("12-NOV-2018", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2019", "Epiphany"); - - lh.addStaticHoliday ("25-MAR-2019", "St. Josephs Day"); - - lh.addStaticHoliday ("18-APR-2019", "Holy Thursday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labor Day"); - - lh.addStaticHoliday ("03-JUN-2019", "Ascension Day Observed"); - - lh.addStaticHoliday ("24-JUN-2019", "Corpus Christi Observed"); - - lh.addStaticHoliday ("01-JUL-2019", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2019", "National Holiday"); - - lh.addStaticHoliday ("19-AUG-2019", "Assumption Day"); - - lh.addStaticHoliday ("14-OCT-2019", "Columbus Day"); - - lh.addStaticHoliday ("04-NOV-2019", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2019", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2020", "Epiphany"); - - lh.addStaticHoliday ("23-MAR-2020", "St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-2020", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labor Day"); - - lh.addStaticHoliday ("25-MAY-2020", "Ascension Day Observed"); - - lh.addStaticHoliday ("15-JUN-2020", "Corpus Christi Observed"); - - lh.addStaticHoliday ("22-JUN-2020", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("29-JUN-2020", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2020", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2020", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-2020", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2020", "Columbus Day"); - - lh.addStaticHoliday ("02-NOV-2020", "All Saints Day"); - - lh.addStaticHoliday ("16-NOV-2020", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2020", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2021", "Epiphany"); - - lh.addStaticHoliday ("22-MAR-2021", "St. Josephs Day"); - - lh.addStaticHoliday ("01-APR-2021", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("17-MAY-2021", "Ascension Day Observed"); - - lh.addStaticHoliday ("07-JUN-2021", "Corpus Christi Observed"); - - lh.addStaticHoliday ("14-JUN-2021", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("05-JUL-2021", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2021", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2021", "Assumption Day"); - - lh.addStaticHoliday ("18-OCT-2021", "Columbus Day"); - - lh.addStaticHoliday ("01-NOV-2021", "All Saints Day"); - - lh.addStaticHoliday ("15-NOV-2021", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2021", "Immaculate Conception"); - - lh.addStaticHoliday ("10-JAN-2022", "Epiphany"); - - lh.addStaticHoliday ("21-MAR-2022", "St. Josephs Day"); - - lh.addStaticHoliday ("14-APR-2022", "Holy Thursday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("30-MAY-2022", "Ascension Day Observed"); - - lh.addStaticHoliday ("20-JUN-2022", "Corpus Christi Observed"); - - lh.addStaticHoliday ("27-JUN-2022", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("04-JUL-2022", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2022", "Independence Day"); - - lh.addStaticHoliday ("15-AUG-2022", "Assumption Day"); - - lh.addStaticHoliday ("17-OCT-2022", "Columbus Day"); - - lh.addStaticHoliday ("07-NOV-2022", "All Saints Day"); - - lh.addStaticHoliday ("14-NOV-2022", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2022", "Immaculate Conception"); - - lh.addStaticHoliday ("09-JAN-2023", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2023", "St. Josephs Day"); - - lh.addStaticHoliday ("06-APR-2023", "Holy Thursday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labor Day"); - - lh.addStaticHoliday ("22-MAY-2023", "Ascension Day Observed"); - - lh.addStaticHoliday ("12-JUN-2023", "Corpus Christi Observed"); - - lh.addStaticHoliday ("19-JUN-2023", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("03-JUL-2023", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2023", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2023", "National Holiday"); - - lh.addStaticHoliday ("21-AUG-2023", "Assumption Day"); - - lh.addStaticHoliday ("16-OCT-2023", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2023", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2023", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2023", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2024", "Epiphany"); - - lh.addStaticHoliday ("25-MAR-2024", "St. Josephs Day"); - - lh.addStaticHoliday ("28-MAR-2024", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labor Day"); - - lh.addStaticHoliday ("13-MAY-2024", "Ascension Day Observed"); - - lh.addStaticHoliday ("03-JUN-2024", "Corpus Christi Observed"); - - lh.addStaticHoliday ("10-JUN-2024", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("01-JUL-2024", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2024", "National Holiday"); - - lh.addStaticHoliday ("19-AUG-2024", "Assumption Day"); - - lh.addStaticHoliday ("14-OCT-2024", "Columbus Day"); - - lh.addStaticHoliday ("04-NOV-2024", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2024", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2025", "Epiphany"); - - lh.addStaticHoliday ("24-MAR-2025", "St. Josephs Day"); - - lh.addStaticHoliday ("17-APR-2025", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labor Day"); - - lh.addStaticHoliday ("02-JUN-2025", "Ascension Day Observed"); - - lh.addStaticHoliday ("23-JUN-2025", "Corpus Christi Observed"); - - lh.addStaticHoliday ("30-JUN-2025", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2025", "National Holiday"); - - lh.addStaticHoliday ("18-AUG-2025", "Assumption Day"); - - lh.addStaticHoliday ("13-OCT-2025", "Columbus Day"); - - lh.addStaticHoliday ("03-NOV-2025", "All Saints Day"); - - lh.addStaticHoliday ("17-NOV-2025", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2025", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2026", "Epiphany"); - - lh.addStaticHoliday ("23-MAR-2026", "St. Josephs Day"); - - lh.addStaticHoliday ("02-APR-2026", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labor Day"); - - lh.addStaticHoliday ("18-MAY-2026", "Ascension Day Observed"); - - lh.addStaticHoliday ("08-JUN-2026", "Corpus Christi Observed"); - - lh.addStaticHoliday ("15-JUN-2026", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("29-JUN-2026", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2026", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2026", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-2026", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2026", "Columbus Day"); - - lh.addStaticHoliday ("02-NOV-2026", "All Saints Day"); - - lh.addStaticHoliday ("16-NOV-2026", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2026", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2027", "Epiphany"); - - lh.addStaticHoliday ("22-MAR-2027", "St. Josephs Day"); - - lh.addStaticHoliday ("25-MAR-2027", "Holy Thursday"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("10-MAY-2027", "Ascension Day Observed"); - - lh.addStaticHoliday ("31-MAY-2027", "Corpus Christi Observed"); - - lh.addStaticHoliday ("07-JUN-2027", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("05-JUL-2027", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2027", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2027", "Assumption Day"); - - lh.addStaticHoliday ("18-OCT-2027", "Columbus Day"); - - lh.addStaticHoliday ("01-NOV-2027", "All Saints Day"); - - lh.addStaticHoliday ("15-NOV-2027", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2027", "Immaculate Conception"); - - lh.addStaticHoliday ("10-JAN-2028", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2028", "St. Josephs Day"); - - lh.addStaticHoliday ("13-APR-2028", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labor Day"); - - lh.addStaticHoliday ("29-MAY-2028", "Ascension Day Observed"); - - lh.addStaticHoliday ("19-JUN-2028", "Corpus Christi Observed"); - - lh.addStaticHoliday ("26-JUN-2028", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("03-JUL-2028", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2028", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2028", "National Holiday"); - - lh.addStaticHoliday ("21-AUG-2028", "Assumption Day"); - - lh.addStaticHoliday ("16-OCT-2028", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2028", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2028", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2028", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/ECSHoliday.java b/org/drip/analytics/holset/ECSHoliday.java deleted file mode 100644 index b2a0949..0000000 --- a/org/drip/analytics/holset/ECSHoliday.java +++ /dev/null @@ -1,647 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class ECSHoliday implements org.drip.analytics.holset.LocationHoliday { - public ECSHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "ECS"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("23-FEB-1998", "Carnival Monday"); - - lh.addStaticHoliday ("24-FEB-1998", "Carnival Tuesday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labor Day"); - - lh.addStaticHoliday ("10-AUG-1998", "Independence Day"); - - lh.addStaticHoliday ("09-OCT-1998", "Guayaquils Independence Day"); - - lh.addStaticHoliday ("02-NOV-1998", "Memorial Day"); - - lh.addStaticHoliday ("03-NOV-1998", "Cuencas Independence Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("15-FEB-1999", "Carnival Monday"); - - lh.addStaticHoliday ("16-FEB-1999", "Carnival Tuesday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-1999", "Pichincha War Day"); - - lh.addStaticHoliday ("10-AUG-1999", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-1999", "Memorial Day"); - - lh.addStaticHoliday ("03-NOV-1999", "Cuencas Independence Day"); - - lh.addStaticHoliday ("06-DEC-1999", "Quitos Independence Day"); - - lh.addStaticHoliday ("06-MAR-2000", "Carnival Monday"); - - lh.addStaticHoliday ("07-MAR-2000", "Carnival Tuesday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labor Day"); - - lh.addStaticHoliday ("24-MAY-2000", "Pichincha War Day"); - - lh.addStaticHoliday ("10-AUG-2000", "Independence Day"); - - lh.addStaticHoliday ("09-OCT-2000", "Guayaquils Independence Day"); - - lh.addStaticHoliday ("02-NOV-2000", "Memorial Day"); - - lh.addStaticHoliday ("03-NOV-2000", "Cuencas Independence Day"); - - lh.addStaticHoliday ("06-DEC-2000", "Quitos Independence Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("26-FEB-2001", "Carnival Monday"); - - lh.addStaticHoliday ("27-FEB-2001", "Carnival Tuesday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labor Day"); - - lh.addStaticHoliday ("24-MAY-2001", "Pichincha War Day"); - - lh.addStaticHoliday ("10-AUG-2001", "Independence Day"); - - lh.addStaticHoliday ("09-OCT-2001", "Guayaquils Independence Day"); - - lh.addStaticHoliday ("02-NOV-2001", "Memorial Day"); - - lh.addStaticHoliday ("06-DEC-2001", "Quitos Independence Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2002", "Carnival Monday"); - - lh.addStaticHoliday ("12-FEB-2002", "Carnival Tuesday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labor Day"); - - lh.addStaticHoliday ("24-MAY-2002", "Pichincha War Day"); - - lh.addStaticHoliday ("09-OCT-2002", "Guayaquils Independence Day"); - - lh.addStaticHoliday ("06-DEC-2002", "Quitos Independence Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2003", "Carnival Monday"); - - lh.addStaticHoliday ("04-MAR-2003", "Carnival Tuesday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labor Day"); - - lh.addStaticHoliday ("09-OCT-2003", "Guayaquils Independence Day"); - - lh.addStaticHoliday ("03-NOV-2003", "Cuencas Independence Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("23-FEB-2004", "Carnival Monday"); - - lh.addStaticHoliday ("24-FEB-2004", "Carnival Tuesday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2004", "Pichincha War Day"); - - lh.addStaticHoliday ("10-AUG-2004", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2004", "Memorial Day"); - - lh.addStaticHoliday ("03-NOV-2004", "Cuencas Independence Day"); - - lh.addStaticHoliday ("06-DEC-2004", "Quitos Independence Day"); - - lh.addStaticHoliday ("07-FEB-2005", "Carnival Monday"); - - lh.addStaticHoliday ("08-FEB-2005", "Carnival Tuesday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2005", "Pichincha War Day"); - - lh.addStaticHoliday ("10-AUG-2005", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2005", "Memorial Day"); - - lh.addStaticHoliday ("03-NOV-2005", "Cuencas Independence Day"); - - lh.addStaticHoliday ("06-DEC-2005", "Quitos Independence Day"); - - lh.addStaticHoliday ("27-FEB-2006", "Carnival Monday"); - - lh.addStaticHoliday ("28-FEB-2006", "Carnival Tuesday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labor Day"); - - lh.addStaticHoliday ("24-MAY-2006", "Pichincha War Day"); - - lh.addStaticHoliday ("10-AUG-2006", "Independence Day"); - - lh.addStaticHoliday ("09-OCT-2006", "Guayaquils Independence Day"); - - lh.addStaticHoliday ("02-NOV-2006", "Memorial Day"); - - lh.addStaticHoliday ("03-NOV-2006", "Cuencas Independence Day"); - - lh.addStaticHoliday ("06-DEC-2006", "Quitos Independence Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("19-FEB-2007", "Carnival Monday"); - - lh.addStaticHoliday ("20-FEB-2007", "Carnival Tuesday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labor Day"); - - lh.addStaticHoliday ("24-MAY-2007", "Pichincha War Day"); - - lh.addStaticHoliday ("10-AUG-2007", "Independence Day"); - - lh.addStaticHoliday ("09-OCT-2007", "Guayaquils Independence Day"); - - lh.addStaticHoliday ("02-NOV-2007", "Memorial Day"); - - lh.addStaticHoliday ("06-DEC-2007", "Quitos Independence Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("04-FEB-2008", "Carnival Monday"); - - lh.addStaticHoliday ("05-FEB-2008", "Carnival Tuesday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labor Day"); - - lh.addStaticHoliday ("09-OCT-2008", "Guayaquils Independence Day"); - - lh.addStaticHoliday ("03-NOV-2008", "Cuencas Independence Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("23-FEB-2009", "Carnival Monday"); - - lh.addStaticHoliday ("24-FEB-2009", "Carnival Tuesday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labor Day"); - - lh.addStaticHoliday ("10-AUG-2009", "Independence Day"); - - lh.addStaticHoliday ("09-OCT-2009", "Guayaquils Independence Day"); - - lh.addStaticHoliday ("02-NOV-2009", "Memorial Day"); - - lh.addStaticHoliday ("03-NOV-2009", "Cuencas Independence Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("15-FEB-2010", "Carnival Monday"); - - lh.addStaticHoliday ("16-FEB-2010", "Carnival Tuesday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2010", "Pichincha War Day"); - - lh.addStaticHoliday ("10-AUG-2010", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2010", "Memorial Day"); - - lh.addStaticHoliday ("03-NOV-2010", "Cuencas Independence Day"); - - lh.addStaticHoliday ("06-DEC-2010", "Quitos Independence Day"); - - lh.addStaticHoliday ("07-MAR-2011", "Carnival Monday"); - - lh.addStaticHoliday ("08-MAR-2011", "Carnival Tuesday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2011", "Pichincha War Day"); - - lh.addStaticHoliday ("10-AUG-2011", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2011", "Memorial Day"); - - lh.addStaticHoliday ("03-NOV-2011", "Cuencas Independence Day"); - - lh.addStaticHoliday ("06-DEC-2011", "Quitos Independence Day"); - - lh.addStaticHoliday ("20-FEB-2012", "Carnival Monday"); - - lh.addStaticHoliday ("21-FEB-2012", "Carnival Tuesday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labor Day"); - - lh.addStaticHoliday ("24-MAY-2012", "Pichincha War Day"); - - lh.addStaticHoliday ("10-AUG-2012", "Independence Day"); - - lh.addStaticHoliday ("09-OCT-2012", "Guayaquils Independence Day"); - - lh.addStaticHoliday ("02-NOV-2012", "Memorial Day"); - - lh.addStaticHoliday ("06-DEC-2012", "Quitos Independence Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2013", "Carnival Monday"); - - lh.addStaticHoliday ("12-FEB-2013", "Carnival Tuesday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labor Day"); - - lh.addStaticHoliday ("24-MAY-2013", "Pichincha War Day"); - - lh.addStaticHoliday ("09-OCT-2013", "Guayaquils Independence Day"); - - lh.addStaticHoliday ("06-DEC-2013", "Quitos Independence Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2014", "Carnival Monday"); - - lh.addStaticHoliday ("04-MAR-2014", "Carnival Tuesday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labor Day"); - - lh.addStaticHoliday ("09-OCT-2014", "Guayaquils Independence Day"); - - lh.addStaticHoliday ("03-NOV-2014", "Cuencas Independence Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2015", "Carnival Monday"); - - lh.addStaticHoliday ("17-FEB-2015", "Carnival Tuesday"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labor Day"); - - lh.addStaticHoliday ("10-AUG-2015", "Independence Day"); - - lh.addStaticHoliday ("09-OCT-2015", "Guayaquils Independence Day"); - - lh.addStaticHoliday ("02-NOV-2015", "Memorial Day"); - - lh.addStaticHoliday ("03-NOV-2015", "Cuencas Independence Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2016", "Carnival Monday"); - - lh.addStaticHoliday ("09-FEB-2016", "Carnival Tuesday"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2016", "Pichincha War Day"); - - lh.addStaticHoliday ("10-AUG-2016", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2016", "Memorial Day"); - - lh.addStaticHoliday ("03-NOV-2016", "Cuencas Independence Day"); - - lh.addStaticHoliday ("06-DEC-2016", "Quitos Independence Day"); - - lh.addStaticHoliday ("27-FEB-2017", "Carnival Monday"); - - lh.addStaticHoliday ("28-FEB-2017", "Carnival Tuesday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labor Day"); - - lh.addStaticHoliday ("24-MAY-2017", "Pichincha War Day"); - - lh.addStaticHoliday ("10-AUG-2017", "Independence Day"); - - lh.addStaticHoliday ("09-OCT-2017", "Guayaquils Independence Day"); - - lh.addStaticHoliday ("02-NOV-2017", "Memorial Day"); - - lh.addStaticHoliday ("03-NOV-2017", "Cuencas Independence Day"); - - lh.addStaticHoliday ("06-DEC-2017", "Quitos Independence Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("12-FEB-2018", "Carnival Monday"); - - lh.addStaticHoliday ("13-FEB-2018", "Carnival Tuesday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labor Day"); - - lh.addStaticHoliday ("24-MAY-2018", "Pichincha War Day"); - - lh.addStaticHoliday ("10-AUG-2018", "Independence Day"); - - lh.addStaticHoliday ("09-OCT-2018", "Guayaquils Independence Day"); - - lh.addStaticHoliday ("02-NOV-2018", "Memorial Day"); - - lh.addStaticHoliday ("06-DEC-2018", "Quitos Independence Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("04-MAR-2019", "Carnival Monday"); - - lh.addStaticHoliday ("05-MAR-2019", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labor Day"); - - lh.addStaticHoliday ("24-MAY-2019", "Pichincha War Day"); - - lh.addStaticHoliday ("09-OCT-2019", "Guayaquils Independence Day"); - - lh.addStaticHoliday ("06-DEC-2019", "Quitos Independence Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("24-FEB-2020", "Carnival Monday"); - - lh.addStaticHoliday ("25-FEB-2020", "Carnival Tuesday"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labor Day"); - - lh.addStaticHoliday ("10-AUG-2020", "Independence Day"); - - lh.addStaticHoliday ("09-OCT-2020", "Guayaquils Independence Day"); - - lh.addStaticHoliday ("02-NOV-2020", "Memorial Day"); - - lh.addStaticHoliday ("03-NOV-2020", "Cuencas Independence Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("15-FEB-2021", "Carnival Monday"); - - lh.addStaticHoliday ("16-FEB-2021", "Carnival Tuesday"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2021", "Pichincha War Day"); - - lh.addStaticHoliday ("10-AUG-2021", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2021", "Memorial Day"); - - lh.addStaticHoliday ("03-NOV-2021", "Cuencas Independence Day"); - - lh.addStaticHoliday ("06-DEC-2021", "Quitos Independence Day"); - - lh.addStaticHoliday ("28-FEB-2022", "Carnival Monday"); - - lh.addStaticHoliday ("01-MAR-2022", "Carnival Tuesday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2022", "Pichincha War Day"); - - lh.addStaticHoliday ("10-AUG-2022", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2022", "Memorial Day"); - - lh.addStaticHoliday ("03-NOV-2022", "Cuencas Independence Day"); - - lh.addStaticHoliday ("06-DEC-2022", "Quitos Independence Day"); - - lh.addStaticHoliday ("20-FEB-2023", "Carnival Monday"); - - lh.addStaticHoliday ("21-FEB-2023", "Carnival Tuesday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labor Day"); - - lh.addStaticHoliday ("24-MAY-2023", "Pichincha War Day"); - - lh.addStaticHoliday ("10-AUG-2023", "Independence Day"); - - lh.addStaticHoliday ("09-OCT-2023", "Guayaquils Independence Day"); - - lh.addStaticHoliday ("02-NOV-2023", "Memorial Day"); - - lh.addStaticHoliday ("03-NOV-2023", "Cuencas Independence Day"); - - lh.addStaticHoliday ("06-DEC-2023", "Quitos Independence Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("12-FEB-2024", "Carnival Monday"); - - lh.addStaticHoliday ("13-FEB-2024", "Carnival Tuesday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labor Day"); - - lh.addStaticHoliday ("24-MAY-2024", "Pichincha War Day"); - - lh.addStaticHoliday ("09-OCT-2024", "Guayaquils Independence Day"); - - lh.addStaticHoliday ("06-DEC-2024", "Quitos Independence Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2025", "Carnival Monday"); - - lh.addStaticHoliday ("04-MAR-2025", "Carnival Tuesday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labor Day"); - - lh.addStaticHoliday ("09-OCT-2025", "Guayaquils Independence Day"); - - lh.addStaticHoliday ("03-NOV-2025", "Cuencas Independence Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2026", "Carnival Monday"); - - lh.addStaticHoliday ("17-FEB-2026", "Carnival Tuesday"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labor Day"); - - lh.addStaticHoliday ("10-AUG-2026", "Independence Day"); - - lh.addStaticHoliday ("09-OCT-2026", "Guayaquils Independence Day"); - - lh.addStaticHoliday ("02-NOV-2026", "Memorial Day"); - - lh.addStaticHoliday ("03-NOV-2026", "Cuencas Independence Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2027", "Carnival Monday"); - - lh.addStaticHoliday ("09-FEB-2027", "Carnival Tuesday"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2027", "Pichincha War Day"); - - lh.addStaticHoliday ("10-AUG-2027", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2027", "Memorial Day"); - - lh.addStaticHoliday ("03-NOV-2027", "Cuencas Independence Day"); - - lh.addStaticHoliday ("06-DEC-2027", "Quitos Independence Day"); - - lh.addStaticHoliday ("28-FEB-2028", "Carnival Monday"); - - lh.addStaticHoliday ("29-FEB-2028", "Carnival Tuesday"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labor Day"); - - lh.addStaticHoliday ("24-MAY-2028", "Pichincha War Day"); - - lh.addStaticHoliday ("10-AUG-2028", "Independence Day"); - - lh.addStaticHoliday ("09-OCT-2028", "Guayaquils Independence Day"); - - lh.addStaticHoliday ("02-NOV-2028", "Memorial Day"); - - lh.addStaticHoliday ("03-NOV-2028", "Cuencas Independence Day"); - - lh.addStaticHoliday ("06-DEC-2028", "Quitos Independence Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/EEKHoliday.java b/org/drip/analytics/holset/EEKHoliday.java deleted file mode 100644 index 0f12de5..0000000 --- a/org/drip/analytics/holset/EEKHoliday.java +++ /dev/null @@ -1,433 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class EEKHoliday implements org.drip.analytics.holset.LocationHoliday { - public EEKHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "EEK"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("24-FEB-1998", "Independence Day"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Spring Day"); - - lh.addStaticHoliday ("23-JUN-1998", "Victory Day"); - - lh.addStaticHoliday ("24-JUN-1998", "St. Johns Day"); - - lh.addStaticHoliday ("20-AUG-1998", "Restoration of Independence Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("24-FEB-1999", "Independence Day"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("23-JUN-1999", "Victory Day"); - - lh.addStaticHoliday ("24-JUN-1999", "St. Johns Day"); - - lh.addStaticHoliday ("24-FEB-2000", "Independence Day"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Spring Day"); - - lh.addStaticHoliday ("23-JUN-2000", "Victory Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Spring Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Spring Day"); - - lh.addStaticHoliday ("24-JUN-2002", "St. Johns Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("24-FEB-2003", "Independence Day"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Spring Day"); - - lh.addStaticHoliday ("23-JUN-2003", "Victory Day"); - - lh.addStaticHoliday ("24-JUN-2003", "St. Johns Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("24-FEB-2004", "Independence Day"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("23-JUN-2004", "Victory Day"); - - lh.addStaticHoliday ("24-JUN-2004", "St. Johns Day"); - - lh.addStaticHoliday ("24-FEB-2005", "Independence Day"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("23-JUN-2005", "Victory Day"); - - lh.addStaticHoliday ("24-JUN-2005", "St. Johns Day"); - - lh.addStaticHoliday ("26-DEC-2005", "Boxing Day"); - - lh.addStaticHoliday ("24-FEB-2006", "Independence Day"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Spring Day"); - - lh.addStaticHoliday ("23-JUN-2006", "Victory Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Spring Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2008", "Spring Day"); - - lh.addStaticHoliday ("23-JUN-2008", "Victory Day"); - - lh.addStaticHoliday ("24-JUN-2008", "St. Johns Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("24-FEB-2009", "Independence Day"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Spring Day"); - - lh.addStaticHoliday ("23-JUN-2009", "Victory Day"); - - lh.addStaticHoliday ("24-JUN-2009", "St. Johns Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("24-FEB-2010", "Independence Day"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("23-JUN-2010", "Victory Day"); - - lh.addStaticHoliday ("24-JUN-2010", "St. Johns Day"); - - lh.addStaticHoliday ("24-FEB-2011", "Independence Day"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("23-JUN-2011", "Victory Day"); - - lh.addStaticHoliday ("24-JUN-2011", "St. Johns Day"); - - lh.addStaticHoliday ("26-DEC-2011", "Boxing Day"); - - lh.addStaticHoliday ("24-FEB-2012", "Independence Day"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2012", "Spring Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2013", "Spring Day"); - - lh.addStaticHoliday ("24-JUN-2013", "St. Johns Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("24-FEB-2014", "Independence Day"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2014", "Spring Day"); - - lh.addStaticHoliday ("23-JUN-2014", "Victory Day"); - - lh.addStaticHoliday ("24-JUN-2014", "St. Johns Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("24-FEB-2015", "Independence Day"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2015", "Spring Day"); - - lh.addStaticHoliday ("23-JUN-2015", "Victory Day"); - - lh.addStaticHoliday ("24-JUN-2015", "St. Johns Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("24-FEB-2016", "Independence Day"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("23-JUN-2016", "Victory Day"); - - lh.addStaticHoliday ("24-JUN-2016", "St. Johns Day"); - - lh.addStaticHoliday ("26-DEC-2016", "Boxing Day"); - - lh.addStaticHoliday ("24-FEB-2017", "Independence Day"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2017", "Spring Day"); - - lh.addStaticHoliday ("23-JUN-2017", "Victory Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2018", "Spring Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2019", "Spring Day"); - - lh.addStaticHoliday ("24-JUN-2019", "St. Johns Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("24-FEB-2020", "Independence Day"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2020", "Spring Day"); - - lh.addStaticHoliday ("23-JUN-2020", "Victory Day"); - - lh.addStaticHoliday ("24-JUN-2020", "St. Johns Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("24-FEB-2021", "Independence Day"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("23-JUN-2021", "Victory Day"); - - lh.addStaticHoliday ("24-JUN-2021", "St. Johns Day"); - - lh.addStaticHoliday ("24-FEB-2022", "Independence Day"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("23-JUN-2022", "Victory Day"); - - lh.addStaticHoliday ("24-JUN-2022", "St. Johns Day"); - - lh.addStaticHoliday ("26-DEC-2022", "Boxing Day"); - - lh.addStaticHoliday ("24-FEB-2023", "Independence Day"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2023", "Spring Day"); - - lh.addStaticHoliday ("23-JUN-2023", "Victory Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2024", "Spring Day"); - - lh.addStaticHoliday ("24-JUN-2024", "St. Johns Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("24-FEB-2025", "Independence Day"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2025", "Spring Day"); - - lh.addStaticHoliday ("23-JUN-2025", "Victory Day"); - - lh.addStaticHoliday ("24-JUN-2025", "St. Johns Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("24-FEB-2026", "Independence Day"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2026", "Spring Day"); - - lh.addStaticHoliday ("23-JUN-2026", "Victory Day"); - - lh.addStaticHoliday ("24-JUN-2026", "St. Johns Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("24-FEB-2027", "Independence Day"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("23-JUN-2027", "Victory Day"); - - lh.addStaticHoliday ("24-JUN-2027", "St. Johns Day"); - - lh.addStaticHoliday ("24-FEB-2028", "Independence Day"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2028", "Spring Day"); - - lh.addStaticHoliday ("23-JUN-2028", "Victory Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Boxing Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/EGPHoliday.java b/org/drip/analytics/holset/EGPHoliday.java deleted file mode 100644 index 0b5df28..0000000 --- a/org/drip/analytics/holset/EGPHoliday.java +++ /dev/null @@ -1,969 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class EGPHoliday implements org.drip.analytics.holset.LocationHoliday { - public EGPHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "EGP"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("28-JAN-1998", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("29-JAN-1998", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("05-APR-1998", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("06-APR-1998", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("07-APR-1998", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("08-APR-1998", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("09-APR-1998", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("19-APR-1998", "Orthodox Easter Day"); - - lh.addStaticHoliday ("20-APR-1998", "Sham El Nessim"); - - lh.addStaticHoliday ("26-APR-1998", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("27-APR-1998", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("28-APR-1998", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("01-JUL-1998", "Bank Holiday"); - - lh.addStaticHoliday ("05-JUL-1998", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("06-JUL-1998", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("07-JUL-1998", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("23-JUL-1998", "Revolution Day"); - - lh.addStaticHoliday ("06-OCT-1998", "Armed Forces Day"); - - lh.addStaticHoliday ("17-JAN-1999", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("18-JAN-1999", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("19-JAN-1999", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("20-JAN-1999", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("28-MAR-1999", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("29-MAR-1999", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("30-MAR-1999", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("11-APR-1999", "Orthodox Easter Day"); - - lh.addStaticHoliday ("12-APR-1999", "Sham El Nessim"); - - lh.addStaticHoliday ("18-APR-1999", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("25-APR-1999", "Sinai Liberation Day"); - - lh.addStaticHoliday ("27-JUN-1999", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("01-JUL-1999", "Bank Holiday"); - - lh.addStaticHoliday ("06-OCT-1999", "Armed Forces Day"); - - lh.addStaticHoliday ("06-JAN-2000", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("09-JAN-2000", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("14-MAR-2000", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("15-MAR-2000", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("16-MAR-2000", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("05-APR-2000", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("06-APR-2000", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("25-APR-2000", "Sinai Liberation Day"); - - lh.addStaticHoliday ("30-APR-2000", "Orthodox Easter Day"); - - lh.addStaticHoliday ("01-MAY-2000", "Sham El Nessim"); - - lh.addStaticHoliday ("14-JUN-2000", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("15-JUN-2000", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("23-JUL-2000", "Revolution Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("26-DEC-2000", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("27-DEC-2000", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("28-DEC-2000", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("04-MAR-2001", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("05-MAR-2001", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("06-MAR-2001", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("07-MAR-2001", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("08-MAR-2001", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("25-MAR-2001", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("26-MAR-2001", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("27-MAR-2001", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("15-APR-2001", "Orthodox Easter Day"); - - lh.addStaticHoliday ("16-APR-2001", "Sham El Nessim"); - - lh.addStaticHoliday ("25-APR-2001", "Sinai Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("03-JUN-2001", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("04-JUN-2001", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("05-JUN-2001", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("01-JUL-2001", "Bank Holiday"); - - lh.addStaticHoliday ("23-JUL-2001", "Revolution Day"); - - lh.addStaticHoliday ("16-DEC-2001", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("17-DEC-2001", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("21-FEB-2002", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("24-FEB-2002", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("25-FEB-2002", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("17-MAR-2002", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("25-APR-2002", "Sinai Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2002", "Orthodox Easter Day"); - - lh.addStaticHoliday ("06-MAY-2002", "Sham El Nessim"); - - lh.addStaticHoliday ("26-MAY-2002", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("01-JUL-2002", "Bank Holiday"); - - lh.addStaticHoliday ("23-JUL-2002", "Revolution Day"); - - lh.addStaticHoliday ("06-OCT-2002", "Armed Forces Day"); - - lh.addStaticHoliday ("04-DEC-2002", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("05-DEC-2002", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("10-FEB-2003", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("11-FEB-2003", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("12-FEB-2003", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("13-FEB-2003", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("04-MAR-2003", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("05-MAR-2003", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("06-MAR-2003", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("27-APR-2003", "Orthodox Easter Day"); - - lh.addStaticHoliday ("28-APR-2003", "Sham El Nessim"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("13-MAY-2003", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("14-MAY-2003", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("15-MAY-2003", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("01-JUL-2003", "Bank Holiday"); - - lh.addStaticHoliday ("23-JUL-2003", "Revolution Day"); - - lh.addStaticHoliday ("06-OCT-2003", "Armed Forces Day"); - - lh.addStaticHoliday ("23-NOV-2003", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("24-NOV-2003", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("25-NOV-2003", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("26-NOV-2003", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("01-FEB-2004", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("02-FEB-2004", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("03-FEB-2004", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("22-FEB-2004", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("11-APR-2004", "Orthodox Easter Day"); - - lh.addStaticHoliday ("12-APR-2004", "Sham El Nessim"); - - lh.addStaticHoliday ("25-APR-2004", "Sinai Liberation Day"); - - lh.addStaticHoliday ("02-MAY-2004", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("03-MAY-2004", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("01-JUL-2004", "Bank Holiday"); - - lh.addStaticHoliday ("06-OCT-2004", "Armed Forces Day"); - - lh.addStaticHoliday ("14-NOV-2004", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("15-NOV-2004", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("19-JAN-2005", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("20-JAN-2005", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("23-JAN-2005", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("09-FEB-2005", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("10-FEB-2005", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("20-APR-2005", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("21-APR-2005", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("25-APR-2005", "Sinai Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2005", "Orthodox Easter Day"); - - lh.addStaticHoliday ("02-MAY-2005", "Sham El Nessim"); - - lh.addStaticHoliday ("06-OCT-2005", "Armed Forces Day"); - - lh.addStaticHoliday ("01-NOV-2005", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("02-NOV-2005", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("03-NOV-2005", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("08-JAN-2006", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("09-JAN-2006", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("10-JAN-2006", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("11-JAN-2006", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("12-JAN-2006", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("30-JAN-2006", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("31-JAN-2006", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("01-FEB-2006", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("10-APR-2006", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("11-APR-2006", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("12-APR-2006", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("23-APR-2006", "Orthodox Easter Day"); - - lh.addStaticHoliday ("24-APR-2006", "Sham El Nessim"); - - lh.addStaticHoliday ("25-APR-2006", "Sinai Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("23-JUL-2006", "Revolution Day"); - - lh.addStaticHoliday ("22-OCT-2006", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("23-OCT-2006", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("24-OCT-2006", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("25-OCT-2006", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("31-DEC-2006", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2007", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("02-JAN-2007", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("21-JAN-2007", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("01-APR-2007", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("08-APR-2007", "Orthodox Easter Day"); - - lh.addStaticHoliday ("09-APR-2007", "Sham El Nessim"); - - lh.addStaticHoliday ("25-APR-2007", "Sinai Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("01-JUL-2007", "Bank Holiday"); - - lh.addStaticHoliday ("23-JUL-2007", "Revolution Day"); - - lh.addStaticHoliday ("11-OCT-2007", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("14-OCT-2007", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("18-DEC-2007", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("19-DEC-2007", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("20-DEC-2007", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("09-JAN-2008", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("10-JAN-2008", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("19-MAR-2008", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("20-MAR-2008", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("27-APR-2008", "Orthodox Easter Day"); - - lh.addStaticHoliday ("28-APR-2008", "Sham El Nessim"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("01-JUL-2008", "Bank Holiday"); - - lh.addStaticHoliday ("23-JUL-2008", "Revolution Day"); - - lh.addStaticHoliday ("29-SEP-2008", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("30-SEP-2008", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("01-OCT-2008", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("02-OCT-2008", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("06-OCT-2008", "Armed Forces Day"); - - lh.addStaticHoliday ("07-DEC-2008", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("08-DEC-2008", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("09-DEC-2008", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("10-DEC-2008", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("28-DEC-2008", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("29-DEC-2008", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("30-DEC-2008", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("08-MAR-2009", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("09-MAR-2009", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("10-MAR-2009", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("19-APR-2009", "Orthodox Easter Day"); - - lh.addStaticHoliday ("20-APR-2009", "Sham El Nessim"); - - lh.addStaticHoliday ("01-JUL-2009", "Bank Holiday"); - - lh.addStaticHoliday ("23-JUL-2009", "Revolution Day"); - - lh.addStaticHoliday ("20-SEP-2009", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("21-SEP-2009", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("06-OCT-2009", "Armed Forces Day"); - - lh.addStaticHoliday ("25-NOV-2009", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("26-NOV-2009", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("29-NOV-2009", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("17-DEC-2009", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("25-FEB-2010", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("04-APR-2010", "Orthodox Easter Day"); - - lh.addStaticHoliday ("05-APR-2010", "Sham El Nessim"); - - lh.addStaticHoliday ("25-APR-2010", "Sinai Liberation Day"); - - lh.addStaticHoliday ("01-JUL-2010", "Bank Holiday"); - - lh.addStaticHoliday ("08-SEP-2010", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("09-SEP-2010", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("06-OCT-2010", "Armed Forces Day"); - - lh.addStaticHoliday ("15-NOV-2010", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("16-NOV-2010", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("17-NOV-2010", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("18-NOV-2010", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("06-DEC-2010", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("07-DEC-2010", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("08-DEC-2010", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("14-FEB-2011", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("15-FEB-2011", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("16-FEB-2011", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("24-APR-2011", "Orthodox Easter Day"); - - lh.addStaticHoliday ("25-APR-2011", "Sham El Nessim"); - - lh.addStaticHoliday ("01-MAY-2011", "Labour Day"); - - lh.addStaticHoliday ("28-AUG-2011", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("29-AUG-2011", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("30-AUG-2011", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("31-AUG-2011", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("06-OCT-2011", "Armed Forces Day"); - - lh.addStaticHoliday ("06-NOV-2011", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("07-NOV-2011", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("08-NOV-2011", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("27-NOV-2011", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("05-FEB-2012", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("06-FEB-2012", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("15-APR-2012", "Orthodox Easter Day"); - - lh.addStaticHoliday ("16-APR-2012", "Sham El Nessim"); - - lh.addStaticHoliday ("25-APR-2012", "Sinai Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("01-JUL-2012", "Bank Holiday"); - - lh.addStaticHoliday ("23-JUL-2012", "Revolution Day"); - - lh.addStaticHoliday ("19-AUG-2012", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("20-AUG-2012", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("24-OCT-2012", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("25-OCT-2012", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("28-OCT-2012", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("14-NOV-2012", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("15-NOV-2012", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("23-JAN-2013", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("24-JAN-2013", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("25-APR-2013", "Sinai Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2013", "Orthodox Easter Day"); - - lh.addStaticHoliday ("06-MAY-2013", "Sham El Nessim"); - - lh.addStaticHoliday ("01-JUL-2013", "Bank Holiday"); - - lh.addStaticHoliday ("23-JUL-2013", "Revolution Day"); - - lh.addStaticHoliday ("06-AUG-2013", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("07-AUG-2013", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("08-AUG-2013", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("06-OCT-2013", "Armed Forces Day"); - - lh.addStaticHoliday ("13-OCT-2013", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("14-OCT-2013", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("15-OCT-2013", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("16-OCT-2013", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("17-OCT-2013", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("04-NOV-2013", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("05-NOV-2013", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("06-NOV-2013", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("13-JAN-2014", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("14-JAN-2014", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("15-JAN-2014", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("20-APR-2014", "Orthodox Easter Day"); - - lh.addStaticHoliday ("21-APR-2014", "Sham El Nessim"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("01-JUL-2014", "Bank Holiday"); - - lh.addStaticHoliday ("23-JUL-2014", "Revolution Day"); - - lh.addStaticHoliday ("27-JUL-2014", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("28-JUL-2014", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("29-JUL-2014", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("30-JUL-2014", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("05-OCT-2014", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("06-OCT-2014", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("07-OCT-2014", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("26-OCT-2014", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("04-JAN-2015", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("12-APR-2015", "Orthodox Easter Day"); - - lh.addStaticHoliday ("13-APR-2015", "Sham El Nessim"); - - lh.addStaticHoliday ("01-JUL-2015", "Bank Holiday"); - - lh.addStaticHoliday ("16-JUL-2015", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("19-JUL-2015", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("23-JUL-2015", "Revolution Day"); - - lh.addStaticHoliday ("22-SEP-2015", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("23-SEP-2015", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("24-SEP-2015", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("06-OCT-2015", "Armed Forces Day"); - - lh.addStaticHoliday ("14-OCT-2015", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("15-OCT-2015", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("23-DEC-2015", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("24-DEC-2015", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("25-APR-2016", "Sinai Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2016", "Orthodox Easter Day"); - - lh.addStaticHoliday ("02-MAY-2016", "Sham El Nessim"); - - lh.addStaticHoliday ("04-JUL-2016", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("05-JUL-2016", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("06-JUL-2016", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("07-JUL-2016", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("11-SEP-2016", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("12-SEP-2016", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("13-SEP-2016", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("14-SEP-2016", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("02-OCT-2016", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("03-OCT-2016", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("04-OCT-2016", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("06-OCT-2016", "Armed Forces Day"); - - lh.addStaticHoliday ("11-DEC-2016", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("12-DEC-2016", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("13-DEC-2016", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("16-APR-2017", "Orthodox Easter Day"); - - lh.addStaticHoliday ("17-APR-2017", "Sham El Nessim"); - - lh.addStaticHoliday ("25-APR-2017", "Sinai Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("25-JUN-2017", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("26-JUN-2017", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("23-JUL-2017", "Revolution Day"); - - lh.addStaticHoliday ("30-AUG-2017", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("31-AUG-2017", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("03-SEP-2017", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("21-SEP-2017", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("30-NOV-2017", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("08-APR-2018", "Orthodox Easter Day"); - - lh.addStaticHoliday ("09-APR-2018", "Sham El Nessim"); - - lh.addStaticHoliday ("25-APR-2018", "Sinai Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("13-JUN-2018", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("14-JUN-2018", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("01-JUL-2018", "Bank Holiday"); - - lh.addStaticHoliday ("23-JUL-2018", "Revolution Day"); - - lh.addStaticHoliday ("20-AUG-2018", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("21-AUG-2018", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("22-AUG-2018", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("23-AUG-2018", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("10-SEP-2018", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("11-SEP-2018", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("12-SEP-2018", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("19-NOV-2018", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("20-NOV-2018", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("21-NOV-2018", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("25-APR-2019", "Sinai Liberation Day"); - - lh.addStaticHoliday ("28-APR-2019", "Orthodox Easter Day"); - - lh.addStaticHoliday ("29-APR-2019", "Sham El Nessim"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("03-JUN-2019", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("04-JUN-2019", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("05-JUN-2019", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("06-JUN-2019", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("01-JUL-2019", "Bank Holiday"); - - lh.addStaticHoliday ("23-JUL-2019", "Revolution Day"); - - lh.addStaticHoliday ("11-AUG-2019", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("12-AUG-2019", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("13-AUG-2019", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("01-SEP-2019", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("06-OCT-2019", "Armed Forces Day"); - - lh.addStaticHoliday ("10-NOV-2019", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("19-APR-2020", "Orthodox Easter Day"); - - lh.addStaticHoliday ("20-APR-2020", "Sham El Nessim"); - - lh.addStaticHoliday ("24-MAY-2020", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("25-MAY-2020", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("01-JUL-2020", "Bank Holiday"); - - lh.addStaticHoliday ("23-JUL-2020", "Revolution Day"); - - lh.addStaticHoliday ("29-JUL-2020", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("30-JUL-2020", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("02-AUG-2020", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("19-AUG-2020", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("20-AUG-2020", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("06-OCT-2020", "Armed Forces Day"); - - lh.addStaticHoliday ("28-OCT-2020", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("29-OCT-2020", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("25-APR-2021", "Sinai Liberation Day"); - - lh.addStaticHoliday ("02-MAY-2021", "Orthodox Easter Day"); - - lh.addStaticHoliday ("03-MAY-2021", "Sham El Nessim"); - - lh.addStaticHoliday ("11-MAY-2021", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("12-MAY-2021", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("13-MAY-2021", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("01-JUL-2021", "Bank Holiday"); - - lh.addStaticHoliday ("18-JUL-2021", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("19-JUL-2021", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("20-JUL-2021", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("21-JUL-2021", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("22-JUL-2021", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("09-AUG-2021", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("10-AUG-2021", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("11-AUG-2021", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("06-OCT-2021", "Armed Forces Day"); - - lh.addStaticHoliday ("17-OCT-2021", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("18-OCT-2021", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("19-OCT-2021", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("24-APR-2022", "Orthodox Easter Day"); - - lh.addStaticHoliday ("25-APR-2022", "Sham El Nessim"); - - lh.addStaticHoliday ("01-MAY-2022", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("02-MAY-2022", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("03-MAY-2022", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("07-JUL-2022", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("10-JUL-2022", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("11-JUL-2022", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("31-JUL-2022", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("06-OCT-2022", "Armed Forces Day"); - - lh.addStaticHoliday ("09-OCT-2022", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("16-APR-2023", "Orthodox Easter Day"); - - lh.addStaticHoliday ("17-APR-2023", "Sham El Nessim"); - - lh.addStaticHoliday ("20-APR-2023", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("23-APR-2023", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("25-APR-2023", "Sinai Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("27-JUN-2023", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("28-JUN-2023", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("29-JUN-2023", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("18-JUL-2023", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("19-JUL-2023", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("20-JUL-2023", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("23-JUL-2023", "Revolution Day"); - - lh.addStaticHoliday ("26-SEP-2023", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("27-SEP-2023", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("28-SEP-2023", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("08-APR-2024", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("09-APR-2024", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("10-APR-2024", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("11-APR-2024", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("25-APR-2024", "Sinai Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2024", "Orthodox Easter Day"); - - lh.addStaticHoliday ("06-MAY-2024", "Sham El Nessim"); - - lh.addStaticHoliday ("16-JUN-2024", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("17-JUN-2024", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("18-JUN-2024", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("19-JUN-2024", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("01-JUL-2024", "Bank Holiday"); - - lh.addStaticHoliday ("07-JUL-2024", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("08-JUL-2024", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("23-JUL-2024", "Revolution Day"); - - lh.addStaticHoliday ("15-SEP-2024", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("16-SEP-2024", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("06-OCT-2024", "Armed Forces Day"); - - lh.addStaticHoliday ("30-MAR-2025", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("31-MAR-2025", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("01-APR-2025", "Ramadan Bairam Holiday Period"); - - lh.addStaticHoliday ("20-APR-2025", "Orthodox Easter Day"); - - lh.addStaticHoliday ("21-APR-2025", "Sham El Nessim"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("04-JUN-2025", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("05-JUN-2025", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("08-JUN-2025", "Courban Bairam Holiday Period"); - - lh.addStaticHoliday ("25-JUN-2025", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("26-JUN-2025", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("01-JUL-2025", "Bank Holiday"); - - lh.addStaticHoliday ("23-JUL-2025", "Revolution Day"); - - lh.addStaticHoliday ("03-SEP-2025", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("04-SEP-2025", "Mawled El Nabi Holiday Period"); - - lh.addStaticHoliday ("06-OCT-2025", "Armed Forces Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/ESBHoliday.java b/org/drip/analytics/holset/ESBHoliday.java deleted file mode 100644 index 6907806..0000000 --- a/org/drip/analytics/holset/ESBHoliday.java +++ /dev/null @@ -1,221 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class ESBHoliday implements org.drip.analytics.holset.LocationHoliday { - public ESBHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "ESB"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1997", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1997", "Epiphany"); - - lh.addStaticHoliday ("27-MAR-1997", "Holy Thursday"); - - lh.addStaticHoliday ("28-MAR-1997", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1997", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-1997", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-1997", "San Isidro"); - - lh.addStaticHoliday ("25-JUL-1997", "St James"); - - lh.addStaticHoliday ("15-AUG-1997", "Assumption"); - - lh.addStaticHoliday ("08-DEC-1997", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-1997", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1998", "Epiphany"); - - lh.addStaticHoliday ("09-APR-1998", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("15-MAY-1998", "San Isidro"); - - lh.addStaticHoliday ("11-JUN-1998", "Replacement"); - - lh.addStaticHoliday ("12-OCT-1998", "National Holiday"); - - lh.addStaticHoliday ("09-NOV-1998", "Almudena"); - - lh.addStaticHoliday ("08-DEC-1998", "Immac Conception"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1999", "Epiphany"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("03-JUN-1999", "Replacement"); - - lh.addStaticHoliday ("12-OCT-1999", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints"); - - lh.addStaticHoliday ("09-NOV-1999", "Alumenda"); - - lh.addStaticHoliday ("06-DEC-1999", "Constitution"); - - lh.addStaticHoliday ("08-DEC-1999", "Immac Conception"); - - lh.addStaticHoliday ("06-JAN-2000", "Epiphany"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2000", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2000", "San Isidro"); - - lh.addStaticHoliday ("22-JUN-2000", "Replacement"); - - lh.addStaticHoliday ("15-AUG-2000", "Assumption"); - - lh.addStaticHoliday ("12-OCT-2000", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2000", "All Saints"); - - lh.addStaticHoliday ("09-NOV-2000", "Almudena"); - - lh.addStaticHoliday ("06-DEC-2000", "Constitution"); - - lh.addStaticHoliday ("08-DEC-2000", "Immac Conception"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2001", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2001", "San Isidro"); - - lh.addStaticHoliday ("14-JUN-2001", "Replacement"); - - lh.addStaticHoliday ("15-AUG-2001", "Assumption"); - - lh.addStaticHoliday ("12-OCT-2001", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2001", "All Saints"); - - lh.addStaticHoliday ("09-NOV-2001", "Almudena"); - - lh.addStaticHoliday ("06-DEC-2001", "Constitution"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2002", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2002", "San Isidro"); - - lh.addStaticHoliday ("30-MAY-2002", "Replacement"); - - lh.addStaticHoliday ("15-AUG-2002", "Assumption"); - - lh.addStaticHoliday ("01-NOV-2002", "All Saints"); - - lh.addStaticHoliday ("06-DEC-2002", "Constitution"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2003", "Epiphany"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2003", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2003", "San Isidro"); - - lh.addStaticHoliday ("19-JUN-2003", "Replacement"); - - lh.addStaticHoliday ("15-AUG-2003", "Assumption"); - - lh.addStaticHoliday ("08-DEC-2003", "Immac Conception"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/ESPHoliday.java b/org/drip/analytics/holset/ESPHoliday.java deleted file mode 100644 index ff1f24c..0000000 --- a/org/drip/analytics/holset/ESPHoliday.java +++ /dev/null @@ -1,865 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class ESPHoliday implements org.drip.analytics.holset.LocationHoliday { - public ESPHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "ESP"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1998", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-1998", "St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-1998", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("15-MAY-1998", "San Isidro"); - - lh.addStaticHoliday ("12-OCT-1998", "National Holiday"); - - lh.addStaticHoliday ("02-NOV-1998", "All Saints Day Observed"); - - lh.addStaticHoliday ("09-NOV-1998", "Our Lady of Almudena"); - - lh.addStaticHoliday ("08-DEC-1998", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1999", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-1999", "St. Josephs Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("03-JUN-1999", "Corpus Christi"); - - lh.addStaticHoliday ("12-OCT-1999", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-1999", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-1999", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-1999", "Immaculate Conception"); - - lh.addStaticHoliday ("06-JAN-2000", "Epiphany"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2000", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2000", "San Isidro"); - - lh.addStaticHoliday ("22-JUN-2000", "Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2000", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2000", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2000", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2000", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2000", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2000", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("19-MAR-2001", "St. Josephs Day"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2001", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2001", "San Isidro"); - - lh.addStaticHoliday ("14-JUN-2001", "Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2001", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2001", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2001", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2001", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2001", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("19-MAR-2002", "St. Josephs Day"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2002", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2002", "San Isidro"); - - lh.addStaticHoliday ("30-MAY-2002", "Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2002", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2002", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("06-DEC-2002", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2003", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2003", "St. Josephs Day"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2003", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2003", "San Isidro"); - - lh.addStaticHoliday ("19-JUN-2003", "Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2003", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2003", "Assumption Day"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2004", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2004", "St. Josephs Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("10-JUN-2004", "Corpus Christi"); - - lh.addStaticHoliday ("12-OCT-2004", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2004", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2004", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2004", "Immaculate Conception"); - - lh.addStaticHoliday ("06-JAN-2005", "Epiphany"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("02-MAY-2005", "Madrid Day"); - - lh.addStaticHoliday ("26-MAY-2005", "Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2005", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2005", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2005", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2005", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2005", "Immaculate Conception"); - - lh.addStaticHoliday ("06-JAN-2006", "Epiphany"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2006", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2006", "San Isidro"); - - lh.addStaticHoliday ("15-JUN-2006", "Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2006", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2006", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2006", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2006", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2006", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2006", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("19-MAR-2007", "St. Josephs Day"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2007", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2007", "San Isidro"); - - lh.addStaticHoliday ("07-JUN-2007", "Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2007", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2007", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2007", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2007", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2007", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("19-MAR-2008", "St. Josephs Day"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2008", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2008", "San Isidro"); - - lh.addStaticHoliday ("22-MAY-2008", "Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2008", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2008", "Assumption Day"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2009", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2009", "St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("15-MAY-2009", "San Isidro"); - - lh.addStaticHoliday ("11-JUN-2009", "Corpus Christi"); - - lh.addStaticHoliday ("12-OCT-2009", "National Holiday"); - - lh.addStaticHoliday ("09-NOV-2009", "Our Lady of Almudena"); - - lh.addStaticHoliday ("08-DEC-2009", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2010", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2010", "St. Josephs Day"); - - lh.addStaticHoliday ("01-APR-2010", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("03-JUN-2010", "Corpus Christi"); - - lh.addStaticHoliday ("12-OCT-2010", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2010", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2010", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2010", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2010", "Immaculate Conception"); - - lh.addStaticHoliday ("06-JAN-2011", "Epiphany"); - - lh.addStaticHoliday ("21-APR-2011", "Holy Thursday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("02-MAY-2011", "Madrid Day"); - - lh.addStaticHoliday ("23-JUN-2011", "Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2011", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2011", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2011", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2011", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2011", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2011", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2011", "Immaculate Conception"); - - lh.addStaticHoliday ("06-JAN-2012", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2012", "St. Josephs Day"); - - lh.addStaticHoliday ("05-APR-2012", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2012", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2012", "San Isidro"); - - lh.addStaticHoliday ("07-JUN-2012", "Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2012", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2012", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2012", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2012", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2012", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2012", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("19-MAR-2013", "St. Josephs Day"); - - lh.addStaticHoliday ("28-MAR-2013", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2013", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2013", "San Isidro"); - - lh.addStaticHoliday ("30-MAY-2013", "Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2013", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2013", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2013", "All Saints Day"); - - lh.addStaticHoliday ("06-DEC-2013", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2014", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2014", "St. Josephs Day"); - - lh.addStaticHoliday ("17-APR-2014", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2014", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2014", "San Isidro"); - - lh.addStaticHoliday ("19-JUN-2014", "Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2014", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2014", "Assumption Day"); - - lh.addStaticHoliday ("08-DEC-2014", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2015", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2015", "St. Josephs Day"); - - lh.addStaticHoliday ("02-APR-2015", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("15-MAY-2015", "San Isidro"); - - lh.addStaticHoliday ("04-JUN-2015", "Corpus Christi"); - - lh.addStaticHoliday ("12-OCT-2015", "National Holiday"); - - lh.addStaticHoliday ("09-NOV-2015", "Our Lady of Almudena"); - - lh.addStaticHoliday ("08-DEC-2015", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2016", "Epiphany"); - - lh.addStaticHoliday ("24-MAR-2016", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("02-MAY-2016", "Madrid Day"); - - lh.addStaticHoliday ("26-MAY-2016", "Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2016", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2016", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2016", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2016", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2016", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2016", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2016", "Immaculate Conception"); - - lh.addStaticHoliday ("06-JAN-2017", "Epiphany"); - - lh.addStaticHoliday ("13-APR-2017", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2017", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2017", "San Isidro"); - - lh.addStaticHoliday ("15-JUN-2017", "Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2017", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2017", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2017", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2017", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2017", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2017", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2017", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("19-MAR-2018", "St. Josephs Day"); - - lh.addStaticHoliday ("29-MAR-2018", "Holy Thursday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2018", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2018", "San Isidro"); - - lh.addStaticHoliday ("31-MAY-2018", "Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2018", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2018", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2018", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2018", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2018", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2018", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("19-MAR-2019", "St. Josephs Day"); - - lh.addStaticHoliday ("18-APR-2019", "Holy Thursday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2019", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2019", "San Isidro"); - - lh.addStaticHoliday ("20-JUN-2019", "Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2019", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2019", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2019", "All Saints Day"); - - lh.addStaticHoliday ("06-DEC-2019", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2020", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2020", "St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-2020", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("15-MAY-2020", "San Isidro"); - - lh.addStaticHoliday ("11-JUN-2020", "Corpus Christi"); - - lh.addStaticHoliday ("12-OCT-2020", "National Holiday"); - - lh.addStaticHoliday ("09-NOV-2020", "Our Lady of Almudena"); - - lh.addStaticHoliday ("08-DEC-2020", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2021", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2021", "St. Josephs Day"); - - lh.addStaticHoliday ("01-APR-2021", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("03-JUN-2021", "Corpus Christi"); - - lh.addStaticHoliday ("12-OCT-2021", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2021", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2021", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2021", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2021", "Immaculate Conception"); - - lh.addStaticHoliday ("06-JAN-2022", "Epiphany"); - - lh.addStaticHoliday ("14-APR-2022", "Holy Thursday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("02-MAY-2022", "Madrid Day"); - - lh.addStaticHoliday ("16-JUN-2022", "Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2022", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2022", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2022", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2022", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2022", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2022", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2022", "Immaculate Conception"); - - lh.addStaticHoliday ("06-JAN-2023", "Epiphany"); - - lh.addStaticHoliday ("06-APR-2023", "Holy Thursday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2023", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2023", "San Isidro"); - - lh.addStaticHoliday ("08-JUN-2023", "Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2023", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2023", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2023", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2023", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2023", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2023", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2023", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("19-MAR-2024", "St. Josephs Day"); - - lh.addStaticHoliday ("28-MAR-2024", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2024", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2024", "San Isidro"); - - lh.addStaticHoliday ("30-MAY-2024", "Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2024", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2024", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2024", "All Saints Day"); - - lh.addStaticHoliday ("06-DEC-2024", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2025", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2025", "St. Josephs Day"); - - lh.addStaticHoliday ("17-APR-2025", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2025", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2025", "San Isidro"); - - lh.addStaticHoliday ("19-JUN-2025", "Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2025", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2025", "Assumption Day"); - - lh.addStaticHoliday ("08-DEC-2025", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2026", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2026", "St. Josephs Day"); - - lh.addStaticHoliday ("02-APR-2026", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("15-MAY-2026", "San Isidro"); - - lh.addStaticHoliday ("04-JUN-2026", "Corpus Christi"); - - lh.addStaticHoliday ("12-OCT-2026", "National Holiday"); - - lh.addStaticHoliday ("09-NOV-2026", "Our Lady of Almudena"); - - lh.addStaticHoliday ("08-DEC-2026", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2027", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2027", "St. Josephs Day"); - - lh.addStaticHoliday ("25-MAR-2027", "Holy Thursday"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("27-MAY-2027", "Corpus Christi"); - - lh.addStaticHoliday ("12-OCT-2027", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2027", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2027", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2027", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2027", "Immaculate Conception"); - - lh.addStaticHoliday ("06-JAN-2028", "Epiphany"); - - lh.addStaticHoliday ("13-APR-2028", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2028", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2028", "San Isidro"); - - lh.addStaticHoliday ("15-JUN-2028", "Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2028", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2028", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2028", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2028", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2028", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2028", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2028", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/ESTHoliday.java b/org/drip/analytics/holset/ESTHoliday.java deleted file mode 100644 index 644fea3..0000000 --- a/org/drip/analytics/holset/ESTHoliday.java +++ /dev/null @@ -1,809 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class ESTHoliday implements org.drip.analytics.holset.LocationHoliday { - public ESTHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "EST"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1997", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1997", "Epiphany"); - - lh.addStaticHoliday ("27-MAR-1997", "Holy Thursday"); - - lh.addStaticHoliday ("28-MAR-1997", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1997", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-1997", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-1997", "San Isidro"); - - lh.addStaticHoliday ("25-JUL-1997", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-1997", "Assumption Day"); - - lh.addStaticHoliday ("09-SEP-1997", "Special Holiday"); - - lh.addStaticHoliday ("08-DEC-1997", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-1997", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1998", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-1998", "*St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-1998", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("15-MAY-1998", "San Isidro"); - - lh.addStaticHoliday ("12-OCT-1998", "National Holiday"); - - lh.addStaticHoliday ("09-NOV-1998", "Our Lady of Almudena"); - - lh.addStaticHoliday ("08-DEC-1998", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1999", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-1999", "St. Josephs Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("12-OCT-1999", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-1999", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-1999", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-1999", "Immaculate Conception"); - - lh.addStaticHoliday ("31-DEC-1999", "Special Holiday"); - - lh.addStaticHoliday ("06-JAN-2000", "Epiphany"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2000", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2000", "San Isidro"); - - lh.addStaticHoliday ("25-JUL-2000", "*St. James Day"); - - lh.addStaticHoliday ("15-AUG-2000", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2000", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2000", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2000", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2000", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("19-MAR-2001", "*St. Josephs Day"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2001", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2001", "San Isidro"); - - lh.addStaticHoliday ("25-JUL-2001", "*St. James Day"); - - lh.addStaticHoliday ("15-AUG-2001", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2001", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2001", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2001", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("19-MAR-2002", "*St. Josephs Day"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2002", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2002", "San Isidro"); - - lh.addStaticHoliday ("25-JUL-2002", "*St. James Day"); - - lh.addStaticHoliday ("15-AUG-2002", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("06-DEC-2002", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2003", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2003", "*St. Josephs Day"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2003", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2003", "San Isidro"); - - lh.addStaticHoliday ("25-JUL-2003", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2003", "Assumption Day"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2004", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2004", "St. Josephs Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("12-OCT-2004", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2004", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2004", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2004", "Immaculate Conception"); - - lh.addStaticHoliday ("06-JAN-2005", "Epiphany"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("02-MAY-2005", "Madrid Day"); - - lh.addStaticHoliday ("25-JUL-2005", "*St. James Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2005", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2005", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2005", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2005", "Immaculate Conception"); - - lh.addStaticHoliday ("06-JAN-2006", "Epiphany"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2006", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2006", "San Isidro"); - - lh.addStaticHoliday ("25-JUL-2006", "*St. James Day"); - - lh.addStaticHoliday ("15-AUG-2006", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2006", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2006", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2006", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2006", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("19-MAR-2007", "*St. Josephs Day"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2007", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2007", "San Isidro"); - - lh.addStaticHoliday ("07-JUN-2007", "*Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2007", "*St. James Day"); - - lh.addStaticHoliday ("15-AUG-2007", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2007", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2007", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2007", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("19-MAR-2008", "*St. Josephs Day"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2008", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2008", "San Isidro"); - - lh.addStaticHoliday ("22-MAY-2008", "*Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2008", "*St. James Day"); - - lh.addStaticHoliday ("15-AUG-2008", "Assumption Day"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2009", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2009", "*St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("15-MAY-2009", "San Isidro"); - - lh.addStaticHoliday ("12-OCT-2009", "National Holiday"); - - lh.addStaticHoliday ("09-NOV-2009", "Our Lady of Almudena"); - - lh.addStaticHoliday ("08-DEC-2009", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2010", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2010", "St. Josephs Day"); - - lh.addStaticHoliday ("01-APR-2010", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("12-OCT-2010", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2010", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2010", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2010", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2010", "Immaculate Conception"); - - lh.addStaticHoliday ("06-JAN-2011", "Epiphany"); - - lh.addStaticHoliday ("21-APR-2011", "Holy Thursday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("02-MAY-2011", "Madrid Day"); - - lh.addStaticHoliday ("25-JUL-2011", "*St. James Day"); - - lh.addStaticHoliday ("15-AUG-2011", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2011", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2011", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2011", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2011", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2011", "Immaculate Conception"); - - lh.addStaticHoliday ("06-JAN-2012", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2012", "*St. Josephs Day"); - - lh.addStaticHoliday ("05-APR-2012", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2012", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2012", "San Isidro"); - - lh.addStaticHoliday ("25-JUL-2012", "*St. James Day"); - - lh.addStaticHoliday ("15-AUG-2012", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2012", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2012", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2012", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2012", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("19-MAR-2013", "*St. Josephs Day"); - - lh.addStaticHoliday ("28-MAR-2013", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2013", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2013", "San Isidro"); - - lh.addStaticHoliday ("25-JUL-2013", "*St. James Day"); - - lh.addStaticHoliday ("15-AUG-2013", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2013", "All Saints Day"); - - lh.addStaticHoliday ("06-DEC-2013", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2014", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2014", "*St. Josephs Day"); - - lh.addStaticHoliday ("17-APR-2014", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2014", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2014", "San Isidro"); - - lh.addStaticHoliday ("25-JUL-2014", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2014", "Assumption Day"); - - lh.addStaticHoliday ("08-DEC-2014", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2015", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2015", "*St. Josephs Day"); - - lh.addStaticHoliday ("02-APR-2015", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("15-MAY-2015", "San Isidro"); - - lh.addStaticHoliday ("12-OCT-2015", "National Holiday"); - - lh.addStaticHoliday ("09-NOV-2015", "Our Lady of Almudena"); - - lh.addStaticHoliday ("08-DEC-2015", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2016", "Epiphany"); - - lh.addStaticHoliday ("24-MAR-2016", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("02-MAY-2016", "Madrid Day"); - - lh.addStaticHoliday ("25-JUL-2016", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2016", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2016", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2016", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2016", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2016", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2016", "Immaculate Conception"); - - lh.addStaticHoliday ("06-JAN-2017", "Epiphany"); - - lh.addStaticHoliday ("13-APR-2017", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2017", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2017", "San Isidro"); - - lh.addStaticHoliday ("25-JUL-2017", "*St. James Day"); - - lh.addStaticHoliday ("15-AUG-2017", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2017", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2017", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2017", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2017", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2017", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("19-MAR-2018", "*St. Josephs Day"); - - lh.addStaticHoliday ("29-MAR-2018", "Holy Thursday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2018", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2018", "San Isidro"); - - lh.addStaticHoliday ("25-JUL-2018", "*St. James Day"); - - lh.addStaticHoliday ("15-AUG-2018", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2018", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2018", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2018", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2018", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("19-MAR-2019", "*St. Josephs Day"); - - lh.addStaticHoliday ("18-APR-2019", "Holy Thursday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2019", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2019", "San Isidro"); - - lh.addStaticHoliday ("25-JUL-2019", "*St. James Day"); - - lh.addStaticHoliday ("15-AUG-2019", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2019", "All Saints Day"); - - lh.addStaticHoliday ("06-DEC-2019", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2020", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2020", "*St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-2020", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("15-MAY-2020", "San Isidro"); - - lh.addStaticHoliday ("12-OCT-2020", "National Holiday"); - - lh.addStaticHoliday ("09-NOV-2020", "Our Lady of Almudena"); - - lh.addStaticHoliday ("08-DEC-2020", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2021", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2021", "St. Josephs Day"); - - lh.addStaticHoliday ("01-APR-2021", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("12-OCT-2021", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2021", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2021", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2021", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2021", "Immaculate Conception"); - - lh.addStaticHoliday ("06-JAN-2022", "Epiphany"); - - lh.addStaticHoliday ("14-APR-2022", "Holy Thursday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("02-MAY-2022", "Madrid Day"); - - lh.addStaticHoliday ("25-JUL-2022", "*St. James Day"); - - lh.addStaticHoliday ("15-AUG-2022", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2022", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2022", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2022", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2022", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2022", "Immaculate Conception"); - - lh.addStaticHoliday ("06-JAN-2023", "Epiphany"); - - lh.addStaticHoliday ("06-APR-2023", "Holy Thursday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2023", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2023", "San Isidro"); - - lh.addStaticHoliday ("25-JUL-2023", "*St. James Day"); - - lh.addStaticHoliday ("15-AUG-2023", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2023", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2023", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2023", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2023", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2023", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("19-MAR-2024", "*St. Josephs Day"); - - lh.addStaticHoliday ("28-MAR-2024", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2024", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2024", "San Isidro"); - - lh.addStaticHoliday ("30-MAY-2024", "*Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2024", "*St. James Day"); - - lh.addStaticHoliday ("15-AUG-2024", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2024", "All Saints Day"); - - lh.addStaticHoliday ("06-DEC-2024", "Constitution Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2025", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2025", "*St. Josephs Day"); - - lh.addStaticHoliday ("17-APR-2025", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2025", "Madrid Day"); - - lh.addStaticHoliday ("15-MAY-2025", "San Isidro"); - - lh.addStaticHoliday ("19-JUN-2025", "*Corpus Christi"); - - lh.addStaticHoliday ("25-JUL-2025", "St. James Day"); - - lh.addStaticHoliday ("15-AUG-2025", "Assumption Day"); - - lh.addStaticHoliday ("08-DEC-2025", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2026", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2026", "*St. Josephs Day"); - - lh.addStaticHoliday ("02-APR-2026", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("15-MAY-2026", "San Isidro"); - - lh.addStaticHoliday ("04-JUN-2026", "*Corpus Christi"); - - lh.addStaticHoliday ("12-OCT-2026", "National Holiday"); - - lh.addStaticHoliday ("09-NOV-2026", "Our Lady of Almudena"); - - lh.addStaticHoliday ("08-DEC-2026", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2027", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2027", "St. Josephs Day"); - - lh.addStaticHoliday ("25-MAR-2027", "Holy Thursday"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("12-OCT-2027", "National Holiday"); - - lh.addStaticHoliday ("01-NOV-2027", "All Saints Day"); - - lh.addStaticHoliday ("09-NOV-2027", "Our Lady of Almudena"); - - lh.addStaticHoliday ("06-DEC-2027", "Constitution Day"); - - lh.addStaticHoliday ("08-DEC-2027", "Immaculate Conception"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/EUBHoliday.java b/org/drip/analytics/holset/EUBHoliday.java deleted file mode 100644 index b17cdf9..0000000 --- a/org/drip/analytics/holset/EUBHoliday.java +++ /dev/null @@ -1,149 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class EUBHoliday implements org.drip.analytics.holset.LocationHoliday { - public EUBHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "EUB"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("31-DEC-1999", "New Years Eve - Special"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/EURHoliday.java b/org/drip/analytics/holset/EURHoliday.java deleted file mode 100644 index 99643fd..0000000 --- a/org/drip/analytics/holset/EURHoliday.java +++ /dev/null @@ -1,369 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class EURHoliday implements org.drip.analytics.holset.LocationHoliday { - public EURHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "EUR"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "26 December"); - - lh.addStaticHoliday ("31-DEC-2001", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "26 December"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "26 December"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("26-DEC-2005", "26 December"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "26 December"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "26 December"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "26 December"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("26-DEC-2011", "26 December"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "26 December"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "26 December"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "26 December"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("26-DEC-2016", "26 December"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "26 December"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "26 December"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "26 December"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("26-DEC-2022", "26 December"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "26 December"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "26 December"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "26 December"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "26 December"); - - lh.addStaticHoliday ("01-JAN-2029", "New Years Day"); - - lh.addStaticHoliday ("30-MAR-2029", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2029", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2029", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2029", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2029", "26 December"); - - lh.addStaticHoliday ("01-JAN-2030", "New Years Day"); - - lh.addStaticHoliday ("19-APR-2030", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2030", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2030", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2030", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2030", "26 December"); - - lh.addStaticHoliday ("01-JAN-2031", "New Years Day"); - - lh.addStaticHoliday ("11-APR-2031", "Good Friday"); - - lh.addStaticHoliday ("14-APR-2031", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2031", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2031", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2031", "26 December"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/FIMHoliday.java b/org/drip/analytics/holset/FIMHoliday.java deleted file mode 100644 index 9b6f5dc..0000000 --- a/org/drip/analytics/holset/FIMHoliday.java +++ /dev/null @@ -1,613 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class FIMHoliday implements org.drip.analytics.holset.LocationHoliday { - public FIMHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "FIM"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1998", "Twelfth Day"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-1998", "Ascension Day"); - - lh.addStaticHoliday ("19-JUN-1998", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-1998", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1999", "Twelfth Day"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-1999", "Ascension Day"); - - lh.addStaticHoliday ("25-JUN-1999", "Midsummers Eve"); - - lh.addStaticHoliday ("06-DEC-1999", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-1999", "Christmas Eve"); - - lh.addStaticHoliday ("06-JAN-2000", "Twelfth Day"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("01-JUN-2000", "Ascension Day"); - - lh.addStaticHoliday ("23-JUN-2000", "Midsummers Eve"); - - lh.addStaticHoliday ("06-DEC-2000", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2001", "Ascension Day"); - - lh.addStaticHoliday ("22-JUN-2001", "Midsummers Eve"); - - lh.addStaticHoliday ("06-DEC-2001", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2001", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2002", "Ascension Day"); - - lh.addStaticHoliday ("21-JUN-2002", "Midsummers Eve"); - - lh.addStaticHoliday ("06-DEC-2002", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2002", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2003", "Twelfth Day"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2003", "Ascension Day"); - - lh.addStaticHoliday ("20-JUN-2003", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2003", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2004", "Twelfth Day"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("20-MAY-2004", "Ascension Day"); - - lh.addStaticHoliday ("25-JUN-2004", "Midsummers Eve"); - - lh.addStaticHoliday ("06-DEC-2004", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2004", "Christmas Eve"); - - lh.addStaticHoliday ("06-JAN-2005", "Twelfth Day"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2005", "Ascension Day"); - - lh.addStaticHoliday ("24-JUN-2005", "Midsummers Eve"); - - lh.addStaticHoliday ("06-DEC-2005", "Independence Day"); - - lh.addStaticHoliday ("26-DEC-2005", "Boxing Day"); - - lh.addStaticHoliday ("06-JAN-2006", "Twelfth Day"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2006", "Ascension Day"); - - lh.addStaticHoliday ("23-JUN-2006", "Midsummers Eve"); - - lh.addStaticHoliday ("06-DEC-2006", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2007", "Ascension Day"); - - lh.addStaticHoliday ("22-JUN-2007", "Midsummers Eve"); - - lh.addStaticHoliday ("06-DEC-2007", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2007", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("20-JUN-2008", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2008", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2009", "Twelfth Day"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2009", "Ascension Day"); - - lh.addStaticHoliday ("19-JUN-2009", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2009", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2010", "Twelfth Day"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-2010", "Ascension Day"); - - lh.addStaticHoliday ("25-JUN-2010", "Midsummers Eve"); - - lh.addStaticHoliday ("06-DEC-2010", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2010", "Christmas Eve"); - - lh.addStaticHoliday ("06-JAN-2011", "Twelfth Day"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("02-JUN-2011", "Ascension Day"); - - lh.addStaticHoliday ("24-JUN-2011", "Midsummers Eve"); - - lh.addStaticHoliday ("06-DEC-2011", "Independence Day"); - - lh.addStaticHoliday ("26-DEC-2011", "Boxing Day"); - - lh.addStaticHoliday ("06-JAN-2012", "Twelfth Day"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2012", "Ascension Day"); - - lh.addStaticHoliday ("22-JUN-2012", "Midsummers Eve"); - - lh.addStaticHoliday ("06-DEC-2012", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2012", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2013", "Ascension Day"); - - lh.addStaticHoliday ("21-JUN-2013", "Midsummers Eve"); - - lh.addStaticHoliday ("06-DEC-2013", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2013", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2014", "Twelfth Day"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2014", "Ascension Day"); - - lh.addStaticHoliday ("20-JUN-2014", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2014", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2015", "Twelfth Day"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("14-MAY-2015", "Ascension Day"); - - lh.addStaticHoliday ("19-JUN-2015", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2015", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2016", "Twelfth Day"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2016", "Ascension Day"); - - lh.addStaticHoliday ("24-JUN-2016", "Midsummers Eve"); - - lh.addStaticHoliday ("06-DEC-2016", "Independence Day"); - - lh.addStaticHoliday ("26-DEC-2016", "Boxing Day"); - - lh.addStaticHoliday ("06-JAN-2017", "Twelfth Day"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2017", "Ascension Day"); - - lh.addStaticHoliday ("23-JUN-2017", "Midsummers Eve"); - - lh.addStaticHoliday ("06-DEC-2017", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("10-MAY-2018", "Ascension Day"); - - lh.addStaticHoliday ("22-JUN-2018", "Midsummers Eve"); - - lh.addStaticHoliday ("06-DEC-2018", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2018", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2019", "Ascension Day"); - - lh.addStaticHoliday ("21-JUN-2019", "Midsummers Eve"); - - lh.addStaticHoliday ("06-DEC-2019", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2019", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2020", "Twelfth Day"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2020", "Ascension Day"); - - lh.addStaticHoliday ("19-JUN-2020", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2020", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2021", "Twelfth Day"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-2021", "Ascension Day"); - - lh.addStaticHoliday ("25-JUN-2021", "Midsummers Eve"); - - lh.addStaticHoliday ("06-DEC-2021", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2021", "Christmas Eve"); - - lh.addStaticHoliday ("06-JAN-2022", "Twelfth Day"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("26-MAY-2022", "Ascension Day"); - - lh.addStaticHoliday ("24-JUN-2022", "Midsummers Eve"); - - lh.addStaticHoliday ("06-DEC-2022", "Independence Day"); - - lh.addStaticHoliday ("26-DEC-2022", "Boxing Day"); - - lh.addStaticHoliday ("06-JAN-2023", "Twelfth Day"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("18-MAY-2023", "Ascension Day"); - - lh.addStaticHoliday ("23-JUN-2023", "Midsummers Eve"); - - lh.addStaticHoliday ("06-DEC-2023", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2024", "Ascension Day"); - - lh.addStaticHoliday ("21-JUN-2024", "Midsummers Eve"); - - lh.addStaticHoliday ("06-DEC-2024", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2024", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2025", "Twelfth Day"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2025", "Ascension Day"); - - lh.addStaticHoliday ("20-JUN-2025", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2025", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2026", "Twelfth Day"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("14-MAY-2026", "Ascension Day"); - - lh.addStaticHoliday ("19-JUN-2026", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2026", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2027", "Twelfth Day"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("06-MAY-2027", "Ascension Day"); - - lh.addStaticHoliday ("25-JUN-2027", "Midsummers Eve"); - - lh.addStaticHoliday ("06-DEC-2027", "Independence Day"); - - lh.addStaticHoliday ("24-DEC-2027", "Christmas Eve"); - - lh.addStaticHoliday ("06-JAN-2028", "Twelfth Day"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2028", "Ascension Day"); - - lh.addStaticHoliday ("23-JUN-2028", "Midsummers Eve"); - - lh.addStaticHoliday ("06-DEC-2028", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Boxing Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/FRFHoliday.java b/org/drip/analytics/holset/FRFHoliday.java deleted file mode 100644 index 1747062..0000000 --- a/org/drip/analytics/holset/FRFHoliday.java +++ /dev/null @@ -1,899 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class FRFHoliday implements org.drip.analytics.holset.LocationHoliday { - public FRFHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "FRF"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-1998", "Victory Day"); - - lh.addStaticHoliday ("21-MAY-1998", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-1998", "Whit Monday"); - - lh.addStaticHoliday ("13-JUL-1998", "Bridging Day"); - - lh.addStaticHoliday ("14-JUL-1998", "Bastille Day"); - - lh.addStaticHoliday ("11-NOV-1998", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("02-APR-1999", "Bridging Day"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-1999", "Ascension Day"); - - lh.addStaticHoliday ("14-MAY-1999", "Bridging Day"); - - lh.addStaticHoliday ("24-MAY-1999", "Whit Monday"); - - lh.addStaticHoliday ("14-JUL-1999", "Bastille Day"); - - lh.addStaticHoliday ("16-AUG-1999", "Bridging Day"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-1999", "Armistice Day"); - - lh.addStaticHoliday ("12-NOV-1999", "Bridging Day"); - - lh.addStaticHoliday ("21-APR-2000", "Bridging Day"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2000", "Victory Day"); - - lh.addStaticHoliday ("01-JUN-2000", "Ascension Day"); - - lh.addStaticHoliday ("02-JUN-2000", "Bridging Day"); - - lh.addStaticHoliday ("12-JUN-2000", "Whit Monday"); - - lh.addStaticHoliday ("14-JUL-2000", "Bastille Day"); - - lh.addStaticHoliday ("14-AUG-2000", "Bridging Day"); - - lh.addStaticHoliday ("15-AUG-2000", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2001", "Bridging Day"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2001", "Victory Day"); - - lh.addStaticHoliday ("24-MAY-2001", "Ascension Day"); - - lh.addStaticHoliday ("04-JUN-2001", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2001", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("02-NOV-2001", "Bridging Day"); - - lh.addStaticHoliday ("12-NOV-2001", "Bridging Day"); - - lh.addStaticHoliday ("24-DEC-2001", "Bridging Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2002", "Bridging Day"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2002", "Victory Day"); - - lh.addStaticHoliday ("09-MAY-2002", "Ascension Day"); - - lh.addStaticHoliday ("10-MAY-2002", "Bridging Day"); - - lh.addStaticHoliday ("20-MAY-2002", "Whit Monday"); - - lh.addStaticHoliday ("15-JUL-2002", "Bridging Day"); - - lh.addStaticHoliday ("15-AUG-2002", "Assumption Day"); - - lh.addStaticHoliday ("16-AUG-2002", "Bridging Day"); - - lh.addStaticHoliday ("01-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2002", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2003", "Bridging Day"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2003", "Bridging Day"); - - lh.addStaticHoliday ("08-MAY-2003", "Victory Day"); - - lh.addStaticHoliday ("09-MAY-2003", "Bridging Day"); - - lh.addStaticHoliday ("29-MAY-2003", "Ascension Day"); - - lh.addStaticHoliday ("30-MAY-2003", "Bridging Day"); - - lh.addStaticHoliday ("09-JUN-2003", "Whit Monday"); - - lh.addStaticHoliday ("14-JUL-2003", "Bastille Day"); - - lh.addStaticHoliday ("15-AUG-2003", "Assumption Day"); - - lh.addStaticHoliday ("10-NOV-2003", "Bridging Day"); - - lh.addStaticHoliday ("11-NOV-2003", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2004", "Bridging Day"); - - lh.addStaticHoliday ("09-APR-2004", "Bridging Day"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("20-MAY-2004", "Ascension Day"); - - lh.addStaticHoliday ("21-MAY-2004", "Bridging Day"); - - lh.addStaticHoliday ("31-MAY-2004", "Whit Monday"); - - lh.addStaticHoliday ("14-JUL-2004", "Bastille Day"); - - lh.addStaticHoliday ("16-AUG-2004", "Bridging Day"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2004", "Armistice Day"); - - lh.addStaticHoliday ("12-NOV-2004", "Bridging Day"); - - lh.addStaticHoliday ("25-MAR-2005", "Bridging Day"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2005", "Bridging Day"); - - lh.addStaticHoliday ("05-MAY-2005", "Ascension Day"); - - lh.addStaticHoliday ("06-MAY-2005", "Bridging Day"); - - lh.addStaticHoliday ("09-MAY-2005", "Bridging Day"); - - lh.addStaticHoliday ("16-MAY-2005", "Whit Monday"); - - lh.addStaticHoliday ("14-JUL-2005", "Bastille Day"); - - lh.addStaticHoliday ("15-JUL-2005", "Bridging Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2005", "Bridging Day"); - - lh.addStaticHoliday ("01-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2005", "Armistice Day"); - - lh.addStaticHoliday ("26-DEC-2005", "Bridging Day"); - - lh.addStaticHoliday ("02-JAN-2006", "Bridging Day"); - - lh.addStaticHoliday ("14-APR-2006", "Bridging Day"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2006", "Victory Day"); - - lh.addStaticHoliday ("25-MAY-2006", "Ascension Day"); - - lh.addStaticHoliday ("26-MAY-2006", "Bridging Day"); - - lh.addStaticHoliday ("05-JUN-2006", "Whit Monday"); - - lh.addStaticHoliday ("14-JUL-2006", "Bastille Day"); - - lh.addStaticHoliday ("14-AUG-2006", "Bridging Day"); - - lh.addStaticHoliday ("15-AUG-2006", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2007", "Bridging Day"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2007", "Bridging Day"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("07-MAY-2007", "Bridging Day"); - - lh.addStaticHoliday ("08-MAY-2007", "Victory Day"); - - lh.addStaticHoliday ("17-MAY-2007", "Ascension Day"); - - lh.addStaticHoliday ("18-MAY-2007", "Bridging Day"); - - lh.addStaticHoliday ("28-MAY-2007", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2007", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("02-NOV-2007", "Bridging Day"); - - lh.addStaticHoliday ("12-NOV-2007", "Bridging Day"); - - lh.addStaticHoliday ("24-DEC-2007", "Bridging Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2008", "Bridging Day"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2008", "Bridging Day"); - - lh.addStaticHoliday ("08-MAY-2008", "Victory Day"); - - lh.addStaticHoliday ("09-MAY-2008", "Bridging Day"); - - lh.addStaticHoliday ("12-MAY-2008", "Whit Monday"); - - lh.addStaticHoliday ("14-JUL-2008", "Bastille Day"); - - lh.addStaticHoliday ("15-AUG-2008", "Assumption Day"); - - lh.addStaticHoliday ("10-NOV-2008", "Bridging Day"); - - lh.addStaticHoliday ("11-NOV-2008", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2009", "Bridging Day"); - - lh.addStaticHoliday ("10-APR-2009", "Bridging Day"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2009", "Victory Day"); - - lh.addStaticHoliday ("21-MAY-2009", "Ascension Day"); - - lh.addStaticHoliday ("22-MAY-2009", "Bridging Day"); - - lh.addStaticHoliday ("01-JUN-2009", "Whit Monday"); - - lh.addStaticHoliday ("13-JUL-2009", "Bridging Day"); - - lh.addStaticHoliday ("14-JUL-2009", "Bastille Day"); - - lh.addStaticHoliday ("02-NOV-2009", "Bridging Day"); - - lh.addStaticHoliday ("11-NOV-2009", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2010", "Bridging Day"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-2010", "Ascension Day"); - - lh.addStaticHoliday ("14-MAY-2010", "Bridging Day"); - - lh.addStaticHoliday ("24-MAY-2010", "Whit Monday"); - - lh.addStaticHoliday ("14-JUL-2010", "Bastille Day"); - - lh.addStaticHoliday ("16-AUG-2010", "Bridging Day"); - - lh.addStaticHoliday ("01-NOV-2010", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2010", "Armistice Day"); - - lh.addStaticHoliday ("12-NOV-2010", "Bridging Day"); - - lh.addStaticHoliday ("22-APR-2011", "Bridging Day"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2011", "Bridging Day"); - - lh.addStaticHoliday ("09-MAY-2011", "Bridging Day"); - - lh.addStaticHoliday ("02-JUN-2011", "Ascension Day"); - - lh.addStaticHoliday ("03-JUN-2011", "Bridging Day"); - - lh.addStaticHoliday ("13-JUN-2011", "Whit Monday"); - - lh.addStaticHoliday ("14-JUL-2011", "Bastille Day"); - - lh.addStaticHoliday ("15-JUL-2011", "Bridging Day"); - - lh.addStaticHoliday ("15-AUG-2011", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2011", "Bridging Day"); - - lh.addStaticHoliday ("01-NOV-2011", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2011", "Armistice Day"); - - lh.addStaticHoliday ("26-DEC-2011", "Bridging Day"); - - lh.addStaticHoliday ("02-JAN-2012", "Bridging Day"); - - lh.addStaticHoliday ("06-APR-2012", "Bridging Day"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2012", "Bridging Day"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("07-MAY-2012", "Bridging Day"); - - lh.addStaticHoliday ("08-MAY-2012", "Victory Day"); - - lh.addStaticHoliday ("17-MAY-2012", "Ascension Day"); - - lh.addStaticHoliday ("18-MAY-2012", "Bridging Day"); - - lh.addStaticHoliday ("28-MAY-2012", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2012", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2012", "All Saints Day"); - - lh.addStaticHoliday ("02-NOV-2012", "Bridging Day"); - - lh.addStaticHoliday ("12-NOV-2012", "Bridging Day"); - - lh.addStaticHoliday ("24-DEC-2012", "Bridging Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2013", "Bridging Day"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2013", "Victory Day"); - - lh.addStaticHoliday ("09-MAY-2013", "Ascension Day"); - - lh.addStaticHoliday ("10-MAY-2013", "Bridging Day"); - - lh.addStaticHoliday ("20-MAY-2013", "Whit Monday"); - - lh.addStaticHoliday ("15-JUL-2013", "Bridging Day"); - - lh.addStaticHoliday ("15-AUG-2013", "Assumption Day"); - - lh.addStaticHoliday ("16-AUG-2013", "Bridging Day"); - - lh.addStaticHoliday ("01-NOV-2013", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2013", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2014", "Bridging Day"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2014", "Bridging Day"); - - lh.addStaticHoliday ("08-MAY-2014", "Victory Day"); - - lh.addStaticHoliday ("09-MAY-2014", "Bridging Day"); - - lh.addStaticHoliday ("29-MAY-2014", "Ascension Day"); - - lh.addStaticHoliday ("30-MAY-2014", "Bridging Day"); - - lh.addStaticHoliday ("09-JUN-2014", "Whit Monday"); - - lh.addStaticHoliday ("14-JUL-2014", "Bastille Day"); - - lh.addStaticHoliday ("15-AUG-2014", "Assumption Day"); - - lh.addStaticHoliday ("10-NOV-2014", "Bridging Day"); - - lh.addStaticHoliday ("11-NOV-2014", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2015", "Bridging Day"); - - lh.addStaticHoliday ("03-APR-2015", "Bridging Day"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2015", "Victory Day"); - - lh.addStaticHoliday ("14-MAY-2015", "Ascension Day"); - - lh.addStaticHoliday ("15-MAY-2015", "Bridging Day"); - - lh.addStaticHoliday ("25-MAY-2015", "Whit Monday"); - - lh.addStaticHoliday ("13-JUL-2015", "Bridging Day"); - - lh.addStaticHoliday ("14-JUL-2015", "Bastille Day"); - - lh.addStaticHoliday ("02-NOV-2015", "Bridging Day"); - - lh.addStaticHoliday ("11-NOV-2015", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("25-MAR-2016", "Bridging Day"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2016", "Bridging Day"); - - lh.addStaticHoliday ("05-MAY-2016", "Ascension Day"); - - lh.addStaticHoliday ("06-MAY-2016", "Bridging Day"); - - lh.addStaticHoliday ("09-MAY-2016", "Bridging Day"); - - lh.addStaticHoliday ("16-MAY-2016", "Whit Monday"); - - lh.addStaticHoliday ("14-JUL-2016", "Bastille Day"); - - lh.addStaticHoliday ("15-JUL-2016", "Bridging Day"); - - lh.addStaticHoliday ("15-AUG-2016", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2016", "Bridging Day"); - - lh.addStaticHoliday ("01-NOV-2016", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2016", "Armistice Day"); - - lh.addStaticHoliday ("26-DEC-2016", "Bridging Day"); - - lh.addStaticHoliday ("02-JAN-2017", "Bridging Day"); - - lh.addStaticHoliday ("14-APR-2017", "Bridging Day"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2017", "Victory Day"); - - lh.addStaticHoliday ("25-MAY-2017", "Ascension Day"); - - lh.addStaticHoliday ("26-MAY-2017", "Bridging Day"); - - lh.addStaticHoliday ("05-JUN-2017", "Whit Monday"); - - lh.addStaticHoliday ("14-JUL-2017", "Bastille Day"); - - lh.addStaticHoliday ("14-AUG-2017", "Bridging Day"); - - lh.addStaticHoliday ("15-AUG-2017", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2017", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("30-MAR-2018", "Bridging Day"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2018", "Bridging Day"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("07-MAY-2018", "Bridging Day"); - - lh.addStaticHoliday ("08-MAY-2018", "Victory Day"); - - lh.addStaticHoliday ("10-MAY-2018", "Ascension Day"); - - lh.addStaticHoliday ("11-MAY-2018", "Bridging Day"); - - lh.addStaticHoliday ("21-MAY-2018", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2018", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2018", "All Saints Day"); - - lh.addStaticHoliday ("02-NOV-2018", "Bridging Day"); - - lh.addStaticHoliday ("12-NOV-2018", "Bridging Day"); - - lh.addStaticHoliday ("24-DEC-2018", "Bridging Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("19-APR-2019", "Bridging Day"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2019", "Victory Day"); - - lh.addStaticHoliday ("30-MAY-2019", "Ascension Day"); - - lh.addStaticHoliday ("31-MAY-2019", "Bridging Day"); - - lh.addStaticHoliday ("10-JUN-2019", "Whit Monday"); - - lh.addStaticHoliday ("15-JUL-2019", "Bridging Day"); - - lh.addStaticHoliday ("15-AUG-2019", "Assumption Day"); - - lh.addStaticHoliday ("16-AUG-2019", "Bridging Day"); - - lh.addStaticHoliday ("01-NOV-2019", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2019", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("10-APR-2020", "Bridging Day"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2020", "Victory Day"); - - lh.addStaticHoliday ("21-MAY-2020", "Ascension Day"); - - lh.addStaticHoliday ("22-MAY-2020", "Bridging Day"); - - lh.addStaticHoliday ("01-JUN-2020", "Whit Monday"); - - lh.addStaticHoliday ("13-JUL-2020", "Bridging Day"); - - lh.addStaticHoliday ("14-JUL-2020", "Bastille Day"); - - lh.addStaticHoliday ("02-NOV-2020", "Bridging Day"); - - lh.addStaticHoliday ("11-NOV-2020", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2021", "Bridging Day"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-2021", "Ascension Day"); - - lh.addStaticHoliday ("14-MAY-2021", "Bridging Day"); - - lh.addStaticHoliday ("24-MAY-2021", "Whit Monday"); - - lh.addStaticHoliday ("14-JUL-2021", "Bastille Day"); - - lh.addStaticHoliday ("16-AUG-2021", "Bridging Day"); - - lh.addStaticHoliday ("01-NOV-2021", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2021", "Armistice Day"); - - lh.addStaticHoliday ("12-NOV-2021", "Bridging Day"); - - lh.addStaticHoliday ("15-APR-2022", "Bridging Day"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2022", "Bridging Day"); - - lh.addStaticHoliday ("09-MAY-2022", "Bridging Day"); - - lh.addStaticHoliday ("26-MAY-2022", "Ascension Day"); - - lh.addStaticHoliday ("27-MAY-2022", "Bridging Day"); - - lh.addStaticHoliday ("06-JUN-2022", "Whit Monday"); - - lh.addStaticHoliday ("14-JUL-2022", "Bastille Day"); - - lh.addStaticHoliday ("15-JUL-2022", "Bridging Day"); - - lh.addStaticHoliday ("15-AUG-2022", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2022", "Bridging Day"); - - lh.addStaticHoliday ("01-NOV-2022", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2022", "Armistice Day"); - - lh.addStaticHoliday ("26-DEC-2022", "Bridging Day"); - - lh.addStaticHoliday ("02-JAN-2023", "Bridging Day"); - - lh.addStaticHoliday ("07-APR-2023", "Bridging Day"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2023", "Victory Day"); - - lh.addStaticHoliday ("18-MAY-2023", "Ascension Day"); - - lh.addStaticHoliday ("19-MAY-2023", "Bridging Day"); - - lh.addStaticHoliday ("29-MAY-2023", "Whit Monday"); - - lh.addStaticHoliday ("14-JUL-2023", "Bastille Day"); - - lh.addStaticHoliday ("14-AUG-2023", "Bridging Day"); - - lh.addStaticHoliday ("15-AUG-2023", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2023", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2024", "Bridging Day"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2024", "Victory Day"); - - lh.addStaticHoliday ("09-MAY-2024", "Ascension Day"); - - lh.addStaticHoliday ("10-MAY-2024", "Bridging Day"); - - lh.addStaticHoliday ("20-MAY-2024", "Whit Monday"); - - lh.addStaticHoliday ("15-JUL-2024", "Bridging Day"); - - lh.addStaticHoliday ("15-AUG-2024", "Assumption Day"); - - lh.addStaticHoliday ("16-AUG-2024", "Bridging Day"); - - lh.addStaticHoliday ("01-NOV-2024", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2024", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2025", "Bridging Day"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2025", "Bridging Day"); - - lh.addStaticHoliday ("08-MAY-2025", "Victory Day"); - - lh.addStaticHoliday ("09-MAY-2025", "Bridging Day"); - - lh.addStaticHoliday ("29-MAY-2025", "Ascension Day"); - - lh.addStaticHoliday ("30-MAY-2025", "Bridging Day"); - - lh.addStaticHoliday ("09-JUN-2025", "Whit Monday"); - - lh.addStaticHoliday ("14-JUL-2025", "Bastille Day"); - - lh.addStaticHoliday ("15-AUG-2025", "Assumption Day"); - - lh.addStaticHoliday ("10-NOV-2025", "Bridging Day"); - - lh.addStaticHoliday ("11-NOV-2025", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2026", "Bridging Day"); - - lh.addStaticHoliday ("03-APR-2026", "Bridging Day"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2026", "Victory Day"); - - lh.addStaticHoliday ("14-MAY-2026", "Ascension Day"); - - lh.addStaticHoliday ("15-MAY-2026", "Bridging Day"); - - lh.addStaticHoliday ("25-MAY-2026", "Whit Monday"); - - lh.addStaticHoliday ("13-JUL-2026", "Bridging Day"); - - lh.addStaticHoliday ("14-JUL-2026", "Bastille Day"); - - lh.addStaticHoliday ("02-NOV-2026", "Bridging Day"); - - lh.addStaticHoliday ("11-NOV-2026", "Armistice Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("26-MAR-2027", "Bridging Day"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("06-MAY-2027", "Ascension Day"); - - lh.addStaticHoliday ("07-MAY-2027", "Bridging Day"); - - lh.addStaticHoliday ("17-MAY-2027", "Whit Monday"); - - lh.addStaticHoliday ("14-JUL-2027", "Bastille Day"); - - lh.addStaticHoliday ("16-AUG-2027", "Bridging Day"); - - lh.addStaticHoliday ("01-NOV-2027", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2027", "Armistice Day"); - - lh.addStaticHoliday ("12-NOV-2027", "Bridging Day"); - - lh.addStaticHoliday ("14-APR-2028", "Bridging Day"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2028", "Victory Day"); - - lh.addStaticHoliday ("25-MAY-2028", "Ascension Day"); - - lh.addStaticHoliday ("26-MAY-2028", "Bridging Day"); - - lh.addStaticHoliday ("05-JUN-2028", "Whit Monday"); - - lh.addStaticHoliday ("14-JUL-2028", "Bastille Day"); - - lh.addStaticHoliday ("14-AUG-2028", "Bridging Day"); - - lh.addStaticHoliday ("15-AUG-2028", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2028", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/GBPHoliday.java b/org/drip/analytics/holset/GBPHoliday.java deleted file mode 100644 index 81616e1..0000000 --- a/org/drip/analytics/holset/GBPHoliday.java +++ /dev/null @@ -1,1459 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class GBPHoliday implements org.drip.analytics.holset.LocationHoliday { - public GBPHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "GBP"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("04-MAY-1998", "May Day"); - - lh.addStaticHoliday ("25-MAY-1998", "Spring Bank Holiday"); - - lh.addStaticHoliday ("31-AUG-1998", "August Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-1998", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-1999", "May Day"); - - lh.addStaticHoliday ("31-MAY-1999", "Spring Bank Holiday"); - - lh.addStaticHoliday ("30-AUG-1999", "August Bank Holiday"); - - lh.addStaticHoliday ("27-DEC-1999", "Boxing Day Observed"); - - lh.addStaticHoliday ("28-DEC-1999", "Christmas Day Observed"); - - lh.addStaticHoliday ("31-DEC-1999", "Special Holiday"); - - lh.addStaticHoliday ("03-JAN-2000", "New Years Day Observed"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2000", "May Day"); - - lh.addStaticHoliday ("29-MAY-2000", "Spring Bank Holiday"); - - lh.addStaticHoliday ("28-AUG-2000", "August Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("07-MAY-2001", "May Day"); - - lh.addStaticHoliday ("28-MAY-2001", "Spring Bank Holiday"); - - lh.addStaticHoliday ("27-AUG-2001", "August Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("06-MAY-2002", "May Day"); - - lh.addStaticHoliday ("03-JUN-2002", "Golden Jubilee"); - - lh.addStaticHoliday ("04-JUN-2002", "Golden Jubilee"); - - lh.addStaticHoliday ("26-AUG-2002", "August Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2003", "May Day"); - - lh.addStaticHoliday ("26-MAY-2003", "Spring Bank Holiday"); - - lh.addStaticHoliday ("25-AUG-2003", "August Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2004", "May Day"); - - lh.addStaticHoliday ("31-MAY-2004", "Spring Bank Holiday"); - - lh.addStaticHoliday ("30-AUG-2004", "August Bank Holiday"); - - lh.addStaticHoliday ("27-DEC-2004", "Boxing Day Observed"); - - lh.addStaticHoliday ("28-DEC-2004", "Christmas Day Observed"); - - lh.addStaticHoliday ("03-JAN-2005", "New Years Day Observed"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2005", "May Day"); - - lh.addStaticHoliday ("30-MAY-2005", "Spring Bank Holiday"); - - lh.addStaticHoliday ("29-AUG-2005", "August Bank Holiday"); - - lh.addStaticHoliday ("26-DEC-2005", "Boxing Day"); - - lh.addStaticHoliday ("27-DEC-2005", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "May Day"); - - lh.addStaticHoliday ("29-MAY-2006", "Spring Bank Holiday"); - - lh.addStaticHoliday ("28-AUG-2006", "August Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("07-MAY-2007", "May Day"); - - lh.addStaticHoliday ("28-MAY-2007", "Spring Bank Holiday"); - - lh.addStaticHoliday ("27-AUG-2007", "August Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2008", "May Day"); - - lh.addStaticHoliday ("26-MAY-2008", "Spring Bank Holiday"); - - lh.addStaticHoliday ("25-AUG-2008", "August Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("04-MAY-2009", "May Day"); - - lh.addStaticHoliday ("25-MAY-2009", "Spring Bank Holiday"); - - lh.addStaticHoliday ("31-AUG-2009", "August Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2009", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2010", "May Day"); - - lh.addStaticHoliday ("31-MAY-2010", "Spring Bank Holiday"); - - lh.addStaticHoliday ("30-AUG-2010", "August Bank Holiday"); - - lh.addStaticHoliday ("27-DEC-2010", "Boxing Day Observed"); - - lh.addStaticHoliday ("28-DEC-2010", "Christmas Day Observed"); - - lh.addStaticHoliday ("03-JAN-2011", "New Years Day Observed"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-2011", "Royal Wedding"); - - lh.addStaticHoliday ("02-MAY-2011", "May Day"); - - lh.addStaticHoliday ("30-MAY-2011", "Spring Bank Holiday"); - - lh.addStaticHoliday ("29-AUG-2011", "August Bank Holiday"); - - lh.addStaticHoliday ("26-DEC-2011", "Boxing Day"); - - lh.addStaticHoliday ("27-DEC-2011", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("07-MAY-2012", "May Day"); - - lh.addStaticHoliday ("04-JUN-2012", "Spring Bank Holiday"); - - lh.addStaticHoliday ("05-JUN-2012", "Queens Diamond Jubilee"); - - lh.addStaticHoliday ("27-AUG-2012", "August Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("06-MAY-2013", "May Day"); - - lh.addStaticHoliday ("27-MAY-2013", "Spring Bank Holiday"); - - lh.addStaticHoliday ("26-AUG-2013", "August Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2014", "May Day"); - - lh.addStaticHoliday ("26-MAY-2014", "Spring Bank Holiday"); - - lh.addStaticHoliday ("25-AUG-2014", "August Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("04-MAY-2015", "May Day"); - - lh.addStaticHoliday ("25-MAY-2015", "Spring Bank Holiday"); - - lh.addStaticHoliday ("31-AUG-2015", "August Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2015", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2016", "May Day"); - - lh.addStaticHoliday ("30-MAY-2016", "Spring Bank Holiday"); - - lh.addStaticHoliday ("29-AUG-2016", "August Bank Holiday"); - - lh.addStaticHoliday ("26-DEC-2016", "Boxing Day"); - - lh.addStaticHoliday ("27-DEC-2016", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "May Day"); - - lh.addStaticHoliday ("29-MAY-2017", "Spring Bank Holiday"); - - lh.addStaticHoliday ("28-AUG-2017", "August Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("07-MAY-2018", "May Day"); - - lh.addStaticHoliday ("28-MAY-2018", "Spring Bank Holiday"); - - lh.addStaticHoliday ("27-AUG-2018", "August Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("06-MAY-2019", "May Day"); - - lh.addStaticHoliday ("27-MAY-2019", "Spring Bank Holiday"); - - lh.addStaticHoliday ("26-AUG-2019", "August Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("04-MAY-2020", "May Day"); - - lh.addStaticHoliday ("25-MAY-2020", "Spring Bank Holiday"); - - lh.addStaticHoliday ("31-AUG-2020", "August Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2020", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2021", "May Day"); - - lh.addStaticHoliday ("31-MAY-2021", "Spring Bank Holiday"); - - lh.addStaticHoliday ("30-AUG-2021", "August Bank Holiday"); - - lh.addStaticHoliday ("27-DEC-2021", "Boxing Day Observed"); - - lh.addStaticHoliday ("28-DEC-2021", "Christmas Day Observed"); - - lh.addStaticHoliday ("03-JAN-2022", "New Years Day Observed"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2022", "May Day"); - - lh.addStaticHoliday ("30-MAY-2022", "Spring Bank Holiday"); - - lh.addStaticHoliday ("29-AUG-2022", "August Bank Holiday"); - - lh.addStaticHoliday ("26-DEC-2022", "Boxing Day"); - - lh.addStaticHoliday ("27-DEC-2022", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "May Day"); - - lh.addStaticHoliday ("29-MAY-2023", "Spring Bank Holiday"); - - lh.addStaticHoliday ("28-AUG-2023", "August Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("06-MAY-2024", "May Day"); - - lh.addStaticHoliday ("27-MAY-2024", "Spring Bank Holiday"); - - lh.addStaticHoliday ("26-AUG-2024", "August Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2025", "May Day"); - - lh.addStaticHoliday ("26-MAY-2025", "Spring Bank Holiday"); - - lh.addStaticHoliday ("25-AUG-2025", "August Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("04-MAY-2026", "May Day"); - - lh.addStaticHoliday ("25-MAY-2026", "Spring Bank Holiday"); - - lh.addStaticHoliday ("31-AUG-2026", "August Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2026", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2027", "May Day"); - - lh.addStaticHoliday ("31-MAY-2027", "Spring Bank Holiday"); - - lh.addStaticHoliday ("30-AUG-2027", "August Bank Holiday"); - - lh.addStaticHoliday ("27-DEC-2027", "Boxing Day Observed"); - - lh.addStaticHoliday ("28-DEC-2027", "Christmas Day Observed"); - - lh.addStaticHoliday ("03-JAN-2028", "New Years Day Observed"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2028", "May Day"); - - lh.addStaticHoliday ("29-MAY-2028", "Spring Bank Holiday"); - - lh.addStaticHoliday ("28-AUG-2028", "August Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2029", "Holiday"); - - lh.addStaticHoliday ("30-MAR-2029", "Holiday"); - - lh.addStaticHoliday ("02-APR-2029", "Holiday"); - - lh.addStaticHoliday ("07-MAY-2029", "Holiday"); - - lh.addStaticHoliday ("28-MAY-2029", "Holiday"); - - lh.addStaticHoliday ("27-AUG-2029", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2029", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2029", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2030", "Holiday"); - - lh.addStaticHoliday ("19-APR-2030", "Holiday"); - - lh.addStaticHoliday ("22-APR-2030", "Holiday"); - - lh.addStaticHoliday ("06-MAY-2030", "Holiday"); - - lh.addStaticHoliday ("27-MAY-2030", "Holiday"); - - lh.addStaticHoliday ("26-AUG-2030", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2030", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2030", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2031", "Holiday"); - - lh.addStaticHoliday ("11-APR-2031", "Holiday"); - - lh.addStaticHoliday ("14-APR-2031", "Holiday"); - - lh.addStaticHoliday ("05-MAY-2031", "Holiday"); - - lh.addStaticHoliday ("26-MAY-2031", "Holiday"); - - lh.addStaticHoliday ("25-AUG-2031", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2031", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2031", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2032", "Holiday"); - - lh.addStaticHoliday ("26-MAR-2032", "Holiday"); - - lh.addStaticHoliday ("29-MAR-2032", "Holiday"); - - lh.addStaticHoliday ("03-MAY-2032", "Holiday"); - - lh.addStaticHoliday ("31-MAY-2032", "Holiday"); - - lh.addStaticHoliday ("30-AUG-2032", "Holiday"); - - lh.addStaticHoliday ("27-DEC-2032", "Holiday"); - - lh.addStaticHoliday ("28-DEC-2032", "Holiday"); - - lh.addStaticHoliday ("03-JAN-2033", "Holiday"); - - lh.addStaticHoliday ("15-APR-2033", "Holiday"); - - lh.addStaticHoliday ("18-APR-2033", "Holiday"); - - lh.addStaticHoliday ("02-MAY-2033", "Holiday"); - - lh.addStaticHoliday ("30-MAY-2033", "Holiday"); - - lh.addStaticHoliday ("29-AUG-2033", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2033", "Holiday"); - - lh.addStaticHoliday ("27-DEC-2033", "Holiday"); - - lh.addStaticHoliday ("02-JAN-2034", "Holiday"); - - lh.addStaticHoliday ("07-APR-2034", "Holiday"); - - lh.addStaticHoliday ("10-APR-2034", "Holiday"); - - lh.addStaticHoliday ("01-MAY-2034", "Holiday"); - - lh.addStaticHoliday ("29-MAY-2034", "Holiday"); - - lh.addStaticHoliday ("28-AUG-2034", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2034", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2034", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2035", "Holiday"); - - lh.addStaticHoliday ("23-MAR-2035", "Holiday"); - - lh.addStaticHoliday ("26-MAR-2035", "Holiday"); - - lh.addStaticHoliday ("07-MAY-2035", "Holiday"); - - lh.addStaticHoliday ("28-MAY-2035", "Holiday"); - - lh.addStaticHoliday ("27-AUG-2035", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2035", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2035", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2036", "Holiday"); - - lh.addStaticHoliday ("11-APR-2036", "Holiday"); - - lh.addStaticHoliday ("14-APR-2036", "Holiday"); - - lh.addStaticHoliday ("05-MAY-2036", "Holiday"); - - lh.addStaticHoliday ("26-MAY-2036", "Holiday"); - - lh.addStaticHoliday ("25-AUG-2036", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2036", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2036", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2037", "Holiday"); - - lh.addStaticHoliday ("03-APR-2037", "Holiday"); - - lh.addStaticHoliday ("06-APR-2037", "Holiday"); - - lh.addStaticHoliday ("04-MAY-2037", "Holiday"); - - lh.addStaticHoliday ("25-MAY-2037", "Holiday"); - - lh.addStaticHoliday ("31-AUG-2037", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2037", "Holiday"); - - lh.addStaticHoliday ("28-DEC-2037", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2038", "Holiday"); - - lh.addStaticHoliday ("23-APR-2038", "Holiday"); - - lh.addStaticHoliday ("26-APR-2038", "Holiday"); - - lh.addStaticHoliday ("03-MAY-2038", "Holiday"); - - lh.addStaticHoliday ("31-MAY-2038", "Holiday"); - - lh.addStaticHoliday ("30-AUG-2038", "Holiday"); - - lh.addStaticHoliday ("27-DEC-2038", "Holiday"); - - lh.addStaticHoliday ("28-DEC-2038", "Holiday"); - - lh.addStaticHoliday ("03-JAN-2039", "Holiday"); - - lh.addStaticHoliday ("08-APR-2039", "Holiday"); - - lh.addStaticHoliday ("11-APR-2039", "Holiday"); - - lh.addStaticHoliday ("02-MAY-2039", "Holiday"); - - lh.addStaticHoliday ("30-MAY-2039", "Holiday"); - - lh.addStaticHoliday ("29-AUG-2039", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2039", "Holiday"); - - lh.addStaticHoliday ("27-DEC-2039", "Holiday"); - - lh.addStaticHoliday ("02-JAN-2040", "Holiday"); - - lh.addStaticHoliday ("30-MAR-2040", "Holiday"); - - lh.addStaticHoliday ("02-APR-2040", "Holiday"); - - lh.addStaticHoliday ("07-MAY-2040", "Holiday"); - - lh.addStaticHoliday ("28-MAY-2040", "Holiday"); - - lh.addStaticHoliday ("27-AUG-2040", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2040", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2040", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2041", "Holiday"); - - lh.addStaticHoliday ("19-APR-2041", "Holiday"); - - lh.addStaticHoliday ("22-APR-2041", "Holiday"); - - lh.addStaticHoliday ("06-MAY-2041", "Holiday"); - - lh.addStaticHoliday ("27-MAY-2041", "Holiday"); - - lh.addStaticHoliday ("26-AUG-2041", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2041", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2041", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2042", "Holiday"); - - lh.addStaticHoliday ("04-APR-2042", "Holiday"); - - lh.addStaticHoliday ("07-APR-2042", "Holiday"); - - lh.addStaticHoliday ("05-MAY-2042", "Holiday"); - - lh.addStaticHoliday ("26-MAY-2042", "Holiday"); - - lh.addStaticHoliday ("25-AUG-2042", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2042", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2042", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2043", "Holiday"); - - lh.addStaticHoliday ("27-MAR-2043", "Holiday"); - - lh.addStaticHoliday ("30-MAR-2043", "Holiday"); - - lh.addStaticHoliday ("04-MAY-2043", "Holiday"); - - lh.addStaticHoliday ("25-MAY-2043", "Holiday"); - - lh.addStaticHoliday ("31-AUG-2043", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2043", "Holiday"); - - lh.addStaticHoliday ("28-DEC-2043", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2044", "Holiday"); - - lh.addStaticHoliday ("15-APR-2044", "Holiday"); - - lh.addStaticHoliday ("18-APR-2044", "Holiday"); - - lh.addStaticHoliday ("02-MAY-2044", "Holiday"); - - lh.addStaticHoliday ("30-MAY-2044", "Holiday"); - - lh.addStaticHoliday ("29-AUG-2044", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2044", "Holiday"); - - lh.addStaticHoliday ("27-DEC-2044", "Holiday"); - - lh.addStaticHoliday ("02-JAN-2045", "Holiday"); - - lh.addStaticHoliday ("07-APR-2045", "Holiday"); - - lh.addStaticHoliday ("10-APR-2045", "Holiday"); - - lh.addStaticHoliday ("01-MAY-2045", "Holiday"); - - lh.addStaticHoliday ("29-MAY-2045", "Holiday"); - - lh.addStaticHoliday ("28-AUG-2045", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2045", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2045", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2046", "Holiday"); - - lh.addStaticHoliday ("23-MAR-2046", "Holiday"); - - lh.addStaticHoliday ("26-MAR-2046", "Holiday"); - - lh.addStaticHoliday ("07-MAY-2046", "Holiday"); - - lh.addStaticHoliday ("28-MAY-2046", "Holiday"); - - lh.addStaticHoliday ("27-AUG-2046", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2046", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2046", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2047", "Holiday"); - - lh.addStaticHoliday ("12-APR-2047", "Holiday"); - - lh.addStaticHoliday ("15-APR-2047", "Holiday"); - - lh.addStaticHoliday ("06-MAY-2047", "Holiday"); - - lh.addStaticHoliday ("27-MAY-2047", "Holiday"); - - lh.addStaticHoliday ("26-AUG-2047", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2047", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2047", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2048", "Holiday"); - - lh.addStaticHoliday ("03-APR-2048", "Holiday"); - - lh.addStaticHoliday ("06-APR-2048", "Holiday"); - - lh.addStaticHoliday ("04-MAY-2048", "Holiday"); - - lh.addStaticHoliday ("25-MAY-2048", "Holiday"); - - lh.addStaticHoliday ("31-AUG-2048", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2048", "Holiday"); - - lh.addStaticHoliday ("28-DEC-2048", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2049", "Holiday"); - - lh.addStaticHoliday ("16-APR-2049", "Holiday"); - - lh.addStaticHoliday ("19-APR-2049", "Holiday"); - - lh.addStaticHoliday ("03-MAY-2049", "Holiday"); - - lh.addStaticHoliday ("31-MAY-2049", "Holiday"); - - lh.addStaticHoliday ("30-AUG-2049", "Holiday"); - - lh.addStaticHoliday ("27-DEC-2049", "Holiday"); - - lh.addStaticHoliday ("28-DEC-2049", "Holiday"); - - lh.addStaticHoliday ("03-JAN-2050", "Holiday"); - - lh.addStaticHoliday ("08-APR-2050", "Holiday"); - - lh.addStaticHoliday ("11-APR-2050", "Holiday"); - - lh.addStaticHoliday ("02-MAY-2050", "Holiday"); - - lh.addStaticHoliday ("30-MAY-2050", "Holiday"); - - lh.addStaticHoliday ("29-AUG-2050", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2050", "Holiday"); - - lh.addStaticHoliday ("27-DEC-2050", "Holiday"); - - lh.addStaticHoliday ("02-JAN-2051", "Holiday"); - - lh.addStaticHoliday ("31-MAR-2051", "Holiday"); - - lh.addStaticHoliday ("03-APR-2051", "Holiday"); - - lh.addStaticHoliday ("01-MAY-2051", "Holiday"); - - lh.addStaticHoliday ("29-MAY-2051", "Holiday"); - - lh.addStaticHoliday ("28-AUG-2051", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2051", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2051", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2052", "Holiday"); - - lh.addStaticHoliday ("19-APR-2052", "Holiday"); - - lh.addStaticHoliday ("22-APR-2052", "Holiday"); - - lh.addStaticHoliday ("06-MAY-2052", "Holiday"); - - lh.addStaticHoliday ("27-MAY-2052", "Holiday"); - - lh.addStaticHoliday ("26-AUG-2052", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2052", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2052", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2053", "Holiday"); - - lh.addStaticHoliday ("04-APR-2053", "Holiday"); - - lh.addStaticHoliday ("07-APR-2053", "Holiday"); - - lh.addStaticHoliday ("05-MAY-2053", "Holiday"); - - lh.addStaticHoliday ("26-MAY-2053", "Holiday"); - - lh.addStaticHoliday ("25-AUG-2053", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2053", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2053", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2054", "Holiday"); - - lh.addStaticHoliday ("27-MAR-2054", "Holiday"); - - lh.addStaticHoliday ("30-MAR-2054", "Holiday"); - - lh.addStaticHoliday ("04-MAY-2054", "Holiday"); - - lh.addStaticHoliday ("25-MAY-2054", "Holiday"); - - lh.addStaticHoliday ("31-AUG-2054", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2054", "Holiday"); - - lh.addStaticHoliday ("28-DEC-2054", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2055", "Holiday"); - - lh.addStaticHoliday ("16-APR-2055", "Holiday"); - - lh.addStaticHoliday ("19-APR-2055", "Holiday"); - - lh.addStaticHoliday ("03-MAY-2055", "Holiday"); - - lh.addStaticHoliday ("31-MAY-2055", "Holiday"); - - lh.addStaticHoliday ("30-AUG-2055", "Holiday"); - - lh.addStaticHoliday ("27-DEC-2055", "Holiday"); - - lh.addStaticHoliday ("28-DEC-2055", "Holiday"); - - lh.addStaticHoliday ("03-JAN-2056", "Holiday"); - - lh.addStaticHoliday ("31-MAR-2056", "Holiday"); - - lh.addStaticHoliday ("03-APR-2056", "Holiday"); - - lh.addStaticHoliday ("01-MAY-2056", "Holiday"); - - lh.addStaticHoliday ("29-MAY-2056", "Holiday"); - - lh.addStaticHoliday ("28-AUG-2056", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2056", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2056", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2057", "Holiday"); - - lh.addStaticHoliday ("20-APR-2057", "Holiday"); - - lh.addStaticHoliday ("23-APR-2057", "Holiday"); - - lh.addStaticHoliday ("07-MAY-2057", "Holiday"); - - lh.addStaticHoliday ("28-MAY-2057", "Holiday"); - - lh.addStaticHoliday ("27-AUG-2057", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2057", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2057", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2058", "Holiday"); - - lh.addStaticHoliday ("12-APR-2058", "Holiday"); - - lh.addStaticHoliday ("15-APR-2058", "Holiday"); - - lh.addStaticHoliday ("06-MAY-2058", "Holiday"); - - lh.addStaticHoliday ("27-MAY-2058", "Holiday"); - - lh.addStaticHoliday ("26-AUG-2058", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2058", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2058", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2059", "Holiday"); - - lh.addStaticHoliday ("28-MAR-2059", "Holiday"); - - lh.addStaticHoliday ("31-MAR-2059", "Holiday"); - - lh.addStaticHoliday ("05-MAY-2059", "Holiday"); - - lh.addStaticHoliday ("26-MAY-2059", "Holiday"); - - lh.addStaticHoliday ("25-AUG-2059", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2059", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2059", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2060", "Holiday"); - - lh.addStaticHoliday ("16-APR-2060", "Holiday"); - - lh.addStaticHoliday ("19-APR-2060", "Holiday"); - - lh.addStaticHoliday ("03-MAY-2060", "Holiday"); - - lh.addStaticHoliday ("31-MAY-2060", "Holiday"); - - lh.addStaticHoliday ("30-AUG-2060", "Holiday"); - - lh.addStaticHoliday ("27-DEC-2060", "Holiday"); - - lh.addStaticHoliday ("28-DEC-2060", "Holiday"); - - lh.addStaticHoliday ("03-JAN-2061", "Holiday"); - - lh.addStaticHoliday ("08-APR-2061", "Holiday"); - - lh.addStaticHoliday ("11-APR-2061", "Holiday"); - - lh.addStaticHoliday ("02-MAY-2061", "Holiday"); - - lh.addStaticHoliday ("30-MAY-2061", "Holiday"); - - lh.addStaticHoliday ("29-AUG-2061", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2061", "Holiday"); - - lh.addStaticHoliday ("27-DEC-2061", "Holiday"); - - lh.addStaticHoliday ("02-JAN-2062", "Holiday"); - - lh.addStaticHoliday ("24-MAR-2062", "Holiday"); - - lh.addStaticHoliday ("27-MAR-2062", "Holiday"); - - lh.addStaticHoliday ("01-MAY-2062", "Holiday"); - - lh.addStaticHoliday ("29-MAY-2062", "Holiday"); - - lh.addStaticHoliday ("28-AUG-2062", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2062", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2062", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2063", "Holiday"); - - lh.addStaticHoliday ("13-APR-2063", "Holiday"); - - lh.addStaticHoliday ("16-APR-2063", "Holiday"); - - lh.addStaticHoliday ("07-MAY-2063", "Holiday"); - - lh.addStaticHoliday ("28-MAY-2063", "Holiday"); - - lh.addStaticHoliday ("27-AUG-2063", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2063", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2063", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2064", "Holiday"); - - lh.addStaticHoliday ("04-APR-2064", "Holiday"); - - lh.addStaticHoliday ("07-APR-2064", "Holiday"); - - lh.addStaticHoliday ("05-MAY-2064", "Holiday"); - - lh.addStaticHoliday ("26-MAY-2064", "Holiday"); - - lh.addStaticHoliday ("25-AUG-2064", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2064", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2064", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2065", "Holiday"); - - lh.addStaticHoliday ("27-MAR-2065", "Holiday"); - - lh.addStaticHoliday ("30-MAR-2065", "Holiday"); - - lh.addStaticHoliday ("04-MAY-2065", "Holiday"); - - lh.addStaticHoliday ("25-MAY-2065", "Holiday"); - - lh.addStaticHoliday ("31-AUG-2065", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2065", "Holiday"); - - lh.addStaticHoliday ("28-DEC-2065", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2066", "Holiday"); - - lh.addStaticHoliday ("09-APR-2066", "Holiday"); - - lh.addStaticHoliday ("12-APR-2066", "Holiday"); - - lh.addStaticHoliday ("03-MAY-2066", "Holiday"); - - lh.addStaticHoliday ("31-MAY-2066", "Holiday"); - - lh.addStaticHoliday ("30-AUG-2066", "Holiday"); - - lh.addStaticHoliday ("27-DEC-2066", "Holiday"); - - lh.addStaticHoliday ("28-DEC-2066", "Holiday"); - - lh.addStaticHoliday ("03-JAN-2067", "Holiday"); - - lh.addStaticHoliday ("01-APR-2067", "Holiday"); - - lh.addStaticHoliday ("04-APR-2067", "Holiday"); - - lh.addStaticHoliday ("02-MAY-2067", "Holiday"); - - lh.addStaticHoliday ("30-MAY-2067", "Holiday"); - - lh.addStaticHoliday ("29-AUG-2067", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2067", "Holiday"); - - lh.addStaticHoliday ("27-DEC-2067", "Holiday"); - - lh.addStaticHoliday ("02-JAN-2068", "Holiday"); - - lh.addStaticHoliday ("20-APR-2068", "Holiday"); - - lh.addStaticHoliday ("23-APR-2068", "Holiday"); - - lh.addStaticHoliday ("07-MAY-2068", "Holiday"); - - lh.addStaticHoliday ("28-MAY-2068", "Holiday"); - - lh.addStaticHoliday ("27-AUG-2068", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2068", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2068", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2069", "Holiday"); - - lh.addStaticHoliday ("12-APR-2069", "Holiday"); - - lh.addStaticHoliday ("15-APR-2069", "Holiday"); - - lh.addStaticHoliday ("06-MAY-2069", "Holiday"); - - lh.addStaticHoliday ("27-MAY-2069", "Holiday"); - - lh.addStaticHoliday ("26-AUG-2069", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2069", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2069", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2070", "Holiday"); - - lh.addStaticHoliday ("28-MAR-2070", "Holiday"); - - lh.addStaticHoliday ("31-MAR-2070", "Holiday"); - - lh.addStaticHoliday ("05-MAY-2070", "Holiday"); - - lh.addStaticHoliday ("26-MAY-2070", "Holiday"); - - lh.addStaticHoliday ("25-AUG-2070", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2070", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2070", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2071", "Holiday"); - - lh.addStaticHoliday ("17-APR-2071", "Holiday"); - - lh.addStaticHoliday ("20-APR-2071", "Holiday"); - - lh.addStaticHoliday ("04-MAY-2071", "Holiday"); - - lh.addStaticHoliday ("25-MAY-2071", "Holiday"); - - lh.addStaticHoliday ("31-AUG-2071", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2071", "Holiday"); - - lh.addStaticHoliday ("28-DEC-2071", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2072", "Holiday"); - - lh.addStaticHoliday ("08-APR-2072", "Holiday"); - - lh.addStaticHoliday ("11-APR-2072", "Holiday"); - - lh.addStaticHoliday ("02-MAY-2072", "Holiday"); - - lh.addStaticHoliday ("30-MAY-2072", "Holiday"); - - lh.addStaticHoliday ("29-AUG-2072", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2072", "Holiday"); - - lh.addStaticHoliday ("27-DEC-2072", "Holiday"); - - lh.addStaticHoliday ("02-JAN-2073", "Holiday"); - - lh.addStaticHoliday ("24-MAR-2073", "Holiday"); - - lh.addStaticHoliday ("27-MAR-2073", "Holiday"); - - lh.addStaticHoliday ("01-MAY-2073", "Holiday"); - - lh.addStaticHoliday ("29-MAY-2073", "Holiday"); - - lh.addStaticHoliday ("28-AUG-2073", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2073", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2073", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2074", "Holiday"); - - lh.addStaticHoliday ("13-APR-2074", "Holiday"); - - lh.addStaticHoliday ("16-APR-2074", "Holiday"); - - lh.addStaticHoliday ("07-MAY-2074", "Holiday"); - - lh.addStaticHoliday ("28-MAY-2074", "Holiday"); - - lh.addStaticHoliday ("27-AUG-2074", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2074", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2074", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2075", "Holiday"); - - lh.addStaticHoliday ("05-APR-2075", "Holiday"); - - lh.addStaticHoliday ("08-APR-2075", "Holiday"); - - lh.addStaticHoliday ("06-MAY-2075", "Holiday"); - - lh.addStaticHoliday ("27-MAY-2075", "Holiday"); - - lh.addStaticHoliday ("26-AUG-2075", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2075", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2075", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2076", "Holiday"); - - lh.addStaticHoliday ("17-APR-2076", "Holiday"); - - lh.addStaticHoliday ("20-APR-2076", "Holiday"); - - lh.addStaticHoliday ("04-MAY-2076", "Holiday"); - - lh.addStaticHoliday ("25-MAY-2076", "Holiday"); - - lh.addStaticHoliday ("31-AUG-2076", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2076", "Holiday"); - - lh.addStaticHoliday ("28-DEC-2076", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2077", "Holiday"); - - lh.addStaticHoliday ("09-APR-2077", "Holiday"); - - lh.addStaticHoliday ("12-APR-2077", "Holiday"); - - lh.addStaticHoliday ("03-MAY-2077", "Holiday"); - - lh.addStaticHoliday ("31-MAY-2077", "Holiday"); - - lh.addStaticHoliday ("30-AUG-2077", "Holiday"); - - lh.addStaticHoliday ("27-DEC-2077", "Holiday"); - - lh.addStaticHoliday ("28-DEC-2077", "Holiday"); - - lh.addStaticHoliday ("03-JAN-2078", "Holiday"); - - lh.addStaticHoliday ("01-APR-2078", "Holiday"); - - lh.addStaticHoliday ("04-APR-2078", "Holiday"); - - lh.addStaticHoliday ("02-MAY-2078", "Holiday"); - - lh.addStaticHoliday ("30-MAY-2078", "Holiday"); - - lh.addStaticHoliday ("29-AUG-2078", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2078", "Holiday"); - - lh.addStaticHoliday ("27-DEC-2078", "Holiday"); - - lh.addStaticHoliday ("02-JAN-2079", "Holiday"); - - lh.addStaticHoliday ("21-APR-2079", "Holiday"); - - lh.addStaticHoliday ("24-APR-2079", "Holiday"); - - lh.addStaticHoliday ("01-MAY-2079", "Holiday"); - - lh.addStaticHoliday ("29-MAY-2079", "Holiday"); - - lh.addStaticHoliday ("28-AUG-2079", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2079", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2079", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2080", "Holiday"); - - lh.addStaticHoliday ("05-APR-2080", "Holiday"); - - lh.addStaticHoliday ("08-APR-2080", "Holiday"); - - lh.addStaticHoliday ("06-MAY-2080", "Holiday"); - - lh.addStaticHoliday ("27-MAY-2080", "Holiday"); - - lh.addStaticHoliday ("26-AUG-2080", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2080", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2080", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2081", "Holiday"); - - lh.addStaticHoliday ("28-MAR-2081", "Holiday"); - - lh.addStaticHoliday ("31-MAR-2081", "Holiday"); - - lh.addStaticHoliday ("05-MAY-2081", "Holiday"); - - lh.addStaticHoliday ("26-MAY-2081", "Holiday"); - - lh.addStaticHoliday ("25-AUG-2081", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2081", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2081", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2082", "Holiday"); - - lh.addStaticHoliday ("17-APR-2082", "Holiday"); - - lh.addStaticHoliday ("20-APR-2082", "Holiday"); - - lh.addStaticHoliday ("04-MAY-2082", "Holiday"); - - lh.addStaticHoliday ("25-MAY-2082", "Holiday"); - - lh.addStaticHoliday ("31-AUG-2082", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2082", "Holiday"); - - lh.addStaticHoliday ("28-DEC-2082", "Holiday"); - - lh.addStaticHoliday ("01-JAN-2083", "Holiday"); - - lh.addStaticHoliday ("02-APR-2083", "Holiday"); - - lh.addStaticHoliday ("05-APR-2083", "Holiday"); - - lh.addStaticHoliday ("03-MAY-2083", "Holiday"); - - lh.addStaticHoliday ("31-MAY-2083", "Holiday"); - - lh.addStaticHoliday ("30-AUG-2083", "Holiday"); - - lh.addStaticHoliday ("27-DEC-2083", "Holiday"); - - lh.addStaticHoliday ("28-DEC-2083", "Holiday"); - - lh.addStaticHoliday ("03-JAN-2084", "Holiday"); - - lh.addStaticHoliday ("24-MAR-2084", "Holiday"); - - lh.addStaticHoliday ("27-MAR-2084", "Holiday"); - - lh.addStaticHoliday ("01-MAY-2084", "Holiday"); - - lh.addStaticHoliday ("29-MAY-2084", "Holiday"); - - lh.addStaticHoliday ("28-AUG-2084", "Holiday"); - - lh.addStaticHoliday ("25-DEC-2084", "Holiday"); - - lh.addStaticHoliday ("26-DEC-2084", "Holiday"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/GELHoliday.java b/org/drip/analytics/holset/GELHoliday.java deleted file mode 100644 index c66e213..0000000 --- a/org/drip/analytics/holset/GELHoliday.java +++ /dev/null @@ -1,469 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class GELHoliday implements org.drip.analytics.holset.LocationHoliday { - public GELHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "GEL"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-1998", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("19-JAN-1998", "Christening Day"); - - lh.addStaticHoliday ("03-MAR-1998", "Mothers Day"); - - lh.addStaticHoliday ("26-MAY-1998", "Independence Day"); - - lh.addStaticHoliday ("24-AUG-1998", "Constitution Day"); - - lh.addStaticHoliday ("28-AUG-1998", "Mariamoba"); - - lh.addStaticHoliday ("14-OCT-1998", "Svetitskhovloba"); - - lh.addStaticHoliday ("23-NOV-1998", "St. Georges Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-1999", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("19-JAN-1999", "Christening Day"); - - lh.addStaticHoliday ("03-MAR-1999", "Mothers Day"); - - lh.addStaticHoliday ("09-APR-1999", "Memorial Day"); - - lh.addStaticHoliday ("26-MAY-1999", "Independence Day"); - - lh.addStaticHoliday ("24-AUG-1999", "Constitution Day"); - - lh.addStaticHoliday ("14-OCT-1999", "Svetitskhovloba"); - - lh.addStaticHoliday ("23-NOV-1999", "St. Georges Day"); - - lh.addStaticHoliday ("07-JAN-2000", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("19-JAN-2000", "Christening Day"); - - lh.addStaticHoliday ("03-MAR-2000", "Mothers Day"); - - lh.addStaticHoliday ("26-MAY-2000", "Independence Day"); - - lh.addStaticHoliday ("24-AUG-2000", "Constitution Day"); - - lh.addStaticHoliday ("28-AUG-2000", "Mariamoba"); - - lh.addStaticHoliday ("23-NOV-2000", "St. Georges Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2001", "Christening Day"); - - lh.addStaticHoliday ("24-AUG-2001", "Constitution Day"); - - lh.addStaticHoliday ("28-AUG-2001", "Mariamoba"); - - lh.addStaticHoliday ("23-NOV-2001", "St. Georges Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2002", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("28-AUG-2002", "Mariamoba"); - - lh.addStaticHoliday ("14-OCT-2002", "Svetitskhovloba"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2003", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("03-MAR-2003", "Mothers Day"); - - lh.addStaticHoliday ("26-MAY-2003", "Independence Day"); - - lh.addStaticHoliday ("28-AUG-2003", "Mariamoba"); - - lh.addStaticHoliday ("14-OCT-2003", "Svetitskhovloba"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2004", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("19-JAN-2004", "Christening Day"); - - lh.addStaticHoliday ("03-MAR-2004", "Mothers Day"); - - lh.addStaticHoliday ("26-MAY-2004", "Independence Day"); - - lh.addStaticHoliday ("24-AUG-2004", "Constitution Day"); - - lh.addStaticHoliday ("14-OCT-2004", "Svetitskhovloba"); - - lh.addStaticHoliday ("23-NOV-2004", "St. Georges Day"); - - lh.addStaticHoliday ("07-JAN-2005", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("19-JAN-2005", "Christening Day"); - - lh.addStaticHoliday ("03-MAR-2005", "Mothers Day"); - - lh.addStaticHoliday ("26-MAY-2005", "Independence Day"); - - lh.addStaticHoliday ("24-AUG-2005", "Constitution Day"); - - lh.addStaticHoliday ("14-OCT-2005", "Svetitskhovloba"); - - lh.addStaticHoliday ("23-NOV-2005", "St. Georges Day"); - - lh.addStaticHoliday ("19-JAN-2006", "Christening Day"); - - lh.addStaticHoliday ("03-MAR-2006", "Mothers Day"); - - lh.addStaticHoliday ("26-MAY-2006", "Independence Day"); - - lh.addStaticHoliday ("24-AUG-2006", "Constitution Day"); - - lh.addStaticHoliday ("28-AUG-2006", "Mariamoba"); - - lh.addStaticHoliday ("23-NOV-2006", "St. Georges Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2007", "Christening Day"); - - lh.addStaticHoliday ("24-AUG-2007", "Constitution Day"); - - lh.addStaticHoliday ("28-AUG-2007", "Mariamoba"); - - lh.addStaticHoliday ("23-NOV-2007", "St. Georges Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2008", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("03-MAR-2008", "Mothers Day"); - - lh.addStaticHoliday ("26-MAY-2008", "Independence Day"); - - lh.addStaticHoliday ("28-AUG-2008", "Mariamoba"); - - lh.addStaticHoliday ("14-OCT-2008", "Svetitskhovloba"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2009", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("19-JAN-2009", "Christening Day"); - - lh.addStaticHoliday ("03-MAR-2009", "Mothers Day"); - - lh.addStaticHoliday ("26-MAY-2009", "Independence Day"); - - lh.addStaticHoliday ("24-AUG-2009", "Constitution Day"); - - lh.addStaticHoliday ("28-AUG-2009", "Mariamoba"); - - lh.addStaticHoliday ("14-OCT-2009", "Svetitskhovloba"); - - lh.addStaticHoliday ("23-NOV-2009", "St. Georges Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2010", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("19-JAN-2010", "Christening Day"); - - lh.addStaticHoliday ("03-MAR-2010", "Mothers Day"); - - lh.addStaticHoliday ("26-MAY-2010", "Independence Day"); - - lh.addStaticHoliday ("24-AUG-2010", "Constitution Day"); - - lh.addStaticHoliday ("14-OCT-2010", "Svetitskhovloba"); - - lh.addStaticHoliday ("23-NOV-2010", "St. Georges Day"); - - lh.addStaticHoliday ("07-JAN-2011", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("19-JAN-2011", "Christening Day"); - - lh.addStaticHoliday ("03-MAR-2011", "Mothers Day"); - - lh.addStaticHoliday ("26-MAY-2011", "Independence Day"); - - lh.addStaticHoliday ("24-AUG-2011", "Constitution Day"); - - lh.addStaticHoliday ("14-OCT-2011", "Svetitskhovloba"); - - lh.addStaticHoliday ("23-NOV-2011", "St. Georges Day"); - - lh.addStaticHoliday ("19-JAN-2012", "Christening Day"); - - lh.addStaticHoliday ("24-AUG-2012", "Constitution Day"); - - lh.addStaticHoliday ("28-AUG-2012", "Mariamoba"); - - lh.addStaticHoliday ("23-NOV-2012", "St. Georges Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2013", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("28-AUG-2013", "Mariamoba"); - - lh.addStaticHoliday ("14-OCT-2013", "Svetitskhovloba"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2014", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("03-MAR-2014", "Mothers Day"); - - lh.addStaticHoliday ("26-MAY-2014", "Independence Day"); - - lh.addStaticHoliday ("28-AUG-2014", "Mariamoba"); - - lh.addStaticHoliday ("14-OCT-2014", "Svetitskhovloba"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2015", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("19-JAN-2015", "Christening Day"); - - lh.addStaticHoliday ("03-MAR-2015", "Mothers Day"); - - lh.addStaticHoliday ("26-MAY-2015", "Independence Day"); - - lh.addStaticHoliday ("24-AUG-2015", "Constitution Day"); - - lh.addStaticHoliday ("28-AUG-2015", "Mariamoba"); - - lh.addStaticHoliday ("14-OCT-2015", "Svetitskhovloba"); - - lh.addStaticHoliday ("23-NOV-2015", "St. Georges Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2016", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("19-JAN-2016", "Christening Day"); - - lh.addStaticHoliday ("03-MAR-2016", "Mothers Day"); - - lh.addStaticHoliday ("26-MAY-2016", "Independence Day"); - - lh.addStaticHoliday ("24-AUG-2016", "Constitution Day"); - - lh.addStaticHoliday ("14-OCT-2016", "Svetitskhovloba"); - - lh.addStaticHoliday ("23-NOV-2016", "St. Georges Day"); - - lh.addStaticHoliday ("19-JAN-2017", "Christening Day"); - - lh.addStaticHoliday ("03-MAR-2017", "Mothers Day"); - - lh.addStaticHoliday ("26-MAY-2017", "Independence Day"); - - lh.addStaticHoliday ("24-AUG-2017", "Constitution Day"); - - lh.addStaticHoliday ("28-AUG-2017", "Mariamoba"); - - lh.addStaticHoliday ("23-NOV-2017", "St. Georges Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2018", "Christening Day"); - - lh.addStaticHoliday ("24-AUG-2018", "Constitution Day"); - - lh.addStaticHoliday ("28-AUG-2018", "Mariamoba"); - - lh.addStaticHoliday ("23-NOV-2018", "St. Georges Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2019", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("28-AUG-2019", "Mariamoba"); - - lh.addStaticHoliday ("14-OCT-2019", "Svetitskhovloba"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2020", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("03-MAR-2020", "Mothers Day"); - - lh.addStaticHoliday ("26-MAY-2020", "Independence Day"); - - lh.addStaticHoliday ("24-AUG-2020", "Constitution Day"); - - lh.addStaticHoliday ("28-AUG-2020", "Mariamoba"); - - lh.addStaticHoliday ("14-OCT-2020", "Svetitskhovloba"); - - lh.addStaticHoliday ("23-NOV-2020", "St. Georges Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2021", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("19-JAN-2021", "Christening Day"); - - lh.addStaticHoliday ("03-MAR-2021", "Mothers Day"); - - lh.addStaticHoliday ("26-MAY-2021", "Independence Day"); - - lh.addStaticHoliday ("24-AUG-2021", "Constitution Day"); - - lh.addStaticHoliday ("14-OCT-2021", "Svetitskhovloba"); - - lh.addStaticHoliday ("23-NOV-2021", "St. Georges Day"); - - lh.addStaticHoliday ("07-JAN-2022", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("19-JAN-2022", "Christening Day"); - - lh.addStaticHoliday ("03-MAR-2022", "Mothers Day"); - - lh.addStaticHoliday ("26-MAY-2022", "Independence Day"); - - lh.addStaticHoliday ("24-AUG-2022", "Constitution Day"); - - lh.addStaticHoliday ("14-OCT-2022", "Svetitskhovloba"); - - lh.addStaticHoliday ("23-NOV-2022", "St. Georges Day"); - - lh.addStaticHoliday ("19-JAN-2023", "Christening Day"); - - lh.addStaticHoliday ("03-MAR-2023", "Mothers Day"); - - lh.addStaticHoliday ("26-MAY-2023", "Independence Day"); - - lh.addStaticHoliday ("24-AUG-2023", "Constitution Day"); - - lh.addStaticHoliday ("28-AUG-2023", "Mariamoba"); - - lh.addStaticHoliday ("23-NOV-2023", "St. Georges Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2024", "Christening Day"); - - lh.addStaticHoliday ("28-AUG-2024", "Mariamoba"); - - lh.addStaticHoliday ("14-OCT-2024", "Svetitskhovloba"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2025", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("03-MAR-2025", "Mothers Day"); - - lh.addStaticHoliday ("26-MAY-2025", "Independence Day"); - - lh.addStaticHoliday ("28-AUG-2025", "Mariamoba"); - - lh.addStaticHoliday ("14-OCT-2025", "Svetitskhovloba"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2026", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("19-JAN-2026", "Christening Day"); - - lh.addStaticHoliday ("03-MAR-2026", "Mothers Day"); - - lh.addStaticHoliday ("26-MAY-2026", "Independence Day"); - - lh.addStaticHoliday ("24-AUG-2026", "Constitution Day"); - - lh.addStaticHoliday ("28-AUG-2026", "Mariamoba"); - - lh.addStaticHoliday ("14-OCT-2026", "Svetitskhovloba"); - - lh.addStaticHoliday ("23-NOV-2026", "St. Georges Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2027", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("19-JAN-2027", "Christening Day"); - - lh.addStaticHoliday ("03-MAR-2027", "Mothers Day"); - - lh.addStaticHoliday ("26-MAY-2027", "Independence Day"); - - lh.addStaticHoliday ("24-AUG-2027", "Constitution Day"); - - lh.addStaticHoliday ("14-OCT-2027", "Svetitskhovloba"); - - lh.addStaticHoliday ("23-NOV-2027", "St. Georges Day"); - - lh.addStaticHoliday ("07-JAN-2028", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("19-JAN-2028", "Christening Day"); - - lh.addStaticHoliday ("03-MAR-2028", "Mothers Day"); - - lh.addStaticHoliday ("26-MAY-2028", "Independence Day"); - - lh.addStaticHoliday ("24-AUG-2028", "Constitution Day"); - - lh.addStaticHoliday ("28-AUG-2028", "Mariamoba"); - - lh.addStaticHoliday ("23-NOV-2028", "St. Georges Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/GFRHoliday.java b/org/drip/analytics/holset/GFRHoliday.java deleted file mode 100644 index d930f76..0000000 --- a/org/drip/analytics/holset/GFRHoliday.java +++ /dev/null @@ -1,247 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class GFRHoliday implements org.drip.analytics.holset.LocationHoliday { - public GFRHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "GFR"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("24-DEC-2004", "Christmas Eve"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("03-JUL-2009", "Good Friday"); - - lh.addStaticHoliday ("24-DEC-2010", "Christmas Eve"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("03-JUL-2015", "Independence Day Observed"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("03-JUL-2020", "Independence Day Observed"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("24-DEC-2021", "Christmas Day Observed"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("03-JUL-2026", "Independence Day Observed"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("24-DEC-2027", "Christmas Day Observed"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("30-MAR-2029", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2030", "Good Friday"); - - lh.addStaticHoliday ("11-APR-2031", "Good Friday"); - - lh.addStaticHoliday ("26-MAR-2032", "Good Friday"); - - lh.addStaticHoliday ("24-DEC-2032", "Christmas Day Observed"); - - lh.addStaticHoliday ("15-APR-2033", "Good Friday"); - - lh.addStaticHoliday ("07-APR-2034", "Good Friday"); - - lh.addStaticHoliday ("23-MAR-2035", "Good Friday"); - - lh.addStaticHoliday ("11-APR-2036", "Good Friday"); - - lh.addStaticHoliday ("03-APR-2037", "Good Friday"); - - lh.addStaticHoliday ("03-JUL-2037", "Independence Day Observed"); - - lh.addStaticHoliday ("23-APR-2038", "Good Friday"); - - lh.addStaticHoliday ("24-DEC-2038", "Christmas Day Observed"); - - lh.addStaticHoliday ("08-APR-2039", "Good Friday"); - - lh.addStaticHoliday ("30-MAR-2040", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2041", "Good Friday"); - - lh.addStaticHoliday ("04-APR-2042", "Good Friday"); - - lh.addStaticHoliday ("27-MAR-2043", "Good Friday"); - - lh.addStaticHoliday ("03-JUL-2043", "Independence Day Observed"); - - lh.addStaticHoliday ("15-APR-2044", "Good Friday"); - - lh.addStaticHoliday ("07-APR-2045", "Good Friday"); - - lh.addStaticHoliday ("23-MAR-2046", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2047", "Good Friday"); - - lh.addStaticHoliday ("03-APR-2048", "Good Friday"); - - lh.addStaticHoliday ("03-JUL-2048", "Independence Day Observed"); - - lh.addStaticHoliday ("16-APR-2049", "Good Friday"); - - lh.addStaticHoliday ("24-DEC-2049", "Christmas Day Observed"); - - lh.addStaticHoliday ("08-APR-2050", "Good Friday"); - - lh.addStaticHoliday ("31-MAR-2051", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2052", "Good Friday"); - - lh.addStaticHoliday ("04-APR-2053", "Good Friday"); - - lh.addStaticHoliday ("27-MAR-2054", "Good Friday"); - - lh.addStaticHoliday ("03-JUL-2054", "Independence Day Observed"); - - lh.addStaticHoliday ("16-APR-2055", "Good Friday"); - - lh.addStaticHoliday ("24-DEC-2055", "Christmas Day Observed"); - - lh.addStaticHoliday ("31-MAR-2056", "Good Friday"); - - lh.addStaticHoliday ("20-APR-2057", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2058", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2059", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2060", "Good Friday"); - - lh.addStaticHoliday ("08-APR-2061", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2062", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2063", "Good Friday"); - - lh.addStaticHoliday ("04-APR-2064", "Good Friday"); - - lh.addStaticHoliday ("27-MAR-2065", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2066", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2067", "Good Friday"); - - lh.addStaticHoliday ("20-APR-2068", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2069", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2070", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2071", "Good Friday"); - - lh.addStaticHoliday ("08-APR-2072", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2073", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2074", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2075", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2076", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2077", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2078", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2079", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2080", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2081", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2082", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2083", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2084", "Good Friday"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/GRDHoliday.java b/org/drip/analytics/holset/GRDHoliday.java deleted file mode 100644 index 4c8ca1b..0000000 --- a/org/drip/analytics/holset/GRDHoliday.java +++ /dev/null @@ -1,655 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class GRDHoliday implements org.drip.analytics.holset.LocationHoliday { - public GRDHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "GRD"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1998", "Epiphany"); - - lh.addStaticHoliday ("02-MAR-1998", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-1998", "National Holiday"); - - lh.addStaticHoliday ("17-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("20-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("08-JUN-1998", "Whit Monday"); - - lh.addStaticHoliday ("28-OCT-1998", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1999", "Epiphany"); - - lh.addStaticHoliday ("22-FEB-1999", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-1999", "National Holiday"); - - lh.addStaticHoliday ("09-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("12-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("31-MAY-1999", "Whit Monday"); - - lh.addStaticHoliday ("28-OCT-1999", "National Holiday"); - - lh.addStaticHoliday ("06-JAN-2000", "Epiphany"); - - lh.addStaticHoliday ("13-MAR-2000", "Monday in Lent"); - - lh.addStaticHoliday ("28-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("19-JUN-2000", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2000", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("26-FEB-2001", "Monday in Lent"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("04-JUN-2001", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2001", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("18-MAR-2002", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2002", "National Holiday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2002", "Good Friday"); - - lh.addStaticHoliday ("06-MAY-2002", "Easter Monday"); - - lh.addStaticHoliday ("24-JUN-2002", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2002", "Assumption Day"); - - lh.addStaticHoliday ("28-OCT-2002", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2003", "Epiphany"); - - lh.addStaticHoliday ("10-MAR-2003", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2003", "National Holiday"); - - lh.addStaticHoliday ("25-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("28-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("16-JUN-2003", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2003", "Assumption Day"); - - lh.addStaticHoliday ("28-OCT-2003", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2004", "Epiphany"); - - lh.addStaticHoliday ("23-FEB-2004", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2004", "National Holiday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("31-MAY-2004", "Whit Monday"); - - lh.addStaticHoliday ("28-OCT-2004", "National Holiday"); - - lh.addStaticHoliday ("06-JAN-2005", "Epiphany"); - - lh.addStaticHoliday ("14-MAR-2005", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2005", "National Holiday"); - - lh.addStaticHoliday ("29-APR-2005", "Good Friday"); - - lh.addStaticHoliday ("02-MAY-2005", "Easter Monday"); - - lh.addStaticHoliday ("20-JUN-2005", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("28-OCT-2005", "National Holiday"); - - lh.addStaticHoliday ("26-DEC-2005", "Christmas Holiday"); - - lh.addStaticHoliday ("06-JAN-2006", "Epiphany"); - - lh.addStaticHoliday ("06-MAR-2006", "Monday in Lent"); - - lh.addStaticHoliday ("21-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("12-JUN-2006", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2006", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("19-FEB-2007", "Monday in Lent"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("28-MAY-2007", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2007", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("10-MAR-2008", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2008", "National Holiday"); - - lh.addStaticHoliday ("25-APR-2008", "Good Friday"); - - lh.addStaticHoliday ("28-APR-2008", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("16-JUN-2008", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2008", "Assumption Day"); - - lh.addStaticHoliday ("28-OCT-2008", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2009", "Epiphany"); - - lh.addStaticHoliday ("02-MAR-2009", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2009", "National Holiday"); - - lh.addStaticHoliday ("17-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("20-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("08-JUN-2009", "Whit Monday"); - - lh.addStaticHoliday ("28-OCT-2009", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2010", "Epiphany"); - - lh.addStaticHoliday ("15-FEB-2010", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2010", "National Holiday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("24-MAY-2010", "Whit Monday"); - - lh.addStaticHoliday ("28-OCT-2010", "National Holiday"); - - lh.addStaticHoliday ("06-JAN-2011", "Epiphany"); - - lh.addStaticHoliday ("07-MAR-2011", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2011", "National Holiday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("13-JUN-2011", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2011", "Assumption Day"); - - lh.addStaticHoliday ("28-OCT-2011", "National Holiday"); - - lh.addStaticHoliday ("26-DEC-2011", "Christmas Holiday"); - - lh.addStaticHoliday ("06-JAN-2012", "Epiphany"); - - lh.addStaticHoliday ("27-FEB-2012", "Monday in Lent"); - - lh.addStaticHoliday ("13-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("04-JUN-2012", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2012", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("18-MAR-2013", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2013", "National Holiday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2013", "Good Friday"); - - lh.addStaticHoliday ("06-MAY-2013", "Easter Monday"); - - lh.addStaticHoliday ("24-JUN-2013", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2013", "Assumption Day"); - - lh.addStaticHoliday ("28-OCT-2013", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2014", "Epiphany"); - - lh.addStaticHoliday ("03-MAR-2014", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2014", "National Holiday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("09-JUN-2014", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2014", "Assumption Day"); - - lh.addStaticHoliday ("28-OCT-2014", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2015", "Epiphany"); - - lh.addStaticHoliday ("23-FEB-2015", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2015", "National Holiday"); - - lh.addStaticHoliday ("10-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("01-JUN-2015", "Whit Monday"); - - lh.addStaticHoliday ("28-OCT-2015", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2016", "Epiphany"); - - lh.addStaticHoliday ("14-MAR-2016", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2016", "National Holiday"); - - lh.addStaticHoliday ("29-APR-2016", "Good Friday"); - - lh.addStaticHoliday ("02-MAY-2016", "Easter Monday"); - - lh.addStaticHoliday ("20-JUN-2016", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2016", "Assumption Day"); - - lh.addStaticHoliday ("28-OCT-2016", "National Holiday"); - - lh.addStaticHoliday ("26-DEC-2016", "Christmas Holiday"); - - lh.addStaticHoliday ("06-JAN-2017", "Epiphany"); - - lh.addStaticHoliday ("27-FEB-2017", "Monday in Lent"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("05-JUN-2017", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2017", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("19-FEB-2018", "Monday in Lent"); - - lh.addStaticHoliday ("06-APR-2018", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("28-MAY-2018", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2018", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("11-MAR-2019", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2019", "National Holiday"); - - lh.addStaticHoliday ("26-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("29-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("17-JUN-2019", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2019", "Assumption Day"); - - lh.addStaticHoliday ("28-OCT-2019", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2020", "Epiphany"); - - lh.addStaticHoliday ("02-MAR-2020", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2020", "National Holiday"); - - lh.addStaticHoliday ("17-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("20-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("08-JUN-2020", "Whit Monday"); - - lh.addStaticHoliday ("28-OCT-2020", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2021", "Epiphany"); - - lh.addStaticHoliday ("15-MAR-2021", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2021", "National Holiday"); - - lh.addStaticHoliday ("30-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("03-MAY-2021", "Easter Monday"); - - lh.addStaticHoliday ("21-JUN-2021", "Whit Monday"); - - lh.addStaticHoliday ("28-OCT-2021", "National Holiday"); - - lh.addStaticHoliday ("06-JAN-2022", "Epiphany"); - - lh.addStaticHoliday ("07-MAR-2022", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2022", "National Holiday"); - - lh.addStaticHoliday ("22-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("13-JUN-2022", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2022", "Assumption Day"); - - lh.addStaticHoliday ("28-OCT-2022", "National Holiday"); - - lh.addStaticHoliday ("26-DEC-2022", "Christmas Holiday"); - - lh.addStaticHoliday ("06-JAN-2023", "Epiphany"); - - lh.addStaticHoliday ("27-FEB-2023", "Monday in Lent"); - - lh.addStaticHoliday ("14-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("05-JUN-2023", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2023", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("18-MAR-2024", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2024", "National Holiday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2024", "Good Friday"); - - lh.addStaticHoliday ("06-MAY-2024", "Easter Monday"); - - lh.addStaticHoliday ("24-JUN-2024", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2024", "Assumption Day"); - - lh.addStaticHoliday ("28-OCT-2024", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2025", "Epiphany"); - - lh.addStaticHoliday ("03-MAR-2025", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2025", "National Holiday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("09-JUN-2025", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2025", "Assumption Day"); - - lh.addStaticHoliday ("28-OCT-2025", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2026", "Epiphany"); - - lh.addStaticHoliday ("23-FEB-2026", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2026", "National Holiday"); - - lh.addStaticHoliday ("10-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("01-JUN-2026", "Whit Monday"); - - lh.addStaticHoliday ("28-OCT-2026", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2027", "Epiphany"); - - lh.addStaticHoliday ("15-MAR-2027", "Monday in Lent"); - - lh.addStaticHoliday ("25-MAR-2027", "National Holiday"); - - lh.addStaticHoliday ("30-APR-2027", "Good Friday"); - - lh.addStaticHoliday ("03-MAY-2027", "Easter Monday"); - - lh.addStaticHoliday ("21-JUN-2027", "Whit Monday"); - - lh.addStaticHoliday ("28-OCT-2027", "National Holiday"); - - lh.addStaticHoliday ("06-JAN-2028", "Epiphany"); - - lh.addStaticHoliday ("28-FEB-2028", "Monday in Lent"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("05-JUN-2028", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2028", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Christmas Holiday"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/HKDHoliday.java b/org/drip/analytics/holset/HKDHoliday.java deleted file mode 100644 index 3c95ea5..0000000 --- a/org/drip/analytics/holset/HKDHoliday.java +++ /dev/null @@ -1,1879 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class HKDHoliday implements org.drip.analytics.holset.LocationHoliday { - public HKDHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "HKD"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1999", "First Weekday in January"); - - lh.addStaticHoliday ("16-FEB-1999", "Lunar New Years Day"); - - lh.addStaticHoliday ("17-FEB-1999", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("18-FEB-1999", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("06-APR-1999", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("18-JUN-1999", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-1999", "SAR Establishment Day"); - - lh.addStaticHoliday ("01-OCT-1999", "Chinese National Day"); - - lh.addStaticHoliday ("18-OCT-1999", "Chung Yeung Festival Observed"); - - lh.addStaticHoliday ("27-DEC-1999", "Christmas Holiday"); - - lh.addStaticHoliday ("31-DEC-1999", "Special Holiday"); - - lh.addStaticHoliday ("04-FEB-2000", "Lunar New Years Eve"); - - lh.addStaticHoliday ("07-FEB-2000", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("04-APR-2000", "Ching Ming Festival"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("11-MAY-2000", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2000", "Tuen Ng Festival"); - - lh.addStaticHoliday ("13-SEP-2000", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("02-OCT-2000", "Chinese National Day Observed"); - - lh.addStaticHoliday ("06-OCT-2000", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2001", "First Weekday in January"); - - lh.addStaticHoliday ("24-JAN-2001", "Lunar New Years Day"); - - lh.addStaticHoliday ("25-JAN-2001", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("26-JAN-2001", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("05-APR-2001", "Ching Ming Festival"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2001", "Buddhas Birthday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("25-JUN-2001", "Tuen Ng Festival"); - - lh.addStaticHoliday ("02-JUL-2001", "SAR Establishment Day Observed"); - - lh.addStaticHoliday ("06-JUL-2001", "TYPHOON-OFFICE CLOSE"); - - lh.addStaticHoliday ("25-JUL-2001", "TYPHOON-OFFICE CLOSE"); - - lh.addStaticHoliday ("01-OCT-2001", "Chinese National Day"); - - lh.addStaticHoliday ("02-OCT-2001", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("25-OCT-2001", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2002", "First Weekday in January"); - - lh.addStaticHoliday ("12-FEB-2002", "Lunar New Years Day"); - - lh.addStaticHoliday ("13-FEB-2002", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("14-FEB-2002", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("05-APR-2002", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("20-MAY-2002", "Buddhas Birthday Observed"); - - lh.addStaticHoliday ("01-JUL-2002", "SAR Establishment Day"); - - lh.addStaticHoliday ("01-OCT-2002", "Chinese National Day"); - - lh.addStaticHoliday ("14-OCT-2002", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2003", "First Weekday in January"); - - lh.addStaticHoliday ("31-JAN-2003", "Lunar New Years Eve"); - - lh.addStaticHoliday ("03-FEB-2003", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2003", "Buddhas Birthday"); - - lh.addStaticHoliday ("04-JUN-2003", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2003", "SAR Establishment Day"); - - lh.addStaticHoliday ("12-SEP-2003", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2003", "Chinese National Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2004", "First Weekday in January"); - - lh.addStaticHoliday ("22-JAN-2004", "Special Holiday"); - - lh.addStaticHoliday ("23-JAN-2004", "Special Holiday"); - - lh.addStaticHoliday ("24-JAN-2004", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("05-APR-2004", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2004", "Special Holiday"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2004", "Labor Day"); - - lh.addStaticHoliday ("26-MAY-2004", "Buddhas Birthday"); - - lh.addStaticHoliday ("22-JUN-2004", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2004", "SAR Establishment Day"); - - lh.addStaticHoliday ("29-SEP-2004", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2004", "Chinese National Day"); - - lh.addStaticHoliday ("22-OCT-2004", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2004", "Christmas Day"); - - lh.addStaticHoliday ("27-DEC-2004", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2005", "First Weekday in January"); - - lh.addStaticHoliday ("09-FEB-2005", "Lunar New Years Day"); - - lh.addStaticHoliday ("10-FEB-2005", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("11-FEB-2005", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("26-MAR-2005", "Day after Good Friday"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("05-APR-2005", "Ching Ming Festival"); - - lh.addStaticHoliday ("02-MAY-2005", "Labour Day Observed"); - - lh.addStaticHoliday ("16-MAY-2005", "Buddhas Birthday Observed"); - - lh.addStaticHoliday ("11-JUN-2005", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2005", "SAR Establishment Day"); - - lh.addStaticHoliday ("19-SEP-2005", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2005", "National Day"); - - lh.addStaticHoliday ("11-OCT-2005", "Chung Yeung Festival"); - - lh.addStaticHoliday ("26-DEC-2005", "Christmas Holiday"); - - lh.addStaticHoliday ("27-DEC-2005", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2006", "First Weekday in January"); - - lh.addStaticHoliday ("28-JAN-2006", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("30-JAN-2006", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("31-JAN-2006", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("05-APR-2006", "Ching Ming Festival"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("15-APR-2006", "Day after Good Friday"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2006", "Buddhas Birthday"); - - lh.addStaticHoliday ("31-MAY-2006", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2006", "SAR Establishment Day"); - - lh.addStaticHoliday ("02-OCT-2006", "Chinese National Day Observed"); - - lh.addStaticHoliday ("07-OCT-2006", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("30-OCT-2006", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2007", "First Weekday in January"); - - lh.addStaticHoliday ("19-FEB-2007", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("20-FEB-2007", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("05-APR-2007", "Ching Ming Festival"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("07-APR-2007", "Day after Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2007", "Buddhas Birthday"); - - lh.addStaticHoliday ("19-JUN-2007", "Tuen Ng Festival"); - - lh.addStaticHoliday ("02-JUL-2007", "SAR Establishment Day Observed"); - - lh.addStaticHoliday ("26-SEP-2007", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2007", "Chinese National Day"); - - lh.addStaticHoliday ("19-OCT-2007", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2008", "First Weekday in January"); - - lh.addStaticHoliday ("07-FEB-2008", "Lunar New Years Day"); - - lh.addStaticHoliday ("08-FEB-2008", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("09-FEB-2008", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("22-MAR-2008", "Day after Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("04-APR-2008", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("12-MAY-2008", "Buddhas Birthday"); - - lh.addStaticHoliday ("09-JUN-2008", "Tuen Ng Festival Observed"); - - lh.addStaticHoliday ("01-JUL-2008", "SAR Establishment Day"); - - lh.addStaticHoliday ("06-AUG-2008", "Special Holiday"); - - lh.addStaticHoliday ("22-AUG-2008", "Special Holiday"); - - lh.addStaticHoliday ("15-SEP-2008", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2008", "Chinese National Day"); - - lh.addStaticHoliday ("07-OCT-2008", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2009", "First Weekday in January"); - - lh.addStaticHoliday ("26-JAN-2009", "Lunar New Years Day"); - - lh.addStaticHoliday ("27-JAN-2009", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("28-JAN-2009", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("04-APR-2009", "Ching Ming Festival"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("11-APR-2009", "Day after Good Friday"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2009", "Buddhas Birthday"); - - lh.addStaticHoliday ("28-MAY-2009", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2009", "SAR Establishment Day"); - - lh.addStaticHoliday ("01-OCT-2009", "Chinese National Day"); - - lh.addStaticHoliday ("03-OCT-2009", "Mid-Autumn Festival"); - - lh.addStaticHoliday ("26-OCT-2009", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2009", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2010", "First Weekday in January"); - - lh.addStaticHoliday ("13-FEB-2010", "Lunar New Years Eve Observed"); - - lh.addStaticHoliday ("15-FEB-2010", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("16-FEB-2010", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("03-APR-2010", "Day after Good Friday"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("06-APR-2010", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("01-MAY-2010", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2010", "Buddhas Birthday"); - - lh.addStaticHoliday ("16-JUN-2010", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2010", "SAR Establishment Day"); - - lh.addStaticHoliday ("23-SEP-2010", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2010", "Chinese National Day"); - - lh.addStaticHoliday ("16-OCT-2010", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2010", "Christmas Day"); - - lh.addStaticHoliday ("27-DEC-2010", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2011", "First Weekday in January"); - - lh.addStaticHoliday ("03-FEB-2011", "Lunar New Years Day"); - - lh.addStaticHoliday ("04-FEB-2011", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("05-FEB-2011", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("05-APR-2011", "Ching Ming Festival"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("23-APR-2011", "Day after Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2011", "Labour Day Observed"); - - lh.addStaticHoliday ("10-MAY-2011", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2011", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2011", "SAR Establishment Day"); - - lh.addStaticHoliday ("13-SEP-2011", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2011", "National Day"); - - lh.addStaticHoliday ("05-OCT-2011", "Chung Yeung Festival"); - - lh.addStaticHoliday ("26-DEC-2011", "Christmas Holiday"); - - lh.addStaticHoliday ("27-DEC-2011", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2012", "First Weekday in January"); - - lh.addStaticHoliday ("23-JAN-2012", "Lunar New Years Day"); - - lh.addStaticHoliday ("24-JAN-2012", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("25-JAN-2012", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("04-APR-2012", "Ching Ming Festival"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("02-JUL-2012", "SAR Establishment Day Observed"); - - lh.addStaticHoliday ("01-OCT-2012", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("02-OCT-2012", "Chinese National Day Observed"); - - lh.addStaticHoliday ("23-OCT-2012", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2013", "First Weekday in January"); - - lh.addStaticHoliday ("11-FEB-2013", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("12-FEB-2013", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("04-APR-2013", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2013", "Buddhas Birthday"); - - lh.addStaticHoliday ("12-JUN-2013", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2013", "SAR Establishment Day"); - - lh.addStaticHoliday ("20-SEP-2013", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2013", "Chinese National Day"); - - lh.addStaticHoliday ("14-OCT-2013", "Chung Yeung Festival Observed"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2014", "First Weekday in January"); - - lh.addStaticHoliday ("30-JAN-2014", "Lunar New Years Eve"); - - lh.addStaticHoliday ("31-JAN-2014", "Lunar New Years Day"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2014", "Buddhas Birthday"); - - lh.addStaticHoliday ("02-JUN-2014", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2014", "SAR Establishment Day"); - - lh.addStaticHoliday ("09-SEP-2014", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2014", "Chinese National Day"); - - lh.addStaticHoliday ("02-OCT-2014", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2015", "First Weekday in January"); - - lh.addStaticHoliday ("19-FEB-2015", "Lunar New Years Day"); - - lh.addStaticHoliday ("20-FEB-2015", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("07-APR-2015", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2015", "Buddhas Birthday"); - - lh.addStaticHoliday ("01-JUL-2015", "SAR Establishment Day"); - - lh.addStaticHoliday ("28-SEP-2015", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2015", "Chinese National Day"); - - lh.addStaticHoliday ("21-OCT-2015", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "First Weekday in January"); - - lh.addStaticHoliday ("08-FEB-2016", "Lunar New Years Day"); - - lh.addStaticHoliday ("09-FEB-2016", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("10-FEB-2016", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("04-APR-2016", "Ching Ming Festival"); - - lh.addStaticHoliday ("02-MAY-2016", "Labour Day Observed"); - - lh.addStaticHoliday ("09-JUN-2016", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2016", "SAR Establishment Day"); - - lh.addStaticHoliday ("16-SEP-2016", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("10-OCT-2016", "Chung Yeung Festival Observed"); - - lh.addStaticHoliday ("26-DEC-2016", "Christmas Holiday"); - - lh.addStaticHoliday ("27-DEC-2016", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2017", "First Weekday in January"); - - lh.addStaticHoliday ("27-JAN-2017", "Lunar New Years Eve"); - - lh.addStaticHoliday ("30-JAN-2017", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("04-APR-2017", "Ching Ming Festival"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2017", "Buddhas Birthday"); - - lh.addStaticHoliday ("30-MAY-2017", "Tuen Ng Festival"); - - lh.addStaticHoliday ("02-OCT-2017", "Chinese National Day Observed"); - - lh.addStaticHoliday ("05-OCT-2017", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2018", "First Weekday in January"); - - lh.addStaticHoliday ("15-FEB-2018", "Lunar New Years Eve"); - - lh.addStaticHoliday ("16-FEB-2018", "Lunar New Years Day"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("05-APR-2018", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("22-MAY-2018", "Buddhas Birthday"); - - lh.addStaticHoliday ("18-JUN-2018", "Tuen Ng Festival"); - - lh.addStaticHoliday ("02-JUL-2018", "SAR Establishment Day Observed"); - - lh.addStaticHoliday ("25-SEP-2018", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2018", "Chinese National Day"); - - lh.addStaticHoliday ("17-OCT-2018", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2019", "First Weekday in January"); - - lh.addStaticHoliday ("05-FEB-2019", "Lunar New Years Day"); - - lh.addStaticHoliday ("06-FEB-2019", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("07-FEB-2019", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("05-APR-2019", "Ching Ming Festival"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("13-MAY-2019", "Buddhas Birthday Observed"); - - lh.addStaticHoliday ("07-JUN-2019", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2019", "SAR Establishment Day"); - - lh.addStaticHoliday ("01-OCT-2019", "Chinese National Day"); - - lh.addStaticHoliday ("07-OCT-2019", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2020", "First Weekday in January"); - - lh.addStaticHoliday ("24-JAN-2020", "Lunar New Years Eve"); - - lh.addStaticHoliday ("27-JAN-2020", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2020", "Buddhas Birthday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("25-JUN-2020", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2020", "SAR Establishment Day"); - - lh.addStaticHoliday ("01-OCT-2020", "Chinese National Day"); - - lh.addStaticHoliday ("02-OCT-2020", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("26-OCT-2020", "Chung Yeung Festival Observed"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "First Weekday in January"); - - lh.addStaticHoliday ("11-FEB-2021", "Lunar New Years Eve"); - - lh.addStaticHoliday ("12-FEB-2021", "Lunar New Years Day"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("06-APR-2021", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("19-MAY-2021", "Buddhas Birthday"); - - lh.addStaticHoliday ("14-JUN-2021", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2021", "SAR Establishment Day"); - - lh.addStaticHoliday ("22-SEP-2021", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2021", "Chinese National Day"); - - lh.addStaticHoliday ("14-OCT-2021", "Chung Yeung Festival"); - - lh.addStaticHoliday ("27-DEC-2021", "Christmas Holiday"); - - lh.addStaticHoliday ("01-FEB-2022", "Lunar New Years Day"); - - lh.addStaticHoliday ("02-FEB-2022", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("03-FEB-2022", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("05-APR-2022", "Ching Ming Festival"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2022", "Labour Day Observed"); - - lh.addStaticHoliday ("09-MAY-2022", "Buddhas Birthday Observed"); - - lh.addStaticHoliday ("03-JUN-2022", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2022", "SAR Establishment Day"); - - lh.addStaticHoliday ("04-OCT-2022", "Chung Yeung Festival"); - - lh.addStaticHoliday ("26-DEC-2022", "Christmas Holiday"); - - lh.addStaticHoliday ("27-DEC-2022", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2023", "First Weekday in January"); - - lh.addStaticHoliday ("23-JAN-2023", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("24-JAN-2023", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("05-APR-2023", "Ching Ming Festival"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("26-MAY-2023", "Buddhas Birthday"); - - lh.addStaticHoliday ("22-JUN-2023", "Tuen Ng Festival"); - - lh.addStaticHoliday ("02-OCT-2023", "Chinese National Day Observed"); - - lh.addStaticHoliday ("23-OCT-2023", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2024", "First Weekday in January"); - - lh.addStaticHoliday ("09-FEB-2024", "Lunar New Years Eve"); - - lh.addStaticHoliday ("12-FEB-2024", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("04-APR-2024", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("15-MAY-2024", "Buddhas Birthday"); - - lh.addStaticHoliday ("10-JUN-2024", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2024", "SAR Establishment Day"); - - lh.addStaticHoliday ("18-SEP-2024", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2024", "Chinese National Day"); - - lh.addStaticHoliday ("11-OCT-2024", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2025", "First Weekday in January"); - - lh.addStaticHoliday ("29-JAN-2025", "Lunar New Years Day"); - - lh.addStaticHoliday ("30-JAN-2025", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("31-JAN-2025", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("04-APR-2025", "Ching Ming Festival"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2025", "Buddhas Birthday"); - - lh.addStaticHoliday ("01-JUL-2025", "SAR Establishment Day"); - - lh.addStaticHoliday ("01-OCT-2025", "Chinese National Day"); - - lh.addStaticHoliday ("07-OCT-2025", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("29-OCT-2025", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2026", "First Weekday in January"); - - lh.addStaticHoliday ("17-FEB-2026", "Lunar New Years Day"); - - lh.addStaticHoliday ("18-FEB-2026", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("19-FEB-2026", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("07-APR-2026", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2026", "Buddhas Birthday Observed"); - - lh.addStaticHoliday ("19-JUN-2026", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2026", "SAR Establishment Day"); - - lh.addStaticHoliday ("01-OCT-2026", "Chinese National Day"); - - lh.addStaticHoliday ("19-OCT-2026", "Chung Yeung Festival Observed"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "First Weekday in January"); - - lh.addStaticHoliday ("05-FEB-2027", "Lunar New Years Eve"); - - lh.addStaticHoliday ("08-FEB-2027", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("05-APR-2027", "Ching Ming Festival"); - - lh.addStaticHoliday ("13-MAY-2027", "Buddhas Birthday"); - - lh.addStaticHoliday ("09-JUN-2027", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2027", "SAR Establishment Day"); - - lh.addStaticHoliday ("16-SEP-2027", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2027", "Chinese National Day"); - - lh.addStaticHoliday ("08-OCT-2027", "Chung Yeung Festival"); - - lh.addStaticHoliday ("27-DEC-2027", "Christmas Holiday"); - - lh.addStaticHoliday ("26-JAN-2028", "Lunar New Years Day"); - - lh.addStaticHoliday ("27-JAN-2028", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("28-JAN-2028", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("04-APR-2028", "Ching Ming Festival"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2028", "Buddhas Birthday"); - - lh.addStaticHoliday ("29-MAY-2028", "Tuen Ng Festival Observed"); - - lh.addStaticHoliday ("02-OCT-2028", "Chinese National Day Observed"); - - lh.addStaticHoliday ("04-OCT-2028", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("26-OCT-2028", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2029", "First Weekday in January"); - - lh.addStaticHoliday ("13-FEB-2029", "Lunar New Years Day"); - - lh.addStaticHoliday ("14-FEB-2029", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("15-FEB-2029", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("30-MAR-2029", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2029", "Easter Monday"); - - lh.addStaticHoliday ("04-APR-2029", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2029", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2029", "Buddhas Birthday Observed"); - - lh.addStaticHoliday ("02-JUL-2029", "SAR Establishment Day Observed"); - - lh.addStaticHoliday ("01-OCT-2029", "Chinese National Day"); - - lh.addStaticHoliday ("16-OCT-2029", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2029", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2029", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2030", "First Weekday in January"); - - lh.addStaticHoliday ("04-FEB-2030", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("05-FEB-2030", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("05-APR-2030", "Ching Ming Festival"); - - lh.addStaticHoliday ("19-APR-2030", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2030", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2030", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2030", "Buddhas Birthday"); - - lh.addStaticHoliday ("05-JUN-2030", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2030", "SAR Establishment Day"); - - lh.addStaticHoliday ("13-SEP-2030", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2030", "Chinese National Day"); - - lh.addStaticHoliday ("25-DEC-2030", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2030", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2031", "First Weekday in January"); - - lh.addStaticHoliday ("23-JAN-2031", "Lunar New Years Day"); - - lh.addStaticHoliday ("24-JAN-2031", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("11-APR-2031", "Good Friday"); - - lh.addStaticHoliday ("14-APR-2031", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2031", "Labour Day"); - - lh.addStaticHoliday ("28-MAY-2031", "Buddhas Birthday"); - - lh.addStaticHoliday ("24-JUN-2031", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2031", "SAR Establishment Day"); - - lh.addStaticHoliday ("01-OCT-2031", "Chinese National Day"); - - lh.addStaticHoliday ("02-OCT-2031", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("24-OCT-2031", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2031", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2031", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2032", "First Weekday in January"); - - lh.addStaticHoliday ("11-FEB-2032", "Lunar New Years Day"); - - lh.addStaticHoliday ("12-FEB-2032", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("13-FEB-2032", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("26-MAR-2032", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2032", "Easter Monday"); - - lh.addStaticHoliday ("05-APR-2032", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("17-MAY-2032", "Buddhas Birthday Observed"); - - lh.addStaticHoliday ("01-JUL-2032", "SAR Establishment Day"); - - lh.addStaticHoliday ("20-SEP-2032", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2032", "Chinese National Day"); - - lh.addStaticHoliday ("12-OCT-2032", "Chung Yeung Festival"); - - lh.addStaticHoliday ("27-DEC-2032", "Christmas Holiday"); - - lh.addStaticHoliday ("31-JAN-2033", "Lunar New Years Day"); - - lh.addStaticHoliday ("01-FEB-2033", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("02-FEB-2033", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("04-APR-2033", "Ching Ming Festival"); - - lh.addStaticHoliday ("15-APR-2033", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2033", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2033", "Labour Day Observed"); - - lh.addStaticHoliday ("06-MAY-2033", "Buddhas Birthday"); - - lh.addStaticHoliday ("01-JUN-2033", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2033", "SAR Establishment Day"); - - lh.addStaticHoliday ("09-SEP-2033", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("26-DEC-2033", "Christmas Holiday"); - - lh.addStaticHoliday ("27-DEC-2033", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2034", "First Weekday in January"); - - lh.addStaticHoliday ("20-FEB-2034", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("21-FEB-2034", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("05-APR-2034", "Ching Ming Festival"); - - lh.addStaticHoliday ("07-APR-2034", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2034", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2034", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2034", "Buddhas Birthday"); - - lh.addStaticHoliday ("20-JUN-2034", "Tuen Ng Festival"); - - lh.addStaticHoliday ("28-SEP-2034", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("02-OCT-2034", "Chinese National Day Observed"); - - lh.addStaticHoliday ("20-OCT-2034", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2034", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2034", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2035", "First Weekday in January"); - - lh.addStaticHoliday ("08-FEB-2035", "Lunar New Years Day"); - - lh.addStaticHoliday ("09-FEB-2035", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("23-MAR-2035", "Good Friday"); - - lh.addStaticHoliday ("26-MAR-2035", "Easter Monday"); - - lh.addStaticHoliday ("05-APR-2035", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2035", "Labour Day"); - - lh.addStaticHoliday ("15-MAY-2035", "Buddhas Birthday"); - - lh.addStaticHoliday ("11-JUN-2035", "Tuen Ng Festival Observed"); - - lh.addStaticHoliday ("02-JUL-2035", "SAR Establishment Day Observed"); - - lh.addStaticHoliday ("17-SEP-2035", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2035", "Chinese National Day"); - - lh.addStaticHoliday ("09-OCT-2035", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2035", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2035", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2036", "First Weekday in January"); - - lh.addStaticHoliday ("28-JAN-2036", "Lunar New Years Day"); - - lh.addStaticHoliday ("29-JAN-2036", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("30-JAN-2036", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("04-APR-2036", "Ching Ming Festival"); - - lh.addStaticHoliday ("11-APR-2036", "Good Friday"); - - lh.addStaticHoliday ("14-APR-2036", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2036", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2036", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2036", "SAR Establishment Day"); - - lh.addStaticHoliday ("01-OCT-2036", "Chinese National Day"); - - lh.addStaticHoliday ("27-OCT-2036", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2036", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2036", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2037", "First Weekday in January"); - - lh.addStaticHoliday ("16-FEB-2037", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("17-FEB-2037", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("03-APR-2037", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2037", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2037", "Labour Day"); - - lh.addStaticHoliday ("22-MAY-2037", "Buddhas Birthday"); - - lh.addStaticHoliday ("18-JUN-2037", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2037", "SAR Establishment Day"); - - lh.addStaticHoliday ("25-SEP-2037", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2037", "Chinese National Day"); - - lh.addStaticHoliday ("25-DEC-2037", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2038", "First Weekday in January"); - - lh.addStaticHoliday ("04-FEB-2038", "Lunar New Years Day"); - - lh.addStaticHoliday ("05-FEB-2038", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("05-APR-2038", "Ching Ming Festival"); - - lh.addStaticHoliday ("23-APR-2038", "Good Friday"); - - lh.addStaticHoliday ("26-APR-2038", "Easter Monday"); - - lh.addStaticHoliday ("11-MAY-2038", "Buddhas Birthday"); - - lh.addStaticHoliday ("07-JUN-2038", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2038", "SAR Establishment Day"); - - lh.addStaticHoliday ("14-SEP-2038", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2038", "Chinese National Day"); - - lh.addStaticHoliday ("07-OCT-2038", "Chung Yeung Festival"); - - lh.addStaticHoliday ("27-DEC-2038", "Christmas Holiday"); - - lh.addStaticHoliday ("24-JAN-2039", "Lunar New Years Day"); - - lh.addStaticHoliday ("25-JAN-2039", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("26-JAN-2039", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("05-APR-2039", "Ching Ming Festival"); - - lh.addStaticHoliday ("08-APR-2039", "Good Friday"); - - lh.addStaticHoliday ("11-APR-2039", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2039", "Labour Day Observed"); - - lh.addStaticHoliday ("27-MAY-2039", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2039", "SAR Establishment Day"); - - lh.addStaticHoliday ("03-OCT-2039", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("26-OCT-2039", "Chung Yeung Festival"); - - lh.addStaticHoliday ("26-DEC-2039", "Christmas Holiday"); - - lh.addStaticHoliday ("27-DEC-2039", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2040", "First Weekday in January"); - - lh.addStaticHoliday ("13-FEB-2040", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("14-FEB-2040", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("30-MAR-2040", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2040", "Easter Monday"); - - lh.addStaticHoliday ("04-APR-2040", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2040", "Labour Day"); - - lh.addStaticHoliday ("18-MAY-2040", "Buddhas Birthday"); - - lh.addStaticHoliday ("14-JUN-2040", "Tuen Ng Festival"); - - lh.addStaticHoliday ("02-JUL-2040", "SAR Establishment Day Observed"); - - lh.addStaticHoliday ("21-SEP-2040", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2040", "Chinese National Day"); - - lh.addStaticHoliday ("15-OCT-2040", "Chung Yeung Festival Observed"); - - lh.addStaticHoliday ("25-DEC-2040", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2040", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2041", "First Weekday in January"); - - lh.addStaticHoliday ("31-JAN-2041", "Lunar New Years Eve"); - - lh.addStaticHoliday ("01-FEB-2041", "Lunar New Years Day"); - - lh.addStaticHoliday ("04-APR-2041", "Ching Ming Festival"); - - lh.addStaticHoliday ("19-APR-2041", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2041", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2041", "Labour Day"); - - lh.addStaticHoliday ("07-MAY-2041", "Buddhas Birthday"); - - lh.addStaticHoliday ("03-JUN-2041", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2041", "SAR Establishment Day"); - - lh.addStaticHoliday ("11-SEP-2041", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2041", "Chinese National Day"); - - lh.addStaticHoliday ("03-OCT-2041", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2041", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2041", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2042", "First Weekday in January"); - - lh.addStaticHoliday ("22-JAN-2042", "Lunar New Years Day"); - - lh.addStaticHoliday ("23-JAN-2042", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("24-JAN-2042", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("03-APR-2042", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("04-APR-2042", "Good Friday"); - - lh.addStaticHoliday ("07-APR-2042", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2042", "Labour Day"); - - lh.addStaticHoliday ("26-MAY-2042", "Buddhas Birthday"); - - lh.addStaticHoliday ("23-JUN-2042", "Tuen Ng Festival Observed"); - - lh.addStaticHoliday ("01-JUL-2042", "SAR Establishment Day"); - - lh.addStaticHoliday ("29-SEP-2042", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2042", "Chinese National Day"); - - lh.addStaticHoliday ("22-OCT-2042", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2042", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2042", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2043", "First Weekday in January"); - - lh.addStaticHoliday ("10-FEB-2043", "Lunar New Years Day"); - - lh.addStaticHoliday ("11-FEB-2043", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("12-FEB-2043", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("27-MAR-2043", "Good Friday"); - - lh.addStaticHoliday ("30-MAR-2043", "Easter Monday"); - - lh.addStaticHoliday ("06-APR-2043", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("01-MAY-2043", "Labour Day"); - - lh.addStaticHoliday ("11-JUN-2043", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2043", "SAR Establishment Day"); - - lh.addStaticHoliday ("18-SEP-2043", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2043", "Chinese National Day"); - - lh.addStaticHoliday ("12-OCT-2043", "Chung Yeung Festival Observed"); - - lh.addStaticHoliday ("25-DEC-2043", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2044", "First Weekday in January"); - - lh.addStaticHoliday ("29-JAN-2044", "Lunar New Years Eve"); - - lh.addStaticHoliday ("01-FEB-2044", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("04-APR-2044", "Ching Ming Festival"); - - lh.addStaticHoliday ("15-APR-2044", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2044", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2044", "Labour Day Observed"); - - lh.addStaticHoliday ("05-MAY-2044", "Buddhas Birthday"); - - lh.addStaticHoliday ("31-MAY-2044", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2044", "SAR Establishment Day"); - - lh.addStaticHoliday ("06-OCT-2044", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("26-DEC-2044", "Christmas Holiday"); - - lh.addStaticHoliday ("27-DEC-2044", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2045", "First Weekday in January"); - - lh.addStaticHoliday ("16-FEB-2045", "Lunar New Years Eve"); - - lh.addStaticHoliday ("17-FEB-2045", "Lunar New Years Day"); - - lh.addStaticHoliday ("04-APR-2045", "Ching Ming Festival"); - - lh.addStaticHoliday ("07-APR-2045", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2045", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2045", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2045", "Buddhas Birthday"); - - lh.addStaticHoliday ("19-JUN-2045", "Tuen Ng Festival"); - - lh.addStaticHoliday ("26-SEP-2045", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("02-OCT-2045", "Chinese National Day Observed"); - - lh.addStaticHoliday ("18-OCT-2045", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2045", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2045", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2046", "First Weekday in January"); - - lh.addStaticHoliday ("06-FEB-2046", "Lunar New Years Day"); - - lh.addStaticHoliday ("07-FEB-2046", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("08-FEB-2046", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("23-MAR-2046", "Good Friday"); - - lh.addStaticHoliday ("26-MAR-2046", "Easter Monday"); - - lh.addStaticHoliday ("04-APR-2046", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2046", "Labour Day"); - - lh.addStaticHoliday ("14-MAY-2046", "Buddhas Birthday Observed"); - - lh.addStaticHoliday ("08-JUN-2046", "Tuen Ng Festival"); - - lh.addStaticHoliday ("02-JUL-2046", "SAR Establishment Day Observed"); - - lh.addStaticHoliday ("01-OCT-2046", "Chinese National Day"); - - lh.addStaticHoliday ("08-OCT-2046", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2046", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2046", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2047", "First Weekday in January"); - - lh.addStaticHoliday ("25-JAN-2047", "Lunar New Years Eve"); - - lh.addStaticHoliday ("28-JAN-2047", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("05-APR-2047", "Ching Ming Festival"); - - lh.addStaticHoliday ("12-APR-2047", "Good Friday"); - - lh.addStaticHoliday ("15-APR-2047", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2047", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2047", "Buddhas Birthday"); - - lh.addStaticHoliday ("29-MAY-2047", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2047", "SAR Establishment Day"); - - lh.addStaticHoliday ("01-OCT-2047", "Chinese National Day"); - - lh.addStaticHoliday ("28-OCT-2047", "Chung Yeung Festival Observed"); - - lh.addStaticHoliday ("25-DEC-2047", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2047", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2048", "First Weekday in January"); - - lh.addStaticHoliday ("13-FEB-2048", "Lunar New Years Eve"); - - lh.addStaticHoliday ("14-FEB-2048", "Lunar New Years Day"); - - lh.addStaticHoliday ("03-APR-2048", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2048", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2048", "Labour Day"); - - lh.addStaticHoliday ("20-MAY-2048", "Buddhas Birthday"); - - lh.addStaticHoliday ("15-JUN-2048", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2048", "SAR Establishment Day"); - - lh.addStaticHoliday ("23-SEP-2048", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2048", "Chinese National Day"); - - lh.addStaticHoliday ("16-OCT-2048", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2048", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2049", "First Weekday in January"); - - lh.addStaticHoliday ("02-FEB-2049", "Lunar New Years Day"); - - lh.addStaticHoliday ("03-FEB-2049", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("04-FEB-2049", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("05-APR-2049", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("16-APR-2049", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2049", "Easter Monday"); - - lh.addStaticHoliday ("10-MAY-2049", "Buddhas Birthday Observed"); - - lh.addStaticHoliday ("04-JUN-2049", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2049", "SAR Establishment Day"); - - lh.addStaticHoliday ("01-OCT-2049", "Chinese National Day"); - - lh.addStaticHoliday ("05-OCT-2049", "Chung Yeung Festival"); - - lh.addStaticHoliday ("27-DEC-2049", "Christmas Holiday"); - - lh.addStaticHoliday ("24-JAN-2050", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("25-JAN-2050", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("04-APR-2050", "Ching Ming Festival"); - - lh.addStaticHoliday ("08-APR-2050", "Good Friday"); - - lh.addStaticHoliday ("11-APR-2050", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2050", "Labour Day Observed"); - - lh.addStaticHoliday ("23-JUN-2050", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2050", "SAR Establishment Day"); - - lh.addStaticHoliday ("24-OCT-2050", "Chung Yeung Festival"); - - lh.addStaticHoliday ("26-DEC-2050", "Christmas Holiday"); - - lh.addStaticHoliday ("27-DEC-2050", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2051", "First Weekday in January"); - - lh.addStaticHoliday ("10-FEB-2051", "Lunar New Years Eve"); - - lh.addStaticHoliday ("13-FEB-2051", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("31-MAR-2051", "Good Friday"); - - lh.addStaticHoliday ("03-APR-2051", "Easter Monday"); - - lh.addStaticHoliday ("05-APR-2051", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2051", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2051", "Buddhas Birthday"); - - lh.addStaticHoliday ("13-JUN-2051", "Tuen Ng Festival"); - - lh.addStaticHoliday ("20-SEP-2051", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("02-OCT-2051", "Chinese National Day Observed"); - - lh.addStaticHoliday ("13-OCT-2051", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2051", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2051", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2052", "First Weekday in January"); - - lh.addStaticHoliday ("01-FEB-2052", "Lunar New Years Day"); - - lh.addStaticHoliday ("02-FEB-2052", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("04-APR-2052", "Ching Ming Festival"); - - lh.addStaticHoliday ("19-APR-2052", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2052", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2052", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2052", "Buddhas Birthday"); - - lh.addStaticHoliday ("01-JUL-2052", "SAR Establishment Day"); - - lh.addStaticHoliday ("01-OCT-2052", "Chinese National Day"); - - lh.addStaticHoliday ("30-OCT-2052", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2052", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2052", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2053", "First Weekday in January"); - - lh.addStaticHoliday ("19-FEB-2053", "Lunar New Years Day"); - - lh.addStaticHoliday ("20-FEB-2053", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("21-FEB-2053", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("03-APR-2053", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("04-APR-2053", "Good Friday"); - - lh.addStaticHoliday ("07-APR-2053", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2053", "Labour Day"); - - lh.addStaticHoliday ("26-MAY-2053", "Buddhas Birthday Observed"); - - lh.addStaticHoliday ("20-JUN-2053", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2053", "SAR Establishment Day"); - - lh.addStaticHoliday ("01-OCT-2053", "Chinese National Day"); - - lh.addStaticHoliday ("20-OCT-2053", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2053", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2053", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2054", "First Weekday in January"); - - lh.addStaticHoliday ("09-FEB-2054", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("10-FEB-2054", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("27-MAR-2054", "Good Friday"); - - lh.addStaticHoliday ("30-MAR-2054", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2054", "Labour Day"); - - lh.addStaticHoliday ("15-MAY-2054", "Buddhas Birthday"); - - lh.addStaticHoliday ("10-JUN-2054", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2054", "SAR Establishment Day"); - - lh.addStaticHoliday ("17-SEP-2054", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2054", "Chinese National Day"); - - lh.addStaticHoliday ("09-OCT-2054", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2054", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2055", "First Weekday in January"); - - lh.addStaticHoliday ("28-JAN-2055", "Lunar New Years Day"); - - lh.addStaticHoliday ("29-JAN-2055", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("05-APR-2055", "Ching Ming Festival"); - - lh.addStaticHoliday ("16-APR-2055", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2055", "Easter Monday"); - - lh.addStaticHoliday ("04-MAY-2055", "Buddhas Birthday"); - - lh.addStaticHoliday ("31-MAY-2055", "Tuen Ng Festival Observed"); - - lh.addStaticHoliday ("01-JUL-2055", "SAR Establishment Day"); - - lh.addStaticHoliday ("01-OCT-2055", "Chinese National Day"); - - lh.addStaticHoliday ("06-OCT-2055", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("28-OCT-2055", "Chung Yeung Festival"); - - lh.addStaticHoliday ("27-DEC-2055", "Christmas Holiday"); - - lh.addStaticHoliday ("15-FEB-2056", "Lunar New Years Day"); - - lh.addStaticHoliday ("16-FEB-2056", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("17-FEB-2056", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("31-MAR-2056", "Good Friday"); - - lh.addStaticHoliday ("03-APR-2056", "Easter Monday"); - - lh.addStaticHoliday ("04-APR-2056", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2056", "Labour Day"); - - lh.addStaticHoliday ("22-MAY-2056", "Buddhas Birthday"); - - lh.addStaticHoliday ("25-SEP-2056", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("02-OCT-2056", "Chinese National Day Observed"); - - lh.addStaticHoliday ("17-OCT-2056", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2056", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2056", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2057", "First Weekday in January"); - - lh.addStaticHoliday ("05-FEB-2057", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("06-FEB-2057", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("04-APR-2057", "Ching Ming Festival"); - - lh.addStaticHoliday ("20-APR-2057", "Good Friday"); - - lh.addStaticHoliday ("23-APR-2057", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2057", "Labour Day"); - - lh.addStaticHoliday ("11-MAY-2057", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2057", "Tuen Ng Festival"); - - lh.addStaticHoliday ("02-JUL-2057", "SAR Establishment Day Observed"); - - lh.addStaticHoliday ("14-SEP-2057", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2057", "Chinese National Day"); - - lh.addStaticHoliday ("25-DEC-2057", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2057", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2058", "First Weekday in January"); - - lh.addStaticHoliday ("24-JAN-2058", "Lunar New Years Day"); - - lh.addStaticHoliday ("25-JAN-2058", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("04-APR-2058", "Ching Ming Festival"); - - lh.addStaticHoliday ("12-APR-2058", "Good Friday"); - - lh.addStaticHoliday ("15-APR-2058", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2058", "Buddhas Birthday"); - - lh.addStaticHoliday ("01-MAY-2058", "Labour Day"); - - lh.addStaticHoliday ("25-JUN-2058", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2058", "SAR Establishment Day"); - - lh.addStaticHoliday ("01-OCT-2058", "Chinese National Day"); - - lh.addStaticHoliday ("03-OCT-2058", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("25-OCT-2058", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2058", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2058", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2059", "First Weekday in January"); - - lh.addStaticHoliday ("12-FEB-2059", "Lunar New Years Day"); - - lh.addStaticHoliday ("13-FEB-2059", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("14-FEB-2059", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("28-MAR-2059", "Good Friday"); - - lh.addStaticHoliday ("31-MAR-2059", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2059", "Labour Day"); - - lh.addStaticHoliday ("19-MAY-2059", "Buddhas Birthday"); - - lh.addStaticHoliday ("01-JUL-2059", "SAR Establishment Day"); - - lh.addStaticHoliday ("22-SEP-2059", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2059", "Chinese National Day"); - - lh.addStaticHoliday ("14-OCT-2059", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2059", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2059", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2060", "First Weekday in January"); - - lh.addStaticHoliday ("02-FEB-2060", "Lunar New Years Day"); - - lh.addStaticHoliday ("03-FEB-2060", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("04-FEB-2060", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("05-APR-2060", "Ching Ming Festival Observed"); - - lh.addStaticHoliday ("16-APR-2060", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2060", "Easter Monday"); - - lh.addStaticHoliday ("07-MAY-2060", "Buddhas Birthday"); - - lh.addStaticHoliday ("03-JUN-2060", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2060", "SAR Establishment Day"); - - lh.addStaticHoliday ("10-SEP-2060", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("01-OCT-2060", "Chinese National Day"); - - lh.addStaticHoliday ("27-DEC-2060", "Christmas Holiday"); - - lh.addStaticHoliday ("20-JAN-2061", "Lunar New Years Eve"); - - lh.addStaticHoliday ("21-JAN-2061", "Lunar New Years Day"); - - lh.addStaticHoliday ("04-APR-2061", "Ching Ming Festival"); - - lh.addStaticHoliday ("08-APR-2061", "Good Friday"); - - lh.addStaticHoliday ("11-APR-2061", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2061", "Labour Day Observed"); - - lh.addStaticHoliday ("26-MAY-2061", "Buddhas Birthday"); - - lh.addStaticHoliday ("22-JUN-2061", "Tuen Ng Festival"); - - lh.addStaticHoliday ("01-JUL-2061", "SAR Establishment Day"); - - lh.addStaticHoliday ("29-SEP-2061", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("21-OCT-2061", "Chung Yeung Festival"); - - lh.addStaticHoliday ("26-DEC-2061", "Christmas Holiday"); - - lh.addStaticHoliday ("27-DEC-2061", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2062", "First Weekday in January"); - - lh.addStaticHoliday ("09-FEB-2062", "Lunar New Years Day"); - - lh.addStaticHoliday ("10-FEB-2062", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("24-MAR-2062", "Good Friday"); - - lh.addStaticHoliday ("27-MAR-2062", "Easter Monday"); - - lh.addStaticHoliday ("04-APR-2062", "Ching Ming Festival"); - - lh.addStaticHoliday ("01-MAY-2062", "Labour Day"); - - lh.addStaticHoliday ("16-MAY-2062", "Buddhas Birthday"); - - lh.addStaticHoliday ("12-JUN-2062", "Tuen Ng Festival Observed"); - - lh.addStaticHoliday ("18-SEP-2062", "Day following Mid-Autumn Festival"); - - lh.addStaticHoliday ("02-OCT-2062", "Chinese National Day Observed"); - - lh.addStaticHoliday ("11-OCT-2062", "Chung Yeung Festival"); - - lh.addStaticHoliday ("25-DEC-2062", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2062", "Christmas Holiday"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/HRKHoliday.java b/org/drip/analytics/holset/HRKHoliday.java deleted file mode 100644 index d0eda45..0000000 --- a/org/drip/analytics/holset/HRKHoliday.java +++ /dev/null @@ -1,559 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class HRKHoliday implements org.drip.analytics.holset.LocationHoliday { - public HRKHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "HRK"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1998", "Epiphany"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("22-JUN-1998", "Day of Antifascist Struggle"); - - lh.addStaticHoliday ("05-AUG-1998", "Day of National Gratitude"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1999", "Epiphany"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("22-JUN-1999", "Day of Antifascist Struggle"); - - lh.addStaticHoliday ("05-AUG-1999", "Day of National Gratitude"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("06-JAN-2000", "Epiphany"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2000", "Statehood Day"); - - lh.addStaticHoliday ("22-JUN-2000", "Day of Antifascist Struggle"); - - lh.addStaticHoliday ("15-AUG-2000", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2001", "Statehood Day"); - - lh.addStaticHoliday ("22-JUN-2001", "Day of Antifascist Struggle"); - - lh.addStaticHoliday ("15-AUG-2001", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2002", "Statehood Day"); - - lh.addStaticHoliday ("05-AUG-2002", "Day of National Gratitude"); - - lh.addStaticHoliday ("15-AUG-2002", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2003", "Epiphany"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2003", "Statehood Day"); - - lh.addStaticHoliday ("05-AUG-2003", "Day of National Gratitude"); - - lh.addStaticHoliday ("15-AUG-2003", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2004", "Epiphany"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("22-JUN-2004", "Day of Antifascist Struggle"); - - lh.addStaticHoliday ("05-AUG-2004", "Day of National Gratitude"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("06-JAN-2005", "Epiphany"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("30-MAY-2005", "Statehood Day"); - - lh.addStaticHoliday ("22-JUN-2005", "Day of Antifascist Struggle"); - - lh.addStaticHoliday ("05-AUG-2005", "Day of National Gratitude"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("26-DEC-2005", "Boxing Day"); - - lh.addStaticHoliday ("06-JAN-2006", "Epiphany"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2006", "Statehood Day"); - - lh.addStaticHoliday ("22-JUN-2006", "Day of Antifascist Struggle"); - - lh.addStaticHoliday ("15-AUG-2006", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2007", "Statehood Day"); - - lh.addStaticHoliday ("22-JUN-2007", "Day of Antifascist Struggle"); - - lh.addStaticHoliday ("15-AUG-2007", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2008", "Statehood Day"); - - lh.addStaticHoliday ("05-AUG-2008", "Day of National Gratitude"); - - lh.addStaticHoliday ("15-AUG-2008", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2009", "Epiphany"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("22-JUN-2009", "Day of Antifascist Struggle"); - - lh.addStaticHoliday ("05-AUG-2009", "Day of National Gratitude"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2010", "Epiphany"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("22-JUN-2010", "Day of Antifascist Struggle"); - - lh.addStaticHoliday ("05-AUG-2010", "Day of National Gratitude"); - - lh.addStaticHoliday ("01-NOV-2010", "All Saints Day"); - - lh.addStaticHoliday ("06-JAN-2011", "Epiphany"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("30-MAY-2011", "Statehood Day"); - - lh.addStaticHoliday ("22-JUN-2011", "Day of Antifascist Struggle"); - - lh.addStaticHoliday ("05-AUG-2011", "Day of National Gratitude"); - - lh.addStaticHoliday ("15-AUG-2011", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2011", "All Saints Day"); - - lh.addStaticHoliday ("26-DEC-2011", "Boxing Day"); - - lh.addStaticHoliday ("06-JAN-2012", "Epiphany"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2012", "Statehood Day"); - - lh.addStaticHoliday ("22-JUN-2012", "Day of Antifascist Struggle"); - - lh.addStaticHoliday ("15-AUG-2012", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2012", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2013", "Statehood Day"); - - lh.addStaticHoliday ("05-AUG-2013", "Day of National Gratitude"); - - lh.addStaticHoliday ("15-AUG-2013", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2013", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2014", "Epiphany"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2014", "Statehood Day"); - - lh.addStaticHoliday ("05-AUG-2014", "Day of National Gratitude"); - - lh.addStaticHoliday ("15-AUG-2014", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2015", "Epiphany"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("22-JUN-2015", "Day of Antifascist Struggle"); - - lh.addStaticHoliday ("05-AUG-2015", "Day of National Gratitude"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2016", "Epiphany"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("30-MAY-2016", "Statehood Day"); - - lh.addStaticHoliday ("22-JUN-2016", "Day of Antifascist Struggle"); - - lh.addStaticHoliday ("05-AUG-2016", "Day of National Gratitude"); - - lh.addStaticHoliday ("15-AUG-2016", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2016", "All Saints Day"); - - lh.addStaticHoliday ("26-DEC-2016", "Boxing Day"); - - lh.addStaticHoliday ("06-JAN-2017", "Epiphany"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2017", "Statehood Day"); - - lh.addStaticHoliday ("22-JUN-2017", "Day of Antifascist Struggle"); - - lh.addStaticHoliday ("15-AUG-2017", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2017", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2018", "Statehood Day"); - - lh.addStaticHoliday ("22-JUN-2018", "Day of Antifascist Struggle"); - - lh.addStaticHoliday ("15-AUG-2018", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2018", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2019", "Statehood Day"); - - lh.addStaticHoliday ("05-AUG-2019", "Day of National Gratitude"); - - lh.addStaticHoliday ("15-AUG-2019", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2019", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2020", "Epiphany"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("22-JUN-2020", "Day of Antifascist Struggle"); - - lh.addStaticHoliday ("05-AUG-2020", "Day of National Gratitude"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2021", "Epiphany"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("22-JUN-2021", "Day of Antifascist Struggle"); - - lh.addStaticHoliday ("05-AUG-2021", "Day of National Gratitude"); - - lh.addStaticHoliday ("01-NOV-2021", "All Saints Day"); - - lh.addStaticHoliday ("06-JAN-2022", "Epiphany"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("30-MAY-2022", "Statehood Day"); - - lh.addStaticHoliday ("22-JUN-2022", "Day of Antifascist Struggle"); - - lh.addStaticHoliday ("05-AUG-2022", "Day of National Gratitude"); - - lh.addStaticHoliday ("15-AUG-2022", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2022", "All Saints Day"); - - lh.addStaticHoliday ("26-DEC-2022", "Boxing Day"); - - lh.addStaticHoliday ("06-JAN-2023", "Epiphany"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2023", "Statehood Day"); - - lh.addStaticHoliday ("22-JUN-2023", "Day of Antifascist Struggle"); - - lh.addStaticHoliday ("15-AUG-2023", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2023", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2024", "Statehood Day"); - - lh.addStaticHoliday ("05-AUG-2024", "Day of National Gratitude"); - - lh.addStaticHoliday ("15-AUG-2024", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2024", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2025", "Epiphany"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2025", "Statehood Day"); - - lh.addStaticHoliday ("05-AUG-2025", "Day of National Gratitude"); - - lh.addStaticHoliday ("15-AUG-2025", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2026", "Epiphany"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("22-JUN-2026", "Day of Antifascist Struggle"); - - lh.addStaticHoliday ("05-AUG-2026", "Day of National Gratitude"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2027", "Epiphany"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("22-JUN-2027", "Day of Antifascist Struggle"); - - lh.addStaticHoliday ("05-AUG-2027", "Day of National Gratitude"); - - lh.addStaticHoliday ("01-NOV-2027", "All Saints Day"); - - lh.addStaticHoliday ("06-JAN-2028", "Epiphany"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2028", "Statehood Day"); - - lh.addStaticHoliday ("22-JUN-2028", "Day of Antifascist Struggle"); - - lh.addStaticHoliday ("15-AUG-2028", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2028", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Boxing Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/HUFHoliday.java b/org/drip/analytics/holset/HUFHoliday.java deleted file mode 100644 index b039585..0000000 --- a/org/drip/analytics/holset/HUFHoliday.java +++ /dev/null @@ -1,495 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class HUFHoliday implements org.drip.analytics.holset.LocationHoliday { - public HUFHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "HUF"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-1998", "Bridging Day"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("01-JUN-1998", "Whit Monday"); - - lh.addStaticHoliday ("20-AUG-1998", "St. Stephens Day"); - - lh.addStaticHoliday ("21-AUG-1998", "Bridging Day"); - - lh.addStaticHoliday ("23-OCT-1998", "National Holiday"); - - lh.addStaticHoliday ("24-DEC-1998", "Bridging Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("15-MAR-1999", "National Holiday"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("24-MAY-1999", "Whit Monday"); - - lh.addStaticHoliday ("20-AUG-1999", "St. Stephens Day"); - - lh.addStaticHoliday ("15-MAR-2000", "National Holiday"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("12-JUN-2000", "Whit Monday"); - - lh.addStaticHoliday ("23-OCT-2000", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("15-MAR-2001", "National Holiday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("04-JUN-2001", "Whit Monday"); - - lh.addStaticHoliday ("20-AUG-2001", "St. Stephens Day"); - - lh.addStaticHoliday ("23-OCT-2001", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("15-MAR-2002", "National Holiday"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("20-MAY-2002", "Whit Monday"); - - lh.addStaticHoliday ("20-AUG-2002", "St. Stephens Day"); - - lh.addStaticHoliday ("23-OCT-2002", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("09-JUN-2003", "Whit Monday"); - - lh.addStaticHoliday ("20-AUG-2003", "St. Stephens Day"); - - lh.addStaticHoliday ("23-OCT-2003", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("15-MAR-2004", "National Holiday"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("31-MAY-2004", "Whit Monday"); - - lh.addStaticHoliday ("20-AUG-2004", "St. Stephens Day"); - - lh.addStaticHoliday ("15-MAR-2005", "National Holiday"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("16-MAY-2005", "Whit Monday"); - - lh.addStaticHoliday ("26-DEC-2005", "Christmas Holiday"); - - lh.addStaticHoliday ("15-MAR-2006", "National Holiday"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("05-JUN-2006", "Whit Monday"); - - lh.addStaticHoliday ("23-OCT-2006", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("15-MAR-2007", "National Holiday"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("28-MAY-2007", "Whit Monday"); - - lh.addStaticHoliday ("20-AUG-2007", "St. Stephens Day"); - - lh.addStaticHoliday ("23-OCT-2007", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("12-MAY-2008", "Whit Monday"); - - lh.addStaticHoliday ("20-AUG-2008", "St. Stephens Day"); - - lh.addStaticHoliday ("23-OCT-2008", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("01-JUN-2009", "Whit Monday"); - - lh.addStaticHoliday ("20-AUG-2009", "St. Stephens Day"); - - lh.addStaticHoliday ("23-OCT-2009", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("15-MAR-2010", "National Holiday"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("24-MAY-2010", "Whit Monday"); - - lh.addStaticHoliday ("20-AUG-2010", "St. Stephens Day"); - - lh.addStaticHoliday ("15-MAR-2011", "National Holiday"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("13-JUN-2011", "Whit Monday"); - - lh.addStaticHoliday ("26-DEC-2011", "Christmas Holiday"); - - lh.addStaticHoliday ("15-MAR-2012", "National Holiday"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("28-MAY-2012", "Whit Monday"); - - lh.addStaticHoliday ("20-AUG-2012", "St. Stephens Day"); - - lh.addStaticHoliday ("23-OCT-2012", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("15-MAR-2013", "National Holiday"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("20-MAY-2013", "Whit Monday"); - - lh.addStaticHoliday ("20-AUG-2013", "St. Stephens Day"); - - lh.addStaticHoliday ("23-OCT-2013", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("09-JUN-2014", "Whit Monday"); - - lh.addStaticHoliday ("20-AUG-2014", "St. Stephens Day"); - - lh.addStaticHoliday ("23-OCT-2014", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2015", "Whit Monday"); - - lh.addStaticHoliday ("20-AUG-2015", "St. Stephens Day"); - - lh.addStaticHoliday ("23-OCT-2015", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("15-MAR-2016", "National Holiday"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("16-MAY-2016", "Whit Monday"); - - lh.addStaticHoliday ("26-DEC-2016", "Christmas Holiday"); - - lh.addStaticHoliday ("15-MAR-2017", "National Holiday"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("05-JUN-2017", "Whit Monday"); - - lh.addStaticHoliday ("23-OCT-2017", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("15-MAR-2018", "National Holiday"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2018", "Whit Monday"); - - lh.addStaticHoliday ("20-AUG-2018", "St. Stephens Day"); - - lh.addStaticHoliday ("23-OCT-2018", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("15-MAR-2019", "National Holiday"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("10-JUN-2019", "Whit Monday"); - - lh.addStaticHoliday ("20-AUG-2019", "St. Stephens Day"); - - lh.addStaticHoliday ("23-OCT-2019", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("01-JUN-2020", "Whit Monday"); - - lh.addStaticHoliday ("20-AUG-2020", "St. Stephens Day"); - - lh.addStaticHoliday ("23-OCT-2020", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("15-MAR-2021", "National Holiday"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("24-MAY-2021", "Whit Monday"); - - lh.addStaticHoliday ("20-AUG-2021", "St. Stephens Day"); - - lh.addStaticHoliday ("15-MAR-2022", "National Holiday"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("06-JUN-2022", "Whit Monday"); - - lh.addStaticHoliday ("26-DEC-2022", "Christmas Holiday"); - - lh.addStaticHoliday ("15-MAR-2023", "National Holiday"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2023", "Whit Monday"); - - lh.addStaticHoliday ("23-OCT-2023", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("15-MAR-2024", "National Holiday"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("20-MAY-2024", "Whit Monday"); - - lh.addStaticHoliday ("20-AUG-2024", "St. Stephens Day"); - - lh.addStaticHoliday ("23-OCT-2024", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("09-JUN-2025", "Whit Monday"); - - lh.addStaticHoliday ("20-AUG-2025", "St. Stephens Day"); - - lh.addStaticHoliday ("23-OCT-2025", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2026", "Whit Monday"); - - lh.addStaticHoliday ("20-AUG-2026", "St. Stephens Day"); - - lh.addStaticHoliday ("23-OCT-2026", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("15-MAR-2027", "National Holiday"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("17-MAY-2027", "Whit Monday"); - - lh.addStaticHoliday ("20-AUG-2027", "St. Stephens Day"); - - lh.addStaticHoliday ("15-MAR-2028", "National Holiday"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("05-JUN-2028", "Whit Monday"); - - lh.addStaticHoliday ("23-OCT-2028", "National Holiday"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Christmas Holiday"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/IBRHoliday.java b/org/drip/analytics/holset/IBRHoliday.java deleted file mode 100644 index 49b03ae..0000000 --- a/org/drip/analytics/holset/IBRHoliday.java +++ /dev/null @@ -1,1063 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class IBRHoliday implements org.drip.analytics.holset.LocationHoliday { - public IBRHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "IBR"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-1998", "Epiphany"); - - lh.addStaticHoliday ("23-MAR-1998", "St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-1998", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labor Day"); - - lh.addStaticHoliday ("25-MAY-1998", "Ascension Day Observed"); - - lh.addStaticHoliday ("15-JUN-1998", "Corpus Christi Observed"); - - lh.addStaticHoliday ("22-JUN-1998", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("29-JUN-1998", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-1998", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-1998", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-1998", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-1998", "Columbus Day"); - - lh.addStaticHoliday ("02-NOV-1998", "All Saints Day"); - - lh.addStaticHoliday ("16-NOV-1998", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-1998", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-1999", "Epiphany"); - - lh.addStaticHoliday ("22-MAR-1999", "St. Josephs Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("17-MAY-1999", "Ascension Day Observed"); - - lh.addStaticHoliday ("07-JUN-1999", "Corpus Christi Observed"); - - lh.addStaticHoliday ("14-JUN-1999", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("05-JUL-1999", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-1999", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-1999", "Assumption Day"); - - lh.addStaticHoliday ("18-OCT-1999", "Columbus Day"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("15-NOV-1999", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-1999", "Immaculate Conception"); - - lh.addStaticHoliday ("10-JAN-2000", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2000", "St. Josephs Day"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labor Day"); - - lh.addStaticHoliday ("05-JUN-2000", "Ascension Day Observed"); - - lh.addStaticHoliday ("26-JUN-2000", "Corpus Christi Observed"); - - lh.addStaticHoliday ("03-JUL-2000", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2000", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2000", "National Holiday"); - - lh.addStaticHoliday ("21-AUG-2000", "Assumption Day"); - - lh.addStaticHoliday ("16-OCT-2000", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2000", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2000", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2001", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2001", "St. Josephs Day"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labor Day"); - - lh.addStaticHoliday ("28-MAY-2001", "Ascension Day Observed"); - - lh.addStaticHoliday ("18-JUN-2001", "Corpus Christi Observed"); - - lh.addStaticHoliday ("25-JUN-2001", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("02-JUL-2001", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2001", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2001", "National Holiday"); - - lh.addStaticHoliday ("20-AUG-2001", "Assumption Day"); - - lh.addStaticHoliday ("15-OCT-2001", "Columbus Day"); - - lh.addStaticHoliday ("05-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("12-NOV-2001", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2002", "Epiphany"); - - lh.addStaticHoliday ("25-MAR-2002", "St. Josephs Day"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labor Day"); - - lh.addStaticHoliday ("13-MAY-2002", "Ascension Day Observed"); - - lh.addStaticHoliday ("03-JUN-2002", "Corpus Christi Observed"); - - lh.addStaticHoliday ("10-JUN-2002", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("01-JUL-2002", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2002", "National Holiday"); - - lh.addStaticHoliday ("19-AUG-2002", "Assumption Day"); - - lh.addStaticHoliday ("14-OCT-2002", "Columbus Day"); - - lh.addStaticHoliday ("04-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2002", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2003", "Epiphany"); - - lh.addStaticHoliday ("24-MAR-2003", "St. Josephs Day"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labor Day"); - - lh.addStaticHoliday ("02-JUN-2003", "Ascension Day Observed"); - - lh.addStaticHoliday ("23-JUN-2003", "Corpus Christi Observed"); - - lh.addStaticHoliday ("30-JUN-2003", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2003", "National Holiday"); - - lh.addStaticHoliday ("18-AUG-2003", "Assumption Day"); - - lh.addStaticHoliday ("13-OCT-2003", "Columbus Day"); - - lh.addStaticHoliday ("03-NOV-2003", "All Saints Day"); - - lh.addStaticHoliday ("17-NOV-2003", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2004", "Epiphany"); - - lh.addStaticHoliday ("22-MAR-2004", "St. Josephs Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2004", "Ascension Day Observed"); - - lh.addStaticHoliday ("14-JUN-2004", "Corpus Christi Observed"); - - lh.addStaticHoliday ("21-JUN-2004", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("05-JUL-2004", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2004", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2004", "Assumption Day"); - - lh.addStaticHoliday ("18-OCT-2004", "Columbus Day"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("15-NOV-2004", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2004", "Immaculate Conception"); - - lh.addStaticHoliday ("10-JAN-2005", "Epiphany"); - - lh.addStaticHoliday ("21-MAR-2005", "St. Josephs Day"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("09-MAY-2005", "Ascension Day Observed"); - - lh.addStaticHoliday ("30-MAY-2005", "Corpus Christi Observed"); - - lh.addStaticHoliday ("06-JUN-2005", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("04-JUL-2005", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2005", "Independence Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("17-OCT-2005", "Columbus Day"); - - lh.addStaticHoliday ("07-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("14-NOV-2005", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2005", "Immaculate Conception"); - - lh.addStaticHoliday ("09-JAN-2006", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2006", "St. Josephs Day"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labor Day"); - - lh.addStaticHoliday ("29-MAY-2006", "Ascension Day Observed"); - - lh.addStaticHoliday ("19-JUN-2006", "Corpus Christi Observed"); - - lh.addStaticHoliday ("26-JUN-2006", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("03-JUL-2006", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2006", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2006", "National Holiday"); - - lh.addStaticHoliday ("21-AUG-2006", "Assumption Day"); - - lh.addStaticHoliday ("16-OCT-2006", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2006", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2006", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2007", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2007", "St. Josephs Day"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labor Day"); - - lh.addStaticHoliday ("21-MAY-2007", "Ascension Day Observed"); - - lh.addStaticHoliday ("11-JUN-2007", "Corpus Christi Observed"); - - lh.addStaticHoliday ("18-JUN-2007", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("02-JUL-2007", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2007", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2007", "National Holiday"); - - lh.addStaticHoliday ("20-AUG-2007", "Assumption Day"); - - lh.addStaticHoliday ("15-OCT-2007", "Columbus Day"); - - lh.addStaticHoliday ("05-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("12-NOV-2007", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2007", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2007", "New Years day Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2008", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "St. Josephs Day"); - - lh.addStaticHoliday ("01-MAY-2008", "Labor Day"); - - lh.addStaticHoliday ("05-MAY-2008", "Ascension Day Observed"); - - lh.addStaticHoliday ("26-MAY-2008", "Corpus Christi Observed"); - - lh.addStaticHoliday ("02-JUN-2008", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("30-JUN-2008", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2008", "National Holiday"); - - lh.addStaticHoliday ("18-AUG-2008", "Assumption Day"); - - lh.addStaticHoliday ("13-OCT-2008", "Columbus Day"); - - lh.addStaticHoliday ("03-NOV-2008", "All Saints Day"); - - lh.addStaticHoliday ("17-NOV-2008", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2009", "Epiphany"); - - lh.addStaticHoliday ("23-MAR-2009", "St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labor Day"); - - lh.addStaticHoliday ("25-MAY-2009", "Ascension Day Observed"); - - lh.addStaticHoliday ("15-JUN-2009", "Corpus Christi Observed"); - - lh.addStaticHoliday ("22-JUN-2009", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("29-JUN-2009", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2009", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2009", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-2009", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2009", "Columbus Day"); - - lh.addStaticHoliday ("02-NOV-2009", "All Saints Day"); - - lh.addStaticHoliday ("16-NOV-2009", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2009", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2010", "Epiphany"); - - lh.addStaticHoliday ("22-MAR-2010", "St. Josephs Day"); - - lh.addStaticHoliday ("01-APR-2010", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("17-MAY-2010", "Ascension Day Observed"); - - lh.addStaticHoliday ("07-JUN-2010", "Corpus Christi Observed"); - - lh.addStaticHoliday ("14-JUN-2010", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("05-JUL-2010", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2010", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2010", "Assumption Day"); - - lh.addStaticHoliday ("18-OCT-2010", "Columbus Day"); - - lh.addStaticHoliday ("01-NOV-2010", "All Saints Day"); - - lh.addStaticHoliday ("15-NOV-2010", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2010", "Immaculate Conception"); - - lh.addStaticHoliday ("10-JAN-2011", "Epiphany"); - - lh.addStaticHoliday ("21-MAR-2011", "St. Josephs Day"); - - lh.addStaticHoliday ("21-APR-2011", "Holy Thursday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("06-JUN-2011", "Ascension Day Observed"); - - lh.addStaticHoliday ("27-JUN-2011", "Corpus Christi Observed"); - - lh.addStaticHoliday ("04-JUL-2011", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2011", "Independence Day"); - - lh.addStaticHoliday ("15-AUG-2011", "Assumption Day"); - - lh.addStaticHoliday ("17-OCT-2011", "Columbus Day"); - - lh.addStaticHoliday ("07-NOV-2011", "All Saints Day"); - - lh.addStaticHoliday ("14-NOV-2011", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2011", "Immaculate Conception"); - - lh.addStaticHoliday ("09-JAN-2012", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2012", "St. Josephs Day"); - - lh.addStaticHoliday ("05-APR-2012", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labor Day"); - - lh.addStaticHoliday ("21-MAY-2012", "Ascension Day Observed"); - - lh.addStaticHoliday ("11-JUN-2012", "Corpus Christi Observed"); - - lh.addStaticHoliday ("18-JUN-2012", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("02-JUL-2012", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2012", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2012", "National Holiday"); - - lh.addStaticHoliday ("20-AUG-2012", "Assumption Day"); - - lh.addStaticHoliday ("15-OCT-2012", "Columbus Day"); - - lh.addStaticHoliday ("05-NOV-2012", "All Saints Day"); - - lh.addStaticHoliday ("12-NOV-2012", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2013", "Epiphany"); - - lh.addStaticHoliday ("25-MAR-2013", "St. Josephs Day"); - - lh.addStaticHoliday ("28-MAR-2013", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labor Day"); - - lh.addStaticHoliday ("13-MAY-2013", "Ascension Day Observed"); - - lh.addStaticHoliday ("03-JUN-2013", "Corpus Christi Observed"); - - lh.addStaticHoliday ("10-JUN-2013", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("01-JUL-2013", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2013", "National Holiday"); - - lh.addStaticHoliday ("19-AUG-2013", "Assumption Day"); - - lh.addStaticHoliday ("14-OCT-2013", "Columbus Day"); - - lh.addStaticHoliday ("04-NOV-2013", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2013", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2014", "Epiphany"); - - lh.addStaticHoliday ("24-MAR-2014", "St. Josephs Day"); - - lh.addStaticHoliday ("17-APR-2014", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labor Day"); - - lh.addStaticHoliday ("02-JUN-2014", "Ascension Day Observed"); - - lh.addStaticHoliday ("23-JUN-2014", "Corpus Christi Observed"); - - lh.addStaticHoliday ("30-JUN-2014", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2014", "National Holiday"); - - lh.addStaticHoliday ("18-AUG-2014", "Assumption Day"); - - lh.addStaticHoliday ("13-OCT-2014", "Columbus Day"); - - lh.addStaticHoliday ("03-NOV-2014", "All Saints Day"); - - lh.addStaticHoliday ("17-NOV-2014", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2014", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2015", "Epiphany"); - - lh.addStaticHoliday ("23-MAR-2015", "St. Josephs Day"); - - lh.addStaticHoliday ("02-APR-2015", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labor Day"); - - lh.addStaticHoliday ("18-MAY-2015", "Ascension Day Observed"); - - lh.addStaticHoliday ("08-JUN-2015", "Corpus Christi Observed"); - - lh.addStaticHoliday ("15-JUN-2015", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("29-JUN-2015", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2015", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2015", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-2015", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2015", "Columbus Day"); - - lh.addStaticHoliday ("02-NOV-2015", "All Saints Day"); - - lh.addStaticHoliday ("16-NOV-2015", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2015", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2016", "Epiphany"); - - lh.addStaticHoliday ("21-MAR-2016", "St. Josephs Day"); - - lh.addStaticHoliday ("24-MAR-2016", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("09-MAY-2016", "Ascension Day Observed"); - - lh.addStaticHoliday ("30-MAY-2016", "Corpus Christi Observed"); - - lh.addStaticHoliday ("06-JUN-2016", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("04-JUL-2016", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2016", "Independence Day"); - - lh.addStaticHoliday ("15-AUG-2016", "Assumption Day"); - - lh.addStaticHoliday ("17-OCT-2016", "Columbus Day"); - - lh.addStaticHoliday ("07-NOV-2016", "All Saints Day"); - - lh.addStaticHoliday ("14-NOV-2016", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2016", "Immaculate Conception"); - - lh.addStaticHoliday ("09-JAN-2017", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2017", "St. Josephs Day"); - - lh.addStaticHoliday ("13-APR-2017", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labor Day"); - - lh.addStaticHoliday ("29-MAY-2017", "Ascension Day Observed"); - - lh.addStaticHoliday ("19-JUN-2017", "Corpus Christi Observed"); - - lh.addStaticHoliday ("26-JUN-2017", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("03-JUL-2017", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2017", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2017", "National Holiday"); - - lh.addStaticHoliday ("21-AUG-2017", "Assumption Day"); - - lh.addStaticHoliday ("16-OCT-2017", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2017", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2017", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2017", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2018", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2018", "St. Josephs Day"); - - lh.addStaticHoliday ("29-MAR-2018", "Holy Thursday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labor Day"); - - lh.addStaticHoliday ("14-MAY-2018", "Ascension Day Observed"); - - lh.addStaticHoliday ("04-JUN-2018", "Corpus Christi Observed"); - - lh.addStaticHoliday ("11-JUN-2018", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("02-JUL-2018", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2018", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2018", "National Holiday"); - - lh.addStaticHoliday ("20-AUG-2018", "Assumption Day"); - - lh.addStaticHoliday ("15-OCT-2018", "Columbus Day"); - - lh.addStaticHoliday ("05-NOV-2018", "All Saints Day"); - - lh.addStaticHoliday ("12-NOV-2018", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2019", "Epiphany"); - - lh.addStaticHoliday ("25-MAR-2019", "St. Josephs Day"); - - lh.addStaticHoliday ("18-APR-2019", "Holy Thursday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labor Day"); - - lh.addStaticHoliday ("03-JUN-2019", "Ascension Day Observed"); - - lh.addStaticHoliday ("24-JUN-2019", "Corpus Christi Observed"); - - lh.addStaticHoliday ("01-JUL-2019", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2019", "National Holiday"); - - lh.addStaticHoliday ("19-AUG-2019", "Assumption Day"); - - lh.addStaticHoliday ("14-OCT-2019", "Columbus Day"); - - lh.addStaticHoliday ("04-NOV-2019", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2019", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2020", "Epiphany"); - - lh.addStaticHoliday ("23-MAR-2020", "St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-2020", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labor Day"); - - lh.addStaticHoliday ("25-MAY-2020", "Ascension Day Observed"); - - lh.addStaticHoliday ("15-JUN-2020", "Corpus Christi Observed"); - - lh.addStaticHoliday ("22-JUN-2020", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("29-JUN-2020", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2020", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2020", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-2020", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2020", "Columbus Day"); - - lh.addStaticHoliday ("02-NOV-2020", "All Saints Day"); - - lh.addStaticHoliday ("16-NOV-2020", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2020", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2021", "Epiphany"); - - lh.addStaticHoliday ("22-MAR-2021", "St. Josephs Day"); - - lh.addStaticHoliday ("01-APR-2021", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("17-MAY-2021", "Ascension Day Observed"); - - lh.addStaticHoliday ("07-JUN-2021", "Corpus Christi Observed"); - - lh.addStaticHoliday ("14-JUN-2021", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("05-JUL-2021", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2021", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2021", "Assumption Day"); - - lh.addStaticHoliday ("18-OCT-2021", "Columbus Day"); - - lh.addStaticHoliday ("01-NOV-2021", "All Saints Day"); - - lh.addStaticHoliday ("15-NOV-2021", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2021", "Immaculate Conception"); - - lh.addStaticHoliday ("10-JAN-2022", "Epiphany"); - - lh.addStaticHoliday ("21-MAR-2022", "St. Josephs Day"); - - lh.addStaticHoliday ("14-APR-2022", "Holy Thursday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("30-MAY-2022", "Ascension Day Observed"); - - lh.addStaticHoliday ("20-JUN-2022", "Corpus Christi Observed"); - - lh.addStaticHoliday ("27-JUN-2022", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("04-JUL-2022", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2022", "Independence Day"); - - lh.addStaticHoliday ("15-AUG-2022", "Assumption Day"); - - lh.addStaticHoliday ("17-OCT-2022", "Columbus Day"); - - lh.addStaticHoliday ("07-NOV-2022", "All Saints Day"); - - lh.addStaticHoliday ("14-NOV-2022", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2022", "Immaculate Conception"); - - lh.addStaticHoliday ("09-JAN-2023", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2023", "St. Josephs Day"); - - lh.addStaticHoliday ("06-APR-2023", "Holy Thursday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labor Day"); - - lh.addStaticHoliday ("22-MAY-2023", "Ascension Day Observed"); - - lh.addStaticHoliday ("12-JUN-2023", "Corpus Christi Observed"); - - lh.addStaticHoliday ("19-JUN-2023", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("03-JUL-2023", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2023", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2023", "National Holiday"); - - lh.addStaticHoliday ("21-AUG-2023", "Assumption Day"); - - lh.addStaticHoliday ("16-OCT-2023", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2023", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2023", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2023", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2024", "Epiphany"); - - lh.addStaticHoliday ("25-MAR-2024", "St. Josephs Day"); - - lh.addStaticHoliday ("28-MAR-2024", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labor Day"); - - lh.addStaticHoliday ("13-MAY-2024", "Ascension Day Observed"); - - lh.addStaticHoliday ("03-JUN-2024", "Corpus Christi Observed"); - - lh.addStaticHoliday ("10-JUN-2024", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("01-JUL-2024", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2024", "National Holiday"); - - lh.addStaticHoliday ("19-AUG-2024", "Assumption Day"); - - lh.addStaticHoliday ("14-OCT-2024", "Columbus Day"); - - lh.addStaticHoliday ("04-NOV-2024", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2024", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2025", "Epiphany"); - - lh.addStaticHoliday ("24-MAR-2025", "St. Josephs Day"); - - lh.addStaticHoliday ("17-APR-2025", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labor Day"); - - lh.addStaticHoliday ("02-JUN-2025", "Ascension Day Observed"); - - lh.addStaticHoliday ("23-JUN-2025", "Corpus Christi Observed"); - - lh.addStaticHoliday ("30-JUN-2025", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2025", "National Holiday"); - - lh.addStaticHoliday ("18-AUG-2025", "Assumption Day"); - - lh.addStaticHoliday ("13-OCT-2025", "Columbus Day"); - - lh.addStaticHoliday ("03-NOV-2025", "All Saints Day"); - - lh.addStaticHoliday ("17-NOV-2025", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2025", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2026", "Epiphany"); - - lh.addStaticHoliday ("23-MAR-2026", "St. Josephs Day"); - - lh.addStaticHoliday ("02-APR-2026", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labor Day"); - - lh.addStaticHoliday ("18-MAY-2026", "Ascension Day Observed"); - - lh.addStaticHoliday ("08-JUN-2026", "Corpus Christi Observed"); - - lh.addStaticHoliday ("15-JUN-2026", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("29-JUN-2026", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2026", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2026", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-2026", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2026", "Columbus Day"); - - lh.addStaticHoliday ("02-NOV-2026", "All Saints Day"); - - lh.addStaticHoliday ("16-NOV-2026", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2026", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2027", "Epiphany"); - - lh.addStaticHoliday ("22-MAR-2027", "St. Josephs Day"); - - lh.addStaticHoliday ("25-MAR-2027", "Holy Thursday"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("10-MAY-2027", "Ascension Day Observed"); - - lh.addStaticHoliday ("31-MAY-2027", "Corpus Christi Observed"); - - lh.addStaticHoliday ("07-JUN-2027", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("05-JUL-2027", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2027", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2027", "Assumption Day"); - - lh.addStaticHoliday ("18-OCT-2027", "Columbus Day"); - - lh.addStaticHoliday ("01-NOV-2027", "All Saints Day"); - - lh.addStaticHoliday ("15-NOV-2027", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2027", "Immaculate Conception"); - - lh.addStaticHoliday ("10-JAN-2028", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2028", "St. Josephs Day"); - - lh.addStaticHoliday ("13-APR-2028", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labor Day"); - - lh.addStaticHoliday ("29-MAY-2028", "Ascension Day Observed"); - - lh.addStaticHoliday ("19-JUN-2028", "Corpus Christi Observed"); - - lh.addStaticHoliday ("26-JUN-2028", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("03-JUL-2028", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2028", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2028", "National Holiday"); - - lh.addStaticHoliday ("21-AUG-2028", "Assumption Day"); - - lh.addStaticHoliday ("16-OCT-2028", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2028", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2028", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2028", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/IDRHoliday.java b/org/drip/analytics/holset/IDRHoliday.java deleted file mode 100644 index abaff05..0000000 --- a/org/drip/analytics/holset/IDRHoliday.java +++ /dev/null @@ -1,1805 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class IDRHoliday implements org.drip.analytics.holset.LocationHoliday { - public IDRHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "IDR"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-1999", "Idul Fitri"); - - lh.addStaticHoliday ("20-JAN-1999", "Idul Fitri"); - - lh.addStaticHoliday ("18-MAR-1999", "Saka New Year"); - - lh.addStaticHoliday ("31-MAR-1999", "Bank Holiday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("17-APR-1999", "First Day of Muharram"); - - lh.addStaticHoliday ("13-MAY-1999", "Ascension Day"); - - lh.addStaticHoliday ("07-JUN-1999", "Election Day"); - - lh.addStaticHoliday ("26-JUN-1999", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("17-AUG-1999", "Independence Day"); - - lh.addStaticHoliday ("06-NOV-1999", "Ascension of Muhammad"); - - lh.addStaticHoliday ("25-DEC-1999", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-1999", "Bank Holiday"); - - lh.addStaticHoliday ("16-MAR-2000", "Idul Adha"); - - lh.addStaticHoliday ("31-MAR-2000", "Bank Holiday"); - - lh.addStaticHoliday ("04-APR-2000", "Saka New Year"); - - lh.addStaticHoliday ("06-APR-2000", "First Day of Muharram"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("18-MAY-2000", "Waisak Day"); - - lh.addStaticHoliday ("01-JUN-2000", "Ascension Day"); - - lh.addStaticHoliday ("15-JUN-2000", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("17-AUG-2000", "Independence Day"); - - lh.addStaticHoliday ("25-OCT-2000", "Ascension of Muhammad"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Bank Holiday"); - - lh.addStaticHoliday ("27-DEC-2000", "Idul Fitri"); - - lh.addStaticHoliday ("28-DEC-2000", "Idul Fitri"); - - lh.addStaticHoliday ("29-DEC-2000", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("05-MAR-2001", "Idul Adha"); - - lh.addStaticHoliday ("26-MAR-2001", "First Day of Muharram"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("07-MAY-2001", "Waisak Day"); - - lh.addStaticHoliday ("24-MAY-2001", "Ascension Day"); - - lh.addStaticHoliday ("04-JUN-2001", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("17-AUG-2001", "Independence Day"); - - lh.addStaticHoliday ("15-OCT-2001", "Ascension of Muhammad"); - - lh.addStaticHoliday ("17-DEC-2001", "Idul Fitri"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("22-FEB-2002", "IDUL ADHA"); - - lh.addStaticHoliday ("15-MAR-2002", "Saka New Year"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("09-MAY-2002", "Ascension Day"); - - lh.addStaticHoliday ("04-OCT-2002", "Ascension of Muhammad"); - - lh.addStaticHoliday ("06-DEC-2002", "Idul Fitri"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2002", "BANK HOLIDAY"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("12-FEB-2003", "Idul Adha"); - - lh.addStaticHoliday ("03-MAR-2003", "First Day of Muharram"); - - lh.addStaticHoliday ("02-APR-2003", "Saka New Year"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("15-MAY-2003", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("16-MAY-2003", "Waisak Day"); - - lh.addStaticHoliday ("30-MAY-2003", "Ascension Day"); - - lh.addStaticHoliday ("18-AUG-2003", "Independence Day"); - - lh.addStaticHoliday ("22-SEP-2003", "Ascension of Muhammad"); - - lh.addStaticHoliday ("24-NOV-2003", "Idul Fitri"); - - lh.addStaticHoliday ("25-NOV-2003", "Idul Fitri"); - - lh.addStaticHoliday ("26-NOV-2003", "Idul Fitri"); - - lh.addStaticHoliday ("27-NOV-2003", "Idul Fitri"); - - lh.addStaticHoliday ("28-NOV-2003", "Idul Fitri"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Christmas Day Observed"); - - lh.addStaticHoliday ("31-DEC-2003", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("22-JAN-2004", "Chinese New Year"); - - lh.addStaticHoliday ("02-FEB-2004", "Idul Adha"); - - lh.addStaticHoliday ("23-FEB-2004", "New Years Day"); - - lh.addStaticHoliday ("22-MAR-2004", "Saka New Year"); - - lh.addStaticHoliday ("05-APR-2004", "Election Day"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("03-MAY-2004", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("20-MAY-2004", "Ascension Day"); - - lh.addStaticHoliday ("03-JUN-2004", "Vesak Day"); - - lh.addStaticHoliday ("05-JUL-2004", "Election Day"); - - lh.addStaticHoliday ("17-AUG-2004", "Independence Day"); - - lh.addStaticHoliday ("13-SEP-2004", "Ascension of Muhammad"); - - lh.addStaticHoliday ("20-SEP-2004", "Election Day"); - - lh.addStaticHoliday ("15-NOV-2004", "Idul Fitri"); - - lh.addStaticHoliday ("16-NOV-2004", "Idul Fitri"); - - lh.addStaticHoliday ("17-NOV-2004", "Idul Fitri"); - - lh.addStaticHoliday ("18-NOV-2004", "Idul Fitri"); - - lh.addStaticHoliday ("19-NOV-2004", "Idul Fitri"); - - lh.addStaticHoliday ("31-DEC-2004", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2005", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2005", "Idul Adha"); - - lh.addStaticHoliday ("09-FEB-2005", "Chinese New Year"); - - lh.addStaticHoliday ("10-FEB-2005", "New Years Day"); - - lh.addStaticHoliday ("11-MAR-2005", "Saka New Year"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2005", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("05-MAY-2005", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-2005", "Waisak Day"); - - lh.addStaticHoliday ("17-AUG-2005", "Independence Day"); - - lh.addStaticHoliday ("02-SEP-2005", "Ascension of Muhammad"); - - lh.addStaticHoliday ("02-NOV-2005", "Idul Fitri"); - - lh.addStaticHoliday ("03-NOV-2005", "Idul Fitri"); - - lh.addStaticHoliday ("04-NOV-2005", "Idul Fitri"); - - lh.addStaticHoliday ("07-NOV-2005", "Idul Fitri"); - - lh.addStaticHoliday ("08-NOV-2005", "Idul Fitri"); - - lh.addStaticHoliday ("25-DEC-2005", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2006", "New Years Day"); - - lh.addStaticHoliday ("10-JAN-2006", "Idul Adha"); - - lh.addStaticHoliday ("29-JAN-2006", "Chinese New Year"); - - lh.addStaticHoliday ("31-JAN-2006", "Muharram"); - - lh.addStaticHoliday ("30-MAR-2006", "Saka New Year"); - - lh.addStaticHoliday ("10-APR-2006", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("13-MAY-2006", "Waisak Day"); - - lh.addStaticHoliday ("25-MAY-2006", "Ascension Day"); - - lh.addStaticHoliday ("17-AUG-2006", "Independence Day"); - - lh.addStaticHoliday ("21-AUG-2006", "Ascension of Muhammad"); - - lh.addStaticHoliday ("23-OCT-2006", "Idul Fitri"); - - lh.addStaticHoliday ("24-OCT-2006", "Idul Fitri"); - - lh.addStaticHoliday ("25-OCT-2006", "Idul Fitri"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2006", "BANK HOLIDAY"); - - lh.addStaticHoliday ("31-DEC-2006", "Idul Adha"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("19-MAR-2007", "Saka New Year"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("17-MAY-2007", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-2007", "Waisak Day"); - - lh.addStaticHoliday ("17-AUG-2007", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2007", "Idul Fitri"); - - lh.addStaticHoliday ("15-OCT-2007", "BANK HOLIDAYS"); - - lh.addStaticHoliday ("16-OCT-2007", "BANK HOLIDAYS"); - - lh.addStaticHoliday ("20-DEC-2007", "Idul Adha"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2007", "BANK HOLIDAY"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("10-JAN-2008", "First Day of Muharram"); - - lh.addStaticHoliday ("07-FEB-2008", "Chinese New Year"); - - lh.addStaticHoliday ("07-MAR-2008", "Saka New Year"); - - lh.addStaticHoliday ("20-MAR-2008", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2008", "Ascension Day Observed"); - - lh.addStaticHoliday ("20-MAY-2008", "Waisak Day"); - - lh.addStaticHoliday ("30-JUL-2008", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("18-AUG-2008", "Independence Day Observed"); - - lh.addStaticHoliday ("30-SEP-2008", "Idul Fitri"); - - lh.addStaticHoliday ("01-OCT-2008", "Idul Fitri"); - - lh.addStaticHoliday ("02-OCT-2008", "Idul Fitri"); - - lh.addStaticHoliday ("03-OCT-2008", "Idul Fitri"); - - lh.addStaticHoliday ("08-DEC-2008", "Idul Adha"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2008", "First Day of Muharram"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2009", "Bank Holiday"); - - lh.addStaticHoliday ("26-JAN-2009", "Chinese New Year"); - - lh.addStaticHoliday ("09-MAR-2009", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("26-MAR-2009", "Saka New Year"); - - lh.addStaticHoliday ("09-APR-2009", "Election Day"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("09-MAY-2009", "Vesak Day"); - - lh.addStaticHoliday ("21-MAY-2009", "Ascension Day"); - - lh.addStaticHoliday ("08-JUL-2009", "Election Day"); - - lh.addStaticHoliday ("20-JUL-2009", "Ascension of Muhammad"); - - lh.addStaticHoliday ("17-AUG-2009", "Independence Day"); - - lh.addStaticHoliday ("21-SEP-2009", "Idul Fitri"); - - lh.addStaticHoliday ("22-SEP-2009", "Idul Fitri"); - - lh.addStaticHoliday ("23-SEP-2009", "Bank Holiday"); - - lh.addStaticHoliday ("27-NOV-2009", "Idul Adha"); - - lh.addStaticHoliday ("18-DEC-2009", "First Day of Muharram"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("26-FEB-2010", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("16-MAR-2010", "Saka New Year"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("13-MAY-2010", "Ascension Day"); - - lh.addStaticHoliday ("28-MAY-2010", "Waisak Day"); - - lh.addStaticHoliday ("17-AUG-2010", "Independence Day"); - - lh.addStaticHoliday ("09-SEP-2010", "Idul Fitri"); - - lh.addStaticHoliday ("10-SEP-2010", "Idul Fitri"); - - lh.addStaticHoliday ("13-SEP-2010", "Idul Fitri"); - - lh.addStaticHoliday ("17-NOV-2010", "Idul Adha"); - - lh.addStaticHoliday ("07-DEC-2010", "First Day of Muharram"); - - lh.addStaticHoliday ("24-DEC-2010", "Christmas Day"); - - lh.addStaticHoliday ("03-FEB-2011", "Chinese New Year"); - - lh.addStaticHoliday ("15-FEB-2011", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("17-MAY-2011", "Waisak Day"); - - lh.addStaticHoliday ("02-JUN-2011", "Ascension Day"); - - lh.addStaticHoliday ("29-JUN-2011", "Ascension of Muhammad"); - - lh.addStaticHoliday ("17-AUG-2011", "Independence Day"); - - lh.addStaticHoliday ("29-AUG-2011", "Idul Fitri"); - - lh.addStaticHoliday ("30-AUG-2011", "Idul Fitri"); - - lh.addStaticHoliday ("31-AUG-2011", "Idul Fitri"); - - lh.addStaticHoliday ("01-SEP-2011", "Idul Fitri"); - - lh.addStaticHoliday ("02-SEP-2011", "Idul Fitri"); - - lh.addStaticHoliday ("26-DEC-2011", "Christmas Day"); - - lh.addStaticHoliday ("23-JAN-2012", "Chinese New Year"); - - lh.addStaticHoliday ("23-MAR-2012", "Saka New Year"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("17-MAY-2012", "Ascension Day"); - - lh.addStaticHoliday ("17-AUG-2012", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2012", "Idul Fitri"); - - lh.addStaticHoliday ("21-AUG-2012", "Idul Fitri"); - - lh.addStaticHoliday ("22-AUG-2012", "Idul Fitri"); - - lh.addStaticHoliday ("26-OCT-2012", "Idul Adha"); - - lh.addStaticHoliday ("15-NOV-2012", "First Day of Muharram"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("24-JAN-2013", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("12-MAR-2013", "Saka New Year"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("09-MAY-2013", "Ascension Day"); - - lh.addStaticHoliday ("06-JUN-2013", "Ascension of Muhammad"); - - lh.addStaticHoliday ("07-AUG-2013", "Idul Fitri"); - - lh.addStaticHoliday ("08-AUG-2013", "Idul Fitri"); - - lh.addStaticHoliday ("09-AUG-2013", "Idul Fitri"); - - lh.addStaticHoliday ("12-AUG-2013", "Idul Fitri"); - - lh.addStaticHoliday ("13-AUG-2013", "Idul Fitri"); - - lh.addStaticHoliday ("15-OCT-2013", "Idul Adha"); - - lh.addStaticHoliday ("05-NOV-2013", "First Day of Muharram"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("14-JAN-2014", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("31-JAN-2014", "Chinese New Year"); - - lh.addStaticHoliday ("31-MAR-2014", "Saka New Year"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("15-MAY-2014", "Waisak Day"); - - lh.addStaticHoliday ("27-MAY-2014", "Ascension of Muhammad"); - - lh.addStaticHoliday ("29-MAY-2014", "Ascension Day"); - - lh.addStaticHoliday ("25-JUL-2014", "Idul Fitri"); - - lh.addStaticHoliday ("28-JUL-2014", "Idul Fitri"); - - lh.addStaticHoliday ("29-JUL-2014", "Idul Fitri"); - - lh.addStaticHoliday ("30-JUL-2014", "Idul Fitri"); - - lh.addStaticHoliday ("31-JUL-2014", "Idul Fitri"); - - lh.addStaticHoliday ("01-AUG-2014", "Idul Fitri"); - - lh.addStaticHoliday ("18-AUG-2014", "Independence Day Observed"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("19-FEB-2015", "Chinese New Year"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("14-MAY-2015", "Ascension Day"); - - lh.addStaticHoliday ("02-JUN-2015", "Waisak Day"); - - lh.addStaticHoliday ("16-JUL-2015", "Idul Fitri"); - - lh.addStaticHoliday ("17-JUL-2015", "Idul Fitri"); - - lh.addStaticHoliday ("17-AUG-2015", "Independence Day"); - - lh.addStaticHoliday ("24-SEP-2015", "Idul Adha"); - - lh.addStaticHoliday ("14-OCT-2015", "First Day of Muharram"); - - lh.addStaticHoliday ("24-DEC-2015", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2016", "Chinese New Year"); - - lh.addStaticHoliday ("09-MAR-2016", "Saka New Year"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("05-MAY-2016", "Ascension Day"); - - lh.addStaticHoliday ("05-JUL-2016", "Idul Fitri"); - - lh.addStaticHoliday ("06-JUL-2016", "Idul Fitri"); - - lh.addStaticHoliday ("07-JUL-2016", "Idul Fitri"); - - lh.addStaticHoliday ("08-JUL-2016", "Idul Fitri"); - - lh.addStaticHoliday ("17-AUG-2016", "Independence Day"); - - lh.addStaticHoliday ("12-SEP-2016", "Idul Adha"); - - lh.addStaticHoliday ("12-DEC-2016", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("28-MAR-2017", "Saka New Year"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2017", "Ascension of Muhammad"); - - lh.addStaticHoliday ("11-MAY-2017", "Waisak Day"); - - lh.addStaticHoliday ("25-MAY-2017", "Ascension Day"); - - lh.addStaticHoliday ("26-JUN-2017", "Idul Fitri"); - - lh.addStaticHoliday ("27-JUN-2017", "Idul Fitri"); - - lh.addStaticHoliday ("28-JUN-2017", "Idul Fitri"); - - lh.addStaticHoliday ("17-AUG-2017", "Independence Day"); - - lh.addStaticHoliday ("01-SEP-2017", "Idul Adha"); - - lh.addStaticHoliday ("21-SEP-2017", "First Day of Muharram"); - - lh.addStaticHoliday ("01-DEC-2017", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2018", "Chinese New Year"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("10-MAY-2018", "Ascension Day"); - - lh.addStaticHoliday ("29-MAY-2018", "Waisak Day"); - - lh.addStaticHoliday ("14-JUN-2018", "Idul Fitri"); - - lh.addStaticHoliday ("15-JUN-2018", "Idul Fitri"); - - lh.addStaticHoliday ("17-AUG-2018", "Independence Day"); - - lh.addStaticHoliday ("22-AUG-2018", "Idul Adha"); - - lh.addStaticHoliday ("11-SEP-2018", "First Day of Muharram"); - - lh.addStaticHoliday ("20-NOV-2018", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2019", "Chinese New Year"); - - lh.addStaticHoliday ("03-APR-2019", "Ascension of Muhammad"); - - lh.addStaticHoliday ("05-APR-2019", "Saka New Year"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("30-MAY-2019", "Ascension Day"); - - lh.addStaticHoliday ("04-JUN-2019", "Idul Fitri"); - - lh.addStaticHoliday ("05-JUN-2019", "Idul Fitri"); - - lh.addStaticHoliday ("06-JUN-2019", "Idul Fitri"); - - lh.addStaticHoliday ("07-JUN-2019", "Idul Fitri"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("25-MAR-2020", "Saka New Year"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("07-MAY-2020", "Waisak Day"); - - lh.addStaticHoliday ("21-MAY-2020", "Ascension Day"); - - lh.addStaticHoliday ("25-MAY-2020", "Idul Fitri"); - - lh.addStaticHoliday ("26-MAY-2020", "Idul Fitri"); - - lh.addStaticHoliday ("27-MAY-2020", "Idul Fitri"); - - lh.addStaticHoliday ("31-JUL-2020", "Idul Adha"); - - lh.addStaticHoliday ("17-AUG-2020", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2020", "First Day of Muharram"); - - lh.addStaticHoliday ("29-OCT-2020", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("12-FEB-2021", "Chinese New Year"); - - lh.addStaticHoliday ("11-MAR-2021", "Ascension of Muhammad"); - - lh.addStaticHoliday ("15-MAR-2021", "Saka New Year"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("12-MAY-2021", "Idul Fitri"); - - lh.addStaticHoliday ("13-MAY-2021", "Idul Fitri"); - - lh.addStaticHoliday ("14-MAY-2021", "Idul Fitri"); - - lh.addStaticHoliday ("17-MAY-2021", "Idul Fitri"); - - lh.addStaticHoliday ("18-MAY-2021", "Idul Fitri"); - - lh.addStaticHoliday ("26-MAY-2021", "Waisak Day"); - - lh.addStaticHoliday ("20-JUL-2021", "Idul Adha"); - - lh.addStaticHoliday ("10-AUG-2021", "First Day of Muharram"); - - lh.addStaticHoliday ("17-AUG-2021", "Independence Day"); - - lh.addStaticHoliday ("19-OCT-2021", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("01-FEB-2022", "Chinese New Year"); - - lh.addStaticHoliday ("28-FEB-2022", "Ascension of Muhammad"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("29-APR-2022", "Idul Fitri"); - - lh.addStaticHoliday ("02-MAY-2022", "Idul Fitri"); - - lh.addStaticHoliday ("03-MAY-2022", "Idul Fitri"); - - lh.addStaticHoliday ("04-MAY-2022", "Idul Fitri"); - - lh.addStaticHoliday ("05-MAY-2022", "Idul Fitri"); - - lh.addStaticHoliday ("06-MAY-2022", "Idul Fitri"); - - lh.addStaticHoliday ("16-MAY-2022", "Waisak Day"); - - lh.addStaticHoliday ("26-MAY-2022", "Ascension Day"); - - lh.addStaticHoliday ("17-AUG-2022", "Independence Day"); - - lh.addStaticHoliday ("22-MAR-2023", "Saka New Year"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("20-APR-2023", "Idul Fitri"); - - lh.addStaticHoliday ("21-APR-2023", "Idul Fitri"); - - lh.addStaticHoliday ("18-MAY-2023", "Ascension Day"); - - lh.addStaticHoliday ("29-JUN-2023", "Idul Adha"); - - lh.addStaticHoliday ("19-JUL-2023", "First Day of Muharram"); - - lh.addStaticHoliday ("17-AUG-2023", "Independence Day"); - - lh.addStaticHoliday ("27-SEP-2023", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2024", "Ascension of Muhammad"); - - lh.addStaticHoliday ("11-MAR-2024", "Saka New Year"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2024", "Idul Fitri"); - - lh.addStaticHoliday ("10-APR-2024", "Idul Fitri"); - - lh.addStaticHoliday ("11-APR-2024", "Idul Fitri"); - - lh.addStaticHoliday ("12-APR-2024", "Idul Fitri"); - - lh.addStaticHoliday ("09-MAY-2024", "Ascension Day"); - - lh.addStaticHoliday ("23-MAY-2024", "Waisak Day"); - - lh.addStaticHoliday ("17-JUN-2024", "Idul Adha"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("27-JAN-2025", "Ascension of Muhammad"); - - lh.addStaticHoliday ("29-JAN-2025", "Chinese New Year"); - - lh.addStaticHoliday ("28-MAR-2025", "Idul Fitri"); - - lh.addStaticHoliday ("31-MAR-2025", "Idul Fitri"); - - lh.addStaticHoliday ("01-APR-2025", "Idul Fitri"); - - lh.addStaticHoliday ("02-APR-2025", "Idul Fitri"); - - lh.addStaticHoliday ("03-APR-2025", "Idul Fitri"); - - lh.addStaticHoliday ("04-APR-2025", "Idul Fitri"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("12-MAY-2025", "Waisak Day"); - - lh.addStaticHoliday ("29-MAY-2025", "Ascension Day"); - - lh.addStaticHoliday ("06-JUN-2025", "Idul Adha"); - - lh.addStaticHoliday ("27-JUN-2025", "First Day of Muharram"); - - lh.addStaticHoliday ("18-AUG-2025", "Independence Day Observed"); - - lh.addStaticHoliday ("05-SEP-2025", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("16-JAN-2026", "Ascension of Muhammad"); - - lh.addStaticHoliday ("17-FEB-2026", "Chinese New Year"); - - lh.addStaticHoliday ("19-MAR-2026", "Idul Fitri"); - - lh.addStaticHoliday ("20-MAR-2026", "Idul Fitri"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2026", "Saka New Year"); - - lh.addStaticHoliday ("14-MAY-2026", "Ascension Day"); - - lh.addStaticHoliday ("27-MAY-2026", "Idul Adha"); - - lh.addStaticHoliday ("16-JUN-2026", "First Day of Muharram"); - - lh.addStaticHoliday ("17-AUG-2026", "Independence Day"); - - lh.addStaticHoliday ("25-AUG-2026", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("05-JAN-2027", "Ascension of Muhammad"); - - lh.addStaticHoliday ("09-MAR-2027", "Idul Fitri"); - - lh.addStaticHoliday ("10-MAR-2027", "Idul Fitri"); - - lh.addStaticHoliday ("11-MAR-2027", "Idul Fitri"); - - lh.addStaticHoliday ("12-MAR-2027", "Idul Fitri"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("07-APR-2027", "Saka New Year"); - - lh.addStaticHoliday ("06-MAY-2027", "Ascension Day"); - - lh.addStaticHoliday ("17-MAY-2027", "Idul Adha"); - - lh.addStaticHoliday ("20-MAY-2027", "Waisak Day"); - - lh.addStaticHoliday ("17-AUG-2027", "Independence Day"); - - lh.addStaticHoliday ("26-JAN-2028", "Chinese New Year"); - - lh.addStaticHoliday ("28-FEB-2028", "Idul Fitri"); - - lh.addStaticHoliday ("29-FEB-2028", "Idul Fitri"); - - lh.addStaticHoliday ("01-MAR-2028", "Idul Fitri"); - - lh.addStaticHoliday ("27-MAR-2028", "Saka New Year"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("05-MAY-2028", "Idul Adha"); - - lh.addStaticHoliday ("09-MAY-2028", "Waisak Day"); - - lh.addStaticHoliday ("25-MAY-2028", "Ascension Day"); - - lh.addStaticHoliday ("26-MAY-2028", "First Day of Muharram"); - - lh.addStaticHoliday ("03-AUG-2028", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("17-AUG-2028", "Independence Day"); - - lh.addStaticHoliday ("14-DEC-2028", "Ascension of Muhammad"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2029", "New Years Day"); - - lh.addStaticHoliday ("13-FEB-2029", "Chinese New Year"); - - lh.addStaticHoliday ("14-FEB-2029", "Idul Fitri"); - - lh.addStaticHoliday ("15-FEB-2029", "Idul Fitri"); - - lh.addStaticHoliday ("16-FEB-2029", "Idul Fitri"); - - lh.addStaticHoliday ("19-FEB-2029", "Idul Fitri"); - - lh.addStaticHoliday ("20-FEB-2029", "Idul Fitri"); - - lh.addStaticHoliday ("30-MAR-2029", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2029", "Idul Adha"); - - lh.addStaticHoliday ("10-MAY-2029", "Ascension Day"); - - lh.addStaticHoliday ("15-MAY-2029", "First Day of Muharram"); - - lh.addStaticHoliday ("28-MAY-2029", "Waisak Day"); - - lh.addStaticHoliday ("24-JUL-2029", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("17-AUG-2029", "Independence Day"); - - lh.addStaticHoliday ("03-DEC-2029", "Ascension of Muhammad"); - - lh.addStaticHoliday ("25-DEC-2029", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2030", "New Years Day"); - - lh.addStaticHoliday ("01-FEB-2030", "Idul Fitri"); - - lh.addStaticHoliday ("04-FEB-2030", "Idul Fitri"); - - lh.addStaticHoliday ("05-FEB-2030", "Idul Fitri"); - - lh.addStaticHoliday ("06-FEB-2030", "Idul Fitri"); - - lh.addStaticHoliday ("07-FEB-2030", "Idul Fitri"); - - lh.addStaticHoliday ("08-FEB-2030", "Idul Fitri"); - - lh.addStaticHoliday ("03-APR-2030", "Saka New Year"); - - lh.addStaticHoliday ("19-APR-2030", "Good Friday"); - - lh.addStaticHoliday ("17-MAY-2030", "Waisak Day"); - - lh.addStaticHoliday ("30-MAY-2030", "Ascension Day"); - - lh.addStaticHoliday ("25-DEC-2030", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2031", "New Years Day"); - - lh.addStaticHoliday ("23-JAN-2031", "Chinese New Year"); - - lh.addStaticHoliday ("24-JAN-2031", "Idul Fitri"); - - lh.addStaticHoliday ("27-JAN-2031", "Idul Fitri"); - - lh.addStaticHoliday ("28-JAN-2031", "Idul Fitri"); - - lh.addStaticHoliday ("24-MAR-2031", "Saka New Year"); - - lh.addStaticHoliday ("03-APR-2031", "Idul Adha"); - - lh.addStaticHoliday ("11-APR-2031", "Good Friday"); - - lh.addStaticHoliday ("23-APR-2031", "First Day of Muharram"); - - lh.addStaticHoliday ("07-MAY-2031", "Waisak Day"); - - lh.addStaticHoliday ("22-MAY-2031", "Ascension Day"); - - lh.addStaticHoliday ("02-JUL-2031", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("18-AUG-2031", "Independence Day Observed"); - - lh.addStaticHoliday ("13-NOV-2031", "Ascension of Muhammad"); - - lh.addStaticHoliday ("25-DEC-2031", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2032", "New Years Day"); - - lh.addStaticHoliday ("13-JAN-2032", "Idul Fitri"); - - lh.addStaticHoliday ("14-JAN-2032", "Idul Fitri"); - - lh.addStaticHoliday ("15-JAN-2032", "Idul Fitri"); - - lh.addStaticHoliday ("16-JAN-2032", "Idul Fitri"); - - lh.addStaticHoliday ("11-FEB-2032", "Chinese New Year"); - - lh.addStaticHoliday ("22-MAR-2032", "Idul Adha"); - - lh.addStaticHoliday ("26-MAR-2032", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2032", "Saka New Year"); - - lh.addStaticHoliday ("06-MAY-2032", "Ascension Day"); - - lh.addStaticHoliday ("25-MAY-2032", "Waisak Day"); - - lh.addStaticHoliday ("17-AUG-2032", "Independence Day"); - - lh.addStaticHoliday ("01-NOV-2032", "Ascension of Muhammad"); - - lh.addStaticHoliday ("31-DEC-2032", "Idul Fitri"); - - lh.addStaticHoliday ("03-JAN-2033", "Idul Fitri"); - - lh.addStaticHoliday ("04-JAN-2033", "Idul Fitri"); - - lh.addStaticHoliday ("05-JAN-2033", "Idul Fitri"); - - lh.addStaticHoliday ("06-JAN-2033", "Idul Fitri"); - - lh.addStaticHoliday ("07-JAN-2033", "Idul Fitri"); - - lh.addStaticHoliday ("31-JAN-2033", "Chinese New Year"); - - lh.addStaticHoliday ("31-MAR-2033", "Saka New Year"); - - lh.addStaticHoliday ("01-APR-2033", "First Day of Muharram"); - - lh.addStaticHoliday ("15-APR-2033", "Good Friday"); - - lh.addStaticHoliday ("26-MAY-2033", "Ascension Day"); - - lh.addStaticHoliday ("10-JUN-2033", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("17-AUG-2033", "Independence Day"); - - lh.addStaticHoliday ("21-OCT-2033", "Ascension of Muhammad"); - - lh.addStaticHoliday ("22-DEC-2033", "Idul Fitri"); - - lh.addStaticHoliday ("23-DEC-2033", "Idul Fitri"); - - lh.addStaticHoliday ("01-MAR-2034", "Idul Adha"); - - lh.addStaticHoliday ("22-MAR-2034", "First Day of Muharram"); - - lh.addStaticHoliday ("07-APR-2034", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2034", "Saka New Year"); - - lh.addStaticHoliday ("18-MAY-2034", "Ascension Day"); - - lh.addStaticHoliday ("30-MAY-2034", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("02-JUN-2034", "Waisak Day"); - - lh.addStaticHoliday ("17-AUG-2034", "Independence Day"); - - lh.addStaticHoliday ("10-OCT-2034", "Ascension of Muhammad"); - - lh.addStaticHoliday ("11-DEC-2034", "Idul Fitri"); - - lh.addStaticHoliday ("12-DEC-2034", "Idul Fitri"); - - lh.addStaticHoliday ("13-DEC-2034", "Idul Fitri"); - - lh.addStaticHoliday ("14-DEC-2034", "Idul Fitri"); - - lh.addStaticHoliday ("15-DEC-2034", "Idul Fitri"); - - lh.addStaticHoliday ("25-DEC-2034", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2035", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2035", "Chinese New Year"); - - lh.addStaticHoliday ("19-FEB-2035", "Idul Adha"); - - lh.addStaticHoliday ("23-MAR-2035", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2035", "Saka New Year"); - - lh.addStaticHoliday ("03-MAY-2035", "Ascension Day"); - - lh.addStaticHoliday ("22-MAY-2035", "Waisak Day"); - - lh.addStaticHoliday ("17-AUG-2035", "Independence Day"); - - lh.addStaticHoliday ("30-NOV-2035", "Idul Fitri"); - - lh.addStaticHoliday ("03-DEC-2035", "Idul Fitri"); - - lh.addStaticHoliday ("04-DEC-2035", "Idul Fitri"); - - lh.addStaticHoliday ("25-DEC-2035", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2036", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-2036", "Chinese New Year"); - - lh.addStaticHoliday ("08-FEB-2036", "Idul Adha"); - - lh.addStaticHoliday ("28-FEB-2036", "First Day of Muharram"); - - lh.addStaticHoliday ("28-MAR-2036", "Saka New Year"); - - lh.addStaticHoliday ("11-APR-2036", "Good Friday"); - - lh.addStaticHoliday ("09-MAY-2036", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("22-MAY-2036", "Ascension Day"); - - lh.addStaticHoliday ("18-AUG-2036", "Independence Day Observed"); - - lh.addStaticHoliday ("18-SEP-2036", "Ascension of Muhammad"); - - lh.addStaticHoliday ("18-NOV-2036", "Idul Fitri"); - - lh.addStaticHoliday ("19-NOV-2036", "Idul Fitri"); - - lh.addStaticHoliday ("20-NOV-2036", "Idul Fitri"); - - lh.addStaticHoliday ("21-NOV-2036", "Idul Fitri"); - - lh.addStaticHoliday ("25-DEC-2036", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2037", "New Years Day"); - - lh.addStaticHoliday ("27-JAN-2037", "Idul Adha"); - - lh.addStaticHoliday ("16-FEB-2037", "First Day of Muharram"); - - lh.addStaticHoliday ("17-MAR-2037", "Saka New Year"); - - lh.addStaticHoliday ("03-APR-2037", "Good Friday"); - - lh.addStaticHoliday ("28-APR-2037", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("14-MAY-2037", "Ascension Day"); - - lh.addStaticHoliday ("29-MAY-2037", "Waisak Day"); - - lh.addStaticHoliday ("17-AUG-2037", "Independence Day"); - - lh.addStaticHoliday ("08-SEP-2037", "Ascension of Muhammad"); - - lh.addStaticHoliday ("06-NOV-2037", "Idul Fitri"); - - lh.addStaticHoliday ("09-NOV-2037", "Idul Fitri"); - - lh.addStaticHoliday ("10-NOV-2037", "Idul Fitri"); - - lh.addStaticHoliday ("11-NOV-2037", "Idul Fitri"); - - lh.addStaticHoliday ("12-NOV-2037", "Idul Fitri"); - - lh.addStaticHoliday ("13-NOV-2037", "Idul Fitri"); - - lh.addStaticHoliday ("25-DEC-2037", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2038", "New Years Day"); - - lh.addStaticHoliday ("04-FEB-2038", "Chinese New Year"); - - lh.addStaticHoliday ("05-FEB-2038", "First Day of Muharram"); - - lh.addStaticHoliday ("05-APR-2038", "Saka New Year"); - - lh.addStaticHoliday ("23-APR-2038", "Good Friday"); - - lh.addStaticHoliday ("19-MAY-2038", "Waisak Day"); - - lh.addStaticHoliday ("03-JUN-2038", "Ascension Day"); - - lh.addStaticHoliday ("17-AUG-2038", "Independence Day"); - - lh.addStaticHoliday ("28-OCT-2038", "Idul Fitri"); - - lh.addStaticHoliday ("29-OCT-2038", "Idul Fitri"); - - lh.addStaticHoliday ("05-JAN-2039", "Idul Adha"); - - lh.addStaticHoliday ("24-JAN-2039", "Chinese New Year"); - - lh.addStaticHoliday ("26-JAN-2039", "First Day of Muharram"); - - lh.addStaticHoliday ("25-MAR-2039", "Saka New Year"); - - lh.addStaticHoliday ("06-APR-2039", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("08-APR-2039", "Good Friday"); - - lh.addStaticHoliday ("19-MAY-2039", "Ascension Day"); - - lh.addStaticHoliday ("17-AUG-2039", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-2039", "Ascension of Muhammad"); - - lh.addStaticHoliday ("18-OCT-2039", "Idul Fitri"); - - lh.addStaticHoliday ("19-OCT-2039", "Idul Fitri"); - - lh.addStaticHoliday ("20-OCT-2039", "Idul Fitri"); - - lh.addStaticHoliday ("21-OCT-2039", "Idul Fitri"); - - lh.addStaticHoliday ("26-DEC-2039", "Idul Adha"); - - lh.addStaticHoliday ("14-MAR-2040", "Saka New Year"); - - lh.addStaticHoliday ("30-MAR-2040", "Good Friday"); - - lh.addStaticHoliday ("10-MAY-2040", "Ascension Day"); - - lh.addStaticHoliday ("06-AUG-2040", "Ascension of Muhammad"); - - lh.addStaticHoliday ("17-AUG-2040", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2040", "Idul Fitri"); - - lh.addStaticHoliday ("09-OCT-2040", "Idul Fitri"); - - lh.addStaticHoliday ("10-OCT-2040", "Idul Fitri"); - - lh.addStaticHoliday ("25-DEC-2040", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2041", "New Years Day"); - - lh.addStaticHoliday ("04-JAN-2041", "First Day of Muharram"); - - lh.addStaticHoliday ("01-FEB-2041", "Chinese New Year"); - - lh.addStaticHoliday ("15-MAR-2041", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("02-APR-2041", "Saka New Year"); - - lh.addStaticHoliday ("19-APR-2041", "Good Friday"); - - lh.addStaticHoliday ("16-MAY-2041", "Waisak Day"); - - lh.addStaticHoliday ("30-MAY-2041", "Ascension Day"); - - lh.addStaticHoliday ("26-JUL-2041", "Ascension of Muhammad"); - - lh.addStaticHoliday ("26-SEP-2041", "Idul Fitri"); - - lh.addStaticHoliday ("27-SEP-2041", "Idul Fitri"); - - lh.addStaticHoliday ("04-DEC-2041", "Idul Adha"); - - lh.addStaticHoliday ("25-DEC-2041", "First Day of Muharram"); - - lh.addStaticHoliday ("01-JAN-2042", "New Years Day"); - - lh.addStaticHoliday ("22-JAN-2042", "Chinese New Year"); - - lh.addStaticHoliday ("04-MAR-2042", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("04-APR-2042", "Good Friday"); - - lh.addStaticHoliday ("15-MAY-2042", "Ascension Day"); - - lh.addStaticHoliday ("04-JUN-2042", "Waisak Day"); - - lh.addStaticHoliday ("15-JUL-2042", "Ascension of Muhammad"); - - lh.addStaticHoliday ("18-AUG-2042", "Independence Day Observed"); - - lh.addStaticHoliday ("15-SEP-2042", "Idul Fitri"); - - lh.addStaticHoliday ("16-SEP-2042", "Idul Fitri"); - - lh.addStaticHoliday ("17-SEP-2042", "Idul Fitri"); - - lh.addStaticHoliday ("18-SEP-2042", "Idul Fitri"); - - lh.addStaticHoliday ("19-SEP-2042", "Idul Fitri"); - - lh.addStaticHoliday ("25-DEC-2042", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2043", "New Years Day"); - - lh.addStaticHoliday ("10-FEB-2043", "Chinese New Year"); - - lh.addStaticHoliday ("27-MAR-2043", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2043", "Saka New Year"); - - lh.addStaticHoliday ("07-MAY-2043", "Ascension Day"); - - lh.addStaticHoliday ("17-AUG-2043", "Independence Day"); - - lh.addStaticHoliday ("04-SEP-2043", "Idul Fitri"); - - lh.addStaticHoliday ("07-SEP-2043", "Idul Fitri"); - - lh.addStaticHoliday ("08-SEP-2043", "Idul Fitri"); - - lh.addStaticHoliday ("12-NOV-2043", "Idul Adha"); - - lh.addStaticHoliday ("03-DEC-2043", "First Day of Muharram"); - - lh.addStaticHoliday ("25-DEC-2043", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2044", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2044", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("29-MAR-2044", "Saka New Year"); - - lh.addStaticHoliday ("15-APR-2044", "Good Friday"); - - lh.addStaticHoliday ("12-MAY-2044", "Waisak Day"); - - lh.addStaticHoliday ("26-MAY-2044", "Ascension Day"); - - lh.addStaticHoliday ("24-JUN-2044", "Ascension of Muhammad"); - - lh.addStaticHoliday ("17-AUG-2044", "Independence Day"); - - lh.addStaticHoliday ("23-AUG-2044", "Idul Fitri"); - - lh.addStaticHoliday ("24-AUG-2044", "Idul Fitri"); - - lh.addStaticHoliday ("25-AUG-2044", "Idul Fitri"); - - lh.addStaticHoliday ("26-AUG-2044", "Idul Fitri"); - - lh.addStaticHoliday ("31-OCT-2044", "Idul Adha"); - - lh.addStaticHoliday ("21-NOV-2044", "First Day of Muharram"); - - lh.addStaticHoliday ("30-JAN-2045", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("17-FEB-2045", "Chinese New Year"); - - lh.addStaticHoliday ("20-MAR-2045", "Saka New Year"); - - lh.addStaticHoliday ("07-APR-2045", "Good Friday"); - - lh.addStaticHoliday ("18-MAY-2045", "Ascension Day"); - - lh.addStaticHoliday ("31-MAY-2045", "Waisak Day"); - - lh.addStaticHoliday ("13-JUN-2045", "Ascension of Muhammad"); - - lh.addStaticHoliday ("11-AUG-2045", "Idul Fitri"); - - lh.addStaticHoliday ("14-AUG-2045", "Idul Fitri"); - - lh.addStaticHoliday ("15-AUG-2045", "Idul Fitri"); - - lh.addStaticHoliday ("16-AUG-2045", "Idul Fitri"); - - lh.addStaticHoliday ("17-AUG-2045", "Idul Fitri"); - - lh.addStaticHoliday ("18-AUG-2045", "Idul Fitri"); - - lh.addStaticHoliday ("10-NOV-2045", "First Day of Muharram"); - - lh.addStaticHoliday ("25-DEC-2045", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2046", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2046", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("06-FEB-2046", "Chinese New Year"); - - lh.addStaticHoliday ("23-MAR-2046", "Good Friday"); - - lh.addStaticHoliday ("03-MAY-2046", "Ascension Day"); - - lh.addStaticHoliday ("03-AUG-2046", "Idul Fitri"); - - lh.addStaticHoliday ("06-AUG-2046", "Idul Fitri"); - - lh.addStaticHoliday ("07-AUG-2046", "Idul Fitri"); - - lh.addStaticHoliday ("17-AUG-2046", "Independence Day"); - - lh.addStaticHoliday ("10-OCT-2046", "Idul Adha"); - - lh.addStaticHoliday ("31-OCT-2046", "First Day of Muharram"); - - lh.addStaticHoliday ("25-DEC-2046", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2047", "New Years Day"); - - lh.addStaticHoliday ("09-JAN-2047", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("27-MAR-2047", "Saka New Year"); - - lh.addStaticHoliday ("12-APR-2047", "Good Friday"); - - lh.addStaticHoliday ("10-MAY-2047", "Waisak Day"); - - lh.addStaticHoliday ("23-MAY-2047", "Ascension Day"); - - lh.addStaticHoliday ("23-JUL-2047", "Idul Fitri"); - - lh.addStaticHoliday ("24-JUL-2047", "Idul Fitri"); - - lh.addStaticHoliday ("25-JUL-2047", "Idul Fitri"); - - lh.addStaticHoliday ("26-JUL-2047", "Idul Fitri"); - - lh.addStaticHoliday ("30-SEP-2047", "Idul Adha"); - - lh.addStaticHoliday ("25-DEC-2047", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2048", "New Years Day"); - - lh.addStaticHoliday ("14-FEB-2048", "Chinese New Year"); - - lh.addStaticHoliday ("16-MAR-2048", "Saka New Year"); - - lh.addStaticHoliday ("03-APR-2048", "Good Friday"); - - lh.addStaticHoliday ("11-MAY-2048", "Ascension of Muhammad"); - - lh.addStaticHoliday ("14-MAY-2048", "Ascension Day"); - - lh.addStaticHoliday ("28-MAY-2048", "Waisak Day"); - - lh.addStaticHoliday ("13-JUL-2048", "Idul Fitri"); - - lh.addStaticHoliday ("14-JUL-2048", "Idul Fitri"); - - lh.addStaticHoliday ("15-JUL-2048", "Idul Fitri"); - - lh.addStaticHoliday ("17-AUG-2048", "Independence Day"); - - lh.addStaticHoliday ("09-OCT-2048", "First Day of Muharram"); - - lh.addStaticHoliday ("18-DEC-2048", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("25-DEC-2048", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2049", "New Years Day"); - - lh.addStaticHoliday ("02-FEB-2049", "Chinese New Year"); - - lh.addStaticHoliday ("16-APR-2049", "Good Friday"); - - lh.addStaticHoliday ("30-APR-2049", "Ascension of Muhammad"); - - lh.addStaticHoliday ("17-MAY-2049", "Waisak Day"); - - lh.addStaticHoliday ("27-MAY-2049", "Ascension Day"); - - lh.addStaticHoliday ("30-JUN-2049", "Idul Fitri"); - - lh.addStaticHoliday ("01-JUL-2049", "Idul Fitri"); - - lh.addStaticHoliday ("02-JUL-2049", "Idul Fitri"); - - lh.addStaticHoliday ("05-JUL-2049", "Idul Fitri"); - - lh.addStaticHoliday ("06-JUL-2049", "Idul Fitri"); - - lh.addStaticHoliday ("17-AUG-2049", "Independence Day"); - - lh.addStaticHoliday ("08-SEP-2049", "Idul Adha"); - - lh.addStaticHoliday ("28-SEP-2049", "First Day of Muharram"); - - lh.addStaticHoliday ("07-DEC-2049", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("24-MAR-2050", "Saka New Year"); - - lh.addStaticHoliday ("08-APR-2050", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2050", "Ascension of Muhammad"); - - lh.addStaticHoliday ("19-MAY-2050", "Ascension Day"); - - lh.addStaticHoliday ("20-JUN-2050", "Idul Fitri"); - - lh.addStaticHoliday ("21-JUN-2050", "Idul Fitri"); - - lh.addStaticHoliday ("22-JUN-2050", "Idul Fitri"); - - lh.addStaticHoliday ("23-JUN-2050", "Idul Fitri"); - - lh.addStaticHoliday ("24-JUN-2050", "Idul Fitri"); - - lh.addStaticHoliday ("17-AUG-2050", "Independence Day"); - - lh.addStaticHoliday ("31-MAR-2051", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2051", "Saka New Year"); - - lh.addStaticHoliday ("11-MAY-2051", "Ascension Day"); - - lh.addStaticHoliday ("26-MAY-2051", "Waisak Day"); - - lh.addStaticHoliday ("09-JUN-2051", "Idul Fitri"); - - lh.addStaticHoliday ("12-JUN-2051", "Idul Fitri"); - - lh.addStaticHoliday ("13-JUN-2051", "Idul Fitri"); - - lh.addStaticHoliday ("17-AUG-2051", "Idul Adha"); - - lh.addStaticHoliday ("07-SEP-2051", "First Day of Muharram"); - - lh.addStaticHoliday ("16-NOV-2051", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("25-DEC-2051", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2052", "New Years Day"); - - lh.addStaticHoliday ("01-FEB-2052", "Chinese New Year"); - - lh.addStaticHoliday ("29-MAR-2052", "Ascension of Muhammad"); - - lh.addStaticHoliday ("01-APR-2052", "Saka New Year"); - - lh.addStaticHoliday ("19-APR-2052", "Good Friday"); - - lh.addStaticHoliday ("14-MAY-2052", "Waisak Day"); - - lh.addStaticHoliday ("29-MAY-2052", "Idul Fitri"); - - lh.addStaticHoliday ("30-MAY-2052", "Idul Fitri"); - - lh.addStaticHoliday ("31-MAY-2052", "Idul Fitri"); - - lh.addStaticHoliday ("03-JUN-2052", "Idul Fitri"); - - lh.addStaticHoliday ("04-JUN-2052", "Idul Fitri"); - - lh.addStaticHoliday ("05-AUG-2052", "Idul Adha"); - - lh.addStaticHoliday ("26-AUG-2052", "First Day of Muharram"); - - lh.addStaticHoliday ("04-NOV-2052", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("25-DEC-2052", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2053", "New Years Day"); - - lh.addStaticHoliday ("19-FEB-2053", "Chinese New Year"); - - lh.addStaticHoliday ("18-MAR-2053", "Ascension of Muhammad"); - - lh.addStaticHoliday ("20-MAR-2053", "Saka New Year"); - - lh.addStaticHoliday ("04-APR-2053", "Good Friday"); - - lh.addStaticHoliday ("15-MAY-2053", "Ascension Day"); - - lh.addStaticHoliday ("16-MAY-2053", "Idul Fitri"); - - lh.addStaticHoliday ("19-MAY-2053", "Idul Fitri"); - - lh.addStaticHoliday ("20-MAY-2053", "Idul Fitri"); - - lh.addStaticHoliday ("21-MAY-2053", "Idul Fitri"); - - lh.addStaticHoliday ("22-MAY-2053", "Idul Fitri"); - - lh.addStaticHoliday ("23-MAY-2053", "Idul Fitri"); - - lh.addStaticHoliday ("15-AUG-2053", "First Day of Muharram"); - - lh.addStaticHoliday ("18-AUG-2053", "Independence Day Observed"); - - lh.addStaticHoliday ("24-OCT-2053", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("25-DEC-2053", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2054", "New Years Day"); - - lh.addStaticHoliday ("27-MAR-2054", "Good Friday"); - - lh.addStaticHoliday ("08-APR-2054", "Saka New Year"); - - lh.addStaticHoliday ("07-MAY-2054", "Ascension Day"); - - lh.addStaticHoliday ("08-MAY-2054", "Idul Fitri"); - - lh.addStaticHoliday ("11-MAY-2054", "Idul Fitri"); - - lh.addStaticHoliday ("12-MAY-2054", "Idul Fitri"); - - lh.addStaticHoliday ("21-MAY-2054", "Waisak Day"); - - lh.addStaticHoliday ("16-JUL-2054", "Idul Adha"); - - lh.addStaticHoliday ("05-AUG-2054", "First Day of Muharram"); - - lh.addStaticHoliday ("17-AUG-2054", "Independence Day"); - - lh.addStaticHoliday ("14-OCT-2054", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("25-DEC-2054", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2055", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-2055", "Chinese New Year"); - - lh.addStaticHoliday ("24-FEB-2055", "Ascension of Muhammad"); - - lh.addStaticHoliday ("29-MAR-2055", "Saka New Year"); - - lh.addStaticHoliday ("16-APR-2055", "Good Friday"); - - lh.addStaticHoliday ("27-APR-2055", "Idul Fitri"); - - lh.addStaticHoliday ("28-APR-2055", "Idul Fitri"); - - lh.addStaticHoliday ("29-APR-2055", "Idul Fitri"); - - lh.addStaticHoliday ("30-APR-2055", "Idul Fitri"); - - lh.addStaticHoliday ("11-MAY-2055", "Waisak Day"); - - lh.addStaticHoliday ("27-MAY-2055", "Ascension Day"); - - lh.addStaticHoliday ("05-JUL-2055", "Idul Adha"); - - lh.addStaticHoliday ("26-JUL-2055", "First Day of Muharram"); - - lh.addStaticHoliday ("17-AUG-2055", "Independence Day"); - - lh.addStaticHoliday ("15-FEB-2056", "Chinese New Year"); - - lh.addStaticHoliday ("17-MAR-2056", "Saka New Year"); - - lh.addStaticHoliday ("31-MAR-2056", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2056", "Idul Fitri"); - - lh.addStaticHoliday ("18-APR-2056", "Idul Fitri"); - - lh.addStaticHoliday ("19-APR-2056", "Idul Fitri"); - - lh.addStaticHoliday ("11-MAY-2056", "Ascension Day"); - - lh.addStaticHoliday ("29-MAY-2056", "Waisak Day"); - - lh.addStaticHoliday ("14-JUL-2056", "First Day of Muharram"); - - lh.addStaticHoliday ("17-AUG-2056", "Independence Day"); - - lh.addStaticHoliday ("22-SEP-2056", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("25-DEC-2056", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2057", "New Years Day"); - - lh.addStaticHoliday ("02-FEB-2057", "Ascension of Muhammad"); - - lh.addStaticHoliday ("04-APR-2057", "Idul Fitri"); - - lh.addStaticHoliday ("05-APR-2057", "Idul Fitri"); - - lh.addStaticHoliday ("06-APR-2057", "Idul Fitri"); - - lh.addStaticHoliday ("09-APR-2057", "Idul Fitri"); - - lh.addStaticHoliday ("10-APR-2057", "Idul Fitri"); - - lh.addStaticHoliday ("20-APR-2057", "Good Friday"); - - lh.addStaticHoliday ("31-MAY-2057", "Ascension Day"); - - lh.addStaticHoliday ("13-JUN-2057", "Idul Adha"); - - lh.addStaticHoliday ("03-JUL-2057", "First Day of Muharram"); - - lh.addStaticHoliday ("17-AUG-2057", "Independence Day"); - - lh.addStaticHoliday ("11-SEP-2057", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("25-DEC-2057", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2058", "New Years Day"); - - lh.addStaticHoliday ("22-JAN-2058", "Ascension of Muhammad"); - - lh.addStaticHoliday ("24-JAN-2058", "Chinese New Year"); - - lh.addStaticHoliday ("22-MAR-2058", "Idul Fitri"); - - lh.addStaticHoliday ("25-MAR-2058", "Idul Fitri"); - - lh.addStaticHoliday ("26-MAR-2058", "Idul Fitri"); - - lh.addStaticHoliday ("27-MAR-2058", "Idul Fitri"); - - lh.addStaticHoliday ("28-MAR-2058", "Idul Fitri"); - - lh.addStaticHoliday ("29-MAR-2058", "Idul Fitri"); - - lh.addStaticHoliday ("12-APR-2058", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2058", "Saka New Year"); - - lh.addStaticHoliday ("08-MAY-2058", "Waisak Day"); - - lh.addStaticHoliday ("23-MAY-2058", "Ascension Day"); - - lh.addStaticHoliday ("25-DEC-2058", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2059", "New Years Day"); - - lh.addStaticHoliday ("12-FEB-2059", "Chinese New Year"); - - lh.addStaticHoliday ("14-MAR-2059", "Idul Fitri"); - - lh.addStaticHoliday ("17-MAR-2059", "Idul Fitri"); - - lh.addStaticHoliday ("18-MAR-2059", "Idul Fitri"); - - lh.addStaticHoliday ("28-MAR-2059", "Good Friday"); - - lh.addStaticHoliday ("14-APR-2059", "Saka New Year"); - - lh.addStaticHoliday ("08-MAY-2059", "Ascension Day"); - - lh.addStaticHoliday ("22-MAY-2059", "Idul Adha"); - - lh.addStaticHoliday ("27-MAY-2059", "Waisak Day"); - - lh.addStaticHoliday ("12-JUN-2059", "First Day of Muharram"); - - lh.addStaticHoliday ("18-AUG-2059", "Independence Day Observed"); - - lh.addStaticHoliday ("21-AUG-2059", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("25-DEC-2059", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2060", "New Years Day"); - - lh.addStaticHoliday ("02-FEB-2060", "Chinese New Year"); - - lh.addStaticHoliday ("03-MAR-2060", "Idul Fitri"); - - lh.addStaticHoliday ("04-MAR-2060", "Idul Fitri"); - - lh.addStaticHoliday ("05-MAR-2060", "Idul Fitri"); - - lh.addStaticHoliday ("08-MAR-2060", "Idul Fitri"); - - lh.addStaticHoliday ("09-MAR-2060", "Idul Fitri"); - - lh.addStaticHoliday ("01-APR-2060", "Saka New Year"); - - lh.addStaticHoliday ("16-APR-2060", "Good Friday"); - - lh.addStaticHoliday ("11-MAY-2060", "Idul Adha"); - - lh.addStaticHoliday ("27-MAY-2060", "Ascension Day"); - - lh.addStaticHoliday ("31-MAY-2060", "First Day of Muharram"); - - lh.addStaticHoliday ("09-AUG-2060", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("17-AUG-2060", "Independence Day"); - - lh.addStaticHoliday ("20-DEC-2060", "Ascension of Muhammad"); - - lh.addStaticHoliday ("21-JAN-2061", "Chinese New Year"); - - lh.addStaticHoliday ("18-FEB-2061", "Idul Fitri"); - - lh.addStaticHoliday ("21-FEB-2061", "Idul Fitri"); - - lh.addStaticHoliday ("22-FEB-2061", "Idul Fitri"); - - lh.addStaticHoliday ("23-FEB-2061", "Idul Fitri"); - - lh.addStaticHoliday ("24-FEB-2061", "Idul Fitri"); - - lh.addStaticHoliday ("25-FEB-2061", "Idul Fitri"); - - lh.addStaticHoliday ("08-APR-2061", "Good Friday"); - - lh.addStaticHoliday ("20-APR-2061", "Saka New Year"); - - lh.addStaticHoliday ("04-MAY-2061", "Waisak Day"); - - lh.addStaticHoliday ("19-MAY-2061", "Ascension Day"); - - lh.addStaticHoliday ("29-JUL-2061", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("17-AUG-2061", "Independence Day"); - - lh.addStaticHoliday ("09-FEB-2062", "Chinese New Year"); - - lh.addStaticHoliday ("10-FEB-2062", "Idul Fitri"); - - lh.addStaticHoliday ("13-FEB-2062", "Idul Fitri"); - - lh.addStaticHoliday ("14-FEB-2062", "Idul Fitri"); - - lh.addStaticHoliday ("24-MAR-2062", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2062", "Saka New Year"); - - lh.addStaticHoliday ("20-APR-2062", "Idul Adha"); - - lh.addStaticHoliday ("04-MAY-2062", "Ascension Day"); - - lh.addStaticHoliday ("11-MAY-2062", "First Day of Muharram"); - - lh.addStaticHoliday ("23-MAY-2062", "Waisak Day"); - - lh.addStaticHoliday ("19-JUL-2062", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("17-AUG-2062", "Independence Day"); - - lh.addStaticHoliday ("29-NOV-2062", "Ascension of Muhammad"); - - lh.addStaticHoliday ("25-DEC-2062", "Christmas Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/IEPHoliday.java b/org/drip/analytics/holset/IEPHoliday.java deleted file mode 100644 index 3547541..0000000 --- a/org/drip/analytics/holset/IEPHoliday.java +++ /dev/null @@ -1,741 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class IEPHoliday implements org.drip.analytics.holset.LocationHoliday { - public IEPHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "IEP"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("17-MAR-1998", "St. Patricks Day"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("04-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("01-JUN-1998", "Spring Bank Holiday"); - - lh.addStaticHoliday ("03-AUG-1998", "Summer Bank Holiday"); - - lh.addStaticHoliday ("26-OCT-1998", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-1998", "St. Stephens Day Observed"); - - lh.addStaticHoliday ("29-DEC-1998", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("17-MAR-1999", "St. Patricks Day"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-1999", "Labour Day"); - - lh.addStaticHoliday ("07-JUN-1999", "Spring Bank Holiday"); - - lh.addStaticHoliday ("02-AUG-1999", "Summer Bank Holiday"); - - lh.addStaticHoliday ("25-OCT-1999", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("27-DEC-1999", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-1999", "St. Stephens Day Observed"); - - lh.addStaticHoliday ("29-DEC-1999", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2000", "New Years Day Observed"); - - lh.addStaticHoliday ("17-MAR-2000", "St. Patricks Day"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("05-JUN-2000", "Spring Bank Holiday"); - - lh.addStaticHoliday ("07-AUG-2000", "Summer Bank Holiday"); - - lh.addStaticHoliday ("30-OCT-2000", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "St. Stephens Day"); - - lh.addStaticHoliday ("27-DEC-2000", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("19-MAR-2001", "St. Patricks Day Observed"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("07-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("04-JUN-2001", "Spring Bank Holiday"); - - lh.addStaticHoliday ("06-AUG-2001", "Summer Bank Holiday"); - - lh.addStaticHoliday ("29-OCT-2001", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "St. Stephens Day"); - - lh.addStaticHoliday ("27-DEC-2001", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("18-MAR-2002", "St. Patricks Day Observed"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("06-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("03-JUN-2002", "Spring Bank Holiday"); - - lh.addStaticHoliday ("05-AUG-2002", "Summer Bank Holiday"); - - lh.addStaticHoliday ("28-OCT-2002", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "St. Stephens Day"); - - lh.addStaticHoliday ("27-DEC-2002", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("17-MAR-2003", "St. Patricks Day"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("02-JUN-2003", "Spring Bank Holiday"); - - lh.addStaticHoliday ("04-AUG-2003", "Summer Bank Holiday"); - - lh.addStaticHoliday ("27-OCT-2003", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "St. Stephens Day"); - - lh.addStaticHoliday ("29-DEC-2003", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("17-MAR-2004", "St. Patricks Day"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2004", "Labour Day"); - - lh.addStaticHoliday ("07-JUN-2004", "Spring Bank Holiday"); - - lh.addStaticHoliday ("02-AUG-2004", "Summer Bank Holiday"); - - lh.addStaticHoliday ("25-OCT-2004", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("27-DEC-2004", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2004", "St. Stephens Day Observed"); - - lh.addStaticHoliday ("29-DEC-2004", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2005", "New Years Day Observed"); - - lh.addStaticHoliday ("17-MAR-2005", "St. Patricks Day"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2005", "Labour Day"); - - lh.addStaticHoliday ("06-JUN-2005", "Spring Bank Holiday"); - - lh.addStaticHoliday ("01-AUG-2005", "Summer Bank Holiday"); - - lh.addStaticHoliday ("31-OCT-2005", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("26-DEC-2005", "St. Stephens Day"); - - lh.addStaticHoliday ("27-DEC-2005", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2005", "Bank Holiday"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("17-MAR-2006", "St. Patricks Day"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("05-JUN-2006", "Spring Bank Holiday"); - - lh.addStaticHoliday ("07-AUG-2006", "Summer Bank Holiday"); - - lh.addStaticHoliday ("30-OCT-2006", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "St. Stephens Day"); - - lh.addStaticHoliday ("27-DEC-2006", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("19-MAR-2007", "St. Patricks Day Observed"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("07-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("04-JUN-2007", "Spring Bank Holiday"); - - lh.addStaticHoliday ("06-AUG-2007", "Summer Bank Holiday"); - - lh.addStaticHoliday ("29-OCT-2007", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "St. Stephens Day"); - - lh.addStaticHoliday ("27-DEC-2007", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("17-MAR-2008", "St. Patricks Day"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("02-JUN-2008", "Spring Bank Holiday"); - - lh.addStaticHoliday ("04-AUG-2008", "Summer Bank Holiday"); - - lh.addStaticHoliday ("27-OCT-2008", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "St. Stephens Day"); - - lh.addStaticHoliday ("29-DEC-2008", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("17-MAR-2009", "St. Patricks Day"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("04-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("01-JUN-2009", "Spring Bank Holiday"); - - lh.addStaticHoliday ("03-AUG-2009", "Summer Bank Holiday"); - - lh.addStaticHoliday ("26-OCT-2009", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2009", "St. Stephens Day Observed"); - - lh.addStaticHoliday ("29-DEC-2009", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("17-MAR-2010", "St. Patricks Day"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2010", "Labour Day"); - - lh.addStaticHoliday ("07-JUN-2010", "Spring Bank Holiday"); - - lh.addStaticHoliday ("02-AUG-2010", "Summer Bank Holiday"); - - lh.addStaticHoliday ("25-OCT-2010", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("27-DEC-2010", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2010", "St. Stephens Day Observed"); - - lh.addStaticHoliday ("29-DEC-2010", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2011", "New Years Day Observed"); - - lh.addStaticHoliday ("17-MAR-2011", "St. Patricks Day"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2011", "Labour Day"); - - lh.addStaticHoliday ("06-JUN-2011", "Spring Bank Holiday"); - - lh.addStaticHoliday ("01-AUG-2011", "Summer Bank Holiday"); - - lh.addStaticHoliday ("31-OCT-2011", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("26-DEC-2011", "St. Stephens Day"); - - lh.addStaticHoliday ("27-DEC-2011", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2011", "Bank Holiday"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("19-MAR-2012", "St. Patricks Day Observed"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("07-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("04-JUN-2012", "Spring Bank Holiday"); - - lh.addStaticHoliday ("06-AUG-2012", "Summer Bank Holiday"); - - lh.addStaticHoliday ("29-OCT-2012", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "St. Stephens Day"); - - lh.addStaticHoliday ("27-DEC-2012", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("18-MAR-2013", "St. Patricks Day Observed"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("06-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("03-JUN-2013", "Spring Bank Holiday"); - - lh.addStaticHoliday ("05-AUG-2013", "Summer Bank Holiday"); - - lh.addStaticHoliday ("28-OCT-2013", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "St. Stephens Day"); - - lh.addStaticHoliday ("27-DEC-2013", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("17-MAR-2014", "St. Patricks Day"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("02-JUN-2014", "Spring Bank Holiday"); - - lh.addStaticHoliday ("04-AUG-2014", "Summer Bank Holiday"); - - lh.addStaticHoliday ("27-OCT-2014", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "St. Stephens Day"); - - lh.addStaticHoliday ("29-DEC-2014", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("17-MAR-2015", "St. Patricks Day"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("04-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("01-JUN-2015", "Spring Bank Holiday"); - - lh.addStaticHoliday ("03-AUG-2015", "Summer Bank Holiday"); - - lh.addStaticHoliday ("26-OCT-2015", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2015", "St. Stephens Day Observed"); - - lh.addStaticHoliday ("29-DEC-2015", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("17-MAR-2016", "St. Patricks Day"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2016", "Labour Day"); - - lh.addStaticHoliday ("06-JUN-2016", "Spring Bank Holiday"); - - lh.addStaticHoliday ("01-AUG-2016", "Summer Bank Holiday"); - - lh.addStaticHoliday ("31-OCT-2016", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("26-DEC-2016", "St. Stephens Day"); - - lh.addStaticHoliday ("27-DEC-2016", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2016", "Bank Holiday"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("17-MAR-2017", "St. Patricks Day"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("05-JUN-2017", "Spring Bank Holiday"); - - lh.addStaticHoliday ("07-AUG-2017", "Summer Bank Holiday"); - - lh.addStaticHoliday ("30-OCT-2017", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "St. Stephens Day"); - - lh.addStaticHoliday ("27-DEC-2017", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("19-MAR-2018", "St. Patricks Day Observed"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("07-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("04-JUN-2018", "Spring Bank Holiday"); - - lh.addStaticHoliday ("06-AUG-2018", "Summer Bank Holiday"); - - lh.addStaticHoliday ("29-OCT-2018", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "St. Stephens Day"); - - lh.addStaticHoliday ("27-DEC-2018", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("18-MAR-2019", "St. Patricks Day Observed"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("06-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("03-JUN-2019", "Spring Bank Holiday"); - - lh.addStaticHoliday ("05-AUG-2019", "Summer Bank Holiday"); - - lh.addStaticHoliday ("28-OCT-2019", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "St. Stephens Day"); - - lh.addStaticHoliday ("27-DEC-2019", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("17-MAR-2020", "St. Patricks Day"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("04-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("01-JUN-2020", "Spring Bank Holiday"); - - lh.addStaticHoliday ("03-AUG-2020", "Summer Bank Holiday"); - - lh.addStaticHoliday ("26-OCT-2020", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2020", "St. Stephens Day Observed"); - - lh.addStaticHoliday ("29-DEC-2020", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("17-MAR-2021", "St. Patricks Day"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2021", "Labour Day"); - - lh.addStaticHoliday ("07-JUN-2021", "Spring Bank Holiday"); - - lh.addStaticHoliday ("02-AUG-2021", "Summer Bank Holiday"); - - lh.addStaticHoliday ("25-OCT-2021", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("27-DEC-2021", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2021", "St. Stephens Day Observed"); - - lh.addStaticHoliday ("29-DEC-2021", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2022", "New Years Day Observed"); - - lh.addStaticHoliday ("17-MAR-2022", "St. Patricks Day"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2022", "Labour Day"); - - lh.addStaticHoliday ("06-JUN-2022", "Spring Bank Holiday"); - - lh.addStaticHoliday ("01-AUG-2022", "Summer Bank Holiday"); - - lh.addStaticHoliday ("31-OCT-2022", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("26-DEC-2022", "St. Stephens Day"); - - lh.addStaticHoliday ("27-DEC-2022", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2022", "Bank Holiday"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("17-MAR-2023", "St. Patricks Day"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("05-JUN-2023", "Spring Bank Holiday"); - - lh.addStaticHoliday ("07-AUG-2023", "Summer Bank Holiday"); - - lh.addStaticHoliday ("30-OCT-2023", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "St. Stephens Day"); - - lh.addStaticHoliday ("27-DEC-2023", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("18-MAR-2024", "St. Patricks Day Observed"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("06-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("03-JUN-2024", "Spring Bank Holiday"); - - lh.addStaticHoliday ("05-AUG-2024", "Summer Bank Holiday"); - - lh.addStaticHoliday ("28-OCT-2024", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "St. Stephens Day"); - - lh.addStaticHoliday ("27-DEC-2024", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("17-MAR-2025", "St. Patricks Day"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("02-JUN-2025", "Spring Bank Holiday"); - - lh.addStaticHoliday ("04-AUG-2025", "Summer Bank Holiday"); - - lh.addStaticHoliday ("27-OCT-2025", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "St. Stephens Day"); - - lh.addStaticHoliday ("29-DEC-2025", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("17-MAR-2026", "St. Patricks Day"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("04-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("01-JUN-2026", "Spring Bank Holiday"); - - lh.addStaticHoliday ("03-AUG-2026", "Summer Bank Holiday"); - - lh.addStaticHoliday ("26-OCT-2026", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2026", "St. Stephens Day Observed"); - - lh.addStaticHoliday ("29-DEC-2026", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("17-MAR-2027", "St. Patricks Day"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2027", "Labour Day"); - - lh.addStaticHoliday ("07-JUN-2027", "Spring Bank Holiday"); - - lh.addStaticHoliday ("02-AUG-2027", "Summer Bank Holiday"); - - lh.addStaticHoliday ("25-OCT-2027", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("27-DEC-2027", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2027", "St. Stephens Day Observed"); - - lh.addStaticHoliday ("29-DEC-2027", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2028", "New Years Day Observed"); - - lh.addStaticHoliday ("17-MAR-2028", "St. Patricks Day"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("05-JUN-2028", "Spring Bank Holiday"); - - lh.addStaticHoliday ("07-AUG-2028", "Summer Bank Holiday"); - - lh.addStaticHoliday ("30-OCT-2028", "Autumn Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "St. Stephens Day"); - - lh.addStaticHoliday ("27-DEC-2028", "Bank Holiday"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/IGPHoliday.java b/org/drip/analytics/holset/IGPHoliday.java deleted file mode 100644 index 2856649..0000000 --- a/org/drip/analytics/holset/IGPHoliday.java +++ /dev/null @@ -1,709 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class IGPHoliday implements org.drip.analytics.holset.LocationHoliday { - public IGPHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "IGP"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("25-DEC-2005", ""); - - lh.addStaticHoliday ("01-JAN-2006", ""); - - lh.addStaticHoliday ("27-FEB-2006", ""); - - lh.addStaticHoliday ("28-FEB-2006", ""); - - lh.addStaticHoliday ("14-APR-2006", ""); - - lh.addStaticHoliday ("21-APR-2006", ""); - - lh.addStaticHoliday ("01-MAY-2006", ""); - - lh.addStaticHoliday ("15-JUN-2006", ""); - - lh.addStaticHoliday ("07-SEP-2006", ""); - - lh.addStaticHoliday ("12-OCT-2006", ""); - - lh.addStaticHoliday ("02-NOV-2006", ""); - - lh.addStaticHoliday ("15-NOV-2006", ""); - - lh.addStaticHoliday ("25-DEC-2006", ""); - - lh.addStaticHoliday ("01-JAN-2007", ""); - - lh.addStaticHoliday ("19-FEB-2007", ""); - - lh.addStaticHoliday ("20-FEB-2007", ""); - - lh.addStaticHoliday ("06-APR-2007", ""); - - lh.addStaticHoliday ("21-APR-2007", ""); - - lh.addStaticHoliday ("01-MAY-2007", ""); - - lh.addStaticHoliday ("07-JUN-2007", ""); - - lh.addStaticHoliday ("07-SEP-2007", ""); - - lh.addStaticHoliday ("12-OCT-2007", ""); - - lh.addStaticHoliday ("02-NOV-2007", ""); - - lh.addStaticHoliday ("15-NOV-2007", ""); - - lh.addStaticHoliday ("25-DEC-2007", ""); - - lh.addStaticHoliday ("01-JAN-2008", ""); - - lh.addStaticHoliday ("04-FEB-2008", ""); - - lh.addStaticHoliday ("05-FEB-2008", ""); - - lh.addStaticHoliday ("21-MAR-2008", ""); - - lh.addStaticHoliday ("21-APR-2008", ""); - - lh.addStaticHoliday ("01-MAY-2008", ""); - - lh.addStaticHoliday ("22-MAY-2008", ""); - - lh.addStaticHoliday ("07-SEP-2008", ""); - - lh.addStaticHoliday ("12-OCT-2008", ""); - - lh.addStaticHoliday ("02-NOV-2008", ""); - - lh.addStaticHoliday ("15-NOV-2008", ""); - - lh.addStaticHoliday ("25-DEC-2008", ""); - - lh.addStaticHoliday ("01-JAN-2009", ""); - - lh.addStaticHoliday ("23-FEB-2009", ""); - - lh.addStaticHoliday ("24-FEB-2009", ""); - - lh.addStaticHoliday ("10-APR-2009", ""); - - lh.addStaticHoliday ("21-APR-2009", ""); - - lh.addStaticHoliday ("01-MAY-2009", ""); - - lh.addStaticHoliday ("11-JUN-2009", ""); - - lh.addStaticHoliday ("07-SEP-2009", ""); - - lh.addStaticHoliday ("12-OCT-2009", ""); - - lh.addStaticHoliday ("02-NOV-2009", ""); - - lh.addStaticHoliday ("15-NOV-2009", ""); - - lh.addStaticHoliday ("25-DEC-2009", ""); - - lh.addStaticHoliday ("01-JAN-2010", ""); - - lh.addStaticHoliday ("15-FEB-2010", ""); - - lh.addStaticHoliday ("16-FEB-2010", ""); - - lh.addStaticHoliday ("02-APR-2010", ""); - - lh.addStaticHoliday ("21-APR-2010", ""); - - lh.addStaticHoliday ("01-MAY-2010", ""); - - lh.addStaticHoliday ("03-JUN-2010", ""); - - lh.addStaticHoliday ("07-SEP-2010", ""); - - lh.addStaticHoliday ("12-OCT-2010", ""); - - lh.addStaticHoliday ("02-NOV-2010", ""); - - lh.addStaticHoliday ("15-NOV-2010", ""); - - lh.addStaticHoliday ("25-DEC-2010", ""); - - lh.addStaticHoliday ("01-JAN-2011", ""); - - lh.addStaticHoliday ("07-MAR-2011", ""); - - lh.addStaticHoliday ("08-MAR-2011", ""); - - lh.addStaticHoliday ("21-APR-2011", ""); - - lh.addStaticHoliday ("22-APR-2011", ""); - - lh.addStaticHoliday ("01-MAY-2011", ""); - - lh.addStaticHoliday ("23-JUN-2011", ""); - - lh.addStaticHoliday ("07-SEP-2011", ""); - - lh.addStaticHoliday ("12-OCT-2011", ""); - - lh.addStaticHoliday ("02-NOV-2011", ""); - - lh.addStaticHoliday ("15-NOV-2011", ""); - - lh.addStaticHoliday ("25-DEC-2011", ""); - - lh.addStaticHoliday ("01-JAN-2012", ""); - - lh.addStaticHoliday ("20-FEB-2012", ""); - - lh.addStaticHoliday ("21-FEB-2012", ""); - - lh.addStaticHoliday ("06-APR-2012", ""); - - lh.addStaticHoliday ("21-APR-2012", ""); - - lh.addStaticHoliday ("01-MAY-2012", ""); - - lh.addStaticHoliday ("07-JUN-2012", ""); - - lh.addStaticHoliday ("07-SEP-2012", ""); - - lh.addStaticHoliday ("12-OCT-2012", ""); - - lh.addStaticHoliday ("02-NOV-2012", ""); - - lh.addStaticHoliday ("15-NOV-2012", ""); - - lh.addStaticHoliday ("25-DEC-2012", ""); - - lh.addStaticHoliday ("01-JAN-2013", ""); - - lh.addStaticHoliday ("11-FEB-2013", ""); - - lh.addStaticHoliday ("12-FEB-2013", ""); - - lh.addStaticHoliday ("29-MAR-2013", ""); - - lh.addStaticHoliday ("21-APR-2013", ""); - - lh.addStaticHoliday ("01-MAY-2013", ""); - - lh.addStaticHoliday ("30-MAY-2013", ""); - - lh.addStaticHoliday ("07-SEP-2013", ""); - - lh.addStaticHoliday ("12-OCT-2013", ""); - - lh.addStaticHoliday ("02-NOV-2013", ""); - - lh.addStaticHoliday ("15-NOV-2013", ""); - - lh.addStaticHoliday ("25-DEC-2013", ""); - - lh.addStaticHoliday ("01-JAN-2014", ""); - - lh.addStaticHoliday ("03-MAR-2014", ""); - - lh.addStaticHoliday ("04-MAR-2014", ""); - - lh.addStaticHoliday ("18-APR-2014", ""); - - lh.addStaticHoliday ("21-APR-2014", ""); - - lh.addStaticHoliday ("01-MAY-2014", ""); - - lh.addStaticHoliday ("19-JUN-2014", ""); - - lh.addStaticHoliday ("07-SEP-2014", ""); - - lh.addStaticHoliday ("12-OCT-2014", ""); - - lh.addStaticHoliday ("02-NOV-2014", ""); - - lh.addStaticHoliday ("15-NOV-2014", ""); - - lh.addStaticHoliday ("25-DEC-2014", ""); - - lh.addStaticHoliday ("01-JAN-2015", ""); - - lh.addStaticHoliday ("16-FEB-2015", ""); - - lh.addStaticHoliday ("17-FEB-2015", ""); - - lh.addStaticHoliday ("03-APR-2015", ""); - - lh.addStaticHoliday ("21-APR-2015", ""); - - lh.addStaticHoliday ("01-MAY-2015", ""); - - lh.addStaticHoliday ("04-JUN-2015", ""); - - lh.addStaticHoliday ("07-SEP-2015", ""); - - lh.addStaticHoliday ("12-OCT-2015", ""); - - lh.addStaticHoliday ("02-NOV-2015", ""); - - lh.addStaticHoliday ("15-NOV-2015", ""); - - lh.addStaticHoliday ("25-DEC-2015", ""); - - lh.addStaticHoliday ("01-JAN-2016", ""); - - lh.addStaticHoliday ("08-FEB-2016", ""); - - lh.addStaticHoliday ("09-FEB-2016", ""); - - lh.addStaticHoliday ("25-MAR-2016", ""); - - lh.addStaticHoliday ("21-APR-2016", ""); - - lh.addStaticHoliday ("01-MAY-2016", ""); - - lh.addStaticHoliday ("26-MAY-2016", ""); - - lh.addStaticHoliday ("07-SEP-2016", ""); - - lh.addStaticHoliday ("12-OCT-2016", ""); - - lh.addStaticHoliday ("02-NOV-2016", ""); - - lh.addStaticHoliday ("15-NOV-2016", ""); - - lh.addStaticHoliday ("25-DEC-2016", ""); - - lh.addStaticHoliday ("01-JAN-2017", ""); - - lh.addStaticHoliday ("27-FEB-2017", ""); - - lh.addStaticHoliday ("28-FEB-2017", ""); - - lh.addStaticHoliday ("14-APR-2017", ""); - - lh.addStaticHoliday ("21-APR-2017", ""); - - lh.addStaticHoliday ("01-MAY-2017", ""); - - lh.addStaticHoliday ("15-JUN-2017", ""); - - lh.addStaticHoliday ("07-SEP-2017", ""); - - lh.addStaticHoliday ("12-OCT-2017", ""); - - lh.addStaticHoliday ("02-NOV-2017", ""); - - lh.addStaticHoliday ("15-NOV-2017", ""); - - lh.addStaticHoliday ("25-DEC-2017", ""); - - lh.addStaticHoliday ("01-JAN-2018", ""); - - lh.addStaticHoliday ("12-FEB-2018", ""); - - lh.addStaticHoliday ("13-FEB-2018", ""); - - lh.addStaticHoliday ("30-MAR-2018", ""); - - lh.addStaticHoliday ("21-APR-2018", ""); - - lh.addStaticHoliday ("01-MAY-2018", ""); - - lh.addStaticHoliday ("31-MAY-2018", ""); - - lh.addStaticHoliday ("07-SEP-2018", ""); - - lh.addStaticHoliday ("12-OCT-2018", ""); - - lh.addStaticHoliday ("02-NOV-2018", ""); - - lh.addStaticHoliday ("15-NOV-2018", ""); - - lh.addStaticHoliday ("25-DEC-2018", ""); - - lh.addStaticHoliday ("01-JAN-2019", ""); - - lh.addStaticHoliday ("04-MAR-2019", ""); - - lh.addStaticHoliday ("05-MAR-2019", ""); - - lh.addStaticHoliday ("19-APR-2019", ""); - - lh.addStaticHoliday ("21-APR-2019", ""); - - lh.addStaticHoliday ("01-MAY-2019", ""); - - lh.addStaticHoliday ("20-JUN-2019", ""); - - lh.addStaticHoliday ("07-SEP-2019", ""); - - lh.addStaticHoliday ("12-OCT-2019", ""); - - lh.addStaticHoliday ("02-NOV-2019", ""); - - lh.addStaticHoliday ("15-NOV-2019", ""); - - lh.addStaticHoliday ("25-DEC-2019", ""); - - lh.addStaticHoliday ("01-JAN-2020", ""); - - lh.addStaticHoliday ("24-FEB-2020", ""); - - lh.addStaticHoliday ("25-FEB-2020", ""); - - lh.addStaticHoliday ("10-APR-2020", ""); - - lh.addStaticHoliday ("21-APR-2020", ""); - - lh.addStaticHoliday ("01-MAY-2020", ""); - - lh.addStaticHoliday ("11-JUN-2020", ""); - - lh.addStaticHoliday ("07-SEP-2020", ""); - - lh.addStaticHoliday ("12-OCT-2020", ""); - - lh.addStaticHoliday ("02-NOV-2020", ""); - - lh.addStaticHoliday ("15-NOV-2020", ""); - - lh.addStaticHoliday ("25-DEC-2020", ""); - - lh.addStaticHoliday ("01-JAN-2021", ""); - - lh.addStaticHoliday ("15-FEB-2021", ""); - - lh.addStaticHoliday ("16-FEB-2021", ""); - - lh.addStaticHoliday ("02-APR-2021", ""); - - lh.addStaticHoliday ("21-APR-2021", ""); - - lh.addStaticHoliday ("01-MAY-2021", ""); - - lh.addStaticHoliday ("03-JUN-2021", ""); - - lh.addStaticHoliday ("07-SEP-2021", ""); - - lh.addStaticHoliday ("12-OCT-2021", ""); - - lh.addStaticHoliday ("02-NOV-2021", ""); - - lh.addStaticHoliday ("15-NOV-2021", ""); - - lh.addStaticHoliday ("25-DEC-2021", ""); - - lh.addStaticHoliday ("01-JAN-2022", ""); - - lh.addStaticHoliday ("28-FEB-2022", ""); - - lh.addStaticHoliday ("01-MAR-2022", ""); - - lh.addStaticHoliday ("15-APR-2022", ""); - - lh.addStaticHoliday ("21-APR-2022", ""); - - lh.addStaticHoliday ("01-MAY-2022", ""); - - lh.addStaticHoliday ("16-JUN-2022", ""); - - lh.addStaticHoliday ("07-SEP-2022", ""); - - lh.addStaticHoliday ("12-OCT-2022", ""); - - lh.addStaticHoliday ("02-NOV-2022", ""); - - lh.addStaticHoliday ("15-NOV-2022", ""); - - lh.addStaticHoliday ("25-DEC-2022", ""); - - lh.addStaticHoliday ("01-JAN-2023", ""); - - lh.addStaticHoliday ("20-FEB-2023", ""); - - lh.addStaticHoliday ("21-FEB-2023", ""); - - lh.addStaticHoliday ("07-APR-2023", ""); - - lh.addStaticHoliday ("21-APR-2023", ""); - - lh.addStaticHoliday ("01-MAY-2023", ""); - - lh.addStaticHoliday ("08-JUN-2023", ""); - - lh.addStaticHoliday ("07-SEP-2023", ""); - - lh.addStaticHoliday ("12-OCT-2023", ""); - - lh.addStaticHoliday ("02-NOV-2023", ""); - - lh.addStaticHoliday ("15-NOV-2023", ""); - - lh.addStaticHoliday ("25-DEC-2023", ""); - - lh.addStaticHoliday ("01-JAN-2024", ""); - - lh.addStaticHoliday ("12-FEB-2024", ""); - - lh.addStaticHoliday ("13-FEB-2024", ""); - - lh.addStaticHoliday ("29-MAR-2024", ""); - - lh.addStaticHoliday ("21-APR-2024", ""); - - lh.addStaticHoliday ("01-MAY-2024", ""); - - lh.addStaticHoliday ("30-MAY-2024", ""); - - lh.addStaticHoliday ("07-SEP-2024", ""); - - lh.addStaticHoliday ("12-OCT-2024", ""); - - lh.addStaticHoliday ("02-NOV-2024", ""); - - lh.addStaticHoliday ("15-NOV-2024", ""); - - lh.addStaticHoliday ("25-DEC-2024", ""); - - lh.addStaticHoliday ("01-JAN-2025", ""); - - lh.addStaticHoliday ("03-MAR-2025", ""); - - lh.addStaticHoliday ("04-MAR-2025", ""); - - lh.addStaticHoliday ("18-APR-2025", ""); - - lh.addStaticHoliday ("21-APR-2025", ""); - - lh.addStaticHoliday ("01-MAY-2025", ""); - - lh.addStaticHoliday ("19-JUN-2025", ""); - - lh.addStaticHoliday ("07-SEP-2025", ""); - - lh.addStaticHoliday ("12-OCT-2025", ""); - - lh.addStaticHoliday ("02-NOV-2025", ""); - - lh.addStaticHoliday ("15-NOV-2025", ""); - - lh.addStaticHoliday ("25-DEC-2025", ""); - - lh.addStaticHoliday ("01-JAN-2026", ""); - - lh.addStaticHoliday ("16-FEB-2026", ""); - - lh.addStaticHoliday ("17-FEB-2026", ""); - - lh.addStaticHoliday ("03-APR-2026", ""); - - lh.addStaticHoliday ("21-APR-2026", ""); - - lh.addStaticHoliday ("01-MAY-2026", ""); - - lh.addStaticHoliday ("04-JUN-2026", ""); - - lh.addStaticHoliday ("07-SEP-2026", ""); - - lh.addStaticHoliday ("12-OCT-2026", ""); - - lh.addStaticHoliday ("02-NOV-2026", ""); - - lh.addStaticHoliday ("15-NOV-2026", ""); - - lh.addStaticHoliday ("25-DEC-2026", ""); - - lh.addStaticHoliday ("01-JAN-2027", ""); - - lh.addStaticHoliday ("08-FEB-2027", ""); - - lh.addStaticHoliday ("09-FEB-2027", ""); - - lh.addStaticHoliday ("26-MAR-2027", ""); - - lh.addStaticHoliday ("21-APR-2027", ""); - - lh.addStaticHoliday ("01-MAY-2027", ""); - - lh.addStaticHoliday ("27-MAY-2027", ""); - - lh.addStaticHoliday ("07-SEP-2027", ""); - - lh.addStaticHoliday ("12-OCT-2027", ""); - - lh.addStaticHoliday ("02-NOV-2027", ""); - - lh.addStaticHoliday ("15-NOV-2027", ""); - - lh.addStaticHoliday ("25-DEC-2027", ""); - - lh.addStaticHoliday ("01-JAN-2028", ""); - - lh.addStaticHoliday ("28-FEB-2028", ""); - - lh.addStaticHoliday ("29-FEB-2028", ""); - - lh.addStaticHoliday ("14-APR-2028", ""); - - lh.addStaticHoliday ("21-APR-2028", ""); - - lh.addStaticHoliday ("01-MAY-2028", ""); - - lh.addStaticHoliday ("15-JUN-2028", ""); - - lh.addStaticHoliday ("07-SEP-2028", ""); - - lh.addStaticHoliday ("12-OCT-2028", ""); - - lh.addStaticHoliday ("02-NOV-2028", ""); - - lh.addStaticHoliday ("15-NOV-2028", ""); - - lh.addStaticHoliday ("25-DEC-2028", ""); - - lh.addStaticHoliday ("01-JAN-2029", ""); - - lh.addStaticHoliday ("12-FEB-2029", ""); - - lh.addStaticHoliday ("13-FEB-2029", ""); - - lh.addStaticHoliday ("30-MAR-2029", ""); - - lh.addStaticHoliday ("21-APR-2029", ""); - - lh.addStaticHoliday ("01-MAY-2029", ""); - - lh.addStaticHoliday ("31-MAY-2029", ""); - - lh.addStaticHoliday ("07-SEP-2029", ""); - - lh.addStaticHoliday ("12-OCT-2029", ""); - - lh.addStaticHoliday ("02-NOV-2029", ""); - - lh.addStaticHoliday ("15-NOV-2029", ""); - - lh.addStaticHoliday ("25-DEC-2029", ""); - - lh.addStaticHoliday ("01-JAN-2030", ""); - - lh.addStaticHoliday ("04-MAR-2030", ""); - - lh.addStaticHoliday ("05-MAR-2030", ""); - - lh.addStaticHoliday ("19-APR-2030", ""); - - lh.addStaticHoliday ("21-APR-2030", ""); - - lh.addStaticHoliday ("01-MAY-2030", ""); - - lh.addStaticHoliday ("20-JUN-2030", ""); - - lh.addStaticHoliday ("07-SEP-2030", ""); - - lh.addStaticHoliday ("12-OCT-2030", ""); - - lh.addStaticHoliday ("02-NOV-2030", ""); - - lh.addStaticHoliday ("15-NOV-2030", ""); - - lh.addStaticHoliday ("25-DEC-2030", ""); - - lh.addStaticHoliday ("01-JAN-2031", ""); - - lh.addStaticHoliday ("24-FEB-2031", ""); - - lh.addStaticHoliday ("25-FEB-2031", ""); - - lh.addStaticHoliday ("11-APR-2031", ""); - - lh.addStaticHoliday ("21-APR-2031", ""); - - lh.addStaticHoliday ("01-MAY-2031", ""); - - lh.addStaticHoliday ("12-JUN-2031", ""); - - lh.addStaticHoliday ("07-SEP-2031", ""); - - lh.addStaticHoliday ("12-OCT-2031", ""); - - lh.addStaticHoliday ("02-NOV-2031", ""); - - lh.addStaticHoliday ("15-NOV-2031", ""); - - lh.addStaticHoliday ("25-DEC-2031", ""); - - lh.addStaticHoliday ("01-JAN-2032", ""); - - lh.addStaticHoliday ("09-FEB-2032", ""); - - lh.addStaticHoliday ("10-FEB-2032", ""); - - lh.addStaticHoliday ("26-MAR-2032", ""); - - lh.addStaticHoliday ("21-APR-2032", ""); - - lh.addStaticHoliday ("01-MAY-2032", ""); - - lh.addStaticHoliday ("27-MAY-2032", ""); - - lh.addStaticHoliday ("07-SEP-2032", ""); - - lh.addStaticHoliday ("12-OCT-2032", ""); - - lh.addStaticHoliday ("02-NOV-2032", ""); - - lh.addStaticHoliday ("15-NOV-2032", ""); - - lh.addStaticHoliday ("25-DEC-2032", ""); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/ILSHoliday.java b/org/drip/analytics/holset/ILSHoliday.java deleted file mode 100644 index 5ba9179..0000000 --- a/org/drip/analytics/holset/ILSHoliday.java +++ /dev/null @@ -1,595 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class ILSHoliday implements org.drip.analytics.holset.LocationHoliday { - public ILSHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "ILS"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("12-MAR-1998", "Feast of Purim"); - - lh.addStaticHoliday ("17-APR-1998", "Last Day of Passover"); - - lh.addStaticHoliday ("30-APR-1998", "Independence Day"); - - lh.addStaticHoliday ("21-SEP-1998", "Jewish New Year"); - - lh.addStaticHoliday ("22-SEP-1998", "Second Day of the Jewish New Year"); - - lh.addStaticHoliday ("29-SEP-1998", "Day of Atonement Eve"); - - lh.addStaticHoliday ("30-SEP-1998", "Day of Atonement"); - - lh.addStaticHoliday ("05-OCT-1998", "First Day of Tabernacles"); - - lh.addStaticHoliday ("12-OCT-1998", "Last Day of Tabernacles"); - - lh.addStaticHoliday ("02-MAR-1999", "Feast of Purim"); - - lh.addStaticHoliday ("01-APR-1999", "First Day of Passover"); - - lh.addStaticHoliday ("07-APR-1999", "Last Day of Passover"); - - lh.addStaticHoliday ("21-APR-1999", "Independence Day"); - - lh.addStaticHoliday ("21-MAY-1999", "Feast of Pentecost"); - - lh.addStaticHoliday ("22-JUL-1999", "Fast of Ninth of Ab"); - - lh.addStaticHoliday ("20-SEP-1999", "Day of Atonement"); - - lh.addStaticHoliday ("21-MAR-2000", "Feast of Purim"); - - lh.addStaticHoliday ("20-APR-2000", "First Day of Passover"); - - lh.addStaticHoliday ("26-APR-2000", "Last Day of Passover"); - - lh.addStaticHoliday ("10-MAY-2000", "Independence Day"); - - lh.addStaticHoliday ("09-JUN-2000", "Feast of Pentecost"); - - lh.addStaticHoliday ("10-AUG-2000", "Fast of Ninth of Ab"); - - lh.addStaticHoliday ("09-OCT-2000", "Day of Atonement"); - - lh.addStaticHoliday ("09-MAR-2001", "Feast of Purim"); - - lh.addStaticHoliday ("26-APR-2001", "Independence Day"); - - lh.addStaticHoliday ("28-MAY-2001", "Feast of Pentecost"); - - lh.addStaticHoliday ("18-SEP-2001", "Jewish New Year"); - - lh.addStaticHoliday ("19-SEP-2001", "Second Day of the Jewish New Year"); - - lh.addStaticHoliday ("26-SEP-2001", "Day of Atonement Eve"); - - lh.addStaticHoliday ("27-SEP-2001", "Day of Atonement"); - - lh.addStaticHoliday ("02-OCT-2001", "First Day of Tabernacles"); - - lh.addStaticHoliday ("09-OCT-2001", "Last Day of Tabernacles"); - - lh.addStaticHoliday ("26-FEB-2002", "Feast of Purim"); - - lh.addStaticHoliday ("28-MAR-2002", "First Day of Passover"); - - lh.addStaticHoliday ("03-APR-2002", "Last Day of Passover"); - - lh.addStaticHoliday ("17-APR-2002", "Independence Day"); - - lh.addStaticHoliday ("17-MAY-2002", "Feast of Pentecost"); - - lh.addStaticHoliday ("18-JUL-2002", "Fast of Ninth of Ab"); - - lh.addStaticHoliday ("16-SEP-2002", "Day of Atonement"); - - lh.addStaticHoliday ("18-MAR-2003", "Feast of Purim"); - - lh.addStaticHoliday ("17-APR-2003", "First Day of Passover"); - - lh.addStaticHoliday ("23-APR-2003", "Last Day of Passover"); - - lh.addStaticHoliday ("07-MAY-2003", "Independence Day"); - - lh.addStaticHoliday ("06-JUN-2003", "Feast of Pentecost"); - - lh.addStaticHoliday ("07-AUG-2003", "Fast of Ninth of Ab"); - - lh.addStaticHoliday ("06-OCT-2003", "Day of Atonement"); - - lh.addStaticHoliday ("06-APR-2004", "First Day of Passover"); - - lh.addStaticHoliday ("12-APR-2004", "Last Day of Passover"); - - lh.addStaticHoliday ("26-APR-2004", "Independence Day"); - - lh.addStaticHoliday ("26-MAY-2004", "Feast of Pentecost"); - - lh.addStaticHoliday ("27-JUL-2004", "Fast of Ninth of Ab"); - - lh.addStaticHoliday ("16-SEP-2004", "Jewish New Year"); - - lh.addStaticHoliday ("17-SEP-2004", "Second Day of the Jewish New Year"); - - lh.addStaticHoliday ("24-SEP-2004", "Day of Atonement Eve"); - - lh.addStaticHoliday ("30-SEP-2004", "First Day of Tabernacles"); - - lh.addStaticHoliday ("07-OCT-2004", "Last Day of Tabernacles"); - - lh.addStaticHoliday ("25-MAR-2005", "Feast of Purim"); - - lh.addStaticHoliday ("12-MAY-2005", "Independence Day"); - - lh.addStaticHoliday ("13-JUN-2005", "Feast of Pentecost"); - - lh.addStaticHoliday ("04-OCT-2005", "Jewish New Year"); - - lh.addStaticHoliday ("05-OCT-2005", "Second Day of the Jewish New Year"); - - lh.addStaticHoliday ("12-OCT-2005", "Day of Atonement Eve"); - - lh.addStaticHoliday ("13-OCT-2005", "Day of Atonement"); - - lh.addStaticHoliday ("18-OCT-2005", "First Day of Tabernacles"); - - lh.addStaticHoliday ("25-OCT-2005", "Last Day of Tabernacles"); - - lh.addStaticHoliday ("14-MAR-2006", "Feast of Purim"); - - lh.addStaticHoliday ("13-APR-2006", "First Day of Passover"); - - lh.addStaticHoliday ("19-APR-2006", "Last Day of Passover"); - - lh.addStaticHoliday ("03-MAY-2006", "Independence Day"); - - lh.addStaticHoliday ("02-JUN-2006", "Feast of Pentecost"); - - lh.addStaticHoliday ("03-AUG-2006", "Fast of Ninth of Ab"); - - lh.addStaticHoliday ("02-OCT-2006", "Day of Atonement"); - - lh.addStaticHoliday ("03-APR-2007", "First Day of Passover"); - - lh.addStaticHoliday ("09-APR-2007", "Last Day of Passover"); - - lh.addStaticHoliday ("23-APR-2007", "Independence Day"); - - lh.addStaticHoliday ("23-MAY-2007", "Feast of Pentecost"); - - lh.addStaticHoliday ("24-JUL-2007", "Fast of Ninth of Ab"); - - lh.addStaticHoliday ("13-SEP-2007", "Jewish New Year"); - - lh.addStaticHoliday ("14-SEP-2007", "Second Day of the Jewish New Year"); - - lh.addStaticHoliday ("21-SEP-2007", "Day of Atonement Eve"); - - lh.addStaticHoliday ("27-SEP-2007", "First Day of Tabernacles"); - - lh.addStaticHoliday ("04-OCT-2007", "Last Day of Tabernacles"); - - lh.addStaticHoliday ("21-MAR-2008", "Feast of Purim"); - - lh.addStaticHoliday ("08-MAY-2008", "Independence Day"); - - lh.addStaticHoliday ("09-JUN-2008", "Feast of Pentecost"); - - lh.addStaticHoliday ("30-SEP-2008", "Jewish New Year"); - - lh.addStaticHoliday ("01-OCT-2008", "Second Day of the Jewish New Year"); - - lh.addStaticHoliday ("08-OCT-2008", "Day of Atonement Eve"); - - lh.addStaticHoliday ("09-OCT-2008", "Day of Atonement"); - - lh.addStaticHoliday ("14-OCT-2008", "First Day of Tabernacles"); - - lh.addStaticHoliday ("21-OCT-2008", "Last Day of Tabernacles"); - - lh.addStaticHoliday ("10-MAR-2009", "Feast of Purim"); - - lh.addStaticHoliday ("09-APR-2009", "First Day of Passover"); - - lh.addStaticHoliday ("15-APR-2009", "Last Day of Passover"); - - lh.addStaticHoliday ("29-APR-2009", "Independence Day"); - - lh.addStaticHoliday ("29-MAY-2009", "Feast of Pentecost"); - - lh.addStaticHoliday ("30-JUL-2009", "Fast of Ninth of Ab"); - - lh.addStaticHoliday ("28-SEP-2009", "Day of Atonement"); - - lh.addStaticHoliday ("30-MAR-2010", "First Day of Passover"); - - lh.addStaticHoliday ("05-APR-2010", "Last Day of Passover"); - - lh.addStaticHoliday ("19-APR-2010", "Independence Day"); - - lh.addStaticHoliday ("19-MAY-2010", "Feast of Pentecost"); - - lh.addStaticHoliday ("20-JUL-2010", "Fast of Ninth of Ab"); - - lh.addStaticHoliday ("09-SEP-2010", "Jewish New Year"); - - lh.addStaticHoliday ("10-SEP-2010", "Second Day of the Jewish New Year"); - - lh.addStaticHoliday ("17-SEP-2010", "Day of Atonement Eve"); - - lh.addStaticHoliday ("23-SEP-2010", "First Day of Tabernacles"); - - lh.addStaticHoliday ("30-SEP-2010", "Last Day of Tabernacles"); - - lh.addStaticHoliday ("19-APR-2011", "First Day of Passover"); - - lh.addStaticHoliday ("25-APR-2011", "Last Day of Passover"); - - lh.addStaticHoliday ("09-MAY-2011", "Independence Day"); - - lh.addStaticHoliday ("08-JUN-2011", "Feast of Pentecost"); - - lh.addStaticHoliday ("09-AUG-2011", "Fast of Ninth of Ab"); - - lh.addStaticHoliday ("29-SEP-2011", "Jewish New Year"); - - lh.addStaticHoliday ("30-SEP-2011", "Second Day of the Jewish New Year"); - - lh.addStaticHoliday ("07-OCT-2011", "Day of Atonement Eve"); - - lh.addStaticHoliday ("13-OCT-2011", "First Day of Tabernacles"); - - lh.addStaticHoliday ("20-OCT-2011", "Last Day of Tabernacles"); - - lh.addStaticHoliday ("08-MAR-2012", "Feast of Purim"); - - lh.addStaticHoliday ("13-APR-2012", "Last Day of Passover"); - - lh.addStaticHoliday ("26-APR-2012", "Independence Day"); - - lh.addStaticHoliday ("17-SEP-2012", "Jewish New Year"); - - lh.addStaticHoliday ("18-SEP-2012", "Second Day of the Jewish New Year"); - - lh.addStaticHoliday ("25-SEP-2012", "Day of Atonement Eve"); - - lh.addStaticHoliday ("26-SEP-2012", "Day of Atonement"); - - lh.addStaticHoliday ("01-OCT-2012", "First Day of Tabernacles"); - - lh.addStaticHoliday ("08-OCT-2012", "Last Day of Tabernacles"); - - lh.addStaticHoliday ("26-MAR-2013", "First Day of Passover"); - - lh.addStaticHoliday ("01-APR-2013", "Last Day of Passover"); - - lh.addStaticHoliday ("15-APR-2013", "Independence Day"); - - lh.addStaticHoliday ("15-MAY-2013", "Feast of Pentecost"); - - lh.addStaticHoliday ("16-JUL-2013", "Fast of Ninth of Ab"); - - lh.addStaticHoliday ("05-SEP-2013", "Jewish New Year"); - - lh.addStaticHoliday ("06-SEP-2013", "Second Day of the Jewish New Year"); - - lh.addStaticHoliday ("13-SEP-2013", "Day of Atonement Eve"); - - lh.addStaticHoliday ("19-SEP-2013", "First Day of Tabernacles"); - - lh.addStaticHoliday ("26-SEP-2013", "Last Day of Tabernacles"); - - lh.addStaticHoliday ("15-APR-2014", "First Day of Passover"); - - lh.addStaticHoliday ("21-APR-2014", "Last Day of Passover"); - - lh.addStaticHoliday ("05-MAY-2014", "Independence Day"); - - lh.addStaticHoliday ("04-JUN-2014", "Feast of Pentecost"); - - lh.addStaticHoliday ("05-AUG-2014", "Fast of Ninth of Ab"); - - lh.addStaticHoliday ("25-SEP-2014", "Jewish New Year"); - - lh.addStaticHoliday ("26-SEP-2014", "Second Day of the Jewish New Year"); - - lh.addStaticHoliday ("03-OCT-2014", "Day of Atonement Eve"); - - lh.addStaticHoliday ("09-OCT-2014", "First Day of Tabernacles"); - - lh.addStaticHoliday ("16-OCT-2014", "Last Day of Tabernacles"); - - lh.addStaticHoliday ("05-MAR-2015", "Feast of Purim"); - - lh.addStaticHoliday ("10-APR-2015", "Last Day of Passover"); - - lh.addStaticHoliday ("23-APR-2015", "Independence Day"); - - lh.addStaticHoliday ("14-SEP-2015", "Jewish New Year"); - - lh.addStaticHoliday ("15-SEP-2015", "Second Day of the Jewish New Year"); - - lh.addStaticHoliday ("22-SEP-2015", "Day of Atonement Eve"); - - lh.addStaticHoliday ("23-SEP-2015", "Day of Atonement"); - - lh.addStaticHoliday ("28-SEP-2015", "First Day of Tabernacles"); - - lh.addStaticHoliday ("05-OCT-2015", "Last Day of Tabernacles"); - - lh.addStaticHoliday ("24-MAR-2016", "Feast of Purim"); - - lh.addStaticHoliday ("29-APR-2016", "Last Day of Passover"); - - lh.addStaticHoliday ("12-MAY-2016", "Independence Day"); - - lh.addStaticHoliday ("03-OCT-2016", "Jewish New Year"); - - lh.addStaticHoliday ("04-OCT-2016", "Second Day of the Jewish New Year"); - - lh.addStaticHoliday ("11-OCT-2016", "Day of Atonement Eve"); - - lh.addStaticHoliday ("12-OCT-2016", "Day of Atonement"); - - lh.addStaticHoliday ("17-OCT-2016", "First Day of Tabernacles"); - - lh.addStaticHoliday ("24-OCT-2016", "Last Day of Tabernacles"); - - lh.addStaticHoliday ("11-APR-2017", "First Day of Passover"); - - lh.addStaticHoliday ("17-APR-2017", "Last Day of Passover"); - - lh.addStaticHoliday ("01-MAY-2017", "Independence Day"); - - lh.addStaticHoliday ("31-MAY-2017", "Feast of Pentecost"); - - lh.addStaticHoliday ("01-AUG-2017", "Fast of Ninth of Ab"); - - lh.addStaticHoliday ("21-SEP-2017", "Jewish New Year"); - - lh.addStaticHoliday ("22-SEP-2017", "Second Day of the Jewish New Year"); - - lh.addStaticHoliday ("29-SEP-2017", "Day of Atonement Eve"); - - lh.addStaticHoliday ("05-OCT-2017", "First Day of Tabernacles"); - - lh.addStaticHoliday ("12-OCT-2017", "Last Day of Tabernacles"); - - lh.addStaticHoliday ("01-MAR-2018", "Feast of Purim"); - - lh.addStaticHoliday ("06-APR-2018", "Last Day of Passover"); - - lh.addStaticHoliday ("19-APR-2018", "Independence Day"); - - lh.addStaticHoliday ("10-SEP-2018", "Jewish New Year"); - - lh.addStaticHoliday ("11-SEP-2018", "Second Day of the Jewish New Year"); - - lh.addStaticHoliday ("18-SEP-2018", "Day of Atonement Eve"); - - lh.addStaticHoliday ("19-SEP-2018", "Day of Atonement"); - - lh.addStaticHoliday ("24-SEP-2018", "First Day of Tabernacles"); - - lh.addStaticHoliday ("01-OCT-2018", "Last Day of Tabernacles"); - - lh.addStaticHoliday ("21-MAR-2019", "Feast of Purim"); - - lh.addStaticHoliday ("26-APR-2019", "Last Day of Passover"); - - lh.addStaticHoliday ("09-MAY-2019", "Independence Day"); - - lh.addStaticHoliday ("30-SEP-2019", "Jewish New Year"); - - lh.addStaticHoliday ("01-OCT-2019", "Second Day of the Jewish New Year"); - - lh.addStaticHoliday ("08-OCT-2019", "Day of Atonement Eve"); - - lh.addStaticHoliday ("09-OCT-2019", "Day of Atonement"); - - lh.addStaticHoliday ("14-OCT-2019", "First Day of Tabernacles"); - - lh.addStaticHoliday ("21-OCT-2019", "Last Day of Tabernacles"); - - lh.addStaticHoliday ("10-MAR-2020", "Feast of Purim"); - - lh.addStaticHoliday ("09-APR-2020", "First Day of Passover"); - - lh.addStaticHoliday ("15-APR-2020", "Last Day of Passover"); - - lh.addStaticHoliday ("29-APR-2020", "Independence Day"); - - lh.addStaticHoliday ("29-MAY-2020", "Feast of Pentecost"); - - lh.addStaticHoliday ("30-JUL-2020", "Fast of Ninth of Ab"); - - lh.addStaticHoliday ("28-SEP-2020", "Day of Atonement"); - - lh.addStaticHoliday ("26-FEB-2021", "Feast of Purim"); - - lh.addStaticHoliday ("15-APR-2021", "Independence Day"); - - lh.addStaticHoliday ("17-MAY-2021", "Feast of Pentecost"); - - lh.addStaticHoliday ("07-SEP-2021", "Jewish New Year"); - - lh.addStaticHoliday ("08-SEP-2021", "Second Day of the Jewish New Year"); - - lh.addStaticHoliday ("15-SEP-2021", "Day of Atonement Eve"); - - lh.addStaticHoliday ("16-SEP-2021", "Day of Atonement"); - - lh.addStaticHoliday ("21-SEP-2021", "First Day of Tabernacles"); - - lh.addStaticHoliday ("28-SEP-2021", "Last Day of Tabernacles"); - - lh.addStaticHoliday ("17-MAR-2022", "Feast of Purim"); - - lh.addStaticHoliday ("22-APR-2022", "Last Day of Passover"); - - lh.addStaticHoliday ("05-MAY-2022", "Independence Day"); - - lh.addStaticHoliday ("26-SEP-2022", "Jewish New Year"); - - lh.addStaticHoliday ("27-SEP-2022", "Second Day of the Jewish New Year"); - - lh.addStaticHoliday ("04-OCT-2022", "Day of Atonement Eve"); - - lh.addStaticHoliday ("05-OCT-2022", "Day of Atonement"); - - lh.addStaticHoliday ("10-OCT-2022", "First Day of Tabernacles"); - - lh.addStaticHoliday ("17-OCT-2022", "Last Day of Tabernacles"); - - lh.addStaticHoliday ("07-MAR-2023", "Feast of Purim"); - - lh.addStaticHoliday ("06-APR-2023", "First Day of Passover"); - - lh.addStaticHoliday ("12-APR-2023", "Last Day of Passover"); - - lh.addStaticHoliday ("26-APR-2023", "Independence Day"); - - lh.addStaticHoliday ("26-MAY-2023", "Feast of Pentecost"); - - lh.addStaticHoliday ("27-JUL-2023", "Fast of Ninth of Ab"); - - lh.addStaticHoliday ("25-SEP-2023", "Day of Atonement"); - - lh.addStaticHoliday ("23-APR-2024", "First Day of Passover"); - - lh.addStaticHoliday ("29-APR-2024", "Last Day of Passover"); - - lh.addStaticHoliday ("13-MAY-2024", "Independence Day"); - - lh.addStaticHoliday ("12-JUN-2024", "Feast of Pentecost"); - - lh.addStaticHoliday ("13-AUG-2024", "Fast of Ninth of Ab"); - - lh.addStaticHoliday ("03-OCT-2024", "Jewish New Year"); - - lh.addStaticHoliday ("04-OCT-2024", "Second Day of the Jewish New Year"); - - lh.addStaticHoliday ("11-OCT-2024", "Day of Atonement Eve"); - - lh.addStaticHoliday ("17-OCT-2024", "First Day of Tabernacles"); - - lh.addStaticHoliday ("24-OCT-2024", "Last Day of Tabernacles"); - - lh.addStaticHoliday ("14-MAR-2025", "Feast of Purim"); - - lh.addStaticHoliday ("01-MAY-2025", "Independence Day"); - - lh.addStaticHoliday ("02-JUN-2025", "Feast of Pentecost"); - - lh.addStaticHoliday ("23-SEP-2025", "Jewish New Year"); - - lh.addStaticHoliday ("24-SEP-2025", "Second Day of the Jewish New Year"); - - lh.addStaticHoliday ("01-OCT-2025", "Day of Atonement Eve"); - - lh.addStaticHoliday ("02-OCT-2025", "Day of Atonement"); - - lh.addStaticHoliday ("07-OCT-2025", "First Day of Tabernacles"); - - lh.addStaticHoliday ("14-OCT-2025", "Last Day of Tabernacles"); - - lh.addStaticHoliday ("03-MAR-2026", "Feast of Purim"); - - lh.addStaticHoliday ("02-APR-2026", "First Day of Passover"); - - lh.addStaticHoliday ("08-APR-2026", "Last Day of Passover"); - - lh.addStaticHoliday ("22-APR-2026", "Independence Day"); - - lh.addStaticHoliday ("22-MAY-2026", "Feast of Pentecost"); - - lh.addStaticHoliday ("23-JUL-2026", "Fast of Ninth of Ab"); - - lh.addStaticHoliday ("21-SEP-2026", "Day of Atonement"); - - lh.addStaticHoliday ("23-MAR-2027", "Feast of Purim"); - - lh.addStaticHoliday ("22-APR-2027", "First Day of Passover"); - - lh.addStaticHoliday ("28-APR-2027", "Last Day of Passover"); - - lh.addStaticHoliday ("12-MAY-2027", "Independence Day"); - - lh.addStaticHoliday ("11-JUN-2027", "Feast of Pentecost"); - - lh.addStaticHoliday ("12-AUG-2027", "Fast of Ninth of Ab"); - - lh.addStaticHoliday ("11-OCT-2027", "Day of Atonement"); - - lh.addStaticHoliday ("11-APR-2028", "First Day of Passover"); - - lh.addStaticHoliday ("17-APR-2028", "Last Day of Passover"); - - lh.addStaticHoliday ("01-MAY-2028", "Independence Day"); - - lh.addStaticHoliday ("31-MAY-2028", "Feast of Pentecost"); - - lh.addStaticHoliday ("01-AUG-2028", "Fast of Ninth of Ab"); - - lh.addStaticHoliday ("21-SEP-2028", "Jewish New Year"); - - lh.addStaticHoliday ("22-SEP-2028", "Second Day of the Jewish New Year"); - - lh.addStaticHoliday ("29-SEP-2028", "Day of Atonement Eve"); - - lh.addStaticHoliday ("05-OCT-2028", "First Day of Tabernacles"); - - lh.addStaticHoliday ("12-OCT-2028", "Last Day of Tabernacles"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/INRHoliday.java b/org/drip/analytics/holset/INRHoliday.java deleted file mode 100644 index c8b9284..0000000 --- a/org/drip/analytics/holset/INRHoliday.java +++ /dev/null @@ -1,2323 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class INRHoliday implements org.drip.analytics.holset.LocationHoliday { - public INRHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "INR"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1997", "INR"); - - lh.addStaticHoliday ("30-SEP-1997", "INR"); - - lh.addStaticHoliday ("02-OCT-1997", "INR"); - - lh.addStaticHoliday ("14-NOV-1997", "INR"); - - lh.addStaticHoliday ("25-DEC-1997", "INR"); - - lh.addStaticHoliday ("01-JAN-1998", "INR"); - - lh.addStaticHoliday ("30-JAN-1998", "INR"); - - lh.addStaticHoliday ("25-FEB-1998", "INR"); - - lh.addStaticHoliday ("13-MAR-1998", "INR"); - - lh.addStaticHoliday ("08-APR-1998", "INR"); - - lh.addStaticHoliday ("09-APR-1998", "INR"); - - lh.addStaticHoliday ("10-APR-1998", "INR"); - - lh.addStaticHoliday ("14-APR-1998", "INR"); - - lh.addStaticHoliday ("28-APR-1998", "INR"); - - lh.addStaticHoliday ("01-MAY-1998", "INR"); - - lh.addStaticHoliday ("07-MAY-1998", "INR"); - - lh.addStaticHoliday ("11-MAY-1998", "INR"); - - lh.addStaticHoliday ("15-JUN-1998", "INR"); - - lh.addStaticHoliday ("07-JUL-1998", "INR"); - - lh.addStaticHoliday ("26-AUG-1998", "INR"); - - lh.addStaticHoliday ("30-SEP-1998", "INR"); - - lh.addStaticHoliday ("01-OCT-1998", "INR"); - - lh.addStaticHoliday ("02-OCT-1998", "INR"); - - lh.addStaticHoliday ("19-OCT-1998", "INR"); - - lh.addStaticHoliday ("21-OCT-1998", "INR"); - - lh.addStaticHoliday ("22-OCT-1998", "INR"); - - lh.addStaticHoliday ("04-NOV-1998", "INR"); - - lh.addStaticHoliday ("25-DEC-1998", "INR"); - - lh.addStaticHoliday ("01-JAN-1999", "INR"); - - lh.addStaticHoliday ("20-JAN-1999", "INR"); - - lh.addStaticHoliday ("26-JAN-1999", "INR"); - - lh.addStaticHoliday ("02-MAR-1999", "INR"); - - lh.addStaticHoliday ("18-MAR-1999", "INR"); - - lh.addStaticHoliday ("25-MAR-1999", "INR"); - - lh.addStaticHoliday ("01-APR-1999", "INR"); - - lh.addStaticHoliday ("14-APR-1999", "INR"); - - lh.addStaticHoliday ("27-APR-1999", "INR"); - - lh.addStaticHoliday ("30-APR-1999", "INR"); - - lh.addStaticHoliday ("30-JUN-1999", "INR"); - - lh.addStaticHoliday ("13-SEP-1999", "INR"); - - lh.addStaticHoliday ("30-SEP-1999", "INR"); - - lh.addStaticHoliday ("19-OCT-1999", "INR"); - - lh.addStaticHoliday ("09-NOV-1999", "INR"); - - lh.addStaticHoliday ("10-NOV-1999", "INR"); - - lh.addStaticHoliday ("23-NOV-1999", "INR"); - - lh.addStaticHoliday ("26-JAN-2000", "INR"); - - lh.addStaticHoliday ("17-MAR-2000", "INR"); - - lh.addStaticHoliday ("20-MAR-2000", "INR"); - - lh.addStaticHoliday ("05-APR-2000", "INR"); - - lh.addStaticHoliday ("12-APR-2000", "INR"); - - lh.addStaticHoliday ("14-APR-2000", "INR"); - - lh.addStaticHoliday ("21-APR-2000", "INR"); - - lh.addStaticHoliday ("01-MAY-2000", "INR"); - - lh.addStaticHoliday ("18-MAY-2000", "INR"); - - lh.addStaticHoliday ("15-JUN-2000", "INR"); - - lh.addStaticHoliday ("15-AUG-2000", "INR"); - - lh.addStaticHoliday ("21-AUG-2000", "INR"); - - lh.addStaticHoliday ("01-SEP-2000", "INR"); - - lh.addStaticHoliday ("02-OCT-2000", "INR"); - - lh.addStaticHoliday ("26-OCT-2000", "INR"); - - lh.addStaticHoliday ("25-DEC-2000", "INR"); - - lh.addStaticHoliday ("28-DEC-2000", "INR"); - - lh.addStaticHoliday ("26-JAN-2001", "INR"); - - lh.addStaticHoliday ("19-FEB-2001", "INR"); - - lh.addStaticHoliday ("21-FEB-2001", "INR"); - - lh.addStaticHoliday ("06-MAR-2001", "INR"); - - lh.addStaticHoliday ("26-MAR-2001", "INR"); - - lh.addStaticHoliday ("02-APR-2001", "INR"); - - lh.addStaticHoliday ("05-APR-2001", "INR"); - - lh.addStaticHoliday ("06-APR-2001", "INR"); - - lh.addStaticHoliday ("13-APR-2001", "INR"); - - lh.addStaticHoliday ("01-MAY-2001", "INR"); - - lh.addStaticHoliday ("07-MAY-2001", "INR"); - - lh.addStaticHoliday ("05-JUN-2001", "INR"); - - lh.addStaticHoliday ("15-AUG-2001", "INR"); - - lh.addStaticHoliday ("21-AUG-2001", "INR"); - - lh.addStaticHoliday ("22-AUG-2001", "INR"); - - lh.addStaticHoliday ("02-OCT-2001", "INR"); - - lh.addStaticHoliday ("26-OCT-2001", "INR"); - - lh.addStaticHoliday ("14-NOV-2001", "INR"); - - lh.addStaticHoliday ("16-NOV-2001", "INR"); - - lh.addStaticHoliday ("30-NOV-2001", "INR"); - - lh.addStaticHoliday ("17-DEC-2001", "INR"); - - lh.addStaticHoliday ("25-DEC-2001", "INR"); - - lh.addStaticHoliday ("12-MAR-2002", "INR"); - - lh.addStaticHoliday ("25-MAR-2002", "INR"); - - lh.addStaticHoliday ("29-MAR-2002", "INR"); - - lh.addStaticHoliday ("25-APR-2002", "INR"); - - lh.addStaticHoliday ("01-MAY-2002", "INR"); - - lh.addStaticHoliday ("15-AUG-2002", "INR"); - - lh.addStaticHoliday ("10-SEP-2002", "INR"); - - lh.addStaticHoliday ("02-OCT-2002", "INR"); - - lh.addStaticHoliday ("15-OCT-2002", "INR"); - - lh.addStaticHoliday ("04-NOV-2002", "INR"); - - lh.addStaticHoliday ("19-NOV-2002", "INR"); - - lh.addStaticHoliday ("25-DEC-2002", "INR"); - - lh.addStaticHoliday ("13-FEB-2003", "INR"); - - lh.addStaticHoliday ("14-MAR-2003", "INR"); - - lh.addStaticHoliday ("18-MAR-2003", "INR"); - - lh.addStaticHoliday ("02-APR-2003", "INR"); - - lh.addStaticHoliday ("11-APR-2003", "INR"); - - lh.addStaticHoliday ("14-APR-2003", "INR"); - - lh.addStaticHoliday ("15-APR-2003", "INR"); - - lh.addStaticHoliday ("18-APR-2003", "INR"); - - lh.addStaticHoliday ("01-MAY-2003", "INR"); - - lh.addStaticHoliday ("15-MAY-2003", "INR"); - - lh.addStaticHoliday ("16-MAY-2003", "INR"); - - lh.addStaticHoliday ("15-AUG-2003", "INR"); - - lh.addStaticHoliday ("02-OCT-2003", "INR"); - - lh.addStaticHoliday ("26-NOV-2003", "INR"); - - lh.addStaticHoliday ("25-DEC-2003", "INR"); - - lh.addStaticHoliday ("26-JAN-2004", "INR"); - - lh.addStaticHoliday ("02-FEB-2004", "INR"); - - lh.addStaticHoliday ("18-FEB-2004", "INR"); - - lh.addStaticHoliday ("02-MAR-2004", "INR"); - - lh.addStaticHoliday ("30-MAR-2004", "INR"); - - lh.addStaticHoliday ("09-APR-2004", "INR"); - - lh.addStaticHoliday ("14-APR-2004", "INR"); - - lh.addStaticHoliday ("26-APR-2004", "INR"); - - lh.addStaticHoliday ("04-MAY-2004", "INR"); - - lh.addStaticHoliday ("20-AUG-2004", "INR"); - - lh.addStaticHoliday ("13-OCT-2004", "INR"); - - lh.addStaticHoliday ("22-OCT-2004", "INR"); - - lh.addStaticHoliday ("12-NOV-2004", "INR"); - - lh.addStaticHoliday ("15-NOV-2004", "INR"); - - lh.addStaticHoliday ("26-NOV-2004", "INR"); - - lh.addStaticHoliday ("21-JAN-2005", "INR"); - - lh.addStaticHoliday ("26-JAN-2005", "INR"); - - lh.addStaticHoliday ("08-MAR-2005", "INR"); - - lh.addStaticHoliday ("25-MAR-2005", "INR"); - - lh.addStaticHoliday ("14-APR-2005", "INR"); - - lh.addStaticHoliday ("18-APR-2005", "INR"); - - lh.addStaticHoliday ("22-APR-2005", "INR"); - - lh.addStaticHoliday ("23-MAY-2005", "INR"); - - lh.addStaticHoliday ("27-JUL-2005", "INR"); - - lh.addStaticHoliday ("28-JUL-2005", "INR"); - - lh.addStaticHoliday ("15-AUG-2005", "INR"); - - lh.addStaticHoliday ("07-SEP-2005", "INR"); - - lh.addStaticHoliday ("12-OCT-2005", "INR"); - - lh.addStaticHoliday ("01-NOV-2005", "INR"); - - lh.addStaticHoliday ("15-NOV-2005", "INR"); - - lh.addStaticHoliday ("11-JAN-2006", "INR"); - - lh.addStaticHoliday ("26-JAN-2006", "INR"); - - lh.addStaticHoliday ("09-FEB-2006", "INR"); - - lh.addStaticHoliday ("15-MAR-2006", "INR"); - - lh.addStaticHoliday ("30-MAR-2006", "INR"); - - lh.addStaticHoliday ("06-APR-2006", "INR"); - - lh.addStaticHoliday ("11-APR-2006", "INR"); - - lh.addStaticHoliday ("14-APR-2006", "INR"); - - lh.addStaticHoliday ("01-MAY-2006", "INR"); - - lh.addStaticHoliday ("15-AUG-2006", "INR"); - - lh.addStaticHoliday ("02-OCT-2006", "INR"); - - lh.addStaticHoliday ("24-OCT-2006", "INR"); - - lh.addStaticHoliday ("25-OCT-2006", "INR"); - - lh.addStaticHoliday ("25-DEC-2006", "INR"); - - lh.addStaticHoliday ("01-JAN-2007", "INR"); - - lh.addStaticHoliday ("26-JAN-2007", "INR"); - - lh.addStaticHoliday ("30-JAN-2007", "INR"); - - lh.addStaticHoliday ("16-FEB-2007", "INR"); - - lh.addStaticHoliday ("19-MAR-2007", "INR"); - - lh.addStaticHoliday ("27-MAR-2007", "INR"); - - lh.addStaticHoliday ("06-APR-2007", "INR"); - - lh.addStaticHoliday ("01-MAY-2007", "INR"); - - lh.addStaticHoliday ("02-MAY-2007", "INR"); - - lh.addStaticHoliday ("15-AUG-2007", "INR"); - - lh.addStaticHoliday ("20-AUG-2007", "INR"); - - lh.addStaticHoliday ("02-OCT-2007", "INR"); - - lh.addStaticHoliday ("09-NOV-2007", "INR"); - - lh.addStaticHoliday ("21-DEC-2007", "INR"); - - lh.addStaticHoliday ("25-DEC-2007", "INR"); - - lh.addStaticHoliday ("06-MAR-2008", "INR"); - - lh.addStaticHoliday ("20-MAR-2008", "INR"); - - lh.addStaticHoliday ("21-MAR-2008", "INR"); - - lh.addStaticHoliday ("14-APR-2008", "INR"); - - lh.addStaticHoliday ("18-APR-2008", "INR"); - - lh.addStaticHoliday ("01-MAY-2008", "INR"); - - lh.addStaticHoliday ("19-MAY-2008", "INR"); - - lh.addStaticHoliday ("15-AUG-2008", "INR"); - - lh.addStaticHoliday ("19-AUG-2008", "INR"); - - lh.addStaticHoliday ("03-SEP-2008", "INR"); - - lh.addStaticHoliday ("02-OCT-2008", "INR"); - - lh.addStaticHoliday ("09-OCT-2008", "INR"); - - lh.addStaticHoliday ("28-OCT-2008", "INR"); - - lh.addStaticHoliday ("30-OCT-2008", "INR"); - - lh.addStaticHoliday ("13-NOV-2008", "INR"); - - lh.addStaticHoliday ("09-DEC-2008", "INR"); - - lh.addStaticHoliday ("25-DEC-2008", "INR"); - - lh.addStaticHoliday ("08-JAN-2009", "INR"); - - lh.addStaticHoliday ("26-JAN-2009", "INR"); - - lh.addStaticHoliday ("23-FEB-2009", "INR"); - - lh.addStaticHoliday ("10-MAR-2009", "INR"); - - lh.addStaticHoliday ("11-MAR-2009", "INR"); - - lh.addStaticHoliday ("27-MAR-2009", "INR"); - - lh.addStaticHoliday ("01-APR-2009", "INR"); - - lh.addStaticHoliday ("03-APR-2009", "INR"); - - lh.addStaticHoliday ("07-APR-2009", "INR"); - - lh.addStaticHoliday ("10-APR-2009", "INR"); - - lh.addStaticHoliday ("14-APR-2009", "INR"); - - lh.addStaticHoliday ("30-APR-2009", "INR"); - - lh.addStaticHoliday ("01-MAY-2009", "INR"); - - lh.addStaticHoliday ("01-JUL-2009", "INR"); - - lh.addStaticHoliday ("19-AUG-2009", "INR"); - - lh.addStaticHoliday ("21-SEP-2009", "INR"); - - lh.addStaticHoliday ("28-SEP-2009", "INR"); - - lh.addStaticHoliday ("30-SEP-2009", "INR"); - - lh.addStaticHoliday ("02-OCT-2009", "INR"); - - lh.addStaticHoliday ("13-OCT-2009", "INR"); - - lh.addStaticHoliday ("19-OCT-2009", "INR"); - - lh.addStaticHoliday ("02-NOV-2009", "INR"); - - lh.addStaticHoliday ("25-DEC-2009", "INR"); - - lh.addStaticHoliday ("28-DEC-2009", "INR"); - - lh.addStaticHoliday ("26-JAN-2010", "INR"); - - lh.addStaticHoliday ("12-FEB-2010", "INR"); - - lh.addStaticHoliday ("01-MAR-2010", "INR"); - - lh.addStaticHoliday ("16-MAR-2010", "INR"); - - lh.addStaticHoliday ("24-MAR-2010", "INR"); - - lh.addStaticHoliday ("01-APR-2010", "INR"); - - lh.addStaticHoliday ("02-APR-2010", "INR"); - - lh.addStaticHoliday ("14-APR-2010", "INR"); - - lh.addStaticHoliday ("27-MAY-2010", "INR"); - - lh.addStaticHoliday ("01-JUL-2010", "INR"); - - lh.addStaticHoliday ("19-AUG-2010", "INR"); - - lh.addStaticHoliday ("31-AUG-2010", "INR"); - - lh.addStaticHoliday ("10-SEP-2010", "INR"); - - lh.addStaticHoliday ("30-SEP-2010", "INR"); - - lh.addStaticHoliday ("05-NOV-2010", "INR"); - - lh.addStaticHoliday ("17-NOV-2010", "INR"); - - lh.addStaticHoliday ("17-DEC-2010", "INR"); - - lh.addStaticHoliday ("26-JAN-2011", "INR"); - - lh.addStaticHoliday ("16-FEB-2011", "INR"); - - lh.addStaticHoliday ("02-MAR-2011", "INR"); - - lh.addStaticHoliday ("01-APR-2011", "INR"); - - lh.addStaticHoliday ("04-APR-2011", "INR"); - - lh.addStaticHoliday ("12-APR-2011", "INR"); - - lh.addStaticHoliday ("14-APR-2011", "INR"); - - lh.addStaticHoliday ("22-APR-2011", "INR"); - - lh.addStaticHoliday ("17-MAY-2011", "INR"); - - lh.addStaticHoliday ("01-JUL-2011", "INR"); - - lh.addStaticHoliday ("15-AUG-2011", "INR"); - - lh.addStaticHoliday ("19-AUG-2011", "INR"); - - lh.addStaticHoliday ("31-AUG-2011", "INR"); - - lh.addStaticHoliday ("01-SEP-2011", "INR"); - - lh.addStaticHoliday ("30-SEP-2011", "INR"); - - lh.addStaticHoliday ("06-OCT-2011", "INR"); - - lh.addStaticHoliday ("26-OCT-2011", "INR"); - - lh.addStaticHoliday ("27-OCT-2011", "INR"); - - lh.addStaticHoliday ("07-NOV-2011", "INR"); - - lh.addStaticHoliday ("10-NOV-2011", "INR"); - - lh.addStaticHoliday ("06-DEC-2011", "INR"); - - lh.addStaticHoliday ("26-JAN-2012", "INR"); - - lh.addStaticHoliday ("20-FEB-2012", "INR"); - - lh.addStaticHoliday ("08-MAR-2012", "INR"); - - lh.addStaticHoliday ("23-MAR-2012", "INR"); - - lh.addStaticHoliday ("02-APR-2012", "INR"); - - lh.addStaticHoliday ("05-APR-2012", "INR"); - - lh.addStaticHoliday ("06-APR-2012", "INR"); - - lh.addStaticHoliday ("01-MAY-2012", "INR"); - - lh.addStaticHoliday ("15-AUG-2012", "INR"); - - lh.addStaticHoliday ("20-AUG-2012", "INR"); - - lh.addStaticHoliday ("19-SEP-2012", "INR"); - - lh.addStaticHoliday ("02-OCT-2012", "INR"); - - lh.addStaticHoliday ("24-OCT-2012", "INR"); - - lh.addStaticHoliday ("13-NOV-2012", "INR"); - - lh.addStaticHoliday ("15-NOV-2012", "INR"); - - lh.addStaticHoliday ("28-NOV-2012", "INR"); - - lh.addStaticHoliday ("25-DEC-2012", "INR"); - - lh.addStaticHoliday ("25-JAN-2013", "INR"); - - lh.addStaticHoliday ("27-MAR-2013", "INR"); - - lh.addStaticHoliday ("29-MAR-2013", "INR"); - - lh.addStaticHoliday ("01-APR-2013", "INR"); - - lh.addStaticHoliday ("11-APR-2013", "INR"); - - lh.addStaticHoliday ("19-APR-2013", "INR"); - - lh.addStaticHoliday ("24-APR-2013", "INR"); - - lh.addStaticHoliday ("01-MAY-2013", "INR"); - - lh.addStaticHoliday ("15-AUG-2013", "INR"); - - lh.addStaticHoliday ("09-SEP-2013", "INR"); - - lh.addStaticHoliday ("30-SEP-2013", "INR"); - - lh.addStaticHoliday ("02-OCT-2013", "INR"); - - lh.addStaticHoliday ("16-OCT-2013", "INR"); - - lh.addStaticHoliday ("05-NOV-2013", "INR"); - - lh.addStaticHoliday ("15-NOV-2013", "INR"); - - lh.addStaticHoliday ("25-DEC-2013", "INR"); - - lh.addStaticHoliday ("14-JAN-2014", "INR"); - - lh.addStaticHoliday ("27-FEB-2014", "INR"); - - lh.addStaticHoliday ("17-MAR-2014", "INR"); - - lh.addStaticHoliday ("31-MAR-2014", "INR"); - - lh.addStaticHoliday ("01-APR-2014", "INR"); - - lh.addStaticHoliday ("08-APR-2014", "INR"); - - lh.addStaticHoliday ("14-APR-2014", "INR"); - - lh.addStaticHoliday ("18-APR-2014", "INR"); - - lh.addStaticHoliday ("01-MAY-2014", "INR"); - - lh.addStaticHoliday ("14-MAY-2014", "INR"); - - lh.addStaticHoliday ("30-JUL-2014", "INR"); - - lh.addStaticHoliday ("15-AUG-2014", "INR"); - - lh.addStaticHoliday ("18-AUG-2014", "INR"); - - lh.addStaticHoliday ("29-AUG-2014", "INR"); - - lh.addStaticHoliday ("30-SEP-2014", "INR"); - - lh.addStaticHoliday ("02-OCT-2014", "INR"); - - lh.addStaticHoliday ("03-OCT-2014", "INR"); - - lh.addStaticHoliday ("06-OCT-2014", "INR"); - - lh.addStaticHoliday ("23-OCT-2014", "INR"); - - lh.addStaticHoliday ("04-NOV-2014", "INR"); - - lh.addStaticHoliday ("06-NOV-2014", "INR"); - - lh.addStaticHoliday ("25-DEC-2014", "INR"); - - lh.addStaticHoliday ("26-JAN-2015", "INR"); - - lh.addStaticHoliday ("17-FEB-2015", "INR"); - - lh.addStaticHoliday ("06-MAR-2015", "INR"); - - lh.addStaticHoliday ("01-APR-2015", "INR"); - - lh.addStaticHoliday ("02-APR-2015", "INR"); - - lh.addStaticHoliday ("03-APR-2015", "INR"); - - lh.addStaticHoliday ("14-APR-2015", "INR"); - - lh.addStaticHoliday ("01-MAY-2015", "INR"); - - lh.addStaticHoliday ("04-MAY-2015", "INR"); - - lh.addStaticHoliday ("18-AUG-2015", "INR"); - - lh.addStaticHoliday ("17-SEP-2015", "INR"); - - lh.addStaticHoliday ("25-SEP-2015", "INR"); - - lh.addStaticHoliday ("30-SEP-2015", "INR"); - - lh.addStaticHoliday ("02-OCT-2015", "INR"); - - lh.addStaticHoliday ("22-OCT-2015", "INR"); - - lh.addStaticHoliday ("11-NOV-2015", "INR"); - - lh.addStaticHoliday ("13-NOV-2015", "INR"); - - lh.addStaticHoliday ("25-NOV-2015", "INR"); - - lh.addStaticHoliday ("25-DEC-2015", "INR"); - - lh.addStaticHoliday ("26-JAN-2016", "INR"); - - lh.addStaticHoliday ("07-MAR-2016", "INR"); - - lh.addStaticHoliday ("23-MAR-2016", "INR"); - - lh.addStaticHoliday ("25-MAR-2016", "INR"); - - lh.addStaticHoliday ("01-APR-2016", "INR"); - - lh.addStaticHoliday ("08-APR-2016", "INR"); - - lh.addStaticHoliday ("14-APR-2016", "INR"); - - lh.addStaticHoliday ("15-APR-2016", "INR"); - - lh.addStaticHoliday ("19-APR-2016", "INR"); - - lh.addStaticHoliday ("07-JUL-2016", "INR"); - - lh.addStaticHoliday ("15-AUG-2016", "INR"); - - lh.addStaticHoliday ("17-AUG-2016", "INR"); - - lh.addStaticHoliday ("05-SEP-2016", "INR"); - - lh.addStaticHoliday ("13-SEP-2016", "INR"); - - lh.addStaticHoliday ("30-SEP-2016", "INR"); - - lh.addStaticHoliday ("11-OCT-2016", "INR"); - - lh.addStaticHoliday ("12-OCT-2016", "INR"); - - lh.addStaticHoliday ("01-NOV-2016", "INR"); - - lh.addStaticHoliday ("14-NOV-2016", "INR"); - - lh.addStaticHoliday ("13-DEC-2016", "INR"); - - lh.addStaticHoliday ("26-JAN-2017", "INR"); - - lh.addStaticHoliday ("24-FEB-2017", "INR"); - - lh.addStaticHoliday ("13-MAR-2017", "INR"); - - lh.addStaticHoliday ("28-MAR-2017", "INR"); - - lh.addStaticHoliday ("04-APR-2017", "INR"); - - lh.addStaticHoliday ("14-APR-2017", "INR"); - - lh.addStaticHoliday ("01-MAY-2017", "INR"); - - lh.addStaticHoliday ("10-MAY-2017", "INR"); - - lh.addStaticHoliday ("26-JUN-2017", "INR"); - - lh.addStaticHoliday ("15-AUG-2017", "INR"); - - lh.addStaticHoliday ("17-AUG-2017", "INR"); - - lh.addStaticHoliday ("25-AUG-2017", "INR"); - - lh.addStaticHoliday ("29-SEP-2017", "INR"); - - lh.addStaticHoliday ("02-OCT-2017", "INR"); - - lh.addStaticHoliday ("19-OCT-2017", "INR"); - - lh.addStaticHoliday ("25-DEC-2017", "INR"); - - lh.addStaticHoliday ("26-JAN-2018", "INR"); - - lh.addStaticHoliday ("14-FEB-2018", "INR"); - - lh.addStaticHoliday ("02-MAR-2018", "INR"); - - lh.addStaticHoliday ("29-MAR-2018", "INR"); - - lh.addStaticHoliday ("30-MAR-2018", "INR"); - - lh.addStaticHoliday ("02-APR-2018", "INR"); - - lh.addStaticHoliday ("30-APR-2018", "INR"); - - lh.addStaticHoliday ("01-MAY-2018", "INR"); - - lh.addStaticHoliday ("15-AUG-2018", "INR"); - - lh.addStaticHoliday ("17-AUG-2018", "INR"); - - lh.addStaticHoliday ("22-AUG-2018", "INR"); - - lh.addStaticHoliday ("13-SEP-2018", "INR"); - - lh.addStaticHoliday ("21-SEP-2018", "INR"); - - lh.addStaticHoliday ("02-OCT-2018", "INR"); - - lh.addStaticHoliday ("19-OCT-2018", "INR"); - - lh.addStaticHoliday ("07-NOV-2018", "INR"); - - lh.addStaticHoliday ("09-NOV-2018", "INR"); - - lh.addStaticHoliday ("21-NOV-2018", "INR"); - - lh.addStaticHoliday ("23-NOV-2018", "INR"); - - lh.addStaticHoliday ("25-DEC-2018", "INR"); - - lh.addStaticHoliday ("04-MAR-2019", "INR"); - - lh.addStaticHoliday ("21-MAR-2019", "INR"); - - lh.addStaticHoliday ("01-APR-2019", "INR"); - - lh.addStaticHoliday ("17-APR-2019", "INR"); - - lh.addStaticHoliday ("19-APR-2019", "INR"); - - lh.addStaticHoliday ("01-MAY-2019", "INR"); - - lh.addStaticHoliday ("05-JUN-2019", "INR"); - - lh.addStaticHoliday ("12-AUG-2019", "INR"); - - lh.addStaticHoliday ("15-AUG-2019", "INR"); - - lh.addStaticHoliday ("02-SEP-2019", "INR"); - - lh.addStaticHoliday ("10-SEP-2019", "INR"); - - lh.addStaticHoliday ("30-SEP-2019", "INR"); - - lh.addStaticHoliday ("02-OCT-2019", "INR"); - - lh.addStaticHoliday ("07-OCT-2019", "INR"); - - lh.addStaticHoliday ("29-OCT-2019", "INR"); - - lh.addStaticHoliday ("12-NOV-2019", "INR"); - - lh.addStaticHoliday ("25-DEC-2019", "INR"); - - lh.addStaticHoliday ("21-FEB-2020", "INR"); - - lh.addStaticHoliday ("10-MAR-2020", "INR"); - - lh.addStaticHoliday ("25-MAR-2020", "INR"); - - lh.addStaticHoliday ("01-APR-2020", "INR"); - - lh.addStaticHoliday ("02-APR-2020", "INR"); - - lh.addStaticHoliday ("06-APR-2020", "INR"); - - lh.addStaticHoliday ("10-APR-2020", "INR"); - - lh.addStaticHoliday ("14-APR-2020", "INR"); - - lh.addStaticHoliday ("01-MAY-2020", "INR"); - - lh.addStaticHoliday ("07-MAY-2020", "INR"); - - lh.addStaticHoliday ("25-MAY-2020", "INR"); - - lh.addStaticHoliday ("30-SEP-2020", "INR"); - - lh.addStaticHoliday ("02-OCT-2020", "INR"); - - lh.addStaticHoliday ("30-OCT-2020", "INR"); - - lh.addStaticHoliday ("16-NOV-2020", "INR"); - - lh.addStaticHoliday ("30-NOV-2020", "INR"); - - lh.addStaticHoliday ("25-DEC-2020", "INR"); - - lh.addStaticHoliday ("26-JAN-2021", "INR"); - - lh.addStaticHoliday ("11-MAR-2021", "INR"); - - lh.addStaticHoliday ("29-MAR-2021", "INR"); - - lh.addStaticHoliday ("01-APR-2021", "INR"); - - lh.addStaticHoliday ("02-APR-2021", "INR"); - - lh.addStaticHoliday ("13-APR-2021", "INR"); - - lh.addStaticHoliday ("14-APR-2021", "INR"); - - lh.addStaticHoliday ("21-APR-2021", "INR"); - - lh.addStaticHoliday ("14-MAY-2021", "INR"); - - lh.addStaticHoliday ("26-MAY-2021", "INR"); - - lh.addStaticHoliday ("21-JUL-2021", "INR"); - - lh.addStaticHoliday ("16-AUG-2021", "INR"); - - lh.addStaticHoliday ("20-AUG-2021", "INR"); - - lh.addStaticHoliday ("10-SEP-2021", "INR"); - - lh.addStaticHoliday ("30-SEP-2021", "INR"); - - lh.addStaticHoliday ("15-OCT-2021", "INR"); - - lh.addStaticHoliday ("20-OCT-2021", "INR"); - - lh.addStaticHoliday ("04-NOV-2021", "INR"); - - lh.addStaticHoliday ("19-NOV-2021", "INR"); - - lh.addStaticHoliday ("26-JAN-2022", "INR"); - - lh.addStaticHoliday ("01-MAR-2022", "INR"); - - lh.addStaticHoliday ("18-MAR-2022", "INR"); - - lh.addStaticHoliday ("01-APR-2022", "INR"); - - lh.addStaticHoliday ("14-APR-2022", "INR"); - - lh.addStaticHoliday ("15-APR-2022", "INR"); - - lh.addStaticHoliday ("03-MAY-2022", "INR"); - - lh.addStaticHoliday ("16-MAY-2022", "INR"); - - lh.addStaticHoliday ("09-AUG-2022", "INR"); - - lh.addStaticHoliday ("15-AUG-2022", "INR"); - - lh.addStaticHoliday ("16-AUG-2022", "INR"); - - lh.addStaticHoliday ("31-AUG-2022", "INR"); - - lh.addStaticHoliday ("30-SEP-2022", "INR"); - - lh.addStaticHoliday ("04-OCT-2022", "INR"); - - lh.addStaticHoliday ("24-OCT-2022", "INR"); - - lh.addStaticHoliday ("27-OCT-2022", "INR"); - - lh.addStaticHoliday ("08-NOV-2022", "INR"); - - lh.addStaticHoliday ("26-JAN-2023", "INR"); - - lh.addStaticHoliday ("07-MAR-2023", "INR"); - - lh.addStaticHoliday ("22-MAR-2023", "INR"); - - lh.addStaticHoliday ("30-MAR-2023", "INR"); - - lh.addStaticHoliday ("04-APR-2023", "INR"); - - lh.addStaticHoliday ("07-APR-2023", "INR"); - - lh.addStaticHoliday ("14-APR-2023", "INR"); - - lh.addStaticHoliday ("01-MAY-2023", "INR"); - - lh.addStaticHoliday ("05-MAY-2023", "INR"); - - lh.addStaticHoliday ("29-JUN-2023", "INR"); - - lh.addStaticHoliday ("15-AUG-2023", "INR"); - - lh.addStaticHoliday ("16-AUG-2023", "INR"); - - lh.addStaticHoliday ("18-SEP-2023", "INR"); - - lh.addStaticHoliday ("29-SEP-2023", "INR"); - - lh.addStaticHoliday ("02-OCT-2023", "INR"); - - lh.addStaticHoliday ("24-OCT-2023", "INR"); - - lh.addStaticHoliday ("15-NOV-2023", "INR"); - - lh.addStaticHoliday ("27-NOV-2023", "INR"); - - lh.addStaticHoliday ("25-DEC-2023", "INR"); - - lh.addStaticHoliday ("26-JAN-2024", "INR"); - - lh.addStaticHoliday ("08-MAR-2024", "INR"); - - lh.addStaticHoliday ("25-MAR-2024", "INR"); - - lh.addStaticHoliday ("29-MAR-2024", "INR"); - - lh.addStaticHoliday ("01-APR-2024", "INR"); - - lh.addStaticHoliday ("09-APR-2024", "INR"); - - lh.addStaticHoliday ("11-APR-2024", "INR"); - - lh.addStaticHoliday ("17-APR-2024", "INR"); - - lh.addStaticHoliday ("01-MAY-2024", "INR"); - - lh.addStaticHoliday ("23-MAY-2024", "INR"); - - lh.addStaticHoliday ("17-JUN-2024", "INR"); - - lh.addStaticHoliday ("17-JUL-2024", "INR"); - - lh.addStaticHoliday ("15-AUG-2024", "INR"); - - lh.addStaticHoliday ("17-SEP-2024", "INR"); - - lh.addStaticHoliday ("30-SEP-2024", "INR"); - - lh.addStaticHoliday ("02-OCT-2024", "INR"); - - lh.addStaticHoliday ("01-NOV-2024", "INR"); - - lh.addStaticHoliday ("15-NOV-2024", "INR"); - - lh.addStaticHoliday ("25-DEC-2024", "INR"); - - lh.addStaticHoliday ("26-FEB-2025", "INR"); - - lh.addStaticHoliday ("14-MAR-2025", "INR"); - - lh.addStaticHoliday ("31-MAR-2025", "INR"); - - lh.addStaticHoliday ("01-APR-2025", "INR"); - - lh.addStaticHoliday ("10-APR-2025", "INR"); - - lh.addStaticHoliday ("14-APR-2025", "INR"); - - lh.addStaticHoliday ("18-APR-2025", "INR"); - - lh.addStaticHoliday ("01-MAY-2025", "INR"); - - lh.addStaticHoliday ("12-MAY-2025", "INR"); - - lh.addStaticHoliday ("15-AUG-2025", "INR"); - - lh.addStaticHoliday ("27-AUG-2025", "INR"); - - lh.addStaticHoliday ("30-SEP-2025", "INR"); - - lh.addStaticHoliday ("02-OCT-2025", "INR"); - - lh.addStaticHoliday ("21-OCT-2025", "INR"); - - lh.addStaticHoliday ("23-OCT-2025", "INR"); - - lh.addStaticHoliday ("05-NOV-2025", "INR"); - - lh.addStaticHoliday ("25-DEC-2025", "INR"); - - lh.addStaticHoliday ("26-JAN-2026", "INR"); - - lh.addStaticHoliday ("03-MAR-2026", "INR"); - - lh.addStaticHoliday ("19-MAR-2026", "INR"); - - lh.addStaticHoliday ("26-MAR-2026", "INR"); - - lh.addStaticHoliday ("31-MAR-2026", "INR"); - - lh.addStaticHoliday ("01-APR-2026", "INR"); - - lh.addStaticHoliday ("03-APR-2026", "INR"); - - lh.addStaticHoliday ("14-APR-2026", "INR"); - - lh.addStaticHoliday ("01-MAY-2026", "INR"); - - lh.addStaticHoliday ("28-MAY-2026", "INR"); - - lh.addStaticHoliday ("26-JUN-2026", "INR"); - - lh.addStaticHoliday ("26-AUG-2026", "INR"); - - lh.addStaticHoliday ("14-SEP-2026", "INR"); - - lh.addStaticHoliday ("30-SEP-2026", "INR"); - - lh.addStaticHoliday ("02-OCT-2026", "INR"); - - lh.addStaticHoliday ("20-OCT-2026", "INR"); - - lh.addStaticHoliday ("11-NOV-2026", "INR"); - - lh.addStaticHoliday ("24-NOV-2026", "INR"); - - lh.addStaticHoliday ("25-DEC-2026", "INR"); - - lh.addStaticHoliday ("26-JAN-2027", "INR"); - - lh.addStaticHoliday ("11-MAR-2027", "INR"); - - lh.addStaticHoliday ("22-MAR-2027", "INR"); - - lh.addStaticHoliday ("26-MAR-2027", "INR"); - - lh.addStaticHoliday ("01-APR-2027", "INR"); - - lh.addStaticHoliday ("07-APR-2027", "INR"); - - lh.addStaticHoliday ("14-APR-2027", "INR"); - - lh.addStaticHoliday ("15-APR-2027", "INR"); - - lh.addStaticHoliday ("19-APR-2027", "INR"); - - lh.addStaticHoliday ("17-MAY-2027", "INR"); - - lh.addStaticHoliday ("20-MAY-2027", "INR"); - - lh.addStaticHoliday ("16-JUN-2027", "INR"); - - lh.addStaticHoliday ("16-AUG-2027", "INR"); - - lh.addStaticHoliday ("30-SEP-2027", "INR"); - - lh.addStaticHoliday ("29-OCT-2027", "INR"); - - lh.addStaticHoliday ("26-JAN-2028", "INR"); - - lh.addStaticHoliday ("23-FEB-2028", "INR"); - - lh.addStaticHoliday ("28-FEB-2028", "INR"); - - lh.addStaticHoliday ("27-MAR-2028", "INR"); - - lh.addStaticHoliday ("03-APR-2028", "INR"); - - lh.addStaticHoliday ("07-APR-2028", "INR"); - - lh.addStaticHoliday ("14-APR-2028", "INR"); - - lh.addStaticHoliday ("01-MAY-2028", "INR"); - - lh.addStaticHoliday ("08-MAY-2028", "INR"); - - lh.addStaticHoliday ("04-AUG-2028", "INR"); - - lh.addStaticHoliday ("14-AUG-2028", "INR"); - - lh.addStaticHoliday ("15-AUG-2028", "INR"); - - lh.addStaticHoliday ("23-AUG-2028", "INR"); - - lh.addStaticHoliday ("27-SEP-2028", "INR"); - - lh.addStaticHoliday ("02-OCT-2028", "INR"); - - lh.addStaticHoliday ("17-OCT-2028", "INR"); - - lh.addStaticHoliday ("19-OCT-2028", "INR"); - - lh.addStaticHoliday ("02-NOV-2028", "INR"); - - lh.addStaticHoliday ("25-DEC-2028", "INR"); - - lh.addStaticHoliday ("26-JAN-2029", "INR"); - - lh.addStaticHoliday ("16-FEB-2029", "INR"); - - lh.addStaticHoliday ("01-MAR-2029", "INR"); - - lh.addStaticHoliday ("16-MAR-2029", "INR"); - - lh.addStaticHoliday ("30-MAR-2029", "INR"); - - lh.addStaticHoliday ("02-APR-2029", "INR"); - - lh.addStaticHoliday ("23-APR-2029", "INR"); - - lh.addStaticHoliday ("25-APR-2029", "INR"); - - lh.addStaticHoliday ("26-APR-2029", "INR"); - - lh.addStaticHoliday ("01-MAY-2029", "INR"); - - lh.addStaticHoliday ("25-MAY-2029", "INR"); - - lh.addStaticHoliday ("25-JUL-2029", "INR"); - - lh.addStaticHoliday ("14-AUG-2029", "INR"); - - lh.addStaticHoliday ("15-AUG-2029", "INR"); - - lh.addStaticHoliday ("11-SEP-2029", "INR"); - - lh.addStaticHoliday ("02-OCT-2029", "INR"); - - lh.addStaticHoliday ("16-OCT-2029", "INR"); - - lh.addStaticHoliday ("05-NOV-2029", "INR"); - - lh.addStaticHoliday ("07-NOV-2029", "INR"); - - lh.addStaticHoliday ("20-NOV-2029", "INR"); - - lh.addStaticHoliday ("25-DEC-2029", "INR"); - - lh.addStaticHoliday ("05-FEB-2030", "INR"); - - lh.addStaticHoliday ("20-MAR-2030", "INR"); - - lh.addStaticHoliday ("01-APR-2030", "INR"); - - lh.addStaticHoliday ("03-APR-2030", "INR"); - - lh.addStaticHoliday ("12-APR-2030", "INR"); - - lh.addStaticHoliday ("16-APR-2030", "INR"); - - lh.addStaticHoliday ("19-APR-2030", "INR"); - - lh.addStaticHoliday ("01-MAY-2030", "INR"); - - lh.addStaticHoliday ("14-MAY-2030", "INR"); - - lh.addStaticHoliday ("17-MAY-2030", "INR"); - - lh.addStaticHoliday ("14-AUG-2030", "INR"); - - lh.addStaticHoliday ("15-AUG-2030", "INR"); - - lh.addStaticHoliday ("30-SEP-2030", "INR"); - - lh.addStaticHoliday ("02-OCT-2030", "INR"); - - lh.addStaticHoliday ("28-OCT-2030", "INR"); - - lh.addStaticHoliday ("25-DEC-2030", "INR"); - - lh.addStaticHoliday ("20-FEB-2031", "INR"); - - lh.addStaticHoliday ("24-MAR-2031", "INR"); - - lh.addStaticHoliday ("01-APR-2031", "INR"); - - lh.addStaticHoliday ("02-APR-2031", "INR"); - - lh.addStaticHoliday ("03-APR-2031", "INR"); - - lh.addStaticHoliday ("11-APR-2031", "INR"); - - lh.addStaticHoliday ("14-APR-2031", "INR"); - - lh.addStaticHoliday ("01-MAY-2031", "INR"); - - lh.addStaticHoliday ("07-MAY-2031", "INR"); - - lh.addStaticHoliday ("03-JUL-2031", "INR"); - - lh.addStaticHoliday ("14-AUG-2031", "INR"); - - lh.addStaticHoliday ("15-AUG-2031", "INR"); - - lh.addStaticHoliday ("30-SEP-2031", "INR"); - - lh.addStaticHoliday ("02-OCT-2031", "INR"); - - lh.addStaticHoliday ("14-NOV-2031", "INR"); - - lh.addStaticHoliday ("28-NOV-2031", "INR"); - - lh.addStaticHoliday ("25-DEC-2031", "INR"); - - lh.addStaticHoliday ("15-JAN-2032", "INR"); - - lh.addStaticHoliday ("26-JAN-2032", "INR"); - - lh.addStaticHoliday ("10-MAR-2032", "INR"); - - lh.addStaticHoliday ("23-MAR-2032", "INR"); - - lh.addStaticHoliday ("26-MAR-2032", "INR"); - - lh.addStaticHoliday ("01-APR-2032", "INR"); - - lh.addStaticHoliday ("14-APR-2032", "INR"); - - lh.addStaticHoliday ("19-APR-2032", "INR"); - - lh.addStaticHoliday ("21-APR-2032", "INR"); - - lh.addStaticHoliday ("23-APR-2032", "INR"); - - lh.addStaticHoliday ("25-MAY-2032", "INR"); - - lh.addStaticHoliday ("21-JUN-2032", "INR"); - - lh.addStaticHoliday ("13-AUG-2032", "INR"); - - lh.addStaticHoliday ("08-SEP-2032", "INR"); - - lh.addStaticHoliday ("30-SEP-2032", "INR"); - - lh.addStaticHoliday ("14-OCT-2032", "INR"); - - lh.addStaticHoliday ("02-NOV-2032", "INR"); - - lh.addStaticHoliday ("05-NOV-2032", "INR"); - - lh.addStaticHoliday ("17-NOV-2032", "INR"); - - lh.addStaticHoliday ("03-JAN-2033", "INR"); - - lh.addStaticHoliday ("26-JAN-2033", "INR"); - - lh.addStaticHoliday ("16-MAR-2033", "INR"); - - lh.addStaticHoliday ("31-MAR-2033", "INR"); - - lh.addStaticHoliday ("01-APR-2033", "INR"); - - lh.addStaticHoliday ("07-APR-2033", "INR"); - - lh.addStaticHoliday ("11-APR-2033", "INR"); - - lh.addStaticHoliday ("12-APR-2033", "INR"); - - lh.addStaticHoliday ("14-APR-2033", "INR"); - - lh.addStaticHoliday ("15-APR-2033", "INR"); - - lh.addStaticHoliday ("15-AUG-2033", "INR"); - - lh.addStaticHoliday ("30-SEP-2033", "INR"); - - lh.addStaticHoliday ("03-OCT-2033", "INR"); - - lh.addStaticHoliday ("25-OCT-2033", "INR"); - - lh.addStaticHoliday ("26-JAN-2034", "INR"); - - lh.addStaticHoliday ("17-FEB-2034", "INR"); - - lh.addStaticHoliday ("02-MAR-2034", "INR"); - - lh.addStaticHoliday ("21-MAR-2034", "INR"); - - lh.addStaticHoliday ("28-MAR-2034", "INR"); - - lh.addStaticHoliday ("31-MAR-2034", "INR"); - - lh.addStaticHoliday ("03-APR-2034", "INR"); - - lh.addStaticHoliday ("07-APR-2034", "INR"); - - lh.addStaticHoliday ("14-APR-2034", "INR"); - - lh.addStaticHoliday ("01-MAY-2034", "INR"); - - lh.addStaticHoliday ("03-MAY-2034", "INR"); - - lh.addStaticHoliday ("31-MAY-2034", "INR"); - - lh.addStaticHoliday ("15-AUG-2034", "INR"); - - lh.addStaticHoliday ("02-OCT-2034", "INR"); - - lh.addStaticHoliday ("10-NOV-2034", "INR"); - - lh.addStaticHoliday ("13-NOV-2034", "INR"); - - lh.addStaticHoliday ("13-DEC-2034", "INR"); - - lh.addStaticHoliday ("25-DEC-2034", "INR"); - - lh.addStaticHoliday ("26-JAN-2035", "INR"); - - lh.addStaticHoliday ("19-FEB-2035", "INR"); - - lh.addStaticHoliday ("08-MAR-2035", "INR"); - - lh.addStaticHoliday ("21-MAR-2035", "INR"); - - lh.addStaticHoliday ("23-MAR-2035", "INR"); - - lh.addStaticHoliday ("02-APR-2035", "INR"); - - lh.addStaticHoliday ("09-APR-2035", "INR"); - - lh.addStaticHoliday ("16-APR-2035", "INR"); - - lh.addStaticHoliday ("20-APR-2035", "INR"); - - lh.addStaticHoliday ("01-MAY-2035", "INR"); - - lh.addStaticHoliday ("21-MAY-2035", "INR"); - - lh.addStaticHoliday ("22-MAY-2035", "INR"); - - lh.addStaticHoliday ("13-AUG-2035", "INR"); - - lh.addStaticHoliday ("15-AUG-2035", "INR"); - - lh.addStaticHoliday ("05-SEP-2035", "INR"); - - lh.addStaticHoliday ("02-OCT-2035", "INR"); - - lh.addStaticHoliday ("11-OCT-2035", "INR"); - - lh.addStaticHoliday ("30-OCT-2035", "INR"); - - lh.addStaticHoliday ("01-NOV-2035", "INR"); - - lh.addStaticHoliday ("15-NOV-2035", "INR"); - - lh.addStaticHoliday ("25-DEC-2035", "INR"); - - lh.addStaticHoliday ("25-FEB-2036", "INR"); - - lh.addStaticHoliday ("12-MAR-2036", "INR"); - - lh.addStaticHoliday ("28-MAR-2036", "INR"); - - lh.addStaticHoliday ("01-APR-2036", "INR"); - - lh.addStaticHoliday ("08-APR-2036", "INR"); - - lh.addStaticHoliday ("11-APR-2036", "INR"); - - lh.addStaticHoliday ("14-APR-2036", "INR"); - - lh.addStaticHoliday ("01-MAY-2036", "INR"); - - lh.addStaticHoliday ("09-MAY-2036", "INR"); - - lh.addStaticHoliday ("12-AUG-2036", "INR"); - - lh.addStaticHoliday ("15-AUG-2036", "INR"); - - lh.addStaticHoliday ("29-SEP-2036", "INR"); - - lh.addStaticHoliday ("30-SEP-2036", "INR"); - - lh.addStaticHoliday ("02-OCT-2036", "INR"); - - lh.addStaticHoliday ("21-OCT-2036", "INR"); - - lh.addStaticHoliday ("03-NOV-2036", "INR"); - - lh.addStaticHoliday ("20-NOV-2036", "INR"); - - lh.addStaticHoliday ("25-DEC-2036", "INR"); - - lh.addStaticHoliday ("26-JAN-2037", "INR"); - - lh.addStaticHoliday ("28-JAN-2037", "INR"); - - lh.addStaticHoliday ("13-FEB-2037", "INR"); - - lh.addStaticHoliday ("26-FEB-2037", "INR"); - - lh.addStaticHoliday ("02-MAR-2037", "INR"); - - lh.addStaticHoliday ("17-MAR-2037", "INR"); - - lh.addStaticHoliday ("25-MAR-2037", "INR"); - - lh.addStaticHoliday ("01-APR-2037", "INR"); - - lh.addStaticHoliday ("03-APR-2037", "INR"); - - lh.addStaticHoliday ("14-APR-2037", "INR"); - - lh.addStaticHoliday ("29-APR-2037", "INR"); - - lh.addStaticHoliday ("01-MAY-2037", "INR"); - - lh.addStaticHoliday ("12-AUG-2037", "INR"); - - lh.addStaticHoliday ("30-SEP-2037", "INR"); - - lh.addStaticHoliday ("02-OCT-2037", "INR"); - - lh.addStaticHoliday ("09-NOV-2037", "INR"); - - lh.addStaticHoliday ("25-DEC-2037", "INR"); - - lh.addStaticHoliday ("26-JAN-2038", "INR"); - - lh.addStaticHoliday ("15-FEB-2038", "INR"); - - lh.addStaticHoliday ("04-MAR-2038", "INR"); - - lh.addStaticHoliday ("01-APR-2038", "INR"); - - lh.addStaticHoliday ("05-APR-2038", "INR"); - - lh.addStaticHoliday ("13-APR-2038", "INR"); - - lh.addStaticHoliday ("14-APR-2038", "INR"); - - lh.addStaticHoliday ("23-APR-2038", "INR"); - - lh.addStaticHoliday ("18-MAY-2038", "INR"); - - lh.addStaticHoliday ("12-AUG-2038", "INR"); - - lh.addStaticHoliday ("02-SEP-2038", "INR"); - - lh.addStaticHoliday ("30-SEP-2038", "INR"); - - lh.addStaticHoliday ("07-OCT-2038", "INR"); - - lh.addStaticHoliday ("27-OCT-2038", "INR"); - - lh.addStaticHoliday ("29-OCT-2038", "INR"); - - lh.addStaticHoliday ("11-NOV-2038", "INR"); - - lh.addStaticHoliday ("06-JAN-2039", "INR"); - - lh.addStaticHoliday ("26-JAN-2039", "INR"); - - lh.addStaticHoliday ("21-FEB-2039", "INR"); - - lh.addStaticHoliday ("11-MAR-2039", "INR"); - - lh.addStaticHoliday ("25-MAR-2039", "INR"); - - lh.addStaticHoliday ("01-APR-2039", "INR"); - - lh.addStaticHoliday ("07-APR-2039", "INR"); - - lh.addStaticHoliday ("08-APR-2039", "INR"); - - lh.addStaticHoliday ("14-APR-2039", "INR"); - - lh.addStaticHoliday ("12-AUG-2039", "INR"); - - lh.addStaticHoliday ("15-AUG-2039", "INR"); - - lh.addStaticHoliday ("23-AUG-2039", "INR"); - - lh.addStaticHoliday ("30-SEP-2039", "INR"); - - lh.addStaticHoliday ("20-OCT-2039", "INR"); - - lh.addStaticHoliday ("26-OCT-2039", "INR"); - - lh.addStaticHoliday ("15-NOV-2039", "INR"); - - lh.addStaticHoliday ("17-NOV-2039", "INR"); - - lh.addStaticHoliday ("30-NOV-2039", "INR"); - - lh.addStaticHoliday ("27-DEC-2039", "INR"); - - lh.addStaticHoliday ("25-JAN-2040", "INR"); - - lh.addStaticHoliday ("26-JAN-2040", "INR"); - - lh.addStaticHoliday ("26-MAR-2040", "INR"); - - lh.addStaticHoliday ("29-MAR-2040", "INR"); - - lh.addStaticHoliday ("30-MAR-2040", "INR"); - - lh.addStaticHoliday ("02-APR-2040", "INR"); - - lh.addStaticHoliday ("12-APR-2040", "INR"); - - lh.addStaticHoliday ("20-APR-2040", "INR"); - - lh.addStaticHoliday ("25-APR-2040", "INR"); - - lh.addStaticHoliday ("01-MAY-2040", "INR"); - - lh.addStaticHoliday ("15-AUG-2040", "INR"); - - lh.addStaticHoliday ("10-SEP-2040", "INR"); - - lh.addStaticHoliday ("02-OCT-2040", "INR"); - - lh.addStaticHoliday ("09-OCT-2040", "INR"); - - lh.addStaticHoliday ("15-OCT-2040", "INR"); - - lh.addStaticHoliday ("06-NOV-2040", "INR"); - - lh.addStaticHoliday ("25-DEC-2040", "INR"); - - lh.addStaticHoliday ("14-JAN-2041", "INR"); - - lh.addStaticHoliday ("01-MAR-2041", "INR"); - - lh.addStaticHoliday ("18-MAR-2041", "INR"); - - lh.addStaticHoliday ("01-APR-2041", "INR"); - - lh.addStaticHoliday ("02-APR-2041", "INR"); - - lh.addStaticHoliday ("09-APR-2041", "INR"); - - lh.addStaticHoliday ("19-APR-2041", "INR"); - - lh.addStaticHoliday ("01-MAY-2041", "INR"); - - lh.addStaticHoliday ("16-MAY-2041", "INR"); - - lh.addStaticHoliday ("15-AUG-2041", "INR"); - - lh.addStaticHoliday ("30-AUG-2041", "INR"); - - lh.addStaticHoliday ("30-SEP-2041", "INR"); - - lh.addStaticHoliday ("02-OCT-2041", "INR"); - - lh.addStaticHoliday ("24-OCT-2041", "INR"); - - lh.addStaticHoliday ("08-NOV-2041", "INR"); - - lh.addStaticHoliday ("05-DEC-2041", "INR"); - - lh.addStaticHoliday ("25-DEC-2041", "INR"); - - lh.addStaticHoliday ("18-FEB-2042", "INR"); - - lh.addStaticHoliday ("05-MAR-2042", "INR"); - - lh.addStaticHoliday ("07-MAR-2042", "INR"); - - lh.addStaticHoliday ("01-APR-2042", "INR"); - - lh.addStaticHoliday ("03-APR-2042", "INR"); - - lh.addStaticHoliday ("04-APR-2042", "INR"); - - lh.addStaticHoliday ("14-APR-2042", "INR"); - - lh.addStaticHoliday ("01-MAY-2042", "INR"); - - lh.addStaticHoliday ("05-MAY-2042", "INR"); - - lh.addStaticHoliday ("11-AUG-2042", "INR"); - - lh.addStaticHoliday ("15-AUG-2042", "INR"); - - lh.addStaticHoliday ("17-SEP-2042", "INR"); - - lh.addStaticHoliday ("18-SEP-2042", "INR"); - - lh.addStaticHoliday ("30-SEP-2042", "INR"); - - lh.addStaticHoliday ("02-OCT-2042", "INR"); - - lh.addStaticHoliday ("24-OCT-2042", "INR"); - - lh.addStaticHoliday ("12-NOV-2042", "INR"); - - lh.addStaticHoliday ("14-NOV-2042", "INR"); - - lh.addStaticHoliday ("25-NOV-2042", "INR"); - - lh.addStaticHoliday ("27-NOV-2042", "INR"); - - lh.addStaticHoliday ("25-DEC-2042", "INR"); - - lh.addStaticHoliday ("26-JAN-2043", "INR"); - - lh.addStaticHoliday ("23-FEB-2043", "INR"); - - lh.addStaticHoliday ("09-MAR-2043", "INR"); - - lh.addStaticHoliday ("26-MAR-2043", "INR"); - - lh.addStaticHoliday ("27-MAR-2043", "INR"); - - lh.addStaticHoliday ("01-APR-2043", "INR"); - - lh.addStaticHoliday ("10-APR-2043", "INR"); - - lh.addStaticHoliday ("14-APR-2043", "INR"); - - lh.addStaticHoliday ("17-APR-2043", "INR"); - - lh.addStaticHoliday ("22-APR-2043", "INR"); - - lh.addStaticHoliday ("01-MAY-2043", "INR"); - - lh.addStaticHoliday ("11-AUG-2043", "INR"); - - lh.addStaticHoliday ("07-SEP-2043", "INR"); - - lh.addStaticHoliday ("30-SEP-2043", "INR"); - - lh.addStaticHoliday ("02-OCT-2043", "INR"); - - lh.addStaticHoliday ("13-OCT-2043", "INR"); - - lh.addStaticHoliday ("03-NOV-2043", "INR"); - - lh.addStaticHoliday ("16-NOV-2043", "INR"); - - lh.addStaticHoliday ("25-DEC-2043", "INR"); - - lh.addStaticHoliday ("26-JAN-2044", "INR"); - - lh.addStaticHoliday ("12-FEB-2044", "INR"); - - lh.addStaticHoliday ("14-MAR-2044", "INR"); - - lh.addStaticHoliday ("30-MAR-2044", "INR"); - - lh.addStaticHoliday ("01-APR-2044", "INR"); - - lh.addStaticHoliday ("06-APR-2044", "INR"); - - lh.addStaticHoliday ("14-APR-2044", "INR"); - - lh.addStaticHoliday ("15-APR-2044", "INR"); - - lh.addStaticHoliday ("11-MAY-2044", "INR"); - - lh.addStaticHoliday ("10-AUG-2044", "INR"); - - lh.addStaticHoliday ("15-AUG-2044", "INR"); - - lh.addStaticHoliday ("25-AUG-2044", "INR"); - - lh.addStaticHoliday ("26-AUG-2044", "INR"); - - lh.addStaticHoliday ("30-SEP-2044", "INR"); - - lh.addStaticHoliday ("20-OCT-2044", "INR"); - - lh.addStaticHoliday ("02-NOV-2044", "INR"); - - lh.addStaticHoliday ("01-DEC-2044", "INR"); - - lh.addStaticHoliday ("26-JAN-2045", "INR"); - - lh.addStaticHoliday ("31-JAN-2045", "INR"); - - lh.addStaticHoliday ("15-FEB-2045", "INR"); - - lh.addStaticHoliday ("03-MAR-2045", "INR"); - - lh.addStaticHoliday ("27-MAR-2045", "INR"); - - lh.addStaticHoliday ("30-MAR-2045", "INR"); - - lh.addStaticHoliday ("07-APR-2045", "INR"); - - lh.addStaticHoliday ("14-APR-2045", "INR"); - - lh.addStaticHoliday ("01-MAY-2045", "INR"); - - lh.addStaticHoliday ("10-AUG-2045", "INR"); - - lh.addStaticHoliday ("15-AUG-2045", "INR"); - - lh.addStaticHoliday ("14-SEP-2045", "INR"); - - lh.addStaticHoliday ("02-OCT-2045", "INR"); - - lh.addStaticHoliday ("20-OCT-2045", "INR"); - - lh.addStaticHoliday ("08-NOV-2045", "INR"); - - lh.addStaticHoliday ("10-NOV-2045", "INR"); - - lh.addStaticHoliday ("20-NOV-2045", "INR"); - - lh.addStaticHoliday ("24-NOV-2045", "INR"); - - lh.addStaticHoliday ("25-DEC-2045", "INR"); - - lh.addStaticHoliday ("26-JAN-2046", "INR"); - - lh.addStaticHoliday ("05-MAR-2046", "INR"); - - lh.addStaticHoliday ("22-MAR-2046", "INR"); - - lh.addStaticHoliday ("23-MAR-2046", "INR"); - - lh.addStaticHoliday ("02-APR-2046", "INR"); - - lh.addStaticHoliday ("19-APR-2046", "INR"); - - lh.addStaticHoliday ("01-MAY-2046", "INR"); - - lh.addStaticHoliday ("10-AUG-2046", "INR"); - - lh.addStaticHoliday ("15-AUG-2046", "INR"); - - lh.addStaticHoliday ("03-SEP-2046", "INR"); - - lh.addStaticHoliday ("02-OCT-2046", "INR"); - - lh.addStaticHoliday ("09-OCT-2046", "INR"); - - lh.addStaticHoliday ("12-OCT-2046", "INR"); - - lh.addStaticHoliday ("29-OCT-2046", "INR"); - - lh.addStaticHoliday ("30-OCT-2046", "INR"); - - lh.addStaticHoliday ("13-NOV-2046", "INR"); - - lh.addStaticHoliday ("25-DEC-2046", "INR"); - - lh.addStaticHoliday ("10-JAN-2047", "INR"); - - lh.addStaticHoliday ("22-FEB-2047", "INR"); - - lh.addStaticHoliday ("12-MAR-2047", "INR"); - - lh.addStaticHoliday ("27-MAR-2047", "INR"); - - lh.addStaticHoliday ("01-APR-2047", "INR"); - - lh.addStaticHoliday ("04-APR-2047", "INR"); - - lh.addStaticHoliday ("08-APR-2047", "INR"); - - lh.addStaticHoliday ("12-APR-2047", "INR"); - - lh.addStaticHoliday ("01-MAY-2047", "INR"); - - lh.addStaticHoliday ("09-MAY-2047", "INR"); - - lh.addStaticHoliday ("25-JUL-2047", "INR"); - - lh.addStaticHoliday ("15-AUG-2047", "INR"); - - lh.addStaticHoliday ("30-SEP-2047", "INR"); - - lh.addStaticHoliday ("01-OCT-2047", "INR"); - - lh.addStaticHoliday ("02-OCT-2047", "INR"); - - lh.addStaticHoliday ("18-OCT-2047", "INR"); - - lh.addStaticHoliday ("31-OCT-2047", "INR"); - - lh.addStaticHoliday ("25-DEC-2047", "INR"); - - lh.addStaticHoliday ("12-FEB-2048", "INR"); - - lh.addStaticHoliday ("01-APR-2048", "INR"); - - lh.addStaticHoliday ("03-APR-2048", "INR"); - - lh.addStaticHoliday ("14-APR-2048", "INR"); - - lh.addStaticHoliday ("22-APR-2048", "INR"); - - lh.addStaticHoliday ("01-MAY-2048", "INR"); - - lh.addStaticHoliday ("27-MAY-2048", "INR"); - - lh.addStaticHoliday ("14-JUL-2048", "INR"); - - lh.addStaticHoliday ("11-SEP-2048", "INR"); - - lh.addStaticHoliday ("30-SEP-2048", "INR"); - - lh.addStaticHoliday ("02-OCT-2048", "INR"); - - lh.addStaticHoliday ("16-OCT-2048", "INR"); - - lh.addStaticHoliday ("19-OCT-2048", "INR"); - - lh.addStaticHoliday ("05-NOV-2048", "INR"); - - lh.addStaticHoliday ("20-NOV-2048", "INR"); - - lh.addStaticHoliday ("25-DEC-2048", "INR"); - - lh.addStaticHoliday ("26-JAN-2049", "INR"); - - lh.addStaticHoliday ("02-MAR-2049", "INR"); - - lh.addStaticHoliday ("19-MAR-2049", "INR"); - - lh.addStaticHoliday ("01-APR-2049", "INR"); - - lh.addStaticHoliday ("14-APR-2049", "INR"); - - lh.addStaticHoliday ("16-APR-2049", "INR"); - - lh.addStaticHoliday ("17-MAY-2049", "INR"); - - lh.addStaticHoliday ("09-AUG-2049", "INR"); - - lh.addStaticHoliday ("01-SEP-2049", "INR"); - - lh.addStaticHoliday ("09-SEP-2049", "INR"); - - lh.addStaticHoliday ("30-SEP-2049", "INR"); - - lh.addStaticHoliday ("06-OCT-2049", "INR"); - - lh.addStaticHoliday ("26-OCT-2049", "INR"); - - lh.addStaticHoliday ("28-OCT-2049", "INR"); - - lh.addStaticHoliday ("09-NOV-2049", "INR"); - - lh.addStaticHoliday ("08-DEC-2049", "INR"); - - lh.addStaticHoliday ("26-JAN-2050", "INR"); - - lh.addStaticHoliday ("09-MAR-2050", "INR"); - - lh.addStaticHoliday ("23-MAR-2050", "INR"); - - lh.addStaticHoliday ("31-MAR-2050", "INR"); - - lh.addStaticHoliday ("01-APR-2050", "INR"); - - lh.addStaticHoliday ("05-APR-2050", "INR"); - - lh.addStaticHoliday ("08-APR-2050", "INR"); - - lh.addStaticHoliday ("14-APR-2050", "INR"); - - lh.addStaticHoliday ("06-MAY-2050", "INR"); - - lh.addStaticHoliday ("22-JUN-2050", "INR"); - - lh.addStaticHoliday ("09-AUG-2050", "INR"); - - lh.addStaticHoliday ("15-AUG-2050", "INR"); - - lh.addStaticHoliday ("29-AUG-2050", "INR"); - - lh.addStaticHoliday ("20-SEP-2050", "INR"); - - lh.addStaticHoliday ("28-SEP-2050", "INR"); - - lh.addStaticHoliday ("30-SEP-2050", "INR"); - - lh.addStaticHoliday ("25-OCT-2050", "INR"); - - lh.addStaticHoliday ("16-NOV-2050", "INR"); - - lh.addStaticHoliday ("28-NOV-2050", "INR"); - - lh.addStaticHoliday ("26-JAN-2051", "INR"); - - lh.addStaticHoliday ("27-MAR-2051", "INR"); - - lh.addStaticHoliday ("31-MAR-2051", "INR"); - - lh.addStaticHoliday ("11-APR-2051", "INR"); - - lh.addStaticHoliday ("14-APR-2051", "INR"); - - lh.addStaticHoliday ("19-APR-2051", "INR"); - - lh.addStaticHoliday ("01-MAY-2051", "INR"); - - lh.addStaticHoliday ("25-MAY-2051", "INR"); - - lh.addStaticHoliday ("09-AUG-2051", "INR"); - - lh.addStaticHoliday ("15-AUG-2051", "INR"); - - lh.addStaticHoliday ("18-AUG-2051", "INR"); - - lh.addStaticHoliday ("02-OCT-2051", "INR"); - - lh.addStaticHoliday ("03-NOV-2051", "INR"); - - lh.addStaticHoliday ("17-NOV-2051", "INR"); - - lh.addStaticHoliday ("25-DEC-2051", "INR"); - - lh.addStaticHoliday ("26-JAN-2052", "INR"); - - lh.addStaticHoliday ("28-FEB-2052", "INR"); - - lh.addStaticHoliday ("15-MAR-2052", "INR"); - - lh.addStaticHoliday ("01-APR-2052", "INR"); - - lh.addStaticHoliday ("11-APR-2052", "INR"); - - lh.addStaticHoliday ("19-APR-2052", "INR"); - - lh.addStaticHoliday ("01-MAY-2052", "INR"); - - lh.addStaticHoliday ("13-MAY-2052", "INR"); - - lh.addStaticHoliday ("30-MAY-2052", "INR"); - - lh.addStaticHoliday ("06-AUG-2052", "INR"); - - lh.addStaticHoliday ("08-AUG-2052", "INR"); - - lh.addStaticHoliday ("15-AUG-2052", "INR"); - - lh.addStaticHoliday ("28-AUG-2052", "INR"); - - lh.addStaticHoliday ("05-SEP-2052", "INR"); - - lh.addStaticHoliday ("30-SEP-2052", "INR"); - - lh.addStaticHoliday ("02-OCT-2052", "INR"); - - lh.addStaticHoliday ("03-OCT-2052", "INR"); - - lh.addStaticHoliday ("22-OCT-2052", "INR"); - - lh.addStaticHoliday ("24-OCT-2052", "INR"); - - lh.addStaticHoliday ("05-NOV-2052", "INR"); - - lh.addStaticHoliday ("06-NOV-2052", "INR"); - - lh.addStaticHoliday ("25-DEC-2052", "INR"); - - lh.addStaticHoliday ("05-MAR-2053", "INR"); - - lh.addStaticHoliday ("21-MAR-2053", "INR"); - - lh.addStaticHoliday ("28-MAR-2053", "INR"); - - lh.addStaticHoliday ("01-APR-2053", "INR"); - - lh.addStaticHoliday ("02-APR-2053", "INR"); - - lh.addStaticHoliday ("04-APR-2053", "INR"); - - lh.addStaticHoliday ("14-APR-2053", "INR"); - - lh.addStaticHoliday ("01-MAY-2053", "INR"); - - lh.addStaticHoliday ("02-MAY-2053", "INR"); - - lh.addStaticHoliday ("20-MAY-2053", "INR"); - - lh.addStaticHoliday ("08-AUG-2053", "INR"); - - lh.addStaticHoliday ("15-AUG-2053", "INR"); - - lh.addStaticHoliday ("25-AUG-2053", "INR"); - - lh.addStaticHoliday ("15-SEP-2053", "INR"); - - lh.addStaticHoliday ("30-SEP-2053", "INR"); - - lh.addStaticHoliday ("02-OCT-2053", "INR"); - - lh.addStaticHoliday ("22-OCT-2053", "INR"); - - lh.addStaticHoliday ("12-NOV-2053", "INR"); - - lh.addStaticHoliday ("25-NOV-2053", "INR"); - - lh.addStaticHoliday ("25-DEC-2053", "INR"); - - lh.addStaticHoliday ("26-JAN-2054", "INR"); - - lh.addStaticHoliday ("24-MAR-2054", "INR"); - - lh.addStaticHoliday ("27-MAR-2054", "INR"); - - lh.addStaticHoliday ("01-APR-2054", "INR"); - - lh.addStaticHoliday ("09-APR-2054", "INR"); - - lh.addStaticHoliday ("14-APR-2054", "INR"); - - lh.addStaticHoliday ("16-APR-2054", "INR"); - - lh.addStaticHoliday ("20-APR-2054", "INR"); - - lh.addStaticHoliday ("01-MAY-2054", "INR"); - - lh.addStaticHoliday ("21-MAY-2054", "INR"); - - lh.addStaticHoliday ("17-JUL-2054", "INR"); - - lh.addStaticHoliday ("30-SEP-2054", "INR"); - - lh.addStaticHoliday ("02-OCT-2054", "INR"); - - lh.addStaticHoliday ("14-OCT-2054", "INR"); - - lh.addStaticHoliday ("30-OCT-2054", "INR"); - - lh.addStaticHoliday ("25-DEC-2054", "INR"); - - lh.addStaticHoliday ("26-JAN-2055", "INR"); - - lh.addStaticHoliday ("24-FEB-2055", "INR"); - - lh.addStaticHoliday ("29-MAR-2055", "INR"); - - lh.addStaticHoliday ("01-APR-2055", "INR"); - - lh.addStaticHoliday ("06-APR-2055", "INR"); - - lh.addStaticHoliday ("14-APR-2055", "INR"); - - lh.addStaticHoliday ("16-APR-2055", "INR"); - - lh.addStaticHoliday ("29-APR-2055", "INR"); - - lh.addStaticHoliday ("11-MAY-2055", "INR"); - - lh.addStaticHoliday ("06-JUL-2055", "INR"); - - lh.addStaticHoliday ("04-AUG-2055", "INR"); - - lh.addStaticHoliday ("25-AUG-2055", "INR"); - - lh.addStaticHoliday ("29-SEP-2055", "INR"); - - lh.addStaticHoliday ("30-SEP-2055", "INR"); - - lh.addStaticHoliday ("04-OCT-2055", "INR"); - - lh.addStaticHoliday ("20-OCT-2055", "INR"); - - lh.addStaticHoliday ("21-OCT-2055", "INR"); - - lh.addStaticHoliday ("04-NOV-2055", "INR"); - - lh.addStaticHoliday ("26-JAN-2056", "INR"); - - lh.addStaticHoliday ("02-MAR-2056", "INR"); - - lh.addStaticHoliday ("17-MAR-2056", "INR"); - - lh.addStaticHoliday ("29-MAR-2056", "INR"); - - lh.addStaticHoliday ("31-MAR-2056", "INR"); - - lh.addStaticHoliday ("14-APR-2056", "INR"); - - lh.addStaticHoliday ("17-APR-2056", "INR"); - - lh.addStaticHoliday ("01-MAY-2056", "INR"); - - lh.addStaticHoliday ("29-MAY-2056", "INR"); - - lh.addStaticHoliday ("24-JUL-2056", "INR"); - - lh.addStaticHoliday ("07-AUG-2056", "INR"); - - lh.addStaticHoliday ("15-AUG-2056", "INR"); - - lh.addStaticHoliday ("13-SEP-2056", "INR"); - - lh.addStaticHoliday ("02-OCT-2056", "INR"); - - lh.addStaticHoliday ("17-OCT-2056", "INR"); - - lh.addStaticHoliday ("07-NOV-2056", "INR"); - - lh.addStaticHoliday ("08-NOV-2056", "INR"); - - lh.addStaticHoliday ("22-NOV-2056", "INR"); - - lh.addStaticHoliday ("25-DEC-2056", "INR"); - - lh.addStaticHoliday ("26-JAN-2057", "INR"); - - lh.addStaticHoliday ("21-MAR-2057", "INR"); - - lh.addStaticHoliday ("02-APR-2057", "INR"); - - lh.addStaticHoliday ("05-APR-2057", "INR"); - - lh.addStaticHoliday ("06-APR-2057", "INR"); - - lh.addStaticHoliday ("13-APR-2057", "INR"); - - lh.addStaticHoliday ("17-APR-2057", "INR"); - - lh.addStaticHoliday ("20-APR-2057", "INR"); - - lh.addStaticHoliday ("01-MAY-2057", "INR"); - - lh.addStaticHoliday ("18-MAY-2057", "INR"); - - lh.addStaticHoliday ("14-JUN-2057", "INR"); - - lh.addStaticHoliday ("13-JUL-2057", "INR"); - - lh.addStaticHoliday ("07-AUG-2057", "INR"); - - lh.addStaticHoliday ("15-AUG-2057", "INR"); - - lh.addStaticHoliday ("12-SEP-2057", "INR"); - - lh.addStaticHoliday ("02-OCT-2057", "INR"); - - lh.addStaticHoliday ("29-OCT-2057", "INR"); - - lh.addStaticHoliday ("25-DEC-2057", "INR"); - - lh.addStaticHoliday ("21-FEB-2058", "INR"); - - lh.addStaticHoliday ("25-MAR-2058", "INR"); - - lh.addStaticHoliday ("26-MAR-2058", "INR"); - - lh.addStaticHoliday ("01-APR-2058", "INR"); - - lh.addStaticHoliday ("02-APR-2058", "INR"); - - lh.addStaticHoliday ("12-APR-2058", "INR"); - - lh.addStaticHoliday ("01-MAY-2058", "INR"); - - lh.addStaticHoliday ("08-MAY-2058", "INR"); - - lh.addStaticHoliday ("03-JUN-2058", "INR"); - - lh.addStaticHoliday ("02-JUL-2058", "INR"); - - lh.addStaticHoliday ("07-AUG-2058", "INR"); - - lh.addStaticHoliday ("15-AUG-2058", "INR"); - - lh.addStaticHoliday ("23-AUG-2058", "INR"); - - lh.addStaticHoliday ("30-SEP-2058", "INR"); - - lh.addStaticHoliday ("02-OCT-2058", "INR"); - - lh.addStaticHoliday ("15-NOV-2058", "INR"); - - lh.addStaticHoliday ("25-DEC-2058", "INR"); - - lh.addStaticHoliday ("12-MAR-2059", "INR"); - - lh.addStaticHoliday ("28-MAR-2059", "INR"); - - lh.addStaticHoliday ("01-APR-2059", "INR"); - - lh.addStaticHoliday ("14-APR-2059", "INR"); - - lh.addStaticHoliday ("21-APR-2059", "INR"); - - lh.addStaticHoliday ("25-APR-2059", "INR"); - - lh.addStaticHoliday ("01-MAY-2059", "INR"); - - lh.addStaticHoliday ("23-MAY-2059", "INR"); - - lh.addStaticHoliday ("27-MAY-2059", "INR"); - - lh.addStaticHoliday ("07-AUG-2059", "INR"); - - lh.addStaticHoliday ("15-AUG-2059", "INR"); - - lh.addStaticHoliday ("21-AUG-2059", "INR"); - - lh.addStaticHoliday ("11-SEP-2059", "INR"); - - lh.addStaticHoliday ("30-SEP-2059", "INR"); - - lh.addStaticHoliday ("02-OCT-2059", "INR"); - - lh.addStaticHoliday ("16-OCT-2059", "INR"); - - lh.addStaticHoliday ("04-NOV-2059", "INR"); - - lh.addStaticHoliday ("07-NOV-2059", "INR"); - - lh.addStaticHoliday ("19-NOV-2059", "INR"); - - lh.addStaticHoliday ("25-DEC-2059", "INR"); - - lh.addStaticHoliday ("26-JAN-2060", "INR"); - - lh.addStaticHoliday ("01-MAR-2060", "INR"); - - lh.addStaticHoliday ("05-MAR-2060", "INR"); - - lh.addStaticHoliday ("17-MAR-2060", "INR"); - - lh.addStaticHoliday ("01-APR-2060", "INR"); - - lh.addStaticHoliday ("02-APR-2060", "INR"); - - lh.addStaticHoliday ("09-APR-2060", "INR"); - - lh.addStaticHoliday ("13-APR-2060", "INR"); - - lh.addStaticHoliday ("14-APR-2060", "INR"); - - lh.addStaticHoliday ("16-APR-2060", "INR"); - - lh.addStaticHoliday ("11-MAY-2060", "INR"); - - lh.addStaticHoliday ("10-JUN-2060", "INR"); - - lh.addStaticHoliday ("06-AUG-2060", "INR"); - - lh.addStaticHoliday ("10-AUG-2060", "INR"); - - lh.addStaticHoliday ("30-SEP-2060", "INR"); - - lh.addStaticHoliday ("05-OCT-2060", "INR"); - - lh.addStaticHoliday ("26-OCT-2060", "INR"); - - lh.addStaticHoliday ("08-NOV-2060", "INR"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/IPCHoliday.java b/org/drip/analytics/holset/IPCHoliday.java deleted file mode 100644 index d73f799..0000000 --- a/org/drip/analytics/holset/IPCHoliday.java +++ /dev/null @@ -1,709 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class IPCHoliday implements org.drip.analytics.holset.LocationHoliday { - public IPCHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "IPC"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("25-DEC-2005", ""); - - lh.addStaticHoliday ("01-JAN-2006", ""); - - lh.addStaticHoliday ("27-FEB-2006", ""); - - lh.addStaticHoliday ("28-FEB-2006", ""); - - lh.addStaticHoliday ("14-APR-2006", ""); - - lh.addStaticHoliday ("21-APR-2006", ""); - - lh.addStaticHoliday ("01-MAY-2006", ""); - - lh.addStaticHoliday ("15-JUN-2006", ""); - - lh.addStaticHoliday ("07-SEP-2006", ""); - - lh.addStaticHoliday ("12-OCT-2006", ""); - - lh.addStaticHoliday ("02-NOV-2006", ""); - - lh.addStaticHoliday ("15-NOV-2006", ""); - - lh.addStaticHoliday ("25-DEC-2006", ""); - - lh.addStaticHoliday ("01-JAN-2007", ""); - - lh.addStaticHoliday ("19-FEB-2007", ""); - - lh.addStaticHoliday ("20-FEB-2007", ""); - - lh.addStaticHoliday ("06-APR-2007", ""); - - lh.addStaticHoliday ("21-APR-2007", ""); - - lh.addStaticHoliday ("01-MAY-2007", ""); - - lh.addStaticHoliday ("07-JUN-2007", ""); - - lh.addStaticHoliday ("07-SEP-2007", ""); - - lh.addStaticHoliday ("12-OCT-2007", ""); - - lh.addStaticHoliday ("02-NOV-2007", ""); - - lh.addStaticHoliday ("15-NOV-2007", ""); - - lh.addStaticHoliday ("25-DEC-2007", ""); - - lh.addStaticHoliday ("01-JAN-2008", ""); - - lh.addStaticHoliday ("04-FEB-2008", ""); - - lh.addStaticHoliday ("05-FEB-2008", ""); - - lh.addStaticHoliday ("21-MAR-2008", ""); - - lh.addStaticHoliday ("21-APR-2008", ""); - - lh.addStaticHoliday ("01-MAY-2008", ""); - - lh.addStaticHoliday ("22-MAY-2008", ""); - - lh.addStaticHoliday ("07-SEP-2008", ""); - - lh.addStaticHoliday ("12-OCT-2008", ""); - - lh.addStaticHoliday ("02-NOV-2008", ""); - - lh.addStaticHoliday ("15-NOV-2008", ""); - - lh.addStaticHoliday ("25-DEC-2008", ""); - - lh.addStaticHoliday ("01-JAN-2009", ""); - - lh.addStaticHoliday ("23-FEB-2009", ""); - - lh.addStaticHoliday ("24-FEB-2009", ""); - - lh.addStaticHoliday ("10-APR-2009", ""); - - lh.addStaticHoliday ("21-APR-2009", ""); - - lh.addStaticHoliday ("01-MAY-2009", ""); - - lh.addStaticHoliday ("11-JUN-2009", ""); - - lh.addStaticHoliday ("07-SEP-2009", ""); - - lh.addStaticHoliday ("12-OCT-2009", ""); - - lh.addStaticHoliday ("02-NOV-2009", ""); - - lh.addStaticHoliday ("15-NOV-2009", ""); - - lh.addStaticHoliday ("25-DEC-2009", ""); - - lh.addStaticHoliday ("01-JAN-2010", ""); - - lh.addStaticHoliday ("15-FEB-2010", ""); - - lh.addStaticHoliday ("16-FEB-2010", ""); - - lh.addStaticHoliday ("02-APR-2010", ""); - - lh.addStaticHoliday ("21-APR-2010", ""); - - lh.addStaticHoliday ("01-MAY-2010", ""); - - lh.addStaticHoliday ("03-JUN-2010", ""); - - lh.addStaticHoliday ("07-SEP-2010", ""); - - lh.addStaticHoliday ("12-OCT-2010", ""); - - lh.addStaticHoliday ("02-NOV-2010", ""); - - lh.addStaticHoliday ("15-NOV-2010", ""); - - lh.addStaticHoliday ("25-DEC-2010", ""); - - lh.addStaticHoliday ("01-JAN-2011", ""); - - lh.addStaticHoliday ("07-MAR-2011", ""); - - lh.addStaticHoliday ("08-MAR-2011", ""); - - lh.addStaticHoliday ("21-APR-2011", ""); - - lh.addStaticHoliday ("22-APR-2011", ""); - - lh.addStaticHoliday ("01-MAY-2011", ""); - - lh.addStaticHoliday ("23-JUN-2011", ""); - - lh.addStaticHoliday ("07-SEP-2011", ""); - - lh.addStaticHoliday ("12-OCT-2011", ""); - - lh.addStaticHoliday ("02-NOV-2011", ""); - - lh.addStaticHoliday ("15-NOV-2011", ""); - - lh.addStaticHoliday ("25-DEC-2011", ""); - - lh.addStaticHoliday ("01-JAN-2012", ""); - - lh.addStaticHoliday ("20-FEB-2012", ""); - - lh.addStaticHoliday ("21-FEB-2012", ""); - - lh.addStaticHoliday ("06-APR-2012", ""); - - lh.addStaticHoliday ("21-APR-2012", ""); - - lh.addStaticHoliday ("01-MAY-2012", ""); - - lh.addStaticHoliday ("07-JUN-2012", ""); - - lh.addStaticHoliday ("07-SEP-2012", ""); - - lh.addStaticHoliday ("12-OCT-2012", ""); - - lh.addStaticHoliday ("02-NOV-2012", ""); - - lh.addStaticHoliday ("15-NOV-2012", ""); - - lh.addStaticHoliday ("25-DEC-2012", ""); - - lh.addStaticHoliday ("01-JAN-2013", ""); - - lh.addStaticHoliday ("11-FEB-2013", ""); - - lh.addStaticHoliday ("12-FEB-2013", ""); - - lh.addStaticHoliday ("29-MAR-2013", ""); - - lh.addStaticHoliday ("21-APR-2013", ""); - - lh.addStaticHoliday ("01-MAY-2013", ""); - - lh.addStaticHoliday ("30-MAY-2013", ""); - - lh.addStaticHoliday ("07-SEP-2013", ""); - - lh.addStaticHoliday ("12-OCT-2013", ""); - - lh.addStaticHoliday ("02-NOV-2013", ""); - - lh.addStaticHoliday ("15-NOV-2013", ""); - - lh.addStaticHoliday ("25-DEC-2013", ""); - - lh.addStaticHoliday ("01-JAN-2014", ""); - - lh.addStaticHoliday ("03-MAR-2014", ""); - - lh.addStaticHoliday ("04-MAR-2014", ""); - - lh.addStaticHoliday ("18-APR-2014", ""); - - lh.addStaticHoliday ("21-APR-2014", ""); - - lh.addStaticHoliday ("01-MAY-2014", ""); - - lh.addStaticHoliday ("19-JUN-2014", ""); - - lh.addStaticHoliday ("07-SEP-2014", ""); - - lh.addStaticHoliday ("12-OCT-2014", ""); - - lh.addStaticHoliday ("02-NOV-2014", ""); - - lh.addStaticHoliday ("15-NOV-2014", ""); - - lh.addStaticHoliday ("25-DEC-2014", ""); - - lh.addStaticHoliday ("01-JAN-2015", ""); - - lh.addStaticHoliday ("16-FEB-2015", ""); - - lh.addStaticHoliday ("17-FEB-2015", ""); - - lh.addStaticHoliday ("03-APR-2015", ""); - - lh.addStaticHoliday ("21-APR-2015", ""); - - lh.addStaticHoliday ("01-MAY-2015", ""); - - lh.addStaticHoliday ("04-JUN-2015", ""); - - lh.addStaticHoliday ("07-SEP-2015", ""); - - lh.addStaticHoliday ("12-OCT-2015", ""); - - lh.addStaticHoliday ("02-NOV-2015", ""); - - lh.addStaticHoliday ("15-NOV-2015", ""); - - lh.addStaticHoliday ("25-DEC-2015", ""); - - lh.addStaticHoliday ("01-JAN-2016", ""); - - lh.addStaticHoliday ("08-FEB-2016", ""); - - lh.addStaticHoliday ("09-FEB-2016", ""); - - lh.addStaticHoliday ("25-MAR-2016", ""); - - lh.addStaticHoliday ("21-APR-2016", ""); - - lh.addStaticHoliday ("01-MAY-2016", ""); - - lh.addStaticHoliday ("26-MAY-2016", ""); - - lh.addStaticHoliday ("07-SEP-2016", ""); - - lh.addStaticHoliday ("12-OCT-2016", ""); - - lh.addStaticHoliday ("02-NOV-2016", ""); - - lh.addStaticHoliday ("15-NOV-2016", ""); - - lh.addStaticHoliday ("25-DEC-2016", ""); - - lh.addStaticHoliday ("01-JAN-2017", ""); - - lh.addStaticHoliday ("27-FEB-2017", ""); - - lh.addStaticHoliday ("28-FEB-2017", ""); - - lh.addStaticHoliday ("14-APR-2017", ""); - - lh.addStaticHoliday ("21-APR-2017", ""); - - lh.addStaticHoliday ("01-MAY-2017", ""); - - lh.addStaticHoliday ("15-JUN-2017", ""); - - lh.addStaticHoliday ("07-SEP-2017", ""); - - lh.addStaticHoliday ("12-OCT-2017", ""); - - lh.addStaticHoliday ("02-NOV-2017", ""); - - lh.addStaticHoliday ("15-NOV-2017", ""); - - lh.addStaticHoliday ("25-DEC-2017", ""); - - lh.addStaticHoliday ("01-JAN-2018", ""); - - lh.addStaticHoliday ("12-FEB-2018", ""); - - lh.addStaticHoliday ("13-FEB-2018", ""); - - lh.addStaticHoliday ("30-MAR-2018", ""); - - lh.addStaticHoliday ("21-APR-2018", ""); - - lh.addStaticHoliday ("01-MAY-2018", ""); - - lh.addStaticHoliday ("31-MAY-2018", ""); - - lh.addStaticHoliday ("07-SEP-2018", ""); - - lh.addStaticHoliday ("12-OCT-2018", ""); - - lh.addStaticHoliday ("02-NOV-2018", ""); - - lh.addStaticHoliday ("15-NOV-2018", ""); - - lh.addStaticHoliday ("25-DEC-2018", ""); - - lh.addStaticHoliday ("01-JAN-2019", ""); - - lh.addStaticHoliday ("04-MAR-2019", ""); - - lh.addStaticHoliday ("05-MAR-2019", ""); - - lh.addStaticHoliday ("19-APR-2019", ""); - - lh.addStaticHoliday ("21-APR-2019", ""); - - lh.addStaticHoliday ("01-MAY-2019", ""); - - lh.addStaticHoliday ("20-JUN-2019", ""); - - lh.addStaticHoliday ("07-SEP-2019", ""); - - lh.addStaticHoliday ("12-OCT-2019", ""); - - lh.addStaticHoliday ("02-NOV-2019", ""); - - lh.addStaticHoliday ("15-NOV-2019", ""); - - lh.addStaticHoliday ("25-DEC-2019", ""); - - lh.addStaticHoliday ("01-JAN-2020", ""); - - lh.addStaticHoliday ("24-FEB-2020", ""); - - lh.addStaticHoliday ("25-FEB-2020", ""); - - lh.addStaticHoliday ("10-APR-2020", ""); - - lh.addStaticHoliday ("21-APR-2020", ""); - - lh.addStaticHoliday ("01-MAY-2020", ""); - - lh.addStaticHoliday ("11-JUN-2020", ""); - - lh.addStaticHoliday ("07-SEP-2020", ""); - - lh.addStaticHoliday ("12-OCT-2020", ""); - - lh.addStaticHoliday ("02-NOV-2020", ""); - - lh.addStaticHoliday ("15-NOV-2020", ""); - - lh.addStaticHoliday ("25-DEC-2020", ""); - - lh.addStaticHoliday ("01-JAN-2021", ""); - - lh.addStaticHoliday ("15-FEB-2021", ""); - - lh.addStaticHoliday ("16-FEB-2021", ""); - - lh.addStaticHoliday ("02-APR-2021", ""); - - lh.addStaticHoliday ("21-APR-2021", ""); - - lh.addStaticHoliday ("01-MAY-2021", ""); - - lh.addStaticHoliday ("03-JUN-2021", ""); - - lh.addStaticHoliday ("07-SEP-2021", ""); - - lh.addStaticHoliday ("12-OCT-2021", ""); - - lh.addStaticHoliday ("02-NOV-2021", ""); - - lh.addStaticHoliday ("15-NOV-2021", ""); - - lh.addStaticHoliday ("25-DEC-2021", ""); - - lh.addStaticHoliday ("01-JAN-2022", ""); - - lh.addStaticHoliday ("28-FEB-2022", ""); - - lh.addStaticHoliday ("01-MAR-2022", ""); - - lh.addStaticHoliday ("15-APR-2022", ""); - - lh.addStaticHoliday ("21-APR-2022", ""); - - lh.addStaticHoliday ("01-MAY-2022", ""); - - lh.addStaticHoliday ("16-JUN-2022", ""); - - lh.addStaticHoliday ("07-SEP-2022", ""); - - lh.addStaticHoliday ("12-OCT-2022", ""); - - lh.addStaticHoliday ("02-NOV-2022", ""); - - lh.addStaticHoliday ("15-NOV-2022", ""); - - lh.addStaticHoliday ("25-DEC-2022", ""); - - lh.addStaticHoliday ("01-JAN-2023", ""); - - lh.addStaticHoliday ("20-FEB-2023", ""); - - lh.addStaticHoliday ("21-FEB-2023", ""); - - lh.addStaticHoliday ("07-APR-2023", ""); - - lh.addStaticHoliday ("21-APR-2023", ""); - - lh.addStaticHoliday ("01-MAY-2023", ""); - - lh.addStaticHoliday ("08-JUN-2023", ""); - - lh.addStaticHoliday ("07-SEP-2023", ""); - - lh.addStaticHoliday ("12-OCT-2023", ""); - - lh.addStaticHoliday ("02-NOV-2023", ""); - - lh.addStaticHoliday ("15-NOV-2023", ""); - - lh.addStaticHoliday ("25-DEC-2023", ""); - - lh.addStaticHoliday ("01-JAN-2024", ""); - - lh.addStaticHoliday ("12-FEB-2024", ""); - - lh.addStaticHoliday ("13-FEB-2024", ""); - - lh.addStaticHoliday ("29-MAR-2024", ""); - - lh.addStaticHoliday ("21-APR-2024", ""); - - lh.addStaticHoliday ("01-MAY-2024", ""); - - lh.addStaticHoliday ("30-MAY-2024", ""); - - lh.addStaticHoliday ("07-SEP-2024", ""); - - lh.addStaticHoliday ("12-OCT-2024", ""); - - lh.addStaticHoliday ("02-NOV-2024", ""); - - lh.addStaticHoliday ("15-NOV-2024", ""); - - lh.addStaticHoliday ("25-DEC-2024", ""); - - lh.addStaticHoliday ("01-JAN-2025", ""); - - lh.addStaticHoliday ("03-MAR-2025", ""); - - lh.addStaticHoliday ("04-MAR-2025", ""); - - lh.addStaticHoliday ("18-APR-2025", ""); - - lh.addStaticHoliday ("21-APR-2025", ""); - - lh.addStaticHoliday ("01-MAY-2025", ""); - - lh.addStaticHoliday ("19-JUN-2025", ""); - - lh.addStaticHoliday ("07-SEP-2025", ""); - - lh.addStaticHoliday ("12-OCT-2025", ""); - - lh.addStaticHoliday ("02-NOV-2025", ""); - - lh.addStaticHoliday ("15-NOV-2025", ""); - - lh.addStaticHoliday ("25-DEC-2025", ""); - - lh.addStaticHoliday ("01-JAN-2026", ""); - - lh.addStaticHoliday ("16-FEB-2026", ""); - - lh.addStaticHoliday ("17-FEB-2026", ""); - - lh.addStaticHoliday ("03-APR-2026", ""); - - lh.addStaticHoliday ("21-APR-2026", ""); - - lh.addStaticHoliday ("01-MAY-2026", ""); - - lh.addStaticHoliday ("04-JUN-2026", ""); - - lh.addStaticHoliday ("07-SEP-2026", ""); - - lh.addStaticHoliday ("12-OCT-2026", ""); - - lh.addStaticHoliday ("02-NOV-2026", ""); - - lh.addStaticHoliday ("15-NOV-2026", ""); - - lh.addStaticHoliday ("25-DEC-2026", ""); - - lh.addStaticHoliday ("01-JAN-2027", ""); - - lh.addStaticHoliday ("08-FEB-2027", ""); - - lh.addStaticHoliday ("09-FEB-2027", ""); - - lh.addStaticHoliday ("26-MAR-2027", ""); - - lh.addStaticHoliday ("21-APR-2027", ""); - - lh.addStaticHoliday ("01-MAY-2027", ""); - - lh.addStaticHoliday ("27-MAY-2027", ""); - - lh.addStaticHoliday ("07-SEP-2027", ""); - - lh.addStaticHoliday ("12-OCT-2027", ""); - - lh.addStaticHoliday ("02-NOV-2027", ""); - - lh.addStaticHoliday ("15-NOV-2027", ""); - - lh.addStaticHoliday ("25-DEC-2027", ""); - - lh.addStaticHoliday ("01-JAN-2028", ""); - - lh.addStaticHoliday ("28-FEB-2028", ""); - - lh.addStaticHoliday ("29-FEB-2028", ""); - - lh.addStaticHoliday ("14-APR-2028", ""); - - lh.addStaticHoliday ("21-APR-2028", ""); - - lh.addStaticHoliday ("01-MAY-2028", ""); - - lh.addStaticHoliday ("15-JUN-2028", ""); - - lh.addStaticHoliday ("07-SEP-2028", ""); - - lh.addStaticHoliday ("12-OCT-2028", ""); - - lh.addStaticHoliday ("02-NOV-2028", ""); - - lh.addStaticHoliday ("15-NOV-2028", ""); - - lh.addStaticHoliday ("25-DEC-2028", ""); - - lh.addStaticHoliday ("01-JAN-2029", ""); - - lh.addStaticHoliday ("12-FEB-2029", ""); - - lh.addStaticHoliday ("13-FEB-2029", ""); - - lh.addStaticHoliday ("30-MAR-2029", ""); - - lh.addStaticHoliday ("21-APR-2029", ""); - - lh.addStaticHoliday ("01-MAY-2029", ""); - - lh.addStaticHoliday ("31-MAY-2029", ""); - - lh.addStaticHoliday ("07-SEP-2029", ""); - - lh.addStaticHoliday ("12-OCT-2029", ""); - - lh.addStaticHoliday ("02-NOV-2029", ""); - - lh.addStaticHoliday ("15-NOV-2029", ""); - - lh.addStaticHoliday ("25-DEC-2029", ""); - - lh.addStaticHoliday ("01-JAN-2030", ""); - - lh.addStaticHoliday ("04-MAR-2030", ""); - - lh.addStaticHoliday ("05-MAR-2030", ""); - - lh.addStaticHoliday ("19-APR-2030", ""); - - lh.addStaticHoliday ("21-APR-2030", ""); - - lh.addStaticHoliday ("01-MAY-2030", ""); - - lh.addStaticHoliday ("20-JUN-2030", ""); - - lh.addStaticHoliday ("07-SEP-2030", ""); - - lh.addStaticHoliday ("12-OCT-2030", ""); - - lh.addStaticHoliday ("02-NOV-2030", ""); - - lh.addStaticHoliday ("15-NOV-2030", ""); - - lh.addStaticHoliday ("25-DEC-2030", ""); - - lh.addStaticHoliday ("01-JAN-2031", ""); - - lh.addStaticHoliday ("24-FEB-2031", ""); - - lh.addStaticHoliday ("25-FEB-2031", ""); - - lh.addStaticHoliday ("11-APR-2031", ""); - - lh.addStaticHoliday ("21-APR-2031", ""); - - lh.addStaticHoliday ("01-MAY-2031", ""); - - lh.addStaticHoliday ("12-JUN-2031", ""); - - lh.addStaticHoliday ("07-SEP-2031", ""); - - lh.addStaticHoliday ("12-OCT-2031", ""); - - lh.addStaticHoliday ("02-NOV-2031", ""); - - lh.addStaticHoliday ("15-NOV-2031", ""); - - lh.addStaticHoliday ("25-DEC-2031", ""); - - lh.addStaticHoliday ("01-JAN-2032", ""); - - lh.addStaticHoliday ("09-FEB-2032", ""); - - lh.addStaticHoliday ("10-FEB-2032", ""); - - lh.addStaticHoliday ("26-MAR-2032", ""); - - lh.addStaticHoliday ("21-APR-2032", ""); - - lh.addStaticHoliday ("01-MAY-2032", ""); - - lh.addStaticHoliday ("27-MAY-2032", ""); - - lh.addStaticHoliday ("07-SEP-2032", ""); - - lh.addStaticHoliday ("12-OCT-2032", ""); - - lh.addStaticHoliday ("02-NOV-2032", ""); - - lh.addStaticHoliday ("15-NOV-2032", ""); - - lh.addStaticHoliday ("25-DEC-2032", ""); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/ITLHoliday.java b/org/drip/analytics/holset/ITLHoliday.java deleted file mode 100644 index ac75b69..0000000 --- a/org/drip/analytics/holset/ITLHoliday.java +++ /dev/null @@ -1,515 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class ITLHoliday implements org.drip.analytics.holset.LocationHoliday { - public ITLHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "ITL"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1998", "Epiphany"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("08-DEC-1998", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1999", "Epiphany"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-1999", "Immaculate Conception"); - - lh.addStaticHoliday ("06-JAN-2000", "Epiphany"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2000", "Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2000", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2000", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2001", "Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2001", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2002", "Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2002", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2003", "Epiphany"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2003", "Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2003", "Assumption Day"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2004", "Epiphany"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2004", "Immaculate Conception"); - - lh.addStaticHoliday ("06-JAN-2005", "Epiphany"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2005", "Liberation Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2005", "Immaculate Conception"); - - lh.addStaticHoliday ("26-DEC-2005", "St. Stephens Day"); - - lh.addStaticHoliday ("06-JAN-2006", "Epiphany"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2006", "Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2006", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2006", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2007", "Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2007", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2008", "Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2008", "Assumption Day"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2009", "Epiphany"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("08-DEC-2009", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2010", "Epiphany"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("01-NOV-2010", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2010", "Immaculate Conception"); - - lh.addStaticHoliday ("06-JAN-2011", "Epiphany"); - - lh.addStaticHoliday ("25-APR-2011", "Liberation Day"); - - lh.addStaticHoliday ("15-AUG-2011", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2011", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2011", "Immaculate Conception"); - - lh.addStaticHoliday ("26-DEC-2011", "St. Stephens Day"); - - lh.addStaticHoliday ("06-JAN-2012", "Epiphany"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2012", "Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2012", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2012", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2013", "Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2013", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2013", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2014", "Epiphany"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2014", "Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2014", "Assumption Day"); - - lh.addStaticHoliday ("08-DEC-2014", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2015", "Epiphany"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("08-DEC-2015", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2016", "Epiphany"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2016", "Liberation Day"); - - lh.addStaticHoliday ("15-AUG-2016", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2016", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2016", "Immaculate Conception"); - - lh.addStaticHoliday ("26-DEC-2016", "St. Stephens Day"); - - lh.addStaticHoliday ("06-JAN-2017", "Epiphany"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2017", "Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2017", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2017", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2017", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2018", "Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2018", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2018", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2019", "Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2019", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2019", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2020", "Epiphany"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("08-DEC-2020", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2021", "Epiphany"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("01-NOV-2021", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2021", "Immaculate Conception"); - - lh.addStaticHoliday ("06-JAN-2022", "Epiphany"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2022", "Liberation Day"); - - lh.addStaticHoliday ("15-AUG-2022", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2022", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2022", "Immaculate Conception"); - - lh.addStaticHoliday ("26-DEC-2022", "St. Stephens Day"); - - lh.addStaticHoliday ("06-JAN-2023", "Epiphany"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2023", "Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2023", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2023", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2023", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2024", "Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2024", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2024", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2025", "Epiphany"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2025", "Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2025", "Assumption Day"); - - lh.addStaticHoliday ("08-DEC-2025", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2026", "Epiphany"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("08-DEC-2026", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2027", "Epiphany"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("01-NOV-2027", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2027", "Immaculate Conception"); - - lh.addStaticHoliday ("06-JAN-2028", "Epiphany"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2028", "Liberation Day"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2028", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2028", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2028", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "St. Stephens Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/JMDHoliday.java b/org/drip/analytics/holset/JMDHoliday.java deleted file mode 100644 index b1756c0..0000000 --- a/org/drip/analytics/holset/JMDHoliday.java +++ /dev/null @@ -1,601 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class JMDHoliday implements org.drip.analytics.holset.LocationHoliday { - public JMDHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "JMD"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("25-FEB-1998", "Ash Wednesday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("25-MAY-1998", "Labour Day Observed"); - - lh.addStaticHoliday ("06-AUG-1998", "Independence Day"); - - lh.addStaticHoliday ("19-OCT-1998", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("17-FEB-1999", "Ash Wednesday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("24-MAY-1999", "Labour Day Observed"); - - lh.addStaticHoliday ("06-AUG-1999", "Independence Day"); - - lh.addStaticHoliday ("18-OCT-1999", "Heroes Day"); - - lh.addStaticHoliday ("08-MAR-2000", "Ash Wednesday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("23-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("01-AUG-2000", "Emancipation Day"); - - lh.addStaticHoliday ("16-OCT-2000", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("28-FEB-2001", "Ash Wednesday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("23-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("01-AUG-2001", "Emancipation Day"); - - lh.addStaticHoliday ("06-AUG-2001", "Independence Day"); - - lh.addStaticHoliday ("15-OCT-2001", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("13-FEB-2002", "Ash Wednesday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("23-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("01-AUG-2002", "Emancipation Day"); - - lh.addStaticHoliday ("06-AUG-2002", "Independence Day"); - - lh.addStaticHoliday ("21-OCT-2002", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("05-MAR-2003", "Ash Wednesday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("23-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("01-AUG-2003", "Emancipation Day"); - - lh.addStaticHoliday ("06-AUG-2003", "Independence Day"); - - lh.addStaticHoliday ("20-OCT-2003", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("25-FEB-2004", "Ash Wednesday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("24-MAY-2004", "Labour Day Observed"); - - lh.addStaticHoliday ("06-AUG-2004", "Independence Day"); - - lh.addStaticHoliday ("18-OCT-2004", "Heroes Day"); - - lh.addStaticHoliday ("09-FEB-2005", "Ash Wednesday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("23-MAY-2005", "Labour Day"); - - lh.addStaticHoliday ("01-AUG-2005", "Emancipation Day"); - - lh.addStaticHoliday ("17-OCT-2005", "Heroes Day"); - - lh.addStaticHoliday ("26-DEC-2005", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2005", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("01-MAR-2006", "Ash Wednesday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("23-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("01-AUG-2006", "Emancipation Day"); - - lh.addStaticHoliday ("16-OCT-2006", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("21-FEB-2007", "Ash Wednesday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("23-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("01-AUG-2007", "Emancipation Day"); - - lh.addStaticHoliday ("06-AUG-2007", "Independence Day"); - - lh.addStaticHoliday ("15-OCT-2007", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("06-FEB-2008", "Ash Wednesday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("23-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("01-AUG-2008", "Emancipation Day"); - - lh.addStaticHoliday ("06-AUG-2008", "Independence Day"); - - lh.addStaticHoliday ("20-OCT-2008", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("25-FEB-2009", "Ash Wednesday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("25-MAY-2009", "Labour Day Observed"); - - lh.addStaticHoliday ("06-AUG-2009", "Independence Day"); - - lh.addStaticHoliday ("19-OCT-2009", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("17-FEB-2010", "Ash Wednesday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("24-MAY-2010", "Labour Day Observed"); - - lh.addStaticHoliday ("06-AUG-2010", "Independence Day"); - - lh.addStaticHoliday ("18-OCT-2010", "Heroes Day"); - - lh.addStaticHoliday ("09-MAR-2011", "Ash Wednesday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("23-MAY-2011", "Labour Day"); - - lh.addStaticHoliday ("01-AUG-2011", "Emancipation Day"); - - lh.addStaticHoliday ("17-OCT-2011", "Heroes Day"); - - lh.addStaticHoliday ("26-DEC-2011", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2011", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("22-FEB-2012", "Ash Wednesday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("23-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("01-AUG-2012", "Emancipation Day"); - - lh.addStaticHoliday ("06-AUG-2012", "Independence Day"); - - lh.addStaticHoliday ("15-OCT-2012", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("13-FEB-2013", "Ash Wednesday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("23-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("01-AUG-2013", "Emancipation Day"); - - lh.addStaticHoliday ("06-AUG-2013", "Independence Day"); - - lh.addStaticHoliday ("21-OCT-2013", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("05-MAR-2014", "Ash Wednesday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("23-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("01-AUG-2014", "Emancipation Day"); - - lh.addStaticHoliday ("06-AUG-2014", "Independence Day"); - - lh.addStaticHoliday ("20-OCT-2014", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("18-FEB-2015", "Ash Wednesday"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("25-MAY-2015", "Labour Day Observed"); - - lh.addStaticHoliday ("06-AUG-2015", "Independence Day"); - - lh.addStaticHoliday ("19-OCT-2015", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("10-FEB-2016", "Ash Wednesday"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("23-MAY-2016", "Labour Day"); - - lh.addStaticHoliday ("01-AUG-2016", "Emancipation Day"); - - lh.addStaticHoliday ("17-OCT-2016", "Heroes Day"); - - lh.addStaticHoliday ("26-DEC-2016", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2016", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("01-MAR-2017", "Ash Wednesday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("23-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("01-AUG-2017", "Emancipation Day"); - - lh.addStaticHoliday ("16-OCT-2017", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("14-FEB-2018", "Ash Wednesday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("23-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("01-AUG-2018", "Emancipation Day"); - - lh.addStaticHoliday ("06-AUG-2018", "Independence Day"); - - lh.addStaticHoliday ("15-OCT-2018", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("06-MAR-2019", "Ash Wednesday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("23-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("01-AUG-2019", "Emancipation Day"); - - lh.addStaticHoliday ("06-AUG-2019", "Independence Day"); - - lh.addStaticHoliday ("21-OCT-2019", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("26-FEB-2020", "Ash Wednesday"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("25-MAY-2020", "Labour Day Observed"); - - lh.addStaticHoliday ("06-AUG-2020", "Independence Day"); - - lh.addStaticHoliday ("19-OCT-2020", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("17-FEB-2021", "Ash Wednesday"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("24-MAY-2021", "Labour Day Observed"); - - lh.addStaticHoliday ("06-AUG-2021", "Independence Day"); - - lh.addStaticHoliday ("18-OCT-2021", "Heroes Day"); - - lh.addStaticHoliday ("02-MAR-2022", "Ash Wednesday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("23-MAY-2022", "Labour Day"); - - lh.addStaticHoliday ("01-AUG-2022", "Emancipation Day"); - - lh.addStaticHoliday ("17-OCT-2022", "Heroes Day"); - - lh.addStaticHoliday ("26-DEC-2022", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2022", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("22-FEB-2023", "Ash Wednesday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("23-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("01-AUG-2023", "Emancipation Day"); - - lh.addStaticHoliday ("16-OCT-2023", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("14-FEB-2024", "Ash Wednesday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("23-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("01-AUG-2024", "Emancipation Day"); - - lh.addStaticHoliday ("06-AUG-2024", "Independence Day"); - - lh.addStaticHoliday ("21-OCT-2024", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("05-MAR-2025", "Ash Wednesday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("23-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("01-AUG-2025", "Emancipation Day"); - - lh.addStaticHoliday ("06-AUG-2025", "Independence Day"); - - lh.addStaticHoliday ("20-OCT-2025", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("18-FEB-2026", "Ash Wednesday"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("25-MAY-2026", "Labour Day Observed"); - - lh.addStaticHoliday ("06-AUG-2026", "Independence Day"); - - lh.addStaticHoliday ("19-OCT-2026", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("10-FEB-2027", "Ash Wednesday"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("24-MAY-2027", "Labour Day Observed"); - - lh.addStaticHoliday ("06-AUG-2027", "Independence Day"); - - lh.addStaticHoliday ("18-OCT-2027", "Heroes Day"); - - lh.addStaticHoliday ("01-MAR-2028", "Ash Wednesday"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("23-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("01-AUG-2028", "Emancipation Day"); - - lh.addStaticHoliday ("16-OCT-2028", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Boxing Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/JPYHoliday.java b/org/drip/analytics/holset/JPYHoliday.java deleted file mode 100644 index 7143651..0000000 --- a/org/drip/analytics/holset/JPYHoliday.java +++ /dev/null @@ -1,2047 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class JPYHoliday implements org.drip.analytics.holset.LocationHoliday { - public JPYHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "JPY"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("15-JAN-1999", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-1999", "National Foundation Day"); - - lh.addStaticHoliday ("22-MAR-1999", "Vernal Equinox Day Observed"); - - lh.addStaticHoliday ("29-APR-1999", "Greenery Day"); - - lh.addStaticHoliday ("03-MAY-1999", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-1999", "National Holiday"); - - lh.addStaticHoliday ("05-MAY-1999", "Childrens Day"); - - lh.addStaticHoliday ("20-JUL-1999", "Ocean Day"); - - lh.addStaticHoliday ("15-SEP-1999", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-1999", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("11-OCT-1999", "Sports Day Observed"); - - lh.addStaticHoliday ("03-NOV-1999", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-1999", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-1999", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-1999", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2000", "Bank Holiday"); - - lh.addStaticHoliday ("10-JAN-2000", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2000", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2000", "Vernal Equinox Day"); - - lh.addStaticHoliday ("03-MAY-2000", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2000", "National Holiday"); - - lh.addStaticHoliday ("05-MAY-2000", "Childrens Day"); - - lh.addStaticHoliday ("20-JUL-2000", "Ocean Day"); - - lh.addStaticHoliday ("15-SEP-2000", "Respect for the Aged Day"); - - lh.addStaticHoliday ("09-OCT-2000", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2000", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2000", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2001", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2001", "Bank Holiday"); - - lh.addStaticHoliday ("08-JAN-2001", "Adults Day"); - - lh.addStaticHoliday ("12-FEB-2001", "National Foundation Day Observed"); - - lh.addStaticHoliday ("20-MAR-2001", "Vernal Equinox Day"); - - lh.addStaticHoliday ("30-APR-2001", "Greenery Day Observed"); - - lh.addStaticHoliday ("03-MAY-2001", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2001", "National Holiday"); - - lh.addStaticHoliday ("20-JUL-2001", "Ocean Day"); - - lh.addStaticHoliday ("24-SEP-2001", "Autumnal Equinox Day Observed"); - - lh.addStaticHoliday ("08-OCT-2001", "Sports Day"); - - lh.addStaticHoliday ("23-NOV-2001", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("24-DEC-2001", "Emperors Birthday Observed"); - - lh.addStaticHoliday ("31-DEC-2001", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2002", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2002", "Bank Holiday"); - - lh.addStaticHoliday ("14-JAN-2002", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2002", "National Foundation Day"); - - lh.addStaticHoliday ("21-MAR-2002", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2002", "Greenery Day"); - - lh.addStaticHoliday ("03-MAY-2002", "Constitution Memorial Day"); - - lh.addStaticHoliday ("06-MAY-2002", "Childrens Day Observed"); - - lh.addStaticHoliday ("16-SEP-2002", "Respect for the Aged Day Observed"); - - lh.addStaticHoliday ("23-SEP-2002", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("14-OCT-2002", "Sports Day"); - - lh.addStaticHoliday ("04-NOV-2002", "Culture Day Observed"); - - lh.addStaticHoliday ("23-DEC-2002", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2002", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2003", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2003", "Bank Holiday"); - - lh.addStaticHoliday ("13-JAN-2003", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2003", "National Foundation Day"); - - lh.addStaticHoliday ("21-MAR-2003", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2003", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2003", "Childrens Day"); - - lh.addStaticHoliday ("21-JUL-2003", "Ocean Day"); - - lh.addStaticHoliday ("15-SEP-2003", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2003", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("13-OCT-2003", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2003", "Culture Day"); - - lh.addStaticHoliday ("24-NOV-2003", "Labour Thanksgiving Day Observed"); - - lh.addStaticHoliday ("23-DEC-2003", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2003", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("03-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2004", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2004", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2004", "Spring Day"); - - lh.addStaticHoliday ("29-APR-2004", "Greenery Day"); - - lh.addStaticHoliday ("03-MAY-2004", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2004", "National Holiday"); - - lh.addStaticHoliday ("05-MAY-2004", "Childrens Day"); - - lh.addStaticHoliday ("19-JUL-2004", "Ocean Day"); - - lh.addStaticHoliday ("20-SEP-2004", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2004", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("11-OCT-2004", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2004", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2004", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2004", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2004", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2005", "Bank Holiday"); - - lh.addStaticHoliday ("10-JAN-2005", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2005", "National Foundation Day"); - - lh.addStaticHoliday ("21-MAR-2005", "Vernal Equinox Day Observed"); - - lh.addStaticHoliday ("29-APR-2005", "Greenery Day"); - - lh.addStaticHoliday ("03-MAY-2005", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2005", "National Holiday"); - - lh.addStaticHoliday ("05-MAY-2005", "Childrens Day"); - - lh.addStaticHoliday ("18-JUL-2005", "Ocean Day"); - - lh.addStaticHoliday ("19-SEP-2005", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2005", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("10-OCT-2005", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2005", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2005", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2005", "Emperors Birthday"); - - lh.addStaticHoliday ("02-JAN-2006", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2006", "Bank Holiday"); - - lh.addStaticHoliday ("09-JAN-2006", "Adults Day"); - - lh.addStaticHoliday ("21-MAR-2006", "Vernal Equinox Day"); - - lh.addStaticHoliday ("03-MAY-2006", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2006", "National Holiday"); - - lh.addStaticHoliday ("05-MAY-2006", "Childrens Day"); - - lh.addStaticHoliday ("17-JUL-2006", "Ocean Day"); - - lh.addStaticHoliday ("18-SEP-2006", "Respect for the Aged Day"); - - lh.addStaticHoliday ("09-OCT-2006", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2006", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2006", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2007", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2007", "Bank Holiday"); - - lh.addStaticHoliday ("08-JAN-2007", "Adults Day"); - - lh.addStaticHoliday ("12-FEB-2007", "National Foundation Day Observed"); - - lh.addStaticHoliday ("21-MAR-2007", "Vernal Equinox Day"); - - lh.addStaticHoliday ("30-APR-2007", "Showa Day Observed"); - - lh.addStaticHoliday ("03-MAY-2007", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2007", "Greenery Day"); - - lh.addStaticHoliday ("16-JUL-2007", "Ocean Day"); - - lh.addStaticHoliday ("17-SEP-2007", "Respect for the Aged Day"); - - lh.addStaticHoliday ("24-SEP-2007", "Autumnal Equinox Day Observed"); - - lh.addStaticHoliday ("08-OCT-2007", "Sports Day"); - - lh.addStaticHoliday ("23-NOV-2007", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("24-DEC-2007", "Emperors Birthday Observed"); - - lh.addStaticHoliday ("31-DEC-2007", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2008", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2008", "Bank Holiday"); - - lh.addStaticHoliday ("14-JAN-2008", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2008", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2008", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2008", "Showa Day"); - - lh.addStaticHoliday ("05-MAY-2008", "Childrens Day"); - - lh.addStaticHoliday ("06-MAY-2008", "Greenery Day Observed"); - - lh.addStaticHoliday ("21-JUL-2008", "Ocean Day"); - - lh.addStaticHoliday ("15-SEP-2008", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2008", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("13-OCT-2008", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2008", "Culture Day"); - - lh.addStaticHoliday ("24-NOV-2008", "Labour Thanksgiving Day Observed"); - - lh.addStaticHoliday ("23-DEC-2008", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2008", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2009", "Bank Holiday"); - - lh.addStaticHoliday ("12-JAN-2009", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2009", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2009", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2009", "Showa Day"); - - lh.addStaticHoliday ("04-MAY-2009", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2009", "Childrens Day"); - - lh.addStaticHoliday ("06-MAY-2009", "Constitution Memorial Day Observed"); - - lh.addStaticHoliday ("20-JUL-2009", "Ocean Day"); - - lh.addStaticHoliday ("21-SEP-2009", "Respect for the Aged Day"); - - lh.addStaticHoliday ("22-SEP-2009", "National Holiday"); - - lh.addStaticHoliday ("23-SEP-2009", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("12-OCT-2009", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2009", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2009", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2009", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2009", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2010", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2010", "National Foundation Day"); - - lh.addStaticHoliday ("22-MAR-2010", "Vernal Equinox Day Observed"); - - lh.addStaticHoliday ("29-APR-2010", "Showa Day"); - - lh.addStaticHoliday ("03-MAY-2010", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2010", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2010", "Childrens Day"); - - lh.addStaticHoliday ("19-JUL-2010", "Ocean Day"); - - lh.addStaticHoliday ("20-SEP-2010", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2010", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("11-OCT-2010", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2010", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2010", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2010", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2010", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2011", "Bank Holiday"); - - lh.addStaticHoliday ("10-JAN-2011", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2011", "National Foundation Day"); - - lh.addStaticHoliday ("21-MAR-2011", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2011", "Showa Day"); - - lh.addStaticHoliday ("03-MAY-2011", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2011", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2011", "Childrens Day"); - - lh.addStaticHoliday ("18-JUL-2011", "Ocean Day"); - - lh.addStaticHoliday ("19-SEP-2011", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2011", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("10-OCT-2011", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2011", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2011", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2011", "Emperors Birthday"); - - lh.addStaticHoliday ("02-JAN-2012", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2012", "Bank Holiday"); - - lh.addStaticHoliday ("09-JAN-2012", "Adults Day"); - - lh.addStaticHoliday ("20-MAR-2012", "Vernal Equinox Day"); - - lh.addStaticHoliday ("30-APR-2012", "Showa Day Observed"); - - lh.addStaticHoliday ("03-MAY-2012", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2012", "Greenery Day"); - - lh.addStaticHoliday ("16-JUL-2012", "Ocean Day"); - - lh.addStaticHoliday ("17-SEP-2012", "Respect for the Aged Day"); - - lh.addStaticHoliday ("08-OCT-2012", "Sports Day"); - - lh.addStaticHoliday ("23-NOV-2012", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("24-DEC-2012", "Emperors Birthday Observed"); - - lh.addStaticHoliday ("31-DEC-2012", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2013", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2013", "Bank Holiday"); - - lh.addStaticHoliday ("14-JAN-2013", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2013", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2013", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2013", "Showa Day"); - - lh.addStaticHoliday ("03-MAY-2013", "Constitution Memorial Day"); - - lh.addStaticHoliday ("06-MAY-2013", "Childrens Day Observed"); - - lh.addStaticHoliday ("15-JUL-2013", "Ocean Day"); - - lh.addStaticHoliday ("16-SEP-2013", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2013", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("14-OCT-2013", "Sports Day"); - - lh.addStaticHoliday ("04-NOV-2013", "Culture Day Observed"); - - lh.addStaticHoliday ("23-DEC-2013", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2013", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2014", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2014", "Bank Holiday"); - - lh.addStaticHoliday ("13-JAN-2014", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2014", "National Foundation Day"); - - lh.addStaticHoliday ("21-MAR-2014", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2014", "Showa Day"); - - lh.addStaticHoliday ("05-MAY-2014", "Childrens Day"); - - lh.addStaticHoliday ("06-MAY-2014", "Greenery Day Observed"); - - lh.addStaticHoliday ("21-JUL-2014", "Ocean Day"); - - lh.addStaticHoliday ("15-SEP-2014", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2014", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("13-OCT-2014", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2014", "Culture Day"); - - lh.addStaticHoliday ("24-NOV-2014", "Labour Thanksgiving Day Observed"); - - lh.addStaticHoliday ("23-DEC-2014", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2014", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2015", "Bank Holiday"); - - lh.addStaticHoliday ("12-JAN-2015", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2015", "National Foundation Day"); - - lh.addStaticHoliday ("29-APR-2015", "Showa Day"); - - lh.addStaticHoliday ("04-MAY-2015", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2015", "Childrens Day"); - - lh.addStaticHoliday ("06-MAY-2015", "Constitution Memorial Day Observed"); - - lh.addStaticHoliday ("20-JUL-2015", "Ocean Day"); - - lh.addStaticHoliday ("21-SEP-2015", "Respect for the Aged Day"); - - lh.addStaticHoliday ("22-SEP-2015", "National Holiday"); - - lh.addStaticHoliday ("23-SEP-2015", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("12-OCT-2015", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2015", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2015", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2015", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2015", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2016", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2016", "National Foundation Day"); - - lh.addStaticHoliday ("21-MAR-2016", "Vernal Equinox Day Observed"); - - lh.addStaticHoliday ("29-APR-2016", "Showa Day"); - - lh.addStaticHoliday ("03-MAY-2016", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2016", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2016", "Childrens Day"); - - lh.addStaticHoliday ("18-JUL-2016", "Ocean Day"); - - lh.addStaticHoliday ("19-SEP-2016", "Respect for the Aged Day"); - - lh.addStaticHoliday ("22-SEP-2016", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("10-OCT-2016", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2016", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2016", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2016", "Emperors Birthday"); - - lh.addStaticHoliday ("02-JAN-2017", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2017", "Bank Holiday"); - - lh.addStaticHoliday ("09-JAN-2017", "Adults Day"); - - lh.addStaticHoliday ("20-MAR-2017", "Vernal Equinox Day"); - - lh.addStaticHoliday ("03-MAY-2017", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2017", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2017", "Childrens Day"); - - lh.addStaticHoliday ("17-JUL-2017", "Ocean Day"); - - lh.addStaticHoliday ("18-SEP-2017", "Respect for the Aged Day"); - - lh.addStaticHoliday ("09-OCT-2017", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2017", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2017", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2018", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2018", "Bank Holiday"); - - lh.addStaticHoliday ("08-JAN-2018", "Adults Day"); - - lh.addStaticHoliday ("12-FEB-2018", "National Foundation Day Observed"); - - lh.addStaticHoliday ("21-MAR-2018", "Vernal Equinox Day"); - - lh.addStaticHoliday ("30-APR-2018", "Showa Day Observed"); - - lh.addStaticHoliday ("03-MAY-2018", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2018", "Greenery Day"); - - lh.addStaticHoliday ("16-JUL-2018", "Ocean Day"); - - lh.addStaticHoliday ("17-SEP-2018", "Respect for the Aged Day"); - - lh.addStaticHoliday ("24-SEP-2018", "Autumnal Equinox Day Observed"); - - lh.addStaticHoliday ("08-OCT-2018", "Sports Day"); - - lh.addStaticHoliday ("23-NOV-2018", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("24-DEC-2018", "Emperors Birthday Observed"); - - lh.addStaticHoliday ("31-DEC-2018", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2019", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2019", "Bank Holiday"); - - lh.addStaticHoliday ("14-JAN-2019", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2019", "National Foundation Day"); - - lh.addStaticHoliday ("21-MAR-2019", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2019", "Showa Day"); - - lh.addStaticHoliday ("03-MAY-2019", "Constitution Memorial Day"); - - lh.addStaticHoliday ("06-MAY-2019", "Childrens Day Observed"); - - lh.addStaticHoliday ("15-JUL-2019", "Ocean Day"); - - lh.addStaticHoliday ("16-SEP-2019", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2019", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("14-OCT-2019", "Sports Day"); - - lh.addStaticHoliday ("04-NOV-2019", "Culture Day Observed"); - - lh.addStaticHoliday ("23-DEC-2019", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2019", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2020", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2020", "Bank Holiday"); - - lh.addStaticHoliday ("13-JAN-2020", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2020", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2020", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2020", "Showa Day"); - - lh.addStaticHoliday ("04-MAY-2020", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2020", "Childrens Day"); - - lh.addStaticHoliday ("06-MAY-2020", "Constitution Memorial Day Observed"); - - lh.addStaticHoliday ("20-JUL-2020", "Ocean Day"); - - lh.addStaticHoliday ("21-SEP-2020", "Respect for the Aged Day"); - - lh.addStaticHoliday ("22-SEP-2020", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("12-OCT-2020", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2020", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2020", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2020", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2020", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2021", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2021", "National Foundation Day"); - - lh.addStaticHoliday ("29-APR-2021", "Showa Day"); - - lh.addStaticHoliday ("03-MAY-2021", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2021", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2021", "Childrens Day"); - - lh.addStaticHoliday ("19-JUL-2021", "Ocean Day"); - - lh.addStaticHoliday ("20-SEP-2021", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2021", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("11-OCT-2021", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2021", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2021", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2021", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2021", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2022", "Bank Holiday"); - - lh.addStaticHoliday ("10-JAN-2022", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2022", "National Foundation Day"); - - lh.addStaticHoliday ("21-MAR-2022", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2022", "Showa Day"); - - lh.addStaticHoliday ("03-MAY-2022", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2022", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2022", "Childrens Day"); - - lh.addStaticHoliday ("18-JUL-2022", "Ocean Day"); - - lh.addStaticHoliday ("19-SEP-2022", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2022", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("10-OCT-2022", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2022", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2022", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2022", "Emperors Birthday"); - - lh.addStaticHoliday ("02-JAN-2023", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2023", "Bank Holiday"); - - lh.addStaticHoliday ("09-JAN-2023", "Adults Day"); - - lh.addStaticHoliday ("21-MAR-2023", "Vernal Equinox Day"); - - lh.addStaticHoliday ("03-MAY-2023", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2023", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2023", "Childrens Day"); - - lh.addStaticHoliday ("17-JUL-2023", "Ocean Day"); - - lh.addStaticHoliday ("18-SEP-2023", "Respect for the Aged Day"); - - lh.addStaticHoliday ("09-OCT-2023", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2023", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2023", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2024", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2024", "Bank Holiday"); - - lh.addStaticHoliday ("08-JAN-2024", "Adults Day"); - - lh.addStaticHoliday ("12-FEB-2024", "National Foundation Day Observed"); - - lh.addStaticHoliday ("20-MAR-2024", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2024", "Showa Day"); - - lh.addStaticHoliday ("03-MAY-2024", "Constitution Memorial Day"); - - lh.addStaticHoliday ("06-MAY-2024", "Childrens Day Observed"); - - lh.addStaticHoliday ("15-JUL-2024", "Ocean Day"); - - lh.addStaticHoliday ("16-SEP-2024", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2024", "Autumnal Equinox Day Observed"); - - lh.addStaticHoliday ("14-OCT-2024", "Sports Day"); - - lh.addStaticHoliday ("04-NOV-2024", "Culture Day Observed"); - - lh.addStaticHoliday ("23-DEC-2024", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2024", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2025", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2025", "Bank Holiday"); - - lh.addStaticHoliday ("13-JAN-2025", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2025", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2025", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2025", "Showa Day"); - - lh.addStaticHoliday ("05-MAY-2025", "Childrens Day"); - - lh.addStaticHoliday ("06-MAY-2025", "Greenery Day Observed"); - - lh.addStaticHoliday ("21-JUL-2025", "Ocean Day"); - - lh.addStaticHoliday ("15-SEP-2025", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2025", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("13-OCT-2025", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2025", "Culture Day"); - - lh.addStaticHoliday ("24-NOV-2025", "Labour Thanksgiving Day Observed"); - - lh.addStaticHoliday ("23-DEC-2025", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2025", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2026", "Bank Holiday"); - - lh.addStaticHoliday ("12-JAN-2026", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2026", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2026", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2026", "Showa Day"); - - lh.addStaticHoliday ("04-MAY-2026", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2026", "Childrens Day"); - - lh.addStaticHoliday ("06-MAY-2026", "Constitution Memorial Day Observed"); - - lh.addStaticHoliday ("20-JUL-2026", "Ocean Day"); - - lh.addStaticHoliday ("21-SEP-2026", "Respect for the Aged Day"); - - lh.addStaticHoliday ("22-SEP-2026", "National Holiday"); - - lh.addStaticHoliday ("23-SEP-2026", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("12-OCT-2026", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2026", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2026", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2026", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2026", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2027", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2027", "National Foundation Day"); - - lh.addStaticHoliday ("22-MAR-2027", "Vernal Equinox Day Observed"); - - lh.addStaticHoliday ("29-APR-2027", "Showa Day"); - - lh.addStaticHoliday ("03-MAY-2027", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2027", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2027", "Childrens Day"); - - lh.addStaticHoliday ("19-JUL-2027", "Ocean Day"); - - lh.addStaticHoliday ("20-SEP-2027", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2027", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("11-OCT-2027", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2027", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2027", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2027", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2027", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2028", "Bank Holiday"); - - lh.addStaticHoliday ("10-JAN-2028", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2028", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2028", "Vernal Equinox Day"); - - lh.addStaticHoliday ("03-MAY-2028", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2028", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2028", "Childrens Day"); - - lh.addStaticHoliday ("17-JUL-2028", "Ocean Day"); - - lh.addStaticHoliday ("18-SEP-2028", "Respect for the Aged Day"); - - lh.addStaticHoliday ("22-SEP-2028", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("09-OCT-2028", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2028", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2028", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("01-JAN-2029", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2029", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2029", "Bank Holiday"); - - lh.addStaticHoliday ("08-JAN-2029", "Adults Day"); - - lh.addStaticHoliday ("12-FEB-2029", "National Foundation Day Observed"); - - lh.addStaticHoliday ("20-MAR-2029", "Vernal Equinox Day"); - - lh.addStaticHoliday ("30-APR-2029", "Showa Day Observed"); - - lh.addStaticHoliday ("03-MAY-2029", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2029", "Greenery Day"); - - lh.addStaticHoliday ("16-JUL-2029", "Ocean Day"); - - lh.addStaticHoliday ("17-SEP-2029", "Respect for the Aged Day"); - - lh.addStaticHoliday ("24-SEP-2029", "Autumnal Equinox Day Observed"); - - lh.addStaticHoliday ("08-OCT-2029", "Sports Day"); - - lh.addStaticHoliday ("23-NOV-2029", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("24-DEC-2029", "Emperors Birthday Observed"); - - lh.addStaticHoliday ("31-DEC-2029", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2030", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2030", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2030", "Bank Holiday"); - - lh.addStaticHoliday ("14-JAN-2030", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2030", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2030", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2030", "Showa Day"); - - lh.addStaticHoliday ("03-MAY-2030", "Constitution Memorial Day"); - - lh.addStaticHoliday ("06-MAY-2030", "Childrens Day Observed"); - - lh.addStaticHoliday ("15-JUL-2030", "Ocean Day"); - - lh.addStaticHoliday ("16-SEP-2030", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2030", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("14-OCT-2030", "Sports Day"); - - lh.addStaticHoliday ("04-NOV-2030", "Culture Day Observed"); - - lh.addStaticHoliday ("23-DEC-2030", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2030", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2031", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2031", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2031", "Bank Holiday"); - - lh.addStaticHoliday ("13-JAN-2031", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2031", "National Foundation Day"); - - lh.addStaticHoliday ("21-MAR-2031", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2031", "Showa Day"); - - lh.addStaticHoliday ("05-MAY-2031", "Childrens Day"); - - lh.addStaticHoliday ("06-MAY-2031", "Greenery Day Observed"); - - lh.addStaticHoliday ("21-JUL-2031", "Ocean Day"); - - lh.addStaticHoliday ("15-SEP-2031", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2031", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("13-OCT-2031", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2031", "Culture Day"); - - lh.addStaticHoliday ("24-NOV-2031", "Labour Thanksgiving Day Observed"); - - lh.addStaticHoliday ("23-DEC-2031", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2031", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2032", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2032", "Bank Holiday"); - - lh.addStaticHoliday ("12-JAN-2032", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2032", "National Foundation Day"); - - lh.addStaticHoliday ("29-APR-2032", "Showa Day"); - - lh.addStaticHoliday ("03-MAY-2032", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2032", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2032", "Childrens Day"); - - lh.addStaticHoliday ("19-JUL-2032", "Ocean Day"); - - lh.addStaticHoliday ("20-SEP-2032", "Respect for the Aged Day"); - - lh.addStaticHoliday ("21-SEP-2032", "National Holiday"); - - lh.addStaticHoliday ("22-SEP-2032", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("11-OCT-2032", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2032", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2032", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2032", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2032", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2033", "Bank Holiday"); - - lh.addStaticHoliday ("10-JAN-2033", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2033", "National Foundation Day"); - - lh.addStaticHoliday ("21-MAR-2033", "Vernal Equinox Day Observed"); - - lh.addStaticHoliday ("29-APR-2033", "Showa Day"); - - lh.addStaticHoliday ("03-MAY-2033", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2033", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2033", "Childrens Day"); - - lh.addStaticHoliday ("18-JUL-2033", "Ocean Day"); - - lh.addStaticHoliday ("19-SEP-2033", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2033", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("10-OCT-2033", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2033", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2033", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2033", "Emperors Birthday"); - - lh.addStaticHoliday ("02-JAN-2034", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2034", "Bank Holiday"); - - lh.addStaticHoliday ("09-JAN-2034", "Adults Day"); - - lh.addStaticHoliday ("20-MAR-2034", "Vernal Equinox Day"); - - lh.addStaticHoliday ("03-MAY-2034", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2034", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2034", "Childrens Day"); - - lh.addStaticHoliday ("17-JUL-2034", "Ocean Day"); - - lh.addStaticHoliday ("18-SEP-2034", "Respect for the Aged Day"); - - lh.addStaticHoliday ("09-OCT-2034", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2034", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2034", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("01-JAN-2035", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2035", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2035", "Bank Holiday"); - - lh.addStaticHoliday ("08-JAN-2035", "Adults Day"); - - lh.addStaticHoliday ("12-FEB-2035", "National Foundation Day Observed"); - - lh.addStaticHoliday ("21-MAR-2035", "Vernal Equinox Day"); - - lh.addStaticHoliday ("30-APR-2035", "Showa Day Observed"); - - lh.addStaticHoliday ("03-MAY-2035", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2035", "Greenery Day"); - - lh.addStaticHoliday ("16-JUL-2035", "Ocean Day"); - - lh.addStaticHoliday ("17-SEP-2035", "Respect for the Aged Day"); - - lh.addStaticHoliday ("24-SEP-2035", "Autumnal Equinox Day Observed"); - - lh.addStaticHoliday ("08-OCT-2035", "Sports Day"); - - lh.addStaticHoliday ("23-NOV-2035", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("24-DEC-2035", "Emperors Birthday Observed"); - - lh.addStaticHoliday ("31-DEC-2035", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2036", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2036", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2036", "Bank Holiday"); - - lh.addStaticHoliday ("14-JAN-2036", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2036", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2036", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2036", "Showa Day"); - - lh.addStaticHoliday ("05-MAY-2036", "Childrens Day"); - - lh.addStaticHoliday ("06-MAY-2036", "Greenery Day Observed"); - - lh.addStaticHoliday ("21-JUL-2036", "Ocean Day"); - - lh.addStaticHoliday ("15-SEP-2036", "Respect for the Aged Day"); - - lh.addStaticHoliday ("22-SEP-2036", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("13-OCT-2036", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2036", "Culture Day"); - - lh.addStaticHoliday ("24-NOV-2036", "Labour Thanksgiving Day Observed"); - - lh.addStaticHoliday ("23-DEC-2036", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2036", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2037", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2037", "Bank Holiday"); - - lh.addStaticHoliday ("12-JAN-2037", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2037", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2037", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2037", "Showa Day"); - - lh.addStaticHoliday ("04-MAY-2037", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2037", "Childrens Day"); - - lh.addStaticHoliday ("06-MAY-2037", "Constitution Memorial Day Observed"); - - lh.addStaticHoliday ("20-JUL-2037", "Ocean Day"); - - lh.addStaticHoliday ("21-SEP-2037", "Respect for the Aged Day"); - - lh.addStaticHoliday ("22-SEP-2037", "National Holiday"); - - lh.addStaticHoliday ("23-SEP-2037", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("12-OCT-2037", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2037", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2037", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2037", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2037", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2038", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2038", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2038", "National Foundation Day"); - - lh.addStaticHoliday ("29-APR-2038", "Showa Day"); - - lh.addStaticHoliday ("03-MAY-2038", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2038", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2038", "Childrens Day"); - - lh.addStaticHoliday ("19-JUL-2038", "Ocean Day"); - - lh.addStaticHoliday ("20-SEP-2038", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2038", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("11-OCT-2038", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2038", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2038", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2038", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2038", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2039", "Bank Holiday"); - - lh.addStaticHoliday ("10-JAN-2039", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2039", "National Foundation Day"); - - lh.addStaticHoliday ("21-MAR-2039", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2039", "Showa Day"); - - lh.addStaticHoliday ("03-MAY-2039", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2039", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2039", "Childrens Day"); - - lh.addStaticHoliday ("18-JUL-2039", "Ocean Day"); - - lh.addStaticHoliday ("19-SEP-2039", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2039", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("10-OCT-2039", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2039", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2039", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2039", "Emperors Birthday"); - - lh.addStaticHoliday ("02-JAN-2040", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2040", "Bank Holiday"); - - lh.addStaticHoliday ("09-JAN-2040", "Adults Day"); - - lh.addStaticHoliday ("20-MAR-2040", "Vernal Equinox Day"); - - lh.addStaticHoliday ("30-APR-2040", "Showa Day Observed"); - - lh.addStaticHoliday ("03-MAY-2040", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2040", "Greenery Day"); - - lh.addStaticHoliday ("16-JUL-2040", "Ocean Day"); - - lh.addStaticHoliday ("17-SEP-2040", "Respect for the Aged Day"); - - lh.addStaticHoliday ("24-SEP-2040", "Autumnal Equinox Day Observed"); - - lh.addStaticHoliday ("08-OCT-2040", "Sports Day"); - - lh.addStaticHoliday ("23-NOV-2040", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("24-DEC-2040", "Emperors Birthday Observed"); - - lh.addStaticHoliday ("31-DEC-2040", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2041", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2041", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2041", "Bank Holiday"); - - lh.addStaticHoliday ("14-JAN-2041", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2041", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2041", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2041", "Showa Day"); - - lh.addStaticHoliday ("03-MAY-2041", "Constitution Memorial Day"); - - lh.addStaticHoliday ("06-MAY-2041", "Childrens Day Observed"); - - lh.addStaticHoliday ("15-JUL-2041", "Ocean Day"); - - lh.addStaticHoliday ("16-SEP-2041", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2041", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("14-OCT-2041", "Sports Day"); - - lh.addStaticHoliday ("04-NOV-2041", "Culture Day Observed"); - - lh.addStaticHoliday ("23-DEC-2041", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2041", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2042", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2042", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2042", "Bank Holiday"); - - lh.addStaticHoliday ("13-JAN-2042", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2042", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2042", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2042", "Showa Day"); - - lh.addStaticHoliday ("05-MAY-2042", "Childrens Day"); - - lh.addStaticHoliday ("06-MAY-2042", "Greenery Day Observed"); - - lh.addStaticHoliday ("21-JUL-2042", "Ocean Day"); - - lh.addStaticHoliday ("15-SEP-2042", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2042", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("13-OCT-2042", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2042", "Culture Day"); - - lh.addStaticHoliday ("24-NOV-2042", "Labour Thanksgiving Day Observed"); - - lh.addStaticHoliday ("23-DEC-2042", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2042", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2043", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2043", "Bank Holiday"); - - lh.addStaticHoliday ("12-JAN-2043", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2043", "National Foundation Day"); - - lh.addStaticHoliday ("29-APR-2043", "Showa Day"); - - lh.addStaticHoliday ("04-MAY-2043", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2043", "Childrens Day"); - - lh.addStaticHoliday ("06-MAY-2043", "Constitution Memorial Day Observed"); - - lh.addStaticHoliday ("20-JUL-2043", "Ocean Day"); - - lh.addStaticHoliday ("21-SEP-2043", "Respect for the Aged Day"); - - lh.addStaticHoliday ("22-SEP-2043", "National Holiday"); - - lh.addStaticHoliday ("23-SEP-2043", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("12-OCT-2043", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2043", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2043", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2043", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2043", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2044", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2044", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2044", "National Foundation Day"); - - lh.addStaticHoliday ("21-MAR-2044", "Vernal Equinox Day Observed"); - - lh.addStaticHoliday ("29-APR-2044", "Showa Day"); - - lh.addStaticHoliday ("03-MAY-2044", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2044", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2044", "Childrens Day"); - - lh.addStaticHoliday ("18-JUL-2044", "Ocean Day"); - - lh.addStaticHoliday ("19-SEP-2044", "Respect for the Aged Day"); - - lh.addStaticHoliday ("22-SEP-2044", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("10-OCT-2044", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2044", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2044", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2044", "Emperors Birthday"); - - lh.addStaticHoliday ("02-JAN-2045", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2045", "Bank Holiday"); - - lh.addStaticHoliday ("09-JAN-2045", "Adults Day"); - - lh.addStaticHoliday ("20-MAR-2045", "Vernal Equinox Day"); - - lh.addStaticHoliday ("03-MAY-2045", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2045", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2045", "Childrens Day"); - - lh.addStaticHoliday ("17-JUL-2045", "Ocean Day"); - - lh.addStaticHoliday ("18-SEP-2045", "Respect for the Aged Day"); - - lh.addStaticHoliday ("22-SEP-2045", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("09-OCT-2045", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2045", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2045", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("01-JAN-2046", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2046", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2046", "Bank Holiday"); - - lh.addStaticHoliday ("08-JAN-2046", "Adults Day"); - - lh.addStaticHoliday ("12-FEB-2046", "National Foundation Day Observed"); - - lh.addStaticHoliday ("20-MAR-2046", "Vernal Equinox Day"); - - lh.addStaticHoliday ("30-APR-2046", "Showa Day Observed"); - - lh.addStaticHoliday ("03-MAY-2046", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2046", "Greenery Day"); - - lh.addStaticHoliday ("16-JUL-2046", "Ocean Day"); - - lh.addStaticHoliday ("17-SEP-2046", "Respect for the Aged Day"); - - lh.addStaticHoliday ("24-SEP-2046", "Autumnal Equinox Day Observed"); - - lh.addStaticHoliday ("08-OCT-2046", "Sports Day"); - - lh.addStaticHoliday ("23-NOV-2046", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("24-DEC-2046", "Emperors Birthday Observed"); - - lh.addStaticHoliday ("31-DEC-2046", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2047", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2047", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2047", "Bank Holiday"); - - lh.addStaticHoliday ("14-JAN-2047", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2047", "National Foundation Day"); - - lh.addStaticHoliday ("21-MAR-2047", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2047", "Showa Day"); - - lh.addStaticHoliday ("03-MAY-2047", "Constitution Memorial Day"); - - lh.addStaticHoliday ("06-MAY-2047", "Childrens Day Observed"); - - lh.addStaticHoliday ("15-JUL-2047", "Ocean Day"); - - lh.addStaticHoliday ("16-SEP-2047", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2047", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("14-OCT-2047", "Sports Day"); - - lh.addStaticHoliday ("04-NOV-2047", "Culture Day Observed"); - - lh.addStaticHoliday ("23-DEC-2047", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2047", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2048", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2048", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2048", "Bank Holiday"); - - lh.addStaticHoliday ("13-JAN-2048", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2048", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2048", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2048", "Showa Day"); - - lh.addStaticHoliday ("04-MAY-2048", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2048", "Childrens Day"); - - lh.addStaticHoliday ("06-MAY-2048", "Constitution Memorial Day Observed"); - - lh.addStaticHoliday ("20-JUL-2048", "Ocean Day"); - - lh.addStaticHoliday ("21-SEP-2048", "Respect for the Aged Day"); - - lh.addStaticHoliday ("22-SEP-2048", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("12-OCT-2048", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2048", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2048", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2048", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2048", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2049", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2049", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2049", "National Foundation Day"); - - lh.addStaticHoliday ("29-APR-2049", "Showa Day"); - - lh.addStaticHoliday ("03-MAY-2049", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2049", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2049", "Childrens Day"); - - lh.addStaticHoliday ("19-JUL-2049", "Ocean Day"); - - lh.addStaticHoliday ("20-SEP-2049", "Respect for the Aged Day"); - - lh.addStaticHoliday ("21-SEP-2049", "National Holiday"); - - lh.addStaticHoliday ("22-SEP-2049", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("11-OCT-2049", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2049", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2049", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2049", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2049", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2050", "Bank Holiday"); - - lh.addStaticHoliday ("10-JAN-2050", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2050", "National Foundation Day"); - - lh.addStaticHoliday ("21-MAR-2050", "Vernal Equinox Day Observed"); - - lh.addStaticHoliday ("29-APR-2050", "Showa Day"); - - lh.addStaticHoliday ("03-MAY-2050", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2050", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2050", "Childrens Day"); - - lh.addStaticHoliday ("18-JUL-2050", "Ocean Day"); - - lh.addStaticHoliday ("19-SEP-2050", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2050", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("10-OCT-2050", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2050", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2050", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2050", "Emperors Birthday"); - - lh.addStaticHoliday ("02-JAN-2051", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2051", "Bank Holiday"); - - lh.addStaticHoliday ("09-JAN-2051", "Adults Day"); - - lh.addStaticHoliday ("21-MAR-2051", "Vernal Equinox Day"); - - lh.addStaticHoliday ("03-MAY-2051", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2051", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2051", "Childrens Day"); - - lh.addStaticHoliday ("17-JUL-2051", "Ocean Day"); - - lh.addStaticHoliday ("18-SEP-2051", "Respect for the Aged Day"); - - lh.addStaticHoliday ("09-OCT-2051", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2051", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2051", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("01-JAN-2052", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2052", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2052", "Bank Holiday"); - - lh.addStaticHoliday ("08-JAN-2052", "Adults Day"); - - lh.addStaticHoliday ("12-FEB-2052", "National Foundation Day Observed"); - - lh.addStaticHoliday ("20-MAR-2052", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2052", "Showa Day"); - - lh.addStaticHoliday ("03-MAY-2052", "Constitution Memorial Day"); - - lh.addStaticHoliday ("06-MAY-2052", "Childrens Day Observed"); - - lh.addStaticHoliday ("15-JUL-2052", "Ocean Day"); - - lh.addStaticHoliday ("16-SEP-2052", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2052", "Autumnal Equinox Day Observed"); - - lh.addStaticHoliday ("14-OCT-2052", "Sports Day"); - - lh.addStaticHoliday ("04-NOV-2052", "Culture Day Observed"); - - lh.addStaticHoliday ("23-DEC-2052", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2052", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2053", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2053", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2053", "Bank Holiday"); - - lh.addStaticHoliday ("13-JAN-2053", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2053", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2053", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2053", "Showa Day"); - - lh.addStaticHoliday ("05-MAY-2053", "Childrens Day"); - - lh.addStaticHoliday ("06-MAY-2053", "Greenery Day Observed"); - - lh.addStaticHoliday ("21-JUL-2053", "Ocean Day"); - - lh.addStaticHoliday ("15-SEP-2053", "Respect for the Aged Day"); - - lh.addStaticHoliday ("22-SEP-2053", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("13-OCT-2053", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2053", "Culture Day"); - - lh.addStaticHoliday ("24-NOV-2053", "Labour Thanksgiving Day Observed"); - - lh.addStaticHoliday ("23-DEC-2053", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2053", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2054", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2054", "Bank Holiday"); - - lh.addStaticHoliday ("12-JAN-2054", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2054", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2054", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2054", "Showa Day"); - - lh.addStaticHoliday ("04-MAY-2054", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2054", "Childrens Day"); - - lh.addStaticHoliday ("06-MAY-2054", "Constitution Memorial Day Observed"); - - lh.addStaticHoliday ("20-JUL-2054", "Ocean Day"); - - lh.addStaticHoliday ("21-SEP-2054", "Respect for the Aged Day"); - - lh.addStaticHoliday ("22-SEP-2054", "National Holiday"); - - lh.addStaticHoliday ("23-SEP-2054", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("12-OCT-2054", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2054", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2054", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2054", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2054", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2055", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2055", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2055", "National Foundation Day"); - - lh.addStaticHoliday ("22-MAR-2055", "Vernal Equinox Day Observed"); - - lh.addStaticHoliday ("29-APR-2055", "Showa Day"); - - lh.addStaticHoliday ("03-MAY-2055", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2055", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2055", "Childrens Day"); - - lh.addStaticHoliday ("19-JUL-2055", "Ocean Day"); - - lh.addStaticHoliday ("20-SEP-2055", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2055", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("11-OCT-2055", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2055", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2055", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2055", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2055", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2056", "Bank Holiday"); - - lh.addStaticHoliday ("10-JAN-2056", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2056", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2056", "Vernal Equinox Day"); - - lh.addStaticHoliday ("03-MAY-2056", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2056", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2056", "Childrens Day"); - - lh.addStaticHoliday ("17-JUL-2056", "Ocean Day"); - - lh.addStaticHoliday ("18-SEP-2056", "Respect for the Aged Day"); - - lh.addStaticHoliday ("22-SEP-2056", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("09-OCT-2056", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2056", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2056", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("01-JAN-2057", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2057", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2057", "Bank Holiday"); - - lh.addStaticHoliday ("08-JAN-2057", "Adults Day"); - - lh.addStaticHoliday ("12-FEB-2057", "National Foundation Day Observed"); - - lh.addStaticHoliday ("20-MAR-2057", "Vernal Equinox Day"); - - lh.addStaticHoliday ("30-APR-2057", "Showa Day Observed"); - - lh.addStaticHoliday ("03-MAY-2057", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2057", "Greenery Day"); - - lh.addStaticHoliday ("16-JUL-2057", "Ocean Day"); - - lh.addStaticHoliday ("17-SEP-2057", "Respect for the Aged Day"); - - lh.addStaticHoliday ("08-OCT-2057", "Sports Day"); - - lh.addStaticHoliday ("23-NOV-2057", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("24-DEC-2057", "Emperors Birthday Observed"); - - lh.addStaticHoliday ("31-DEC-2057", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2058", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2058", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2058", "Bank Holiday"); - - lh.addStaticHoliday ("14-JAN-2058", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2058", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2058", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2058", "Showa Day"); - - lh.addStaticHoliday ("03-MAY-2058", "Constitution Memorial Day"); - - lh.addStaticHoliday ("06-MAY-2058", "Childrens Day Observed"); - - lh.addStaticHoliday ("15-JUL-2058", "Ocean Day"); - - lh.addStaticHoliday ("16-SEP-2058", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2058", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("14-OCT-2058", "Sports Day"); - - lh.addStaticHoliday ("04-NOV-2058", "Culture Day Observed"); - - lh.addStaticHoliday ("23-DEC-2058", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2058", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2059", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2059", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2059", "Bank Holiday"); - - lh.addStaticHoliday ("13-JAN-2059", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2059", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2059", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-APR-2059", "Showa Day"); - - lh.addStaticHoliday ("05-MAY-2059", "Childrens Day"); - - lh.addStaticHoliday ("06-MAY-2059", "Greenery Day Observed"); - - lh.addStaticHoliday ("21-JUL-2059", "Ocean Day"); - - lh.addStaticHoliday ("15-SEP-2059", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2059", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("13-OCT-2059", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2059", "Culture Day"); - - lh.addStaticHoliday ("24-NOV-2059", "Labour Thanksgiving Day Observed"); - - lh.addStaticHoliday ("23-DEC-2059", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2059", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2060", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2060", "Bank Holiday"); - - lh.addStaticHoliday ("12-JAN-2060", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2060", "National Foundation Day"); - - lh.addStaticHoliday ("29-APR-2060", "Showa Day"); - - lh.addStaticHoliday ("03-MAY-2060", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2060", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2060", "Childrens Day"); - - lh.addStaticHoliday ("19-JUL-2060", "Ocean Day"); - - lh.addStaticHoliday ("20-SEP-2060", "Respect for the Aged Day"); - - lh.addStaticHoliday ("21-SEP-2060", "National Holiday"); - - lh.addStaticHoliday ("22-SEP-2060", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("11-OCT-2060", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2060", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2060", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2060", "Emperors Birthday"); - - lh.addStaticHoliday ("31-DEC-2060", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2061", "Bank Holiday"); - - lh.addStaticHoliday ("10-JAN-2061", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2061", "National Foundation Day"); - - lh.addStaticHoliday ("21-MAR-2061", "Vernal Equinox Day Observed"); - - lh.addStaticHoliday ("29-APR-2061", "Showa Day"); - - lh.addStaticHoliday ("03-MAY-2061", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2061", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2061", "Childrens Day"); - - lh.addStaticHoliday ("18-JUL-2061", "Ocean Day"); - - lh.addStaticHoliday ("19-SEP-2061", "Respect for the Aged Day"); - - lh.addStaticHoliday ("22-SEP-2061", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("10-OCT-2061", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2061", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2061", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2061", "Emperors Birthday"); - - lh.addStaticHoliday ("02-JAN-2062", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2062", "Bank Holiday"); - - lh.addStaticHoliday ("09-JAN-2062", "Adults Day"); - - lh.addStaticHoliday ("20-MAR-2062", "Vernal Equinox Day"); - - lh.addStaticHoliday ("03-MAY-2062", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2062", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2062", "Childrens Day"); - - lh.addStaticHoliday ("17-JUL-2062", "Ocean Day"); - - lh.addStaticHoliday ("18-SEP-2062", "Respect for the Aged Day"); - - lh.addStaticHoliday ("09-OCT-2062", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2062", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2062", "Labour Thanksgiving Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/KPWHoliday.java b/org/drip/analytics/holset/KPWHoliday.java deleted file mode 100644 index 893912a..0000000 --- a/org/drip/analytics/holset/KPWHoliday.java +++ /dev/null @@ -1,85 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class KPWHoliday implements org.drip.analytics.holset.LocationHoliday { - public KPWHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "KPW"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1997", "New Years day"); - - lh.addStaticHoliday ("02-JAN-1997", "New Years Holiday"); - - lh.addStaticHoliday ("07-FEB-1997", "Lunar New Years Holiday"); - - lh.addStaticHoliday ("05-MAY-1997", "Childrens Day"); - - lh.addStaticHoliday ("14-MAY-1997", "Lord Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-1997", "Memorial day"); - - lh.addStaticHoliday ("17-JUL-1997", "Constitution Day"); - - lh.addStaticHoliday ("15-AUG-1997", "Liberation Day"); - - lh.addStaticHoliday ("15-SEP-1997", "Korea Thanksgiving Holiday"); - - lh.addStaticHoliday ("16-SEP-1997", "Korea Thanksgiving Day"); - - lh.addStaticHoliday ("17-SEP-1997", "Korea Thanksgiving Holiday"); - - lh.addStaticHoliday ("03-OCT-1997", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-1997", "Christmas Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/KRWHoliday.java b/org/drip/analytics/holset/KRWHoliday.java deleted file mode 100644 index 6f0edab..0000000 --- a/org/drip/analytics/holset/KRWHoliday.java +++ /dev/null @@ -1,1553 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class KRWHoliday implements org.drip.analytics.holset.LocationHoliday { - public KRWHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "KRW"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("15-FEB-1999", "Lunar New Years Eve"); - - lh.addStaticHoliday ("16-FEB-1999", "Lunar New Years Day"); - - lh.addStaticHoliday ("17-FEB-1999", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-1999", "Independence Movement Day"); - - lh.addStaticHoliday ("05-APR-1999", "Arbor Day"); - - lh.addStaticHoliday ("01-MAY-1999", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-1999", "Childrens Day"); - - lh.addStaticHoliday ("22-MAY-1999", "Buddhas Birthday"); - - lh.addStaticHoliday ("17-JUL-1999", "Constitution Day"); - - lh.addStaticHoliday ("23-SEP-1999", "Chusok"); - - lh.addStaticHoliday ("24-SEP-1999", "Chusok"); - - lh.addStaticHoliday ("25-SEP-1999", "Chusok"); - - lh.addStaticHoliday ("25-DEC-1999", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-1999", "Special Holiday"); - - lh.addStaticHoliday ("01-JAN-2000", "New Years Day"); - - lh.addStaticHoliday ("03-JAN-2000", "Special Holiday"); - - lh.addStaticHoliday ("04-FEB-2000", "Lunar New Years Eve"); - - lh.addStaticHoliday ("05-FEB-2000", "Lunar New Years Day"); - - lh.addStaticHoliday ("01-MAR-2000", "Independence Movement Day"); - - lh.addStaticHoliday ("05-APR-2000", "Arbor Day"); - - lh.addStaticHoliday ("13-APR-2000", "Election Day"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2000", "Childrens Day"); - - lh.addStaticHoliday ("11-MAY-2000", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2000", "Memorial Day"); - - lh.addStaticHoliday ("17-JUL-2000", "Constitution Day"); - - lh.addStaticHoliday ("15-AUG-2000", "Liberation Day"); - - lh.addStaticHoliday ("11-SEP-2000", "Chusok"); - - lh.addStaticHoliday ("12-SEP-2000", "Chusok"); - - lh.addStaticHoliday ("13-SEP-2000", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2000", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("23-JAN-2001", "Lunar New Years Eve"); - - lh.addStaticHoliday ("24-JAN-2001", "Lunar New Years Day"); - - lh.addStaticHoliday ("25-JAN-2001", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2001", "Independence Movement Day"); - - lh.addStaticHoliday ("05-APR-2001", "Arbor Day"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2001", "Childrens Day"); - - lh.addStaticHoliday ("06-JUN-2001", "Memorial Day"); - - lh.addStaticHoliday ("17-JUL-2001", "Constitution Day"); - - lh.addStaticHoliday ("15-AUG-2001", "Liberation Day"); - - lh.addStaticHoliday ("01-OCT-2001", "Chusok"); - - lh.addStaticHoliday ("02-OCT-2001", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2001", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2002", "Lunar New Years Eve"); - - lh.addStaticHoliday ("12-FEB-2002", "Lunar New Years Day"); - - lh.addStaticHoliday ("13-FEB-2002", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2002", "Independence Movement Day"); - - lh.addStaticHoliday ("05-APR-2002", "Arbor Day"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("06-JUN-2002", "Memorial Day"); - - lh.addStaticHoliday ("13-JUN-2002", "Special Holiday"); - - lh.addStaticHoliday ("01-JUL-2002", "NATIONAL HOLIDAY"); - - lh.addStaticHoliday ("17-JUL-2002", "Constitution Day"); - - lh.addStaticHoliday ("15-AUG-2002", "Liberation Day"); - - lh.addStaticHoliday ("20-SEP-2002", "Chusok"); - - lh.addStaticHoliday ("21-SEP-2002", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2002", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("31-JAN-2003", "Lunar New Years Eve"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2003", "Childrens Day"); - - lh.addStaticHoliday ("08-MAY-2003", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2003", "Memorial Day"); - - lh.addStaticHoliday ("17-JUL-2003", "Constitution Day"); - - lh.addStaticHoliday ("15-AUG-2003", "Liberation Day"); - - lh.addStaticHoliday ("10-SEP-2003", "Chusok"); - - lh.addStaticHoliday ("11-SEP-2003", "Chusok"); - - lh.addStaticHoliday ("12-SEP-2003", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2003", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2004", "Lunar New Years Eve"); - - lh.addStaticHoliday ("22-JAN-2004", "Lunar New Years Day"); - - lh.addStaticHoliday ("23-JAN-2004", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2004", "Independence Movement Day"); - - lh.addStaticHoliday ("05-APR-2004", "Arbor Day"); - - lh.addStaticHoliday ("15-APR-2004", "Election Day"); - - lh.addStaticHoliday ("05-MAY-2004", "Childrens Day"); - - lh.addStaticHoliday ("26-MAY-2004", "Buddhas Birthday"); - - lh.addStaticHoliday ("27-SEP-2004", "Chusok"); - - lh.addStaticHoliday ("28-SEP-2004", "Chusok"); - - lh.addStaticHoliday ("29-SEP-2004", "Chusok"); - - lh.addStaticHoliday ("08-FEB-2005", "Lunar New Years Eve"); - - lh.addStaticHoliday ("09-FEB-2005", "Lunar New Years Day"); - - lh.addStaticHoliday ("10-FEB-2005", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2005", "Independence Movement Day"); - - lh.addStaticHoliday ("05-APR-2005", "Arbor Day"); - - lh.addStaticHoliday ("05-MAY-2005", "Childrens Day"); - - lh.addStaticHoliday ("06-JUN-2005", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Liberation Day"); - - lh.addStaticHoliday ("19-SEP-2005", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2005", "National Foundation Day"); - - lh.addStaticHoliday ("30-JAN-2006", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2006", "Independence Movement Day"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2006", "Childrens Day"); - - lh.addStaticHoliday ("31-MAY-2006", "Election Day"); - - lh.addStaticHoliday ("06-JUN-2006", "Memorial Day"); - - lh.addStaticHoliday ("17-JUL-2006", "Constitution Day"); - - lh.addStaticHoliday ("15-AUG-2006", "Liberation Day"); - - lh.addStaticHoliday ("03-OCT-2006", "National Foundation Day"); - - lh.addStaticHoliday ("05-OCT-2006", "Chusok"); - - lh.addStaticHoliday ("06-OCT-2006", "Chusok"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("19-FEB-2007", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2007", "Independence Movement Day"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2007", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2007", "Memorial Day"); - - lh.addStaticHoliday ("17-JUL-2007", "Constitution Day"); - - lh.addStaticHoliday ("15-AUG-2007", "Liberation Day"); - - lh.addStaticHoliday ("24-SEP-2007", "Chusok"); - - lh.addStaticHoliday ("25-SEP-2007", "Chusok"); - - lh.addStaticHoliday ("26-SEP-2007", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2007", "National Foundation Day"); - - lh.addStaticHoliday ("19-DEC-2007", "Election Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("06-FEB-2008", "Lunar New Years Eve"); - - lh.addStaticHoliday ("07-FEB-2008", "Lunar New Years Day"); - - lh.addStaticHoliday ("08-FEB-2008", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("09-APR-2008", "Election Day"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2008", "Childrens Day"); - - lh.addStaticHoliday ("12-MAY-2008", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2008", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2008", "Liberation Day"); - - lh.addStaticHoliday ("15-SEP-2008", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2008", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2009", "Lunar New Years Day"); - - lh.addStaticHoliday ("27-JAN-2009", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2009", "Childrens Day"); - - lh.addStaticHoliday ("02-OCT-2009", "Chusok"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("13-FEB-2010", "Lunar New Years Day"); - - lh.addStaticHoliday ("15-FEB-2010", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2010", "Independence Movement Day"); - - lh.addStaticHoliday ("01-MAY-2010", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2010", "Childrens Day"); - - lh.addStaticHoliday ("21-MAY-2010", "Buddhas Birthday"); - - lh.addStaticHoliday ("02-JUN-2010", "Election Day"); - - lh.addStaticHoliday ("21-SEP-2010", "Chusok"); - - lh.addStaticHoliday ("22-SEP-2010", "Chusok"); - - lh.addStaticHoliday ("23-SEP-2010", "Chusok"); - - lh.addStaticHoliday ("25-DEC-2010", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2011", "New Years Day"); - - lh.addStaticHoliday ("02-FEB-2011", "Lunar New Years Eve"); - - lh.addStaticHoliday ("03-FEB-2011", "Lunar New Years Day"); - - lh.addStaticHoliday ("04-FEB-2011", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2011", "Independence Movement Day"); - - lh.addStaticHoliday ("05-MAY-2011", "Childrens Day"); - - lh.addStaticHoliday ("10-MAY-2011", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2011", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2011", "Liberation Day"); - - lh.addStaticHoliday ("12-SEP-2011", "Chusok"); - - lh.addStaticHoliday ("13-SEP-2011", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2011", "National Foundation Day"); - - lh.addStaticHoliday ("23-JAN-2012", "Lunar New Years Day"); - - lh.addStaticHoliday ("24-JAN-2012", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2012", "Independence Movement Day"); - - lh.addStaticHoliday ("11-APR-2012", "Election Day"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("28-MAY-2012", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2012", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2012", "Liberation Day"); - - lh.addStaticHoliday ("01-OCT-2012", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2012", "National Foundation Day"); - - lh.addStaticHoliday ("19-DEC-2012", "Election Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2013", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2013", "Independence Movement Day"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2013", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2013", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2013", "Liberation Day"); - - lh.addStaticHoliday ("18-SEP-2013", "Chusok"); - - lh.addStaticHoliday ("19-SEP-2013", "Chusok"); - - lh.addStaticHoliday ("20-SEP-2013", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2013", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("30-JAN-2014", "Lunar New Years Eve"); - - lh.addStaticHoliday ("31-JAN-2014", "Lunar New Years Day"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2014", "Childrens Day"); - - lh.addStaticHoliday ("06-MAY-2014", "Buddhas Birthday"); - - lh.addStaticHoliday ("04-JUN-2014", "Election Day"); - - lh.addStaticHoliday ("06-JUN-2014", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2014", "Liberation Day"); - - lh.addStaticHoliday ("08-SEP-2014", "Chusok"); - - lh.addStaticHoliday ("09-SEP-2014", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2014", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("18-FEB-2015", "Lunar New Years Eve"); - - lh.addStaticHoliday ("19-FEB-2015", "Lunar New Years Day"); - - lh.addStaticHoliday ("20-FEB-2015", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2015", "Childrens Day"); - - lh.addStaticHoliday ("25-MAY-2015", "Buddhas Birthday"); - - lh.addStaticHoliday ("28-SEP-2015", "Chusok"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2016", "Lunar New Years Day"); - - lh.addStaticHoliday ("09-FEB-2016", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2016", "Independence Movement Day"); - - lh.addStaticHoliday ("13-APR-2016", "Election Day"); - - lh.addStaticHoliday ("05-MAY-2016", "Childrens Day"); - - lh.addStaticHoliday ("06-JUN-2016", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2016", "Liberation Day"); - - lh.addStaticHoliday ("14-SEP-2016", "Chusok"); - - lh.addStaticHoliday ("15-SEP-2016", "Chusok"); - - lh.addStaticHoliday ("16-SEP-2016", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2016", "National Foundation Day"); - - lh.addStaticHoliday ("27-JAN-2017", "Lunar New Years Eve"); - - lh.addStaticHoliday ("01-MAR-2017", "Independence Movement Day"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2017", "Buddhas Birthday"); - - lh.addStaticHoliday ("05-MAY-2017", "Childrens Day"); - - lh.addStaticHoliday ("06-JUN-2017", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2017", "Liberation Day"); - - lh.addStaticHoliday ("03-OCT-2017", "Chusok"); - - lh.addStaticHoliday ("04-OCT-2017", "Chusok"); - - lh.addStaticHoliday ("05-OCT-2017", "Chusok"); - - lh.addStaticHoliday ("20-DEC-2017", "Election Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("15-FEB-2018", "Lunar New Years Eve"); - - lh.addStaticHoliday ("16-FEB-2018", "Lunar New Years Day"); - - lh.addStaticHoliday ("01-MAR-2018", "Independence Movement Day"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("22-MAY-2018", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2018", "Memorial Day"); - - lh.addStaticHoliday ("13-JUN-2018", "Election Day"); - - lh.addStaticHoliday ("15-AUG-2018", "Liberation Day"); - - lh.addStaticHoliday ("24-SEP-2018", "Chusok"); - - lh.addStaticHoliday ("25-SEP-2018", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2018", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("04-FEB-2019", "Lunar New Years Eve"); - - lh.addStaticHoliday ("05-FEB-2019", "Lunar New Years Day"); - - lh.addStaticHoliday ("06-FEB-2019", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2019", "Independence Movement Day"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("06-JUN-2019", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2019", "Liberation Day"); - - lh.addStaticHoliday ("12-SEP-2019", "Chusok"); - - lh.addStaticHoliday ("13-SEP-2019", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2019", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("24-JAN-2020", "Lunar New Years Eve"); - - lh.addStaticHoliday ("15-APR-2020", "Election Day"); - - lh.addStaticHoliday ("30-APR-2020", "Buddhas Birthday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2020", "Childrens Day"); - - lh.addStaticHoliday ("30-SEP-2020", "Chusok"); - - lh.addStaticHoliday ("01-OCT-2020", "Chusok"); - - lh.addStaticHoliday ("02-OCT-2020", "Chusok"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2021", "Lunar New Years Eve"); - - lh.addStaticHoliday ("12-FEB-2021", "Lunar New Years Day"); - - lh.addStaticHoliday ("01-MAR-2021", "Independence Movement Day"); - - lh.addStaticHoliday ("05-MAY-2021", "Childrens Day"); - - lh.addStaticHoliday ("19-MAY-2021", "Buddhas Birthday"); - - lh.addStaticHoliday ("20-SEP-2021", "Chusok"); - - lh.addStaticHoliday ("21-SEP-2021", "Chusok"); - - lh.addStaticHoliday ("22-SEP-2021", "Chusok"); - - lh.addStaticHoliday ("31-JAN-2022", "Lunar New Years Eve"); - - lh.addStaticHoliday ("01-FEB-2022", "Lunar New Years Day"); - - lh.addStaticHoliday ("02-FEB-2022", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2022", "Independence Movement Day"); - - lh.addStaticHoliday ("05-MAY-2022", "Childrens Day"); - - lh.addStaticHoliday ("01-JUN-2022", "Election Day"); - - lh.addStaticHoliday ("06-JUN-2022", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2022", "Liberation Day"); - - lh.addStaticHoliday ("09-SEP-2022", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2022", "National Foundation Day"); - - lh.addStaticHoliday ("21-DEC-2022", "Election Day"); - - lh.addStaticHoliday ("23-JAN-2023", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2023", "Independence Movement Day"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2023", "Childrens Day"); - - lh.addStaticHoliday ("06-JUN-2023", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2023", "Liberation Day"); - - lh.addStaticHoliday ("28-SEP-2023", "Chusok"); - - lh.addStaticHoliday ("29-SEP-2023", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2023", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("09-FEB-2024", "Lunar New Years Eve"); - - lh.addStaticHoliday ("01-MAR-2024", "Independence Movement Day"); - - lh.addStaticHoliday ("10-APR-2024", "Election Day"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("15-MAY-2024", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2024", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2024", "Liberation Day"); - - lh.addStaticHoliday ("16-SEP-2024", "Chusok"); - - lh.addStaticHoliday ("17-SEP-2024", "Chusok"); - - lh.addStaticHoliday ("18-SEP-2024", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2024", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-2025", "Lunar New Years Eve"); - - lh.addStaticHoliday ("29-JAN-2025", "Lunar New Years Day"); - - lh.addStaticHoliday ("30-JAN-2025", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2025", "Childrens Day"); - - lh.addStaticHoliday ("06-JUN-2025", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2025", "Liberation Day"); - - lh.addStaticHoliday ("03-OCT-2025", "National Foundation Day"); - - lh.addStaticHoliday ("06-OCT-2025", "Chusok"); - - lh.addStaticHoliday ("07-OCT-2025", "Chusok"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2026", "Lunar New Years Eve"); - - lh.addStaticHoliday ("17-FEB-2026", "Lunar New Years Day"); - - lh.addStaticHoliday ("18-FEB-2026", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2026", "Childrens Day"); - - lh.addStaticHoliday ("03-JUN-2026", "Election Day"); - - lh.addStaticHoliday ("24-SEP-2026", "Chusok"); - - lh.addStaticHoliday ("25-SEP-2026", "Chusok"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2027", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2027", "Independence Movement Day"); - - lh.addStaticHoliday ("05-MAY-2027", "Childrens Day"); - - lh.addStaticHoliday ("13-MAY-2027", "Buddhas Birthday"); - - lh.addStaticHoliday ("14-SEP-2027", "Chusok"); - - lh.addStaticHoliday ("15-SEP-2027", "Chusok"); - - lh.addStaticHoliday ("16-SEP-2027", "Chusok"); - - lh.addStaticHoliday ("22-DEC-2027", "Election Day"); - - lh.addStaticHoliday ("26-JAN-2028", "Lunar New Years Eve"); - - lh.addStaticHoliday ("27-JAN-2028", "Lunar New Years Day"); - - lh.addStaticHoliday ("28-JAN-2028", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2028", "Independence Movement Day"); - - lh.addStaticHoliday ("12-APR-2028", "Election Day"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2028", "Buddhas Birthday"); - - lh.addStaticHoliday ("05-MAY-2028", "Childrens Day"); - - lh.addStaticHoliday ("06-JUN-2028", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2028", "Liberation Day"); - - lh.addStaticHoliday ("02-OCT-2028", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2028", "Chusok"); - - lh.addStaticHoliday ("04-OCT-2028", "Chusok"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2029", "New Years Day"); - - lh.addStaticHoliday ("12-FEB-2029", "Lunar New Years Eve"); - - lh.addStaticHoliday ("13-FEB-2029", "Lunar New Years Day"); - - lh.addStaticHoliday ("14-FEB-2029", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2029", "Independence Movement Day"); - - lh.addStaticHoliday ("01-MAY-2029", "Labour Day"); - - lh.addStaticHoliday ("06-JUN-2029", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2029", "Liberation Day"); - - lh.addStaticHoliday ("21-SEP-2029", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2029", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-2029", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2030", "New Years Day"); - - lh.addStaticHoliday ("04-FEB-2030", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2030", "Independence Movement Day"); - - lh.addStaticHoliday ("01-MAY-2030", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2030", "Buddhas Birthday"); - - lh.addStaticHoliday ("05-JUN-2030", "Election Day"); - - lh.addStaticHoliday ("06-JUN-2030", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2030", "Liberation Day"); - - lh.addStaticHoliday ("11-SEP-2030", "Chusok"); - - lh.addStaticHoliday ("12-SEP-2030", "Chusok"); - - lh.addStaticHoliday ("13-SEP-2030", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2030", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-2030", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2031", "New Years Day"); - - lh.addStaticHoliday ("22-JAN-2031", "Lunar New Years Eve"); - - lh.addStaticHoliday ("23-JAN-2031", "Lunar New Years Day"); - - lh.addStaticHoliday ("24-JAN-2031", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAY-2031", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2031", "Childrens Day"); - - lh.addStaticHoliday ("28-MAY-2031", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2031", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2031", "Liberation Day"); - - lh.addStaticHoliday ("30-SEP-2031", "Chusok"); - - lh.addStaticHoliday ("01-OCT-2031", "Chusok"); - - lh.addStaticHoliday ("02-OCT-2031", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2031", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-2031", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2032", "New Years Day"); - - lh.addStaticHoliday ("10-FEB-2032", "Lunar New Years Eve"); - - lh.addStaticHoliday ("11-FEB-2032", "Lunar New Years Day"); - - lh.addStaticHoliday ("12-FEB-2032", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2032", "Independence Movement Day"); - - lh.addStaticHoliday ("14-APR-2032", "Election Day"); - - lh.addStaticHoliday ("05-MAY-2032", "Childrens Day"); - - lh.addStaticHoliday ("20-SEP-2032", "Chusok"); - - lh.addStaticHoliday ("22-DEC-2032", "Election Day"); - - lh.addStaticHoliday ("31-JAN-2033", "Lunar New Years Day"); - - lh.addStaticHoliday ("01-FEB-2033", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2033", "Independence Movement Day"); - - lh.addStaticHoliday ("05-MAY-2033", "Childrens Day"); - - lh.addStaticHoliday ("06-MAY-2033", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2033", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2033", "Liberation Day"); - - lh.addStaticHoliday ("07-SEP-2033", "Chusok"); - - lh.addStaticHoliday ("08-SEP-2033", "Chusok"); - - lh.addStaticHoliday ("09-SEP-2033", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2033", "National Foundation Day"); - - lh.addStaticHoliday ("20-FEB-2034", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2034", "Independence Movement Day"); - - lh.addStaticHoliday ("01-MAY-2034", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2034", "Childrens Day"); - - lh.addStaticHoliday ("25-MAY-2034", "Buddhas Birthday"); - - lh.addStaticHoliday ("31-MAY-2034", "Election Day"); - - lh.addStaticHoliday ("06-JUN-2034", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2034", "Liberation Day"); - - lh.addStaticHoliday ("26-SEP-2034", "Chusok"); - - lh.addStaticHoliday ("27-SEP-2034", "Chusok"); - - lh.addStaticHoliday ("28-SEP-2034", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2034", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-2034", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2035", "New Years Day"); - - lh.addStaticHoliday ("07-FEB-2035", "Lunar New Years Eve"); - - lh.addStaticHoliday ("08-FEB-2035", "Lunar New Years Day"); - - lh.addStaticHoliday ("09-FEB-2035", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2035", "Independence Movement Day"); - - lh.addStaticHoliday ("01-MAY-2035", "Labour Day"); - - lh.addStaticHoliday ("15-MAY-2035", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2035", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2035", "Liberation Day"); - - lh.addStaticHoliday ("17-SEP-2035", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2035", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-2035", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2036", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-2036", "Lunar New Years Day"); - - lh.addStaticHoliday ("29-JAN-2036", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("09-APR-2036", "Election Day"); - - lh.addStaticHoliday ("01-MAY-2036", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2036", "Childrens Day"); - - lh.addStaticHoliday ("06-JUN-2036", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2036", "Liberation Day"); - - lh.addStaticHoliday ("03-OCT-2036", "Chusok"); - - lh.addStaticHoliday ("25-DEC-2036", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2037", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2037", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAY-2037", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2037", "Childrens Day"); - - lh.addStaticHoliday ("22-MAY-2037", "Buddhas Birthday"); - - lh.addStaticHoliday ("23-SEP-2037", "Chusok"); - - lh.addStaticHoliday ("24-SEP-2037", "Chusok"); - - lh.addStaticHoliday ("25-SEP-2037", "Chusok"); - - lh.addStaticHoliday ("23-DEC-2037", "Election Day"); - - lh.addStaticHoliday ("25-DEC-2037", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2038", "New Years Day"); - - lh.addStaticHoliday ("03-FEB-2038", "Lunar New Years Eve"); - - lh.addStaticHoliday ("04-FEB-2038", "Lunar New Years Day"); - - lh.addStaticHoliday ("05-FEB-2038", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2038", "Independence Movement Day"); - - lh.addStaticHoliday ("05-MAY-2038", "Childrens Day"); - - lh.addStaticHoliday ("11-MAY-2038", "Buddhas Birthday"); - - lh.addStaticHoliday ("02-JUN-2038", "Election Day"); - - lh.addStaticHoliday ("13-SEP-2038", "Chusok"); - - lh.addStaticHoliday ("14-SEP-2038", "Chusok"); - - lh.addStaticHoliday ("24-JAN-2039", "Lunar New Years Day"); - - lh.addStaticHoliday ("25-JAN-2039", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2039", "Independence Movement Day"); - - lh.addStaticHoliday ("05-MAY-2039", "Childrens Day"); - - lh.addStaticHoliday ("06-JUN-2039", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2039", "Liberation Day"); - - lh.addStaticHoliday ("03-OCT-2039", "Chusok"); - - lh.addStaticHoliday ("13-FEB-2040", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2040", "Independence Movement Day"); - - lh.addStaticHoliday ("11-APR-2040", "Election Day"); - - lh.addStaticHoliday ("01-MAY-2040", "Labour Day"); - - lh.addStaticHoliday ("18-MAY-2040", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2040", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2040", "Liberation Day"); - - lh.addStaticHoliday ("20-SEP-2040", "Chusok"); - - lh.addStaticHoliday ("21-SEP-2040", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2040", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-2040", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2041", "New Years Day"); - - lh.addStaticHoliday ("31-JAN-2041", "Lunar New Years Eve"); - - lh.addStaticHoliday ("01-FEB-2041", "Lunar New Years Day"); - - lh.addStaticHoliday ("01-MAR-2041", "Independence Movement Day"); - - lh.addStaticHoliday ("01-MAY-2041", "Labour Day"); - - lh.addStaticHoliday ("07-MAY-2041", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2041", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2041", "Liberation Day"); - - lh.addStaticHoliday ("09-SEP-2041", "Chusok"); - - lh.addStaticHoliday ("10-SEP-2041", "Chusok"); - - lh.addStaticHoliday ("11-SEP-2041", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2041", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-2041", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2042", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2042", "Lunar New Years Eve"); - - lh.addStaticHoliday ("22-JAN-2042", "Lunar New Years Day"); - - lh.addStaticHoliday ("23-JAN-2042", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAY-2042", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2042", "Childrens Day"); - - lh.addStaticHoliday ("26-MAY-2042", "Buddhas Birthday"); - - lh.addStaticHoliday ("04-JUN-2042", "Election Day"); - - lh.addStaticHoliday ("06-JUN-2042", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2042", "Liberation Day"); - - lh.addStaticHoliday ("29-SEP-2042", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2042", "National Foundation Day"); - - lh.addStaticHoliday ("17-DEC-2042", "Election Day"); - - lh.addStaticHoliday ("25-DEC-2042", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2043", "New Years Day"); - - lh.addStaticHoliday ("09-FEB-2043", "Lunar New Years Eve"); - - lh.addStaticHoliday ("10-FEB-2043", "Lunar New Years Day"); - - lh.addStaticHoliday ("11-FEB-2043", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAY-2043", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2043", "Childrens Day"); - - lh.addStaticHoliday ("16-SEP-2043", "Chusok"); - - lh.addStaticHoliday ("17-SEP-2043", "Chusok"); - - lh.addStaticHoliday ("18-SEP-2043", "Chusok"); - - lh.addStaticHoliday ("25-DEC-2043", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2044", "New Years Day"); - - lh.addStaticHoliday ("29-JAN-2044", "Lunar New Years Eve"); - - lh.addStaticHoliday ("01-MAR-2044", "Independence Movement Day"); - - lh.addStaticHoliday ("13-APR-2044", "Election Day"); - - lh.addStaticHoliday ("05-MAY-2044", "Childrens Day"); - - lh.addStaticHoliday ("06-JUN-2044", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2044", "Liberation Day"); - - lh.addStaticHoliday ("03-OCT-2044", "National Foundation Day"); - - lh.addStaticHoliday ("04-OCT-2044", "Chusok"); - - lh.addStaticHoliday ("05-OCT-2044", "Chusok"); - - lh.addStaticHoliday ("06-OCT-2044", "Chusok"); - - lh.addStaticHoliday ("16-FEB-2045", "Lunar New Years Eve"); - - lh.addStaticHoliday ("17-FEB-2045", "Lunar New Years Day"); - - lh.addStaticHoliday ("01-MAR-2045", "Independence Movement Day"); - - lh.addStaticHoliday ("01-MAY-2045", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2045", "Childrens Day"); - - lh.addStaticHoliday ("24-MAY-2045", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2045", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2045", "Liberation Day"); - - lh.addStaticHoliday ("25-SEP-2045", "Chusok"); - - lh.addStaticHoliday ("26-SEP-2045", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2045", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-2045", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2046", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2046", "Lunar New Years Eve"); - - lh.addStaticHoliday ("06-FEB-2046", "Lunar New Years Day"); - - lh.addStaticHoliday ("07-FEB-2046", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2046", "Independence Movement Day"); - - lh.addStaticHoliday ("01-MAY-2046", "Labour Day"); - - lh.addStaticHoliday ("06-JUN-2046", "Memorial Day"); - - lh.addStaticHoliday ("13-JUN-2046", "Election Day"); - - lh.addStaticHoliday ("15-AUG-2046", "Liberation Day"); - - lh.addStaticHoliday ("14-SEP-2046", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2046", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-2046", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2047", "New Years Day"); - - lh.addStaticHoliday ("25-JAN-2047", "Lunar New Years Eve"); - - lh.addStaticHoliday ("01-MAR-2047", "Independence Movement Day"); - - lh.addStaticHoliday ("01-MAY-2047", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2047", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2047", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2047", "Liberation Day"); - - lh.addStaticHoliday ("03-OCT-2047", "Chusok"); - - lh.addStaticHoliday ("04-OCT-2047", "Chusok"); - - lh.addStaticHoliday ("18-DEC-2047", "Election Day"); - - lh.addStaticHoliday ("25-DEC-2047", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2048", "New Years Day"); - - lh.addStaticHoliday ("13-FEB-2048", "Lunar New Years Eve"); - - lh.addStaticHoliday ("14-FEB-2048", "Lunar New Years Day"); - - lh.addStaticHoliday ("15-APR-2048", "Election Day"); - - lh.addStaticHoliday ("01-MAY-2048", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2048", "Childrens Day"); - - lh.addStaticHoliday ("20-MAY-2048", "Buddhas Birthday"); - - lh.addStaticHoliday ("21-SEP-2048", "Chusok"); - - lh.addStaticHoliday ("22-SEP-2048", "Chusok"); - - lh.addStaticHoliday ("23-SEP-2048", "Chusok"); - - lh.addStaticHoliday ("25-DEC-2048", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2049", "New Years Day"); - - lh.addStaticHoliday ("01-FEB-2049", "Lunar New Years Eve"); - - lh.addStaticHoliday ("02-FEB-2049", "Lunar New Years Day"); - - lh.addStaticHoliday ("03-FEB-2049", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2049", "Independence Movement Day"); - - lh.addStaticHoliday ("05-MAY-2049", "Childrens Day"); - - lh.addStaticHoliday ("10-SEP-2049", "Chusok"); - - lh.addStaticHoliday ("24-JAN-2050", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2050", "Independence Movement Day"); - - lh.addStaticHoliday ("05-MAY-2050", "Childrens Day"); - - lh.addStaticHoliday ("01-JUN-2050", "Election Day"); - - lh.addStaticHoliday ("06-JUN-2050", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2050", "Liberation Day"); - - lh.addStaticHoliday ("29-SEP-2050", "Chusok"); - - lh.addStaticHoliday ("30-SEP-2050", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2050", "National Foundation Day"); - - lh.addStaticHoliday ("10-FEB-2051", "Lunar New Years Eve"); - - lh.addStaticHoliday ("01-MAR-2051", "Independence Movement Day"); - - lh.addStaticHoliday ("01-MAY-2051", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2051", "Childrens Day"); - - lh.addStaticHoliday ("17-MAY-2051", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2051", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2051", "Liberation Day"); - - lh.addStaticHoliday ("18-SEP-2051", "Chusok"); - - lh.addStaticHoliday ("19-SEP-2051", "Chusok"); - - lh.addStaticHoliday ("20-SEP-2051", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2051", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-2051", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2052", "New Years Day"); - - lh.addStaticHoliday ("31-JAN-2052", "Lunar New Years Eve"); - - lh.addStaticHoliday ("01-FEB-2052", "Lunar New Years Day"); - - lh.addStaticHoliday ("02-FEB-2052", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2052", "Independence Movement Day"); - - lh.addStaticHoliday ("10-APR-2052", "Election Day"); - - lh.addStaticHoliday ("01-MAY-2052", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2052", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2052", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2052", "Liberation Day"); - - lh.addStaticHoliday ("06-SEP-2052", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2052", "National Foundation Day"); - - lh.addStaticHoliday ("18-DEC-2052", "Election Day"); - - lh.addStaticHoliday ("25-DEC-2052", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2053", "New Years Day"); - - lh.addStaticHoliday ("18-FEB-2053", "Lunar New Years Eve"); - - lh.addStaticHoliday ("19-FEB-2053", "Lunar New Years Day"); - - lh.addStaticHoliday ("20-FEB-2053", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAY-2053", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2053", "Childrens Day"); - - lh.addStaticHoliday ("06-JUN-2053", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2053", "Liberation Day"); - - lh.addStaticHoliday ("25-SEP-2053", "Chusok"); - - lh.addStaticHoliday ("26-SEP-2053", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2053", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-2053", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2054", "New Years Day"); - - lh.addStaticHoliday ("09-FEB-2054", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAY-2054", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2054", "Childrens Day"); - - lh.addStaticHoliday ("15-MAY-2054", "Buddhas Birthday"); - - lh.addStaticHoliday ("03-JUN-2054", "Election Day"); - - lh.addStaticHoliday ("15-SEP-2054", "Chusok"); - - lh.addStaticHoliday ("16-SEP-2054", "Chusok"); - - lh.addStaticHoliday ("17-SEP-2054", "Chusok"); - - lh.addStaticHoliday ("25-DEC-2054", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2055", "New Years Day"); - - lh.addStaticHoliday ("27-JAN-2055", "Lunar New Years Eve"); - - lh.addStaticHoliday ("28-JAN-2055", "Lunar New Years Day"); - - lh.addStaticHoliday ("29-JAN-2055", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2055", "Independence Movement Day"); - - lh.addStaticHoliday ("04-MAY-2055", "Buddhas Birthday"); - - lh.addStaticHoliday ("05-MAY-2055", "Childrens Day"); - - lh.addStaticHoliday ("04-OCT-2055", "Chusok"); - - lh.addStaticHoliday ("05-OCT-2055", "Chusok"); - - lh.addStaticHoliday ("06-OCT-2055", "Chusok"); - - lh.addStaticHoliday ("14-FEB-2056", "Lunar New Years Eve"); - - lh.addStaticHoliday ("15-FEB-2056", "Lunar New Years Day"); - - lh.addStaticHoliday ("16-FEB-2056", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2056", "Independence Movement Day"); - - lh.addStaticHoliday ("12-APR-2056", "Election Day"); - - lh.addStaticHoliday ("01-MAY-2056", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2056", "Childrens Day"); - - lh.addStaticHoliday ("22-MAY-2056", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2056", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2056", "Liberation Day"); - - lh.addStaticHoliday ("25-SEP-2056", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2056", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-2056", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2057", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2057", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2057", "Independence Movement Day"); - - lh.addStaticHoliday ("01-MAY-2057", "Labour Day"); - - lh.addStaticHoliday ("11-MAY-2057", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2057", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2057", "Liberation Day"); - - lh.addStaticHoliday ("12-SEP-2057", "Chusok"); - - lh.addStaticHoliday ("13-SEP-2057", "Chusok"); - - lh.addStaticHoliday ("14-SEP-2057", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2057", "National Foundation Day"); - - lh.addStaticHoliday ("19-DEC-2057", "Election Day"); - - lh.addStaticHoliday ("25-DEC-2057", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2058", "New Years Day"); - - lh.addStaticHoliday ("23-JAN-2058", "Lunar New Years Eve"); - - lh.addStaticHoliday ("24-JAN-2058", "Lunar New Years Day"); - - lh.addStaticHoliday ("25-JAN-2058", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2058", "Independence Movement Day"); - - lh.addStaticHoliday ("30-APR-2058", "Buddhas Birthday"); - - lh.addStaticHoliday ("01-MAY-2058", "Labour Day"); - - lh.addStaticHoliday ("05-JUN-2058", "Election Day"); - - lh.addStaticHoliday ("06-JUN-2058", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2058", "Liberation Day"); - - lh.addStaticHoliday ("01-OCT-2058", "Chusok"); - - lh.addStaticHoliday ("02-OCT-2058", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2058", "Chusok"); - - lh.addStaticHoliday ("25-DEC-2058", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2059", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2059", "Lunar New Years Eve"); - - lh.addStaticHoliday ("12-FEB-2059", "Lunar New Years Day"); - - lh.addStaticHoliday ("13-FEB-2059", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAY-2059", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2059", "Childrens Day"); - - lh.addStaticHoliday ("19-MAY-2059", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2059", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2059", "Liberation Day"); - - lh.addStaticHoliday ("22-SEP-2059", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2059", "National Foundation Day"); - - lh.addStaticHoliday ("25-DEC-2059", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2060", "New Years Day"); - - lh.addStaticHoliday ("02-FEB-2060", "Lunar New Years Day"); - - lh.addStaticHoliday ("03-FEB-2060", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2060", "Independence Movement Day"); - - lh.addStaticHoliday ("14-APR-2060", "Election Day"); - - lh.addStaticHoliday ("05-MAY-2060", "Childrens Day"); - - lh.addStaticHoliday ("07-MAY-2060", "Buddhas Birthday"); - - lh.addStaticHoliday ("08-SEP-2060", "Chusok"); - - lh.addStaticHoliday ("09-SEP-2060", "Chusok"); - - lh.addStaticHoliday ("10-SEP-2060", "Chusok"); - - lh.addStaticHoliday ("21-JAN-2061", "Lunar New Years Eve"); - - lh.addStaticHoliday ("01-MAR-2061", "Independence Movement Day"); - - lh.addStaticHoliday ("05-MAY-2061", "Childrens Day"); - - lh.addStaticHoliday ("26-MAY-2061", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-2061", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2061", "Liberation Day"); - - lh.addStaticHoliday ("27-SEP-2061", "Chusok"); - - lh.addStaticHoliday ("28-SEP-2061", "Chusok"); - - lh.addStaticHoliday ("29-SEP-2061", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2061", "National Foundation Day"); - - lh.addStaticHoliday ("08-FEB-2062", "Lunar New Years Eve"); - - lh.addStaticHoliday ("09-FEB-2062", "Lunar New Years Day"); - - lh.addStaticHoliday ("10-FEB-2062", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-2062", "Independence Movement Day"); - - lh.addStaticHoliday ("01-MAY-2062", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2062", "Childrens Day"); - - lh.addStaticHoliday ("16-MAY-2062", "Buddhas Birthday"); - - lh.addStaticHoliday ("31-MAY-2062", "Election Day"); - - lh.addStaticHoliday ("06-JUN-2062", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-2062", "Liberation Day"); - - lh.addStaticHoliday ("18-SEP-2062", "Chusok"); - - lh.addStaticHoliday ("03-OCT-2062", "National Foundation Day"); - - lh.addStaticHoliday ("20-DEC-2062", "Election Day"); - - lh.addStaticHoliday ("25-DEC-2062", "Christmas Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/KWDHoliday.java b/org/drip/analytics/holset/KWDHoliday.java deleted file mode 100644 index 1214497..0000000 --- a/org/drip/analytics/holset/KWDHoliday.java +++ /dev/null @@ -1,1277 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class KWDHoliday implements org.drip.analytics.holset.LocationHoliday { - public KWDHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "KWD"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-1998", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("29-JAN-1998", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-FEB-1998", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-FEB-1998", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("25-FEB-1998", "National Day"); - - lh.addStaticHoliday ("26-FEB-1998", "National Day"); - - lh.addStaticHoliday ("05-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("26-APR-1998", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("27-APR-1998", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("05-JUL-1998", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("06-JUL-1998", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("15-NOV-1998", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("16-NOV-1998", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("03-JAN-1999", "New Years Day Observed"); - - lh.addStaticHoliday ("17-JAN-1999", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("18-JAN-1999", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("19-JAN-1999", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("20-JAN-1999", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("21-JAN-1999", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("25-FEB-1999", "National Day"); - - lh.addStaticHoliday ("28-FEB-1999", "National Day Observed"); - - lh.addStaticHoliday ("25-MAR-1999", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-MAR-1999", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-MAR-1999", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("30-MAR-1999", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("31-MAR-1999", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-APR-1999", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("15-APR-1999", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("24-JUN-1999", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("03-NOV-1999", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("04-NOV-1999", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("02-JAN-2000", "New Years Day Observed"); - - lh.addStaticHoliday ("06-JAN-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("09-JAN-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("10-JAN-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("11-JAN-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("27-FEB-2000", "National Day Observed"); - - lh.addStaticHoliday ("28-FEB-2000", "National Day Observed"); - - lh.addStaticHoliday ("13-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("14-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("15-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-APR-2000", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("05-APR-2000", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("06-APR-2000", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("13-JUN-2000", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("14-JUN-2000", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("15-JUN-2000", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("23-OCT-2000", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("24-OCT-2000", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("25-OCT-2000", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("25-DEC-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-DEC-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("27-DEC-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("28-DEC-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("25-FEB-2001", "National Day"); - - lh.addStaticHoliday ("26-FEB-2001", "National Day"); - - lh.addStaticHoliday ("04-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-MAR-2001", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("26-MAR-2001", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("03-JUN-2001", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("04-JUN-2001", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("14-OCT-2001", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2001", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("17-DEC-2001", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("18-DEC-2001", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("19-DEC-2001", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("20-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("21-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("26-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("27-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("14-MAR-2002", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("23-MAY-2002", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("02-OCT-2002", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("03-OCT-2002", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("04-DEC-2002", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("05-DEC-2002", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("08-DEC-2002", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("09-DEC-2002", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("09-FEB-2003", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-FEB-2003", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-FEB-2003", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("12-FEB-2003", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-FEB-2003", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-FEB-2003", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-FEB-2003", "National Day"); - - lh.addStaticHoliday ("26-FEB-2003", "National Day"); - - lh.addStaticHoliday ("03-MAR-2003", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("04-MAR-2003", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("05-MAR-2003", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("12-MAY-2003", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("13-MAY-2003", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("14-MAY-2003", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("21-SEP-2003", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("22-SEP-2003", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("23-SEP-2003", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("23-NOV-2003", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("24-NOV-2003", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("25-NOV-2003", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-NOV-2003", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("27-NOV-2003", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("29-JAN-2004", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-FEB-2004", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-FEB-2004", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-FEB-2004", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-FEB-2004", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-FEB-2004", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-FEB-2004", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("25-FEB-2004", "National Day"); - - lh.addStaticHoliday ("26-FEB-2004", "National Day"); - - lh.addStaticHoliday ("02-MAY-2004", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("12-SEP-2004", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("14-NOV-2004", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("15-NOV-2004", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("16-NOV-2004", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("17-NOV-2004", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-JAN-2005", "New Years Day Observed"); - - lh.addStaticHoliday ("18-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-FEB-2005", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("09-FEB-2005", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("10-FEB-2005", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("27-FEB-2005", "National Day Observed"); - - lh.addStaticHoliday ("28-FEB-2005", "National Day Observed"); - - lh.addStaticHoliday ("19-APR-2005", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("20-APR-2005", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("21-APR-2005", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("30-AUG-2005", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("31-AUG-2005", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("01-SEP-2005", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("01-NOV-2005", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-NOV-2005", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("03-NOV-2005", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("06-NOV-2005", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2006", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("12-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-JAN-2006", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("30-JAN-2006", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("31-JAN-2006", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("26-FEB-2006", "National Day"); - - lh.addStaticHoliday ("27-FEB-2006", "National Day Observed"); - - lh.addStaticHoliday ("09-APR-2006", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("10-APR-2006", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("11-APR-2006", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("20-AUG-2006", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("21-AUG-2006", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("22-OCT-2006", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("23-OCT-2006", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("24-OCT-2006", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("25-OCT-2006", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-OCT-2006", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("28-DEC-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("31-DEC-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-JAN-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-JAN-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-JAN-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-JAN-2007", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("25-FEB-2007", "National Day"); - - lh.addStaticHoliday ("26-FEB-2007", "National Day"); - - lh.addStaticHoliday ("29-MAR-2007", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("08-AUG-2007", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("09-AUG-2007", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("11-OCT-2007", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("14-OCT-2007", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("15-OCT-2007", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("16-OCT-2007", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("17-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2008", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("09-JAN-2008", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("10-JAN-2008", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("25-FEB-2008", "National Day"); - - lh.addStaticHoliday ("26-FEB-2008", "National Day"); - - lh.addStaticHoliday ("18-MAR-2008", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("19-MAR-2008", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("20-MAR-2008", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("28-JUL-2008", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("29-JUL-2008", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("30-JUL-2008", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("29-SEP-2008", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("30-SEP-2008", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-OCT-2008", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-OCT-2008", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("07-DEC-2008", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-DEC-2008", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-DEC-2008", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-DEC-2008", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-DEC-2008", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-DEC-2008", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("29-DEC-2008", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("25-FEB-2009", "National Day"); - - lh.addStaticHoliday ("26-FEB-2009", "National Day"); - - lh.addStaticHoliday ("08-MAR-2009", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("09-MAR-2009", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("19-JUL-2009", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("20-JUL-2009", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("20-SEP-2009", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("21-SEP-2009", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("22-SEP-2009", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("23-SEP-2009", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("24-NOV-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-NOV-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("26-NOV-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-NOV-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("30-NOV-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-DEC-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2009", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("17-DEC-2009", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("03-JAN-2010", "New Years Day Observed"); - - lh.addStaticHoliday ("24-FEB-2010", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("25-FEB-2010", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("28-FEB-2010", "National Day Observed"); - - lh.addStaticHoliday ("07-JUL-2010", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("08-JUL-2010", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("08-SEP-2010", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("09-SEP-2010", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("12-SEP-2010", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("13-SEP-2010", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("14-NOV-2010", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("15-NOV-2010", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-NOV-2010", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-NOV-2010", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-NOV-2010", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("21-NOV-2010", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-DEC-2010", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("06-DEC-2010", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("07-DEC-2010", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("02-JAN-2011", "New Years Day Observed"); - - lh.addStaticHoliday ("13-FEB-2011", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("14-FEB-2011", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("15-FEB-2011", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("27-FEB-2011", "National Day Observed"); - - lh.addStaticHoliday ("28-FEB-2011", "National Day Observed"); - - lh.addStaticHoliday ("26-JUN-2011", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("27-JUN-2011", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("28-JUN-2011", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("28-AUG-2011", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("29-AUG-2011", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("30-AUG-2011", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("31-AUG-2011", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-SEP-2011", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("03-NOV-2011", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-NOV-2011", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-NOV-2011", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-NOV-2011", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-NOV-2011", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-NOV-2011", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-NOV-2011", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2012", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2012", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("26-FEB-2012", "National Day"); - - lh.addStaticHoliday ("27-FEB-2012", "National Day Observed"); - - lh.addStaticHoliday ("17-JUN-2012", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("19-AUG-2012", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("20-AUG-2012", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("21-AUG-2012", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("22-AUG-2012", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("23-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("30-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-NOV-2012", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("14-NOV-2012", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("15-NOV-2012", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("22-JAN-2013", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("23-JAN-2013", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("24-JAN-2013", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("25-FEB-2013", "National Day"); - - lh.addStaticHoliday ("26-FEB-2013", "National Day"); - - lh.addStaticHoliday ("04-JUN-2013", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("05-JUN-2013", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("06-JUN-2013", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2013", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("07-AUG-2013", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("08-AUG-2013", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("11-AUG-2013", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("13-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("14-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("15-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-NOV-2013", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("04-NOV-2013", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("05-NOV-2013", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2014", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("13-JAN-2014", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("14-JAN-2014", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("25-FEB-2014", "National Day"); - - lh.addStaticHoliday ("26-FEB-2014", "National Day"); - - lh.addStaticHoliday ("25-MAY-2014", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("26-MAY-2014", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("27-JUL-2014", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("28-JUL-2014", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("29-JUL-2014", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("30-JUL-2014", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("31-JUL-2014", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-OCT-2014", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-OCT-2014", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-OCT-2014", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-OCT-2014", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-OCT-2014", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-OCT-2014", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-OCT-2014", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2015", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("25-FEB-2015", "National Day"); - - lh.addStaticHoliday ("26-FEB-2015", "National Day"); - - lh.addStaticHoliday ("14-MAY-2015", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("16-JUL-2015", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("19-JUL-2015", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("20-JUL-2015", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("21-JUL-2015", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("21-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("22-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("27-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-OCT-2015", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("14-OCT-2015", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("15-OCT-2015", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("22-DEC-2015", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("23-DEC-2015", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("24-DEC-2015", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("03-JAN-2016", "New Years Day Observed"); - - lh.addStaticHoliday ("25-FEB-2016", "National Day"); - - lh.addStaticHoliday ("28-FEB-2016", "National Day Observed"); - - lh.addStaticHoliday ("02-MAY-2016", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("03-MAY-2016", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("04-MAY-2016", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("04-JUL-2016", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("05-JUL-2016", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("06-JUL-2016", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("07-JUL-2016", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("11-SEP-2016", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("12-SEP-2016", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-SEP-2016", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("14-SEP-2016", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("15-SEP-2016", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-OCT-2016", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("03-OCT-2016", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("11-DEC-2016", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("12-DEC-2016", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2017", "New Years Day"); - - lh.addStaticHoliday ("26-FEB-2017", "National Day"); - - lh.addStaticHoliday ("27-FEB-2017", "National Day Observed"); - - lh.addStaticHoliday ("23-APR-2017", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("24-APR-2017", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("25-JUN-2017", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-JUN-2017", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("27-JUN-2017", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("28-JUN-2017", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("29-AUG-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("30-AUG-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("31-AUG-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-SEP-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-SEP-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-SEP-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-SEP-2017", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("21-SEP-2017", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("29-NOV-2017", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("30-NOV-2017", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("25-FEB-2018", "National Day"); - - lh.addStaticHoliday ("26-FEB-2018", "National Day"); - - lh.addStaticHoliday ("11-APR-2018", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("12-APR-2018", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("13-JUN-2018", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("14-JUN-2018", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("17-JUN-2018", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("18-JUN-2018", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("19-AUG-2018", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-AUG-2018", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("21-AUG-2018", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("22-AUG-2018", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-AUG-2018", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("26-AUG-2018", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-SEP-2018", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("10-SEP-2018", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("11-SEP-2018", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("18-NOV-2018", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("19-NOV-2018", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("20-NOV-2018", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("25-FEB-2019", "National Day"); - - lh.addStaticHoliday ("26-FEB-2019", "National Day"); - - lh.addStaticHoliday ("31-MAR-2019", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("01-APR-2019", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("02-APR-2019", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("03-JUN-2019", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("04-JUN-2019", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("05-JUN-2019", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("06-JUN-2019", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("08-AUG-2019", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-AUG-2019", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("12-AUG-2019", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-AUG-2019", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("14-AUG-2019", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("15-AUG-2019", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-AUG-2019", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("07-NOV-2019", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("25-FEB-2020", "National Day"); - - lh.addStaticHoliday ("26-FEB-2020", "National Day"); - - lh.addStaticHoliday ("19-MAR-2020", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("24-MAY-2020", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("25-MAY-2020", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-MAY-2020", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("27-MAY-2020", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("28-JUL-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-JUL-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("30-JUL-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-AUG-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-AUG-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-AUG-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-AUG-2020", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("19-AUG-2020", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("20-AUG-2020", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("27-OCT-2020", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("28-OCT-2020", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("29-OCT-2020", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("03-JAN-2021", "New Years Day Observed"); - - lh.addStaticHoliday ("25-FEB-2021", "National Day"); - - lh.addStaticHoliday ("28-FEB-2021", "National Day Observed"); - - lh.addStaticHoliday ("09-MAR-2021", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("10-MAR-2021", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("11-MAR-2021", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("11-MAY-2021", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("12-MAY-2021", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("13-MAY-2021", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("16-MAY-2021", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("18-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("21-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("22-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-AUG-2021", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("09-AUG-2021", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("10-AUG-2021", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("17-OCT-2021", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("18-OCT-2021", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("02-JAN-2022", "New Years Day Observed"); - - lh.addStaticHoliday ("27-FEB-2022", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("28-FEB-2022", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("01-MAY-2022", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-MAY-2022", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("03-MAY-2022", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("04-MAY-2022", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("05-MAY-2022", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("06-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("12-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-JUL-2022", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("06-OCT-2022", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2023", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2023", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("26-FEB-2023", "National Day"); - - lh.addStaticHoliday ("27-FEB-2023", "National Day Observed"); - - lh.addStaticHoliday ("20-APR-2023", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("23-APR-2023", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("24-APR-2023", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("25-APR-2023", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-JUN-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("27-JUN-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-JUN-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-JUN-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-JUL-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-JUL-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-JUL-2023", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("18-JUL-2023", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("19-JUL-2023", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("25-SEP-2023", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("26-SEP-2023", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("27-SEP-2023", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2024", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("06-FEB-2024", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("07-FEB-2024", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("25-FEB-2024", "National Day"); - - lh.addStaticHoliday ("26-FEB-2024", "National Day"); - - lh.addStaticHoliday ("08-APR-2024", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("09-APR-2024", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("10-APR-2024", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("11-APR-2024", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("16-JUN-2024", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-JUN-2024", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-JUN-2024", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-JUN-2024", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-JUN-2024", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-JUL-2024", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("15-SEP-2024", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2025", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("27-JAN-2025", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("25-FEB-2025", "National Day"); - - lh.addStaticHoliday ("26-FEB-2025", "National Day"); - - lh.addStaticHoliday ("30-MAR-2025", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("31-MAR-2025", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-APR-2025", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-APR-2025", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("03-APR-2025", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("03-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-JUN-2025", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("25-JUN-2025", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("26-JUN-2025", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("02-SEP-2025", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("03-SEP-2025", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("04-SEP-2025", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("14-JAN-2026", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("15-JAN-2026", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("25-FEB-2026", "National Day"); - - lh.addStaticHoliday ("26-FEB-2026", "National Day"); - - lh.addStaticHoliday ("18-MAR-2026", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("19-MAR-2026", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("22-MAR-2026", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("23-MAR-2026", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("24-MAY-2026", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-MAY-2026", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("26-MAY-2026", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("27-MAY-2026", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-MAY-2026", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("31-MAY-2026", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("14-JUN-2026", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("15-JUN-2026", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("16-JUN-2026", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("23-AUG-2026", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("24-AUG-2026", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("25-AUG-2026", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("03-JAN-2027", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("04-JAN-2027", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("05-JAN-2027", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("25-FEB-2027", "National Day"); - - lh.addStaticHoliday ("28-FEB-2027", "National Day Observed"); - - lh.addStaticHoliday ("08-MAR-2027", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("09-MAR-2027", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("10-MAR-2027", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("11-MAR-2027", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("16-MAY-2027", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-MAY-2027", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-MAY-2027", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-MAY-2027", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-MAY-2027", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-JUN-2027", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("15-AUG-2027", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("23-DEC-2027", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("02-JAN-2028", "New Years Day Observed"); - - lh.addStaticHoliday ("27-FEB-2028", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("28-FEB-2028", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("29-FEB-2028", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-MAR-2028", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-MAY-2028", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-MAY-2028", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-MAY-2028", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-MAY-2028", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-MAY-2028", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-MAY-2028", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-MAY-2028", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("24-MAY-2028", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("25-MAY-2028", "Al Hijrah New Year Holiday Period"); - - lh.addStaticHoliday ("01-AUG-2028", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("02-AUG-2028", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("03-AUG-2028", "Prophet Muhammads Birthday Holiday Period"); - - lh.addStaticHoliday ("11-DEC-2028", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("12-DEC-2028", "Ascension of Muhammad Holiday Period"); - - lh.addStaticHoliday ("13-DEC-2028", "Ascension of Muhammad Holiday Period"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/KYDHoliday.java b/org/drip/analytics/holset/KYDHoliday.java deleted file mode 100644 index 3d3c90c..0000000 --- a/org/drip/analytics/holset/KYDHoliday.java +++ /dev/null @@ -1,679 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class KYDHoliday implements org.drip.analytics.holset.LocationHoliday { - public KYDHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "KYD"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("25-FEB-1998", "Ash Wednesday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("18-MAY-1998", "Discovery Day"); - - lh.addStaticHoliday ("15-JUN-1998", "Queens Birthday"); - - lh.addStaticHoliday ("06-JUL-1998", "Constitution Day"); - - lh.addStaticHoliday ("09-NOV-1998", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-1998", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("17-FEB-1999", "Ash Wednesday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("17-MAY-1999", "Discovery Day"); - - lh.addStaticHoliday ("14-JUN-1999", "Queens Birthday"); - - lh.addStaticHoliday ("05-JUL-1999", "Constitution Day"); - - lh.addStaticHoliday ("15-NOV-1999", "Remembrance Day"); - - lh.addStaticHoliday ("27-DEC-1999", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-1999", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2000", "New Years Day Observed"); - - lh.addStaticHoliday ("08-MAR-2000", "Ash Wednesday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("15-MAY-2000", "Discovery Day"); - - lh.addStaticHoliday ("12-JUN-2000", "Queens Birthday"); - - lh.addStaticHoliday ("03-JUL-2000", "Constitution Day"); - - lh.addStaticHoliday ("13-NOV-2000", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("28-FEB-2001", "Ash Wednesday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("21-MAY-2001", "Discovery Day"); - - lh.addStaticHoliday ("11-JUN-2001", "Queens Birthday"); - - lh.addStaticHoliday ("02-JUL-2001", "Constitution Day"); - - lh.addStaticHoliday ("12-NOV-2001", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("13-FEB-2002", "Ash Wednesday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("20-MAY-2002", "Discovery Day"); - - lh.addStaticHoliday ("10-JUN-2002", "Queens Birthday"); - - lh.addStaticHoliday ("01-JUL-2002", "Constitution Day"); - - lh.addStaticHoliday ("11-NOV-2002", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("05-MAR-2003", "Ash Wednesday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("19-MAY-2003", "Discovery Day"); - - lh.addStaticHoliday ("16-JUN-2003", "Queens Birthday"); - - lh.addStaticHoliday ("07-JUL-2003", "Constitution Day"); - - lh.addStaticHoliday ("10-NOV-2003", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("25-FEB-2004", "Ash Wednesday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("17-MAY-2004", "Discovery Day"); - - lh.addStaticHoliday ("14-JUN-2004", "Queens Birthday"); - - lh.addStaticHoliday ("05-JUL-2004", "Constitution Day"); - - lh.addStaticHoliday ("15-NOV-2004", "Remembrance Day"); - - lh.addStaticHoliday ("27-DEC-2004", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2004", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2005", "New Years Day Observed"); - - lh.addStaticHoliday ("09-FEB-2005", "Ash Wednesday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("16-MAY-2005", "Discovery Day"); - - lh.addStaticHoliday ("13-JUN-2005", "Queens Birthday"); - - lh.addStaticHoliday ("04-JUL-2005", "Constitution Day"); - - lh.addStaticHoliday ("14-NOV-2005", "Remembrance Day"); - - lh.addStaticHoliday ("26-DEC-2005", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2005", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("01-MAR-2006", "Ash Wednesday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("15-MAY-2006", "Discovery Day"); - - lh.addStaticHoliday ("12-JUN-2006", "Queens Birthday"); - - lh.addStaticHoliday ("03-JUL-2006", "Constitution Day"); - - lh.addStaticHoliday ("13-NOV-2006", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("21-FEB-2007", "Ash Wednesday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("21-MAY-2007", "Discovery Day"); - - lh.addStaticHoliday ("11-JUN-2007", "Queens Birthday"); - - lh.addStaticHoliday ("02-JUL-2007", "Constitution Day"); - - lh.addStaticHoliday ("12-NOV-2007", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("06-FEB-2008", "Ash Wednesday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("19-MAY-2008", "Discovery Day"); - - lh.addStaticHoliday ("16-JUN-2008", "Queens Birthday"); - - lh.addStaticHoliday ("07-JUL-2008", "Constitution Day"); - - lh.addStaticHoliday ("10-NOV-2008", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("25-FEB-2009", "Ash Wednesday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("18-MAY-2009", "Discovery Day"); - - lh.addStaticHoliday ("15-JUN-2009", "Queens Birthday"); - - lh.addStaticHoliday ("06-JUL-2009", "Constitution Day"); - - lh.addStaticHoliday ("09-NOV-2009", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2009", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("17-FEB-2010", "Ash Wednesday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("17-MAY-2010", "Discovery Day"); - - lh.addStaticHoliday ("14-JUN-2010", "Queens Birthday"); - - lh.addStaticHoliday ("05-JUL-2010", "Constitution Day"); - - lh.addStaticHoliday ("15-NOV-2010", "Remembrance Day"); - - lh.addStaticHoliday ("27-DEC-2010", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2010", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2011", "New Years Day Observed"); - - lh.addStaticHoliday ("09-MAR-2011", "Ash Wednesday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("16-MAY-2011", "Discovery Day"); - - lh.addStaticHoliday ("13-JUN-2011", "Queens Birthday"); - - lh.addStaticHoliday ("04-JUL-2011", "Constitution Day"); - - lh.addStaticHoliday ("14-NOV-2011", "Remembrance Day"); - - lh.addStaticHoliday ("26-DEC-2011", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2011", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("22-FEB-2012", "Ash Wednesday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("21-MAY-2012", "Discovery Day"); - - lh.addStaticHoliday ("11-JUN-2012", "Queens Birthday"); - - lh.addStaticHoliday ("02-JUL-2012", "Constitution Day"); - - lh.addStaticHoliday ("12-NOV-2012", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("13-FEB-2013", "Ash Wednesday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("20-MAY-2013", "Discovery Day"); - - lh.addStaticHoliday ("10-JUN-2013", "Queens Birthday"); - - lh.addStaticHoliday ("01-JUL-2013", "Constitution Day"); - - lh.addStaticHoliday ("11-NOV-2013", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("05-MAR-2014", "Ash Wednesday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("19-MAY-2014", "Discovery Day"); - - lh.addStaticHoliday ("16-JUN-2014", "Queens Birthday"); - - lh.addStaticHoliday ("07-JUL-2014", "Constitution Day"); - - lh.addStaticHoliday ("10-NOV-2014", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("18-FEB-2015", "Ash Wednesday"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("18-MAY-2015", "Discovery Day"); - - lh.addStaticHoliday ("15-JUN-2015", "Queens Birthday"); - - lh.addStaticHoliday ("06-JUL-2015", "Constitution Day"); - - lh.addStaticHoliday ("09-NOV-2015", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2015", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("10-FEB-2016", "Ash Wednesday"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("16-MAY-2016", "Discovery Day"); - - lh.addStaticHoliday ("13-JUN-2016", "Queens Birthday"); - - lh.addStaticHoliday ("04-JUL-2016", "Constitution Day"); - - lh.addStaticHoliday ("14-NOV-2016", "Remembrance Day"); - - lh.addStaticHoliday ("26-DEC-2016", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2016", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("01-MAR-2017", "Ash Wednesday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("15-MAY-2017", "Discovery Day"); - - lh.addStaticHoliday ("12-JUN-2017", "Queens Birthday"); - - lh.addStaticHoliday ("03-JUL-2017", "Constitution Day"); - - lh.addStaticHoliday ("13-NOV-2017", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("14-FEB-2018", "Ash Wednesday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("21-MAY-2018", "Discovery Day"); - - lh.addStaticHoliday ("11-JUN-2018", "Queens Birthday"); - - lh.addStaticHoliday ("02-JUL-2018", "Constitution Day"); - - lh.addStaticHoliday ("12-NOV-2018", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("06-MAR-2019", "Ash Wednesday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("20-MAY-2019", "Discovery Day"); - - lh.addStaticHoliday ("10-JUN-2019", "Queens Birthday"); - - lh.addStaticHoliday ("01-JUL-2019", "Constitution Day"); - - lh.addStaticHoliday ("11-NOV-2019", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("26-FEB-2020", "Ash Wednesday"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("18-MAY-2020", "Discovery Day"); - - lh.addStaticHoliday ("15-JUN-2020", "Queens Birthday"); - - lh.addStaticHoliday ("06-JUL-2020", "Constitution Day"); - - lh.addStaticHoliday ("09-NOV-2020", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2020", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("17-FEB-2021", "Ash Wednesday"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("17-MAY-2021", "Discovery Day"); - - lh.addStaticHoliday ("14-JUN-2021", "Queens Birthday"); - - lh.addStaticHoliday ("05-JUL-2021", "Constitution Day"); - - lh.addStaticHoliday ("15-NOV-2021", "Remembrance Day"); - - lh.addStaticHoliday ("27-DEC-2021", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2021", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2022", "New Years Day Observed"); - - lh.addStaticHoliday ("02-MAR-2022", "Ash Wednesday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("16-MAY-2022", "Discovery Day"); - - lh.addStaticHoliday ("13-JUN-2022", "Queens Birthday"); - - lh.addStaticHoliday ("04-JUL-2022", "Constitution Day"); - - lh.addStaticHoliday ("14-NOV-2022", "Remembrance Day"); - - lh.addStaticHoliday ("26-DEC-2022", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2022", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("22-FEB-2023", "Ash Wednesday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("15-MAY-2023", "Discovery Day"); - - lh.addStaticHoliday ("12-JUN-2023", "Queens Birthday"); - - lh.addStaticHoliday ("03-JUL-2023", "Constitution Day"); - - lh.addStaticHoliday ("13-NOV-2023", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("14-FEB-2024", "Ash Wednesday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("20-MAY-2024", "Discovery Day"); - - lh.addStaticHoliday ("10-JUN-2024", "Queens Birthday"); - - lh.addStaticHoliday ("01-JUL-2024", "Constitution Day"); - - lh.addStaticHoliday ("11-NOV-2024", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("05-MAR-2025", "Ash Wednesday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("19-MAY-2025", "Discovery Day"); - - lh.addStaticHoliday ("16-JUN-2025", "Queens Birthday"); - - lh.addStaticHoliday ("07-JUL-2025", "Constitution Day"); - - lh.addStaticHoliday ("10-NOV-2025", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("18-FEB-2026", "Ash Wednesday"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("18-MAY-2026", "Discovery Day"); - - lh.addStaticHoliday ("15-JUN-2026", "Queens Birthday"); - - lh.addStaticHoliday ("06-JUL-2026", "Constitution Day"); - - lh.addStaticHoliday ("09-NOV-2026", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2026", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("10-FEB-2027", "Ash Wednesday"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("17-MAY-2027", "Discovery Day"); - - lh.addStaticHoliday ("14-JUN-2027", "Queens Birthday"); - - lh.addStaticHoliday ("05-JUL-2027", "Constitution Day"); - - lh.addStaticHoliday ("15-NOV-2027", "Remembrance Day"); - - lh.addStaticHoliday ("27-DEC-2027", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2027", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2028", "New Years Day Observed"); - - lh.addStaticHoliday ("01-MAR-2028", "Ash Wednesday"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("15-MAY-2028", "Discovery Day"); - - lh.addStaticHoliday ("12-JUN-2028", "Queens Birthday"); - - lh.addStaticHoliday ("03-JUL-2028", "Constitution Day"); - - lh.addStaticHoliday ("13-NOV-2028", "Remembrance Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Boxing Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/KZTHoliday.java b/org/drip/analytics/holset/KZTHoliday.java deleted file mode 100644 index 92ca077..0000000 --- a/org/drip/analytics/holset/KZTHoliday.java +++ /dev/null @@ -1,517 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class KZTHoliday implements org.drip.analytics.holset.LocationHoliday { - public KZTHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "KZT"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-1998", "New Years Holiday"); - - lh.addStaticHoliday ("01-MAY-1998", "Kazakstan People Unity Day"); - - lh.addStaticHoliday ("16-DEC-1998", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("08-MAR-1999", "Womens Day"); - - lh.addStaticHoliday ("22-MAR-1999", "Nau-Ruz"); - - lh.addStaticHoliday ("30-AUG-1999", "Constitution Day"); - - lh.addStaticHoliday ("25-OCT-1999", "Republic Day"); - - lh.addStaticHoliday ("16-DEC-1999", "Independence Day"); - - lh.addStaticHoliday ("17-DEC-1999", "Bridging Day"); - - lh.addStaticHoliday ("08-MAR-2000", "Womens Day"); - - lh.addStaticHoliday ("22-MAR-2000", "Nau-Ruz"); - - lh.addStaticHoliday ("01-MAY-2000", "Kazakstan People Unity Day"); - - lh.addStaticHoliday ("09-MAY-2000", "Victory Day"); - - lh.addStaticHoliday ("30-AUG-2000", "Constitution Day"); - - lh.addStaticHoliday ("25-OCT-2000", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2001", "New Years Holiday"); - - lh.addStaticHoliday ("08-MAR-2001", "Womens Day"); - - lh.addStaticHoliday ("09-MAR-2001", "Bridging Day"); - - lh.addStaticHoliday ("22-MAR-2001", "Nau-Ruz"); - - lh.addStaticHoliday ("23-MAR-2001", "Bridging Day"); - - lh.addStaticHoliday ("01-MAY-2001", "Kazakstan People Unity Day"); - - lh.addStaticHoliday ("09-MAY-2001", "Victory Day"); - - lh.addStaticHoliday ("30-AUG-2001", "Constitution Day"); - - lh.addStaticHoliday ("31-AUG-2001", "Bridging Day"); - - lh.addStaticHoliday ("25-OCT-2001", "Republic Day"); - - lh.addStaticHoliday ("26-OCT-2001", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2002", "New Years Holiday"); - - lh.addStaticHoliday ("08-MAR-2002", "Womens Day"); - - lh.addStaticHoliday ("22-MAR-2002", "Nau-Ruz"); - - lh.addStaticHoliday ("01-MAY-2002", "Kazakstan People Unity Day"); - - lh.addStaticHoliday ("09-MAY-2002", "Victory Day"); - - lh.addStaticHoliday ("10-MAY-2002", "Bridging Day"); - - lh.addStaticHoliday ("30-AUG-2002", "Constitution Day"); - - lh.addStaticHoliday ("25-OCT-2002", "Republic Day"); - - lh.addStaticHoliday ("16-DEC-2002", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2003", "New Years Holiday"); - - lh.addStaticHoliday ("03-JAN-2003", "Bridging Day"); - - lh.addStaticHoliday ("01-MAY-2003", "Kazakstan People Unity Day"); - - lh.addStaticHoliday ("02-MAY-2003", "Bridging Day"); - - lh.addStaticHoliday ("09-MAY-2003", "Victory Day"); - - lh.addStaticHoliday ("16-DEC-2003", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2004", "New Years Holiday"); - - lh.addStaticHoliday ("08-MAR-2004", "Womens Day"); - - lh.addStaticHoliday ("22-MAR-2004", "Nau-Ruz"); - - lh.addStaticHoliday ("30-AUG-2004", "Constitution Day"); - - lh.addStaticHoliday ("25-OCT-2004", "Republic Day"); - - lh.addStaticHoliday ("16-DEC-2004", "Independence Day"); - - lh.addStaticHoliday ("17-DEC-2004", "Bridging Day"); - - lh.addStaticHoliday ("08-MAR-2005", "Womens Day"); - - lh.addStaticHoliday ("22-MAR-2005", "Nau-Ruz"); - - lh.addStaticHoliday ("09-MAY-2005", "Victory Day"); - - lh.addStaticHoliday ("30-AUG-2005", "Constitution Day"); - - lh.addStaticHoliday ("25-OCT-2005", "Republic Day"); - - lh.addStaticHoliday ("16-DEC-2005", "Independence Day"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Holiday"); - - lh.addStaticHoliday ("08-MAR-2006", "Womens Day"); - - lh.addStaticHoliday ("22-MAR-2006", "Nau-Ruz"); - - lh.addStaticHoliday ("01-MAY-2006", "Kazakstan People Unity Day"); - - lh.addStaticHoliday ("09-MAY-2006", "Victory Day"); - - lh.addStaticHoliday ("30-AUG-2006", "Constitution Day"); - - lh.addStaticHoliday ("25-OCT-2006", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2007", "New Years Holiday"); - - lh.addStaticHoliday ("08-MAR-2007", "Womens Day"); - - lh.addStaticHoliday ("09-MAR-2007", "Bridging Day"); - - lh.addStaticHoliday ("22-MAR-2007", "Nau-Ruz"); - - lh.addStaticHoliday ("23-MAR-2007", "Bridging Day"); - - lh.addStaticHoliday ("01-MAY-2007", "Kazakstan People Unity Day"); - - lh.addStaticHoliday ("09-MAY-2007", "Victory Day"); - - lh.addStaticHoliday ("30-AUG-2007", "Constitution Day"); - - lh.addStaticHoliday ("31-AUG-2007", "Bridging Day"); - - lh.addStaticHoliday ("25-OCT-2007", "Republic Day"); - - lh.addStaticHoliday ("26-OCT-2007", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2008", "New Years Holiday"); - - lh.addStaticHoliday ("01-MAY-2008", "Kazakstan People Unity Day"); - - lh.addStaticHoliday ("02-MAY-2008", "Bridging Day"); - - lh.addStaticHoliday ("09-MAY-2008", "Victory Day"); - - lh.addStaticHoliday ("16-DEC-2008", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2009", "New Years Holiday"); - - lh.addStaticHoliday ("01-MAY-2009", "Kazakstan People Unity Day"); - - lh.addStaticHoliday ("16-DEC-2009", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("08-MAR-2010", "Womens Day"); - - lh.addStaticHoliday ("22-MAR-2010", "Nau-Ruz"); - - lh.addStaticHoliday ("30-AUG-2010", "Constitution Day"); - - lh.addStaticHoliday ("25-OCT-2010", "Republic Day"); - - lh.addStaticHoliday ("16-DEC-2010", "Independence Day"); - - lh.addStaticHoliday ("17-DEC-2010", "Bridging Day"); - - lh.addStaticHoliday ("08-MAR-2011", "Womens Day"); - - lh.addStaticHoliday ("22-MAR-2011", "Nau-Ruz"); - - lh.addStaticHoliday ("09-MAY-2011", "Victory Day"); - - lh.addStaticHoliday ("30-AUG-2011", "Constitution Day"); - - lh.addStaticHoliday ("25-OCT-2011", "Republic Day"); - - lh.addStaticHoliday ("16-DEC-2011", "Independence Day"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Holiday"); - - lh.addStaticHoliday ("08-MAR-2012", "Womens Day"); - - lh.addStaticHoliday ("09-MAR-2012", "Bridging Day"); - - lh.addStaticHoliday ("22-MAR-2012", "Nau-Ruz"); - - lh.addStaticHoliday ("23-MAR-2012", "Bridging Day"); - - lh.addStaticHoliday ("01-MAY-2012", "Kazakstan People Unity Day"); - - lh.addStaticHoliday ("09-MAY-2012", "Victory Day"); - - lh.addStaticHoliday ("30-AUG-2012", "Constitution Day"); - - lh.addStaticHoliday ("31-AUG-2012", "Bridging Day"); - - lh.addStaticHoliday ("25-OCT-2012", "Republic Day"); - - lh.addStaticHoliday ("26-OCT-2012", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2013", "New Years Holiday"); - - lh.addStaticHoliday ("08-MAR-2013", "Womens Day"); - - lh.addStaticHoliday ("22-MAR-2013", "Nau-Ruz"); - - lh.addStaticHoliday ("01-MAY-2013", "Kazakstan People Unity Day"); - - lh.addStaticHoliday ("09-MAY-2013", "Victory Day"); - - lh.addStaticHoliday ("10-MAY-2013", "Bridging Day"); - - lh.addStaticHoliday ("30-AUG-2013", "Constitution Day"); - - lh.addStaticHoliday ("25-OCT-2013", "Republic Day"); - - lh.addStaticHoliday ("16-DEC-2013", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2014", "New Years Holiday"); - - lh.addStaticHoliday ("03-JAN-2014", "Bridging Day"); - - lh.addStaticHoliday ("01-MAY-2014", "Kazakstan People Unity Day"); - - lh.addStaticHoliday ("02-MAY-2014", "Bridging Day"); - - lh.addStaticHoliday ("09-MAY-2014", "Victory Day"); - - lh.addStaticHoliday ("16-DEC-2014", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2015", "New Years Holiday"); - - lh.addStaticHoliday ("01-MAY-2015", "Kazakstan People Unity Day"); - - lh.addStaticHoliday ("16-DEC-2015", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("08-MAR-2016", "Womens Day"); - - lh.addStaticHoliday ("22-MAR-2016", "Nau-Ruz"); - - lh.addStaticHoliday ("09-MAY-2016", "Victory Day"); - - lh.addStaticHoliday ("30-AUG-2016", "Constitution Day"); - - lh.addStaticHoliday ("25-OCT-2016", "Republic Day"); - - lh.addStaticHoliday ("16-DEC-2016", "Independence Day"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Holiday"); - - lh.addStaticHoliday ("08-MAR-2017", "Womens Day"); - - lh.addStaticHoliday ("22-MAR-2017", "Nau-Ruz"); - - lh.addStaticHoliday ("01-MAY-2017", "Kazakstan People Unity Day"); - - lh.addStaticHoliday ("09-MAY-2017", "Victory Day"); - - lh.addStaticHoliday ("30-AUG-2017", "Constitution Day"); - - lh.addStaticHoliday ("25-OCT-2017", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2018", "New Years Holiday"); - - lh.addStaticHoliday ("08-MAR-2018", "Womens Day"); - - lh.addStaticHoliday ("09-MAR-2018", "Bridging Day"); - - lh.addStaticHoliday ("22-MAR-2018", "Nau-Ruz"); - - lh.addStaticHoliday ("23-MAR-2018", "Bridging Day"); - - lh.addStaticHoliday ("01-MAY-2018", "Kazakstan People Unity Day"); - - lh.addStaticHoliday ("09-MAY-2018", "Victory Day"); - - lh.addStaticHoliday ("30-AUG-2018", "Constitution Day"); - - lh.addStaticHoliday ("31-AUG-2018", "Bridging Day"); - - lh.addStaticHoliday ("25-OCT-2018", "Republic Day"); - - lh.addStaticHoliday ("26-OCT-2018", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2019", "New Years Holiday"); - - lh.addStaticHoliday ("08-MAR-2019", "Womens Day"); - - lh.addStaticHoliday ("22-MAR-2019", "Nau-Ruz"); - - lh.addStaticHoliday ("01-MAY-2019", "Kazakstan People Unity Day"); - - lh.addStaticHoliday ("09-MAY-2019", "Victory Day"); - - lh.addStaticHoliday ("10-MAY-2019", "Bridging Day"); - - lh.addStaticHoliday ("30-AUG-2019", "Constitution Day"); - - lh.addStaticHoliday ("25-OCT-2019", "Republic Day"); - - lh.addStaticHoliday ("16-DEC-2019", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2020", "New Years Holiday"); - - lh.addStaticHoliday ("03-JAN-2020", "Bridging Day"); - - lh.addStaticHoliday ("01-MAY-2020", "Kazakstan People Unity Day"); - - lh.addStaticHoliday ("16-DEC-2020", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("08-MAR-2021", "Womens Day"); - - lh.addStaticHoliday ("22-MAR-2021", "Nau-Ruz"); - - lh.addStaticHoliday ("30-AUG-2021", "Constitution Day"); - - lh.addStaticHoliday ("25-OCT-2021", "Republic Day"); - - lh.addStaticHoliday ("16-DEC-2021", "Independence Day"); - - lh.addStaticHoliday ("17-DEC-2021", "Bridging Day"); - - lh.addStaticHoliday ("08-MAR-2022", "Womens Day"); - - lh.addStaticHoliday ("22-MAR-2022", "Nau-Ruz"); - - lh.addStaticHoliday ("09-MAY-2022", "Victory Day"); - - lh.addStaticHoliday ("30-AUG-2022", "Constitution Day"); - - lh.addStaticHoliday ("25-OCT-2022", "Republic Day"); - - lh.addStaticHoliday ("16-DEC-2022", "Independence Day"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Holiday"); - - lh.addStaticHoliday ("08-MAR-2023", "Womens Day"); - - lh.addStaticHoliday ("22-MAR-2023", "Nau-Ruz"); - - lh.addStaticHoliday ("01-MAY-2023", "Kazakstan People Unity Day"); - - lh.addStaticHoliday ("09-MAY-2023", "Victory Day"); - - lh.addStaticHoliday ("30-AUG-2023", "Constitution Day"); - - lh.addStaticHoliday ("25-OCT-2023", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2024", "New Years Holiday"); - - lh.addStaticHoliday ("08-MAR-2024", "Womens Day"); - - lh.addStaticHoliday ("22-MAR-2024", "Nau-Ruz"); - - lh.addStaticHoliday ("01-MAY-2024", "Kazakstan People Unity Day"); - - lh.addStaticHoliday ("09-MAY-2024", "Victory Day"); - - lh.addStaticHoliday ("10-MAY-2024", "Bridging Day"); - - lh.addStaticHoliday ("30-AUG-2024", "Constitution Day"); - - lh.addStaticHoliday ("25-OCT-2024", "Republic Day"); - - lh.addStaticHoliday ("16-DEC-2024", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2025", "New Years Holiday"); - - lh.addStaticHoliday ("03-JAN-2025", "Bridging Day"); - - lh.addStaticHoliday ("01-MAY-2025", "Kazakstan People Unity Day"); - - lh.addStaticHoliday ("02-MAY-2025", "Bridging Day"); - - lh.addStaticHoliday ("09-MAY-2025", "Victory Day"); - - lh.addStaticHoliday ("16-DEC-2025", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2026", "New Years Holiday"); - - lh.addStaticHoliday ("01-MAY-2026", "Kazakstan People Unity Day"); - - lh.addStaticHoliday ("16-DEC-2026", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("08-MAR-2027", "Womens Day"); - - lh.addStaticHoliday ("22-MAR-2027", "Nau-Ruz"); - - lh.addStaticHoliday ("30-AUG-2027", "Constitution Day"); - - lh.addStaticHoliday ("25-OCT-2027", "Republic Day"); - - lh.addStaticHoliday ("16-DEC-2027", "Independence Day"); - - lh.addStaticHoliday ("17-DEC-2027", "Bridging Day"); - - lh.addStaticHoliday ("08-MAR-2028", "Womens Day"); - - lh.addStaticHoliday ("22-MAR-2028", "Nau-Ruz"); - - lh.addStaticHoliday ("01-MAY-2028", "Kazakstan People Unity Day"); - - lh.addStaticHoliday ("09-MAY-2028", "Victory Day"); - - lh.addStaticHoliday ("30-AUG-2028", "Constitution Day"); - - lh.addStaticHoliday ("25-OCT-2028", "Republic Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/LKRHoliday.java b/org/drip/analytics/holset/LKRHoliday.java deleted file mode 100644 index e339a67..0000000 --- a/org/drip/analytics/holset/LKRHoliday.java +++ /dev/null @@ -1,703 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class LKRHoliday implements org.drip.analytics.holset.LocationHoliday { - public LKRHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "LKR"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01 CHASE-JAN-1998", ""); - - lh.addStaticHoliday ("13 CHASE-APR-1998", ""); - - lh.addStaticHoliday ("01 CHASE-MAY-1998", ""); - - lh.addStaticHoliday ("21 CHASE-MAY-1998", ""); - - lh.addStaticHoliday ("01 CHASE-JUN-1998", ""); - - lh.addStaticHoliday ("23 CHASE-JUN-1998", ""); - - lh.addStaticHoliday ("02 CHASE-NOV-1998", ""); - - lh.addStaticHoliday ("25 CHASE-DEC-1998", ""); - - lh.addStaticHoliday ("01 CHASE-JAN-1999", ""); - - lh.addStaticHoliday ("05 CHASE-APR-1999", ""); - - lh.addStaticHoliday ("13 CHASE-MAY-1999", ""); - - lh.addStaticHoliday ("24 CHASE-MAY-1999", ""); - - lh.addStaticHoliday ("23 CHASE-JUN-1999", ""); - - lh.addStaticHoliday ("16 CHASE-AUG-1999", ""); - - lh.addStaticHoliday ("01 CHASE-NOV-1999", ""); - - lh.addStaticHoliday ("27 CHASE-DEC-1999", ""); - - lh.addStaticHoliday ("24 CHASE-APR-2000", ""); - - lh.addStaticHoliday ("01 CHASE-MAY-2000", ""); - - lh.addStaticHoliday ("01 CHASE-JUN-2000", ""); - - lh.addStaticHoliday ("12 CHASE-JUN-2000", ""); - - lh.addStaticHoliday ("23 CHASE-JUN-2000", ""); - - lh.addStaticHoliday ("15 CHASE-AUG-2000", ""); - - lh.addStaticHoliday ("01 CHASE-NOV-2000", ""); - - lh.addStaticHoliday ("25 CHASE-DEC-2000", ""); - - lh.addStaticHoliday ("26 CHASE-DEC-2000", ""); - - lh.addStaticHoliday ("01 CHASE-JAN-2001", ""); - - lh.addStaticHoliday ("16 CHASE-APR-2001", ""); - - lh.addStaticHoliday ("01 CHASE-MAY-2001", ""); - - lh.addStaticHoliday ("24 CHASE-MAY-2001", ""); - - lh.addStaticHoliday ("04 CHASE-JUN-2001", ""); - - lh.addStaticHoliday ("15 CHASE-AUG-2001", ""); - - lh.addStaticHoliday ("01 CHASE-NOV-2001", ""); - - lh.addStaticHoliday ("25 CHASE-DEC-2001", ""); - - lh.addStaticHoliday ("26 CHASE-DEC-2001", ""); - - lh.addStaticHoliday ("01 CHASE-JAN-2002", ""); - - lh.addStaticHoliday ("01 CHASE-APR-2002", ""); - - lh.addStaticHoliday ("01 CHASE-MAY-2002", ""); - - lh.addStaticHoliday ("09 CHASE-MAY-2002", ""); - - lh.addStaticHoliday ("20 CHASE-MAY-2002", ""); - - lh.addStaticHoliday ("24 CHASE-JUN-2002", ""); - - lh.addStaticHoliday ("15 CHASE-AUG-2002", ""); - - lh.addStaticHoliday ("01 CHASE-NOV-2002", ""); - - lh.addStaticHoliday ("25 CHASE-DEC-2002", ""); - - lh.addStaticHoliday ("26 CHASE-DEC-2002", ""); - - lh.addStaticHoliday ("01 CHASE-JAN-2003", ""); - - lh.addStaticHoliday ("21 CHASE-APR-2003", ""); - - lh.addStaticHoliday ("01 CHASE-MAY-2003", ""); - - lh.addStaticHoliday ("29 CHASE-MAY-2003", ""); - - lh.addStaticHoliday ("09 CHASE-JUN-2003", ""); - - lh.addStaticHoliday ("23 CHASE-JUN-2003", ""); - - lh.addStaticHoliday ("15 CHASE-AUG-2003", ""); - - lh.addStaticHoliday ("25 CHASE-DEC-2003", ""); - - lh.addStaticHoliday ("26 CHASE-DEC-2003", ""); - - lh.addStaticHoliday ("01 CHASE-JAN-2004", ""); - - lh.addStaticHoliday ("09-APR-2004", "IRFE"); - - lh.addStaticHoliday ("12 BOTH-APR-2004", ""); - - lh.addStaticHoliday ("20 BOTH-MAY-2004", ""); - - lh.addStaticHoliday ("31 BOTH-MAY-2004", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2004", ""); - - lh.addStaticHoliday ("16 BOTH-AUG-2004", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2004", ""); - - lh.addStaticHoliday ("27 BOTH-DEC-2004", ""); - - lh.addStaticHoliday ("31-DEC-2004", "IRFE"); - - lh.addStaticHoliday ("25-MAR-2005", "IRFE"); - - lh.addStaticHoliday ("28 BOTH-MAR-2005", ""); - - lh.addStaticHoliday ("02 BOTH-MAY-2005", ""); - - lh.addStaticHoliday ("05 BOTH-MAY-2005", ""); - - lh.addStaticHoliday ("16 BOTH-MAY-2005", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2005", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2005", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2005", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2005", ""); - - lh.addStaticHoliday ("27 BOTH-DEC-2005", ""); - - lh.addStaticHoliday ("02 BOTH-JAN-2006", ""); - - lh.addStaticHoliday ("14-APR-2006", "IRFE"); - - lh.addStaticHoliday ("17 BOTH-APR-2006", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2006", ""); - - lh.addStaticHoliday ("25 BOTH-MAY-2006", ""); - - lh.addStaticHoliday ("05 BOTH-JUN-2006", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2006", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2006", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2006", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2006", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2006", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2007", ""); - - lh.addStaticHoliday ("06-APR-2007", "IRFE"); - - lh.addStaticHoliday ("09 BOTH-APR-2007", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2007", ""); - - lh.addStaticHoliday ("17 BOTH-MAY-2007", ""); - - lh.addStaticHoliday ("28 BOTH-MAY-2007", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2007", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2007", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2007", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2007", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2008", ""); - - lh.addStaticHoliday ("21-MAR-2008", "IRFE"); - - lh.addStaticHoliday ("24 BOTH-MAR-2008", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2008", ""); - - lh.addStaticHoliday ("12 BOTH-MAY-2008", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2008", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2008", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2008", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2008", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2009", ""); - - lh.addStaticHoliday ("10-APR-2009", "IRFE"); - - lh.addStaticHoliday ("13 BOTH-APR-2009", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2009", ""); - - lh.addStaticHoliday ("21 BOTH-MAY-2009", ""); - - lh.addStaticHoliday ("01 BOTH-JUN-2009", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2009", ""); - - lh.addStaticHoliday ("02 BOTH-NOV-2009", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2009", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2010", ""); - - lh.addStaticHoliday ("02-APR-2010", "IRFE"); - - lh.addStaticHoliday ("05 BOTH-APR-2010", ""); - - lh.addStaticHoliday ("13 BOTH-MAY-2010", ""); - - lh.addStaticHoliday ("24 BOTH-MAY-2010", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2010", ""); - - lh.addStaticHoliday ("16 BOTH-AUG-2010", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2010", ""); - - lh.addStaticHoliday ("27 BOTH-DEC-2010", ""); - - lh.addStaticHoliday ("22-APR-2011", "IRFE"); - - lh.addStaticHoliday ("25 BOTH-APR-2011", ""); - - lh.addStaticHoliday ("02 BOTH-MAY-2011", ""); - - lh.addStaticHoliday ("02 BOTH-JUN-2011", ""); - - lh.addStaticHoliday ("13 BOTH-JUN-2011", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2011", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2011", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2011", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2011", ""); - - lh.addStaticHoliday ("27 BOTH-DEC-2011", ""); - - lh.addStaticHoliday ("02 BOTH-JAN-2012", ""); - - lh.addStaticHoliday ("06-APR-2012", "IRFE"); - - lh.addStaticHoliday ("09 BOTH-APR-2012", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2012", ""); - - lh.addStaticHoliday ("17 BOTH-MAY-2012", ""); - - lh.addStaticHoliday ("28 BOTH-MAY-2012", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2012", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2012", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2012", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2012", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2013", ""); - - lh.addStaticHoliday ("29-MAR-2013", "IRFE"); - - lh.addStaticHoliday ("01 BOTH-APR-2013", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2013", ""); - - lh.addStaticHoliday ("09 BOTH-MAY-2013", ""); - - lh.addStaticHoliday ("20 BOTH-MAY-2013", ""); - - lh.addStaticHoliday ("24 BOTH-JUN-2013", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2013", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2013", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2013", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2013", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2014", ""); - - lh.addStaticHoliday ("18-APR-2014", "IRFE"); - - lh.addStaticHoliday ("21 BOTH-APR-2014", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2014", ""); - - lh.addStaticHoliday ("29 BOTH-MAY-2014", ""); - - lh.addStaticHoliday ("09 BOTH-JUN-2014", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2014", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2014", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2014", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2014", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2015", ""); - - lh.addStaticHoliday ("03-APR-2015", "IRFE"); - - lh.addStaticHoliday ("06 BOTH-APR-2015", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2015", ""); - - lh.addStaticHoliday ("14 BOTH-MAY-2015", ""); - - lh.addStaticHoliday ("25 BOTH-MAY-2015", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2015", ""); - - lh.addStaticHoliday ("02 BOTH-NOV-2015", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2015", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2016", ""); - - lh.addStaticHoliday ("25-MAR-2016", "IRFE"); - - lh.addStaticHoliday ("28 BOTH-MAR-2016", ""); - - lh.addStaticHoliday ("02 BOTH-MAY-2016", ""); - - lh.addStaticHoliday ("05 BOTH-MAY-2016", ""); - - lh.addStaticHoliday ("16 BOTH-MAY-2016", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2016", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2016", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2016", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2016", ""); - - lh.addStaticHoliday ("27 BOTH-DEC-2016", ""); - - lh.addStaticHoliday ("02 BOTH-JAN-2017", ""); - - lh.addStaticHoliday ("14-APR-2017", "IRFE"); - - lh.addStaticHoliday ("17 BOTH-APR-2017", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2017", ""); - - lh.addStaticHoliday ("25 BOTH-MAY-2017", ""); - - lh.addStaticHoliday ("05 BOTH-JUN-2017", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2017", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2017", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2017", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2017", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2017", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2018", ""); - - lh.addStaticHoliday ("30-MAR-2018", "IRFE"); - - lh.addStaticHoliday ("02 BOTH-APR-2018", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2018", ""); - - lh.addStaticHoliday ("10 BOTH-MAY-2018", ""); - - lh.addStaticHoliday ("21 BOTH-MAY-2018", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2018", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2018", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2018", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2018", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2019", ""); - - lh.addStaticHoliday ("19-APR-2019", "IRFE"); - - lh.addStaticHoliday ("22 BOTH-APR-2019", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2019", ""); - - lh.addStaticHoliday ("30 BOTH-MAY-2019", ""); - - lh.addStaticHoliday ("10 BOTH-JUN-2019", ""); - - lh.addStaticHoliday ("24 BOTH-JUN-2019", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2019", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2019", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2019", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2019", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2020", ""); - - lh.addStaticHoliday ("10-APR-2020", "IRFE"); - - lh.addStaticHoliday ("13 BOTH-APR-2020", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2020", ""); - - lh.addStaticHoliday ("21 BOTH-MAY-2020", ""); - - lh.addStaticHoliday ("01 BOTH-JUN-2020", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2020", ""); - - lh.addStaticHoliday ("02 BOTH-NOV-2020", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2020", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2021", ""); - - lh.addStaticHoliday ("02-APR-2021", "IRFE"); - - lh.addStaticHoliday ("05 BOTH-APR-2021", ""); - - lh.addStaticHoliday ("13 BOTH-MAY-2021", ""); - - lh.addStaticHoliday ("24 BOTH-MAY-2021", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2021", ""); - - lh.addStaticHoliday ("16 BOTH-AUG-2021", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2021", ""); - - lh.addStaticHoliday ("27 BOTH-DEC-2021", ""); - - lh.addStaticHoliday ("15-APR-2022", "IRFE"); - - lh.addStaticHoliday ("18 BOTH-APR-2022", ""); - - lh.addStaticHoliday ("02 BOTH-MAY-2022", ""); - - lh.addStaticHoliday ("26 BOTH-MAY-2022", ""); - - lh.addStaticHoliday ("06 BOTH-JUN-2022", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2022", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2022", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2022", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2022", ""); - - lh.addStaticHoliday ("27 BOTH-DEC-2022", ""); - - lh.addStaticHoliday ("02 BOTH-JAN-2023", ""); - - lh.addStaticHoliday ("07-APR-2023", "IRFE"); - - lh.addStaticHoliday ("10 BOTH-APR-2023", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2023", ""); - - lh.addStaticHoliday ("18 BOTH-MAY-2023", ""); - - lh.addStaticHoliday ("29 BOTH-MAY-2023", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2023", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2023", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2023", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2023", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2023", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2024", ""); - - lh.addStaticHoliday ("29-MAR-2024", "IRFE"); - - lh.addStaticHoliday ("01 BOTH-APR-2024", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2024", ""); - - lh.addStaticHoliday ("09 BOTH-MAY-2024", ""); - - lh.addStaticHoliday ("20 BOTH-MAY-2024", ""); - - lh.addStaticHoliday ("24 BOTH-JUN-2024", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2024", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2024", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2024", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2024", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2025", ""); - - lh.addStaticHoliday ("18-APR-2025", "IRFE"); - - lh.addStaticHoliday ("21 BOTH-APR-2025", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2025", ""); - - lh.addStaticHoliday ("29 BOTH-MAY-2025", ""); - - lh.addStaticHoliday ("09 BOTH-JUN-2025", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2025", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2025", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2025", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2025", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2026", ""); - - lh.addStaticHoliday ("03-APR-2026", "IRFE"); - - lh.addStaticHoliday ("06 BOTH-APR-2026", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2026", ""); - - lh.addStaticHoliday ("14 BOTH-MAY-2026", ""); - - lh.addStaticHoliday ("25 BOTH-MAY-2026", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2026", ""); - - lh.addStaticHoliday ("02 BOTH-NOV-2026", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2026", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2027", ""); - - lh.addStaticHoliday ("26-MAR-2027", "IRFE"); - - lh.addStaticHoliday ("29 BOTH-MAR-2027", ""); - - lh.addStaticHoliday ("06 BOTH-MAY-2027", ""); - - lh.addStaticHoliday ("17 BOTH-MAY-2027", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2027", ""); - - lh.addStaticHoliday ("16 BOTH-AUG-2027", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2027", ""); - - lh.addStaticHoliday ("27 BOTH-DEC-2027", ""); - - lh.addStaticHoliday ("14-APR-2028", "IRFE"); - - lh.addStaticHoliday ("17 BOTH-APR-2028", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2028", ""); - - lh.addStaticHoliday ("25 BOTH-MAY-2028", ""); - - lh.addStaticHoliday ("05 BOTH-JUN-2028", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2028", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2028", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2028", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2028", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2028", ""); - - lh.addStaticHoliday ("01-JAN-2029", "IRFE"); - - lh.addStaticHoliday ("30-MAR-2029", "IRFE"); - - lh.addStaticHoliday ("02-APR-2029", "IRFE"); - - lh.addStaticHoliday ("01-MAY-2029", "IRFE"); - - lh.addStaticHoliday ("10-MAY-2029", "IRFE"); - - lh.addStaticHoliday ("21-MAY-2029", "IRFE"); - - lh.addStaticHoliday ("15-AUG-2029", "IRFE"); - - lh.addStaticHoliday ("01-NOV-2029", "IRFE"); - - lh.addStaticHoliday ("25-DEC-2029", "IRFE"); - - lh.addStaticHoliday ("26-DEC-2029", "IRFE"); - - lh.addStaticHoliday ("01-JAN-2030", "IRFE"); - - lh.addStaticHoliday ("19-APR-2030", "IRFE"); - - lh.addStaticHoliday ("22-APR-2030", "IRFE"); - - lh.addStaticHoliday ("01-MAY-2030", "IRFE"); - - lh.addStaticHoliday ("30-MAY-2030", "IRFE"); - - lh.addStaticHoliday ("10-JUN-2030", "IRFE"); - - lh.addStaticHoliday ("15-AUG-2030", "IRFE"); - - lh.addStaticHoliday ("01-NOV-2030", "IRFE"); - - lh.addStaticHoliday ("25-DEC-2030", "IRFE"); - - lh.addStaticHoliday ("26-DEC-2030", "IRFE"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/LTLHoliday.java b/org/drip/analytics/holset/LTLHoliday.java deleted file mode 100644 index 523b084..0000000 --- a/org/drip/analytics/holset/LTLHoliday.java +++ /dev/null @@ -1,431 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class LTLHoliday implements org.drip.analytics.holset.LocationHoliday { - public LTLHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "LTL"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-1998", "Independence Day"); - - lh.addStaticHoliday ("11-MAR-1998", "Restoration of Independence Day"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("06-JUL-1998", "Statehood Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-1999", "Independence Day"); - - lh.addStaticHoliday ("11-MAR-1999", "Restoration of Independence Day"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("06-JUL-1999", "Statehood Day"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("16-FEB-2000", "Independence Day"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("06-JUL-2000", "Statehood Day"); - - lh.addStaticHoliday ("01-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2001", "Independence Day"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("06-JUL-2001", "Statehood Day"); - - lh.addStaticHoliday ("01-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("11-MAR-2002", "Restoration of Independence Day"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("01-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("11-MAR-2003", "Restoration of Independence Day"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2004", "Independence Day"); - - lh.addStaticHoliday ("11-MAR-2004", "Restoration of Independence Day"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("06-JUL-2004", "Statehood Day"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("16-FEB-2005", "Independence Day"); - - lh.addStaticHoliday ("11-MAR-2005", "Restoration of Independence Day"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("06-JUL-2005", "Statehood Day"); - - lh.addStaticHoliday ("01-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("26-DEC-2005", "Christmas Holiday"); - - lh.addStaticHoliday ("16-FEB-2006", "Independence Day"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("06-JUL-2006", "Statehood Day"); - - lh.addStaticHoliday ("01-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2007", "Independence Day"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("06-JUL-2007", "Statehood Day"); - - lh.addStaticHoliday ("01-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("11-MAR-2008", "Restoration of Independence Day"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2009", "Independence Day"); - - lh.addStaticHoliday ("11-MAR-2009", "Restoration of Independence Day"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("06-JUL-2009", "Statehood Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2010", "Independence Day"); - - lh.addStaticHoliday ("11-MAR-2010", "Restoration of Independence Day"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("06-JUL-2010", "Statehood Day"); - - lh.addStaticHoliday ("01-NOV-2010", "All Saints Day"); - - lh.addStaticHoliday ("16-FEB-2011", "Independence Day"); - - lh.addStaticHoliday ("11-MAR-2011", "Restoration of Independence Day"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("06-JUL-2011", "Statehood Day"); - - lh.addStaticHoliday ("01-NOV-2011", "All Saints Day"); - - lh.addStaticHoliday ("26-DEC-2011", "Christmas Holiday"); - - lh.addStaticHoliday ("16-FEB-2012", "Independence Day"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("06-JUL-2012", "Statehood Day"); - - lh.addStaticHoliday ("01-NOV-2012", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("11-MAR-2013", "Restoration of Independence Day"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("01-NOV-2013", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("11-MAR-2014", "Restoration of Independence Day"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2015", "Independence Day"); - - lh.addStaticHoliday ("11-MAR-2015", "Restoration of Independence Day"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("06-JUL-2015", "Statehood Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2016", "Independence Day"); - - lh.addStaticHoliday ("11-MAR-2016", "Restoration of Independence Day"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("06-JUL-2016", "Statehood Day"); - - lh.addStaticHoliday ("01-NOV-2016", "All Saints Day"); - - lh.addStaticHoliday ("26-DEC-2016", "Christmas Holiday"); - - lh.addStaticHoliday ("16-FEB-2017", "Independence Day"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("06-JUL-2017", "Statehood Day"); - - lh.addStaticHoliday ("01-NOV-2017", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2018", "Independence Day"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("06-JUL-2018", "Statehood Day"); - - lh.addStaticHoliday ("01-NOV-2018", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("11-MAR-2019", "Restoration of Independence Day"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("01-NOV-2019", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("11-MAR-2020", "Restoration of Independence Day"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("06-JUL-2020", "Statehood Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2021", "Independence Day"); - - lh.addStaticHoliday ("11-MAR-2021", "Restoration of Independence Day"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("06-JUL-2021", "Statehood Day"); - - lh.addStaticHoliday ("01-NOV-2021", "All Saints Day"); - - lh.addStaticHoliday ("16-FEB-2022", "Independence Day"); - - lh.addStaticHoliday ("11-MAR-2022", "Restoration of Independence Day"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("06-JUL-2022", "Statehood Day"); - - lh.addStaticHoliday ("01-NOV-2022", "All Saints Day"); - - lh.addStaticHoliday ("26-DEC-2022", "Christmas Holiday"); - - lh.addStaticHoliday ("16-FEB-2023", "Independence Day"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("06-JUL-2023", "Statehood Day"); - - lh.addStaticHoliday ("01-NOV-2023", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2024", "Independence Day"); - - lh.addStaticHoliday ("11-MAR-2024", "Restoration of Independence Day"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("01-NOV-2024", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("11-MAR-2025", "Restoration of Independence Day"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Christmas Holiday"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2026", "Independence Day"); - - lh.addStaticHoliday ("11-MAR-2026", "Restoration of Independence Day"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("06-JUL-2026", "Statehood Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2027", "Independence Day"); - - lh.addStaticHoliday ("11-MAR-2027", "Restoration of Independence Day"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("06-JUL-2027", "Statehood Day"); - - lh.addStaticHoliday ("01-NOV-2027", "All Saints Day"); - - lh.addStaticHoliday ("16-FEB-2028", "Independence Day"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("06-JUL-2028", "Statehood Day"); - - lh.addStaticHoliday ("01-NOV-2028", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Christmas Holiday"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/LUFHoliday.java b/org/drip/analytics/holset/LUFHoliday.java deleted file mode 100644 index 804b73f..0000000 --- a/org/drip/analytics/holset/LUFHoliday.java +++ /dev/null @@ -1,611 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class LUFHoliday implements org.drip.analytics.holset.LocationHoliday { - public LUFHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "LUF"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1998", "May Day"); - - lh.addStaticHoliday ("21-MAY-1998", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-1998", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-1998", "National Holiday"); - - lh.addStaticHoliday ("02-NOV-1998", "All Saints Day Observed"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-1999", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-1999", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-1999", "National Holiday"); - - lh.addStaticHoliday ("16-AUG-1999", "Assumption Day Observed"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("27-DEC-1999", "St. Stephens Day Observed"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2000", "May Day"); - - lh.addStaticHoliday ("01-JUN-2000", "Ascension Day"); - - lh.addStaticHoliday ("12-JUN-2000", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2000", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2000", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2001", "May Day"); - - lh.addStaticHoliday ("24-MAY-2001", "Ascension Day"); - - lh.addStaticHoliday ("04-JUN-2001", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2001", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2002", "May Day"); - - lh.addStaticHoliday ("09-MAY-2002", "Ascension Day"); - - lh.addStaticHoliday ("20-MAY-2002", "Whit Monday"); - - lh.addStaticHoliday ("24-JUN-2002", "National Holiday Observed"); - - lh.addStaticHoliday ("15-AUG-2002", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "May Day"); - - lh.addStaticHoliday ("29-MAY-2003", "Ascension Day"); - - lh.addStaticHoliday ("09-JUN-2003", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2003", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2003", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("20-MAY-2004", "Ascension Day"); - - lh.addStaticHoliday ("31-MAY-2004", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2004", "National Holiday"); - - lh.addStaticHoliday ("16-AUG-2004", "Assumption Day Observed"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("27-DEC-2004", "St. Stephens Day Observed"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2005", "May Day Observed"); - - lh.addStaticHoliday ("05-MAY-2005", "Ascension Day"); - - lh.addStaticHoliday ("16-MAY-2005", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2005", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("26-DEC-2005", "St. Stephens Day"); - - lh.addStaticHoliday ("27-DEC-2005", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "May Day"); - - lh.addStaticHoliday ("25-MAY-2006", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2006", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2006", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2006", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2007", "May Day"); - - lh.addStaticHoliday ("17-MAY-2007", "Ascension Day"); - - lh.addStaticHoliday ("28-MAY-2007", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2007", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2008", "May Day"); - - lh.addStaticHoliday ("12-MAY-2008", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2008", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2008", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2009", "May Day"); - - lh.addStaticHoliday ("21-MAY-2009", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-2009", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2009", "National Holiday"); - - lh.addStaticHoliday ("02-NOV-2009", "All Saints Day Observed"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-2010", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-2010", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2010", "National Holiday"); - - lh.addStaticHoliday ("16-AUG-2010", "Assumption Day Observed"); - - lh.addStaticHoliday ("01-NOV-2010", "All Saints Day"); - - lh.addStaticHoliday ("27-DEC-2010", "St. Stephens Day Observed"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2011", "May Day Observed"); - - lh.addStaticHoliday ("02-JUN-2011", "Ascension Day"); - - lh.addStaticHoliday ("13-JUN-2011", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2011", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2011", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2011", "All Saints Day"); - - lh.addStaticHoliday ("26-DEC-2011", "St. Stephens Day"); - - lh.addStaticHoliday ("27-DEC-2011", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2012", "May Day"); - - lh.addStaticHoliday ("17-MAY-2012", "Ascension Day"); - - lh.addStaticHoliday ("28-MAY-2012", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2012", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2012", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2013", "May Day"); - - lh.addStaticHoliday ("09-MAY-2013", "Ascension Day"); - - lh.addStaticHoliday ("20-MAY-2013", "Whit Monday"); - - lh.addStaticHoliday ("24-JUN-2013", "National Holiday Observed"); - - lh.addStaticHoliday ("15-AUG-2013", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2013", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2014", "May Day"); - - lh.addStaticHoliday ("29-MAY-2014", "Ascension Day"); - - lh.addStaticHoliday ("09-JUN-2014", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2014", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2014", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2015", "May Day"); - - lh.addStaticHoliday ("14-MAY-2015", "Ascension Day"); - - lh.addStaticHoliday ("25-MAY-2015", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2015", "National Holiday"); - - lh.addStaticHoliday ("02-NOV-2015", "All Saints Day Observed"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2016", "May Day Observed"); - - lh.addStaticHoliday ("05-MAY-2016", "Ascension Day"); - - lh.addStaticHoliday ("16-MAY-2016", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2016", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2016", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2016", "All Saints Day"); - - lh.addStaticHoliday ("26-DEC-2016", "St. Stephens Day"); - - lh.addStaticHoliday ("27-DEC-2016", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "May Day"); - - lh.addStaticHoliday ("25-MAY-2017", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2017", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2017", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2017", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2017", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2018", "May Day"); - - lh.addStaticHoliday ("10-MAY-2018", "Ascension Day"); - - lh.addStaticHoliday ("21-MAY-2018", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2018", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2018", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "May Day"); - - lh.addStaticHoliday ("30-MAY-2019", "Ascension Day"); - - lh.addStaticHoliday ("10-JUN-2019", "Whit Monday"); - - lh.addStaticHoliday ("24-JUN-2019", "National Holiday Observed"); - - lh.addStaticHoliday ("15-AUG-2019", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2019", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2020", "May Day"); - - lh.addStaticHoliday ("21-MAY-2020", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-2020", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2020", "National Holiday"); - - lh.addStaticHoliday ("02-NOV-2020", "All Saints Day Observed"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-2021", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-2021", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2021", "National Holiday"); - - lh.addStaticHoliday ("16-AUG-2021", "Assumption Day Observed"); - - lh.addStaticHoliday ("01-NOV-2021", "All Saints Day"); - - lh.addStaticHoliday ("27-DEC-2021", "St. Stephens Day Observed"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2022", "May Day Observed"); - - lh.addStaticHoliday ("26-MAY-2022", "Ascension Day"); - - lh.addStaticHoliday ("06-JUN-2022", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2022", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2022", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2022", "All Saints Day"); - - lh.addStaticHoliday ("26-DEC-2022", "St. Stephens Day"); - - lh.addStaticHoliday ("27-DEC-2022", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "May Day"); - - lh.addStaticHoliday ("18-MAY-2023", "Ascension Day"); - - lh.addStaticHoliday ("29-MAY-2023", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2023", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2023", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2023", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2024", "May Day"); - - lh.addStaticHoliday ("09-MAY-2024", "Ascension Day"); - - lh.addStaticHoliday ("20-MAY-2024", "Whit Monday"); - - lh.addStaticHoliday ("24-JUN-2024", "National Holiday Observed"); - - lh.addStaticHoliday ("15-AUG-2024", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2024", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2025", "May Day"); - - lh.addStaticHoliday ("29-MAY-2025", "Ascension Day"); - - lh.addStaticHoliday ("09-JUN-2025", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2025", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2025", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2026", "May Day"); - - lh.addStaticHoliday ("14-MAY-2026", "Ascension Day"); - - lh.addStaticHoliday ("25-MAY-2026", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2026", "National Holiday"); - - lh.addStaticHoliday ("02-NOV-2026", "All Saints Day Observed"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("06-MAY-2027", "Ascension Day"); - - lh.addStaticHoliday ("17-MAY-2027", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2027", "National Holiday"); - - lh.addStaticHoliday ("16-AUG-2027", "Assumption Day Observed"); - - lh.addStaticHoliday ("01-NOV-2027", "All Saints Day"); - - lh.addStaticHoliday ("27-DEC-2027", "St. Stephens Day Observed"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2028", "May Day"); - - lh.addStaticHoliday ("25-MAY-2028", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2028", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2028", "National Holiday"); - - lh.addStaticHoliday ("15-AUG-2028", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2028", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "St. Stephens Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/LUXHoliday.java b/org/drip/analytics/holset/LUXHoliday.java deleted file mode 100644 index 48df340..0000000 --- a/org/drip/analytics/holset/LUXHoliday.java +++ /dev/null @@ -1,703 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class LUXHoliday implements org.drip.analytics.holset.LocationHoliday { - public LUXHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "LUX"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01 CHASE-JAN-1998", ""); - - lh.addStaticHoliday ("13 CHASE-APR-1998", ""); - - lh.addStaticHoliday ("01 CHASE-MAY-1998", ""); - - lh.addStaticHoliday ("21 CHASE-MAY-1998", ""); - - lh.addStaticHoliday ("01 CHASE-JUN-1998", ""); - - lh.addStaticHoliday ("23 CHASE-JUN-1998", ""); - - lh.addStaticHoliday ("02 CHASE-NOV-1998", ""); - - lh.addStaticHoliday ("25 CHASE-DEC-1998", ""); - - lh.addStaticHoliday ("01 CHASE-JAN-1999", ""); - - lh.addStaticHoliday ("05 CHASE-APR-1999", ""); - - lh.addStaticHoliday ("13 CHASE-MAY-1999", ""); - - lh.addStaticHoliday ("24 CHASE-MAY-1999", ""); - - lh.addStaticHoliday ("23 CHASE-JUN-1999", ""); - - lh.addStaticHoliday ("16 CHASE-AUG-1999", ""); - - lh.addStaticHoliday ("01 CHASE-NOV-1999", ""); - - lh.addStaticHoliday ("27 CHASE-DEC-1999", ""); - - lh.addStaticHoliday ("24 CHASE-APR-2000", ""); - - lh.addStaticHoliday ("01 CHASE-MAY-2000", ""); - - lh.addStaticHoliday ("01 CHASE-JUN-2000", ""); - - lh.addStaticHoliday ("12 CHASE-JUN-2000", ""); - - lh.addStaticHoliday ("23 CHASE-JUN-2000", ""); - - lh.addStaticHoliday ("15 CHASE-AUG-2000", ""); - - lh.addStaticHoliday ("01 CHASE-NOV-2000", ""); - - lh.addStaticHoliday ("25 CHASE-DEC-2000", ""); - - lh.addStaticHoliday ("26 CHASE-DEC-2000", ""); - - lh.addStaticHoliday ("01 CHASE-JAN-2001", ""); - - lh.addStaticHoliday ("16 CHASE-APR-2001", ""); - - lh.addStaticHoliday ("01 CHASE-MAY-2001", ""); - - lh.addStaticHoliday ("24 CHASE-MAY-2001", ""); - - lh.addStaticHoliday ("04 CHASE-JUN-2001", ""); - - lh.addStaticHoliday ("15 CHASE-AUG-2001", ""); - - lh.addStaticHoliday ("01 CHASE-NOV-2001", ""); - - lh.addStaticHoliday ("25 CHASE-DEC-2001", ""); - - lh.addStaticHoliday ("26 CHASE-DEC-2001", ""); - - lh.addStaticHoliday ("01 CHASE-JAN-2002", ""); - - lh.addStaticHoliday ("01 CHASE-APR-2002", ""); - - lh.addStaticHoliday ("01 CHASE-MAY-2002", ""); - - lh.addStaticHoliday ("09 CHASE-MAY-2002", ""); - - lh.addStaticHoliday ("20 CHASE-MAY-2002", ""); - - lh.addStaticHoliday ("24 CHASE-JUN-2002", ""); - - lh.addStaticHoliday ("15 CHASE-AUG-2002", ""); - - lh.addStaticHoliday ("01 CHASE-NOV-2002", ""); - - lh.addStaticHoliday ("25 CHASE-DEC-2002", ""); - - lh.addStaticHoliday ("26 CHASE-DEC-2002", ""); - - lh.addStaticHoliday ("01 CHASE-JAN-2003", ""); - - lh.addStaticHoliday ("21 CHASE-APR-2003", ""); - - lh.addStaticHoliday ("01 CHASE-MAY-2003", ""); - - lh.addStaticHoliday ("29 CHASE-MAY-2003", ""); - - lh.addStaticHoliday ("09 CHASE-JUN-2003", ""); - - lh.addStaticHoliday ("23 CHASE-JUN-2003", ""); - - lh.addStaticHoliday ("15 CHASE-AUG-2003", ""); - - lh.addStaticHoliday ("25 CHASE-DEC-2003", ""); - - lh.addStaticHoliday ("26 CHASE-DEC-2003", ""); - - lh.addStaticHoliday ("01 CHASE-JAN-2004", ""); - - lh.addStaticHoliday ("09-APR-2004", "IRFE"); - - lh.addStaticHoliday ("12 BOTH-APR-2004", ""); - - lh.addStaticHoliday ("20 BOTH-MAY-2004", ""); - - lh.addStaticHoliday ("31 BOTH-MAY-2004", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2004", ""); - - lh.addStaticHoliday ("16 BOTH-AUG-2004", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2004", ""); - - lh.addStaticHoliday ("27 BOTH-DEC-2004", ""); - - lh.addStaticHoliday ("31-DEC-2004", "IRFE"); - - lh.addStaticHoliday ("25-MAR-2005", "IRFE"); - - lh.addStaticHoliday ("28 BOTH-MAR-2005", ""); - - lh.addStaticHoliday ("02 BOTH-MAY-2005", ""); - - lh.addStaticHoliday ("05 BOTH-MAY-2005", ""); - - lh.addStaticHoliday ("16 BOTH-MAY-2005", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2005", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2005", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2005", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2005", ""); - - lh.addStaticHoliday ("27 BOTH-DEC-2005", ""); - - lh.addStaticHoliday ("02 BOTH-JAN-2006", ""); - - lh.addStaticHoliday ("14-APR-2006", "IRFE"); - - lh.addStaticHoliday ("17 BOTH-APR-2006", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2006", ""); - - lh.addStaticHoliday ("25 BOTH-MAY-2006", ""); - - lh.addStaticHoliday ("05 BOTH-JUN-2006", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2006", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2006", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2006", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2006", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2006", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2007", ""); - - lh.addStaticHoliday ("06-APR-2007", "IRFE"); - - lh.addStaticHoliday ("09 BOTH-APR-2007", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2007", ""); - - lh.addStaticHoliday ("17 BOTH-MAY-2007", ""); - - lh.addStaticHoliday ("28 BOTH-MAY-2007", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2007", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2007", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2007", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2007", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2008", ""); - - lh.addStaticHoliday ("21-MAR-2008", "IRFE"); - - lh.addStaticHoliday ("24 BOTH-MAR-2008", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2008", ""); - - lh.addStaticHoliday ("12 BOTH-MAY-2008", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2008", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2008", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2008", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2008", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2009", ""); - - lh.addStaticHoliday ("10-APR-2009", "IRFE"); - - lh.addStaticHoliday ("13 BOTH-APR-2009", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2009", ""); - - lh.addStaticHoliday ("21 BOTH-MAY-2009", ""); - - lh.addStaticHoliday ("01 BOTH-JUN-2009", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2009", ""); - - lh.addStaticHoliday ("02 BOTH-NOV-2009", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2009", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2010", ""); - - lh.addStaticHoliday ("02-APR-2010", "IRFE"); - - lh.addStaticHoliday ("05 BOTH-APR-2010", ""); - - lh.addStaticHoliday ("13 BOTH-MAY-2010", ""); - - lh.addStaticHoliday ("24 BOTH-MAY-2010", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2010", ""); - - lh.addStaticHoliday ("16 BOTH-AUG-2010", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2010", ""); - - lh.addStaticHoliday ("27 BOTH-DEC-2010", ""); - - lh.addStaticHoliday ("22-APR-2011", "IRFE"); - - lh.addStaticHoliday ("25 BOTH-APR-2011", ""); - - lh.addStaticHoliday ("02 BOTH-MAY-2011", ""); - - lh.addStaticHoliday ("02 BOTH-JUN-2011", ""); - - lh.addStaticHoliday ("13 BOTH-JUN-2011", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2011", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2011", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2011", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2011", ""); - - lh.addStaticHoliday ("27 BOTH-DEC-2011", ""); - - lh.addStaticHoliday ("02 BOTH-JAN-2012", ""); - - lh.addStaticHoliday ("06-APR-2012", "IRFE"); - - lh.addStaticHoliday ("09 BOTH-APR-2012", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2012", ""); - - lh.addStaticHoliday ("17 BOTH-MAY-2012", ""); - - lh.addStaticHoliday ("28 BOTH-MAY-2012", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2012", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2012", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2012", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2012", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2013", ""); - - lh.addStaticHoliday ("29-MAR-2013", "IRFE"); - - lh.addStaticHoliday ("01 BOTH-APR-2013", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2013", ""); - - lh.addStaticHoliday ("09 BOTH-MAY-2013", ""); - - lh.addStaticHoliday ("20 BOTH-MAY-2013", ""); - - lh.addStaticHoliday ("24 BOTH-JUN-2013", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2013", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2013", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2013", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2013", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2014", ""); - - lh.addStaticHoliday ("18-APR-2014", "IRFE"); - - lh.addStaticHoliday ("21 BOTH-APR-2014", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2014", ""); - - lh.addStaticHoliday ("29 BOTH-MAY-2014", ""); - - lh.addStaticHoliday ("09 BOTH-JUN-2014", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2014", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2014", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2014", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2014", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2015", ""); - - lh.addStaticHoliday ("03-APR-2015", "IRFE"); - - lh.addStaticHoliday ("06 BOTH-APR-2015", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2015", ""); - - lh.addStaticHoliday ("14 BOTH-MAY-2015", ""); - - lh.addStaticHoliday ("25 BOTH-MAY-2015", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2015", ""); - - lh.addStaticHoliday ("02 BOTH-NOV-2015", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2015", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2016", ""); - - lh.addStaticHoliday ("25-MAR-2016", "IRFE"); - - lh.addStaticHoliday ("28 BOTH-MAR-2016", ""); - - lh.addStaticHoliday ("02 BOTH-MAY-2016", ""); - - lh.addStaticHoliday ("05 BOTH-MAY-2016", ""); - - lh.addStaticHoliday ("16 BOTH-MAY-2016", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2016", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2016", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2016", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2016", ""); - - lh.addStaticHoliday ("27 BOTH-DEC-2016", ""); - - lh.addStaticHoliday ("02 BOTH-JAN-2017", ""); - - lh.addStaticHoliday ("14-APR-2017", "IRFE"); - - lh.addStaticHoliday ("17 BOTH-APR-2017", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2017", ""); - - lh.addStaticHoliday ("25 BOTH-MAY-2017", ""); - - lh.addStaticHoliday ("05 BOTH-JUN-2017", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2017", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2017", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2017", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2017", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2017", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2018", ""); - - lh.addStaticHoliday ("30-MAR-2018", "IRFE"); - - lh.addStaticHoliday ("02 BOTH-APR-2018", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2018", ""); - - lh.addStaticHoliday ("10 BOTH-MAY-2018", ""); - - lh.addStaticHoliday ("21 BOTH-MAY-2018", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2018", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2018", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2018", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2018", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2019", ""); - - lh.addStaticHoliday ("19-APR-2019", "IRFE"); - - lh.addStaticHoliday ("22 BOTH-APR-2019", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2019", ""); - - lh.addStaticHoliday ("30 BOTH-MAY-2019", ""); - - lh.addStaticHoliday ("10 BOTH-JUN-2019", ""); - - lh.addStaticHoliday ("24 BOTH-JUN-2019", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2019", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2019", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2019", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2019", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2020", ""); - - lh.addStaticHoliday ("10-APR-2020", "IRFE"); - - lh.addStaticHoliday ("13 BOTH-APR-2020", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2020", ""); - - lh.addStaticHoliday ("21 BOTH-MAY-2020", ""); - - lh.addStaticHoliday ("01 BOTH-JUN-2020", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2020", ""); - - lh.addStaticHoliday ("02 BOTH-NOV-2020", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2020", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2021", ""); - - lh.addStaticHoliday ("02-APR-2021", "IRFE"); - - lh.addStaticHoliday ("05 BOTH-APR-2021", ""); - - lh.addStaticHoliday ("13 BOTH-MAY-2021", ""); - - lh.addStaticHoliday ("24 BOTH-MAY-2021", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2021", ""); - - lh.addStaticHoliday ("16 BOTH-AUG-2021", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2021", ""); - - lh.addStaticHoliday ("27 BOTH-DEC-2021", ""); - - lh.addStaticHoliday ("15-APR-2022", "IRFE"); - - lh.addStaticHoliday ("18 BOTH-APR-2022", ""); - - lh.addStaticHoliday ("02 BOTH-MAY-2022", ""); - - lh.addStaticHoliday ("26 BOTH-MAY-2022", ""); - - lh.addStaticHoliday ("06 BOTH-JUN-2022", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2022", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2022", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2022", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2022", ""); - - lh.addStaticHoliday ("27 BOTH-DEC-2022", ""); - - lh.addStaticHoliday ("02 BOTH-JAN-2023", ""); - - lh.addStaticHoliday ("07-APR-2023", "IRFE"); - - lh.addStaticHoliday ("10 BOTH-APR-2023", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2023", ""); - - lh.addStaticHoliday ("18 BOTH-MAY-2023", ""); - - lh.addStaticHoliday ("29 BOTH-MAY-2023", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2023", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2023", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2023", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2023", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2023", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2024", ""); - - lh.addStaticHoliday ("29-MAR-2024", "IRFE"); - - lh.addStaticHoliday ("01 BOTH-APR-2024", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2024", ""); - - lh.addStaticHoliday ("09 BOTH-MAY-2024", ""); - - lh.addStaticHoliday ("20 BOTH-MAY-2024", ""); - - lh.addStaticHoliday ("24 BOTH-JUN-2024", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2024", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2024", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2024", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2024", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2025", ""); - - lh.addStaticHoliday ("18-APR-2025", "IRFE"); - - lh.addStaticHoliday ("21 BOTH-APR-2025", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2025", ""); - - lh.addStaticHoliday ("29 BOTH-MAY-2025", ""); - - lh.addStaticHoliday ("09 BOTH-JUN-2025", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2025", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2025", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2025", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2025", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2026", ""); - - lh.addStaticHoliday ("03-APR-2026", "IRFE"); - - lh.addStaticHoliday ("06 BOTH-APR-2026", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2026", ""); - - lh.addStaticHoliday ("14 BOTH-MAY-2026", ""); - - lh.addStaticHoliday ("25 BOTH-MAY-2026", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2026", ""); - - lh.addStaticHoliday ("02 BOTH-NOV-2026", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2026", ""); - - lh.addStaticHoliday ("01 BOTH-JAN-2027", ""); - - lh.addStaticHoliday ("26-MAR-2027", "IRFE"); - - lh.addStaticHoliday ("29 BOTH-MAR-2027", ""); - - lh.addStaticHoliday ("06 BOTH-MAY-2027", ""); - - lh.addStaticHoliday ("17 BOTH-MAY-2027", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2027", ""); - - lh.addStaticHoliday ("16 BOTH-AUG-2027", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2027", ""); - - lh.addStaticHoliday ("27 BOTH-DEC-2027", ""); - - lh.addStaticHoliday ("14-APR-2028", "IRFE"); - - lh.addStaticHoliday ("17 BOTH-APR-2028", ""); - - lh.addStaticHoliday ("01 BOTH-MAY-2028", ""); - - lh.addStaticHoliday ("25 BOTH-MAY-2028", ""); - - lh.addStaticHoliday ("05 BOTH-JUN-2028", ""); - - lh.addStaticHoliday ("23 BOTH-JUN-2028", ""); - - lh.addStaticHoliday ("15 BOTH-AUG-2028", ""); - - lh.addStaticHoliday ("01 BOTH-NOV-2028", ""); - - lh.addStaticHoliday ("25 BOTH-DEC-2028", ""); - - lh.addStaticHoliday ("26 BOTH-DEC-2028", ""); - - lh.addStaticHoliday ("01-JAN-2029", "IRFE"); - - lh.addStaticHoliday ("30-MAR-2029", "IRFE"); - - lh.addStaticHoliday ("02-APR-2029", "IRFE"); - - lh.addStaticHoliday ("01-MAY-2029", "IRFE"); - - lh.addStaticHoliday ("10-MAY-2029", "IRFE"); - - lh.addStaticHoliday ("21-MAY-2029", "IRFE"); - - lh.addStaticHoliday ("15-AUG-2029", "IRFE"); - - lh.addStaticHoliday ("01-NOV-2029", "IRFE"); - - lh.addStaticHoliday ("25-DEC-2029", "IRFE"); - - lh.addStaticHoliday ("26-DEC-2029", "IRFE"); - - lh.addStaticHoliday ("01-JAN-2030", "IRFE"); - - lh.addStaticHoliday ("19-APR-2030", "IRFE"); - - lh.addStaticHoliday ("22-APR-2030", "IRFE"); - - lh.addStaticHoliday ("01-MAY-2030", "IRFE"); - - lh.addStaticHoliday ("30-MAY-2030", "IRFE"); - - lh.addStaticHoliday ("10-JUN-2030", "IRFE"); - - lh.addStaticHoliday ("15-AUG-2030", "IRFE"); - - lh.addStaticHoliday ("01-NOV-2030", "IRFE"); - - lh.addStaticHoliday ("25-DEC-2030", "IRFE"); - - lh.addStaticHoliday ("26-DEC-2030", "IRFE"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/LVLHoliday.java b/org/drip/analytics/holset/LVLHoliday.java deleted file mode 100644 index d57b53d..0000000 --- a/org/drip/analytics/holset/LVLHoliday.java +++ /dev/null @@ -1,499 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class LVLHoliday implements org.drip.analytics.holset.LocationHoliday { - public LVLHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "LVL"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("23-JUN-1998", "Midsummers Eve"); - - lh.addStaticHoliday ("24-JUN-1998", "St. Johns Day"); - - lh.addStaticHoliday ("18-NOV-1998", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-1998", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("23-JUN-1999", "Midsummers Eve"); - - lh.addStaticHoliday ("24-JUN-1999", "St. Johns Day"); - - lh.addStaticHoliday ("25-JUN-1999", "Bridging Day"); - - lh.addStaticHoliday ("18-NOV-1999", "Independence Day"); - - lh.addStaticHoliday ("31-DEC-1999", "New Years Eve"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("23-JUN-2000", "Midsummers Eve"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2001", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("24-JUN-2002", "St. Johns Day"); - - lh.addStaticHoliday ("18-NOV-2002", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Boxing Day"); - - lh.addStaticHoliday ("27-DEC-2002", "Bridging Day"); - - lh.addStaticHoliday ("31-DEC-2002", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("23-JUN-2003", "Midsummers Eve"); - - lh.addStaticHoliday ("24-JUN-2003", "St. Johns Day"); - - lh.addStaticHoliday ("18-NOV-2003", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2003", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2004", "Bridging Day"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("23-JUN-2004", "Midsummers Eve"); - - lh.addStaticHoliday ("24-JUN-2004", "St. Johns Day"); - - lh.addStaticHoliday ("25-JUN-2004", "Bridging Day"); - - lh.addStaticHoliday ("18-NOV-2004", "Independence Day"); - - lh.addStaticHoliday ("31-DEC-2004", "New Years Eve"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("23-JUN-2005", "Midsummers Eve"); - - lh.addStaticHoliday ("24-JUN-2005", "St. Johns Day"); - - lh.addStaticHoliday ("18-NOV-2005", "Independence Day"); - - lh.addStaticHoliday ("26-DEC-2005", "Boxing Day"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("23-JUN-2006", "Midsummers Eve"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2007", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("23-JUN-2008", "Midsummers Eve"); - - lh.addStaticHoliday ("24-JUN-2008", "St. Johns Day"); - - lh.addStaticHoliday ("18-NOV-2008", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2008", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2009", "Bridging Day"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("23-JUN-2009", "Midsummers Eve"); - - lh.addStaticHoliday ("24-JUN-2009", "St. Johns Day"); - - lh.addStaticHoliday ("18-NOV-2009", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2009", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("23-JUN-2010", "Midsummers Eve"); - - lh.addStaticHoliday ("24-JUN-2010", "St. Johns Day"); - - lh.addStaticHoliday ("25-JUN-2010", "Bridging Day"); - - lh.addStaticHoliday ("18-NOV-2010", "Independence Day"); - - lh.addStaticHoliday ("31-DEC-2010", "New Years Eve"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("23-JUN-2011", "Midsummers Eve"); - - lh.addStaticHoliday ("24-JUN-2011", "St. Johns Day"); - - lh.addStaticHoliday ("18-NOV-2011", "Independence Day"); - - lh.addStaticHoliday ("26-DEC-2011", "Boxing Day"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2012", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("24-JUN-2013", "St. Johns Day"); - - lh.addStaticHoliday ("18-NOV-2013", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Boxing Day"); - - lh.addStaticHoliday ("27-DEC-2013", "Bridging Day"); - - lh.addStaticHoliday ("31-DEC-2013", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("23-JUN-2014", "Midsummers Eve"); - - lh.addStaticHoliday ("24-JUN-2014", "St. Johns Day"); - - lh.addStaticHoliday ("18-NOV-2014", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2014", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2015", "Bridging Day"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("23-JUN-2015", "Midsummers Eve"); - - lh.addStaticHoliday ("24-JUN-2015", "St. Johns Day"); - - lh.addStaticHoliday ("18-NOV-2015", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2015", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("23-JUN-2016", "Midsummers Eve"); - - lh.addStaticHoliday ("24-JUN-2016", "St. Johns Day"); - - lh.addStaticHoliday ("18-NOV-2016", "Independence Day"); - - lh.addStaticHoliday ("26-DEC-2016", "Boxing Day"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("23-JUN-2017", "Midsummers Eve"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2018", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("24-JUN-2019", "St. Johns Day"); - - lh.addStaticHoliday ("18-NOV-2019", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Boxing Day"); - - lh.addStaticHoliday ("27-DEC-2019", "Bridging Day"); - - lh.addStaticHoliday ("31-DEC-2019", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("23-JUN-2020", "Midsummers Eve"); - - lh.addStaticHoliday ("24-JUN-2020", "St. Johns Day"); - - lh.addStaticHoliday ("18-NOV-2020", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2020", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("23-JUN-2021", "Midsummers Eve"); - - lh.addStaticHoliday ("24-JUN-2021", "St. Johns Day"); - - lh.addStaticHoliday ("25-JUN-2021", "Bridging Day"); - - lh.addStaticHoliday ("18-NOV-2021", "Independence Day"); - - lh.addStaticHoliday ("31-DEC-2021", "New Years Eve"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("23-JUN-2022", "Midsummers Eve"); - - lh.addStaticHoliday ("24-JUN-2022", "St. Johns Day"); - - lh.addStaticHoliday ("18-NOV-2022", "Independence Day"); - - lh.addStaticHoliday ("26-DEC-2022", "Boxing Day"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("23-JUN-2023", "Midsummers Eve"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("24-JUN-2024", "St. Johns Day"); - - lh.addStaticHoliday ("18-NOV-2024", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Boxing Day"); - - lh.addStaticHoliday ("27-DEC-2024", "Bridging Day"); - - lh.addStaticHoliday ("31-DEC-2024", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("23-JUN-2025", "Midsummers Eve"); - - lh.addStaticHoliday ("24-JUN-2025", "St. Johns Day"); - - lh.addStaticHoliday ("18-NOV-2025", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2025", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2026", "Bridging Day"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("23-JUN-2026", "Midsummers Eve"); - - lh.addStaticHoliday ("24-JUN-2026", "St. Johns Day"); - - lh.addStaticHoliday ("18-NOV-2026", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2026", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("23-JUN-2027", "Midsummers Eve"); - - lh.addStaticHoliday ("24-JUN-2027", "St. Johns Day"); - - lh.addStaticHoliday ("25-JUN-2027", "Bridging Day"); - - lh.addStaticHoliday ("18-NOV-2027", "Independence Day"); - - lh.addStaticHoliday ("31-DEC-2027", "New Years Eve"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("23-JUN-2028", "Midsummers Eve"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Boxing Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/LocationHoliday.java b/org/drip/analytics/holset/LocationHoliday.java deleted file mode 100644 index f2f921a..0000000 --- a/org/drip/analytics/holset/LocationHoliday.java +++ /dev/null @@ -1,79 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * LocationHoliday is an interface which is implemented by all the Location Holiday classes. It exposes the - * specific holiday location, as well as the set of location-specific holidays. - * - * @author Lakshmi Krishnamurthy - */ - -public interface LocationHoliday { - - /** - * Retrieve the holiday location - * - * @return HolidayLocation - */ - - public java.lang.String getHolidayLoc(); - - /** - * Return the Locale instance for this location - * - * @return Locale instance - */ - - public org.drip.analytics.eventday.Locale getHolidaySet(); -} diff --git a/org/drip/analytics/holset/MDLHoliday.java b/org/drip/analytics/holset/MDLHoliday.java deleted file mode 100644 index 0f448bc..0000000 --- a/org/drip/analytics/holset/MDLHoliday.java +++ /dev/null @@ -1,529 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class MDLHoliday implements org.drip.analytics.holset.LocationHoliday { - public MDLHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "MDL"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-1998", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-JAN-1998", "Day after Orthodox Christmas Day"); - - lh.addStaticHoliday ("20-APR-1998", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("27-APR-1998", "Prayer Day"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("27-AUG-1998", "Independence Day"); - - lh.addStaticHoliday ("31-AUG-1998", "Language Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-1999", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-JAN-1999", "Day after Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-1999", "Womens Day"); - - lh.addStaticHoliday ("12-APR-1999", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("19-APR-1999", "Prayer Day"); - - lh.addStaticHoliday ("27-AUG-1999", "Independence Day"); - - lh.addStaticHoliday ("31-AUG-1999", "Language Day"); - - lh.addStaticHoliday ("07-JAN-2000", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2000", "Womens Day"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-2000", "Prayer Day"); - - lh.addStaticHoliday ("09-MAY-2000", "Victory Day"); - - lh.addStaticHoliday ("31-AUG-2000", "Language Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2001", "Day after Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2001", "Womens Day"); - - lh.addStaticHoliday ("16-APR-2001", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("23-APR-2001", "Prayer Day"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2001", "Victory Day"); - - lh.addStaticHoliday ("27-AUG-2001", "Independence Day"); - - lh.addStaticHoliday ("31-AUG-2001", "Language Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2002", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-JAN-2002", "Day after Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2002", "Womens Day"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2002", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("09-MAY-2002", "Victory Day"); - - lh.addStaticHoliday ("13-MAY-2002", "Prayer Day"); - - lh.addStaticHoliday ("27-AUG-2002", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2003", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-JAN-2003", "Day after Orthodox Christmas Day"); - - lh.addStaticHoliday ("28-APR-2003", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2003", "Prayer Day"); - - lh.addStaticHoliday ("09-MAY-2003", "Victory Day"); - - lh.addStaticHoliday ("27-AUG-2003", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2004", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-JAN-2004", "Day after Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2004", "Womens Day"); - - lh.addStaticHoliday ("12-APR-2004", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("19-APR-2004", "Prayer Day"); - - lh.addStaticHoliday ("27-AUG-2004", "Independence Day"); - - lh.addStaticHoliday ("31-AUG-2004", "Language Day"); - - lh.addStaticHoliday ("07-JAN-2005", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2005", "Womens Day"); - - lh.addStaticHoliday ("02-MAY-2005", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("09-MAY-2005", "Victory Day"); - - lh.addStaticHoliday ("31-AUG-2005", "Language Day"); - - lh.addStaticHoliday ("08-MAR-2006", "Womens Day"); - - lh.addStaticHoliday ("24-APR-2006", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2006", "Victory Day"); - - lh.addStaticHoliday ("31-AUG-2006", "Language Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2007", "Day after Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2007", "Womens Day"); - - lh.addStaticHoliday ("09-APR-2007", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("16-APR-2007", "Prayer Day"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2007", "Victory Day"); - - lh.addStaticHoliday ("27-AUG-2007", "Independence Day"); - - lh.addStaticHoliday ("31-AUG-2007", "Language Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2008", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-JAN-2008", "Day after Orthodox Christmas Day"); - - lh.addStaticHoliday ("28-APR-2008", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2008", "Prayer Day"); - - lh.addStaticHoliday ("09-MAY-2008", "Victory Day"); - - lh.addStaticHoliday ("27-AUG-2008", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2009", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-JAN-2009", "Day after Orthodox Christmas Day"); - - lh.addStaticHoliday ("20-APR-2009", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("27-APR-2009", "Prayer Day"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("27-AUG-2009", "Independence Day"); - - lh.addStaticHoliday ("31-AUG-2009", "Language Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2010", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-JAN-2010", "Day after Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2010", "Womens Day"); - - lh.addStaticHoliday ("05-APR-2010", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("12-APR-2010", "Prayer Day"); - - lh.addStaticHoliday ("27-AUG-2010", "Independence Day"); - - lh.addStaticHoliday ("31-AUG-2010", "Language Day"); - - lh.addStaticHoliday ("07-JAN-2011", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2011", "Womens Day"); - - lh.addStaticHoliday ("25-APR-2011", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2011", "Prayer Day"); - - lh.addStaticHoliday ("09-MAY-2011", "Victory Day"); - - lh.addStaticHoliday ("31-AUG-2011", "Language Day"); - - lh.addStaticHoliday ("08-MAR-2012", "Womens Day"); - - lh.addStaticHoliday ("16-APR-2012", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("23-APR-2012", "Prayer Day"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2012", "Victory Day"); - - lh.addStaticHoliday ("27-AUG-2012", "Independence Day"); - - lh.addStaticHoliday ("31-AUG-2012", "Language Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2013", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-JAN-2013", "Day after Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2013", "Womens Day"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2013", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("09-MAY-2013", "Victory Day"); - - lh.addStaticHoliday ("13-MAY-2013", "Prayer Day"); - - lh.addStaticHoliday ("27-AUG-2013", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2014", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-JAN-2014", "Day after Orthodox Christmas Day"); - - lh.addStaticHoliday ("21-APR-2014", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("28-APR-2014", "Prayer Day"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2014", "Victory Day"); - - lh.addStaticHoliday ("27-AUG-2014", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2015", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-JAN-2015", "Day after Orthodox Christmas Day"); - - lh.addStaticHoliday ("13-APR-2015", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("20-APR-2015", "Prayer Day"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("27-AUG-2015", "Independence Day"); - - lh.addStaticHoliday ("31-AUG-2015", "Language Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2016", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-JAN-2016", "Day after Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2016", "Womens Day"); - - lh.addStaticHoliday ("02-MAY-2016", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("09-MAY-2016", "Victory Day"); - - lh.addStaticHoliday ("31-AUG-2016", "Language Day"); - - lh.addStaticHoliday ("08-MAR-2017", "Womens Day"); - - lh.addStaticHoliday ("17-APR-2017", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("24-APR-2017", "Prayer Day"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2017", "Victory Day"); - - lh.addStaticHoliday ("31-AUG-2017", "Language Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2018", "Day after Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2018", "Womens Day"); - - lh.addStaticHoliday ("09-APR-2018", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("16-APR-2018", "Prayer Day"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2018", "Victory Day"); - - lh.addStaticHoliday ("27-AUG-2018", "Independence Day"); - - lh.addStaticHoliday ("31-AUG-2018", "Language Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2019", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-JAN-2019", "Day after Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2019", "Womens Day"); - - lh.addStaticHoliday ("29-APR-2019", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2019", "Prayer Day"); - - lh.addStaticHoliday ("09-MAY-2019", "Victory Day"); - - lh.addStaticHoliday ("27-AUG-2019", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2020", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-JAN-2020", "Day after Orthodox Christmas Day"); - - lh.addStaticHoliday ("20-APR-2020", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("27-APR-2020", "Prayer Day"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("27-AUG-2020", "Independence Day"); - - lh.addStaticHoliday ("31-AUG-2020", "Language Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2021", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-JAN-2021", "Day after Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2021", "Womens Day"); - - lh.addStaticHoliday ("03-MAY-2021", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("10-MAY-2021", "Prayer Day"); - - lh.addStaticHoliday ("27-AUG-2021", "Independence Day"); - - lh.addStaticHoliday ("31-AUG-2021", "Language Day"); - - lh.addStaticHoliday ("07-JAN-2022", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2022", "Womens Day"); - - lh.addStaticHoliday ("25-APR-2022", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2022", "Prayer Day"); - - lh.addStaticHoliday ("09-MAY-2022", "Victory Day"); - - lh.addStaticHoliday ("31-AUG-2022", "Language Day"); - - lh.addStaticHoliday ("08-MAR-2023", "Womens Day"); - - lh.addStaticHoliday ("17-APR-2023", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("24-APR-2023", "Prayer Day"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2023", "Victory Day"); - - lh.addStaticHoliday ("31-AUG-2023", "Language Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2024", "Day after Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2024", "Womens Day"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2024", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("09-MAY-2024", "Victory Day"); - - lh.addStaticHoliday ("13-MAY-2024", "Prayer Day"); - - lh.addStaticHoliday ("27-AUG-2024", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2025", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-JAN-2025", "Day after Orthodox Christmas Day"); - - lh.addStaticHoliday ("21-APR-2025", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("28-APR-2025", "Prayer Day"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2025", "Victory Day"); - - lh.addStaticHoliday ("27-AUG-2025", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2026", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-JAN-2026", "Day after Orthodox Christmas Day"); - - lh.addStaticHoliday ("13-APR-2026", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("20-APR-2026", "Prayer Day"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("27-AUG-2026", "Independence Day"); - - lh.addStaticHoliday ("31-AUG-2026", "Language Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2027", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-JAN-2027", "Day after Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2027", "Womens Day"); - - lh.addStaticHoliday ("03-MAY-2027", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("10-MAY-2027", "Prayer Day"); - - lh.addStaticHoliday ("27-AUG-2027", "Independence Day"); - - lh.addStaticHoliday ("31-AUG-2027", "Language Day"); - - lh.addStaticHoliday ("07-JAN-2028", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2028", "Womens Day"); - - lh.addStaticHoliday ("17-APR-2028", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("24-APR-2028", "Prayer Day"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2028", "Victory Day"); - - lh.addStaticHoliday ("31-AUG-2028", "Language Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/MIXHoliday.java b/org/drip/analytics/holset/MIXHoliday.java deleted file mode 100644 index 6322723..0000000 --- a/org/drip/analytics/holset/MIXHoliday.java +++ /dev/null @@ -1,1433 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class MIXHoliday implements org.drip.analytics.holset.LocationHoliday { - public MIXHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "MIX"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1996", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-1996", "New Years Holiday"); - - lh.addStaticHoliday ("03-JAN-1996", "Bank Holiday"); - - lh.addStaticHoliday ("15-JAN-1996", "Adults Day"); - - lh.addStaticHoliday ("12-FEB-1996", "Founding Day"); - - lh.addStaticHoliday ("20-MAR-1996", "Vernal Equinox"); - - lh.addStaticHoliday ("05-APR-1996", "Good Friday"); - - lh.addStaticHoliday ("08-APR-1996", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-1996", "Greenery Day"); - - lh.addStaticHoliday ("03-MAY-1996", "Constitutional"); - - lh.addStaticHoliday ("04-MAY-1996", "Bank Holiday"); - - lh.addStaticHoliday ("06-MAY-1996", "May Day"); - - lh.addStaticHoliday ("27-MAY-1996", "Late Spring Hol"); - - lh.addStaticHoliday ("26-AUG-1996", "Late Summer Hol"); - - lh.addStaticHoliday ("16-SEP-1996", "Aged Day"); - - lh.addStaticHoliday ("23-SEP-1996", "Autumnal Equinox"); - - lh.addStaticHoliday ("10-OCT-1996", "Physical Ed. Day"); - - lh.addStaticHoliday ("04-NOV-1996", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-1996", "Labor Day"); - - lh.addStaticHoliday ("23-DEC-1996", "Emperors Day"); - - lh.addStaticHoliday ("25-DEC-1996", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-1996", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-1996", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-1997", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-1997", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-1997", "Bank Holiday"); - - lh.addStaticHoliday ("15-JAN-1997", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-1997", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-1997", "Vernal Equinox Day"); - - lh.addStaticHoliday ("28-MAR-1997", "Good Friday"); - - lh.addStaticHoliday ("31-MAR-1997", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-1997", "Greenery Day"); - - lh.addStaticHoliday ("03-MAY-1997", "Constitutional"); - - lh.addStaticHoliday ("05-MAY-1997", "May Day"); - - lh.addStaticHoliday ("26-MAY-1997", "Spring Bank Holiday"); - - lh.addStaticHoliday ("20-JUL-1997", "Maritime Day"); - - lh.addStaticHoliday ("21-JUL-1997", "Ocean Day Observed"); - - lh.addStaticHoliday ("25-AUG-1997", "August Bank Holiday"); - - lh.addStaticHoliday ("15-SEP-1997", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-1997", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("10-OCT-1997", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-1997", "Culture Day"); - - lh.addStaticHoliday ("24-NOV-1997", "Labour Thanksgiving Day Observ"); - - lh.addStaticHoliday ("23-DEC-1997", "Emperors Birthday"); - - lh.addStaticHoliday ("25-DEC-1997", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-1997", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-1997", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-1998", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-1998", "Bank Holiday"); - - lh.addStaticHoliday ("15-JAN-1998", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-1998", "National Foundation Day"); - - lh.addStaticHoliday ("21-MAR-1998", "Vernal Equinox"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-1998", "Greenery Day"); - - lh.addStaticHoliday ("04-MAY-1998", "May Day"); - - lh.addStaticHoliday ("05-MAY-1998", "Childrens Day"); - - lh.addStaticHoliday ("25-MAY-1998", "Spring Bank Holiday"); - - lh.addStaticHoliday ("20-JUL-1998", "Ocean Day"); - - lh.addStaticHoliday ("31-AUG-1998", "August Bank Holiday"); - - lh.addStaticHoliday ("15-SEP-1998", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-1998", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("10-OCT-1998", "Physical Ed. Day"); - - lh.addStaticHoliday ("03-NOV-1998", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-1998", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-1998", "Emperors Birthday"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-1998", "Boxing Day Observed"); - - lh.addStaticHoliday ("31-DEC-1998", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-1999", "New Years Holiday"); - - lh.addStaticHoliday ("03-JAN-1999", "New Year Observance"); - - lh.addStaticHoliday ("15-JAN-1999", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-1999", "National Foundation Day"); - - lh.addStaticHoliday ("22-MAR-1999", "Vernal Equinox Day Observed"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-1999", "Greenery Day"); - - lh.addStaticHoliday ("03-MAY-1999", "May Day"); - - lh.addStaticHoliday ("04-MAY-1999", "National Holiday"); - - lh.addStaticHoliday ("05-MAY-1999", "Childrens Day"); - - lh.addStaticHoliday ("31-MAY-1999", "Spring Bank Holiday"); - - lh.addStaticHoliday ("20-JUL-1999", "Ocean Day"); - - lh.addStaticHoliday ("30-AUG-1999", "August Bank Holiday"); - - lh.addStaticHoliday ("15-SEP-1999", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-1999", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("11-OCT-1999", "Sports Day Observed"); - - lh.addStaticHoliday ("03-NOV-1999", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-1999", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-1999", "Emperors Birthday"); - - lh.addStaticHoliday ("27-DEC-1999", "Boxing Day Observed"); - - lh.addStaticHoliday ("28-DEC-1999", "Christmas Day Observed"); - - lh.addStaticHoliday ("31-DEC-1999", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2000", "New Year"); - - lh.addStaticHoliday ("03-JAN-2000", "New Years Day Observed"); - - lh.addStaticHoliday ("10-JAN-2000", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2000", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2000", "Vernal Equinox Day"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-2000", "Greenery Day"); - - lh.addStaticHoliday ("01-MAY-2000", "May Day"); - - lh.addStaticHoliday ("03-MAY-2000", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2000", "National Holiday"); - - lh.addStaticHoliday ("05-MAY-2000", "Childrens Day"); - - lh.addStaticHoliday ("29-MAY-2000", "Spring Bank Holiday"); - - lh.addStaticHoliday ("20-JUL-2000", "Ocean Day"); - - lh.addStaticHoliday ("28-AUG-2000", "August Bank Holiday"); - - lh.addStaticHoliday ("15-SEP-2000", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2000", "Autumnal Equinox"); - - lh.addStaticHoliday ("09-OCT-2000", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2000", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2000", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2000", "Emperors Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2001", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2001", "Bank Holiday"); - - lh.addStaticHoliday ("08-JAN-2001", "Adults Day"); - - lh.addStaticHoliday ("12-FEB-2001", "National Foundation Day Observ"); - - lh.addStaticHoliday ("20-MAR-2001", "Vernal Equinox Day"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2001", "Greenery Day Observed"); - - lh.addStaticHoliday ("03-MAY-2001", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2001", "National Holiday"); - - lh.addStaticHoliday ("05-MAY-2001", "Childrens Day"); - - lh.addStaticHoliday ("07-MAY-2001", "May Day"); - - lh.addStaticHoliday ("28-MAY-2001", "Spring Bank Holiday"); - - lh.addStaticHoliday ("20-JUL-2001", "Ocean Day"); - - lh.addStaticHoliday ("27-AUG-2001", "August Bank Holiday"); - - lh.addStaticHoliday ("15-SEP-2001", "Aged Day"); - - lh.addStaticHoliday ("24-SEP-2001", "Autumnal Equinox Day Observed"); - - lh.addStaticHoliday ("08-OCT-2001", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2001", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2001", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("24-DEC-2001", "Emperors Birthday Observed"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2001", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2002", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2002", "Bank Holiday"); - - lh.addStaticHoliday ("14-JAN-2002", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2002", "National Foundation Day"); - - lh.addStaticHoliday ("21-MAR-2002", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-2002", "Greenery Day"); - - lh.addStaticHoliday ("03-MAY-2002", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2002", "Bank Holiday"); - - lh.addStaticHoliday ("06-MAY-2002", "May Day"); - - lh.addStaticHoliday ("03-JUN-2002", "Spring Bank Holiday"); - - lh.addStaticHoliday ("04-JUN-2002", "Queens 50th Jubilee"); - - lh.addStaticHoliday ("26-AUG-2002", "August Bank Holiday"); - - lh.addStaticHoliday ("16-SEP-2002", "Respect for the Aged Day Obser"); - - lh.addStaticHoliday ("23-SEP-2002", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("14-OCT-2002", "Sports Day"); - - lh.addStaticHoliday ("04-NOV-2002", "Culture Day Observed"); - - lh.addStaticHoliday ("23-NOV-2002", "Labor Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2002", "Emperors Birthday"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2002", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2003", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2003", "Bank Holiday"); - - lh.addStaticHoliday ("13-JAN-2003", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2003", "National Foundation Day"); - - lh.addStaticHoliday ("21-MAR-2003", "Vernal Equinox Day"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-2003", "Greenery Day"); - - lh.addStaticHoliday ("03-MAY-2003", "Constitutional memory Day"); - - lh.addStaticHoliday ("05-MAY-2003", "May Day"); - - lh.addStaticHoliday ("26-MAY-2003", "Spring Bank Holiday"); - - lh.addStaticHoliday ("21-JUL-2003", "Ocean Day Observed"); - - lh.addStaticHoliday ("25-AUG-2003", "August Bank Holiday"); - - lh.addStaticHoliday ("15-SEP-2003", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2003", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("13-OCT-2003", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2003", "Culture Day"); - - lh.addStaticHoliday ("24-NOV-2003", "Labour Thanksgiving Day Observ"); - - lh.addStaticHoliday ("23-DEC-2003", "Emperors Birthday"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2003", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2004", "Bank Holiday"); - - lh.addStaticHoliday ("12-JAN-2004", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2004", "National Foundation Day"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-2004", "Greenery Day"); - - lh.addStaticHoliday ("03-MAY-2004", "May Day"); - - lh.addStaticHoliday ("04-MAY-2004", "National Holiday"); - - lh.addStaticHoliday ("05-MAY-2004", "Childrens Day"); - - lh.addStaticHoliday ("31-MAY-2004", "Spring Bank Holiday"); - - lh.addStaticHoliday ("19-JUL-2004", "Ocean Day"); - - lh.addStaticHoliday ("30-AUG-2004", "August Bank Holiday"); - - lh.addStaticHoliday ("20-SEP-2004", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2004", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("11-OCT-2004", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2004", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2004", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2004", "Emperors Birthday"); - - lh.addStaticHoliday ("27-DEC-2004", "Boxing Day Observed"); - - lh.addStaticHoliday ("28-DEC-2004", "Christmas Day Observed"); - - lh.addStaticHoliday ("31-DEC-2004", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2005", "New Years Day Observed"); - - lh.addStaticHoliday ("10-JAN-2005", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2005", "National Foundation Day"); - - lh.addStaticHoliday ("21-MAR-2005", "Vernal Equinox Day Observed"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-2005", "Greenery Day"); - - lh.addStaticHoliday ("02-MAY-2005", "May Day"); - - lh.addStaticHoliday ("03-MAY-2005", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2005", "National Holiday"); - - lh.addStaticHoliday ("05-MAY-2005", "Childrens Day"); - - lh.addStaticHoliday ("30-MAY-2005", "Spring Bank Holiday"); - - lh.addStaticHoliday ("18-JUL-2005", "Ocean Day"); - - lh.addStaticHoliday ("29-AUG-2005", "August Bank Holiday"); - - lh.addStaticHoliday ("19-SEP-2005", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2005", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("10-OCT-2005", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2005", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2005", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2005", "Emperors Birthday"); - - lh.addStaticHoliday ("26-DEC-2005", "Boxing Day"); - - lh.addStaticHoliday ("27-DEC-2005", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("03-JAN-2006", "Bank Holiday"); - - lh.addStaticHoliday ("09-JAN-2006", "Adults Day"); - - lh.addStaticHoliday ("21-MAR-2006", "Vernal Equinox Day"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "May Day"); - - lh.addStaticHoliday ("03-MAY-2006", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2006", "National Holiday"); - - lh.addStaticHoliday ("05-MAY-2006", "Childrens Day"); - - lh.addStaticHoliday ("29-MAY-2006", "Spring Bank Holiday"); - - lh.addStaticHoliday ("17-JUL-2006", "Ocean Day"); - - lh.addStaticHoliday ("28-AUG-2006", "August Bank Holiday"); - - lh.addStaticHoliday ("18-SEP-2006", "Respect for the Aged Day"); - - lh.addStaticHoliday ("09-OCT-2006", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2006", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2006", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2007", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2007", "Bank Holiday"); - - lh.addStaticHoliday ("08-JAN-2007", "Adults Day"); - - lh.addStaticHoliday ("12-FEB-2007", "National Foundation Day Observ"); - - lh.addStaticHoliday ("21-MAR-2007", "Vernal Equinox Day"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2007", "Greenery Day Observed"); - - lh.addStaticHoliday ("03-MAY-2007", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2007", "National Holiday"); - - lh.addStaticHoliday ("07-MAY-2007", "May Day"); - - lh.addStaticHoliday ("28-MAY-2007", "Spring Bank Holiday"); - - lh.addStaticHoliday ("16-JUL-2007", "Ocean Day"); - - lh.addStaticHoliday ("27-AUG-2007", "August Bank Holiday"); - - lh.addStaticHoliday ("17-SEP-2007", "Respect for the Aged Day"); - - lh.addStaticHoliday ("24-SEP-2007", "Autumnal Equinox Day Observed"); - - lh.addStaticHoliday ("08-OCT-2007", "Sports Day"); - - lh.addStaticHoliday ("23-NOV-2007", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("24-DEC-2007", "Emperors Birthday Observed"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2007", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2008", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2008", "Bank Holiday"); - - lh.addStaticHoliday ("14-JAN-2008", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2008", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2008", "Vernal Equinox Day"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-2008", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2008", "May Day"); - - lh.addStaticHoliday ("26-MAY-2008", "Spring Bank Holiday"); - - lh.addStaticHoliday ("21-JUL-2008", "Ocean Day Observed"); - - lh.addStaticHoliday ("25-AUG-2008", "August Bank Holiday"); - - lh.addStaticHoliday ("15-SEP-2008", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2008", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("13-OCT-2008", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2008", "Culture Day"); - - lh.addStaticHoliday ("24-NOV-2008", "Labour Thanksgiving Day Observ"); - - lh.addStaticHoliday ("23-DEC-2008", "Emperors Birthday"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2008", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2009", "Bank Holiday"); - - lh.addStaticHoliday ("12-JAN-2009", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2009", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2009", "Vernal Equinox Day"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-2009", "Greenery Day"); - - lh.addStaticHoliday ("04-MAY-2009", "May Day"); - - lh.addStaticHoliday ("05-MAY-2009", "Childrens Day"); - - lh.addStaticHoliday ("25-MAY-2009", "Spring Bank Holiday"); - - lh.addStaticHoliday ("20-JUL-2009", "Ocean Day"); - - lh.addStaticHoliday ("31-AUG-2009", "August Bank Holiday"); - - lh.addStaticHoliday ("21-SEP-2009", "Respect for the Aged Day"); - - lh.addStaticHoliday ("22-SEP-2009", "New Holiday"); - - lh.addStaticHoliday ("23-SEP-2009", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("12-OCT-2009", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2009", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2009", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2009", "Emperors Birthday"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2009", "Boxing Day Observed"); - - lh.addStaticHoliday ("31-DEC-2009", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2010", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2010", "National Foundation Day"); - - lh.addStaticHoliday ("22-MAR-2010", "Vernal Equinox Day Observed"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-2010", "Greenery Day"); - - lh.addStaticHoliday ("03-MAY-2010", "May Day"); - - lh.addStaticHoliday ("04-MAY-2010", "National Holiday"); - - lh.addStaticHoliday ("05-MAY-2010", "Childrens Day"); - - lh.addStaticHoliday ("31-MAY-2010", "Spring Bank Holiday"); - - lh.addStaticHoliday ("19-JUL-2010", "Ocean Day"); - - lh.addStaticHoliday ("30-AUG-2010", "August Bank Holiday"); - - lh.addStaticHoliday ("20-SEP-2010", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2010", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("11-OCT-2010", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2010", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2010", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2010", "Emperors Birthday"); - - lh.addStaticHoliday ("27-DEC-2010", "Boxing Day Observed"); - - lh.addStaticHoliday ("28-DEC-2010", "Christmas Day Observed"); - - lh.addStaticHoliday ("31-DEC-2010", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2011", "New Years Day Observed"); - - lh.addStaticHoliday ("10-JAN-2011", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2011", "National Foundation Day"); - - lh.addStaticHoliday ("21-MAR-2011", "Vernal Equinox Day"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-2011", "Greenery Day"); - - lh.addStaticHoliday ("02-MAY-2011", "May Day"); - - lh.addStaticHoliday ("03-MAY-2011", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2011", "National Holiday"); - - lh.addStaticHoliday ("05-MAY-2011", "Childrens Day"); - - lh.addStaticHoliday ("30-MAY-2011", "Spring Bank Holiday"); - - lh.addStaticHoliday ("18-JUL-2011", "Ocean Day"); - - lh.addStaticHoliday ("29-AUG-2011", "August Bank Holiday"); - - lh.addStaticHoliday ("19-SEP-2011", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2011", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("10-OCT-2011", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2011", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2011", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2011", "Emperors Birthday"); - - lh.addStaticHoliday ("26-DEC-2011", "Boxing Day"); - - lh.addStaticHoliday ("27-DEC-2011", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("03-JAN-2012", "Bank Holiday"); - - lh.addStaticHoliday ("09-JAN-2012", "Adults Day"); - - lh.addStaticHoliday ("20-MAR-2012", "Vernal Equinox Day"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2012", "Greenery Day Observed"); - - lh.addStaticHoliday ("03-MAY-2012", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2012", "National Holiday"); - - lh.addStaticHoliday ("07-MAY-2012", "May Day"); - - lh.addStaticHoliday ("28-MAY-2012", "Spring Bank Holiday"); - - lh.addStaticHoliday ("16-JUL-2012", "Ocean Day"); - - lh.addStaticHoliday ("27-AUG-2012", "August Bank Holiday"); - - lh.addStaticHoliday ("17-SEP-2012", "Respect for the Aged Day"); - - lh.addStaticHoliday ("08-OCT-2012", "Sports Day"); - - lh.addStaticHoliday ("23-NOV-2012", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("24-DEC-2012", "Emperors Birthday Observed"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2012", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2013", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2013", "Bank Holiday"); - - lh.addStaticHoliday ("14-JAN-2013", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2013", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2013", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-2013", "Greenery Day"); - - lh.addStaticHoliday ("03-MAY-2013", "Constitution Memorial Day"); - - lh.addStaticHoliday ("06-MAY-2013", "May Day"); - - lh.addStaticHoliday ("27-MAY-2013", "Spring Bank Holiday"); - - lh.addStaticHoliday ("15-JUL-2013", "Ocean Day Observed"); - - lh.addStaticHoliday ("26-AUG-2013", "August Bank Holiday"); - - lh.addStaticHoliday ("16-SEP-2013", "Respect for the Aged Day Obser"); - - lh.addStaticHoliday ("23-SEP-2013", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("14-OCT-2013", "Sports Day"); - - lh.addStaticHoliday ("04-NOV-2013", "Culture Day Observed"); - - lh.addStaticHoliday ("23-DEC-2013", "Emperors Birthday"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2013", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2014", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2014", "Bank Holiday"); - - lh.addStaticHoliday ("13-JAN-2014", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2014", "National Foundation Day"); - - lh.addStaticHoliday ("21-MAR-2014", "Vernal Equinox Day"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-2014", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2014", "May Day"); - - lh.addStaticHoliday ("26-MAY-2014", "Spring Bank Holiday"); - - lh.addStaticHoliday ("21-JUL-2014", "Ocean Day Observed"); - - lh.addStaticHoliday ("25-AUG-2014", "August Bank Holiday"); - - lh.addStaticHoliday ("15-SEP-2014", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2014", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("13-OCT-2014", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2014", "Culture Day"); - - lh.addStaticHoliday ("24-NOV-2014", "Labour Thanksgiving Day Observ"); - - lh.addStaticHoliday ("23-DEC-2014", "Emperors Birthday"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2014", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2015", "Bank Holiday"); - - lh.addStaticHoliday ("12-JAN-2015", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2015", "National Foundation Day"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-2015", "Greenery Day"); - - lh.addStaticHoliday ("04-MAY-2015", "May Day"); - - lh.addStaticHoliday ("05-MAY-2015", "Childrens Day"); - - lh.addStaticHoliday ("25-MAY-2015", "Spring Bank Holiday"); - - lh.addStaticHoliday ("20-JUL-2015", "Ocean Day"); - - lh.addStaticHoliday ("31-AUG-2015", "August Bank Holiday"); - - lh.addStaticHoliday ("21-SEP-2015", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2015", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("12-OCT-2015", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2015", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2015", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2015", "Emperors Birthday"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2015", "Boxing Day Observed"); - - lh.addStaticHoliday ("31-DEC-2015", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2016", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2016", "National Foundation Day"); - - lh.addStaticHoliday ("21-MAR-2016", "Vernal Equinox Day Observed"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-2016", "Greenery Day"); - - lh.addStaticHoliday ("02-MAY-2016", "May Day"); - - lh.addStaticHoliday ("03-MAY-2016", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2016", "National Holiday"); - - lh.addStaticHoliday ("05-MAY-2016", "Childrens Day"); - - lh.addStaticHoliday ("30-MAY-2016", "Spring Bank Holiday"); - - lh.addStaticHoliday ("18-JUL-2016", "Ocean Day"); - - lh.addStaticHoliday ("29-AUG-2016", "August Bank Holiday"); - - lh.addStaticHoliday ("19-SEP-2016", "Respect for the Aged Day"); - - lh.addStaticHoliday ("22-SEP-2016", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("10-OCT-2016", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2016", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2016", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2016", "Emperors Birthday"); - - lh.addStaticHoliday ("26-DEC-2016", "Boxing Day"); - - lh.addStaticHoliday ("27-DEC-2016", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("03-JAN-2017", "Bank Holiday"); - - lh.addStaticHoliday ("09-JAN-2017", "Adults Day"); - - lh.addStaticHoliday ("20-MAR-2017", "Vernal Equinox Day"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "May Day"); - - lh.addStaticHoliday ("03-MAY-2017", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2017", "National Holiday"); - - lh.addStaticHoliday ("05-MAY-2017", "Childrens Day"); - - lh.addStaticHoliday ("29-MAY-2017", "Spring Bank Holiday"); - - lh.addStaticHoliday ("17-JUL-2017", "Ocean Day"); - - lh.addStaticHoliday ("28-AUG-2017", "August Bank Holiday"); - - lh.addStaticHoliday ("18-SEP-2017", "Respect for the Aged Day"); - - lh.addStaticHoliday ("09-OCT-2017", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2017", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2017", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2018", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2018", "Bank Holiday"); - - lh.addStaticHoliday ("08-JAN-2018", "Adults Day"); - - lh.addStaticHoliday ("12-FEB-2018", "National Foundation Day Observ"); - - lh.addStaticHoliday ("21-MAR-2018", "Vernal Equinox Day"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2018", "Greenery Day Observed"); - - lh.addStaticHoliday ("03-MAY-2018", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2018", "National Holiday"); - - lh.addStaticHoliday ("07-MAY-2018", "May Day"); - - lh.addStaticHoliday ("28-MAY-2018", "Spring Bank Holiday"); - - lh.addStaticHoliday ("16-JUL-2018", "Ocean Day"); - - lh.addStaticHoliday ("27-AUG-2018", "August Bank Holiday"); - - lh.addStaticHoliday ("17-SEP-2018", "Respect for the Aged Day"); - - lh.addStaticHoliday ("24-SEP-2018", "Autumnal Equinox Day Observed"); - - lh.addStaticHoliday ("08-OCT-2018", "Sports Day"); - - lh.addStaticHoliday ("23-NOV-2018", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("24-DEC-2018", "Emperors Birthday Observed"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2018", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2019", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2019", "Bank Holiday"); - - lh.addStaticHoliday ("14-JAN-2019", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2019", "National Foundation Day"); - - lh.addStaticHoliday ("21-MAR-2019", "Vernal Equinox Day"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-2019", "Greenery Day"); - - lh.addStaticHoliday ("03-MAY-2019", "Constitution Memorial Day"); - - lh.addStaticHoliday ("06-MAY-2019", "May Day"); - - lh.addStaticHoliday ("27-MAY-2019", "Spring Bank Holiday"); - - lh.addStaticHoliday ("15-JUL-2019", "Ocean Day"); - - lh.addStaticHoliday ("26-AUG-2019", "August Bank Holiday"); - - lh.addStaticHoliday ("16-SEP-2019", "Respect for the Aged Day Obser"); - - lh.addStaticHoliday ("23-SEP-2019", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("14-OCT-2019", "Sports Day"); - - lh.addStaticHoliday ("04-NOV-2019", "Culture Day Observed"); - - lh.addStaticHoliday ("23-DEC-2019", "Emperors Birthday"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2019", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2020", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2020", "Bank Holiday"); - - lh.addStaticHoliday ("13-JAN-2020", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2020", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2020", "Vernal Equinox Day"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-2020", "Greenery Day"); - - lh.addStaticHoliday ("04-MAY-2020", "May Day"); - - lh.addStaticHoliday ("05-MAY-2020", "Childrens Day"); - - lh.addStaticHoliday ("25-MAY-2020", "Spring Bank Holiday"); - - lh.addStaticHoliday ("20-JUL-2020", "Ocean Day"); - - lh.addStaticHoliday ("31-AUG-2020", "August Bank Holiday"); - - lh.addStaticHoliday ("21-SEP-2020", "Respect for the Aged Day"); - - lh.addStaticHoliday ("22-SEP-2020", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("12-OCT-2020", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2020", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2020", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2020", "Emperors Birthday"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2020", "Boxing Day Observed"); - - lh.addStaticHoliday ("31-DEC-2020", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2021", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2021", "National Foundation Day"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-2021", "Greenery Day"); - - lh.addStaticHoliday ("03-MAY-2021", "May Day"); - - lh.addStaticHoliday ("04-MAY-2021", "National Holiday"); - - lh.addStaticHoliday ("05-MAY-2021", "Childrens Day"); - - lh.addStaticHoliday ("31-MAY-2021", "Spring Bank Holiday"); - - lh.addStaticHoliday ("19-JUL-2021", "Ocean Day"); - - lh.addStaticHoliday ("30-AUG-2021", "August Bank Holiday"); - - lh.addStaticHoliday ("20-SEP-2021", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2021", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("11-OCT-2021", "Sports Day Observed"); - - lh.addStaticHoliday ("03-NOV-2021", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2021", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2021", "Emperors Birthday"); - - lh.addStaticHoliday ("27-DEC-2021", "Boxing Day Observed"); - - lh.addStaticHoliday ("28-DEC-2021", "Christmas Day Observed"); - - lh.addStaticHoliday ("31-DEC-2021", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2022", "New Years Day Observed"); - - lh.addStaticHoliday ("10-JAN-2022", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2022", "National Foundation Day"); - - lh.addStaticHoliday ("21-MAR-2022", "Vernal Equinox Day"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-2022", "Greenery Day"); - - lh.addStaticHoliday ("02-MAY-2022", "May Day"); - - lh.addStaticHoliday ("03-MAY-2022", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2022", "National Holiday"); - - lh.addStaticHoliday ("05-MAY-2022", "Childrens Day"); - - lh.addStaticHoliday ("30-MAY-2022", "Spring Bank Holiday"); - - lh.addStaticHoliday ("18-JUL-2022", "Ocean Day"); - - lh.addStaticHoliday ("29-AUG-2022", "August Bank Holiday"); - - lh.addStaticHoliday ("19-SEP-2022", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2022", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("10-OCT-2022", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2022", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2022", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2022", "Emperors Birthday"); - - lh.addStaticHoliday ("26-DEC-2022", "Boxing Day"); - - lh.addStaticHoliday ("27-DEC-2022", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("03-JAN-2023", "Bank Holiday"); - - lh.addStaticHoliday ("09-JAN-2023", "Adults Day"); - - lh.addStaticHoliday ("21-MAR-2023", "Vernal Equinox Day"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "May Day"); - - lh.addStaticHoliday ("03-MAY-2023", "Constitution Memorial Day"); - - lh.addStaticHoliday ("04-MAY-2023", "National Holiday"); - - lh.addStaticHoliday ("05-MAY-2023", "Childrens Day"); - - lh.addStaticHoliday ("29-MAY-2023", "Spring Bank Holiday"); - - lh.addStaticHoliday ("17-JUL-2023", "Ocean Day"); - - lh.addStaticHoliday ("28-AUG-2023", "August Bank Holiday"); - - lh.addStaticHoliday ("18-SEP-2023", "Respect for the Aged Day"); - - lh.addStaticHoliday ("09-OCT-2023", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2023", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2023", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2024", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2024", "Bank Holiday"); - - lh.addStaticHoliday ("08-JAN-2024", "Adults Day"); - - lh.addStaticHoliday ("12-FEB-2024", "National Foundation Day Observ"); - - lh.addStaticHoliday ("20-MAR-2024", "Vernal Equinox Day"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-2024", "Greenery Day"); - - lh.addStaticHoliday ("03-MAY-2024", "Constitution Memorial Day"); - - lh.addStaticHoliday ("06-MAY-2024", "May Day"); - - lh.addStaticHoliday ("27-MAY-2024", "Spring Bank Holiday"); - - lh.addStaticHoliday ("15-JUL-2024", "Ocean Day"); - - lh.addStaticHoliday ("26-AUG-2024", "August Bank Holiday"); - - lh.addStaticHoliday ("16-SEP-2024", "Respect for the Aged Day Obser"); - - lh.addStaticHoliday ("23-SEP-2024", "Autumnal Equinox Day Observed"); - - lh.addStaticHoliday ("14-OCT-2024", "Sports Day"); - - lh.addStaticHoliday ("04-NOV-2024", "Culture Day Observed"); - - lh.addStaticHoliday ("23-DEC-2024", "Emperors Birthday"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2024", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2025", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2025", "Bank Holiday"); - - lh.addStaticHoliday ("13-JAN-2025", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2025", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2025", "Vernal Equinox Day"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-2025", "Greenery Day"); - - lh.addStaticHoliday ("05-MAY-2025", "May Day"); - - lh.addStaticHoliday ("26-MAY-2025", "Spring Bank Holiday"); - - lh.addStaticHoliday ("21-JUL-2025", "Ocean Day Observed"); - - lh.addStaticHoliday ("25-AUG-2025", "August Bank Holiday"); - - lh.addStaticHoliday ("15-SEP-2025", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2025", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("13-OCT-2025", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2025", "Culture Day"); - - lh.addStaticHoliday ("24-NOV-2025", "Labour Thanksgiving Day Observ"); - - lh.addStaticHoliday ("23-DEC-2025", "Emperors Birthday"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2025", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2026", "Bank Holiday"); - - lh.addStaticHoliday ("12-JAN-2026", "Adults Day"); - - lh.addStaticHoliday ("11-FEB-2026", "National Foundation Day"); - - lh.addStaticHoliday ("20-MAR-2026", "Vernal Equinox Day"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("29-APR-2026", "Greenery Day"); - - lh.addStaticHoliday ("04-MAY-2026", "May Day"); - - lh.addStaticHoliday ("05-MAY-2026", "Childrens Day"); - - lh.addStaticHoliday ("25-MAY-2026", "Spring Bank Holiday"); - - lh.addStaticHoliday ("20-JUL-2026", "Ocean Day"); - - lh.addStaticHoliday ("31-AUG-2026", "August Bank Holiday"); - - lh.addStaticHoliday ("21-SEP-2026", "Respect for the Aged Day"); - - lh.addStaticHoliday ("23-SEP-2026", "Autumnal Equinox Day"); - - lh.addStaticHoliday ("12-OCT-2026", "Sports Day"); - - lh.addStaticHoliday ("03-NOV-2026", "Culture Day"); - - lh.addStaticHoliday ("23-NOV-2026", "Labour Thanksgiving Day"); - - lh.addStaticHoliday ("23-DEC-2026", "Emperors Birthday"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2026", "Boxing Day Observed"); - - lh.addStaticHoliday ("31-DEC-2026", "Bank Holiday"); - - lh.addStaticHoliday ("null", ""); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/MKDHoliday.java b/org/drip/analytics/holset/MKDHoliday.java deleted file mode 100644 index 008d7be..0000000 --- a/org/drip/analytics/holset/MKDHoliday.java +++ /dev/null @@ -1,587 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class MKDHoliday implements org.drip.analytics.holset.LocationHoliday { - public MKDHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "MKD"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-1998", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-1998", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("20-APR-1998", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("04-MAY-1998", "Day after Labour Day Observed"); - - lh.addStaticHoliday ("03-AUG-1998", "National Holiday Observed"); - - lh.addStaticHoliday ("08-SEP-1998", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-1998", "Liberation Day Observed"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("04-JAN-1999", "New Years Holiday Observed"); - - lh.addStaticHoliday ("07-JAN-1999", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("12-APR-1999", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("03-MAY-1999", "Labour Day Observed"); - - lh.addStaticHoliday ("02-AUG-1999", "National Holiday"); - - lh.addStaticHoliday ("08-SEP-1999", "Independence Day"); - - lh.addStaticHoliday ("11-OCT-1999", "Liberation Day"); - - lh.addStaticHoliday ("03-JAN-2000", "New Years Day Observed"); - - lh.addStaticHoliday ("07-JAN-2000", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2000", "Day after Labour Day"); - - lh.addStaticHoliday ("02-AUG-2000", "National Holiday"); - - lh.addStaticHoliday ("08-SEP-2000", "Independence Day"); - - lh.addStaticHoliday ("11-OCT-2000", "Liberation Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2001", "New Years Holiday"); - - lh.addStaticHoliday ("08-JAN-2001", "Orthodox Christmas Day Observed"); - - lh.addStaticHoliday ("16-APR-2001", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2001", "Day after Labour Day"); - - lh.addStaticHoliday ("02-AUG-2001", "National Holiday"); - - lh.addStaticHoliday ("10-SEP-2001", "Independence Day Observed"); - - lh.addStaticHoliday ("11-OCT-2001", "Liberation Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2002", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-2002", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2002", "Day after Labour Day"); - - lh.addStaticHoliday ("06-MAY-2002", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("02-AUG-2002", "National Holiday"); - - lh.addStaticHoliday ("09-SEP-2002", "Independence Day Observed"); - - lh.addStaticHoliday ("11-OCT-2002", "Liberation Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2003", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-2003", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("28-APR-2003", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2003", "Day after Labour Day"); - - lh.addStaticHoliday ("04-AUG-2003", "National Holiday Observed"); - - lh.addStaticHoliday ("08-SEP-2003", "Independence Day"); - - lh.addStaticHoliday ("13-OCT-2003", "Liberation Day Observed"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2004", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-2004", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("12-APR-2004", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2004", "Labour Day Observed"); - - lh.addStaticHoliday ("02-AUG-2004", "National Holiday"); - - lh.addStaticHoliday ("08-SEP-2004", "Independence Day"); - - lh.addStaticHoliday ("11-OCT-2004", "Liberation Day"); - - lh.addStaticHoliday ("03-JAN-2005", "New Years Day Observed"); - - lh.addStaticHoliday ("07-JAN-2005", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("02-MAY-2005", "Day after Labour Day"); - - lh.addStaticHoliday ("03-MAY-2005", "Labour Day Observed"); - - lh.addStaticHoliday ("02-AUG-2005", "National Holiday"); - - lh.addStaticHoliday ("08-SEP-2005", "Independence Day"); - - lh.addStaticHoliday ("11-OCT-2005", "Liberation Day"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Holiday"); - - lh.addStaticHoliday ("03-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("09-JAN-2006", "Orthodox Christmas Day Observed"); - - lh.addStaticHoliday ("24-APR-2006", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2006", "Day after Labour Day"); - - lh.addStaticHoliday ("02-AUG-2006", "National Holiday"); - - lh.addStaticHoliday ("08-SEP-2006", "Independence Day"); - - lh.addStaticHoliday ("11-OCT-2006", "Liberation Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2007", "New Years Holiday"); - - lh.addStaticHoliday ("08-JAN-2007", "Orthodox Christmas Day Observed"); - - lh.addStaticHoliday ("09-APR-2007", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2007", "Day after Labour Day"); - - lh.addStaticHoliday ("02-AUG-2007", "National Holiday"); - - lh.addStaticHoliday ("10-SEP-2007", "Independence Day Observed"); - - lh.addStaticHoliday ("11-OCT-2007", "Liberation Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2008", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-2008", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("28-APR-2008", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2008", "Day after Labour Day"); - - lh.addStaticHoliday ("04-AUG-2008", "National Holiday Observed"); - - lh.addStaticHoliday ("08-SEP-2008", "Independence Day"); - - lh.addStaticHoliday ("13-OCT-2008", "Liberation Day Observed"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2009", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-2009", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("20-APR-2009", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("04-MAY-2009", "Day after Labour Day Observed"); - - lh.addStaticHoliday ("03-AUG-2009", "National Holiday Observed"); - - lh.addStaticHoliday ("08-SEP-2009", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2009", "Liberation Day Observed"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("04-JAN-2010", "New Years Holiday Observed"); - - lh.addStaticHoliday ("07-JAN-2010", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("05-APR-2010", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2010", "Labour Day Observed"); - - lh.addStaticHoliday ("02-AUG-2010", "National Holiday"); - - lh.addStaticHoliday ("08-SEP-2010", "Independence Day"); - - lh.addStaticHoliday ("11-OCT-2010", "Liberation Day"); - - lh.addStaticHoliday ("03-JAN-2011", "New Years Day Observed"); - - lh.addStaticHoliday ("07-JAN-2011", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("25-APR-2011", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2011", "Day after Labour Day"); - - lh.addStaticHoliday ("03-MAY-2011", "Labour Day Observed"); - - lh.addStaticHoliday ("02-AUG-2011", "National Holiday"); - - lh.addStaticHoliday ("08-SEP-2011", "Independence Day"); - - lh.addStaticHoliday ("11-OCT-2011", "Liberation Day"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Holiday"); - - lh.addStaticHoliday ("03-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("09-JAN-2012", "Orthodox Christmas Day Observed"); - - lh.addStaticHoliday ("16-APR-2012", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2012", "Day after Labour Day"); - - lh.addStaticHoliday ("02-AUG-2012", "National Holiday"); - - lh.addStaticHoliday ("10-SEP-2012", "Independence Day Observed"); - - lh.addStaticHoliday ("11-OCT-2012", "Liberation Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2013", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-2013", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2013", "Day after Labour Day"); - - lh.addStaticHoliday ("06-MAY-2013", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("02-AUG-2013", "National Holiday"); - - lh.addStaticHoliday ("09-SEP-2013", "Independence Day Observed"); - - lh.addStaticHoliday ("11-OCT-2013", "Liberation Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2014", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-2014", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("21-APR-2014", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2014", "Day after Labour Day"); - - lh.addStaticHoliday ("04-AUG-2014", "National Holiday Observed"); - - lh.addStaticHoliday ("08-SEP-2014", "Independence Day"); - - lh.addStaticHoliday ("13-OCT-2014", "Liberation Day Observed"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2015", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-2015", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("13-APR-2015", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("04-MAY-2015", "Day after Labour Day Observed"); - - lh.addStaticHoliday ("03-AUG-2015", "National Holiday Observed"); - - lh.addStaticHoliday ("08-SEP-2015", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2015", "Liberation Day Observed"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("04-JAN-2016", "New Years Holiday Observed"); - - lh.addStaticHoliday ("07-JAN-2016", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("02-MAY-2016", "Day after Labour Day"); - - lh.addStaticHoliday ("03-MAY-2016", "Labour Day Observed"); - - lh.addStaticHoliday ("02-AUG-2016", "National Holiday"); - - lh.addStaticHoliday ("08-SEP-2016", "Independence Day"); - - lh.addStaticHoliday ("11-OCT-2016", "Liberation Day"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Holiday"); - - lh.addStaticHoliday ("03-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("09-JAN-2017", "Orthodox Christmas Day Observed"); - - lh.addStaticHoliday ("17-APR-2017", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2017", "Day after Labour Day"); - - lh.addStaticHoliday ("02-AUG-2017", "National Holiday"); - - lh.addStaticHoliday ("08-SEP-2017", "Independence Day"); - - lh.addStaticHoliday ("11-OCT-2017", "Liberation Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2018", "New Years Holiday"); - - lh.addStaticHoliday ("08-JAN-2018", "Orthodox Christmas Day Observed"); - - lh.addStaticHoliday ("09-APR-2018", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2018", "Day after Labour Day"); - - lh.addStaticHoliday ("02-AUG-2018", "National Holiday"); - - lh.addStaticHoliday ("10-SEP-2018", "Independence Day Observed"); - - lh.addStaticHoliday ("11-OCT-2018", "Liberation Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2019", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-2019", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("29-APR-2019", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2019", "Day after Labour Day"); - - lh.addStaticHoliday ("02-AUG-2019", "National Holiday"); - - lh.addStaticHoliday ("09-SEP-2019", "Independence Day Observed"); - - lh.addStaticHoliday ("11-OCT-2019", "Liberation Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2020", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-2020", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("20-APR-2020", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("04-MAY-2020", "Day after Labour Day Observed"); - - lh.addStaticHoliday ("03-AUG-2020", "National Holiday Observed"); - - lh.addStaticHoliday ("08-SEP-2020", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2020", "Liberation Day Observed"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("04-JAN-2021", "New Years Holiday Observed"); - - lh.addStaticHoliday ("07-JAN-2021", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("03-MAY-2021", "Labour Day Observed"); - - lh.addStaticHoliday ("02-AUG-2021", "National Holiday"); - - lh.addStaticHoliday ("08-SEP-2021", "Independence Day"); - - lh.addStaticHoliday ("11-OCT-2021", "Liberation Day"); - - lh.addStaticHoliday ("03-JAN-2022", "New Years Day Observed"); - - lh.addStaticHoliday ("07-JAN-2022", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("25-APR-2022", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2022", "Day after Labour Day"); - - lh.addStaticHoliday ("03-MAY-2022", "Labour Day Observed"); - - lh.addStaticHoliday ("02-AUG-2022", "National Holiday"); - - lh.addStaticHoliday ("08-SEP-2022", "Independence Day"); - - lh.addStaticHoliday ("11-OCT-2022", "Liberation Day"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Holiday"); - - lh.addStaticHoliday ("03-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("09-JAN-2023", "Orthodox Christmas Day Observed"); - - lh.addStaticHoliday ("17-APR-2023", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2023", "Day after Labour Day"); - - lh.addStaticHoliday ("02-AUG-2023", "National Holiday"); - - lh.addStaticHoliday ("08-SEP-2023", "Independence Day"); - - lh.addStaticHoliday ("11-OCT-2023", "Liberation Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2024", "New Years Holiday"); - - lh.addStaticHoliday ("08-JAN-2024", "Orthodox Christmas Day Observed"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2024", "Day after Labour Day"); - - lh.addStaticHoliday ("06-MAY-2024", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("02-AUG-2024", "National Holiday"); - - lh.addStaticHoliday ("09-SEP-2024", "Independence Day Observed"); - - lh.addStaticHoliday ("11-OCT-2024", "Liberation Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2025", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-2025", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("21-APR-2025", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2025", "Day after Labour Day"); - - lh.addStaticHoliday ("04-AUG-2025", "National Holiday Observed"); - - lh.addStaticHoliday ("08-SEP-2025", "Independence Day"); - - lh.addStaticHoliday ("13-OCT-2025", "Liberation Day Observed"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2026", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-2026", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("13-APR-2026", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("04-MAY-2026", "Day after Labour Day Observed"); - - lh.addStaticHoliday ("03-AUG-2026", "National Holiday Observed"); - - lh.addStaticHoliday ("08-SEP-2026", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2026", "Liberation Day Observed"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("04-JAN-2027", "New Years Holiday Observed"); - - lh.addStaticHoliday ("07-JAN-2027", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("03-MAY-2027", "Labour Day Observed"); - - lh.addStaticHoliday ("02-AUG-2027", "National Holiday"); - - lh.addStaticHoliday ("08-SEP-2027", "Independence Day"); - - lh.addStaticHoliday ("11-OCT-2027", "Liberation Day"); - - lh.addStaticHoliday ("03-JAN-2028", "New Years Day Observed"); - - lh.addStaticHoliday ("07-JAN-2028", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("17-APR-2028", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2028", "Day after Labour Day"); - - lh.addStaticHoliday ("02-AUG-2028", "National Holiday"); - - lh.addStaticHoliday ("08-SEP-2028", "Independence Day"); - - lh.addStaticHoliday ("11-OCT-2028", "Liberation Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/MXCHoliday.java b/org/drip/analytics/holset/MXCHoliday.java deleted file mode 100644 index d988640..0000000 --- a/org/drip/analytics/holset/MXCHoliday.java +++ /dev/null @@ -1,1251 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class MXCHoliday implements org.drip.analytics.holset.LocationHoliday { - public MXCHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "MXC"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-1998", "Constitution Day"); - - lh.addStaticHoliday ("09-APR-1998", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-1998", "Puebla Battle Day"); - - lh.addStaticHoliday ("01-SEP-1998", "Presidential Report"); - - lh.addStaticHoliday ("16-SEP-1998", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-1998", "All Souls Day"); - - lh.addStaticHoliday ("20-NOV-1998", "Revolution Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-1999", "Constitution Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-MAY-1999", "Puebla Battle Day"); - - lh.addStaticHoliday ("01-SEP-1999", "Presidential Report"); - - lh.addStaticHoliday ("16-SEP-1999", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-1999", "All Souls Day"); - - lh.addStaticHoliday ("21-MAR-2000", "Juarezs Birthday"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2000", "Puebla Battle Day"); - - lh.addStaticHoliday ("01-SEP-2000", "Presidential Report"); - - lh.addStaticHoliday ("02-NOV-2000", "All Souls Day"); - - lh.addStaticHoliday ("20-NOV-2000", "Revolution Day"); - - lh.addStaticHoliday ("01-DEC-2000", "Presidential Succession Day"); - - lh.addStaticHoliday ("12-DEC-2000", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2001", "Constitution Day"); - - lh.addStaticHoliday ("21-MAR-2001", "Juarezs Birthday"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("02-NOV-2001", "All Souls Day"); - - lh.addStaticHoliday ("20-NOV-2001", "Revolution Day"); - - lh.addStaticHoliday ("12-DEC-2001", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2002", "Constitution Day"); - - lh.addStaticHoliday ("21-MAR-2002", "Juarezs Birthday"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("16-SEP-2002", "Independence Day"); - - lh.addStaticHoliday ("20-NOV-2002", "Revolution Day"); - - lh.addStaticHoliday ("12-DEC-2002", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2003", "Constitution Day"); - - lh.addStaticHoliday ("21-MAR-2003", "Juarezs Birthday"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2003", "Puebla Battle Day"); - - lh.addStaticHoliday ("16-SEP-2003", "Independence Day"); - - lh.addStaticHoliday ("20-NOV-2003", "Revolution Day"); - - lh.addStaticHoliday ("12-DEC-2003", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2004", "Constitution Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("05-MAY-2004", "Puebla Battle Day"); - - lh.addStaticHoliday ("16-SEP-2004", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2004", "All Souls Day"); - - lh.addStaticHoliday ("21-MAR-2005", "Juarezs Birthday"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("16-SEP-2005", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2005", "All Souls Day"); - - lh.addStaticHoliday ("12-DEC-2005", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("01-JAN-2006", "New Years Day"); - - lh.addStaticHoliday ("06-FEB-2006", "Dia de la Constitucion"); - - lh.addStaticHoliday ("21-MAR-2006", "Juarezs Birthday"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("16-SEP-2006", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2006", "All Souls Day"); - - lh.addStaticHoliday ("20-NOV-2006", "Revolution Day"); - - lh.addStaticHoliday ("01-DEC-2006", "Presidential Succession Day"); - - lh.addStaticHoliday ("12-DEC-2006", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2007", "Constitution Day"); - - lh.addStaticHoliday ("19-MAR-2007", "Juarezs Birthday"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("02-NOV-2007", "All Souls Day"); - - lh.addStaticHoliday ("19-NOV-2007", "Revolution Day"); - - lh.addStaticHoliday ("12-DEC-2007", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("04-FEB-2008", "Constitution Day"); - - lh.addStaticHoliday ("17-MAR-2008", "Juarezs Birthday"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("16-SEP-2008", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2008", "All Souls Day"); - - lh.addStaticHoliday ("17-NOV-2008", "Revolution Day"); - - lh.addStaticHoliday ("12-DEC-2008", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("02-FEB-2009", "Constitution Day"); - - lh.addStaticHoliday ("16-MAR-2009", "Juarezs Birthday"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("16-SEP-2009", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2009", "All Souls Day"); - - lh.addStaticHoliday ("16-NOV-2009", "Revolution Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "MXN"); - - lh.addStaticHoliday ("01-FEB-2010", "MXN"); - - lh.addStaticHoliday ("15-MAR-2010", "MXN"); - - lh.addStaticHoliday ("01-APR-2010", "MXN"); - - lh.addStaticHoliday ("02-APR-2010", "MXN"); - - lh.addStaticHoliday ("16-SEP-2010", "MXN"); - - lh.addStaticHoliday ("17-SEP-2010", "MXN"); - - lh.addStaticHoliday ("02-NOV-2010", "MXN"); - - lh.addStaticHoliday ("15-NOV-2010", "MXN"); - - lh.addStaticHoliday ("07-FEB-2011", "MXN"); - - lh.addStaticHoliday ("21-MAR-2011", "MXN"); - - lh.addStaticHoliday ("21-APR-2011", "MXN"); - - lh.addStaticHoliday ("22-APR-2011", "MXN"); - - lh.addStaticHoliday ("16-SEP-2011", "MXN"); - - lh.addStaticHoliday ("02-NOV-2011", "MXN"); - - lh.addStaticHoliday ("21-NOV-2011", "MXN"); - - lh.addStaticHoliday ("12-DEC-2011", "MXN"); - - lh.addStaticHoliday ("06-FEB-2012", "MXN"); - - lh.addStaticHoliday ("19-MAR-2012", "MXN"); - - lh.addStaticHoliday ("05-APR-2012", "MXN"); - - lh.addStaticHoliday ("06-APR-2012", "MXN"); - - lh.addStaticHoliday ("01-MAY-2012", "MXN"); - - lh.addStaticHoliday ("02-NOV-2012", "MXN"); - - lh.addStaticHoliday ("19-NOV-2012", "MXN"); - - lh.addStaticHoliday ("12-DEC-2012", "MXN"); - - lh.addStaticHoliday ("25-DEC-2012", "MXN"); - - lh.addStaticHoliday ("01-JAN-2013", "MXN"); - - lh.addStaticHoliday ("04-FEB-2013", "MXN"); - - lh.addStaticHoliday ("18-MAR-2013", "MXN"); - - lh.addStaticHoliday ("28-MAR-2013", "MXN"); - - lh.addStaticHoliday ("29-MAR-2013", "MXN"); - - lh.addStaticHoliday ("01-MAY-2013", "MXN"); - - lh.addStaticHoliday ("16-SEP-2013", "MXN"); - - lh.addStaticHoliday ("18-NOV-2013", "MXN"); - - lh.addStaticHoliday ("12-DEC-2013", "MXN"); - - lh.addStaticHoliday ("25-DEC-2013", "MXN"); - - lh.addStaticHoliday ("01-JAN-2014", "MXN"); - - lh.addStaticHoliday ("03-FEB-2014", "MXN"); - - lh.addStaticHoliday ("17-MAR-2014", "MXN"); - - lh.addStaticHoliday ("17-APR-2014", "MXN"); - - lh.addStaticHoliday ("18-APR-2014", "MXN"); - - lh.addStaticHoliday ("01-MAY-2014", "MXN"); - - lh.addStaticHoliday ("16-SEP-2014", "MXN"); - - lh.addStaticHoliday ("17-NOV-2014", "MXN"); - - lh.addStaticHoliday ("12-DEC-2014", "MXN"); - - lh.addStaticHoliday ("25-DEC-2014", "MXN"); - - lh.addStaticHoliday ("01-JAN-2015", "MXN"); - - lh.addStaticHoliday ("02-FEB-2015", "MXN"); - - lh.addStaticHoliday ("16-MAR-2015", "MXN"); - - lh.addStaticHoliday ("02-APR-2015", "MXN"); - - lh.addStaticHoliday ("03-APR-2015", "MXN"); - - lh.addStaticHoliday ("01-MAY-2015", "MXN"); - - lh.addStaticHoliday ("16-SEP-2015", "MXN"); - - lh.addStaticHoliday ("02-NOV-2015", "MXN"); - - lh.addStaticHoliday ("16-NOV-2015", "MXN"); - - lh.addStaticHoliday ("25-DEC-2015", "MXN"); - - lh.addStaticHoliday ("01-JAN-2016", "MXN"); - - lh.addStaticHoliday ("01-FEB-2016", "MXN"); - - lh.addStaticHoliday ("21-MAR-2016", "MXN"); - - lh.addStaticHoliday ("24-MAR-2016", "MXN"); - - lh.addStaticHoliday ("25-MAR-2016", "MXN"); - - lh.addStaticHoliday ("16-SEP-2016", "MXN"); - - lh.addStaticHoliday ("02-NOV-2016", "MXN"); - - lh.addStaticHoliday ("21-NOV-2016", "MXN"); - - lh.addStaticHoliday ("12-DEC-2016", "MXN"); - - lh.addStaticHoliday ("06-FEB-2017", "MXN"); - - lh.addStaticHoliday ("20-MAR-2017", "MXN"); - - lh.addStaticHoliday ("13-APR-2017", "MXN"); - - lh.addStaticHoliday ("14-APR-2017", "MXN"); - - lh.addStaticHoliday ("01-MAY-2017", "MXN"); - - lh.addStaticHoliday ("02-NOV-2017", "MXN"); - - lh.addStaticHoliday ("20-NOV-2017", "MXN"); - - lh.addStaticHoliday ("12-DEC-2017", "MXN"); - - lh.addStaticHoliday ("25-DEC-2017", "MXN"); - - lh.addStaticHoliday ("01-JAN-2018", "MXN"); - - lh.addStaticHoliday ("05-FEB-2018", "MXN"); - - lh.addStaticHoliday ("19-MAR-2018", "MXN"); - - lh.addStaticHoliday ("29-MAR-2018", "MXN"); - - lh.addStaticHoliday ("30-MAR-2018", "MXN"); - - lh.addStaticHoliday ("01-MAY-2018", "MXN"); - - lh.addStaticHoliday ("02-NOV-2018", "MXN"); - - lh.addStaticHoliday ("19-NOV-2018", "MXN"); - - lh.addStaticHoliday ("12-DEC-2018", "MXN"); - - lh.addStaticHoliday ("25-DEC-2018", "MXN"); - - lh.addStaticHoliday ("01-JAN-2019", "MXN"); - - lh.addStaticHoliday ("04-FEB-2019", "MXN"); - - lh.addStaticHoliday ("18-MAR-2019", "MXN"); - - lh.addStaticHoliday ("18-APR-2019", "MXN"); - - lh.addStaticHoliday ("19-APR-2019", "MXN"); - - lh.addStaticHoliday ("01-MAY-2019", "MXN"); - - lh.addStaticHoliday ("16-SEP-2019", "MXN"); - - lh.addStaticHoliday ("18-NOV-2019", "MXN"); - - lh.addStaticHoliday ("12-DEC-2019", "MXN"); - - lh.addStaticHoliday ("25-DEC-2019", "MXN"); - - lh.addStaticHoliday ("01-JAN-2020", "MXN"); - - lh.addStaticHoliday ("03-FEB-2020", "MXN"); - - lh.addStaticHoliday ("16-MAR-2020", "MXN"); - - lh.addStaticHoliday ("09-APR-2020", "MXN"); - - lh.addStaticHoliday ("10-APR-2020", "MXN"); - - lh.addStaticHoliday ("01-MAY-2020", "MXN"); - - lh.addStaticHoliday ("16-SEP-2020", "MXN"); - - lh.addStaticHoliday ("02-NOV-2020", "MXN"); - - lh.addStaticHoliday ("16-NOV-2020", "MXN"); - - lh.addStaticHoliday ("25-DEC-2020", "MXN"); - - lh.addStaticHoliday ("01-JAN-2021", "MXN"); - - lh.addStaticHoliday ("01-FEB-2021", "MXN"); - - lh.addStaticHoliday ("15-MAR-2021", "MXN"); - - lh.addStaticHoliday ("01-APR-2021", "MXN"); - - lh.addStaticHoliday ("02-APR-2021", "MXN"); - - lh.addStaticHoliday ("16-SEP-2021", "MXN"); - - lh.addStaticHoliday ("02-NOV-2021", "MXN"); - - lh.addStaticHoliday ("15-NOV-2021", "MXN"); - - lh.addStaticHoliday ("07-FEB-2022", "MXN"); - - lh.addStaticHoliday ("21-MAR-2022", "MXN"); - - lh.addStaticHoliday ("14-APR-2022", "MXN"); - - lh.addStaticHoliday ("15-APR-2022", "MXN"); - - lh.addStaticHoliday ("16-SEP-2022", "MXN"); - - lh.addStaticHoliday ("02-NOV-2022", "MXN"); - - lh.addStaticHoliday ("21-NOV-2022", "MXN"); - - lh.addStaticHoliday ("12-DEC-2022", "MXN"); - - lh.addStaticHoliday ("06-FEB-2023", "MXN"); - - lh.addStaticHoliday ("20-MAR-2023", "MXN"); - - lh.addStaticHoliday ("06-APR-2023", "MXN"); - - lh.addStaticHoliday ("07-APR-2023", "MXN"); - - lh.addStaticHoliday ("01-MAY-2023", "MXN"); - - lh.addStaticHoliday ("02-NOV-2023", "MXN"); - - lh.addStaticHoliday ("20-NOV-2023", "MXN"); - - lh.addStaticHoliday ("12-DEC-2023", "MXN"); - - lh.addStaticHoliday ("25-DEC-2023", "MXN"); - - lh.addStaticHoliday ("01-JAN-2024", "MXN"); - - lh.addStaticHoliday ("05-FEB-2024", "MXN"); - - lh.addStaticHoliday ("18-MAR-2024", "MXN"); - - lh.addStaticHoliday ("28-MAR-2024", "MXN"); - - lh.addStaticHoliday ("29-MAR-2024", "MXN"); - - lh.addStaticHoliday ("01-MAY-2024", "MXN"); - - lh.addStaticHoliday ("16-SEP-2024", "MXN"); - - lh.addStaticHoliday ("18-NOV-2024", "MXN"); - - lh.addStaticHoliday ("12-DEC-2024", "MXN"); - - lh.addStaticHoliday ("25-DEC-2024", "MXN"); - - lh.addStaticHoliday ("01-JAN-2025", "MXN"); - - lh.addStaticHoliday ("03-FEB-2025", "MXN"); - - lh.addStaticHoliday ("17-MAR-2025", "MXN"); - - lh.addStaticHoliday ("17-APR-2025", "MXN"); - - lh.addStaticHoliday ("18-APR-2025", "MXN"); - - lh.addStaticHoliday ("01-MAY-2025", "MXN"); - - lh.addStaticHoliday ("16-SEP-2025", "MXN"); - - lh.addStaticHoliday ("17-NOV-2025", "MXN"); - - lh.addStaticHoliday ("12-DEC-2025", "MXN"); - - lh.addStaticHoliday ("25-DEC-2025", "MXN"); - - lh.addStaticHoliday ("01-JAN-2026", "MXN"); - - lh.addStaticHoliday ("02-FEB-2026", "MXN"); - - lh.addStaticHoliday ("16-MAR-2026", "MXN"); - - lh.addStaticHoliday ("02-APR-2026", "MXN"); - - lh.addStaticHoliday ("03-APR-2026", "MXN"); - - lh.addStaticHoliday ("01-MAY-2026", "MXN"); - - lh.addStaticHoliday ("16-SEP-2026", "MXN"); - - lh.addStaticHoliday ("02-NOV-2026", "MXN"); - - lh.addStaticHoliday ("16-NOV-2026", "MXN"); - - lh.addStaticHoliday ("25-DEC-2026", "MXN"); - - lh.addStaticHoliday ("01-JAN-2027", "MXN"); - - lh.addStaticHoliday ("01-FEB-2027", "MXN"); - - lh.addStaticHoliday ("15-MAR-2027", "MXN"); - - lh.addStaticHoliday ("25-MAR-2027", "MXN"); - - lh.addStaticHoliday ("26-MAR-2027", "MXN"); - - lh.addStaticHoliday ("16-SEP-2027", "MXN"); - - lh.addStaticHoliday ("02-NOV-2027", "MXN"); - - lh.addStaticHoliday ("15-NOV-2027", "MXN"); - - lh.addStaticHoliday ("07-FEB-2028", "MXN"); - - lh.addStaticHoliday ("20-MAR-2028", "MXN"); - - lh.addStaticHoliday ("13-APR-2028", "MXN"); - - lh.addStaticHoliday ("14-APR-2028", "MXN"); - - lh.addStaticHoliday ("01-MAY-2028", "MXN"); - - lh.addStaticHoliday ("02-NOV-2028", "MXN"); - - lh.addStaticHoliday ("20-NOV-2028", "MXN"); - - lh.addStaticHoliday ("12-DEC-2028", "MXN"); - - lh.addStaticHoliday ("25-DEC-2028", "MXN"); - - lh.addStaticHoliday ("01-JAN-2029", "MXN"); - - lh.addStaticHoliday ("05-FEB-2029", "MXN"); - - lh.addStaticHoliday ("19-MAR-2029", "MXN"); - - lh.addStaticHoliday ("29-MAR-2029", "MXN"); - - lh.addStaticHoliday ("30-MAR-2029", "MXN"); - - lh.addStaticHoliday ("01-MAY-2029", "MXN"); - - lh.addStaticHoliday ("02-NOV-2029", "MXN"); - - lh.addStaticHoliday ("19-NOV-2029", "MXN"); - - lh.addStaticHoliday ("12-DEC-2029", "MXN"); - - lh.addStaticHoliday ("25-DEC-2029", "MXN"); - - lh.addStaticHoliday ("01-JAN-2030", "MXN"); - - lh.addStaticHoliday ("04-FEB-2030", "MXN"); - - lh.addStaticHoliday ("18-MAR-2030", "MXN"); - - lh.addStaticHoliday ("18-APR-2030", "MXN"); - - lh.addStaticHoliday ("19-APR-2030", "MXN"); - - lh.addStaticHoliday ("01-MAY-2030", "MXN"); - - lh.addStaticHoliday ("16-SEP-2030", "MXN"); - - lh.addStaticHoliday ("18-NOV-2030", "MXN"); - - lh.addStaticHoliday ("12-DEC-2030", "MXN"); - - lh.addStaticHoliday ("25-DEC-2030", "MXN"); - - lh.addStaticHoliday ("01-JAN-2031", "MXN"); - - lh.addStaticHoliday ("03-FEB-2031", "MXN"); - - lh.addStaticHoliday ("17-MAR-2031", "MXN"); - - lh.addStaticHoliday ("10-APR-2031", "MXN"); - - lh.addStaticHoliday ("11-APR-2031", "MXN"); - - lh.addStaticHoliday ("01-MAY-2031", "MXN"); - - lh.addStaticHoliday ("16-SEP-2031", "MXN"); - - lh.addStaticHoliday ("17-NOV-2031", "MXN"); - - lh.addStaticHoliday ("12-DEC-2031", "MXN"); - - lh.addStaticHoliday ("25-DEC-2031", "MXN"); - - lh.addStaticHoliday ("01-JAN-2032", "MXN"); - - lh.addStaticHoliday ("02-FEB-2032", "MXN"); - - lh.addStaticHoliday ("15-MAR-2032", "MXN"); - - lh.addStaticHoliday ("25-MAR-2032", "MXN"); - - lh.addStaticHoliday ("26-MAR-2032", "MXN"); - - lh.addStaticHoliday ("16-SEP-2032", "MXN"); - - lh.addStaticHoliday ("02-NOV-2032", "MXN"); - - lh.addStaticHoliday ("15-NOV-2032", "MXN"); - - lh.addStaticHoliday ("07-FEB-2033", "MXN"); - - lh.addStaticHoliday ("21-MAR-2033", "MXN"); - - lh.addStaticHoliday ("14-APR-2033", "MXN"); - - lh.addStaticHoliday ("15-APR-2033", "MXN"); - - lh.addStaticHoliday ("16-SEP-2033", "MXN"); - - lh.addStaticHoliday ("02-NOV-2033", "MXN"); - - lh.addStaticHoliday ("21-NOV-2033", "MXN"); - - lh.addStaticHoliday ("12-DEC-2033", "MXN"); - - lh.addStaticHoliday ("06-FEB-2034", "MXN"); - - lh.addStaticHoliday ("20-MAR-2034", "MXN"); - - lh.addStaticHoliday ("06-APR-2034", "MXN"); - - lh.addStaticHoliday ("07-APR-2034", "MXN"); - - lh.addStaticHoliday ("01-MAY-2034", "MXN"); - - lh.addStaticHoliday ("02-NOV-2034", "MXN"); - - lh.addStaticHoliday ("20-NOV-2034", "MXN"); - - lh.addStaticHoliday ("12-DEC-2034", "MXN"); - - lh.addStaticHoliday ("25-DEC-2034", "MXN"); - - lh.addStaticHoliday ("01-JAN-2035", "MXN"); - - lh.addStaticHoliday ("05-FEB-2035", "MXN"); - - lh.addStaticHoliday ("19-MAR-2035", "MXN"); - - lh.addStaticHoliday ("22-MAR-2035", "MXN"); - - lh.addStaticHoliday ("23-MAR-2035", "MXN"); - - lh.addStaticHoliday ("01-MAY-2035", "MXN"); - - lh.addStaticHoliday ("02-NOV-2035", "MXN"); - - lh.addStaticHoliday ("19-NOV-2035", "MXN"); - - lh.addStaticHoliday ("12-DEC-2035", "MXN"); - - lh.addStaticHoliday ("25-DEC-2035", "MXN"); - - lh.addStaticHoliday ("01-JAN-2036", "MXN"); - - lh.addStaticHoliday ("04-FEB-2036", "MXN"); - - lh.addStaticHoliday ("17-MAR-2036", "MXN"); - - lh.addStaticHoliday ("10-APR-2036", "MXN"); - - lh.addStaticHoliday ("11-APR-2036", "MXN"); - - lh.addStaticHoliday ("01-MAY-2036", "MXN"); - - lh.addStaticHoliday ("16-SEP-2036", "MXN"); - - lh.addStaticHoliday ("17-NOV-2036", "MXN"); - - lh.addStaticHoliday ("01-DEC-2036", "MXN"); - - lh.addStaticHoliday ("12-DEC-2036", "MXN"); - - lh.addStaticHoliday ("25-DEC-2036", "MXN"); - - lh.addStaticHoliday ("01-JAN-2037", "MXN"); - - lh.addStaticHoliday ("02-FEB-2037", "MXN"); - - lh.addStaticHoliday ("16-MAR-2037", "MXN"); - - lh.addStaticHoliday ("02-APR-2037", "MXN"); - - lh.addStaticHoliday ("03-APR-2037", "MXN"); - - lh.addStaticHoliday ("01-MAY-2037", "MXN"); - - lh.addStaticHoliday ("16-SEP-2037", "MXN"); - - lh.addStaticHoliday ("02-NOV-2037", "MXN"); - - lh.addStaticHoliday ("16-NOV-2037", "MXN"); - - lh.addStaticHoliday ("25-DEC-2037", "MXN"); - - lh.addStaticHoliday ("01-JAN-2038", "MXN"); - - lh.addStaticHoliday ("01-FEB-2038", "MXN"); - - lh.addStaticHoliday ("15-MAR-2038", "MXN"); - - lh.addStaticHoliday ("22-APR-2038", "MXN"); - - lh.addStaticHoliday ("23-APR-2038", "MXN"); - - lh.addStaticHoliday ("16-SEP-2038", "MXN"); - - lh.addStaticHoliday ("02-NOV-2038", "MXN"); - - lh.addStaticHoliday ("15-NOV-2038", "MXN"); - - lh.addStaticHoliday ("07-FEB-2039", "MXN"); - - lh.addStaticHoliday ("21-MAR-2039", "MXN"); - - lh.addStaticHoliday ("07-APR-2039", "MXN"); - - lh.addStaticHoliday ("08-APR-2039", "MXN"); - - lh.addStaticHoliday ("16-SEP-2039", "MXN"); - - lh.addStaticHoliday ("02-NOV-2039", "MXN"); - - lh.addStaticHoliday ("21-NOV-2039", "MXN"); - - lh.addStaticHoliday ("12-DEC-2039", "MXN"); - - lh.addStaticHoliday ("06-FEB-2040", "MXN"); - - lh.addStaticHoliday ("19-MAR-2040", "MXN"); - - lh.addStaticHoliday ("29-MAR-2040", "MXN"); - - lh.addStaticHoliday ("30-MAR-2040", "MXN"); - - lh.addStaticHoliday ("01-MAY-2040", "MXN"); - - lh.addStaticHoliday ("02-NOV-2040", "MXN"); - - lh.addStaticHoliday ("19-NOV-2040", "MXN"); - - lh.addStaticHoliday ("12-DEC-2040", "MXN"); - - lh.addStaticHoliday ("25-DEC-2040", "MXN"); - - lh.addStaticHoliday ("01-JAN-2041", "MXN"); - - lh.addStaticHoliday ("04-FEB-2041", "MXN"); - - lh.addStaticHoliday ("18-MAR-2041", "MXN"); - - lh.addStaticHoliday ("18-APR-2041", "MXN"); - - lh.addStaticHoliday ("19-APR-2041", "MXN"); - - lh.addStaticHoliday ("01-MAY-2041", "MXN"); - - lh.addStaticHoliday ("16-SEP-2041", "MXN"); - - lh.addStaticHoliday ("18-NOV-2041", "MXN"); - - lh.addStaticHoliday ("12-DEC-2041", "MXN"); - - lh.addStaticHoliday ("25-DEC-2041", "MXN"); - - lh.addStaticHoliday ("01-JAN-2042", "MXN"); - - lh.addStaticHoliday ("03-FEB-2042", "MXN"); - - lh.addStaticHoliday ("17-MAR-2042", "MXN"); - - lh.addStaticHoliday ("03-APR-2042", "MXN"); - - lh.addStaticHoliday ("04-APR-2042", "MXN"); - - lh.addStaticHoliday ("01-MAY-2042", "MXN"); - - lh.addStaticHoliday ("16-SEP-2042", "MXN"); - - lh.addStaticHoliday ("17-NOV-2042", "MXN"); - - lh.addStaticHoliday ("01-DEC-2042", "MXN"); - - lh.addStaticHoliday ("12-DEC-2042", "MXN"); - - lh.addStaticHoliday ("25-DEC-2042", "MXN"); - - lh.addStaticHoliday ("01-JAN-2043", "MXN"); - - lh.addStaticHoliday ("02-FEB-2043", "MXN"); - - lh.addStaticHoliday ("16-MAR-2043", "MXN"); - - lh.addStaticHoliday ("26-MAR-2043", "MXN"); - - lh.addStaticHoliday ("27-MAR-2043", "MXN"); - - lh.addStaticHoliday ("01-MAY-2043", "MXN"); - - lh.addStaticHoliday ("16-SEP-2043", "MXN"); - - lh.addStaticHoliday ("02-NOV-2043", "MXN"); - - lh.addStaticHoliday ("16-NOV-2043", "MXN"); - - lh.addStaticHoliday ("25-DEC-2043", "MXN"); - - lh.addStaticHoliday ("01-JAN-2044", "MXN"); - - lh.addStaticHoliday ("01-FEB-2044", "MXN"); - - lh.addStaticHoliday ("21-MAR-2044", "MXN"); - - lh.addStaticHoliday ("14-APR-2044", "MXN"); - - lh.addStaticHoliday ("15-APR-2044", "MXN"); - - lh.addStaticHoliday ("16-SEP-2044", "MXN"); - - lh.addStaticHoliday ("02-NOV-2044", "MXN"); - - lh.addStaticHoliday ("21-NOV-2044", "MXN"); - - lh.addStaticHoliday ("12-DEC-2044", "MXN"); - - lh.addStaticHoliday ("06-FEB-2045", "MXN"); - - lh.addStaticHoliday ("20-MAR-2045", "MXN"); - - lh.addStaticHoliday ("06-APR-2045", "MXN"); - - lh.addStaticHoliday ("07-APR-2045", "MXN"); - - lh.addStaticHoliday ("01-MAY-2045", "MXN"); - - lh.addStaticHoliday ("02-NOV-2045", "MXN"); - - lh.addStaticHoliday ("20-NOV-2045", "MXN"); - - lh.addStaticHoliday ("12-DEC-2045", "MXN"); - - lh.addStaticHoliday ("25-DEC-2045", "MXN"); - - lh.addStaticHoliday ("01-JAN-2046", "MXN"); - - lh.addStaticHoliday ("05-FEB-2046", "MXN"); - - lh.addStaticHoliday ("19-MAR-2046", "MXN"); - - lh.addStaticHoliday ("22-MAR-2046", "MXN"); - - lh.addStaticHoliday ("23-MAR-2046", "MXN"); - - lh.addStaticHoliday ("01-MAY-2046", "MXN"); - - lh.addStaticHoliday ("02-NOV-2046", "MXN"); - - lh.addStaticHoliday ("19-NOV-2046", "MXN"); - - lh.addStaticHoliday ("12-DEC-2046", "MXN"); - - lh.addStaticHoliday ("25-DEC-2046", "MXN"); - - lh.addStaticHoliday ("01-JAN-2047", "MXN"); - - lh.addStaticHoliday ("04-FEB-2047", "MXN"); - - lh.addStaticHoliday ("18-MAR-2047", "MXN"); - - lh.addStaticHoliday ("11-APR-2047", "MXN"); - - lh.addStaticHoliday ("12-APR-2047", "MXN"); - - lh.addStaticHoliday ("01-MAY-2047", "MXN"); - - lh.addStaticHoliday ("16-SEP-2047", "MXN"); - - lh.addStaticHoliday ("18-NOV-2047", "MXN"); - - lh.addStaticHoliday ("12-DEC-2047", "MXN"); - - lh.addStaticHoliday ("25-DEC-2047", "MXN"); - - lh.addStaticHoliday ("01-JAN-2048", "MXN"); - - lh.addStaticHoliday ("03-FEB-2048", "MXN"); - - lh.addStaticHoliday ("16-MAR-2048", "MXN"); - - lh.addStaticHoliday ("02-APR-2048", "MXN"); - - lh.addStaticHoliday ("03-APR-2048", "MXN"); - - lh.addStaticHoliday ("01-MAY-2048", "MXN"); - - lh.addStaticHoliday ("16-SEP-2048", "MXN"); - - lh.addStaticHoliday ("02-NOV-2048", "MXN"); - - lh.addStaticHoliday ("16-NOV-2048", "MXN"); - - lh.addStaticHoliday ("01-DEC-2048", "MXN"); - - lh.addStaticHoliday ("25-DEC-2048", "MXN"); - - lh.addStaticHoliday ("01-JAN-2049", "MXN"); - - lh.addStaticHoliday ("01-FEB-2049", "MXN"); - - lh.addStaticHoliday ("15-MAR-2049", "MXN"); - - lh.addStaticHoliday ("15-APR-2049", "MXN"); - - lh.addStaticHoliday ("16-APR-2049", "MXN"); - - lh.addStaticHoliday ("16-SEP-2049", "MXN"); - - lh.addStaticHoliday ("02-NOV-2049", "MXN"); - - lh.addStaticHoliday ("15-NOV-2049", "MXN"); - - lh.addStaticHoliday ("07-FEB-2050", "MXN"); - - lh.addStaticHoliday ("21-MAR-2050", "MXN"); - - lh.addStaticHoliday ("07-APR-2050", "MXN"); - - lh.addStaticHoliday ("08-APR-2050", "MXN"); - - lh.addStaticHoliday ("16-SEP-2050", "MXN"); - - lh.addStaticHoliday ("02-NOV-2050", "MXN"); - - lh.addStaticHoliday ("21-NOV-2050", "MXN"); - - lh.addStaticHoliday ("12-DEC-2050", "MXN"); - - lh.addStaticHoliday ("06-FEB-2051", "MXN"); - - lh.addStaticHoliday ("20-MAR-2051", "MXN"); - - lh.addStaticHoliday ("30-MAR-2051", "MXN"); - - lh.addStaticHoliday ("31-MAR-2051", "MXN"); - - lh.addStaticHoliday ("01-MAY-2051", "MXN"); - - lh.addStaticHoliday ("02-NOV-2051", "MXN"); - - lh.addStaticHoliday ("20-NOV-2051", "MXN"); - - lh.addStaticHoliday ("12-DEC-2051", "MXN"); - - lh.addStaticHoliday ("25-DEC-2051", "MXN"); - - lh.addStaticHoliday ("01-JAN-2052", "MXN"); - - lh.addStaticHoliday ("05-FEB-2052", "MXN"); - - lh.addStaticHoliday ("18-MAR-2052", "MXN"); - - lh.addStaticHoliday ("18-APR-2052", "MXN"); - - lh.addStaticHoliday ("19-APR-2052", "MXN"); - - lh.addStaticHoliday ("01-MAY-2052", "MXN"); - - lh.addStaticHoliday ("16-SEP-2052", "MXN"); - - lh.addStaticHoliday ("18-NOV-2052", "MXN"); - - lh.addStaticHoliday ("12-DEC-2052", "MXN"); - - lh.addStaticHoliday ("25-DEC-2052", "MXN"); - - lh.addStaticHoliday ("01-JAN-2053", "MXN"); - - lh.addStaticHoliday ("03-FEB-2053", "MXN"); - - lh.addStaticHoliday ("17-MAR-2053", "MXN"); - - lh.addStaticHoliday ("03-APR-2053", "MXN"); - - lh.addStaticHoliday ("04-APR-2053", "MXN"); - - lh.addStaticHoliday ("01-MAY-2053", "MXN"); - - lh.addStaticHoliday ("16-SEP-2053", "MXN"); - - lh.addStaticHoliday ("17-NOV-2053", "MXN"); - - lh.addStaticHoliday ("12-DEC-2053", "MXN"); - - lh.addStaticHoliday ("25-DEC-2053", "MXN"); - - lh.addStaticHoliday ("01-JAN-2054", "MXN"); - - lh.addStaticHoliday ("02-FEB-2054", "MXN"); - - lh.addStaticHoliday ("16-MAR-2054", "MXN"); - - lh.addStaticHoliday ("26-MAR-2054", "MXN"); - - lh.addStaticHoliday ("27-MAR-2054", "MXN"); - - lh.addStaticHoliday ("01-MAY-2054", "MXN"); - - lh.addStaticHoliday ("16-SEP-2054", "MXN"); - - lh.addStaticHoliday ("02-NOV-2054", "MXN"); - - lh.addStaticHoliday ("16-NOV-2054", "MXN"); - - lh.addStaticHoliday ("01-DEC-2054", "MXN"); - - lh.addStaticHoliday ("25-DEC-2054", "MXN"); - - lh.addStaticHoliday ("01-JAN-2055", "MXN"); - - lh.addStaticHoliday ("01-FEB-2055", "MXN"); - - lh.addStaticHoliday ("15-MAR-2055", "MXN"); - - lh.addStaticHoliday ("15-APR-2055", "MXN"); - - lh.addStaticHoliday ("16-APR-2055", "MXN"); - - lh.addStaticHoliday ("16-SEP-2055", "MXN"); - - lh.addStaticHoliday ("02-NOV-2055", "MXN"); - - lh.addStaticHoliday ("15-NOV-2055", "MXN"); - - lh.addStaticHoliday ("07-FEB-2056", "MXN"); - - lh.addStaticHoliday ("20-MAR-2056", "MXN"); - - lh.addStaticHoliday ("30-MAR-2056", "MXN"); - - lh.addStaticHoliday ("31-MAR-2056", "MXN"); - - lh.addStaticHoliday ("01-MAY-2056", "MXN"); - - lh.addStaticHoliday ("02-NOV-2056", "MXN"); - - lh.addStaticHoliday ("20-NOV-2056", "MXN"); - - lh.addStaticHoliday ("12-DEC-2056", "MXN"); - - lh.addStaticHoliday ("25-DEC-2056", "MXN"); - - lh.addStaticHoliday ("01-JAN-2057", "MXN"); - - lh.addStaticHoliday ("05-FEB-2057", "MXN"); - - lh.addStaticHoliday ("19-MAR-2057", "MXN"); - - lh.addStaticHoliday ("19-APR-2057", "MXN"); - - lh.addStaticHoliday ("20-APR-2057", "MXN"); - - lh.addStaticHoliday ("01-MAY-2057", "MXN"); - - lh.addStaticHoliday ("02-NOV-2057", "MXN"); - - lh.addStaticHoliday ("19-NOV-2057", "MXN"); - - lh.addStaticHoliday ("12-DEC-2057", "MXN"); - - lh.addStaticHoliday ("25-DEC-2057", "MXN"); - - lh.addStaticHoliday ("01-JAN-2058", "MXN"); - - lh.addStaticHoliday ("04-FEB-2058", "MXN"); - - lh.addStaticHoliday ("18-MAR-2058", "MXN"); - - lh.addStaticHoliday ("11-APR-2058", "MXN"); - - lh.addStaticHoliday ("12-APR-2058", "MXN"); - - lh.addStaticHoliday ("01-MAY-2058", "MXN"); - - lh.addStaticHoliday ("16-SEP-2058", "MXN"); - - lh.addStaticHoliday ("18-NOV-2058", "MXN"); - - lh.addStaticHoliday ("12-DEC-2058", "MXN"); - - lh.addStaticHoliday ("25-DEC-2058", "MXN"); - - lh.addStaticHoliday ("01-JAN-2059", "MXN"); - - lh.addStaticHoliday ("03-FEB-2059", "MXN"); - - lh.addStaticHoliday ("17-MAR-2059", "MXN"); - - lh.addStaticHoliday ("27-MAR-2059", "MXN"); - - lh.addStaticHoliday ("28-MAR-2059", "MXN"); - - lh.addStaticHoliday ("01-MAY-2059", "MXN"); - - lh.addStaticHoliday ("16-SEP-2059", "MXN"); - - lh.addStaticHoliday ("17-NOV-2059", "MXN"); - - lh.addStaticHoliday ("12-DEC-2059", "MXN"); - - lh.addStaticHoliday ("25-DEC-2059", "MXN"); - - lh.addStaticHoliday ("01-JAN-2060", "MXN"); - - lh.addStaticHoliday ("02-FEB-2060", "MXN"); - - lh.addStaticHoliday ("15-MAR-2060", "MXN"); - - lh.addStaticHoliday ("15-APR-2060", "MXN"); - - lh.addStaticHoliday ("16-APR-2060", "MXN"); - - lh.addStaticHoliday ("16-SEP-2060", "MXN"); - - lh.addStaticHoliday ("02-NOV-2060", "MXN"); - - lh.addStaticHoliday ("15-NOV-2060", "MXN"); - - lh.addStaticHoliday ("01-DEC-2060", "MXN"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/MXNHoliday.java b/org/drip/analytics/holset/MXNHoliday.java deleted file mode 100644 index f457bb5..0000000 --- a/org/drip/analytics/holset/MXNHoliday.java +++ /dev/null @@ -1,1251 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class MXNHoliday implements org.drip.analytics.holset.LocationHoliday { - public MXNHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "MXN"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-1998", "Constitution Day"); - - lh.addStaticHoliday ("09-APR-1998", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-1998", "Puebla Battle Day"); - - lh.addStaticHoliday ("01-SEP-1998", "Presidential Report"); - - lh.addStaticHoliday ("16-SEP-1998", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-1998", "All Souls Day"); - - lh.addStaticHoliday ("20-NOV-1998", "Revolution Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-1999", "Constitution Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-MAY-1999", "Puebla Battle Day"); - - lh.addStaticHoliday ("01-SEP-1999", "Presidential Report"); - - lh.addStaticHoliday ("16-SEP-1999", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-1999", "All Souls Day"); - - lh.addStaticHoliday ("21-MAR-2000", "Juarezs Birthday"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2000", "Puebla Battle Day"); - - lh.addStaticHoliday ("01-SEP-2000", "Presidential Report"); - - lh.addStaticHoliday ("02-NOV-2000", "All Souls Day"); - - lh.addStaticHoliday ("20-NOV-2000", "Revolution Day"); - - lh.addStaticHoliday ("01-DEC-2000", "Presidential Succession Day"); - - lh.addStaticHoliday ("12-DEC-2000", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2001", "Constitution Day"); - - lh.addStaticHoliday ("21-MAR-2001", "Juarezs Birthday"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("02-NOV-2001", "All Souls Day"); - - lh.addStaticHoliday ("20-NOV-2001", "Revolution Day"); - - lh.addStaticHoliday ("12-DEC-2001", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2002", "Constitution Day"); - - lh.addStaticHoliday ("21-MAR-2002", "Juarezs Birthday"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("16-SEP-2002", "Independence Day"); - - lh.addStaticHoliday ("20-NOV-2002", "Revolution Day"); - - lh.addStaticHoliday ("12-DEC-2002", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2003", "Constitution Day"); - - lh.addStaticHoliday ("21-MAR-2003", "Juarezs Birthday"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2003", "Puebla Battle Day"); - - lh.addStaticHoliday ("16-SEP-2003", "Independence Day"); - - lh.addStaticHoliday ("20-NOV-2003", "Revolution Day"); - - lh.addStaticHoliday ("12-DEC-2003", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2004", "Constitution Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("05-MAY-2004", "Puebla Battle Day"); - - lh.addStaticHoliday ("16-SEP-2004", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2004", "All Souls Day"); - - lh.addStaticHoliday ("21-MAR-2005", "Juarezs Birthday"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("16-SEP-2005", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2005", "All Souls Day"); - - lh.addStaticHoliday ("12-DEC-2005", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("01-JAN-2006", "New Years Day"); - - lh.addStaticHoliday ("06-FEB-2006", "Dia de la Constitucion"); - - lh.addStaticHoliday ("21-MAR-2006", "Juarezs Birthday"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("16-SEP-2006", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2006", "All Souls Day"); - - lh.addStaticHoliday ("20-NOV-2006", "Revolution Day"); - - lh.addStaticHoliday ("01-DEC-2006", "Presidential Succession Day"); - - lh.addStaticHoliday ("12-DEC-2006", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2007", "Constitution Day"); - - lh.addStaticHoliday ("19-MAR-2007", "Juarezs Birthday"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("02-NOV-2007", "All Souls Day"); - - lh.addStaticHoliday ("19-NOV-2007", "Revolution Day"); - - lh.addStaticHoliday ("12-DEC-2007", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("04-FEB-2008", "Constitution Day"); - - lh.addStaticHoliday ("17-MAR-2008", "Juarezs Birthday"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("16-SEP-2008", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2008", "All Souls Day"); - - lh.addStaticHoliday ("17-NOV-2008", "Revolution Day"); - - lh.addStaticHoliday ("12-DEC-2008", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("02-FEB-2009", "Constitution Day"); - - lh.addStaticHoliday ("16-MAR-2009", "Juarezs Birthday"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("16-SEP-2009", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2009", "All Souls Day"); - - lh.addStaticHoliday ("16-NOV-2009", "Revolution Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "MXN"); - - lh.addStaticHoliday ("01-FEB-2010", "MXN"); - - lh.addStaticHoliday ("15-MAR-2010", "MXN"); - - lh.addStaticHoliday ("01-APR-2010", "MXN"); - - lh.addStaticHoliday ("02-APR-2010", "MXN"); - - lh.addStaticHoliday ("16-SEP-2010", "MXN"); - - lh.addStaticHoliday ("17-SEP-2010", "MXN"); - - lh.addStaticHoliday ("02-NOV-2010", "MXN"); - - lh.addStaticHoliday ("15-NOV-2010", "MXN"); - - lh.addStaticHoliday ("07-FEB-2011", "MXN"); - - lh.addStaticHoliday ("21-MAR-2011", "MXN"); - - lh.addStaticHoliday ("21-APR-2011", "MXN"); - - lh.addStaticHoliday ("22-APR-2011", "MXN"); - - lh.addStaticHoliday ("16-SEP-2011", "MXN"); - - lh.addStaticHoliday ("02-NOV-2011", "MXN"); - - lh.addStaticHoliday ("21-NOV-2011", "MXN"); - - lh.addStaticHoliday ("12-DEC-2011", "MXN"); - - lh.addStaticHoliday ("06-FEB-2012", "MXN"); - - lh.addStaticHoliday ("19-MAR-2012", "MXN"); - - lh.addStaticHoliday ("05-APR-2012", "MXN"); - - lh.addStaticHoliday ("06-APR-2012", "MXN"); - - lh.addStaticHoliday ("01-MAY-2012", "MXN"); - - lh.addStaticHoliday ("02-NOV-2012", "MXN"); - - lh.addStaticHoliday ("19-NOV-2012", "MXN"); - - lh.addStaticHoliday ("12-DEC-2012", "MXN"); - - lh.addStaticHoliday ("25-DEC-2012", "MXN"); - - lh.addStaticHoliday ("01-JAN-2013", "MXN"); - - lh.addStaticHoliday ("04-FEB-2013", "MXN"); - - lh.addStaticHoliday ("18-MAR-2013", "MXN"); - - lh.addStaticHoliday ("28-MAR-2013", "MXN"); - - lh.addStaticHoliday ("29-MAR-2013", "MXN"); - - lh.addStaticHoliday ("01-MAY-2013", "MXN"); - - lh.addStaticHoliday ("16-SEP-2013", "MXN"); - - lh.addStaticHoliday ("18-NOV-2013", "MXN"); - - lh.addStaticHoliday ("12-DEC-2013", "MXN"); - - lh.addStaticHoliday ("25-DEC-2013", "MXN"); - - lh.addStaticHoliday ("01-JAN-2014", "MXN"); - - lh.addStaticHoliday ("03-FEB-2014", "MXN"); - - lh.addStaticHoliday ("17-MAR-2014", "MXN"); - - lh.addStaticHoliday ("17-APR-2014", "MXN"); - - lh.addStaticHoliday ("18-APR-2014", "MXN"); - - lh.addStaticHoliday ("01-MAY-2014", "MXN"); - - lh.addStaticHoliday ("16-SEP-2014", "MXN"); - - lh.addStaticHoliday ("17-NOV-2014", "MXN"); - - lh.addStaticHoliday ("12-DEC-2014", "MXN"); - - lh.addStaticHoliday ("25-DEC-2014", "MXN"); - - lh.addStaticHoliday ("01-JAN-2015", "MXN"); - - lh.addStaticHoliday ("02-FEB-2015", "MXN"); - - lh.addStaticHoliday ("16-MAR-2015", "MXN"); - - lh.addStaticHoliday ("02-APR-2015", "MXN"); - - lh.addStaticHoliday ("03-APR-2015", "MXN"); - - lh.addStaticHoliday ("01-MAY-2015", "MXN"); - - lh.addStaticHoliday ("16-SEP-2015", "MXN"); - - lh.addStaticHoliday ("02-NOV-2015", "MXN"); - - lh.addStaticHoliday ("16-NOV-2015", "MXN"); - - lh.addStaticHoliday ("25-DEC-2015", "MXN"); - - lh.addStaticHoliday ("01-JAN-2016", "MXN"); - - lh.addStaticHoliday ("01-FEB-2016", "MXN"); - - lh.addStaticHoliday ("21-MAR-2016", "MXN"); - - lh.addStaticHoliday ("24-MAR-2016", "MXN"); - - lh.addStaticHoliday ("25-MAR-2016", "MXN"); - - lh.addStaticHoliday ("16-SEP-2016", "MXN"); - - lh.addStaticHoliday ("02-NOV-2016", "MXN"); - - lh.addStaticHoliday ("21-NOV-2016", "MXN"); - - lh.addStaticHoliday ("12-DEC-2016", "MXN"); - - lh.addStaticHoliday ("06-FEB-2017", "MXN"); - - lh.addStaticHoliday ("20-MAR-2017", "MXN"); - - lh.addStaticHoliday ("13-APR-2017", "MXN"); - - lh.addStaticHoliday ("14-APR-2017", "MXN"); - - lh.addStaticHoliday ("01-MAY-2017", "MXN"); - - lh.addStaticHoliday ("02-NOV-2017", "MXN"); - - lh.addStaticHoliday ("20-NOV-2017", "MXN"); - - lh.addStaticHoliday ("12-DEC-2017", "MXN"); - - lh.addStaticHoliday ("25-DEC-2017", "MXN"); - - lh.addStaticHoliday ("01-JAN-2018", "MXN"); - - lh.addStaticHoliday ("05-FEB-2018", "MXN"); - - lh.addStaticHoliday ("19-MAR-2018", "MXN"); - - lh.addStaticHoliday ("29-MAR-2018", "MXN"); - - lh.addStaticHoliday ("30-MAR-2018", "MXN"); - - lh.addStaticHoliday ("01-MAY-2018", "MXN"); - - lh.addStaticHoliday ("02-NOV-2018", "MXN"); - - lh.addStaticHoliday ("19-NOV-2018", "MXN"); - - lh.addStaticHoliday ("12-DEC-2018", "MXN"); - - lh.addStaticHoliday ("25-DEC-2018", "MXN"); - - lh.addStaticHoliday ("01-JAN-2019", "MXN"); - - lh.addStaticHoliday ("04-FEB-2019", "MXN"); - - lh.addStaticHoliday ("18-MAR-2019", "MXN"); - - lh.addStaticHoliday ("18-APR-2019", "MXN"); - - lh.addStaticHoliday ("19-APR-2019", "MXN"); - - lh.addStaticHoliday ("01-MAY-2019", "MXN"); - - lh.addStaticHoliday ("16-SEP-2019", "MXN"); - - lh.addStaticHoliday ("18-NOV-2019", "MXN"); - - lh.addStaticHoliday ("12-DEC-2019", "MXN"); - - lh.addStaticHoliday ("25-DEC-2019", "MXN"); - - lh.addStaticHoliday ("01-JAN-2020", "MXN"); - - lh.addStaticHoliday ("03-FEB-2020", "MXN"); - - lh.addStaticHoliday ("16-MAR-2020", "MXN"); - - lh.addStaticHoliday ("09-APR-2020", "MXN"); - - lh.addStaticHoliday ("10-APR-2020", "MXN"); - - lh.addStaticHoliday ("01-MAY-2020", "MXN"); - - lh.addStaticHoliday ("16-SEP-2020", "MXN"); - - lh.addStaticHoliday ("02-NOV-2020", "MXN"); - - lh.addStaticHoliday ("16-NOV-2020", "MXN"); - - lh.addStaticHoliday ("25-DEC-2020", "MXN"); - - lh.addStaticHoliday ("01-JAN-2021", "MXN"); - - lh.addStaticHoliday ("01-FEB-2021", "MXN"); - - lh.addStaticHoliday ("15-MAR-2021", "MXN"); - - lh.addStaticHoliday ("01-APR-2021", "MXN"); - - lh.addStaticHoliday ("02-APR-2021", "MXN"); - - lh.addStaticHoliday ("16-SEP-2021", "MXN"); - - lh.addStaticHoliday ("02-NOV-2021", "MXN"); - - lh.addStaticHoliday ("15-NOV-2021", "MXN"); - - lh.addStaticHoliday ("07-FEB-2022", "MXN"); - - lh.addStaticHoliday ("21-MAR-2022", "MXN"); - - lh.addStaticHoliday ("14-APR-2022", "MXN"); - - lh.addStaticHoliday ("15-APR-2022", "MXN"); - - lh.addStaticHoliday ("16-SEP-2022", "MXN"); - - lh.addStaticHoliday ("02-NOV-2022", "MXN"); - - lh.addStaticHoliday ("21-NOV-2022", "MXN"); - - lh.addStaticHoliday ("12-DEC-2022", "MXN"); - - lh.addStaticHoliday ("06-FEB-2023", "MXN"); - - lh.addStaticHoliday ("20-MAR-2023", "MXN"); - - lh.addStaticHoliday ("06-APR-2023", "MXN"); - - lh.addStaticHoliday ("07-APR-2023", "MXN"); - - lh.addStaticHoliday ("01-MAY-2023", "MXN"); - - lh.addStaticHoliday ("02-NOV-2023", "MXN"); - - lh.addStaticHoliday ("20-NOV-2023", "MXN"); - - lh.addStaticHoliday ("12-DEC-2023", "MXN"); - - lh.addStaticHoliday ("25-DEC-2023", "MXN"); - - lh.addStaticHoliday ("01-JAN-2024", "MXN"); - - lh.addStaticHoliday ("05-FEB-2024", "MXN"); - - lh.addStaticHoliday ("18-MAR-2024", "MXN"); - - lh.addStaticHoliday ("28-MAR-2024", "MXN"); - - lh.addStaticHoliday ("29-MAR-2024", "MXN"); - - lh.addStaticHoliday ("01-MAY-2024", "MXN"); - - lh.addStaticHoliday ("16-SEP-2024", "MXN"); - - lh.addStaticHoliday ("18-NOV-2024", "MXN"); - - lh.addStaticHoliday ("12-DEC-2024", "MXN"); - - lh.addStaticHoliday ("25-DEC-2024", "MXN"); - - lh.addStaticHoliday ("01-JAN-2025", "MXN"); - - lh.addStaticHoliday ("03-FEB-2025", "MXN"); - - lh.addStaticHoliday ("17-MAR-2025", "MXN"); - - lh.addStaticHoliday ("17-APR-2025", "MXN"); - - lh.addStaticHoliday ("18-APR-2025", "MXN"); - - lh.addStaticHoliday ("01-MAY-2025", "MXN"); - - lh.addStaticHoliday ("16-SEP-2025", "MXN"); - - lh.addStaticHoliday ("17-NOV-2025", "MXN"); - - lh.addStaticHoliday ("12-DEC-2025", "MXN"); - - lh.addStaticHoliday ("25-DEC-2025", "MXN"); - - lh.addStaticHoliday ("01-JAN-2026", "MXN"); - - lh.addStaticHoliday ("02-FEB-2026", "MXN"); - - lh.addStaticHoliday ("16-MAR-2026", "MXN"); - - lh.addStaticHoliday ("02-APR-2026", "MXN"); - - lh.addStaticHoliday ("03-APR-2026", "MXN"); - - lh.addStaticHoliday ("01-MAY-2026", "MXN"); - - lh.addStaticHoliday ("16-SEP-2026", "MXN"); - - lh.addStaticHoliday ("02-NOV-2026", "MXN"); - - lh.addStaticHoliday ("16-NOV-2026", "MXN"); - - lh.addStaticHoliday ("25-DEC-2026", "MXN"); - - lh.addStaticHoliday ("01-JAN-2027", "MXN"); - - lh.addStaticHoliday ("01-FEB-2027", "MXN"); - - lh.addStaticHoliday ("15-MAR-2027", "MXN"); - - lh.addStaticHoliday ("25-MAR-2027", "MXN"); - - lh.addStaticHoliday ("26-MAR-2027", "MXN"); - - lh.addStaticHoliday ("16-SEP-2027", "MXN"); - - lh.addStaticHoliday ("02-NOV-2027", "MXN"); - - lh.addStaticHoliday ("15-NOV-2027", "MXN"); - - lh.addStaticHoliday ("07-FEB-2028", "MXN"); - - lh.addStaticHoliday ("20-MAR-2028", "MXN"); - - lh.addStaticHoliday ("13-APR-2028", "MXN"); - - lh.addStaticHoliday ("14-APR-2028", "MXN"); - - lh.addStaticHoliday ("01-MAY-2028", "MXN"); - - lh.addStaticHoliday ("02-NOV-2028", "MXN"); - - lh.addStaticHoliday ("20-NOV-2028", "MXN"); - - lh.addStaticHoliday ("12-DEC-2028", "MXN"); - - lh.addStaticHoliday ("25-DEC-2028", "MXN"); - - lh.addStaticHoliday ("01-JAN-2029", "MXN"); - - lh.addStaticHoliday ("05-FEB-2029", "MXN"); - - lh.addStaticHoliday ("19-MAR-2029", "MXN"); - - lh.addStaticHoliday ("29-MAR-2029", "MXN"); - - lh.addStaticHoliday ("30-MAR-2029", "MXN"); - - lh.addStaticHoliday ("01-MAY-2029", "MXN"); - - lh.addStaticHoliday ("02-NOV-2029", "MXN"); - - lh.addStaticHoliday ("19-NOV-2029", "MXN"); - - lh.addStaticHoliday ("12-DEC-2029", "MXN"); - - lh.addStaticHoliday ("25-DEC-2029", "MXN"); - - lh.addStaticHoliday ("01-JAN-2030", "MXN"); - - lh.addStaticHoliday ("04-FEB-2030", "MXN"); - - lh.addStaticHoliday ("18-MAR-2030", "MXN"); - - lh.addStaticHoliday ("18-APR-2030", "MXN"); - - lh.addStaticHoliday ("19-APR-2030", "MXN"); - - lh.addStaticHoliday ("01-MAY-2030", "MXN"); - - lh.addStaticHoliday ("16-SEP-2030", "MXN"); - - lh.addStaticHoliday ("18-NOV-2030", "MXN"); - - lh.addStaticHoliday ("12-DEC-2030", "MXN"); - - lh.addStaticHoliday ("25-DEC-2030", "MXN"); - - lh.addStaticHoliday ("01-JAN-2031", "MXN"); - - lh.addStaticHoliday ("03-FEB-2031", "MXN"); - - lh.addStaticHoliday ("17-MAR-2031", "MXN"); - - lh.addStaticHoliday ("10-APR-2031", "MXN"); - - lh.addStaticHoliday ("11-APR-2031", "MXN"); - - lh.addStaticHoliday ("01-MAY-2031", "MXN"); - - lh.addStaticHoliday ("16-SEP-2031", "MXN"); - - lh.addStaticHoliday ("17-NOV-2031", "MXN"); - - lh.addStaticHoliday ("12-DEC-2031", "MXN"); - - lh.addStaticHoliday ("25-DEC-2031", "MXN"); - - lh.addStaticHoliday ("01-JAN-2032", "MXN"); - - lh.addStaticHoliday ("02-FEB-2032", "MXN"); - - lh.addStaticHoliday ("15-MAR-2032", "MXN"); - - lh.addStaticHoliday ("25-MAR-2032", "MXN"); - - lh.addStaticHoliday ("26-MAR-2032", "MXN"); - - lh.addStaticHoliday ("16-SEP-2032", "MXN"); - - lh.addStaticHoliday ("02-NOV-2032", "MXN"); - - lh.addStaticHoliday ("15-NOV-2032", "MXN"); - - lh.addStaticHoliday ("07-FEB-2033", "MXN"); - - lh.addStaticHoliday ("21-MAR-2033", "MXN"); - - lh.addStaticHoliday ("14-APR-2033", "MXN"); - - lh.addStaticHoliday ("15-APR-2033", "MXN"); - - lh.addStaticHoliday ("16-SEP-2033", "MXN"); - - lh.addStaticHoliday ("02-NOV-2033", "MXN"); - - lh.addStaticHoliday ("21-NOV-2033", "MXN"); - - lh.addStaticHoliday ("12-DEC-2033", "MXN"); - - lh.addStaticHoliday ("06-FEB-2034", "MXN"); - - lh.addStaticHoliday ("20-MAR-2034", "MXN"); - - lh.addStaticHoliday ("06-APR-2034", "MXN"); - - lh.addStaticHoliday ("07-APR-2034", "MXN"); - - lh.addStaticHoliday ("01-MAY-2034", "MXN"); - - lh.addStaticHoliday ("02-NOV-2034", "MXN"); - - lh.addStaticHoliday ("20-NOV-2034", "MXN"); - - lh.addStaticHoliday ("12-DEC-2034", "MXN"); - - lh.addStaticHoliday ("25-DEC-2034", "MXN"); - - lh.addStaticHoliday ("01-JAN-2035", "MXN"); - - lh.addStaticHoliday ("05-FEB-2035", "MXN"); - - lh.addStaticHoliday ("19-MAR-2035", "MXN"); - - lh.addStaticHoliday ("22-MAR-2035", "MXN"); - - lh.addStaticHoliday ("23-MAR-2035", "MXN"); - - lh.addStaticHoliday ("01-MAY-2035", "MXN"); - - lh.addStaticHoliday ("02-NOV-2035", "MXN"); - - lh.addStaticHoliday ("19-NOV-2035", "MXN"); - - lh.addStaticHoliday ("12-DEC-2035", "MXN"); - - lh.addStaticHoliday ("25-DEC-2035", "MXN"); - - lh.addStaticHoliday ("01-JAN-2036", "MXN"); - - lh.addStaticHoliday ("04-FEB-2036", "MXN"); - - lh.addStaticHoliday ("17-MAR-2036", "MXN"); - - lh.addStaticHoliday ("10-APR-2036", "MXN"); - - lh.addStaticHoliday ("11-APR-2036", "MXN"); - - lh.addStaticHoliday ("01-MAY-2036", "MXN"); - - lh.addStaticHoliday ("16-SEP-2036", "MXN"); - - lh.addStaticHoliday ("17-NOV-2036", "MXN"); - - lh.addStaticHoliday ("01-DEC-2036", "MXN"); - - lh.addStaticHoliday ("12-DEC-2036", "MXN"); - - lh.addStaticHoliday ("25-DEC-2036", "MXN"); - - lh.addStaticHoliday ("01-JAN-2037", "MXN"); - - lh.addStaticHoliday ("02-FEB-2037", "MXN"); - - lh.addStaticHoliday ("16-MAR-2037", "MXN"); - - lh.addStaticHoliday ("02-APR-2037", "MXN"); - - lh.addStaticHoliday ("03-APR-2037", "MXN"); - - lh.addStaticHoliday ("01-MAY-2037", "MXN"); - - lh.addStaticHoliday ("16-SEP-2037", "MXN"); - - lh.addStaticHoliday ("02-NOV-2037", "MXN"); - - lh.addStaticHoliday ("16-NOV-2037", "MXN"); - - lh.addStaticHoliday ("25-DEC-2037", "MXN"); - - lh.addStaticHoliday ("01-JAN-2038", "MXN"); - - lh.addStaticHoliday ("01-FEB-2038", "MXN"); - - lh.addStaticHoliday ("15-MAR-2038", "MXN"); - - lh.addStaticHoliday ("22-APR-2038", "MXN"); - - lh.addStaticHoliday ("23-APR-2038", "MXN"); - - lh.addStaticHoliday ("16-SEP-2038", "MXN"); - - lh.addStaticHoliday ("02-NOV-2038", "MXN"); - - lh.addStaticHoliday ("15-NOV-2038", "MXN"); - - lh.addStaticHoliday ("07-FEB-2039", "MXN"); - - lh.addStaticHoliday ("21-MAR-2039", "MXN"); - - lh.addStaticHoliday ("07-APR-2039", "MXN"); - - lh.addStaticHoliday ("08-APR-2039", "MXN"); - - lh.addStaticHoliday ("16-SEP-2039", "MXN"); - - lh.addStaticHoliday ("02-NOV-2039", "MXN"); - - lh.addStaticHoliday ("21-NOV-2039", "MXN"); - - lh.addStaticHoliday ("12-DEC-2039", "MXN"); - - lh.addStaticHoliday ("06-FEB-2040", "MXN"); - - lh.addStaticHoliday ("19-MAR-2040", "MXN"); - - lh.addStaticHoliday ("29-MAR-2040", "MXN"); - - lh.addStaticHoliday ("30-MAR-2040", "MXN"); - - lh.addStaticHoliday ("01-MAY-2040", "MXN"); - - lh.addStaticHoliday ("02-NOV-2040", "MXN"); - - lh.addStaticHoliday ("19-NOV-2040", "MXN"); - - lh.addStaticHoliday ("12-DEC-2040", "MXN"); - - lh.addStaticHoliday ("25-DEC-2040", "MXN"); - - lh.addStaticHoliday ("01-JAN-2041", "MXN"); - - lh.addStaticHoliday ("04-FEB-2041", "MXN"); - - lh.addStaticHoliday ("18-MAR-2041", "MXN"); - - lh.addStaticHoliday ("18-APR-2041", "MXN"); - - lh.addStaticHoliday ("19-APR-2041", "MXN"); - - lh.addStaticHoliday ("01-MAY-2041", "MXN"); - - lh.addStaticHoliday ("16-SEP-2041", "MXN"); - - lh.addStaticHoliday ("18-NOV-2041", "MXN"); - - lh.addStaticHoliday ("12-DEC-2041", "MXN"); - - lh.addStaticHoliday ("25-DEC-2041", "MXN"); - - lh.addStaticHoliday ("01-JAN-2042", "MXN"); - - lh.addStaticHoliday ("03-FEB-2042", "MXN"); - - lh.addStaticHoliday ("17-MAR-2042", "MXN"); - - lh.addStaticHoliday ("03-APR-2042", "MXN"); - - lh.addStaticHoliday ("04-APR-2042", "MXN"); - - lh.addStaticHoliday ("01-MAY-2042", "MXN"); - - lh.addStaticHoliday ("16-SEP-2042", "MXN"); - - lh.addStaticHoliday ("17-NOV-2042", "MXN"); - - lh.addStaticHoliday ("01-DEC-2042", "MXN"); - - lh.addStaticHoliday ("12-DEC-2042", "MXN"); - - lh.addStaticHoliday ("25-DEC-2042", "MXN"); - - lh.addStaticHoliday ("01-JAN-2043", "MXN"); - - lh.addStaticHoliday ("02-FEB-2043", "MXN"); - - lh.addStaticHoliday ("16-MAR-2043", "MXN"); - - lh.addStaticHoliday ("26-MAR-2043", "MXN"); - - lh.addStaticHoliday ("27-MAR-2043", "MXN"); - - lh.addStaticHoliday ("01-MAY-2043", "MXN"); - - lh.addStaticHoliday ("16-SEP-2043", "MXN"); - - lh.addStaticHoliday ("02-NOV-2043", "MXN"); - - lh.addStaticHoliday ("16-NOV-2043", "MXN"); - - lh.addStaticHoliday ("25-DEC-2043", "MXN"); - - lh.addStaticHoliday ("01-JAN-2044", "MXN"); - - lh.addStaticHoliday ("01-FEB-2044", "MXN"); - - lh.addStaticHoliday ("21-MAR-2044", "MXN"); - - lh.addStaticHoliday ("14-APR-2044", "MXN"); - - lh.addStaticHoliday ("15-APR-2044", "MXN"); - - lh.addStaticHoliday ("16-SEP-2044", "MXN"); - - lh.addStaticHoliday ("02-NOV-2044", "MXN"); - - lh.addStaticHoliday ("21-NOV-2044", "MXN"); - - lh.addStaticHoliday ("12-DEC-2044", "MXN"); - - lh.addStaticHoliday ("06-FEB-2045", "MXN"); - - lh.addStaticHoliday ("20-MAR-2045", "MXN"); - - lh.addStaticHoliday ("06-APR-2045", "MXN"); - - lh.addStaticHoliday ("07-APR-2045", "MXN"); - - lh.addStaticHoliday ("01-MAY-2045", "MXN"); - - lh.addStaticHoliday ("02-NOV-2045", "MXN"); - - lh.addStaticHoliday ("20-NOV-2045", "MXN"); - - lh.addStaticHoliday ("12-DEC-2045", "MXN"); - - lh.addStaticHoliday ("25-DEC-2045", "MXN"); - - lh.addStaticHoliday ("01-JAN-2046", "MXN"); - - lh.addStaticHoliday ("05-FEB-2046", "MXN"); - - lh.addStaticHoliday ("19-MAR-2046", "MXN"); - - lh.addStaticHoliday ("22-MAR-2046", "MXN"); - - lh.addStaticHoliday ("23-MAR-2046", "MXN"); - - lh.addStaticHoliday ("01-MAY-2046", "MXN"); - - lh.addStaticHoliday ("02-NOV-2046", "MXN"); - - lh.addStaticHoliday ("19-NOV-2046", "MXN"); - - lh.addStaticHoliday ("12-DEC-2046", "MXN"); - - lh.addStaticHoliday ("25-DEC-2046", "MXN"); - - lh.addStaticHoliday ("01-JAN-2047", "MXN"); - - lh.addStaticHoliday ("04-FEB-2047", "MXN"); - - lh.addStaticHoliday ("18-MAR-2047", "MXN"); - - lh.addStaticHoliday ("11-APR-2047", "MXN"); - - lh.addStaticHoliday ("12-APR-2047", "MXN"); - - lh.addStaticHoliday ("01-MAY-2047", "MXN"); - - lh.addStaticHoliday ("16-SEP-2047", "MXN"); - - lh.addStaticHoliday ("18-NOV-2047", "MXN"); - - lh.addStaticHoliday ("12-DEC-2047", "MXN"); - - lh.addStaticHoliday ("25-DEC-2047", "MXN"); - - lh.addStaticHoliday ("01-JAN-2048", "MXN"); - - lh.addStaticHoliday ("03-FEB-2048", "MXN"); - - lh.addStaticHoliday ("16-MAR-2048", "MXN"); - - lh.addStaticHoliday ("02-APR-2048", "MXN"); - - lh.addStaticHoliday ("03-APR-2048", "MXN"); - - lh.addStaticHoliday ("01-MAY-2048", "MXN"); - - lh.addStaticHoliday ("16-SEP-2048", "MXN"); - - lh.addStaticHoliday ("02-NOV-2048", "MXN"); - - lh.addStaticHoliday ("16-NOV-2048", "MXN"); - - lh.addStaticHoliday ("01-DEC-2048", "MXN"); - - lh.addStaticHoliday ("25-DEC-2048", "MXN"); - - lh.addStaticHoliday ("01-JAN-2049", "MXN"); - - lh.addStaticHoliday ("01-FEB-2049", "MXN"); - - lh.addStaticHoliday ("15-MAR-2049", "MXN"); - - lh.addStaticHoliday ("15-APR-2049", "MXN"); - - lh.addStaticHoliday ("16-APR-2049", "MXN"); - - lh.addStaticHoliday ("16-SEP-2049", "MXN"); - - lh.addStaticHoliday ("02-NOV-2049", "MXN"); - - lh.addStaticHoliday ("15-NOV-2049", "MXN"); - - lh.addStaticHoliday ("07-FEB-2050", "MXN"); - - lh.addStaticHoliday ("21-MAR-2050", "MXN"); - - lh.addStaticHoliday ("07-APR-2050", "MXN"); - - lh.addStaticHoliday ("08-APR-2050", "MXN"); - - lh.addStaticHoliday ("16-SEP-2050", "MXN"); - - lh.addStaticHoliday ("02-NOV-2050", "MXN"); - - lh.addStaticHoliday ("21-NOV-2050", "MXN"); - - lh.addStaticHoliday ("12-DEC-2050", "MXN"); - - lh.addStaticHoliday ("06-FEB-2051", "MXN"); - - lh.addStaticHoliday ("20-MAR-2051", "MXN"); - - lh.addStaticHoliday ("30-MAR-2051", "MXN"); - - lh.addStaticHoliday ("31-MAR-2051", "MXN"); - - lh.addStaticHoliday ("01-MAY-2051", "MXN"); - - lh.addStaticHoliday ("02-NOV-2051", "MXN"); - - lh.addStaticHoliday ("20-NOV-2051", "MXN"); - - lh.addStaticHoliday ("12-DEC-2051", "MXN"); - - lh.addStaticHoliday ("25-DEC-2051", "MXN"); - - lh.addStaticHoliday ("01-JAN-2052", "MXN"); - - lh.addStaticHoliday ("05-FEB-2052", "MXN"); - - lh.addStaticHoliday ("18-MAR-2052", "MXN"); - - lh.addStaticHoliday ("18-APR-2052", "MXN"); - - lh.addStaticHoliday ("19-APR-2052", "MXN"); - - lh.addStaticHoliday ("01-MAY-2052", "MXN"); - - lh.addStaticHoliday ("16-SEP-2052", "MXN"); - - lh.addStaticHoliday ("18-NOV-2052", "MXN"); - - lh.addStaticHoliday ("12-DEC-2052", "MXN"); - - lh.addStaticHoliday ("25-DEC-2052", "MXN"); - - lh.addStaticHoliday ("01-JAN-2053", "MXN"); - - lh.addStaticHoliday ("03-FEB-2053", "MXN"); - - lh.addStaticHoliday ("17-MAR-2053", "MXN"); - - lh.addStaticHoliday ("03-APR-2053", "MXN"); - - lh.addStaticHoliday ("04-APR-2053", "MXN"); - - lh.addStaticHoliday ("01-MAY-2053", "MXN"); - - lh.addStaticHoliday ("16-SEP-2053", "MXN"); - - lh.addStaticHoliday ("17-NOV-2053", "MXN"); - - lh.addStaticHoliday ("12-DEC-2053", "MXN"); - - lh.addStaticHoliday ("25-DEC-2053", "MXN"); - - lh.addStaticHoliday ("01-JAN-2054", "MXN"); - - lh.addStaticHoliday ("02-FEB-2054", "MXN"); - - lh.addStaticHoliday ("16-MAR-2054", "MXN"); - - lh.addStaticHoliday ("26-MAR-2054", "MXN"); - - lh.addStaticHoliday ("27-MAR-2054", "MXN"); - - lh.addStaticHoliday ("01-MAY-2054", "MXN"); - - lh.addStaticHoliday ("16-SEP-2054", "MXN"); - - lh.addStaticHoliday ("02-NOV-2054", "MXN"); - - lh.addStaticHoliday ("16-NOV-2054", "MXN"); - - lh.addStaticHoliday ("01-DEC-2054", "MXN"); - - lh.addStaticHoliday ("25-DEC-2054", "MXN"); - - lh.addStaticHoliday ("01-JAN-2055", "MXN"); - - lh.addStaticHoliday ("01-FEB-2055", "MXN"); - - lh.addStaticHoliday ("15-MAR-2055", "MXN"); - - lh.addStaticHoliday ("15-APR-2055", "MXN"); - - lh.addStaticHoliday ("16-APR-2055", "MXN"); - - lh.addStaticHoliday ("16-SEP-2055", "MXN"); - - lh.addStaticHoliday ("02-NOV-2055", "MXN"); - - lh.addStaticHoliday ("15-NOV-2055", "MXN"); - - lh.addStaticHoliday ("07-FEB-2056", "MXN"); - - lh.addStaticHoliday ("20-MAR-2056", "MXN"); - - lh.addStaticHoliday ("30-MAR-2056", "MXN"); - - lh.addStaticHoliday ("31-MAR-2056", "MXN"); - - lh.addStaticHoliday ("01-MAY-2056", "MXN"); - - lh.addStaticHoliday ("02-NOV-2056", "MXN"); - - lh.addStaticHoliday ("20-NOV-2056", "MXN"); - - lh.addStaticHoliday ("12-DEC-2056", "MXN"); - - lh.addStaticHoliday ("25-DEC-2056", "MXN"); - - lh.addStaticHoliday ("01-JAN-2057", "MXN"); - - lh.addStaticHoliday ("05-FEB-2057", "MXN"); - - lh.addStaticHoliday ("19-MAR-2057", "MXN"); - - lh.addStaticHoliday ("19-APR-2057", "MXN"); - - lh.addStaticHoliday ("20-APR-2057", "MXN"); - - lh.addStaticHoliday ("01-MAY-2057", "MXN"); - - lh.addStaticHoliday ("02-NOV-2057", "MXN"); - - lh.addStaticHoliday ("19-NOV-2057", "MXN"); - - lh.addStaticHoliday ("12-DEC-2057", "MXN"); - - lh.addStaticHoliday ("25-DEC-2057", "MXN"); - - lh.addStaticHoliday ("01-JAN-2058", "MXN"); - - lh.addStaticHoliday ("04-FEB-2058", "MXN"); - - lh.addStaticHoliday ("18-MAR-2058", "MXN"); - - lh.addStaticHoliday ("11-APR-2058", "MXN"); - - lh.addStaticHoliday ("12-APR-2058", "MXN"); - - lh.addStaticHoliday ("01-MAY-2058", "MXN"); - - lh.addStaticHoliday ("16-SEP-2058", "MXN"); - - lh.addStaticHoliday ("18-NOV-2058", "MXN"); - - lh.addStaticHoliday ("12-DEC-2058", "MXN"); - - lh.addStaticHoliday ("25-DEC-2058", "MXN"); - - lh.addStaticHoliday ("01-JAN-2059", "MXN"); - - lh.addStaticHoliday ("03-FEB-2059", "MXN"); - - lh.addStaticHoliday ("17-MAR-2059", "MXN"); - - lh.addStaticHoliday ("27-MAR-2059", "MXN"); - - lh.addStaticHoliday ("28-MAR-2059", "MXN"); - - lh.addStaticHoliday ("01-MAY-2059", "MXN"); - - lh.addStaticHoliday ("16-SEP-2059", "MXN"); - - lh.addStaticHoliday ("17-NOV-2059", "MXN"); - - lh.addStaticHoliday ("12-DEC-2059", "MXN"); - - lh.addStaticHoliday ("25-DEC-2059", "MXN"); - - lh.addStaticHoliday ("01-JAN-2060", "MXN"); - - lh.addStaticHoliday ("02-FEB-2060", "MXN"); - - lh.addStaticHoliday ("15-MAR-2060", "MXN"); - - lh.addStaticHoliday ("15-APR-2060", "MXN"); - - lh.addStaticHoliday ("16-APR-2060", "MXN"); - - lh.addStaticHoliday ("16-SEP-2060", "MXN"); - - lh.addStaticHoliday ("02-NOV-2060", "MXN"); - - lh.addStaticHoliday ("15-NOV-2060", "MXN"); - - lh.addStaticHoliday ("01-DEC-2060", "MXN"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/MXPHoliday.java b/org/drip/analytics/holset/MXPHoliday.java deleted file mode 100644 index 3cc6f5f..0000000 --- a/org/drip/analytics/holset/MXPHoliday.java +++ /dev/null @@ -1,1251 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class MXPHoliday implements org.drip.analytics.holset.LocationHoliday { - public MXPHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "MXP"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-1998", "Constitution Day"); - - lh.addStaticHoliday ("09-APR-1998", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-1998", "Puebla Battle Day"); - - lh.addStaticHoliday ("01-SEP-1998", "Presidential Report"); - - lh.addStaticHoliday ("16-SEP-1998", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-1998", "All Souls Day"); - - lh.addStaticHoliday ("20-NOV-1998", "Revolution Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-1999", "Constitution Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-MAY-1999", "Puebla Battle Day"); - - lh.addStaticHoliday ("01-SEP-1999", "Presidential Report"); - - lh.addStaticHoliday ("16-SEP-1999", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-1999", "All Souls Day"); - - lh.addStaticHoliday ("21-MAR-2000", "Juarezs Birthday"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2000", "Puebla Battle Day"); - - lh.addStaticHoliday ("01-SEP-2000", "Presidential Report"); - - lh.addStaticHoliday ("02-NOV-2000", "All Souls Day"); - - lh.addStaticHoliday ("20-NOV-2000", "Revolution Day"); - - lh.addStaticHoliday ("01-DEC-2000", "Presidential Succession Day"); - - lh.addStaticHoliday ("12-DEC-2000", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2001", "Constitution Day"); - - lh.addStaticHoliday ("21-MAR-2001", "Juarezs Birthday"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("02-NOV-2001", "All Souls Day"); - - lh.addStaticHoliday ("20-NOV-2001", "Revolution Day"); - - lh.addStaticHoliday ("12-DEC-2001", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2002", "Constitution Day"); - - lh.addStaticHoliday ("21-MAR-2002", "Juarezs Birthday"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("16-SEP-2002", "Independence Day"); - - lh.addStaticHoliday ("20-NOV-2002", "Revolution Day"); - - lh.addStaticHoliday ("12-DEC-2002", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2003", "Constitution Day"); - - lh.addStaticHoliday ("21-MAR-2003", "Juarezs Birthday"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2003", "Puebla Battle Day"); - - lh.addStaticHoliday ("16-SEP-2003", "Independence Day"); - - lh.addStaticHoliday ("20-NOV-2003", "Revolution Day"); - - lh.addStaticHoliday ("12-DEC-2003", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2004", "Constitution Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("05-MAY-2004", "Puebla Battle Day"); - - lh.addStaticHoliday ("16-SEP-2004", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2004", "All Souls Day"); - - lh.addStaticHoliday ("21-MAR-2005", "Juarezs Birthday"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("16-SEP-2005", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2005", "All Souls Day"); - - lh.addStaticHoliday ("12-DEC-2005", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("01-JAN-2006", "New Years Day"); - - lh.addStaticHoliday ("06-FEB-2006", "Dia de la Constitucion"); - - lh.addStaticHoliday ("21-MAR-2006", "Juarezs Birthday"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("16-SEP-2006", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2006", "All Souls Day"); - - lh.addStaticHoliday ("20-NOV-2006", "Revolution Day"); - - lh.addStaticHoliday ("01-DEC-2006", "Presidential Succession Day"); - - lh.addStaticHoliday ("12-DEC-2006", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2007", "Constitution Day"); - - lh.addStaticHoliday ("19-MAR-2007", "Juarezs Birthday"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("02-NOV-2007", "All Souls Day"); - - lh.addStaticHoliday ("19-NOV-2007", "Revolution Day"); - - lh.addStaticHoliday ("12-DEC-2007", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("04-FEB-2008", "Constitution Day"); - - lh.addStaticHoliday ("17-MAR-2008", "Juarezs Birthday"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("16-SEP-2008", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2008", "All Souls Day"); - - lh.addStaticHoliday ("17-NOV-2008", "Revolution Day"); - - lh.addStaticHoliday ("12-DEC-2008", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("02-FEB-2009", "Constitution Day"); - - lh.addStaticHoliday ("16-MAR-2009", "Juarezs Birthday"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("16-SEP-2009", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2009", "All Souls Day"); - - lh.addStaticHoliday ("16-NOV-2009", "Revolution Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "MXN"); - - lh.addStaticHoliday ("01-FEB-2010", "MXN"); - - lh.addStaticHoliday ("15-MAR-2010", "MXN"); - - lh.addStaticHoliday ("01-APR-2010", "MXN"); - - lh.addStaticHoliday ("02-APR-2010", "MXN"); - - lh.addStaticHoliday ("16-SEP-2010", "MXN"); - - lh.addStaticHoliday ("17-SEP-2010", "MXN"); - - lh.addStaticHoliday ("02-NOV-2010", "MXN"); - - lh.addStaticHoliday ("15-NOV-2010", "MXN"); - - lh.addStaticHoliday ("07-FEB-2011", "MXN"); - - lh.addStaticHoliday ("21-MAR-2011", "MXN"); - - lh.addStaticHoliday ("21-APR-2011", "MXN"); - - lh.addStaticHoliday ("22-APR-2011", "MXN"); - - lh.addStaticHoliday ("16-SEP-2011", "MXN"); - - lh.addStaticHoliday ("02-NOV-2011", "MXN"); - - lh.addStaticHoliday ("21-NOV-2011", "MXN"); - - lh.addStaticHoliday ("12-DEC-2011", "MXN"); - - lh.addStaticHoliday ("06-FEB-2012", "MXN"); - - lh.addStaticHoliday ("19-MAR-2012", "MXN"); - - lh.addStaticHoliday ("05-APR-2012", "MXN"); - - lh.addStaticHoliday ("06-APR-2012", "MXN"); - - lh.addStaticHoliday ("01-MAY-2012", "MXN"); - - lh.addStaticHoliday ("02-NOV-2012", "MXN"); - - lh.addStaticHoliday ("19-NOV-2012", "MXN"); - - lh.addStaticHoliday ("12-DEC-2012", "MXN"); - - lh.addStaticHoliday ("25-DEC-2012", "MXN"); - - lh.addStaticHoliday ("01-JAN-2013", "MXN"); - - lh.addStaticHoliday ("04-FEB-2013", "MXN"); - - lh.addStaticHoliday ("18-MAR-2013", "MXN"); - - lh.addStaticHoliday ("28-MAR-2013", "MXN"); - - lh.addStaticHoliday ("29-MAR-2013", "MXN"); - - lh.addStaticHoliday ("01-MAY-2013", "MXN"); - - lh.addStaticHoliday ("16-SEP-2013", "MXN"); - - lh.addStaticHoliday ("18-NOV-2013", "MXN"); - - lh.addStaticHoliday ("12-DEC-2013", "MXN"); - - lh.addStaticHoliday ("25-DEC-2013", "MXN"); - - lh.addStaticHoliday ("01-JAN-2014", "MXN"); - - lh.addStaticHoliday ("03-FEB-2014", "MXN"); - - lh.addStaticHoliday ("17-MAR-2014", "MXN"); - - lh.addStaticHoliday ("17-APR-2014", "MXN"); - - lh.addStaticHoliday ("18-APR-2014", "MXN"); - - lh.addStaticHoliday ("01-MAY-2014", "MXN"); - - lh.addStaticHoliday ("16-SEP-2014", "MXN"); - - lh.addStaticHoliday ("17-NOV-2014", "MXN"); - - lh.addStaticHoliday ("12-DEC-2014", "MXN"); - - lh.addStaticHoliday ("25-DEC-2014", "MXN"); - - lh.addStaticHoliday ("01-JAN-2015", "MXN"); - - lh.addStaticHoliday ("02-FEB-2015", "MXN"); - - lh.addStaticHoliday ("16-MAR-2015", "MXN"); - - lh.addStaticHoliday ("02-APR-2015", "MXN"); - - lh.addStaticHoliday ("03-APR-2015", "MXN"); - - lh.addStaticHoliday ("01-MAY-2015", "MXN"); - - lh.addStaticHoliday ("16-SEP-2015", "MXN"); - - lh.addStaticHoliday ("02-NOV-2015", "MXN"); - - lh.addStaticHoliday ("16-NOV-2015", "MXN"); - - lh.addStaticHoliday ("25-DEC-2015", "MXN"); - - lh.addStaticHoliday ("01-JAN-2016", "MXN"); - - lh.addStaticHoliday ("01-FEB-2016", "MXN"); - - lh.addStaticHoliday ("21-MAR-2016", "MXN"); - - lh.addStaticHoliday ("24-MAR-2016", "MXN"); - - lh.addStaticHoliday ("25-MAR-2016", "MXN"); - - lh.addStaticHoliday ("16-SEP-2016", "MXN"); - - lh.addStaticHoliday ("02-NOV-2016", "MXN"); - - lh.addStaticHoliday ("21-NOV-2016", "MXN"); - - lh.addStaticHoliday ("12-DEC-2016", "MXN"); - - lh.addStaticHoliday ("06-FEB-2017", "MXN"); - - lh.addStaticHoliday ("20-MAR-2017", "MXN"); - - lh.addStaticHoliday ("13-APR-2017", "MXN"); - - lh.addStaticHoliday ("14-APR-2017", "MXN"); - - lh.addStaticHoliday ("01-MAY-2017", "MXN"); - - lh.addStaticHoliday ("02-NOV-2017", "MXN"); - - lh.addStaticHoliday ("20-NOV-2017", "MXN"); - - lh.addStaticHoliday ("12-DEC-2017", "MXN"); - - lh.addStaticHoliday ("25-DEC-2017", "MXN"); - - lh.addStaticHoliday ("01-JAN-2018", "MXN"); - - lh.addStaticHoliday ("05-FEB-2018", "MXN"); - - lh.addStaticHoliday ("19-MAR-2018", "MXN"); - - lh.addStaticHoliday ("29-MAR-2018", "MXN"); - - lh.addStaticHoliday ("30-MAR-2018", "MXN"); - - lh.addStaticHoliday ("01-MAY-2018", "MXN"); - - lh.addStaticHoliday ("02-NOV-2018", "MXN"); - - lh.addStaticHoliday ("19-NOV-2018", "MXN"); - - lh.addStaticHoliday ("12-DEC-2018", "MXN"); - - lh.addStaticHoliday ("25-DEC-2018", "MXN"); - - lh.addStaticHoliday ("01-JAN-2019", "MXN"); - - lh.addStaticHoliday ("04-FEB-2019", "MXN"); - - lh.addStaticHoliday ("18-MAR-2019", "MXN"); - - lh.addStaticHoliday ("18-APR-2019", "MXN"); - - lh.addStaticHoliday ("19-APR-2019", "MXN"); - - lh.addStaticHoliday ("01-MAY-2019", "MXN"); - - lh.addStaticHoliday ("16-SEP-2019", "MXN"); - - lh.addStaticHoliday ("18-NOV-2019", "MXN"); - - lh.addStaticHoliday ("12-DEC-2019", "MXN"); - - lh.addStaticHoliday ("25-DEC-2019", "MXN"); - - lh.addStaticHoliday ("01-JAN-2020", "MXN"); - - lh.addStaticHoliday ("03-FEB-2020", "MXN"); - - lh.addStaticHoliday ("16-MAR-2020", "MXN"); - - lh.addStaticHoliday ("09-APR-2020", "MXN"); - - lh.addStaticHoliday ("10-APR-2020", "MXN"); - - lh.addStaticHoliday ("01-MAY-2020", "MXN"); - - lh.addStaticHoliday ("16-SEP-2020", "MXN"); - - lh.addStaticHoliday ("02-NOV-2020", "MXN"); - - lh.addStaticHoliday ("16-NOV-2020", "MXN"); - - lh.addStaticHoliday ("25-DEC-2020", "MXN"); - - lh.addStaticHoliday ("01-JAN-2021", "MXN"); - - lh.addStaticHoliday ("01-FEB-2021", "MXN"); - - lh.addStaticHoliday ("15-MAR-2021", "MXN"); - - lh.addStaticHoliday ("01-APR-2021", "MXN"); - - lh.addStaticHoliday ("02-APR-2021", "MXN"); - - lh.addStaticHoliday ("16-SEP-2021", "MXN"); - - lh.addStaticHoliday ("02-NOV-2021", "MXN"); - - lh.addStaticHoliday ("15-NOV-2021", "MXN"); - - lh.addStaticHoliday ("07-FEB-2022", "MXN"); - - lh.addStaticHoliday ("21-MAR-2022", "MXN"); - - lh.addStaticHoliday ("14-APR-2022", "MXN"); - - lh.addStaticHoliday ("15-APR-2022", "MXN"); - - lh.addStaticHoliday ("16-SEP-2022", "MXN"); - - lh.addStaticHoliday ("02-NOV-2022", "MXN"); - - lh.addStaticHoliday ("21-NOV-2022", "MXN"); - - lh.addStaticHoliday ("12-DEC-2022", "MXN"); - - lh.addStaticHoliday ("06-FEB-2023", "MXN"); - - lh.addStaticHoliday ("20-MAR-2023", "MXN"); - - lh.addStaticHoliday ("06-APR-2023", "MXN"); - - lh.addStaticHoliday ("07-APR-2023", "MXN"); - - lh.addStaticHoliday ("01-MAY-2023", "MXN"); - - lh.addStaticHoliday ("02-NOV-2023", "MXN"); - - lh.addStaticHoliday ("20-NOV-2023", "MXN"); - - lh.addStaticHoliday ("12-DEC-2023", "MXN"); - - lh.addStaticHoliday ("25-DEC-2023", "MXN"); - - lh.addStaticHoliday ("01-JAN-2024", "MXN"); - - lh.addStaticHoliday ("05-FEB-2024", "MXN"); - - lh.addStaticHoliday ("18-MAR-2024", "MXN"); - - lh.addStaticHoliday ("28-MAR-2024", "MXN"); - - lh.addStaticHoliday ("29-MAR-2024", "MXN"); - - lh.addStaticHoliday ("01-MAY-2024", "MXN"); - - lh.addStaticHoliday ("16-SEP-2024", "MXN"); - - lh.addStaticHoliday ("18-NOV-2024", "MXN"); - - lh.addStaticHoliday ("12-DEC-2024", "MXN"); - - lh.addStaticHoliday ("25-DEC-2024", "MXN"); - - lh.addStaticHoliday ("01-JAN-2025", "MXN"); - - lh.addStaticHoliday ("03-FEB-2025", "MXN"); - - lh.addStaticHoliday ("17-MAR-2025", "MXN"); - - lh.addStaticHoliday ("17-APR-2025", "MXN"); - - lh.addStaticHoliday ("18-APR-2025", "MXN"); - - lh.addStaticHoliday ("01-MAY-2025", "MXN"); - - lh.addStaticHoliday ("16-SEP-2025", "MXN"); - - lh.addStaticHoliday ("17-NOV-2025", "MXN"); - - lh.addStaticHoliday ("12-DEC-2025", "MXN"); - - lh.addStaticHoliday ("25-DEC-2025", "MXN"); - - lh.addStaticHoliday ("01-JAN-2026", "MXN"); - - lh.addStaticHoliday ("02-FEB-2026", "MXN"); - - lh.addStaticHoliday ("16-MAR-2026", "MXN"); - - lh.addStaticHoliday ("02-APR-2026", "MXN"); - - lh.addStaticHoliday ("03-APR-2026", "MXN"); - - lh.addStaticHoliday ("01-MAY-2026", "MXN"); - - lh.addStaticHoliday ("16-SEP-2026", "MXN"); - - lh.addStaticHoliday ("02-NOV-2026", "MXN"); - - lh.addStaticHoliday ("16-NOV-2026", "MXN"); - - lh.addStaticHoliday ("25-DEC-2026", "MXN"); - - lh.addStaticHoliday ("01-JAN-2027", "MXN"); - - lh.addStaticHoliday ("01-FEB-2027", "MXN"); - - lh.addStaticHoliday ("15-MAR-2027", "MXN"); - - lh.addStaticHoliday ("25-MAR-2027", "MXN"); - - lh.addStaticHoliday ("26-MAR-2027", "MXN"); - - lh.addStaticHoliday ("16-SEP-2027", "MXN"); - - lh.addStaticHoliday ("02-NOV-2027", "MXN"); - - lh.addStaticHoliday ("15-NOV-2027", "MXN"); - - lh.addStaticHoliday ("07-FEB-2028", "MXN"); - - lh.addStaticHoliday ("20-MAR-2028", "MXN"); - - lh.addStaticHoliday ("13-APR-2028", "MXN"); - - lh.addStaticHoliday ("14-APR-2028", "MXN"); - - lh.addStaticHoliday ("01-MAY-2028", "MXN"); - - lh.addStaticHoliday ("02-NOV-2028", "MXN"); - - lh.addStaticHoliday ("20-NOV-2028", "MXN"); - - lh.addStaticHoliday ("12-DEC-2028", "MXN"); - - lh.addStaticHoliday ("25-DEC-2028", "MXN"); - - lh.addStaticHoliday ("01-JAN-2029", "MXN"); - - lh.addStaticHoliday ("05-FEB-2029", "MXN"); - - lh.addStaticHoliday ("19-MAR-2029", "MXN"); - - lh.addStaticHoliday ("29-MAR-2029", "MXN"); - - lh.addStaticHoliday ("30-MAR-2029", "MXN"); - - lh.addStaticHoliday ("01-MAY-2029", "MXN"); - - lh.addStaticHoliday ("02-NOV-2029", "MXN"); - - lh.addStaticHoliday ("19-NOV-2029", "MXN"); - - lh.addStaticHoliday ("12-DEC-2029", "MXN"); - - lh.addStaticHoliday ("25-DEC-2029", "MXN"); - - lh.addStaticHoliday ("01-JAN-2030", "MXN"); - - lh.addStaticHoliday ("04-FEB-2030", "MXN"); - - lh.addStaticHoliday ("18-MAR-2030", "MXN"); - - lh.addStaticHoliday ("18-APR-2030", "MXN"); - - lh.addStaticHoliday ("19-APR-2030", "MXN"); - - lh.addStaticHoliday ("01-MAY-2030", "MXN"); - - lh.addStaticHoliday ("16-SEP-2030", "MXN"); - - lh.addStaticHoliday ("18-NOV-2030", "MXN"); - - lh.addStaticHoliday ("12-DEC-2030", "MXN"); - - lh.addStaticHoliday ("25-DEC-2030", "MXN"); - - lh.addStaticHoliday ("01-JAN-2031", "MXN"); - - lh.addStaticHoliday ("03-FEB-2031", "MXN"); - - lh.addStaticHoliday ("17-MAR-2031", "MXN"); - - lh.addStaticHoliday ("10-APR-2031", "MXN"); - - lh.addStaticHoliday ("11-APR-2031", "MXN"); - - lh.addStaticHoliday ("01-MAY-2031", "MXN"); - - lh.addStaticHoliday ("16-SEP-2031", "MXN"); - - lh.addStaticHoliday ("17-NOV-2031", "MXN"); - - lh.addStaticHoliday ("12-DEC-2031", "MXN"); - - lh.addStaticHoliday ("25-DEC-2031", "MXN"); - - lh.addStaticHoliday ("01-JAN-2032", "MXN"); - - lh.addStaticHoliday ("02-FEB-2032", "MXN"); - - lh.addStaticHoliday ("15-MAR-2032", "MXN"); - - lh.addStaticHoliday ("25-MAR-2032", "MXN"); - - lh.addStaticHoliday ("26-MAR-2032", "MXN"); - - lh.addStaticHoliday ("16-SEP-2032", "MXN"); - - lh.addStaticHoliday ("02-NOV-2032", "MXN"); - - lh.addStaticHoliday ("15-NOV-2032", "MXN"); - - lh.addStaticHoliday ("07-FEB-2033", "MXN"); - - lh.addStaticHoliday ("21-MAR-2033", "MXN"); - - lh.addStaticHoliday ("14-APR-2033", "MXN"); - - lh.addStaticHoliday ("15-APR-2033", "MXN"); - - lh.addStaticHoliday ("16-SEP-2033", "MXN"); - - lh.addStaticHoliday ("02-NOV-2033", "MXN"); - - lh.addStaticHoliday ("21-NOV-2033", "MXN"); - - lh.addStaticHoliday ("12-DEC-2033", "MXN"); - - lh.addStaticHoliday ("06-FEB-2034", "MXN"); - - lh.addStaticHoliday ("20-MAR-2034", "MXN"); - - lh.addStaticHoliday ("06-APR-2034", "MXN"); - - lh.addStaticHoliday ("07-APR-2034", "MXN"); - - lh.addStaticHoliday ("01-MAY-2034", "MXN"); - - lh.addStaticHoliday ("02-NOV-2034", "MXN"); - - lh.addStaticHoliday ("20-NOV-2034", "MXN"); - - lh.addStaticHoliday ("12-DEC-2034", "MXN"); - - lh.addStaticHoliday ("25-DEC-2034", "MXN"); - - lh.addStaticHoliday ("01-JAN-2035", "MXN"); - - lh.addStaticHoliday ("05-FEB-2035", "MXN"); - - lh.addStaticHoliday ("19-MAR-2035", "MXN"); - - lh.addStaticHoliday ("22-MAR-2035", "MXN"); - - lh.addStaticHoliday ("23-MAR-2035", "MXN"); - - lh.addStaticHoliday ("01-MAY-2035", "MXN"); - - lh.addStaticHoliday ("02-NOV-2035", "MXN"); - - lh.addStaticHoliday ("19-NOV-2035", "MXN"); - - lh.addStaticHoliday ("12-DEC-2035", "MXN"); - - lh.addStaticHoliday ("25-DEC-2035", "MXN"); - - lh.addStaticHoliday ("01-JAN-2036", "MXN"); - - lh.addStaticHoliday ("04-FEB-2036", "MXN"); - - lh.addStaticHoliday ("17-MAR-2036", "MXN"); - - lh.addStaticHoliday ("10-APR-2036", "MXN"); - - lh.addStaticHoliday ("11-APR-2036", "MXN"); - - lh.addStaticHoliday ("01-MAY-2036", "MXN"); - - lh.addStaticHoliday ("16-SEP-2036", "MXN"); - - lh.addStaticHoliday ("17-NOV-2036", "MXN"); - - lh.addStaticHoliday ("01-DEC-2036", "MXN"); - - lh.addStaticHoliday ("12-DEC-2036", "MXN"); - - lh.addStaticHoliday ("25-DEC-2036", "MXN"); - - lh.addStaticHoliday ("01-JAN-2037", "MXN"); - - lh.addStaticHoliday ("02-FEB-2037", "MXN"); - - lh.addStaticHoliday ("16-MAR-2037", "MXN"); - - lh.addStaticHoliday ("02-APR-2037", "MXN"); - - lh.addStaticHoliday ("03-APR-2037", "MXN"); - - lh.addStaticHoliday ("01-MAY-2037", "MXN"); - - lh.addStaticHoliday ("16-SEP-2037", "MXN"); - - lh.addStaticHoliday ("02-NOV-2037", "MXN"); - - lh.addStaticHoliday ("16-NOV-2037", "MXN"); - - lh.addStaticHoliday ("25-DEC-2037", "MXN"); - - lh.addStaticHoliday ("01-JAN-2038", "MXN"); - - lh.addStaticHoliday ("01-FEB-2038", "MXN"); - - lh.addStaticHoliday ("15-MAR-2038", "MXN"); - - lh.addStaticHoliday ("22-APR-2038", "MXN"); - - lh.addStaticHoliday ("23-APR-2038", "MXN"); - - lh.addStaticHoliday ("16-SEP-2038", "MXN"); - - lh.addStaticHoliday ("02-NOV-2038", "MXN"); - - lh.addStaticHoliday ("15-NOV-2038", "MXN"); - - lh.addStaticHoliday ("07-FEB-2039", "MXN"); - - lh.addStaticHoliday ("21-MAR-2039", "MXN"); - - lh.addStaticHoliday ("07-APR-2039", "MXN"); - - lh.addStaticHoliday ("08-APR-2039", "MXN"); - - lh.addStaticHoliday ("16-SEP-2039", "MXN"); - - lh.addStaticHoliday ("02-NOV-2039", "MXN"); - - lh.addStaticHoliday ("21-NOV-2039", "MXN"); - - lh.addStaticHoliday ("12-DEC-2039", "MXN"); - - lh.addStaticHoliday ("06-FEB-2040", "MXN"); - - lh.addStaticHoliday ("19-MAR-2040", "MXN"); - - lh.addStaticHoliday ("29-MAR-2040", "MXN"); - - lh.addStaticHoliday ("30-MAR-2040", "MXN"); - - lh.addStaticHoliday ("01-MAY-2040", "MXN"); - - lh.addStaticHoliday ("02-NOV-2040", "MXN"); - - lh.addStaticHoliday ("19-NOV-2040", "MXN"); - - lh.addStaticHoliday ("12-DEC-2040", "MXN"); - - lh.addStaticHoliday ("25-DEC-2040", "MXN"); - - lh.addStaticHoliday ("01-JAN-2041", "MXN"); - - lh.addStaticHoliday ("04-FEB-2041", "MXN"); - - lh.addStaticHoliday ("18-MAR-2041", "MXN"); - - lh.addStaticHoliday ("18-APR-2041", "MXN"); - - lh.addStaticHoliday ("19-APR-2041", "MXN"); - - lh.addStaticHoliday ("01-MAY-2041", "MXN"); - - lh.addStaticHoliday ("16-SEP-2041", "MXN"); - - lh.addStaticHoliday ("18-NOV-2041", "MXN"); - - lh.addStaticHoliday ("12-DEC-2041", "MXN"); - - lh.addStaticHoliday ("25-DEC-2041", "MXN"); - - lh.addStaticHoliday ("01-JAN-2042", "MXN"); - - lh.addStaticHoliday ("03-FEB-2042", "MXN"); - - lh.addStaticHoliday ("17-MAR-2042", "MXN"); - - lh.addStaticHoliday ("03-APR-2042", "MXN"); - - lh.addStaticHoliday ("04-APR-2042", "MXN"); - - lh.addStaticHoliday ("01-MAY-2042", "MXN"); - - lh.addStaticHoliday ("16-SEP-2042", "MXN"); - - lh.addStaticHoliday ("17-NOV-2042", "MXN"); - - lh.addStaticHoliday ("01-DEC-2042", "MXN"); - - lh.addStaticHoliday ("12-DEC-2042", "MXN"); - - lh.addStaticHoliday ("25-DEC-2042", "MXN"); - - lh.addStaticHoliday ("01-JAN-2043", "MXN"); - - lh.addStaticHoliday ("02-FEB-2043", "MXN"); - - lh.addStaticHoliday ("16-MAR-2043", "MXN"); - - lh.addStaticHoliday ("26-MAR-2043", "MXN"); - - lh.addStaticHoliday ("27-MAR-2043", "MXN"); - - lh.addStaticHoliday ("01-MAY-2043", "MXN"); - - lh.addStaticHoliday ("16-SEP-2043", "MXN"); - - lh.addStaticHoliday ("02-NOV-2043", "MXN"); - - lh.addStaticHoliday ("16-NOV-2043", "MXN"); - - lh.addStaticHoliday ("25-DEC-2043", "MXN"); - - lh.addStaticHoliday ("01-JAN-2044", "MXN"); - - lh.addStaticHoliday ("01-FEB-2044", "MXN"); - - lh.addStaticHoliday ("21-MAR-2044", "MXN"); - - lh.addStaticHoliday ("14-APR-2044", "MXN"); - - lh.addStaticHoliday ("15-APR-2044", "MXN"); - - lh.addStaticHoliday ("16-SEP-2044", "MXN"); - - lh.addStaticHoliday ("02-NOV-2044", "MXN"); - - lh.addStaticHoliday ("21-NOV-2044", "MXN"); - - lh.addStaticHoliday ("12-DEC-2044", "MXN"); - - lh.addStaticHoliday ("06-FEB-2045", "MXN"); - - lh.addStaticHoliday ("20-MAR-2045", "MXN"); - - lh.addStaticHoliday ("06-APR-2045", "MXN"); - - lh.addStaticHoliday ("07-APR-2045", "MXN"); - - lh.addStaticHoliday ("01-MAY-2045", "MXN"); - - lh.addStaticHoliday ("02-NOV-2045", "MXN"); - - lh.addStaticHoliday ("20-NOV-2045", "MXN"); - - lh.addStaticHoliday ("12-DEC-2045", "MXN"); - - lh.addStaticHoliday ("25-DEC-2045", "MXN"); - - lh.addStaticHoliday ("01-JAN-2046", "MXN"); - - lh.addStaticHoliday ("05-FEB-2046", "MXN"); - - lh.addStaticHoliday ("19-MAR-2046", "MXN"); - - lh.addStaticHoliday ("22-MAR-2046", "MXN"); - - lh.addStaticHoliday ("23-MAR-2046", "MXN"); - - lh.addStaticHoliday ("01-MAY-2046", "MXN"); - - lh.addStaticHoliday ("02-NOV-2046", "MXN"); - - lh.addStaticHoliday ("19-NOV-2046", "MXN"); - - lh.addStaticHoliday ("12-DEC-2046", "MXN"); - - lh.addStaticHoliday ("25-DEC-2046", "MXN"); - - lh.addStaticHoliday ("01-JAN-2047", "MXN"); - - lh.addStaticHoliday ("04-FEB-2047", "MXN"); - - lh.addStaticHoliday ("18-MAR-2047", "MXN"); - - lh.addStaticHoliday ("11-APR-2047", "MXN"); - - lh.addStaticHoliday ("12-APR-2047", "MXN"); - - lh.addStaticHoliday ("01-MAY-2047", "MXN"); - - lh.addStaticHoliday ("16-SEP-2047", "MXN"); - - lh.addStaticHoliday ("18-NOV-2047", "MXN"); - - lh.addStaticHoliday ("12-DEC-2047", "MXN"); - - lh.addStaticHoliday ("25-DEC-2047", "MXN"); - - lh.addStaticHoliday ("01-JAN-2048", "MXN"); - - lh.addStaticHoliday ("03-FEB-2048", "MXN"); - - lh.addStaticHoliday ("16-MAR-2048", "MXN"); - - lh.addStaticHoliday ("02-APR-2048", "MXN"); - - lh.addStaticHoliday ("03-APR-2048", "MXN"); - - lh.addStaticHoliday ("01-MAY-2048", "MXN"); - - lh.addStaticHoliday ("16-SEP-2048", "MXN"); - - lh.addStaticHoliday ("02-NOV-2048", "MXN"); - - lh.addStaticHoliday ("16-NOV-2048", "MXN"); - - lh.addStaticHoliday ("01-DEC-2048", "MXN"); - - lh.addStaticHoliday ("25-DEC-2048", "MXN"); - - lh.addStaticHoliday ("01-JAN-2049", "MXN"); - - lh.addStaticHoliday ("01-FEB-2049", "MXN"); - - lh.addStaticHoliday ("15-MAR-2049", "MXN"); - - lh.addStaticHoliday ("15-APR-2049", "MXN"); - - lh.addStaticHoliday ("16-APR-2049", "MXN"); - - lh.addStaticHoliday ("16-SEP-2049", "MXN"); - - lh.addStaticHoliday ("02-NOV-2049", "MXN"); - - lh.addStaticHoliday ("15-NOV-2049", "MXN"); - - lh.addStaticHoliday ("07-FEB-2050", "MXN"); - - lh.addStaticHoliday ("21-MAR-2050", "MXN"); - - lh.addStaticHoliday ("07-APR-2050", "MXN"); - - lh.addStaticHoliday ("08-APR-2050", "MXN"); - - lh.addStaticHoliday ("16-SEP-2050", "MXN"); - - lh.addStaticHoliday ("02-NOV-2050", "MXN"); - - lh.addStaticHoliday ("21-NOV-2050", "MXN"); - - lh.addStaticHoliday ("12-DEC-2050", "MXN"); - - lh.addStaticHoliday ("06-FEB-2051", "MXN"); - - lh.addStaticHoliday ("20-MAR-2051", "MXN"); - - lh.addStaticHoliday ("30-MAR-2051", "MXN"); - - lh.addStaticHoliday ("31-MAR-2051", "MXN"); - - lh.addStaticHoliday ("01-MAY-2051", "MXN"); - - lh.addStaticHoliday ("02-NOV-2051", "MXN"); - - lh.addStaticHoliday ("20-NOV-2051", "MXN"); - - lh.addStaticHoliday ("12-DEC-2051", "MXN"); - - lh.addStaticHoliday ("25-DEC-2051", "MXN"); - - lh.addStaticHoliday ("01-JAN-2052", "MXN"); - - lh.addStaticHoliday ("05-FEB-2052", "MXN"); - - lh.addStaticHoliday ("18-MAR-2052", "MXN"); - - lh.addStaticHoliday ("18-APR-2052", "MXN"); - - lh.addStaticHoliday ("19-APR-2052", "MXN"); - - lh.addStaticHoliday ("01-MAY-2052", "MXN"); - - lh.addStaticHoliday ("16-SEP-2052", "MXN"); - - lh.addStaticHoliday ("18-NOV-2052", "MXN"); - - lh.addStaticHoliday ("12-DEC-2052", "MXN"); - - lh.addStaticHoliday ("25-DEC-2052", "MXN"); - - lh.addStaticHoliday ("01-JAN-2053", "MXN"); - - lh.addStaticHoliday ("03-FEB-2053", "MXN"); - - lh.addStaticHoliday ("17-MAR-2053", "MXN"); - - lh.addStaticHoliday ("03-APR-2053", "MXN"); - - lh.addStaticHoliday ("04-APR-2053", "MXN"); - - lh.addStaticHoliday ("01-MAY-2053", "MXN"); - - lh.addStaticHoliday ("16-SEP-2053", "MXN"); - - lh.addStaticHoliday ("17-NOV-2053", "MXN"); - - lh.addStaticHoliday ("12-DEC-2053", "MXN"); - - lh.addStaticHoliday ("25-DEC-2053", "MXN"); - - lh.addStaticHoliday ("01-JAN-2054", "MXN"); - - lh.addStaticHoliday ("02-FEB-2054", "MXN"); - - lh.addStaticHoliday ("16-MAR-2054", "MXN"); - - lh.addStaticHoliday ("26-MAR-2054", "MXN"); - - lh.addStaticHoliday ("27-MAR-2054", "MXN"); - - lh.addStaticHoliday ("01-MAY-2054", "MXN"); - - lh.addStaticHoliday ("16-SEP-2054", "MXN"); - - lh.addStaticHoliday ("02-NOV-2054", "MXN"); - - lh.addStaticHoliday ("16-NOV-2054", "MXN"); - - lh.addStaticHoliday ("01-DEC-2054", "MXN"); - - lh.addStaticHoliday ("25-DEC-2054", "MXN"); - - lh.addStaticHoliday ("01-JAN-2055", "MXN"); - - lh.addStaticHoliday ("01-FEB-2055", "MXN"); - - lh.addStaticHoliday ("15-MAR-2055", "MXN"); - - lh.addStaticHoliday ("15-APR-2055", "MXN"); - - lh.addStaticHoliday ("16-APR-2055", "MXN"); - - lh.addStaticHoliday ("16-SEP-2055", "MXN"); - - lh.addStaticHoliday ("02-NOV-2055", "MXN"); - - lh.addStaticHoliday ("15-NOV-2055", "MXN"); - - lh.addStaticHoliday ("07-FEB-2056", "MXN"); - - lh.addStaticHoliday ("20-MAR-2056", "MXN"); - - lh.addStaticHoliday ("30-MAR-2056", "MXN"); - - lh.addStaticHoliday ("31-MAR-2056", "MXN"); - - lh.addStaticHoliday ("01-MAY-2056", "MXN"); - - lh.addStaticHoliday ("02-NOV-2056", "MXN"); - - lh.addStaticHoliday ("20-NOV-2056", "MXN"); - - lh.addStaticHoliday ("12-DEC-2056", "MXN"); - - lh.addStaticHoliday ("25-DEC-2056", "MXN"); - - lh.addStaticHoliday ("01-JAN-2057", "MXN"); - - lh.addStaticHoliday ("05-FEB-2057", "MXN"); - - lh.addStaticHoliday ("19-MAR-2057", "MXN"); - - lh.addStaticHoliday ("19-APR-2057", "MXN"); - - lh.addStaticHoliday ("20-APR-2057", "MXN"); - - lh.addStaticHoliday ("01-MAY-2057", "MXN"); - - lh.addStaticHoliday ("02-NOV-2057", "MXN"); - - lh.addStaticHoliday ("19-NOV-2057", "MXN"); - - lh.addStaticHoliday ("12-DEC-2057", "MXN"); - - lh.addStaticHoliday ("25-DEC-2057", "MXN"); - - lh.addStaticHoliday ("01-JAN-2058", "MXN"); - - lh.addStaticHoliday ("04-FEB-2058", "MXN"); - - lh.addStaticHoliday ("18-MAR-2058", "MXN"); - - lh.addStaticHoliday ("11-APR-2058", "MXN"); - - lh.addStaticHoliday ("12-APR-2058", "MXN"); - - lh.addStaticHoliday ("01-MAY-2058", "MXN"); - - lh.addStaticHoliday ("16-SEP-2058", "MXN"); - - lh.addStaticHoliday ("18-NOV-2058", "MXN"); - - lh.addStaticHoliday ("12-DEC-2058", "MXN"); - - lh.addStaticHoliday ("25-DEC-2058", "MXN"); - - lh.addStaticHoliday ("01-JAN-2059", "MXN"); - - lh.addStaticHoliday ("03-FEB-2059", "MXN"); - - lh.addStaticHoliday ("17-MAR-2059", "MXN"); - - lh.addStaticHoliday ("27-MAR-2059", "MXN"); - - lh.addStaticHoliday ("28-MAR-2059", "MXN"); - - lh.addStaticHoliday ("01-MAY-2059", "MXN"); - - lh.addStaticHoliday ("16-SEP-2059", "MXN"); - - lh.addStaticHoliday ("17-NOV-2059", "MXN"); - - lh.addStaticHoliday ("12-DEC-2059", "MXN"); - - lh.addStaticHoliday ("25-DEC-2059", "MXN"); - - lh.addStaticHoliday ("01-JAN-2060", "MXN"); - - lh.addStaticHoliday ("02-FEB-2060", "MXN"); - - lh.addStaticHoliday ("15-MAR-2060", "MXN"); - - lh.addStaticHoliday ("15-APR-2060", "MXN"); - - lh.addStaticHoliday ("16-APR-2060", "MXN"); - - lh.addStaticHoliday ("16-SEP-2060", "MXN"); - - lh.addStaticHoliday ("02-NOV-2060", "MXN"); - - lh.addStaticHoliday ("15-NOV-2060", "MXN"); - - lh.addStaticHoliday ("01-DEC-2060", "MXN"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/MXVHoliday.java b/org/drip/analytics/holset/MXVHoliday.java deleted file mode 100644 index c68fb19..0000000 --- a/org/drip/analytics/holset/MXVHoliday.java +++ /dev/null @@ -1,1251 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class MXVHoliday implements org.drip.analytics.holset.LocationHoliday { - public MXVHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "MXV"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-1998", "Constitution Day"); - - lh.addStaticHoliday ("09-APR-1998", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-1998", "Puebla Battle Day"); - - lh.addStaticHoliday ("01-SEP-1998", "Presidential Report"); - - lh.addStaticHoliday ("16-SEP-1998", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-1998", "All Souls Day"); - - lh.addStaticHoliday ("20-NOV-1998", "Revolution Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-1999", "Constitution Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-MAY-1999", "Puebla Battle Day"); - - lh.addStaticHoliday ("01-SEP-1999", "Presidential Report"); - - lh.addStaticHoliday ("16-SEP-1999", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-1999", "All Souls Day"); - - lh.addStaticHoliday ("21-MAR-2000", "Juarezs Birthday"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2000", "Puebla Battle Day"); - - lh.addStaticHoliday ("01-SEP-2000", "Presidential Report"); - - lh.addStaticHoliday ("02-NOV-2000", "All Souls Day"); - - lh.addStaticHoliday ("20-NOV-2000", "Revolution Day"); - - lh.addStaticHoliday ("01-DEC-2000", "Presidential Succession Day"); - - lh.addStaticHoliday ("12-DEC-2000", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2001", "Constitution Day"); - - lh.addStaticHoliday ("21-MAR-2001", "Juarezs Birthday"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("02-NOV-2001", "All Souls Day"); - - lh.addStaticHoliday ("20-NOV-2001", "Revolution Day"); - - lh.addStaticHoliday ("12-DEC-2001", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2002", "Constitution Day"); - - lh.addStaticHoliday ("21-MAR-2002", "Juarezs Birthday"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("16-SEP-2002", "Independence Day"); - - lh.addStaticHoliday ("20-NOV-2002", "Revolution Day"); - - lh.addStaticHoliday ("12-DEC-2002", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2003", "Constitution Day"); - - lh.addStaticHoliday ("21-MAR-2003", "Juarezs Birthday"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2003", "Puebla Battle Day"); - - lh.addStaticHoliday ("16-SEP-2003", "Independence Day"); - - lh.addStaticHoliday ("20-NOV-2003", "Revolution Day"); - - lh.addStaticHoliday ("12-DEC-2003", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2004", "Constitution Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("05-MAY-2004", "Puebla Battle Day"); - - lh.addStaticHoliday ("16-SEP-2004", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2004", "All Souls Day"); - - lh.addStaticHoliday ("21-MAR-2005", "Juarezs Birthday"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("16-SEP-2005", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2005", "All Souls Day"); - - lh.addStaticHoliday ("12-DEC-2005", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("01-JAN-2006", "New Years Day"); - - lh.addStaticHoliday ("06-FEB-2006", "Dia de la Constitucion"); - - lh.addStaticHoliday ("21-MAR-2006", "Juarezs Birthday"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("16-SEP-2006", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2006", "All Souls Day"); - - lh.addStaticHoliday ("20-NOV-2006", "Revolution Day"); - - lh.addStaticHoliday ("01-DEC-2006", "Presidential Succession Day"); - - lh.addStaticHoliday ("12-DEC-2006", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2007", "Constitution Day"); - - lh.addStaticHoliday ("19-MAR-2007", "Juarezs Birthday"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("02-NOV-2007", "All Souls Day"); - - lh.addStaticHoliday ("19-NOV-2007", "Revolution Day"); - - lh.addStaticHoliday ("12-DEC-2007", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("04-FEB-2008", "Constitution Day"); - - lh.addStaticHoliday ("17-MAR-2008", "Juarezs Birthday"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("16-SEP-2008", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2008", "All Souls Day"); - - lh.addStaticHoliday ("17-NOV-2008", "Revolution Day"); - - lh.addStaticHoliday ("12-DEC-2008", "Our Lady of Guadalupe Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("02-FEB-2009", "Constitution Day"); - - lh.addStaticHoliday ("16-MAR-2009", "Juarezs Birthday"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("16-SEP-2009", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2009", "All Souls Day"); - - lh.addStaticHoliday ("16-NOV-2009", "Revolution Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "MXN"); - - lh.addStaticHoliday ("01-FEB-2010", "MXN"); - - lh.addStaticHoliday ("15-MAR-2010", "MXN"); - - lh.addStaticHoliday ("01-APR-2010", "MXN"); - - lh.addStaticHoliday ("02-APR-2010", "MXN"); - - lh.addStaticHoliday ("16-SEP-2010", "MXN"); - - lh.addStaticHoliday ("17-SEP-2010", "MXN"); - - lh.addStaticHoliday ("02-NOV-2010", "MXN"); - - lh.addStaticHoliday ("15-NOV-2010", "MXN"); - - lh.addStaticHoliday ("07-FEB-2011", "MXN"); - - lh.addStaticHoliday ("21-MAR-2011", "MXN"); - - lh.addStaticHoliday ("21-APR-2011", "MXN"); - - lh.addStaticHoliday ("22-APR-2011", "MXN"); - - lh.addStaticHoliday ("16-SEP-2011", "MXN"); - - lh.addStaticHoliday ("02-NOV-2011", "MXN"); - - lh.addStaticHoliday ("21-NOV-2011", "MXN"); - - lh.addStaticHoliday ("12-DEC-2011", "MXN"); - - lh.addStaticHoliday ("06-FEB-2012", "MXN"); - - lh.addStaticHoliday ("19-MAR-2012", "MXN"); - - lh.addStaticHoliday ("05-APR-2012", "MXN"); - - lh.addStaticHoliday ("06-APR-2012", "MXN"); - - lh.addStaticHoliday ("01-MAY-2012", "MXN"); - - lh.addStaticHoliday ("02-NOV-2012", "MXN"); - - lh.addStaticHoliday ("19-NOV-2012", "MXN"); - - lh.addStaticHoliday ("12-DEC-2012", "MXN"); - - lh.addStaticHoliday ("25-DEC-2012", "MXN"); - - lh.addStaticHoliday ("01-JAN-2013", "MXN"); - - lh.addStaticHoliday ("04-FEB-2013", "MXN"); - - lh.addStaticHoliday ("18-MAR-2013", "MXN"); - - lh.addStaticHoliday ("28-MAR-2013", "MXN"); - - lh.addStaticHoliday ("29-MAR-2013", "MXN"); - - lh.addStaticHoliday ("01-MAY-2013", "MXN"); - - lh.addStaticHoliday ("16-SEP-2013", "MXN"); - - lh.addStaticHoliday ("18-NOV-2013", "MXN"); - - lh.addStaticHoliday ("12-DEC-2013", "MXN"); - - lh.addStaticHoliday ("25-DEC-2013", "MXN"); - - lh.addStaticHoliday ("01-JAN-2014", "MXN"); - - lh.addStaticHoliday ("03-FEB-2014", "MXN"); - - lh.addStaticHoliday ("17-MAR-2014", "MXN"); - - lh.addStaticHoliday ("17-APR-2014", "MXN"); - - lh.addStaticHoliday ("18-APR-2014", "MXN"); - - lh.addStaticHoliday ("01-MAY-2014", "MXN"); - - lh.addStaticHoliday ("16-SEP-2014", "MXN"); - - lh.addStaticHoliday ("17-NOV-2014", "MXN"); - - lh.addStaticHoliday ("12-DEC-2014", "MXN"); - - lh.addStaticHoliday ("25-DEC-2014", "MXN"); - - lh.addStaticHoliday ("01-JAN-2015", "MXN"); - - lh.addStaticHoliday ("02-FEB-2015", "MXN"); - - lh.addStaticHoliday ("16-MAR-2015", "MXN"); - - lh.addStaticHoliday ("02-APR-2015", "MXN"); - - lh.addStaticHoliday ("03-APR-2015", "MXN"); - - lh.addStaticHoliday ("01-MAY-2015", "MXN"); - - lh.addStaticHoliday ("16-SEP-2015", "MXN"); - - lh.addStaticHoliday ("02-NOV-2015", "MXN"); - - lh.addStaticHoliday ("16-NOV-2015", "MXN"); - - lh.addStaticHoliday ("25-DEC-2015", "MXN"); - - lh.addStaticHoliday ("01-JAN-2016", "MXN"); - - lh.addStaticHoliday ("01-FEB-2016", "MXN"); - - lh.addStaticHoliday ("21-MAR-2016", "MXN"); - - lh.addStaticHoliday ("24-MAR-2016", "MXN"); - - lh.addStaticHoliday ("25-MAR-2016", "MXN"); - - lh.addStaticHoliday ("16-SEP-2016", "MXN"); - - lh.addStaticHoliday ("02-NOV-2016", "MXN"); - - lh.addStaticHoliday ("21-NOV-2016", "MXN"); - - lh.addStaticHoliday ("12-DEC-2016", "MXN"); - - lh.addStaticHoliday ("06-FEB-2017", "MXN"); - - lh.addStaticHoliday ("20-MAR-2017", "MXN"); - - lh.addStaticHoliday ("13-APR-2017", "MXN"); - - lh.addStaticHoliday ("14-APR-2017", "MXN"); - - lh.addStaticHoliday ("01-MAY-2017", "MXN"); - - lh.addStaticHoliday ("02-NOV-2017", "MXN"); - - lh.addStaticHoliday ("20-NOV-2017", "MXN"); - - lh.addStaticHoliday ("12-DEC-2017", "MXN"); - - lh.addStaticHoliday ("25-DEC-2017", "MXN"); - - lh.addStaticHoliday ("01-JAN-2018", "MXN"); - - lh.addStaticHoliday ("05-FEB-2018", "MXN"); - - lh.addStaticHoliday ("19-MAR-2018", "MXN"); - - lh.addStaticHoliday ("29-MAR-2018", "MXN"); - - lh.addStaticHoliday ("30-MAR-2018", "MXN"); - - lh.addStaticHoliday ("01-MAY-2018", "MXN"); - - lh.addStaticHoliday ("02-NOV-2018", "MXN"); - - lh.addStaticHoliday ("19-NOV-2018", "MXN"); - - lh.addStaticHoliday ("12-DEC-2018", "MXN"); - - lh.addStaticHoliday ("25-DEC-2018", "MXN"); - - lh.addStaticHoliday ("01-JAN-2019", "MXN"); - - lh.addStaticHoliday ("04-FEB-2019", "MXN"); - - lh.addStaticHoliday ("18-MAR-2019", "MXN"); - - lh.addStaticHoliday ("18-APR-2019", "MXN"); - - lh.addStaticHoliday ("19-APR-2019", "MXN"); - - lh.addStaticHoliday ("01-MAY-2019", "MXN"); - - lh.addStaticHoliday ("16-SEP-2019", "MXN"); - - lh.addStaticHoliday ("18-NOV-2019", "MXN"); - - lh.addStaticHoliday ("12-DEC-2019", "MXN"); - - lh.addStaticHoliday ("25-DEC-2019", "MXN"); - - lh.addStaticHoliday ("01-JAN-2020", "MXN"); - - lh.addStaticHoliday ("03-FEB-2020", "MXN"); - - lh.addStaticHoliday ("16-MAR-2020", "MXN"); - - lh.addStaticHoliday ("09-APR-2020", "MXN"); - - lh.addStaticHoliday ("10-APR-2020", "MXN"); - - lh.addStaticHoliday ("01-MAY-2020", "MXN"); - - lh.addStaticHoliday ("16-SEP-2020", "MXN"); - - lh.addStaticHoliday ("02-NOV-2020", "MXN"); - - lh.addStaticHoliday ("16-NOV-2020", "MXN"); - - lh.addStaticHoliday ("25-DEC-2020", "MXN"); - - lh.addStaticHoliday ("01-JAN-2021", "MXN"); - - lh.addStaticHoliday ("01-FEB-2021", "MXN"); - - lh.addStaticHoliday ("15-MAR-2021", "MXN"); - - lh.addStaticHoliday ("01-APR-2021", "MXN"); - - lh.addStaticHoliday ("02-APR-2021", "MXN"); - - lh.addStaticHoliday ("16-SEP-2021", "MXN"); - - lh.addStaticHoliday ("02-NOV-2021", "MXN"); - - lh.addStaticHoliday ("15-NOV-2021", "MXN"); - - lh.addStaticHoliday ("07-FEB-2022", "MXN"); - - lh.addStaticHoliday ("21-MAR-2022", "MXN"); - - lh.addStaticHoliday ("14-APR-2022", "MXN"); - - lh.addStaticHoliday ("15-APR-2022", "MXN"); - - lh.addStaticHoliday ("16-SEP-2022", "MXN"); - - lh.addStaticHoliday ("02-NOV-2022", "MXN"); - - lh.addStaticHoliday ("21-NOV-2022", "MXN"); - - lh.addStaticHoliday ("12-DEC-2022", "MXN"); - - lh.addStaticHoliday ("06-FEB-2023", "MXN"); - - lh.addStaticHoliday ("20-MAR-2023", "MXN"); - - lh.addStaticHoliday ("06-APR-2023", "MXN"); - - lh.addStaticHoliday ("07-APR-2023", "MXN"); - - lh.addStaticHoliday ("01-MAY-2023", "MXN"); - - lh.addStaticHoliday ("02-NOV-2023", "MXN"); - - lh.addStaticHoliday ("20-NOV-2023", "MXN"); - - lh.addStaticHoliday ("12-DEC-2023", "MXN"); - - lh.addStaticHoliday ("25-DEC-2023", "MXN"); - - lh.addStaticHoliday ("01-JAN-2024", "MXN"); - - lh.addStaticHoliday ("05-FEB-2024", "MXN"); - - lh.addStaticHoliday ("18-MAR-2024", "MXN"); - - lh.addStaticHoliday ("28-MAR-2024", "MXN"); - - lh.addStaticHoliday ("29-MAR-2024", "MXN"); - - lh.addStaticHoliday ("01-MAY-2024", "MXN"); - - lh.addStaticHoliday ("16-SEP-2024", "MXN"); - - lh.addStaticHoliday ("18-NOV-2024", "MXN"); - - lh.addStaticHoliday ("12-DEC-2024", "MXN"); - - lh.addStaticHoliday ("25-DEC-2024", "MXN"); - - lh.addStaticHoliday ("01-JAN-2025", "MXN"); - - lh.addStaticHoliday ("03-FEB-2025", "MXN"); - - lh.addStaticHoliday ("17-MAR-2025", "MXN"); - - lh.addStaticHoliday ("17-APR-2025", "MXN"); - - lh.addStaticHoliday ("18-APR-2025", "MXN"); - - lh.addStaticHoliday ("01-MAY-2025", "MXN"); - - lh.addStaticHoliday ("16-SEP-2025", "MXN"); - - lh.addStaticHoliday ("17-NOV-2025", "MXN"); - - lh.addStaticHoliday ("12-DEC-2025", "MXN"); - - lh.addStaticHoliday ("25-DEC-2025", "MXN"); - - lh.addStaticHoliday ("01-JAN-2026", "MXN"); - - lh.addStaticHoliday ("02-FEB-2026", "MXN"); - - lh.addStaticHoliday ("16-MAR-2026", "MXN"); - - lh.addStaticHoliday ("02-APR-2026", "MXN"); - - lh.addStaticHoliday ("03-APR-2026", "MXN"); - - lh.addStaticHoliday ("01-MAY-2026", "MXN"); - - lh.addStaticHoliday ("16-SEP-2026", "MXN"); - - lh.addStaticHoliday ("02-NOV-2026", "MXN"); - - lh.addStaticHoliday ("16-NOV-2026", "MXN"); - - lh.addStaticHoliday ("25-DEC-2026", "MXN"); - - lh.addStaticHoliday ("01-JAN-2027", "MXN"); - - lh.addStaticHoliday ("01-FEB-2027", "MXN"); - - lh.addStaticHoliday ("15-MAR-2027", "MXN"); - - lh.addStaticHoliday ("25-MAR-2027", "MXN"); - - lh.addStaticHoliday ("26-MAR-2027", "MXN"); - - lh.addStaticHoliday ("16-SEP-2027", "MXN"); - - lh.addStaticHoliday ("02-NOV-2027", "MXN"); - - lh.addStaticHoliday ("15-NOV-2027", "MXN"); - - lh.addStaticHoliday ("07-FEB-2028", "MXN"); - - lh.addStaticHoliday ("20-MAR-2028", "MXN"); - - lh.addStaticHoliday ("13-APR-2028", "MXN"); - - lh.addStaticHoliday ("14-APR-2028", "MXN"); - - lh.addStaticHoliday ("01-MAY-2028", "MXN"); - - lh.addStaticHoliday ("02-NOV-2028", "MXN"); - - lh.addStaticHoliday ("20-NOV-2028", "MXN"); - - lh.addStaticHoliday ("12-DEC-2028", "MXN"); - - lh.addStaticHoliday ("25-DEC-2028", "MXN"); - - lh.addStaticHoliday ("01-JAN-2029", "MXN"); - - lh.addStaticHoliday ("05-FEB-2029", "MXN"); - - lh.addStaticHoliday ("19-MAR-2029", "MXN"); - - lh.addStaticHoliday ("29-MAR-2029", "MXN"); - - lh.addStaticHoliday ("30-MAR-2029", "MXN"); - - lh.addStaticHoliday ("01-MAY-2029", "MXN"); - - lh.addStaticHoliday ("02-NOV-2029", "MXN"); - - lh.addStaticHoliday ("19-NOV-2029", "MXN"); - - lh.addStaticHoliday ("12-DEC-2029", "MXN"); - - lh.addStaticHoliday ("25-DEC-2029", "MXN"); - - lh.addStaticHoliday ("01-JAN-2030", "MXN"); - - lh.addStaticHoliday ("04-FEB-2030", "MXN"); - - lh.addStaticHoliday ("18-MAR-2030", "MXN"); - - lh.addStaticHoliday ("18-APR-2030", "MXN"); - - lh.addStaticHoliday ("19-APR-2030", "MXN"); - - lh.addStaticHoliday ("01-MAY-2030", "MXN"); - - lh.addStaticHoliday ("16-SEP-2030", "MXN"); - - lh.addStaticHoliday ("18-NOV-2030", "MXN"); - - lh.addStaticHoliday ("12-DEC-2030", "MXN"); - - lh.addStaticHoliday ("25-DEC-2030", "MXN"); - - lh.addStaticHoliday ("01-JAN-2031", "MXN"); - - lh.addStaticHoliday ("03-FEB-2031", "MXN"); - - lh.addStaticHoliday ("17-MAR-2031", "MXN"); - - lh.addStaticHoliday ("10-APR-2031", "MXN"); - - lh.addStaticHoliday ("11-APR-2031", "MXN"); - - lh.addStaticHoliday ("01-MAY-2031", "MXN"); - - lh.addStaticHoliday ("16-SEP-2031", "MXN"); - - lh.addStaticHoliday ("17-NOV-2031", "MXN"); - - lh.addStaticHoliday ("12-DEC-2031", "MXN"); - - lh.addStaticHoliday ("25-DEC-2031", "MXN"); - - lh.addStaticHoliday ("01-JAN-2032", "MXN"); - - lh.addStaticHoliday ("02-FEB-2032", "MXN"); - - lh.addStaticHoliday ("15-MAR-2032", "MXN"); - - lh.addStaticHoliday ("25-MAR-2032", "MXN"); - - lh.addStaticHoliday ("26-MAR-2032", "MXN"); - - lh.addStaticHoliday ("16-SEP-2032", "MXN"); - - lh.addStaticHoliday ("02-NOV-2032", "MXN"); - - lh.addStaticHoliday ("15-NOV-2032", "MXN"); - - lh.addStaticHoliday ("07-FEB-2033", "MXN"); - - lh.addStaticHoliday ("21-MAR-2033", "MXN"); - - lh.addStaticHoliday ("14-APR-2033", "MXN"); - - lh.addStaticHoliday ("15-APR-2033", "MXN"); - - lh.addStaticHoliday ("16-SEP-2033", "MXN"); - - lh.addStaticHoliday ("02-NOV-2033", "MXN"); - - lh.addStaticHoliday ("21-NOV-2033", "MXN"); - - lh.addStaticHoliday ("12-DEC-2033", "MXN"); - - lh.addStaticHoliday ("06-FEB-2034", "MXN"); - - lh.addStaticHoliday ("20-MAR-2034", "MXN"); - - lh.addStaticHoliday ("06-APR-2034", "MXN"); - - lh.addStaticHoliday ("07-APR-2034", "MXN"); - - lh.addStaticHoliday ("01-MAY-2034", "MXN"); - - lh.addStaticHoliday ("02-NOV-2034", "MXN"); - - lh.addStaticHoliday ("20-NOV-2034", "MXN"); - - lh.addStaticHoliday ("12-DEC-2034", "MXN"); - - lh.addStaticHoliday ("25-DEC-2034", "MXN"); - - lh.addStaticHoliday ("01-JAN-2035", "MXN"); - - lh.addStaticHoliday ("05-FEB-2035", "MXN"); - - lh.addStaticHoliday ("19-MAR-2035", "MXN"); - - lh.addStaticHoliday ("22-MAR-2035", "MXN"); - - lh.addStaticHoliday ("23-MAR-2035", "MXN"); - - lh.addStaticHoliday ("01-MAY-2035", "MXN"); - - lh.addStaticHoliday ("02-NOV-2035", "MXN"); - - lh.addStaticHoliday ("19-NOV-2035", "MXN"); - - lh.addStaticHoliday ("12-DEC-2035", "MXN"); - - lh.addStaticHoliday ("25-DEC-2035", "MXN"); - - lh.addStaticHoliday ("01-JAN-2036", "MXN"); - - lh.addStaticHoliday ("04-FEB-2036", "MXN"); - - lh.addStaticHoliday ("17-MAR-2036", "MXN"); - - lh.addStaticHoliday ("10-APR-2036", "MXN"); - - lh.addStaticHoliday ("11-APR-2036", "MXN"); - - lh.addStaticHoliday ("01-MAY-2036", "MXN"); - - lh.addStaticHoliday ("16-SEP-2036", "MXN"); - - lh.addStaticHoliday ("17-NOV-2036", "MXN"); - - lh.addStaticHoliday ("01-DEC-2036", "MXN"); - - lh.addStaticHoliday ("12-DEC-2036", "MXN"); - - lh.addStaticHoliday ("25-DEC-2036", "MXN"); - - lh.addStaticHoliday ("01-JAN-2037", "MXN"); - - lh.addStaticHoliday ("02-FEB-2037", "MXN"); - - lh.addStaticHoliday ("16-MAR-2037", "MXN"); - - lh.addStaticHoliday ("02-APR-2037", "MXN"); - - lh.addStaticHoliday ("03-APR-2037", "MXN"); - - lh.addStaticHoliday ("01-MAY-2037", "MXN"); - - lh.addStaticHoliday ("16-SEP-2037", "MXN"); - - lh.addStaticHoliday ("02-NOV-2037", "MXN"); - - lh.addStaticHoliday ("16-NOV-2037", "MXN"); - - lh.addStaticHoliday ("25-DEC-2037", "MXN"); - - lh.addStaticHoliday ("01-JAN-2038", "MXN"); - - lh.addStaticHoliday ("01-FEB-2038", "MXN"); - - lh.addStaticHoliday ("15-MAR-2038", "MXN"); - - lh.addStaticHoliday ("22-APR-2038", "MXN"); - - lh.addStaticHoliday ("23-APR-2038", "MXN"); - - lh.addStaticHoliday ("16-SEP-2038", "MXN"); - - lh.addStaticHoliday ("02-NOV-2038", "MXN"); - - lh.addStaticHoliday ("15-NOV-2038", "MXN"); - - lh.addStaticHoliday ("07-FEB-2039", "MXN"); - - lh.addStaticHoliday ("21-MAR-2039", "MXN"); - - lh.addStaticHoliday ("07-APR-2039", "MXN"); - - lh.addStaticHoliday ("08-APR-2039", "MXN"); - - lh.addStaticHoliday ("16-SEP-2039", "MXN"); - - lh.addStaticHoliday ("02-NOV-2039", "MXN"); - - lh.addStaticHoliday ("21-NOV-2039", "MXN"); - - lh.addStaticHoliday ("12-DEC-2039", "MXN"); - - lh.addStaticHoliday ("06-FEB-2040", "MXN"); - - lh.addStaticHoliday ("19-MAR-2040", "MXN"); - - lh.addStaticHoliday ("29-MAR-2040", "MXN"); - - lh.addStaticHoliday ("30-MAR-2040", "MXN"); - - lh.addStaticHoliday ("01-MAY-2040", "MXN"); - - lh.addStaticHoliday ("02-NOV-2040", "MXN"); - - lh.addStaticHoliday ("19-NOV-2040", "MXN"); - - lh.addStaticHoliday ("12-DEC-2040", "MXN"); - - lh.addStaticHoliday ("25-DEC-2040", "MXN"); - - lh.addStaticHoliday ("01-JAN-2041", "MXN"); - - lh.addStaticHoliday ("04-FEB-2041", "MXN"); - - lh.addStaticHoliday ("18-MAR-2041", "MXN"); - - lh.addStaticHoliday ("18-APR-2041", "MXN"); - - lh.addStaticHoliday ("19-APR-2041", "MXN"); - - lh.addStaticHoliday ("01-MAY-2041", "MXN"); - - lh.addStaticHoliday ("16-SEP-2041", "MXN"); - - lh.addStaticHoliday ("18-NOV-2041", "MXN"); - - lh.addStaticHoliday ("12-DEC-2041", "MXN"); - - lh.addStaticHoliday ("25-DEC-2041", "MXN"); - - lh.addStaticHoliday ("01-JAN-2042", "MXN"); - - lh.addStaticHoliday ("03-FEB-2042", "MXN"); - - lh.addStaticHoliday ("17-MAR-2042", "MXN"); - - lh.addStaticHoliday ("03-APR-2042", "MXN"); - - lh.addStaticHoliday ("04-APR-2042", "MXN"); - - lh.addStaticHoliday ("01-MAY-2042", "MXN"); - - lh.addStaticHoliday ("16-SEP-2042", "MXN"); - - lh.addStaticHoliday ("17-NOV-2042", "MXN"); - - lh.addStaticHoliday ("01-DEC-2042", "MXN"); - - lh.addStaticHoliday ("12-DEC-2042", "MXN"); - - lh.addStaticHoliday ("25-DEC-2042", "MXN"); - - lh.addStaticHoliday ("01-JAN-2043", "MXN"); - - lh.addStaticHoliday ("02-FEB-2043", "MXN"); - - lh.addStaticHoliday ("16-MAR-2043", "MXN"); - - lh.addStaticHoliday ("26-MAR-2043", "MXN"); - - lh.addStaticHoliday ("27-MAR-2043", "MXN"); - - lh.addStaticHoliday ("01-MAY-2043", "MXN"); - - lh.addStaticHoliday ("16-SEP-2043", "MXN"); - - lh.addStaticHoliday ("02-NOV-2043", "MXN"); - - lh.addStaticHoliday ("16-NOV-2043", "MXN"); - - lh.addStaticHoliday ("25-DEC-2043", "MXN"); - - lh.addStaticHoliday ("01-JAN-2044", "MXN"); - - lh.addStaticHoliday ("01-FEB-2044", "MXN"); - - lh.addStaticHoliday ("21-MAR-2044", "MXN"); - - lh.addStaticHoliday ("14-APR-2044", "MXN"); - - lh.addStaticHoliday ("15-APR-2044", "MXN"); - - lh.addStaticHoliday ("16-SEP-2044", "MXN"); - - lh.addStaticHoliday ("02-NOV-2044", "MXN"); - - lh.addStaticHoliday ("21-NOV-2044", "MXN"); - - lh.addStaticHoliday ("12-DEC-2044", "MXN"); - - lh.addStaticHoliday ("06-FEB-2045", "MXN"); - - lh.addStaticHoliday ("20-MAR-2045", "MXN"); - - lh.addStaticHoliday ("06-APR-2045", "MXN"); - - lh.addStaticHoliday ("07-APR-2045", "MXN"); - - lh.addStaticHoliday ("01-MAY-2045", "MXN"); - - lh.addStaticHoliday ("02-NOV-2045", "MXN"); - - lh.addStaticHoliday ("20-NOV-2045", "MXN"); - - lh.addStaticHoliday ("12-DEC-2045", "MXN"); - - lh.addStaticHoliday ("25-DEC-2045", "MXN"); - - lh.addStaticHoliday ("01-JAN-2046", "MXN"); - - lh.addStaticHoliday ("05-FEB-2046", "MXN"); - - lh.addStaticHoliday ("19-MAR-2046", "MXN"); - - lh.addStaticHoliday ("22-MAR-2046", "MXN"); - - lh.addStaticHoliday ("23-MAR-2046", "MXN"); - - lh.addStaticHoliday ("01-MAY-2046", "MXN"); - - lh.addStaticHoliday ("02-NOV-2046", "MXN"); - - lh.addStaticHoliday ("19-NOV-2046", "MXN"); - - lh.addStaticHoliday ("12-DEC-2046", "MXN"); - - lh.addStaticHoliday ("25-DEC-2046", "MXN"); - - lh.addStaticHoliday ("01-JAN-2047", "MXN"); - - lh.addStaticHoliday ("04-FEB-2047", "MXN"); - - lh.addStaticHoliday ("18-MAR-2047", "MXN"); - - lh.addStaticHoliday ("11-APR-2047", "MXN"); - - lh.addStaticHoliday ("12-APR-2047", "MXN"); - - lh.addStaticHoliday ("01-MAY-2047", "MXN"); - - lh.addStaticHoliday ("16-SEP-2047", "MXN"); - - lh.addStaticHoliday ("18-NOV-2047", "MXN"); - - lh.addStaticHoliday ("12-DEC-2047", "MXN"); - - lh.addStaticHoliday ("25-DEC-2047", "MXN"); - - lh.addStaticHoliday ("01-JAN-2048", "MXN"); - - lh.addStaticHoliday ("03-FEB-2048", "MXN"); - - lh.addStaticHoliday ("16-MAR-2048", "MXN"); - - lh.addStaticHoliday ("02-APR-2048", "MXN"); - - lh.addStaticHoliday ("03-APR-2048", "MXN"); - - lh.addStaticHoliday ("01-MAY-2048", "MXN"); - - lh.addStaticHoliday ("16-SEP-2048", "MXN"); - - lh.addStaticHoliday ("02-NOV-2048", "MXN"); - - lh.addStaticHoliday ("16-NOV-2048", "MXN"); - - lh.addStaticHoliday ("01-DEC-2048", "MXN"); - - lh.addStaticHoliday ("25-DEC-2048", "MXN"); - - lh.addStaticHoliday ("01-JAN-2049", "MXN"); - - lh.addStaticHoliday ("01-FEB-2049", "MXN"); - - lh.addStaticHoliday ("15-MAR-2049", "MXN"); - - lh.addStaticHoliday ("15-APR-2049", "MXN"); - - lh.addStaticHoliday ("16-APR-2049", "MXN"); - - lh.addStaticHoliday ("16-SEP-2049", "MXN"); - - lh.addStaticHoliday ("02-NOV-2049", "MXN"); - - lh.addStaticHoliday ("15-NOV-2049", "MXN"); - - lh.addStaticHoliday ("07-FEB-2050", "MXN"); - - lh.addStaticHoliday ("21-MAR-2050", "MXN"); - - lh.addStaticHoliday ("07-APR-2050", "MXN"); - - lh.addStaticHoliday ("08-APR-2050", "MXN"); - - lh.addStaticHoliday ("16-SEP-2050", "MXN"); - - lh.addStaticHoliday ("02-NOV-2050", "MXN"); - - lh.addStaticHoliday ("21-NOV-2050", "MXN"); - - lh.addStaticHoliday ("12-DEC-2050", "MXN"); - - lh.addStaticHoliday ("06-FEB-2051", "MXN"); - - lh.addStaticHoliday ("20-MAR-2051", "MXN"); - - lh.addStaticHoliday ("30-MAR-2051", "MXN"); - - lh.addStaticHoliday ("31-MAR-2051", "MXN"); - - lh.addStaticHoliday ("01-MAY-2051", "MXN"); - - lh.addStaticHoliday ("02-NOV-2051", "MXN"); - - lh.addStaticHoliday ("20-NOV-2051", "MXN"); - - lh.addStaticHoliday ("12-DEC-2051", "MXN"); - - lh.addStaticHoliday ("25-DEC-2051", "MXN"); - - lh.addStaticHoliday ("01-JAN-2052", "MXN"); - - lh.addStaticHoliday ("05-FEB-2052", "MXN"); - - lh.addStaticHoliday ("18-MAR-2052", "MXN"); - - lh.addStaticHoliday ("18-APR-2052", "MXN"); - - lh.addStaticHoliday ("19-APR-2052", "MXN"); - - lh.addStaticHoliday ("01-MAY-2052", "MXN"); - - lh.addStaticHoliday ("16-SEP-2052", "MXN"); - - lh.addStaticHoliday ("18-NOV-2052", "MXN"); - - lh.addStaticHoliday ("12-DEC-2052", "MXN"); - - lh.addStaticHoliday ("25-DEC-2052", "MXN"); - - lh.addStaticHoliday ("01-JAN-2053", "MXN"); - - lh.addStaticHoliday ("03-FEB-2053", "MXN"); - - lh.addStaticHoliday ("17-MAR-2053", "MXN"); - - lh.addStaticHoliday ("03-APR-2053", "MXN"); - - lh.addStaticHoliday ("04-APR-2053", "MXN"); - - lh.addStaticHoliday ("01-MAY-2053", "MXN"); - - lh.addStaticHoliday ("16-SEP-2053", "MXN"); - - lh.addStaticHoliday ("17-NOV-2053", "MXN"); - - lh.addStaticHoliday ("12-DEC-2053", "MXN"); - - lh.addStaticHoliday ("25-DEC-2053", "MXN"); - - lh.addStaticHoliday ("01-JAN-2054", "MXN"); - - lh.addStaticHoliday ("02-FEB-2054", "MXN"); - - lh.addStaticHoliday ("16-MAR-2054", "MXN"); - - lh.addStaticHoliday ("26-MAR-2054", "MXN"); - - lh.addStaticHoliday ("27-MAR-2054", "MXN"); - - lh.addStaticHoliday ("01-MAY-2054", "MXN"); - - lh.addStaticHoliday ("16-SEP-2054", "MXN"); - - lh.addStaticHoliday ("02-NOV-2054", "MXN"); - - lh.addStaticHoliday ("16-NOV-2054", "MXN"); - - lh.addStaticHoliday ("01-DEC-2054", "MXN"); - - lh.addStaticHoliday ("25-DEC-2054", "MXN"); - - lh.addStaticHoliday ("01-JAN-2055", "MXN"); - - lh.addStaticHoliday ("01-FEB-2055", "MXN"); - - lh.addStaticHoliday ("15-MAR-2055", "MXN"); - - lh.addStaticHoliday ("15-APR-2055", "MXN"); - - lh.addStaticHoliday ("16-APR-2055", "MXN"); - - lh.addStaticHoliday ("16-SEP-2055", "MXN"); - - lh.addStaticHoliday ("02-NOV-2055", "MXN"); - - lh.addStaticHoliday ("15-NOV-2055", "MXN"); - - lh.addStaticHoliday ("07-FEB-2056", "MXN"); - - lh.addStaticHoliday ("20-MAR-2056", "MXN"); - - lh.addStaticHoliday ("30-MAR-2056", "MXN"); - - lh.addStaticHoliday ("31-MAR-2056", "MXN"); - - lh.addStaticHoliday ("01-MAY-2056", "MXN"); - - lh.addStaticHoliday ("02-NOV-2056", "MXN"); - - lh.addStaticHoliday ("20-NOV-2056", "MXN"); - - lh.addStaticHoliday ("12-DEC-2056", "MXN"); - - lh.addStaticHoliday ("25-DEC-2056", "MXN"); - - lh.addStaticHoliday ("01-JAN-2057", "MXN"); - - lh.addStaticHoliday ("05-FEB-2057", "MXN"); - - lh.addStaticHoliday ("19-MAR-2057", "MXN"); - - lh.addStaticHoliday ("19-APR-2057", "MXN"); - - lh.addStaticHoliday ("20-APR-2057", "MXN"); - - lh.addStaticHoliday ("01-MAY-2057", "MXN"); - - lh.addStaticHoliday ("02-NOV-2057", "MXN"); - - lh.addStaticHoliday ("19-NOV-2057", "MXN"); - - lh.addStaticHoliday ("12-DEC-2057", "MXN"); - - lh.addStaticHoliday ("25-DEC-2057", "MXN"); - - lh.addStaticHoliday ("01-JAN-2058", "MXN"); - - lh.addStaticHoliday ("04-FEB-2058", "MXN"); - - lh.addStaticHoliday ("18-MAR-2058", "MXN"); - - lh.addStaticHoliday ("11-APR-2058", "MXN"); - - lh.addStaticHoliday ("12-APR-2058", "MXN"); - - lh.addStaticHoliday ("01-MAY-2058", "MXN"); - - lh.addStaticHoliday ("16-SEP-2058", "MXN"); - - lh.addStaticHoliday ("18-NOV-2058", "MXN"); - - lh.addStaticHoliday ("12-DEC-2058", "MXN"); - - lh.addStaticHoliday ("25-DEC-2058", "MXN"); - - lh.addStaticHoliday ("01-JAN-2059", "MXN"); - - lh.addStaticHoliday ("03-FEB-2059", "MXN"); - - lh.addStaticHoliday ("17-MAR-2059", "MXN"); - - lh.addStaticHoliday ("27-MAR-2059", "MXN"); - - lh.addStaticHoliday ("28-MAR-2059", "MXN"); - - lh.addStaticHoliday ("01-MAY-2059", "MXN"); - - lh.addStaticHoliday ("16-SEP-2059", "MXN"); - - lh.addStaticHoliday ("17-NOV-2059", "MXN"); - - lh.addStaticHoliday ("12-DEC-2059", "MXN"); - - lh.addStaticHoliday ("25-DEC-2059", "MXN"); - - lh.addStaticHoliday ("01-JAN-2060", "MXN"); - - lh.addStaticHoliday ("02-FEB-2060", "MXN"); - - lh.addStaticHoliday ("15-MAR-2060", "MXN"); - - lh.addStaticHoliday ("15-APR-2060", "MXN"); - - lh.addStaticHoliday ("16-APR-2060", "MXN"); - - lh.addStaticHoliday ("16-SEP-2060", "MXN"); - - lh.addStaticHoliday ("02-NOV-2060", "MXN"); - - lh.addStaticHoliday ("15-NOV-2060", "MXN"); - - lh.addStaticHoliday ("01-DEC-2060", "MXN"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/MYRHoliday.java b/org/drip/analytics/holset/MYRHoliday.java deleted file mode 100644 index e9c3633..0000000 --- a/org/drip/analytics/holset/MYRHoliday.java +++ /dev/null @@ -1,1849 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class MYRHoliday implements org.drip.analytics.holset.LocationHoliday { - public MYRHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "MYR"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-1999", "Hari Raya Puasa"); - - lh.addStaticHoliday ("20-JAN-1999", "Hari Raya Puasa"); - - lh.addStaticHoliday ("01-FEB-1999", "Federal Territory Day"); - - lh.addStaticHoliday ("16-FEB-1999", "Chinese New Year"); - - lh.addStaticHoliday ("17-FEB-1999", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("29-MAR-1999", "Hari Raya Qurban Observed"); - - lh.addStaticHoliday ("17-APR-1999", "First Day of Muharram"); - - lh.addStaticHoliday ("01-MAY-1999", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-1999", "Wesak Day"); - - lh.addStaticHoliday ("05-JUN-1999", "Birthday of His Majesty Yang Di Pertuan Agong"); - - lh.addStaticHoliday ("26-JUN-1999", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("31-AUG-1999", "National Day"); - - lh.addStaticHoliday ("08-NOV-1999", "Deepavali Observed"); - - lh.addStaticHoliday ("29-NOV-1999", "Election Day"); - - lh.addStaticHoliday ("25-DEC-1999", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-1999", "Special Holiday"); - - lh.addStaticHoliday ("01-JAN-2000", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2000", "Hari Raya Puasa"); - - lh.addStaticHoliday ("10-JAN-2000", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("01-FEB-2000", "Federal Territory Day"); - - lh.addStaticHoliday ("05-FEB-2000", "Chinese New Year"); - - lh.addStaticHoliday ("07-FEB-2000", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("16-MAR-2000", "Hari Raya Qurban"); - - lh.addStaticHoliday ("06-APR-2000", "First Day of Muharram"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("18-MAY-2000", "Wesak Day"); - - lh.addStaticHoliday ("03-JUN-2000", "Birthday of His Majesty Yang Di Pertuan Agong"); - - lh.addStaticHoliday ("15-JUN-2000", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("31-AUG-2000", "National Day"); - - lh.addStaticHoliday ("26-OCT-2000", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("27-DEC-2000", "Hari Raya Puasa"); - - lh.addStaticHoliday ("28-DEC-2000", "Hari Raya Puasa"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("24-JAN-2001", "Chinese New Year"); - - lh.addStaticHoliday ("25-JAN-2001", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("01-FEB-2001", "Federal Territory Day"); - - lh.addStaticHoliday ("06-MAR-2001", "Hari Raya Qurban"); - - lh.addStaticHoliday ("26-MAR-2001", "First Day of Muharram"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("07-MAY-2001", "Wesak Day"); - - lh.addStaticHoliday ("02-JUN-2001", "Birthday of His Majesty Yang Di Pertuan Agong"); - - lh.addStaticHoliday ("04-JUN-2001", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("31-AUG-2001", "National Day"); - - lh.addStaticHoliday ("22-SEP-2001", "National Holiday"); - - lh.addStaticHoliday ("14-NOV-2001", "Deepavali"); - - lh.addStaticHoliday ("22-NOV-2001", "Special Holiday"); - - lh.addStaticHoliday ("17-DEC-2001", "Hari Raya Puasa"); - - lh.addStaticHoliday ("18-DEC-2001", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("01-FEB-2002", "Federal Territory Day"); - - lh.addStaticHoliday ("12-FEB-2002", "Chinese New Year"); - - lh.addStaticHoliday ("13-FEB-2002", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("23-FEB-2002", "Hari Raya Qurban"); - - lh.addStaticHoliday ("15-MAR-2002", "First Day of Muharram"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2002", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("27-MAY-2002", "Wesak Day Observed"); - - lh.addStaticHoliday ("01-JUN-2002", "Birthday of His Majesty Yang Di Pertuan Agong"); - - lh.addStaticHoliday ("31-AUG-2002", "National Day"); - - lh.addStaticHoliday ("04-NOV-2002", "Deepavali"); - - lh.addStaticHoliday ("06-DEC-2002", "Hari Raya Puasa"); - - lh.addStaticHoliday ("07-DEC-2002", "Hari Raya Puasa"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("01-FEB-2003", "Federal Territory Day"); - - lh.addStaticHoliday ("03-FEB-2003", "Chinese New Year Observed"); - - lh.addStaticHoliday ("04-FEB-2003", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("12-FEB-2003", "Hari Raya Qurban"); - - lh.addStaticHoliday ("04-MAR-2003", "First Day of Muharram"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("14-MAY-2003", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("15-MAY-2003", "Wesak Day"); - - lh.addStaticHoliday ("07-JUN-2003", "Birthday of His Majesty Yang Di Pertuan Agong"); - - lh.addStaticHoliday ("01-SEP-2003", "National Day Observed"); - - lh.addStaticHoliday ("24-OCT-2003", "Deepavali"); - - lh.addStaticHoliday ("25-NOV-2003", "Hari Raya Puasa"); - - lh.addStaticHoliday ("26-NOV-2003", "Hari Raya Puasa"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("22-JAN-2004", "Chinese New Year"); - - lh.addStaticHoliday ("23-JAN-2004", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("02-FEB-2004", "Federal Territory Day Observed"); - - lh.addStaticHoliday ("03-FEB-2004", "Hari Raya Qurban Observed"); - - lh.addStaticHoliday ("23-FEB-2004", "First Day of Muharram Observed"); - - lh.addStaticHoliday ("01-MAY-2004", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2004", "Wesak Day"); - - lh.addStaticHoliday ("04-MAY-2004", "Prophet Muhammads Birthday Observed"); - - lh.addStaticHoliday ("05-JUN-2004", "Birthday of His Majesty Yang Di Pertuan Agong"); - - lh.addStaticHoliday ("31-AUG-2004", "National Day"); - - lh.addStaticHoliday ("11-NOV-2004", "Deepavali"); - - lh.addStaticHoliday ("15-NOV-2004", "Hari Raya Puasa"); - - lh.addStaticHoliday ("16-NOV-2004", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("25-DEC-2004", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2005", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2005", "Hari Raya Qurban"); - - lh.addStaticHoliday ("01-FEB-2005", "Federal Territory Day"); - - lh.addStaticHoliday ("09-FEB-2005", "Chinese New Year"); - - lh.addStaticHoliday ("10-FEB-2005", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("11-FEB-2005", "First Day of Muharram Observed"); - - lh.addStaticHoliday ("21-APR-2005", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("02-MAY-2005", "Labour Day Observed"); - - lh.addStaticHoliday ("23-MAY-2005", "Wesak Day Observed"); - - lh.addStaticHoliday ("04-JUN-2005", "Birthday of His Majesty Yang Di Pertuan Agong"); - - lh.addStaticHoliday ("31-AUG-2005", "National Day"); - - lh.addStaticHoliday ("01-NOV-2005", "Deepavali"); - - lh.addStaticHoliday ("03-NOV-2005", "Hari Raya Puasa"); - - lh.addStaticHoliday ("04-NOV-2005", "Hari Raya Puasa"); - - lh.addStaticHoliday ("26-DEC-2005", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("10-JAN-2006", "Hari Raya Qurban"); - - lh.addStaticHoliday ("30-JAN-2006", "Chinese New Year Observed"); - - lh.addStaticHoliday ("31-JAN-2006", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("01-FEB-2006", "Federal Territory Day"); - - lh.addStaticHoliday ("02-FEB-2006", "First Day of Muharram Observed"); - - lh.addStaticHoliday ("11-APR-2006", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("12-MAY-2006", "Wesak Day"); - - lh.addStaticHoliday ("31-AUG-2006", "National Day"); - - lh.addStaticHoliday ("23-OCT-2006", "Bank Holiday"); - - lh.addStaticHoliday ("24-OCT-2006", "Hari Raya Puasa"); - - lh.addStaticHoliday ("25-OCT-2006", "Hari Raya Puasa"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2007", "Hari Raya Qurban Observed"); - - lh.addStaticHoliday ("01-FEB-2007", "Federal Territory Day"); - - lh.addStaticHoliday ("19-FEB-2007", "Chinese New Year Observed"); - - lh.addStaticHoliday ("20-FEB-2007", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("26-APR-2007", "BANK HOLIDAY"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2007", "Wesak Day Observed"); - - lh.addStaticHoliday ("31-AUG-2007", "National Day"); - - lh.addStaticHoliday ("15-OCT-2007", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("08-NOV-2007", "Deepavali"); - - lh.addStaticHoliday ("20-DEC-2007", "Hari Raya Qurban"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("10-JAN-2008", "First Day of Muharram"); - - lh.addStaticHoliday ("23-JAN-2008", "Thai Poosam"); - - lh.addStaticHoliday ("01-FEB-2008", "Federal Territory Day"); - - lh.addStaticHoliday ("07-FEB-2008", "Chinese New Year"); - - lh.addStaticHoliday ("08-FEB-2008", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("20-MAR-2008", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("19-MAY-2008", "Wesak Day"); - - lh.addStaticHoliday ("01-SEP-2008", "National Day Observed"); - - lh.addStaticHoliday ("01-OCT-2008", "Hari Raya Puasa"); - - lh.addStaticHoliday ("02-OCT-2008", "Hari Raya Puasa"); - - lh.addStaticHoliday ("27-OCT-2008", "Deepavali"); - - lh.addStaticHoliday ("08-DEC-2008", "Hari Raya Qurban"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("29-DEC-2008", "First Day of Muharram"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2009", "Chinese New Year"); - - lh.addStaticHoliday ("27-JAN-2009", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("02-FEB-2009", "Federal Territory Day Observed"); - - lh.addStaticHoliday ("09-FEB-2009", "Thai Poosam"); - - lh.addStaticHoliday ("09-MAR-2009", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("31-AUG-2009", "National Day"); - - lh.addStaticHoliday ("21-SEP-2009", "Hari Raya Puasa"); - - lh.addStaticHoliday ("22-SEP-2009", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("27-NOV-2009", "Hari Raya Qurban"); - - lh.addStaticHoliday ("18-DEC-2009", "First Day of Muharram"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("01-FEB-2010", "Federal Territory Day"); - - lh.addStaticHoliday ("15-FEB-2010", "Chinese New Year Observed"); - - lh.addStaticHoliday ("16-FEB-2010", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("26-FEB-2010", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("28-MAY-2010", "Wesak Day"); - - lh.addStaticHoliday ("31-AUG-2010", "National Day"); - - lh.addStaticHoliday ("10-SEP-2010", "Hari Raya Puasa"); - - lh.addStaticHoliday ("16-SEP-2010", "National Day"); - - lh.addStaticHoliday ("05-NOV-2010", "Deepavali"); - - lh.addStaticHoliday ("17-NOV-2010", "Hari Raya Qurban"); - - lh.addStaticHoliday ("07-DEC-2010", "First Day of Muharram"); - - lh.addStaticHoliday ("31-DEC-2010", "Special Holiday"); - - lh.addStaticHoliday ("20-JAN-2011", "Thai Poosam"); - - lh.addStaticHoliday ("01-FEB-2011", "Federal Territory Day"); - - lh.addStaticHoliday ("03-FEB-2011", "Chinese New Year"); - - lh.addStaticHoliday ("04-FEB-2011", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("15-FEB-2011", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("02-MAY-2011", "Labour Day Observed"); - - lh.addStaticHoliday ("17-MAY-2011", "Wesak Day"); - - lh.addStaticHoliday ("30-AUG-2011", "Hari Raya Puasa"); - - lh.addStaticHoliday ("31-AUG-2011", "National Day"); - - lh.addStaticHoliday ("01-SEP-2011", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("16-SEP-2011", "National Day"); - - lh.addStaticHoliday ("26-OCT-2011", "Deepavali"); - - lh.addStaticHoliday ("07-NOV-2011", "Hari Raya Qurban Observed"); - - lh.addStaticHoliday ("28-NOV-2011", "First Day of Muharram Observed"); - - lh.addStaticHoliday ("26-DEC-2011", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("23-JAN-2012", "Chinese New Year"); - - lh.addStaticHoliday ("24-JAN-2012", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("01-FEB-2012", "Federal Territory Day"); - - lh.addStaticHoliday ("06-FEB-2012", "Prophet Muhammads Birthday Observed"); - - lh.addStaticHoliday ("07-FEB-2012", "Thai Poosam"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("20-AUG-2012", "Hari Raya Puasa"); - - lh.addStaticHoliday ("21-AUG-2012", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("31-AUG-2012", "National Day"); - - lh.addStaticHoliday ("17-SEP-2012", "National Day Observed"); - - lh.addStaticHoliday ("26-OCT-2012", "Hari Raya Qurban"); - - lh.addStaticHoliday ("13-NOV-2012", "Deepavali"); - - lh.addStaticHoliday ("15-NOV-2012", "First Day of Muharram"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("24-JAN-2013", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("28-JAN-2013", "Thai Poosam"); - - lh.addStaticHoliday ("01-FEB-2013", "Federal Territory Day"); - - lh.addStaticHoliday ("11-FEB-2013", "Chinese New Year Observed"); - - lh.addStaticHoliday ("12-FEB-2013", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2013", "Wesak Day"); - - lh.addStaticHoliday ("08-AUG-2013", "Hari Raya Puasa"); - - lh.addStaticHoliday ("09-AUG-2013", "Hari Raya Puasa"); - - lh.addStaticHoliday ("16-SEP-2013", "National Day"); - - lh.addStaticHoliday ("15-OCT-2013", "Hari Raya Qurban"); - - lh.addStaticHoliday ("05-NOV-2013", "First Day of Muharram"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("14-JAN-2014", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("31-JAN-2014", "Chinese New Year"); - - lh.addStaticHoliday ("03-FEB-2014", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("13-FEB-2014", "Thai Poosam"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("13-MAY-2014", "Wesak Day"); - - lh.addStaticHoliday ("28-JUL-2014", "Hari Raya Puasa"); - - lh.addStaticHoliday ("29-JUL-2014", "Hari Raya Puasa"); - - lh.addStaticHoliday ("01-SEP-2014", "National Day Observed"); - - lh.addStaticHoliday ("16-SEP-2014", "National Day"); - - lh.addStaticHoliday ("06-OCT-2014", "Hari Raya Qurban Observed"); - - lh.addStaticHoliday ("22-OCT-2014", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("02-FEB-2015", "Federal Territory Day Observed"); - - lh.addStaticHoliday ("03-FEB-2015", "Thai Poosam"); - - lh.addStaticHoliday ("19-FEB-2015", "Chinese New Year"); - - lh.addStaticHoliday ("20-FEB-2015", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("04-MAY-2015", "Wesak Day Observed"); - - lh.addStaticHoliday ("17-JUL-2015", "Hari Raya Puasa"); - - lh.addStaticHoliday ("31-AUG-2015", "National Day"); - - lh.addStaticHoliday ("16-SEP-2015", "National Day"); - - lh.addStaticHoliday ("24-SEP-2015", "Hari Raya Qurban"); - - lh.addStaticHoliday ("14-OCT-2015", "First Day of Muharram"); - - lh.addStaticHoliday ("10-NOV-2015", "Deepavali"); - - lh.addStaticHoliday ("24-DEC-2015", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("25-JAN-2016", "Thai Poosam"); - - lh.addStaticHoliday ("01-FEB-2016", "Federal Territory Day"); - - lh.addStaticHoliday ("08-FEB-2016", "Chinese New Year"); - - lh.addStaticHoliday ("09-FEB-2016", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("02-MAY-2016", "Labour Day Observed"); - - lh.addStaticHoliday ("06-JUL-2016", "Hari Raya Puasa"); - - lh.addStaticHoliday ("07-JUL-2016", "Hari Raya Puasa"); - - lh.addStaticHoliday ("31-AUG-2016", "National Day"); - - lh.addStaticHoliday ("12-SEP-2016", "Hari Raya Qurban"); - - lh.addStaticHoliday ("16-SEP-2016", "National Day"); - - lh.addStaticHoliday ("03-OCT-2016", "First Day of Muharram Observed"); - - lh.addStaticHoliday ("12-DEC-2016", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("26-DEC-2016", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("30-JAN-2017", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("01-FEB-2017", "Federal Territory Day"); - - lh.addStaticHoliday ("10-FEB-2017", "Thai Poosam"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("10-MAY-2017", "Wesak Day"); - - lh.addStaticHoliday ("26-JUN-2017", "Hari Raya Puasa"); - - lh.addStaticHoliday ("27-JUN-2017", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("31-AUG-2017", "National Day"); - - lh.addStaticHoliday ("01-SEP-2017", "Hari Raya Qurban"); - - lh.addStaticHoliday ("21-SEP-2017", "First Day of Muharram"); - - lh.addStaticHoliday ("18-OCT-2017", "Deepavali"); - - lh.addStaticHoliday ("01-DEC-2017", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("31-JAN-2018", "Thai Poosam"); - - lh.addStaticHoliday ("01-FEB-2018", "Federal Territory Day"); - - lh.addStaticHoliday ("16-FEB-2018", "Chinese New Year"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2018", "Wesak Day"); - - lh.addStaticHoliday ("15-JUN-2018", "Hari Raya Puasa"); - - lh.addStaticHoliday ("22-AUG-2018", "Hari Raya Qurban"); - - lh.addStaticHoliday ("31-AUG-2018", "National Day"); - - lh.addStaticHoliday ("11-SEP-2018", "First Day of Muharram"); - - lh.addStaticHoliday ("17-SEP-2018", "National Day Observed"); - - lh.addStaticHoliday ("06-NOV-2018", "Deepavali"); - - lh.addStaticHoliday ("20-NOV-2018", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2019", "Thai Poosam"); - - lh.addStaticHoliday ("01-FEB-2019", "Federal Territory Day"); - - lh.addStaticHoliday ("05-FEB-2019", "Chinese New Year"); - - lh.addStaticHoliday ("06-FEB-2019", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("20-MAY-2019", "Wesak Day Observed"); - - lh.addStaticHoliday ("05-JUN-2019", "Hari Raya Puasa"); - - lh.addStaticHoliday ("06-JUN-2019", "Hari Raya Puasa"); - - lh.addStaticHoliday ("12-AUG-2019", "Hari Raya Qurban Observed"); - - lh.addStaticHoliday ("02-SEP-2019", "First Day of Muharram Observed"); - - lh.addStaticHoliday ("16-SEP-2019", "National Day"); - - lh.addStaticHoliday ("28-OCT-2019", "Deepavali Observed"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("27-JAN-2020", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("07-MAY-2020", "Wesak Day"); - - lh.addStaticHoliday ("25-MAY-2020", "Hari Raya Puasa"); - - lh.addStaticHoliday ("26-MAY-2020", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("31-JUL-2020", "Hari Raya Qurban"); - - lh.addStaticHoliday ("20-AUG-2020", "First Day of Muharram"); - - lh.addStaticHoliday ("31-AUG-2020", "National Day"); - - lh.addStaticHoliday ("16-SEP-2020", "National Day"); - - lh.addStaticHoliday ("29-OCT-2020", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-2021", "Thai Poosam"); - - lh.addStaticHoliday ("01-FEB-2021", "Federal Territory Day"); - - lh.addStaticHoliday ("12-FEB-2021", "Chinese New Year"); - - lh.addStaticHoliday ("13-MAY-2021", "Hari Raya Puasa"); - - lh.addStaticHoliday ("14-MAY-2021", "Hari Raya Puasa"); - - lh.addStaticHoliday ("26-MAY-2021", "Wesak Day"); - - lh.addStaticHoliday ("20-JUL-2021", "Hari Raya Qurban"); - - lh.addStaticHoliday ("10-AUG-2021", "First Day of Muharram"); - - lh.addStaticHoliday ("31-AUG-2021", "National Day"); - - lh.addStaticHoliday ("16-SEP-2021", "National Day"); - - lh.addStaticHoliday ("19-OCT-2021", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("04-NOV-2021", "Deepavali"); - - lh.addStaticHoliday ("18-JAN-2022", "Thai Poosam"); - - lh.addStaticHoliday ("01-FEB-2022", "Federal Territory Day"); - - lh.addStaticHoliday ("02-FEB-2022", "Chinese New Year Observed"); - - lh.addStaticHoliday ("03-FEB-2022", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("02-MAY-2022", "Labour Day Observed"); - - lh.addStaticHoliday ("03-MAY-2022", "Hari Raya Puasa"); - - lh.addStaticHoliday ("04-MAY-2022", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("16-MAY-2022", "Wesak Day Observed"); - - lh.addStaticHoliday ("31-AUG-2022", "National Day"); - - lh.addStaticHoliday ("16-SEP-2022", "National Day"); - - lh.addStaticHoliday ("24-OCT-2022", "Deepavali"); - - lh.addStaticHoliday ("26-DEC-2022", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("23-JAN-2023", "Chinese New Year Observed"); - - lh.addStaticHoliday ("24-JAN-2023", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("01-FEB-2023", "Federal Territory Day"); - - lh.addStaticHoliday ("06-FEB-2023", "Thai Poosam"); - - lh.addStaticHoliday ("21-APR-2023", "Hari Raya Puasa"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("04-MAY-2023", "Wesak Day"); - - lh.addStaticHoliday ("28-JUN-2023", "Hari Raya Qurban"); - - lh.addStaticHoliday ("19-JUL-2023", "First Day of Muharram"); - - lh.addStaticHoliday ("31-AUG-2023", "National Day"); - - lh.addStaticHoliday ("27-SEP-2023", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("13-NOV-2023", "Deepavali Observed"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2024", "Thai Poosam"); - - lh.addStaticHoliday ("01-FEB-2024", "Federal Territory Day"); - - lh.addStaticHoliday ("12-FEB-2024", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("10-APR-2024", "Hari Raya Puasa"); - - lh.addStaticHoliday ("11-APR-2024", "Hari Raya Puasa"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("22-MAY-2024", "Wesak Day"); - - lh.addStaticHoliday ("17-JUN-2024", "Hari Raya Qurban"); - - lh.addStaticHoliday ("08-JUL-2024", "First Day of Muharram Observed"); - - lh.addStaticHoliday ("16-SEP-2024", "National Day"); - - lh.addStaticHoliday ("17-SEP-2024", "Prophet Muhammads Birthday Observed"); - - lh.addStaticHoliday ("31-OCT-2024", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("29-JAN-2025", "Chinese New Year"); - - lh.addStaticHoliday ("30-JAN-2025", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("11-FEB-2025", "Thai Poosam"); - - lh.addStaticHoliday ("31-MAR-2025", "Hari Raya Puasa"); - - lh.addStaticHoliday ("01-APR-2025", "Hari Raya Puasa"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("12-MAY-2025", "Wesak Day"); - - lh.addStaticHoliday ("06-JUN-2025", "Hari Raya Qurban"); - - lh.addStaticHoliday ("27-JUN-2025", "First Day of Muharram"); - - lh.addStaticHoliday ("01-SEP-2025", "National Day Observed"); - - lh.addStaticHoliday ("05-SEP-2025", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("16-SEP-2025", "National Day"); - - lh.addStaticHoliday ("20-OCT-2025", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("02-FEB-2026", "Federal Territory Day Observed"); - - lh.addStaticHoliday ("17-FEB-2026", "Chinese New Year"); - - lh.addStaticHoliday ("18-FEB-2026", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("20-MAR-2026", "Hari Raya Puasa"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("27-MAY-2026", "Hari Raya Qurban"); - - lh.addStaticHoliday ("16-JUN-2026", "First Day of Muharram"); - - lh.addStaticHoliday ("25-AUG-2026", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("31-AUG-2026", "National Day"); - - lh.addStaticHoliday ("16-SEP-2026", "National Day"); - - lh.addStaticHoliday ("09-NOV-2026", "Deepavali Observed"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("22-JAN-2027", "Thai Poosam"); - - lh.addStaticHoliday ("01-FEB-2027", "Federal Territory Day"); - - lh.addStaticHoliday ("08-FEB-2027", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("10-MAR-2027", "Hari Raya Puasa"); - - lh.addStaticHoliday ("11-MAR-2027", "Hari Raya Puasa"); - - lh.addStaticHoliday ("17-MAY-2027", "Hari Raya Qurban"); - - lh.addStaticHoliday ("20-MAY-2027", "Wesak Day"); - - lh.addStaticHoliday ("07-JUN-2027", "First Day of Muharram Observed"); - - lh.addStaticHoliday ("16-AUG-2027", "Prophet Muhammads Birthday Observed"); - - lh.addStaticHoliday ("31-AUG-2027", "National Day"); - - lh.addStaticHoliday ("16-SEP-2027", "National Day"); - - lh.addStaticHoliday ("28-OCT-2027", "Deepavali"); - - lh.addStaticHoliday ("26-JAN-2028", "Chinese New Year"); - - lh.addStaticHoliday ("27-JAN-2028", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("01-FEB-2028", "Federal Territory Day"); - - lh.addStaticHoliday ("09-FEB-2028", "Thai Poosam"); - - lh.addStaticHoliday ("28-FEB-2028", "Hari Raya Puasa"); - - lh.addStaticHoliday ("29-FEB-2028", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2028", "Hari Raya Qurban"); - - lh.addStaticHoliday ("09-MAY-2028", "Wesak Day"); - - lh.addStaticHoliday ("26-MAY-2028", "First Day of Muharram"); - - lh.addStaticHoliday ("03-AUG-2028", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("31-AUG-2028", "National Day"); - - lh.addStaticHoliday ("17-OCT-2028", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2029", "New Years Day"); - - lh.addStaticHoliday ("30-JAN-2029", "Thai Poosam"); - - lh.addStaticHoliday ("01-FEB-2029", "Federal Territory Day"); - - lh.addStaticHoliday ("13-FEB-2029", "Chinese New Year"); - - lh.addStaticHoliday ("14-FEB-2029", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("15-FEB-2029", "Hari Raya Puasa"); - - lh.addStaticHoliday ("16-FEB-2029", "Hari Raya Puasa"); - - lh.addStaticHoliday ("24-APR-2029", "Hari Raya Qurban"); - - lh.addStaticHoliday ("01-MAY-2029", "Labour Day"); - - lh.addStaticHoliday ("15-MAY-2029", "First Day of Muharram"); - - lh.addStaticHoliday ("28-MAY-2029", "Wesak Day Observed"); - - lh.addStaticHoliday ("24-JUL-2029", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("31-AUG-2029", "National Day"); - - lh.addStaticHoliday ("17-SEP-2029", "National Day Observed"); - - lh.addStaticHoliday ("05-NOV-2029", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2029", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2030", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2030", "Thai Poosam"); - - lh.addStaticHoliday ("01-FEB-2030", "Federal Territory Day"); - - lh.addStaticHoliday ("04-FEB-2030", "Chinese New Year Observed"); - - lh.addStaticHoliday ("05-FEB-2030", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("06-FEB-2030", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("07-FEB-2030", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("01-MAY-2030", "Labour Day"); - - lh.addStaticHoliday ("16-MAY-2030", "Wesak Day"); - - lh.addStaticHoliday ("16-SEP-2030", "National Day"); - - lh.addStaticHoliday ("25-DEC-2030", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2031", "New Years Day"); - - lh.addStaticHoliday ("23-JAN-2031", "Chinese New Year"); - - lh.addStaticHoliday ("24-JAN-2031", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("27-JAN-2031", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("06-FEB-2031", "Thai Poosam"); - - lh.addStaticHoliday ("03-APR-2031", "Hari Raya Qurban"); - - lh.addStaticHoliday ("23-APR-2031", "First Day of Muharram"); - - lh.addStaticHoliday ("01-MAY-2031", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2031", "Wesak Day"); - - lh.addStaticHoliday ("02-JUL-2031", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("01-SEP-2031", "National Day Observed"); - - lh.addStaticHoliday ("16-SEP-2031", "National Day"); - - lh.addStaticHoliday ("14-NOV-2031", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2031", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2032", "New Years Day"); - - lh.addStaticHoliday ("14-JAN-2032", "Hari Raya Puasa"); - - lh.addStaticHoliday ("15-JAN-2032", "Hari Raya Puasa"); - - lh.addStaticHoliday ("27-JAN-2032", "Thai Poosam"); - - lh.addStaticHoliday ("02-FEB-2032", "Federal Territory Day Observed"); - - lh.addStaticHoliday ("11-FEB-2032", "Chinese New Year"); - - lh.addStaticHoliday ("12-FEB-2032", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("22-MAR-2032", "Hari Raya Qurban"); - - lh.addStaticHoliday ("12-APR-2032", "First Day of Muharram Observed"); - - lh.addStaticHoliday ("24-MAY-2032", "Wesak Day Observed"); - - lh.addStaticHoliday ("21-JUN-2032", "Prophet Muhammads Birthday Observed"); - - lh.addStaticHoliday ("31-AUG-2032", "National Day"); - - lh.addStaticHoliday ("16-SEP-2032", "National Day"); - - lh.addStaticHoliday ("02-NOV-2032", "Deepavali"); - - lh.addStaticHoliday ("03-JAN-2033", "Hari Raya Puasa"); - - lh.addStaticHoliday ("04-JAN-2033", "Hari Raya Puasa"); - - lh.addStaticHoliday ("31-JAN-2033", "Chinese New Year"); - - lh.addStaticHoliday ("01-FEB-2033", "Federal Territory Day"); - - lh.addStaticHoliday ("02-FEB-2033", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("01-APR-2033", "First Day of Muharram"); - - lh.addStaticHoliday ("02-MAY-2033", "Labour Day Observed"); - - lh.addStaticHoliday ("13-MAY-2033", "Wesak Day"); - - lh.addStaticHoliday ("10-JUN-2033", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("31-AUG-2033", "National Day"); - - lh.addStaticHoliday ("16-SEP-2033", "National Day"); - - lh.addStaticHoliday ("23-DEC-2033", "Hari Raya Puasa"); - - lh.addStaticHoliday ("26-DEC-2033", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2034", "New Years Day Observed"); - - lh.addStaticHoliday ("01-FEB-2034", "Federal Territory Day"); - - lh.addStaticHoliday ("02-FEB-2034", "Thai Poosam"); - - lh.addStaticHoliday ("20-FEB-2034", "Chinese New Year Observed"); - - lh.addStaticHoliday ("21-FEB-2034", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("01-MAR-2034", "Hari Raya Qurban"); - - lh.addStaticHoliday ("22-MAR-2034", "First Day of Muharram"); - - lh.addStaticHoliday ("01-MAY-2034", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2034", "Wesak Day"); - - lh.addStaticHoliday ("30-MAY-2034", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("31-AUG-2034", "National Day"); - - lh.addStaticHoliday ("09-NOV-2034", "Deepavali"); - - lh.addStaticHoliday ("12-DEC-2034", "Hari Raya Puasa"); - - lh.addStaticHoliday ("13-DEC-2034", "Hari Raya Puasa"); - - lh.addStaticHoliday ("25-DEC-2034", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2035", "New Years Day"); - - lh.addStaticHoliday ("24-JAN-2035", "Thai Poosam"); - - lh.addStaticHoliday ("01-FEB-2035", "Federal Territory Day"); - - lh.addStaticHoliday ("08-FEB-2035", "Chinese New Year"); - - lh.addStaticHoliday ("09-FEB-2035", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("19-FEB-2035", "Hari Raya Qurban"); - - lh.addStaticHoliday ("12-MAR-2035", "First Day of Muharram Observed"); - - lh.addStaticHoliday ("01-MAY-2035", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2035", "Prophet Muhammads Birthday Observed"); - - lh.addStaticHoliday ("22-MAY-2035", "Wesak Day"); - - lh.addStaticHoliday ("31-AUG-2035", "National Day"); - - lh.addStaticHoliday ("17-SEP-2035", "National Day Observed"); - - lh.addStaticHoliday ("30-OCT-2035", "Deepavali"); - - lh.addStaticHoliday ("03-DEC-2035", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("25-DEC-2035", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2036", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-2036", "Chinese New Year"); - - lh.addStaticHoliday ("29-JAN-2036", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("01-FEB-2036", "Federal Territory Day"); - - lh.addStaticHoliday ("08-FEB-2036", "Hari Raya Qurban"); - - lh.addStaticHoliday ("11-FEB-2036", "Thai Poosam"); - - lh.addStaticHoliday ("29-FEB-2036", "First Day of Muharram"); - - lh.addStaticHoliday ("01-MAY-2036", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2036", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("01-SEP-2036", "National Day Observed"); - - lh.addStaticHoliday ("16-SEP-2036", "National Day"); - - lh.addStaticHoliday ("19-NOV-2036", "Hari Raya Puasa"); - - lh.addStaticHoliday ("20-NOV-2036", "Hari Raya Puasa"); - - lh.addStaticHoliday ("25-DEC-2036", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2037", "New Years Day"); - - lh.addStaticHoliday ("27-JAN-2037", "Hari Raya Qurban"); - - lh.addStaticHoliday ("02-FEB-2037", "Federal Territory Day Observed"); - - lh.addStaticHoliday ("16-FEB-2037", "Chinese New Year Observed"); - - lh.addStaticHoliday ("17-FEB-2037", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("18-FEB-2037", "First Day of Muharram Observed"); - - lh.addStaticHoliday ("28-APR-2037", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("01-MAY-2037", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2037", "Wesak Day"); - - lh.addStaticHoliday ("31-AUG-2037", "National Day"); - - lh.addStaticHoliday ("16-SEP-2037", "National Day"); - - lh.addStaticHoliday ("06-NOV-2037", "Deepavali"); - - lh.addStaticHoliday ("09-NOV-2037", "Hari Raya Puasa"); - - lh.addStaticHoliday ("10-NOV-2037", "Hari Raya Puasa"); - - lh.addStaticHoliday ("25-DEC-2037", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2038", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2038", "Thai Poosam"); - - lh.addStaticHoliday ("01-FEB-2038", "Federal Territory Day"); - - lh.addStaticHoliday ("04-FEB-2038", "Chinese New Year"); - - lh.addStaticHoliday ("05-FEB-2038", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("18-MAY-2038", "Wesak Day"); - - lh.addStaticHoliday ("31-AUG-2038", "National Day"); - - lh.addStaticHoliday ("16-SEP-2038", "National Day"); - - lh.addStaticHoliday ("27-OCT-2038", "Deepavali"); - - lh.addStaticHoliday ("29-OCT-2038", "Hari Raya Puasa"); - - lh.addStaticHoliday ("05-JAN-2039", "Hari Raya Qurban"); - - lh.addStaticHoliday ("24-JAN-2039", "Chinese New Year"); - - lh.addStaticHoliday ("25-JAN-2039", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("26-JAN-2039", "First Day of Muharram"); - - lh.addStaticHoliday ("01-FEB-2039", "Federal Territory Day"); - - lh.addStaticHoliday ("08-FEB-2039", "Thai Poosam"); - - lh.addStaticHoliday ("06-APR-2039", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("02-MAY-2039", "Labour Day Observed"); - - lh.addStaticHoliday ("31-AUG-2039", "National Day"); - - lh.addStaticHoliday ("16-SEP-2039", "National Day"); - - lh.addStaticHoliday ("19-OCT-2039", "Hari Raya Puasa"); - - lh.addStaticHoliday ("20-OCT-2039", "Hari Raya Puasa"); - - lh.addStaticHoliday ("15-NOV-2039", "Deepavali"); - - lh.addStaticHoliday ("26-DEC-2039", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2039", "Hari Raya Qurban Observed"); - - lh.addStaticHoliday ("02-JAN-2040", "New Years Day Observed"); - - lh.addStaticHoliday ("16-JAN-2040", "First Day of Muharram Observed"); - - lh.addStaticHoliday ("30-JAN-2040", "Thai Poosam"); - - lh.addStaticHoliday ("01-FEB-2040", "Federal Territory Day"); - - lh.addStaticHoliday ("13-FEB-2040", "Chinese New Year Observed"); - - lh.addStaticHoliday ("14-FEB-2040", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("26-MAR-2040", "Prophet Muhammads Birthday Observed"); - - lh.addStaticHoliday ("01-MAY-2040", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2040", "Wesak Day"); - - lh.addStaticHoliday ("31-AUG-2040", "National Day"); - - lh.addStaticHoliday ("17-SEP-2040", "National Day Observed"); - - lh.addStaticHoliday ("08-OCT-2040", "Hari Raya Puasa"); - - lh.addStaticHoliday ("09-OCT-2040", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("25-DEC-2040", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2041", "New Years Day"); - - lh.addStaticHoliday ("04-JAN-2041", "First Day of Muharram"); - - lh.addStaticHoliday ("18-JAN-2041", "Thai Poosam"); - - lh.addStaticHoliday ("01-FEB-2041", "Federal Territory Day"); - - lh.addStaticHoliday ("04-FEB-2041", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("15-MAR-2041", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("01-MAY-2041", "Labour Day"); - - lh.addStaticHoliday ("14-MAY-2041", "Wesak Day"); - - lh.addStaticHoliday ("16-SEP-2041", "National Day"); - - lh.addStaticHoliday ("27-SEP-2041", "Hari Raya Puasa"); - - lh.addStaticHoliday ("23-OCT-2041", "Deepavali"); - - lh.addStaticHoliday ("04-DEC-2041", "Hari Raya Qurban"); - - lh.addStaticHoliday ("25-DEC-2041", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2041", "First Day of Muharram Observed"); - - lh.addStaticHoliday ("01-JAN-2042", "New Years Day"); - - lh.addStaticHoliday ("22-JAN-2042", "Chinese New Year"); - - lh.addStaticHoliday ("23-JAN-2042", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("04-FEB-2042", "Thai Poosam"); - - lh.addStaticHoliday ("05-MAR-2042", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("01-MAY-2042", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2042", "Wesak Day Observed"); - - lh.addStaticHoliday ("01-SEP-2042", "National Day Observed"); - - lh.addStaticHoliday ("16-SEP-2042", "National Day"); - - lh.addStaticHoliday ("17-SEP-2042", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("18-SEP-2042", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("11-NOV-2042", "Deepavali"); - - lh.addStaticHoliday ("24-NOV-2042", "Hari Raya Qurban Observed"); - - lh.addStaticHoliday ("15-DEC-2042", "First Day of Muharram Observed"); - - lh.addStaticHoliday ("25-DEC-2042", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2043", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2043", "Thai Poosam"); - - lh.addStaticHoliday ("02-FEB-2043", "Federal Territory Day Observed"); - - lh.addStaticHoliday ("10-FEB-2043", "Chinese New Year"); - - lh.addStaticHoliday ("11-FEB-2043", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("23-FEB-2043", "Prophet Muhammads Birthday Observed"); - - lh.addStaticHoliday ("01-MAY-2043", "Labour Day"); - - lh.addStaticHoliday ("31-AUG-2043", "National Day"); - - lh.addStaticHoliday ("07-SEP-2043", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("16-SEP-2043", "National Day"); - - lh.addStaticHoliday ("12-NOV-2043", "Hari Raya Qurban"); - - lh.addStaticHoliday ("03-DEC-2043", "First Day of Muharram"); - - lh.addStaticHoliday ("25-DEC-2043", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2044", "New Years Day"); - - lh.addStaticHoliday ("01-FEB-2044", "Federal Territory Day"); - - lh.addStaticHoliday ("02-FEB-2044", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("11-FEB-2044", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("12-FEB-2044", "Thai Poosam"); - - lh.addStaticHoliday ("02-MAY-2044", "Labour Day Observed"); - - lh.addStaticHoliday ("12-MAY-2044", "Wesak Day"); - - lh.addStaticHoliday ("24-AUG-2044", "Hari Raya Puasa"); - - lh.addStaticHoliday ("25-AUG-2044", "Hari Raya Puasa"); - - lh.addStaticHoliday ("31-AUG-2044", "National Day"); - - lh.addStaticHoliday ("16-SEP-2044", "National Day"); - - lh.addStaticHoliday ("20-OCT-2044", "Deepavali"); - - lh.addStaticHoliday ("31-OCT-2044", "Hari Raya Qurban"); - - lh.addStaticHoliday ("21-NOV-2044", "First Day of Muharram"); - - lh.addStaticHoliday ("26-DEC-2044", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2045", "New Years Day Observed"); - - lh.addStaticHoliday ("31-JAN-2045", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("01-FEB-2045", "Federal Territory Day"); - - lh.addStaticHoliday ("17-FEB-2045", "Chinese New Year"); - - lh.addStaticHoliday ("01-MAY-2045", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2045", "Wesak Day Observed"); - - lh.addStaticHoliday ("14-AUG-2045", "Hari Raya Puasa"); - - lh.addStaticHoliday ("15-AUG-2045", "Hari Raya Puasa"); - - lh.addStaticHoliday ("31-AUG-2045", "National Day"); - - lh.addStaticHoliday ("08-NOV-2045", "Deepavali"); - - lh.addStaticHoliday ("10-NOV-2045", "First Day of Muharram"); - - lh.addStaticHoliday ("25-DEC-2045", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2046", "New Years Day"); - - lh.addStaticHoliday ("22-JAN-2046", "Thai Poosam"); - - lh.addStaticHoliday ("01-FEB-2046", "Federal Territory Day"); - - lh.addStaticHoliday ("06-FEB-2046", "Chinese New Year"); - - lh.addStaticHoliday ("07-FEB-2046", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("01-MAY-2046", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2046", "Wesak Day Observed"); - - lh.addStaticHoliday ("06-AUG-2046", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("31-AUG-2046", "National Day"); - - lh.addStaticHoliday ("17-SEP-2046", "National Day Observed"); - - lh.addStaticHoliday ("10-OCT-2046", "Hari Raya Qurban"); - - lh.addStaticHoliday ("29-OCT-2046", "Deepavali Observed"); - - lh.addStaticHoliday ("31-OCT-2046", "First Day of Muharram"); - - lh.addStaticHoliday ("25-DEC-2046", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2047", "New Years Day"); - - lh.addStaticHoliday ("09-JAN-2047", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("28-JAN-2047", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("01-FEB-2047", "Federal Territory Day"); - - lh.addStaticHoliday ("01-MAY-2047", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2047", "Wesak Day"); - - lh.addStaticHoliday ("24-JUL-2047", "Hari Raya Puasa"); - - lh.addStaticHoliday ("25-JUL-2047", "Hari Raya Puasa"); - - lh.addStaticHoliday ("16-SEP-2047", "National Day"); - - lh.addStaticHoliday ("30-SEP-2047", "Hari Raya Qurban"); - - lh.addStaticHoliday ("18-OCT-2047", "Deepavali"); - - lh.addStaticHoliday ("21-OCT-2047", "First Day of Muharram"); - - lh.addStaticHoliday ("25-DEC-2047", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2047", "Prophet Muhammads Birthday Observed"); - - lh.addStaticHoliday ("01-JAN-2048", "New Years Day"); - - lh.addStaticHoliday ("30-JAN-2048", "Thai Poosam"); - - lh.addStaticHoliday ("14-FEB-2048", "Chinese New Year"); - - lh.addStaticHoliday ("01-MAY-2048", "Labour Day"); - - lh.addStaticHoliday ("27-MAY-2048", "Wesak Day"); - - lh.addStaticHoliday ("13-JUL-2048", "Hari Raya Puasa"); - - lh.addStaticHoliday ("14-JUL-2048", "Hari Raya Puasa"); - - lh.addStaticHoliday ("31-AUG-2048", "National Day"); - - lh.addStaticHoliday ("16-SEP-2048", "National Day"); - - lh.addStaticHoliday ("09-OCT-2048", "First Day of Muharram"); - - lh.addStaticHoliday ("05-NOV-2048", "Deepavali"); - - lh.addStaticHoliday ("18-DEC-2048", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("25-DEC-2048", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2049", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2049", "Thai Poosam"); - - lh.addStaticHoliday ("01-FEB-2049", "Federal Territory Day"); - - lh.addStaticHoliday ("02-FEB-2049", "Chinese New Year"); - - lh.addStaticHoliday ("03-FEB-2049", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("17-MAY-2049", "Wesak Day Observed"); - - lh.addStaticHoliday ("02-JUL-2049", "Hari Raya Puasa"); - - lh.addStaticHoliday ("31-AUG-2049", "National Day"); - - lh.addStaticHoliday ("08-SEP-2049", "Hari Raya Qurban"); - - lh.addStaticHoliday ("16-SEP-2049", "National Day"); - - lh.addStaticHoliday ("28-SEP-2049", "First Day of Muharram"); - - lh.addStaticHoliday ("25-OCT-2049", "Deepavali"); - - lh.addStaticHoliday ("08-DEC-2049", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("24-JAN-2050", "Chinese New Year Observed"); - - lh.addStaticHoliday ("25-JAN-2050", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("01-FEB-2050", "Federal Territory Day"); - - lh.addStaticHoliday ("07-FEB-2050", "Thai Poosam"); - - lh.addStaticHoliday ("02-MAY-2050", "Labour Day Observed"); - - lh.addStaticHoliday ("05-MAY-2050", "Wesak Day"); - - lh.addStaticHoliday ("21-JUN-2050", "Hari Raya Puasa"); - - lh.addStaticHoliday ("22-JUN-2050", "Hari Raya Puasa"); - - lh.addStaticHoliday ("29-AUG-2050", "Hari Raya Qurban Observed"); - - lh.addStaticHoliday ("31-AUG-2050", "National Day"); - - lh.addStaticHoliday ("16-SEP-2050", "National Day"); - - lh.addStaticHoliday ("19-SEP-2050", "First Day of Muharram Observed"); - - lh.addStaticHoliday ("14-NOV-2050", "Deepavali Observed"); - - lh.addStaticHoliday ("28-NOV-2050", "Prophet Muhammads Birthday Observed"); - - lh.addStaticHoliday ("26-DEC-2050", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2051", "New Years Day Observed"); - - lh.addStaticHoliday ("27-JAN-2051", "Thai Poosam"); - - lh.addStaticHoliday ("01-FEB-2051", "Federal Territory Day"); - - lh.addStaticHoliday ("13-FEB-2051", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("01-MAY-2051", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2051", "Wesak Day"); - - lh.addStaticHoliday ("12-JUN-2051", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("17-AUG-2051", "Hari Raya Qurban"); - - lh.addStaticHoliday ("31-AUG-2051", "National Day"); - - lh.addStaticHoliday ("07-SEP-2051", "First Day of Muharram"); - - lh.addStaticHoliday ("02-NOV-2051", "Deepavali"); - - lh.addStaticHoliday ("16-NOV-2051", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("25-DEC-2051", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2052", "New Years Day"); - - lh.addStaticHoliday ("01-FEB-2052", "Federal Territory Day"); - - lh.addStaticHoliday ("02-FEB-2052", "Chinese New Year Observed"); - - lh.addStaticHoliday ("13-FEB-2052", "Thai Poosam"); - - lh.addStaticHoliday ("01-MAY-2052", "Labour Day"); - - lh.addStaticHoliday ("13-MAY-2052", "Wesak Day"); - - lh.addStaticHoliday ("30-MAY-2052", "Hari Raya Puasa"); - - lh.addStaticHoliday ("31-MAY-2052", "Hari Raya Puasa"); - - lh.addStaticHoliday ("05-AUG-2052", "Hari Raya Qurban"); - - lh.addStaticHoliday ("26-AUG-2052", "First Day of Muharram"); - - lh.addStaticHoliday ("16-SEP-2052", "National Day"); - - lh.addStaticHoliday ("21-OCT-2052", "Deepavali"); - - lh.addStaticHoliday ("04-NOV-2052", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("25-DEC-2052", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2053", "New Years Day"); - - lh.addStaticHoliday ("03-FEB-2053", "Thai Poosam"); - - lh.addStaticHoliday ("19-FEB-2053", "Chinese New Year"); - - lh.addStaticHoliday ("20-FEB-2053", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("01-MAY-2053", "Labour Day"); - - lh.addStaticHoliday ("19-MAY-2053", "Hari Raya Puasa"); - - lh.addStaticHoliday ("20-MAY-2053", "Hari Raya Puasa"); - - lh.addStaticHoliday ("15-AUG-2053", "First Day of Muharram"); - - lh.addStaticHoliday ("01-SEP-2053", "National Day Observed"); - - lh.addStaticHoliday ("16-SEP-2053", "National Day"); - - lh.addStaticHoliday ("24-OCT-2053", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("10-NOV-2053", "Deepavali Observed"); - - lh.addStaticHoliday ("25-DEC-2053", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2054", "New Years Day"); - - lh.addStaticHoliday ("02-FEB-2054", "Federal Territory Day Observed"); - - lh.addStaticHoliday ("09-FEB-2054", "Chinese New Year Observed"); - - lh.addStaticHoliday ("10-FEB-2054", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("01-MAY-2054", "Labour Day"); - - lh.addStaticHoliday ("11-MAY-2054", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("22-MAY-2054", "Wesak Day"); - - lh.addStaticHoliday ("16-JUL-2054", "Hari Raya Qurban"); - - lh.addStaticHoliday ("05-AUG-2054", "First Day of Muharram"); - - lh.addStaticHoliday ("31-AUG-2054", "National Day"); - - lh.addStaticHoliday ("16-SEP-2054", "National Day"); - - lh.addStaticHoliday ("14-OCT-2054", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("30-OCT-2054", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2054", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2055", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-2055", "Chinese New Year"); - - lh.addStaticHoliday ("29-JAN-2055", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("01-FEB-2055", "Federal Territory Day"); - - lh.addStaticHoliday ("10-FEB-2055", "Thai Poosam"); - - lh.addStaticHoliday ("28-APR-2055", "Hari Raya Puasa"); - - lh.addStaticHoliday ("29-APR-2055", "Hari Raya Puasa"); - - lh.addStaticHoliday ("11-MAY-2055", "Wesak Day"); - - lh.addStaticHoliday ("05-JUL-2055", "Hari Raya Qurban"); - - lh.addStaticHoliday ("26-JUL-2055", "First Day of Muharram"); - - lh.addStaticHoliday ("31-AUG-2055", "National Day"); - - lh.addStaticHoliday ("16-SEP-2055", "National Day"); - - lh.addStaticHoliday ("04-OCT-2055", "Prophet Muhammads Birthday Observed"); - - lh.addStaticHoliday ("19-OCT-2055", "Deepavali"); - - lh.addStaticHoliday ("01-FEB-2056", "Federal Territory Day"); - - lh.addStaticHoliday ("15-FEB-2056", "Chinese New Year"); - - lh.addStaticHoliday ("16-FEB-2056", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("17-APR-2056", "Hari Raya Puasa"); - - lh.addStaticHoliday ("18-APR-2056", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("01-MAY-2056", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2056", "Wesak Day"); - - lh.addStaticHoliday ("14-JUL-2056", "First Day of Muharram"); - - lh.addStaticHoliday ("31-AUG-2056", "National Day"); - - lh.addStaticHoliday ("22-SEP-2056", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("06-NOV-2056", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2056", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2057", "New Years Day"); - - lh.addStaticHoliday ("22-JAN-2057", "Thai Poosam"); - - lh.addStaticHoliday ("01-FEB-2057", "Federal Territory Day"); - - lh.addStaticHoliday ("05-FEB-2057", "Chinese New Year Observed"); - - lh.addStaticHoliday ("06-FEB-2057", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("05-APR-2057", "Hari Raya Puasa"); - - lh.addStaticHoliday ("06-APR-2057", "Hari Raya Puasa"); - - lh.addStaticHoliday ("01-MAY-2057", "Labour Day"); - - lh.addStaticHoliday ("18-MAY-2057", "Wesak Day"); - - lh.addStaticHoliday ("13-JUN-2057", "Hari Raya Qurban"); - - lh.addStaticHoliday ("03-JUL-2057", "First Day of Muharram"); - - lh.addStaticHoliday ("31-AUG-2057", "National Day"); - - lh.addStaticHoliday ("11-SEP-2057", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("17-SEP-2057", "National Day Observed"); - - lh.addStaticHoliday ("25-DEC-2057", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2058", "New Years Day"); - - lh.addStaticHoliday ("24-JAN-2058", "Chinese New Year"); - - lh.addStaticHoliday ("25-JAN-2058", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("01-FEB-2058", "Federal Territory Day"); - - lh.addStaticHoliday ("07-FEB-2058", "Thai Poosam"); - - lh.addStaticHoliday ("26-MAR-2058", "Hari Raya Puasa"); - - lh.addStaticHoliday ("27-MAR-2058", "Hari Raya Puasa"); - - lh.addStaticHoliday ("01-MAY-2058", "Labour Day"); - - lh.addStaticHoliday ("07-MAY-2058", "Wesak Day"); - - lh.addStaticHoliday ("03-JUN-2058", "Hari Raya Qurban Observed"); - - lh.addStaticHoliday ("02-SEP-2058", "Prophet Muhammads Birthday Observed"); - - lh.addStaticHoliday ("16-SEP-2058", "National Day"); - - lh.addStaticHoliday ("15-NOV-2058", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2058", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2059", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-2059", "Thai Poosam"); - - lh.addStaticHoliday ("12-FEB-2059", "Chinese New Year"); - - lh.addStaticHoliday ("13-FEB-2059", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("17-MAR-2059", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("01-MAY-2059", "Labour Day"); - - lh.addStaticHoliday ("22-MAY-2059", "Hari Raya Qurban"); - - lh.addStaticHoliday ("26-MAY-2059", "Wesak Day"); - - lh.addStaticHoliday ("12-JUN-2059", "First Day of Muharram"); - - lh.addStaticHoliday ("20-AUG-2059", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("01-SEP-2059", "National Day Observed"); - - lh.addStaticHoliday ("16-SEP-2059", "National Day"); - - lh.addStaticHoliday ("04-NOV-2059", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2059", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2060", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2060", "Thai Poosam"); - - lh.addStaticHoliday ("02-FEB-2060", "Federal Territory Day Observed"); - - lh.addStaticHoliday ("03-FEB-2060", "Chinese New Year Observed"); - - lh.addStaticHoliday ("04-FEB-2060", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("04-MAR-2060", "Hari Raya Puasa"); - - lh.addStaticHoliday ("05-MAR-2060", "Hari Raya Puasa"); - - lh.addStaticHoliday ("11-MAY-2060", "Hari Raya Qurban"); - - lh.addStaticHoliday ("14-MAY-2060", "Wesak Day"); - - lh.addStaticHoliday ("31-MAY-2060", "First Day of Muharram"); - - lh.addStaticHoliday ("09-AUG-2060", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("31-AUG-2060", "National Day"); - - lh.addStaticHoliday ("16-SEP-2060", "National Day"); - - lh.addStaticHoliday ("21-JAN-2061", "Chinese New Year"); - - lh.addStaticHoliday ("01-FEB-2061", "Federal Territory Day"); - - lh.addStaticHoliday ("04-FEB-2061", "Thai Poosam"); - - lh.addStaticHoliday ("21-FEB-2061", "Hari Raya Puasa"); - - lh.addStaticHoliday ("22-FEB-2061", "Hari Raya Puasa"); - - lh.addStaticHoliday ("02-MAY-2061", "Labour Day Observed"); - - lh.addStaticHoliday ("04-MAY-2061", "Wesak Day"); - - lh.addStaticHoliday ("29-JUL-2061", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("31-AUG-2061", "National Day"); - - lh.addStaticHoliday ("16-SEP-2061", "National Day"); - - lh.addStaticHoliday ("11-NOV-2061", "Deepavali"); - - lh.addStaticHoliday ("26-DEC-2061", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2062", "New Years Day Observed"); - - lh.addStaticHoliday ("25-JAN-2062", "Thai Poosam"); - - lh.addStaticHoliday ("01-FEB-2062", "Federal Territory Day"); - - lh.addStaticHoliday ("09-FEB-2062", "Chinese New Year"); - - lh.addStaticHoliday ("10-FEB-2062", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("13-FEB-2062", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("20-APR-2062", "Hari Raya Qurban"); - - lh.addStaticHoliday ("01-MAY-2062", "Labour Day"); - - lh.addStaticHoliday ("10-MAY-2062", "First Day of Muharram"); - - lh.addStaticHoliday ("23-MAY-2062", "Wesak Day"); - - lh.addStaticHoliday ("19-JUL-2062", "Prophet Muhammads Birthday"); - - lh.addStaticHoliday ("31-AUG-2062", "National Day"); - - lh.addStaticHoliday ("31-OCT-2062", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2062", "Christmas Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/NLGHoliday.java b/org/drip/analytics/holset/NLGHoliday.java deleted file mode 100644 index 592a2d7..0000000 --- a/org/drip/analytics/holset/NLGHoliday.java +++ /dev/null @@ -1,493 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class NLGHoliday implements org.drip.analytics.holset.LocationHoliday { - public NLGHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "NLG"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-1998", "Queens Birthday"); - - lh.addStaticHoliday ("21-MAY-1998", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-1998", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-1999", "Queens Birthday"); - - lh.addStaticHoliday ("13-MAY-1999", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-1999", "Whit Monday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2000", "Queens Birthday Observed"); - - lh.addStaticHoliday ("05-MAY-2000", "Liberation Day"); - - lh.addStaticHoliday ("01-JUN-2000", "Ascension Day"); - - lh.addStaticHoliday ("12-JUN-2000", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2001", "Queens Birthday Observed"); - - lh.addStaticHoliday ("24-MAY-2001", "Ascension Day"); - - lh.addStaticHoliday ("04-JUN-2001", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2002", "Queens Birthday"); - - lh.addStaticHoliday ("09-MAY-2002", "Ascension Day"); - - lh.addStaticHoliday ("20-MAY-2002", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2003", "Queens Birthday"); - - lh.addStaticHoliday ("29-MAY-2003", "Ascension Day"); - - lh.addStaticHoliday ("09-JUN-2003", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2004", "Queens Birthday"); - - lh.addStaticHoliday ("20-MAY-2004", "Ascension Day"); - - lh.addStaticHoliday ("31-MAY-2004", "Whit Monday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2005", "Liberation Day"); - - lh.addStaticHoliday ("16-MAY-2005", "Whit Monday"); - - lh.addStaticHoliday ("26-DEC-2005", "Boxing Day"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("25-MAY-2006", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2006", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2007", "Queens Birthday"); - - lh.addStaticHoliday ("17-MAY-2007", "Ascension Day"); - - lh.addStaticHoliday ("28-MAY-2007", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2008", "Queens Birthday"); - - lh.addStaticHoliday ("01-MAY-2008", "Ascension Day"); - - lh.addStaticHoliday ("12-MAY-2008", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2009", "Queens Birthday"); - - lh.addStaticHoliday ("21-MAY-2009", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-2009", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2010", "Queens Birthday"); - - lh.addStaticHoliday ("05-MAY-2010", "Liberation Day"); - - lh.addStaticHoliday ("13-MAY-2010", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-2010", "Whit Monday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("02-JUN-2011", "Ascension Day"); - - lh.addStaticHoliday ("13-JUN-2011", "Whit Monday"); - - lh.addStaticHoliday ("26-DEC-2011", "Boxing Day"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2012", "Queens Birthday"); - - lh.addStaticHoliday ("17-MAY-2012", "Ascension Day"); - - lh.addStaticHoliday ("28-MAY-2012", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2013", "Queens Birthday"); - - lh.addStaticHoliday ("09-MAY-2013", "Ascension Day"); - - lh.addStaticHoliday ("20-MAY-2013", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2014", "Queens Birthday"); - - lh.addStaticHoliday ("29-MAY-2014", "Ascension Day"); - - lh.addStaticHoliday ("09-JUN-2014", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2015", "Queens Birthday"); - - lh.addStaticHoliday ("05-MAY-2015", "Liberation Day"); - - lh.addStaticHoliday ("14-MAY-2015", "Ascension Day"); - - lh.addStaticHoliday ("25-MAY-2015", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2016", "Ascension Day"); - - lh.addStaticHoliday ("16-MAY-2016", "Whit Monday"); - - lh.addStaticHoliday ("26-DEC-2016", "Boxing Day"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("25-MAY-2017", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2017", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2018", "Queens Birthday"); - - lh.addStaticHoliday ("10-MAY-2018", "Ascension Day"); - - lh.addStaticHoliday ("21-MAY-2018", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2019", "Queens Birthday"); - - lh.addStaticHoliday ("30-MAY-2019", "Ascension Day"); - - lh.addStaticHoliday ("10-JUN-2019", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2020", "Queens Birthday"); - - lh.addStaticHoliday ("05-MAY-2020", "Liberation Day"); - - lh.addStaticHoliday ("21-MAY-2020", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-2020", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2021", "Queens Birthday"); - - lh.addStaticHoliday ("13-MAY-2021", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-2021", "Whit Monday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("26-MAY-2022", "Ascension Day"); - - lh.addStaticHoliday ("06-JUN-2022", "Whit Monday"); - - lh.addStaticHoliday ("26-DEC-2022", "Boxing Day"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("18-MAY-2023", "Ascension Day"); - - lh.addStaticHoliday ("29-MAY-2023", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2024", "Queens Birthday"); - - lh.addStaticHoliday ("09-MAY-2024", "Ascension Day"); - - lh.addStaticHoliday ("20-MAY-2024", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2025", "Queens Birthday"); - - lh.addStaticHoliday ("05-MAY-2025", "Liberation Day"); - - lh.addStaticHoliday ("29-MAY-2025", "Ascension Day"); - - lh.addStaticHoliday ("09-JUN-2025", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2026", "Queens Birthday"); - - lh.addStaticHoliday ("14-MAY-2026", "Ascension Day"); - - lh.addStaticHoliday ("25-MAY-2026", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("30-APR-2027", "Queens Birthday"); - - lh.addStaticHoliday ("06-MAY-2027", "Ascension Day"); - - lh.addStaticHoliday ("17-MAY-2027", "Whit Monday"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("25-MAY-2028", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2028", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Boxing Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/NOKHoliday.java b/org/drip/analytics/holset/NOKHoliday.java deleted file mode 100644 index 89cb9b8..0000000 --- a/org/drip/analytics/holset/NOKHoliday.java +++ /dev/null @@ -1,579 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class NOKHoliday implements org.drip.analytics.holset.LocationHoliday { - public NOKHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "NOK"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("09-APR-1998", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-1998", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-1998", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-1999", "Ascension Day"); - - lh.addStaticHoliday ("17-MAY-1999", "Constitution Day"); - - lh.addStaticHoliday ("24-MAY-1999", "Whit Monday"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2000", "Constitution Day"); - - lh.addStaticHoliday ("01-JUN-2000", "Ascension Day"); - - lh.addStaticHoliday ("12-JUN-2000", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2001", "Constitution Day"); - - lh.addStaticHoliday ("24-MAY-2001", "Ascension Day"); - - lh.addStaticHoliday ("04-JUN-2001", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2002", "Ascension Day"); - - lh.addStaticHoliday ("17-MAY-2002", "Constitution Day"); - - lh.addStaticHoliday ("20-MAY-2002", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2003", "Ascension Day"); - - lh.addStaticHoliday ("09-JUN-2003", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("17-MAY-2004", "Constitution Day"); - - lh.addStaticHoliday ("20-MAY-2004", "Ascension Day"); - - lh.addStaticHoliday ("31-MAY-2004", "Whit Monday"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2005", "Ascension Day"); - - lh.addStaticHoliday ("16-MAY-2005", "Whit Monday"); - - lh.addStaticHoliday ("17-MAY-2005", "Constitution Day"); - - lh.addStaticHoliday ("26-DEC-2005", "Boxing Day"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2006", "Constitution Day"); - - lh.addStaticHoliday ("25-MAY-2006", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2006", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2007", "Constitution Day"); - - lh.addStaticHoliday ("28-MAY-2007", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("12-MAY-2008", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2009", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-2009", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2010", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-2010", "Ascension Day"); - - lh.addStaticHoliday ("17-MAY-2010", "Constitution Day"); - - lh.addStaticHoliday ("24-MAY-2010", "Whit Monday"); - - lh.addStaticHoliday ("21-APR-2011", "Holy Thursday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("17-MAY-2011", "Constitution Day"); - - lh.addStaticHoliday ("02-JUN-2011", "Ascension Day"); - - lh.addStaticHoliday ("13-JUN-2011", "Whit Monday"); - - lh.addStaticHoliday ("26-DEC-2011", "Boxing Day"); - - lh.addStaticHoliday ("05-APR-2012", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2012", "Constitution Day"); - - lh.addStaticHoliday ("28-MAY-2012", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2013", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2013", "Ascension Day"); - - lh.addStaticHoliday ("17-MAY-2013", "Constitution Day"); - - lh.addStaticHoliday ("20-MAY-2013", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("17-APR-2014", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2014", "Ascension Day"); - - lh.addStaticHoliday ("09-JUN-2014", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2015", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("14-MAY-2015", "Ascension Day"); - - lh.addStaticHoliday ("25-MAY-2015", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2016", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2016", "Ascension Day"); - - lh.addStaticHoliday ("16-MAY-2016", "Whit Monday"); - - lh.addStaticHoliday ("17-MAY-2016", "Constitution Day"); - - lh.addStaticHoliday ("26-DEC-2016", "Boxing Day"); - - lh.addStaticHoliday ("13-APR-2017", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2017", "Constitution Day"); - - lh.addStaticHoliday ("25-MAY-2017", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2017", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2018", "Holy Thursday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("10-MAY-2018", "Ascension Day"); - - lh.addStaticHoliday ("17-MAY-2018", "Constitution Day"); - - lh.addStaticHoliday ("21-MAY-2018", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2019", "Holy Thursday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2019", "Constitution Day"); - - lh.addStaticHoliday ("30-MAY-2019", "Ascension Day"); - - lh.addStaticHoliday ("10-JUN-2019", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2020", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2020", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-2020", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2021", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-2021", "Ascension Day"); - - lh.addStaticHoliday ("17-MAY-2021", "Constitution Day"); - - lh.addStaticHoliday ("24-MAY-2021", "Whit Monday"); - - lh.addStaticHoliday ("14-APR-2022", "Holy Thursday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("17-MAY-2022", "Constitution Day"); - - lh.addStaticHoliday ("26-MAY-2022", "Ascension Day"); - - lh.addStaticHoliday ("06-JUN-2022", "Whit Monday"); - - lh.addStaticHoliday ("26-DEC-2022", "Boxing Day"); - - lh.addStaticHoliday ("06-APR-2023", "Holy Thursday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2023", "Constitution Day"); - - lh.addStaticHoliday ("18-MAY-2023", "Ascension Day"); - - lh.addStaticHoliday ("29-MAY-2023", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2024", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2024", "Ascension Day"); - - lh.addStaticHoliday ("17-MAY-2024", "Constitution Day"); - - lh.addStaticHoliday ("20-MAY-2024", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("17-APR-2025", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2025", "Ascension Day"); - - lh.addStaticHoliday ("09-JUN-2025", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2026", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("14-MAY-2026", "Ascension Day"); - - lh.addStaticHoliday ("25-MAY-2026", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("25-MAR-2027", "Holy Thursday"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("06-MAY-2027", "Ascension Day"); - - lh.addStaticHoliday ("17-MAY-2027", "Constitution Day"); - - lh.addStaticHoliday ("13-APR-2028", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2028", "Constitution Day"); - - lh.addStaticHoliday ("25-MAY-2028", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2028", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Boxing Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/NZDHoliday.java b/org/drip/analytics/holset/NZDHoliday.java deleted file mode 100644 index 625b8cf..0000000 --- a/org/drip/analytics/holset/NZDHoliday.java +++ /dev/null @@ -1,761 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class NZDHoliday implements org.drip.analytics.holset.LocationHoliday { - public NZDHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "NZD"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-1998", "Public Holiday"); - - lh.addStaticHoliday ("19-JAN-1998", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("26-JAN-1998", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("06-FEB-1998", "Waitangi Day"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("01-JUN-1998", "Queens Birthday"); - - lh.addStaticHoliday ("26-OCT-1998", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-1998", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("04-JAN-1999", "Public Holiday Observed"); - - lh.addStaticHoliday ("25-JAN-1999", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("01-FEB-1999", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("07-JUN-1999", "Queens Birthday"); - - lh.addStaticHoliday ("25-OCT-1999", "Labour Day"); - - lh.addStaticHoliday ("27-DEC-1999", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-1999", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2000", "New Years Day Observed"); - - lh.addStaticHoliday ("04-JAN-2000", "Public Holiday Observed"); - - lh.addStaticHoliday ("24-JAN-2000", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("31-JAN-2000", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2000", "Anzac Day"); - - lh.addStaticHoliday ("05-JUN-2000", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2000", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2001", "Public Holiday"); - - lh.addStaticHoliday ("22-JAN-2001", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("29-JAN-2001", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("06-FEB-2001", "Waitangi Day"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2001", "Anzac Day"); - - lh.addStaticHoliday ("04-JUN-2001", "Queens Birthday"); - - lh.addStaticHoliday ("22-OCT-2001", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2002", "Public Holiday"); - - lh.addStaticHoliday ("21-JAN-2002", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("28-JAN-2002", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("06-FEB-2002", "Waitangi Day"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2002", "Anzac Day"); - - lh.addStaticHoliday ("03-JUN-2002", "Queens Birthday"); - - lh.addStaticHoliday ("28-OCT-2002", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2003", "Public Holiday"); - - lh.addStaticHoliday ("20-JAN-2003", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("27-JAN-2003", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("06-FEB-2003", "Waitangi Day"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2003", "Anzac Day"); - - lh.addStaticHoliday ("02-JUN-2003", "Queens Birthday"); - - lh.addStaticHoliday ("27-OCT-2003", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2004", "Public Holiday"); - - lh.addStaticHoliday ("19-JAN-2004", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("26-JAN-2004", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("06-FEB-2004", "Waitangi Day"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("07-JUN-2004", "Queens Birthday"); - - lh.addStaticHoliday ("25-OCT-2004", "Labour Day"); - - lh.addStaticHoliday ("27-DEC-2004", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2004", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2005", "New Years Day Observed"); - - lh.addStaticHoliday ("04-JAN-2005", "Public Holiday Observed"); - - lh.addStaticHoliday ("24-JAN-2005", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("31-JAN-2005", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2005", "Anzac Day"); - - lh.addStaticHoliday ("06-JUN-2005", "Queens Birthday"); - - lh.addStaticHoliday ("24-OCT-2005", "Labour Day"); - - lh.addStaticHoliday ("26-DEC-2005", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2005", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("03-JAN-2006", "Public Holiday Observed"); - - lh.addStaticHoliday ("23-JAN-2006", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("30-JAN-2006", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("06-FEB-2006", "Waitangi Day"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2006", "Anzac Day"); - - lh.addStaticHoliday ("05-JUN-2006", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2006", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2007", "Public Holiday"); - - lh.addStaticHoliday ("22-JAN-2007", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("29-JAN-2007", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("06-FEB-2007", "Waitangi Day"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2007", "Anzac Day"); - - lh.addStaticHoliday ("04-JUN-2007", "Queens Birthday"); - - lh.addStaticHoliday ("22-OCT-2007", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2008", "Public Holiday"); - - lh.addStaticHoliday ("21-JAN-2008", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("28-JAN-2008", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("06-FEB-2008", "Waitangi Day"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2008", "Anzac Day"); - - lh.addStaticHoliday ("02-JUN-2008", "Queens Birthday"); - - lh.addStaticHoliday ("27-OCT-2008", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2009", "Public Holiday"); - - lh.addStaticHoliday ("19-JAN-2009", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("26-JAN-2009", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("06-FEB-2009", "Waitangi Day"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("01-JUN-2009", "Queens Birthday"); - - lh.addStaticHoliday ("26-OCT-2009", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2009", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("04-JAN-2010", "Public Holiday Observed"); - - lh.addStaticHoliday ("25-JAN-2010", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("01-FEB-2010", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("07-JUN-2010", "Queens Birthday"); - - lh.addStaticHoliday ("25-OCT-2010", "Labour Day"); - - lh.addStaticHoliday ("27-DEC-2010", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2010", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2011", "New Years Day Observed"); - - lh.addStaticHoliday ("04-JAN-2011", "Public Holiday Observed"); - - lh.addStaticHoliday ("24-JAN-2011", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("31-JAN-2011", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Anzac Day"); - - lh.addStaticHoliday ("06-JUN-2011", "Queens Birthday"); - - lh.addStaticHoliday ("24-OCT-2011", "Labour Day"); - - lh.addStaticHoliday ("26-DEC-2011", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2011", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("03-JAN-2012", "Public Holiday Observed"); - - lh.addStaticHoliday ("23-JAN-2012", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("30-JAN-2012", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("06-FEB-2012", "Waitangi Day"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2012", "Anzac Day"); - - lh.addStaticHoliday ("04-JUN-2012", "Queens Birthday"); - - lh.addStaticHoliday ("22-OCT-2012", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2013", "Public Holiday"); - - lh.addStaticHoliday ("21-JAN-2013", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("28-JAN-2013", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("06-FEB-2013", "Waitangi Day"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2013", "Anzac Day"); - - lh.addStaticHoliday ("03-JUN-2013", "Queens Birthday"); - - lh.addStaticHoliday ("28-OCT-2013", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2014", "Public Holiday"); - - lh.addStaticHoliday ("20-JAN-2014", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("27-JAN-2014", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("06-FEB-2014", "Waitangi Day"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2014", "Anzac Day"); - - lh.addStaticHoliday ("02-JUN-2014", "Queens Birthday"); - - lh.addStaticHoliday ("27-OCT-2014", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2015", "Public Holiday"); - - lh.addStaticHoliday ("19-JAN-2015", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("26-JAN-2015", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("06-FEB-2015", "Waitangi Day"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("01-JUN-2015", "Queens Birthday"); - - lh.addStaticHoliday ("26-OCT-2015", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2015", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("04-JAN-2016", "Public Holiday Observed"); - - lh.addStaticHoliday ("25-JAN-2016", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("01-FEB-2016", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2016", "Anzac Day"); - - lh.addStaticHoliday ("06-JUN-2016", "Queens Birthday"); - - lh.addStaticHoliday ("24-OCT-2016", "Labour Day"); - - lh.addStaticHoliday ("26-DEC-2016", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2016", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("03-JAN-2017", "Public Holiday Observed"); - - lh.addStaticHoliday ("23-JAN-2017", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("30-JAN-2017", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("06-FEB-2017", "Waitangi Day"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2017", "Anzac Day"); - - lh.addStaticHoliday ("05-JUN-2017", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2017", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2018", "Public Holiday"); - - lh.addStaticHoliday ("22-JAN-2018", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("29-JAN-2018", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("06-FEB-2018", "Waitangi Day"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2018", "Anzac Day"); - - lh.addStaticHoliday ("04-JUN-2018", "Queens Birthday"); - - lh.addStaticHoliday ("22-OCT-2018", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2019", "Public Holiday"); - - lh.addStaticHoliday ("21-JAN-2019", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("28-JAN-2019", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("06-FEB-2019", "Waitangi Day"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2019", "Anzac Day"); - - lh.addStaticHoliday ("03-JUN-2019", "Queens Birthday"); - - lh.addStaticHoliday ("28-OCT-2019", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2020", "Public Holiday"); - - lh.addStaticHoliday ("20-JAN-2020", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("27-JAN-2020", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("06-FEB-2020", "Waitangi Day"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("01-JUN-2020", "Queens Birthday"); - - lh.addStaticHoliday ("26-OCT-2020", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2020", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("04-JAN-2021", "Public Holiday Observed"); - - lh.addStaticHoliday ("25-JAN-2021", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("01-FEB-2021", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("07-JUN-2021", "Queens Birthday"); - - lh.addStaticHoliday ("25-OCT-2021", "Labour Day"); - - lh.addStaticHoliday ("27-DEC-2021", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2021", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2022", "New Years Day Observed"); - - lh.addStaticHoliday ("04-JAN-2022", "Public Holiday Observed"); - - lh.addStaticHoliday ("24-JAN-2022", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("31-JAN-2022", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2022", "Anzac Day"); - - lh.addStaticHoliday ("06-JUN-2022", "Queens Birthday"); - - lh.addStaticHoliday ("24-OCT-2022", "Labour Day"); - - lh.addStaticHoliday ("26-DEC-2022", "Christmas Day Observed"); - - lh.addStaticHoliday ("27-DEC-2022", "Boxing Day Observed"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("03-JAN-2023", "Public Holiday Observed"); - - lh.addStaticHoliday ("23-JAN-2023", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("30-JAN-2023", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("06-FEB-2023", "Waitangi Day"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2023", "Anzac Day"); - - lh.addStaticHoliday ("05-JUN-2023", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2023", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2024", "Public Holiday"); - - lh.addStaticHoliday ("22-JAN-2024", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("29-JAN-2024", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("06-FEB-2024", "Waitangi Day"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2024", "Anzac Day"); - - lh.addStaticHoliday ("03-JUN-2024", "Queens Birthday"); - - lh.addStaticHoliday ("28-OCT-2024", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2025", "Public Holiday"); - - lh.addStaticHoliday ("20-JAN-2025", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("27-JAN-2025", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("06-FEB-2025", "Waitangi Day"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2025", "Anzac Day"); - - lh.addStaticHoliday ("02-JUN-2025", "Queens Birthday"); - - lh.addStaticHoliday ("27-OCT-2025", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2026", "Public Holiday"); - - lh.addStaticHoliday ("19-JAN-2026", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("26-JAN-2026", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("06-FEB-2026", "Waitangi Day"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("01-JUN-2026", "Queens Birthday"); - - lh.addStaticHoliday ("26-OCT-2026", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("28-DEC-2026", "Boxing Day Observed"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("04-JAN-2027", "Public Holiday Observed"); - - lh.addStaticHoliday ("25-JAN-2027", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("01-FEB-2027", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("07-JUN-2027", "Queens Birthday"); - - lh.addStaticHoliday ("25-OCT-2027", "Labour Day"); - - lh.addStaticHoliday ("27-DEC-2027", "Christmas Day Observed"); - - lh.addStaticHoliday ("28-DEC-2027", "Boxing Day Observed"); - - lh.addStaticHoliday ("03-JAN-2028", "New Years Day Observed"); - - lh.addStaticHoliday ("04-JAN-2028", "Public Holiday Observed"); - - lh.addStaticHoliday ("24-JAN-2028", "Wellington Anniversary Day"); - - lh.addStaticHoliday ("31-JAN-2028", "Auckland Anniversary Day"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2028", "Anzac Day"); - - lh.addStaticHoliday ("05-JUN-2028", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2028", "Labour Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Boxing Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/PABHoliday.java b/org/drip/analytics/holset/PABHoliday.java deleted file mode 100644 index facc94c..0000000 --- a/org/drip/analytics/holset/PABHoliday.java +++ /dev/null @@ -1,685 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class PABHoliday implements org.drip.analytics.holset.LocationHoliday { - public PABHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "PAB"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-1998", "Day of Mourning"); - - lh.addStaticHoliday ("23-FEB-1998", "Carnival Monday"); - - lh.addStaticHoliday ("24-FEB-1998", "Carnival Tuesday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("04-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("03-NOV-1998", "Independence from Columbia Day"); - - lh.addStaticHoliday ("04-NOV-1998", "Flag Day"); - - lh.addStaticHoliday ("09-NOV-1998", "First Cry of Independence Day"); - - lh.addStaticHoliday ("07-DEC-1998", "Mothers Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("15-FEB-1999", "Carnival Monday"); - - lh.addStaticHoliday ("16-FEB-1999", "Carnival Tuesday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("03-NOV-1999", "Independence from Columbia Day"); - - lh.addStaticHoliday ("04-NOV-1999", "Flag Day"); - - lh.addStaticHoliday ("08-NOV-1999", "First Cry of Independence Day"); - - lh.addStaticHoliday ("06-DEC-1999", "Mothers Day"); - - lh.addStaticHoliday ("06-MAR-2000", "Carnival Monday"); - - lh.addStaticHoliday ("07-MAR-2000", "Carnival Tuesday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2000", "Foundation of Panama City Day"); - - lh.addStaticHoliday ("03-NOV-2000", "Independence from Columbia Day"); - - lh.addStaticHoliday ("13-NOV-2000", "First Cry of Independence Day"); - - lh.addStaticHoliday ("27-NOV-2000", "Independence from Spain Day"); - - lh.addStaticHoliday ("11-DEC-2000", "Mothers Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2001", "Day of Mourning"); - - lh.addStaticHoliday ("26-FEB-2001", "Carnival Monday"); - - lh.addStaticHoliday ("27-FEB-2001", "Carnival Tuesday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("30-APR-2001", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2001", "Foundation of Panama City Day"); - - lh.addStaticHoliday ("26-NOV-2001", "Independence from Spain Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2002", "Day of Mourning"); - - lh.addStaticHoliday ("11-FEB-2002", "Carnival Monday"); - - lh.addStaticHoliday ("12-FEB-2002", "Carnival Tuesday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("29-APR-2002", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2002", "Foundation of Panama City Day"); - - lh.addStaticHoliday ("04-NOV-2002", "Flag Day"); - - lh.addStaticHoliday ("02-DEC-2002", "Independence from Spain Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("13-JAN-2003", "Day of Mourning"); - - lh.addStaticHoliday ("03-MAR-2003", "Carnival Monday"); - - lh.addStaticHoliday ("04-MAR-2003", "Carnival Tuesday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("05-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2003", "Foundation of Panama City Day"); - - lh.addStaticHoliday ("03-NOV-2003", "Independence from Columbia Day"); - - lh.addStaticHoliday ("04-NOV-2003", "Flag Day"); - - lh.addStaticHoliday ("10-NOV-2003", "First Cry of Independence Day"); - - lh.addStaticHoliday ("01-DEC-2003", "Independence from Spain Day"); - - lh.addStaticHoliday ("08-DEC-2003", "Mothers Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2004", "Day of Mourning"); - - lh.addStaticHoliday ("23-FEB-2004", "Carnival Monday"); - - lh.addStaticHoliday ("24-FEB-2004", "Carnival Tuesday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("03-NOV-2004", "Independence from Columbia Day"); - - lh.addStaticHoliday ("04-NOV-2004", "Flag Day"); - - lh.addStaticHoliday ("08-NOV-2004", "First Cry of Independence Day"); - - lh.addStaticHoliday ("06-DEC-2004", "Mothers Day"); - - lh.addStaticHoliday ("07-FEB-2005", "Carnival Monday"); - - lh.addStaticHoliday ("08-FEB-2005", "Carnival Tuesday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("15-AUG-2005", "Foundation of Panama City Day"); - - lh.addStaticHoliday ("03-NOV-2005", "Independence from Columbia Day"); - - lh.addStaticHoliday ("04-NOV-2005", "Flag Day"); - - lh.addStaticHoliday ("14-NOV-2005", "First Cry of Independence Day"); - - lh.addStaticHoliday ("28-NOV-2005", "Independence from Spain Day"); - - lh.addStaticHoliday ("12-DEC-2005", "Mothers Day"); - - lh.addStaticHoliday ("09-JAN-2006", "Day of Mourning"); - - lh.addStaticHoliday ("27-FEB-2006", "Carnival Monday"); - - lh.addStaticHoliday ("28-FEB-2006", "Carnival Tuesday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2006", "Foundation of Panama City Day"); - - lh.addStaticHoliday ("03-NOV-2006", "Independence from Columbia Day"); - - lh.addStaticHoliday ("13-NOV-2006", "First Cry of Independence Day"); - - lh.addStaticHoliday ("27-NOV-2006", "Independence from Spain Day"); - - lh.addStaticHoliday ("11-DEC-2006", "Mothers Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2007", "Day of Mourning"); - - lh.addStaticHoliday ("19-FEB-2007", "Carnival Monday"); - - lh.addStaticHoliday ("20-FEB-2007", "Carnival Tuesday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("30-APR-2007", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2007", "Foundation of Panama City Day"); - - lh.addStaticHoliday ("26-NOV-2007", "Independence from Spain Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2008", "Day of Mourning"); - - lh.addStaticHoliday ("04-FEB-2008", "Carnival Monday"); - - lh.addStaticHoliday ("05-FEB-2008", "Carnival Tuesday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("05-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2008", "Foundation of Panama City Day"); - - lh.addStaticHoliday ("03-NOV-2008", "Independence from Columbia Day"); - - lh.addStaticHoliday ("04-NOV-2008", "Flag Day"); - - lh.addStaticHoliday ("10-NOV-2008", "First Cry of Independence Day"); - - lh.addStaticHoliday ("01-DEC-2008", "Independence from Spain Day"); - - lh.addStaticHoliday ("08-DEC-2008", "Mothers Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2009", "Day of Mourning"); - - lh.addStaticHoliday ("23-FEB-2009", "Carnival Monday"); - - lh.addStaticHoliday ("24-FEB-2009", "Carnival Tuesday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("04-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("03-NOV-2009", "Independence from Columbia Day"); - - lh.addStaticHoliday ("04-NOV-2009", "Flag Day"); - - lh.addStaticHoliday ("09-NOV-2009", "First Cry of Independence Day"); - - lh.addStaticHoliday ("07-DEC-2009", "Mothers Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("15-FEB-2010", "Carnival Monday"); - - lh.addStaticHoliday ("16-FEB-2010", "Carnival Tuesday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("03-NOV-2010", "Independence from Columbia Day"); - - lh.addStaticHoliday ("04-NOV-2010", "Flag Day"); - - lh.addStaticHoliday ("08-NOV-2010", "First Cry of Independence Day"); - - lh.addStaticHoliday ("06-DEC-2010", "Mothers Day"); - - lh.addStaticHoliday ("07-MAR-2011", "Carnival Monday"); - - lh.addStaticHoliday ("08-MAR-2011", "Carnival Tuesday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("15-AUG-2011", "Foundation of Panama City Day"); - - lh.addStaticHoliday ("03-NOV-2011", "Independence from Columbia Day"); - - lh.addStaticHoliday ("04-NOV-2011", "Flag Day"); - - lh.addStaticHoliday ("14-NOV-2011", "First Cry of Independence Day"); - - lh.addStaticHoliday ("28-NOV-2011", "Independence from Spain Day"); - - lh.addStaticHoliday ("12-DEC-2011", "Mothers Day"); - - lh.addStaticHoliday ("09-JAN-2012", "Day of Mourning"); - - lh.addStaticHoliday ("20-FEB-2012", "Carnival Monday"); - - lh.addStaticHoliday ("21-FEB-2012", "Carnival Tuesday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("30-APR-2012", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2012", "Foundation of Panama City Day"); - - lh.addStaticHoliday ("26-NOV-2012", "Independence from Spain Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2013", "Day of Mourning"); - - lh.addStaticHoliday ("11-FEB-2013", "Carnival Monday"); - - lh.addStaticHoliday ("12-FEB-2013", "Carnival Tuesday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("29-APR-2013", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2013", "Foundation of Panama City Day"); - - lh.addStaticHoliday ("04-NOV-2013", "Flag Day"); - - lh.addStaticHoliday ("02-DEC-2013", "Independence from Spain Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("13-JAN-2014", "Day of Mourning"); - - lh.addStaticHoliday ("03-MAR-2014", "Carnival Monday"); - - lh.addStaticHoliday ("04-MAR-2014", "Carnival Tuesday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("05-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2014", "Foundation of Panama City Day"); - - lh.addStaticHoliday ("03-NOV-2014", "Independence from Columbia Day"); - - lh.addStaticHoliday ("04-NOV-2014", "Flag Day"); - - lh.addStaticHoliday ("10-NOV-2014", "First Cry of Independence Day"); - - lh.addStaticHoliday ("01-DEC-2014", "Independence from Spain Day"); - - lh.addStaticHoliday ("08-DEC-2014", "Mothers Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2015", "Day of Mourning"); - - lh.addStaticHoliday ("16-FEB-2015", "Carnival Monday"); - - lh.addStaticHoliday ("17-FEB-2015", "Carnival Tuesday"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("04-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("03-NOV-2015", "Independence from Columbia Day"); - - lh.addStaticHoliday ("04-NOV-2015", "Flag Day"); - - lh.addStaticHoliday ("09-NOV-2015", "First Cry of Independence Day"); - - lh.addStaticHoliday ("07-DEC-2015", "Mothers Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2016", "Carnival Monday"); - - lh.addStaticHoliday ("09-FEB-2016", "Carnival Tuesday"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("15-AUG-2016", "Foundation of Panama City Day"); - - lh.addStaticHoliday ("03-NOV-2016", "Independence from Columbia Day"); - - lh.addStaticHoliday ("04-NOV-2016", "Flag Day"); - - lh.addStaticHoliday ("14-NOV-2016", "First Cry of Independence Day"); - - lh.addStaticHoliday ("28-NOV-2016", "Independence from Spain Day"); - - lh.addStaticHoliday ("12-DEC-2016", "Mothers Day"); - - lh.addStaticHoliday ("09-JAN-2017", "Day of Mourning"); - - lh.addStaticHoliday ("27-FEB-2017", "Carnival Monday"); - - lh.addStaticHoliday ("28-FEB-2017", "Carnival Tuesday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2017", "Foundation of Panama City Day"); - - lh.addStaticHoliday ("03-NOV-2017", "Independence from Columbia Day"); - - lh.addStaticHoliday ("13-NOV-2017", "First Cry of Independence Day"); - - lh.addStaticHoliday ("27-NOV-2017", "Independence from Spain Day"); - - lh.addStaticHoliday ("11-DEC-2017", "Mothers Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2018", "Day of Mourning"); - - lh.addStaticHoliday ("12-FEB-2018", "Carnival Monday"); - - lh.addStaticHoliday ("13-FEB-2018", "Carnival Tuesday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("30-APR-2018", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2018", "Foundation of Panama City Day"); - - lh.addStaticHoliday ("26-NOV-2018", "Independence from Spain Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2019", "Day of Mourning"); - - lh.addStaticHoliday ("04-MAR-2019", "Carnival Monday"); - - lh.addStaticHoliday ("05-MAR-2019", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("29-APR-2019", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2019", "Foundation of Panama City Day"); - - lh.addStaticHoliday ("04-NOV-2019", "Flag Day"); - - lh.addStaticHoliday ("02-DEC-2019", "Independence from Spain Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("13-JAN-2020", "Day of Mourning"); - - lh.addStaticHoliday ("24-FEB-2020", "Carnival Monday"); - - lh.addStaticHoliday ("25-FEB-2020", "Carnival Tuesday"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("04-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("03-NOV-2020", "Independence from Columbia Day"); - - lh.addStaticHoliday ("04-NOV-2020", "Flag Day"); - - lh.addStaticHoliday ("09-NOV-2020", "First Cry of Independence Day"); - - lh.addStaticHoliday ("07-DEC-2020", "Mothers Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("15-FEB-2021", "Carnival Monday"); - - lh.addStaticHoliday ("16-FEB-2021", "Carnival Tuesday"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("03-NOV-2021", "Independence from Columbia Day"); - - lh.addStaticHoliday ("04-NOV-2021", "Flag Day"); - - lh.addStaticHoliday ("08-NOV-2021", "First Cry of Independence Day"); - - lh.addStaticHoliday ("06-DEC-2021", "Mothers Day"); - - lh.addStaticHoliday ("28-FEB-2022", "Carnival Monday"); - - lh.addStaticHoliday ("01-MAR-2022", "Carnival Tuesday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("15-AUG-2022", "Foundation of Panama City Day"); - - lh.addStaticHoliday ("03-NOV-2022", "Independence from Columbia Day"); - - lh.addStaticHoliday ("04-NOV-2022", "Flag Day"); - - lh.addStaticHoliday ("14-NOV-2022", "First Cry of Independence Day"); - - lh.addStaticHoliday ("28-NOV-2022", "Independence from Spain Day"); - - lh.addStaticHoliday ("12-DEC-2022", "Mothers Day"); - - lh.addStaticHoliday ("09-JAN-2023", "Day of Mourning"); - - lh.addStaticHoliday ("20-FEB-2023", "Carnival Monday"); - - lh.addStaticHoliday ("21-FEB-2023", "Carnival Tuesday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2023", "Foundation of Panama City Day"); - - lh.addStaticHoliday ("03-NOV-2023", "Independence from Columbia Day"); - - lh.addStaticHoliday ("13-NOV-2023", "First Cry of Independence Day"); - - lh.addStaticHoliday ("27-NOV-2023", "Independence from Spain Day"); - - lh.addStaticHoliday ("11-DEC-2023", "Mothers Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2024", "Day of Mourning"); - - lh.addStaticHoliday ("12-FEB-2024", "Carnival Monday"); - - lh.addStaticHoliday ("13-FEB-2024", "Carnival Tuesday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("29-APR-2024", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2024", "Foundation of Panama City Day"); - - lh.addStaticHoliday ("04-NOV-2024", "Flag Day"); - - lh.addStaticHoliday ("02-DEC-2024", "Independence from Spain Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("13-JAN-2025", "Day of Mourning"); - - lh.addStaticHoliday ("03-MAR-2025", "Carnival Monday"); - - lh.addStaticHoliday ("04-MAR-2025", "Carnival Tuesday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("05-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2025", "Foundation of Panama City Day"); - - lh.addStaticHoliday ("03-NOV-2025", "Independence from Columbia Day"); - - lh.addStaticHoliday ("04-NOV-2025", "Flag Day"); - - lh.addStaticHoliday ("10-NOV-2025", "First Cry of Independence Day"); - - lh.addStaticHoliday ("01-DEC-2025", "Independence from Spain Day"); - - lh.addStaticHoliday ("08-DEC-2025", "Mothers Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2026", "Day of Mourning"); - - lh.addStaticHoliday ("16-FEB-2026", "Carnival Monday"); - - lh.addStaticHoliday ("17-FEB-2026", "Carnival Tuesday"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("04-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("03-NOV-2026", "Independence from Columbia Day"); - - lh.addStaticHoliday ("04-NOV-2026", "Flag Day"); - - lh.addStaticHoliday ("09-NOV-2026", "First Cry of Independence Day"); - - lh.addStaticHoliday ("07-DEC-2026", "Mothers Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2027", "Carnival Monday"); - - lh.addStaticHoliday ("09-FEB-2027", "Carnival Tuesday"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("03-NOV-2027", "Independence from Columbia Day"); - - lh.addStaticHoliday ("04-NOV-2027", "Flag Day"); - - lh.addStaticHoliday ("08-NOV-2027", "First Cry of Independence Day"); - - lh.addStaticHoliday ("06-DEC-2027", "Mothers Day"); - - lh.addStaticHoliday ("28-FEB-2028", "Carnival Monday"); - - lh.addStaticHoliday ("29-FEB-2028", "Carnival Tuesday"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("15-AUG-2028", "Foundation of Panama City Day"); - - lh.addStaticHoliday ("03-NOV-2028", "Independence from Columbia Day"); - - lh.addStaticHoliday ("13-NOV-2028", "First Cry of Independence Day"); - - lh.addStaticHoliday ("27-NOV-2028", "Independence from Spain Day"); - - lh.addStaticHoliday ("11-DEC-2028", "Mothers Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/PEFHoliday.java b/org/drip/analytics/holset/PEFHoliday.java deleted file mode 100644 index 6ab833e..0000000 --- a/org/drip/analytics/holset/PEFHoliday.java +++ /dev/null @@ -1,1231 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class PEFHoliday implements org.drip.analytics.holset.LocationHoliday { - public PEFHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "PEF"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("09-APR-1998", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-1998", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-1998", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-1998", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-1998", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-1998", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-1999", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-1999", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-1999", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-1999", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-1999", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-1999", "Immaculate Conception"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2000", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2000", "Peruvian Day"); - - lh.addStaticHoliday ("30-AUG-2000", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2000", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2001", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("30-AUG-2001", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2001", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("29-JUL-2002", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2002", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2002", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("28-JUL-2003", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2003", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2003", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-2004", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2004", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2004", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2004", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2004", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2004", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-2005", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2005", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2005", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2005", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2005", "Immaculate Conception"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2006", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2006", "Peruvian Day"); - - lh.addStaticHoliday ("30-AUG-2006", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2006", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2007", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("30-AUG-2007", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2007", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("15-MAY-2008", ""); - - lh.addStaticHoliday ("16-MAY-2008", ""); - - lh.addStaticHoliday ("28-JUL-2008", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2008", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2008", "Combate de Angamos"); - - lh.addStaticHoliday ("20-NOV-2008", "APEC Summit"); - - lh.addStaticHoliday ("21-NOV-2008", "APEC Summit"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2009", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("27-JUL-2009", "Civil Servants holiday"); - - lh.addStaticHoliday ("28-JUL-2009", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2009", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2009", "Combate de Angamos"); - - lh.addStaticHoliday ("09-OCT-2009", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-2009", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2009", "Christmas Eve Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2009", "New Years Eve Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2010", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-2010", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2010", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2010", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2010", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2010", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2010", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2010", "Immaculate Conception"); - - lh.addStaticHoliday ("21-APR-2011", "Holy Thursday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-2011", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2011", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2011", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2011", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2011", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2011", "Immaculate Conception"); - - lh.addStaticHoliday ("05-APR-2012", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2012", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("30-AUG-2012", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2012", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2012", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2013", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("29-JUL-2013", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2013", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2013", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2013", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("17-APR-2014", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("28-JUL-2014", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2014", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2014", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-2014", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2015", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2015", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2015", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2015", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2015", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-2015", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2016", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-2016", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2016", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2016", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2016", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2016", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2016", "Immaculate Conception"); - - lh.addStaticHoliday ("13-APR-2017", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2017", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2017", "Peruvian Day"); - - lh.addStaticHoliday ("30-AUG-2017", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2017", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2017", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2018", "Holy Thursday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2018", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("30-AUG-2018", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2018", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2018", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2019", "Holy Thursday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("29-JUL-2019", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2019", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2019", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2019", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2020", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2020", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2020", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2020", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2020", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-2020", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2021", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-2021", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2021", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2021", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2021", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2021", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2021", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2021", "Immaculate Conception"); - - lh.addStaticHoliday ("14-APR-2022", "Holy Thursday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-2022", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2022", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2022", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2022", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2022", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2022", "Immaculate Conception"); - - lh.addStaticHoliday ("06-APR-2023", "Holy Thursday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2023", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2023", "Peruvian Day"); - - lh.addStaticHoliday ("30-AUG-2023", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2023", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2023", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2024", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("29-JUL-2024", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2024", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2024", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2024", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("17-APR-2025", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("28-JUL-2025", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2025", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2025", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-2025", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2026", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2026", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2026", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2026", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2026", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-2026", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("25-MAR-2027", "Holy Thursday"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-2027", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2027", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2027", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2027", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2027", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2027", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2027", "Immaculate Conception"); - - lh.addStaticHoliday ("13-APR-2028", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2028", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2028", "Peruvian Day"); - - lh.addStaticHoliday ("30-AUG-2028", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2028", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2028", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2029", "PEN"); - - lh.addStaticHoliday ("29-MAR-2029", "PEN"); - - lh.addStaticHoliday ("30-MAR-2029", "PEN"); - - lh.addStaticHoliday ("01-MAY-2029", "PEN"); - - lh.addStaticHoliday ("29-JUN-2029", "PEN"); - - lh.addStaticHoliday ("30-AUG-2029", "PEN"); - - lh.addStaticHoliday ("08-OCT-2029", "PEN"); - - lh.addStaticHoliday ("01-NOV-2029", "PEN"); - - lh.addStaticHoliday ("25-DEC-2029", "PEN"); - - lh.addStaticHoliday ("01-JAN-2030", "PEN"); - - lh.addStaticHoliday ("18-APR-2030", "PEN"); - - lh.addStaticHoliday ("19-APR-2030", "PEN"); - - lh.addStaticHoliday ("01-MAY-2030", "PEN"); - - lh.addStaticHoliday ("29-JUL-2030", "PEN"); - - lh.addStaticHoliday ("30-AUG-2030", "PEN"); - - lh.addStaticHoliday ("08-OCT-2030", "PEN"); - - lh.addStaticHoliday ("01-NOV-2030", "PEN"); - - lh.addStaticHoliday ("25-DEC-2030", "PEN"); - - lh.addStaticHoliday ("01-JAN-2031", "PEN"); - - lh.addStaticHoliday ("10-APR-2031", "PEN"); - - lh.addStaticHoliday ("11-APR-2031", "PEN"); - - lh.addStaticHoliday ("01-MAY-2031", "PEN"); - - lh.addStaticHoliday ("28-JUL-2031", "PEN"); - - lh.addStaticHoliday ("29-JUL-2031", "PEN"); - - lh.addStaticHoliday ("08-OCT-2031", "PEN"); - - lh.addStaticHoliday ("08-DEC-2031", "PEN"); - - lh.addStaticHoliday ("25-DEC-2031", "PEN"); - - lh.addStaticHoliday ("01-JAN-2032", "PEN"); - - lh.addStaticHoliday ("25-MAR-2032", "PEN"); - - lh.addStaticHoliday ("26-MAR-2032", "PEN"); - - lh.addStaticHoliday ("29-JUN-2032", "PEN"); - - lh.addStaticHoliday ("28-JUL-2032", "PEN"); - - lh.addStaticHoliday ("29-JUL-2032", "PEN"); - - lh.addStaticHoliday ("30-AUG-2032", "PEN"); - - lh.addStaticHoliday ("08-OCT-2032", "PEN"); - - lh.addStaticHoliday ("01-NOV-2032", "PEN"); - - lh.addStaticHoliday ("08-DEC-2032", "PEN"); - - lh.addStaticHoliday ("14-APR-2033", "PEN"); - - lh.addStaticHoliday ("15-APR-2033", "PEN"); - - lh.addStaticHoliday ("29-JUN-2033", "PEN"); - - lh.addStaticHoliday ("28-JUL-2033", "PEN"); - - lh.addStaticHoliday ("29-JUL-2033", "PEN"); - - lh.addStaticHoliday ("30-AUG-2033", "PEN"); - - lh.addStaticHoliday ("01-NOV-2033", "PEN"); - - lh.addStaticHoliday ("08-DEC-2033", "PEN"); - - lh.addStaticHoliday ("06-APR-2034", "PEN"); - - lh.addStaticHoliday ("07-APR-2034", "PEN"); - - lh.addStaticHoliday ("01-MAY-2034", "PEN"); - - lh.addStaticHoliday ("29-JUN-2034", "PEN"); - - lh.addStaticHoliday ("28-JUL-2034", "PEN"); - - lh.addStaticHoliday ("30-AUG-2034", "PEN"); - - lh.addStaticHoliday ("01-NOV-2034", "PEN"); - - lh.addStaticHoliday ("08-DEC-2034", "PEN"); - - lh.addStaticHoliday ("25-DEC-2034", "PEN"); - - lh.addStaticHoliday ("01-JAN-2035", "PEN"); - - lh.addStaticHoliday ("22-MAR-2035", "PEN"); - - lh.addStaticHoliday ("23-MAR-2035", "PEN"); - - lh.addStaticHoliday ("01-MAY-2035", "PEN"); - - lh.addStaticHoliday ("29-JUN-2035", "PEN"); - - lh.addStaticHoliday ("30-AUG-2035", "PEN"); - - lh.addStaticHoliday ("08-OCT-2035", "PEN"); - - lh.addStaticHoliday ("01-NOV-2035", "PEN"); - - lh.addStaticHoliday ("25-DEC-2035", "PEN"); - - lh.addStaticHoliday ("01-JAN-2036", "PEN"); - - lh.addStaticHoliday ("10-APR-2036", "PEN"); - - lh.addStaticHoliday ("11-APR-2036", "PEN"); - - lh.addStaticHoliday ("01-MAY-2036", "PEN"); - - lh.addStaticHoliday ("28-JUL-2036", "PEN"); - - lh.addStaticHoliday ("29-JUL-2036", "PEN"); - - lh.addStaticHoliday ("08-OCT-2036", "PEN"); - - lh.addStaticHoliday ("08-DEC-2036", "PEN"); - - lh.addStaticHoliday ("25-DEC-2036", "PEN"); - - lh.addStaticHoliday ("01-JAN-2037", "PEN"); - - lh.addStaticHoliday ("02-APR-2037", "PEN"); - - lh.addStaticHoliday ("03-APR-2037", "PEN"); - - lh.addStaticHoliday ("01-MAY-2037", "PEN"); - - lh.addStaticHoliday ("29-JUN-2037", "PEN"); - - lh.addStaticHoliday ("28-JUL-2037", "PEN"); - - lh.addStaticHoliday ("29-JUL-2037", "PEN"); - - lh.addStaticHoliday ("08-OCT-2037", "PEN"); - - lh.addStaticHoliday ("08-DEC-2037", "PEN"); - - lh.addStaticHoliday ("25-DEC-2037", "PEN"); - - lh.addStaticHoliday ("01-JAN-2038", "PEN"); - - lh.addStaticHoliday ("22-APR-2038", "PEN"); - - lh.addStaticHoliday ("23-APR-2038", "PEN"); - - lh.addStaticHoliday ("29-JUN-2038", "PEN"); - - lh.addStaticHoliday ("28-JUL-2038", "PEN"); - - lh.addStaticHoliday ("29-JUL-2038", "PEN"); - - lh.addStaticHoliday ("30-AUG-2038", "PEN"); - - lh.addStaticHoliday ("08-OCT-2038", "PEN"); - - lh.addStaticHoliday ("01-NOV-2038", "PEN"); - - lh.addStaticHoliday ("08-DEC-2038", "PEN"); - - lh.addStaticHoliday ("07-APR-2039", "PEN"); - - lh.addStaticHoliday ("08-APR-2039", "PEN"); - - lh.addStaticHoliday ("29-JUN-2039", "PEN"); - - lh.addStaticHoliday ("28-JUL-2039", "PEN"); - - lh.addStaticHoliday ("29-JUL-2039", "PEN"); - - lh.addStaticHoliday ("30-AUG-2039", "PEN"); - - lh.addStaticHoliday ("01-NOV-2039", "PEN"); - - lh.addStaticHoliday ("08-DEC-2039", "PEN"); - - lh.addStaticHoliday ("29-MAR-2040", "PEN"); - - lh.addStaticHoliday ("30-MAR-2040", "PEN"); - - lh.addStaticHoliday ("01-MAY-2040", "PEN"); - - lh.addStaticHoliday ("29-JUN-2040", "PEN"); - - lh.addStaticHoliday ("30-AUG-2040", "PEN"); - - lh.addStaticHoliday ("08-OCT-2040", "PEN"); - - lh.addStaticHoliday ("01-NOV-2040", "PEN"); - - lh.addStaticHoliday ("25-DEC-2040", "PEN"); - - lh.addStaticHoliday ("01-JAN-2041", "PEN"); - - lh.addStaticHoliday ("18-APR-2041", "PEN"); - - lh.addStaticHoliday ("19-APR-2041", "PEN"); - - lh.addStaticHoliday ("01-MAY-2041", "PEN"); - - lh.addStaticHoliday ("29-JUL-2041", "PEN"); - - lh.addStaticHoliday ("30-AUG-2041", "PEN"); - - lh.addStaticHoliday ("08-OCT-2041", "PEN"); - - lh.addStaticHoliday ("01-NOV-2041", "PEN"); - - lh.addStaticHoliday ("25-DEC-2041", "PEN"); - - lh.addStaticHoliday ("01-JAN-2042", "PEN"); - - lh.addStaticHoliday ("03-APR-2042", "PEN"); - - lh.addStaticHoliday ("04-APR-2042", "PEN"); - - lh.addStaticHoliday ("01-MAY-2042", "PEN"); - - lh.addStaticHoliday ("28-JUL-2042", "PEN"); - - lh.addStaticHoliday ("29-JUL-2042", "PEN"); - - lh.addStaticHoliday ("08-OCT-2042", "PEN"); - - lh.addStaticHoliday ("08-DEC-2042", "PEN"); - - lh.addStaticHoliday ("25-DEC-2042", "PEN"); - - lh.addStaticHoliday ("01-JAN-2043", "PEN"); - - lh.addStaticHoliday ("26-MAR-2043", "PEN"); - - lh.addStaticHoliday ("27-MAR-2043", "PEN"); - - lh.addStaticHoliday ("01-MAY-2043", "PEN"); - - lh.addStaticHoliday ("29-JUN-2043", "PEN"); - - lh.addStaticHoliday ("28-JUL-2043", "PEN"); - - lh.addStaticHoliday ("29-JUL-2043", "PEN"); - - lh.addStaticHoliday ("08-OCT-2043", "PEN"); - - lh.addStaticHoliday ("08-DEC-2043", "PEN"); - - lh.addStaticHoliday ("25-DEC-2043", "PEN"); - - lh.addStaticHoliday ("01-JAN-2044", "PEN"); - - lh.addStaticHoliday ("14-APR-2044", "PEN"); - - lh.addStaticHoliday ("15-APR-2044", "PEN"); - - lh.addStaticHoliday ("29-JUN-2044", "PEN"); - - lh.addStaticHoliday ("28-JUL-2044", "PEN"); - - lh.addStaticHoliday ("29-JUL-2044", "PEN"); - - lh.addStaticHoliday ("30-AUG-2044", "PEN"); - - lh.addStaticHoliday ("01-NOV-2044", "PEN"); - - lh.addStaticHoliday ("08-DEC-2044", "PEN"); - - lh.addStaticHoliday ("06-APR-2045", "PEN"); - - lh.addStaticHoliday ("07-APR-2045", "PEN"); - - lh.addStaticHoliday ("01-MAY-2045", "PEN"); - - lh.addStaticHoliday ("29-JUN-2045", "PEN"); - - lh.addStaticHoliday ("28-JUL-2045", "PEN"); - - lh.addStaticHoliday ("30-AUG-2045", "PEN"); - - lh.addStaticHoliday ("01-NOV-2045", "PEN"); - - lh.addStaticHoliday ("08-DEC-2045", "PEN"); - - lh.addStaticHoliday ("25-DEC-2045", "PEN"); - - lh.addStaticHoliday ("01-JAN-2046", "PEN"); - - lh.addStaticHoliday ("22-MAR-2046", "PEN"); - - lh.addStaticHoliday ("23-MAR-2046", "PEN"); - - lh.addStaticHoliday ("01-MAY-2046", "PEN"); - - lh.addStaticHoliday ("29-JUN-2046", "PEN"); - - lh.addStaticHoliday ("30-AUG-2046", "PEN"); - - lh.addStaticHoliday ("08-OCT-2046", "PEN"); - - lh.addStaticHoliday ("01-NOV-2046", "PEN"); - - lh.addStaticHoliday ("25-DEC-2046", "PEN"); - - lh.addStaticHoliday ("01-JAN-2047", "PEN"); - - lh.addStaticHoliday ("11-APR-2047", "PEN"); - - lh.addStaticHoliday ("12-APR-2047", "PEN"); - - lh.addStaticHoliday ("01-MAY-2047", "PEN"); - - lh.addStaticHoliday ("29-JUL-2047", "PEN"); - - lh.addStaticHoliday ("30-AUG-2047", "PEN"); - - lh.addStaticHoliday ("08-OCT-2047", "PEN"); - - lh.addStaticHoliday ("01-NOV-2047", "PEN"); - - lh.addStaticHoliday ("25-DEC-2047", "PEN"); - - lh.addStaticHoliday ("01-JAN-2048", "PEN"); - - lh.addStaticHoliday ("02-APR-2048", "PEN"); - - lh.addStaticHoliday ("03-APR-2048", "PEN"); - - lh.addStaticHoliday ("01-MAY-2048", "PEN"); - - lh.addStaticHoliday ("29-JUN-2048", "PEN"); - - lh.addStaticHoliday ("28-JUL-2048", "PEN"); - - lh.addStaticHoliday ("29-JUL-2048", "PEN"); - - lh.addStaticHoliday ("08-OCT-2048", "PEN"); - - lh.addStaticHoliday ("08-DEC-2048", "PEN"); - - lh.addStaticHoliday ("25-DEC-2048", "PEN"); - - lh.addStaticHoliday ("01-JAN-2049", "PEN"); - - lh.addStaticHoliday ("15-APR-2049", "PEN"); - - lh.addStaticHoliday ("16-APR-2049", "PEN"); - - lh.addStaticHoliday ("29-JUN-2049", "PEN"); - - lh.addStaticHoliday ("28-JUL-2049", "PEN"); - - lh.addStaticHoliday ("29-JUL-2049", "PEN"); - - lh.addStaticHoliday ("30-AUG-2049", "PEN"); - - lh.addStaticHoliday ("08-OCT-2049", "PEN"); - - lh.addStaticHoliday ("01-NOV-2049", "PEN"); - - lh.addStaticHoliday ("08-DEC-2049", "PEN"); - - lh.addStaticHoliday ("07-APR-2050", "PEN"); - - lh.addStaticHoliday ("08-APR-2050", "PEN"); - - lh.addStaticHoliday ("29-JUN-2050", "PEN"); - - lh.addStaticHoliday ("28-JUL-2050", "PEN"); - - lh.addStaticHoliday ("29-JUL-2050", "PEN"); - - lh.addStaticHoliday ("30-AUG-2050", "PEN"); - - lh.addStaticHoliday ("01-NOV-2050", "PEN"); - - lh.addStaticHoliday ("08-DEC-2050", "PEN"); - - lh.addStaticHoliday ("30-MAR-2051", "PEN"); - - lh.addStaticHoliday ("31-MAR-2051", "PEN"); - - lh.addStaticHoliday ("01-MAY-2051", "PEN"); - - lh.addStaticHoliday ("29-JUN-2051", "PEN"); - - lh.addStaticHoliday ("28-JUL-2051", "PEN"); - - lh.addStaticHoliday ("30-AUG-2051", "PEN"); - - lh.addStaticHoliday ("01-NOV-2051", "PEN"); - - lh.addStaticHoliday ("08-DEC-2051", "PEN"); - - lh.addStaticHoliday ("25-DEC-2051", "PEN"); - - lh.addStaticHoliday ("01-JAN-2052", "PEN"); - - lh.addStaticHoliday ("18-APR-2052", "PEN"); - - lh.addStaticHoliday ("19-APR-2052", "PEN"); - - lh.addStaticHoliday ("01-MAY-2052", "PEN"); - - lh.addStaticHoliday ("29-JUL-2052", "PEN"); - - lh.addStaticHoliday ("30-AUG-2052", "PEN"); - - lh.addStaticHoliday ("08-OCT-2052", "PEN"); - - lh.addStaticHoliday ("01-NOV-2052", "PEN"); - - lh.addStaticHoliday ("25-DEC-2052", "PEN"); - - lh.addStaticHoliday ("01-JAN-2053", "PEN"); - - lh.addStaticHoliday ("03-APR-2053", "PEN"); - - lh.addStaticHoliday ("04-APR-2053", "PEN"); - - lh.addStaticHoliday ("01-MAY-2053", "PEN"); - - lh.addStaticHoliday ("28-JUL-2053", "PEN"); - - lh.addStaticHoliday ("29-JUL-2053", "PEN"); - - lh.addStaticHoliday ("08-OCT-2053", "PEN"); - - lh.addStaticHoliday ("08-DEC-2053", "PEN"); - - lh.addStaticHoliday ("25-DEC-2053", "PEN"); - - lh.addStaticHoliday ("01-JAN-2054", "PEN"); - - lh.addStaticHoliday ("26-MAR-2054", "PEN"); - - lh.addStaticHoliday ("27-MAR-2054", "PEN"); - - lh.addStaticHoliday ("01-MAY-2054", "PEN"); - - lh.addStaticHoliday ("29-JUN-2054", "PEN"); - - lh.addStaticHoliday ("28-JUL-2054", "PEN"); - - lh.addStaticHoliday ("29-JUL-2054", "PEN"); - - lh.addStaticHoliday ("08-OCT-2054", "PEN"); - - lh.addStaticHoliday ("08-DEC-2054", "PEN"); - - lh.addStaticHoliday ("25-DEC-2054", "PEN"); - - lh.addStaticHoliday ("01-JAN-2055", "PEN"); - - lh.addStaticHoliday ("15-APR-2055", "PEN"); - - lh.addStaticHoliday ("16-APR-2055", "PEN"); - - lh.addStaticHoliday ("29-JUN-2055", "PEN"); - - lh.addStaticHoliday ("28-JUL-2055", "PEN"); - - lh.addStaticHoliday ("29-JUL-2055", "PEN"); - - lh.addStaticHoliday ("30-AUG-2055", "PEN"); - - lh.addStaticHoliday ("08-OCT-2055", "PEN"); - - lh.addStaticHoliday ("01-NOV-2055", "PEN"); - - lh.addStaticHoliday ("08-DEC-2055", "PEN"); - - lh.addStaticHoliday ("30-MAR-2056", "PEN"); - - lh.addStaticHoliday ("31-MAR-2056", "PEN"); - - lh.addStaticHoliday ("01-MAY-2056", "PEN"); - - lh.addStaticHoliday ("29-JUN-2056", "PEN"); - - lh.addStaticHoliday ("28-JUL-2056", "PEN"); - - lh.addStaticHoliday ("30-AUG-2056", "PEN"); - - lh.addStaticHoliday ("01-NOV-2056", "PEN"); - - lh.addStaticHoliday ("08-DEC-2056", "PEN"); - - lh.addStaticHoliday ("25-DEC-2056", "PEN"); - - lh.addStaticHoliday ("01-JAN-2057", "PEN"); - - lh.addStaticHoliday ("19-APR-2057", "PEN"); - - lh.addStaticHoliday ("20-APR-2057", "PEN"); - - lh.addStaticHoliday ("01-MAY-2057", "PEN"); - - lh.addStaticHoliday ("29-JUN-2057", "PEN"); - - lh.addStaticHoliday ("30-AUG-2057", "PEN"); - - lh.addStaticHoliday ("08-OCT-2057", "PEN"); - - lh.addStaticHoliday ("01-NOV-2057", "PEN"); - - lh.addStaticHoliday ("25-DEC-2057", "PEN"); - - lh.addStaticHoliday ("01-JAN-2058", "PEN"); - - lh.addStaticHoliday ("11-APR-2058", "PEN"); - - lh.addStaticHoliday ("12-APR-2058", "PEN"); - - lh.addStaticHoliday ("01-MAY-2058", "PEN"); - - lh.addStaticHoliday ("29-JUL-2058", "PEN"); - - lh.addStaticHoliday ("30-AUG-2058", "PEN"); - - lh.addStaticHoliday ("08-OCT-2058", "PEN"); - - lh.addStaticHoliday ("01-NOV-2058", "PEN"); - - lh.addStaticHoliday ("25-DEC-2058", "PEN"); - - lh.addStaticHoliday ("01-JAN-2059", "PEN"); - - lh.addStaticHoliday ("27-MAR-2059", "PEN"); - - lh.addStaticHoliday ("28-MAR-2059", "PEN"); - - lh.addStaticHoliday ("01-MAY-2059", "PEN"); - - lh.addStaticHoliday ("28-JUL-2059", "PEN"); - - lh.addStaticHoliday ("29-JUL-2059", "PEN"); - - lh.addStaticHoliday ("08-OCT-2059", "PEN"); - - lh.addStaticHoliday ("08-DEC-2059", "PEN"); - - lh.addStaticHoliday ("25-DEC-2059", "PEN"); - - lh.addStaticHoliday ("01-JAN-2060", "PEN"); - - lh.addStaticHoliday ("15-APR-2060", "PEN"); - - lh.addStaticHoliday ("16-APR-2060", "PEN"); - - lh.addStaticHoliday ("29-JUN-2060", "PEN"); - - lh.addStaticHoliday ("28-JUL-2060", "PEN"); - - lh.addStaticHoliday ("29-JUL-2060", "PEN"); - - lh.addStaticHoliday ("30-AUG-2060", "PEN"); - - lh.addStaticHoliday ("08-OCT-2060", "PEN"); - - lh.addStaticHoliday ("01-NOV-2060", "PEN"); - - lh.addStaticHoliday ("08-DEC-2060", "PEN"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/PENHoliday.java b/org/drip/analytics/holset/PENHoliday.java deleted file mode 100644 index 8287ef4..0000000 --- a/org/drip/analytics/holset/PENHoliday.java +++ /dev/null @@ -1,1237 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class PENHoliday implements org.drip.analytics.holset.LocationHoliday { - public PENHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "PEN"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("09-APR-1998", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-1998", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-1998", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-1998", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-1998", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-1998", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-1999", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-1999", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-1999", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-1999", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-1999", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-1999", "Immaculate Conception"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2000", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2000", "Peruvian Day"); - - lh.addStaticHoliday ("30-AUG-2000", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2000", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2001", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("30-AUG-2001", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2001", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("29-JUL-2002", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2002", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2002", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("28-JUL-2003", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2003", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2003", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-2004", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2004", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2004", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2004", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2004", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2004", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-2005", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2005", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2005", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2005", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2005", "Immaculate Conception"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2006", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2006", "Peruvian Day"); - - lh.addStaticHoliday ("30-AUG-2006", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2006", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2007", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("30-AUG-2007", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2007", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("15-MAY-2008", ""); - - lh.addStaticHoliday ("16-MAY-2008", ""); - - lh.addStaticHoliday ("28-JUL-2008", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2008", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2008", "Combate de Angamos"); - - lh.addStaticHoliday ("20-NOV-2008", "APEC Summit"); - - lh.addStaticHoliday ("21-NOV-2008", "APEC Summit"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2009", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("27-JUL-2009", "Civil Servants holiday"); - - lh.addStaticHoliday ("28-JUL-2009", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2009", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2009", "Combate de Angamos"); - - lh.addStaticHoliday ("09-OCT-2009", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-2009", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2009", "Christmas Eve Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2009", "New Years Eve Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2010", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("28-JUN-2010", "Country Holiday"); - - lh.addStaticHoliday ("29-JUN-2010", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2010", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2010", "Independence Day"); - - lh.addStaticHoliday ("30-JUL-2010", "Country Holiday"); - - lh.addStaticHoliday ("30-AUG-2010", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2010", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2010", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2010", "Immaculate Conception"); - - lh.addStaticHoliday ("21-APR-2011", "Holy Thursday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("02-MAY-2011", "Labor Day"); - - lh.addStaticHoliday ("29-JUN-2011", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2011", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2011", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2011", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2011", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2011", "Immaculate Conception"); - - lh.addStaticHoliday ("05-APR-2012", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2012", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("30-AUG-2012", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2012", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2012", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2013", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("29-JUL-2013", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2013", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2013", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2013", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("17-APR-2014", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("28-JUL-2014", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2014", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2014", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-2014", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2015", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2015", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2015", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2015", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2015", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-2015", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2016", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-2016", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2016", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2016", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2016", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2016", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2016", "Immaculate Conception"); - - lh.addStaticHoliday ("13-APR-2017", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2017", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2017", "Peruvian Day"); - - lh.addStaticHoliday ("30-AUG-2017", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2017", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2017", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2018", "Holy Thursday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2018", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("30-AUG-2018", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2018", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2018", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2019", "Holy Thursday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("29-JUL-2019", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2019", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2019", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2019", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2020", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2020", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2020", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2020", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2020", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-2020", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2021", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-2021", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2021", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2021", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2021", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2021", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2021", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2021", "Immaculate Conception"); - - lh.addStaticHoliday ("14-APR-2022", "Holy Thursday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-2022", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2022", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2022", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2022", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2022", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2022", "Immaculate Conception"); - - lh.addStaticHoliday ("06-APR-2023", "Holy Thursday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2023", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2023", "Peruvian Day"); - - lh.addStaticHoliday ("30-AUG-2023", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2023", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2023", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2024", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("29-JUL-2024", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2024", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2024", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2024", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("17-APR-2025", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("28-JUL-2025", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2025", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2025", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-2025", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2026", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2026", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2026", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2026", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2026", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-2026", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("25-MAR-2027", "Holy Thursday"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-2027", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2027", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2027", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2027", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2027", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2027", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2027", "Immaculate Conception"); - - lh.addStaticHoliday ("13-APR-2028", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2028", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2028", "Peruvian Day"); - - lh.addStaticHoliday ("30-AUG-2028", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2028", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2028", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2029", "PEN"); - - lh.addStaticHoliday ("29-MAR-2029", "PEN"); - - lh.addStaticHoliday ("30-MAR-2029", "PEN"); - - lh.addStaticHoliday ("01-MAY-2029", "PEN"); - - lh.addStaticHoliday ("29-JUN-2029", "PEN"); - - lh.addStaticHoliday ("30-AUG-2029", "PEN"); - - lh.addStaticHoliday ("08-OCT-2029", "PEN"); - - lh.addStaticHoliday ("01-NOV-2029", "PEN"); - - lh.addStaticHoliday ("25-DEC-2029", "PEN"); - - lh.addStaticHoliday ("01-JAN-2030", "PEN"); - - lh.addStaticHoliday ("18-APR-2030", "PEN"); - - lh.addStaticHoliday ("19-APR-2030", "PEN"); - - lh.addStaticHoliday ("01-MAY-2030", "PEN"); - - lh.addStaticHoliday ("29-JUL-2030", "PEN"); - - lh.addStaticHoliday ("30-AUG-2030", "PEN"); - - lh.addStaticHoliday ("08-OCT-2030", "PEN"); - - lh.addStaticHoliday ("01-NOV-2030", "PEN"); - - lh.addStaticHoliday ("25-DEC-2030", "PEN"); - - lh.addStaticHoliday ("01-JAN-2031", "PEN"); - - lh.addStaticHoliday ("10-APR-2031", "PEN"); - - lh.addStaticHoliday ("11-APR-2031", "PEN"); - - lh.addStaticHoliday ("01-MAY-2031", "PEN"); - - lh.addStaticHoliday ("28-JUL-2031", "PEN"); - - lh.addStaticHoliday ("29-JUL-2031", "PEN"); - - lh.addStaticHoliday ("08-OCT-2031", "PEN"); - - lh.addStaticHoliday ("08-DEC-2031", "PEN"); - - lh.addStaticHoliday ("25-DEC-2031", "PEN"); - - lh.addStaticHoliday ("01-JAN-2032", "PEN"); - - lh.addStaticHoliday ("25-MAR-2032", "PEN"); - - lh.addStaticHoliday ("26-MAR-2032", "PEN"); - - lh.addStaticHoliday ("29-JUN-2032", "PEN"); - - lh.addStaticHoliday ("28-JUL-2032", "PEN"); - - lh.addStaticHoliday ("29-JUL-2032", "PEN"); - - lh.addStaticHoliday ("30-AUG-2032", "PEN"); - - lh.addStaticHoliday ("08-OCT-2032", "PEN"); - - lh.addStaticHoliday ("01-NOV-2032", "PEN"); - - lh.addStaticHoliday ("08-DEC-2032", "PEN"); - - lh.addStaticHoliday ("14-APR-2033", "PEN"); - - lh.addStaticHoliday ("15-APR-2033", "PEN"); - - lh.addStaticHoliday ("29-JUN-2033", "PEN"); - - lh.addStaticHoliday ("28-JUL-2033", "PEN"); - - lh.addStaticHoliday ("29-JUL-2033", "PEN"); - - lh.addStaticHoliday ("30-AUG-2033", "PEN"); - - lh.addStaticHoliday ("01-NOV-2033", "PEN"); - - lh.addStaticHoliday ("08-DEC-2033", "PEN"); - - lh.addStaticHoliday ("06-APR-2034", "PEN"); - - lh.addStaticHoliday ("07-APR-2034", "PEN"); - - lh.addStaticHoliday ("01-MAY-2034", "PEN"); - - lh.addStaticHoliday ("29-JUN-2034", "PEN"); - - lh.addStaticHoliday ("28-JUL-2034", "PEN"); - - lh.addStaticHoliday ("30-AUG-2034", "PEN"); - - lh.addStaticHoliday ("01-NOV-2034", "PEN"); - - lh.addStaticHoliday ("08-DEC-2034", "PEN"); - - lh.addStaticHoliday ("25-DEC-2034", "PEN"); - - lh.addStaticHoliday ("01-JAN-2035", "PEN"); - - lh.addStaticHoliday ("22-MAR-2035", "PEN"); - - lh.addStaticHoliday ("23-MAR-2035", "PEN"); - - lh.addStaticHoliday ("01-MAY-2035", "PEN"); - - lh.addStaticHoliday ("29-JUN-2035", "PEN"); - - lh.addStaticHoliday ("30-AUG-2035", "PEN"); - - lh.addStaticHoliday ("08-OCT-2035", "PEN"); - - lh.addStaticHoliday ("01-NOV-2035", "PEN"); - - lh.addStaticHoliday ("25-DEC-2035", "PEN"); - - lh.addStaticHoliday ("01-JAN-2036", "PEN"); - - lh.addStaticHoliday ("10-APR-2036", "PEN"); - - lh.addStaticHoliday ("11-APR-2036", "PEN"); - - lh.addStaticHoliday ("01-MAY-2036", "PEN"); - - lh.addStaticHoliday ("28-JUL-2036", "PEN"); - - lh.addStaticHoliday ("29-JUL-2036", "PEN"); - - lh.addStaticHoliday ("08-OCT-2036", "PEN"); - - lh.addStaticHoliday ("08-DEC-2036", "PEN"); - - lh.addStaticHoliday ("25-DEC-2036", "PEN"); - - lh.addStaticHoliday ("01-JAN-2037", "PEN"); - - lh.addStaticHoliday ("02-APR-2037", "PEN"); - - lh.addStaticHoliday ("03-APR-2037", "PEN"); - - lh.addStaticHoliday ("01-MAY-2037", "PEN"); - - lh.addStaticHoliday ("29-JUN-2037", "PEN"); - - lh.addStaticHoliday ("28-JUL-2037", "PEN"); - - lh.addStaticHoliday ("29-JUL-2037", "PEN"); - - lh.addStaticHoliday ("08-OCT-2037", "PEN"); - - lh.addStaticHoliday ("08-DEC-2037", "PEN"); - - lh.addStaticHoliday ("25-DEC-2037", "PEN"); - - lh.addStaticHoliday ("01-JAN-2038", "PEN"); - - lh.addStaticHoliday ("22-APR-2038", "PEN"); - - lh.addStaticHoliday ("23-APR-2038", "PEN"); - - lh.addStaticHoliday ("29-JUN-2038", "PEN"); - - lh.addStaticHoliday ("28-JUL-2038", "PEN"); - - lh.addStaticHoliday ("29-JUL-2038", "PEN"); - - lh.addStaticHoliday ("30-AUG-2038", "PEN"); - - lh.addStaticHoliday ("08-OCT-2038", "PEN"); - - lh.addStaticHoliday ("01-NOV-2038", "PEN"); - - lh.addStaticHoliday ("08-DEC-2038", "PEN"); - - lh.addStaticHoliday ("07-APR-2039", "PEN"); - - lh.addStaticHoliday ("08-APR-2039", "PEN"); - - lh.addStaticHoliday ("29-JUN-2039", "PEN"); - - lh.addStaticHoliday ("28-JUL-2039", "PEN"); - - lh.addStaticHoliday ("29-JUL-2039", "PEN"); - - lh.addStaticHoliday ("30-AUG-2039", "PEN"); - - lh.addStaticHoliday ("01-NOV-2039", "PEN"); - - lh.addStaticHoliday ("08-DEC-2039", "PEN"); - - lh.addStaticHoliday ("29-MAR-2040", "PEN"); - - lh.addStaticHoliday ("30-MAR-2040", "PEN"); - - lh.addStaticHoliday ("01-MAY-2040", "PEN"); - - lh.addStaticHoliday ("29-JUN-2040", "PEN"); - - lh.addStaticHoliday ("30-AUG-2040", "PEN"); - - lh.addStaticHoliday ("08-OCT-2040", "PEN"); - - lh.addStaticHoliday ("01-NOV-2040", "PEN"); - - lh.addStaticHoliday ("25-DEC-2040", "PEN"); - - lh.addStaticHoliday ("01-JAN-2041", "PEN"); - - lh.addStaticHoliday ("18-APR-2041", "PEN"); - - lh.addStaticHoliday ("19-APR-2041", "PEN"); - - lh.addStaticHoliday ("01-MAY-2041", "PEN"); - - lh.addStaticHoliday ("29-JUL-2041", "PEN"); - - lh.addStaticHoliday ("30-AUG-2041", "PEN"); - - lh.addStaticHoliday ("08-OCT-2041", "PEN"); - - lh.addStaticHoliday ("01-NOV-2041", "PEN"); - - lh.addStaticHoliday ("25-DEC-2041", "PEN"); - - lh.addStaticHoliday ("01-JAN-2042", "PEN"); - - lh.addStaticHoliday ("03-APR-2042", "PEN"); - - lh.addStaticHoliday ("04-APR-2042", "PEN"); - - lh.addStaticHoliday ("01-MAY-2042", "PEN"); - - lh.addStaticHoliday ("28-JUL-2042", "PEN"); - - lh.addStaticHoliday ("29-JUL-2042", "PEN"); - - lh.addStaticHoliday ("08-OCT-2042", "PEN"); - - lh.addStaticHoliday ("08-DEC-2042", "PEN"); - - lh.addStaticHoliday ("25-DEC-2042", "PEN"); - - lh.addStaticHoliday ("01-JAN-2043", "PEN"); - - lh.addStaticHoliday ("26-MAR-2043", "PEN"); - - lh.addStaticHoliday ("27-MAR-2043", "PEN"); - - lh.addStaticHoliday ("01-MAY-2043", "PEN"); - - lh.addStaticHoliday ("29-JUN-2043", "PEN"); - - lh.addStaticHoliday ("28-JUL-2043", "PEN"); - - lh.addStaticHoliday ("29-JUL-2043", "PEN"); - - lh.addStaticHoliday ("08-OCT-2043", "PEN"); - - lh.addStaticHoliday ("08-DEC-2043", "PEN"); - - lh.addStaticHoliday ("25-DEC-2043", "PEN"); - - lh.addStaticHoliday ("01-JAN-2044", "PEN"); - - lh.addStaticHoliday ("14-APR-2044", "PEN"); - - lh.addStaticHoliday ("15-APR-2044", "PEN"); - - lh.addStaticHoliday ("29-JUN-2044", "PEN"); - - lh.addStaticHoliday ("28-JUL-2044", "PEN"); - - lh.addStaticHoliday ("29-JUL-2044", "PEN"); - - lh.addStaticHoliday ("30-AUG-2044", "PEN"); - - lh.addStaticHoliday ("01-NOV-2044", "PEN"); - - lh.addStaticHoliday ("08-DEC-2044", "PEN"); - - lh.addStaticHoliday ("06-APR-2045", "PEN"); - - lh.addStaticHoliday ("07-APR-2045", "PEN"); - - lh.addStaticHoliday ("01-MAY-2045", "PEN"); - - lh.addStaticHoliday ("29-JUN-2045", "PEN"); - - lh.addStaticHoliday ("28-JUL-2045", "PEN"); - - lh.addStaticHoliday ("30-AUG-2045", "PEN"); - - lh.addStaticHoliday ("01-NOV-2045", "PEN"); - - lh.addStaticHoliday ("08-DEC-2045", "PEN"); - - lh.addStaticHoliday ("25-DEC-2045", "PEN"); - - lh.addStaticHoliday ("01-JAN-2046", "PEN"); - - lh.addStaticHoliday ("22-MAR-2046", "PEN"); - - lh.addStaticHoliday ("23-MAR-2046", "PEN"); - - lh.addStaticHoliday ("01-MAY-2046", "PEN"); - - lh.addStaticHoliday ("29-JUN-2046", "PEN"); - - lh.addStaticHoliday ("30-AUG-2046", "PEN"); - - lh.addStaticHoliday ("08-OCT-2046", "PEN"); - - lh.addStaticHoliday ("01-NOV-2046", "PEN"); - - lh.addStaticHoliday ("25-DEC-2046", "PEN"); - - lh.addStaticHoliday ("01-JAN-2047", "PEN"); - - lh.addStaticHoliday ("11-APR-2047", "PEN"); - - lh.addStaticHoliday ("12-APR-2047", "PEN"); - - lh.addStaticHoliday ("01-MAY-2047", "PEN"); - - lh.addStaticHoliday ("29-JUL-2047", "PEN"); - - lh.addStaticHoliday ("30-AUG-2047", "PEN"); - - lh.addStaticHoliday ("08-OCT-2047", "PEN"); - - lh.addStaticHoliday ("01-NOV-2047", "PEN"); - - lh.addStaticHoliday ("25-DEC-2047", "PEN"); - - lh.addStaticHoliday ("01-JAN-2048", "PEN"); - - lh.addStaticHoliday ("02-APR-2048", "PEN"); - - lh.addStaticHoliday ("03-APR-2048", "PEN"); - - lh.addStaticHoliday ("01-MAY-2048", "PEN"); - - lh.addStaticHoliday ("29-JUN-2048", "PEN"); - - lh.addStaticHoliday ("28-JUL-2048", "PEN"); - - lh.addStaticHoliday ("29-JUL-2048", "PEN"); - - lh.addStaticHoliday ("08-OCT-2048", "PEN"); - - lh.addStaticHoliday ("08-DEC-2048", "PEN"); - - lh.addStaticHoliday ("25-DEC-2048", "PEN"); - - lh.addStaticHoliday ("01-JAN-2049", "PEN"); - - lh.addStaticHoliday ("15-APR-2049", "PEN"); - - lh.addStaticHoliday ("16-APR-2049", "PEN"); - - lh.addStaticHoliday ("29-JUN-2049", "PEN"); - - lh.addStaticHoliday ("28-JUL-2049", "PEN"); - - lh.addStaticHoliday ("29-JUL-2049", "PEN"); - - lh.addStaticHoliday ("30-AUG-2049", "PEN"); - - lh.addStaticHoliday ("08-OCT-2049", "PEN"); - - lh.addStaticHoliday ("01-NOV-2049", "PEN"); - - lh.addStaticHoliday ("08-DEC-2049", "PEN"); - - lh.addStaticHoliday ("07-APR-2050", "PEN"); - - lh.addStaticHoliday ("08-APR-2050", "PEN"); - - lh.addStaticHoliday ("29-JUN-2050", "PEN"); - - lh.addStaticHoliday ("28-JUL-2050", "PEN"); - - lh.addStaticHoliday ("29-JUL-2050", "PEN"); - - lh.addStaticHoliday ("30-AUG-2050", "PEN"); - - lh.addStaticHoliday ("01-NOV-2050", "PEN"); - - lh.addStaticHoliday ("08-DEC-2050", "PEN"); - - lh.addStaticHoliday ("30-MAR-2051", "PEN"); - - lh.addStaticHoliday ("31-MAR-2051", "PEN"); - - lh.addStaticHoliday ("01-MAY-2051", "PEN"); - - lh.addStaticHoliday ("29-JUN-2051", "PEN"); - - lh.addStaticHoliday ("28-JUL-2051", "PEN"); - - lh.addStaticHoliday ("30-AUG-2051", "PEN"); - - lh.addStaticHoliday ("01-NOV-2051", "PEN"); - - lh.addStaticHoliday ("08-DEC-2051", "PEN"); - - lh.addStaticHoliday ("25-DEC-2051", "PEN"); - - lh.addStaticHoliday ("01-JAN-2052", "PEN"); - - lh.addStaticHoliday ("18-APR-2052", "PEN"); - - lh.addStaticHoliday ("19-APR-2052", "PEN"); - - lh.addStaticHoliday ("01-MAY-2052", "PEN"); - - lh.addStaticHoliday ("29-JUL-2052", "PEN"); - - lh.addStaticHoliday ("30-AUG-2052", "PEN"); - - lh.addStaticHoliday ("08-OCT-2052", "PEN"); - - lh.addStaticHoliday ("01-NOV-2052", "PEN"); - - lh.addStaticHoliday ("25-DEC-2052", "PEN"); - - lh.addStaticHoliday ("01-JAN-2053", "PEN"); - - lh.addStaticHoliday ("03-APR-2053", "PEN"); - - lh.addStaticHoliday ("04-APR-2053", "PEN"); - - lh.addStaticHoliday ("01-MAY-2053", "PEN"); - - lh.addStaticHoliday ("28-JUL-2053", "PEN"); - - lh.addStaticHoliday ("29-JUL-2053", "PEN"); - - lh.addStaticHoliday ("08-OCT-2053", "PEN"); - - lh.addStaticHoliday ("08-DEC-2053", "PEN"); - - lh.addStaticHoliday ("25-DEC-2053", "PEN"); - - lh.addStaticHoliday ("01-JAN-2054", "PEN"); - - lh.addStaticHoliday ("26-MAR-2054", "PEN"); - - lh.addStaticHoliday ("27-MAR-2054", "PEN"); - - lh.addStaticHoliday ("01-MAY-2054", "PEN"); - - lh.addStaticHoliday ("29-JUN-2054", "PEN"); - - lh.addStaticHoliday ("28-JUL-2054", "PEN"); - - lh.addStaticHoliday ("29-JUL-2054", "PEN"); - - lh.addStaticHoliday ("08-OCT-2054", "PEN"); - - lh.addStaticHoliday ("08-DEC-2054", "PEN"); - - lh.addStaticHoliday ("25-DEC-2054", "PEN"); - - lh.addStaticHoliday ("01-JAN-2055", "PEN"); - - lh.addStaticHoliday ("15-APR-2055", "PEN"); - - lh.addStaticHoliday ("16-APR-2055", "PEN"); - - lh.addStaticHoliday ("29-JUN-2055", "PEN"); - - lh.addStaticHoliday ("28-JUL-2055", "PEN"); - - lh.addStaticHoliday ("29-JUL-2055", "PEN"); - - lh.addStaticHoliday ("30-AUG-2055", "PEN"); - - lh.addStaticHoliday ("08-OCT-2055", "PEN"); - - lh.addStaticHoliday ("01-NOV-2055", "PEN"); - - lh.addStaticHoliday ("08-DEC-2055", "PEN"); - - lh.addStaticHoliday ("30-MAR-2056", "PEN"); - - lh.addStaticHoliday ("31-MAR-2056", "PEN"); - - lh.addStaticHoliday ("01-MAY-2056", "PEN"); - - lh.addStaticHoliday ("29-JUN-2056", "PEN"); - - lh.addStaticHoliday ("28-JUL-2056", "PEN"); - - lh.addStaticHoliday ("30-AUG-2056", "PEN"); - - lh.addStaticHoliday ("01-NOV-2056", "PEN"); - - lh.addStaticHoliday ("08-DEC-2056", "PEN"); - - lh.addStaticHoliday ("25-DEC-2056", "PEN"); - - lh.addStaticHoliday ("01-JAN-2057", "PEN"); - - lh.addStaticHoliday ("19-APR-2057", "PEN"); - - lh.addStaticHoliday ("20-APR-2057", "PEN"); - - lh.addStaticHoliday ("01-MAY-2057", "PEN"); - - lh.addStaticHoliday ("29-JUN-2057", "PEN"); - - lh.addStaticHoliday ("30-AUG-2057", "PEN"); - - lh.addStaticHoliday ("08-OCT-2057", "PEN"); - - lh.addStaticHoliday ("01-NOV-2057", "PEN"); - - lh.addStaticHoliday ("25-DEC-2057", "PEN"); - - lh.addStaticHoliday ("01-JAN-2058", "PEN"); - - lh.addStaticHoliday ("11-APR-2058", "PEN"); - - lh.addStaticHoliday ("12-APR-2058", "PEN"); - - lh.addStaticHoliday ("01-MAY-2058", "PEN"); - - lh.addStaticHoliday ("29-JUL-2058", "PEN"); - - lh.addStaticHoliday ("30-AUG-2058", "PEN"); - - lh.addStaticHoliday ("08-OCT-2058", "PEN"); - - lh.addStaticHoliday ("01-NOV-2058", "PEN"); - - lh.addStaticHoliday ("25-DEC-2058", "PEN"); - - lh.addStaticHoliday ("01-JAN-2059", "PEN"); - - lh.addStaticHoliday ("27-MAR-2059", "PEN"); - - lh.addStaticHoliday ("28-MAR-2059", "PEN"); - - lh.addStaticHoliday ("01-MAY-2059", "PEN"); - - lh.addStaticHoliday ("28-JUL-2059", "PEN"); - - lh.addStaticHoliday ("29-JUL-2059", "PEN"); - - lh.addStaticHoliday ("08-OCT-2059", "PEN"); - - lh.addStaticHoliday ("08-DEC-2059", "PEN"); - - lh.addStaticHoliday ("25-DEC-2059", "PEN"); - - lh.addStaticHoliday ("01-JAN-2060", "PEN"); - - lh.addStaticHoliday ("15-APR-2060", "PEN"); - - lh.addStaticHoliday ("16-APR-2060", "PEN"); - - lh.addStaticHoliday ("29-JUN-2060", "PEN"); - - lh.addStaticHoliday ("28-JUL-2060", "PEN"); - - lh.addStaticHoliday ("29-JUL-2060", "PEN"); - - lh.addStaticHoliday ("30-AUG-2060", "PEN"); - - lh.addStaticHoliday ("08-OCT-2060", "PEN"); - - lh.addStaticHoliday ("01-NOV-2060", "PEN"); - - lh.addStaticHoliday ("08-DEC-2060", "PEN"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/PESHoliday.java b/org/drip/analytics/holset/PESHoliday.java deleted file mode 100644 index c0bc7e4..0000000 --- a/org/drip/analytics/holset/PESHoliday.java +++ /dev/null @@ -1,117 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class PESHoliday implements org.drip.analytics.holset.LocationHoliday { - public PESHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "PES"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("09-FEB-1994", "Lunar New Year"); - - lh.addStaticHoliday ("10-FEB-1994", "Lunar New Year"); - - lh.addStaticHoliday ("11-FEB-1994", "Lunar New Year"); - - lh.addStaticHoliday ("01-MAR-1994", "Independence Movement Day"); - - lh.addStaticHoliday ("05-APR-1994", "Arbor Day"); - - lh.addStaticHoliday ("05-MAY-1994", "Childrens Day"); - - lh.addStaticHoliday ("18-MAY-1994", "Buddhas Birthday"); - - lh.addStaticHoliday ("06-JUN-1994", "Memorial Day"); - - lh.addStaticHoliday ("15-AUG-1994", "Liberation Day"); - - lh.addStaticHoliday ("19-SEP-1994", "Chusok"); - - lh.addStaticHoliday ("20-SEP-1994", "Chusok"); - - lh.addStaticHoliday ("21-SEP-1994", "Chusok"); - - lh.addStaticHoliday ("03-OCT-1994", "National Foundation Day"); - - lh.addStaticHoliday ("01-JAN-1995", ""); - - lh.addStaticHoliday ("02-JAN-1995", ""); - - lh.addStaticHoliday ("30-JAN-1995", ""); - - lh.addStaticHoliday ("01-FEB-1995", ""); - - lh.addStaticHoliday ("01-MAR-1995", ""); - - lh.addStaticHoliday ("05-APR-1995", ""); - - lh.addStaticHoliday ("05-MAY-1995", ""); - - lh.addStaticHoliday ("07-MAY-1995", ""); - - lh.addStaticHoliday ("06-JUN-1995", ""); - - lh.addStaticHoliday ("17-JUL-1995", ""); - - lh.addStaticHoliday ("15-AUG-1995", ""); - - lh.addStaticHoliday ("08-SEP-1995", ""); - - lh.addStaticHoliday ("09-SEP-1995", ""); - - lh.addStaticHoliday ("10-SEP-1995", ""); - - lh.addStaticHoliday ("03-OCT-1995", ""); - - lh.addStaticHoliday ("25-DEC-1995", ""); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/PHPHoliday.java b/org/drip/analytics/holset/PHPHoliday.java deleted file mode 100644 index 7af8f75..0000000 --- a/org/drip/analytics/holset/PHPHoliday.java +++ /dev/null @@ -1,1745 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class PHPHoliday implements org.drip.analytics.holset.LocationHoliday { - public PHPHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "PHP"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("09-APR-1999", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("02-NOV-1999", "All Souls Day"); - - lh.addStaticHoliday ("30-NOV-1999", "Bonifacio Day"); - - lh.addStaticHoliday ("30-DEC-1999", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-1999", "Bank Holiday"); - - lh.addStaticHoliday ("25-FEB-2000", "Bank Holiday"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labor Day"); - - lh.addStaticHoliday ("12-JUN-2000", "Independence Day"); - - lh.addStaticHoliday ("01-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("02-NOV-2000", "All Souls Day"); - - lh.addStaticHoliday ("30-NOV-2000", "Bonifacio Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2001", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labor Day"); - - lh.addStaticHoliday ("14-MAY-2001", "Election Day"); - - lh.addStaticHoliday ("12-JUN-2001", "Independence Day"); - - lh.addStaticHoliday ("01-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("02-NOV-2001", "All Souls Day"); - - lh.addStaticHoliday ("30-NOV-2001", "Bonifacio Day"); - - lh.addStaticHoliday ("17-DEC-2001", "Ramadan Feast day"); - - lh.addStaticHoliday ("24-DEC-2001", "Special Holiday"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2001", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2001", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("25-FEB-2002", "National Day"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("08-APR-2002", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("01-MAY-2002", "LABOR DAY"); - - lh.addStaticHoliday ("12-JUN-2002", "Independence Day"); - - lh.addStaticHoliday ("01-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2002", "Special Holiday"); - - lh.addStaticHoliday ("25-DEC-2002", "Special Holiday"); - - lh.addStaticHoliday ("30-DEC-2002", "Special Holiday"); - - lh.addStaticHoliday ("31-DEC-2002", "Special Holiday"); - - lh.addStaticHoliday ("01-JAN-2003", "Special Holiday"); - - lh.addStaticHoliday ("25-FEB-2003", "Special Holiday"); - - lh.addStaticHoliday ("07-APR-2003", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labor Day"); - - lh.addStaticHoliday ("13-JUN-2003", "Independence Day"); - - lh.addStaticHoliday ("22-AUG-2003", "Bank Holiday"); - - lh.addStaticHoliday ("26-NOV-2003", "Idul Fitri"); - - lh.addStaticHoliday ("24-DEC-2003", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2003", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2004", "Special Holiday"); - - lh.addStaticHoliday ("07-APR-2004", "Bank Holiday"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("10-MAY-2004", "Election Day"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("15-NOV-2004", "Idul Fitri"); - - lh.addStaticHoliday ("29-NOV-2004", "Bonifacio Day"); - - lh.addStaticHoliday ("03-DEC-2004", "Special Holiday"); - - lh.addStaticHoliday ("24-DEC-2004", "Special Holiday"); - - lh.addStaticHoliday ("27-DEC-2004", "Bank Holiday"); - - lh.addStaticHoliday ("30-DEC-2004", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2004", "Bank Holiday"); - - lh.addStaticHoliday ("25-FEB-2005", "Revolution Day"); - - lh.addStaticHoliday ("23-MAR-2005", "Bank Holiday"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("02-MAY-2005", "Labor Day Observed"); - - lh.addStaticHoliday ("25-JUL-2005", "Special Holiday"); - - lh.addStaticHoliday ("29-AUG-2005", "Heroes Day"); - - lh.addStaticHoliday ("31-OCT-2005", "Bank Holiday"); - - lh.addStaticHoliday ("01-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("04-NOV-2005", "Idul Fitri"); - - lh.addStaticHoliday ("28-NOV-2005", "Bonifacio Day"); - - lh.addStaticHoliday ("26-DEC-2005", "Bank Holiday"); - - lh.addStaticHoliday ("30-DEC-2005", "Rizal Day"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labor Day"); - - lh.addStaticHoliday ("12-JUN-2006", "Independence Day"); - - lh.addStaticHoliday ("24-JUL-2006", "Special Holiday"); - - lh.addStaticHoliday ("21-AUG-2006", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("28-SEP-2006", "Special Holiday"); - - lh.addStaticHoliday ("29-SEP-2006", "Special Holiday"); - - lh.addStaticHoliday ("24-OCT-2006", "Idul Fitri"); - - lh.addStaticHoliday ("01-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("01-DEC-2006", "Bonifacio Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("01-MAY-2007", "Labor Day"); - - lh.addStaticHoliday ("14-MAY-2007", "Election Day"); - - lh.addStaticHoliday ("11-JUN-2007", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2007", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("27-AUG-2007", "Heroes Day"); - - lh.addStaticHoliday ("12-OCT-2007", "Idul Fitri"); - - lh.addStaticHoliday ("29-OCT-2007", "Election Day"); - - lh.addStaticHoliday ("01-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("02-NOV-2007", "All Souls Day"); - - lh.addStaticHoliday ("30-NOV-2007", "Bonifacio Day"); - - lh.addStaticHoliday ("24-DEC-2007", "Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2007", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("25-FEB-2008", "Revolution Day"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("07-APR-2008", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("01-MAY-2008", "Labor Day"); - - lh.addStaticHoliday ("09-JUN-2008", "Independence Day"); - - lh.addStaticHoliday ("18-AUG-2008", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("25-AUG-2008", "Heroes Day"); - - lh.addStaticHoliday ("01-OCT-2008", "Idul Fitri"); - - lh.addStaticHoliday ("01-DEC-2008", "Bonifacio Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Boxing Day"); - - lh.addStaticHoliday ("29-DEC-2008", "Bank Holiday"); - - lh.addStaticHoliday ("30-DEC-2008", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2008", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2009", "Bank Holiday"); - - lh.addStaticHoliday ("06-APR-2009", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labor Day"); - - lh.addStaticHoliday ("12-JUN-2009", "Independence Day"); - - lh.addStaticHoliday ("24-JUN-2009", "Bank Holiday"); - - lh.addStaticHoliday ("05-AUG-2009", "Special Holiday"); - - lh.addStaticHoliday ("21-AUG-2009", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("31-AUG-2009", "Heroes Day"); - - lh.addStaticHoliday ("07-SEP-2009", "Special Holiday"); - - lh.addStaticHoliday ("21-SEP-2009", "Bank Holiday"); - - lh.addStaticHoliday ("02-NOV-2009", "All Souls Day"); - - lh.addStaticHoliday ("30-NOV-2009", "Bonifacio Day"); - - lh.addStaticHoliday ("24-DEC-2009", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2009", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2009", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2010", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2010", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("03-MAY-2010", "Labor Day"); - - lh.addStaticHoliday ("10-MAY-2010", "Election Day"); - - lh.addStaticHoliday ("14-JUN-2010", "Independence Day"); - - lh.addStaticHoliday ("30-JUN-2010", "Special Holiday"); - - lh.addStaticHoliday ("30-AUG-2010", "Heroes Day"); - - lh.addStaticHoliday ("10-SEP-2010", "Bank Holiday"); - - lh.addStaticHoliday ("25-OCT-2010", "Election Day"); - - lh.addStaticHoliday ("01-NOV-2010", "All Saints Day"); - - lh.addStaticHoliday ("16-NOV-2010", "National Holiday"); - - lh.addStaticHoliday ("29-NOV-2010", "Bonifacio Day"); - - lh.addStaticHoliday ("24-DEC-2010", "Christmas Eve"); - - lh.addStaticHoliday ("27-DEC-2010", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2010", "Bank Holiday"); - - lh.addStaticHoliday ("21-APR-2011", "Holy Thursday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("20-JUN-2011", "Special Holiday"); - - lh.addStaticHoliday ("29-AUG-2011", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2011", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2011", "Bonifacio Day"); - - lh.addStaticHoliday ("30-DEC-2011", "Rizal Day"); - - lh.addStaticHoliday ("05-APR-2012", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2012", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("01-MAY-2012", "Labor Day"); - - lh.addStaticHoliday ("12-JUN-2012", "Independence Day"); - - lh.addStaticHoliday ("20-AUG-2012", "Idul Fitri"); - - lh.addStaticHoliday ("21-AUG-2012", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("27-AUG-2012", "Heroes Day"); - - lh.addStaticHoliday ("26-OCT-2012", "Idul Adha"); - - lh.addStaticHoliday ("01-NOV-2012", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2012", "Bonifacio Day"); - - lh.addStaticHoliday ("24-DEC-2012", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2012", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2013", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2013", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("01-MAY-2013", "Labor Day"); - - lh.addStaticHoliday ("13-MAY-2013", "Election Day"); - - lh.addStaticHoliday ("12-JUN-2013", "Independence Day"); - - lh.addStaticHoliday ("09-AUG-2013", "Idul Fitri"); - - lh.addStaticHoliday ("21-AUG-2013", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("26-AUG-2013", "Heroes Day"); - - lh.addStaticHoliday ("15-OCT-2013", "Idul Adha"); - - lh.addStaticHoliday ("01-NOV-2013", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2013", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2013", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2013", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2014", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("17-APR-2014", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labor Day"); - - lh.addStaticHoliday ("12-JUN-2014", "Independence Day"); - - lh.addStaticHoliday ("29-JUL-2014", "Idul Fitri"); - - lh.addStaticHoliday ("21-AUG-2014", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("25-AUG-2014", "Heroes Day"); - - lh.addStaticHoliday ("03-OCT-2014", "Idul Adha"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Boxing Day"); - - lh.addStaticHoliday ("30-DEC-2014", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2014", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2015", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2015", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("01-MAY-2015", "Labor Day"); - - lh.addStaticHoliday ("12-JUN-2015", "Independence Day"); - - lh.addStaticHoliday ("17-JUL-2015", "Idul Fitri"); - - lh.addStaticHoliday ("21-AUG-2015", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("31-AUG-2015", "Heroes Day"); - - lh.addStaticHoliday ("23-SEP-2015", "Idul Adha"); - - lh.addStaticHoliday ("30-NOV-2015", "Bonifacio Day"); - - lh.addStaticHoliday ("24-DEC-2015", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2015", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2015", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2016", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("09-MAY-2016", "Election Day"); - - lh.addStaticHoliday ("06-JUL-2016", "Idul Fitri"); - - lh.addStaticHoliday ("29-AUG-2016", "Heroes Day"); - - lh.addStaticHoliday ("12-SEP-2016", "Idul Adha"); - - lh.addStaticHoliday ("01-NOV-2016", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2016", "Bonifacio Day"); - - lh.addStaticHoliday ("30-DEC-2016", "Rizal Day"); - - lh.addStaticHoliday ("13-APR-2017", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labor Day"); - - lh.addStaticHoliday ("12-JUN-2017", "Independence Day"); - - lh.addStaticHoliday ("26-JUN-2017", "Idul Fitri"); - - lh.addStaticHoliday ("21-AUG-2017", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("28-AUG-2017", "Heroes Day"); - - lh.addStaticHoliday ("01-SEP-2017", "Idul Adha"); - - lh.addStaticHoliday ("01-NOV-2017", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2017", "Bonifacio Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2018", "Holy Thursday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2018", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("01-MAY-2018", "Labor Day"); - - lh.addStaticHoliday ("12-JUN-2018", "Independence Day"); - - lh.addStaticHoliday ("15-JUN-2018", "Idul Fitri"); - - lh.addStaticHoliday ("21-AUG-2018", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("27-AUG-2018", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2018", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2018", "Bonifacio Day"); - - lh.addStaticHoliday ("24-DEC-2018", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2018", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2019", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("18-APR-2019", "Holy Thursday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labor Day"); - - lh.addStaticHoliday ("13-MAY-2019", "Election Day"); - - lh.addStaticHoliday ("05-JUN-2019", "Idul Fitri"); - - lh.addStaticHoliday ("12-JUN-2019", "Independence Day"); - - lh.addStaticHoliday ("12-AUG-2019", "Idul Adha"); - - lh.addStaticHoliday ("21-AUG-2019", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("26-AUG-2019", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2019", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2019", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2019", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2019", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2020", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labor Day"); - - lh.addStaticHoliday ("25-MAY-2020", "Idul Fitri"); - - lh.addStaticHoliday ("12-JUN-2020", "Independence Day"); - - lh.addStaticHoliday ("31-JUL-2020", "Idul Adha"); - - lh.addStaticHoliday ("21-AUG-2020", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("31-AUG-2020", "Heroes Day"); - - lh.addStaticHoliday ("30-NOV-2020", "Bonifacio Day"); - - lh.addStaticHoliday ("24-DEC-2020", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2020", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2020", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2021", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2021", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("14-MAY-2021", "Idul Fitri"); - - lh.addStaticHoliday ("20-JUL-2021", "Idul Adha"); - - lh.addStaticHoliday ("30-AUG-2021", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2021", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2021", "Bonifacio Day"); - - lh.addStaticHoliday ("24-DEC-2021", "Christmas Eve"); - - lh.addStaticHoliday ("30-DEC-2021", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2021", "Bank Holiday"); - - lh.addStaticHoliday ("14-APR-2022", "Holy Thursday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("03-MAY-2022", "Idul Fitri"); - - lh.addStaticHoliday ("09-MAY-2022", "Election Day"); - - lh.addStaticHoliday ("08-JUL-2022", "Idul Adha"); - - lh.addStaticHoliday ("29-AUG-2022", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2022", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2022", "Bonifacio Day"); - - lh.addStaticHoliday ("30-DEC-2022", "Rizal Day"); - - lh.addStaticHoliday ("06-APR-2023", "Holy Thursday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2023", "Idul Fitri"); - - lh.addStaticHoliday ("01-MAY-2023", "Labor Day"); - - lh.addStaticHoliday ("12-JUN-2023", "Independence Day"); - - lh.addStaticHoliday ("28-JUN-2023", "Idul Adha"); - - lh.addStaticHoliday ("21-AUG-2023", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("28-AUG-2023", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2023", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2023", "Bonifacio Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2024", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2024", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("11-APR-2024", "Idul Fitri"); - - lh.addStaticHoliday ("01-MAY-2024", "Labor Day"); - - lh.addStaticHoliday ("12-JUN-2024", "Independence Day"); - - lh.addStaticHoliday ("17-JUN-2024", "Idul Adha"); - - lh.addStaticHoliday ("21-AUG-2024", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("26-AUG-2024", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2024", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2024", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2024", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2024", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("31-MAR-2025", "Idul Fitri"); - - lh.addStaticHoliday ("09-APR-2025", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("17-APR-2025", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labor Day"); - - lh.addStaticHoliday ("12-MAY-2025", "Election Day"); - - lh.addStaticHoliday ("06-JUN-2025", "Idul Adha"); - - lh.addStaticHoliday ("12-JUN-2025", "Independence Day"); - - lh.addStaticHoliday ("21-AUG-2025", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("25-AUG-2025", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Boxing Day"); - - lh.addStaticHoliday ("30-DEC-2025", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2025", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("20-MAR-2026", "Idul Fitri"); - - lh.addStaticHoliday ("02-APR-2026", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2026", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("01-MAY-2026", "Labor Day"); - - lh.addStaticHoliday ("27-MAY-2026", "Idul Adha"); - - lh.addStaticHoliday ("12-JUN-2026", "Independence Day"); - - lh.addStaticHoliday ("21-AUG-2026", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("31-AUG-2026", "Heroes Day"); - - lh.addStaticHoliday ("30-NOV-2026", "Bonifacio Day"); - - lh.addStaticHoliday ("24-DEC-2026", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2026", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2026", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("10-MAR-2027", "Idul Fitri"); - - lh.addStaticHoliday ("25-MAR-2027", "Holy Thursday"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2027", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("17-MAY-2027", "Idul Adha"); - - lh.addStaticHoliday ("30-AUG-2027", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2027", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2027", "Bonifacio Day"); - - lh.addStaticHoliday ("24-DEC-2027", "Christmas Eve"); - - lh.addStaticHoliday ("30-DEC-2027", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2027", "Bank Holiday"); - - lh.addStaticHoliday ("28-FEB-2028", "Idul Fitri"); - - lh.addStaticHoliday ("13-APR-2028", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labor Day"); - - lh.addStaticHoliday ("05-MAY-2028", "Idul Adha"); - - lh.addStaticHoliday ("08-MAY-2028", "Election Day"); - - lh.addStaticHoliday ("12-JUN-2028", "Independence Day"); - - lh.addStaticHoliday ("21-AUG-2028", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("28-AUG-2028", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2028", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2028", "Bonifacio Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2029", "New Years Day"); - - lh.addStaticHoliday ("15-FEB-2029", "Idul Fitri"); - - lh.addStaticHoliday ("29-MAR-2029", "Holy Thursday"); - - lh.addStaticHoliday ("30-MAR-2029", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2029", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("24-APR-2029", "Idul Adha"); - - lh.addStaticHoliday ("01-MAY-2029", "Labor Day"); - - lh.addStaticHoliday ("12-JUN-2029", "Independence Day"); - - lh.addStaticHoliday ("21-AUG-2029", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("27-AUG-2029", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2029", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2029", "Bonifacio Day"); - - lh.addStaticHoliday ("24-DEC-2029", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2029", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2029", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2030", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2030", "Idul Fitri"); - - lh.addStaticHoliday ("09-APR-2030", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("12-APR-2030", "Idul Adha"); - - lh.addStaticHoliday ("18-APR-2030", "Holy Thursday"); - - lh.addStaticHoliday ("19-APR-2030", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2030", "Labor Day"); - - lh.addStaticHoliday ("12-JUN-2030", "Independence Day"); - - lh.addStaticHoliday ("21-AUG-2030", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("26-AUG-2030", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2030", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2030", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2030", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2030", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2030", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2031", "New Years Day"); - - lh.addStaticHoliday ("24-JAN-2031", "Idul Fitri"); - - lh.addStaticHoliday ("02-APR-2031", "Idul Adha"); - - lh.addStaticHoliday ("09-APR-2031", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("10-APR-2031", "Holy Thursday"); - - lh.addStaticHoliday ("11-APR-2031", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2031", "Labor Day"); - - lh.addStaticHoliday ("12-MAY-2031", "Election Day"); - - lh.addStaticHoliday ("12-JUN-2031", "Independence Day"); - - lh.addStaticHoliday ("21-AUG-2031", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("25-AUG-2031", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2031", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2031", "Boxing Day"); - - lh.addStaticHoliday ("30-DEC-2031", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2031", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2032", "New Years Day"); - - lh.addStaticHoliday ("15-JAN-2032", "Idul Fitri"); - - lh.addStaticHoliday ("22-MAR-2032", "Idul Adha"); - - lh.addStaticHoliday ("25-MAR-2032", "Holy Thursday"); - - lh.addStaticHoliday ("26-MAR-2032", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2032", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("30-AUG-2032", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2032", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2032", "Bonifacio Day"); - - lh.addStaticHoliday ("24-DEC-2032", "Christmas Eve"); - - lh.addStaticHoliday ("30-DEC-2032", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2032", "Bank Holiday"); - - lh.addStaticHoliday ("03-JAN-2033", "Idul Fitri"); - - lh.addStaticHoliday ("11-MAR-2033", "Idul Adha"); - - lh.addStaticHoliday ("14-APR-2033", "Holy Thursday"); - - lh.addStaticHoliday ("15-APR-2033", "Good Friday"); - - lh.addStaticHoliday ("29-AUG-2033", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2033", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2033", "Bonifacio Day"); - - lh.addStaticHoliday ("23-DEC-2033", "Idul Fitri"); - - lh.addStaticHoliday ("30-DEC-2033", "Rizal Day"); - - lh.addStaticHoliday ("01-MAR-2034", "Idul Adha"); - - lh.addStaticHoliday ("06-APR-2034", "Holy Thursday"); - - lh.addStaticHoliday ("07-APR-2034", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2034", "Labor Day"); - - lh.addStaticHoliday ("08-MAY-2034", "Election Day"); - - lh.addStaticHoliday ("12-JUN-2034", "Independence Day"); - - lh.addStaticHoliday ("21-AUG-2034", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("28-AUG-2034", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2034", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2034", "Bonifacio Day"); - - lh.addStaticHoliday ("13-DEC-2034", "Idul Fitri"); - - lh.addStaticHoliday ("25-DEC-2034", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2035", "New Years Day"); - - lh.addStaticHoliday ("19-FEB-2035", "Idul Adha"); - - lh.addStaticHoliday ("22-MAR-2035", "Holy Thursday"); - - lh.addStaticHoliday ("23-MAR-2035", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2035", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("01-MAY-2035", "Labor Day"); - - lh.addStaticHoliday ("12-JUN-2035", "Independence Day"); - - lh.addStaticHoliday ("21-AUG-2035", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("27-AUG-2035", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2035", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2035", "Bonifacio Day"); - - lh.addStaticHoliday ("03-DEC-2035", "Idul Fitri"); - - lh.addStaticHoliday ("24-DEC-2035", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2035", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2035", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2036", "New Years Day"); - - lh.addStaticHoliday ("07-FEB-2036", "Idul Adha"); - - lh.addStaticHoliday ("09-APR-2036", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("10-APR-2036", "Holy Thursday"); - - lh.addStaticHoliday ("11-APR-2036", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2036", "Labor Day"); - - lh.addStaticHoliday ("12-JUN-2036", "Independence Day"); - - lh.addStaticHoliday ("21-AUG-2036", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("25-AUG-2036", "Heroes Day"); - - lh.addStaticHoliday ("20-NOV-2036", "Idul Fitri"); - - lh.addStaticHoliday ("25-DEC-2036", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2036", "Boxing Day"); - - lh.addStaticHoliday ("30-DEC-2036", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2036", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2037", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2037", "Idul Adha"); - - lh.addStaticHoliday ("02-APR-2037", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2037", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2037", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("01-MAY-2037", "Labor Day"); - - lh.addStaticHoliday ("11-MAY-2037", "Election Day"); - - lh.addStaticHoliday ("12-JUN-2037", "Independence Day"); - - lh.addStaticHoliday ("21-AUG-2037", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("31-AUG-2037", "Heroes Day"); - - lh.addStaticHoliday ("09-NOV-2037", "Idul Fitri"); - - lh.addStaticHoliday ("30-NOV-2037", "Bonifacio Day"); - - lh.addStaticHoliday ("24-DEC-2037", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2037", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2037", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2037", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2038", "New Years Day"); - - lh.addStaticHoliday ("15-JAN-2038", "Idul Adha"); - - lh.addStaticHoliday ("09-APR-2038", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("22-APR-2038", "Holy Thursday"); - - lh.addStaticHoliday ("23-APR-2038", "Good Friday"); - - lh.addStaticHoliday ("30-AUG-2038", "Heroes Day"); - - lh.addStaticHoliday ("29-OCT-2038", "Idul Fitri"); - - lh.addStaticHoliday ("01-NOV-2038", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2038", "Bonifacio Day"); - - lh.addStaticHoliday ("24-DEC-2038", "Christmas Eve"); - - lh.addStaticHoliday ("30-DEC-2038", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2038", "Bank Holiday"); - - lh.addStaticHoliday ("05-JAN-2039", "Idul Adha"); - - lh.addStaticHoliday ("07-APR-2039", "Holy Thursday"); - - lh.addStaticHoliday ("08-APR-2039", "Good Friday"); - - lh.addStaticHoliday ("29-AUG-2039", "Heroes Day"); - - lh.addStaticHoliday ("20-OCT-2039", "Idul Fitri"); - - lh.addStaticHoliday ("01-NOV-2039", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2039", "Bonifacio Day"); - - lh.addStaticHoliday ("26-DEC-2039", "Idul Adha"); - - lh.addStaticHoliday ("30-DEC-2039", "Rizal Day"); - - lh.addStaticHoliday ("29-MAR-2040", "Holy Thursday"); - - lh.addStaticHoliday ("30-MAR-2040", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2040", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("01-MAY-2040", "Labor Day"); - - lh.addStaticHoliday ("14-MAY-2040", "Election Day"); - - lh.addStaticHoliday ("12-JUN-2040", "Independence Day"); - - lh.addStaticHoliday ("21-AUG-2040", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("27-AUG-2040", "Heroes Day"); - - lh.addStaticHoliday ("08-OCT-2040", "Idul Fitri"); - - lh.addStaticHoliday ("01-NOV-2040", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2040", "Bonifacio Day"); - - lh.addStaticHoliday ("14-DEC-2040", "Idul Adha"); - - lh.addStaticHoliday ("24-DEC-2040", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2040", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2040", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2041", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2041", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("18-APR-2041", "Holy Thursday"); - - lh.addStaticHoliday ("19-APR-2041", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2041", "Labor Day"); - - lh.addStaticHoliday ("12-JUN-2041", "Independence Day"); - - lh.addStaticHoliday ("21-AUG-2041", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("26-AUG-2041", "Heroes Day"); - - lh.addStaticHoliday ("27-SEP-2041", "Idul Fitri"); - - lh.addStaticHoliday ("01-NOV-2041", "All Saints Day"); - - lh.addStaticHoliday ("04-DEC-2041", "Idul Adha"); - - lh.addStaticHoliday ("24-DEC-2041", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2041", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2041", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2041", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2042", "New Years Day"); - - lh.addStaticHoliday ("03-APR-2042", "Holy Thursday"); - - lh.addStaticHoliday ("04-APR-2042", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2042", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("01-MAY-2042", "Labor Day"); - - lh.addStaticHoliday ("12-JUN-2042", "Independence Day"); - - lh.addStaticHoliday ("21-AUG-2042", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("25-AUG-2042", "Heroes Day"); - - lh.addStaticHoliday ("16-SEP-2042", "Idul Fitri"); - - lh.addStaticHoliday ("24-NOV-2042", "Idul Adha"); - - lh.addStaticHoliday ("25-DEC-2042", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2042", "Boxing Day"); - - lh.addStaticHoliday ("30-DEC-2042", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2042", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2043", "New Years Day"); - - lh.addStaticHoliday ("26-MAR-2043", "Holy Thursday"); - - lh.addStaticHoliday ("27-MAR-2043", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2043", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("01-MAY-2043", "Labor Day"); - - lh.addStaticHoliday ("11-MAY-2043", "Election Day"); - - lh.addStaticHoliday ("12-JUN-2043", "Independence Day"); - - lh.addStaticHoliday ("21-AUG-2043", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("31-AUG-2043", "Heroes Day"); - - lh.addStaticHoliday ("04-SEP-2043", "Idul Fitri"); - - lh.addStaticHoliday ("12-NOV-2043", "Idul Adha"); - - lh.addStaticHoliday ("30-NOV-2043", "Bonifacio Day"); - - lh.addStaticHoliday ("24-DEC-2043", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2043", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2043", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2043", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2044", "New Years Day"); - - lh.addStaticHoliday ("14-APR-2044", "Holy Thursday"); - - lh.addStaticHoliday ("15-APR-2044", "Good Friday"); - - lh.addStaticHoliday ("25-AUG-2044", "Idul Fitri"); - - lh.addStaticHoliday ("29-AUG-2044", "Heroes Day"); - - lh.addStaticHoliday ("31-OCT-2044", "Idul Adha"); - - lh.addStaticHoliday ("01-NOV-2044", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2044", "Bonifacio Day"); - - lh.addStaticHoliday ("30-DEC-2044", "Rizal Day"); - - lh.addStaticHoliday ("06-APR-2045", "Holy Thursday"); - - lh.addStaticHoliday ("07-APR-2045", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2045", "Labor Day"); - - lh.addStaticHoliday ("12-JUN-2045", "Independence Day"); - - lh.addStaticHoliday ("15-AUG-2045", "Idul Fitri"); - - lh.addStaticHoliday ("21-AUG-2045", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("28-AUG-2045", "Heroes Day"); - - lh.addStaticHoliday ("20-OCT-2045", "Idul Adha"); - - lh.addStaticHoliday ("01-NOV-2045", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2045", "Bonifacio Day"); - - lh.addStaticHoliday ("25-DEC-2045", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2046", "New Years Day"); - - lh.addStaticHoliday ("22-MAR-2046", "Holy Thursday"); - - lh.addStaticHoliday ("23-MAR-2046", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2046", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("01-MAY-2046", "Labor Day"); - - lh.addStaticHoliday ("14-MAY-2046", "Election Day"); - - lh.addStaticHoliday ("12-JUN-2046", "Independence Day"); - - lh.addStaticHoliday ("03-AUG-2046", "Idul Fitri"); - - lh.addStaticHoliday ("21-AUG-2046", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("27-AUG-2046", "Heroes Day"); - - lh.addStaticHoliday ("10-OCT-2046", "Idul Adha"); - - lh.addStaticHoliday ("01-NOV-2046", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2046", "Bonifacio Day"); - - lh.addStaticHoliday ("24-DEC-2046", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2046", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2046", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2047", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2047", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("11-APR-2047", "Holy Thursday"); - - lh.addStaticHoliday ("12-APR-2047", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2047", "Labor Day"); - - lh.addStaticHoliday ("12-JUN-2047", "Independence Day"); - - lh.addStaticHoliday ("25-JUL-2047", "Idul Fitri"); - - lh.addStaticHoliday ("21-AUG-2047", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("26-AUG-2047", "Heroes Day"); - - lh.addStaticHoliday ("30-SEP-2047", "Idul Adha"); - - lh.addStaticHoliday ("01-NOV-2047", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2047", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2047", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2047", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2047", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2048", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2048", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2048", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2048", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("01-MAY-2048", "Labor Day"); - - lh.addStaticHoliday ("12-JUN-2048", "Independence Day"); - - lh.addStaticHoliday ("13-JUL-2048", "Idul Fitri"); - - lh.addStaticHoliday ("21-AUG-2048", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("31-AUG-2048", "Heroes Day"); - - lh.addStaticHoliday ("18-SEP-2048", "Idul Adha"); - - lh.addStaticHoliday ("30-NOV-2048", "Bonifacio Day"); - - lh.addStaticHoliday ("24-DEC-2048", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2048", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2048", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2048", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2049", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2049", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("15-APR-2049", "Holy Thursday"); - - lh.addStaticHoliday ("16-APR-2049", "Good Friday"); - - lh.addStaticHoliday ("10-MAY-2049", "Election Day"); - - lh.addStaticHoliday ("02-JUL-2049", "Idul Fitri"); - - lh.addStaticHoliday ("30-AUG-2049", "Heroes Day"); - - lh.addStaticHoliday ("08-SEP-2049", "Idul Adha"); - - lh.addStaticHoliday ("01-NOV-2049", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2049", "Bonifacio Day"); - - lh.addStaticHoliday ("24-DEC-2049", "Christmas Eve"); - - lh.addStaticHoliday ("30-DEC-2049", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2049", "Bank Holiday"); - - lh.addStaticHoliday ("07-APR-2050", "Holy Thursday"); - - lh.addStaticHoliday ("08-APR-2050", "Good Friday"); - - lh.addStaticHoliday ("21-JUN-2050", "Idul Fitri"); - - lh.addStaticHoliday ("29-AUG-2050", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2050", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2050", "Bonifacio Day"); - - lh.addStaticHoliday ("30-DEC-2050", "Rizal Day"); - - lh.addStaticHoliday ("30-MAR-2051", "Holy Thursday"); - - lh.addStaticHoliday ("31-MAR-2051", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2051", "Labor Day"); - - lh.addStaticHoliday ("12-JUN-2051", "Independence Day"); - - lh.addStaticHoliday ("17-AUG-2051", "Idul Adha"); - - lh.addStaticHoliday ("21-AUG-2051", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("28-AUG-2051", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2051", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2051", "Bonifacio Day"); - - lh.addStaticHoliday ("25-DEC-2051", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2052", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2052", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("18-APR-2052", "Holy Thursday"); - - lh.addStaticHoliday ("19-APR-2052", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2052", "Labor Day"); - - lh.addStaticHoliday ("13-MAY-2052", "Election Day"); - - lh.addStaticHoliday ("30-MAY-2052", "Idul Fitri"); - - lh.addStaticHoliday ("12-JUN-2052", "Independence Day"); - - lh.addStaticHoliday ("05-AUG-2052", "Idul Adha"); - - lh.addStaticHoliday ("21-AUG-2052", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("26-AUG-2052", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2052", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2052", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2052", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2052", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2052", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2053", "New Years Day"); - - lh.addStaticHoliday ("03-APR-2053", "Holy Thursday"); - - lh.addStaticHoliday ("04-APR-2053", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2053", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("01-MAY-2053", "Labor Day"); - - lh.addStaticHoliday ("20-MAY-2053", "Idul Fitri"); - - lh.addStaticHoliday ("12-JUN-2053", "Independence Day"); - - lh.addStaticHoliday ("25-JUL-2053", "Idul Adha"); - - lh.addStaticHoliday ("21-AUG-2053", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("25-AUG-2053", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2053", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2053", "Boxing Day"); - - lh.addStaticHoliday ("30-DEC-2053", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2053", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2054", "New Years Day"); - - lh.addStaticHoliday ("26-MAR-2054", "Holy Thursday"); - - lh.addStaticHoliday ("27-MAR-2054", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2054", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("01-MAY-2054", "Labor Day"); - - lh.addStaticHoliday ("11-MAY-2054", "Idul Fitri"); - - lh.addStaticHoliday ("12-JUN-2054", "Independence Day"); - - lh.addStaticHoliday ("15-JUL-2054", "Idul Adha"); - - lh.addStaticHoliday ("21-AUG-2054", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("31-AUG-2054", "Heroes Day"); - - lh.addStaticHoliday ("30-NOV-2054", "Bonifacio Day"); - - lh.addStaticHoliday ("24-DEC-2054", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2054", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2054", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2054", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2055", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2055", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("15-APR-2055", "Holy Thursday"); - - lh.addStaticHoliday ("16-APR-2055", "Good Friday"); - - lh.addStaticHoliday ("29-APR-2055", "Idul Fitri"); - - lh.addStaticHoliday ("10-MAY-2055", "Election Day"); - - lh.addStaticHoliday ("05-JUL-2055", "Idul Adha"); - - lh.addStaticHoliday ("30-AUG-2055", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2055", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2055", "Bonifacio Day"); - - lh.addStaticHoliday ("24-DEC-2055", "Christmas Eve"); - - lh.addStaticHoliday ("30-DEC-2055", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2055", "Bank Holiday"); - - lh.addStaticHoliday ("30-MAR-2056", "Holy Thursday"); - - lh.addStaticHoliday ("31-MAR-2056", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2056", "Idul Fitri"); - - lh.addStaticHoliday ("01-MAY-2056", "Labor Day"); - - lh.addStaticHoliday ("12-JUN-2056", "Independence Day"); - - lh.addStaticHoliday ("23-JUN-2056", "Idul Adha"); - - lh.addStaticHoliday ("21-AUG-2056", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("28-AUG-2056", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2056", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2056", "Bonifacio Day"); - - lh.addStaticHoliday ("25-DEC-2056", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2057", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2057", "Idul Fitri"); - - lh.addStaticHoliday ("09-APR-2057", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("19-APR-2057", "Holy Thursday"); - - lh.addStaticHoliday ("20-APR-2057", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2057", "Labor Day"); - - lh.addStaticHoliday ("12-JUN-2057", "Independence Day"); - - lh.addStaticHoliday ("21-AUG-2057", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("27-AUG-2057", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2057", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2057", "Bonifacio Day"); - - lh.addStaticHoliday ("24-DEC-2057", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2057", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2057", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2058", "New Years Day"); - - lh.addStaticHoliday ("26-MAR-2058", "Idul Fitri"); - - lh.addStaticHoliday ("09-APR-2058", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("11-APR-2058", "Holy Thursday"); - - lh.addStaticHoliday ("12-APR-2058", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2058", "Labor Day"); - - lh.addStaticHoliday ("13-MAY-2058", "Election Day"); - - lh.addStaticHoliday ("31-MAY-2058", "Idul Adha"); - - lh.addStaticHoliday ("12-JUN-2058", "Independence Day"); - - lh.addStaticHoliday ("21-AUG-2058", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("26-AUG-2058", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2058", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2058", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2058", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2058", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2058", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2059", "New Years Day"); - - lh.addStaticHoliday ("17-MAR-2059", "Idul Fitri"); - - lh.addStaticHoliday ("27-MAR-2059", "Holy Thursday"); - - lh.addStaticHoliday ("28-MAR-2059", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2059", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("01-MAY-2059", "Labor Day"); - - lh.addStaticHoliday ("22-MAY-2059", "Idul Adha"); - - lh.addStaticHoliday ("12-JUN-2059", "Independence Day"); - - lh.addStaticHoliday ("21-AUG-2059", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("25-AUG-2059", "Heroes Day"); - - lh.addStaticHoliday ("25-DEC-2059", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2059", "Boxing Day"); - - lh.addStaticHoliday ("30-DEC-2059", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2059", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2060", "New Years Day"); - - lh.addStaticHoliday ("05-MAR-2060", "Idul Fitri"); - - lh.addStaticHoliday ("09-APR-2060", "Araw Ng Kagitingan"); - - lh.addStaticHoliday ("15-APR-2060", "Holy Thursday"); - - lh.addStaticHoliday ("16-APR-2060", "Good Friday"); - - lh.addStaticHoliday ("10-MAY-2060", "Idul Adha"); - - lh.addStaticHoliday ("30-AUG-2060", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2060", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2060", "Bonifacio Day"); - - lh.addStaticHoliday ("24-DEC-2060", "Christmas Eve"); - - lh.addStaticHoliday ("30-DEC-2060", "Rizal Day"); - - lh.addStaticHoliday ("31-DEC-2060", "Bank Holiday"); - - lh.addStaticHoliday ("22-FEB-2061", "Idul Fitri"); - - lh.addStaticHoliday ("07-APR-2061", "Holy Thursday"); - - lh.addStaticHoliday ("08-APR-2061", "Good Friday"); - - lh.addStaticHoliday ("29-APR-2061", "Idul Adha"); - - lh.addStaticHoliday ("09-MAY-2061", "Election Day"); - - lh.addStaticHoliday ("29-AUG-2061", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2061", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2061", "Bonifacio Day"); - - lh.addStaticHoliday ("30-DEC-2061", "Rizal Day"); - - lh.addStaticHoliday ("10-FEB-2062", "Idul Fitri"); - - lh.addStaticHoliday ("23-MAR-2062", "Holy Thursday"); - - lh.addStaticHoliday ("24-MAR-2062", "Good Friday"); - - lh.addStaticHoliday ("20-APR-2062", "Idul Adha"); - - lh.addStaticHoliday ("01-MAY-2062", "Labor Day"); - - lh.addStaticHoliday ("12-JUN-2062", "Independence Day"); - - lh.addStaticHoliday ("21-AUG-2062", "Ninoy Aquino Day"); - - lh.addStaticHoliday ("28-AUG-2062", "Heroes Day"); - - lh.addStaticHoliday ("01-NOV-2062", "All Saints Day"); - - lh.addStaticHoliday ("30-NOV-2062", "Bonifacio Day"); - - lh.addStaticHoliday ("25-DEC-2062", "Christmas Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/PLNHoliday.java b/org/drip/analytics/holset/PLNHoliday.java deleted file mode 100644 index 7223569..0000000 --- a/org/drip/analytics/holset/PLNHoliday.java +++ /dev/null @@ -1,531 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class PLNHoliday implements org.drip.analytics.holset.LocationHoliday { - public PLNHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "PLN"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("11-JUN-1998", "Corpus Christi"); - - lh.addStaticHoliday ("11-NOV-1998", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-1999", "Constitution Day"); - - lh.addStaticHoliday ("03-JUN-1999", "Corpus Christi"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-1999", "Independence Day"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2000", "Constitution Day"); - - lh.addStaticHoliday ("22-JUN-2000", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2000", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2001", "Constitution Day"); - - lh.addStaticHoliday ("14-JUN-2001", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2001", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2002", "Constitution Day"); - - lh.addStaticHoliday ("30-MAY-2002", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2002", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2002", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("19-JUN-2003", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2003", "Assumption Day"); - - lh.addStaticHoliday ("11-NOV-2003", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2004", "Constitution Day"); - - lh.addStaticHoliday ("10-JUN-2004", "Corpus Christi"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2004", "Independence Day"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2005", "Constitution Day"); - - lh.addStaticHoliday ("26-MAY-2005", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2005", "Independence Day"); - - lh.addStaticHoliday ("26-DEC-2005", "St. Stephens Day"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2006", "Constitution Day"); - - lh.addStaticHoliday ("15-JUN-2006", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2006", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2007", "Constitution Day"); - - lh.addStaticHoliday ("07-JUN-2007", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2007", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("22-MAY-2008", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2008", "Assumption Day"); - - lh.addStaticHoliday ("11-NOV-2008", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("11-JUN-2009", "Corpus Christi"); - - lh.addStaticHoliday ("11-NOV-2009", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2010", "Constitution Day"); - - lh.addStaticHoliday ("03-JUN-2010", "Corpus Christi"); - - lh.addStaticHoliday ("01-NOV-2010", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2010", "Independence Day"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2011", "Constitution Day"); - - lh.addStaticHoliday ("23-JUN-2011", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2011", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2011", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2011", "Independence Day"); - - lh.addStaticHoliday ("26-DEC-2011", "St. Stephens Day"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2012", "Constitution Day"); - - lh.addStaticHoliday ("07-JUN-2012", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2012", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2012", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2013", "Constitution Day"); - - lh.addStaticHoliday ("30-MAY-2013", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2013", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2013", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2013", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("19-JUN-2014", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2014", "Assumption Day"); - - lh.addStaticHoliday ("11-NOV-2014", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("04-JUN-2015", "Corpus Christi"); - - lh.addStaticHoliday ("11-NOV-2015", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2016", "Constitution Day"); - - lh.addStaticHoliday ("26-MAY-2016", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2016", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2016", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2016", "Independence Day"); - - lh.addStaticHoliday ("26-DEC-2016", "St. Stephens Day"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2017", "Constitution Day"); - - lh.addStaticHoliday ("15-JUN-2017", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2017", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2017", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2018", "Constitution Day"); - - lh.addStaticHoliday ("31-MAY-2018", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2018", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2018", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2019", "Constitution Day"); - - lh.addStaticHoliday ("20-JUN-2019", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2019", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2019", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2019", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("11-JUN-2020", "Corpus Christi"); - - lh.addStaticHoliday ("11-NOV-2020", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2021", "Constitution Day"); - - lh.addStaticHoliday ("03-JUN-2021", "Corpus Christi"); - - lh.addStaticHoliday ("01-NOV-2021", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2021", "Independence Day"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2022", "Constitution Day"); - - lh.addStaticHoliday ("16-JUN-2022", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2022", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2022", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2022", "Independence Day"); - - lh.addStaticHoliday ("26-DEC-2022", "St. Stephens Day"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2023", "Constitution Day"); - - lh.addStaticHoliday ("08-JUN-2023", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2023", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2023", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2024", "Constitution Day"); - - lh.addStaticHoliday ("30-MAY-2024", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2024", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2024", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2024", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("19-JUN-2025", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2025", "Assumption Day"); - - lh.addStaticHoliday ("11-NOV-2025", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("04-JUN-2026", "Corpus Christi"); - - lh.addStaticHoliday ("11-NOV-2026", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2027", "Constitution Day"); - - lh.addStaticHoliday ("27-MAY-2027", "Corpus Christi"); - - lh.addStaticHoliday ("01-NOV-2027", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2027", "Independence Day"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2028", "Constitution Day"); - - lh.addStaticHoliday ("15-JUN-2028", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2028", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2028", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "St. Stephens Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/PLZHoliday.java b/org/drip/analytics/holset/PLZHoliday.java deleted file mode 100644 index 0771273..0000000 --- a/org/drip/analytics/holset/PLZHoliday.java +++ /dev/null @@ -1,531 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class PLZHoliday implements org.drip.analytics.holset.LocationHoliday { - public PLZHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "PLZ"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1997", "New Years Day"); - - lh.addStaticHoliday ("31-MAR-1997", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1997", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-1997", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-1997", "Assumption Day"); - - lh.addStaticHoliday ("11-NOV-1997", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-1997", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-1997", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("11-JUN-1998", "Corpus Christi"); - - lh.addStaticHoliday ("11-NOV-1998", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-1999", "Constitution Day"); - - lh.addStaticHoliday ("03-JUN-1999", "Corpus Christi"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-1999", "Independence Day"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2000", "Constitution Day"); - - lh.addStaticHoliday ("22-JUN-2000", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2000", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2001", "Constitution Day"); - - lh.addStaticHoliday ("14-JUN-2001", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2001", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2002", "Constitution Day"); - - lh.addStaticHoliday ("30-MAY-2002", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2002", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2002", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("19-JUN-2003", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2003", "Assumption Day"); - - lh.addStaticHoliday ("11-NOV-2003", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2004", "Constitution Day"); - - lh.addStaticHoliday ("10-JUN-2004", "Corpus Christi"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2004", "Independence Day"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2005", "Constitution Day"); - - lh.addStaticHoliday ("26-MAY-2005", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2005", "Independence Day"); - - lh.addStaticHoliday ("26-DEC-2005", "St. Stephens Day"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2006", "Constitution Day"); - - lh.addStaticHoliday ("15-JUN-2006", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2006", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2007", "Constitution Day"); - - lh.addStaticHoliday ("07-JUN-2007", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2007", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("22-MAY-2008", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2008", "Assumption Day"); - - lh.addStaticHoliday ("11-NOV-2008", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("11-JUN-2009", "Corpus Christi"); - - lh.addStaticHoliday ("11-NOV-2009", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2010", "Constitution Day"); - - lh.addStaticHoliday ("03-JUN-2010", "Corpus Christi"); - - lh.addStaticHoliday ("01-NOV-2010", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2010", "Independence Day"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2011", "Constitution Day"); - - lh.addStaticHoliday ("23-JUN-2011", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2011", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2011", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2011", "Independence Day"); - - lh.addStaticHoliday ("26-DEC-2011", "St. Stephens Day"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2012", "Constitution Day"); - - lh.addStaticHoliday ("07-JUN-2012", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2012", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2012", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2013", "Constitution Day"); - - lh.addStaticHoliday ("30-MAY-2013", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2013", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2013", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2013", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("19-JUN-2014", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2014", "Assumption Day"); - - lh.addStaticHoliday ("11-NOV-2014", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("04-JUN-2015", "Corpus Christi"); - - lh.addStaticHoliday ("11-NOV-2015", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2016", "Constitution Day"); - - lh.addStaticHoliday ("26-MAY-2016", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2016", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2016", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2016", "Independence Day"); - - lh.addStaticHoliday ("26-DEC-2016", "St. Stephens Day"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2017", "Constitution Day"); - - lh.addStaticHoliday ("15-JUN-2017", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2017", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2017", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2018", "Constitution Day"); - - lh.addStaticHoliday ("31-MAY-2018", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2018", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2018", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2019", "Constitution Day"); - - lh.addStaticHoliday ("20-JUN-2019", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2019", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2019", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2019", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("11-JUN-2020", "Corpus Christi"); - - lh.addStaticHoliday ("11-NOV-2020", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2021", "Constitution Day"); - - lh.addStaticHoliday ("03-JUN-2021", "Corpus Christi"); - - lh.addStaticHoliday ("01-NOV-2021", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2021", "Independence Day"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2022", "Constitution Day"); - - lh.addStaticHoliday ("16-JUN-2022", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2022", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2022", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2022", "Independence Day"); - - lh.addStaticHoliday ("26-DEC-2022", "St. Stephens Day"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2023", "Constitution Day"); - - lh.addStaticHoliday ("08-JUN-2023", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2023", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2023", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("03-MAY-2024", "Constitution Day"); - - lh.addStaticHoliday ("30-MAY-2024", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2024", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2024", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2024", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("19-JUN-2025", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2025", "Assumption Day"); - - lh.addStaticHoliday ("11-NOV-2025", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("04-JUN-2026", "Corpus Christi"); - - lh.addStaticHoliday ("11-NOV-2026", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2027", "Constitution Day"); - - lh.addStaticHoliday ("27-MAY-2027", "Corpus Christi"); - - lh.addStaticHoliday ("01-NOV-2027", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2027", "Independence Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/PTEHoliday.java b/org/drip/analytics/holset/PTEHoliday.java deleted file mode 100644 index 7fc0445..0000000 --- a/org/drip/analytics/holset/PTEHoliday.java +++ /dev/null @@ -1,775 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class PTEHoliday implements org.drip.analytics.holset.LocationHoliday { - public PTEHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "PTE"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("24-FEB-1998", "Carnival Tuesday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("10-JUN-1998", "Portugal Day"); - - lh.addStaticHoliday ("11-JUN-1998", "Corpus Christi"); - - lh.addStaticHoliday ("05-OCT-1998", "Republic Day"); - - lh.addStaticHoliday ("01-DEC-1998", "Independence Day"); - - lh.addStaticHoliday ("08-DEC-1998", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-1998", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-1999", "Carnival Tuesday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("03-JUN-1999", "Corpus Christi"); - - lh.addStaticHoliday ("10-JUN-1999", "Portugal Day"); - - lh.addStaticHoliday ("05-OCT-1999", "Republic Day"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("01-DEC-1999", "Independence Day"); - - lh.addStaticHoliday ("08-DEC-1999", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-1999", "Christmas Eve"); - - lh.addStaticHoliday ("07-MAR-2000", "Carnival Tuesday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2000", "Liberty Day"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("13-JUN-2000", "Lisbon Day"); - - lh.addStaticHoliday ("22-JUN-2000", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2000", "Assumption Day"); - - lh.addStaticHoliday ("05-OCT-2000", "Republic Day"); - - lh.addStaticHoliday ("01-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("01-DEC-2000", "Independence Day"); - - lh.addStaticHoliday ("08-DEC-2000", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("27-FEB-2001", "Carnival Tuesday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("25-APR-2001", "Liberty Day"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2001", "Public Holiday"); - - lh.addStaticHoliday ("13-JUN-2001", "Lisbon Day"); - - lh.addStaticHoliday ("14-JUN-2001", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2001", "Assumption Day"); - - lh.addStaticHoliday ("05-OCT-2001", "Republic Day"); - - lh.addStaticHoliday ("01-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2001", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("12-FEB-2002", "Carnival Tuesday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2002", "Liberty Day"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2002", "Corpus Christi"); - - lh.addStaticHoliday ("10-JUN-2002", "Portugal Day"); - - lh.addStaticHoliday ("13-JUN-2002", "Lisbon Day"); - - lh.addStaticHoliday ("15-AUG-2002", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2002", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("04-MAR-2003", "Carnival Tuesday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2003", "Liberty Day"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("10-JUN-2003", "Portugal Day"); - - lh.addStaticHoliday ("13-JUN-2003", "Lisbon Day"); - - lh.addStaticHoliday ("19-JUN-2003", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2003", "Assumption Day"); - - lh.addStaticHoliday ("01-DEC-2003", "Independence Day"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2003", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("24-FEB-2004", "Carnival Tuesday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("10-JUN-2004", "Portugal Day"); - - lh.addStaticHoliday ("05-OCT-2004", "Republic Day"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("01-DEC-2004", "Independence Day"); - - lh.addStaticHoliday ("08-DEC-2004", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2004", "Christmas Eve"); - - lh.addStaticHoliday ("08-FEB-2005", "Carnival Tuesday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2005", "Liberty Day"); - - lh.addStaticHoliday ("26-MAY-2005", "Corpus Christi"); - - lh.addStaticHoliday ("10-JUN-2005", "Portugal Day"); - - lh.addStaticHoliday ("13-JUN-2005", "Lisbon Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("05-OCT-2005", "Republic Day"); - - lh.addStaticHoliday ("01-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("01-DEC-2005", "Independence Day"); - - lh.addStaticHoliday ("08-DEC-2005", "Immaculate Conception"); - - lh.addStaticHoliday ("28-FEB-2006", "Carnival Tuesday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2006", "Liberty Day"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("13-JUN-2006", "Lisbon Day"); - - lh.addStaticHoliday ("15-JUN-2006", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2006", "Assumption Day"); - - lh.addStaticHoliday ("05-OCT-2006", "Republic Day"); - - lh.addStaticHoliday ("01-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("01-DEC-2006", "Independence Day"); - - lh.addStaticHoliday ("08-DEC-2006", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("20-FEB-2007", "Carnival Tuesday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2007", "Liberty Day"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("07-JUN-2007", "Corpus Christi"); - - lh.addStaticHoliday ("13-JUN-2007", "Lisbon Day"); - - lh.addStaticHoliday ("15-AUG-2007", "Assumption Day"); - - lh.addStaticHoliday ("05-OCT-2007", "Republic Day"); - - lh.addStaticHoliday ("01-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2007", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2008", "Carnival Tuesday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2008", "Liberty Day"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("22-MAY-2008", "Corpus Christi"); - - lh.addStaticHoliday ("10-JUN-2008", "Portugal Day"); - - lh.addStaticHoliday ("13-JUN-2008", "Lisbon Day"); - - lh.addStaticHoliday ("15-AUG-2008", "Assumption Day"); - - lh.addStaticHoliday ("01-DEC-2008", "Independence Day"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2008", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("24-FEB-2009", "Carnival Tuesday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("10-JUN-2009", "Portugal Day"); - - lh.addStaticHoliday ("11-JUN-2009", "Corpus Christi"); - - lh.addStaticHoliday ("05-OCT-2009", "Republic Day"); - - lh.addStaticHoliday ("01-DEC-2009", "Independence Day"); - - lh.addStaticHoliday ("08-DEC-2009", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2009", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2010", "Carnival Tuesday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("03-JUN-2010", "Corpus Christi"); - - lh.addStaticHoliday ("10-JUN-2010", "Portugal Day"); - - lh.addStaticHoliday ("05-OCT-2010", "Republic Day"); - - lh.addStaticHoliday ("01-NOV-2010", "All Saints Day"); - - lh.addStaticHoliday ("01-DEC-2010", "Independence Day"); - - lh.addStaticHoliday ("08-DEC-2010", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2010", "Christmas Eve"); - - lh.addStaticHoliday ("08-MAR-2011", "Carnival Tuesday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Liberty Day"); - - lh.addStaticHoliday ("10-JUN-2011", "Portugal Day"); - - lh.addStaticHoliday ("13-JUN-2011", "Lisbon Day"); - - lh.addStaticHoliday ("23-JUN-2011", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2011", "Assumption Day"); - - lh.addStaticHoliday ("05-OCT-2011", "Republic Day"); - - lh.addStaticHoliday ("01-NOV-2011", "All Saints Day"); - - lh.addStaticHoliday ("01-DEC-2011", "Independence Day"); - - lh.addStaticHoliday ("08-DEC-2011", "Immaculate Conception"); - - lh.addStaticHoliday ("21-FEB-2012", "Carnival Tuesday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2012", "Liberty Day"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("07-JUN-2012", "Corpus Christi"); - - lh.addStaticHoliday ("13-JUN-2012", "Lisbon Day"); - - lh.addStaticHoliday ("15-AUG-2012", "Assumption Day"); - - lh.addStaticHoliday ("05-OCT-2012", "Republic Day"); - - lh.addStaticHoliday ("01-NOV-2012", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2012", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("12-FEB-2013", "Carnival Tuesday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2013", "Liberty Day"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2013", "Corpus Christi"); - - lh.addStaticHoliday ("10-JUN-2013", "Portugal Day"); - - lh.addStaticHoliday ("13-JUN-2013", "Lisbon Day"); - - lh.addStaticHoliday ("15-AUG-2013", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2013", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2013", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("04-MAR-2014", "Carnival Tuesday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2014", "Liberty Day"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("10-JUN-2014", "Portugal Day"); - - lh.addStaticHoliday ("13-JUN-2014", "Lisbon Day"); - - lh.addStaticHoliday ("19-JUN-2014", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2014", "Assumption Day"); - - lh.addStaticHoliday ("01-DEC-2014", "Independence Day"); - - lh.addStaticHoliday ("08-DEC-2014", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2014", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("17-FEB-2015", "Carnival Tuesday"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("04-JUN-2015", "Corpus Christi"); - - lh.addStaticHoliday ("10-JUN-2015", "Portugal Day"); - - lh.addStaticHoliday ("05-OCT-2015", "Republic Day"); - - lh.addStaticHoliday ("01-DEC-2015", "Independence Day"); - - lh.addStaticHoliday ("08-DEC-2015", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2015", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("09-FEB-2016", "Carnival Tuesday"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2016", "Liberty Day"); - - lh.addStaticHoliday ("26-MAY-2016", "Corpus Christi"); - - lh.addStaticHoliday ("10-JUN-2016", "Portugal Day"); - - lh.addStaticHoliday ("13-JUN-2016", "Lisbon Day"); - - lh.addStaticHoliday ("15-AUG-2016", "Assumption Day"); - - lh.addStaticHoliday ("05-OCT-2016", "Republic Day"); - - lh.addStaticHoliday ("01-NOV-2016", "All Saints Day"); - - lh.addStaticHoliday ("01-DEC-2016", "Independence Day"); - - lh.addStaticHoliday ("08-DEC-2016", "Immaculate Conception"); - - lh.addStaticHoliday ("28-FEB-2017", "Carnival Tuesday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2017", "Liberty Day"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("13-JUN-2017", "Lisbon Day"); - - lh.addStaticHoliday ("15-JUN-2017", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2017", "Assumption Day"); - - lh.addStaticHoliday ("05-OCT-2017", "Republic Day"); - - lh.addStaticHoliday ("01-NOV-2017", "All Saints Day"); - - lh.addStaticHoliday ("01-DEC-2017", "Independence Day"); - - lh.addStaticHoliday ("08-DEC-2017", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("13-FEB-2018", "Carnival Tuesday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2018", "Liberty Day"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("31-MAY-2018", "Corpus Christi"); - - lh.addStaticHoliday ("13-JUN-2018", "Lisbon Day"); - - lh.addStaticHoliday ("15-AUG-2018", "Assumption Day"); - - lh.addStaticHoliday ("05-OCT-2018", "Republic Day"); - - lh.addStaticHoliday ("01-NOV-2018", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2018", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("05-MAR-2019", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2019", "Liberty Day"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("10-JUN-2019", "Portugal Day"); - - lh.addStaticHoliday ("13-JUN-2019", "Lisbon Day"); - - lh.addStaticHoliday ("20-JUN-2019", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2019", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2019", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2019", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("25-FEB-2020", "Carnival Tuesday"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("10-JUN-2020", "Portugal Day"); - - lh.addStaticHoliday ("11-JUN-2020", "Corpus Christi"); - - lh.addStaticHoliday ("05-OCT-2020", "Republic Day"); - - lh.addStaticHoliday ("01-DEC-2020", "Independence Day"); - - lh.addStaticHoliday ("08-DEC-2020", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2020", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2021", "Carnival Tuesday"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("03-JUN-2021", "Corpus Christi"); - - lh.addStaticHoliday ("10-JUN-2021", "Portugal Day"); - - lh.addStaticHoliday ("05-OCT-2021", "Republic Day"); - - lh.addStaticHoliday ("01-NOV-2021", "All Saints Day"); - - lh.addStaticHoliday ("01-DEC-2021", "Independence Day"); - - lh.addStaticHoliday ("08-DEC-2021", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2021", "Christmas Eve"); - - lh.addStaticHoliday ("01-MAR-2022", "Carnival Tuesday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2022", "Liberty Day"); - - lh.addStaticHoliday ("10-JUN-2022", "Portugal Day"); - - lh.addStaticHoliday ("13-JUN-2022", "Lisbon Day"); - - lh.addStaticHoliday ("16-JUN-2022", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2022", "Assumption Day"); - - lh.addStaticHoliday ("05-OCT-2022", "Republic Day"); - - lh.addStaticHoliday ("01-NOV-2022", "All Saints Day"); - - lh.addStaticHoliday ("01-DEC-2022", "Independence Day"); - - lh.addStaticHoliday ("08-DEC-2022", "Immaculate Conception"); - - lh.addStaticHoliday ("21-FEB-2023", "Carnival Tuesday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2023", "Liberty Day"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("08-JUN-2023", "Corpus Christi"); - - lh.addStaticHoliday ("13-JUN-2023", "Lisbon Day"); - - lh.addStaticHoliday ("15-AUG-2023", "Assumption Day"); - - lh.addStaticHoliday ("05-OCT-2023", "Republic Day"); - - lh.addStaticHoliday ("01-NOV-2023", "All Saints Day"); - - lh.addStaticHoliday ("01-DEC-2023", "Independence Day"); - - lh.addStaticHoliday ("08-DEC-2023", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("13-FEB-2024", "Carnival Tuesday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2024", "Liberty Day"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2024", "Corpus Christi"); - - lh.addStaticHoliday ("10-JUN-2024", "Portugal Day"); - - lh.addStaticHoliday ("13-JUN-2024", "Lisbon Day"); - - lh.addStaticHoliday ("15-AUG-2024", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2024", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-2024", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("04-MAR-2025", "Carnival Tuesday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2025", "Liberty Day"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("10-JUN-2025", "Portugal Day"); - - lh.addStaticHoliday ("13-JUN-2025", "Lisbon Day"); - - lh.addStaticHoliday ("19-JUN-2025", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2025", "Assumption Day"); - - lh.addStaticHoliday ("01-DEC-2025", "Independence Day"); - - lh.addStaticHoliday ("08-DEC-2025", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2025", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("17-FEB-2026", "Carnival Tuesday"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("04-JUN-2026", "Corpus Christi"); - - lh.addStaticHoliday ("10-JUN-2026", "Portugal Day"); - - lh.addStaticHoliday ("05-OCT-2026", "Republic Day"); - - lh.addStaticHoliday ("01-DEC-2026", "Independence Day"); - - lh.addStaticHoliday ("08-DEC-2026", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2026", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("09-FEB-2027", "Carnival Tuesday"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("27-MAY-2027", "Corpus Christi"); - - lh.addStaticHoliday ("10-JUN-2027", "Portugal Day"); - - lh.addStaticHoliday ("05-OCT-2027", "Republic Day"); - - lh.addStaticHoliday ("01-NOV-2027", "All Saints Day"); - - lh.addStaticHoliday ("01-DEC-2027", "Independence Day"); - - lh.addStaticHoliday ("08-DEC-2027", "Immaculate Conception"); - - lh.addStaticHoliday ("24-DEC-2027", "Christmas Eve"); - - lh.addStaticHoliday ("29-FEB-2028", "Carnival Tuesday"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2028", "Liberty Day"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("13-JUN-2028", "Lisbon Day"); - - lh.addStaticHoliday ("15-JUN-2028", "Corpus Christi"); - - lh.addStaticHoliday ("15-AUG-2028", "Assumption Day"); - - lh.addStaticHoliday ("05-OCT-2028", "Republic Day"); - - lh.addStaticHoliday ("01-NOV-2028", "All Saints Day"); - - lh.addStaticHoliday ("01-DEC-2028", "Independence Day"); - - lh.addStaticHoliday ("08-DEC-2028", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/QEFHoliday.java b/org/drip/analytics/holset/QEFHoliday.java deleted file mode 100644 index 7a45093..0000000 --- a/org/drip/analytics/holset/QEFHoliday.java +++ /dev/null @@ -1,83 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class QEFHoliday implements org.drip.analytics.holset.LocationHoliday { - public QEFHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "QEF"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("null", ""); - - lh.addStaticHoliday ("null", ""); - - lh.addStaticHoliday ("null", ""); - - lh.addStaticHoliday ("null", ""); - - lh.addStaticHoliday ("null", ""); - - lh.addStaticHoliday ("null", ""); - - lh.addStaticHoliday ("null", ""); - - lh.addStaticHoliday ("null", ""); - - lh.addStaticHoliday ("null", ""); - - lh.addStaticHoliday ("null", ""); - - lh.addStaticHoliday ("null", ""); - - lh.addStaticHoliday ("null", ""); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/RUBHoliday.java b/org/drip/analytics/holset/RUBHoliday.java deleted file mode 100644 index 8b443c7..0000000 --- a/org/drip/analytics/holset/RUBHoliday.java +++ /dev/null @@ -1,695 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class RUBHoliday implements org.drip.analytics.holset.LocationHoliday { - public RUBHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "RUB"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-1998", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-1998", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("09-MAR-1998", "Womens Day Observed"); - - lh.addStaticHoliday ("01-MAY-1998", "Labor Day"); - - lh.addStaticHoliday ("04-MAY-1998", "Spring Day Observed"); - - lh.addStaticHoliday ("11-MAY-1998", "Victory Day Observed"); - - lh.addStaticHoliday ("12-JUN-1998", "Independence Day"); - - lh.addStaticHoliday ("09-NOV-1998", "National Holiday Observed"); - - lh.addStaticHoliday ("14-DEC-1998", "Constitution Day Observed"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("04-JAN-1999", "New Years Holiday Observed"); - - lh.addStaticHoliday ("07-JAN-1999", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-1999", "Womens Day"); - - lh.addStaticHoliday ("03-MAY-1999", "Spring Day Observed"); - - lh.addStaticHoliday ("04-MAY-1999", "Labor Day Observed"); - - lh.addStaticHoliday ("10-MAY-1999", "Victory Day Observed"); - - lh.addStaticHoliday ("14-JUN-1999", "Independence Day Observed"); - - lh.addStaticHoliday ("08-NOV-1999", "National Holiday Observed"); - - lh.addStaticHoliday ("13-DEC-1999", "Constitution Day Observed"); - - lh.addStaticHoliday ("03-JAN-2000", "New Years Holiday Observed"); - - lh.addStaticHoliday ("04-JAN-2000", "New Years Day Observed"); - - lh.addStaticHoliday ("07-JAN-2000", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2000", "Womens Day"); - - lh.addStaticHoliday ("01-MAY-2000", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2000", "Spring Day"); - - lh.addStaticHoliday ("09-MAY-2000", "Victory Day"); - - lh.addStaticHoliday ("12-JUN-2000", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2000", "National Holiday"); - - lh.addStaticHoliday ("12-DEC-2000", "Constitution Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2001", "New Years Holiday"); - - lh.addStaticHoliday ("08-JAN-2001", "Orthodox Christmas Day Observed"); - - lh.addStaticHoliday ("08-MAR-2001", "Womens Day"); - - lh.addStaticHoliday ("01-MAY-2001", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2001", "Spring Day"); - - lh.addStaticHoliday ("09-MAY-2001", "Victory Day"); - - lh.addStaticHoliday ("12-JUN-2001", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2001", "National Holiday"); - - lh.addStaticHoliday ("12-DEC-2001", "Constitution Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2002", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-2002", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2002", "Womens Day"); - - lh.addStaticHoliday ("01-MAY-2002", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2002", "Spring Day"); - - lh.addStaticHoliday ("09-MAY-2002", "Victory Day"); - - lh.addStaticHoliday ("12-JUN-2002", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2002", "National Holiday"); - - lh.addStaticHoliday ("12-DEC-2002", "Constitution Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2003", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-2003", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("10-MAR-2003", "Womens Day Observed"); - - lh.addStaticHoliday ("01-MAY-2003", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2003", "Spring Day"); - - lh.addStaticHoliday ("09-MAY-2003", "Victory Day"); - - lh.addStaticHoliday ("12-JUN-2003", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2003", "National Holiday"); - - lh.addStaticHoliday ("12-DEC-2003", "Constitution Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2004", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-2004", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2004", "Womens Day"); - - lh.addStaticHoliday ("03-MAY-2004", "Spring Day Observed"); - - lh.addStaticHoliday ("04-MAY-2004", "Labor Day Observed"); - - lh.addStaticHoliday ("10-MAY-2004", "Victory Day Observed"); - - lh.addStaticHoliday ("14-JUN-2004", "Independence Day Observed"); - - lh.addStaticHoliday ("08-NOV-2004", "National Holiday Observed"); - - lh.addStaticHoliday ("13-DEC-2004", "Constitution Day Observed"); - - lh.addStaticHoliday ("03-JAN-2005", "New Years Holiday Observed"); - - lh.addStaticHoliday ("04-JAN-2005", "New Years Day Observed"); - - lh.addStaticHoliday ("07-JAN-2005", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2005", "Womens Day"); - - lh.addStaticHoliday ("02-MAY-2005", "Spring Day"); - - lh.addStaticHoliday ("03-MAY-2005", "Labor Day Observed"); - - lh.addStaticHoliday ("09-MAY-2005", "Victory Day"); - - lh.addStaticHoliday ("13-JUN-2005", "Independence Day Observed"); - - lh.addStaticHoliday ("07-NOV-2005", "National Holiday"); - - lh.addStaticHoliday ("12-DEC-2005", "Constitution Day"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Holiday"); - - lh.addStaticHoliday ("03-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("09-JAN-2006", "Orthodox Christmas Day Observed"); - - lh.addStaticHoliday ("08-MAR-2006", "Womens Day"); - - lh.addStaticHoliday ("01-MAY-2006", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2006", "Spring Day"); - - lh.addStaticHoliday ("09-MAY-2006", "Victory Day"); - - lh.addStaticHoliday ("12-JUN-2006", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2006", "National Holiday"); - - lh.addStaticHoliday ("12-DEC-2006", "Constitution Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2007", "New Years Holiday"); - - lh.addStaticHoliday ("08-JAN-2007", "Orthodox Christmas Day Observed"); - - lh.addStaticHoliday ("08-MAR-2007", "Womens Day"); - - lh.addStaticHoliday ("01-MAY-2007", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2007", "Spring Day"); - - lh.addStaticHoliday ("09-MAY-2007", "Victory Day"); - - lh.addStaticHoliday ("12-JUN-2007", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2007", "National Holiday"); - - lh.addStaticHoliday ("12-DEC-2007", "Constitution Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2008", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-2008", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("10-MAR-2008", "Womens Day Observed"); - - lh.addStaticHoliday ("01-MAY-2008", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2008", "Spring Day"); - - lh.addStaticHoliday ("09-MAY-2008", "Victory Day"); - - lh.addStaticHoliday ("12-JUN-2008", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2008", "National Holiday"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2009", "New Years Holiday"); - - lh.addStaticHoliday ("05-JAN-2009", "New Years Holiday"); - - lh.addStaticHoliday ("06-JAN-2009", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-2009", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-JAN-2009", "New Years Holiday"); - - lh.addStaticHoliday ("09-JAN-2009", "Bank Holiday"); - - lh.addStaticHoliday ("23-FEB-2009", "Defender of the Fatherland"); - - lh.addStaticHoliday ("09-MAR-2009", "Womens Day Observed"); - - lh.addStaticHoliday ("01-MAY-2009", "Labor Day"); - - lh.addStaticHoliday ("11-MAY-2009", "Victory Day Observed"); - - lh.addStaticHoliday ("12-JUN-2009", "Independence Day"); - - lh.addStaticHoliday ("04-NOV-2009", "National Unity Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("04-JAN-2010", "New Years Holiday Observed"); - - lh.addStaticHoliday ("07-JAN-2010", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2010", "Womens Day"); - - lh.addStaticHoliday ("10-MAY-2010", "Victory Day Observed"); - - lh.addStaticHoliday ("14-JUN-2010", "Independence Day Observed"); - - lh.addStaticHoliday ("04-NOV-2010", "National Unity Day"); - - lh.addStaticHoliday ("05-NOV-2010", "No Settlements"); - - lh.addStaticHoliday ("02-JAN-2011", "New Years Holiday"); - - lh.addStaticHoliday ("03-JAN-2011", "New Years Holiday Observed"); - - lh.addStaticHoliday ("04-JAN-2011", "New Years Day Observed"); - - lh.addStaticHoliday ("05-JAN-2011", "New Years Holiday"); - - lh.addStaticHoliday ("06-JAN-2011", "No Settlements"); - - lh.addStaticHoliday ("07-JAN-2011", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("10-JAN-2011", "No Settlements"); - - lh.addStaticHoliday ("23-FEB-2011", "Defender of the Fat"); - - lh.addStaticHoliday ("05-MAR-2011", "Settlement"); - - lh.addStaticHoliday ("07-MAR-2011", "National Holiday"); - - lh.addStaticHoliday ("08-MAR-2011", "Womens Day"); - - lh.addStaticHoliday ("01-MAY-2011", "International Labor"); - - lh.addStaticHoliday ("02-MAY-2011", "National Holiday"); - - lh.addStaticHoliday ("09-MAY-2011", "Victory Day"); - - lh.addStaticHoliday ("12-JUN-2011", "Day of Russia"); - - lh.addStaticHoliday ("13-JUN-2011", "National Holiday"); - - lh.addStaticHoliday ("04-NOV-2011", "National Unity Day"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Holiday"); - - lh.addStaticHoliday ("03-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("09-JAN-2012", "Orthodox Christmas Day Observed"); - - lh.addStaticHoliday ("08-MAR-2012", "Womens Day"); - - lh.addStaticHoliday ("01-MAY-2012", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2012", "Spring Day"); - - lh.addStaticHoliday ("09-MAY-2012", "Victory Day"); - - lh.addStaticHoliday ("12-JUN-2012", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2012", "National Holiday"); - - lh.addStaticHoliday ("12-DEC-2012", "Constitution Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2013", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-2013", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2013", "Womens Day"); - - lh.addStaticHoliday ("01-MAY-2013", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2013", "Spring Day"); - - lh.addStaticHoliday ("09-MAY-2013", "Victory Day"); - - lh.addStaticHoliday ("12-JUN-2013", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2013", "National Holiday"); - - lh.addStaticHoliday ("12-DEC-2013", "Constitution Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2014", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-2014", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("10-MAR-2014", "Womens Day Observed"); - - lh.addStaticHoliday ("01-MAY-2014", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2014", "Spring Day"); - - lh.addStaticHoliday ("09-MAY-2014", "Victory Day"); - - lh.addStaticHoliday ("12-JUN-2014", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2014", "National Holiday"); - - lh.addStaticHoliday ("12-DEC-2014", "Constitution Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2015", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-2015", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("09-MAR-2015", "Womens Day Observed"); - - lh.addStaticHoliday ("01-MAY-2015", "Labor Day"); - - lh.addStaticHoliday ("04-MAY-2015", "Spring Day Observed"); - - lh.addStaticHoliday ("11-MAY-2015", "Victory Day Observed"); - - lh.addStaticHoliday ("12-JUN-2015", "Independence Day"); - - lh.addStaticHoliday ("09-NOV-2015", "National Holiday Observed"); - - lh.addStaticHoliday ("14-DEC-2015", "Constitution Day Observed"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("04-JAN-2016", "New Years Holiday Observed"); - - lh.addStaticHoliday ("07-JAN-2016", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2016", "Womens Day"); - - lh.addStaticHoliday ("02-MAY-2016", "Spring Day"); - - lh.addStaticHoliday ("03-MAY-2016", "Labor Day Observed"); - - lh.addStaticHoliday ("09-MAY-2016", "Victory Day"); - - lh.addStaticHoliday ("13-JUN-2016", "Independence Day Observed"); - - lh.addStaticHoliday ("07-NOV-2016", "National Holiday"); - - lh.addStaticHoliday ("12-DEC-2016", "Constitution Day"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Holiday"); - - lh.addStaticHoliday ("03-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("09-JAN-2017", "Orthodox Christmas Day Observed"); - - lh.addStaticHoliday ("08-MAR-2017", "Womens Day"); - - lh.addStaticHoliday ("01-MAY-2017", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2017", "Spring Day"); - - lh.addStaticHoliday ("09-MAY-2017", "Victory Day"); - - lh.addStaticHoliday ("12-JUN-2017", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2017", "National Holiday"); - - lh.addStaticHoliday ("12-DEC-2017", "Constitution Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2018", "New Years Holiday"); - - lh.addStaticHoliday ("08-JAN-2018", "Orthodox Christmas Day Observed"); - - lh.addStaticHoliday ("08-MAR-2018", "Womens Day"); - - lh.addStaticHoliday ("01-MAY-2018", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2018", "Spring Day"); - - lh.addStaticHoliday ("09-MAY-2018", "Victory Day"); - - lh.addStaticHoliday ("12-JUN-2018", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2018", "National Holiday"); - - lh.addStaticHoliday ("12-DEC-2018", "Constitution Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2019", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-2019", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2019", "Womens Day"); - - lh.addStaticHoliday ("01-MAY-2019", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2019", "Spring Day"); - - lh.addStaticHoliday ("09-MAY-2019", "Victory Day"); - - lh.addStaticHoliday ("12-JUN-2019", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2019", "National Holiday"); - - lh.addStaticHoliday ("12-DEC-2019", "Constitution Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2020", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-2020", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("09-MAR-2020", "Womens Day Observed"); - - lh.addStaticHoliday ("01-MAY-2020", "Labor Day"); - - lh.addStaticHoliday ("04-MAY-2020", "Spring Day Observed"); - - lh.addStaticHoliday ("11-MAY-2020", "Victory Day Observed"); - - lh.addStaticHoliday ("12-JUN-2020", "Independence Day"); - - lh.addStaticHoliday ("09-NOV-2020", "National Holiday Observed"); - - lh.addStaticHoliday ("14-DEC-2020", "Constitution Day Observed"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("04-JAN-2021", "New Years Holiday Observed"); - - lh.addStaticHoliday ("07-JAN-2021", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2021", "Womens Day"); - - lh.addStaticHoliday ("03-MAY-2021", "Spring Day Observed"); - - lh.addStaticHoliday ("04-MAY-2021", "Labor Day Observed"); - - lh.addStaticHoliday ("10-MAY-2021", "Victory Day Observed"); - - lh.addStaticHoliday ("14-JUN-2021", "Independence Day Observed"); - - lh.addStaticHoliday ("08-NOV-2021", "National Holiday Observed"); - - lh.addStaticHoliday ("13-DEC-2021", "Constitution Day Observed"); - - lh.addStaticHoliday ("03-JAN-2022", "New Years Holiday Observed"); - - lh.addStaticHoliday ("04-JAN-2022", "New Years Day Observed"); - - lh.addStaticHoliday ("07-JAN-2022", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2022", "Womens Day"); - - lh.addStaticHoliday ("02-MAY-2022", "Spring Day"); - - lh.addStaticHoliday ("03-MAY-2022", "Labor Day Observed"); - - lh.addStaticHoliday ("09-MAY-2022", "Victory Day"); - - lh.addStaticHoliday ("13-JUN-2022", "Independence Day Observed"); - - lh.addStaticHoliday ("07-NOV-2022", "National Holiday"); - - lh.addStaticHoliday ("12-DEC-2022", "Constitution Day"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Holiday"); - - lh.addStaticHoliday ("03-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("09-JAN-2023", "Orthodox Christmas Day Observed"); - - lh.addStaticHoliday ("08-MAR-2023", "Womens Day"); - - lh.addStaticHoliday ("01-MAY-2023", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2023", "Spring Day"); - - lh.addStaticHoliday ("09-MAY-2023", "Victory Day"); - - lh.addStaticHoliday ("12-JUN-2023", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2023", "National Holiday"); - - lh.addStaticHoliday ("12-DEC-2023", "Constitution Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2024", "New Years Holiday"); - - lh.addStaticHoliday ("08-JAN-2024", "Orthodox Christmas Day Observed"); - - lh.addStaticHoliday ("08-MAR-2024", "Womens Day"); - - lh.addStaticHoliday ("01-MAY-2024", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2024", "Spring Day"); - - lh.addStaticHoliday ("09-MAY-2024", "Victory Day"); - - lh.addStaticHoliday ("12-JUN-2024", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2024", "National Holiday"); - - lh.addStaticHoliday ("12-DEC-2024", "Constitution Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2025", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-2025", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("10-MAR-2025", "Womens Day Observed"); - - lh.addStaticHoliday ("01-MAY-2025", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2025", "Spring Day"); - - lh.addStaticHoliday ("09-MAY-2025", "Victory Day"); - - lh.addStaticHoliday ("12-JUN-2025", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2025", "National Holiday"); - - lh.addStaticHoliday ("12-DEC-2025", "Constitution Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2026", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-2026", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("09-MAR-2026", "Womens Day Observed"); - - lh.addStaticHoliday ("01-MAY-2026", "Labor Day"); - - lh.addStaticHoliday ("04-MAY-2026", "Spring Day Observed"); - - lh.addStaticHoliday ("11-MAY-2026", "Victory Day Observed"); - - lh.addStaticHoliday ("12-JUN-2026", "Independence Day"); - - lh.addStaticHoliday ("09-NOV-2026", "National Holiday Observed"); - - lh.addStaticHoliday ("14-DEC-2026", "Constitution Day Observed"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("04-JAN-2027", "New Years Holiday Observed"); - - lh.addStaticHoliday ("07-JAN-2027", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2027", "Womens Day"); - - lh.addStaticHoliday ("03-MAY-2027", "Spring Day Observed"); - - lh.addStaticHoliday ("04-MAY-2027", "Labor Day Observed"); - - lh.addStaticHoliday ("10-MAY-2027", "Victory Day Observed"); - - lh.addStaticHoliday ("14-JUN-2027", "Independence Day Observed"); - - lh.addStaticHoliday ("08-NOV-2027", "National Holiday Observed"); - - lh.addStaticHoliday ("13-DEC-2027", "Constitution Day Observed"); - - lh.addStaticHoliday ("03-JAN-2028", "New Years Holiday Observed"); - - lh.addStaticHoliday ("04-JAN-2028", "New Years Day Observed"); - - lh.addStaticHoliday ("07-JAN-2028", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2028", "Womens Day"); - - lh.addStaticHoliday ("01-MAY-2028", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2028", "Spring Day"); - - lh.addStaticHoliday ("09-MAY-2028", "Victory Day"); - - lh.addStaticHoliday ("12-JUN-2028", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2028", "National Holiday"); - - lh.addStaticHoliday ("12-DEC-2028", "Constitution Day"); - - lh.addStaticHoliday ("null", ""); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/RURHoliday.java b/org/drip/analytics/holset/RURHoliday.java deleted file mode 100644 index 011355c..0000000 --- a/org/drip/analytics/holset/RURHoliday.java +++ /dev/null @@ -1,83 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class RURHoliday implements org.drip.analytics.holset.LocationHoliday { - public RURHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "RUR"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1997", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-1997", "New Years Holiday"); - - lh.addStaticHoliday ("07-JAN-1997", "Christmas Day (Orthodox)"); - - lh.addStaticHoliday ("08-MAR-1997", "International Womens Day"); - - lh.addStaticHoliday ("10-MAR-1997", "International Womans Day"); - - lh.addStaticHoliday ("01-APR-1997", "Foundation of the Commonwealth"); - - lh.addStaticHoliday ("01-MAY-1997", "International Labor Day"); - - lh.addStaticHoliday ("02-MAY-1997", "International Labor holiday"); - - lh.addStaticHoliday ("09-MAY-1997", "Victory Day"); - - lh.addStaticHoliday ("12-JUN-1997", "Declaration of independance"); - - lh.addStaticHoliday ("07-NOV-1997", "80th An of October Revolution"); - - lh.addStaticHoliday ("12-DEC-1997", "Constitution Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/SARHoliday.java b/org/drip/analytics/holset/SARHoliday.java deleted file mode 100644 index 6e551d8..0000000 --- a/org/drip/analytics/holset/SARHoliday.java +++ /dev/null @@ -1,1105 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class SARHoliday implements org.drip.analytics.holset.LocationHoliday { - public SARHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "SAR"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("27-JAN-1998", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("28-JAN-1998", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("29-JAN-1998", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("31-JAN-1998", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-FEB-1998", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-FEB-1998", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("03-FEB-1998", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("12-APR-1998", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-JAN-1999", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("17-JAN-1999", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("18-JAN-1999", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("19-JAN-1999", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("20-JAN-1999", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("21-JAN-1999", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("23-JAN-1999", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("23-MAR-1999", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-MAR-1999", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-MAR-1999", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("27-MAR-1999", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-MAR-1999", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-MAR-1999", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("30-MAR-1999", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("31-MAR-1999", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-APR-1999", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-JAN-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("06-JAN-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("08-JAN-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("09-JAN-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("10-JAN-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("11-JAN-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("12-JAN-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("11-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("12-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("14-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("15-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("21-MAR-2000", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-DEC-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("25-DEC-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-DEC-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("27-DEC-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("28-DEC-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("30-DEC-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("31-DEC-2000", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-MAR-2001", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-DEC-2001", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("15-DEC-2001", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2001", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("17-DEC-2001", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("18-DEC-2001", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("19-DEC-2001", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("20-DEC-2001", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("18-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("21-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("26-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("27-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-FEB-2002", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-DEC-2002", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("04-DEC-2002", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("05-DEC-2002", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("07-DEC-2002", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("08-DEC-2002", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("09-DEC-2002", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("10-DEC-2002", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("08-FEB-2003", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-FEB-2003", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-FEB-2003", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-FEB-2003", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("12-FEB-2003", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-FEB-2003", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("15-FEB-2003", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-FEB-2003", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-FEB-2003", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("22-NOV-2003", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("23-NOV-2003", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("24-NOV-2003", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("25-NOV-2003", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-NOV-2003", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("27-NOV-2003", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("29-NOV-2003", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("27-JAN-2004", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-JAN-2004", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-JAN-2004", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("31-JAN-2004", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-FEB-2004", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-FEB-2004", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-FEB-2004", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-FEB-2004", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-FEB-2004", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-NOV-2004", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("13-NOV-2004", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("14-NOV-2004", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("15-NOV-2004", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("16-NOV-2004", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("17-NOV-2004", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("18-NOV-2004", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("16-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("22-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("26-JAN-2005", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("31-OCT-2005", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-NOV-2005", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-NOV-2005", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("03-NOV-2005", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("05-NOV-2005", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("06-NOV-2005", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("07-NOV-2005", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("05-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("12-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("14-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("15-JAN-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("21-OCT-2006", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("22-OCT-2006", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("23-OCT-2006", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("24-OCT-2006", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("25-OCT-2006", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-OCT-2006", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("28-OCT-2006", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-DEC-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("27-DEC-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-DEC-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("30-DEC-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("31-DEC-2006", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-JAN-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-JAN-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-JAN-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-JAN-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-OCT-2007", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("11-OCT-2007", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("13-OCT-2007", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("14-OCT-2007", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("15-OCT-2007", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("16-OCT-2007", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("17-OCT-2007", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("15-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("22-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-DEC-2007", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-SEP-2008", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("29-SEP-2008", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("30-SEP-2008", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-OCT-2008", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-OCT-2008", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("04-OCT-2008", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("05-OCT-2008", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("03-DEC-2008", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-DEC-2008", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-DEC-2008", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-DEC-2008", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-DEC-2008", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-DEC-2008", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-DEC-2008", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-DEC-2008", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-DEC-2008", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-SEP-2009", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("19-SEP-2009", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("20-SEP-2009", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("21-SEP-2009", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("22-SEP-2009", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("23-SEP-2009", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("24-SEP-2009", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("22-NOV-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-NOV-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-NOV-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-NOV-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("26-NOV-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-NOV-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-NOV-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("30-NOV-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-DEC-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-DEC-2009", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-SEP-2010", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("08-SEP-2010", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("09-SEP-2010", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("11-SEP-2010", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("12-SEP-2010", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("13-SEP-2010", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("14-SEP-2010", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("13-NOV-2010", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("14-NOV-2010", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("15-NOV-2010", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-NOV-2010", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-NOV-2010", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-NOV-2010", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-NOV-2010", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("21-NOV-2010", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("22-NOV-2010", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("27-AUG-2011", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("28-AUG-2011", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("29-AUG-2011", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("30-AUG-2011", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("31-AUG-2011", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-SEP-2011", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("03-SEP-2011", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-NOV-2011", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-NOV-2011", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-NOV-2011", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-NOV-2011", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-NOV-2011", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-NOV-2011", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-NOV-2011", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-NOV-2011", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-NOV-2011", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-AUG-2012", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("18-AUG-2012", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("19-AUG-2012", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("20-AUG-2012", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("21-AUG-2012", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("22-AUG-2012", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("23-AUG-2012", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("21-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("22-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("27-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("30-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("31-OCT-2012", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-AUG-2013", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2013", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("07-AUG-2013", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("08-AUG-2013", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("10-AUG-2013", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("11-AUG-2013", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("12-AUG-2013", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("10-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("12-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("14-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("15-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-OCT-2013", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("26-JUL-2014", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("27-JUL-2014", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("28-JUL-2014", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("29-JUL-2014", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("30-JUL-2014", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("31-JUL-2014", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-AUG-2014", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("30-SEP-2014", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-OCT-2014", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-OCT-2014", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-OCT-2014", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-OCT-2014", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-OCT-2014", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-OCT-2014", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-OCT-2014", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-OCT-2014", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("15-JUL-2015", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("16-JUL-2015", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("18-JUL-2015", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("19-JUL-2015", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("20-JUL-2015", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("21-JUL-2015", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("22-JUL-2015", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("19-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("21-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("22-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("26-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("27-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-SEP-2015", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-JUL-2016", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("04-JUL-2016", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("05-JUL-2016", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("06-JUL-2016", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("07-JUL-2016", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("09-JUL-2016", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("10-JUL-2016", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("07-SEP-2016", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-SEP-2016", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-SEP-2016", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-SEP-2016", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("12-SEP-2016", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-SEP-2016", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("14-SEP-2016", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("15-SEP-2016", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-SEP-2016", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("22-JUN-2017", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("24-JUN-2017", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("25-JUN-2017", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-JUN-2017", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("27-JUN-2017", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("28-JUN-2017", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("29-JUN-2017", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("27-AUG-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-AUG-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-AUG-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("30-AUG-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("31-AUG-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-SEP-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-SEP-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-SEP-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-SEP-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-SEP-2017", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("12-JUN-2018", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("13-JUN-2018", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("14-JUN-2018", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("16-JUN-2018", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("17-JUN-2018", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("18-JUN-2018", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("19-JUN-2018", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("18-AUG-2018", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-AUG-2018", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-AUG-2018", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("21-AUG-2018", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("22-AUG-2018", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("23-AUG-2018", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-AUG-2018", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("26-AUG-2018", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("27-AUG-2018", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-JUN-2019", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("03-JUN-2019", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("04-JUN-2019", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("05-JUN-2019", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("06-JUN-2019", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("08-JUN-2019", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("09-JUN-2019", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("06-AUG-2019", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-AUG-2019", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-AUG-2019", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-AUG-2019", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-AUG-2019", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("12-AUG-2019", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-AUG-2019", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("14-AUG-2019", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("15-AUG-2019", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("21-MAY-2020", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("23-MAY-2020", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("24-MAY-2020", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("25-MAY-2020", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-MAY-2020", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("27-MAY-2020", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("28-MAY-2020", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-JUL-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("27-JUL-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-JUL-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-JUL-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("30-JUL-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-AUG-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-AUG-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-AUG-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-AUG-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-AUG-2020", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-MAY-2021", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("11-MAY-2021", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("12-MAY-2021", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("13-MAY-2021", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("15-MAY-2021", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("16-MAY-2021", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("17-MAY-2021", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("15-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("21-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("22-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-JUL-2021", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("30-APR-2022", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-MAY-2022", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-MAY-2022", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("03-MAY-2022", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("04-MAY-2022", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("05-MAY-2022", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("04-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("12-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("14-JUL-2022", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-APR-2023", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("20-APR-2023", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("22-APR-2023", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("23-APR-2023", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("24-APR-2023", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("25-APR-2023", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-APR-2023", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("24-JUN-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-JUN-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("26-JUN-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("27-JUN-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-JUN-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-JUN-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-JUL-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-JUL-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-JUL-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-JUL-2023", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-APR-2024", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("08-APR-2024", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("09-APR-2024", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("10-APR-2024", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("11-APR-2024", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("13-APR-2024", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("14-APR-2024", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("12-JUN-2024", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-JUN-2024", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("15-JUN-2024", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-JUN-2024", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-JUN-2024", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-JUN-2024", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-JUN-2024", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-JUN-2024", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("22-JUN-2024", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("29-MAR-2025", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("30-MAR-2025", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("31-MAR-2025", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-APR-2025", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-APR-2025", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("03-APR-2025", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("05-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("11-JUN-2025", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-MAR-2026", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("18-MAR-2026", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("19-MAR-2026", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("21-MAR-2026", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("22-MAR-2026", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("23-MAR-2026", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("24-MAR-2026", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("23-MAY-2026", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-MAY-2026", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("25-MAY-2026", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("26-MAY-2026", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("27-MAY-2026", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("28-MAY-2026", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("30-MAY-2026", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("31-MAY-2026", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-JUN-2026", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-MAR-2027", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("08-MAR-2027", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("09-MAR-2027", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("10-MAR-2027", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("11-MAR-2027", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("13-MAR-2027", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("14-MAR-2027", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("12-MAY-2027", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("13-MAY-2027", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("15-MAY-2027", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("16-MAY-2027", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("17-MAY-2027", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("18-MAY-2027", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("19-MAY-2027", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("20-MAY-2027", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("22-MAY-2027", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("24-FEB-2028", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("26-FEB-2028", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("27-FEB-2028", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("28-FEB-2028", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("29-FEB-2028", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("01-MAR-2028", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("02-MAR-2028", "Eid Al Fiter Holiday Period"); - - lh.addStaticHoliday ("30-APR-2028", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("01-MAY-2028", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("02-MAY-2028", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("03-MAY-2028", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("04-MAY-2028", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("06-MAY-2028", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("07-MAY-2028", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("08-MAY-2028", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("09-MAY-2028", "Eid Al Adha Holiday Period"); - - lh.addStaticHoliday ("10-MAY-2028", "Eid Al Adha Holiday Period"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/SEKHoliday.java b/org/drip/analytics/holset/SEKHoliday.java deleted file mode 100644 index 70049c3..0000000 --- a/org/drip/analytics/holset/SEKHoliday.java +++ /dev/null @@ -1,675 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class SEKHoliday implements org.drip.analytics.holset.LocationHoliday { - public SEKHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "SEK"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1998", "Epiphany"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-1998", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-1998", "Whit Monday"); - - lh.addStaticHoliday ("19-JUN-1998", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-1998", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-1998", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1999", "Epiphany"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-1999", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-1999", "Whit Monday"); - - lh.addStaticHoliday ("25-JUN-1999", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-1999", "Christmas Eve"); - - lh.addStaticHoliday ("31-DEC-1999", "New Years Eve"); - - lh.addStaticHoliday ("06-JAN-2000", "Epiphany"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("01-JUN-2000", "Ascension Day"); - - lh.addStaticHoliday ("12-JUN-2000", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2000", "Midsummers Eve"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2001", "Ascension Day"); - - lh.addStaticHoliday ("04-JUN-2001", "Whit Monday"); - - lh.addStaticHoliday ("22-JUN-2001", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2001", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2001", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2002", "Ascension Day"); - - lh.addStaticHoliday ("20-MAY-2002", "Whit Monday"); - - lh.addStaticHoliday ("21-JUN-2002", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2002", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2002", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2003", "Epiphany"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2003", "Ascension Day"); - - lh.addStaticHoliday ("09-JUN-2003", "Whit Monday"); - - lh.addStaticHoliday ("20-JUN-2003", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2003", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2003", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2004", "Epiphany"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("20-MAY-2004", "Ascension Day"); - - lh.addStaticHoliday ("31-MAY-2004", "Whit Monday"); - - lh.addStaticHoliday ("25-JUN-2004", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2004", "Christmas Eve"); - - lh.addStaticHoliday ("31-DEC-2004", "New Years Eve"); - - lh.addStaticHoliday ("06-JAN-2005", "Epiphany"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2005", "Ascension Day"); - - lh.addStaticHoliday ("16-MAY-2005", "Whit Monday"); - - lh.addStaticHoliday ("24-JUN-2005", "Midsummers Eve"); - - lh.addStaticHoliday ("26-DEC-2005", "Boxing Day"); - - lh.addStaticHoliday ("06-JAN-2006", "Epiphany"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2006", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2006", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2006", "Midsummers Eve"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2007", "Ascension Day"); - - lh.addStaticHoliday ("28-MAY-2007", "Whit Monday"); - - lh.addStaticHoliday ("22-JUN-2007", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2007", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2007", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("12-MAY-2008", "Whit Monday"); - - lh.addStaticHoliday ("20-JUN-2008", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2008", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2008", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2009", "Epiphany"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2009", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-2009", "Whit Monday"); - - lh.addStaticHoliday ("19-JUN-2009", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2009", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2009", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2010", "Epiphany"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-2010", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-2010", "Whit Monday"); - - lh.addStaticHoliday ("25-JUN-2010", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2010", "Christmas Eve"); - - lh.addStaticHoliday ("31-DEC-2010", "New Years Eve"); - - lh.addStaticHoliday ("06-JAN-2011", "Epiphany"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("02-JUN-2011", "Ascension Day"); - - lh.addStaticHoliday ("13-JUN-2011", "Whit Monday"); - - lh.addStaticHoliday ("24-JUN-2011", "Midsummers Eve"); - - lh.addStaticHoliday ("26-DEC-2011", "Boxing Day"); - - lh.addStaticHoliday ("06-JAN-2012", "Epiphany"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2012", "Ascension Day"); - - lh.addStaticHoliday ("28-MAY-2012", "Whit Monday"); - - lh.addStaticHoliday ("22-JUN-2012", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2012", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2012", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2013", "Ascension Day"); - - lh.addStaticHoliday ("20-MAY-2013", "Whit Monday"); - - lh.addStaticHoliday ("21-JUN-2013", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2013", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2013", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2014", "Epiphany"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2014", "Ascension Day"); - - lh.addStaticHoliday ("09-JUN-2014", "Whit Monday"); - - lh.addStaticHoliday ("20-JUN-2014", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2014", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2014", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2015", "Epiphany"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("14-MAY-2015", "Ascension Day"); - - lh.addStaticHoliday ("25-MAY-2015", "Whit Monday"); - - lh.addStaticHoliday ("19-JUN-2015", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2015", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2015", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2016", "Epiphany"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2016", "Ascension Day"); - - lh.addStaticHoliday ("16-MAY-2016", "Whit Monday"); - - lh.addStaticHoliday ("24-JUN-2016", "Midsummers Eve"); - - lh.addStaticHoliday ("26-DEC-2016", "Boxing Day"); - - lh.addStaticHoliday ("06-JAN-2017", "Epiphany"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2017", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2017", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2017", "Midsummers Eve"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("10-MAY-2018", "Ascension Day"); - - lh.addStaticHoliday ("21-MAY-2018", "Whit Monday"); - - lh.addStaticHoliday ("22-JUN-2018", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2018", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2018", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2019", "Ascension Day"); - - lh.addStaticHoliday ("10-JUN-2019", "Whit Monday"); - - lh.addStaticHoliday ("21-JUN-2019", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2019", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2019", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2020", "Epiphany"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2020", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-2020", "Whit Monday"); - - lh.addStaticHoliday ("19-JUN-2020", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2020", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2020", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2021", "Epiphany"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-2021", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-2021", "Whit Monday"); - - lh.addStaticHoliday ("25-JUN-2021", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2021", "Christmas Eve"); - - lh.addStaticHoliday ("31-DEC-2021", "New Years Eve"); - - lh.addStaticHoliday ("06-JAN-2022", "Epiphany"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("26-MAY-2022", "Ascension Day"); - - lh.addStaticHoliday ("06-JUN-2022", "Whit Monday"); - - lh.addStaticHoliday ("24-JUN-2022", "Midsummers Eve"); - - lh.addStaticHoliday ("26-DEC-2022", "Boxing Day"); - - lh.addStaticHoliday ("06-JAN-2023", "Epiphany"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("18-MAY-2023", "Ascension Day"); - - lh.addStaticHoliday ("29-MAY-2023", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2023", "Midsummers Eve"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2024", "Ascension Day"); - - lh.addStaticHoliday ("20-MAY-2024", "Whit Monday"); - - lh.addStaticHoliday ("21-JUN-2024", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2024", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2024", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2025", "Epiphany"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2025", "Ascension Day"); - - lh.addStaticHoliday ("09-JUN-2025", "Whit Monday"); - - lh.addStaticHoliday ("20-JUN-2025", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2025", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Boxing Day"); - - lh.addStaticHoliday ("31-DEC-2025", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2026", "Epiphany"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("14-MAY-2026", "Ascension Day"); - - lh.addStaticHoliday ("25-MAY-2026", "Whit Monday"); - - lh.addStaticHoliday ("19-JUN-2026", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2026", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2026", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2027", "Epiphany"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("06-MAY-2027", "Ascension Day"); - - lh.addStaticHoliday ("17-MAY-2027", "Whit Monday"); - - lh.addStaticHoliday ("25-JUN-2027", "Midsummers Eve"); - - lh.addStaticHoliday ("24-DEC-2027", "Christmas Eve"); - - lh.addStaticHoliday ("31-DEC-2027", "New Years Eve"); - - lh.addStaticHoliday ("06-JAN-2028", "Epiphany"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2028", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2028", "Whit Monday"); - - lh.addStaticHoliday ("23-JUN-2028", "Midsummers Eve"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Boxing Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/SGDHoliday.java b/org/drip/analytics/holset/SGDHoliday.java deleted file mode 100644 index 1bd8607..0000000 --- a/org/drip/analytics/holset/SGDHoliday.java +++ /dev/null @@ -1,1305 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class SGDHoliday implements org.drip.analytics.holset.LocationHoliday { - public SGDHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "SGD"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-1999", "Hari Raya Puasa"); - - lh.addStaticHoliday ("16-FEB-1999", "Chinese New Year"); - - lh.addStaticHoliday ("17-FEB-1999", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("29-MAR-1999", "Hari Raya Haji Observed"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("09-AUG-1999", "National Day"); - - lh.addStaticHoliday ("08-NOV-1999", "Deepavali Observed"); - - lh.addStaticHoliday ("31-DEC-1999", "Special Holiday"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("24-JAN-2001", "Chinese New Year"); - - lh.addStaticHoliday ("25-JAN-2001", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("06-MAR-2001", "Hari Raya Haji"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("07-MAY-2001", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2001", "National Day"); - - lh.addStaticHoliday ("03-NOV-2001", "Election Day"); - - lh.addStaticHoliday ("14-NOV-2001", "Deepavali"); - - lh.addStaticHoliday ("17-DEC-2001", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("12-FEB-2002", "Chinese New Year"); - - lh.addStaticHoliday ("13-FEB-2002", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("23-FEB-2002", "Hari Raya Haji"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("27-MAY-2002", "Vesak Day Observed"); - - lh.addStaticHoliday ("09-AUG-2002", "National Day"); - - lh.addStaticHoliday ("04-NOV-2002", "Deepavali"); - - lh.addStaticHoliday ("06-DEC-2002", "Hari Raya Puasa"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("01-FEB-2003", "Chinese New Year"); - - lh.addStaticHoliday ("03-FEB-2003", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("12-FEB-2003", "Hari Raya Haji"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("15-MAY-2003", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2003", "National Day"); - - lh.addStaticHoliday ("24-OCT-2003", "Deepavali"); - - lh.addStaticHoliday ("25-NOV-2003", "Hari Raya Puasa"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("22-JAN-2004", "Chinese New Year"); - - lh.addStaticHoliday ("23-JAN-2004", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("01-FEB-2004", "Hari Raya Haji"); - - lh.addStaticHoliday ("02-FEB-2004", "Special Holiday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2004", "Labour Day"); - - lh.addStaticHoliday ("02-JUN-2004", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2004", "National Day"); - - lh.addStaticHoliday ("11-NOV-2004", "Deepavali"); - - lh.addStaticHoliday ("14-NOV-2004", "Hari Raya Puasa"); - - lh.addStaticHoliday ("15-NOV-2004", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("25-DEC-2004", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2005", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2005", "Hari Raya Haji"); - - lh.addStaticHoliday ("09-FEB-2005", "Chinese New Year"); - - lh.addStaticHoliday ("10-FEB-2005", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("02-MAY-2005", "Labour Day Observed"); - - lh.addStaticHoliday ("23-MAY-2005", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2005", "National Day"); - - lh.addStaticHoliday ("01-NOV-2005", "Deepavali"); - - lh.addStaticHoliday ("03-NOV-2005", "Hari Raya Puasa"); - - lh.addStaticHoliday ("26-DEC-2005", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("10-JAN-2006", "Hari Raya Haji"); - - lh.addStaticHoliday ("30-JAN-2006", "Chinese New Year Observed"); - - lh.addStaticHoliday ("31-JAN-2006", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2006", "Election Day"); - - lh.addStaticHoliday ("12-MAY-2006", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2006", "National Day"); - - lh.addStaticHoliday ("21-OCT-2006", "Deepavali"); - - lh.addStaticHoliday ("24-OCT-2006", "Hari Raya Puasa"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2007", "Bank Holiday"); - - lh.addStaticHoliday ("19-FEB-2007", "Chinese New Year Observed"); - - lh.addStaticHoliday ("20-FEB-2007", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("31-MAY-2007", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2007", "National Day"); - - lh.addStaticHoliday ("13-OCT-2007", "Hari Raya Puasa"); - - lh.addStaticHoliday ("08-NOV-2007", "Deepavali"); - - lh.addStaticHoliday ("20-DEC-2007", "Hari Raya Haji"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("07-FEB-2008", "Chinese New Year"); - - lh.addStaticHoliday ("08-FEB-2008", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("19-MAY-2008", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2008", "National Day"); - - lh.addStaticHoliday ("01-OCT-2008", "Hari Raya Puasa"); - - lh.addStaticHoliday ("27-OCT-2008", "Deepavali"); - - lh.addStaticHoliday ("08-DEC-2008", "Hari Raya Haji"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2009", "Chinese New Year"); - - lh.addStaticHoliday ("27-JAN-2009", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2009", "Vesak Day"); - - lh.addStaticHoliday ("10-AUG-2009", "National Day Observed"); - - lh.addStaticHoliday ("21-SEP-2009", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("17-OCT-2009", "Deepavali"); - - lh.addStaticHoliday ("27-NOV-2009", "Hari Raya Haji"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("15-FEB-2010", "Chinese New Year Observed"); - - lh.addStaticHoliday ("16-FEB-2010", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2010", "Labour Day"); - - lh.addStaticHoliday ("28-MAY-2010", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2010", "National Day"); - - lh.addStaticHoliday ("10-SEP-2010", "Hari Raya Puasa"); - - lh.addStaticHoliday ("05-NOV-2010", "Deepavali"); - - lh.addStaticHoliday ("17-NOV-2010", "Hari Raya Haji"); - - lh.addStaticHoliday ("25-DEC-2010", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2011", "New Years Day"); - - lh.addStaticHoliday ("03-FEB-2011", "Chinese New Year"); - - lh.addStaticHoliday ("04-FEB-2011", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("02-MAY-2011", "Labour Day Observed"); - - lh.addStaticHoliday ("07-MAY-2011", "Bank Holiday"); - - lh.addStaticHoliday ("17-MAY-2011", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2011", "National Day"); - - lh.addStaticHoliday ("30-AUG-2011", "Hari Raya Puasa"); - - lh.addStaticHoliday ("26-OCT-2011", "Deepavali"); - - lh.addStaticHoliday ("07-NOV-2011", "Hari Raya Haji Observed"); - - lh.addStaticHoliday ("26-DEC-2011", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("23-JAN-2012", "Chinese New Year"); - - lh.addStaticHoliday ("24-JAN-2012", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("09-AUG-2012", "National Day"); - - lh.addStaticHoliday ("20-AUG-2012", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("26-OCT-2012", "Hari Raya Haji"); - - lh.addStaticHoliday ("14-NOV-2012", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2013", "Chinese New Year Observed"); - - lh.addStaticHoliday ("12-FEB-2013", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2013", "Vesak Day"); - - lh.addStaticHoliday ("08-AUG-2013", "Hari Raya Puasa"); - - lh.addStaticHoliday ("09-AUG-2013", "National Day"); - - lh.addStaticHoliday ("15-OCT-2013", "Hari Raya Haji"); - - lh.addStaticHoliday ("04-NOV-2013", "Bank Holiday"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("31-JAN-2014", "Chinese New Year"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("13-MAY-2014", "Vesak Day"); - - lh.addStaticHoliday ("28-JUL-2014", "Hari Raya Puasa"); - - lh.addStaticHoliday ("06-OCT-2014", "Hari Raya Haji Observed"); - - lh.addStaticHoliday ("22-OCT-2014", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("19-FEB-2015", "Chinese New Year"); - - lh.addStaticHoliday ("20-FEB-2015", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("01-JUN-2015", "Vesak Day"); - - lh.addStaticHoliday ("17-JUL-2015", "Hari Raya Puasa"); - - lh.addStaticHoliday ("10-AUG-2015", "National Day Observed"); - - lh.addStaticHoliday ("24-SEP-2015", "Hari Raya Haji"); - - lh.addStaticHoliday ("10-NOV-2015", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2016", "Chinese New Year"); - - lh.addStaticHoliday ("09-FEB-2016", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("02-MAY-2016", "Labour Day Observed"); - - lh.addStaticHoliday ("06-JUL-2016", "Hari Raya Puasa"); - - lh.addStaticHoliday ("09-AUG-2016", "National Day"); - - lh.addStaticHoliday ("12-SEP-2016", "Hari Raya Haji"); - - lh.addStaticHoliday ("26-DEC-2016", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("30-JAN-2017", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("10-MAY-2017", "Vesak Day"); - - lh.addStaticHoliday ("26-JUN-2017", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("09-AUG-2017", "National Day"); - - lh.addStaticHoliday ("01-SEP-2017", "Hari Raya Haji"); - - lh.addStaticHoliday ("18-OCT-2017", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2018", "Chinese New Year"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2018", "Vesak Day"); - - lh.addStaticHoliday ("15-JUN-2018", "Hari Raya Puasa"); - - lh.addStaticHoliday ("09-AUG-2018", "National Day"); - - lh.addStaticHoliday ("22-AUG-2018", "Hari Raya Haji"); - - lh.addStaticHoliday ("06-NOV-2018", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2019", "Chinese New Year"); - - lh.addStaticHoliday ("06-FEB-2019", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("20-MAY-2019", "Vesak Day Observed"); - - lh.addStaticHoliday ("05-JUN-2019", "Hari Raya Puasa"); - - lh.addStaticHoliday ("09-AUG-2019", "National Day"); - - lh.addStaticHoliday ("12-AUG-2019", "Hari Raya Haji Observed"); - - lh.addStaticHoliday ("28-OCT-2019", "Deepavali Observed"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("27-JAN-2020", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("07-MAY-2020", "Vesak Day"); - - lh.addStaticHoliday ("25-MAY-2020", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("31-JUL-2020", "Hari Raya Haji"); - - lh.addStaticHoliday ("10-AUG-2020", "National Day Observed"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("12-FEB-2021", "Chinese New Year"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("13-MAY-2021", "Hari Raya Puasa"); - - lh.addStaticHoliday ("26-MAY-2021", "Vesak Day"); - - lh.addStaticHoliday ("20-JUL-2021", "Hari Raya Haji"); - - lh.addStaticHoliday ("09-AUG-2021", "National Day"); - - lh.addStaticHoliday ("04-NOV-2021", "Deepavali"); - - lh.addStaticHoliday ("01-FEB-2022", "Chinese New Year"); - - lh.addStaticHoliday ("02-FEB-2022", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("02-MAY-2022", "Labour Day Observed"); - - lh.addStaticHoliday ("16-MAY-2022", "Vesak Day Observed"); - - lh.addStaticHoliday ("09-AUG-2022", "National Day"); - - lh.addStaticHoliday ("24-OCT-2022", "Deepavali"); - - lh.addStaticHoliday ("26-DEC-2022", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("23-JAN-2023", "Chinese New Year Observed"); - - lh.addStaticHoliday ("24-JAN-2023", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2023", "Hari Raya Puasa"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("02-JUN-2023", "Vesak Day"); - - lh.addStaticHoliday ("28-JUN-2023", "Hari Raya Haji"); - - lh.addStaticHoliday ("09-AUG-2023", "National Day"); - - lh.addStaticHoliday ("13-NOV-2023", "Deepavali Observed"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("12-FEB-2024", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2024", "Hari Raya Puasa"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("22-MAY-2024", "Vesak Day"); - - lh.addStaticHoliday ("17-JUN-2024", "Hari Raya Haji"); - - lh.addStaticHoliday ("09-AUG-2024", "National Day"); - - lh.addStaticHoliday ("31-OCT-2024", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("29-JAN-2025", "Chinese New Year"); - - lh.addStaticHoliday ("30-JAN-2025", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("31-MAR-2025", "Hari Raya Puasa"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("12-MAY-2025", "Vesak Day"); - - lh.addStaticHoliday ("06-JUN-2025", "Hari Raya Haji"); - - lh.addStaticHoliday ("20-OCT-2025", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("17-FEB-2026", "Chinese New Year"); - - lh.addStaticHoliday ("18-FEB-2026", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("20-MAR-2026", "Hari Raya Puasa"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("27-MAY-2026", "Hari Raya Haji"); - - lh.addStaticHoliday ("01-JUN-2026", "Vesak Day Observed"); - - lh.addStaticHoliday ("10-AUG-2026", "National Day Observed"); - - lh.addStaticHoliday ("09-NOV-2026", "Deepavali Observed"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2027", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("10-MAR-2027", "Hari Raya Puasa"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("17-MAY-2027", "Hari Raya Haji"); - - lh.addStaticHoliday ("20-MAY-2027", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2027", "National Day"); - - lh.addStaticHoliday ("28-OCT-2027", "Deepavali"); - - lh.addStaticHoliday ("26-JAN-2028", "Chinese New Year"); - - lh.addStaticHoliday ("27-JAN-2028", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("28-FEB-2028", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2028", "Hari Raya Haji"); - - lh.addStaticHoliday ("09-MAY-2028", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2028", "National Day"); - - lh.addStaticHoliday ("17-OCT-2028", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2029", "New Years Day"); - - lh.addStaticHoliday ("13-FEB-2029", "Chinese New Year"); - - lh.addStaticHoliday ("14-FEB-2029", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("15-FEB-2029", "Hari Raya Puasa"); - - lh.addStaticHoliday ("30-MAR-2029", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2029", "Hari Raya Haji"); - - lh.addStaticHoliday ("01-MAY-2029", "Labour Day"); - - lh.addStaticHoliday ("28-MAY-2029", "Vesak Day Observed"); - - lh.addStaticHoliday ("09-AUG-2029", "National Day"); - - lh.addStaticHoliday ("05-NOV-2029", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2029", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2030", "New Years Day"); - - lh.addStaticHoliday ("04-FEB-2030", "Chinese New Year Observed"); - - lh.addStaticHoliday ("05-FEB-2030", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("06-FEB-2030", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("19-APR-2030", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2030", "Labour Day"); - - lh.addStaticHoliday ("16-MAY-2030", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2030", "National Day"); - - lh.addStaticHoliday ("25-DEC-2030", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2031", "New Years Day"); - - lh.addStaticHoliday ("23-JAN-2031", "Chinese New Year"); - - lh.addStaticHoliday ("24-JAN-2031", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("03-APR-2031", "Hari Raya Haji"); - - lh.addStaticHoliday ("11-APR-2031", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2031", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2031", "Vesak Day"); - - lh.addStaticHoliday ("14-NOV-2031", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2031", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2032", "New Years Day"); - - lh.addStaticHoliday ("14-JAN-2032", "Hari Raya Puasa"); - - lh.addStaticHoliday ("11-FEB-2032", "Chinese New Year"); - - lh.addStaticHoliday ("12-FEB-2032", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("22-MAR-2032", "Hari Raya Haji"); - - lh.addStaticHoliday ("26-MAR-2032", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2032", "Vesak Day Observed"); - - lh.addStaticHoliday ("09-AUG-2032", "National Day"); - - lh.addStaticHoliday ("02-NOV-2032", "Deepavali"); - - lh.addStaticHoliday ("03-JAN-2033", "Hari Raya Puasa"); - - lh.addStaticHoliday ("31-JAN-2033", "Chinese New Year"); - - lh.addStaticHoliday ("01-FEB-2033", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("15-APR-2033", "Good Friday"); - - lh.addStaticHoliday ("02-MAY-2033", "Labour Day Observed"); - - lh.addStaticHoliday ("13-MAY-2033", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2033", "National Day"); - - lh.addStaticHoliday ("23-DEC-2033", "Hari Raya Puasa"); - - lh.addStaticHoliday ("26-DEC-2033", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2034", "New Years Day Observed"); - - lh.addStaticHoliday ("20-FEB-2034", "Chinese New Year Observed"); - - lh.addStaticHoliday ("21-FEB-2034", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("01-MAR-2034", "Hari Raya Haji"); - - lh.addStaticHoliday ("07-APR-2034", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2034", "Labour Day"); - - lh.addStaticHoliday ("01-JUN-2034", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2034", "National Day"); - - lh.addStaticHoliday ("09-NOV-2034", "Deepavali"); - - lh.addStaticHoliday ("12-DEC-2034", "Hari Raya Puasa"); - - lh.addStaticHoliday ("25-DEC-2034", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2035", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2035", "Chinese New Year"); - - lh.addStaticHoliday ("09-FEB-2035", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("19-FEB-2035", "Hari Raya Haji"); - - lh.addStaticHoliday ("23-MAR-2035", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2035", "Labour Day"); - - lh.addStaticHoliday ("22-MAY-2035", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2035", "National Day"); - - lh.addStaticHoliday ("30-OCT-2035", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2035", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2036", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-2036", "Chinese New Year"); - - lh.addStaticHoliday ("29-JAN-2036", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("08-FEB-2036", "Hari Raya Haji"); - - lh.addStaticHoliday ("11-APR-2036", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2036", "Labour Day"); - - lh.addStaticHoliday ("19-NOV-2036", "Hari Raya Puasa"); - - lh.addStaticHoliday ("25-DEC-2036", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2037", "New Years Day"); - - lh.addStaticHoliday ("27-JAN-2037", "Hari Raya Haji"); - - lh.addStaticHoliday ("16-FEB-2037", "Chinese New Year Observed"); - - lh.addStaticHoliday ("17-FEB-2037", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("03-APR-2037", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2037", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2037", "Vesak Day"); - - lh.addStaticHoliday ("10-AUG-2037", "National Day Observed"); - - lh.addStaticHoliday ("06-NOV-2037", "Deepavali"); - - lh.addStaticHoliday ("09-NOV-2037", "Hari Raya Puasa"); - - lh.addStaticHoliday ("25-DEC-2037", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2038", "New Years Day"); - - lh.addStaticHoliday ("04-FEB-2038", "Chinese New Year"); - - lh.addStaticHoliday ("05-FEB-2038", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("23-APR-2038", "Good Friday"); - - lh.addStaticHoliday ("18-MAY-2038", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2038", "National Day"); - - lh.addStaticHoliday ("27-OCT-2038", "Deepavali"); - - lh.addStaticHoliday ("29-OCT-2038", "Hari Raya Puasa"); - - lh.addStaticHoliday ("05-JAN-2039", "Hari Raya Haji"); - - lh.addStaticHoliday ("24-JAN-2039", "Chinese New Year"); - - lh.addStaticHoliday ("25-JAN-2039", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("08-APR-2039", "Good Friday"); - - lh.addStaticHoliday ("02-MAY-2039", "Labour Day Observed"); - - lh.addStaticHoliday ("09-AUG-2039", "National Day"); - - lh.addStaticHoliday ("19-OCT-2039", "Hari Raya Puasa"); - - lh.addStaticHoliday ("15-NOV-2039", "Deepavali"); - - lh.addStaticHoliday ("26-DEC-2039", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2040", "New Years Day Observed"); - - lh.addStaticHoliday ("13-FEB-2040", "Chinese New Year Observed"); - - lh.addStaticHoliday ("14-FEB-2040", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("30-MAR-2040", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2040", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2040", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2040", "National Day"); - - lh.addStaticHoliday ("08-OCT-2040", "Hari Raya Puasa"); - - lh.addStaticHoliday ("25-DEC-2040", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2041", "New Years Day"); - - lh.addStaticHoliday ("01-FEB-2041", "Chinese New Year"); - - lh.addStaticHoliday ("19-APR-2041", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2041", "Labour Day"); - - lh.addStaticHoliday ("14-MAY-2041", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2041", "National Day"); - - lh.addStaticHoliday ("27-SEP-2041", "Hari Raya Puasa"); - - lh.addStaticHoliday ("23-OCT-2041", "Deepavali"); - - lh.addStaticHoliday ("04-DEC-2041", "Hari Raya Haji"); - - lh.addStaticHoliday ("25-DEC-2041", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2042", "New Years Day"); - - lh.addStaticHoliday ("22-JAN-2042", "Chinese New Year"); - - lh.addStaticHoliday ("23-JAN-2042", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("04-APR-2042", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2042", "Labour Day"); - - lh.addStaticHoliday ("02-JUN-2042", "Vesak Day"); - - lh.addStaticHoliday ("16-SEP-2042", "Hari Raya Puasa"); - - lh.addStaticHoliday ("11-NOV-2042", "Deepavali"); - - lh.addStaticHoliday ("24-NOV-2042", "Hari Raya Haji Observed"); - - lh.addStaticHoliday ("25-DEC-2042", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2043", "New Years Day"); - - lh.addStaticHoliday ("10-FEB-2043", "Chinese New Year"); - - lh.addStaticHoliday ("11-FEB-2043", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("27-MAR-2043", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2043", "Labour Day"); - - lh.addStaticHoliday ("10-AUG-2043", "National Day Observed"); - - lh.addStaticHoliday ("12-NOV-2043", "Hari Raya Haji"); - - lh.addStaticHoliday ("25-DEC-2043", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2044", "New Years Day"); - - lh.addStaticHoliday ("01-FEB-2044", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("15-APR-2044", "Good Friday"); - - lh.addStaticHoliday ("02-MAY-2044", "Labour Day Observed"); - - lh.addStaticHoliday ("12-MAY-2044", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2044", "National Day"); - - lh.addStaticHoliday ("24-AUG-2044", "Hari Raya Puasa"); - - lh.addStaticHoliday ("20-OCT-2044", "Deepavali"); - - lh.addStaticHoliday ("31-OCT-2044", "Hari Raya Haji"); - - lh.addStaticHoliday ("26-DEC-2044", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2045", "New Years Day Observed"); - - lh.addStaticHoliday ("17-FEB-2045", "Chinese New Year"); - - lh.addStaticHoliday ("07-APR-2045", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2045", "Labour Day"); - - lh.addStaticHoliday ("31-MAY-2045", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2045", "National Day"); - - lh.addStaticHoliday ("14-AUG-2045", "Hari Raya Puasa"); - - lh.addStaticHoliday ("08-NOV-2045", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2045", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2046", "New Years Day"); - - lh.addStaticHoliday ("06-FEB-2046", "Chinese New Year"); - - lh.addStaticHoliday ("07-FEB-2046", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("23-MAR-2046", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2046", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2046", "Vesak Day Observed"); - - lh.addStaticHoliday ("09-AUG-2046", "National Day"); - - lh.addStaticHoliday ("10-OCT-2046", "Hari Raya Haji"); - - lh.addStaticHoliday ("29-OCT-2046", "Deepavali Observed"); - - lh.addStaticHoliday ("25-DEC-2046", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2047", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-2047", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("12-APR-2047", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2047", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2047", "Vesak Day"); - - lh.addStaticHoliday ("24-JUL-2047", "Hari Raya Puasa"); - - lh.addStaticHoliday ("09-AUG-2047", "National Day"); - - lh.addStaticHoliday ("30-SEP-2047", "Hari Raya Haji"); - - lh.addStaticHoliday ("18-OCT-2047", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2047", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2048", "New Years Day"); - - lh.addStaticHoliday ("14-FEB-2048", "Chinese New Year"); - - lh.addStaticHoliday ("03-APR-2048", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2048", "Labour Day"); - - lh.addStaticHoliday ("27-MAY-2048", "Vesak Day"); - - lh.addStaticHoliday ("13-JUL-2048", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("10-AUG-2048", "National Day Observed"); - - lh.addStaticHoliday ("05-NOV-2048", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2048", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2049", "New Years Day"); - - lh.addStaticHoliday ("02-FEB-2049", "Chinese New Year"); - - lh.addStaticHoliday ("03-FEB-2049", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("16-APR-2049", "Good Friday"); - - lh.addStaticHoliday ("17-MAY-2049", "Vesak Day Observed"); - - lh.addStaticHoliday ("01-JUL-2049", "Hari Raya Puasa"); - - lh.addStaticHoliday ("09-AUG-2049", "National Day"); - - lh.addStaticHoliday ("08-SEP-2049", "Hari Raya Haji"); - - lh.addStaticHoliday ("25-OCT-2049", "Deepavali"); - - lh.addStaticHoliday ("24-JAN-2050", "Chinese New Year Observed"); - - lh.addStaticHoliday ("25-JAN-2050", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("08-APR-2050", "Good Friday"); - - lh.addStaticHoliday ("02-MAY-2050", "Labour Day Observed"); - - lh.addStaticHoliday ("05-MAY-2050", "Vesak Day"); - - lh.addStaticHoliday ("21-JUN-2050", "Hari Raya Puasa"); - - lh.addStaticHoliday ("09-AUG-2050", "National Day"); - - lh.addStaticHoliday ("29-AUG-2050", "Hari Raya Haji Observed"); - - lh.addStaticHoliday ("14-NOV-2050", "Deepavali Observed"); - - lh.addStaticHoliday ("26-DEC-2050", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2051", "New Years Day Observed"); - - lh.addStaticHoliday ("13-FEB-2051", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("31-MAR-2051", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2051", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2051", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2051", "National Day"); - - lh.addStaticHoliday ("17-AUG-2051", "Hari Raya Haji"); - - lh.addStaticHoliday ("02-NOV-2051", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2051", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2052", "New Years Day"); - - lh.addStaticHoliday ("01-FEB-2052", "Chinese New Year"); - - lh.addStaticHoliday ("02-FEB-2052", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("19-APR-2052", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2052", "Labour Day"); - - lh.addStaticHoliday ("13-MAY-2052", "Vesak Day"); - - lh.addStaticHoliday ("30-MAY-2052", "Hari Raya Puasa"); - - lh.addStaticHoliday ("05-AUG-2052", "Hari Raya Haji"); - - lh.addStaticHoliday ("09-AUG-2052", "National Day"); - - lh.addStaticHoliday ("21-OCT-2052", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2052", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2053", "New Years Day"); - - lh.addStaticHoliday ("19-FEB-2053", "Chinese New Year"); - - lh.addStaticHoliday ("20-FEB-2053", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("04-APR-2053", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2053", "Labour Day"); - - lh.addStaticHoliday ("19-MAY-2053", "Hari Raya Puasa"); - - lh.addStaticHoliday ("02-JUN-2053", "Vesak Day Observed"); - - lh.addStaticHoliday ("10-NOV-2053", "Deepavali Observed"); - - lh.addStaticHoliday ("25-DEC-2053", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2054", "New Years Day"); - - lh.addStaticHoliday ("09-FEB-2054", "Chinese New Year Observed"); - - lh.addStaticHoliday ("10-FEB-2054", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("27-MAR-2054", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2054", "Labour Day"); - - lh.addStaticHoliday ("22-MAY-2054", "Vesak Day"); - - lh.addStaticHoliday ("16-JUL-2054", "Hari Raya Haji"); - - lh.addStaticHoliday ("10-AUG-2054", "National Day Observed"); - - lh.addStaticHoliday ("30-OCT-2054", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2054", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2055", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-2055", "Chinese New Year"); - - lh.addStaticHoliday ("29-JAN-2055", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("16-APR-2055", "Good Friday"); - - lh.addStaticHoliday ("28-APR-2055", "Hari Raya Puasa"); - - lh.addStaticHoliday ("11-MAY-2055", "Vesak Day"); - - lh.addStaticHoliday ("05-JUL-2055", "Hari Raya Haji"); - - lh.addStaticHoliday ("09-AUG-2055", "National Day"); - - lh.addStaticHoliday ("19-OCT-2055", "Deepavali"); - - lh.addStaticHoliday ("15-FEB-2056", "Chinese New Year"); - - lh.addStaticHoliday ("16-FEB-2056", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("31-MAR-2056", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2056", "Hari Raya Puasa Observed"); - - lh.addStaticHoliday ("01-MAY-2056", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2056", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2056", "National Day"); - - lh.addStaticHoliday ("06-NOV-2056", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2056", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2057", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2057", "Chinese New Year Observed"); - - lh.addStaticHoliday ("06-FEB-2057", "Second Day of Chinese New Year Observed"); - - lh.addStaticHoliday ("05-APR-2057", "Hari Raya Puasa"); - - lh.addStaticHoliday ("20-APR-2057", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2057", "Labour Day"); - - lh.addStaticHoliday ("18-MAY-2057", "Vesak Day"); - - lh.addStaticHoliday ("13-JUN-2057", "Hari Raya Haji"); - - lh.addStaticHoliday ("09-AUG-2057", "National Day"); - - lh.addStaticHoliday ("25-DEC-2057", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2058", "New Years Day"); - - lh.addStaticHoliday ("24-JAN-2058", "Chinese New Year"); - - lh.addStaticHoliday ("25-JAN-2058", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("26-MAR-2058", "Hari Raya Puasa"); - - lh.addStaticHoliday ("12-APR-2058", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2058", "Labour Day"); - - lh.addStaticHoliday ("07-MAY-2058", "Vesak Day"); - - lh.addStaticHoliday ("03-JUN-2058", "Hari Raya Haji Observed"); - - lh.addStaticHoliday ("09-AUG-2058", "National Day"); - - lh.addStaticHoliday ("15-NOV-2058", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2058", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2059", "New Years Day"); - - lh.addStaticHoliday ("12-FEB-2059", "Chinese New Year"); - - lh.addStaticHoliday ("13-FEB-2059", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("28-MAR-2059", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2059", "Labour Day"); - - lh.addStaticHoliday ("22-MAY-2059", "Hari Raya Haji"); - - lh.addStaticHoliday ("26-MAY-2059", "Vesak Day"); - - lh.addStaticHoliday ("04-NOV-2059", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2059", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2060", "New Years Day"); - - lh.addStaticHoliday ("02-FEB-2060", "Chinese New Year"); - - lh.addStaticHoliday ("03-FEB-2060", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("04-MAR-2060", "Hari Raya Puasa"); - - lh.addStaticHoliday ("16-APR-2060", "Good Friday"); - - lh.addStaticHoliday ("11-MAY-2060", "Hari Raya Haji"); - - lh.addStaticHoliday ("14-MAY-2060", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2060", "National Day"); - - lh.addStaticHoliday ("21-JAN-2061", "Chinese New Year"); - - lh.addStaticHoliday ("22-FEB-2061", "Hari Raya Puasa"); - - lh.addStaticHoliday ("08-APR-2061", "Good Friday"); - - lh.addStaticHoliday ("02-MAY-2061", "Labour Day Observed"); - - lh.addStaticHoliday ("04-MAY-2061", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2061", "National Day"); - - lh.addStaticHoliday ("11-NOV-2061", "Deepavali"); - - lh.addStaticHoliday ("26-DEC-2061", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2062", "New Years Day Observed"); - - lh.addStaticHoliday ("09-FEB-2062", "Chinese New Year"); - - lh.addStaticHoliday ("10-FEB-2062", "Second Day of Chinese New Year"); - - lh.addStaticHoliday ("24-MAR-2062", "Good Friday"); - - lh.addStaticHoliday ("20-APR-2062", "Hari Raya Haji"); - - lh.addStaticHoliday ("01-MAY-2062", "Labour Day"); - - lh.addStaticHoliday ("23-MAY-2062", "Vesak Day"); - - lh.addStaticHoliday ("09-AUG-2062", "National Day"); - - lh.addStaticHoliday ("31-OCT-2062", "Deepavali"); - - lh.addStaticHoliday ("25-DEC-2062", "Christmas Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/SITHoliday.java b/org/drip/analytics/holset/SITHoliday.java deleted file mode 100644 index 69db349..0000000 --- a/org/drip/analytics/holset/SITHoliday.java +++ /dev/null @@ -1,641 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class SITHoliday implements org.drip.analytics.holset.LocationHoliday { - public SITHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "SIT"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-1998", "New Years Holiday"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-1998", "National Holiday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("25-JUN-1998", "Slovenian Sovereignty Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-1999", "Day of Slovenian Culture"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-1999", "National Holiday"); - - lh.addStaticHoliday ("25-JUN-1999", "Slovenian Sovereignty Day"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("08-FEB-2000", "Day of Slovenian Culture"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-2000", "National Holiday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2000", "Day after Labour Day"); - - lh.addStaticHoliday ("15-AUG-2000", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2000", "Reformation Day"); - - lh.addStaticHoliday ("01-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2001", "New Years Holiday"); - - lh.addStaticHoliday ("08-FEB-2001", "Day of Slovenian Culture"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-2001", "National Holiday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2001", "Day after Labour Day"); - - lh.addStaticHoliday ("25-JUN-2001", "Slovenian Sovereignty Day"); - - lh.addStaticHoliday ("15-AUG-2001", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2001", "Reformation Day"); - - lh.addStaticHoliday ("01-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2002", "New Years Holiday"); - - lh.addStaticHoliday ("08-FEB-2002", "Day of Slovenian Culture"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2002", "Day after Labour Day"); - - lh.addStaticHoliday ("25-JUN-2002", "Slovenian Sovereignty Day"); - - lh.addStaticHoliday ("15-AUG-2002", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2002", "Reformation Day"); - - lh.addStaticHoliday ("01-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2003", "New Years Holiday"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2003", "Day after Labour Day"); - - lh.addStaticHoliday ("25-JUN-2003", "Slovenian Sovereignty Day"); - - lh.addStaticHoliday ("15-AUG-2003", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2003", "Reformation Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2004", "New Years Holiday"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-2004", "National Holiday"); - - lh.addStaticHoliday ("25-JUN-2004", "Slovenian Sovereignty Day"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("08-FEB-2005", "Day of Slovenian Culture"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-2005", "National Holiday"); - - lh.addStaticHoliday ("02-MAY-2005", "Day after Labour Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2005", "Reformation Day"); - - lh.addStaticHoliday ("01-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("26-DEC-2005", "Independence Day"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Holiday"); - - lh.addStaticHoliday ("08-FEB-2006", "Day of Slovenian Culture"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-2006", "National Holiday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2006", "Day after Labour Day"); - - lh.addStaticHoliday ("15-AUG-2006", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2006", "Reformation Day"); - - lh.addStaticHoliday ("01-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2007", "New Years Holiday"); - - lh.addStaticHoliday ("08-FEB-2007", "Day of Slovenian Culture"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-2007", "National Holiday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2007", "Day after Labour Day"); - - lh.addStaticHoliday ("25-JUN-2007", "Slovenian Sovereignty Day"); - - lh.addStaticHoliday ("15-AUG-2007", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2007", "Reformation Day"); - - lh.addStaticHoliday ("01-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2008", "New Years Holiday"); - - lh.addStaticHoliday ("08-FEB-2008", "Day of Slovenian Culture"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2008", "Day after Labour Day"); - - lh.addStaticHoliday ("25-JUN-2008", "Slovenian Sovereignty Day"); - - lh.addStaticHoliday ("15-AUG-2008", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2008", "Reformation Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2009", "New Years Holiday"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-2009", "National Holiday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("25-JUN-2009", "Slovenian Sovereignty Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2010", "Day of Slovenian Culture"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-2010", "National Holiday"); - - lh.addStaticHoliday ("25-JUN-2010", "Slovenian Sovereignty Day"); - - lh.addStaticHoliday ("01-NOV-2010", "All Saints Day"); - - lh.addStaticHoliday ("08-FEB-2011", "Day of Slovenian Culture"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-2011", "National Holiday"); - - lh.addStaticHoliday ("02-MAY-2011", "Day after Labour Day"); - - lh.addStaticHoliday ("15-AUG-2011", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2011", "Reformation Day"); - - lh.addStaticHoliday ("01-NOV-2011", "All Saints Day"); - - lh.addStaticHoliday ("26-DEC-2011", "Independence Day"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Holiday"); - - lh.addStaticHoliday ("08-FEB-2012", "Day of Slovenian Culture"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-2012", "National Holiday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2012", "Day after Labour Day"); - - lh.addStaticHoliday ("25-JUN-2012", "Slovenian Sovereignty Day"); - - lh.addStaticHoliday ("15-AUG-2012", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2012", "Reformation Day"); - - lh.addStaticHoliday ("01-NOV-2012", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2013", "New Years Holiday"); - - lh.addStaticHoliday ("08-FEB-2013", "Day of Slovenian Culture"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2013", "Day after Labour Day"); - - lh.addStaticHoliday ("25-JUN-2013", "Slovenian Sovereignty Day"); - - lh.addStaticHoliday ("15-AUG-2013", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2013", "Reformation Day"); - - lh.addStaticHoliday ("01-NOV-2013", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2014", "New Years Holiday"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2014", "Day after Labour Day"); - - lh.addStaticHoliday ("25-JUN-2014", "Slovenian Sovereignty Day"); - - lh.addStaticHoliday ("15-AUG-2014", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2014", "Reformation Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2015", "New Years Holiday"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-2015", "National Holiday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("25-JUN-2015", "Slovenian Sovereignty Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2016", "Day of Slovenian Culture"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-2016", "National Holiday"); - - lh.addStaticHoliday ("02-MAY-2016", "Day after Labour Day"); - - lh.addStaticHoliday ("15-AUG-2016", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2016", "Reformation Day"); - - lh.addStaticHoliday ("01-NOV-2016", "All Saints Day"); - - lh.addStaticHoliday ("26-DEC-2016", "Independence Day"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Holiday"); - - lh.addStaticHoliday ("08-FEB-2017", "Day of Slovenian Culture"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-2017", "National Holiday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2017", "Day after Labour Day"); - - lh.addStaticHoliday ("15-AUG-2017", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2017", "Reformation Day"); - - lh.addStaticHoliday ("01-NOV-2017", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2018", "New Years Holiday"); - - lh.addStaticHoliday ("08-FEB-2018", "Day of Slovenian Culture"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-2018", "National Holiday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2018", "Day after Labour Day"); - - lh.addStaticHoliday ("25-JUN-2018", "Slovenian Sovereignty Day"); - - lh.addStaticHoliday ("15-AUG-2018", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2018", "Reformation Day"); - - lh.addStaticHoliday ("01-NOV-2018", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2019", "New Years Holiday"); - - lh.addStaticHoliday ("08-FEB-2019", "Day of Slovenian Culture"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2019", "Day after Labour Day"); - - lh.addStaticHoliday ("25-JUN-2019", "Slovenian Sovereignty Day"); - - lh.addStaticHoliday ("15-AUG-2019", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2019", "Reformation Day"); - - lh.addStaticHoliday ("01-NOV-2019", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2020", "New Years Holiday"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-2020", "National Holiday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("25-JUN-2020", "Slovenian Sovereignty Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2021", "Day of Slovenian Culture"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-2021", "National Holiday"); - - lh.addStaticHoliday ("25-JUN-2021", "Slovenian Sovereignty Day"); - - lh.addStaticHoliday ("01-NOV-2021", "All Saints Day"); - - lh.addStaticHoliday ("08-FEB-2022", "Day of Slovenian Culture"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-2022", "National Holiday"); - - lh.addStaticHoliday ("02-MAY-2022", "Day after Labour Day"); - - lh.addStaticHoliday ("15-AUG-2022", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2022", "Reformation Day"); - - lh.addStaticHoliday ("01-NOV-2022", "All Saints Day"); - - lh.addStaticHoliday ("26-DEC-2022", "Independence Day"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Holiday"); - - lh.addStaticHoliday ("08-FEB-2023", "Day of Slovenian Culture"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-2023", "National Holiday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2023", "Day after Labour Day"); - - lh.addStaticHoliday ("15-AUG-2023", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2023", "Reformation Day"); - - lh.addStaticHoliday ("01-NOV-2023", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2024", "New Years Holiday"); - - lh.addStaticHoliday ("08-FEB-2024", "Day of Slovenian Culture"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2024", "Day after Labour Day"); - - lh.addStaticHoliday ("25-JUN-2024", "Slovenian Sovereignty Day"); - - lh.addStaticHoliday ("15-AUG-2024", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2024", "Reformation Day"); - - lh.addStaticHoliday ("01-NOV-2024", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2025", "New Years Holiday"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2025", "Day after Labour Day"); - - lh.addStaticHoliday ("25-JUN-2025", "Slovenian Sovereignty Day"); - - lh.addStaticHoliday ("15-AUG-2025", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2025", "Reformation Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2026", "New Years Holiday"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-2026", "National Holiday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("25-JUN-2026", "Slovenian Sovereignty Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2027", "Day of Slovenian Culture"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-2027", "National Holiday"); - - lh.addStaticHoliday ("25-JUN-2027", "Slovenian Sovereignty Day"); - - lh.addStaticHoliday ("01-NOV-2027", "All Saints Day"); - - lh.addStaticHoliday ("08-FEB-2028", "Day of Slovenian Culture"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-2028", "National Holiday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("02-MAY-2028", "Day after Labour Day"); - - lh.addStaticHoliday ("15-AUG-2028", "Assumption Day"); - - lh.addStaticHoliday ("31-OCT-2028", "Reformation Day"); - - lh.addStaticHoliday ("01-NOV-2028", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Independence Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/SKKHoliday.java b/org/drip/analytics/holset/SKKHoliday.java deleted file mode 100644 index af3a7f5..0000000 --- a/org/drip/analytics/holset/SKKHoliday.java +++ /dev/null @@ -1,191 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class SKKHoliday implements org.drip.analytics.holset.LocationHoliday { - public SKKHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "SKK"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1997", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-1997", "Epiphany"); - - lh.addStaticHoliday ("28-MAR-1997", "Good Friday"); - - lh.addStaticHoliday ("31-MAR-1997", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1997", "International Labor Day"); - - lh.addStaticHoliday ("08-MAY-1997", "Anniversary of Liberation"); - - lh.addStaticHoliday ("05-JUL-1997", "Sts. Cyril Methodias"); - - lh.addStaticHoliday ("29-AUG-1997", "Slovak National Uprising"); - - lh.addStaticHoliday ("01-SEP-1997", "Constitution Day"); - - lh.addStaticHoliday ("15-SEP-1997", "Seven Sorrows of Virgin Mary"); - - lh.addStaticHoliday ("01-NOV-1997", "All Saints Day"); - - lh.addStaticHoliday ("24-DEC-1997", "Christmas Eve"); - - lh.addStaticHoliday ("25-DEC-1997", "Christma Day"); - - lh.addStaticHoliday ("26-DEC-1997", "St. Stephens Day"); - - lh.addStaticHoliday ("06-JAN-2005", "Non Settlement Day"); - - lh.addStaticHoliday ("25-MAR-2005", "Non Settlement Day"); - - lh.addStaticHoliday ("28-MAR-2005", "Non Settlement Day"); - - lh.addStaticHoliday ("05-JUL-2005", "Non Settlement Day"); - - lh.addStaticHoliday ("29-AUG-2005", "Non Settlement Day"); - - lh.addStaticHoliday ("01-SEP-2005", "Non Settlement Day"); - - lh.addStaticHoliday ("15-SEP-2005", "Non Settlement Day"); - - lh.addStaticHoliday ("01-NOV-2005", "Non Settlement Day"); - - lh.addStaticHoliday ("17-NOV-2005", "Non Settlement Day"); - - lh.addStaticHoliday ("26-DEC-2005", "Non Settlement Day"); - - lh.addStaticHoliday ("27-DEC-2005", "Non Settlement Day"); - - lh.addStaticHoliday ("28-DEC-2005", "Non Settlement Day"); - - lh.addStaticHoliday ("29-DEC-2005", "Non Settlement Day"); - - lh.addStaticHoliday ("30-DEC-2005", "Non Settlement Day"); - - lh.addStaticHoliday ("02-JAN-2006", "Non Settlement Day"); - - lh.addStaticHoliday ("03-JAN-2006", "Non Settlement Day"); - - lh.addStaticHoliday ("04-JAN-2006", "Non Settlement Day"); - - lh.addStaticHoliday ("05-JAN-2006", "Non Settlement Day"); - - lh.addStaticHoliday ("06-JAN-2006", "Non Settlement Day"); - - lh.addStaticHoliday ("14-APR-2006", "Non Settlement Day"); - - lh.addStaticHoliday ("17-APR-2006", "Non Settlement Day"); - - lh.addStaticHoliday ("01-MAY-2006", "Non Settlement Day"); - - lh.addStaticHoliday ("08-MAY-2006", "Non Settlement Day"); - - lh.addStaticHoliday ("05-JUL-2006", "Non Settlement Day"); - - lh.addStaticHoliday ("29-AUG-2006", "Non Settlement Day"); - - lh.addStaticHoliday ("01-SEP-2006", "Non Settlement Day"); - - lh.addStaticHoliday ("15-SEP-2006", "Non Settlement Day"); - - lh.addStaticHoliday ("01-NOV-2006", "Non Settlement Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Non Settlement Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Non Settlement Day"); - - lh.addStaticHoliday ("01-JAN-2007", "Non Settlement Day"); - - lh.addStaticHoliday ("06-APR-2007", "Non Settlement Day"); - - lh.addStaticHoliday ("09-APR-2007", "Non Settlement Day"); - - lh.addStaticHoliday ("01-MAY-2007", "Non Settlement Day"); - - lh.addStaticHoliday ("08-MAY-2007", "Non Settlement Day"); - - lh.addStaticHoliday ("05-JUL-2007", "Non Settlement Day"); - - lh.addStaticHoliday ("29-AUG-2007", "Non Settlement Day"); - - lh.addStaticHoliday ("01-NOV-2007", "Non Settlement Day"); - - lh.addStaticHoliday ("24-DEC-2007", "Non Settlement Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Non Settlement Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Non Settlement Day"); - - lh.addStaticHoliday ("01-JAN-2008", "Non Settlement Day"); - - lh.addStaticHoliday ("21-MAR-2008", "Non Settlement Day"); - - lh.addStaticHoliday ("24-MAR-2008", "Non Settlement Day"); - - lh.addStaticHoliday ("01-MAY-2008", "Non Settlement Day"); - - lh.addStaticHoliday ("08-MAY-2008", "Non Settlement Day"); - - lh.addStaticHoliday ("29-AUG-2008", "Non Settlement Day"); - - lh.addStaticHoliday ("01-SEP-2008", "Non Settlement Day"); - - lh.addStaticHoliday ("15-SEP-2008", "Non Settlement Day"); - - lh.addStaticHoliday ("24-DEC-2008", "Non Settlement Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Non Settlement Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Non Settlement Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/SVCHoliday.java b/org/drip/analytics/holset/SVCHoliday.java deleted file mode 100644 index 372af54..0000000 --- a/org/drip/analytics/holset/SVCHoliday.java +++ /dev/null @@ -1,693 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class SVCHoliday implements org.drip.analytics.holset.LocationHoliday { - public SVCHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "SVC"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("08-APR-1998", "Holy Wednesday"); - - lh.addStaticHoliday ("09-APR-1998", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labor Day"); - - lh.addStaticHoliday ("30-JUN-1998", "Bank Holiday"); - - lh.addStaticHoliday ("04-AUG-1998", "Agostinas Holiday"); - - lh.addStaticHoliday ("05-AUG-1998", "Agostinas Holiday"); - - lh.addStaticHoliday ("06-AUG-1998", "Agostinas Holiday"); - - lh.addStaticHoliday ("15-SEP-1998", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-1998", "All Souls Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-1998", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("31-MAR-1999", "Holy Wednesday"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("30-JUN-1999", "Bank Holiday"); - - lh.addStaticHoliday ("04-AUG-1999", "Agostinas Holiday"); - - lh.addStaticHoliday ("05-AUG-1999", "Agostinas Holiday"); - - lh.addStaticHoliday ("06-AUG-1999", "Agostinas Holiday"); - - lh.addStaticHoliday ("15-SEP-1999", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-1999", "All Souls Day"); - - lh.addStaticHoliday ("31-DEC-1999", "Bank Holiday"); - - lh.addStaticHoliday ("19-APR-2000", "Holy Wednesday"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labor Day"); - - lh.addStaticHoliday ("30-JUN-2000", "Bank Holiday"); - - lh.addStaticHoliday ("04-AUG-2000", "Agostinas Holiday"); - - lh.addStaticHoliday ("15-SEP-2000", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2000", "All Souls Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("11-APR-2001", "Holy Wednesday"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labor Day"); - - lh.addStaticHoliday ("06-AUG-2001", "Agostinas Holiday"); - - lh.addStaticHoliday ("02-NOV-2001", "All Souls Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2001", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("27-MAR-2002", "Holy Wednesday"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labor Day"); - - lh.addStaticHoliday ("05-AUG-2002", "Agostinas Holiday"); - - lh.addStaticHoliday ("06-AUG-2002", "Agostinas Holiday"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2002", "Bank Holiday"); - - lh.addStaticHoliday ("31-DEC-2002", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("16-APR-2003", "Holy Wednesday"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labor Day"); - - lh.addStaticHoliday ("30-JUN-2003", "Bank Holiday"); - - lh.addStaticHoliday ("05-AUG-2003", "Agostinas Holiday"); - - lh.addStaticHoliday ("06-AUG-2003", "Agostinas Holiday"); - - lh.addStaticHoliday ("15-SEP-2003", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2003", "Bank Holiday"); - - lh.addStaticHoliday ("31-DEC-2003", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("07-APR-2004", "Holy Wednesday"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("30-JUN-2004", "Bank Holiday"); - - lh.addStaticHoliday ("05-AUG-2004", "Agostinas Holiday"); - - lh.addStaticHoliday ("06-AUG-2004", "Agostinas Holiday"); - - lh.addStaticHoliday ("15-SEP-2004", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2004", "All Souls Day"); - - lh.addStaticHoliday ("30-DEC-2004", "Bank Holiday"); - - lh.addStaticHoliday ("31-DEC-2004", "Bank Holiday"); - - lh.addStaticHoliday ("23-MAR-2005", "Holy Wednesday"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("30-JUN-2005", "Bank Holiday"); - - lh.addStaticHoliday ("05-AUG-2005", "Agostinas Holiday"); - - lh.addStaticHoliday ("15-SEP-2005", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2005", "All Souls Day"); - - lh.addStaticHoliday ("30-DEC-2005", "Bank Holiday"); - - lh.addStaticHoliday ("12-APR-2006", "Holy Wednesday"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labor Day"); - - lh.addStaticHoliday ("30-JUN-2006", "Bank Holiday"); - - lh.addStaticHoliday ("15-SEP-2006", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2006", "All Souls Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("04-APR-2007", "Holy Wednesday"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labor Day"); - - lh.addStaticHoliday ("06-AUG-2007", "Agostinas Holiday"); - - lh.addStaticHoliday ("02-NOV-2007", "All Souls Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2007", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("19-MAR-2008", "Holy Wednesday"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labor Day"); - - lh.addStaticHoliday ("30-JUN-2008", "Bank Holiday"); - - lh.addStaticHoliday ("05-AUG-2008", "Agostinas Holiday"); - - lh.addStaticHoliday ("06-AUG-2008", "Agostinas Holiday"); - - lh.addStaticHoliday ("15-SEP-2008", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2008", "Bank Holiday"); - - lh.addStaticHoliday ("31-DEC-2008", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("08-APR-2009", "Holy Wednesday"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labor Day"); - - lh.addStaticHoliday ("30-JUN-2009", "Bank Holiday"); - - lh.addStaticHoliday ("05-AUG-2009", "Agostinas Holiday"); - - lh.addStaticHoliday ("06-AUG-2009", "Agostinas Holiday"); - - lh.addStaticHoliday ("15-SEP-2009", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2009", "All Souls Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2009", "Bank Holiday"); - - lh.addStaticHoliday ("31-DEC-2009", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("31-MAR-2010", "Holy Wednesday"); - - lh.addStaticHoliday ("01-APR-2010", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("30-JUN-2010", "Bank Holiday"); - - lh.addStaticHoliday ("05-AUG-2010", "Agostinas Holiday"); - - lh.addStaticHoliday ("06-AUG-2010", "Agostinas Holiday"); - - lh.addStaticHoliday ("15-SEP-2010", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2010", "All Souls Day"); - - lh.addStaticHoliday ("30-DEC-2010", "Bank Holiday"); - - lh.addStaticHoliday ("31-DEC-2010", "Bank Holiday"); - - lh.addStaticHoliday ("20-APR-2011", "Holy Wednesday"); - - lh.addStaticHoliday ("21-APR-2011", "Holy Thursday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("30-JUN-2011", "Bank Holiday"); - - lh.addStaticHoliday ("05-AUG-2011", "Agostinas Holiday"); - - lh.addStaticHoliday ("15-SEP-2011", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2011", "All Souls Day"); - - lh.addStaticHoliday ("30-DEC-2011", "Bank Holiday"); - - lh.addStaticHoliday ("04-APR-2012", "Holy Wednesday"); - - lh.addStaticHoliday ("05-APR-2012", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labor Day"); - - lh.addStaticHoliday ("06-AUG-2012", "Agostinas Holiday"); - - lh.addStaticHoliday ("02-NOV-2012", "All Souls Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2012", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("27-MAR-2013", "Holy Wednesday"); - - lh.addStaticHoliday ("28-MAR-2013", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labor Day"); - - lh.addStaticHoliday ("05-AUG-2013", "Agostinas Holiday"); - - lh.addStaticHoliday ("06-AUG-2013", "Agostinas Holiday"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2013", "Bank Holiday"); - - lh.addStaticHoliday ("31-DEC-2013", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("16-APR-2014", "Holy Wednesday"); - - lh.addStaticHoliday ("17-APR-2014", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labor Day"); - - lh.addStaticHoliday ("30-JUN-2014", "Bank Holiday"); - - lh.addStaticHoliday ("05-AUG-2014", "Agostinas Holiday"); - - lh.addStaticHoliday ("06-AUG-2014", "Agostinas Holiday"); - - lh.addStaticHoliday ("15-SEP-2014", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2014", "Bank Holiday"); - - lh.addStaticHoliday ("31-DEC-2014", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2015", "Holy Wednesday"); - - lh.addStaticHoliday ("02-APR-2015", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labor Day"); - - lh.addStaticHoliday ("30-JUN-2015", "Bank Holiday"); - - lh.addStaticHoliday ("05-AUG-2015", "Agostinas Holiday"); - - lh.addStaticHoliday ("06-AUG-2015", "Agostinas Holiday"); - - lh.addStaticHoliday ("15-SEP-2015", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2015", "All Souls Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2015", "Bank Holiday"); - - lh.addStaticHoliday ("31-DEC-2015", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("23-MAR-2016", "Holy Wednesday"); - - lh.addStaticHoliday ("24-MAR-2016", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("30-JUN-2016", "Bank Holiday"); - - lh.addStaticHoliday ("05-AUG-2016", "Agostinas Holiday"); - - lh.addStaticHoliday ("15-SEP-2016", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2016", "All Souls Day"); - - lh.addStaticHoliday ("30-DEC-2016", "Bank Holiday"); - - lh.addStaticHoliday ("12-APR-2017", "Holy Wednesday"); - - lh.addStaticHoliday ("13-APR-2017", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labor Day"); - - lh.addStaticHoliday ("30-JUN-2017", "Bank Holiday"); - - lh.addStaticHoliday ("15-SEP-2017", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2017", "All Souls Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2018", "Holy Wednesday"); - - lh.addStaticHoliday ("29-MAR-2018", "Holy Thursday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labor Day"); - - lh.addStaticHoliday ("06-AUG-2018", "Agostinas Holiday"); - - lh.addStaticHoliday ("02-NOV-2018", "All Souls Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("31-DEC-2018", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("17-APR-2019", "Holy Wednesday"); - - lh.addStaticHoliday ("18-APR-2019", "Holy Thursday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labor Day"); - - lh.addStaticHoliday ("05-AUG-2019", "Agostinas Holiday"); - - lh.addStaticHoliday ("06-AUG-2019", "Agostinas Holiday"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2019", "Bank Holiday"); - - lh.addStaticHoliday ("31-DEC-2019", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("08-APR-2020", "Holy Wednesday"); - - lh.addStaticHoliday ("09-APR-2020", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labor Day"); - - lh.addStaticHoliday ("30-JUN-2020", "Bank Holiday"); - - lh.addStaticHoliday ("05-AUG-2020", "Agostinas Holiday"); - - lh.addStaticHoliday ("06-AUG-2020", "Agostinas Holiday"); - - lh.addStaticHoliday ("15-SEP-2020", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2020", "All Souls Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2020", "Bank Holiday"); - - lh.addStaticHoliday ("31-DEC-2020", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("31-MAR-2021", "Holy Wednesday"); - - lh.addStaticHoliday ("01-APR-2021", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("30-JUN-2021", "Bank Holiday"); - - lh.addStaticHoliday ("05-AUG-2021", "Agostinas Holiday"); - - lh.addStaticHoliday ("06-AUG-2021", "Agostinas Holiday"); - - lh.addStaticHoliday ("15-SEP-2021", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2021", "All Souls Day"); - - lh.addStaticHoliday ("30-DEC-2021", "Bank Holiday"); - - lh.addStaticHoliday ("31-DEC-2021", "Bank Holiday"); - - lh.addStaticHoliday ("13-APR-2022", "Holy Wednesday"); - - lh.addStaticHoliday ("14-APR-2022", "Holy Thursday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("30-JUN-2022", "Bank Holiday"); - - lh.addStaticHoliday ("05-AUG-2022", "Agostinas Holiday"); - - lh.addStaticHoliday ("15-SEP-2022", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2022", "All Souls Day"); - - lh.addStaticHoliday ("30-DEC-2022", "Bank Holiday"); - - lh.addStaticHoliday ("05-APR-2023", "Holy Wednesday"); - - lh.addStaticHoliday ("06-APR-2023", "Holy Thursday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labor Day"); - - lh.addStaticHoliday ("30-JUN-2023", "Bank Holiday"); - - lh.addStaticHoliday ("15-SEP-2023", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2023", "All Souls Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("27-MAR-2024", "Holy Wednesday"); - - lh.addStaticHoliday ("28-MAR-2024", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labor Day"); - - lh.addStaticHoliday ("05-AUG-2024", "Agostinas Holiday"); - - lh.addStaticHoliday ("06-AUG-2024", "Agostinas Holiday"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2024", "Bank Holiday"); - - lh.addStaticHoliday ("31-DEC-2024", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("16-APR-2025", "Holy Wednesday"); - - lh.addStaticHoliday ("17-APR-2025", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labor Day"); - - lh.addStaticHoliday ("30-JUN-2025", "Bank Holiday"); - - lh.addStaticHoliday ("05-AUG-2025", "Agostinas Holiday"); - - lh.addStaticHoliday ("06-AUG-2025", "Agostinas Holiday"); - - lh.addStaticHoliday ("15-SEP-2025", "Independence Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2025", "Bank Holiday"); - - lh.addStaticHoliday ("31-DEC-2025", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2026", "Holy Wednesday"); - - lh.addStaticHoliday ("02-APR-2026", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labor Day"); - - lh.addStaticHoliday ("30-JUN-2026", "Bank Holiday"); - - lh.addStaticHoliday ("05-AUG-2026", "Agostinas Holiday"); - - lh.addStaticHoliday ("06-AUG-2026", "Agostinas Holiday"); - - lh.addStaticHoliday ("15-SEP-2026", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2026", "All Souls Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("30-DEC-2026", "Bank Holiday"); - - lh.addStaticHoliday ("31-DEC-2026", "Bank Holiday"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2027", "Holy Wednesday"); - - lh.addStaticHoliday ("25-MAR-2027", "Holy Thursday"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("30-JUN-2027", "Bank Holiday"); - - lh.addStaticHoliday ("05-AUG-2027", "Agostinas Holiday"); - - lh.addStaticHoliday ("06-AUG-2027", "Agostinas Holiday"); - - lh.addStaticHoliday ("15-SEP-2027", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2027", "All Souls Day"); - - lh.addStaticHoliday ("30-DEC-2027", "Bank Holiday"); - - lh.addStaticHoliday ("31-DEC-2027", "Bank Holiday"); - - lh.addStaticHoliday ("12-APR-2028", "Holy Wednesday"); - - lh.addStaticHoliday ("13-APR-2028", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labor Day"); - - lh.addStaticHoliday ("30-JUN-2028", "Bank Holiday"); - - lh.addStaticHoliday ("15-SEP-2028", "Independence Day"); - - lh.addStaticHoliday ("02-NOV-2028", "All Souls Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/TABHoliday.java b/org/drip/analytics/holset/TABHoliday.java deleted file mode 100644 index 954ab30..0000000 --- a/org/drip/analytics/holset/TABHoliday.java +++ /dev/null @@ -1,1265 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class TABHoliday implements org.drip.analytics.holset.LocationHoliday { - public TABHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "TAB"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("03-JAN-1994", "...from ChaseTools"); - - lh.addStaticHoliday ("02-JAN-1995", "...from ChaseTools"); - - lh.addStaticHoliday ("29-MAY-1995", "...from ChaseTools"); - - lh.addStaticHoliday ("04-JUL-1995", "...from ChaseTools"); - - lh.addStaticHoliday ("04-SEP-1995", "...from ChaseTools"); - - lh.addStaticHoliday ("09-OCT-1995", "...from ChaseTools"); - - lh.addStaticHoliday ("10-NOV-1995", "...from ChaseTools"); - - lh.addStaticHoliday ("23-NOV-1995", "...from ChaseTools"); - - lh.addStaticHoliday ("25-DEC-1995", "...from ChaseTools"); - - lh.addStaticHoliday ("01-JAN-1996", "...from ChaseTools"); - - lh.addStaticHoliday ("15-JAN-1996", "...from ChaseTools"); - - lh.addStaticHoliday ("19-FEB-1996", "...from ChaseTools"); - - lh.addStaticHoliday ("27-MAY-1996", "...from ChaseTools"); - - lh.addStaticHoliday ("04-JUL-1996", "...from ChaseTools"); - - lh.addStaticHoliday ("02-SEP-1996", "...from ChaseTools"); - - lh.addStaticHoliday ("14-OCT-1996", "...from ChaseTools"); - - lh.addStaticHoliday ("11-NOV-1996", "...from ChaseTools"); - - lh.addStaticHoliday ("28-NOV-1996", "...from ChaseTools"); - - lh.addStaticHoliday ("25-DEC-1996", "...from ChaseTools"); - - lh.addStaticHoliday ("01-JAN-1997", "...from ChaseTools"); - - lh.addStaticHoliday ("20-JAN-1997", "...from ChaseTools"); - - lh.addStaticHoliday ("17-FEB-1997", "...from ChaseTools"); - - lh.addStaticHoliday ("26-MAY-1997", "...from ChaseTools"); - - lh.addStaticHoliday ("04-JUL-1997", "...from ChaseTools"); - - lh.addStaticHoliday ("01-SEP-1997", "...from ChaseTools"); - - lh.addStaticHoliday ("13-OCT-1997", "...from ChaseTools"); - - lh.addStaticHoliday ("11-NOV-1997", "...from ChaseTools"); - - lh.addStaticHoliday ("27-NOV-1997", "...from ChaseTools"); - - lh.addStaticHoliday ("25-DEC-1997", "...from ChaseTools"); - - lh.addStaticHoliday ("01-JAN-1998", "...from ChaseTools"); - - lh.addStaticHoliday ("19-JAN-1998", "...from ChaseTools"); - - lh.addStaticHoliday ("16-FEB-1998", "...from ChaseTools"); - - lh.addStaticHoliday ("25-MAY-1998", "...from ChaseTools"); - - lh.addStaticHoliday ("07-SEP-1998", "...from ChaseTools"); - - lh.addStaticHoliday ("12-OCT-1998", "...from ChaseTools"); - - lh.addStaticHoliday ("11-NOV-1998", "...from ChaseTools"); - - lh.addStaticHoliday ("26-NOV-1998", "...from ChaseTools"); - - lh.addStaticHoliday ("25-DEC-1998", "...from ChaseTools"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("18-JAN-1999", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("15-FEB-1999", "Washingtons Birthday"); - - lh.addStaticHoliday ("31-MAY-1999", "Memorial Day"); - - lh.addStaticHoliday ("05-JUL-1999", "Independence Day Observed"); - - lh.addStaticHoliday ("06-SEP-1999", "Labor Day"); - - lh.addStaticHoliday ("11-OCT-1999", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-1999", "Veterans Day"); - - lh.addStaticHoliday ("25-NOV-1999", "Thanksgiving Day"); - - lh.addStaticHoliday ("17-JAN-2000", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("21-FEB-2000", "Washingtons Birthday"); - - lh.addStaticHoliday ("29-MAY-2000", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2000", "Independence Day"); - - lh.addStaticHoliday ("04-SEP-2000", "Labor Day"); - - lh.addStaticHoliday ("09-OCT-2000", "Columbus Day"); - - lh.addStaticHoliday ("23-NOV-2000", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("15-JAN-2001", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("19-FEB-2001", "Washingtons Birthday"); - - lh.addStaticHoliday ("28-MAY-2001", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2001", "Independence Day"); - - lh.addStaticHoliday ("03-SEP-2001", "Labor Day"); - - lh.addStaticHoliday ("08-OCT-2001", "Columbus Day"); - - lh.addStaticHoliday ("12-NOV-2001", "Veterans Day Observed"); - - lh.addStaticHoliday ("22-NOV-2001", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2002", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("18-FEB-2002", "Washingtons Birthday"); - - lh.addStaticHoliday ("27-MAY-2002", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2002", "Independence Day"); - - lh.addStaticHoliday ("02-SEP-2002", "Labor Day"); - - lh.addStaticHoliday ("14-OCT-2002", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2002", "Veterans Day"); - - lh.addStaticHoliday ("28-NOV-2002", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2003", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("17-FEB-2003", "Washingtons Birthday"); - - lh.addStaticHoliday ("26-MAY-2003", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2003", "Independence Day"); - - lh.addStaticHoliday ("01-SEP-2003", "Labor Day"); - - lh.addStaticHoliday ("13-OCT-2003", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2003", "Veterans Day"); - - lh.addStaticHoliday ("27-NOV-2003", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2004", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("16-FEB-2004", "Washingtons Birthday"); - - lh.addStaticHoliday ("31-MAY-2004", "Memorial Day"); - - lh.addStaticHoliday ("05-JUL-2004", "Independence Day Observed"); - - lh.addStaticHoliday ("06-SEP-2004", "Labor Day"); - - lh.addStaticHoliday ("11-OCT-2004", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2004", "Veterans Day"); - - lh.addStaticHoliday ("25-NOV-2004", "Thanksgiving Day"); - - lh.addStaticHoliday ("17-JAN-2005", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("21-FEB-2005", "Washingtons Birthday"); - - lh.addStaticHoliday ("30-MAY-2005", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2005", "Independence Day"); - - lh.addStaticHoliday ("05-SEP-2005", "Labor Day"); - - lh.addStaticHoliday ("10-OCT-2005", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2005", "Veterans Day"); - - lh.addStaticHoliday ("24-NOV-2005", "Thanksgiving Day"); - - lh.addStaticHoliday ("26-DEC-2005", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("16-JAN-2006", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("20-FEB-2006", "Washingtons Birthday"); - - lh.addStaticHoliday ("29-MAY-2006", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2006", "Independence Day"); - - lh.addStaticHoliday ("04-SEP-2006", "Labor Day"); - - lh.addStaticHoliday ("09-OCT-2006", "Columbus Day"); - - lh.addStaticHoliday ("23-NOV-2006", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("15-JAN-2007", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("19-FEB-2007", "Washingtons Birthday"); - - lh.addStaticHoliday ("28-MAY-2007", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2007", "Independence Day"); - - lh.addStaticHoliday ("03-SEP-2007", "Labor Day"); - - lh.addStaticHoliday ("08-OCT-2007", "Columbus Day"); - - lh.addStaticHoliday ("12-NOV-2007", "Veterans Day Observed"); - - lh.addStaticHoliday ("22-NOV-2007", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2008", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("18-FEB-2008", "Washingtons Birthday"); - - lh.addStaticHoliday ("26-MAY-2008", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2008", "Independence Day"); - - lh.addStaticHoliday ("01-SEP-2008", "Labor Day"); - - lh.addStaticHoliday ("13-OCT-2008", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2008", "Veterans Day"); - - lh.addStaticHoliday ("27-NOV-2008", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2009", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("16-FEB-2009", "Washingtons Birthday"); - - lh.addStaticHoliday ("25-MAY-2009", "Memorial Day"); - - lh.addStaticHoliday ("07-SEP-2009", "Labor Day"); - - lh.addStaticHoliday ("12-OCT-2009", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2009", "Veterans Day"); - - lh.addStaticHoliday ("26-NOV-2009", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("18-JAN-2010", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("15-FEB-2010", "Washingtons Birthday"); - - lh.addStaticHoliday ("31-MAY-2010", "Memorial Day"); - - lh.addStaticHoliday ("05-JUL-2010", "Independence Day Observed"); - - lh.addStaticHoliday ("06-SEP-2010", "Labor Day"); - - lh.addStaticHoliday ("11-OCT-2010", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2010", "Veterans Day"); - - lh.addStaticHoliday ("25-NOV-2010", "Thanksgiving Day"); - - lh.addStaticHoliday ("17-JAN-2011", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("21-FEB-2011", "Washingtons Birthday"); - - lh.addStaticHoliday ("30-MAY-2011", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2011", "Independence Day"); - - lh.addStaticHoliday ("05-SEP-2011", "Labor Day"); - - lh.addStaticHoliday ("10-OCT-2011", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2011", "Veterans Day"); - - lh.addStaticHoliday ("24-NOV-2011", "Thanksgiving Day"); - - lh.addStaticHoliday ("26-DEC-2011", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("16-JAN-2012", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("20-FEB-2012", "Washingtons Birthday"); - - lh.addStaticHoliday ("28-MAY-2012", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2012", "Independence Day"); - - lh.addStaticHoliday ("03-SEP-2012", "Labor Day"); - - lh.addStaticHoliday ("08-OCT-2012", "Columbus Day"); - - lh.addStaticHoliday ("12-NOV-2012", "Veterans Day Observed"); - - lh.addStaticHoliday ("22-NOV-2012", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2013", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("18-FEB-2013", "Washingtons Birthday"); - - lh.addStaticHoliday ("27-MAY-2013", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2013", "Independence Day"); - - lh.addStaticHoliday ("02-SEP-2013", "Labor Day"); - - lh.addStaticHoliday ("14-OCT-2013", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2013", "Veterans Day"); - - lh.addStaticHoliday ("28-NOV-2013", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2014", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("17-FEB-2014", "Washingtons Birthday"); - - lh.addStaticHoliday ("26-MAY-2014", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2014", "Independence Day"); - - lh.addStaticHoliday ("01-SEP-2014", "Labor Day"); - - lh.addStaticHoliday ("13-OCT-2014", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2014", "Veterans Day"); - - lh.addStaticHoliday ("27-NOV-2014", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2015", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("16-FEB-2015", "Washingtons Birthday"); - - lh.addStaticHoliday ("25-MAY-2015", "Memorial Day"); - - lh.addStaticHoliday ("07-SEP-2015", "Labor Day"); - - lh.addStaticHoliday ("12-OCT-2015", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2015", "Veterans Day"); - - lh.addStaticHoliday ("26-NOV-2015", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("18-JAN-2016", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("15-FEB-2016", "Washingtons Birthday"); - - lh.addStaticHoliday ("30-MAY-2016", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2016", "Independence Day"); - - lh.addStaticHoliday ("05-SEP-2016", "Labor Day"); - - lh.addStaticHoliday ("10-OCT-2016", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2016", "Veterans Day"); - - lh.addStaticHoliday ("24-NOV-2016", "Thanksgiving Day"); - - lh.addStaticHoliday ("26-DEC-2016", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("16-JAN-2017", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("20-FEB-2017", "Washingtons Birthday"); - - lh.addStaticHoliday ("29-MAY-2017", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2017", "Independence Day"); - - lh.addStaticHoliday ("04-SEP-2017", "Labor Day"); - - lh.addStaticHoliday ("09-OCT-2017", "Columbus Day"); - - lh.addStaticHoliday ("23-NOV-2017", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("15-JAN-2018", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("19-FEB-2018", "Washingtons Birthday"); - - lh.addStaticHoliday ("28-MAY-2018", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2018", "Independence Day"); - - lh.addStaticHoliday ("03-SEP-2018", "Labor Day"); - - lh.addStaticHoliday ("08-OCT-2018", "Columbus Day"); - - lh.addStaticHoliday ("12-NOV-2018", "Veterans Day Observed"); - - lh.addStaticHoliday ("22-NOV-2018", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2019", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("18-FEB-2019", "Washingtons Birthday"); - - lh.addStaticHoliday ("27-MAY-2019", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2019", "Independence Day"); - - lh.addStaticHoliday ("02-SEP-2019", "Labor Day"); - - lh.addStaticHoliday ("14-OCT-2019", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2019", "Veterans Day"); - - lh.addStaticHoliday ("28-NOV-2019", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2020", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("17-FEB-2020", "Washingtons Birthday"); - - lh.addStaticHoliday ("25-MAY-2020", "Memorial Day"); - - lh.addStaticHoliday ("07-SEP-2020", "Labor Day"); - - lh.addStaticHoliday ("12-OCT-2020", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2020", "Veterans Day"); - - lh.addStaticHoliday ("26-NOV-2020", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("18-JAN-2021", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("15-FEB-2021", "Washingtons Birthday"); - - lh.addStaticHoliday ("31-MAY-2021", "Memorial Day"); - - lh.addStaticHoliday ("05-JUL-2021", "Independence Day Observed"); - - lh.addStaticHoliday ("06-SEP-2021", "Labor Day"); - - lh.addStaticHoliday ("11-OCT-2021", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2021", "Veterans Day"); - - lh.addStaticHoliday ("25-NOV-2021", "Thanksgiving Day"); - - lh.addStaticHoliday ("17-JAN-2022", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("21-FEB-2022", "Washingtons Birthday"); - - lh.addStaticHoliday ("30-MAY-2022", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2022", "Independence Day"); - - lh.addStaticHoliday ("05-SEP-2022", "Labor Day"); - - lh.addStaticHoliday ("10-OCT-2022", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2022", "Veterans Day"); - - lh.addStaticHoliday ("24-NOV-2022", "Thanksgiving Day"); - - lh.addStaticHoliday ("26-DEC-2022", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("16-JAN-2023", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("20-FEB-2023", "Washingtons Birthday"); - - lh.addStaticHoliday ("29-MAY-2023", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2023", "Independence Day"); - - lh.addStaticHoliday ("04-SEP-2023", "Labor Day"); - - lh.addStaticHoliday ("09-OCT-2023", "Columbus Day"); - - lh.addStaticHoliday ("23-NOV-2023", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("15-JAN-2024", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("19-FEB-2024", "Washingtons Birthday"); - - lh.addStaticHoliday ("27-MAY-2024", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2024", "Independence Day"); - - lh.addStaticHoliday ("02-SEP-2024", "Labor Day"); - - lh.addStaticHoliday ("14-OCT-2024", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2024", "Veterans Day"); - - lh.addStaticHoliday ("28-NOV-2024", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2025", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("17-FEB-2025", "Washingtons Birthday"); - - lh.addStaticHoliday ("26-MAY-2025", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2025", "Independence Day"); - - lh.addStaticHoliday ("01-SEP-2025", "Labor Day"); - - lh.addStaticHoliday ("13-OCT-2025", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2025", "Veterans Day"); - - lh.addStaticHoliday ("27-NOV-2025", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2026", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("16-FEB-2026", "Washingtons Birthday"); - - lh.addStaticHoliday ("25-MAY-2026", "Memorial Day"); - - lh.addStaticHoliday ("07-SEP-2026", "Labor Day"); - - lh.addStaticHoliday ("12-OCT-2026", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2026", "Veterans Day"); - - lh.addStaticHoliday ("26-NOV-2026", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("18-JAN-2027", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("15-FEB-2027", "Washingtons Birthday"); - - lh.addStaticHoliday ("31-MAY-2027", "Memorial Day"); - - lh.addStaticHoliday ("05-JUL-2027", "Independence Day Observed"); - - lh.addStaticHoliday ("06-SEP-2027", "Labor Day"); - - lh.addStaticHoliday ("11-OCT-2027", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2027", "Veterans Day"); - - lh.addStaticHoliday ("25-NOV-2027", "Thanksgiving Day"); - - lh.addStaticHoliday ("17-JAN-2028", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("21-FEB-2028", "Washingtons Birthday"); - - lh.addStaticHoliday ("29-MAY-2028", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2028", "Independence Day"); - - lh.addStaticHoliday ("04-SEP-2028", "Labor Day"); - - lh.addStaticHoliday ("09-OCT-2028", "Columbus Day"); - - lh.addStaticHoliday ("23-NOV-2028", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2029", "New Years Day"); - - lh.addStaticHoliday ("15-JAN-2029", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("19-FEB-2029", "Washingtons Birthday"); - - lh.addStaticHoliday ("28-MAY-2029", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2029", "Independence Day"); - - lh.addStaticHoliday ("03-SEP-2029", "Labor Day"); - - lh.addStaticHoliday ("08-OCT-2029", "Columbus Day"); - - lh.addStaticHoliday ("12-NOV-2029", "Veterans Day Observed"); - - lh.addStaticHoliday ("22-NOV-2029", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2029", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2030", "...from ChaseTools"); - - lh.addStaticHoliday ("21-JAN-2030", "...from ChaseTools"); - - lh.addStaticHoliday ("18-FEB-2030", "...from ChaseTools"); - - lh.addStaticHoliday ("27-MAY-2030", "...from ChaseTools"); - - lh.addStaticHoliday ("04-JUL-2030", "...from ChaseTools"); - - lh.addStaticHoliday ("02-SEP-2030", "...from ChaseTools"); - - lh.addStaticHoliday ("14-OCT-2030", "...from ChaseTools"); - - lh.addStaticHoliday ("11-NOV-2030", "...from ChaseTools"); - - lh.addStaticHoliday ("28-NOV-2030", "...from ChaseTools"); - - lh.addStaticHoliday ("25-DEC-2030", "...from ChaseTools"); - - lh.addStaticHoliday ("01-JAN-2031", "...from ChaseTools"); - - lh.addStaticHoliday ("20-JAN-2031", "...from ChaseTools"); - - lh.addStaticHoliday ("17-FEB-2031", "...from ChaseTools"); - - lh.addStaticHoliday ("26-MAY-2031", "...from ChaseTools"); - - lh.addStaticHoliday ("04-JUL-2031", "...from ChaseTools"); - - lh.addStaticHoliday ("01-SEP-2031", "...from ChaseTools"); - - lh.addStaticHoliday ("13-OCT-2031", "...from ChaseTools"); - - lh.addStaticHoliday ("11-NOV-2031", "...from ChaseTools"); - - lh.addStaticHoliday ("27-NOV-2031", "...from ChaseTools"); - - lh.addStaticHoliday ("25-DEC-2031", "...from ChaseTools"); - - lh.addStaticHoliday ("01-JAN-2032", "...from ChaseTools"); - - lh.addStaticHoliday ("19-JAN-2032", "...from ChaseTools"); - - lh.addStaticHoliday ("16-FEB-2032", "...from ChaseTools"); - - lh.addStaticHoliday ("31-MAY-2032", "...from ChaseTools"); - - lh.addStaticHoliday ("05-JUL-2032", "...from ChaseTools"); - - lh.addStaticHoliday ("06-SEP-2032", "...from ChaseTools"); - - lh.addStaticHoliday ("11-OCT-2032", "...from ChaseTools"); - - lh.addStaticHoliday ("11-NOV-2032", "...from ChaseTools"); - - lh.addStaticHoliday ("25-NOV-2032", "...from ChaseTools"); - - lh.addStaticHoliday ("17-JAN-2033", "...from ChaseTools"); - - lh.addStaticHoliday ("21-FEB-2033", "...from ChaseTools"); - - lh.addStaticHoliday ("30-MAY-2033", "...from ChaseTools"); - - lh.addStaticHoliday ("04-JUL-2033", "...from ChaseTools"); - - lh.addStaticHoliday ("05-SEP-2033", "...from ChaseTools"); - - lh.addStaticHoliday ("10-OCT-2033", "...from ChaseTools"); - - lh.addStaticHoliday ("11-NOV-2033", "...from ChaseTools"); - - lh.addStaticHoliday ("24-NOV-2033", "...from ChaseTools"); - - lh.addStaticHoliday ("26-DEC-2033", "...from ChaseTools"); - - lh.addStaticHoliday ("02-JAN-2034", "...from ChaseTools"); - - lh.addStaticHoliday ("16-JAN-2034", "...from ChaseTools"); - - lh.addStaticHoliday ("20-FEB-2034", "...from ChaseTools"); - - lh.addStaticHoliday ("29-MAY-2034", "...from ChaseTools"); - - lh.addStaticHoliday ("04-JUL-2034", "...from ChaseTools"); - - lh.addStaticHoliday ("04-SEP-2034", "...from ChaseTools"); - - lh.addStaticHoliday ("09-OCT-2034", "...from ChaseTools"); - - lh.addStaticHoliday ("23-NOV-2034", "...from ChaseTools"); - - lh.addStaticHoliday ("25-DEC-2034", "...from ChaseTools"); - - lh.addStaticHoliday ("01-JAN-2035", "...from ChaseTools"); - - lh.addStaticHoliday ("15-JAN-2035", "...from ChaseTools"); - - lh.addStaticHoliday ("19-FEB-2035", "...from ChaseTools"); - - lh.addStaticHoliday ("28-MAY-2035", "...from ChaseTools"); - - lh.addStaticHoliday ("04-JUL-2035", "...from ChaseTools"); - - lh.addStaticHoliday ("03-SEP-2035", "...from ChaseTools"); - - lh.addStaticHoliday ("08-OCT-2035", "...from ChaseTools"); - - lh.addStaticHoliday ("12-NOV-2035", "...from ChaseTools"); - - lh.addStaticHoliday ("22-NOV-2035", "...from ChaseTools"); - - lh.addStaticHoliday ("25-DEC-2035", "...from ChaseTools"); - - lh.addStaticHoliday ("01-JAN-2036", "...from ChaseTools"); - - lh.addStaticHoliday ("21-JAN-2036", "...from ChaseTools"); - - lh.addStaticHoliday ("18-FEB-2036", "...from ChaseTools"); - - lh.addStaticHoliday ("26-MAY-2036", "...from ChaseTools"); - - lh.addStaticHoliday ("04-JUL-2036", "...from ChaseTools"); - - lh.addStaticHoliday ("01-SEP-2036", "...from ChaseTools"); - - lh.addStaticHoliday ("13-OCT-2036", "...from ChaseTools"); - - lh.addStaticHoliday ("11-NOV-2036", "...from ChaseTools"); - - lh.addStaticHoliday ("27-NOV-2036", "...from ChaseTools"); - - lh.addStaticHoliday ("25-DEC-2036", "...from ChaseTools"); - - lh.addStaticHoliday ("01-JAN-2037", "...from ChaseTools"); - - lh.addStaticHoliday ("19-JAN-2037", "...from ChaseTools"); - - lh.addStaticHoliday ("16-FEB-2037", "...from ChaseTools"); - - lh.addStaticHoliday ("25-MAY-2037", "...from ChaseTools"); - - lh.addStaticHoliday ("07-SEP-2037", "...from ChaseTools"); - - lh.addStaticHoliday ("12-OCT-2037", "...from ChaseTools"); - - lh.addStaticHoliday ("11-NOV-2037", "...from ChaseTools"); - - lh.addStaticHoliday ("26-NOV-2037", "...from ChaseTools"); - - lh.addStaticHoliday ("25-DEC-2037", "...from ChaseTools"); - - lh.addStaticHoliday ("01-JAN-2038", "...from ChaseTools"); - - lh.addStaticHoliday ("18-JAN-2038", "...from ChaseTools"); - - lh.addStaticHoliday ("15-FEB-2038", "...from ChaseTools"); - - lh.addStaticHoliday ("31-MAY-2038", "...from ChaseTools"); - - lh.addStaticHoliday ("05-JUL-2038", "...from ChaseTools"); - - lh.addStaticHoliday ("06-SEP-2038", "...from ChaseTools"); - - lh.addStaticHoliday ("11-OCT-2038", "...from ChaseTools"); - - lh.addStaticHoliday ("11-NOV-2038", "...from ChaseTools"); - - lh.addStaticHoliday ("25-NOV-2038", "...from ChaseTools"); - - lh.addStaticHoliday ("17-JAN-2039", "...from ChaseTools"); - - lh.addStaticHoliday ("21-FEB-2039", "...from ChaseTools"); - - lh.addStaticHoliday ("30-MAY-2039", "...from ChaseTools"); - - lh.addStaticHoliday ("04-JUL-2039", "...from ChaseTools"); - - lh.addStaticHoliday ("05-SEP-2039", "...from ChaseTools"); - - lh.addStaticHoliday ("10-OCT-2039", "...from ChaseTools"); - - lh.addStaticHoliday ("11-NOV-2039", "...from ChaseTools"); - - lh.addStaticHoliday ("24-NOV-2039", "...from ChaseTools"); - - lh.addStaticHoliday ("26-DEC-2039", "...from ChaseTools"); - - lh.addStaticHoliday ("02-JAN-2040", ""); - - lh.addStaticHoliday ("16-JAN-2040", ""); - - lh.addStaticHoliday ("20-FEB-2040", ""); - - lh.addStaticHoliday ("28-MAY-2040", ""); - - lh.addStaticHoliday ("04-JUL-2040", ""); - - lh.addStaticHoliday ("03-SEP-2040", ""); - - lh.addStaticHoliday ("08-OCT-2040", ""); - - lh.addStaticHoliday ("12-NOV-2040", ""); - - lh.addStaticHoliday ("22-NOV-2040", ""); - - lh.addStaticHoliday ("25-DEC-2040", ""); - - lh.addStaticHoliday ("01-JAN-2041", ""); - - lh.addStaticHoliday ("21-JAN-2041", ""); - - lh.addStaticHoliday ("18-FEB-2041", ""); - - lh.addStaticHoliday ("27-MAY-2041", ""); - - lh.addStaticHoliday ("04-JUL-2041", ""); - - lh.addStaticHoliday ("02-SEP-2041", ""); - - lh.addStaticHoliday ("14-OCT-2041", ""); - - lh.addStaticHoliday ("11-NOV-2041", ""); - - lh.addStaticHoliday ("28-NOV-2041", ""); - - lh.addStaticHoliday ("25-DEC-2041", ""); - - lh.addStaticHoliday ("01-JAN-2042", ""); - - lh.addStaticHoliday ("20-JAN-2042", ""); - - lh.addStaticHoliday ("17-FEB-2042", ""); - - lh.addStaticHoliday ("26-MAY-2042", ""); - - lh.addStaticHoliday ("04-JUL-2042", ""); - - lh.addStaticHoliday ("01-SEP-2042", ""); - - lh.addStaticHoliday ("13-OCT-2042", ""); - - lh.addStaticHoliday ("11-NOV-2042", ""); - - lh.addStaticHoliday ("27-NOV-2042", ""); - - lh.addStaticHoliday ("25-DEC-2042", ""); - - lh.addStaticHoliday ("01-JAN-2043", ""); - - lh.addStaticHoliday ("19-JAN-2043", ""); - - lh.addStaticHoliday ("16-FEB-2043", ""); - - lh.addStaticHoliday ("25-MAY-2043", ""); - - lh.addStaticHoliday ("07-SEP-2043", ""); - - lh.addStaticHoliday ("12-OCT-2043", ""); - - lh.addStaticHoliday ("11-NOV-2043", ""); - - lh.addStaticHoliday ("26-NOV-2043", ""); - - lh.addStaticHoliday ("25-DEC-2043", ""); - - lh.addStaticHoliday ("01-JAN-2044", ""); - - lh.addStaticHoliday ("18-JAN-2044", ""); - - lh.addStaticHoliday ("15-FEB-2044", ""); - - lh.addStaticHoliday ("30-MAY-2044", ""); - - lh.addStaticHoliday ("04-JUL-2044", ""); - - lh.addStaticHoliday ("05-SEP-2044", ""); - - lh.addStaticHoliday ("10-OCT-2044", ""); - - lh.addStaticHoliday ("11-NOV-2044", ""); - - lh.addStaticHoliday ("24-NOV-2044", ""); - - lh.addStaticHoliday ("26-DEC-2044", ""); - - lh.addStaticHoliday ("02-JAN-2045", ""); - - lh.addStaticHoliday ("16-JAN-2045", ""); - - lh.addStaticHoliday ("20-FEB-2045", ""); - - lh.addStaticHoliday ("29-MAY-2045", ""); - - lh.addStaticHoliday ("04-JUL-2045", ""); - - lh.addStaticHoliday ("04-SEP-2045", ""); - - lh.addStaticHoliday ("09-OCT-2045", ""); - - lh.addStaticHoliday ("23-NOV-2045", ""); - - lh.addStaticHoliday ("25-DEC-2045", ""); - - lh.addStaticHoliday ("01-JAN-2046", ""); - - lh.addStaticHoliday ("15-JAN-2046", ""); - - lh.addStaticHoliday ("19-FEB-2046", ""); - - lh.addStaticHoliday ("28-MAY-2046", ""); - - lh.addStaticHoliday ("04-JUL-2046", ""); - - lh.addStaticHoliday ("03-SEP-2046", ""); - - lh.addStaticHoliday ("08-OCT-2046", ""); - - lh.addStaticHoliday ("12-NOV-2046", ""); - - lh.addStaticHoliday ("22-NOV-2046", ""); - - lh.addStaticHoliday ("25-DEC-2046", ""); - - lh.addStaticHoliday ("01-JAN-2047", ""); - - lh.addStaticHoliday ("21-JAN-2047", ""); - - lh.addStaticHoliday ("18-FEB-2047", ""); - - lh.addStaticHoliday ("27-MAY-2047", ""); - - lh.addStaticHoliday ("04-JUL-2047", ""); - - lh.addStaticHoliday ("02-SEP-2047", ""); - - lh.addStaticHoliday ("14-OCT-2047", ""); - - lh.addStaticHoliday ("11-NOV-2047", ""); - - lh.addStaticHoliday ("28-NOV-2047", ""); - - lh.addStaticHoliday ("25-DEC-2047", ""); - - lh.addStaticHoliday ("01-JAN-2048", ""); - - lh.addStaticHoliday ("20-JAN-2048", ""); - - lh.addStaticHoliday ("17-FEB-2048", ""); - - lh.addStaticHoliday ("25-MAY-2048", ""); - - lh.addStaticHoliday ("07-SEP-2048", ""); - - lh.addStaticHoliday ("12-OCT-2048", ""); - - lh.addStaticHoliday ("11-NOV-2048", ""); - - lh.addStaticHoliday ("26-NOV-2048", ""); - - lh.addStaticHoliday ("25-DEC-2048", ""); - - lh.addStaticHoliday ("01-JAN-2049", ""); - - lh.addStaticHoliday ("18-JAN-2049", ""); - - lh.addStaticHoliday ("15-FEB-2049", ""); - - lh.addStaticHoliday ("31-MAY-2049", ""); - - lh.addStaticHoliday ("05-JUL-2049", ""); - - lh.addStaticHoliday ("06-SEP-2049", ""); - - lh.addStaticHoliday ("11-OCT-2049", ""); - - lh.addStaticHoliday ("11-NOV-2049", ""); - - lh.addStaticHoliday ("25-NOV-2049", ""); - - lh.addStaticHoliday ("17-JAN-2050", ""); - - lh.addStaticHoliday ("21-FEB-2050", ""); - - lh.addStaticHoliday ("30-MAY-2050", ""); - - lh.addStaticHoliday ("04-JUL-2050", ""); - - lh.addStaticHoliday ("05-SEP-2050", ""); - - lh.addStaticHoliday ("10-OCT-2050", ""); - - lh.addStaticHoliday ("11-NOV-2050", ""); - - lh.addStaticHoliday ("24-NOV-2050", ""); - - lh.addStaticHoliday ("26-DEC-2050", ""); - - lh.addStaticHoliday ("02-JAN-2051", ""); - - lh.addStaticHoliday ("16-JAN-2051", ""); - - lh.addStaticHoliday ("20-FEB-2051", ""); - - lh.addStaticHoliday ("29-MAY-2051", ""); - - lh.addStaticHoliday ("04-JUL-2051", ""); - - lh.addStaticHoliday ("04-SEP-2051", ""); - - lh.addStaticHoliday ("09-OCT-2051", ""); - - lh.addStaticHoliday ("23-NOV-2051", ""); - - lh.addStaticHoliday ("25-DEC-2051", ""); - - lh.addStaticHoliday ("01-JAN-2052", ""); - - lh.addStaticHoliday ("15-JAN-2052", ""); - - lh.addStaticHoliday ("19-FEB-2052", ""); - - lh.addStaticHoliday ("27-MAY-2052", ""); - - lh.addStaticHoliday ("04-JUL-2052", ""); - - lh.addStaticHoliday ("02-SEP-2052", ""); - - lh.addStaticHoliday ("14-OCT-2052", ""); - - lh.addStaticHoliday ("11-NOV-2052", ""); - - lh.addStaticHoliday ("28-NOV-2052", ""); - - lh.addStaticHoliday ("25-DEC-2052", ""); - - lh.addStaticHoliday ("01-JAN-2053", ""); - - lh.addStaticHoliday ("20-JAN-2053", ""); - - lh.addStaticHoliday ("17-FEB-2053", ""); - - lh.addStaticHoliday ("26-MAY-2053", ""); - - lh.addStaticHoliday ("04-JUL-2053", ""); - - lh.addStaticHoliday ("01-SEP-2053", ""); - - lh.addStaticHoliday ("13-OCT-2053", ""); - - lh.addStaticHoliday ("11-NOV-2053", ""); - - lh.addStaticHoliday ("27-NOV-2053", ""); - - lh.addStaticHoliday ("25-DEC-2053", ""); - - lh.addStaticHoliday ("01-JAN-2054", ""); - - lh.addStaticHoliday ("19-JAN-2054", ""); - - lh.addStaticHoliday ("16-FEB-2054", ""); - - lh.addStaticHoliday ("25-MAY-2054", ""); - - lh.addStaticHoliday ("07-SEP-2054", ""); - - lh.addStaticHoliday ("12-OCT-2054", ""); - - lh.addStaticHoliday ("11-NOV-2054", ""); - - lh.addStaticHoliday ("26-NOV-2054", ""); - - lh.addStaticHoliday ("25-DEC-2054", ""); - - lh.addStaticHoliday ("01-JAN-2055", ""); - - lh.addStaticHoliday ("18-JAN-2055", ""); - - lh.addStaticHoliday ("15-FEB-2055", ""); - - lh.addStaticHoliday ("31-MAY-2055", ""); - - lh.addStaticHoliday ("05-JUL-2055", ""); - - lh.addStaticHoliday ("06-SEP-2055", ""); - - lh.addStaticHoliday ("11-OCT-2055", ""); - - lh.addStaticHoliday ("11-NOV-2055", ""); - - lh.addStaticHoliday ("25-NOV-2055", ""); - - lh.addStaticHoliday ("17-JAN-2056", ""); - - lh.addStaticHoliday ("21-FEB-2056", ""); - - lh.addStaticHoliday ("29-MAY-2056", ""); - - lh.addStaticHoliday ("04-JUL-2056", ""); - - lh.addStaticHoliday ("04-SEP-2056", ""); - - lh.addStaticHoliday ("09-OCT-2056", ""); - - lh.addStaticHoliday ("23-NOV-2056", ""); - - lh.addStaticHoliday ("25-DEC-2056", ""); - - lh.addStaticHoliday ("01-JAN-2057", ""); - - lh.addStaticHoliday ("15-JAN-2057", ""); - - lh.addStaticHoliday ("19-FEB-2057", ""); - - lh.addStaticHoliday ("28-MAY-2057", ""); - - lh.addStaticHoliday ("04-JUL-2057", ""); - - lh.addStaticHoliday ("03-SEP-2057", ""); - - lh.addStaticHoliday ("08-OCT-2057", ""); - - lh.addStaticHoliday ("12-NOV-2057", ""); - - lh.addStaticHoliday ("22-NOV-2057", ""); - - lh.addStaticHoliday ("25-DEC-2057", ""); - - lh.addStaticHoliday ("01-JAN-2058", ""); - - lh.addStaticHoliday ("21-JAN-2058", ""); - - lh.addStaticHoliday ("18-FEB-2058", ""); - - lh.addStaticHoliday ("27-MAY-2058", ""); - - lh.addStaticHoliday ("04-JUL-2058", ""); - - lh.addStaticHoliday ("02-SEP-2058", ""); - - lh.addStaticHoliday ("14-OCT-2058", ""); - - lh.addStaticHoliday ("11-NOV-2058", ""); - - lh.addStaticHoliday ("28-NOV-2058", ""); - - lh.addStaticHoliday ("25-DEC-2058", ""); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/TGTHoliday.java b/org/drip/analytics/holset/TGTHoliday.java deleted file mode 100644 index 4a9f54e..0000000 --- a/org/drip/analytics/holset/TGTHoliday.java +++ /dev/null @@ -1,147 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class TGTHoliday implements org.drip.analytics.holset.LocationHoliday { - public TGTHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "TGT"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/THBHoliday.java b/org/drip/analytics/holset/THBHoliday.java deleted file mode 100644 index 42db48c..0000000 --- a/org/drip/analytics/holset/THBHoliday.java +++ /dev/null @@ -1,2003 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class THBHoliday implements org.drip.analytics.holset.LocationHoliday { - public THBHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "THB"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("01-MAR-1999", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-1999", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-1999", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-1999", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-1999", "Songkran Festival Day"); - - lh.addStaticHoliday ("03-MAY-1999", "Labour Day Observed"); - - lh.addStaticHoliday ("05-MAY-1999", "Coronation Day"); - - lh.addStaticHoliday ("31-MAY-1999", "Visakha Bucha Day Observed"); - - lh.addStaticHoliday ("01-JUL-1999", "Mid-Year Holiday"); - - lh.addStaticHoliday ("28-JUL-1999", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-1999", "Queens Birthday"); - - lh.addStaticHoliday ("25-OCT-1999", "King Chulalongkorn Memorial Day Observed"); - - lh.addStaticHoliday ("06-DEC-1999", "Kings Birthday Observed"); - - lh.addStaticHoliday ("10-DEC-1999", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-1999", "New Years Eve"); - - lh.addStaticHoliday ("03-JAN-2000", "New Years Day Observed"); - - lh.addStaticHoliday ("21-FEB-2000", "Makha Bucha Day Observed"); - - lh.addStaticHoliday ("06-APR-2000", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2000", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2000", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2000", "Coronation Day"); - - lh.addStaticHoliday ("17-MAY-2000", "Visakha Bucha Day"); - - lh.addStaticHoliday ("17-JUL-2000", "Buddhist Lent"); - - lh.addStaticHoliday ("14-AUG-2000", "Queens Birthday Observed"); - - lh.addStaticHoliday ("23-OCT-2000", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2000", "Kings Birthday"); - - lh.addStaticHoliday ("11-DEC-2000", "Constitution Day Observed"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2001", "New Years Holiday"); - - lh.addStaticHoliday ("08-FEB-2001", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2001", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2001", "Songkran Festival Day"); - - lh.addStaticHoliday ("16-APR-2001", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("07-MAY-2001", "Visakha Bucha Day"); - - lh.addStaticHoliday ("08-MAY-2001", "Coronation Day Observed"); - - lh.addStaticHoliday ("06-JUL-2001", "Buddhist Lent"); - - lh.addStaticHoliday ("13-AUG-2001", "Queens Birthday Observed"); - - lh.addStaticHoliday ("23-OCT-2001", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2001", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2001", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2001", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("26-FEB-2002", "Makha Bucha Day"); - - lh.addStaticHoliday ("08-APR-2002", "Chakri Day Observed"); - - lh.addStaticHoliday ("15-APR-2002", "Songkran Festival Day"); - - lh.addStaticHoliday ("16-APR-2002", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2002", "Coronation Day Observed"); - - lh.addStaticHoliday ("27-MAY-2002", "Visakha Bucha Day Observed"); - - lh.addStaticHoliday ("01-JUL-2002", "Mid-Year Holiday"); - - lh.addStaticHoliday ("25-JUL-2002", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2002", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2002", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2002", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2002", "Constitution Day"); - - lh.addStaticHoliday ("30-DEC-2002", "Bank Holiday"); - - lh.addStaticHoliday ("31-DEC-2002", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("17-FEB-2003", "Makha Bucha Day Observed"); - - lh.addStaticHoliday ("07-APR-2003", "Chakri Day Observed"); - - lh.addStaticHoliday ("14-APR-2003", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2003", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2003", "Coronation Day"); - - lh.addStaticHoliday ("15-MAY-2003", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2003", "Mid-Year Holiday"); - - lh.addStaticHoliday ("14-JUL-2003", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2003", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2003", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2003", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2003", "Constitution Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2004", "New Years Holiday"); - - lh.addStaticHoliday ("05-MAR-2004", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2004", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2004", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2004", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2004", "Songkran Festival Day"); - - lh.addStaticHoliday ("03-MAY-2004", "Labour Day Observed"); - - lh.addStaticHoliday ("05-MAY-2004", "Coronation Day"); - - lh.addStaticHoliday ("02-JUN-2004", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2004", "Mid-Year Holiday"); - - lh.addStaticHoliday ("02-AUG-2004", "Buddhist Lent Observed"); - - lh.addStaticHoliday ("12-AUG-2004", "Queens Birthday"); - - lh.addStaticHoliday ("25-OCT-2004", "King Chulalongkorn Memorial Day Observed"); - - lh.addStaticHoliday ("06-DEC-2004", "Kings Birthday Observed"); - - lh.addStaticHoliday ("10-DEC-2004", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2004", "New Years Eve"); - - lh.addStaticHoliday ("03-JAN-2005", "New Years Day Observed"); - - lh.addStaticHoliday ("23-FEB-2005", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2005", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2005", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2005", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2005", "Songkran Festival Day"); - - lh.addStaticHoliday ("02-MAY-2005", "Labour Day Observed"); - - lh.addStaticHoliday ("05-MAY-2005", "Coronation Day"); - - lh.addStaticHoliday ("23-MAY-2005", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2005", "Mid-Year Holiday"); - - lh.addStaticHoliday ("22-JUL-2005", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2005", "Queens Birthday"); - - lh.addStaticHoliday ("24-OCT-2005", "King Chulalongkorn Memorial Day Observed"); - - lh.addStaticHoliday ("05-DEC-2005", "Kings Birthday"); - - lh.addStaticHoliday ("12-DEC-2005", "Constitution Day Observed"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("13-FEB-2006", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2006", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2006", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2006", "Songkran Festival Day"); - - lh.addStaticHoliday ("19-APR-2006", "Election Day"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2006", "Coronation Day"); - - lh.addStaticHoliday ("12-MAY-2006", "Visakha Bucha Day"); - - lh.addStaticHoliday ("12-JUN-2006", "Special Holiday"); - - lh.addStaticHoliday ("13-JUN-2006", "Special Holiday"); - - lh.addStaticHoliday ("11-JUL-2006", "Buddhist Lent"); - - lh.addStaticHoliday ("14-AUG-2006", "Queens Birthday Observed"); - - lh.addStaticHoliday ("20-SEP-2006", "Special Holiday"); - - lh.addStaticHoliday ("23-OCT-2006", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2006", "Kings Birthday"); - - lh.addStaticHoliday ("11-DEC-2006", "Constitution Day Observed"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2007", "New Years Holiday"); - - lh.addStaticHoliday ("05-MAR-2007", "Makha Bucha Day Observed"); - - lh.addStaticHoliday ("06-APR-2007", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2007", "Songkran Festival Day"); - - lh.addStaticHoliday ("16-APR-2007", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("07-MAY-2007", "Coronation Day Observed"); - - lh.addStaticHoliday ("31-MAY-2007", "Visakha Bucha Day"); - - lh.addStaticHoliday ("30-JUL-2007", "Buddhist Lent"); - - lh.addStaticHoliday ("13-AUG-2007", "Queens Birthday Observed"); - - lh.addStaticHoliday ("23-OCT-2007", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2007", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2007", "Constitution Day"); - - lh.addStaticHoliday ("24-DEC-2007", "Election Day"); - - lh.addStaticHoliday ("31-DEC-2007", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("21-FEB-2008", "Makha Bucha Day"); - - lh.addStaticHoliday ("07-APR-2008", "Chakri Day Observed"); - - lh.addStaticHoliday ("14-APR-2008", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2008", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2008", "Coronation Day"); - - lh.addStaticHoliday ("19-MAY-2008", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2008", "Mid-Year Holiday"); - - lh.addStaticHoliday ("17-JUL-2008", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2008", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2008", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2008", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2008", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2008", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2009", "New Years Holiday"); - - lh.addStaticHoliday ("09-FEB-2009", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2009", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2009", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2009", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2009", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2009", "Coronation Day"); - - lh.addStaticHoliday ("08-MAY-2009", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2009", "Mid-Year Holiday"); - - lh.addStaticHoliday ("06-JUL-2009", "Bridging Day"); - - lh.addStaticHoliday ("07-JUL-2009", "Asarnha Bucha Day"); - - lh.addStaticHoliday ("12-AUG-2009", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2009", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("07-DEC-2009", "Kings Birthday Observed"); - - lh.addStaticHoliday ("10-DEC-2009", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2009", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("01-MAR-2010", "Makha Bucha Day Observed"); - - lh.addStaticHoliday ("06-APR-2010", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2010", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2010", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2010", "Songkran Festival Day"); - - lh.addStaticHoliday ("03-MAY-2010", "Labour Day Observed"); - - lh.addStaticHoliday ("05-MAY-2010", "Coronation Day"); - - lh.addStaticHoliday ("20-MAY-2010", "Special Holiday"); - - lh.addStaticHoliday ("21-MAY-2010", "Special Holiday"); - - lh.addStaticHoliday ("28-MAY-2010", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2010", "Mid-Year Holiday"); - - lh.addStaticHoliday ("26-JUL-2010", "Asarnha Bucha Day"); - - lh.addStaticHoliday ("12-AUG-2010", "Queens Birthday"); - - lh.addStaticHoliday ("13-AUG-2010", "Bridging Day"); - - lh.addStaticHoliday ("25-OCT-2010", "King Chulalongkorn Memorial Day Observed"); - - lh.addStaticHoliday ("06-DEC-2010", "Kings Birthday Observed"); - - lh.addStaticHoliday ("10-DEC-2010", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2010", "New Years Eve"); - - lh.addStaticHoliday ("03-JAN-2011", "New Years Day Observed"); - - lh.addStaticHoliday ("18-FEB-2011", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2011", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2011", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2011", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2011", "Songkran Festival Day"); - - lh.addStaticHoliday ("02-MAY-2011", "Labour Day Observed"); - - lh.addStaticHoliday ("05-MAY-2011", "Coronation Day"); - - lh.addStaticHoliday ("16-MAY-2011", "Bridging Day"); - - lh.addStaticHoliday ("17-MAY-2011", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2011", "Mid-Year Holiday"); - - lh.addStaticHoliday ("15-JUL-2011", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2011", "Queens Birthday"); - - lh.addStaticHoliday ("24-OCT-2011", "King Chulalongkorn Memorial Day Observed"); - - lh.addStaticHoliday ("05-DEC-2011", "Kings Birthday"); - - lh.addStaticHoliday ("12-DEC-2011", "Constitution Day Observed"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("07-MAR-2012", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2012", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2012", "Songkran Festival Day"); - - lh.addStaticHoliday ("16-APR-2012", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("07-MAY-2012", "Coronation Day Observed"); - - lh.addStaticHoliday ("04-JUN-2012", "Visakha Bucha Day"); - - lh.addStaticHoliday ("02-AUG-2012", "Buddhist Lent"); - - lh.addStaticHoliday ("13-AUG-2012", "Queens Birthday Observed"); - - lh.addStaticHoliday ("23-OCT-2012", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2012", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2012", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2012", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("25-FEB-2013", "Makha Bucha Day"); - - lh.addStaticHoliday ("08-APR-2013", "Chakri Day Observed"); - - lh.addStaticHoliday ("15-APR-2013", "Songkran Festival Day"); - - lh.addStaticHoliday ("16-APR-2013", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2013", "Coronation Day Observed"); - - lh.addStaticHoliday ("24-MAY-2013", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2013", "Mid-Year Holiday"); - - lh.addStaticHoliday ("22-JUL-2013", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2013", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2013", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2013", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2013", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2013", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("14-FEB-2014", "Makha Bucha Day"); - - lh.addStaticHoliday ("07-APR-2014", "Chakri Day Observed"); - - lh.addStaticHoliday ("14-APR-2014", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2014", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2014", "Coronation Day"); - - lh.addStaticHoliday ("13-MAY-2014", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2014", "Mid-Year Holiday"); - - lh.addStaticHoliday ("11-JUL-2014", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2014", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2014", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2014", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2014", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2014", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("04-MAR-2015", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2015", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2015", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2015", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2015", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2015", "Coronation Day"); - - lh.addStaticHoliday ("01-JUN-2015", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2015", "Mid-Year Holiday"); - - lh.addStaticHoliday ("30-JUL-2015", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2015", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2015", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("07-DEC-2015", "Kings Birthday Observed"); - - lh.addStaticHoliday ("10-DEC-2015", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2015", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("22-FEB-2016", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2016", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2016", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2016", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2016", "Songkran Festival Day"); - - lh.addStaticHoliday ("02-MAY-2016", "Labour Day Observed"); - - lh.addStaticHoliday ("05-MAY-2016", "Coronation Day"); - - lh.addStaticHoliday ("20-MAY-2016", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2016", "Mid-Year Holiday"); - - lh.addStaticHoliday ("19-JUL-2016", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2016", "Queens Birthday"); - - lh.addStaticHoliday ("24-OCT-2016", "King Chulalongkorn Memorial Day Observed"); - - lh.addStaticHoliday ("05-DEC-2016", "Kings Birthday"); - - lh.addStaticHoliday ("12-DEC-2016", "Constitution Day Observed"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("13-FEB-2017", "Makha Bucha Day Observed"); - - lh.addStaticHoliday ("06-APR-2017", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2017", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2017", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2017", "Coronation Day"); - - lh.addStaticHoliday ("10-MAY-2017", "Visakha Bucha Day"); - - lh.addStaticHoliday ("10-JUL-2017", "Buddhist Lent"); - - lh.addStaticHoliday ("14-AUG-2017", "Queens Birthday Observed"); - - lh.addStaticHoliday ("23-OCT-2017", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2017", "Kings Birthday"); - - lh.addStaticHoliday ("11-DEC-2017", "Constitution Day Observed"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2018", "New Years Holiday"); - - lh.addStaticHoliday ("01-MAR-2018", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2018", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2018", "Songkran Festival Day"); - - lh.addStaticHoliday ("16-APR-2018", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("07-MAY-2018", "Coronation Day Observed"); - - lh.addStaticHoliday ("29-MAY-2018", "Visakha Bucha Day"); - - lh.addStaticHoliday ("27-JUL-2018", "Buddhist Lent"); - - lh.addStaticHoliday ("13-AUG-2018", "Queens Birthday Observed"); - - lh.addStaticHoliday ("23-OCT-2018", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2018", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2018", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2018", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("19-FEB-2019", "Makha Bucha Day"); - - lh.addStaticHoliday ("08-APR-2019", "Chakri Day Observed"); - - lh.addStaticHoliday ("15-APR-2019", "Songkran Festival Day"); - - lh.addStaticHoliday ("16-APR-2019", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2019", "Coronation Day Observed"); - - lh.addStaticHoliday ("20-MAY-2019", "Visakha Bucha Day Observed"); - - lh.addStaticHoliday ("01-JUL-2019", "Mid-Year Holiday"); - - lh.addStaticHoliday ("16-JUL-2019", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2019", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2019", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2019", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2019", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2019", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("10-FEB-2020", "Makha Bucha Day Observed"); - - lh.addStaticHoliday ("06-APR-2020", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2020", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2020", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2020", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2020", "Coronation Day"); - - lh.addStaticHoliday ("06-MAY-2020", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2020", "Mid-Year Holiday"); - - lh.addStaticHoliday ("06-JUL-2020", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2020", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2020", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("07-DEC-2020", "Kings Birthday Observed"); - - lh.addStaticHoliday ("10-DEC-2020", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2020", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("26-FEB-2021", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2021", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2021", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2021", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2021", "Songkran Festival Day"); - - lh.addStaticHoliday ("03-MAY-2021", "Labour Day Observed"); - - lh.addStaticHoliday ("05-MAY-2021", "Coronation Day"); - - lh.addStaticHoliday ("26-MAY-2021", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2021", "Mid-Year Holiday"); - - lh.addStaticHoliday ("26-JUL-2021", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2021", "Queens Birthday"); - - lh.addStaticHoliday ("25-OCT-2021", "King Chulalongkorn Memorial Day Observed"); - - lh.addStaticHoliday ("06-DEC-2021", "Kings Birthday Observed"); - - lh.addStaticHoliday ("10-DEC-2021", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2021", "New Years Eve"); - - lh.addStaticHoliday ("03-JAN-2022", "New Years Day Observed"); - - lh.addStaticHoliday ("16-FEB-2022", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2022", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2022", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2022", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2022", "Songkran Festival Day"); - - lh.addStaticHoliday ("02-MAY-2022", "Labour Day Observed"); - - lh.addStaticHoliday ("05-MAY-2022", "Coronation Day"); - - lh.addStaticHoliday ("16-MAY-2022", "Visakha Bucha Day Observed"); - - lh.addStaticHoliday ("01-JUL-2022", "Mid-Year Holiday"); - - lh.addStaticHoliday ("13-JUL-2022", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2022", "Queens Birthday"); - - lh.addStaticHoliday ("24-OCT-2022", "King Chulalongkorn Memorial Day Observed"); - - lh.addStaticHoliday ("05-DEC-2022", "Kings Birthday"); - - lh.addStaticHoliday ("12-DEC-2022", "Constitution Day Observed"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("06-MAR-2023", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2023", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2023", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2023", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2023", "Coronation Day"); - - lh.addStaticHoliday ("05-JUN-2023", "Visakha Bucha Day Observed"); - - lh.addStaticHoliday ("01-AUG-2023", "Buddhist Lent"); - - lh.addStaticHoliday ("14-AUG-2023", "Queens Birthday Observed"); - - lh.addStaticHoliday ("23-OCT-2023", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2023", "Kings Birthday"); - - lh.addStaticHoliday ("11-DEC-2023", "Constitution Day Observed"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2024", "New Years Holiday"); - - lh.addStaticHoliday ("26-FEB-2024", "Makha Bucha Day Observed"); - - lh.addStaticHoliday ("08-APR-2024", "Chakri Day Observed"); - - lh.addStaticHoliday ("15-APR-2024", "Songkran Festival Day"); - - lh.addStaticHoliday ("16-APR-2024", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2024", "Coronation Day Observed"); - - lh.addStaticHoliday ("22-MAY-2024", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2024", "Mid-Year Holiday"); - - lh.addStaticHoliday ("22-JUL-2024", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2024", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2024", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2024", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2024", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2024", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("12-FEB-2025", "Makha Bucha Day"); - - lh.addStaticHoliday ("07-APR-2025", "Chakri Day Observed"); - - lh.addStaticHoliday ("14-APR-2025", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2025", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2025", "Coronation Day"); - - lh.addStaticHoliday ("12-MAY-2025", "Visakha Bucha Day Observed"); - - lh.addStaticHoliday ("01-JUL-2025", "Mid-Year Holiday"); - - lh.addStaticHoliday ("10-JUL-2025", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2025", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2025", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2025", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2025", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2025", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("03-MAR-2026", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2026", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2026", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2026", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2026", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2026", "Coronation Day"); - - lh.addStaticHoliday ("01-JUN-2026", "Visakha Bucha Day Observed"); - - lh.addStaticHoliday ("01-JUL-2026", "Mid-Year Holiday"); - - lh.addStaticHoliday ("29-JUL-2026", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2026", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2026", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("07-DEC-2026", "Kings Birthday Observed"); - - lh.addStaticHoliday ("10-DEC-2026", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2026", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("22-FEB-2027", "Makha Bucha Day Observed"); - - lh.addStaticHoliday ("06-APR-2027", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2027", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2027", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2027", "Songkran Festival Day"); - - lh.addStaticHoliday ("03-MAY-2027", "Labour Day Observed"); - - lh.addStaticHoliday ("05-MAY-2027", "Coronation Day"); - - lh.addStaticHoliday ("20-MAY-2027", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2027", "Mid-Year Holiday"); - - lh.addStaticHoliday ("19-JUL-2027", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2027", "Queens Birthday"); - - lh.addStaticHoliday ("25-OCT-2027", "King Chulalongkorn Memorial Day Observed"); - - lh.addStaticHoliday ("06-DEC-2027", "Kings Birthday Observed"); - - lh.addStaticHoliday ("10-DEC-2027", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2027", "New Years Eve"); - - lh.addStaticHoliday ("03-JAN-2028", "New Years Day Observed"); - - lh.addStaticHoliday ("10-FEB-2028", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2028", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2028", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2028", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2028", "Coronation Day"); - - lh.addStaticHoliday ("08-MAY-2028", "Visakha Bucha Day"); - - lh.addStaticHoliday ("06-JUL-2028", "Buddhist Lent"); - - lh.addStaticHoliday ("14-AUG-2028", "Queens Birthday Observed"); - - lh.addStaticHoliday ("23-OCT-2028", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2028", "Kings Birthday"); - - lh.addStaticHoliday ("11-DEC-2028", "Constitution Day Observed"); - - lh.addStaticHoliday ("01-JAN-2029", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2029", "New Years Holiday"); - - lh.addStaticHoliday ("27-FEB-2029", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2029", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2029", "Songkran Festival Day"); - - lh.addStaticHoliday ("16-APR-2029", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2029", "Labour Day"); - - lh.addStaticHoliday ("07-MAY-2029", "Coronation Day Observed"); - - lh.addStaticHoliday ("28-MAY-2029", "Visakha Bucha Day Observed"); - - lh.addStaticHoliday ("25-JUL-2029", "Buddhist Lent"); - - lh.addStaticHoliday ("13-AUG-2029", "Queens Birthday Observed"); - - lh.addStaticHoliday ("23-OCT-2029", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2029", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2029", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2029", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2030", "New Years Day"); - - lh.addStaticHoliday ("18-FEB-2030", "Makha Bucha Day Observed"); - - lh.addStaticHoliday ("08-APR-2030", "Chakri Day Observed"); - - lh.addStaticHoliday ("15-APR-2030", "Songkran Festival Day"); - - lh.addStaticHoliday ("16-APR-2030", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2030", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2030", "Coronation Day Observed"); - - lh.addStaticHoliday ("16-MAY-2030", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2030", "Mid-Year Holiday"); - - lh.addStaticHoliday ("15-JUL-2030", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2030", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2030", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2030", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2030", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2030", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2031", "New Years Day"); - - lh.addStaticHoliday ("07-MAR-2031", "Makha Bucha Day"); - - lh.addStaticHoliday ("07-APR-2031", "Chakri Day Observed"); - - lh.addStaticHoliday ("14-APR-2031", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2031", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2031", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2031", "Coronation Day"); - - lh.addStaticHoliday ("04-JUN-2031", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2031", "Mid-Year Holiday"); - - lh.addStaticHoliday ("04-AUG-2031", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2031", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2031", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2031", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2031", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2031", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2032", "New Years Day"); - - lh.addStaticHoliday ("25-FEB-2032", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2032", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2032", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2032", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2032", "Songkran Festival Day"); - - lh.addStaticHoliday ("03-MAY-2032", "Labour Day Observed"); - - lh.addStaticHoliday ("05-MAY-2032", "Coronation Day"); - - lh.addStaticHoliday ("24-MAY-2032", "Visakha Bucha Day Observed"); - - lh.addStaticHoliday ("01-JUL-2032", "Mid-Year Holiday"); - - lh.addStaticHoliday ("22-JUL-2032", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2032", "Queens Birthday"); - - lh.addStaticHoliday ("25-OCT-2032", "King Chulalongkorn Memorial Day Observed"); - - lh.addStaticHoliday ("06-DEC-2032", "Kings Birthday Observed"); - - lh.addStaticHoliday ("10-DEC-2032", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2032", "New Years Eve"); - - lh.addStaticHoliday ("03-JAN-2033", "New Years Day Observed"); - - lh.addStaticHoliday ("14-FEB-2033", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2033", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2033", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2033", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2033", "Songkran Festival Day"); - - lh.addStaticHoliday ("02-MAY-2033", "Labour Day Observed"); - - lh.addStaticHoliday ("05-MAY-2033", "Coronation Day"); - - lh.addStaticHoliday ("13-MAY-2033", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2033", "Mid-Year Holiday"); - - lh.addStaticHoliday ("11-JUL-2033", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2033", "Queens Birthday"); - - lh.addStaticHoliday ("24-OCT-2033", "King Chulalongkorn Memorial Day Observed"); - - lh.addStaticHoliday ("05-DEC-2033", "Kings Birthday"); - - lh.addStaticHoliday ("12-DEC-2033", "Constitution Day Observed"); - - lh.addStaticHoliday ("02-JAN-2034", "New Years Day Observed"); - - lh.addStaticHoliday ("06-MAR-2034", "Makha Bucha Day Observed"); - - lh.addStaticHoliday ("06-APR-2034", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2034", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2034", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2034", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2034", "Coronation Day"); - - lh.addStaticHoliday ("01-JUN-2034", "Visakha Bucha Day"); - - lh.addStaticHoliday ("31-JUL-2034", "Buddhist Lent"); - - lh.addStaticHoliday ("14-AUG-2034", "Queens Birthday Observed"); - - lh.addStaticHoliday ("23-OCT-2034", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2034", "Kings Birthday"); - - lh.addStaticHoliday ("11-DEC-2034", "Constitution Day Observed"); - - lh.addStaticHoliday ("01-JAN-2035", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2035", "New Years Holiday"); - - lh.addStaticHoliday ("22-FEB-2035", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2035", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2035", "Songkran Festival Day"); - - lh.addStaticHoliday ("16-APR-2035", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2035", "Labour Day"); - - lh.addStaticHoliday ("07-MAY-2035", "Coronation Day Observed"); - - lh.addStaticHoliday ("21-MAY-2035", "Visakha Bucha Day"); - - lh.addStaticHoliday ("20-JUL-2035", "Buddhist Lent"); - - lh.addStaticHoliday ("13-AUG-2035", "Queens Birthday Observed"); - - lh.addStaticHoliday ("23-OCT-2035", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2035", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2035", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2035", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2036", "New Years Day"); - - lh.addStaticHoliday ("12-FEB-2036", "Makha Bucha Day"); - - lh.addStaticHoliday ("07-APR-2036", "Chakri Day Observed"); - - lh.addStaticHoliday ("14-APR-2036", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2036", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2036", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2036", "Coronation Day"); - - lh.addStaticHoliday ("12-MAY-2036", "Visakha Bucha Day Observed"); - - lh.addStaticHoliday ("01-JUL-2036", "Mid-Year Holiday"); - - lh.addStaticHoliday ("08-JUL-2036", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2036", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2036", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2036", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2036", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2036", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2037", "New Years Day"); - - lh.addStaticHoliday ("02-MAR-2037", "Makha Bucha Day Observed"); - - lh.addStaticHoliday ("06-APR-2037", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2037", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2037", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2037", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2037", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2037", "Coronation Day"); - - lh.addStaticHoliday ("29-MAY-2037", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2037", "Mid-Year Holiday"); - - lh.addStaticHoliday ("27-JUL-2037", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2037", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2037", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("07-DEC-2037", "Kings Birthday Observed"); - - lh.addStaticHoliday ("10-DEC-2037", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2037", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2038", "New Years Day"); - - lh.addStaticHoliday ("19-FEB-2038", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2038", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2038", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2038", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2038", "Songkran Festival Day"); - - lh.addStaticHoliday ("03-MAY-2038", "Labour Day Observed"); - - lh.addStaticHoliday ("05-MAY-2038", "Coronation Day"); - - lh.addStaticHoliday ("18-MAY-2038", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2038", "Mid-Year Holiday"); - - lh.addStaticHoliday ("16-JUL-2038", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2038", "Queens Birthday"); - - lh.addStaticHoliday ("25-OCT-2038", "King Chulalongkorn Memorial Day Observed"); - - lh.addStaticHoliday ("06-DEC-2038", "Kings Birthday Observed"); - - lh.addStaticHoliday ("10-DEC-2038", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2038", "New Years Eve"); - - lh.addStaticHoliday ("03-JAN-2039", "New Years Day Observed"); - - lh.addStaticHoliday ("08-FEB-2039", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2039", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2039", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2039", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2039", "Songkran Festival Day"); - - lh.addStaticHoliday ("02-MAY-2039", "Labour Day Observed"); - - lh.addStaticHoliday ("05-MAY-2039", "Coronation Day"); - - lh.addStaticHoliday ("09-MAY-2039", "Visakha Bucha Day Observed"); - - lh.addStaticHoliday ("01-JUL-2039", "Mid-Year Holiday"); - - lh.addStaticHoliday ("05-JUL-2039", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2039", "Queens Birthday"); - - lh.addStaticHoliday ("24-OCT-2039", "King Chulalongkorn Memorial Day Observed"); - - lh.addStaticHoliday ("05-DEC-2039", "Kings Birthday"); - - lh.addStaticHoliday ("12-DEC-2039", "Constitution Day Observed"); - - lh.addStaticHoliday ("02-JAN-2040", "New Years Day Observed"); - - lh.addStaticHoliday ("27-FEB-2040", "Makha Bucha Day Observed"); - - lh.addStaticHoliday ("06-APR-2040", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2040", "Songkran Festival Day"); - - lh.addStaticHoliday ("16-APR-2040", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2040", "Labour Day"); - - lh.addStaticHoliday ("07-MAY-2040", "Coronation Day Observed"); - - lh.addStaticHoliday ("25-MAY-2040", "Visakha Bucha Day"); - - lh.addStaticHoliday ("23-JUL-2040", "Buddhist Lent"); - - lh.addStaticHoliday ("13-AUG-2040", "Queens Birthday Observed"); - - lh.addStaticHoliday ("23-OCT-2040", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2040", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2040", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2040", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2041", "New Years Day"); - - lh.addStaticHoliday ("15-FEB-2041", "Makha Bucha Day"); - - lh.addStaticHoliday ("08-APR-2041", "Chakri Day Observed"); - - lh.addStaticHoliday ("15-APR-2041", "Songkran Festival Day"); - - lh.addStaticHoliday ("16-APR-2041", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2041", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2041", "Coronation Day Observed"); - - lh.addStaticHoliday ("14-MAY-2041", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2041", "Mid-Year Holiday"); - - lh.addStaticHoliday ("15-JUL-2041", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2041", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2041", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2041", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2041", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2041", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2042", "New Years Day"); - - lh.addStaticHoliday ("06-MAR-2042", "Makha Bucha Day"); - - lh.addStaticHoliday ("07-APR-2042", "Chakri Day Observed"); - - lh.addStaticHoliday ("14-APR-2042", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2042", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2042", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2042", "Coronation Day"); - - lh.addStaticHoliday ("03-JUN-2042", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2042", "Mid-Year Holiday"); - - lh.addStaticHoliday ("01-AUG-2042", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2042", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2042", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2042", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2042", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2042", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2043", "New Years Day"); - - lh.addStaticHoliday ("24-FEB-2043", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2043", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2043", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2043", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2043", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2043", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2043", "Coronation Day"); - - lh.addStaticHoliday ("25-MAY-2043", "Visakha Bucha Day Observed"); - - lh.addStaticHoliday ("01-JUL-2043", "Mid-Year Holiday"); - - lh.addStaticHoliday ("21-JUL-2043", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2043", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2043", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("07-DEC-2043", "Kings Birthday Observed"); - - lh.addStaticHoliday ("10-DEC-2043", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2043", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2044", "New Years Day"); - - lh.addStaticHoliday ("15-FEB-2044", "Makha Bucha Day Observed"); - - lh.addStaticHoliday ("06-APR-2044", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2044", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2044", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2044", "Songkran Festival Day"); - - lh.addStaticHoliday ("02-MAY-2044", "Labour Day Observed"); - - lh.addStaticHoliday ("05-MAY-2044", "Coronation Day"); - - lh.addStaticHoliday ("11-MAY-2044", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2044", "Mid-Year Holiday"); - - lh.addStaticHoliday ("11-JUL-2044", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2044", "Queens Birthday"); - - lh.addStaticHoliday ("24-OCT-2044", "King Chulalongkorn Memorial Day Observed"); - - lh.addStaticHoliday ("05-DEC-2044", "Kings Birthday"); - - lh.addStaticHoliday ("12-DEC-2044", "Constitution Day Observed"); - - lh.addStaticHoliday ("02-JAN-2045", "New Years Day Observed"); - - lh.addStaticHoliday ("02-MAR-2045", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2045", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2045", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2045", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2045", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2045", "Coronation Day"); - - lh.addStaticHoliday ("30-MAY-2045", "Visakha Bucha Day"); - - lh.addStaticHoliday ("28-JUL-2045", "Buddhist Lent"); - - lh.addStaticHoliday ("14-AUG-2045", "Queens Birthday Observed"); - - lh.addStaticHoliday ("23-OCT-2045", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2045", "Kings Birthday"); - - lh.addStaticHoliday ("11-DEC-2045", "Constitution Day Observed"); - - lh.addStaticHoliday ("01-JAN-2046", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2046", "New Years Holiday"); - - lh.addStaticHoliday ("20-FEB-2046", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2046", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2046", "Songkran Festival Day"); - - lh.addStaticHoliday ("16-APR-2046", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2046", "Labour Day"); - - lh.addStaticHoliday ("07-MAY-2046", "Coronation Day Observed"); - - lh.addStaticHoliday ("21-MAY-2046", "Visakha Bucha Day Observed"); - - lh.addStaticHoliday ("17-JUL-2046", "Buddhist Lent"); - - lh.addStaticHoliday ("13-AUG-2046", "Queens Birthday Observed"); - - lh.addStaticHoliday ("23-OCT-2046", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2046", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2046", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2046", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2047", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2047", "Makha Bucha Day Observed"); - - lh.addStaticHoliday ("08-APR-2047", "Chakri Day Observed"); - - lh.addStaticHoliday ("15-APR-2047", "Songkran Festival Day"); - - lh.addStaticHoliday ("16-APR-2047", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2047", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2047", "Coronation Day Observed"); - - lh.addStaticHoliday ("08-MAY-2047", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2047", "Mid-Year Holiday"); - - lh.addStaticHoliday ("08-JUL-2047", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2047", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2047", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2047", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2047", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2047", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2048", "New Years Day"); - - lh.addStaticHoliday ("28-FEB-2048", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2048", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2048", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2048", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2048", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2048", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2048", "Coronation Day"); - - lh.addStaticHoliday ("27-MAY-2048", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2048", "Mid-Year Holiday"); - - lh.addStaticHoliday ("27-JUL-2048", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2048", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2048", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("07-DEC-2048", "Kings Birthday Observed"); - - lh.addStaticHoliday ("10-DEC-2048", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2048", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2049", "New Years Day"); - - lh.addStaticHoliday ("17-FEB-2049", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2049", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2049", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2049", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2049", "Songkran Festival Day"); - - lh.addStaticHoliday ("03-MAY-2049", "Labour Day Observed"); - - lh.addStaticHoliday ("05-MAY-2049", "Coronation Day"); - - lh.addStaticHoliday ("17-MAY-2049", "Visakha Bucha Day Observed"); - - lh.addStaticHoliday ("01-JUL-2049", "Mid-Year Holiday"); - - lh.addStaticHoliday ("14-JUL-2049", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2049", "Queens Birthday"); - - lh.addStaticHoliday ("25-OCT-2049", "King Chulalongkorn Memorial Day Observed"); - - lh.addStaticHoliday ("06-DEC-2049", "Kings Birthday Observed"); - - lh.addStaticHoliday ("10-DEC-2049", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2049", "New Years Eve"); - - lh.addStaticHoliday ("03-JAN-2050", "New Years Day Observed"); - - lh.addStaticHoliday ("07-MAR-2050", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2050", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2050", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2050", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2050", "Songkran Festival Day"); - - lh.addStaticHoliday ("02-MAY-2050", "Labour Day Observed"); - - lh.addStaticHoliday ("05-MAY-2050", "Coronation Day"); - - lh.addStaticHoliday ("06-JUN-2050", "Visakha Bucha Day Observed"); - - lh.addStaticHoliday ("01-JUL-2050", "Mid-Year Holiday"); - - lh.addStaticHoliday ("02-AUG-2050", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2050", "Queens Birthday"); - - lh.addStaticHoliday ("24-OCT-2050", "King Chulalongkorn Memorial Day Observed"); - - lh.addStaticHoliday ("05-DEC-2050", "Kings Birthday"); - - lh.addStaticHoliday ("12-DEC-2050", "Constitution Day Observed"); - - lh.addStaticHoliday ("02-JAN-2051", "New Years Day Observed"); - - lh.addStaticHoliday ("27-FEB-2051", "Makha Bucha Day Observed"); - - lh.addStaticHoliday ("06-APR-2051", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2051", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2051", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2051", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2051", "Coronation Day"); - - lh.addStaticHoliday ("24-MAY-2051", "Visakha Bucha Day"); - - lh.addStaticHoliday ("24-JUL-2051", "Buddhist Lent"); - - lh.addStaticHoliday ("14-AUG-2051", "Queens Birthday Observed"); - - lh.addStaticHoliday ("23-OCT-2051", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2051", "Kings Birthday"); - - lh.addStaticHoliday ("11-DEC-2051", "Constitution Day Observed"); - - lh.addStaticHoliday ("01-JAN-2052", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2052", "New Years Holiday"); - - lh.addStaticHoliday ("14-FEB-2052", "Makha Bucha Day"); - - lh.addStaticHoliday ("08-APR-2052", "Chakri Day Observed"); - - lh.addStaticHoliday ("15-APR-2052", "Songkran Festival Day"); - - lh.addStaticHoliday ("16-APR-2052", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2052", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2052", "Coronation Day Observed"); - - lh.addStaticHoliday ("13-MAY-2052", "Visakha Bucha Day Observed"); - - lh.addStaticHoliday ("01-JUL-2052", "Mid-Year Holiday"); - - lh.addStaticHoliday ("11-JUL-2052", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2052", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2052", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2052", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2052", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2052", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2053", "New Years Day"); - - lh.addStaticHoliday ("04-MAR-2053", "Makha Bucha Day"); - - lh.addStaticHoliday ("07-APR-2053", "Chakri Day Observed"); - - lh.addStaticHoliday ("14-APR-2053", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2053", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2053", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2053", "Coronation Day"); - - lh.addStaticHoliday ("02-JUN-2053", "Visakha Bucha Day Observed"); - - lh.addStaticHoliday ("01-JUL-2053", "Mid-Year Holiday"); - - lh.addStaticHoliday ("30-JUL-2053", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2053", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2053", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2053", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2053", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2053", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2054", "New Years Day"); - - lh.addStaticHoliday ("23-FEB-2054", "Makha Bucha Day Observed"); - - lh.addStaticHoliday ("06-APR-2054", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2054", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2054", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2054", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2054", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2054", "Coronation Day"); - - lh.addStaticHoliday ("21-MAY-2054", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2054", "Mid-Year Holiday"); - - lh.addStaticHoliday ("20-JUL-2054", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2054", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2054", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("07-DEC-2054", "Kings Birthday Observed"); - - lh.addStaticHoliday ("10-DEC-2054", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2054", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2055", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2055", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2055", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2055", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2055", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2055", "Songkran Festival Day"); - - lh.addStaticHoliday ("03-MAY-2055", "Labour Day Observed"); - - lh.addStaticHoliday ("05-MAY-2055", "Coronation Day"); - - lh.addStaticHoliday ("10-MAY-2055", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2055", "Mid-Year Holiday"); - - lh.addStaticHoliday ("08-JUL-2055", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2055", "Queens Birthday"); - - lh.addStaticHoliday ("25-OCT-2055", "King Chulalongkorn Memorial Day Observed"); - - lh.addStaticHoliday ("06-DEC-2055", "Kings Birthday Observed"); - - lh.addStaticHoliday ("10-DEC-2055", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2055", "New Years Eve"); - - lh.addStaticHoliday ("03-JAN-2056", "New Years Day Observed"); - - lh.addStaticHoliday ("29-FEB-2056", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2056", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2056", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2056", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2056", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2056", "Coronation Day"); - - lh.addStaticHoliday ("29-MAY-2056", "Visakha Bucha Day Observed"); - - lh.addStaticHoliday ("27-JUL-2056", "Buddhist Lent"); - - lh.addStaticHoliday ("14-AUG-2056", "Queens Birthday Observed"); - - lh.addStaticHoliday ("23-OCT-2056", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2056", "Kings Birthday"); - - lh.addStaticHoliday ("11-DEC-2056", "Constitution Day Observed"); - - lh.addStaticHoliday ("01-JAN-2057", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2057", "New Years Holiday"); - - lh.addStaticHoliday ("19-FEB-2057", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2057", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2057", "Songkran Festival Day"); - - lh.addStaticHoliday ("16-APR-2057", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2057", "Labour Day"); - - lh.addStaticHoliday ("07-MAY-2057", "Coronation Day Observed"); - - lh.addStaticHoliday ("18-MAY-2057", "Visakha Bucha Day"); - - lh.addStaticHoliday ("16-JUL-2057", "Buddhist Lent"); - - lh.addStaticHoliday ("13-AUG-2057", "Queens Birthday Observed"); - - lh.addStaticHoliday ("23-OCT-2057", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2057", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2057", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2057", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2058", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2058", "Makha Bucha Day"); - - lh.addStaticHoliday ("08-APR-2058", "Chakri Day Observed"); - - lh.addStaticHoliday ("15-APR-2058", "Songkran Festival Day"); - - lh.addStaticHoliday ("16-APR-2058", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2058", "Labour Day"); - - lh.addStaticHoliday ("06-MAY-2058", "Coronation Day Observed"); - - lh.addStaticHoliday ("07-MAY-2058", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2058", "Mid-Year Holiday"); - - lh.addStaticHoliday ("05-JUL-2058", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2058", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2058", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2058", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2058", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2058", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2059", "New Years Day"); - - lh.addStaticHoliday ("26-FEB-2059", "Makha Bucha Day"); - - lh.addStaticHoliday ("07-APR-2059", "Chakri Day Observed"); - - lh.addStaticHoliday ("14-APR-2059", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2059", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2059", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2059", "Coronation Day"); - - lh.addStaticHoliday ("26-MAY-2059", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2059", "Mid-Year Holiday"); - - lh.addStaticHoliday ("24-JUL-2059", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2059", "Queens Birthday"); - - lh.addStaticHoliday ("23-OCT-2059", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2059", "Kings Birthday"); - - lh.addStaticHoliday ("10-DEC-2059", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2059", "New Years Eve"); - - lh.addStaticHoliday ("01-JAN-2060", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2060", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2060", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2060", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2060", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2060", "Songkran Festival Day"); - - lh.addStaticHoliday ("03-MAY-2060", "Labour Day Observed"); - - lh.addStaticHoliday ("05-MAY-2060", "Coronation Day"); - - lh.addStaticHoliday ("14-MAY-2060", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2060", "Mid-Year Holiday"); - - lh.addStaticHoliday ("12-JUL-2060", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2060", "Queens Birthday"); - - lh.addStaticHoliday ("25-OCT-2060", "King Chulalongkorn Memorial Day Observed"); - - lh.addStaticHoliday ("06-DEC-2060", "Kings Birthday Observed"); - - lh.addStaticHoliday ("10-DEC-2060", "Constitution Day"); - - lh.addStaticHoliday ("31-DEC-2060", "New Years Eve"); - - lh.addStaticHoliday ("03-JAN-2061", "New Years Day Observed"); - - lh.addStaticHoliday ("07-MAR-2061", "Makha Bucha Day Observed"); - - lh.addStaticHoliday ("06-APR-2061", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2061", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2061", "Songkran Festival Day"); - - lh.addStaticHoliday ("15-APR-2061", "Songkran Festival Day"); - - lh.addStaticHoliday ("02-MAY-2061", "Labour Day Observed"); - - lh.addStaticHoliday ("05-MAY-2061", "Coronation Day"); - - lh.addStaticHoliday ("02-JUN-2061", "Visakha Bucha Day"); - - lh.addStaticHoliday ("01-JUL-2061", "Mid-Year Holiday"); - - lh.addStaticHoliday ("01-AUG-2061", "Buddhist Lent"); - - lh.addStaticHoliday ("12-AUG-2061", "Queens Birthday"); - - lh.addStaticHoliday ("24-OCT-2061", "King Chulalongkorn Memorial Day Observed"); - - lh.addStaticHoliday ("05-DEC-2061", "Kings Birthday"); - - lh.addStaticHoliday ("12-DEC-2061", "Constitution Day Observed"); - - lh.addStaticHoliday ("02-JAN-2062", "New Years Day Observed"); - - lh.addStaticHoliday ("23-FEB-2062", "Makha Bucha Day"); - - lh.addStaticHoliday ("24-FEB-2062", "Makha Bucha Day"); - - lh.addStaticHoliday ("06-APR-2062", "Chakri Day"); - - lh.addStaticHoliday ("13-APR-2062", "Songkran Festival Day"); - - lh.addStaticHoliday ("14-APR-2062", "Songkran Festival Day"); - - lh.addStaticHoliday ("01-MAY-2062", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2062", "Coronation Day"); - - lh.addStaticHoliday ("22-MAY-2062", "Visakha Bucha Day"); - - lh.addStaticHoliday ("23-MAY-2062", "Visakha Bucha Day"); - - lh.addStaticHoliday ("21-JUL-2062", "Buddhist Lent"); - - lh.addStaticHoliday ("14-AUG-2062", "Queens Birthday Observed"); - - lh.addStaticHoliday ("23-OCT-2062", "King Chulalongkorn Memorial Day"); - - lh.addStaticHoliday ("05-DEC-2062", "Kings Birthday"); - - lh.addStaticHoliday ("11-DEC-2062", "Constitution Day Observed"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/TRLHoliday.java b/org/drip/analytics/holset/TRLHoliday.java deleted file mode 100644 index 1448966..0000000 --- a/org/drip/analytics/holset/TRLHoliday.java +++ /dev/null @@ -1,593 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class TRLHoliday implements org.drip.analytics.holset.LocationHoliday { - public TRLHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "TRL"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("29-JAN-1998", "Ramadan Feast Day"); - - lh.addStaticHoliday ("30-JAN-1998", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("07-APR-1998", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("08-APR-1998", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("09-APR-1998", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("10-APR-1998", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("23-APR-1998", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("19-MAY-1998", "Youth & Sports Day"); - - lh.addStaticHoliday ("29-OCT-1998", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-1999", "Ramadan Feast Day"); - - lh.addStaticHoliday ("20-JAN-1999", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("21-JAN-1999", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("29-MAR-1999", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("30-MAR-1999", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("31-MAR-1999", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("23-APR-1999", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("19-MAY-1999", "Youth & Sports Day"); - - lh.addStaticHoliday ("30-AUG-1999", "Victory Day"); - - lh.addStaticHoliday ("29-OCT-1999", "Republic Day"); - - lh.addStaticHoliday ("07-JAN-2000", "Ramadan Feast Day"); - - lh.addStaticHoliday ("10-JAN-2000", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("16-MAR-2000", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("17-MAR-2000", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("19-MAY-2000", "Youth & Sports Day"); - - lh.addStaticHoliday ("30-AUG-2000", "Victory Day"); - - lh.addStaticHoliday ("27-DEC-2000", "Ramadan Feast Day"); - - lh.addStaticHoliday ("28-DEC-2000", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("29-DEC-2000", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("05-MAR-2001", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("06-MAR-2001", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("07-MAR-2001", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("08-MAR-2001", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("23-APR-2001", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("30-AUG-2001", "Victory Day"); - - lh.addStaticHoliday ("29-OCT-2001", "Republic Day"); - - lh.addStaticHoliday ("17-DEC-2001", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("22-FEB-2002", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("25-FEB-2002", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("23-APR-2002", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("30-AUG-2002", "Victory Day"); - - lh.addStaticHoliday ("29-OCT-2002", "Republic Day"); - - lh.addStaticHoliday ("05-DEC-2002", "Ramadan Feast Day"); - - lh.addStaticHoliday ("06-DEC-2002", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2003", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("12-FEB-2003", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("13-FEB-2003", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("14-FEB-2003", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("23-APR-2003", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("19-MAY-2003", "Youth & Sports Day"); - - lh.addStaticHoliday ("29-OCT-2003", "Republic Day"); - - lh.addStaticHoliday ("24-NOV-2003", "Ramadan Feast Day"); - - lh.addStaticHoliday ("25-NOV-2003", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("26-NOV-2003", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("02-FEB-2004", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("03-FEB-2004", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("23-APR-2004", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("19-MAY-2004", "Youth & Sports Day"); - - lh.addStaticHoliday ("30-AUG-2004", "Victory Day"); - - lh.addStaticHoliday ("29-OCT-2004", "Republic Day"); - - lh.addStaticHoliday ("15-NOV-2004", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("20-JAN-2005", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("21-JAN-2005", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("19-MAY-2005", "Youth & Sports Day"); - - lh.addStaticHoliday ("30-AUG-2005", "Victory Day"); - - lh.addStaticHoliday ("02-NOV-2005", "Ramadan Feast Day"); - - lh.addStaticHoliday ("03-NOV-2005", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("04-NOV-2005", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("09-JAN-2006", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("10-JAN-2006", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("11-JAN-2006", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("12-JAN-2006", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("19-MAY-2006", "Youth & Sports Day"); - - lh.addStaticHoliday ("30-AUG-2006", "Victory Day"); - - lh.addStaticHoliday ("23-OCT-2006", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("24-OCT-2006", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2007", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("23-APR-2007", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("30-AUG-2007", "Victory Day"); - - lh.addStaticHoliday ("11-OCT-2007", "Ramadan Feast Day"); - - lh.addStaticHoliday ("12-OCT-2007", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("29-OCT-2007", "Republic Day"); - - lh.addStaticHoliday ("19-DEC-2007", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("20-DEC-2007", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("21-DEC-2007", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("23-APR-2008", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("19-MAY-2008", "Youth & Sports Day"); - - lh.addStaticHoliday ("30-SEP-2008", "Ramadan Feast Day"); - - lh.addStaticHoliday ("01-OCT-2008", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("02-OCT-2008", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("29-OCT-2008", "Republic Day"); - - lh.addStaticHoliday ("08-DEC-2008", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("09-DEC-2008", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("10-DEC-2008", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("23-APR-2009", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("19-MAY-2009", "Youth & Sports Day"); - - lh.addStaticHoliday ("21-SEP-2009", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("29-OCT-2009", "Republic Day"); - - lh.addStaticHoliday ("26-NOV-2009", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("27-NOV-2009", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("23-APR-2010", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("19-MAY-2010", "Youth & Sports Day"); - - lh.addStaticHoliday ("30-AUG-2010", "Victory Day"); - - lh.addStaticHoliday ("09-SEP-2010", "Ramadan Feast Day"); - - lh.addStaticHoliday ("10-SEP-2010", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("29-OCT-2010", "Republic Day"); - - lh.addStaticHoliday ("16-NOV-2010", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("17-NOV-2010", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("18-NOV-2010", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("19-NOV-2010", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("19-MAY-2011", "Youth & Sports Day"); - - lh.addStaticHoliday ("29-AUG-2011", "Ramadan Feast Day"); - - lh.addStaticHoliday ("30-AUG-2011", "Victory Day"); - - lh.addStaticHoliday ("31-AUG-2011", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("07-NOV-2011", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("08-NOV-2011", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("23-APR-2012", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("20-AUG-2012", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("30-AUG-2012", "Victory Day"); - - lh.addStaticHoliday ("25-OCT-2012", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("26-OCT-2012", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("29-OCT-2012", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("23-APR-2013", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("07-AUG-2013", "Ramadan Feast Day"); - - lh.addStaticHoliday ("08-AUG-2013", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("09-AUG-2013", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("30-AUG-2013", "Victory Day"); - - lh.addStaticHoliday ("14-OCT-2013", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("15-OCT-2013", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("16-OCT-2013", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("17-OCT-2013", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("29-OCT-2013", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("23-APR-2014", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("19-MAY-2014", "Youth & Sports Day"); - - lh.addStaticHoliday ("28-JUL-2014", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("03-OCT-2014", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("06-OCT-2014", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("29-OCT-2014", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("23-APR-2015", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("19-MAY-2015", "Youth & Sports Day"); - - lh.addStaticHoliday ("16-JUL-2015", "Ramadan Feast Day"); - - lh.addStaticHoliday ("17-JUL-2015", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("23-SEP-2015", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("24-SEP-2015", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("25-SEP-2015", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("29-OCT-2015", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("19-MAY-2016", "Youth & Sports Day"); - - lh.addStaticHoliday ("05-JUL-2016", "Ramadan Feast Day"); - - lh.addStaticHoliday ("06-JUL-2016", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("07-JUL-2016", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("30-AUG-2016", "Victory Day"); - - lh.addStaticHoliday ("12-SEP-2016", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("13-SEP-2016", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("14-SEP-2016", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("19-MAY-2017", "Youth & Sports Day"); - - lh.addStaticHoliday ("26-JUN-2017", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("30-AUG-2017", "Victory Day"); - - lh.addStaticHoliday ("31-AUG-2017", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("01-SEP-2017", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("23-APR-2018", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("14-JUN-2018", "Ramadan Feast Day"); - - lh.addStaticHoliday ("15-JUN-2018", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("21-AUG-2018", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("22-AUG-2018", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("23-AUG-2018", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("24-AUG-2018", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("30-AUG-2018", "Victory Day"); - - lh.addStaticHoliday ("29-OCT-2018", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("23-APR-2019", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("04-JUN-2019", "Ramadan Feast Day"); - - lh.addStaticHoliday ("05-JUN-2019", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("06-JUN-2019", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("12-AUG-2019", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("13-AUG-2019", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("30-AUG-2019", "Victory Day"); - - lh.addStaticHoliday ("29-OCT-2019", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("23-APR-2020", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("19-MAY-2020", "Youth & Sports Day"); - - lh.addStaticHoliday ("25-MAY-2020", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("30-JUL-2020", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("31-JUL-2020", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("29-OCT-2020", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("23-APR-2021", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("12-MAY-2021", "Ramadan Feast Day"); - - lh.addStaticHoliday ("13-MAY-2021", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("14-MAY-2021", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("19-MAY-2021", "Youth & Sports Day"); - - lh.addStaticHoliday ("19-JUL-2021", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("20-JUL-2021", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("21-JUL-2021", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("22-JUL-2021", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("30-AUG-2021", "Victory Day"); - - lh.addStaticHoliday ("29-OCT-2021", "Republic Day"); - - lh.addStaticHoliday ("02-MAY-2022", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("03-MAY-2022", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("19-MAY-2022", "Youth & Sports Day"); - - lh.addStaticHoliday ("08-JUL-2022", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("11-JUL-2022", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("30-AUG-2022", "Victory Day"); - - lh.addStaticHoliday ("20-APR-2023", "Ramadan Feast Day"); - - lh.addStaticHoliday ("21-APR-2023", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("19-MAY-2023", "Youth & Sports Day"); - - lh.addStaticHoliday ("27-JUN-2023", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("28-JUN-2023", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("29-JUN-2023", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("30-JUN-2023", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("30-AUG-2023", "Victory Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2024", "Ramadan Feast Day"); - - lh.addStaticHoliday ("10-APR-2024", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("11-APR-2024", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("23-APR-2024", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("17-JUN-2024", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("18-JUN-2024", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("19-JUN-2024", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("30-AUG-2024", "Victory Day"); - - lh.addStaticHoliday ("29-OCT-2024", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("31-MAR-2025", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("01-APR-2025", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("23-APR-2025", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("19-MAY-2025", "Youth & Sports Day"); - - lh.addStaticHoliday ("05-JUN-2025", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("06-JUN-2025", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("29-OCT-2025", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("19-MAR-2026", "Ramadan Feast Day"); - - lh.addStaticHoliday ("20-MAR-2026", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("23-APR-2026", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("19-MAY-2026", "Youth & Sports Day"); - - lh.addStaticHoliday ("26-MAY-2026", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("27-MAY-2026", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("28-MAY-2026", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("29-MAY-2026", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("29-OCT-2026", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("08-MAR-2027", "Ramadan Feast Day"); - - lh.addStaticHoliday ("09-MAR-2027", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("10-MAR-2027", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("23-APR-2027", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("17-MAY-2027", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("18-MAY-2027", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("19-MAY-2027", "Youth & Sports Day"); - - lh.addStaticHoliday ("30-AUG-2027", "Victory Day"); - - lh.addStaticHoliday ("29-OCT-2027", "Republic Day"); - - lh.addStaticHoliday ("28-FEB-2028", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("04-MAY-2028", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("05-MAY-2028", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("19-MAY-2028", "Youth & Sports Day"); - - lh.addStaticHoliday ("30-AUG-2028", "Victory Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/TRYHoliday.java b/org/drip/analytics/holset/TRYHoliday.java deleted file mode 100644 index 0c1a00c..0000000 --- a/org/drip/analytics/holset/TRYHoliday.java +++ /dev/null @@ -1,593 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class TRYHoliday implements org.drip.analytics.holset.LocationHoliday { - public TRYHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "TRY"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("29-JAN-1998", "Ramadan Feast Day"); - - lh.addStaticHoliday ("30-JAN-1998", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("07-APR-1998", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("08-APR-1998", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("09-APR-1998", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("10-APR-1998", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("23-APR-1998", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("19-MAY-1998", "Youth & Sports Day"); - - lh.addStaticHoliday ("29-OCT-1998", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-1999", "Ramadan Feast Day"); - - lh.addStaticHoliday ("20-JAN-1999", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("21-JAN-1999", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("29-MAR-1999", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("30-MAR-1999", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("31-MAR-1999", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("23-APR-1999", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("19-MAY-1999", "Youth & Sports Day"); - - lh.addStaticHoliday ("30-AUG-1999", "Victory Day"); - - lh.addStaticHoliday ("29-OCT-1999", "Republic Day"); - - lh.addStaticHoliday ("07-JAN-2000", "Ramadan Feast Day"); - - lh.addStaticHoliday ("10-JAN-2000", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("16-MAR-2000", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("17-MAR-2000", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("19-MAY-2000", "Youth & Sports Day"); - - lh.addStaticHoliday ("30-AUG-2000", "Victory Day"); - - lh.addStaticHoliday ("27-DEC-2000", "Ramadan Feast Day"); - - lh.addStaticHoliday ("28-DEC-2000", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("29-DEC-2000", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("05-MAR-2001", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("06-MAR-2001", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("07-MAR-2001", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("08-MAR-2001", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("23-APR-2001", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("30-AUG-2001", "Victory Day"); - - lh.addStaticHoliday ("29-OCT-2001", "Republic Day"); - - lh.addStaticHoliday ("17-DEC-2001", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("22-FEB-2002", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("25-FEB-2002", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("23-APR-2002", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("30-AUG-2002", "Victory Day"); - - lh.addStaticHoliday ("29-OCT-2002", "Republic Day"); - - lh.addStaticHoliday ("05-DEC-2002", "Ramadan Feast Day"); - - lh.addStaticHoliday ("06-DEC-2002", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2003", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("12-FEB-2003", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("13-FEB-2003", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("14-FEB-2003", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("23-APR-2003", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("19-MAY-2003", "Youth & Sports Day"); - - lh.addStaticHoliday ("29-OCT-2003", "Republic Day"); - - lh.addStaticHoliday ("24-NOV-2003", "Ramadan Feast Day"); - - lh.addStaticHoliday ("25-NOV-2003", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("26-NOV-2003", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("02-FEB-2004", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("03-FEB-2004", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("23-APR-2004", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("19-MAY-2004", "Youth & Sports Day"); - - lh.addStaticHoliday ("30-AUG-2004", "Victory Day"); - - lh.addStaticHoliday ("29-OCT-2004", "Republic Day"); - - lh.addStaticHoliday ("15-NOV-2004", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("20-JAN-2005", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("21-JAN-2005", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("19-MAY-2005", "Youth & Sports Day"); - - lh.addStaticHoliday ("30-AUG-2005", "Victory Day"); - - lh.addStaticHoliday ("02-NOV-2005", "Ramadan Feast Day"); - - lh.addStaticHoliday ("03-NOV-2005", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("04-NOV-2005", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("09-JAN-2006", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("10-JAN-2006", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("11-JAN-2006", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("12-JAN-2006", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("19-MAY-2006", "Youth & Sports Day"); - - lh.addStaticHoliday ("30-AUG-2006", "Victory Day"); - - lh.addStaticHoliday ("23-OCT-2006", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("24-OCT-2006", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2007", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("23-APR-2007", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("30-AUG-2007", "Victory Day"); - - lh.addStaticHoliday ("11-OCT-2007", "Ramadan Feast Day"); - - lh.addStaticHoliday ("12-OCT-2007", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("29-OCT-2007", "Republic Day"); - - lh.addStaticHoliday ("19-DEC-2007", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("20-DEC-2007", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("21-DEC-2007", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("23-APR-2008", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("19-MAY-2008", "Youth & Sports Day"); - - lh.addStaticHoliday ("30-SEP-2008", "Ramadan Feast Day"); - - lh.addStaticHoliday ("01-OCT-2008", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("02-OCT-2008", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("29-OCT-2008", "Republic Day"); - - lh.addStaticHoliday ("08-DEC-2008", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("09-DEC-2008", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("10-DEC-2008", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("23-APR-2009", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("19-MAY-2009", "Youth & Sports Day"); - - lh.addStaticHoliday ("21-SEP-2009", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("29-OCT-2009", "Republic Day"); - - lh.addStaticHoliday ("26-NOV-2009", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("27-NOV-2009", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("23-APR-2010", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("19-MAY-2010", "Youth & Sports Day"); - - lh.addStaticHoliday ("30-AUG-2010", "Victory Day"); - - lh.addStaticHoliday ("09-SEP-2010", "Ramadan Feast Day"); - - lh.addStaticHoliday ("10-SEP-2010", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("29-OCT-2010", "Republic Day"); - - lh.addStaticHoliday ("16-NOV-2010", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("17-NOV-2010", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("18-NOV-2010", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("19-NOV-2010", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("19-MAY-2011", "Youth & Sports Day"); - - lh.addStaticHoliday ("29-AUG-2011", "Ramadan Feast Day"); - - lh.addStaticHoliday ("30-AUG-2011", "Victory Day"); - - lh.addStaticHoliday ("31-AUG-2011", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("07-NOV-2011", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("08-NOV-2011", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("23-APR-2012", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("20-AUG-2012", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("30-AUG-2012", "Victory Day"); - - lh.addStaticHoliday ("25-OCT-2012", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("26-OCT-2012", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("29-OCT-2012", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("23-APR-2013", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("07-AUG-2013", "Ramadan Feast Day"); - - lh.addStaticHoliday ("08-AUG-2013", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("09-AUG-2013", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("30-AUG-2013", "Victory Day"); - - lh.addStaticHoliday ("14-OCT-2013", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("15-OCT-2013", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("16-OCT-2013", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("17-OCT-2013", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("29-OCT-2013", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("23-APR-2014", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("19-MAY-2014", "Youth & Sports Day"); - - lh.addStaticHoliday ("28-JUL-2014", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("03-OCT-2014", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("06-OCT-2014", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("29-OCT-2014", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("23-APR-2015", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("19-MAY-2015", "Youth & Sports Day"); - - lh.addStaticHoliday ("16-JUL-2015", "Ramadan Feast Day"); - - lh.addStaticHoliday ("17-JUL-2015", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("23-SEP-2015", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("24-SEP-2015", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("25-SEP-2015", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("29-OCT-2015", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("19-MAY-2016", "Youth & Sports Day"); - - lh.addStaticHoliday ("05-JUL-2016", "Ramadan Feast Day"); - - lh.addStaticHoliday ("06-JUL-2016", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("07-JUL-2016", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("30-AUG-2016", "Victory Day"); - - lh.addStaticHoliday ("12-SEP-2016", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("13-SEP-2016", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("14-SEP-2016", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("19-MAY-2017", "Youth & Sports Day"); - - lh.addStaticHoliday ("26-JUN-2017", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("30-AUG-2017", "Victory Day"); - - lh.addStaticHoliday ("31-AUG-2017", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("01-SEP-2017", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("23-APR-2018", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("14-JUN-2018", "Ramadan Feast Day"); - - lh.addStaticHoliday ("15-JUN-2018", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("21-AUG-2018", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("22-AUG-2018", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("23-AUG-2018", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("24-AUG-2018", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("30-AUG-2018", "Victory Day"); - - lh.addStaticHoliday ("29-OCT-2018", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("23-APR-2019", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("04-JUN-2019", "Ramadan Feast Day"); - - lh.addStaticHoliday ("05-JUN-2019", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("06-JUN-2019", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("12-AUG-2019", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("13-AUG-2019", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("30-AUG-2019", "Victory Day"); - - lh.addStaticHoliday ("29-OCT-2019", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("23-APR-2020", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("19-MAY-2020", "Youth & Sports Day"); - - lh.addStaticHoliday ("25-MAY-2020", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("30-JUL-2020", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("31-JUL-2020", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("29-OCT-2020", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("23-APR-2021", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("12-MAY-2021", "Ramadan Feast Day"); - - lh.addStaticHoliday ("13-MAY-2021", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("14-MAY-2021", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("19-MAY-2021", "Youth & Sports Day"); - - lh.addStaticHoliday ("19-JUL-2021", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("20-JUL-2021", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("21-JUL-2021", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("22-JUL-2021", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("30-AUG-2021", "Victory Day"); - - lh.addStaticHoliday ("29-OCT-2021", "Republic Day"); - - lh.addStaticHoliday ("02-MAY-2022", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("03-MAY-2022", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("19-MAY-2022", "Youth & Sports Day"); - - lh.addStaticHoliday ("08-JUL-2022", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("11-JUL-2022", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("30-AUG-2022", "Victory Day"); - - lh.addStaticHoliday ("20-APR-2023", "Ramadan Feast Day"); - - lh.addStaticHoliday ("21-APR-2023", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("19-MAY-2023", "Youth & Sports Day"); - - lh.addStaticHoliday ("27-JUN-2023", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("28-JUN-2023", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("29-JUN-2023", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("30-JUN-2023", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("30-AUG-2023", "Victory Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2024", "Ramadan Feast Day"); - - lh.addStaticHoliday ("10-APR-2024", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("11-APR-2024", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("23-APR-2024", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("17-JUN-2024", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("18-JUN-2024", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("19-JUN-2024", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("30-AUG-2024", "Victory Day"); - - lh.addStaticHoliday ("29-OCT-2024", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("31-MAR-2025", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("01-APR-2025", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("23-APR-2025", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("19-MAY-2025", "Youth & Sports Day"); - - lh.addStaticHoliday ("05-JUN-2025", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("06-JUN-2025", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("29-OCT-2025", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("19-MAR-2026", "Ramadan Feast Day"); - - lh.addStaticHoliday ("20-MAR-2026", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("23-APR-2026", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("19-MAY-2026", "Youth & Sports Day"); - - lh.addStaticHoliday ("26-MAY-2026", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("27-MAY-2026", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("28-MAY-2026", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("29-MAY-2026", "Fourth Day of Sacrifice Feast"); - - lh.addStaticHoliday ("29-OCT-2026", "Republic Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("08-MAR-2027", "Ramadan Feast Day"); - - lh.addStaticHoliday ("09-MAR-2027", "Second Day of Ramadan Feast"); - - lh.addStaticHoliday ("10-MAR-2027", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("23-APR-2027", "National Sovereignty and Childrens Day"); - - lh.addStaticHoliday ("17-MAY-2027", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("18-MAY-2027", "Third Day of Sacrifice Feast"); - - lh.addStaticHoliday ("19-MAY-2027", "Youth & Sports Day"); - - lh.addStaticHoliday ("30-AUG-2027", "Victory Day"); - - lh.addStaticHoliday ("29-OCT-2027", "Republic Day"); - - lh.addStaticHoliday ("28-FEB-2028", "Third Day of Ramadan Feast"); - - lh.addStaticHoliday ("04-MAY-2028", "Sacrifice Feast Day"); - - lh.addStaticHoliday ("05-MAY-2028", "Second Day of Sacrifice Feast"); - - lh.addStaticHoliday ("19-MAY-2028", "Youth & Sports Day"); - - lh.addStaticHoliday ("30-AUG-2028", "Victory Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/TWDHoliday.java b/org/drip/analytics/holset/TWDHoliday.java deleted file mode 100644 index f906d13..0000000 --- a/org/drip/analytics/holset/TWDHoliday.java +++ /dev/null @@ -1,1501 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class TWDHoliday implements org.drip.analytics.holset.LocationHoliday { - public TWDHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "TWD"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-1999", "Bank Holiday"); - - lh.addStaticHoliday ("04-JAN-1999", "Bank Holiday Observed"); - - lh.addStaticHoliday ("15-FEB-1999", "Lunar New Years Eve"); - - lh.addStaticHoliday ("16-FEB-1999", "Lunar New Years Day"); - - lh.addStaticHoliday ("17-FEB-1999", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("18-FEB-1999", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("05-APR-1999", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-1999", "May Day"); - - lh.addStaticHoliday ("18-JUN-1999", "Dragon Boat Festival"); - - lh.addStaticHoliday ("19-JUN-1999", "Bridging Day"); - - lh.addStaticHoliday ("01-JUL-1999", "Bank Holiday"); - - lh.addStaticHoliday ("24-SEP-1999", "Moon Festival Day"); - - lh.addStaticHoliday ("12-NOV-1999", "Sun Yat-Sens Birthday"); - - lh.addStaticHoliday ("31-DEC-1999", "Special Holiday"); - - lh.addStaticHoliday ("01-JAN-2000", "New Years Day"); - - lh.addStaticHoliday ("03-JAN-2000", "Bank Holiday Observed"); - - lh.addStaticHoliday ("04-FEB-2000", "Lunar New Years Eve"); - - lh.addStaticHoliday ("05-FEB-2000", "Lunar New Years Day"); - - lh.addStaticHoliday ("07-FEB-2000", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("28-FEB-2000", "Memorial Day"); - - lh.addStaticHoliday ("18-MAR-2000", "Election Day"); - - lh.addStaticHoliday ("03-APR-2000", "Childrens Day"); - - lh.addStaticHoliday ("04-APR-2000", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2000", "May Day"); - - lh.addStaticHoliday ("06-JUN-2000", "Dragon Boat Festival"); - - lh.addStaticHoliday ("01-JUL-2000", "Bank Holiday"); - - lh.addStaticHoliday ("23-AUG-2000", "TYPHOON-OFFICE CLOSE"); - - lh.addStaticHoliday ("12-SEP-2000", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2000", "National Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Constitution Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("22-JAN-2001", "Bridging Day"); - - lh.addStaticHoliday ("23-JAN-2001", "Lunar New Years Eve"); - - lh.addStaticHoliday ("24-JAN-2001", "Lunar New Years Day"); - - lh.addStaticHoliday ("25-JAN-2001", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("26-JAN-2001", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("28-FEB-2001", "Memorial Day"); - - lh.addStaticHoliday ("05-APR-2001", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2001", "May Day"); - - lh.addStaticHoliday ("25-JUN-2001", "Dragon Boat Festival"); - - lh.addStaticHoliday ("30-JUL-2001", "TYPHOON-OFFICE CLOSE"); - - lh.addStaticHoliday ("17-SEP-2001", "TYPHOON-OFFICE CLOSE"); - - lh.addStaticHoliday ("18-SEP-2001", "TYPHOON-OFFICE CLOSE"); - - lh.addStaticHoliday ("01-OCT-2001", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2001", "National Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2002", "Lunar New Years Eve"); - - lh.addStaticHoliday ("12-FEB-2002", "Lunar New Years Day"); - - lh.addStaticHoliday ("13-FEB-2002", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("14-FEB-2002", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("28-FEB-2002", "MEMORIAL DAY"); - - lh.addStaticHoliday ("02-MAR-2002", "Special Holiday"); - - lh.addStaticHoliday ("05-APR-2002", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2002", "LABOR DAY"); - - lh.addStaticHoliday ("10-OCT-2002", "National Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("31-JAN-2003", "Lunar New Years Eve"); - - lh.addStaticHoliday ("03-FEB-2003", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("04-FEB-2003", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("05-FEB-2003", "Chinese New Year Holiday Period"); - - lh.addStaticHoliday ("28-FEB-2003", "Special Holiday"); - - lh.addStaticHoliday ("01-MAY-2003", "May Day"); - - lh.addStaticHoliday ("04-JUN-2003", "Dragon Boat Festival"); - - lh.addStaticHoliday ("11-SEP-2003", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2003", "National Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2004", "Lunar New Years Eve"); - - lh.addStaticHoliday ("22-JAN-2004", "Lunar New Years Day"); - - lh.addStaticHoliday ("23-JAN-2004", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("26-JAN-2004", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("22-JUN-2004", "Dragon Boat Festival"); - - lh.addStaticHoliday ("24-AUG-2004", "Special Holiday"); - - lh.addStaticHoliday ("25-AUG-2004", "Special Holiday"); - - lh.addStaticHoliday ("28-SEP-2004", "Moon Festival Day"); - - lh.addStaticHoliday ("25-OCT-2004", "Special Holiday"); - - lh.addStaticHoliday ("07-FEB-2005", "Bridging Day"); - - lh.addStaticHoliday ("08-FEB-2005", "Lunar New Years Eve"); - - lh.addStaticHoliday ("09-FEB-2005", "Lunar New Years Day"); - - lh.addStaticHoliday ("10-FEB-2005", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("11-FEB-2005", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("28-FEB-2005", "Memorial Day"); - - lh.addStaticHoliday ("05-APR-2005", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("02-MAY-2005", "Labor Day Observed"); - - lh.addStaticHoliday ("18-JUL-2005", "Special Holiday"); - - lh.addStaticHoliday ("05-AUG-2005", "Special Holiday"); - - lh.addStaticHoliday ("01-SEP-2005", "Special Holiday"); - - lh.addStaticHoliday ("10-OCT-2005", "National Day"); - - lh.addStaticHoliday ("28-JAN-2006", "Lunar New Years Eve Observed"); - - lh.addStaticHoliday ("29-JAN-2006", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("30-JAN-2006", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("31-JAN-2006", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("01-FEB-2006", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("02-FEB-2006", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("28-FEB-2006", "Memorial Day"); - - lh.addStaticHoliday ("05-APR-2006", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2006", "Labor Day Observed"); - - lh.addStaticHoliday ("31-MAY-2006", "Dragon Boat Festival"); - - lh.addStaticHoliday ("06-OCT-2006", "Moon Festival Day"); - - lh.addStaticHoliday ("09-OCT-2006", "Bank Holiday"); - - lh.addStaticHoliday ("10-OCT-2006", "National Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("19-FEB-2007", "Lunar New Years Eve Observed"); - - lh.addStaticHoliday ("20-FEB-2007", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("21-FEB-2007", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("22-FEB-2007", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("23-FEB-2007", "Bridging Day"); - - lh.addStaticHoliday ("28-FEB-2007", "Memorial Day"); - - lh.addStaticHoliday ("05-APR-2007", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("06-APR-2007", "Bridging Day"); - - lh.addStaticHoliday ("01-MAY-2007", "May Day"); - - lh.addStaticHoliday ("18-JUN-2007", "Bridging Day"); - - lh.addStaticHoliday ("19-JUN-2007", "Dragon Boat Festival"); - - lh.addStaticHoliday ("18-SEP-2007", "Special Holiday"); - - lh.addStaticHoliday ("24-SEP-2007", "Bridging Day"); - - lh.addStaticHoliday ("25-SEP-2007", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2007", "National Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("06-FEB-2008", "Lunar New Years Eve"); - - lh.addStaticHoliday ("07-FEB-2008", "Lunar New Years Day"); - - lh.addStaticHoliday ("08-FEB-2008", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("11-FEB-2008", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("28-FEB-2008", "Memorial Day"); - - lh.addStaticHoliday ("04-APR-2008", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2008", "May Day"); - - lh.addStaticHoliday ("28-JUL-2008", "Special Holiday"); - - lh.addStaticHoliday ("29-SEP-2008", "Special Holiday"); - - lh.addStaticHoliday ("10-OCT-2008", "National Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("02-JAN-2009", "Bridging Day"); - - lh.addStaticHoliday ("26-JAN-2009", "Lunar New Years Eve Observed"); - - lh.addStaticHoliday ("27-JAN-2009", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("28-JAN-2009", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("29-JAN-2009", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("30-JAN-2009", "Bridging Day"); - - lh.addStaticHoliday ("01-MAY-2009", "May Day"); - - lh.addStaticHoliday ("28-MAY-2009", "Dragon Boat Festival"); - - lh.addStaticHoliday ("29-MAY-2009", "Dragon Boat Festival"); - - lh.addStaticHoliday ("07-AUG-2009", "Special Holiday"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("13-FEB-2010", "Chinese New Year"); - - lh.addStaticHoliday ("14-FEB-2010", "Chinese New Year"); - - lh.addStaticHoliday ("15-FEB-2010", "Lunar New Years Eve Observed"); - - lh.addStaticHoliday ("16-FEB-2010", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("17-FEB-2010", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("18-FEB-2010", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("19-FEB-2010", "Bridging Day"); - - lh.addStaticHoliday ("28-FEB-2010", "Peace Day"); - - lh.addStaticHoliday ("05-APR-2010", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2010", "Labour Day"); - - lh.addStaticHoliday ("16-JUN-2010", "Dragon Boat Festival"); - - lh.addStaticHoliday ("22-SEP-2010", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2010", "National Day"); - - lh.addStaticHoliday ("02-FEB-2011", "Lunar New Years Eve"); - - lh.addStaticHoliday ("03-FEB-2011", "Lunar New Years Day"); - - lh.addStaticHoliday ("04-FEB-2011", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("07-FEB-2011", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("28-FEB-2011", "Memorial Day"); - - lh.addStaticHoliday ("04-APR-2011", "Childrens Day"); - - lh.addStaticHoliday ("05-APR-2011", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("02-MAY-2011", "May Day Observed"); - - lh.addStaticHoliday ("06-JUN-2011", "Dragon Boat Festival"); - - lh.addStaticHoliday ("12-SEP-2011", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2011", "National Day"); - - lh.addStaticHoliday ("23-JAN-2012", "Lunar New Years Eve Observed"); - - lh.addStaticHoliday ("24-JAN-2012", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("25-JAN-2012", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("26-JAN-2012", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("27-JAN-2012", "Bridging Day"); - - lh.addStaticHoliday ("28-FEB-2012", "Memorial Day"); - - lh.addStaticHoliday ("03-APR-2012", "Childrens Day"); - - lh.addStaticHoliday ("04-APR-2012", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2012", "May Day"); - - lh.addStaticHoliday ("10-OCT-2012", "National Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2013", "Lunar New Years Eve Observed"); - - lh.addStaticHoliday ("12-FEB-2013", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("13-FEB-2013", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("14-FEB-2013", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("15-FEB-2013", "Bridging Day"); - - lh.addStaticHoliday ("28-FEB-2013", "Memorial Day"); - - lh.addStaticHoliday ("03-APR-2013", "Childrens Day"); - - lh.addStaticHoliday ("04-APR-2013", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2013", "May Day"); - - lh.addStaticHoliday ("12-JUN-2013", "Dragon Boat Festival"); - - lh.addStaticHoliday ("19-SEP-2013", "Moon Festival Day"); - - lh.addStaticHoliday ("20-SEP-2013", "Bridging Day"); - - lh.addStaticHoliday ("10-OCT-2013", "National Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("30-JAN-2014", "Lunar New Years Eve"); - - lh.addStaticHoliday ("31-JAN-2014", "Lunar New Years Day"); - - lh.addStaticHoliday ("03-FEB-2014", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("04-FEB-2014", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("28-FEB-2014", "Memorial Day"); - - lh.addStaticHoliday ("04-APR-2014", "Childrens Day"); - - lh.addStaticHoliday ("01-MAY-2014", "May Day"); - - lh.addStaticHoliday ("02-JUN-2014", "Dragon Boat Festival"); - - lh.addStaticHoliday ("08-SEP-2014", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2014", "National Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("18-FEB-2015", "Lunar New Years Eve"); - - lh.addStaticHoliday ("19-FEB-2015", "Lunar New Years Day"); - - lh.addStaticHoliday ("20-FEB-2015", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("23-FEB-2015", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("01-MAY-2015", "May Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2016", "Lunar New Years Eve Observed"); - - lh.addStaticHoliday ("09-FEB-2016", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("10-FEB-2016", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("11-FEB-2016", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("12-FEB-2016", "Bridging Day"); - - lh.addStaticHoliday ("04-APR-2016", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("02-MAY-2016", "May Day Observed"); - - lh.addStaticHoliday ("09-JUN-2016", "Dragon Boat Festival"); - - lh.addStaticHoliday ("10-JUN-2016", "Bridging Day"); - - lh.addStaticHoliday ("15-SEP-2016", "Moon Festival Day"); - - lh.addStaticHoliday ("16-SEP-2016", "Bridging Day"); - - lh.addStaticHoliday ("10-OCT-2016", "National Day"); - - lh.addStaticHoliday ("27-JAN-2017", "Lunar New Years Eve"); - - lh.addStaticHoliday ("30-JAN-2017", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("31-JAN-2017", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("01-FEB-2017", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("28-FEB-2017", "Memorial Day"); - - lh.addStaticHoliday ("03-APR-2017", "Childrens Day"); - - lh.addStaticHoliday ("04-APR-2017", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2017", "May Day"); - - lh.addStaticHoliday ("29-MAY-2017", "Bridging Day"); - - lh.addStaticHoliday ("30-MAY-2017", "Dragon Boat Festival"); - - lh.addStaticHoliday ("04-OCT-2017", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2017", "National Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("15-FEB-2018", "Lunar New Years Eve"); - - lh.addStaticHoliday ("16-FEB-2018", "Lunar New Years Day"); - - lh.addStaticHoliday ("19-FEB-2018", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("20-FEB-2018", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("28-FEB-2018", "Memorial Day"); - - lh.addStaticHoliday ("04-APR-2018", "Childrens Day"); - - lh.addStaticHoliday ("05-APR-2018", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2018", "May Day"); - - lh.addStaticHoliday ("18-JUN-2018", "Dragon Boat Festival"); - - lh.addStaticHoliday ("24-SEP-2018", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2018", "National Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("04-FEB-2019", "Lunar New Years Eve"); - - lh.addStaticHoliday ("05-FEB-2019", "Lunar New Years Day"); - - lh.addStaticHoliday ("06-FEB-2019", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("07-FEB-2019", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("28-FEB-2019", "Memorial Day"); - - lh.addStaticHoliday ("04-APR-2019", "Childrens Day"); - - lh.addStaticHoliday ("05-APR-2019", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2019", "May Day"); - - lh.addStaticHoliday ("07-JUN-2019", "Dragon Boat Festival"); - - lh.addStaticHoliday ("13-SEP-2019", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2019", "National Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("24-JAN-2020", "Lunar New Years Eve"); - - lh.addStaticHoliday ("27-JAN-2020", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("28-JAN-2020", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("29-JAN-2020", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("28-FEB-2020", "Memorial Day"); - - lh.addStaticHoliday ("03-APR-2020", "Childrens Day"); - - lh.addStaticHoliday ("01-MAY-2020", "May Day"); - - lh.addStaticHoliday ("25-JUN-2020", "Dragon Boat Festival"); - - lh.addStaticHoliday ("26-JUN-2020", "Bridging Day"); - - lh.addStaticHoliday ("01-OCT-2020", "Moon Festival Day"); - - lh.addStaticHoliday ("02-OCT-2020", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2021", "Lunar New Years Eve"); - - lh.addStaticHoliday ("12-FEB-2021", "Lunar New Years Day"); - - lh.addStaticHoliday ("15-FEB-2021", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("16-FEB-2021", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("14-JUN-2021", "Dragon Boat Festival"); - - lh.addStaticHoliday ("20-SEP-2021", "Bridging Day"); - - lh.addStaticHoliday ("21-SEP-2021", "Moon Festival Day"); - - lh.addStaticHoliday ("31-JAN-2022", "Lunar New Years Eve"); - - lh.addStaticHoliday ("01-FEB-2022", "Lunar New Years Day"); - - lh.addStaticHoliday ("02-FEB-2022", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("03-FEB-2022", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("28-FEB-2022", "Memorial Day"); - - lh.addStaticHoliday ("04-APR-2022", "Childrens Day"); - - lh.addStaticHoliday ("05-APR-2022", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("02-MAY-2022", "May Day Observed"); - - lh.addStaticHoliday ("03-JUN-2022", "Dragon Boat Festival"); - - lh.addStaticHoliday ("10-OCT-2022", "National Day"); - - lh.addStaticHoliday ("23-JAN-2023", "Lunar New Years Eve Observed"); - - lh.addStaticHoliday ("24-JAN-2023", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("25-JAN-2023", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("26-JAN-2023", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("27-JAN-2023", "Bridging Day"); - - lh.addStaticHoliday ("28-FEB-2023", "Memorial Day"); - - lh.addStaticHoliday ("04-APR-2023", "Childrens Day"); - - lh.addStaticHoliday ("05-APR-2023", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2023", "May Day"); - - lh.addStaticHoliday ("22-JUN-2023", "Dragon Boat Festival"); - - lh.addStaticHoliday ("23-JUN-2023", "Bridging Day"); - - lh.addStaticHoliday ("29-SEP-2023", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2023", "National Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("09-FEB-2024", "Lunar New Years Eve"); - - lh.addStaticHoliday ("12-FEB-2024", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("13-FEB-2024", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("14-FEB-2024", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("28-FEB-2024", "Memorial Day"); - - lh.addStaticHoliday ("03-APR-2024", "Childrens Day"); - - lh.addStaticHoliday ("04-APR-2024", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2024", "May Day"); - - lh.addStaticHoliday ("10-JUN-2024", "Dragon Boat Festival"); - - lh.addStaticHoliday ("16-SEP-2024", "Bridging Day"); - - lh.addStaticHoliday ("17-SEP-2024", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2024", "National Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("27-JAN-2025", "Bridging Day"); - - lh.addStaticHoliday ("28-JAN-2025", "Lunar New Years Eve"); - - lh.addStaticHoliday ("29-JAN-2025", "Lunar New Years Day"); - - lh.addStaticHoliday ("30-JAN-2025", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("31-JAN-2025", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("28-FEB-2025", "Memorial Day"); - - lh.addStaticHoliday ("03-APR-2025", "Childrens Day"); - - lh.addStaticHoliday ("04-APR-2025", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2025", "May Day"); - - lh.addStaticHoliday ("06-OCT-2025", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2025", "National Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2026", "Lunar New Years Eve"); - - lh.addStaticHoliday ("17-FEB-2026", "Lunar New Years Day"); - - lh.addStaticHoliday ("18-FEB-2026", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("19-FEB-2026", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAY-2026", "May Day"); - - lh.addStaticHoliday ("19-JUN-2026", "Dragon Boat Festival"); - - lh.addStaticHoliday ("25-SEP-2026", "Moon Festival Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2027", "Lunar New Years Eve"); - - lh.addStaticHoliday ("08-FEB-2027", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("09-FEB-2027", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("10-FEB-2027", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("05-APR-2027", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("09-JUN-2027", "Dragon Boat Festival"); - - lh.addStaticHoliday ("15-SEP-2027", "Moon Festival Day"); - - lh.addStaticHoliday ("24-JAN-2028", "Bridging Day"); - - lh.addStaticHoliday ("25-JAN-2028", "Lunar New Years Eve"); - - lh.addStaticHoliday ("26-JAN-2028", "Lunar New Years Day"); - - lh.addStaticHoliday ("27-JAN-2028", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("28-JAN-2028", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("28-FEB-2028", "Memorial Day"); - - lh.addStaticHoliday ("03-APR-2028", "Childrens Day"); - - lh.addStaticHoliday ("04-APR-2028", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2028", "May Day"); - - lh.addStaticHoliday ("02-OCT-2028", "Bridging Day"); - - lh.addStaticHoliday ("03-OCT-2028", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2028", "National Day"); - - lh.addStaticHoliday ("01-JAN-2029", "New Years Day"); - - lh.addStaticHoliday ("12-FEB-2029", "Lunar New Years Eve"); - - lh.addStaticHoliday ("13-FEB-2029", "Lunar New Years Day"); - - lh.addStaticHoliday ("14-FEB-2029", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("15-FEB-2029", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("28-FEB-2029", "Memorial Day"); - - lh.addStaticHoliday ("03-APR-2029", "Childrens Day"); - - lh.addStaticHoliday ("04-APR-2029", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2029", "May Day"); - - lh.addStaticHoliday ("10-OCT-2029", "National Day"); - - lh.addStaticHoliday ("01-JAN-2030", "New Years Day"); - - lh.addStaticHoliday ("04-FEB-2030", "Lunar New Years Eve Observed"); - - lh.addStaticHoliday ("05-FEB-2030", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("06-FEB-2030", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("07-FEB-2030", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("08-FEB-2030", "Bridging Day"); - - lh.addStaticHoliday ("28-FEB-2030", "Memorial Day"); - - lh.addStaticHoliday ("04-APR-2030", "Childrens Day"); - - lh.addStaticHoliday ("05-APR-2030", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2030", "May Day"); - - lh.addStaticHoliday ("05-JUN-2030", "Dragon Boat Festival"); - - lh.addStaticHoliday ("12-SEP-2030", "Moon Festival Day"); - - lh.addStaticHoliday ("13-SEP-2030", "Bridging Day"); - - lh.addStaticHoliday ("10-OCT-2030", "National Day"); - - lh.addStaticHoliday ("01-JAN-2031", "New Years Day"); - - lh.addStaticHoliday ("22-JAN-2031", "Lunar New Years Eve"); - - lh.addStaticHoliday ("23-JAN-2031", "Lunar New Years Day"); - - lh.addStaticHoliday ("24-JAN-2031", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("27-JAN-2031", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("28-FEB-2031", "Memorial Day"); - - lh.addStaticHoliday ("04-APR-2031", "Childrens Day"); - - lh.addStaticHoliday ("01-MAY-2031", "May Day"); - - lh.addStaticHoliday ("23-JUN-2031", "Bridging Day"); - - lh.addStaticHoliday ("24-JUN-2031", "Dragon Boat Festival"); - - lh.addStaticHoliday ("01-OCT-2031", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2031", "National Day"); - - lh.addStaticHoliday ("01-JAN-2032", "New Years Day"); - - lh.addStaticHoliday ("09-FEB-2032", "Bridging Day"); - - lh.addStaticHoliday ("10-FEB-2032", "Lunar New Years Eve"); - - lh.addStaticHoliday ("11-FEB-2032", "Lunar New Years Day"); - - lh.addStaticHoliday ("12-FEB-2032", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("13-FEB-2032", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("31-JAN-2033", "Lunar New Years Eve Observed"); - - lh.addStaticHoliday ("01-FEB-2033", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("02-FEB-2033", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("03-FEB-2033", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("04-FEB-2033", "Bridging Day"); - - lh.addStaticHoliday ("28-FEB-2033", "Memorial Day"); - - lh.addStaticHoliday ("04-APR-2033", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("02-MAY-2033", "May Day Observed"); - - lh.addStaticHoliday ("01-JUN-2033", "Dragon Boat Festival"); - - lh.addStaticHoliday ("08-SEP-2033", "Moon Festival Day"); - - lh.addStaticHoliday ("09-SEP-2033", "Bridging Day"); - - lh.addStaticHoliday ("10-OCT-2033", "National Day"); - - lh.addStaticHoliday ("20-FEB-2034", "Lunar New Years Eve Observed"); - - lh.addStaticHoliday ("21-FEB-2034", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("22-FEB-2034", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("23-FEB-2034", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("24-FEB-2034", "Bridging Day"); - - lh.addStaticHoliday ("28-FEB-2034", "Memorial Day"); - - lh.addStaticHoliday ("04-APR-2034", "Childrens Day"); - - lh.addStaticHoliday ("05-APR-2034", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2034", "May Day"); - - lh.addStaticHoliday ("19-JUN-2034", "Bridging Day"); - - lh.addStaticHoliday ("20-JUN-2034", "Dragon Boat Festival"); - - lh.addStaticHoliday ("27-SEP-2034", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2034", "National Day"); - - lh.addStaticHoliday ("01-JAN-2035", "New Years Day"); - - lh.addStaticHoliday ("07-FEB-2035", "Lunar New Years Eve"); - - lh.addStaticHoliday ("08-FEB-2035", "Lunar New Years Day"); - - lh.addStaticHoliday ("09-FEB-2035", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("12-FEB-2035", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("28-FEB-2035", "Memorial Day"); - - lh.addStaticHoliday ("04-APR-2035", "Childrens Day"); - - lh.addStaticHoliday ("05-APR-2035", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2035", "May Day"); - - lh.addStaticHoliday ("10-OCT-2035", "National Day"); - - lh.addStaticHoliday ("01-JAN-2036", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-2036", "Lunar New Years Eve Observed"); - - lh.addStaticHoliday ("29-JAN-2036", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("30-JAN-2036", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("31-JAN-2036", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("01-FEB-2036", "Bridging Day"); - - lh.addStaticHoliday ("28-FEB-2036", "Memorial Day"); - - lh.addStaticHoliday ("03-APR-2036", "Childrens Day"); - - lh.addStaticHoliday ("04-APR-2036", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2036", "May Day"); - - lh.addStaticHoliday ("30-MAY-2036", "Dragon Boat Festival"); - - lh.addStaticHoliday ("10-OCT-2036", "National Day"); - - lh.addStaticHoliday ("01-JAN-2037", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2037", "Lunar New Years Eve Observed"); - - lh.addStaticHoliday ("17-FEB-2037", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("18-FEB-2037", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("19-FEB-2037", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("20-FEB-2037", "Bridging Day"); - - lh.addStaticHoliday ("03-APR-2037", "Childrens Day"); - - lh.addStaticHoliday ("01-MAY-2037", "May Day"); - - lh.addStaticHoliday ("18-JUN-2037", "Dragon Boat Festival"); - - lh.addStaticHoliday ("19-JUN-2037", "Bridging Day"); - - lh.addStaticHoliday ("24-SEP-2037", "Moon Festival Day"); - - lh.addStaticHoliday ("25-SEP-2037", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2038", "New Years Day"); - - lh.addStaticHoliday ("03-FEB-2038", "Lunar New Years Eve"); - - lh.addStaticHoliday ("04-FEB-2038", "Lunar New Years Day"); - - lh.addStaticHoliday ("05-FEB-2038", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("08-FEB-2038", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("05-APR-2038", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("07-JUN-2038", "Dragon Boat Festival"); - - lh.addStaticHoliday ("13-SEP-2038", "Moon Festival Day"); - - lh.addStaticHoliday ("24-JAN-2039", "Lunar New Years Eve Observed"); - - lh.addStaticHoliday ("25-JAN-2039", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("26-JAN-2039", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("27-JAN-2039", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("28-JAN-2039", "Bridging Day"); - - lh.addStaticHoliday ("28-FEB-2039", "Memorial Day"); - - lh.addStaticHoliday ("04-APR-2039", "Childrens Day"); - - lh.addStaticHoliday ("05-APR-2039", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("02-MAY-2039", "May Day Observed"); - - lh.addStaticHoliday ("27-MAY-2039", "Dragon Boat Festival"); - - lh.addStaticHoliday ("10-OCT-2039", "National Day"); - - lh.addStaticHoliday ("13-FEB-2040", "Lunar New Years Eve Observed"); - - lh.addStaticHoliday ("14-FEB-2040", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("15-FEB-2040", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("16-FEB-2040", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("17-FEB-2040", "Bridging Day"); - - lh.addStaticHoliday ("28-FEB-2040", "Memorial Day"); - - lh.addStaticHoliday ("03-APR-2040", "Childrens Day"); - - lh.addStaticHoliday ("04-APR-2040", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2040", "May Day"); - - lh.addStaticHoliday ("14-JUN-2040", "Dragon Boat Festival"); - - lh.addStaticHoliday ("15-JUN-2040", "Bridging Day"); - - lh.addStaticHoliday ("20-SEP-2040", "Moon Festival Day"); - - lh.addStaticHoliday ("21-SEP-2040", "Bridging Day"); - - lh.addStaticHoliday ("10-OCT-2040", "National Day"); - - lh.addStaticHoliday ("01-JAN-2041", "New Years Day"); - - lh.addStaticHoliday ("31-JAN-2041", "Lunar New Years Eve"); - - lh.addStaticHoliday ("01-FEB-2041", "Lunar New Years Day"); - - lh.addStaticHoliday ("04-FEB-2041", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("05-FEB-2041", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("28-FEB-2041", "Memorial Day"); - - lh.addStaticHoliday ("03-APR-2041", "Childrens Day"); - - lh.addStaticHoliday ("04-APR-2041", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2041", "May Day"); - - lh.addStaticHoliday ("03-JUN-2041", "Dragon Boat Festival"); - - lh.addStaticHoliday ("09-SEP-2041", "Bridging Day"); - - lh.addStaticHoliday ("10-SEP-2041", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2041", "National Day"); - - lh.addStaticHoliday ("01-JAN-2042", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2042", "Bridging Day"); - - lh.addStaticHoliday ("21-JAN-2042", "Lunar New Years Eve"); - - lh.addStaticHoliday ("22-JAN-2042", "Lunar New Years Day"); - - lh.addStaticHoliday ("23-JAN-2042", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("24-JAN-2042", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("28-FEB-2042", "Memorial Day"); - - lh.addStaticHoliday ("03-APR-2042", "Childrens Day"); - - lh.addStaticHoliday ("04-APR-2042", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2042", "May Day"); - - lh.addStaticHoliday ("10-OCT-2042", "National Day"); - - lh.addStaticHoliday ("01-JAN-2043", "New Years Day"); - - lh.addStaticHoliday ("09-FEB-2043", "Lunar New Years Eve"); - - lh.addStaticHoliday ("10-FEB-2043", "Lunar New Years Day"); - - lh.addStaticHoliday ("11-FEB-2043", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("12-FEB-2043", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAY-2043", "May Day"); - - lh.addStaticHoliday ("11-JUN-2043", "Dragon Boat Festival"); - - lh.addStaticHoliday ("12-JUN-2043", "Bridging Day"); - - lh.addStaticHoliday ("17-SEP-2043", "Moon Festival Day"); - - lh.addStaticHoliday ("18-SEP-2043", "Bridging Day"); - - lh.addStaticHoliday ("01-JAN-2044", "New Years Day"); - - lh.addStaticHoliday ("29-JAN-2044", "Lunar New Years Eve"); - - lh.addStaticHoliday ("01-FEB-2044", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("02-FEB-2044", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("03-FEB-2044", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("04-APR-2044", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("02-MAY-2044", "May Day Observed"); - - lh.addStaticHoliday ("30-MAY-2044", "Bridging Day"); - - lh.addStaticHoliday ("31-MAY-2044", "Dragon Boat Festival"); - - lh.addStaticHoliday ("05-OCT-2044", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2044", "National Day"); - - lh.addStaticHoliday ("16-FEB-2045", "Lunar New Years Eve"); - - lh.addStaticHoliday ("17-FEB-2045", "Lunar New Years Day"); - - lh.addStaticHoliday ("20-FEB-2045", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("21-FEB-2045", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("28-FEB-2045", "Memorial Day"); - - lh.addStaticHoliday ("03-APR-2045", "Childrens Day"); - - lh.addStaticHoliday ("04-APR-2045", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2045", "May Day"); - - lh.addStaticHoliday ("19-JUN-2045", "Dragon Boat Festival"); - - lh.addStaticHoliday ("25-SEP-2045", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2045", "National Day"); - - lh.addStaticHoliday ("01-JAN-2046", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2046", "Lunar New Years Eve"); - - lh.addStaticHoliday ("06-FEB-2046", "Lunar New Years Day"); - - lh.addStaticHoliday ("07-FEB-2046", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("08-FEB-2046", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("28-FEB-2046", "Memorial Day"); - - lh.addStaticHoliday ("03-APR-2046", "Childrens Day"); - - lh.addStaticHoliday ("04-APR-2046", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2046", "May Day"); - - lh.addStaticHoliday ("08-JUN-2046", "Dragon Boat Festival"); - - lh.addStaticHoliday ("10-OCT-2046", "National Day"); - - lh.addStaticHoliday ("01-JAN-2047", "New Years Day"); - - lh.addStaticHoliday ("25-JAN-2047", "Lunar New Years Eve"); - - lh.addStaticHoliday ("28-JAN-2047", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("29-JAN-2047", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("30-JAN-2047", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("28-FEB-2047", "Memorial Day"); - - lh.addStaticHoliday ("04-APR-2047", "Childrens Day"); - - lh.addStaticHoliday ("05-APR-2047", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2047", "May Day"); - - lh.addStaticHoliday ("29-MAY-2047", "Dragon Boat Festival"); - - lh.addStaticHoliday ("04-OCT-2047", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2047", "National Day"); - - lh.addStaticHoliday ("01-JAN-2048", "New Years Day"); - - lh.addStaticHoliday ("13-FEB-2048", "Lunar New Years Eve"); - - lh.addStaticHoliday ("14-FEB-2048", "Lunar New Years Day"); - - lh.addStaticHoliday ("17-FEB-2048", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("18-FEB-2048", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("28-FEB-2048", "Memorial Day"); - - lh.addStaticHoliday ("03-APR-2048", "Childrens Day"); - - lh.addStaticHoliday ("01-MAY-2048", "May Day"); - - lh.addStaticHoliday ("15-JUN-2048", "Dragon Boat Festival"); - - lh.addStaticHoliday ("21-SEP-2048", "Bridging Day"); - - lh.addStaticHoliday ("22-SEP-2048", "Moon Festival Day"); - - lh.addStaticHoliday ("01-JAN-2049", "New Years Day"); - - lh.addStaticHoliday ("01-FEB-2049", "Lunar New Years Eve"); - - lh.addStaticHoliday ("02-FEB-2049", "Lunar New Years Day"); - - lh.addStaticHoliday ("03-FEB-2049", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("04-FEB-2049", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("04-JUN-2049", "Dragon Boat Festival"); - - lh.addStaticHoliday ("24-JAN-2050", "Lunar New Years Eve Observed"); - - lh.addStaticHoliday ("25-JAN-2050", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("26-JAN-2050", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("27-JAN-2050", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("28-JAN-2050", "Bridging Day"); - - lh.addStaticHoliday ("28-FEB-2050", "Memorial Day"); - - lh.addStaticHoliday ("04-APR-2050", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("02-MAY-2050", "May Day Observed"); - - lh.addStaticHoliday ("23-JUN-2050", "Dragon Boat Festival"); - - lh.addStaticHoliday ("24-JUN-2050", "Bridging Day"); - - lh.addStaticHoliday ("30-SEP-2050", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2050", "National Day"); - - lh.addStaticHoliday ("10-FEB-2051", "Lunar New Years Eve"); - - lh.addStaticHoliday ("13-FEB-2051", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("14-FEB-2051", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("15-FEB-2051", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("28-FEB-2051", "Memorial Day"); - - lh.addStaticHoliday ("04-APR-2051", "Childrens Day"); - - lh.addStaticHoliday ("05-APR-2051", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2051", "May Day"); - - lh.addStaticHoliday ("12-JUN-2051", "Bridging Day"); - - lh.addStaticHoliday ("13-JUN-2051", "Dragon Boat Festival"); - - lh.addStaticHoliday ("18-SEP-2051", "Bridging Day"); - - lh.addStaticHoliday ("19-SEP-2051", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2051", "National Day"); - - lh.addStaticHoliday ("01-JAN-2052", "New Years Day"); - - lh.addStaticHoliday ("31-JAN-2052", "Lunar New Years Eve"); - - lh.addStaticHoliday ("01-FEB-2052", "Lunar New Years Day"); - - lh.addStaticHoliday ("02-FEB-2052", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("05-FEB-2052", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("28-FEB-2052", "Memorial Day"); - - lh.addStaticHoliday ("03-APR-2052", "Childrens Day"); - - lh.addStaticHoliday ("04-APR-2052", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2052", "May Day"); - - lh.addStaticHoliday ("10-OCT-2052", "National Day"); - - lh.addStaticHoliday ("01-JAN-2053", "New Years Day"); - - lh.addStaticHoliday ("17-FEB-2053", "Bridging Day"); - - lh.addStaticHoliday ("18-FEB-2053", "Lunar New Years Eve"); - - lh.addStaticHoliday ("19-FEB-2053", "Lunar New Years Day"); - - lh.addStaticHoliday ("20-FEB-2053", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("21-FEB-2053", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("28-FEB-2053", "Memorial Day"); - - lh.addStaticHoliday ("03-APR-2053", "Childrens Day"); - - lh.addStaticHoliday ("04-APR-2053", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2053", "May Day"); - - lh.addStaticHoliday ("20-JUN-2053", "Dragon Boat Festival"); - - lh.addStaticHoliday ("26-SEP-2053", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2053", "National Day"); - - lh.addStaticHoliday ("01-JAN-2054", "New Years Day"); - - lh.addStaticHoliday ("09-FEB-2054", "Lunar New Years Eve Observed"); - - lh.addStaticHoliday ("10-FEB-2054", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("11-FEB-2054", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("12-FEB-2054", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("13-FEB-2054", "Bridging Day"); - - lh.addStaticHoliday ("03-APR-2054", "Childrens Day"); - - lh.addStaticHoliday ("01-MAY-2054", "May Day"); - - lh.addStaticHoliday ("10-JUN-2054", "Dragon Boat Festival"); - - lh.addStaticHoliday ("16-SEP-2054", "Moon Festival Day"); - - lh.addStaticHoliday ("01-JAN-2055", "New Years Day"); - - lh.addStaticHoliday ("27-JAN-2055", "Lunar New Years Eve"); - - lh.addStaticHoliday ("28-JAN-2055", "Lunar New Years Day"); - - lh.addStaticHoliday ("29-JAN-2055", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("01-FEB-2055", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("05-APR-2055", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("04-OCT-2055", "Bridging Day"); - - lh.addStaticHoliday ("05-OCT-2055", "Moon Festival Day"); - - lh.addStaticHoliday ("14-FEB-2056", "Lunar New Years Eve"); - - lh.addStaticHoliday ("15-FEB-2056", "Lunar New Years Day"); - - lh.addStaticHoliday ("16-FEB-2056", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("17-FEB-2056", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("28-FEB-2056", "Memorial Day"); - - lh.addStaticHoliday ("03-APR-2056", "Childrens Day"); - - lh.addStaticHoliday ("04-APR-2056", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2056", "May Day"); - - lh.addStaticHoliday ("10-OCT-2056", "National Day"); - - lh.addStaticHoliday ("01-JAN-2057", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2057", "Lunar New Years Eve Observed"); - - lh.addStaticHoliday ("06-FEB-2057", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("07-FEB-2057", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("08-FEB-2057", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("09-FEB-2057", "Bridging Day"); - - lh.addStaticHoliday ("28-FEB-2057", "Memorial Day"); - - lh.addStaticHoliday ("03-APR-2057", "Childrens Day"); - - lh.addStaticHoliday ("04-APR-2057", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2057", "May Day"); - - lh.addStaticHoliday ("06-JUN-2057", "Dragon Boat Festival"); - - lh.addStaticHoliday ("13-SEP-2057", "Moon Festival Day"); - - lh.addStaticHoliday ("14-SEP-2057", "Bridging Day"); - - lh.addStaticHoliday ("10-OCT-2057", "National Day"); - - lh.addStaticHoliday ("01-JAN-2058", "New Years Day"); - - lh.addStaticHoliday ("23-JAN-2058", "Lunar New Years Eve"); - - lh.addStaticHoliday ("24-JAN-2058", "Lunar New Years Day"); - - lh.addStaticHoliday ("25-JAN-2058", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("28-JAN-2058", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("28-FEB-2058", "Memorial Day"); - - lh.addStaticHoliday ("03-APR-2058", "Childrens Day"); - - lh.addStaticHoliday ("04-APR-2058", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2058", "May Day"); - - lh.addStaticHoliday ("24-JUN-2058", "Bridging Day"); - - lh.addStaticHoliday ("25-JUN-2058", "Dragon Boat Festival"); - - lh.addStaticHoliday ("02-OCT-2058", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2058", "National Day"); - - lh.addStaticHoliday ("01-JAN-2059", "New Years Day"); - - lh.addStaticHoliday ("10-FEB-2059", "Bridging Day"); - - lh.addStaticHoliday ("11-FEB-2059", "Lunar New Years Eve"); - - lh.addStaticHoliday ("12-FEB-2059", "Lunar New Years Day"); - - lh.addStaticHoliday ("13-FEB-2059", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("14-FEB-2059", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("28-FEB-2059", "Memorial Day"); - - lh.addStaticHoliday ("04-APR-2059", "Childrens Day"); - - lh.addStaticHoliday ("01-MAY-2059", "May Day"); - - lh.addStaticHoliday ("10-OCT-2059", "National Day"); - - lh.addStaticHoliday ("01-JAN-2060", "New Years Day"); - - lh.addStaticHoliday ("02-FEB-2060", "Lunar New Years Eve Observed"); - - lh.addStaticHoliday ("03-FEB-2060", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("04-FEB-2060", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("05-FEB-2060", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("06-FEB-2060", "Bridging Day"); - - lh.addStaticHoliday ("03-JUN-2060", "Dragon Boat Festival"); - - lh.addStaticHoliday ("04-JUN-2060", "Bridging Day"); - - lh.addStaticHoliday ("09-SEP-2060", "Moon Festival Day"); - - lh.addStaticHoliday ("10-SEP-2060", "Bridging Day"); - - lh.addStaticHoliday ("20-JAN-2061", "Lunar New Years Eve"); - - lh.addStaticHoliday ("21-JAN-2061", "Lunar New Years Day"); - - lh.addStaticHoliday ("24-JAN-2061", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("25-JAN-2061", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("28-FEB-2061", "Memorial Day"); - - lh.addStaticHoliday ("04-APR-2061", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("02-MAY-2061", "May Day Observed"); - - lh.addStaticHoliday ("22-JUN-2061", "Dragon Boat Festival"); - - lh.addStaticHoliday ("28-SEP-2061", "Moon Festival Day"); - - lh.addStaticHoliday ("10-OCT-2061", "National Day"); - - lh.addStaticHoliday ("08-FEB-2062", "Lunar New Years Eve"); - - lh.addStaticHoliday ("09-FEB-2062", "Lunar New Years Day"); - - lh.addStaticHoliday ("10-FEB-2062", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("13-FEB-2062", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("28-FEB-2062", "Memorial Day"); - - lh.addStaticHoliday ("03-APR-2062", "Childrens Day"); - - lh.addStaticHoliday ("04-APR-2062", "Tomb Sweeping Day"); - - lh.addStaticHoliday ("01-MAY-2062", "May Day"); - - lh.addStaticHoliday ("10-OCT-2062", "National Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/UAHHoliday.java b/org/drip/analytics/holset/UAHHoliday.java deleted file mode 100644 index 1491bc2..0000000 --- a/org/drip/analytics/holset/UAHHoliday.java +++ /dev/null @@ -1,793 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class UAHHoliday implements org.drip.analytics.holset.LocationHoliday { - public UAHHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "UAH"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-1998", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("09-MAR-1998", "Womens Day Observed"); - - lh.addStaticHoliday ("20-APR-1998", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labor Day"); - - lh.addStaticHoliday ("04-MAY-1998", "Day after Labor Day Observed"); - - lh.addStaticHoliday ("11-MAY-1998", "Victory Day Observed"); - - lh.addStaticHoliday ("08-JUN-1998", "Whit Monday"); - - lh.addStaticHoliday ("29-JUN-1998", "Constitution Day Observed"); - - lh.addStaticHoliday ("24-AUG-1998", "Independence Day"); - - lh.addStaticHoliday ("09-NOV-1998", "Day after Great October Revolution Day Observed"); - - lh.addStaticHoliday ("10-NOV-1998", "Great October Revolution Day Observed"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-1999", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-1999", "Womens Day"); - - lh.addStaticHoliday ("12-APR-1999", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("03-MAY-1999", "Day after Labor Day Observed"); - - lh.addStaticHoliday ("04-MAY-1999", "Labor Day Observed"); - - lh.addStaticHoliday ("10-MAY-1999", "Victory Day Observed"); - - lh.addStaticHoliday ("31-MAY-1999", "Whit Monday"); - - lh.addStaticHoliday ("28-JUN-1999", "Constitution Day"); - - lh.addStaticHoliday ("24-AUG-1999", "Independence Day"); - - lh.addStaticHoliday ("08-NOV-1999", "Day after Great October Revolution Day"); - - lh.addStaticHoliday ("09-NOV-1999", "Great October Revolution Day Observed"); - - lh.addStaticHoliday ("03-JAN-2000", "New Years Day Observed"); - - lh.addStaticHoliday ("07-JAN-2000", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2000", "Womens Day"); - - lh.addStaticHoliday ("01-MAY-2000", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2000", "Day after Labor Day"); - - lh.addStaticHoliday ("09-MAY-2000", "Victory Day"); - - lh.addStaticHoliday ("19-JUN-2000", "Whit Monday"); - - lh.addStaticHoliday ("28-JUN-2000", "Constitution Day"); - - lh.addStaticHoliday ("24-AUG-2000", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2000", "Great October Revolution Day"); - - lh.addStaticHoliday ("08-NOV-2000", "Day after Great October Revolution Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2001", "Orthodox Christmas Day Observed"); - - lh.addStaticHoliday ("08-MAR-2001", "Womens Day"); - - lh.addStaticHoliday ("16-APR-2001", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2001", "Day after Labor Day"); - - lh.addStaticHoliday ("09-MAY-2001", "Victory Day"); - - lh.addStaticHoliday ("04-JUN-2001", "Whit Monday"); - - lh.addStaticHoliday ("28-JUN-2001", "Constitution Day"); - - lh.addStaticHoliday ("24-AUG-2001", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2001", "Great October Revolution Day"); - - lh.addStaticHoliday ("08-NOV-2001", "Day after Great October Revolution Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2002", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2002", "Womens Day"); - - lh.addStaticHoliday ("01-MAY-2002", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2002", "Day after Labor Day"); - - lh.addStaticHoliday ("06-MAY-2002", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("09-MAY-2002", "Victory Day"); - - lh.addStaticHoliday ("24-JUN-2002", "Whit Monday"); - - lh.addStaticHoliday ("28-JUN-2002", "Constitution Day"); - - lh.addStaticHoliday ("26-AUG-2002", "Independence Day Observed"); - - lh.addStaticHoliday ("07-NOV-2002", "Great October Revolution Day"); - - lh.addStaticHoliday ("08-NOV-2002", "Day after Great October Revolution Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2003", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("10-MAR-2003", "Womens Day Observed"); - - lh.addStaticHoliday ("28-APR-2003", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2003", "Day after Labor Day"); - - lh.addStaticHoliday ("09-MAY-2003", "Victory Day"); - - lh.addStaticHoliday ("16-JUN-2003", "Whit Monday"); - - lh.addStaticHoliday ("30-JUN-2003", "Constitution Day Observed"); - - lh.addStaticHoliday ("25-AUG-2003", "Independence Day Observed"); - - lh.addStaticHoliday ("07-NOV-2003", "Great October Revolution Day"); - - lh.addStaticHoliday ("10-NOV-2003", "Day after Great October Revolution Day Observed"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2004", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2004", "Womens Day"); - - lh.addStaticHoliday ("12-APR-2004", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2004", "Day after Labor Day Observed"); - - lh.addStaticHoliday ("04-MAY-2004", "Labor Day Observed"); - - lh.addStaticHoliday ("10-MAY-2004", "Victory Day Observed"); - - lh.addStaticHoliday ("31-MAY-2004", "Whit Monday"); - - lh.addStaticHoliday ("28-JUN-2004", "Constitution Day"); - - lh.addStaticHoliday ("24-AUG-2004", "Independence Day"); - - lh.addStaticHoliday ("08-NOV-2004", "Day after Great October Revolution Day"); - - lh.addStaticHoliday ("09-NOV-2004", "Great October Revolution Day Observed"); - - lh.addStaticHoliday ("03-JAN-2005", "New Years Day Observed"); - - lh.addStaticHoliday ("07-JAN-2005", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2005", "Womens Day"); - - lh.addStaticHoliday ("02-MAY-2005", "Day after Labor Day"); - - lh.addStaticHoliday ("03-MAY-2005", "Labor Day Observed"); - - lh.addStaticHoliday ("09-MAY-2005", "Victory Day"); - - lh.addStaticHoliday ("20-JUN-2005", "Whit Monday"); - - lh.addStaticHoliday ("28-JUN-2005", "Constitution Day"); - - lh.addStaticHoliday ("24-AUG-2005", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2005", "Great October Revolution Day"); - - lh.addStaticHoliday ("08-NOV-2005", "Day after Great October Revolution Day"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("09-JAN-2006", "Orthodox Christmas Day Observed"); - - lh.addStaticHoliday ("08-MAR-2006", "Womens Day"); - - lh.addStaticHoliday ("24-APR-2006", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2006", "Day after Labor Day"); - - lh.addStaticHoliday ("09-MAY-2006", "Victory Day"); - - lh.addStaticHoliday ("12-JUN-2006", "Whit Monday"); - - lh.addStaticHoliday ("28-JUN-2006", "Constitution Day"); - - lh.addStaticHoliday ("24-AUG-2006", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2006", "Great October Revolution Day"); - - lh.addStaticHoliday ("08-NOV-2006", "Day after Great October Revolution Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2007", "Orthodox Christmas Day Observed"); - - lh.addStaticHoliday ("08-MAR-2007", "Womens Day"); - - lh.addStaticHoliday ("09-APR-2007", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2007", "Day after Labor Day"); - - lh.addStaticHoliday ("09-MAY-2007", "Victory Day"); - - lh.addStaticHoliday ("28-MAY-2007", "Whit Monday"); - - lh.addStaticHoliday ("28-JUN-2007", "Constitution Day"); - - lh.addStaticHoliday ("24-AUG-2007", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2007", "Great October Revolution Day"); - - lh.addStaticHoliday ("08-NOV-2007", "Day after Great October Revolution Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2008", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("10-MAR-2008", "Womens Day Observed"); - - lh.addStaticHoliday ("28-APR-2008", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2008", "Day after Labor Day"); - - lh.addStaticHoliday ("09-MAY-2008", "Victory Day"); - - lh.addStaticHoliday ("16-JUN-2008", "Whit Monday"); - - lh.addStaticHoliday ("30-JUN-2008", "Constitution Day Observed"); - - lh.addStaticHoliday ("25-AUG-2008", "Independence Day Observed"); - - lh.addStaticHoliday ("07-NOV-2008", "Great October Revolution Day"); - - lh.addStaticHoliday ("10-NOV-2008", "Day after Great October Revolution Day Observed"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2009", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("09-MAR-2009", "Womens Day Observed"); - - lh.addStaticHoliday ("20-APR-2009", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labor Day"); - - lh.addStaticHoliday ("04-MAY-2009", "Day after Labor Day Observed"); - - lh.addStaticHoliday ("11-MAY-2009", "Victory Day Observed"); - - lh.addStaticHoliday ("08-JUN-2009", "Whit Monday"); - - lh.addStaticHoliday ("29-JUN-2009", "Constitution Day Observed"); - - lh.addStaticHoliday ("24-AUG-2009", "Independence Day"); - - lh.addStaticHoliday ("09-NOV-2009", "Day after Great October Revolution Day Observed"); - - lh.addStaticHoliday ("10-NOV-2009", "Great October Revolution Day Observed"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2010", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2010", "Womens Day"); - - lh.addStaticHoliday ("05-APR-2010", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("03-MAY-2010", "Day after Labor Day Observed"); - - lh.addStaticHoliday ("04-MAY-2010", "Labor Day Observed"); - - lh.addStaticHoliday ("10-MAY-2010", "Victory Day Observed"); - - lh.addStaticHoliday ("24-MAY-2010", "Whit Monday"); - - lh.addStaticHoliday ("28-JUN-2010", "Constitution Day"); - - lh.addStaticHoliday ("24-AUG-2010", "Independence Day"); - - lh.addStaticHoliday ("08-NOV-2010", "Day after Great October Revolution Day"); - - lh.addStaticHoliday ("09-NOV-2010", "Great October Revolution Day Observed"); - - lh.addStaticHoliday ("03-JAN-2011", "New Years Day Observed"); - - lh.addStaticHoliday ("07-JAN-2011", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2011", "Womens Day"); - - lh.addStaticHoliday ("25-APR-2011", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2011", "Day after Labor Day"); - - lh.addStaticHoliday ("03-MAY-2011", "Labor Day Observed"); - - lh.addStaticHoliday ("09-MAY-2011", "Victory Day"); - - lh.addStaticHoliday ("13-JUN-2011", "Whit Monday"); - - lh.addStaticHoliday ("28-JUN-2011", "Constitution Day"); - - lh.addStaticHoliday ("24-AUG-2011", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2011", "Great October Revolution Day"); - - lh.addStaticHoliday ("08-NOV-2011", "Day after Great October Revolution Day"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("09-JAN-2012", "Orthodox Christmas Day Observed"); - - lh.addStaticHoliday ("08-MAR-2012", "Womens Day"); - - lh.addStaticHoliday ("16-APR-2012", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2012", "Day after Labor Day"); - - lh.addStaticHoliday ("09-MAY-2012", "Victory Day"); - - lh.addStaticHoliday ("04-JUN-2012", "Whit Monday"); - - lh.addStaticHoliday ("28-JUN-2012", "Constitution Day"); - - lh.addStaticHoliday ("24-AUG-2012", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2012", "Great October Revolution Day"); - - lh.addStaticHoliday ("08-NOV-2012", "Day after Great October Revolution Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2013", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2013", "Womens Day"); - - lh.addStaticHoliday ("01-MAY-2013", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2013", "Day after Labor Day"); - - lh.addStaticHoliday ("06-MAY-2013", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("09-MAY-2013", "Victory Day"); - - lh.addStaticHoliday ("24-JUN-2013", "Whit Monday"); - - lh.addStaticHoliday ("28-JUN-2013", "Constitution Day"); - - lh.addStaticHoliday ("26-AUG-2013", "Independence Day Observed"); - - lh.addStaticHoliday ("07-NOV-2013", "Great October Revolution Day"); - - lh.addStaticHoliday ("08-NOV-2013", "Day after Great October Revolution Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2014", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("10-MAR-2014", "Womens Day Observed"); - - lh.addStaticHoliday ("21-APR-2014", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2014", "Day after Labor Day"); - - lh.addStaticHoliday ("09-MAY-2014", "Victory Day"); - - lh.addStaticHoliday ("09-JUN-2014", "Whit Monday"); - - lh.addStaticHoliday ("30-JUN-2014", "Constitution Day Observed"); - - lh.addStaticHoliday ("25-AUG-2014", "Independence Day Observed"); - - lh.addStaticHoliday ("07-NOV-2014", "Great October Revolution Day"); - - lh.addStaticHoliday ("10-NOV-2014", "Day after Great October Revolution Day Observed"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2015", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("09-MAR-2015", "Womens Day Observed"); - - lh.addStaticHoliday ("13-APR-2015", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labor Day"); - - lh.addStaticHoliday ("04-MAY-2015", "Day after Labor Day Observed"); - - lh.addStaticHoliday ("11-MAY-2015", "Victory Day Observed"); - - lh.addStaticHoliday ("01-JUN-2015", "Whit Monday"); - - lh.addStaticHoliday ("29-JUN-2015", "Constitution Day Observed"); - - lh.addStaticHoliday ("24-AUG-2015", "Independence Day"); - - lh.addStaticHoliday ("09-NOV-2015", "Day after Great October Revolution Day Observed"); - - lh.addStaticHoliday ("10-NOV-2015", "Great October Revolution Day Observed"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2016", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2016", "Womens Day"); - - lh.addStaticHoliday ("02-MAY-2016", "Day after Labor Day"); - - lh.addStaticHoliday ("03-MAY-2016", "Labor Day Observed"); - - lh.addStaticHoliday ("09-MAY-2016", "Victory Day"); - - lh.addStaticHoliday ("20-JUN-2016", "Whit Monday"); - - lh.addStaticHoliday ("28-JUN-2016", "Constitution Day"); - - lh.addStaticHoliday ("24-AUG-2016", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2016", "Great October Revolution Day"); - - lh.addStaticHoliday ("08-NOV-2016", "Day after Great October Revolution Day"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("09-JAN-2017", "Orthodox Christmas Day Observed"); - - lh.addStaticHoliday ("08-MAR-2017", "Womens Day"); - - lh.addStaticHoliday ("17-APR-2017", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2017", "Day after Labor Day"); - - lh.addStaticHoliday ("09-MAY-2017", "Victory Day"); - - lh.addStaticHoliday ("05-JUN-2017", "Whit Monday"); - - lh.addStaticHoliday ("28-JUN-2017", "Constitution Day"); - - lh.addStaticHoliday ("24-AUG-2017", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2017", "Great October Revolution Day"); - - lh.addStaticHoliday ("08-NOV-2017", "Day after Great October Revolution Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2018", "Orthodox Christmas Day Observed"); - - lh.addStaticHoliday ("08-MAR-2018", "Womens Day"); - - lh.addStaticHoliday ("09-APR-2018", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2018", "Day after Labor Day"); - - lh.addStaticHoliday ("09-MAY-2018", "Victory Day"); - - lh.addStaticHoliday ("28-MAY-2018", "Whit Monday"); - - lh.addStaticHoliday ("28-JUN-2018", "Constitution Day"); - - lh.addStaticHoliday ("24-AUG-2018", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2018", "Great October Revolution Day"); - - lh.addStaticHoliday ("08-NOV-2018", "Day after Great October Revolution Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2019", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2019", "Womens Day"); - - lh.addStaticHoliday ("29-APR-2019", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2019", "Day after Labor Day"); - - lh.addStaticHoliday ("09-MAY-2019", "Victory Day"); - - lh.addStaticHoliday ("17-JUN-2019", "Whit Monday"); - - lh.addStaticHoliday ("28-JUN-2019", "Constitution Day"); - - lh.addStaticHoliday ("26-AUG-2019", "Independence Day Observed"); - - lh.addStaticHoliday ("07-NOV-2019", "Great October Revolution Day"); - - lh.addStaticHoliday ("08-NOV-2019", "Day after Great October Revolution Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2020", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("09-MAR-2020", "Womens Day Observed"); - - lh.addStaticHoliday ("20-APR-2020", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labor Day"); - - lh.addStaticHoliday ("04-MAY-2020", "Day after Labor Day Observed"); - - lh.addStaticHoliday ("11-MAY-2020", "Victory Day Observed"); - - lh.addStaticHoliday ("08-JUN-2020", "Whit Monday"); - - lh.addStaticHoliday ("29-JUN-2020", "Constitution Day Observed"); - - lh.addStaticHoliday ("24-AUG-2020", "Independence Day"); - - lh.addStaticHoliday ("09-NOV-2020", "Day after Great October Revolution Day Observed"); - - lh.addStaticHoliday ("10-NOV-2020", "Great October Revolution Day Observed"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2021", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2021", "Womens Day"); - - lh.addStaticHoliday ("03-MAY-2021", "Day after Labor Day Observed"); - - lh.addStaticHoliday ("04-MAY-2021", "Labor Day Observed"); - - lh.addStaticHoliday ("10-MAY-2021", "Victory Day Observed"); - - lh.addStaticHoliday ("21-JUN-2021", "Whit Monday"); - - lh.addStaticHoliday ("28-JUN-2021", "Constitution Day"); - - lh.addStaticHoliday ("24-AUG-2021", "Independence Day"); - - lh.addStaticHoliday ("08-NOV-2021", "Day after Great October Revolution Day"); - - lh.addStaticHoliday ("09-NOV-2021", "Great October Revolution Day Observed"); - - lh.addStaticHoliday ("03-JAN-2022", "New Years Day Observed"); - - lh.addStaticHoliday ("07-JAN-2022", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2022", "Womens Day"); - - lh.addStaticHoliday ("25-APR-2022", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2022", "Day after Labor Day"); - - lh.addStaticHoliday ("03-MAY-2022", "Labor Day Observed"); - - lh.addStaticHoliday ("09-MAY-2022", "Victory Day"); - - lh.addStaticHoliday ("13-JUN-2022", "Whit Monday"); - - lh.addStaticHoliday ("28-JUN-2022", "Constitution Day"); - - lh.addStaticHoliday ("24-AUG-2022", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2022", "Great October Revolution Day"); - - lh.addStaticHoliday ("08-NOV-2022", "Day after Great October Revolution Day"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("09-JAN-2023", "Orthodox Christmas Day Observed"); - - lh.addStaticHoliday ("08-MAR-2023", "Womens Day"); - - lh.addStaticHoliday ("17-APR-2023", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2023", "Day after Labor Day"); - - lh.addStaticHoliday ("09-MAY-2023", "Victory Day"); - - lh.addStaticHoliday ("05-JUN-2023", "Whit Monday"); - - lh.addStaticHoliday ("28-JUN-2023", "Constitution Day"); - - lh.addStaticHoliday ("24-AUG-2023", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2023", "Great October Revolution Day"); - - lh.addStaticHoliday ("08-NOV-2023", "Day after Great October Revolution Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2024", "Orthodox Christmas Day Observed"); - - lh.addStaticHoliday ("08-MAR-2024", "Womens Day"); - - lh.addStaticHoliday ("01-MAY-2024", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2024", "Day after Labor Day"); - - lh.addStaticHoliday ("06-MAY-2024", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("09-MAY-2024", "Victory Day"); - - lh.addStaticHoliday ("24-JUN-2024", "Whit Monday"); - - lh.addStaticHoliday ("28-JUN-2024", "Constitution Day"); - - lh.addStaticHoliday ("26-AUG-2024", "Independence Day Observed"); - - lh.addStaticHoliday ("07-NOV-2024", "Great October Revolution Day"); - - lh.addStaticHoliday ("08-NOV-2024", "Day after Great October Revolution Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2025", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("10-MAR-2025", "Womens Day Observed"); - - lh.addStaticHoliday ("21-APR-2025", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2025", "Day after Labor Day"); - - lh.addStaticHoliday ("09-MAY-2025", "Victory Day"); - - lh.addStaticHoliday ("09-JUN-2025", "Whit Monday"); - - lh.addStaticHoliday ("30-JUN-2025", "Constitution Day Observed"); - - lh.addStaticHoliday ("25-AUG-2025", "Independence Day Observed"); - - lh.addStaticHoliday ("07-NOV-2025", "Great October Revolution Day"); - - lh.addStaticHoliday ("10-NOV-2025", "Day after Great October Revolution Day Observed"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2026", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("09-MAR-2026", "Womens Day Observed"); - - lh.addStaticHoliday ("13-APR-2026", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labor Day"); - - lh.addStaticHoliday ("04-MAY-2026", "Day after Labor Day Observed"); - - lh.addStaticHoliday ("11-MAY-2026", "Victory Day Observed"); - - lh.addStaticHoliday ("01-JUN-2026", "Whit Monday"); - - lh.addStaticHoliday ("29-JUN-2026", "Constitution Day Observed"); - - lh.addStaticHoliday ("24-AUG-2026", "Independence Day"); - - lh.addStaticHoliday ("09-NOV-2026", "Day after Great October Revolution Day Observed"); - - lh.addStaticHoliday ("10-NOV-2026", "Great October Revolution Day Observed"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2027", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2027", "Womens Day"); - - lh.addStaticHoliday ("03-MAY-2027", "Day after Labor Day Observed"); - - lh.addStaticHoliday ("04-MAY-2027", "Labor Day Observed"); - - lh.addStaticHoliday ("10-MAY-2027", "Victory Day Observed"); - - lh.addStaticHoliday ("21-JUN-2027", "Whit Monday"); - - lh.addStaticHoliday ("28-JUN-2027", "Constitution Day"); - - lh.addStaticHoliday ("24-AUG-2027", "Independence Day"); - - lh.addStaticHoliday ("08-NOV-2027", "Day after Great October Revolution Day"); - - lh.addStaticHoliday ("09-NOV-2027", "Great October Revolution Day Observed"); - - lh.addStaticHoliday ("03-JAN-2028", "New Years Day Observed"); - - lh.addStaticHoliday ("07-JAN-2028", "Orthodox Christmas Day"); - - lh.addStaticHoliday ("08-MAR-2028", "Womens Day"); - - lh.addStaticHoliday ("17-APR-2028", "Orthodox Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2028", "Day after Labor Day"); - - lh.addStaticHoliday ("09-MAY-2028", "Victory Day"); - - lh.addStaticHoliday ("05-JUN-2028", "Whit Monday"); - - lh.addStaticHoliday ("28-JUN-2028", "Constitution Day"); - - lh.addStaticHoliday ("24-AUG-2028", "Independence Day"); - - lh.addStaticHoliday ("07-NOV-2028", "Great October Revolution Day"); - - lh.addStaticHoliday ("08-NOV-2028", "Day after Great October Revolution Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/USDHoliday.java b/org/drip/analytics/holset/USDHoliday.java deleted file mode 100644 index d401e0d..0000000 --- a/org/drip/analytics/holset/USDHoliday.java +++ /dev/null @@ -1,1773 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class USDHoliday implements org.drip.analytics.holset.LocationHoliday { - public USDHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "USD"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("03-JAN-1994", "...from ChaseTools"); - - lh.addStaticHoliday ("02-JAN-1995", "...from ChaseTools"); - - lh.addStaticHoliday ("29-MAY-1995", "...from ChaseTools"); - - lh.addStaticHoliday ("04-JUL-1995", "...from ChaseTools"); - - lh.addStaticHoliday ("04-SEP-1995", "...from ChaseTools"); - - lh.addStaticHoliday ("09-OCT-1995", "...from ChaseTools"); - - lh.addStaticHoliday ("10-NOV-1995", "...from ChaseTools"); - - lh.addStaticHoliday ("23-NOV-1995", "...from ChaseTools"); - - lh.addStaticHoliday ("25-DEC-1995", "...from ChaseTools"); - - lh.addStaticHoliday ("01-JAN-1996", "...from ChaseTools"); - - lh.addStaticHoliday ("15-JAN-1996", "...from ChaseTools"); - - lh.addStaticHoliday ("19-FEB-1996", "...from ChaseTools"); - - lh.addStaticHoliday ("27-MAY-1996", "...from ChaseTools"); - - lh.addStaticHoliday ("04-JUL-1996", "...from ChaseTools"); - - lh.addStaticHoliday ("02-SEP-1996", "...from ChaseTools"); - - lh.addStaticHoliday ("14-OCT-1996", "...from ChaseTools"); - - lh.addStaticHoliday ("11-NOV-1996", "...from ChaseTools"); - - lh.addStaticHoliday ("28-NOV-1996", "...from ChaseTools"); - - lh.addStaticHoliday ("25-DEC-1996", "...from ChaseTools"); - - lh.addStaticHoliday ("01-JAN-1997", "...from ChaseTools"); - - lh.addStaticHoliday ("20-JAN-1997", "...from ChaseTools"); - - lh.addStaticHoliday ("17-FEB-1997", "...from ChaseTools"); - - lh.addStaticHoliday ("26-MAY-1997", "...from ChaseTools"); - - lh.addStaticHoliday ("04-JUL-1997", "...from ChaseTools"); - - lh.addStaticHoliday ("01-SEP-1997", "...from ChaseTools"); - - lh.addStaticHoliday ("13-OCT-1997", "...from ChaseTools"); - - lh.addStaticHoliday ("11-NOV-1997", "...from ChaseTools"); - - lh.addStaticHoliday ("27-NOV-1997", "...from ChaseTools"); - - lh.addStaticHoliday ("25-DEC-1997", "...from ChaseTools"); - - lh.addStaticHoliday ("01-JAN-1998", "...from ChaseTools"); - - lh.addStaticHoliday ("19-JAN-1998", "...from ChaseTools"); - - lh.addStaticHoliday ("16-FEB-1998", "...from ChaseTools"); - - lh.addStaticHoliday ("25-MAY-1998", "...from ChaseTools"); - - lh.addStaticHoliday ("07-SEP-1998", "...from ChaseTools"); - - lh.addStaticHoliday ("12-OCT-1998", "...from ChaseTools"); - - lh.addStaticHoliday ("11-NOV-1998", "...from ChaseTools"); - - lh.addStaticHoliday ("26-NOV-1998", "...from ChaseTools"); - - lh.addStaticHoliday ("25-DEC-1998", "...from ChaseTools"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("18-JAN-1999", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("15-FEB-1999", "Washingtons Birthday"); - - lh.addStaticHoliday ("31-MAY-1999", "Memorial Day"); - - lh.addStaticHoliday ("05-JUL-1999", "Independence Day Observed"); - - lh.addStaticHoliday ("06-SEP-1999", "Labor Day"); - - lh.addStaticHoliday ("11-OCT-1999", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-1999", "Veterans Day"); - - lh.addStaticHoliday ("25-NOV-1999", "Thanksgiving Day"); - - lh.addStaticHoliday ("17-JAN-2000", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("21-FEB-2000", "Washingtons Birthday"); - - lh.addStaticHoliday ("29-MAY-2000", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2000", "Independence Day"); - - lh.addStaticHoliday ("04-SEP-2000", "Labor Day"); - - lh.addStaticHoliday ("09-OCT-2000", "Columbus Day"); - - lh.addStaticHoliday ("23-NOV-2000", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("15-JAN-2001", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("19-FEB-2001", "Washingtons Birthday"); - - lh.addStaticHoliday ("28-MAY-2001", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2001", "Independence Day"); - - lh.addStaticHoliday ("03-SEP-2001", "Labor Day"); - - lh.addStaticHoliday ("08-OCT-2001", "Columbus Day"); - - lh.addStaticHoliday ("12-NOV-2001", "Veterans Day Observed"); - - lh.addStaticHoliday ("22-NOV-2001", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2002", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("18-FEB-2002", "Washingtons Birthday"); - - lh.addStaticHoliday ("27-MAY-2002", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2002", "Independence Day"); - - lh.addStaticHoliday ("02-SEP-2002", "Labor Day"); - - lh.addStaticHoliday ("14-OCT-2002", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2002", "Veterans Day"); - - lh.addStaticHoliday ("28-NOV-2002", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2003", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("17-FEB-2003", "Washingtons Birthday"); - - lh.addStaticHoliday ("26-MAY-2003", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2003", "Independence Day"); - - lh.addStaticHoliday ("01-SEP-2003", "Labor Day"); - - lh.addStaticHoliday ("13-OCT-2003", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2003", "Veterans Day"); - - lh.addStaticHoliday ("27-NOV-2003", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2004", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("16-FEB-2004", "Washingtons Birthday"); - - lh.addStaticHoliday ("31-MAY-2004", "Memorial Day"); - - lh.addStaticHoliday ("05-JUL-2004", "Independence Day Observed"); - - lh.addStaticHoliday ("06-SEP-2004", "Labor Day"); - - lh.addStaticHoliday ("11-OCT-2004", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2004", "Veterans Day"); - - lh.addStaticHoliday ("25-NOV-2004", "Thanksgiving Day"); - - lh.addStaticHoliday ("17-JAN-2005", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("21-FEB-2005", "Washingtons Birthday"); - - lh.addStaticHoliday ("30-MAY-2005", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2005", "Independence Day"); - - lh.addStaticHoliday ("05-SEP-2005", "Labor Day"); - - lh.addStaticHoliday ("10-OCT-2005", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2005", "Veterans Day"); - - lh.addStaticHoliday ("24-NOV-2005", "Thanksgiving Day"); - - lh.addStaticHoliday ("26-DEC-2005", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("16-JAN-2006", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("20-FEB-2006", "Washingtons Birthday"); - - lh.addStaticHoliday ("29-MAY-2006", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2006", "Independence Day"); - - lh.addStaticHoliday ("04-SEP-2006", "Labor Day"); - - lh.addStaticHoliday ("09-OCT-2006", "Columbus Day"); - - lh.addStaticHoliday ("23-NOV-2006", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("15-JAN-2007", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("19-FEB-2007", "Washingtons Birthday"); - - lh.addStaticHoliday ("28-MAY-2007", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2007", "Independence Day"); - - lh.addStaticHoliday ("03-SEP-2007", "Labor Day"); - - lh.addStaticHoliday ("08-OCT-2007", "Columbus Day"); - - lh.addStaticHoliday ("12-NOV-2007", "Veterans Day Observed"); - - lh.addStaticHoliday ("22-NOV-2007", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2008", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("18-FEB-2008", "Washingtons Birthday"); - - lh.addStaticHoliday ("26-MAY-2008", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2008", "Independence Day"); - - lh.addStaticHoliday ("01-SEP-2008", "Labor Day"); - - lh.addStaticHoliday ("13-OCT-2008", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2008", "Veterans Day"); - - lh.addStaticHoliday ("27-NOV-2008", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2009", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("16-FEB-2009", "Washingtons Birthday"); - - lh.addStaticHoliday ("25-MAY-2009", "Memorial Day"); - - lh.addStaticHoliday ("07-SEP-2009", "Labor Day"); - - lh.addStaticHoliday ("12-OCT-2009", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2009", "Veterans Day"); - - lh.addStaticHoliday ("26-NOV-2009", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("18-JAN-2010", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("15-FEB-2010", "Washingtons Birthday"); - - lh.addStaticHoliday ("31-MAY-2010", "Memorial Day"); - - lh.addStaticHoliday ("05-JUL-2010", "Independence Day Observed"); - - lh.addStaticHoliday ("06-SEP-2010", "Labor Day"); - - lh.addStaticHoliday ("11-OCT-2010", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2010", "Veterans Day"); - - lh.addStaticHoliday ("25-NOV-2010", "Thanksgiving Day"); - - lh.addStaticHoliday ("17-JAN-2011", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("21-FEB-2011", "Washingtons Birthday"); - - lh.addStaticHoliday ("30-MAY-2011", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2011", "Independence Day"); - - lh.addStaticHoliday ("05-SEP-2011", "Labor Day"); - - lh.addStaticHoliday ("10-OCT-2011", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2011", "Veterans Day"); - - lh.addStaticHoliday ("24-NOV-2011", "Thanksgiving Day"); - - lh.addStaticHoliday ("26-DEC-2011", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("16-JAN-2012", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("20-FEB-2012", "Washingtons Birthday"); - - lh.addStaticHoliday ("28-MAY-2012", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2012", "Independence Day"); - - lh.addStaticHoliday ("03-SEP-2012", "Labor Day"); - - lh.addStaticHoliday ("08-OCT-2012", "Columbus Day"); - - lh.addStaticHoliday ("12-NOV-2012", "Veterans Day Observed"); - - lh.addStaticHoliday ("22-NOV-2012", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2013", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("18-FEB-2013", "Washingtons Birthday"); - - lh.addStaticHoliday ("27-MAY-2013", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2013", "Independence Day"); - - lh.addStaticHoliday ("02-SEP-2013", "Labor Day"); - - lh.addStaticHoliday ("14-OCT-2013", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2013", "Veterans Day"); - - lh.addStaticHoliday ("28-NOV-2013", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2014", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("17-FEB-2014", "Washingtons Birthday"); - - lh.addStaticHoliday ("26-MAY-2014", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2014", "Independence Day"); - - lh.addStaticHoliday ("01-SEP-2014", "Labor Day"); - - lh.addStaticHoliday ("13-OCT-2014", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2014", "Veterans Day"); - - lh.addStaticHoliday ("27-NOV-2014", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2015", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("16-FEB-2015", "Washingtons Birthday"); - - lh.addStaticHoliday ("25-MAY-2015", "Memorial Day"); - - lh.addStaticHoliday ("07-SEP-2015", "Labor Day"); - - lh.addStaticHoliday ("12-OCT-2015", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2015", "Veterans Day"); - - lh.addStaticHoliday ("26-NOV-2015", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("18-JAN-2016", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("15-FEB-2016", "Washingtons Birthday"); - - lh.addStaticHoliday ("30-MAY-2016", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2016", "Independence Day"); - - lh.addStaticHoliday ("05-SEP-2016", "Labor Day"); - - lh.addStaticHoliday ("10-OCT-2016", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2016", "Veterans Day"); - - lh.addStaticHoliday ("24-NOV-2016", "Thanksgiving Day"); - - lh.addStaticHoliday ("26-DEC-2016", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("16-JAN-2017", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("20-FEB-2017", "Washingtons Birthday"); - - lh.addStaticHoliday ("29-MAY-2017", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2017", "Independence Day"); - - lh.addStaticHoliday ("04-SEP-2017", "Labor Day"); - - lh.addStaticHoliday ("09-OCT-2017", "Columbus Day"); - - lh.addStaticHoliday ("23-NOV-2017", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("15-JAN-2018", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("19-FEB-2018", "Washingtons Birthday"); - - lh.addStaticHoliday ("28-MAY-2018", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2018", "Independence Day"); - - lh.addStaticHoliday ("03-SEP-2018", "Labor Day"); - - lh.addStaticHoliday ("08-OCT-2018", "Columbus Day"); - - lh.addStaticHoliday ("12-NOV-2018", "Veterans Day Observed"); - - lh.addStaticHoliday ("22-NOV-2018", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2019", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("18-FEB-2019", "Washingtons Birthday"); - - lh.addStaticHoliday ("27-MAY-2019", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2019", "Independence Day"); - - lh.addStaticHoliday ("02-SEP-2019", "Labor Day"); - - lh.addStaticHoliday ("14-OCT-2019", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2019", "Veterans Day"); - - lh.addStaticHoliday ("28-NOV-2019", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2020", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("17-FEB-2020", "Washingtons Birthday"); - - lh.addStaticHoliday ("25-MAY-2020", "Memorial Day"); - - lh.addStaticHoliday ("07-SEP-2020", "Labor Day"); - - lh.addStaticHoliday ("12-OCT-2020", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2020", "Veterans Day"); - - lh.addStaticHoliday ("26-NOV-2020", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("18-JAN-2021", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("15-FEB-2021", "Washingtons Birthday"); - - lh.addStaticHoliday ("31-MAY-2021", "Memorial Day"); - - lh.addStaticHoliday ("05-JUL-2021", "Independence Day Observed"); - - lh.addStaticHoliday ("06-SEP-2021", "Labor Day"); - - lh.addStaticHoliday ("11-OCT-2021", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2021", "Veterans Day"); - - lh.addStaticHoliday ("25-NOV-2021", "Thanksgiving Day"); - - lh.addStaticHoliday ("17-JAN-2022", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("21-FEB-2022", "Washingtons Birthday"); - - lh.addStaticHoliday ("30-MAY-2022", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2022", "Independence Day"); - - lh.addStaticHoliday ("05-SEP-2022", "Labor Day"); - - lh.addStaticHoliday ("10-OCT-2022", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2022", "Veterans Day"); - - lh.addStaticHoliday ("24-NOV-2022", "Thanksgiving Day"); - - lh.addStaticHoliday ("26-DEC-2022", "Christmas Day Observed"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("16-JAN-2023", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("20-FEB-2023", "Washingtons Birthday"); - - lh.addStaticHoliday ("29-MAY-2023", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2023", "Independence Day"); - - lh.addStaticHoliday ("04-SEP-2023", "Labor Day"); - - lh.addStaticHoliday ("09-OCT-2023", "Columbus Day"); - - lh.addStaticHoliday ("23-NOV-2023", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("15-JAN-2024", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("19-FEB-2024", "Washingtons Birthday"); - - lh.addStaticHoliday ("27-MAY-2024", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2024", "Independence Day"); - - lh.addStaticHoliday ("02-SEP-2024", "Labor Day"); - - lh.addStaticHoliday ("14-OCT-2024", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2024", "Veterans Day"); - - lh.addStaticHoliday ("28-NOV-2024", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2025", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("17-FEB-2025", "Washingtons Birthday"); - - lh.addStaticHoliday ("26-MAY-2025", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2025", "Independence Day"); - - lh.addStaticHoliday ("01-SEP-2025", "Labor Day"); - - lh.addStaticHoliday ("13-OCT-2025", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2025", "Veterans Day"); - - lh.addStaticHoliday ("27-NOV-2025", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2026", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("16-FEB-2026", "Washingtons Birthday"); - - lh.addStaticHoliday ("25-MAY-2026", "Memorial Day"); - - lh.addStaticHoliday ("07-SEP-2026", "Labor Day"); - - lh.addStaticHoliday ("12-OCT-2026", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2026", "Veterans Day"); - - lh.addStaticHoliday ("26-NOV-2026", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("18-JAN-2027", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("15-FEB-2027", "Washingtons Birthday"); - - lh.addStaticHoliday ("31-MAY-2027", "Memorial Day"); - - lh.addStaticHoliday ("05-JUL-2027", "Independence Day Observed"); - - lh.addStaticHoliday ("06-SEP-2027", "Labor Day"); - - lh.addStaticHoliday ("11-OCT-2027", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2027", "Veterans Day"); - - lh.addStaticHoliday ("25-NOV-2027", "Thanksgiving Day"); - - lh.addStaticHoliday ("17-JAN-2028", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("21-FEB-2028", "Washingtons Birthday"); - - lh.addStaticHoliday ("29-MAY-2028", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2028", "Independence Day"); - - lh.addStaticHoliday ("04-SEP-2028", "Labor Day"); - - lh.addStaticHoliday ("09-OCT-2028", "Columbus Day"); - - lh.addStaticHoliday ("23-NOV-2028", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2029", "New Years Day"); - - lh.addStaticHoliday ("15-JAN-2029", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("19-FEB-2029", "Washingtons Birthday"); - - lh.addStaticHoliday ("28-MAY-2029", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2029", "Independence Day"); - - lh.addStaticHoliday ("03-SEP-2029", "Labor Day"); - - lh.addStaticHoliday ("08-OCT-2029", "Columbus Day"); - - lh.addStaticHoliday ("12-NOV-2029", "Veterans Day Observed"); - - lh.addStaticHoliday ("22-NOV-2029", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2029", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2030", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2030", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("18-FEB-2030", "Washingtons Birthday"); - - lh.addStaticHoliday ("27-MAY-2030", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2030", "Independence Day"); - - lh.addStaticHoliday ("02-SEP-2030", "Labor Day"); - - lh.addStaticHoliday ("14-OCT-2030", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2030", "Veterans Day Observed"); - - lh.addStaticHoliday ("28-NOV-2030", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2030", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2031", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2031", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("17-FEB-2031", "Washingtons Birthday"); - - lh.addStaticHoliday ("26-MAY-2031", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2031", "Independence Day"); - - lh.addStaticHoliday ("01-SEP-2031", "Labor Day"); - - lh.addStaticHoliday ("13-OCT-2031", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2031", "Veterans Day Observed"); - - lh.addStaticHoliday ("27-NOV-2031", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2031", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2032", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2032", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("16-FEB-2032", "Washingtons Birthday"); - - lh.addStaticHoliday ("31-MAY-2032", "Memorial Day"); - - lh.addStaticHoliday ("05-JUL-2032", "Independence Day"); - - lh.addStaticHoliday ("06-SEP-2032", "Labor Day"); - - lh.addStaticHoliday ("11-OCT-2032", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2032", "Veterans Day Observed"); - - lh.addStaticHoliday ("25-NOV-2032", "Thanksgiving Day"); - - lh.addStaticHoliday ("17-JAN-2033", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("21-FEB-2033", "Washingtons Birthday"); - - lh.addStaticHoliday ("30-MAY-2033", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2033", "Independence Day"); - - lh.addStaticHoliday ("05-SEP-2033", "Labor Day"); - - lh.addStaticHoliday ("10-OCT-2033", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2033", "Veterans Day Observed"); - - lh.addStaticHoliday ("24-NOV-2033", "Thanksgiving Day"); - - lh.addStaticHoliday ("26-DEC-2033", "Christmas Day"); - - lh.addStaticHoliday ("02-JAN-2034", "New Years Day"); - - lh.addStaticHoliday ("16-JAN-2034", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("20-FEB-2034", "Washingtons Birthday"); - - lh.addStaticHoliday ("29-MAY-2034", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2034", "Independence Day"); - - lh.addStaticHoliday ("04-SEP-2034", "Labor Day"); - - lh.addStaticHoliday ("09-OCT-2034", "Columbus Day"); - - lh.addStaticHoliday ("23-NOV-2034", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2034", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2035", "New Years Day"); - - lh.addStaticHoliday ("15-JAN-2035", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("19-FEB-2035", "Washingtons Birthday"); - - lh.addStaticHoliday ("28-MAY-2035", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2035", "Independence Day"); - - lh.addStaticHoliday ("03-SEP-2035", "Labor Day"); - - lh.addStaticHoliday ("08-OCT-2035", "Columbus Day"); - - lh.addStaticHoliday ("12-NOV-2035", "Veterans Day Observed"); - - lh.addStaticHoliday ("22-NOV-2035", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2035", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2036", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2036", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("18-FEB-2036", "Washingtons Birthday"); - - lh.addStaticHoliday ("26-MAY-2036", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2036", "Independence Day"); - - lh.addStaticHoliday ("01-SEP-2036", "Labor Day"); - - lh.addStaticHoliday ("13-OCT-2036", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2036", "Veterans Day Observed"); - - lh.addStaticHoliday ("27-NOV-2036", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2036", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2037", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2037", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("16-FEB-2037", "Washingtons Birthday"); - - lh.addStaticHoliday ("25-MAY-2037", "Memorial Day"); - - lh.addStaticHoliday ("07-SEP-2037", "Labor Day"); - - lh.addStaticHoliday ("12-OCT-2037", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2037", "Veterans Day Observed"); - - lh.addStaticHoliday ("26-NOV-2037", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2037", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2038", "New Years Day"); - - lh.addStaticHoliday ("18-JAN-2038", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("15-FEB-2038", "Washingtons Birthday"); - - lh.addStaticHoliday ("31-MAY-2038", "Memorial Day"); - - lh.addStaticHoliday ("05-JUL-2038", "Independence Day"); - - lh.addStaticHoliday ("06-SEP-2038", "Labor Day"); - - lh.addStaticHoliday ("11-OCT-2038", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2038", "Veterans Day Observed"); - - lh.addStaticHoliday ("25-NOV-2038", "Thanksgiving Day"); - - lh.addStaticHoliday ("17-JAN-2039", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("21-FEB-2039", "Washingtons Birthday"); - - lh.addStaticHoliday ("30-MAY-2039", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2039", "Independence Day"); - - lh.addStaticHoliday ("05-SEP-2039", "Labor Day"); - - lh.addStaticHoliday ("10-OCT-2039", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2039", "Veterans Day Observed"); - - lh.addStaticHoliday ("24-NOV-2039", "Thanksgiving Day"); - - lh.addStaticHoliday ("26-DEC-2039", "Christmas Day"); - - lh.addStaticHoliday ("02-JAN-2040", "New Years Day"); - - lh.addStaticHoliday ("16-JAN-2040", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("20-FEB-2040", "Washingtons Birthday"); - - lh.addStaticHoliday ("28-MAY-2040", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2040", "Independence Day"); - - lh.addStaticHoliday ("03-SEP-2040", "Labor Day"); - - lh.addStaticHoliday ("08-OCT-2040", "Columbus Day"); - - lh.addStaticHoliday ("12-NOV-2040", "Veterans Day Observed"); - - lh.addStaticHoliday ("22-NOV-2040", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2040", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2041", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2041", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("18-FEB-2041", "Washingtons Birthday"); - - lh.addStaticHoliday ("27-MAY-2041", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2041", "Independence Day"); - - lh.addStaticHoliday ("02-SEP-2041", "Labor Day"); - - lh.addStaticHoliday ("14-OCT-2041", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2041", "Veterans Day Observed"); - - lh.addStaticHoliday ("28-NOV-2041", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2041", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2042", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2042", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("17-FEB-2042", "Washingtons Birthday"); - - lh.addStaticHoliday ("26-MAY-2042", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2042", "Independence Day"); - - lh.addStaticHoliday ("01-SEP-2042", "Labor Day"); - - lh.addStaticHoliday ("13-OCT-2042", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2042", "Veterans Day Observed"); - - lh.addStaticHoliday ("27-NOV-2042", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2042", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2043", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2043", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("16-FEB-2043", "Washingtons Birthday"); - - lh.addStaticHoliday ("25-MAY-2043", "Memorial Day"); - - lh.addStaticHoliday ("07-SEP-2043", "Labor Day"); - - lh.addStaticHoliday ("12-OCT-2043", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2043", "Veterans Day Observed"); - - lh.addStaticHoliday ("26-NOV-2043", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2043", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2044", "New Years Day"); - - lh.addStaticHoliday ("18-JAN-2044", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("15-FEB-2044", "Washingtons Birthday"); - - lh.addStaticHoliday ("30-MAY-2044", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2044", "Independence Day"); - - lh.addStaticHoliday ("05-SEP-2044", "Labor Day"); - - lh.addStaticHoliday ("10-OCT-2044", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2044", "Veterans Day Observed"); - - lh.addStaticHoliday ("24-NOV-2044", "Thanksgiving Day"); - - lh.addStaticHoliday ("26-DEC-2044", "Christmas Day"); - - lh.addStaticHoliday ("02-JAN-2045", "New Years Day"); - - lh.addStaticHoliday ("16-JAN-2045", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("20-FEB-2045", "Washingtons Birthday"); - - lh.addStaticHoliday ("29-MAY-2045", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2045", "Independence Day"); - - lh.addStaticHoliday ("04-SEP-2045", "Labor Day"); - - lh.addStaticHoliday ("09-OCT-2045", "Columbus Day"); - - lh.addStaticHoliday ("23-NOV-2045", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2045", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2046", "New Years Day"); - - lh.addStaticHoliday ("15-JAN-2046", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("19-FEB-2046", "Washingtons Birthday"); - - lh.addStaticHoliday ("28-MAY-2046", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2046", "Independence Day"); - - lh.addStaticHoliday ("03-SEP-2046", "Labor Day"); - - lh.addStaticHoliday ("08-OCT-2046", "Columbus Day"); - - lh.addStaticHoliday ("12-NOV-2046", "Veterans Day Observed"); - - lh.addStaticHoliday ("22-NOV-2046", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2046", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2047", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2047", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("18-FEB-2047", "Washingtons Birthday"); - - lh.addStaticHoliday ("27-MAY-2047", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2047", "Independence Day"); - - lh.addStaticHoliday ("02-SEP-2047", "Labor Day"); - - lh.addStaticHoliday ("14-OCT-2047", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2047", "Veterans Day Observed"); - - lh.addStaticHoliday ("28-NOV-2047", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2047", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2048", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2048", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("17-FEB-2048", "Washingtons Birthday"); - - lh.addStaticHoliday ("25-MAY-2048", "Memorial Day"); - - lh.addStaticHoliday ("07-SEP-2048", "Labor Day"); - - lh.addStaticHoliday ("12-OCT-2048", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2048", "Veterans Day Observed"); - - lh.addStaticHoliday ("26-NOV-2048", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2048", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2049", "New Years Day"); - - lh.addStaticHoliday ("18-JAN-2049", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("15-FEB-2049", "Washingtons Birthday"); - - lh.addStaticHoliday ("31-MAY-2049", "Memorial Day"); - - lh.addStaticHoliday ("05-JUL-2049", "Independence Day"); - - lh.addStaticHoliday ("06-SEP-2049", "Labor Day"); - - lh.addStaticHoliday ("11-OCT-2049", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2049", "Veterans Day Observed"); - - lh.addStaticHoliday ("25-NOV-2049", "Thanksgiving Day"); - - lh.addStaticHoliday ("17-JAN-2050", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("21-FEB-2050", "Washingtons Birthday"); - - lh.addStaticHoliday ("30-MAY-2050", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2050", "Independence Day"); - - lh.addStaticHoliday ("05-SEP-2050", "Labor Day"); - - lh.addStaticHoliday ("10-OCT-2050", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2050", "Veterans Day Observed"); - - lh.addStaticHoliday ("24-NOV-2050", "Thanksgiving Day"); - - lh.addStaticHoliday ("26-DEC-2050", "Christmas Day"); - - lh.addStaticHoliday ("02-JAN-2051", "New Years Day"); - - lh.addStaticHoliday ("16-JAN-2051", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("20-FEB-2051", "Washingtons Birthday"); - - lh.addStaticHoliday ("29-MAY-2051", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2051", "Independence Day"); - - lh.addStaticHoliday ("04-SEP-2051", "Labor Day"); - - lh.addStaticHoliday ("09-OCT-2051", "Columbus Day"); - - lh.addStaticHoliday ("23-NOV-2051", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2051", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2052", "New Years Day"); - - lh.addStaticHoliday ("15-JAN-2052", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("19-FEB-2052", "Washingtons Birthday"); - - lh.addStaticHoliday ("27-MAY-2052", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2052", "Independence Day"); - - lh.addStaticHoliday ("02-SEP-2052", "Labor Day"); - - lh.addStaticHoliday ("14-OCT-2052", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2052", "Veterans Day Observed"); - - lh.addStaticHoliday ("28-NOV-2052", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2052", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2053", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2053", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("17-FEB-2053", "Washingtons Birthday"); - - lh.addStaticHoliday ("26-MAY-2053", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2053", "Independence Day"); - - lh.addStaticHoliday ("01-SEP-2053", "Labor Day"); - - lh.addStaticHoliday ("13-OCT-2053", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2053", "Veterans Day Observed"); - - lh.addStaticHoliday ("27-NOV-2053", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2053", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2054", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2054", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("16-FEB-2054", "Washingtons Birthday"); - - lh.addStaticHoliday ("25-MAY-2054", "Memorial Day"); - - lh.addStaticHoliday ("07-SEP-2054", "Labor Day"); - - lh.addStaticHoliday ("12-OCT-2054", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2054", "Veterans Day Observed"); - - lh.addStaticHoliday ("26-NOV-2054", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2054", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2055", "New Years Day"); - - lh.addStaticHoliday ("18-JAN-2055", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("15-FEB-2055", "Washingtons Birthday"); - - lh.addStaticHoliday ("31-MAY-2055", "Memorial Day"); - - lh.addStaticHoliday ("05-JUL-2055", "Independence Day"); - - lh.addStaticHoliday ("06-SEP-2055", "Labor Day"); - - lh.addStaticHoliday ("11-OCT-2055", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2055", "Veterans Day Observed"); - - lh.addStaticHoliday ("25-NOV-2055", "Thanksgiving Day"); - - lh.addStaticHoliday ("17-JAN-2056", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("21-FEB-2056", "Washingtons Birthday"); - - lh.addStaticHoliday ("29-MAY-2056", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2056", "Independence Day"); - - lh.addStaticHoliday ("04-SEP-2056", "Labor Day"); - - lh.addStaticHoliday ("09-OCT-2056", "Columbus Day"); - - lh.addStaticHoliday ("23-NOV-2056", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2056", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2057", "New Years Day"); - - lh.addStaticHoliday ("15-JAN-2057", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("19-FEB-2057", "Washingtons Birthday"); - - lh.addStaticHoliday ("28-MAY-2057", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2057", "Independence Day"); - - lh.addStaticHoliday ("03-SEP-2057", "Labor Day"); - - lh.addStaticHoliday ("08-OCT-2057", "Columbus Day"); - - lh.addStaticHoliday ("12-NOV-2057", "Veterans Day Observed"); - - lh.addStaticHoliday ("22-NOV-2057", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2057", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2058", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2058", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("18-FEB-2058", "Washingtons Birthday"); - - lh.addStaticHoliday ("27-MAY-2058", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2058", "Independence Day"); - - lh.addStaticHoliday ("02-SEP-2058", "Labor Day"); - - lh.addStaticHoliday ("14-OCT-2058", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2058", "Veterans Day Observed"); - - lh.addStaticHoliday ("28-NOV-2058", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2058", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2059", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2059", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("17-FEB-2059", "Washingtons Birthday"); - - lh.addStaticHoliday ("26-MAY-2059", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2059", "Independence Day"); - - lh.addStaticHoliday ("01-SEP-2059", "Labor Day"); - - lh.addStaticHoliday ("13-OCT-2059", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2059", "Veterans Day Observed"); - - lh.addStaticHoliday ("27-NOV-2059", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2059", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2060", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2060", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("16-FEB-2060", "Washingtons Birthday"); - - lh.addStaticHoliday ("31-MAY-2060", "Memorial Day"); - - lh.addStaticHoliday ("05-JUL-2060", "Independence Day"); - - lh.addStaticHoliday ("06-SEP-2060", "Labor Day"); - - lh.addStaticHoliday ("11-OCT-2060", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2060", "Veterans Day Observed"); - - lh.addStaticHoliday ("25-NOV-2060", "Thanksgiving Day"); - - lh.addStaticHoliday ("17-JAN-2061", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("21-FEB-2061", "Washingtons Birthday"); - - lh.addStaticHoliday ("30-MAY-2061", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2061", "Independence Day"); - - lh.addStaticHoliday ("05-SEP-2061", "Labor Day"); - - lh.addStaticHoliday ("10-OCT-2061", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2061", "Veterans Day Observed"); - - lh.addStaticHoliday ("24-NOV-2061", "Thanksgiving Day"); - - lh.addStaticHoliday ("26-DEC-2061", "Christmas Day"); - - lh.addStaticHoliday ("02-JAN-2062", "New Years Day"); - - lh.addStaticHoliday ("16-JAN-2062", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("20-FEB-2062", "Washingtons Birthday"); - - lh.addStaticHoliday ("29-MAY-2062", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2062", "Independence Day"); - - lh.addStaticHoliday ("04-SEP-2062", "Labor Day"); - - lh.addStaticHoliday ("09-OCT-2062", "Columbus Day"); - - lh.addStaticHoliday ("23-NOV-2062", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2062", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2063", "New Years Day"); - - lh.addStaticHoliday ("15-JAN-2063", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("19-FEB-2063", "Washingtons Birthday"); - - lh.addStaticHoliday ("28-MAY-2063", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2063", "Independence Day"); - - lh.addStaticHoliday ("03-SEP-2063", "Labor Day"); - - lh.addStaticHoliday ("08-OCT-2063", "Columbus Day"); - - lh.addStaticHoliday ("12-NOV-2063", "Veterans Day Observed"); - - lh.addStaticHoliday ("22-NOV-2063", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2063", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2064", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2064", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("18-FEB-2064", "Washingtons Birthday"); - - lh.addStaticHoliday ("26-MAY-2064", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2064", "Independence Day"); - - lh.addStaticHoliday ("01-SEP-2064", "Labor Day"); - - lh.addStaticHoliday ("13-OCT-2064", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2064", "Veterans Day Observed"); - - lh.addStaticHoliday ("27-NOV-2064", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2064", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2065", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2065", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("16-FEB-2065", "Washingtons Birthday"); - - lh.addStaticHoliday ("25-MAY-2065", "Memorial Day"); - - lh.addStaticHoliday ("07-SEP-2065", "Labor Day"); - - lh.addStaticHoliday ("12-OCT-2065", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2065", "Veterans Day Observed"); - - lh.addStaticHoliday ("26-NOV-2065", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2065", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2066", "New Years Day"); - - lh.addStaticHoliday ("18-JAN-2066", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("15-FEB-2066", "Washingtons Birthday"); - - lh.addStaticHoliday ("31-MAY-2066", "Memorial Day"); - - lh.addStaticHoliday ("05-JUL-2066", "Independence Day"); - - lh.addStaticHoliday ("06-SEP-2066", "Labor Day"); - - lh.addStaticHoliday ("11-OCT-2066", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2066", "Veterans Day Observed"); - - lh.addStaticHoliday ("25-NOV-2066", "Thanksgiving Day"); - - lh.addStaticHoliday ("17-JAN-2067", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("21-FEB-2067", "Washingtons Birthday"); - - lh.addStaticHoliday ("30-MAY-2067", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2067", "Independence Day"); - - lh.addStaticHoliday ("05-SEP-2067", "Labor Day"); - - lh.addStaticHoliday ("10-OCT-2067", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2067", "Veterans Day Observed"); - - lh.addStaticHoliday ("24-NOV-2067", "Thanksgiving Day"); - - lh.addStaticHoliday ("26-DEC-2067", "Christmas Day"); - - lh.addStaticHoliday ("02-JAN-2068", "New Years Day"); - - lh.addStaticHoliday ("16-JAN-2068", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("20-FEB-2068", "Washingtons Birthday"); - - lh.addStaticHoliday ("28-MAY-2068", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2068", "Independence Day"); - - lh.addStaticHoliday ("03-SEP-2068", "Labor Day"); - - lh.addStaticHoliday ("08-OCT-2068", "Columbus Day"); - - lh.addStaticHoliday ("12-NOV-2068", "Veterans Day Observed"); - - lh.addStaticHoliday ("22-NOV-2068", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2068", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2069", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2069", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("18-FEB-2069", "Washingtons Birthday"); - - lh.addStaticHoliday ("27-MAY-2069", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2069", "Independence Day"); - - lh.addStaticHoliday ("02-SEP-2069", "Labor Day"); - - lh.addStaticHoliday ("14-OCT-2069", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2069", "Veterans Day Observed"); - - lh.addStaticHoliday ("28-NOV-2069", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2069", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2070", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2070", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("17-FEB-2070", "Washingtons Birthday"); - - lh.addStaticHoliday ("26-MAY-2070", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2070", "Independence Day"); - - lh.addStaticHoliday ("01-SEP-2070", "Labor Day"); - - lh.addStaticHoliday ("13-OCT-2070", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2070", "Veterans Day Observed"); - - lh.addStaticHoliday ("27-NOV-2070", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2070", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2071", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2071", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("16-FEB-2071", "Washingtons Birthday"); - - lh.addStaticHoliday ("25-MAY-2071", "Memorial Day"); - - lh.addStaticHoliday ("07-SEP-2071", "Labor Day"); - - lh.addStaticHoliday ("12-OCT-2071", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2071", "Veterans Day Observed"); - - lh.addStaticHoliday ("26-NOV-2071", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2071", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2072", "New Years Day"); - - lh.addStaticHoliday ("18-JAN-2072", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("15-FEB-2072", "Washingtons Birthday"); - - lh.addStaticHoliday ("30-MAY-2072", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2072", "Independence Day"); - - lh.addStaticHoliday ("05-SEP-2072", "Labor Day"); - - lh.addStaticHoliday ("10-OCT-2072", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2072", "Veterans Day Observed"); - - lh.addStaticHoliday ("24-NOV-2072", "Thanksgiving Day"); - - lh.addStaticHoliday ("26-DEC-2072", "Christmas Day"); - - lh.addStaticHoliday ("02-JAN-2073", "New Years Day"); - - lh.addStaticHoliday ("16-JAN-2073", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("20-FEB-2073", "Washingtons Birthday"); - - lh.addStaticHoliday ("29-MAY-2073", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2073", "Independence Day"); - - lh.addStaticHoliday ("04-SEP-2073", "Labor Day"); - - lh.addStaticHoliday ("09-OCT-2073", "Columbus Day"); - - lh.addStaticHoliday ("23-NOV-2073", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2073", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2074", "New Years Day"); - - lh.addStaticHoliday ("15-JAN-2074", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("19-FEB-2074", "Washingtons Birthday"); - - lh.addStaticHoliday ("28-MAY-2074", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2074", "Independence Day"); - - lh.addStaticHoliday ("03-SEP-2074", "Labor Day"); - - lh.addStaticHoliday ("08-OCT-2074", "Columbus Day"); - - lh.addStaticHoliday ("12-NOV-2074", "Veterans Day Observed"); - - lh.addStaticHoliday ("22-NOV-2074", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2074", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2075", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2075", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("18-FEB-2075", "Washingtons Birthday"); - - lh.addStaticHoliday ("27-MAY-2075", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2075", "Independence Day"); - - lh.addStaticHoliday ("02-SEP-2075", "Labor Day"); - - lh.addStaticHoliday ("14-OCT-2075", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2075", "Veterans Day Observed"); - - lh.addStaticHoliday ("28-NOV-2075", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2075", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2076", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2076", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("17-FEB-2076", "Washingtons Birthday"); - - lh.addStaticHoliday ("25-MAY-2076", "Memorial Day"); - - lh.addStaticHoliday ("07-SEP-2076", "Labor Day"); - - lh.addStaticHoliday ("12-OCT-2076", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2076", "Veterans Day Observed"); - - lh.addStaticHoliday ("26-NOV-2076", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2076", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2077", "New Years Day"); - - lh.addStaticHoliday ("18-JAN-2077", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("15-FEB-2077", "Washingtons Birthday"); - - lh.addStaticHoliday ("31-MAY-2077", "Memorial Day"); - - lh.addStaticHoliday ("05-JUL-2077", "Independence Day"); - - lh.addStaticHoliday ("06-SEP-2077", "Labor Day"); - - lh.addStaticHoliday ("11-OCT-2077", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2077", "Veterans Day Observed"); - - lh.addStaticHoliday ("25-NOV-2077", "Thanksgiving Day"); - - lh.addStaticHoliday ("17-JAN-2078", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("21-FEB-2078", "Washingtons Birthday"); - - lh.addStaticHoliday ("30-MAY-2078", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2078", "Independence Day"); - - lh.addStaticHoliday ("05-SEP-2078", "Labor Day"); - - lh.addStaticHoliday ("10-OCT-2078", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2078", "Veterans Day Observed"); - - lh.addStaticHoliday ("24-NOV-2078", "Thanksgiving Day"); - - lh.addStaticHoliday ("26-DEC-2078", "Christmas Day"); - - lh.addStaticHoliday ("02-JAN-2079", "New Years Day"); - - lh.addStaticHoliday ("16-JAN-2079", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("20-FEB-2079", "Washingtons Birthday"); - - lh.addStaticHoliday ("29-MAY-2079", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2079", "Independence Day"); - - lh.addStaticHoliday ("04-SEP-2079", "Labor Day"); - - lh.addStaticHoliday ("09-OCT-2079", "Columbus Day"); - - lh.addStaticHoliday ("23-NOV-2079", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2079", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2080", "New Years Day"); - - lh.addStaticHoliday ("15-JAN-2080", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("19-FEB-2080", "Washingtons Birthday"); - - lh.addStaticHoliday ("27-MAY-2080", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2080", "Independence Day"); - - lh.addStaticHoliday ("02-SEP-2080", "Labor Day"); - - lh.addStaticHoliday ("14-OCT-2080", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2080", "Veterans Day Observed"); - - lh.addStaticHoliday ("28-NOV-2080", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2080", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2081", "New Years Day"); - - lh.addStaticHoliday ("20-JAN-2081", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("17-FEB-2081", "Washingtons Birthday"); - - lh.addStaticHoliday ("26-MAY-2081", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2081", "Independence Day"); - - lh.addStaticHoliday ("01-SEP-2081", "Labor Day"); - - lh.addStaticHoliday ("13-OCT-2081", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2081", "Veterans Day Observed"); - - lh.addStaticHoliday ("27-NOV-2081", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2081", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2082", "New Years Day"); - - lh.addStaticHoliday ("19-JAN-2082", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("16-FEB-2082", "Washingtons Birthday"); - - lh.addStaticHoliday ("25-MAY-2082", "Memorial Day"); - - lh.addStaticHoliday ("07-SEP-2082", "Labor Day"); - - lh.addStaticHoliday ("12-OCT-2082", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2082", "Veterans Day Observed"); - - lh.addStaticHoliday ("26-NOV-2082", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2082", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2083", "New Years Day"); - - lh.addStaticHoliday ("18-JAN-2083", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("15-FEB-2083", "Washingtons Birthday"); - - lh.addStaticHoliday ("31-MAY-2083", "Memorial Day"); - - lh.addStaticHoliday ("05-JUL-2083", "Independence Day"); - - lh.addStaticHoliday ("06-SEP-2083", "Labor Day"); - - lh.addStaticHoliday ("11-OCT-2083", "Columbus Day"); - - lh.addStaticHoliday ("11-NOV-2083", "Veterans Day Observed"); - - lh.addStaticHoliday ("25-NOV-2083", "Thanksgiving Day"); - - lh.addStaticHoliday ("17-JAN-2084", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("21-FEB-2084", "Washingtons Birthday"); - - lh.addStaticHoliday ("29-MAY-2084", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2084", "Independence Day"); - - lh.addStaticHoliday ("04-SEP-2084", "Labor Day"); - - lh.addStaticHoliday ("09-OCT-2084", "Columbus Day"); - - lh.addStaticHoliday ("23-NOV-2084", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2084", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2085", "New Years Day"); - - lh.addStaticHoliday ("15-JAN-2085", "Martin Luther Kings Birthday"); - - lh.addStaticHoliday ("19-FEB-2085", "Washingtons Birthday"); - - lh.addStaticHoliday ("28-MAY-2085", "Memorial Day"); - - lh.addStaticHoliday ("04-JUL-2085", "Independence Day"); - - lh.addStaticHoliday ("03-SEP-2085", "Labor Day"); - - lh.addStaticHoliday ("08-OCT-2085", "Columbus Day"); - - lh.addStaticHoliday ("12-NOV-2085", "Veterans Day Observed"); - - lh.addStaticHoliday ("22-NOV-2085", "Thanksgiving Day"); - - lh.addStaticHoliday ("25-DEC-2085", "Christmas Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/USVHoliday.java b/org/drip/analytics/holset/USVHoliday.java deleted file mode 100644 index d6316eb..0000000 --- a/org/drip/analytics/holset/USVHoliday.java +++ /dev/null @@ -1,61 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class USVHoliday implements org.drip.analytics.holset.LocationHoliday { - public USVHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "USV"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("03 Independence Day Observed-JUL-2009", ""); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/UVRHoliday.java b/org/drip/analytics/holset/UVRHoliday.java deleted file mode 100644 index bf51ac2..0000000 --- a/org/drip/analytics/holset/UVRHoliday.java +++ /dev/null @@ -1,1059 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class UVRHoliday implements org.drip.analytics.holset.LocationHoliday { - public UVRHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "UVR"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-1998", "Epiphany"); - - lh.addStaticHoliday ("23-MAR-1998", "St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-1998", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labor Day"); - - lh.addStaticHoliday ("25-MAY-1998", "Ascension Day Observed"); - - lh.addStaticHoliday ("15-JUN-1998", "Corpus Christi Observed"); - - lh.addStaticHoliday ("22-JUN-1998", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("29-JUN-1998", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-1998", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-1998", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-1998", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-1998", "Columbus Day"); - - lh.addStaticHoliday ("02-NOV-1998", "All Saints Day"); - - lh.addStaticHoliday ("16-NOV-1998", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-1998", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-1999", "Epiphany"); - - lh.addStaticHoliday ("22-MAR-1999", "St. Josephs Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("17-MAY-1999", "Ascension Day Observed"); - - lh.addStaticHoliday ("07-JUN-1999", "Corpus Christi Observed"); - - lh.addStaticHoliday ("14-JUN-1999", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("05-JUL-1999", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-1999", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-1999", "Assumption Day"); - - lh.addStaticHoliday ("18-OCT-1999", "Columbus Day"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("15-NOV-1999", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-1999", "Immaculate Conception"); - - lh.addStaticHoliday ("10-JAN-2000", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2000", "St. Josephs Day"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labor Day"); - - lh.addStaticHoliday ("05-JUN-2000", "Ascension Day Observed"); - - lh.addStaticHoliday ("26-JUN-2000", "Corpus Christi Observed"); - - lh.addStaticHoliday ("03-JUL-2000", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2000", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2000", "National Holiday"); - - lh.addStaticHoliday ("21-AUG-2000", "Assumption Day"); - - lh.addStaticHoliday ("16-OCT-2000", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2000", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2000", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2001", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2001", "St. Josephs Day"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labor Day"); - - lh.addStaticHoliday ("28-MAY-2001", "Ascension Day Observed"); - - lh.addStaticHoliday ("18-JUN-2001", "Corpus Christi Observed"); - - lh.addStaticHoliday ("25-JUN-2001", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("02-JUL-2001", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2001", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2001", "National Holiday"); - - lh.addStaticHoliday ("20-AUG-2001", "Assumption Day"); - - lh.addStaticHoliday ("15-OCT-2001", "Columbus Day"); - - lh.addStaticHoliday ("05-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("12-NOV-2001", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2002", "Epiphany"); - - lh.addStaticHoliday ("25-MAR-2002", "St. Josephs Day"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labor Day"); - - lh.addStaticHoliday ("13-MAY-2002", "Ascension Day Observed"); - - lh.addStaticHoliday ("03-JUN-2002", "Corpus Christi Observed"); - - lh.addStaticHoliday ("10-JUN-2002", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("01-JUL-2002", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2002", "National Holiday"); - - lh.addStaticHoliday ("19-AUG-2002", "Assumption Day"); - - lh.addStaticHoliday ("14-OCT-2002", "Columbus Day"); - - lh.addStaticHoliday ("04-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2002", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2003", "Epiphany"); - - lh.addStaticHoliday ("24-MAR-2003", "St. Josephs Day"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labor Day"); - - lh.addStaticHoliday ("02-JUN-2003", "Ascension Day Observed"); - - lh.addStaticHoliday ("23-JUN-2003", "Corpus Christi Observed"); - - lh.addStaticHoliday ("30-JUN-2003", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2003", "National Holiday"); - - lh.addStaticHoliday ("18-AUG-2003", "Assumption Day"); - - lh.addStaticHoliday ("13-OCT-2003", "Columbus Day"); - - lh.addStaticHoliday ("03-NOV-2003", "All Saints Day"); - - lh.addStaticHoliday ("17-NOV-2003", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2004", "Epiphany"); - - lh.addStaticHoliday ("22-MAR-2004", "St. Josephs Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("24-MAY-2004", "Ascension Day Observed"); - - lh.addStaticHoliday ("14-JUN-2004", "Corpus Christi Observed"); - - lh.addStaticHoliday ("21-JUN-2004", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("05-JUL-2004", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2004", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2004", "Assumption Day"); - - lh.addStaticHoliday ("18-OCT-2004", "Columbus Day"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("15-NOV-2004", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2004", "Immaculate Conception"); - - lh.addStaticHoliday ("10-JAN-2005", "Epiphany"); - - lh.addStaticHoliday ("21-MAR-2005", "St. Josephs Day"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("09-MAY-2005", "Ascension Day Observed"); - - lh.addStaticHoliday ("30-MAY-2005", "Corpus Christi Observed"); - - lh.addStaticHoliday ("06-JUN-2005", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("04-JUL-2005", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2005", "Independence Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("17-OCT-2005", "Columbus Day"); - - lh.addStaticHoliday ("07-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("14-NOV-2005", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2005", "Immaculate Conception"); - - lh.addStaticHoliday ("09-JAN-2006", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2006", "St. Josephs Day"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labor Day"); - - lh.addStaticHoliday ("29-MAY-2006", "Ascension Day Observed"); - - lh.addStaticHoliday ("19-JUN-2006", "Corpus Christi Observed"); - - lh.addStaticHoliday ("26-JUN-2006", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("03-JUL-2006", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2006", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2006", "National Holiday"); - - lh.addStaticHoliday ("21-AUG-2006", "Assumption Day"); - - lh.addStaticHoliday ("16-OCT-2006", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2006", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2006", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2007", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2007", "St. Josephs Day"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labor Day"); - - lh.addStaticHoliday ("21-MAY-2007", "Ascension Day Observed"); - - lh.addStaticHoliday ("11-JUN-2007", "Corpus Christi Observed"); - - lh.addStaticHoliday ("18-JUN-2007", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("02-JUL-2007", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2007", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2007", "National Holiday"); - - lh.addStaticHoliday ("20-AUG-2007", "Assumption Day"); - - lh.addStaticHoliday ("15-OCT-2007", "Columbus Day"); - - lh.addStaticHoliday ("05-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("12-NOV-2007", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2008", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "St. Josephs Day"); - - lh.addStaticHoliday ("01-MAY-2008", "Labor Day"); - - lh.addStaticHoliday ("05-MAY-2008", "Ascension Day Observed"); - - lh.addStaticHoliday ("26-MAY-2008", "Corpus Christi Observed"); - - lh.addStaticHoliday ("02-JUN-2008", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("30-JUN-2008", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2008", "National Holiday"); - - lh.addStaticHoliday ("18-AUG-2008", "Assumption Day"); - - lh.addStaticHoliday ("13-OCT-2008", "Columbus Day"); - - lh.addStaticHoliday ("03-NOV-2008", "All Saints Day"); - - lh.addStaticHoliday ("17-NOV-2008", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2009", "Epiphany"); - - lh.addStaticHoliday ("23-MAR-2009", "St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labor Day"); - - lh.addStaticHoliday ("25-MAY-2009", "Ascension Day Observed"); - - lh.addStaticHoliday ("15-JUN-2009", "Corpus Christi Observed"); - - lh.addStaticHoliday ("22-JUN-2009", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("29-JUN-2009", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2009", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2009", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-2009", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2009", "Columbus Day"); - - lh.addStaticHoliday ("02-NOV-2009", "All Saints Day"); - - lh.addStaticHoliday ("16-NOV-2009", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2009", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2010", "Epiphany"); - - lh.addStaticHoliday ("22-MAR-2010", "St. Josephs Day"); - - lh.addStaticHoliday ("01-APR-2010", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("17-MAY-2010", "Ascension Day Observed"); - - lh.addStaticHoliday ("07-JUN-2010", "Corpus Christi Observed"); - - lh.addStaticHoliday ("14-JUN-2010", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("05-JUL-2010", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2010", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2010", "Assumption Day"); - - lh.addStaticHoliday ("18-OCT-2010", "Columbus Day"); - - lh.addStaticHoliday ("01-NOV-2010", "All Saints Day"); - - lh.addStaticHoliday ("15-NOV-2010", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2010", "Immaculate Conception"); - - lh.addStaticHoliday ("10-JAN-2011", "Epiphany"); - - lh.addStaticHoliday ("21-MAR-2011", "St. Josephs Day"); - - lh.addStaticHoliday ("21-APR-2011", "Holy Thursday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("06-JUN-2011", "Ascension Day Observed"); - - lh.addStaticHoliday ("27-JUN-2011", "Corpus Christi Observed"); - - lh.addStaticHoliday ("04-JUL-2011", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2011", "Independence Day"); - - lh.addStaticHoliday ("15-AUG-2011", "Assumption Day"); - - lh.addStaticHoliday ("17-OCT-2011", "Columbus Day"); - - lh.addStaticHoliday ("07-NOV-2011", "All Saints Day"); - - lh.addStaticHoliday ("14-NOV-2011", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2011", "Immaculate Conception"); - - lh.addStaticHoliday ("09-JAN-2012", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2012", "St. Josephs Day"); - - lh.addStaticHoliday ("05-APR-2012", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labor Day"); - - lh.addStaticHoliday ("21-MAY-2012", "Ascension Day Observed"); - - lh.addStaticHoliday ("11-JUN-2012", "Corpus Christi Observed"); - - lh.addStaticHoliday ("18-JUN-2012", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("02-JUL-2012", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2012", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2012", "National Holiday"); - - lh.addStaticHoliday ("20-AUG-2012", "Assumption Day"); - - lh.addStaticHoliday ("15-OCT-2012", "Columbus Day"); - - lh.addStaticHoliday ("05-NOV-2012", "All Saints Day"); - - lh.addStaticHoliday ("12-NOV-2012", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2013", "Epiphany"); - - lh.addStaticHoliday ("25-MAR-2013", "St. Josephs Day"); - - lh.addStaticHoliday ("28-MAR-2013", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labor Day"); - - lh.addStaticHoliday ("13-MAY-2013", "Ascension Day Observed"); - - lh.addStaticHoliday ("03-JUN-2013", "Corpus Christi Observed"); - - lh.addStaticHoliday ("10-JUN-2013", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("01-JUL-2013", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2013", "National Holiday"); - - lh.addStaticHoliday ("19-AUG-2013", "Assumption Day"); - - lh.addStaticHoliday ("14-OCT-2013", "Columbus Day"); - - lh.addStaticHoliday ("04-NOV-2013", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2013", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2014", "Epiphany"); - - lh.addStaticHoliday ("24-MAR-2014", "St. Josephs Day"); - - lh.addStaticHoliday ("17-APR-2014", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labor Day"); - - lh.addStaticHoliday ("02-JUN-2014", "Ascension Day Observed"); - - lh.addStaticHoliday ("23-JUN-2014", "Corpus Christi Observed"); - - lh.addStaticHoliday ("30-JUN-2014", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2014", "National Holiday"); - - lh.addStaticHoliday ("18-AUG-2014", "Assumption Day"); - - lh.addStaticHoliday ("13-OCT-2014", "Columbus Day"); - - lh.addStaticHoliday ("03-NOV-2014", "All Saints Day"); - - lh.addStaticHoliday ("17-NOV-2014", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2014", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2015", "Epiphany"); - - lh.addStaticHoliday ("23-MAR-2015", "St. Josephs Day"); - - lh.addStaticHoliday ("02-APR-2015", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labor Day"); - - lh.addStaticHoliday ("18-MAY-2015", "Ascension Day Observed"); - - lh.addStaticHoliday ("08-JUN-2015", "Corpus Christi Observed"); - - lh.addStaticHoliday ("15-JUN-2015", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("29-JUN-2015", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2015", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2015", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-2015", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2015", "Columbus Day"); - - lh.addStaticHoliday ("02-NOV-2015", "All Saints Day"); - - lh.addStaticHoliday ("16-NOV-2015", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2015", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2016", "Epiphany"); - - lh.addStaticHoliday ("21-MAR-2016", "St. Josephs Day"); - - lh.addStaticHoliday ("24-MAR-2016", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("09-MAY-2016", "Ascension Day Observed"); - - lh.addStaticHoliday ("30-MAY-2016", "Corpus Christi Observed"); - - lh.addStaticHoliday ("06-JUN-2016", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("04-JUL-2016", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2016", "Independence Day"); - - lh.addStaticHoliday ("15-AUG-2016", "Assumption Day"); - - lh.addStaticHoliday ("17-OCT-2016", "Columbus Day"); - - lh.addStaticHoliday ("07-NOV-2016", "All Saints Day"); - - lh.addStaticHoliday ("14-NOV-2016", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2016", "Immaculate Conception"); - - lh.addStaticHoliday ("09-JAN-2017", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2017", "St. Josephs Day"); - - lh.addStaticHoliday ("13-APR-2017", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labor Day"); - - lh.addStaticHoliday ("29-MAY-2017", "Ascension Day Observed"); - - lh.addStaticHoliday ("19-JUN-2017", "Corpus Christi Observed"); - - lh.addStaticHoliday ("26-JUN-2017", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("03-JUL-2017", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2017", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2017", "National Holiday"); - - lh.addStaticHoliday ("21-AUG-2017", "Assumption Day"); - - lh.addStaticHoliday ("16-OCT-2017", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2017", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2017", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2017", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2018", "Epiphany"); - - lh.addStaticHoliday ("19-MAR-2018", "St. Josephs Day"); - - lh.addStaticHoliday ("29-MAR-2018", "Holy Thursday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labor Day"); - - lh.addStaticHoliday ("14-MAY-2018", "Ascension Day Observed"); - - lh.addStaticHoliday ("04-JUN-2018", "Corpus Christi Observed"); - - lh.addStaticHoliday ("11-JUN-2018", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("02-JUL-2018", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2018", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2018", "National Holiday"); - - lh.addStaticHoliday ("20-AUG-2018", "Assumption Day"); - - lh.addStaticHoliday ("15-OCT-2018", "Columbus Day"); - - lh.addStaticHoliday ("05-NOV-2018", "All Saints Day"); - - lh.addStaticHoliday ("12-NOV-2018", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("07-JAN-2019", "Epiphany"); - - lh.addStaticHoliday ("25-MAR-2019", "St. Josephs Day"); - - lh.addStaticHoliday ("18-APR-2019", "Holy Thursday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labor Day"); - - lh.addStaticHoliday ("03-JUN-2019", "Ascension Day Observed"); - - lh.addStaticHoliday ("24-JUN-2019", "Corpus Christi Observed"); - - lh.addStaticHoliday ("01-JUL-2019", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2019", "National Holiday"); - - lh.addStaticHoliday ("19-AUG-2019", "Assumption Day"); - - lh.addStaticHoliday ("14-OCT-2019", "Columbus Day"); - - lh.addStaticHoliday ("04-NOV-2019", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2019", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2020", "Epiphany"); - - lh.addStaticHoliday ("23-MAR-2020", "St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-2020", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labor Day"); - - lh.addStaticHoliday ("25-MAY-2020", "Ascension Day Observed"); - - lh.addStaticHoliday ("15-JUN-2020", "Corpus Christi Observed"); - - lh.addStaticHoliday ("22-JUN-2020", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("29-JUN-2020", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2020", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2020", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-2020", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2020", "Columbus Day"); - - lh.addStaticHoliday ("02-NOV-2020", "All Saints Day"); - - lh.addStaticHoliday ("16-NOV-2020", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2020", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2021", "Epiphany"); - - lh.addStaticHoliday ("22-MAR-2021", "St. Josephs Day"); - - lh.addStaticHoliday ("01-APR-2021", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("17-MAY-2021", "Ascension Day Observed"); - - lh.addStaticHoliday ("07-JUN-2021", "Corpus Christi Observed"); - - lh.addStaticHoliday ("14-JUN-2021", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("05-JUL-2021", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2021", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2021", "Assumption Day"); - - lh.addStaticHoliday ("18-OCT-2021", "Columbus Day"); - - lh.addStaticHoliday ("01-NOV-2021", "All Saints Day"); - - lh.addStaticHoliday ("15-NOV-2021", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2021", "Immaculate Conception"); - - lh.addStaticHoliday ("10-JAN-2022", "Epiphany"); - - lh.addStaticHoliday ("21-MAR-2022", "St. Josephs Day"); - - lh.addStaticHoliday ("14-APR-2022", "Holy Thursday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("30-MAY-2022", "Ascension Day Observed"); - - lh.addStaticHoliday ("20-JUN-2022", "Corpus Christi Observed"); - - lh.addStaticHoliday ("27-JUN-2022", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("04-JUL-2022", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2022", "Independence Day"); - - lh.addStaticHoliday ("15-AUG-2022", "Assumption Day"); - - lh.addStaticHoliday ("17-OCT-2022", "Columbus Day"); - - lh.addStaticHoliday ("07-NOV-2022", "All Saints Day"); - - lh.addStaticHoliday ("14-NOV-2022", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2022", "Immaculate Conception"); - - lh.addStaticHoliday ("09-JAN-2023", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2023", "St. Josephs Day"); - - lh.addStaticHoliday ("06-APR-2023", "Holy Thursday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labor Day"); - - lh.addStaticHoliday ("22-MAY-2023", "Ascension Day Observed"); - - lh.addStaticHoliday ("12-JUN-2023", "Corpus Christi Observed"); - - lh.addStaticHoliday ("19-JUN-2023", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("03-JUL-2023", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2023", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2023", "National Holiday"); - - lh.addStaticHoliday ("21-AUG-2023", "Assumption Day"); - - lh.addStaticHoliday ("16-OCT-2023", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2023", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2023", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2023", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("08-JAN-2024", "Epiphany"); - - lh.addStaticHoliday ("25-MAR-2024", "St. Josephs Day"); - - lh.addStaticHoliday ("28-MAR-2024", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labor Day"); - - lh.addStaticHoliday ("13-MAY-2024", "Ascension Day Observed"); - - lh.addStaticHoliday ("03-JUN-2024", "Corpus Christi Observed"); - - lh.addStaticHoliday ("10-JUN-2024", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("01-JUL-2024", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2024", "National Holiday"); - - lh.addStaticHoliday ("19-AUG-2024", "Assumption Day"); - - lh.addStaticHoliday ("14-OCT-2024", "Columbus Day"); - - lh.addStaticHoliday ("04-NOV-2024", "All Saints Day"); - - lh.addStaticHoliday ("11-NOV-2024", "Independence of Cartagena"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2025", "Epiphany"); - - lh.addStaticHoliday ("24-MAR-2025", "St. Josephs Day"); - - lh.addStaticHoliday ("17-APR-2025", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labor Day"); - - lh.addStaticHoliday ("02-JUN-2025", "Ascension Day Observed"); - - lh.addStaticHoliday ("23-JUN-2025", "Corpus Christi Observed"); - - lh.addStaticHoliday ("30-JUN-2025", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("07-AUG-2025", "National Holiday"); - - lh.addStaticHoliday ("18-AUG-2025", "Assumption Day"); - - lh.addStaticHoliday ("13-OCT-2025", "Columbus Day"); - - lh.addStaticHoliday ("03-NOV-2025", "All Saints Day"); - - lh.addStaticHoliday ("17-NOV-2025", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2025", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("12-JAN-2026", "Epiphany"); - - lh.addStaticHoliday ("23-MAR-2026", "St. Josephs Day"); - - lh.addStaticHoliday ("02-APR-2026", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labor Day"); - - lh.addStaticHoliday ("18-MAY-2026", "Ascension Day Observed"); - - lh.addStaticHoliday ("08-JUN-2026", "Corpus Christi Observed"); - - lh.addStaticHoliday ("15-JUN-2026", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("29-JUN-2026", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2026", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2026", "National Holiday"); - - lh.addStaticHoliday ("17-AUG-2026", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2026", "Columbus Day"); - - lh.addStaticHoliday ("02-NOV-2026", "All Saints Day"); - - lh.addStaticHoliday ("16-NOV-2026", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2026", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2027", "Epiphany"); - - lh.addStaticHoliday ("22-MAR-2027", "St. Josephs Day"); - - lh.addStaticHoliday ("25-MAR-2027", "Holy Thursday"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("10-MAY-2027", "Ascension Day Observed"); - - lh.addStaticHoliday ("31-MAY-2027", "Corpus Christi Observed"); - - lh.addStaticHoliday ("07-JUN-2027", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("05-JUL-2027", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2027", "Independence Day"); - - lh.addStaticHoliday ("16-AUG-2027", "Assumption Day"); - - lh.addStaticHoliday ("18-OCT-2027", "Columbus Day"); - - lh.addStaticHoliday ("01-NOV-2027", "All Saints Day"); - - lh.addStaticHoliday ("15-NOV-2027", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2027", "Immaculate Conception"); - - lh.addStaticHoliday ("10-JAN-2028", "Epiphany"); - - lh.addStaticHoliday ("20-MAR-2028", "St. Josephs Day"); - - lh.addStaticHoliday ("13-APR-2028", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labor Day"); - - lh.addStaticHoliday ("29-MAY-2028", "Ascension Day Observed"); - - lh.addStaticHoliday ("19-JUN-2028", "Corpus Christi Observed"); - - lh.addStaticHoliday ("26-JUN-2028", "Sacred Heart of Jesus"); - - lh.addStaticHoliday ("03-JUL-2028", "Sts. Peter and Paul Day"); - - lh.addStaticHoliday ("20-JUL-2028", "Independence Day"); - - lh.addStaticHoliday ("07-AUG-2028", "National Holiday"); - - lh.addStaticHoliday ("21-AUG-2028", "Assumption Day"); - - lh.addStaticHoliday ("16-OCT-2028", "Columbus Day"); - - lh.addStaticHoliday ("06-NOV-2028", "All Saints Day"); - - lh.addStaticHoliday ("13-NOV-2028", "Independence of Cartagena"); - - lh.addStaticHoliday ("08-DEC-2028", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/UYUHoliday.java b/org/drip/analytics/holset/UYUHoliday.java deleted file mode 100644 index 66346c7..0000000 --- a/org/drip/analytics/holset/UYUHoliday.java +++ /dev/null @@ -1,1215 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class UYUHoliday implements org.drip.analytics.holset.LocationHoliday { - public UYUHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "UYU"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("04-FEB-2008", ""); - - lh.addStaticHoliday ("05-FEB-2008", ""); - - lh.addStaticHoliday ("21-MAR-2008", ""); - - lh.addStaticHoliday ("01-MAY-2008", ""); - - lh.addStaticHoliday ("19-JUN-2008", ""); - - lh.addStaticHoliday ("18-JUL-2008", ""); - - lh.addStaticHoliday ("25-AUG-2008", ""); - - lh.addStaticHoliday ("25-DEC-2008", ""); - - lh.addStaticHoliday ("01-JAN-2009", ""); - - lh.addStaticHoliday ("06-JAN-2009", ""); - - lh.addStaticHoliday ("23-FEB-2009", ""); - - lh.addStaticHoliday ("24-FEB-2009", ""); - - lh.addStaticHoliday ("10-APR-2009", ""); - - lh.addStaticHoliday ("01-MAY-2009", ""); - - lh.addStaticHoliday ("18-MAY-2009", ""); - - lh.addStaticHoliday ("19-JUN-2009", ""); - - lh.addStaticHoliday ("25-AUG-2009", ""); - - lh.addStaticHoliday ("12-OCT-2009", ""); - - lh.addStaticHoliday ("02-NOV-2009", ""); - - lh.addStaticHoliday ("25-DEC-2009", ""); - - lh.addStaticHoliday ("01-JAN-2010", ""); - - lh.addStaticHoliday ("06-JAN-2010", ""); - - lh.addStaticHoliday ("15-FEB-2010", ""); - - lh.addStaticHoliday ("16-FEB-2010", ""); - - lh.addStaticHoliday ("01-MAR-2010", ""); - - lh.addStaticHoliday ("02-APR-2010", ""); - - lh.addStaticHoliday ("19-APR-2010", ""); - - lh.addStaticHoliday ("17-MAY-2010", ""); - - lh.addStaticHoliday ("25-AUG-2010", ""); - - lh.addStaticHoliday ("11-OCT-2010", ""); - - lh.addStaticHoliday ("02-NOV-2010", ""); - - lh.addStaticHoliday ("06-JAN-2011", ""); - - lh.addStaticHoliday ("07-MAR-2011", ""); - - lh.addStaticHoliday ("08-MAR-2011", ""); - - lh.addStaticHoliday ("18-APR-2011", ""); - - lh.addStaticHoliday ("22-APR-2011", ""); - - lh.addStaticHoliday ("16-MAY-2011", ""); - - lh.addStaticHoliday ("18-JUL-2011", ""); - - lh.addStaticHoliday ("25-AUG-2011", ""); - - lh.addStaticHoliday ("10-OCT-2011", ""); - - lh.addStaticHoliday ("02-NOV-2011", ""); - - lh.addStaticHoliday ("06-JAN-2012", ""); - - lh.addStaticHoliday ("20-FEB-2012", ""); - - lh.addStaticHoliday ("21-FEB-2012", ""); - - lh.addStaticHoliday ("06-APR-2012", ""); - - lh.addStaticHoliday ("23-APR-2012", ""); - - lh.addStaticHoliday ("01-MAY-2012", ""); - - lh.addStaticHoliday ("21-MAY-2012", ""); - - lh.addStaticHoliday ("19-JUN-2012", ""); - - lh.addStaticHoliday ("18-JUL-2012", ""); - - lh.addStaticHoliday ("15-OCT-2012", ""); - - lh.addStaticHoliday ("02-NOV-2012", ""); - - lh.addStaticHoliday ("25-DEC-2012", ""); - - lh.addStaticHoliday ("01-JAN-2013", ""); - - lh.addStaticHoliday ("11-FEB-2013", ""); - - lh.addStaticHoliday ("12-FEB-2013", ""); - - lh.addStaticHoliday ("29-MAR-2013", ""); - - lh.addStaticHoliday ("22-APR-2013", ""); - - lh.addStaticHoliday ("01-MAY-2013", ""); - - lh.addStaticHoliday ("19-JUN-2013", ""); - - lh.addStaticHoliday ("18-JUL-2013", ""); - - lh.addStaticHoliday ("25-DEC-2013", ""); - - lh.addStaticHoliday ("01-JAN-2014", ""); - - lh.addStaticHoliday ("06-JAN-2014", ""); - - lh.addStaticHoliday ("03-MAR-2014", ""); - - lh.addStaticHoliday ("04-MAR-2014", ""); - - lh.addStaticHoliday ("18-APR-2014", ""); - - lh.addStaticHoliday ("01-MAY-2014", ""); - - lh.addStaticHoliday ("19-JUN-2014", ""); - - lh.addStaticHoliday ("18-JUL-2014", ""); - - lh.addStaticHoliday ("25-AUG-2014", ""); - - lh.addStaticHoliday ("25-DEC-2014", ""); - - lh.addStaticHoliday ("01-JAN-2015", ""); - - lh.addStaticHoliday ("06-JAN-2015", ""); - - lh.addStaticHoliday ("16-FEB-2015", ""); - - lh.addStaticHoliday ("17-FEB-2015", ""); - - lh.addStaticHoliday ("03-APR-2015", ""); - - lh.addStaticHoliday ("01-MAY-2015", ""); - - lh.addStaticHoliday ("18-MAY-2015", ""); - - lh.addStaticHoliday ("19-JUN-2015", ""); - - lh.addStaticHoliday ("25-AUG-2015", ""); - - lh.addStaticHoliday ("12-OCT-2015", ""); - - lh.addStaticHoliday ("02-NOV-2015", ""); - - lh.addStaticHoliday ("25-DEC-2015", ""); - - lh.addStaticHoliday ("01-JAN-2016", ""); - - lh.addStaticHoliday ("06-JAN-2016", ""); - - lh.addStaticHoliday ("08-FEB-2016", ""); - - lh.addStaticHoliday ("09-FEB-2016", ""); - - lh.addStaticHoliday ("25-MAR-2016", ""); - - lh.addStaticHoliday ("18-APR-2016", ""); - - lh.addStaticHoliday ("16-MAY-2016", ""); - - lh.addStaticHoliday ("18-JUL-2016", ""); - - lh.addStaticHoliday ("25-AUG-2016", ""); - - lh.addStaticHoliday ("10-OCT-2016", ""); - - lh.addStaticHoliday ("02-NOV-2016", ""); - - lh.addStaticHoliday ("06-JAN-2017", ""); - - lh.addStaticHoliday ("27-FEB-2017", ""); - - lh.addStaticHoliday ("28-FEB-2017", ""); - - lh.addStaticHoliday ("14-APR-2017", ""); - - lh.addStaticHoliday ("17-APR-2017", ""); - - lh.addStaticHoliday ("01-MAY-2017", ""); - - lh.addStaticHoliday ("22-MAY-2017", ""); - - lh.addStaticHoliday ("19-JUN-2017", ""); - - lh.addStaticHoliday ("18-JUL-2017", ""); - - lh.addStaticHoliday ("25-AUG-2017", ""); - - lh.addStaticHoliday ("16-OCT-2017", ""); - - lh.addStaticHoliday ("02-NOV-2017", ""); - - lh.addStaticHoliday ("25-DEC-2017", ""); - - lh.addStaticHoliday ("01-JAN-2018", ""); - - lh.addStaticHoliday ("12-FEB-2018", ""); - - lh.addStaticHoliday ("13-FEB-2018", ""); - - lh.addStaticHoliday ("30-MAR-2018", ""); - - lh.addStaticHoliday ("23-APR-2018", ""); - - lh.addStaticHoliday ("01-MAY-2018", ""); - - lh.addStaticHoliday ("21-MAY-2018", ""); - - lh.addStaticHoliday ("19-JUN-2018", ""); - - lh.addStaticHoliday ("18-JUL-2018", ""); - - lh.addStaticHoliday ("15-OCT-2018", ""); - - lh.addStaticHoliday ("02-NOV-2018", ""); - - lh.addStaticHoliday ("25-DEC-2018", ""); - - lh.addStaticHoliday ("01-JAN-2019", ""); - - lh.addStaticHoliday ("04-MAR-2019", ""); - - lh.addStaticHoliday ("05-MAR-2019", ""); - - lh.addStaticHoliday ("19-APR-2019", ""); - - lh.addStaticHoliday ("22-APR-2019", ""); - - lh.addStaticHoliday ("01-MAY-2019", ""); - - lh.addStaticHoliday ("19-JUN-2019", ""); - - lh.addStaticHoliday ("18-JUL-2019", ""); - - lh.addStaticHoliday ("25-DEC-2019", ""); - - lh.addStaticHoliday ("01-JAN-2020", ""); - - lh.addStaticHoliday ("06-JAN-2020", ""); - - lh.addStaticHoliday ("24-FEB-2020", ""); - - lh.addStaticHoliday ("25-FEB-2020", ""); - - lh.addStaticHoliday ("10-APR-2020", ""); - - lh.addStaticHoliday ("01-MAY-2020", ""); - - lh.addStaticHoliday ("18-MAY-2020", ""); - - lh.addStaticHoliday ("19-JUN-2020", ""); - - lh.addStaticHoliday ("25-AUG-2020", ""); - - lh.addStaticHoliday ("12-OCT-2020", ""); - - lh.addStaticHoliday ("02-NOV-2020", ""); - - lh.addStaticHoliday ("25-DEC-2020", ""); - - lh.addStaticHoliday ("01-JAN-2021", ""); - - lh.addStaticHoliday ("06-JAN-2021", ""); - - lh.addStaticHoliday ("15-FEB-2021", ""); - - lh.addStaticHoliday ("16-FEB-2021", ""); - - lh.addStaticHoliday ("02-APR-2021", ""); - - lh.addStaticHoliday ("19-APR-2021", ""); - - lh.addStaticHoliday ("17-MAY-2021", ""); - - lh.addStaticHoliday ("25-AUG-2021", ""); - - lh.addStaticHoliday ("11-OCT-2021", ""); - - lh.addStaticHoliday ("02-NOV-2021", ""); - - lh.addStaticHoliday ("06-JAN-2022", ""); - - lh.addStaticHoliday ("28-FEB-2022", ""); - - lh.addStaticHoliday ("01-MAR-2022", ""); - - lh.addStaticHoliday ("15-APR-2022", ""); - - lh.addStaticHoliday ("18-APR-2022", ""); - - lh.addStaticHoliday ("16-MAY-2022", ""); - - lh.addStaticHoliday ("18-JUL-2022", ""); - - lh.addStaticHoliday ("25-AUG-2022", ""); - - lh.addStaticHoliday ("10-OCT-2022", ""); - - lh.addStaticHoliday ("02-NOV-2022", ""); - - lh.addStaticHoliday ("06-JAN-2023", ""); - - lh.addStaticHoliday ("20-FEB-2023", ""); - - lh.addStaticHoliday ("21-FEB-2023", ""); - - lh.addStaticHoliday ("07-APR-2023", ""); - - lh.addStaticHoliday ("17-APR-2023", ""); - - lh.addStaticHoliday ("01-MAY-2023", ""); - - lh.addStaticHoliday ("22-MAY-2023", ""); - - lh.addStaticHoliday ("19-JUN-2023", ""); - - lh.addStaticHoliday ("18-JUL-2023", ""); - - lh.addStaticHoliday ("25-AUG-2023", ""); - - lh.addStaticHoliday ("16-OCT-2023", ""); - - lh.addStaticHoliday ("02-NOV-2023", ""); - - lh.addStaticHoliday ("25-DEC-2023", ""); - - lh.addStaticHoliday ("01-JAN-2024", ""); - - lh.addStaticHoliday ("12-FEB-2024", ""); - - lh.addStaticHoliday ("13-FEB-2024", ""); - - lh.addStaticHoliday ("29-MAR-2024", ""); - - lh.addStaticHoliday ("22-APR-2024", ""); - - lh.addStaticHoliday ("01-MAY-2024", ""); - - lh.addStaticHoliday ("19-JUN-2024", ""); - - lh.addStaticHoliday ("18-JUL-2024", ""); - - lh.addStaticHoliday ("25-DEC-2024", ""); - - lh.addStaticHoliday ("01-JAN-2025", ""); - - lh.addStaticHoliday ("06-JAN-2025", ""); - - lh.addStaticHoliday ("03-MAR-2025", ""); - - lh.addStaticHoliday ("04-MAR-2025", ""); - - lh.addStaticHoliday ("18-APR-2025", ""); - - lh.addStaticHoliday ("01-MAY-2025", ""); - - lh.addStaticHoliday ("19-JUN-2025", ""); - - lh.addStaticHoliday ("18-JUL-2025", ""); - - lh.addStaticHoliday ("25-AUG-2025", ""); - - lh.addStaticHoliday ("25-DEC-2025", ""); - - lh.addStaticHoliday ("01-JAN-2026", ""); - - lh.addStaticHoliday ("06-JAN-2026", ""); - - lh.addStaticHoliday ("16-FEB-2026", ""); - - lh.addStaticHoliday ("17-FEB-2026", ""); - - lh.addStaticHoliday ("03-APR-2026", ""); - - lh.addStaticHoliday ("01-MAY-2026", ""); - - lh.addStaticHoliday ("18-MAY-2026", ""); - - lh.addStaticHoliday ("19-JUN-2026", ""); - - lh.addStaticHoliday ("25-AUG-2026", ""); - - lh.addStaticHoliday ("12-OCT-2026", ""); - - lh.addStaticHoliday ("02-NOV-2026", ""); - - lh.addStaticHoliday ("25-DEC-2026", ""); - - lh.addStaticHoliday ("01-JAN-2027", ""); - - lh.addStaticHoliday ("06-JAN-2027", ""); - - lh.addStaticHoliday ("08-FEB-2027", ""); - - lh.addStaticHoliday ("09-FEB-2027", ""); - - lh.addStaticHoliday ("26-MAR-2027", ""); - - lh.addStaticHoliday ("19-APR-2027", ""); - - lh.addStaticHoliday ("17-MAY-2027", ""); - - lh.addStaticHoliday ("25-AUG-2027", ""); - - lh.addStaticHoliday ("11-OCT-2027", ""); - - lh.addStaticHoliday ("02-NOV-2027", ""); - - lh.addStaticHoliday ("06-JAN-2028", ""); - - lh.addStaticHoliday ("28-FEB-2028", ""); - - lh.addStaticHoliday ("29-FEB-2028", ""); - - lh.addStaticHoliday ("14-APR-2028", ""); - - lh.addStaticHoliday ("17-APR-2028", ""); - - lh.addStaticHoliday ("01-MAY-2028", ""); - - lh.addStaticHoliday ("22-MAY-2028", ""); - - lh.addStaticHoliday ("19-JUN-2028", ""); - - lh.addStaticHoliday ("18-JUL-2028", ""); - - lh.addStaticHoliday ("25-AUG-2028", ""); - - lh.addStaticHoliday ("16-OCT-2028", ""); - - lh.addStaticHoliday ("02-NOV-2028", ""); - - lh.addStaticHoliday ("25-DEC-2028", ""); - - lh.addStaticHoliday ("01-JAN-2029", ""); - - lh.addStaticHoliday ("12-FEB-2029", ""); - - lh.addStaticHoliday ("13-FEB-2029", ""); - - lh.addStaticHoliday ("30-MAR-2029", ""); - - lh.addStaticHoliday ("23-APR-2029", ""); - - lh.addStaticHoliday ("01-MAY-2029", ""); - - lh.addStaticHoliday ("21-MAY-2029", ""); - - lh.addStaticHoliday ("19-JUN-2029", ""); - - lh.addStaticHoliday ("18-JUL-2029", ""); - - lh.addStaticHoliday ("15-OCT-2029", ""); - - lh.addStaticHoliday ("02-NOV-2029", ""); - - lh.addStaticHoliday ("25-DEC-2029", ""); - - lh.addStaticHoliday ("01-JAN-2030", ""); - - lh.addStaticHoliday ("01-MAR-2030", ""); - - lh.addStaticHoliday ("04-MAR-2030", ""); - - lh.addStaticHoliday ("05-MAR-2030", ""); - - lh.addStaticHoliday ("19-APR-2030", ""); - - lh.addStaticHoliday ("22-APR-2030", ""); - - lh.addStaticHoliday ("01-MAY-2030", ""); - - lh.addStaticHoliday ("19-JUN-2030", ""); - - lh.addStaticHoliday ("18-JUL-2030", ""); - - lh.addStaticHoliday ("25-DEC-2030", ""); - - lh.addStaticHoliday ("01-JAN-2031", ""); - - lh.addStaticHoliday ("06-JAN-2031", ""); - - lh.addStaticHoliday ("24-FEB-2031", ""); - - lh.addStaticHoliday ("25-FEB-2031", ""); - - lh.addStaticHoliday ("11-APR-2031", ""); - - lh.addStaticHoliday ("01-MAY-2031", ""); - - lh.addStaticHoliday ("19-JUN-2031", ""); - - lh.addStaticHoliday ("18-JUL-2031", ""); - - lh.addStaticHoliday ("25-AUG-2031", ""); - - lh.addStaticHoliday ("25-DEC-2031", ""); - - lh.addStaticHoliday ("01-JAN-2032", ""); - - lh.addStaticHoliday ("06-JAN-2032", ""); - - lh.addStaticHoliday ("09-FEB-2032", ""); - - lh.addStaticHoliday ("10-FEB-2032", ""); - - lh.addStaticHoliday ("26-MAR-2032", ""); - - lh.addStaticHoliday ("19-APR-2032", ""); - - lh.addStaticHoliday ("17-MAY-2032", ""); - - lh.addStaticHoliday ("25-AUG-2032", ""); - - lh.addStaticHoliday ("11-OCT-2032", ""); - - lh.addStaticHoliday ("02-NOV-2032", ""); - - lh.addStaticHoliday ("06-JAN-2033", ""); - - lh.addStaticHoliday ("28-FEB-2033", ""); - - lh.addStaticHoliday ("01-MAR-2033", ""); - - lh.addStaticHoliday ("15-APR-2033", ""); - - lh.addStaticHoliday ("18-APR-2033", ""); - - lh.addStaticHoliday ("16-MAY-2033", ""); - - lh.addStaticHoliday ("18-JUL-2033", ""); - - lh.addStaticHoliday ("25-AUG-2033", ""); - - lh.addStaticHoliday ("10-OCT-2033", ""); - - lh.addStaticHoliday ("02-NOV-2033", ""); - - lh.addStaticHoliday ("06-JAN-2034", ""); - - lh.addStaticHoliday ("20-FEB-2034", ""); - - lh.addStaticHoliday ("21-FEB-2034", ""); - - lh.addStaticHoliday ("07-APR-2034", ""); - - lh.addStaticHoliday ("17-APR-2034", ""); - - lh.addStaticHoliday ("01-MAY-2034", ""); - - lh.addStaticHoliday ("22-MAY-2034", ""); - - lh.addStaticHoliday ("19-JUN-2034", ""); - - lh.addStaticHoliday ("18-JUL-2034", ""); - - lh.addStaticHoliday ("25-AUG-2034", ""); - - lh.addStaticHoliday ("16-OCT-2034", ""); - - lh.addStaticHoliday ("02-NOV-2034", ""); - - lh.addStaticHoliday ("25-DEC-2034", ""); - - lh.addStaticHoliday ("01-JAN-2035", ""); - - lh.addStaticHoliday ("05-FEB-2035", ""); - - lh.addStaticHoliday ("06-FEB-2035", ""); - - lh.addStaticHoliday ("01-MAR-2035", ""); - - lh.addStaticHoliday ("23-MAR-2035", ""); - - lh.addStaticHoliday ("23-APR-2035", ""); - - lh.addStaticHoliday ("01-MAY-2035", ""); - - lh.addStaticHoliday ("21-MAY-2035", ""); - - lh.addStaticHoliday ("19-JUN-2035", ""); - - lh.addStaticHoliday ("18-JUL-2035", ""); - - lh.addStaticHoliday ("15-OCT-2035", ""); - - lh.addStaticHoliday ("02-NOV-2035", ""); - - lh.addStaticHoliday ("25-DEC-2035", ""); - - lh.addStaticHoliday ("01-JAN-2036", ""); - - lh.addStaticHoliday ("25-FEB-2036", ""); - - lh.addStaticHoliday ("26-FEB-2036", ""); - - lh.addStaticHoliday ("11-APR-2036", ""); - - lh.addStaticHoliday ("01-MAY-2036", ""); - - lh.addStaticHoliday ("19-JUN-2036", ""); - - lh.addStaticHoliday ("18-JUL-2036", ""); - - lh.addStaticHoliday ("25-AUG-2036", ""); - - lh.addStaticHoliday ("25-DEC-2036", ""); - - lh.addStaticHoliday ("01-JAN-2037", ""); - - lh.addStaticHoliday ("06-JAN-2037", ""); - - lh.addStaticHoliday ("16-FEB-2037", ""); - - lh.addStaticHoliday ("17-FEB-2037", ""); - - lh.addStaticHoliday ("03-APR-2037", ""); - - lh.addStaticHoliday ("01-MAY-2037", ""); - - lh.addStaticHoliday ("18-MAY-2037", ""); - - lh.addStaticHoliday ("19-JUN-2037", ""); - - lh.addStaticHoliday ("25-AUG-2037", ""); - - lh.addStaticHoliday ("12-OCT-2037", ""); - - lh.addStaticHoliday ("02-NOV-2037", ""); - - lh.addStaticHoliday ("25-DEC-2037", ""); - - lh.addStaticHoliday ("01-JAN-2038", ""); - - lh.addStaticHoliday ("06-JAN-2038", ""); - - lh.addStaticHoliday ("08-MAR-2038", ""); - - lh.addStaticHoliday ("09-MAR-2038", ""); - - lh.addStaticHoliday ("19-APR-2038", ""); - - lh.addStaticHoliday ("23-APR-2038", ""); - - lh.addStaticHoliday ("17-MAY-2038", ""); - - lh.addStaticHoliday ("25-AUG-2038", ""); - - lh.addStaticHoliday ("11-OCT-2038", ""); - - lh.addStaticHoliday ("02-NOV-2038", ""); - - lh.addStaticHoliday ("06-JAN-2039", ""); - - lh.addStaticHoliday ("21-FEB-2039", ""); - - lh.addStaticHoliday ("22-FEB-2039", ""); - - lh.addStaticHoliday ("08-APR-2039", ""); - - lh.addStaticHoliday ("18-APR-2039", ""); - - lh.addStaticHoliday ("16-MAY-2039", ""); - - lh.addStaticHoliday ("18-JUL-2039", ""); - - lh.addStaticHoliday ("25-AUG-2039", ""); - - lh.addStaticHoliday ("10-OCT-2039", ""); - - lh.addStaticHoliday ("02-NOV-2039", ""); - - lh.addStaticHoliday ("06-JAN-2040", ""); - - lh.addStaticHoliday ("13-FEB-2040", ""); - - lh.addStaticHoliday ("14-FEB-2040", ""); - - lh.addStaticHoliday ("01-MAR-2040", ""); - - lh.addStaticHoliday ("30-MAR-2040", ""); - - lh.addStaticHoliday ("23-APR-2040", ""); - - lh.addStaticHoliday ("01-MAY-2040", ""); - - lh.addStaticHoliday ("21-MAY-2040", ""); - - lh.addStaticHoliday ("19-JUN-2040", ""); - - lh.addStaticHoliday ("18-JUL-2040", ""); - - lh.addStaticHoliday ("15-OCT-2040", ""); - - lh.addStaticHoliday ("02-NOV-2040", ""); - - lh.addStaticHoliday ("25-DEC-2040", ""); - - lh.addStaticHoliday ("01-JAN-2041", ""); - - lh.addStaticHoliday ("04-MAR-2041", ""); - - lh.addStaticHoliday ("05-MAR-2041", ""); - - lh.addStaticHoliday ("19-APR-2041", ""); - - lh.addStaticHoliday ("22-APR-2041", ""); - - lh.addStaticHoliday ("01-MAY-2041", ""); - - lh.addStaticHoliday ("19-JUN-2041", ""); - - lh.addStaticHoliday ("18-JUL-2041", ""); - - lh.addStaticHoliday ("25-DEC-2041", ""); - - lh.addStaticHoliday ("01-JAN-2042", ""); - - lh.addStaticHoliday ("06-JAN-2042", ""); - - lh.addStaticHoliday ("17-FEB-2042", ""); - - lh.addStaticHoliday ("18-FEB-2042", ""); - - lh.addStaticHoliday ("04-APR-2042", ""); - - lh.addStaticHoliday ("01-MAY-2042", ""); - - lh.addStaticHoliday ("19-JUN-2042", ""); - - lh.addStaticHoliday ("18-JUL-2042", ""); - - lh.addStaticHoliday ("25-AUG-2042", ""); - - lh.addStaticHoliday ("25-DEC-2042", ""); - - lh.addStaticHoliday ("01-JAN-2043", ""); - - lh.addStaticHoliday ("06-JAN-2043", ""); - - lh.addStaticHoliday ("09-FEB-2043", ""); - - lh.addStaticHoliday ("10-FEB-2043", ""); - - lh.addStaticHoliday ("27-MAR-2043", ""); - - lh.addStaticHoliday ("01-MAY-2043", ""); - - lh.addStaticHoliday ("18-MAY-2043", ""); - - lh.addStaticHoliday ("19-JUN-2043", ""); - - lh.addStaticHoliday ("25-AUG-2043", ""); - - lh.addStaticHoliday ("12-OCT-2043", ""); - - lh.addStaticHoliday ("02-NOV-2043", ""); - - lh.addStaticHoliday ("25-DEC-2043", ""); - - lh.addStaticHoliday ("01-JAN-2044", ""); - - lh.addStaticHoliday ("06-JAN-2044", ""); - - lh.addStaticHoliday ("29-FEB-2044", ""); - - lh.addStaticHoliday ("01-MAR-2044", ""); - - lh.addStaticHoliday ("15-APR-2044", ""); - - lh.addStaticHoliday ("18-APR-2044", ""); - - lh.addStaticHoliday ("16-MAY-2044", ""); - - lh.addStaticHoliday ("18-JUL-2044", ""); - - lh.addStaticHoliday ("25-AUG-2044", ""); - - lh.addStaticHoliday ("10-OCT-2044", ""); - - lh.addStaticHoliday ("02-NOV-2044", ""); - - lh.addStaticHoliday ("06-JAN-2045", ""); - - lh.addStaticHoliday ("20-FEB-2045", ""); - - lh.addStaticHoliday ("21-FEB-2045", ""); - - lh.addStaticHoliday ("01-MAR-2045", ""); - - lh.addStaticHoliday ("07-APR-2045", ""); - - lh.addStaticHoliday ("17-APR-2045", ""); - - lh.addStaticHoliday ("01-MAY-2045", ""); - - lh.addStaticHoliday ("22-MAY-2045", ""); - - lh.addStaticHoliday ("19-JUN-2045", ""); - - lh.addStaticHoliday ("18-JUL-2045", ""); - - lh.addStaticHoliday ("25-AUG-2045", ""); - - lh.addStaticHoliday ("16-OCT-2045", ""); - - lh.addStaticHoliday ("02-NOV-2045", ""); - - lh.addStaticHoliday ("25-DEC-2045", ""); - - lh.addStaticHoliday ("01-JAN-2046", ""); - - lh.addStaticHoliday ("05-FEB-2046", ""); - - lh.addStaticHoliday ("06-FEB-2046", ""); - - lh.addStaticHoliday ("23-MAR-2046", ""); - - lh.addStaticHoliday ("23-APR-2046", ""); - - lh.addStaticHoliday ("01-MAY-2046", ""); - - lh.addStaticHoliday ("21-MAY-2046", ""); - - lh.addStaticHoliday ("19-JUN-2046", ""); - - lh.addStaticHoliday ("18-JUL-2046", ""); - - lh.addStaticHoliday ("15-OCT-2046", ""); - - lh.addStaticHoliday ("02-NOV-2046", ""); - - lh.addStaticHoliday ("25-DEC-2046", ""); - - lh.addStaticHoliday ("01-JAN-2047", ""); - - lh.addStaticHoliday ("25-FEB-2047", ""); - - lh.addStaticHoliday ("26-FEB-2047", ""); - - lh.addStaticHoliday ("12-APR-2047", ""); - - lh.addStaticHoliday ("22-APR-2047", ""); - - lh.addStaticHoliday ("01-MAY-2047", ""); - - lh.addStaticHoliday ("19-JUN-2047", ""); - - lh.addStaticHoliday ("18-JUL-2047", ""); - - lh.addStaticHoliday ("25-DEC-2047", ""); - - lh.addStaticHoliday ("01-JAN-2048", ""); - - lh.addStaticHoliday ("06-JAN-2048", ""); - - lh.addStaticHoliday ("17-FEB-2048", ""); - - lh.addStaticHoliday ("18-FEB-2048", ""); - - lh.addStaticHoliday ("03-APR-2048", ""); - - lh.addStaticHoliday ("01-MAY-2048", ""); - - lh.addStaticHoliday ("18-MAY-2048", ""); - - lh.addStaticHoliday ("19-JUN-2048", ""); - - lh.addStaticHoliday ("25-AUG-2048", ""); - - lh.addStaticHoliday ("12-OCT-2048", ""); - - lh.addStaticHoliday ("02-NOV-2048", ""); - - lh.addStaticHoliday ("25-DEC-2048", ""); - - lh.addStaticHoliday ("01-JAN-2049", ""); - - lh.addStaticHoliday ("06-JAN-2049", ""); - - lh.addStaticHoliday ("01-MAR-2049", ""); - - lh.addStaticHoliday ("02-MAR-2049", ""); - - lh.addStaticHoliday ("16-APR-2049", ""); - - lh.addStaticHoliday ("19-APR-2049", ""); - - lh.addStaticHoliday ("17-MAY-2049", ""); - - lh.addStaticHoliday ("25-AUG-2049", ""); - - lh.addStaticHoliday ("11-OCT-2049", ""); - - lh.addStaticHoliday ("02-NOV-2049", ""); - - lh.addStaticHoliday ("06-JAN-2050", ""); - - lh.addStaticHoliday ("21-FEB-2050", ""); - - lh.addStaticHoliday ("22-FEB-2050", ""); - - lh.addStaticHoliday ("01-MAR-2050", ""); - - lh.addStaticHoliday ("08-APR-2050", ""); - - lh.addStaticHoliday ("18-APR-2050", ""); - - lh.addStaticHoliday ("16-MAY-2050", ""); - - lh.addStaticHoliday ("18-JUL-2050", ""); - - lh.addStaticHoliday ("25-AUG-2050", ""); - - lh.addStaticHoliday ("10-OCT-2050", ""); - - lh.addStaticHoliday ("02-NOV-2050", ""); - - lh.addStaticHoliday ("06-JAN-2051", ""); - - lh.addStaticHoliday ("13-FEB-2051", ""); - - lh.addStaticHoliday ("14-FEB-2051", ""); - - lh.addStaticHoliday ("31-MAR-2051", ""); - - lh.addStaticHoliday ("17-APR-2051", ""); - - lh.addStaticHoliday ("01-MAY-2051", ""); - - lh.addStaticHoliday ("22-MAY-2051", ""); - - lh.addStaticHoliday ("19-JUN-2051", ""); - - lh.addStaticHoliday ("18-JUL-2051", ""); - - lh.addStaticHoliday ("25-AUG-2051", ""); - - lh.addStaticHoliday ("16-OCT-2051", ""); - - lh.addStaticHoliday ("02-NOV-2051", ""); - - lh.addStaticHoliday ("25-DEC-2051", ""); - - lh.addStaticHoliday ("01-JAN-2052", ""); - - lh.addStaticHoliday ("04-MAR-2052", ""); - - lh.addStaticHoliday ("05-MAR-2052", ""); - - lh.addStaticHoliday ("19-APR-2052", ""); - - lh.addStaticHoliday ("22-APR-2052", ""); - - lh.addStaticHoliday ("01-MAY-2052", ""); - - lh.addStaticHoliday ("19-JUN-2052", ""); - - lh.addStaticHoliday ("18-JUL-2052", ""); - - lh.addStaticHoliday ("25-DEC-2052", ""); - - lh.addStaticHoliday ("01-JAN-2053", ""); - - lh.addStaticHoliday ("06-JAN-2053", ""); - - lh.addStaticHoliday ("17-FEB-2053", ""); - - lh.addStaticHoliday ("18-FEB-2053", ""); - - lh.addStaticHoliday ("04-APR-2053", ""); - - lh.addStaticHoliday ("01-MAY-2053", ""); - - lh.addStaticHoliday ("19-JUN-2053", ""); - - lh.addStaticHoliday ("18-JUL-2053", ""); - - lh.addStaticHoliday ("25-AUG-2053", ""); - - lh.addStaticHoliday ("25-DEC-2053", ""); - - lh.addStaticHoliday ("01-JAN-2054", ""); - - lh.addStaticHoliday ("06-JAN-2054", ""); - - lh.addStaticHoliday ("09-FEB-2054", ""); - - lh.addStaticHoliday ("10-FEB-2054", ""); - - lh.addStaticHoliday ("27-MAR-2054", ""); - - lh.addStaticHoliday ("01-MAY-2054", ""); - - lh.addStaticHoliday ("18-MAY-2054", ""); - - lh.addStaticHoliday ("19-JUN-2054", ""); - - lh.addStaticHoliday ("25-AUG-2054", ""); - - lh.addStaticHoliday ("12-OCT-2054", ""); - - lh.addStaticHoliday ("02-NOV-2054", ""); - - lh.addStaticHoliday ("25-DEC-2054", ""); - - lh.addStaticHoliday ("01-JAN-2055", ""); - - lh.addStaticHoliday ("06-JAN-2055", ""); - - lh.addStaticHoliday ("01-MAR-2055", ""); - - lh.addStaticHoliday ("02-MAR-2055", ""); - - lh.addStaticHoliday ("16-APR-2055", ""); - - lh.addStaticHoliday ("19-APR-2055", ""); - - lh.addStaticHoliday ("17-MAY-2055", ""); - - lh.addStaticHoliday ("25-AUG-2055", ""); - - lh.addStaticHoliday ("11-OCT-2055", ""); - - lh.addStaticHoliday ("02-NOV-2055", ""); - - lh.addStaticHoliday ("06-JAN-2056", ""); - - lh.addStaticHoliday ("14-FEB-2056", ""); - - lh.addStaticHoliday ("15-FEB-2056", ""); - - lh.addStaticHoliday ("31-MAR-2056", ""); - - lh.addStaticHoliday ("17-APR-2056", ""); - - lh.addStaticHoliday ("01-MAY-2056", ""); - - lh.addStaticHoliday ("22-MAY-2056", ""); - - lh.addStaticHoliday ("19-JUN-2056", ""); - - lh.addStaticHoliday ("18-JUL-2056", ""); - - lh.addStaticHoliday ("25-AUG-2056", ""); - - lh.addStaticHoliday ("16-OCT-2056", ""); - - lh.addStaticHoliday ("02-NOV-2056", ""); - - lh.addStaticHoliday ("25-DEC-2056", ""); - - lh.addStaticHoliday ("01-JAN-2057", ""); - - lh.addStaticHoliday ("05-MAR-2057", ""); - - lh.addStaticHoliday ("06-MAR-2057", ""); - - lh.addStaticHoliday ("20-APR-2057", ""); - - lh.addStaticHoliday ("23-APR-2057", ""); - - lh.addStaticHoliday ("01-MAY-2057", ""); - - lh.addStaticHoliday ("21-MAY-2057", ""); - - lh.addStaticHoliday ("19-JUN-2057", ""); - - lh.addStaticHoliday ("18-JUL-2057", ""); - - lh.addStaticHoliday ("15-OCT-2057", ""); - - lh.addStaticHoliday ("02-NOV-2057", ""); - - lh.addStaticHoliday ("25-DEC-2057", ""); - - lh.addStaticHoliday ("01-JAN-2058", ""); - - lh.addStaticHoliday ("25-FEB-2058", ""); - - lh.addStaticHoliday ("26-FEB-2058", ""); - - lh.addStaticHoliday ("12-APR-2058", ""); - - lh.addStaticHoliday ("22-APR-2058", ""); - - lh.addStaticHoliday ("01-MAY-2058", ""); - - lh.addStaticHoliday ("19-JUN-2058", ""); - - lh.addStaticHoliday ("18-JUL-2058", ""); - - lh.addStaticHoliday ("25-DEC-2058", ""); - - lh.addStaticHoliday ("01-JAN-2059", ""); - - lh.addStaticHoliday ("06-JAN-2059", ""); - - lh.addStaticHoliday ("10-FEB-2059", ""); - - lh.addStaticHoliday ("11-FEB-2059", ""); - - lh.addStaticHoliday ("28-MAR-2059", ""); - - lh.addStaticHoliday ("01-MAY-2059", ""); - - lh.addStaticHoliday ("19-JUN-2059", ""); - - lh.addStaticHoliday ("18-JUL-2059", ""); - - lh.addStaticHoliday ("25-AUG-2059", ""); - - lh.addStaticHoliday ("25-DEC-2059", ""); - - lh.addStaticHoliday ("01-JAN-2060", ""); - - lh.addStaticHoliday ("06-JAN-2060", ""); - - lh.addStaticHoliday ("01-MAR-2060", ""); - - lh.addStaticHoliday ("02-MAR-2060", ""); - - lh.addStaticHoliday ("16-APR-2060", ""); - - lh.addStaticHoliday ("19-APR-2060", ""); - - lh.addStaticHoliday ("17-MAY-2060", ""); - - lh.addStaticHoliday ("25-AUG-2060", ""); - - lh.addStaticHoliday ("11-OCT-2060", ""); - - lh.addStaticHoliday ("02-NOV-2060", ""); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/VACHoliday.java b/org/drip/analytics/holset/VACHoliday.java deleted file mode 100644 index 12d323f..0000000 --- a/org/drip/analytics/holset/VACHoliday.java +++ /dev/null @@ -1,629 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class VACHoliday implements org.drip.analytics.holset.LocationHoliday { - public VACHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "VAC"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("09-APR-1998", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-1998", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-1998", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-1998", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-1998", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-1998", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-1999", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-1999", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-1999", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-1999", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-1999", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-1999", "Immaculate Conception"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2000", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2000", "Peruvian Day"); - - lh.addStaticHoliday ("30-AUG-2000", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2000", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2001", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("30-AUG-2001", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2001", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("29-JUL-2002", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2002", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2002", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("28-JUL-2003", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2003", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2003", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-2004", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2004", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2004", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2004", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2004", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2004", "Immaculate Conception"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-2005", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2005", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2005", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2005", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2005", "Immaculate Conception"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2006", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2006", "Peruvian Day"); - - lh.addStaticHoliday ("30-AUG-2006", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2006", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2007", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("30-AUG-2007", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2007", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("28-JUL-2008", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2008", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2008", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2009", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2009", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2009", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2009", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-2009", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2010", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-2010", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2010", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2010", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2010", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2010", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2010", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2010", "Immaculate Conception"); - - lh.addStaticHoliday ("21-APR-2011", "Holy Thursday"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-2011", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2011", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2011", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2011", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2011", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2011", "Immaculate Conception"); - - lh.addStaticHoliday ("05-APR-2012", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2012", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("30-AUG-2012", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2012", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2012", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2013", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("29-JUL-2013", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2013", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2013", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2013", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("17-APR-2014", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("28-JUL-2014", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2014", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2014", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-2014", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2015", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2015", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2015", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2015", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2015", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-2015", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("24-MAR-2016", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-2016", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2016", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2016", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2016", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2016", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2016", "Immaculate Conception"); - - lh.addStaticHoliday ("13-APR-2017", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2017", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2017", "Peruvian Day"); - - lh.addStaticHoliday ("30-AUG-2017", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2017", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2017", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2018", "Holy Thursday"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2018", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("30-AUG-2018", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2018", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2018", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2019", "Holy Thursday"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("29-JUL-2019", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2019", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2019", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2019", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2020", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2020", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2020", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2020", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2020", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-2020", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("01-APR-2021", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-2021", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2021", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2021", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2021", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2021", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2021", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2021", "Immaculate Conception"); - - lh.addStaticHoliday ("14-APR-2022", "Holy Thursday"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-2022", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2022", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2022", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2022", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2022", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2022", "Immaculate Conception"); - - lh.addStaticHoliday ("06-APR-2023", "Holy Thursday"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2023", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2023", "Peruvian Day"); - - lh.addStaticHoliday ("30-AUG-2023", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2023", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2023", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-2024", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("29-JUL-2024", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2024", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2024", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2024", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("17-APR-2025", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("28-JUL-2025", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2025", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2025", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-2025", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2026", "Holy Thursday"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2026", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2026", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2026", "Independence Day"); - - lh.addStaticHoliday ("08-OCT-2026", "Combate de Angamos"); - - lh.addStaticHoliday ("08-DEC-2026", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("25-MAR-2027", "Holy Thursday"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("29-JUN-2027", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2027", "Peruvian Day"); - - lh.addStaticHoliday ("29-JUL-2027", "Independence Day"); - - lh.addStaticHoliday ("30-AUG-2027", "St. Roses Day"); - - lh.addStaticHoliday ("08-OCT-2027", "Combate de Angamos"); - - lh.addStaticHoliday ("01-NOV-2027", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2027", "Immaculate Conception"); - - lh.addStaticHoliday ("13-APR-2028", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2028", "Labour Day"); - - lh.addStaticHoliday ("29-JUN-2028", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("28-JUL-2028", "Peruvian Day"); - - lh.addStaticHoliday ("30-AUG-2028", "St. Roses Day"); - - lh.addStaticHoliday ("01-NOV-2028", "All Saints Day"); - - lh.addStaticHoliday ("08-DEC-2028", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/VEBHoliday.java b/org/drip/analytics/holset/VEBHoliday.java deleted file mode 100644 index 99fbb33..0000000 --- a/org/drip/analytics/holset/VEBHoliday.java +++ /dev/null @@ -1,2055 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class VEBHoliday implements org.drip.analytics.holset.LocationHoliday { - public VEBHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "VEB"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("05-JAN-1998", "Epiphany Observed"); - - lh.addStaticHoliday ("23-FEB-1998", "Carnival Monday"); - - lh.addStaticHoliday ("24-FEB-1998", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-MAR-1998", "St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-1998", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-1998", "Ascension Day"); - - lh.addStaticHoliday ("15-JUN-1998", "Corpus Christi"); - - lh.addStaticHoliday ("24-JUN-1998", "Battle of Carabobo Day"); - - lh.addStaticHoliday ("29-JUN-1998", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("24-JUL-1998", "Bolivars Birthday"); - - lh.addStaticHoliday ("12-OCT-1998", "Day of the Race"); - - lh.addStaticHoliday ("07-DEC-1998", "Immaculate Conception Observed"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-1999", "Epiphany Observed"); - - lh.addStaticHoliday ("15-FEB-1999", "Carnival Monday"); - - lh.addStaticHoliday ("16-FEB-1999", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-MAR-1999", "St. Josephs Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("19-APR-1999", "Constitution Day"); - - lh.addStaticHoliday ("17-MAY-1999", "Ascension Day"); - - lh.addStaticHoliday ("07-JUN-1999", "Corpus Christi"); - - lh.addStaticHoliday ("24-JUN-1999", "Battle of Carabobo Day"); - - lh.addStaticHoliday ("28-JUN-1999", "Saints Peter and Paul Day Observed"); - - lh.addStaticHoliday ("05-JUL-1999", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-1999", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("06-DEC-1999", "Immaculate Conception Observed"); - - lh.addStaticHoliday ("10-JAN-2000", "Epiphany Observed"); - - lh.addStaticHoliday ("06-MAR-2000", "Carnival Monday"); - - lh.addStaticHoliday ("07-MAR-2000", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-APR-2000", "Constitution Day"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("05-JUN-2000", "Ascension Day"); - - lh.addStaticHoliday ("26-JUN-2000", "Corpus Christi"); - - lh.addStaticHoliday ("05-JUL-2000", "Independence Day"); - - lh.addStaticHoliday ("24-JUL-2000", "Bolivars Birthday"); - - lh.addStaticHoliday ("14-AUG-2000", "Assumption Day Observed"); - - lh.addStaticHoliday ("12-OCT-2000", "Day of the Race"); - - lh.addStaticHoliday ("30-OCT-2000", "All Saints Day Observed"); - - lh.addStaticHoliday ("11-DEC-2000", "Immaculate Conception Observed"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("26-FEB-2001", "Carnival Monday"); - - lh.addStaticHoliday ("27-FEB-2001", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-MAR-2001", "St. Josephs Day"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2001", "Constitution Day"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("28-MAY-2001", "Ascension Day"); - - lh.addStaticHoliday ("18-JUN-2001", "Corpus Christi"); - - lh.addStaticHoliday ("02-JUL-2001", "Saints Peter and Paul Day Observed"); - - lh.addStaticHoliday ("05-JUL-2001", "Independence Day"); - - lh.addStaticHoliday ("24-JUL-2001", "Bolivars Birthday"); - - lh.addStaticHoliday ("13-AUG-2001", "Assumption Day Observed"); - - lh.addStaticHoliday ("12-OCT-2001", "Day of the Race"); - - lh.addStaticHoliday ("05-NOV-2001", "All Saints Day Observed"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2002", "Carnival Monday"); - - lh.addStaticHoliday ("12-FEB-2002", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-MAR-2002", "St. Josephs Day"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2002", "Constitution Day"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("13-MAY-2002", "Ascension Day"); - - lh.addStaticHoliday ("03-JUN-2002", "Corpus Christi"); - - lh.addStaticHoliday ("24-JUN-2002", "Battle of Carabobo Day"); - - lh.addStaticHoliday ("05-JUL-2002", "Independence Day"); - - lh.addStaticHoliday ("24-JUL-2002", "Bolivars Birthday"); - - lh.addStaticHoliday ("19-AUG-2002", "Assumption Day Observed"); - - lh.addStaticHoliday ("04-NOV-2002", "All Saints Day Observed"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2003", "Epiphany"); - - lh.addStaticHoliday ("03-MAR-2003", "Carnival Monday"); - - lh.addStaticHoliday ("04-MAR-2003", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-MAR-2003", "St. Josephs Day"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("02-JUN-2003", "Ascension Day"); - - lh.addStaticHoliday ("23-JUN-2003", "Corpus Christi"); - - lh.addStaticHoliday ("24-JUN-2003", "Battle of Carabobo Day"); - - lh.addStaticHoliday ("24-JUL-2003", "Bolivars Birthday"); - - lh.addStaticHoliday ("18-AUG-2003", "Assumption Day Observed"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("05-JAN-2004", "Epiphany Observed"); - - lh.addStaticHoliday ("23-FEB-2004", "Carnival Monday"); - - lh.addStaticHoliday ("24-FEB-2004", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-MAR-2004", "St. Josephs Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2004", "Constitution Day"); - - lh.addStaticHoliday ("24-MAY-2004", "Ascension Day"); - - lh.addStaticHoliday ("14-JUN-2004", "Corpus Christi"); - - lh.addStaticHoliday ("24-JUN-2004", "Battle of Carabobo Day"); - - lh.addStaticHoliday ("28-JUN-2004", "Saints Peter and Paul Day Observed"); - - lh.addStaticHoliday ("05-JUL-2004", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2004", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("06-DEC-2004", "Immaculate Conception Observed"); - - lh.addStaticHoliday ("10-JAN-2005", "Epiphany Observed"); - - lh.addStaticHoliday ("07-FEB-2005", "Carnival Monday"); - - lh.addStaticHoliday ("08-FEB-2005", "Carnival Tuesday"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2005", "Constitution Day"); - - lh.addStaticHoliday ("09-MAY-2005", "Ascension Day"); - - lh.addStaticHoliday ("30-MAY-2005", "Corpus Christi"); - - lh.addStaticHoliday ("24-JUN-2005", "Battle of Carabobo Day"); - - lh.addStaticHoliday ("27-JUN-2005", "Saints Peter and Paul Day Observed"); - - lh.addStaticHoliday ("05-JUL-2005", "Independence Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2005", "Day of the Race"); - - lh.addStaticHoliday ("31-OCT-2005", "All Saints Day Observed"); - - lh.addStaticHoliday ("12-DEC-2005", "Immaculate Conception Observed"); - - lh.addStaticHoliday ("09-JAN-2006", "Epiphany Observed"); - - lh.addStaticHoliday ("27-FEB-2006", "Carnival Monday"); - - lh.addStaticHoliday ("28-FEB-2006", "Carnival Tuesday"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2006", "Constitution Day"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2006", "Ascension Day"); - - lh.addStaticHoliday ("19-JUN-2006", "Corpus Christi"); - - lh.addStaticHoliday ("26-JUN-2006", "Saints Peter and Paul Day Observed"); - - lh.addStaticHoliday ("05-JUL-2006", "Independence Day"); - - lh.addStaticHoliday ("24-JUL-2006", "Bolivars Birthday"); - - lh.addStaticHoliday ("14-AUG-2006", "Assumption Day Observed"); - - lh.addStaticHoliday ("12-OCT-2006", "Day of the Race"); - - lh.addStaticHoliday ("30-OCT-2006", "All Saints Day Observed"); - - lh.addStaticHoliday ("11-DEC-2006", "Immaculate Conception Observed"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("19-FEB-2007", "Carnival Monday"); - - lh.addStaticHoliday ("20-FEB-2007", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-MAR-2007", "St. Josephs Day"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2007", "Constitution Day"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2007", "Ascension Day"); - - lh.addStaticHoliday ("11-JUN-2007", "Corpus Christi"); - - lh.addStaticHoliday ("02-JUL-2007", "Saints Peter and Paul Day Observed"); - - lh.addStaticHoliday ("05-JUL-2007", "Independence Day"); - - lh.addStaticHoliday ("24-JUL-2007", "Bolivars Birthday"); - - lh.addStaticHoliday ("13-AUG-2007", "Assumption Day Observed"); - - lh.addStaticHoliday ("12-OCT-2007", "Day of the Race"); - - lh.addStaticHoliday ("05-NOV-2007", "All Saints Day Observed"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("04-FEB-2008", "Carnival Monday"); - - lh.addStaticHoliday ("05-FEB-2008", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-MAR-2008", "St. Josephs Day"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2008", "Ascension Day"); - - lh.addStaticHoliday ("26-MAY-2008", "Corpus Christi"); - - lh.addStaticHoliday ("24-JUN-2008", "Battle of Carabobo Day"); - - lh.addStaticHoliday ("24-JUL-2008", "Bolivars Birthday"); - - lh.addStaticHoliday ("18-AUG-2008", "Assumption Day Observed"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("05-JAN-2009", "Epiphany Observed"); - - lh.addStaticHoliday ("23-FEB-2009", "Carnival Monday"); - - lh.addStaticHoliday ("24-FEB-2009", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-MAR-2009", "St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2009", "Ascension Day"); - - lh.addStaticHoliday ("15-JUN-2009", "Corpus Christi"); - - lh.addStaticHoliday ("24-JUN-2009", "Battle of Carabobo Day"); - - lh.addStaticHoliday ("29-JUN-2009", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("24-JUL-2009", "Bolivars Birthday"); - - lh.addStaticHoliday ("12-OCT-2009", "Day of the Race"); - - lh.addStaticHoliday ("07-DEC-2009", "Immaculate Conception Observed"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2010", "Epiphany Observed"); - - lh.addStaticHoliday ("15-FEB-2010", "Carnival Monday"); - - lh.addStaticHoliday ("16-FEB-2010", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-MAR-2010", "St. Josephs Day"); - - lh.addStaticHoliday ("01-APR-2010", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2010", "Constitution Day"); - - lh.addStaticHoliday ("17-MAY-2010", "Ascension Day"); - - lh.addStaticHoliday ("07-JUN-2010", "Corpus Christi"); - - lh.addStaticHoliday ("24-JUN-2010", "Battle of Carabobo Day"); - - lh.addStaticHoliday ("28-JUN-2010", "Saints Peter and Paul Day Observed"); - - lh.addStaticHoliday ("05-JUL-2010", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2010", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-2010", "All Saints Day"); - - lh.addStaticHoliday ("06-DEC-2010", "Immaculate Conception Observed"); - - lh.addStaticHoliday ("10-JAN-2011", "VEB"); - - lh.addStaticHoliday ("07-MAR-2011", "VEB"); - - lh.addStaticHoliday ("08-MAR-2011", "VEB"); - - lh.addStaticHoliday ("19-APR-2011", "VEB"); - - lh.addStaticHoliday ("21-APR-2011", "VEB"); - - lh.addStaticHoliday ("22-APR-2011", "VEB"); - - lh.addStaticHoliday ("06-JUN-2011", "VEB"); - - lh.addStaticHoliday ("24-JUN-2011", "VEB"); - - lh.addStaticHoliday ("27-JUN-2011", "VEB"); - - lh.addStaticHoliday ("04-JUL-2011", "VEB"); - - lh.addStaticHoliday ("05-JUL-2011", "VEB"); - - lh.addStaticHoliday ("15-AUG-2011", "VEB"); - - lh.addStaticHoliday ("12-OCT-2011", "VEB"); - - lh.addStaticHoliday ("31-OCT-2011", "VEB"); - - lh.addStaticHoliday ("12-DEC-2011", "VEB"); - - lh.addStaticHoliday ("09-JAN-2012", "VEB"); - - lh.addStaticHoliday ("20-FEB-2012", "VEB"); - - lh.addStaticHoliday ("21-FEB-2012", "VEB"); - - lh.addStaticHoliday ("19-MAR-2012", "VEB"); - - lh.addStaticHoliday ("05-APR-2012", "VEB"); - - lh.addStaticHoliday ("06-APR-2012", "VEB"); - - lh.addStaticHoliday ("19-APR-2012", "VEB"); - - lh.addStaticHoliday ("01-MAY-2012", "VEB"); - - lh.addStaticHoliday ("21-MAY-2012", "VEB"); - - lh.addStaticHoliday ("11-JUN-2012", "VEB"); - - lh.addStaticHoliday ("02-JUL-2012", "VEB"); - - lh.addStaticHoliday ("05-JUL-2012", "VEB"); - - lh.addStaticHoliday ("24-JUL-2012", "VEB"); - - lh.addStaticHoliday ("20-AUG-2012", "VEB"); - - lh.addStaticHoliday ("12-OCT-2012", "VEB"); - - lh.addStaticHoliday ("05-NOV-2012", "VEB"); - - lh.addStaticHoliday ("25-DEC-2012", "VEB"); - - lh.addStaticHoliday ("01-JAN-2013", "VEB"); - - lh.addStaticHoliday ("11-FEB-2013", "VEB"); - - lh.addStaticHoliday ("12-FEB-2013", "VEB"); - - lh.addStaticHoliday ("19-MAR-2013", "VEB"); - - lh.addStaticHoliday ("28-MAR-2013", "VEB"); - - lh.addStaticHoliday ("29-MAR-2013", "VEB"); - - lh.addStaticHoliday ("19-APR-2013", "VEB"); - - lh.addStaticHoliday ("01-MAY-2013", "VEB"); - - lh.addStaticHoliday ("13-MAY-2013", "VEB"); - - lh.addStaticHoliday ("03-JUN-2013", "VEB"); - - lh.addStaticHoliday ("24-JUN-2013", "VEB"); - - lh.addStaticHoliday ("05-JUL-2013", "VEB"); - - lh.addStaticHoliday ("24-JUL-2013", "VEB"); - - lh.addStaticHoliday ("19-AUG-2013", "VEB"); - - lh.addStaticHoliday ("04-NOV-2013", "VEB"); - - lh.addStaticHoliday ("25-DEC-2013", "VEB"); - - lh.addStaticHoliday ("01-JAN-2014", "VEB"); - - lh.addStaticHoliday ("06-JAN-2014", "VEB"); - - lh.addStaticHoliday ("03-MAR-2014", "VEB"); - - lh.addStaticHoliday ("04-MAR-2014", "VEB"); - - lh.addStaticHoliday ("19-MAR-2014", "VEB"); - - lh.addStaticHoliday ("17-APR-2014", "VEB"); - - lh.addStaticHoliday ("18-APR-2014", "VEB"); - - lh.addStaticHoliday ("01-MAY-2014", "VEB"); - - lh.addStaticHoliday ("02-JUN-2014", "VEB"); - - lh.addStaticHoliday ("16-JUN-2014", "VEB"); - - lh.addStaticHoliday ("24-JUN-2014", "VEB"); - - lh.addStaticHoliday ("24-JUL-2014", "VEB"); - - lh.addStaticHoliday ("18-AUG-2014", "VEB"); - - lh.addStaticHoliday ("08-DEC-2014", "VEB"); - - lh.addStaticHoliday ("25-DEC-2014", "VEB"); - - lh.addStaticHoliday ("01-JAN-2015", "VEB"); - - lh.addStaticHoliday ("05-JAN-2015", "VEB"); - - lh.addStaticHoliday ("16-FEB-2015", "VEB"); - - lh.addStaticHoliday ("17-FEB-2015", "VEB"); - - lh.addStaticHoliday ("19-MAR-2015", "VEB"); - - lh.addStaticHoliday ("02-APR-2015", "VEB"); - - lh.addStaticHoliday ("03-APR-2015", "VEB"); - - lh.addStaticHoliday ("01-MAY-2015", "VEB"); - - lh.addStaticHoliday ("18-MAY-2015", "VEB"); - - lh.addStaticHoliday ("08-JUN-2015", "VEB"); - - lh.addStaticHoliday ("24-JUN-2015", "VEB"); - - lh.addStaticHoliday ("29-JUN-2015", "VEB"); - - lh.addStaticHoliday ("24-JUL-2015", "VEB"); - - lh.addStaticHoliday ("12-OCT-2015", "VEB"); - - lh.addStaticHoliday ("07-DEC-2015", "VEB"); - - lh.addStaticHoliday ("25-DEC-2015", "VEB"); - - lh.addStaticHoliday ("01-JAN-2016", "VEB"); - - lh.addStaticHoliday ("04-JAN-2016", "VEB"); - - lh.addStaticHoliday ("08-FEB-2016", "VEB"); - - lh.addStaticHoliday ("09-FEB-2016", "VEB"); - - lh.addStaticHoliday ("24-MAR-2016", "VEB"); - - lh.addStaticHoliday ("25-MAR-2016", "VEB"); - - lh.addStaticHoliday ("19-APR-2016", "VEB"); - - lh.addStaticHoliday ("09-MAY-2016", "VEB"); - - lh.addStaticHoliday ("30-MAY-2016", "VEB"); - - lh.addStaticHoliday ("24-JUN-2016", "VEB"); - - lh.addStaticHoliday ("27-JUN-2016", "VEB"); - - lh.addStaticHoliday ("05-JUL-2016", "VEB"); - - lh.addStaticHoliday ("15-AUG-2016", "VEB"); - - lh.addStaticHoliday ("12-OCT-2016", "VEB"); - - lh.addStaticHoliday ("31-OCT-2016", "VEB"); - - lh.addStaticHoliday ("12-DEC-2016", "VEB"); - - lh.addStaticHoliday ("09-JAN-2017", "VEB"); - - lh.addStaticHoliday ("27-FEB-2017", "VEB"); - - lh.addStaticHoliday ("28-FEB-2017", "VEB"); - - lh.addStaticHoliday ("13-APR-2017", "VEB"); - - lh.addStaticHoliday ("14-APR-2017", "VEB"); - - lh.addStaticHoliday ("19-APR-2017", "VEB"); - - lh.addStaticHoliday ("01-MAY-2017", "VEB"); - - lh.addStaticHoliday ("29-MAY-2017", "VEB"); - - lh.addStaticHoliday ("19-JUN-2017", "VEB"); - - lh.addStaticHoliday ("03-JUL-2017", "VEB"); - - lh.addStaticHoliday ("05-JUL-2017", "VEB"); - - lh.addStaticHoliday ("24-JUL-2017", "VEB"); - - lh.addStaticHoliday ("14-AUG-2017", "VEB"); - - lh.addStaticHoliday ("12-OCT-2017", "VEB"); - - lh.addStaticHoliday ("06-NOV-2017", "VEB"); - - lh.addStaticHoliday ("11-DEC-2017", "VEB"); - - lh.addStaticHoliday ("25-DEC-2017", "VEB"); - - lh.addStaticHoliday ("01-JAN-2018", "VEB"); - - lh.addStaticHoliday ("12-FEB-2018", "VEB"); - - lh.addStaticHoliday ("13-FEB-2018", "VEB"); - - lh.addStaticHoliday ("19-MAR-2018", "VEB"); - - lh.addStaticHoliday ("29-MAR-2018", "VEB"); - - lh.addStaticHoliday ("30-MAR-2018", "VEB"); - - lh.addStaticHoliday ("19-APR-2018", "VEB"); - - lh.addStaticHoliday ("01-MAY-2018", "VEB"); - - lh.addStaticHoliday ("14-MAY-2018", "VEB"); - - lh.addStaticHoliday ("04-JUN-2018", "VEB"); - - lh.addStaticHoliday ("02-JUL-2018", "VEB"); - - lh.addStaticHoliday ("05-JUL-2018", "VEB"); - - lh.addStaticHoliday ("24-JUL-2018", "VEB"); - - lh.addStaticHoliday ("20-AUG-2018", "VEB"); - - lh.addStaticHoliday ("12-OCT-2018", "VEB"); - - lh.addStaticHoliday ("05-NOV-2018", "VEB"); - - lh.addStaticHoliday ("25-DEC-2018", "VEB"); - - lh.addStaticHoliday ("01-JAN-2019", "VEB"); - - lh.addStaticHoliday ("04-MAR-2019", "VEB"); - - lh.addStaticHoliday ("05-MAR-2019", "VEB"); - - lh.addStaticHoliday ("19-MAR-2019", "VEB"); - - lh.addStaticHoliday ("18-APR-2019", "VEB"); - - lh.addStaticHoliday ("19-APR-2019", "VEB"); - - lh.addStaticHoliday ("01-MAY-2019", "VEB"); - - lh.addStaticHoliday ("03-JUN-2019", "VEB"); - - lh.addStaticHoliday ("24-JUN-2019", "VEB"); - - lh.addStaticHoliday ("05-JUL-2019", "VEB"); - - lh.addStaticHoliday ("24-JUL-2019", "VEB"); - - lh.addStaticHoliday ("19-AUG-2019", "VEB"); - - lh.addStaticHoliday ("04-NOV-2019", "VEB"); - - lh.addStaticHoliday ("25-DEC-2019", "VEB"); - - lh.addStaticHoliday ("01-JAN-2020", "VEB"); - - lh.addStaticHoliday ("06-JAN-2020", "VEB"); - - lh.addStaticHoliday ("24-FEB-2020", "VEB"); - - lh.addStaticHoliday ("25-FEB-2020", "VEB"); - - lh.addStaticHoliday ("19-MAR-2020", "VEB"); - - lh.addStaticHoliday ("09-APR-2020", "VEB"); - - lh.addStaticHoliday ("10-APR-2020", "VEB"); - - lh.addStaticHoliday ("01-MAY-2020", "VEB"); - - lh.addStaticHoliday ("25-MAY-2020", "VEB"); - - lh.addStaticHoliday ("15-JUN-2020", "VEB"); - - lh.addStaticHoliday ("24-JUN-2020", "VEB"); - - lh.addStaticHoliday ("29-JUN-2020", "VEB"); - - lh.addStaticHoliday ("24-JUL-2020", "VEB"); - - lh.addStaticHoliday ("12-OCT-2020", "VEB"); - - lh.addStaticHoliday ("07-DEC-2020", "VEB"); - - lh.addStaticHoliday ("25-DEC-2020", "VEB"); - - lh.addStaticHoliday ("01-JAN-2021", "VEB"); - - lh.addStaticHoliday ("04-JAN-2021", "VEB"); - - lh.addStaticHoliday ("15-FEB-2021", "VEB"); - - lh.addStaticHoliday ("16-FEB-2021", "VEB"); - - lh.addStaticHoliday ("19-MAR-2021", "VEB"); - - lh.addStaticHoliday ("01-APR-2021", "VEB"); - - lh.addStaticHoliday ("02-APR-2021", "VEB"); - - lh.addStaticHoliday ("19-APR-2021", "VEB"); - - lh.addStaticHoliday ("17-MAY-2021", "VEB"); - - lh.addStaticHoliday ("07-JUN-2021", "VEB"); - - lh.addStaticHoliday ("24-JUN-2021", "VEB"); - - lh.addStaticHoliday ("28-JUN-2021", "VEB"); - - lh.addStaticHoliday ("05-JUL-2021", "VEB"); - - lh.addStaticHoliday ("12-OCT-2021", "VEB"); - - lh.addStaticHoliday ("01-NOV-2021", "VEB"); - - lh.addStaticHoliday ("06-DEC-2021", "VEB"); - - lh.addStaticHoliday ("10-JAN-2022", "VEB"); - - lh.addStaticHoliday ("28-FEB-2022", "VEB"); - - lh.addStaticHoliday ("01-MAR-2022", "VEB"); - - lh.addStaticHoliday ("14-APR-2022", "VEB"); - - lh.addStaticHoliday ("15-APR-2022", "VEB"); - - lh.addStaticHoliday ("19-APR-2022", "VEB"); - - lh.addStaticHoliday ("30-MAY-2022", "VEB"); - - lh.addStaticHoliday ("20-JUN-2022", "VEB"); - - lh.addStaticHoliday ("24-JUN-2022", "VEB"); - - lh.addStaticHoliday ("27-JUN-2022", "VEB"); - - lh.addStaticHoliday ("05-JUL-2022", "VEB"); - - lh.addStaticHoliday ("15-AUG-2022", "VEB"); - - lh.addStaticHoliday ("12-OCT-2022", "VEB"); - - lh.addStaticHoliday ("31-OCT-2022", "VEB"); - - lh.addStaticHoliday ("12-DEC-2022", "VEB"); - - lh.addStaticHoliday ("09-JAN-2023", "VEB"); - - lh.addStaticHoliday ("20-FEB-2023", "VEB"); - - lh.addStaticHoliday ("21-FEB-2023", "VEB"); - - lh.addStaticHoliday ("06-APR-2023", "VEB"); - - lh.addStaticHoliday ("07-APR-2023", "VEB"); - - lh.addStaticHoliday ("19-APR-2023", "VEB"); - - lh.addStaticHoliday ("01-MAY-2023", "VEB"); - - lh.addStaticHoliday ("22-MAY-2023", "VEB"); - - lh.addStaticHoliday ("12-JUN-2023", "VEB"); - - lh.addStaticHoliday ("03-JUL-2023", "VEB"); - - lh.addStaticHoliday ("05-JUL-2023", "VEB"); - - lh.addStaticHoliday ("24-JUL-2023", "VEB"); - - lh.addStaticHoliday ("14-AUG-2023", "VEB"); - - lh.addStaticHoliday ("12-OCT-2023", "VEB"); - - lh.addStaticHoliday ("06-NOV-2023", "VEB"); - - lh.addStaticHoliday ("11-DEC-2023", "VEB"); - - lh.addStaticHoliday ("25-DEC-2023", "VEB"); - - lh.addStaticHoliday ("01-JAN-2024", "VEB"); - - lh.addStaticHoliday ("12-FEB-2024", "VEB"); - - lh.addStaticHoliday ("13-FEB-2024", "VEB"); - - lh.addStaticHoliday ("19-MAR-2024", "VEB"); - - lh.addStaticHoliday ("28-MAR-2024", "VEB"); - - lh.addStaticHoliday ("29-MAR-2024", "VEB"); - - lh.addStaticHoliday ("19-APR-2024", "VEB"); - - lh.addStaticHoliday ("01-MAY-2024", "VEB"); - - lh.addStaticHoliday ("13-MAY-2024", "VEB"); - - lh.addStaticHoliday ("03-JUN-2024", "VEB"); - - lh.addStaticHoliday ("24-JUN-2024", "VEB"); - - lh.addStaticHoliday ("05-JUL-2024", "VEB"); - - lh.addStaticHoliday ("24-JUL-2024", "VEB"); - - lh.addStaticHoliday ("19-AUG-2024", "VEB"); - - lh.addStaticHoliday ("04-NOV-2024", "VEB"); - - lh.addStaticHoliday ("25-DEC-2024", "VEB"); - - lh.addStaticHoliday ("01-JAN-2025", "VEB"); - - lh.addStaticHoliday ("06-JAN-2025", "VEB"); - - lh.addStaticHoliday ("03-MAR-2025", "VEB"); - - lh.addStaticHoliday ("04-MAR-2025", "VEB"); - - lh.addStaticHoliday ("19-MAR-2025", "VEB"); - - lh.addStaticHoliday ("17-APR-2025", "VEB"); - - lh.addStaticHoliday ("18-APR-2025", "VEB"); - - lh.addStaticHoliday ("01-MAY-2025", "VEB"); - - lh.addStaticHoliday ("02-JUN-2025", "VEB"); - - lh.addStaticHoliday ("16-JUN-2025", "VEB"); - - lh.addStaticHoliday ("24-JUN-2025", "VEB"); - - lh.addStaticHoliday ("24-JUL-2025", "VEB"); - - lh.addStaticHoliday ("18-AUG-2025", "VEB"); - - lh.addStaticHoliday ("08-DEC-2025", "VEB"); - - lh.addStaticHoliday ("25-DEC-2025", "VEB"); - - lh.addStaticHoliday ("01-JAN-2026", "VEB"); - - lh.addStaticHoliday ("05-JAN-2026", "VEB"); - - lh.addStaticHoliday ("16-FEB-2026", "VEB"); - - lh.addStaticHoliday ("17-FEB-2026", "VEB"); - - lh.addStaticHoliday ("19-MAR-2026", "VEB"); - - lh.addStaticHoliday ("02-APR-2026", "VEB"); - - lh.addStaticHoliday ("03-APR-2026", "VEB"); - - lh.addStaticHoliday ("01-MAY-2026", "VEB"); - - lh.addStaticHoliday ("18-MAY-2026", "VEB"); - - lh.addStaticHoliday ("08-JUN-2026", "VEB"); - - lh.addStaticHoliday ("24-JUN-2026", "VEB"); - - lh.addStaticHoliday ("29-JUN-2026", "VEB"); - - lh.addStaticHoliday ("24-JUL-2026", "VEB"); - - lh.addStaticHoliday ("12-OCT-2026", "VEB"); - - lh.addStaticHoliday ("07-DEC-2026", "VEB"); - - lh.addStaticHoliday ("25-DEC-2026", "VEB"); - - lh.addStaticHoliday ("01-JAN-2027", "VEB"); - - lh.addStaticHoliday ("04-JAN-2027", "VEB"); - - lh.addStaticHoliday ("08-FEB-2027", "VEB"); - - lh.addStaticHoliday ("09-FEB-2027", "VEB"); - - lh.addStaticHoliday ("19-MAR-2027", "VEB"); - - lh.addStaticHoliday ("25-MAR-2027", "VEB"); - - lh.addStaticHoliday ("26-MAR-2027", "VEB"); - - lh.addStaticHoliday ("19-APR-2027", "VEB"); - - lh.addStaticHoliday ("10-MAY-2027", "VEB"); - - lh.addStaticHoliday ("31-MAY-2027", "VEB"); - - lh.addStaticHoliday ("24-JUN-2027", "VEB"); - - lh.addStaticHoliday ("28-JUN-2027", "VEB"); - - lh.addStaticHoliday ("05-JUL-2027", "VEB"); - - lh.addStaticHoliday ("12-OCT-2027", "VEB"); - - lh.addStaticHoliday ("01-NOV-2027", "VEB"); - - lh.addStaticHoliday ("06-DEC-2027", "VEB"); - - lh.addStaticHoliday ("10-JAN-2028", "VEB"); - - lh.addStaticHoliday ("28-FEB-2028", "VEB"); - - lh.addStaticHoliday ("29-FEB-2028", "VEB"); - - lh.addStaticHoliday ("13-APR-2028", "VEB"); - - lh.addStaticHoliday ("14-APR-2028", "VEB"); - - lh.addStaticHoliday ("19-APR-2028", "VEB"); - - lh.addStaticHoliday ("01-MAY-2028", "VEB"); - - lh.addStaticHoliday ("29-MAY-2028", "VEB"); - - lh.addStaticHoliday ("19-JUN-2028", "VEB"); - - lh.addStaticHoliday ("03-JUL-2028", "VEB"); - - lh.addStaticHoliday ("05-JUL-2028", "VEB"); - - lh.addStaticHoliday ("24-JUL-2028", "VEB"); - - lh.addStaticHoliday ("14-AUG-2028", "VEB"); - - lh.addStaticHoliday ("12-OCT-2028", "VEB"); - - lh.addStaticHoliday ("06-NOV-2028", "VEB"); - - lh.addStaticHoliday ("11-DEC-2028", "VEB"); - - lh.addStaticHoliday ("25-DEC-2028", "VEB"); - - lh.addStaticHoliday ("01-JAN-2029", "VEB"); - - lh.addStaticHoliday ("12-FEB-2029", "VEB"); - - lh.addStaticHoliday ("13-FEB-2029", "VEB"); - - lh.addStaticHoliday ("19-MAR-2029", "VEB"); - - lh.addStaticHoliday ("29-MAR-2029", "VEB"); - - lh.addStaticHoliday ("30-MAR-2029", "VEB"); - - lh.addStaticHoliday ("19-APR-2029", "VEB"); - - lh.addStaticHoliday ("01-MAY-2029", "VEB"); - - lh.addStaticHoliday ("14-MAY-2029", "VEB"); - - lh.addStaticHoliday ("04-JUN-2029", "VEB"); - - lh.addStaticHoliday ("02-JUL-2029", "VEB"); - - lh.addStaticHoliday ("05-JUL-2029", "VEB"); - - lh.addStaticHoliday ("24-JUL-2029", "VEB"); - - lh.addStaticHoliday ("20-AUG-2029", "VEB"); - - lh.addStaticHoliday ("12-OCT-2029", "VEB"); - - lh.addStaticHoliday ("05-NOV-2029", "VEB"); - - lh.addStaticHoliday ("25-DEC-2029", "VEB"); - - lh.addStaticHoliday ("01-JAN-2030", "VEB"); - - lh.addStaticHoliday ("04-MAR-2030", "VEB"); - - lh.addStaticHoliday ("05-MAR-2030", "VEB"); - - lh.addStaticHoliday ("19-MAR-2030", "VEB"); - - lh.addStaticHoliday ("18-APR-2030", "VEB"); - - lh.addStaticHoliday ("19-APR-2030", "VEB"); - - lh.addStaticHoliday ("01-MAY-2030", "VEB"); - - lh.addStaticHoliday ("03-JUN-2030", "VEB"); - - lh.addStaticHoliday ("24-JUN-2030", "VEB"); - - lh.addStaticHoliday ("05-JUL-2030", "VEB"); - - lh.addStaticHoliday ("24-JUL-2030", "VEB"); - - lh.addStaticHoliday ("19-AUG-2030", "VEB"); - - lh.addStaticHoliday ("04-NOV-2030", "VEB"); - - lh.addStaticHoliday ("25-DEC-2030", "VEB"); - - lh.addStaticHoliday ("01-JAN-2031", "VEB"); - - lh.addStaticHoliday ("06-JAN-2031", "VEB"); - - lh.addStaticHoliday ("24-FEB-2031", "VEB"); - - lh.addStaticHoliday ("25-FEB-2031", "VEB"); - - lh.addStaticHoliday ("19-MAR-2031", "VEB"); - - lh.addStaticHoliday ("10-APR-2031", "VEB"); - - lh.addStaticHoliday ("11-APR-2031", "VEB"); - - lh.addStaticHoliday ("01-MAY-2031", "VEB"); - - lh.addStaticHoliday ("26-MAY-2031", "VEB"); - - lh.addStaticHoliday ("16-JUN-2031", "VEB"); - - lh.addStaticHoliday ("24-JUN-2031", "VEB"); - - lh.addStaticHoliday ("24-JUL-2031", "VEB"); - - lh.addStaticHoliday ("18-AUG-2031", "VEB"); - - lh.addStaticHoliday ("08-DEC-2031", "VEB"); - - lh.addStaticHoliday ("25-DEC-2031", "VEB"); - - lh.addStaticHoliday ("01-JAN-2032", "VEB"); - - lh.addStaticHoliday ("05-JAN-2032", "VEB"); - - lh.addStaticHoliday ("09-FEB-2032", "VEB"); - - lh.addStaticHoliday ("10-FEB-2032", "VEB"); - - lh.addStaticHoliday ("19-MAR-2032", "VEB"); - - lh.addStaticHoliday ("25-MAR-2032", "VEB"); - - lh.addStaticHoliday ("26-MAR-2032", "VEB"); - - lh.addStaticHoliday ("19-APR-2032", "VEB"); - - lh.addStaticHoliday ("10-MAY-2032", "VEB"); - - lh.addStaticHoliday ("31-MAY-2032", "VEB"); - - lh.addStaticHoliday ("24-JUN-2032", "VEB"); - - lh.addStaticHoliday ("28-JUN-2032", "VEB"); - - lh.addStaticHoliday ("05-JUL-2032", "VEB"); - - lh.addStaticHoliday ("12-OCT-2032", "VEB"); - - lh.addStaticHoliday ("01-NOV-2032", "VEB"); - - lh.addStaticHoliday ("06-DEC-2032", "VEB"); - - lh.addStaticHoliday ("10-JAN-2033", "VEB"); - - lh.addStaticHoliday ("28-FEB-2033", "VEB"); - - lh.addStaticHoliday ("01-MAR-2033", "VEB"); - - lh.addStaticHoliday ("14-APR-2033", "VEB"); - - lh.addStaticHoliday ("15-APR-2033", "VEB"); - - lh.addStaticHoliday ("19-APR-2033", "VEB"); - - lh.addStaticHoliday ("30-MAY-2033", "VEB"); - - lh.addStaticHoliday ("20-JUN-2033", "VEB"); - - lh.addStaticHoliday ("24-JUN-2033", "VEB"); - - lh.addStaticHoliday ("27-JUN-2033", "VEB"); - - lh.addStaticHoliday ("05-JUL-2033", "VEB"); - - lh.addStaticHoliday ("15-AUG-2033", "VEB"); - - lh.addStaticHoliday ("12-OCT-2033", "VEB"); - - lh.addStaticHoliday ("31-OCT-2033", "VEB"); - - lh.addStaticHoliday ("12-DEC-2033", "VEB"); - - lh.addStaticHoliday ("09-JAN-2034", "VEB"); - - lh.addStaticHoliday ("20-FEB-2034", "VEB"); - - lh.addStaticHoliday ("21-FEB-2034", "VEB"); - - lh.addStaticHoliday ("06-APR-2034", "VEB"); - - lh.addStaticHoliday ("07-APR-2034", "VEB"); - - lh.addStaticHoliday ("19-APR-2034", "VEB"); - - lh.addStaticHoliday ("01-MAY-2034", "VEB"); - - lh.addStaticHoliday ("22-MAY-2034", "VEB"); - - lh.addStaticHoliday ("12-JUN-2034", "VEB"); - - lh.addStaticHoliday ("03-JUL-2034", "VEB"); - - lh.addStaticHoliday ("05-JUL-2034", "VEB"); - - lh.addStaticHoliday ("24-JUL-2034", "VEB"); - - lh.addStaticHoliday ("14-AUG-2034", "VEB"); - - lh.addStaticHoliday ("12-OCT-2034", "VEB"); - - lh.addStaticHoliday ("06-NOV-2034", "VEB"); - - lh.addStaticHoliday ("11-DEC-2034", "VEB"); - - lh.addStaticHoliday ("25-DEC-2034", "VEB"); - - lh.addStaticHoliday ("01-JAN-2035", "VEB"); - - lh.addStaticHoliday ("05-FEB-2035", "VEB"); - - lh.addStaticHoliday ("06-FEB-2035", "VEB"); - - lh.addStaticHoliday ("19-MAR-2035", "VEB"); - - lh.addStaticHoliday ("22-MAR-2035", "VEB"); - - lh.addStaticHoliday ("23-MAR-2035", "VEB"); - - lh.addStaticHoliday ("19-APR-2035", "VEB"); - - lh.addStaticHoliday ("01-MAY-2035", "VEB"); - - lh.addStaticHoliday ("07-MAY-2035", "VEB"); - - lh.addStaticHoliday ("28-MAY-2035", "VEB"); - - lh.addStaticHoliday ("02-JUL-2035", "VEB"); - - lh.addStaticHoliday ("05-JUL-2035", "VEB"); - - lh.addStaticHoliday ("24-JUL-2035", "VEB"); - - lh.addStaticHoliday ("20-AUG-2035", "VEB"); - - lh.addStaticHoliday ("12-OCT-2035", "VEB"); - - lh.addStaticHoliday ("05-NOV-2035", "VEB"); - - lh.addStaticHoliday ("25-DEC-2035", "VEB"); - - lh.addStaticHoliday ("01-JAN-2036", "VEB"); - - lh.addStaticHoliday ("25-FEB-2036", "VEB"); - - lh.addStaticHoliday ("26-FEB-2036", "VEB"); - - lh.addStaticHoliday ("19-MAR-2036", "VEB"); - - lh.addStaticHoliday ("10-APR-2036", "VEB"); - - lh.addStaticHoliday ("11-APR-2036", "VEB"); - - lh.addStaticHoliday ("01-MAY-2036", "VEB"); - - lh.addStaticHoliday ("26-MAY-2036", "VEB"); - - lh.addStaticHoliday ("16-JUN-2036", "VEB"); - - lh.addStaticHoliday ("24-JUN-2036", "VEB"); - - lh.addStaticHoliday ("24-JUL-2036", "VEB"); - - lh.addStaticHoliday ("18-AUG-2036", "VEB"); - - lh.addStaticHoliday ("08-DEC-2036", "VEB"); - - lh.addStaticHoliday ("25-DEC-2036", "VEB"); - - lh.addStaticHoliday ("01-JAN-2037", "VEB"); - - lh.addStaticHoliday ("05-JAN-2037", "VEB"); - - lh.addStaticHoliday ("16-FEB-2037", "VEB"); - - lh.addStaticHoliday ("17-FEB-2037", "VEB"); - - lh.addStaticHoliday ("19-MAR-2037", "VEB"); - - lh.addStaticHoliday ("02-APR-2037", "VEB"); - - lh.addStaticHoliday ("03-APR-2037", "VEB"); - - lh.addStaticHoliday ("01-MAY-2037", "VEB"); - - lh.addStaticHoliday ("18-MAY-2037", "VEB"); - - lh.addStaticHoliday ("08-JUN-2037", "VEB"); - - lh.addStaticHoliday ("24-JUN-2037", "VEB"); - - lh.addStaticHoliday ("29-JUN-2037", "VEB"); - - lh.addStaticHoliday ("24-JUL-2037", "VEB"); - - lh.addStaticHoliday ("12-OCT-2037", "VEB"); - - lh.addStaticHoliday ("07-DEC-2037", "VEB"); - - lh.addStaticHoliday ("25-DEC-2037", "VEB"); - - lh.addStaticHoliday ("01-JAN-2038", "VEB"); - - lh.addStaticHoliday ("04-JAN-2038", "VEB"); - - lh.addStaticHoliday ("08-MAR-2038", "VEB"); - - lh.addStaticHoliday ("09-MAR-2038", "VEB"); - - lh.addStaticHoliday ("19-MAR-2038", "VEB"); - - lh.addStaticHoliday ("19-APR-2038", "VEB"); - - lh.addStaticHoliday ("22-APR-2038", "VEB"); - - lh.addStaticHoliday ("23-APR-2038", "VEB"); - - lh.addStaticHoliday ("07-JUN-2038", "VEB"); - - lh.addStaticHoliday ("24-JUN-2038", "VEB"); - - lh.addStaticHoliday ("28-JUN-2038", "VEB"); - - lh.addStaticHoliday ("05-JUL-2038", "VEB"); - - lh.addStaticHoliday ("12-OCT-2038", "VEB"); - - lh.addStaticHoliday ("01-NOV-2038", "VEB"); - - lh.addStaticHoliday ("06-DEC-2038", "VEB"); - - lh.addStaticHoliday ("10-JAN-2039", "VEB"); - - lh.addStaticHoliday ("21-FEB-2039", "VEB"); - - lh.addStaticHoliday ("22-FEB-2039", "VEB"); - - lh.addStaticHoliday ("07-APR-2039", "VEB"); - - lh.addStaticHoliday ("08-APR-2039", "VEB"); - - lh.addStaticHoliday ("19-APR-2039", "VEB"); - - lh.addStaticHoliday ("23-MAY-2039", "VEB"); - - lh.addStaticHoliday ("13-JUN-2039", "VEB"); - - lh.addStaticHoliday ("24-JUN-2039", "VEB"); - - lh.addStaticHoliday ("27-JUN-2039", "VEB"); - - lh.addStaticHoliday ("05-JUL-2039", "VEB"); - - lh.addStaticHoliday ("15-AUG-2039", "VEB"); - - lh.addStaticHoliday ("12-OCT-2039", "VEB"); - - lh.addStaticHoliday ("31-OCT-2039", "VEB"); - - lh.addStaticHoliday ("12-DEC-2039", "VEB"); - - lh.addStaticHoliday ("09-JAN-2040", "VEB"); - - lh.addStaticHoliday ("13-FEB-2040", "VEB"); - - lh.addStaticHoliday ("14-FEB-2040", "VEB"); - - lh.addStaticHoliday ("19-MAR-2040", "VEB"); - - lh.addStaticHoliday ("29-MAR-2040", "VEB"); - - lh.addStaticHoliday ("30-MAR-2040", "VEB"); - - lh.addStaticHoliday ("19-APR-2040", "VEB"); - - lh.addStaticHoliday ("01-MAY-2040", "VEB"); - - lh.addStaticHoliday ("14-MAY-2040", "VEB"); - - lh.addStaticHoliday ("04-JUN-2040", "VEB"); - - lh.addStaticHoliday ("02-JUL-2040", "VEB"); - - lh.addStaticHoliday ("05-JUL-2040", "VEB"); - - lh.addStaticHoliday ("24-JUL-2040", "VEB"); - - lh.addStaticHoliday ("20-AUG-2040", "VEB"); - - lh.addStaticHoliday ("12-OCT-2040", "VEB"); - - lh.addStaticHoliday ("05-NOV-2040", "VEB"); - - lh.addStaticHoliday ("25-DEC-2040", "VEB"); - - lh.addStaticHoliday ("01-JAN-2041", "VEB"); - - lh.addStaticHoliday ("04-MAR-2041", "VEB"); - - lh.addStaticHoliday ("05-MAR-2041", "VEB"); - - lh.addStaticHoliday ("19-MAR-2041", "VEB"); - - lh.addStaticHoliday ("18-APR-2041", "VEB"); - - lh.addStaticHoliday ("19-APR-2041", "VEB"); - - lh.addStaticHoliday ("01-MAY-2041", "VEB"); - - lh.addStaticHoliday ("03-JUN-2041", "VEB"); - - lh.addStaticHoliday ("24-JUN-2041", "VEB"); - - lh.addStaticHoliday ("05-JUL-2041", "VEB"); - - lh.addStaticHoliday ("24-JUL-2041", "VEB"); - - lh.addStaticHoliday ("19-AUG-2041", "VEB"); - - lh.addStaticHoliday ("04-NOV-2041", "VEB"); - - lh.addStaticHoliday ("25-DEC-2041", "VEB"); - - lh.addStaticHoliday ("01-JAN-2042", "VEB"); - - lh.addStaticHoliday ("06-JAN-2042", "VEB"); - - lh.addStaticHoliday ("17-FEB-2042", "VEB"); - - lh.addStaticHoliday ("18-FEB-2042", "VEB"); - - lh.addStaticHoliday ("19-MAR-2042", "VEB"); - - lh.addStaticHoliday ("03-APR-2042", "VEB"); - - lh.addStaticHoliday ("04-APR-2042", "VEB"); - - lh.addStaticHoliday ("01-MAY-2042", "VEB"); - - lh.addStaticHoliday ("19-MAY-2042", "VEB"); - - lh.addStaticHoliday ("09-JUN-2042", "VEB"); - - lh.addStaticHoliday ("24-JUN-2042", "VEB"); - - lh.addStaticHoliday ("24-JUL-2042", "VEB"); - - lh.addStaticHoliday ("18-AUG-2042", "VEB"); - - lh.addStaticHoliday ("08-DEC-2042", "VEB"); - - lh.addStaticHoliday ("25-DEC-2042", "VEB"); - - lh.addStaticHoliday ("01-JAN-2043", "VEB"); - - lh.addStaticHoliday ("05-JAN-2043", "VEB"); - - lh.addStaticHoliday ("09-FEB-2043", "VEB"); - - lh.addStaticHoliday ("10-FEB-2043", "VEB"); - - lh.addStaticHoliday ("19-MAR-2043", "VEB"); - - lh.addStaticHoliday ("26-MAR-2043", "VEB"); - - lh.addStaticHoliday ("27-MAR-2043", "VEB"); - - lh.addStaticHoliday ("01-MAY-2043", "VEB"); - - lh.addStaticHoliday ("11-MAY-2043", "VEB"); - - lh.addStaticHoliday ("01-JUN-2043", "VEB"); - - lh.addStaticHoliday ("24-JUN-2043", "VEB"); - - lh.addStaticHoliday ("29-JUN-2043", "VEB"); - - lh.addStaticHoliday ("24-JUL-2043", "VEB"); - - lh.addStaticHoliday ("12-OCT-2043", "VEB"); - - lh.addStaticHoliday ("07-DEC-2043", "VEB"); - - lh.addStaticHoliday ("25-DEC-2043", "VEB"); - - lh.addStaticHoliday ("01-JAN-2044", "VEB"); - - lh.addStaticHoliday ("04-JAN-2044", "VEB"); - - lh.addStaticHoliday ("29-FEB-2044", "VEB"); - - lh.addStaticHoliday ("01-MAR-2044", "VEB"); - - lh.addStaticHoliday ("14-APR-2044", "VEB"); - - lh.addStaticHoliday ("15-APR-2044", "VEB"); - - lh.addStaticHoliday ("19-APR-2044", "VEB"); - - lh.addStaticHoliday ("30-MAY-2044", "VEB"); - - lh.addStaticHoliday ("20-JUN-2044", "VEB"); - - lh.addStaticHoliday ("24-JUN-2044", "VEB"); - - lh.addStaticHoliday ("27-JUN-2044", "VEB"); - - lh.addStaticHoliday ("05-JUL-2044", "VEB"); - - lh.addStaticHoliday ("15-AUG-2044", "VEB"); - - lh.addStaticHoliday ("12-OCT-2044", "VEB"); - - lh.addStaticHoliday ("31-OCT-2044", "VEB"); - - lh.addStaticHoliday ("12-DEC-2044", "VEB"); - - lh.addStaticHoliday ("09-JAN-2045", "VEB"); - - lh.addStaticHoliday ("20-FEB-2045", "VEB"); - - lh.addStaticHoliday ("21-FEB-2045", "VEB"); - - lh.addStaticHoliday ("06-APR-2045", "VEB"); - - lh.addStaticHoliday ("07-APR-2045", "VEB"); - - lh.addStaticHoliday ("19-APR-2045", "VEB"); - - lh.addStaticHoliday ("01-MAY-2045", "VEB"); - - lh.addStaticHoliday ("22-MAY-2045", "VEB"); - - lh.addStaticHoliday ("12-JUN-2045", "VEB"); - - lh.addStaticHoliday ("03-JUL-2045", "VEB"); - - lh.addStaticHoliday ("05-JUL-2045", "VEB"); - - lh.addStaticHoliday ("24-JUL-2045", "VEB"); - - lh.addStaticHoliday ("14-AUG-2045", "VEB"); - - lh.addStaticHoliday ("12-OCT-2045", "VEB"); - - lh.addStaticHoliday ("06-NOV-2045", "VEB"); - - lh.addStaticHoliday ("11-DEC-2045", "VEB"); - - lh.addStaticHoliday ("25-DEC-2045", "VEB"); - - lh.addStaticHoliday ("01-JAN-2046", "VEB"); - - lh.addStaticHoliday ("05-FEB-2046", "VEB"); - - lh.addStaticHoliday ("06-FEB-2046", "VEB"); - - lh.addStaticHoliday ("19-MAR-2046", "VEB"); - - lh.addStaticHoliday ("22-MAR-2046", "VEB"); - - lh.addStaticHoliday ("23-MAR-2046", "VEB"); - - lh.addStaticHoliday ("19-APR-2046", "VEB"); - - lh.addStaticHoliday ("01-MAY-2046", "VEB"); - - lh.addStaticHoliday ("07-MAY-2046", "VEB"); - - lh.addStaticHoliday ("28-MAY-2046", "VEB"); - - lh.addStaticHoliday ("02-JUL-2046", "VEB"); - - lh.addStaticHoliday ("05-JUL-2046", "VEB"); - - lh.addStaticHoliday ("24-JUL-2046", "VEB"); - - lh.addStaticHoliday ("20-AUG-2046", "VEB"); - - lh.addStaticHoliday ("12-OCT-2046", "VEB"); - - lh.addStaticHoliday ("05-NOV-2046", "VEB"); - - lh.addStaticHoliday ("25-DEC-2046", "VEB"); - - lh.addStaticHoliday ("01-JAN-2047", "VEB"); - - lh.addStaticHoliday ("25-FEB-2047", "VEB"); - - lh.addStaticHoliday ("26-FEB-2047", "VEB"); - - lh.addStaticHoliday ("19-MAR-2047", "VEB"); - - lh.addStaticHoliday ("11-APR-2047", "VEB"); - - lh.addStaticHoliday ("12-APR-2047", "VEB"); - - lh.addStaticHoliday ("19-APR-2047", "VEB"); - - lh.addStaticHoliday ("01-MAY-2047", "VEB"); - - lh.addStaticHoliday ("27-MAY-2047", "VEB"); - - lh.addStaticHoliday ("17-JUN-2047", "VEB"); - - lh.addStaticHoliday ("24-JUN-2047", "VEB"); - - lh.addStaticHoliday ("05-JUL-2047", "VEB"); - - lh.addStaticHoliday ("24-JUL-2047", "VEB"); - - lh.addStaticHoliday ("19-AUG-2047", "VEB"); - - lh.addStaticHoliday ("04-NOV-2047", "VEB"); - - lh.addStaticHoliday ("25-DEC-2047", "VEB"); - - lh.addStaticHoliday ("01-JAN-2048", "VEB"); - - lh.addStaticHoliday ("06-JAN-2048", "VEB"); - - lh.addStaticHoliday ("17-FEB-2048", "VEB"); - - lh.addStaticHoliday ("18-FEB-2048", "VEB"); - - lh.addStaticHoliday ("19-MAR-2048", "VEB"); - - lh.addStaticHoliday ("02-APR-2048", "VEB"); - - lh.addStaticHoliday ("03-APR-2048", "VEB"); - - lh.addStaticHoliday ("01-MAY-2048", "VEB"); - - lh.addStaticHoliday ("18-MAY-2048", "VEB"); - - lh.addStaticHoliday ("08-JUN-2048", "VEB"); - - lh.addStaticHoliday ("24-JUN-2048", "VEB"); - - lh.addStaticHoliday ("29-JUN-2048", "VEB"); - - lh.addStaticHoliday ("24-JUL-2048", "VEB"); - - lh.addStaticHoliday ("12-OCT-2048", "VEB"); - - lh.addStaticHoliday ("07-DEC-2048", "VEB"); - - lh.addStaticHoliday ("25-DEC-2048", "VEB"); - - lh.addStaticHoliday ("01-JAN-2049", "VEB"); - - lh.addStaticHoliday ("04-JAN-2049", "VEB"); - - lh.addStaticHoliday ("01-MAR-2049", "VEB"); - - lh.addStaticHoliday ("02-MAR-2049", "VEB"); - - lh.addStaticHoliday ("19-MAR-2049", "VEB"); - - lh.addStaticHoliday ("15-APR-2049", "VEB"); - - lh.addStaticHoliday ("16-APR-2049", "VEB"); - - lh.addStaticHoliday ("19-APR-2049", "VEB"); - - lh.addStaticHoliday ("31-MAY-2049", "VEB"); - - lh.addStaticHoliday ("21-JUN-2049", "VEB"); - - lh.addStaticHoliday ("24-JUN-2049", "VEB"); - - lh.addStaticHoliday ("28-JUN-2049", "VEB"); - - lh.addStaticHoliday ("05-JUL-2049", "VEB"); - - lh.addStaticHoliday ("12-OCT-2049", "VEB"); - - lh.addStaticHoliday ("01-NOV-2049", "VEB"); - - lh.addStaticHoliday ("06-DEC-2049", "VEB"); - - lh.addStaticHoliday ("10-JAN-2050", "VEB"); - - lh.addStaticHoliday ("21-FEB-2050", "VEB"); - - lh.addStaticHoliday ("22-FEB-2050", "VEB"); - - lh.addStaticHoliday ("07-APR-2050", "VEB"); - - lh.addStaticHoliday ("08-APR-2050", "VEB"); - - lh.addStaticHoliday ("19-APR-2050", "VEB"); - - lh.addStaticHoliday ("23-MAY-2050", "VEB"); - - lh.addStaticHoliday ("13-JUN-2050", "VEB"); - - lh.addStaticHoliday ("24-JUN-2050", "VEB"); - - lh.addStaticHoliday ("27-JUN-2050", "VEB"); - - lh.addStaticHoliday ("05-JUL-2050", "VEB"); - - lh.addStaticHoliday ("15-AUG-2050", "VEB"); - - lh.addStaticHoliday ("12-OCT-2050", "VEB"); - - lh.addStaticHoliday ("31-OCT-2050", "VEB"); - - lh.addStaticHoliday ("12-DEC-2050", "VEB"); - - lh.addStaticHoliday ("09-JAN-2051", "VEB"); - - lh.addStaticHoliday ("13-FEB-2051", "VEB"); - - lh.addStaticHoliday ("14-FEB-2051", "VEB"); - - lh.addStaticHoliday ("30-MAR-2051", "VEB"); - - lh.addStaticHoliday ("31-MAR-2051", "VEB"); - - lh.addStaticHoliday ("19-APR-2051", "VEB"); - - lh.addStaticHoliday ("01-MAY-2051", "VEB"); - - lh.addStaticHoliday ("15-MAY-2051", "VEB"); - - lh.addStaticHoliday ("05-JUN-2051", "VEB"); - - lh.addStaticHoliday ("03-JUL-2051", "VEB"); - - lh.addStaticHoliday ("05-JUL-2051", "VEB"); - - lh.addStaticHoliday ("24-JUL-2051", "VEB"); - - lh.addStaticHoliday ("14-AUG-2051", "VEB"); - - lh.addStaticHoliday ("12-OCT-2051", "VEB"); - - lh.addStaticHoliday ("06-NOV-2051", "VEB"); - - lh.addStaticHoliday ("11-DEC-2051", "VEB"); - - lh.addStaticHoliday ("25-DEC-2051", "VEB"); - - lh.addStaticHoliday ("01-JAN-2052", "VEB"); - - lh.addStaticHoliday ("04-MAR-2052", "VEB"); - - lh.addStaticHoliday ("05-MAR-2052", "VEB"); - - lh.addStaticHoliday ("19-MAR-2052", "VEB"); - - lh.addStaticHoliday ("18-APR-2052", "VEB"); - - lh.addStaticHoliday ("19-APR-2052", "VEB"); - - lh.addStaticHoliday ("01-MAY-2052", "VEB"); - - lh.addStaticHoliday ("03-JUN-2052", "VEB"); - - lh.addStaticHoliday ("24-JUN-2052", "VEB"); - - lh.addStaticHoliday ("05-JUL-2052", "VEB"); - - lh.addStaticHoliday ("24-JUL-2052", "VEB"); - - lh.addStaticHoliday ("19-AUG-2052", "VEB"); - - lh.addStaticHoliday ("04-NOV-2052", "VEB"); - - lh.addStaticHoliday ("25-DEC-2052", "VEB"); - - lh.addStaticHoliday ("01-JAN-2053", "VEB"); - - lh.addStaticHoliday ("06-JAN-2053", "VEB"); - - lh.addStaticHoliday ("17-FEB-2053", "VEB"); - - lh.addStaticHoliday ("18-FEB-2053", "VEB"); - - lh.addStaticHoliday ("19-MAR-2053", "VEB"); - - lh.addStaticHoliday ("03-APR-2053", "VEB"); - - lh.addStaticHoliday ("04-APR-2053", "VEB"); - - lh.addStaticHoliday ("01-MAY-2053", "VEB"); - - lh.addStaticHoliday ("19-MAY-2053", "VEB"); - - lh.addStaticHoliday ("09-JUN-2053", "VEB"); - - lh.addStaticHoliday ("24-JUN-2053", "VEB"); - - lh.addStaticHoliday ("24-JUL-2053", "VEB"); - - lh.addStaticHoliday ("18-AUG-2053", "VEB"); - - lh.addStaticHoliday ("08-DEC-2053", "VEB"); - - lh.addStaticHoliday ("25-DEC-2053", "VEB"); - - lh.addStaticHoliday ("01-JAN-2054", "VEB"); - - lh.addStaticHoliday ("05-JAN-2054", "VEB"); - - lh.addStaticHoliday ("09-FEB-2054", "VEB"); - - lh.addStaticHoliday ("10-FEB-2054", "VEB"); - - lh.addStaticHoliday ("19-MAR-2054", "VEB"); - - lh.addStaticHoliday ("26-MAR-2054", "VEB"); - - lh.addStaticHoliday ("27-MAR-2054", "VEB"); - - lh.addStaticHoliday ("01-MAY-2054", "VEB"); - - lh.addStaticHoliday ("11-MAY-2054", "VEB"); - - lh.addStaticHoliday ("01-JUN-2054", "VEB"); - - lh.addStaticHoliday ("24-JUN-2054", "VEB"); - - lh.addStaticHoliday ("29-JUN-2054", "VEB"); - - lh.addStaticHoliday ("24-JUL-2054", "VEB"); - - lh.addStaticHoliday ("12-OCT-2054", "VEB"); - - lh.addStaticHoliday ("07-DEC-2054", "VEB"); - - lh.addStaticHoliday ("25-DEC-2054", "VEB"); - - lh.addStaticHoliday ("01-JAN-2055", "VEB"); - - lh.addStaticHoliday ("04-JAN-2055", "VEB"); - - lh.addStaticHoliday ("01-MAR-2055", "VEB"); - - lh.addStaticHoliday ("02-MAR-2055", "VEB"); - - lh.addStaticHoliday ("19-MAR-2055", "VEB"); - - lh.addStaticHoliday ("15-APR-2055", "VEB"); - - lh.addStaticHoliday ("16-APR-2055", "VEB"); - - lh.addStaticHoliday ("19-APR-2055", "VEB"); - - lh.addStaticHoliday ("31-MAY-2055", "VEB"); - - lh.addStaticHoliday ("21-JUN-2055", "VEB"); - - lh.addStaticHoliday ("24-JUN-2055", "VEB"); - - lh.addStaticHoliday ("28-JUN-2055", "VEB"); - - lh.addStaticHoliday ("05-JUL-2055", "VEB"); - - lh.addStaticHoliday ("12-OCT-2055", "VEB"); - - lh.addStaticHoliday ("01-NOV-2055", "VEB"); - - lh.addStaticHoliday ("06-DEC-2055", "VEB"); - - lh.addStaticHoliday ("10-JAN-2056", "VEB"); - - lh.addStaticHoliday ("14-FEB-2056", "VEB"); - - lh.addStaticHoliday ("15-FEB-2056", "VEB"); - - lh.addStaticHoliday ("30-MAR-2056", "VEB"); - - lh.addStaticHoliday ("31-MAR-2056", "VEB"); - - lh.addStaticHoliday ("19-APR-2056", "VEB"); - - lh.addStaticHoliday ("01-MAY-2056", "VEB"); - - lh.addStaticHoliday ("15-MAY-2056", "VEB"); - - lh.addStaticHoliday ("05-JUN-2056", "VEB"); - - lh.addStaticHoliday ("03-JUL-2056", "VEB"); - - lh.addStaticHoliday ("05-JUL-2056", "VEB"); - - lh.addStaticHoliday ("24-JUL-2056", "VEB"); - - lh.addStaticHoliday ("14-AUG-2056", "VEB"); - - lh.addStaticHoliday ("12-OCT-2056", "VEB"); - - lh.addStaticHoliday ("06-NOV-2056", "VEB"); - - lh.addStaticHoliday ("11-DEC-2056", "VEB"); - - lh.addStaticHoliday ("25-DEC-2056", "VEB"); - - lh.addStaticHoliday ("01-JAN-2057", "VEB"); - - lh.addStaticHoliday ("05-MAR-2057", "VEB"); - - lh.addStaticHoliday ("06-MAR-2057", "VEB"); - - lh.addStaticHoliday ("19-MAR-2057", "VEB"); - - lh.addStaticHoliday ("19-APR-2057", "VEB"); - - lh.addStaticHoliday ("20-APR-2057", "VEB"); - - lh.addStaticHoliday ("01-MAY-2057", "VEB"); - - lh.addStaticHoliday ("04-JUN-2057", "VEB"); - - lh.addStaticHoliday ("25-JUN-2057", "VEB"); - - lh.addStaticHoliday ("02-JUL-2057", "VEB"); - - lh.addStaticHoliday ("05-JUL-2057", "VEB"); - - lh.addStaticHoliday ("24-JUL-2057", "VEB"); - - lh.addStaticHoliday ("20-AUG-2057", "VEB"); - - lh.addStaticHoliday ("12-OCT-2057", "VEB"); - - lh.addStaticHoliday ("05-NOV-2057", "VEB"); - - lh.addStaticHoliday ("25-DEC-2057", "VEB"); - - lh.addStaticHoliday ("01-JAN-2058", "VEB"); - - lh.addStaticHoliday ("25-FEB-2058", "VEB"); - - lh.addStaticHoliday ("26-FEB-2058", "VEB"); - - lh.addStaticHoliday ("19-MAR-2058", "VEB"); - - lh.addStaticHoliday ("11-APR-2058", "VEB"); - - lh.addStaticHoliday ("12-APR-2058", "VEB"); - - lh.addStaticHoliday ("19-APR-2058", "VEB"); - - lh.addStaticHoliday ("01-MAY-2058", "VEB"); - - lh.addStaticHoliday ("27-MAY-2058", "VEB"); - - lh.addStaticHoliday ("17-JUN-2058", "VEB"); - - lh.addStaticHoliday ("24-JUN-2058", "VEB"); - - lh.addStaticHoliday ("05-JUL-2058", "VEB"); - - lh.addStaticHoliday ("24-JUL-2058", "VEB"); - - lh.addStaticHoliday ("19-AUG-2058", "VEB"); - - lh.addStaticHoliday ("04-NOV-2058", "VEB"); - - lh.addStaticHoliday ("25-DEC-2058", "VEB"); - - lh.addStaticHoliday ("01-JAN-2059", "VEB"); - - lh.addStaticHoliday ("06-JAN-2059", "VEB"); - - lh.addStaticHoliday ("10-FEB-2059", "VEB"); - - lh.addStaticHoliday ("11-FEB-2059", "VEB"); - - lh.addStaticHoliday ("19-MAR-2059", "VEB"); - - lh.addStaticHoliday ("27-MAR-2059", "VEB"); - - lh.addStaticHoliday ("28-MAR-2059", "VEB"); - - lh.addStaticHoliday ("01-MAY-2059", "VEB"); - - lh.addStaticHoliday ("12-MAY-2059", "VEB"); - - lh.addStaticHoliday ("02-JUN-2059", "VEB"); - - lh.addStaticHoliday ("24-JUN-2059", "VEB"); - - lh.addStaticHoliday ("24-JUL-2059", "VEB"); - - lh.addStaticHoliday ("18-AUG-2059", "VEB"); - - lh.addStaticHoliday ("08-DEC-2059", "VEB"); - - lh.addStaticHoliday ("25-DEC-2059", "VEB"); - - lh.addStaticHoliday ("01-JAN-2060", "VEB"); - - lh.addStaticHoliday ("05-JAN-2060", "VEB"); - - lh.addStaticHoliday ("01-MAR-2060", "VEB"); - - lh.addStaticHoliday ("02-MAR-2060", "VEB"); - - lh.addStaticHoliday ("19-MAR-2060", "VEB"); - - lh.addStaticHoliday ("15-APR-2060", "VEB"); - - lh.addStaticHoliday ("16-APR-2060", "VEB"); - - lh.addStaticHoliday ("19-APR-2060", "VEB"); - - lh.addStaticHoliday ("31-MAY-2060", "VEB"); - - lh.addStaticHoliday ("21-JUN-2060", "VEB"); - - lh.addStaticHoliday ("24-JUN-2060", "VEB"); - - lh.addStaticHoliday ("28-JUN-2060", "VEB"); - - lh.addStaticHoliday ("05-JUL-2060", "VEB"); - - lh.addStaticHoliday ("12-OCT-2060", "VEB"); - - lh.addStaticHoliday ("01-NOV-2060", "VEB"); - - lh.addStaticHoliday ("06-DEC-2060", "VEB"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/VEFHoliday.java b/org/drip/analytics/holset/VEFHoliday.java deleted file mode 100644 index 523dd7f..0000000 --- a/org/drip/analytics/holset/VEFHoliday.java +++ /dev/null @@ -1,2055 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class VEFHoliday implements org.drip.analytics.holset.LocationHoliday { - public VEFHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "VEF"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("05-JAN-1998", "Epiphany Observed"); - - lh.addStaticHoliday ("23-FEB-1998", "Carnival Monday"); - - lh.addStaticHoliday ("24-FEB-1998", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-MAR-1998", "St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-1998", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-1998", "Ascension Day"); - - lh.addStaticHoliday ("15-JUN-1998", "Corpus Christi"); - - lh.addStaticHoliday ("24-JUN-1998", "Battle of Carabobo Day"); - - lh.addStaticHoliday ("29-JUN-1998", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("24-JUL-1998", "Bolivars Birthday"); - - lh.addStaticHoliday ("12-OCT-1998", "Day of the Race"); - - lh.addStaticHoliday ("07-DEC-1998", "Immaculate Conception Observed"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-1999", "Epiphany Observed"); - - lh.addStaticHoliday ("15-FEB-1999", "Carnival Monday"); - - lh.addStaticHoliday ("16-FEB-1999", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-MAR-1999", "St. Josephs Day"); - - lh.addStaticHoliday ("01-APR-1999", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("19-APR-1999", "Constitution Day"); - - lh.addStaticHoliday ("17-MAY-1999", "Ascension Day"); - - lh.addStaticHoliday ("07-JUN-1999", "Corpus Christi"); - - lh.addStaticHoliday ("24-JUN-1999", "Battle of Carabobo Day"); - - lh.addStaticHoliday ("28-JUN-1999", "Saints Peter and Paul Day Observed"); - - lh.addStaticHoliday ("05-JUL-1999", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-1999", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("06-DEC-1999", "Immaculate Conception Observed"); - - lh.addStaticHoliday ("10-JAN-2000", "Epiphany Observed"); - - lh.addStaticHoliday ("06-MAR-2000", "Carnival Monday"); - - lh.addStaticHoliday ("07-MAR-2000", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-APR-2000", "Constitution Day"); - - lh.addStaticHoliday ("20-APR-2000", "Holy Thursday"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("05-JUN-2000", "Ascension Day"); - - lh.addStaticHoliday ("26-JUN-2000", "Corpus Christi"); - - lh.addStaticHoliday ("05-JUL-2000", "Independence Day"); - - lh.addStaticHoliday ("24-JUL-2000", "Bolivars Birthday"); - - lh.addStaticHoliday ("14-AUG-2000", "Assumption Day Observed"); - - lh.addStaticHoliday ("12-OCT-2000", "Day of the Race"); - - lh.addStaticHoliday ("30-OCT-2000", "All Saints Day Observed"); - - lh.addStaticHoliday ("11-DEC-2000", "Immaculate Conception Observed"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("26-FEB-2001", "Carnival Monday"); - - lh.addStaticHoliday ("27-FEB-2001", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-MAR-2001", "St. Josephs Day"); - - lh.addStaticHoliday ("12-APR-2001", "Holy Thursday"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2001", "Constitution Day"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("28-MAY-2001", "Ascension Day"); - - lh.addStaticHoliday ("18-JUN-2001", "Corpus Christi"); - - lh.addStaticHoliday ("02-JUL-2001", "Saints Peter and Paul Day Observed"); - - lh.addStaticHoliday ("05-JUL-2001", "Independence Day"); - - lh.addStaticHoliday ("24-JUL-2001", "Bolivars Birthday"); - - lh.addStaticHoliday ("13-AUG-2001", "Assumption Day Observed"); - - lh.addStaticHoliday ("12-OCT-2001", "Day of the Race"); - - lh.addStaticHoliday ("05-NOV-2001", "All Saints Day Observed"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2002", "Carnival Monday"); - - lh.addStaticHoliday ("12-FEB-2002", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-MAR-2002", "St. Josephs Day"); - - lh.addStaticHoliday ("28-MAR-2002", "Holy Thursday"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2002", "Constitution Day"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("13-MAY-2002", "Ascension Day"); - - lh.addStaticHoliday ("03-JUN-2002", "Corpus Christi"); - - lh.addStaticHoliday ("24-JUN-2002", "Battle of Carabobo Day"); - - lh.addStaticHoliday ("05-JUL-2002", "Independence Day"); - - lh.addStaticHoliday ("24-JUL-2002", "Bolivars Birthday"); - - lh.addStaticHoliday ("19-AUG-2002", "Assumption Day Observed"); - - lh.addStaticHoliday ("04-NOV-2002", "All Saints Day Observed"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("06-JAN-2003", "Epiphany"); - - lh.addStaticHoliday ("03-MAR-2003", "Carnival Monday"); - - lh.addStaticHoliday ("04-MAR-2003", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-MAR-2003", "St. Josephs Day"); - - lh.addStaticHoliday ("17-APR-2003", "Holy Thursday"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("02-JUN-2003", "Ascension Day"); - - lh.addStaticHoliday ("23-JUN-2003", "Corpus Christi"); - - lh.addStaticHoliday ("24-JUN-2003", "Battle of Carabobo Day"); - - lh.addStaticHoliday ("24-JUL-2003", "Bolivars Birthday"); - - lh.addStaticHoliday ("18-AUG-2003", "Assumption Day Observed"); - - lh.addStaticHoliday ("08-DEC-2003", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("05-JAN-2004", "Epiphany Observed"); - - lh.addStaticHoliday ("23-FEB-2004", "Carnival Monday"); - - lh.addStaticHoliday ("24-FEB-2004", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-MAR-2004", "St. Josephs Day"); - - lh.addStaticHoliday ("08-APR-2004", "Holy Thursday"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2004", "Constitution Day"); - - lh.addStaticHoliday ("24-MAY-2004", "Ascension Day"); - - lh.addStaticHoliday ("14-JUN-2004", "Corpus Christi"); - - lh.addStaticHoliday ("24-JUN-2004", "Battle of Carabobo Day"); - - lh.addStaticHoliday ("28-JUN-2004", "Saints Peter and Paul Day Observed"); - - lh.addStaticHoliday ("05-JUL-2004", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2004", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("06-DEC-2004", "Immaculate Conception Observed"); - - lh.addStaticHoliday ("10-JAN-2005", "Epiphany Observed"); - - lh.addStaticHoliday ("07-FEB-2005", "Carnival Monday"); - - lh.addStaticHoliday ("08-FEB-2005", "Carnival Tuesday"); - - lh.addStaticHoliday ("24-MAR-2005", "Holy Thursday"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2005", "Constitution Day"); - - lh.addStaticHoliday ("09-MAY-2005", "Ascension Day"); - - lh.addStaticHoliday ("30-MAY-2005", "Corpus Christi"); - - lh.addStaticHoliday ("24-JUN-2005", "Battle of Carabobo Day"); - - lh.addStaticHoliday ("27-JUN-2005", "Saints Peter and Paul Day Observed"); - - lh.addStaticHoliday ("05-JUL-2005", "Independence Day"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("12-OCT-2005", "Day of the Race"); - - lh.addStaticHoliday ("31-OCT-2005", "All Saints Day Observed"); - - lh.addStaticHoliday ("12-DEC-2005", "Immaculate Conception Observed"); - - lh.addStaticHoliday ("09-JAN-2006", "Epiphany Observed"); - - lh.addStaticHoliday ("27-FEB-2006", "Carnival Monday"); - - lh.addStaticHoliday ("28-FEB-2006", "Carnival Tuesday"); - - lh.addStaticHoliday ("13-APR-2006", "Holy Thursday"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2006", "Constitution Day"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2006", "Ascension Day"); - - lh.addStaticHoliday ("19-JUN-2006", "Corpus Christi"); - - lh.addStaticHoliday ("26-JUN-2006", "Saints Peter and Paul Day Observed"); - - lh.addStaticHoliday ("05-JUL-2006", "Independence Day"); - - lh.addStaticHoliday ("24-JUL-2006", "Bolivars Birthday"); - - lh.addStaticHoliday ("14-AUG-2006", "Assumption Day Observed"); - - lh.addStaticHoliday ("12-OCT-2006", "Day of the Race"); - - lh.addStaticHoliday ("30-OCT-2006", "All Saints Day Observed"); - - lh.addStaticHoliday ("11-DEC-2006", "Immaculate Conception Observed"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("19-FEB-2007", "Carnival Monday"); - - lh.addStaticHoliday ("20-FEB-2007", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-MAR-2007", "St. Josephs Day"); - - lh.addStaticHoliday ("05-APR-2007", "Holy Thursday"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2007", "Constitution Day"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2007", "Ascension Day"); - - lh.addStaticHoliday ("11-JUN-2007", "Corpus Christi"); - - lh.addStaticHoliday ("02-JUL-2007", "Saints Peter and Paul Day Observed"); - - lh.addStaticHoliday ("05-JUL-2007", "Independence Day"); - - lh.addStaticHoliday ("24-JUL-2007", "Bolivars Birthday"); - - lh.addStaticHoliday ("13-AUG-2007", "Assumption Day Observed"); - - lh.addStaticHoliday ("12-OCT-2007", "Day of the Race"); - - lh.addStaticHoliday ("05-NOV-2007", "All Saints Day Observed"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("04-FEB-2008", "Carnival Monday"); - - lh.addStaticHoliday ("05-FEB-2008", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-MAR-2008", "St. Josephs Day"); - - lh.addStaticHoliday ("20-MAR-2008", "Holy Thursday"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("05-MAY-2008", "Ascension Day"); - - lh.addStaticHoliday ("26-MAY-2008", "Corpus Christi"); - - lh.addStaticHoliday ("24-JUN-2008", "Battle of Carabobo Day"); - - lh.addStaticHoliday ("24-JUL-2008", "Bolivars Birthday"); - - lh.addStaticHoliday ("18-AUG-2008", "Assumption Day Observed"); - - lh.addStaticHoliday ("08-DEC-2008", "Immaculate Conception"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("05-JAN-2009", "Epiphany Observed"); - - lh.addStaticHoliday ("23-FEB-2009", "Carnival Monday"); - - lh.addStaticHoliday ("24-FEB-2009", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-MAR-2009", "St. Josephs Day"); - - lh.addStaticHoliday ("09-APR-2009", "Holy Thursday"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2009", "Ascension Day"); - - lh.addStaticHoliday ("15-JUN-2009", "Corpus Christi"); - - lh.addStaticHoliday ("24-JUN-2009", "Battle of Carabobo Day"); - - lh.addStaticHoliday ("29-JUN-2009", "Saints Peter and Paul Day"); - - lh.addStaticHoliday ("24-JUL-2009", "Bolivars Birthday"); - - lh.addStaticHoliday ("12-OCT-2009", "Day of the Race"); - - lh.addStaticHoliday ("07-DEC-2009", "Immaculate Conception Observed"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("11-JAN-2010", "Epiphany Observed"); - - lh.addStaticHoliday ("15-FEB-2010", "Carnival Monday"); - - lh.addStaticHoliday ("16-FEB-2010", "Carnival Tuesday"); - - lh.addStaticHoliday ("19-MAR-2010", "St. Josephs Day"); - - lh.addStaticHoliday ("01-APR-2010", "Holy Thursday"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("19-APR-2010", "Constitution Day"); - - lh.addStaticHoliday ("17-MAY-2010", "Ascension Day"); - - lh.addStaticHoliday ("07-JUN-2010", "Corpus Christi"); - - lh.addStaticHoliday ("24-JUN-2010", "Battle of Carabobo Day"); - - lh.addStaticHoliday ("28-JUN-2010", "Saints Peter and Paul Day Observed"); - - lh.addStaticHoliday ("05-JUL-2010", "Independence Day"); - - lh.addStaticHoliday ("12-OCT-2010", "Day of the Race"); - - lh.addStaticHoliday ("01-NOV-2010", "All Saints Day"); - - lh.addStaticHoliday ("06-DEC-2010", "Immaculate Conception Observed"); - - lh.addStaticHoliday ("10-JAN-2011", "VEB"); - - lh.addStaticHoliday ("07-MAR-2011", "VEB"); - - lh.addStaticHoliday ("08-MAR-2011", "VEB"); - - lh.addStaticHoliday ("19-APR-2011", "VEB"); - - lh.addStaticHoliday ("21-APR-2011", "VEB"); - - lh.addStaticHoliday ("22-APR-2011", "VEB"); - - lh.addStaticHoliday ("06-JUN-2011", "VEB"); - - lh.addStaticHoliday ("24-JUN-2011", "VEB"); - - lh.addStaticHoliday ("27-JUN-2011", "VEB"); - - lh.addStaticHoliday ("04-JUL-2011", "VEB"); - - lh.addStaticHoliday ("05-JUL-2011", "VEB"); - - lh.addStaticHoliday ("15-AUG-2011", "VEB"); - - lh.addStaticHoliday ("12-OCT-2011", "VEB"); - - lh.addStaticHoliday ("31-OCT-2011", "VEB"); - - lh.addStaticHoliday ("12-DEC-2011", "VEB"); - - lh.addStaticHoliday ("09-JAN-2012", "VEB"); - - lh.addStaticHoliday ("20-FEB-2012", "VEB"); - - lh.addStaticHoliday ("21-FEB-2012", "VEB"); - - lh.addStaticHoliday ("19-MAR-2012", "VEB"); - - lh.addStaticHoliday ("05-APR-2012", "VEB"); - - lh.addStaticHoliday ("06-APR-2012", "VEB"); - - lh.addStaticHoliday ("19-APR-2012", "VEB"); - - lh.addStaticHoliday ("01-MAY-2012", "VEB"); - - lh.addStaticHoliday ("21-MAY-2012", "VEB"); - - lh.addStaticHoliday ("11-JUN-2012", "VEB"); - - lh.addStaticHoliday ("02-JUL-2012", "VEB"); - - lh.addStaticHoliday ("05-JUL-2012", "VEB"); - - lh.addStaticHoliday ("24-JUL-2012", "VEB"); - - lh.addStaticHoliday ("20-AUG-2012", "VEB"); - - lh.addStaticHoliday ("12-OCT-2012", "VEB"); - - lh.addStaticHoliday ("05-NOV-2012", "VEB"); - - lh.addStaticHoliday ("25-DEC-2012", "VEB"); - - lh.addStaticHoliday ("01-JAN-2013", "VEB"); - - lh.addStaticHoliday ("11-FEB-2013", "VEB"); - - lh.addStaticHoliday ("12-FEB-2013", "VEB"); - - lh.addStaticHoliday ("19-MAR-2013", "VEB"); - - lh.addStaticHoliday ("28-MAR-2013", "VEB"); - - lh.addStaticHoliday ("29-MAR-2013", "VEB"); - - lh.addStaticHoliday ("19-APR-2013", "VEB"); - - lh.addStaticHoliday ("01-MAY-2013", "VEB"); - - lh.addStaticHoliday ("13-MAY-2013", "VEB"); - - lh.addStaticHoliday ("03-JUN-2013", "VEB"); - - lh.addStaticHoliday ("24-JUN-2013", "VEB"); - - lh.addStaticHoliday ("05-JUL-2013", "VEB"); - - lh.addStaticHoliday ("24-JUL-2013", "VEB"); - - lh.addStaticHoliday ("19-AUG-2013", "VEB"); - - lh.addStaticHoliday ("04-NOV-2013", "VEB"); - - lh.addStaticHoliday ("25-DEC-2013", "VEB"); - - lh.addStaticHoliday ("01-JAN-2014", "VEB"); - - lh.addStaticHoliday ("06-JAN-2014", "VEB"); - - lh.addStaticHoliday ("03-MAR-2014", "VEB"); - - lh.addStaticHoliday ("04-MAR-2014", "VEB"); - - lh.addStaticHoliday ("19-MAR-2014", "VEB"); - - lh.addStaticHoliday ("17-APR-2014", "VEB"); - - lh.addStaticHoliday ("18-APR-2014", "VEB"); - - lh.addStaticHoliday ("01-MAY-2014", "VEB"); - - lh.addStaticHoliday ("02-JUN-2014", "VEB"); - - lh.addStaticHoliday ("16-JUN-2014", "VEB"); - - lh.addStaticHoliday ("24-JUN-2014", "VEB"); - - lh.addStaticHoliday ("24-JUL-2014", "VEB"); - - lh.addStaticHoliday ("18-AUG-2014", "VEB"); - - lh.addStaticHoliday ("08-DEC-2014", "VEB"); - - lh.addStaticHoliday ("25-DEC-2014", "VEB"); - - lh.addStaticHoliday ("01-JAN-2015", "VEB"); - - lh.addStaticHoliday ("05-JAN-2015", "VEB"); - - lh.addStaticHoliday ("16-FEB-2015", "VEB"); - - lh.addStaticHoliday ("17-FEB-2015", "VEB"); - - lh.addStaticHoliday ("19-MAR-2015", "VEB"); - - lh.addStaticHoliday ("02-APR-2015", "VEB"); - - lh.addStaticHoliday ("03-APR-2015", "VEB"); - - lh.addStaticHoliday ("01-MAY-2015", "VEB"); - - lh.addStaticHoliday ("18-MAY-2015", "VEB"); - - lh.addStaticHoliday ("08-JUN-2015", "VEB"); - - lh.addStaticHoliday ("24-JUN-2015", "VEB"); - - lh.addStaticHoliday ("29-JUN-2015", "VEB"); - - lh.addStaticHoliday ("24-JUL-2015", "VEB"); - - lh.addStaticHoliday ("12-OCT-2015", "VEB"); - - lh.addStaticHoliday ("07-DEC-2015", "VEB"); - - lh.addStaticHoliday ("25-DEC-2015", "VEB"); - - lh.addStaticHoliday ("01-JAN-2016", "VEB"); - - lh.addStaticHoliday ("04-JAN-2016", "VEB"); - - lh.addStaticHoliday ("08-FEB-2016", "VEB"); - - lh.addStaticHoliday ("09-FEB-2016", "VEB"); - - lh.addStaticHoliday ("24-MAR-2016", "VEB"); - - lh.addStaticHoliday ("25-MAR-2016", "VEB"); - - lh.addStaticHoliday ("19-APR-2016", "VEB"); - - lh.addStaticHoliday ("09-MAY-2016", "VEB"); - - lh.addStaticHoliday ("30-MAY-2016", "VEB"); - - lh.addStaticHoliday ("24-JUN-2016", "VEB"); - - lh.addStaticHoliday ("27-JUN-2016", "VEB"); - - lh.addStaticHoliday ("05-JUL-2016", "VEB"); - - lh.addStaticHoliday ("15-AUG-2016", "VEB"); - - lh.addStaticHoliday ("12-OCT-2016", "VEB"); - - lh.addStaticHoliday ("31-OCT-2016", "VEB"); - - lh.addStaticHoliday ("12-DEC-2016", "VEB"); - - lh.addStaticHoliday ("09-JAN-2017", "VEB"); - - lh.addStaticHoliday ("27-FEB-2017", "VEB"); - - lh.addStaticHoliday ("28-FEB-2017", "VEB"); - - lh.addStaticHoliday ("13-APR-2017", "VEB"); - - lh.addStaticHoliday ("14-APR-2017", "VEB"); - - lh.addStaticHoliday ("19-APR-2017", "VEB"); - - lh.addStaticHoliday ("01-MAY-2017", "VEB"); - - lh.addStaticHoliday ("29-MAY-2017", "VEB"); - - lh.addStaticHoliday ("19-JUN-2017", "VEB"); - - lh.addStaticHoliday ("03-JUL-2017", "VEB"); - - lh.addStaticHoliday ("05-JUL-2017", "VEB"); - - lh.addStaticHoliday ("24-JUL-2017", "VEB"); - - lh.addStaticHoliday ("14-AUG-2017", "VEB"); - - lh.addStaticHoliday ("12-OCT-2017", "VEB"); - - lh.addStaticHoliday ("06-NOV-2017", "VEB"); - - lh.addStaticHoliday ("11-DEC-2017", "VEB"); - - lh.addStaticHoliday ("25-DEC-2017", "VEB"); - - lh.addStaticHoliday ("01-JAN-2018", "VEB"); - - lh.addStaticHoliday ("12-FEB-2018", "VEB"); - - lh.addStaticHoliday ("13-FEB-2018", "VEB"); - - lh.addStaticHoliday ("19-MAR-2018", "VEB"); - - lh.addStaticHoliday ("29-MAR-2018", "VEB"); - - lh.addStaticHoliday ("30-MAR-2018", "VEB"); - - lh.addStaticHoliday ("19-APR-2018", "VEB"); - - lh.addStaticHoliday ("01-MAY-2018", "VEB"); - - lh.addStaticHoliday ("14-MAY-2018", "VEB"); - - lh.addStaticHoliday ("04-JUN-2018", "VEB"); - - lh.addStaticHoliday ("02-JUL-2018", "VEB"); - - lh.addStaticHoliday ("05-JUL-2018", "VEB"); - - lh.addStaticHoliday ("24-JUL-2018", "VEB"); - - lh.addStaticHoliday ("20-AUG-2018", "VEB"); - - lh.addStaticHoliday ("12-OCT-2018", "VEB"); - - lh.addStaticHoliday ("05-NOV-2018", "VEB"); - - lh.addStaticHoliday ("25-DEC-2018", "VEB"); - - lh.addStaticHoliday ("01-JAN-2019", "VEB"); - - lh.addStaticHoliday ("04-MAR-2019", "VEB"); - - lh.addStaticHoliday ("05-MAR-2019", "VEB"); - - lh.addStaticHoliday ("19-MAR-2019", "VEB"); - - lh.addStaticHoliday ("18-APR-2019", "VEB"); - - lh.addStaticHoliday ("19-APR-2019", "VEB"); - - lh.addStaticHoliday ("01-MAY-2019", "VEB"); - - lh.addStaticHoliday ("03-JUN-2019", "VEB"); - - lh.addStaticHoliday ("24-JUN-2019", "VEB"); - - lh.addStaticHoliday ("05-JUL-2019", "VEB"); - - lh.addStaticHoliday ("24-JUL-2019", "VEB"); - - lh.addStaticHoliday ("19-AUG-2019", "VEB"); - - lh.addStaticHoliday ("04-NOV-2019", "VEB"); - - lh.addStaticHoliday ("25-DEC-2019", "VEB"); - - lh.addStaticHoliday ("01-JAN-2020", "VEB"); - - lh.addStaticHoliday ("06-JAN-2020", "VEB"); - - lh.addStaticHoliday ("24-FEB-2020", "VEB"); - - lh.addStaticHoliday ("25-FEB-2020", "VEB"); - - lh.addStaticHoliday ("19-MAR-2020", "VEB"); - - lh.addStaticHoliday ("09-APR-2020", "VEB"); - - lh.addStaticHoliday ("10-APR-2020", "VEB"); - - lh.addStaticHoliday ("01-MAY-2020", "VEB"); - - lh.addStaticHoliday ("25-MAY-2020", "VEB"); - - lh.addStaticHoliday ("15-JUN-2020", "VEB"); - - lh.addStaticHoliday ("24-JUN-2020", "VEB"); - - lh.addStaticHoliday ("29-JUN-2020", "VEB"); - - lh.addStaticHoliday ("24-JUL-2020", "VEB"); - - lh.addStaticHoliday ("12-OCT-2020", "VEB"); - - lh.addStaticHoliday ("07-DEC-2020", "VEB"); - - lh.addStaticHoliday ("25-DEC-2020", "VEB"); - - lh.addStaticHoliday ("01-JAN-2021", "VEB"); - - lh.addStaticHoliday ("04-JAN-2021", "VEB"); - - lh.addStaticHoliday ("15-FEB-2021", "VEB"); - - lh.addStaticHoliday ("16-FEB-2021", "VEB"); - - lh.addStaticHoliday ("19-MAR-2021", "VEB"); - - lh.addStaticHoliday ("01-APR-2021", "VEB"); - - lh.addStaticHoliday ("02-APR-2021", "VEB"); - - lh.addStaticHoliday ("19-APR-2021", "VEB"); - - lh.addStaticHoliday ("17-MAY-2021", "VEB"); - - lh.addStaticHoliday ("07-JUN-2021", "VEB"); - - lh.addStaticHoliday ("24-JUN-2021", "VEB"); - - lh.addStaticHoliday ("28-JUN-2021", "VEB"); - - lh.addStaticHoliday ("05-JUL-2021", "VEB"); - - lh.addStaticHoliday ("12-OCT-2021", "VEB"); - - lh.addStaticHoliday ("01-NOV-2021", "VEB"); - - lh.addStaticHoliday ("06-DEC-2021", "VEB"); - - lh.addStaticHoliday ("10-JAN-2022", "VEB"); - - lh.addStaticHoliday ("28-FEB-2022", "VEB"); - - lh.addStaticHoliday ("01-MAR-2022", "VEB"); - - lh.addStaticHoliday ("14-APR-2022", "VEB"); - - lh.addStaticHoliday ("15-APR-2022", "VEB"); - - lh.addStaticHoliday ("19-APR-2022", "VEB"); - - lh.addStaticHoliday ("30-MAY-2022", "VEB"); - - lh.addStaticHoliday ("20-JUN-2022", "VEB"); - - lh.addStaticHoliday ("24-JUN-2022", "VEB"); - - lh.addStaticHoliday ("27-JUN-2022", "VEB"); - - lh.addStaticHoliday ("05-JUL-2022", "VEB"); - - lh.addStaticHoliday ("15-AUG-2022", "VEB"); - - lh.addStaticHoliday ("12-OCT-2022", "VEB"); - - lh.addStaticHoliday ("31-OCT-2022", "VEB"); - - lh.addStaticHoliday ("12-DEC-2022", "VEB"); - - lh.addStaticHoliday ("09-JAN-2023", "VEB"); - - lh.addStaticHoliday ("20-FEB-2023", "VEB"); - - lh.addStaticHoliday ("21-FEB-2023", "VEB"); - - lh.addStaticHoliday ("06-APR-2023", "VEB"); - - lh.addStaticHoliday ("07-APR-2023", "VEB"); - - lh.addStaticHoliday ("19-APR-2023", "VEB"); - - lh.addStaticHoliday ("01-MAY-2023", "VEB"); - - lh.addStaticHoliday ("22-MAY-2023", "VEB"); - - lh.addStaticHoliday ("12-JUN-2023", "VEB"); - - lh.addStaticHoliday ("03-JUL-2023", "VEB"); - - lh.addStaticHoliday ("05-JUL-2023", "VEB"); - - lh.addStaticHoliday ("24-JUL-2023", "VEB"); - - lh.addStaticHoliday ("14-AUG-2023", "VEB"); - - lh.addStaticHoliday ("12-OCT-2023", "VEB"); - - lh.addStaticHoliday ("06-NOV-2023", "VEB"); - - lh.addStaticHoliday ("11-DEC-2023", "VEB"); - - lh.addStaticHoliday ("25-DEC-2023", "VEB"); - - lh.addStaticHoliday ("01-JAN-2024", "VEB"); - - lh.addStaticHoliday ("12-FEB-2024", "VEB"); - - lh.addStaticHoliday ("13-FEB-2024", "VEB"); - - lh.addStaticHoliday ("19-MAR-2024", "VEB"); - - lh.addStaticHoliday ("28-MAR-2024", "VEB"); - - lh.addStaticHoliday ("29-MAR-2024", "VEB"); - - lh.addStaticHoliday ("19-APR-2024", "VEB"); - - lh.addStaticHoliday ("01-MAY-2024", "VEB"); - - lh.addStaticHoliday ("13-MAY-2024", "VEB"); - - lh.addStaticHoliday ("03-JUN-2024", "VEB"); - - lh.addStaticHoliday ("24-JUN-2024", "VEB"); - - lh.addStaticHoliday ("05-JUL-2024", "VEB"); - - lh.addStaticHoliday ("24-JUL-2024", "VEB"); - - lh.addStaticHoliday ("19-AUG-2024", "VEB"); - - lh.addStaticHoliday ("04-NOV-2024", "VEB"); - - lh.addStaticHoliday ("25-DEC-2024", "VEB"); - - lh.addStaticHoliday ("01-JAN-2025", "VEB"); - - lh.addStaticHoliday ("06-JAN-2025", "VEB"); - - lh.addStaticHoliday ("03-MAR-2025", "VEB"); - - lh.addStaticHoliday ("04-MAR-2025", "VEB"); - - lh.addStaticHoliday ("19-MAR-2025", "VEB"); - - lh.addStaticHoliday ("17-APR-2025", "VEB"); - - lh.addStaticHoliday ("18-APR-2025", "VEB"); - - lh.addStaticHoliday ("01-MAY-2025", "VEB"); - - lh.addStaticHoliday ("02-JUN-2025", "VEB"); - - lh.addStaticHoliday ("16-JUN-2025", "VEB"); - - lh.addStaticHoliday ("24-JUN-2025", "VEB"); - - lh.addStaticHoliday ("24-JUL-2025", "VEB"); - - lh.addStaticHoliday ("18-AUG-2025", "VEB"); - - lh.addStaticHoliday ("08-DEC-2025", "VEB"); - - lh.addStaticHoliday ("25-DEC-2025", "VEB"); - - lh.addStaticHoliday ("01-JAN-2026", "VEB"); - - lh.addStaticHoliday ("05-JAN-2026", "VEB"); - - lh.addStaticHoliday ("16-FEB-2026", "VEB"); - - lh.addStaticHoliday ("17-FEB-2026", "VEB"); - - lh.addStaticHoliday ("19-MAR-2026", "VEB"); - - lh.addStaticHoliday ("02-APR-2026", "VEB"); - - lh.addStaticHoliday ("03-APR-2026", "VEB"); - - lh.addStaticHoliday ("01-MAY-2026", "VEB"); - - lh.addStaticHoliday ("18-MAY-2026", "VEB"); - - lh.addStaticHoliday ("08-JUN-2026", "VEB"); - - lh.addStaticHoliday ("24-JUN-2026", "VEB"); - - lh.addStaticHoliday ("29-JUN-2026", "VEB"); - - lh.addStaticHoliday ("24-JUL-2026", "VEB"); - - lh.addStaticHoliday ("12-OCT-2026", "VEB"); - - lh.addStaticHoliday ("07-DEC-2026", "VEB"); - - lh.addStaticHoliday ("25-DEC-2026", "VEB"); - - lh.addStaticHoliday ("01-JAN-2027", "VEB"); - - lh.addStaticHoliday ("04-JAN-2027", "VEB"); - - lh.addStaticHoliday ("08-FEB-2027", "VEB"); - - lh.addStaticHoliday ("09-FEB-2027", "VEB"); - - lh.addStaticHoliday ("19-MAR-2027", "VEB"); - - lh.addStaticHoliday ("25-MAR-2027", "VEB"); - - lh.addStaticHoliday ("26-MAR-2027", "VEB"); - - lh.addStaticHoliday ("19-APR-2027", "VEB"); - - lh.addStaticHoliday ("10-MAY-2027", "VEB"); - - lh.addStaticHoliday ("31-MAY-2027", "VEB"); - - lh.addStaticHoliday ("24-JUN-2027", "VEB"); - - lh.addStaticHoliday ("28-JUN-2027", "VEB"); - - lh.addStaticHoliday ("05-JUL-2027", "VEB"); - - lh.addStaticHoliday ("12-OCT-2027", "VEB"); - - lh.addStaticHoliday ("01-NOV-2027", "VEB"); - - lh.addStaticHoliday ("06-DEC-2027", "VEB"); - - lh.addStaticHoliday ("10-JAN-2028", "VEB"); - - lh.addStaticHoliday ("28-FEB-2028", "VEB"); - - lh.addStaticHoliday ("29-FEB-2028", "VEB"); - - lh.addStaticHoliday ("13-APR-2028", "VEB"); - - lh.addStaticHoliday ("14-APR-2028", "VEB"); - - lh.addStaticHoliday ("19-APR-2028", "VEB"); - - lh.addStaticHoliday ("01-MAY-2028", "VEB"); - - lh.addStaticHoliday ("29-MAY-2028", "VEB"); - - lh.addStaticHoliday ("19-JUN-2028", "VEB"); - - lh.addStaticHoliday ("03-JUL-2028", "VEB"); - - lh.addStaticHoliday ("05-JUL-2028", "VEB"); - - lh.addStaticHoliday ("24-JUL-2028", "VEB"); - - lh.addStaticHoliday ("14-AUG-2028", "VEB"); - - lh.addStaticHoliday ("12-OCT-2028", "VEB"); - - lh.addStaticHoliday ("06-NOV-2028", "VEB"); - - lh.addStaticHoliday ("11-DEC-2028", "VEB"); - - lh.addStaticHoliday ("25-DEC-2028", "VEB"); - - lh.addStaticHoliday ("01-JAN-2029", "VEB"); - - lh.addStaticHoliday ("12-FEB-2029", "VEB"); - - lh.addStaticHoliday ("13-FEB-2029", "VEB"); - - lh.addStaticHoliday ("19-MAR-2029", "VEB"); - - lh.addStaticHoliday ("29-MAR-2029", "VEB"); - - lh.addStaticHoliday ("30-MAR-2029", "VEB"); - - lh.addStaticHoliday ("19-APR-2029", "VEB"); - - lh.addStaticHoliday ("01-MAY-2029", "VEB"); - - lh.addStaticHoliday ("14-MAY-2029", "VEB"); - - lh.addStaticHoliday ("04-JUN-2029", "VEB"); - - lh.addStaticHoliday ("02-JUL-2029", "VEB"); - - lh.addStaticHoliday ("05-JUL-2029", "VEB"); - - lh.addStaticHoliday ("24-JUL-2029", "VEB"); - - lh.addStaticHoliday ("20-AUG-2029", "VEB"); - - lh.addStaticHoliday ("12-OCT-2029", "VEB"); - - lh.addStaticHoliday ("05-NOV-2029", "VEB"); - - lh.addStaticHoliday ("25-DEC-2029", "VEB"); - - lh.addStaticHoliday ("01-JAN-2030", "VEB"); - - lh.addStaticHoliday ("04-MAR-2030", "VEB"); - - lh.addStaticHoliday ("05-MAR-2030", "VEB"); - - lh.addStaticHoliday ("19-MAR-2030", "VEB"); - - lh.addStaticHoliday ("18-APR-2030", "VEB"); - - lh.addStaticHoliday ("19-APR-2030", "VEB"); - - lh.addStaticHoliday ("01-MAY-2030", "VEB"); - - lh.addStaticHoliday ("03-JUN-2030", "VEB"); - - lh.addStaticHoliday ("24-JUN-2030", "VEB"); - - lh.addStaticHoliday ("05-JUL-2030", "VEB"); - - lh.addStaticHoliday ("24-JUL-2030", "VEB"); - - lh.addStaticHoliday ("19-AUG-2030", "VEB"); - - lh.addStaticHoliday ("04-NOV-2030", "VEB"); - - lh.addStaticHoliday ("25-DEC-2030", "VEB"); - - lh.addStaticHoliday ("01-JAN-2031", "VEB"); - - lh.addStaticHoliday ("06-JAN-2031", "VEB"); - - lh.addStaticHoliday ("24-FEB-2031", "VEB"); - - lh.addStaticHoliday ("25-FEB-2031", "VEB"); - - lh.addStaticHoliday ("19-MAR-2031", "VEB"); - - lh.addStaticHoliday ("10-APR-2031", "VEB"); - - lh.addStaticHoliday ("11-APR-2031", "VEB"); - - lh.addStaticHoliday ("01-MAY-2031", "VEB"); - - lh.addStaticHoliday ("26-MAY-2031", "VEB"); - - lh.addStaticHoliday ("16-JUN-2031", "VEB"); - - lh.addStaticHoliday ("24-JUN-2031", "VEB"); - - lh.addStaticHoliday ("24-JUL-2031", "VEB"); - - lh.addStaticHoliday ("18-AUG-2031", "VEB"); - - lh.addStaticHoliday ("08-DEC-2031", "VEB"); - - lh.addStaticHoliday ("25-DEC-2031", "VEB"); - - lh.addStaticHoliday ("01-JAN-2032", "VEB"); - - lh.addStaticHoliday ("05-JAN-2032", "VEB"); - - lh.addStaticHoliday ("09-FEB-2032", "VEB"); - - lh.addStaticHoliday ("10-FEB-2032", "VEB"); - - lh.addStaticHoliday ("19-MAR-2032", "VEB"); - - lh.addStaticHoliday ("25-MAR-2032", "VEB"); - - lh.addStaticHoliday ("26-MAR-2032", "VEB"); - - lh.addStaticHoliday ("19-APR-2032", "VEB"); - - lh.addStaticHoliday ("10-MAY-2032", "VEB"); - - lh.addStaticHoliday ("31-MAY-2032", "VEB"); - - lh.addStaticHoliday ("24-JUN-2032", "VEB"); - - lh.addStaticHoliday ("28-JUN-2032", "VEB"); - - lh.addStaticHoliday ("05-JUL-2032", "VEB"); - - lh.addStaticHoliday ("12-OCT-2032", "VEB"); - - lh.addStaticHoliday ("01-NOV-2032", "VEB"); - - lh.addStaticHoliday ("06-DEC-2032", "VEB"); - - lh.addStaticHoliday ("10-JAN-2033", "VEB"); - - lh.addStaticHoliday ("28-FEB-2033", "VEB"); - - lh.addStaticHoliday ("01-MAR-2033", "VEB"); - - lh.addStaticHoliday ("14-APR-2033", "VEB"); - - lh.addStaticHoliday ("15-APR-2033", "VEB"); - - lh.addStaticHoliday ("19-APR-2033", "VEB"); - - lh.addStaticHoliday ("30-MAY-2033", "VEB"); - - lh.addStaticHoliday ("20-JUN-2033", "VEB"); - - lh.addStaticHoliday ("24-JUN-2033", "VEB"); - - lh.addStaticHoliday ("27-JUN-2033", "VEB"); - - lh.addStaticHoliday ("05-JUL-2033", "VEB"); - - lh.addStaticHoliday ("15-AUG-2033", "VEB"); - - lh.addStaticHoliday ("12-OCT-2033", "VEB"); - - lh.addStaticHoliday ("31-OCT-2033", "VEB"); - - lh.addStaticHoliday ("12-DEC-2033", "VEB"); - - lh.addStaticHoliday ("09-JAN-2034", "VEB"); - - lh.addStaticHoliday ("20-FEB-2034", "VEB"); - - lh.addStaticHoliday ("21-FEB-2034", "VEB"); - - lh.addStaticHoliday ("06-APR-2034", "VEB"); - - lh.addStaticHoliday ("07-APR-2034", "VEB"); - - lh.addStaticHoliday ("19-APR-2034", "VEB"); - - lh.addStaticHoliday ("01-MAY-2034", "VEB"); - - lh.addStaticHoliday ("22-MAY-2034", "VEB"); - - lh.addStaticHoliday ("12-JUN-2034", "VEB"); - - lh.addStaticHoliday ("03-JUL-2034", "VEB"); - - lh.addStaticHoliday ("05-JUL-2034", "VEB"); - - lh.addStaticHoliday ("24-JUL-2034", "VEB"); - - lh.addStaticHoliday ("14-AUG-2034", "VEB"); - - lh.addStaticHoliday ("12-OCT-2034", "VEB"); - - lh.addStaticHoliday ("06-NOV-2034", "VEB"); - - lh.addStaticHoliday ("11-DEC-2034", "VEB"); - - lh.addStaticHoliday ("25-DEC-2034", "VEB"); - - lh.addStaticHoliday ("01-JAN-2035", "VEB"); - - lh.addStaticHoliday ("05-FEB-2035", "VEB"); - - lh.addStaticHoliday ("06-FEB-2035", "VEB"); - - lh.addStaticHoliday ("19-MAR-2035", "VEB"); - - lh.addStaticHoliday ("22-MAR-2035", "VEB"); - - lh.addStaticHoliday ("23-MAR-2035", "VEB"); - - lh.addStaticHoliday ("19-APR-2035", "VEB"); - - lh.addStaticHoliday ("01-MAY-2035", "VEB"); - - lh.addStaticHoliday ("07-MAY-2035", "VEB"); - - lh.addStaticHoliday ("28-MAY-2035", "VEB"); - - lh.addStaticHoliday ("02-JUL-2035", "VEB"); - - lh.addStaticHoliday ("05-JUL-2035", "VEB"); - - lh.addStaticHoliday ("24-JUL-2035", "VEB"); - - lh.addStaticHoliday ("20-AUG-2035", "VEB"); - - lh.addStaticHoliday ("12-OCT-2035", "VEB"); - - lh.addStaticHoliday ("05-NOV-2035", "VEB"); - - lh.addStaticHoliday ("25-DEC-2035", "VEB"); - - lh.addStaticHoliday ("01-JAN-2036", "VEB"); - - lh.addStaticHoliday ("25-FEB-2036", "VEB"); - - lh.addStaticHoliday ("26-FEB-2036", "VEB"); - - lh.addStaticHoliday ("19-MAR-2036", "VEB"); - - lh.addStaticHoliday ("10-APR-2036", "VEB"); - - lh.addStaticHoliday ("11-APR-2036", "VEB"); - - lh.addStaticHoliday ("01-MAY-2036", "VEB"); - - lh.addStaticHoliday ("26-MAY-2036", "VEB"); - - lh.addStaticHoliday ("16-JUN-2036", "VEB"); - - lh.addStaticHoliday ("24-JUN-2036", "VEB"); - - lh.addStaticHoliday ("24-JUL-2036", "VEB"); - - lh.addStaticHoliday ("18-AUG-2036", "VEB"); - - lh.addStaticHoliday ("08-DEC-2036", "VEB"); - - lh.addStaticHoliday ("25-DEC-2036", "VEB"); - - lh.addStaticHoliday ("01-JAN-2037", "VEB"); - - lh.addStaticHoliday ("05-JAN-2037", "VEB"); - - lh.addStaticHoliday ("16-FEB-2037", "VEB"); - - lh.addStaticHoliday ("17-FEB-2037", "VEB"); - - lh.addStaticHoliday ("19-MAR-2037", "VEB"); - - lh.addStaticHoliday ("02-APR-2037", "VEB"); - - lh.addStaticHoliday ("03-APR-2037", "VEB"); - - lh.addStaticHoliday ("01-MAY-2037", "VEB"); - - lh.addStaticHoliday ("18-MAY-2037", "VEB"); - - lh.addStaticHoliday ("08-JUN-2037", "VEB"); - - lh.addStaticHoliday ("24-JUN-2037", "VEB"); - - lh.addStaticHoliday ("29-JUN-2037", "VEB"); - - lh.addStaticHoliday ("24-JUL-2037", "VEB"); - - lh.addStaticHoliday ("12-OCT-2037", "VEB"); - - lh.addStaticHoliday ("07-DEC-2037", "VEB"); - - lh.addStaticHoliday ("25-DEC-2037", "VEB"); - - lh.addStaticHoliday ("01-JAN-2038", "VEB"); - - lh.addStaticHoliday ("04-JAN-2038", "VEB"); - - lh.addStaticHoliday ("08-MAR-2038", "VEB"); - - lh.addStaticHoliday ("09-MAR-2038", "VEB"); - - lh.addStaticHoliday ("19-MAR-2038", "VEB"); - - lh.addStaticHoliday ("19-APR-2038", "VEB"); - - lh.addStaticHoliday ("22-APR-2038", "VEB"); - - lh.addStaticHoliday ("23-APR-2038", "VEB"); - - lh.addStaticHoliday ("07-JUN-2038", "VEB"); - - lh.addStaticHoliday ("24-JUN-2038", "VEB"); - - lh.addStaticHoliday ("28-JUN-2038", "VEB"); - - lh.addStaticHoliday ("05-JUL-2038", "VEB"); - - lh.addStaticHoliday ("12-OCT-2038", "VEB"); - - lh.addStaticHoliday ("01-NOV-2038", "VEB"); - - lh.addStaticHoliday ("06-DEC-2038", "VEB"); - - lh.addStaticHoliday ("10-JAN-2039", "VEB"); - - lh.addStaticHoliday ("21-FEB-2039", "VEB"); - - lh.addStaticHoliday ("22-FEB-2039", "VEB"); - - lh.addStaticHoliday ("07-APR-2039", "VEB"); - - lh.addStaticHoliday ("08-APR-2039", "VEB"); - - lh.addStaticHoliday ("19-APR-2039", "VEB"); - - lh.addStaticHoliday ("23-MAY-2039", "VEB"); - - lh.addStaticHoliday ("13-JUN-2039", "VEB"); - - lh.addStaticHoliday ("24-JUN-2039", "VEB"); - - lh.addStaticHoliday ("27-JUN-2039", "VEB"); - - lh.addStaticHoliday ("05-JUL-2039", "VEB"); - - lh.addStaticHoliday ("15-AUG-2039", "VEB"); - - lh.addStaticHoliday ("12-OCT-2039", "VEB"); - - lh.addStaticHoliday ("31-OCT-2039", "VEB"); - - lh.addStaticHoliday ("12-DEC-2039", "VEB"); - - lh.addStaticHoliday ("09-JAN-2040", "VEB"); - - lh.addStaticHoliday ("13-FEB-2040", "VEB"); - - lh.addStaticHoliday ("14-FEB-2040", "VEB"); - - lh.addStaticHoliday ("19-MAR-2040", "VEB"); - - lh.addStaticHoliday ("29-MAR-2040", "VEB"); - - lh.addStaticHoliday ("30-MAR-2040", "VEB"); - - lh.addStaticHoliday ("19-APR-2040", "VEB"); - - lh.addStaticHoliday ("01-MAY-2040", "VEB"); - - lh.addStaticHoliday ("14-MAY-2040", "VEB"); - - lh.addStaticHoliday ("04-JUN-2040", "VEB"); - - lh.addStaticHoliday ("02-JUL-2040", "VEB"); - - lh.addStaticHoliday ("05-JUL-2040", "VEB"); - - lh.addStaticHoliday ("24-JUL-2040", "VEB"); - - lh.addStaticHoliday ("20-AUG-2040", "VEB"); - - lh.addStaticHoliday ("12-OCT-2040", "VEB"); - - lh.addStaticHoliday ("05-NOV-2040", "VEB"); - - lh.addStaticHoliday ("25-DEC-2040", "VEB"); - - lh.addStaticHoliday ("01-JAN-2041", "VEB"); - - lh.addStaticHoliday ("04-MAR-2041", "VEB"); - - lh.addStaticHoliday ("05-MAR-2041", "VEB"); - - lh.addStaticHoliday ("19-MAR-2041", "VEB"); - - lh.addStaticHoliday ("18-APR-2041", "VEB"); - - lh.addStaticHoliday ("19-APR-2041", "VEB"); - - lh.addStaticHoliday ("01-MAY-2041", "VEB"); - - lh.addStaticHoliday ("03-JUN-2041", "VEB"); - - lh.addStaticHoliday ("24-JUN-2041", "VEB"); - - lh.addStaticHoliday ("05-JUL-2041", "VEB"); - - lh.addStaticHoliday ("24-JUL-2041", "VEB"); - - lh.addStaticHoliday ("19-AUG-2041", "VEB"); - - lh.addStaticHoliday ("04-NOV-2041", "VEB"); - - lh.addStaticHoliday ("25-DEC-2041", "VEB"); - - lh.addStaticHoliday ("01-JAN-2042", "VEB"); - - lh.addStaticHoliday ("06-JAN-2042", "VEB"); - - lh.addStaticHoliday ("17-FEB-2042", "VEB"); - - lh.addStaticHoliday ("18-FEB-2042", "VEB"); - - lh.addStaticHoliday ("19-MAR-2042", "VEB"); - - lh.addStaticHoliday ("03-APR-2042", "VEB"); - - lh.addStaticHoliday ("04-APR-2042", "VEB"); - - lh.addStaticHoliday ("01-MAY-2042", "VEB"); - - lh.addStaticHoliday ("19-MAY-2042", "VEB"); - - lh.addStaticHoliday ("09-JUN-2042", "VEB"); - - lh.addStaticHoliday ("24-JUN-2042", "VEB"); - - lh.addStaticHoliday ("24-JUL-2042", "VEB"); - - lh.addStaticHoliday ("18-AUG-2042", "VEB"); - - lh.addStaticHoliday ("08-DEC-2042", "VEB"); - - lh.addStaticHoliday ("25-DEC-2042", "VEB"); - - lh.addStaticHoliday ("01-JAN-2043", "VEB"); - - lh.addStaticHoliday ("05-JAN-2043", "VEB"); - - lh.addStaticHoliday ("09-FEB-2043", "VEB"); - - lh.addStaticHoliday ("10-FEB-2043", "VEB"); - - lh.addStaticHoliday ("19-MAR-2043", "VEB"); - - lh.addStaticHoliday ("26-MAR-2043", "VEB"); - - lh.addStaticHoliday ("27-MAR-2043", "VEB"); - - lh.addStaticHoliday ("01-MAY-2043", "VEB"); - - lh.addStaticHoliday ("11-MAY-2043", "VEB"); - - lh.addStaticHoliday ("01-JUN-2043", "VEB"); - - lh.addStaticHoliday ("24-JUN-2043", "VEB"); - - lh.addStaticHoliday ("29-JUN-2043", "VEB"); - - lh.addStaticHoliday ("24-JUL-2043", "VEB"); - - lh.addStaticHoliday ("12-OCT-2043", "VEB"); - - lh.addStaticHoliday ("07-DEC-2043", "VEB"); - - lh.addStaticHoliday ("25-DEC-2043", "VEB"); - - lh.addStaticHoliday ("01-JAN-2044", "VEB"); - - lh.addStaticHoliday ("04-JAN-2044", "VEB"); - - lh.addStaticHoliday ("29-FEB-2044", "VEB"); - - lh.addStaticHoliday ("01-MAR-2044", "VEB"); - - lh.addStaticHoliday ("14-APR-2044", "VEB"); - - lh.addStaticHoliday ("15-APR-2044", "VEB"); - - lh.addStaticHoliday ("19-APR-2044", "VEB"); - - lh.addStaticHoliday ("30-MAY-2044", "VEB"); - - lh.addStaticHoliday ("20-JUN-2044", "VEB"); - - lh.addStaticHoliday ("24-JUN-2044", "VEB"); - - lh.addStaticHoliday ("27-JUN-2044", "VEB"); - - lh.addStaticHoliday ("05-JUL-2044", "VEB"); - - lh.addStaticHoliday ("15-AUG-2044", "VEB"); - - lh.addStaticHoliday ("12-OCT-2044", "VEB"); - - lh.addStaticHoliday ("31-OCT-2044", "VEB"); - - lh.addStaticHoliday ("12-DEC-2044", "VEB"); - - lh.addStaticHoliday ("09-JAN-2045", "VEB"); - - lh.addStaticHoliday ("20-FEB-2045", "VEB"); - - lh.addStaticHoliday ("21-FEB-2045", "VEB"); - - lh.addStaticHoliday ("06-APR-2045", "VEB"); - - lh.addStaticHoliday ("07-APR-2045", "VEB"); - - lh.addStaticHoliday ("19-APR-2045", "VEB"); - - lh.addStaticHoliday ("01-MAY-2045", "VEB"); - - lh.addStaticHoliday ("22-MAY-2045", "VEB"); - - lh.addStaticHoliday ("12-JUN-2045", "VEB"); - - lh.addStaticHoliday ("03-JUL-2045", "VEB"); - - lh.addStaticHoliday ("05-JUL-2045", "VEB"); - - lh.addStaticHoliday ("24-JUL-2045", "VEB"); - - lh.addStaticHoliday ("14-AUG-2045", "VEB"); - - lh.addStaticHoliday ("12-OCT-2045", "VEB"); - - lh.addStaticHoliday ("06-NOV-2045", "VEB"); - - lh.addStaticHoliday ("11-DEC-2045", "VEB"); - - lh.addStaticHoliday ("25-DEC-2045", "VEB"); - - lh.addStaticHoliday ("01-JAN-2046", "VEB"); - - lh.addStaticHoliday ("05-FEB-2046", "VEB"); - - lh.addStaticHoliday ("06-FEB-2046", "VEB"); - - lh.addStaticHoliday ("19-MAR-2046", "VEB"); - - lh.addStaticHoliday ("22-MAR-2046", "VEB"); - - lh.addStaticHoliday ("23-MAR-2046", "VEB"); - - lh.addStaticHoliday ("19-APR-2046", "VEB"); - - lh.addStaticHoliday ("01-MAY-2046", "VEB"); - - lh.addStaticHoliday ("07-MAY-2046", "VEB"); - - lh.addStaticHoliday ("28-MAY-2046", "VEB"); - - lh.addStaticHoliday ("02-JUL-2046", "VEB"); - - lh.addStaticHoliday ("05-JUL-2046", "VEB"); - - lh.addStaticHoliday ("24-JUL-2046", "VEB"); - - lh.addStaticHoliday ("20-AUG-2046", "VEB"); - - lh.addStaticHoliday ("12-OCT-2046", "VEB"); - - lh.addStaticHoliday ("05-NOV-2046", "VEB"); - - lh.addStaticHoliday ("25-DEC-2046", "VEB"); - - lh.addStaticHoliday ("01-JAN-2047", "VEB"); - - lh.addStaticHoliday ("25-FEB-2047", "VEB"); - - lh.addStaticHoliday ("26-FEB-2047", "VEB"); - - lh.addStaticHoliday ("19-MAR-2047", "VEB"); - - lh.addStaticHoliday ("11-APR-2047", "VEB"); - - lh.addStaticHoliday ("12-APR-2047", "VEB"); - - lh.addStaticHoliday ("19-APR-2047", "VEB"); - - lh.addStaticHoliday ("01-MAY-2047", "VEB"); - - lh.addStaticHoliday ("27-MAY-2047", "VEB"); - - lh.addStaticHoliday ("17-JUN-2047", "VEB"); - - lh.addStaticHoliday ("24-JUN-2047", "VEB"); - - lh.addStaticHoliday ("05-JUL-2047", "VEB"); - - lh.addStaticHoliday ("24-JUL-2047", "VEB"); - - lh.addStaticHoliday ("19-AUG-2047", "VEB"); - - lh.addStaticHoliday ("04-NOV-2047", "VEB"); - - lh.addStaticHoliday ("25-DEC-2047", "VEB"); - - lh.addStaticHoliday ("01-JAN-2048", "VEB"); - - lh.addStaticHoliday ("06-JAN-2048", "VEB"); - - lh.addStaticHoliday ("17-FEB-2048", "VEB"); - - lh.addStaticHoliday ("18-FEB-2048", "VEB"); - - lh.addStaticHoliday ("19-MAR-2048", "VEB"); - - lh.addStaticHoliday ("02-APR-2048", "VEB"); - - lh.addStaticHoliday ("03-APR-2048", "VEB"); - - lh.addStaticHoliday ("01-MAY-2048", "VEB"); - - lh.addStaticHoliday ("18-MAY-2048", "VEB"); - - lh.addStaticHoliday ("08-JUN-2048", "VEB"); - - lh.addStaticHoliday ("24-JUN-2048", "VEB"); - - lh.addStaticHoliday ("29-JUN-2048", "VEB"); - - lh.addStaticHoliday ("24-JUL-2048", "VEB"); - - lh.addStaticHoliday ("12-OCT-2048", "VEB"); - - lh.addStaticHoliday ("07-DEC-2048", "VEB"); - - lh.addStaticHoliday ("25-DEC-2048", "VEB"); - - lh.addStaticHoliday ("01-JAN-2049", "VEB"); - - lh.addStaticHoliday ("04-JAN-2049", "VEB"); - - lh.addStaticHoliday ("01-MAR-2049", "VEB"); - - lh.addStaticHoliday ("02-MAR-2049", "VEB"); - - lh.addStaticHoliday ("19-MAR-2049", "VEB"); - - lh.addStaticHoliday ("15-APR-2049", "VEB"); - - lh.addStaticHoliday ("16-APR-2049", "VEB"); - - lh.addStaticHoliday ("19-APR-2049", "VEB"); - - lh.addStaticHoliday ("31-MAY-2049", "VEB"); - - lh.addStaticHoliday ("21-JUN-2049", "VEB"); - - lh.addStaticHoliday ("24-JUN-2049", "VEB"); - - lh.addStaticHoliday ("28-JUN-2049", "VEB"); - - lh.addStaticHoliday ("05-JUL-2049", "VEB"); - - lh.addStaticHoliday ("12-OCT-2049", "VEB"); - - lh.addStaticHoliday ("01-NOV-2049", "VEB"); - - lh.addStaticHoliday ("06-DEC-2049", "VEB"); - - lh.addStaticHoliday ("10-JAN-2050", "VEB"); - - lh.addStaticHoliday ("21-FEB-2050", "VEB"); - - lh.addStaticHoliday ("22-FEB-2050", "VEB"); - - lh.addStaticHoliday ("07-APR-2050", "VEB"); - - lh.addStaticHoliday ("08-APR-2050", "VEB"); - - lh.addStaticHoliday ("19-APR-2050", "VEB"); - - lh.addStaticHoliday ("23-MAY-2050", "VEB"); - - lh.addStaticHoliday ("13-JUN-2050", "VEB"); - - lh.addStaticHoliday ("24-JUN-2050", "VEB"); - - lh.addStaticHoliday ("27-JUN-2050", "VEB"); - - lh.addStaticHoliday ("05-JUL-2050", "VEB"); - - lh.addStaticHoliday ("15-AUG-2050", "VEB"); - - lh.addStaticHoliday ("12-OCT-2050", "VEB"); - - lh.addStaticHoliday ("31-OCT-2050", "VEB"); - - lh.addStaticHoliday ("12-DEC-2050", "VEB"); - - lh.addStaticHoliday ("09-JAN-2051", "VEB"); - - lh.addStaticHoliday ("13-FEB-2051", "VEB"); - - lh.addStaticHoliday ("14-FEB-2051", "VEB"); - - lh.addStaticHoliday ("30-MAR-2051", "VEB"); - - lh.addStaticHoliday ("31-MAR-2051", "VEB"); - - lh.addStaticHoliday ("19-APR-2051", "VEB"); - - lh.addStaticHoliday ("01-MAY-2051", "VEB"); - - lh.addStaticHoliday ("15-MAY-2051", "VEB"); - - lh.addStaticHoliday ("05-JUN-2051", "VEB"); - - lh.addStaticHoliday ("03-JUL-2051", "VEB"); - - lh.addStaticHoliday ("05-JUL-2051", "VEB"); - - lh.addStaticHoliday ("24-JUL-2051", "VEB"); - - lh.addStaticHoliday ("14-AUG-2051", "VEB"); - - lh.addStaticHoliday ("12-OCT-2051", "VEB"); - - lh.addStaticHoliday ("06-NOV-2051", "VEB"); - - lh.addStaticHoliday ("11-DEC-2051", "VEB"); - - lh.addStaticHoliday ("25-DEC-2051", "VEB"); - - lh.addStaticHoliday ("01-JAN-2052", "VEB"); - - lh.addStaticHoliday ("04-MAR-2052", "VEB"); - - lh.addStaticHoliday ("05-MAR-2052", "VEB"); - - lh.addStaticHoliday ("19-MAR-2052", "VEB"); - - lh.addStaticHoliday ("18-APR-2052", "VEB"); - - lh.addStaticHoliday ("19-APR-2052", "VEB"); - - lh.addStaticHoliday ("01-MAY-2052", "VEB"); - - lh.addStaticHoliday ("03-JUN-2052", "VEB"); - - lh.addStaticHoliday ("24-JUN-2052", "VEB"); - - lh.addStaticHoliday ("05-JUL-2052", "VEB"); - - lh.addStaticHoliday ("24-JUL-2052", "VEB"); - - lh.addStaticHoliday ("19-AUG-2052", "VEB"); - - lh.addStaticHoliday ("04-NOV-2052", "VEB"); - - lh.addStaticHoliday ("25-DEC-2052", "VEB"); - - lh.addStaticHoliday ("01-JAN-2053", "VEB"); - - lh.addStaticHoliday ("06-JAN-2053", "VEB"); - - lh.addStaticHoliday ("17-FEB-2053", "VEB"); - - lh.addStaticHoliday ("18-FEB-2053", "VEB"); - - lh.addStaticHoliday ("19-MAR-2053", "VEB"); - - lh.addStaticHoliday ("03-APR-2053", "VEB"); - - lh.addStaticHoliday ("04-APR-2053", "VEB"); - - lh.addStaticHoliday ("01-MAY-2053", "VEB"); - - lh.addStaticHoliday ("19-MAY-2053", "VEB"); - - lh.addStaticHoliday ("09-JUN-2053", "VEB"); - - lh.addStaticHoliday ("24-JUN-2053", "VEB"); - - lh.addStaticHoliday ("24-JUL-2053", "VEB"); - - lh.addStaticHoliday ("18-AUG-2053", "VEB"); - - lh.addStaticHoliday ("08-DEC-2053", "VEB"); - - lh.addStaticHoliday ("25-DEC-2053", "VEB"); - - lh.addStaticHoliday ("01-JAN-2054", "VEB"); - - lh.addStaticHoliday ("05-JAN-2054", "VEB"); - - lh.addStaticHoliday ("09-FEB-2054", "VEB"); - - lh.addStaticHoliday ("10-FEB-2054", "VEB"); - - lh.addStaticHoliday ("19-MAR-2054", "VEB"); - - lh.addStaticHoliday ("26-MAR-2054", "VEB"); - - lh.addStaticHoliday ("27-MAR-2054", "VEB"); - - lh.addStaticHoliday ("01-MAY-2054", "VEB"); - - lh.addStaticHoliday ("11-MAY-2054", "VEB"); - - lh.addStaticHoliday ("01-JUN-2054", "VEB"); - - lh.addStaticHoliday ("24-JUN-2054", "VEB"); - - lh.addStaticHoliday ("29-JUN-2054", "VEB"); - - lh.addStaticHoliday ("24-JUL-2054", "VEB"); - - lh.addStaticHoliday ("12-OCT-2054", "VEB"); - - lh.addStaticHoliday ("07-DEC-2054", "VEB"); - - lh.addStaticHoliday ("25-DEC-2054", "VEB"); - - lh.addStaticHoliday ("01-JAN-2055", "VEB"); - - lh.addStaticHoliday ("04-JAN-2055", "VEB"); - - lh.addStaticHoliday ("01-MAR-2055", "VEB"); - - lh.addStaticHoliday ("02-MAR-2055", "VEB"); - - lh.addStaticHoliday ("19-MAR-2055", "VEB"); - - lh.addStaticHoliday ("15-APR-2055", "VEB"); - - lh.addStaticHoliday ("16-APR-2055", "VEB"); - - lh.addStaticHoliday ("19-APR-2055", "VEB"); - - lh.addStaticHoliday ("31-MAY-2055", "VEB"); - - lh.addStaticHoliday ("21-JUN-2055", "VEB"); - - lh.addStaticHoliday ("24-JUN-2055", "VEB"); - - lh.addStaticHoliday ("28-JUN-2055", "VEB"); - - lh.addStaticHoliday ("05-JUL-2055", "VEB"); - - lh.addStaticHoliday ("12-OCT-2055", "VEB"); - - lh.addStaticHoliday ("01-NOV-2055", "VEB"); - - lh.addStaticHoliday ("06-DEC-2055", "VEB"); - - lh.addStaticHoliday ("10-JAN-2056", "VEB"); - - lh.addStaticHoliday ("14-FEB-2056", "VEB"); - - lh.addStaticHoliday ("15-FEB-2056", "VEB"); - - lh.addStaticHoliday ("30-MAR-2056", "VEB"); - - lh.addStaticHoliday ("31-MAR-2056", "VEB"); - - lh.addStaticHoliday ("19-APR-2056", "VEB"); - - lh.addStaticHoliday ("01-MAY-2056", "VEB"); - - lh.addStaticHoliday ("15-MAY-2056", "VEB"); - - lh.addStaticHoliday ("05-JUN-2056", "VEB"); - - lh.addStaticHoliday ("03-JUL-2056", "VEB"); - - lh.addStaticHoliday ("05-JUL-2056", "VEB"); - - lh.addStaticHoliday ("24-JUL-2056", "VEB"); - - lh.addStaticHoliday ("14-AUG-2056", "VEB"); - - lh.addStaticHoliday ("12-OCT-2056", "VEB"); - - lh.addStaticHoliday ("06-NOV-2056", "VEB"); - - lh.addStaticHoliday ("11-DEC-2056", "VEB"); - - lh.addStaticHoliday ("25-DEC-2056", "VEB"); - - lh.addStaticHoliday ("01-JAN-2057", "VEB"); - - lh.addStaticHoliday ("05-MAR-2057", "VEB"); - - lh.addStaticHoliday ("06-MAR-2057", "VEB"); - - lh.addStaticHoliday ("19-MAR-2057", "VEB"); - - lh.addStaticHoliday ("19-APR-2057", "VEB"); - - lh.addStaticHoliday ("20-APR-2057", "VEB"); - - lh.addStaticHoliday ("01-MAY-2057", "VEB"); - - lh.addStaticHoliday ("04-JUN-2057", "VEB"); - - lh.addStaticHoliday ("25-JUN-2057", "VEB"); - - lh.addStaticHoliday ("02-JUL-2057", "VEB"); - - lh.addStaticHoliday ("05-JUL-2057", "VEB"); - - lh.addStaticHoliday ("24-JUL-2057", "VEB"); - - lh.addStaticHoliday ("20-AUG-2057", "VEB"); - - lh.addStaticHoliday ("12-OCT-2057", "VEB"); - - lh.addStaticHoliday ("05-NOV-2057", "VEB"); - - lh.addStaticHoliday ("25-DEC-2057", "VEB"); - - lh.addStaticHoliday ("01-JAN-2058", "VEB"); - - lh.addStaticHoliday ("25-FEB-2058", "VEB"); - - lh.addStaticHoliday ("26-FEB-2058", "VEB"); - - lh.addStaticHoliday ("19-MAR-2058", "VEB"); - - lh.addStaticHoliday ("11-APR-2058", "VEB"); - - lh.addStaticHoliday ("12-APR-2058", "VEB"); - - lh.addStaticHoliday ("19-APR-2058", "VEB"); - - lh.addStaticHoliday ("01-MAY-2058", "VEB"); - - lh.addStaticHoliday ("27-MAY-2058", "VEB"); - - lh.addStaticHoliday ("17-JUN-2058", "VEB"); - - lh.addStaticHoliday ("24-JUN-2058", "VEB"); - - lh.addStaticHoliday ("05-JUL-2058", "VEB"); - - lh.addStaticHoliday ("24-JUL-2058", "VEB"); - - lh.addStaticHoliday ("19-AUG-2058", "VEB"); - - lh.addStaticHoliday ("04-NOV-2058", "VEB"); - - lh.addStaticHoliday ("25-DEC-2058", "VEB"); - - lh.addStaticHoliday ("01-JAN-2059", "VEB"); - - lh.addStaticHoliday ("06-JAN-2059", "VEB"); - - lh.addStaticHoliday ("10-FEB-2059", "VEB"); - - lh.addStaticHoliday ("11-FEB-2059", "VEB"); - - lh.addStaticHoliday ("19-MAR-2059", "VEB"); - - lh.addStaticHoliday ("27-MAR-2059", "VEB"); - - lh.addStaticHoliday ("28-MAR-2059", "VEB"); - - lh.addStaticHoliday ("01-MAY-2059", "VEB"); - - lh.addStaticHoliday ("12-MAY-2059", "VEB"); - - lh.addStaticHoliday ("02-JUN-2059", "VEB"); - - lh.addStaticHoliday ("24-JUN-2059", "VEB"); - - lh.addStaticHoliday ("24-JUL-2059", "VEB"); - - lh.addStaticHoliday ("18-AUG-2059", "VEB"); - - lh.addStaticHoliday ("08-DEC-2059", "VEB"); - - lh.addStaticHoliday ("25-DEC-2059", "VEB"); - - lh.addStaticHoliday ("01-JAN-2060", "VEB"); - - lh.addStaticHoliday ("05-JAN-2060", "VEB"); - - lh.addStaticHoliday ("01-MAR-2060", "VEB"); - - lh.addStaticHoliday ("02-MAR-2060", "VEB"); - - lh.addStaticHoliday ("19-MAR-2060", "VEB"); - - lh.addStaticHoliday ("15-APR-2060", "VEB"); - - lh.addStaticHoliday ("16-APR-2060", "VEB"); - - lh.addStaticHoliday ("19-APR-2060", "VEB"); - - lh.addStaticHoliday ("31-MAY-2060", "VEB"); - - lh.addStaticHoliday ("21-JUN-2060", "VEB"); - - lh.addStaticHoliday ("24-JUN-2060", "VEB"); - - lh.addStaticHoliday ("28-JUN-2060", "VEB"); - - lh.addStaticHoliday ("05-JUL-2060", "VEB"); - - lh.addStaticHoliday ("12-OCT-2060", "VEB"); - - lh.addStaticHoliday ("01-NOV-2060", "VEB"); - - lh.addStaticHoliday ("06-DEC-2060", "VEB"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/VNDHoliday.java b/org/drip/analytics/holset/VNDHoliday.java deleted file mode 100644 index 3558f3d..0000000 --- a/org/drip/analytics/holset/VNDHoliday.java +++ /dev/null @@ -1,555 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class VNDHoliday implements org.drip.analytics.holset.LocationHoliday { - public VNDHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "VND"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("27-JAN-1998", "Lunar New Years Eve"); - - lh.addStaticHoliday ("28-JAN-1998", "Lunar New Years Day"); - - lh.addStaticHoliday ("29-JAN-1998", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("30-JAN-1998", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("30-APR-1998", "Day before Labor Day"); - - lh.addStaticHoliday ("01-MAY-1998", "Labor Day"); - - lh.addStaticHoliday ("02-SEP-1998", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("15-FEB-1999", "Lunar New Years Eve"); - - lh.addStaticHoliday ("16-FEB-1999", "Lunar New Years Day"); - - lh.addStaticHoliday ("17-FEB-1999", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("18-FEB-1999", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("30-APR-1999", "Day before Labor Day"); - - lh.addStaticHoliday ("01-MAY-1999", "Labor Day"); - - lh.addStaticHoliday ("02-SEP-1999", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2000", "New Years Day"); - - lh.addStaticHoliday ("04-FEB-2000", "Lunar New Years Eve"); - - lh.addStaticHoliday ("05-FEB-2000", "Lunar New Years Day"); - - lh.addStaticHoliday ("07-FEB-2000", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("08-FEB-2000", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("01-MAY-2000", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2000", "Day before Labor Day Observed"); - - lh.addStaticHoliday ("02-SEP-2000", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("23-JAN-2001", "Lunar New Years Eve"); - - lh.addStaticHoliday ("24-JAN-2001", "Lunar New Years Day"); - - lh.addStaticHoliday ("25-JAN-2001", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("26-JAN-2001", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("30-APR-2001", "Day before Labor Day"); - - lh.addStaticHoliday ("01-MAY-2001", "Labor Day"); - - lh.addStaticHoliday ("03-SEP-2001", "Independence Day Observed"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2002", "Lunar New Years Eve"); - - lh.addStaticHoliday ("12-FEB-2002", "Lunar New Years Day"); - - lh.addStaticHoliday ("13-FEB-2002", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("14-FEB-2002", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("30-APR-2002", "Day before Labor Day"); - - lh.addStaticHoliday ("01-MAY-2002", "Labor Day"); - - lh.addStaticHoliday ("02-SEP-2002", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("31-JAN-2003", "Lunar New Years Eve"); - - lh.addStaticHoliday ("01-FEB-2003", "Lunar New Years Day"); - - lh.addStaticHoliday ("03-FEB-2003", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("04-FEB-2003", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("30-APR-2003", "Day before Labor Day"); - - lh.addStaticHoliday ("01-MAY-2003", "Labor Day"); - - lh.addStaticHoliday ("02-SEP-2003", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("21-JAN-2004", "Lunar New Years Eve"); - - lh.addStaticHoliday ("22-JAN-2004", "Lunar New Years Day"); - - lh.addStaticHoliday ("23-JAN-2004", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("24-JAN-2004", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("30-APR-2004", "Day before Labor Day"); - - lh.addStaticHoliday ("01-MAY-2004", "Labor Day"); - - lh.addStaticHoliday ("02-SEP-2004", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2005", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2005", "Lunar New Years Eve"); - - lh.addStaticHoliday ("09-FEB-2005", "Lunar New Years Day"); - - lh.addStaticHoliday ("10-FEB-2005", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("11-FEB-2005", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("30-APR-2005", "Day before Labor Day"); - - lh.addStaticHoliday ("02-MAY-2005", "Labor Day Observed"); - - lh.addStaticHoliday ("02-SEP-2005", "Independence Day"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("28-JAN-2006", "Lunar New Years Eve"); - - lh.addStaticHoliday ("30-JAN-2006", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("31-JAN-2006", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("01-FEB-2006", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("01-MAY-2006", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2006", "Day before Labor Day Observed"); - - lh.addStaticHoliday ("02-SEP-2006", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("17-FEB-2007", "Lunar New Years Eve"); - - lh.addStaticHoliday ("19-FEB-2007", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("20-FEB-2007", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("21-FEB-2007", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("30-APR-2007", "Day before Labor Day"); - - lh.addStaticHoliday ("01-MAY-2007", "Labor Day"); - - lh.addStaticHoliday ("03-SEP-2007", "Independence Day Observed"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("06-FEB-2008", "Lunar New Years Eve"); - - lh.addStaticHoliday ("07-FEB-2008", "Lunar New Years Day"); - - lh.addStaticHoliday ("08-FEB-2008", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("09-FEB-2008", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("30-APR-2008", "Day before Labor Day"); - - lh.addStaticHoliday ("01-MAY-2008", "Labor Day"); - - lh.addStaticHoliday ("02-SEP-2008", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("26-JAN-2009", "Lunar New Years Eve Observed"); - - lh.addStaticHoliday ("27-JAN-2009", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("28-JAN-2009", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("29-JAN-2009", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("30-APR-2009", "Day before Labor Day"); - - lh.addStaticHoliday ("01-MAY-2009", "Labor Day"); - - lh.addStaticHoliday ("02-SEP-2009", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("13-FEB-2010", "Lunar New Years Eve"); - - lh.addStaticHoliday ("15-FEB-2010", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("16-FEB-2010", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("17-FEB-2010", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("30-APR-2010", "Day before Labor Day"); - - lh.addStaticHoliday ("01-MAY-2010", "Labor Day"); - - lh.addStaticHoliday ("02-SEP-2010", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2011", "New Years Day"); - - lh.addStaticHoliday ("02-FEB-2011", "Lunar New Years Eve"); - - lh.addStaticHoliday ("03-FEB-2011", "Lunar New Years Day"); - - lh.addStaticHoliday ("04-FEB-2011", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("05-FEB-2011", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("30-APR-2011", "Day before Labor Day"); - - lh.addStaticHoliday ("02-MAY-2011", "Labor Day Observed"); - - lh.addStaticHoliday ("02-SEP-2011", "Independence Day"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("23-JAN-2012", "Lunar New Years Eve Observed"); - - lh.addStaticHoliday ("24-JAN-2012", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("25-JAN-2012", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("26-JAN-2012", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("30-APR-2012", "Day before Labor Day"); - - lh.addStaticHoliday ("01-MAY-2012", "Labor Day"); - - lh.addStaticHoliday ("03-SEP-2012", "Independence Day Observed"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("09-FEB-2013", "Lunar New Years Eve"); - - lh.addStaticHoliday ("11-FEB-2013", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("12-FEB-2013", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("13-FEB-2013", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("30-APR-2013", "Day before Labor Day"); - - lh.addStaticHoliday ("01-MAY-2013", "Labor Day"); - - lh.addStaticHoliday ("02-SEP-2013", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("30-JAN-2014", "Lunar New Years Eve"); - - lh.addStaticHoliday ("31-JAN-2014", "Lunar New Years Day"); - - lh.addStaticHoliday ("01-FEB-2014", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("03-FEB-2014", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("30-APR-2014", "Day before Labor Day"); - - lh.addStaticHoliday ("01-MAY-2014", "Labor Day"); - - lh.addStaticHoliday ("02-SEP-2014", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("18-FEB-2015", "Lunar New Years Eve"); - - lh.addStaticHoliday ("19-FEB-2015", "Lunar New Years Day"); - - lh.addStaticHoliday ("20-FEB-2015", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("21-FEB-2015", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("30-APR-2015", "Day before Labor Day"); - - lh.addStaticHoliday ("01-MAY-2015", "Labor Day"); - - lh.addStaticHoliday ("02-SEP-2015", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("08-FEB-2016", "Lunar New Years Eve Observed"); - - lh.addStaticHoliday ("09-FEB-2016", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("10-FEB-2016", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("11-FEB-2016", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("30-APR-2016", "Day before Labor Day"); - - lh.addStaticHoliday ("02-MAY-2016", "Labor Day Observed"); - - lh.addStaticHoliday ("02-SEP-2016", "Independence Day"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("27-JAN-2017", "Lunar New Years Eve"); - - lh.addStaticHoliday ("28-JAN-2017", "Lunar New Years Day"); - - lh.addStaticHoliday ("30-JAN-2017", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("31-JAN-2017", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("01-MAY-2017", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2017", "Day before Labor Day Observed"); - - lh.addStaticHoliday ("02-SEP-2017", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("15-FEB-2018", "Lunar New Years Eve"); - - lh.addStaticHoliday ("16-FEB-2018", "Lunar New Years Day"); - - lh.addStaticHoliday ("17-FEB-2018", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("19-FEB-2018", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("30-APR-2018", "Day before Labor Day"); - - lh.addStaticHoliday ("01-MAY-2018", "Labor Day"); - - lh.addStaticHoliday ("03-SEP-2018", "Independence Day Observed"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("04-FEB-2019", "Lunar New Years Eve"); - - lh.addStaticHoliday ("05-FEB-2019", "Lunar New Years Day"); - - lh.addStaticHoliday ("06-FEB-2019", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("07-FEB-2019", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("30-APR-2019", "Day before Labor Day"); - - lh.addStaticHoliday ("01-MAY-2019", "Labor Day"); - - lh.addStaticHoliday ("02-SEP-2019", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("24-JAN-2020", "Lunar New Years Eve"); - - lh.addStaticHoliday ("25-JAN-2020", "Lunar New Years Day"); - - lh.addStaticHoliday ("27-JAN-2020", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("28-JAN-2020", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("30-APR-2020", "Day before Labor Day"); - - lh.addStaticHoliday ("01-MAY-2020", "Labor Day"); - - lh.addStaticHoliday ("02-SEP-2020", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("11-FEB-2021", "Lunar New Years Eve"); - - lh.addStaticHoliday ("12-FEB-2021", "Lunar New Years Day"); - - lh.addStaticHoliday ("13-FEB-2021", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("15-FEB-2021", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("30-APR-2021", "Day before Labor Day"); - - lh.addStaticHoliday ("01-MAY-2021", "Labor Day"); - - lh.addStaticHoliday ("02-SEP-2021", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2022", "New Years Day"); - - lh.addStaticHoliday ("31-JAN-2022", "Lunar New Years Eve"); - - lh.addStaticHoliday ("01-FEB-2022", "Lunar New Years Day"); - - lh.addStaticHoliday ("02-FEB-2022", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("03-FEB-2022", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("30-APR-2022", "Day before Labor Day"); - - lh.addStaticHoliday ("02-MAY-2022", "Labor Day Observed"); - - lh.addStaticHoliday ("02-SEP-2022", "Independence Day"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("21-JAN-2023", "Lunar New Years Eve"); - - lh.addStaticHoliday ("23-JAN-2023", "Lunar New Years Day Observed"); - - lh.addStaticHoliday ("24-JAN-2023", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("25-JAN-2023", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("01-MAY-2023", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2023", "Day before Labor Day Observed"); - - lh.addStaticHoliday ("02-SEP-2023", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("09-FEB-2024", "Lunar New Years Eve"); - - lh.addStaticHoliday ("10-FEB-2024", "Lunar New Years Day"); - - lh.addStaticHoliday ("12-FEB-2024", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("13-FEB-2024", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("30-APR-2024", "Day before Labor Day"); - - lh.addStaticHoliday ("01-MAY-2024", "Labor Day"); - - lh.addStaticHoliday ("02-SEP-2024", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("28-JAN-2025", "Lunar New Years Eve"); - - lh.addStaticHoliday ("29-JAN-2025", "Lunar New Years Day"); - - lh.addStaticHoliday ("30-JAN-2025", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("31-JAN-2025", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("30-APR-2025", "Day before Labor Day"); - - lh.addStaticHoliday ("01-MAY-2025", "Labor Day"); - - lh.addStaticHoliday ("02-SEP-2025", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("16-FEB-2026", "Lunar New Years Eve"); - - lh.addStaticHoliday ("17-FEB-2026", "Lunar New Years Day"); - - lh.addStaticHoliday ("18-FEB-2026", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("19-FEB-2026", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("30-APR-2026", "Day before Labor Day"); - - lh.addStaticHoliday ("01-MAY-2026", "Labor Day"); - - lh.addStaticHoliday ("02-SEP-2026", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("05-FEB-2027", "Lunar New Years Eve"); - - lh.addStaticHoliday ("06-FEB-2027", "Lunar New Years Day"); - - lh.addStaticHoliday ("08-FEB-2027", "Second Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("09-FEB-2027", "Third Day of Lunar New Year Observed"); - - lh.addStaticHoliday ("30-APR-2027", "Day before Labor Day"); - - lh.addStaticHoliday ("01-MAY-2027", "Labor Day"); - - lh.addStaticHoliday ("02-SEP-2027", "Independence Day"); - - lh.addStaticHoliday ("01-JAN-2028", "New Years Day"); - - lh.addStaticHoliday ("25-JAN-2028", "Lunar New Years Eve"); - - lh.addStaticHoliday ("26-JAN-2028", "Lunar New Years Day"); - - lh.addStaticHoliday ("27-JAN-2028", "Second Day of Lunar New Year"); - - lh.addStaticHoliday ("28-JAN-2028", "Third Day of Lunar New Year"); - - lh.addStaticHoliday ("01-MAY-2028", "Labor Day"); - - lh.addStaticHoliday ("02-MAY-2028", "Day before Labor Day Observed"); - - lh.addStaticHoliday ("02-SEP-2028", "Independence Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/XDRHoliday.java b/org/drip/analytics/holset/XDRHoliday.java deleted file mode 100644 index e9a2307..0000000 --- a/org/drip/analytics/holset/XDRHoliday.java +++ /dev/null @@ -1,717 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class XDRHoliday implements org.drip.analytics.holset.LocationHoliday { - public XDRHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "XDR"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("20-FEB-1995", "holiday"); - - lh.addStaticHoliday ("21-MAR-1995", "holiday"); - - lh.addStaticHoliday ("14-APR-1995", "holiday"); - - lh.addStaticHoliday ("17-APR-1995", "holiday"); - - lh.addStaticHoliday ("01-MAY-1995", "holiday"); - - lh.addStaticHoliday ("03-MAY-1995", "holiday"); - - lh.addStaticHoliday ("04-MAY-1995", "holiday"); - - lh.addStaticHoliday ("05-MAY-1995", "holiday"); - - lh.addStaticHoliday ("08-MAY-1995", "holiday"); - - lh.addStaticHoliday ("25-MAY-1995", "holiday"); - - lh.addStaticHoliday ("29-MAY-1995", "holiday"); - - lh.addStaticHoliday ("05-JUN-1995", "holiday"); - - lh.addStaticHoliday ("15-JUN-1995", "holiday"); - - lh.addStaticHoliday ("04-JUL-1995", "holiday"); - - lh.addStaticHoliday ("14-JUL-1995", "holiday"); - - lh.addStaticHoliday ("14-AUG-1995", "holiday"); - - lh.addStaticHoliday ("15-AUG-1995", "holiday"); - - lh.addStaticHoliday ("28-AUG-1995", "holiday"); - - lh.addStaticHoliday ("04-SEP-1995", "holiday"); - - lh.addStaticHoliday ("15-SEP-1995", "holiday"); - - lh.addStaticHoliday ("03-OCT-1995", "holiday"); - - lh.addStaticHoliday ("09-OCT-1995", "holiday"); - - lh.addStaticHoliday ("10-OCT-1995", "holiday"); - - lh.addStaticHoliday ("01-NOV-1995", "holiday"); - - lh.addStaticHoliday ("03-NOV-1995", "holiday"); - - lh.addStaticHoliday ("23-NOV-1995", "holiday"); - - lh.addStaticHoliday ("25-DEC-1995", "holiday"); - - lh.addStaticHoliday ("26-DEC-1995", "holiday"); - - lh.addStaticHoliday ("27-DEC-1995", "holiday"); - - lh.addStaticHoliday ("01-JAN-1996", "holiday"); - - lh.addStaticHoliday ("02-JAN-1996", "holiday"); - - lh.addStaticHoliday ("03-JAN-1996", "holiday"); - - lh.addStaticHoliday ("15-JAN-1996", "holiday"); - - lh.addStaticHoliday ("12-FEB-1996", "holiday"); - - lh.addStaticHoliday ("19-FEB-1996", "holiday"); - - lh.addStaticHoliday ("21-MAR-1996", "holiday"); - - lh.addStaticHoliday ("05-APR-1996", "holiday"); - - lh.addStaticHoliday ("08-APR-1996", "holiday"); - - lh.addStaticHoliday ("29-APR-1996", "holiday"); - - lh.addStaticHoliday ("01-MAY-1996", "holiday"); - - lh.addStaticHoliday ("03-MAY-1996", "holiday"); - - lh.addStaticHoliday ("06-MAY-1996", "holiday"); - - lh.addStaticHoliday ("08-MAY-1996", "holiday"); - - lh.addStaticHoliday ("16-MAY-1996", "holiday"); - - lh.addStaticHoliday ("27-MAY-1996", "holiday"); - - lh.addStaticHoliday ("06-JUN-1996", "holiday"); - - lh.addStaticHoliday ("04-JUL-1996", "holiday"); - - lh.addStaticHoliday ("15-AUG-1996", "holiday"); - - lh.addStaticHoliday ("28-AUG-1996", "holiday"); - - lh.addStaticHoliday ("02-SEP-1996", "holiday"); - - lh.addStaticHoliday ("16-SEP-1996", "holiday"); - - lh.addStaticHoliday ("23-SEP-1996", "holiday"); - - lh.addStaticHoliday ("03-OCT-1996", "holiday"); - - lh.addStaticHoliday ("10-OCT-1996", "holiday"); - - lh.addStaticHoliday ("14-OCT-1996", "holiday"); - - lh.addStaticHoliday ("01-NOV-1996", "holiday"); - - lh.addStaticHoliday ("04-NOV-1996", "holiday"); - - lh.addStaticHoliday ("11-NOV-1996", "holiday"); - - lh.addStaticHoliday ("28-NOV-1996", "holiday"); - - lh.addStaticHoliday ("23-DEC-1996", "holiday"); - - lh.addStaticHoliday ("24-DEC-1996", "holiday"); - - lh.addStaticHoliday ("25-DEC-1996", "holiday"); - - lh.addStaticHoliday ("26-DEC-1996", "holiday"); - - lh.addStaticHoliday ("27-DEC-1996", "holiday"); - - lh.addStaticHoliday ("01-JAN-1997", "holiday"); - - lh.addStaticHoliday ("02-JAN-1997", "holiday"); - - lh.addStaticHoliday ("03-JAN-1997", "holiday"); - - lh.addStaticHoliday ("15-JAN-1997", "holiday"); - - lh.addStaticHoliday ("20-JAN-1997", "holiday"); - - lh.addStaticHoliday ("11-FEB-1997", "holiday"); - - lh.addStaticHoliday ("17-FEB-1997", "holiday"); - - lh.addStaticHoliday ("21-MAR-1997", "holiday"); - - lh.addStaticHoliday ("28-MAR-1997", "holiday"); - - lh.addStaticHoliday ("31-MAR-1997", "holiday"); - - lh.addStaticHoliday ("29-APR-1997", "holiday"); - - lh.addStaticHoliday ("01-MAY-1997", "holiday"); - - lh.addStaticHoliday ("05-MAY-1997", "holiday"); - - lh.addStaticHoliday ("08-MAY-1997", "holiday"); - - lh.addStaticHoliday ("19-MAY-1997", "holiday"); - - lh.addStaticHoliday ("26-MAY-1997", "holiday"); - - lh.addStaticHoliday ("29-MAY-1997", "holiday"); - - lh.addStaticHoliday ("04-JUL-1997", "holiday"); - - lh.addStaticHoliday ("14-JUL-1997", "holiday"); - - lh.addStaticHoliday ("15-AUG-1997", "holiday"); - - lh.addStaticHoliday ("28-AUG-1997", "holiday"); - - lh.addStaticHoliday ("01-SEP-1997", "holiday"); - - lh.addStaticHoliday ("15-SEP-1997", "holiday"); - - lh.addStaticHoliday ("23-SEP-1997", "holiday"); - - lh.addStaticHoliday ("03-OCT-1997", "holiday"); - - lh.addStaticHoliday ("10-OCT-1997", "holiday"); - - lh.addStaticHoliday ("13-OCT-1997", "holiday"); - - lh.addStaticHoliday ("03-NOV-1997", "holiday"); - - lh.addStaticHoliday ("11-NOV-1997", "holiday"); - - lh.addStaticHoliday ("24-NOV-1997", "holiday"); - - lh.addStaticHoliday ("27-NOV-1997", "holiday"); - - lh.addStaticHoliday ("23-DEC-1997", "holiday"); - - lh.addStaticHoliday ("24-DEC-1997", "holiday"); - - lh.addStaticHoliday ("25-DEC-1997", "holiday"); - - lh.addStaticHoliday ("26-DEC-1997", "holiday"); - - lh.addStaticHoliday ("01-JAN-1998", "holiday"); - - lh.addStaticHoliday ("02-JAN-1998", "holiday"); - - lh.addStaticHoliday ("15-JAN-1998", "holiday"); - - lh.addStaticHoliday ("19-JAN-1998", "holiday"); - - lh.addStaticHoliday ("11-FEB-1998", "holiday"); - - lh.addStaticHoliday ("16-FEB-1998", "holiday"); - - lh.addStaticHoliday ("10-APR-1998", "holiday"); - - lh.addStaticHoliday ("13-APR-1998", "holiday"); - - lh.addStaticHoliday ("29-APR-1998", "holiday"); - - lh.addStaticHoliday ("01-MAY-1998", "holiday"); - - lh.addStaticHoliday ("04-MAY-1998", "holiday"); - - lh.addStaticHoliday ("05-MAY-1998", "holiday"); - - lh.addStaticHoliday ("08-MAY-1998", "holiday"); - - lh.addStaticHoliday ("21-MAY-1998", "holiday"); - - lh.addStaticHoliday ("25-MAY-1998", "holiday"); - - lh.addStaticHoliday ("01-JUN-1998", "holiday"); - - lh.addStaticHoliday ("11-JUN-1998", "holiday"); - - lh.addStaticHoliday ("14-JUL-1998", "holiday"); - - lh.addStaticHoliday ("28-AUG-1998", "holiday"); - - lh.addStaticHoliday ("07-SEP-1998", "holiday"); - - lh.addStaticHoliday ("15-SEP-1998", "holiday"); - - lh.addStaticHoliday ("23-SEP-1998", "holiday"); - - lh.addStaticHoliday ("12-OCT-1998", "holiday"); - - lh.addStaticHoliday ("03-NOV-1998", "holiday"); - - lh.addStaticHoliday ("11-NOV-1998", "holiday"); - - lh.addStaticHoliday ("23-NOV-1998", "holiday"); - - lh.addStaticHoliday ("26-NOV-1998", "holiday"); - - lh.addStaticHoliday ("23-DEC-1998", "holiday"); - - lh.addStaticHoliday ("24-DEC-1998", "holiday"); - - lh.addStaticHoliday ("25-DEC-1998", "holiday"); - - lh.addStaticHoliday ("28-DEC-1998", "holiday"); - - lh.addStaticHoliday ("29-DEC-1998", "holiday"); - - lh.addStaticHoliday ("01-JAN-1999", "holiday"); - - lh.addStaticHoliday ("15-JAN-1999", "holiday"); - - lh.addStaticHoliday ("18-JAN-1999", "holiday"); - - lh.addStaticHoliday ("11-FEB-1999", "holiday"); - - lh.addStaticHoliday ("15-FEB-1999", "holiday"); - - lh.addStaticHoliday ("22-MAR-1999", "holiday"); - - lh.addStaticHoliday ("02-APR-1999", "holiday"); - - lh.addStaticHoliday ("05-APR-1999", "holiday"); - - lh.addStaticHoliday ("29-APR-1999", "holiday"); - - lh.addStaticHoliday ("03-MAY-1999", "holiday"); - - lh.addStaticHoliday ("04-MAY-1999", "holiday"); - - lh.addStaticHoliday ("05-MAY-1999", "holiday"); - - lh.addStaticHoliday ("13-MAY-1999", "holiday"); - - lh.addStaticHoliday ("24-MAY-1999", "holiday"); - - lh.addStaticHoliday ("31-MAY-1999", "holiday"); - - lh.addStaticHoliday ("03-JUN-1999", "holiday"); - - lh.addStaticHoliday ("05-JUL-1999", "holiday"); - - lh.addStaticHoliday ("14-JUL-1999", "holiday"); - - lh.addStaticHoliday ("06-SEP-1999", "holiday"); - - lh.addStaticHoliday ("15-SEP-1999", "holiday"); - - lh.addStaticHoliday ("23-SEP-1999", "holiday"); - - lh.addStaticHoliday ("11-OCT-1999", "holiday"); - - lh.addStaticHoliday ("01-NOV-1999", "holiday"); - - lh.addStaticHoliday ("03-NOV-1999", "holiday"); - - lh.addStaticHoliday ("11-NOV-1999", "holiday"); - - lh.addStaticHoliday ("23-NOV-1999", "holiday"); - - lh.addStaticHoliday ("25-NOV-1999", "holiday"); - - lh.addStaticHoliday ("23-DEC-1999", "holiday"); - - lh.addStaticHoliday ("24-DEC-1999", "holiday"); - - lh.addStaticHoliday ("27-DEC-1999", "holiday"); - - lh.addStaticHoliday ("28-DEC-1999", "holiday"); - - lh.addStaticHoliday ("03-JAN-2000", "holiday"); - - lh.addStaticHoliday ("17-JAN-2000", "holiday"); - - lh.addStaticHoliday ("11-FEB-2000", "holiday"); - - lh.addStaticHoliday ("21-FEB-2000", "holiday"); - - lh.addStaticHoliday ("21-MAR-2000", "holiday"); - - lh.addStaticHoliday ("21-APR-2000", "holiday"); - - lh.addStaticHoliday ("24-APR-2000", "holiday"); - - lh.addStaticHoliday ("01-MAY-2000", "holiday"); - - lh.addStaticHoliday ("03-MAY-2000", "holiday"); - - lh.addStaticHoliday ("04-MAY-2000", "holiday"); - - lh.addStaticHoliday ("05-MAY-2000", "holiday"); - - lh.addStaticHoliday ("08-MAY-2000", "holiday"); - - lh.addStaticHoliday ("29-MAY-2000", "holiday"); - - lh.addStaticHoliday ("01-JUN-2000", "holiday"); - - lh.addStaticHoliday ("12-JUN-2000", "holiday"); - - lh.addStaticHoliday ("22-JUN-2000", "holiday"); - - lh.addStaticHoliday ("04-JUL-2000", "holiday"); - - lh.addStaticHoliday ("14-JUL-2000", "holiday"); - - lh.addStaticHoliday ("14-AUG-2000", "holiday"); - - lh.addStaticHoliday ("15-AUG-2000", "holiday"); - - lh.addStaticHoliday ("28-AUG-2000", "holiday"); - - lh.addStaticHoliday ("04-SEP-2000", "holiday"); - - lh.addStaticHoliday ("15-SEP-2000", "holiday"); - - lh.addStaticHoliday ("03-OCT-2000", "holiday"); - - lh.addStaticHoliday ("09-OCT-2000", "holiday"); - - lh.addStaticHoliday ("10-OCT-2000", "holiday"); - - lh.addStaticHoliday ("01-NOV-2000", "holiday"); - - lh.addStaticHoliday ("03-NOV-2000", "holiday"); - - lh.addStaticHoliday ("23-NOV-2000", "holiday"); - - lh.addStaticHoliday ("25-DEC-2000", "holiday"); - - lh.addStaticHoliday ("26-DEC-2000", "holiday"); - - lh.addStaticHoliday ("27-DEC-2000", "holiday"); - - lh.addStaticHoliday ("01-JAN-2001", "holiday"); - - lh.addStaticHoliday ("02-JAN-2001", "holiday"); - - lh.addStaticHoliday ("03-JAN-2001", "holiday"); - - lh.addStaticHoliday ("15-JAN-2001", "holiday"); - - lh.addStaticHoliday ("12-FEB-2001", "holiday"); - - lh.addStaticHoliday ("19-FEB-2001", "holiday"); - - lh.addStaticHoliday ("21-MAR-2001", "holiday"); - - lh.addStaticHoliday ("13-APR-2001", "holiday"); - - lh.addStaticHoliday ("16-APR-2001", "holiday"); - - lh.addStaticHoliday ("30-APR-2001", "holiday"); - - lh.addStaticHoliday ("01-MAY-2001", "holiday"); - - lh.addStaticHoliday ("03-MAY-2001", "holiday"); - - lh.addStaticHoliday ("04-MAY-2001", "holiday"); - - lh.addStaticHoliday ("08-MAY-2001", "holiday"); - - lh.addStaticHoliday ("24-MAY-2001", "holiday"); - - lh.addStaticHoliday ("28-MAY-2001", "holiday"); - - lh.addStaticHoliday ("04-JUN-2001", "holiday"); - - lh.addStaticHoliday ("14-JUN-2001", "holiday"); - - lh.addStaticHoliday ("04-JUL-2001", "holiday"); - - lh.addStaticHoliday ("15-AUG-2001", "holiday"); - - lh.addStaticHoliday ("28-AUG-2001", "holiday"); - - lh.addStaticHoliday ("03-SEP-2001", "holiday"); - - lh.addStaticHoliday ("24-SEP-2001", "holiday"); - - lh.addStaticHoliday ("03-OCT-2001", "holiday"); - - lh.addStaticHoliday ("08-OCT-2001", "holiday"); - - lh.addStaticHoliday ("10-OCT-2001", "holiday"); - - lh.addStaticHoliday ("01-NOV-2001", "holiday"); - - lh.addStaticHoliday ("12-NOV-2001", "holiday"); - - lh.addStaticHoliday ("22-NOV-2001", "holiday"); - - lh.addStaticHoliday ("23-NOV-2001", "holiday"); - - lh.addStaticHoliday ("24-DEC-2001", "holiday"); - - lh.addStaticHoliday ("25-DEC-2001", "holiday"); - - lh.addStaticHoliday ("26-DEC-2001", "holiday"); - - lh.addStaticHoliday ("27-DEC-2001", "holiday"); - - lh.addStaticHoliday ("01-JAN-2002", "holiday"); - - lh.addStaticHoliday ("02-JAN-2002", "holiday"); - - lh.addStaticHoliday ("03-JAN-2002", "holiday"); - - lh.addStaticHoliday ("15-JAN-2002", "holiday"); - - lh.addStaticHoliday ("21-JAN-2002", "holiday"); - - lh.addStaticHoliday ("11-FEB-2002", "holiday"); - - lh.addStaticHoliday ("18-FEB-2002", "holiday"); - - lh.addStaticHoliday ("21-MAR-2002", "holiday"); - - lh.addStaticHoliday ("29-APR-2002", "holiday"); - - lh.addStaticHoliday ("01-MAY-2002", "holiday"); - - lh.addStaticHoliday ("03-MAY-2002", "holiday"); - - lh.addStaticHoliday ("06-MAY-2002", "holiday"); - - lh.addStaticHoliday ("08-MAY-2002", "holiday"); - - lh.addStaticHoliday ("27-MAY-2002", "holiday"); - - lh.addStaticHoliday ("04-JUL-2002", "holiday"); - - lh.addStaticHoliday ("15-AUG-2002", "holiday"); - - lh.addStaticHoliday ("28-AUG-2002", "holiday"); - - lh.addStaticHoliday ("02-SEP-2002", "holiday"); - - lh.addStaticHoliday ("16-SEP-2002", "holiday"); - - lh.addStaticHoliday ("23-SEP-2002", "holiday"); - - lh.addStaticHoliday ("03-OCT-2002", "holiday"); - - lh.addStaticHoliday ("10-OCT-2002", "holiday"); - - lh.addStaticHoliday ("14-OCT-2002", "holiday"); - - lh.addStaticHoliday ("01-NOV-2002", "holiday"); - - lh.addStaticHoliday ("04-NOV-2002", "holiday"); - - lh.addStaticHoliday ("11-NOV-2002", "holiday"); - - lh.addStaticHoliday ("28-NOV-2002", "holiday"); - - lh.addStaticHoliday ("23-DEC-2002", "holiday"); - - lh.addStaticHoliday ("24-DEC-2002", "holiday"); - - lh.addStaticHoliday ("25-DEC-2002", "holiday"); - - lh.addStaticHoliday ("26-DEC-2002", "holiday"); - - lh.addStaticHoliday ("27-DEC-2002", "holiday"); - - lh.addStaticHoliday ("01-JAN-2003", "holiday"); - - lh.addStaticHoliday ("02-JAN-2003", "holiday"); - - lh.addStaticHoliday ("03-JAN-2003", "holiday"); - - lh.addStaticHoliday ("15-JAN-2003", "holiday"); - - lh.addStaticHoliday ("20-JAN-2003", "holiday"); - - lh.addStaticHoliday ("11-FEB-2003", "holiday"); - - lh.addStaticHoliday ("17-FEB-2003", "holiday"); - - lh.addStaticHoliday ("21-MAR-2003", "holiday"); - - lh.addStaticHoliday ("18-APR-2003", "holiday"); - - lh.addStaticHoliday ("21-APR-2003", "holiday"); - - lh.addStaticHoliday ("29-APR-2003", "holiday"); - - lh.addStaticHoliday ("01-MAY-2003", "holiday"); - - lh.addStaticHoliday ("05-MAY-2003", "holiday"); - - lh.addStaticHoliday ("08-MAY-2003", "holiday"); - - lh.addStaticHoliday ("26-MAY-2003", "holiday"); - - lh.addStaticHoliday ("29-MAY-2003", "holiday"); - - lh.addStaticHoliday ("09-JUN-2003", "holiday"); - - lh.addStaticHoliday ("19-JUN-2003", "holiday"); - - lh.addStaticHoliday ("04-JUL-2003", "holiday"); - - lh.addStaticHoliday ("14-JUL-2003", "holiday"); - - lh.addStaticHoliday ("15-AUG-2003", "holiday"); - - lh.addStaticHoliday ("28-AUG-2003", "holiday"); - - lh.addStaticHoliday ("01-SEP-2003", "holiday"); - - lh.addStaticHoliday ("15-SEP-2003", "holiday"); - - lh.addStaticHoliday ("23-SEP-2003", "holiday"); - - lh.addStaticHoliday ("03-OCT-2003", "holiday"); - - lh.addStaticHoliday ("10-OCT-2003", "holiday"); - - lh.addStaticHoliday ("13-OCT-2003", "holiday"); - - lh.addStaticHoliday ("03-NOV-2003", "holiday"); - - lh.addStaticHoliday ("11-NOV-2003", "holiday"); - - lh.addStaticHoliday ("24-NOV-2003", "holiday"); - - lh.addStaticHoliday ("27-NOV-2003", "holiday"); - - lh.addStaticHoliday ("23-DEC-2003", "holiday"); - - lh.addStaticHoliday ("24-DEC-2003", "holiday"); - - lh.addStaticHoliday ("25-DEC-2003", "holiday"); - - lh.addStaticHoliday ("26-DEC-2003", "holiday"); - - lh.addStaticHoliday ("01-JAN-2004", "holiday"); - - lh.addStaticHoliday ("02-JAN-2004", "holiday"); - - lh.addStaticHoliday ("15-JAN-2004", "holiday"); - - lh.addStaticHoliday ("19-JAN-2004", "holiday"); - - lh.addStaticHoliday ("11-FEB-2004", "holiday"); - - lh.addStaticHoliday ("16-FEB-2004", "holiday"); - - lh.addStaticHoliday ("22-MAR-2004", "holiday"); - - lh.addStaticHoliday ("09-APR-2004", "holiday"); - - lh.addStaticHoliday ("12-APR-2004", "holiday"); - - lh.addStaticHoliday ("29-APR-2004", "holiday"); - - lh.addStaticHoliday ("03-MAY-2004", "holiday"); - - lh.addStaticHoliday ("04-MAY-2004", "holiday"); - - lh.addStaticHoliday ("05-MAY-2004", "holiday"); - - lh.addStaticHoliday ("20-MAY-2004", "holiday"); - - lh.addStaticHoliday ("31-MAY-2004", "holiday"); - - lh.addStaticHoliday ("10-JUN-2004", "holiday"); - - lh.addStaticHoliday ("05-JUL-2004", "holiday"); - - lh.addStaticHoliday ("14-JUL-2004", "holiday"); - - lh.addStaticHoliday ("06-SEP-2004", "holiday"); - - lh.addStaticHoliday ("15-SEP-2004", "holiday"); - - lh.addStaticHoliday ("23-SEP-2004", "holiday"); - - lh.addStaticHoliday ("11-OCT-2004", "holiday"); - - lh.addStaticHoliday ("01-NOV-2004", "holiday"); - - lh.addStaticHoliday ("03-NOV-2004", "holiday"); - - lh.addStaticHoliday ("11-NOV-2004", "holiday"); - - lh.addStaticHoliday ("23-NOV-2004", "holiday"); - - lh.addStaticHoliday ("25-NOV-2004", "holiday"); - - lh.addStaticHoliday ("23-DEC-2004", "holiday"); - - lh.addStaticHoliday ("24-DEC-2004", "holiday"); - - lh.addStaticHoliday ("27-DEC-2004", "holiday"); - - lh.addStaticHoliday ("28-DEC-2004", "holiday"); - - lh.addStaticHoliday ("03-JAN-2005", "holiday"); - - lh.addStaticHoliday ("17-JAN-2005", "holiday"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/XEUHoliday.java b/org/drip/analytics/holset/XEUHoliday.java deleted file mode 100644 index 4b80d0b..0000000 --- a/org/drip/analytics/holset/XEUHoliday.java +++ /dev/null @@ -1,581 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class XEUHoliday implements org.drip.analytics.holset.LocationHoliday { - public XEUHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "XEU"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1997", "New Years Day"); - - lh.addStaticHoliday ("28-MAR-1997", "Good Friday"); - - lh.addStaticHoliday ("31-MAR-1997", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1997", "Labour Day"); - - lh.addStaticHoliday ("08-MAY-1997", "Ascension Day"); - - lh.addStaticHoliday ("19-MAY-1997", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-1997", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-1997", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-1997", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1998", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-1998", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-1998", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-1999", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-1999", "Whit Monday"); - - lh.addStaticHoliday ("01-NOV-1999", "All Saints Day"); - - lh.addStaticHoliday ("03-JAN-2000", "New Years Day Observed"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2000", "Labour Day"); - - lh.addStaticHoliday ("01-JUN-2000", "Ascension Day"); - - lh.addStaticHoliday ("12-JUN-2000", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2000", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2000", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2001", "Labour Day"); - - lh.addStaticHoliday ("24-MAY-2001", "Ascension Day"); - - lh.addStaticHoliday ("04-JUN-2001", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2001", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2001", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2002", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2002", "Ascension Day"); - - lh.addStaticHoliday ("20-MAY-2002", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2002", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2002", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2003", "Ascension Day"); - - lh.addStaticHoliday ("09-JUN-2003", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2003", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("20-MAY-2004", "Ascension Day"); - - lh.addStaticHoliday ("31-MAY-2004", "Whit Monday"); - - lh.addStaticHoliday ("01-NOV-2004", "All Saints Day"); - - lh.addStaticHoliday ("03-JAN-2005", "New Years Day Observed"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2005", "Ascension Day"); - - lh.addStaticHoliday ("16-MAY-2005", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2005", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2005", "All Saints Day"); - - lh.addStaticHoliday ("26-DEC-2005", "St. Stephens Day"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2006", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2006", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2006", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2006", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2006", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2007", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2007", "Ascension Day"); - - lh.addStaticHoliday ("28-MAY-2007", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2007", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2007", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2008", "Labour Day"); - - lh.addStaticHoliday ("12-MAY-2008", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2008", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2009", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2009", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-2009", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-2010", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-2010", "Whit Monday"); - - lh.addStaticHoliday ("01-NOV-2010", "All Saints Day"); - - lh.addStaticHoliday ("03-JAN-2011", "New Years Day Observed"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("02-JUN-2011", "Ascension Day"); - - lh.addStaticHoliday ("13-JUN-2011", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2011", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2011", "All Saints Day"); - - lh.addStaticHoliday ("26-DEC-2011", "St. Stephens Day"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2012", "Labour Day"); - - lh.addStaticHoliday ("17-MAY-2012", "Ascension Day"); - - lh.addStaticHoliday ("28-MAY-2012", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2012", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2012", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2013", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2013", "Ascension Day"); - - lh.addStaticHoliday ("20-MAY-2013", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2013", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2013", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2014", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2014", "Ascension Day"); - - lh.addStaticHoliday ("09-JUN-2014", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2014", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2015", "Labour Day"); - - lh.addStaticHoliday ("14-MAY-2015", "Ascension Day"); - - lh.addStaticHoliday ("25-MAY-2015", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("05-MAY-2016", "Ascension Day"); - - lh.addStaticHoliday ("16-MAY-2016", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2016", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2016", "All Saints Day"); - - lh.addStaticHoliday ("26-DEC-2016", "St. Stephens Day"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2017", "Labour Day"); - - lh.addStaticHoliday ("25-MAY-2017", "Ascension Day"); - - lh.addStaticHoliday ("05-JUN-2017", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2017", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2017", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2018", "Labour Day"); - - lh.addStaticHoliday ("10-MAY-2018", "Ascension Day"); - - lh.addStaticHoliday ("21-MAY-2018", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2018", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2018", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "Labour Day"); - - lh.addStaticHoliday ("30-MAY-2019", "Ascension Day"); - - lh.addStaticHoliday ("10-JUN-2019", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2019", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2019", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2020", "Labour Day"); - - lh.addStaticHoliday ("21-MAY-2020", "Ascension Day"); - - lh.addStaticHoliday ("01-JUN-2020", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("13-MAY-2021", "Ascension Day"); - - lh.addStaticHoliday ("24-MAY-2021", "Whit Monday"); - - lh.addStaticHoliday ("01-NOV-2021", "All Saints Day"); - - lh.addStaticHoliday ("03-JAN-2022", "New Years Day Observed"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2022", "Easter Monday"); - - lh.addStaticHoliday ("26-MAY-2022", "Ascension Day"); - - lh.addStaticHoliday ("06-JUN-2022", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2022", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2022", "All Saints Day"); - - lh.addStaticHoliday ("26-DEC-2022", "St. Stephens Day"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2023", "Labour Day"); - - lh.addStaticHoliday ("18-MAY-2023", "Ascension Day"); - - lh.addStaticHoliday ("29-MAY-2023", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2023", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2023", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2024", "Labour Day"); - - lh.addStaticHoliday ("09-MAY-2024", "Ascension Day"); - - lh.addStaticHoliday ("20-MAY-2024", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2024", "Assumption Day"); - - lh.addStaticHoliday ("01-NOV-2024", "All Saints Day"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2025", "Labour Day"); - - lh.addStaticHoliday ("29-MAY-2025", "Ascension Day"); - - lh.addStaticHoliday ("09-JUN-2025", "Whit Monday"); - - lh.addStaticHoliday ("15-AUG-2025", "Assumption Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "St. Stephens Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2026", "Labour Day"); - - lh.addStaticHoliday ("14-MAY-2026", "Ascension Day"); - - lh.addStaticHoliday ("25-MAY-2026", "Whit Monday"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("06-MAY-2027", "Ascension Day"); - - lh.addStaticHoliday ("17-MAY-2027", "Whit Monday"); - - lh.addStaticHoliday ("01-NOV-2027", "All Saints Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/ZALHoliday.java b/org/drip/analytics/holset/ZALHoliday.java deleted file mode 100644 index 71932ff..0000000 --- a/org/drip/analytics/holset/ZALHoliday.java +++ /dev/null @@ -1,131 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class ZALHoliday implements org.drip.analytics.holset.LocationHoliday { - public ZALHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "ZAL"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-APR-1994", "Good Friday"); - - lh.addStaticHoliday ("06-APR-1994", "Founders Day"); - - lh.addStaticHoliday ("12-MAY-1994", "Ascension day"); - - lh.addStaticHoliday ("31-MAY-1994", "Republic Day"); - - lh.addStaticHoliday ("10-OCT-1994", "Kruger Day"); - - lh.addStaticHoliday ("16-DEC-1994", "Day of the Vow"); - - lh.addStaticHoliday ("26-DEC-1994", "Day of Goodwill"); - - lh.addStaticHoliday ("01-JAN-1995", ""); - - lh.addStaticHoliday ("04-APR-1995", "Easter Monday"); - - lh.addStaticHoliday ("06-APR-1995", "Founders Day"); - - lh.addStaticHoliday ("14-APR-1995", "Good Friday"); - - lh.addStaticHoliday ("17-APR-1995", "Easter Monday"); - - lh.addStaticHoliday ("27-APR-1995", ""); - - lh.addStaticHoliday ("01-MAY-1995", "Workers day"); - - lh.addStaticHoliday ("25-MAY-1995", "Ascension day"); - - lh.addStaticHoliday ("31-MAY-1995", "Republic Day"); - - lh.addStaticHoliday ("16-JUN-1995", ""); - - lh.addStaticHoliday ("09-AUG-1995", ""); - - lh.addStaticHoliday ("24-SEP-1995", ""); - - lh.addStaticHoliday ("10-OCT-1995", "Kruger Day"); - - lh.addStaticHoliday ("16-DEC-1995", ""); - - lh.addStaticHoliday ("25-DEC-1995", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-1995", "Day of Goodwill"); - - lh.addStaticHoliday ("01-JAN-1996", ""); - - lh.addStaticHoliday ("21-MAR-1996", ""); - - lh.addStaticHoliday ("05-APR-1996", ""); - - lh.addStaticHoliday ("08-APR-1996", ""); - - lh.addStaticHoliday ("27-APR-1996", ""); - - lh.addStaticHoliday ("01-MAY-1996", ""); - - lh.addStaticHoliday ("16-JUN-1996", ""); - - lh.addStaticHoliday ("17-JUN-1996", ""); - - lh.addStaticHoliday ("09-AUG-1996", ""); - - lh.addStaticHoliday ("24-SEP-1996", ""); - - lh.addStaticHoliday ("16-DEC-1996", ""); - - lh.addStaticHoliday ("25-DEC-1996", ""); - - lh.addStaticHoliday ("26-DEC-1996", ""); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/ZARHoliday.java b/org/drip/analytics/holset/ZARHoliday.java deleted file mode 100644 index c02f285..0000000 --- a/org/drip/analytics/holset/ZARHoliday.java +++ /dev/null @@ -1,701 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class ZARHoliday implements org.drip.analytics.holset.LocationHoliday { - public ZARHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "ZAR"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("13-APR-1998", "Family Day"); - - lh.addStaticHoliday ("27-APR-1998", "Freedom Day"); - - lh.addStaticHoliday ("01-MAY-1998", "Workers Day"); - - lh.addStaticHoliday ("16-JUN-1998", "Youths Day"); - - lh.addStaticHoliday ("10-AUG-1998", "National Womens Day Observed"); - - lh.addStaticHoliday ("24-SEP-1998", "Heritage Day"); - - lh.addStaticHoliday ("16-DEC-1998", "Day of Reconciliation"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("22-MAR-1999", "Human Rights Day Observed"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-APR-1999", "Family Day"); - - lh.addStaticHoliday ("27-APR-1999", "Freedom Day"); - - lh.addStaticHoliday ("16-JUN-1999", "Youths Day"); - - lh.addStaticHoliday ("09-AUG-1999", "National Womens Day"); - - lh.addStaticHoliday ("24-SEP-1999", "Heritage Day"); - - lh.addStaticHoliday ("16-DEC-1999", "Day of Reconciliation"); - - lh.addStaticHoliday ("27-DEC-1999", "Day of Goodwill Observed"); - - lh.addStaticHoliday ("21-MAR-2000", "Human Rights Day"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2000", "Family Day"); - - lh.addStaticHoliday ("27-APR-2000", "Freedom Day"); - - lh.addStaticHoliday ("01-MAY-2000", "Workers Day"); - - lh.addStaticHoliday ("16-JUN-2000", "Youths Day"); - - lh.addStaticHoliday ("09-AUG-2000", "National Womens Day"); - - lh.addStaticHoliday ("25-SEP-2000", "Heritage Day Observed"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Day of Goodwill"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2001", "Human Rights Day"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Family Day"); - - lh.addStaticHoliday ("27-APR-2001", "Freedom Day"); - - lh.addStaticHoliday ("01-MAY-2001", "Workers Day"); - - lh.addStaticHoliday ("09-AUG-2001", "National Womens Day"); - - lh.addStaticHoliday ("24-SEP-2001", "Heritage Day"); - - lh.addStaticHoliday ("17-DEC-2001", "Day of Reconciliation Observed"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Day of Goodwill"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2002", "Human Rights Day"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2002", "Family Day"); - - lh.addStaticHoliday ("01-MAY-2002", "Workers Day"); - - lh.addStaticHoliday ("17-JUN-2002", "Youths Day Observed"); - - lh.addStaticHoliday ("09-AUG-2002", "National Womens Day"); - - lh.addStaticHoliday ("24-SEP-2002", "Heritage Day"); - - lh.addStaticHoliday ("16-DEC-2002", "Day of Reconciliation"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Day of Goodwill"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2003", "Human Rights Day"); - - lh.addStaticHoliday ("18-APR-2003", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2003", "Family Day"); - - lh.addStaticHoliday ("28-APR-2003", "Freedom Day Observed"); - - lh.addStaticHoliday ("01-MAY-2003", "Workers Day"); - - lh.addStaticHoliday ("16-JUN-2003", "Youths Day"); - - lh.addStaticHoliday ("24-SEP-2003", "Heritage Day"); - - lh.addStaticHoliday ("16-DEC-2003", "Day of Reconciliation"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Day of Goodwill"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("22-MAR-2004", "Human Rights Day Observed"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2004", "Family Day"); - - lh.addStaticHoliday ("27-APR-2004", "Freedom Day"); - - lh.addStaticHoliday ("16-JUN-2004", "Youths Day"); - - lh.addStaticHoliday ("09-AUG-2004", "National Womens Day"); - - lh.addStaticHoliday ("24-SEP-2004", "Heritage Day"); - - lh.addStaticHoliday ("16-DEC-2004", "Day of Reconciliation"); - - lh.addStaticHoliday ("27-DEC-2004", "Day of Goodwill Observed"); - - lh.addStaticHoliday ("21-MAR-2005", "Human Rights Day"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2005", "Family Day"); - - lh.addStaticHoliday ("27-APR-2005", "Freedom Day"); - - lh.addStaticHoliday ("02-MAY-2005", "Workers Day Observed"); - - lh.addStaticHoliday ("16-JUN-2005", "Youths Day"); - - lh.addStaticHoliday ("09-AUG-2005", "National Womens Day"); - - lh.addStaticHoliday ("16-DEC-2005", "Day of Reconciliation"); - - lh.addStaticHoliday ("26-DEC-2005", "Day of Goodwill"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("21-MAR-2006", "Human Rights Day"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2006", "Family Day"); - - lh.addStaticHoliday ("27-APR-2006", "Freedom Day"); - - lh.addStaticHoliday ("01-MAY-2006", "Workers Day"); - - lh.addStaticHoliday ("16-JUN-2006", "Youths Day"); - - lh.addStaticHoliday ("09-AUG-2006", "National Womens Day"); - - lh.addStaticHoliday ("25-SEP-2006", "Heritage Day Observed"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Day of Goodwill"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2007", "Human Rights Day"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Family Day"); - - lh.addStaticHoliday ("27-APR-2007", "Freedom Day"); - - lh.addStaticHoliday ("01-MAY-2007", "Workers Day"); - - lh.addStaticHoliday ("09-AUG-2007", "National Womens Day"); - - lh.addStaticHoliday ("24-SEP-2007", "Heritage Day"); - - lh.addStaticHoliday ("17-DEC-2007", "Day of Reconciliation Observed"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Day of Goodwill"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2008", "Human Rights Day"); - - lh.addStaticHoliday ("24-MAR-2008", "Family Day"); - - lh.addStaticHoliday ("28-APR-2008", "Freedom Day Observed"); - - lh.addStaticHoliday ("01-MAY-2008", "Workers Day"); - - lh.addStaticHoliday ("16-JUN-2008", "Youths Day"); - - lh.addStaticHoliday ("24-SEP-2008", "Heritage Day"); - - lh.addStaticHoliday ("16-DEC-2008", "Day of Reconciliation"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Day of Goodwill"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2009", "Family Day"); - - lh.addStaticHoliday ("27-APR-2009", "Freedom Day"); - - lh.addStaticHoliday ("01-MAY-2009", "Workers Day"); - - lh.addStaticHoliday ("16-JUN-2009", "Youths Day"); - - lh.addStaticHoliday ("10-AUG-2009", "National Womens Day Observed"); - - lh.addStaticHoliday ("24-SEP-2009", "Heritage Day"); - - lh.addStaticHoliday ("16-DEC-2009", "Day of Reconciliation"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("22-MAR-2010", "Human Rights Day Observed"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2010", "Family Day"); - - lh.addStaticHoliday ("27-APR-2010", "Freedom Day"); - - lh.addStaticHoliday ("16-JUN-2010", "Youths Day"); - - lh.addStaticHoliday ("09-AUG-2010", "National Womens Day"); - - lh.addStaticHoliday ("24-SEP-2010", "Heritage Day"); - - lh.addStaticHoliday ("16-DEC-2010", "Day of Reconciliation"); - - lh.addStaticHoliday ("27-DEC-2010", "Day of Goodwill Observed"); - - lh.addStaticHoliday ("21-MAR-2011", "Human Rights Day"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Family Day"); - - lh.addStaticHoliday ("27-APR-2011", "Freedom Day"); - - lh.addStaticHoliday ("02-MAY-2011", "Workers Day Observed"); - - lh.addStaticHoliday ("16-JUN-2011", "Youths Day"); - - lh.addStaticHoliday ("09-AUG-2011", "National Womens Day"); - - lh.addStaticHoliday ("16-DEC-2011", "Day of Reconciliation"); - - lh.addStaticHoliday ("26-DEC-2011", "Day of Goodwill"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("21-MAR-2012", "Human Rights Day"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2012", "Family Day"); - - lh.addStaticHoliday ("27-APR-2012", "Freedom Day"); - - lh.addStaticHoliday ("01-MAY-2012", "Workers Day"); - - lh.addStaticHoliday ("09-AUG-2012", "National Womens Day"); - - lh.addStaticHoliday ("24-SEP-2012", "Heritage Day"); - - lh.addStaticHoliday ("17-DEC-2012", "Day of Reconciliation Observed"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Day of Goodwill"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2013", "Human Rights Day"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2013", "Family Day"); - - lh.addStaticHoliday ("01-MAY-2013", "Workers Day"); - - lh.addStaticHoliday ("17-JUN-2013", "Youths Day Observed"); - - lh.addStaticHoliday ("09-AUG-2013", "National Womens Day"); - - lh.addStaticHoliday ("24-SEP-2013", "Heritage Day"); - - lh.addStaticHoliday ("16-DEC-2013", "Day of Reconciliation"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Day of Goodwill"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2014", "Human Rights Day"); - - lh.addStaticHoliday ("18-APR-2014", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2014", "Family Day"); - - lh.addStaticHoliday ("28-APR-2014", "Freedom Day Observed"); - - lh.addStaticHoliday ("01-MAY-2014", "Workers Day"); - - lh.addStaticHoliday ("16-JUN-2014", "Youths Day"); - - lh.addStaticHoliday ("24-SEP-2014", "Heritage Day"); - - lh.addStaticHoliday ("16-DEC-2014", "Day of Reconciliation"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Day of Goodwill"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2015", "Family Day"); - - lh.addStaticHoliday ("27-APR-2015", "Freedom Day"); - - lh.addStaticHoliday ("01-MAY-2015", "Workers Day"); - - lh.addStaticHoliday ("16-JUN-2015", "Youths Day"); - - lh.addStaticHoliday ("10-AUG-2015", "National Womens Day Observed"); - - lh.addStaticHoliday ("24-SEP-2015", "Heritage Day"); - - lh.addStaticHoliday ("16-DEC-2015", "Day of Reconciliation"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2016", "Human Rights Day"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2016", "Family Day"); - - lh.addStaticHoliday ("27-APR-2016", "Freedom Day"); - - lh.addStaticHoliday ("02-MAY-2016", "Workers Day Observed"); - - lh.addStaticHoliday ("16-JUN-2016", "Youths Day"); - - lh.addStaticHoliday ("09-AUG-2016", "National Womens Day"); - - lh.addStaticHoliday ("16-DEC-2016", "Day of Reconciliation"); - - lh.addStaticHoliday ("26-DEC-2016", "Day of Goodwill"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("21-MAR-2017", "Human Rights Day"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2017", "Family Day"); - - lh.addStaticHoliday ("27-APR-2017", "Freedom Day"); - - lh.addStaticHoliday ("01-MAY-2017", "Workers Day"); - - lh.addStaticHoliday ("16-JUN-2017", "Youths Day"); - - lh.addStaticHoliday ("09-AUG-2017", "National Womens Day"); - - lh.addStaticHoliday ("25-SEP-2017", "Heritage Day Observed"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Day of Goodwill"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2018", "Human Rights Day"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2018", "Family Day"); - - lh.addStaticHoliday ("27-APR-2018", "Freedom Day"); - - lh.addStaticHoliday ("01-MAY-2018", "Workers Day"); - - lh.addStaticHoliday ("09-AUG-2018", "National Womens Day"); - - lh.addStaticHoliday ("24-SEP-2018", "Heritage Day"); - - lh.addStaticHoliday ("17-DEC-2018", "Day of Reconciliation Observed"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Day of Goodwill"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2019", "Human Rights Day"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2019", "Family Day"); - - lh.addStaticHoliday ("01-MAY-2019", "Workers Day"); - - lh.addStaticHoliday ("17-JUN-2019", "Youths Day Observed"); - - lh.addStaticHoliday ("09-AUG-2019", "National Womens Day"); - - lh.addStaticHoliday ("24-SEP-2019", "Heritage Day"); - - lh.addStaticHoliday ("16-DEC-2019", "Day of Reconciliation"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Day of Goodwill"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2020", "Family Day"); - - lh.addStaticHoliday ("27-APR-2020", "Freedom Day"); - - lh.addStaticHoliday ("01-MAY-2020", "Workers Day"); - - lh.addStaticHoliday ("16-JUN-2020", "Youths Day"); - - lh.addStaticHoliday ("10-AUG-2020", "National Womens Day Observed"); - - lh.addStaticHoliday ("24-SEP-2020", "Heritage Day"); - - lh.addStaticHoliday ("16-DEC-2020", "Day of Reconciliation"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("22-MAR-2021", "Human Rights Day Observed"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2021", "Family Day"); - - lh.addStaticHoliday ("27-APR-2021", "Freedom Day"); - - lh.addStaticHoliday ("16-JUN-2021", "Youths Day"); - - lh.addStaticHoliday ("09-AUG-2021", "National Womens Day"); - - lh.addStaticHoliday ("24-SEP-2021", "Heritage Day"); - - lh.addStaticHoliday ("16-DEC-2021", "Day of Reconciliation"); - - lh.addStaticHoliday ("27-DEC-2021", "Day of Goodwill Observed"); - - lh.addStaticHoliday ("21-MAR-2022", "Human Rights Day"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2022", "Family Day"); - - lh.addStaticHoliday ("27-APR-2022", "Freedom Day"); - - lh.addStaticHoliday ("02-MAY-2022", "Workers Day Observed"); - - lh.addStaticHoliday ("16-JUN-2022", "Youths Day"); - - lh.addStaticHoliday ("09-AUG-2022", "National Womens Day"); - - lh.addStaticHoliday ("16-DEC-2022", "Day of Reconciliation"); - - lh.addStaticHoliday ("26-DEC-2022", "Day of Goodwill"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("21-MAR-2023", "Human Rights Day"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2023", "Family Day"); - - lh.addStaticHoliday ("27-APR-2023", "Freedom Day"); - - lh.addStaticHoliday ("01-MAY-2023", "Workers Day"); - - lh.addStaticHoliday ("16-JUN-2023", "Youths Day"); - - lh.addStaticHoliday ("09-AUG-2023", "National Womens Day"); - - lh.addStaticHoliday ("25-SEP-2023", "Heritage Day Observed"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Day of Goodwill"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2024", "Human Rights Day"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2024", "Family Day"); - - lh.addStaticHoliday ("01-MAY-2024", "Workers Day"); - - lh.addStaticHoliday ("17-JUN-2024", "Youths Day Observed"); - - lh.addStaticHoliday ("09-AUG-2024", "National Womens Day"); - - lh.addStaticHoliday ("24-SEP-2024", "Heritage Day"); - - lh.addStaticHoliday ("16-DEC-2024", "Day of Reconciliation"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Day of Goodwill"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2025", "Human Rights Day"); - - lh.addStaticHoliday ("18-APR-2025", "Good Friday"); - - lh.addStaticHoliday ("21-APR-2025", "Family Day"); - - lh.addStaticHoliday ("28-APR-2025", "Freedom Day Observed"); - - lh.addStaticHoliday ("01-MAY-2025", "Workers Day"); - - lh.addStaticHoliday ("16-JUN-2025", "Youths Day"); - - lh.addStaticHoliday ("24-SEP-2025", "Heritage Day"); - - lh.addStaticHoliday ("16-DEC-2025", "Day of Reconciliation"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Day of Goodwill"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2026", "Family Day"); - - lh.addStaticHoliday ("27-APR-2026", "Freedom Day"); - - lh.addStaticHoliday ("01-MAY-2026", "Workers Day"); - - lh.addStaticHoliday ("16-JUN-2026", "Youths Day"); - - lh.addStaticHoliday ("10-AUG-2026", "National Womens Day Observed"); - - lh.addStaticHoliday ("24-SEP-2026", "Heritage Day"); - - lh.addStaticHoliday ("16-DEC-2026", "Day of Reconciliation"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("22-MAR-2027", "Human Rights Day Observed"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2027", "Family Day"); - - lh.addStaticHoliday ("27-APR-2027", "Freedom Day"); - - lh.addStaticHoliday ("16-JUN-2027", "Youths Day"); - - lh.addStaticHoliday ("09-AUG-2027", "National Womens Day"); - - lh.addStaticHoliday ("24-SEP-2027", "Heritage Day"); - - lh.addStaticHoliday ("16-DEC-2027", "Day of Reconciliation"); - - lh.addStaticHoliday ("27-DEC-2027", "Day of Goodwill Observed"); - - lh.addStaticHoliday ("21-MAR-2028", "Human Rights Day"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2028", "Family Day"); - - lh.addStaticHoliday ("27-APR-2028", "Freedom Day"); - - lh.addStaticHoliday ("01-MAY-2028", "Workers Day"); - - lh.addStaticHoliday ("16-JUN-2028", "Youths Day"); - - lh.addStaticHoliday ("09-AUG-2028", "National Womens Day"); - - lh.addStaticHoliday ("25-SEP-2028", "Heritage Day Observed"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Day of Goodwill"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/ZUSHoliday.java b/org/drip/analytics/holset/ZUSHoliday.java deleted file mode 100644 index cc13cc0..0000000 --- a/org/drip/analytics/holset/ZUSHoliday.java +++ /dev/null @@ -1,709 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class ZUSHoliday implements org.drip.analytics.holset.LocationHoliday { - public ZUSHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "ZUS"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("25-DEC-2005", ""); - - lh.addStaticHoliday ("01-JAN-2006", ""); - - lh.addStaticHoliday ("27-FEB-2006", ""); - - lh.addStaticHoliday ("28-FEB-2006", ""); - - lh.addStaticHoliday ("14-APR-2006", ""); - - lh.addStaticHoliday ("21-APR-2006", ""); - - lh.addStaticHoliday ("01-MAY-2006", ""); - - lh.addStaticHoliday ("15-JUN-2006", ""); - - lh.addStaticHoliday ("07-SEP-2006", ""); - - lh.addStaticHoliday ("12-OCT-2006", ""); - - lh.addStaticHoliday ("02-NOV-2006", ""); - - lh.addStaticHoliday ("15-NOV-2006", ""); - - lh.addStaticHoliday ("25-DEC-2006", ""); - - lh.addStaticHoliday ("01-JAN-2007", ""); - - lh.addStaticHoliday ("19-FEB-2007", ""); - - lh.addStaticHoliday ("20-FEB-2007", ""); - - lh.addStaticHoliday ("06-APR-2007", ""); - - lh.addStaticHoliday ("21-APR-2007", ""); - - lh.addStaticHoliday ("01-MAY-2007", ""); - - lh.addStaticHoliday ("07-JUN-2007", ""); - - lh.addStaticHoliday ("07-SEP-2007", ""); - - lh.addStaticHoliday ("12-OCT-2007", ""); - - lh.addStaticHoliday ("02-NOV-2007", ""); - - lh.addStaticHoliday ("15-NOV-2007", ""); - - lh.addStaticHoliday ("25-DEC-2007", ""); - - lh.addStaticHoliday ("01-JAN-2008", ""); - - lh.addStaticHoliday ("04-FEB-2008", ""); - - lh.addStaticHoliday ("05-FEB-2008", ""); - - lh.addStaticHoliday ("21-MAR-2008", ""); - - lh.addStaticHoliday ("21-APR-2008", ""); - - lh.addStaticHoliday ("01-MAY-2008", ""); - - lh.addStaticHoliday ("22-MAY-2008", ""); - - lh.addStaticHoliday ("07-SEP-2008", ""); - - lh.addStaticHoliday ("12-OCT-2008", ""); - - lh.addStaticHoliday ("02-NOV-2008", ""); - - lh.addStaticHoliday ("15-NOV-2008", ""); - - lh.addStaticHoliday ("25-DEC-2008", ""); - - lh.addStaticHoliday ("01-JAN-2009", ""); - - lh.addStaticHoliday ("23-FEB-2009", ""); - - lh.addStaticHoliday ("24-FEB-2009", ""); - - lh.addStaticHoliday ("10-APR-2009", ""); - - lh.addStaticHoliday ("21-APR-2009", ""); - - lh.addStaticHoliday ("01-MAY-2009", ""); - - lh.addStaticHoliday ("11-JUN-2009", ""); - - lh.addStaticHoliday ("07-SEP-2009", ""); - - lh.addStaticHoliday ("12-OCT-2009", ""); - - lh.addStaticHoliday ("02-NOV-2009", ""); - - lh.addStaticHoliday ("15-NOV-2009", ""); - - lh.addStaticHoliday ("25-DEC-2009", ""); - - lh.addStaticHoliday ("01-JAN-2010", ""); - - lh.addStaticHoliday ("15-FEB-2010", ""); - - lh.addStaticHoliday ("16-FEB-2010", ""); - - lh.addStaticHoliday ("02-APR-2010", ""); - - lh.addStaticHoliday ("21-APR-2010", ""); - - lh.addStaticHoliday ("01-MAY-2010", ""); - - lh.addStaticHoliday ("03-JUN-2010", ""); - - lh.addStaticHoliday ("07-SEP-2010", ""); - - lh.addStaticHoliday ("12-OCT-2010", ""); - - lh.addStaticHoliday ("02-NOV-2010", ""); - - lh.addStaticHoliday ("15-NOV-2010", ""); - - lh.addStaticHoliday ("25-DEC-2010", ""); - - lh.addStaticHoliday ("01-JAN-2011", ""); - - lh.addStaticHoliday ("07-MAR-2011", ""); - - lh.addStaticHoliday ("08-MAR-2011", ""); - - lh.addStaticHoliday ("21-APR-2011", ""); - - lh.addStaticHoliday ("22-APR-2011", ""); - - lh.addStaticHoliday ("01-MAY-2011", ""); - - lh.addStaticHoliday ("23-JUN-2011", ""); - - lh.addStaticHoliday ("07-SEP-2011", ""); - - lh.addStaticHoliday ("12-OCT-2011", ""); - - lh.addStaticHoliday ("02-NOV-2011", ""); - - lh.addStaticHoliday ("15-NOV-2011", ""); - - lh.addStaticHoliday ("25-DEC-2011", ""); - - lh.addStaticHoliday ("01-JAN-2012", ""); - - lh.addStaticHoliday ("20-FEB-2012", ""); - - lh.addStaticHoliday ("21-FEB-2012", ""); - - lh.addStaticHoliday ("06-APR-2012", ""); - - lh.addStaticHoliday ("21-APR-2012", ""); - - lh.addStaticHoliday ("01-MAY-2012", ""); - - lh.addStaticHoliday ("07-JUN-2012", ""); - - lh.addStaticHoliday ("07-SEP-2012", ""); - - lh.addStaticHoliday ("12-OCT-2012", ""); - - lh.addStaticHoliday ("02-NOV-2012", ""); - - lh.addStaticHoliday ("15-NOV-2012", ""); - - lh.addStaticHoliday ("25-DEC-2012", ""); - - lh.addStaticHoliday ("01-JAN-2013", ""); - - lh.addStaticHoliday ("11-FEB-2013", ""); - - lh.addStaticHoliday ("12-FEB-2013", ""); - - lh.addStaticHoliday ("29-MAR-2013", ""); - - lh.addStaticHoliday ("21-APR-2013", ""); - - lh.addStaticHoliday ("01-MAY-2013", ""); - - lh.addStaticHoliday ("30-MAY-2013", ""); - - lh.addStaticHoliday ("07-SEP-2013", ""); - - lh.addStaticHoliday ("12-OCT-2013", ""); - - lh.addStaticHoliday ("02-NOV-2013", ""); - - lh.addStaticHoliday ("15-NOV-2013", ""); - - lh.addStaticHoliday ("25-DEC-2013", ""); - - lh.addStaticHoliday ("01-JAN-2014", ""); - - lh.addStaticHoliday ("03-MAR-2014", ""); - - lh.addStaticHoliday ("04-MAR-2014", ""); - - lh.addStaticHoliday ("18-APR-2014", ""); - - lh.addStaticHoliday ("21-APR-2014", ""); - - lh.addStaticHoliday ("01-MAY-2014", ""); - - lh.addStaticHoliday ("19-JUN-2014", ""); - - lh.addStaticHoliday ("07-SEP-2014", ""); - - lh.addStaticHoliday ("12-OCT-2014", ""); - - lh.addStaticHoliday ("02-NOV-2014", ""); - - lh.addStaticHoliday ("15-NOV-2014", ""); - - lh.addStaticHoliday ("25-DEC-2014", ""); - - lh.addStaticHoliday ("01-JAN-2015", ""); - - lh.addStaticHoliday ("16-FEB-2015", ""); - - lh.addStaticHoliday ("17-FEB-2015", ""); - - lh.addStaticHoliday ("03-APR-2015", ""); - - lh.addStaticHoliday ("21-APR-2015", ""); - - lh.addStaticHoliday ("01-MAY-2015", ""); - - lh.addStaticHoliday ("04-JUN-2015", ""); - - lh.addStaticHoliday ("07-SEP-2015", ""); - - lh.addStaticHoliday ("12-OCT-2015", ""); - - lh.addStaticHoliday ("02-NOV-2015", ""); - - lh.addStaticHoliday ("15-NOV-2015", ""); - - lh.addStaticHoliday ("25-DEC-2015", ""); - - lh.addStaticHoliday ("01-JAN-2016", ""); - - lh.addStaticHoliday ("08-FEB-2016", ""); - - lh.addStaticHoliday ("09-FEB-2016", ""); - - lh.addStaticHoliday ("25-MAR-2016", ""); - - lh.addStaticHoliday ("21-APR-2016", ""); - - lh.addStaticHoliday ("01-MAY-2016", ""); - - lh.addStaticHoliday ("26-MAY-2016", ""); - - lh.addStaticHoliday ("07-SEP-2016", ""); - - lh.addStaticHoliday ("12-OCT-2016", ""); - - lh.addStaticHoliday ("02-NOV-2016", ""); - - lh.addStaticHoliday ("15-NOV-2016", ""); - - lh.addStaticHoliday ("25-DEC-2016", ""); - - lh.addStaticHoliday ("01-JAN-2017", ""); - - lh.addStaticHoliday ("27-FEB-2017", ""); - - lh.addStaticHoliday ("28-FEB-2017", ""); - - lh.addStaticHoliday ("14-APR-2017", ""); - - lh.addStaticHoliday ("21-APR-2017", ""); - - lh.addStaticHoliday ("01-MAY-2017", ""); - - lh.addStaticHoliday ("15-JUN-2017", ""); - - lh.addStaticHoliday ("07-SEP-2017", ""); - - lh.addStaticHoliday ("12-OCT-2017", ""); - - lh.addStaticHoliday ("02-NOV-2017", ""); - - lh.addStaticHoliday ("15-NOV-2017", ""); - - lh.addStaticHoliday ("25-DEC-2017", ""); - - lh.addStaticHoliday ("01-JAN-2018", ""); - - lh.addStaticHoliday ("12-FEB-2018", ""); - - lh.addStaticHoliday ("13-FEB-2018", ""); - - lh.addStaticHoliday ("30-MAR-2018", ""); - - lh.addStaticHoliday ("21-APR-2018", ""); - - lh.addStaticHoliday ("01-MAY-2018", ""); - - lh.addStaticHoliday ("31-MAY-2018", ""); - - lh.addStaticHoliday ("07-SEP-2018", ""); - - lh.addStaticHoliday ("12-OCT-2018", ""); - - lh.addStaticHoliday ("02-NOV-2018", ""); - - lh.addStaticHoliday ("15-NOV-2018", ""); - - lh.addStaticHoliday ("25-DEC-2018", ""); - - lh.addStaticHoliday ("01-JAN-2019", ""); - - lh.addStaticHoliday ("04-MAR-2019", ""); - - lh.addStaticHoliday ("05-MAR-2019", ""); - - lh.addStaticHoliday ("19-APR-2019", ""); - - lh.addStaticHoliday ("21-APR-2019", ""); - - lh.addStaticHoliday ("01-MAY-2019", ""); - - lh.addStaticHoliday ("20-JUN-2019", ""); - - lh.addStaticHoliday ("07-SEP-2019", ""); - - lh.addStaticHoliday ("12-OCT-2019", ""); - - lh.addStaticHoliday ("02-NOV-2019", ""); - - lh.addStaticHoliday ("15-NOV-2019", ""); - - lh.addStaticHoliday ("25-DEC-2019", ""); - - lh.addStaticHoliday ("01-JAN-2020", ""); - - lh.addStaticHoliday ("24-FEB-2020", ""); - - lh.addStaticHoliday ("25-FEB-2020", ""); - - lh.addStaticHoliday ("10-APR-2020", ""); - - lh.addStaticHoliday ("21-APR-2020", ""); - - lh.addStaticHoliday ("01-MAY-2020", ""); - - lh.addStaticHoliday ("11-JUN-2020", ""); - - lh.addStaticHoliday ("07-SEP-2020", ""); - - lh.addStaticHoliday ("12-OCT-2020", ""); - - lh.addStaticHoliday ("02-NOV-2020", ""); - - lh.addStaticHoliday ("15-NOV-2020", ""); - - lh.addStaticHoliday ("25-DEC-2020", ""); - - lh.addStaticHoliday ("01-JAN-2021", ""); - - lh.addStaticHoliday ("15-FEB-2021", ""); - - lh.addStaticHoliday ("16-FEB-2021", ""); - - lh.addStaticHoliday ("02-APR-2021", ""); - - lh.addStaticHoliday ("21-APR-2021", ""); - - lh.addStaticHoliday ("01-MAY-2021", ""); - - lh.addStaticHoliday ("03-JUN-2021", ""); - - lh.addStaticHoliday ("07-SEP-2021", ""); - - lh.addStaticHoliday ("12-OCT-2021", ""); - - lh.addStaticHoliday ("02-NOV-2021", ""); - - lh.addStaticHoliday ("15-NOV-2021", ""); - - lh.addStaticHoliday ("25-DEC-2021", ""); - - lh.addStaticHoliday ("01-JAN-2022", ""); - - lh.addStaticHoliday ("28-FEB-2022", ""); - - lh.addStaticHoliday ("01-MAR-2022", ""); - - lh.addStaticHoliday ("15-APR-2022", ""); - - lh.addStaticHoliday ("21-APR-2022", ""); - - lh.addStaticHoliday ("01-MAY-2022", ""); - - lh.addStaticHoliday ("16-JUN-2022", ""); - - lh.addStaticHoliday ("07-SEP-2022", ""); - - lh.addStaticHoliday ("12-OCT-2022", ""); - - lh.addStaticHoliday ("02-NOV-2022", ""); - - lh.addStaticHoliday ("15-NOV-2022", ""); - - lh.addStaticHoliday ("25-DEC-2022", ""); - - lh.addStaticHoliday ("01-JAN-2023", ""); - - lh.addStaticHoliday ("20-FEB-2023", ""); - - lh.addStaticHoliday ("21-FEB-2023", ""); - - lh.addStaticHoliday ("07-APR-2023", ""); - - lh.addStaticHoliday ("21-APR-2023", ""); - - lh.addStaticHoliday ("01-MAY-2023", ""); - - lh.addStaticHoliday ("08-JUN-2023", ""); - - lh.addStaticHoliday ("07-SEP-2023", ""); - - lh.addStaticHoliday ("12-OCT-2023", ""); - - lh.addStaticHoliday ("02-NOV-2023", ""); - - lh.addStaticHoliday ("15-NOV-2023", ""); - - lh.addStaticHoliday ("25-DEC-2023", ""); - - lh.addStaticHoliday ("01-JAN-2024", ""); - - lh.addStaticHoliday ("12-FEB-2024", ""); - - lh.addStaticHoliday ("13-FEB-2024", ""); - - lh.addStaticHoliday ("29-MAR-2024", ""); - - lh.addStaticHoliday ("21-APR-2024", ""); - - lh.addStaticHoliday ("01-MAY-2024", ""); - - lh.addStaticHoliday ("30-MAY-2024", ""); - - lh.addStaticHoliday ("07-SEP-2024", ""); - - lh.addStaticHoliday ("12-OCT-2024", ""); - - lh.addStaticHoliday ("02-NOV-2024", ""); - - lh.addStaticHoliday ("15-NOV-2024", ""); - - lh.addStaticHoliday ("25-DEC-2024", ""); - - lh.addStaticHoliday ("01-JAN-2025", ""); - - lh.addStaticHoliday ("03-MAR-2025", ""); - - lh.addStaticHoliday ("04-MAR-2025", ""); - - lh.addStaticHoliday ("18-APR-2025", ""); - - lh.addStaticHoliday ("21-APR-2025", ""); - - lh.addStaticHoliday ("01-MAY-2025", ""); - - lh.addStaticHoliday ("19-JUN-2025", ""); - - lh.addStaticHoliday ("07-SEP-2025", ""); - - lh.addStaticHoliday ("12-OCT-2025", ""); - - lh.addStaticHoliday ("02-NOV-2025", ""); - - lh.addStaticHoliday ("15-NOV-2025", ""); - - lh.addStaticHoliday ("25-DEC-2025", ""); - - lh.addStaticHoliday ("01-JAN-2026", ""); - - lh.addStaticHoliday ("16-FEB-2026", ""); - - lh.addStaticHoliday ("17-FEB-2026", ""); - - lh.addStaticHoliday ("03-APR-2026", ""); - - lh.addStaticHoliday ("21-APR-2026", ""); - - lh.addStaticHoliday ("01-MAY-2026", ""); - - lh.addStaticHoliday ("04-JUN-2026", ""); - - lh.addStaticHoliday ("07-SEP-2026", ""); - - lh.addStaticHoliday ("12-OCT-2026", ""); - - lh.addStaticHoliday ("02-NOV-2026", ""); - - lh.addStaticHoliday ("15-NOV-2026", ""); - - lh.addStaticHoliday ("25-DEC-2026", ""); - - lh.addStaticHoliday ("01-JAN-2027", ""); - - lh.addStaticHoliday ("08-FEB-2027", ""); - - lh.addStaticHoliday ("09-FEB-2027", ""); - - lh.addStaticHoliday ("26-MAR-2027", ""); - - lh.addStaticHoliday ("21-APR-2027", ""); - - lh.addStaticHoliday ("01-MAY-2027", ""); - - lh.addStaticHoliday ("27-MAY-2027", ""); - - lh.addStaticHoliday ("07-SEP-2027", ""); - - lh.addStaticHoliday ("12-OCT-2027", ""); - - lh.addStaticHoliday ("02-NOV-2027", ""); - - lh.addStaticHoliday ("15-NOV-2027", ""); - - lh.addStaticHoliday ("25-DEC-2027", ""); - - lh.addStaticHoliday ("01-JAN-2028", ""); - - lh.addStaticHoliday ("28-FEB-2028", ""); - - lh.addStaticHoliday ("29-FEB-2028", ""); - - lh.addStaticHoliday ("14-APR-2028", ""); - - lh.addStaticHoliday ("21-APR-2028", ""); - - lh.addStaticHoliday ("01-MAY-2028", ""); - - lh.addStaticHoliday ("15-JUN-2028", ""); - - lh.addStaticHoliday ("07-SEP-2028", ""); - - lh.addStaticHoliday ("12-OCT-2028", ""); - - lh.addStaticHoliday ("02-NOV-2028", ""); - - lh.addStaticHoliday ("15-NOV-2028", ""); - - lh.addStaticHoliday ("25-DEC-2028", ""); - - lh.addStaticHoliday ("01-JAN-2029", ""); - - lh.addStaticHoliday ("12-FEB-2029", ""); - - lh.addStaticHoliday ("13-FEB-2029", ""); - - lh.addStaticHoliday ("30-MAR-2029", ""); - - lh.addStaticHoliday ("21-APR-2029", ""); - - lh.addStaticHoliday ("01-MAY-2029", ""); - - lh.addStaticHoliday ("31-MAY-2029", ""); - - lh.addStaticHoliday ("07-SEP-2029", ""); - - lh.addStaticHoliday ("12-OCT-2029", ""); - - lh.addStaticHoliday ("02-NOV-2029", ""); - - lh.addStaticHoliday ("15-NOV-2029", ""); - - lh.addStaticHoliday ("25-DEC-2029", ""); - - lh.addStaticHoliday ("01-JAN-2030", ""); - - lh.addStaticHoliday ("04-MAR-2030", ""); - - lh.addStaticHoliday ("05-MAR-2030", ""); - - lh.addStaticHoliday ("19-APR-2030", ""); - - lh.addStaticHoliday ("21-APR-2030", ""); - - lh.addStaticHoliday ("01-MAY-2030", ""); - - lh.addStaticHoliday ("20-JUN-2030", ""); - - lh.addStaticHoliday ("07-SEP-2030", ""); - - lh.addStaticHoliday ("12-OCT-2030", ""); - - lh.addStaticHoliday ("02-NOV-2030", ""); - - lh.addStaticHoliday ("15-NOV-2030", ""); - - lh.addStaticHoliday ("25-DEC-2030", ""); - - lh.addStaticHoliday ("01-JAN-2031", ""); - - lh.addStaticHoliday ("24-FEB-2031", ""); - - lh.addStaticHoliday ("25-FEB-2031", ""); - - lh.addStaticHoliday ("11-APR-2031", ""); - - lh.addStaticHoliday ("21-APR-2031", ""); - - lh.addStaticHoliday ("01-MAY-2031", ""); - - lh.addStaticHoliday ("12-JUN-2031", ""); - - lh.addStaticHoliday ("07-SEP-2031", ""); - - lh.addStaticHoliday ("12-OCT-2031", ""); - - lh.addStaticHoliday ("02-NOV-2031", ""); - - lh.addStaticHoliday ("15-NOV-2031", ""); - - lh.addStaticHoliday ("25-DEC-2031", ""); - - lh.addStaticHoliday ("01-JAN-2032", ""); - - lh.addStaticHoliday ("09-FEB-2032", ""); - - lh.addStaticHoliday ("10-FEB-2032", ""); - - lh.addStaticHoliday ("26-MAR-2032", ""); - - lh.addStaticHoliday ("21-APR-2032", ""); - - lh.addStaticHoliday ("01-MAY-2032", ""); - - lh.addStaticHoliday ("27-MAY-2032", ""); - - lh.addStaticHoliday ("07-SEP-2032", ""); - - lh.addStaticHoliday ("12-OCT-2032", ""); - - lh.addStaticHoliday ("02-NOV-2032", ""); - - lh.addStaticHoliday ("15-NOV-2032", ""); - - lh.addStaticHoliday ("25-DEC-2032", ""); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/holset/ZWDHoliday.java b/org/drip/analytics/holset/ZWDHoliday.java deleted file mode 100644 index 41c9a58..0000000 --- a/org/drip/analytics/holset/ZWDHoliday.java +++ /dev/null @@ -1,633 +0,0 @@ - -package org.drip.analytics.holset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Fri Jan 11 19:54:07 EST 2013 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 Lakshmi Krishnamurthy - * - * This file is part of CreditAnalytics, a free-software/open-source library for - * fixed income analysts and developers - http://www.credit-trader.org - * - * CreditAnalytics is a free, full featured, fixed income credit analytics library, developed with a special focus - * towards the needs of the bonds and credit products community. - * - * 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. - */ - -public class ZWDHoliday implements org.drip.analytics.holset.LocationHoliday { - public ZWDHoliday() - { - } - - public java.lang.String getHolidayLoc() - { - return "ZWD"; - } - - public org.drip.analytics.eventday.Locale getHolidaySet() - { - org.drip.analytics.eventday.Locale lh = new - org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday ("01-JAN-1998", "New Years Day"); - - lh.addStaticHoliday ("10-APR-1998", "Good Friday"); - - lh.addStaticHoliday ("13-APR-1998", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-1998", "Workers Day"); - - lh.addStaticHoliday ("25-MAY-1998", "Africa Day"); - - lh.addStaticHoliday ("11-AUG-1998", "Heroes Day"); - - lh.addStaticHoliday ("12-AUG-1998", "Defense Forces Day"); - - lh.addStaticHoliday ("22-DEC-1998", "Unity Day"); - - lh.addStaticHoliday ("25-DEC-1998", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-1999", "New Years Day"); - - lh.addStaticHoliday ("02-APR-1999", "Good Friday"); - - lh.addStaticHoliday ("05-APR-1999", "Easter Monday"); - - lh.addStaticHoliday ("19-APR-1999", "Independence Day Observed"); - - lh.addStaticHoliday ("25-MAY-1999", "Africa Day"); - - lh.addStaticHoliday ("11-AUG-1999", "Heroes Day"); - - lh.addStaticHoliday ("12-AUG-1999", "Defense Forces Day"); - - lh.addStaticHoliday ("22-DEC-1999", "Unity Day"); - - lh.addStaticHoliday ("27-DEC-1999", "Boxing Day Observed"); - - lh.addStaticHoliday ("18-APR-2000", "Independence Day"); - - lh.addStaticHoliday ("21-APR-2000", "Good Friday"); - - lh.addStaticHoliday ("24-APR-2000", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2000", "Workers Day"); - - lh.addStaticHoliday ("25-MAY-2000", "Africa Day"); - - lh.addStaticHoliday ("11-AUG-2000", "Heroes Day"); - - lh.addStaticHoliday ("22-DEC-2000", "Unity Day"); - - lh.addStaticHoliday ("25-DEC-2000", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2000", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2001", "New Years Day"); - - lh.addStaticHoliday ("13-APR-2001", "Good Friday"); - - lh.addStaticHoliday ("16-APR-2001", "Easter Monday"); - - lh.addStaticHoliday ("18-APR-2001", "Independence Day"); - - lh.addStaticHoliday ("01-MAY-2001", "Workers Day"); - - lh.addStaticHoliday ("25-MAY-2001", "Africa Day"); - - lh.addStaticHoliday ("13-AUG-2001", "Defense Forces Day Observed"); - - lh.addStaticHoliday ("25-DEC-2001", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2001", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2002", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2002", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2002", "Easter Monday"); - - lh.addStaticHoliday ("18-APR-2002", "Independence Day"); - - lh.addStaticHoliday ("01-MAY-2002", "Workers Day"); - - lh.addStaticHoliday ("12-AUG-2002", "Defense Forces Day"); - - lh.addStaticHoliday ("23-DEC-2002", "Unity Day Observed"); - - lh.addStaticHoliday ("25-DEC-2002", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2002", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2003", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2003", "Independence Day"); - - lh.addStaticHoliday ("21-APR-2003", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2003", "Workers Day"); - - lh.addStaticHoliday ("26-MAY-2003", "Africa Day Observed"); - - lh.addStaticHoliday ("11-AUG-2003", "Heroes Day"); - - lh.addStaticHoliday ("12-AUG-2003", "Defense Forces Day"); - - lh.addStaticHoliday ("22-DEC-2003", "Unity Day"); - - lh.addStaticHoliday ("25-DEC-2003", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2003", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2004", "New Years Day"); - - lh.addStaticHoliday ("09-APR-2004", "Good Friday"); - - lh.addStaticHoliday ("12-APR-2004", "Easter Monday"); - - lh.addStaticHoliday ("19-APR-2004", "Independence Day Observed"); - - lh.addStaticHoliday ("25-MAY-2004", "Africa Day"); - - lh.addStaticHoliday ("11-AUG-2004", "Heroes Day"); - - lh.addStaticHoliday ("12-AUG-2004", "Defense Forces Day"); - - lh.addStaticHoliday ("22-DEC-2004", "Unity Day"); - - lh.addStaticHoliday ("27-DEC-2004", "Boxing Day Observed"); - - lh.addStaticHoliday ("25-MAR-2005", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2005", "Easter Monday"); - - lh.addStaticHoliday ("18-APR-2005", "Independence Day"); - - lh.addStaticHoliday ("02-MAY-2005", "Workers Day Observed"); - - lh.addStaticHoliday ("25-MAY-2005", "Africa Day"); - - lh.addStaticHoliday ("11-AUG-2005", "Heroes Day"); - - lh.addStaticHoliday ("12-AUG-2005", "Defense Forces Day"); - - lh.addStaticHoliday ("22-DEC-2005", "Unity Day"); - - lh.addStaticHoliday ("26-DEC-2005", "Boxing Day"); - - lh.addStaticHoliday ("02-JAN-2006", "New Years Day Observed"); - - lh.addStaticHoliday ("14-APR-2006", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2006", "Easter Monday"); - - lh.addStaticHoliday ("18-APR-2006", "Independence Day"); - - lh.addStaticHoliday ("01-MAY-2006", "Workers Day"); - - lh.addStaticHoliday ("25-MAY-2006", "Africa Day"); - - lh.addStaticHoliday ("11-AUG-2006", "Heroes Day"); - - lh.addStaticHoliday ("22-DEC-2006", "Unity Day"); - - lh.addStaticHoliday ("25-DEC-2006", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2006", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2007", "New Years Day"); - - lh.addStaticHoliday ("06-APR-2007", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2007", "Easter Monday"); - - lh.addStaticHoliday ("18-APR-2007", "Independence Day"); - - lh.addStaticHoliday ("01-MAY-2007", "Workers Day"); - - lh.addStaticHoliday ("25-MAY-2007", "Africa Day"); - - lh.addStaticHoliday ("13-AUG-2007", "Defense Forces Day Observed"); - - lh.addStaticHoliday ("25-DEC-2007", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2007", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2008", "New Years Day"); - - lh.addStaticHoliday ("21-MAR-2008", "Good Friday"); - - lh.addStaticHoliday ("24-MAR-2008", "Easter Monday"); - - lh.addStaticHoliday ("18-APR-2008", "Independence Day"); - - lh.addStaticHoliday ("01-MAY-2008", "Workers Day"); - - lh.addStaticHoliday ("26-MAY-2008", "Africa Day Observed"); - - lh.addStaticHoliday ("11-AUG-2008", "Heroes Day"); - - lh.addStaticHoliday ("12-AUG-2008", "Defense Forces Day"); - - lh.addStaticHoliday ("22-DEC-2008", "Unity Day"); - - lh.addStaticHoliday ("25-DEC-2008", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2008", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2009", "New Years Day"); - - lh.addStaticHoliday ("10-APR-2009", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2009", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2009", "Workers Day"); - - lh.addStaticHoliday ("25-MAY-2009", "Africa Day"); - - lh.addStaticHoliday ("11-AUG-2009", "Heroes Day"); - - lh.addStaticHoliday ("12-AUG-2009", "Defense Forces Day"); - - lh.addStaticHoliday ("22-DEC-2009", "Unity Day"); - - lh.addStaticHoliday ("25-DEC-2009", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2010", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2010", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2010", "Easter Monday"); - - lh.addStaticHoliday ("19-APR-2010", "Independence Day Observed"); - - lh.addStaticHoliday ("25-MAY-2010", "Africa Day"); - - lh.addStaticHoliday ("11-AUG-2010", "Heroes Day"); - - lh.addStaticHoliday ("12-AUG-2010", "Defense Forces Day"); - - lh.addStaticHoliday ("22-DEC-2010", "Unity Day"); - - lh.addStaticHoliday ("27-DEC-2010", "Boxing Day Observed"); - - lh.addStaticHoliday ("18-APR-2011", "Independence Day"); - - lh.addStaticHoliday ("22-APR-2011", "Good Friday"); - - lh.addStaticHoliday ("25-APR-2011", "Easter Monday"); - - lh.addStaticHoliday ("02-MAY-2011", "Workers Day Observed"); - - lh.addStaticHoliday ("25-MAY-2011", "Africa Day"); - - lh.addStaticHoliday ("11-AUG-2011", "Heroes Day"); - - lh.addStaticHoliday ("12-AUG-2011", "Defense Forces Day"); - - lh.addStaticHoliday ("22-DEC-2011", "Unity Day"); - - lh.addStaticHoliday ("26-DEC-2011", "Boxing Day"); - - lh.addStaticHoliday ("02-JAN-2012", "New Years Day Observed"); - - lh.addStaticHoliday ("06-APR-2012", "Good Friday"); - - lh.addStaticHoliday ("09-APR-2012", "Easter Monday"); - - lh.addStaticHoliday ("18-APR-2012", "Independence Day"); - - lh.addStaticHoliday ("01-MAY-2012", "Workers Day"); - - lh.addStaticHoliday ("25-MAY-2012", "Africa Day"); - - lh.addStaticHoliday ("13-AUG-2012", "Defense Forces Day Observed"); - - lh.addStaticHoliday ("25-DEC-2012", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2012", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2013", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2013", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2013", "Easter Monday"); - - lh.addStaticHoliday ("18-APR-2013", "Independence Day"); - - lh.addStaticHoliday ("01-MAY-2013", "Workers Day"); - - lh.addStaticHoliday ("12-AUG-2013", "Defense Forces Day"); - - lh.addStaticHoliday ("23-DEC-2013", "Unity Day Observed"); - - lh.addStaticHoliday ("25-DEC-2013", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2013", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2014", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2014", "Independence Day"); - - lh.addStaticHoliday ("21-APR-2014", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2014", "Workers Day"); - - lh.addStaticHoliday ("26-MAY-2014", "Africa Day Observed"); - - lh.addStaticHoliday ("11-AUG-2014", "Heroes Day"); - - lh.addStaticHoliday ("12-AUG-2014", "Defense Forces Day"); - - lh.addStaticHoliday ("22-DEC-2014", "Unity Day"); - - lh.addStaticHoliday ("25-DEC-2014", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2014", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2015", "New Years Day"); - - lh.addStaticHoliday ("03-APR-2015", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2015", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2015", "Workers Day"); - - lh.addStaticHoliday ("25-MAY-2015", "Africa Day"); - - lh.addStaticHoliday ("11-AUG-2015", "Heroes Day"); - - lh.addStaticHoliday ("12-AUG-2015", "Defense Forces Day"); - - lh.addStaticHoliday ("22-DEC-2015", "Unity Day"); - - lh.addStaticHoliday ("25-DEC-2015", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2016", "New Years Day"); - - lh.addStaticHoliday ("25-MAR-2016", "Good Friday"); - - lh.addStaticHoliday ("28-MAR-2016", "Easter Monday"); - - lh.addStaticHoliday ("18-APR-2016", "Independence Day"); - - lh.addStaticHoliday ("02-MAY-2016", "Workers Day Observed"); - - lh.addStaticHoliday ("25-MAY-2016", "Africa Day"); - - lh.addStaticHoliday ("11-AUG-2016", "Heroes Day"); - - lh.addStaticHoliday ("12-AUG-2016", "Defense Forces Day"); - - lh.addStaticHoliday ("22-DEC-2016", "Unity Day"); - - lh.addStaticHoliday ("26-DEC-2016", "Boxing Day"); - - lh.addStaticHoliday ("02-JAN-2017", "New Years Day Observed"); - - lh.addStaticHoliday ("14-APR-2017", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2017", "Easter Monday"); - - lh.addStaticHoliday ("18-APR-2017", "Independence Day"); - - lh.addStaticHoliday ("01-MAY-2017", "Workers Day"); - - lh.addStaticHoliday ("25-MAY-2017", "Africa Day"); - - lh.addStaticHoliday ("11-AUG-2017", "Heroes Day"); - - lh.addStaticHoliday ("22-DEC-2017", "Unity Day"); - - lh.addStaticHoliday ("25-DEC-2017", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2017", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2018", "New Years Day"); - - lh.addStaticHoliday ("30-MAR-2018", "Good Friday"); - - lh.addStaticHoliday ("02-APR-2018", "Easter Monday"); - - lh.addStaticHoliday ("18-APR-2018", "Independence Day"); - - lh.addStaticHoliday ("01-MAY-2018", "Workers Day"); - - lh.addStaticHoliday ("25-MAY-2018", "Africa Day"); - - lh.addStaticHoliday ("13-AUG-2018", "Defense Forces Day Observed"); - - lh.addStaticHoliday ("25-DEC-2018", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2018", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2019", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2019", "Independence Day"); - - lh.addStaticHoliday ("19-APR-2019", "Good Friday"); - - lh.addStaticHoliday ("22-APR-2019", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2019", "Workers Day"); - - lh.addStaticHoliday ("12-AUG-2019", "Defense Forces Day"); - - lh.addStaticHoliday ("23-DEC-2019", "Unity Day Observed"); - - lh.addStaticHoliday ("25-DEC-2019", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2019", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2020", "New Years Day"); - - lh.addStaticHoliday ("10-APR-2020", "Good Friday"); - - lh.addStaticHoliday ("13-APR-2020", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2020", "Workers Day"); - - lh.addStaticHoliday ("25-MAY-2020", "Africa Day"); - - lh.addStaticHoliday ("11-AUG-2020", "Heroes Day"); - - lh.addStaticHoliday ("12-AUG-2020", "Defense Forces Day"); - - lh.addStaticHoliday ("22-DEC-2020", "Unity Day"); - - lh.addStaticHoliday ("25-DEC-2020", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2021", "New Years Day"); - - lh.addStaticHoliday ("02-APR-2021", "Good Friday"); - - lh.addStaticHoliday ("05-APR-2021", "Easter Monday"); - - lh.addStaticHoliday ("19-APR-2021", "Independence Day Observed"); - - lh.addStaticHoliday ("25-MAY-2021", "Africa Day"); - - lh.addStaticHoliday ("11-AUG-2021", "Heroes Day"); - - lh.addStaticHoliday ("12-AUG-2021", "Defense Forces Day"); - - lh.addStaticHoliday ("22-DEC-2021", "Unity Day"); - - lh.addStaticHoliday ("27-DEC-2021", "Boxing Day Observed"); - - lh.addStaticHoliday ("15-APR-2022", "Good Friday"); - - lh.addStaticHoliday ("18-APR-2022", "Independence Day"); - - lh.addStaticHoliday ("02-MAY-2022", "Workers Day Observed"); - - lh.addStaticHoliday ("25-MAY-2022", "Africa Day"); - - lh.addStaticHoliday ("11-AUG-2022", "Heroes Day"); - - lh.addStaticHoliday ("12-AUG-2022", "Defense Forces Day"); - - lh.addStaticHoliday ("22-DEC-2022", "Unity Day"); - - lh.addStaticHoliday ("26-DEC-2022", "Boxing Day"); - - lh.addStaticHoliday ("02-JAN-2023", "New Years Day Observed"); - - lh.addStaticHoliday ("07-APR-2023", "Good Friday"); - - lh.addStaticHoliday ("10-APR-2023", "Easter Monday"); - - lh.addStaticHoliday ("18-APR-2023", "Independence Day"); - - lh.addStaticHoliday ("01-MAY-2023", "Workers Day"); - - lh.addStaticHoliday ("25-MAY-2023", "Africa Day"); - - lh.addStaticHoliday ("11-AUG-2023", "Heroes Day"); - - lh.addStaticHoliday ("22-DEC-2023", "Unity Day"); - - lh.addStaticHoliday ("25-DEC-2023", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2023", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2024", "New Years Day"); - - lh.addStaticHoliday ("29-MAR-2024", "Good Friday"); - - lh.addStaticHoliday ("01-APR-2024", "Easter Monday"); - - lh.addStaticHoliday ("18-APR-2024", "Independence Day"); - - lh.addStaticHoliday ("01-MAY-2024", "Workers Day"); - - lh.addStaticHoliday ("12-AUG-2024", "Defense Forces Day"); - - lh.addStaticHoliday ("23-DEC-2024", "Unity Day Observed"); - - lh.addStaticHoliday ("25-DEC-2024", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2024", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2025", "New Years Day"); - - lh.addStaticHoliday ("18-APR-2025", "Independence Day"); - - lh.addStaticHoliday ("21-APR-2025", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2025", "Workers Day"); - - lh.addStaticHoliday ("26-MAY-2025", "Africa Day Observed"); - - lh.addStaticHoliday ("11-AUG-2025", "Heroes Day"); - - lh.addStaticHoliday ("12-AUG-2025", "Defense Forces Day"); - - lh.addStaticHoliday ("22-DEC-2025", "Unity Day"); - - lh.addStaticHoliday ("25-DEC-2025", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2025", "Boxing Day"); - - lh.addStaticHoliday ("01-JAN-2026", "New Years Day"); - - lh.addStaticHoliday ("03-APR-2026", "Good Friday"); - - lh.addStaticHoliday ("06-APR-2026", "Easter Monday"); - - lh.addStaticHoliday ("01-MAY-2026", "Workers Day"); - - lh.addStaticHoliday ("25-MAY-2026", "Africa Day"); - - lh.addStaticHoliday ("11-AUG-2026", "Heroes Day"); - - lh.addStaticHoliday ("12-AUG-2026", "Defense Forces Day"); - - lh.addStaticHoliday ("22-DEC-2026", "Unity Day"); - - lh.addStaticHoliday ("25-DEC-2026", "Christmas Day"); - - lh.addStaticHoliday ("01-JAN-2027", "New Years Day"); - - lh.addStaticHoliday ("26-MAR-2027", "Good Friday"); - - lh.addStaticHoliday ("29-MAR-2027", "Easter Monday"); - - lh.addStaticHoliday ("19-APR-2027", "Independence Day Observed"); - - lh.addStaticHoliday ("25-MAY-2027", "Africa Day"); - - lh.addStaticHoliday ("11-AUG-2027", "Heroes Day"); - - lh.addStaticHoliday ("12-AUG-2027", "Defense Forces Day"); - - lh.addStaticHoliday ("22-DEC-2027", "Unity Day"); - - lh.addStaticHoliday ("27-DEC-2027", "Boxing Day Observed"); - - lh.addStaticHoliday ("14-APR-2028", "Good Friday"); - - lh.addStaticHoliday ("17-APR-2028", "Easter Monday"); - - lh.addStaticHoliday ("18-APR-2028", "Independence Day"); - - lh.addStaticHoliday ("01-MAY-2028", "Workers Day"); - - lh.addStaticHoliday ("25-MAY-2028", "Africa Day"); - - lh.addStaticHoliday ("11-AUG-2028", "Heroes Day"); - - lh.addStaticHoliday ("22-DEC-2028", "Unity Day"); - - lh.addStaticHoliday ("25-DEC-2028", "Christmas Day"); - - lh.addStaticHoliday ("26-DEC-2028", "Boxing Day"); - - lh.addStandardWeekend(); - - return lh; - } -} diff --git a/org/drip/analytics/input/BootCurveConstructionInput.java b/org/drip/analytics/input/BootCurveConstructionInput.java deleted file mode 100644 index 5e61627..0000000 --- a/org/drip/analytics/input/BootCurveConstructionInput.java +++ /dev/null @@ -1,231 +0,0 @@ - -package org.drip.analytics.input; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * BootCurveConstructionInput contains the Parameters needed for the Curve Calibration/Estimation. It - * contains the following: - * - Calibration Valuation Parameters - * - Calibration Quoting Parameters - * - Array of Calibration Instruments - * - Map of Calibration Quotes - * - Map of Calibration Measures - * - Latent State Fixings Container - * - * @author Lakshmi Krishnamurthy - */ - -public class BootCurveConstructionInput implements org.drip.analytics.input.CurveConstructionInputSet { - private org.drip.param.valuation.ValuationParams _valParam = null; - private org.drip.param.market.LatentStateFixingsContainer _lsfc = null; - private org.drip.param.valuation.ValuationCustomizationParams _quotingParam = null; - private org.drip.product.definition.CalibratableComponent[] _aCalibInst = null; - private org.drip.analytics.support.CaseInsensitiveTreeMap _mapMeasures = null; - private - org.drip.analytics.support.CaseInsensitiveTreeMap> - _mapQuote = null; - - /** - * Create an Instance of BootCurveConstructionInput from the given Calibration Inputs - * - * @param valParam Valuation Parameters - * @param quotingParam Quoting Parameters - * @param aCalibInst Array of the Calibration Instruments - * @param adblCalibQuote Array of the Calibration Quotes - * @param astrCalibMeasure Array of the Calibration Measures - * @param lsfc Latent State Fixings Container - * - * @return Instance of BootCurveConstructionInput - */ - - public static final BootCurveConstructionInput Create ( - final org.drip.param.valuation.ValuationParams valParam, - final org.drip.param.valuation.ValuationCustomizationParams quotingParam, - final org.drip.product.definition.CalibratableComponent[] aCalibInst, - final double[] adblCalibQuote, - final java.lang.String[] astrCalibMeasure, - final org.drip.param.market.LatentStateFixingsContainer lsfc) - { - if (null == aCalibInst || null == adblCalibQuote || null == astrCalibMeasure) return null; - - int iNumInst = aCalibInst.length; - - if (0 == iNumInst || adblCalibQuote.length != iNumInst || astrCalibMeasure.length != iNumInst) - return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap> - mapQuote = new - org.drip.analytics.support.CaseInsensitiveTreeMap>(); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapMeasures = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (int i = 0; i < iNumInst; ++i) { - if (null == aCalibInst[i]) return null; - - java.lang.String strInstrumentCode = aCalibInst[i].primaryCode(); - - if (null == strInstrumentCode || strInstrumentCode.isEmpty() || null == astrCalibMeasure[i] || - astrCalibMeasure[i].isEmpty() || !org.drip.quant.common.NumberUtil.IsValid - (adblCalibQuote[i])) - return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapCalibManifestMeasureQuote - = new org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapCalibManifestMeasureQuote.put (astrCalibMeasure[i], adblCalibQuote[i]); - - mapMeasures.put (strInstrumentCode, new java.lang.String[] {astrCalibMeasure[i]}); - - mapQuote.put (strInstrumentCode, mapCalibManifestMeasureQuote); - - java.lang.String[] astrSecCode = aCalibInst[i].secondaryCode(); - - if (null != astrSecCode) { - int iNumSecCode = astrSecCode.length; - - for (int j = 0; j < iNumSecCode; ++j) { - java.lang.String strSecCode = astrSecCode[j]; - - if (null == strSecCode || strSecCode.isEmpty()) - mapQuote.put (strSecCode, mapCalibManifestMeasureQuote); - } - } - } - - try { - return new BootCurveConstructionInput (valParam, quotingParam, aCalibInst, mapQuote, mapMeasures, - lsfc); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * BootCurveConstructionInput constructor - * - * @param valParam Valuation Parameter - * @param quotingParam Quoting Parameter - * @param aCalibInst Array of Calibration Instruments - * @param mapQuote Map of the Calibration Instrument Quotes - * @param mapMeasures Map containing the Array of the Calibration Instrument Measures - * @param lsfc Latent State Fixings Container - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public BootCurveConstructionInput ( - final org.drip.param.valuation.ValuationParams valParam, - final org.drip.param.valuation.ValuationCustomizationParams quotingParam, - final org.drip.product.definition.CalibratableComponent[] aCalibInst, - final - org.drip.analytics.support.CaseInsensitiveTreeMap> - mapQuote, - final org.drip.analytics.support.CaseInsensitiveTreeMap mapMeasures, - final org.drip.param.market.LatentStateFixingsContainer lsfc) - throws java.lang.Exception - { - if (null == (_valParam = valParam) || null == (_aCalibInst = aCalibInst) || null == (_mapQuote = - mapQuote) || null == (_mapMeasures = mapMeasures)) - throw new java.lang.Exception ("BootCurveConstructionInput ctr: Invalid Inputs"); - - _lsfc = lsfc; - _quotingParam = quotingParam; - int iNumInst = _aCalibInst.length; - - if (0 == iNumInst || iNumInst > _mapQuote.size() || iNumInst > _mapMeasures.size()) - throw new java.lang.Exception ("BootCurveConstructionInput ctr: Invalid Inputs"); - } - - @Override public org.drip.param.valuation.ValuationParams valuationParameter() - { - return _valParam; - } - - @Override public org.drip.param.pricer.CreditPricerParams pricerParameter() - { - return null; - } - - @Override public org.drip.param.market.CurveSurfaceQuoteContainer marketParameters() - { - return null; - } - - @Override public org.drip.param.valuation.ValuationCustomizationParams quotingParameter() - { - return _quotingParam; - } - - @Override public org.drip.product.definition.CalibratableComponent[] components() - { - return _aCalibInst; - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap> - quoteMap() - { - return _mapQuote; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap measures() - { - return _mapMeasures; - } - - @Override public org.drip.param.market.LatentStateFixingsContainer fixing() - { - return _lsfc; - } -} diff --git a/org/drip/analytics/input/CurveConstructionInputSet.java b/org/drip/analytics/input/CurveConstructionInputSet.java deleted file mode 100644 index 956ca91..0000000 --- a/org/drip/analytics/input/CurveConstructionInputSet.java +++ /dev/null @@ -1,133 +0,0 @@ - -package org.drip.analytics.input; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * CurveConstructionInputSet interface contains the Parameters needed for the Curve Calibration/Estimation. - * It's methods expose access to the following: - * - Calibration Valuation Parameters - * - Calibration Quoting Parameters - * - Array of Calibration Instruments - * - Map of Calibration Quotes - * - Map of Calibration Measures - * - Double Map of the Date/Index Fixings - * - * @author Lakshmi Krishnamurthy - */ - -public interface CurveConstructionInputSet { - - /** - * Retrieve the Valuation Parameter - * - * @return The Valuation Parameter - */ - - public abstract org.drip.param.valuation.ValuationParams valuationParameter(); - - /** - * Retrieve the Market Parameters - * - * @return The Market Parameters - */ - - public abstract org.drip.param.market.CurveSurfaceQuoteContainer marketParameters(); - - /** - * Retrieve the Pricer Parameters - * - * @return The Pricer Parameters - */ - - public abstract org.drip.param.pricer.CreditPricerParams pricerParameter(); - - /** - * Retrieve the Quoting Parameter - * - * @return The Quoting Parameter - */ - - public abstract org.drip.param.valuation.ValuationCustomizationParams quotingParameter(); - - /** - * Retrieve the Array of the Calibration Components - * - * @return The Array of the Calibration Components - */ - - public abstract org.drip.product.definition.CalibratableComponent[] components(); - - /** - * Retrieve the Calibration Quote Map - * - * @return The Calibration Quote Map - */ - - public abstract - org.drip.analytics.support.CaseInsensitiveTreeMap> - quoteMap(); - - /** - * Retrieve the Map containing the array of the Calibration Measures - * - * @return The Map containing the array of the Calibration Measures - */ - - public abstract org.drip.analytics.support.CaseInsensitiveTreeMap measures(); - - /** - * Retrieve the Latent State Fixings Container - * - * @return The Latent State Fixings Container - */ - - public abstract org.drip.param.market.LatentStateFixingsContainer fixing(); -} diff --git a/org/drip/analytics/input/LatentStateShapePreservingCCIS.java b/org/drip/analytics/input/LatentStateShapePreservingCCIS.java deleted file mode 100644 index 5809940..0000000 --- a/org/drip/analytics/input/LatentStateShapePreservingCCIS.java +++ /dev/null @@ -1,258 +0,0 @@ - -package org.drip.analytics.input; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * LatentStateShapePreservingCCIS contains the Parameters needed for the Curve Calibration/Estimation. It - * contains the following: - * - Calibration Valuation Parameters - * - Calibration Quoting Parameters - * - Calibration Market Parameters - * - Calibration Pricing Parameters - * - Array of Calibration Span Representation - * - Map of Calibration Quotes - * - Map of Calibration Measures - * - Double Map of the Date/Index Fixings - * - The Shape Preserving Linear Latent State Calibrator - * - * Additional functions provide for retrieval of the above and specific instrument quotes. - * - * @author Lakshmi Krishnamurthy - */ - -public class LatentStateShapePreservingCCIS implements - org.drip.analytics.input.CurveConstructionInputSet { - private org.drip.param.valuation.ValuationParams _valParam = null; - private org.drip.param.pricer.CreditPricerParams _pricerParam = null; - private org.drip.param.market.CurveSurfaceQuoteContainer _csqs = null; - private org.drip.param.market.LatentStateFixingsContainer _lsfc = null; - private org.drip.param.valuation.ValuationCustomizationParams _vcp = null; - private org.drip.state.inference.LatentStateStretchSpec[] _aStretchSpec = null; - private org.drip.state.inference.LinearLatentStateCalibrator _llscShapePreserving = null; - - /** - * LatentStateShapePreservingCCIS constructor - * - * @param llscShapePreserving Shape Preserving LinearLatentStateCalibrator instance - * @param aStretchSpec Array of the Latent State Stretch Representation Specifications - * @param valParam Valuation Parameters - * @param pricerParam Pricer Parameters - * @param vcp Valuation Customization Parameters - * @param csqs Market Parameters - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public LatentStateShapePreservingCCIS ( - final org.drip.state.inference.LinearLatentStateCalibrator llscShapePreserving, - final org.drip.state.inference.LatentStateStretchSpec[] aStretchSpec, - final org.drip.param.valuation.ValuationParams valParam, - final org.drip.param.pricer.CreditPricerParams pricerParam, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - throws java.lang.Exception - { - if (null == (_llscShapePreserving = llscShapePreserving) || null == (_aStretchSpec = aStretchSpec) || - null == (_valParam = valParam)) - throw new java.lang.Exception ("LatentStateShapePreservingCCIS ctr: Invalid Inputs"); - - _vcp = vcp; - _csqs = csqs; - int iNumStretchNULL = 0; - _pricerParam = pricerParam; - int iNumStretch = _aStretchSpec.length; - - if (0 == iNumStretch) - throw new java.lang.Exception ("LatentStateShapePreservingCCIS ctr: Invalid Inputs"); - - for (int i = 0; i < iNumStretch; ++i) { - if (null == _aStretchSpec[i]) ++iNumStretchNULL; - } - - if (iNumStretchNULL == iNumStretch) - throw new java.lang.Exception ("LatentStateShapePreservingCCIS ctr: Invalid Inputs"); - } - - @Override public org.drip.param.valuation.ValuationParams valuationParameter() - { - return _valParam; - } - - @Override public org.drip.param.valuation.ValuationCustomizationParams quotingParameter() - { - return _vcp; - } - - @Override public org.drip.product.definition.CalibratableComponent[] components() - { - java.util.List lsComp = new - java.util.ArrayList(); - - for (org.drip.state.inference.LatentStateStretchSpec stretchSpec : _aStretchSpec) { - if (null == stretchSpec) continue; - - org.drip.state.inference.LatentStateSegmentSpec[] aSegmentSpec = stretchSpec.segmentSpec(); - - if (null == aSegmentSpec) continue; - - int iNumComp = aSegmentSpec.length; - - if (0 == iNumComp) continue; - - for (int i = 0; i < iNumComp; ++i) { - if (null == aSegmentSpec[i]) continue; - - org.drip.product.definition.CalibratableComponent comp = aSegmentSpec[i].component(); - - if (null != comp) lsComp.add (comp); - } - } - - int iNumComp = lsComp.size(); - - if (0 == iNumComp) return null; - - org.drip.product.definition.CalibratableComponent[] aComp = new - org.drip.product.definition.CalibratableComponent[iNumComp]; - - for (int i = 0; i < iNumComp; ++i) - aComp[i] = lsComp.get (i); - - return aComp; - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap> - quoteMap() - { - org.drip.analytics.support.CaseInsensitiveTreeMap> - mapInstrumentQuote = new - org.drip.analytics.support.CaseInsensitiveTreeMap>(); - - for (org.drip.state.inference.LatentStateStretchSpec stretchSpec : _aStretchSpec) { - if (null == stretchSpec) continue; - - org.drip.state.inference.LatentStateSegmentSpec[] aSegmentSpec = stretchSpec.segmentSpec(); - - for (org.drip.state.inference.LatentStateSegmentSpec segmentSpec : aSegmentSpec) { - org.drip.analytics.support.CaseInsensitiveTreeMap mapMeasureQuote = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - org.drip.product.calib.ProductQuoteSet pqs = segmentSpec.manifestMeasures(); - - for (java.lang.String strManifestMeasure : pqs.fields()) { - try { - mapMeasureQuote.put (strManifestMeasure, pqs.get (strManifestMeasure)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - } - - mapInstrumentQuote.put (segmentSpec.component().primaryCode(), mapMeasureQuote); - } - } - - return mapInstrumentQuote; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap measures() - { - return null; - } - - @Override public org.drip.param.market.LatentStateFixingsContainer fixing() - { - return _lsfc; - } - - /** - * Retrieve the Pricer Parameters - * - * @return The Pricer Parameters - */ - - public org.drip.param.pricer.CreditPricerParams pricerParameter() - { - return _pricerParam; - } - - /** - * Retrieve the Market Parameters - * - * @return The Market Parameters - */ - - public org.drip.param.market.CurveSurfaceQuoteContainer marketParameters() - { - return _csqs; - } - - /** - * Retrieve the Array of Latent State Stretch Representation Specifications - * - * @return The Array of Latent State Stretch Representation Specifications - */ - - public org.drip.state.inference.LatentStateStretchSpec[] stretchSpec() - { - return _aStretchSpec; - } - - /** - * Retrieve the Shape Preserving Linear Latent State Calibrator - * - * @return The Shape Preserving Linear Latent State Calibrator - */ - - public org.drip.state.estimator.GlobalControlCurveParams shapePreservingLLSC() - { - return _llscShapePreserving; - } -} diff --git a/org/drip/analytics/output/BasketMeasures.java b/org/drip/analytics/output/BasketMeasures.java deleted file mode 100644 index f75b67c..0000000 --- a/org/drip/analytics/output/BasketMeasures.java +++ /dev/null @@ -1,466 +0,0 @@ - -package org.drip.analytics.output; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * BasketMeasures is the place holder for the analytical basket measures, optionally across scenarios. It - * contains the following scenario measure maps: - * - Unadjusted Base Measures - * - Flat delta/gamma bump measure maps for IR/credit/RR bump curves - * - Component/tenor bump double maps for IR/credit/RR curves - * - Flat/component recovery bumped measure maps for recovery bumped credit curves - * - Custom scenario measure map - * - * @author Lakshmi Krishnamurthy - */ - -public class BasketMeasures extends org.drip.analytics.output.ComponentMeasures { - private - org.drip.analytics.support.CaseInsensitiveTreeMap> - _mmComponentIRDeltaMeasures = null; - private - org.drip.analytics.support.CaseInsensitiveTreeMap> - _mmComponentIRGammaMeasures = null; - private - org.drip.analytics.support.CaseInsensitiveTreeMap> - _mmComponentCreditDeltaMeasures = null; - private - org.drip.analytics.support.CaseInsensitiveTreeMap> - _mmComponentCreditGammaMeasures = null; - private - org.drip.analytics.support.CaseInsensitiveTreeMap> - _mmComponentRRDeltaMeasures = null; - private - org.drip.analytics.support.CaseInsensitiveTreeMap> - _mmComponentRRGammaMeasures = null; - private - org.drip.analytics.support.CaseInsensitiveTreeMap>> - _mmmComponentTenorIRDeltaMeasures = null; - private - org.drip.analytics.support.CaseInsensitiveTreeMap>> - _mmmComponentTenorIRGammaMeasures = null; - private - org.drip.analytics.support.CaseInsensitiveTreeMap>> - _mmmComponentTenorCreditDeltaMeasures = null; - private - org.drip.analytics.support.CaseInsensitiveTreeMap>> - _mmmComponentTenorCreditGammaMeasures = null; - private - org.drip.analytics.support.CaseInsensitiveTreeMap> - _mmComponentCustomMeasures = null; - - /** - * Empty constructor - all members initialized to NaN or null - */ - - public BasketMeasures() - { - } - - /** - * Retrieve the Component IR Delta Double Measure Map - * - * @return The Component IR Delta Double Measure Map - */ - - public - org.drip.analytics.support.CaseInsensitiveTreeMap> - componentIRDeltaMeasures() - { - return _mmComponentIRDeltaMeasures; - } - - /** - * Set the Component IR Delta Double Measures Map - * - * @param mmComponentIRDeltaMeasures The Component IR Delta Double Measures Map - * - * @return TRUE - The Component IR Delta Double Measures Map Successfully Set - */ - - public boolean setComponentIRDeltaMeasures ( - final - org.drip.analytics.support.CaseInsensitiveTreeMap> - mmComponentIRDeltaMeasures) - { - if (null == mmComponentIRDeltaMeasures || 0 == mmComponentIRDeltaMeasures.size()) return false; - - _mmComponentIRDeltaMeasures = mmComponentIRDeltaMeasures; - return true; - } - - /** - * Retrieve the Component IR Gamma Double Measure Map - * - * @return The Component IR Gamma Double Measure Map - */ - - public - org.drip.analytics.support.CaseInsensitiveTreeMap> - componentIRGammaMeasures() - { - return _mmComponentIRGammaMeasures; - } - - /** - * Set the Component IR Gamma Double Measures Map - * - * @param mmComponentIRGammaMeasures The Component IR Gamma Double Measures Map - * - * @return TRUE - The Component IR Gamma Double Measures Map Successfully Set - */ - - public boolean setComponentIRGammaMeasures ( - final - org.drip.analytics.support.CaseInsensitiveTreeMap> - mmComponentIRGammaMeasures) - { - if (null == mmComponentIRGammaMeasures || 0 == mmComponentIRGammaMeasures.size()) return false; - - _mmComponentIRGammaMeasures = mmComponentIRGammaMeasures; - return true; - } - - /** - * Retrieve the Component Credit Delta Double Measure Map - * - * @return The ComponentCredit Delta Double Measure Map - */ - - public - org.drip.analytics.support.CaseInsensitiveTreeMap> - componentCreditDeltaMeasures() - { - return _mmComponentCreditDeltaMeasures; - } - - /** - * Set the Component Credit Delta Double Measures Map - * - * @param mmComponentCreditDeltaMeasures The Component Credit Delta Double Measures Map - * - * @return TRUE - The Component Credit Delta Double Measures Map Successfully Set - */ - - public boolean setComponentCreditDeltaMeasures ( - final - org.drip.analytics.support.CaseInsensitiveTreeMap> - mmComponentCreditDeltaMeasures) - { - if (null == mmComponentCreditDeltaMeasures || 0 == mmComponentCreditDeltaMeasures.size()) - return false; - - _mmComponentCreditDeltaMeasures = mmComponentCreditDeltaMeasures; - return true; - } - - /** - * Retrieve the Component Credit Gamma Double Measure Map - * - * @return The Component Credit Gamma Double Measure Map - */ - - public - org.drip.analytics.support.CaseInsensitiveTreeMap> - componentCreditGammaMeasures() - { - return _mmComponentCreditGammaMeasures; - } - - /** - * Set the Component Credit Gamma Double Measures Map - * - * @param mmComponentCreditGammaMeasures The Component Credit Gamma Double Measures Map - * - * @return TRUE - The Component Credit Gamma Double Measures Map Successfully Set - */ - - public boolean setComponentCreditGammaMeasures ( - final - org.drip.analytics.support.CaseInsensitiveTreeMap> - mmComponentCreditGammaMeasures) - { - if (null == mmComponentCreditGammaMeasures || 0 == mmComponentCreditGammaMeasures.size()) return false; - - _mmComponentCreditGammaMeasures = mmComponentCreditGammaMeasures; - return true; - } - - /** - * Retrieve the Component RR Delta Double Measure Map - * - * @return The Component RR Delta Double Measure Map - */ - - public - org.drip.analytics.support.CaseInsensitiveTreeMap> - componentRRDeltaMeasures() - { - return _mmComponentRRDeltaMeasures; - } - - /** - * Set the Component RR Delta Double Measures Map - * - * @param mmComponentRRDeltaMeasures The RR Delta Double Measures Map - * - * @return TRUE - The Component RR Delta Double Measures Map Successfully Set - */ - - public boolean setComponentRRDeltaMeasures ( - final - org.drip.analytics.support.CaseInsensitiveTreeMap> - mmComponentRRDeltaMeasures) - { - if (null == mmComponentRRDeltaMeasures || 0 == mmComponentRRDeltaMeasures.size()) return false; - - _mmComponentRRDeltaMeasures = mmComponentRRDeltaMeasures; - return true; - } - - /** - * Retrieve the Component RR Gamma Double Measure Map - * - * @return The Component RR Gamma Double Measure Map - */ - - public - org.drip.analytics.support.CaseInsensitiveTreeMap> - componentRRGammaMeasures() - { - return _mmComponentRRGammaMeasures; - } - - /** - * Set the Component RR Gamma Double Measures Map - * - * @param mmComponentRRGammaMeasures The RR Gamma Double Measures Map - * - * @return TRUE - The Component RR Gamma Double Measures Map Successfully Set - */ - - public boolean setComponentRRGammaMeasures ( - final - org.drip.analytics.support.CaseInsensitiveTreeMap> - mmComponentRRGammaMeasures) - { - if (null == mmComponentRRGammaMeasures || 0 == mmComponentRRGammaMeasures.size()) return false; - - _mmComponentRRGammaMeasures = mmComponentRRGammaMeasures; - return true; - } - - /** - * Retrieve the Component/Tenor IR Delta Triple Measure Map - * - * @return The Component/Tenor IR Delta Triple Measure Map - */ - - public - org.drip.analytics.support.CaseInsensitiveTreeMap>> - componentTenorIRDeltaMeasures() - { - return _mmmComponentTenorIRDeltaMeasures; - } - - /** - * Set the Component/Tenor IR Delta Triple Measures Map - * - * @param mmmComponentTenorIRDeltaMeasures The Component/Tenor IR Delta Triple Measures Map - * - * @return TRUE - The Component/Tenor IR Delta Triple Measures Map Successfully Set - */ - - public boolean setComponentTenorIRDeltaMeasures ( - final - org.drip.analytics.support.CaseInsensitiveTreeMap>> - mmmComponentTenorIRDeltaMeasures) - { - if (null == mmmComponentTenorIRDeltaMeasures || 0 == mmmComponentTenorIRDeltaMeasures.size()) - return false; - - _mmmComponentTenorIRDeltaMeasures = mmmComponentTenorIRDeltaMeasures; - return true; - } - - /** - * Retrieve the Component/Tenor IR Gamma Triple Measure Map - * - * @return The Component/Tenor IR Gamma Triple Measure Map - */ - - public - org.drip.analytics.support.CaseInsensitiveTreeMap>> - componentTenorIRGammaMeasures() - { - return _mmmComponentTenorIRGammaMeasures; - } - - /** - * Set the Component/Tenor IR Gamma Triple Measures Map - * - * @param mmmComponentTenorIRGammaMeasures The Component/Tenor IR Gamma Triple Measures Map - * - * @return TRUE - The Component/Tenor IR Gamma Triple Measures Map Successfully Set - */ - - public boolean setComponentTenorIRGammaMeasures ( - final - org.drip.analytics.support.CaseInsensitiveTreeMap>> - mmmComponentTenorIRGammaMeasures) - { - if (null == mmmComponentTenorIRGammaMeasures || 0 == mmmComponentTenorIRGammaMeasures.size()) - return false; - - _mmmComponentTenorIRGammaMeasures = mmmComponentTenorIRGammaMeasures; - return true; - } - - /** - * Retrieve the Component/Tenor Credit Delta Triple Measure Map - * - * @return The Component/Tenor Credit Delta Triple Measure Map - */ - - public - org.drip.analytics.support.CaseInsensitiveTreeMap>> - componentTenorCreditDeltaMeasures() - { - return _mmmComponentTenorCreditDeltaMeasures; - } - - /** - * Set the Component/Tenor Credit Delta Triple Measures Map - * - * @param mmmComponentTenorCreditDeltaMeasures The Component/Tenor Credit Delta Triple Measures Map - * - * @return TRUE - The Component/Tenor Credit Delta Triple Measures Map Successfully Set - */ - - public boolean setComponentTenorCreditDeltaMeasures ( - final - org.drip.analytics.support.CaseInsensitiveTreeMap>> - mmmComponentTenorCreditDeltaMeasures) - { - if (null == mmmComponentTenorCreditDeltaMeasures || 0 == mmmComponentTenorCreditDeltaMeasures.size()) - return false; - - _mmmComponentTenorCreditDeltaMeasures = mmmComponentTenorCreditDeltaMeasures; - return true; - } - - /** - * Retrieve the Component/Tenor Credit Gamma Triple Measure Map - * - * @return The Component/Tenor Credit Gamma Triple Measure Map - */ - - public - org.drip.analytics.support.CaseInsensitiveTreeMap>> - componentTenorCreditGammaMeasures() - { - return _mmmComponentTenorCreditGammaMeasures; - } - - /** - * Set the Component/Tenor Credit Gamma Triple Measures Map - * - * @param mmmComponentTenorCreditGammaMeasures The Component/Tenor Credit Gamma Triple Measures Map - * - * @return TRUE - The Component/Tenor Credit Gamma Triple Measures Map Successfully Set - */ - - public boolean setComponentTenorCreditGammaMeasures ( - final - org.drip.analytics.support.CaseInsensitiveTreeMap>> - mmmComponentTenorCreditGammaMeasures) - { - if (null == mmmComponentTenorCreditGammaMeasures || 0 == mmmComponentTenorCreditGammaMeasures.size()) - return false; - - _mmmComponentTenorCreditGammaMeasures = mmmComponentTenorCreditGammaMeasures; - return true; - } - - /** - * Retrieve the Component Custom Double Measure Map - * - * @return The Component Custom Double Measure Map - */ - - public - org.drip.analytics.support.CaseInsensitiveTreeMap> - componentCustomMeasures() - { - return _mmComponentCustomMeasures; - } - - /** - * Set the Component Custom Double Measures Map - * - * @param mmComponentCustomMeasures The Component Custom Double Measures Map - * - * @return TRUE - The Component Custom Double Measures Map Successfully Set - */ - - public boolean setComponentCustomMeasures ( - final - org.drip.analytics.support.CaseInsensitiveTreeMap> - mmComponentCustomMeasures) - { - if (null == mmComponentCustomMeasures || 0 == mmComponentCustomMeasures.size()) return false; - - _mmComponentCustomMeasures = mmComponentCustomMeasures; - return true; - } -} diff --git a/org/drip/analytics/output/BondCouponMeasures.java b/org/drip/analytics/output/BondCouponMeasures.java deleted file mode 100644 index 0f9029a..0000000 --- a/org/drip/analytics/output/BondCouponMeasures.java +++ /dev/null @@ -1,227 +0,0 @@ - -package org.drip.analytics.output; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * This class encapsulates the parsimonius but complete set of the cash-flow oriented coupon measures - * generated out of a full bond analytics run to a given work-out. These are: - * - DV01 - * - PV Measures (Coupon PV, Index Coupon PV, PV) - * - * @author Lakshmi Krishnamurthy - */ - -public class BondCouponMeasures { - private double _dblDV01 = java.lang.Double.NaN; - private double _dblIndexCouponPV = java.lang.Double.NaN; - private double _dblCouponPV = java.lang.Double.NaN; - private double _dblPV = java.lang.Double.NaN; - - /** - * BondCouponMeasures constructor - * - * @param dblDV01 DV01 - * @param dblIndexCouponPV Index Coupon PV - * @param dblCouponPV Coupon PV - * @param dblPV PV - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public BondCouponMeasures ( - final double dblDV01, - final double dblIndexCouponPV, - final double dblCouponPV, - final double dblPV) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblDV01 = dblDV01) || - !org.drip.quant.common.NumberUtil.IsValid (_dblCouponPV = dblCouponPV) || - !org.drip.quant.common.NumberUtil.IsValid (_dblPV = dblPV)) - throw new java.lang.Exception ("BondCouponMeasures ctr: Invalid Inputs!"); - - _dblIndexCouponPV = dblIndexCouponPV; - } - - /** - * Adjust the bond coupon measures by a cash settlement discount factor - * - * @param dblCashPayDF Cash Pay discount factor - * - * @return TRUE - if the adjustment has been successfully applied - */ - - public boolean adjustForSettlement ( - final double dblCashPayDF) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCashPayDF)) return false; - - _dblDV01 /= dblCashPayDF; - _dblIndexCouponPV /= dblCashPayDF; - _dblCouponPV /= dblCashPayDF; - _dblPV /= dblCashPayDF; - return true; - } - - /** - * Retrieve the DV01 - * - * @return DV01 - */ - - public double dv01() - { - return _dblDV01; - } - - /** - * Retrieve the Index Coupon PV - * - * @return Index Coupon PV - */ - - public double indexCouponPV() - { - return _dblIndexCouponPV; - } - - /** - * Retrieve the Coupon PV - * - * @return Coupon PV - */ - - public double couponPV() - { - return _dblCouponPV; - } - - /** - * Retrieve the PV - * - * @return PV - */ - - public double pv() - { - return _dblPV; - } - - /** - * Adjust Measures for accrued - * - * @param dblAccrued01 Accrued 01 - * @param dblCoupon Coupon during the accrued phase - * @param dblIndex Index Rate during the accrued phase - * @param bDirtyFromClean True - Change measures from Clean to Dirty - * - * @return True - if the adjustment has been successfully applied - */ - - public boolean adjustForAccrual ( - final double dblAccrued01, - final double dblCoupon, - final double dblIndex, - final boolean bDirtyFromClean) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblAccrued01) || - !org.drip.quant.common.NumberUtil.IsValid (dblCoupon)) - return false; - - if (bDirtyFromClean) - _dblDV01 -= dblAccrued01; - else - _dblDV01 += dblAccrued01; - - if (bDirtyFromClean) - _dblIndexCouponPV -= dblAccrued01 * dblIndex; - else - _dblIndexCouponPV += dblAccrued01 * dblIndex; - - if (bDirtyFromClean) - _dblCouponPV -= dblAccrued01 * dblCoupon; - else - _dblCouponPV += dblAccrued01 * dblCoupon; - - if (bDirtyFromClean) - _dblPV -= dblAccrued01 * dblCoupon; - else - _dblPV += dblAccrued01 * dblCoupon; - - return true; - } - - /** - * Return the state as a named measure map - * - * @param strPrefix Measure name prefix - * - * @return Map of the measures - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap toMap ( - final java.lang.String strPrefix) - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapMeasures = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapMeasures.put (strPrefix + "DV01", _dblDV01); - - mapMeasures.put (strPrefix + "IndexCouponPV", _dblIndexCouponPV); - - mapMeasures.put (strPrefix + "CouponPV", _dblCouponPV); - - mapMeasures.put (strPrefix + "PV", _dblPV); - - return mapMeasures; - } -} diff --git a/org/drip/analytics/output/BondRVMeasures.java b/org/drip/analytics/output/BondRVMeasures.java deleted file mode 100644 index ec6331e..0000000 --- a/org/drip/analytics/output/BondRVMeasures.java +++ /dev/null @@ -1,389 +0,0 @@ - -package org.drip.analytics.output; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * BondRVMeasures encapsulates the comprehensive set of RV measures calculated for the bond to the - * appropriate exercise: - * - Workout Information - * - Price, Yield, and Yield01 - * - Spread Measures: Asset Swap/Credit/G/I/OAS/PECS/TSY/Z - * - Basis Measures: Bond Basis, Credit Basis, Yield Basis - * - Duration Measures: Macaulay/Modified Duration, Convexity - * - * @author Lakshmi Krishnamurthy - */ - -public class BondRVMeasures { - private double _dblPECS = java.lang.Double.NaN; - private double _dblPrice = java.lang.Double.NaN; - private double _dblGSpread = java.lang.Double.NaN; - private double _dblISpread = java.lang.Double.NaN; - private double _dblYield01 = java.lang.Double.NaN; - private double _dblZSpread = java.lang.Double.NaN; - private double _dblOASpread = java.lang.Double.NaN; - private double _dblBondBasis = java.lang.Double.NaN; - private double _dblConvexity = java.lang.Double.NaN; - private double _dblTSYSpread = java.lang.Double.NaN; - private double _dblCreditBasis = java.lang.Double.NaN; - private org.drip.param.valuation.WorkoutInfo _wi = null; - private double _dblDiscountMargin = java.lang.Double.NaN; - private double _dblAssetSwapSpread = java.lang.Double.NaN; - private double _dblMacaulayDuration = java.lang.Double.NaN; - private double _dblModifiedDuration = java.lang.Double.NaN; - - /** - * BondRVMeasures ctr - * - * @param dblPrice BondRV Clean Price - * @param dblBondBasis BondRV Bond Basis - * @param dblZSpread BondRV Z Spread - * @param dblGSpread BondRV G Spread - * @param dblISpread BondRV I Spread - * @param dblOASpread BondRV OAS - * @param dblTSYSpread BondRV TSY Spread - * @param dblDiscountMargin BondRV Asset Swap Spread - * @param dblAssetSwapSpread BondRV Asset Swap Spread - * @param dblCreditBasis BondRV Credit Basis - * @param dblPECS BondRV PECS - * @param dblYield01 BondRV Yield01 - * @param dblModifiedDuration BondRV Modified Duration - * @param dblMacaulayDuration BondRV Macaulay Duration - * @param dblConvexity BondRV Convexity - * @param wi BondRV work-out info - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public BondRVMeasures ( - final double dblPrice, - final double dblBondBasis, - final double dblZSpread, - final double dblGSpread, - final double dblISpread, - final double dblOASpread, - final double dblTSYSpread, - final double dblDiscountMargin, - final double dblAssetSwapSpread, - final double dblCreditBasis, - final double dblPECS, - final double dblYield01, - final double dblModifiedDuration, - final double dblMacaulayDuration, - final double dblConvexity, - final org.drip.param.valuation.WorkoutInfo wi) - throws java.lang.Exception - { - if (null == (_wi = wi)) throw new java.lang.Exception ("BondRVMeasures ctr: Invalid inputs!"); - - _dblPECS = dblPECS; - _dblPrice = dblPrice; - _dblGSpread = dblGSpread; - _dblISpread = dblISpread; - _dblYield01 = dblYield01; - _dblZSpread = dblZSpread; - _dblOASpread = dblOASpread; - _dblBondBasis = dblBondBasis; - _dblConvexity = dblConvexity; - _dblTSYSpread = dblTSYSpread; - _dblCreditBasis = dblCreditBasis; - _dblDiscountMargin = dblDiscountMargin; - _dblAssetSwapSpread = dblAssetSwapSpread; - _dblMacaulayDuration = dblMacaulayDuration; - _dblModifiedDuration = dblModifiedDuration; - } - - /** - * Retrieve the Work-out Info - * - * @return Work-out Info - */ - - public org.drip.param.valuation.WorkoutInfo wi() - { - return _wi; - } - - /** - * Retrieve the PECS - * - * @return PECS - */ - - public double pecs() - { - return _dblPECS; - } - - /** - * Retrieve the Price - * - * @return Price - */ - - public double price() - { - return _dblPrice; - } - - /** - * Retrieve the G Spread - * - * @return G Spread - */ - - public double gSpread() - { - return _dblGSpread; - } - - /** - * Retrieve the I Spread - * - * @return I Spread - */ - - public double iSpread() - { - return _dblISpread; - } - - /** - * Retrieve the Yield01 - * - * @return Yield01 - */ - - public double yield01() - { - return _dblYield01; - } - - /** - * Retrieve the Z Spread - * - * @return Z Spread - */ - - public double zSpread() - { - return _dblZSpread; - } - - /** - * Retrieve the OAS - * - * @return OAS - */ - - public double oas() - { - return _dblOASpread; - } - - /** - * Retrieve the Bond Basis - * - * @return Bond Basis - */ - - public double bondBasis() - { - return _dblBondBasis; - } - - /** - * Retrieve the Convexity - * - * @return Convexity - */ - - public double convexity() - { - return _dblConvexity; - } - - /** - * Retrieve the TSY Spread - * - * @return TSY Spread - */ - - public double tsySpread() - { - return _dblTSYSpread; - } - - /** - * Retrieve the Credit Basis - * - * @return Credit Basis - */ - - public double creditBasis() - { - return _dblCreditBasis; - } - - /** - * Retrieve the Discount Margin - * - * @return Discount Margin - */ - - public double discountMargin() - { - return _dblDiscountMargin; - } - - /** - * Retrieve the Asset Swap Spread - * - * @return Asset Swap Spread - */ - - public double asw() - { - return _dblAssetSwapSpread; - } - - /** - * Retrieve the Macaulay Duration - * - * @return Macaulay Duration - */ - - public double macaulayDuration() - { - return _dblMacaulayDuration; - } - - /** - * Retrieve the Modified Duration - * - * @return Modified Duration - */ - - public double modifiedDuration() - { - return _dblModifiedDuration; - } - - /** - * Return the state as a measure map - * - * @param strPrefix RV Measure name prefix - * - * @return Map of the RV measures - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap toMap ( - final java.lang.String strPrefix) - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapRVMeasures = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapRVMeasures.put (strPrefix + "AssetSwapSpread", _dblAssetSwapSpread); - - mapRVMeasures.put (strPrefix + "ASW", _dblAssetSwapSpread); - - mapRVMeasures.put (strPrefix + "BondBasis", _dblBondBasis); - - mapRVMeasures.put (strPrefix + "Convexity", _dblConvexity); - - mapRVMeasures.put (strPrefix + "CreditBasis", _dblCreditBasis); - - mapRVMeasures.put (strPrefix + "DiscountMargin", _dblDiscountMargin); - - mapRVMeasures.put (strPrefix + "Duration", _dblModifiedDuration); - - mapRVMeasures.put (strPrefix + "GSpread", _dblGSpread); - - mapRVMeasures.put (strPrefix + "ISpread", _dblISpread); - - mapRVMeasures.put (strPrefix + "MacaulayDuration", _dblMacaulayDuration); - - mapRVMeasures.put (strPrefix + "ModifiedDuration", _dblModifiedDuration); - - mapRVMeasures.put (strPrefix + "OAS", _dblOASpread); - - mapRVMeasures.put (strPrefix + "OASpread", _dblOASpread); - - mapRVMeasures.put (strPrefix + "OptionAdjustedSpread", _dblOASpread); - - mapRVMeasures.put (strPrefix + "PECS", _dblPECS); - - mapRVMeasures.put (strPrefix + "Price", _dblPrice); - - mapRVMeasures.put (strPrefix + "TSYSpread", _dblTSYSpread); - - mapRVMeasures.put (strPrefix + "WorkoutDate", (double) _wi.date()); - - mapRVMeasures.put (strPrefix + "WorkoutFactor", _wi.factor()); - - mapRVMeasures.put (strPrefix + "WorkoutType", (double) _wi.type()); - - mapRVMeasures.put (strPrefix + "WorkoutYield", _wi.yield()); - - mapRVMeasures.put (strPrefix + "Yield", _wi.yield()); - - mapRVMeasures.put (strPrefix + "Yield01", _dblYield01); - - mapRVMeasures.put (strPrefix + "YieldBasis", _dblBondBasis); - - mapRVMeasures.put (strPrefix + "YieldSpread", _dblBondBasis); - - mapRVMeasures.put (strPrefix + "ZSpread", _dblZSpread); - - return mapRVMeasures; - } -} diff --git a/org/drip/analytics/output/BondWorkoutMeasures.java b/org/drip/analytics/output/BondWorkoutMeasures.java deleted file mode 100644 index 360162e..0000000 --- a/org/drip/analytics/output/BondWorkoutMeasures.java +++ /dev/null @@ -1,452 +0,0 @@ - -package org.drip.analytics.output; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * BondWorkoutMeasures encapsulates the parsimonius yet complete set of measures generated out of a full bond - * analytics run to a given work-out. It contains the following: - * - Credit Risky/Credit Riskless Clean/Dirty Coupon Measures - * - Credit Risky/Credit Riskless Par/Principal PV - * - Loss Measures such as expected Recovery, Loss on instantaneous default, and default exposure - * with/without recovery - * - Unit Coupon measures such as Accrued 01, first coupon/index rate - * - * @author Lakshmi Krishnamurthy - */ - -public class BondWorkoutMeasures { - private double _dblAccrued01 = java.lang.Double.NaN; - private double _dblRecoveryPV = java.lang.Double.NaN; - private BondCouponMeasures _bcmCreditRiskyClean = null; - private BondCouponMeasures _bcmCreditRiskyDirty = null; - private double _dblFirstIndexRate = java.lang.Double.NaN; - private double _dblFirstCouponRate = java.lang.Double.NaN; - private BondCouponMeasures _bcmCreditRisklessClean = null; - private BondCouponMeasures _bcmCreditRisklessDirty = null; - private double _dblDefaultExposure = java.lang.Double.NaN; - private double _dblExpectedRecovery = java.lang.Double.NaN; - private double _dblCreditRiskyParPV = java.lang.Double.NaN; - private double _dblCreditRisklessParPV = java.lang.Double.NaN; - private double _dblDefaultExposureNoRec = java.lang.Double.NaN; - private double _dblCreditRiskyPrincipalPV = java.lang.Double.NaN; - private double _dblCreditRisklessPrincipalPV = java.lang.Double.NaN; - private double _dblLossOnInstantaneousDefault = java.lang.Double.NaN; - - /** - * - * BondWorkoutMeasures constructor - * - * @param bcmCreditRiskyDirty Dirty credit risky BondMeasuresCoupon - * @param bcmCreditRisklessDirty Dirty credit risk-less BondMeasuresCoupon - * @param dblCreditRiskyParPV Credit risky Par PV - * @param dblCreditRisklessParPV Credit risk-less par PV - * @param dblCreditRiskyPrincipalPV Credit Risky Principal PV - * @param dblCreditRisklessPrincipalPV Credit Risk-less Principal PV - * @param dblRecoveryPV Recovery PV - * @param dblExpectedRecovery Expected Recovery - * @param dblDefaultExposure PV on instantaneous default - * @param dblDefaultExposureNoRec PV on instantaneous default with zero recovery - * @param dblLossOnInstantaneousDefault Loss On Instantaneous Default - * @param dblAccrued01 Accrued01 - * @param dblFirstCouponRate First Coupon Rate - * @param dblFirstIndexRate First Index Rate - * @param dblCashPayDF Cash Pay Discount Factor - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public BondWorkoutMeasures ( - final BondCouponMeasures bcmCreditRiskyDirty, - final BondCouponMeasures bcmCreditRisklessDirty, - final double dblCreditRiskyParPV, - final double dblCreditRisklessParPV, - final double dblCreditRiskyPrincipalPV, - final double dblCreditRisklessPrincipalPV, - final double dblRecoveryPV, - final double dblExpectedRecovery, - final double dblDefaultExposure, - final double dblDefaultExposureNoRec, - final double dblLossOnInstantaneousDefault, - final double dblAccrued01, - final double dblFirstCouponRate, - final double dblFirstIndexRate, - final double dblCashPayDF) - throws java.lang.Exception - { - if (null == (_bcmCreditRisklessDirty = bcmCreditRisklessDirty) || - !org.drip.quant.common.NumberUtil.IsValid (_dblCreditRisklessParPV = dblCreditRisklessParPV) || - !org.drip.quant.common.NumberUtil.IsValid (_dblCreditRisklessPrincipalPV = - dblCreditRisklessPrincipalPV) || !org.drip.quant.common.NumberUtil.IsValid (_dblAccrued01 - = dblAccrued01) || !org.drip.quant.common.NumberUtil.IsValid (_dblFirstCouponRate = - dblFirstCouponRate)) - throw new java.lang.Exception ("BondWorkoutMeasures ctr: Invalid Inputs!"); - - _dblRecoveryPV = dblRecoveryPV; - _dblFirstIndexRate = dblFirstIndexRate; - _dblDefaultExposure = dblDefaultExposure; - _dblExpectedRecovery = dblExpectedRecovery; - _bcmCreditRiskyDirty = bcmCreditRiskyDirty; - _dblCreditRiskyParPV = dblCreditRiskyParPV; - _dblDefaultExposureNoRec = dblDefaultExposureNoRec; - _dblCreditRiskyPrincipalPV = dblCreditRiskyPrincipalPV; - _dblLossOnInstantaneousDefault = dblLossOnInstantaneousDefault; - - if (!(_bcmCreditRisklessClean = new org.drip.analytics.output.BondCouponMeasures - (_bcmCreditRisklessDirty.dv01(), _bcmCreditRisklessDirty.indexCouponPV(), - _bcmCreditRisklessDirty.couponPV(), _bcmCreditRisklessDirty.pv())).adjustForSettlement - (dblCashPayDF)) - throw new java.lang.Exception - ("BondWorkoutMeasures ctr: Cannot successfully set up BCM CreditRisklessClean"); - - if (!_bcmCreditRisklessClean.adjustForAccrual (_dblAccrued01, _dblFirstCouponRate, dblFirstIndexRate, - false)) - throw new java.lang.Exception - ("BondWorkoutMeasures ctr: Cannot successfully set up BCM CreditRisklessClean"); - - if (null != _bcmCreditRiskyDirty && ((!(_bcmCreditRiskyClean = new BondCouponMeasures - (_bcmCreditRiskyDirty.dv01(), _bcmCreditRiskyDirty.indexCouponPV(), - _bcmCreditRiskyDirty.couponPV(), _bcmCreditRiskyDirty.pv())).adjustForSettlement - (dblCashPayDF)) || !_bcmCreditRiskyClean.adjustForAccrual (_dblAccrued01, - _dblFirstCouponRate, _dblFirstCouponRate, false))) - throw new java.lang.Exception - ("BondWorkoutMeasures ctr: Cannot successfully set up BCM CreditRiskyClean"); - } - - /** - * Retrieve the Credit Risky Clean Bond Coupon Measures - * - * @return Credit Risky Clean Bond Coupon Measures - */ - - public org.drip.analytics.output.BondCouponMeasures creditRiskyCleanbcm() - { - return _bcmCreditRiskyClean; - } - - /** - * Retrieve the Credit Risk-less Clean Bond Coupon Measures - * - * @return Credit Risk-less Clean Bond Coupon Measures - */ - - public org.drip.analytics.output.BondCouponMeasures creditRisklessCleanbcm() - { - return _bcmCreditRisklessClean; - } - - /** - * Retrieve the Credit Risky Dirty Bond Coupon Measures - * - * @return Credit Risky Dirty Bond Coupon Measures - */ - - public org.drip.analytics.output.BondCouponMeasures creditRiskyDirtybcm() - { - return _bcmCreditRiskyDirty; - } - - /** - * Retrieve the Credit Risk-less Dirty Bond Coupon Measures - * - * @return Credit Risk-less Dirty Bond Coupon Measures - */ - - public org.drip.analytics.output.BondCouponMeasures creditRisklessDirtybcm() - { - return _bcmCreditRisklessDirty; - } - - /** - * Retrieve the Accrued01 - * - * @return Accrued01 - */ - - public double accrued01() - { - return _dblAccrued01; - } - - /** - * Retrieve the First Coupon Rate - * - * @return First Coupon Rate - */ - - public double firstCouponRate() - { - return _dblFirstCouponRate; - } - - /** - * Retrieve the First Index Rate - * - * @return First Index Rate - */ - - public double firstIndexRate() - { - return _dblFirstIndexRate; - } - - /** - * Retrieve the Credit Risky Par PV - * - * @return The Credit Risky Par PV - */ - - public double creditRiskyParPV() - { - return _dblCreditRiskyParPV; - } - - /** - * Retrieve the Credit Risk-less Par PV - * - * @return The Credit Risk-less Par PV - */ - - public double creditRisklessParPV() - { - return _dblCreditRisklessParPV; - } - - /** - * Retrieve the Credit Risky Principal PV - * - * @return The Credit Risky Principal PV - */ - - public double creditRiskyPrincipalPV() - { - return _dblCreditRiskyPrincipalPV; - } - - /** - * Retrieve the Credit Risk-less Principal PV - * - * @return The Credit Risk-less Principal PV - */ - - public double creditRisklessPrincipalPV() - { - return _dblCreditRisklessPrincipalPV; - } - - /** - * Retrieve the Recovery PV - * - * @return The Recovery PV - */ - - public double recoveryPV() - { - return _dblRecoveryPV; - } - - /** - * Retrieve the Expected Recovery - * - * @return The Expected Recovery - */ - - public double expectedRecovery() - { - return _dblExpectedRecovery; - } - - /** - * Retrieve Default Exposure - Same as PV on instantaneous default - * - * @return The Default Exposure - */ - - public double defaultExposure() - { - return _dblDefaultExposure; - } - - /** - * Retrieve the Default Exposure without recovery - Same as PV on instantaneous default without recovery - * - * @return The Default Exposure without recovery - */ - - public double defaultExposureNoRec() - { - return _dblDefaultExposureNoRec; - } - - /** - * Retrieve the Loss On Instantaneous Default - * - * @return Loss On Instantaneous Default - */ - - public double lossOnInstantaneousDefault() - { - return _dblLossOnInstantaneousDefault; - } - - /** - * Return the state as a measure map - * - * @param strPrefix Measure name prefix - * - * @return Map of the measures - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap toMap ( - final java.lang.String strPrefix) - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapMeasures = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapMeasures.put (strPrefix + "Accrued", _dblAccrued01 * _dblFirstCouponRate); - - mapMeasures.put (strPrefix + "Accrued01", _dblAccrued01); - - mapMeasures.put (strPrefix + "CleanCouponPV", _bcmCreditRisklessClean.couponPV()); - - mapMeasures.put (strPrefix + "CleanDV01", _bcmCreditRisklessClean.dv01()); - - mapMeasures.put (strPrefix + "CleanIndexCouponPV", _bcmCreditRisklessClean.indexCouponPV()); - - mapMeasures.put (strPrefix + "CleanPrice", _bcmCreditRisklessClean.pv()); - - mapMeasures.put (strPrefix + "CleanPV", _bcmCreditRisklessClean.pv()); - - mapMeasures.put (strPrefix + "CreditRisklessParPV", _dblCreditRisklessParPV); - - mapMeasures.put (strPrefix + "CreditRisklessPrincipalPV", _dblCreditRisklessPrincipalPV); - - mapMeasures.put (strPrefix + "CreditRiskyParPV", _dblCreditRiskyParPV); - - mapMeasures.put (strPrefix + "CreditRiskyPrincipalPV", _dblCreditRiskyPrincipalPV); - - mapMeasures.put (strPrefix + "DefaultExposure", _dblDefaultExposure); - - mapMeasures.put (strPrefix + "DefaultExposureNoRec", _dblDefaultExposureNoRec); - - mapMeasures.put (strPrefix + "DirtyCouponPV", _bcmCreditRisklessDirty.couponPV()); - - mapMeasures.put (strPrefix + "DirtyDV01", _bcmCreditRisklessDirty.dv01()); - - mapMeasures.put (strPrefix + "DirtyIndexCouponPV", _bcmCreditRisklessDirty.indexCouponPV()); - - mapMeasures.put (strPrefix + "DirtyPrice", _bcmCreditRisklessDirty.pv()); - - mapMeasures.put (strPrefix + "DirtyPV", _bcmCreditRisklessDirty.pv()); - - mapMeasures.put (strPrefix + "DV01", _bcmCreditRisklessClean.dv01()); - - mapMeasures.put (strPrefix + "ExpectedRecovery", _dblExpectedRecovery); - - mapMeasures.put (strPrefix + "FirstCouponRate", _dblFirstCouponRate); - - mapMeasures.put (strPrefix + "FirstIndexRate", _dblFirstIndexRate); - - mapMeasures.put (strPrefix + "LossOnInstantaneousDefault", _dblLossOnInstantaneousDefault); - - mapMeasures.put (strPrefix + "ParPV", _dblCreditRisklessParPV); - - mapMeasures.put (strPrefix + "PrincipalPV", _dblCreditRisklessPrincipalPV); - - mapMeasures.put (strPrefix + "PV", _bcmCreditRisklessClean.pv()); - - mapMeasures.put (strPrefix + "RecoveryPV", _dblRecoveryPV); - - org.drip.quant.common.CollectionUtil.MergeWithMain (mapMeasures, _bcmCreditRisklessDirty.toMap - (strPrefix + "RisklessDirty")); - - org.drip.quant.common.CollectionUtil.MergeWithMain (mapMeasures, _bcmCreditRisklessClean.toMap - (strPrefix + "RisklessClean")); - - if (null != _bcmCreditRiskyDirty) { - mapMeasures.put (strPrefix + "CleanCouponPV", _bcmCreditRiskyClean.couponPV()); - - mapMeasures.put (strPrefix + "CleanDV01", _bcmCreditRiskyClean.dv01()); - - mapMeasures.put (strPrefix + "CleanIndexCouponPV", _bcmCreditRiskyClean.indexCouponPV()); - - mapMeasures.put (strPrefix + "CleanPrice", _bcmCreditRiskyClean.pv()); - - mapMeasures.put (strPrefix + "CleanPV", _bcmCreditRiskyClean.pv()); - - mapMeasures.put (strPrefix + "DirtyCouponPV", _bcmCreditRiskyDirty.couponPV()); - - mapMeasures.put (strPrefix + "DirtyDV01", _bcmCreditRiskyDirty.dv01()); - - mapMeasures.put (strPrefix + "DirtyIndexCouponPV", _bcmCreditRiskyDirty.indexCouponPV()); - - mapMeasures.put (strPrefix + "DirtyPrice", _bcmCreditRiskyDirty.pv()); - - mapMeasures.put (strPrefix + "DirtyPV", _bcmCreditRiskyDirty.pv()); - - mapMeasures.put (strPrefix + "DV01", _bcmCreditRiskyClean.dv01()); - - mapMeasures.put (strPrefix + "ParPV", _dblCreditRiskyParPV); - - mapMeasures.put (strPrefix + "PrincipalPV", _dblCreditRiskyPrincipalPV); - - mapMeasures.put (strPrefix + "PV", _bcmCreditRiskyClean.pv()); - - org.drip.quant.common.CollectionUtil.MergeWithMain (mapMeasures, _bcmCreditRiskyDirty.toMap - (strPrefix + "RiskyDirty")); - - org.drip.quant.common.CollectionUtil.MergeWithMain (mapMeasures, _bcmCreditRiskyClean.toMap - (strPrefix + "RiskyClean")); - } - - return mapMeasures; - } -} diff --git a/org/drip/analytics/output/BulletMetrics.java b/org/drip/analytics/output/BulletMetrics.java deleted file mode 100644 index 1661ea0..0000000 --- a/org/drip/analytics/output/BulletMetrics.java +++ /dev/null @@ -1,318 +0,0 @@ - -package org.drip.analytics.output; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * BulletMetrics holds the results of the Bullet Cash flow metrics estimate output. - * - * @author Lakshmi Krishnamurthy - */ - -public class BulletMetrics { - - /* - * Bullet Latent State Identification Support Fields - */ - - private org.drip.state.identifier.CreditLabel _creditLabel = null; - private org.drip.state.identifier.FundingLabel _fundingLabel = null; - private org.drip.state.identifier.FXLabel _fxLabel = null; - - /* - * Bullet Parameters Specification Fields - */ - - private int _iTerminalDate = java.lang.Integer.MIN_VALUE; - private int _iPayDate = java.lang.Integer.MIN_VALUE; - private double _dblNotional = java.lang.Double.NaN; - - /* - * Bullet State Point Value Fields - */ - - private double _dblSurvival = java.lang.Double.NaN; - private double _dblDF = java.lang.Double.NaN; - private double _dblFX = java.lang.Double.NaN; - - /* - * Bullet Convexity Adjustment Fields - */ - - private org.drip.analytics.output.ConvexityAdjustment _convAdj = null; - - /** - * BulletMetrics Constructor - * - * @param iTerminalDate Terminal Date - * @param iPayDate Pay Date - * @param dblNotional Notional - * @param dblSurvival Terminal Survival - * @param dblDF Terminal Discount Factor - * @param dblFX Terminal FX Rate - * @param convAdj Terminal Convexity Adjustment - * @param creditLabel The Credit Label - * @param fundingLabel The Funding Label - * @param fxLabel The FX Label - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public BulletMetrics ( - final int iTerminalDate, - final int iPayDate, - final double dblNotional, - final double dblSurvival, - final double dblDF, - final double dblFX, - final org.drip.analytics.output.ConvexityAdjustment convAdj, - final org.drip.state.identifier.CreditLabel creditLabel, - final org.drip.state.identifier.FundingLabel fundingLabel, - final org.drip.state.identifier.FXLabel fxLabel) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblNotional = dblNotional) || - !org.drip.quant.common.NumberUtil.IsValid (_dblSurvival = dblSurvival) || - !org.drip.quant.common.NumberUtil.IsValid (_dblDF = dblDF) || - !org.drip.quant.common.NumberUtil.IsValid (_dblFX = dblFX) || null == (_convAdj = - convAdj) || null == (_fundingLabel = fundingLabel)) - throw new java.lang.Exception ("BulletMetrics ctr: Invalid Inputs"); - - _fxLabel = fxLabel; - _iPayDate = iPayDate; - _creditLabel = creditLabel; - _iTerminalDate = iTerminalDate; - } - - /** - * Retrieve the Terminal Date - * - * @return The Terminal Date - */ - - public int terminalDate() - { - return _iTerminalDate; - } - - /** - * Retrieve the Pay Date - * - * @return The Pay Date - */ - - public int payDate() - { - return _iPayDate; - } - - /** - * Retrieve the Terminal Notional - * - * @return The Terminal Notional - */ - - public double notional() - { - return _dblNotional; - } - - /** - * Retrieve the Terminal Survival Probability - * - * @return The Terminal Survival Probability - */ - - public double survival() - { - return _dblSurvival; - } - - /** - * Retrieve the Terminal DF - * - * @return The Terminal DF - */ - - public double df() - { - return _dblDF; - } - - /** - * Retrieve the Terminal FX Rate - * - * @return The Terminal FX Rate - */ - - public double fx() - { - return _dblFX; - } - - /** - * Retrieve the Terminal Annuity in the Pay Currency - * - * @return The Terminal Annuity in the Pay Currency - */ - - public double annuity() - { - return _dblNotional * _dblSurvival * _dblDF * _dblFX; - } - - /** - * Retrieve the Terminal Convexity Adjustment - * - * @return The Terminal Convexity Adjustment - */ - - public org.drip.analytics.output.ConvexityAdjustment convexityAdjustment() - { - return _convAdj; - } - - /** - * Retrieve the Terminal Survival Probability Loading Coefficient for the specified Credit Latent State - * - * @param creditLabel The Credit Label - * - * @return The Terminal Survival Probability Loading Coefficient for the specified Credit Latent State - */ - - public java.util.Map survivalProbabilityCreditLoading ( - final org.drip.state.identifier.CreditLabel creditLabel) - { - if (null == creditLabel || !creditLabel.match (_creditLabel)) return null; - - java.util.Map mapSurvivalProbabilityLoading = new - java.util.TreeMap(); - - mapSurvivalProbabilityLoading.put (_iPayDate, _dblNotional * _dblDF * _dblFX * - _convAdj.cumulative()); - - return mapSurvivalProbabilityLoading; - } - - /** - * Retrieve the Discount Factor Loading Coefficient for the specified Funding Latent State - * - * @param fundingLabel The Funding Label - * - * @return The Discount Factor Loading Coefficient for the specified Funding Latent State - */ - - public java.util.Map discountFactorFundingLoading ( - final org.drip.state.identifier.FundingLabel fundingLabel) - { - if (null == fundingLabel || !fundingLabel.match (_fundingLabel)) return null; - - java.util.Map mapDiscountFactorLoading = new - java.util.TreeMap(); - - mapDiscountFactorLoading.put (_iPayDate, _dblNotional * _dblSurvival * _dblFX * - _convAdj.cumulative()); - - return mapDiscountFactorLoading; - } - - /** - * Retrieve the FX Loading Coefficient for the specified FX Latent State - * - * @param fxLabel The FX Label - * - * @return The FX Loading Coefficient for the specified FX Latent State - */ - - public java.util.Map fxFXLoading ( - final org.drip.state.identifier.FXLabel fxLabel) - { - if (null == fxLabel || !fxLabel.match (_fxLabel)) return null; - - java.util.Map mapFXLoading = new - java.util.TreeMap(); - - mapFXLoading.put (_iPayDate, _dblNotional * _dblSurvival * _dblDF * _convAdj.cumulative()); - - return mapFXLoading; - } - - /** - * Retrieve the Credit Label - * - * @return The Credit Label - */ - - public org.drip.state.identifier.CreditLabel creditLabel() - { - return _creditLabel; - } - - /** - * Retrieve the Funding Label - * - * @return The Funding Label - */ - - public org.drip.state.identifier.FundingLabel fundingLabel() - { - return _fundingLabel; - } - - /** - * Retrieve the FX Label - * - * @return The FX Label - */ - - public org.drip.state.identifier.FXLabel fxLabel() - { - return _fxLabel; - } -} diff --git a/org/drip/analytics/output/ComponentMeasures.java b/org/drip/analytics/output/ComponentMeasures.java deleted file mode 100644 index adb3382..0000000 --- a/org/drip/analytics/output/ComponentMeasures.java +++ /dev/null @@ -1,561 +0,0 @@ - -package org.drip.analytics.output; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * ComponentMeasures is the place holder for analytical single component output measures, optionally across - * scenarios. It contains measure maps for the following scenarios: - * - Unadjusted Base IR/credit curves - * - Flat delta/gamma bump measure maps for IR/credit bump curves - * - Tenor bump double maps for IR/credit curves - * - Flat/recovery bumped measure maps for recovery bumped credit curves - * - Measure Maps generated for Custom Scenarios - * - Accessor Functions for the above fields - * - Serialize into and de-serialize out of byte arrays - * - * @author Lakshmi Krishnamurthy - */ - -public class ComponentMeasures { - private double _dblCalcTime = java.lang.Double.NaN; - private org.drip.analytics.support.CaseInsensitiveTreeMap _mapBaseMeasures = null; - private org.drip.analytics.support.CaseInsensitiveTreeMap _mapFlatIRDeltaMeasures = - null; - private org.drip.analytics.support.CaseInsensitiveTreeMap _mapFlatIRGammaMeasures = - null; - private org.drip.analytics.support.CaseInsensitiveTreeMap _mapFlatRRDeltaMeasures = - null; - private org.drip.analytics.support.CaseInsensitiveTreeMap _mapFlatRRGammaMeasures = - null; - private org.drip.analytics.support.CaseInsensitiveTreeMap _mapFlatCreditDeltaMeasures = - null; - private org.drip.analytics.support.CaseInsensitiveTreeMap _mapFlatCreditGammaMeasures = - null; - private - org.drip.analytics.support.CaseInsensitiveTreeMap> - _mmTenorIRDeltaMeasures = null; - private - org.drip.analytics.support.CaseInsensitiveTreeMap> - _mmTenorIRGammaMeasures = null; - private - org.drip.analytics.support.CaseInsensitiveTreeMap> - _mmTenorCreditDeltaMeasures = null; - private - org.drip.analytics.support.CaseInsensitiveTreeMap> - _mmTenorCreditGammaMeasures = null; - private - org.drip.analytics.support.CaseInsensitiveTreeMap> - _mmTenorRRDeltaMeasures = null; - private - org.drip.analytics.support.CaseInsensitiveTreeMap> - _mmTenorRRGammaMeasures = null; - private - org.drip.analytics.support.CaseInsensitiveTreeMap> - _mmCustomMeasures = null; - - /** - * Empty constructor - all members initialized to NaN or null - */ - - public ComponentMeasures() - { - } - - /** - * Retrieve the Calculation Time - * - * @return The Calculation Time - */ - - public double calcTime() - { - return _dblCalcTime; - } - - /** - * Set the Calculation Time - * - * @param dblCalcTime The Calculation Time - * - * @return TRUE - The Calculation Time Successfully Set - */ - - public boolean setCalcTime ( - final double dblCalcTime) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCalcTime)) return false; - - _dblCalcTime = dblCalcTime; - return true; - } - - /** - * Retrieve the Base Measure Map - * - * @return The Base Measure Map - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap baseMeasures() - { - return _mapBaseMeasures; - } - - /** - * Set the Base Measures Map - * - * @param mapBaseMeasures The Base Measures Map - * - * @return TRUE - The Base Measures Map Successfully Set - */ - - public boolean setBaseMeasures ( - final org.drip.analytics.support.CaseInsensitiveTreeMap mapBaseMeasures) - { - if (null == mapBaseMeasures || 0 == mapBaseMeasures.size()) return false; - - _mapBaseMeasures = mapBaseMeasures; - return true; - } - - /** - * Retrieve the Flat IR Delta Measure Map - * - * @return The Flat IR Delta Measure Map - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap flatIRDeltaMeasures() - { - return _mapFlatIRDeltaMeasures; - } - - /** - * Set the Flat IR Delta Measures Map - * - * @param mapFlatIRDeltaMeasures The Flat IR Delta Measures Map - * - * @return TRUE - The Flat IR Delta Measures Map Successfully Set - */ - - public boolean setFlatIRDeltaMeasures ( - final org.drip.analytics.support.CaseInsensitiveTreeMap mapFlatIRDeltaMeasures) - { - if (null == mapFlatIRDeltaMeasures || 0 == mapFlatIRDeltaMeasures.size()) return false; - - _mapFlatIRDeltaMeasures = mapFlatIRDeltaMeasures; - return true; - } - - /** - * Retrieve the Flat IR Gamma Measure Map - * - * @return The Flat IR Gamma Measure Map - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap flatIRGammaMeasures() - { - return _mapFlatIRGammaMeasures; - } - - /** - * Set the Flat IR Gamma Measures Map - * - * @param mapFlatIRGammaMeasures The Flat IR Gamma Measures Map - * - * @return TRUE - The Flat IR Gamma Measures Map Successfully Set - */ - - public boolean setFlatIRGammaMeasures ( - final org.drip.analytics.support.CaseInsensitiveTreeMap mapFlatIRGammaMeasures) - { - if (null == mapFlatIRGammaMeasures || 0 == mapFlatIRGammaMeasures.size()) return false; - - _mapFlatIRGammaMeasures = mapFlatIRGammaMeasures; - return true; - } - - /** - * Retrieve the Flat RR Delta Measure Map - * - * @return The Flat RR Delta Measure Map - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap flatRRDeltaMeasures() - { - return _mapFlatRRDeltaMeasures; - } - - /** - * Set the Flat RR Delta Measures Map - * - * @param mapFlatRRDeltaMeasures The Flat RR Delta Measures Map - * - * @return TRUE - The Flat RR Delta Measures Map Successfully Set - */ - - public boolean setFlatRRDeltaMeasures ( - final org.drip.analytics.support.CaseInsensitiveTreeMap mapFlatRRDeltaMeasures) - { - if (null == mapFlatRRDeltaMeasures || 0 == mapFlatRRDeltaMeasures.size()) return false; - - _mapFlatRRDeltaMeasures = mapFlatRRDeltaMeasures; - return true; - } - - /** - * Retrieve the Flat RR Gamma Measure Map - * - * @return The Flat RR Gamma Measure Map - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap flatRRGammaMeasures() - { - return _mapFlatRRGammaMeasures; - } - - /** - * Set the Flat RR Gamma Measures Map - * - * @param mapFlatRRGammaMeasures The Flat RR Gamma Measures Map - * - * @return TRUE - The Flat RR Gamma Measures Map Successfully Set - */ - - public boolean setFlatRRGammaMeasures ( - final org.drip.analytics.support.CaseInsensitiveTreeMap mapFlatRRGammaMeasures) - { - if (null == mapFlatRRGammaMeasures || 0 == mapFlatRRGammaMeasures.size()) return false; - - _mapFlatRRGammaMeasures = mapFlatRRGammaMeasures; - return true; - } - - /** - * Retrieve the Flat Credit Delta Measure Map - * - * @return The Flat Credit Delta Measure Map - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap flatCreditDeltaMeasures() - { - return _mapFlatCreditDeltaMeasures; - } - - /** - * Set the Flat Credit Delta Measures Map - * - * @param mapFlatCreditDeltaMeasures The Flat Credit Delta Measures Map - * - * @return TRUE - The Flat Credit Delta Measures Map Successfully Set - */ - - public boolean setFlatCreditDeltaMeasures ( - final org.drip.analytics.support.CaseInsensitiveTreeMap mapFlatCreditDeltaMeasures) - { - if (null == mapFlatCreditDeltaMeasures || 0 == mapFlatCreditDeltaMeasures.size()) return false; - - _mapFlatCreditDeltaMeasures = mapFlatCreditDeltaMeasures; - return true; - } - - /** - * Retrieve the Flat Credit Gamma Measure Map - * - * @return The Flat Credit Gamma Measure Map - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap flatCreditGammaMeasures() - { - return _mapFlatCreditGammaMeasures; - } - - /** - * Set the Flat Credit Gamma Measures Map - * - * @param mapFlatCreditGammaMeasures The Flat Credit Gamma Measures Map - * - * @return TRUE - The Flat Credit Gamma Measures Map Successfully Set - */ - - public boolean setFlatCreditGammaMeasures ( - final org.drip.analytics.support.CaseInsensitiveTreeMap mapFlatCreditGammaMeasures) - { - if (null == mapFlatCreditGammaMeasures || 0 == mapFlatCreditGammaMeasures.size()) return false; - - _mapFlatCreditGammaMeasures = mapFlatCreditGammaMeasures; - return true; - } - - /** - * Retrieve the Tenor IR Delta Double Measure Map - * - * @return The Tenor IR Delta Double Measure Map - */ - - public - org.drip.analytics.support.CaseInsensitiveTreeMap> - tenorIRDeltaMeasures() - { - return _mmTenorIRDeltaMeasures; - } - - /** - * Set the Tenor IR Delta Double Measures Map - * - * @param mmTenorIRDeltaMeasures The Tenor IR Delta Double Measures Map - * - * @return TRUE - The Tenor IR Delta Double Measures Map Successfully Set - */ - - public boolean setTenorIRDeltaMeasures ( - final - org.drip.analytics.support.CaseInsensitiveTreeMap> - mmTenorIRDeltaMeasures) - { - if (null == mmTenorIRDeltaMeasures || 0 == mmTenorIRDeltaMeasures.size()) return false; - - _mmTenorIRDeltaMeasures = mmTenorIRDeltaMeasures; - return true; - } - - /** - * Retrieve the Tenor IR Gamma Double Measure Map - * - * @return The Tenor IR Gamma Double Measure Map - */ - - public - org.drip.analytics.support.CaseInsensitiveTreeMap> - tenorIRGammaMeasures() - { - return _mmTenorIRGammaMeasures; - } - - /** - * Set the Tenor IR Gamma Double Measures Map - * - * @param mmTenorIRGammaMeasures The Tenor IR Gamma Double Measures Map - * - * @return TRUE - The Tenor IR Gamma Double Measures Map Successfully Set - */ - - public boolean setTenorIRGammaMeasures ( - final - org.drip.analytics.support.CaseInsensitiveTreeMap> - mmTenorIRGammaMeasures) - { - if (null == mmTenorIRGammaMeasures || 0 == mmTenorIRGammaMeasures.size()) return false; - - _mmTenorIRGammaMeasures = mmTenorIRGammaMeasures; - return true; - } - - /** - * Retrieve the Tenor Credit Delta Double Measure Map - * - * @return The Tenor Credit Delta Double Measure Map - */ - - public - org.drip.analytics.support.CaseInsensitiveTreeMap> - tenorCreditDeltaMeasures() - { - return _mmTenorCreditDeltaMeasures; - } - - /** - * Set the Tenor Credit Delta Double Measures Map - * - * @param mmTenorCreditDeltaMeasures The Tenor Credit Delta Double Measures Map - * - * @return TRUE - The Tenor Credit Delta Double Measures Map Successfully Set - */ - - public boolean setTenorCreditDeltaMeasures ( - final - org.drip.analytics.support.CaseInsensitiveTreeMap> - mmTenorCreditDeltaMeasures) - { - if (null == mmTenorCreditDeltaMeasures || 0 == mmTenorCreditDeltaMeasures.size()) return false; - - _mmTenorCreditDeltaMeasures = mmTenorCreditDeltaMeasures; - return true; - } - - /** - * Retrieve the Tenor Credit Gamma Double Measure Map - * - * @return The Tenor Credit Gamma Double Measure Map - */ - - public - org.drip.analytics.support.CaseInsensitiveTreeMap> - tenorCreditGammaMeasures() - { - return _mmTenorCreditGammaMeasures; - } - - /** - * Set the Tenor Credit Gamma Double Measures Map - * - * @param mmTenorCreditGammaMeasures The Tenor Credit Gamma Double Measures Map - * - * @return TRUE - The Tenor Credit Gamma Double Measures Map Successfully Set - */ - - public boolean setTenorCreditGammaMeasures ( - final - org.drip.analytics.support.CaseInsensitiveTreeMap> - mmTenorCreditGammaMeasures) - { - if (null == mmTenorCreditGammaMeasures || 0 == mmTenorCreditGammaMeasures.size()) return false; - - _mmTenorCreditGammaMeasures = mmTenorCreditGammaMeasures; - return true; - } - - /** - * Retrieve the Tenor RR Delta Double Measure Map - * - * @return The Tenor RR Delta Double Measure Map - */ - - public - org.drip.analytics.support.CaseInsensitiveTreeMap> - tenorRRDeltaMeasures() - { - return _mmTenorRRDeltaMeasures; - } - - /** - * Set the Tenor RR Delta Double Measures Map - * - * @param mmTenorRRDeltaMeasures The Tenor RR Delta Double Measures Map - * - * @return TRUE - The Tenor RR Delta Double Measures Map Successfully Set - */ - - public boolean setTenorRRDeltaMeasures ( - final - org.drip.analytics.support.CaseInsensitiveTreeMap> - mmTenorRRDeltaMeasures) - { - if (null == mmTenorRRDeltaMeasures || 0 == mmTenorRRDeltaMeasures.size()) return false; - - _mmTenorRRDeltaMeasures = mmTenorRRDeltaMeasures; - return true; - } - - /** - * Retrieve the Tenor RR Gamma Double Measure Map - * - * @return The Tenor RR Gamma Double Measure Map - */ - - public - org.drip.analytics.support.CaseInsensitiveTreeMap> - tenorRRGammaMeasures() - { - return _mmTenorRRGammaMeasures; - } - - /** - * Set the Tenor RR Gamma Double Measures Map - * - * @param mmTenorRRGammaMeasures The Tenor IR Gamma Double Measures Map - * - * @return TRUE - The Tenor RR Gamma Double Measures Map Successfully Set - */ - - public boolean setTenorRRGammaMeasures ( - final - org.drip.analytics.support.CaseInsensitiveTreeMap> - mmTenorRRGammaMeasures) - { - if (null == mmTenorRRGammaMeasures || 0 == mmTenorRRGammaMeasures.size()) return false; - - _mmTenorRRGammaMeasures = mmTenorRRGammaMeasures; - return true; - } - - /** - * Retrieve the Custom Double Measure Map - * - * @return The Custom Double Measure Map - */ - - public - org.drip.analytics.support.CaseInsensitiveTreeMap> - customMeasures() - { - return _mmCustomMeasures; - } - - /** - * Set the Custom Double Measures Map - * - * @param mmCustomMeasures The Custom Double Measures Map - * - * @return TRUE - The Custom Double Measures Map Successfully Set - */ - - public boolean setCustomMeasures ( - final - org.drip.analytics.support.CaseInsensitiveTreeMap> - mmCustomMeasures) - { - if (null == mmCustomMeasures || 0 == mmCustomMeasures.size()) return false; - - _mmCustomMeasures = mmCustomMeasures; - return true; - } -} diff --git a/org/drip/analytics/output/CompositePeriodAccrualMetrics.java b/org/drip/analytics/output/CompositePeriodAccrualMetrics.java deleted file mode 100644 index 712ace8..0000000 --- a/org/drip/analytics/output/CompositePeriodAccrualMetrics.java +++ /dev/null @@ -1,106 +0,0 @@ - -package org.drip.analytics.output; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * CompositePeriodAccrualMetrics holds the results of the compounded Composed period Accrual Metrics Estimate - * Output. - * - * @author Lakshmi Krishnamurthy - */ - -public class CompositePeriodAccrualMetrics extends org.drip.analytics.output.CompositePeriodCouponMetrics { - private int _iResetDate = java.lang.Integer.MIN_VALUE; - - /** - * CompositePeriodAccrualMetrics Instance from the list of the composite period metrics - * - * @param iResetDate Reset Date - * @param lsUPM List of Unit Period Metrics - * - * @return Instance of CompositePeriodAccrualMetrics - */ - - public static final CompositePeriodAccrualMetrics Create ( - final int iResetDate, - final java.util.List lsUPM) - { - try { - CompositePeriodAccrualMetrics cpam = new CompositePeriodAccrualMetrics (iResetDate, lsUPM); - - return cpam.initialize() ? cpam : null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - protected CompositePeriodAccrualMetrics ( - final int iResetDate, - final java.util.List lsUPM) - throws java.lang.Exception - { - super (lsUPM); - - _iResetDate = iResetDate; - } - - /** - * Retrieve the Reset Date - * - * @return The Reset Date - */ - - public int resetDate() - { - return _iResetDate; - } -} diff --git a/org/drip/analytics/output/CompositePeriodCouponMetrics.java b/org/drip/analytics/output/CompositePeriodCouponMetrics.java deleted file mode 100644 index fc40e14..0000000 --- a/org/drip/analytics/output/CompositePeriodCouponMetrics.java +++ /dev/null @@ -1,320 +0,0 @@ - -package org.drip.analytics.output; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * CompositePeriodCouponMetrics holds the results of the compounded Composed period Full Coupon Metrics - * Estimate Output. - * - * @author Lakshmi Krishnamurthy - */ - -public class CompositePeriodCouponMetrics { - private double _dblDCF = 0.; - private double _dblRate = 0.; - private double _dblCreditFX = 0.; - private double _dblForwardFX = 0.; - private double _dblFundingFX = 0.; - private double _dblCollateralFX = 0.; - private double _dblCreditForward = 0.; - private double _dblCreditFunding = 0.; - private double _dblForwardFunding = 0.; - private double _dblCollateralCredit = 0.; - private double _dblCollateralForward = 0.; - private double _dblCollateralFunding = 0.; - private java.util.List _lsUPM = null; - - /** - * CompositePeriodCouponMetrics Instance from the list of the composite period metrics - * - * @param lsUPM List of Unit Period Metrics - * - * @return Instance of CompositePeriodCouponMetrics - */ - - public static final CompositePeriodCouponMetrics Create ( - final java.util.List lsUPM) - { - try { - CompositePeriodCouponMetrics cpm = new CompositePeriodCouponMetrics (lsUPM); - - return cpm.initialize() ? cpm : null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - protected CompositePeriodCouponMetrics ( - final java.util.List lsUPM) - throws java.lang.Exception - { - if (null == (_lsUPM = lsUPM) || 0 == _lsUPM.size()) - throw new java.lang.Exception ("CompositePeriodCouponMetrics ctr: Invalid Inputs"); - } - - protected boolean initialize() - { - double dblAmount = 0.; - - for (org.drip.analytics.output.UnitPeriodMetrics upm : _lsUPM) { - org.drip.analytics.output.ConvexityAdjustment convAdj = upm.convAdj(); - - double dblUnitRate = upm.rate(); - - double dblUnitDCF = upm.dcf(); - - double dblUnitAmount = dblUnitDCF * dblUnitRate; - dblAmount += dblUnitAmount; - _dblDCF += dblUnitDCF; - - _dblCollateralCredit += convAdj.collateralCredit() * dblUnitDCF; - - _dblCollateralForward += convAdj.collateralForward() * dblUnitDCF; - - _dblCollateralFunding += convAdj.collateralFunding() * dblUnitDCF; - - _dblCollateralFX += convAdj.collateralFX() * dblUnitDCF; - - _dblCreditForward += convAdj.creditForward() * dblUnitDCF; - - _dblCreditFunding += convAdj.creditFunding() * dblUnitDCF; - - _dblCreditFX += convAdj.creditFX() * dblUnitDCF; - - _dblForwardFunding += convAdj.forwardFunding() * dblUnitDCF; - - _dblForwardFX += convAdj.forwardFX() * dblUnitDCF; - - _dblFundingFX += convAdj.fundingFX() * dblUnitDCF; - } - - _dblCollateralCredit /= _dblDCF; - _dblCollateralForward /= _dblDCF; - _dblCollateralFunding /= _dblDCF; - _dblCollateralFX /= _dblDCF; - _dblCreditForward /= _dblDCF; - _dblCreditFunding /= _dblDCF; - _dblCreditFX /= _dblDCF; - _dblForwardFunding /= _dblDCF; - _dblForwardFX /= _dblDCF; - _dblFundingFX /= _dblDCF; - _dblRate = dblAmount / _dblDCF; - return true; - } - - /** - * Retrieve the Composite DCF - * - * @return The Composite DCF - */ - - public double dcf() - { - return _dblDCF; - } - - /** - * Retrieve the Composite Rate - * - * @return The Composite Rate - */ - - public double rate() - { - return _dblRate; - } - - /** - * Retrieve the Collateral/Credit Convexity Adjustment - * - * @return The Collateral/Credit Convexity Adjustment - */ - - public double collateralCredit() - { - return _dblCollateralCredit; - } - - /** - * Retrieve the Collateral/Forward Convexity Adjustment - * - * @return The Collateral/Forward Convexity Adjustment - */ - - public double collateralForward() - { - return _dblCollateralForward; - } - - /** - * Retrieve the Collateral/Funding Convexity Adjustment - * - * @return The Collateral/Funding Convexity Adjustment - */ - - public double collateralFunding() - { - return _dblCollateralFunding; - } - - /** - * Retrieve the Collateral/FX Convexity Adjustment - * - * @return The Collateral/FX Convexity Adjustment - */ - - public double collateralFX() - { - return _dblCollateralFX; - } - - /** - * Retrieve the Credit/Forward Convexity Adjustment - * - * @return The Credit/Forward Convexity Adjustment - */ - - public double creditForward() - { - return _dblCreditForward; - } - - /** - * Retrieve the Credit/Funding Convexity Adjustment - * - * @return The Credit/Funding Convexity Adjustment - */ - - public double creditFunding() - { - return _dblCreditFunding; - } - - /** - * Retrieve the Credit/FX Convexity Adjustment - * - * @return The Credit/FX Convexity Adjustment - */ - - public double creditFX() - { - return _dblCreditFX; - } - - /** - * Retrieve the Forward/Funding Convexity Adjustment - * - * @return The Forward/Funding Convexity Adjustment - */ - - public double forwardFunding() - { - return _dblForwardFunding; - } - - /** - * Retrieve the Forward/FX Convexity Adjustment - * - * @return The Forward/FX Convexity Adjustment - */ - - public double forwardFX() - { - return _dblForwardFX; - } - - /** - * Retrieve the Funding/FX Convexity Adjustment - * - * @return The Funding/FX Convexity Adjustment - */ - - public double fundingFX() - { - return _dblFundingFX; - } - - /** - * Retrieve the Compounding Convexity Correction - * - * @return The Compounding Convexity Correction - */ - - public double compounding() - { - return _dblCollateralForward * _dblCreditForward * _dblForwardFunding * _dblForwardFX; - } - - /** - * Retrieve the Cumulative Convexity Correction - * - * @return The Cumulative Convexity Correction - */ - - public double cumulative() - { - return _dblCollateralCredit * _dblCollateralForward * _dblCollateralFunding * _dblCollateralFX * - _dblCreditForward * _dblCreditFunding * _dblCreditFX * _dblForwardFunding * _dblForwardFX * - _dblFundingFX; - } - - /** - * Retrieve the List of the Unit Period Metrics - * - * @return The List of the Unit Period Metrics - */ - - public java.util.List unitMetrics() - { - return _lsUPM; - } -} diff --git a/org/drip/analytics/output/ConvexityAdjustment.java b/org/drip/analytics/output/ConvexityAdjustment.java deleted file mode 100644 index 925de5f..0000000 --- a/org/drip/analytics/output/ConvexityAdjustment.java +++ /dev/null @@ -1,370 +0,0 @@ - -package org.drip.analytics.output; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ConvexityAdjustment holds the dynamical convexity Adjustments between the Latent States. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConvexityAdjustment { - private double _dblCollateralCredit = 1.; - private double _dblCollateralForward = 1.; - private double _dblCollateralFunding = 1.; - private double _dblCollateralFX = 1.; - private double _dblCreditForward = 1.; - private double _dblCreditFunding = 1.; - private double _dblCreditFX = 1.; - private double _dblForwardFunding = 1.; - private double _dblForwardFX = 1.; - private double _dblFundingFX = 1.; - - /** - * Empty ConvexityAdjustment Constructor - */ - - public ConvexityAdjustment() - { - } - - /** - * Set the Collateral/Credit Convexity Adjustment - * - * @param dblCollateralCredit The Collateral/Credit Convexity Adjustment - * - * @return TRUE - The Collateral/Credit Convexity Adjustment successfully set - */ - - public boolean setCollateralCredit ( - final double dblCollateralCredit) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCollateralCredit)) return false; - - _dblCollateralCredit = dblCollateralCredit; - return true; - } - - /** - * Retrieve the Collateral/Credit Convexity Adjustment - * - * @return The Collateral/Credit Convexity Adjustment - */ - - public double collateralCredit() - { - return _dblCollateralCredit; - } - - /** - * Set the Collateral/Forward Convexity Adjustment - * - * @param dblCollateralForward The Collateral/Forward Convexity Adjustment - * - * @return TRUE - The Collateral/Forward Convexity Adjustment successfully set - */ - - public boolean setCollateralForward ( - final double dblCollateralForward) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCollateralForward)) return false; - - _dblCollateralForward = dblCollateralForward; - return true; - } - - /** - * Retrieve the Collateral/Forward Convexity Adjustment - * - * @return The Collateral/Forward Convexity Adjustment - */ - - public double collateralForward() - { - return _dblCollateralForward; - } - - /** - * Set the Collateral/Funding Convexity Adjustment - * - * @param dblCollateralFunding The Collateral/Funding Convexity Adjustment - * - * @return TRUE - The Collateral/Funding Convexity Adjustment successfully set - */ - - public boolean setCollateralFunding ( - final double dblCollateralFunding) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCollateralFunding)) return false; - - _dblCollateralFunding = dblCollateralFunding; - return true; - } - - /** - * Retrieve the Collateral/Funding Convexity Adjustment - * - * @return The Collateral/Funding Convexity Adjustment - */ - - public double collateralFunding() - { - return _dblCollateralFunding; - } - - /** - * Set the Collateral/FX Convexity Adjustment - * - * @param dblCollateralFX The Collateral/FX Convexity Adjustment - * - * @return TRUE - The Collateral/FX Convexity Adjustment successfully set - */ - - public boolean setCollateralFX ( - final double dblCollateralFX) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCollateralFX)) return false; - - _dblCollateralFunding = dblCollateralFX; - return true; - } - - /** - * Retrieve the Collateral/FX Convexity Adjustment - * - * @return The Collateral/FX Convexity Adjustment - */ - - public double collateralFX() - { - return _dblCollateralFX; - } - - /** - * Set the Credit/Forward Convexity Adjustment - * - * @param dblCreditForward The Credit/Forward Convexity Adjustment - * - * @return TRUE - The Credit/Forward Convexity Adjustment successfully set - */ - - public boolean setCreditForward ( - final double dblCreditForward) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCreditForward)) return false; - - _dblCreditForward = dblCreditForward; - return true; - } - - /** - * Retrieve the Credit/Forward Convexity Adjustment - * - * @return The Credit/Forward Convexity Adjustment - */ - - public double creditForward() - { - return _dblCreditForward; - } - - /** - * Set the Credit/Funding Convexity Adjustment - * - * @param dblCreditFunding The Credit/Funding Convexity Adjustment - * - * @return TRUE - The Credit/Funding Convexity Adjustment successfully set - */ - - public boolean setCreditFunding ( - final double dblCreditFunding) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCreditFunding)) return false; - - _dblCreditFunding = dblCreditFunding; - return true; - } - - /** - * Retrieve the Credit/Funding Convexity Adjustment - * - * @return The Credit/Funding Convexity Adjustment - */ - - public double creditFunding() - { - return _dblCreditFunding; - } - - /** - * Set the Credit/FX Convexity Adjustment - * - * @param dblCreditFX The Credit/FX Convexity Adjustment - * - * @return TRUE - The Credit/FX Convexity Adjustment successfully set - */ - - public boolean setCreditFX ( - final double dblCreditFX) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCreditFX)) return false; - - _dblCreditFX = dblCreditFX; - return true; - } - - /** - * Retrieve the Credit/FX Convexity Adjustment - * - * @return The Credit/FX Convexity Adjustment - */ - - public double creditFX() - { - return _dblCreditFX; - } - - /** - * Set the Forward/Funding Convexity Adjustment - * - * @param dblForwardFunding The Forward/Funding Convexity Adjustment - * - * @return TRUE - The Forward/Funding Convexity Adjustment successfully set - */ - - public boolean setForwardFunding ( - final double dblForwardFunding) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblForwardFunding)) return false; - - _dblForwardFunding = dblForwardFunding; - return true; - } - - /** - * Retrieve the Forward/Funding Convexity Adjustment - * - * @return The Forward/Funding Convexity Adjustment - */ - - public double forwardFunding() - { - return _dblForwardFunding; - } - - /** - * Set the Forward/FX Convexity Adjustment - * - * @param dblForwardFX The Forward/FX Convexity Adjustment - * - * @return TRUE - The Forward/FX Convexity Adjustment successfully set - */ - - public boolean setForwardFX ( - final double dblForwardFX) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblForwardFX)) return false; - - _dblForwardFX = dblForwardFX; - return true; - } - - /** - * Retrieve the Forward/FX Convexity Adjustment - * - * @return The Forward/FX Convexity Adjustment - */ - - public double forwardFX() - { - return _dblForwardFX; - } - - /** - * Set the Funding/FX Convexity Adjustment - * - * @param dblFundingFX The Funding/FX Convexity Adjustment - * - * @return TRUE - The Funding/FX Convexity Adjustment successfully set - */ - - public boolean setFundingFX ( - final double dblFundingFX) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblFundingFX)) return false; - - _dblFundingFX = dblFundingFX; - return true; - } - - /** - * Retrieve the Funding/FX Convexity Adjustment - * - * @return The Funding/FX Convexity Adjustment - */ - - public double fundingFX() - { - return _dblFundingFX; - } - - /** - * Retrieve the Cumulative Convexity Correction - * - * @return The Cumulative Convexity Correction - */ - - public double cumulative() - { - return _dblCollateralCredit * _dblCollateralForward * _dblCollateralFunding * _dblCollateralFX * - _dblCreditForward * _dblCreditFunding * _dblCreditFX * _dblForwardFunding * _dblForwardFX * - _dblFundingFX; - } -} diff --git a/org/drip/analytics/output/ExerciseInfo.java b/org/drip/analytics/output/ExerciseInfo.java deleted file mode 100644 index c3d0655..0000000 --- a/org/drip/analytics/output/ExerciseInfo.java +++ /dev/null @@ -1,123 +0,0 @@ - -package org.drip.analytics.output; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * ExerciseInfo is a place-holder for the set of exercise information. It contains the exercise date, the - * exercise factor, and the exercise type. It also exposes methods to serialize/de-serialize off of byte - * arrays. - * - * @author Lakshmi Krishnamurthy - */ - -public class ExerciseInfo { - private int _iDate = java.lang.Integer.MIN_VALUE; - private double _dblExerciseFactor = java.lang.Double.NaN; - private int _iWOType = org.drip.param.valuation.WorkoutInfo.WO_TYPE_MATURITY; - - /** - * Constructs the ExerciseInfo from the work-out date, type, and the exercise factor - * - * @param iDate Work-out Date - * @param dblExerciseFactor Work-out Factor - * @param iWOType Work out Type - * - * @throws java.lang.Exception Thrown if input is invalid - */ - - public ExerciseInfo ( - final int iDate, - final double dblExerciseFactor, - final int iWOType) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblExerciseFactor = dblExerciseFactor)) - throw new java.lang.Exception ("ExerciseInfo ctr: Invalid Inputs!"); - - _iDate = iDate; - _iWOType = iWOType; - } - - /** - * Retrieve the Exercise Date - * - * @return The Exercise Date - */ - - public int date() - { - return _iDate; - } - - /** - * Retrieve the Exercise Factor - * - * @return The Exercise Factor - */ - - public double factor() - { - return _dblExerciseFactor; - } - - /** - * Retrieve the Work-out Type - * - * @return The Work-out Type - */ - - public int workoutType() - { - return _iWOType; - } -} diff --git a/org/drip/analytics/output/UnitPeriodConvexityMetrics.java b/org/drip/analytics/output/UnitPeriodConvexityMetrics.java deleted file mode 100644 index 91c7709..0000000 --- a/org/drip/analytics/output/UnitPeriodConvexityMetrics.java +++ /dev/null @@ -1,115 +0,0 @@ - -package org.drip.analytics.output; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * UnitPeriodMetrics holds the results of a unit composable period convexity metrics estimate output. - * - * @author Lakshmi Krishnamurthy - */ - -public class UnitPeriodConvexityMetrics { - private int _iEndDate = java.lang.Integer.MIN_VALUE; - private int _iStartDate = java.lang.Integer.MIN_VALUE; - private org.drip.analytics.output.ConvexityAdjustment _convAdj = null; - - /** - * UnitPeriodConvexityMetrics constructor - * - * @param iStartDate Metric Period Start Date - * @param iEndDate Metric Period End Date - * @param convAdj Coupon Period Convexity Adjustment - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public UnitPeriodConvexityMetrics ( - final int iStartDate, - final int iEndDate, - final org.drip.analytics.output.ConvexityAdjustment convAdj) - throws java.lang.Exception - { - if ((_iEndDate = iEndDate) < (_iStartDate = iStartDate) || null == (_convAdj = convAdj)) - throw new java.lang.Exception ("UnitPeriodConvexityMetrics ctr: Invalid Inputs"); - } - - /** - * Retrieve the Start Date - * - * @return The Start Date - */ - - public int startDate() - { - return _iStartDate; - } - - /** - * Retrieve the End Date - * - * @return The End Date - */ - - public int endDate() - { - return _iEndDate; - } - - /** - * Retrieve the Convexity Adjustment - * - * @return The Convexity Adjustment - */ - - public org.drip.analytics.output.ConvexityAdjustment convAdj() - { - return _convAdj; - } -} diff --git a/org/drip/analytics/output/UnitPeriodMetrics.java b/org/drip/analytics/output/UnitPeriodMetrics.java deleted file mode 100644 index 834b978..0000000 --- a/org/drip/analytics/output/UnitPeriodMetrics.java +++ /dev/null @@ -1,110 +0,0 @@ - -package org.drip.analytics.output; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * UnitPeriodMetrics holds the results of a unit composable period metrics estimate output. - * - * @author Lakshmi Krishnamurthy - */ - -public class UnitPeriodMetrics extends org.drip.analytics.output.UnitPeriodConvexityMetrics { - private double _dblDCF = java.lang.Double.NaN; - private double _dblRate = java.lang.Double.NaN; - - /** - * UnitPeriodMetrics constructor - * - * @param iStartDate Metric Period Start Date - * @param iEndDate Metric Period End Date - * @param dblDCF Coupon Period Coupon DCF - * @param dblRate Coupon Period Coupon Rate - * @param convAdj Coupon Period Convexity Adjustment - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public UnitPeriodMetrics ( - final int iStartDate, - final int iEndDate, - final double dblDCF, - final double dblRate, - final org.drip.analytics.output.ConvexityAdjustment convAdj) - throws java.lang.Exception - { - super (iStartDate, iEndDate, convAdj); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblDCF = dblDCF) || - !org.drip.quant.common.NumberUtil.IsValid (_dblRate = dblRate)) - throw new java.lang.Exception ("UnitPeriodMetrics ctr: Invalid Inputs"); - } - - /** - * Retrieve the Day Count Fraction - * - * @return The DCF - */ - - public double dcf() - { - return _dblDCF; - } - - /** - * Retrieve the Coupon Rate - * - * @return The Coupon Rate - */ - - public double rate() - { - return _dblRate; - } -} diff --git a/org/drip/analytics/support/CaseInsensitiveHashMap.java b/org/drip/analytics/support/CaseInsensitiveHashMap.java deleted file mode 100644 index c7077ac..0000000 --- a/org/drip/analytics/support/CaseInsensitiveHashMap.java +++ /dev/null @@ -1,86 +0,0 @@ - -package org.drip.analytics.support; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * CaseInsensitiveMap implements a case insensitive key in a hash map - * - * @author Michael Beer - */ - -@SuppressWarnings ("serial") public class CaseInsensitiveHashMap extends - java.util.HashMap -{ - @Override public V put ( - final java.lang.String strKey, - final V v) - { - return null == strKey ? null : super.put (strKey.toLowerCase(), v); - } - - @Override public V get ( - final java.lang.Object objKey) - { - return null == objKey ? null : super.get (((java.lang.String) objKey).toLowerCase()); - } - - @Override public boolean containsKey ( - final java.lang.Object objKey) - { - return null == objKey ? null : super.containsKey (((java.lang.String) objKey).toLowerCase()); - } - - @Override public V remove ( - final java.lang.Object objKey) - { - return null == objKey ? null : super.remove (((java.lang.String) objKey).toLowerCase()); - } -} diff --git a/org/drip/analytics/support/CaseInsensitiveTreeMap.java b/org/drip/analytics/support/CaseInsensitiveTreeMap.java deleted file mode 100644 index c2ba3c0..0000000 --- a/org/drip/analytics/support/CaseInsensitiveTreeMap.java +++ /dev/null @@ -1,89 +0,0 @@ - -package org.drip.analytics.support; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * CaseInsensitiveMap implements a case insensitive key in a hash map - * - * @author Michael Beer - */ - -@SuppressWarnings ("serial") public class CaseInsensitiveTreeMap extends - java.util.TreeMap -{ - @Override public V put ( - final java.lang.String strKey, - final V v) - { - return null == strKey ? null : super.put (strKey.toLowerCase(), v); - } - - @Override public V get ( - final java.lang.Object objKey) - { - return null == objKey || !(objKey instanceof java.lang.String) ? null : super.get - (((java.lang.String) objKey).toLowerCase()); - } - - @Override public boolean containsKey ( - final java.lang.Object objKey) - { - return null == objKey || !(objKey instanceof java.lang.String) ? null : super.containsKey - (((java.lang.String) objKey).toLowerCase()); - } - - @Override public V remove ( - final java.lang.Object objKey) - { - return null == objKey || !(objKey instanceof java.lang.String) ? null : super.remove - (((java.lang.String) objKey).toLowerCase()); - } -} diff --git a/org/drip/analytics/support/CompositePeriodBuilder.java b/org/drip/analytics/support/CompositePeriodBuilder.java deleted file mode 100644 index fafc4fc..0000000 --- a/org/drip/analytics/support/CompositePeriodBuilder.java +++ /dev/null @@ -1,897 +0,0 @@ - -package org.drip.analytics.support; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * CompositePeriodBuilder exposes the composite period construction functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class CompositePeriodBuilder { - - /** - * Edge Date Generation Sequence - Forward - */ - - public static final int EDGE_DATE_SEQUENCE_FORWARD = 0; - - /** - * Edge Date Generation Sequence - Reverse - */ - - public static final int EDGE_DATE_SEQUENCE_REVERSE = 1; - - /** - * Edge Date Generation Sequence - Regular - */ - - public static final int EDGE_DATE_SEQUENCE_REGULAR = 2; - - /** - * Edge Date Generation Sequence - Overnight - */ - - public static final int EDGE_DATE_SEQUENCE_OVERNIGHT = 4; - - /** - * Edge Date Generation Sequence - Single Edge Date Pair Between Dates - */ - - public static final int EDGE_DATE_SEQUENCE_SINGLE = 8; - - /** - * Period Set Generation Customization - Short Stub (i.e., No adjustment on either end) - */ - - public static final int SHORT_STUB = 0; - - /** - * Period Set Generation Customization - Merge the front periods to produce a long front - */ - - public static final int FULL_FRONT_PERIOD = 1; - - /** - * Period Set Generation Customization - Long Stub (if present) belongs to the front/back end depending - * upon backwards/forwards generation scheme - */ - - public static final int LONG_STUB = 2; - - /** - * Reference Period Fixing is IN-ARREARS (i.e., displaced one period to the right) of the Coupon Period - */ - - public static final int REFERENCE_PERIOD_IN_ARREARS = 0; - - /** - * Reference Period Fixing is IN-ADVANCE (i.e., the same as that) of the Coupon Period - */ - - public static final int REFERENCE_PERIOD_IN_ADVANCE = 1; - - /** - * Accrual Compounding Rule - Arithmetic - */ - - public static final int ACCRUAL_COMPOUNDING_RULE_ARITHMETIC = 1; - - /** - * Accrual Compounding Rule - Geometric - */ - - public static final int ACCRUAL_COMPOUNDING_RULE_GEOMETRIC = 2; - - private static final int DAPAdjust ( - final int iDate, - final org.drip.analytics.daycount.DateAdjustParams dap) - { - if (null == dap) return iDate; - - try { - return dap.roll (iDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return iDate; - } - - /** - * Verify if the Specified Accrual Compounding Rule is a Valid One - * - * @param iAccrualCompoundingRule The Accrual Compounding Rule - * - * @return TRUE - The Accrual Compounding Rule is valid - */ - - public static final boolean ValidateCompoundingRule ( - final int iAccrualCompoundingRule) - { - return ACCRUAL_COMPOUNDING_RULE_ARITHMETIC == iAccrualCompoundingRule || - ACCRUAL_COMPOUNDING_RULE_GEOMETRIC == iAccrualCompoundingRule; - } - - /** - * Generate a list of period edge dates forward from the start. - * - * @param dtEffective Effective date - * @param dtMaturity Maturity date - * @param strTenor Period Tenor - * @param dap Inner Date Adjustment Parameters - * @param iPSEC Period Set Edge Customizer Setting - * - * @return List of Period Edge Dates - */ - - public static final java.util.List ForwardEdgeDates ( - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity, - final java.lang.String strTenor, - final org.drip.analytics.daycount.DateAdjustParams dap, - final int iPSEC) - { - if (null == dtEffective || null == dtMaturity || null == strTenor || strTenor.isEmpty()) return null; - - java.lang.String strPeriodRollTenor = ""; - org.drip.analytics.date.JulianDate dtEdge = dtEffective; - - int iMaturityDate = dtMaturity.julian(); - - int iEdgeDate = dtEdge.julian(); - - if (iEdgeDate >= iMaturityDate) return null; - - java.util.List lsEdgeDate = new java.util.ArrayList(); - - while (iEdgeDate < iMaturityDate) { - lsEdgeDate.add (iEdgeDate); - - strPeriodRollTenor = org.drip.analytics.support.Helper.AggregateTenor - (strPeriodRollTenor, strTenor); - - if (null == (dtEdge = dtMaturity.addTenor (strPeriodRollTenor))) return null; - - iEdgeDate = dtEdge.julian(); - } - - if (iEdgeDate > iMaturityDate) { - if (SHORT_STUB == iPSEC) - lsEdgeDate.add (iMaturityDate); - else if (LONG_STUB == iPSEC) { - lsEdgeDate.remove (lsEdgeDate.size() - 1); - - lsEdgeDate.add (iMaturityDate); - } - } else if (iEdgeDate == iMaturityDate) - lsEdgeDate.add (iMaturityDate); - - if (null == dap) return lsEdgeDate; - - java.util.List lsAdjustedEdgeDate = new java.util.ArrayList(); - - lsAdjustedEdgeDate.add (lsEdgeDate.get (0)); - - int iNumDate = lsEdgeDate.size(); - - for (int i = 1; i < iNumDate - 1; ++i) - lsAdjustedEdgeDate.add (DAPAdjust (lsEdgeDate.get (i), dap)); - - lsAdjustedEdgeDate.add (lsEdgeDate.get (iNumDate - 1)); - - return lsAdjustedEdgeDate; - } - - /** - * Generate a list of period edge dates backward from the end. - * - * @param dtEffective Effective date - * @param dtMaturity Maturity date - * @param strTenor Period Tenor - * @param dap Inner Date Adjustment Parameters - * @param iPSEC Period Set Edge Customizer Setting - * - * @return List of Period Edge Dates - */ - - public static final java.util.List BackwardEdgeDates ( - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity, - final java.lang.String strTenor, - final org.drip.analytics.daycount.DateAdjustParams dap, - final int iPSEC) - { - if (null == dtEffective || null == dtMaturity || null == strTenor || strTenor.isEmpty()) return null; - - int iEffectiveDate = dtEffective.julian(); - - java.lang.String strPeriodRollTenor = ""; - org.drip.analytics.date.JulianDate dtEdge = dtMaturity; - - int iEdgeDate = dtEdge.julian(); - - if (iEffectiveDate >= iEdgeDate) return null; - - java.util.List lsEdgeDate = new java.util.ArrayList(); - - while (iEdgeDate > iEffectiveDate) { - lsEdgeDate.add (0, iEdgeDate); - - strPeriodRollTenor = org.drip.analytics.support.Helper.AggregateTenor (strPeriodRollTenor, - strTenor); - - if (null == (dtEdge = dtMaturity.subtractTenor (strPeriodRollTenor))) return null; - - iEdgeDate = dtEdge.julian(); - } - - if (iEdgeDate < iEffectiveDate) { - if (SHORT_STUB == iPSEC) - lsEdgeDate.add (0, iEffectiveDate); - else if (FULL_FRONT_PERIOD == iPSEC) - lsEdgeDate.add (0, iEdgeDate); - else if (LONG_STUB == iPSEC) { - lsEdgeDate.remove (0); - - lsEdgeDate.add (0, iEffectiveDate); - } - } else if (dtEdge.julian() == iEffectiveDate) - lsEdgeDate.add (0, iEffectiveDate); - - if (null == dap) return lsEdgeDate; - - java.util.List lsAdjustedEdgeDate = new java.util.ArrayList(); - - lsAdjustedEdgeDate.add (lsEdgeDate.get (0)); - - int iNumDate = lsEdgeDate.size(); - - for (int i = 1; i < iNumDate - 1; ++i) - lsAdjustedEdgeDate.add (DAPAdjust (lsEdgeDate.get (i), dap)); - - lsAdjustedEdgeDate.add (lsEdgeDate.get (iNumDate - 1)); - - return lsAdjustedEdgeDate; - } - - /** - * Generate a list of regular period edge dates forward from the start. - * - * @param dtEffective Effective date - * @param strPeriodTenor Period Tenor - * @param strMaturityTenor Period Tenor - * @param dap Inner Date Adjustment Parameters - * - * @return List of Period Edge Dates - */ - - public static final java.util.List RegularEdgeDates ( - final org.drip.analytics.date.JulianDate dtEffective, - final java.lang.String strPeriodTenor, - final java.lang.String strMaturityTenor, - final org.drip.analytics.daycount.DateAdjustParams dap) - { - if (null == dtEffective || null == strPeriodTenor || strPeriodTenor.isEmpty() || null == - strMaturityTenor || strMaturityTenor.isEmpty()) - return null; - - int iPeriodTenorMonth = -1; - int iMaturityTenorMonth = -1; - int iPeriodMaturityTenorComparison = -1; - - int iMaturityDate = dtEffective.addTenor (strMaturityTenor).julian(); - - java.util.List lsEdgeDate = new java.util.ArrayList(); - - try { - iPeriodMaturityTenorComparison = org.drip.analytics.support.Helper.TenorCompare (strPeriodTenor, - strMaturityTenor); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (org.drip.analytics.support.Helper.LEFT_TENOR_EQUALS == iPeriodMaturityTenorComparison || - org.drip.analytics.support.Helper.LEFT_TENOR_GREATER == iPeriodMaturityTenorComparison) { - lsEdgeDate.add (dtEffective.julian()); - - lsEdgeDate.add (iMaturityDate); - - return lsEdgeDate; - } - - try { - iPeriodTenorMonth = org.drip.analytics.support.Helper.TenorToMonths (strPeriodTenor); - - iMaturityTenorMonth = org.drip.analytics.support.Helper.TenorToMonths (strMaturityTenor); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.analytics.date.JulianDate dtEdge = dtEffective; - int iNumPeriod = iMaturityTenorMonth / iPeriodTenorMonth; - - lsEdgeDate.add (dtEdge.julian()); - - for (int i = 0; i < iNumPeriod; ++i) { - dtEdge = dtEdge.addTenor (strPeriodTenor); - - int iEdgeDate = dtEdge.julian(); - - if (iEdgeDate < iMaturityDate) lsEdgeDate.add (DAPAdjust (iEdgeDate, dap)); - } - - lsEdgeDate.add (iMaturityDate); - - return lsEdgeDate; - } - - /** - * Generate a list of regular period edge dates forward from the start. - * - * @param iStartDate Start Date - * @param iEndDate End Date - * @param strPeriodTenor Period Tenor - * @param dap Inner Date Adjustment Parameters - * - * @return List of Period Edge Dates - */ - - public static final java.util.List RegularEdgeDates ( - final int iStartDate, - final int iEndDate, - final java.lang.String strPeriodTenor, - final org.drip.analytics.daycount.DateAdjustParams dap) - { - if (iStartDate >= iEndDate || null == strPeriodTenor || strPeriodTenor.isEmpty()) return null; - - java.util.List lsEdgeDate = new java.util.ArrayList(); - - int iEdgeDate = iStartDate; - - org.drip.analytics.date.JulianDate dtEdge = new org.drip.analytics.date.JulianDate (iStartDate); - - while (iEdgeDate < iEndDate) { - lsEdgeDate.add (DAPAdjust (iEdgeDate, dap)); - - if (null == (dtEdge = dtEdge.addTenor (strPeriodTenor))) return null; - - iEdgeDate = dtEdge.julian(); - } - - lsEdgeDate.add (iEndDate); - - return lsEdgeDate; - } - - /** - * Generate a list of the IMM period edge dates forward from the spot date. - * - * @param dtSpot Spot Date - * @param iRollMonths Number of Months to Roll to the Next IMM Date - * @param strPeriodTenor Period Tenor - * @param strMaturityTenor Period Tenor - * @param dap Inner Date Adjustment Parameters - * - * @return List of IMM Period Edge Dates - */ - - public static final java.util.List IMMEdgeDates ( - final org.drip.analytics.date.JulianDate dtSpot, - final int iRollMonths, - final java.lang.String strPeriodTenor, - final java.lang.String strMaturityTenor, - final org.drip.analytics.daycount.DateAdjustParams dap) - { - if (null == dtSpot) return null; - - try { - return RegularEdgeDates (dtSpot.nextRatesFuturesIMM (iRollMonths), strPeriodTenor, - strMaturityTenor, dap); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the List of Overnight Edge Dates between the specified dates, using the specified Calendar - * - * @param dtStart Start Date - * @param dtEnd End Date - * @param strCalendar Calendar - * - * @return List of Overnight Edge Dates - */ - - public static final java.util.List OvernightEdgeDates ( - final org.drip.analytics.date.JulianDate dtStart, - final org.drip.analytics.date.JulianDate dtEnd, - final java.lang.String strCalendar) - { - if (null == dtStart || null == dtEnd) return null; - - org.drip.analytics.date.JulianDate dtEdge = dtStart; - - int iEndDate = dtEnd.julian(); - - int iEdgeDate = dtEdge.julian(); - - if (iEndDate <= iEdgeDate) return null; - - java.util.List lsOvernightEdgeDate = new java.util.ArrayList(); - - while (iEdgeDate < iEndDate) { - lsOvernightEdgeDate.add (iEdgeDate); - - if (null == (dtEdge = dtEdge.addBusDays (1, strCalendar))) return null; - - iEdgeDate = dtEdge.julian(); - } - - lsOvernightEdgeDate.add (iEndDate); - - return lsOvernightEdgeDate; - } - - /** - * Generate a single Spanning Edge Pair between the specified dates, using the specified Calendar - * - * @param dtStart Start Date - * @param dtEnd End Date - * - * @return List Containing the Pair - */ - - public static final java.util.List EdgePair ( - final org.drip.analytics.date.JulianDate dtStart, - final org.drip.analytics.date.JulianDate dtEnd) - { - if (null == dtStart || null == dtEnd) return null; - - int iEndDate = dtEnd.julian(); - - int iStartDate = dtStart.julian(); - - if (iEndDate <= iStartDate) return null; - - java.util.List lsOvernightEdgeDate = new java.util.ArrayList(); - - lsOvernightEdgeDate.add (iStartDate); - - lsOvernightEdgeDate.add (iEndDate); - - return lsOvernightEdgeDate; - } - - /** - * Construct a Reference Period using the Start/End Dates, Fixing DAP, Forward Label, and the Reference - * Period Arrears Type - * - * @param dtStart Start Date - * @param dtEnd End Date - * @param forwardLabel Forward Label - * @param iReferencePeriodArrearsType Reference Period Arrears Type - * - * @return The Reference Period - */ - - public static final org.drip.analytics.cashflow.ReferenceIndexPeriod MakeReferencePeriod ( - final org.drip.analytics.date.JulianDate dtStart, - final org.drip.analytics.date.JulianDate dtEnd, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final int iReferencePeriodArrearsType) - { - if (null == dtStart || null == dtEnd || null == forwardLabel) return null; - - java.lang.String strForwardTenor = forwardLabel.tenor(); - - int iReferencePeriodStartDate = REFERENCE_PERIOD_IN_ARREARS == iReferencePeriodArrearsType ? - dtStart.addTenor (strForwardTenor).julian() : dtStart.julian(); - - int iReferencePeriodEndDate = REFERENCE_PERIOD_IN_ARREARS == iReferencePeriodArrearsType ? - dtEnd.addTenor (strForwardTenor).julian() : dtEnd.julian(); - - try { - return new org.drip.analytics.cashflow.ReferenceIndexPeriod (iReferencePeriodStartDate, - iReferencePeriodEndDate, forwardLabel); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate a list of period edge dates forward from the start. - * - * @param iEffective Effective Date - * @param iMaturity Maturity Date - * @param strTenor Period Tenor - * @param dap Inner Date Adjustment Parameters - * @param iPSEC Period Set Edge Customizer Setting - * - * @return List of Period Edge Dates - */ - - public static final java.util.List ForwardEdgeDates ( - final int iEffective, - final int iMaturity, - final java.lang.String strTenor, - final org.drip.analytics.daycount.DateAdjustParams dap, - final int iPSEC) - { - return ForwardEdgeDates (new org.drip.analytics.date.JulianDate (iEffective), new - org.drip.analytics.date.JulianDate (iMaturity), strTenor, dap, iPSEC); - } - - /** - * Generate a list of period edge dates backward from the end. - * - * @param iEffective Effective Date - * @param iMaturity Maturity Date - * @param strTenor Period Tenor - * @param dap Inner Date Adjustment Parameters - * @param iPSEC Period Set Edge Customizer Setting - * - * @return List of Period Edge Dates - */ - - public static final java.util.List BackwardEdgeDates ( - final int iEffective, - final int iMaturity, - final java.lang.String strTenor, - final org.drip.analytics.daycount.DateAdjustParams dap, - final int iPSEC) - { - return BackwardEdgeDates (new org.drip.analytics.date.JulianDate (iEffective), new - org.drip.analytics.date.JulianDate (iMaturity), strTenor, dap, iPSEC); - } - - /** - * Generate a list of regular period edge dates forward from the start. - * - * @param iEffective Effective Date - * @param strPeriodTenor Period Tenor - * @param strMaturityTenor Period Tenor - * @param dap Inner Date Adjustment Parameters - * - * @return List of Period Edge Dates - */ - - public static final java.util.List RegularEdgeDates ( - final int iEffective, - final java.lang.String strPeriodTenor, - final java.lang.String strMaturityTenor, - final org.drip.analytics.daycount.DateAdjustParams dap) - { - return RegularEdgeDates (new org.drip.analytics.date.JulianDate (iEffective), strPeriodTenor, - strMaturityTenor, dap); - } - - /** - * Generate the List of Overnight Edge Dates between the specified dates, using the specified Calendar - * - * @param iStartDate Start Date - * @param iEndDate End Date - * @param strCalendar Calendar - * - * @return List of Overnight Edge Dates - */ - - public static final java.util.List OvernightEdgeDates ( - final int iStartDate, - final int iEndDate, - final java.lang.String strCalendar) - { - return OvernightEdgeDates (new org.drip.analytics.date.JulianDate (iStartDate), new - org.drip.analytics.date.JulianDate (iEndDate), strCalendar); - } - - /** - * Construct a Reference Period using the Start/End Dates, Fixing DAP, Forward Label, and the Reference - * Period Arrears Type - * - * @param iStartDate Start Date - * @param iEndDate End Date - * @param forwardLabel Forward Label - * @param iReferencePeriodArrearsType Reference Period Arrears Type - * - * @return The Reference Period - */ - - public static final org.drip.analytics.cashflow.ReferenceIndexPeriod MakeReferencePeriod ( - final int iStartDate, - final int iEndDate, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final int iReferencePeriodArrearsType) - { - return MakeReferencePeriod (new org.drip.analytics.date.JulianDate (iStartDate), new - org.drip.analytics.date.JulianDate (iEndDate), forwardLabel, iReferencePeriodArrearsType); - } - - /** - * Retrieve the List of Edge Dates across all Units - * - * @param iUnitPeriodStartDate Unit Period Start Date - * @param iUnitPeriodEndDate Unit Period End Date - * @param strCalendar Unit Date Generation Calendar - * @param cubs Composable Unit Builder Setting - * - * @return List of Edge Dates across all Units - */ - - public static final java.util.List UnitDateEdges ( - final int iUnitPeriodStartDate, - final int iUnitPeriodEndDate, - final java.lang.String strCalendar, - final org.drip.param.period.ComposableUnitBuilderSetting cubs) - { - if (null == cubs) return null; - - int iEdgeDateSequenceScheme = cubs.edgeDateSequenceScheme(); - - if (EDGE_DATE_SEQUENCE_SINGLE == iEdgeDateSequenceScheme) { - if (iUnitPeriodStartDate >= iUnitPeriodEndDate) return null; - - java.util.List lsEdgeDates = new java.util.ArrayList(); - - lsEdgeDates.add (iUnitPeriodStartDate); - - lsEdgeDates.add (iUnitPeriodEndDate); - - return lsEdgeDates; - } - - if (EDGE_DATE_SEQUENCE_REGULAR == iEdgeDateSequenceScheme) - return RegularEdgeDates (iUnitPeriodStartDate, iUnitPeriodEndDate, cubs.tenor(), cubs.dapEdge()); - - if (EDGE_DATE_SEQUENCE_OVERNIGHT == iEdgeDateSequenceScheme) - return OvernightEdgeDates (iUnitPeriodStartDate, iUnitPeriodEndDate, strCalendar); - - return null; - } - - /** - * Construct the List of Composable Fixed Units from the inputs - * - * @param iUnitPeriodStartDate Unit Period Start Date - * @param iUnitPeriodEndDate Unit Period End Date - * @param ucas Unit Coupon/Accrual Setting - * @param cfus Composable Fixed Unit Setting - * - * @return The List of Composable Floating Units - */ - - public static final java.util.List FixedUnits ( - final int iUnitPeriodStartDate, - final int iUnitPeriodEndDate, - final org.drip.param.period.UnitCouponAccrualSetting ucas, - final org.drip.param.period.ComposableFixedUnitSetting cfus) - { - if (null == cfus) return null; - - java.util.List lsUnitEdgeDate = UnitDateEdges (iUnitPeriodStartDate, - iUnitPeriodEndDate, ucas.calendar(), cfus); - - if (null == lsUnitEdgeDate) return null; - - int iNumDate = lsUnitEdgeDate.size(); - - if (2 > iNumDate) return null; - - java.util.List lsCUP = new - java.util.ArrayList(); - - for (int i = 1; i < iNumDate; ++i) { - try { - lsCUP.add (new org.drip.analytics.cashflow.ComposableUnitFixedPeriod (lsUnitEdgeDate.get - (i - 1), lsUnitEdgeDate.get (i), ucas, cfus)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return lsCUP; - } - - /** - * Construct the List of Composable Floating Units from the inputs - * - * @param iUnitPeriodStartDate Unit Period Start Date - * @param iUnitPeriodEndDate Unit Period End Date - * @param cfus Composable Floating Unit Setting - * - * @return The List of Composable Floating Units - */ - - public static final java.util.List FloatingUnits ( - final int iUnitPeriodStartDate, - final int iUnitPeriodEndDate, - final org.drip.param.period.ComposableFloatingUnitSetting cfus) - { - if (null == cfus) return null; - - org.drip.state.identifier.ForwardLabel forwardLabel = cfus.forwardLabel(); - - java.lang.String strCalendar = forwardLabel.floaterIndex().calendar(); - - java.util.List lsUnitEdgeDate = UnitDateEdges (iUnitPeriodStartDate, - iUnitPeriodEndDate, strCalendar, cfus); - - if (null == lsUnitEdgeDate) return null; - - int iNumDate = lsUnitEdgeDate.size(); - - if (2 > iNumDate) return null; - - java.util.List lsCUP = new - java.util.ArrayList(); - - double dblSpread = cfus.spread(); - - java.lang.String strUnitTenor = cfus.tenor(); - - java.lang.String strForwardTenor = forwardLabel.tenor(); - - int iReferencePeriodArrearsType = cfus.referencePeriodArrearsType(); - - boolean bComposableForwardPeriodsMatch = cfus.tenor().equalsIgnoreCase (strForwardTenor); - - for (int i = 1; i < iNumDate; ++i) { - int iUnitStartDate = lsUnitEdgeDate.get (i - 1); - - int iUnitEndDate = lsUnitEdgeDate.get (i); - - int iReferencePeriodEndDate = iUnitEndDate; - - int iReferencePeriodStartDate = bComposableForwardPeriodsMatch ? iUnitStartDate : new - org.drip.analytics.date.JulianDate (iUnitEndDate).subtractTenorAndAdjust (strForwardTenor, - strCalendar).julian(); - - try { - lsCUP.add (new org.drip.analytics.cashflow.ComposableUnitFloatingPeriod (iUnitStartDate, - iUnitEndDate, strUnitTenor, MakeReferencePeriod (iReferencePeriodStartDate, - iReferencePeriodEndDate, forwardLabel, iReferencePeriodArrearsType), dblSpread)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return lsCUP; - } - - /** - * Construct the List of Composite Fixed Periods from the corresponding composable Fixed Period Units - * - * @param lsCompositeEdgeDate The Composite Period Edge Dates - * @param cps Composite Period Setting Instance - * @param ucas Unit Coupon/Accrual Setting - * @param cfus Composable Fixed Unit Setting - * - * @return List of Composite Fixed Periods - */ - - public static final java.util.List FixedCompositeUnit ( - final java.util.List lsCompositeEdgeDate, - final org.drip.param.period.CompositePeriodSetting cps, - final org.drip.param.period.UnitCouponAccrualSetting ucas, - final org.drip.param.period.ComposableFixedUnitSetting cfus) - { - if (null == lsCompositeEdgeDate) return null; - - int iNumEdge = lsCompositeEdgeDate.size(); - - if (2 > iNumEdge) return null; - - java.util.List lsCFP = new - java.util.ArrayList(); - - for (int i = 1; i < iNumEdge; ++i) { - try { - lsCFP.add (new org.drip.analytics.cashflow.CompositeFixedPeriod (cps, FixedUnits - (lsCompositeEdgeDate.get (i - 1), lsCompositeEdgeDate.get (i), ucas, cfus))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return lsCFP; - } - - /** - * Construct the List of Composite Floating Period from the corresponding composable Floating Period Units - * - * @param lsCompositeEdgeDate The Composite Period Edge Dates - * @param cps Composite Period Setting Instance - * @param cfus Composable Floating Unit Setting - * - * @return List of Composite Floating Periods - */ - - public static final java.util.List FloatingCompositeUnit ( - final java.util.List lsCompositeEdgeDate, - final org.drip.param.period.CompositePeriodSetting cps, - final org.drip.param.period.ComposableFloatingUnitSetting cfus) - { - if (null == lsCompositeEdgeDate) return null; - - int iNumEdge = lsCompositeEdgeDate.size(); - - if (2 > iNumEdge) return null; - - java.util.List lsCFP = new - java.util.ArrayList(); - - for (int i = 1; i < iNumEdge; ++i) { - try { - lsCFP.add (new org.drip.analytics.cashflow.CompositeFloatingPeriod (cps, FloatingUnits - (lsCompositeEdgeDate.get (i - 1), lsCompositeEdgeDate.get (i), cfus))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return lsCFP; - } -} diff --git a/org/drip/analytics/support/ForwardDecompositionUtil.java b/org/drip/analytics/support/ForwardDecompositionUtil.java deleted file mode 100644 index 4594345..0000000 --- a/org/drip/analytics/support/ForwardDecompositionUtil.java +++ /dev/null @@ -1,194 +0,0 @@ - -package org.drip.analytics.support; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ForwardDecompositionUtil contains the utility functions needed to carry out periodic decomposition at MTM - * sync points for the given stream. - * - * @author Lakshmi Krishnamurthy - */ - -public class ForwardDecompositionUtil { - - /** - * Decompose the Stream into an Array of Single Forward Period Floating Streams - * - * @param fs The Stream - * @param iNumPeriodsToAccumulate Number of Forward Periods to roll into one - * - * @return The Array of Single Forward Period Streams - */ - - public static final org.drip.product.rates.Stream[] SinglePeriodStreamDecompose ( - final org.drip.product.rates.Stream fs, - final int iNumPeriodsToAccumulate) - { - if (null == fs) return null; - - java.util.List lsCouponFlow = fs.cashFlowPeriod(); - - int iNumPeriods = lsCouponFlow.size(); - - int iCFPIndex = 0; - int iNumPeriodsAccumulated = 0; - int iNumForward = iNumPeriods / iNumPeriodsToAccumulate; - org.drip.product.rates.Stream[] aFS = new org.drip.product.rates.Stream[iNumForward]; - - java.util.List> lslsCouponPeriod = new - java.util.ArrayList>(); - - for (int i = 0; i < iNumForward; ++i) - lslsCouponPeriod.add (new java.util.ArrayList()); - - for (org.drip.analytics.cashflow.CompositePeriod cfp : lsCouponFlow) { - java.util.List lsCouponPeriod = lslsCouponPeriod.get - (iCFPIndex); - - lsCouponPeriod.add (cfp); - - if (++iNumPeriodsAccumulated != iNumPeriodsToAccumulate) continue; - - iNumPeriodsAccumulated = 0; - - try { - aFS[iCFPIndex++] = new org.drip.product.rates.Stream (lsCouponPeriod); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return aFS; - } - - /** - * Decompose the Dual Stream Component into an Array of Single Forward Period Dual Streams - * - * @param dsc The Dual Stream - * - * @return The Array of Single Forward Period Dual Streams - */ - - public static final org.drip.product.definition.CalibratableComponent[] DualStreamForwardArray ( - final org.drip.product.rates.DualStreamComponent dsc) - { - if (null == dsc) return null; - - org.drip.product.rates.Stream streamDerived = dsc.derivedStream(); - - org.drip.product.rates.Stream streamReference = dsc.referenceStream(); - - int iNumForward = 0; - org.drip.product.rates.Stream[] aStreamDerivedForward = null; - org.drip.product.rates.Stream[] aStreamReferenceForward = null; - - int iDerivedStreamTenorMonths = 12 / streamDerived.freq(); - - int iReferenceStreamTenorMonths = 12 / streamReference.freq(); - - if (iReferenceStreamTenorMonths > iDerivedStreamTenorMonths) { - if (null == (aStreamReferenceForward = SinglePeriodStreamDecompose (streamReference, 1)) || 0 == - (iNumForward = aStreamReferenceForward.length)) - return null; - - if (null == (aStreamDerivedForward = SinglePeriodStreamDecompose (streamDerived, - iReferenceStreamTenorMonths / iDerivedStreamTenorMonths)) || iNumForward != - aStreamDerivedForward.length) - return null; - } else { - if (null == (aStreamDerivedForward = SinglePeriodStreamDecompose (streamDerived, 1)) || 0 == - (iNumForward = aStreamDerivedForward.length)) - return null; - - if (null == (aStreamReferenceForward = SinglePeriodStreamDecompose (streamReference, - iDerivedStreamTenorMonths / iReferenceStreamTenorMonths)) || iNumForward != - aStreamReferenceForward.length) - return null; - } - - org.drip.product.definition.CalibratableComponent[] aRC = new - org.drip.product.definition.CalibratableComponent[iNumForward]; - - for (int i = 0; i < iNumForward; ++i) { - try { - if (null == (aRC[i] = org.drip.product.creator.DualStreamComponentBuilder.MakeFloatFloat - (aStreamReferenceForward[i], aStreamDerivedForward[i], new - org.drip.param.valuation.CashSettleParams (0, streamDerived.couponCurrency(), 0)))) - return null; - - aRC[i].setPrimaryCode (streamReference.name() + "::" + streamDerived.name() + "_" + i); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return aRC; - } - - /** - * Decompose the Rates Component into an Array of Single Forward Rates Components - * - * @param rc The Rates Component - * - * @return The Array of Single Forward Period Rates Components - */ - - public static final org.drip.product.definition.CalibratableComponent[] - CalibratableFixedIncomeComponentForwardArray ( - final org.drip.product.definition.CalibratableComponent rc) - { - return null != rc && rc instanceof org.drip.product.rates.DualStreamComponent ? - DualStreamForwardArray ((org.drip.product.rates.DualStreamComponent) rc) : null; - } -} diff --git a/org/drip/analytics/support/FuturesHelper.java b/org/drip/analytics/support/FuturesHelper.java deleted file mode 100644 index 81a1ecd..0000000 --- a/org/drip/analytics/support/FuturesHelper.java +++ /dev/null @@ -1,302 +0,0 @@ - -package org.drip.analytics.support; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FuturesHelper contains the Collection of the Futures Valuation related Utility Functions. - * - * @author Lakshmi Krishnamurthy - */ - -public class FuturesHelper { - - /** - * Compute the Forward Bond Price Using the Implied Bond Yield - * - * @param bond The Bond Instance - * @param valParamsSpot The Spot Valuation Parameters - * @param valParamsForward The Forward Valuation Parameters - * @param csqc The Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCleanPrice The Clean Bond Price - * - * @return The Forward Bond Price Using the Implied Bond Yield - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final double ForwardBondYieldPrice ( - final org.drip.product.definition.Bond bond, - final org.drip.param.valuation.ValuationParams valParamsSpot, - final org.drip.param.valuation.ValuationParams valParamsForward, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCleanPrice) - throws java.lang.Exception - { - if (null == bond) - throw new java.lang.Exception ("FuturesHelper::ForwardBondYieldPrice => Invalid Inputs"); - - return bond.priceFromYield (valParamsForward, csqc, vcp, bond.yieldFromPrice (valParamsSpot, csqc, - vcp, dblCleanPrice)); - } - - /** - * Compute the Forward Bond Price Using the Implied Bond Z Spread - * - * @param bond The Bond Instance - * @param valParamsSpot The Spot Valuation Parameters - * @param valParamsForward The Forward Valuation Parameters - * @param csqc The Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCleanPrice The Clean Bond Price - * - * @return The Forward Bond Price Using the Implied Bond Z Spread - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final double ForwardBondZSpreadPrice ( - final org.drip.product.definition.Bond bond, - final org.drip.param.valuation.ValuationParams valParamsSpot, - final org.drip.param.valuation.ValuationParams valParamsForward, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCleanPrice) - throws java.lang.Exception - { - if (null == bond) - throw new java.lang.Exception ("FuturesHelper::ForwardBondZSpreadPrice => Invalid Inputs"); - - return bond.priceFromZSpread (valParamsForward, csqc, vcp, bond.zspreadFromPrice (valParamsSpot, - csqc, vcp, dblCleanPrice)); - } - - /** - * Compute the Forward Bond Price Using the Implied Bond OAS - * - * @param bond The Bond Instance - * @param valParamsSpot The Spot Valuation Parameters - * @param valParamsForward The Forward Valuation Parameters - * @param csqc The Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCleanPrice The Clean Bond Price - * - * @return The Forward Bond Price Using the Implied Bond OAS - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final double ForwardBondOASPrice ( - final org.drip.product.definition.Bond bond, - final org.drip.param.valuation.ValuationParams valParamsSpot, - final org.drip.param.valuation.ValuationParams valParamsForward, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCleanPrice) - throws java.lang.Exception - { - if (null == bond) - throw new java.lang.Exception ("FuturesHelper::ForwardBondOASPrice => Invalid Inputs"); - - return bond.priceFromOAS (valParamsForward, csqc, vcp, bond.oasFromPrice (valParamsSpot, csqc, vcp, - dblCleanPrice)); - } - - /** - * Compute the Forward Bond Price Using the Implied Bond Credit Basis - * - * @param bond The Bond Instance - * @param valParamsSpot The Spot Valuation Parameters - * @param valParamsForward The Forward Valuation Parameters - * @param csqc The Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCleanPrice The Clean Bond Price - * - * @return The Forward Bond Price Using the Implied Bond Credit Basis - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final double ForwardBondCreditPrice ( - final org.drip.product.definition.Bond bond, - final org.drip.param.valuation.ValuationParams valParamsSpot, - final org.drip.param.valuation.ValuationParams valParamsForward, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCleanPrice) - throws java.lang.Exception - { - if (null == bond) - throw new java.lang.Exception ("FuturesHelper::ForwardBondCreditPrice => Invalid Inputs"); - - return bond.priceFromCreditBasis (valParamsForward, csqc, vcp, bond.creditBasisFromPrice - (valParamsSpot, csqc, vcp, dblCleanPrice)); - } - - /** - * Compute the Forward Bond Price Using the Implied Bond Yield - * - * @param bond The Bond Instance - * @param dtSpot The Spot Date - * @param dtForward The Forward Date - * @param csqc The Market Parameters - * @param dblCleanPrice The Clean Bond Price - * - * @return The Forward Bond Price Using the Implied Bond Yield - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final double ForwardBondYieldPrice ( - final org.drip.product.definition.Bond bond, - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.analytics.date.JulianDate dtForward, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final double dblCleanPrice) - throws java.lang.Exception - { - if (null == bond || null == dtSpot || null == dtForward) - throw new java.lang.Exception ("FuturesHelper::ForwardBondYieldPrice => Invalid Inputs"); - - return bond.priceFromYield (org.drip.param.valuation.ValuationParams.Spot (dtForward.julian()), csqc, - null, bond.yieldFromPrice (org.drip.param.valuation.ValuationParams.Spot (dtSpot.julian()), csqc, - null, dblCleanPrice)); - } - - /** - * Compute the Forward Bond Price Using the Implied Bond Z Spread - * - * @param bond The Bond Instance - * @param dtSpot The Spot Date - * @param dtForward The Forward Date - * @param csqc The Market Parameters - * @param dblCleanPrice The Clean Bond Price - * - * @return The Forward Bond Price Using the Implied Bond Z Spread - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final double ForwardBondZSpreadPrice ( - final org.drip.product.definition.Bond bond, - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.analytics.date.JulianDate dtForward, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final double dblCleanPrice) - throws java.lang.Exception - { - if (null == bond || null == dtSpot || null == dtForward) - throw new java.lang.Exception ("FuturesHelper::ForwardBondZSpreadPrice => Invalid Inputs"); - - return bond.priceFromZSpread (org.drip.param.valuation.ValuationParams.Spot (dtForward.julian()), - csqc, null, bond.zspreadFromPrice (org.drip.param.valuation.ValuationParams.Spot - (dtSpot.julian()), csqc, null, dblCleanPrice)); - } - - /** - * Compute the Forward Bond Price Using the Implied Bond OAS - * - * @param bond The Bond Instance - * @param dtSpot The Spot Date - * @param dtForward The Forward Date - * @param csqc The Market Parameters - * @param dblCleanPrice The Clean Bond Price - * - * @return The Forward Bond Price Using the Implied Bond OAS - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final double ForwardBondOASPrice ( - final org.drip.product.definition.Bond bond, - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.analytics.date.JulianDate dtForward, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final double dblCleanPrice) - throws java.lang.Exception - { - if (null == bond || null == dtSpot || null == dtForward) - throw new java.lang.Exception ("FuturesHelper::ForwardBondOASPrice => Invalid Inputs"); - - return bond.priceFromOAS (org.drip.param.valuation.ValuationParams.Spot (dtForward.julian()), csqc, - null, bond.oasFromPrice (org.drip.param.valuation.ValuationParams.Spot (dtSpot.julian()), csqc, - null, dblCleanPrice)); - } - - /** - * Compute the Forward Bond Price Using the Implied Bond Credit Basis - * - * @param bond The Bond Instance - * @param dtSpot The Spot Date - * @param dtForward The Forward Date - * @param csqc The Market Parameters - * @param dblCleanPrice The Clean Bond Price - * - * @return The Forward Bond Price Using the Implied Bond Credit Basis - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final double ForwardBondCreditPrice ( - final org.drip.product.definition.Bond bond, - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.analytics.date.JulianDate dtForward, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final double dblCleanPrice) - throws java.lang.Exception - { - if (null == bond || null == dtSpot || null == dtForward) - throw new java.lang.Exception ("FuturesHelper::ForwardBondCreditPrice => Invalid Inputs"); - - return bond.priceFromCreditBasis (org.drip.param.valuation.ValuationParams.Spot (dtForward.julian()), - csqc, null, bond.creditBasisFromPrice (org.drip.param.valuation.ValuationParams.Spot - (dtSpot.julian()), csqc, null, dblCleanPrice)); - } -} diff --git a/org/drip/analytics/support/Helper.java b/org/drip/analytics/support/Helper.java deleted file mode 100644 index 4b513ae..0000000 --- a/org/drip/analytics/support/Helper.java +++ /dev/null @@ -1,1157 +0,0 @@ - -package org.drip.analytics.support; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * AnalyticsHelper contains the collection of the analytics related utility functions used by the modules. - * The following are the functionality that it exposes: - * - Yield to Discount Factor, and vice versa. - * - Map Bloomberg Day Count Codes to Credit Analytics Day Count Codes - * - Generate rule-based curve node manifest measure bumps - * - Generate loss periods using a variety of different schemes - * - Aggregate/disaggregate/merge coupon period lists - * - Create fixings objects, rate index from currency/coupon/frequency - * - String Tenor/Month Code/Work-out - * - Standard Treasury Bench-mark off of Maturity - * - * @author Lakshmi Krishnamurthy - */ - -public class Helper { - - /** - * Tenor Comparator - Left Tenor Greater than Right - */ - - public static int LEFT_TENOR_GREATER = 1; - - /** - * Tenor Comparator - Left Tenor Lesser than Right - */ - - public static int LEFT_TENOR_LESSER = 2; - - /** - * Tenor Comparator - Left Tenor Matches Right - */ - - public static int LEFT_TENOR_EQUALS = 4; - - private static final org.drip.analytics.support.CaseInsensitiveTreeMap s_mapIRSwitch = - new org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private static final java.util.Map s_mapDCBBGCode = new - java.util.HashMap(); - - /** - * Initialize IR switcher and Bloomberg day count maps - */ - - public static final void Init() - { - s_mapDCBBGCode.put (1, "ACT/ACT"); - - s_mapDCBBGCode.put (2, "ACT/360"); - - s_mapDCBBGCode.put (3, "ACT/365"); - - s_mapDCBBGCode.put (4, "30/ACT"); - - s_mapDCBBGCode.put (5, "30/360"); - - s_mapDCBBGCode.put (6, "30/365"); - - s_mapDCBBGCode.put (7, "NL/ACT"); - - s_mapDCBBGCode.put (8, "NL/360"); - - s_mapDCBBGCode.put (9, "NL/365"); - - s_mapDCBBGCode.put (10, "ACT/ACT NON-EOM"); - - s_mapDCBBGCode.put (11, "ACT/360 NON-EOM"); - - s_mapDCBBGCode.put (12, "ACT/365 NON-EOM"); - - s_mapDCBBGCode.put (13, "30/ACT NON-EOM"); - - s_mapDCBBGCode.put (14, "30/360 NON-EOM"); - - s_mapDCBBGCode.put (15, "30/365 NON-EOM"); - - s_mapDCBBGCode.put (16, "NL/ACT NON-EOM"); - - s_mapDCBBGCode.put (17, "NL/360 NON-EOM"); - - s_mapDCBBGCode.put (18, "NL/365 NON-EOM"); - - s_mapDCBBGCode.put (19, "ISMA 30/ACT"); - - s_mapDCBBGCode.put (20, "ISMA 30/360"); - - s_mapDCBBGCode.put (21, "ISMA 30/365"); - - s_mapDCBBGCode.put (22, "ISMA 30/ACT NON-EOM"); - - s_mapDCBBGCode.put (23, "ISMA 30/360 NON-EOM"); - - s_mapDCBBGCode.put (24, "ISMA 30/365 NON-EOM"); - - s_mapDCBBGCode.put (27, "ACT/364"); - - s_mapDCBBGCode.put (29, "US MUNI: 30/360"); - - s_mapDCBBGCode.put (30, "ACT/364 NON-EOM"); - - s_mapDCBBGCode.put (32, "MUNI30/360 NON-EOM"); - - s_mapDCBBGCode.put (33, "BUS DAYS/252"); - - s_mapDCBBGCode.put (35, "GERMAN:30/360"); - - s_mapDCBBGCode.put (36, "BUS DAY/252 NON-EOM"); - - s_mapDCBBGCode.put (38, "GER:30/360 NON-EOM"); - - s_mapDCBBGCode.put (40, "US:WIT ACT/ACT"); - - s_mapDCBBGCode.put (41, "US:WIB ACT/360"); - - s_mapDCBBGCode.put (44, "ISDA SWAPS:30/360"); - - s_mapDCBBGCode.put (45, "ISDA SWAPS:30/365"); - - s_mapDCBBGCode.put (46, "ISDA SWAPS:30/ACT"); - - s_mapDCBBGCode.put (47, "ISDA30/360 NON-EOM"); - - s_mapDCBBGCode.put (48, "ISDA30/365 NON-EOM"); - - s_mapDCBBGCode.put (49, "ISDA30/ACT NON-EOM"); - - s_mapDCBBGCode.put (50, "ISDA 30E/360"); - - s_mapDCBBGCode.put (51, "ISDA 30E/365"); - - s_mapDCBBGCode.put (52, "ISDA 30E/ACT"); - - s_mapDCBBGCode.put (53, "ISDA 30E/360 N-EOM"); - - s_mapDCBBGCode.put (54, "ISDA 30E/365 N-EOM"); - - s_mapDCBBGCode.put (55, "ISDA 30E/ACT N-EOM"); - - s_mapDCBBGCode.put (101, "ACT/ACT"); - - s_mapDCBBGCode.put (102, "ACT/360"); - - s_mapDCBBGCode.put (103, "ACT/365"); - - s_mapDCBBGCode.put (104, "30/360"); - - s_mapDCBBGCode.put (105, "ACT/ACT NON-EOM"); - - s_mapDCBBGCode.put (106, "ACT/360 NON-EOM"); - - s_mapDCBBGCode.put (107, "ACT/365 NON-EOM"); - - s_mapDCBBGCode.put (108, "ACT/360"); - - s_mapDCBBGCode.put (131, "ISMA 30/360"); - - s_mapDCBBGCode.put (201, "ISDA ACT/ACT"); - - s_mapDCBBGCode.put (202, "AFB ACT/ACT"); - - s_mapDCBBGCode.put (203, "ISDA ACT/ACT NOM"); - - s_mapDCBBGCode.put (204, "AFB ACT/ACT NOM"); - - s_mapDCBBGCode.put (206, "ISMA ACT/ACT"); - - s_mapDCBBGCode.put (207, "ISMA ACT/ACT NON-EOM"); - - s_mapIRSwitch.put ("ITL", "EUR"); - - s_mapIRSwitch.put ("FRF", "EUR"); - - s_mapIRSwitch.put ("CZK", "EUR"); - - s_mapIRSwitch.put ("BEF", "EUR"); - - s_mapIRSwitch.put ("ATS", "EUR"); - - s_mapIRSwitch.put ("SKK", "EUR"); - } - - /** - * Calculate the discount factor from the specified frequency, yield, and accrual year fraction - * - * @param iFreqIn Input frequency - if zero, set to semi-annual. - * @param dblYield Yield - * @param dblTime Time in DC years - * - * @return the discount factor - * - * @throws java.lang.Exception if input are invalid. - */ - - public static final double Yield2DF ( - final int iFreqIn, - final double dblYield, - final double dblTime) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblYield) || !org.drip.quant.common.NumberUtil.IsValid - (dblTime)) { - System.out.println (dblYield + " | " + dblTime); - - System.exit (36); - - throw new java.lang.Exception ("Helper::YieldDF => Bad yield/time"); - } - - int iFreq = (0 == iFreqIn) ? 2 : iFreqIn; - - return java.lang.Math.pow (1. + (dblYield / iFreq), -1. * dblTime * iFreq); - } - - /** - * Calculate the yield from the specified discount factor to the given time. - * - * @param iFreqIn Yield calculation frequency - defaults to semi-annual if zero. - * @param dblDF Discount Factor - * @param dblTime Time to which the yield/DF are specified - * - * @return Implied yield - * - * @throws java.lang.Exception Thrown if yield cannot be computed - */ - - public static final double DF2Yield ( - final int iFreqIn, - final double dblDF, - final double dblTime) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblDF) || !org.drip.quant.common.NumberUtil.IsValid - (dblTime)) - throw new java.lang.Exception ("CurveProductHelper.DFYield: Bad yield/time"); - - int iFreq = (0 == iFreqIn) ? 2 : iFreqIn; - - return iFreq * (java.lang.Math.pow (dblDF, -1. / (iFreq * dblTime)) - 1.); - } - - /** - * Compute the uncompounded OIS Rate from the LIBOR Swap Rate and the LIBOR Swap Rate - Fed Fund Basis. - * The calculation is from the following Bloomberg Publication: - * - * - Lipman, H. and F. Mercurio (2012): OIS Discounting and Dual-Curve Stripping Methodology at - * Bloomberg - * - * @param dblLIBORSwapRate LIBOR Swap Rate - * @param dblFedFundLIBORSwapBasis Fed Fund - LIBOR Swap Rate Basis - * - * @return The Uncompounded OIS Rate - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public static final double OISFromLIBORSwapFedFundBasis ( - final double dblLIBORSwapRate, - final double dblFedFundLIBORSwapBasis) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblLIBORSwapRate) || - !org.drip.quant.common.NumberUtil.IsValid (dblFedFundLIBORSwapBasis)) - throw new java.lang.Exception ("Helper::OISFromLIBORSwapFedFundBasis => Invalid Inputs!"); - - double dblOISAnnuity = 1. + 0.25 * (4. * (java.lang.Math.sqrt (1. + (dblLIBORSwapRate * 180. / 365.)) - - 1.) - dblFedFundLIBORSwapBasis); - - return dblOISAnnuity * dblOISAnnuity * dblOISAnnuity * dblOISAnnuity - 1.; - } - - /** - * Compute the Daily Compounded OIS Rate from the LIBOR Swap Rate and the LIBOR Swap Rate - Fed Fund - * Basis. The calculation is from the following Bloomberg Publication: - * - * - Lipman, H. and F. Mercurio (2012): OIS Discounting and Dual-Curve Stripping Methodology at - * Bloomberg - * - * @param dblLIBORSwapRate LIBOR Swap Rate - * @param dblFedFundLIBORSwapBasis Fed Fund - LIBOR Swap Rate Basis - * - * @return The Daily Compounded OIS Rate - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public static final double OISFromLIBORSwapFedFundBasis2 ( - final double dblLIBORSwapRate, - final double dblFedFundLIBORSwapBasis) - throws java.lang.Exception - { - return 4. * (java.lang.Math.pow (1. + (OISFromLIBORSwapFedFundBasis (dblLIBORSwapRate, - dblFedFundLIBORSwapBasis) / 360.), 90.) - 1.); - } - - /** - * Compute the DI-Style Price given the Rate - * - * @param dblDIRate The DI Rate - * @param iStartDate The Start Date - * @param iEndDate The End Date - * @param strCalendar The Calendar - * - * @return The DI-Style Price - * - * @throws java.lang.Exception Thrown if the DI-Style Price cannot be calculated - */ - - public static final double DIStylePriceFromRate ( - final double dblDIRate, - final int iStartDate, - final int iEndDate, - final java.lang.String strCalendar) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblDIRate) || iStartDate >= iEndDate) - throw new java.lang.Exception ("Helper::DIStylePriceFromRate => Invalid Inputs"); - - return java.lang.Math.pow (1. + dblDIRate, -1. * org.drip.analytics.daycount.Convention.BusinessDays - (iStartDate, iEndDate, strCalendar) / 252.); - } - - /** - * Compute the DI-Style Rate given the Price - * - * @param dblDIPrice The DI Price - * @param iStartDate The Start Date - * @param iEndDate The End Date - * @param strCalendar The Calendar - * - * @return The DI-Style Rate - * - * @throws java.lang.Exception Thrown if the DI-Style Price cannot be calculated - */ - - public static final double DIStyleRateFromPrice ( - final double dblDIPrice, - final int iStartDate, - final int iEndDate, - final java.lang.String strCalendar) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblDIPrice) || iStartDate >= iEndDate) - throw new java.lang.Exception ("Helper::DIStyleRateFromPrice => Invalid Inputs"); - - return java.lang.Math.pow (dblDIPrice, -252. / org.drip.analytics.daycount.Convention.BusinessDays - (iStartDate, iEndDate, strCalendar)) - 1.; - } - - /** - * Return the standard on-the-run benchmark treasury string from the valuation and the maturity dates - * - * @param iValueDate the Valuation date - * @param iMaturityDate the Maturity date - * - * @return the standard on-the-run benchmark treasury string - */ - - public static final java.lang.String BaseTsyBmk ( - final int iValueDate, - final int iMaturityDate) - { - double dblMatYears = 1. * (iMaturityDate - iValueDate) / 365.25; - - if (1.0 < dblMatYears && dblMatYears <= 2.5) return "02YON"; - - if (2.5 < dblMatYears && dblMatYears <= 4.0) return "03YON"; - - if (4.0 < dblMatYears && dblMatYears <= 6.0) return "05YON"; - - if (6.0 < dblMatYears && dblMatYears <= 8.5) return "07YON"; - - if (8.5 < dblMatYears && dblMatYears <= 15.) return "10YON"; - - if (dblMatYears > 15.) return "30YON"; - - return null; - } - - /** - * Turn the work out type to string - * - * @param iWOType One of the WO_TYPE_* fields in the WorkoutInfo class - * - * @return String representation of the work out type field - */ - - public static final java.lang.String WorkoutTypeToString ( - final int iWOType) - { - if (org.drip.param.valuation.WorkoutInfo.WO_TYPE_PUT == iWOType) return "Put"; - - if (org.drip.param.valuation.WorkoutInfo.WO_TYPE_CALL == iWOType) return "Call"; - - if (org.drip.param.valuation.WorkoutInfo.WO_TYPE_MATURITY == iWOType) return "Maturity"; - - return "Unknown work out type"; - } - - /** - * Convert the Bloomberg day count code to DRIP day count code. - * - * @param strBBGDCCode String representing the Bloomberg day count code. - * - * @return String representing the DRIP day count code. - */ - - public static final java.lang.String ParseFromBBGDCCode ( - final java.lang.String strBBGDCCode) - { - if (null == strBBGDCCode) return "Unknown BBG DC"; - - try { - return s_mapDCBBGCode.get ((int) new java.lang.Double (strBBGDCCode.trim()).doubleValue()); - } catch (java.lang.Exception e) { - } - - return "Unknown BBG DC"; - } - - /** - * Retrieve the tenor from the frequency - * - * @param iFreq Integer frequency - * - * @return String representing the tenor - */ - - public static final java.lang.String GetTenorFromFreq ( - final int iFreq) - { - if (1 == iFreq) return "1Y"; - - if (2 == iFreq) return "6M"; - - if (3 == iFreq) return "4M"; - - if (4 == iFreq) return "3M"; - - if (6 == iFreq) return "2M"; - - if (12 == iFreq) return "1M"; - - return null; - } - - /** - * Retrieve the Number of Years from the Tenor - * - * @param strTenor The Specified Tenor - * - * @return The Number of Years - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final int TenorToYears ( - final java.lang.String strTenor) - throws java.lang.Exception - { - if (null == strTenor || strTenor.isEmpty()) - throw new java.lang.Exception ("Helper::TenorToYears => Invalid Inputs"); - - char chTenor = strTenor.charAt (strTenor.length() - 1); - - int iTimeUnit = (int) new java.lang.Double (strTenor.substring (0, strTenor.length() - - 1)).doubleValue(); - - if ('y' == chTenor || 'Y' == chTenor) return iTimeUnit * 12; - - throw new java.lang.Exception ("AnalyticsHelper::TenorToYears => Invalid tenor format " + strTenor); - } - - /** - * Retrieve the Number of Months from the Tenor - * - * @param strTenor The Specified Tenor - * - * @return The Number of Months - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final int TenorToMonths ( - final java.lang.String strTenor) - throws java.lang.Exception - { - if (null == strTenor || strTenor.isEmpty()) - throw new java.lang.Exception ("Helper::TenorToMonths => Invalid Inputs"); - - char chTenor = strTenor.charAt (strTenor.length() - 1); - - int iTimeUnit = (int) new java.lang.Double (strTenor.substring (0, strTenor.length() - - 1)).doubleValue(); - - if ('d' == chTenor || 'D' == chTenor) return iTimeUnit * (iTimeUnit / 30); - - if ('w' == chTenor || 'W' == chTenor) return iTimeUnit * (iTimeUnit / 7); - - if ('l' == chTenor || 'L' == chTenor) return iTimeUnit; - - if ('m' == chTenor || 'M' == chTenor) return iTimeUnit; - - if ('y' == chTenor || 'Y' == chTenor) return iTimeUnit * 12; - - throw new java.lang.Exception ("Helper::TenorToMonths => Invalid Tenor Format " + strTenor); - } - - /** - * Retrieve the Number of Days from the Tenor - * - * @param strTenor The Specified Tenor - * - * @return The Number of Days - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final int TenorToDays ( - final java.lang.String strTenor) - throws java.lang.Exception - { - if (null == strTenor || strTenor.isEmpty()) - throw new java.lang.Exception ("Helper::TenorToDays => Invalid Inputs"); - - char chTenor = strTenor.charAt (strTenor.length() - 1); - - int iTimeUnit = (int) new java.lang.Double (strTenor.substring (0, strTenor.length() - - 1)).doubleValue(); - - if ('d' == chTenor || 'D' == chTenor) return iTimeUnit; - - if ('w' == chTenor || 'W' == chTenor) return iTimeUnit * 7; - - if ('l' == chTenor || 'L' == chTenor) return iTimeUnit * 28; - - if ('m' == chTenor || 'M' == chTenor) return iTimeUnit * 30; - - if ('y' == chTenor || 'Y' == chTenor) return (int) (365.25 * iTimeUnit); - - throw new java.lang.Exception ("Helper::TenorToDays => Unknown tenor format " + strTenor); - } - - /** - * Retrieve the Number of Days from the Tenor - * - * @param strTenor The Specified Tenor - * - * @return The Number of Days - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final double TenorToYearFraction ( - final java.lang.String strTenor) - throws java.lang.Exception - { - if (null == strTenor || strTenor.isEmpty()) - throw new java.lang.Exception ("Helper::TenorToYearFraction => Invalid Inputs"); - - char chTenor = strTenor.charAt (strTenor.length() - 1); - - int iTimeUnit = (int) new java.lang.Double (strTenor.substring (0, strTenor.length() - - 1)).doubleValue(); - - if ('d' == chTenor || 'D' == chTenor) return ((double) iTimeUnit) / 365.25; - - // if ('w' == chTenor || 'W' == chTenor) return ((double) (7. * iTimeUnit)) / 365.25; - - if ('w' == chTenor || 'W' == chTenor) return ((double) (iTimeUnit)) / 52.; - - // if ('l' == chTenor || 'L' == chTenor) return ((double) (28. * iTimeUnit)) / 365.25; - - if ('l' == chTenor || 'L' == chTenor) return ((double) (iTimeUnit)) / 13.; - - if ('m' == chTenor || 'M' == chTenor) return ((double) (iTimeUnit)) / 12.; - - if ('y' == chTenor || 'Y' == chTenor) return iTimeUnit; - - throw new java.lang.Exception ("Helper::TenorToDays => Unknown tenor format " + strTenor); - } - - /** - * Retrieve the Annual Frequency from the Tenor - * - * @param strTenor The Specified Tenor - * - * @return The Annual Frequency - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final int TenorToFreq ( - final java.lang.String strTenor) - throws java.lang.Exception - { - if (null == strTenor || strTenor.isEmpty()) - throw new java.lang.Exception ("Helper::TenorToFreq => Invalid Inputs"); - - if ("ON".equalsIgnoreCase (strTenor)) return 365; - - char chTenor = strTenor.charAt (strTenor.length() - 1); - - int iTimeUnit = (int) new java.lang.Double (strTenor.substring (0, strTenor.length() - - 1)).doubleValue(); - - if ('d' == chTenor || 'D' == chTenor) return (int) (365. / iTimeUnit); - - if ('w' == chTenor || 'W' == chTenor) return (int) (52. / iTimeUnit); - - if ('l' == chTenor || 'L' == chTenor) return (int) (13. / iTimeUnit); - - if ('m' == chTenor || 'M' == chTenor) return (int) (12. / iTimeUnit); - - if ('y' == chTenor || 'Y' == chTenor) return iTimeUnit; - - throw new java.lang.Exception ("Helper::TenorToFreq => Unknown tenor format " + strTenor); - } - - /** - * Compare the Left and the Right Tenors - * - * @param strTenorLeft Left Tenor - * @param strTenorRight Right Tenor - * - * @return Results of the Comparison - * - * @throws java.lang.Exception Thrown if the Comparison cannot be done - */ - - public static final int TenorCompare ( - final java.lang.String strTenorLeft, - final java.lang.String strTenorRight) - throws java.lang.Exception - { - int iLeftTenorDays = TenorToDays (strTenorLeft); - - int iRightTenorDays = TenorToDays (strTenorRight); - - if (iLeftTenorDays == iRightTenorDays) return LEFT_TENOR_EQUALS; - - return iLeftTenorDays > iRightTenorDays ? LEFT_TENOR_GREATER : LEFT_TENOR_LESSER; - } - - /** - * Retrieve the month code from input frequency - * - * @param iFreq Integer frequency - * - * @return String representing the month code - */ - - public static final java.lang.String GetMonthCodeFromFreq ( - final int iFreq) - { - if (1 == iFreq) return "0012M"; - - if (2 == iFreq) return "0006M"; - - if (3 == iFreq) return "0004M"; - - if (4 == iFreq) return "0003M"; - - if (6 == iFreq) return "0002M"; - - if (12 == iFreq) return "0001M"; - - return null; - } - - /** - * Calculate the rate index from the coupon currency and the frequency - * - * @param strCouponCurrency String representing the coupon currency - * @param iCouponFreq Integer representing the coupon frequency - * - * @return String representing the rate index - */ - - public static final java.lang.String CalcRateIndex ( - final java.lang.String strCouponCurrency, - final int iCouponFreq) - { - if (null == strCouponCurrency || strCouponCurrency.isEmpty()) return null; - - java.lang.String strFreqMonthCode = GetMonthCodeFromFreq (iCouponFreq); - - if (null == strFreqMonthCode) return null; - - return strCouponCurrency.substring (0, 2) + strFreqMonthCode; - } - - /** - * Get the DRIP day count from the Bloomberg code - * - * @param strBBGDC String representing the Bloomberg day count convention - * - * @return String representing DRIP day count - */ - - public static final java.lang.String GetDayCountFromBBGCode ( - final java.lang.String strBBGDC) - { - if (null == strBBGDC || strBBGDC.isEmpty()) return "30/360"; - - return "30/360"; - } - - /** - * Calculate the rate index from currency and coupon frequency - * - * @param strCcy String representing coupon currency - * @param iCouponFreq Integer representing coupon frequency - * - * @return String representing the rate index - */ - - public static final java.lang.String RateIndexFromCcyAndCouponFreq ( - final java.lang.String strCcy, - final int iCouponFreq) - { - if (null == strCcy || strCcy.isEmpty() || 0 >= iCouponFreq) return ""; - - java.lang.String strCcyPrefix = strCcy.substring (0, 2); - - if (1 == iCouponFreq) return strCcyPrefix + "0012M"; - - if (2 == iCouponFreq) return strCcyPrefix + "0006M"; - - if (3 == iCouponFreq) return strCcyPrefix + "0004M"; - - if (4 == iCouponFreq) return strCcyPrefix + "0003M"; - - if (6 == iCouponFreq) return strCcyPrefix + "0002M"; - - if (12 == iCouponFreq) return strCcyPrefix + "0001M"; - - return ""; - } - - /** - * Switch the given IR curve if necessary - * - * @param strCurveIn String representing the input curve - * - * @return String representing the switched curve - */ - - public static final java.lang.String SwitchIRCurve ( - final java.lang.String strCurveIn) - { - if (null == strCurveIn) return null; - - if (!s_mapIRSwitch.containsKey (strCurveIn)) return strCurveIn; - - return s_mapIRSwitch.get (strCurveIn); - } - - /** - * Create the Latent State Fixings object from the bond, the fixings date, and the fixing. - * - * @param bond The input bond - * @param dtFixing The Fixings Date - * @param dblFixing Double representing the fixing - * - * @return The Latent State Fixings Instance - */ - - public static final org.drip.param.market.LatentStateFixingsContainer CreateFixingsObject ( - final org.drip.product.definition.Bond bond, - final org.drip.analytics.date.JulianDate dtFixing, - final double dblFixing) - { - if (!bond.isFloater()) return null; - - org.drip.param.market.LatentStateFixingsContainer lsfc = new - org.drip.param.market.LatentStateFixingsContainer(); - - return lsfc.add (dtFixing, bond.forwardLabel().get (0), dblFixing) ? lsfc : null; - } - - /** - * Bump the input array quotes - * - * @param adblQuotesIn Array of the input double quotes - * @param dblBump Bump amount - * @param bIsProportional True - Bump is proportional - * - * @return Bumped array output - */ - - public static final double[] BumpQuotes ( - final double[] adblQuotesIn, - final double dblBump, - final boolean bIsProportional) - { - if (null == adblQuotesIn || 0 == adblQuotesIn.length || !org.drip.quant.common.NumberUtil.IsValid - (dblBump)) - return null; - - double[] adblQuotesOut = new double[adblQuotesIn.length]; - - for (int i = 0; i < adblQuotesIn.length; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (adblQuotesIn[i])) return null; - - if (!bIsProportional) - adblQuotesOut[i] = adblQuotesIn[i] + dblBump; - else - adblQuotesOut[i] = adblQuotesIn[i] * (1. + dblBump); - } - - return adblQuotesOut; - } - - /** - * Tweak the Manifest Measures (gor the given set of nodes) in accordance with the specified tweak - * parameters - * - * @param adblQuotesIn Array of quotes to be bumped - * @param ntp NodeTweakParams input - * - * @return Bumped array output - */ - - public static final double[] TweakManifestMeasure ( - final double[] adblQuotesIn, - final org.drip.param.definition.ManifestMeasureTweak ntp) - { - if (null == adblQuotesIn || 0 == adblQuotesIn.length || null == ntp) return adblQuotesIn; - - double[] adblQuotesOut = new double[adblQuotesIn.length]; - - if (org.drip.param.definition.ManifestMeasureTweak.FLAT == ntp.node()) { - for (int i = 0; i < adblQuotesIn.length; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (adblQuotesIn[i])) return null; - - if (!ntp.isProportional()) - adblQuotesOut[i] = adblQuotesIn[i] + ntp.amount(); - else - adblQuotesOut[i] = adblQuotesIn[i] * (1. + ntp.amount()); - } - } else { - if (ntp.node() < 0 || ntp.node() >= adblQuotesIn.length) return null; - - for (int i = 0; i < adblQuotesIn.length; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (adblQuotesIn[i])) return null; - - if (i == ntp.node()) { - if (!ntp.isProportional()) - adblQuotesOut[i] = adblQuotesIn[i] + ntp.amount(); - else - adblQuotesOut[i] = adblQuotesIn[i] * (1. + ntp.amount()); - } else - adblQuotesOut[i] = adblQuotesIn[i]; - } - } - - return adblQuotesOut; - } - - /** - * Merge two lists of periods - * - * @param lsPeriod1 Period 1 - * @param lsPeriod2 Period 2 - * - * @return The Merged Period List - */ - - public static final java.util.List MergePeriodLists ( - final java.util.List lsPeriod1, - final java.util.List lsPeriod2) - { - if ((null == lsPeriod1 || 0 == lsPeriod1.size()) && (null == lsPeriod2 || 0 == lsPeriod2.size())) - return null; - - java.util.List lsPeriodMerged = new - java.util.ArrayList(); - - if (null == lsPeriod1 || 0 == lsPeriod1.size()) { - for (org.drip.analytics.cashflow.CompositePeriod p : lsPeriod2) { - if (null != p) lsPeriodMerged.add (p); - } - - return lsPeriodMerged; - } - - if (null == lsPeriod2 || 0 == lsPeriod2.size()) { - for (org.drip.analytics.cashflow.CompositePeriod p : lsPeriod1) { - if (null != p) lsPeriodMerged.add (p); - } - - return lsPeriodMerged; - } - - int iPeriod1Index = 0; - int iPeriod2Index = 0; - - while (iPeriod1Index < lsPeriod1.size() && iPeriod2Index < lsPeriod2.size()) { - org.drip.analytics.cashflow.CompositePeriod p1 = lsPeriod1.get (iPeriod1Index); - - org.drip.analytics.cashflow.CompositePeriod p2 = lsPeriod2.get (iPeriod2Index); - - if (p1.payDate() < p2.payDate()) { - lsPeriodMerged.add (p1); - - ++iPeriod1Index; - } else { - lsPeriodMerged.add (p2); - - ++iPeriod2Index; - } - } - - if (iPeriod1Index < lsPeriod1.size() - 1) { - for (int i = iPeriod1Index; i < lsPeriod1.size(); ++i) - lsPeriodMerged.add (lsPeriod1.get (i)); - } else if (iPeriod2Index < lsPeriod2.size() - 1) { - for (int i = iPeriod2Index; i < lsPeriod2.size(); ++i) - lsPeriodMerged.add (lsPeriod2.get (i)); - } - - return lsPeriodMerged; - } - - /** - * Aggregate the period lists for an array of components - * - * @param aComp Array of Components - * - * @return The Aggregated Period Set - */ - - public static final java.util.Set AggregateComponentPeriods - (final org.drip.product.definition.Component[] aComp) - { - if (null == aComp) return null; - - int iStartIndex = 0; - int iNumComp = aComp.length; - - if (0 == iNumComp) return null; - - for (int i = 0; i < iNumComp; ++i) { - if (null != aComp[i]) { - iStartIndex = i; - break; - } - } - - java.util.Set setAggregatedPeriod = new - java.util.TreeSet(); - - for (int i = iStartIndex; i < iNumComp; ++i) { - if (null == aComp[i]) continue; - - java.util.List lsCompPeriod = - aComp[i].couponPeriods(); - - if (null == lsCompPeriod || 0 == lsCompPeriod.size()) continue; - - for (org.drip.analytics.cashflow.CompositePeriod p : lsCompPeriod) { - if (null != p) setAggregatedPeriod.add (p); - } - } - - return setAggregatedPeriod; - } - - /** - * Append the Prefixed Map Entries of the specified Input Map onto the Output Map - * - * @param mapOutput The Output Map - * @param strPrefix The Entry Prefix - * @param mapInput The Input Map - * - * @return TRUE - At least one entry appended - */ - - public static final boolean AccumulateMeasures ( - final org.drip.analytics.support.CaseInsensitiveTreeMap mapOutput, - final java.lang.String strPrefix, - final org.drip.analytics.support.CaseInsensitiveTreeMap mapInput) - { - if (null == mapOutput || null == strPrefix || strPrefix.isEmpty() || null == mapInput) return false; - - java.util.Set> mapInputESSingle = - mapInput.entrySet(); - - if (null == mapInputESSingle) return false; - - for (java.util.Map.Entry me : mapInputESSingle) { - if (null == me) continue; - - java.lang.String strKey = me.getKey(); - - if (null == strKey || strKey.isEmpty()) continue; - - mapOutput.put (strPrefix + "@" + strKey, me.getValue()); - } - - return true; - } - - /** - * Do the Left and the Right Labels Match? - * - * @param lslLeft Left Cash Flow Period Label - * @param lslRight Right Cash Flow Period Label - * - * @return TRUE - The Labels Match - */ - - public static final boolean LabelMatch ( - final org.drip.state.identifier.LatentStateLabel lslLeft, - final org.drip.state.identifier.LatentStateLabel lslRight) - { - if (null == lslLeft && null == lslRight) return true; - - if ((null == lslLeft && null != lslRight) || (null != lslLeft && null == lslRight)) return false; - - return lslLeft.match (lslRight); - } - - /** - * Compute the Bond Futures Price AUD Bill Style from the Reference Index Level - * - * @param dtValue The Valuation Date - * @param bond The Bond Instance - * @param dblReferenceIndex The Reference Index - * - * @return The Bond Futures Price AUD Bill Style - * - * @throws java.lang.Exception Thrown if the Bond Futures Price AUD Bill Style cannot be computed - */ - - public static final double BondFuturesPriceAUDBillStyle ( - final org.drip.analytics.date.JulianDate dtValue, - final org.drip.product.definition.Bond bond, - final double dblReferenceIndex) - throws java.lang.Exception - { - if (null == dtValue || null == bond || !org.drip.quant.common.NumberUtil.IsValid (dblReferenceIndex)) - throw new java.lang.Exception - ("AnalyticsHelper::BondFuturesPriceAUDBillStyle => Invalid Inputs"); - - return 1. / (1. + (1. - dblReferenceIndex) * org.drip.analytics.daycount.Convention.YearFraction - (dtValue.julian(), bond.maturityDate().julian(), bond.accrualDC(), false, null, - bond.currency())); - } - - /** - * Construct a Normalized, Equally Weighted Array from the Specified Number of Elements - * - * @param iNumElement Number of Elements - * - * @return The Normalized, Equally Weighted Array - */ - - public static final double[] NormalizedEqualWeightedArray ( - final int iNumElement) - { - if (0 >= iNumElement) return null; - - double dblWeight = 1. / iNumElement; - double[] adblEqualWeighted = new double[iNumElement]; - - for (int i = 0; i < iNumElement; ++i) - adblEqualWeighted[i] = dblWeight; - - return adblEqualWeighted; - } - - /** - * Aggregate the Base and the Roll Tenors onto a Composite Tenor - * - * @param strBaseTenor The Base Tenor - * @param strRollTenor The Roll Tenor - * - * @return The Agrregated Composite Tenor - */ - - public static final java.lang.String AggregateTenor ( - final java.lang.String strBaseTenor, - final java.lang.String strRollTenor) - { - if (null == strBaseTenor || strBaseTenor.isEmpty()) return strRollTenor; - - char chBaseTenor = strBaseTenor.charAt (strBaseTenor.length() - 1); - - char chRollTenor = strRollTenor.charAt (strRollTenor.length() - 1); - - if (chRollTenor != chBaseTenor) return null; - - int iBaseTimeUnit = (int) new java.lang.Double (strBaseTenor.substring (0, strBaseTenor.length() - - 1)).doubleValue(); - - int iRollTimeUnit = (int) new java.lang.Double (strRollTenor.substring (0, strRollTenor.length() - - 1)).doubleValue(); - - return "" + (iBaseTimeUnit + iRollTimeUnit) + chBaseTenor; - } -} diff --git a/org/drip/analytics/support/Logger.java b/org/drip/analytics/support/Logger.java deleted file mode 100644 index 656573e..0000000 --- a/org/drip/analytics/support/Logger.java +++ /dev/null @@ -1,163 +0,0 @@ - -package org.drip.analytics.support; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * The Logger class implements level-set logging, backed by either the screen or a file. Logging always - * includes time-stamps, and happens according to the level requested. - * - * @author Lakshmi Krishnamurthy - */ - -public class Logger { - - /** - * Logger level ERROR - */ - - public static final int ERROR = 0; - - /** - * Logger level WARNING - */ - - public static final int WARNING = 1; - - /** - * Logger level INFO - */ - - public static final int INFO = 2; - - /** - * Logger level DEBUG - */ - - public static final int DEBUG = 4; - - private static boolean _sbInit = false; - private static java.io.BufferedWriter _writeLog = null; - - private static final java.lang.String ImprintPreSub ( - final int iLevel, - final java.lang.String strMsg) - { - if (null == strMsg || strMsg.isEmpty()) return ""; - - java.lang.StringBuilder sb = new java.lang.StringBuilder(); - - sb.append ("[").append ((new java.util.Date()).toString()).append ("|Level:").append (iLevel).append - ("|").append (strMsg).append ("]\n"); - - return sb.toString(); - } - - /** - * Initialize the logger from a configuration file - * - * @param strConfigFile Configuration file containing the logger file location - * - * @return boolean indicating whether initialization succeeded - */ - - public static boolean Init ( - final java.lang.String strConfigFile) - { - if (null == strConfigFile || strConfigFile.isEmpty()) return false; - - try { - _writeLog = new java.io.BufferedWriter (new java.io.FileWriter - (org.drip.param.config.ConfigLoader.LoggerLocation (strConfigFile))); - - return _sbInit = true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return _sbInit = false; - } - - /** - * Log a specific message to the level - * - * @param iLevel the level of message (ERROR/WARNING/INFO/DEBUG) - * @param bHardLog whether the logging is to file/DB (true) or to screen (false) - * @param strMsg Message to be logged - * - * @return boolean indicating whether logging operation succeeded - */ - - public static boolean Log ( - final int iLevel, - final boolean bHardLog, - final java.lang.String strMsg) - { - if (!_sbInit || null == strMsg || strMsg.isEmpty()) return false; - - if (bHardLog) { - try { - _writeLog.write (ImprintPreSub (iLevel, strMsg)); - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - System.out.println (ImprintPreSub (iLevel, strMsg)); - - return true; - } -} diff --git a/org/drip/analytics/support/LossQuadratureGenerator.java b/org/drip/analytics/support/LossQuadratureGenerator.java deleted file mode 100644 index 74bd13c..0000000 --- a/org/drip/analytics/support/LossQuadratureGenerator.java +++ /dev/null @@ -1,291 +0,0 @@ - -package org.drip.analytics.support; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * LossQuadratureGenerator generates the decomposed Integrand Quadrature for the Loss Steps. - * - * @author Lakshmi Krishnamurthy - */ - -public class LossQuadratureGenerator { - - /** - * Generate the Set of Loss Quadrature Metrics from the Day Step Loss Periods - * - * @param comp Component for which the measures are to be generated - * @param valParams ValuationParams from which the periods are generated - * @param period The enveloping coupon period - * @param iWorkoutDate Date representing the absolute end of all the generated periods - * @param iPeriodUnit Day Step Size Unit of the generated Loss Quadrature Periods - * @param csqs The Market Parameters Curves/Quotes - * - * @return List of the generated LossQuadratureMetrics - */ - - public static final java.util.List - GenerateDayStepLossPeriods ( - final org.drip.product.definition.CreditComponent comp, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.analytics.cashflow.CompositePeriod period, - final int iWorkoutDate, - final int iPeriodUnit, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - if (null == comp || null == valParams || null == period || null == csqs) return null; - - org.drip.state.discount.MergedDiscountForwardCurve dc = csqs.fundingState - (org.drip.state.identifier.FundingLabel.Standard (comp.payCurrency())); - - if (null == dc) return null; - - org.drip.state.credit.CreditCurve cc = csqs.creditState (comp.creditLabel()); - - if (null == cc) return null; - - int iLossPayLag = comp.creditValuationParams().lossPayLag(); - - int iSubPeriodStartDate = period.startDate(); - - if (iSubPeriodStartDate > iWorkoutDate) return null; - - int iPeriodEndDate = period.endDate(); - - int iValueDate = valParams.valueDate(); - - boolean bPeriodDone = false; - iPeriodEndDate = iPeriodEndDate < iWorkoutDate ? iPeriodEndDate : iWorkoutDate; - iSubPeriodStartDate = iSubPeriodStartDate < iValueDate ? iValueDate : iSubPeriodStartDate; - - java.util.List sLP = new - java.util.ArrayList(); - - while (!bPeriodDone) { - int iSubPeriodEndDate = iSubPeriodStartDate + iPeriodUnit; - - if (iSubPeriodEndDate < iValueDate) return null; - - if (iSubPeriodEndDate >= iPeriodEndDate) { - bPeriodDone = true; - iSubPeriodEndDate = iPeriodEndDate; - } - - try { - org.drip.analytics.cashflow.LossQuadratureMetrics lp = - org.drip.analytics.cashflow.LossQuadratureMetrics.MakeDefaultPeriod (iSubPeriodStartDate, - iSubPeriodEndDate, period.accrualDCF ((iSubPeriodStartDate + iSubPeriodEndDate) / 2), - comp.notional (iSubPeriodStartDate, iSubPeriodEndDate), comp.recovery - (iSubPeriodStartDate, iSubPeriodEndDate, cc), dc, cc, iLossPayLag); - - if (null != lp) sLP.add (lp); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - iSubPeriodStartDate = iSubPeriodEndDate; - } - - return sLP; - } - - /** - * Generate the Set of Loss Quadrature Metrics from the Day Step Loss Periods - * - * @param comp Component for which the measures are to be generated - * @param valParams ValuationParams from which the periods are generated - * @param period The enveloping coupon period - * @param iWorkoutDate The absolute end of all the generated periods - * @param iPeriodUnit Loss Grid Size Unit of the generated Loss Quadrature Periods - * @param csqs The Market Parameters Curves/Quotes - * - * @return List of the generated LossQuadratureMetrics - */ - - public static final java.util.List - GeneratePeriodUnitLossPeriods ( - final org.drip.product.definition.CreditComponent comp, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.analytics.cashflow.CompositePeriod period, - final int iWorkoutDate, - final int iPeriodUnit, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - if (null == comp || null == valParams || null == period || null == csqs) return null; - - org.drip.state.discount.MergedDiscountForwardCurve dc = csqs.fundingState - (org.drip.state.identifier.FundingLabel.Standard (comp.payCurrency())); - - if (null == dc) return null; - - org.drip.state.credit.CreditCurve cc = csqs.creditState (comp.creditLabel()); - - if (null == cc) return null; - - int iValueDate = valParams.valueDate(); - - int iPeriodEndDate = period.endDate(); - - int iSubPeriodStartDate = period.startDate(); - - boolean bPeriodDone = false; - iPeriodEndDate = iPeriodEndDate < iWorkoutDate ? iPeriodEndDate : iWorkoutDate; - iSubPeriodStartDate = iSubPeriodStartDate < iValueDate ? iValueDate : iSubPeriodStartDate; - int iDayStep = (iPeriodEndDate - iSubPeriodStartDate) / iPeriodUnit; - - if (iSubPeriodStartDate > iWorkoutDate || iPeriodEndDate < iValueDate) return null; - - if (iDayStep < org.drip.param.pricer.CreditPricerParams.PERIOD_DAY_STEPS_MINIMUM) - iDayStep = org.drip.param.pricer.CreditPricerParams.PERIOD_DAY_STEPS_MINIMUM; - - int iLossPayLag = comp.creditValuationParams().lossPayLag(); - - java.util.List sLP = new - java.util.ArrayList(); - - while (!bPeriodDone) { - int iSubPeriodEndDate = iSubPeriodStartDate + iDayStep; - - if (iSubPeriodEndDate < iValueDate) return null; - - try { - if (iSubPeriodEndDate >= iPeriodEndDate) { - bPeriodDone = true; - iSubPeriodEndDate = iPeriodEndDate; - } - - org.drip.analytics.cashflow.LossQuadratureMetrics lp = - org.drip.analytics.cashflow.LossQuadratureMetrics.MakeDefaultPeriod (iSubPeriodStartDate, - iSubPeriodEndDate, period.accrualDCF ((iSubPeriodStartDate + iSubPeriodEndDate) / 2), - comp.notional (iSubPeriodStartDate, iSubPeriodEndDate), comp.recovery - (iSubPeriodStartDate, iSubPeriodEndDate, cc), dc, cc, iLossPayLag); - - if (null != lp) sLP.add (lp); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - iSubPeriodStartDate = iSubPeriodEndDate; - } - - return sLP; - } - - - /** - * Generate the Set of Loss Quadrature Metrics from the Day Step Loss Periods - * - * @param comp Component for which the measures are to be generated - * @param valParams ValuationParams from which the periods are generated - * @param period The Enveloping Coupon period - * @param iWorkoutDate The Absolute End of all the generated periods - * @param csqs The Market Parameters Curves/Quotes - * - * @return List of the generated LossQuadratureMetrics - */ - - public static final java.util.List - GenerateWholeLossPeriods ( - final org.drip.product.definition.CreditComponent comp, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.analytics.cashflow.CompositePeriod period, - final int iWorkoutDate, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - if (null == comp || null == valParams || null == period || null == csqs) return null; - - org.drip.state.discount.MergedDiscountForwardCurve dc = csqs.fundingState - (org.drip.state.identifier.FundingLabel.Standard (comp.payCurrency())); - - if (null == dc) return null; - - org.drip.state.credit.CreditCurve cc = csqs.creditState (comp.creditLabel()); - - if (null == cc) return null; - - int iPeriodStartDate = period.startDate(); - - if (iPeriodStartDate > iWorkoutDate) return null; - - int iPeriodEndDate = period.endDate(); - - int iValueDate = valParams.valueDate(); - - iPeriodStartDate = iPeriodStartDate < iValueDate ? iValueDate : iPeriodStartDate; - iPeriodEndDate = iPeriodEndDate < iWorkoutDate ? iPeriodEndDate : iWorkoutDate; - - int iLossPayLag = comp.creditValuationParams().lossPayLag(); - - java.util.List sLP = new - java.util.ArrayList(); - - try { - org.drip.analytics.cashflow.LossQuadratureMetrics lp = - org.drip.analytics.cashflow.LossQuadratureMetrics.MakeDefaultPeriod (iPeriodStartDate, - iPeriodEndDate, period.accrualDCF ((iPeriodStartDate + iPeriodEndDate) / 2), - comp.notional (iPeriodStartDate, iPeriodEndDate), comp.recovery (iPeriodStartDate, - iPeriodEndDate, cc), dc, cc, iLossPayLag); - - if (null != lp) sLP.add (lp); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return sLP; - } -} diff --git a/org/drip/analytics/support/OptionHelper.java b/org/drip/analytics/support/OptionHelper.java deleted file mode 100644 index 84f6446..0000000 --- a/org/drip/analytics/support/OptionHelper.java +++ /dev/null @@ -1,374 +0,0 @@ - -package org.drip.analytics.support; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * OptionHelper contains the collection of the option valuation related utility functions used by the modules. - * - * @author Lakshmi Krishnamurthy - */ - -public class OptionHelper { - - static class CrossVolatilityQuantoProduct extends org.drip.function.definition.R1ToR1 { - org.drip.state.volatility.VolatilityCurve _vcForward = null; - org.drip.state.volatility.VolatilityCurve _vcForwardToDiscount = null; - org.drip.function.definition.R1ToR1 _r1r1ForwardForwardToDiscountCorrelation = null; - - CrossVolatilityQuantoProduct ( - final org.drip.state.volatility.VolatilityCurve vcForward, - final org.drip.state.volatility.VolatilityCurve vcForwardToDiscount, - final org.drip.function.definition.R1ToR1 r1r1ForwardForwardToDiscountCorrelation) - { - super (null); - - _vcForward = vcForward; - _vcForwardToDiscount = vcForwardToDiscount; - _r1r1ForwardForwardToDiscountCorrelation = r1r1ForwardForwardToDiscountCorrelation; - } - - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - return _vcForward.impliedVol ((int) dblVariate) * _vcForwardToDiscount.impliedVol ((int) - dblVariate) * _r1r1ForwardForwardToDiscountCorrelation.evaluate (dblVariate); - } - } - - static class CrossVolatilityConvexityExponent extends org.drip.function.definition.R1ToR1 { - org.drip.state.volatility.VolatilityCurve _vcForward = null; - org.drip.state.volatility.VolatilityCurve _vcFunding = null; - double _dblForwardShiftedLogNormalScaler = java.lang.Double.NaN; - double _dblFundingShiftedLogNormalScaler = java.lang.Double.NaN; - org.drip.function.definition.R1ToR1 _r1r1ForwardFundingCorrelation = null; - - CrossVolatilityConvexityExponent ( - final org.drip.state.volatility.VolatilityCurve vcForward, - final double dblForwardShiftedLogNormalScaler, - final org.drip.state.volatility.VolatilityCurve vcFunding, - final double dblFundingShiftedLogNormalScaler, - final org.drip.function.definition.R1ToR1 r1r1ForwardFundingCorrelation) - { - super (null); - - _vcForward = vcForward; - _vcFunding = vcFunding; - _r1r1ForwardFundingCorrelation = r1r1ForwardFundingCorrelation; - _dblForwardShiftedLogNormalScaler = dblForwardShiftedLogNormalScaler; - _dblFundingShiftedLogNormalScaler = dblFundingShiftedLogNormalScaler; - } - - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - double dblForwardShiftedLogNormalScaler = java.lang.Double.isNaN - (_dblForwardShiftedLogNormalScaler) ? 1. : _dblForwardShiftedLogNormalScaler; - double dblFundingShiftedLogNormalScaler = java.lang.Double.isNaN - (_dblFundingShiftedLogNormalScaler) ? 1. : _dblFundingShiftedLogNormalScaler; - - return _r1r1ForwardFundingCorrelation.evaluate (dblVariate) * _vcFunding.impliedVol ((int) - dblVariate) * _vcFunding.impliedVol ((int) dblVariate) * dblFundingShiftedLogNormalScaler * - dblForwardShiftedLogNormalScaler - _vcForward.impliedVol ((int) dblVariate) * - _vcForward.impliedVol ((int) dblVariate) * dblForwardShiftedLogNormalScaler * - dblForwardShiftedLogNormalScaler; - } - } - - static class PeriodVariance extends org.drip.function.definition.R1ToR1 { - org.drip.state.volatility.VolatilityCurve _vc = null; - - PeriodVariance ( - final org.drip.state.volatility.VolatilityCurve vc) - { - super (null); - - _vc = vc; - } - - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - return _vc.impliedVol ((int) dblVariate) * _vc.impliedVol ((int) dblVariate); - } - } - - /** - * Compute the Integrated Surface Variance given the corresponding volatility and the date spans - * - * @param csqs Market Parameters - * @param strCustomMetricLabel Custom Metric Label - * @param iStartDate Evolution Start Date - * @param iEndDate Evolution End Date - * - * @return The Integrated Volatility Surface - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public static final double IntegratedSurfaceVariance ( - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final java.lang.String strCustomMetricLabel, - final int iStartDate, - final int iEndDate) - throws java.lang.Exception - { - if (iEndDate < iStartDate) - throw new java.lang.Exception ("OptionHelper::IntegratedSurfaceVariance => Invalid Inputs"); - - if (null == csqs || null == strCustomMetricLabel || strCustomMetricLabel.isEmpty() || iEndDate == - iStartDate) - return 0.; - - org.drip.state.volatility.VolatilityCurve vc = csqs.customVolatility - (org.drip.state.identifier.CustomLabel.Standard (strCustomMetricLabel)); - - return null != vc ? new PeriodVariance (vc).integrate (iStartDate, iEndDate) / 365.25 : 0.; - } - - /** - * Compute the Integrated Surface Variance given the corresponding volatility and the date spans - * - * @param vc The Volatility Curve - * @param iStartDate Evolution Start Date - * @param iEndDate Evolution End Date - * - * @return The Integrated Volatility Surface - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public static final double IntegratedSurfaceVariance ( - final org.drip.state.volatility.VolatilityCurve vc, - final int iStartDate, - final int iEndDate) - throws java.lang.Exception - { - if (null == vc || iEndDate < iStartDate) - throw new java.lang.Exception ("OptionHelper::IntegratedSurfaceVariance => Invalid Inputs"); - - return null != vc ? new PeriodVariance (vc).integrate (iStartDate, iEndDate) / 365.25 : 0.; - } - - /** - * Compute the Integrated Cross Volatility Quanto Product given the corresponding volatility and the - * correlation curves, and the date spans - * - * @param vc1 Volatility Curve #1 - * @param vc2 Volatility Curve #2 - * @param r1r1Correlation Correlation Curve - * @param iStartDate Evolution Start Date - * @param iEndDate Evolution End Date - * - * @return The Integrated Cross Volatility Quanto Product - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public static final double IntegratedCrossVolQuanto ( - final org.drip.state.volatility.VolatilityCurve vc1, - final org.drip.state.volatility.VolatilityCurve vc2, - final org.drip.function.definition.R1ToR1 r1r1Correlation, - final int iStartDate, - final int iEndDate) - throws java.lang.Exception - { - if (iEndDate < iStartDate) - throw new java.lang.Exception ("OptionHelper::IntegratedCrossVolQuanto => Invalid Inputs"); - - return null == vc1 || null == vc2 || null == r1r1Correlation ? 0. : new CrossVolatilityQuantoProduct - (vc1, vc2, r1r1Correlation).integrate (iStartDate, iEndDate) / 365.25; - } - - /** - * Compute the Integrated FRA Cross Volatility Convexity Exponent given the corresponding volatility and - * the correlation Curves, and the date spans - * - * @param vcForward Volatility Term Structure of the Funding Rate - * @param vcFunding Volatility Term Structure of the Forward Rate - * @param r1r1ForwardFundingCorrelation Correlation Term Structure between the Forward and the Funding - * States - * @param dblForwardShiftedLogNormalScaler Scaling for the Forward Log Normal Volatility - * @param dblFundingShiftedLogNormalScaler Scaling for the Funding Log Normal Volatility - * @param iStartDate Evolution Start Date - * @param iEndDate Evolution End Date - * - * @return The Integrated FRA Cross Volatility Convexity Exponent - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public static final double IntegratedFRACrossVolConvexityExponent ( - final org.drip.state.volatility.VolatilityCurve vcForward, - final org.drip.state.volatility.VolatilityCurve vcFunding, - final org.drip.function.definition.R1ToR1 r1r1ForwardFundingCorrelation, - final double dblForwardShiftedLogNormalScaler, - final double dblFundingShiftedLogNormalScaler, - final int iStartDate, - final int iEndDate) - throws java.lang.Exception - { - if (iEndDate < iStartDate) - throw new java.lang.Exception - ("OptionHelper::IntegratedFRACrossVolConvexityExponent => Invalid Inputs"); - - return null == vcFunding || null == vcForward || null == r1r1ForwardFundingCorrelation ? 0. : new - CrossVolatilityConvexityExponent (vcForward, dblForwardShiftedLogNormalScaler, vcFunding, - dblFundingShiftedLogNormalScaler, r1r1ForwardFundingCorrelation).integrate (iStartDate, - iEndDate) / 365.25; - } - - /** - * Compute the Integrated Cross Volatility Quanto Product given the corresponding volatility and the - * correlation Curves and the date spans - * - * @param csqs Market Parameters - * @param strCustomMetricLabel1 Custom Metric Label #1 - * @param strCustomMetricLabel2 Custom Metric Label #2 - * @param iStartDate Evolution Start Date - * @param iEndDate Evolution End Date - * - * @return The Integrated Cross Volatility Quanto Product - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public static final double IntegratedCrossVolQuanto ( - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final java.lang.String strCustomMetricLabel1, - final java.lang.String strCustomMetricLabel2, - final int iStartDate, - final int iEndDate) - throws java.lang.Exception - { - if (iEndDate < iStartDate) - throw new java.lang.Exception ("OptionHelper::IntegratedCrossVolQuanto => Invalid Inputs"); - - if (null == csqs || null == strCustomMetricLabel1 || strCustomMetricLabel1.isEmpty() || null == - strCustomMetricLabel2 || strCustomMetricLabel2.isEmpty() || iEndDate == iStartDate) - return 0.; - - org.drip.state.identifier.CustomLabel cml1 = - org.drip.state.identifier.CustomLabel.Standard (strCustomMetricLabel1); - - org.drip.state.identifier.CustomLabel cml2 = - org.drip.state.identifier.CustomLabel.Standard (strCustomMetricLabel2); - - return null == cml1 || null == cml2 ? 0. : IntegratedCrossVolQuanto (csqs.customVolatility (cml1), - csqs.customVolatility (cml2), csqs.customCustomCorrelation (cml1, cml2), iStartDate, iEndDate); - } - - /** - * Compute the Multiplicative Cross Volatility Quanto Product given the corresponding volatility and the - * correlation Curves, and the date spans - * - * @param csqs Market Parameters - * @param strCustomMetricLabel1 Custom Metric Label #1 - * @param strCustomMetricLabel2 Custom Metric Label #2 - * @param iStartDate Evolution Start Date - * @param iEndDate Evolution End Date - * - * @return The Multiplicative Cross Volatility Quanto Product - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public static final double MultiplicativeCrossVolQuanto ( - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final java.lang.String strCustomMetricLabel1, - final java.lang.String strCustomMetricLabel2, - final int iStartDate, - final int iEndDate) - throws java.lang.Exception - { - return java.lang.Math.exp (-1. * IntegratedCrossVolQuanto (csqs, strCustomMetricLabel1, - strCustomMetricLabel2, iStartDate, iEndDate)); - } - - /** - * Compute the Integrated FRA Cross Volatility Convexity Adjuster given the corresponding volatility and - * the correlation Curves and the date spans - * - * @param csqs Market Parameters - * @param forwardLabel Forward Latent State Label - * @param fundingLabel Funding Latent State Label - * @param dblForwardShiftedLogNormalScaler Scaling for the Forward Log Normal Volatility - * @param dblFundingShiftedLogNormalScaler Scaling for the Funding Log Normal Volatility - * @param iStartDate Evolution Start Date - * @param iEndDate Evolution End Date - * - * @return The Integrated FRA Cross Volatility Convexity Adjuster - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public static final double IntegratedFRACrossVolConvexityAdjuster ( - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final org.drip.state.identifier.FundingLabel fundingLabel, - final double dblForwardShiftedLogNormalScaler, - final double dblFundingShiftedLogNormalScaler, - final int iStartDate, - final int iEndDate) - throws java.lang.Exception - { - if (iEndDate < iStartDate) - throw new java.lang.Exception - ("OptionHelper::IntegratedFRACrossVolConvexityAdjuster => Invalid Inputs"); - - return null == csqs || null == forwardLabel || null == fundingLabel || iEndDate == iStartDate ? 0. : - IntegratedFRACrossVolConvexityExponent (csqs.fundingVolatility (fundingLabel), - csqs.forwardVolatility (forwardLabel), csqs.forwardFundingCorrelation (forwardLabel, - fundingLabel), dblFundingShiftedLogNormalScaler, dblForwardShiftedLogNormalScaler, - iStartDate, iEndDate); - } -} diff --git a/org/drip/assetbacked/borrower/DTIExMortgage.java b/org/drip/assetbacked/borrower/DTIExMortgage.java deleted file mode 100644 index 695626b..0000000 --- a/org/drip/assetbacked/borrower/DTIExMortgage.java +++ /dev/null @@ -1,85 +0,0 @@ - -package org.drip.assetbacked.borrower; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DTIExMortgage contains the Borrower's current ex-of-mortgage Debt-to-Income Ratio. - * - * @author Lakshmi Krishnamurthy - */ - -public class DTIExMortgage { - private double _dblRatio = java.lang.Double.NaN; - - /** - * DTIExMortgage Constructor - * - * @param dblRatio The Borrower's Current Debt-to-income Ratio - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public DTIExMortgage ( - final double dblRatio) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblRatio = dblRatio)) - throw new java.lang.Exception ("DTIExMortgage Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Borrower's Current Debt-to-income Ratio - * - * @return The Borrower's Current Debt-to-income Ratio - */ - - public double ratio() - { - return _dblRatio; - } -} diff --git a/org/drip/assetbacked/borrower/DelinquentAccountsLast2Years.java b/org/drip/assetbacked/borrower/DelinquentAccountsLast2Years.java deleted file mode 100644 index 58e1010..0000000 --- a/org/drip/assetbacked/borrower/DelinquentAccountsLast2Years.java +++ /dev/null @@ -1,86 +0,0 @@ - -package org.drip.assetbacked.borrower; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DelinquentAccountsLast2Years contains the Total Number of Borrower Delinquent Accounts over the Last Two - * Years - * - * @author Lakshmi Krishnamurthy - */ - -public class DelinquentAccountsLast2Years { - private int _iCount = -1; - - /** - * DelinquentAccountsLast2Years Constructor - * - * @param iCount Count of the Delinquent Borrower Accounts over the last Two Years - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public DelinquentAccountsLast2Years ( - final int iCount) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_iCount = iCount)) - throw new java.lang.Exception ("DelinquentAccountsLast2Years Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Count of the Delinquent Borrower Accounts over the last Two Years - * - * @return The Count of the Delinquent Borrower Accounts over the last Two Years - */ - - public int count() - { - return _iCount; - } -} diff --git a/org/drip/assetbacked/borrower/MonthlyGrossIncome.java b/org/drip/assetbacked/borrower/MonthlyGrossIncome.java deleted file mode 100644 index 0ed4a7c..0000000 --- a/org/drip/assetbacked/borrower/MonthlyGrossIncome.java +++ /dev/null @@ -1,85 +0,0 @@ - -package org.drip.assetbacked.borrower; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * MonthlyGrossIncome contains the Borrower's Monthly Gross Income - * - * @author Lakshmi Krishnamurthy - */ - -public class MonthlyGrossIncome { - private double _dblAmount = java.lang.Double.NaN; - - /** - * MonthlyGrossIncome Constructor - * - * @param dblAmount The Borrower's Monthly Gross Income - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public MonthlyGrossIncome ( - final double dblAmount) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblAmount = dblAmount)) - throw new java.lang.Exception ("MonthlyGrossIncome Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Borrower's Monthly Gross Income - * - * @return The Borrower's Monthly Gross Income - */ - - public double amount() - { - return _dblAmount; - } -} diff --git a/org/drip/assetbacked/borrower/OriginationFICO.java b/org/drip/assetbacked/borrower/OriginationFICO.java deleted file mode 100644 index e276d81..0000000 --- a/org/drip/assetbacked/borrower/OriginationFICO.java +++ /dev/null @@ -1,85 +0,0 @@ - -package org.drip.assetbacked.borrower; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OriginationFICO contains the Borrower's FICO Score at a given Loan's Origination. - * - * @author Lakshmi Krishnamurthy - */ - -public class OriginationFICO { - private double _dblFICO = java.lang.Double.NaN; - - /** - * OriginationFICO Constructor - * - * @param dblFICO The Borrower's FICO Score at Origination - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public OriginationFICO ( - final double dblFICO) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblFICO = dblFICO)) - throw new java.lang.Exception ("OriginationFICO Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Borrower's FICO Score at Origination - * - * @return The Borrower's FICO Score at Origination - */ - - public double score() - { - return _dblFICO; - } -} diff --git a/org/drip/assetbacked/borrower/RevolvingUtilizationRate.java b/org/drip/assetbacked/borrower/RevolvingUtilizationRate.java deleted file mode 100644 index 9923845..0000000 --- a/org/drip/assetbacked/borrower/RevolvingUtilizationRate.java +++ /dev/null @@ -1,85 +0,0 @@ - -package org.drip.assetbacked.borrower; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * RevolvingUtilizationRate contains the Borrower's Net Revolving Utilization Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class RevolvingUtilizationRate { - private double _dblRate = java.lang.Double.NaN; - - /** - * RevolvingUtilizationRate Constructor - * - * @param dblRate The Borrower's Revolving Utilization Rate - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public RevolvingUtilizationRate ( - final double dblRate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblRate = dblRate)) - throw new java.lang.Exception ("RevolvingUtilizationRate Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Borrower's Revolving Utilization Rate - * - * @return The Borrower's Revolving Utilization Rate - */ - - public double rate() - { - return _dblRate; - } -} diff --git a/org/drip/assetbacked/borrower/TotalAccounts.java b/org/drip/assetbacked/borrower/TotalAccounts.java deleted file mode 100644 index 79e3166..0000000 --- a/org/drip/assetbacked/borrower/TotalAccounts.java +++ /dev/null @@ -1,85 +0,0 @@ - -package org.drip.assetbacked.borrower; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TotalAccounts contains the Total Current Number of Accounts for the Borrower - * - * @author Lakshmi Krishnamurthy - */ - -public class TotalAccounts { - private int _iCount = -1; - - /** - * TotalAccounts Constructor - * - * @param iCount Current Count of the Total Number of Accounts - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public TotalAccounts ( - final int iCount) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_iCount = iCount)) - throw new java.lang.Exception ("TotalAccounts Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Borrower's Current Count of the Total Number of Accounts - * - * @return The Borrower's Current Count of the Total Number of Accounts - */ - - public int count() - { - return _iCount; - } -} diff --git a/org/drip/assetbacked/loan/Age.java b/org/drip/assetbacked/loan/Age.java deleted file mode 100644 index 98bde3b..0000000 --- a/org/drip/assetbacked/loan/Age.java +++ /dev/null @@ -1,85 +0,0 @@ - -package org.drip.assetbacked.loan; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * Age contains the current Loan Age - i.e., the Months in Balance of an Asset Backed Loan - * - * @author Lakshmi Krishnamurthy - */ - -public class Age { - private double _dblMonthsInBalance = java.lang.Double.NaN; - - /** - * Age Constructor - * - * @param dblMonthsInBalance Outstanding Months in Balance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public Age ( - final double dblMonthsInBalance) - throws java.lang.Exception - { - if (0 >= (_dblMonthsInBalance = dblMonthsInBalance)) - throw new java.lang.Exception ("Age Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Loan Months in Balance - * - * @return The Loan Months in Balance - */ - - public double monthsInBalance() - { - return _dblMonthsInBalance; - } -} diff --git a/org/drip/assetbacked/loan/Coupon.java b/org/drip/assetbacked/loan/Coupon.java deleted file mode 100644 index 2ab3cbb..0000000 --- a/org/drip/assetbacked/loan/Coupon.java +++ /dev/null @@ -1,100 +0,0 @@ - -package org.drip.assetbacked.loan; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * Coupon contains the current Loan Annualized Coupon Rate and Frequency - * - * @author Lakshmi Krishnamurthy - */ - -public class Coupon { - private int _iFrequency = -1; - private double _dblRate = java.lang.Double.NaN; - - /** - * Coupon Constructor - * - * @param dblRate Loan Coupon Rate - * @param iFrequency Loan Coupon Frequency - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public Coupon ( - final double dblRate, - final int iFrequency) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblRate = dblRate) || 0 >= (_iFrequency = - iFrequency)) - throw new java.lang.Exception ("Coupon Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Loan Coupon Frequency - * - * @return The Loan Coupon Frequency - */ - - public int frequency() - { - return _iFrequency; - } - - /** - * Retrieve the Loan Coupon Rate - * - * @return The Loan Coupon Rate - */ - - public double rate() - { - return _dblRate; - } -} diff --git a/org/drip/assetbacked/loan/InquiriesLast6Months.java b/org/drip/assetbacked/loan/InquiriesLast6Months.java deleted file mode 100644 index 802d67f..0000000 --- a/org/drip/assetbacked/loan/InquiriesLast6Months.java +++ /dev/null @@ -1,85 +0,0 @@ - -package org.drip.assetbacked.loan; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * InquiriesLast6Months contains the Total Number of Inquiries for the Loan over the Last 6 Months - * - * @author Lakshmi Krishnamurthy - */ - -public class InquiriesLast6Months { - private int _iCount = -1; - - /** - * InquiriesLast6Months Constructor - * - * @param iCount Total Number of Inquiries for the Loan over the Last 6 Months - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public InquiriesLast6Months ( - final int iCount) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_iCount = iCount)) - throw new java.lang.Exception ("InquiriesLast6Months Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Total Number of Inquiries for the Loan over the Last 6 Months - * - * @return The Total Number of Inquiries for the Loan over the Last 6 Months - */ - - public int count() - { - return _iCount; - } -} diff --git a/org/drip/assetbacked/loan/OriginalPrincipal.java b/org/drip/assetbacked/loan/OriginalPrincipal.java deleted file mode 100644 index da3ab88..0000000 --- a/org/drip/assetbacked/loan/OriginalPrincipal.java +++ /dev/null @@ -1,85 +0,0 @@ - -package org.drip.assetbacked.loan; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OriginalPrincipal contains the Origination Loan Principal. - * - * @author Lakshmi Krishnamurthy - */ - -public class OriginalPrincipal { - private double _dblAmount = java.lang.Double.NaN; - - /** - * OriginalPrincipal Constructor - * - * @param dblAmount The Original Principal Amount - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public OriginalPrincipal ( - final double dblAmount) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblAmount = dblAmount)) - throw new java.lang.Exception ("OriginalPrincipal Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Original Principal Amount - * - * @return The Original Principal Amount - */ - - public double amount() - { - return _dblAmount; - } -} diff --git a/org/drip/assetbacked/loan/Term.java b/org/drip/assetbacked/loan/Term.java deleted file mode 100644 index 8a9ec6a..0000000 --- a/org/drip/assetbacked/loan/Term.java +++ /dev/null @@ -1,85 +0,0 @@ - -package org.drip.assetbacked.loan; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * Term contains the original Term of the Loan in Months - * - * @author Lakshmi Krishnamurthy - */ - -public class Term { - private double _dblMonths = java.lang.Double.NaN; - - /** - * Term Constructor - * - * @param dblMonths Outstanding Months in Balance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public Term ( - final double dblMonths) - throws java.lang.Exception - { - if (0 >= (_dblMonths = dblMonths)) - throw new java.lang.Exception ("Term Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Loan Term in Months - * - * @return The Loan Term in Months - */ - - public double months() - { - return _dblMonths; - } -} diff --git a/org/drip/assetbacked/loan/Vintage.java b/org/drip/assetbacked/loan/Vintage.java deleted file mode 100644 index 1bbd7bc..0000000 --- a/org/drip/assetbacked/loan/Vintage.java +++ /dev/null @@ -1,124 +0,0 @@ - -package org.drip.assetbacked.loan; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * Vintage contains the Loan Origination Vintage Details - i.e., the Year/Month of Loan Origination - * - * @author Lakshmi Krishnamurthy - */ - -public class Vintage { - private int _iOriginationYear = -1; - private int _iOriginationMonth = -1; - - /** - * Construct a Vintage Instance from the Origination Date - * - * @param dtOrigination The Origination Date - * - * @return Vintage Instance - */ - - public static final Vintage Standard ( - final org.drip.analytics.date.JulianDate dtOrigination) - { - if (null == dtOrigination) return null; - - try { - int iDate = dtOrigination.julian(); - - return new Vintage (org.drip.analytics.date.DateUtil.Year (iDate), - org.drip.analytics.date.DateUtil.Month (iDate)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Vintage Constructor - * - * @param iOriginationYear Loan Origination Year - * @param iOriginationMonth Loan Origination Month - * - * @throws java.lang.Exception Thrown if the Inputs are not Valid - */ - - public Vintage ( - final int iOriginationYear, - final int iOriginationMonth) - throws java.lang.Exception - { - if (0 > (_iOriginationYear = iOriginationYear) || 0 > (_iOriginationMonth = iOriginationMonth)) - throw new java.lang.Exception ("Vintage Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Origination Year - * - * @return The Origination Year - */ - - public int originationYear() - { - return _iOriginationYear; - } - - /** - * Retrieve the Origination Month - * - * @return The Origination Month - */ - - public int originationMonth() - { - return _iOriginationMonth; - } -} diff --git a/org/drip/dynamics/evolution/CurveStateEvolver.java b/org/drip/dynamics/evolution/CurveStateEvolver.java deleted file mode 100644 index 9df1828..0000000 --- a/org/drip/dynamics/evolution/CurveStateEvolver.java +++ /dev/null @@ -1,98 +0,0 @@ - -package org.drip.dynamics.evolution; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CurveStateEvolver is the Interface on top of which the Curve State Evolution Dynamics is constructed. - * - * @author Lakshmi Krishnamurthy - */ - -public interface CurveStateEvolver { - - /** - * Evolve the Latent State and return the LSQM Curve Update - * - * @param iSpotDate The Spot Date - * @param iViewDate The View Date - * @param iSpotTimeIncrement The Spot Evolution Increment - * @param lsqmPrev The Previous LSQM Curve Update - * - * @return The LSQM Curve Update - */ - - public abstract org.drip.dynamics.evolution.LSQMCurveUpdate evolve ( - final int iSpotDate, - final int iViewDate, - final int iSpotTimeIncrement, - final org.drip.dynamics.evolution.LSQMCurveUpdate lsqmPrev - ); - - /** - * Simulate the Principal Metric from the Start to the End Date - * - * @param iEvolutionStartDate The Evolution Start Date - * @param iEvolutionFinishDate The Evolution Finish Date - * @param iEvolutionIncrement The Evolution Increment - * @param iViewDate The View Date - * @param lsqmStart The Starting State Metrics - * @param iNumSimulation Number of Simulations - * - * @return The Array of the Evolved Tenor LIBOR's - */ - - public abstract double[][] simulatePrincipalMetric ( - final int iEvolutionStartDate, - final int iEvolutionFinishDate, - final int iEvolutionIncrement, - final int iViewDate, - final org.drip.dynamics.evolution.LSQMCurveUpdate lsqmStart, - final int iNumSimulation - ); -} diff --git a/org/drip/dynamics/evolution/LSQMCurveIncrement.java b/org/drip/dynamics/evolution/LSQMCurveIncrement.java deleted file mode 100644 index 464d2de..0000000 --- a/org/drip/dynamics/evolution/LSQMCurveIncrement.java +++ /dev/null @@ -1,168 +0,0 @@ - -package org.drip.dynamics.evolution; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * LSQMCurveIncrement contains the Increment of the Evolving Term Structure of the Latent State - * Quantification Metrics. - * - * @author Lakshmi Krishnamurthy - */ - -public class LSQMCurveIncrement { - private java.util.Map> - _mmIncrement = new java.util.HashMap>(); - - /** - * Empty LSQMCurveIncrement Constructor - */ - - public LSQMCurveIncrement() - { - } - - /** - * Retrieve the Latent State Labels - * - * @return The Latent State Labels - */ - - public java.util.Set latentStateLabel() - { - return _mmIncrement.keySet(); - } - - /** - * Indicate if Quantification Metrics are available for the specified Latent State - * - * @param lsl The Latent State Label - * - * @return TRUE - Quantification Metrics are available for the specified Latent State - */ - - public boolean containsLatentState ( - final org.drip.state.identifier.LatentStateLabel lsl) - { - return null == lsl ? false : _mmIncrement.containsKey (lsl.fullyQualifiedName()); - } - - /** - * Indicate if the Value for the specified Quantification Metric is available - * - * @param lsl The Latent State Label - * @param strQM The Quantification Metric - * - * @return TRUE - The Requested Value is available - */ - - public boolean containsQM ( - final org.drip.state.identifier.LatentStateLabel lsl, - final java.lang.String strQM) - { - if (null == lsl || null == strQM || strQM.isEmpty()) return false; - - java.lang.String strLabel = lsl.fullyQualifiedName(); - - return _mmIncrement.containsKey (strLabel) && _mmIncrement.get (strLabel).containsKey (strQM); - } - - /** - * Set the LSQM Increment Span - * - * @param lsl The Latent State Label - * @param strQM The Quantification Metric - * @param spanIncrement The Increment Span - * - * @return TRUE - The LSQM Increment Span successfully set - */ - - public boolean setQMSpan ( - final org.drip.state.identifier.LatentStateLabel lsl, - final java.lang.String strQM, - final org.drip.spline.grid.Span spanIncrement) - { - if (null == lsl || null == strQM || strQM.isEmpty() || null == spanIncrement) return false; - - java.lang.String strLabel = lsl.fullyQualifiedName(); - - java.util.Map mapSpanIncrement = - _mmIncrement.containsKey (strLabel) ? _mmIncrement.get (strLabel) : new - java.util.HashMap(); - - mapSpanIncrement.put (strQM, spanIncrement); - - _mmIncrement.put (strLabel, mapSpanIncrement); - - return true; - } - - /** - * Retrieve the specified Latent State Quantification Metric Span Increment - * - * @param lsl The Latent State Label - * @param strQM The Quantification Metric - * - * @return The Latent State Quantification Metric Span Increment - */ - - public org.drip.spline.grid.Span span ( - final org.drip.state.identifier.LatentStateLabel lsl, - final java.lang.String strQM) - { - if (null == lsl || null == strQM || strQM.isEmpty()) return null; - - java.lang.String strLabel = lsl.fullyQualifiedName(); - - java.util.Map mapSpanIncrement = _mmIncrement.get - (strLabel); - - return mapSpanIncrement.containsKey (strQM) ? mapSpanIncrement.get (strQM) : null; - } -} diff --git a/org/drip/dynamics/evolution/LSQMCurveSnapshot.java b/org/drip/dynamics/evolution/LSQMCurveSnapshot.java deleted file mode 100644 index c806b81..0000000 --- a/org/drip/dynamics/evolution/LSQMCurveSnapshot.java +++ /dev/null @@ -1,166 +0,0 @@ - -package org.drip.dynamics.evolution; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * LSQMCurveSnapshot contains the Snapshot of the Evolving Term Structure of the Latent State Quantification - * Metrics. - * - * @author Lakshmi Krishnamurthy - */ - -public class LSQMCurveSnapshot { - private java.util.Map> _mmCurve = new java.util.HashMap>(); - - /** - * Empty LSQMCurveSnapshot Constructor - */ - - public LSQMCurveSnapshot() - { - } - - /** - * Retrieve the Latent State Labels - * - * @return The Latent State Labels - */ - - public java.util.Set latentStateLabel() - { - return _mmCurve.keySet(); - } - - /** - * Indicate if Quantification Metrics are available for the specified Latent State - * - * @param lsl The Latent State Label - * - * @return TRUE - Quantification Metrics are available for the specified Latent State - */ - - public boolean containsLatentState ( - final org.drip.state.identifier.LatentStateLabel lsl) - { - return null == lsl ? false : _mmCurve.containsKey (lsl.fullyQualifiedName()); - } - - /** - * Indicate if the Value for the specified Quantification Metric is available - * - * @param lsl The Latent State Label - * @param strQM The Quantification Metric - * - * @return TRUE - The Requested Value is available - */ - - public boolean containsQM ( - final org.drip.state.identifier.LatentStateLabel lsl, - final java.lang.String strQM) - { - if (null == lsl || null == strQM || strQM.isEmpty()) return false; - - java.lang.String strLabel = lsl.fullyQualifiedName(); - - return _mmCurve.containsKey (strLabel) && _mmCurve.get (strLabel).containsKey (strQM); - } - - /** - * Set the LSQM Curve - * - * @param strQM The Quantification Metric - * @param curve The QM Curve - * - * @return TRUE - The QM successfully set - */ - - public boolean setQMCurve ( - final java.lang.String strQM, - final org.drip.analytics.definition.Curve curve) - { - if (null == strQM || strQM.isEmpty() || null == curve) return false; - - java.lang.String strLabel = curve.label().fullyQualifiedName(); - - java.util.Map mapCurve = _mmCurve.containsKey - (strLabel) ? _mmCurve.get (strLabel) : new java.util.HashMap(); - - mapCurve.put (strQM, curve); - - _mmCurve.put (strLabel, mapCurve); - - return true; - } - - /** - * Retrieve the specified Latent State Quantification Metric Curve - * - * @param lsl The Latent State Label - * @param strQM The Quantification Metric - * - * @return The Latent State Quantification Metric Curve - */ - - public org.drip.analytics.definition.Curve qm ( - final org.drip.state.identifier.LatentStateLabel lsl, - final java.lang.String strQM) - { - if (null == lsl || null == strQM || strQM.isEmpty()) return null; - - java.lang.String strLabel = lsl.fullyQualifiedName(); - - java.util.Map mapCurve = _mmCurve.get - (strLabel); - - return mapCurve.containsKey (strQM) ? mapCurve.get (strQM) : null; - } -} diff --git a/org/drip/dynamics/evolution/LSQMCurveUpdate.java b/org/drip/dynamics/evolution/LSQMCurveUpdate.java deleted file mode 100644 index 20559fa..0000000 --- a/org/drip/dynamics/evolution/LSQMCurveUpdate.java +++ /dev/null @@ -1,131 +0,0 @@ - -package org.drip.dynamics.evolution; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * LSQMCurveUpdate contains the Snapshot and the Increment of the Evolving Curve Latent State Quantification - * Metrics. - * - * @author Lakshmi Krishnamurthy - */ - -public class LSQMCurveUpdate { - private int _iFinalDate = java.lang.Integer.MIN_VALUE; - private int _iInitialDate = java.lang.Integer.MIN_VALUE; - private org.drip.dynamics.evolution.LSQMCurveSnapshot _snapshot = null; - private org.drip.dynamics.evolution.LSQMCurveIncrement _increment = null; - - /** - * LSQMCurveUpdate Constructor - * - * @param iInitialDate The Initial Date - * @param iFinalDate The Final Date - * @param snapshot The LSQM Curve Snapshot - * @param increment The LSQM Curve Increment - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public LSQMCurveUpdate ( - final int iInitialDate, - final int iFinalDate, - final org.drip.dynamics.evolution.LSQMCurveSnapshot snapshot, - final org.drip.dynamics.evolution.LSQMCurveIncrement increment) - throws java.lang.Exception - { - if (null == (_snapshot = snapshot) || (_iFinalDate = iFinalDate) < (_iInitialDate = iInitialDate)) - throw new java.lang.Exception ("LSQMCurveUpdate ctr: Invalid Inputs"); - - _increment = increment; - } - - /** - * Retrieve the Initial Date - * - * @return The Initial Date - */ - - public int initialDate() - { - return _iInitialDate; - } - - /** - * Retrieve the Final Date - * - * @return The Final Date - */ - - public int finalDate() - { - return _iFinalDate; - } - - /** - * Retrieve the LSQM Curve Snapshot - * - * @return The LSQM Curve Snapshot - */ - - public org.drip.dynamics.evolution.LSQMCurveSnapshot snapshot() - { - return _snapshot; - } - - /** - * Retrieve the LSQM Curve Increment - * - * @return The LSQM Curve Increment - */ - - public org.drip.dynamics.evolution.LSQMCurveIncrement increment() - { - return _increment; - } -} diff --git a/org/drip/dynamics/evolution/LSQMPointRecord.java b/org/drip/dynamics/evolution/LSQMPointRecord.java deleted file mode 100644 index d8b858a..0000000 --- a/org/drip/dynamics/evolution/LSQMPointRecord.java +++ /dev/null @@ -1,178 +0,0 @@ - -package org.drip.dynamics.evolution; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * LSQMPointRecord contains the Record of the Evolving Point Latent State Quantification Metrics. - * - * @author Lakshmi Krishnamurthy - */ - -public class LSQMPointRecord { - private java.util.Map> _mmLSQMValue = - new java.util.HashMap>(); - - /** - * Empty LSQMPointRecord Constructor - */ - - public LSQMPointRecord() - { - } - - /** - * Retrieve the Latent State Labels - * - * @return The Latent State Labels - */ - - public java.util.Set latentStateLabel() - { - return _mmLSQMValue.keySet(); - } - - /** - * Indicate if Quantification Metrics are available for the specified Latent State - * - * @param lsl The Latent State Label - * - * @return TRUE - Quantification Metrics are available for the specified Latent State - */ - - public boolean containsLatentState ( - final org.drip.state.identifier.LatentStateLabel lsl) - { - return null == lsl ? false : _mmLSQMValue.containsKey (lsl.fullyQualifiedName()); - } - - /** - * Set the LSQM Value - * - * @param lsl The Latent State Label - * @param strQM The Quantification Metric - * @param dblValue The QM's Value - * - * @return TRUE - The QM successfully set - */ - - public boolean setQM ( - final org.drip.state.identifier.LatentStateLabel lsl, - final java.lang.String strQM, - final double dblValue) - { - if (null == lsl || null == strQM || strQM.isEmpty() || !org.drip.quant.common.NumberUtil.IsValid - (dblValue)) - return false; - - java.lang.String strLatentStateLabel = lsl.fullyQualifiedName(); - - java.util.Map mapLSQM = _mmLSQMValue.containsKey - (strLatentStateLabel) ? _mmLSQMValue.get (strLatentStateLabel) : new - java.util.HashMap(); - - mapLSQM.put (strQM, dblValue); - - _mmLSQMValue.put (lsl.fullyQualifiedName(), mapLSQM); - - return true; - } - - /** - * Indicate if the Value for the specified Quantification Metric is available - * - * @param lsl The Latent State Label - * @param strQM The Quantification Metric - * - * @return TRUE - The Requested Value is available - */ - - public boolean containsQM ( - final org.drip.state.identifier.LatentStateLabel lsl, - final java.lang.String strQM) - { - if (null == lsl || null == strQM || strQM.isEmpty()) return false; - - java.lang.String strLatentStateLabel = lsl.fullyQualifiedName(); - - return _mmLSQMValue.containsKey (strLatentStateLabel) && _mmLSQMValue.get - (strLatentStateLabel).containsKey (strQM); - } - - /** - * Retrieve the specified Quantification Metric Value - * - * @param lsl The Latent State Label - * @param strQM The Quantification Metric - * - * @return The Quantification Metric Value - * - * @throws java.lang.Exception Thrown if the Quantification Metric is not available - */ - - public double qm ( - final org.drip.state.identifier.LatentStateLabel lsl, - final java.lang.String strQM) - throws java.lang.Exception - { - if (null == lsl || null == strQM || strQM.isEmpty()) - throw new java.lang.Exception ("LSQMPointRecord::qm => Invalid Inputs"); - - java.lang.String strLatentStateLabel = lsl.fullyQualifiedName(); - - if (!_mmLSQMValue.containsKey (strLatentStateLabel)) - throw new java.lang.Exception ("LSQMPointRecord::qm => Invalid Inputs"); - - java.util.Map mapLSQM = _mmLSQMValue.get (strLatentStateLabel); - - if (!mapLSQM.containsKey (strQM)) - throw new java.lang.Exception ("LSQMPointRecord::qm => No LSQM Entry"); - - return mapLSQM.get (strQM); - } -} diff --git a/org/drip/dynamics/evolution/LSQMPointUpdate.java b/org/drip/dynamics/evolution/LSQMPointUpdate.java deleted file mode 100644 index a15dd17..0000000 --- a/org/drip/dynamics/evolution/LSQMPointUpdate.java +++ /dev/null @@ -1,146 +0,0 @@ - -package org.drip.dynamics.evolution; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * LSQMPointUpdate contains the Snapshot and the Increment of the Evolving Point Latent State Quantification - * Metrics. - * - * @author Lakshmi Krishnamurthy - */ - -public class LSQMPointUpdate { - private int _iViewDate = java.lang.Integer.MIN_VALUE; - private int _iEvolutionStartDate = java.lang.Integer.MIN_VALUE; - private int _iEvolutionFinishDate = java.lang.Integer.MIN_VALUE; - private org.drip.dynamics.evolution.LSQMPointRecord _lprSnapshot = null; - private org.drip.dynamics.evolution.LSQMPointRecord _lprIncrement = null; - - /** - * LSQMPointUpdate Constructor - * - * @param iEvolutionStartDate The Evolution Start Date - * @param iEvolutionFinishDate The Evolution Finish Date - * @param iViewDate The View Date - * @param lprSnapshot The LSQM Point Record Snapshot - * @param lprIncrement The LSQM Point Record Update - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public LSQMPointUpdate ( - final int iEvolutionStartDate, - final int iEvolutionFinishDate, - final int iViewDate, - final org.drip.dynamics.evolution.LSQMPointRecord lprSnapshot, - final org.drip.dynamics.evolution.LSQMPointRecord lprIncrement) - throws java.lang.Exception - { - if (null == (_lprSnapshot = lprSnapshot) || (_iEvolutionFinishDate = iEvolutionFinishDate) < - (_iEvolutionStartDate = iEvolutionStartDate) || (_iViewDate = iViewDate) < _iEvolutionStartDate) - throw new java.lang.Exception ("LSQMPointUpdate ctr: Invalid Inputs"); - - _lprIncrement = lprIncrement; - } - - /** - * Retrieve the Evolution Start Date - * - * @return The Evolution Start Date - */ - - public int evolutionStartDate() - { - return _iEvolutionStartDate; - } - - /** - * Retrieve the Evolution Finish Date - * - * @return The Evolution Finish Date - */ - - public int evolutionFinishDate() - { - return _iEvolutionFinishDate; - } - - /** - * Retrieve the View Date - * - * @return The View Date - */ - - public int viewDate() - { - return _iViewDate; - } - - /** - * Retrieve the LSQM Point Snapshot - * - * @return The LSQM Point Snapshot - */ - - public org.drip.dynamics.evolution.LSQMPointRecord snapshot() - { - return _lprSnapshot; - } - - /** - * Retrieve the LSQM Point Increment - * - * @return The LSQM Point Increment - */ - - public org.drip.dynamics.evolution.LSQMPointRecord increment() - { - return _lprIncrement; - } -} diff --git a/org/drip/dynamics/evolution/PointStateEvolver.java b/org/drip/dynamics/evolution/PointStateEvolver.java deleted file mode 100644 index 206a5a2..0000000 --- a/org/drip/dynamics/evolution/PointStateEvolver.java +++ /dev/null @@ -1,76 +0,0 @@ - -package org.drip.dynamics.evolution; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * PointStateEvolver is the Interface on top of which the Point State Evolution Dynamics is constructed. - * - * @author Lakshmi Krishnamurthy - */ - -public interface PointStateEvolver { - - /** - * Evolve the Latent State and return the LSQM Point Update - * - * @param iSpotDate The Spot Date - * @param iViewDate The View Date - * @param iSpotTimeIncrement The Spot Time Increment - * @param lsqmPrev The Previous LSQM Point Update - * - * @return The LSQM Point Update - */ - - public abstract org.drip.dynamics.evolution.LSQMPointUpdate evolve ( - final int iSpotDate, - final int iViewDate, - final int iSpotTimeIncrement, - final org.drip.dynamics.evolution.LSQMPointUpdate lsqmPrev - ); -} diff --git a/org/drip/dynamics/hjm/G2PlusPlus.java b/org/drip/dynamics/hjm/G2PlusPlus.java deleted file mode 100644 index d0efb49..0000000 --- a/org/drip/dynamics/hjm/G2PlusPlus.java +++ /dev/null @@ -1,261 +0,0 @@ - -package org.drip.dynamics.hjm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * G2PlusPlus provides the Hull-White-type, but Two-Factor Gaussian HJM Short Rate Dynamics Implementation. - * - * @author Lakshmi Krishnamurthy - */ - -public class G2PlusPlus { - private double _dblA = java.lang.Double.NaN; - private double _dblB = java.lang.Double.NaN; - private double _dblEta = java.lang.Double.NaN; - private double _dblRho = java.lang.Double.NaN; - private double _dblSigma = java.lang.Double.NaN; - private org.drip.function.definition.R1ToR1 _auIFRInitial = null; - private org.drip.sequence.random.UnivariateSequenceGenerator[] _aRSG = null; - - /** - * G2PlusPlus Constructor - * - * @param dblSigma Sigma - * @param dblA A - * @param dblEta Eta - * @param dblB B - * @param aRSG Array of the Random Sequence Generators - * @param dblRho Rho - * @param auIFRInitial The Initial Instantaneous Forward Rate Term Structure - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public G2PlusPlus ( - final double dblSigma, - final double dblA, - final double dblEta, - final double dblB, - final org.drip.sequence.random.UnivariateSequenceGenerator[] aRSG, - final double dblRho, - final org.drip.function.definition.R1ToR1 auIFRInitial) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblSigma = dblSigma) || - !org.drip.quant.common.NumberUtil.IsValid (_dblA = dblA) || - !org.drip.quant.common.NumberUtil.IsValid (_dblEta = dblEta) || - !org.drip.quant.common.NumberUtil.IsValid (_dblB = dblB) || null == (_aRSG = aRSG) || 2 - != _aRSG.length || !org.drip.quant.common.NumberUtil.IsValid (_dblRho = dblRho) || - null == (_auIFRInitial = auIFRInitial)) - throw new java.lang.Exception ("G2PlusPlus ctr: Invalid Inputs"); - } - - /** - * Retrieve Sigma - * - * @return Sigma - */ - - public double sigma() - { - return _dblSigma; - } - - /** - * Retrieve A - * - * @return A - */ - - public double a() - { - return _dblA; - } - - /** - * Retrieve Eta - * - * @return Eta - */ - - public double eta() - { - return _dblEta; - } - - /** - * Retrieve B - * - * @return B - */ - - public double b() - { - return _dblB; - } - - /** - * Retrieve the Initial Instantaneous Forward Rate Term Structure - * - * @return The Initial Instantaneous Forward Rate Term Structure - */ - - public org.drip.function.definition.R1ToR1 ifrInitialTermStructure() - { - return _auIFRInitial; - } - - /** - * Retrieve the Random Sequence Generator Array - * - * @return The Random Sequence Generator Array - */ - - public org.drip.sequence.random.UnivariateSequenceGenerator[] rsg() - { - return _aRSG; - } - - /** - * Retrieve Rho - * - * @return Rho - */ - - public double rho() - { - return _dblRho; - } - - /** - * Compute the G2++ Phi - * - * @param iSpotDate The Spot Date - * @param iViewDate The View Date - * - * @return The G2++ Phi - * - * @throws java.lang.Exception Thrown if the G2++ Phi cannot be computed - */ - - public double phi ( - final int iSpotDate, - final int iViewDate) - throws java.lang.Exception - { - if (iSpotDate > iViewDate) throw new java.lang.Exception ("G2PlusPlus::phi => Invalid Inputs"); - - double dblSpotViewDCF = 1. * (iViewDate - iSpotDate) / 365.25; - - double dblFactor1Phi = _dblSigma / _dblA * (1. - java.lang.Math.exp (-1. * _dblA * dblSpotViewDCF)); - - double dblFactor2Phi = _dblEta / _dblB * (1. - java.lang.Math.exp (-1. * _dblB * dblSpotViewDCF)); - - return _auIFRInitial.evaluate (iViewDate) + 0.5 * dblFactor1Phi * dblFactor1Phi + 0.5 * dblFactor2Phi - * dblFactor2Phi; - } - - /** - * Compute the X Increment - * - * @param iSpotDate The Spot Date - * @param iViewDate The View Date - * @param dblX The X Value - * @param iSpotTimeIncrement The Spot Time Increment - * - * @return The X Increment - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double deltaX ( - final int iSpotDate, - final int iViewDate, - final double dblX, - final int iSpotTimeIncrement) - throws java.lang.Exception - { - if (iSpotDate > iViewDate || !org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception ("G2PlusPlus::deltaX => Invalid Inputs"); - - double dblAnnualizedIncrement = 1. * iSpotTimeIncrement / 365.25; - - return -1. * _dblA * dblX * dblAnnualizedIncrement + _dblSigma * java.lang.Math.sqrt - (dblAnnualizedIncrement) * _aRSG[0].random(); - } - - /** - * Compute the Y Increment - * - * @param iSpotDate The Spot Date - * @param iViewDate The View Date - * @param dblY The Y Value - * @param iSpotTimeIncrement The Spot Time Increment - * - * @return The Y Increment - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double deltaY ( - final int iSpotDate, - final int iViewDate, - final double dblY, - final int iSpotTimeIncrement) - throws java.lang.Exception - { - if (iSpotDate > iViewDate || !org.drip.quant.common.NumberUtil.IsValid (dblY)) - throw new java.lang.Exception ("G2PlusPlus::deltaY => Invalid Inputs"); - - double dblAnnualizedIncrement = 1. * iSpotTimeIncrement / 365.25; - - return -1. * _dblB * dblY * dblAnnualizedIncrement + _dblEta * java.lang.Math.sqrt - (dblAnnualizedIncrement) * _aRSG[1].random(); - } -} diff --git a/org/drip/dynamics/hjm/MultiFactorStateEvolver.java b/org/drip/dynamics/hjm/MultiFactorStateEvolver.java deleted file mode 100644 index 8bea646..0000000 --- a/org/drip/dynamics/hjm/MultiFactorStateEvolver.java +++ /dev/null @@ -1,525 +0,0 @@ - -package org.drip.dynamics.hjm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * MultiFactorStateEvolver sets up and implements the Base Multi-Factor No-arbitrage Dynamics of the Rates - * State Quantifiers as formulated in: - * - * Heath, D., R. Jarrow, and A. Morton (1992): Bond Pricing and Term Structure of Interest Rates: A New - * Methodology for Contingent Claims Valuation, Econometrica 60 (1), 77-105. - * - * In particular it looks to evolve the Multi-factor Instantaneous Forward Rates. - * - * @author Lakshmi Krishnamurthy - */ - -public class MultiFactorStateEvolver implements org.drip.dynamics.evolution.PointStateEvolver { - private org.drip.dynamics.hjm.MultiFactorVolatility _mfv = null; - private org.drip.state.identifier.ForwardLabel _lslForward = null; - private org.drip.state.identifier.FundingLabel _lslFunding = null; - private org.drip.function.definition.R1ToR1 _auInitialInstantaneousForwardRate = null; - - /** - * MultiFactorStateEvolver Constructor - * - * @param lslFunding The Funding Latent State Label - * @param lslForward The Forward Latent State Label - * @param mfv The Multi-Factor Volatility Instance - * @param auInitialInstantaneousForwardRate The Initial Instantaneous Forward Rate Term Structure - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public MultiFactorStateEvolver ( - final org.drip.state.identifier.FundingLabel lslFunding, - final org.drip.state.identifier.ForwardLabel lslForward, - final org.drip.dynamics.hjm.MultiFactorVolatility mfv, - final org.drip.function.definition.R1ToR1 auInitialInstantaneousForwardRate) - throws java.lang.Exception - { - if (null == (_lslFunding = lslFunding) || null == (_lslForward = lslForward) || null == (_mfv = mfv) - || null == (_auInitialInstantaneousForwardRate = auInitialInstantaneousForwardRate)) - throw new java.lang.Exception ("MultiFactorStateEvolver ctr: Invalid Inputs"); - } - - /** - * Retrieve the Funding Label - * - * @return The Funding Label - */ - - public org.drip.state.identifier.FundingLabel fundingLabel() - { - return _lslFunding; - } - - /** - * Retrieve the Forward Label - * - * @return The Forward Label - */ - - public org.drip.state.identifier.ForwardLabel forwardLabel() - { - return _lslForward; - } - - /** - * Retrieve the Multi-factor Volatility Instance - * - * @return The Multi-factor Volatility Instance - */ - - public org.drip.dynamics.hjm.MultiFactorVolatility mfv() - { - return _mfv; - } - - /** - * Retrieve the Initial Instantaneous Forward Rate Term Structure - * - * @return The Initial Instantaneous Forward Rate Term Structure - */ - - public org.drip.function.definition.R1ToR1 instantaneousForwardInitialTermStructure() - { - return _auInitialInstantaneousForwardRate; - } - - /** - * Compute the Instantaneous Forward Rate Increment given the View Date, the Target Date, and the View - * Time Increment - * - * @param iViewDate The View Date - * @param iTargetDate The Target Date - * @param iViewTimeIncrement The View Time Increment - * - * @return The Instantaneous Forward Rate Increment - * - * @throws java.lang.Exception Thrown if the Instantaneous Forward Rate Increment cannot be computed - */ - - public double instantaneousForwardRateIncrement ( - final int iViewDate, - final int iTargetDate, - final int iViewTimeIncrement) - throws java.lang.Exception - { - if (iTargetDate <= iViewDate) - throw new java.lang.Exception - ("MultiFactorStateEvolver::instantaneousForwardRateIncrement => Invalid Inputs"); - - org.drip.sequence.random.PrincipalFactorSequenceGenerator pfsg = _mfv.msg(); - - int iNumFactor = pfsg.numFactor(); - - double[] adblMultivariateRandom = pfsg.random(); - - double dblIntantaneousForwardRateIncrement = 0.; - double dblAnnualizedTimeIncrement = 1. * iViewTimeIncrement / 365.25; - - double dblAnnualizedTimeIncrementSQRT = java.lang.Math.sqrt (dblAnnualizedTimeIncrement); - - for (int i = 0; i < iNumFactor; ++i) { - double dblWeightedFactorPointVolatility = _mfv.weightedFactorPointVolatility (i, iViewDate, - iTargetDate); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblWeightedFactorPointVolatility)) - throw new java.lang.Exception - ("MultiFactorStateEvolver::instantaneousForwardRateIncrement => Cannot compute View/Target Date Point Volatility"); - - dblIntantaneousForwardRateIncrement += _mfv.volatilityIntegral (i, iViewDate, iTargetDate) * - dblWeightedFactorPointVolatility * dblAnnualizedTimeIncrement + - dblWeightedFactorPointVolatility * dblAnnualizedTimeIncrementSQRT * - adblMultivariateRandom[i]; - } - - return dblIntantaneousForwardRateIncrement; - } - - /** - * Compute the Proportional Price Increment given the View Date, the Target Date, the Short Rate, and the - * View Time Increment - * - * @param iViewDate The View Date - * @param iTargetDate The Target Date - * @param dblShortRate The Short Rate - * @param iViewTimeIncrement The View Time Increment - * - * @return The Proportional Price Increment - * - * @throws java.lang.Exception Thrown if the Proportional Price Increment cannot be computed - */ - - public double proportionalPriceIncrement ( - final int iViewDate, - final int iTargetDate, - final double dblShortRate, - final int iViewTimeIncrement) - throws java.lang.Exception - { - if (iTargetDate <= iViewDate || !org.drip.quant.common.NumberUtil.IsValid (dblShortRate)) - throw new java.lang.Exception - ("MultiFactorStateEvolver::proportionalPriceIncrement => Invalid Inputs"); - - org.drip.sequence.random.PrincipalFactorSequenceGenerator pfsg = _mfv.msg(); - - int iNumFactor = pfsg.numFactor(); - - double[] adblMultivariateRandom = pfsg.random(); - - double dblAnnualizedTimeIncrement = 1. * iViewTimeIncrement / 365.25; - double dblProportionalPriceIncrement = dblShortRate * dblAnnualizedTimeIncrement; - - double dblAnnualizedTimeIncrementSQRT = java.lang.Math.sqrt (dblAnnualizedTimeIncrement); - - for (int i = 0; i < iNumFactor; ++i) - dblProportionalPriceIncrement -= _mfv.volatilityIntegral (i, iViewDate, iTargetDate) * - dblAnnualizedTimeIncrementSQRT * adblMultivariateRandom[i]; - - return dblProportionalPriceIncrement; - } - - /** - * Compute the Short Rate Increment given the Spot Date, the View Date, and the View Time Increment - * - * @param iSpotDate The Spot Date - * @param iViewDate The View Date - * @param iViewTimeIncrement The View Time Increment - * - * @return The Short Rate Increment - * - * @throws java.lang.Exception Thrown if the Short Rate Increment cannot be computed - */ - - public double shortRateIncrement ( - final int iSpotDate, - final int iViewDate, - final int iViewTimeIncrement) - throws java.lang.Exception - { - if (iSpotDate > iViewDate) - throw new java.lang.Exception ("MultiFactorStateEvolver::shortRateIncrement => Invalid Inputs"); - - org.drip.sequence.random.PrincipalFactorSequenceGenerator pfsg = _mfv.msg(); - - double[] adblMultivariateRandom = pfsg.random(); - - int iNumFactor = pfsg.numFactor(); - - double dblShortRateIncrement = 0.; - double dblAnnualizedIncrement = 1. * iViewTimeIncrement / 365.25; - - double dblAnnualizedIncrementSQRT = java.lang.Math.sqrt (dblAnnualizedIncrement); - - for (int i = 0; i < iNumFactor; ++i) { - double dblViewWeightedFactorVolatility = _mfv.weightedFactorPointVolatility (i, iViewDate, - iViewDate); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblViewWeightedFactorVolatility)) - throw new java.lang.Exception - ("MultiFactorStateEvolver::shortRateIncrement => Cannot compute View Date Factor Volatility"); - - dblShortRateIncrement += _mfv.volatilityIntegral (i, iSpotDate, iViewDate) * - dblViewWeightedFactorVolatility * dblAnnualizedIncrement + dblViewWeightedFactorVolatility * - dblAnnualizedIncrementSQRT * adblMultivariateRandom[i]; - } - - return dblShortRateIncrement; - } - - /** - * Compute the Continuously Compounded Short Rate Increment given the Spot Date, the View Date, the - * Target Date, the Continuously Compounded Short Rate, the Current Short Rate, and the View Time - * Increment. - * - * @param iSpotDate The Spot Date - * @param iViewDate The View Date - * @param iTargetDate The Target Date - * @param dblCompoundedShortRate The Compounded Short Rate - * @param dblShortRate The Short Rate - * @param iViewTimeIncrement The View Time Increment - * - * @return The Short Rate Increment - * - * @throws java.lang.Exception Thrown if the Continuously Compounded Short Rate Increment cannot be - * computed - */ - - public double compoundedShortRateIncrement ( - final int iSpotDate, - final int iViewDate, - final int iTargetDate, - final double dblCompoundedShortRate, - final double dblShortRate, - final int iViewTimeIncrement) - throws java.lang.Exception - { - if (iSpotDate > iViewDate || iViewDate >= iTargetDate) - throw new java.lang.Exception - ("MultiFactorStateEvolver::compoundedShortRateIncrement => Invalid Inputs"); - - org.drip.sequence.random.PrincipalFactorSequenceGenerator pfsg = _mfv.msg(); - - int iNumFactor = pfsg.numFactor(); - - double[] adblMultivariateRandom = pfsg.random(); - - double dblAnnualizedIncrement = 1. * iViewTimeIncrement / 365.25; - double dblCompoundedShortRateIncrement = (dblCompoundedShortRate - dblShortRate) * - dblAnnualizedIncrement; - - double dblAnnualizedIncrementSQRT = java.lang.Math.sqrt (dblAnnualizedIncrement); - - for (int i = 0; i < iNumFactor; ++i) { - double dblViewTargetVolatilityIntegral = _mfv.volatilityIntegral (i, iViewDate, iTargetDate); - - dblCompoundedShortRateIncrement += 0.5 * dblViewTargetVolatilityIntegral * - dblViewTargetVolatilityIntegral * dblAnnualizedIncrement + dblViewTargetVolatilityIntegral * - dblAnnualizedIncrementSQRT * adblMultivariateRandom[i]; - } - - return dblCompoundedShortRateIncrement * 365.25 / (iTargetDate - iViewDate); - } - - /** - * Compute the LIBOR Forward Rate Increment given the Spot Date, the View Date, the Target Date, the - * Current LIBOR Forward Rate, and the View Time Increment - * - * @param iSpotDate The Spot Date - * @param iViewDate The View Date - * @param iTargetDate The Target Date - * @param dblLIBORForwardRate The LIBOR Forward Rate - * @param iViewTimeIncrement The View Time Increment - * - * @return The Forward Rate Increment - * - * @throws java.lang.Exception Thrown if the LIBOR Forward Rate Increment cannot be computed - */ - - public double liborForwardRateIncrement ( - final int iSpotDate, - final int iViewDate, - final int iTargetDate, - final double dblLIBORForwardRate, - final int iViewTimeIncrement) - throws java.lang.Exception - { - if (iSpotDate > iViewDate || iViewDate >= iTargetDate || !org.drip.quant.common.NumberUtil.IsValid - (dblLIBORForwardRate)) - throw new java.lang.Exception - ("MultiFactorStateEvolver::liborForwardRateIncrement => Invalid Inputs"); - - double dblAnnualizedTimeIncrementSQRT = java.lang.Math.sqrt (1. * iViewTimeIncrement / 365.25); - - org.drip.sequence.random.PrincipalFactorSequenceGenerator pfsg = _mfv.msg(); - - double[] adblMultivariateRandom = pfsg.random(); - - double dblLIBORForwardRateVolIncrement = 0.; - - int iNumFactor = pfsg.numFactor(); - - for (int i = 0; i < iNumFactor; ++i) - dblLIBORForwardRateVolIncrement += _mfv.volatilityIntegral (i, iViewDate, iTargetDate) * - (_mfv.volatilityIntegral (i, iSpotDate, iTargetDate) + dblAnnualizedTimeIncrementSQRT * - adblMultivariateRandom[i]); - - return (dblLIBORForwardRate + (365.25 / (iTargetDate - iViewDate))) * - dblLIBORForwardRateVolIncrement; - } - - /** - * Compute the Shifted LIBOR Forward Rate Increment given the Spot Date, the View Date, the Target Date, - * the Current Shifted LIBOR Forward Rate, and the View Time Increment - * - * @param iSpotDate The Spot Date - * @param iViewDate The View Date - * @param iTargetDate The Target Date - * @param dblShiftedLIBORForwardRate The Shifted LIBOR Forward Rate - * @param iViewTimeIncrement The View Time Increment - * - * @return The Shifted Forward Rate Increment - * - * @throws java.lang.Exception Thrown if the Shifted LIBOR Forward Rate Increment cannot be computed - */ - - public double shiftedLIBORForwardIncrement ( - final int iSpotDate, - final int iViewDate, - final int iTargetDate, - final double dblShiftedLIBORForwardRate, - final int iViewTimeIncrement) - throws java.lang.Exception - { - if (iSpotDate > iViewDate || iViewDate >= iTargetDate || !org.drip.quant.common.NumberUtil.IsValid - (dblShiftedLIBORForwardRate)) - throw new java.lang.Exception - ("MultiFactorStateEvolver::shiftedLIBORForwardIncrement => Invalid Inputs"); - - double dblAnnualizedTimeIncrementSQRT = java.lang.Math.sqrt (1. * iViewTimeIncrement / 365.25); - - org.drip.sequence.random.PrincipalFactorSequenceGenerator pfsg = _mfv.msg(); - - double[] adblMultivariateRandom = pfsg.random(); - - double dblShiftedLIBORVolIncrement = 0.; - - int iNumFactor = pfsg.numFactor(); - - for (int i = 0; i < iNumFactor; ++i) - dblShiftedLIBORVolIncrement += _mfv.volatilityIntegral (i, iViewDate, iTargetDate) * - (_mfv.volatilityIntegral (i, iSpotDate, iTargetDate) + dblAnnualizedTimeIncrementSQRT * - adblMultivariateRandom[i]); - - return dblShiftedLIBORForwardRate * dblShiftedLIBORVolIncrement; - } - - @Override public org.drip.dynamics.evolution.LSQMPointUpdate evolve ( - final int iSpotDate, - final int iViewDate, - final int iSpotTimeIncrement, - final org.drip.dynamics.evolution.LSQMPointUpdate lsqmPrev) - { - if (iSpotDate > iViewDate || null == lsqmPrev || !(lsqmPrev instanceof - org.drip.dynamics.hjm.ShortForwardRateUpdate)) - return null; - - org.drip.sequence.random.PrincipalFactorSequenceGenerator pfsg = _mfv.msg(); - - double dblAnnualizedIncrement = 1. * iSpotTimeIncrement / 365.25; - - double dblAnnualizedIncrementSQRT = java.lang.Math.sqrt (dblAnnualizedIncrement); - - double[] adblMultivariateRandom = pfsg.random(); - - int iNumFactor = pfsg.numFactor(); - - org.drip.dynamics.hjm.ShortForwardRateUpdate qmInitial = - (org.drip.dynamics.hjm.ShortForwardRateUpdate) lsqmPrev; - - try { - double dblInitialPrice = qmInitial.price(); - - double dblInitialShortRate = qmInitial.shortRate(); - - double dblInitialLIBORForwardRate = qmInitial.liborForwardRate(); - - double dblInitialCompoundedShortRate = qmInitial.compoundedShortRate(); - - int iTargetDate = new org.drip.analytics.date.JulianDate (iViewDate).addTenor - (_lslForward.tenor()).julian(); - - double dblShortRateIncrement = 0.; - double dblShiftedLIBORForwardRateIncrement = 0.; - double dblInstantaneousForwardRateIncrement = 0.; - double dblPriceIncrement = dblInitialShortRate * dblAnnualizedIncrement; - double dblCompoundedShortRateIncrement = (dblInitialCompoundedShortRate - dblInitialShortRate) * - dblAnnualizedIncrement; - - for (int i = 0; i < iNumFactor; ++i) { - double dblViewDateFactorVolatility = _mfv.weightedFactorPointVolatility (i, iViewDate, - iViewDate); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblViewDateFactorVolatility)) return null; - - double dblViewTargetFactorVolatility = _mfv.weightedFactorPointVolatility (i, iViewDate, - iTargetDate); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblViewTargetFactorVolatility)) return null; - - double dblViewTargetVolatilityIntegral = _mfv.volatilityIntegral (i, iViewDate, iTargetDate); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblViewTargetVolatilityIntegral)) return null; - - double dblSpotViewVolatilityIntegral = _mfv.volatilityIntegral (i, iSpotDate, iViewDate); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblSpotViewVolatilityIntegral)) return null; - - double dblSpotTargetVolatilityIntegral = _mfv.volatilityIntegral (i, iSpotDate, iTargetDate); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblSpotTargetVolatilityIntegral)) return null; - - double dblScaledMultivariateRandom = dblAnnualizedIncrementSQRT * adblMultivariateRandom[i]; - dblInstantaneousForwardRateIncrement += dblViewTargetVolatilityIntegral * - dblViewTargetFactorVolatility * dblAnnualizedIncrement + dblViewTargetFactorVolatility * - dblScaledMultivariateRandom; - dblShortRateIncrement += dblSpotViewVolatilityIntegral * dblViewDateFactorVolatility * - dblAnnualizedIncrement + dblViewDateFactorVolatility * dblScaledMultivariateRandom; - dblCompoundedShortRateIncrement += 0.5 * dblViewTargetVolatilityIntegral * - dblViewTargetVolatilityIntegral * dblAnnualizedIncrement + - dblViewTargetVolatilityIntegral * dblScaledMultivariateRandom; - dblShiftedLIBORForwardRateIncrement += dblViewTargetVolatilityIntegral * - (dblSpotTargetVolatilityIntegral + dblScaledMultivariateRandom); - dblPriceIncrement -= dblViewTargetVolatilityIntegral * dblScaledMultivariateRandom; - } - - dblPriceIncrement *= dblInitialPrice; - dblCompoundedShortRateIncrement *= 365.25 / (iTargetDate - iViewDate); - double dblLIBORForwardRateIncrement = (dblInitialLIBORForwardRate + (365.25 / (iTargetDate - - iViewDate))) * dblShiftedLIBORForwardRateIncrement; - - return org.drip.dynamics.hjm.ShortForwardRateUpdate.Create (_lslFunding, _lslForward, iSpotDate, - iSpotDate + iSpotTimeIncrement, iTargetDate, qmInitial.instantaneousForwardRate() + - dblInstantaneousForwardRateIncrement, dblInstantaneousForwardRateIncrement, - dblInitialLIBORForwardRate + dblLIBORForwardRateIncrement, - dblLIBORForwardRateIncrement, qmInitial.shiftedLIBORForwardRate() + - dblShiftedLIBORForwardRateIncrement, dblShiftedLIBORForwardRateIncrement, - dblInitialShortRate + dblShortRateIncrement, dblShortRateIncrement, - dblInitialCompoundedShortRate + dblCompoundedShortRateIncrement, - dblCompoundedShortRateIncrement, dblInitialPrice + - dblPriceIncrement, dblPriceIncrement); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/dynamics/hjm/MultiFactorVolatility.java b/org/drip/dynamics/hjm/MultiFactorVolatility.java deleted file mode 100644 index d87776f..0000000 --- a/org/drip/dynamics/hjm/MultiFactorVolatility.java +++ /dev/null @@ -1,351 +0,0 @@ - -package org.drip.dynamics.hjm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * MultiFactorVolatility implements the Volatility of the Multi-factor Stochastic Evolutionary Process. The - * Factors may come from the Underlying Stochastic Variables, or from Principal Components. - * - * @author Lakshmi Krishnamurthy - */ - -public class MultiFactorVolatility { - private org.drip.analytics.definition.MarketSurface[] _aMSVolatility = null; - private org.drip.sequence.random.PrincipalFactorSequenceGenerator _pfsg = null; - - /** - * MultiFactorVolatility Constructor - * - * @param aMSVolatility Array of the Multi-Factor Volatility Surfaces - * @param pfsg Principal Factor Sequence Generator - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public MultiFactorVolatility ( - final org.drip.analytics.definition.MarketSurface[] aMSVolatility, - final org.drip.sequence.random.PrincipalFactorSequenceGenerator pfsg) - throws java.lang.Exception - { - if (null == (_aMSVolatility = aMSVolatility) || null == (_pfsg = pfsg)) - throw new java.lang.Exception ("MultiFactorVolatility ctr: Invalid Inputs"); - - int iNumFactor = _pfsg.numFactor(); - - if (0 == iNumFactor || _aMSVolatility.length < iNumFactor) - throw new java.lang.Exception ("MultiFactorVolatility ctr: Invalid Inputs"); - } - - /** - * Retrieve the Array of Volatility Surfaces - * - * @return The Array of Volatility Surfaces - */ - - public org.drip.analytics.definition.MarketSurface[] volatilitySurface() - { - return _aMSVolatility; - } - - /** - * Retrieve the Principal Factor Sequence Generator - * - * @return The Principal Factor Sequence Generator - */ - - public org.drip.sequence.random.PrincipalFactorSequenceGenerator msg() - { - return _pfsg; - } - - /** - * Retrieve the Factor-Specific Univariate Volatility Function for the Specified Date - * - * @param iFactorIndex The Factor Index - * @param iXDate The X Date - * - * @return The Factor-Specific Univariate Volatility Function for the Specified Date - */ - - public org.drip.function.definition.R1ToR1 xDateVolatilityFunction ( - final int iFactorIndex, - final int iXDate) - { - int iNumFactor = _pfsg.numFactor(); - - if (iFactorIndex >= iNumFactor) return null; - - final int iNumVariate = _aMSVolatility.length; - - return new org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - double dblMultiFactorVol = 0.; - - double[] adblFactor = _pfsg.factors()[iFactorIndex]; - - for (int i = 0; i < iNumVariate; ++i) { - org.drip.analytics.definition.NodeStructure tsVolatilityXDate = - _aMSVolatility[iFactorIndex].xAnchorTermStructure (iXDate); - - dblMultiFactorVol += adblFactor[i] * tsVolatilityXDate.node ((int) dblX); - } - - return _pfsg.factorWeight()[iFactorIndex] * dblMultiFactorVol; - } - }; - } - - /** - * Compute the Factor Volatility Integral - * - * @param iFactorIndex The Factor Index - * @param iXDate The X Date - * @param iYDate The Y Date - * - * @return The Factor Volatility Integral - * - * @throws java.lang.Exception Thrown if the Factor Volatility Integral cannot be computed - */ - - public double volatilityIntegral ( - final int iFactorIndex, - final int iXDate, - final int iYDate) - throws java.lang.Exception - { - org.drip.function.definition.R1ToR1 auVolatilityFunction = xDateVolatilityFunction (iFactorIndex, - iXDate); - - if (null == auVolatilityFunction) - throw new java.lang.Exception - ("MultiFactorVolatility::volatilityIntegral => Cannot extract X Date Volatility Function"); - - return auVolatilityFunction.integrate (iXDate, iYDate) / 365.25; - } - - /** - * Compute the Factor Point Volatility - * - * @param iFactorIndex The Factor Index - * @param iXDate The X Date - * @param iYDate The Y Date - * - * @return The Factor Point Volatility - * - * @throws java.lang.Exception Thrown if the Factor Point Volatility cannot be computed - */ - - public double factorPointVolatility ( - final int iFactorIndex, - final int iXDate, - final int iYDate) - throws java.lang.Exception - { - int iNumFactor = _pfsg.numFactor(); - - if (iFactorIndex >= iNumFactor) - throw new java.lang.Exception - ("MultiFactorVolatility::factorPointVolatility => Invalid Factor Index"); - - double[] adblFactor = _pfsg.factors()[iFactorIndex]; - - int iNumVariate = adblFactor.length; - double dblFactorPointVolatility = 0.; - - for (int i = 0; i < iNumVariate; ++i) - dblFactorPointVolatility += adblFactor[i] * _aMSVolatility[i].node (iXDate, iYDate); - - return dblFactorPointVolatility; - } - - /** - * Compute the Array of Factor Point Volatilities - * - * @param iXDate The X Date - * @param iYDate The Y Date - * - * @return The Array of Factor Point Volatilities - */ - - public double[] factorPointVolatility ( - final int iXDate, - final int iYDate) - { - int iNumFactor = _pfsg.numFactor(); - - double[][] aadblFactor = _pfsg.factors(); - - int iNumVariate = aadblFactor[0].length; - double[] adblVariateVolatility = new double[iNumVariate]; - double[] adblFactorPointVolatility = new double[iNumFactor]; - - for (int iVariateIndex = 0; iVariateIndex < iNumVariate; ++iVariateIndex) { - try { - adblVariateVolatility[iVariateIndex] = _aMSVolatility[iVariateIndex].node (iXDate, iYDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - for (int iFactorIndex = 0; iFactorIndex < iNumFactor; ++iFactorIndex) { - adblFactorPointVolatility[iFactorIndex] = 0.; - double[] adblFactor = aadblFactor[iFactorIndex]; - - for (int iVariateIndex = 0; iVariateIndex < iNumVariate; ++iVariateIndex) - adblFactorPointVolatility[iFactorIndex] += adblFactor[iVariateIndex] * - adblVariateVolatility[iVariateIndex]; - } - - return adblFactorPointVolatility; - } - - /** - * Compute the Weighted Factor Point Volatility - * - * @param iFactorIndex The Factor Index - * @param iXDate The X Date - * @param iYDate The Y Date - * - * @return The Weighted Factor Point Volatility - * - * @throws java.lang.Exception Thrown if the Weighted Factor Point Volatility cannot be computed - */ - - public double weightedFactorPointVolatility ( - final int iFactorIndex, - final int iXDate, - final int iYDate) - throws java.lang.Exception - { - int iNumFactor = _pfsg.numFactor(); - - if (iFactorIndex >= iNumFactor) - throw new java.lang.Exception - ("MultiFactorVolatility::weightedFactorPointVolatility => Invalid Factor Index"); - - double[] adblFactor = _pfsg.factors()[iFactorIndex]; - - int iNumVariate = adblFactor.length; - double dblFactorPointVolatility = 0.; - - for (int i = 0; i < iNumVariate; ++i) - dblFactorPointVolatility += adblFactor[i] * _aMSVolatility[i].node (iXDate, iYDate); - - return _pfsg.factorWeight()[iFactorIndex] * dblFactorPointVolatility; - } - - /** - * Compute the Point Volatility Modulus - * - * @param iXDate The X Date - * @param iYDate The Y Date - * - * @return The Point Volatility Modulus - * - * @throws java.lang.Exception Thrown if the Point Volatility Modulus cannot be computed - */ - - public double pointVolatilityModulus ( - final int iXDate, - final int iYDate) - throws java.lang.Exception - { - int iNumFactor = _pfsg.numFactor(); - - double dblPointVolatilityModulus = 0.; - - for (int i = 0; i < iNumFactor; ++i) { - double dblWeightedFactorPointVolatility = weightedFactorPointVolatility (i, iXDate, iYDate); - - dblPointVolatilityModulus += dblWeightedFactorPointVolatility * dblWeightedFactorPointVolatility; - } - - return dblPointVolatilityModulus; - } - - /** - * Compute the Point Volatility Modulus Derivative - * - * @param iXDate The X Date - * @param iYDate The Y Date - * @param iOrder The Derivative Order - * @param bTerminal TRUE - Derivative off of the Y Date; FALSE - Derivative off of the X Date - * - * @return The Point Volatility Modulus Derivative - * - * @throws java.lang.Exception Thrown if the Point Volatility Modulus Derivative cannot be computed - */ - - public double pointVolatilityModulusDerivative ( - final int iXDate, - final int iYDate, - final int iOrder, - final boolean bTerminal) - throws java.lang.Exception - { - org.drip.function.definition.R1ToR1 pointVolatilityR1ToR1 = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - return bTerminal ? pointVolatilityModulus (iXDate, (int) dblVariate) : pointVolatilityModulus - ((int) dblVariate, iYDate); - } - }; - - return bTerminal ? pointVolatilityR1ToR1.derivative (iXDate, iOrder) : - pointVolatilityR1ToR1.derivative (iXDate, iOrder); - } -} diff --git a/org/drip/dynamics/hjm/ShortForwardRateUpdate.java b/org/drip/dynamics/hjm/ShortForwardRateUpdate.java deleted file mode 100644 index d0eb1ed..0000000 --- a/org/drip/dynamics/hjm/ShortForwardRateUpdate.java +++ /dev/null @@ -1,371 +0,0 @@ - -package org.drip.dynamics.hjm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ShortForwardRateUpdate contains the Instantaneous Snapshot of the Evolving Discount Latent State - * Quantification Metrics. - * - * @author Lakshmi Krishnamurthy - */ - -public class ShortForwardRateUpdate extends org.drip.dynamics.evolution.LSQMPointUpdate { - private org.drip.state.identifier.ForwardLabel _lslForward = null; - private org.drip.state.identifier.FundingLabel _lslFunding = null; - - /** - * Construct an Instance of ShortForwardRateUpdate - * - * @param lslFunding The Funding Latent State Label - * @param lslForward The Forward Latent State Label - * @param iInitialDate The Initial Date - * @param iFinalDate The Final Date - * @param iTargetPointDate The Target Point Date - * @param dblInstantaneousForwardRate The Instantaneous Forward Rate - * @param dblInstantaneousForwardRateIncrement The Instantaneous Forward Rate Increment - * @param dblLIBORForwardRate The LIBOR Forward Rate - * @param dblLIBORForwardRateIncrement The LIBOR Forward Rate Increment - * @param dblShiftedLIBORForwardRate The Shifted LIBOR Forward Rate - * @param dblShiftedLIBORForwardRateIncrement The Shifted LIBOR Forward Rate Increment - * @param dblShortRate The Short Rate - * @param dblShortRateIncrement The Short Rate Increment - * @param dblCompoundedShortRate The Compounded Short Rate - * @param dblCompoundedShortRateIncrement The Compounded Short Rate Increment - * @param dblPrice The Price - * @param dblPriceIncrement The Price Increment - * - * @return Instance of ShortForwardRateUpdate - */ - - public static final ShortForwardRateUpdate Create ( - final org.drip.state.identifier.FundingLabel lslFunding, - final org.drip.state.identifier.ForwardLabel lslForward, - final int iInitialDate, - final int iFinalDate, - final int iTargetPointDate, - final double dblInstantaneousForwardRate, - final double dblInstantaneousForwardRateIncrement, - final double dblLIBORForwardRate, - final double dblLIBORForwardRateIncrement, - final double dblShiftedLIBORForwardRate, - final double dblShiftedLIBORForwardRateIncrement, - final double dblShortRate, - final double dblShortRateIncrement, - final double dblCompoundedShortRate, - final double dblCompoundedShortRateIncrement, - final double dblPrice, - final double dblPriceIncrement) - { - org.drip.dynamics.evolution.LSQMPointRecord lrSnapshot = new - org.drip.dynamics.evolution.LSQMPointRecord(); - - if (!lrSnapshot.setQM (lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE, dblShortRate)) - return null; - - if (!lrSnapshot.setQM (lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_COMPOUNDED_SHORT_RATE, - dblCompoundedShortRate)) - return null; - - if (!lrSnapshot.setQM (lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR, dblPrice)) - return null; - - if (!lrSnapshot.setQM (lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_FORWARD_RATE, dblLIBORForwardRate)) - return null; - - if (!lrSnapshot.setQM (lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_SHIFTED_FORWARD_RATE, - dblShiftedLIBORForwardRate)) - return null; - - if (!lrSnapshot.setQM (lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_INSTANTANEOUS_FORWARD_RATE, - dblInstantaneousForwardRate)) - return null; - - org.drip.dynamics.evolution.LSQMPointRecord lrIncrement = new - org.drip.dynamics.evolution.LSQMPointRecord(); - - if (!lrIncrement.setQM (lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE, dblShortRateIncrement)) - return null; - - if (!lrIncrement.setQM (lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_COMPOUNDED_SHORT_RATE, - dblCompoundedShortRateIncrement)) - return null; - - if (!lrIncrement.setQM (lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR, dblPriceIncrement)) - return null; - - if (!lrIncrement.setQM (lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_FORWARD_RATE, - dblLIBORForwardRateIncrement)) - return null; - - if (!lrIncrement.setQM (lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_SHIFTED_FORWARD_RATE, - dblShiftedLIBORForwardRateIncrement)) - return null; - - if (!lrIncrement.setQM (lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_INSTANTANEOUS_FORWARD_RATE, - dblInstantaneousForwardRateIncrement)) - return null; - - try { - return new ShortForwardRateUpdate (lslFunding, lslForward, iInitialDate, iFinalDate, - iTargetPointDate, lrSnapshot, lrIncrement); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private ShortForwardRateUpdate ( - final org.drip.state.identifier.FundingLabel lslFunding, - final org.drip.state.identifier.ForwardLabel lslForward, - final int iInitialDate, - final int iFinalDate, - final int iViewDate, - final org.drip.dynamics.evolution.LSQMPointRecord lrSnapshot, - final org.drip.dynamics.evolution.LSQMPointRecord lrIncrement) - throws java.lang.Exception - { - super (iInitialDate, iFinalDate, iViewDate, lrSnapshot, lrIncrement); - - if (null == (_lslFunding = lslFunding) || null == (_lslForward = lslForward)) - throw new java.lang.Exception ("ShortForwardRateUpdate ctr: Invalid Inputs"); - } - - /** - * Retrieve the Instantaneous Forward Rate - * - * @return The Instantaneous Forward Rate - * - * @throws java.lang.Exception Thrown if the Instantaneous Forward Rate is not available - */ - - public double instantaneousForwardRate() - throws java.lang.Exception - { - return snapshot().qm (_lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_INSTANTANEOUS_FORWARD_RATE); - } - - /** - * Retrieve the Instantaneous Forward Rate Increment - * - * @return The Instantaneous Forward Rate Increment - * - * @throws java.lang.Exception Thrown if the Instantaneous Forward Rate Increment is not available - */ - - public double instantaneousForwardRateIncrement() - throws java.lang.Exception - { - return increment().qm (_lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_INSTANTANEOUS_FORWARD_RATE); - } - - /** - * Retrieve the LIBOR Forward Rate - * - * @return The LIBOR Forward Rate - * - * @throws java.lang.Exception Thrown if the Forward Rate is not available - */ - - public double liborForwardRate() - throws java.lang.Exception - { - return snapshot().qm (_lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_FORWARD_RATE); - } - - /** - * Retrieve the LIBOR Forward Rate Increment - * - * @return The LIBOR Forward Rate Increment - * - * @throws java.lang.Exception Thrown if the Forward Rate Increment is not available - */ - - public double liborForwardRateIncrement() - throws java.lang.Exception - { - return increment().qm (_lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_FORWARD_RATE); - } - - /** - * Retrieve the Shifted LIBOR Forward Rate - * - * @return The Shifted LIBOR Forward Rate - * - * @throws java.lang.Exception Thrown if the Shifted Forward Rate is not available - */ - - public double shiftedLIBORForwardRate() - throws java.lang.Exception - { - return snapshot().qm (_lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_SHIFTED_FORWARD_RATE); - } - - /** - * Retrieve the Shifted LIBOR Forward Rate Increment - * - * @return The Shifted LIBOR Forward Rate Increment - * - * @throws java.lang.Exception Thrown if the Shifted Forward Rate Increment is not available - */ - - public double shiftedLIBORForwardRateIncrement() - throws java.lang.Exception - { - return increment().qm (_lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_SHIFTED_FORWARD_RATE); - } - - /** - * Retrieve the Short Rate - * - * @return The Short Rate - * - * @throws java.lang.Exception Thrown if the Short Rate is not available - */ - - public double shortRate() - throws java.lang.Exception - { - return snapshot().qm (_lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE); - } - - /** - * Retrieve the Short Rate Increment - * - * @return The Short Rate Increment - * - * @throws java.lang.Exception Thrown if the Short Rate Increment is not available - */ - - public double shortRateIncrement() - throws java.lang.Exception - { - return increment().qm (_lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE); - } - - /** - * Retrieve the Compounded Short Rate - * - * @return The Compounded Short Rate - * - * @throws java.lang.Exception Thrown if the Compounded Short Rate is not available - */ - - public double compoundedShortRate() - throws java.lang.Exception - { - return snapshot().qm (_lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_COMPOUNDED_SHORT_RATE); - } - - /** - * Retrieve the Compounded Short Rate Increment - * - * @return The Compounded Short Rate Increment - * - * @throws java.lang.Exception Thrown if the Compounded Short Rate Increment is not available - */ - - public double compoundedShortRateIncrement() - throws java.lang.Exception - { - return increment().qm (_lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_COMPOUNDED_SHORT_RATE); - } - - /** - * Retrieve the Price - * - * @return The Price - * - * @throws java.lang.Exception Thrown if the Price is not available - */ - - public double price() - throws java.lang.Exception - { - return snapshot().qm (_lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR); - } - - /** - * Retrieve the Price Increment - * - * @return The Price Increment - * - * @throws java.lang.Exception Thrown if the Price Increment is not available - */ - - public double priceIncrement() - throws java.lang.Exception - { - return increment().qm (_lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR); - } -} diff --git a/org/drip/dynamics/hullwhite/ShortRateUpdate.java b/org/drip/dynamics/hullwhite/ShortRateUpdate.java deleted file mode 100644 index 3f4c3f9..0000000 --- a/org/drip/dynamics/hullwhite/ShortRateUpdate.java +++ /dev/null @@ -1,237 +0,0 @@ - -package org.drip.dynamics.hullwhite; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ShortRateUpdate records the Metrics associated with the Evolution of the Instantaneous Short Rate from a - * Starting to the Terminal Date. - * - * @author Lakshmi Krishnamurthy - */ - -public class ShortRateUpdate extends org.drip.dynamics.evolution.LSQMPointUpdate { - private double _dblExpectedFinalShortRate = java.lang.Double.NaN; - private double _dblFinalShortRateVariance = java.lang.Double.NaN; - private org.drip.state.identifier.FundingLabel _lslFunding = null; - - /** - * Construct an Instance of ShortRateUpdate - * - * @param lslFunding The Funding Latent State Label - * @param iInitialDate The Initial Date - * @param iFinalDate The Final Date - * @param iTargetPointDate The Target Point Date - * @param dblInitialShortRate The Initial Short Rate - * @param dblRealizedFinalShortRate The Realized Final Short Rate - * @param dblExpectedFinalShortRate The Expected Final Short Rate - * @param dblFinalShortRateVariance The Final Variance of the Short Rate - * @param dblZeroCouponBondPrice The Zero Coupon Bond Price - * - * @return The ShortRateUpdate Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final ShortRateUpdate Create ( - final org.drip.state.identifier.FundingLabel lslFunding, - final int iInitialDate, - final int iFinalDate, - final int iTargetPointDate, - final double dblInitialShortRate, - final double dblRealizedFinalShortRate, - final double dblExpectedFinalShortRate, - final double dblFinalShortRateVariance, - final double dblZeroCouponBondPrice) - throws java.lang.Exception - { - org.drip.dynamics.evolution.LSQMPointRecord lrSnapshot = new - org.drip.dynamics.evolution.LSQMPointRecord(); - - if (!lrSnapshot.setQM (lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE, - dblRealizedFinalShortRate)) - return null; - - if (!lrSnapshot.setQM (lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR, - dblZeroCouponBondPrice)) - return null; - - org.drip.dynamics.evolution.LSQMPointRecord lrIncrement = new - org.drip.dynamics.evolution.LSQMPointRecord(); - - if (!lrIncrement.setQM (lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE, - dblRealizedFinalShortRate - dblInitialShortRate)) - return null; - - try { - return new ShortRateUpdate (lslFunding, iInitialDate, iFinalDate, iTargetPointDate, lrSnapshot, - lrIncrement, dblExpectedFinalShortRate, dblFinalShortRateVariance); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private ShortRateUpdate ( - final org.drip.state.identifier.FundingLabel lslFunding, - final int iInitialDate, - final int iFinalDate, - final int iViewDate, - final org.drip.dynamics.evolution.LSQMPointRecord lrSnapshot, - final org.drip.dynamics.evolution.LSQMPointRecord lrIncrement, - final double dblExpectedFinalShortRate, - final double dblFinalShortRateVariance) - throws java.lang.Exception - { - super (iInitialDate, iFinalDate, iViewDate, lrSnapshot, lrIncrement); - - if (null == (_lslFunding = lslFunding) || !org.drip.quant.common.NumberUtil.IsValid - (_dblExpectedFinalShortRate = dblExpectedFinalShortRate) || - !org.drip.quant.common.NumberUtil.IsValid (_dblFinalShortRateVariance = - dblFinalShortRateVariance)) { - System.out.println (_lslFunding.fullyQualifiedName()); - - System.out.println ("Final Short Rate: " + _dblExpectedFinalShortRate); - - System.out.println ("Final Short Rate Variance: " + _dblFinalShortRateVariance); - - throw new java.lang.Exception ("ShortRateUpdate ctr: Invalid Inputs!"); - } - } - - /** - * Retrieve the Initial Short Rate - * - * @return The Initial Short Rate - * - * @throws java.lang.Exception Thrown if the Initial Short Rate is not available - */ - - public double initialShortRate() - throws java.lang.Exception - { - return realizedFinalShortRate() - shortRateIncrement(); - } - - /** - * Retrieve the Realized Final Short Rate - * - * @return The Realized Final Short Rate - * - * @throws java.lang.Exception Thrown if the Realized Final Short Rate is not available - */ - - public double realizedFinalShortRate() - throws java.lang.Exception - { - return snapshot().qm (_lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE); - } - - /** - * Retrieve the Short Rate Increment - * - * @return The Short Rate Increment - * - * @throws java.lang.Exception Thrown if the Short Rate Increment is not available - */ - - public double shortRateIncrement() - throws java.lang.Exception - { - return increment().qm (_lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE); - } - - /** - * Retrieve the Expected Final Short Rate - * - * @return The Expected Final Short Rate - */ - - public double expectedFinalShortRate() - { - return _dblExpectedFinalShortRate; - } - - /** - * Retrieve the Final Short Rate Variance - * - * @return The Final Short Rate Variance - */ - - public double finalShortRateVariance() - { - return _dblFinalShortRateVariance; - } - - /** - * Compute the Zero Coupon Bond Price - * - * @param dblFinalInitialZeroRatio The Final-to-Initial Zero-Coupon Bond Price Ratio - * - * @return The Zero Coupon Bond Price - * - * @throws java.lang.Exception Thrown if the Zero Coupon Bond Price cannot be computed - */ - - public double zeroCouponBondPrice ( - final double dblFinalInitialZeroRatio) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblFinalInitialZeroRatio)) - throw new java.lang.Exception ("ShortRateUpdate::zeroCouponBondPrice => Invalid Inputs"); - - return dblFinalInitialZeroRatio * snapshot().qm (_lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR); - } -} diff --git a/org/drip/dynamics/hullwhite/SingleFactorStateEvolver.java b/org/drip/dynamics/hullwhite/SingleFactorStateEvolver.java deleted file mode 100644 index 51e8286..0000000 --- a/org/drip/dynamics/hullwhite/SingleFactorStateEvolver.java +++ /dev/null @@ -1,402 +0,0 @@ - -package org.drip.dynamics.hullwhite; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * SingleFactorStateEvolver provides the Hull-White One-Factor Gaussian HJM Short Rate Dynamics - * Implementation. - * - * @author Lakshmi Krishnamurthy - */ - -public class SingleFactorStateEvolver implements org.drip.dynamics.evolution.PointStateEvolver { - private double _dblA = java.lang.Double.NaN; - private double _dblSigma = java.lang.Double.NaN; - private org.drip.function.definition.R1ToR1 _auIFRInitial = null; - private org.drip.state.identifier.FundingLabel _lslFunding = null; - private org.drip.sequence.random.UnivariateSequenceGenerator _usg = null; - - /** - * SingleFactorStateEvolver Constructor - * - * @param lslFunding The Funding Latent State Label - * @param dblSigma Sigma - * @param dblA A - * @param auIFRInitial The Initial Instantaneous Forward Rate Term Structure - * @param usg Univariate Random Sequence Generator - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public SingleFactorStateEvolver ( - final org.drip.state.identifier.FundingLabel lslFunding, - final double dblSigma, - final double dblA, - final org.drip.function.definition.R1ToR1 auIFRInitial, - final org.drip.sequence.random.UnivariateSequenceGenerator usg) - throws java.lang.Exception - { - if (null == (_lslFunding = lslFunding) || !org.drip.quant.common.NumberUtil.IsValid (_dblSigma = - dblSigma) || !org.drip.quant.common.NumberUtil.IsValid (_dblA = dblA) || null == (_auIFRInitial = - auIFRInitial) || null == (_usg = usg)) - throw new java.lang.Exception ("SingleFactorStateEvolver ctr: Invalid Inputs"); - } - - /** - * Retrieve the Funding Label - * - * @return The Funding Label - */ - - public org.drip.state.identifier.FundingLabel fundingLabel() - { - return _lslFunding; - } - - /** - * Retrieve Sigma - * - * @return Sigma - */ - - public double sigma() - { - return _dblSigma; - } - - /** - * Retrieve A - * - * @return A - */ - - public double a() - { - return _dblA; - } - - /** - * Retrieve the Initial Instantaneous Forward Rate Term Structure - * - * @return The Initial Instantaneous Forward Rate Term Structure - */ - - public org.drip.function.definition.R1ToR1 ifrInitialTermStructure() - { - return _auIFRInitial; - } - - /** - * Retrieve the Random Sequence Generator - * - * @return The Random Sequence Generator - */ - - public org.drip.sequence.random.UnivariateSequenceGenerator rsg() - { - return _usg; - } - - /** - * Calculate the Alpha - * - * @param iSpotDate The Spot Date - * @param iViewDate The View Date - * - * @return Alpha - * - * @throws java.lang.Exception Thrown if Alpha cannot be computed - */ - - public double alpha ( - final int iSpotDate, - final int iViewDate) - throws java.lang.Exception - { - if (iSpotDate > iViewDate) - throw new java.lang.Exception ("SingleFactorStateEvolver::alpha => Invalid Inputs"); - - double dblAlphaVol = _dblSigma * (1. - java.lang.Math.exp (_dblA * (iViewDate - iSpotDate) / 365.25)) - / _dblA; - - return _auIFRInitial.evaluate (iViewDate) + 0.5 * dblAlphaVol * dblAlphaVol; - } - - /** - * Calculate the Theta - * - * @param iSpotDate The Spot Date - * @param iViewDate The View Date - * - * @return Theta - * - * @throws java.lang.Exception Thrown if Theta cannot be computed - */ - - public double theta ( - final int iSpotDate, - final int iViewDate) - throws java.lang.Exception - { - if (iSpotDate > iViewDate) - throw new java.lang.Exception ("SingleFactorStateEvolver::theta => Invalid Inputs"); - - return _auIFRInitial.derivative (iViewDate, 1) + _dblA * _auIFRInitial.evaluate (iViewDate) + - _dblSigma * _dblSigma / (2. * _dblA) * (1. - java.lang.Math.exp (-2. * _dblA * (iViewDate - - iSpotDate) / 365.25)); - } - - /** - * Calculate the Short Rate Increment - * - * @param iSpotDate The Spot Date - * @param iViewDate The View Date - * @param dblShortRate The Short Rate - * @param iViewTimeIncrement The View Time Increment - * - * @return The Short Rate Increment - * - * @throws java.lang.Exception Thrown if the Short Rate cannot be computed - */ - - public double shortRateIncrement ( - final int iSpotDate, - final int iViewDate, - final double dblShortRate, - final int iViewTimeIncrement) - throws java.lang.Exception - { - if (iSpotDate > iViewDate || !org.drip.quant.common.NumberUtil.IsValid (dblShortRate)) - throw new java.lang.Exception ("SingleFactorStateEvolver::shortRateIncrement => Invalid Inputs"); - - double dblAnnualizedIncrement = 1. * iViewTimeIncrement / 365.25; - - return (theta (iSpotDate, iViewDate) - _dblA * dblShortRate) * dblAnnualizedIncrement + _dblSigma * - java.lang.Math.sqrt (dblAnnualizedIncrement) * _usg.random(); - } - - @Override public org.drip.dynamics.evolution.LSQMPointUpdate evolve ( - final int iSpotDate, - final int iViewDate, - final int iSpotTimeIncrement, - final org.drip.dynamics.evolution.LSQMPointUpdate lsqmPrev) - { - if (iViewDate < iSpotDate || null == lsqmPrev || !(lsqmPrev instanceof - org.drip.dynamics.hullwhite.ShortRateUpdate)) - return null; - - int iDate = iSpotDate; - int iTimeIncrement = 1; - int iFinalDate = iSpotDate + iSpotTimeIncrement; - double dblInitialShortRate = java.lang.Double.NaN; - - try { - dblInitialShortRate = ((org.drip.dynamics.hullwhite.ShortRateUpdate) - lsqmPrev).realizedFinalShortRate(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - double dblShortRate = dblInitialShortRate; - - while (iDate < iFinalDate) { - try { - dblShortRate += shortRateIncrement (iSpotDate, iDate, dblShortRate, iTimeIncrement); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - ++iDate; - } - - double dblADF = java.lang.Math.exp (-1. * _dblA * iSpotTimeIncrement); - - double dblB = (1. - dblADF) / _dblA; - - try { - return org.drip.dynamics.hullwhite.ShortRateUpdate.Create (_lslFunding, iSpotDate, iFinalDate, - iViewDate, dblInitialShortRate, dblShortRate, dblInitialShortRate * dblADF + alpha - (iSpotDate, iFinalDate) - alpha (iSpotDate, iViewDate) * dblADF, 0.5 * _dblSigma * - _dblSigma * (1. - dblADF * dblADF) / _dblA, java.lang.Math.exp (dblB * - _auIFRInitial.evaluate (iViewDate) - 0.25 * _dblSigma * _dblSigma * (1. - - java.lang.Math.exp (-2. * _dblA * (iViewDate - iSpotDate) / 365.25)) * dblB * - dblB / _dblA)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Metrics associated with the Transition that results from using a Trinomial Tree Using the - * Starting Node Metrics - * - * @param iSpotDate The Spot/Epoch Date - * @param iInitialDate The Initial Date - * @param iTerminalDate The Terminal Date - * @param hwnmInitial The Initial Node Metrics - * - * @return The Hull White Transition Metrics - */ - - public org.drip.dynamics.hullwhite.TrinomialTreeTransitionMetrics evolveTrinomialTree ( - final int iSpotDate, - final int iInitialDate, - final int iTerminalDate, - final org.drip.dynamics.hullwhite.TrinomialTreeNodeMetrics hwnmInitial) - { - if (iInitialDate < iSpotDate || iTerminalDate <= iInitialDate) return null; - - long lTreeTimeIndex = 0L; - double dblExpectedTerminalX = 0.; - long lTreeStochasticBaseIndex = 0L; - - if (null != hwnmInitial) { - dblExpectedTerminalX = hwnmInitial.x(); - - lTreeTimeIndex = hwnmInitial.timeIndex() + 1; - - lTreeStochasticBaseIndex = hwnmInitial.xStochasticIndex(); - } - - double dblADF = java.lang.Math.exp (-1. * _dblA * (iTerminalDate - iInitialDate) / 365.25); - - try { - return new org.drip.dynamics.hullwhite.TrinomialTreeTransitionMetrics (iInitialDate, - iTerminalDate, lTreeTimeIndex, lTreeStochasticBaseIndex, dblExpectedTerminalX * dblADF, 0.5 * - _dblSigma * _dblSigma * (1. - dblADF * dblADF) / _dblA, alpha (iSpotDate, - iTerminalDate)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Evolve the Trinomial Tree Sequence - * - * @param iSpotDate The Spot Date - * @param iInitialDate The Initial Date - * @param iDayIncrement The Day Increment - * @param iNumIncrement Number of Times to Increment - * @param hwnm Starting Node Metrics - * @param hwsm The Sequence Metrics - * - * @return TRUE - The Tree Successfully Evolved - */ - - public boolean evolveTrinomialTreeSequence ( - final int iSpotDate, - final int iInitialDate, - final int iDayIncrement, - final int iNumIncrement, - final org.drip.dynamics.hullwhite.TrinomialTreeNodeMetrics hwnm, - final org.drip.dynamics.hullwhite.TrinomialTreeSequenceMetrics hwsm) - { - if (iInitialDate < iSpotDate || 0 >= iDayIncrement || null == hwsm) return false; - - if (0 == iNumIncrement) return true; - - org.drip.dynamics.hullwhite.TrinomialTreeTransitionMetrics hwtm = evolveTrinomialTree (iSpotDate, - iInitialDate, iInitialDate + iDayIncrement, hwnm); - - if (!hwsm.addTransitionMetrics (hwtm)) return false; - - org.drip.dynamics.hullwhite.TrinomialTreeNodeMetrics hwnmUp = hwtm.upNodeMetrics(); - - if (!hwsm.addNodeMetrics (hwnmUp) || (null != hwnm && !hwsm.setTransitionProbability (hwnm, hwnmUp, - hwtm.probabilityUp())) || !evolveTrinomialTreeSequence (iSpotDate, iInitialDate + iDayIncrement, - iDayIncrement, iNumIncrement - 1, hwnmUp, hwsm)) - return false; - - org.drip.dynamics.hullwhite.TrinomialTreeNodeMetrics hwnmDown = hwtm.downNodeMetrics(); - - if (!hwsm.addNodeMetrics (hwnmDown) || (null != hwnm && !hwsm.setTransitionProbability (hwnm, - hwnmDown, hwtm.probabilityDown())) || !evolveTrinomialTreeSequence (iSpotDate, iInitialDate + - iDayIncrement, iDayIncrement, iNumIncrement - 1, hwnmDown, hwsm)) - return false; - - org.drip.dynamics.hullwhite.TrinomialTreeNodeMetrics hwnmStay = hwtm.stayNodeMetrics(); - - if (!hwsm.addNodeMetrics (hwnmStay) || (null != hwnm && !hwsm.setTransitionProbability (hwnm, - hwnmStay, hwtm.probabilityStay())) || !evolveTrinomialTreeSequence (iSpotDate, iInitialDate + - iDayIncrement, iDayIncrement, iNumIncrement - 1, hwnmStay, hwsm)) - return false; - - return true; - } - - /** - * Evolve the Trinomial Tree Sequence - * - * @param iSpotDate The Spot Date - * @param iDayIncrement The Day Increment - * @param iNumIncrement Number of Times to Increment - * - * @return The Sequence Metrics - */ - - public org.drip.dynamics.hullwhite.TrinomialTreeSequenceMetrics evolveTrinomialTreeSequence ( - final int iSpotDate, - final int iDayIncrement, - final int iNumIncrement) - { - org.drip.dynamics.hullwhite.TrinomialTreeSequenceMetrics hwsm = new - org.drip.dynamics.hullwhite.TrinomialTreeSequenceMetrics(); - - return evolveTrinomialTreeSequence (iSpotDate, iSpotDate, iDayIncrement, iNumIncrement, null, hwsm) ? - hwsm : null; - } -} diff --git a/org/drip/dynamics/hullwhite/TrinomialTreeNodeMetrics.java b/org/drip/dynamics/hullwhite/TrinomialTreeNodeMetrics.java deleted file mode 100644 index 13b428c..0000000 --- a/org/drip/dynamics/hullwhite/TrinomialTreeNodeMetrics.java +++ /dev/null @@ -1,143 +0,0 @@ - -package org.drip.dynamics.hullwhite; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * TrinomialTreeNodeMetrics records the Metrics associated with each Node in the Trinomial Tree Evolution of - * the Instantaneous Short Rate using the Hull-White Model. - * - * @author Lakshmi Krishnamurthy - */ - -public class TrinomialTreeNodeMetrics { - private long _lTimeIndex = -1L; - private long _lXStochasticIndex = 0L; - private double _dblX = java.lang.Double.NaN; - private double _dblAlpha = java.lang.Double.NaN; - - /** - * TrinomialTreeNodeMetrics Constructor - * - * @param lTimeIndex The Tree Node's Time Index - * @param lXStochasticIndex The Tree Node's Stochastic Index - * @param dblX X - * @param dblAlpha Alpha - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public TrinomialTreeNodeMetrics ( - final long lTimeIndex, - final long lXStochasticIndex, - final double dblX, - final double dblAlpha) - throws java.lang.Exception - { - if (0 > (_lTimeIndex = lTimeIndex) || !org.drip.quant.common.NumberUtil.IsValid (_dblX = dblX) || - !org.drip.quant.common.NumberUtil.IsValid (_dblAlpha = dblAlpha)) - throw new java.lang.Exception ("TrinomialTreeNodeMetrics ctr: Invalid Inputs"); - - _lXStochasticIndex = lXStochasticIndex; - } - - /** - * Retrieve the Node's X - * - * @return The Node's X - */ - - public double x() - { - return _dblX; - } - - /** - * Retrieve the Node's Alpha - * - * @return The Node's Alpha - */ - - public double alpha() - { - return _dblAlpha; - } - - /** - * Retrieve the Node's Short Rate - * - * @return The Node's Short Rate - */ - - public double shortRate() - { - return _dblX + _dblAlpha; - } - - /** - * Retrieve the Tree Node's Time Index - * - * @return The Time Index - */ - - public long timeIndex() - { - return _lTimeIndex; - } - - /** - * Retrieve the Tree Node's X Stochastic Index - * - * @return The Tree Node's X Stochastic Index - */ - - public long xStochasticIndex() - { - return _lXStochasticIndex; - } -} diff --git a/org/drip/dynamics/hullwhite/TrinomialTreeSequenceMetrics.java b/org/drip/dynamics/hullwhite/TrinomialTreeSequenceMetrics.java deleted file mode 100644 index fdddb0d..0000000 --- a/org/drip/dynamics/hullwhite/TrinomialTreeSequenceMetrics.java +++ /dev/null @@ -1,289 +0,0 @@ - -package org.drip.dynamics.hullwhite; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * TrinomialTreeSequenceMetrics records the Evolution Metrics of the Hull-White Model Trinomial Tree - * Sequence. - * - * @author Lakshmi Krishnamurthy - */ - -public class TrinomialTreeSequenceMetrics { - private java.util.Map _mapSourceTargetTransitionProbability = new - java.util.HashMap(); - - private java.util.Map _mapTargetSourceTransitionProbability = new - java.util.HashMap(); - - private java.util.Map _mapTTNM = - new java.util.HashMap(); - - private java.util.Map - _mapTTTM = new java.util.HashMap(); - - private static final java.lang.String NodeMetricsKey ( - final org.drip.dynamics.hullwhite.TrinomialTreeNodeMetrics hwnm) - { - return hwnm.timeIndex() + "," + hwnm.xStochasticIndex(); - } - - /** - * Empty TrinomialTreeSequenceMetrics Constructor - */ - - public TrinomialTreeSequenceMetrics() - { - } - - /** - * Add a Path Transition Metrics Instance - * - * @param hwtm The Path Transition Metrics Instance - * - * @return TRUE - The Path Transition Metrics Instance successfully added - */ - - public boolean addTransitionMetrics ( - final org.drip.dynamics.hullwhite.TrinomialTreeTransitionMetrics hwtm) - { - if (null == hwtm) return false; - - _mapTTTM.put (hwtm.treeTimeIndex(), hwtm); - - return true; - } - - /** - * Retrieve the Transition Metrics associated with the specified Tree Time Index - * - * @param lTreeTimeIndex The Tree Time Index - * - * @return The Transition Metrics associated with the specified Tree Time Index - */ - - public org.drip.dynamics.hullwhite.TrinomialTreeTransitionMetrics transitionMetrics ( - final long lTreeTimeIndex) - { - return _mapTTTM.containsKey (lTreeTimeIndex) ? _mapTTTM.get (lTreeTimeIndex) : null; - } - - /** - * Retrieve the Transition Metrics Map - * - * @return The Transition Metrics Map - */ - - public java.util.Map - transitionMetrics() - { - return _mapTTTM; - } - - /** - * Add the Hull-White Node Metrics Instance - * - * @param hwnm The Hull-White Node Metrics Instance - * - * @return The Node Met5rics Instance successfully added - */ - - public boolean addNodeMetrics ( - final org.drip.dynamics.hullwhite.TrinomialTreeNodeMetrics hwnm) - { - if (null == hwnm) return false; - - _mapTTNM.put (NodeMetricsKey (hwnm), hwnm); - - return true; - } - - /** - * Retrieve the Node Metrics from the corresponding Tree Time/Space Indexes - * - * @param lTreeTimeIndex The Tree Time Index - * @param lTreeStochasticIndex The Tree Space Index - * - * @return The Node Metrics - */ - - public org.drip.dynamics.hullwhite.TrinomialTreeNodeMetrics nodeMetrics ( - final long lTreeTimeIndex, - final long lTreeStochasticIndex) - { - java.lang.String strKey = lTreeTimeIndex + "," + lTreeStochasticIndex; - - return _mapTTNM.containsKey (strKey) ? _mapTTNM.get (strKey) : null; - } - - /** - * Retrieve the Node Metrics Map - * - * @return The Node Metrics Map - */ - - public java.util.Map - nodeMetrics() - { - return _mapTTNM; - } - - /** - * Set the Transition Probability for the specified Pair of Nodes - * - * @param hwnmSource Source Node - * @param hwnmTarget Target Node - * @param dblTransitionProbability The Transition Probability - * - * @return TRUE - The Transition Probability Successfully set - */ - - public boolean setTransitionProbability ( - final org.drip.dynamics.hullwhite.TrinomialTreeNodeMetrics hwnmSource, - final org.drip.dynamics.hullwhite.TrinomialTreeNodeMetrics hwnmTarget, - final double dblTransitionProbability) - { - if (null == hwnmSource || null == hwnmTarget || !org.drip.quant.common.NumberUtil.IsValid - (dblTransitionProbability) || 0. >= dblTransitionProbability || 1. < dblTransitionProbability) - return false; - - java.lang.String strSourceNodeKey = NodeMetricsKey (hwnmSource); - - java.lang.String strTargetNodeKey = NodeMetricsKey (hwnmTarget); - - _mapSourceTargetTransitionProbability.put (strSourceNodeKey + "#" + strTargetNodeKey, - dblTransitionProbability); - - _mapTargetSourceTransitionProbability.put (strTargetNodeKey + "#" + strSourceNodeKey, - dblTransitionProbability); - - return true; - } - - /** - * Retrieve the Source-To-Target Transition Probability - * - * @param hwnmSource Source Node - * @param hwnmTarget Target Node - * - * @return The Source-To-Target Transition Probability - * - * @throws java.lang.Exception Thrown if the Source-To-Target Transition Probability cannot be computed - */ - - public double sourceTargetTransitionProbability ( - final org.drip.dynamics.hullwhite.TrinomialTreeNodeMetrics hwnmSource, - final org.drip.dynamics.hullwhite.TrinomialTreeNodeMetrics hwnmTarget) - throws java.lang.Exception - { - if (null == hwnmSource || null == hwnmTarget) - throw new java.lang.Exception - ("TrinomialTreeSequenceMetrics::sourceTargetTransitionProbability => Invalid Inputs!"); - - java.lang.String strKey = NodeMetricsKey (hwnmSource) + "#" + NodeMetricsKey (hwnmTarget); - - if (!_mapSourceTargetTransitionProbability.containsKey (strKey)) - throw new java.lang.Exception - ("TrinomialTreeSequenceMetrics::sourceTargetTransitionProbability => No Transition Entry!"); - - return _mapSourceTargetTransitionProbability.get (strKey); - } - - /** - * Retrieve the FULL Source-Target Transition Probability Map - * - * @return The Source-Target Transition Probability Map - */ - - public java.util.Map sourceTargetTransitionProbability() - { - return _mapSourceTargetTransitionProbability; - } - - /** - * Retrieve the Target-From-Source Transition Probability - * - * @param hwnmTarget Target Node - * @param hwnmSource Source Node - * - * @return The Target-From-Source Transition Probability - * - * @throws java.lang.Exception Thrown if the Target-From-Source Transition Probability cannot be computed - */ - - public double targetSourceTransitionProbability ( - final org.drip.dynamics.hullwhite.TrinomialTreeNodeMetrics hwnmTarget, - final org.drip.dynamics.hullwhite.TrinomialTreeNodeMetrics hwnmSource) - throws java.lang.Exception - { - if (null == hwnmSource || null == hwnmTarget) - throw new java.lang.Exception - ("TrinomialTreeSequenceMetrics::targetSourceTransitionProbability => Invalid Inputs!"); - - java.lang.String strKey = NodeMetricsKey (hwnmTarget) + "#" + NodeMetricsKey (hwnmSource); - - if (!_mapTargetSourceTransitionProbability.containsKey (strKey)) - throw new java.lang.Exception - ("TrinomialTreeSequenceMetrics::targetSourceTransitionProbability => No Transition Entry!"); - - return _mapTargetSourceTransitionProbability.get (strKey); - } - - /** - * Retrieve the FULL Target-Source Transition Probability Map - * - * @return The Target-Source Transition Probability Map - */ - - public java.util.Map targetSourceTransitionProbability() - { - return _mapTargetSourceTransitionProbability; - } -} diff --git a/org/drip/dynamics/hullwhite/TrinomialTreeTransitionMetrics.java b/org/drip/dynamics/hullwhite/TrinomialTreeTransitionMetrics.java deleted file mode 100644 index 4e00018..0000000 --- a/org/drip/dynamics/hullwhite/TrinomialTreeTransitionMetrics.java +++ /dev/null @@ -1,317 +0,0 @@ - -package org.drip.dynamics.hullwhite; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * TrinomialTreeTransitionMetrics records the Transition Metrics associated with Node-to-Node Evolution of - * the Instantaneous Short Rate using the Hull-White Model Trinomial Tree. - * - * @author Lakshmi Krishnamurthy - */ - -public class TrinomialTreeTransitionMetrics { - private long _lTreeTimeIndex = -1L; - private long _lTreeStochasticBaseIndex = -1L; - private long _lTreeStochasticDisplacementIndex = -1L; - private double _dblXVariance = java.lang.Double.NaN; - private double _dblTerminalAlpha = java.lang.Double.NaN; - private double _dblProbabilityUp = java.lang.Double.NaN; - private int _iInitialDate = java.lang.Integer.MIN_VALUE; - private int _iTerminalDate = java.lang.Integer.MIN_VALUE; - private double _dblProbabilityDown = java.lang.Double.NaN; - private double _dblProbabilityStay = java.lang.Double.NaN; - private double _dblXStochasticShift = java.lang.Double.NaN; - private double _dblExpectedTerminalX = java.lang.Double.NaN; - - /** - * TrinomialTreeTransitionMetrics Constructor - * - * @param iInitialDate The Initial Date - * @param iTerminalDate The Terminal/Final Date - * @param lTreeTimeIndex The Tree Time Index - * @param lTreeStochasticBaseIndex The Tree Stochastic Base Index - * @param dblExpectedTerminalX Expectation of the Final/Terminal Value for X - * @param dblXVariance Variance of X - * @param dblTerminalAlpha The Final/Terminal Alpha - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public TrinomialTreeTransitionMetrics ( - final int iInitialDate, - final int iTerminalDate, - final long lTreeTimeIndex, - final long lTreeStochasticBaseIndex, - final double dblExpectedTerminalX, - final double dblXVariance, - final double dblTerminalAlpha) - throws java.lang.Exception - { - if (0 > (_lTreeTimeIndex = lTreeTimeIndex) || !org.drip.quant.common.NumberUtil.IsValid - (_dblExpectedTerminalX = dblExpectedTerminalX) || !org.drip.quant.common.NumberUtil.IsValid - (_dblXVariance = dblXVariance) || !org.drip.quant.common.NumberUtil.IsValid - (_dblTerminalAlpha = dblTerminalAlpha)) - throw new java.lang.Exception ("TrinomialTreeTransitionMetrics ctr: Invalid Inputs"); - - _dblXStochasticShift = java.lang.Math.sqrt (_dblXVariance * 3.); - - _lTreeStochasticDisplacementIndex = java.lang.Math.round (_dblExpectedTerminalX / - _dblXStochasticShift); - - _iInitialDate = iInitialDate; - _iTerminalDate = iTerminalDate; - _lTreeStochasticBaseIndex = lTreeStochasticBaseIndex; - double dblEta = _dblExpectedTerminalX - _lTreeStochasticDisplacementIndex * _dblXStochasticShift; - _dblProbabilityStay = (2. / 3.) - (dblEta * dblEta / (3. * _dblXVariance)); - _dblProbabilityDown = (1. / 6.) + (dblEta * dblEta / (6. * _dblXVariance)) - (0.5 * dblEta / - _dblXStochasticShift); - _dblProbabilityUp = (1. / 6.) + (dblEta * dblEta / (6. * _dblXVariance)) + (0.5 * dblEta / - _dblXStochasticShift); - } - - /** - * Retrieve the Initial Date - * - * @return The Initial Date - */ - - public int initialDate() - { - return _iInitialDate; - } - - /** - * Retrieve the Terminal Date - * - * @return The Terminal Date - */ - - public int terminalDate() - { - return _iTerminalDate; - } - - /** - * Retrieve the Tree Time Index - * - * @return The Tree Time Index - */ - - public long treeTimeIndex() - { - return _lTreeTimeIndex; - } - - /** - * Retrieve the Expected Final/Terminal Value for X - * - * @return The Expected Final/Terminal Value for X - */ - - public double expectedTerminalX() - { - return _dblExpectedTerminalX; - } - - /** - * Retrieve the Variance in the Final Value of X - * - * @return The Variance in the Final Value of X - */ - - public double xVariance() - { - return _dblXVariance; - } - - /** - * Retrieve the Stochastic Shift of X - * - * @return The Stochastic Shift of X - */ - - public double xStochasticShift() - { - return _dblXStochasticShift; - } - - /** - * Retrieve the Tree Stochastic Displacement Index - * - * @return The Tree Stochastic Displacement Index - */ - - public long treeStochasticDisplacementIndex() - { - return _lTreeStochasticDisplacementIndex; - } - - /** - * Retrieve the Probability of the Up Stochastic Shift - * - * @return Probability of the Up Stochastic Shift - */ - - public double probabilityUp() - { - return _dblProbabilityUp; - } - - /** - * Retrieve the Probability of the Down Stochastic Shift - * - * @return Probability of the Down Stochastic Shift - */ - - public double probabilityDown() - { - return _dblProbabilityDown; - } - - /** - * Retrieve the Probability of the No Shift - * - * @return Probability of the No Shift - */ - - public double probabilityStay() - { - return _dblProbabilityStay; - } - - /** - * Retrieve the "Up" Value for X - * - * @return The "Up" Value for X - */ - - public double xUp() - { - return (_lTreeStochasticDisplacementIndex + 1) * _dblXStochasticShift; - } - - /** - * Retrieve the "Down" Value for X - * - * @return The "Down" Value for X - */ - - public double xDown() - { - return (_lTreeStochasticDisplacementIndex - 1) * _dblXStochasticShift; - } - - /** - * Retrieve the Final/Terminal Alpha - * - * @return The Final/Terminal Alpha - */ - - public double terminalAlpha() - { - return _dblTerminalAlpha; - } - - /** - * Retrieve the "Up" Node Metrics - * - * @return The "Up" Node Metrics - */ - - public org.drip.dynamics.hullwhite.TrinomialTreeNodeMetrics upNodeMetrics() - { - try { - return new org.drip.dynamics.hullwhite.TrinomialTreeNodeMetrics (_lTreeTimeIndex, - _lTreeStochasticBaseIndex + 1, (_lTreeStochasticDisplacementIndex + 1) * - _dblXStochasticShift, _dblTerminalAlpha); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the "Down" Node Metrics - * - * @return The "Down" Node Metrics - */ - - public org.drip.dynamics.hullwhite.TrinomialTreeNodeMetrics downNodeMetrics() - { - try { - return new org.drip.dynamics.hullwhite.TrinomialTreeNodeMetrics (_lTreeTimeIndex, - _lTreeStochasticBaseIndex - 1, (_lTreeStochasticDisplacementIndex - 1) * - _dblXStochasticShift, _dblTerminalAlpha); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the "Stay" Node Metrics - * - * @return The "Stay" Node Metrics - */ - - public org.drip.dynamics.hullwhite.TrinomialTreeNodeMetrics stayNodeMetrics() - { - try { - return new org.drip.dynamics.hullwhite.TrinomialTreeNodeMetrics (_lTreeTimeIndex, - _lTreeStochasticBaseIndex, _lTreeStochasticDisplacementIndex * _dblXStochasticShift, - _dblTerminalAlpha); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/dynamics/lmm/BGMCurveUpdate.java b/org/drip/dynamics/lmm/BGMCurveUpdate.java deleted file mode 100644 index 2f24cf9..0000000 --- a/org/drip/dynamics/lmm/BGMCurveUpdate.java +++ /dev/null @@ -1,271 +0,0 @@ - -package org.drip.dynamics.lmm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BGMCurveUpdate contains the Instantaneous Snapshot of the Evolving Discount Curve Latent State - * Quantification Metrics Updated using the BGM LIBOR Update Dynamics. - * - * @author Lakshmi Krishnamurthy - */ - -public class BGMCurveUpdate extends org.drip.dynamics.evolution.LSQMCurveUpdate { - private org.drip.state.identifier.ForwardLabel _lslForward = null; - private org.drip.state.identifier.FundingLabel _lslFunding = null; - private org.drip.dynamics.lmm.LognormalLIBORVolatility _llv = null; - - /** - * Construct an Instance of BGMCurveUpdate - * - * @param lslFunding The Funding Latent State Label - * @param lslForward The Forward Latent State Label - * @param iInitialDate The Initial Date - * @param iFinalDate The Final Date - * @param fc The LIBOR Forward Curve Snapshot - * @param spanLIBORIncrement The LIBOR Forward Curve Span Increment - * @param dc The Discount Factor Discount Curve - * @param spanDiscountFactorIncrement The Discount Factor Discount Curve Span Increment - * @param spanContinuousForwardRateIncrement The Continuous Forward Rate Discount Curve Span Increment - * @param spanSpotRateIncrement The Spot Rate Discount Curve Span Increment - * @param spanInstantaneousEffectiveForward The Instantaneous Effective Forward Rate Span - * @param spanInstantaneousNominalForward The Instantaneous Nominal Forward Rate Span - * @param llv The Log-normal LIBOR Rate Volatility - * - * @return Instance of BGMCurveUpdate - */ - - public static final BGMCurveUpdate Create ( - final org.drip.state.identifier.FundingLabel lslFunding, - final org.drip.state.identifier.ForwardLabel lslForward, - final int iInitialDate, - final int iFinalDate, - final org.drip.state.forward.ForwardCurve fc, - final org.drip.spline.grid.Span spanLIBORIncrement, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.spline.grid.Span spanDiscountFactorIncrement, - final org.drip.spline.grid.Span spanContinuousForwardRateIncrement, - final org.drip.spline.grid.Span spanSpotRateIncrement, - final org.drip.spline.grid.Span spanInstantaneousEffectiveForward, - final org.drip.spline.grid.Span spanInstantaneousNominalForward, - final org.drip.dynamics.lmm.LognormalLIBORVolatility llv) - { - org.drip.dynamics.evolution.LSQMCurveSnapshot snapshot = new - org.drip.dynamics.evolution.LSQMCurveSnapshot(); - - if (!snapshot.setQMCurve (org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_LIBOR_RATE, fc)) - return null; - - if (!snapshot.setQMCurve - (org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR, dc)) - return null; - - org.drip.dynamics.evolution.LSQMCurveIncrement increment = new - org.drip.dynamics.evolution.LSQMCurveIncrement(); - - if (null != spanLIBORIncrement && !increment.setQMSpan (lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_LIBOR_RATE, spanLIBORIncrement)) - return null; - - if (null != spanContinuousForwardRateIncrement && !increment.setQMSpan (lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_CONTINUOUSLY_COMPOUNDED_FORWARD_RATE, - spanContinuousForwardRateIncrement)) - return null; - - if (null != spanDiscountFactorIncrement && !increment.setQMSpan (lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR, - spanDiscountFactorIncrement)) - return null; - - if (null != spanSpotRateIncrement && !increment.setQMSpan (lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE, spanSpotRateIncrement)) - return null; - - if (null != spanInstantaneousEffectiveForward && !increment.setQMSpan (lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_INSTANTANEOUS_EFFECTIVE_FORWARD_RATE, - spanInstantaneousEffectiveForward)) - return null; - - if (null != spanInstantaneousNominalForward && !increment.setQMSpan (lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_INSTANTANEOUS_NOMINAL_FORWARD_RATE, - spanInstantaneousNominalForward)) - return null; - - try { - return new BGMCurveUpdate (lslFunding, lslForward, iInitialDate, iFinalDate, snapshot, increment, - llv); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private BGMCurveUpdate ( - final org.drip.state.identifier.FundingLabel lslFunding, - final org.drip.state.identifier.ForwardLabel lslForward, - final int iInitialDate, - final int iFinalDate, - final org.drip.dynamics.evolution.LSQMCurveSnapshot snapshot, - final org.drip.dynamics.evolution.LSQMCurveIncrement increment, - final org.drip.dynamics.lmm.LognormalLIBORVolatility llv) - throws java.lang.Exception - { - super (iInitialDate, iFinalDate, snapshot, increment); - - if (null == (_lslFunding = lslFunding) || null == (_lslForward = lslForward) || null == (_llv = llv)) - throw new java.lang.Exception ("BGMCurveUpdate ctr: Invalid Inputs"); - } - - /** - * Retrieve the LIBOR Forward Curve - * - * @return The LIBOR Forward Curve - */ - - public org.drip.state.forward.ForwardCurve forwardCurve() - { - return (org.drip.state.forward.ForwardCurve) snapshot().qm (_lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_LIBOR_RATE); - } - - /** - * Retrieve the LIBOR Forward Curve Increment Span - * - * @return The LIBOR Forward Curve Increment Span - */ - - public org.drip.spline.grid.Span forwardCurveIncrement() - { - return increment().span (_lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_LIBOR_RATE); - } - - /** - * Retrieve the Instantaneous Continuously Compounded Forward Curve Increment Span - * - * @return The Instantaneous Continuously Compounded Forward Curve Increment Span - */ - - public org.drip.spline.grid.Span continuousForwardRateIncrement() - { - return increment().span (_lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_CONTINUOUSLY_COMPOUNDED_FORWARD_RATE); - } - - /** - * Retrieve the Instantaneous Effective Annual Forward Rate Span - * - * @return The Instantaneous Effective Annual Forward Rate Span - */ - - public org.drip.spline.grid.Span instantaneousEffectiveForwardRate() - { - return increment().span (_lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_INSTANTANEOUS_EFFECTIVE_FORWARD_RATE); - } - - /** - * Retrieve the Instantaneous Nominal Annual Forward Rate Span - * - * @return The Instantaneous Nominal Annual Forward Rate Span - */ - - public org.drip.spline.grid.Span instantaneousNominalForwardRate() - { - return increment().span (_lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_INSTANTANEOUS_NOMINAL_FORWARD_RATE); - } - - /** - * Retrieve the Discount Factor Curve - * - * @return The Discount Factor Curve - */ - - public org.drip.state.discount.MergedDiscountForwardCurve discountCurve() - { - return (org.drip.state.discount.MergedDiscountForwardCurve) snapshot().qm (_lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR); - } - - /** - * Retrieve the Discount Factor Discount Curve Increment - * - * @return The Discount Factor Discount Curve Increment - */ - - public org.drip.spline.grid.Span discountCurveIncrement() - { - return increment().span (_lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR); - } - - /** - * Retrieve the Spot Rate Discount Curve Increment - * - * @return The Spot Rate Discount Curve Increment - */ - - public org.drip.spline.grid.Span spotRateIncrement() - { - return increment().span (_lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE); - } - - /** - * Retrieve the Log-normal LIBOR Volatility Instance - * - * @return The Log-normal LIBOR Volatility Instance - */ - - public org.drip.dynamics.lmm.LognormalLIBORVolatility lognormalLIBORVolatility() - { - return _llv; - } -} diff --git a/org/drip/dynamics/lmm/BGMForwardTenorSnap.java b/org/drip/dynamics/lmm/BGMForwardTenorSnap.java deleted file mode 100644 index 44148d7..0000000 --- a/org/drip/dynamics/lmm/BGMForwardTenorSnap.java +++ /dev/null @@ -1,270 +0,0 @@ - -package org.drip.dynamics.lmm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BGMForwardTenorSnap contains the Absolute and the Incremental Latent State Quantifier Snapshot traced from - * the Evolution of the LIBOR Forward Rate as formulated in: - * - * 1) Goldys, B., M. Musiela, and D. Sondermann (1994): Log-normality of Rates and Term Structure Models, - * The University of New South Wales. - * - * 2) Musiela, M. (1994): Nominal Annual Rates and Log-normal Volatility Structure, The University of New - * South Wales. - * - * 3) Brace, A., D. Gatarek, and M. Musiela (1997): The Market Model of Interest Rate Dynamics, Mathematical - * Finance 7 (2), 127-155. - * - * @author Lakshmi Krishnamurthy - */ - -public class BGMForwardTenorSnap { - private double _dblLIBOR = java.lang.Double.NaN; - private int _iDate = java.lang.Integer.MIN_VALUE; - private double _dblDiscountFactor = java.lang.Double.NaN; - private double _dblLIBORIncrement = java.lang.Double.NaN; - private double _dblSpotRateIncrement = java.lang.Double.NaN; - private double _dblDiscountFactorIncrement = java.lang.Double.NaN; - private double _dblLognormalLIBORVolatility = java.lang.Double.NaN; - private double _dblInstantaneousNominalForwardRate = java.lang.Double.NaN; - private double _dblInstantaneousEffectiveForwardRate = java.lang.Double.NaN; - private double _dblContinuouslyCompoundedForwardIncrement = java.lang.Double.NaN; - private double _dblContinuouslyCompoundedForwardVolatility = java.lang.Double.NaN; - - /** - * BGMForwardTenorSnap Constructor - * - * @param iDate The Date corresponding to the Tenor - * @param dblLIBOR The LIBOR Rate - * @param dblLIBORIncrement The LIBOR Rate Increment - * @param dblDiscountFactor The Discount Factor - * @param dblDiscountFactorIncrement The Discount Factor Increment - * @param dblContinuouslyCompoundedForwardIncrement Continuously Compounded Forward Rate Increment - * @param dblSpotRateIncrement Spot Rate Increment - * @param dblInstantaneousEffectiveForwardRate Instantaneous Effective Annual Forward Rate - * @param dblInstantaneousNominalForwardRate Instantaneous Nominal Annual Forward Rate - * @param dblLognormalLIBORVolatility The Log-normal LIBOR Rate Volatility - * @param dblContinuouslyCompoundedForwardVolatility The Continuously Compounded Forward Rate Volatility - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BGMForwardTenorSnap ( - final int iDate, - final double dblLIBOR, - final double dblLIBORIncrement, - final double dblDiscountFactor, - final double dblDiscountFactorIncrement, - final double dblContinuouslyCompoundedForwardIncrement, - final double dblSpotRateIncrement, - final double dblInstantaneousEffectiveForwardRate, - final double dblInstantaneousNominalForwardRate, - final double dblLognormalLIBORVolatility, - final double dblContinuouslyCompoundedForwardVolatility) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblLIBOR = dblLIBOR) || - !org.drip.quant.common.NumberUtil.IsValid (_dblLIBORIncrement = dblLIBORIncrement) || - !org.drip.quant.common.NumberUtil.IsValid (_dblDiscountFactor = dblDiscountFactor) || - !org.drip.quant.common.NumberUtil.IsValid (_dblDiscountFactorIncrement = - dblDiscountFactorIncrement) || !org.drip.quant.common.NumberUtil.IsValid - (_dblContinuouslyCompoundedForwardIncrement = - dblContinuouslyCompoundedForwardIncrement) || - !org.drip.quant.common.NumberUtil.IsValid (_dblSpotRateIncrement = - dblSpotRateIncrement) || !org.drip.quant.common.NumberUtil.IsValid - (_dblInstantaneousEffectiveForwardRate = - dblInstantaneousEffectiveForwardRate) || - !org.drip.quant.common.NumberUtil.IsValid - (_dblInstantaneousNominalForwardRate = - dblInstantaneousNominalForwardRate) || - !org.drip.quant.common.NumberUtil.IsValid - (_dblLognormalLIBORVolatility = dblLognormalLIBORVolatility) || - !org.drip.quant.common.NumberUtil.IsValid (_dblContinuouslyCompoundedForwardVolatility = - dblContinuouslyCompoundedForwardVolatility)) - throw new java.lang.Exception ("BGMForwardTenorSnap ctr: Invalid Inputs"); - - _iDate = iDate; - } - - /** - * Retrieve the Tenor Date - * - * @return The Tenor Date - */ - - public int date() - { - return _iDate; - } - - /** - * Retrieve the LIBOR Rate - * - * @return The LIBOR Rate - */ - - public double libor() - { - return _dblLIBOR; - } - - /** - * Retrieve the LIBOR Rate Increment - * - * @return The LIBOR Rate Increment - */ - - public double liborIncrement() - { - return _dblLIBORIncrement; - } - - /** - * Retrieve the Discount Factor - * - * @return The Discount Factor - */ - - public double discountFactor() - { - return _dblDiscountFactor; - } - - /** - * Retrieve the Discount Factor Increment - * - * @return The Discount Factor Increment - */ - - public double discountFactorIncrement() - { - return _dblDiscountFactorIncrement; - } - - /** - * Retrieve the Continuously Compounded Forward Rate Increment - * - * @return The Continuously Compounded Forward Rate Increment - */ - - public double continuouslyCompoundedForwardIncrement() - { - return _dblContinuouslyCompoundedForwardIncrement; - } - - /** - * Retrieve the Spot Rate Increment - * - * @return The Spot Rate Increment - */ - - public double spotRateIncrement() - { - return _dblSpotRateIncrement; - } - - /** - * Retrieve the Instantaneous Effective Annual Forward Rate - * - * @return The Instantaneous Effective Annual Forward Rate - */ - - public double instantaneousEffectiveForwardRate() - { - return _dblInstantaneousEffectiveForwardRate; - } - - /** - * Retrieve the Instantaneous Nominal Annual Forward Rate - * - * @return The Instantaneous Nominal Annual Forward Rate - */ - - public double instantaneousNominalForwardRate() - { - return _dblInstantaneousNominalForwardRate; - } - - /** - * Retrieve the Log-normal LIBOR Volatility - * - * @return The Log-normal LIBOR Volatility - */ - - public double lognormalLIBORVolatility() - { - return _dblLognormalLIBORVolatility; - } - - /** - * Retrieve the Continuously Compounded Forward Rate Volatility - * - * @return The Continuously Compounded Forward Rate Volatility - */ - - public double continuouslyCompoundedForwardVolatility() - { - return _dblContinuouslyCompoundedForwardVolatility; - } - - @Override public java.lang.String toString() - { - return org.drip.quant.common.FormatUtil.FormatDouble (_dblLIBOR, 1, 2, 100.) + "% | " + - org.drip.quant.common.FormatUtil.FormatDouble (_dblLIBORIncrement, 2, 2, 10000.) + " | " + - org.drip.quant.common.FormatUtil.FormatDouble (_dblDiscountFactor, 1, 4, 1.) + " | " + - org.drip.quant.common.FormatUtil.FormatDouble (_dblDiscountFactorIncrement, 2, 2, 10000.) - + " | " + org.drip.quant.common.FormatUtil.FormatDouble - (_dblContinuouslyCompoundedForwardIncrement, 2, 2, 10000.) + " | " + - org.drip.quant.common.FormatUtil.FormatDouble (_dblSpotRateIncrement, 2, 2, - 10000.) + " | " + org.drip.quant.common.FormatUtil.FormatDouble - (_dblInstantaneousEffectiveForwardRate, 2, 2, 10000.) + " | " + - org.drip.quant.common.FormatUtil.FormatDouble - (_dblInstantaneousNominalForwardRate, 2, 2, 10000.) + " ||"; - } -} diff --git a/org/drip/dynamics/lmm/BGMPointUpdate.java b/org/drip/dynamics/lmm/BGMPointUpdate.java deleted file mode 100644 index 44ceb29..0000000 --- a/org/drip/dynamics/lmm/BGMPointUpdate.java +++ /dev/null @@ -1,363 +0,0 @@ - -package org.drip.dynamics.lmm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BGMPointUpdate contains the Instantaneous Snapshot of the Evolving Discount Point Latent State - * Quantification Metrics Updated using the BGM LIBOR Update Dynamics. - * - * @author Lakshmi Krishnamurthy - */ - -public class BGMPointUpdate extends org.drip.dynamics.evolution.LSQMPointUpdate { - private org.drip.state.identifier.ForwardLabel _lslForward = null; - private org.drip.state.identifier.FundingLabel _lslFunding = null; - private double _dblLognormalLIBORVolatility = java.lang.Double.NaN; - private double _dblContinuouslyCompoundedForwardVolatility = java.lang.Double.NaN; - - /** - * Construct an Instance of BGMPointUpdate - * - * @param lslFunding The Funding Latent State Label - * @param lslForward The Forward Latent State Label - * @param iInitialDate The Initial Date - * @param iFinalDate The Final Date - * @param iTargetPointDate The Target Point Date - * @param dblLIBOR The LIBOR Rate - * @param dblLIBORIncrement The LIBOR Rate Increment - * @param dblContinuousForwardRate The Continuously Compounded Forward Rate - * @param dblContinuousForwardRateIncrement The Continuously Compounded Forward Rate Increment - * @param dblSpotRate The Spot Rate - * @param dblSpotRateIncrement The Spot Rate Increment - * @param dblDiscountFactor The Discount Factor - * @param dblDiscountFactorIncrement The Discount Factor Increment - * @param dblInstantaneousEffectiveForwardRate Instantaneous Effective Annual Forward Rate - * @param dblInstantaneousNominalForwardRate Instantaneous Nominal Annual Forward Rate - * @param dblLognormalLIBORVolatility The Log-normal LIBOR Rate Volatility - * @param dblContinuouslyCompoundedForwardVolatility The Continuously Compounded Forward Rate Volatility - * - * @return Instance of BGMPointUpdate - */ - - public static final BGMPointUpdate Create ( - final org.drip.state.identifier.FundingLabel lslFunding, - final org.drip.state.identifier.ForwardLabel lslForward, - final int iInitialDate, - final int iFinalDate, - final int iTargetPointDate, - final double dblLIBOR, - final double dblLIBORIncrement, - final double dblContinuousForwardRate, - final double dblContinuousForwardRateIncrement, - final double dblSpotRate, - final double dblSpotRateIncrement, - final double dblDiscountFactor, - final double dblDiscountFactorIncrement, - final double dblInstantaneousEffectiveForwardRate, - final double dblInstantaneousNominalForwardRate, - final double dblLognormalLIBORVolatility, - final double dblContinuouslyCompoundedForwardVolatility) - { - org.drip.dynamics.evolution.LSQMPointRecord lrSnapshot = new - org.drip.dynamics.evolution.LSQMPointRecord(); - - if (!lrSnapshot.setQM (lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_LIBOR_RATE, dblLIBOR)) - return null; - - if (!lrSnapshot.setQM (lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_CONTINUOUSLY_COMPOUNDED_FORWARD_RATE, - dblContinuousForwardRate)) - return null; - - if (!lrSnapshot.setQM (lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_INSTANTANEOUS_EFFECTIVE_FORWARD_RATE, - dblInstantaneousEffectiveForwardRate)) - return null; - - if (!lrSnapshot.setQM (lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_INSTANTANEOUS_NOMINAL_FORWARD_RATE, - dblInstantaneousNominalForwardRate)) - return null; - - if (!lrSnapshot.setQM (lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE, dblSpotRate)) - return null; - - if (!lrSnapshot.setQM (lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR, dblDiscountFactor)) - return null; - - org.drip.dynamics.evolution.LSQMPointRecord lrIncrement = new - org.drip.dynamics.evolution.LSQMPointRecord(); - - if (!lrIncrement.setQM (lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_LIBOR_RATE, dblLIBORIncrement)) - return null; - - if (!lrIncrement.setQM (lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_CONTINUOUSLY_COMPOUNDED_FORWARD_RATE, - dblContinuousForwardRateIncrement)) - return null; - - if (!lrIncrement.setQM (lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE, dblSpotRateIncrement)) - return null; - - if (!lrIncrement.setQM (lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR, - dblDiscountFactorIncrement)) - return null; - - try { - return new BGMPointUpdate (lslFunding, lslForward, iInitialDate, iFinalDate, iTargetPointDate, - lrSnapshot, lrIncrement, dblLognormalLIBORVolatility, - dblContinuouslyCompoundedForwardVolatility); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private BGMPointUpdate ( - final org.drip.state.identifier.FundingLabel lslFunding, - final org.drip.state.identifier.ForwardLabel lslForward, - final int iInitialDate, - final int iFinalDate, - final int iViewDate, - final org.drip.dynamics.evolution.LSQMPointRecord lrSnapshot, - final org.drip.dynamics.evolution.LSQMPointRecord lrIncrement, - final double dblLognormalLIBORVolatility, - final double dblContinuouslyCompoundedForwardVolatility) - throws java.lang.Exception - { - super (iInitialDate, iFinalDate, iViewDate, lrSnapshot, lrIncrement); - - if (null == (_lslFunding = lslFunding) || null == (_lslForward = lslForward) || - !org.drip.quant.common.NumberUtil.IsValid (_dblLognormalLIBORVolatility = - dblLognormalLIBORVolatility) || !org.drip.quant.common.NumberUtil.IsValid - (_dblContinuouslyCompoundedForwardVolatility = - dblContinuouslyCompoundedForwardVolatility)) - throw new java.lang.Exception ("BGMPointUpdate ctr: Invalid Inputs"); - } - - /** - * Retrieve the LIBOR Rate - * - * @return The LIBOR Rate - * - * @throws java.lang.Exception Thrown if the LIBOR Rate is not available - */ - - public double libor() - throws java.lang.Exception - { - return snapshot().qm (_lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_LIBOR_RATE); - } - - /** - * Retrieve the LIBOR Rate Increment - * - * @return The LIBOR Rate Increment - * - * @throws java.lang.Exception Thrown if the LIBOR Rate Increment is not available - */ - - public double liborIncrement() - throws java.lang.Exception - { - return increment().qm (_lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_LIBOR_RATE); - } - - /** - * Retrieve the Continuously Compounded Forward Rate - * - * @return The Continuously Compounded Forward Rate - * - * @throws java.lang.Exception Thrown if the Continuously Compounded Forward Rate is not available - */ - - public double continuousForwardRate() - throws java.lang.Exception - { - return snapshot().qm (_lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_CONTINUOUSLY_COMPOUNDED_FORWARD_RATE); - } - - /** - * Retrieve the Continuously Compounded Forward Rate Increment - * - * @return The Continuously Compounded Forward Rate Increment - * - * @throws java.lang.Exception Thrown if the Continuously Compounded Forward Rate Increment is not - * available - */ - - public double continuousForwardRateIncrement() - throws java.lang.Exception - { - return increment().qm (_lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_CONTINUOUSLY_COMPOUNDED_FORWARD_RATE); - } - - /** - * Retrieve the Instantaneous Effective Annual Forward Rate - * - * @return The Instantaneous Effective Annual Forward Rate - * - * @throws java.lang.Exception Thrown if the Instantaneous Effective Annual Forward Rate is not available - */ - - public double instantaneousEffectiveForwardRate() - throws java.lang.Exception - { - return snapshot().qm (_lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_INSTANTANEOUS_EFFECTIVE_FORWARD_RATE); - } - - /** - * Retrieve the Instantaneous Nominal Annual Forward Rate - * - * @return The Instantaneous Nominal Annual Forward Rate - * - * @throws java.lang.Exception Thrown if the Instantaneous Nominal Annual Forward Rate is not available - */ - - public double instantaneousNominalForwardRate() - throws java.lang.Exception - { - return snapshot().qm (_lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_INSTANTANEOUS_NOMINAL_FORWARD_RATE); - } - - /** - * Retrieve the Spot Rate - * - * @return The Spot Rate - * - * @throws java.lang.Exception Thrown if the Spot Rate is not available - */ - - public double spotRate() - throws java.lang.Exception - { - return snapshot().qm (_lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE); - } - - /** - * Retrieve the Spot Rate Increment - * - * @return The Spot Rate Increment - * - * @throws java.lang.Exception Thrown if the Spot Rate Increment is not available - */ - - public double spotRateIncrement() - throws java.lang.Exception - { - return increment().qm (_lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE); - } - - /** - * Retrieve the Discount Factor - * - * @return The Discount Factor - * - * @throws java.lang.Exception Thrown if the Discount Factor is not available - */ - - public double discountFactor() - throws java.lang.Exception - { - return snapshot().qm (_lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR); - } - - /** - * Retrieve the Discount Factor Increment - * - * @return The Discount Factor Increment - * - * @throws java.lang.Exception Thrown if the Discount Factor Increment is not available - */ - - public double discountFactorIncrement() - throws java.lang.Exception - { - return increment().qm (_lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR); - } - - /** - * Retrieve the Log-normal LIBOR Volatility - * - * @return The Log-normal LIBOR Volatility - */ - - public double lognormalLIBORVolatility() - { - return _dblLognormalLIBORVolatility; - } - - /** - * Retrieve the Continuously Compounded Forward Rate Volatility - * - * @return The Continuously Compounded Forward Rate Volatility - */ - - public double continuouslyCompoundedForwardVolatility() - { - return _dblContinuouslyCompoundedForwardVolatility; - } -} diff --git a/org/drip/dynamics/lmm/BGMTenorNodeSequence.java b/org/drip/dynamics/lmm/BGMTenorNodeSequence.java deleted file mode 100644 index f0a3c3f..0000000 --- a/org/drip/dynamics/lmm/BGMTenorNodeSequence.java +++ /dev/null @@ -1,275 +0,0 @@ - -package org.drip.dynamics.lmm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BGMTenorNodeSequence contains the Point Nodes of the Latent State Quantifiers and their Increments present - * in the specified BGMForwardTenorSnap Instance. The References are: - * - * 1) Goldys, B., M. Musiela, and D. Sondermann (1994): Log-normality of Rates and Term Structure Models, - * The University of New South Wales. - * - * 2) Musiela, M. (1994): Nominal Annual Rates and Log-normal Volatility Structure, The University of New - * South Wales. - * - * 3) Brace, A., D. Gatarek, and M. Musiela (1997): The Market Model of Interest Rate Dynamics, Mathematical - * Finance 7 (2), 127-155. - * - * @author Lakshmi Krishnamurthy - */ - -public class BGMTenorNodeSequence { - private int[] _aiDate = null; - private double[] _adblLIBOR = null; - private double[] _adblLIBORIncrement = null; - private double[] _adblDiscountFactor = null; - private double[] _adblSpotRateIncrement = null; - private double[] _adblDiscountFactorIncrement = null; - private double[] _adblContinuousForwardRateIncrement = null; - private double[] _adblInstantaneousNominalForwardRate = null; - private double[] _adblInstantaneousEffectiveForwardRate = null; - - /** - * BGMTenorNodeSequence Constructor - * - * @param aBFTS Array of the BGM Forward Tenor Snap Instances - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BGMTenorNodeSequence ( - final org.drip.dynamics.lmm.BGMForwardTenorSnap[] aBFTS) - throws java.lang.Exception - { - if (null == aBFTS) throw new java.lang.Exception ("BGMTenorNodeSequence ctr: Invalid Inputs!"); - - int iNumSnap = aBFTS.length; - _aiDate = new int[iNumSnap]; - _adblLIBOR = new double[iNumSnap]; - _adblLIBORIncrement = new double[iNumSnap]; - _adblDiscountFactor = new double[iNumSnap]; - _adblSpotRateIncrement = new double[iNumSnap]; - _adblDiscountFactorIncrement = new double[iNumSnap]; - _adblContinuousForwardRateIncrement = new double[iNumSnap]; - _adblInstantaneousNominalForwardRate = new double[iNumSnap]; - _adblInstantaneousEffectiveForwardRate = new double[iNumSnap]; - - if (0 == iNumSnap) throw new java.lang.Exception ("BGMTenorNodeSequence ctr: Invalid Inputs!"); - - for (int i = 0; i < iNumSnap; ++i) { - _aiDate[i] = aBFTS[i].date(); - - _adblLIBOR[i] = aBFTS[i].libor(); - - _adblLIBORIncrement[i] = aBFTS[i].liborIncrement(); - - _adblDiscountFactor[i] = aBFTS[i].discountFactor(); - - _adblSpotRateIncrement[i] = aBFTS[i].spotRateIncrement(); - - _adblDiscountFactorIncrement[i] = aBFTS[i].discountFactorIncrement(); - - _adblInstantaneousNominalForwardRate[i] = aBFTS[i].instantaneousNominalForwardRate(); - - _adblInstantaneousEffectiveForwardRate[i] = aBFTS[i].instantaneousEffectiveForwardRate(); - - _adblContinuousForwardRateIncrement[i] = aBFTS[i].continuouslyCompoundedForwardIncrement(); - } - } - - /** - * Retrieve the Array of Tenor Dates - * - * @return The Array of Tenor Dates - */ - - public int[] dates() - { - return _aiDate; - } - - /** - * Retrieve the Array of Tenor LIBOR Rates - * - * @return The Array of Tenor LIBOR Rates - */ - - public double[] liborRates() - { - return _adblLIBOR; - } - - /** - * Retrieve the Array of Tenor LIBOR Rate Increments - * - * @return The Array of Tenor LIBOR Rate Increments - */ - - public double[] liborRateIncrements() - { - return _adblLIBORIncrement; - } - - /** - * Retrieve the Array of Tenor Discount Factors - * - * @return The Array of Tenor Discount Factors - */ - - public double[] discountFactors() - { - return _adblDiscountFactor; - } - - /** - * Retrieve the Array of Tenor Discount Factor Increments - * - * @return The Array of Tenor Discount Factor Increments - */ - - public double[] discountFactorIncrements() - { - return _adblDiscountFactorIncrement; - } - - /** - * Retrieve the Array of Tenor Instantaneous Effective Annual Forward Rate - * - * @return The Array of Tenor Instantaneous Effective Annual Forward Rate - */ - - public double[] instantaneousEffectiveForwardRates() - { - return _adblInstantaneousEffectiveForwardRate; - } - - /** - * Retrieve the Array of Tenor Instantaneous Nominal Annual Forward Rate - * - * @return The Array of Tenor Instantaneous Nominal Annual Forward Rate - */ - - public double[] instantaneousNominalForwardRates() - { - return _adblInstantaneousNominalForwardRate; - } - - /** - * Retrieve the Array of Tenor Instantaneous Continuously Compounded Forward Rate Increments - * - * @return The Array of Tenor Instantaneous Continuously Compounded Forward Rate Increments - */ - - public double[] continuousForwardRateIncrements() - { - return _adblContinuousForwardRateIncrement; - } - - /** - * Retrieve the Array of Tenor Spot Rate Increments - * - * @return The Array of Tenor Spot Rate Increments - */ - - public double[] spotRateIncrements() - { - return _adblSpotRateIncrement; - } - - @Override public java.lang.String toString() - { - int iNumTenor = _aiDate.length; - java.lang.String strDateDump = "\t |"; - java.lang.String strPartition = "\t |"; - java.lang.String strLIBORDump = "\t |"; - java.lang.String strLIBORIncrementDump = "\t |"; - java.lang.String strDiscountFactorDump = "\t |"; - java.lang.String strSpotRateIncrementDump = "\t |"; - java.lang.String strDiscountFactorIncrementDump = "\t |"; - java.lang.String strContinuousForwardIncrementDump = "\t |"; - java.lang.String strInstantaneousNominalForwardDump = "\t |"; - java.lang.String strInstantaneousEffectiveForwardDump = "\t |"; - - for (int i = 0; i < iNumTenor; ++i) { - strPartition += "-------------"; - - strDateDump += " " + new org.drip.analytics.date.JulianDate (_aiDate[i]) + " |"; - - strLIBORDump += " " + org.drip.quant.common.FormatUtil.FormatDouble (_adblLIBOR[i], 1, 3, 100.) - + "% |"; - - strLIBORIncrementDump += " " + org.drip.quant.common.FormatUtil.FormatDouble - (_adblLIBORIncrement[i], 2, 0, 10000.) + " |"; - - strDiscountFactorDump += " " + org.drip.quant.common.FormatUtil.FormatDouble - (_adblDiscountFactor[i], 2, 3, 100.) + " |"; - - strDiscountFactorIncrementDump += " " + org.drip.quant.common.FormatUtil.FormatDouble - (_adblDiscountFactorIncrement[i], 2, 0, 10000.) + " |"; - - strContinuousForwardIncrementDump += " " + org.drip.quant.common.FormatUtil.FormatDouble - (_adblContinuousForwardRateIncrement[i], 2, 0, 10000.) + " |"; - - strSpotRateIncrementDump += " " + org.drip.quant.common.FormatUtil.FormatDouble - (_adblSpotRateIncrement[i], 2, 0, 10000.) + " |"; - - strInstantaneousEffectiveForwardDump += " " + org.drip.quant.common.FormatUtil.FormatDouble - (_adblInstantaneousEffectiveForwardRate[i], 2, 0, 10000.) + " |"; - - strInstantaneousNominalForwardDump += " " + org.drip.quant.common.FormatUtil.FormatDouble - (_adblInstantaneousNominalForwardRate[i], 2, 0, 10000.) + " |"; - } - - return "\n" + strPartition + "|\n" + strDateDump + "|\n" + strPartition + "|\n" + strLIBORDump + - "|\n" + strLIBORIncrementDump + "|\n" + strDiscountFactorDump + "|\n" + - strDiscountFactorIncrementDump + "|\n" + strContinuousForwardIncrementDump + "|\n" + - strSpotRateIncrementDump + "|\n" + strInstantaneousEffectiveForwardDump + "|\n" + - strInstantaneousNominalForwardDump + "|\n" + strPartition + "|\n"; - } -} diff --git a/org/drip/dynamics/lmm/ContinuousForwardRateEvolver.java b/org/drip/dynamics/lmm/ContinuousForwardRateEvolver.java deleted file mode 100644 index e4c5dc2..0000000 --- a/org/drip/dynamics/lmm/ContinuousForwardRateEvolver.java +++ /dev/null @@ -1,253 +0,0 @@ - -package org.drip.dynamics.lmm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ContinuousForwardRateEvolver sets up and implements the Multi-Factor No-arbitrage Dynamics of the Rates - * State Quantifiers traced from the Evolution of the Continuously Compounded Forward Rate as formulated in: - * - * 1) Goldys, B., M. Musiela, and D. Sondermann (1994): Log-normality of Rates and Term Structure Models, - * The University of New South Wales. - * - * 2) Musiela, M. (1994): Nominal Annual Rates and Log-normal Volatility Structure, The University of New - * South Wales. - * - * 3) Brace, A., D. Gatarek, and M. Musiela (1997): The Market Model of Interest Rate Dynamics, Mathematical - * Finance 7 (2), 127-155. - * - * @author Lakshmi Krishnamurthy - */ - -public class ContinuousForwardRateEvolver implements org.drip.dynamics.evolution.PointStateEvolver { - private org.drip.dynamics.hjm.MultiFactorVolatility _mfv = null; - private org.drip.state.identifier.ForwardLabel _lslForward = null; - private org.drip.state.identifier.FundingLabel _lslFunding = null; - - private double volatilityRandomDotProduct ( - final int iViewDate, - final int iTargetDate, - final int iViewTimeIncrement) - throws java.lang.Exception - { - double dblViewTimeIncrementSQRT = java.lang.Math.sqrt (iViewTimeIncrement); - - org.drip.sequence.random.PrincipalFactorSequenceGenerator pfsg = _mfv.msg(); - - double[] adblMultivariateRandom = pfsg.random(); - - double dblVolatilityRandomDotProduct = 0.; - - int iNumFactor = pfsg.numFactor(); - - for (int i = 0; i < iNumFactor; ++i) - dblVolatilityRandomDotProduct += _mfv.weightedFactorPointVolatility (i, iViewDate, iTargetDate) * - adblMultivariateRandom[i] * dblViewTimeIncrementSQRT; - - return dblVolatilityRandomDotProduct; - } - - private double volatilityRandomDotDerivative ( - final int iViewDate, - final int iTargetDate, - final int iViewTimeIncrement, - final boolean bTerminal) - throws java.lang.Exception - { - org.drip.function.definition.R1ToR1 pointVolatilityFunctionR1ToR1 = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - return bTerminal ? volatilityRandomDotProduct (iViewDate, (int) dblX, iViewTimeIncrement) : - volatilityRandomDotProduct ((int) dblX, iTargetDate, iViewTimeIncrement); - } - }; - - return pointVolatilityFunctionR1ToR1.derivative (bTerminal ? iTargetDate : iViewDate, 1); - } - - /** - * ContinuousForwardRateEvolver Constructor - * - * @param lslFunding The Funding Latent State Label - * @param lslForward The Forward Latent State Label - * @param mfv The Multi-Factor Volatility Instance - * @param auInitialInstantaneousForwardRate The Instantaneous Forward Rate Function - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public ContinuousForwardRateEvolver ( - final org.drip.state.identifier.FundingLabel lslFunding, - final org.drip.state.identifier.ForwardLabel lslForward, - final org.drip.dynamics.hjm.MultiFactorVolatility mfv, - final org.drip.function.definition.R1ToR1 auInitialInstantaneousForwardRate) - throws java.lang.Exception - { - if (null == (_lslFunding = lslFunding) || null == (_lslForward = lslForward) || null == (_mfv = mfv)) - throw new java.lang.Exception ("ContinuousForwardRateEvolver ctr: Invalid Inputs"); - } - - /** - * Retrieve the Funding Label - * - * @return The Funding Label - */ - - public org.drip.state.identifier.FundingLabel fundingLabel() - { - return _lslFunding; - } - - /** - * Retrieve the Forward Label - * - * @return The Forward Label - */ - - public org.drip.state.identifier.ForwardLabel forwardLabel() - { - return _lslForward; - } - - /** - * Retrieve the Multi-factor Volatility Instance - * - * @return The Multi-factor Volatility Instance - */ - - public org.drip.dynamics.hjm.MultiFactorVolatility mfv() - { - return _mfv; - } - - @Override public org.drip.dynamics.lmm.ContinuousForwardRateUpdate evolve ( - final int iSpotDate, - final int iViewDate, - final int iSpotTimeIncrement, - final org.drip.dynamics.evolution.LSQMPointUpdate lsqmPrev) - { - if (iSpotDate > iViewDate || (null != lsqmPrev && !(lsqmPrev instanceof - org.drip.dynamics.lmm.ContinuousForwardRateUpdate))) - return null; - - org.drip.dynamics.lmm.ContinuousForwardRateUpdate bgmPrev = - (org.drip.dynamics.lmm.ContinuousForwardRateUpdate) lsqmPrev; - - double dblDContinuousForwardDXTerminalPrev = bgmPrev.dContinuousForwardDXTerminal(); - - double dblDContinuousForwardDXInitialPrev = bgmPrev.dContinuousForwardDXInitial(); - - try { - double dblDiscountFactorPrev = bgmPrev.discountFactor(); - - double dblSpotRateIncrement = dblDContinuousForwardDXInitialPrev * iSpotTimeIncrement + - volatilityRandomDotDerivative (iSpotDate, iViewDate, iSpotTimeIncrement, false); - - double dblContinuousForwardIncrement = (dblDContinuousForwardDXTerminalPrev + 0.5 * - _mfv.pointVolatilityModulusDerivative (iSpotDate, iViewDate, 1, true)) * iSpotTimeIncrement + - volatilityRandomDotDerivative (iSpotDate, iViewDate, iSpotTimeIncrement, true); - - double dblContinuousForwardRate = bgmPrev.continuousForwardRate() + - dblContinuousForwardIncrement; - - double dblSpotRate = bgmPrev.spotRate() + dblSpotRateIncrement; - - double dblDiscountFactorIncrement = dblDiscountFactorPrev * ((dblSpotRate - - dblContinuousForwardRate) * iSpotTimeIncrement - volatilityRandomDotProduct (iSpotDate, - iViewDate, iSpotTimeIncrement)); - - return org.drip.dynamics.lmm.ContinuousForwardRateUpdate.Create (_lslFunding, _lslForward, - iSpotDate, iSpotDate + iSpotTimeIncrement, iViewDate, dblContinuousForwardRate, - dblContinuousForwardIncrement, dblSpotRate, dblSpotRateIncrement, dblDiscountFactorPrev + - dblDiscountFactorIncrement, dblDiscountFactorIncrement, - dblDContinuousForwardDXInitialPrev, dblDContinuousForwardDXTerminalPrev); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Realized Zero Coupon Bond Forward Price - * - * @param iSpotDate The Spot Date - * @param iForwardDate The Forward Date - * @param iMaturityDate The Maturity Date - * @param dblSpotPrice The Spot Price - * @param dblSpotForwardReinvestmentAccrual The Continuously Re-invested Accruing Bank Account - * - * @return The Realized Zero Coupon Bond Forward Price - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public double zeroCouponForwardPrice ( - final int iSpotDate, - final int iForwardDate, - final int iMaturityDate, - final double dblSpotPrice, - final double dblSpotForwardReinvestmentAccrual) - throws java.lang.Exception - { - if (iSpotDate > iForwardDate || iForwardDate > iMaturityDate || - !org.drip.quant.common.NumberUtil.IsValid (dblSpotPrice) || - !org.drip.quant.common.NumberUtil.IsValid (dblSpotForwardReinvestmentAccrual)) - throw new java.lang.Exception - ("ContinuousForwardRateEvolver::zeroCouponForwardPrice => Invalid Inputs"); - - int iPeriodIncrement = iForwardDate - iSpotDate; - - return dblSpotPrice / dblSpotForwardReinvestmentAccrual * java.lang.Math.exp (-1. * - (volatilityRandomDotProduct (iSpotDate, iForwardDate, iPeriodIncrement) + 0.5 * iPeriodIncrement - * _mfv.pointVolatilityModulus (iSpotDate, iForwardDate))); - } -} diff --git a/org/drip/dynamics/lmm/ContinuousForwardRateUpdate.java b/org/drip/dynamics/lmm/ContinuousForwardRateUpdate.java deleted file mode 100644 index 12d00a9..0000000 --- a/org/drip/dynamics/lmm/ContinuousForwardRateUpdate.java +++ /dev/null @@ -1,273 +0,0 @@ - -package org.drip.dynamics.lmm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ContinuousForwardRateUpdate contains the Instantaneous Snapshot of the Evolving Discount Latent State - * Quantification Metrics Updated using the Continuously Compounded Forward Rate Dynamics. - * - * @author Lakshmi Krishnamurthy - */ - -public class ContinuousForwardRateUpdate extends org.drip.dynamics.evolution.LSQMPointUpdate { - private org.drip.state.identifier.ForwardLabel _lslForward = null; - private org.drip.state.identifier.FundingLabel _lslFunding = null; - private double _dblDContinuousForwardDXInitial = java.lang.Double.NaN; - private double _dblDContinuousForwardDXTerminal = java.lang.Double.NaN; - - /** - * Construct an Instance of ContinuousForwardRateUpdate - * - * @param lslFunding The Funding Latent State Label - * @param lslForward The Forward Latent State Label - * @param iInitialDate The Initial Date - * @param iFinalDate The Final Date - * @param iTargetPointDate The Target Point Date - * @param dblContinuousForwardRate The Continuously Compounded Forward Rate - * @param dblContinuousForwardRateIncrement The Continuously Compounded Forward Rate Increment - * @param dblSpotRate The Spot Rate - * @param dblSpotRateIncrement The Spot Rate Increment - * @param dblDiscountFactor The Discount Factor - * @param dblDiscountFactorIncrement The Discount Factor Increment - * @param dblDContinuousForwardDXInitial Initial D {Continuously Compounded Forward Rate} / DX - * @param dblDContinuousForwardDXTerminal Terminal D {Continuously Compounded Forward Rate} / DX - * - * @return Instance of ContinuousForwardRateUpdate - */ - - public static final ContinuousForwardRateUpdate Create ( - final org.drip.state.identifier.FundingLabel lslFunding, - final org.drip.state.identifier.ForwardLabel lslForward, - final int iInitialDate, - final int iFinalDate, - final int iTargetPointDate, - final double dblContinuousForwardRate, - final double dblContinuousForwardRateIncrement, - final double dblSpotRate, - final double dblSpotRateIncrement, - final double dblDiscountFactor, - final double dblDiscountFactorIncrement, - final double dblDContinuousForwardDXInitial, - final double dblDContinuousForwardDXTerminal) - { - org.drip.dynamics.evolution.LSQMPointRecord lrSnapshot = new org.drip.dynamics.evolution.LSQMPointRecord(); - - if (!lrSnapshot.setQM (lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_CONTINUOUSLY_COMPOUNDED_FORWARD_RATE, - dblContinuousForwardRate)) - return null; - - if (!lrSnapshot.setQM (lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE, dblSpotRate)) - return null; - - if (!lrSnapshot.setQM (lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR, dblDiscountFactor)) - return null; - - org.drip.dynamics.evolution.LSQMPointRecord lrIncrement = new org.drip.dynamics.evolution.LSQMPointRecord(); - - if (!lrIncrement.setQM (lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_CONTINUOUSLY_COMPOUNDED_FORWARD_RATE, - dblContinuousForwardRateIncrement)) - return null; - - if (!lrIncrement.setQM (lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE, dblSpotRateIncrement)) - return null; - - if (!lrIncrement.setQM (lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR, - dblDiscountFactorIncrement)) - return null; - - try { - return new ContinuousForwardRateUpdate (lslFunding, lslForward, iInitialDate, iFinalDate, - iTargetPointDate, lrSnapshot, lrIncrement, dblDContinuousForwardDXInitial, - dblDContinuousForwardDXTerminal); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private ContinuousForwardRateUpdate ( - final org.drip.state.identifier.FundingLabel lslFunding, - final org.drip.state.identifier.ForwardLabel lslForward, - final int iInitialDate, - final int iFinalDate, - final int iViewDate, - final org.drip.dynamics.evolution.LSQMPointRecord lrSnapshot, - final org.drip.dynamics.evolution.LSQMPointRecord lrIncrement, - final double dblDContinuousForwardDXInitial, - final double dblDContinuousForwardDXTerminal) - throws java.lang.Exception - { - super (iInitialDate, iFinalDate, iViewDate, lrSnapshot, lrIncrement); - - if (null == (_lslFunding = lslFunding) || null == (_lslForward = lslForward) || - !org.drip.quant.common.NumberUtil.IsValid (_dblDContinuousForwardDXTerminal = - dblDContinuousForwardDXTerminal) || !org.drip.quant.common.NumberUtil.IsValid - (_dblDContinuousForwardDXInitial = dblDContinuousForwardDXInitial)) - throw new java.lang.Exception ("ContinuousForwardRateUpdate ctr: Invalid Inputs"); - } - - /** - * Retrieve the Continuously Compounded Forward Rate - * - * @return The Continuously Compounded Forward Rate - * - * @throws java.lang.Exception Thrown if the Continuously Compounded Forward Rate is not available - */ - - public double continuousForwardRate() - throws java.lang.Exception - { - return snapshot().qm (_lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_CONTINUOUSLY_COMPOUNDED_FORWARD_RATE); - } - - /** - * Retrieve the Continuously Compounded Forward Rate Increment - * - * @return The Continuously Compounded Forward Rate Increment - * - * @throws java.lang.Exception Thrown if the Continuously Compounded Forward Rate Increment is not available - */ - - public double continuousForwardRateIncrement() - throws java.lang.Exception - { - return increment().qm (_lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_CONTINUOUSLY_COMPOUNDED_FORWARD_RATE); - } - - /** - * Retrieve the Spot Rate - * - * @return The Spot Rate - * - * @throws java.lang.Exception Thrown if the Spot Rate is not available - */ - - public double spotRate() - throws java.lang.Exception - { - return snapshot().qm (_lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE); - } - - /** - * Retrieve the Spot Rate Increment - * - * @return The Spot Rate Increment - * - * @throws java.lang.Exception Thrown if the Spot Rate Increment is not available - */ - - public double spotRateIncrement() - throws java.lang.Exception - { - return increment().qm (_lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE); - } - - /** - * Retrieve the Discount Factor - * - * @return The Discount Factor - * - * @throws java.lang.Exception Thrown if the Discount Factor is not available - */ - - public double discountFactor() - throws java.lang.Exception - { - return snapshot().qm (_lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR); - } - - /** - * Retrieve the Discount Factor Increment - * - * @return The Discount Factor Increment - * - * @throws java.lang.Exception Thrown if the Discount Factor Increment is not available - */ - - public double discountFactorIncrement() - throws java.lang.Exception - { - return increment().qm (_lslFunding, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR); - } - - /** - * Retrieve the Initial D {Continuously Compounded Forward Rate} / DX - * - * @return The Initial D {Continuously Compounded Forward Rate} / DX - */ - - public double dContinuousForwardDXInitial() - { - return _dblDContinuousForwardDXInitial; - } - - /** - * Retrieve the Terminal D {Continuously Compounded Forward Rate} / DX - * - * @return The Terminal D {Continuously Compounded Forward Rate} / DX - */ - - public double dContinuousForwardDXTerminal() - { - return _dblDContinuousForwardDXTerminal; - } -} diff --git a/org/drip/dynamics/lmm/ContinuouslyCompoundedForwardProcess.java b/org/drip/dynamics/lmm/ContinuouslyCompoundedForwardProcess.java deleted file mode 100644 index 6fe2179..0000000 --- a/org/drip/dynamics/lmm/ContinuouslyCompoundedForwardProcess.java +++ /dev/null @@ -1,212 +0,0 @@ - -package org.drip.dynamics.lmm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ContinuouslyCompoundedForwardProcess implements the Continuously Compounded Forward Rate Process defined - * in the LIBOR Market Model. The References are: - * - * 1) Goldys, B., M. Musiela, and D. Sondermann (1994): Log-normality of Rates and Term Structure Models, - * The University of New South Wales. - * - * 2) Musiela, M. (1994): Nominal Annual Rates and Log-normal Volatility Structure, The University of New - * South Wales. - * - * 3) Brace, A., D. Gatarek, and M. Musiela (1997): The Market Model of Interest Rate Dynamics, Mathematical - * Finance 7 (2), 127-155. - * - * @author Lakshmi Krishnamurthy - */ - -public class ContinuouslyCompoundedForwardProcess { - private int _iSpotDate = java.lang.Integer.MIN_VALUE; - private org.drip.measure.stochastic.R1R1ToR1 _funcR1R1ToR1 = null; - - /** - * ContinuouslyCompoundedForwardProcess Constructor - * - * @param iSpotDate The Spot Date - * @param funcR1R1ToR1 The Stochastic Forward Rate Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ContinuouslyCompoundedForwardProcess ( - final int iSpotDate, - final org.drip.measure.stochastic.R1R1ToR1 funcR1R1ToR1) - throws java.lang.Exception - { - if (null == (_funcR1R1ToR1 = funcR1R1ToR1)) - throw new java.lang.Exception ("ContinuouslyCompoundedForwardProcess ctr: Invalid Inputs"); - - _iSpotDate = iSpotDate; - } - - /** - * Retrieve the Spot Date - * - * @return The Spot Date - */ - - public int spotDate() - { - return _iSpotDate; - } - - /** - * Retrieve the Stochastic Forward Rate Function - * - * @return The Stochastic Forward Rate Function - */ - - public org.drip.measure.stochastic.R1R1ToR1 stochasticForwardRateFunction() - { - return _funcR1R1ToR1; - } - - /** - * Retrieve a Realized Zero-Coupon Bond Price - * - * @param iMaturityDate The Maturity Date - * - * @return The Realized Zero-Coupon Bond Price - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double realizedZeroCouponPrice ( - final int iMaturityDate) - throws java.lang.Exception - { - if (iMaturityDate <= _iSpotDate) - throw new java.lang.Exception - ("ContinuouslyCompoundedForwardProcess::realizedZeroCouponPrice => Invalid Maturity Date"); - - return java.lang.Math.exp (-1. * _funcR1R1ToR1.integralRealization (0., iMaturityDate - _iSpotDate)); - } - - /** - * Compute the Realized/Expected Instantaneous Forward Rate Integral to the Target Date - * - * @param iTargetDate The Target Date - * @param bRealized TRUE - Compute the Realized (TRUE) / Expected (FALSE) Instantaneous Forward Rate - * Integral - * - * @return The Realized/Expected Instantaneous Forward Rate Integral - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double instantaneousForwardRateIntegral ( - final int iTargetDate, - final boolean bRealized) - throws java.lang.Exception - { - if (iTargetDate <= _iSpotDate) - throw new java.lang.Exception - ("ContinuouslyCompoundedForwardProcess::instantaneousForwardRateIntegral => Invalid Target Date"); - - return bRealized ? java.lang.Math.exp (-1. * _funcR1R1ToR1.integralRealization (0., iTargetDate - - _iSpotDate)) : java.lang.Math.exp (-1. * _funcR1R1ToR1.integralExpectation (0., iTargetDate - - _iSpotDate)); - } - - /** - * Retrieve a Realized/Expected Value of the Discount to the Target Date - * - * @param iTargetDate The Target Date - * @param bRealized TRUE - Compute the Realized (TRUE) / Expected (FALSE) Instantaneous Forward Rate - * Integral - * - * @return The Realized/Expected Value of the Discount to the Target Date - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double discountFunctionValue ( - final int iTargetDate, - final boolean bRealized) - throws java.lang.Exception - { - if (iTargetDate <= _iSpotDate) - throw new java.lang.Exception - ("ContinuouslyCompoundedForwardProcess::discountFunctionValue => Invalid Target Date"); - - return bRealized ? java.lang.Math.exp (-1. * _funcR1R1ToR1.integralRealization (0., iTargetDate - - _iSpotDate)) : java.lang.Math.exp (-1. * _funcR1R1ToR1.integralExpectation (0., iTargetDate - - _iSpotDate)); - } - - /** - * Retrieve a Realized/Expected Value of the LIBOR Rate at the Target Date - * - * @param iTargetDate The Target Date - * @param strTenor The LIBOR Tenor - * @param bRealized TRUE - Compute the Realized (TRUE) / Expected (FALSE) LIBOR Rate - * - * @return The Realized/Expected Value of the LIBOR Rate at the Target Date - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double liborRate ( - final int iTargetDate, - final java.lang.String strTenor, - final boolean bRealized) - throws java.lang.Exception - { - if (iTargetDate <= _iSpotDate) - throw new java.lang.Exception - ("ContinuouslyCompoundedForwardProcess::liborRate => Invalid Inputs"); - - return (discountFunctionValue (new org.drip.analytics.date.JulianDate (iTargetDate).addTenor - (strTenor).julian(), bRealized) / discountFunctionValue (iTargetDate, bRealized) - 1.) / - org.drip.analytics.support.Helper.TenorToYearFraction (strTenor); - } -} diff --git a/org/drip/dynamics/lmm/LognormalLIBORCurveEvolver.java b/org/drip/dynamics/lmm/LognormalLIBORCurveEvolver.java deleted file mode 100644 index 7528e92..0000000 --- a/org/drip/dynamics/lmm/LognormalLIBORCurveEvolver.java +++ /dev/null @@ -1,825 +0,0 @@ - -package org.drip.dynamics.lmm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * LognormalLIBORCurveEvolver sets up and implements the Multi-Factor No-arbitrage Dynamics of the full Curve - * Rates State Quantifiers traced from the Evolution of the LIBOR Forward Rate as formulated in: - * - * 1) Goldys, B., M. Musiela, and D. Sondermann (1994): Log-normality of Rates and Term Structure Models, - * The University of New South Wales. - * - * 2) Musiela, M. (1994): Nominal Annual Rates and Log-normal Volatility Structure, The University of New - * South Wales. - * - * 3) Brace, A., D. Gatarek, and M. Musiela (1997): The Market Model of Interest Rate Dynamics, Mathematical - * Finance 7 (2), 127-155. - * - * @author Lakshmi Krishnamurthy - */ - -public class LognormalLIBORCurveEvolver implements org.drip.dynamics.evolution.CurveStateEvolver { - private int _iNumForwardTenor = -1; - private org.drip.state.identifier.ForwardLabel _lslForward = null; - private org.drip.state.identifier.FundingLabel _lslFunding = null; - private org.drip.spline.params.SegmentCustomBuilderControl[] _aSCBCLIBOR = null; - private org.drip.spline.params.SegmentCustomBuilderControl[] _aSCBCDiscountFactor = null; - private org.drip.spline.params.SegmentCustomBuilderControl[] _aSCBCLIBORIncrement = null; - private org.drip.spline.params.SegmentCustomBuilderControl[] _aSCBCSpotRateIncrement = null; - private org.drip.spline.params.SegmentCustomBuilderControl[] _aSCBCDiscountFactorIncrement = null; - private org.drip.spline.params.SegmentCustomBuilderControl[] _aSCBCContinuousForwardIncrement = null; - private org.drip.spline.params.SegmentCustomBuilderControl[] _aSCBCInstantaneousNominalForward = null; - private org.drip.spline.params.SegmentCustomBuilderControl[] _aSCBCInstantaneousEffectiveForward = null; - - /** - * Create a LognormalLIBORCurveEvolver Instance - * - * @param lslFunding The Funding Latent State Label - * @param lslForward The Forward Latent State Label - * @param iNumForwardTenor Number of Forward Tenors to Build the Span - * @param scbc The Common Span Segment Custom Builder Control Instance - * - * @return The LognormalLIBORCurveEvolver Instance - */ - - public static final LognormalLIBORCurveEvolver Create ( - final org.drip.state.identifier.FundingLabel lslFunding, - final org.drip.state.identifier.ForwardLabel lslForward, - final int iNumForwardTenor, - final org.drip.spline.params.SegmentCustomBuilderControl scbc) - { - try { - return new LognormalLIBORCurveEvolver (lslFunding, lslForward, iNumForwardTenor, scbc, scbc, - scbc, scbc, scbc, scbc, scbc, scbc); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private double forwardDerivative ( - final org.drip.state.forward.ForwardCurve fc, - final int iTargetPointDate) - throws java.lang.Exception - { - org.drip.function.definition.R1ToR1 freR1ToR1 = new org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblDate) - throws java.lang.Exception - { - return fc.forward ((int) dblDate); - } - }; - - return freR1ToR1.derivative (iTargetPointDate, 1); - } - - private double continuousForwardRateIncrement ( - final int iViewDate, - final double dblAnnualizedIncrement, - final double dblAnnualizedIncrementSQRT, - final org.drip.state.forward.ForwardCurve fc, - final double[] adblMultivariateRandom, - final org.drip.dynamics.lmm.LognormalLIBORVolatility llv) - throws java.lang.Exception - { - final int iNumFactor = adblMultivariateRandom.length; - - org.drip.function.definition.R1ToR1 continuousForwardRateR1ToR1 = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblDate) - throws java.lang.Exception - { - double dblForwardPointVolatilityModulus = 0.; - double dblPointVolatilityMultifactorRandom = 0.; - - double[] adblContinuousForwardVolatility = llv.continuousForwardVolatility ((int) dblDate, - fc); - - if (null != adblContinuousForwardVolatility) { - for (int i = 0; i < iNumFactor; ++i) { - dblForwardPointVolatilityModulus += adblContinuousForwardVolatility[i] * - adblContinuousForwardVolatility[i]; - dblPointVolatilityMultifactorRandom += adblContinuousForwardVolatility[i] * - adblMultivariateRandom[i]; - } - } - - return (fc.forward ((int) dblDate) + 0.5 * dblForwardPointVolatilityModulus) * - dblAnnualizedIncrement + dblPointVolatilityMultifactorRandom * - dblAnnualizedIncrementSQRT; - } - }; - - return continuousForwardRateR1ToR1.derivative (iViewDate, 1); - } - - private double spotRateIncrement ( - final int iViewDate, - final double dblAnnualizedIncrement, - final double dblAnnualizedIncrementSQRT, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final double[] adblMultivariateRandom, - final org.drip.dynamics.lmm.LognormalLIBORVolatility llv) - throws java.lang.Exception - { - final int iNumFactor = adblMultivariateRandom.length; - - org.drip.function.definition.R1ToR1 spotRateR1ToR1 = new org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblDate) - throws java.lang.Exception - { - int iDate = (int) dblDate; - double dblPointVolatilityMultifactorRandom = 0.; - - double[] adblContinuousForwardVolatility = llv.continuousForwardVolatility (iDate, dc); - - if (null != adblContinuousForwardVolatility) { - for (int i = 0; i < iNumFactor; ++i) - dblPointVolatilityMultifactorRandom += adblContinuousForwardVolatility[i] * - adblMultivariateRandom[i]; - } - - return dc.forward (iDate, iDate + 1) * dblAnnualizedIncrement + - dblPointVolatilityMultifactorRandom * dblAnnualizedIncrementSQRT; - } - }; - - return spotRateR1ToR1.derivative (iViewDate, 1); - } - - private org.drip.dynamics.lmm.BGMForwardTenorSnap timeSnap ( - final int iSpotDate, - final int iTargetPointDate, - final double dblAnnualizedIncrement, - final double dblAnnualizedIncrementSQRT, - final java.lang.String strForwardTenor, - final org.drip.state.forward.ForwardCurve fc, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.dynamics.lmm.LognormalLIBORVolatility llv) - { - double[] adblLognormalFactorPointVolatility = llv.factorPointVolatility (iSpotDate, - iTargetPointDate); - - double[] adblContinuousForwardVolatility = llv.continuousForwardVolatility (iTargetPointDate, fc); - - double[] adblMultivariateRandom = llv.msg().random(); - - double dblCrossVolatilityDotProduct = 0.; - double dblLognormalPointVolatilityModulus = 0.; - double dblLIBORVolatilityMultiFactorRandom = 0.; - double dblContinuousForwardVolatilityModulus = 0.; - double dblForwardVolatilityMultiFactorRandom = 0.; - int iNumFactor = adblLognormalFactorPointVolatility.length; - - for (int i = 0; i < iNumFactor; ++i) { - dblLognormalPointVolatilityModulus += adblLognormalFactorPointVolatility[i] * - adblLognormalFactorPointVolatility[i]; - dblCrossVolatilityDotProduct += adblLognormalFactorPointVolatility[i] * - adblContinuousForwardVolatility[i]; - dblLIBORVolatilityMultiFactorRandom += adblLognormalFactorPointVolatility[i] * - adblMultivariateRandom[i] * dblAnnualizedIncrementSQRT; - dblContinuousForwardVolatilityModulus += adblContinuousForwardVolatility[i] * - adblContinuousForwardVolatility[i]; - dblForwardVolatilityMultiFactorRandom += adblContinuousForwardVolatility[i] * - adblMultivariateRandom[i] * dblAnnualizedIncrementSQRT; - } - - try { - double dblLIBOR = fc.forward (iTargetPointDate); - - double dblDiscountFactor = dc.df (iTargetPointDate); - - double dblSpotRate = dc.forward (iSpotDate, iSpotDate + 1); - - double dblContinuousForwardRate = fc.forward (iTargetPointDate); - - double dblDCF = org.drip.analytics.support.Helper.TenorToYearFraction (strForwardTenor); - - double dblLIBORDCF = dblDCF * dblLIBOR; - - double dblLIBORIncrement = dblAnnualizedIncrement * (forwardDerivative (fc, iTargetPointDate) + - dblLIBOR * dblCrossVolatilityDotProduct + (dblLognormalPointVolatilityModulus * dblLIBOR * - dblLIBORDCF / (1. + dblLIBORDCF))) + dblLIBOR * dblLIBORVolatilityMultiFactorRandom; - - double dblDiscountFactorIncrement = dblDiscountFactor * (dblSpotRate - dblContinuousForwardRate) - * dblAnnualizedIncrement - dblForwardVolatilityMultiFactorRandom; - - double dblContinuousForwardRateIncrement = continuousForwardRateIncrement (iTargetPointDate, - dblAnnualizedIncrement, dblAnnualizedIncrementSQRT, fc, adblMultivariateRandom, llv); - - double dblSpotRateIncrement = spotRateIncrement (iTargetPointDate, dblAnnualizedIncrement, - dblAnnualizedIncrementSQRT, dc, adblMultivariateRandom, llv); - - double dblContinuousForwardRateEvolved = dblContinuousForwardRate + - dblContinuousForwardRateIncrement; - - return new org.drip.dynamics.lmm.BGMForwardTenorSnap (iTargetPointDate, dblLIBOR + - dblLIBORIncrement, dblLIBORIncrement, dblDiscountFactor + dblDiscountFactorIncrement, - dblDiscountFactorIncrement, dblContinuousForwardRateIncrement, dblSpotRateIncrement, - java.lang.Math.exp (dblContinuousForwardRateEvolved) - 1., (java.lang.Math.exp - (dblDCF * dblContinuousForwardRateEvolved) - 1.) / dblDCF, java.lang.Math.sqrt - (dblLognormalPointVolatilityModulus), java.lang.Math.sqrt - (dblContinuousForwardVolatilityModulus)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private org.drip.dynamics.lmm.PathwiseQMRealization simulateLIBOR ( - final int iEvolutionDate, - final int iViewDate, - final double dblAnnualizedIncrement, - final double dblAnnualizedIncrementSQRT, - final org.drip.state.forward.ForwardCurve fc, - final java.lang.String strForwardTenor, - final double dblForwardDCF, - final org.drip.dynamics.lmm.LognormalLIBORVolatility llv) - { - int[] aiTenorDate = new int[_iNumForwardTenor + 1]; - double[] adblLIBOR = new double[_iNumForwardTenor + 1]; - - double[] adblMultivariateRandom = llv.msg().random(); - - org.drip.analytics.date.JulianDate dtTargetPoint = new org.drip.analytics.date.JulianDate - (iViewDate); - - try { - for (int i = 0; i <= _iNumForwardTenor; ++i) { - int iTargetPointDate = dtTargetPoint.julian(); - - double[] adblLognormalFactorPointVolatility = llv.factorPointVolatility (iEvolutionDate, - iTargetPointDate); - - double[] adblContinuousForwardVolatility = llv.continuousForwardVolatility (iTargetPointDate, - fc); - - double dblLIBOR = fc.forward (iTargetPointDate); - - aiTenorDate[i] = iTargetPointDate; - double dblCrossVolatilityDotProduct = 0.; - double dblLIBORDCF = dblForwardDCF * dblLIBOR; - double dblLognormalPointVolatilityModulus = 0.; - double dblLIBORVolatilityMultiFactorRandom = 0.; - int iNumFactor = adblLognormalFactorPointVolatility.length; - - for (int j = 0; j < iNumFactor; ++j) { - dblLognormalPointVolatilityModulus += adblLognormalFactorPointVolatility[j] * - adblLognormalFactorPointVolatility[j]; - dblCrossVolatilityDotProduct += adblLognormalFactorPointVolatility[j] * - adblContinuousForwardVolatility[j]; - dblLIBORVolatilityMultiFactorRandom += adblLognormalFactorPointVolatility[j] * - adblMultivariateRandom[j] * dblAnnualizedIncrementSQRT; - } - - adblLIBOR[i] = dblLIBOR + dblAnnualizedIncrement * (forwardDerivative (fc, iTargetPointDate) - + dblLIBOR * dblCrossVolatilityDotProduct + (dblLognormalPointVolatilityModulus * - dblLIBOR * dblLIBORDCF / (1. + dblLIBORDCF))) + dblLIBOR * - dblLIBORVolatilityMultiFactorRandom; - - dtTargetPoint = dtTargetPoint.addTenor (strForwardTenor); - } - - return new org.drip.dynamics.lmm.PathwiseQMRealization (aiTenorDate, adblLIBOR); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * LognormalLIBORCurveEvolver Constructor - * - * @param lslFunding The Funding Latent State Label - * @param lslForward The Forward Latent State Label - * @param iNumForwardTenor Number of Forward Tenors to Build the Span - * @param scbcLIBOR LIBOR Span Segment Custom Builder Control Instance - * @param scbcDiscountFactor Discount Factor Span Segment Custom Builder Control Instance - * @param scbcLIBORIncrement LIBOR Increment Span Segment Custom Builder Control Instance - * @param scbcDiscountFactorIncrement Discount Factor Increment Span Segment Custom Builder Control - * Instance - * @param scbcContinuousForwardIncrement Instantaneous Continuously Compounded Forward Rate Increment - * Span Segment Custom Builder Control Instance - * @param scbcSpotRateIncrement Spot Rate Increment Span Segment Custom Builder Control Instance - * @param scbcInstantaneousEffectiveForward Instantaneous Effective Annual Forward Rate Span Segment - * Custom Builder Control Instance - * @param scbcInstantaneousNominalForward Instantaneous Nominal Annual Forward Rate Span Segment Custom - * Builder Control Instance - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public LognormalLIBORCurveEvolver ( - final org.drip.state.identifier.FundingLabel lslFunding, - final org.drip.state.identifier.ForwardLabel lslForward, - final int iNumForwardTenor, - final org.drip.spline.params.SegmentCustomBuilderControl scbcLIBOR, - final org.drip.spline.params.SegmentCustomBuilderControl scbcDiscountFactor, - final org.drip.spline.params.SegmentCustomBuilderControl scbcLIBORIncrement, - final org.drip.spline.params.SegmentCustomBuilderControl scbcDiscountFactorIncrement, - final org.drip.spline.params.SegmentCustomBuilderControl scbcContinuousForwardIncrement, - final org.drip.spline.params.SegmentCustomBuilderControl scbcSpotRateIncrement, - final org.drip.spline.params.SegmentCustomBuilderControl scbcInstantaneousEffectiveForward, - final org.drip.spline.params.SegmentCustomBuilderControl scbcInstantaneousNominalForward) - throws java.lang.Exception - { - if (null == (_lslFunding = lslFunding) || null == (_lslForward = lslForward) || 1 >= - (_iNumForwardTenor = iNumForwardTenor) || null == scbcLIBOR || null == scbcLIBORIncrement || null - == scbcDiscountFactor || null == scbcDiscountFactorIncrement || null == - scbcContinuousForwardIncrement || null == scbcSpotRateIncrement || null == - scbcInstantaneousEffectiveForward) - throw new java.lang.Exception ("LognormalLIBORCurveEvolver ctr: Invalid Inputs"); - - _aSCBCLIBOR = new org.drip.spline.params.SegmentCustomBuilderControl[iNumForwardTenor]; - _aSCBCDiscountFactor = new org.drip.spline.params.SegmentCustomBuilderControl[iNumForwardTenor]; - _aSCBCLIBORIncrement = new org.drip.spline.params.SegmentCustomBuilderControl[iNumForwardTenor]; - _aSCBCDiscountFactorIncrement = new - org.drip.spline.params.SegmentCustomBuilderControl[iNumForwardTenor]; - _aSCBCContinuousForwardIncrement = new - org.drip.spline.params.SegmentCustomBuilderControl[iNumForwardTenor]; - _aSCBCSpotRateIncrement = new org.drip.spline.params.SegmentCustomBuilderControl[iNumForwardTenor]; - _aSCBCInstantaneousNominalForward = new - org.drip.spline.params.SegmentCustomBuilderControl[iNumForwardTenor]; - _aSCBCInstantaneousEffectiveForward = new - org.drip.spline.params.SegmentCustomBuilderControl[iNumForwardTenor]; - - for (int i = 0; i < iNumForwardTenor; ++i) { - _aSCBCLIBOR[i] = scbcLIBOR; - _aSCBCDiscountFactor[i] = scbcDiscountFactor; - _aSCBCLIBORIncrement[i] = scbcLIBORIncrement; - _aSCBCDiscountFactorIncrement[i] = scbcDiscountFactorIncrement; - _aSCBCContinuousForwardIncrement[i] = scbcContinuousForwardIncrement; - _aSCBCSpotRateIncrement[i] = scbcSpotRateIncrement; - _aSCBCInstantaneousEffectiveForward[i] = scbcInstantaneousEffectiveForward; - _aSCBCInstantaneousNominalForward[i] = scbcInstantaneousNominalForward; - } - } - - /** - * Retrieve the Funding Label - * - * @return The Funding Label - */ - - public org.drip.state.identifier.FundingLabel fundingLabel() - { - return _lslFunding; - } - - /** - * Retrieve the Forward Label - * - * @return The Forward Label - */ - - public org.drip.state.identifier.ForwardLabel forwardLabel() - { - return _lslForward; - } - - /** - * Retrieve the Number of Forward Tenors comprising the Span Tenor - * - * @return Number of Forward Tenors comprising the Span Tenor - */ - - public int spanTenor() - { - return _iNumForwardTenor; - } - - /** - * Retrieve the LIBOR Curve Segment Custom Builder Control Instance - * - * @return The LIBOR Curve Segment Custom Builder Control Instance - */ - - public org.drip.spline.params.SegmentCustomBuilderControl scbcLIBOR() - { - return _aSCBCLIBOR[0]; - } - - /** - * Retrieve the Discount Factor Segment Custom Builder Control Instance - * - * @return The Discount Factor Segment Custom Builder Control Instance - */ - - public org.drip.spline.params.SegmentCustomBuilderControl scbcDiscountFactor() - { - return _aSCBCDiscountFactor[0]; - } - - /** - * Retrieve the LIBOR Increment Segment Custom Builder Control Instance - * - * @return The LIBOR Increment Segment Custom Builder Control Instance - */ - - public org.drip.spline.params.SegmentCustomBuilderControl scbcLIBORIncrement() - { - return _aSCBCLIBORIncrement[0]; - } - - /** - * Retrieve the Discount Factor Increment Segment Custom Builder Control Instance - * - * @return The Discount Factor Increment Segment Custom Builder Control Instance - */ - - public org.drip.spline.params.SegmentCustomBuilderControl scbcDiscountFactorIncrement() - { - return _aSCBCDiscountFactorIncrement[0]; - } - - /** - * Retrieve the Instantaneous Continuously Compounded Forward Rate Increment Segment Custom Builder - * Control Instance - * - * @return The Instantaneous Continuously Compounded Forward Rate Increment Segment Custom Builder - * Control Instance - */ - - public org.drip.spline.params.SegmentCustomBuilderControl scbcContinuousForwardIncrement() - { - return _aSCBCContinuousForwardIncrement[0]; - } - - /** - * Retrieve the Spot Rate Increment Segment Custom Builder Control Instance - * - * @return The Spot Rate Increment Segment Custom Builder Control Instance - */ - - public org.drip.spline.params.SegmentCustomBuilderControl scbcSpotRateIncrement() - { - return _aSCBCSpotRateIncrement[0]; - } - - /** - * Retrieve the Instantaneous Effective Annual Forward Rate Increment Segment Custom Builder Control - * Instance - * - * @return The Instantaneous Effective Annual Forward Rate Increment Segment Custom Builder Control - * Instance - */ - - public org.drip.spline.params.SegmentCustomBuilderControl scbcInstantaneousEffectiveForward() - { - return _aSCBCInstantaneousEffectiveForward[0]; - } - - /** - * Retrieve the Instantaneous Nominal Annual Forward Rate Increment Segment Custom Builder Control - * Instance - * - * @return The Instantaneous Nominal Annual Forward Rate Increment Segment Custom Builder Control - * Instance - */ - - public org.drip.spline.params.SegmentCustomBuilderControl scbcInstantaneousNominalForward() - { - return _aSCBCInstantaneousNominalForward[0]; - } - - @Override public org.drip.dynamics.lmm.BGMCurveUpdate evolve ( - final int iSpotDate, - final int iViewDate, - final int iSpotTimeIncrement, - final org.drip.dynamics.evolution.LSQMCurveUpdate lsqmPrev) - { - if (iSpotDate > iViewDate || null == lsqmPrev || !(lsqmPrev instanceof - org.drip.dynamics.lmm.BGMCurveUpdate)) - return null; - - org.drip.dynamics.lmm.BGMCurveUpdate bgmPrev = (org.drip.dynamics.lmm.BGMCurveUpdate) lsqmPrev; - org.drip.dynamics.lmm.BGMForwardTenorSnap[] aBGMTS = new - org.drip.dynamics.lmm.BGMForwardTenorSnap[_iNumForwardTenor + 1]; - double dblAnnualizedIncrement = 1. * iSpotTimeIncrement / 365.25; - - double dblAnnualizedIncrementSQRT = java.lang.Math.sqrt (dblAnnualizedIncrement); - - org.drip.state.forward.ForwardCurve fc = bgmPrev.forwardCurve(); - - org.drip.state.discount.MergedDiscountForwardCurve dc = bgmPrev.discountCurve(); - - org.drip.dynamics.lmm.LognormalLIBORVolatility llv = bgmPrev.lognormalLIBORVolatility(); - - java.lang.String strForwardTenor = _lslForward.tenor(); - - org.drip.analytics.date.JulianDate dtTargetPoint = new org.drip.analytics.date.JulianDate - (iViewDate); - - try { - for (int i = 0; i <= _iNumForwardTenor; ++i) { - if (null == (aBGMTS[i] = timeSnap (iSpotDate, dtTargetPoint.julian(), iSpotTimeIncrement, - dblAnnualizedIncrementSQRT, strForwardTenor, fc, dc, llv)) || null == (dtTargetPoint = - dtTargetPoint.addTenor (strForwardTenor))) - return null; - } - - org.drip.dynamics.lmm.BGMTenorNodeSequence btns = new org.drip.dynamics.lmm.BGMTenorNodeSequence - (aBGMTS); - - org.drip.spline.stretch.BoundarySettings bs = - org.drip.spline.stretch.BoundarySettings.NaturalStandard(); - - java.lang.String strForwardLabelName = _lslForward.fullyQualifiedName(); - - java.lang.String strFundingLabelName = _lslFunding.fullyQualifiedName(); - - int[] aiTenorDate = btns.dates(); - - org.drip.state.curve.BasisSplineForwardRate fcLIBOR = new - org.drip.state.curve.BasisSplineForwardRate (_lslForward, new - org.drip.spline.grid.OverlappingStretchSpan - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - (strForwardLabelName + "_QM_LIBOR", aiTenorDate, btns.liborRates(), _aSCBCLIBOR, - null, bs, org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE))); - - org.drip.state.curve.DiscountFactorDiscountCurve dcDiscountFactor = new - org.drip.state.curve.DiscountFactorDiscountCurve (_lslForward.currency(), new - org.drip.spline.grid.OverlappingStretchSpan - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - (strFundingLabelName + "_QM_DISCOUNTFACTOR", aiTenorDate, btns.discountFactors(), - _aSCBCDiscountFactor, null, bs, - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE))); - - org.drip.spline.stretch.MultiSegmentSequence mssDiscountFactorIncrement = - org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - (strFundingLabelName + "_INCREMENT", aiTenorDate, btns.discountFactorIncrements(), - _aSCBCDiscountFactorIncrement, null, bs, - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE); - - org.drip.spline.stretch.MultiSegmentSequence mssContinuousForwardRateIncrement = - org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - (strForwardLabelName + "_CONT_FWD_INCREMENT", aiTenorDate, - btns.continuousForwardRateIncrements(), _aSCBCContinuousForwardIncrement, null, bs, - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE); - - org.drip.spline.stretch.MultiSegmentSequence mssSpotRateIncrement = - org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - (strForwardLabelName + "_SPOT_RATE_INCREMENT", aiTenorDate, btns.spotRateIncrements(), - _aSCBCSpotRateIncrement, null, bs, - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE); - - org.drip.spline.stretch.MultiSegmentSequence mssInstantaneousEffectiveForwardRate = - org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - (strForwardLabelName + "_EFFECTIVE_ANNUAL_FORWARD", aiTenorDate, - btns.instantaneousEffectiveForwardRates(), _aSCBCInstantaneousEffectiveForward, null, - bs, org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE); - - org.drip.spline.stretch.MultiSegmentSequence mssInstantaneousNominalForwardRate = - org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - (strForwardLabelName + "_NOMINAL_ANNUAL_FORWARD", aiTenorDate, - btns.instantaneousNominalForwardRates(), _aSCBCInstantaneousNominalForward, null, bs, - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE); - - return org.drip.dynamics.lmm.BGMCurveUpdate.Create (_lslFunding, _lslForward, iSpotDate, - iSpotDate + iSpotTimeIncrement, fcLIBOR, new org.drip.spline.grid.OverlappingStretchSpan - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - (strForwardLabelName + "_INCREMENT", aiTenorDate, btns.liborRateIncrements(), - _aSCBCLIBORIncrement, null, bs, - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE)), dcDiscountFactor, - new org.drip.spline.grid.OverlappingStretchSpan - (mssDiscountFactorIncrement), new - org.drip.spline.grid.OverlappingStretchSpan - (mssContinuousForwardRateIncrement), new - org.drip.spline.grid.OverlappingStretchSpan - (mssSpotRateIncrement), new - org.drip.spline.grid.OverlappingStretchSpan - (mssInstantaneousEffectiveForwardRate), new - org.drip.spline.grid.OverlappingStretchSpan - (mssInstantaneousNominalForwardRate), bgmPrev.lognormalLIBORVolatility()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public double[][] simulatePrincipalMetric ( - final int iEvolutionStartDate, - final int iEvolutionFinishDate, - final int iEvolutionIncrement, - final int iViewDate, - final org.drip.dynamics.evolution.LSQMCurveUpdate lsqmStart, - final int iNumSimulation) - { - if (iEvolutionStartDate > iViewDate || iEvolutionFinishDate <= iEvolutionStartDate || - iEvolutionFinishDate > iViewDate || iEvolutionIncrement <= 0. || null == lsqmStart || !(lsqmStart - instanceof org.drip.dynamics.lmm.BGMCurveUpdate) || 1 >= iNumSimulation) - return null; - - org.drip.dynamics.lmm.BGMCurveUpdate bgmMetrics = (org.drip.dynamics.lmm.BGMCurveUpdate) lsqmStart; - - org.drip.dynamics.lmm.LognormalLIBORVolatility llv = bgmMetrics.lognormalLIBORVolatility(); - - java.lang.String strForwardLabel = _lslForward.fullyQualifiedName() + "_QM_LIBOR"; - - org.drip.state.forward.ForwardCurve fc = bgmMetrics.forwardCurve(); - - java.lang.String strForwardTenor = _lslForward.tenor(); - - int iNumTimeStep = ((iEvolutionFinishDate - iEvolutionStartDate) / iEvolutionIncrement) + 1; - double[][] aadblTenorLIBOR = new double[iNumTimeStep][_iNumForwardTenor + 1]; - double dblAnnualizedIncrement = 1. * iEvolutionIncrement / 365.25; - double dblForwardDCF = java.lang.Double.NaN; - - double dblAnnualizedIncrementSQRT = java.lang.Math.sqrt (dblAnnualizedIncrement); - - org.drip.spline.stretch.BoundarySettings bs = - org.drip.spline.stretch.BoundarySettings.NaturalStandard(); - - try { - dblForwardDCF = org.drip.analytics.support.Helper.TenorToYearFraction (strForwardTenor); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int i = 0 ; i < iNumTimeStep; ++i) { - for (int j = 0 ; j <= _iNumForwardTenor; ++j) - aadblTenorLIBOR[i][j] = 0.; - } - - for (int iSimulationIndex = 0; iSimulationIndex < iNumSimulation; ++iSimulationIndex) { - int iEvolutionTimeIndex = 0; - org.drip.state.forward.ForwardCurve fcLIBOR = fc; - - for (int iEvolutionDate = iEvolutionStartDate; iEvolutionDate <= iEvolutionFinishDate; - iEvolutionDate += iEvolutionIncrement) { - org.drip.dynamics.lmm.PathwiseQMRealization pqmr = simulateLIBOR (iEvolutionDate, iViewDate, - dblAnnualizedIncrement, dblAnnualizedIncrementSQRT, fcLIBOR, strForwardTenor, - dblForwardDCF, llv); - - if (null == pqmr) return null; - - double[] adblSimulatedLIBOR = pqmr.realizedQM(); - - try { - fcLIBOR = new org.drip.state.curve.BasisSplineForwardRate (_lslForward, new - org.drip.spline.grid.OverlappingStretchSpan - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - (strForwardLabel + "_QM_LIBOR", pqmr.targetDate(), adblSimulatedLIBOR, _aSCBCLIBOR, - null, bs, org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int j = 0 ; j <= _iNumForwardTenor; ++j) - aadblTenorLIBOR[iEvolutionTimeIndex][j] += adblSimulatedLIBOR[j]; - - iEvolutionTimeIndex++; - } - } - - for (int i = 0 ; i < iNumTimeStep; ++i) { - for (int j = 0 ; j <= _iNumForwardTenor; ++j) - aadblTenorLIBOR[i][j] /= iNumSimulation; - } - - return aadblTenorLIBOR; - } - - /** - * Construct an Array of Forward Curves that Result from the Simulation - * - * @param iEvolutionStartDate The Start Date of the Simulation - * @param iEvolutionFinishDate The Finish Date of the Simulation - * @param iEvolutionIncrement The Simulation Evolution Increment - * @param iViewDate The Forward View Date - * @param lsqmStart The Initial/Starting LSQM State - * @param iNumSimulation Number of Simulations - * - * @return The Array of Forward Curves that Result from the Simulation - */ - - public org.drip.state.forward.ForwardCurve[] simulateTerminalLatentState ( - final int iEvolutionStartDate, - final int iEvolutionFinishDate, - final int iEvolutionIncrement, - final int iViewDate, - final org.drip.dynamics.evolution.LSQMCurveUpdate lsqmStart, - final int iNumSimulation) - { - if (iEvolutionStartDate > iViewDate || iEvolutionFinishDate <= iEvolutionStartDate || - iEvolutionFinishDate > iViewDate || iEvolutionIncrement <= 0. || null == lsqmStart || !(lsqmStart - instanceof org.drip.dynamics.lmm.BGMCurveUpdate) || 1 >= iNumSimulation) - return null; - - org.drip.dynamics.lmm.BGMCurveUpdate bgmMetrics = (org.drip.dynamics.lmm.BGMCurveUpdate) lsqmStart; - - org.drip.dynamics.lmm.LognormalLIBORVolatility llv = bgmMetrics.lognormalLIBORVolatility(); - - java.lang.String strForwardLabel = _lslForward.fullyQualifiedName() + "_QM_LIBOR"; - - org.drip.state.forward.ForwardCurve fc = bgmMetrics.forwardCurve(); - - java.lang.String strForwardTenor = _lslForward.tenor(); - - org.drip.state.forward.ForwardCurve[] aFCLIBOR = new - org.drip.state.forward.ForwardCurve[iNumSimulation]; - double dblAnnualizedIncrement = 1. * iEvolutionIncrement / 365.25; - double dblForwardDCF = java.lang.Double.NaN; - - double dblAnnualizedIncrementSQRT = java.lang.Math.sqrt (dblAnnualizedIncrement); - - org.drip.spline.stretch.BoundarySettings bs = - org.drip.spline.stretch.BoundarySettings.NaturalStandard(); - - try { - dblForwardDCF = org.drip.analytics.support.Helper.TenorToYearFraction (strForwardTenor); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int iSimulationIndex = 0; iSimulationIndex < iNumSimulation; ++iSimulationIndex) { - System.out.println ("\t\tSimulation #" + (iSimulationIndex + 1)); - - org.drip.state.forward.ForwardCurve fcLIBOR = fc; - - for (int iEvolutionDate = iEvolutionStartDate; iEvolutionDate <= iEvolutionFinishDate; - iEvolutionDate += iEvolutionIncrement) { - org.drip.dynamics.lmm.PathwiseQMRealization pqmr = simulateLIBOR (iEvolutionDate, iViewDate, - dblAnnualizedIncrement, dblAnnualizedIncrementSQRT, fcLIBOR, strForwardTenor, - dblForwardDCF, llv); - - if (null == pqmr) return null; - - try { - fcLIBOR = new org.drip.state.curve.BasisSplineForwardRate (_lslForward, new - org.drip.spline.grid.OverlappingStretchSpan - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - (strForwardLabel + "_QM_LIBOR", pqmr.targetDate(), pqmr.realizedQM(), _aSCBCLIBOR, - null, bs, org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - aFCLIBOR[iSimulationIndex] = fcLIBOR; - } - - return aFCLIBOR; - } -} diff --git a/org/drip/dynamics/lmm/LognormalLIBORPointEvolver.java b/org/drip/dynamics/lmm/LognormalLIBORPointEvolver.java deleted file mode 100644 index 1851b45..0000000 --- a/org/drip/dynamics/lmm/LognormalLIBORPointEvolver.java +++ /dev/null @@ -1,351 +0,0 @@ - -package org.drip.dynamics.lmm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * LognormalLIBORPointEvolver sets up and implements the Multi-Factor No-arbitrage Dynamics of the Point - * Rates State Quantifiers traced from the Evolution of the LIBOR Forward Rate as formulated in: - * - * 1) Goldys, B., M. Musiela, and D. Sondermann (1994): Log-normality of Rates and Term Structure Models, - * The University of New South Wales. - * - * 2) Musiela, M. (1994): Nominal Annual Rates and Log-normal Volatility Structure, The University of New - * South Wales. - * - * 3) Brace, A., D. Gatarek, and M. Musiela (1997): The Market Model of Interest Rate Dynamics, Mathematical - * Finance 7 (2), 127-155. - * - * @author Lakshmi Krishnamurthy - */ - -public class LognormalLIBORPointEvolver implements org.drip.dynamics.evolution.PointStateEvolver { - private org.drip.state.forward.ForwardCurve _fc = null; - private org.drip.state.discount.MergedDiscountForwardCurve _dc = null; - private org.drip.state.identifier.ForwardLabel _lslForward = null; - private org.drip.state.identifier.FundingLabel _lslFunding = null; - private org.drip.dynamics.lmm.LognormalLIBORVolatility _llv = null; - - private double forwardDerivative ( - final int iViewDate) - throws java.lang.Exception - { - org.drip.function.definition.R1ToR1 freR1ToR1 = new org.drip.function.definition.R1ToR1 (null) - { - @Override public double evaluate ( - final double dblDate) - throws java.lang.Exception - { - return _fc.forward ((int) dblDate); - } - }; - - return freR1ToR1.derivative (iViewDate, 1); - } - - private double continuousForwardRateIncrement ( - final int iViewDate, - final double dblAnnualizedIncrement, - final double[] adblMultivariateRandom) - throws java.lang.Exception - { - final int iNumFactor = adblMultivariateRandom.length; - - final double dblSpotTimeIncrementSQRT = java.lang.Math.sqrt (dblAnnualizedIncrement); - - org.drip.function.definition.R1ToR1 continuousForwardRateR1ToR1 = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblDate) - throws java.lang.Exception - { - double dblForwardPointVolatilityModulus = 0.; - double dblPointVolatilityMultifactorRandom = 0.; - - double[] adblContinuousForwardVolatility = _llv.continuousForwardVolatility ((int) dblDate, - _fc); - - if (null != adblContinuousForwardVolatility) { - for (int i = 0; i < iNumFactor; ++i) { - dblForwardPointVolatilityModulus += adblContinuousForwardVolatility[i] * - adblContinuousForwardVolatility[i]; - dblPointVolatilityMultifactorRandom += adblContinuousForwardVolatility[i] * - adblMultivariateRandom[i]; - } - } - - return (_fc.forward ((int) dblDate) + 0.5 * dblForwardPointVolatilityModulus) * - dblAnnualizedIncrement + dblPointVolatilityMultifactorRandom * dblSpotTimeIncrementSQRT; - } - }; - - return continuousForwardRateR1ToR1.derivative (iViewDate, 1); - } - - private double spotRateIncrement ( - final double dblSpotDate, - final double dblViewDate, - final double dblAnnualizedIncrement, - final double[] adblMultivariateRandom) - throws java.lang.Exception - { - final int iNumFactor = adblMultivariateRandom.length; - - final double dblAnnualizedIncrementSQRT = java.lang.Math.sqrt (dblAnnualizedIncrement); - - org.drip.function.definition.R1ToR1 spotRateR1ToR1 = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblDate) - throws java.lang.Exception - { - double dblPointVolatilityMultifactorRandom = 0.; - - double[] adblContinuousForwardVolatility = _llv.continuousForwardVolatility ((int) dblDate, - _fc); - - if (null != adblContinuousForwardVolatility) { - for (int i = 0; i < iNumFactor; ++i) - dblPointVolatilityMultifactorRandom += adblContinuousForwardVolatility[i] * - adblMultivariateRandom[i]; - } - - return _fc.forward ((int) dblDate) * dblAnnualizedIncrement + - dblPointVolatilityMultifactorRandom * dblAnnualizedIncrementSQRT; - } - }; - - return spotRateR1ToR1.derivative (dblViewDate, 1); - } - - /** - * LognormalLIBORPointEvolver Constructor - * - * @param lslFunding The Funding Latent State Label - * @param lslForward The Forward Latent State Label - * @param llv The Log-normal LIBOR Volatility Instance - * @param fc The Forward Curve Instance - * @param dc The Discount Curve Instance - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public LognormalLIBORPointEvolver ( - final org.drip.state.identifier.FundingLabel lslFunding, - final org.drip.state.identifier.ForwardLabel lslForward, - final org.drip.dynamics.lmm.LognormalLIBORVolatility llv, - final org.drip.state.forward.ForwardCurve fc, - final org.drip.state.discount.MergedDiscountForwardCurve dc) - throws java.lang.Exception - { - if (null == (_lslFunding = lslFunding) || null == (_lslForward = lslForward) || null == (_llv = llv) - || null == (_fc = fc) || null == (_dc = dc)) - throw new java.lang.Exception ("LognormalLIBORPointEvolver ctr: Invalid Inputs"); - } - - /** - * Retrieve the Funding Label - * - * @return The Funding Label - */ - - public org.drip.state.identifier.FundingLabel fundingLabel() - { - return _lslFunding; - } - - /** - * Retrieve the Forward Label - * - * @return The Forward Label - */ - - public org.drip.state.identifier.ForwardLabel forwardLabel() - { - return _lslForward; - } - - /** - * Retrieve the Log-normal LIBOR Volatility Instance - * - * @return The Log-normal LIBOR Volatility Instance - */ - - public org.drip.dynamics.lmm.LognormalLIBORVolatility llv() - { - return _llv; - } - - /** - * Retrieve the Forward Curve Instance - * - * @return The Forward Curve Instance - */ - - public org.drip.state.forward.ForwardCurve forwardCurve() - { - return _fc; - } - - /** - * Retrieve the Discount Curve Instance - * - * @return The Discount Curve Instance - */ - - public org.drip.state.discount.MergedDiscountForwardCurve discountCurve() - { - return _dc; - } - - @Override public org.drip.dynamics.lmm.BGMPointUpdate evolve ( - final int iSpotDate, - final int iViewDate, - final int iSpotTimeIncrement, - final org.drip.dynamics.evolution.LSQMPointUpdate lsqmPrev) - { - if (iSpotDate > iViewDate || (null != lsqmPrev && !(lsqmPrev instanceof - org.drip.dynamics.lmm.BGMPointUpdate))) - return null; - - double dblAnnualizedIncrement = 1. * iSpotTimeIncrement / 365.25; - - double dblAnnualizedIncrementSQRT = java.lang.Math.sqrt (dblAnnualizedIncrement); - - double[] adblMultivariateRandom = _llv.msg().random(); - - java.lang.String strTenor = _lslForward.tenor(); - - double dblLIBOR = java.lang.Double.NaN; - double dblSpotRate = java.lang.Double.NaN; - double dblDiscountFactor = java.lang.Double.NaN; - double dblContinuouslyCompoundedForwardRate = java.lang.Double.NaN; - org.drip.dynamics.lmm.BGMPointUpdate bgmPrev = null == lsqmPrev ? null : - (org.drip.dynamics.lmm.BGMPointUpdate) lsqmPrev; - - int iForwardDate = new org.drip.analytics.date.JulianDate (iViewDate).addTenor (strTenor).julian(); - - try { - if (null == bgmPrev) { - dblLIBOR = _fc.forward (iForwardDate); - - dblDiscountFactor = _dc.df (iViewDate); - - dblSpotRate = _dc.forward (iSpotDate, iSpotDate + 1); - - dblContinuouslyCompoundedForwardRate = _dc.forward (iViewDate, iViewDate + 1); - } else { - dblLIBOR = bgmPrev.libor(); - - dblSpotRate = bgmPrev.spotRate(); - - dblDiscountFactor = bgmPrev.discountFactor(); - - dblContinuouslyCompoundedForwardRate = bgmPrev.continuousForwardRate(); - } - - double[] adblLognormalFactorPointVolatility = _llv.factorPointVolatility (iSpotDate, iViewDate); - - double[] adblContinuousForwardVolatility = _llv.continuousForwardVolatility (iViewDate, _fc); - - double dblCrossVolatilityDotProduct = 0.; - double dblLognormalPointVolatilityModulus = 0.; - double dblLIBORVolatilityMultiFactorRandom = 0.; - double dblContinuousForwardVolatilityModulus = 0.; - double dblForwardVolatilityMultiFactorRandom = 0.; - int iNumFactor = adblLognormalFactorPointVolatility.length; - - for (int i = 0; i < iNumFactor; ++i) { - dblLognormalPointVolatilityModulus += adblLognormalFactorPointVolatility[i] * - adblLognormalFactorPointVolatility[i]; - dblCrossVolatilityDotProduct += adblLognormalFactorPointVolatility[i] * - adblContinuousForwardVolatility[i]; - dblLIBORVolatilityMultiFactorRandom += adblLognormalFactorPointVolatility[i] * - adblMultivariateRandom[i] * dblAnnualizedIncrementSQRT; - dblContinuousForwardVolatilityModulus += adblContinuousForwardVolatility[i] * - adblContinuousForwardVolatility[i]; - dblForwardVolatilityMultiFactorRandom += adblContinuousForwardVolatility[i] * - adblMultivariateRandom[i] * dblAnnualizedIncrementSQRT; - } - - double dblDCF = org.drip.analytics.support.Helper.TenorToYearFraction (strTenor); - - double dblLIBORDCF = dblDCF * dblLIBOR; - - double dblLIBORIncrement = dblAnnualizedIncrement * (forwardDerivative (iForwardDate) + dblLIBOR - * dblCrossVolatilityDotProduct + (dblLognormalPointVolatilityModulus * dblLIBOR * dblLIBORDCF - / (1. + dblLIBORDCF))) + dblLIBOR * dblLIBORVolatilityMultiFactorRandom; - - double dblContinuousForwardRateIncrement = continuousForwardRateIncrement (iViewDate, - dblAnnualizedIncrement, adblMultivariateRandom); - - double dblSpotRateIncrement = spotRateIncrement (iSpotDate, iViewDate, dblAnnualizedIncrement, - adblMultivariateRandom); - - double dblEvolvedContinuousForwardRate = dblContinuouslyCompoundedForwardRate + - dblContinuousForwardRateIncrement; - double dblDiscountFactorIncrement = dblDiscountFactor * (dblSpotRate - - dblContinuouslyCompoundedForwardRate) * dblAnnualizedIncrement - - dblForwardVolatilityMultiFactorRandom; - - return org.drip.dynamics.lmm.BGMPointUpdate.Create (_lslFunding, _lslForward, iSpotDate, - iSpotDate + iSpotTimeIncrement, iViewDate, dblLIBOR + dblLIBORIncrement, dblLIBORIncrement, - dblEvolvedContinuousForwardRate, dblContinuousForwardRateIncrement, dblSpotRate + - dblSpotRateIncrement, dblSpotRateIncrement, dblDiscountFactor + - dblDiscountFactorIncrement, dblDiscountFactorIncrement, java.lang.Math.exp - (dblEvolvedContinuousForwardRate) - 1., (java.lang.Math.exp (dblDCF * - dblEvolvedContinuousForwardRate) - 1.) / dblDCF, java.lang.Math.sqrt - (dblLognormalPointVolatilityModulus), java.lang.Math.sqrt - (dblContinuousForwardVolatilityModulus)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/dynamics/lmm/LognormalLIBORVolatility.java b/org/drip/dynamics/lmm/LognormalLIBORVolatility.java deleted file mode 100644 index c691037..0000000 --- a/org/drip/dynamics/lmm/LognormalLIBORVolatility.java +++ /dev/null @@ -1,323 +0,0 @@ - -package org.drip.dynamics.lmm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * LognormalLIBORVolatility implements the Multi-Factor Log-normal LIBOR Volatility as formulated in: - * - * 1) Goldys, B., M. Musiela, and D. Sondermann (1994): Log-normality of Rates and Term Structure Models, - * The University of New South Wales. - * - * 2) Musiela, M. (1994): Nominal Annual Rates and Log-normal Volatility Structure, The University of New - * South Wales. - * - * 3) Brace, A., D. Gatarek, and M. Musiela (1997): The Market Model of Interest Rate Dynamics, Mathematical - * Finance 7 (2), 127-155. - * - * @author Lakshmi Krishnamurthy - */ - -public class LognormalLIBORVolatility extends org.drip.dynamics.hjm.MultiFactorVolatility { - private int _iSpotDate = java.lang.Integer.MIN_VALUE; - private org.drip.state.identifier.ForwardLabel _lslForward = null; - - /** - * LognormalLIBORVolatility Constructor - * - * @param iSpotDate The Spot Date - * @param lslForward The Forward Label - * @param aMSVolatility Array of the Multi-Factor Volatility Surfaces - * @param pfsg Principal Factor Sequence Generator - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public LognormalLIBORVolatility ( - final int iSpotDate, - final org.drip.state.identifier.ForwardLabel lslForward, - final org.drip.analytics.definition.MarketSurface[] aMSVolatility, - final org.drip.sequence.random.PrincipalFactorSequenceGenerator pfsg) - throws java.lang.Exception - { - super (aMSVolatility, pfsg); - - if (null == (_lslForward = lslForward)) - throw new java.lang.Exception ("LognormalLIBORVolatility ctr: Invalid Inputs"); - - _iSpotDate = iSpotDate; - } - - /** - * Retrieve the Spot Date - * - * @return The Spot Date - */ - - public int spotDate() - { - return _iSpotDate; - } - - /** - * Retrieve the Forward Label - * - * @return The Forward Label - */ - - public org.drip.state.identifier.ForwardLabel forwardLabel() - { - return _lslForward; - } - - /** - * Compute the Constraint in the Difference in the Volatility of the Continuously Compounded Forward Rate - * between the Target Date and the Target Date + Forward Tenor - * - * @param fc The Forward Curve Instance - * @param iTargetDate The Target Date - * - * @return The Constraint in the Difference in the Volatility of the Continuously Compounded Forward Rate - */ - - public double[] continuousForwardVolatilityConstraint ( - final org.drip.state.forward.ForwardCurve fc, - final int iTargetDate) - { - if (null == fc || iTargetDate <= _iSpotDate) return null; - - java.lang.String strTenor = _lslForward.tenor(); - - org.drip.analytics.definition.MarketSurface[] aMS = volatilitySurface(); - - try { - double dblLIBORDCF = fc.forward (new org.drip.analytics.date.JulianDate (iTargetDate).addTenor - (strTenor)) * org.drip.analytics.support.Helper.TenorToYearFraction (strTenor); - - int iNumSurface = aMS.length; - double dblConstraintWeight = dblLIBORDCF / (1. + dblLIBORDCF); - double[] adblContinuousForwardVolatilityConstraint = new double[iNumSurface]; - - for (int i = 0; i < iNumSurface; ++i) - adblContinuousForwardVolatilityConstraint[i] = dblConstraintWeight * aMS[i].node (_iSpotDate, - iTargetDate); - - return adblContinuousForwardVolatilityConstraint; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Volatility of the Continuously Compounded Forward Rate Up to the Target Date - * - * @param iTargetDate The Target Date - * @param fc The Forward Curve Instance - * - * @return The Volatility of the Continuously Compounded Forward Rate Up to the Target Date - */ - - public double[] continuousForwardVolatility ( - final int iTargetDate, - final org.drip.state.forward.ForwardCurve fc) - { - if (iTargetDate <= _iSpotDate || null == fc) return null; - - org.drip.sequence.random.PrincipalFactorSequenceGenerator pfsg = msg(); - - int iNumFactor = pfsg.numFactor(); - - boolean bLoop = true; - int iEndDate = _iSpotDate; - double dblTenorDCF = java.lang.Double.NaN; - double[] adblContinuousForwardVolatility = new double[iNumFactor]; - - java.lang.String strTenor = _lslForward.tenor(); - - try { - dblTenorDCF = org.drip.analytics.support.Helper.TenorToYearFraction (strTenor); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int i = 0; i < iNumFactor; ++i) - adblContinuousForwardVolatility[i] = 0.; - - double[] adblFactorPointVolatility = factorPointVolatility (_iSpotDate, iEndDate); - - while (bLoop) { - try { - if ((iEndDate = new org.drip.analytics.date.JulianDate (iEndDate).addTenor - (strTenor).julian()) > iTargetDate) - bLoop = false; - - double dblLIBORTenorDCF = fc.forward (iEndDate) * dblTenorDCF; - - double dblLIBORLognormalVolatilityScaler = dblLIBORTenorDCF / (1. + dblLIBORTenorDCF); - - for (int i = 0; i < iNumFactor; ++i) - adblContinuousForwardVolatility[i] += dblLIBORLognormalVolatilityScaler * - adblFactorPointVolatility[i]; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return adblContinuousForwardVolatility; - } - - /** - * Compute the Volatility of the Continuously Compounded Forward Rate Up to the Target Date - * - * @param iTargetDate The Target Date - * @param dc The Discount Curve Instance - * - * @return The Volatility of the Continuously Compounded Forward Rate Up to the Target Date - */ - - public double[] continuousForwardVolatility ( - final int iTargetDate, - final org.drip.state.discount.MergedDiscountForwardCurve dc) - { - if (iTargetDate <= _iSpotDate || null == dc) return null; - - org.drip.sequence.random.PrincipalFactorSequenceGenerator pfsg = msg(); - - int iNumFactor = pfsg.numFactor(); - - boolean bLoop = true; - int iStartDate = _iSpotDate; - double dblTenorDCF = java.lang.Double.NaN; - double[] adblContinuousForwardVolatility = new double[iNumFactor]; - - java.lang.String strTenor = _lslForward.tenor(); - - try { - dblTenorDCF = org.drip.analytics.support.Helper.TenorToYearFraction (strTenor); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int i = 0; i < iNumFactor; ++i) - adblContinuousForwardVolatility[i] = 0.; - - double[] adblFactorPointVolatility = factorPointVolatility (_iSpotDate, iStartDate); - - while (bLoop) { - try { - double dblLIBORTenorDCF = dc.libor (iStartDate, strTenor) * dblTenorDCF; - - double dblLIBORLognormalVolatilityScaler = dblLIBORTenorDCF / (1. + dblLIBORTenorDCF); - - for (int i = 0; i < iNumFactor; ++i) - adblContinuousForwardVolatility[i] += dblLIBORLognormalVolatilityScaler * - adblFactorPointVolatility[i]; - - if ((iStartDate = new org.drip.analytics.date.JulianDate (iStartDate).addTenor - (strTenor).julian()) > iTargetDate) - bLoop = false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return adblContinuousForwardVolatility; - } - - /** - * Multi-Factor Cross Volatility Integral - * - * @param iForwardDate1 Forward Date #1 - * @param iForwardDate2 Forward Date #2 - * @param iTerminalDate The Terminal Date - * - * @return The Multi-Factor Cross Volatility Integral - * - * @throws java.lang.Exception Thrown if the Multi-Factor Cross Volatility Integral cannot be computed - */ - - public double crossVolatilityIntegralProduct ( - final int iForwardDate1, - final int iForwardDate2, - final int iTerminalDate) - throws java.lang.Exception - { - if (iForwardDate1 < iTerminalDate || iForwardDate2 < iTerminalDate) - throw new java.lang.Exception - ("LognormalLIBORVolatility::crossVolatilityIntegralProduct => Invalid Inputs"); - - org.drip.function.definition.R1ToR1 crossVolR1ToR1 = new org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblDate) - throws java.lang.Exception - { - double dblCrossVolProduct = 0.; - - int iNumFactor = msg().numFactor(); - - for (int iFactorIndex = 0; iFactorIndex < iNumFactor; ++iFactorIndex) - dblCrossVolProduct += factorPointVolatility (iFactorIndex, (int) dblDate, iForwardDate1) - * factorPointVolatility (iFactorIndex, (int) dblDate, iForwardDate2); - - return dblCrossVolProduct; - } - }; - - return crossVolR1ToR1.integrate (_iSpotDate, iTerminalDate); - } -} diff --git a/org/drip/dynamics/lmm/PathwiseQMRealization.java b/org/drip/dynamics/lmm/PathwiseQMRealization.java deleted file mode 100644 index ae2e3c7..0000000 --- a/org/drip/dynamics/lmm/PathwiseQMRealization.java +++ /dev/null @@ -1,110 +0,0 @@ - -package org.drip.dynamics.lmm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * PathwiseQMRealization contains the Sequence of the Simulated Target Point State QM Realizations and their - * corresponding Date Nodes. The formulations for the case of the Forward Rates are in: - * - * 1) Goldys, B., M. Musiela, and D. Sondermann (1994): Log-normality of Rates and Term Structure Models, - * The University of New South Wales. - * - * 2) Musiela, M. (1994): Nominal Annual Rates and Log-normal Volatility Structure, The University of New - * South Wales. - * - * 3) Brace, A., D. Gatarek, and M. Musiela (1997): The Market Model of Interest Rate Dynamics, Mathematical - * Finance 7 (2), 127-155. - * - * @author Lakshmi Krishnamurthy - */ - -public class PathwiseQMRealization { - private int[] _aiTargetDateNode = null; - private double[] _adblPointStateQMRealization = null; - - /** - * PathwiseQMRealization Constructor - * - * @param aiTargetDateNode Array of Target Date Nodes - * @param adblPointStateQMRealization Array of the Realized QM - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public PathwiseQMRealization ( - final int[] aiTargetDateNode, - final double[] adblPointStateQMRealization) - throws java.lang.Exception - { - _aiTargetDateNode = aiTargetDateNode; - _adblPointStateQMRealization = adblPointStateQMRealization; - } - - /** - * Retrieve the Array of the Target Date Nodes - * - * @return Array of the Target Date Nodes - */ - - public int[] targetDate() - { - return _aiTargetDateNode; - } - - /** - * Retrieve the Array of the Realized QM - * - * @return Array of the Realized QM - */ - - public double[] realizedQM() - { - return _adblPointStateQMRealization; - } -} diff --git a/org/drip/dynamics/lmm/ShortRateProcess.java b/org/drip/dynamics/lmm/ShortRateProcess.java deleted file mode 100644 index 465fd57..0000000 --- a/org/drip/dynamics/lmm/ShortRateProcess.java +++ /dev/null @@ -1,132 +0,0 @@ - -package org.drip.dynamics.lmm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ShortRateProcess implements the Short Rate Process defined in the LIBOR Market Model. The References are: - * - * 1) Goldys, B., M. Musiela, and D. Sondermann (1994): Log-normality of Rates and Term Structure Models, - * The University of New South Wales. - * - * 2) Musiela, M. (1994): Nominal Annual Rates and Log-normal Volatility Structure, The University of New - * South Wales. - * - * 3) Brace, A., D. Gatarek, and M. Musiela (1997): The Market Model of Interest Rate Dynamics, Mathematical - * Finance 7 (2), 127-155. - * - * @author Lakshmi Krishnamurthy - */ - -public class ShortRateProcess { - private int _iSpotDate = java.lang.Integer.MIN_VALUE; - private org.drip.measure.stochastic.R1R1ToR1 _funcR1R1ToR1 = null; - - /** - * ShortRateProcess Constructor - * - * @param iSpotDate The Spot Date - * @param funcR1R1ToR1 The Stochastic Short Rate Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ShortRateProcess ( - final int iSpotDate, - final org.drip.measure.stochastic.R1R1ToR1 funcR1R1ToR1) - throws java.lang.Exception - { - if (null == (_funcR1R1ToR1 = funcR1R1ToR1)) - throw new java.lang.Exception ("ShortRateProcess ctr: Invalid Inputs"); - - _iSpotDate = iSpotDate; - } - - /** - * Retrieve the Spot Date - * - * @return The Spot Date - */ - - public int spotDate() - { - return _iSpotDate; - } - - /** - * Retrieve the Stochastic Short Rate Function - * - * @return The Stochastic Short Rate Function - */ - - public org.drip.measure.stochastic.R1R1ToR1 stochasticShortRateFunction() - { - return _funcR1R1ToR1; - } - - /** - * Retrieve the Continuously Re-invested Accruing Bank Account - * - * @param iMaturityDate The Maturity Date - * - * @return The Continuously Re-invested Accruing Bank Account - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double continuouslyReinvestedAccrualFactor ( - final int iMaturityDate) - throws java.lang.Exception - { - if (iMaturityDate <= _iSpotDate) - throw new java.lang.Exception - ("ShortRateProcess::continuouslyReinvestedAccrualFactor => Invalid Maturity Date"); - - return java.lang.Math.exp (_funcR1R1ToR1.integralRealization (0., iMaturityDate - _iSpotDate)); - } -} diff --git a/org/drip/dynamics/sabr/ForwardRateUpdate.java b/org/drip/dynamics/sabr/ForwardRateUpdate.java deleted file mode 100644 index 7e1f143..0000000 --- a/org/drip/dynamics/sabr/ForwardRateUpdate.java +++ /dev/null @@ -1,198 +0,0 @@ - -package org.drip.dynamics.sabr; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - * - * DRIP is a free, full featured, fixed income rates, credit, and FX analytics library with a focus towards - * pricing/valuation, risk, and market making. - * - * 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. - */ - -/** - * ForwardRateUpdate contains the Increment and Snapshot of the Forward Rate Latent State evolved through - * the SABR Dynamics. - * - * @author Lakshmi Krishnamurthy - */ - -public class ForwardRateUpdate extends org.drip.dynamics.evolution.LSQMPointUpdate { - private org.drip.state.identifier.ForwardLabel _lslForward = null; - - /** - * ForwardRateUpdate Creator - * - * @param lslForward The Forward Rate Latent State Label - * @param iInitialDate The Initial Date - * @param iFinalDate The Final Date - * @param iTargetPointDate The Target Point Date - * @param dblForwardRate The Forward Rate - * @param dblForwardRateIncrement The Forward Rate Increment - * @param dblForwardRateVolatility The Forward Volatility - * @param dblForwardRateVolatilityIncrement The Forward Volatility Rate - * - * @return Instance of ForwardRateUpdate - */ - - public static final ForwardRateUpdate Create ( - final org.drip.state.identifier.ForwardLabel lslForward, - final int iInitialDate, - final int iFinalDate, - final int iTargetPointDate, - final double dblForwardRate, - final double dblForwardRateIncrement, - final double dblForwardRateVolatility, - final double dblForwardRateVolatilityIncrement) - { - org.drip.dynamics.evolution.LSQMPointRecord lrSnapshot = new - org.drip.dynamics.evolution.LSQMPointRecord(); - - if (!lrSnapshot.setQM (lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_FORWARD_RATE, dblForwardRate)) - return null; - - if (!lrSnapshot.setQM (org.drip.state.identifier.VolatilityLabel.Standard (lslForward), - org.drip.analytics.definition.LatentStateStatic.VOLATILITY_QM_SABR_VOLATILITY, - dblForwardRateVolatility)) - return null; - - org.drip.dynamics.evolution.LSQMPointRecord lrIncrement = new - org.drip.dynamics.evolution.LSQMPointRecord(); - - if (!lrIncrement.setQM (lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_FORWARD_RATE, - dblForwardRateIncrement)) - return null; - - if (!lrIncrement.setQM (org.drip.state.identifier.VolatilityLabel.Standard (lslForward), - org.drip.analytics.definition.LatentStateStatic.VOLATILITY_QM_SABR_VOLATILITY, - dblForwardRateVolatilityIncrement)) - return null; - - try { - return new ForwardRateUpdate (lslForward, iInitialDate, iFinalDate, iTargetPointDate, lrSnapshot, - lrIncrement); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private ForwardRateUpdate ( - final org.drip.state.identifier.ForwardLabel lslForward, - final int iInitialDate, - final int iFinalDate, - final int iViewDate, - final org.drip.dynamics.evolution.LSQMPointRecord lrSnapshot, - final org.drip.dynamics.evolution.LSQMPointRecord lrIncrement) - throws java.lang.Exception - { - super (iInitialDate, iFinalDate, iViewDate, lrSnapshot, lrIncrement); - - if (null == (_lslForward = lslForward)) - throw new java.lang.Exception ("ForwardRateUpdate ctr: Invalid Inputs"); - } - - /** - * Retrieve the Forward Rate - * - * @return The Forward Rate - * - * @throws java.lang.Exception Thrown if the Forward Rate is not available - */ - - public double forwardRate() - throws java.lang.Exception - { - return snapshot().qm (_lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_FORWARD_RATE); - } - - /** - * Retrieve the Forward Rate Increment - * - * @return The Forward Rate Increment - * - * @throws java.lang.Exception Thrown if the Forward Rate Increment is not available - */ - - public double forwardRateIncrement() - throws java.lang.Exception - { - return increment().qm (_lslForward, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_FORWARD_RATE); - } - - /** - * Retrieve the Forward Rate Volatility - * - * @return The Forward Rate Volatility - * - * @throws java.lang.Exception Thrown if the Forward Rate Volatility is not available - */ - - public double forwardRateVolatility() - throws java.lang.Exception - { - return snapshot().qm (org.drip.state.identifier.VolatilityLabel.Standard (_lslForward), - org.drip.analytics.definition.LatentStateStatic.VOLATILITY_QM_SABR_VOLATILITY); - } - - /** - * Retrieve the Forward Rate Volatility Increment - * - * @return The Forward Rate Volatility Increment - * - * @throws java.lang.Exception Thrown if the Forward Rate Volatility Increment is not available - */ - - public double forwardRateVolatilityIncrement() - throws java.lang.Exception - { - return increment().qm (org.drip.state.identifier.VolatilityLabel.Standard (_lslForward), - org.drip.analytics.definition.LatentStateStatic.VOLATILITY_QM_SABR_VOLATILITY); - } -} diff --git a/org/drip/dynamics/sabr/ImpliedBlackVolatility.java b/org/drip/dynamics/sabr/ImpliedBlackVolatility.java deleted file mode 100644 index 80ae79a..0000000 --- a/org/drip/dynamics/sabr/ImpliedBlackVolatility.java +++ /dev/null @@ -1,195 +0,0 @@ - -package org.drip.dynamics.sabr; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - * - * DRIP is a free, full featured, fixed income rates, credit, and FX analytics library with a focus towards - * pricing/valuation, risk, and market making. - * - * 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. - */ - -/** - * ImpliedBlackVolatility contains the Output of the Black Volatility Implication Calculations. - * - * @author Lakshmi Krishnamurthy - */ - -public class ImpliedBlackVolatility { - private double _dblA = java.lang.Double.NaN; - private double _dblB = java.lang.Double.NaN; - private double _dblZ = java.lang.Double.NaN; - private double _dblTTE = java.lang.Double.NaN; - private double _dblChiZ = java.lang.Double.NaN; - private double _dblStrike = java.lang.Double.NaN; - private double _dblATMForwardRate = java.lang.Double.NaN; - private double _dblImpliedVolatility = java.lang.Double.NaN; - - /** - * ImpliedBlackVolatility Constructor - * - * @param dblStrike Strike - * @param dblATMForwardRate Forward Rate - * @param dblTTE Time To Expiry - * @param dblA A - * @param dblZ Z - * @param dblChiZ Chi (Z) - * @param dblB B - * @param dblImpliedVolatility The Implied Volatility - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public ImpliedBlackVolatility ( - final double dblStrike, - final double dblATMForwardRate, - final double dblTTE, - final double dblA, - final double dblZ, - final double dblChiZ, - final double dblB, - final double dblImpliedVolatility) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblStrike = dblStrike) || - !org.drip.quant.common.NumberUtil.IsValid (_dblATMForwardRate = dblATMForwardRate) || - !org.drip.quant.common.NumberUtil.IsValid (_dblTTE = dblTTE) || - !org.drip.quant.common.NumberUtil.IsValid (_dblA = dblA) || - !org.drip.quant.common.NumberUtil.IsValid (_dblZ = dblZ) || - !org.drip.quant.common.NumberUtil.IsValid (_dblChiZ = dblChiZ) || - !org.drip.quant.common.NumberUtil.IsValid (_dblB = dblB) || - !org.drip.quant.common.NumberUtil.IsValid (_dblImpliedVolatility = - dblImpliedVolatility)) - throw new java.lang.Exception ("ImpliedBlackVolatility ctr: Invalid Inputs"); - } - - /** - * Retrieve the Strike - * - * @return The Strike - */ - - public double strike() - { - return _dblStrike; - } - - /** - * Retrieve the ATM Forward Rate - * - * @return The ATM Forward Rate - */ - - public double atmForwardRate() - { - return _dblATMForwardRate; - } - - /** - * Retrieve TTE - * - * @return TTE - */ - - public double tte() - { - return _dblTTE; - } - - /** - * Retrieve A - * - * @return A - */ - - public double a() - { - return _dblA; - } - - /** - * Retrieve Z - * - * @return Z - */ - - public double z() - { - return _dblZ; - } - - /** - * Retrieve Chi - * - * @return Chi - */ - - public double chi() - { - return _dblChiZ; - } - - /** - * Retrieve B - * - * @return B - */ - - public double b() - { - return _dblB; - } - - /** - * Retrieve the Implied Volatility - * - * @return The Implied Volatility - */ - - public double impliedVolatility() - { - return _dblImpliedVolatility; - } -} diff --git a/org/drip/dynamics/sabr/StochasticVolatilityStateEvolver.java b/org/drip/dynamics/sabr/StochasticVolatilityStateEvolver.java deleted file mode 100644 index 757f3be..0000000 --- a/org/drip/dynamics/sabr/StochasticVolatilityStateEvolver.java +++ /dev/null @@ -1,388 +0,0 @@ - -package org.drip.dynamics.sabr; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * StochasticVolatilityStateEvolver provides the SABR Stochastic Volatility Evolution Dynamics. - * - * @author Lakshmi Krishnamurthy - */ - -public class StochasticVolatilityStateEvolver implements org.drip.dynamics.evolution.PointStateEvolver { - private double _dblRho = java.lang.Double.NaN; - private double _dblBeta = java.lang.Double.NaN; - private double _dblIdiosyncraticRho = java.lang.Double.NaN; - private double _dblVolatilityOfVolatility = java.lang.Double.NaN; - private org.drip.state.identifier.ForwardLabel _lslForward = null; - private org.drip.sequence.random.UnivariateSequenceGenerator _usgForwardRate = null; - private org.drip.sequence.random.UnivariateSequenceGenerator _usgForwardRateVolatilityIdiosyncratic = - null; - - /** - * Create a Gaussian SABR Instance - * - * @param lslForward The Forward Rate Latent State Label - * @param dblRho SABR Rho - * @param dblVolatilityOfVolatility SABR Volatility Of Volatility - * @param usgForwardRate The Forward Rate Univariate Sequence Generator - * @param usgForwardRateVolatilityIdiosyncratic The Idiosyncratic Component Forward Rate Volatility - * Univariate Sequence Generator - * - * @return The Gaussian SABR Instance - */ - - public static final StochasticVolatilityStateEvolver Gaussian ( - final org.drip.state.identifier.ForwardLabel lslForward, - final double dblRho, - final double dblVolatilityOfVolatility, - final org.drip.sequence.random.UnivariateSequenceGenerator usgForwardRate, - final org.drip.sequence.random.UnivariateSequenceGenerator usgForwardRateVolatilityIdiosyncratic) - { - try { - return new StochasticVolatilityStateEvolver (lslForward, 0., dblRho, dblVolatilityOfVolatility, - usgForwardRate, usgForwardRateVolatilityIdiosyncratic); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create a Log-normal SABR Instance - * - * @param lslForward The Forward Rate Latent State Label - * @param dblRho SABR Rho - * @param dblVolatilityOfVolatility SABR Volatility Of Volatility - * @param usgForwardRate The Forward Rate Univariate Sequence Generator - * @param usgForwardRateVolatilityIdiosyncratic The Idiosyncratic Component Forward Rate Volatility - * Univariate Sequence Generator - * - * @return The Log-normal SABR Instance - */ - - public static final StochasticVolatilityStateEvolver Lognormal ( - final org.drip.state.identifier.ForwardLabel lslForward, - final double dblRho, - final double dblVolatilityOfVolatility, - final org.drip.sequence.random.UnivariateSequenceGenerator usgForwardRate, - final org.drip.sequence.random.UnivariateSequenceGenerator usgForwardRateVolatilityIdiosyncratic) - { - try { - return new StochasticVolatilityStateEvolver (lslForward, 1., dblRho, dblVolatilityOfVolatility, - usgForwardRate, usgForwardRateVolatilityIdiosyncratic); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create a Constant Elasticity of Variance SABR Instance - * - * @param lslForward The Forward Rate Latent State Label - * @param dblBeta SABR Beta - * @param dblRho SABR Rho - * @param usgForwardRate The Forward Rate Univariate Sequence Generator - * @param usgForwardRateVolatilityIdiosyncratic The Idiosyncratic Component Forward Rate Volatility - * Univariate Sequence Generator - * - * @return The Constant Elasticity of Variance SABR Instance - */ - - public static final StochasticVolatilityStateEvolver CEV ( - final org.drip.state.identifier.ForwardLabel lslForward, - final double dblBeta, - final double dblRho, - final org.drip.sequence.random.UnivariateSequenceGenerator usgForwardRate, - final org.drip.sequence.random.UnivariateSequenceGenerator usgForwardRateVolatilityIdiosyncratic) - { - try { - return new StochasticVolatilityStateEvolver (lslForward, dblBeta, dblRho, 0., usgForwardRate, - usgForwardRateVolatilityIdiosyncratic); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * StochasticVolatilityStateEvolver Constructor - * - * @param lslForward The Forward Rate Latent State Label - * @param dblBeta SABR Beta - * @param dblRho SABR Rho - * @param dblVolatilityOfVolatility SABR Volatility Of Volatility - * @param usgForwardRate The Forward Rate Univariate Sequence Generator - * @param usgForwardRateVolatilityIdiosyncratic The Idiosyncratic Component Forward Rate Volatility - * Univariate Sequence Generator - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public StochasticVolatilityStateEvolver ( - final org.drip.state.identifier.ForwardLabel lslForward, - final double dblBeta, - final double dblRho, - final double dblVolatilityOfVolatility, - final org.drip.sequence.random.UnivariateSequenceGenerator usgForwardRate, - final org.drip.sequence.random.UnivariateSequenceGenerator usgForwardRateVolatilityIdiosyncratic) - throws java.lang.Exception - { - if (null == (_lslForward = lslForward) || !org.drip.quant.common.NumberUtil.IsValid (_dblBeta = - dblBeta) || !org.drip.quant.common.NumberUtil.IsValid (_dblRho = dblRho) || _dblRho < -1. || - _dblRho > 1. || !org.drip.quant.common.NumberUtil.IsValid (_dblVolatilityOfVolatility = - dblVolatilityOfVolatility) || null == (_usgForwardRate = usgForwardRate) || (0. != - _dblVolatilityOfVolatility && null == (_usgForwardRateVolatilityIdiosyncratic = - usgForwardRateVolatilityIdiosyncratic))) - throw new java.lang.Exception ("StochasticVolatilityStateEvolver ctr => Invalid Inputs"); - - _dblIdiosyncraticRho = java.lang.Math.sqrt (1. - _dblRho * _dblRho); - } - - /** - * Retrieve the Forward Label - * - * @return The Forward Label - */ - - public org.drip.state.identifier.ForwardLabel forwardLabel() - { - return _lslForward; - } - - /** - * Retrieve SABR Volatility of Volatility - * - * @return SABR Volatility of Volatility - */ - - public double volatilityOfVolatility() - { - return _dblVolatilityOfVolatility; - } - - /** - * Retrieve SABR Beta - * - * @return SABR Beta - */ - - public double beta() - { - return _dblBeta; - } - - /** - * Retrieve SABR Rho - * - * @return SABR Rho - */ - - public double rho() - { - return _dblRho; - } - - /** - * The Forward Rate Univariate Random Variable Generator Sequence - * - * @return The Forward Rate Univariate Random Variable Generator Sequence - */ - - public org.drip.sequence.random.UnivariateSequenceGenerator usgForwardRate() - { - return _usgForwardRate; - } - - /** - * The Idiosyncratic Component of Forward Rate Volatility Univariate Random Variable Generator Sequence - * - * @return The Idiosyncratic Component of Forward Rate Volatility Univariate Random Variable Generator - * Sequence - */ - - public org.drip.sequence.random.UnivariateSequenceGenerator usgForwardRateVolatilityIdiosyncratic() - { - return _usgForwardRateVolatilityIdiosyncratic; - } - - @Override public org.drip.dynamics.evolution.LSQMPointUpdate evolve ( - final int iSpotDate, - final int iViewDate, - final int iSpotTimeIncrement, - final org.drip.dynamics.evolution.LSQMPointUpdate lsqmPrev) - { - if (iViewDate < iSpotDate || null == lsqmPrev || !(lsqmPrev instanceof - org.drip.dynamics.sabr.ForwardRateUpdate)) - return null; - double dblForwardRateZ = _usgForwardRate.random(); - - - double dblAnnualizedIncrement = 1. * iSpotTimeIncrement / 365.25; - org.drip.dynamics.sabr.ForwardRateUpdate fruPrev = (org.drip.dynamics.sabr.ForwardRateUpdate) - lsqmPrev; - - double dblAnnualizedIncrementSQRT = java.lang.Math.sqrt (dblAnnualizedIncrement); - - try { - double dblForwardRate = fruPrev.forwardRate(); - - double dblForwardRateVolatility = fruPrev.forwardRateVolatility(); - - double dblForwardRateIncrement = dblForwardRateVolatility * java.lang.Math.pow (dblForwardRate, - _dblBeta) * dblAnnualizedIncrementSQRT * dblForwardRateZ; - - double dblForwardRateVolatilityIncrement = _dblVolatilityOfVolatility * dblForwardRateVolatility - * dblAnnualizedIncrementSQRT * (_dblRho * dblForwardRateZ + _dblIdiosyncraticRho * - _usgForwardRateVolatilityIdiosyncratic.random()); - - return org.drip.dynamics.sabr.ForwardRateUpdate.Create (_lslForward, iSpotDate, iSpotDate + - iSpotTimeIncrement, iViewDate, dblForwardRate + dblForwardRateIncrement, - dblForwardRateIncrement, dblForwardRateVolatility + dblForwardRateVolatilityIncrement, - dblForwardRateVolatilityIncrement); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Implied ATM Black Volatility for the ATM Forward Rate and the TTE - * - * @param dblATMForwardRate ATM Forward Rate - * @param dblTTE Time to Expiry - * @param dblSigma0 Initial Sigma - * - * @return The Implied Black Volatility Instance - */ - - public org.drip.dynamics.sabr.ImpliedBlackVolatility computeATMBlackVolatility ( - final double dblATMForwardRate, - final double dblTTE, - final double dblSigma0) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblATMForwardRate) || - !org.drip.quant.common.NumberUtil.IsValid (dblTTE) || !org.drip.quant.common.NumberUtil.IsValid - (dblSigma0)) - return null; - - double dblF0KExpSQRT = java.lang.Math.pow (dblATMForwardRate, 1. - _dblBeta); - - double dblA = dblSigma0 / dblF0KExpSQRT; - double dblB = 1. + dblTTE * (((1. - _dblBeta) * (1. - _dblBeta) * dblSigma0 * dblSigma0 / (24. * - dblF0KExpSQRT * dblF0KExpSQRT)) + (_dblRho * _dblBeta * _dblVolatilityOfVolatility * dblSigma0 / - (4. * dblF0KExpSQRT)) + ((2. - 3. * _dblRho * _dblRho) * _dblVolatilityOfVolatility * - _dblVolatilityOfVolatility / 24.)); - - try { - return new org.drip.dynamics.sabr.ImpliedBlackVolatility (dblATMForwardRate, dblATMForwardRate, - dblTTE, dblA, 0., 0., dblB, dblA * dblB); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Implied Black Volatility for the Specified Strike, the ATM Forward Rate, and the TTE - * - * @param dblStrike Strike - * @param dblATMForwardRate ATM Forward Rate - * @param dblTTE Time to Expiry - * @param dblSigma0 Initial Sigma - * - * @return The Implied Black Volatility Instance - */ - - public org.drip.dynamics.sabr.ImpliedBlackVolatility computeBlackVolatility ( - final double dblStrike, - final double dblATMForwardRate, - final double dblTTE, - final double dblSigma0) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblStrike) || - !org.drip.quant.common.NumberUtil.IsValid (dblATMForwardRate) || - !org.drip.quant.common.NumberUtil.IsValid (dblTTE) || - !org.drip.quant.common.NumberUtil.IsValid (dblSigma0)) - return null; - - if (dblStrike == dblATMForwardRate) - return computeATMBlackVolatility (dblATMForwardRate, dblTTE, dblSigma0); - - double dblLogF0ByK = java.lang.Math.log (dblATMForwardRate / dblStrike); - - double dblF0KExpSQRT = java.lang.Math.pow (dblATMForwardRate * dblStrike, 0.5 * (1. - _dblBeta)); - - double dblZ = _dblVolatilityOfVolatility * dblF0KExpSQRT * dblLogF0ByK / dblSigma0; - double dblOneMinusBetaLogF0ByK = (1. - _dblBeta) * (1. - _dblBeta) * dblLogF0ByK * dblLogF0ByK; - double dblA = dblSigma0 / (dblF0KExpSQRT * (1. + (dblOneMinusBetaLogF0ByK / 24.) + - (dblOneMinusBetaLogF0ByK * dblOneMinusBetaLogF0ByK / 1920.))); - double dblB = 1. + dblTTE * (((1. - _dblBeta) * (1. - _dblBeta) * dblSigma0 * dblSigma0 / (24. * - dblF0KExpSQRT * dblF0KExpSQRT)) + (_dblRho * _dblBeta * _dblVolatilityOfVolatility * dblSigma0 / - (4. * dblF0KExpSQRT)) + ((2. - 3. * _dblRho * _dblRho) * _dblVolatilityOfVolatility * - _dblVolatilityOfVolatility / 24.)); - - double dblChiZ = java.lang.Math.log ((java.lang.Math.sqrt (1. - 2. * _dblRho * dblZ + dblZ * dblZ) + - dblZ - _dblRho) / (1. - _dblRho)); - - try { - return new org.drip.dynamics.sabr.ImpliedBlackVolatility (dblStrike, dblATMForwardRate, dblTTE, - dblA, dblZ, dblChiZ, dblB, dblA * dblZ * dblB / dblChiZ); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/adaptive/CoordinatedVariationDynamic.java b/org/drip/execution/adaptive/CoordinatedVariationDynamic.java deleted file mode 100644 index 093afd2..0000000 --- a/org/drip/execution/adaptive/CoordinatedVariationDynamic.java +++ /dev/null @@ -1,148 +0,0 @@ - -package org.drip.execution.adaptive; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CoordinatedVariationDynamic implements the HJB-based Single Step Optimal Cost Dynamic Trajectory using the - * Coordinated Variation Version of the Stochastic Volatility and the Transaction Function arising from the - * Realization of the Market State Variable as described in the "Trading Time" Model. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class CoordinatedVariationDynamic extends org.drip.execution.adaptive.CoordinatedVariationTrajectory { - private double[] _adblNonDimensionalHoldings = null; - private double[] _adblScaledNonDimensionalTradeRate = null; - private org.drip.execution.hjb.NonDimensionalCost[] _aNDC = null; - - /** - * CoordinatedVariationDynamic Constructor - * - * @param cvtd The Coordinated Variation Trajectory Determinant - * @param adblNonDimensionalHoldings The Array of the Non Dimensional Holdings - * @param adblScaledNonDimensionalTradeRate The Array of the Scaled Non Dimensional Trade Rate - * @param aNDC The Array of the Non Dimensional Costs - * - * @throws java.lang.Exception Thrown if the the Inputs are Invalid - */ - - public CoordinatedVariationDynamic ( - final org.drip.execution.adaptive.CoordinatedVariationTrajectoryDeterminant cvtd, - final double[] adblNonDimensionalHoldings, - final double[] adblScaledNonDimensionalTradeRate, - final org.drip.execution.hjb.NonDimensionalCost[] aNDC) - throws java.lang.Exception - { - super (cvtd); - - if (null == (_aNDC = aNDC) || null == (_adblNonDimensionalHoldings = adblNonDimensionalHoldings) || - null == (_adblScaledNonDimensionalTradeRate = adblScaledNonDimensionalTradeRate) || - !org.drip.quant.common.NumberUtil.IsValid (_adblNonDimensionalHoldings) || - !org.drip.quant.common.NumberUtil.IsValid (_adblScaledNonDimensionalTradeRate)) - throw new java.lang.Exception ("CoordinatedVariationDynamic Constructor => Invalid Inputs"); - - int iNumTimeNode = _adblNonDimensionalHoldings.length; - - if (0 == iNumTimeNode || iNumTimeNode != _adblScaledNonDimensionalTradeRate.length || iNumTimeNode != - _aNDC.length) - throw new java.lang.Exception ("CoordinatedVariationDynamic Constructor => Invalid Inputs"); - - for (int i = 0; i < iNumTimeNode; ++i) { - if (null == _aNDC[i]) - throw new java.lang.Exception ("CoordinatedVariationDynamic Constructor => Invalid Inputs"); - } - } - - /** - * Retrieve the Array of the Non Dimensional Holdings - * - * @return The Array of the Non Dimensional Holdings - */ - - public double[] nonDimensionalHoldings() - { - return _adblNonDimensionalHoldings; - } - - /** - * Retrieve the Array of the Scaled Non Dimensional Trade Rate - * - * @return The Array of the Scaled Non Dimensional Trade Rate - */ - - public double[] scaledNonDimensionalTradeRate() - { - return _adblScaledNonDimensionalTradeRate; - } - - /** - * Retrieve the Array of the Non Dimensional Costs - * - * @return The Array of the Non Dimensional Costs - */ - - public org.drip.execution.hjb.NonDimensionalCost[] nonDimensionalCost() - { - return _aNDC; - } -} diff --git a/org/drip/execution/adaptive/CoordinatedVariationRollingHorizon.java b/org/drip/execution/adaptive/CoordinatedVariationRollingHorizon.java deleted file mode 100644 index 32dc5ee..0000000 --- a/org/drip/execution/adaptive/CoordinatedVariationRollingHorizon.java +++ /dev/null @@ -1,148 +0,0 @@ - -package org.drip.execution.adaptive; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CoordinatedVariationRollingHorizon implements the "Rolling Horizon" Approximation of the Optimal Cost - * Dynamic Trajectory arising from the Coordinated Variation Version of the Stochastic Volatility and the - * Transaction Function arising from the Realization of the Market State Variable as described in the - * "Trading Time" Model. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class CoordinatedVariationRollingHorizon extends - org.drip.execution.adaptive.CoordinatedVariationTrajectory { - private double[] _adblNonDimensionalCost = null; - private double[] _adblNonDimensionalHoldings = null; - private double[] _adblNonDimensionalTradeRate = null; - - /** - * CoordinatedVariationRollingHorizon Constructor - * - * @param cvtd The Coordinated Variation Trajectory Determinant - * @param adblNonDimensionalHoldings The Array of the Non Dimensional Holdings - * @param adblNonDimensionalTradeRate The Array of the Non Dimensional Trade Rate - * @param adblNonDimensionalCost The Array of the Non Dimensional Cost - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CoordinatedVariationRollingHorizon ( - final org.drip.execution.adaptive.CoordinatedVariationTrajectoryDeterminant cvtd, - final double[] adblNonDimensionalHoldings, - final double[] adblNonDimensionalTradeRate, - final double[] adblNonDimensionalCost) - throws java.lang.Exception - { - super (cvtd); - - if (null == (_adblNonDimensionalHoldings = adblNonDimensionalHoldings) || null == - (_adblNonDimensionalTradeRate = adblNonDimensionalTradeRate) || null == (_adblNonDimensionalCost - = adblNonDimensionalCost) || !org.drip.quant.common.NumberUtil.IsValid - (_adblNonDimensionalHoldings) || !org.drip.quant.common.NumberUtil.IsValid - (_adblNonDimensionalTradeRate) || !org.drip.quant.common.NumberUtil.IsValid - (_adblNonDimensionalCost)) - throw new java.lang.Exception - ("CoordinatedVariationRollingHorizon Constructor => Invalid Inputs"); - - int iNumTimeNode = _adblNonDimensionalHoldings.length; - - if (0 == iNumTimeNode || iNumTimeNode != _adblNonDimensionalTradeRate.length) - throw new java.lang.Exception - ("CoordinatedVariationRollingHorizon Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Array of the Non Dimensional Holdings - * - * @return The Array of the Non Dimensional Holdings - */ - - public double[] nonDimensionalHoldings() - { - return _adblNonDimensionalHoldings; - } - - /** - * Retrieve the Array of the Non Dimensional Trade Rate - * - * @return The Array of the Non Dimensional Trade Rate - */ - - public double[] nonDimensionalTradeRate() - { - return _adblNonDimensionalTradeRate; - } - - /** - * Retrieve the Array of the Non Dimensional Cost - * - * @return The Array of the Non Dimensional Cost - */ - - public double[] nonDimensionalCost() - { - return _adblNonDimensionalCost; - } -} diff --git a/org/drip/execution/adaptive/CoordinatedVariationStatic.java b/org/drip/execution/adaptive/CoordinatedVariationStatic.java deleted file mode 100644 index 710ebff..0000000 --- a/org/drip/execution/adaptive/CoordinatedVariationStatic.java +++ /dev/null @@ -1,107 +0,0 @@ - -package org.drip.execution.adaptive; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CoordinatedVariationStatic implements the Static Trajectory based on the "Mean Equilibrium Market State" - * of the Coordinated Variation Version of the Stochastic Volatility and the Transaction Function arising - * from the Realization of the Market State Variable as described in the "Trading Time" Model. The - * References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class CoordinatedVariationStatic extends org.drip.execution.adaptive.CoordinatedVariationTrajectory { - private org.drip.execution.optimum.EfficientTradingTrajectoryContinuous _ettc = null; - - /** - * CoordinatedVariationStatic Constructor - * - * @param cvtd The Coordinated Variation Trajectory Determinant - * @param ettc The Static Continuous Trading Trajectory Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CoordinatedVariationStatic ( - final org.drip.execution.adaptive.CoordinatedVariationTrajectoryDeterminant cvtd, - final org.drip.execution.optimum.EfficientTradingTrajectoryContinuous ettc) - throws java.lang.Exception - { - super (cvtd); - - if (null == (_ettc = ettc)) - throw new java.lang.Exception ("CoordinatedVariationStatic Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Static Continuous Trading Trajectory Instance - * - * @return The Static Continuous Trading Trajectory Instance - */ - - public org.drip.execution.optimum.EfficientTradingTrajectoryContinuous trajectory() - { - return _ettc; - } -} diff --git a/org/drip/execution/adaptive/CoordinatedVariationTrajectory.java b/org/drip/execution/adaptive/CoordinatedVariationTrajectory.java deleted file mode 100644 index 21bb112..0000000 --- a/org/drip/execution/adaptive/CoordinatedVariationTrajectory.java +++ /dev/null @@ -1,103 +0,0 @@ - -package org.drip.execution.adaptive; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CoordinatedVariationTrajectory holds the "Common" Measures generated from the HJB-based MultiStep Optimal - * Cost Dynamic Trajectory Generation using the Coordinated Variation Version of the Stochastic Volatility - * and the Transaction Function arising from the Realization of the Market State Variable as described in - * the "Trading Time" Model. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class CoordinatedVariationTrajectory { - private org.drip.execution.adaptive.CoordinatedVariationTrajectoryDeterminant _cvtd = null; - - /** - * CoordinatedVariationTrajectory Constructor - * - * @param cvtd The Coordinated Variation Trajectory Determinant - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CoordinatedVariationTrajectory ( - final org.drip.execution.adaptive.CoordinatedVariationTrajectoryDeterminant cvtd) - throws java.lang.Exception - { - if (null == (_cvtd = cvtd)) - throw new java.lang.Exception ("CoordinatedVariationTrajectory Constructor => Invalid Inputs"); - } - - /** - * Retrieve The Coordinated Variation Trajectory Determinant Instance - * - * @return The Coordinated Variation Trajectory Determinant Instance - */ - - public org.drip.execution.adaptive.CoordinatedVariationTrajectoryDeterminant trajectoryDeterminant() - { - return _cvtd; - } -} diff --git a/org/drip/execution/adaptive/CoordinatedVariationTrajectoryDeterminant.java b/org/drip/execution/adaptive/CoordinatedVariationTrajectoryDeterminant.java deleted file mode 100644 index 20aee35..0000000 --- a/org/drip/execution/adaptive/CoordinatedVariationTrajectoryDeterminant.java +++ /dev/null @@ -1,196 +0,0 @@ - -package org.drip.execution.adaptive; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CoordinatedVariationTrajectoryDeterminant contains the HJB-based MultiStep Optimal Cost Dynamic Trajectory - * Generation Metrics using the Coordinated Variation Version of the Stochastic Volatility and the - * Transaction Function arising from the Realization of the Market State Variable as described in the - * "Trading Time" Model. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class CoordinatedVariationTrajectoryDeterminant { - private double _dblOrderSize = java.lang.Double.NaN; - private double _dblCostScale = java.lang.Double.NaN; - private double _dblTimeScale = java.lang.Double.NaN; - private double _dblMarketPower = java.lang.Double.NaN; - private double _dblTradeRateScale = java.lang.Double.NaN; - private double _dblMeanMarketUrgency = java.lang.Double.NaN; - private double _dblNonDimensionalRiskAversion = java.lang.Double.NaN; - - /** - * CoordinatedVariationTrajectoryDeterminant Constructor - * - * @param dblOrderSize The Order Size - * @param dblTimeScale The Time Scale - * @param dblCostScale The Cost Scale - * @param dblTradeRateScale The Trade Rate Scale - * @param dblMeanMarketUrgency The Mean Market Urgency - * @param dblNonDimensionalRiskAversion The Non Dimensional Risk Aversion Parameter - * @param dblMarketPower The Preference-free "Market Power" Parameter - * - * @throws java.lang.Exception Thrown if the the Inputs are Invalid - */ - - public CoordinatedVariationTrajectoryDeterminant ( - final double dblOrderSize, - final double dblTimeScale, - final double dblCostScale, - final double dblTradeRateScale, - final double dblMeanMarketUrgency, - final double dblNonDimensionalRiskAversion, - final double dblMarketPower) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblOrderSize = dblOrderSize) || - !org.drip.quant.common.NumberUtil.IsValid (_dblTimeScale = dblTimeScale) || - !org.drip.quant.common.NumberUtil.IsValid (_dblCostScale = dblCostScale) || - !org.drip.quant.common.NumberUtil.IsValid (_dblTradeRateScale = dblTradeRateScale) || - !org.drip.quant.common.NumberUtil.IsValid (_dblMeanMarketUrgency = - dblMeanMarketUrgency) || !org.drip.quant.common.NumberUtil.IsValid - (_dblNonDimensionalRiskAversion = dblNonDimensionalRiskAversion) || - !org.drip.quant.common.NumberUtil.IsValid (_dblMarketPower = - dblMarketPower)) - throw new java.lang.Exception - ("CoordinatedVariationTrajectoryDeterminant Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Order Size - * - * @return The Order Size - */ - - public double orderSize() - { - return _dblOrderSize; - } - - /** - * Retrieve the Time Scale - * - * @return The Time Scale - */ - - public double timeScale() - { - return _dblTimeScale; - } - - /** - * Retrieve the Cost Scale - * - * @return The Cost Scale - */ - - public double costScale() - { - return _dblCostScale; - } - - /** - * Retrieve the Trade Rate Scale - * - * @return The Trade Rate Scale - */ - - public double tradeRateScale() - { - return _dblTradeRateScale; - } - - /** - * Retrieve the Mean Market Urgency - * - * @return The Mean Market Urgency - */ - - public double meanMarketUrgency() - { - return _dblMeanMarketUrgency; - } - - /** - * Retrieve the Non Dimensional Risk Aversion Parameter - * - * @return The Non Dimensional Risk Aversion Parameter - */ - - public double nonDimensionalRiskAversion() - { - return _dblNonDimensionalRiskAversion; - } - - /** - * Retrieve the Preference-free "Market Power" Parameter - * - * @return The Preference-free "Market Power" Parameter - */ - - public double marketPower() - { - return _dblMarketPower; - } -} diff --git a/org/drip/execution/adaptive/CoordinatedVariationTrajectoryGenerator.java b/org/drip/execution/adaptive/CoordinatedVariationTrajectoryGenerator.java deleted file mode 100644 index 15131f2..0000000 --- a/org/drip/execution/adaptive/CoordinatedVariationTrajectoryGenerator.java +++ /dev/null @@ -1,454 +0,0 @@ - -package org.drip.execution.adaptive; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CoordinatedVariationTrajectoryGenerator implements the Continuous HJB-based Single Step Optimal Cost - * Trajectory using the Coordinated Variation Version of the Stochastic Volatility and the Transaction - * Function arising from the Realization of the Market State Variable as described in the "Trading Time" - * Model. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class CoordinatedVariationTrajectoryGenerator { - - /** - * Flag Indicating Trade Rate Initialization from Static Trajectory - */ - - public static final int TRADE_RATE_STATIC_INITIALIZATION = 1; - - /** - * Flag Indicating Trade Rate Initialization to Zero Initial Value - */ - - public static final int TRADE_RATE_ZERO_INITIALIZATION = 2; - - private org.drip.execution.strategy.OrderSpecification _os = null; - private int _iTradeRateInitializer = TRADE_RATE_ZERO_INITIALIZATION; - private org.drip.execution.tradingtime.CoordinatedVariation _cv = null; - private org.drip.execution.risk.MeanVarianceObjectiveUtility _mvou = null; - private org.drip.execution.hjb.NonDimensionalCostEvolver _ndce = null; - - private org.drip.execution.dynamics.LinearPermanentExpectationParameters realizedLPEP ( - final double dblMarketState) - { - try { - return new org.drip.execution.dynamics.LinearPermanentExpectationParameters (new - org.drip.execution.parameters.ArithmeticPriceDynamicsSettings (0., new - org.drip.function.r1tor1.FlatUnivariate (_cv.referenceVolatility() * java.lang.Math.exp - (-0.5 * dblMarketState)), 0.), new - org.drip.execution.profiletime.UniformParticipationRateLinear - (org.drip.execution.impact.ParticipationRateLinear.NoImpact()), new - org.drip.execution.profiletime.UniformParticipationRateLinear - (org.drip.execution.impact.ParticipationRateLinear.SlopeOnly - (_cv.referenceLiquidity() * java.lang.Math.exp - (dblMarketState)))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * CoordinatedVariationTrajectoryGenerator Constructor - * - * @param os The Order Specification - * @param cv The Coordinated Variation Instance - * @param mvou The Mean Variance Objective Utility Function - * @param ndce The Non Dimensional Cost Evolver - * @param iTradeRateInitializer The Trade Rate Initialization Indicator - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CoordinatedVariationTrajectoryGenerator ( - final org.drip.execution.strategy.OrderSpecification os, - final org.drip.execution.tradingtime.CoordinatedVariation cv, - final org.drip.execution.risk.MeanVarianceObjectiveUtility mvou, - final org.drip.execution.hjb.NonDimensionalCostEvolver ndce, - final int iTradeRateInitializer) - throws java.lang.Exception - { - if (null == (_os = os) || null == (_cv = cv) || null == (_mvou = mvou) || null == (_ndce = ndce) || - (TRADE_RATE_STATIC_INITIALIZATION != (_iTradeRateInitializer = iTradeRateInitializer) && - TRADE_RATE_ZERO_INITIALIZATION != _iTradeRateInitializer)) - throw new java.lang.Exception - ("CoordinatedVariationTrajectoryGenerator Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Trade Rate Initialization Indicator - * - * @return The Trade Rate Initialization Indicator - */ - - public int tradeRateInitializer() - { - return _iTradeRateInitializer; - } - - /** - * Retrieve the Order Specification - * - * @return The Order Specification - */ - - public org.drip.execution.strategy.OrderSpecification orderSpecification() - { - return _os; - } - - /** - * Retrieve the Coordinated Variation Instance - * - * @return The Coordinated Variation Instance - */ - - public org.drip.execution.tradingtime.CoordinatedVariation coordinatedVariationConstraint() - { - return _cv; - } - - /** - * Retrieve the Non Dimensional Cost Evolver - * - * @return The Non Dimensional Cost Evolver - */ - - public org.drip.execution.hjb.NonDimensionalCostEvolver evolver() - { - return _ndce; - } - - /** - * Retrieve the Mean Variance Objective Utility Function - * - * @return The Mean Variance Objective Utility Function - */ - - public org.drip.execution.risk.MeanVarianceObjectiveUtility objectiveUtility() - { - return _mvou; - } - - /** - * Compute The Coordinated Variation Trajectory Determinant Instance - * - * @return The Coordinated Variation Trajectory Determinant Instance - */ - - public org.drip.execution.adaptive.CoordinatedVariationTrajectoryDeterminant trajectoryDeterminant() - { - double dblExecutionSize = _os.size(); - - double dblReferenceLiquidity = _cv.referenceLiquidity(); - - double dblReferenceVolatility = _cv.referenceVolatility(); - - double dblRelaxationTime = _ndce.ornsteinUnlenbeckProcess().referenceRelaxationTime(); - - double dblMeanMarketUrgency = _cv.referenceVolatility() * java.lang.Math.sqrt (_mvou.riskAversion() / - dblReferenceLiquidity); - - double dblTradeRateScale = dblExecutionSize / dblRelaxationTime; - - try { - return new org.drip.execution.adaptive.CoordinatedVariationTrajectoryDeterminant - (dblExecutionSize, dblRelaxationTime, dblReferenceLiquidity * dblExecutionSize * - dblExecutionSize / dblTradeRateScale, dblTradeRateScale, dblMeanMarketUrgency, - dblMeanMarketUrgency * dblRelaxationTime, dblReferenceLiquidity * dblExecutionSize / - dblReferenceVolatility * java.lang.Math.pow (_os.maxExecutionTime(), -1.5)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Initial Non Dimensional Cost - * - * @param ms The Initial Market State - * @param dblTradeRateScale The Trade Rate Scale - * - * @return The Initial Non Dimensional Cost - */ - - public org.drip.execution.hjb.NonDimensionalCost initializeNonDimensionalCost ( - final org.drip.execution.latent.MarketState ms, - final double dblTradeRateScale) - { - if (TRADE_RATE_ZERO_INITIALIZATION == _iTradeRateInitializer) - return org.drip.execution.hjb.NonDimensionalCostSystemic.Zero(); - - if (null == ms || !org.drip.quant.common.NumberUtil.IsValid (dblTradeRateScale)) return null; - - try { - org.drip.execution.strategy.ContinuousTradingTrajectory ctt = - (org.drip.execution.strategy.ContinuousTradingTrajectory) new - org.drip.execution.nonadaptive.ContinuousAlmgrenChriss (_os, - org.drip.execution.dynamics.ArithmeticPriceEvolutionParametersBuilder.ReferenceCoordinatedVariation - (_cv), _mvou).generate(); - - if (null == ctt) return null; - - double dblNonDimensionalInstantTradeRate = ctt.tradeRate().evaluate (0.) / dblTradeRateScale; - - double dblNonDimensionalCostSensitivity = java.lang.Math.exp (ms.liquidity()) * - dblNonDimensionalInstantTradeRate; - - return new org.drip.execution.hjb.NonDimensionalCostSystemic (0., dblNonDimensionalCostSensitivity, - dblNonDimensionalCostSensitivity, dblNonDimensionalInstantTradeRate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Continuous Coordinated Variation Dynamic Adaptive Trajectory - * - * @param aMS Array of Realized Market States - * - * @return The Continuous Coordinated Variation Dynamic Adaptive Trajectory - */ - - public org.drip.execution.adaptive.CoordinatedVariationDynamic adaptive ( - final org.drip.execution.latent.MarketState[] aMS) - { - if (null == aMS) return null; - - int iNumTimeNode = aMS.length; - - if (1 >= iNumTimeNode) return null; - - double dblExecutionSize = _os.size(); - - double dblReferenceLiquidity = _cv.referenceLiquidity(); - - double dblReferenceVolatility = _cv.referenceVolatility(); - - double dblRelaxationTime = _ndce.ornsteinUnlenbeckProcess().referenceRelaxationTime(); - - double dblNonDimensionalTimeIncrement = _os.maxExecutionTime() / (iNumTimeNode - 1) / - dblRelaxationTime; - - double dblMeanMarketUrgency = dblReferenceVolatility * java.lang.Math.sqrt (_mvou.riskAversion() / - dblReferenceLiquidity); - - org.drip.execution.hjb.NonDimensionalCost[] aNDC = new - org.drip.execution.hjb.NonDimensionalCost[iNumTimeNode]; - double[] adblNonDimensionalScaledTradeRate = new double[iNumTimeNode]; - double dblTradeRateScale = dblExecutionSize / dblRelaxationTime; - double[] adblNonDimensionalHoldings = new double[iNumTimeNode]; - adblNonDimensionalScaledTradeRate[0] = 0.; - adblNonDimensionalHoldings[0] = 1.; - - if (null == (aNDC[0] = initializeNonDimensionalCost (aMS[0], dblTradeRateScale))) return null; - - for (int i = 1; i < iNumTimeNode; ++i) { - if (null == (aNDC[i] = _ndce.evolve (aNDC[i - 1], aMS[i], dblMeanMarketUrgency * - dblRelaxationTime, (iNumTimeNode - i) * dblNonDimensionalTimeIncrement, - dblNonDimensionalTimeIncrement))) - return null; - - adblNonDimensionalScaledTradeRate[i] = adblNonDimensionalHoldings[i - 1] * - aNDC[i].nonDimensionalTradeRate(); - - adblNonDimensionalHoldings[i] = adblNonDimensionalHoldings[i - 1] - - adblNonDimensionalScaledTradeRate[i] * dblNonDimensionalTimeIncrement; - } - - try { - return new org.drip.execution.adaptive.CoordinatedVariationDynamic (new - org.drip.execution.adaptive.CoordinatedVariationTrajectoryDeterminant (dblExecutionSize, - dblRelaxationTime, dblReferenceLiquidity * dblExecutionSize * dblExecutionSize / - dblTradeRateScale, dblTradeRateScale, dblMeanMarketUrgency, dblMeanMarketUrgency * - dblRelaxationTime, dblReferenceLiquidity * dblExecutionSize / - dblReferenceVolatility * java.lang.Math.pow (_os.maxExecutionTime(), -1.5)), - adblNonDimensionalHoldings, adblNonDimensionalScaledTradeRate, aNDC); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate a Static, Non-adaptive Trading Trajectory Instance - * - * @return The Static, Non-adaptive Trading Trajectory Instance - */ - - public org.drip.execution.adaptive.CoordinatedVariationStatic nonAdaptive() - { - try { - return new org.drip.execution.adaptive.CoordinatedVariationStatic (trajectoryDeterminant(), - (org.drip.execution.optimum.EfficientTradingTrajectoryContinuous) new - org.drip.execution.nonadaptive.ContinuousAlmgrenChriss (_os, - org.drip.execution.dynamics.ArithmeticPriceEvolutionParametersBuilder.ReferenceCoordinatedVariation - (_cv), _mvou).generate()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Continuous Coordinated Variation Rolling Horizon Trajectory - * - * @param aMS Array of Realized Market States - * - * @return The Continuous Coordinated Variation Rolling Horizon Trajectory - */ - - public org.drip.execution.adaptive.CoordinatedVariationRollingHorizon rollingHorizon ( - final org.drip.execution.latent.MarketState[] aMS) - { - if (null == aMS) return null; - - int iNumTimeNode = aMS.length; - double[] adblNonDimensionalCost = 0 == iNumTimeNode ? null : new double[iNumTimeNode]; - double[] adblNonDimensionalHoldings = 0 == iNumTimeNode ? null : new double[iNumTimeNode]; - double[] adblNonDimensionalTradeRate = 0 == iNumTimeNode ? null : new double[iNumTimeNode]; - - if (0 == iNumTimeNode) return null; - - double dblExecutionSize = _os.size(); - - double dblRiskAversion = _mvou.riskAversion(); - - double dblExecutionTime = _os.maxExecutionTime(); - - double dblReferenceLiquidity = _cv.referenceLiquidity(); - - double dblReferenceVolatility = _cv.referenceVolatility(); - - double dblRelaxationTime = _ndce.ornsteinUnlenbeckProcess().referenceRelaxationTime(); - - double dblMeanMarketUrgency = dblReferenceVolatility * java.lang.Math.sqrt (dblRiskAversion / - dblReferenceLiquidity); - - double dblNonDimensionalTimeIncrement = dblExecutionTime / (iNumTimeNode - 1) / dblRelaxationTime; - double dblNonDimensionalExecutionTime = dblExecutionTime / dblRelaxationTime; - double dblTradeRateScale = dblExecutionSize / dblRelaxationTime; - adblNonDimensionalTradeRate[iNumTimeNode - 1] = 0.; - adblNonDimensionalHoldings[0] = 1.; - adblNonDimensionalCost[0] = 0.; - - for (int i = 0; i < iNumTimeNode - 1; ++i) { - org.drip.execution.dynamics.LinearPermanentExpectationParameters lpep = realizedLPEP - (aMS[i].liquidity()); - - if (null == lpep) return null; - - try { - double dblRealizedVolatility = lpep.arithmeticPriceDynamicsSettings().epochVolatility(); - - org.drip.execution.strategy.ContinuousTradingTrajectory ctt = - (org.drip.execution.strategy.ContinuousTradingTrajectory) new - org.drip.execution.nonadaptive.ContinuousAlmgrenChriss (new - org.drip.execution.strategy.OrderSpecification (adblNonDimensionalHoldings[i], - dblNonDimensionalExecutionTime - i * dblNonDimensionalTimeIncrement), lpep, - _mvou).generate(); - - if (null == ctt) return null; - - adblNonDimensionalTradeRate[i] = ctt.tradeRate().evaluate (0.); - - adblNonDimensionalHoldings[i + 1] = adblNonDimensionalHoldings[i] - - adblNonDimensionalTradeRate[i] * dblNonDimensionalTimeIncrement; - adblNonDimensionalCost[i + 1] = adblNonDimensionalCost[i] + (dblRiskAversion * - dblRealizedVolatility * dblRealizedVolatility * adblNonDimensionalHoldings[i] * - adblNonDimensionalHoldings[i] + - lpep.linearPermanentExpectation().epochLiquidityFunction().slope() * - adblNonDimensionalTradeRate[i] * adblNonDimensionalTradeRate[i]) * - dblNonDimensionalTimeIncrement; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - try { - return new org.drip.execution.adaptive.CoordinatedVariationRollingHorizon (new - org.drip.execution.adaptive.CoordinatedVariationTrajectoryDeterminant (dblExecutionSize, - dblRelaxationTime, dblReferenceLiquidity * dblExecutionSize * dblExecutionSize / - dblTradeRateScale, dblTradeRateScale, dblMeanMarketUrgency, dblMeanMarketUrgency * - dblRelaxationTime, dblReferenceLiquidity * dblExecutionSize / - dblReferenceVolatility * java.lang.Math.pow (_os.maxExecutionTime(), -1.5)), - adblNonDimensionalHoldings, adblNonDimensionalTradeRate, - adblNonDimensionalCost); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/adaptive/CoordinatedVariationTrajectoryState.java b/org/drip/execution/adaptive/CoordinatedVariationTrajectoryState.java deleted file mode 100644 index 8a4c3c5..0000000 --- a/org/drip/execution/adaptive/CoordinatedVariationTrajectoryState.java +++ /dev/null @@ -1,164 +0,0 @@ - -package org.drip.execution.adaptive; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CoordinatedVariationTrajectoryState holds the HJB-based Multi Step Optimal Trajectory State at each Step - * of the Evolution using the Coordinated Variation Version of the Stochastic Volatility and the Transaction - * Function arising from the Realization of the Market State Variable as described in the "Trading Time" - * Model. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class CoordinatedVariationTrajectoryState { - private double _dblCost = java.lang.Double.NaN; - private double _dblTime = java.lang.Double.NaN; - private double _dblHoldings = java.lang.Double.NaN; - private double _dblTradeRate = java.lang.Double.NaN; - private double _dblMarketState = java.lang.Double.NaN; - - /** - * CoordinatedVariationTrajectoryState Constructor - * - * @param dblTime The Time Instant - * @param dblHoldings The Holdings - * @param dblTradeRate The Trade Rate - * @param dblCost The Accumulated Cost - * @param dblMarketState The Current Market State - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CoordinatedVariationTrajectoryState ( - final double dblTime, - final double dblHoldings, - final double dblTradeRate, - final double dblCost, - final double dblMarketState) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblTime = dblTime) || - !org.drip.quant.common.NumberUtil.IsValid (_dblHoldings = dblHoldings) || - !org.drip.quant.common.NumberUtil.IsValid (_dblTradeRate = dblTradeRate) || - !org.drip.quant.common.NumberUtil.IsValid (_dblCost = dblCost) || - !org.drip.quant.common.NumberUtil.IsValid (_dblMarketState = dblMarketState)) - throw new java.lang.Exception - ("CoordinatedVariationTrajectoryState Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Trajectory State Time Node - * - * @return The Trajectory State Time Node - */ - - public double time() - { - return _dblTime; - } - - /** - * Retrieve the Trajectory State Time Node Holdings - * - * @return The Trajectory State Time Node Holdings - */ - - public double holdings() - { - return _dblHoldings; - } - - /** - * Retrieve the Trajectory State Time Node Cost - * - * @return The Trajectory State Time Node Cost - */ - - public double cost() - { - return _dblCost; - } - - /** - * Retrieve the Trajectory State Time Node Trade Rate - * - * @return The Trajectory State Time Node Trade Rate - */ - - public double tradeRate() - { - return _dblTradeRate; - } - - /** - * Retrieve the Trajectory Time Node Market State - * - * @return The Trajectory Time Node Market State - */ - - public double marketState() - { - return _dblMarketState; - } -} diff --git a/org/drip/execution/athl/CalibrationEmpirics.java b/org/drip/execution/athl/CalibrationEmpirics.java deleted file mode 100644 index ebd6c19..0000000 --- a/org/drip/execution/athl/CalibrationEmpirics.java +++ /dev/null @@ -1,149 +0,0 @@ - -package org.drip.execution.athl; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CalibrationEmpirics contains the Universal Market Impact Exponent/Coefficients that have been determined - * empirically by Almgren, Thum, Hauptmann, and Li (2005), using the Parameterization of Almgren (2003). The - * References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class CalibrationEmpirics { - - /** - * Almgren, Thum, Hauptmann, and Li (2005) Universal Permanent Impact Exponent - */ - - public static final double PERMANENT_IMPACT_EXPONENT_ATHL2005 = 0.891; - - /** - * Almgren, Thum, Hauptmann, and Li (2005) Universal Permanent Impact Exponent One Sigma - */ - - public static final double PERMANENT_IMPACT_EXPONENT_ATHL2005_ONE_SIGMA = 0.10; - - /** - * Quasi-Arbitrage Free Universal Permanent Impact Exponent - */ - - public static final double PERMANENT_IMPACT_EXPONENT_QUASI_ARBITRAGE_FREE = 1.00; - - /** - * Universal Permanent Impact Exponent - */ - - public static final double PERMANENT_IMPACT_EXPONENT = PERMANENT_IMPACT_EXPONENT_QUASI_ARBITRAGE_FREE; - - /** - * Universal Permanent Impact Coefficient - */ - - public static final double PERMANENT_IMPACT_COEFFICIENT = 0.314; - - /** - * Universal Permanent Impact Coefficient One Sigma - */ - - public static final double PERMANENT_IMPACT_COEFFICIENT_ONE_SIGMA = 0.041; - - /** - * The ATHL2005 Permanent Impact Inverse Turnover Coefficient - */ - - public static final double PERMANENT_IMPACT_INVERSE_TURNOVER_EXPONENT_ATHL2005 = 0.267; - - /** - * The ATHL2005 Permanent Impact Inverse Turnover Coefficient One Sigma Error - */ - - public static final double PERMANENT_IMPACT_INVERSE_TURNOVER_EXPONENT_ATHL2005_ONE_SIGMA = 0.22; - - /** - * The Universal Permanent Impact Inverse Turnover Coefficient - */ - - public static final double PERMANENT_IMPACT_INVERSE_TURNOVER_EXPONENT = 0.25; - - /** - * Universal Temporary Impact Exponent - */ - - public static final double TEMPORARY_IMPACT_EXPONENT = 0.600; - - /** - * Universal Temporary Impact Exponent One Sigma - */ - - public static final double TEMPORARY_IMPACT_EXPONENT_ONE_SIGMA = 0.038; - - /** - * Universal Temporary Impact Coefficient - */ - - public static final double TEMPORARY_IMPACT_COEFFICIENT = 0.142; - - /** - * Universal Temporary Impact Coefficient One Sigma - */ - - public static final double TEMPORARY_IMPACT_COEFFICIENT_ONE_SIGMA = 0.0062; -} diff --git a/org/drip/execution/athl/DynamicsParameters.java b/org/drip/execution/athl/DynamicsParameters.java deleted file mode 100644 index 184a762..0000000 --- a/org/drip/execution/athl/DynamicsParameters.java +++ /dev/null @@ -1,122 +0,0 @@ - -package org.drip.execution.athl; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DynamicsParameters generates the Variants of the Market Dynamics Parameters constructed using the - * Methodologies presented in Almgren, Thum, Hauptmann, and Li (2005), using the Parameterization of Almgren - * (2003). The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class DynamicsParameters { - private org.drip.execution.parameters.AssetFlowSettings _afp = null; - - /** - * DynamicsParameters Constructor - * - * @param afp The Asset Flow Parameters Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public DynamicsParameters ( - final org.drip.execution.parameters.AssetFlowSettings afp) - throws java.lang.Exception - { - if (null == (_afp = afp)) - throw new java.lang.Exception ("DynamicsParameters Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Asset Flow Parameters Instance - * - * @return The Asset Flow Parameters Instance - */ - - public org.drip.execution.parameters.AssetFlowSettings assetFlowParameters() - { - return _afp; - } - - /** - * Generate an Instance of the Almgren 2003 Dynamics Parameters - * - * @return Instance of the Almgren 2003 Dynamics Parameters - */ - - public org.drip.execution.dynamics.LinearPermanentExpectationParameters almgren2003() - { - try { - return org.drip.execution.dynamics.ArithmeticPriceEvolutionParametersBuilder.Almgren2003 (new - org.drip.execution.parameters.ArithmeticPriceDynamicsSettings (0., new - org.drip.function.r1tor1.FlatUnivariate (_afp.dailyVolatility()), 0.), new - org.drip.execution.profiletime.UniformParticipationRateLinear (new - org.drip.execution.athl.PermanentImpactNoArbitrage (_afp)), new - org.drip.execution.profiletime.UniformParticipationRate (new - org.drip.execution.athl.TemporaryImpact (_afp))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/athl/IJK.java b/org/drip/execution/athl/IJK.java deleted file mode 100644 index 0419885..0000000 --- a/org/drip/execution/athl/IJK.java +++ /dev/null @@ -1,131 +0,0 @@ - -package org.drip.execution.athl; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * IJK holds the Empirical Signals that have been emitted off of a Transaction Run using the Scheme by - * Almgren, Thum, Hauptmann, and Li (2005), using the Parameterization of Almgren (2003). The References - * are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class IJK { - private org.drip.execution.athl.TransactionSignal _tsI = null; - private org.drip.execution.athl.TransactionSignal _tsK = null; - - /** - * IJK Constructor - * - * @param tsI The "I" Transaction Signal - * @param tsK The "K" Transaction Signal - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public IJK ( - final org.drip.execution.athl.TransactionSignal tsI, - final org.drip.execution.athl.TransactionSignal tsK) - throws java.lang.Exception - { - if (null == (_tsI = tsI) || null == (_tsK = tsK)) - throw new java.lang.Exception ("IJK Constructor => Invalid Inputs"); - } - - /** - * The Almgren-Thum-Hauptmann-Li "I" Transaction Signal - * - * @return The Almgren-Thum-Hauptmann-Li "I" Transaction Signal - */ - - public org.drip.execution.athl.TransactionSignal i() - { - return _tsI; - } - - /** - * The Almgren-Thum-Hauptmann-Li "K" Transaction Signal - * - * @return The Almgren-Thum-Hauptmann-Li "K" Transaction Signal - */ - - public org.drip.execution.athl.TransactionSignal k() - { - return _tsK; - } - - /** - * The Almgren-Thum-Hauptmann-Li "J" Transaction Signal - * - * @return The Almgren-Thum-Hauptmann-Li "J" Transaction Signal - */ - - public org.drip.execution.athl.TransactionSignal j() - { - try { - return new org.drip.execution.athl.TransactionSignal (_tsK.drift() + 0.5 * _tsI.drift(), - _tsK.iWander() + 0.5 * _tsI.iWander(), _tsK.jWander()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/athl/PermanentImpactNoArbitrage.java b/org/drip/execution/athl/PermanentImpactNoArbitrage.java deleted file mode 100644 index f37d4f2..0000000 --- a/org/drip/execution/athl/PermanentImpactNoArbitrage.java +++ /dev/null @@ -1,173 +0,0 @@ - -package org.drip.execution.athl; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PermanentImpactNoArbitrage implements the Linear Permanent Market Impact with Coefficients that have been - * determined empirically by Almgren, Thum, Hauptmann, and Li (2005), using the no Quasi-Arbitrage Criterion - * identified by Huberman and Stanzl (2004). The References are: - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Huberman, G., and W. Stanzl (2004): Price Manipulation and Quasi-arbitrage, Econometrica 72 (4) - * 1247-1275. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class PermanentImpactNoArbitrage extends org.drip.execution.impact.ParticipationRateLinear { - private double _dblLiquidityFactor = java.lang.Double.NaN; - private org.drip.execution.parameters.AssetFlowSettings _afp = null; - - /** - * PermanentImpactNoArbitrage Constructor - * - * @param afp The Asset Flow Parameters - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public PermanentImpactNoArbitrage ( - final org.drip.execution.parameters.AssetFlowSettings afp) - throws java.lang.Exception - { - super (0., org.drip.execution.athl.CalibrationEmpirics.PERMANENT_IMPACT_COEFFICIENT * - java.lang.Math.pow (afp.inverseTurnover(), - org.drip.execution.athl.CalibrationEmpirics.PERMANENT_IMPACT_INVERSE_TURNOVER_EXPONENT)); - - if (null == (_afp = afp)) - throw new java.lang.Exception ("PermanentImpactNoArbitrage Constructor => Invalid Inputs"); - - _dblLiquidityFactor = java.lang.Math.pow (afp.inverseTurnover(), - org.drip.execution.athl.CalibrationEmpirics.PERMANENT_IMPACT_INVERSE_TURNOVER_EXPONENT); - } - - /** - * Retrieve the Liquidity Factor - * - * @return The Liquidity Factor - */ - - public double liquidityFactor() - { - return _dblLiquidityFactor; - } - - /** - * Retrieve the Asset Flow Parameters - * - * @return The Asset Flow Parameters - */ - - public org.drip.execution.parameters.AssetFlowSettings assetFlowParameters() - { - return _afp; - } - - @Override public double regularize ( - final double dblTradeInterval) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblTradeInterval) || 0 >= dblTradeInterval) - throw new java.lang.Exception ("PermanentImpactNoArbitrage::regularize => Invalid Inputs"); - - return 1. / (_afp.averageDailyVolume() * dblTradeInterval); - } - - @Override public double modulate ( - final double dblTradeInterval) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblTradeInterval) || 0 >= dblTradeInterval) - throw new java.lang.Exception ("PermanentImpactNoArbitrage::modulate => Invalid Inputs"); - - return dblTradeInterval * _afp.dailyVolatility(); - } - - @Override public double slope() - { - return org.drip.execution.athl.CalibrationEmpirics.PERMANENT_IMPACT_COEFFICIENT * - _dblLiquidityFactor; - } - - @Override public double offset() - { - return 0.; - } - - @Override public double evaluate ( - final double dblNormalizedX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblNormalizedX)) - throw new java.lang.Exception ("PermanentImpactNoArbitrage::evaluate => Invalid Inputs"); - - return 0.5 * org.drip.execution.athl.CalibrationEmpirics.PERMANENT_IMPACT_COEFFICIENT * - dblNormalizedX * _dblLiquidityFactor; - } - - @Override public double derivative ( - final double dblNormalizedX, - final int iOrder) - throws java.lang.Exception - { - if (0 >= iOrder || !org.drip.quant.common.NumberUtil.IsValid (dblNormalizedX)) - throw new java.lang.Exception ("PermanentImpactNoArbitrage::derivative => Invalid Inputs"); - - return 1 < iOrder ? 0. : 0.5 * - org.drip.execution.athl.CalibrationEmpirics.PERMANENT_IMPACT_COEFFICIENT * _dblLiquidityFactor; - } -} diff --git a/org/drip/execution/athl/PermanentImpactQuasiArbitrage.java b/org/drip/execution/athl/PermanentImpactQuasiArbitrage.java deleted file mode 100644 index 86ecf10..0000000 --- a/org/drip/execution/athl/PermanentImpactQuasiArbitrage.java +++ /dev/null @@ -1,179 +0,0 @@ - -package org.drip.execution.athl; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PermanentImpactQuasiArbitrage implements the Linear Permanent Market Impact with Coefficients that have - * been determined empirically by Almgren, Thum, Hauptmann, and Li (2005), independent of the no - * Quasi-Arbitrage Criterion identified by Huberman and Stanzl (2004). The References are: - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Huberman, G., and W. Stanzl (2004): Price Manipulation and Quasi-arbitrage, Econometrica 72 (4) - * 1247-1275. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class PermanentImpactQuasiArbitrage extends org.drip.execution.impact.TransactionFunctionPower { - private double _dblLiquidityFactor = java.lang.Double.NaN; - private org.drip.execution.parameters.AssetFlowSettings _afp = null; - - /** - * PermanentImpactQuasiArbitrage Constructor - * - * @param afp The Asset Flow Parameters - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public PermanentImpactQuasiArbitrage ( - final org.drip.execution.parameters.AssetFlowSettings afp) - throws java.lang.Exception - { - if (null == (_afp = afp)) - throw new java.lang.Exception ("PermanentImpactQuasiArbitrage Constructor => Invalid Inputs"); - - _dblLiquidityFactor = java.lang.Math.pow (afp.inverseTurnover(), - org.drip.execution.athl.CalibrationEmpirics.PERMANENT_IMPACT_INVERSE_TURNOVER_EXPONENT); - } - - /** - * Retrieve the Liquidity Factor - * - * @return The Liquidity Factor - */ - - public double liquidityFactor() - { - return _dblLiquidityFactor; - } - - /** - * Retrieve the Asset Flow Parameters - * - * @return The Asset Flow Parameters - */ - - public org.drip.execution.parameters.AssetFlowSettings assetFlowParameters() - { - return _afp; - } - - @Override public double regularize ( - final double dblTradeInterval) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblTradeInterval) || 0 >= dblTradeInterval) - throw new java.lang.Exception ("PermanentImpactQuasiArbitrage::regularize => Invalid Inputs"); - - return 1. / (_afp.averageDailyVolume() * dblTradeInterval); - } - - @Override public double modulate ( - final double dblTradeInterval) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblTradeInterval) || 0 >= dblTradeInterval) - throw new java.lang.Exception ("PermanentImpactQuasiArbitrage::modulate => Invalid Inputs"); - - return dblTradeInterval * _afp.dailyVolatility(); - } - - @Override public double constant() - { - return org.drip.execution.athl.CalibrationEmpirics.PERMANENT_IMPACT_COEFFICIENT * - _dblLiquidityFactor; - } - - @Override public double exponent() - { - return org.drip.execution.athl.CalibrationEmpirics.PERMANENT_IMPACT_EXPONENT_ATHL2005; - } - - @Override public double evaluate ( - final double dblNormalizedX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblNormalizedX)) - throw new java.lang.Exception ("PermanentImpactQuasiArbitrage::evaluate => Invalid Inputs"); - - double dblAlpha = org.drip.execution.athl.CalibrationEmpirics.PERMANENT_IMPACT_EXPONENT_ATHL2005; - double dblGamma = org.drip.execution.athl.CalibrationEmpirics.PERMANENT_IMPACT_COEFFICIENT; - - return 0.5 * dblGamma * (dblNormalizedX < 0. ? -1. : 1.) * java.lang.Math.pow (java.lang.Math.abs - (dblNormalizedX), dblAlpha) * _dblLiquidityFactor; - } - - @Override public double derivative ( - final double dblNormalizedX, - final int iOrder) - throws java.lang.Exception - { - if (0 >= iOrder || !org.drip.quant.common.NumberUtil.IsValid (dblNormalizedX)) - throw new java.lang.Exception ("PermanentImpactQuasiArbitrage::derivative => Invalid Inputs"); - - double dblCoefficient = 1.; - double dblAlpha = org.drip.execution.athl.CalibrationEmpirics.PERMANENT_IMPACT_EXPONENT_ATHL2005; - double dblGamma = org.drip.execution.athl.CalibrationEmpirics.PERMANENT_IMPACT_COEFFICIENT; - - for (int i = 0; i < iOrder; ++i) - dblCoefficient = dblCoefficient * (dblAlpha - i); - - return 0.5 * dblGamma * (dblNormalizedX < 0. ? -1. : 1.) * dblCoefficient * java.lang.Math.pow - (java.lang.Math.abs (dblNormalizedX), dblAlpha - iOrder) * _dblLiquidityFactor; - } -} diff --git a/org/drip/execution/athl/TemporaryImpact.java b/org/drip/execution/athl/TemporaryImpact.java deleted file mode 100644 index c46d670..0000000 --- a/org/drip/execution/athl/TemporaryImpact.java +++ /dev/null @@ -1,159 +0,0 @@ - -package org.drip.execution.athl; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TemporaryImpact implements the Temporary Market Impact with Exponent/Coefficients that have been - * determined empirically by Almgren, Thum, Hauptmann, and Li (2005), using the Parameterization of Almgren - * (2003). The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class TemporaryImpact extends org.drip.execution.impact.TransactionFunctionPower { - private org.drip.execution.parameters.AssetFlowSettings _afp = null; - - /** - * TemporaryImpact Constructor - * - * @param afp The Asset Flow Parameters - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public TemporaryImpact ( - final org.drip.execution.parameters.AssetFlowSettings afp) - throws java.lang.Exception - { - if (null == (_afp = afp)) - throw new java.lang.Exception ("TemporaryImpact Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Asset Flow Parameters - * - * @return The Asset Flow Parameters - */ - - public org.drip.execution.parameters.AssetFlowSettings assetFlowParameters() - { - return _afp; - } - - @Override public double regularize ( - final double dblTradeInterval) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblTradeInterval) || 0 >= dblTradeInterval) - throw new java.lang.Exception ("TemporaryImpact::regularize => Invalid Inputs"); - - return 1. / (_afp.averageDailyVolume() * dblTradeInterval); - } - - @Override public double modulate ( - final double dblTradeInterval) - throws java.lang.Exception - { - return _afp.dailyVolatility(); - } - - @Override public double constant() - { - return org.drip.execution.athl.CalibrationEmpirics.TEMPORARY_IMPACT_COEFFICIENT; - } - - @Override public double exponent() - { - return org.drip.execution.athl.CalibrationEmpirics.TEMPORARY_IMPACT_EXPONENT; - } - - @Override public double evaluate ( - final double dblNormalizedX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblNormalizedX)) - throw new java.lang.Exception ("TemporaryImpact::evaluate => Invalid Inputs"); - - double dblBeta = org.drip.execution.athl.CalibrationEmpirics.TEMPORARY_IMPACT_EXPONENT; - double dblEta = org.drip.execution.athl.CalibrationEmpirics.TEMPORARY_IMPACT_COEFFICIENT; - - return dblEta * (dblNormalizedX < 0. ? -1. : 1.) * java.lang.Math.pow (java.lang.Math.abs - (dblNormalizedX), dblBeta); - } - - @Override public double derivative ( - final double dblNormalizedX, - final int iOrder) - throws java.lang.Exception - { - if (0 >= iOrder || !org.drip.quant.common.NumberUtil.IsValid (dblNormalizedX)) - throw new java.lang.Exception ("TemporaryImpact::derivative => Invalid Inputs"); - - double dblCoefficient = 1.; - double dblBeta = org.drip.execution.athl.CalibrationEmpirics.TEMPORARY_IMPACT_EXPONENT; - double dblEta = org.drip.execution.athl.CalibrationEmpirics.TEMPORARY_IMPACT_COEFFICIENT; - - for (int i = 0; i < iOrder; ++i) - dblCoefficient = dblCoefficient * (dblBeta - i); - - return dblEta * (dblNormalizedX < 0. ? -1. : 1.) * dblCoefficient * java.lang.Math.pow - (java.lang.Math.abs (dblNormalizedX), dblBeta - iOrder); - } -} diff --git a/org/drip/execution/athl/TransactionRealization.java b/org/drip/execution/athl/TransactionRealization.java deleted file mode 100644 index 91db18b..0000000 --- a/org/drip/execution/athl/TransactionRealization.java +++ /dev/null @@ -1,207 +0,0 @@ - -package org.drip.execution.athl; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TransactionRealization holds the Suite of Empirical Drift/Wander Signals that have been emitted off of a - * Transaction Run using the Scheme by Almgren, Thum, Hauptmann, and Li (2005), using the Parameterization - * of Almgren (2003). The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class TransactionRealization { - private double _dblT = java.lang.Double.NaN; - private double _dblX = java.lang.Double.NaN; - private double _dblTPost = java.lang.Double.NaN; - private double _dblTSQRT = java.lang.Double.NaN; - private double _dblVolatility = java.lang.Double.NaN; - private org.drip.execution.impact.TransactionFunction _tfPermanent = null; - private org.drip.execution.impact.TransactionFunction _tfTemporary = null; - - /** - * TransactionRealization Constructor - * - * @param tfPermanent The Permanent Market Impact Transaction Function - * @param tfTemporary The Temporary Market Impact Transaction Function - * @param dblVolatility The Asset Daily Volatility - * @param dblX The Transaction Amount - * @param dblT The Transaction Completion Time in Days - * @param dblTPost The Transaction Completion Time in Days Adjusted for the Permanent Lag - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public TransactionRealization ( - final org.drip.execution.impact.TransactionFunction tfPermanent, - final org.drip.execution.impact.TransactionFunction tfTemporary, - final double dblVolatility, - final double dblX, - final double dblT, - final double dblTPost) - throws java.lang.Exception - { - if (null == (_tfPermanent = tfPermanent) || null == (_tfTemporary = tfTemporary) || - !org.drip.quant.common.NumberUtil.IsValid (_dblVolatility = dblVolatility) || 0. > _dblVolatility - || !org.drip.quant.common.NumberUtil.IsValid (_dblX = dblX) || - !org.drip.quant.common.NumberUtil.IsValid (_dblT = dblT) || 0. > _dblT || - !org.drip.quant.common.NumberUtil.IsValid (_dblTPost = dblTPost) || _dblT >= - _dblTPost) - throw new java.lang.Exception ("TransactionRealization Constructor => Invalid Inputs"); - - _dblTSQRT = java.lang.Math.sqrt (_dblT); - } - - /** - * Retrieve the Permanent Market Impact Transaction Function - * - * @return The Permanent Market Impact Transaction Function - */ - - public org.drip.execution.impact.TransactionFunction permanentMarketImpactFunction() - { - return _tfPermanent; - } - - /** - * Retrieve the Temporary Market Impact Transaction Function - * - * @return The Temporary Market Impact Transaction Function - */ - - public org.drip.execution.impact.TransactionFunction temporaryMarketImpactFunction() - { - return _tfTemporary; - } - - /** - * Retrieve the Asset Daily Volatility - * - * @return The Asset Daily Volatility - */ - - public double volatility() - { - return _dblVolatility; - } - - /** - * Retrieve the Transaction Amount X - * - * @return The Transaction Amount X - */ - - public double x() - { - return _dblX; - } - - /** - * Retrieve the Transaction Completion Time T in Days - * - * @return The Transaction Completion Time T in Days - */ - - public double t() - { - return _dblT; - } - - /** - * Retrieve the Transaction Completion Time in Days Adjusted for the Permanent Lag TPost - * - * @return The Transaction Completion Time in Days Adjusted for the Permanent Lag TPost - */ - - public double tPost() - { - return _dblTPost; - } - - /** - * Emit the IJK Signal - * - * @param dblIRandom The Random "I" Instance - * @param dblJRandom The Random "J" Instance - * - * @return The IJK Signal Instance - */ - - public org.drip.execution.athl.IJK emitSignal ( - final double dblIRandom, - final double dblJRandom) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblIRandom) || - !org.drip.quant.common.NumberUtil.IsValid (dblJRandom)) - return null; - - try { - return new org.drip.execution.athl.IJK (new org.drip.execution.athl.TransactionSignal - (_tfPermanent.evaluate (_dblX, _dblT), _dblVolatility * _dblTSQRT * dblIRandom, 0.), new - org.drip.execution.athl.TransactionSignal (_tfTemporary.evaluate (_dblX, _dblT), - _dblVolatility * java.lang.Math.sqrt (_dblT / 12. * (4. - (3. * _dblT / _dblTPost))) - * dblJRandom, 0.5 * (_dblTPost - _dblT) / _dblTSQRT * dblIRandom)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/athl/TransactionSignal.java b/org/drip/execution/athl/TransactionSignal.java deleted file mode 100644 index 1b49026..0000000 --- a/org/drip/execution/athl/TransactionSignal.java +++ /dev/null @@ -1,129 +0,0 @@ - -package org.drip.execution.athl; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TransactionSignal holds the Realized Empirical Signals that have been emitted off of a Transaction Run, - * decomposed using the Scheme by Almgren, Thum, Hauptmann, and Li (2005), based off of the Parameterization - * of Almgren (2003). The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class TransactionSignal { - private double _dblDrift = java.lang.Double.NaN; - private double _dblIWander = java.lang.Double.NaN; - private double _dblJWander = java.lang.Double.NaN; - - /** - * TransactionSignal Constructor - * - * @param dblDrift The Signal Drift - * @param dblIWander The "I" Signal Wander - * @param dblJWander The "J" Signal Wander - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public TransactionSignal ( - final double dblDrift, - final double dblIWander, - final double dblJWander) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblDrift = dblDrift) || - !org.drip.quant.common.NumberUtil.IsValid (_dblIWander = dblIWander) || - !org.drip.quant.common.NumberUtil.IsValid (_dblJWander = dblJWander)) - throw new java.lang.Exception ("TransactionSignal Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Drift of the Transaction Signal - * - * @return The Drift of the Transaction Signal - */ - - public double drift() - { - return _dblDrift; - } - - /** - * Retrieve the "I" Component Wander of the Transaction Signal - * - * @return The "I" Component Wander of the Transaction Signal - */ - - public double iWander() - { - return _dblIWander; - } - - /** - * Retrieve the "J" Component Wander of the Transaction Signal - * - * @return The "J" Component Wander of the Transaction Signal - */ - - public double jWander() - { - return _dblJWander; - } -} diff --git a/org/drip/execution/bayesian/ConditionalPriceDistribution.java b/org/drip/execution/bayesian/ConditionalPriceDistribution.java deleted file mode 100644 index 6b4e9bd..0000000 --- a/org/drip/execution/bayesian/ConditionalPriceDistribution.java +++ /dev/null @@ -1,178 +0,0 @@ - -package org.drip.execution.bayesian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ConditionalPriceDistribution holds the Price Distribution Conditional on a given Drift. The References - * are: - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets 1 - * 1-50. - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Brunnermeier, L. K., and L. H. Pedersen (2005): Predatory Trading, Journal of Finance 60 (4) 1825-1863. - * - * - Almgren, R., and J. Lorenz (2006): Bayesian Adaptive Trading with a Daily Cycle, Journal of Trading 1 - * (4) 38-46. - * - * - Kissell, R., and R. Malamut (2007): Algorithmic Decision Making Framework, Journal of Trading 1 (1) - * 12-21. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConditionalPriceDistribution extends org.drip.measure.gaussian.R1UnivariateNormal { - private double _dblTime = java.lang.Double.NaN; - private double _dblPriceVolatility = java.lang.Double.NaN; - private double _dblConditionalDrift = java.lang.Double.NaN; - - /** - * ConditionalPriceDistribution Constructor - * - * @param dblConditionalDrift The Conditional Drift - * @param dblPriceVolatility The Price Volatility - * @param dblTime The Distribution Time Horizon - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ConditionalPriceDistribution ( - final double dblConditionalDrift, - final double dblPriceVolatility, - final double dblTime) - throws java.lang.Exception - { - super (dblConditionalDrift * dblTime, dblPriceVolatility * java.lang.Math.sqrt (dblTime)); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblTime = dblTime) || 0. >= _dblTime || - !org.drip.quant.common.NumberUtil.IsValid (_dblConditionalDrift = dblConditionalDrift) || - !org.drip.quant.common.NumberUtil.IsValid (_dblPriceVolatility = dblPriceVolatility)) - throw new java.lang.Exception ("ConditionalPriceDistribution Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Distribution Time Horizon - * - * @return The Distribution Time Horizon - */ - - public double time() - { - return _dblTime; - } - - /** - * Retrieve the Distribution Price Volatility - * - * @return The Distribution Price Volatility - */ - - public double priceVolatility() - { - return _dblPriceVolatility; - } - - /** - * Retrieve the Distribution Conditional Drift - * - * @return The Distribution Conditional Drift - */ - - public double conditionalDrift() - { - return _dblConditionalDrift; - } - - /** - * Generate s Single Price Volatility Swings - * - * @return The Price Volatility Swings - * - * @throws java.lang.Exception Thrown if the Swing cannot be generated - */ - - public double priceVolatilitySwing() - throws java.lang.Exception - { - return _dblPriceVolatility * org.drip.measure.gaussian.NormalQuadrature.InverseCDF - (java.lang.Math.random()) * java.lang.Math.sqrt (_dblTime); - } - - /** - * Generate the given Number of Price Volatility Swings - * - * @param iNumRealization The Number of Swings to be generated - * - * @return Array of the Price Volatility Swings - */ - - public double[] priceVolatilitySwings ( - final int iNumRealization) - { - if (0 >= iNumRealization) return null; - - double[] adblVolatilitySwings = new double[iNumRealization]; - - double dblVolatilityTimeSQRT = _dblPriceVolatility * java.lang.Math.sqrt (_dblTime); - - for (int i = 0; i < iNumRealization; ++i) { - try { - adblVolatilitySwings[i] = org.drip.measure.gaussian.NormalQuadrature.InverseCDF - (java.lang.Math.random()) * dblVolatilityTimeSQRT; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return adblVolatilitySwings; - } -} diff --git a/org/drip/execution/bayesian/PriorConditionalCombiner.java b/org/drip/execution/bayesian/PriorConditionalCombiner.java deleted file mode 100644 index 553982a..0000000 --- a/org/drip/execution/bayesian/PriorConditionalCombiner.java +++ /dev/null @@ -1,167 +0,0 @@ - -package org.drip.execution.bayesian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PriorConditionalCombiner holds the Distributions associated with the Prior Drift and the Conditional Price - * Distributions. It uses them to generate the resulting Joint, Posterior, and MAP Implied Posterior - * Distributions. The References are: - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets 1 - * 1-50. - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Brunnermeier, L. K., and L. H. Pedersen (2005): Predatory Trading, Journal of Finance 60 (4) 1825-1863. - * - * - Almgren, R., and J. Lorenz (2006): Bayesian Adaptive Trading with a Daily Cycle, Journal of Trading 1 - * (4) 38-46. - * - * - Kissell, R., and R. Malamut (2007): Algorithmic Decision Making Framework, Journal of Trading 1 (1) - * 12-21. - * - * @author Lakshmi Krishnamurthy - */ - -public class PriorConditionalCombiner { - private org.drip.execution.bayesian.PriorDriftDistribution _pdd = null; - private org.drip.execution.bayesian.ConditionalPriceDistribution _cpd = null; - - /** - * PriorConditionalCombiner Constructor - * - * @param pdd The Prior Drift Distribution Instance - * @param cpd The Conditional Price Distribution Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public PriorConditionalCombiner ( - final org.drip.execution.bayesian.PriorDriftDistribution pdd, - final org.drip.execution.bayesian.ConditionalPriceDistribution cpd) - throws java.lang.Exception - { - if (null == (_pdd = pdd) || null == (_cpd = cpd)) - throw new java.lang.Exception ("PriorConditionalCombiner Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Prior Drift Distribution Instance - * - * @return The Prior Drift Distribution Instance - */ - - public org.drip.execution.bayesian.PriorDriftDistribution prior() - { - return _pdd; - } - - /** - * Retrieve the Conditional Price Distribution Instance - * - * @return The Conditional Price Distribution Instance - */ - - public org.drip.execution.bayesian.ConditionalPriceDistribution conditional() - { - return _cpd; - } - - /** - * Generate the Joint Price Distribution - * - * @return The Joint Price Distribution - */ - - public org.drip.measure.gaussian.R1UnivariateNormal jointPriceDistribution() - { - double dblTime = _cpd.time(); - - try { - return new org.drip.measure.gaussian.R1UnivariateNormal (_pdd.expectation() * dblTime, - _pdd.variance() * dblTime * dblTime +_cpd.variance()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Posterior Drift Distribution - * - * @param dblDeltaS The Price Change (Final - Initial) - * - * @return The Posterior Drift Distribution - */ - - public org.drip.measure.gaussian.R1UnivariateNormal posteriorDriftDistribution ( - final double dblDeltaS) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblDeltaS)) return null; - - double dblT = _cpd.time(); - - double dblNuSquared = _pdd.variance(); - - double dblSigmaSquared = _cpd.variance() / dblT; - - double dblPrecisionSquared = 1. / (dblSigmaSquared + dblNuSquared * dblT); - - try { - return new org.drip.measure.gaussian.R1UnivariateNormal ((_pdd.expectation() * dblSigmaSquared + - dblNuSquared * dblDeltaS) * dblPrecisionSquared, dblSigmaSquared * dblNuSquared * - dblPrecisionSquared); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/bayesian/PriorDriftDistribution.java b/org/drip/execution/bayesian/PriorDriftDistribution.java deleted file mode 100644 index 5caa16d..0000000 --- a/org/drip/execution/bayesian/PriorDriftDistribution.java +++ /dev/null @@ -1,144 +0,0 @@ - -package org.drip.execution.bayesian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PriorDriftDistribution holds the Prior Belief Distribution associated with the Directional Drift. The - * References are: - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets 1 - * 1-50. - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Brunnermeier, L. K., and L. H. Pedersen (2005): Predatory Trading, Journal of Finance 60 (4) 1825-1863. - * - * - Almgren, R., and J. Lorenz (2006): Bayesian Adaptive Trading with a Daily Cycle, Journal of Trading 1 - * (4) 38-46. - * - * - Kissell, R., and R. Malamut (2007): Algorithmic Decision Making Framework, Journal of Trading 1 (1) - * 12-21. - * - * @author Lakshmi Krishnamurthy - */ - -public class PriorDriftDistribution extends org.drip.measure.gaussian.R1UnivariateNormal { - - /** - * Construct an Instance of Prior Drift Distribution - * - * @param dblExpectation Expectation of the Prior Drift - * @param dblConfidence Confidence of the Prior Drift - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public PriorDriftDistribution ( - final double dblExpectation, - final double dblConfidence) - throws java.lang.Exception - { - super (dblExpectation, dblConfidence); - } - - /** - * Retrieve the Expectation of the Prior Drift Distribution - * - * @return The Expectation of the Prior Drift Distribution - */ - - public double expectation() - { - return mean(); - } - - /** - * Retrieve the Confidence of the Prior Drift Distribution - * - * @return The Confidence of the Prior Drift Distribution - */ - - public double confidence() - { - return java.lang.Math.sqrt (variance()); - } - - /** - * Generate the given Number of Bayesian Drift Realizations - * - * @param iNumRealization The Number of Realizations to be generated - * - * @return Array of the Drift Realizations - */ - - public double[] realizedDrift ( - final int iNumRealization) - { - if (0 >= iNumRealization) return null; - - double[] adblRealizedDrift = new double[iNumRealization]; - - double dblConfidence = confidence(); - - double dblExpectation = mean(); - - for (int i = 0; i < iNumRealization; ++i) { - try { - adblRealizedDrift[i] = dblExpectation + dblConfidence * - org.drip.measure.gaussian.NormalQuadrature.InverseCDF (java.lang.Math.random()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return adblRealizedDrift; - } -} diff --git a/org/drip/execution/capture/LinearImpactBlockTrajectoryEstimator.java b/org/drip/execution/capture/LinearImpactBlockTrajectoryEstimator.java deleted file mode 100644 index 10558f9..0000000 --- a/org/drip/execution/capture/LinearImpactBlockTrajectoryEstimator.java +++ /dev/null @@ -1,114 +0,0 @@ - -package org.drip.execution.capture; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * LinearImpactBlockTrajectoryEstimator estimates the Price/Cost Distribution associated with the Single - * Block Trading Trajectory generated using the Linear Market Impact Evolution Parameters. The References - * are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class LinearImpactBlockTrajectoryEstimator extends - org.drip.execution.capture.TrajectoryShortfallEstimator { - - /** - * LinearImpactBlockTrajectoryCost Constructor - * - * @param mvttBlock The Block (i.e., Minimum Variance) Trading Trajectory - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public LinearImpactBlockTrajectoryEstimator ( - final org.drip.execution.strategy.MinimumVarianceTradingTrajectory mvttBlock) - throws java.lang.Exception - { - super (mvttBlock); - } - - @Override public org.drip.measure.gaussian.R1UnivariateNormal totalCostDistributionSynopsis ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - if (null == apep) return null; - - org.drip.execution.impact.TransactionFunctionLinear tflTemporaryExpectation = - (org.drip.execution.impact.TransactionFunctionLinear) - apep.temporaryExpectation().epochImpactFunction(); - - org.drip.execution.strategy.MinimumImpactTradingTrajectory mitt = - (org.drip.execution.strategy.MinimumImpactTradingTrajectory) trajectory(); - - double dblBlockSize = mitt.tradeSize(); - - try { - return new org.drip.measure.gaussian.R1UnivariateNormal (tflTemporaryExpectation.offset() * - java.lang.Math.abs (dblBlockSize) + tflTemporaryExpectation.slope() * dblBlockSize * - dblBlockSize / mitt.executionTime(), 0.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/capture/LinearImpactTrajectoryEstimator.java b/org/drip/execution/capture/LinearImpactTrajectoryEstimator.java deleted file mode 100644 index 44ffaca..0000000 --- a/org/drip/execution/capture/LinearImpactTrajectoryEstimator.java +++ /dev/null @@ -1,155 +0,0 @@ - -package org.drip.execution.capture; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * LinearImpactTrajectoryEstimator estimates the Price/Cost Distribution associated with the Trading - * Trajectory generated using the Linear Market Impact Evolution Parameters. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class LinearImpactTrajectoryEstimator extends org.drip.execution.capture.TrajectoryShortfallEstimator -{ - - /** - * LinearImpactTrajectoryEstimator Constructor - * - * @param tt The Trading Trajectory Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public LinearImpactTrajectoryEstimator ( - final org.drip.execution.strategy.DiscreteTradingTrajectory tt) - throws java.lang.Exception - { - super (tt); - } - - @Override public org.drip.measure.gaussian.R1UnivariateNormal totalCostDistributionSynopsis ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - if (null == apep) return null; - - double dblMarketCoreVolatility = java.lang.Double.NaN; - org.drip.execution.dynamics.LinearPermanentExpectationParameters lpep = - (org.drip.execution.dynamics.LinearPermanentExpectationParameters) apep; - - double dblPermanentLinearImpactParameter = ((org.drip.execution.impact.TransactionFunctionLinear) - lpep.linearPermanentExpectation().epochImpactFunction()).slope(); - - org.drip.execution.impact.TransactionFunctionLinear tflTemporaryExpectation = - (org.drip.execution.impact.TransactionFunctionLinear) - apep.temporaryExpectation().epochImpactFunction(); - - double dblTemporaryLinearImpactParameter = tflTemporaryExpectation.slope(); - - double dblTemporaryOffsetImpactParameter = tflTemporaryExpectation.offset(); - - org.drip.execution.strategy.DiscreteTradingTrajectory tt = trajectory(); - - double[] adblExecutionTimeNode = tt.executionTimeNode(); - - org.drip.execution.parameters.ArithmeticPriceDynamicsSettings apds = - lpep.arithmeticPriceDynamicsSettings(); - - try { - dblMarketCoreVolatility = apds.epochVolatility(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - double dblMarketCoreDrift = apds.drift(); - - double[] adblHoldings = tt.holdings(); - - int iNumTimeNode = adblHoldings.length; - double dblUnscaledTotalCostVariance = 0.; - double dblTotalCostMean = 0.5 * dblPermanentLinearImpactParameter * adblHoldings[0] * - adblHoldings[0]; - - for (int i = 1; i < iNumTimeNode; ++i) { - double dblHoldingsIncrement = adblHoldings[i] - adblHoldings[i - 1]; - double dblTimeInterval = adblExecutionTimeNode[i] - adblExecutionTimeNode[i - 1]; - dblUnscaledTotalCostVariance = dblUnscaledTotalCostVariance + dblTimeInterval * adblHoldings[i] * - adblHoldings[i]; - - dblTotalCostMean = dblTotalCostMean + dblTemporaryOffsetImpactParameter * java.lang.Math.abs - (dblHoldingsIncrement) + (dblTemporaryLinearImpactParameter - 0.5 * - dblPermanentLinearImpactParameter * dblTimeInterval) / dblTimeInterval * - dblHoldingsIncrement * dblHoldingsIncrement - dblMarketCoreDrift * dblTimeInterval * - adblHoldings[i]; - } - - try { - return new org.drip.measure.gaussian.R1UnivariateNormal (dblTotalCostMean, - dblMarketCoreVolatility * java.lang.Math.sqrt (dblUnscaledTotalCostVariance)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/capture/LinearImpactUniformTrajectoryEstimator.java b/org/drip/execution/capture/LinearImpactUniformTrajectoryEstimator.java deleted file mode 100644 index 066f361..0000000 --- a/org/drip/execution/capture/LinearImpactUniformTrajectoryEstimator.java +++ /dev/null @@ -1,137 +0,0 @@ - -package org.drip.execution.capture; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * LinearImpactUniformTrajectoryEstimator estimates the Price/Cost Distribution associated with the Uniform - * Trading Trajectory generated using the Linear Market Impact Evolution Parameters. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class LinearImpactUniformTrajectoryEstimator extends - org.drip.execution.capture.TrajectoryShortfallEstimator { - - /** - * LinearImpactUniformTrajectoryEstimator Constructor - * - * @param mittUniform The Uniform (i.e., Minimum Impact) Trading Trajectory - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public LinearImpactUniformTrajectoryEstimator ( - final org.drip.execution.strategy.MinimumImpactTradingTrajectory mittUniform) - throws java.lang.Exception - { - super (mittUniform); - } - - @Override public org.drip.measure.gaussian.R1UnivariateNormal totalCostDistributionSynopsis ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - if (null == apep) return null; - - org.drip.execution.strategy.MinimumImpactTradingTrajectory mitt = - (org.drip.execution.strategy.MinimumImpactTradingTrajectory) trajectory(); - - double dblBlockSize = mitt.tradeSize(); - - double dblExecutionTime = mitt.executionTime(); - - double dblNumberOfTradesReciprocal = 1. / mitt.numberOfTrades(); - - double dblMarketCoreVolatility = java.lang.Double.NaN; - double dblBlockSizeSquared = dblBlockSize * dblBlockSize; - org.drip.execution.dynamics.LinearPermanentExpectationParameters lpep = - (org.drip.execution.dynamics.LinearPermanentExpectationParameters) apep; - - double dblPermanentLinearImpactParameter = ((org.drip.execution.impact.TransactionFunctionLinear) - lpep.linearPermanentExpectation().epochImpactFunction()).slope(); - - org.drip.execution.impact.TransactionFunctionLinear tflTemporaryExpectation = - (org.drip.execution.impact.TransactionFunctionLinear) - apep.temporaryExpectation().epochImpactFunction(); - - try { - dblMarketCoreVolatility = apep.arithmeticPriceDynamicsSettings().epochVolatility(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - try { - return new org.drip.measure.gaussian.R1UnivariateNormal (0.5 * dblPermanentLinearImpactParameter - * dblBlockSizeSquared + tflTemporaryExpectation.offset() * java.lang.Math.abs (dblBlockSize) - + (tflTemporaryExpectation.slope() - 0.5 * dblPermanentLinearImpactParameter * - mitt.tradeTimeInterval()) * dblBlockSizeSquared / dblExecutionTime, - dblMarketCoreVolatility * dblMarketCoreVolatility * dblBlockSizeSquared * - dblExecutionTime * (1. - dblNumberOfTradesReciprocal) * (1. - 0.5 * - dblNumberOfTradesReciprocal) / 3.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/capture/TrajectoryShortfallAggregate.java b/org/drip/execution/capture/TrajectoryShortfallAggregate.java deleted file mode 100644 index 23f1abf..0000000 --- a/org/drip/execution/capture/TrajectoryShortfallAggregate.java +++ /dev/null @@ -1,363 +0,0 @@ - -package org.drip.execution.capture; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TrajectoryShortfallAggregate aggregates the Execution Short-fall Distribution across each Interval in the - * Trade. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class TrajectoryShortfallAggregate { - private java.util.List _lsSID = null; - - /** - * TrajectoryShortfallAggregate Constructor - * - * @param lsSID List of the Incremental Slice Short-fall Distributions - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public TrajectoryShortfallAggregate ( - final java.util.List lsSID) - throws java.lang.Exception - { - if (null == (_lsSID = lsSID)) - throw new java.lang.Exception ("TrajectoryShortfallAggregate Constructor => Invalid Inputs"); - - int iNumInterval = _lsSID.size(); - - if (0 == iNumInterval) - throw new java.lang.Exception ("TrajectoryShortfallAggregate Constructor => Invalid Inputs"); - - for (org.drip.execution.discrete.ShortfallIncrementDistribution sid : _lsSID) { - if (null == sid) - throw new java.lang.Exception ("TrajectoryShortfallAggregate Constructor => Invalid Inputs"); - } - } - - /** - * Retrieve the List of the Interval Cost Distributions - * - * @return The List of the Interval Cost Distributions - */ - - public java.util.List list() - { - return _lsSID; - } - - /** - * Generate the Total Cost R^1 Normal Distribution - * - * @return The Total Cost R^1 Normal Distribution - */ - - public org.drip.measure.gaussian.R1UnivariateNormal totalCostDistribution() - { - double dblTotalCostMean = 0.; - double dblTotalCostVariance = 0.; - - for (org.drip.measure.gaussian.R1UnivariateNormal r1un : _lsSID) { - dblTotalCostMean = dblTotalCostMean + r1un.mean(); - - dblTotalCostVariance = dblTotalCostVariance + r1un.variance(); - } - - try { - return new org.drip.measure.gaussian.R1UnivariateNormal (dblTotalCostMean, java.lang.Math.sqrt - (dblTotalCostVariance)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Array of Incremental Expectation Sequence - * - * @return The Array of Incremental Expectation Sequence - */ - - public double[] incrementalExpectation() - { - int iNumInterval = _lsSID.size(); - - double[] adblIncrementalExpectationSequence = new double[iNumInterval]; - - for (int i = 0; i < iNumInterval; ++i) - adblIncrementalExpectationSequence[i] = _lsSID.get (i).mean(); - - return adblIncrementalExpectationSequence; - } - - /** - * Generate the Array of Cumulative Expectation Sequence - * - * @return The Array of Cumulative Expectation Sequence - */ - - public double[] cumulativeExpectation() - { - int iNumInterval = _lsSID.size(); - - double[] adblCumulativeExpectationSequence = new double[iNumInterval]; - - for (int i = 0; i < iNumInterval; ++i) - adblCumulativeExpectationSequence[i] = 0 == i ? _lsSID.get (i).expectation() : - adblCumulativeExpectationSequence[i - 1] + _lsSID.get (i).expectation(); - - return adblCumulativeExpectationSequence; - } - - /** - * Generate the Array of Incremental Variance Sequence - * - * @return The Array of Incremental Variance Sequence - */ - - public double[] incrementalVariance() - { - int iNumInterval = _lsSID.size(); - - double[] adblIncrementalVarianceSequence = new double[iNumInterval]; - - for (int i = 0; i < iNumInterval; ++i) - adblIncrementalVarianceSequence[i] = _lsSID.get (i).variance(); - - return adblIncrementalVarianceSequence; - } - - /** - * Generate the Array of Cumulative Variance Sequence - * - * @return The Array of Cumulative Variance Sequence - */ - - public double[] cumulativeVariance() - { - int iNumInterval = _lsSID.size(); - - double[] adblCumulativeVarianceSequence = new double[iNumInterval]; - - for (int i = 0; i < iNumInterval; ++i) - adblCumulativeVarianceSequence[i] = 0 == i ? _lsSID.get (i).variance() : - adblCumulativeVarianceSequence[i - 1] + _lsSID.get (i).variance(); - - return adblCumulativeVarianceSequence; - } - - /** - * Generate the Array of Incremental Market Dynamic Expectation Sequence - * - * @return The Array of Incremental Market Dynamic Expectation Sequence - */ - - public double[] incrementalMarketDynamicExpectation() - { - int iNumInterval = _lsSID.size(); - - double[] adblIncrementalMarketDynamicExpectationSequence = new double[iNumInterval]; - - for (int i = 0; i < iNumInterval; ++i) - adblIncrementalMarketDynamicExpectationSequence[i] = _lsSID.get (i).marketDynamicExpectation(); - - return adblIncrementalMarketDynamicExpectationSequence; - } - - /** - * Generate the Array of Cumulative Market Dynamic Expectation Sequence - * - * @return The Array of Cumulative Market Dynamic Expectation Sequence - */ - - public double[] cumulativeMarketDynamicExpectation() - { - int iNumInterval = _lsSID.size(); - - double[] adblCumulativeMarketDynamicExpectationSequence = new double[iNumInterval]; - - for (int i = 0; i < iNumInterval; ++i) - adblCumulativeMarketDynamicExpectationSequence[i] = 0 == i ? _lsSID.get - (i).marketDynamicExpectation() : adblCumulativeMarketDynamicExpectationSequence[i - 1] + - _lsSID.get (i).marketDynamicExpectation(); - - return adblCumulativeMarketDynamicExpectationSequence; - } - - /** - * Generate the Array of Incremental Permanent Impact Expectation Sequence - * - * @return The Array of Incremental Permanent Impact Expectation Sequence - */ - - public double[] incrementalPermanentImpactExpectation() - { - int iNumInterval = _lsSID.size(); - - double[] adblIncrementalPermanentImpactExpectationSequence = new double[iNumInterval]; - - for (int i = 0; i < iNumInterval; ++i) - adblIncrementalPermanentImpactExpectationSequence[i] = _lsSID.get - (i).permanentImpactExpectation(); - - return adblIncrementalPermanentImpactExpectationSequence; - } - - /** - * Generate the Array of Cumulative Permanent Impact Expectation Sequence - * - * @return The Array of Cumulative Permanent Impact Expectation Sequence - */ - - public double[] cumulativePermanentImpactExpectation() - { - int iNumInterval = _lsSID.size(); - - double[] adblCumulativePermanentImpactExpectationSequence = new double[iNumInterval]; - - for (int i = 0; i < iNumInterval; ++i) - adblCumulativePermanentImpactExpectationSequence[i] = 0 == i ? _lsSID.get - (i).permanentImpactExpectation() : adblCumulativePermanentImpactExpectationSequence[i - 1] + - _lsSID.get (i).permanentImpactExpectation(); - - return adblCumulativePermanentImpactExpectationSequence; - } - - /** - * Generate the Array of Incremental Temporary Impact Expectation Sequence - * - * @return The Array of Incremental Temporary Impact Expectation Sequence - */ - - public double[] incrementalTemporaryImpactExpectation() - { - int iNumInterval = _lsSID.size(); - - double[] adblIncrementalTemporaryImpactExpectationSequence = new double[iNumInterval]; - - for (int i = 0; i < iNumInterval; ++i) - adblIncrementalTemporaryImpactExpectationSequence[i] = _lsSID.get - (i).temporaryImpactExpectation(); - - return adblIncrementalTemporaryImpactExpectationSequence; - } - - /** - * Generate the Array of Cumulative Temporary Impact Expectation Sequence - * - * @return The Array of Cumulative Temporary Impact Expectation Sequence - */ - - public double[] cumulativeTemporaryImpactExpectation() - { - int iNumInterval = _lsSID.size(); - - double[] adblCumulativeTemporaryImpactExpectationSequence = new double[iNumInterval]; - - for (int i = 0; i < iNumInterval; ++i) - adblCumulativeTemporaryImpactExpectationSequence[i] = 0 == i ? _lsSID.get - (i).temporaryImpactExpectation() : adblCumulativeTemporaryImpactExpectationSequence[i - 1] + - _lsSID.get (i).temporaryImpactExpectation(); - - return adblCumulativeTemporaryImpactExpectationSequence; - } - - /** - * Generate the Expected Short-fall - * - * @return The Expected Short-fall - */ - - public double shortfallExpectation() - { - int iNumInterval = _lsSID.size(); - - double dblExpectedShortfall = 0.; - - for (int i = 0; i < iNumInterval; ++i) - dblExpectedShortfall = dblExpectedShortfall + _lsSID.get (i).expectation(); - - return dblExpectedShortfall; - } - - /** - * Generate the Short-fall Variance - * - * @return The Short-fall Variance - */ - - public double shortfallVariance() - { - int iNumInterval = _lsSID.size(); - - double dblShortfallVariance = 0.; - - for (int i = 0; i < iNumInterval; ++i) - dblShortfallVariance = dblShortfallVariance + _lsSID.get (i).variance(); - - return dblShortfallVariance; - } -} diff --git a/org/drip/execution/capture/TrajectoryShortfallEstimator.java b/org/drip/execution/capture/TrajectoryShortfallEstimator.java deleted file mode 100644 index 1694a30..0000000 --- a/org/drip/execution/capture/TrajectoryShortfallEstimator.java +++ /dev/null @@ -1,729 +0,0 @@ - -package org.drip.execution.capture; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TrajectoryShortfallEstimator estimates the Price/Short Fall Distribution associated with the Trading - * Trajectory generated using the specified Evolution Parameters. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class TrajectoryShortfallEstimator implements - org.drip.execution.sensitivity.ControlNodesGreekGenerator { - private org.drip.execution.strategy.DiscreteTradingTrajectory _tt = null; - - /** - * TrajectoryShortfallEstimator Constructor - * - * @param tt The Trading Trajectory Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public TrajectoryShortfallEstimator ( - final org.drip.execution.strategy.DiscreteTradingTrajectory tt) - throws java.lang.Exception - { - if (null == (_tt = tt)) - throw new java.lang.Exception ("TrajectoryShortfallEstimator Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Underlying Trading Trajectory Instance - * - * @return The Underlying Trading Trajectory Instance - */ - - public org.drip.execution.strategy.DiscreteTradingTrajectory trajectory() - { - return _tt; - } - - /** - * Generate the Detailed Cost Realization Sequence given the Specified Inputs - * - * @param dblStartingEquilibriumPrice The Starting Equilibrium Price - * @param aWS Array of the Realized Walk Random Variable Suite - * @param apep The Price Evolution Parameters - * - * @return The Detailed Cost Realization Sequence given the Specified Inputs - */ - - public org.drip.execution.capture.TrajectoryShortfallRealization totalCostRealizationDetail ( - final double dblStartingEquilibriumPrice, - final org.drip.execution.dynamics.WalkSuite[] aWS, - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblStartingEquilibriumPrice) || null == aWS) - return null; - - double[] adblExecutionTimeNode = _tt.executionTimeNode(); - - double[] adblHoldings = _tt.holdings(); - - int iNumTimeNode = adblExecutionTimeNode.length; - double dblPreviousEquilibriumPrice = dblStartingEquilibriumPrice; - - if (aWS.length + 1 != iNumTimeNode) return null; - - java.util.List lsSI = new - java.util.ArrayList(); - - for (int i = 1; i < iNumTimeNode; ++i) { - org.drip.execution.discrete.ShortfallIncrement si = null; - - try { - si = ( new org.drip.execution.discrete.Slice (adblHoldings[i - 1], adblHoldings[i], - adblExecutionTimeNode[i] - adblExecutionTimeNode[i - 1])).costIncrementRealization - (dblPreviousEquilibriumPrice, aWS[i - 1], apep); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (null == si) return null; - - lsSI.add (si); - - dblPreviousEquilibriumPrice = si.compositePriceIncrement().newEquilibriumPrice(); - } - - try { - return new org.drip.execution.capture.TrajectoryShortfallRealization (lsSI); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Detailed Total Cost Distribution for the Trading Trajectory - * - * @param apep The Price Evolution Parameters - * - * @return The Detailed Total Cost Distribution for the Trading Trajectory - */ - - public org.drip.execution.capture.TrajectoryShortfallAggregate totalCostDistributionDetail ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - double[] adblExecutionTimeNode = _tt.executionTimeNode(); - - double[] adblHoldings = _tt.holdings(); - - int iNumTimeNode = adblExecutionTimeNode.length; - - java.util.List lsSID = new - java.util.ArrayList(); - - for (int i = 1; i < iNumTimeNode; ++i) { - org.drip.execution.discrete.Slice s = null; - - try { - s = new org.drip.execution.discrete.Slice (adblHoldings[i - 1], adblHoldings[i], - adblExecutionTimeNode[i] - adblExecutionTimeNode[i - 1]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - lsSID.add (s.costIncrementDistribution (apep)); - } - - try { - return new org.drip.execution.capture.TrajectoryShortfallAggregate (lsSID); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Total Cost Distribution Synopsis Distribution for the Trading Trajectory - * - * @param apep Arithmetic Price Evolution Parameters Instance - * - * @return The Total Cost Distribution Synopsis Distribution for the Trading Trajectory - */ - - public org.drip.measure.gaussian.R1UnivariateNormal totalCostDistributionSynopsis ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - org.drip.execution.capture.TrajectoryShortfallAggregate tsa = totalCostDistributionDetail (apep); - - return null == tsa ? null : tsa.totalCostDistribution(); - } - - @Override public org.drip.execution.sensitivity.ControlNodesGreek permanentImpactExpectation ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - double[] adblExecutionTimeNode = _tt.executionTimeNode(); - - double dblValue = 0.; - int iNumTimeNode = adblExecutionTimeNode.length; - double[] adblTrajectoryJacobian = new double[iNumTimeNode]; - double[][] aadblTrajectoryHessian = new double[iNumTimeNode][iNumTimeNode]; - - double[] adblHoldings = _tt.holdings(); - - java.util.List lsCNG = new - java.util.ArrayList(); - - for (int i = 1; i < iNumTimeNode; ++i) { - org.drip.execution.discrete.Slice s = null; - - try { - s = new org.drip.execution.discrete.Slice (adblHoldings[i - 1], adblHoldings[i], - adblExecutionTimeNode[i] - adblExecutionTimeNode[i - 1]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.execution.sensitivity.ControlNodesGreek cng = s.permanentImpactExpectation (apep); - - if (null == cng) return null; - - lsCNG.add (cng); - - dblValue = dblValue + cng.value(); - - double[] adblSliceJacobian = cng.jacobian(); - - double[][] aadblSliceHessian = cng.hessian(); - - adblTrajectoryJacobian[i] = adblTrajectoryJacobian[i] + adblSliceJacobian[1]; - adblTrajectoryJacobian[i - 1] = adblTrajectoryJacobian[i - 1] + adblSliceJacobian[0]; - aadblTrajectoryHessian[i][i] = aadblTrajectoryHessian[i][i] + aadblSliceHessian[1][1]; - aadblTrajectoryHessian[i][i - 1] = aadblTrajectoryHessian[i][i - 1] + aadblSliceHessian[1][0]; - aadblTrajectoryHessian[i - 1][i] = aadblTrajectoryHessian[i - 1][i] + aadblSliceHessian[0][1]; - aadblTrajectoryHessian[i - 1][i - 1] = aadblTrajectoryHessian[i - 1][i - 1] + - aadblSliceHessian[0][0]; - } - - try { - return new org.drip.execution.sensitivity.TrajectoryControlNodesGreek (dblValue, - adblTrajectoryJacobian, aadblTrajectoryHessian, lsCNG); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.execution.sensitivity.ControlNodesGreek permanentImpactVariance ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - double[] adblExecutionTimeNode = _tt.executionTimeNode(); - - double dblValue = 0.; - int iNumTimeNode = adblExecutionTimeNode.length; - double[] adblTrajectoryJacobian = new double[iNumTimeNode]; - double[][] aadblTrajectoryHessian = new double[iNumTimeNode][iNumTimeNode]; - - double[] adblHoldings = _tt.holdings(); - - java.util.List lsCNG = new - java.util.ArrayList(); - - for (int i = 1; i < iNumTimeNode; ++i) { - org.drip.execution.discrete.Slice s = null; - - try { - s = new org.drip.execution.discrete.Slice (adblHoldings[i - 1], adblHoldings[i], - adblExecutionTimeNode[i] - adblExecutionTimeNode[i - 1]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.execution.sensitivity.ControlNodesGreek cng = s.permanentImpactVariance (apep); - - if (null == cng) return null; - - lsCNG.add (cng); - - dblValue = dblValue + cng.value(); - - double[] adblSliceJacobian = cng.jacobian(); - - double[][] aadblSliceHessian = cng.hessian(); - - adblTrajectoryJacobian[i] = adblTrajectoryJacobian[i] + adblSliceJacobian[1]; - adblTrajectoryJacobian[i - 1] = adblTrajectoryJacobian[i - 1] + adblSliceJacobian[0]; - aadblTrajectoryHessian[i][i] = aadblTrajectoryHessian[i][i] + aadblSliceHessian[1][1]; - aadblTrajectoryHessian[i][i - 1] = aadblTrajectoryHessian[i][i - 1] + aadblSliceHessian[1][0]; - aadblTrajectoryHessian[i - 1][i] = aadblTrajectoryHessian[i - 1][i] + aadblSliceHessian[0][1]; - aadblTrajectoryHessian[i - 1][i - 1] = aadblTrajectoryHessian[i - 1][i - 1] + - aadblSliceHessian[0][0]; - } - - try { - return new org.drip.execution.sensitivity.TrajectoryControlNodesGreek (dblValue, - adblTrajectoryJacobian, aadblTrajectoryHessian, lsCNG); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.execution.sensitivity.ControlNodesGreek temporaryImpactExpectation ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - double[] adblExecutionTimeNode = _tt.executionTimeNode(); - - double dblValue = 0.; - int iNumTimeNode = adblExecutionTimeNode.length; - double[] adblTrajectoryJacobian = new double[iNumTimeNode]; - double[][] aadblTrajectoryHessian = new double[iNumTimeNode][iNumTimeNode]; - - double[] adblHoldings = _tt.holdings(); - - java.util.List lsCNG = new - java.util.ArrayList(); - - for (int i = 1; i < iNumTimeNode; ++i) { - org.drip.execution.discrete.Slice s = null; - - try { - s = new org.drip.execution.discrete.Slice (adblHoldings[i - 1], adblHoldings[i], - adblExecutionTimeNode[i] - adblExecutionTimeNode[i - 1]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.execution.sensitivity.ControlNodesGreek cng = s.temporaryImpactExpectation (apep); - - if (null == cng) return null; - - lsCNG.add (cng); - - dblValue = dblValue + cng.value(); - - double[] adblSliceJacobian = cng.jacobian(); - - double[][] aadblSliceHessian = cng.hessian(); - - adblTrajectoryJacobian[i] = adblTrajectoryJacobian[i] + adblSliceJacobian[1]; - adblTrajectoryJacobian[i - 1] = adblTrajectoryJacobian[i - 1] + adblSliceJacobian[0]; - aadblTrajectoryHessian[i][i] = aadblTrajectoryHessian[i][i] + aadblSliceHessian[1][1]; - aadblTrajectoryHessian[i][i - 1] = aadblTrajectoryHessian[i][i - 1] + aadblSliceHessian[1][0]; - aadblTrajectoryHessian[i - 1][i] = aadblTrajectoryHessian[i - 1][i] + aadblSliceHessian[0][1]; - aadblTrajectoryHessian[i - 1][i - 1] = aadblTrajectoryHessian[i - 1][i - 1] + - aadblSliceHessian[0][0]; - } - - try { - return new org.drip.execution.sensitivity.TrajectoryControlNodesGreek (dblValue, - adblTrajectoryJacobian, aadblTrajectoryHessian, lsCNG); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.execution.sensitivity.ControlNodesGreek temporaryImpactVariance ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - double[] adblExecutionTimeNode = _tt.executionTimeNode(); - - double dblValue = 0.; - int iNumTimeNode = adblExecutionTimeNode.length; - double[] adblTrajectoryJacobian = new double[iNumTimeNode]; - double[][] aadblTrajectoryHessian = new double[iNumTimeNode][iNumTimeNode]; - - double[] adblHoldings = _tt.holdings(); - - java.util.List lsCNG = new - java.util.ArrayList(); - - for (int i = 1; i < iNumTimeNode; ++i) { - org.drip.execution.discrete.Slice s = null; - - try { - s = new org.drip.execution.discrete.Slice (adblHoldings[i - 1], adblHoldings[i], - adblExecutionTimeNode[i] - adblExecutionTimeNode[i - 1]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.execution.sensitivity.ControlNodesGreek cng = s.temporaryImpactVariance (apep); - - if (null == cng) return null; - - lsCNG.add (cng); - - dblValue = dblValue + cng.value(); - - double[] adblSliceJacobian = cng.jacobian(); - - double[][] aadblSliceHessian = cng.hessian(); - - adblTrajectoryJacobian[i] = adblTrajectoryJacobian[i] + adblSliceJacobian[1]; - adblTrajectoryJacobian[i - 1] = adblTrajectoryJacobian[i - 1] + adblSliceJacobian[0]; - aadblTrajectoryHessian[i][i] = aadblTrajectoryHessian[i][i] + aadblSliceHessian[1][1]; - aadblTrajectoryHessian[i][i - 1] = aadblTrajectoryHessian[i][i - 1] + aadblSliceHessian[1][0]; - aadblTrajectoryHessian[i - 1][i] = aadblTrajectoryHessian[i - 1][i] + aadblSliceHessian[0][1]; - aadblTrajectoryHessian[i - 1][i - 1] = aadblTrajectoryHessian[i - 1][i - 1] + - aadblSliceHessian[0][0]; - } - - try { - return new org.drip.execution.sensitivity.TrajectoryControlNodesGreek (dblValue, - adblTrajectoryJacobian, aadblTrajectoryHessian, lsCNG); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.execution.sensitivity.ControlNodesGreek marketDynamicsExpectation ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - double[] adblExecutionTimeNode = _tt.executionTimeNode(); - - double dblValue = 0.; - int iNumTimeNode = adblExecutionTimeNode.length; - double[] adblTrajectoryJacobian = new double[iNumTimeNode]; - double[][] aadblTrajectoryHessian = new double[iNumTimeNode][iNumTimeNode]; - - double[] adblHoldings = _tt.holdings(); - - java.util.List lsCNG = new - java.util.ArrayList(); - - for (int i = 1; i < iNumTimeNode; ++i) { - org.drip.execution.discrete.Slice s = null; - - try { - s = new org.drip.execution.discrete.Slice (adblHoldings[i - 1], adblHoldings[i], - adblExecutionTimeNode[i] - adblExecutionTimeNode[i - 1]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.execution.sensitivity.ControlNodesGreek cng = s.marketDynamicsExpectation (apep); - - if (null == cng) return null; - - lsCNG.add (cng); - - dblValue = dblValue + cng.value(); - - double[] adblSliceJacobian = cng.jacobian(); - - double[][] aadblSliceHessian = cng.hessian(); - - adblTrajectoryJacobian[i] = adblTrajectoryJacobian[i] + adblSliceJacobian[1]; - adblTrajectoryJacobian[i - 1] = adblTrajectoryJacobian[i - 1] + adblSliceJacobian[0]; - aadblTrajectoryHessian[i][i] = aadblTrajectoryHessian[i][i] + aadblSliceHessian[1][1]; - aadblTrajectoryHessian[i][i - 1] = aadblTrajectoryHessian[i][i - 1] + aadblSliceHessian[1][0]; - aadblTrajectoryHessian[i - 1][i] = aadblTrajectoryHessian[i - 1][i] + aadblSliceHessian[0][1]; - aadblTrajectoryHessian[i - 1][i - 1] = aadblTrajectoryHessian[i - 1][i - 1] + - aadblSliceHessian[0][0]; - } - - try { - return new org.drip.execution.sensitivity.TrajectoryControlNodesGreek (dblValue, - adblTrajectoryJacobian, aadblTrajectoryHessian, lsCNG); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.execution.sensitivity.ControlNodesGreek marketDynamicsVariance ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - double[] adblExecutionTimeNode = _tt.executionTimeNode(); - - double dblValue = 0.; - int iNumTimeNode = adblExecutionTimeNode.length; - double[] adblTrajectoryJacobian = new double[iNumTimeNode]; - double[][] aadblTrajectoryHessian = new double[iNumTimeNode][iNumTimeNode]; - - double[] adblHoldings = _tt.holdings(); - - java.util.List lsCNG = new - java.util.ArrayList(); - - for (int i = 1; i < iNumTimeNode; ++i) { - org.drip.execution.discrete.Slice s = null; - - try { - s = new org.drip.execution.discrete.Slice (adblHoldings[i - 1], adblHoldings[i], - adblExecutionTimeNode[i] - adblExecutionTimeNode[i - 1]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.execution.sensitivity.ControlNodesGreek cng = s.marketDynamicsVariance (apep); - - if (null == cng) return null; - - lsCNG.add (cng); - - dblValue = dblValue + cng.value(); - - double[] adblSliceJacobian = cng.jacobian(); - - double[][] aadblSliceHessian = cng.hessian(); - - adblTrajectoryJacobian[i] = adblTrajectoryJacobian[i] + adblSliceJacobian[1]; - adblTrajectoryJacobian[i - 1] = adblTrajectoryJacobian[i - 1] + adblSliceJacobian[0]; - aadblTrajectoryHessian[i][i] = aadblTrajectoryHessian[i][i] + aadblSliceHessian[1][1]; - aadblTrajectoryHessian[i][i - 1] = aadblTrajectoryHessian[i][i - 1] + aadblSliceHessian[1][0]; - aadblTrajectoryHessian[i - 1][i] = aadblTrajectoryHessian[i - 1][i] + aadblSliceHessian[0][1]; - aadblTrajectoryHessian[i - 1][i - 1] = aadblTrajectoryHessian[i - 1][i - 1] + - aadblSliceHessian[0][0]; - } - - try { - return new org.drip.execution.sensitivity.TrajectoryControlNodesGreek (dblValue, - adblTrajectoryJacobian, aadblTrajectoryHessian, lsCNG); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.execution.sensitivity.ControlNodesGreek expectationContribution ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - double[] adblExecutionTimeNode = _tt.executionTimeNode(); - - double dblValue = 0.; - int iNumTimeNode = adblExecutionTimeNode.length; - double[] adblTrajectoryJacobian = new double[iNumTimeNode]; - double[][] aadblTrajectoryHessian = new double[iNumTimeNode][iNumTimeNode]; - - double[] adblHoldings = _tt.holdings(); - - java.util.List lsCNG = new - java.util.ArrayList(); - - for (int i = 1; i < iNumTimeNode; ++i) { - org.drip.execution.discrete.Slice s = null; - - try { - s = new org.drip.execution.discrete.Slice (adblHoldings[i - 1], adblHoldings[i], - adblExecutionTimeNode[i] - adblExecutionTimeNode[i - 1]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.execution.sensitivity.ControlNodesGreek cng = s.expectationContribution (apep); - - if (null == cng) return null; - - lsCNG.add (cng); - - dblValue = dblValue + cng.value(); - - double[] adblSliceJacobian = cng.jacobian(); - - double[][] aadblSliceHessian = cng.hessian(); - - adblTrajectoryJacobian[i] = adblTrajectoryJacobian[i] + adblSliceJacobian[1]; - adblTrajectoryJacobian[i - 1] = adblTrajectoryJacobian[i - 1] + adblSliceJacobian[0]; - aadblTrajectoryHessian[i][i] = aadblTrajectoryHessian[i][i] + aadblSliceHessian[1][1]; - aadblTrajectoryHessian[i][i - 1] = aadblTrajectoryHessian[i][i - 1] + aadblSliceHessian[1][0]; - aadblTrajectoryHessian[i - 1][i] = aadblTrajectoryHessian[i - 1][i] + aadblSliceHessian[0][1]; - aadblTrajectoryHessian[i - 1][i - 1] = aadblTrajectoryHessian[i - 1][i - 1] + - aadblSliceHessian[0][0]; - } - - try { - return new org.drip.execution.sensitivity.TrajectoryControlNodesGreek (dblValue, - adblTrajectoryJacobian, aadblTrajectoryHessian, lsCNG); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.execution.sensitivity.ControlNodesGreek varianceContribution ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - double[] adblExecutionTimeNode = _tt.executionTimeNode(); - - double dblValue = 0.; - int iNumTimeNode = adblExecutionTimeNode.length; - double[] adblTrajectoryJacobian = new double[iNumTimeNode]; - double[][] aadblTrajectoryHessian = new double[iNumTimeNode][iNumTimeNode]; - - double[] adblHoldings = _tt.holdings(); - - java.util.List lsCNG = new - java.util.ArrayList(); - - for (int i = 1; i < iNumTimeNode; ++i) { - org.drip.execution.discrete.Slice s = null; - - try { - s = new org.drip.execution.discrete.Slice (adblHoldings[i - 1], adblHoldings[i], - adblExecutionTimeNode[i] - adblExecutionTimeNode[i - 1]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.execution.sensitivity.ControlNodesGreek cng = s.varianceContribution (apep); - - if (null == cng) return null; - - lsCNG.add (cng); - - dblValue = dblValue + cng.value(); - - double[] adblSliceJacobian = cng.jacobian(); - - double[][] aadblSliceHessian = cng.hessian(); - - adblTrajectoryJacobian[i] = adblTrajectoryJacobian[i] + adblSliceJacobian[1]; - adblTrajectoryJacobian[i - 1] = adblTrajectoryJacobian[i - 1] + adblSliceJacobian[0]; - aadblTrajectoryHessian[i][i] = aadblTrajectoryHessian[i][i] + aadblSliceHessian[1][1]; - aadblTrajectoryHessian[i][i - 1] = aadblTrajectoryHessian[i][i - 1] + aadblSliceHessian[1][0]; - aadblTrajectoryHessian[i - 1][i] = aadblTrajectoryHessian[i - 1][i] + aadblSliceHessian[0][1]; - aadblTrajectoryHessian[i - 1][i - 1] = aadblTrajectoryHessian[i - 1][i - 1] + - aadblSliceHessian[0][0]; - } - - try { - return new org.drip.execution.sensitivity.TrajectoryControlNodesGreek (dblValue, - adblTrajectoryJacobian, aadblTrajectoryHessian, lsCNG); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Estimate the Optimal Adjustment Attributable to the Serial Correlation - * - * @param apep The Arithmetic Price Walk Parameters - * - * @return The Optimal Adjustment Attributable to the Serial Correlation - */ - - public org.drip.execution.discrete.OptimalSerialCorrelationAdjustment[] serialCorrelationAdjustment ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - double[] adblExecutionTimeNode = _tt.executionTimeNode(); - - int iNumTimeNode = adblExecutionTimeNode.length; - org.drip.execution.discrete.OptimalSerialCorrelationAdjustment[] aOSCA = new - org.drip.execution.discrete.OptimalSerialCorrelationAdjustment[iNumTimeNode]; - - double[] adblHoldings = _tt.holdings(); - - try { - aOSCA[0] = new org.drip.execution.discrete.OptimalSerialCorrelationAdjustment (0., 0.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int i = 1; i < iNumTimeNode; ++i) { - org.drip.execution.discrete.Slice s = null; - - try { - s = new org.drip.execution.discrete.Slice (adblHoldings[i - 1], adblHoldings[i], - adblExecutionTimeNode[i] - adblExecutionTimeNode[i - 1]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (null == (aOSCA[i] = s.serialCorrelationAdjustment (apep))) return null; - } - - return aOSCA; - } -} diff --git a/org/drip/execution/capture/TrajectoryShortfallRealization.java b/org/drip/execution/capture/TrajectoryShortfallRealization.java deleted file mode 100644 index abdab62..0000000 --- a/org/drip/execution/capture/TrajectoryShortfallRealization.java +++ /dev/null @@ -1,441 +0,0 @@ - -package org.drip.execution.capture; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TrajectoryShortfallRealization holds Execution Cost Realization across each Interval in the Trade during a - * Single Simulation Run. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class TrajectoryShortfallRealization { - private java.util.List _lsSI = null; - - /** - * TrajectoryShortfallRealization Constructor - * - * @param lsSI List of the Composite Slice Short-fall Increments - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public TrajectoryShortfallRealization ( - final java.util.List lsSI) - throws java.lang.Exception - { - if (null == (_lsSI = lsSI)) - throw new java.lang.Exception ("TrajectoryShortfallRealization Constructor => Invalid Inputs"); - - int iNumSlice = _lsSI.size(); - - if (0 == iNumSlice) - throw new java.lang.Exception ("TrajectoryShortfallRealization Constructor => Invalid Inputs"); - - for (org.drip.execution.discrete.ShortfallIncrement si : _lsSI) { - if (null == si) - throw new java.lang.Exception - ("TrajectoryShortfallRealization Constructor => Invalid Inputs"); - } - } - - /** - * Retrieve the List of the Realized Composite Cost Increments - * - * @return The List of the Realized Composite Cost Increments - */ - - public java.util.List list() - { - return _lsSI; - } - - /** - * Generate the Array of Incremental Market Dynamic Cost Drift - * - * @return The Array of Incremental Market Dynamic Cost Drift - */ - - public double[] incrementalMarketDynamicDrift() - { - int iNumInterval = _lsSI.size(); - - double[] adblIncrementalMarketDynamicDrift = new double[iNumInterval]; - - for (int i = 0; i < iNumInterval; ++i) - adblIncrementalMarketDynamicDrift[i] = _lsSI.get (i).marketDynamicDrift(); - - return adblIncrementalMarketDynamicDrift; - } - - /** - * Generate the Array of Cumulative Market Dynamic Cost Drift - * - * @return The Array of Cumulative Market Dynamic Cost Drift - */ - - public double[] cumulativeMarketDynamicDrift() - { - int iNumInterval = _lsSI.size(); - - double[] adblCumulativeMarketDynamicDrift = new double[iNumInterval]; - - for (int i = 0; i < iNumInterval; ++i) - adblCumulativeMarketDynamicDrift[i] = 0 == i ? _lsSI.get (i).marketDynamicDrift() : _lsSI.get - (i).marketDynamicDrift() + adblCumulativeMarketDynamicDrift[i - 1]; - - return adblCumulativeMarketDynamicDrift; - } - - /** - * Generate the Total Market Dynamic Cost Drift - * - * @return The Total Market Dynamic Cost Drift - */ - - public double totalMarketDynamicDrift() - { - int iNumInterval = _lsSI.size(); - - double dblTotalMarketDynamicDrift = 0.; - - for (int i = 0; i < iNumInterval; ++i) - dblTotalMarketDynamicDrift = dblTotalMarketDynamicDrift + _lsSI.get (i).marketDynamicDrift(); - - return dblTotalMarketDynamicDrift; - } - - /** - * Generate the Array of Incremental Market Dynamic Cost Wander - * - * @return The Array of Incremental Market Dynamic Cost Wander - */ - - public double[] incrementalMarketDynamicWander() - { - int iNumInterval = _lsSI.size(); - - double[] adblIncrementalMarketDynamicWander = new double[iNumInterval]; - - for (int i = 0; i < iNumInterval; ++i) - adblIncrementalMarketDynamicWander[i] = _lsSI.get (i).marketDynamicWander(); - - return adblIncrementalMarketDynamicWander; - } - - /** - * Generate the Array of Cumulative Market Dynamic Cost Wander - * - * @return The Array of Cumulative Market Dynamic Cost Wander - */ - - public double[] cumulativeMarketDynamicWander() - { - int iNumInterval = _lsSI.size(); - - double[] adblCumulativeMarketDynamicWander = new double[iNumInterval]; - - for (int i = 0; i < iNumInterval; ++i) - adblCumulativeMarketDynamicWander[i] = 0 == i ? _lsSI.get (i).marketDynamicWander() : _lsSI.get - (i).marketDynamicWander() + adblCumulativeMarketDynamicWander[i - 1]; - - return adblCumulativeMarketDynamicWander; - } - - /** - * Generate the Total Market Dynamic Cost Wander - * - * @return The Total Market Dynamic Cost Wander - */ - - public double totalMarketDynamicWander() - { - int iNumInterval = _lsSI.size(); - - double dblTotalMarketDynamicWander = 0.; - - for (int i = 0; i < iNumInterval; ++i) - dblTotalMarketDynamicWander = dblTotalMarketDynamicWander + _lsSI.get (i).marketDynamicWander(); - - return dblTotalMarketDynamicWander; - } - - /** - * Generate the Array of Incremental Permanent Cost Drift - * - * @return The Array of Incremental Permanent Cost Drift - */ - - public double[] incrementalPermanentDrift() - { - int iNumInterval = _lsSI.size(); - - double[] adblIncrementalPermanentDrift = new double[iNumInterval]; - - for (int i = 0; i < iNumInterval; ++i) - adblIncrementalPermanentDrift[i] = _lsSI.get (i).permanentImpactDrift(); - - return adblIncrementalPermanentDrift; - } - - /** - * Generate the Array of Cumulative Permanent Cost Drift - * - * @return The Array of Cumulative Permanent Cost Drift - */ - - public double[] cumulativePermanentDrift() - { - int iNumInterval = _lsSI.size(); - - double[] adblCumulativePermanentDrift = new double[iNumInterval]; - - for (int i = 0; i < iNumInterval; ++i) - adblCumulativePermanentDrift[i] = 0 == i ? _lsSI.get (i).permanentImpactDrift() : _lsSI.get - (i).permanentImpactDrift() + adblCumulativePermanentDrift[i - 1]; - - return adblCumulativePermanentDrift; - } - - /** - * Generate the Total Permanent Cost Drift - * - * @return The Total Permanent Cost Drift - */ - - public double totalPermanentDrift() - { - int iNumInterval = _lsSI.size(); - - double dblTotalPermanentDrift = 0.; - - for (int i = 0; i < iNumInterval; ++i) - dblTotalPermanentDrift = dblTotalPermanentDrift + _lsSI.get (i).permanentImpactDrift(); - - return dblTotalPermanentDrift; - } - - /** - * Generate the Array of Incremental Permanent Cost Wander - * - * @return The Array of Incremental Permanent Cost Wander - */ - - public double[] incrementalPermanentWander() - { - int iNumInterval = _lsSI.size(); - - double[] adblIncrementalPermanentWander = new double[iNumInterval]; - - for (int i = 0; i < iNumInterval; ++i) - adblIncrementalPermanentWander[i] = _lsSI.get (i).permanentImpactWander(); - - return adblIncrementalPermanentWander; - } - - /** - * Generate the Array of Cumulative Permanent Cost Wander - * - * @return The Array of Cumulative Permanent Cost Wander - */ - - public double[] cumulativePermanentWander() - { - int iNumInterval = _lsSI.size(); - - double[] adblCumulativePermanentWander = new double[iNumInterval]; - - for (int i = 0; i < iNumInterval; ++i) - adblCumulativePermanentWander[i] = 0 == i ? _lsSI.get (i).permanentImpactWander() : _lsSI.get - (i).permanentImpactWander() + adblCumulativePermanentWander[i - 1]; - - return adblCumulativePermanentWander; - } - - /** - * Generate the Total Permanent Cost Wander - * - * @return The Total Permanent Cost Wander - */ - - public double totalPermanentWander() - { - int iNumInterval = _lsSI.size(); - - double dblTotalPermanentWander = 0.; - - for (int i = 0; i < iNumInterval; ++i) - dblTotalPermanentWander = dblTotalPermanentWander + _lsSI.get (i).permanentImpactWander(); - - return dblTotalPermanentWander; - } - - /** - * Generate the Array of Incremental Temporary Cost Drift - * - * @return The Array of Incremental Temporary Cost Drift - */ - - public double[] incrementalTemporaryDrift() - { - int iNumInterval = _lsSI.size(); - - double[] adblIncrementalTemporaryDrift = new double[iNumInterval]; - - for (int i = 0; i < iNumInterval; ++i) - adblIncrementalTemporaryDrift[i] = _lsSI.get (i).temporaryImpactDrift(); - - return adblIncrementalTemporaryDrift; - } - - /** - * Generate the Array of Cumulative Temporary Cost Drift - * - * @return The Array of Cumulative Temporary Cost Drift - */ - - public double[] cumulativeTemporaryDrift() - { - int iNumInterval = _lsSI.size(); - - double[] adblCumulativeTemporaryDrift = new double[iNumInterval]; - - for (int i = 0; i < iNumInterval; ++i) - adblCumulativeTemporaryDrift[i] = 0 == i ? _lsSI.get (i).temporaryImpactDrift() : _lsSI.get - (i).temporaryImpactDrift() + adblCumulativeTemporaryDrift[i - 1]; - - return adblCumulativeTemporaryDrift; - } - - /** - * Generate the Total Temporary Cost Drift - * - * @return The Total Temporary Cost Drift - */ - - public double totalTemporaryDrift() - { - int iNumInterval = _lsSI.size(); - - double dblTotalTemporaryDrift = 0.; - - for (int i = 0; i < iNumInterval; ++i) - dblTotalTemporaryDrift = dblTotalTemporaryDrift + _lsSI.get (i).temporaryImpactDrift(); - - return dblTotalTemporaryDrift; - } - - /** - * Generate the Array of Incremental Temporary Cost Wander - * - * @return The Array of Incremental Temporary Cost Wander - */ - - public double[] incrementalTemporaryWander() - { - int iNumInterval = _lsSI.size(); - - double[] adblIncrementalTemporaryWander = new double[iNumInterval]; - - for (int i = 0; i < iNumInterval; ++i) - adblIncrementalTemporaryWander[i] = _lsSI.get (i).temporaryImpactWander(); - - return adblIncrementalTemporaryWander; - } - - /** - * Generate the Array of Cumulative Temporary Cost Wander - * - * @return The Array of Cumulative Temporary Cost Wander - */ - - public double[] cumulativeTemporaryWander() - { - int iNumInterval = _lsSI.size(); - - double[] adblCumulativeTemporaryWander = new double[iNumInterval]; - - for (int i = 0; i < iNumInterval; ++i) - adblCumulativeTemporaryWander[i] = 0 == i ? _lsSI.get (i).temporaryImpactWander() : _lsSI.get - (i).temporaryImpactWander() + adblCumulativeTemporaryWander[i - 1]; - - return adblCumulativeTemporaryWander; - } - - /** - * Generate the Total Temporary Cost Wander - * - * @return The Total Temporary Cost Wander - */ - - public double totalTemporaryWander() - { - int iNumInterval = _lsSI.size(); - - double dblTotalTemporaryWander = 0.; - - for (int i = 0; i < iNumInterval; ++i) - dblTotalTemporaryWander = dblTotalTemporaryWander + _lsSI.get (i).temporaryImpactWander(); - - return dblTotalTemporaryWander; - } -} diff --git a/org/drip/execution/cost/ConstrainedLinearTemporaryImpact.java b/org/drip/execution/cost/ConstrainedLinearTemporaryImpact.java deleted file mode 100644 index 1a76aef..0000000 --- a/org/drip/execution/cost/ConstrainedLinearTemporaryImpact.java +++ /dev/null @@ -1,223 +0,0 @@ - -package org.drip.execution.cost; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ConstrainedLinearTemporaryImpact computes and holds the Optimal Trajectory under Trading Rate Sign - * Constraints using Linear Temporary Impact Function for the given set of Inputs. The References are: - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets 1 - * 1-50. - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Brunnermeier, L. K., and L. H. Pedersen (2005): Predatory Trading, Journal of Finance 60 (4) 1825-1863. - * - * - Almgren, R., and J. Lorenz (2006): Bayesian Adaptive Trading with a Daily Cycle, Journal of Trading 1 - * (4) 38-46. - * - * - Kissell, R., and R. Malamut (2007): Algorithmic Decision Making Framework, Journal of Trading 1 (1) - * 12-21. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConstrainedLinearTemporaryImpact extends org.drip.execution.cost.LinearTemporaryImpact { - private double _dblCriticalDrift = java.lang.Double.NaN; - private double _dblTradeStartTime = java.lang.Double.NaN; - private double _dblTradeFinishTime = java.lang.Double.NaN; - - /** - * Generate a ConstrainedLinearTemporaryImpact Instance - * - * @param dblSpotTime Spot Time - * @param dblFinishTime Finish Time - * @param dblSpotHoldings Spot Holdings - * @param pcc The Prior/Conditional Combiner - * @param dblGrossPriceChange The Gross Price Change - * @param tflTemporary The Temporary Linear Impact Function - * - * @return The ConstrainedLinearTemporaryImpact Instance - */ - - public static final ConstrainedLinearTemporaryImpact Standard ( - final double dblSpotTime, - final double dblFinishTime, - final double dblSpotHoldings, - final org.drip.execution.bayesian.PriorConditionalCombiner pcc, - final double dblGrossPriceChange, - final org.drip.execution.impact.TransactionFunctionLinear tflTemporary) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblSpotTime) || - !org.drip.quant.common.NumberUtil.IsValid (dblFinishTime) || - !org.drip.quant.common.NumberUtil.IsValid (dblSpotHoldings) || null == pcc || null == - tflTemporary) - return null; - - final double dblLiquidityCoefficient = tflTemporary.slope(); - - org.drip.measure.gaussian.R1UnivariateNormal r1unPosterior = pcc.posteriorDriftDistribution - (dblGrossPriceChange); - - if (null == r1unPosterior) return null; - - final double dblDriftEstimate = r1unPosterior.mean(); - - double dblTradeStartTime = dblSpotTime; - double dblTradeFinishTime = dblFinishTime; - double dblHorizon = dblFinishTime - dblSpotTime; - double dblInstantaneousTradeRate = java.lang.Double.NaN; - double dblCriticalDrift = 4. * dblLiquidityCoefficient * dblSpotHoldings / (dblHorizon * dblHorizon); - - if (dblDriftEstimate > dblCriticalDrift) { - dblTradeStartTime = dblSpotTime; - - dblInstantaneousTradeRate = java.lang.Math.sqrt (dblDriftEstimate * dblSpotHoldings / - dblLiquidityCoefficient); - - dblTradeFinishTime = dblSpotTime + java.lang.Math.sqrt (4. * dblLiquidityCoefficient * - dblSpotHoldings / dblDriftEstimate); - } else if (dblDriftEstimate < -1. * dblCriticalDrift) { - dblTradeFinishTime = dblFinishTime - java.lang.Math.sqrt (-4. * dblLiquidityCoefficient * - dblSpotHoldings / dblDriftEstimate); - - dblInstantaneousTradeRate = 0.; - dblTradeFinishTime = dblFinishTime; - } else - dblInstantaneousTradeRate = dblSpotHoldings / dblHorizon + dblDriftEstimate * dblHorizon / - dblLiquidityCoefficient; - - final double dblt = dblTradeStartTime; - final double dblT = dblTradeFinishTime; - - org.drip.function.definition.R1ToR1 r1ToR1Holdings = new org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTau) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblTau)) - throw new java.lang.Exception - ("ConstrainedLinearTemporaryImpact::Holdings::evaluate => Invalid Inputs"); - - if (dblTau <= dblt) return dblSpotHoldings; - - if (dblTau >= dblT) return 0.; - - return (dblT - dblTau) * (dblSpotHoldings / (dblT - dblt) - 0.25 * dblDriftEstimate * (dblTau - - dblt) / dblLiquidityCoefficient); - } - }; - - try { - return new ConstrainedLinearTemporaryImpact (dblSpotTime, dblFinishTime, dblSpotHoldings, pcc, - dblGrossPriceChange, tflTemporary, r1ToR1Holdings, dblInstantaneousTradeRate, - dblCriticalDrift, dblTradeStartTime, dblTradeFinishTime); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - protected ConstrainedLinearTemporaryImpact ( - final double dblSpotTime, - final double dblFinishTime, - final double dblSpotHoldings, - final org.drip.execution.bayesian.PriorConditionalCombiner pcc, - final double dblGrossPriceChange, - final org.drip.execution.impact.TransactionFunctionLinear tflTemporary, - final org.drip.function.definition.R1ToR1 r1ToR1Holdings, - final double dblInstantaneousTradeRate, - final double dblCriticalDrift, - final double dblTradeStartTime, - final double dblTradeFinishTime) - throws java.lang.Exception - { - super (dblSpotTime, dblFinishTime, dblSpotHoldings, pcc, dblGrossPriceChange, tflTemporary, - dblTradeFinishTime - dblTradeStartTime, r1ToR1Holdings, dblInstantaneousTradeRate); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblCriticalDrift = dblCriticalDrift) || - !org.drip.quant.common.NumberUtil.IsValid (_dblTradeStartTime = dblTradeStartTime) || - !org.drip.quant.common.NumberUtil.IsValid (_dblTradeFinishTime = dblTradeFinishTime)) - throw new java.lang.Exception ("ConstrainedLinearTemporaryImpact Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Critical Drift - * - * @return The Critical Drift - */ - - public double criticalDrift() - { - return _dblCriticalDrift; - } - - /** - * Retrieve the Trade Start Time - * - * @return The Trade Start Time - */ - - public double tradeStartTime() - { - return _dblTradeStartTime; - } - - /** - * Retrieve the Trade Finish Time - * - * @return The Trade Finish Time - */ - - public double tradeFinishTime() - { - return _dblTradeFinishTime; - } -} diff --git a/org/drip/execution/cost/LinearTemporaryImpact.java b/org/drip/execution/cost/LinearTemporaryImpact.java deleted file mode 100644 index 0cb072e..0000000 --- a/org/drip/execution/cost/LinearTemporaryImpact.java +++ /dev/null @@ -1,414 +0,0 @@ - -package org.drip.execution.cost; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * LinearTemporaryImpact computes and holds the Optimal Trajectory using the Linear Temporary Impact Function - * for the given set of Inputs. It provides a Default Unconstrained Trajectory Implementation. The - * References are: - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets 1 - * 1-50. - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Brunnermeier, L. K., and L. H. Pedersen (2005): Predatory Trading, Journal of Finance 60 (4) 1825-1863. - * - * - Almgren, R., and J. Lorenz (2006): Bayesian Adaptive Trading with a Daily Cycle, Journal of Trading 1 - * (4) 38-46. - * - * - Kissell, R., and R. Malamut (2007): Algorithmic Decision Making Framework, Journal of Trading 1 (1) - * 12-21. - * - * @author Lakshmi Krishnamurthy - */ - -public class LinearTemporaryImpact { - private double _dblSpotTime = java.lang.Double.NaN; - private double _dblFinishTime = java.lang.Double.NaN; - private double _dblSpotHoldings = java.lang.Double.NaN; - private double _dblGrossPriceChange = java.lang.Double.NaN; - private double _dblTransactionCostGain = java.lang.Double.NaN; - private double _dblStaticTransactionCost = java.lang.Double.NaN; - private double _dblInstantaneousTradeRate = java.lang.Double.NaN; - private org.drip.execution.bayesian.PriorConditionalCombiner _pcc = null; - private org.drip.execution.impact.TransactionFunctionLinear _tflTemporary = null; - private org.drip.execution.optimum.EfficientTradingTrajectoryContinuous _ectt = null; - - /** - * Generate an Unconstrained LinearTemporaryImpact Instance - * - * @param dblSpotTime Spot Time - * @param dblFinishTime Finish Time - * @param dblSpotHoldings Spot Holdings - * @param pcc The Prior/Conditional Combiner - * @param dblGrossPriceChange The Gross Price Change - * @param tflTemporary The Temporary Linear Impact Function - * - * @return The Unconstrained LinearTemporaryImpact Instance - */ - - public static final LinearTemporaryImpact Unconstrained ( - final double dblSpotTime, - final double dblFinishTime, - final double dblSpotHoldings, - final org.drip.execution.bayesian.PriorConditionalCombiner pcc, - final double dblGrossPriceChange, - final org.drip.execution.impact.TransactionFunctionLinear tflTemporary) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblSpotTime) || - !org.drip.quant.common.NumberUtil.IsValid (dblFinishTime) || - !org.drip.quant.common.NumberUtil.IsValid (dblSpotHoldings) || null == pcc || null == - tflTemporary) - return null; - - final double dblHorizon = dblFinishTime - dblSpotTime; - - org.drip.measure.gaussian.R1UnivariateNormal r1unPosterior = pcc.posteriorDriftDistribution - (dblGrossPriceChange); - - if (null == r1unPosterior) return null; - - final double dblScaledDrift = 0.25 * r1unPosterior.mean() / tflTemporary.slope(); - - org.drip.function.definition.R1ToR1 r1ToR1Holdings = new org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTau) - throws java.lang.Exception - { - if (0. >= dblHorizon) return 0.; - - if (!org.drip.quant.common.NumberUtil.IsValid (dblTau)) - throw new java.lang.Exception - ("LinearTemporaryImpact::Holdings::evaluate => Invalid Inputs"); - - if (dblTau <= dblSpotTime) return dblSpotHoldings; - - if (dblTau >= dblFinishTime) return 0.; - - return (dblFinishTime - dblTau) * (dblSpotHoldings / (dblFinishTime - dblSpotTime) - - dblScaledDrift * (dblTau - dblSpotTime)); - } - }; - - try { - return new LinearTemporaryImpact (dblSpotTime, dblFinishTime, dblSpotHoldings, pcc, - dblGrossPriceChange, tflTemporary, dblFinishTime - dblSpotTime, r1ToR1Holdings, 0 >= - dblHorizon ? 0. : dblSpotHoldings / dblHorizon + dblScaledDrift * dblHorizon); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - protected LinearTemporaryImpact ( - final double dblSpotTime, - final double dblFinishTime, - final double dblSpotHoldings, - final org.drip.execution.bayesian.PriorConditionalCombiner pcc, - final double dblGrossPriceChange, - final org.drip.execution.impact.TransactionFunctionLinear tflTemporary, - final double dblCharacteristicTime, - final org.drip.function.definition.R1ToR1 r1ToR1Holdings, - final double dblInstantaneousTradeRate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblSpotTime = dblSpotTime) || - !org.drip.quant.common.NumberUtil.IsValid (_dblFinishTime = dblFinishTime) || - !org.drip.quant.common.NumberUtil.IsValid (_dblSpotHoldings = dblSpotHoldings) || null == - (_pcc = pcc) || !org.drip.quant.common.NumberUtil.IsValid (_dblGrossPriceChange = - dblGrossPriceChange) || null == (_tflTemporary = tflTemporary) || null == - r1ToR1Holdings || !org.drip.quant.common.NumberUtil.IsValid - (_dblInstantaneousTradeRate = dblInstantaneousTradeRate)) - throw new java.lang.Exception ("LinearTemporaryImpact Constructor => Invalid Inputs"); - - final double dblLiquidityCoefficient = _tflTemporary.slope(); - - double dblDriftEstimate = _pcc.posteriorDriftDistribution (_dblGrossPriceChange).mean(); - - final double dblExecutionTime = _dblFinishTime - _dblSpotTime; - _dblStaticTransactionCost = _dblSpotHoldings * _dblSpotHoldings * dblLiquidityCoefficient / - dblExecutionTime + 0.5 * _dblSpotHoldings * dblDriftEstimate * dblExecutionTime - - dblExecutionTime * dblExecutionTime * dblExecutionTime * dblDriftEstimate * dblDriftEstimate - / (48. * dblLiquidityCoefficient); - - double dblDriftConfidence = _pcc.prior().confidence(); - - final double dblPriceVolatility = _pcc.conditional().priceVolatility(); - - org.drip.function.definition.R1ToR1 r1ToR1HoldingsSquared = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - double dblHoldings = r1ToR1Holdings.evaluate (dblTime); - - return dblHoldings * dblHoldings; - } - }; - - final double dblRho = dblPriceVolatility * dblPriceVolatility / (dblDriftConfidence * - dblDriftConfidence * dblExecutionTime); - - org.drip.function.definition.R1ToR1 r1ToR1Quadrature = new org.drip.function.definition.R1ToR1 (null) - { - @Override public double evaluate ( - final double dblDelta) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblDelta)) - throw new java.lang.Exception - ("LinearTemporaryImpact::r1ToR1Quadrature::evaluate => Invalid Inputs"); - - double dblRemainingTime = 1. - dblDelta; - double dblDimensionlessTime = dblDelta + dblRho; - return dblRemainingTime * dblRemainingTime * dblRemainingTime / (dblDimensionlessTime * - dblDimensionlessTime); - } - }; - - _dblTransactionCostGain = dblPriceVolatility * dblPriceVolatility * dblExecutionTime * - dblExecutionTime / (48. * linearTemporaryImpact().slope()) * r1ToR1Quadrature.integrate (0., 1.); - - org.drip.function.definition.R1ToR1 r1ToR1TradeRate = new org.drip.function.definition.R1ToR1 (null) - { - @Override public double evaluate ( - final double dblS) - throws java.lang.Exception - { - return r1ToR1Holdings.derivative (dblS, 1); - } - }; - - final org.drip.function.definition.R1ToR1 r1ToR1TransactionCostExpectationRate = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - double dblTradeRate = r1ToR1Holdings.derivative (dblTime, 1); - - return dblLiquidityCoefficient * dblLiquidityCoefficient * dblTradeRate * dblTradeRate; - } - }; - - org.drip.function.definition.R1ToR1 r1ToR1TransactionCostExpectation = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - return r1ToR1TransactionCostExpectationRate.integrate (dblTime, dblExecutionTime); - } - }; - - final org.drip.function.definition.R1ToR1 r1ToR1TransactionCostVarianceRate = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - double dblHoldings = r1ToR1Holdings.evaluate (dblTime); - - return dblPriceVolatility * dblPriceVolatility * dblHoldings * dblHoldings; - } - }; - - org.drip.function.definition.R1ToR1 r1ToR1TransactionCostVariance = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - return r1ToR1TransactionCostVarianceRate.integrate (dblTime, dblExecutionTime); - } - }; - - _ectt = new org.drip.execution.optimum.EfficientTradingTrajectoryContinuous (dblExecutionTime, - _dblStaticTransactionCost + _dblTransactionCostGain, dblPriceVolatility * dblPriceVolatility * - r1ToR1HoldingsSquared.integrate (_dblSpotTime, _dblFinishTime), dblCharacteristicTime, - dblLiquidityCoefficient * _dblSpotHoldings / (dblExecutionTime * dblLiquidityCoefficient - * java.lang.Math.sqrt (dblExecutionTime)), r1ToR1Holdings, r1ToR1TradeRate, - r1ToR1TransactionCostExpectation, r1ToR1TransactionCostVariance); - } - - /** - * Retrieve the Spot Time - * - * @return The Spot Time - */ - - public double spotTime() - { - return _dblSpotTime; - } - - /** - * Retrieve the Finish Time - * - * @return The Finish Time - */ - - public double finishTime() - { - return _dblFinishTime; - } - - /** - * Retrieve the Spot Holdings - * - * @return The Spot Holdings - */ - - public double spotHoldings() - { - return _dblSpotHoldings; - } - - /** - * Retrieve the Prior/Conditional Distributions Combiner - * - * @return The Prior/Conditional Distributions Combiner - */ - - public org.drip.execution.bayesian.PriorConditionalCombiner combiner() - { - return _pcc; - } - - /** - * Retrieve the Gross Price Change - * - * @return The Gross Price Change - */ - - public double grossPriceChange() - { - return _dblGrossPriceChange; - } - - /** - * Retrieve the Drift Expectation Estimate - * - * @return The Drift Expectation Estimate - */ - - public double driftExpectationEstimate() - { - return _pcc.posteriorDriftDistribution (_dblGrossPriceChange).mean(); - } - - /** - * Retrieve the Drift Volatility Estimate - * - * @return The Drift Volatility Estimate - */ - - public double driftVolatilityEstimate() - { - return java.lang.Math.sqrt (_pcc.posteriorDriftDistribution (_dblGrossPriceChange).variance()); - } - - /** - * Retrieve the Linear Temporary Market Impact Function - * - * @return The Linear Temporary Market Impact Function - */ - - public org.drip.execution.impact.TransactionFunctionLinear linearTemporaryImpact() - { - return _tflTemporary; - } - - /** - * Retrieve the Holdings Trajectory - * - * @return The Holdings Trajectory - */ - - public org.drip.execution.optimum.EfficientTradingTrajectoryContinuous trajectory() - { - return _ectt; - } - - /** - * Retrieve the Instantaneous Trade Rate - * - * @return The Instantaneous Trade Rate - */ - - public double instantaneousTradeRate() - { - return _dblInstantaneousTradeRate; - } - - /** - * Estimate of the Static Transaction Cost - * - * @return The Static Transaction Cost Estimate - */ - - public double staticTransactionCost() - { - return _dblStaticTransactionCost; - } - - /** - * Estimate the Transaction Cost Gain available from the Bayesian Drift - * - * @return The Transaction Cost Gain available from the Bayesian Drift - */ - - public double transactionCostGain() - { - return _dblTransactionCostGain; - } -} diff --git a/org/drip/execution/discrete/EvolutionIncrement.java b/org/drip/execution/discrete/EvolutionIncrement.java deleted file mode 100644 index 95137ef..0000000 --- a/org/drip/execution/discrete/EvolutionIncrement.java +++ /dev/null @@ -1,160 +0,0 @@ - -package org.drip.execution.discrete; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * EvolutionIncrement contains the Realized Stochastic Evolution Increments of the Price/Short-fall exhibited - * by an Asset owing to the Volatility and the Market Impact Factors over the Slice Time Interval. It is - * composed of Stochastic and Deterministic Price Increment Components. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class EvolutionIncrement extends org.drip.execution.evolution.MarketImpactComposite { - - /** - * EvolutionIncrement Constructor - * - * @param micDeterministic The Deterministic Market Impact Component Instance - * @param micStochastic The Stochastic Market Impact Component Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public EvolutionIncrement ( - final org.drip.execution.evolution.MarketImpactComponent micDeterministic, - final org.drip.execution.evolution.MarketImpactComponent micStochastic) - throws java.lang.Exception - { - super (micDeterministic, micStochastic); - } - - /** - * Retrieve the Change induced by Deterministic Asset Price Market Dynamic Drivers - * - * @return The Change induced by Deterministic Asset Price Market Dynamic Drivers - */ - - public double marketDynamicDrift() - { - org.drip.execution.evolution.MarketImpactComponent micDeterministic = deterministic(); - - return micDeterministic.previousStep() + micDeterministic.currentStep(); - } - - /** - * Retrieve the Change induced by Stochastic Asset Price Market Dynamic Drivers - * - * @return The Change induced by Stochastic Asset Price Market Dynamic Drivers - */ - - public double marketDynamicWander() - { - org.drip.execution.evolution.MarketImpactComponent micStochastic = stochastic(); - - return micStochastic.previousStep() + micStochastic.currentStep(); - } - - /** - * Retrieve the Change induced by the Deterministic Asset Price Permanent Market Impact Drivers - * - * @return The Change induced by the Deterministic Asset Price Permanent Market Impact Drivers - */ - - public double permanentImpactDrift() - { - return deterministic().permanentImpact(); - } - - /** - * Retrieve the Change induced by the Stochastic Asset Price Permanent Market Impact Drivers - * - * @return The Change induced by the Stochastic Asset Price Permanent Market Impact Drivers - */ - - public double permanentImpactWander() - { - return stochastic().permanentImpact(); - } - - /** - * Retrieve the Change induced by the Deterministic Asset Price Temporary Market Impact Drivers - * - * @return The Change induced by the Deterministic Asset Price Temporary Market Impact Drivers - */ - - public double temporaryImpactDrift() - { - return deterministic().temporaryImpact(); - } - - /** - * Retrieve the Change induced by the Stochastic Asset Price Temporary Market Impact Drivers - * - * @return The Change induced by the Stochastic Asset Price Temporary Market Impact Drivers - */ - - public double temporaryImpactWander() - { - return stochastic().temporaryImpact(); - } -} diff --git a/org/drip/execution/discrete/OptimalSerialCorrelationAdjustment.java b/org/drip/execution/discrete/OptimalSerialCorrelationAdjustment.java deleted file mode 100644 index e54fea9..0000000 --- a/org/drip/execution/discrete/OptimalSerialCorrelationAdjustment.java +++ /dev/null @@ -1,116 +0,0 @@ - -package org.drip.execution.discrete; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OptimalSerialCorrelationAdjustment contains an Estimate of the Optimal Adjustments attributable to Cross - * Period Serial Price Correlations over the Slice Time Interval. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class OptimalSerialCorrelationAdjustment { - private double _dblGain = java.lang.Double.NaN; - private double _dblHoldingsShift = java.lang.Double.NaN; - - /** - * OptimalSerialCorrelationAdjustment Constructor - * - * @param dblHoldingsShift The Optimal Holdings Shift - * @param dblGain The Optimal Gain - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public OptimalSerialCorrelationAdjustment ( - final double dblHoldingsShift, - final double dblGain) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblHoldingsShift = dblHoldingsShift) || - !org.drip.quant.common.NumberUtil.IsValid (_dblGain = dblGain)) - throw new java.lang.Exception - ("OptimalSerialCorrelationAdjustment Contructor => Invalid Inputs"); - } - - /** - * Retrieve the Optimal Gain - * - * @return The Optimal Gain - */ - - public double gain() - { - return _dblGain; - } - - /** - * Retrieve the Optimal Holdings Shift - * - * @return The Optimal Holdings Shift - */ - - public double holdingsShift() - { - return _dblHoldingsShift; - } -} diff --git a/org/drip/execution/discrete/PriceIncrement.java b/org/drip/execution/discrete/PriceIncrement.java deleted file mode 100644 index 562f4ac..0000000 --- a/org/drip/execution/discrete/PriceIncrement.java +++ /dev/null @@ -1,131 +0,0 @@ - -package org.drip.execution.discrete; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PriceIncrement contains the Realized Stochastic Evolution Increments of the Price Movements exhibited by - * an Asset owing to the Volatility and the Market Impact Factors over the Slice Time Interval. It is - * composed of Stochastic and Deterministic Price Increment Components. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class PriceIncrement extends org.drip.execution.discrete.EvolutionIncrement { - private double _dblPreviousEquilibriumPrice = java.lang.Double.NaN; - - /** - * PriceIncrement Constructor - * - * @param dblPreviousEquilibriumPrice The Previous Equilibrium Price - * @param micDeterministic The Deterministic Market Impact Component Instance - * @param micStochastic The Stochastic Market Impact Component Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public PriceIncrement ( - final double dblPreviousEquilibriumPrice, - final org.drip.execution.evolution.MarketImpactComponent micDeterministic, - final org.drip.execution.evolution.MarketImpactComponent micStochastic) - throws java.lang.Exception - { - super (micDeterministic, micStochastic); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblPreviousEquilibriumPrice = - dblPreviousEquilibriumPrice)) - throw new java.lang.Exception ("PriceIncrement Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Previous Equilibrium Price - * - * @return The Previous Equilibrium Price - */ - - public double previousEquilibriumPrice() - { - return _dblPreviousEquilibriumPrice; - } - - /** - * Retrieve the New Equilibrium Price - * - * @return The New Equilibrium Price - */ - - public double newEquilibriumPrice() - { - return _dblPreviousEquilibriumPrice + marketDynamicWander() + marketDynamicDrift() + - permanentImpactWander() + permanentImpactDrift(); - } - - /** - * Retrieve the New Execution Price - * - * @return The New Execution Price - */ - - public double newExecutionPrice() - { - return newEquilibriumPrice() + temporaryImpactWander() + temporaryImpactDrift(); - } -} diff --git a/org/drip/execution/discrete/ShortfallIncrement.java b/org/drip/execution/discrete/ShortfallIncrement.java deleted file mode 100644 index c92eda1..0000000 --- a/org/drip/execution/discrete/ShortfallIncrement.java +++ /dev/null @@ -1,158 +0,0 @@ - -package org.drip.execution.discrete; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ShortfallIncrement generates the Realized Incremental Stochastic Trading/Execution Short-fall and the - * corresponding Implementation Short-fall corresponding to the Trajectory of a Holdings Block that is to be - * executed over Time. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * - Perold, A. F. (1988): The Implementation Short-fall: Paper versus Reality, Journal of Portfolio - * Management, 14, 4-9. - * - * @author Lakshmi Krishnamurthy - */ - -public class ShortfallIncrement extends org.drip.execution.discrete.EvolutionIncrement { - private org.drip.execution.discrete.PriceIncrement _pi = null; - - /** - * Generate a Standard ShortfallIncrement Instance - * - * @param pi The Composite Slice Price Increment - * @param dblPreviousHoldings The Previous Holdings - * @param dblHoldingsIncrement The Holdings Increment - * - * @return The Standard ShortfallIncrement Instance - */ - - public static final ShortfallIncrement Standard ( - final org.drip.execution.discrete.PriceIncrement pi, - final double dblPreviousHoldings, - final double dblHoldingsIncrement) - { - if (null == pi || !org.drip.quant.common.NumberUtil.IsValid (dblPreviousHoldings) || - !org.drip.quant.common.NumberUtil.IsValid (dblHoldingsIncrement)) - return null; - - double dblCurrentHoldings = dblPreviousHoldings + dblHoldingsIncrement; - - try { - org.drip.execution.evolution.MarketImpactComponent micStochastic = pi.stochastic(); - - org.drip.execution.evolution.MarketImpactComponent micDeterministic = pi.deterministic(); - - return new ShortfallIncrement ( - new org.drip.execution.evolution.MarketImpactComponent ( - micDeterministic.currentStep() * dblCurrentHoldings, - micDeterministic.previousStep() * dblCurrentHoldings, - pi.permanentImpactDrift() * dblCurrentHoldings, - pi.temporaryImpactDrift() * dblHoldingsIncrement - ), - new org.drip.execution.evolution.MarketImpactComponent ( - micStochastic.currentStep() * dblCurrentHoldings, - micStochastic.previousStep() * dblCurrentHoldings, - pi.permanentImpactWander() * dblCurrentHoldings, - pi.temporaryImpactWander() * dblHoldingsIncrement - ), - pi - ); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private ShortfallIncrement ( - final org.drip.execution.evolution.MarketImpactComponent micDeterministic, - final org.drip.execution.evolution.MarketImpactComponent micStochastic, - final org.drip.execution.discrete.PriceIncrement pi) - throws java.lang.Exception - { - super (micDeterministic, micStochastic); - - _pi = pi; - } - - /** - * Compute the Implementation Short-fall - * - * @return The Implementation Short-fall - */ - - public double implementationShortfall() - { - return total(); - } - - /** - * Retrieve the Composite Price Increment Instance - * - * @return The Composite Price Increment Instance - */ - - public org.drip.execution.discrete.PriceIncrement compositePriceIncrement() - { - return _pi; - } -} diff --git a/org/drip/execution/discrete/ShortfallIncrementDistribution.java b/org/drip/execution/discrete/ShortfallIncrementDistribution.java deleted file mode 100644 index 7cfbd99..0000000 --- a/org/drip/execution/discrete/ShortfallIncrementDistribution.java +++ /dev/null @@ -1,192 +0,0 @@ - -package org.drip.execution.discrete; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ShortfallIncrementDistribution holds the Parameters of the R^1 Normal Short fall Increment Distribution. - * The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * - Perold, A. F. (1988): The Implementation Short-fall: Paper versus Reality, Journal of Portfolio - * Management, 14, 4-9. - * - * @author Lakshmi Krishnamurthy - */ - -public class ShortfallIncrementDistribution extends org.drip.measure.gaussian.R1UnivariateNormal { - public double _dblMarketDynamicVariance = java.lang.Double.NaN; - public double _dblPermanentImpactVariance = java.lang.Double.NaN; - public double _dblTemporaryImpactVariance = java.lang.Double.NaN; - public double _dblMarketDynamicExpectation = java.lang.Double.NaN; - public double _dblPermanentImpactExpectation = java.lang.Double.NaN; - public double _dblTemporaryImpactExpectation = java.lang.Double.NaN; - - /** - * ShortfallIncrementDistribution Constructor - * - * @param dblPermanentImpactExpectation The Permanent Market Impact Expectation Component - * @param dblTemporaryImpactExpectation The Temporary Market Impact Expectation Component - * @param dblMarketDynamicExpectation The Market Dynamics Expectation Component - * @param dblPermanentImpactVariance The Permanent Market Impact Variance Component - * @param dblTemporaryImpactVariance The Temporary Market Impact Variance Component - * @param dblMarketDynamicVariance The Market Dynamics Variance Component - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ShortfallIncrementDistribution ( - final double dblPermanentImpactExpectation, - final double dblTemporaryImpactExpectation, - final double dblMarketDynamicExpectation, - final double dblPermanentImpactVariance, - final double dblTemporaryImpactVariance, - final double dblMarketDynamicVariance) - throws java.lang.Exception - { - super (dblPermanentImpactExpectation + dblTemporaryImpactExpectation + dblMarketDynamicExpectation, - java.lang.Math.sqrt (dblPermanentImpactVariance + dblTemporaryImpactVariance + - dblMarketDynamicVariance)); - - _dblPermanentImpactExpectation = dblPermanentImpactExpectation; - _dblTemporaryImpactExpectation = dblTemporaryImpactExpectation; - _dblMarketDynamicExpectation = dblMarketDynamicExpectation; - _dblPermanentImpactVariance = dblPermanentImpactVariance; - _dblTemporaryImpactVariance = dblTemporaryImpactVariance; - _dblMarketDynamicVariance = dblMarketDynamicVariance; - } - - /** - * Retrieve the Total Expectation - * - * @return The Total Expectation - */ - - public double expectation() - { - return mean(); - } - - /** - * Retrieve the Market Dynamic Expectation Component - * - * @return The Market Dynamic Expectation Component - */ - - public double marketDynamicExpectation() - { - return _dblMarketDynamicExpectation; - } - - /** - * Retrieve the Market Dynamic Variance Component - * - * @return The Market Dynamic Variance Component - */ - - public double marketDynamicVariance() - { - return _dblMarketDynamicVariance; - } - - /** - * Retrieve the Permanent Market Impact Expectation Component - * - * @return The Permanent Market Impact Expectation Component - */ - - public double permanentImpactExpectation() - { - return _dblPermanentImpactExpectation; - } - - /** - * Retrieve the Permanent Market Impact Variance Component - * - * @return The Permanent Market Impact Variance Component - */ - - public double permanentImpactVariance() - { - return _dblPermanentImpactVariance; - } - - /** - * Retrieve the Temporary Market Impact Expectation Component - * - * @return The Temporary Market Impact Expectation Component - */ - - public double temporaryImpactExpectation() - { - return _dblTemporaryImpactExpectation; - } - - /** - * Retrieve the Temporary Market Impact Variance Component - * - * @return The Temporary Market Impact Variance Component - */ - - public double temporaryImpactVariance() - { - return _dblTemporaryImpactVariance; - } -} diff --git a/org/drip/execution/discrete/Slice.java b/org/drip/execution/discrete/Slice.java deleted file mode 100644 index 1318086..0000000 --- a/org/drip/execution/discrete/Slice.java +++ /dev/null @@ -1,658 +0,0 @@ - -package org.drip.execution.discrete; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * Slice implements the Arithmetic Dynamics of the Price/Cost Movements exhibited by an Asset owing to the - * Volatility and the Market Impact Factors on a Trajectory Slice. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class Slice implements org.drip.execution.sensitivity.ControlNodesGreekGenerator { - private double _dblTimeInterval = java.lang.Double.NaN; - private double _dblLeftHoldings = java.lang.Double.NaN; - private double _dblRightHoldings = java.lang.Double.NaN; - - /** - * Slice Constructor - * - * @param dblLeftHoldings The Left-of-Slice Holdings - * @param dblRightHoldings The Right-of-Slice Holdings - * @param dblTimeInterval The Discrete Time Interval - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public Slice ( - final double dblLeftHoldings, - final double dblRightHoldings, - final double dblTimeInterval) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblLeftHoldings = dblLeftHoldings) || - !org.drip.quant.common.NumberUtil.IsValid (_dblRightHoldings = dblRightHoldings) || - !org.drip.quant.common.NumberUtil.IsValid (_dblTimeInterval = dblTimeInterval) || 0. >= - _dblTimeInterval) - throw new java.lang.Exception ("Slice Constructor => Invalid Inputs!"); - } - - /** - * Retrieve the Left-of-Slice Holdings - * - * @return The Left-of-Slice Holdings - */ - - public double leftHoldings() - { - return _dblLeftHoldings; - } - - /** - * Retrieve the Right Holdings - * - * @return The Right Holdings - */ - - public double rightHoldings() - { - return _dblRightHoldings; - } - - /** - * Retrieve the Evolution Time Interval of the Arithmetic Dynamics - * - * @return The Evolution Time Interval of the Arithmetic Dynamics - */ - - public double timeInterval() - { - return _dblTimeInterval; - } - - /** - * Indicate if the Slice is a Sell - * - * @return TRUE - The Slice is a Sell - */ - - public boolean isSell() - { - return _dblLeftHoldings - _dblRightHoldings > 0.; - } - - /** - * Generate the Price Evolution Increment Unit Realization given the Walk Realization - * - * @param dblPreviousEquilibriumPrice The Previous Equilibrium Price - * @param ws Realized Walk Suite - * @param apep The Arithmetic Price Walk Evolution Parameters - * - * @return The Realized Price Evolution Increment Unit given the Walk Realization - */ - - public org.drip.execution.discrete.PriceIncrement priceIncrementRealization ( - final double dblPreviousEquilibriumPrice, - final org.drip.execution.dynamics.WalkSuite ws, - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - if (null == ws || null == apep) return null; - - org.drip.execution.parameters.ArithmeticPriceDynamicsSettings apds = - apep.arithmeticPriceDynamicsSettings(); - - double dblSerialCorrelation = apds.serialCorrelation(); - - double dblTimeUnitSQRT = java.lang.Math.sqrt (_dblTimeInterval); - - double dblExecutionRate = (_dblRightHoldings - _dblLeftHoldings) / _dblTimeInterval; - - try { - double dblMarketCoreJumpUnit = apds.epochVolatility() * dblTimeUnitSQRT; - - return new org.drip.execution.discrete.PriceIncrement ( - dblPreviousEquilibriumPrice, - new org.drip.execution.evolution.MarketImpactComponent ( - _dblTimeInterval * apds.drift(), - 0., - _dblTimeInterval * apep.permanentExpectation().epochImpactFunction().evaluate (dblExecutionRate), - apep.temporaryExpectation().epochImpactFunction().evaluate (dblExecutionRate) - ), - new org.drip.execution.evolution.MarketImpactComponent ( - dblMarketCoreJumpUnit * java.lang.Math.sqrt (1. + dblSerialCorrelation * dblSerialCorrelation) * - ws.currentWanderer(), - dblMarketCoreJumpUnit * dblSerialCorrelation * ws.previousWanderer(), - dblTimeUnitSQRT * apep.permanentVolatility().epochImpactFunction().evaluate (dblExecutionRate) * - ws.permanentImpactWanderer(), - dblTimeUnitSQRT * apep.temporaryVolatility().epochImpactFunction().evaluate (dblExecutionRate) * - ws.temporaryImpactWanderer() - ) - ); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Cost Evolution Increment Unit Realization given the Walk Realization - * - * @param dblPreviousEquilibriumPrice The Previous Equilibrium Price - * @param ws Realized Walk Suite - * @param apep The Arithmetic Price Walk Evolution Parameters - * - * @return The Cost Evolution Increment Unit Realization given the Walk Realization - */ - - public org.drip.execution.discrete.ShortfallIncrement costIncrementRealization ( - final double dblPreviousEquilibriumPrice, - final org.drip.execution.dynamics.WalkSuite ws, - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - return org.drip.execution.discrete.ShortfallIncrement.Standard ( - priceIncrementRealization (dblPreviousEquilibriumPrice, ws, apep), - _dblLeftHoldings, - _dblRightHoldings - _dblLeftHoldings - ); - } - - /** - * Generate the R^1 Normal Cost Increment Distribution - * - * @param apep The Arithmetic Price Walk Evolution Parameters - * - * @return The R^1 Normal Cost Increment Distribution - */ - - public org.drip.execution.discrete.ShortfallIncrementDistribution costIncrementDistribution ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - double dblTradeAmount = _dblRightHoldings > _dblLeftHoldings ? _dblRightHoldings - _dblLeftHoldings : - _dblLeftHoldings - _dblRightHoldings; - double dblExecutionRate = dblTradeAmount / _dblTimeInterval; - - org.drip.execution.parameters.ArithmeticPriceDynamicsSettings apds = - apep.arithmeticPriceDynamicsSettings(); - - try { - double dblMarketCoreVolatility = apds.epochVolatility(); - - double dblTemporaryVolatility = apep.temporaryVolatility().epochImpactFunction().evaluate - (dblTradeAmount, _dblTimeInterval); - - return new org.drip.execution.discrete.ShortfallIncrementDistribution ( - _dblTimeInterval * _dblRightHoldings * apep.permanentExpectation().epochImpactFunction().evaluate - (dblExecutionRate), - dblTradeAmount * apep.temporaryExpectation().epochImpactFunction().evaluate (dblExecutionRate), - -1. * _dblRightHoldings * apds.drift() * _dblTimeInterval, - 0., - dblExecutionRate * dblExecutionRate * dblTemporaryVolatility * dblTemporaryVolatility * - _dblTimeInterval, - _dblRightHoldings * _dblRightHoldings * dblMarketCoreVolatility * dblMarketCoreVolatility * - _dblTimeInterval - ); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.execution.sensitivity.ControlNodesGreek permanentImpactExpectation ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - if (null == apep) return null; - - double dblTradeAmount = _dblRightHoldings - _dblLeftHoldings; - double dblSign = _dblRightHoldings < _dblLeftHoldings ? -1. : 1.; - - org.drip.execution.impact.TransactionFunction tfPermanentDrift = - apep.permanentExpectation().epochImpactFunction(); - - try { - double dblPermanentDrift = tfPermanentDrift.evaluate (dblTradeAmount, _dblTimeInterval); - - double dblPermanentDriftLeftJacobian = tfPermanentDrift.leftHoldingsDerivative (dblTradeAmount, - _dblTimeInterval, 1); - - double dblPermanentDriftRightJacobian = tfPermanentDrift.rightHoldingsDerivative (dblTradeAmount, - _dblTimeInterval, 1); - - double dblPermanentDriftLeftHessian = tfPermanentDrift.leftHoldingsDerivative (dblTradeAmount, - _dblTimeInterval, 2); - - double dblPermanentDriftRightHessian = tfPermanentDrift.rightHoldingsDerivative (dblTradeAmount, - _dblTimeInterval, 2); - - double dblPermanentDriftCrossHessian = tfPermanentDrift.crossHoldingsDerivative (dblTradeAmount, - _dblTimeInterval); - - double dblPermanentDriftImpact = dblSign * _dblTimeInterval * _dblRightHoldings * - dblPermanentDrift; - double dblPermanentDriftImpactLeftJacobian = dblSign * _dblTimeInterval * _dblRightHoldings * - dblPermanentDriftLeftJacobian; - double dblPermanentDriftImpactRightJacobian = dblSign * _dblTimeInterval * _dblRightHoldings * - dblPermanentDriftRightJacobian + dblSign * _dblTimeInterval * dblPermanentDrift; - double dblPermanentDriftImpactLeftHessian = dblSign * _dblTimeInterval * _dblRightHoldings * - dblPermanentDriftLeftHessian; - double dblPermanentDriftImpactRightHessian = dblSign * _dblTimeInterval * _dblRightHoldings * - dblPermanentDriftRightHessian + 2. * dblSign * _dblTimeInterval * - dblPermanentDriftRightJacobian; - double dblPermanentDriftImpactCrossHessian = dblSign * _dblTimeInterval * - dblPermanentDriftLeftJacobian + dblSign * _dblTimeInterval * _dblRightHoldings * - dblPermanentDriftCrossHessian; - - return new org.drip.execution.sensitivity.ControlNodesGreek ( - dblPermanentDriftImpact, - new double[] { - dblPermanentDriftImpactLeftJacobian, - dblPermanentDriftImpactRightJacobian - }, - new double[][] { - {dblPermanentDriftImpactLeftHessian, dblPermanentDriftImpactCrossHessian}, - {dblPermanentDriftImpactCrossHessian, dblPermanentDriftImpactRightHessian} - } - ); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.execution.sensitivity.ControlNodesGreek permanentImpactVariance ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - try { - return new org.drip.execution.sensitivity.ControlNodesGreek (0., new double[] {0., 0.}, new - double[][] {{0., 0.}, {0., 0.}}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.execution.sensitivity.ControlNodesGreek temporaryImpactExpectation ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - if (null == apep) return null; - - double dblTradeAmount = _dblRightHoldings - _dblLeftHoldings; - - org.drip.execution.impact.TransactionFunction tfTemporaryDrift = - apep.temporaryExpectation().epochImpactFunction(); - - try { - double dblTemporaryDrift = tfTemporaryDrift.evaluate (dblTradeAmount, _dblTimeInterval); - - double dblTemporaryDriftLeftJacobian = tfTemporaryDrift.leftHoldingsDerivative (dblTradeAmount, - _dblTimeInterval, 1); - - double dblTemporaryDriftRightJacobian = tfTemporaryDrift.rightHoldingsDerivative - (dblTradeAmount, _dblTimeInterval, 1); - - double dblTemporaryDriftLeftHessian = tfTemporaryDrift.leftHoldingsDerivative (dblTradeAmount, - _dblTimeInterval, 2); - - double dblTemporaryDriftRightHessian = tfTemporaryDrift.rightHoldingsDerivative (dblTradeAmount, - _dblTimeInterval, 2); - - double dblTemporaryDriftCrossHessian = tfTemporaryDrift.crossHoldingsDerivative (dblTradeAmount, - _dblTimeInterval); - - double dblTemporaryDriftImpact = dblTradeAmount * dblTemporaryDrift; - - double dblTemporaryDriftImpactLeftJacobian = -1. * dblTemporaryDrift + dblTradeAmount * - dblTemporaryDriftLeftJacobian; - double dblTemporaryDriftImpactRightJacobian = dblTemporaryDrift + dblTradeAmount * - dblTemporaryDriftRightJacobian; - double dblTemporaryDriftImpactLeftHessian = -2. * dblTemporaryDriftLeftJacobian + dblTradeAmount - * dblTemporaryDriftLeftHessian; - double dblTemporaryDriftImpactRightHessian = 2. * dblTemporaryDriftRightJacobian + dblTradeAmount - * dblTemporaryDriftRightHessian; - double dblTemporaryDriftImpactCrossHessian = -1. * dblTemporaryDriftRightJacobian + - dblTemporaryDriftLeftJacobian + dblTradeAmount * dblTemporaryDriftCrossHessian; - - return new org.drip.execution.sensitivity.ControlNodesGreek ( - dblTemporaryDriftImpact, - new double[] { - dblTemporaryDriftImpactLeftJacobian, - dblTemporaryDriftImpactRightJacobian - }, - new double[][] { - {dblTemporaryDriftImpactLeftHessian, dblTemporaryDriftImpactCrossHessian}, - {dblTemporaryDriftImpactCrossHessian, dblTemporaryDriftImpactRightHessian} - } - ); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.execution.sensitivity.ControlNodesGreek temporaryImpactVariance ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - if (null == apep) return null; - - double dblTradeAmount = _dblRightHoldings - _dblLeftHoldings; - double dblTradeAmountSquared = dblTradeAmount * dblTradeAmount; - - org.drip.execution.impact.TransactionFunction tfTemporaryVolatility = - apep.temporaryVolatility().epochImpactFunction(); - - try { - if (null == tfTemporaryVolatility) - return new org.drip.execution.sensitivity.ControlNodesGreek (0., new double[] {0., 0.}, new - double[][] {{0., 0.}, {0., 0.}}); - - double dblTemporaryVolatility = tfTemporaryVolatility.evaluate (dblTradeAmount, - _dblTimeInterval); - - double dblTemporaryVolatilityLeftJacobian = tfTemporaryVolatility.leftHoldingsDerivative - (dblTradeAmount, _dblTimeInterval, 1); - - double dblTemporaryVolatilityRightJacobian = tfTemporaryVolatility.rightHoldingsDerivative - (dblTradeAmount, _dblTimeInterval, 1); - - double dblTemporaryVolatilityLeftHessian = tfTemporaryVolatility.leftHoldingsDerivative - (dblTradeAmount, _dblTimeInterval, 2); - - double dblTemporaryVolatilityRightHessian = tfTemporaryVolatility.rightHoldingsDerivative - (dblTradeAmount, _dblTimeInterval, 2); - - double dblTemporaryVolatilityCrossHessian = tfTemporaryVolatility.crossHoldingsDerivative - (dblTradeAmount, _dblTimeInterval); - - double dblTemporaryVolatilitySquared = dblTemporaryVolatility * dblTemporaryVolatility; - - double dblTemporaryVarianceCrossHessian = - 2. * dblTradeAmountSquared * dblTemporaryVolatilityLeftJacobian * dblTemporaryVolatilityRightJacobian * _dblTimeInterval - + 2. * dblTradeAmountSquared * dblTemporaryVolatility * dblTemporaryVolatilityCrossHessian * _dblTimeInterval - + 4. * dblTradeAmount * dblTemporaryVolatility * dblTemporaryVolatilityLeftJacobian * _dblTimeInterval - - 4. * dblTradeAmount * dblTemporaryVolatility * dblTemporaryVolatilityRightJacobian * _dblTimeInterval - - 2. * dblTemporaryVolatilitySquared * _dblTimeInterval; - - return new org.drip.execution.sensitivity.ControlNodesGreek ( - dblTradeAmountSquared * dblTemporaryVolatilitySquared * _dblTimeInterval, - new double[] { - 2. * dblTradeAmountSquared * dblTemporaryVolatility * dblTemporaryVolatilityLeftJacobian * _dblTimeInterval - - 2. * dblTradeAmount * dblTemporaryVolatilitySquared * _dblTimeInterval, - 2. * dblTradeAmountSquared * dblTemporaryVolatility * dblTemporaryVolatilityRightJacobian * _dblTimeInterval - + 2. * dblTradeAmount * dblTemporaryVolatilitySquared * _dblTimeInterval - }, - new double[][] { - { - 2. * dblTradeAmountSquared * dblTemporaryVolatilityLeftJacobian * dblTemporaryVolatilityLeftJacobian * _dblTimeInterval - + 2. * dblTradeAmountSquared * dblTemporaryVolatility * dblTemporaryVolatilityLeftHessian * _dblTimeInterval - - 8. * dblTradeAmount * dblTemporaryVolatility * dblTemporaryVolatilityLeftJacobian * _dblTimeInterval - + 2. * dblTemporaryVolatilitySquared * _dblTimeInterval, - dblTemporaryVarianceCrossHessian - }, { - dblTemporaryVarianceCrossHessian, - 2. * dblTradeAmountSquared * dblTemporaryVolatilityRightJacobian * dblTemporaryVolatilityRightJacobian * _dblTimeInterval - + 2. * dblTradeAmountSquared * dblTemporaryVolatility * dblTemporaryVolatilityRightHessian * _dblTimeInterval - + 8. * dblTradeAmount * dblTemporaryVolatility * dblTemporaryVolatilityRightJacobian * _dblTimeInterval - + 2. * dblTemporaryVolatilitySquared * _dblTimeInterval - } - } - ); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.execution.sensitivity.ControlNodesGreek marketDynamicsExpectation ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - if (null == apep) return null; - - double dblDrift = apep.arithmeticPriceDynamicsSettings().drift(); - - try { - return new org.drip.execution.sensitivity.ControlNodesGreek ( - -1. * _dblTimeInterval * dblDrift * _dblRightHoldings, - new double[] { - 0., - -1. * _dblTimeInterval * dblDrift - }, new - double[][] { - {0., 0.}, - {0., 0.} - } - ); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.execution.sensitivity.ControlNodesGreek marketDynamicsVariance ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - if (null == apep) return null; - - try { - double dblVolatility = apep.arithmeticPriceDynamicsSettings().epochVolatility(); - - return new org.drip.execution.sensitivity.ControlNodesGreek ( - _dblTimeInterval * dblVolatility * dblVolatility * _dblRightHoldings * _dblRightHoldings, - new double[] { - 0., - 2. * _dblTimeInterval * dblVolatility * dblVolatility * _dblRightHoldings - }, new double[][] { - {0., 0.}, - {0., 2. * _dblTimeInterval * dblVolatility * dblVolatility} - } - ); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.execution.sensitivity.ControlNodesGreek expectationContribution ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - org.drip.execution.sensitivity.ControlNodesGreek cngPermanentImpact = permanentImpactExpectation - (apep); - - if (null == cngPermanentImpact) return null; - - org.drip.execution.sensitivity.ControlNodesGreek cngTemporaryImpact = temporaryImpactExpectation - (apep); - - if (null == cngTemporaryImpact) return null; - - org.drip.execution.sensitivity.ControlNodesGreek cngMarketCore = marketDynamicsExpectation (apep); - - if (null == cngMarketCore) return null; - - double[][] aadblPermanentImpactExpectationHessian = cngPermanentImpact.hessian(); - - double[][] aadblTemporaryImpactExpectationHessian = cngTemporaryImpact.hessian(); - - double[] adblPermanentImpactExpectationJacobian = cngPermanentImpact.jacobian(); - - double[] adblTemporaryImpactExpectationJacobian = cngTemporaryImpact.jacobian(); - - double[][] aadblMarketCoreExpectationHessian = cngMarketCore.hessian(); - - double[] adblMarketCoreExpectationJacobian = cngMarketCore.jacobian(); - - int iNumSliceNode = adblMarketCoreExpectationJacobian.length; - double[][] aadblHessian = new double[iNumSliceNode][iNumSliceNode]; - double[] adblJacobian = new double[iNumSliceNode]; - - for (int i = 0; i < iNumSliceNode; ++i) { - adblJacobian[i] = adblPermanentImpactExpectationJacobian[i] + - adblTemporaryImpactExpectationJacobian[i] + adblMarketCoreExpectationJacobian[i]; - - for (int j = 0; j < iNumSliceNode; ++j) - aadblHessian[i][j] = aadblPermanentImpactExpectationHessian[i][j] + - aadblTemporaryImpactExpectationHessian[i][j] + aadblMarketCoreExpectationHessian[i][j]; - } - - try { - return new org.drip.execution.sensitivity.ControlNodesGreek (cngPermanentImpact.value() + - cngTemporaryImpact.value() + cngMarketCore.value(), adblJacobian, aadblHessian); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.execution.sensitivity.ControlNodesGreek varianceContribution ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - org.drip.execution.sensitivity.ControlNodesGreek cngPermanentImpact = permanentImpactVariance (apep); - - if (null == cngPermanentImpact) return null; - - org.drip.execution.sensitivity.ControlNodesGreek cngTemporaryImpact = temporaryImpactVariance (apep); - - if (null == cngTemporaryImpact) return null; - - org.drip.execution.sensitivity.ControlNodesGreek cngMarketCore = marketDynamicsVariance (apep); - - if (null == cngMarketCore) return null; - - double[][] aadblPermanentImpactExpectationHessian = cngPermanentImpact.hessian(); - - double[][] aadblTemporaryImpactExpectationHessian = cngTemporaryImpact.hessian(); - - double[] adblPermanentImpactExpectationJacobian = cngPermanentImpact.jacobian(); - - double[] adblTemporaryImpactExpectationJacobian = cngTemporaryImpact.jacobian(); - - double[][] aadblMarketCoreExpectationHessian = cngMarketCore.hessian(); - - double[] adblMarketCoreExpectationJacobian = cngMarketCore.jacobian(); - - int iNumSliceNode = adblMarketCoreExpectationJacobian.length; - double[][] aadblHessian = new double[iNumSliceNode][iNumSliceNode]; - double[] adblJacobian = new double[iNumSliceNode]; - - for (int i = 0; i < iNumSliceNode; ++i) { - adblJacobian[i] = adblPermanentImpactExpectationJacobian[i] + - adblTemporaryImpactExpectationJacobian[i] + adblMarketCoreExpectationJacobian[i]; - - for (int j = 0; j < iNumSliceNode; ++j) - aadblHessian[i][j] = aadblPermanentImpactExpectationHessian[i][j] + - aadblTemporaryImpactExpectationHessian[i][j] + aadblMarketCoreExpectationHessian[i][j]; - } - - try { - return new org.drip.execution.sensitivity.ControlNodesGreek (cngPermanentImpact.value() + - cngTemporaryImpact.value() + cngMarketCore.value(), adblJacobian, aadblHessian); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Estimate the Optimal Adjustment Attributable to the Serial Correlation - * - * @param apep The Arithmetic Price Walk Parameters - * - * @return The Optimal Adjustment Attributable to the Serial Correlation - */ - - public org.drip.execution.discrete.OptimalSerialCorrelationAdjustment serialCorrelationAdjustment ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - if (null == apep) return null; - - org.drip.execution.parameters.ArithmeticPriceDynamicsSettings apds = - apep.arithmeticPriceDynamicsSettings(); - - double dblTradeRate = (_dblRightHoldings - _dblLeftHoldings) / _dblTimeInterval; - - org.drip.execution.impact.TransactionFunction miTemporary = - apep.temporaryExpectation().epochImpactFunction(); - - try { - double dblRhoSigma = apds.serialCorrelation() * apds.epochVolatility(); - - double dblDenominator = 1. / (dblTradeRate * miTemporary.derivative (dblTradeRate, 2) + 2. * - miTemporary.derivative (dblTradeRate, 1)); - - return new org.drip.execution.discrete.OptimalSerialCorrelationAdjustment (dblDenominator * - dblRhoSigma * java.lang.Math.pow (_dblTimeInterval, 1.5), 0.5 * dblDenominator * dblRhoSigma - * dblRhoSigma * _dblTimeInterval * _dblTimeInterval); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/dynamics/ArithmeticPriceEvolutionParameters.java b/org/drip/execution/dynamics/ArithmeticPriceEvolutionParameters.java deleted file mode 100644 index 5d5e4f3..0000000 --- a/org/drip/execution/dynamics/ArithmeticPriceEvolutionParameters.java +++ /dev/null @@ -1,162 +0,0 @@ - -package org.drip.execution.dynamics; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ArithmeticPriceEvolutionParameters contains the Exogenous Parameters that determine the Dynamics of the - * Arithmetic Price Movements exhibited by an Asset owing to the Volatility and the Market Impact Factors. - * The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class ArithmeticPriceEvolutionParameters { - private org.drip.execution.parameters.ArithmeticPriceDynamicsSettings _apds = null; - private org.drip.execution.profiletime.BackgroundParticipationRate _bprPermanentVolatility = null; - private org.drip.execution.profiletime.BackgroundParticipationRate _bprTemporaryVolatility = null; - private org.drip.execution.profiletime.BackgroundParticipationRate _bprPermanentExpectation = null; - private org.drip.execution.profiletime.BackgroundParticipationRate _bprTemporaryExpectation = null; - - /** - * ArithmeticPriceEvolutionParameters Constructor - * - * @param apds The Asset Price Dynamics Settings - * @param bprPermanentExpectation The Background Participation Permanent Market Impact Expectation - * Function - * @param bprTemporaryExpectation The Background Participation Temporary Market Impact Expectation - * Function - * @param bprPermanentVolatility The Background Participation Permanent Market Impact Volatility Function - * @param bprTemporaryVolatility The Background Participation Temporary Market Impact Volatility Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ArithmeticPriceEvolutionParameters ( - final org.drip.execution.parameters.ArithmeticPriceDynamicsSettings apds, - final org.drip.execution.profiletime.BackgroundParticipationRate bprPermanentExpectation, - final org.drip.execution.profiletime.BackgroundParticipationRate bprTemporaryExpectation, - final org.drip.execution.profiletime.BackgroundParticipationRate bprPermanentVolatility, - final org.drip.execution.profiletime.BackgroundParticipationRate bprTemporaryVolatility) - throws java.lang.Exception - { - if (null == (_apds = apds) || null == (_bprPermanentExpectation = bprPermanentExpectation) || null == - (_bprTemporaryExpectation = bprTemporaryExpectation) || null == (_bprPermanentVolatility = - bprPermanentVolatility) || null == (_bprTemporaryVolatility = bprTemporaryVolatility)) - throw new java.lang.Exception - ("ArithmeticPriceEvolutionParameters Constructor => Invalid Inputs!"); - } - - /** - * Retrieve the Arithmetic Price Dynamics Settings Instance - * - * @return The Arithmetic Price Dynamics Settings Instance - */ - - public org.drip.execution.parameters.ArithmeticPriceDynamicsSettings arithmeticPriceDynamicsSettings() - { - return _apds; - } - - /** - * Retrieve the Background Participation Permanent Market Impact Expectation Function - * - * @return The Background Participation Permanent Market Impact Expectation Function - */ - - public org.drip.execution.profiletime.BackgroundParticipationRate permanentExpectation() - { - return _bprPermanentExpectation; - } - - /** - * Retrieve the Background Participation Temporary Market Impact Expectation Function - * - * @return The Background Participation Temporary Market Impact Expectation Function - */ - - public org.drip.execution.profiletime.BackgroundParticipationRate temporaryExpectation() - { - return _bprTemporaryExpectation; - } - - /** - * Retrieve the Background Participation Permanent Market Impact Volatility Function - * - * @return The Background Participation Permanent Market Impact Volatility Function - */ - - public org.drip.execution.profiletime.BackgroundParticipationRate permanentVolatility() - { - return _bprPermanentVolatility; - } - - /** - * Retrieve the Background Participation Temporary Market Impact Volatility Function - * - * @return The Background Participation Temporary Market Impact Volatility Function - */ - - public org.drip.execution.profiletime.BackgroundParticipationRate temporaryVolatility() - { - return _bprTemporaryVolatility; - } -} diff --git a/org/drip/execution/dynamics/ArithmeticPriceEvolutionParametersBuilder.java b/org/drip/execution/dynamics/ArithmeticPriceEvolutionParametersBuilder.java deleted file mode 100644 index 08138ce..0000000 --- a/org/drip/execution/dynamics/ArithmeticPriceEvolutionParametersBuilder.java +++ /dev/null @@ -1,245 +0,0 @@ - -package org.drip.execution.dynamics; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ArithmeticPriceEvolutionParametersBuilder constructs a variety of Arithmetic Price Evolution Parameters. - * The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * @author Lakshmi Krishnamurthy - */ - -public class ArithmeticPriceEvolutionParametersBuilder { - - /** - * Linear Expectation Version of LinearPermanentExpectationParameters Instance - * - * @param apds The Asset Price Dynamics Settings - * @param bprlPermanentExpectation The Background Participation Rate Linear Permanent Expectation Market - * Impact Function - * @param bprlTemporaryExpectation The Background Participation Rate Linear Temporary Market Impact - * Expectation Function - * - * @return Linear Expectation Version of LinearPermanentExpectationParameters Instance - */ - - public static final org.drip.execution.dynamics.LinearPermanentExpectationParameters LinearExpectation ( - final org.drip.execution.parameters.ArithmeticPriceDynamicsSettings apds, - final org.drip.execution.profiletime.BackgroundParticipationRateLinear bprlPermanentExpectation, - final org.drip.execution.profiletime.BackgroundParticipationRateLinear bprlTemporaryExpectation) - { - try { - return new org.drip.execution.dynamics.LinearPermanentExpectationParameters (apds, - bprlPermanentExpectation, bprlTemporaryExpectation); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Almgren 2003 Version of LinearPermanentExpectationParameters Instance - * - * @param apds The Asset Price Dynamics Settings - * @param bprlPermanentExpectation The Background Participation Rate Linear Permanent Expectation Market - * Impact Function - * @param bprTemporaryExpectation The Participation Rate Power Temporary Market Impact Expectation - * Function - * - * @return Almgren 2003 Version of LinearPermanentExpectationParameters Instance - */ - - public static final org.drip.execution.dynamics.LinearPermanentExpectationParameters Almgren2003 ( - final org.drip.execution.parameters.ArithmeticPriceDynamicsSettings apds, - final org.drip.execution.profiletime.BackgroundParticipationRateLinear bprlPermanentExpectation, - final org.drip.execution.profiletime.BackgroundParticipationRate bprTemporaryExpectation) - { - try { - return new org.drip.execution.dynamics.LinearPermanentExpectationParameters (apds, - bprlPermanentExpectation, bprTemporaryExpectation); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Trading Enhanced Volatility ArithmeticPriceEvolutionParameters Instance - * - * @param dblPriceVolatility The Daily Price Volatility Parameter - * @param bprlTemporaryExpectation The Background Participation Linear Temporary Market Impact - * Expectation Function - * @param bprlTemporaryVolatility The Background Participation Linear Temporary Market Impact - * Volatility Function - * - * @return The Trading Enhanced Volatility /ArithmeticPriceEvolutionParameters Instance - */ - - public static final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters - TradingEnhancedVolatility ( - final double dblPriceVolatility, - final org.drip.execution.profiletime.BackgroundParticipationRateLinear bprlTemporaryExpectation, - final org.drip.execution.profiletime.BackgroundParticipationRateLinear bprlTemporaryVolatility) - { - try { - return new org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters (new - org.drip.execution.parameters.ArithmeticPriceDynamicsSettings (0., new - org.drip.function.r1tor1.FlatUnivariate (dblPriceVolatility), 0.), new - org.drip.execution.profiletime.UniformParticipationRate - (org.drip.execution.impact.ParticipationRateLinear.NoImpact()), - bprlTemporaryExpectation, new - org.drip.execution.profiletime.UniformParticipationRate - (org.drip.execution.impact.ParticipationRateLinear.NoImpact()), - bprlTemporaryVolatility); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Arithmetic Price Evolution Parameters from Coordinated Variation Instance - * - * @param r1ToR1Volatility The R^1 To R^1 Volatility Function - * @param cv The Coordinated Volatility/Liquidity Variation - * - * @return The Arithmetic Price Evolution Parameters from Coordinated Variation Instance - */ - - public static final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters CoordinatedVariation ( - final org.drip.function.definition.R1ToR1 r1ToR1Volatility, - final org.drip.execution.tradingtime.CoordinatedVariation cv) - { - try { - return new org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters (new - org.drip.execution.parameters.ArithmeticPriceDynamicsSettings (0., r1ToR1Volatility, 0.), new - org.drip.execution.profiletime.UniformParticipationRate - (org.drip.execution.impact.ParticipationRateLinear.NoImpact()), new - org.drip.execution.tradingtime.CoordinatedParticipationRateLinear (cv, - r1ToR1Volatility), new - org.drip.execution.profiletime.UniformParticipationRate - (org.drip.execution.impact.ParticipationRateLinear.NoImpact()), new - org.drip.execution.profiletime.UniformParticipationRate - (org.drip.execution.impact.ParticipationRateLinear.NoImpact())); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Arithmetic Price Evolution Parameters from a Deterministic Coordinated Variation Instance - * - * @param dblPriceVolatility The Daily Price Volatility Parameter - * @param cv The Coordinated Volatility/Liquidity Variation - * - * @return The Arithmetic Price Evolution Parameters from a Deterministic Coordinated Variation Instance - */ - - public static final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters - DeterministicCoordinatedVariation ( - final double dblPriceVolatility, - final org.drip.execution.tradingtime.CoordinatedVariation cv) - { - try { - return CoordinatedVariation (new org.drip.function.r1tor1.FlatUnivariate (dblPriceVolatility), - cv); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Linear Permanent Evolution Parameters from a Deterministic Coordinated Variation Instance - * - * @param cv The Coordinated Volatility/Liquidity Variation - * - * @return The Linear Permanent Evolution Parameters from a Deterministic Coordinated Variation Instance - */ - - public static final org.drip.execution.dynamics.LinearPermanentExpectationParameters - ReferenceCoordinatedVariation ( - final org.drip.execution.tradingtime.CoordinatedVariation cv) - { - if (null == cv) return null; - - try { - return new org.drip.execution.dynamics.LinearPermanentExpectationParameters (new - org.drip.execution.parameters.ArithmeticPriceDynamicsSettings (0., new - org.drip.function.r1tor1.FlatUnivariate (cv.referenceVolatility()), 0.), new - org.drip.execution.profiletime.UniformParticipationRateLinear - (org.drip.execution.impact.ParticipationRateLinear.NoImpact()), new - org.drip.execution.profiletime.UniformParticipationRateLinear - (org.drip.execution.impact.ParticipationRateLinear.SlopeOnly - (cv.referenceLiquidity()))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/dynamics/LinearPermanentExpectationParameters.java b/org/drip/execution/dynamics/LinearPermanentExpectationParameters.java deleted file mode 100644 index b6f0b07..0000000 --- a/org/drip/execution/dynamics/LinearPermanentExpectationParameters.java +++ /dev/null @@ -1,108 +0,0 @@ - -package org.drip.execution.dynamics; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * LinearPermanentExpectationParameters implements a Permanent Market Impact Function where the Price Change - * scales linearly with the Trade Rate. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * @author Lakshmi Krishnamurthy - */ - -public class LinearPermanentExpectationParameters extends - org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters { - - /** - * LinearPermanentExpectationParameters Constructor - * - * @param apds The Asset Price Dynamics Settings - * @param bprlPermanentExpectation The Background Participation Rate Linear Permanent Expectation Market - * Impact Function - * @param bprTemporaryExpectation The Background Participation Rate Temporary Expectation Market Impact - * Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public LinearPermanentExpectationParameters ( - final org.drip.execution.parameters.ArithmeticPriceDynamicsSettings apds, - final org.drip.execution.profiletime.BackgroundParticipationRateLinear bprlPermanentExpectation, - final org.drip.execution.profiletime.BackgroundParticipationRate bprTemporaryExpectation) - throws java.lang.Exception - { - super (apds, bprlPermanentExpectation, bprTemporaryExpectation, new - org.drip.execution.profiletime.UniformParticipationRateLinear - (org.drip.execution.impact.ParticipationRateLinear.NoImpact()), new - org.drip.execution.profiletime.UniformParticipationRateLinear - (org.drip.execution.impact.ParticipationRateLinear.NoImpact())); - } - - /** - * Retrieve the Background Participation Linear Permanent Market Impact Expectation Function - * - * @return The Background Participation Linear Permanent Market Impact Expectation Function - */ - - public org.drip.execution.profiletime.BackgroundParticipationRateLinear linearPermanentExpectation() - { - return (org.drip.execution.profiletime.BackgroundParticipationRateLinear) permanentExpectation(); - } -} diff --git a/org/drip/execution/dynamics/WalkSuite.java b/org/drip/execution/dynamics/WalkSuite.java deleted file mode 100644 index 972976b..0000000 --- a/org/drip/execution/dynamics/WalkSuite.java +++ /dev/null @@ -1,145 +0,0 @@ - -package org.drip.execution.dynamics; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * WalkSuite holds the Walk Random Variables (e.g., Weiner Variates) that correspond to an Instance of Walk - * attributable to different Factor Contributions inside of a Slice Increment. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class WalkSuite { - private double _dblCurrent = java.lang.Double.NaN; - private double _dblPrevious = java.lang.Double.NaN; - private double _dblPermanentImpact = java.lang.Double.NaN; - private double _dblTemporaryImpact = java.lang.Double.NaN; - - /** - * WalkSuite Constructor - * - * @param dblPrevious The Previous Walk Realization - * @param dblCurrent The Current Walk Realization - * @param dblPermanentImpact The Permanent Impact Walk Realization - * @param dblTemporaryImpact The Temporary Impact Walk Realization - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public WalkSuite ( - final double dblPrevious, - final double dblCurrent, - final double dblPermanentImpact, - final double dblTemporaryImpact) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblPrevious = dblPrevious) || - !org.drip.quant.common.NumberUtil.IsValid (_dblCurrent = dblCurrent) || - !org.drip.quant.common.NumberUtil.IsValid (_dblPermanentImpact = dblPermanentImpact) || - !org.drip.quant.common.NumberUtil.IsValid (_dblTemporaryImpact = dblTemporaryImpact)) - throw new java.lang.Exception ("WalkSuite Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Previous Instance of the Walk Wanderer - * - * @return The Previous Instance of the Walk Wanderer - */ - - public double previousWanderer() - { - return _dblPrevious; - } - - /** - * Retrieve the Current Instance of the Walk Wanderer - * - * @return The Current Instance of the Market Core Walk Wanderer - */ - - public double currentWanderer() - { - return _dblCurrent; - } - - /** - * Retrieve the Previous Instance of the Permanent Impact Walk Wanderer - * - * @return The Previous Instance of the Permanent Impact Walk Wanderer - */ - - public double permanentImpactWanderer() - { - return _dblPermanentImpact; - } - - /** - * Retrieve the Previous Instance of the Temporary Impact Walk Wanderer - * - * @return The Previous Instance of the Temporary Impact Walk Wanderer - */ - - public double temporaryImpactWanderer() - { - return _dblTemporaryImpact; - } -} diff --git a/org/drip/execution/evolution/MarketImpactComponent.java b/org/drip/execution/evolution/MarketImpactComponent.java deleted file mode 100644 index 784cafa..0000000 --- a/org/drip/execution/evolution/MarketImpactComponent.java +++ /dev/null @@ -1,156 +0,0 @@ - -package org.drip.execution.evolution; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * MarketImpactComponent exposes the Evolution Increment Components of the Movements exhibited by an Asset's - * Manifest Measures owing to either Stochastic or Deterministic Factors. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class MarketImpactComponent { - private double _dblCurrentStep = java.lang.Double.NaN; - private double _dblPreviousStep = java.lang.Double.NaN; - private double _dblPermanentImpact = java.lang.Double.NaN; - private double _dblTemporaryImpact = java.lang.Double.NaN; - - /** - * MarketImpactComponent Constructor - * - * @param dblCurrentStep The Current Step Volatility Component Contribution - * @param dblPreviousStep The Previous Step Volatility Component Contribution - * @param dblPermanentImpact The Permanent Market Impact Contribution - * @param dblTemporaryImpact The Temporary Market Impact Contribution - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public MarketImpactComponent ( - final double dblCurrentStep, - final double dblPreviousStep, - final double dblPermanentImpact, - final double dblTemporaryImpact) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblCurrentStep = dblCurrentStep) || - !org.drip.quant.common.NumberUtil.IsValid (_dblPreviousStep = dblPreviousStep) || - !org.drip.quant.common.NumberUtil.IsValid (_dblPermanentImpact = dblPermanentImpact) || - !org.drip.quant.common.NumberUtil.IsValid (_dblTemporaryImpact = dblTemporaryImpact)) - throw new java.lang.Exception ("MarketImpactComponent Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Previous Step Contribution - * - * @return The Previous Step Contribution - */ - - public double previousStep() - { - return _dblPreviousStep; - } - - /** - * Retrieve the Current Step Contribution - * - * @return The Current Step Contribution - */ - - public double currentStep() - { - return _dblCurrentStep; - } - - /** - * Retrieve the Permanent Market Impact Contribution - * - * @return The Permanent Market Impact Contribution - */ - - public double permanentImpact() - { - return _dblPermanentImpact; - } - - /** - * Retrieve the Temporary Market Impact Contribution - * - * @return The Temporary Market Impact Contribution - */ - - public double temporaryImpact() - { - return _dblTemporaryImpact; - } - - /** - * Retrieve the Total Component Impact - * - * @return The Total Component Impact - */ - - public double total() - { - return previousStep() + currentStep() + permanentImpact() + temporaryImpact(); - } -} diff --git a/org/drip/execution/evolution/MarketImpactComposite.java b/org/drip/execution/evolution/MarketImpactComposite.java deleted file mode 100644 index e409147..0000000 --- a/org/drip/execution/evolution/MarketImpactComposite.java +++ /dev/null @@ -1,131 +0,0 @@ - -package org.drip.execution.evolution; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * MarketImpactComposite contains the Composite Evolution Increment Components of the Movements exhibited by - * an Asset's Manifest Measures owing to the Stochastic and the Deterministic Factors. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class MarketImpactComposite extends org.drip.execution.evolution.MarketImpactComponent { - private org.drip.execution.evolution.MarketImpactComponent _micStochastic = null; - private org.drip.execution.evolution.MarketImpactComponent _micDeterministic = null; - - /** - * Construct a Standard Instance of MarketImpactComposite - * - * @param micDeterministic The Deterministic Market Impact Component Instance - * @param micStochastic The Stochastic Market Impact Component Instance - * - * @return The Standard Instance of MarketImpactComposite - */ - - public static final MarketImpactComposite Standard ( - final org.drip.execution.evolution.MarketImpactComponent micDeterministic, - final org.drip.execution.evolution.MarketImpactComponent micStochastic) - { - if (null == micDeterministic || null == micStochastic) return null; - - try { - return new MarketImpactComposite (micDeterministic, micStochastic); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - protected MarketImpactComposite ( - final org.drip.execution.evolution.MarketImpactComponent micDeterministic, - final org.drip.execution.evolution.MarketImpactComponent micStochastic) - throws java.lang.Exception - { - super (micDeterministic.currentStep() + micStochastic.currentStep(), micDeterministic.previousStep() - + micStochastic.previousStep(), micDeterministic.permanentImpact() + - micStochastic.permanentImpact(), micDeterministic.temporaryImpact() + - micStochastic.temporaryImpact()); - } - - /** - * Retrieve the Deterministic Impact Component Instance - * - * @return The Deterministic Impact Component Instance - */ - - public org.drip.execution.evolution.MarketImpactComponent deterministic() - { - return _micDeterministic; - } - - /** - * Retrieve the Stochastic Impact Component Instance - * - * @return The Stochastic Impact Component Instance - */ - - public org.drip.execution.evolution.MarketImpactComponent stochastic() - { - return _micStochastic; - } -} diff --git a/org/drip/execution/hjb/NonDimensionalCost.java b/org/drip/execution/hjb/NonDimensionalCost.java deleted file mode 100644 index a51ec92..0000000 --- a/org/drip/execution/hjb/NonDimensionalCost.java +++ /dev/null @@ -1,117 +0,0 @@ - -package org.drip.execution.hjb; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NonDimensionalCost exposes the Level, the Gradient, and the Jacobian of the Realized Non Dimensional Cost - * Value Function to the Market State. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class NonDimensionalCost { - private double _dblRealization = java.lang.Double.NaN; - private double _dblNonDimensionalTradeRate = java.lang.Double.NaN; - - /** - * NonDimensionalCost Constructor - * - * @param dblRealization The Non dimensional Value Function Realization - * @param dblNonDimensionalTradeRate The Non-dimensional Trade Rate - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public NonDimensionalCost ( - final double dblRealization, - final double dblNonDimensionalTradeRate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblRealization = dblRealization) || - !org.drip.quant.common.NumberUtil.IsValid (_dblNonDimensionalTradeRate = - dblNonDimensionalTradeRate)) - throw new java.lang.Exception ("NonDimensionalCost Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Realized Non-dimensional Value - * - * @return The Realized Non-dimensional Value - */ - - public double realization() - { - return _dblRealization; - } - - /** - * Retrieve the Non-dimensional Trade Rate - * - * @return The Non-dimensional Trade Rate - */ - - public double nonDimensionalTradeRate() - { - return _dblNonDimensionalTradeRate; - } -} diff --git a/org/drip/execution/hjb/NonDimensionalCostCorrelated.java b/org/drip/execution/hjb/NonDimensionalCostCorrelated.java deleted file mode 100644 index 368b675..0000000 --- a/org/drip/execution/hjb/NonDimensionalCostCorrelated.java +++ /dev/null @@ -1,185 +0,0 @@ - -package org.drip.execution.hjb; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NonDimensionalCostCorrelated contains the Level, the Gradient, and the Jacobian of the HJB Non-dimensional - * Cost Value Function to the Individual Correlated Market States. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class NonDimensionalCostCorrelated extends org.drip.execution.hjb.NonDimensionalCost { - private double _dblLiquidityGradient = java.lang.Double.NaN; - private double _dblLiquidityJacobian = java.lang.Double.NaN; - private double _dblVolatilityGradient = java.lang.Double.NaN; - private double _dblVolatilityJacobian = java.lang.Double.NaN; - private double _dblLiquidityVolatilityGradient = java.lang.Double.NaN; - - /** - * Generate a Zero Sensitivity Correlated Non-dimensional Cost Instance - * - * @return The Zero Sensitivity Correlated Non-dimensional Cost Instance - */ - - public static final NonDimensionalCostCorrelated Zero() - { - try { - return new NonDimensionalCostCorrelated (0., 0., 0., 0., 0., 0., 0.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * NonDimensionalCostCorrelated Constructor - * - * @param dblRealization The Realized Non Dimensional Value - * @param dblNonDimensionalTradeRate The Non Dimensional Trade Rate - * @param dblLiquidityGradient The Realized Non Dimensional Value Liquidity Gradient - * @param dblLiquidityJacobian The Realized Non Dimensional Value Liquidity Jacobian - * @param dblVolatilityGradient The Realized Non Dimensional Value Volatility Gradient - * @param dblVolatilityJacobian The Realized Non Dimensional Value Volatility Jacobian - * @param dblLiquidityVolatilityGradient The Realized Non Dimensional Value Liquidity/Volatility Gradient - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public NonDimensionalCostCorrelated ( - final double dblRealization, - final double dblLiquidityGradient, - final double dblLiquidityJacobian, - final double dblVolatilityGradient, - final double dblVolatilityJacobian, - final double dblLiquidityVolatilityGradient, - final double dblNonDimensionalTradeRate) - throws java.lang.Exception - { - super (dblRealization, dblNonDimensionalTradeRate); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblLiquidityGradient = dblLiquidityGradient) || - !org.drip.quant.common.NumberUtil.IsValid (_dblLiquidityJacobian = dblLiquidityJacobian) || - !org.drip.quant.common.NumberUtil.IsValid (_dblVolatilityGradient = dblVolatilityGradient) || - !org.drip.quant.common.NumberUtil.IsValid (_dblVolatilityJacobian = - dblVolatilityJacobian) || !org.drip.quant.common.NumberUtil.IsValid - (_dblLiquidityVolatilityGradient = dblLiquidityVolatilityGradient)) - throw new java.lang.Exception ("NonDimensionalCostCorrelated Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Non Dimensional Value Liquidity Gradient - * - * @return The Non Dimensional Value Liquidity Gradient - */ - - public double liquidityGradient() - { - return _dblLiquidityGradient; - } - - /** - * Retrieve the Non Dimensional Value Liquidity Jacobian - * - * @return The Non Dimensional Value Liquidity Jacobian - */ - - public double liquidityJacobian() - { - return _dblLiquidityJacobian; - } - - /** - * Retrieve the Non Dimensional Value Volatility Gradient - * - * @return The Non Dimensional Value Volatility Gradient - */ - - public double volatilityGradient() - { - return _dblVolatilityGradient; - } - - /** - * Retrieve the Non Dimensional Value Volatility Jacobian - * - * @return The Non Dimensional Value Volatility Jacobian - */ - - public double volatilityJacobian() - { - return _dblVolatilityJacobian; - } - - /** - * Retrieve the Non Dimensional Value Liquidity/Volatility Gradient - * - * @return The Non Dimensional Value Liquidity/Volatility Gradient - */ - - public double liquidityVolatilityGradient() - { - return _dblLiquidityVolatilityGradient; - } -} diff --git a/org/drip/execution/hjb/NonDimensionalCostEvolver.java b/org/drip/execution/hjb/NonDimensionalCostEvolver.java deleted file mode 100644 index b5ffb2b..0000000 --- a/org/drip/execution/hjb/NonDimensionalCostEvolver.java +++ /dev/null @@ -1,152 +0,0 @@ - -package org.drip.execution.hjb; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NonDimensionalCostEvolver exposes the HJB-based Single Step Optimal Trajectory Cost Step Evolver using the - * Variants of the Coordinated Variation Version of the Stochastic Volatility and the Transaction Function - * arising from the Realization of the Market State Variable as described in the "Trading Time" Model. The - * References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class NonDimensionalCostEvolver { - protected static final double SINGULAR_URGENCY_THRESHOLD = 50.; - - private boolean _bAsymptoticEnhancedEulerCorrection = false; - private org.drip.measure.process.OrnsteinUhlenbeck _ou = null; - private double _dblAsymptoticEulerUrgencyThreshold = java.lang.Double.NaN; - - protected abstract double advance ( - final org.drip.execution.hjb.NonDimensionalCost ndc, - final org.drip.execution.latent.MarketState ms, - final double[] adblMarketStateTweak, - final double dblNonDimensionalRiskAversion) - throws java.lang.Exception; - - protected NonDimensionalCostEvolver ( - final org.drip.measure.process.OrnsteinUhlenbeck ou, - final double dblAsymptoticEulerUrgencyThreshold, - final boolean bAsymptoticEnhancedEulerCorrection) - throws java.lang.Exception - { - if (null == (_ou = ou) || !org.drip.quant.common.NumberUtil.IsValid - (_dblAsymptoticEulerUrgencyThreshold = dblAsymptoticEulerUrgencyThreshold)) - throw new java.lang.Exception ("NonDimensionalCostEvolver Constructor => Invalid Inputs"); - - _bAsymptoticEnhancedEulerCorrection = bAsymptoticEnhancedEulerCorrection; - } - - /** - * Retrieve the Asymptotic Enhanced Euler Correction Application Flag - * - * @return The Asymptotic Enhanced Euler Correction Application Flag - */ - - public boolean asymptoticEnhancedEulerCorrection() - { - return _bAsymptoticEnhancedEulerCorrection; - } - - /** - * Retrieve the Asymptotic Euler Urgency Threshold - * - * @return The Asymptotic Euler Urgency Threshold - */ - - public double asymptoticEulerUrgencyThreshold() - { - return _dblAsymptoticEulerUrgencyThreshold; - } - - /** - * Retrieve the Reference Ornstein-Unlenbeck Process - * - * @return The Reference Ornstein-Unlenbeck Process - */ - - public org.drip.measure.process.OrnsteinUhlenbeck ornsteinUnlenbeckProcess() - { - return _ou; - } - - /** - * Evolve a Single Time Step of the Optimal Trajectory - * - * @param ndc The Initial Non Dimensional Cost Value Function - * @param ms The Market State - * @param dblNonDimensionalRiskAversion The Non Dimensional Risk Aversion Parameter - * @param dblNonDimensionalTime The Non Dimensional Time Node - * @param dblNonDimensionalTimeIncrement The Non Dimensional Time Increment - * - * @return The Post Evolved Non-dimensional Cost Value Function - */ - - public abstract org.drip.execution.hjb.NonDimensionalCost evolve ( - final org.drip.execution.hjb.NonDimensionalCost ndc, - final org.drip.execution.latent.MarketState ms, - final double dblNonDimensionalRiskAversion, - final double dblNonDimensionalTime, - final double dblNonDimensionalTimeIncrement); -} diff --git a/org/drip/execution/hjb/NonDimensionalCostEvolverCorrelated.java b/org/drip/execution/hjb/NonDimensionalCostEvolverCorrelated.java deleted file mode 100644 index 39ff266..0000000 --- a/org/drip/execution/hjb/NonDimensionalCostEvolverCorrelated.java +++ /dev/null @@ -1,205 +0,0 @@ - -package org.drip.execution.hjb; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NonDimensionalCostEvolverCorrelated implements the Correlated HJB-based Single Step Optimal Trajectory - * Cost Step Evolver using the Correlated Coordinated Variation Version of the Stochastic Volatility and the - * Transaction Function arising from the Realization of the Market State Variable as described in the - * "Trading Time" Model. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class NonDimensionalCostEvolverCorrelated extends - org.drip.execution.hjb.NonDimensionalCostEvolver { - - @Override protected double advance ( - final org.drip.execution.hjb.NonDimensionalCost ndc, - final org.drip.execution.latent.MarketState ms, - final double[] adblMarketStateTweak, - final double dblNonDimensionalRiskAversion) - throws java.lang.Exception - { - org.drip.execution.hjb.NonDimensionalCostCorrelated ndcc = - (org.drip.execution.hjb.NonDimensionalCostCorrelated) ndc; - - org.drip.measure.process.OrnsteinUhlenbeckPair oup2D = - (org.drip.measure.process.OrnsteinUhlenbeckPair) ornsteinUnlenbeckProcess(); - - org.drip.measure.dynamics.DiffusionEvaluatorOrnsteinUhlenbeck oup1DLiquidity = oup2D.reference(); - - org.drip.measure.dynamics.DiffusionEvaluatorOrnsteinUhlenbeck oup1DVolatility = oup2D.derived(); - - double dblVolatilityMarketState = ms.volatility() + adblMarketStateTweak[1]; - - double dblLiquidityMarketState = ms.liquidity() + adblMarketStateTweak[0]; - - double dblMu = oup1DLiquidity.relaxationTime() / oup1DVolatility.relaxationTime(); - - double dblVolatilityBurstiness = oup1DVolatility.burstiness(); - - double dblLiquidityBurstiness = oup1DLiquidity.burstiness(); - - double dblNonDimensionalCost = ndc.realization(); - - return - dblNonDimensionalRiskAversion * dblNonDimensionalRiskAversion * java.lang.Math.exp (2. * - dblVolatilityMarketState) - - dblNonDimensionalCost * dblNonDimensionalCost * java.lang.Math.exp (-dblLiquidityMarketState) + - oup2D.correlation() + java.lang.Math.sqrt (dblMu) * dblLiquidityBurstiness * - dblVolatilityBurstiness * ndcc.liquidityVolatilityGradient() + - 0.5 * dblLiquidityBurstiness * dblLiquidityBurstiness * ndcc.liquidityJacobian() + - 0.5 * dblMu * dblVolatilityBurstiness * dblVolatilityBurstiness * ndcc.volatilityJacobian() - - dblLiquidityMarketState * ndcc.liquidityGradient() - - dblMu * dblVolatilityMarketState * ndcc.volatilityGradient(); - } - - /** - * NonDimensionalCostEvolverCorrelated Constructor - * - * @param oup2D The 2D Ornstein-Unlenbeck Generator Process - * @param bAsymptoticEnhancedEulerCorrection Asymptotic Enhanced Euler Correction Application Flag - * @param dblAsymptoticEulerUrgencyThreshold The Asymptotic Euler Urgency Threshold - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public NonDimensionalCostEvolverCorrelated ( - final org.drip.measure.process.OrnsteinUhlenbeckPair oup2D, - final double dblAsymptoticEulerUrgencyThreshold, - final boolean bAsymptoticEnhancedEulerCorrection) - throws java.lang.Exception - { - super (oup2D, dblAsymptoticEulerUrgencyThreshold, bAsymptoticEnhancedEulerCorrection); - } - - @Override public org.drip.execution.hjb.NonDimensionalCost evolve ( - final org.drip.execution.hjb.NonDimensionalCost ndc, - final org.drip.execution.latent.MarketState ms, - final double dblNonDimensionalRiskAversion, - final double dblNonDimensionalTime, - final double dblNonDimensionalTimeIncrement) - { - if (null == ndc || !(ndc instanceof org.drip.execution.hjb.NonDimensionalCostCorrelated) || null - == ms || !org.drip.quant.common.NumberUtil.IsValid (dblNonDimensionalRiskAversion) || - !org.drip.quant.common.NumberUtil.IsValid (dblNonDimensionalTime) || - !org.drip.quant.common.NumberUtil.IsValid (dblNonDimensionalTimeIncrement)) - return null; - - double dblLiquidityMarketState = ms.liquidity(); - - double dblLiquidityMarketStateIncrement = 0.01 * dblLiquidityMarketState; - - double dblVolatilityMarketStateIncrement = 0.01 * ms.volatility(); - - try { - double dblCostIncrementMid = advance (ndc, ms, new double[] {0., 0.}, - dblNonDimensionalRiskAversion) * dblNonDimensionalTimeIncrement; - - double dblCostIncrementLiquidityUp = advance (ndc, ms, new double[] - {dblLiquidityMarketStateIncrement, 0.}, dblNonDimensionalRiskAversion) * - dblNonDimensionalTimeIncrement; - - double dblCostIncrementLiquidityDown = advance (ndc, ms, new double[] - {-dblLiquidityMarketStateIncrement, 0.}, dblNonDimensionalRiskAversion) * - dblNonDimensionalTimeIncrement; - - double dblCostIncrementVolatilityUp = advance (ndc, ms, new double[] {0., - dblVolatilityMarketStateIncrement}, dblNonDimensionalRiskAversion) * - dblNonDimensionalTimeIncrement; - - double dblCostIncrementVolatilityDown = advance (ndc, ms, new double[] {0., - -dblVolatilityMarketStateIncrement}, dblNonDimensionalRiskAversion) * - dblNonDimensionalTimeIncrement; - - double dblCostIncrementCrossUp = advance (ndc, ms, new double[] - {dblLiquidityMarketStateIncrement, dblVolatilityMarketStateIncrement}, - dblNonDimensionalRiskAversion) * dblNonDimensionalTimeIncrement; - - double dblCostIncrementCrossDown = advance (ndc, ms, new double[] - {-dblLiquidityMarketStateIncrement, -dblVolatilityMarketStateIncrement}, - dblNonDimensionalRiskAversion) * dblNonDimensionalTimeIncrement; - - double dblNonDimensionalCost = ndc.realization() + dblCostIncrementMid; - - return new org.drip.execution.hjb.NonDimensionalCostCorrelated ( - dblNonDimensionalCost, - 0.5 * (dblCostIncrementLiquidityUp - dblCostIncrementLiquidityDown) / - dblLiquidityMarketStateIncrement, - (dblCostIncrementLiquidityUp + dblCostIncrementLiquidityDown - 2. * dblCostIncrementMid) / - (dblLiquidityMarketStateIncrement * dblLiquidityMarketStateIncrement), - 0.5 * (dblCostIncrementVolatilityUp - dblCostIncrementVolatilityDown) / - dblVolatilityMarketStateIncrement, - (dblCostIncrementVolatilityUp + dblCostIncrementVolatilityDown - 2. * dblCostIncrementMid) / - (dblVolatilityMarketStateIncrement * dblVolatilityMarketStateIncrement), - 0.25 * (dblCostIncrementCrossUp - dblCostIncrementCrossDown) / - (dblLiquidityMarketStateIncrement * dblVolatilityMarketStateIncrement), - dblNonDimensionalCost * java.lang.Math.exp (-dblLiquidityMarketState)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/hjb/NonDimensionalCostEvolverSystemic.java b/org/drip/execution/hjb/NonDimensionalCostEvolverSystemic.java deleted file mode 100644 index 768ae3e..0000000 --- a/org/drip/execution/hjb/NonDimensionalCostEvolverSystemic.java +++ /dev/null @@ -1,194 +0,0 @@ - -package org.drip.execution.hjb; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NonDimensionalCostEvolverSystemic implements the 1D HJB-based Single Step Optimal Trajectory Cost Step - * Evolver using the Systemic Coordinated Variation Version of the Stochastic Volatility and the Transaction - * Function arising from the Realization of the Market State Variable as described in the "Trading Time" - * Model. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class NonDimensionalCostEvolverSystemic extends org.drip.execution.hjb.NonDimensionalCostEvolver -{ - - /** - * Construct a Standard NonDimensionalCostEvolverSystemic Instance - * - * @param ou The Underlying Ornstein-Unlenbeck Reference Process - * - * @return The Standard NonDimensionalCostEvolverSystemic Instance - */ - - public static final NonDimensionalCostEvolverSystemic Standard ( - final org.drip.measure.process.OrnsteinUhlenbeck ou) - { - try { - return new NonDimensionalCostEvolverSystemic (ou, - org.drip.execution.hjb.NonDimensionalCostEvolver.SINGULAR_URGENCY_THRESHOLD, true); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override protected double advance ( - final org.drip.execution.hjb.NonDimensionalCost ndc, - final org.drip.execution.latent.MarketState ms, - final double[] adblMarketStateTweak, - final double dblNonDimensionalRiskAversion) - throws java.lang.Exception - { - double dblNonDimensionalCost = ndc.realization(); - - double dblMarketState = ms.liquidity() + adblMarketStateTweak[0]; - - double dblBurstiness = ornsteinUnlenbeckProcess().referenceBurstiness(); - - org.drip.execution.hjb.NonDimensionalCostSystemic ndcs = - (org.drip.execution.hjb.NonDimensionalCostSystemic) ndc; - - return java.lang.Math.exp (-dblMarketState) * (dblNonDimensionalRiskAversion * - dblNonDimensionalRiskAversion - dblNonDimensionalCost * dblNonDimensionalCost) + 0.5 * - dblBurstiness * dblBurstiness * ndcs.jacobian() - dblMarketState * ndcs.gradient(); - } - - /** - * NonDimensionalCostEvolverSystemic Constructor - * - * @param ou The Underlying Ornstein-Unlenbeck Reference Process - * @param bAsymptoticEnhancedEulerCorrection Asymptotic Enhanced Euler Correction Application Flag - * @param dblAsymptoticEulerUrgencyThreshold The Asymptotic Euler Urgency Threshold - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public NonDimensionalCostEvolverSystemic ( - final org.drip.measure.process.OrnsteinUhlenbeck ou, - final double dblAsymptoticEulerUrgencyThreshold, - final boolean bAsymptoticEnhancedEulerCorrection) - throws java.lang.Exception - { - super (ou, dblAsymptoticEulerUrgencyThreshold, bAsymptoticEnhancedEulerCorrection); - } - - @Override public org.drip.execution.hjb.NonDimensionalCost evolve ( - final org.drip.execution.hjb.NonDimensionalCost ndc, - final org.drip.execution.latent.MarketState ms, - final double dblNonDimensionalRiskAversion, - final double dblNonDimensionalTime, - final double dblNonDimensionalTimeIncrement) - { - if (null == ndc || !(ndc instanceof org.drip.execution.hjb.NonDimensionalCostSystemic) || null - == ms || !org.drip.quant.common.NumberUtil.IsValid (dblNonDimensionalRiskAversion) || - !org.drip.quant.common.NumberUtil.IsValid (dblNonDimensionalTime) || - !org.drip.quant.common.NumberUtil.IsValid (dblNonDimensionalTimeIncrement)) - return null; - - double dblMarketState = ms.liquidity(); - - double dblMarketStateIncrement = 0.01 * dblMarketState; - - double dblMarketStateExponentiation = java.lang.Math.exp (dblMarketState); - - if (asymptoticEulerUrgencyThreshold() * dblNonDimensionalTime < 1.) { - if (!asymptoticEnhancedEulerCorrection()) - return org.drip.execution.hjb.NonDimensionalCostSystemic.LinearThreshold - (dblMarketStateExponentiation, dblNonDimensionalTime); - - double dblBurstiness = ornsteinUnlenbeckProcess().referenceBurstiness(); - - double dblNonDimensionalCostCross = -0.5 * dblMarketState * dblMarketStateExponentiation; - - return org.drip.execution.hjb.NonDimensionalCostSystemic.EulerEnhancedLinearThreshold - (dblMarketState, ((1. / dblNonDimensionalTimeIncrement) + 0.25 * dblBurstiness * - dblBurstiness) * java.lang.Math.exp (dblMarketState) + dblNonDimensionalCostCross, - dblNonDimensionalCostCross); - } - - try { - double dblCostIncrementMid = advance (ndc, ms, new double[] {0.}, dblNonDimensionalRiskAversion) - * dblNonDimensionalTimeIncrement; - - double dblCostIncrementUp = advance (ndc, ms, new double[] {dblMarketStateIncrement}, - dblNonDimensionalRiskAversion) * dblNonDimensionalTimeIncrement; - - double dblCostIncrementDown = advance (ndc, ms, new double[] {-1. * dblMarketStateIncrement}, - dblNonDimensionalRiskAversion) * dblNonDimensionalTimeIncrement; - - double dblCost = ndc.realization() + dblCostIncrementMid; - - return new org.drip.execution.hjb.NonDimensionalCostSystemic (dblCost, 0.5 * - (dblCostIncrementUp - dblCostIncrementDown) / dblMarketStateIncrement, (dblCostIncrementUp + - dblCostIncrementDown - 2. * dblCostIncrementMid) / (dblMarketStateIncrement * - dblMarketStateIncrement), dblCost / dblMarketStateExponentiation); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/hjb/NonDimensionalCostSystemic.java b/org/drip/execution/hjb/NonDimensionalCostSystemic.java deleted file mode 100644 index 17d0ebc..0000000 --- a/org/drip/execution/hjb/NonDimensionalCostSystemic.java +++ /dev/null @@ -1,200 +0,0 @@ - -package org.drip.execution.hjb; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NonDimensionalCostSystemic contains the Level, the Gradient, and the Jacobian of the HJB Non Dimensional - * Cost Value Function to the Systemic Market State. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class NonDimensionalCostSystemic extends org.drip.execution.hjb.NonDimensionalCost { - private double _dblGradient = java.lang.Double.NaN; - private double _dblJacobian = java.lang.Double.NaN; - - /** - * Generate a Zero Sensitivity Systemic Non Dimensional Cost Instance - * - * @return The Zero Sensitivity Systemic Non Dimensional Cost Instance - */ - - public static final NonDimensionalCostSystemic Zero() - { - try { - return new NonDimensionalCostSystemic (0., 0., 0., 0.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate a Linear Trading Systemic Non Dimensional Cost Instance - * - * @param dblMarketStateExponentiation The Exponentiated Market State - * @param dblNonDimensionalTime The Non Dimensional Time - * - * @return The Linear Trading Systemic Non Dimensional Cost Instance - */ - - public static final NonDimensionalCostSystemic LinearThreshold ( - final double dblMarketStateExponentiation, - final double dblNonDimensionalTime) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblMarketStateExponentiation) || - !org.drip.quant.common.NumberUtil.IsValid (dblNonDimensionalTime) || 0. >= dblNonDimensionalTime) - return null; - - double dblNonDimensionalUrgency = 1. / dblNonDimensionalTime; - double dblNonDimensionalCostThreshold = dblMarketStateExponentiation * dblNonDimensionalUrgency; - - try { - return new NonDimensionalCostSystemic (dblNonDimensionalCostThreshold, - dblNonDimensionalCostThreshold, dblNonDimensionalCostThreshold, dblNonDimensionalUrgency); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate a Euler Enhanced Linear Trading Systemic Non Dimensional Cost Instance - * - * @param dblMarketState The Market State - * @param dblNonDimensionalCost The Non Dimensional Cost - * @param dblNonDimensionalCostCross The Non Dimensional Cost Cross Term - * - * @return The Euler Enhanced Linear Trading Systemic Non Dimensional Cost Instance - */ - - public static final NonDimensionalCostSystemic EulerEnhancedLinearThreshold ( - final double dblMarketState, - final double dblNonDimensionalCost, - final double dblNonDimensionalCostCross) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblMarketState) || - !org.drip.quant.common.NumberUtil.IsValid (dblNonDimensionalCost) || - !org.drip.quant.common.NumberUtil.IsValid (dblNonDimensionalCostCross)) - return null; - - try { - return new NonDimensionalCostSystemic (dblNonDimensionalCost, dblNonDimensionalCost + - dblNonDimensionalCostCross, dblNonDimensionalCost + 2. * dblNonDimensionalCostCross, - java.lang.Math.exp (-dblMarketState) * dblNonDimensionalCost); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * NonDimensionalCostSystemic Constructor - * - * @param dblRealization The Non Dimensional Cost Value Function Realization - * @param dblGradient The Non Dimensional Cost Value Function Gradient to the Systemic Market State - * @param dblJacobian The Non Dimensional Cost Value Function Jacobian to the Systemic Market State - * @param dblNonDimensionalTradeRate The Non-dimensional Trade Rate - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public NonDimensionalCostSystemic ( - final double dblRealization, - final double dblGradient, - final double dblJacobian, - final double dblNonDimensionalTradeRate) - throws java.lang.Exception - { - super (dblRealization, dblNonDimensionalTradeRate); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblGradient = dblGradient) || - !org.drip.quant.common.NumberUtil.IsValid (_dblJacobian = dblJacobian)) - throw new java.lang.Exception ("NonDimensionalCostSystemic Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Realized Non Dimensional Cost Value Function Gradient to the Systemic Market State - * - * @return The Realized Non Dimensional Cost Value Function Gradient to the Systemic Market State - */ - - public double gradient() - { - return _dblGradient; - } - - /** - * Retrieve the Realized Non Dimensional Cost Value Function Jacobian to the Systemic Market State - * - * @return The Realized Non Dimensional Cost Value Function Jacobian to the Systemic Market State - */ - - public double jacobian() - { - return _dblJacobian; - } -} diff --git a/org/drip/execution/impact/ParticipationRateLinear.java b/org/drip/execution/impact/ParticipationRateLinear.java deleted file mode 100644 index a021b32..0000000 --- a/org/drip/execution/impact/ParticipationRateLinear.java +++ /dev/null @@ -1,190 +0,0 @@ - -package org.drip.execution.impact; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ParticipationRateLinear implements a Linear Temporary/Permanent Market Impact Function where the Price - * Change scales linearly with the Trade Rate, along with an Offset. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange Analysis - * of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class ParticipationRateLinear extends org.drip.execution.impact.TransactionFunctionLinear { - private double _dblSlope = java.lang.Double.NaN; - private double _dblOffset = java.lang.Double.NaN; - - /** - * Construct a Vanilla Zero-Impact ParticipationRateLinear Instance - * - * @return The Vanilla Zero-Impact ParticipationRateLinear Instance - */ - - public static final ParticipationRateLinear NoImpact() - { - try { - return new ParticipationRateLinear (0., 0.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Vanilla Slope-Only ParticipationRateLinear Instance - * - * @param dblSlope The Slope - * - * @return The Vanilla Slope-Only ParticipationRateLinear Instance - */ - - public static final ParticipationRateLinear SlopeOnly ( - final double dblSlope) - { - try { - return new ParticipationRateLinear (0., dblSlope); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * ParticipationRateLinear Constructor - * - * @param dblOffset The Offset Market Impact Parameter - * @param dblSlope The Linear Market Impact Slope Parameter - * - * @throws java.lang.Exception Propagated up from R1ToR1 - */ - - public ParticipationRateLinear ( - final double dblOffset, - final double dblSlope) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblOffset = dblOffset) || 0. > _dblOffset || - !org.drip.quant.common.NumberUtil.IsValid (_dblSlope = dblSlope) || 0. > _dblSlope) - throw new java.lang.Exception ("ParticipationRateLinear Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Linear Market Impact Slope Parameter - * - * @return The Linear Market Impact Slope Parameter - */ - - public double slope() - { - return _dblSlope; - } - - /** - * Retrieve the Offset Market Impact Parameter - * - * @return The Offset Market Impact Parameter - */ - - public double offset() - { - return _dblOffset; - } - - @Override public double regularize ( - final double dblTradeInterval) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblTradeInterval) || 0 >= dblTradeInterval) - throw new java.lang.Exception ("ParticipationRateLinear::regularize => Invalid Inputs"); - - return 1. / dblTradeInterval; - } - - @Override public double modulate ( - final double dblTradeInterval) - throws java.lang.Exception - { - return 1.; - } - - @Override public double evaluate ( - final double dblTradeRate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblTradeRate)) - throw new java.lang.Exception ("ParticipationRateLinear::evaluate => Invalid Inputs"); - - return (dblTradeRate < 0. ? -1. : 1.) * _dblOffset + _dblSlope * dblTradeRate; - } - - @Override public double derivative ( - final double dblTradeRate, - final int iOrder) - throws java.lang.Exception - { - if (0 >= iOrder) - throw new java.lang.Exception ("ParticipationRateLinear::derivative => Invalid Inputs"); - - return 1 == iOrder ? _dblSlope : 0.; - } -} diff --git a/org/drip/execution/impact/ParticipationRatePower.java b/org/drip/execution/impact/ParticipationRatePower.java deleted file mode 100644 index 1a4de00..0000000 --- a/org/drip/execution/impact/ParticipationRatePower.java +++ /dev/null @@ -1,147 +0,0 @@ - -package org.drip.execution.impact; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ParticipationRatePower implements a Power-Law Based Temporary/Permanent Market Impact Function where the - * Price Change scales as a Power of the Trade Rate. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R., and N. Chriss (2003): Optimal Execution with Nonlinear Impact Functions and Trading- - * Enhanced Risk, Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * @author Lakshmi Krishnamurthy - */ - -public class ParticipationRatePower extends org.drip.execution.impact.TransactionFunctionPower { - private double _dblConstant = java.lang.Double.NaN; - private double _dblExponent = java.lang.Double.NaN; - - /** - * ParticipationRatePower Constructor - * - * @param dblConstant The Market Impact Constant Parameter - * @param dblExponent The Market Impact Power Law Exponent - * - * @throws java.lang.Exception Propagated up from R1ToR1 - */ - - public ParticipationRatePower ( - final double dblConstant, - final double dblExponent) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblConstant = dblConstant) || 0. > _dblConstant || - !org.drip.quant.common.NumberUtil.IsValid (_dblExponent = dblExponent) || 0. > _dblExponent) - throw new java.lang.Exception ("ParticipationRatePower Constructor => Invalid Inputs"); - } - - @Override public double constant() - { - return _dblConstant; - } - - @Override public double exponent() - { - return _dblExponent; - } - - @Override public double regularize ( - final double dblTradeInterval) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblTradeInterval) || 0 >= dblTradeInterval) - throw new java.lang.Exception ("ParticipationRatePower::regularize => Invalid Inputs"); - - return 1. / dblTradeInterval; - } - - @Override public double modulate ( - final double dblTradeInterval) - throws java.lang.Exception - { - return 1.; - } - - @Override public double evaluate ( - final double dblTradeRate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblTradeRate)) - throw new java.lang.Exception ("ParticipationRatePower::evaluate => Invalid Inputs"); - - return (dblTradeRate < 0. ? -1. : 1.) * _dblConstant * java.lang.Math.pow (java.lang.Math.abs - (dblTradeRate), _dblExponent); - } - - @Override public double derivative ( - final double dblTradeRate, - final int iOrder) - throws java.lang.Exception - { - if (0 >= iOrder || !org.drip.quant.common.NumberUtil.IsValid (dblTradeRate)) - throw new java.lang.Exception ("ParticipationRatePower::derivative => Invalid Inputs"); - - double dblCoefficient = 1.; - - for (int i = 0; i < iOrder; ++i) - dblCoefficient = dblCoefficient * (_dblExponent - i); - - return (dblTradeRate < 0. ? -1. : 1.) * dblCoefficient * _dblConstant * java.lang.Math.pow - (java.lang.Math.abs (dblTradeRate), _dblExponent - iOrder); - } -} diff --git a/org/drip/execution/impact/TransactionFunction.java b/org/drip/execution/impact/TransactionFunction.java deleted file mode 100644 index 643146a..0000000 --- a/org/drip/execution/impact/TransactionFunction.java +++ /dev/null @@ -1,203 +0,0 @@ - -package org.drip.execution.impact; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TransactionFunction exports the Temporary/Permanent Market Impact Displacement/Volatility Functional - * Dependence on the Trade Rate. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class TransactionFunction extends org.drip.function.definition.R1ToR1 { - - protected TransactionFunction() - { - super (null); - } - - /** - * Regularize the Input Function using the specified Trade Inputs - * - * @param dblTradeInterval The Trade Interval - * - * @return The Regularize Input - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public abstract double regularize ( - final double dblTradeInterval) - throws java.lang.Exception; - - /** - * Modulate/Scale the Impact Output - * - * @param dblTradeInterval The Trade Interval - * - * @return The Modulated Output - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public abstract double modulate ( - final double dblTradeInterval) - throws java.lang.Exception; - - /** - * Evaluate the Impact Function at the specified Trade Parameters - * - * @param dblTradeAmount The Trade Amount - * @param dblTradeInterval The Trade Interval - * - * @return The Value of the Impact Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double evaluate ( - final double dblTradeAmount, - final double dblTradeInterval) - throws java.lang.Exception - { - return modulate (dblTradeInterval) * evaluate (dblTradeAmount * regularize (dblTradeInterval)); - } - - /** - * Compute the Sensitivity to the Left Holdings - * - * @param dblTradeAmount The Trade Amount - * @param dblTradeInterval The Trade Interval - * @param iOrder Order of the Derivative - * - * @return The Sensitivity to the Left Holdings of the Impact Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double leftHoldingsDerivative ( - final double dblTradeAmount, - final double dblTradeInterval, - final int iOrder) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblTradeAmount) || 0 >= iOrder) - throw new java.lang.Exception ("TransactionFunction::leftHoldingsDerivative => Invalid Inputs"); - - double dblRegularizedInput = regularize (dblTradeInterval); - - return modulate (dblTradeInterval) * java.lang.Math.pow (-1. * dblRegularizedInput, iOrder) * - derivative (dblTradeAmount * dblRegularizedInput, iOrder); - } - - /** - * Compute the Sensitivity to the Right Holdings - * - * @param dblTradeAmount The Trade Amount - * @param dblTradeInterval The Trade Interval - * @param iOrder Order of the Derivative - * - * @return The Sensitivity to the Right Holdings of the Impact Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double rightHoldingsDerivative ( - final double dblTradeAmount, - final double dblTradeInterval, - final int iOrder) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblTradeAmount) || 0 >= iOrder) - throw new java.lang.Exception ("TransactionFunction::rightHoldingsDerivative => Invalid Inputs"); - - double dblRegularizedInput = regularize (dblTradeInterval); - - return modulate (dblTradeInterval) * java.lang.Math.pow (dblRegularizedInput, iOrder) * derivative - (dblTradeAmount * dblRegularizedInput, iOrder); - } - - /** - * Compute the Second Order Sensitivity to the Left/Right Holdings - * - * @param dblTradeAmount The Trade Amount - * @param dblTradeInterval The Trade Interval - * - * @return The Second Order Sensitivity to the Left/Right Holdings of the Impact Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double crossHoldingsDerivative ( - final double dblTradeAmount, - final double dblTradeInterval) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblTradeAmount)) - throw new java.lang.Exception ("TransactionFunction::crossHoldingsDerivative => Invalid Inputs"); - - double dblRegularizedInput = regularize (dblTradeInterval); - - return -1. * modulate (dblTradeInterval) * dblRegularizedInput * dblRegularizedInput * derivative - (dblTradeAmount * dblRegularizedInput, 2); - } -} diff --git a/org/drip/execution/impact/TransactionFunctionLinear.java b/org/drip/execution/impact/TransactionFunctionLinear.java deleted file mode 100644 index c075e74..0000000 --- a/org/drip/execution/impact/TransactionFunctionLinear.java +++ /dev/null @@ -1,86 +0,0 @@ - -package org.drip.execution.impact; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TransactionFunctionLinear exposes the Linear Impact Function Stubs as defined in Almgren and Chriss (2000) - * and Almgren (2003). The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class TransactionFunctionLinear extends org.drip.execution.impact.TransactionFunction { - - /** - * Retrieve the Offset Market Impact Parameter - * - * @return The Offset Market Impact Parameter - */ - - public abstract double offset(); - - /** - * Retrieve the Slope Market Impact Parameter - * - * @return The Slope Market Impact Parameter - */ - - public abstract double slope(); -} diff --git a/org/drip/execution/impact/TransactionFunctionPower.java b/org/drip/execution/impact/TransactionFunctionPower.java deleted file mode 100644 index 919ff7b..0000000 --- a/org/drip/execution/impact/TransactionFunctionPower.java +++ /dev/null @@ -1,86 +0,0 @@ - -package org.drip.execution.impact; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TransactionFunctionPower exposes the Power Law Impact Function Stubs as defined in Almgren and Chriss - * (2000) and Almgren (2003). The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class TransactionFunctionPower extends org.drip.execution.impact.TransactionFunction { - - /** - * Retrieve the Constant Market Impact Parameter - * - * @return The Constant Market Impact Parameter - */ - - public abstract double constant(); - - /** - * Retrieve the Power Law Exponent Market Impact Parameter - * - * @return The Power Law Exponent Market Impact Parameter - */ - - public abstract double exponent(); -} diff --git a/org/drip/execution/latent/MarketState.java b/org/drip/execution/latent/MarketState.java deleted file mode 100644 index 2c11f41..0000000 --- a/org/drip/execution/latent/MarketState.java +++ /dev/null @@ -1,89 +0,0 @@ - -package org.drip.execution.latent; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * MarketState holds the Random Market State(s) that control(s) the Cost Evolution and the Eventual Optimal - * Trajectory Generation. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public interface MarketState { - - /** - * Retrieve the Realized Liquidity Market State - * - * @return The Realized Liquidity Market State Realization - */ - - public abstract double liquidity(); - - /** - * Retrieve the Realized Volatility Market State - * - * @return The Realized Volatility Market State Realization - */ - - public abstract double volatility(); -} diff --git a/org/drip/execution/latent/MarketStateCorrelated.java b/org/drip/execution/latent/MarketStateCorrelated.java deleted file mode 100644 index 72c1798..0000000 --- a/org/drip/execution/latent/MarketStateCorrelated.java +++ /dev/null @@ -1,115 +0,0 @@ - -package org.drip.execution.latent; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * MarketStateCorrelated holds the Correlated Market State that drives the Liquidity and the Volatility - * Market States separately. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class MarketStateCorrelated implements org.drip.execution.latent.MarketState { - private double _dblLiquidity = java.lang.Double.NaN; - private double _dblVolatility = java.lang.Double.NaN; - - /** - * MarketStateCorrelated Constructor - * - * @param dblLiquidity The Realized Liquidity Market State Realization - * @param dblVolatility The Realized Volatility Market State Realization - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public MarketStateCorrelated ( - final double dblLiquidity, - final double dblVolatility) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblLiquidity = dblLiquidity) || - !org.drip.quant.common.NumberUtil.IsValid (_dblVolatility = dblVolatility)) - throw new java.lang.Exception ("MarketStateCorrelated Constructor => Invalid Inpus"); - } - - @Override public double liquidity() - { - return _dblLiquidity; - } - - @Override public double volatility() - { - return _dblVolatility; - } - - /** - * Retrieve the Liquidity/Volatility Market State Realizations - * - * @return The Liquidity/Volatility Market State Realizations - */ - - public double[] realization() - { - return new double[] {_dblLiquidity, _dblVolatility}; - } -} diff --git a/org/drip/execution/latent/MarketStateSystemic.java b/org/drip/execution/latent/MarketStateSystemic.java deleted file mode 100644 index eb818eb..0000000 --- a/org/drip/execution/latent/MarketStateSystemic.java +++ /dev/null @@ -1,111 +0,0 @@ - -package org.drip.execution.latent; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * MarketStateSystemic holds the Single Systemic Market State that drives both the Liquidity and the - * Volatility Market States. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class MarketStateSystemic implements org.drip.execution.latent.MarketState { - private double _dblCommon = java.lang.Double.NaN; - - /** - * MarketStateSystemic Constructor - * - * @param dblCommon The Common Systemic Market State - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public MarketStateSystemic ( - final double dblCommon) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblCommon = dblCommon)) - throw new java.lang.Exception ("MarketStateSystemic Constructor => Invalid Inpus"); - } - - /** - * Retrieve the Common Systemic Market State - * - * @return The Common Systemic Market State - */ - - public double common() - { - return _dblCommon; - } - - @Override public double liquidity() - { - return _dblCommon; - } - - @Override public double volatility() - { - return _dblCommon; - } -} diff --git a/org/drip/execution/latent/OrnsteinUhlenbeckSequence.java b/org/drip/execution/latent/OrnsteinUhlenbeckSequence.java deleted file mode 100644 index f6bd874..0000000 --- a/org/drip/execution/latent/OrnsteinUhlenbeckSequence.java +++ /dev/null @@ -1,242 +0,0 @@ - -package org.drip.execution.latent; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OrnsteinUhlenbeckSequence holds the Sequence of the Market State that drives the Liquidity and the - * Volatility Market States driven using an Ornstein-Uhlenbeck Process. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class OrnsteinUhlenbeckSequence { - private int _iCount = 0; - private org.drip.execution.latent.MarketState[] _aMS = null; - private double _dblGenerationInterval = java.lang.Double.NaN; - private org.drip.measure.process.OrnsteinUhlenbeck _ou = null; - - /** - * Construct a Standard Systemic Instance of OrnsteinUhlenbeckSequence - * - * @param deou The 1D Ornstein-Uhlenbeck Generator Scheme - * @param dblGenerationInterval The Generation Interval - * @param dblInitialMarketState The Initial Market State - * @param iCount Count of the Number of States to be generated - * - * @return The OrnsteinUhlenbeckSequence Instance - */ - - public static final OrnsteinUhlenbeckSequence Systemic ( - final org.drip.measure.dynamics.DiffusionEvaluatorOrnsteinUhlenbeck deou, - final double dblGenerationInterval, - final double dblInitialMarketState, - final int iCount) - { - if (null == deou || !org.drip.quant.common.NumberUtil.IsValid (dblGenerationInterval) || 0 >= - dblGenerationInterval || 1 >= iCount) - return null; - - double dblTime = 0.; - org.drip.execution.latent.MarketStateSystemic[] aMSS = new - org.drip.execution.latent.MarketStateSystemic[iCount]; - - try { - aMSS[0] = new org.drip.execution.latent.MarketStateSystemic (dblInitialMarketState); - - org.drip.measure.process.DiffusionEvolver de = new org.drip.measure.process.DiffusionEvolver - (deou); - - for (int i = 0; i < iCount - 1; ++i) { - org.drip.measure.realization.JumpDiffusionEdge gi = de.weinerIncrement (new - org.drip.measure.realization.JumpDiffusionVertex (dblTime, aMSS[i].common(), 0., false), - dblGenerationInterval); - - aMSS[i + 1] = new org.drip.execution.latent.MarketStateSystemic (aMSS[i].common() + - gi.deterministic() + gi.diffusionStochastic()); - - dblTime += dblGenerationInterval; - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return new OrnsteinUhlenbeckSequence (deou, aMSS, dblGenerationInterval); - } - - /** - * Construct a Standard Correlated Instance of OrnsteinUhlenbeckSequence - * - * @param oup2D The 2D Ornstein-Uhlenbeck Generator Scheme - * @param dblGenerationInterval The Generation Interval - * @param dblInitialLiquidityMarketState The Initial Liquidity Market State - * @param dblInitialVolatilityMarketState The Initial Volatility Market State - * @param iCount Count of the Number of States to be generated - * - * @return The OrnsteinUhlenbeckSequence Instance - */ - - public static final OrnsteinUhlenbeckSequence Correlated ( - final org.drip.measure.process.OrnsteinUhlenbeckPair oup2D, - final double dblGenerationInterval, - final double dblInitialLiquidityMarketState, - final double dblInitialVolatilityMarketState, - final int iCount) - { - if (null == oup2D || !org.drip.quant.common.NumberUtil.IsValid (dblGenerationInterval) || 0 >= - dblGenerationInterval || 1 >= iCount) - return null; - - org.drip.execution.latent.MarketStateCorrelated[] aMSC = new - org.drip.execution.latent.MarketStateCorrelated[iCount]; - - try { - aMSC[0] = new org.drip.execution.latent.MarketStateCorrelated (dblInitialLiquidityMarketState, - dblInitialVolatilityMarketState); - - for (int i = 0; i < iCount - 1; ++i) { - org.drip.measure.realization.JumpDiffusionEdge[] aGI = oup2D.weinerIncrement - (aMSC[i].realization(), dblGenerationInterval); - - if (null == aGI || 2 != aGI.length) return null; - - aMSC[i + 1] = new org.drip.execution.latent.MarketStateCorrelated (aMSC[i].liquidity() + - aGI[0].deterministic() + aGI[0].diffusionStochastic(), aMSC[i].volatility() + - aGI[1].deterministic() + aGI[1].diffusionStochastic()); - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return new OrnsteinUhlenbeckSequence (oup2D, aMSC, dblGenerationInterval); - } - - private OrnsteinUhlenbeckSequence ( - final org.drip.measure.process.OrnsteinUhlenbeck ou, - final org.drip.execution.latent.MarketState[] aMS, - final double dblGenerationInterval) - { - _ou = ou; - _aMS = aMS; - _iCount = aMS.length; - _dblGenerationInterval = dblGenerationInterval; - } - - /** - * Retrieve the Total Count of States realized - * - * @return The Total Count of States realized - */ - - public int count() - { - return _iCount; - } - - /** - * Retrieve the Generation Interval - * - * @return The Generation Interval - */ - - public double generationInterval() - { - return _dblGenerationInterval; - } - - /** - * Retrieve the Sequence of Market State Realization - * - * @return The Sequence of Market State Realization - */ - - public org.drip.execution.latent.MarketState[] realizedMarketState() - { - return _aMS; - } - - /** - * Retrieve the Ornstein-Uhlenbeck Generator Scheme Parameters - * - * @return The Ornstein-Uhlenbeck Generator Scheme Parameters - */ - - public org.drip.measure.process.OrnsteinUhlenbeck scheme() - { - return _ou; - } - - /** - * Retrieve the Initial Market State - * - * @return The Initial Market State - */ - - public org.drip.execution.latent.MarketState initialMarketState() - { - return _aMS[0]; - } -} diff --git a/org/drip/execution/nonadaptive/ContinuousAlmgrenChriss.java b/org/drip/execution/nonadaptive/ContinuousAlmgrenChriss.java deleted file mode 100644 index c59bef3..0000000 --- a/org/drip/execution/nonadaptive/ContinuousAlmgrenChriss.java +++ /dev/null @@ -1,248 +0,0 @@ - -package org.drip.execution.nonadaptive; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ContinuousAlmgrenChriss contains the Continuous Version of the Discrete Trading Trajectory generated by - * the Almgren and Chriss (2000) Scheme under the Criterion of No-Drift. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Walia, N. (2006): Optimal Trading: Dynamic Stock Liquidation Strategies, Senior Thesis, Princeton - * University. - * - * @author Lakshmi Krishnamurthy - */ - -public class ContinuousAlmgrenChriss extends org.drip.execution.nonadaptive.StaticOptimalSchemeContinuous { - - /** - * Create the Standard ContinuousAlmgrenChriss Instance - * - * @param dblStartHoldings Trajectory Start Holdings - * @param dblFinishTime Trajectory Finish Time - * @param lpep The Linear Impact Expectation Parameters - * @param dblRiskAversion The Risk Aversion Parameter - * - * @return The ContinuousAlmgrenChriss Instance - */ - - public static final ContinuousAlmgrenChriss Standard ( - final double dblStartHoldings, - final double dblFinishTime, - final org.drip.execution.dynamics.LinearPermanentExpectationParameters lpep, - final double dblRiskAversion) - { - try { - return new ContinuousAlmgrenChriss (new org.drip.execution.strategy.OrderSpecification - (dblStartHoldings, dblFinishTime), lpep, new - org.drip.execution.risk.MeanVarianceObjectiveUtility (dblRiskAversion)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * ContinuousAlmgrenChriss Constructor - * - * @param os The Order Specification - * @param lpep The Linear Impact Expectation Parameters - * @param mvou The Mean Variation Objective Utility - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ContinuousAlmgrenChriss ( - final org.drip.execution.strategy.OrderSpecification os, - final org.drip.execution.dynamics.LinearPermanentExpectationParameters lpep, - final org.drip.execution.risk.MeanVarianceObjectiveUtility mvou) - throws java.lang.Exception - { - super (os, lpep, mvou); - } - - @Override public org.drip.execution.optimum.EfficientTradingTrajectory generate() - { - org.drip.execution.dynamics.LinearPermanentExpectationParameters lpep = - (org.drip.execution.dynamics.LinearPermanentExpectationParameters) priceEvolutionParameters(); - - org.drip.execution.impact.TransactionFunction tfTemporaryExpectation = - lpep.temporaryExpectation().epochImpactFunction(); - - if (!(tfTemporaryExpectation instanceof org.drip.execution.impact.TransactionFunctionLinear)) - return null; - - double dblEpochVolatility = java.lang.Double.NaN; - org.drip.execution.impact.TransactionFunctionLinear tflTemporaryExpectation = - (org.drip.execution.impact.TransactionFunctionLinear) tfTemporaryExpectation; - - try { - dblEpochVolatility = lpep.arithmeticPriceDynamicsSettings().epochVolatility(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - final double dblSigma = dblEpochVolatility; - - final double dblEta = tflTemporaryExpectation.slope(); - - final double dblKappa = java.lang.Math.sqrt (((org.drip.execution.risk.MeanVarianceObjectiveUtility) - objectiveUtility()).riskAversion() * dblSigma * dblSigma / dblEta); - - org.drip.execution.strategy.OrderSpecification os = orderSpecification(); - - final double dblT = os.maxExecutionTime(); - - final double dblX = os.size(); - - final org.drip.function.definition.R1ToR1 r1ToR1Holdings = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblTime)) - throw new java.lang.Exception - ("ContinuousAlmgrenChriss::Holdings::evaluate => Invalid Inputs"); - - return java.lang.Math.sinh (dblKappa * (dblT - dblTime)) / java.lang.Math.sinh (dblKappa * - dblT) * dblX; - } - }; - - final org.drip.function.definition.R1ToR1 r1ToR1TradeRate = new org.drip.function.definition.R1ToR1 - (null) - { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblTime)) - throw new java.lang.Exception - ("ContinuousAlmgrenChriss::TradeRate::evaluate => Invalid Inputs"); - - return dblKappa * dblX * java.lang.Math.cosh (dblKappa * (dblT - dblTime)) / - java.lang.Math.sinh (dblKappa * dblT); - } - }; - - final org.drip.function.definition.R1ToR1 r1ToR1TransactionCostExpectationRate = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - double dblTradeRate = r1ToR1TradeRate.evaluate (dblTime); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblTradeRate)) - throw new java.lang.Exception - ("ContinuousAlmgrenChriss::ExpectationRate::evaluate => Invalid Inputs"); - - return dblEta * dblTradeRate * dblTradeRate; - } - }; - - org.drip.function.definition.R1ToR1 r1ToR1TransactionCostExpectation = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - return r1ToR1TransactionCostExpectationRate.integrate (dblTime, dblT); - } - }; - - final org.drip.function.definition.R1ToR1 r1ToR1TransactionCostVarianceRate = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - double dblHoldings = r1ToR1Holdings.evaluate (dblTime); - - return dblSigma * dblSigma * dblHoldings * dblHoldings; - } - }; - - org.drip.function.definition.R1ToR1 r1ToR1TransactionCostVariance = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - return r1ToR1TransactionCostVarianceRate.integrate (dblTime, dblT); - } - }; - - try { - return new org.drip.execution.optimum.EfficientTradingTrajectoryContinuous (dblT, dblEta * - dblKappa * dblX * dblX / java.lang.Math.tanh (dblKappa * dblT), - r1ToR1TransactionCostExpectation.evaluate (0.), 1. / dblKappa, dblEta * dblX / (dblT * - dblEpochVolatility * java.lang.Math.sqrt (dblT)), r1ToR1Holdings, r1ToR1TradeRate, - r1ToR1TransactionCostExpectation, r1ToR1TransactionCostVariance); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/nonadaptive/ContinuousConstantTradingEnhanced.java b/org/drip/execution/nonadaptive/ContinuousConstantTradingEnhanced.java deleted file mode 100644 index dd24736..0000000 --- a/org/drip/execution/nonadaptive/ContinuousConstantTradingEnhanced.java +++ /dev/null @@ -1,242 +0,0 @@ - -package org.drip.execution.nonadaptive; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ContinuousConstantTradingEnhanced contains the Constant Volatility Trading Trajectory generated by the - * Almgren and Chriss (2003) Scheme under the Criterion of No-Drift AND Constant Temporary Impact - * Volatility. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * @author Lakshmi Krishnamurthy - */ - -public class ContinuousConstantTradingEnhanced extends - org.drip.execution.nonadaptive.StaticOptimalSchemeContinuous { - - /** - * Create the Standard ContinuousConstantTradingEnhanced Instance - * - * @param dblStartHoldings Trajectory Start Holdings - * @param dblFinishTime Trajectory Finish Time - * @param apep Almgren 2003 Arithmetic Price Evolution Parameters - * @param dblRiskAversion The Risk Aversion Parameter - * - * @return The ContinuousConstantTradingEnhanced Instance - */ - - public static final ContinuousConstantTradingEnhanced Standard ( - final double dblStartHoldings, - final double dblFinishTime, - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep, - final double dblRiskAversion) - { - try { - return new ContinuousConstantTradingEnhanced (new org.drip.execution.strategy.OrderSpecification - (dblStartHoldings, dblFinishTime), apep, new - org.drip.execution.risk.MeanVarianceObjectiveUtility (dblRiskAversion)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private ContinuousConstantTradingEnhanced ( - final org.drip.execution.strategy.OrderSpecification os, - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep, - final org.drip.execution.risk.MeanVarianceObjectiveUtility mvou) - throws java.lang.Exception - { - super (os, apep, mvou); - } - - @Override public org.drip.execution.optimum.EfficientTradingTrajectory generate() - { - org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep = priceEvolutionParameters(); - - double dblLambda = ((org.drip.execution.risk.MeanVarianceObjectiveUtility) - objectiveUtility()).riskAversion(); - - double dblEpochVolatility = java.lang.Double.NaN; - - try { - dblEpochVolatility = apep.arithmeticPriceDynamicsSettings().epochVolatility(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - final double dblSigma = dblEpochVolatility; - - org.drip.execution.strategy.OrderSpecification os = orderSpecification(); - - org.drip.execution.impact.TransactionFunction tfTemporaryExpectation = - apep.temporaryExpectation().epochImpactFunction(); - - if (!(tfTemporaryExpectation instanceof org.drip.execution.impact.TransactionFunctionLinear)) - return null; - - final double dblEta = ((org.drip.execution.impact.TransactionFunctionLinear) - tfTemporaryExpectation).slope(); - - org.drip.execution.impact.TransactionFunction tfTemporaryVolatility = - apep.temporaryVolatility().epochImpactFunction(); - - if (!(tfTemporaryVolatility instanceof org.drip.execution.impact.TransactionFunctionLinear)) - return null; - - double dblAlpha = ((org.drip.execution.impact.TransactionFunctionLinear) - tfTemporaryVolatility).offset(); - - final double dblExecutionTime = os.maxExecutionTime(); - - final double dblX = os.size(); - - final double dblTStar = java.lang.Math.sqrt ((dblEta + dblLambda * dblAlpha * dblAlpha) / (dblLambda - * dblSigma * dblSigma)); - - double dblE = 0.5 * dblEta * dblX * dblX / dblTStar; - - double dblV = 0.5 * dblX * dblX * dblSigma * dblSigma * dblTStar * (1. + (dblAlpha * dblAlpha / - (dblSigma * dblSigma * dblTStar * dblTStar))); - - final org.drip.function.definition.R1ToR1 r1ToR1Holdings = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblT) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblT)) - throw new java.lang.Exception - ("ContinuousConstantTradingEnhanced::generate::evaluate => Invalid Inputs"); - - return dblX * java.lang.Math.pow (java.lang.Math.E, -1. * dblT/ dblTStar); - } - }; - - org.drip.function.definition.R1ToR1 r1ToR1TradeRate = new org.drip.function.definition.R1ToR1 (null) - { - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - return r1ToR1Holdings.derivative (dblVariate, 1); - } - }; - - final org.drip.function.definition.R1ToR1 r1ToR1TransactionCostExpectationRate = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - double dblTradeRate = r1ToR1Holdings.derivative (dblTime, 1); - - return dblEta * dblEta * dblTradeRate * dblTradeRate; - } - }; - - org.drip.function.definition.R1ToR1 r1ToR1TransactionCostExpectation = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - return r1ToR1TransactionCostExpectationRate.integrate (dblTime, dblExecutionTime); - } - }; - - final org.drip.function.definition.R1ToR1 r1ToR1TransactionCostVarianceRate = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - double dblHoldings = r1ToR1Holdings.evaluate (dblTime); - - return dblSigma * dblSigma * dblHoldings * dblHoldings; - } - }; - - org.drip.function.definition.R1ToR1 r1ToR1TransactionCostVariance = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - return r1ToR1TransactionCostVarianceRate.integrate (dblTime, dblExecutionTime); - } - }; - - try { - return new org.drip.execution.optimum.EfficientTradingTrajectoryContinuous (dblExecutionTime, - dblE, dblV, dblTStar, apep.temporaryExpectation().epochImpactFunction().evaluate (dblX / - dblExecutionTime) / (apep.arithmeticPriceDynamicsSettings().epochVolatility() * - java.lang.Math.sqrt (dblExecutionTime)), r1ToR1Holdings, r1ToR1TradeRate, - r1ToR1TransactionCostExpectation, r1ToR1TransactionCostVariance); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/nonadaptive/ContinuousCoordinatedVariationDeterministic.java b/org/drip/execution/nonadaptive/ContinuousCoordinatedVariationDeterministic.java deleted file mode 100644 index 6c15d0b..0000000 --- a/org/drip/execution/nonadaptive/ContinuousCoordinatedVariationDeterministic.java +++ /dev/null @@ -1,270 +0,0 @@ - -package org.drip.execution.nonadaptive; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ContinuousCoordinatedVariationDeterministic uses the Coordinated Variation Version of the Linear - * Participation Rate Transaction Function as described in the "Trading Time" Model to construct an Optimal - * Trading Trajectory. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class ContinuousCoordinatedVariationDeterministic extends - org.drip.execution.nonadaptive.StaticOptimalSchemeContinuous { - - /** - * Create the Standard ContinuousCoordinatedVariationDeterministic Instance - * - * @param dblStartHoldings Trajectory Start Holdings - * @param dblFinishTime Trajectory Finish Time - * @param apep The Arithmetic Price Evolution Parameters - * @param dblRiskAversion The Risk Aversion Parameter - * - * @return The ContinuousCoordinatedVariationDeterministic Instance - */ - - public static final ContinuousCoordinatedVariationDeterministic Standard ( - final double dblStartHoldings, - final double dblFinishTime, - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep, - final double dblRiskAversion) - { - try { - return new ContinuousCoordinatedVariationDeterministic (new - org.drip.execution.strategy.OrderSpecification (dblStartHoldings, dblFinishTime), apep, new - org.drip.execution.risk.MeanVarianceObjectiveUtility (dblRiskAversion)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private ContinuousCoordinatedVariationDeterministic ( - final org.drip.execution.strategy.OrderSpecification os, - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep, - final org.drip.execution.risk.MeanVarianceObjectiveUtility mvou) - throws java.lang.Exception - { - super (os, apep, mvou); - } - - @Override public org.drip.execution.optimum.EfficientTradingTrajectory generate() - { - org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep = - (org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters) priceEvolutionParameters(); - - org.drip.execution.profiletime.BackgroundParticipationRate bprTemporary = - apep.temporaryExpectation(); - - if (!(bprTemporary instanceof org.drip.execution.profiletime.BackgroundParticipationRateLinear)) - return null; - - double dblInitialVolatility = java.lang.Double.NaN; - final org.drip.execution.profiletime.BackgroundParticipationRateLinear bprlTemporary = - (org.drip.execution.profiletime.BackgroundParticipationRateLinear) bprTemporary; - - org.drip.execution.impact.TransactionFunctionLinear tflTemporaryExpectation = - bprlTemporary.epochLiquidityFunction(); - - try { - dblInitialVolatility = apep.arithmeticPriceDynamicsSettings().epochVolatility(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - final double dblEpochVolatility = dblInitialVolatility; - - final double dblEpochLiquidity = tflTemporaryExpectation.slope(); - - final double dblLambda = ((org.drip.execution.risk.MeanVarianceObjectiveUtility) - objectiveUtility()).riskAversion(); - - double dblEpochUrgency = java.lang.Math.sqrt (dblLambda * dblEpochVolatility * dblEpochVolatility / - dblEpochLiquidity); - - final org.drip.function.definition.R1ToR1 r1ToR1VolatilityFunction = - apep.arithmeticPriceDynamicsSettings().volatilityFunction(); - - org.drip.execution.strategy.OrderSpecification os = orderSpecification(); - - final double dblT = os.maxExecutionTime(); - - final double dblX = os.size(); - - final org.drip.function.definition.R1ToR1 r1ToR1Holdings = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - double dblVolatility = r1ToR1VolatilityFunction.evaluate (dblTime); - - double dblKappa = java.lang.Math.sqrt (dblLambda * dblVolatility * dblVolatility / - bprlTemporary.liquidityFunction (dblTime).slope()); - - return java.lang.Math.sinh (dblKappa * (dblT - dblTime)) / java.lang.Math.sinh (dblKappa * - dblT) * dblX; - } - }; - - final org.drip.function.definition.R1ToR1 r1ToR1TradeRate = new org.drip.function.definition.R1ToR1 - (null) - { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblTime)) - throw new java.lang.Exception - ("ContinuousCoordinatedVariationDeterministic::TradeRate::evaluate => Invalid Inputs"); - - org.drip.function.definition.R1ToR1 r1ToR1VarianceFunction = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblForwardTime) - throws java.lang.Exception - { - double dblForwardVolatility = r1ToR1VolatilityFunction.evaluate (dblForwardTime); - - return dblForwardVolatility * dblForwardVolatility; - } - }; - - double dblVolatility = r1ToR1VolatilityFunction.evaluate (dblTime); - - double dblKappa = java.lang.Math.sqrt (dblLambda * dblVolatility * dblVolatility / - bprlTemporary.liquidityFunction (dblTime).slope()); - - return dblKappa * dblX / java.lang.Math.tanh (dblKappa * r1ToR1VarianceFunction.integrate - (dblTime, dblT) / dblVolatility * dblVolatility); - } - }; - - final org.drip.function.definition.R1ToR1 r1ToR1TransactionCostExpectationRate = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - double dblTradeRate = r1ToR1TradeRate.evaluate (dblTime); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblTradeRate)) - throw new java.lang.Exception - ("ContinuousCoordinatedVariationStochastic::ExpectationRate::evaluate => Invalid Inputs"); - - return bprlTemporary.liquidityFunction (dblTime).slope() * dblTradeRate * dblTradeRate; - } - }; - - org.drip.function.definition.R1ToR1 r1ToR1TransactionCostExpectation = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - return r1ToR1TransactionCostExpectationRate.integrate (dblTime, dblT); - } - }; - - final org.drip.function.definition.R1ToR1 r1ToR1TransactionCostVarianceRate = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - double dblHoldings = r1ToR1Holdings.evaluate (dblTime); - - double dblVolatility = r1ToR1VolatilityFunction.evaluate (dblTime); - - return dblVolatility * dblVolatility * dblHoldings * dblHoldings; - } - }; - - org.drip.function.definition.R1ToR1 r1ToR1TransactionCostVariance = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - return r1ToR1TransactionCostVarianceRate.integrate (dblTime, dblT); - } - }; - - try { - return new org.drip.execution.optimum.EfficientTradingTrajectoryContinuous (dblT, - dblEpochLiquidity * dblEpochUrgency * dblX * dblX / java.lang.Math.tanh (dblEpochUrgency * - dblT), r1ToR1TransactionCostExpectation.evaluate (0.), 1. / dblEpochUrgency, - dblEpochLiquidity * dblX / (dblT * dblEpochVolatility * java.lang.Math.sqrt (dblT)), - r1ToR1Holdings, r1ToR1TradeRate, r1ToR1TransactionCostExpectation, - r1ToR1TransactionCostVariance); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/nonadaptive/ContinuousCoordinatedVariationStochastic.java b/org/drip/execution/nonadaptive/ContinuousCoordinatedVariationStochastic.java deleted file mode 100644 index c6d2dd9..0000000 --- a/org/drip/execution/nonadaptive/ContinuousCoordinatedVariationStochastic.java +++ /dev/null @@ -1,249 +0,0 @@ - -package org.drip.execution.nonadaptive; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ContinuousCoordinatedVariationStochastic uses the Coordinated Variation Version of the Linear - * Participation Rate Transaction Function as described in the "Trading Time" Model to construct an Optimal - * Trading Trajectory in the T To Infinite Limit. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class ContinuousCoordinatedVariationStochastic extends - org.drip.execution.nonadaptive.StaticOptimalSchemeContinuous { - - /** - * Create the Standard ContinuousCoordinatedVariationStochastic Instance - * - * @param dblStartHoldings Trajectory Start Holdings - * @param dblFinishTime Trajectory Finish Time - * @param apep The Arithmetic Price Evolution Parameters - * @param dblRiskAversion The Risk Aversion Parameter - * - * @return The ContinuousCoordinatedVariationStochastic Instance - */ - - public static final ContinuousCoordinatedVariationStochastic Standard ( - final double dblStartHoldings, - final double dblFinishTime, - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep, - final double dblRiskAversion) - { - try { - return new ContinuousCoordinatedVariationStochastic (new - org.drip.execution.strategy.OrderSpecification (dblStartHoldings, dblFinishTime), apep, new - org.drip.execution.risk.MeanVarianceObjectiveUtility (dblRiskAversion)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private ContinuousCoordinatedVariationStochastic ( - final org.drip.execution.strategy.OrderSpecification os, - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep, - final org.drip.execution.risk.MeanVarianceObjectiveUtility mvou) - throws java.lang.Exception - { - super (os, apep, mvou); - } - - @Override public org.drip.execution.optimum.EfficientTradingTrajectory generate() - { - org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep = - (org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters) priceEvolutionParameters(); - - org.drip.execution.profiletime.BackgroundParticipationRate bprTemporary = - apep.temporaryExpectation(); - - if (!(bprTemporary instanceof org.drip.execution.profiletime.BackgroundParticipationRateLinear)) - return null; - - double dblInitialVolatility = java.lang.Double.NaN; - final org.drip.execution.profiletime.BackgroundParticipationRateLinear bprlTemporary = - (org.drip.execution.profiletime.BackgroundParticipationRateLinear) bprTemporary; - - org.drip.execution.impact.TransactionFunctionLinear tflTemporaryExpectation = - bprlTemporary.epochLiquidityFunction(); - - try { - dblInitialVolatility = apep.arithmeticPriceDynamicsSettings().epochVolatility(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - final double dblEpochVolatility = dblInitialVolatility; - - final double dblEpochLiquidity = tflTemporaryExpectation.slope(); - - final double dblLambda = ((org.drip.execution.risk.MeanVarianceObjectiveUtility) - objectiveUtility()).riskAversion(); - - double dblEpochUrgency = java.lang.Math.sqrt (dblLambda * dblEpochVolatility * dblEpochVolatility / - dblEpochLiquidity); - - final org.drip.function.definition.R1ToR1 r1ToR1VolatilityFunction = - apep.arithmeticPriceDynamicsSettings().volatilityFunction(); - - org.drip.execution.strategy.OrderSpecification os = orderSpecification(); - - final double dblT = os.maxExecutionTime(); - - final double dblX = os.size(); - - final org.drip.function.definition.R1ToR1 r1ToR1Holdings = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - double dblVolatility = r1ToR1VolatilityFunction.evaluate (dblTime); - - double dblKappa = java.lang.Math.sqrt (dblLambda * dblVolatility * dblVolatility / - bprlTemporary.liquidityFunction (dblTime).slope()); - - return java.lang.Math.sinh (dblKappa * (dblT - dblTime)) / java.lang.Math.sinh (dblKappa * - dblT) * dblX; - } - }; - - org.drip.function.definition.R1ToR1 r1ToR1TradeRate = new org.drip.function.definition.R1ToR1 (null) - { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - double dblVolatility = r1ToR1VolatilityFunction.evaluate (dblTime); - - return java.lang.Math.sqrt (dblLambda * dblVolatility * dblVolatility / - bprlTemporary.liquidityFunction (dblTime).slope()) * r1ToR1Holdings.evaluate (dblTime); - } - }; - - final org.drip.function.definition.R1ToR1 r1ToR1TransactionCostExpectationRate = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - double dblHoldings = r1ToR1Holdings.evaluate (dblTime); - - double dblVolatility = r1ToR1VolatilityFunction.evaluate (dblTime); - - return java.lang.Math.sqrt (dblLambda * dblVolatility * dblVolatility * - bprlTemporary.liquidityFunction (dblTime).slope()) * dblHoldings * dblHoldings; - } - }; - - org.drip.function.definition.R1ToR1 r1ToR1TransactionCostExpectation = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - return r1ToR1TransactionCostExpectationRate.integrate (dblTime, dblT); - } - }; - - final org.drip.function.definition.R1ToR1 r1ToR1TransactionCostVarianceRate = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - double dblHoldings = r1ToR1Holdings.evaluate (dblTime); - - double dblVolatility = r1ToR1VolatilityFunction.evaluate (dblTime); - - return dblVolatility * dblVolatility * dblHoldings * dblHoldings; - } - }; - - org.drip.function.definition.R1ToR1 r1ToR1TransactionCostVariance = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - return r1ToR1TransactionCostVarianceRate.integrate (dblTime, dblT); - } - }; - - try { - return new org.drip.execution.optimum.EfficientTradingTrajectoryContinuous (dblT, - dblEpochLiquidity * dblEpochUrgency * dblX * dblX / java.lang.Math.tanh (dblEpochUrgency * - dblT), r1ToR1TransactionCostExpectation.evaluate (0.), 1. / dblEpochUrgency, - dblEpochLiquidity * dblX / (dblT * dblEpochVolatility * java.lang.Math.sqrt (dblT)), - r1ToR1Holdings, r1ToR1TradeRate, r1ToR1TransactionCostExpectation, - r1ToR1TransactionCostVariance); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/nonadaptive/ContinuousHighUrgencyAsymptote.java b/org/drip/execution/nonadaptive/ContinuousHighUrgencyAsymptote.java deleted file mode 100644 index c07c34b..0000000 --- a/org/drip/execution/nonadaptive/ContinuousHighUrgencyAsymptote.java +++ /dev/null @@ -1,225 +0,0 @@ - -package org.drip.execution.nonadaptive; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ContinuousHighUrgencyAsymptote contains the High Urgency Asymptote of the Static Continuous Trading - * Trajectory generated by the Almgren and Chriss (2000) Scheme under the Criterion of No-Drift. The - * References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Walia, N. (2006): Optimal Trading: Dynamic Stock Liquidation Strategies, Senior Thesis, Princeton - * University. - * - * @author Lakshmi Krishnamurthy - */ - -public class ContinuousHighUrgencyAsymptote extends - org.drip.execution.nonadaptive.StaticOptimalSchemeContinuous { - - /** - * Create the Standard ContinuousHighUrgencyAsymptote Instance - * - * @param dblStartHoldings Trajectory Start Holdings - * @param dblFinishTime Trajectory Finish Time - * @param lpep The Linear Impact Expectation Parameters - * @param dblRiskAversion The Risk Aversion Parameter - * - * @return The ContinuousHighUrgencyAsymptote Instance - */ - - public static final ContinuousHighUrgencyAsymptote Standard ( - final double dblStartHoldings, - final double dblFinishTime, - final org.drip.execution.dynamics.LinearPermanentExpectationParameters lpep, - final double dblRiskAversion) - { - try { - return new ContinuousHighUrgencyAsymptote (new org.drip.execution.strategy.OrderSpecification - (dblStartHoldings, dblFinishTime), lpep, new - org.drip.execution.risk.MeanVarianceObjectiveUtility (dblRiskAversion)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private ContinuousHighUrgencyAsymptote ( - final org.drip.execution.strategy.OrderSpecification os, - final org.drip.execution.dynamics.LinearPermanentExpectationParameters lpep, - final org.drip.execution.risk.MeanVarianceObjectiveUtility mvou) - throws java.lang.Exception - { - super (os, lpep, mvou); - } - - @Override public org.drip.execution.optimum.EfficientTradingTrajectory generate() - { - org.drip.execution.dynamics.LinearPermanentExpectationParameters lpep = - (org.drip.execution.dynamics.LinearPermanentExpectationParameters) priceEvolutionParameters(); - - org.drip.execution.impact.TransactionFunction tfTemporaryExpectation = - lpep.temporaryExpectation().epochImpactFunction(); - - if (!(tfTemporaryExpectation instanceof org.drip.execution.impact.TransactionFunctionLinear)) - return null; - - double dblEpochVolatility = java.lang.Double.NaN; - org.drip.execution.impact.TransactionFunctionLinear tflTemporaryExpectation = - (org.drip.execution.impact.TransactionFunctionLinear) tfTemporaryExpectation; - - try { - dblEpochVolatility = lpep.arithmeticPriceDynamicsSettings().epochVolatility(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - final double dblSigma = dblEpochVolatility; - - final double dblEta = tflTemporaryExpectation.slope(); - - final double dblLambda = ((org.drip.execution.risk.MeanVarianceObjectiveUtility) - objectiveUtility()).riskAversion(); - - final double dblKappa = java.lang.Math.sqrt (dblLambda * dblSigma * dblSigma / dblEta); - - org.drip.execution.strategy.OrderSpecification os = orderSpecification(); - - final double dblT = os.maxExecutionTime(); - - final double dblX = os.size(); - - final org.drip.function.definition.R1ToR1 r1ToR1Holdings = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblTime)) - throw new java.lang.Exception - ("ContinuousHighUrgencyAsymptote::Holdings::evaluate => Invalid Inputs"); - - return dblX * java.lang.Math.exp (-1. * dblKappa * dblTime); - } - }; - - org.drip.function.definition.R1ToR1 r1ToR1TradeRate = new org.drip.function.definition.R1ToR1 (null) - { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblTime)) - throw new java.lang.Exception - ("ContinuousHighUrgencyAsymptote::TradeRate::evaluate => Invalid Inputs"); - - return dblKappa * r1ToR1Holdings.evaluate (dblTime); - } - }; - - org.drip.function.definition.R1ToR1 r1ToR1TransactionCostExpectation = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - double dblHoldings = r1ToR1Holdings.evaluate (dblTime); - - return dblEta * dblKappa * dblHoldings * dblHoldings; - } - }; - - final org.drip.function.definition.R1ToR1 r1ToR1TransactionCostVarianceRate = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - double dblHoldings = r1ToR1Holdings.evaluate (dblTime); - - return dblSigma * dblSigma * dblHoldings * dblHoldings; - } - }; - - org.drip.function.definition.R1ToR1 r1ToR1TransactionCostVariance = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - return r1ToR1TransactionCostVarianceRate.integrate (dblTime, dblT); - } - }; - - try { - return new org.drip.execution.optimum.EfficientTradingTrajectoryContinuous (dblT, dblEta * - dblKappa * dblX * dblX / java.lang.Math.tanh (dblKappa * dblT), - r1ToR1TransactionCostExpectation.evaluate (0.), 1. / dblKappa, dblEta * dblX / (dblT * - dblEpochVolatility * java.lang.Math.sqrt (dblT)), r1ToR1Holdings, r1ToR1TradeRate, - r1ToR1TransactionCostExpectation, r1ToR1TransactionCostVariance); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/nonadaptive/ContinuousLowUrgencyAsymptote.java b/org/drip/execution/nonadaptive/ContinuousLowUrgencyAsymptote.java deleted file mode 100644 index 9d6e556..0000000 --- a/org/drip/execution/nonadaptive/ContinuousLowUrgencyAsymptote.java +++ /dev/null @@ -1,235 +0,0 @@ - -package org.drip.execution.nonadaptive; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ContinuousLowUrgencyAsymptote contains the Low Urgency Asymptote of the Static Continuous Trading - * Trajectory generated by the Almgren and Chriss (2000) Scheme under the Criterion of No-Drift. The - * References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Walia, N. (2006): Optimal Trading: Dynamic Stock Liquidation Strategies, Senior Thesis, Princeton - * University. - * - * @author Lakshmi Krishnamurthy - */ - -public class ContinuousLowUrgencyAsymptote extends - org.drip.execution.nonadaptive.StaticOptimalSchemeContinuous { - - /** - * Create the Standard ContinuousLowUrgencyAsymptote Instance - * - * @param dblStartHoldings Trajectory Start Holdings - * @param dblFinishTime Trajectory Finish Time - * @param lpep The Linear Impact Expectation Parameters - * @param dblRiskAversion The Risk Aversion Parameter - * - * @return The ContinuousLowUrgencyAsymptote Instance - */ - - public static final ContinuousLowUrgencyAsymptote Standard ( - final double dblStartHoldings, - final double dblFinishTime, - final org.drip.execution.dynamics.LinearPermanentExpectationParameters lpep, - final double dblRiskAversion) - { - try { - return new ContinuousLowUrgencyAsymptote (new org.drip.execution.strategy.OrderSpecification - (dblStartHoldings, dblFinishTime), lpep, new - org.drip.execution.risk.MeanVarianceObjectiveUtility (dblRiskAversion)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private ContinuousLowUrgencyAsymptote ( - final org.drip.execution.strategy.OrderSpecification os, - final org.drip.execution.dynamics.LinearPermanentExpectationParameters lpep, - final org.drip.execution.risk.MeanVarianceObjectiveUtility mvou) - throws java.lang.Exception - { - super (os, lpep, mvou); - } - - @Override public org.drip.execution.optimum.EfficientTradingTrajectory generate() - { - org.drip.execution.dynamics.LinearPermanentExpectationParameters lpep = - (org.drip.execution.dynamics.LinearPermanentExpectationParameters) priceEvolutionParameters(); - - org.drip.execution.impact.TransactionFunction tfTemporaryExpectation = - lpep.temporaryExpectation().epochImpactFunction(); - - if (!(tfTemporaryExpectation instanceof org.drip.execution.impact.TransactionFunctionLinear)) - return null; - - double dblEpochVolatility = java.lang.Double.NaN; - org.drip.execution.impact.TransactionFunctionLinear tflTemporaryExpectation = - (org.drip.execution.impact.TransactionFunctionLinear) tfTemporaryExpectation; - - try { - dblEpochVolatility = lpep.arithmeticPriceDynamicsSettings().epochVolatility(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - final double dblSigma = dblEpochVolatility; - - final double dblEta = tflTemporaryExpectation.slope(); - - final double dblLambda = ((org.drip.execution.risk.MeanVarianceObjectiveUtility) - objectiveUtility()).riskAversion(); - - final double dblKappa = java.lang.Math.sqrt (dblLambda * dblSigma * dblSigma / dblEta); - - org.drip.execution.strategy.OrderSpecification os = orderSpecification(); - - final double dblT = os.maxExecutionTime(); - - final double dblX = os.size(); - - final org.drip.function.definition.R1ToR1 r1ToR1Holdings = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblTime)) - throw new java.lang.Exception - ("ContinuousLowUrgencyAsymptote::Holdings::evaluate => Invalid Inputs"); - - return java.lang.Math.sinh (dblKappa * (dblT - dblTime)) / java.lang.Math.sinh (dblKappa * - dblT) * dblX; - } - }; - - org.drip.function.definition.R1ToR1 r1ToR1TradeRate = new org.drip.function.definition.R1ToR1 (null) - { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblTime)) - throw new java.lang.Exception - ("ContinuousLowUrgencyAsymptote::TradeRate::evaluate => Invalid Inputs"); - - return dblT == dblTime ? 0. : r1ToR1Holdings.evaluate (dblTime) / (dblT - dblTime); - } - }; - - org.drip.function.definition.R1ToR1 r1ToR1TransactionCostExpectation = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblTime)) - throw new java.lang.Exception - ("ContinuousLowUrgencyAsymptote::TransactionCostExpectation::evaluate => Invalid Inputs"); - - double dblRemainingTime = dblT - dblTime; - - if (0. >= dblRemainingTime) return 0.; - - double dblHoldings = r1ToR1Holdings.evaluate (dblTime); - - return dblEta * dblHoldings * dblHoldings / dblRemainingTime + (dblLambda * dblSigma * - dblSigma * dblHoldings * dblHoldings * dblRemainingTime / 3.); - } - }; - - final org.drip.function.definition.R1ToR1 r1ToR1TransactionCostVarianceRate = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - double dblHoldings = r1ToR1Holdings.evaluate (dblTime); - - return dblSigma * dblSigma * dblHoldings * dblHoldings; - } - }; - - org.drip.function.definition.R1ToR1 r1ToR1TransactionCostVariance = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - return r1ToR1TransactionCostVarianceRate.integrate (dblTime, dblT); - } - }; - - try { - return new org.drip.execution.optimum.EfficientTradingTrajectoryContinuous (dblT, dblEta * - dblKappa * dblX * dblX / java.lang.Math.tanh (dblKappa * dblT), - r1ToR1TransactionCostExpectation.evaluate (0.), 1. / dblKappa, dblEta * dblX / (dblT * - dblEpochVolatility * java.lang.Math.sqrt (dblT)), r1ToR1Holdings, r1ToR1TradeRate, - r1ToR1TransactionCostExpectation, r1ToR1TransactionCostVariance); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/nonadaptive/ContinuousPowerImpact.java b/org/drip/execution/nonadaptive/ContinuousPowerImpact.java deleted file mode 100644 index 547af09..0000000 --- a/org/drip/execution/nonadaptive/ContinuousPowerImpact.java +++ /dev/null @@ -1,238 +0,0 @@ - -package org.drip.execution.nonadaptive; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ContinuousPowerImpact contains the Temporary Impact Power Law Trading Trajectory generated by the Almgren - * and Chriss (2003) Scheme under the Criterion of No-Drift. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * @author Lakshmi Krishnamurthy - */ - -public class ContinuousPowerImpact extends org.drip.execution.nonadaptive.StaticOptimalSchemeContinuous { - - /** - * Create the Standard ContinuousPowerImpact Instance - * - * @param dblStartHoldings Trajectory Start Holdings - * @param dblFinishTime Trajectory Finish Time - * @param lpep Almgren 2003 Linear Permanent Expectation Market Impact Parameters - * @param dblRiskAversion The Risk Aversion Parameter - * - * @return The ContinuousPowerImpact Instance - */ - - public static final ContinuousPowerImpact Standard ( - final double dblStartHoldings, - final double dblFinishTime, - final org.drip.execution.dynamics.LinearPermanentExpectationParameters lpep, - final double dblRiskAversion) - { - try { - return new ContinuousPowerImpact (new org.drip.execution.strategy.OrderSpecification - (dblStartHoldings, dblFinishTime), lpep, new - org.drip.execution.risk.MeanVarianceObjectiveUtility (dblRiskAversion)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private ContinuousPowerImpact ( - final org.drip.execution.strategy.OrderSpecification os, - final org.drip.execution.dynamics.LinearPermanentExpectationParameters lpep, - final org.drip.execution.risk.MeanVarianceObjectiveUtility mvou) - throws java.lang.Exception - { - super (os, lpep, mvou); - } - - @Override public org.drip.execution.optimum.EfficientTradingTrajectory generate() - { - org.drip.execution.dynamics.LinearPermanentExpectationParameters lpep = - (org.drip.execution.dynamics.LinearPermanentExpectationParameters) priceEvolutionParameters(); - - final org.drip.execution.impact.TransactionFunction tfTemporaryExpectation = - lpep.temporaryExpectation().epochImpactFunction(); - - if (!(tfTemporaryExpectation instanceof org.drip.execution.impact.TransactionFunctionPower)) - return null; - - double dblEpochVolatility = java.lang.Double.NaN; - final org.drip.execution.impact.TransactionFunctionPower tfpTemporaryExpectation = - (org.drip.execution.impact.TransactionFunctionPower) tfTemporaryExpectation; - - double dblLambda = ((org.drip.execution.risk.MeanVarianceObjectiveUtility) - objectiveUtility()).riskAversion(); - - try { - dblEpochVolatility = lpep.arithmeticPriceDynamicsSettings().epochVolatility(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - final double dblSigma = dblEpochVolatility; - - org.drip.execution.strategy.OrderSpecification os = orderSpecification(); - - double dblGamma = ((org.drip.execution.impact.TransactionFunctionLinear) - lpep.linearPermanentExpectation().epochImpactFunction()).slope(); - - final double dblK = tfpTemporaryExpectation.exponent(); - - final double dblExecutionTime = os.maxExecutionTime(); - - double dblEta = tfpTemporaryExpectation.constant(); - - final double dblX = os.size(); - - final double dblTStar = java.lang.Math.pow (dblK * dblEta * java.lang.Math.pow (dblX, dblK - 1.) / - (dblLambda * dblSigma * dblSigma), 1. / (dblK + 1.)); - - double dblTMax = dblK > 1. ? (dblK + 1.) / (dblK - 1.) * dblTStar : java.lang.Double.NaN; - - double dblE = 0.5 * dblGamma * dblX * dblX + (dblK + 1.) / (3. * dblK + 1.) * dblEta * - java.lang.Math.pow (dblX / dblTStar, dblK + 1.) * dblTStar; - - double dblV = (dblK + 1.) / (3. * dblK + 1.) * dblSigma * dblSigma * dblTStar * dblX * dblX; - - double dblHyperboloidBoundaryValue = java.lang.Math.pow ((dblK + 1.) / (3. * dblK + 1.), dblK + 1.) * - dblEta * java.lang.Math.pow (dblSigma, 2. * dblK) * java.lang.Math.pow (dblX, 3. * dblK + 1.); - - final org.drip.function.definition.R1ToR1 r1ToR1Holdings = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblT) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblT)) - throw new java.lang.Exception - ("ContinuousPowerImpact::generate::evaluate => Invalid Inputs"); - - if (1. > dblK) - return dblX * java.lang.Math.pow (1. + ((1. - dblK) * dblT) / ((1. + dblK) * dblTStar), - -1. * (1. + dblK) / (1. - dblK)); - - if (1. == dblK) return dblX * java.lang.Math.pow (java.lang.Math.E, -1. * dblT/ dblTStar); - - double dblHoldings = dblX * java.lang.Math.pow (1. - ((dblK - 1.) * dblT) / ((dblK + 1.) * - dblTStar), (dblK + 1.) / (dblK + 1.)); - - return 0. > dblX * dblHoldings ? 0. : dblHoldings; - } - }; - - final org.drip.function.definition.R1ToR1 r1ToR1TradeRateSquared = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - double dblTradeRate = r1ToR1Holdings.derivative (dblTime, 1); - - double dblTemporaryImpactCoefficient = tfpTemporaryExpectation.evaluate (dblTradeRate); - - return dblTemporaryImpactCoefficient * dblTemporaryImpactCoefficient * dblTradeRate * - dblTradeRate; - } - }; - - org.drip.function.definition.R1ToR1 r1ToR1TransactionCostExpectation = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - return r1ToR1TradeRateSquared.integrate (dblTime, dblExecutionTime); - } - }; - - final org.drip.function.definition.R1ToR1 r1ToR1HoldingsSquared = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - double dblHoldings = r1ToR1Holdings.evaluate (dblTime); - - return dblHoldings * dblHoldings; - } - }; - - org.drip.function.definition.R1ToR1 r1ToR1TransactionCostVariance = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - return dblSigma * dblSigma * r1ToR1HoldingsSquared.integrate (dblTime, dblExecutionTime); - } - }; - - return org.drip.execution.optimum.PowerImpactContinuous.Standard (dblExecutionTime, dblE, - dblV, dblTStar, dblTMax, dblHyperboloidBoundaryValue, dblEta * (dblX / dblExecutionTime) / - (dblEpochVolatility * java.lang.Math.sqrt (dblExecutionTime)), r1ToR1Holdings, - r1ToR1TransactionCostExpectation, r1ToR1TransactionCostVariance); - } -} diff --git a/org/drip/execution/nonadaptive/DiscreteAlmgrenChriss.java b/org/drip/execution/nonadaptive/DiscreteAlmgrenChriss.java deleted file mode 100644 index 13322aa..0000000 --- a/org/drip/execution/nonadaptive/DiscreteAlmgrenChriss.java +++ /dev/null @@ -1,213 +0,0 @@ - -package org.drip.execution.nonadaptive; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DiscreteAlmgrenChriss generates the Trade/Holdings List of Optimal Execution Schedule for the Equally - * Spaced Trading Intervals based on the No-Drift Linear Impact Evolution Walk Parameters specified. The - * References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class DiscreteAlmgrenChriss extends org.drip.execution.nonadaptive.StaticOptimalSchemeDiscrete { - - private double KappaTau ( - final double dblKappaTildaSquared, - final double dblTau) - { - double dblKappaTildaSquaredTauSquared = dblKappaTildaSquared * dblTau * dblTau; - - return java.lang.Math.log (0.5 * (2. + dblKappaTildaSquaredTauSquared + dblTau * java.lang.Math.sqrt - (dblKappaTildaSquared * (dblKappaTildaSquaredTauSquared + 4.)))); - } - - /** - * Create the Standard DiscreteAlmgrenChriss Instance - * - * @param dblStartHoldings Trajectory Start Holdings - * @param dblFinishTime Trajectory Finish Time - * @param iNumInterval The Number of Fixed Intervals - * @param lpep Linear Impact Price Walk Parameters - * @param dblRiskAversion The Risk Aversion Parameter - * - * @return The DiscreteAlmgrenChriss Instance - */ - - public static final DiscreteAlmgrenChriss Standard ( - final double dblStartHoldings, - final double dblFinishTime, - final int iNumInterval, - final org.drip.execution.dynamics.LinearPermanentExpectationParameters lpep, - final double dblRiskAversion) - { - try { - return new DiscreteAlmgrenChriss - (org.drip.execution.strategy.DiscreteTradingTrajectoryControl.FixedInterval (new - org.drip.execution.strategy.OrderSpecification (dblStartHoldings, dblFinishTime), - iNumInterval), lpep, new org.drip.execution.risk.MeanVarianceObjectiveUtility - (dblRiskAversion)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private DiscreteAlmgrenChriss ( - final org.drip.execution.strategy.DiscreteTradingTrajectoryControl dttc, - final org.drip.execution.dynamics.LinearPermanentExpectationParameters lpep, - final org.drip.execution.risk.MeanVarianceObjectiveUtility mvou) - throws java.lang.Exception - { - super (dttc, lpep, mvou); - } - - @Override public org.drip.execution.optimum.EfficientTradingTrajectoryDiscrete generate() - { - org.drip.execution.strategy.DiscreteTradingTrajectoryControl dttc = control(); - - double[] adblTNode = dttc.executionTimeNodes(); - - org.drip.execution.dynamics.LinearPermanentExpectationParameters lpep = - (org.drip.execution.dynamics.LinearPermanentExpectationParameters) priceEvolutionParameters(); - - org.drip.execution.impact.TransactionFunction tfTemporaryExpectation = - lpep.temporaryExpectation().epochImpactFunction(); - - if (!(tfTemporaryExpectation instanceof org.drip.execution.impact.TransactionFunctionLinear)) - return null; - - double dblEpochVolatility = java.lang.Double.NaN; - org.drip.execution.impact.TransactionFunctionLinear tflTemporaryExpectation = - (org.drip.execution.impact.TransactionFunctionLinear) tfTemporaryExpectation; - - try { - dblEpochVolatility = lpep.arithmeticPriceDynamicsSettings().epochVolatility(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - double dblGamma = lpep.linearPermanentExpectation().epochLiquidityFunction().slope(); - - double dblEta = tflTemporaryExpectation.slope(); - - double dblX = dttc.startHoldings(); - - int iNumNode = adblTNode.length; - double dblXSquared = dblX * dblX; - final double dblSigma = dblEpochVolatility; - double dblTau = adblTNode[1] - adblTNode[0]; - double dblSigmaSquared = dblSigma * dblSigma; - double[] adblHoldings = new double[iNumNode]; - double[] adblTradeList = new double[iNumNode - 1]; - double dblT = adblTNode[iNumNode - 1] - adblTNode[0]; - double dblEtaTilda = dblEta - 0.5 * dblGamma * dblTau; - - double dblKappaTildaSquared = ((org.drip.execution.risk.MeanVarianceObjectiveUtility) - objectiveUtility()).riskAversion() * dblSigmaSquared / dblEtaTilda; - - double dblKappaTau = KappaTau (dblKappaTildaSquared, dblTau); - - double dblHalfKappaTau = 0.5 * dblKappaTau; - double dblKappa = dblKappaTau / dblTau; - double dblKappaT = dblKappa * dblT; - - double dblSinhKappaT = java.lang.Math.sinh (dblKappaT); - - double dblSinhKappaTau = java.lang.Math.sinh (dblKappaTau); - - double dblSinhHalfKappaTau = java.lang.Math.sinh (dblHalfKappaTau); - - double dblTSinhKappaTau = dblT * dblSinhKappaTau; - double dblInverseSinhKappaT = 1. / dblSinhKappaT; - double dblTrajectoryScaler = dblInverseSinhKappaT * dblX; - double dblTradeListScaler = 2. * dblSinhHalfKappaTau * dblTrajectoryScaler; - double dblReciprocalSinhKappaTSquared = dblInverseSinhKappaT * dblInverseSinhKappaT; - - for (int i = 0; i < iNumNode; ++i) { - adblHoldings[i] = dblTrajectoryScaler * java.lang.Math.sinh (dblKappa * (dblT - adblTNode[i])); - - if (i < iNumNode - 1) - adblTradeList[i] = -1. * dblTradeListScaler * java.lang.Math.cosh (dblKappa * (dblT - dblTau - * (0.5 + i))); - } - - try { - return new org.drip.execution.optimum.AlmgrenChrissDiscrete (adblTNode, adblHoldings, - adblTradeList, java.lang.Math.sqrt (dblKappaTildaSquared), dblKappa, 0.5 * dblGamma * - dblXSquared + tflTemporaryExpectation.offset() * dblX + dblEtaTilda * dblXSquared * - dblReciprocalSinhKappaTSquared * java.lang.Math.tanh (dblHalfKappaTau) * (dblTau * - java.lang.Math.sinh (2. * dblKappaT) + 2. * dblTSinhKappaTau) / (2. * dblTau * - dblTau), 0.5 * dblSigmaSquared * dblXSquared * dblReciprocalSinhKappaTSquared - * (dblTau * dblSinhKappaT * java.lang.Math.cosh (dblKappa * (dblT - - dblTau)) - dblTSinhKappaTau) / dblSinhKappaTau, dblEpochVolatility * - dblX / (dblT * dblEpochVolatility * java.lang.Math.sqrt (dblT))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/nonadaptive/DiscreteAlmgrenChrissDrift.java b/org/drip/execution/nonadaptive/DiscreteAlmgrenChrissDrift.java deleted file mode 100644 index 47e2c10..0000000 --- a/org/drip/execution/nonadaptive/DiscreteAlmgrenChrissDrift.java +++ /dev/null @@ -1,233 +0,0 @@ - -package org.drip.execution.nonadaptive; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DiscreteAlmgrenChrissDrift generates the Trade/Holdings List of Optimal Execution Schedule for the Equally - * Spaced Trading Intervals based on the Linear Impact Evolution Walk Parameters with Drift specified. The - * References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class DiscreteAlmgrenChrissDrift extends org.drip.execution.nonadaptive.StaticOptimalSchemeDiscrete { - - private double KappaTau ( - final double dblKappaTildaSquared, - final double dblTau) - { - double dblKappaTildaSquaredTauSquared = dblKappaTildaSquared * dblTau * dblTau; - - return java.lang.Math.log (0.5 * (2. + dblKappaTildaSquaredTauSquared + dblTau * java.lang.Math.sqrt - (dblKappaTildaSquared * (dblKappaTildaSquaredTauSquared + 4.)))); - } - - /** - * Create the Standard DiscreteAlmgrenChrissDrift Instance - * - * @param dblStartHoldings Trajectory Start Holdings - * @param dblFinishTime Trajectory Finish Time - * @param iNumInterval The Number of Fixed Intervals - * @param lpep Linear Impact Price Walk Parameters - * @param dblRiskAversion The Risk Aversion Parameter - * - * @return The DiscreteAlmgrenChrissDrift Instance - */ - - public static final DiscreteAlmgrenChrissDrift Standard ( - final double dblStartHoldings, - final double dblFinishTime, - final int iNumInterval, - final org.drip.execution.dynamics.LinearPermanentExpectationParameters lpep, - final double dblRiskAversion) - { - try { - return new DiscreteAlmgrenChrissDrift - (org.drip.execution.strategy.DiscreteTradingTrajectoryControl.FixedInterval (new - org.drip.execution.strategy.OrderSpecification (dblStartHoldings, dblFinishTime), - iNumInterval), lpep, new org.drip.execution.risk.MeanVarianceObjectiveUtility - (dblRiskAversion)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private DiscreteAlmgrenChrissDrift ( - final org.drip.execution.strategy.DiscreteTradingTrajectoryControl dttc, - final org.drip.execution.dynamics.LinearPermanentExpectationParameters lpep, - final org.drip.execution.risk.MeanVarianceObjectiveUtility mvou) - throws java.lang.Exception - { - super (dttc, lpep, mvou); - } - - @Override public org.drip.execution.optimum.EfficientTradingTrajectoryDiscrete generate() - { - org.drip.execution.strategy.DiscreteTradingTrajectoryControl dttc = control(); - - double[] adblTNode = dttc.executionTimeNodes(); - - org.drip.execution.dynamics.LinearPermanentExpectationParameters lpep = - (org.drip.execution.dynamics.LinearPermanentExpectationParameters) priceEvolutionParameters(); - - org.drip.execution.impact.TransactionFunction tfTemporaryExpectation = - lpep.temporaryExpectation().epochImpactFunction(); - - if (!(tfTemporaryExpectation instanceof org.drip.execution.impact.TransactionFunctionLinear)) - return null; - - double dblEpochVolatility = java.lang.Double.NaN; - org.drip.execution.impact.TransactionFunctionLinear tflTemporaryExpectation = - (org.drip.execution.impact.TransactionFunctionLinear) tfTemporaryExpectation; - - double dblX = dttc.startHoldings(); - - org.drip.execution.parameters.ArithmeticPriceDynamicsSettings apds = - lpep.arithmeticPriceDynamicsSettings(); - - double dblAlpha = apds.drift(); - - double dblEta = tflTemporaryExpectation.slope(); - - try { - dblEpochVolatility = apds.epochVolatility(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - double dblGamma = lpep.linearPermanentExpectation().epochLiquidityFunction().slope(); - - int iNumNode = adblTNode.length; - final double dblSigma = dblEpochVolatility; - double dblTau = adblTNode[1] - adblTNode[0]; - double dblSigmaSquared = dblSigma * dblSigma; - double[] adblHoldings = new double[iNumNode]; - double[] adblTradeList = new double[iNumNode - 1]; - double dblT = adblTNode[iNumNode - 1] - adblTNode[0]; - double dblEtaTilda = dblEta - 0.5 * dblGamma * dblTau; - double[] adblHoldingsDriftAdjustment = new double[iNumNode]; - double[] adblTradeListDriftAdjustment = new double[iNumNode - 1]; - - double dblLambdaSigmaSquared = ((org.drip.execution.risk.MeanVarianceObjectiveUtility) - objectiveUtility()).riskAversion() * dblSigmaSquared; - - double dblResidualHolding = 0.5 * dblAlpha / dblLambdaSigmaSquared; - double dblKappaTildaSquared = dblLambdaSigmaSquared / dblEtaTilda; - - double dblKappaTau = KappaTau (dblKappaTildaSquared, dblTau); - - double dblHalfKappaTau = 0.5 * dblKappaTau; - double dblKappa = dblKappaTau / dblTau; - double dblKappaT = dblKappa * dblT; - - double dblSinhKappaT = java.lang.Math.sinh (dblKappaT); - - double dblSinhHalfKappaTau = java.lang.Math.sinh (dblHalfKappaTau); - - double dblInverseSinhKappaT = 1. / dblSinhKappaT; - double dblTrajectoryScaler = dblInverseSinhKappaT * dblX; - double dblTradeListScaler = 2. * dblSinhHalfKappaTau * dblTrajectoryScaler; - double dblTrajectoryAdjustmentScaler = dblInverseSinhKappaT * dblResidualHolding; - double dblTradeListAdjustmentScaler = 2. * dblSinhHalfKappaTau * dblTrajectoryAdjustmentScaler; - - for (int i = 0; i < iNumNode; ++i) { - adblHoldingsDriftAdjustment[i] = dblResidualHolding * (1. - dblInverseSinhKappaT * - (java.lang.Math.sinh (dblKappa * (dblT - adblTNode[i])) + java.lang.Math.sinh (dblKappa * - adblTNode[i]))); - - adblHoldings[i] = dblTrajectoryScaler * java.lang.Math.sinh (dblKappa * (dblT - adblTNode[i])) + - adblHoldingsDriftAdjustment[i]; - - if (i < iNumNode - 1) { - adblTradeListDriftAdjustment[i] = -1. * dblTradeListAdjustmentScaler * (java.lang.Math.cosh - (dblKappa * dblTau * (0.5 + i)) - java.lang.Math.cosh (dblKappa * (dblT - dblTau * (0.5 + - i)))); - - adblTradeList[i] = -1. * dblTradeListScaler * java.lang.Math.cosh (dblKappa * (dblT - dblTau - * (0.5 + i))) + adblTradeListDriftAdjustment[i]; - } - } - - try { - org.drip.measure.gaussian.R1UnivariateNormal r1un = (new - org.drip.execution.capture.TrajectoryShortfallEstimator (new - org.drip.execution.strategy.DiscreteTradingTrajectory (adblTNode, adblHoldings, - adblTradeList))).totalCostDistributionSynopsis (lpep); - - return null == r1un ? null : new org.drip.execution.optimum.AlmgrenChrissDriftDiscrete - (adblTNode, adblHoldings, adblTradeList, adblHoldingsDriftAdjustment, - adblTradeListDriftAdjustment, java.lang.Math.sqrt (dblKappaTildaSquared), dblKappa, - dblResidualHolding, dblAlpha * dblResidualHolding * dblT * (1. - (dblTau * - java.lang.Math.tanh (0.5 * dblKappa * dblT) / (dblT * java.lang.Math.tanh - (dblHalfKappaTau)))), r1un.mean(), r1un.variance(), dblEpochVolatility * dblX - / (dblT * dblEpochVolatility * java.lang.Math.sqrt (dblT))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/nonadaptive/DiscreteLinearTradingEnhanced.java b/org/drip/execution/nonadaptive/DiscreteLinearTradingEnhanced.java deleted file mode 100644 index 9c25867..0000000 --- a/org/drip/execution/nonadaptive/DiscreteLinearTradingEnhanced.java +++ /dev/null @@ -1,151 +0,0 @@ - -package org.drip.execution.nonadaptive; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DiscreteLinearTradingEnhanced contains the Volatility Trading Trajectory generated by the Almgren (2003) - * Scheme under the Criterion of No-Drift AND Linear Temporary Impact Volatility. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * @author Lakshmi Krishnamurthy - */ - -public class DiscreteLinearTradingEnhanced extends org.drip.execution.nonadaptive.StaticOptimalSchemeDiscrete -{ - - /** - * Create the Standard DiscreteLinearTradingEnhanced Instance - * - * @param dblStartHoldings Trajectory Start Holdings - * @param dblFinishTime Trajectory Finish Time - * @param iNumInterval The Number of Fixed Intervals - * @param apep Almgren 2003 Arithmetic Price Evolution Parameters - * @param dblRiskAversion The Risk Aversion Parameter - * - * @return The DiscreteLinearTradingEnhanced Instance - */ - - public static final DiscreteLinearTradingEnhanced Standard ( - final double dblStartHoldings, - final double dblFinishTime, - final int iNumInterval, - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep, - final double dblRiskAversion) - { - try { - return new DiscreteLinearTradingEnhanced - (org.drip.execution.strategy.DiscreteTradingTrajectoryControl.FixedInterval (new - org.drip.execution.strategy.OrderSpecification (dblStartHoldings, dblFinishTime), - iNumInterval), apep, new org.drip.execution.risk.MeanVarianceObjectiveUtility - (dblRiskAversion)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private DiscreteLinearTradingEnhanced ( - final org.drip.execution.strategy.DiscreteTradingTrajectoryControl dttc, - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep, - final org.drip.execution.risk.MeanVarianceObjectiveUtility mvou) - throws java.lang.Exception - { - super (dttc, apep, mvou); - } - - @Override public org.drip.execution.optimum.EfficientTradingTrajectory generate() - { - org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep = priceEvolutionParameters(); - - double dblLambda = ((org.drip.execution.risk.MeanVarianceObjectiveUtility) - objectiveUtility()).riskAversion(); - - double dblSigma = java.lang.Double.NaN; - - try { - dblSigma = apep.arithmeticPriceDynamicsSettings().epochVolatility(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.execution.impact.TransactionFunction tfTemporaryExpectation = - apep.temporaryExpectation().epochImpactFunction(); - - if (!(tfTemporaryExpectation instanceof org.drip.execution.impact.TransactionFunctionLinear)) - return null; - - org.drip.execution.impact.TransactionFunction tfTemporaryVolatility = - apep.temporaryVolatility().epochImpactFunction(); - - if (!(tfTemporaryVolatility instanceof org.drip.execution.impact.TransactionFunctionLinear)) - return null; - - double dblTStar = java.lang.Math.sqrt (((org.drip.execution.impact.TransactionFunctionLinear) - tfTemporaryExpectation).slope() / (dblLambda * dblSigma * dblSigma)); - - return org.drip.execution.optimum.TradingEnhancedDiscrete.Standard - ((org.drip.execution.strategy.DiscreteTradingTrajectory) super.generate(), apep, dblTStar, - dblSigma * dblTStar * dblTStar / ((org.drip.execution.impact.TransactionFunctionLinear) - tfTemporaryVolatility).slope() * java.lang.Math.sqrt (3.)); - } -} diff --git a/org/drip/execution/nonadaptive/StaticOptimalScheme.java b/org/drip/execution/nonadaptive/StaticOptimalScheme.java deleted file mode 100644 index d9309f1..0000000 --- a/org/drip/execution/nonadaptive/StaticOptimalScheme.java +++ /dev/null @@ -1,114 +0,0 @@ - -package org.drip.execution.nonadaptive; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * StaticOptimalScheme generates the Trade/Holdings List of Static Optimal Execution Schedule based on the - * Discrete/Continuous Trade Trajectory Control, the Price Walk Parameters, and the Objective Utility - * Function. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class StaticOptimalScheme { - private org.drip.execution.risk.ObjectiveUtility _ou = null; - private org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters _apep = null; - - protected StaticOptimalScheme ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep, - final org.drip.execution.risk.ObjectiveUtility ou) - throws java.lang.Exception - { - if (null == (_apep = apep) || null == (_ou = ou)) - throw new java.lang.Exception ("StaticOptimalScheme Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Optimizer Objective Utility Function - * - * @return The Optimizer Objective Utility Function - */ - - public org.drip.execution.risk.ObjectiveUtility objectiveUtility() - { - return _ou; - } - - /** - * Retrieve the Asset Arithmetic Price Evolution Parameters - * - * @return The Asset Arithmetic Price Evolution Parameters - */ - - public org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters priceEvolutionParameters() - { - return _apep; - } - - /** - * Invoke the Optimizer, and generate/return the Optimal Trading Trajectory Instance - * - * @return The Optimal Trading Trajectory Instance - */ - - abstract public org.drip.execution.optimum.EfficientTradingTrajectory generate(); -} diff --git a/org/drip/execution/nonadaptive/StaticOptimalSchemeContinuous.java b/org/drip/execution/nonadaptive/StaticOptimalSchemeContinuous.java deleted file mode 100644 index 02b89a7..0000000 --- a/org/drip/execution/nonadaptive/StaticOptimalSchemeContinuous.java +++ /dev/null @@ -1,108 +0,0 @@ - -package org.drip.execution.nonadaptive; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * StaticOptimalSchemeContinuous generates the Trade/Holdings List of Static Optimal Execution Schedule based - * on the Continuous Trade Trajectory Control, the Price Walk Parameters, and the Objective Utility - * Function. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class StaticOptimalSchemeContinuous extends - org.drip.execution.nonadaptive.StaticOptimalScheme { - private org.drip.execution.strategy.OrderSpecification _os = null; - - /** - * StaticOptimalSchemeContinuous Constructor - * - * @param os The Order Specification - * @param apep The Arithmetic Price Walk Parameters - * @param ou The Optimizer Objective Utility Function - * - * @throws java.lang.Exception Thrown if the Inputs are not valid - */ - - public StaticOptimalSchemeContinuous ( - final org.drip.execution.strategy.OrderSpecification os, - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep, - final org.drip.execution.risk.ObjectiveUtility ou) - throws java.lang.Exception - { - super (apep, ou); - - if (null == (_os = os)) - throw new java.lang.Exception ("StaticOptimalSchemeContinuous Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Order Specification - * - * @return The Order Specification - */ - - public org.drip.execution.strategy.OrderSpecification orderSpecification() - { - return _os; - } -} diff --git a/org/drip/execution/nonadaptive/StaticOptimalSchemeDiscrete.java b/org/drip/execution/nonadaptive/StaticOptimalSchemeDiscrete.java deleted file mode 100644 index ac1aef2..0000000 --- a/org/drip/execution/nonadaptive/StaticOptimalSchemeDiscrete.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.execution.nonadaptive; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * StaticOptimalSchemeDiscrete generates the Trade/Holdings List of Static Optimal Execution Schedule based - * on the Discrete Trade Trajectory Control, the Price Walk Parameters, and the Objective Utility Function. - * The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class StaticOptimalSchemeDiscrete extends org.drip.execution.nonadaptive.StaticOptimalScheme { - private org.drip.execution.strategy.DiscreteTradingTrajectoryControl _dttc = null; - - private double[] completeHoldings ( - final double[] adblInnerHoldings) - { - if (null == adblInnerHoldings) return null; - - int iNumCompleteHoldings = adblInnerHoldings.length + 2; - double[] adblCompleteHoldings = new double[iNumCompleteHoldings]; - - for (int i = 0; i < iNumCompleteHoldings; ++i) { - if (0 == i) - adblCompleteHoldings[i] = _dttc.startHoldings(); - else if (iNumCompleteHoldings - 1 == i) - adblCompleteHoldings[i] = 0.; - else - adblCompleteHoldings[i] = adblInnerHoldings[i - 1]; - } - - return adblCompleteHoldings; - } - - private org.drip.execution.sensitivity.ControlNodesGreek objectiveSensitivity ( - final double[] adblInnerHoldings) - { - org.drip.execution.capture.TrajectoryShortfallEstimator tse = null; - - try { - tse = new org.drip.execution.capture.TrajectoryShortfallEstimator - (org.drip.execution.strategy.DiscreteTradingTrajectory.Standard (_dttc.executionTimeNodes(), - completeHoldings (adblInnerHoldings))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep = priceEvolutionParameters(); - - org.drip.execution.sensitivity.ControlNodesGreek cngVariance = tse.varianceContribution (apep); - - org.drip.execution.sensitivity.ControlNodesGreek cngExpectation = tse.expectationContribution (apep); - - if (null == cngExpectation || null == cngVariance) return null; - - return objectiveUtility().sensitivity ((org.drip.execution.sensitivity.TrajectoryControlNodesGreek) - cngExpectation, (org.drip.execution.sensitivity.TrajectoryControlNodesGreek) cngVariance); - } - - private org.drip.function.definition.RdToR1 optimizerRdToR1() - { - return new org.drip.function.definition.RdToR1 (null) { - @Override public int dimension() - { - return _dttc.executionTimeNodes().length - 2; - } - - @Override public double evaluate ( - final double[] adblInnerHoldings) - throws java.lang.Exception - { - org.drip.execution.sensitivity.ControlNodesGreek cngObjectiveUtility = objectiveSensitivity - (adblInnerHoldings); - - if (null == cngObjectiveUtility) - throw new java.lang.Exception - ("StaticOptimalSchemeDiscrete::optimizerRdToR1::evaluate => Invalid Inputs"); - - return cngObjectiveUtility.value(); - } - - @Override public double[] jacobian ( - final double[] adblInnerHoldings) - { - org.drip.execution.sensitivity.ControlNodesGreek cngObjectiveUtility = objectiveSensitivity - (adblInnerHoldings); - - return null == cngObjectiveUtility ? null : cngObjectiveUtility.jacobian(); - } - - @Override public double[][] hessian ( - final double[] adblInnerHoldings) - { - org.drip.execution.sensitivity.ControlNodesGreek cngObjectiveUtility = objectiveSensitivity - (adblInnerHoldings); - - return null == cngObjectiveUtility ? null : cngObjectiveUtility.hessian(); - } - }; - } - - /** - * StaticOptimalSchemeDiscrete Constructor - * - * @param dttc The Discrete Trading Trajectory Control Parameters - * @param apep The Arithmetic Price Walk Parameters - * @param ou The Optimizer Objective Utility Function - * - * @throws java.lang.Exception Thrown if the Inputs are not valid - */ - - public StaticOptimalSchemeDiscrete ( - final org.drip.execution.strategy.DiscreteTradingTrajectoryControl dttc, - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep, - final org.drip.execution.risk.ObjectiveUtility ou) - throws java.lang.Exception - { - super (apep, ou); - - if (null == (_dttc = dttc)) - throw new java.lang.Exception ("StaticOptimalSchemeDiscrete Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Discrete Trajectory Control Settings - * - * @return The Discrete Trajectory Control Settings - */ - - public org.drip.execution.strategy.DiscreteTradingTrajectoryControl control() - { - return _dttc; - } - - @Override public org.drip.execution.optimum.EfficientTradingTrajectory generate() - { - double[] adblExecutionTimeNode = _dttc.executionTimeNodes(); - - org.drip.execution.strategy.DiscreteTradingTrajectory dtt = - org.drip.execution.strategy.DiscreteTradingTrajectory.Linear (adblExecutionTimeNode, - _dttc.startHoldings(), 0.); - - if (null == dtt) return null; - - org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier vicm = null; - - try { - if (null == (vicm = new org.drip.function.rdtor1solver.NewtonFixedPointFinder (optimizerRdToR1(), - null, org.drip.function.rdtor1solver.ConvergenceControl.Standard()).convergeVariate (new - org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier (false, - dtt.innerHoldings(), null)))) - return null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return org.drip.execution.optimum.EfficientTradingTrajectoryDiscrete.Standard (adblExecutionTimeNode, - completeHoldings (vicm.variates()), priceEvolutionParameters()); - } -} diff --git a/org/drip/execution/optimum/AlmgrenChrissDiscrete.java b/org/drip/execution/optimum/AlmgrenChrissDiscrete.java deleted file mode 100644 index af01a26..0000000 --- a/org/drip/execution/optimum/AlmgrenChrissDiscrete.java +++ /dev/null @@ -1,141 +0,0 @@ - -package org.drip.execution.optimum; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AlmgrenChrissDiscrete contains the Trading Trajectory generated by the Almgren and Chriss (2000) Scheme - * under the Criterion of No-Drift. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class AlmgrenChrissDiscrete extends org.drip.execution.optimum.EfficientTradingTrajectoryDiscrete { - private double _dblKappa = java.lang.Double.NaN; - private double _dblKappaTilda = java.lang.Double.NaN; - - /** - * AlmgrenChrissDiscrete Constructor - * - * @param adblExecutionTimeNode Array containing the Trajectory Time Nodes - * @param adblHoldings Array containing the Holdings - * @param adblTradeList Array containing the Trade List - * @param dblKappaTilda AC2000 Kappa-Tilda - * @param dblKappa AC2000 Kappa - * @param dblTransactionCostExpectation The Expected Transaction Cost - * @param dblTransactionCostVariance The Variance of the Transaction Cost - * @param dblMarketPower Estimate of the Relative Market Impact Power - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public AlmgrenChrissDiscrete ( - final double[] adblExecutionTimeNode, - final double[] adblHoldings, - final double[] adblTradeList, - final double dblKappaTilda, - final double dblKappa, - final double dblTransactionCostExpectation, - final double dblTransactionCostVariance, - final double dblMarketPower) - throws java.lang.Exception - { - super (adblExecutionTimeNode, adblHoldings, adblTradeList, dblTransactionCostExpectation, - dblTransactionCostVariance, dblMarketPower); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblKappaTilda = dblKappaTilda) || - !org.drip.quant.common.NumberUtil.IsValid (_dblKappa = dblKappa)) - throw new java.lang.Exception ("AlmgrenChrissDiscrete Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Kappa Tilda - * - * @return The Kappa Tilda - */ - - public double kappaTilda() - { - return _dblKappaTilda; - } - - /** - * Retrieve the Kappa - * - * @return The Kappa - */ - - public double kappa() - { - return _dblKappa; - } - - /** - * Retrieve the Half-Life - * - * @return The Half-Life - */ - - public double halfLife() - { - return 1. / _dblKappa; - } -} diff --git a/org/drip/execution/optimum/AlmgrenChrissDriftDiscrete.java b/org/drip/execution/optimum/AlmgrenChrissDriftDiscrete.java deleted file mode 100644 index 01e89bc..0000000 --- a/org/drip/execution/optimum/AlmgrenChrissDriftDiscrete.java +++ /dev/null @@ -1,181 +0,0 @@ - -package org.drip.execution.optimum; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AlmgrenChrissDriftDiscrete contains the Trading Trajectory generated by the Almgren and Chrissb(2000) - * Scheme under the Criterion of Non-zero Drift. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class AlmgrenChrissDriftDiscrete extends org.drip.execution.optimum.AlmgrenChrissDiscrete { - private double[] _adblHoldingsDriftAdjustment = null; - private double[] _adblTradeListDriftAdjustment = null; - private double _dblResidualHolding = java.lang.Double.NaN; - private double _dblDriftGainUpperBound = java.lang.Double.NaN; - - /** - * AlmgrenChrissDriftDiscrete Constructor - * - * @param adblExecutionTimeNode Array containing the Trajectory Time Nodes - * @param adblHoldings Array containing the Holdings - * @param adblTradeList Array containing the Trade List - * @param adblHoldingsDriftAdjustment Array containing the Holdings Drift Adjustment - * @param adblTradeListDriftAdjustment Array containing the Trade List Drift Adjustment - * @param dblKappaTilda AC2000 Kappa-Tilda - * @param dblKappa AC2000 Kappa - * @param dblResidualHolding The Residual Holdings induced by the Drift - * @param dblDriftGainUpperBound The Upper Bound of the Gain induced by Drift - * @param dblTransactionCostExpectation The Expected Transaction Cost - * @param dblTransactionCostVariance The Variance of the Transaction Cost - * @param dblMarketPower Estimate of the Relative Market Impact Power - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public AlmgrenChrissDriftDiscrete ( - final double[] adblExecutionTimeNode, - final double[] adblHoldings, - final double[] adblTradeList, - final double[] adblHoldingsDriftAdjustment, - final double[] adblTradeListDriftAdjustment, - final double dblKappaTilda, - final double dblKappa, - final double dblResidualHolding, - final double dblDriftGainUpperBound, - final double dblTransactionCostExpectation, - final double dblTransactionCostVariance, - final double dblMarketPower) - throws java.lang.Exception - { - super (adblExecutionTimeNode, adblHoldings, adblTradeList, dblKappaTilda, dblKappa, - dblTransactionCostExpectation, dblTransactionCostVariance, dblMarketPower); - - if (null == (_adblHoldingsDriftAdjustment = adblHoldingsDriftAdjustment) || null == - (_adblTradeListDriftAdjustment = adblTradeListDriftAdjustment) || - !org.drip.quant.common.NumberUtil.IsValid (_dblResidualHolding = dblResidualHolding) || - !org.drip.quant.common.NumberUtil.IsValid (_dblDriftGainUpperBound = - dblDriftGainUpperBound)) - throw new java.lang.Exception ("AlmgrenChrissDriftDiscrete Constructor => Invalid Inputs"); - - int iNumNode = _adblHoldingsDriftAdjustment.length; - - if (0 == iNumNode || iNumNode != _adblTradeListDriftAdjustment.length + 1) - throw new java.lang.Exception ("AlmgrenChrissDriftDiscrete Constructor => Invalid Inputs"); - - for (int i = 0; i < iNumNode; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (_adblHoldingsDriftAdjustment[i])) - throw new java.lang.Exception ("AlmgrenChrissDriftDiscrete Constructor => Invalid Inputs"); - - if (0 != i) { - if (!org.drip.quant.common.NumberUtil.IsValid (_adblTradeListDriftAdjustment[i - 1])) - throw new java.lang.Exception - ("AlmgrenChrissDriftDiscrete Constructor => Invalid Inputs"); - } - } - } - - /** - * Retrieve the Array of the Holdings Drift Adjustment - * - * @return The Array of the Holdings Drift Adjustment - */ - - public double[] holdingsDriftAdjustment() - { - return _adblHoldingsDriftAdjustment; - } - - /** - * Retrieve the Array of the Trade List Drift Adjustment - * - * @return The Array of the Trade List Drift Adjustment - */ - - public double[] tradeListDriftAdjustment() - { - return _adblTradeListDriftAdjustment; - } - - /** - * Retrieve the Residual Holdings induced by the Drift - * - * @return The Residual Holdings induced by the Drift - */ - - public double residualHolding() - { - return _dblResidualHolding; - } - - /** - * Retrieve the Gain Upper Bound induced by the Drift - * - * @return The Gain Upper Bound induced by the Drift - */ - - public double driftGainUpperBound() - { - return _dblDriftGainUpperBound; - } -} diff --git a/org/drip/execution/optimum/EfficientTradingTrajectory.java b/org/drip/execution/optimum/EfficientTradingTrajectory.java deleted file mode 100644 index 7a46b83..0000000 --- a/org/drip/execution/optimum/EfficientTradingTrajectory.java +++ /dev/null @@ -1,96 +0,0 @@ - -package org.drip.execution.optimum; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * EfficientTradingTrajectory contains the Efficient Trading Trajectory generated by one of the Methods - * outlined in the Almgren and Chriss (2000) and Almgren (2003) Scheme for Discrete and Continuous Trading - * Approximation respectively. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * @author Lakshmi Krishnamurthy - */ - -public interface EfficientTradingTrajectory extends org.drip.execution.strategy.TradingTrajectory { - - /** - * Retrieve the Intrinsic Market Power Parameter - * - * @return The Intrinsic Market Power Parameter - */ - - abstract public double marketPower(); - - /** - * Retrieve the Expected Transaction Cost - * - * @return The Expected Transaction Cost - */ - - abstract public double transactionCostExpectation(); - - /** - * Retrieve the Variance of the Expected Transaction Cost - * - * @return The Variance of the Expected Transaction Cost - */ - - abstract public double transactionCostVariance(); -} diff --git a/org/drip/execution/optimum/EfficientTradingTrajectoryContinuous.java b/org/drip/execution/optimum/EfficientTradingTrajectoryContinuous.java deleted file mode 100644 index 4977620..0000000 --- a/org/drip/execution/optimum/EfficientTradingTrajectoryContinuous.java +++ /dev/null @@ -1,154 +0,0 @@ - -package org.drip.execution.optimum; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * EfficientTradingTrajectoryContinuous contains the Efficient Trading Trajectory generated by one of the - * Methods outlined in the Almgren (2003) Scheme for Continuous Trading Approximation. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * @author Lakshmi Krishnamurthy - */ - -public class EfficientTradingTrajectoryContinuous extends - org.drip.execution.strategy.ContinuousTradingTrajectory implements - org.drip.execution.optimum.EfficientTradingTrajectory { - private double _dblMarketPower = java.lang.Double.NaN; - private double _dblCharacteristicTime = java.lang.Double.NaN; - private double _dblTransactionCostVariance = java.lang.Double.NaN; - private double _dblTransactionCostExpectation = java.lang.Double.NaN; - - /** - * EfficientTradingTrajectoryContinuous Constructor - * - * @param dblExecutionTime The Execution Time - * @param dblTransactionCostExpectation The Expected Transaction Cost - * @param dblTransactionCostVariance The Variance of the Transaction Cost - * @param dblCharacteristicTime The Optimal Trajectory's "Characteristic" Time - * @param dblMarketPower The Dimension-less Relative Market Impact - * @param r1ToR1Holdings The Optimal Trajectory R^1 To R^1 Holdings Function - * @param r1ToR1TradeRate The Optimal Trajectory R^1 To R^1 Trade Rate Function - * @param r1ToR1TransactionCostExpectation The Transaction Cost Expectation Function - * @param r1ToR1TransactionCostVariance The Transaction Cost Variance Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public EfficientTradingTrajectoryContinuous ( - final double dblExecutionTime, - final double dblTransactionCostExpectation, - final double dblTransactionCostVariance, - final double dblCharacteristicTime, - final double dblMarketPower, - final org.drip.function.definition.R1ToR1 r1ToR1Holdings, - final org.drip.function.definition.R1ToR1 r1ToR1TradeRate, - final org.drip.function.definition.R1ToR1 r1ToR1TransactionCostExpectation, - final org.drip.function.definition.R1ToR1 r1ToR1TransactionCostVariance) - throws java.lang.Exception - { - super (dblExecutionTime, r1ToR1Holdings, r1ToR1TradeRate, r1ToR1TransactionCostExpectation, - r1ToR1TransactionCostVariance); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblTransactionCostExpectation = - dblTransactionCostExpectation) || !org.drip.quant.common.NumberUtil.IsValid - (_dblTransactionCostVariance = dblTransactionCostVariance) || - !org.drip.quant.common.NumberUtil.IsValid (_dblCharacteristicTime = - dblCharacteristicTime)) - throw new java.lang.Exception - ("EfficientTradingTrajectoryContinuous Constructor => Invalid Inputs"); - } - - @Override public double marketPower() - { - return _dblMarketPower; - } - - @Override public double transactionCostExpectation() - { - return _dblTransactionCostExpectation; - } - - @Override public double transactionCostVariance() - { - return _dblTransactionCostVariance; - } - - /** - * Retrieve the Optimal Trajectory Characteristic Time - * - * @return The Optimal Trajectory Characteristic Time - */ - - public double characteristicTime() - { - return _dblCharacteristicTime; - } - - /** - * Retrieve the Optimal Trajectory Urgency - * - * @return The Optimal Trajectory Urgency - */ - - public double urgency() - { - return 0. == _dblCharacteristicTime ? 0. : 1. / _dblCharacteristicTime; - } -} diff --git a/org/drip/execution/optimum/EfficientTradingTrajectoryDiscrete.java b/org/drip/execution/optimum/EfficientTradingTrajectoryDiscrete.java deleted file mode 100644 index f2479d0..0000000 --- a/org/drip/execution/optimum/EfficientTradingTrajectoryDiscrete.java +++ /dev/null @@ -1,165 +0,0 @@ - -package org.drip.execution.optimum; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * EfficientTradingTrajectoryDiscrete contains the Discrete Trading Trajectory generated by a given Optimal - * Trajectory Generation Scheme. Schemes may be Numerical or Closed Form. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class EfficientTradingTrajectoryDiscrete extends org.drip.execution.strategy.DiscreteTradingTrajectory - implements org.drip.execution.optimum.EfficientTradingTrajectory { - private double _dblMarketPower = java.lang.Double.NaN; - private double _dblTransactionCostVariance = java.lang.Double.NaN; - private double _dblTransactionCostExpectation = java.lang.Double.NaN; - - /** - * Construct a Standard EfficientTradingTrajectoryDiscrete Instance - * - * @param adblExecutionTimeNode Array containing the Trajectory Time Nodes - * @param adblHoldings Array containing the Holdings - * @param apep The Arithmetic Price Walk Evolution Parameters - * - * @return The EfficientTradingTrajectoryDiscrete Instance - */ - - public static EfficientTradingTrajectoryDiscrete Standard ( - final double[] adblExecutionTimeNode, - final double[] adblHoldings, - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep) - { - if (null == apep) return null; - - org.drip.execution.strategy.DiscreteTradingTrajectory dtt = - org.drip.execution.strategy.DiscreteTradingTrajectory.Standard (adblExecutionTimeNode, - adblHoldings); - - if (null == dtt) return null; - - double dblExecutionTime = dtt.executionTime(); - - try { - org.drip.measure.gaussian.R1UnivariateNormal r1un = (new - org.drip.execution.capture.TrajectoryShortfallEstimator (dtt)).totalCostDistributionSynopsis - (apep); - - return null == r1un ? null : new EfficientTradingTrajectoryDiscrete (adblExecutionTimeNode, - adblHoldings, dtt.tradeList(), r1un.mean(), r1un.variance(), - apep.temporaryExpectation().epochImpactFunction().evaluate (dtt.tradeSize(), - dblExecutionTime) / (apep.arithmeticPriceDynamicsSettings().epochVolatility() * - java.lang.Math.sqrt (dblExecutionTime))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * EfficientTradingTrajectoryDiscrete Constructor - * - * @param adblExecutionTimeNode Array containing the Trajectory Time Nodes - * @param adblHoldings Array containing the Holdings - * @param adblTradeList Array containing the Trade List - * @param dblTransactionCostExpectation The Expected Transaction Cost - * @param dblTransactionCostVariance The Variance of the Transaction Cost - * @param dblMarketPower The Dimension-less Relative Market Impact - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public EfficientTradingTrajectoryDiscrete ( - final double[] adblExecutionTimeNode, - final double[] adblHoldings, - final double[] adblTradeList, - final double dblTransactionCostExpectation, - final double dblTransactionCostVariance, - final double dblMarketPower) - throws java.lang.Exception - { - super (adblExecutionTimeNode, adblHoldings, adblTradeList); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblTransactionCostExpectation = - dblTransactionCostExpectation) || !org.drip.quant.common.NumberUtil.IsValid - (_dblTransactionCostVariance = dblTransactionCostVariance) || - !org.drip.quant.common.NumberUtil.IsValid (_dblMarketPower = dblMarketPower)) - throw new java.lang.Exception - ("EfficientTradingTrajectoryDiscrete Constructor => Invalid Inputs"); - } - - @Override public double marketPower() - { - return _dblMarketPower; - } - - @Override public double transactionCostExpectation() - { - return _dblTransactionCostExpectation; - } - - @Override public double transactionCostVariance() - { - return _dblTransactionCostVariance; - } -} diff --git a/org/drip/execution/optimum/PowerImpactContinuous.java b/org/drip/execution/optimum/PowerImpactContinuous.java deleted file mode 100644 index 78fac3a..0000000 --- a/org/drip/execution/optimum/PowerImpactContinuous.java +++ /dev/null @@ -1,191 +0,0 @@ - -package org.drip.execution.optimum; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PowerImpactContinuous contains the Trading Trajectory generated by the Almgren (2003) Power Impact Scheme - * under the Criterion of No-Drift. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * @author Lakshmi Krishnamurthy - */ - -public class PowerImpactContinuous extends org.drip.execution.optimum.EfficientTradingTrajectoryContinuous { - private double _dblExecutionTimeUpperBound = java.lang.Double.NaN; - private double _dblHyperboloidBoundaryValue = java.lang.Double.NaN; - - /** - * Construct the Standard PowerImpactContinuous Instance - * - * @param dblExecutionTime The Execution Time - * @param dblTransactionCostExpectation The Expected Transaction Cost - * @param dblTransactionCostVariance The Variance of the Transaction Cost - * @param dblCharacteristicTime The Optimal Trajectory's "Characteristic" Time - * @param dblExecutionTimeUpperBound The Optimal Trajectory's Execution Time Upper Bound (if it exists) - * @param dblHyperboloidBoundaryValue The Hyperboloid Boundary Value - * @param dblMarketPower The Dimension-less Relative Market Impact - * @param r1ToR1Holdings The Optimal Trajectory R^1 To R^1 Holdings Function - * @param r1ToR1TransactionCostExpectation The Transaction Cost Expectation Function - * @param r1ToR1TransactionCostVariance The Transaction Cost Variance Function - * - * @return The Standard PowerImpactContinuous Instance - */ - - public static PowerImpactContinuous Standard ( - final double dblExecutionTime, - final double dblTransactionCostExpectation, - final double dblTransactionCostVariance, - final double dblCharacteristicTime, - final double dblExecutionTimeUpperBound, - final double dblHyperboloidBoundaryValue, - final double dblMarketPower, - final org.drip.function.definition.R1ToR1 r1ToR1Holdings, - final org.drip.function.definition.R1ToR1 r1ToR1TransactionCostExpectation, - final org.drip.function.definition.R1ToR1 r1ToR1TransactionCostVariance) - { - if (null == r1ToR1Holdings) return null; - - try { - org.drip.function.definition.R1ToR1 r1ToR1TradeRate = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - return r1ToR1Holdings.derivative (dblVariate, 1); - } - }; - - return new PowerImpactContinuous (dblExecutionTime, dblTransactionCostExpectation, - dblTransactionCostVariance, dblCharacteristicTime, dblExecutionTimeUpperBound, - dblHyperboloidBoundaryValue, dblMarketPower, r1ToR1Holdings, r1ToR1TradeRate, - r1ToR1TransactionCostExpectation, r1ToR1TransactionCostVariance); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * PowerImpactContinuous Constructor - * - * @param dblExecutionTime The Execution Time - * @param dblTransactionCostExpectation The Expected Transaction Cost - * @param dblTransactionCostVariance The Variance of the Transaction Cost - * @param dblCharacteristicTime The Optimal Trajectory's "Characteristic" Time - * @param dblExecutionTimeUpperBound The Optimal Trajectory's Execution Time Upper Bound (if it exists) - * @param dblHyperboloidBoundaryValue The Hyperboloid Boundary Value - * @param dblMarketPower The Dimension-less Relative Market Impact - * @param r1ToR1Holdings The Optimal Trajectory R^1 To R^1 Holdings Function - * @param r1ToR1TradeRate The Optimal Trajectory R^1 To R^1 Trade Rate Function - * @param r1ToR1TransactionCostExpectation The Transaction Cost Expectation Function - * @param r1ToR1TransactionCostVariance The Transaction Cost Variance Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public PowerImpactContinuous ( - final double dblExecutionTime, - final double dblTransactionCostExpectation, - final double dblTransactionCostVariance, - final double dblCharacteristicTime, - final double dblExecutionTimeUpperBound, - final double dblHyperboloidBoundaryValue, - final double dblMarketPower, - final org.drip.function.definition.R1ToR1 r1ToR1Holdings, - final org.drip.function.definition.R1ToR1 r1ToR1TradeRate, - final org.drip.function.definition.R1ToR1 r1ToR1TransactionCostExpectation, - final org.drip.function.definition.R1ToR1 r1ToR1TransactionCostVariance) - throws java.lang.Exception - { - super (dblExecutionTime, dblTransactionCostExpectation, dblTransactionCostVariance, - dblCharacteristicTime, dblMarketPower, r1ToR1Holdings, r1ToR1TradeRate, - r1ToR1TransactionCostExpectation, r1ToR1TransactionCostVariance); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblHyperboloidBoundaryValue = - dblHyperboloidBoundaryValue)) - throw new java.lang.Exception ("PowerImpactContinuous Constructor => Invalid Inputs"); - - _dblExecutionTimeUpperBound = dblExecutionTimeUpperBound; - } - - /** - * Retrieve the Optimal Trajectory Execution Time Upper Bound (if it exists) - * - * @return The Optimal Trajectory Execution Time Upper Bound (if it exists) - */ - - public double executionTimeUpperBound() - { - return _dblExecutionTimeUpperBound; - } - - /** - * Retrieve the Optimal Trajectory Hyperboloid Boundary Value - * - * @return The Optimal Trajectory Hyperboloid Boundary Value - */ - - public double hyperboloidBoundaryValue() - { - return _dblHyperboloidBoundaryValue; - } -} diff --git a/org/drip/execution/optimum/TradingEnhancedDiscrete.java b/org/drip/execution/optimum/TradingEnhancedDiscrete.java deleted file mode 100644 index 5f85cab..0000000 --- a/org/drip/execution/optimum/TradingEnhancedDiscrete.java +++ /dev/null @@ -1,166 +0,0 @@ - -package org.drip.execution.optimum; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TradingEnhancedDiscrete contains the Trading Trajectory generated by one of the Methods outlined in the - * Almgren (2003) Scheme for Continuous Trading Approximation for Linear Trading Enhanced Temporary Impact - * Volatility. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * @author Lakshmi Krishnamurthy - */ - -public class TradingEnhancedDiscrete extends org.drip.execution.optimum.EfficientTradingTrajectoryDiscrete { - private double _dblCharacteristicSize = java.lang.Double.NaN; - private double _dblCharacteristicTime = java.lang.Double.NaN; - - /** - * Construct a Standard TradingEnhancedDiscrete Instance - * - * @param dtt The Trading Trajectory - * @param apep The Arithmetic Price Walk Evolution Parameters - * @param dblCharacteristicTime The Optimal Trajectory's "Characteristic" Time - * @param dblCharacteristicSize The Optimal Trajectory's "Characteristic" Size - * - * @return The TradingEnhancedDiscrete Instance - */ - - public static TradingEnhancedDiscrete Standard ( - final org.drip.execution.strategy.DiscreteTradingTrajectory dtt, - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep, - final double dblCharacteristicTime, - final double dblCharacteristicSize) - { - if (null == dtt || null == apep) return null; - - try { - org.drip.measure.gaussian.R1UnivariateNormal r1un = (new - org.drip.execution.capture.TrajectoryShortfallEstimator (dtt)).totalCostDistributionSynopsis - (apep); - - return null == r1un ? null : new TradingEnhancedDiscrete (dtt.executionTimeNode(), - dtt.holdings(), dtt.tradeList(), r1un.mean(), r1un.variance(), dblCharacteristicTime, - dblCharacteristicSize, apep.temporaryExpectation().epochImpactFunction().evaluate - (dtt.instantTradeRate()) / (apep.arithmeticPriceDynamicsSettings().epochVolatility() - * java.lang.Math.sqrt (dtt.executionTime()))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * TradingEnhancedDiscrete Constructor - * - * @param adblExecutionTimeNode Array containing the Trajectory Time Nodes - * @param adblHoldings Array containing the Holdings - * @param adblTradeList Array containing the Trade List - * @param dblTransactionCostExpectation The Expected Transaction Cost - * @param dblTransactionCostVariance The Variance of the Transaction Cost - * @param dblCharacteristicTime The Optimal Trajectory's "Characteristic" Time - * @param dblCharacteristicSize The Optimal Trajectory's "Characteristic" Size - * @param dblMarketPower Estimate of the Relative Market Impact Power - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public TradingEnhancedDiscrete ( - final double[] adblExecutionTimeNode, - final double[] adblHoldings, - final double[] adblTradeList, - final double dblTransactionCostExpectation, - final double dblTransactionCostVariance, - final double dblCharacteristicTime, - final double dblCharacteristicSize, - final double dblMarketPower) - throws java.lang.Exception - { - super (adblExecutionTimeNode, adblHoldings, adblTradeList, dblTransactionCostExpectation, - dblTransactionCostVariance, dblMarketPower); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblCharacteristicTime = dblCharacteristicTime) || - !org.drip.quant.common.NumberUtil.IsValid (_dblCharacteristicSize = dblCharacteristicSize)) - throw new java.lang.Exception ("TradingEnhancedDiscrete Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Optimal Trajectory Characteristic Size - * - * @return The Optimal Trajectory Characteristic Size - */ - - public double characteristicSize() - { - return _dblCharacteristicSize; - } - - /** - * Retrieve the Optimal Trajectory Characteristic Time - * - * @return The Optimal Trajectory Characteristic Time - */ - - public double characteristicTime() - { - return _dblCharacteristicTime; - } -} diff --git a/org/drip/execution/parameters/ArithmeticPriceDynamicsSettings.java b/org/drip/execution/parameters/ArithmeticPriceDynamicsSettings.java deleted file mode 100644 index 052f730..0000000 --- a/org/drip/execution/parameters/ArithmeticPriceDynamicsSettings.java +++ /dev/null @@ -1,177 +0,0 @@ - -package org.drip.execution.parameters; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ArithmeticPriceDynamicsSettings contains the Arithmetic Price Evolution Dynamics Parameters used in the - * Almgren and Chriss (2000) Optimal Trajectory Generation Scheme. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class ArithmeticPriceDynamicsSettings { - private double _dblDrift = java.lang.Double.NaN; - private double _dblSerialCorrelation = java.lang.Double.NaN; - private org.drip.function.definition.R1ToR1 _r1ToR1Volatility = null; - - /** - * Construct the Asset Dynamics Settings from the Annual Returns Parameters - * - * @param dblAnnualReturnsExpectation The Asset Annual Expected Returns - * @param dblAnnualReturnsVolatility The Asset Annual Returns Volatility - * @param dblSerialCorrelation The Asset Serial Correlation - * @param dblPrice The Asset Price - * - * @return The Asset Dynamics Settings from the Annual Returns Parameters - */ - - public static final ArithmeticPriceDynamicsSettings FromAnnualReturnsSettings ( - final double dblAnnualReturnsExpectation, - final double dblAnnualReturnsVolatility, - final double dblSerialCorrelation, - final double dblPrice) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblAnnualReturnsExpectation) || - !org.drip.quant.common.NumberUtil.IsValid (dblAnnualReturnsVolatility) || - !org.drip.quant.common.NumberUtil.IsValid (dblPrice)) - return null; - - try { - return new ArithmeticPriceDynamicsSettings (dblPrice * dblAnnualReturnsExpectation / 250., new - org.drip.function.r1tor1.FlatUnivariate (dblPrice * dblAnnualReturnsVolatility / - java.lang.Math.sqrt (250.)), dblSerialCorrelation); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * ArithmeticPriceDynamicsSettings Constructor - * - * @param dblDrift The Asset Daily Arithmetic Drift - * @param r1ToR1Volatility The R^1 To R^1 Volatility Function - * @param dblSerialCorrelation The Asset Serial Correlation - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ArithmeticPriceDynamicsSettings ( - final double dblDrift, - final org.drip.function.definition.R1ToR1 r1ToR1Volatility, - final double dblSerialCorrelation) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblDrift = dblDrift) || null == (_r1ToR1Volatility = - r1ToR1Volatility)|| !org.drip.quant.common.NumberUtil.IsValid (_dblSerialCorrelation = - dblSerialCorrelation) || 1. < _dblSerialCorrelation || -1. > _dblSerialCorrelation) - throw new java.lang.Exception ("ArithmeticPriceDynamicsSettings Constructor => Invalid Inputs!"); - } - - /** - * Retrieve the Asset Annual Logarithmic Drift - * - * @return The Asset Annual Logarithmic Drift - */ - - public double drift() - { - return _dblDrift; - } - - /** - * Retrieve the Asset Annual Volatility - * - * @return The Asset Annual Volatility - * - * @throws java.lang.Exception - Thrown if the Inputs are Invalid - */ - - public double epochVolatility() - throws java.lang.Exception - { - return _r1ToR1Volatility.evaluate (0.); - } - - /** - * Retrieve the Asset Annual Volatility Function - * - * @return The Asset Annual Volatility Function - */ - - public org.drip.function.definition.R1ToR1 volatilityFunction() - { - return _r1ToR1Volatility; - } - - /** - * Retrieve the Asset Serial Correlation - * - * @return The Asset Serial Correlation - */ - - public double serialCorrelation() - { - return _dblSerialCorrelation; - } -} diff --git a/org/drip/execution/parameters/AssetFlowSettings.java b/org/drip/execution/parameters/AssetFlowSettings.java deleted file mode 100644 index 23d15a0..0000000 --- a/org/drip/execution/parameters/AssetFlowSettings.java +++ /dev/null @@ -1,210 +0,0 @@ - -package org.drip.execution.parameters; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AssetFlowSettings contains the Asset's Market Flow Parameters that are determined empirically from - * Almgren, Thum, Hauptmann, and Li (2005), using the Parameterization of Almgren (2003). The References - * are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class AssetFlowSettings { - private java.lang.String _strAssetID = ""; - private double _dblDailyVolatility = java.lang.Double.NaN; - private double _dblNumberOutstanding = java.lang.Double.NaN; - private double _dblAverageDailyVolume = java.lang.Double.NaN; - - /** - * AssetFlowSettings Constructor - * - * @param strAssetID The Asset ID - * @param dblAverageDailyVolume The Asset Average Daily Volume - * @param dblNumberOutstanding The Number of Trade-able Asset Units Outstanding - * @param dblDailyVolatility The Asset Daily Volatility - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public AssetFlowSettings ( - final java.lang.String strAssetID, - final double dblAverageDailyVolume, - final double dblNumberOutstanding, - final double dblDailyVolatility) - throws java.lang.Exception - { - if (null == (_strAssetID = strAssetID) || _strAssetID.isEmpty() || - !org.drip.quant.common.NumberUtil.IsValid (_dblAverageDailyVolume = dblAverageDailyVolume) || - !org.drip.quant.common.NumberUtil.IsValid (_dblNumberOutstanding = dblNumberOutstanding) || - !org.drip.quant.common.NumberUtil.IsValid (_dblDailyVolatility = dblDailyVolatility) || - 0. >= _dblNumberOutstanding || 0. >= _dblDailyVolatility) - throw new java.lang.Exception ("AssetFlowSettings Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Asset ID - * - * @return The Asset ID - */ - - public java.lang.String assetID() - { - return _strAssetID; - } - - /** - * Retrieve the Average Daily Volume - * - * @return The Average Daily Volume - */ - - public double averageDailyVolume() - { - return _dblAverageDailyVolume; - } - - /** - * Retrieve the Daily Volatility - * - * @return The Daily Volatility - */ - - public double dailyVolatility() - { - return _dblDailyVolatility; - } - - /** - * Retrieve the Outstanding Number of the Traded Units - * - * @return The Outstanding Number of the Traded Units - */ - - public double outstandingUnits() - { - return _dblNumberOutstanding; - } - - /** - * Retrieve the Daily Turnover - * - * @return The Daily Turnover - */ - - public double turnover() - { - return _dblAverageDailyVolume / _dblNumberOutstanding; - } - - /** - * Retrieve the Daily Inverse Turnover - * - * @return The Daily Inverse Turnover - */ - - public double inverseTurnover() - { - return _dblNumberOutstanding / _dblAverageDailyVolume; - } - - /** - * Retrieve the Normalized Trade Size - * - * @param dblRawTradeSize The Raw Trade Size - * @param dblTime The Time - * - * @return The Normalized Trade Size - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double normalizeTradeSize ( - final double dblRawTradeSize, - final double dblTime) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblRawTradeSize) || - !org.drip.quant.common.NumberUtil.IsValid (dblTime)) - throw new java.lang.Exception ("AssetFlowSettings::normalizeTradeSize => Invalid Inputs"); - - return dblRawTradeSize / (_dblAverageDailyVolume * dblTime); - } - - /** - * De-normalize the Specified Temporary/Permanent Impact - * - * @param dblNormalizedImpact The Normalized Impact - * - * @return The De-normalized Temporary/Permanent Impact - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double denormalizeImpact ( - final double dblNormalizedImpact) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblNormalizedImpact)) - throw new java.lang.Exception ("AssetFlowSettings::denormalizeImpact => Invalid Inputs"); - - return dblNormalizedImpact * _dblDailyVolatility; - } -} diff --git a/org/drip/execution/parameters/AssetTransactionSettings.java b/org/drip/execution/parameters/AssetTransactionSettings.java deleted file mode 100644 index 5dabd08..0000000 --- a/org/drip/execution/parameters/AssetTransactionSettings.java +++ /dev/null @@ -1,132 +0,0 @@ - -package org.drip.execution.parameters; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ArithmeticLinearMarketImpact contains the Arithmetic Linear Market Impact Inputs used in the Construction - * of the Impact Parameters for the Almgren and Chriss (2000) Optimal Trajectory Generation Scheme. The - * References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class AssetTransactionSettings { - private double _dblPrice = java.lang.Double.NaN; - private double _dblBidAskSpread = java.lang.Double.NaN; - private double _dblBackgroundVolume = java.lang.Double.NaN; - - /** - * AssetTransactionSettings Constructor - * - * @param dblPrice The Asset Price - * @param dblBackgroundVolume The Background Volume - * @param dblBidAskSpread The Bid-Ask Spread - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public AssetTransactionSettings ( - final double dblPrice, - final double dblBackgroundVolume, - final double dblBidAskSpread) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblPrice = dblPrice) || 0. >= _dblPrice || - !org.drip.quant.common.NumberUtil.IsValid (_dblBackgroundVolume = dblBackgroundVolume) || 0. >= - _dblBackgroundVolume || !org.drip.quant.common.NumberUtil.IsValid (_dblBidAskSpread = - dblBidAskSpread)) - throw new java.lang.Exception ("AssetTransactionSettings Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Asset Price - * - * @return The Asset Price - */ - - public double price() - { - return _dblPrice; - } - - /** - * Retrieve the Bid-Ask Spread - * - * @return The Bid-Ask Spread - */ - - public double bidAskSpread() - { - return _dblBidAskSpread; - } - - /** - * Retrieve the Background Volume - * - * @return The Background Volume - */ - - public double backgroundVolume() - { - return _dblBackgroundVolume; - } -} diff --git a/org/drip/execution/parameters/PriceMarketImpact.java b/org/drip/execution/parameters/PriceMarketImpact.java deleted file mode 100644 index 4fcbac1..0000000 --- a/org/drip/execution/parameters/PriceMarketImpact.java +++ /dev/null @@ -1,137 +0,0 @@ - -package org.drip.execution.parameters; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PriceMarketImpact contains the Price Market Impact Inputs used in the Construction of the Impact - * Parameters for the Almgren and Chriss (2000) Optimal Trajectory Generation Scheme. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class PriceMarketImpact { - private double _dblPermanentImpactFactor = java.lang.Double.NaN; - private double _dblTemporaryImpactFactor = java.lang.Double.NaN; - private org.drip.execution.parameters.AssetTransactionSettings _ats = null; - - protected PriceMarketImpact ( - final org.drip.execution.parameters.AssetTransactionSettings ats, - final double dblPermanentImpactFactor, - final double dblTemporaryImpactFactor) - throws java.lang.Exception - { - if (null == (_ats = ats) || !org.drip.quant.common.NumberUtil.IsValid (_dblPermanentImpactFactor = - dblPermanentImpactFactor) || 0. > _dblPermanentImpactFactor || - !org.drip.quant.common.NumberUtil.IsValid (_dblTemporaryImpactFactor = - dblTemporaryImpactFactor) || 0. >= _dblTemporaryImpactFactor) - throw new java.lang.Exception ("PriceMarketImpact Constructor => Invalid Inputs"); - } - - /** - * Retrieve the AssetTransactionSettings Instance - * - * @return The AssetTransactionSettings Instance - */ - - public org.drip.execution.parameters.AssetTransactionSettings ats() - { - return _ats; - } - - /** - * Retrieve the Fraction of the Daily Volume that triggers One Bid-Ask of Permanent Impact Cost - * - * @return The Fraction of the Daily Volume that triggers One Bid-Ask of Permanent Impact Cost - */ - - public double permanentImpactFactor() - { - return _dblPermanentImpactFactor; - } - - /** - * Retrieve the Fraction of the Daily Volume that triggers One Bid-Ask of Temporary Impact Cost - * - * @return The Fraction of the Daily Volume that triggers One Bid-Ask of Temporary Impact Cost - */ - - public double temporaryImpactFactor() - { - return _dblTemporaryImpactFactor; - } - - /** - * Generate the Permanent Impact Transaction Function - * - * @return The Permanent Impact Transaction Function - */ - - abstract public org.drip.execution.impact.TransactionFunction permanentTransactionFunction(); - - /** - * Generate the Temporary Impact Transaction Function - * - * @return The Temporary Impact Transaction Function - */ - - abstract public org.drip.execution.impact.TransactionFunction temporaryTransactionFunction(); -} diff --git a/org/drip/execution/parameters/PriceMarketImpactLinear.java b/org/drip/execution/parameters/PriceMarketImpactLinear.java deleted file mode 100644 index 3e5df80..0000000 --- a/org/drip/execution/parameters/PriceMarketImpactLinear.java +++ /dev/null @@ -1,161 +0,0 @@ - -package org.drip.execution.parameters; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PriceMarketImpactLinear contains the Linear Price Market Impact Inputs used in the Construction of the - * Impact Parameters for the Almgren and Chriss (2000) Optimal Trajectory Generation Scheme. The References - * are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class PriceMarketImpactLinear extends org.drip.execution.parameters.PriceMarketImpact { - - /** - * Construct a Standard PriceMarketImpactLinear Instance - * - * @param dblPrice The Asset Price - * @param dblDailyVolume The Daily Volume - * @param dblBidAskSpread The Bid-Ask Spread - * - * @return The Standard PriceMarketImpactLinear Instance - */ - - public static final PriceMarketImpactLinear AlmgrenChriss ( - final double dblPrice, - final double dblDailyVolume, - final double dblBidAskSpread) - { - try { - return new PriceMarketImpactLinear (new org.drip.execution.parameters.AssetTransactionSettings - (dblPrice, dblDailyVolume, dblBidAskSpread), 0.1, 0.01); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * PriceMarketImpactLinear Constructor - * - * @param ats The Asset Transaction Settings Instance - * @param dblPermanentImpactFactor The Fraction of the Daily Volume that triggers One Bid-Ask of - * Permanent Impact Cost - * @param dblTemporaryImpactFactor The Fraction of the Daily Volume that triggers One Bid-Ask of - * Temporary Impact Cost - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public PriceMarketImpactLinear ( - final org.drip.execution.parameters.AssetTransactionSettings ats, - final double dblPermanentImpactFactor, - final double dblTemporaryImpactFactor) - throws java.lang.Exception - { - super (ats, dblPermanentImpactFactor, dblTemporaryImpactFactor); - } - - /** - * Generate the Permanent Impact Transaction Function - * - * @return The Permanent Impact Transaction Function - */ - - public org.drip.execution.impact.TransactionFunction permanentTransactionFunction() - { - org.drip.execution.parameters.AssetTransactionSettings ats = ats(); - - try { - return new org.drip.execution.impact.ParticipationRateLinear (0., ats.bidAskSpread() / - (permanentImpactFactor() * ats.backgroundVolume())); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Temporary Impact Transaction Function - * - * @return The Temporary Impact Transaction Function - */ - - public org.drip.execution.impact.TransactionFunction temporaryTransactionFunction() - { - org.drip.execution.parameters.AssetTransactionSettings ats = ats(); - - double dblBidAskSpread = ats.bidAskSpread(); - - try { - return new org.drip.execution.impact.ParticipationRateLinear (0.5 * dblBidAskSpread, - dblBidAskSpread / (temporaryImpactFactor() * ats.backgroundVolume())); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/parameters/PriceMarketImpactPower.java b/org/drip/execution/parameters/PriceMarketImpactPower.java deleted file mode 100644 index a882404..0000000 --- a/org/drip/execution/parameters/PriceMarketImpactPower.java +++ /dev/null @@ -1,157 +0,0 @@ - -package org.drip.execution.parameters; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - * pricing/valuation, risk, and market making. - * - * 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. - */ - -/** - * PriceMarketImpactPower contains the Power Law based Price Market Impact Inputs used in the Construction of - * the Impact Parameters for the Almgren and Chriss (2000) Optimal Trajectory Generation Scheme. The - * References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * @author Lakshmi Krishnamurthy - */ - -public class PriceMarketImpactPower extends org.drip.execution.parameters.PriceMarketImpact { - private double _dblTemporaryImpactExponent = java.lang.Double.NaN; - private double _dblDailyVolumeExecutionFactor = java.lang.Double.NaN; - - /** - * PriceMarketImpactPower Constructor - * - * @param ats The Asset Transaction Settings Instance - * @param dblPermanentImpactFactor The Fraction of the Daily Volume that triggers One Bid-Ask of - * Permanent Impact Cost - * @param dblTemporaryImpactFactor The Fraction of the Daily Volume that triggers One Bid-Ask of - * Temporary Impact Cost - * @param dblDailyVolumeExecutionFactor The Daily Reference Execution Rate as a Proportion of the Daily - * Volume - * @param dblTemporaryImpactExponent The Temporary Impact Exponent - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public PriceMarketImpactPower ( - final org.drip.execution.parameters.AssetTransactionSettings ats, - final double dblPermanentImpactFactor, - final double dblTemporaryImpactFactor, - final double dblDailyVolumeExecutionFactor, - final double dblTemporaryImpactExponent) - throws java.lang.Exception - { - super (ats, dblPermanentImpactFactor, dblTemporaryImpactFactor); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblDailyVolumeExecutionFactor = - dblDailyVolumeExecutionFactor) || 0. >= _dblDailyVolumeExecutionFactor || - !org.drip.quant.common.NumberUtil.IsValid (_dblTemporaryImpactExponent = - dblTemporaryImpactExponent)) - throw new java.lang.Exception ("PriceMarketImpactPower Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Daily Reference Execution Rate as a Proportion of the Daily Volume - * - * @return The Daily Reference Execution Rate as a Proportion of the Daily Volume - */ - - public double dailyVolumeExecutionFactor() - { - return _dblDailyVolumeExecutionFactor; - } - - /** - * Generate the Permanent Impact Transaction Function - * - * @return The Permanent Impact Transaction Function - */ - - public org.drip.execution.impact.TransactionFunction permanentTransactionFunction() - { - try { - return new org.drip.execution.impact.ParticipationRateLinear (0., 0.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Temporary Impact Transaction Function - * - * @return The Temporary Impact Transaction Function - */ - - public org.drip.execution.impact.TransactionFunction temporaryTransactionFunction() - { - org.drip.execution.parameters.AssetTransactionSettings ats = ats(); - - try { - return new org.drip.execution.impact.ParticipationRatePower (ats.price() * - temporaryImpactFactor() / java.lang.Math.pow (ats.backgroundVolume() * - _dblDailyVolumeExecutionFactor, _dblTemporaryImpactExponent), - _dblTemporaryImpactExponent); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/principal/Almgren2003Estimator.java b/org/drip/execution/principal/Almgren2003Estimator.java deleted file mode 100644 index 437ea27..0000000 --- a/org/drip/execution/principal/Almgren2003Estimator.java +++ /dev/null @@ -1,250 +0,0 @@ - -package org.drip.execution.principal; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * Almgren2003Estimator generates the Gross Profit Distribution and the Information Ratio for a given Level - * of Principal Discount for an Optimal Trajectory that is generated using the Almgren (2003) Scheme. The - * References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 16 (6) 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class Almgren2003Estimator extends org.drip.execution.principal.GrossProfitEstimator { - private org.drip.execution.dynamics.LinearPermanentExpectationParameters _lpep = null; - - /** - * Almgren2003Estimator Constructor - * - * @param pic The Power Continuous Market Impact Trajectory - * @param lpep The Linear Permanent Expectation Paremeter - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public Almgren2003Estimator ( - final org.drip.execution.optimum.PowerImpactContinuous pic, - final org.drip.execution.dynamics.LinearPermanentExpectationParameters lpep) - throws java.lang.Exception - { - super (pic); - - if (null == (_lpep = lpep)) - throw new java.lang.Exception ("Almgren2003Estimator Constructor => Invalid Inputs"); - } - - /** - * Generate the Horizon that results in the Optimal Information Ratio - * - * @param dblD The Principal Discount "D" - * - * @return The Horizon that results in the Optimal Information Ratio - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double optimalInformationRatioHorizon ( - final double dblD) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblD)) - throw new java.lang.Exception - ("Almgren2003Estimator::optimalInformationRatioHorizon => Invalid Inputs"); - - org.drip.execution.impact.TransactionFunctionPower tfpTemporaryExpectation = - (org.drip.execution.impact.TransactionFunctionPower) - _lpep.temporaryExpectation().epochImpactFunction(); - - double dblGamma = ((org.drip.execution.impact.TransactionFunctionLinear) - _lpep.linearPermanentExpectation().epochImpactFunction()).slope(); - - double dblEta = tfpTemporaryExpectation.constant(); - - double dblK = tfpTemporaryExpectation.exponent(); - - double dblX = efficientTrajectory().tradeSize(); - - return dblX * java.lang.Math.pow (dblEta * (dblK + 1.) * (dblK + 1.) / (3. * dblK + 1.) / (dblD - 0.5 - * dblGamma * dblX), 1. / dblK); - } - - /** - * Compute the Optimal Information Ratio - * - * @param dblD The Principal Discount "D" - * - * @return The Optimal Information Ratio - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double optimalInformationRatio ( - final double dblD) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblD)) - throw new java.lang.Exception - ("Almgren2003Estimator::optimalInformationRatio => Invalid Inputs"); - - org.drip.execution.impact.TransactionFunctionPower tfpTemporaryExpectation = - (org.drip.execution.impact.TransactionFunctionPower) - _lpep.temporaryExpectation().epochImpactFunction(); - - double dblSigma = _lpep.arithmeticPriceDynamicsSettings().epochVolatility(); - - double dblGamma = ((org.drip.execution.impact.TransactionFunctionLinear) - _lpep.linearPermanentExpectation().epochImpactFunction()).slope(); - - double dblEta = tfpTemporaryExpectation.constant(); - - double dblK = tfpTemporaryExpectation.exponent(); - - double dblX = efficientTrajectory().tradeSize(); - - return java.lang.Math.pow (3. * dblK + 1. , (1. * dblK + 2.) / (2. * dblK)) / - java.lang.Math.pow (1. * dblK + 1. , (3. * dblK + 4.) / (2. * dblK)) * - java.lang.Math.pow (dblD - 0.5 * dblGamma * dblX, (1. * dblK + 1.) / (1. * dblK)) / - java.lang.Math.pow (dblEta , (0. * dblK + 1.) / (1. * dblK)) / - (dblX * dblSigma); - } - - /** - * Compute the Principal Discount Hurdle given the Information Ratio - * - * @param dblI The Optimal Information Ratio "I" - * - * @return The Principal Discount Hurdle - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double principalDiscountHurdle ( - final double dblI) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblI)) - throw new java.lang.Exception - ("Almgren2003Estimator::principalDiscountHurdle => Invalid Inputs"); - - org.drip.execution.impact.TransactionFunctionPower tfpTemporaryExpectation = - (org.drip.execution.impact.TransactionFunctionPower) - _lpep.temporaryExpectation().epochImpactFunction(); - - double dblEta = tfpTemporaryExpectation.constant(); - - double dblGamma = ((org.drip.execution.impact.TransactionFunctionLinear) - _lpep.linearPermanentExpectation().epochImpactFunction()).slope(); - - double dblSigma = _lpep.arithmeticPriceDynamicsSettings().epochVolatility(); - - double dblK = tfpTemporaryExpectation.exponent(); - - double dblX = efficientTrajectory().tradeSize(); - - return java.lang.Math.pow ( - 0.5 * dblGamma * dblX + - java.lang.Math.pow (1. * dblK + 1. , (3. * dblK + 4.) / (2. * dblK)) / - java.lang.Math.pow (3. * dblK + 1. , (1. * dblK + 2.) / (2. * dblK)) * - java.lang.Math.pow (dblEta , (0. * dblK + 1.) / (1. * dblK)) * - (dblX * dblSigma * dblI), - dblK / (dblK + 1.) - ); - } - - /** - * Generate the Constant/Exponent Dependencies on the Market Parameters for the Optimal Execution Horizon - * / Information Ratio - * - * @return The Optimal Execution Horizon/Information Ratio Dependency - */ - - public org.drip.execution.principal.HorizonInformationRatioDependence optimalMeasures() - { - org.drip.execution.impact.TransactionFunctionPower tfpTemporaryExpectation = - (org.drip.execution.impact.TransactionFunctionPower) - _lpep.temporaryExpectation().epochImpactFunction(); - - double dblK = tfpTemporaryExpectation.exponent(); - - try { - return new org.drip.execution.principal.HorizonInformationRatioDependence ( - new org.drip.execution.principal.OptimalMeasureDependence ( - java.lang.Math.pow ((dblK + 1.) * (dblK + 1.) / (3. * dblK + 1.), 1. / dblK), - 1. / dblK, - 1., - 0., - -1. / dblK - ), - new org.drip.execution.principal.OptimalMeasureDependence ( - java.lang.Math.pow (3. * dblK + 1., (1. * dblK + 2.) / (2. * dblK)) / - java.lang.Math.pow (1. * dblK + 1., (3. * dblK + 4.) / (2. * dblK)), - -1. / dblK, - -1., - -1., - (dblK + 1.) / dblK - ) - ); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/principal/GrossProfitEstimator.java b/org/drip/execution/principal/GrossProfitEstimator.java deleted file mode 100644 index fe4ba43..0000000 --- a/org/drip/execution/principal/GrossProfitEstimator.java +++ /dev/null @@ -1,183 +0,0 @@ - -package org.drip.execution.principal; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * GrossProfitEstimator generates the Gross Profit Distribution and the Information Ratio for a given Level - * of Principal Discount. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 16 (6) 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class GrossProfitEstimator { - private org.drip.execution.optimum.EfficientTradingTrajectory _ett = null; - - /** - * GrossProfitEstimator Constructor - * - * @param ett The efficient Trading Trajectory Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public GrossProfitEstimator ( - final org.drip.execution.optimum.EfficientTradingTrajectory ett) - throws java.lang.Exception - { - if (null == (_ett = ett)) - throw new java.lang.Exception ("GrossProfitEstimator Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Optimal Efficient Trajectory - * - * @return The Optimal "Efficient" Trajectory - */ - - public org.drip.execution.optimum.EfficientTradingTrajectory efficientTrajectory() - { - return _ett; - } - - /** - * Generate R^1 Univariate Normal Gross Profit Distribution from the specified Principal Discount - * - * @param dblPrincipalDiscount The Principal Discount - * - * @return The R^1 Univariate Normal Gross Profit Distribution from the specified Principal Discount - */ - - public org.drip.measure.gaussian.R1UnivariateNormal principalMeasure ( - final double dblPrincipalDiscount) - { - try { - return new org.drip.measure.gaussian.R1UnivariateNormal (dblPrincipalDiscount * _ett.tradeSize() - - _ett.transactionCostExpectation(), java.lang.Math.sqrt (_ett.transactionCostVariance())); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Break-even Principal Discount - * - * @return The Break-even Principal Discount - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double breakevenPrincipalDiscount() - throws java.lang.Exception - { - return _ett.transactionCostExpectation() / _ett.tradeSize(); - } - - /** - * Generate R^1 Univariate Normal Gross Profit Distribution from the specified Principal Discount - * - * @param dblPrincipalDiscount The Principal Discount - * - * @return The R^1 Univariate Normal Gross Profit Distribution from the specified Principal Discount - */ - - public org.drip.measure.gaussian.R1UnivariateNormal horizonPrincipalMeasure ( - final double dblPrincipalDiscount) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPrincipalDiscount)) return null; - - double dblInverseHorizon = 1. / _ett.executionTime(); - - try { - return new org.drip.measure.gaussian.R1UnivariateNormal (dblPrincipalDiscount * _ett.tradeSize() - - _ett.transactionCostExpectation() * dblInverseHorizon, java.lang.Math.sqrt - (_ett.transactionCostVariance() * dblInverseHorizon)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Information Ratio given the Principal Discount - * - * @param dblPrincipalDiscount The Principal Discount - * - * @return The Information Ratio - * - * @throws java.lang.Exception Thrown if the Inputs cannot be calculated - */ - - public double informationRatio ( - final double dblPrincipalDiscount) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPrincipalDiscount)) - throw new java.lang.Exception ("GrossProfitEstimator::informationRatio => Invalid Inputs"); - - double dblInverseHorizon = 1. / _ett.executionTime(); - - return dblInverseHorizon * (dblPrincipalDiscount * _ett.tradeSize() - - _ett.transactionCostExpectation()) / java.lang.Math.sqrt (dblInverseHorizon * - _ett.transactionCostVariance()); - } -} diff --git a/org/drip/execution/principal/GrossProfitExpectation.java b/org/drip/execution/principal/GrossProfitExpectation.java deleted file mode 100644 index 1d02f36..0000000 --- a/org/drip/execution/principal/GrossProfitExpectation.java +++ /dev/null @@ -1,125 +0,0 @@ - -package org.drip.execution.principal; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * GrossProfitExpectation implements the R^1 To R^1 Univariate that computes the Explicit Profit of a - * Principal Execution given the Optimal Trajectory. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class GrossProfitExpectation extends org.drip.function.definition.R1ToR1 { - private double _dblNumExecutedUnit = java.lang.Double.NaN; - private double _dblTransactionCost = java.lang.Double.NaN; - - /** - * GrossProfitExpectation Constructor - * - * @param dblNumExecutedUnit The Number of Executed Units - * @param dblTransactionCost The Execution Transaction Cost - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public GrossProfitExpectation ( - final double dblNumExecutedUnit, - final double dblTransactionCost) - throws java.lang.Exception - { - super (null); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblNumExecutedUnit = dblNumExecutedUnit) || - !org.drip.quant.common.NumberUtil.IsValid (_dblTransactionCost = dblTransactionCost)) - throw new java.lang.Exception ("GrossProfitExpectation Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Execution Transaction Cost - * - * @return The Execution Transaction Cost - */ - - public double transactionCost() - { - return _dblTransactionCost; - } - - /** - * Retrieve the Number of Executed Units - * - * @return The Number of Executed Units - */ - - public double numExecutedUnit() - { - return _dblNumExecutedUnit; - } - - @Override public double evaluate ( - final double dblUnitDiscount) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblUnitDiscount)) - throw new java.lang.Exception ("GrossProfitExpectation::evaluate => Invalid Inputs"); - - return dblUnitDiscount * _dblNumExecutedUnit - _dblTransactionCost; - } -} diff --git a/org/drip/execution/principal/HorizonInformationRatioDependence.java b/org/drip/execution/principal/HorizonInformationRatioDependence.java deleted file mode 100644 index 978b4e5..0000000 --- a/org/drip/execution/principal/HorizonInformationRatioDependence.java +++ /dev/null @@ -1,112 +0,0 @@ - -package org.drip.execution.principal; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * HorizonInformationRatioDependence holds the Dependence Constants/Exponents for the Optimal Information - * Ratio and the corresponding Horizon. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 16 (6) 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class HorizonInformationRatioDependence { - private org.drip.execution.principal.OptimalMeasureDependence _omdHorizon = null; - private org.drip.execution.principal.OptimalMeasureDependence _omdInformationRatio = null; - - /** - * HorizonInformationRatioDependence Constructor - * - * @param omdHorizon The Horizon Optimal Measure Dependence Instance - * @param omdInformationRatio The Information Ratio Optimal Measure Dependence Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public HorizonInformationRatioDependence ( - final org.drip.execution.principal.OptimalMeasureDependence omdHorizon, - final org.drip.execution.principal.OptimalMeasureDependence omdInformationRatio) - throws java.lang.Exception - { - if (null == (_omdHorizon = omdHorizon) || null == (_omdInformationRatio = omdInformationRatio)) - throw new java.lang.Exception ("HorizonInformationRatioDependence Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Optimal Measure Dependence for the Time Horizon - * - * @return Optimal Measure Dependence for Time Horizon - */ - - public org.drip.execution.principal.OptimalMeasureDependence omdHorizon() - { - return _omdHorizon; - } - - /** - * Retrieve the Optimal Measure Dependence for the Time Horizon - * - * @return Optimal Measure Dependence for Time Horizon - */ - - public org.drip.execution.principal.OptimalMeasureDependence omdInformationRatio() - { - return _omdInformationRatio; - } -} diff --git a/org/drip/execution/principal/OptimalMeasureDependence.java b/org/drip/execution/principal/OptimalMeasureDependence.java deleted file mode 100644 index d99d47a..0000000 --- a/org/drip/execution/principal/OptimalMeasureDependence.java +++ /dev/null @@ -1,160 +0,0 @@ - -package org.drip.execution.principal; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OptimalMeasureDependence contains the Dependence Exponents on Liquidity, Trade Size, and Permanent Impact - * Adjusted Principal Discount for the Optimal Principal Horizon and the Optional Information Ratio. It also - * holds the Constant . The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 16 (6) 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class OptimalMeasureDependence { - private double _dblConstant = java.lang.Double.NaN; - private double _dblBlockSizeExponent = java.lang.Double.NaN; - private double _dblLiquidityExponent = java.lang.Double.NaN; - private double _dblVolatilityExponent = java.lang.Double.NaN; - private double _dblAdjustedPrincipalDiscountExponent = java.lang.Double.NaN; - - /** - * OptimalMeasureDependence Constructor - * - * @param dblConstant The Optimal Measure Constant - * @param dblLiquidityExponent The Optimal Measure Liquidity Exponent - * @param dblBlockSizeExponent The Optimal Measure Block Size Exponent - * @param dblVolatilityExponent The Optimal Measure Volatility Exponent - * @param dblAdjustedPrincipalDiscountExponent The Optimal Measure Adjusted Principal Discount Exponent - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public OptimalMeasureDependence ( - final double dblConstant, - final double dblLiquidityExponent, - final double dblBlockSizeExponent, - final double dblVolatilityExponent, - final double dblAdjustedPrincipalDiscountExponent) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblConstant = dblConstant) || - !org.drip.quant.common.NumberUtil.IsValid (_dblLiquidityExponent = dblLiquidityExponent) || - !org.drip.quant.common.NumberUtil.IsValid (_dblBlockSizeExponent = dblBlockSizeExponent) || - !org.drip.quant.common.NumberUtil.IsValid (_dblVolatilityExponent = - dblVolatilityExponent) || !org.drip.quant.common.NumberUtil.IsValid - (_dblAdjustedPrincipalDiscountExponent = dblAdjustedPrincipalDiscountExponent)) - throw new java.lang.Exception ("OptimalMeasureDependence Constructor => Invalid Inputs!"); - } - - /** - * Retrieve the Constant - * - * @return The Constant - */ - - public double constant() - { - return _dblConstant; - } - - /** - * Retrieve the Block Size Dependence Exponent - * - * @return The Block Size Dependence Exponent - */ - - public double blockSizeExponent() - { - return _dblBlockSizeExponent; - } - - /** - * Retrieve the Liquidity Dependence Exponent - * - * @return The Liquidity Dependence Exponent - */ - - public double liquidityExponent() - { - return _dblLiquidityExponent; - } - - /** - * Retrieve the Volatility Dependence Exponent - * - * @return The Volatility Dependence Exponent - */ - - public double volatilityExponent() - { - return _dblVolatilityExponent; - } - - /** - * Retrieve the Adjusted Principal Discount Dependence Exponent - * - * @return The Adjusted Principal Discount Dependence Exponent - */ - - public double adjustedPrincipalDiscountExponent() - { - return _dblAdjustedPrincipalDiscountExponent; - } -} diff --git a/org/drip/execution/profiletime/BackgroundParticipationRate.java b/org/drip/execution/profiletime/BackgroundParticipationRate.java deleted file mode 100644 index 95f3a5a..0000000 --- a/org/drip/execution/profiletime/BackgroundParticipationRate.java +++ /dev/null @@ -1,92 +0,0 @@ - -package org.drip.execution.profiletime; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * BackgroundParticipationRate exposes the Background Profile Adjusted Version of the Participation Rate - * Transaction Function as described in the "Trading Time" Model. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public interface BackgroundParticipationRate { - - /** - * Compute the Market Impact Function from the Volatility Function - * - * @param dblTime The Time Snapshot - * - * @return The Market Impact Function - */ - - public abstract org.drip.execution.impact.TransactionFunction impactFunction ( - final double dblTime); - - /** - * Compute the Epoch Market Impact Function - * - * @return The Epoch Market Impact Function - */ - - public abstract org.drip.execution.impact.TransactionFunction epochImpactFunction(); -} diff --git a/org/drip/execution/profiletime/BackgroundParticipationRateLinear.java b/org/drip/execution/profiletime/BackgroundParticipationRateLinear.java deleted file mode 100644 index 2c73f3b..0000000 --- a/org/drip/execution/profiletime/BackgroundParticipationRateLinear.java +++ /dev/null @@ -1,93 +0,0 @@ - -package org.drip.execution.profiletime; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * BackgroundParticipationRateLinear exposes the Background Profile Adjusted Version of the Linear - * Participation Rate Transaction Function as described in the "Trading Time" Model. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public interface BackgroundParticipationRateLinear extends - org.drip.execution.profiletime.BackgroundParticipationRate { - - /** - * Compute the Liquidity Market Impact Function from the Volatility Function - * - * @param dblTime The Time Snapshot - * - * @return The Liquidity Market Impact Function - */ - - public abstract org.drip.execution.impact.ParticipationRateLinear liquidityFunction ( - final double dblTime); - - /** - * Compute the Epoch Liquidity Market Impact Function - * - * @return The Epoch Liquidity Market Impact Function - */ - - public abstract org.drip.execution.impact.ParticipationRateLinear epochLiquidityFunction(); -} diff --git a/org/drip/execution/profiletime/UniformParticipationRate.java b/org/drip/execution/profiletime/UniformParticipationRate.java deleted file mode 100644 index 58c4b9e..0000000 --- a/org/drip/execution/profiletime/UniformParticipationRate.java +++ /dev/null @@ -1,101 +0,0 @@ - -package org.drip.execution.profiletime; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * UniformParticipationRateLinear exposes the Uniform Background Profile Adjusted Version of the Linear - * Participation Rate Transaction Function as described in the "Trading Time" Model. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class UniformParticipationRate implements org.drip.execution.profiletime.BackgroundParticipationRate { - private org.drip.execution.impact.TransactionFunction _tf = null; - - /** - * UniformParticipationRate Constructor - * - * @param tf The Participation Rate Transaction Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public UniformParticipationRate ( - final org.drip.execution.impact.TransactionFunction tf) - throws java.lang.Exception - { - if (null == (_tf = tf)) - throw new java.lang.Exception ("UniformParticipationRate Constructor => Invalid Inputs"); - } - - @Override public org.drip.execution.impact.TransactionFunction impactFunction ( - final double dblTime) - { - return _tf; - } - - @Override public org.drip.execution.impact.TransactionFunction epochImpactFunction() - { - return _tf; - } -} diff --git a/org/drip/execution/profiletime/UniformParticipationRateLinear.java b/org/drip/execution/profiletime/UniformParticipationRateLinear.java deleted file mode 100644 index 2a557ba..0000000 --- a/org/drip/execution/profiletime/UniformParticipationRateLinear.java +++ /dev/null @@ -1,113 +0,0 @@ - -package org.drip.execution.profiletime; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * UniformParticipationRateLinear exposes the Uniform Background Profile Adjusted Version of the Linear - * Participation Rate Transaction Function as described in the "Trading Time" Model. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class UniformParticipationRateLinear implements - org.drip.execution.profiletime.BackgroundParticipationRateLinear { - private org.drip.execution.impact.ParticipationRateLinear _prl = null; - - /** - * UniformParticipationRateLinear Constructor - * - * @param prl The Linear Participation Rate Transaction Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public UniformParticipationRateLinear ( - final org.drip.execution.impact.ParticipationRateLinear prl) - throws java.lang.Exception - { - if (null == (_prl = prl)) - throw new java.lang.Exception ("UniformParticipationRateLinear Constructor => Invalid Inputs"); - } - - @Override public org.drip.execution.impact.TransactionFunction impactFunction ( - final double dblTime) - { - return _prl; - } - - @Override public org.drip.execution.impact.TransactionFunction epochImpactFunction() - { - return _prl; - } - - @Override public org.drip.execution.impact.ParticipationRateLinear liquidityFunction ( - final double dblTime) - { - return _prl; - } - - @Override public org.drip.execution.impact.ParticipationRateLinear epochLiquidityFunction() - { - return _prl; - } -} diff --git a/org/drip/execution/risk/MeanVarianceObjectiveUtility.java b/org/drip/execution/risk/MeanVarianceObjectiveUtility.java deleted file mode 100644 index 150d871..0000000 --- a/org/drip/execution/risk/MeanVarianceObjectiveUtility.java +++ /dev/null @@ -1,139 +0,0 @@ - -package org.drip.execution.risk; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * MeanVarianceObjectiveUtility implements the Mean-Variance Objective Utility Function that needs to be - * optimized to extract the Optimal Execution Trajectory. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class MeanVarianceObjectiveUtility implements org.drip.execution.risk.ObjectiveUtility { - private double _dblRiskAversion = java.lang.Double.NaN; - - /** - * MeanVarianceObjectiveUtility Constructor - * - * @param dblRiskAversion The Risk Aversion Parameter - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public MeanVarianceObjectiveUtility ( - final double dblRiskAversion) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblRiskAversion = dblRiskAversion) || 0. > - _dblRiskAversion) - throw new java.lang.Exception ("MeanVarianceObjectiveUtility Constructor => Invalid Inputs!"); - } - - /** - * Retrieve the Risk Aversion Parameter - * - * @return The Risk Aversion Parameter - */ - - public double riskAversion() - { - return _dblRiskAversion; - } - - @Override public org.drip.execution.sensitivity.ControlNodesGreek sensitivity ( - final org.drip.execution.sensitivity.TrajectoryControlNodesGreek tcngExpectation, - final org.drip.execution.sensitivity.TrajectoryControlNodesGreek tcngVariance) - { - if (null == tcngExpectation || null == tcngVariance) return null; - - double[] adblVarianceJacobian = tcngVariance.innerJacobian(); - - if (null == adblVarianceJacobian) return null; - - double[][] aadblVarianceHessian = tcngVariance.innerHessian(); - - double[] adblExpectationJacobian = tcngExpectation.innerJacobian(); - - double[][] aadblExpectationHessian = tcngExpectation.innerHessian(); - - int iNumControlNode = adblVarianceJacobian.length; - double[] adblObjectiveJacobian = new double[iNumControlNode]; - double[][] aadblObjectiveHessian = new double[iNumControlNode][iNumControlNode]; - - for (int i = 0; i < iNumControlNode; ++i) { - adblObjectiveJacobian[i] = adblExpectationJacobian[i] + _dblRiskAversion * - adblVarianceJacobian[i]; - - for (int j = 0; j < iNumControlNode; ++j) - aadblObjectiveHessian[i][j] = aadblExpectationHessian[i][j] + _dblRiskAversion * - aadblVarianceHessian[i][j]; - } - - try { - return new org.drip.execution.sensitivity.ControlNodesGreek (tcngExpectation.value() + - _dblRiskAversion * tcngVariance.value(), adblObjectiveJacobian, aadblObjectiveHessian); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - return null; - } -} diff --git a/org/drip/execution/risk/ObjectiveUtility.java b/org/drip/execution/risk/ObjectiveUtility.java deleted file mode 100644 index 7767e5a..0000000 --- a/org/drip/execution/risk/ObjectiveUtility.java +++ /dev/null @@ -1,86 +0,0 @@ - -package org.drip.execution.risk; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ObjectiveUtility exposes the Objective Utility Function that needs to be optimized to extract the - * Optimal Execution Trajectory. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public interface ObjectiveUtility { - - /** - * Generate the Objective Function Sensitivity given the Expectation and the Variance Control Node - * Sensitivity - * - * @param tcngExpectation The Control Node Trajectory Expectation Sensitivity - * @param tcngVariance The Control Node Trajectory Variance Sensitivity - * - * @return The Control Node Trajectory Objective Function Sensitivity Sensitivity - */ - - public abstract org.drip.execution.sensitivity.ControlNodesGreek sensitivity ( - final org.drip.execution.sensitivity.TrajectoryControlNodesGreek tcngExpectation, - final org.drip.execution.sensitivity.TrajectoryControlNodesGreek tcngVariance); -} diff --git a/org/drip/execution/risk/PowerVarianceObjectiveUtility.java b/org/drip/execution/risk/PowerVarianceObjectiveUtility.java deleted file mode 100644 index e098d6c..0000000 --- a/org/drip/execution/risk/PowerVarianceObjectiveUtility.java +++ /dev/null @@ -1,189 +0,0 @@ - -package org.drip.execution.risk; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PowerVarianceObjectiveUtility implements the Mean-Power-Variance Objective Utility Function that needs to - * be optimized to extract the Optimal Execution Trajectory. The Exact Objective Function is of the Form: - * - * U[x] = E[x] + lambda * (V[x] ^p) - * - * where p is greater than 0. p = 1 is the Regular Mean-Variance, and p = 0.5 is VaR Minimization (L-VaR). - * The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk, 3 (2), - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Non-linear Impact Functions and Trading Enhanced Risk, - * Applied Mathematical Finance, 10, 1-18. - * - * - Artzner, P., F. Delbaen, J. M. Eber, and D. Heath (1999): Coherent Measures of Risk, Mathematical - * Finance, 9, 203-228. - * - * - Basak, S., and A. Shapiro (2001): Value-at-Risk Based Risk Management: Optimal Policies and Asset - * Prices, Review of Financial Studies, 14, 371-405. - * - * @author Lakshmi Krishnamurthy - */ - -public class PowerVarianceObjectiveUtility implements org.drip.execution.risk.ObjectiveUtility { - private double _dblRiskAversion = java.lang.Double.NaN; - private double _dblVarianceExponent = java.lang.Double.NaN; - - /** - * Generate the Liquidity VaR Version of the Power Variance Utility Function - * - * @param dblRiskAversion The Risk Aversion Parameter - * - * @return The Liquidity VaR Version of the Power Variance Utility Function - */ - - public static final PowerVarianceObjectiveUtility LiquidityVaR ( - final double dblRiskAversion) - { - try { - return new PowerVarianceObjectiveUtility (0.5, dblRiskAversion); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * PowerVarianceObjectiveUtility Constructor - * - * @param dblVarianceExponent The Variance Exponent - * @param dblRiskAversion The Risk Aversion Parameter - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public PowerVarianceObjectiveUtility ( - final double dblVarianceExponent, - final double dblRiskAversion) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblVarianceExponent = dblVarianceExponent) || 0. > - _dblVarianceExponent || !org.drip.quant.common.NumberUtil.IsValid (_dblRiskAversion = - dblRiskAversion) || 0. > _dblRiskAversion) - throw new java.lang.Exception ("PowerVarianceObjectiveUtility Constructor => Invalid Inputs!"); - } - - /** - * Retrieve the Risk Aversion Parameter - * - * @return The Risk Aversion Parameter - */ - - public double riskAversion() - { - return _dblRiskAversion; - } - - /** - * Retrieve the Variance Exponent - * - * @return The Variance Exponent - */ - - public double varianceExponent() - { - return _dblVarianceExponent; - } - - @Override public org.drip.execution.sensitivity.ControlNodesGreek sensitivity ( - final org.drip.execution.sensitivity.TrajectoryControlNodesGreek tcngExpectation, - final org.drip.execution.sensitivity.TrajectoryControlNodesGreek tcngVariance) - { - if (null == tcngExpectation || null == tcngVariance) return null; - - double[] adblVarianceJacobian = tcngVariance.innerJacobian(); - - if (null == adblVarianceJacobian) return null; - - double dblVarianceValue = tcngVariance.value(); - - double[][] aadblVarianceHessian = tcngVariance.innerHessian(); - - double[] adblExpectationJacobian = tcngExpectation.innerJacobian(); - - double[][] aadblExpectationHessian = tcngExpectation.innerHessian(); - - int iNumControlNode = adblVarianceJacobian.length; - double[] adblObjectiveJacobian = new double[iNumControlNode]; - double[][] aadblObjectiveHessian = new double[iNumControlNode][iNumControlNode]; - - double dblJacobianMultiplier = _dblVarianceExponent * _dblRiskAversion * java.lang.Math.pow - (dblVarianceValue, _dblVarianceExponent - 1.); - - double dblJacobianProductMultiplier = _dblVarianceExponent * (_dblVarianceExponent - 1.) * - _dblRiskAversion * java.lang.Math.pow (dblVarianceValue, _dblVarianceExponent - 2.); - - for (int i = 0; i < iNumControlNode; ++i) { - adblObjectiveJacobian[i] = adblExpectationJacobian[i] + dblJacobianMultiplier * - adblVarianceJacobian[i]; - - for (int j = 0; j < iNumControlNode; ++j) - aadblObjectiveHessian[i][j] = aadblExpectationHessian[i][j] + dblJacobianProductMultiplier * - adblVarianceJacobian[i] * adblVarianceJacobian[j] + dblJacobianMultiplier * - aadblVarianceHessian[i][j]; - } - - try { - return new org.drip.execution.sensitivity.ControlNodesGreek (tcngExpectation.value() + - _dblRiskAversion * java.lang.Math.pow (dblVarianceValue, _dblVarianceExponent), - adblObjectiveJacobian, aadblObjectiveHessian); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - return null; - } -} diff --git a/org/drip/execution/sensitivity/ControlNodesGreek.java b/org/drip/execution/sensitivity/ControlNodesGreek.java deleted file mode 100644 index aece589..0000000 --- a/org/drip/execution/sensitivity/ControlNodesGreek.java +++ /dev/null @@ -1,141 +0,0 @@ - -package org.drip.execution.sensitivity; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ControlNodesGreek holds the Point Value, the Jacobian, and the Hessian for a Trajectory/Slice to the - * Holdings Control Nodes. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class ControlNodesGreek { - private double[] _adblJacobian = null; - private double[][] _aadblHessian = null; - private double _dblValue = java.lang.Double.NaN; - - /** - * ControlNodesGreek Constructor - * - * @param dblValue The Objective Function Penalty Value - * @param adblJacobian The Objective Function Penalty Jacobian - * @param aadblHessian The Objective Function Penalty Hessian - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ControlNodesGreek ( - final double dblValue, - final double[] adblJacobian, - final double[][] aadblHessian) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblValue = dblValue) || null == (_adblJacobian = - adblJacobian) || null == (_aadblHessian = aadblHessian)) - throw new java.lang.Exception ("ControlNodesGreek Constructor => Invalid Inputs"); - - int iNumInterval = _adblJacobian.length; - - if (0 == iNumInterval || iNumInterval != _aadblHessian.length) - throw new java.lang.Exception ("ControlNodesGreek Constructor => Invalid Inputs"); - - for (int i = 0; i < iNumInterval; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (_adblJacobian[i]) || null == _aadblHessian[i] || - iNumInterval != _aadblHessian[i].length || !org.drip.quant.common.NumberUtil.IsValid - (_aadblHessian[i])) - throw new java.lang.Exception ("ControlNodesGreek Constructor => Invalid Inputs"); - } - } - - /** - * Retrieve the Objective Function Penalty Value - * - * @return The Objective Function Penalty Value - */ - - public double value() - { - return _dblValue; - } - - /** - * Retrieve the Objective Function Penalty Jacobian - * - * @return The Objective Function Penalty Jacobian - */ - - public double[] jacobian() - { - return _adblJacobian; - } - - /** - * Retrieve the Objective Function Penalty Hessian - * - * @return The Objective Function Penalty Hessian - */ - - public double[][] hessian() - { - return _aadblHessian; - } -} diff --git a/org/drip/execution/sensitivity/ControlNodesGreekGenerator.java b/org/drip/execution/sensitivity/ControlNodesGreekGenerator.java deleted file mode 100644 index 8565c8a..0000000 --- a/org/drip/execution/sensitivity/ControlNodesGreekGenerator.java +++ /dev/null @@ -1,161 +0,0 @@ - -package org.drip.execution.sensitivity; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ControlNodesGreekGenerator exposes the Functionality to compute the Base Value, the Jacobian, and the - * Hessian Sensitivities of the Mean and the Variance Contributions to the Permanent Impact, Temporary - * Impact, and the Market Core Components. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public interface ControlNodesGreekGenerator { - - /** - * Generate the Permanent Impact Expectation Contribution - * - * @param apep The Arithmetic Price Walk Evolution Parameters - * - * @return The Permanent Impact Expectation Contribution - */ - - public abstract org.drip.execution.sensitivity.ControlNodesGreek permanentImpactExpectation ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep); - - /** - * Generate the Permanent Impact Variance Contribution - * - * @param apep The Arithmetic Price Walk Evolution Parameters - * - * @return The Permanent Impact Variance Contribution - */ - - public abstract org.drip.execution.sensitivity.ControlNodesGreek permanentImpactVariance ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep); - - /** - * Generate the Temporary Impact Expectation Contribution - * - * @param apep The Arithmetic Price Walk Evolution Parameters - * - * @return The Temporary Impact Expectation Contribution - */ - - public abstract org.drip.execution.sensitivity.ControlNodesGreek temporaryImpactExpectation ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep); - - /** - * Generate the Temporary Impact Variance Contribution - * - * @param apep The Arithmetic Price Walk Evolution Parameters - * - * @return The Temporary Impact Variance Contribution - */ - - public abstract org.drip.execution.sensitivity.ControlNodesGreek temporaryImpactVariance ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep); - - /** - * Generate the Market Dynamics Expectation Contribution - * - * @param apep The Arithmetic Price Walk Evolution Parameters - * - * @return The Market Dynamics Expectation Contribution - */ - - public abstract org.drip.execution.sensitivity.ControlNodesGreek marketDynamicsExpectation ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep); - - /** - * Generate the Market Dynamics Variance Contribution - * - * @param apep The Arithmetic Price Walk Evolution Parameters - * - * @return The Market Dynamics Variance Contribution - */ - - public abstract org.drip.execution.sensitivity.ControlNodesGreek marketDynamicsVariance ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep); - - /** - * Generate the Total Expectation Contribution - * - * @param apep The Arithmetic Price Walk Evolution Parameters - * - * @return The Total Expectation Contribution - */ - - public abstract org.drip.execution.sensitivity.ControlNodesGreek expectationContribution ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep); - - /** - * Generate the Total Variance Contribution - * - * @param apep The Arithmetic Price Walk Evolution Parameters - * - * @return The Total Variance Contribution - */ - - public abstract org.drip.execution.sensitivity.ControlNodesGreek varianceContribution ( - final org.drip.execution.dynamics.ArithmeticPriceEvolutionParameters apep); -} diff --git a/org/drip/execution/sensitivity/TrajectoryControlNodesGreek.java b/org/drip/execution/sensitivity/TrajectoryControlNodesGreek.java deleted file mode 100644 index a2c4df5..0000000 --- a/org/drip/execution/sensitivity/TrajectoryControlNodesGreek.java +++ /dev/null @@ -1,152 +0,0 @@ - -package org.drip.execution.sensitivity; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TrajectoryControlNodesGreek holds the Point Value, the Jacobian, and the Hessian for a Trajectory to the - * Holdings Control Nodes. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class TrajectoryControlNodesGreek extends org.drip.execution.sensitivity.ControlNodesGreek { - private java.util.List _lsCNGSlice = null; - - /** - * TrajectoryControlNodesGreek Constructor - * - * @param dblValue The Objective Function Penalty Value - * @param adblJacobian The Objective Function Penalty Jacobian - * @param aadblHessian The Objective Function Penalty Hessian - * @param lsCNGSlice The List of the Slice Control Nodes Greek - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public TrajectoryControlNodesGreek ( - final double dblValue, - final double[] adblJacobian, - final double[][] aadblHessian, - final java.util.List lsCNGSlice) - throws java.lang.Exception - { - super (dblValue, adblJacobian, aadblHessian); - - if (null == (_lsCNGSlice = lsCNGSlice) || 0 == _lsCNGSlice.size()) - throw new java.lang.Exception ("TrajectoryControlNodesGreek Constructor => Invalid Inputs"); - } - - /** - * Retrieve the List of the Slice Control Nodes Greek - * - * @return The List of the Slice Control Nodes Greek - */ - - public java.util.List sliceGreeks() - { - return _lsCNGSlice; - } - - /** - * Retrieve the Inner Jacobian Array - * - * @return The Inner Jacobian Array - */ - - public double[] innerJacobian() - { - double[] adblJacobian = jacobian(); - - int iNumInnerNode = adblJacobian.length - 2; - double[] adblInnerJacobian = 0 >= iNumInnerNode ? null : new double[iNumInnerNode]; - - if (null == adblInnerJacobian) return null; - - for (int i = 0; i < iNumInnerNode; ++i) - adblInnerJacobian[i] = adblJacobian[i + 1]; - - return adblInnerJacobian; - } - - /** - * Retrieve the Inner Hessian Matrix - * - * @return The Inner Hessian Matrix - */ - - public double[][] innerHessian() - { - double[][] aadblHessian = hessian(); - - int iNumInnerNode = aadblHessian.length - 2; - double[][] aadblInnerHessian = 0 >= iNumInnerNode ? null : new double[iNumInnerNode][iNumInnerNode]; - - if (null == aadblInnerHessian) return null; - - for (int i = 0; i < iNumInnerNode; ++i) { - for (int j = 0; j < iNumInnerNode; ++j) - aadblInnerHessian[i][j] = aadblHessian[i + 1][j + 1]; - } - - return aadblInnerHessian; - } -} diff --git a/org/drip/execution/strategy/ContinuousTradingTrajectory.java b/org/drip/execution/strategy/ContinuousTradingTrajectory.java deleted file mode 100644 index d60177b..0000000 --- a/org/drip/execution/strategy/ContinuousTradingTrajectory.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.execution.strategy; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ContinuousTradingTrajectory holds the Continuous Trajectory of a Trading Block that is to be executed over - * the Specified Horizon. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class ContinuousTradingTrajectory implements org.drip.execution.strategy.TradingTrajectory { - private double _dblExecutionTime = java.lang.Double.NaN; - private org.drip.function.definition.R1ToR1 _r1ToR1Holdings = null; - private org.drip.function.definition.R1ToR1 _r1ToR1TradeRate = null; - private org.drip.function.definition.R1ToR1 _r1ToR1TransactionCostVariance = null; - private org.drip.function.definition.R1ToR1 _r1ToR1TransactionCostExpectation = null; - - /** - * Construct a Standard Instance of ContinuousTradingTrajectory - * - * @param dblExecutionTime The Execution Time - * @param r1ToR1Holdings The Holdings Function - * @param r1ToR1TransactionCostExpectation The Transaction Cost Expectation Function - * @param r1ToR1TransactionCostVariance The Transaction Cost Variance Function - * - * @return Standard Instance of ContinuousTradingTrajectory - */ - - public static final ContinuousTradingTrajectory Standard ( - final double dblExecutionTime, - final org.drip.function.definition.R1ToR1 r1ToR1Holdings, - final org.drip.function.definition.R1ToR1 r1ToR1TransactionCostExpectation, - final org.drip.function.definition.R1ToR1 r1ToR1TransactionCostVariance) - { - if (null == r1ToR1Holdings) return null; - - org.drip.function.definition.R1ToR1 r1ToR1TradeRate = new org.drip.function.definition.R1ToR1 (null) - { - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - return r1ToR1Holdings.derivative (dblVariate, 1); - } - }; - - try { - return new ContinuousTradingTrajectory (dblExecutionTime, r1ToR1Holdings, r1ToR1TradeRate, - r1ToR1TransactionCostExpectation, r1ToR1TransactionCostVariance); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * ContinuousTradingTrajectory Constructor - * - * @param dblExecutionTime The Execution Time - * @param r1ToR1Holdings The Holdings Function - * @param r1ToR1TradeRate The Trade Rate Function - * @param r1ToR1TransactionCostExpectation The Transaction Cost Expectation Function - * @param r1ToR1TransactionCostVariance The Transaction Cost Variance Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ContinuousTradingTrajectory ( - final double dblExecutionTime, - final org.drip.function.definition.R1ToR1 r1ToR1Holdings, - final org.drip.function.definition.R1ToR1 r1ToR1TradeRate, - final org.drip.function.definition.R1ToR1 r1ToR1TransactionCostExpectation, - final org.drip.function.definition.R1ToR1 r1ToR1TransactionCostVariance) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblExecutionTime = dblExecutionTime) || 0. >= - _dblExecutionTime || null == (_r1ToR1Holdings = r1ToR1Holdings) || null == (_r1ToR1TradeRate = - r1ToR1TradeRate) || null == (_r1ToR1TransactionCostExpectation = - r1ToR1TransactionCostExpectation) || null == (_r1ToR1TransactionCostVariance = - r1ToR1TransactionCostVariance)) - throw new java.lang.Exception ("ContinuousTradingTrajectory Constructor => Invalid Inputs"); - } - - @Override public double tradeSize() - { - try { - return _r1ToR1Holdings.evaluate (0.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return 0.; - } - - @Override public double executedBlockSize() - { - try { - return _r1ToR1Holdings.evaluate (0.) - _r1ToR1Holdings.evaluate (_dblExecutionTime); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return 0.; - } - - @Override public double executionTime() - { - return _dblExecutionTime; - } - - @Override public double instantTradeRate() - { - return executedBlockSize() / executionTime(); - } - - /** - * Retrieve the Holdings Function - * - * @return The Holdings Function - */ - - public org.drip.function.definition.R1ToR1 holdings() - { - return _r1ToR1Holdings; - } - - /** - * Retrieve the Trade Rate Function - * - * @return The Trade Rate Function - */ - - public org.drip.function.definition.R1ToR1 tradeRate() - { - return _r1ToR1TradeRate; - } - - /** - * Retrieve the Transaction Cost Expectation Function - * - * @return The Transaction Cost Expectation Function - */ - - public org.drip.function.definition.R1ToR1 transactionCostExpectationFunction() - { - return _r1ToR1TransactionCostExpectation; - } - - /** - * Retrieve the Transaction Cost Variance Function - * - * @return The Transaction Cost Variance Function - */ - - public org.drip.function.definition.R1ToR1 transactionCostVarianceFunction() - { - return _r1ToR1TransactionCostVariance; - } -} diff --git a/org/drip/execution/strategy/DiscreteTradingTrajectory.java b/org/drip/execution/strategy/DiscreteTradingTrajectory.java deleted file mode 100644 index 39bfe5e..0000000 --- a/org/drip/execution/strategy/DiscreteTradingTrajectory.java +++ /dev/null @@ -1,257 +0,0 @@ - -package org.drip.execution.strategy; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DiscreteTradingTrajectory holds the Trajectory of a Trading Block that is to be executed over a Discrete - * Time Set. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class DiscreteTradingTrajectory implements org.drip.execution.strategy.TradingTrajectory { - private double[] _adblHoldings = null; - private double[] _adblTradeList = null; - private double[] _adblExecutionTimeNode = null; - - /** - * Construct a Standard DiscreteTradingTrajectory Instance - * - * @param adblExecutionTimeNode Array containing the Trajectory Time Nodes - * @param adblHoldings Array containing the Holdings - * - * @return The DiscreteTradingTrajectory Instance - */ - - public static DiscreteTradingTrajectory Standard ( - final double[] adblExecutionTimeNode, - final double[] adblHoldings) - { - if (null == adblHoldings) return null; - - int iNumExecutionTime = adblHoldings.length; - double[] adblTradeList = 1 >= iNumExecutionTime ? null : new double[iNumExecutionTime - 1]; - - if (1 >= iNumExecutionTime) return null; - - for (int i = 0; i < iNumExecutionTime - 1; ++i) - adblTradeList[i] = adblHoldings[i + 1] - adblHoldings[i]; - - try { - return new DiscreteTradingTrajectory (adblExecutionTimeNode, adblHoldings, adblTradeList); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Linear DiscreteTradingTrajectory Instance - * - * @param adblExecutionTimeNode Array of the Execution Time Nodes - * @param dblStartHoldings Trajectory Start Holdings - * @param dblFinishHoldings Trajectory Finish Holdings - * - * @return The Linear TradingTrajectory Instance - */ - - public static final DiscreteTradingTrajectory Linear ( - final double[] adblExecutionTimeNode, - final double dblStartHoldings, - final double dblFinishHoldings) - { - if (null == adblExecutionTimeNode || !org.drip.quant.common.NumberUtil.IsValid - (adblExecutionTimeNode) || !org.drip.quant.common.NumberUtil.IsValid (dblStartHoldings) || - !org.drip.quant.common.NumberUtil.IsValid (dblFinishHoldings)) - return null; - - int iNumNode = adblExecutionTimeNode.length; - double[] adblHoldings = 1 >= iNumNode ? null : new double[iNumNode]; - double dblHoldingsChangeRate = (dblFinishHoldings - dblStartHoldings) / - (adblExecutionTimeNode[iNumNode - 1] - adblExecutionTimeNode[0]); - - if (1 >= iNumNode) return null; - - for (int i = 0; i < iNumNode; ++i) - adblHoldings[i] = dblStartHoldings + dblHoldingsChangeRate * i; - - return DiscreteTradingTrajectory.Standard (adblExecutionTimeNode, adblHoldings); - } - - /** - * DiscreteTradingTrajectory Constructor - * - * @param adblExecutionTimeNode Array containing the Trajectory Time Nodes - * @param adblHoldings Array containing the Holdings - * @param adblTradeList Array containing the Trade List - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public DiscreteTradingTrajectory ( - final double[] adblExecutionTimeNode, - final double[] adblHoldings, - final double[] adblTradeList) - throws java.lang.Exception - { - if (null == (_adblHoldings = adblHoldings) || null == (_adblTradeList = adblTradeList) || null == - (_adblExecutionTimeNode = adblExecutionTimeNode)) - throw new java.lang.Exception ("DiscreteTradingTrajectory Constructor => Invalid Inputs!"); - - int iNumExecutionTime = _adblExecutionTimeNode.length; - - if (1 >= iNumExecutionTime || iNumExecutionTime != _adblHoldings.length || iNumExecutionTime - 1 != - _adblTradeList.length || !org.drip.quant.common.NumberUtil.IsValid (_adblHoldings[0]) || - !org.drip.quant.common.NumberUtil.IsValid (_adblExecutionTimeNode[0])) - throw new java.lang.Exception ("DiscreteTradingTrajectory Constructor => Invalid Inputs!"); - - for (int i = 1; i < iNumExecutionTime; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (_adblHoldings[i]) || - !org.drip.quant.common.NumberUtil.IsValid (_adblTradeList[i - 1]) || - !org.drip.quant.common.NumberUtil.IsValid (_adblExecutionTimeNode[i]) || - _adblExecutionTimeNode[i - 1] >= _adblExecutionTimeNode[i]) - throw new java.lang.Exception ("DiscreteTradingTrajectory Constructor => Invalid Inputs!"); - } - } - - @Override public double tradeSize() - { - return _adblHoldings[0]; - } - - @Override public double executedBlockSize() - { - return _adblHoldings[_adblHoldings.length - 1] - _adblHoldings[0]; - } - - @Override public double executionTime() - { - return _adblExecutionTimeNode[_adblExecutionTimeNode.length - 1] - _adblExecutionTimeNode[0]; - } - - @Override public double instantTradeRate() - { - return executedBlockSize() / executionTime(); - } - - /** - * Retrieve the Array containing the Execution Time Nodes Sequence - * - * @return The Array containing the Execution Time Nodes Sequence - */ - - public double[] executionTimeNode() - { - return _adblExecutionTimeNode; - } - - /** - * Retrieve the Array of the Number of Units Outstanding - * - * @return The Array of the Number of Units Outstanding - */ - - public double[] holdings() - { - return _adblHoldings; - } - - /** - * Retrieve the Trade List, i.e., the Array of the Number of Units executed - * - * @return The Trade List, i.e., the Array of the Number of Units executed - */ - - public double[] tradeList() - { - return _adblTradeList; - } - - /** - * Retrieve the Number of Trades - * - * @return The Number of Trades - */ - - public int numberOfTrades() - { - return _adblHoldings.length - 1; - } - - /** - * Retrieve the Array of the Inner Holdings - * - * @return The Array of the Inner Holdings - */ - - public double[] innerHoldings() - { - int iNumInnerHoldings = _adblHoldings.length - 2; - double[] adblInnerHoldings = new double[iNumInnerHoldings]; - - for (int i = 0; i < iNumInnerHoldings; ++i) - adblInnerHoldings[i] = _adblHoldings[i + 1]; - - return adblInnerHoldings; - } -} diff --git a/org/drip/execution/strategy/DiscreteTradingTrajectoryControl.java b/org/drip/execution/strategy/DiscreteTradingTrajectoryControl.java deleted file mode 100644 index f7e3d94..0000000 --- a/org/drip/execution/strategy/DiscreteTradingTrajectoryControl.java +++ /dev/null @@ -1,206 +0,0 @@ - -package org.drip.execution.strategy; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DiscreteTradingTrajectoryControl holds the Time Trajectory Control Settings of a Trading Block that is to - * be executed over a Discrete Time Sequence. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class DiscreteTradingTrajectoryControl { - private double[] _adblExecutionTimeNode = null; - private double _dblStartHoldings = java.lang.Double.NaN; - - /** - * Create a DiscreteTradingTrajectoryControl from Fixed Intervals - * - * @param os The Order Specification - * @param iNumInterval The Number of Fixed Intervals - * - * @return The DiscreteTradingTrajectoryControl from Fixed Intervals - */ - - public static final DiscreteTradingTrajectoryControl FixedInterval ( - final org.drip.execution.strategy.OrderSpecification os, - final int iNumInterval) - { - if (null == os || 0 >= iNumInterval) return null; - - double dblFinishTime = os.maxExecutionTime(); - - double dblTimeInterval = dblFinishTime / iNumInterval; - double[] adblExecutionTimeNode = new double[iNumInterval + 1]; - adblExecutionTimeNode[iNumInterval] = dblFinishTime; - adblExecutionTimeNode[0] = 0.; - - for (int i = 1; i < iNumInterval; ++i) - adblExecutionTimeNode[i] = i * dblTimeInterval; - - try { - return new DiscreteTradingTrajectoryControl (os.size(), adblExecutionTimeNode); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create a Single Interval DiscreteTradingTrajectoryControl Instance from the Order Specification - * - * @param os The Order Specification - * - * @return The Single Interval DiscreteTradingTrajectoryControl Instance from the Order Specification - */ - - public static final DiscreteTradingTrajectoryControl SingleInterval ( - final org.drip.execution.strategy.OrderSpecification os) - { - return FixedInterval (os, 1); - } - - /** - * DiscreteTradingTrajectoryControl Constructor - * - * @param dblStartHoldings Trajectory Start Holdings - * @param adblExecutionTimeNode Array of the Trajectory Time Snapshots - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public DiscreteTradingTrajectoryControl ( - final double dblStartHoldings, - final double[] adblExecutionTimeNode) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblStartHoldings = dblStartHoldings) || null == - (_adblExecutionTimeNode = adblExecutionTimeNode)) - throw new java.lang.Exception - ("DiscreteTradingTrajectoryControl Constructor => Invalid Inputs!"); - - int iNumExecutionTimeNode = _adblExecutionTimeNode.length; - - if (1 >= iNumExecutionTimeNode || !org.drip.quant.common.NumberUtil.IsValid - (_adblExecutionTimeNode[0])) - throw new java.lang.Exception - ("DiscreteTradingTrajectoryControl Constructor => Invalid Inputs!"); - - for (int i = 1; i < iNumExecutionTimeNode; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (_adblExecutionTimeNode[i]) || - _adblExecutionTimeNode[i - 1] >= _adblExecutionTimeNode[i]) - throw new java.lang.Exception - ("DiscreteTradingTrajectoryControl Constructor => Invalid Inputs!"); - } - } - - /** - * Retrieve the Finish Time of the Trading Trajectory - * - * @return The Finish Time of the Trading Trajectory - */ - - public double finishTime() - { - return _adblExecutionTimeNode[_adblExecutionTimeNode.length - 1]; - } - - /** - * Retrieve the Array containing the Execution Time Nodes - * - * @return The Array containing the Execution Time Nodes - */ - - public double[] executionTimeNodes() - { - return _adblExecutionTimeNode; - } - - /** - * Retrieve the Initial Holdings, i.e., the Starting Number of Units to the Executed - * - * @return The Initial Holdings, i.e., the Starting Number of Units to the Executed - */ - - public double startHoldings() - { - return _dblStartHoldings; - } - - /** - * Generate the Order Specification corresponding to the Trajectory Control - * - * @return The Order Specificaton Instance - */ - - public org.drip.execution.strategy.OrderSpecification order() - { - try { - return new org.drip.execution.strategy.OrderSpecification (_dblStartHoldings, finishTime()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/execution/strategy/MinimumImpactTradingTrajectory.java b/org/drip/execution/strategy/MinimumImpactTradingTrajectory.java deleted file mode 100644 index ef6bf9d..0000000 --- a/org/drip/execution/strategy/MinimumImpactTradingTrajectory.java +++ /dev/null @@ -1,174 +0,0 @@ - -package org.drip.execution.strategy; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * MinimumImpactTradingTrajectory holds the Trajectory of a Trading Block that is to be executed uniformly - * over Equal Intervals, the Idea being to minimize the Trading Impact. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class MinimumImpactTradingTrajectory extends org.drip.execution.strategy.DiscreteTradingTrajectory { - - /** - * Create a MinimumImpactTradingTrajectory Instance from Equal Intervals - * - * @param dblStartHoldings Trajectory Start Holdings - * @param dblFinishHoldings Trajectory Finish Holdings - * @param dblStartTime Trajectory Start Time - * @param dblFinishTime Trajectory Finish Time - * @param iNumInterval The Number of Fixed Intervals - * - * @return The MinimumImpactTradingTrajectory Instance from Fixed Intervals - */ - - public static final MinimumImpactTradingTrajectory Standard ( - final double dblStartHoldings, - final double dblFinishHoldings, - final double dblStartTime, - final double dblFinishTime, - final int iNumInterval) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblStartHoldings) || - !org.drip.quant.common.NumberUtil.IsValid (dblFinishHoldings) || - !org.drip.quant.common.NumberUtil.IsValid (dblStartTime) || - !org.drip.quant.common.NumberUtil.IsValid (dblFinishTime) || dblStartTime >= - dblFinishTime || 0 >= iNumInterval) - return null; - - double dblTradeList = (dblFinishHoldings - dblStartHoldings) / iNumInterval; - double dblTimeInterval = (dblFinishTime - dblStartTime) / iNumInterval; - double[] adblExecutionTimeNode = new double[iNumInterval + 1]; - double[] adblHoldings = new double[iNumInterval + 1]; - adblExecutionTimeNode[iNumInterval] = dblFinishTime; - double[] adblTradeList = new double[iNumInterval]; - adblHoldings[iNumInterval] = dblFinishHoldings; - adblExecutionTimeNode[0] = dblStartTime; - adblHoldings[0] = dblStartHoldings; - adblTradeList[0] = dblTradeList; - - for (int i = 1; i < iNumInterval; ++i) { - adblTradeList[i] = dblTradeList; - adblHoldings[i] = dblStartHoldings + i * dblTradeList; - adblExecutionTimeNode[i] = dblStartTime + i * dblTimeInterval; - } - - try { - return new MinimumImpactTradingTrajectory (adblExecutionTimeNode, adblHoldings, adblTradeList); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - protected MinimumImpactTradingTrajectory ( - final double[] adblExecutionTimeNode, - final double[] adblHoldings, - final double[] adblTradeList) - throws java.lang.Exception - { - super (adblExecutionTimeNode, adblHoldings, adblTradeList); - } - - /** - * Retrieve the Trade Size - * - * @return The Trade Size - */ - - public double tradeSize() - { - double[] adblHoldings = holdings(); - - return adblHoldings[1] - adblHoldings[0]; - } - - /** - * Retrieve the Trade Time Interval - * - * @return The Trade Time Interval - */ - - public double tradeTimeInterval() - { - double[] adblExecutionTimeNode = executionTimeNode(); - - return adblExecutionTimeNode[1] - adblExecutionTimeNode[0]; - } - - /** - * Retrieve the Trade Rate - * - * @return The Trade Rate - */ - - public double tradeRate() - { - double[] adblHoldings = holdings(); - - double[] adblExecutionTimeNode = executionTimeNode(); - - return (adblHoldings[1] - adblHoldings[0]) / (adblExecutionTimeNode[1] - adblExecutionTimeNode[0]); - } -} diff --git a/org/drip/execution/strategy/MinimumVarianceTradingTrajectory.java b/org/drip/execution/strategy/MinimumVarianceTradingTrajectory.java deleted file mode 100644 index bcc95a2..0000000 --- a/org/drip/execution/strategy/MinimumVarianceTradingTrajectory.java +++ /dev/null @@ -1,95 +0,0 @@ - -package org.drip.execution.strategy; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * MinimumVarianceTradingTrajectory holds the Trajectory of a Trading Block that is to be executed in a - * Single Block, the Idea being to minimize the Trading Variance. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class MinimumVarianceTradingTrajectory extends - org.drip.execution.strategy.MinimumImpactTradingTrajectory { - - /** - * MinimumVarianceTradingTrajectory Constructor - * - * @param dblStartTime The Execution Start Time - * @param dblFinishTime The Execution Finish Time - * @param dblStartHoldings The Execution Start Holdings - * @param dblFinishHoldings The Execution Finish Holdings - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public MinimumVarianceTradingTrajectory ( - final double dblStartTime, - final double dblFinishTime, - final double dblStartHoldings, - final double dblFinishHoldings) - throws java.lang.Exception - { - super (new double[] {dblStartTime, dblFinishTime}, new double[] {dblStartHoldings, - dblFinishHoldings}, new double[] {dblFinishHoldings - dblStartHoldings}); - } -} diff --git a/org/drip/execution/strategy/OrderSpecification.java b/org/drip/execution/strategy/OrderSpecification.java deleted file mode 100644 index ce8d938..0000000 --- a/org/drip/execution/strategy/OrderSpecification.java +++ /dev/null @@ -1,114 +0,0 @@ - -package org.drip.execution.strategy; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OrderSpecification contains the Parameters that constitute an Order, namely the Size and the Execution - * Time. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class OrderSpecification { - private double _dblSize = java.lang.Double.NaN; - private double _dblMaxExecutionTime = java.lang.Double.NaN; - - /** - * OrderSpecification Constructor - * - * @param dblSize The Size of the Order - * @param dblMaxExecutionTime The Maximum Allowed Execution Time of the Order - * - * @throws java.lang.Exception Thrown if the inputs are Invalid - */ - - public OrderSpecification ( - final double dblSize, - final double dblMaxExecutionTime) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblSize = dblSize) || - !org.drip.quant.common.NumberUtil.IsValid (_dblMaxExecutionTime = dblMaxExecutionTime) || 0. >= - _dblMaxExecutionTime) - throw new java.lang.Exception ("OrderSpecification Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Maximum Allowed Execution Time - * - * @return The Maximum Allowed Execution Time - */ - - public double maxExecutionTime() - { - return _dblMaxExecutionTime; - } - - /** - * Retrieve the Order Size - * - * @return The Order Size - */ - - public double size() - { - return _dblSize; - } -} diff --git a/org/drip/execution/strategy/TradingTrajectory.java b/org/drip/execution/strategy/TradingTrajectory.java deleted file mode 100644 index 1611bcb..0000000 --- a/org/drip/execution/strategy/TradingTrajectory.java +++ /dev/null @@ -1,104 +0,0 @@ - -package org.drip.execution.strategy; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TradingTrajectory holds the Continuous/Discrete Trajectory of a Trading Block that is to be executed over - * a Discrete Time Set. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public interface TradingTrajectory { - - /** - * Retrieve the Trade Size - * - * @return The Trade Size - */ - - abstract public double tradeSize(); - - /** - * Retrieve the Execution Time - * - * @return The Execution Time - */ - - abstract public double executionTime(); - - /** - * Retrieve the Executed Block Size - * - * @return The Executed Block Size - */ - - abstract public double executedBlockSize(); - - /** - * Retrieve the Instant Trade Rate - * - * @return The Instant Trade Rate - */ - - abstract public double instantTradeRate(); -} diff --git a/org/drip/execution/tradingtime/CoordinatedMarketState.java b/org/drip/execution/tradingtime/CoordinatedMarketState.java deleted file mode 100644 index 0b2c6d1..0000000 --- a/org/drip/execution/tradingtime/CoordinatedMarketState.java +++ /dev/null @@ -1,130 +0,0 @@ - -package org.drip.execution.tradingtime; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CoordinatedMarketState implements the Coordinated Variation Version of the Volatility and the Linear - * Transaction Function arising from the Realization of the Market State Variable as described in the - * "Trading Time" Model. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class CoordinatedMarketState { - private org.drip.execution.tradingtime.CoordinatedVariation _cv = null; - - /** - * CoordinatedParticipationRateLinear Constructor - * - * @param cv The Coordinated Volatility/Liquidity Variation - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CoordinatedMarketState ( - final org.drip.execution.tradingtime.CoordinatedVariation cv) - throws java.lang.Exception - { - if (null == (_cv = cv)) - throw new java.lang.Exception ("CoordinatedMarketState Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Coordinated Variation Constraint - * - * @return The Coordinated Variation Constraint - */ - - public org.drip.execution.tradingtime.CoordinatedVariation variationConstraint() - { - return _cv; - } - - /** - * Retrieve the Realized Random Volatility - * - * @param dblMarketState The Realized Market State - * - * @return The Realized Random Volatility - */ - - public double volatility ( - final double dblMarketState) - { - return _cv.referenceVolatility() * java.lang.Math.exp (-0.5 * dblMarketState); - } - - /** - * Retrieve the Realized Random Liquidity - * - * @param dblMarketState The Realized Market State - * - * @return The Realized Random Liquidity - */ - - public double liquidity ( - final double dblMarketState) - { - return _cv.referenceLiquidity() * java.lang.Math.exp (dblMarketState); - } -} diff --git a/org/drip/execution/tradingtime/CoordinatedParticipationRateLinear.java b/org/drip/execution/tradingtime/CoordinatedParticipationRateLinear.java deleted file mode 100644 index a96c820..0000000 --- a/org/drip/execution/tradingtime/CoordinatedParticipationRateLinear.java +++ /dev/null @@ -1,161 +0,0 @@ - -package org.drip.execution.tradingtime; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CoordinatedParticipationRateLinear implements the Coordinated Variation Version of the Linear - * Participation Rate Transaction Function as described in the "Trading Time" Model. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class CoordinatedParticipationRateLinear implements - org.drip.execution.profiletime.BackgroundParticipationRateLinear { - private org.drip.function.definition.R1ToR1 _r1ToR1Volatility = null; - private org.drip.execution.tradingtime.CoordinatedVariation _cv = null; - - /** - * CoordinatedParticipationRateLinear Constructor - * - * @param cv The Coordinated Volatility/Liquidity Variation - * @param r1ToR1Volatility The R^1 To R^1 Volatility Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CoordinatedParticipationRateLinear ( - final org.drip.execution.tradingtime.CoordinatedVariation cv, - final org.drip.function.definition.R1ToR1 r1ToR1Volatility) - throws java.lang.Exception - { - if (null == (_cv = cv) || null == (_r1ToR1Volatility = r1ToR1Volatility)) - throw new java.lang.Exception - ("CoordinatedParticipationRateLinear Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Coordinated Variation Constraint - * - * @return The Coordinated Variation Constraint - */ - - public org.drip.execution.tradingtime.CoordinatedVariation variationConstraint() - { - return _cv; - } - - @Override public org.drip.execution.impact.ParticipationRateLinear liquidityFunction ( - final double dblTime) - { - try { - double dblVolatility = _r1ToR1Volatility.evaluate (dblTime); - - return org.drip.execution.impact.ParticipationRateLinear.SlopeOnly (_cv.invariant() / - (dblVolatility * dblVolatility)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.execution.impact.TransactionFunction impactFunction ( - final double dblTime) - { - return liquidityFunction (dblTime); - } - - @Override public org.drip.execution.impact.ParticipationRateLinear epochLiquidityFunction() - { - return liquidityFunction (0.); - } - - @Override public org.drip.execution.impact.TransactionFunction epochImpactFunction() - { - return epochLiquidityFunction(); - } - - /** - * Compute the Volatility Function from the Liquidity Function - * - * @return The R^1 To R^1 Volatility Function - */ - - public org.drip.function.definition.R1ToR1 volatilityFunction() - { - return new org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - org.drip.execution.impact.TransactionFunctionLinear tfl = liquidityFunction (dblTime); - - if (null == tfl) - throw new java.lang.Exception - ("CoordinatedParticipationRateLinear::volatilityFunction::evaluate => Invalid Inputs"); - - return java.lang.Math.sqrt (_cv.invariant() / tfl.slope()); - } - }; - } -} diff --git a/org/drip/execution/tradingtime/CoordinatedVariation.java b/org/drip/execution/tradingtime/CoordinatedVariation.java deleted file mode 100644 index b25727f..0000000 --- a/org/drip/execution/tradingtime/CoordinatedVariation.java +++ /dev/null @@ -1,194 +0,0 @@ - -package org.drip.execution.tradingtime; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CoordinatedVariation implements the Coordinated Variation of the Volatility and Liquidity as described in - * the "Trading Time" Model. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class CoordinatedVariation { - private double _dblInvariant = java.lang.Double.NaN; - private double _dblReferenceLiquidity = java.lang.Double.NaN; - private double _dblReferenceVolatility = java.lang.Double.NaN; - - /** - * CoordinatedVariation Constructor - * - * @param dblReferenceVolatility The Reference Volatility - * @param dblReferenceLiquidity The Reference Liquidity - * - * @throws java.lang.Exception Thrwon if the Inputs are Invalid - */ - - public CoordinatedVariation ( - final double dblReferenceVolatility, - final double dblReferenceLiquidity) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblReferenceVolatility = dblReferenceVolatility) || - 0. >= _dblReferenceVolatility || !org.drip.quant.common.NumberUtil.IsValid - (_dblReferenceLiquidity = dblReferenceLiquidity) || 0. >= _dblReferenceLiquidity) - throw new java.lang.Exception ("CoordinatedVariation Constructor => Invalid Inputs"); - - _dblInvariant = _dblReferenceVolatility * _dblReferenceVolatility * _dblReferenceLiquidity; - } - - /** - * Retrieve the Reference Liquidity - * - * @return The Reference Liquidity - */ - - public double referenceLiquidity() - { - return _dblReferenceLiquidity; - } - - /** - * Retrieve the Reference Volatility - * - * @return The Reference Volatility - */ - - public double referenceVolatility() - { - return _dblReferenceVolatility; - } - - /** - * Retrieve the Volatility/Liquidity Invariant - * - * @return The Volatility/Liquidity Invariant - */ - - public double invariant() - { - return _dblInvariant; - } - - /** - * Estimate the Liquidity given the Volatility - * - * @param dblVolatility The Volatility - * - * @return Liquidity Estimate using the Volatility - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double liquidity ( - final double dblVolatility) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVolatility)) - throw new java.lang.Exception ("CoordinatedVariation::liquidity => Invalid Inputs"); - - return _dblInvariant / (dblVolatility * dblVolatility); - } - - /** - * Estimate the Volatility given the Liquidity - * - * @param dblLiquidity The Liquidity - * - * @return Volatility Estimate using the Liquidity - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double volatility ( - final double dblLiquidity) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblLiquidity)) - throw new java.lang.Exception ("CoordinatedVariation::volatility => Invalid Inputs"); - - return java.lang.Math.sqrt (_dblInvariant / dblLiquidity); - } - - /** - * Compute the Volatility Function from the Liquidity Function - * - * @param r1ToR1Liquidity The R^1 To R^1 Liquidity Function - * - * @return The R^1 To R^1 Volatility Function - */ - - public org.drip.function.definition.R1ToR1 volatilityFunction ( - final org.drip.function.definition.R1ToR1 r1ToR1Liquidity) - { - if (null == r1ToR1Liquidity) return null; - - return new org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblTime) - throws java.lang.Exception - { - return java.lang.Math.sqrt (_dblInvariant / r1ToR1Liquidity.evaluate (dblTime)); - } - }; - } -} diff --git a/org/drip/execution/tradingtime/VolumeTimeFrame.java b/org/drip/execution/tradingtime/VolumeTimeFrame.java deleted file mode 100644 index 9044aa2..0000000 --- a/org/drip/execution/tradingtime/VolumeTimeFrame.java +++ /dev/null @@ -1,150 +0,0 @@ - -package org.drip.execution.tradingtime; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * VolumeTimeFrame implements the Pre- and Post-transformed Increment in the Volume Time Space as used in the - * "Trading Time" Model. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class VolumeTimeFrame extends org.drip.measure.realization.JumpDiffusionEdge { - private double _dblHoldings = java.lang.Double.NaN; - private double _dblTradeRate = java.lang.Double.NaN; - - /** - * VolumeTimeFrame Constructor - * - * @param dblPrevious The Previous Realization - * @param dblTemporal The Temporal Increment - * @param dblBrownian The Brownian Increment - * @param dblVolatility The Volatility - * @param dblHoldings Current Holdings - * @param dblTradeRate Current Trade Rate - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public VolumeTimeFrame ( - final double dblPrevious, - final double dblTemporal, - final double dblBrownian, - final double dblVolatility, - final double dblHoldings, - final double dblTradeRate) - throws java.lang.Exception - { - super (dblPrevious, dblVolatility * dblVolatility * dblTemporal, new - org.drip.measure.realization.StochasticEdgeDiffusion (dblVolatility * dblBrownian), null, new - org.drip.measure.realization.UnitRandom (dblBrownian, 0.)); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblHoldings = dblHoldings) || - !org.drip.quant.common.NumberUtil.IsValid (_dblTradeRate = dblTradeRate / (dblVolatility * - dblVolatility))) - throw new java.lang.Exception ("VolumeTimeFrame Constructor => Invalid Inputs!"); - } - - /** - * Retrieve the Holdings - * - * @return The Holdings - */ - - public double holdings() - { - return _dblHoldings; - } - - /** - * Retrieve the Trade Rate - * - * @return The Trade Rate - */ - - public double tradeRate() - { - return _dblTradeRate; - } - - /** - * Generate the Transaction Cost Increment - * - * @param cv The Coordinated Variation Parameters - * - * @return The Transaction Cost Increment - * - * @throws java.lang.Exception Throw if the Inputs are Invalid - */ - - public double transactionCostIncrement ( - final org.drip.execution.tradingtime.CoordinatedVariation cv) - throws java.lang.Exception - { - if (null == cv) - throw new java.lang.Exception ("VolumeTimeFrame::transactionCostIncrement => Invalid Inputs"); - - return _dblHoldings * diffusionStochastic() + cv.invariant() * _dblTradeRate * _dblTradeRate * - deterministic(); - } -} diff --git a/org/drip/feed/loader/BondRefData.java b/org/drip/feed/loader/BondRefData.java deleted file mode 100644 index 14bc806..0000000 --- a/org/drip/feed/loader/BondRefData.java +++ /dev/null @@ -1,406 +0,0 @@ - -package org.drip.feed.loader; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * BondRefData contains functionality to load a variety of Bond Product reference data and closing - * marks. It exposes the following functionality: - * - Load the bond valuation-based reference data, amortization schedule and EOS - * - Build the bond instance entities from the valuation-based reference data - * - Load the bond non-valuation-based reference data - * - * BondRefData assumes the appropriate connections are available to load the data. - * - * @author Lakshmi Krishnamurthy - */ - -class BondRefData { - private static final boolean m_bBlog = false; - private static final boolean m_bDBExec = true; - - private static final org.drip.product.creator.BondRefDataBuilder MakeBRDB ( - final java.lang.String[] astrFODATA) - { - if (null == astrFODATA || 88 != astrFODATA.length) return null; - - org.drip.product.creator.BondRefDataBuilder brdb = new org.drip.product.creator.BondRefDataBuilder(); - - if (!brdb.setISIN (astrFODATA[40])) { - System.out.println ("Bad ISIN " + astrFODATA[40]); - - return null; - } - - if (!brdb.setCUSIP (astrFODATA[42])) { - System.out.println ("Bad CUSIP " + astrFODATA[42]); - - return null; - } - - brdb.setBBGID (astrFODATA[1]); - - brdb.setIssuerCategory (astrFODATA[2]); - - brdb.setTicker (astrFODATA[3]); - - brdb.setSeries (astrFODATA[7]); - - brdb.setName (astrFODATA[8]); - - brdb.setShortName (astrFODATA[9]); - - brdb.setIssuerIndustry (astrFODATA[10]); - - brdb.setCouponType (astrFODATA[13]); - - brdb.setMaturityType (astrFODATA[14]); - - brdb.setCalculationType (astrFODATA[15]); - - brdb.setDayCountCode (astrFODATA[16]); - - brdb.setMarketIssueType (astrFODATA[17]); - - brdb.setIssueCountryCode (astrFODATA[18]); - - brdb.setIssueCountry (astrFODATA[19]); - - brdb.setCollateralType (astrFODATA[20]); - - brdb.setIssueAmount (astrFODATA[21]); - - brdb.setOutstandingAmount (astrFODATA[22]); - - brdb.setMinimumPiece (astrFODATA[23]); - - brdb.setMinimumIncrement (astrFODATA[24]); - - brdb.setParAmount (astrFODATA[25]); - - brdb.setLeadManager (astrFODATA[26]); - - brdb.setExchangeCode (astrFODATA[27]); - - brdb.setRedemptionValue (astrFODATA[28]); - - brdb.setAnnounce (astrFODATA[29]); - - brdb.setFirstSettle (astrFODATA[31]); - - brdb.setFirstCoupon (astrFODATA[33]); - - brdb.setInterestAccrualStart (astrFODATA[35]); - - brdb.setIssue (astrFODATA[37]); - - brdb.setIssuePrice (astrFODATA[39]); - - brdb.setNextCouponDate (astrFODATA[43]); - - brdb.setIsCallable (astrFODATA[45]); - - brdb.setIsSinkable (astrFODATA[46]); - - brdb.setIsPutable (astrFODATA[47]); - - brdb.setBBGParent (astrFODATA[48]); - - brdb.setCountryOfIncorporation (astrFODATA[53]); - - brdb.setIndustrySector (astrFODATA[54]); - - brdb.setIndustryGroup (astrFODATA[55]); - - brdb.setIndustrySubgroup (astrFODATA[56]); - - brdb.setCountryOfGuarantor (astrFODATA[57]); - - brdb.setCountryOfDomicile (astrFODATA[58]); - - brdb.setDescription (astrFODATA[59]); - - brdb.setSecurityType (astrFODATA[60]); - - brdb.setPrevCouponDate (astrFODATA[61]); - - brdb.setBBGUniqueID (astrFODATA[63]); - - brdb.setLongCompanyName (astrFODATA[64]); - - brdb.setRedemptionCurrency (astrFODATA[66]); - - brdb.setCouponCurrency (astrFODATA[67]); - - brdb.setIsStructuredNote (astrFODATA[68]); - - brdb.setIsUnitTraded (astrFODATA[69]); - - brdb.setIsReversibleConvertible (astrFODATA[70]); - - brdb.setTradeCurrency (astrFODATA[71]); - - brdb.setIsBearer (astrFODATA[72]); - - brdb.setIsRegistered (astrFODATA[73]); - - brdb.setHasBeenCalled (astrFODATA[74]); - - brdb.setIssuer (astrFODATA[75]); - - brdb.setPenultimateCouponDate (astrFODATA[76]); - - brdb.setFloatCouponConvention (astrFODATA[77]); - - brdb.setCurrentCoupon (astrFODATA[78]); - - brdb.setIsFloater (astrFODATA[79]); - - brdb.setTradeStatus (astrFODATA[80]); - - brdb.setCDRCountryCode (astrFODATA[81]); - - brdb.setCDRSettleCode (astrFODATA[82]); - - brdb.setFinalMaturity (astrFODATA[83]); - - brdb.setIsPrivatePlacement (astrFODATA[85]); - - brdb.setIsPerpetual (astrFODATA[86]); - - brdb.setIsDefaulted (astrFODATA[87]); - - if (!brdb.validate()) return null; - - return brdb; - } - - private static final org.drip.product.creator.BondProductBuilder MakeBPB ( - final java.lang.String[] astrFODATA, - final org.drip.param.definition.ScenarioMarketParams mpc) - { - if (null == astrFODATA || 88 != astrFODATA.length || null == mpc) return null; - - org.drip.product.creator.BondProductBuilder bpb = new org.drip.product.creator.BondProductBuilder(); - - if (!bpb.setISIN (astrFODATA[40])) { - System.out.println ("Bad ISIN " + astrFODATA[40]); - - return null; - } - - if (!bpb.setCUSIP (astrFODATA[42])) { - System.out.println ("Bad CUSIP " + astrFODATA[42]); - - return null; - } - - bpb.setTicker (astrFODATA[3]); - - bpb.setCoupon (astrFODATA[4]); - - if (!bpb.setMaturity (astrFODATA[5])) { - System.out.println ("Bad Maturity " + astrFODATA[5]); - - return null; - } - - if (!bpb.setCouponFreq (astrFODATA[12])) { - System.out.println ("Bad Cpn Freq " + astrFODATA[12]); - - return null; - } - - bpb.setCouponType (astrFODATA[13]); - - bpb.setMaturityType (astrFODATA[14]); - - bpb.setCalculationType (astrFODATA[15]); - - if (!bpb.setDayCountCode (astrFODATA[16])) { - System.out.println ("Bad Day Count " + astrFODATA[40]); - - return null; - } - - if (!bpb.setRedemptionValue (astrFODATA[28])) { - System.out.println ("Bad Redemp Value " + astrFODATA[40]); - - return null; - } - - bpb.setAnnounce (astrFODATA[29]); - - bpb.setFirstSettle (astrFODATA[31]); - - bpb.setFirstCoupon (astrFODATA[33]); - - bpb.setInterestAccrualStart (astrFODATA[35]); - - bpb.setIssue (astrFODATA[37]); - - bpb.setIsCallable (astrFODATA[45]); - - bpb.setIsSinkable (astrFODATA[46]); - - bpb.setIsPutable (astrFODATA[47]); - - if (!bpb.setRedemptionCurrency (astrFODATA[66])) { - System.out.println ("Bad Redemp Ccy " + astrFODATA[66]); - - return null; - } - - if (!bpb.setCouponCurrency (astrFODATA[67])) { - System.out.println ("Bad Cpn Ccy " + astrFODATA[40]); - - return null; - } - - if (!bpb.setTradeCurrency (astrFODATA[71])) { - System.out.println ("Bad Trade ccy " + astrFODATA[40]); - - return null; - } - - bpb.setHasBeenCalled (astrFODATA[74]); - - bpb.setFloatCouponConvention (astrFODATA[77]); - - bpb.setCurrentCoupon (astrFODATA[78]); - - bpb.setIsFloater (astrFODATA[79]); - - bpb.setFinalMaturity (astrFODATA[83]); - - bpb.setIsPerpetual (astrFODATA[86]); - - bpb.setIsDefaulted (astrFODATA[87]); - - if (!bpb.validate (mpc)) return null; - - return bpb; - } - - public static final void UploadBondFromFODATA ( - final java.lang.String strFODATAFile, - final java.sql.Statement stmt, - final org.drip.param.definition.ScenarioMarketParams mpc) - throws java.lang.Exception - { - int iNumBonds = 0; - int iNumFloaters = 0; - int iNumFailedToLoad = 0; - java.lang.String strBondFODATALine = ""; - - java.io.BufferedReader inBondFODATA = new java.io.BufferedReader (new java.io.FileReader - (strFODATAFile)); - - while (null != (strBondFODATALine = inBondFODATA.readLine())) { - ++iNumBonds; - - java.lang.String[] astrBondFODATARecord = strBondFODATALine.split (","); - - org.drip.product.creator.BondRefDataBuilder brdb = MakeBRDB (astrBondFODATARecord); - - if (null != brdb) { - System.out.println ("Doing #" + iNumBonds + ": " + brdb._strCUSIP); - - java.lang.String strSQLBRDBDelete = brdb.makeSQLDelete(); - - if (null != strSQLBRDBDelete) { - if (m_bBlog) System.out.println (strSQLBRDBDelete); - - if (m_bDBExec) stmt.executeUpdate (strSQLBRDBDelete); - } - - java.lang.String strSQLBRDBInsert = brdb.makeSQLInsert(); - - if (null != strSQLBRDBInsert) { - if (m_bBlog) System.out.println (strSQLBRDBInsert); - - if (m_bDBExec) stmt.executeUpdate (strSQLBRDBInsert); - } - } - - org.drip.product.creator.BondProductBuilder bpb = MakeBPB (astrBondFODATARecord, mpc); - - if (null != bpb) { - if (null != bpb.getFloaterParams()) ++iNumFloaters; - - java.lang.String strSQLBPBDelete = bpb.makeSQLDelete(); - - if (null != strSQLBPBDelete) { - if (m_bBlog) System.out.println (strSQLBPBDelete); - - if (m_bDBExec) stmt.executeUpdate (strSQLBPBDelete); - } - - java.lang.String strSQLBPBInsert = bpb.makeSQLInsert(); - - if (null != strSQLBPBInsert) { - if (m_bBlog) System.out.println (strSQLBPBInsert); - - if (m_bDBExec) stmt.executeUpdate (strSQLBPBInsert); - } - } - - if (null == brdb || null == bpb) ++iNumFailedToLoad; - } - - inBondFODATA.close(); - - System.out.println (iNumFailedToLoad + " out of " + iNumBonds + " failed to load"); - - System.out.println ("There were " + iNumFloaters + " floaters!"); - } -} diff --git a/org/drip/feed/loader/CDXRefData.java b/org/drip/feed/loader/CDXRefData.java deleted file mode 100644 index 3fcefd7..0000000 --- a/org/drip/feed/loader/CDXRefData.java +++ /dev/null @@ -1,516 +0,0 @@ - -package org.drip.feed.loader; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * CDXRefData contains the functionality to load the standard CDX reference data and definitions, and create - * compile time static classes for these definitions. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXRefData { - private static final boolean s_bBlog = false; - private static final boolean s_bSuppressErr = true; - private static final boolean s_bPrintCDXRefDataDump = false; - - private static final org.drip.product.params.CDXRefDataParams CreateCDXRefDataFromRecord ( - final java.lang.String[] astrArgs, - final java.io.BufferedWriter bw) - { - if (null == astrArgs || 43 != astrArgs.length) System.exit (333); - - java.lang.String strCurveID = org.drip.quant.common.StringUtil.ProcessInputForNULL (astrArgs[0], - false); - - if (s_bBlog) System.out.println ("Curve ID: " + strCurveID); - - java.lang.String strSPN = org.drip.quant.common.StringUtil.ProcessInputForNULL (astrArgs[1], false); - - if (s_bBlog) System.out.println ("SPN: " + strSPN); - - java.lang.String strIndexLabel = org.drip.quant.common.StringUtil.ProcessInputForNULL (astrArgs[2], - false); - - if (s_bBlog) System.out.println ("Index Label: " + strIndexLabel); - - java.lang.String strIndexName = org.drip.quant.common.StringUtil.ProcessInputForNULL (astrArgs[3], - false); - - if (s_bBlog) System.out.println ("Index Name: " + strIndexName); - - java.lang.String strCurveName = org.drip.quant.common.StringUtil.ProcessInputForNULL (astrArgs[4], - false); - - if (s_bBlog) System.out.println ("Curve Name: " + strCurveName); - - org.drip.analytics.date.JulianDate dtIssueDate = - org.drip.analytics.date.DateUtil.MakeJulianFromDDMMMYY - (org.drip.quant.common.StringUtil.ProcessInputForNULL (astrArgs[5], false), "-"); - - if (null == dtIssueDate) { - System.out.println ("Bad Issue Date for Curve ID " + strCurveID); - - return null; - } - - if (s_bBlog) System.out.println ("Issue Date: " + dtIssueDate); - - org.drip.analytics.date.JulianDate dtMaturityDate = - org.drip.analytics.date.DateUtil.MakeJulianFromDDMMMYY - (org.drip.quant.common.StringUtil.ProcessInputForNULL (astrArgs[6], false), "-"); - - if (null == dtMaturityDate) { - System.out.println ("Bad Maturity Date for Curve ID " + strCurveID); - - return null; - } - - if (s_bBlog) System.out.println ("Maturity Date: " + dtMaturityDate); - - double dblCoupon = java.lang.Double.NaN; - - try { - dblCoupon = 0.0001 * new java.lang.Double (astrArgs[7]); - } catch (java.lang.Exception e) { - if (!s_bSuppressErr) e.printStackTrace(); - - dblCoupon = 0.; - } - - if (s_bBlog) System.out.println ("Coupon: " + dblCoupon); - - java.lang.String strCurrency = org.drip.quant.common.StringUtil.ProcessInputForNULL (astrArgs[8], - false); - - if (s_bBlog) System.out.println ("Currency: " + strCurrency); - - java.lang.String strDayCount = org.drip.quant.common.StringUtil.ProcessInputForNULL (astrArgs[9], - false); - - if (s_bBlog) System.out.println ("DayCount: " + strDayCount); - - java.lang.String strFullFirstStub = org.drip.quant.common.StringUtil.ProcessInputForNULL - (astrArgs[10], false); - - boolean bFullFirstStub = "lf".equalsIgnoreCase (strFullFirstStub); - - if (s_bBlog) System.out.println ("Full First Stub: " + bFullFirstStub); - - double dblRecovery = java.lang.Double.NaN; - - try { - dblRecovery = 0.01 * new java.lang.Double (astrArgs[11]); - } catch (java.lang.Exception e) { - if (!s_bSuppressErr) e.printStackTrace(); - - dblRecovery = 0.; - } - - if (s_bBlog) System.out.println ("Recovery: " + dblRecovery); - - int iFrequency = 0; - - java.lang.String strFrequency = org.drip.quant.common.StringUtil.ProcessInputForNULL (astrArgs[12], - false); - - if ("Q".equalsIgnoreCase (strFrequency)) - iFrequency = 4; - else if ("S".equalsIgnoreCase (strFrequency)) - iFrequency = 2; - - if (s_bBlog) System.out.println ("Frequency: " + iFrequency); - - java.lang.String strRedID = org.drip.quant.common.StringUtil.ProcessInputForNULL (astrArgs[13], - false); - - if (s_bBlog) System.out.println ("RedID: " + strRedID); - - java.lang.String strIndexClass = org.drip.quant.common.StringUtil.ProcessInputForNULL (astrArgs[14], - false); - - if (s_bBlog) System.out.println ("Index Class: " + strIndexClass); - - int iIndexSeries = 0; - - try { - iIndexSeries = new java.lang.Integer (astrArgs[15]); - } catch (java.lang.Exception e) { - if (!s_bSuppressErr) e.printStackTrace(); - } - - if (s_bBlog) System.out.println ("Index Series: " + iIndexSeries); - - java.lang.String strIndexGroupName = org.drip.quant.common.StringUtil.ProcessInputForNULL - (astrArgs[16], false); - - if (s_bBlog) System.out.println ("Index Group Name: " + strIndexGroupName); - - java.lang.String strIndexShortName = org.drip.quant.common.StringUtil.ProcessInputForNULL - (astrArgs[17], false); - - if (s_bBlog) System.out.println ("Index Short Name: " + strIndexShortName); - - java.lang.String strIndexShortGroupName = org.drip.quant.common.StringUtil.ProcessInputForNULL - (astrArgs[18], false); - - if (s_bBlog) System.out.println ("Index Short Group Name: " + strIndexShortGroupName); - - int iIndexVersion = 0; - - try { - iIndexVersion = new java.lang.Integer (astrArgs[19]); - } catch (java.lang.Exception e) { - if (!s_bSuppressErr) e.printStackTrace(); - } - - if (s_bBlog) System.out.println ("Index Version: " + iIndexVersion); - - int iIndexLifeSpan = 0; - - try { - iIndexLifeSpan = new java.lang.Integer (astrArgs[20]); - } catch (java.lang.Exception e) { - if (!s_bSuppressErr) e.printStackTrace(); - } - - if (s_bBlog) System.out.println ("Index Life Span: " + iIndexLifeSpan); - - java.lang.String strCurvyCurveID = org.drip.quant.common.StringUtil.ProcessInputForNULL (astrArgs[21], - false); - - if (s_bBlog) System.out.println ("Curvy Curve ID: " + strCurvyCurveID); - - double dblIndexFactor = java.lang.Double.NaN; - - try { - dblIndexFactor = 0.01 * new java.lang.Double (astrArgs[22]); - } catch (java.lang.Exception e) { - if (!s_bSuppressErr) e.printStackTrace(); - } - - if (s_bBlog) System.out.println ("Index Factor: " + dblIndexFactor); - - int iOriginalComponentCount = 0; - - try { - iOriginalComponentCount = new java.lang.Integer (astrArgs[23]); - } catch (java.lang.Exception e) { - if (!s_bSuppressErr) e.printStackTrace(); - } - - if (s_bBlog) System.out.println ("Original Component Count: " + iOriginalComponentCount); - - int iDefaultedComponentCount = 0; - - try { - new java.lang.Integer (astrArgs[24]); - } catch (java.lang.Exception e) { - if (!s_bSuppressErr) e.printStackTrace(); - } - - if (s_bBlog) System.out.println ("Defaulted Component Count: " + iDefaultedComponentCount); - - java.lang.String strLocation = org.drip.quant.common.StringUtil.ProcessInputForNULL (astrArgs[26], - false); - - if (s_bBlog) System.out.println ("Location: " + strLocation); - - boolean bPayAccrued = "1".equalsIgnoreCase (astrArgs[27]); - - if (s_bBlog) System.out.println ("Pay Accrued: " + bPayAccrued); - - boolean bKnockOutOnDefault = "1".equalsIgnoreCase (astrArgs[28]); - - if (s_bBlog) System.out.println ("KO Def: " + bKnockOutOnDefault); - - boolean bQuoteAsCDS = "1".equalsIgnoreCase (astrArgs[33]); - - if (s_bBlog) System.out.println ("Quote As CDS: " + bQuoteAsCDS); - - java.lang.String strBBGTicker = org.drip.quant.common.StringUtil.ProcessInputForNULL (astrArgs[41], - false); - - if (s_bBlog) System.out.println ("BBG Ticker: " + strBBGTicker); - - java.lang.String strShortName = org.drip.quant.common.StringUtil.ProcessInputForNULL (astrArgs[42], - false); - - if (s_bBlog) System.out.println ("Short Name: " + strShortName); - - org.drip.product.params.CDXRefDataParams cdxrd = - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder (strCurveID, strSPN, - strIndexLabel, strIndexName, strCurveName, dtIssueDate.julian(), - dtMaturityDate.julian(), dblCoupon, strCurrency, strDayCount, bFullFirstStub, - dblRecovery, iFrequency, strRedID, strIndexClass, iIndexSeries, strIndexGroupName, - strIndexShortName, strIndexShortGroupName, iIndexVersion, iIndexLifeSpan, - strCurvyCurveID, dblIndexFactor, iOriginalComponentCount, - iDefaultedComponentCount, strLocation, bPayAccrued, bKnockOutOnDefault, - bQuoteAsCDS, strBBGTicker, strShortName); - - if (s_bBlog) System.out.println ("CDXRD = " + cdxrd); - - if (null == cdxrd) return null; - - java.lang.String strCDXRD = cdxrd.setConstructionString(); - - if (s_bPrintCDXRefDataDump) System.out.println (strCDXRD); - - try { - if (null != bw) { - bw.write (strCDXRD); - - bw.flush(); - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return cdxrd; - } - - private static final boolean LoadCDXDefinitions ( - final java.lang.String strCDXRefDataFile) - { - if (null == strCDXRefDataFile || strCDXRefDataFile.isEmpty()) { - System.out.println ("Invalid CDX Ref Data File: " + strCDXRefDataFile); - - return false; - } - - int iNumIndices = 0; - int iNumFunctions = 0; - int iNumFailedToLoad = 0; - int iNumIndicesPerFunction = 100; - java.io.BufferedWriter bw = null; - java.lang.String strCDXRefDataLine = ""; - java.io.BufferedReader iobrCDXRefData = null; - - try { - iobrCDXRefData = new java.io.BufferedReader (new java.io.FileReader (strCDXRefDataFile)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - try { - bw = new java.io.BufferedWriter (new java.io.FileWriter - ("C:\\Lakshmi\\BondAnal\\org\\drip\\product\\creator\\CDXRefDataHolder.java")); - - bw.write ("\npackage org.drip.product.creator;\n\n"); - - bw.write - ("/*\n * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-\n */\n"); - - bw.write ("\n/*\n * GENERATED on " + new java.util.Date().toString() + - " ---- DO NOT DELETE\n */\n"); - - bw.write ("\n/*!\n * Copyright (C) 2012 Lakshmi Krishnamurthy\n *\n"); - - bw.write (" * This file is part of CreditAnalytics, a free-software/open-source library for\n"); - - bw.write - (" * fixed income analysts and developers - http://www.credit-trader.org\n *\n"); - - bw.write - (" * CreditAnalytics is a free, full featured, fixed income credit analytics library,\n"); - - bw.write (" * developed with a special focus"); - - bw.write (" towards the needs of the bonds and credit products community.\n *\n"); - - bw.write (" * Licensed under the Apache License, Version 2.0 (the \"License\");\n"); - - bw.write (" * you may not use this file except in compliance with the License.\n"); - - bw.write (" *\n * You may obtain a copy of the License at\n"); - - bw.write (" * http://www.apache.org/licenses/LICENSE-2.0\n *\n"); - - bw.write (" * Unless required by applicable law or agreed to in writing, software\n"); - - bw.write (" * distributed under the License is distributed on an \"AS IS\" BASIS,\n"); - - bw.write (" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"); - - bw.write (" * \n * See the License for the specific language governing permissions and\n"); - - bw.write (" * limitations under the License.\n */\n\n"); - - bw.write ("public class CDXRefDataHolder {\n\tpublic "); - - bw.write ("static org.drip.analytics.support.CaseInsensitiveMap "); - - bw.write ("_mapCDXRefData\n\t\t= new "); - - bw.write ("org.drip.analytics.support.AnalyticsHelper.CaseInsensitiveMap();"); - - bw.write ("\n\n\tpublic static org.drip.analytics.support.CaseInsensitiveMap<"); - - bw.write ("java.util.Map> "); - - bw.write ("_mmCDXRDBFirstCouponSeries = new org.drip.analytics.support.CaseInsensitiveMap<\n\t\t\t"); - - bw.write ("java.util.Map>();\n\n\t"); - - bw.write ("public static org.drip.analytics.support.CaseInsensitiveMap> _mmCDXRDBSeriesFirstCoupon = new "); - - bw.write ("org.drip.analytics.support.CaseInsensitiveMap<\n\t\t\t"); - - bw.write ("java.util.Map>();\n\n\t"); - - bw.write ("private static final boolean UpdateCDXRefDataMap (\n\t\tfinal java.lang.String "); - - bw.write ("strCDXName,\n\t\tfinal org.drip.product.creator.CDXRefDataBuilder cdxrd)\n\t{\n"); - - bw.write ("\t\tif (null == cdxrd) {\n"); - - bw.write ("\t\t\tSystem.out.println (\"No CDX ref data for \" + strCDXName);\n\n"); - - bw.write ("\t\t\treturn false;\n\t\t}\n\n"); - - bw.write ("\t\t_mapCDXRefData.put (strCDXName, cdxrd);\n\n\t\t"); - - bw.write ("java.util.Map "); - - bw.write ("mapFirstCouponSeries =\n\t\t\t_mmCDXRDBFirstCouponSeries.get "); - - bw.write ("(cdxrd._strIndexClass + \".\" + cdxrd._strIndexGroupName);\n\n\t\t"); - - bw.write ("if (null == mapFirstCouponSeries)\n\t\t\tmapFirstCouponSeries = new "); - - bw.write ("java.util.TreeMap();\n\n\t\t"); - - bw.write ("mapFirstCouponSeries.put (cdxrd._dtMaturity.subtractTenor (cdxrd._iIndexLifeSpan + "); - - bw.write ("\"Y\"),\n\t\t\tcdxrd._iIndexSeries);"); - - bw.write ("\n\n\t\t_mmCDXRDBFirstCouponSeries.put (cdxrd._strIndexClass + \".\" + "); - - bw.write ("cdxrd._strIndexGroupName,\n\t\t\tmapFirstCouponSeries);\n\n"); - - bw.write ("\t\tjava.util.Map "); - - bw.write ("mapSeriesFirstCoupon = \n\t\t\t"); - - bw.write ("_mmCDXRDBSeriesFirstCoupon.get (cdxrd._strIndexClass + \".\" + "); - - bw.write ("cdxrd._strIndexGroupName);\n\n"); - - bw.write ("\t\tif (null == mapSeriesFirstCoupon)\n"); - - bw.write ("\t\t\tmapSeriesFirstCoupon = new java.util.TreeMap();\n\n"); - - bw.write ("\t\tmapSeriesFirstCoupon.put (cdxrd._iIndexSeries, cdxrd._dtMaturity.subtractTenor "); - - bw.write ("(cdxrd._iIndexLifeSpan\n\t\t\t+ \"Y\"));\n\n"); - - bw.write ("\t\t_mmCDXRDBSeriesFirstCoupon.put (cdxrd._strIndexClass + \".\" + "); - - bw.write ("cdxrd._strIndexGroupName,\n\t\t\tmapSeriesFirstCoupon);\n\n"); - - bw.write ("\t\treturn true;\n\t}\n"); - - bw.write ("\n\tprivate static final boolean InitCDXRefDataSet" + ++iNumFunctions + "()\n\t{\n"); - - while (null != (strCDXRefDataLine = iobrCDXRefData.readLine())) { - ++iNumIndices; - - java.lang.String[] astrCDXRefDataRecord = strCDXRefDataLine.split (","); - - org.drip.product.params.CDXRefDataParams cdxrd = CreateCDXRefDataFromRecord - (astrCDXRefDataRecord, bw); - - if (null == cdxrd) - System.out.println (++iNumFailedToLoad + " / " + iNumIndices + " failed to load!"); - - if (0 == (iNumIndices % iNumIndicesPerFunction)) { - bw.write ("\t\treturn true;\n\t}\n\n\tprivate "); - - bw.write ("static final boolean InitCDXRefDataSet" + ++iNumFunctions + "()\n\t{\n"); - } - } - - bw.write ("\t\treturn true;\n\t}\n\n\t"); - - bw.write ("public static final boolean InitFullCDXRefDataSet()\n\t{\n"); - - for (int i = 1 ; i <= iNumFunctions; ++i) - bw.write ("\t\tif (!InitCDXRefDataSet" + i + "()) return false;\n\n"); - - bw.write ("\t\treturn true;\n\t}\n}\n"); - - bw.close(); - - iobrCDXRefData.close(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - System.out.println (iNumFailedToLoad + " / " + iNumIndices + " failed to load!"); - - return true; - } - - public static void main ( - final java.lang.String[] astrArgs) - { - LoadCDXDefinitions ("C:\\Lakshmi\\RefDataAndMarks\\CDXRefData1Raw.csv"); - } -} diff --git a/org/drip/feed/loader/CSVGrid.java b/org/drip/feed/loader/CSVGrid.java deleted file mode 100644 index 8de099c..0000000 --- a/org/drip/feed/loader/CSVGrid.java +++ /dev/null @@ -1,489 +0,0 @@ - -package org.drip.feed.loader; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CSVGrid Holds the Outputs of a CSV Parsing Exercise. - * - * @author Lakshmi Krishnamurthy - */ - -public class CSVGrid { - private java.lang.String[] _astrHeader = null; - private java.util.List _lsastr = null; - - /** - * Convert the String Element to double. Fall back is NaN. - * - * @param strElement String Element - * - * @return The Return Value - */ - - public static final double ToDouble ( - final java.lang.String strElement) - { - if (null == strElement || strElement.trim().isEmpty()) return java.lang.Double.NaN; - - try { - return java.lang.Double.parseDouble (strElement); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return java.lang.Double.NaN; - } - - /** - * Convert the String Element to int. Fall back is MIN_VALUE. - * - * @param strElement String Element - * - * @return The Return Value - */ - - public static final int ToInteger ( - final java.lang.String strElement) - { - if (null == strElement || strElement.trim().isEmpty()) return java.lang.Integer.MIN_VALUE; - - try { - return java.lang.Integer.parseInt (strElement); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return java.lang.Integer.MIN_VALUE; - } - - /** - * Convert the String Element to a JulianDate Instance. - * - * @param strElement String Element - * - * @return The Return Value - */ - - public static final org.drip.analytics.date.JulianDate ToDate ( - final java.lang.String strElement) - { - org.drip.analytics.date.JulianDate dt = org.drip.analytics.date.DateUtil.CreateFromDDMMMYYYY - (strElement.trim()); - - if (null != dt || null != (dt = org.drip.analytics.date.DateUtil.MakeJulianFromDDMMMYY (strElement, - "-"))) - return dt; - - return org.drip.analytics.date.DateUtil.CreateFromMDY (strElement, "-"); - } - - /** - * Empty CSVGrid Constructor - */ - - public CSVGrid() - { - } - - /** - * Retrieve the Underlying CSV Grid - * - * @return The Underlying CSV Field Grid - */ - - public java.util.List grid() - { - return _lsastr; - } - - /** - * Retrieve the Size of the Sample Set - * - * @return Size of the Sample Set - */ - - public int size() - { - return null == _lsastr ? 0 : _lsastr.size(); - } - - /** - * Set the Column Headers - * - * @param astrHeader The Column Headers - * - * @return TRUE - Column Headers successfully set - */ - - public boolean setHeader ( - final java.lang.String[] astrHeader) - { - if (null == astrHeader || 0 == astrHeader.length) return false; - - _astrHeader = astrHeader; - return true; - } - - /** - * Add a String Array to the Grid - * - * @param astr The String Array - * - * @return TRUE - The String Array successfully added - */ - - public boolean add ( - final java.lang.String[] astr) - { - if (null == astr || 0 == astr.length) return false; - - if (null == _lsastr) _lsastr = new java.util.ArrayList(); - - _lsastr.add (astr); - - return true; - } - - /** - * Retrieve the Array of Headers - * - * @return The Header Array - */ - - public java.lang.String[] headers() - { - return _astrHeader; - } - - /** - * Retrieve the Header identified by the Index - * - * @param iIndex The Index - * - * @return The Header identified by the Index - */ - - public java.lang.String header ( - final int iIndex) - { - return null == _astrHeader || _astrHeader.length <= iIndex ? null : _astrHeader[iIndex]; - } - - /** - * - * Retrieve the Array of String Values corresponding to the specified Column Index - * - * @param iColumn The Column Index - * - * @return The Array of Strings - */ - - public java.lang.String[] stringArrayAtColumn ( - final int iColumn) - { - if (0 > iColumn) return null; - - int iRow = 0; - - java.lang.String[] astrColumn = new java.lang.String[_lsastr.size()]; - - for (java.lang.String[] astr : _lsastr) { - if (null == astr || astr.length <= iColumn) return null; - - astrColumn[iRow++] = astr[iColumn]; - } - - return astrColumn; - } - - /** - * Retrieve the Array of Integer Values corresponding to the specified Column Index - * - * @param iColumn The Column Index - * - * @return The Array of Integers - */ - - public int[] intArrayAtColumn ( - final int iColumn) - { - if (0 > iColumn) return null; - - int iRow = 0; - - int[] ai = new int[_lsastr.size()]; - - for (java.lang.String[] astr : _lsastr) { - if (null == astr || astr.length <= iColumn) return null; - - ai[iRow++] = ToInteger (astr[iColumn]); - } - - return ai; - } - - /** - * Retrieve the Array of Double Values corresponding to the specified Column Index - * - * @param iColumn The Column Index - * @param dblScaler The Scaling Multiplier - * - * @return The Array of Doubles - */ - - public double[] doubleArrayAtColumn ( - final int iColumn, - final double dblScaler) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblScaler) || 0 > iColumn) return null; - - int iRow = 0; - - double[] adbl = new double[_lsastr.size()]; - - for (java.lang.String[] astr : _lsastr) { - if (null == astr || astr.length <= iColumn) return null; - - adbl[iRow++] = dblScaler * ToDouble (astr[iColumn]); - } - - return adbl; - } - - /** - * Retrieve the Array of Double Values corresponding to the specified Column Index - * - * @param iColumn The Column Index - * - * @return The Array of Doubles - */ - - public double[] doubleArrayAtColumn ( - final int iColumn) - { - return doubleArrayAtColumn (iColumn, 1.); - } - - /** - * Retrieve the Array of JulianDate corresponding to the specified Column Index - * - * @param iColumn The Column Index - * - * @return The Array of JulianDate - */ - - public org.drip.analytics.date.JulianDate[] dateArrayAtColumn ( - final int iColumn) - { - if (0 > iColumn) return null; - - int iRow = 0; - - org.drip.analytics.date.JulianDate[] adt = new org.drip.analytics.date.JulianDate[_lsastr.size()]; - - for (java.lang.String[] astr : _lsastr) { - if (null == astr || astr.length <= iColumn) return null; - - adt[iRow++] = ToDate (astr[iColumn]); - } - - return adt; - } - - /** - * Construct a Historical Map of Scaled/Keyed Double - * - * @param dblScaler The Scale to be applied - * - * @return Historical Map of Scaled/Keyed Double - */ - - public java.util.Map> - doubleMap ( - final double dblScaler) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblScaler) || null == _lsastr) return null; - - int iNumClose = _lsastr.size(); - - if (0 == iNumClose) return null; - - java.lang.String[] astrHeader = _lsastr.get (0); - - int iNumMark = astrHeader.length; - double adblHeader[] = new double[iNumMark]; - - for (int i = 1; i < iNumMark; ++i) { - if (null == astrHeader[i] || astrHeader[i].isEmpty()) return null; - - double dblHeader = java.lang.Double.NaN; - - java.lang.String strHeader = astrHeader[i].trim(); - - if (null == strHeader || strHeader.isEmpty()) return null; - - try { - dblHeader = new java.lang.Double (strHeader); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (!org.drip.quant.common.NumberUtil.IsValid (dblHeader)) return null; - - adblHeader[i] = dblHeader;; - } - - java.util.Map> - mapClose = new java.util.TreeMap>(); - - for (int i = 1; i < iNumClose; ++i) { - java.util.Map mapClosingMark = new - java.util.TreeMap(); - - java.lang.String[] astrClosingMark = _lsastr.get (i); - - for (int j = 1; j < iNumMark; ++j) { - double dblClosingMark = java.lang.Double.NaN; - - java.lang.String strClosingMark = null == astrClosingMark[j] || astrClosingMark[j].isEmpty() - ? null : astrClosingMark[j].trim(); - - try { - if (null != strClosingMark && !strClosingMark.isEmpty()) - dblClosingMark = new java.lang.Double (strClosingMark); - } catch (java.lang.Exception e) { - } - - if (org.drip.quant.common.NumberUtil.IsValid (dblClosingMark)) - mapClosingMark.put (adblHeader[j], dblScaler * dblClosingMark); - } - - if (0 != mapClosingMark.size()) - mapClose.put (org.drip.analytics.date.DateUtil.CreateFromDDMMMYYYY (astrClosingMark[0]), - mapClosingMark); - } - - return mapClose; - } - - /** - * Construct a Historical Map of Scaled/Keyed/Tenor Ordered Double - * - * @param dblScaler The Scale to be applied - * - * @return Historical Map of Scaled/Keyed/Tenor Ordered Double - */ - - public java.util.Map - groupedOrderedDouble ( - final double dblScaler) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblScaler) || null == _lsastr) return null; - - int iNumClose = _lsastr.size(); - - if (0 == iNumClose) return null; - - java.lang.String[] astrHeader = _lsastr.get (0); - - int iNumMark = astrHeader.length; - java.lang.String[] astrTenor = new java.lang.String[iNumMark - 1]; - java.lang.String[] astrInstrument = new java.lang.String[iNumMark - 1]; - - for (int i = 1; i < iNumMark; ++i) { - astrHeader[i].trim(); - - if (null == astrHeader[i] || astrHeader[i].isEmpty()) astrHeader[i] = "@:#"; - - java.lang.String[] astrInstrumentTenor = org.drip.quant.common.StringUtil.Split - (astrHeader[i].trim(), ":"); - - if (null == astrInstrumentTenor || 2 != astrInstrumentTenor.length) return null; - - astrTenor[i - 1] = astrInstrumentTenor[1]; - astrInstrument[i - 1] = astrInstrumentTenor[0]; - } - - java.util.Map - mapISTQ = new java.util.TreeMap(); - - for (int i = 1; i < iNumClose; ++i) { - java.lang.String[] astrClosingMark = _lsastr.get (i); - - org.drip.feed.loader.InstrumentSetTenorQuote istq = new - org.drip.feed.loader.InstrumentSetTenorQuote(); - - for (int j = 1; j < iNumMark; ++j) { - double dblClosingMark = java.lang.Double.NaN; - - java.lang.String strClosingMark = null == astrClosingMark[j] || astrClosingMark[j].isEmpty() - ? null : astrClosingMark[j].trim(); - - try { - if (null != strClosingMark && !strClosingMark.isEmpty()) - dblClosingMark = new java.lang.Double (strClosingMark); - } catch (java.lang.Exception e) { - } - - istq.add (astrInstrument[j - 1], astrTenor[j - 1], dblClosingMark, dblScaler); - } - - if (!istq.isEmpty()) - mapISTQ.put (org.drip.analytics.date.DateUtil.CreateFromDDMMMYYYY (astrClosingMark[0]), - istq); - } - - return mapISTQ; - } -} diff --git a/org/drip/feed/loader/CSVParser.java b/org/drip/feed/loader/CSVParser.java deleted file mode 100644 index 6aae457..0000000 --- a/org/drip/feed/loader/CSVParser.java +++ /dev/null @@ -1,143 +0,0 @@ - -package org.drip.feed.loader; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CSVParser Parses the Lines of a Comma Separated File into appropriate Data Types. - * - * @author Lakshmi Krishnamurthy - */ - -public class CSVParser { - - /** - * Parse the Contents of the CSV File into a List of String Arrays - * - * @param strCSVFile The CSV File - * @param bIgnoreHeader TRUE - Ignore the Leading Row as a Header - * - * @return List of String Arrays - */ - - @SuppressWarnings ("resource") public static final org.drip.feed.loader.CSVGrid StringGrid ( - final java.lang.String strCSVFile, - final boolean bIgnoreHeader) - { - if (null == strCSVFile || strCSVFile.isEmpty()) return null; - - boolean bHeader = true; - java.lang.String strCSVLine = ""; - java.io.BufferedReader brCSV = null; - - org.drip.feed.loader.CSVGrid csvGrid = new org.drip.feed.loader.CSVGrid(); - - try { - brCSV = new java.io.BufferedReader (new java.io.FileReader (strCSVFile)); - - while (null != (strCSVLine = brCSV.readLine())) { - java.lang.String[] astrValue = org.drip.quant.common.StringUtil.Split (strCSVLine, ","); - - if (null != astrValue && 0 != astrValue.length) { - if (!bHeader || !bIgnoreHeader) csvGrid.add (astrValue); - - bHeader = false; - } - } - - return csvGrid; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Parse the Contents of the CSV File into a List of Named String Arrays - * - * @param strCSVFile The CSV File - * - * @return List of String Arrays - */ - - @SuppressWarnings ("resource") public static final org.drip.feed.loader.CSVGrid NamedStringGrid ( - final java.lang.String strCSVFile) - { - if (null == strCSVFile || strCSVFile.isEmpty()) return null; - - boolean bHeader = true; - java.lang.String strCSVLine = ""; - java.io.BufferedReader brCSV = null; - - org.drip.feed.loader.CSVGrid csvGrid = new org.drip.feed.loader.CSVGrid(); - - try { - brCSV = new java.io.BufferedReader (new java.io.FileReader (strCSVFile)); - - while (null != (strCSVLine = brCSV.readLine())) { - java.lang.String[] astrValue = org.drip.quant.common.StringUtil.Split (strCSVLine, ","); - - if (null != astrValue && 0 != astrValue.length) { - if (bHeader) - csvGrid.setHeader (astrValue); - else - csvGrid.add (astrValue); - - bHeader = false; - } - } - - return csvGrid; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/feed/loader/CreditStaticAndMarks.java b/org/drip/feed/loader/CreditStaticAndMarks.java deleted file mode 100644 index 946049f..0000000 --- a/org/drip/feed/loader/CreditStaticAndMarks.java +++ /dev/null @@ -1,1959 +0,0 @@ - -package org.drip.feed.loader; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * CreditStaticAndMarks contains functionality to load a variety of Credit and Rates Product reference data - * and closing marks. It exposes the following functionality: - * - Load the bond reference data, static data, amortization schedule and EOS - * - Build the bond instance entities from the reference data - * - Load the bond, CDS, and Rates product Closing Marks. - * - Load and build the Holiday Calendars - * - * CreditStaticAndMarks assumes the appropriate connections are available to load the data. - * - * @author Lakshmi Krishnamurthy - */ - -class CreditStaticAndMarks { - private static final boolean m_bBlog = false; - private static java.lang.String INVALID_BBG_FIELD_START = "#N/A"; - - public static java.lang.String makeSQLClearISINOrCUSIP ( - final java.lang.String[] astrRecord) - { - if (null == astrRecord || 0 == astrRecord.length) return null; - - java.lang.String strISIN = astrRecord[1]; - java.lang.String strCUSIP = astrRecord[0]; - - if (null == strISIN || strISIN.isEmpty()) return null; - - if (null == strCUSIP || strCUSIP.isEmpty()) return null; - - java.lang.StringBuilder sb = new java.lang.StringBuilder(); - - sb.append ("delete from BondRef where ISIN = '").append (strISIN).append ("' or CUSIP = '").append - (strCUSIP).append ("'"); - - return sb.toString(); - } - - private static java.lang.String makeSQLClearMarksForBondDate ( - final java.lang.String[] astrRecord) - { - if (null == astrRecord || 0 == astrRecord.length) return null; - - java.lang.String strIDType = astrRecord[6]; - - if (null == strIDType || 0 == strIDType.length() || (!"ISIN".equalsIgnoreCase (strIDType) && - !"CUSIP".equalsIgnoreCase (strIDType))) { - System.out.println ("Unknown ID Type: " + strIDType); - - return null; - } - - java.lang.String strID = astrRecord[1]; - java.lang.String strORAMarkDate = ""; - - try { - strORAMarkDate = org.drip.analytics.date.DateUtil.MakeOracleDateFromBBGDate - (astrRecord[3].trim()); - } catch (java.lang.Exception e) { - System.out.println ("Bad mark date " + astrRecord[1] + " for " + strIDType + " " + strID); - - return null; - } - - java.lang.StringBuilder sb = new java.lang.StringBuilder(); - - sb.append ("delete from BondMarks where ID = '").append (strID).append ("' and MarkDate = '").append - (strORAMarkDate).append ("'"); - - return sb.toString(); - } - - private static java.lang.String makeSQLBondMarksInsert ( - final java.lang.String[] astrRecord) - { - if (null == astrRecord || 0 == astrRecord.length) return null; - - java.lang.String strIDType = astrRecord[6]; - - if (null == strIDType || 0 == strIDType.length() || (!"ISIN".equalsIgnoreCase (strIDType) && - !"CUSIP".equalsIgnoreCase (strIDType))) { - System.out.println ("Unknown ID Type: " + strIDType); - - return null; - } - - java.lang.String strID = astrRecord[1]; - java.lang.String strORAMarkDate = ""; - - try { - strORAMarkDate = org.drip.analytics.date.DateUtil.MakeOracleDateFromBBGDate (astrRecord[3].trim()); - } catch (java.lang.Exception e) { - System.out.println ("Bad mark date " + astrRecord[1] + " for " + strIDType + " " + strID); - - return null; - } - - double dblMarkValue = java.lang.Double.NaN; - - try { - dblMarkValue = new java.lang.Double (astrRecord[2].trim()).doubleValue(); - } catch (java.lang.Exception e) { - System.out.println ("Bad mark " + astrRecord[2] + " for " + strIDType + " " + strID); - - return null; - } - - java.lang.StringBuilder sb = new java.lang.StringBuilder(); - - sb.append ("insert into BondMarks values('").append (strIDType).append ("', '").append (strID).append - ("', '").append (strORAMarkDate).append ("', ").append (dblMarkValue).append (")"); - - return sb.toString(); - } - - private static java.lang.String makeSQLClear_FODATA ( - final java.lang.String[] astrValRecord) - { - if (null == astrValRecord || 0 == astrValRecord.length) return null; - - java.lang.String strISIN = astrValRecord[40]; - - if (null == strISIN || strISIN.isEmpty()) return null; - - return "delete from BondRef where ISIN = '" + strISIN + "'"; - } - - private static java.lang.String makeSQLInsert_FODATA ( - final java.lang.String[] astrValRecord) - { - if (null == astrValRecord || 0 == astrValRecord.length) return null; - - java.lang.String strCUSIP = astrValRecord[42]; - - if (null == strCUSIP || strCUSIP.isEmpty()) return null; - - java.lang.String strISIN = astrValRecord[40]; - - if (null == strISIN || strISIN.isEmpty()) return null; - - java.lang.String strName = astrValRecord[59]; - - if (null == strName || strName.isEmpty()) return null; - - java.lang.String strDescription = astrValRecord[59]; - - if (null == strDescription || strDescription.isEmpty()) return null; - - java.lang.String strTicker = astrValRecord[3]; - - if (null == strTicker || strTicker.isEmpty()) return null; - - double dblCoupon = 0.; - - try { - dblCoupon = new java.lang.Double (astrValRecord[4].trim()).doubleValue(); - } catch (java.lang.Exception e) { - if (m_bBlog) System.out.println ("Bad coupon " + astrValRecord[4] + " for ISIN " + strISIN); - } - - java.lang.String strOracleMaturity = ""; - - try { - strOracleMaturity = org.drip.analytics.date.DateUtil.MakeOracleDateFromBBGDate - (astrValRecord[5].trim()); - } catch (java.lang.Exception e) { - System.out.println ("Bad maturity " + astrValRecord[5] + " for ISIN " + strISIN); - - return null; - } - - java.lang.String strOracleAnnounce = ""; - - try { - strOracleAnnounce = org.drip.analytics.date.DateUtil.MakeOracleDateFromBBGDate - (astrValRecord[29].trim()); - } catch (java.lang.Exception e) { - if (m_bBlog) - System.out.println ("Bad announce date " + astrValRecord[29] + " for ISIN " + strISIN); - } - - java.lang.String strOracleFirstSettle = ""; - - try { - strOracleFirstSettle = org.drip.analytics.date.DateUtil.MakeOracleDateFromBBGDate - (astrValRecord[31].trim()); - } catch (java.lang.Exception e) { - System.out.println ("Bad first settle " + astrValRecord[31] + " for ISIN " + strISIN); - - return null; - } - - java.lang.String strOracleFirstCoupon = ""; - - try { - strOracleFirstCoupon = org.drip.analytics.date.DateUtil.MakeOracleDateFromBBGDate - (astrValRecord[33].trim()); - } catch (java.lang.Exception e) { - } - - if (null == strOracleFirstCoupon || strOracleFirstCoupon.isEmpty()) - strOracleFirstCoupon = strOracleFirstSettle; - - if (null == strOracleAnnounce || strOracleAnnounce.isEmpty()) - strOracleAnnounce = strOracleFirstCoupon; - - java.lang.String strCurrency = astrValRecord[67]; - - if (null == strCurrency || strCurrency.isEmpty()) return null; - - int iCouponFreq = 0; - - try { - iCouponFreq = (int) new java.lang.Double (astrValRecord[12].trim()).doubleValue(); - } catch (java.lang.Exception e) { - if (m_bBlog) - System.out.println ("Bad coupon freq " + astrValRecord[12] + " for ISIN " + strISIN); - } - - java.lang.String strDayCount = org.drip.analytics.support.Helper.GetDayCountFromBBGCode - (astrValRecord[16]); - - if (null == strDayCount || strDayCount.isEmpty()) return null; - - double dblFloatSpread = 0.; - - try { - dblFloatSpread = new java.lang.Double (astrValRecord[78].trim()).doubleValue(); - } catch (java.lang.Exception e) { - if (m_bBlog) - System.out.println ("Bad float spread " + astrValRecord[78] + " for ISIN " + strISIN); - } - - java.lang.String strRateIndex = - org.drip.analytics.support.Helper.RateIndexFromCcyAndCouponFreq (strCurrency, - iCouponFreq); - - java.lang.String strCalendar = astrValRecord[19]; - - if (strCalendar.startsWith (INVALID_BBG_FIELD_START)) strCalendar = ""; - - java.lang.String strMoodys = ""; - java.lang.String strSnP = ""; - java.lang.String strFitch = ""; - java.lang.String strIndustrySector = astrValRecord[54]; - java.lang.String strIndustryGroup = astrValRecord[55]; - java.lang.String strSnrSub = astrValRecord[20]; - java.lang.String strIssuer = astrValRecord[0]; - double dblAmountIssued = 0.; - - try { - dblAmountIssued = new java.lang.Double (astrValRecord[21].trim()).doubleValue(); - } catch (java.lang.Exception e) { - if (m_bBlog) System.out.println ("Bad issue amt " + astrValRecord[21] + " for ISIN " + strISIN); - } - - double dblAmountOutstanding = 0.; - - try { - dblAmountOutstanding = new java.lang.Double (astrValRecord[22].trim()).doubleValue(); - } catch (java.lang.Exception e) { - if (m_bBlog) - System.out.println ("Bad outstanding amt " + astrValRecord[22] + " for ISIN " + strISIN); - } - - java.lang.String strOracleIssue = ""; - - try { - strOracleIssue = org.drip.analytics.date.DateUtil.MakeOracleDateFromBBGDate - (astrValRecord[29].trim()); - } catch (java.lang.Exception e) { - if (m_bBlog) System.out.println ("Bad issue date " + astrValRecord[29] + " for ISIN " + strISIN); - } - - java.lang.String strCouponDates = ""; - java.lang.String strCouponFactors = ""; - java.lang.String strNotionalDates = ""; - java.lang.String strNotionalFactors = ""; - java.lang.String strIssuerSPN = ""; - java.lang.String strFloatQuote = "FullCoupon"; - - java.lang.StringBuilder sb = new java.lang.StringBuilder(); - - sb.append ("INSERT INTO BondRef VALUES ("); - - sb.append ("'" + strISIN + "',"); - - sb.append ("'" + strCUSIP + "',"); - - sb.append ("'" + strName + "',"); - - sb.append ("'" + strDescription + "',"); - - sb.append ("'" + strTicker + "',"); - - sb.append (dblCoupon + ","); - - sb.append ("'" + strOracleMaturity + "',"); - - sb.append ("'" + strOracleAnnounce + "',"); - - sb.append ("'" + strOracleFirstSettle + "',"); - - sb.append ("'" + strOracleFirstCoupon + "',"); - - sb.append ("'" + strCurrency + "',"); - - sb.append (iCouponFreq + ","); - - sb.append ("'" + strDayCount + "',"); - - sb.append (dblFloatSpread + ","); - - sb.append ("'" + strRateIndex + "',"); - - sb.append ("'" + strCalendar + "',"); - - sb.append ("'" + strMoodys + "',"); - - sb.append ("'" + strSnP + "',"); - - sb.append ("'" + strFitch + "',"); - - sb.append ("'" + strIndustrySector + "',"); - - sb.append ("'" + strIndustryGroup + "',"); - - sb.append ("'" + strSnrSub + "',"); - - sb.append ("'" + strIssuer + "',"); - - sb.append (dblAmountIssued + ","); - - sb.append (dblAmountOutstanding + ","); - - sb.append ("'" + strOracleIssue + "',"); - - sb.append ("'" + strCouponDates + "',"); - - sb.append ("'" + strCouponFactors + "',"); - - sb.append ("'" + strNotionalDates + "',"); - - sb.append ("'" + strNotionalFactors + "',"); - - sb.append ("'" + strIssuerSPN + "',"); - - sb.append ("'" + strFloatQuote + "')"); - - return sb.toString(); - } - - private static final java.lang.String ClearISINDateTypeFromEOS ( - final java.lang.String[] astrEOS) - { - java.lang.String strISIN = astrEOS[1].trim(); - - java.lang.String strOracleExerciseStartDate = ""; - - try { - strOracleExerciseStartDate = org.drip.analytics.date.DateUtil.MakeOracleDateFromBBGDate - (astrEOS[2].trim()); - } catch (java.lang.Exception e) { - System.out.println ("Bad exercise date " + astrEOS[2] + " for ISIN " + strISIN); - - return ""; - } - - java.lang.String strOracleExerciseEndDate = ""; - - try { - strOracleExerciseEndDate = org.drip.analytics.date.DateUtil.MakeOracleDateFromBBGDate - (astrEOS[4].trim()); - } catch (java.lang.Exception e) { - System.out.println ("Bad exercise date " + astrEOS[4] + " for ISIN " + strISIN); - - return ""; - } - - java.lang.String strCallOrPut = astrEOS[8].trim(); - - java.lang.String strEuroOrAmer = astrEOS[9].trim(); - - return "delete from EOS where ISIN = '" + strISIN + "' and ExerciseStartDate = '" + - strOracleExerciseStartDate + "' and ExerciseEndDate = '" + strOracleExerciseEndDate + - "' and CallOrPut = '" + strCallOrPut + "' and EuroAmer = '" + strEuroOrAmer + "'"; - } - - private static final java.lang.String InsertIntoEOS ( - final java.lang.String[] astrEOS) - { - java.lang.String strISIN = astrEOS[1].trim(); - - java.lang.String strOracleExerciseStartDate = ""; - - try { - strOracleExerciseStartDate = org.drip.analytics.date.DateUtil.MakeOracleDateFromBBGDate - (astrEOS[2].trim()); - } catch (java.lang.Exception e) { - System.out.println ("Bad exercise start " + astrEOS[2] + " for ISIN " + strISIN); - - return null; - } - - java.lang.String strOracleExerciseEndDate = ""; - - try { - strOracleExerciseEndDate = org.drip.analytics.date.DateUtil.MakeOracleDateFromBBGDate - (astrEOS[4].trim()); - } catch (java.lang.Exception e) { - System.out.println ("Bad exercise end " + astrEOS[4] + " for ISIN " + strISIN); - - return null; - } - - double dblExerciseFactor = java.lang.Double.NaN; - - try { - dblExerciseFactor = new java.lang.Double (astrEOS[6].trim()).doubleValue(); - } catch (java.lang.Exception e) { - System.out.println ("Bad exercise factor " + astrEOS[6] + " for ISIN " + strISIN); - - return null; - } - - java.lang.String strExerciseCallOrPut = astrEOS[8].trim(); - - java.lang.String strExerciseEuroOrAmer = astrEOS[9].trim(); - - java.lang.String strStrikeType = astrEOS[12].trim(); - - int iKnockoutOnDefault = 1; - - try { - iKnockoutOnDefault = (int) new java.lang.Double (astrEOS[13].trim()).doubleValue(); - } catch (java.lang.Exception e) { - System.out.println ("Bad knockout on default " + astrEOS[13] + " for ISIN " + strISIN); - - return null; - } - - return "insert into EOS values('" + strISIN + "', '" + strOracleExerciseStartDate + "', '" + - strOracleExerciseEndDate + "', " + dblExerciseFactor + ", '" + strExerciseCallOrPut + "', '" + - strExerciseEuroOrAmer + "', '" + strStrikeType + "', " + iKnockoutOnDefault + ", 'N')"; - } - - private static final java.lang.String ClearFromIREOD ( - final java.lang.String[] astrIREOD) - { - java.lang.String strType = astrIREOD[3].trim(); - - java.lang.String strCurrency = astrIREOD[4].trim(); - - java.lang.String strOracleCloseDate = ""; - - try { - strOracleCloseDate = org.drip.analytics.date.DateUtil.MakeOracleDateFromBBGDate - (astrIREOD[1].trim()); - } catch (java.lang.Exception e) { - System.out.println ("Bad date " + astrIREOD[1] + " for " + strCurrency); - - return null; - } - - return "delete from IR_EOD where EOD = '" + strOracleCloseDate + "' and Currency = '" + - strCurrency + "' and Type = '" + strType + "'"; - } - - private static final java.lang.String InsertIntoIREOD ( - final java.lang.String[] astrIREOD) - { - java.lang.String strType = astrIREOD[3].trim(); - - java.lang.String strCurrency = astrIREOD[4].trim(); - - java.lang.String strOracleCloseDate = ""; - double dbl1D = java.lang.Double.NaN; - double dbl1M = java.lang.Double.NaN; - double dbl2M = java.lang.Double.NaN; - double dbl3M = java.lang.Double.NaN; - double dbl4M = java.lang.Double.NaN; - double dbl5M = java.lang.Double.NaN; - double dbl6M = java.lang.Double.NaN; - double dbl9M = java.lang.Double.NaN; - double dbl1Y = java.lang.Double.NaN; - double dbl18M = java.lang.Double.NaN; - double dbl2Y = java.lang.Double.NaN; - double dbl3Y = java.lang.Double.NaN; - double dbl4Y = java.lang.Double.NaN; - double dbl5Y = java.lang.Double.NaN; - double dbl6Y = java.lang.Double.NaN; - double dbl7Y = java.lang.Double.NaN; - double dbl8Y = java.lang.Double.NaN; - double dbl9Y = java.lang.Double.NaN; - double dbl10Y = java.lang.Double.NaN; - double dbl12Y = java.lang.Double.NaN; - double dbl15Y = java.lang.Double.NaN; - double dbl20Y = java.lang.Double.NaN; - double dbl25Y = java.lang.Double.NaN; - double dbl30Y = java.lang.Double.NaN; - double dbl40Y = java.lang.Double.NaN; - - try { - strOracleCloseDate = org.drip.analytics.date.DateUtil.MakeOracleDateFromBBGDate - (astrIREOD[1].trim()); - - dbl1D = new java.lang.Double (astrIREOD[5].trim()).doubleValue(); - - dbl1M = new java.lang.Double (astrIREOD[6].trim()).doubleValue(); - - dbl2M = new java.lang.Double (astrIREOD[7].trim()).doubleValue(); - - dbl3M = new java.lang.Double (astrIREOD[8].trim()).doubleValue(); - - dbl4M = new java.lang.Double (astrIREOD[9].trim()).doubleValue(); - - dbl5M = new java.lang.Double (astrIREOD[10].trim()).doubleValue(); - - dbl6M = new java.lang.Double (astrIREOD[11].trim()).doubleValue(); - - dbl9M = new java.lang.Double (astrIREOD[12].trim()).doubleValue(); - - dbl1Y = new java.lang.Double (astrIREOD[13].trim()).doubleValue(); - - dbl18M = new java.lang.Double (astrIREOD[14].trim()).doubleValue(); - - dbl2Y = new java.lang.Double (astrIREOD[15].trim()).doubleValue(); - - dbl3Y = new java.lang.Double (astrIREOD[16].trim()).doubleValue(); - - dbl4Y = new java.lang.Double (astrIREOD[17].trim()).doubleValue(); - - dbl5Y = new java.lang.Double (astrIREOD[18].trim()).doubleValue(); - - dbl6Y = new java.lang.Double (astrIREOD[19].trim()).doubleValue(); - - dbl7Y = new java.lang.Double (astrIREOD[20].trim()).doubleValue(); - - dbl8Y = new java.lang.Double (astrIREOD[21].trim()).doubleValue(); - - dbl9Y = new java.lang.Double (astrIREOD[22].trim()).doubleValue(); - - dbl10Y = new java.lang.Double (astrIREOD[23].trim()).doubleValue(); - - dbl12Y = new java.lang.Double (astrIREOD[24].trim()).doubleValue(); - - dbl15Y = new java.lang.Double (astrIREOD[25].trim()).doubleValue(); - - dbl20Y = new java.lang.Double (astrIREOD[26].trim()).doubleValue(); - - dbl25Y = new java.lang.Double (astrIREOD[27].trim()).doubleValue(); - - dbl30Y = new java.lang.Double (astrIREOD[28].trim()).doubleValue(); - - dbl40Y = new java.lang.Double (astrIREOD[29].trim()).doubleValue(); - } catch (java.lang.Exception e) { - System.out.println ("Bad input marks for ccy " + strCurrency); - - return null; - } - - java.lang.String str1DType = astrIREOD[30].trim(); - - java.lang.String str1MType = astrIREOD[31].trim(); - - java.lang.String str2MType = astrIREOD[32].trim(); - - java.lang.String str3MType = astrIREOD[33].trim(); - - java.lang.String str4MType = astrIREOD[34].trim(); - - java.lang.String str5MType = astrIREOD[35].trim(); - - java.lang.String str6MType = astrIREOD[36].trim(); - - java.lang.String str9MType = astrIREOD[37].trim(); - - java.lang.String str1YType = astrIREOD[38].trim(); - - java.lang.String str18MType = astrIREOD[39].trim(); - - java.lang.String str2YType = astrIREOD[40].trim(); - - java.lang.String str3YType = astrIREOD[41].trim(); - - java.lang.String str4YType = astrIREOD[42].trim(); - - java.lang.String str5YType = astrIREOD[43].trim(); - - java.lang.String str6YType = astrIREOD[44].trim(); - - java.lang.String str7YType = astrIREOD[45].trim(); - - java.lang.String str8YType = astrIREOD[46].trim(); - - java.lang.String str9YType = astrIREOD[47].trim(); - - java.lang.String str10YType = astrIREOD[48].trim(); - - java.lang.String str12YType = astrIREOD[49].trim(); - - java.lang.String str15YType = astrIREOD[50].trim(); - - java.lang.String str20YType = astrIREOD[51].trim(); - - java.lang.String str25YType = astrIREOD[52].trim(); - - java.lang.String str30YType = astrIREOD[53].trim(); - - java.lang.String str40YType = astrIREOD[54].trim(); - - java.lang.StringBuilder sbInsertIREOD = new java.lang.StringBuilder(); - - sbInsertIREOD.append ("insert into IR_EOD values("); - - sbInsertIREOD.append ("'").append (strOracleCloseDate).append ("', "); - - sbInsertIREOD.append ("'").append (strType).append ("', "); - - sbInsertIREOD.append ("'").append (strCurrency).append ("', "); - - sbInsertIREOD.append (dbl1D).append (", "); - - sbInsertIREOD.append (dbl1M).append (", "); - - sbInsertIREOD.append (dbl2M).append (", "); - - sbInsertIREOD.append (dbl3M).append (", "); - - sbInsertIREOD.append (dbl4M).append (", "); - - sbInsertIREOD.append (dbl5M).append (", "); - - sbInsertIREOD.append (dbl6M).append (", "); - - sbInsertIREOD.append (dbl9M).append (", "); - - sbInsertIREOD.append (dbl1Y).append (", "); - - sbInsertIREOD.append (dbl18M).append (", "); - - sbInsertIREOD.append (dbl2Y).append (", "); - - sbInsertIREOD.append (dbl3Y).append (", "); - - sbInsertIREOD.append (dbl4Y).append (", "); - - sbInsertIREOD.append (dbl5Y).append (", "); - - sbInsertIREOD.append (dbl6Y).append (", "); - - sbInsertIREOD.append (dbl7Y).append (", "); - - sbInsertIREOD.append (dbl8Y).append (", "); - - sbInsertIREOD.append (dbl9Y).append (", "); - - sbInsertIREOD.append (dbl10Y).append (", "); - - sbInsertIREOD.append (dbl12Y).append (", "); - - sbInsertIREOD.append (dbl15Y).append (", "); - - sbInsertIREOD.append (dbl20Y).append (", "); - - sbInsertIREOD.append (dbl25Y).append (", "); - - sbInsertIREOD.append (dbl30Y).append (", "); - - sbInsertIREOD.append (dbl40Y).append (", "); - - sbInsertIREOD.append ("'").append (str1DType).append ("', "); - - sbInsertIREOD.append ("'").append (str1MType).append ("', "); - - sbInsertIREOD.append ("'").append (str2MType).append ("', "); - - sbInsertIREOD.append ("'").append (str3MType).append ("', "); - - sbInsertIREOD.append ("'").append (str4MType).append ("', "); - - sbInsertIREOD.append ("'").append (str5MType).append ("', "); - - sbInsertIREOD.append ("'").append (str6MType).append ("', "); - - sbInsertIREOD.append ("'").append (str9MType).append ("', "); - - sbInsertIREOD.append ("'").append (str1YType).append ("', "); - - sbInsertIREOD.append ("'").append (str18MType).append ("', "); - - sbInsertIREOD.append ("'").append (str2YType).append ("', "); - - sbInsertIREOD.append ("'").append (str3YType).append ("', "); - - sbInsertIREOD.append ("'").append (str4YType).append ("', "); - - sbInsertIREOD.append ("'").append (str5YType).append ("', "); - - sbInsertIREOD.append ("'").append (str6YType).append ("', "); - - sbInsertIREOD.append ("'").append (str7YType).append ("', "); - - sbInsertIREOD.append ("'").append (str8YType).append ("', "); - - sbInsertIREOD.append ("'").append (str9YType).append ("', "); - - sbInsertIREOD.append ("'").append (str10YType).append ("', "); - - sbInsertIREOD.append ("'").append (str12YType).append ("', "); - - sbInsertIREOD.append ("'").append (str15YType).append ("', "); - - sbInsertIREOD.append ("'").append (str20YType).append ("', "); - - sbInsertIREOD.append ("'").append (str25YType).append ("', "); - - sbInsertIREOD.append ("'").append (str30YType).append ("', "); - - sbInsertIREOD.append ("'").append (str40YType).append ("')"); - - return sbInsertIREOD.toString(); - } - - private static final java.lang.String ClearFromCREOD ( - final java.lang.String[] astrCREOD) - { - java.lang.String strSPN = astrCREOD[6].trim(); - - java.lang.String strOracleCloseDate = ""; - - try { - strOracleCloseDate = org.drip.analytics.date.DateUtil.MakeOracleDateFromBBGDate - (astrCREOD[2].trim()); - } catch (java.lang.Exception e) { - System.out.println ("Bad date " + astrCREOD[2] + " for " + strSPN); - - return null; - } - - return "delete from CR_EOD where EOD = '" + strOracleCloseDate + "' and SPN = '" + strSPN + "'"; - } - - private static final java.lang.String InsertIntoCREOD ( - final java.lang.String[] astrCREOD) - { - java.lang.String strName = astrCREOD[4].trim(); - - java.lang.String strSPN = astrCREOD[6].trim(); - - java.lang.String strOracleCloseDate = ""; - double dblRecRate = java.lang.Double.NaN; - double dblCR3M = java.lang.Double.NaN; - double dblCR6M = java.lang.Double.NaN; - double dblCR9M = java.lang.Double.NaN; - double dblCR1Y = java.lang.Double.NaN; - double dblCR18M = java.lang.Double.NaN; - double dblCR2Y = java.lang.Double.NaN; - double dblCR3Y = java.lang.Double.NaN; - double dblCR4Y = java.lang.Double.NaN; - double dblCR5Y = java.lang.Double.NaN; - double dblCR6Y = java.lang.Double.NaN; - double dblCR7Y = java.lang.Double.NaN; - double dblCR8Y = java.lang.Double.NaN; - double dblCR9Y = java.lang.Double.NaN; - double dblCR10Y = java.lang.Double.NaN; - double dblCR11Y = java.lang.Double.NaN; - double dblCR12Y = java.lang.Double.NaN; - double dblCR15Y = java.lang.Double.NaN; - double dblCR20Y = java.lang.Double.NaN; - double dblCR30Y = java.lang.Double.NaN; - double dblCR40Y = java.lang.Double.NaN; - - try { - strOracleCloseDate = org.drip.analytics.date.DateUtil.MakeOracleDateFromBBGDate - (astrCREOD[2].trim()); - - dblRecRate = new java.lang.Double (astrCREOD[7].trim()).doubleValue(); - - dblCR3M = new java.lang.Double (astrCREOD[8].trim()).doubleValue(); - - dblCR6M = new java.lang.Double (astrCREOD[9].trim()).doubleValue(); - - dblCR9M = new java.lang.Double (astrCREOD[10].trim()).doubleValue(); - - dblCR1Y = new java.lang.Double (astrCREOD[11].trim()).doubleValue(); - - dblCR18M = new java.lang.Double (astrCREOD[12].trim()).doubleValue(); - - dblCR2Y = new java.lang.Double (astrCREOD[13].trim()).doubleValue(); - - dblCR3Y = new java.lang.Double (astrCREOD[14].trim()).doubleValue(); - - dblCR4Y = new java.lang.Double (astrCREOD[15].trim()).doubleValue(); - - dblCR5Y = new java.lang.Double (astrCREOD[16].trim()).doubleValue(); - - dblCR6Y = new java.lang.Double (astrCREOD[17].trim()).doubleValue(); - - dblCR7Y = new java.lang.Double (astrCREOD[18].trim()).doubleValue(); - - dblCR8Y = new java.lang.Double (astrCREOD[19].trim()).doubleValue(); - - dblCR9Y = new java.lang.Double (astrCREOD[20].trim()).doubleValue(); - - dblCR10Y = new java.lang.Double (astrCREOD[21].trim()).doubleValue(); - - dblCR11Y = new java.lang.Double (astrCREOD[22].trim()).doubleValue(); - - dblCR12Y = new java.lang.Double (astrCREOD[23].trim()).doubleValue(); - - dblCR15Y = new java.lang.Double (astrCREOD[26].trim()).doubleValue(); - - dblCR20Y = new java.lang.Double (astrCREOD[31].trim()).doubleValue(); - - dblCR30Y = new java.lang.Double (astrCREOD[37].trim()).doubleValue(); - - dblCR40Y = new java.lang.Double (astrCREOD[39].trim()).doubleValue(); - } catch (java.lang.Exception e) { - System.out.println ("Bad input marks for SPN " + strSPN); - - e.printStackTrace(); - - return null; - } - - java.lang.StringBuilder sb = new java.lang.StringBuilder(); - - sb.append ("insert into CR_EOD values("); - - sb.append ("'" + strOracleCloseDate + "', "); - - sb.append ("'" + strName + "', "); - - sb.append ("'" + strSPN + "', "); - - sb.append (dblRecRate + ", "); - - sb.append (dblCR3M + ", "); - - sb.append (dblCR6M + ", "); - - sb.append (dblCR9M + ", "); - - sb.append (dblCR1Y + ", "); - - sb.append (dblCR18M + ", "); - - sb.append (dblCR2Y + ", "); - - sb.append (dblCR3Y + ", "); - - sb.append (dblCR4Y + ", "); - - sb.append (dblCR5Y + ", "); - - sb.append (dblCR6Y + ", "); - - sb.append (dblCR7Y + ", "); - - sb.append (dblCR8Y + ", "); - - sb.append (dblCR9Y + ", "); - - sb.append (dblCR10Y + ", "); - - sb.append (dblCR11Y + ", "); - - sb.append (dblCR12Y + ", "); - - sb.append (dblCR15Y + ", "); - - sb.append (dblCR20Y + ", "); - - sb.append (dblCR30Y + ", "); - - sb.append (dblCR40Y + ")"); - - return sb.toString(); - } - - private static java.lang.String makeSQLClearISIN2 ( - final java.lang.String[] astrBondRef2) - { - java.lang.String strISIN = astrBondRef2[0]; - - if (null == strISIN || strISIN.isEmpty()) return null; - - return "delete from BondRef where ISIN = '" + strISIN + "'"; - } - - private static java.lang.String makeSQLInsert2 ( - final java.lang.String[] astrBondRef2) - { - java.lang.String strCUSIP = astrBondRef2[40]; - - if (null == strCUSIP || strCUSIP.isEmpty()) return null; - - java.lang.String strISIN = astrBondRef2[0]; - - if (null == strISIN || strISIN.isEmpty()) return null; - - java.lang.String strName = astrBondRef2[2]; - - if (null == strName || strName.isEmpty()) return null; - - java.lang.String strDescription = astrBondRef2[2]; - - if (null == strDescription || strDescription.isEmpty()) return null; - - System.out.println (astrBondRef2[1]); - - java.lang.String[] astrTicker = astrBondRef2[1].split (" "); - - java.lang.String strTicker = astrTicker[0]; - double dblCoupon = 0.; - - try { - dblCoupon = new java.lang.Double (astrBondRef2[11].trim()).doubleValue(); - } catch (java.lang.Exception e) { - if (m_bBlog) System.out.println ("Bad coupon " + astrBondRef2[11] + " for ISIN " + strISIN); - } - - java.lang.String strOracleMaturity = ""; - - try { - strOracleMaturity = org.drip.analytics.date.DateUtil.MakeOracleDateFromBBGDate - (astrBondRef2[8].trim()); - } catch (java.lang.Exception e) { - System.out.println ("Bad maturity " + astrBondRef2[8] + " for ISIN " + strISIN); - - return null; - } - - java.lang.String strOracleFirstSettle = ""; - - try { - strOracleFirstSettle = org.drip.analytics.date.DateUtil.MakeOracleDateFromBBGDate - (astrBondRef2[6].trim()); - } catch (java.lang.Exception e) { - System.out.println ("Bad first settle " + astrBondRef2[6] + " for ISIN " + strISIN); - - return null; - } - - java.lang.String strOracleFirstCoupon = ""; - - try { - strOracleFirstCoupon = org.drip.analytics.date.DateUtil.MakeOracleDateFromBBGDate - (astrBondRef2[6].trim()); - } catch (java.lang.Exception e) { - System.out.println ("Bad first coupon " + astrBondRef2[6] + " for ISIN " + strISIN); - - return null; - } - - java.lang.String strOracleAnnounce = strOracleFirstCoupon; - - java.lang.String strCurrency = astrBondRef2[5]; - - if (null == strCurrency || strCurrency.isEmpty()) return null; - - int iCouponFreq = 0; - - java.lang.String strCouponFreq = astrBondRef2[13]; - - if ("A".equalsIgnoreCase (strCouponFreq)) - iCouponFreq = 1; - else if ("M".equalsIgnoreCase (strCouponFreq)) - iCouponFreq = 12; - else if ("Q".equalsIgnoreCase (strCouponFreq)) - iCouponFreq = 4; - else if ("S".equalsIgnoreCase (strCouponFreq)) - iCouponFreq = 2; - - java.lang.String strDayCount = astrBondRef2[14]; - - if (null == strDayCount || strDayCount.isEmpty()) return null; - - double dblFloatSpread = 0.; - - try { - dblFloatSpread = new java.lang.Double (astrBondRef2[12].trim()).doubleValue(); - } catch (java.lang.Exception e) { - if (m_bBlog) - System.out.println ("Bad float spread " + astrBondRef2[12] + " for ISIN " + strISIN); - } - - java.lang.String strRateIndex = ""; - java.lang.String strCalendar = astrBondRef2[5]; - - if (strCalendar.startsWith (INVALID_BBG_FIELD_START)) strCalendar = ""; - - java.lang.String strMoodys = ""; - java.lang.String strSnP = ""; - java.lang.String strFitch = ""; - java.lang.String strIndustrySector = ""; - java.lang.String strIndustryGroup = ""; - java.lang.String strSnrSub = ""; - java.lang.String strIssuer = astrBondRef2[2]; - double dblAmountIssued = 0.; - double dblAmountOutstanding = 0.; - java.lang.String strOracleIssue = ""; - - try { - strOracleIssue = org.drip.analytics.date.DateUtil.MakeOracleDateFromBBGDate - (astrBondRef2[6].trim()); - } catch (java.lang.Exception e) { - if (m_bBlog) System.out.println ("Bad issue date " + astrBondRef2[6] + " for ISIN " + strISIN); - } - - java.lang.String strCouponDates = ""; - java.lang.String strCouponFactors = ""; - java.lang.String strNotionalDates = ""; - java.lang.String strNotionalFactors = ""; - java.lang.String strIssuerSPN = astrBondRef2[3]; - java.lang.String strFloatQuote = ""; - - java.lang.StringBuilder sb = new java.lang.StringBuilder(); - - sb.append ("INSERT INTO BondRef VALUES ("); - - sb.append ("'" + strISIN + "',"); - - sb.append ("'" + strCUSIP + "',"); - - sb.append ("'" + strName + "',"); - - sb.append ("'" + strDescription + "',"); - - sb.append ("'" + strTicker + "',"); - - sb.append (dblCoupon + ","); - - sb.append ("'" + strOracleMaturity + "',"); - - sb.append ("'" + strOracleAnnounce + "',"); - - sb.append ("'" + strOracleFirstSettle + "',"); - - sb.append ("'" + strOracleFirstCoupon + "',"); - - sb.append ("'" + strCurrency + "',"); - - sb.append (iCouponFreq + ","); - - sb.append ("'" + strDayCount + "',"); - - sb.append (dblFloatSpread + ","); - - sb.append ("'" + strRateIndex + "',"); - - sb.append ("'" + strCalendar + "',"); - - sb.append ("'" + strMoodys + "',"); - - sb.append ("'" + strSnP + "',"); - - sb.append ("'" + strFitch + "',"); - - sb.append ("'" + strIndustrySector + "',"); - - sb.append ("'" + strIndustryGroup + "',"); - - sb.append ("'" + strSnrSub + "',"); - - sb.append ("'" + strIssuer + "',"); - - sb.append (dblAmountIssued + ","); - - sb.append (dblAmountOutstanding + ","); - - sb.append ("'" + strOracleIssue + "',"); - - sb.append ("'" + strCouponDates + "',"); - - sb.append ("'" + strCouponFactors + "',"); - - sb.append ("'" + strNotionalDates + "',"); - - sb.append ("'" + strNotionalFactors + "',"); - - sb.append ("'" + strIssuerSPN + "',"); - - sb.append ("'" + strFloatQuote + "')"); - - return sb.toString(); - } - - private static java.lang.String makeSQLClearAmortScheduleEntry ( - final java.lang.String[] astrAmortizationSchedule) - { - if (null == astrAmortizationSchedule || 5 != astrAmortizationSchedule.length) return null; - - java.lang.String strOracleAmortizationDate = ""; - - java.lang.String strCUSIP = astrAmortizationSchedule[1].trim(); - - if (null == strCUSIP || strCUSIP.isEmpty()) return null; - - java.lang.StringBuilder sb = new java.lang.StringBuilder(); - - try { - strOracleAmortizationDate = org.drip.analytics.date.DateUtil.MakeOracleDateFromBBGDate - (astrAmortizationSchedule[2].trim()); - } catch (java.lang.Exception e) { - System.out.println ("Bad date " + astrAmortizationSchedule[2] + " for CUSIP " + strCUSIP); - - return null; - } - - sb.append ("delete from AmortizationSchedule where CUSIP = '").append (strCUSIP).append - ("' and AmortDate = '").append (strOracleAmortizationDate).append ("'"); - - return sb.toString(); - } - - private static final java.lang.String InsertIntoAmortizationSchedule ( - final java.lang.String[] astrAmortizationSchedule) - { - if (null == astrAmortizationSchedule || 5 != astrAmortizationSchedule.length) return null; - - java.lang.String strCUSIP = astrAmortizationSchedule[1].trim(); - - java.lang.String strOracleAmortizationDate = ""; - double dblPrincipalPaydown = java.lang.Double.NaN; - - try { - strOracleAmortizationDate = org.drip.analytics.date.DateUtil.MakeOracleDateFromBBGDate - (astrAmortizationSchedule[2].trim()); - } catch (java.lang.Exception e) { - System.out.println ("Bad date " + astrAmortizationSchedule[2] + " for CUSIP " + strCUSIP); - - return null; - } - - try { - dblPrincipalPaydown = new java.lang.Double (astrAmortizationSchedule[4].trim()); - } catch (java.lang.Exception e) { - System.out.println ("Bad paydown factor " + astrAmortizationSchedule[4] + " for CUSIP " + - strCUSIP); - - return null; - } - - return "insert into AmortizationSchedule values('" + strCUSIP + "', '" + strOracleAmortizationDate + - "', " + dblPrincipalPaydown + ")"; - } - - private static void LoadBondRef() - throws java.lang.Exception - { - /* int iNumBonds = 0; - java.lang.String strValDataLine = ""; - java.io.BufferedReader inValData = null; - - System.out.println ("Loading BondRef ..."); - - oracle.jdbc.pool.OracleDataSource ds = new oracle.jdbc.pool.OracleDataSource(); - - ds.setDriverType ("thin"); - - ds.setServerName ("localhost"); - - ds.setPortNumber (1521); - - ds.setDatabaseName ("XE"); - - ds.setUser ("hr"); - - ds.setPassword ("hr"); - - java.sql.Connection con = ds.getConnection(); - - java.sql.Statement stmt = con.createStatement(); - - try { - inValData = new java.io.BufferedReader (new java.io.FileReader - ("c:\\Lakshmi\\java\\BondAnal\\Data\\BondStaticRef\\FullTickers_Base\\RefDataSet.csv")); - } catch (java.lang.Exception e) { - System.out.println ("Cannot open Val Data record file"); - - return; - } - - while (null != (strValDataLine = inValData.readLine())) { - int iNumRecord = 0; - java.lang.String astrValRecord[] = new java.lang.String[33]; - - java.util.StringTokenizer stValData = new java.util.StringTokenizer (strValDataLine, ","); - - while (stValData.hasMoreTokens()) { - java.lang.String stValDataField = stValData.nextToken(); - - astrValRecord[iNumRecord++] = stValDataField; - } - - java.lang.String strSQLClear = makeSQLClearISINOrCUSIP (astrValRecord); - - if (null != strSQLClear) stmt.executeUpdate (strSQLClear); - - java.lang.String strSQLInsert = makeSQLInsert (astrValRecord); - - if (null != strSQLInsert) { - if (m_bBlog) System.out.println ("SQL[" + iNumBonds + "]: " + strSQLInsert); - - stmt.executeUpdate (strSQLInsert); - } - - ++iNumBonds; - } - - inValData.close(); - - System.out.println ("Loaded " + iNumBonds + " into BondRef."); */ - } - - private static void LoadBondRef2() - throws java.lang.Exception - { - int iNumBonds = 0; - java.lang.String strBondRef2Line = ""; - java.io.BufferedReader inBondRef2 = null; - - System.out.println ("Loading BondRef2 ..."); - - java.sql.Statement stmt = org.drip.param.config.ConfigLoader.OracleInit - ("c:\\Lakshmi\\java\\BondAnal\\Config.xml"); - - try { - inBondRef2 = new java.io.BufferedReader (new java.io.FileReader - ("C:\\Lakshmi\\RefDataAndMarks\\17Jan2012\\Bond.csv")); - } catch (java.lang.Exception e) { - System.out.println ("Cannot open BondRef record file"); - - return; - } - - while (null != (strBondRef2Line = inBondRef2.readLine())) { - java.lang.String[] astrBondRef2Record = strBondRef2Line.split (","); - - java.lang.String strSQLClear = makeSQLClearISIN2 (astrBondRef2Record); - - if (null != strSQLClear) stmt.executeUpdate (strSQLClear); - - java.lang.String strSQLInsert = makeSQLInsert2 (astrBondRef2Record); - - if (null != strSQLInsert) { - if (m_bBlog) System.out.println ("SQL[" + iNumBonds + "]: " + strSQLInsert); - - stmt.executeUpdate (strSQLInsert); - } - - ++iNumBonds; - } - - inBondRef2.close(); - - System.out.println ("Loaded " + iNumBonds + " into BondRef2"); - } - - private static void LoadBondRef_FODATA() - throws java.lang.Exception - { - int iNumBonds = 0; - java.lang.String strBondRefLine = ""; - java.io.BufferedReader inBondRef = null; - - System.out.println ("Loading BondRef_FODATA ..."); - - java.sql.Statement stmt = org.drip.param.config.ConfigLoader.OracleInit - ("c:\\Lakshmi\\java\\BondAnal\\Config.xml"); - - try { - inBondRef = new java.io.BufferedReader (new java.io.FileReader - ("C:\\Lakshmi\\RefDataAndMarks\\17Jan2012\\Bond.csv")); - } catch (java.lang.Exception e) { - System.out.println ("Cannot open BondRef record file"); - - return; - } - - while (null != (strBondRefLine = inBondRef.readLine())) { - java.lang.String[] astrBondRefRecord = strBondRefLine.split (","); - - java.lang.String strSQLClear = makeSQLClear_FODATA (astrBondRefRecord); - - if (null != strSQLClear) stmt.executeUpdate (strSQLClear); - - java.lang.String strSQLInsert = makeSQLInsert_FODATA (astrBondRefRecord); - - if (null != strSQLInsert) { - if (m_bBlog) System.out.println ("SQL[" + iNumBonds + "]: " + strSQLInsert); - - stmt.executeUpdate (strSQLInsert); - } - - ++iNumBonds; - } - - inBondRef.close(); - - System.out.println ("Loaded " + iNumBonds + " into BondRef_FODATA"); - } - - private static void LoadBondMarks() - throws java.lang.Exception - { - int iNumMarks = 0; - java.lang.String strMarksLine = ""; - java.io.BufferedReader inMarks = null; - - System.out.println ("Loading BondMark ..."); - - java.sql.Statement stmt = org.drip.param.config.ConfigLoader.OracleInit - ("c:\\Lakshmi\\java\\BondAnal\\Config.xml"); - - try { - inMarks = new java.io.BufferedReader (new java.io.FileReader - ("c:\\Lakshmi\\java\\BondAnal\\Data\\BondStaticRef\\Marks\\MatrixPricer_Prices_0715.csv")); - } catch (java.lang.Exception e) { - System.out.println ("Cannot open marks file"); - - return; - } - - while (null != (strMarksLine = inMarks.readLine())) { - int iNumMarksRecord = 0; - java.lang.String astrMarks[] = new java.lang.String[9]; - - java.util.StringTokenizer stMarks = new java.util.StringTokenizer (strMarksLine, ","); - - while (stMarks.hasMoreTokens()) { - java.lang.String strMarks = stMarks.nextToken(); - - astrMarks[iNumMarksRecord++] = strMarks; - } - - java.lang.String strSQLClearMarks = makeSQLClearMarksForBondDate (astrMarks); - - if (null != strSQLClearMarks) { - if (m_bBlog) System.out.println ("SQL[" + iNumMarks + "]: " + strSQLClearMarks); - - stmt.executeUpdate (strSQLClearMarks); - } - - java.lang.String strSQLInsertMarks = makeSQLBondMarksInsert (astrMarks); - - if (null != strSQLInsertMarks) { - if (m_bBlog) System.out.println ("SQL[" + iNumMarks + "]: " + strSQLInsertMarks); - - stmt.executeUpdate (strSQLInsertMarks); - } - - ++iNumMarks; - } - - inMarks.close(); - - System.out.println ("Loaded " + iNumMarks + " into BondMark."); - } - - private static void LoadHolidayCalendar ( - final java.lang.String strHolLoc, - final java.lang.String strHolLocFile) - throws java.lang.Exception - { - java.lang.String strHolsLine = ""; - java.io.BufferedReader inHolCal = null; - - System.out.println ("Loading " + strHolLoc + " from " + strHolLocFile); - - java.sql.Statement stmt = org.drip.param.config.ConfigLoader.OracleInit - ("c:\\Lakshmi\\java\\BondAnal\\Config.xml"); - - try { - inHolCal = new java.io.BufferedReader (new java.io.FileReader (strHolLocFile)); - } catch (java.lang.Exception e) { - System.out.println ("Cannot open hol cal file"); - - return; - } - - while (null != (strHolsLine = inHolCal.readLine())) { - java.util.StringTokenizer stHolFields = new java.util.StringTokenizer (strHolsLine, " "); - - try { - int iFieldNum = 0; - java.lang.String[] astrHolFields = new java.lang.String[2]; - astrHolFields[0] = ""; - astrHolFields[1] = ""; - java.lang.String strORAHoliday = ""; - - while (stHolFields.hasMoreTokens() && iFieldNum < astrHolFields.length) - astrHolFields[iFieldNum++] = stHolFields.nextToken(); - - java.lang.String strTextHol = astrHolFields[0].trim(); - - try { - strORAHoliday = org.drip.analytics.date.DateUtil.MakeOracleDateFromYYYYMMDD (strTextHol); - } catch (java.lang.Exception e) { - java.util.StringTokenizer stTextHol = new java.util.StringTokenizer (strTextHol, " "); - - strORAHoliday = org.drip.analytics.date.DateUtil.MakeOracleDateFromYYYYMMDD - (stTextHol.nextToken().trim()); - } - - java.lang.String strDescription = astrHolFields[1].trim(); - - if (null != strDescription && !strDescription.isEmpty()) - strDescription = strDescription.replaceAll ("'", ""); - else - strDescription = ""; - - stmt.executeUpdate ("delete from Holidays where Location = '" + strHolLoc + - "' and Holiday = '" + strORAHoliday + "'"); - - stmt.executeUpdate ("insert into Holidays values('" + strHolLoc + "', '" + strORAHoliday + - "', '" + strDescription + "')"); - } catch (java.lang.Exception e) { - System.out.println (strHolLoc + ": Check line " + strHolsLine); - } - } - - inHolCal.close(); - } - - private static void LoadHolsToHolderSource ( - final java.io.BufferedWriter bw, - final java.lang.String strHolLoc, - final java.lang.String strHolLocFile) - throws java.lang.Exception - { - java.lang.String strHolsLine = ""; - java.io.BufferedReader inHolCal = null; - - System.out.println ("Loading " + strHolLoc + " from " + strHolLocFile); - - try { - inHolCal = new java.io.BufferedReader (new java.io.FileReader (strHolLocFile)); - } catch (java.lang.Exception e) { - System.out.println ("Cannot open hol cal file"); - - return; - } - - while (null != (strHolsLine = inHolCal.readLine())) { - java.util.StringTokenizer stHolFields = new java.util.StringTokenizer (strHolsLine, " "); - - try { - java.lang.String[] astrHolFields = new java.lang.String[2]; - java.lang.String strORAHoliday = ""; - astrHolFields[0] = ""; - astrHolFields[1] = ""; - int iFieldNum = 0; - - while (stHolFields.hasMoreTokens() && iFieldNum < astrHolFields.length) - astrHolFields[iFieldNum++] = stHolFields.nextToken(); - - java.lang.String strTextHol = astrHolFields[0].trim(); - - try { - strORAHoliday = org.drip.analytics.date.DateUtil.MakeOracleDateFromYYYYMMDD (strTextHol); - } catch (java.lang.Exception e) { - java.util.StringTokenizer stTextHol = new java.util.StringTokenizer (strTextHol, " "); - - strORAHoliday = org.drip.analytics.date.DateUtil.MakeOracleDateFromYYYYMMDD - (stTextHol.nextToken().trim()); - } - - java.lang.String strDescription = astrHolFields[1].trim(); - - if (null != strDescription && !strDescription.isEmpty()) - strDescription = strDescription.replaceAll ("'", ""); - else - strDescription = ""; - - java.lang.String strLocHolDates = "lh.addStaticHoliday (\"" + strORAHoliday + "\", \"" + - strDescription + "\");"; - - if (m_bBlog) System.out.println (strLocHolDates); - - bw.write ("\t\t" + strLocHolDates + "\n\n"); - } catch (java.lang.Exception e) { - System.out.println (strHolLoc + ": Check line " + strHolsLine); - } - } - - bw.flush(); - - inHolCal.close(); - } - - private static final void LoadHolCals() - throws java.lang.Exception - { - java.lang.String strHolDir = "c:\\Lakshmi\\java\\BondAnal\\Data\\Holidays\\"; - - java.io.File f = new java.io.File (strHolDir); - - java.lang.String[] astrFile = f.list(); - - for (int i = 0; i < astrFile.length; ++i) { - java.util.StringTokenizer stLoc = new java.util.StringTokenizer (astrFile[i], "."); - - java.lang.String strPrefix = stLoc.nextToken(); - - if (!"holiday".equalsIgnoreCase (strPrefix)) continue; - - LoadHolidayCalendar (stLoc.nextToken().toUpperCase(), strHolDir + astrFile[i]); - } - } - - private static final void AccumulateHolidays() - throws java.lang.Exception - { - java.lang.String strHolDir = "c:\\Lakshmi\\BondAnal\\Data\\Holidays\\"; - - java.io.File f = new java.io.File (strHolDir); - - java.lang.String[] astrFile = f.list(); - - for (int i = 0; i < astrFile.length; ++i) { - java.util.StringTokenizer stLoc = new java.util.StringTokenizer (astrFile[i], "."); - - java.lang.String strPrefix = stLoc.nextToken(); - - if (!"holiday".equalsIgnoreCase (strPrefix)) continue; - - java.lang.String strSuffix = stLoc.nextToken().toUpperCase(); - - java.io.BufferedWriter bw = new java.io.BufferedWriter (new java.io.FileWriter - ("c:\\DRIP\\CreditAnalytics\\org\\drip\\analytics\\holset\\" + strSuffix + "Holiday.java")); - - bw.write ("\npackage org.drip.analytics.holset;\n\n"); - - bw.write - ("/*\n * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-\n */\n"); - - bw.write ("\n/*\n * GENERATED on " + new java.util.Date().toString() + - " ---- DO NOT DELETE\n */\n"); - - bw.write ("\n/*!\n * Copyright (C) 2013 Lakshmi Krishnamurthy\n"); - - bw.write (" * Copyright (C) 2012 Lakshmi Krishnamurthy\n"); - - bw.write (" * Copyright (C) 2011 Lakshmi Krishnamurthy\n *\n"); - - bw.write (" * This file is part of CreditAnalytics, a free-software/open-source library for\n"); - - bw.write (" * fixed income analysts and developers - http://www.credit-trader.org\n *\n"); - - bw.write (" * CreditAnalytics is a free, full featured, fixed income credit analytics library,"); - - bw.write (" developed with a special focus\n"); - - bw.write (" * towards the needs of the bonds and credit products community.\n *\n"); - - bw.write (" * Licensed under the Apache License, Version 2.0 (the \"License\");\n"); - - bw.write (" * you may not use this file except in compliance with the License.\n"); - - bw.write (" *\n * You may obtain a copy of the License at\n"); - - bw.write (" * http://www.apache.org/licenses/LICENSE-2.0\n *\n"); - - bw.write (" * Unless required by applicable law or agreed to in writing, software\n"); - - bw.write (" * distributed under the License is distributed on an \"AS IS\" BASIS,\n"); - - bw.write (" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"); - - bw.write (" * \n * See the License for the specific language governing permissions and\n"); - - bw.write (" * limitations under the License.\n */\n\n"); - - bw.write ("public class " + strSuffix + - "Holiday implements org.drip.analytics.holset.LocationHoliday {\n"); - - bw.write ("\tpublic " + strSuffix + "Holiday()\n\t{\n\t}\n\n"); - - bw.write ("\tpublic java.lang.String getHolidayLoc()\n\t{\n"); - - bw.write ("\t\treturn \"" + strSuffix + "\";\n\t}\n\n"); - - bw.write ("\tpublic org.drip.analytics.holiday.Locale getHolidaySet()\n\t{"); - - bw.write ("\n\t\torg.drip.analytics.holiday.Locale lh = new\n"); - - bw.write ("\t\t\torg.drip.analytics.holiday.Locale();\n\n"); - - LoadHolsToHolderSource (bw, strSuffix, strHolDir + astrFile[i]); - - bw.write ("\t\tlh.addStandardWeekend();\n\n"); - - bw.write ("\t\treturn lh;\n\t}\n}\n"); - - bw.close(); - } - } - - private static final void LoadEOS() - throws java.lang.Exception - { - int iNumSchedules = 0; - java.lang.String strEOSLine = ""; - java.io.BufferedReader inEOS = null; - - java.sql.Statement stmt = org.drip.param.config.ConfigLoader.OracleInit - ("c:\\Lakshmi\\BondAnal\\Config.xml"); - - System.out.println ("Loading EOS ..."); - - try { - inEOS = new java.io.BufferedReader (new java.io.FileReader - ("C:\\Lakshmi\\RefDataAndMarks\\17Jan2012\\OptionSchedule.csv")); - } catch (java.lang.Exception e) { - System.out.println ("Cannot open EOS file"); - - return; - } - - while (null != (strEOSLine = inEOS.readLine())) { - int iNumRecord = 0; - java.lang.String astrEOS[] = new java.lang.String[14]; - - java.util.StringTokenizer stEOS = new java.util.StringTokenizer (strEOSLine, ","); - - while (stEOS.hasMoreTokens()) { - java.lang.String strEOS = stEOS.nextToken(); - - astrEOS[iNumRecord++] = strEOS; - } - - java.lang.String strClearEOS = ClearISINDateTypeFromEOS (astrEOS); - - if (null != strClearEOS && !strClearEOS.isEmpty()) stmt.executeQuery (strClearEOS); - - java.lang.String strInsertEOS = InsertIntoEOS (astrEOS); - - if (null != strInsertEOS && !strInsertEOS.isEmpty()) - stmt.executeQuery (strInsertEOS); - - ++iNumSchedules; - } - - inEOS.close(); - - System.out.println ("Loaded " + iNumSchedules + " into EOS."); - } - - private static final void LoadAmortizationSchedule() - throws java.lang.Exception - { - int iNumSchedules = 0; - java.lang.String strAmortizationScheduleLine = ""; - java.io.BufferedReader inAmortizationSchedule = null; - - java.sql.Statement stmt = org.drip.param.config.ConfigLoader.OracleInit - ("c:\\Lakshmi\\java\\BondAnal\\Config.xml"); - - System.out.println ("Loading AmortizationSchedule ..."); - - try { - inAmortizationSchedule = new java.io.BufferedReader (new java.io.FileReader - ("C:\\Lakshmi\\RefDataAndMarks\\17Jan2012\\AmortizationSchedule.csv")); - } catch (java.lang.Exception e) { - System.out.println ("Cannot open AmortizationSchedule file"); - - return; - } - - while (null != (strAmortizationScheduleLine = inAmortizationSchedule.readLine())) { - int iNumRecord = 0; - java.lang.String astrAmortizationSchedule[] = new java.lang.String[5]; - - java.util.StringTokenizer stAmortizationSchedule = new java.util.StringTokenizer - (strAmortizationScheduleLine, ","); - - while (stAmortizationSchedule.hasMoreTokens()) { - java.lang.String strAmortizationSchedule = stAmortizationSchedule.nextToken(); - - astrAmortizationSchedule[iNumRecord++] = strAmortizationSchedule; - } - - java.lang.String strClearAmortizationSchedule = makeSQLClearAmortScheduleEntry - (astrAmortizationSchedule); - - if (null != strClearAmortizationSchedule && !strClearAmortizationSchedule.isEmpty()) - stmt.executeQuery (strClearAmortizationSchedule); - - java.lang.String strInsertAmortizationSchedule = InsertIntoAmortizationSchedule - (astrAmortizationSchedule); - - if (null != strInsertAmortizationSchedule && !strInsertAmortizationSchedule.isEmpty()) - stmt.executeQuery (strInsertAmortizationSchedule); - - ++iNumSchedules; - } - - inAmortizationSchedule.close(); - - System.out.println ("Loaded " + iNumSchedules + " into AmortizationSchedule."); - } - - private static final void LoadIREOD() - throws java.lang.Exception - { - int iNumIREOD = 0; - java.lang.String strIREODLine = ""; - java.io.BufferedReader inIREOD = null; - - System.out.println ("Loading IREOD ..."); - - java.sql.Statement stmt = org.drip.param.config.ConfigLoader.OracleInit - ("c:\\Lakshmi\\BondAnal\\Config.xml"); - - try { - inIREOD = new java.io.BufferedReader (new java.io.FileReader - ("C:\\Lakshmi\\RefDataAndMarks\\17Jan2012\\EODIRCurves.csv")); - } catch (java.lang.Exception e) { - System.out.println ("Cannot open IREOD file"); - - return; - } - - while (null != (strIREODLine = inIREOD.readLine())) { - int iNumRecord = 0; - java.lang.String astrIREOD[] = new java.lang.String[58]; - - java.util.StringTokenizer stIREOD = new java.util.StringTokenizer (strIREODLine, ","); - - while (stIREOD.hasMoreTokens()) - astrIREOD[iNumRecord++] = stIREOD.nextToken(); - - java.lang.String strClearIREOD = ClearFromIREOD (astrIREOD); - - if (null != strClearIREOD && !strClearIREOD.isEmpty()) stmt.executeQuery (strClearIREOD); - - java.lang.String strInsertIREOD = InsertIntoIREOD (astrIREOD); - - if (null != strInsertIREOD && !strInsertIREOD.isEmpty()) stmt.executeQuery (strInsertIREOD); - - ++iNumIREOD; - } - - inIREOD.close(); - - System.out.println ("Loaded " + iNumIREOD + " into IR_EOD."); - } - - private static final void LoadBondSPN() - throws java.lang.Exception - { - int iNumSPN = 0; - java.lang.String strSPNLine = ""; - java.io.BufferedReader inSPN = null; - - System.out.println ("Loading SPN ..."); - - java.sql.Statement stmt = org.drip.param.config.ConfigLoader.OracleInit - ("c:\\Lakshmi\\java\\BondAnal\\Config.xml"); - - try { - inSPN = new java.io.BufferedReader (new java.io.FileReader - ("c:\\Lakshmi\\BondAnal\\Data\\BondStaticRef\\Closes\\Bond.csv")); - } catch (java.lang.Exception e) { - System.out.println ("Cannot open SPN file"); - - return; - } - - while (null != (strSPNLine = inSPN.readLine())) { - java.lang.String[] astrSPN = strSPNLine.split (","); - - java.lang.String strISIN = astrSPN[0]; - java.lang.String strSPN = astrSPN[3]; - - if (null != strSPN && !strSPN.isEmpty() && null != strSPN && !strSPN.isEmpty()) { - stmt.executeQuery ("update BondRef set IssuerSPN = '" + strSPN + "' where ISIN = '" + strISIN - + "'"); - - ++iNumSPN; - } - } - - System.out.println ("Loaded " + iNumSPN + " SPNs into BondRef."); - - inSPN.close(); - } - - private static final void LoadCREOD() - throws java.lang.Exception - { - int iNumCREOD = 0; - java.lang.String strCREODLine = ""; - java.io.BufferedReader inCREOD = null; - - System.out.println ("Loading CREOD ..."); - - java.sql.Statement stmt = org.drip.param.config.ConfigLoader.OracleInit - ("c:\\Lakshmi\\BondAnal\\Config.xml"); - - try { - inCREOD = new java.io.BufferedReader (new java.io.FileReader - ("c:\\Lakshmi\\BondAnal\\Data\\BondStaticRef\\Closes\\EODCR_2Q_2011.csv")); - } catch (java.lang.Exception e) { - System.out.println ("Cannot open CREOD file"); - - return; - } - - while (null != (strCREODLine = inCREOD.readLine())) { - java.lang.String[] astrCREOD = strCREODLine.split (","); - - java.lang.String strClearCREOD = ClearFromCREOD (astrCREOD); - - if (null != strClearCREOD && !strClearCREOD.isEmpty()) stmt.executeQuery (strClearCREOD); - - java.lang.String strInsertCREOD = InsertIntoCREOD (astrCREOD); - - if (null != strInsertCREOD && !strInsertCREOD.isEmpty()) { - System.out.println (strInsertCREOD); - - stmt.executeQuery (strInsertCREOD); - } - - ++iNumCREOD; - } - - System.out.println ("Loaded " + iNumCREOD + " into CREOD."); - - inCREOD.close(); - } - - public static void main ( - final java.lang.String[] astrArgs) - throws java.lang.Exception - { - if (0 < astrArgs.length && "-loadbondref2".equalsIgnoreCase (astrArgs[0])) { - LoadBondRef2(); - - return; - } - - if (0 < astrArgs.length && "-loadbondref_fodata".equalsIgnoreCase (astrArgs[0])) { - LoadBondRef_FODATA(); - - return; - } - - if (0 < astrArgs.length && "-bondmarks".equalsIgnoreCase (astrArgs[0])) { - LoadBondMarks(); - - return; - } - - if (0 < astrArgs.length && "-holcals".equalsIgnoreCase (astrArgs[0])) { - LoadHolCals(); - - return; - } - - if (0 < astrArgs.length && "-acchols".equalsIgnoreCase (astrArgs[0])) { - AccumulateHolidays(); - - return; - } - - if (0 < astrArgs.length && "-eos".equalsIgnoreCase (astrArgs[0])) { - LoadEOS(); - - return; - } - - if (0 < astrArgs.length && "-amortsched".equalsIgnoreCase (astrArgs[0])) { - LoadAmortizationSchedule(); - - return; - } - - if (0 < astrArgs.length && "-ireod".equalsIgnoreCase (astrArgs[0])) { - LoadIREOD(); - - return; - } - - if (0 < astrArgs.length && "-creod".equalsIgnoreCase (astrArgs[0])) { - LoadCREOD(); - - return; - } - - if (0 < astrArgs.length && "-spn".equalsIgnoreCase (astrArgs[0])) { - LoadBondSPN(); - - return; - } - - LoadBondRef(); - - LoadEOS(); - - LoadBondSPN(); - } -} diff --git a/org/drip/feed/loader/InstrumentSetTenorQuote.java b/org/drip/feed/loader/InstrumentSetTenorQuote.java deleted file mode 100644 index a998b59..0000000 --- a/org/drip/feed/loader/InstrumentSetTenorQuote.java +++ /dev/null @@ -1,195 +0,0 @@ - -package org.drip.feed.loader; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * InstrumentSetTenorQuote holds the Instrument Set Tenor and Closing Quote Group. - * - * @author Lakshmi Krishnamurthy - */ - -public class InstrumentSetTenorQuote { - private org.drip.analytics.support.CaseInsensitiveHashMap> _mapOrderedInstrumentTenorQuote = new - org.drip.analytics.support.CaseInsensitiveHashMap>(); - - /** - * Empty InstrumentSetTenorQuote Constructor - */ - - public InstrumentSetTenorQuote() - { - } - - /** - * Add the Instrument/Tenor/Quote/Scale Field Set - * - * @param strInstrument Quote Instrument - * @param strTenor Quote Tenor - * @param dblQuote Quote Value - * @param dblScale Quote Scale - * - * @return TRUE - Group Set successfully added - */ - - public boolean add ( - final java.lang.String strInstrument, - final java.lang.String strTenor, - final double dblQuote, - final double dblScale) - { - int iTenorDays = -1; - org.drip.feed.loader.TenorQuote tq = null; - - try { - tq = new org.drip.feed.loader.TenorQuote (strTenor, dblQuote * dblScale); - - if (0 >= (iTenorDays = org.drip.analytics.support.Helper.TenorToDays (strTenor))) return false; - } catch (java.lang.Exception e) { - return false; - } - - java.util.Map mapOrderedTenorQuote = - _mapOrderedInstrumentTenorQuote.containsKey (strInstrument) ? _mapOrderedInstrumentTenorQuote.get - (strInstrument) : new java.util.TreeMap(); - - mapOrderedTenorQuote.put (iTenorDays, tq); - - _mapOrderedInstrumentTenorQuote.put (strInstrument, mapOrderedTenorQuote); - - return true; - } - - /** - * Retrieve the Named Instrument Group Quote Map - * - * @param strInstrument The Instrument Group Name - * - * @return The Named Instrument Group Quote Map - */ - - public java.util.Map instrumentTenorQuote ( - final java.lang.String strInstrument) - { - return null == strInstrument || !_mapOrderedInstrumentTenorQuote.containsKey (strInstrument) ? null : - _mapOrderedInstrumentTenorQuote.get (strInstrument); - } - - /** - * Retrieve the Named Instrument Tenors - * - * @param strInstrument The Instrument Group Name - * - * @return The Named Instrument Tenors - */ - - public java.lang.String[] instrumentTenor ( - final java.lang.String strInstrument) - { - java.util.Map mapTenorQuote = - instrumentTenorQuote (strInstrument); - - if (null == mapTenorQuote) return null; - - int iNumTenor = mapTenorQuote.size(); - - if (0 == iNumTenor) return null; - - int i = 0; - java.lang.String[] astrTenor = new java.lang.String[iNumTenor]; - - for (java.util.Map.Entry meTQ : - mapTenorQuote.entrySet()) - astrTenor[i++] = meTQ.getValue().tenor(); - - return astrTenor; - } - - /** - * Retrieve the Named Instrument Quotes - * - * @param strInstrument The Instrument Group Name - * - * @return The Named Instrument Quotes - */ - - public double[] instrumentQuote ( - final java.lang.String strInstrument) - { - java.util.Map mapTenorQuote = - instrumentTenorQuote (strInstrument); - - if (null == mapTenorQuote) return null; - - int iNumTenor = mapTenorQuote.size(); - - if (0 == iNumTenor) return null; - - int i = 0; - double[] adblQuote = new double[iNumTenor]; - - for (java.util.Map.Entry meTQ : - mapTenorQuote.entrySet()) - adblQuote[i++] = meTQ.getValue().quote(); - - return adblQuote; - } - - /** - * Indicates whether the ISTQ is Empty or not - * - * @return TRUE - ISTQ is Empty - */ - - public boolean isEmpty() - { - return 0 == _mapOrderedInstrumentTenorQuote.size(); - } -} diff --git a/org/drip/feed/loader/TenorQuote.java b/org/drip/feed/loader/TenorQuote.java deleted file mode 100644 index 4465d9c..0000000 --- a/org/drip/feed/loader/TenorQuote.java +++ /dev/null @@ -1,105 +0,0 @@ - -package org.drip.feed.loader; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TenorQuote holds the Instrument Tenor and Closing Quote. - * - * @author Lakshmi Krishnamurthy - */ - -public class TenorQuote { - private java.lang.String _strTenor = ""; - private double _dblQuote = java.lang.Double.NaN; - - /** - * TenorQuote Constructor - * - * @param strTenor The Closing Tenor - * @param dblQuote The Closing Quote - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public TenorQuote ( - final java.lang.String strTenor, - final double dblQuote) - throws java.lang.Exception - { - if (null == (_strTenor = strTenor) || _strTenor.isEmpty() || - !org.drip.quant.common.NumberUtil.IsValid (_dblQuote = dblQuote)) - throw new java.lang.Exception ("TenorQuote Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Closing Tenor - * - * @return The Closing Tenor - */ - - public java.lang.String tenor() - { - return _strTenor; - } - - /** - * Retrieve the Closing Quote - * - * @return The Closing Quote - */ - - public double quote() - { - return _dblQuote; - } - - @Override public java.lang.String toString() - { - return _strTenor + "=" + _dblQuote; - } -} diff --git a/org/drip/feed/metric/FixFloatPnLAttributor.java b/org/drip/feed/metric/FixFloatPnLAttributor.java deleted file mode 100644 index a874488..0000000 --- a/org/drip/feed/metric/FixFloatPnLAttributor.java +++ /dev/null @@ -1,191 +0,0 @@ - -package org.drip.feed.metric; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FixFloatPnLAttributor generates the Date Valuation and Position Change PnL Explain Attributions for the - * Standard OTC Fix Float Swap. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixFloatPnLAttributor { - - /** - * Generate the Explain Components for the specified Fix Float Product - * - * @param strCurrency The Fix-Float Swap Currency - * @param strMaturityTenor The Fix-Float Swap Maturity Tenor - * @param iHorizonGap The Valuation Horizon Gap - * @param strFeedTranformLocation The Closing Funding Curve Quotes Location - * @param astrFundingDepositTenor The Funding Curve Deposit Instrument Maturity Tenors - * @param aiFundingDepositColumn The Funding Curve Deposit Instrument Quote Columns - * @param astrFundingFixFloatTenor The Funding Curve Fix Float Swap Instrument Maturity Tenors - * @param aiFundingFixFloatColumn The Funding Curve Fix Float Swap Instrument Quote Columns - * @param astrRollDownHorizonTenor Array of the Roll Down Horizon Tenors - * - * @return List of the Position Change Components - */ - - public static final java.util.List - TenorHorizonExplainComponents ( - final java.lang.String strCurrency, - final java.lang.String strMaturityTenor, - final int iHorizonGap, - final java.lang.String strFeedTranformLocation, - final java.lang.String[] astrFundingDepositTenor, - final int[] aiFundingDepositColumn, - final java.lang.String[] astrFundingFixFloatTenor, - final int[] aiFundingFixFloatColumn, - final java.lang.String[] astrRollDownHorizonTenor) - { - if (null == astrFundingDepositTenor || null == aiFundingDepositColumn || null == - astrFundingFixFloatTenor || null == aiFundingFixFloatColumn) - return null; - - int iNumFundingDeposit = astrFundingDepositTenor.length; - int iNumFundingFixFloat = astrFundingFixFloatTenor.length; - double[][] aadblFundingDepositClose = new double[iNumFundingDeposit][]; - double[][] aadblFundingFixFloatClose = new double[iNumFundingFixFloat][]; - - if (0 == iNumFundingDeposit || iNumFundingDeposit != aiFundingDepositColumn.length || 0 == - iNumFundingFixFloat || iNumFundingFixFloat != aiFundingFixFloatColumn.length) - return null; - - org.drip.feed.loader.CSVGrid csvGrid = org.drip.feed.loader.CSVParser.StringGrid - (strFeedTranformLocation, true); - - if (null == csvGrid) return null; - - org.drip.analytics.date.JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - int iNumClose = adtClose.length; - double[][] aadblFundingDepositQuote = new double[iNumClose][iNumFundingDeposit]; - double[][] aadblFundingFixFloatQuote = new double[iNumClose][iNumFundingFixFloat]; - org.drip.analytics.date.JulianDate[] adtSpot = new org.drip.analytics.date.JulianDate[iNumClose]; - - for (int i = 0; i < iNumFundingDeposit; ++i) - aadblFundingDepositClose[i] = csvGrid.doubleArrayAtColumn (aiFundingDepositColumn[i]); - - for (int i = 0; i < iNumFundingFixFloat; ++i) - aadblFundingFixFloatClose[i] = csvGrid.doubleArrayAtColumn (aiFundingFixFloatColumn[i]); - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - - for (int j = 0; j < iNumFundingDeposit; ++j) - aadblFundingDepositQuote[i][j] = aadblFundingDepositClose[j][i]; - - for (int j = 0; j < iNumFundingFixFloat; ++j) - aadblFundingFixFloatQuote[i][j] = aadblFundingFixFloatClose[j][i]; - } - - return org.drip.service.product.FixFloatAPI.HorizonChangeAttribution (adtSpot, iHorizonGap, - astrFundingDepositTenor, aadblFundingDepositQuote, astrFundingFixFloatTenor, - aadblFundingFixFloatQuote, strCurrency, strMaturityTenor, astrRollDownHorizonTenor, - org.drip.service.template.LatentMarketStateBuilder.SHAPE_PRESERVING); - } - - /** - * Generate the Tenor Horizon Explain Components - * - * @param strCurrency The Fix-Float Swap Currency - * @param astrMaturityTenor Array of Fix-Float Swap Maturity Tenors - * @param aiHorizonGap Array of the Valuation Horizon Gaps - * @param strFeedTranformLocation The Closing Funding Curve Quotes Location - * @param astrFundingDepositTenor The Funding Curve Deposit Instrument Maturity Tenors - * @param aiFundingDepositColumn The Funding Curve Deposit Instrument Quote Columns - * @param astrFundingFixFloatTenor The Funding Curve Fix Float Swap Instrument Maturity Tenors - * @param aiFundingFixFloatColumn The Funding Curve Fix Float Swap Instrument Quote Columns - * @param astrRollDownHorizonTenor Array of the Roll Down Horizon Tenors - * - * @return List of the Position Change Components - */ - - public static final boolean TenorHorizonExplainComponents ( - final java.lang.String strCurrency, - final java.lang.String[] astrMaturityTenor, - final int[] aiHorizonGap, - final java.lang.String strFeedTranformLocation, - final java.lang.String[] astrFundingDepositTenor, - final int[] aiFundingDepositColumn, - final java.lang.String[] astrFundingFixFloatTenor, - final int[] aiFundingFixFloatColumn, - final java.lang.String[] astrRollDownHorizonTenor) - { - boolean bFirstRun = true; - - for (java.lang.String strMaturityTenor : astrMaturityTenor) { - for (int iHorizonGap : aiHorizonGap) { - java.util.List lsPCC = - org.drip.feed.metric.FixFloatPnLAttributor.TenorHorizonExplainComponents (strCurrency, - strMaturityTenor, iHorizonGap, strFeedTranformLocation, astrFundingDepositTenor, - aiFundingDepositColumn, astrFundingFixFloatTenor, aiFundingFixFloatColumn, - astrRollDownHorizonTenor); - - if (null != lsPCC) { - java.lang.String strHorizonTenor = 1 == iHorizonGap ? "1D" : ((iHorizonGap / 22) + "M"); - - for (org.drip.historical.attribution.PositionChangeComponents pcc : lsPCC) { - if (null != pcc) { - if (bFirstRun) { - System.out.println (pcc.header() + "horizontenor,"); - - bFirstRun = false; - } - - System.out.println (pcc.content() + strHorizonTenor + ","); - } - } - } - } - } - - return true; - } -} diff --git a/org/drip/feed/metric/TreasuryBondPnLAttributor.java b/org/drip/feed/metric/TreasuryBondPnLAttributor.java deleted file mode 100644 index 141823a..0000000 --- a/org/drip/feed/metric/TreasuryBondPnLAttributor.java +++ /dev/null @@ -1,169 +0,0 @@ - -package org.drip.feed.metric; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TreasuryBondPnLAttributor generates the Date Valuation and Position Change PnL Explain Attributions for - * the Specified Treasury Bond. - * - * @author Lakshmi Krishnamurthy - */ - -public class TreasuryBondPnLAttributor { - - /** - * Generate the Explain Components for the specified Treasury Bond - * - * @param strMaturityTenor Treasury Bond Maturity Tenor - * @param strCode Treasury Bond Code - * @param iHorizonGap The Valuation Horizon Gap - * @param strFeedTranformLocation The Closing Funding Curve Quotes Location - * @param astrGovvieTreasuryTenor The Govvie Curve Treasury Bond Maturity Tenors - * @param aiGovvieTreasuryColumn The Govvie Curve Treasury Bond Quote Columns - * @param astrRollDownHorizonTenor Array of the Roll Down Horizon Tenors - * - * @return List of the Position Change Components - */ - - public static final java.util.List - TenorHorizonExplainComponents ( - final java.lang.String strMaturityTenor, - final java.lang.String strCode, - final int iHorizonGap, - final java.lang.String strFeedTranformLocation, - final java.lang.String[] astrGovvieTreasuryTenor, - final int[] aiGovvieTreasuryColumn, - final java.lang.String[] astrRollDownHorizonTenor) - { - if (null == astrGovvieTreasuryTenor || null == aiGovvieTreasuryColumn) return null; - - int iNumGovvieTreasury = astrGovvieTreasuryTenor.length; - double[][] aadblGovvieTreasuryClose = new double[iNumGovvieTreasury][]; - - if (0 == iNumGovvieTreasury || iNumGovvieTreasury != aiGovvieTreasuryColumn.length) return null; - - org.drip.feed.loader.CSVGrid csvGrid = org.drip.feed.loader.CSVParser.StringGrid - (strFeedTranformLocation, true); - - if (null == csvGrid) return null; - - org.drip.analytics.date.JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - int iNumClose = adtClose.length; - double[][] aadblGovvieTreasuryQuote = new double[iNumClose][iNumGovvieTreasury]; - org.drip.analytics.date.JulianDate[] adtSpot = new org.drip.analytics.date.JulianDate[iNumClose]; - - for (int i = 0; i < iNumGovvieTreasury; ++i) - aadblGovvieTreasuryClose[i] = csvGrid.doubleArrayAtColumn (aiGovvieTreasuryColumn[i]); - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - - for (int j = 0; j < iNumGovvieTreasury; ++j) - aadblGovvieTreasuryQuote[i][j] = aadblGovvieTreasuryClose[j][i]; - } - - return org.drip.service.product.TreasuryAPI.HorizonChangeAttribution (adtSpot, iHorizonGap, - astrGovvieTreasuryTenor, aadblGovvieTreasuryQuote, strMaturityTenor, strCode, - astrRollDownHorizonTenor, - org.drip.service.template.LatentMarketStateBuilder.SHAPE_PRESERVING); - } - - /** - * Generate the Tenor Horizon Explain Components - * - * @param astrMaturityTenor Array of Treasury Bond Maturity Tenors - * @param strCode Treasury Bond Code - * @param aiHorizonGap Array of the Valuation Horizon Gaps - * @param strFeedTranformLocation The Closing Funding Curve Quotes Location - * @param astrGovvieTreasuryTenor The Govvie Curve Treasury Bond Maturity Tenors - * @param aiGovvieTreasuryColumn The Govvie Curve Treasury Bond Maturity Columns - * @param astrRollDownHorizonTenor Array of the Roll Down Horizon Tenors - * - * @return TRUE - The Treasury Bond Tenor Explain Components Successfully generated - */ - - public static final boolean TenorHorizonExplainComponents ( - final java.lang.String[] astrMaturityTenor, - final java.lang.String strCode, - final int[] aiHorizonGap, - final java.lang.String strFeedTranformLocation, - final java.lang.String[] astrGovvieTreasuryTenor, - final int[] aiGovvieTreasuryColumn, - final java.lang.String[] astrRollDownHorizonTenor) - { - boolean bFirstRun = true; - - for (java.lang.String strMaturityTenor : astrMaturityTenor) { - for (int iHorizonGap : aiHorizonGap) { - java.util.List lsPCC = - org.drip.feed.metric.TreasuryBondPnLAttributor.TenorHorizonExplainComponents - (strMaturityTenor, strCode, iHorizonGap, strFeedTranformLocation, - astrGovvieTreasuryTenor, aiGovvieTreasuryColumn, astrRollDownHorizonTenor); - - if (null != lsPCC) { - java.lang.String strHorizonTenor = 1 == iHorizonGap ? "1D" : ((iHorizonGap / 22) + "M"); - - for (org.drip.historical.attribution.PositionChangeComponents pcc : lsPCC) { - if (null != pcc) { - if (bFirstRun) { - System.out.println (pcc.header() + "horizontenor,"); - - bFirstRun = false; - } - - System.out.println (pcc.content() + strHorizonTenor + ","); - } - } - } - } - } - - return true; - } -} diff --git a/org/drip/feed/transformer/CreditCDSIndexMarksReconstitutor.java b/org/drip/feed/transformer/CreditCDSIndexMarksReconstitutor.java deleted file mode 100644 index 6c220cb..0000000 --- a/org/drip/feed/transformer/CreditCDSIndexMarksReconstitutor.java +++ /dev/null @@ -1,157 +0,0 @@ - -package org.drip.feed.transformer; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CreditCDSIndexMarksReconstitutor transforms the Credit CDS Index Closes - Feed Inputs into Formats - * suitable for Valuation Metrics and Sensitivities Generation. - * - * @author Lakshmi Krishnamurthy - */ - -public class CreditCDSIndexMarksReconstitutor { - - private static final double[] FundingFixingMarksIndex ( - final org.drip.feed.loader.CSVGrid csvGridFundingFixingMarks, - final org.drip.analytics.date.JulianDate[] adtFundingFixingSpot, - final org.drip.analytics.date.JulianDate dtCreditIndexSpot) - { - int iNumFundingFixingSpot = adtFundingFixingSpot.length; - int iNumFundingFixingMaturityTenor = - org.drip.feed.transformer.FundingFixFloatMarksReconstitutor.s_astrFixFloatTenor.length; - - for (int i = 0; i < iNumFundingFixingSpot; ++i) { - if (dtCreditIndexSpot.julian() == adtFundingFixingSpot[i].julian()) { - double[] adblFundingFixingFixFloatQuote = new double[iNumFundingFixingMaturityTenor]; - - for (int j = 0; j < iNumFundingFixingMaturityTenor; ++j) - adblFundingFixingFixFloatQuote[j] = csvGridFundingFixingMarks.doubleArrayAtColumn - (j + 1)[i]; - - return adblFundingFixingFixFloatQuote; - } - } - - return null; - } - - /** - * Regularize the Credit Index Feed Marks - * - * @param strFundingFixingMarksLocation The Funding Fixing Marks Location - * @param strCreditIndexMarksLocation The Credit Index Marks Location - * @param strIndexFullName Full Name of the Index - * @param iSpotDateIndex Spot Date Column Index - * @param iQuotedSpreadIndex Quoted Spread Column Index - * - * @return TRUE - The Regularization is Successful - */ - - public static final boolean RegularizeCloses ( - final java.lang.String strFundingFixingMarksLocation, - final java.lang.String strCreditIndexMarksLocation, - final java.lang.String strIndexFullName, - final int iSpotDateIndex, - final int iQuotedSpreadIndex) - { - org.drip.feed.loader.CSVGrid csvGridFundingFixingMarks = org.drip.feed.loader.CSVParser.StringGrid - (strFundingFixingMarksLocation, true); - - if (null == csvGridFundingFixingMarks) return false; - - org.drip.analytics.date.JulianDate[] adtFundingFixingMarksSpot = - csvGridFundingFixingMarks.dateArrayAtColumn (0); - - if (null == adtFundingFixingMarksSpot || 0 == adtFundingFixingMarksSpot.length) return false; - - org.drip.feed.loader.CSVGrid csvGridCreditIndexMarks = org.drip.feed.loader.CSVParser.StringGrid - (strCreditIndexMarksLocation, true); - - if (null == csvGridCreditIndexMarks) return false; - - org.drip.analytics.date.JulianDate[] adtCreditIndexMarksSpot = - csvGridCreditIndexMarks.dateArrayAtColumn (iSpotDateIndex); - - if (null == adtCreditIndexMarksSpot) return false; - - int iNumClose = adtCreditIndexMarksSpot.length; - int iNumFundingFixingMaturityTenor = - org.drip.feed.transformer.FundingFixFloatMarksReconstitutor.s_astrFixFloatTenor.length; - - if (0 == iNumClose) return false; - - double[] adblQuotedSpread = csvGridCreditIndexMarks.doubleArrayAtColumn (iQuotedSpreadIndex); - - if (null == adblQuotedSpread || iNumClose != adblQuotedSpread.length) return false; - - java.lang.String strDump = "CloseDate"; - - for (int j = 0; j < iNumFundingFixingMaturityTenor; ++j) - strDump += "," + - org.drip.feed.transformer.FundingFixFloatMarksReconstitutor.s_astrFixFloatTenor[j]; - - System.out.println (strDump + ",CreditIndexName,QuotedSpread"); - - for (int i = 0; i < iNumClose; ++i) { - double[] adblFundingFixingFixFloatQuote = FundingFixingMarksIndex (csvGridFundingFixingMarks, - adtFundingFixingMarksSpot, adtCreditIndexMarksSpot[i]); - - if (null == adblFundingFixingFixFloatQuote) continue; - - strDump = ""; - - for (int j = 0; j < iNumFundingFixingMaturityTenor; ++j) - strDump += "," + adblFundingFixingFixFloatQuote[j]; - - System.out.println (adtCreditIndexMarksSpot[i] + strDump + "," + strIndexFullName + "," + (0.0001 - * adblQuotedSpread[i])); - } - - return true; - } -} diff --git a/org/drip/feed/transformer/FundingFixFloatMarksReconstitutor.java b/org/drip/feed/transformer/FundingFixFloatMarksReconstitutor.java deleted file mode 100644 index f92b28f..0000000 --- a/org/drip/feed/transformer/FundingFixFloatMarksReconstitutor.java +++ /dev/null @@ -1,235 +0,0 @@ - -package org.drip.feed.transformer; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FundingFixFloatMarksReconstitutor transforms the Funding Instrument Manifest Measures (e.g., Forward Rate - * for Deposits, Forward Rate for Futures, and Swap Rates for Fix/Float Swap) Feed Inputs into Formats - * appropriate for Funding Curve Construction and Measure Generation. - * - * @author Lakshmi Krishnamurthy - */ - -public class FundingFixFloatMarksReconstitutor { - - /** - * The Standard Funding Input Calibration Manifest Measure Scaler - */ - - public static final double s_dblScaler = 0.01; - - /** - * The Standard Deposit Maturity Tenors - */ - - public static final java.lang.String[] s_astrDepositTenor = new java.lang.String[] {"1M", "2M", "3M", - "4M", "5M", "6M"}; - - /** - * The Standard Fix Float Maturity Tenors - */ - - public static final java.lang.String[] s_astrFixFloatTenor = new java.lang.String[] {"1Y", "2Y", "3Y", - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y"}; - - /** - * Dump the Regularized Marks of the ISTQ Map - * - * @param strCurrency Currency - * @param mapISTQ The ISTQ Map - * @param iLatentStateType SHAPE PRESERVING/SMOOTH - * - * @return TRUE - The Regularized ISTQ Map Successfully Dumped - */ - - public static final boolean RegularizeMarks ( - final java.lang.String strCurrency, - final java.util.Map - mapISTQ, - final int iLatentStateType) - { - if (null == mapISTQ || 0 == mapISTQ.size()) return false; - - java.lang.String strHeader = "Date,"; - - for (java.lang.String strMaturityTenor : s_astrDepositTenor) - strHeader += "DEPOSITPROC:" + strMaturityTenor + ","; - - for (java.lang.String strMaturityTenor : s_astrFixFloatTenor) - strHeader += "FIXFLOATPROC:" + strMaturityTenor + ","; - - for (java.lang.String strMaturityTenor : s_astrDepositTenor) - strHeader += "<>,"; - - for (java.lang.String strMaturityTenor : s_astrFixFloatTenor) - strHeader += "<>,"; - - System.out.println (strHeader); - - for (java.util.Map.Entry meISTQ : mapISTQ.entrySet()) { - if (null == meISTQ) continue; - - org.drip.analytics.date.JulianDate dtSpot = meISTQ.getKey(); - - org.drip.feed.loader.InstrumentSetTenorQuote istq = meISTQ.getValue(); - - if (null == dtSpot || null == istq) continue; - - java.lang.String strDump = dtSpot.toString() + ","; - - double[] adblDepositQuote = istq.instrumentQuote ("DEPOSIT"); - - java.lang.String[] astrDepositMaturityTenor = istq.instrumentTenor ("DEPOSIT"); - - double[] adblFixFloatQuote = istq.instrumentQuote ("FIXFLOAT"); - - java.lang.String[] astrFixFloatMaturityTenor = istq.instrumentTenor ("FIXFLOAT"); - - int iNumDepositQuote = null == adblDepositQuote ? 0 : adblDepositQuote.length; - int iNumFixFloatQuote = null == adblFixFloatQuote ? 0 : adblFixFloatQuote.length; - int iNumDepositTenor = null == astrDepositMaturityTenor ? 0 : astrDepositMaturityTenor.length; - int iNumFixFloatTenor = null == astrFixFloatMaturityTenor ? 0 : astrFixFloatMaturityTenor.length; - - if (0 == iNumFixFloatQuote || iNumDepositQuote != iNumDepositTenor || iNumFixFloatQuote != - iNumFixFloatTenor) - continue; - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = - org.drip.service.template.LatentMarketStateBuilder.FundingCurve (dtSpot, strCurrency, - astrDepositMaturityTenor, adblDepositQuote, "ForwardRate", null, "ForwardRate", - astrFixFloatMaturityTenor, adblFixFloatQuote, "SwapRate", iLatentStateType); - - org.drip.param.market.CurveSurfaceQuoteContainer csqc = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - if (!csqc.setFundingState (dcFunding)) continue; - - org.drip.param.valuation.ValuationParams valParams = - org.drip.param.valuation.ValuationParams.Spot (dtSpot.julian()); - - org.drip.product.rates.SingleStreamComponent[] aSSCDeposit = - org.drip.service.template.OTCInstrumentBuilder.FundingDeposit (dtSpot, strCurrency, - s_astrDepositTenor); - - for (org.drip.product.rates.SingleStreamComponent sscDeposit : aSSCDeposit) { - try { - strDump += org.drip.quant.common.FormatUtil.FormatDouble (sscDeposit.measureValue - (valParams, null, csqc, null, "ForwardRate"), 1, 6, 1.) + ","; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - continue; - } - } - - org.drip.product.rates.FixFloatComponent[] aFixFloat = - org.drip.service.template.OTCInstrumentBuilder.FixFloatStandard (dtSpot, strCurrency, "ALL", - s_astrFixFloatTenor, "MAIN", 0.); - - for (org.drip.product.rates.FixFloatComponent ffc : aFixFloat) { - try { - strDump += org.drip.quant.common.FormatUtil.FormatDouble (ffc.measureValue (valParams, - null, csqc, null, "SwapRate"), 1, 6, 1.) + ","; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - continue; - } - } - - for (int i = 0; i < iNumFixFloatQuote; ++i) - strDump += org.drip.quant.common.FormatUtil.FormatDouble (adblFixFloatQuote[i], 1, 6, 1.) + - ","; - - System.out.println (strDump); - } - - return true; - } - - /** - * Re-constitute the Horizon Quote Marks Using a Shape Preserving Re-constructor - * - * @param strCurrency Currency - * @param strMarksLocation The Location of the CSV Marks File - * - * @return The Transformed Horizon Quote Marks - */ - - public static final boolean ShapePreservingRegularization ( - final java.lang.String strCurrency, - final java.lang.String strMarksLocation) - { - org.drip.feed.loader.CSVGrid csvGrid = org.drip.feed.loader.CSVParser.StringGrid (strMarksLocation, - false); - - return null == csvGrid ? false : RegularizeMarks (strCurrency, csvGrid.groupedOrderedDouble - (s_dblScaler), org.drip.service.template.LatentMarketStateBuilder.SHAPE_PRESERVING); - } - - /** - * Re-constitute the Horizon Quote Marks Using a Smooth Re-constructor - * - * @param strCurrency Currency - * @param strMarksLocation The Location of the CSV Marks File - * - * @return The Transformed Horizon Quote Marks - */ - - public static final boolean SmoothRegularization ( - final java.lang.String strCurrency, - final java.lang.String strMarksLocation) - { - org.drip.feed.loader.CSVGrid csvGrid = org.drip.feed.loader.CSVParser.StringGrid (strMarksLocation, - false); - - return null == csvGrid ? false : RegularizeMarks (strCurrency, csvGrid.groupedOrderedDouble - (s_dblScaler), org.drip.service.template.LatentMarketStateBuilder.SMOOTH); - } -} diff --git a/org/drip/feed/transformer/FundingFuturesClosesReconstitutor.java b/org/drip/feed/transformer/FundingFuturesClosesReconstitutor.java deleted file mode 100644 index 7643935..0000000 --- a/org/drip/feed/transformer/FundingFuturesClosesReconstitutor.java +++ /dev/null @@ -1,110 +0,0 @@ - -package org.drip.feed.transformer; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FundingFuturesClosesReconstitutor transforms the Funding Futures Closes- Feed Inputs into Formats - * suitable for Valuation Metrics and Sensitivities Generation. - * - * @author Lakshmi Krishnamurthy - */ - -public class FundingFuturesClosesReconstitutor { - - /** - * Regularize the Funding Futures Feed Closes - * - * @param strClosesLocation The Closes Location - * @param iSpotDateIndex Spot Date Column Index - * @param iLastPriceIndex Last Price Column Index - * @param iFuturesExpiryDateIndex Futures Expiry Date Column Index - * - * @return TRUE - The Regularization is Successful - */ - - public static final boolean RegularizeCloses ( - final java.lang.String strClosesLocation, - final int iSpotDateIndex, - final int iLastPriceIndex, - final int iFuturesExpiryDateIndex) - { - org.drip.feed.loader.CSVGrid csvGrid = org.drip.feed.loader.CSVParser.StringGrid (strClosesLocation, - true); - - if (null == csvGrid) return false; - - org.drip.analytics.date.JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (iSpotDateIndex); - - if (null == adtSpot) return false; - - int iNumClose = adtSpot.length; - double[] adblForwardRate = new double[iNumClose]; - - if (0 == iNumClose) return false; - - double[] adblLastPrice = csvGrid.doubleArrayAtColumn (iLastPriceIndex); - - if (null == adblLastPrice || iNumClose != adblLastPrice.length) return false; - - for (int i = 0; i < iNumClose; ++i) - adblForwardRate[i] = 0.01 * (100. - adblLastPrice[i]); - - org.drip.analytics.date.JulianDate[] adtFuturesExpiry = csvGrid.dateArrayAtColumn - (iFuturesExpiryDateIndex); - - if (null == adtFuturesExpiry || iNumClose != adtFuturesExpiry.length) return false; - - System.out.println ("CloseDate,Price,ForwardRate,FuturesExpiry"); - - for (int i = 0; i < iNumClose; ++i) - System.out.println (adtSpot[i] + "," + adblLastPrice[i] + "," + adblForwardRate[i] + "," + - adtFuturesExpiry[i]); - - return true; - } -} diff --git a/org/drip/feed/transformer/GovvieTreasuryMarksReconstitutor.java b/org/drip/feed/transformer/GovvieTreasuryMarksReconstitutor.java deleted file mode 100644 index 6dd9ad3..0000000 --- a/org/drip/feed/transformer/GovvieTreasuryMarksReconstitutor.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.feed.transformer; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * GovvieTreasuryMarksReconstitutor transforms the Treasury Marks (e.g., Yield) Feed Inputs into Formats - * appropriate for Govvie Curve Construction and Measure Generation. - * - * @author Lakshmi Krishnamurthy - */ - -public class GovvieTreasuryMarksReconstitutor { - - /** - * The Standard Treasury Input Calibration Manifest Measure - */ - - public static final java.lang.String s_strCalibrationMeasure = "Yield"; - - /** - * The Standard Treasury Input Calibration Manifest Measure Scaler - */ - - public static final double s_dblScaler = 0.01; - - /** - * The Standard Treasury Market Yield Re-constitution Benchmark Tenors - */ - - public static final java.lang.String[] s_astrOutputBenchmarkTenor = new java.lang.String[] { - "2Y", "3Y", "4Y", "5Y", "7Y", "10Y", "20Y", "30Y" - }; - - /** - * Re-constitute the Horizon Benchmark Marks - * - * @param strTreasuryType The Treasury Type - * @param mapClosingMarks Map of the Dates Closing Marks - * @param strManifestMeasure The Govvie Curve Calibration Manifest Measure - * @param astrOutputBenchmarkTenor Tenors of the Output Benchmark Desired - * - * @return The Transformed Horizon Benchmark Yield - */ - - public static final boolean RegularizeBenchmarkMarks ( - final java.lang.String strTreasuryType, - final java.util.Map> mapClosingMarks, - final java.lang.String strManifestMeasure, - final java.lang.String[] astrOutputBenchmarkTenor) - { - if (null == mapClosingMarks || 0 == mapClosingMarks.size() || null == astrOutputBenchmarkTenor) - return false; - - java.lang.String strHeader = "Date"; - int iNumOutputBenchmark = astrOutputBenchmarkTenor.length; - - if (0 == iNumOutputBenchmark) return false; - - for (int i = 0; i < iNumOutputBenchmark; ++i) - strHeader += "," + astrOutputBenchmarkTenor[i]; - - for (int i = 0; i < iNumOutputBenchmark; ++i) - strHeader += ",<>"; - - System.out.println (strHeader); - - for (java.util.Map.Entry> meClosingMarks : mapClosingMarks.entrySet()) { - org.drip.analytics.date.JulianDate dtSpot = meClosingMarks.getKey(); - - java.util.Map mapKeyMarks = meClosingMarks.getValue(); - - int iNumInputBenchmark = mapKeyMarks.size(); - - int i = 0; - double[] adblInputTreasuryYield = new double[iNumInputBenchmark]; - org.drip.analytics.date.JulianDate[] adtInputTreasuryMaturity = new - org.drip.analytics.date.JulianDate[iNumInputBenchmark]; - org.drip.analytics.date.JulianDate[] adtInputTreasuryEffective = new - org.drip.analytics.date.JulianDate[iNumInputBenchmark]; - org.drip.product.credit.BondComponent[] aInputBenchmarkTreasury = new - org.drip.product.credit.BondComponent[iNumInputBenchmark]; - org.drip.product.credit.BondComponent[] aOutputBenchmarkTreasury = new - org.drip.product.credit.BondComponent[iNumOutputBenchmark]; - - for (java.util.Map.Entry meKeyMarks : mapKeyMarks.entrySet()) - { - double dblYear = meKeyMarks.getKey(); - - if (null == (aInputBenchmarkTreasury[i] = org.drip.service.template.TreasuryBuilder.FromCode - (strTreasuryType, adtInputTreasuryEffective[i] = dtSpot, adtInputTreasuryMaturity[i] = - dtSpot.addYears ((int) dblYear), adblInputTreasuryYield[i] = meKeyMarks.getValue()))) - return false; - - ++i; - } - - for (int j = 0; j < iNumOutputBenchmark; ++j) { - if (null == (aOutputBenchmarkTreasury[j] = org.drip.service.template.TreasuryBuilder.FromCode - (strTreasuryType, dtSpot, dtSpot.addTenor (astrOutputBenchmarkTenor[j]), 0.01))) - return false; - } - - org.drip.state.govvie.GovvieCurve gc = - org.drip.service.template.LatentMarketStateBuilder.ShapePreservingGovvieCurve - (strTreasuryType, dtSpot, adtInputTreasuryEffective, adtInputTreasuryMaturity, - adblInputTreasuryYield, adblInputTreasuryYield, strManifestMeasure); - - java.lang.String strCleansedInput = "" + dtSpot; - - org.drip.param.valuation.ValuationParams valParamsSpot = - org.drip.param.valuation.ValuationParams.Spot (dtSpot.julian()); - - for (int j = 0; j < iNumOutputBenchmark; ++j) { - try { - strCleansedInput += "," + org.drip.quant.common.FormatUtil.FormatDouble - (aOutputBenchmarkTreasury[j].yieldFromPrice (valParamsSpot, null, null, - aOutputBenchmarkTreasury[j].priceFromYield (valParamsSpot, null, null, gc.yield - (aOutputBenchmarkTreasury[j].maturityDate()))), 1, 6, 1.); - } catch (java.lang.Exception e) { - // e.printStackTrace(); - - continue; - } - } - - for (int j = 0; j < iNumInputBenchmark; ++j) - strCleansedInput += "," + org.drip.quant.common.FormatUtil.FormatDouble - (adblInputTreasuryYield[j], 1, 6, 1.); - - System.out.println (strCleansedInput); - } - - return true; - } - - /** - * Re-constitute the Horizon Benchmark Marks - * - * @param strTreasuryType The Treasury Type - * @param mapClosingMarks Map of the Dates Closing Marks - * - * @return The Transformed Horizon Benchmark Yield - */ - - public static final boolean RegularizeBenchmarkMarks ( - final java.lang.String strTreasuryType, - final java.util.Map> mapClosingMarks) - { - return RegularizeBenchmarkMarks (strTreasuryType, mapClosingMarks, s_strCalibrationMeasure, - s_astrOutputBenchmarkTenor); - } - - /** - * Re-constitute the Horizon Benchmark Marks - * - * @param strMarksLocation The Location of the CSV Marks File - * @param strTreasuryType The Treasury Type - * - * @return The Transformed Horizon Benchmark Yield - */ - - public static final boolean RegularizeBenchmarkMarks ( - final java.lang.String strMarksLocation, - final java.lang.String strTreasuryType) - { - org.drip.feed.loader.CSVGrid csvGrid = org.drip.feed.loader.CSVParser.StringGrid (strMarksLocation, - false); - - return null == csvGrid ? false : RegularizeBenchmarkMarks (strTreasuryType, csvGrid.doubleMap - (s_dblScaler), s_strCalibrationMeasure, s_astrOutputBenchmarkTenor); - } -} diff --git a/org/drip/feed/transformer/OvernightIndexMarksReconstitutor.java b/org/drip/feed/transformer/OvernightIndexMarksReconstitutor.java deleted file mode 100644 index 08056b7..0000000 --- a/org/drip/feed/transformer/OvernightIndexMarksReconstitutor.java +++ /dev/null @@ -1,202 +0,0 @@ - -package org.drip.feed.transformer; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OvernightIndexMarksReconstitutor transforms the Overnight Instrument Manifest Measures (e.g., Deposits and - * OIS) Feed Inputs into Formats appropriate for Overnight Curve Construction and Measure Generation. - * - * @author Lakshmi Krishnamurthy - */ - -public class OvernightIndexMarksReconstitutor { - - /** - * The Standard Overnight Input Calibration Manifest Measure Scaler - */ - - public static final double s_dblScaler = 0.01; - - /** - * The Standard Overnight Swap Maturity Tenors - */ - - public static final java.lang.String[] s_astrMaturityTenor = new java.lang.String[] {"1W", "2W", "3W", - "1M", "2M", "3M", "4M", "5M", "6M", "9M", "1Y", "18M", "2Y", "3Y", "4Y", "5Y"}; - - /** - * Dump the Regularized Marks of the ISTQ Map - * - * @param strCurrency Currency - * @param mapISTQ The ISTQ Map - * @param iLatentStateType SHAPE PRESERVING/SMOOTH - * - * @return TRUE - The Regularized ISTQ Map Successfully Dumped - */ - - public static final boolean RegularizeMarks ( - final java.lang.String strCurrency, - final java.util.Map - mapISTQ, - final int iLatentStateType) - { - if (null == mapISTQ || 0 == mapISTQ.size()) return false; - - java.lang.String strHeader = "Date,"; - - for (java.lang.String strMaturityTenor : s_astrMaturityTenor) - strHeader += "OISPROC:" + strMaturityTenor + ","; - - for (java.lang.String strMaturityTenor : s_astrMaturityTenor) - strHeader += "<>,"; - - System.out.println (strHeader); - - for (java.util.Map.Entry meISTQ : mapISTQ.entrySet()) { - if (null == meISTQ) continue; - - org.drip.analytics.date.JulianDate dtSpot = meISTQ.getKey(); - - org.drip.feed.loader.InstrumentSetTenorQuote istq = meISTQ.getValue(); - - if (null == dtSpot || null == istq) continue; - - java.lang.String strDump = dtSpot.toString() + ","; - - double[] adblOISQuote = istq.instrumentQuote ("OIS"); - - java.lang.String[] astrOISMaturityTenor = istq.instrumentTenor ("OIS"); - - int iNumRegularizedTenor = s_astrMaturityTenor.length; - double[] adblRegularizedOISQuote = new double[iNumRegularizedTenor]; - int iNumOISQuote = null == adblOISQuote ? 0 : adblOISQuote.length; - int iNumOISTenor = null == astrOISMaturityTenor ? 0 : astrOISMaturityTenor.length; - - if (0 == iNumOISQuote || iNumOISQuote != iNumOISTenor) continue; - - org.drip.state.discount.MergedDiscountForwardCurve dcOvernight = - org.drip.service.template.LatentMarketStateBuilder.OvernightCurve (dtSpot, strCurrency, null, - null, null, null, null, null, null, null, null, null, astrOISMaturityTenor, adblOISQuote, - "SwapRate", iLatentStateType); - - org.drip.param.market.CurveSurfaceQuoteContainer csqc = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - if (!csqc.setFundingState (dcOvernight)) continue; - - org.drip.param.valuation.ValuationParams valParams = - org.drip.param.valuation.ValuationParams.Spot (dtSpot.julian()); - - for (int i = 0; i < iNumRegularizedTenor; ++i) - adblRegularizedOISQuote[i] = 0.; - - org.drip.product.rates.FixFloatComponent[] aOIS = - org.drip.service.template.OTCInstrumentBuilder.OISFixFloat (dtSpot, strCurrency, - s_astrMaturityTenor, adblRegularizedOISQuote, false); - - for (org.drip.product.rates.FixFloatComponent ffc : aOIS) { - try { - strDump += org.drip.quant.common.FormatUtil.FormatDouble (ffc.measureValue (valParams, - null, csqc, null, "SwapRate"), 1, 6, 1.) + ","; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - continue; - } - } - - for (int i = 0; i < iNumOISQuote; ++i) - strDump += org.drip.quant.common.FormatUtil.FormatDouble (adblOISQuote[i], 1, 6, 1.) + ","; - - System.out.println (strDump); - } - - return true; - } - - /** - * Re-constitute the Horizon Quote Marks Using a Shape Preserving Re-constructor - * - * @param strCurrency Currency - * @param strMarksLocation The Location of the CSV Marks File - * - * @return The Transformed Horizon Quote Marks - */ - - public static final boolean ShapePreservingRegularization ( - final java.lang.String strCurrency, - final java.lang.String strMarksLocation) - { - org.drip.feed.loader.CSVGrid csvGrid = org.drip.feed.loader.CSVParser.StringGrid (strMarksLocation, - false); - - return null == csvGrid ? false : RegularizeMarks (strCurrency, csvGrid.groupedOrderedDouble - (s_dblScaler), org.drip.service.template.LatentMarketStateBuilder.SHAPE_PRESERVING); - } - - /** - * Re-constitute the Horizon Quote Marks Using a Smooth Re-constructor - * - * @param strCurrency Currency - * @param strMarksLocation The Location of the CSV Marks File - * - * @return The Transformed Horizon Quote Marks - */ - - public static final boolean SmoothRegularization ( - final java.lang.String strCurrency, - final java.lang.String strMarksLocation) - { - org.drip.feed.loader.CSVGrid csvGrid = org.drip.feed.loader.CSVParser.StringGrid (strMarksLocation, - false); - - return null == csvGrid ? false : RegularizeMarks (strCurrency, csvGrid.groupedOrderedDouble - (s_dblScaler), org.drip.service.template.LatentMarketStateBuilder.SMOOTH); - } -} diff --git a/org/drip/feed/transformer/TreasuryFuturesClosesReconstitutor.java b/org/drip/feed/transformer/TreasuryFuturesClosesReconstitutor.java deleted file mode 100644 index d16f66d..0000000 --- a/org/drip/feed/transformer/TreasuryFuturesClosesReconstitutor.java +++ /dev/null @@ -1,165 +0,0 @@ - -package org.drip.feed.transformer; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TreasuryFuturesClosesReconstitutor transforms the Treasury Futures Closes- Feed Inputs into Formats - * suitable for Valuation Metrics and Sensitivities Generation. - * - * @author Lakshmi Krishnamurthy - */ - -public class TreasuryFuturesClosesReconstitutor { - - /** - * Regularize the Treasury Feed Closes - * - * @param strClosesLocation The Closes Location - * @param iSpotDateIndex Spot Date Column Index - * @param iConversionFactorIndex Conversion Factor Column Index - * @param iCleanPriceIndex Clean Price Column Index - * @param iCTDCouponIndex CTD Coupon Column Index - * @param iEffectiveDateIndex Effective Date Column Index - * @param iMaturityDateIndex Maturity Date Column Index - * @param iExpiryProxyIndex Expiry Proxy Column Index - * - * @return TRUE - The Regularization Successful - */ - - public static final boolean RegularizeCloses ( - final java.lang.String strClosesLocation, - final int iSpotDateIndex, - final int iConversionFactorIndex, - final int iCleanPriceIndex, - final int iCTDCouponIndex, - final int iEffectiveDateIndex, - final int iMaturityDateIndex, - final int iExpiryProxyIndex) - { - org.drip.feed.loader.CSVGrid csvGrid = org.drip.feed.loader.CSVParser.StringGrid (strClosesLocation, - true); - - if (null == csvGrid) return false; - - org.drip.analytics.date.JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (iSpotDateIndex); - - if (null == adtSpot) return false; - - int iNumClose = adtSpot.length; - org.drip.analytics.date.JulianDate[] adtExpiry = new org.drip.analytics.date.JulianDate[iNumClose]; - - if (0 == iNumClose) return false; - - double[] adblConversionFactor = csvGrid.doubleArrayAtColumn (iConversionFactorIndex); - - if (null == adblConversionFactor || iNumClose != adblConversionFactor.length) return false; - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (iCleanPriceIndex, 0.01); - - if (null == adblCleanPrice || iNumClose != adblCleanPrice.length) return false; - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (iCTDCouponIndex, 0.01); - - if (null == adblCoupon || iNumClose != adblCoupon.length) return false; - - org.drip.analytics.date.JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (iEffectiveDateIndex); - - if (null == adtEffective || iNumClose != adtEffective.length) return false; - - org.drip.analytics.date.JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (iMaturityDateIndex); - - if (null == adtMaturity || iNumClose != adtMaturity.length) return false; - - org.drip.analytics.date.JulianDate[] adtExpiryProxy = csvGrid.dateArrayAtColumn (iExpiryProxyIndex); - - if (null == adtExpiryProxy || iNumClose != adtExpiryProxy.length) return false; - - try { - for (int i = 0; i < iNumClose; ++i) { - if (null == adtExpiryProxy[i]) return false; - - int iExpiryProxyDate = adtExpiryProxy[i].julian(); - - int iMonth = org.drip.analytics.date.DateUtil.Month (iExpiryProxyDate); - - int iYear = 2000 + org.drip.analytics.date.DateUtil.Date (iExpiryProxyDate); - - if (null == (adtExpiry[i] = org.drip.analytics.date.DateUtil.CreateFromYMD (iYear, iMonth, - org.drip.analytics.date.DateUtil.DaysInMonth (iMonth, iYear)))) - return false; - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - System.out.println - ("CloseDate,ConversionFactor,CTDPrice,CTDCoupon,CTDEffective,CTDMaturity,FuturesExpiry"); - - for (int i = 0; i < iNumClose; ++i) - System.out.println (adtSpot[i] + "," + adblConversionFactor[i] + "," + adblCleanPrice[i] + "," + - adblCoupon[i] + "," + adtEffective[i] + "," + adtMaturity[i] + "," + adtExpiry[i]); - - return true; - } - - /** - * Regularize the UST Futures Closes Feed - * - * @param strClosesLocation The UST Futures Closes Feed Location - * - * @return TRUE - Regularization Successful - */ - - public static final boolean USTRegularizeCloses ( - final java.lang.String strClosesLocation) - { - return RegularizeCloses (strClosesLocation, 0, 1, 4, 9, 10, 8, 13); - } -} diff --git a/org/drip/function/definition/R1ToR1.java b/org/drip/function/definition/R1ToR1.java deleted file mode 100644 index 3e768a6..0000000 --- a/org/drip/function/definition/R1ToR1.java +++ /dev/null @@ -1,352 +0,0 @@ - -package org.drip.function.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * R1ToR1 provides the evaluation of the objective function and its derivatives for a specified variate. - * Default implementation of the derivatives are for non-analytical black box objective functions. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class R1ToR1 { - protected org.drip.quant.calculus.DerivativeControl _dc = null; - - protected R1ToR1 ( - final org.drip.quant.calculus.DerivativeControl dc) - { - if (null == (_dc = dc)) _dc = new org.drip.quant.calculus.DerivativeControl(); - } - - /** - * Evaluate for the given variate - * - * @param dblVariate Variate - * - * @return Returns the calculated value - * - * @throws java.lang.Exception Thrown if evaluation cannot be done - */ - - public abstract double evaluate ( - final double dblVariate) - throws java.lang.Exception; - - /** - * Calculate the Differential - * - * @param dblVariate Variate at which the derivative is to be calculated - * @param dblOFBase Base Value for the Objective Function - * @param iOrder Order of the derivative to be computed - * - * @return The Derivative - */ - - public org.drip.quant.calculus.Differential differential ( - final double dblVariate, - final double dblOFBase, - final int iOrder) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate) || 0 >= iOrder) return null; - - double dblDerivative = 0.; - double dblOrderedVariateInfinitesimal = 1.; - double dblVariateInfinitesimal = java.lang.Double.NaN; - - try { - dblVariateInfinitesimal = _dc.getVariateInfinitesimal (dblVariate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int i = 0; i <= iOrder; ++i) { - if (0 != i) dblOrderedVariateInfinitesimal *= (2. * dblVariateInfinitesimal); - - try { - dblDerivative += (i % 2 == 0 ? 1 : -1) * org.drip.quant.common.NumberUtil.NCK (iOrder, i) * - evaluate (dblVariate + dblVariateInfinitesimal * (iOrder - 2. * i)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - try { - return new org.drip.quant.calculus.Differential (dblOrderedVariateInfinitesimal, dblDerivative); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Calculate the Differential - * - * @param dblVariate Variate at which the derivative is to be calculated - * @param iOrder Order of the derivative to be computed - * - * @return The Derivative - */ - - public org.drip.quant.calculus.Differential differential ( - final double dblVariate, - final int iOrder) - { - try { - return differential (dblVariate, evaluate (dblVariate), iOrder); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Calculate the derivative as a double - * - * @param dblVariate Variate at which the derivative is to be calculated - * @param iOrder Order of the derivative to be computed - * - * @return The Derivative - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public double derivative ( - final double dblVariate, - final int iOrder) - throws java.lang.Exception - { - return differential (dblVariate, evaluate (dblVariate), iOrder).calcSlope (true); - } - - /** - * Integrate over the given range - * - * @param dblBegin Range Begin - * @param dblEnd Range End - * - * @return The Integrated Value - * - * @throws java.lang.Exception Thrown if evaluation cannot be done - */ - - public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - return org.drip.quant.calculus.R1ToR1Integrator.Boole (this, dblBegin, dblEnd); - } - - /** - * Compute the Maximal Variate and the Corresponding Function Value - * - * @return The Maximal Variate and the Corresponding Function Value - */ - - public org.drip.function.definition.VariateOutputPair maxima() - { - R1ToR1 auDerivative = new R1ToR1 (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - return derivative (dblX, 1); - } - }; - - try { - org.drip.function.r1tor1solver.FixedPointFinder fpf = new - org.drip.function.r1tor1solver.FixedPointFinderZheng (0., auDerivative, false); - - org.drip.function.r1tor1solver.FixedPointFinderOutput fpfo = fpf.findRoot(); - - if (null == fpfo) return null; - - double dblExtrema = fpfo.getRoot(); - - if (0. <= derivative (dblExtrema, 2)) return null; - - return new org.drip.function.definition.VariateOutputPair (new double[] {dblExtrema}, new - double[] {evaluate (dblExtrema)}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Maximum VOP within the Variate Range - * - * @param dblVariateLeft The Range Left End - * @param dblVariateRight The Range Right End - * - * @return The Maximum VOP - */ - - public org.drip.function.definition.VariateOutputPair maxima ( - final double dblVariateLeft, - final double dblVariateRight) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariateLeft) || - !org.drip.quant.common.NumberUtil.IsValid (dblVariateRight) || dblVariateLeft >= dblVariateRight) - return null; - - org.drip.function.definition.VariateOutputPair vop = maxima(); - - if (null != vop) { - double dblRoot = vop.variates()[0]; - - if (dblVariateLeft <= dblRoot && dblVariateRight >= dblRoot) return vop; - } - - try { - double dblLeftOutput = evaluate (dblVariateLeft); - - double dblRightOutput = evaluate (dblVariateRight); - - return dblLeftOutput > dblRightOutput ? new org.drip.function.definition.VariateOutputPair - (new double[] {dblVariateLeft}, new double[] {dblLeftOutput}) : new - org.drip.function.definition.VariateOutputPair (new double[] {dblVariateRight}, new - double[] {dblRightOutput}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Minimal Variate and the Corresponding Function Value - * - * @return The Minimal Variate and the Corresponding Function Value - */ - - public org.drip.function.definition.VariateOutputPair minima() - { - R1ToR1 auDerivative = new R1ToR1 (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - return derivative (dblX, 1); - } - }; - - try { - org.drip.function.r1tor1solver.FixedPointFinder fpf = new - org.drip.function.r1tor1solver.FixedPointFinderZheng (0., auDerivative, false); - - org.drip.function.r1tor1solver.FixedPointFinderOutput fpfo = fpf.findRoot(); - - if (null == fpfo) return null; - - double dblExtrema = fpfo.getRoot(); - - if (0. >= derivative (dblExtrema, 2)) return null; - - return new org.drip.function.definition.VariateOutputPair (new double[] {dblExtrema}, new - double[] {evaluate (dblExtrema)}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Minimum VOP within the Variate Range - * - * @param dblVariateLeft The Range Left End - * @param dblVariateRight The Range Right End - * - * @return The Minimum VOP - */ - - public org.drip.function.definition.VariateOutputPair minima ( - final double dblVariateLeft, - final double dblVariateRight) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariateLeft) || - !org.drip.quant.common.NumberUtil.IsValid (dblVariateRight) || dblVariateLeft >= dblVariateRight) - return null; - - org.drip.function.definition.VariateOutputPair vop = minima(); - - if (null != vop) { - double dblRoot = vop.variates()[0]; - - if (dblVariateLeft <= dblRoot && dblVariateRight >= dblRoot) return vop; - } - - try { - double dblLeftOutput = evaluate (dblVariateLeft); - - double dblRightOutput = evaluate (dblVariateRight); - - return dblLeftOutput < dblRightOutput ? new org.drip.function.definition.VariateOutputPair - (new double[] {dblVariateLeft}, new double[] {dblLeftOutput}) : new - org.drip.function.definition.VariateOutputPair (new double[] {dblVariateRight}, new - double[] {dblRightOutput}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/function/definition/R1ToRd.java b/org/drip/function/definition/R1ToRd.java deleted file mode 100644 index 8f5952e..0000000 --- a/org/drip/function/definition/R1ToRd.java +++ /dev/null @@ -1,216 +0,0 @@ - -package org.drip.function.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * R1ToRd provides the evaluation of the R^1 To R^d Objective Function and its derivatives for a specified - * variate. Default implementation of the derivatives are for non-analytical black box objective functions. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class R1ToRd { - private static final int QUADRATURE_SAMPLING = 10000; - - protected org.drip.quant.calculus.DerivativeControl _dc = null; - - protected R1ToRd ( - final org.drip.quant.calculus.DerivativeControl dc) - { - if (null == (_dc = dc)) _dc = new org.drip.quant.calculus.DerivativeControl(); - } - - /** - * Evaluate for the given Input R^1 Variate - * - * @param dblVariate The Input R^1 Variate - * - * @return The Output R^d Array - */ - - public abstract double[] evaluate ( - final double dblVariate); - - /** - * Calculate the Array of Differentials - * - * @param dblVariate Variate at which the derivative is to be calculated - * @param iOrder Order of the derivative to be computed - * - * @return The Array of Differentials - */ - - public org.drip.quant.calculus.Differential[] differential ( - final double dblVariate, - final int iOrder) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate) || 0 >= iOrder) return null; - - int iOutputDimension = -1; - double[] adblDerivative = null; - double dblOrderedVariateInfinitesimal = 1.; - double dblVariateInfinitesimal = java.lang.Double.NaN; - - try { - dblVariateInfinitesimal = _dc.getVariateInfinitesimal (dblVariate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int i = 0; i <= iOrder; ++i) { - if (0 != i) dblOrderedVariateInfinitesimal *= (2. * dblVariateInfinitesimal); - - double dblVariateIncremental = dblVariateInfinitesimal * (iOrder - 2. * i); - - double[] adblValue = evaluate (dblVariateIncremental); - - if (null == adblValue || 0 == (iOutputDimension = adblValue.length)) return null; - - if (null == adblDerivative) { - adblDerivative = new double[iOutputDimension]; - - for (int j = 0; j < iOutputDimension; ++j) - adblDerivative[j] = 0.; - } - - try { - for (int j = 0; j < iOutputDimension; ++j) - adblDerivative[j] += (i % 2 == 0 ? 1 : -1) * org.drip.quant.common.NumberUtil.NCK - (iOrder, i) * adblValue[j]; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - org.drip.quant.calculus.Differential[] aDiff = new - org.drip.quant.calculus.Differential[iOutputDimension]; - - try { - for (int j = 0; j < iOutputDimension; ++j) - aDiff[j] = new org.drip.quant.calculus.Differential (dblOrderedVariateInfinitesimal, - adblDerivative[j]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return aDiff; - } - - /** - * Calculate the Derivative Array as a double - * - * @param dblVariate Variate at which the derivative is to be calculated - * @param iOrder Order of the derivative to be computed - * - * @return The Derivative Array - */ - - public double[] derivative ( - final double dblVariate, - final int iOrder) - { - org.drip.quant.calculus.Differential[] aDiff = differential (dblVariate, iOrder); - - if (null == aDiff) return null; - - int iOutputDimension = aDiff.length; - double[] adblDerivative = new double[iOutputDimension]; - - if (0 == iOutputDimension) return null; - - for (int i = 0; i < iOutputDimension; ++i) - adblDerivative[i] = aDiff[i].calcSlope (true); - - return adblDerivative; - } - - /** - * Integrate over the given Input Range Using Uniform Monte-Carlo - * - * @param dblLeftEdge Input Left Edge - * @param dblRightEdge Input Right Edge - * - * @return The Array Containing the Result of the Integration over the specified Range - */ - - public double[] integrate ( - final double dblLeftEdge, - final double dblRightEdge) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblLeftEdge) || - !org.drip.quant.common.NumberUtil.IsValid (dblRightEdge) || dblRightEdge <= dblLeftEdge) - return null; - - int iOutputDimension = -1; - double[] adblIntegrand = null; - double dblVariateWidth = dblRightEdge - dblLeftEdge; - - for (int i = 0; i < QUADRATURE_SAMPLING; ++i) { - double[] adblValue = evaluate (dblLeftEdge + java.lang.Math.random() * dblVariateWidth); - - if (null == adblValue || 0 == (iOutputDimension = adblValue.length)) return null; - - if (null == adblIntegrand) adblIntegrand = new double[iOutputDimension]; - - for (int j = 0; j < iOutputDimension; ++j) - adblIntegrand[j] += adblValue[j]; - } - - for (int i = 0; i < iOutputDimension; ++i) - adblIntegrand[i] *= (dblVariateWidth / QUADRATURE_SAMPLING); - - return adblIntegrand; - } -} diff --git a/org/drip/function/definition/RdToR1.java b/org/drip/function/definition/RdToR1.java deleted file mode 100644 index bfdba15..0000000 --- a/org/drip/function/definition/RdToR1.java +++ /dev/null @@ -1,545 +0,0 @@ - -package org.drip.function.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RdToR1 provides the evaluation of the R^d To R^1 objective function and its derivatives for a specified - * set of R^d variates. Default implementation of the derivatives are for non-analytical black box objective - * functions. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class RdToR1 { - private static final int EXTREMA_SAMPLING = 10000; - private static final int QUADRATURE_SAMPLING = 10000; - - protected static final int DIMENSION_NOT_FIXED = -1; - - protected org.drip.quant.calculus.DerivativeControl _dc = null; - - /** - * Validate the Input Double Array - * - * @param adblVariate The Input Double Array - * - * @return The Input Double Array consists of valid Values - */ - - public static final boolean ValidateInput ( - final double[] adblVariate) - { - if (null == adblVariate) return false; - - int iNumVariate = adblVariate.length; - - if (0 == iNumVariate) return false; - - for (int i = 0; i < iNumVariate; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (adblVariate[i])) return false; - } - - return true; - } - - protected RdToR1 ( - final org.drip.quant.calculus.DerivativeControl dc) - { - if (null == (_dc = dc)) _dc = new org.drip.quant.calculus.DerivativeControl(); - } - - /** - * Retrieve the Dimension of the Input Variate - * - * @return The Dimension of the Input Variate - */ - - public abstract int dimension(); - - /** - * Evaluate for the given Input Variates - * - * @param adblVariate Array of Input Variates - * - * @return The Calculated Value - * - * @throws java.lang.Exception Thrown if the Evaluation cannot be done - */ - - public abstract double evaluate ( - final double[] adblVariate) - throws java.lang.Exception; - - /** - * Calculate the Differential - * - * @param adblVariate Variate Array at which the derivative is to be calculated - * @param iVariateIndex Index of the Variate whose Derivative is to be computed - * @param iOrder Order of the derivative to be computed - * - * @return The Derivative - */ - - public org.drip.quant.calculus.Differential differential ( - final double[] adblVariate, - final int iVariateIndex, - final int iOrder) - { - if (!org.drip.quant.common.NumberUtil.IsValid (adblVariate) || 0 >= iOrder) return null; - - double dblDerivative = 0.; - int iNumVariate = adblVariate.length; - double dblOrderedVariateInfinitesimal = 1.; - double dblVariateInfinitesimal = java.lang.Double.NaN; - - if (iNumVariate <= iVariateIndex) return null; - - try { - dblVariateInfinitesimal = _dc.getVariateInfinitesimal (adblVariate[iVariateIndex]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int i = 0; i <= iOrder; ++i) { - if (0 != i) dblOrderedVariateInfinitesimal *= (2. * dblVariateInfinitesimal); - - double[] adblVariateIncremental = new double[iNumVariate]; - - for (int j = 0; j < iNumVariate; ++j) - adblVariateIncremental[j] = j == iVariateIndex ? adblVariate[j] + dblVariateInfinitesimal * - (iOrder - 2. * i) : adblVariate[j]; - - try { - dblDerivative += (i % 2 == 0 ? 1 : -1) * org.drip.quant.common.NumberUtil.NCK (iOrder, i) * - evaluate (adblVariateIncremental); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - try { - return new org.drip.quant.calculus.Differential (dblOrderedVariateInfinitesimal, dblDerivative); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Calculate the derivative as a double - * - * @param adblVariate Variate Array at which the derivative is to be calculated - * @param iVariateIndex Index of the Variate whose Derivative is to be computed - * @param iOrder Order of the derivative to be computed - * - * @return The Derivative - */ - - public double derivative ( - final double[] adblVariate, - final int iVariateIndex, - final int iOrder) - { - return differential (adblVariate, iVariateIndex, iOrder).calcSlope (true); - } - - /** - * Evaluate the Jacobian for the given Input Variates - * - * @param adblVariate Array of Input Variates - * - * @return The Jacobian Array - */ - - public double[] jacobian ( - final double[] adblVariate) - { - if (null == adblVariate) return null; - - int iNumVariate = adblVariate.length; - double[] adblJacobian = new double[iNumVariate]; - - if (0 == iNumVariate) return null; - - for (int i = 0; i < iNumVariate; ++i) { - try { - adblJacobian[i] = derivative (adblVariate, i, 1); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return adblJacobian; - } - - /** - * Construct an Instance of the Unit Gradient Vector at the given Input Variates - * - * @param adblVariate Array of Input Variates - * - * @return Instance of the Unit Gradient Vector Array - */ - - public org.drip.function.definition.UnitVector gradient ( - final double[] adblVariate) - { - return org.drip.function.definition.UnitVector.Standard (jacobian (adblVariate)); - } - - /** - * Evaluate The Hessian for the given Input Variates - * - * @param adblVariate Array of Input Variates - * - * @return The Hessian Matrix - */ - - public double[][] hessian ( - final double[] adblVariate) - { - if (null == adblVariate) return null; - - final int iNumVariate = adblVariate.length; - double[][] adblHessian = new double[iNumVariate][iNumVariate]; - - if (0 == iNumVariate) return null; - - for (int i = 0; i < iNumVariate; ++i) { - final int iVariateIndex = i; - - org.drip.function.definition.RdToR1 gradientRdToR1 = new org.drip.function.definition.RdToR1 - (null) { - @Override public int dimension() - { - return iNumVariate; - } - - @Override public double evaluate ( - final double[] adblVariate) - throws java.lang.Exception - { - return derivative (adblVariate, iVariateIndex, 1); - } - }; - - for (int j = 0; j < iNumVariate; ++j) { - try { - adblHessian[i][j] = gradientRdToR1.derivative (adblVariate, j, 1); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - } - - return adblHessian; - } - - /** - * Integrate over the given Input Range Using Uniform Monte-Carlo - * - * @param adblLeftEdge Array of Input Left Edge - * @param adblRightEdge Array of Input Right Edge - * - * @return The Result of the Integration over the specified Range - * - * @throws java.lang.Exception Thrown if the Integration cannot be done - */ - - public double integrate ( - final double[] adblLeftEdge, - final double[] adblRightEdge) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (adblLeftEdge) || - !org.drip.quant.common.NumberUtil.IsValid (adblRightEdge)) - throw new java.lang.Exception ("RdToR1::integrate => Invalid Inputs"); - - double dblIntegrand = 0.; - int iNumVariate = adblLeftEdge.length; - double[] adblVariate = new double[iNumVariate]; - double[] adblVariateWidth = new double[iNumVariate]; - - if (adblRightEdge.length != iNumVariate) - throw new java.lang.Exception ("RdToR1::integrate => Invalid Inputs"); - - for (int j = 0; j < iNumVariate; ++j) - adblVariateWidth[j] = adblRightEdge[j] - adblLeftEdge[j]; - - for (int i = 0; i < QUADRATURE_SAMPLING; ++i) { - for (int j = 0; j < iNumVariate; ++j) - adblVariate[j] = adblLeftEdge[j] + java.lang.Math.random() * adblVariateWidth[j]; - - dblIntegrand += evaluate (adblVariate); - } - - for (int j = 0; j < iNumVariate; ++j) - dblIntegrand = dblIntegrand * adblVariateWidth[j]; - - return dblIntegrand / QUADRATURE_SAMPLING; - } - - /** - * Compute the Maximum VOP within the Variate Array Range Using Uniform Monte-Carlo - * - * @param adblVariateLeft The Range Left End Array - * @param adblVariateRight The Range Right End Array - * - * @return The Maximum VOP - */ - - public org.drip.function.definition.VariateOutputPair maxima ( - final double[] adblVariateLeft, - final double[] adblVariateRight) - { - if (!org.drip.quant.common.NumberUtil.IsValid (adblVariateLeft) || - !org.drip.quant.common.NumberUtil.IsValid (adblVariateRight)) - return null; - - double dblValue = java.lang.Double.NaN; - double dblMaxima = java.lang.Double.NaN; - int iNumVariate = adblVariateLeft.length; - double[] adblVariate = new double[iNumVariate]; - double[] adblVariateWidth = new double[iNumVariate]; - double[] adblMaximaVariate = new double[iNumVariate]; - - if (adblVariateRight.length != iNumVariate) return null; - - for (int j = 0; j < iNumVariate; ++j) - adblVariateWidth[j] = adblVariateRight[j] - adblVariateLeft[j]; - - for (int i = 0; i < EXTREMA_SAMPLING; ++i) { - for (int j = 0; j < iNumVariate; ++j) - adblVariate[j] = adblVariateLeft[j] + java.lang.Math.random() * adblVariateWidth[j]; - - try { - dblValue = evaluate (adblVariate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (!org.drip.quant.common.NumberUtil.IsValid (dblMaxima)) { - dblMaxima = dblValue; - - for (int j = 0; j < iNumVariate; ++j) - adblMaximaVariate[j] = adblVariate[j]; - } else { - if (dblMaxima < dblValue) { - dblMaxima = dblValue; - - for (int j = 0; j < iNumVariate; ++j) - adblMaximaVariate[j] = adblVariate[j]; - } - } - } - - try { - return new org.drip.function.definition.VariateOutputPair (adblMaximaVariate, new double[] - {dblMaxima}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Minimum VOP within the Variate Array Range Using Uniform Monte-Carlo - * - * @param adblVariateLeft The Range Left End Array - * @param adblVariateRight The Range Right End Array - * - * @return The Minimum VOP - */ - - public org.drip.function.definition.VariateOutputPair minima ( - final double[] adblVariateLeft, - final double[] adblVariateRight) - { - if (!org.drip.quant.common.NumberUtil.IsValid (adblVariateLeft) || - !org.drip.quant.common.NumberUtil.IsValid (adblVariateRight)) - return null; - - double dblValue = java.lang.Double.NaN; - double dblMinima = java.lang.Double.NaN; - int iNumVariate = adblVariateLeft.length; - double[] adblVariate = new double[iNumVariate]; - double[] adblVariateWidth = new double[iNumVariate]; - double[] adblMinimaVariate = new double[iNumVariate]; - - if (adblVariateRight.length != iNumVariate) return null; - - for (int j = 0; j < iNumVariate; ++j) - adblVariateWidth[j] = adblVariateRight[j] - adblVariateLeft[j]; - - for (int i = 0; i < EXTREMA_SAMPLING; ++i) { - for (int j = 0; j < iNumVariate; ++j) - adblVariate[j] = adblVariateLeft[j] + java.lang.Math.random() * adblVariateWidth[j]; - - try { - dblValue = evaluate (adblVariate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (!org.drip.quant.common.NumberUtil.IsValid (dblMinima)) { - dblMinima = dblValue; - - for (int j = 0; j < iNumVariate; ++j) - adblMinimaVariate[j] = adblVariate[j]; - } else { - if (dblMinima > dblValue) { - dblMinima = dblValue; - - for (int j = 0; j < iNumVariate; ++j) - adblMinimaVariate[j] = adblVariate[j]; - } - } - } - - try { - return new org.drip.function.definition.VariateOutputPair (adblMinimaVariate, new double[] - {dblMinima}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Modulus of the Gradient at the Specified Variate location - * - * @param adblVariate The Variate Array location - * - * @return The Modulus of the Gradient at the Specified Variate location - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double gradientModulus ( - final double[] adblVariate) - throws java.lang.Exception - { - double[] adblJacobian = jacobian (adblVariate); - - if (null == adblJacobian) - throw new java.lang.Exception ("RdToR1::gradientModulus => Invalid Inputs!"); - - double dblGradientModulus = 0.; - int iNumVariate = adblVariate.length; - - for (int i = 0; i < iNumVariate; ++i) - dblGradientModulus += adblJacobian[i] * adblJacobian[i]; - - return dblGradientModulus; - } - - /** - * Generate the Gradient Modulus Function - * - * @return The Gradient Modulus Function - */ - - public org.drip.function.definition.RdToR1 gradientModulusFunction() - { - org.drip.function.definition.RdToR1 gradientModulusRdToR1 = new org.drip.function.definition.RdToR1 - (null) { - @Override public int dimension() - { - return dimension(); - } - - @Override public double evaluate ( - final double[] adblVariate) - throws java.lang.Exception - { - return gradientModulus (adblVariate); - } - - @Override public double[] jacobian ( - final double[] adblVariate) - { - double[] adblParentJacobian = jacobian (adblVariate); - - double[][] adblParentHessian = hessian (adblVariate); - - if (null == adblParentJacobian || null == adblParentHessian) return null; - - int iDimension = adblParentJacobian.length; - double[] adblGradientModulusJacobian = new double[iDimension]; - - for (int k = 0; k < iDimension; ++k) { - adblGradientModulusJacobian[k] = 0.; - - for (int i = 0; i < iDimension; ++i) - adblGradientModulusJacobian[k] += adblParentJacobian[i] * adblParentHessian[i][k]; - - adblGradientModulusJacobian[k] *= 2.; - } - - return adblGradientModulusJacobian; - } - }; - - return gradientModulusRdToR1; - } -} diff --git a/org/drip/function/definition/RdToRd.java b/org/drip/function/definition/RdToRd.java deleted file mode 100644 index 9cf80a5..0000000 --- a/org/drip/function/definition/RdToRd.java +++ /dev/null @@ -1,242 +0,0 @@ - -package org.drip.function.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RdToRd provides the evaluation of the R^d To R^d objective function and its derivatives for a specified - * set of R^d variates. Default implementation of the derivatives are for non-analytical black box objective - * functions. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class RdToRd { - private static final int QUADRATURE_SAMPLING = 10000; - - protected org.drip.quant.calculus.DerivativeControl _dc = null; - - protected RdToRd ( - final org.drip.quant.calculus.DerivativeControl dc) - { - if (null == (_dc = dc)) _dc = new org.drip.quant.calculus.DerivativeControl(); - } - - /** - * Evaluate for the given Input R^d Variates - * - * @param adblVariate Array of Input R^d Variates - * - * @return The Output R^d Variates - */ - - public abstract double[] evaluate ( - final double[] adblVariate); - - /** - * Calculate the Array of Differentials - * - * @param adblVariate Variate Array at which the derivative is to be calculated - * @param iVariateIndex Index of the Variate whose Derivative is to be computed - * @param iOrder Order of the derivative to be computed - * - * @return The Array of Differentials - */ - - public org.drip.quant.calculus.Differential[] differential ( - final double[] adblVariate, - final int iVariateIndex, - final int iOrder) - { - if (!org.drip.quant.common.NumberUtil.IsValid (adblVariate) || 0 >= iOrder) return null; - - int iOutputDimension = -1; - double[] adblDerivative = null; - int iNumVariate = adblVariate.length; - double dblOrderedVariateInfinitesimal = 1.; - double dblVariateInfinitesimal = java.lang.Double.NaN; - - if (iNumVariate <= iVariateIndex) return null; - - try { - dblVariateInfinitesimal = _dc.getVariateInfinitesimal (adblVariate[iVariateIndex]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int i = 0; i <= iOrder; ++i) { - if (0 != i) dblOrderedVariateInfinitesimal *= (2. * dblVariateInfinitesimal); - - double[] adblVariateIncremental = new double[iNumVariate]; - - for (int j = 0; i < iNumVariate; ++j) - adblVariateIncremental[j] = j == iVariateIndex ? adblVariate[j] + dblVariateInfinitesimal * - (iOrder - 2. * i) : adblVariate[j]; - - double[] adblValue = evaluate (adblVariateIncremental); - - if (null == adblValue || 0 == (iOutputDimension = adblValue.length)) return null; - - if (null == adblDerivative) { - adblDerivative = new double[iOutputDimension]; - - for (int j = 0; j < iOutputDimension; ++j) - adblDerivative[j] = 0.; - } - - try { - for (int j = 0; j < iOutputDimension; ++j) - adblDerivative[j] += (i % 2 == 0 ? 1 : -1) * org.drip.quant.common.NumberUtil.NCK - (iOrder, i) * adblValue[j]; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - org.drip.quant.calculus.Differential[] aDiff = new - org.drip.quant.calculus.Differential[iOutputDimension]; - - try { - for (int j = 0; j < iOutputDimension; ++j) - aDiff[j] = new org.drip.quant.calculus.Differential (dblOrderedVariateInfinitesimal, - adblDerivative[j]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return aDiff; - } - - /** - * Calculate the Derivative Array as a double - * - * @param adblVariate Variate Array at which the derivative is to be calculated - * @param iVariateIndex Index of the Variate whose Derivative is to be computed - * @param iOrder Order of the derivative to be computed - * - * @return The Derivative Array - */ - - public double[] derivative ( - final double[] adblVariate, - final int iVariateIndex, - final int iOrder) - { - org.drip.quant.calculus.Differential[] aDiff = differential (adblVariate, iVariateIndex, iOrder); - - if (null == aDiff) return null; - - int iOutputDimension = aDiff.length; - double[] adblDerivative = new double[iOutputDimension]; - - if (0 == iOutputDimension) return null; - - for (int i = 0; i < iOutputDimension; ++i) - adblDerivative[i] = aDiff[i].calcSlope (true); - - return adblDerivative; - } - - /** - * Integrate over the given Input Range Using Uniform Monte-Carlo - * - * @param adblLeftEdge Array of Input Left Edge - * @param adblRightEdge Array of Input Right Edge - * - * @return The Array Containing the Result of the Integration over the specified Range - */ - - public double[] integrate ( - final double[] adblLeftEdge, - final double[] adblRightEdge) - { - if (!org.drip.quant.common.NumberUtil.IsValid (adblLeftEdge) || - !org.drip.quant.common.NumberUtil.IsValid (adblRightEdge)) - return null; - - int iOutputDimension = -1; - double[] adblIntegrand = null; - int iNumVariate = adblLeftEdge.length; - double[] adblVariate = new double[iNumVariate]; - double[] adblVariateWidth = new double[iNumVariate]; - - if (adblRightEdge.length != iNumVariate) return null; - - for (int j = 0; j < iNumVariate; ++j) - adblVariateWidth[j] = adblRightEdge[j] - adblLeftEdge[j]; - - for (int i = 0; i < QUADRATURE_SAMPLING; ++i) { - for (int j = 0; j < iNumVariate; ++j) - adblVariate[j] = adblLeftEdge[j] + java.lang.Math.random() * adblVariateWidth[j]; - - double[] adblValue = evaluate (adblVariate); - - if (null == adblValue || 0 == (iOutputDimension = adblValue.length)) return null; - - if (null == adblIntegrand) adblIntegrand = new double[iOutputDimension]; - - for (int j = 0; j < iOutputDimension; ++j) - adblIntegrand[j] += adblValue[j]; - } - - for (int i = 0; i < iOutputDimension; ++i) { - for (int j = 0; j < iNumVariate; ++j) - adblIntegrand[i] = adblIntegrand[i] * adblVariateWidth[j]; - - adblIntegrand[i] /= QUADRATURE_SAMPLING; - } - - return adblIntegrand; - } -} diff --git a/org/drip/function/definition/SizedVector.java b/org/drip/function/definition/SizedVector.java deleted file mode 100644 index 2b3bb31..0000000 --- a/org/drip/function/definition/SizedVector.java +++ /dev/null @@ -1,140 +0,0 @@ - -package org.drip.function.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * SizedVector holds the R^d Unit Direction Vector along with its Magnitude. - * - * @author Lakshmi Krishnamurthy - */ - -public class SizedVector { - private double _dblMagnitude = java.lang.Double.NaN; - private org.drip.function.definition.UnitVector _uv = null; - - /** - * Construct an Instance of the Sized Vector from the Input Array - * - * @param adbl The Input Double Array - * - * @return The Sized Vector Instance - */ - - public static final SizedVector Standard ( - final double[] adbl) - { - if (null == adbl) return null; - - double dblModulus = 0.; - int iDimension = adbl.length; - double[] adblComponent = 0 == iDimension ? null : new double[iDimension]; - - if (0 == iDimension) return null; - - for (int i = 0; i < iDimension; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (adbl[i])) return null; - - dblModulus += adbl[i] * adbl[i]; - } - - if (0. == dblModulus) return null; - - dblModulus = java.lang.Math.sqrt (dblModulus); - - for (int i = 0; i < iDimension; ++i) - adblComponent[i] = adbl[i] / dblModulus; - - try { - return new SizedVector (new org.drip.function.definition.UnitVector (adblComponent), dblModulus); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * SizedVector Constructor - * - * @param uv The Unit Vector - * @param dblMagnitude Magnitude of the Vector - * - * @throws java.lang.Exception Thriwn if the Inputs are Invalid - */ - - public SizedVector ( - final org.drip.function.definition.UnitVector uv, - final double dblMagnitude) - throws java.lang.Exception - { - if (null == (_uv = uv) || !org.drip.quant.common.NumberUtil.IsValid (_dblMagnitude = dblMagnitude)) - throw new java.lang.Exception ("SizedVector Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Unit Direction Vector - * - * @return The Unit Vector Direction Instance - */ - - public org.drip.function.definition.UnitVector direction() - { - return _uv; - } - - /** - * Retrieve the Vector Magnitude - * - * @return The Vector Magnitude - */ - - public double magnitude() - { - return _dblMagnitude; - } -} diff --git a/org/drip/function/definition/UnitVector.java b/org/drip/function/definition/UnitVector.java deleted file mode 100644 index f9220b4..0000000 --- a/org/drip/function/definition/UnitVector.java +++ /dev/null @@ -1,139 +0,0 @@ - -package org.drip.function.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * UnitVector implements the Normalized R^d Unit Vector. - * - * @author Lakshmi Krishnamurthy - */ - -public class UnitVector { - private double[] _adblComponent; - - /** - * Construct an Instance of the Unit Vector from the Input Vector - * - * @param adbl The Input Double Vector - * - * @return The Unit Vector Instance - */ - - public static final UnitVector Standard ( - final double[] adbl) - { - if (null == adbl) return null; - - int iDimension = adbl.length; - double dblGradientModulus = 0.; - double[] adblComponent = new double[iDimension]; - - if (0 == iDimension) return null; - - for (int i = 0; i < iDimension; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (adbl[i])) return null; - - dblGradientModulus += adbl[i] * adbl[i]; - } - - if (0. == dblGradientModulus) return null; - - dblGradientModulus = java.lang.Math.sqrt (dblGradientModulus); - - for (int i = 0; i < iDimension; ++i) - adblComponent[i] = adbl[i] / dblGradientModulus; - - return new UnitVector (adblComponent); - } - - protected UnitVector ( - final double[] adblComponent) - { - _adblComponent = adblComponent; - } - - /** - * Retrieve the Unit Vector's Component Array - * - * @return The Unit Vector's Component Array - */ - - public double[] component() - { - return _adblComponent; - } - - /** - * Compute the Directional Increment along the Vector - * - * @param adblVariate The Starting R^d Variate - * @param dblStepLength The Step Length - * - * @return The Directionally Incremented Vector - */ - - public double[] directionalIncrement ( - final double[] adblVariate, - final double dblStepLength) - { - if (null == adblVariate || !org.drip.quant.common.NumberUtil.IsValid (dblStepLength)) return null; - - int iVariateDimension = adblVariate.length; - double[] adblIncrementedVariate = new double[iVariateDimension]; - - if (iVariateDimension != _adblComponent.length) return null; - - for (int i = 0; i < iVariateDimension; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (adblVariate[i])) return null; - - adblIncrementedVariate[i] = adblVariate[i] + dblStepLength * _adblComponent[i]; - } - - return adblIncrementedVariate; - } -} diff --git a/org/drip/function/definition/VariateOutputPair.java b/org/drip/function/definition/VariateOutputPair.java deleted file mode 100644 index 9e58632..0000000 --- a/org/drip/function/definition/VariateOutputPair.java +++ /dev/null @@ -1,109 +0,0 @@ - -package org.drip.function.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * VariateOutputPair records the Multidimensional Variate and its corresponding Objective Function Value. - * - * @author Lakshmi Krishnamurthy - */ - -public class VariateOutputPair { - private double[] _adblOutput = null; - private double[] _adblVariate = null; - - /** - * VariateOutputPair Constructor - * - * @param adblVariate Array of Variates - * @param adblOutput Array of Output - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public VariateOutputPair ( - final double[] adblVariate, - final double[] adblOutput) - throws java.lang.Exception - { - if (null == (_adblVariate = adblVariate) || null == (_adblOutput = adblOutput)) - throw new java.lang.Exception ("VariateOutputPair ctr: Invalid Inputs"); - - int iNumVariate = _adblVariate.length; - - if (0 == iNumVariate) throw new java.lang.Exception ("VariateOutputPair ctr: Invalid Inputs"); - - for (int i = 0; i < iNumVariate; ++i) { - if (!!org.drip.quant.common.NumberUtil.IsValid (adblVariate[i])) - throw new java.lang.Exception ("VariateOutputPair ctr: Invalid Inputs"); - } - } - - /** - * Retrieve the Variate Array - * - * @return The Variate Array - */ - - public double[] variates() - { - return _adblVariate; - } - - /** - * Retrieve the Function Output Value Array - * - * @return The Function Output Value Array - */ - - public double[] output() - { - return _adblOutput; - } -} diff --git a/org/drip/function/r1tor1/AlmgrenEnhancedEulerUpdate.java b/org/drip/function/r1tor1/AlmgrenEnhancedEulerUpdate.java deleted file mode 100644 index c4790fb..0000000 --- a/org/drip/function/r1tor1/AlmgrenEnhancedEulerUpdate.java +++ /dev/null @@ -1,126 +0,0 @@ - -package org.drip.function.r1tor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AlmgrenEnhancedEulerUpdate is a R^1 To R^1 Function that is used in Almgren (2009, 2012) to illustrate the - * Construction of the Enhanced Euler Update Scheme. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * @author Lakshmi Krishnamurthy - */ - -public class AlmgrenEnhancedEulerUpdate extends org.drip.function.definition.R1ToR1 { - private double _dblA = java.lang.Double.NaN; - private double _dblB = java.lang.Double.NaN; - - /** - * AlmgrenEnhancedEulerUpdate Constructor - * - * @param dblA The "A" Parameter - * @param dblB The "B" Parameter - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public AlmgrenEnhancedEulerUpdate ( - final double dblA, - final double dblB) - throws java.lang.Exception - { - super (null); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblA = dblA) || - !org.drip.quant.common.NumberUtil.IsValid (_dblB = dblB) || _dblA == _dblB) - throw new java.lang.Exception ("AlmgrenEnhancedEulerUpdate Constructor => Inbalid Inputs"); - } - - /** - * Retrieve the "A" Parameter - * - * @return The "A" Parameter - */ - - public double a() - { - return _dblA; - } - - /** - * Retrieve the "B" Parameter - * - * @return The "B" Parameter - */ - - public double b() - { - return _dblB; - } - - @Override public double evaluate ( - final double dblT) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblT)) - throw new java.lang.Exception ("AlmgrenEnhancedEulerUpdate::evaluate => Invalid Inputs"); - - double dblInvExpAT = java.lang.Math.exp (-1. * _dblA * dblT); - - double dblInvExpBT = java.lang.Math.exp (-1. * _dblB * dblT); - - return (_dblA * dblInvExpBT - _dblB * dblInvExpAT) / (dblInvExpBT - dblInvExpAT); - } -} diff --git a/org/drip/function/r1tor1/AndersenPiterbargMeanReverter.java b/org/drip/function/r1tor1/AndersenPiterbargMeanReverter.java deleted file mode 100644 index 97e46b4..0000000 --- a/org/drip/function/r1tor1/AndersenPiterbargMeanReverter.java +++ /dev/null @@ -1,93 +0,0 @@ - -package org.drip.function.r1tor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * AndersenPiterbargMeanReverter implements the mean-reverting Univariate Function detailed in: - * - * - Andersen and Piterbarg (2010): Interest Rate Modeling (3 Volumes), Atlantic Financial Press. - * - * @author Lakshmi Krishnamurthy - */ - -public class AndersenPiterbargMeanReverter extends org.drip.function.definition.R1ToR1 { - private org.drip.function.r1tor1.ExponentialDecay _auExpDecay = null; - private org.drip.function.definition.R1ToR1 _auSteadyState = null; - - /** - * AndersenPiterbargMeanReverter constructor - * - * @param auExpDecay The Exponential Decay Univariate Function - * @param auSteadyState The Steady State (i.e., Infinite Time) Undamped Behavior Univariate Function - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public AndersenPiterbargMeanReverter ( - final org.drip.function.r1tor1.ExponentialDecay auExpDecay, - final org.drip.function.definition.R1ToR1 auSteadyState) - throws java.lang.Exception - { - super (null); - - if (null == (_auExpDecay = auExpDecay) || null == (_auSteadyState = auSteadyState)) - throw new java.lang.Exception ("AndersenPiterbargMeanReverter ctr => Invalid Inputs"); - } - - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate)) - throw new java.lang.Exception ("AndersenPiterbargMeanReverter::evaluate => Invalid Inputs"); - - return (1. - _auExpDecay.evaluate (dblVariate)) * _auSteadyState.evaluate (dblVariate); - } -} diff --git a/org/drip/function/r1tor1/Bennett.java b/org/drip/function/r1tor1/Bennett.java deleted file mode 100644 index 6262077..0000000 --- a/org/drip/function/r1tor1/Bennett.java +++ /dev/null @@ -1,81 +0,0 @@ - -package org.drip.function.r1tor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * Bennett is implementation of the Bennett's Function used in the Estimation of the Bennett's Concentration - * Inequality. - * - * @author Lakshmi Krishnamurthy - */ - -public class Bennett extends org.drip.function.definition.R1ToR1 { - - /** - * Bennett constructor - * - * @throws java.lang.Exception Thrown if Bennett cannot be instantiated - */ - - public Bennett() - throws java.lang.Exception - { - super (null); - } - - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate) || dblVariate < 0.) - throw new java.lang.Exception ("Bennett::evaluate => Invalid Inputs"); - - return (1. + dblVariate) * java.lang.Math.log (1. + dblVariate) - dblVariate; - } -} diff --git a/org/drip/function/r1tor1/BernsteinPolynomial.java b/org/drip/function/r1tor1/BernsteinPolynomial.java deleted file mode 100644 index ca5bf12..0000000 --- a/org/drip/function/r1tor1/BernsteinPolynomial.java +++ /dev/null @@ -1,89 +0,0 @@ - -package org.drip.function.r1tor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * BernsteinPolynomial provides the evaluation of the BernsteinPolynomial and its derivatives for a specified - * variate. - * - * @author Lakshmi Krishnamurthy - */ - -public class BernsteinPolynomial extends org.drip.function.r1tor1.UnivariateConvolution { - - /** - * Construct a BernsteinPolynomial instance - * - * @param iBaseExponent Base Exponent - * @param iComplementExponent Complement Exponent - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public BernsteinPolynomial ( - final int iBaseExponent, - final int iComplementExponent) - throws java.lang.Exception - { - super (new org.drip.function.r1tor1.NaturalLogSeriesElement (iBaseExponent), new - org.drip.function.r1tor1.UnivariateReflection (new org.drip.function.r1tor1.NaturalLogSeriesElement - (iComplementExponent))); - } - - public static final void main ( - final java.lang.String[] astrArgs) - throws java.lang.Exception - { - BernsteinPolynomial bp = new BernsteinPolynomial (3, 3); - - System.out.println ("BPDeriv[0.25] = " + bp.derivative (0.25, 1)); - } -} diff --git a/org/drip/function/r1tor1/ExponentialDecay.java b/org/drip/function/r1tor1/ExponentialDecay.java deleted file mode 100644 index 23ab8be..0000000 --- a/org/drip/function/r1tor1/ExponentialDecay.java +++ /dev/null @@ -1,142 +0,0 @@ - -package org.drip.function.r1tor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ExponentialDecay implements the scaled exponential decay Univariate Function. - * - * @author Lakshmi Krishnamurthy - */ - -public class ExponentialDecay extends org.drip.function.definition.R1ToR1 { - private double _dblEpoch = java.lang.Double.NaN; - private double _dblHazard = java.lang.Double.NaN; - - /** - * ExponentialDecay constructor - * - * @param dblEpoch The Starting Epoch - * @param dblHazard The Exponential Decay Hazard Rate - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public ExponentialDecay ( - final double dblEpoch, - final double dblHazard) - throws java.lang.Exception - { - super (null); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblEpoch = dblEpoch) || - !org.drip.quant.common.NumberUtil.IsValid (_dblHazard = dblHazard)) - throw new java.lang.Exception ("ExponentialDecay ctr => Invalid Inputs"); - } - - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate)) - throw new java.lang.Exception ("ExponentialDecay::evaluate => Invalid Inputs"); - - return java.lang.Math.exp (-1. * _dblHazard * (dblVariate - _dblEpoch)); - } - - @Override public double derivative ( - final double dblVariate, - final int iOrder) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate) || 0 >= iOrder) - throw new java.lang.Exception ("ExponentialDecay::derivative => Invalid Inputs"); - - double dblDerivativeFactor = 1; - - for (int i = 0; i < iOrder; ++i) - dblDerivativeFactor *= (-1. * _dblHazard); - - return dblDerivativeFactor * evaluate (dblVariate); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || !org.drip.quant.common.NumberUtil.IsValid - (dblEnd)) - throw new java.lang.Exception ("ExponentialDecay::integrate => Invalid Inputs"); - - return (evaluate (dblEnd) - evaluate (dblBegin)) / (-1. * _dblHazard); - } - - /** - * Retrieve the Epoch - * - * @return The Epoch - */ - - public double epoch() - { - return _dblEpoch; - } - - /** - * Retrieve the Hazard - * - * @return The Hazard - */ - - public double hazard() - { - return _dblHazard; - } -} diff --git a/org/drip/function/r1tor1/ExponentialTension.java b/org/drip/function/r1tor1/ExponentialTension.java deleted file mode 100644 index c14426f..0000000 --- a/org/drip/function/r1tor1/ExponentialTension.java +++ /dev/null @@ -1,182 +0,0 @@ - -package org.drip.function.r1tor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * ExponentialTension provides the evaluation of the Exponential Tension Function and its derivatives for a - * specified variate. - * - * @author Lakshmi Krishnamurthy - */ - -public class ExponentialTension extends org.drip.function.definition.R1ToR1 { - private boolean _bIsBaseNatural = false; - private double _dblBase = java.lang.Double.NaN; - private double _dblTension = java.lang.Double.NaN; - - /** - * ExponentialTension constructor - * - * @param dblBase Base of the ExponentialTension Function - * @param dblTension Tension of the ExponentialTension Function - * - * @throws java.lang.Exception Thrown if the input is invalid - */ - - public ExponentialTension ( - final double dblBase, - final double dblTension) - throws java.lang.Exception - { - super (null); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblBase = dblBase) || - !org.drip.quant.common.NumberUtil.IsValid (_dblTension = dblTension)) - throw new java.lang.Exception ("ExponentialTension ctr: Invalid Inputs"); - - _bIsBaseNatural = _dblBase == java.lang.Math.E; - } - - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate)) - throw new java.lang.Exception ("ExponentialTension::evaluate => Invalid Inputs"); - - return _bIsBaseNatural ? java.lang.Math.exp (_dblTension * dblVariate) : java.lang.Math.pow - (_dblBase, _dblTension * dblVariate); - } - - @Override public double derivative ( - final double dblVariate, - final int iOrder) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate) || 0 > iOrder) - throw new java.lang.Exception ("ExponentialTension::derivative => Invalid Inputs"); - - double dblDerivFactor = 1.; - - for (int i = 0; i < iOrder; ++i) - dblDerivFactor *= _dblTension; - - return _bIsBaseNatural ? dblDerivFactor * java.lang.Math.exp (_dblTension * dblVariate) : - dblDerivFactor * java.lang.Math.exp (_dblTension * dblVariate); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || !org.drip.quant.common.NumberUtil.IsValid - (dblEnd)) - throw new java.lang.Exception ("ExponentialTension::integrate => Invalid Inputs"); - - return _bIsBaseNatural ? (java.lang.Math.exp (_dblTension * dblEnd) - java.lang.Math.exp (_dblTension - * dblBegin)) / _dblTension : (java.lang.Math.pow (_dblBase, _dblTension * dblEnd) - - java.lang.Math.pow (_dblBase, _dblTension * dblBegin)) / (_dblTension * java.lang.Math.log - (_dblBase)); - } - - /** - * Is the base natural? - * - * @return TRUE - Base is off of natural logarithm - */ - - public boolean isBaseNatural() - { - return _bIsBaseNatural; - } - - /** - * Retrieve the Base - * - * @return The Base - */ - - public double getBase() - { - return _dblBase; - } - - /** - * Retrieve the Tension Parameter - * - * @return Tension Parameter - */ - - public double getTension() - { - return _dblTension; - } - - public static final void main ( - final java.lang.String[] astrArgs) - throws java.lang.Exception - { - ExponentialTension e = new ExponentialTension (java.lang.Math.E, 2.); - - System.out.println ("E[0.0] = " + e.evaluate (0.0)); - - System.out.println ("E[0.5] = " + e.evaluate (0.5)); - - System.out.println ("E[1.0] = " + e.evaluate (1.0)); - - System.out.println ("EDeriv[0.0] = " + e.derivative (0.0, 2)); - - System.out.println ("EDeriv[0.5] = " + e.derivative (0.5, 2)); - - System.out.println ("EDeriv[1.0] = " + e.derivative (1.0, 2)); - } -} diff --git a/org/drip/function/r1tor1/FlatUnivariate.java b/org/drip/function/r1tor1/FlatUnivariate.java deleted file mode 100644 index ac45354..0000000 --- a/org/drip/function/r1tor1/FlatUnivariate.java +++ /dev/null @@ -1,116 +0,0 @@ - -package org.drip.function.r1tor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FlatUnivariate implements the level constant Univariate Function. - * - * @author Lakshmi Krishnamurthy - */ - -public class FlatUnivariate extends org.drip.function.definition.R1ToR1 { - private double _dblLevel = java.lang.Double.NaN; - - /** - * FlatUnivariate constructor - * - * @param dblLevel The FlatUnivariate Level - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public FlatUnivariate ( - final double dblLevel) - throws java.lang.Exception - { - super (null); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblLevel = dblLevel)) - throw new java.lang.Exception ("FlatUnivariate ctr => Invalid Inputs"); - } - - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate)) - throw new java.lang.Exception ("FlatUnivariate::evaluate => Invalid Inputs"); - - return _dblLevel; - } - - @Override public org.drip.quant.calculus.Differential differential ( - final double dblVariate, - final double dblOFBase, - final int iOrder) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate) || 0 >= iOrder) return null; - - try { - return new org.drip.quant.calculus.Differential (_dc.getVariateInfinitesimal (dblVariate), 0.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || !org.drip.quant.common.NumberUtil.IsValid - (dblEnd)) - throw new java.lang.Exception ("FlatUnivariate::integrate => Invalid Inputs"); - - return (dblEnd - dblBegin) * _dblLevel; - } -} diff --git a/org/drip/function/r1tor1/FunctionClassSupremum.java b/org/drip/function/r1tor1/FunctionClassSupremum.java deleted file mode 100644 index 1d1fe47..0000000 --- a/org/drip/function/r1tor1/FunctionClassSupremum.java +++ /dev/null @@ -1,180 +0,0 @@ - -package org.drip.function.r1tor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FunctionClassSupremum implements the Univariate Function that corresponds to the Supremum among the - * specified Class of Functions. - * - * @author Lakshmi Krishnamurthy - */ - -public class FunctionClassSupremum extends org.drip.function.definition.R1ToR1 { - class IndexSupremum { - int _iIndex = -1; - double _dblSupremum = java.lang.Double.NaN; - - IndexSupremum ( - final int iIndex, - final double dblSupremum) - { - _iIndex = iIndex; - _dblSupremum = dblSupremum; - } - }; - - private org.drip.function.definition.R1ToR1[] _aAUClass = null; - - private IndexSupremum supremum ( - final double dblVariate) - { - int iIndex = 0; - int iNumFunction = _aAUClass.length; - - try { - double dblSupremum = _aAUClass[0].evaluate (dblVariate); - - for (int i = 1; i < iNumFunction; ++i) { - double dblValue = _aAUClass[i].evaluate (dblVariate); - - if (dblValue > dblSupremum) { - iIndex = i; - dblSupremum = dblValue; - } - } - - return new IndexSupremum (iIndex, dblSupremum); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * FunctionClassSupremum Cnstructor - * - * @param aAUClass Array of Functions in the Class - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public FunctionClassSupremum ( - final org.drip.function.definition.R1ToR1[] aAUClass) - throws java.lang.Exception - { - super (null); - - if (null == (_aAUClass = aAUClass) || 0 == _aAUClass.length) - throw new java.lang.Exception ("FunctionClassSupremum ctr => Invalid Inputs"); - } - - /** - * Retrieve the Class of Functions - * - * @return The Class of Functions - */ - - public org.drip.function.definition.R1ToR1[] functionClass() - { - return _aAUClass; - } - - /** - * Retrieve the Supremum Function corresponding to the specified Variate - * - * @param dblVariate The Variate - * - * @return The Supremum Function corresponding to the specified Variate - */ - - public org.drip.function.definition.R1ToR1 supremumFunction ( - final double dblVariate) - { - IndexSupremum is = supremum (dblVariate); - - return null == is ? null : _aAUClass[is._iIndex]; - } - - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - IndexSupremum is = supremum (dblVariate); - - if (null == is) throw new java.lang.Exception ("FunctionClassSupremum::evaluate => Invalid Inputs"); - - return is._dblSupremum; - } - - @Override public double derivative ( - final double dblVariate, - final int iOrder) - throws java.lang.Exception - { - IndexSupremum is = supremum (dblVariate); - - if (null == is) - throw new java.lang.Exception ("FunctionClassSupremum::derivative => Invalid Inputs"); - - return _aAUClass[is._iIndex].derivative (dblVariate, iOrder); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - IndexSupremum is = supremum (0.5 * (dblBegin + dblEnd)); - - if (null == is) throw new java.lang.Exception ("FunctionClassSupremum::integrate => Invalid Inputs"); - - return _aAUClass[is._iIndex].integrate (dblBegin, dblEnd); - } -} diff --git a/org/drip/function/r1tor1/HyperbolicTension.java b/org/drip/function/r1tor1/HyperbolicTension.java deleted file mode 100644 index 79b6156..0000000 --- a/org/drip/function/r1tor1/HyperbolicTension.java +++ /dev/null @@ -1,182 +0,0 @@ - -package org.drip.function.r1tor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * HyperbolicTension provides the evaluation of the Hyperbolic Tension Function and its derivatives for a - * specified variate. - * - * @author Lakshmi Krishnamurthy - */ - -public class HyperbolicTension extends org.drip.function.definition.R1ToR1 { - - /** - * Hyperbolic Tension Function Type - sinh - */ - - public static final int SINH = 1; - - /** - * Hyperbolic Tension Function Type - cosh - */ - - public static final int COSH = 2; - - private int _iType = -1; - private double _dblTension = java.lang.Double.NaN; - - /** - * HyperbolicTension constructor - * - * @param iType Type of the HyperbolicTension Function - SINH/COSH/TANH - * @param dblTension Tension of the HyperbolicTension Function - * - * @throws java.lang.Exception Thrown if the input is invalid - */ - - public HyperbolicTension ( - final int iType, - final double dblTension) - throws java.lang.Exception - { - super (null); - - if ((SINH != (_iType = iType) && COSH != _iType) || !org.drip.quant.common.NumberUtil.IsValid - (_dblTension = dblTension)) - throw new java.lang.Exception ("HyperbolicTension ctr: Invalid Inputs"); - } - - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate)) - throw new java.lang.Exception ("HyperbolicTension::evaluate => Invalid Inputs"); - - return SINH == _iType ? java.lang.Math.sinh (_dblTension * dblVariate) : java.lang.Math.cosh - (_dblTension * dblVariate); - } - - @Override public double derivative ( - final double dblVariate, - final int iOrder) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate) || 0 > iOrder) - throw new java.lang.Exception ("HyperbolicTension::derivative => Invalid Inputs"); - - double dblDerivFactor = 1.; - - for (int i = 0; i < iOrder; ++i) - dblDerivFactor *= _dblTension; - - return (SINH == _iType) ? dblDerivFactor * (1 == iOrder % 2 ? java.lang.Math.cosh (_dblTension * - dblVariate) : java.lang.Math.sinh (_dblTension * dblVariate)) : dblDerivFactor * (1 == iOrder % 2 - ? java.lang.Math.sinh (_dblTension * dblVariate) : java.lang.Math.cosh (_dblTension * - dblVariate)); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || !org.drip.quant.common.NumberUtil.IsValid - (dblEnd)) - throw new java.lang.Exception ("HyperbolicTension::integrate => Invalid Inputs"); - - return SINH == _iType ? (java.lang.Math.cosh (_dblTension * dblEnd) - java.lang.Math.cosh - (_dblTension * dblBegin)) / _dblTension : (java.lang.Math.sinh (_dblTension * dblEnd) - - java.lang.Math.sinh (_dblTension * dblBegin)) / _dblTension; - } - - /** - * Retrieve the hyperbolic function type - * - * @return Hyperbolic function type - */ - - public int getType() - { - return _iType; - } - - /** - * Retrieve the Tension Parameter - * - * @return Tension Parameter - */ - - public double getTension() - { - return _dblTension; - } - - public static final void main ( - final java.lang.String[] astrArgs) - throws java.lang.Exception - { - HyperbolicTension e = new HyperbolicTension (SINH, 2.); - - System.out.println ("E[0.0] = " + e.evaluate (0.0)); - - System.out.println ("E[0.5] = " + e.evaluate (0.5)); - - System.out.println ("E[1.0] = " + e.evaluate (1.0)); - - System.out.println ("EDeriv[0.0] = " + e.derivative (0.0, 2)); - - System.out.println ("EDeriv[0.5] = " + e.derivative (0.5, 2)); - - System.out.println ("EDeriv[1.0] = " + e.derivative (1.0, 2)); - } -} diff --git a/org/drip/function/r1tor1/LinearRationalShapeControl.java b/org/drip/function/r1tor1/LinearRationalShapeControl.java deleted file mode 100644 index b0f0821..0000000 --- a/org/drip/function/r1tor1/LinearRationalShapeControl.java +++ /dev/null @@ -1,132 +0,0 @@ - -package org.drip.function.r1tor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * LinearRationalShapeControl implements the deterministic rational shape control functionality on top of the - * estimator basis splines inside - [0,...,1) - Globally [x_0,...,x_1): - * - * y = 1 / [1 + lambda * x] - * - * where is the normalized ordinate mapped as - * - * x === (x - x_i-1) / (x_i - x_i-1) - * - * @author Lakshmi Krishnamurthy - */ - -public class LinearRationalShapeControl extends org.drip.function.definition.R1ToR1 { - private double _dblLambda = java.lang.Double.NaN; - - /** - * LinearRationalShapeControl constructor - * - * @param dblLambda Tension Parameter - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public LinearRationalShapeControl ( - final double dblLambda) - throws java.lang.Exception - { - super (null); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblLambda = dblLambda)) - throw new java.lang.Exception ("LinearRationalShapeControl ctr: Invalid tension"); - } - - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - return 1. / (1. + _dblLambda * dblX); - } - - @Override public double derivative ( - final double dblX, - final int iOrder) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception ("LinearRationalShapeControl::derivative => Invalid Inputs"); - - double dblDerivative = 1. / (1. + _dblLambda * dblX); - - for (int i = 0; i < iOrder; ++i) - dblDerivative *= (-1. * _dblLambda / (1. + _dblLambda * dblX)); - - return dblDerivative; - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || !org.drip.quant.common.NumberUtil.IsValid - (dblEnd)) - throw new java.lang.Exception ("LinearRationalShapeControl::integrate => Invalid Inputs"); - - return (java.lang.Math.log ((1. + _dblLambda * dblEnd) / (1. + _dblLambda * dblBegin))) / _dblLambda; - } - - /** - * Retrieve the shape control coefficient - * - * @return Shape control coefficient - */ - - public double getShapeControlCoefficient() - { - return _dblLambda; - } -} diff --git a/org/drip/function/r1tor1/LinearRationalTensionExponential.java b/org/drip/function/r1tor1/LinearRationalTensionExponential.java deleted file mode 100644 index ad53e9e..0000000 --- a/org/drip/function/r1tor1/LinearRationalTensionExponential.java +++ /dev/null @@ -1,90 +0,0 @@ - -package org.drip.function.r1tor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * LinearRationalTensionExponential provides the evaluation of the Convolution of the Linear Rational and the - * Tension Exponential Functons and its derivatives for a specified variate. - * - * @author Lakshmi Krishnamurthy - */ - -public class LinearRationalTensionExponential extends org.drip.function.r1tor1.UnivariateConvolution { - - /** - * Construct a LinearRationalTensionExponential instance - * - * @param dblExponentialTension Exponential Tension Parameter - * @param dblRationalTension Rational Tension Parameter - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public LinearRationalTensionExponential ( - final double dblExponentialTension, - final double dblRationalTension) - throws java.lang.Exception - { - super (new org.drip.function.r1tor1.ExponentialTension (java.lang.Math.E, dblExponentialTension), new - org.drip.function.r1tor1.LinearRationalShapeControl (dblRationalTension)); - } - - public static final void main ( - final java.lang.String[] astrArgs) - throws java.lang.Exception - { - LinearRationalTensionExponential lret = new LinearRationalTensionExponential (-1., 1.); - - System.out.println ("LRET[0.00] = " + lret.evaluate (0.00)); - - System.out.println ("LRETDeriv[0.00] = " + lret.derivative (0.00, 1)); - } -} diff --git a/org/drip/function/r1tor1/NaturalLogSeriesElement.java b/org/drip/function/r1tor1/NaturalLogSeriesElement.java deleted file mode 100644 index 659e8b3..0000000 --- a/org/drip/function/r1tor1/NaturalLogSeriesElement.java +++ /dev/null @@ -1,120 +0,0 @@ - -package org.drip.function.r1tor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * NaturalLogSeriesElement implements an element in the natural log series expansion. - * - * @author Lakshmi Krishnamurthy - */ - -public class NaturalLogSeriesElement extends org.drip.function.definition.R1ToR1 { - private int _iExponent = -1; - - /** - * NaturalLogSeriesElement constructor - * - * @param iExponent The series exponent - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public NaturalLogSeriesElement ( - final int iExponent) - throws java.lang.Exception - { - super (null); - - if (0 > (_iExponent = iExponent)) - throw new java.lang.Exception ("NaturalLogSeriesElement ctr: Invalid Inputs"); - } - - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - return java.lang.Math.pow (dblVariate, _iExponent) / org.drip.quant.common.NumberUtil.Factorial - (_iExponent); - } - - @Override public double derivative ( - final double dblVariate, - final int iOrder) - throws java.lang.Exception - { - return iOrder > _iExponent ? 0. : java.lang.Math.pow (dblVariate, _iExponent - iOrder) / - org.drip.quant.common.NumberUtil.Factorial (_iExponent - iOrder); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || !org.drip.quant.common.NumberUtil.IsValid - (dblEnd)) - throw new java.lang.Exception ("NaturalLogSeriesElement::integrate => Invalid Inputs"); - - return (java.lang.Math.pow (dblEnd, _iExponent) - java.lang.Math.pow (dblBegin, _iExponent)) / - org.drip.quant.common.NumberUtil.Factorial (_iExponent + 1); - } - - /** - * Retrieve the exponent in the natural log series - * - * @return Exponent in the natural log series - */ - - public int getExponent() - { - return _iExponent; - } -} diff --git a/org/drip/function/r1tor1/OffsetIdempotent.java b/org/drip/function/r1tor1/OffsetIdempotent.java deleted file mode 100644 index 7a5a8ae..0000000 --- a/org/drip/function/r1tor1/OffsetIdempotent.java +++ /dev/null @@ -1,121 +0,0 @@ - -package org.drip.function.r1tor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * OffsetIdempotent provides the Implementation of the Offset Idempotent Operator - f(x) = x - C. - * - * @author Lakshmi Krishnamurthy - */ - -public class OffsetIdempotent extends org.drip.function.definition.R1ToR1 { - private double _dblOffset = java.lang.Double.NaN; - - /** - * OffsetIdempotent Constructor - * - * @param dblOffset The Offset - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public OffsetIdempotent ( - final double dblOffset) - throws java.lang.Exception - { - super (null); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblOffset = dblOffset)) - throw new java.lang.Exception ("OffsetIdempotent ctr: Invalid Inputs"); - } - - /** - * Retrieve the Offset - * - * @return The Offset - */ - - public double offset() - { - return _dblOffset; - } - - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate)) - throw new java.lang.Exception ("OffsetIdempotent::evaluate => Invalid Inputs"); - - return dblVariate - _dblOffset; - } - - @Override public double derivative ( - final double dblVariate, - final int iOrder) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate) || 0 > iOrder) - throw new java.lang.Exception ("OffsetIdempotent::derivative => Invalid Inputs"); - - return iOrder > 1 ? 0. : 1; - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || !org.drip.quant.common.NumberUtil.IsValid - (dblEnd)) - throw new java.lang.Exception ("OffsetIdempotent::integrate => Invalid Inputs"); - - return 0.5 * (dblEnd * dblEnd - dblBegin - dblBegin) + _dblOffset * (dblEnd - dblBegin); - } -} diff --git a/org/drip/function/r1tor1/Polynomial.java b/org/drip/function/r1tor1/Polynomial.java deleted file mode 100644 index 25e3e8a..0000000 --- a/org/drip/function/r1tor1/Polynomial.java +++ /dev/null @@ -1,144 +0,0 @@ - -package org.drip.function.r1tor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * Polynomial provides the evaluation of the n-th order Polynomial and its derivatives for a specified - * variate. - * - * @author Lakshmi Krishnamurthy - */ - -public class Polynomial extends org.drip.function.definition.R1ToR1 { - private int _iDegree = -1; - - /** - * Polynomial constructor - * - * @param iDegree Degree of the Polynomial - * - * @throws java.lang.Exception Thrown if the input is invalid - */ - - public Polynomial ( - final int iDegree) - throws java.lang.Exception - { - super (null); - - if (0 > (_iDegree = iDegree)) throw new java.lang.Exception ("Polynomial ctr: Invalid Inputs"); - } - - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate)) - throw new java.lang.Exception ("Polynomial::evaluate => Invalid Inputs"); - - return java.lang.Math.pow (dblVariate, _iDegree); - } - - @Override public double derivative ( - final double dblVariate, - final int iOrder) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate) || 0 > iOrder) - throw new java.lang.Exception ("Polynomial::derivative => Invalid Inputs"); - - return iOrder > _iDegree ? 0. : java.lang.Math.pow (dblVariate, _iDegree - iOrder) * - org.drip.quant.common.NumberUtil.NPK (_iDegree, _iDegree - iOrder); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || !org.drip.quant.common.NumberUtil.IsValid - (dblEnd)) - throw new java.lang.Exception ("Polynomial::integrate => Invalid Inputs"); - - return (java.lang.Math.pow (dblEnd, _iDegree + 1) - java.lang.Math.pow (dblBegin, _iDegree + 1)) / - (_iDegree + 1); - } - - /** - * Retrieve the degree of the polynomial - * - * @return Degree of the polynomial - */ - - public double getDegree() - { - return _iDegree; - } - - public static final void main ( - final java.lang.String[] astrArgs) - throws java.lang.Exception - { - Polynomial poly = new Polynomial (4); - - System.out.println ("Poly[0.0] = " + poly.evaluate (0.0)); - - System.out.println ("Poly[0.5] = " + poly.evaluate (0.5)); - - System.out.println ("Poly[1.0] = " + poly.evaluate (1.0)); - - System.out.println ("Deriv[0.0] = " + poly.derivative (0.0, 3)); - - System.out.println ("Deriv[0.5] = " + poly.derivative (0.5, 3)); - - System.out.println ("Deriv[1.0] = " + poly.derivative (1.0, 3)); - } -} diff --git a/org/drip/function/r1tor1/QuadraticRationalShapeControl.java b/org/drip/function/r1tor1/QuadraticRationalShapeControl.java deleted file mode 100644 index 902adc7..0000000 --- a/org/drip/function/r1tor1/QuadraticRationalShapeControl.java +++ /dev/null @@ -1,149 +0,0 @@ - -package org.drip.function.r1tor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * QuadraticRationalShapeControl implements the deterministic rational shape control functionality on top of - * the estimator basis splines inside - [0,...,1) - Globally [x_0,...,x_1): - * - * y = 1 / [1 + lambda * x * (1-x)] - * - * where is the normalized ordinate mapped as - * - * x ==== (x - x_i-1) / (x_i - x_i-1) - * - * @author Lakshmi Krishnamurthy - */ - -public class QuadraticRationalShapeControl extends org.drip.function.definition.R1ToR1 { - private double _dblLambda = java.lang.Double.NaN; - - /** - * QuadraticRationalShapeControl constructor - * - * @param dblLambda Tension Parameter - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public QuadraticRationalShapeControl ( - final double dblLambda) - throws java.lang.Exception - { - super (null); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblLambda = dblLambda)) - throw new java.lang.Exception ("QuadraticRationalShapeControl ctr: Invalid tension"); - } - - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - return 1. / (1. + _dblLambda * dblX * (1. - dblX)); - } - - @Override public double derivative ( - final double dblX, - final int iOrder) - throws java.lang.Exception - { - if (0. == _dblLambda) return 0.; - - double dblD2BetaDX2 = -2. * _dblLambda; - double dblDBetaDX = _dblLambda * (1. - 2. * dblX); - double dblBeta = 1. + _dblLambda * dblX * (1. - dblX); - - if (1 == iOrder) return -1. * dblDBetaDX / (dblBeta * dblBeta); - - if (2 == iOrder) - return (2. * dblDBetaDX * dblDBetaDX - dblBeta * dblD2BetaDX2) / (dblBeta * dblBeta * dblBeta); - - return super.derivative (dblX, iOrder); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || !org.drip.quant.common.NumberUtil.IsValid - (dblEnd)) - throw new java.lang.Exception ("QuadraticRationalShapeControl::integrate => Invalid Inputs"); - - double dblAlpha = java.lang.Math.sqrt (0.25 * (_dblLambda + 4.) / _dblLambda); - - return -0.5 * (java.lang.Math.log ((dblEnd - dblAlpha - 0.5) * (dblBegin + dblAlpha - 0.5) / - (dblEnd + dblAlpha - 0.5) / (dblBegin - dblAlpha - 0.5))) / dblAlpha / _dblLambda; - } - - /** - * Retrieve the shape control coefficient - * - * @return Shape control coefficient - */ - - public double getShapeControlCoefficient() - { - return _dblLambda; - } - - public static final void main ( - final java.lang.String[] astrArgs) - throws java.lang.Exception - { - QuadraticRationalShapeControl qrsc = new QuadraticRationalShapeControl (1.); - - System.out.println (qrsc.derivative (0., 2)); - - System.out.println (qrsc.derivative (1., 2)); - } -} diff --git a/org/drip/function/r1tor1/SABRLIBORCapVolatility.java b/org/drip/function/r1tor1/SABRLIBORCapVolatility.java deleted file mode 100644 index 04764a1..0000000 --- a/org/drip/function/r1tor1/SABRLIBORCapVolatility.java +++ /dev/null @@ -1,164 +0,0 @@ - -package org.drip.function.r1tor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * SABRLIBORCapVolatility implements the Deterministic, Non-local Cap Volatility Scheme detailed in: - * - * - Rebonato, R., K. McKay, and R. White (2009): The SABR/LIBOR Market Model: Pricing, Calibration, and - * Hedging for Complex Interest-Rate Derivatives, John Wiley and Sons. - * - * @author Lakshmi Krishnamurthy - */ - -public class SABRLIBORCapVolatility extends org.drip.function.definition.R1ToR1 { - private double _dblA = java.lang.Double.NaN; - private double _dblB = java.lang.Double.NaN; - private double _dblC = java.lang.Double.NaN; - private double _dblD = java.lang.Double.NaN; - private double _dblEpoch = java.lang.Double.NaN; - - /** - * SABRLIBORCapVolatility Constructor - * - * @param dblEpoch Epoch - * @param dblA A - * @param dblB B - * @param dblC C - * @param dblD D - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public SABRLIBORCapVolatility ( - final double dblEpoch, - final double dblA, - final double dblB, - final double dblC, - final double dblD) - throws java.lang.Exception - { - super (null); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblEpoch = dblEpoch) || - !org.drip.quant.common.NumberUtil.IsValid (_dblA = dblA) || - !org.drip.quant.common.NumberUtil.IsValid (_dblB = dblB) || - !org.drip.quant.common.NumberUtil.IsValid (_dblC = dblC) || - !org.drip.quant.common.NumberUtil.IsValid (_dblD = dblD)) - throw new java.lang.Exception ("SABRLIBORCapVolatility ctr: Invalid Inputs"); - } - - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate)) - throw new java.lang.Exception ("SABRLIBORCapVolatility::evaluate => Invalid Inputs"); - - double dblDateGap = dblVariate - _dblEpoch; - - return (_dblB * dblDateGap + _dblA) * java.lang.Math.exp (-1. * _dblC * dblDateGap) + _dblD; - } - - /** - * Return "A" - * - * @return "A" - */ - - public double A() - { - return _dblA; - } - - /** - * Return "B" - * - * @return "B" - */ - - public double B() - { - return _dblB; - } - - /** - * Return "C" - * - * @return "C" - */ - - public double C() - { - return _dblC; - } - - /** - * Return "D" - * - * @return "D" - */ - - public double D() - { - return _dblD; - } - - /** - * Return the Epoch - * - * @return The Epoch - */ - - public double epoch() - { - return _dblEpoch; - } -} diff --git a/org/drip/function/r1tor1/UnivariateConvolution.java b/org/drip/function/r1tor1/UnivariateConvolution.java deleted file mode 100644 index b96df49..0000000 --- a/org/drip/function/r1tor1/UnivariateConvolution.java +++ /dev/null @@ -1,119 +0,0 @@ - -package org.drip.function.r1tor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * This class provides the evaluation of the Convolution au1 * au2 and its derivatives for a specified - * variate. - * - * @author Lakshmi Krishnamurthy - */ - -public class UnivariateConvolution extends org.drip.function.definition.R1ToR1 { - private org.drip.function.definition.R1ToR1 _au1 = null; - private org.drip.function.definition.R1ToR1 _au2 = null; - - /** - * Construct a PolynomialMirrorCross instance - * - * @param au1 Univariate Function #1 - * @param au2 Univariate Function #2 - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public UnivariateConvolution ( - final org.drip.function.definition.R1ToR1 au1, - final org.drip.function.definition.R1ToR1 au2) - throws java.lang.Exception - { - super (null); - - if (null == (_au1 = au1) || null == (_au2 = au2)) - throw new java.lang.Exception ("Convolution ctr: Invalid Inputs"); - } - - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate)) - throw new java.lang.Exception ("Convolution::evaluate => Invalid Input"); - - return _au1.evaluate (dblVariate) * _au2.evaluate (dblVariate); - } - - @Override public double derivative ( - final double dblVariate, - final int iOrder) - throws java.lang.Exception - { - double dblDerivative = _au1.evaluate (dblVariate) * _au2.derivative (dblVariate, iOrder); - - for (int i = 1; i < iOrder; ++i) - dblDerivative += org.drip.quant.common.NumberUtil.NCK (iOrder, i) * _au1.derivative (dblVariate, - i) * _au2.derivative (dblVariate, iOrder - i); - - return dblDerivative + _au1.derivative (dblVariate, iOrder) * _au2.evaluate (dblVariate); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || !org.drip.quant.common.NumberUtil.IsValid - (dblEnd)) - throw new java.lang.Exception ("HyperbolicTension::integrate => Invalid Inputs"); - - return org.drip.quant.calculus.R1ToR1Integrator.Boole (this, dblBegin, dblEnd); - } -} diff --git a/org/drip/function/r1tor1/UnivariateReciprocal.java b/org/drip/function/r1tor1/UnivariateReciprocal.java deleted file mode 100644 index 742a76b..0000000 --- a/org/drip/function/r1tor1/UnivariateReciprocal.java +++ /dev/null @@ -1,104 +0,0 @@ - -package org.drip.function.r1tor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * UnivariateReciprocal provides the evaluation 1/f(x) instead of f(x) for a given f. - * - * @author Lakshmi Krishnamurthy - */ - -public class UnivariateReciprocal extends org.drip.function.definition.R1ToR1 { - private org.drip.function.definition.R1ToR1 _au = null; - - /** - * UnivariateReciprocal constructor - * - * @param au Univariate Function - * - * @throws java.lang.Exception Thrown if the input is invalid - */ - - public UnivariateReciprocal ( - final org.drip.function.definition.R1ToR1 au) - throws java.lang.Exception - { - super (null); - - if (null == (_au = au)) throw new java.lang.Exception ("UnivariateReciprocal ctr: Invalid Inputs"); - } - - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - return 1. / _au.evaluate (dblVariate); - } - - public static final void main ( - final java.lang.String[] astrArgs) - throws java.lang.Exception - { - UnivariateReciprocal ur = new UnivariateReciprocal (new - org.drip.function.r1tor1.NaturalLogSeriesElement (1)); - - System.out.println ("UnivariateReciprocal[0.0] = " + ur.evaluate (0.0)); - - System.out.println ("UnivariateReciprocal[0.5] = " + ur.evaluate (0.5)); - - System.out.println ("UnivariateReciprocal[1.0] = " + ur.evaluate (1.0)); - - System.out.println ("UnivariateReciprocalDeriv[0.0] = " + ur.derivative (0.0, 3)); - - System.out.println ("UnivariateReciprocalDeriv[0.5] = " + ur.derivative (0.5, 3)); - - System.out.println ("UnivariateReciprocalDeriv[1.0] = " + ur.derivative (1.0, 3)); - } -} diff --git a/org/drip/function/r1tor1/UnivariateReflection.java b/org/drip/function/r1tor1/UnivariateReflection.java deleted file mode 100644 index 7bae27a..0000000 --- a/org/drip/function/r1tor1/UnivariateReflection.java +++ /dev/null @@ -1,130 +0,0 @@ - -package org.drip.function.r1tor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * UnivariateReflection provides the evaluation f(1-x) instead of f(x) for a given f. - * - * @author Lakshmi Krishnamurthy - */ - -public class UnivariateReflection extends org.drip.function.definition.R1ToR1 { - private org.drip.function.definition.R1ToR1 _au = null; - - /** - * UnivariateReflection constructor - * - * @param au Univariate Function - * - * @throws java.lang.Exception Thrown if the input is invalid - */ - - public UnivariateReflection ( - final org.drip.function.definition.R1ToR1 au) - throws java.lang.Exception - { - super (null); - - if (null == (_au = au)) throw new java.lang.Exception ("UnivariateReflection ctr: Invalid Inputs"); - } - - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate)) - throw new java.lang.Exception ("UnivariateReflection::evaluate => Invalid Inputs"); - - return _au.evaluate (1. - dblVariate); - } - - @Override public double derivative ( - final double dblVariate, - final int iOrder) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate) || 0 >= iOrder) - throw new java.lang.Exception ("UnivariateReflection::derivative => Invalid Inputs"); - - return java.lang.Math.pow (-1., iOrder) * _au.derivative (1. - dblVariate, iOrder); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || !org.drip.quant.common.NumberUtil.IsValid - (dblEnd)) - throw new java.lang.Exception ("UnivariateReflection::integrate => Invalid Inputs"); - - return -1. * _au.integrate (1. - dblBegin, 1. - dblEnd); - } - - public static final void main ( - final java.lang.String[] astrArgs) - throws java.lang.Exception - { - UnivariateReflection ur = new UnivariateReflection (new Polynomial (4)); - - System.out.println ("UnivariateReflection[0.0] = " + ur.evaluate (0.0)); - - System.out.println ("UnivariateReflection[0.5] = " + ur.evaluate (0.5)); - - System.out.println ("UnivariateReflection[1.0] = " + ur.evaluate (1.0)); - - System.out.println ("UnivariateReflectionDeriv[0.0] = " + ur.derivative (0.0, 3)); - - System.out.println ("UnivariateReflectionDeriv[0.5] = " + ur.derivative (0.5, 3)); - - System.out.println ("UnivariateReflectionDeriv[1.0] = " + ur.derivative (1.0, 3)); - } -} diff --git a/org/drip/function/r1tor1solver/BracketingControlParams.java b/org/drip/function/r1tor1solver/BracketingControlParams.java deleted file mode 100644 index e9dccce..0000000 --- a/org/drip/function/r1tor1solver/BracketingControlParams.java +++ /dev/null @@ -1,158 +0,0 @@ - -package org.drip.function.r1tor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * BracketingControlParams implements the control parameters for bracketing solutions. - * - * BracketingControlParams provides the following parameters: - * - The starting variate from which the search for bracketing begins - * - The initial width for the brackets - * - The factor by which the width expands with each iterative search - * - The number of such iterations. - * - * @author Lakshmi Krishnamurthy - */ - -public class BracketingControlParams { - - /* - * Bracket Determination Parameters - */ - - private int _iNumExpansions = 0; - private double _dblVariateStart = java.lang.Double.NaN; - private double _dblBracketStartingWidth = java.lang.Double.NaN; - private double _dblBracketWidthExpansionFactor = java.lang.Double.NaN; - - /** - * Default BracketingControlParams constructor - */ - - public BracketingControlParams() - { - _dblVariateStart = 0.; - _iNumExpansions = 100; - _dblBracketStartingWidth = 1.e-06; - _dblBracketWidthExpansionFactor = 2.; - } - - /** - * BracketingControlParams constructor - * - * @param iNumExpansions Number of bracket expansions to determine the bracket - * @param dblVariateStart Variate start for the bracket determination - * @param dblBracketStartingWidth Base Bracket Width - * @param dblBracketWidthExpansionFactor Bracket width expansion factor - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public BracketingControlParams ( - final int iNumExpansions, - final double dblVariateStart, - final double dblBracketStartingWidth, - final double dblBracketWidthExpansionFactor) - throws java.lang.Exception - { - if (0 >= (_iNumExpansions = iNumExpansions) || !org.drip.quant.common.NumberUtil.IsValid - (_dblVariateStart = dblVariateStart) || !org.drip.quant.common.NumberUtil.IsValid - (_dblBracketStartingWidth = dblBracketStartingWidth) || - !org.drip.quant.common.NumberUtil.IsValid (_dblBracketWidthExpansionFactor = - dblBracketWidthExpansionFactor)) - throw new java.lang.Exception ("BracketingControlParams constructor: Invalid inputs!"); - } - - /** - * Return the number of expansions - * - * @return Number of expansions - */ - - public int getNumExpansions() - { - return _iNumExpansions; - } - - /** - * Return the starting point of bracketing determination - * - * @return Starting point of bracketing determination - */ - - public double getVariateStart() - { - return _dblVariateStart; - } - - /** - * Return the initial bracket width - * - * @return Initial bracket width - */ - - public double getStartingBracketWidth() - { - return _dblBracketStartingWidth; - } - - /** - * Return the bracket width expansion factor - * - * @return Bracket width expansion factor - */ - - public double getBracketWidthExpansionFactor() - { - return _dblBracketWidthExpansionFactor; - } -} diff --git a/org/drip/function/r1tor1solver/BracketingOutput.java b/org/drip/function/r1tor1solver/BracketingOutput.java deleted file mode 100644 index f5475f0..0000000 --- a/org/drip/function/r1tor1solver/BracketingOutput.java +++ /dev/null @@ -1,186 +0,0 @@ - -package org.drip.function.r1tor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * BracketingOutput carries the results of the bracketing initialization. - * - * In addition to the fields of ExecutionInitializationOutput, BracketingOutput holds the left/right bracket - * variates and the corresponding values for the objective function. - * - * @author Lakshmi Krishnamurthy - */ - -public class BracketingOutput extends org.drip.function.r1tor1solver.ExecutionInitializationOutput { - private double _dblOFLeft = java.lang.Double.NaN; - private double _dblOFRight = java.lang.Double.NaN; - private double _dblVariateLeft = java.lang.Double.NaN; - private double _dblVariateRight = java.lang.Double.NaN; - - /** - * Default BracketingOutput constructor: Initializes the output - */ - - public BracketingOutput() - { - super(); - } - - /** - * Return the left Variate - * - * @return Left Variate - */ - - public double getVariateLeft() - { - return _dblVariateLeft; - } - - /** - * Return the Right Variate - * - * @return Right Variate - */ - - public double getVariateRight() - { - return _dblVariateRight; - } - - /** - * Return the left OF - * - * @return Left OF - */ - - public double getOFLeft() - { - return _dblOFLeft; - } - - /** - * Return the Right OF - * - * @return Right OF - */ - - public double getOFRight() - { - return _dblOFRight; - } - - /** - * Set the brackets in the output object - * - * @param dblVariateLeft Left Variate - * @param dblVariateRight Right Variate - * @param dblOFLeft Left OF - * @param dblOFRight Right OF - * @param dblStartingVariate Starting Variate - * - * @return TRUE - Successfully set - */ - - public boolean done ( - final double dblVariateLeft, - final double dblVariateRight, - final double dblOFLeft, - final double dblOFRight, - final double dblStartingVariate) - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblVariateLeft = dblVariateLeft) || - !org.drip.quant.common.NumberUtil.IsValid (_dblVariateRight = dblVariateRight) || - !org.drip.quant.common.NumberUtil.IsValid (_dblOFLeft = dblOFLeft) || - !org.drip.quant.common.NumberUtil.IsValid (_dblOFRight = dblOFRight) || - !setStartingVariate (dblStartingVariate)) - return false; - - return done(); - } - - /** - * Make a ConvergenceOutput for the Open Method from the bracketing output - * - * @return The ConvergenceOutput object - */ - - public org.drip.function.r1tor1solver.ConvergenceOutput makeConvergenceVariate() - { - org.drip.function.r1tor1solver.ConvergenceOutput cop = null; - - try { - cop = new org.drip.function.r1tor1solver.ConvergenceOutput (this); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return cop.done (getStartingVariate()) ? cop : null; - } - - @Override public java.lang.String displayString() - { - java.lang.StringBuffer sb = new java.lang.StringBuffer(); - - sb.append (super.displayString()); - - sb.append ("\n\t\tLeft Bracket: " + getVariateLeft()); - - sb.append ("\n\t\tRight Bracket: " + getVariateRight()); - - sb.append ("\n\t\tLeft OF: " + getOFLeft()); - - sb.append ("\n\t\tRight OF: " + getOFRight()); - - return sb.toString(); - } -} diff --git a/org/drip/function/r1tor1solver/ConvergenceControlParams.java b/org/drip/function/r1tor1solver/ConvergenceControlParams.java deleted file mode 100644 index 6cd7885..0000000 --- a/org/drip/function/r1tor1solver/ConvergenceControlParams.java +++ /dev/null @@ -1,162 +0,0 @@ - -package org.drip.function.r1tor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * ConvergenceControlParams holds the fields needed for the controlling the execution of Newton's method. - * - * ConvergenceControlParams does that using the following parameters: - * - The determinant limit below which the convergence zone is deemed to have been reached. - * - Starting variate from where the convergence search is kicked off. - * - The factor by which the variate expands across each iterative search. - * - The number of search iterations. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConvergenceControlParams { - /* - * Convergence Zone Locator Determination - */ - - private int _iFixedPointConvergenceIterations = 0; - private double _dblConvergenceZoneEdgeLimit = java.lang.Double.NaN; - private double _dblConvergenceZoneVariateBegin = java.lang.Double.NaN; - private double _dblConvergenceZoneVariateBumpFactor = java.lang.Double.NaN; - - /** - * Default Convergence Control Parameters constructor - */ - - public ConvergenceControlParams() - { - /* - * Convergence Zone Locator Determination Initialization - */ - - _iFixedPointConvergenceIterations = 100; - _dblConvergenceZoneEdgeLimit = 0.01; - _dblConvergenceZoneVariateBegin = 1.0e-30; - _dblConvergenceZoneVariateBumpFactor = 3.; - } - - /** - * ConvergenceControlParams constructor - * - * @param iFixedPointConvergenceIterations Iterations to locate a variate inside the convergence zone - * @param dblConvergenceZoneVariateBegin Starting variate for convergence zone determination - * @param dblConvergenceZoneEdgeLimit Convergence zone edge limit - * @param dblConvergenceZoneVariateBumpFactor Convergence Zone Variate Bump Factor - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public ConvergenceControlParams ( - final int iFixedPointConvergenceIterations, - final double dblConvergenceZoneVariateBegin, - final double dblConvergenceZoneEdgeLimit, - final double dblConvergenceZoneVariateBumpFactor) - throws java.lang.Exception - { - if (0 >= (_iFixedPointConvergenceIterations = iFixedPointConvergenceIterations) || - !org.drip.quant.common.NumberUtil.IsValid (_dblConvergenceZoneVariateBegin = - dblConvergenceZoneVariateBegin) || !org.drip.quant.common.NumberUtil.IsValid - (_dblConvergenceZoneEdgeLimit = dblConvergenceZoneEdgeLimit) || - !org.drip.quant.common.NumberUtil.IsValid (_dblConvergenceZoneVariateBumpFactor = - dblConvergenceZoneVariateBumpFactor)) - throw new java.lang.Exception ("ConvergenceControlParams constructor: Invalid inputs"); - } - - /** - * Return the number of fixed point convergence iterations - * - * @return Number of fixed point convergence iterations - */ - - public int getFixedPointConvergenceIterations() - { - return _iFixedPointConvergenceIterations; - } - - /** - * Return the limit of the fixed point convergence zone edge - * - * @return Limit of fixed point convergence zone edge - */ - - public double getConvergenceZoneEdgeLimit() - { - return _dblConvergenceZoneEdgeLimit; - } - - /** - * Return the start of the fixed point convergence variate - * - * @return Start of the fixed point convergence variate - */ - - public double getConvergenceZoneVariateBegin() - { - return _dblConvergenceZoneVariateBegin; - } - - /** - * Return the bump factor for the fixed point convergence variate iteration - * - * @return Bump factor for the fixed point convergence variate iteration - */ - - public double getConvergenceZoneVariateBumpFactor() - { - return _dblConvergenceZoneVariateBumpFactor; - } -} diff --git a/org/drip/function/r1tor1solver/ConvergenceOutput.java b/org/drip/function/r1tor1solver/ConvergenceOutput.java deleted file mode 100644 index 9f1ba65..0000000 --- a/org/drip/function/r1tor1solver/ConvergenceOutput.java +++ /dev/null @@ -1,104 +0,0 @@ - -package org.drip.function.r1tor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * ConvergenceOutput extends the ExecutionInitializationOutput by retaining the starting variate that - * results from the convergence zone search. - * - * ConvergenceOutput does not add any new field to ExecutionInitializationOutput. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConvergenceOutput extends org.drip.function.r1tor1solver.ExecutionInitializationOutput { - - /** - * Default ConvergenceOutput constructor: Initializes the output object - */ - - public ConvergenceOutput() - { - super(); - } - - /** - * Initialize off of an existing EIOP - * - * @throws java.lang.Exception Thrown if inputs are invalid - * - * @param eiop EIOP - */ - - public ConvergenceOutput ( - final org.drip.function.r1tor1solver.ExecutionInitializationOutput eiop) - throws java.lang.Exception - { - super (eiop); - } - - /** - * Indicate that the initialization is completed - * - * @param dblStartingVariate Starting Variate - * - * @return TRUE - Initialization successfully completed - */ - - public boolean done ( - final double dblStartingVariate) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblStartingVariate)) return false; - - return setStartingVariate (dblStartingVariate) && done(); - } -} diff --git a/org/drip/function/r1tor1solver/ExecutionControl.java b/org/drip/function/r1tor1solver/ExecutionControl.java deleted file mode 100644 index 8f52d66..0000000 --- a/org/drip/function/r1tor1solver/ExecutionControl.java +++ /dev/null @@ -1,191 +0,0 @@ - -package org.drip.function.r1tor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * ExecutionControl implements the core fixed point search execution control and customization functionality. - * - * ExecutionControl is used for a) calculating the absolute tolerance, and b) determining whether the OF has - * reached the goal. - * - * ExecutionControl determines the execution termination using its ExecutionControlParams instance. - * - * @author Lakshmi Krishnamurthy - */ - -public class ExecutionControl { - private org.drip.function.r1tor1solver.ExecutionControlParams _ecp = null; - - protected org.drip.function.definition.R1ToR1 _of = null; - - /** - * ExecutionControl constructor - * - * @param of Objective Function - * @param ecp Execution Control Parameters - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public ExecutionControl ( - final org.drip.function.definition.R1ToR1 of, - final org.drip.function.r1tor1solver.ExecutionControlParams ecp) - throws java.lang.Exception - { - if (null == (_of = of)) - throw new java.lang.Exception ("ExecutionControl constructor: Invalid inputs"); - - if (null == (_ecp = ecp)) _ecp = new org.drip.function.r1tor1solver.ExecutionControlParams(); - } - - /** - * Retrieve the Number of Iterations - * - * @return Number of solver iterations - */ - - public int getNumIterations() - { - return _ecp.getNumIterations(); - } - - /** - * Calculate the absolute OF tolerance using the initial OF value - * - * @param dblOFInitial Initial OF Value - * - * @return The absolute OF Tolerance - * - * @throws java.lang.Exception Thrown if absolute tolerance cannot be calculated - */ - - public double calcAbsoluteOFTolerance ( - final double dblOFInitial) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblOFInitial)) - throw new java.lang.Exception ("ExecutionControl::calcAbsoluteOFTolerance => Invalid inputs!"); - - double dblAbsoluteTolerance = java.lang.Math.abs (dblOFInitial) * _ecp.getOFGoalToleranceFactor(); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblAbsoluteTolerance) || dblAbsoluteTolerance < - _ecp.getAbsoluteOFToleranceFallback()) - dblAbsoluteTolerance = _ecp.getAbsoluteOFToleranceFallback(); - - return dblAbsoluteTolerance; - } - - /** - * Calculate the absolute variate convergence amount using the initial variate - * - * @param dblInitialVariate Initial Variate - * - * @return The Absolute Variate Convergence Amount - * - * @throws java.lang.Exception Thrown if Absolute Variate Convergence Amount cannot be calculated - */ - - public double calcAbsoluteVariateConvergence ( - final double dblInitialVariate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblInitialVariate)) - throw new java.lang.Exception - ("ExecutionControl::calcAbsoluteVariateConvergence => Invalid inputs!"); - - double dblAbsoluteConvergence = java.lang.Math.abs (dblInitialVariate) * - _ecp.getVariateConvergenceFactor(); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblAbsoluteConvergence) || dblAbsoluteConvergence < - _ecp.getAbsoluteVariateConvergenceFallback()) - dblAbsoluteConvergence = _ecp.getAbsoluteVariateConvergenceFallback(); - - return dblAbsoluteConvergence; - } - - /** - * Check to see if the OF has reached the goal - * - * @param dblAbsoluteTolerance Absolute Tolerance - * @param dblOF OF Value - * @param dblOFGoal OF Goal - * - * @return TRUE - If the OF has reached the goal - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public boolean hasOFReachedGoal ( - final double dblAbsoluteTolerance, - final double dblOF, - final double dblOFGoal) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblAbsoluteTolerance) || - !org.drip.quant.common.NumberUtil.IsValid (dblOF) || !org.drip.quant.common.NumberUtil.IsValid - (dblOFGoal)) - throw new java.lang.Exception ("ExecutionControl::hasOFReachedGoal => Invalid inputs!"); - - return dblAbsoluteTolerance > java.lang.Math.abs (dblOF - dblOFGoal); - } - - /** - * Indicate if the variate convergence check has been turned on - * - * @return TRUE - Variate convergence check has been turned on - */ - - public boolean isVariateConvergenceCheckEnabled() - { - return _ecp.isVariateConvergenceCheckEnabled(); - } -} diff --git a/org/drip/function/r1tor1solver/ExecutionControlParams.java b/org/drip/function/r1tor1solver/ExecutionControlParams.java deleted file mode 100644 index e4218dd..0000000 --- a/org/drip/function/r1tor1solver/ExecutionControlParams.java +++ /dev/null @@ -1,190 +0,0 @@ - -package org.drip.function.r1tor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * ExecutionControlParams holds the parameters needed for controlling the execution of the fixed point - * finder. - * - * ExecutionControlParams fields control the fixed point search in one of the following ways: - * - Number of iterations after which the search is deemed to have failed - * - Relative Objective Function Tolerance Factor which, when reached by the objective function, will - * indicate that the fixed point has been reached - * - Variate Convergence Factor, factor applied to the initial variate to determine the absolute convergence - * - Absolute Tolerance fall-back, which is used to determine that the fixed point has been reached when the - * relative tolerance factor becomes zero - * - Absolute Variate Convergence Fall-back, fall-back used to determine if the variate has converged. - * - * @author Lakshmi Krishnamurthy - */ - -public class ExecutionControlParams { - private int _iNumIterations = 0; - private boolean _bIsVariateConvergenceCheckEnabled = false; - private double _dblOFGoalToleranceFactor = java.lang.Double.NaN; - private double _dblVariateConvergenceFactor = java.lang.Double.NaN; - private double _dblAbsoluteOFToleranceFallback = java.lang.Double.NaN; - private double _dblAbsoluteVariateConvergenceFallback = java.lang.Double.NaN; - - /** - * Default Execution Control Parameters constructor - */ - - public ExecutionControlParams() - { - _iNumIterations = 200; - _dblOFGoalToleranceFactor = 1.0e-06; - _dblVariateConvergenceFactor = 1.0e-06; - _dblAbsoluteOFToleranceFallback = 1.0e-07; - _dblAbsoluteVariateConvergenceFallback = 1.0e-07; - } - - /** - * Execution Control Parameters constructor - * - * @param iNumIterations Number of Iterations - * @param bIsVariateConvergenceCheckEnabled Flag indicating if the variate convergence check is on - * @param dblOFGoalToleranceFactor Tolerance factor for the OF Goal - * @param dblVariateConvergenceFactor Variate Convergence Factor - * @param dblAbsoluteOFToleranceFallback Absolute Tolerance Fall-back - * @param dblAbsoluteVariateConvergenceFallback Absolute Variate Convergence fall-back - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public ExecutionControlParams ( - final int iNumIterations, - final boolean bIsVariateConvergenceCheckEnabled, - final double dblOFGoalToleranceFactor, - final double dblVariateConvergenceFactor, - final double dblAbsoluteOFToleranceFallback, - final double dblAbsoluteVariateConvergenceFallback) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblOFGoalToleranceFactor = dblOFGoalToleranceFactor) - || !org.drip.quant.common.NumberUtil.IsValid (_dblVariateConvergenceFactor = - dblVariateConvergenceFactor) || !org.drip.quant.common.NumberUtil.IsValid - (_dblAbsoluteOFToleranceFallback = dblAbsoluteOFToleranceFallback) || - !org.drip.quant.common.NumberUtil.IsValid (_dblAbsoluteVariateConvergenceFallback = - dblAbsoluteVariateConvergenceFallback) || 0 >= (_iNumIterations = - iNumIterations)) - throw new java.lang.Exception ("ExecutionControlParams constructor: Invalid inputs"); - - _bIsVariateConvergenceCheckEnabled = bIsVariateConvergenceCheckEnabled; - } - - /** - * Return the number of iterations allowed - * - * @return Number of iterations - */ - - public int getNumIterations() - { - return _iNumIterations; - } - - /** - * Return the tolerance factor for the OF Goal - * - * @return Tolerance factor for the OF Goal - */ - - public double getOFGoalToleranceFactor() - { - return _dblOFGoalToleranceFactor; - } - - /** - * Return the Variate Convergence Factor - * - * @return Variate Convergence Factor - */ - - public double getVariateConvergenceFactor() - { - return _dblVariateConvergenceFactor; - } - - /** - * Return the Fall-back absolute tolerance for the OF - * - * @return Fall-back absolute tolerance for the OF - */ - - public double getAbsoluteOFToleranceFallback() - { - return _dblAbsoluteOFToleranceFallback; - } - - /** - * Return the fall-back absolute variate convergence - * - * @return Fall-back absolute variate convergence - */ - - public double getAbsoluteVariateConvergenceFallback() - { - return _dblAbsoluteVariateConvergenceFallback; - } - - /** - * Indicate if the variate convergence check has been turned on - * - * @return TRUE - Variate convergence check has been turned on - */ - - public boolean isVariateConvergenceCheckEnabled() - { - return _bIsVariateConvergenceCheckEnabled; - } -} diff --git a/org/drip/function/r1tor1solver/ExecutionInitializationOutput.java b/org/drip/function/r1tor1solver/ExecutionInitializationOutput.java deleted file mode 100644 index a6f2166..0000000 --- a/org/drip/function/r1tor1solver/ExecutionInitializationOutput.java +++ /dev/null @@ -1,244 +0,0 @@ - -package org.drip.function.r1tor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * ExecutionInitializationOutput holds the output of the root initializer calculation. - * - * The following are the fields held by ExecutionInitializationOutput: - * - Whether the initialization completed successfully - * - the number of iterations, the number of objective function calculations, and the time taken for the - * initialization - * - the starting variate from the initialization - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class ExecutionInitializationOutput { - private int _iNumOFCalcs = 0; - private long _lStartTime = 0L; - private boolean _bDone = false; - private int _iNumIterations = 0; - private int _iNumOFDerivCalcs = 0; - private double _dblTime = java.lang.Double.NaN; - private double _dblStartingVariate = java.lang.Double.NaN; - - protected ExecutionInitializationOutput() - { - _lStartTime = System.nanoTime(); - } - - protected ExecutionInitializationOutput ( - final ExecutionInitializationOutput eiopOther) - throws java.lang.Exception - { - if (null == eiopOther) - throw new java.lang.Exception ("ExecutionInitializationOutput constructor: Invalid inputs!"); - - _iNumOFCalcs = eiopOther._iNumOFCalcs; - _lStartTime = eiopOther._lStartTime; - _bDone = eiopOther._bDone; - _iNumIterations = eiopOther._iNumIterations; - _iNumOFDerivCalcs = eiopOther._iNumOFDerivCalcs; - _dblTime = eiopOther._dblTime; - _dblStartingVariate = eiopOther._dblStartingVariate; - } - - protected boolean done() - { - _dblTime = (System.nanoTime() - _lStartTime) * 0.000001; - - return _bDone = true; - } - - /** - * Increment the Number of Iterations - * - * @return TRUE - Successfully incremented - */ - - public final boolean incrIterations() - { - ++_iNumIterations; - return true; - } - - /** - * Return The number of Iterations consumed - * - * @return Number of Iterations consumed - */ - - public final int getNumIterations() - { - return _iNumIterations; - } - - /** - * Increment the Number of Objective Function Evaluations - * - * @return TRUE - Successfully incremented - */ - - public final boolean incrOFCalcs() - { - ++_iNumOFCalcs; - return true; - } - - /** - * Retrieve the number of objective function calculations needed - * - * @return Number of objective function calculations needed - */ - - public final int getNumOFCalcs() - { - return _iNumOFCalcs; - } - - /** - * Increment the number of Objective Function Derivative evaluations - * - * @return TRUE - Successfully incremented - */ - - public final boolean incrOFDerivCalcs() - { - ++_iNumOFDerivCalcs; - return true; - } - - /** - * Retrieve the number of objective function derivative calculations needed - * - * @return Number of objective function derivative calculations needed - */ - - public final int getNumOFDerivCalcs() - { - return _iNumOFDerivCalcs; - } - - /** - * Indicate if the execution initialization is done - * - * @return TRUE - Execution initialization is done - */ - - public final boolean isDone() - { - return _bDone; - } - - /** - * Return the time elapsed for the execution initialization operation - * - * @return execution initialization time - */ - - public final double time() - { - return _dblTime; - } - - /** - * Set the Starting Variate - * - * @param dblStartingVariate Starting Variate - * - * @return TRUE - Starting Variate set successfully - */ - - public boolean setStartingVariate ( - final double dblStartingVariate) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblStartingVariate)) return false; - - _dblStartingVariate = dblStartingVariate; - return true; - } - - /** - * Return the Starting Variate - * - * @return Starting Variate - */ - - public double getStartingVariate() - { - return _dblStartingVariate; - } - - /** - * Return a string form of the Initializer output - * - * @return String form of the Initializer output - */ - - public java.lang.String displayString() - { - java.lang.StringBuffer sb = new java.lang.StringBuffer(); - - sb.append ("\t\tInitialization Done? " + isDone() + " [" + time() + " msec]"); - - sb.append ("\n\t\tNum Iterations: " + getNumIterations()); - - sb.append ("\n\t\tNum OF Calculations: " + getNumOFCalcs()); - - sb.append ("\n\t\tNum OF Derivative Calculations: " + getNumOFDerivCalcs()); - - sb.append ("\n\t\tStarting Variate: " + getStartingVariate()); - - return sb.toString(); - } -} diff --git a/org/drip/function/r1tor1solver/ExecutionInitializer.java b/org/drip/function/r1tor1solver/ExecutionInitializer.java deleted file mode 100644 index 370b284..0000000 --- a/org/drip/function/r1tor1solver/ExecutionInitializer.java +++ /dev/null @@ -1,516 +0,0 @@ - -package org.drip.function.r1tor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * ExecutionInitializer implements the initialization execution and customization functionality. - * - * ExecutionInitializer performs two types of variate initialization: - * - Bracketing initialization: This brackets the fixed point using the bracketing algorithm described in - * http://www.credit-trader.org. If successful, a pair of variate/OF coordinate nodes that bracket the - * fixed point are generated. These brackets are eventually used by routines that iteratively determine - * the fixed point. Bracketing initialization is controlled by the parameters in - * BracketingControlParams. - * - Convergence Zone initialization: This generates a variate that lies within the convergence zone for the - * iterative determination of the fixed point using the Newton's method. Convergence Zone Determination - * is controlled by the parameters in ConvergenceControlParams. - * - * ExecutionInitializer behavior can be customized/optimized through several of the initialization heuristics - * techniques implemented in the InitializationHeuristics class. - * - * @author Lakshmi Krishnamurthy - */ - -public class ExecutionInitializer { - - class StartingVariateOF { - public double _dblOF = java.lang.Double.NaN; - public double _dblVariate = java.lang.Double.NaN; - - public StartingVariateOF ( - final double dblVariate, - final double dblOF) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblOF = dblOF) || - !org.drip.quant.common.NumberUtil.IsValid (_dblVariate = dblVariate)) - throw new java.lang.Exception ("StartingVariateOF constructor: Invalid inputs!"); - } - } - - private boolean _bTrendBracketRight = false; - private org.drip.function.definition.R1ToR1 _of = null; - private org.drip.function.r1tor1solver.ConvergenceControlParams _ccp = null; - - private java.util.SortedMap _mapOFMap = new - java.util.TreeMap(); - - private double evaluateOF ( - final double dblVariate) - throws java.lang.Exception - { - if (_mapOFMap.containsKey (dblVariate)) return _mapOFMap.get (dblVariate); - - double dblOF = _of.evaluate (dblVariate); - - if (org.drip.quant.common.NumberUtil.IsValid (dblOF)) _mapOFMap.put (dblVariate, dblOF); - - return dblOF; - } - - private StartingVariateOF validateVariate ( - final double dblVariate, - final org.drip.function.r1tor1solver.BracketingOutput bop) - { - double dblOF = java.lang.Double.NaN; - - try { - dblOF = evaluateOF (dblVariate); - } catch (java.lang.Exception e) { - dblOF = java.lang.Double.NaN; - } - - if (!bop.incrOFCalcs() || !org.drip.quant.common.NumberUtil.IsValid (dblOF)) return null; - - _mapOFMap.put (dblVariate, dblOF); - - try { - return new StartingVariateOF (dblVariate, dblOF); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private StartingVariateOF initializeBracketingVariate ( - final int iNumExpansions, - final double dblBracketVariateStart, - final double dblBracketWidthStart, - final double dblBracketWidthExpansionFactor, - final org.drip.function.r1tor1solver.BracketingOutput bop) - { - StartingVariateOF sv = validateVariate (dblBracketVariateStart, bop); - - if (null != sv) return sv; - - double dblVariate = dblBracketVariateStart; - int iNumExpansionsCurrent = iNumExpansions; - double dblBracketWidth = dblBracketWidthStart; - double dblBracketLeft = dblVariate - dblBracketWidth; - double dblBracketRight = dblVariate + dblBracketWidth; - - while (0 <= iNumExpansionsCurrent--) { - if (_bTrendBracketRight) { - if (null != (sv = validateVariate (dblBracketRight, bop))) return sv; - - if (null != (sv = validateVariate (dblBracketLeft, bop))) return sv; - } else { - if (null != (sv = validateVariate (dblBracketLeft, bop))) return sv; - - if (null != (sv = validateVariate (dblBracketRight, bop))) return sv; - } - - dblBracketWidth *= dblBracketWidthExpansionFactor; - dblBracketLeft = dblVariate - dblBracketWidth; - dblBracketRight = dblVariate + dblBracketWidth; - } - - return null; - } - - private boolean bracketingDone ( - final double dblVariateLeft, - final double dblVariateRight, - final double dblOFLeft, - final double dblOFRight, - final double dblOFGoal, - final org.drip.function.r1tor1solver.BracketingOutput bop) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblOFLeft) || !org.drip.quant.common.NumberUtil.IsValid - (dblOFRight)) - return false; - - if (((dblOFLeft - dblOFGoal) * (dblOFRight - dblOFGoal)) > 0.) return false; - - double dblOF = java.lang.Double.NaN; - double dblOFPrev = java.lang.Double.NaN; - double dblVariate = java.lang.Double.NaN; - double dblVariatePrev = java.lang.Double.NaN; - - for (java.util.Map.Entry me : _mapOFMap.entrySet()) { - dblVariate = me.getKey(); - - dblOF = me.getValue(); - - if (org.drip.quant.common.NumberUtil.IsValid (dblVariatePrev) && - org.drip.quant.common.NumberUtil.IsValid (dblOFPrev) && (((dblOF - dblOFGoal) * (dblOFPrev - - dblOFGoal)) < 0.)) { - try { - bop.done (dblVariatePrev, dblVariate, dblOFPrev, dblOF, - org.drip.function.r1tor1solver.VariateIteratorPrimitive.Bisection (dblVariatePrev, - dblVariate)); - } catch (java.lang.Exception e) { - } - - return true; - } - - dblOFPrev = dblOF; - dblVariatePrev = dblVariate; - } - - try { - bop.done (dblVariateLeft, dblVariateRight, dblOFLeft, dblOFRight, - org.drip.function.r1tor1solver.VariateIteratorPrimitive.Bisection (dblVariateLeft, dblVariateRight)); - } catch (java.lang.Exception e) { - } - - return true; - } - - private boolean isInConvergenceZone ( - final double dblConvergenceZoneVariate, - final double dblOFGoal, - final org.drip.function.r1tor1solver.ConvergenceOutput cop) - throws java.lang.Exception - { - if (!cop.incrOFCalcs()) - throw new java.lang.Exception - ("ExecutionInitializer::isInConvergenceZone => Cannot increment OF in the output"); - - double dblOFValue = evaluateOF (dblConvergenceZoneVariate) - dblOFGoal; - - if (!org.drip.quant.common.NumberUtil.IsValid (dblOFValue)) - throw new java.lang.Exception - ("ExecutionInitializer::isInConvergenceZone => Cannot evaluate OF for variate " + - dblConvergenceZoneVariate); - - if (!cop.incrOFDerivCalcs()) - throw new java.lang.Exception - ("ExecutionInitializer::isInConvergenceZone => Cannot increment OF deriv count in the output"); - - org.drip.quant.calculus.Differential diff1D = _of.differential (dblConvergenceZoneVariate, 1); - - if (null == diff1D) - throw new java.lang.Exception - ("ExecutionInitializer::isInConvergenceZone => Cannot evaluate OF first deriv for variate " + - dblConvergenceZoneVariate); - - if (!cop.incrOFDerivCalcs() && !cop.incrOFDerivCalcs()) - throw new java.lang.Exception - ("ExecutionInitializer::isInConvergenceZone => Cannot increment OF deriv in the output"); - - org.drip.quant.calculus.Differential diff2D = _of.differential (dblConvergenceZoneVariate, 2); - - if (null == diff2D) - throw new java.lang.Exception - ("ExecutionInitializer::isInConvergenceZone => Cannot evaluate OF second deriv for variate " - + dblConvergenceZoneVariate); - - return java.lang.Math.abs (dblOFValue * diff2D.calcSlope (false)) < (diff1D.calcSlope (false) * - diff1D.calcSlope (false) * _ccp.getConvergenceZoneEdgeLimit()); - } - - private boolean leftOFValidityEdgeReached ( - final double dblVariateLeft, - final double dblOFLeft, - final org.drip.function.r1tor1solver.InitializationHeuristics ih) - { - return !org.drip.quant.common.NumberUtil.IsValid (dblOFLeft) || (null != ih && - org.drip.quant.common.NumberUtil.IsValid (ih.getBracketFloor()) && dblVariateLeft < - ih.getBracketFloor()); - } - - private boolean rightOFValidityEdgeReached ( - final double dblVariateRight, - final double dblOFRight, - final org.drip.function.r1tor1solver.InitializationHeuristics ih) - { - return !org.drip.quant.common.NumberUtil.IsValid (dblOFRight) || (null != ih && - org.drip.quant.common.NumberUtil.IsValid (ih.getBracketCeiling()) && dblVariateRight > - ih.getBracketCeiling()); - } - - private double getStartingBracketVariate ( - final org.drip.function.r1tor1solver.BracketingControlParams bcp, - final org.drip.function.r1tor1solver.InitializationHeuristics ih) - { - if (null != ih && org.drip.quant.common.NumberUtil.IsValid (ih.getStartingBracketMid())) - return ih.getStartingBracketMid(); - - if (null != ih && org.drip.quant.common.NumberUtil.IsValid (ih.getStartingBracketLeft()) && - org.drip.quant.common.NumberUtil.IsValid (ih.getStartingBracketRight())) - return 0.5 * (ih.getStartingBracketLeft() + ih.getStartingBracketRight()); - - return bcp.getVariateStart(); - } - - private double getStartingBracketWidth ( - final org.drip.function.r1tor1solver.BracketingControlParams bcp, - final org.drip.function.r1tor1solver.InitializationHeuristics ih) - { - if (null != ih) { - double dblBracketStartLeft = ih.getStartingBracketLeft(); - - double dblBracketStartRight = ih.getStartingBracketRight(); - - if (org.drip.quant.common.NumberUtil.IsValid (dblBracketStartLeft) && - org.drip.quant.common.NumberUtil.IsValid (dblBracketStartRight) && dblBracketStartRight > - dblBracketStartLeft) - return dblBracketStartRight - dblBracketStartLeft; - } - - return bcp.getStartingBracketWidth(); - } - - /** - * ExecutionInitializer constructor - * - * @param of Objective Function - * @param ccp Convergence Control Parameters - * @param bTrendBracketRight TRUE - Start Right Trending in search of a Bracket Variate - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public ExecutionInitializer ( - final org.drip.function.definition.R1ToR1 of, - final org.drip.function.r1tor1solver.ConvergenceControlParams ccp, - final boolean bTrendBracketRight) - throws java.lang.Exception - { - if (null == (_of = of)) - throw new java.lang.Exception ("ExecutionInitializer constructor: Invalid inputs"); - - if (null == (_ccp = ccp)) _ccp = new org.drip.function.r1tor1solver.ConvergenceControlParams(); - - _bTrendBracketRight = bTrendBracketRight; - } - - /** - * Set up the bracket to be used for the eventual search kick-off - * - * @param ih Optional InitializationHeuristics instance - * @param dblOFGoal The OF Goal - * - * @return The Bracketing Output - */ - - public org.drip.function.r1tor1solver.BracketingOutput initializeBracket ( - final org.drip.function.r1tor1solver.InitializationHeuristics ih, - final double dblOFGoal) - { - org.drip.function.r1tor1solver.BracketingControlParams bcp = (null != ih && null != ih.getCustomBCP()) ? - ih.getCustomBCP() : new org.drip.function.r1tor1solver.BracketingControlParams(); - - int iNumExpansions = bcp.getNumExpansions(); - - org.drip.function.r1tor1solver.BracketingOutput bop = new org.drip.function.r1tor1solver.BracketingOutput(); - - StartingVariateOF sv = initializeBracketingVariate (iNumExpansions, getStartingBracketVariate (bcp, - ih), getStartingBracketWidth (bcp, ih), bcp.getBracketWidthExpansionFactor(), bop); - - if (null == sv) return bop; - - double dblOFLeft = sv._dblOF; - double dblOFRight = sv._dblOF; - double dblPreviousOFLeft = sv._dblOF; - double dblPreviousOFRight = sv._dblOF; - double dblVariateLeft = sv._dblVariate; - double dblVariateRight = sv._dblVariate; - boolean bLeftOFValidityEdgeReached = false; - boolean bRightOFValidityEdgeReached = false; - double dblPreviousVariateLeft = sv._dblVariate; - double dblPreviousVariateRight = sv._dblVariate; - - double dblBracketWidth = bcp.getStartingBracketWidth(); - - while (0 <= iNumExpansions--) { - if (!bop.incrIterations()) return null; - - if (bLeftOFValidityEdgeReached && bRightOFValidityEdgeReached) return bop; - - if (!bLeftOFValidityEdgeReached) { - dblPreviousVariateLeft = dblVariateLeft; - dblVariateLeft -= dblBracketWidth; - dblPreviousOFLeft = dblOFLeft; - - try { - if (bracketingDone (dblVariateLeft, dblVariateRight, dblOFLeft = evaluateOF - (dblVariateLeft), dblOFRight, dblOFGoal, bop) && bop.incrOFCalcs()) - return bop; - } catch (java.lang.Exception e) { - dblOFLeft = java.lang.Double.NaN; - } - - if (bLeftOFValidityEdgeReached = leftOFValidityEdgeReached (dblVariateLeft, dblOFLeft, ih)) { - dblOFLeft = dblPreviousOFLeft; - dblVariateLeft = dblPreviousVariateLeft; - } - } - - if (!bRightOFValidityEdgeReached) { - dblPreviousVariateRight = dblVariateRight; - dblVariateRight += dblBracketWidth; - dblPreviousOFRight = dblOFRight; - - try { - if (bracketingDone (dblVariateLeft, dblVariateRight, dblOFLeft, dblOFRight = evaluateOF - (dblVariateRight), dblOFGoal, bop) && bop.incrOFCalcs()) - return bop; - } catch (java.lang.Exception e) { - dblOFRight = java.lang.Double.NaN; - } - - if (bRightOFValidityEdgeReached = rightOFValidityEdgeReached (dblVariateRight, dblOFRight, - ih)) { - dblOFRight = dblPreviousOFRight; - dblVariateRight = dblPreviousVariateRight; - } - } - - if (bracketingDone (dblVariateLeft, dblVariateRight, dblOFLeft, dblOFRight, dblOFGoal, bop)) - return bop; - - dblBracketWidth *= bcp.getBracketWidthExpansionFactor(); - } - - return null; - } - - /** - * Initialize the starting variate to within the fixed point convergence zone - * - * @param ih Optional InitializationHeuristics instance - * @param dblOFGoal The OF Goal - * - * @return The Convergence Zone Output - */ - - public org.drip.function.r1tor1solver.ConvergenceOutput initializeVariate ( - final org.drip.function.r1tor1solver.InitializationHeuristics ih, - final double dblOFGoal) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblOFGoal)) return null; - - org.drip.function.r1tor1solver.ConvergenceOutput cop = new org.drip.function.r1tor1solver.ConvergenceOutput(); - - org.drip.function.r1tor1solver.BracketingOutput bop = initializeBracket (ih, dblOFGoal); - - if (null != bop && bop.done()) return bop.makeConvergenceVariate(); - - double dblConvergenceZoneVariate = _ccp.getConvergenceZoneVariateBegin(); - - int iFixedPointConvergenceIterations = _ccp.getFixedPointConvergenceIterations(); - - while (0 != iFixedPointConvergenceIterations--) { - if (!cop.incrIterations()) return cop; - - try { - if (isInConvergenceZone (dblConvergenceZoneVariate, dblOFGoal, cop)) { - cop.done (dblConvergenceZoneVariate); - - return cop; - } - } catch (java.lang.Exception e) { - // e.printStackTrace(); - } - - try { - if (isInConvergenceZone (-1. * dblConvergenceZoneVariate, dblOFGoal, cop)) { - cop.done (-1. * dblConvergenceZoneVariate); - - return cop; - } - } catch (java.lang.Exception e) { - // e.printStackTrace(); - } - - dblConvergenceZoneVariate *= _ccp.getConvergenceZoneVariateBumpFactor(); - } - - return null; - } - - /** - * Initialize the starting bracket within the specified boundary - * - * @param ih Initialization Heuristics containing the hard search edges - * @param dblOFGoal The OF Goal - * - * @return Results of the Verification - */ - - public org.drip.function.r1tor1solver.BracketingOutput verifyHardSearchEdges ( - final org.drip.function.r1tor1solver.InitializationHeuristics ih, - final double dblOFGoal) - { - if (null == ih || !org.drip.quant.common.NumberUtil.IsValid (ih.getSearchStartLeft()) || - !org.drip.quant.common.NumberUtil.IsValid (ih.getSearchStartRight()) || - !org.drip.quant.common.NumberUtil.IsValid (dblOFGoal)) - return null; - - try { - org.drip.function.r1tor1solver.BracketingOutput bop = new - org.drip.function.r1tor1solver.BracketingOutput(); - - if (bracketingDone (ih.getSearchStartLeft(), ih.getSearchStartRight(), evaluateOF - (ih.getSearchStartLeft()), evaluateOF (ih.getSearchStartRight()), dblOFGoal, bop) && - bop.incrOFCalcs()) - return bop; - } catch (java.lang.Exception e) { - } - - return null; - } -} diff --git a/org/drip/function/r1tor1solver/FixedPointFinder.java b/org/drip/function/r1tor1solver/FixedPointFinder.java deleted file mode 100644 index 7ead76c..0000000 --- a/org/drip/function/r1tor1solver/FixedPointFinder.java +++ /dev/null @@ -1,169 +0,0 @@ - -package org.drip.function.r1tor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * FixedPointFinder is the base abstract class that is implemented by customized invocations, e.g., Newton's - * method, or any of the bracketing methodologies. - * - * FixedPointFinder invokes the core routine for determining the fixed point from the goal. The - * ExecutionControl determines the execution termination. The initialization heuristics implements - * targeted customization of the search. - * - * FixedPointFinder main flow comprises of the following steps: - * - Initialize the fixed point search zone by determining either a) the brackets, or b) the starting - * variate. - * - Compute the absolute OF tolerance that establishes the attainment of the fixed point. - * - Launch the variate iterator that iterates the variate. - * - Iterate until the desired tolerance has been attained - * - Return the fixed point output. - * - * Fixed point finders that derive from this provide implementations for the following: - * - Variate initialization: They may choose either bracketing initializer, or the convergence initializer - - * functionality is provided for both in this module. - * - Variate Iteration: Variates are iterated using a) any of the standard primitive built-in variate - * iterators (or custom ones), or b) a variate selector scheme for each iteration. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class FixedPointFinder { - protected boolean _bWhine = false; - protected double _dblOFGoal = java.lang.Double.NaN; - protected org.drip.function.r1tor1solver.ExecutionControl _ec = null; - protected org.drip.function.definition.R1ToR1 _of = null; - - protected FixedPointFinder ( - final double dblOFGoal, - final org.drip.function.definition.R1ToR1 of, - final org.drip.function.r1tor1solver.ExecutionControl ec, - final boolean bWhine) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblOFGoal = dblOFGoal) || null == (_of = of)) - throw new java.lang.Exception ("FixedPointFinder constructor: Invalid inputs"); - - _ec = new org.drip.function.r1tor1solver.ExecutionControl (of, null); - - _bWhine = bWhine; - } - - protected abstract boolean iterateVariate ( - final org.drip.function.r1tor1solver.IteratedVariate vi, - final org.drip.function.r1tor1solver.FixedPointFinderOutput rfop); - - protected abstract org.drip.function.r1tor1solver.ExecutionInitializationOutput initializeVariateZone ( - final org.drip.function.r1tor1solver.InitializationHeuristics ih); - - /** - * Invoke the solution 1D root finding sequence - * - * @param ih Optional Initialization Heuristics - * - * @return Root finder Solution Object for the variate - */ - - public org.drip.function.r1tor1solver.FixedPointFinderOutput findRoot ( - final org.drip.function.r1tor1solver.InitializationHeuristics ih) - { - org.drip.function.r1tor1solver.FixedPointFinderOutput rfop = null; - - org.drip.function.r1tor1solver.ExecutionInitializationOutput eiop = initializeVariateZone (ih); - - if (null == eiop || !eiop.isDone()) return null; - - try { - rfop = new org.drip.function.r1tor1solver.FixedPointFinderOutput (eiop); - - if (!rfop.incrOFCalcs()) return rfop; - - double dblOF = _of.evaluate (eiop.getStartingVariate()); - - double dblAbsoluteTolerance = _ec.calcAbsoluteOFTolerance (dblOF); - - double dblAbsoluteConvergence = _ec.calcAbsoluteVariateConvergence (eiop.getStartingVariate()); - - org.drip.function.r1tor1solver.IteratedVariate iv = new - org.drip.function.r1tor1solver.IteratedVariate (eiop, dblOF); - - int iNumIterationsPending = _ec.getNumIterations(); - - while (!_ec.hasOFReachedGoal (dblAbsoluteTolerance, iv.getOF(), _dblOFGoal)) { - double dblPrevVariate = iv.getVariate(); - - if (!rfop.incrIterations() || 0 == --iNumIterationsPending || !iterateVariate (iv, rfop)) - return rfop; - - if (_ec.isVariateConvergenceCheckEnabled() && (java.lang.Math.abs (dblPrevVariate - - iv.getVariate()) < dblAbsoluteConvergence)) - break; - } - - rfop.setRoot (iv.getVariate()); - } catch (java.lang.Exception e) { - if (_bWhine) e.printStackTrace(); - } - - return rfop; - } - - /** - * Invoke the solution 1D root finding sequence - * - * @return Root finder Solution Object for the variate - */ - - public org.drip.function.r1tor1solver.FixedPointFinderOutput findRoot() - { - return findRoot (null); - } -} diff --git a/org/drip/function/r1tor1solver/FixedPointFinderBracketing.java b/org/drip/function/r1tor1solver/FixedPointFinderBracketing.java deleted file mode 100644 index 16ff94f..0000000 --- a/org/drip/function/r1tor1solver/FixedPointFinderBracketing.java +++ /dev/null @@ -1,233 +0,0 @@ - -package org.drip.function.r1tor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * FixedPointFinderBracketing customizes the FixedPointFinder for bracketing based fixed point finder - * functionality. - * - * FixedPointFinderBracketing applies the following customization: - * - Initializes the fixed point finder by computing the starting brackets - * - Iterating the next search variate using one of the specified variate iterator primitives. - * - * By default, FixedPointFinderBracketing does not do compound iterations of the variate using any schemes - - * that is done by classes that extend it. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixedPointFinderBracketing extends org.drip.function.r1tor1solver.FixedPointFinder { - protected int _iIteratorPrimitive = -1; - protected org.drip.function.r1tor1solver.IteratedBracket _ib = null; - - private org.drip.function.r1tor1solver.ExecutionInitializer _ei = null; - - protected final double calcNextVariate ( - final double dblCurrentVariate, - final double dblContraVariate, - final double dblCurrentOF, - final double dblContraPointOF, - final int iIteratorPrimitive, - final org.drip.function.r1tor1solver.FixedPointFinderOutput rfop) - throws java.lang.Exception - { - if (org.drip.function.r1tor1solver.VariateIteratorPrimitive.BISECTION == iIteratorPrimitive) - return org.drip.function.r1tor1solver.VariateIteratorPrimitive.Bisection (dblCurrentVariate, - dblContraVariate); - - if (org.drip.function.r1tor1solver.VariateIteratorPrimitive.FALSE_POSITION == iIteratorPrimitive) - return org.drip.function.r1tor1solver.VariateIteratorPrimitive.FalsePosition (dblCurrentVariate, - dblContraVariate, dblCurrentOF, dblContraPointOF); - - double dblIntermediateVariate = org.drip.function.r1tor1solver.VariateIteratorPrimitive.Bisection - (dblCurrentVariate, dblContraVariate); - - if (!rfop.incrOFCalcs()) - throw new java.lang.Exception - ("FixedPointFinderBracketing::calcNextVariate => Cannot increment rfop!"); - - if (org.drip.function.r1tor1solver.VariateIteratorPrimitive.QUADRATIC_INTERPOLATION == iIteratorPrimitive) - return org.drip.function.r1tor1solver.VariateIteratorPrimitive.QuadraticInterpolation (dblCurrentVariate, - dblIntermediateVariate, dblContraVariate, dblCurrentOF, _of.evaluate - (dblIntermediateVariate), dblContraPointOF); - - if (org.drip.function.r1tor1solver.VariateIteratorPrimitive.INVERSE_QUADRATIC_INTERPOLATION == - iIteratorPrimitive) - return org.drip.function.r1tor1solver.VariateIteratorPrimitive.InverseQuadraticInterpolation - (dblCurrentVariate, dblIntermediateVariate, dblContraVariate, dblCurrentOF, _of.evaluate - (dblIntermediateVariate), dblContraPointOF); - - if (org.drip.function.r1tor1solver.VariateIteratorPrimitive.RIDDER == iIteratorPrimitive) - return org.drip.function.r1tor1solver.VariateIteratorPrimitive.Ridder (dblCurrentVariate, - dblIntermediateVariate, dblContraVariate, dblCurrentOF, _of.evaluate - (dblIntermediateVariate), dblContraPointOF); - - throw new java.lang.Exception - ("FixedPointFinderBracketing.calcNextVariate => Unknown Iterator Primitive"); - } - - protected double iterateCompoundVariate ( - final double dblCurrentVariate, - final double dblContraVariate, - final double dblCurrentOF, - final double dblContraPointOF, - final org.drip.function.r1tor1solver.FixedPointFinderOutput rfop) - throws java.lang.Exception - { - return calcNextVariate (dblCurrentVariate, dblContraVariate, dblCurrentOF, dblContraPointOF, - _iIteratorPrimitive, rfop); - } - - @Override protected boolean iterateVariate ( - final org.drip.function.r1tor1solver.IteratedVariate iv, - final org.drip.function.r1tor1solver.FixedPointFinderOutput rfop) - { - if (null == iv || null == rfop) return false; - - double dblContraRoot = java.lang.Double.NaN; - double dblContraRootOF = java.lang.Double.NaN; - - double dblOF = iv.getOF(); - - double dblOFLeft = _ib.getOFLeft(); - - double dblOFRight = _ib.getOFRight(); - - double dblVariate = iv.getVariate(); - - double dblVariateLeft = _ib.getVariateLeft(); - - double dblVariateRight = _ib.getVariateRight(); - - if (((dblOFLeft - _dblOFGoal) * (dblOF - _dblOFGoal)) > 0.) { - if (!_ib.setOFLeft (dblOF) || !_ib.setVariateLeft (dblVariate)) return false; - - dblContraRootOF = dblOFRight; - dblContraRoot = dblVariateRight; - } else if (((dblOFRight - _dblOFGoal) * (dblOF - _dblOFGoal)) > 0.) { - if (!_ib.setOFRight (dblOF) || !_ib.setVariateRight (dblVariate)) return false; - - dblContraRootOF = dblOFLeft; - dblContraRoot = dblVariateLeft; - } - - try { - dblVariate = iterateCompoundVariate (dblVariate, dblContraRoot, dblOF, dblContraRootOF, rfop); - - return iv.setVariate (dblVariate) && iv.setOF (_of.evaluate (dblVariate)) && rfop.incrOFCalcs(); - } catch (java.lang.Exception e) { - if (_bWhine) e.printStackTrace(); - } - - return false; - } - - @Override protected org.drip.function.r1tor1solver.ExecutionInitializationOutput initializeVariateZone ( - final org.drip.function.r1tor1solver.InitializationHeuristics ih) - { - org.drip.function.r1tor1solver.BracketingOutput bop = null; - - if (null != ih && org.drip.function.r1tor1solver.InitializationHeuristics.SEARCH_HARD_BRACKETS == - ih.getDeterminant()) - bop = _ei.verifyHardSearchEdges (ih, _dblOFGoal); - else - bop = _ei.initializeBracket (ih, _dblOFGoal); - - if (null == bop || !bop.isDone()) return null; - - try { - _ib = new org.drip.function.r1tor1solver.IteratedBracket (bop); - - return bop; - } catch (java.lang.Exception e) { - if (_bWhine) e.printStackTrace(); - } - - return null; - } - - /** - * FixedPointFinderBracketing constructor - * - * @param dblOFGoal OF Goal - * @param of Objective Function - * @param ec Execution Control - * @param iIteratorPrimitive Iterator Primitive - * @param bWhine TRUE - Balk on Encountering Exception - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public FixedPointFinderBracketing ( - final double dblOFGoal, - final org.drip.function.definition.R1ToR1 of, - final org.drip.function.r1tor1solver.ExecutionControl ec, - final int iIteratorPrimitive, - final boolean bWhine) - throws java.lang.Exception - { - super (dblOFGoal, of, ec, bWhine); - - if (org.drip.function.r1tor1solver.VariateIteratorPrimitive.BISECTION != (_iIteratorPrimitive = - iIteratorPrimitive) && org.drip.function.r1tor1solver.VariateIteratorPrimitive.FALSE_POSITION != - _iIteratorPrimitive && - org.drip.function.r1tor1solver.VariateIteratorPrimitive.QUADRATIC_INTERPOLATION != - _iIteratorPrimitive && - org.drip.function.r1tor1solver.VariateIteratorPrimitive.INVERSE_QUADRATIC_INTERPOLATION - != _iIteratorPrimitive && - org.drip.function.r1tor1solver.VariateIteratorPrimitive.RIDDER != - _iIteratorPrimitive) - throw new java.lang.Exception ("FixedPointFinderBracketing constructor: Invalid inputs!"); - - _ei = new org.drip.function.r1tor1solver.ExecutionInitializer (_of, null, true); - } -} diff --git a/org/drip/function/r1tor1solver/FixedPointFinderBrent.java b/org/drip/function/r1tor1solver/FixedPointFinderBrent.java deleted file mode 100644 index 6d03bbc..0000000 --- a/org/drip/function/r1tor1solver/FixedPointFinderBrent.java +++ /dev/null @@ -1,148 +0,0 @@ - -package org.drip.function.r1tor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * FixedPointFinderBrent customizes FixedPointFinderBracketing by applying the Brent's scheme of compound - * variate selector. - * - * Brent's scheme, as implemented here, is described in http://www.credit-trader.org. This implementation - * retains absolute shifts that have happened to the variate for the past 2 iterations as the discriminant - * that determines the next variate to be generated. - * - * FixedPointFinderBrent uses the following parameters specified in VariateIterationSelectorParams: - * - The Variate Primitive that is regarded as the "fast" method - * - The Variate Primitive that is regarded as the "robust" method - * - The relative variate shift that determines when the "robust" method is to be invoked over the "fast" - * - The lower bound on the variate shift between iterations that serves as the fall-back to the "robust" - * - * @author Lakshmi Krishnamurthy - */ - -public class FixedPointFinderBrent extends org.drip.function.r1tor1solver.FixedPointFinderBracketing { - private double _dblVariateIterativeShift = java.lang.Double.NaN; - private double _dblPreviousVariateIterativeShift = java.lang.Double.NaN; - private org.drip.function.r1tor1solver.VariateIterationSelectorParams _visp = null; - - @Override protected double iterateCompoundVariate ( - final double dblCurrentVariate, - final double dblContraVariate, - final double dblCurrentOF, - final double dblContraPointOF, - final org.drip.function.r1tor1solver.FixedPointFinderOutput rfop) - throws java.lang.Exception - { - double dblNextVariate = calcNextVariate (dblCurrentVariate, dblContraVariate, dblCurrentOF, - dblContraPointOF, _visp.getFastVariateIteratorPrimitive(), rfop); - - double dblVariateEstimateShift = java.lang.Math.abs (dblNextVariate - dblCurrentVariate); - - if (org.drip.quant.common.NumberUtil.IsValid (_dblVariateIterativeShift) || - _visp.getRobustVariateIteratorPrimitive() == _iIteratorPrimitive) { - if (dblVariateEstimateShift < _visp.getRelativeVariateShift() * _dblVariateIterativeShift && - _dblVariateIterativeShift > 0.5 * _visp.getVariateShiftLowerBound()) { - _iIteratorPrimitive = _visp.getFastVariateIteratorPrimitive(); - - _dblPreviousVariateIterativeShift = _dblVariateIterativeShift; - _dblVariateIterativeShift = dblVariateEstimateShift; - return dblNextVariate; - } - - _iIteratorPrimitive = _visp.getRobustVariateIteratorPrimitive(); - - _dblPreviousVariateIterativeShift = _dblVariateIterativeShift; - _dblVariateIterativeShift = dblVariateEstimateShift; - - return calcNextVariate (dblCurrentVariate, dblContraVariate, dblCurrentOF, dblContraPointOF, - _visp.getRobustVariateIteratorPrimitive(), rfop); - } - - if (org.drip.quant.common.NumberUtil.IsValid (_dblPreviousVariateIterativeShift) && - (dblVariateEstimateShift < _visp.getRelativeVariateShift() * _dblPreviousVariateIterativeShift && - _dblPreviousVariateIterativeShift > 0.5 * _visp.getVariateShiftLowerBound())) { - _iIteratorPrimitive = _visp.getFastVariateIteratorPrimitive(); - - _dblPreviousVariateIterativeShift = _dblVariateIterativeShift; - _dblVariateIterativeShift = dblVariateEstimateShift; - return dblNextVariate; - } - - _iIteratorPrimitive = _visp.getRobustVariateIteratorPrimitive(); - - _dblPreviousVariateIterativeShift = _dblVariateIterativeShift; - _dblVariateIterativeShift = dblVariateEstimateShift; - - return calcNextVariate (dblCurrentVariate, dblContraVariate, dblCurrentOF, dblContraPointOF, - _visp.getRobustVariateIteratorPrimitive(), rfop); - } - - /** - * FixedPointFinderBrent constructor - * - * @param dblOFGoal OF Goal - * @param of Objective Function - * @param bWhine TRUE - Balk on Encountering Exception - * - * @throws java.lang.Exception Propogated from below - */ - - public FixedPointFinderBrent ( - final double dblOFGoal, - final org.drip.function.definition.R1ToR1 of, - final boolean bWhine) - throws java.lang.Exception - { - super (dblOFGoal, of, null, org.drip.function.r1tor1solver.VariateIteratorPrimitive.BISECTION, bWhine); - - _visp = new org.drip.function.r1tor1solver.VariateIterationSelectorParams(); - } -} diff --git a/org/drip/function/r1tor1solver/FixedPointFinderNewton.java b/org/drip/function/r1tor1solver/FixedPointFinderNewton.java deleted file mode 100644 index bfde08e..0000000 --- a/org/drip/function/r1tor1solver/FixedPointFinderNewton.java +++ /dev/null @@ -1,131 +0,0 @@ - -package org.drip.function.r1tor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * FixedPointFinderNewton customizes the FixedPointFinder for Open (Newton's) fixed point finder - * functionality. - * - * FixedPointFinderNewton applies the following customization: - * - Initializes the fixed point finder by computing a starting variate in the convergence zone - * - Iterating the next search variate using the Newton's method. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixedPointFinderNewton extends org.drip.function.r1tor1solver.FixedPointFinder { - private org.drip.function.r1tor1solver.ExecutionInitializer _ei = null; - - private double calcVariateOFSlope ( - final double dblVariate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate)) - throw new java.lang.Exception ("FixedPointFinderNewton::calcVariateOFSlope => Invalid input!"); - - org.drip.quant.calculus.Differential diff = _of.differential (dblVariate, 1); - - if (null == diff) - throw new java.lang.Exception - ("FixedPointFinderNewton::calcVariateTargetSlope => Cannot evaluate Derivative for variate " - + dblVariate); - - return diff.calcSlope (false); - } - - @Override protected boolean iterateVariate ( - final org.drip.function.r1tor1solver.IteratedVariate vi, - final org.drip.function.r1tor1solver.FixedPointFinderOutput rfop) - { - if (null == vi || null == rfop) return false; - - double dblVariate = vi.getVariate(); - - try { - double dblVariateNext = dblVariate - calcVariateOFSlope (dblVariate) * vi.getOF(); - - return vi.setVariate (dblVariateNext) && vi.setOF (_of.evaluate (dblVariateNext)) && - rfop.incrOFDerivCalcs() && rfop.incrOFCalcs(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - @Override protected org.drip.function.r1tor1solver.ExecutionInitializationOutput initializeVariateZone ( - final org.drip.function.r1tor1solver.InitializationHeuristics ih) - { - return _ei.initializeBracket (ih, _dblOFGoal); - } - - /** - * FixedPointFinderNewton constructor - * - * @param dblOFGoal OF Goal - * @param of Objective Function - * @param bWhine TRUE - Balk on Encountering Exception - * - * @throws java.lang.Exception Propogated from underneath - */ - - public FixedPointFinderNewton ( - final double dblOFGoal, - final org.drip.function.definition.R1ToR1 of, - final boolean bWhine) - throws java.lang.Exception - { - super (dblOFGoal, of, null, bWhine); - - _ei = new org.drip.function.r1tor1solver.ExecutionInitializer (_of, null, true); - } -} diff --git a/org/drip/function/r1tor1solver/FixedPointFinderOutput.java b/org/drip/function/r1tor1solver/FixedPointFinderOutput.java deleted file mode 100644 index 03450f7..0000000 --- a/org/drip/function/r1tor1solver/FixedPointFinderOutput.java +++ /dev/null @@ -1,249 +0,0 @@ - -package org.drip.function.r1tor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * FixedPointFinderOutput holds the result of the fixed point search. - * - * FixedPointFinderOutput contains the following fields: - * - Whether the search completed successfully - * - The number of iterations, the number of objective function base/derivative calculations, and the time - * taken for the search - * - The output from initialization - * - * @author Lakshmi Krishnamurthy - */ - -public class FixedPointFinderOutput { - private int _iNumOFCalcs = 0; - private long _lStartTime = 0L; - private int _iNumIterations = 0; - private int _iNumOFDerivCalcs = 0; - private boolean _bHasRoot = false; - private double _dblRoot = java.lang.Double.NaN; - private double _dblRootFindingTime = java.lang.Double.NaN; - private org.drip.function.r1tor1solver.ExecutionInitializationOutput _eiop = null; - - /** - * FixedPointFinderOutput constructor - * - * @param eiop Execution Initialization Output 1D - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public FixedPointFinderOutput ( - final org.drip.function.r1tor1solver.ExecutionInitializationOutput eiop) - throws java.lang.Exception - { - if (null == (_eiop = eiop)) - throw new java.lang.Exception ("FixedPointFinderOutput constructor: Invalid inputs!"); - - _lStartTime = System.nanoTime(); - } - - /** - * Set the Root - * - * @param dblRoot Root - * - * @return TRUE - Successfully set - */ - - public boolean setRoot ( - final double dblRoot) - { - _dblRootFindingTime = (System.nanoTime() - _lStartTime) * 0.000001; - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblRoot = dblRoot)) return false; - - return _bHasRoot = true; - } - - /** - * Indicate whether the root is present in the output, i.e., if the finder has successfully completed. - * - * @return TRUE - Root exists in the output - */ - - public boolean containsRoot() - { - return _bHasRoot; - } - - /** - * Return the time elapsed for the the full root finding operation - * - * @return Time taken for root finding - */ - - public double time() - { - return _dblRootFindingTime; - } - - /** - * Return the root - * - * @return Root - */ - - public double getRoot() - { - return _dblRoot; - } - - /** - * Increment the number of Iterations - * - * @return TRUE - Successfully incremented - */ - - public boolean incrIterations() - { - ++_iNumIterations; - return true; - } - - /** - * Return The number of iterations taken - * - * @return Number of iterations taken - */ - - public int getNumIterations() - { - return _iNumIterations; - } - - /** - * Increment the number of Objective Function evaluations - * - * @return TRUE - Successfully incremented - */ - - public boolean incrOFCalcs() - { - ++_iNumOFCalcs; - return true; - } - - /** - * Retrieve the number of objective function calculations needed - * - * @return Number of objective function calculations needed - */ - - public int getNumOFCalcs() - { - return _iNumOFCalcs; - } - - /** - * Increment the number of Objective Function Derivative evaluations - * - * @return TRUE - Successfully incremented - */ - - public boolean incrOFDerivCalcs() - { - ++_iNumOFDerivCalcs; - return true; - } - - /** - * Retrieve the number of objective function derivative calculations needed - * - * @return Number of objective function derivative calculations needed - */ - - public int getNumOFDerivCalcs() - { - return _iNumOFDerivCalcs; - } - - /** - * Retrieve the Execution Initialization Output - * - * @return Execution Initialization Output - */ - - public org.drip.function.r1tor1solver.ExecutionInitializationOutput getEIOP() - { - return _eiop; - } - - /** - * Return a string form of the root finder output - * - * @return String form of the root finder output - */ - - public java.lang.String displayString() - { - java.lang.StringBuffer sb = new java.lang.StringBuffer(); - - sb.append (_eiop.displayString()); - - sb.append ("\n\tRoot finding Done? " + _bHasRoot + " [" + _dblRootFindingTime + " msec]"); - - sb.append ("\n\tRoot: " + _dblRoot); - - sb.append ("\n\tNum Iterations: " + _iNumIterations); - - sb.append ("\n\tNum OF Calculations: " + _iNumOFCalcs); - - sb.append ("\n\tNum OF Derivative Calculations: " + _iNumOFDerivCalcs); - - return sb.toString(); - } -} diff --git a/org/drip/function/r1tor1solver/FixedPointFinderZheng.java b/org/drip/function/r1tor1solver/FixedPointFinderZheng.java deleted file mode 100644 index 978b422..0000000 --- a/org/drip/function/r1tor1solver/FixedPointFinderZheng.java +++ /dev/null @@ -1,111 +0,0 @@ - -package org.drip.function.r1tor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * FixedPointFinderZheng implements the fixed point locator using Zheng's improvement to Brent's method. - * - * FixedPointFinderZheng overrides the iterateCompoundVariate method to achieve the desired simplification in - * the iterative variate selection. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixedPointFinderZheng extends org.drip.function.r1tor1solver.FixedPointFinderBracketing { - @Override protected double iterateCompoundVariate ( - final double dblCurrentVariate, - final double dblContraVariate, - final double dblCurrentOF, - final double dblContraPointOF, - final org.drip.function.r1tor1solver.FixedPointFinderOutput rfop) - throws java.lang.Exception - { - double dblVariateMid = org.drip.function.r1tor1solver.VariateIteratorPrimitive.Bisection (dblCurrentVariate, - dblContraVariate); - - if (!rfop.incrOFCalcs()) - throw new java.lang.Exception - ("FixedPointFinderZheng::iterateCompoundVariate => Cannot increment rfop!"); - - double dblOF = _of.evaluate (dblVariateMid); - - double dblNextVariate = java.lang.Double.NaN; - - if (dblCurrentOF != dblOF && dblContraPointOF != dblOF) - dblNextVariate = org.drip.function.r1tor1solver.VariateIteratorPrimitive.InverseQuadraticInterpolation - (dblCurrentVariate, dblVariateMid, dblContraVariate, dblCurrentOF, dblOF, dblContraPointOF); - else - dblNextVariate = org.drip.function.r1tor1solver.VariateIteratorPrimitive.FalsePosition (dblCurrentVariate, - dblContraVariate, dblCurrentOF, dblContraPointOF); - - return dblVariateMid < dblNextVariate ? dblVariateMid : dblNextVariate; - } - - /** - * FixedPointFinderZheng constructor - * - * @param dblOFGoal OF Goal - * @param of Objective Function - * @param bWhine TRUE - Balk on Encountering Exception - * - * @throws java.lang.Exception Propogated from below - */ - - public FixedPointFinderZheng ( - final double dblOFGoal, - final org.drip.function.definition.R1ToR1 of, - final boolean bWhine) - throws java.lang.Exception - { - super (dblOFGoal, of, null, org.drip.function.r1tor1solver.VariateIteratorPrimitive.BISECTION, bWhine); - } -} diff --git a/org/drip/function/r1tor1solver/InitializationHeuristics.java b/org/drip/function/r1tor1solver/InitializationHeuristics.java deleted file mode 100644 index 6a84e97..0000000 --- a/org/drip/function/r1tor1solver/InitializationHeuristics.java +++ /dev/null @@ -1,395 +0,0 @@ - -package org.drip.function.r1tor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * InitializationHeuristics implements several heuristics used to kick off the fixed point bracketing/search - * process. - * - * The following custom heuristics are implemented as part of the heuristics based kick-off: - * - * - Custom Bracketing Control Parameters: Any of the standard bracketing control parameters can be - * customized to kick-off the bracketing search. - * - Soft Left/Right Bracketing Hints: The left/right starting bracket edges are used as soft bracketing - * initialization hints. - * - Soft Mid Bracketing Hint: A mid bracketing level is specified to indicate the soft bracketing kick-off. - * - Hard Bracketing Floor/Ceiling: A pair of hard floor and ceiling limits are specified as a constraint to - * the bracketing. - * - Hard Search Boundaries: A pair of hard left and right boundaries are specified to kick-off the final - * fixed point search. - * - * These heuristics are further interpreted and developed inside the ExecutionInitializer and the - * ExecutionControl implementations. - * - * @author Lakshmi Krishnamurthy - */ - -public class InitializationHeuristics { - - /** - * Start bracket initialization from the Generic Bracket Initializer - */ - - public static final int BRACKETING_GENERIC_BCP = 0; - - /** - * Start bracket initialization from Pre-specified left/right edge hints - */ - - public static final int BRACKETING_EDGE_HINTS = 1; - - /** - * Start bracket initialization from Pre-specified Starting Mid Bracketing Variate - */ - - public static final int BRACKETING_MID_HINT = 2; - - /** - * Restrict the bracket initialization to within the specified Floor and Ceiling - */ - - public static final int BRACKETING_FLOOR_CEILING = 4; - - /** - * Start search from Pre-specified Hard Search Brackets - */ - - public static final int SEARCH_HARD_BRACKETS = 8; - - /** - * Start search from Custom Bracketing Control Parameters - */ - - public static final int BRACKETING_CUSTOM_BCP = 16; - - private int _iDeterminant = BRACKETING_GENERIC_BCP; - private double _dblBracketFloor = java.lang.Double.NaN; - private double _dblBracketCeiling = java.lang.Double.NaN; - private double _dblSearchStartLeft = java.lang.Double.NaN; - private double _dblSearchStartRight = java.lang.Double.NaN; - private double _dblStartingBracketMid = java.lang.Double.NaN; - private double _dblStartingBracketLeft = java.lang.Double.NaN; - private double _dblStartingBracketRight = java.lang.Double.NaN; - private org.drip.function.r1tor1solver.BracketingControlParams _bcpCustom = null; - - /** - * Construct an Initialization Heuristics Instance from the hard search edges - * - * @param dblSearchStartLeft Search Start Left Edge - * @param dblSearchStartRight Search Start Right Edge - * - * @return InitializationHeuristics instance - */ - - public static final InitializationHeuristics FromHardSearchEdges ( - final double dblSearchStartLeft, - final double dblSearchStartRight) - { - try { - return new InitializationHeuristics (SEARCH_HARD_BRACKETS, dblSearchStartLeft, - dblSearchStartRight, java.lang.Double.NaN, java.lang.Double.NaN, java.lang.Double.NaN, - java.lang.Double.NaN, java.lang.Double.NaN, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an Initialization Heuristics Instance from the bracketing edge soft hints - * - * @param dblStartingBracketLeft Starting Soft Left Bracketing Edge Hint - * @param dblStartingBracketRight Starting Soft Right Bracketing Edge Hint - * - * @return InitializationHeuristics instance - */ - - public static final InitializationHeuristics FromBracketingEdgeHints ( - final double dblStartingBracketLeft, - final double dblStartingBracketRight) - { - try { - return new InitializationHeuristics (BRACKETING_EDGE_HINTS, java.lang.Double.NaN, - java.lang.Double.NaN, dblStartingBracketLeft, dblStartingBracketRight, java.lang.Double.NaN, - java.lang.Double.NaN, java.lang.Double.NaN, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an Initialization Heuristics Instance from the bracketing mid hint - * - * @param dblStartingBracketMid Starting Soft Right Bracketing Mid Hint - * - * @return InitializationHeuristics instance - */ - - public static final InitializationHeuristics FromBracketingMidHint ( - final double dblStartingBracketMid) - { - try { - return new InitializationHeuristics (BRACKETING_MID_HINT, java.lang.Double.NaN, - java.lang.Double.NaN, java.lang.Double.NaN, java.lang.Double.NaN, dblStartingBracketMid, - java.lang.Double.NaN, java.lang.Double.NaN, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an Initialization Heuristics Instance from the bracketing hard floor/ceiling - * - * @param dblBracketFloor Starting Hard Left Bracketing Floor - * @param dblBracketCeiling Starting Hard Right Bracketing Ceiling - * - * @return InitializationHeuristics instance - */ - - public static final InitializationHeuristics FromBracketingFloorCeiling ( - final double dblBracketFloor, - final double dblBracketCeiling) - { - try { - return new InitializationHeuristics (BRACKETING_FLOOR_CEILING, java.lang.Double.NaN, - java.lang.Double.NaN, java.lang.Double.NaN, java.lang.Double.NaN, java.lang.Double.NaN, - dblBracketFloor, dblBracketCeiling, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an Initialization Heuristics Instance from Custom Bracketing Control Parameters - * - * @param bcpCustom Custom Bracketing Control Parameters - * - * @return InitializationHeuristics instance - */ - - public static final InitializationHeuristics FromBracketingCustomBCP ( - final org.drip.function.r1tor1solver.BracketingControlParams bcpCustom) - { - try { - return new InitializationHeuristics (BRACKETING_CUSTOM_BCP, java.lang.Double.NaN, - java.lang.Double.NaN, java.lang.Double.NaN, java.lang.Double.NaN, java.lang.Double.NaN, - java.lang.Double.NaN, java.lang.Double.NaN, bcpCustom); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an Initialization Heuristics Instance from the set of Heuristics Parameters - * - * @param iDeterminant Initialization Heuristics Instance Type - * @param dblSearchStartLeft Hard Search Start Left Edge - * @param dblSearchStartRight Hard Search Start Right Edge - * @param dblStartingBracketLeft Starting Soft Left Bracketing Edge Hint - * @param dblStartingBracketRight Starting Soft Right Bracketing Edge Hint - * @param dblStartingBracketMid Starting Soft Right Bracketing Mid Hint - * @param dblBracketFloor Starting Hard Left Bracketing Floor - * @param dblBracketCeiling Starting Hard Right Bracketing Ceiling - * @param bcpCustom Custom Bracketing Control Parameters - * - * @throws java.lang.Exception Thrown if the Input Determinant/parameters are unknown/invalid - */ - - public InitializationHeuristics ( - final int iDeterminant, - final double dblSearchStartLeft, - final double dblSearchStartRight, - final double dblStartingBracketLeft, - final double dblStartingBracketRight, - final double dblStartingBracketMid, - final double dblBracketFloor, - final double dblBracketCeiling, - final org.drip.function.r1tor1solver.BracketingControlParams bcpCustom) - throws java.lang.Exception - { - if (BRACKETING_EDGE_HINTS == (_iDeterminant = iDeterminant)) { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblStartingBracketLeft = dblStartingBracketLeft) - || !org.drip.quant.common.NumberUtil.IsValid (_dblStartingBracketRight = - dblStartingBracketRight)) - throw new java.lang.Exception - ("InitializationHeuristics constructor: Invalid BRACKETING_EDGE_HINTS params!"); - } else if (BRACKETING_MID_HINT == _iDeterminant) { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblStartingBracketMid = dblStartingBracketMid)) - throw new java.lang.Exception - ("InitializationHeuristics constructor: Invalid BRACKETING_MID_HINT params!"); - } else if (BRACKETING_FLOOR_CEILING == _iDeterminant) { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblBracketFloor = dblBracketFloor) || - !org.drip.quant.common.NumberUtil.IsValid (_dblBracketCeiling = dblBracketCeiling)) - throw new java.lang.Exception - ("InitializationHeuristics constructor: Invalid BRACKETING_FLOOR_CEILING params!"); - } else if (SEARCH_HARD_BRACKETS == _iDeterminant) { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblSearchStartLeft = dblSearchStartLeft) || - !org.drip.quant.common.NumberUtil.IsValid (_dblSearchStartRight = dblSearchStartRight)) - throw new java.lang.Exception - ("InitializationHeuristics constructor: Invalid SEARCH_HARD_BRACKETS params!"); - } else if (BRACKETING_CUSTOM_BCP == _iDeterminant) { - if (null == (_bcpCustom = bcpCustom)) - throw new java.lang.Exception - ("InitializationHeuristics constructor: Invalid BRACKETING_CUSTOM_BCP params!"); - } else if (BRACKETING_GENERIC_BCP != _iDeterminant) - throw new java.lang.Exception - ("InitializationHeuristics constructor: Invalid BRACKETING_GENERIC_BCP params!"); - } - - /** - * Retrieve the Determinant - * - * @return The Determinant - */ - - public int getDeterminant() - { - return _iDeterminant; - } - - /** - * Retrieve the Hard Left Search Start - * - * @return The Hard Left Search Start - */ - - public double getSearchStartLeft() - { - return _dblSearchStartLeft; - } - - /** - * Retrieve the Hard Right Search Start - * - * @return The Hard Right Search Start - */ - - public double getSearchStartRight() - { - return _dblSearchStartRight; - } - - /** - * Retrieve the Soft Bracket Start Mid - * - * @return The Soft Bracket Start Mid - */ - - public double getStartingBracketMid() - { - return _dblStartingBracketMid; - } - - /** - * Retrieve the Soft Bracket Start Left - * - * @return The Soft Bracket Start Left - */ - - public double getStartingBracketLeft() - { - return _dblStartingBracketLeft; - } - - /** - * Retrieve the Hard Bracket Floor - * - * @return The Hard Bracket Floor - */ - - public double getBracketFloor() - { - return _dblBracketFloor; - } - - /** - * Retrieve the Soft Bracket Start Right - * - * @return The Soft Bracket Start Right - */ - - public double getStartingBracketRight() - { - return _dblStartingBracketRight; - } - - /** - * Retrieve the Hard Bracket Ceiling - * - * @return The Hard Bracket Ceiling - */ - - public double getBracketCeiling() - { - return _dblBracketCeiling; - } - - /** - * Retrieve the Custom BCP - * - * @return The Custom BCP - */ - - public org.drip.function.r1tor1solver.BracketingControlParams getCustomBCP() - { - return _bcpCustom; - } -} diff --git a/org/drip/function/r1tor1solver/IteratedBracket.java b/org/drip/function/r1tor1solver/IteratedBracket.java deleted file mode 100644 index 9eb9dbb..0000000 --- a/org/drip/function/r1tor1solver/IteratedBracket.java +++ /dev/null @@ -1,201 +0,0 @@ - -package org.drip.function.r1tor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * IteratedBracket holds the left/right bracket variates and the corresponding values for the objective - * function during each iteration. - * - * @author Lakshmi Krishnamurthy - */ - -public class IteratedBracket { - private double _dblOFLeft = java.lang.Double.NaN; - private double _dblOFRight = java.lang.Double.NaN; - private double _dblVariateLeft = java.lang.Double.NaN; - private double _dblVariateRight = java.lang.Double.NaN; - - /** - * BracketingVariateIterator constructor - * - * @param bop Bracketing Output - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public IteratedBracket ( - final org.drip.function.r1tor1solver.BracketingOutput bop) - throws java.lang.Exception - { - if (null == bop) throw new java.lang.Exception ("IteratedBracket constructor: Invalid inputs"); - - _dblOFLeft = bop.getOFLeft(); - - _dblOFRight = bop.getOFRight(); - - _dblVariateLeft = bop.getVariateLeft(); - - _dblVariateRight = bop.getVariateRight(); - } - - /** - * Retrieve the left variate - * - * @return Left Variate - */ - - public double getVariateLeft() - { - return _dblVariateLeft; - } - - /** - * Set the left variate - * - * @param dblVariateLeft Left Variate - * - * @return TRUE - Left Variate set successfully - */ - - public boolean setVariateLeft ( - final double dblVariateLeft) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariateLeft)) return false; - - _dblVariateLeft = dblVariateLeft; - return true; - } - - /** - * Retrieve the right variate - * - * @return Right Variate - */ - - public double getVariateRight() - { - return _dblVariateRight; - } - - /** - * Set the right variate - * - * @param dblVariateRight Right Variate - * - * @return TRUE - Right Variate set successfully - */ - - public boolean setVariateRight ( - final double dblVariateRight) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariateRight)) return false; - - _dblVariateRight = dblVariateRight; - return true; - } - - /** - * Retrieve the left objective function value - * - * @return Left Objective Function Value - */ - - public double getOFLeft() - { - return _dblOFLeft; - } - - /** - * Set the left objective function value - * - * @param dblOFLeft Left Objective Function Value - * - * @return TRUE - Left Objective Function set successfully - */ - - public boolean setOFLeft ( - final double dblOFLeft) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblOFLeft)) return false; - - _dblOFLeft = dblOFLeft; - return true; - } - - /** - * Retrieve the right objective function value - * - * @return Right objective function value - */ - - public double getOFRight() - { - return _dblOFRight; - } - - /** - * Set the right objective function value - * - * @param dblOFRight Right Objective Function Value - * - * @return TRUE - Right Objective Function set successfully - */ - - public boolean setOFRight ( - final double dblOFRight) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblOFRight)) return false; - - _dblOFRight = dblOFRight; - return true; - } -} diff --git a/org/drip/function/r1tor1solver/IteratedVariate.java b/org/drip/function/r1tor1solver/IteratedVariate.java deleted file mode 100644 index db0b5bf..0000000 --- a/org/drip/function/r1tor1solver/IteratedVariate.java +++ /dev/null @@ -1,140 +0,0 @@ - -package org.drip.function.r1tor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * IteratedVariate holds the variate and the corresponding value for the objective function during each - * iteration. - * - * @author Lakshmi Krishnamurthy - */ - -public class IteratedVariate { - private double _dblOF = java.lang.Double.NaN; - private double _dblVariate = java.lang.Double.NaN; - - /** - * IteratedVariate constructor - * - * @param eiop Execution Initialization Output - * @param dblOF Objective Function Value - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public IteratedVariate ( - final org.drip.function.r1tor1solver.ExecutionInitializationOutput eiop, - final double dblOF) - throws java.lang.Exception - { - if (null == eiop || !org.drip.quant.common.NumberUtil.IsValid (_dblOF = dblOF)) - throw new java.lang.Exception ("IteratedVariate constructor: Invalid Inputs"); - - _dblVariate = eiop.getStartingVariate(); - } - - /** - * Retrieve the variate - * - * @return Variate - */ - - public double getVariate() - { - return _dblVariate; - } - - /** - * Set the variate - * - * @param dblVariate Variate - * - * @return TRUE - Variate set successfully - */ - - public boolean setVariate ( - final double dblVariate) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate)) return false; - - _dblVariate = dblVariate; - return true; - } - - /** - * Retrieve the Objective Function Value - * - * @return The Objective Function Value - */ - - public double getOF() - { - return _dblOF; - } - - /** - * Set the Objective Function Value - * - * @param dblOF Objective Function Value - * - * @return TRUE - Objective Function Value set successfully - */ - - public boolean setOF ( - final double dblOF) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblOF)) return false; - - _dblOF = dblOF; - return true; - } -} diff --git a/org/drip/function/r1tor1solver/VariateIterationSelectorParams.java b/org/drip/function/r1tor1solver/VariateIterationSelectorParams.java deleted file mode 100644 index e60da7c..0000000 --- a/org/drip/function/r1tor1solver/VariateIterationSelectorParams.java +++ /dev/null @@ -1,153 +0,0 @@ - -package org.drip.function.r1tor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * VariateIterationSelectorParams implements the control parameters for the compound variate selector scheme - * used in Brent's method. - * - * Brent's method uses the following fields in VariateIterationSelectorParams to generate the next variate: - * - The Variate Primitive that is regarded as the "fast" method - * - The Variate Primitive that is regarded as the "robust" method - * - The relative variate shift that determines when the "robust" method is to be invoked over the "fast" - * - The lower bound on the variate shift between iterations that serves as the fall-back to the "robust" - * - * @author Lakshmi Krishnamurthy - */ - -public class VariateIterationSelectorParams { - private int _iFastIteratorPrimitive = -1; - private int _iRobustIteratorPrimitive = -1; - private double _dblRelativeVariateShift = java.lang.Double.NaN; - private double _dblVariateShiftLowerBound = java.lang.Double.NaN; - - /** - * Default VariateIterationSelectorParams constructor - */ - - public VariateIterationSelectorParams() - { - _dblRelativeVariateShift = 0.5; - _dblVariateShiftLowerBound = 0.01; - _iRobustIteratorPrimitive = org.drip.function.r1tor1solver.VariateIteratorPrimitive.BISECTION; - _iFastIteratorPrimitive = - org.drip.function.r1tor1solver.VariateIteratorPrimitive.INVERSE_QUADRATIC_INTERPOLATION; - } - - /** - * VariateIterationSelectorParams constructor - * - * @param dblRelativeVariateShift Relative Variate Shift - * @param dblVariateShiftLowerBound Variant Shift Lower Bound - * @param iFastIteratorPrimitive Fast Iterator Primitive - * @param iRobustIteratorPrimitive Robust Iterator Primitive - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public VariateIterationSelectorParams ( - final double dblRelativeVariateShift, - final double dblVariateShiftLowerBound, - final int iFastIteratorPrimitive, - final int iRobustIteratorPrimitive) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblRelativeVariateShift = dblRelativeVariateShift) || - !org.drip.quant.common.NumberUtil.IsValid (_dblVariateShiftLowerBound = - dblVariateShiftLowerBound)) - throw new java.lang.Exception ("VariateIterationSelectorParams constructor: Invalid inputs!"); - } - - /** - * Retrieve the relative variate Shift - * - * @return Relative variate Shift - */ - - public double getRelativeVariateShift() - { - return _dblRelativeVariateShift; - } - - /** - * Retrieve the Variate Shift lower bound - * - * @return Variate Shift lower bound - */ - - public double getVariateShiftLowerBound() - { - return _dblVariateShiftLowerBound; - } - - /** - * Retrieve the variate iterator primitive meant for speed - * - * @return variate iterator primitive meant for speed - */ - - public int getFastVariateIteratorPrimitive() - { - return _iFastIteratorPrimitive; - } - - /** - * Retrieve the variate iterator primitive meant for robustness - * - * @return variate iterator primitive meant for robustness - */ - - public int getRobustVariateIteratorPrimitive() - { - return _iRobustIteratorPrimitive; - } -} diff --git a/org/drip/function/r1tor1solver/VariateIteratorPrimitive.java b/org/drip/function/r1tor1solver/VariateIteratorPrimitive.java deleted file mode 100644 index 88f0bfb..0000000 --- a/org/drip/function/r1tor1solver/VariateIteratorPrimitive.java +++ /dev/null @@ -1,406 +0,0 @@ - -package org.drip.function.r1tor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * VariateIteratorPrimitive implements the various Primitive Variate Iterator routines. - * - * VariateIteratorPrimitive implements the following iteration primitives: - * - Bisection - * - False Position - * - Quadratic - * - Inverse Quadratic - * - Ridder - * - * It may be readily enhanced to accommodate additional primitives. - * - * @author Lakshmi Krishnamurthy - */ - -public class VariateIteratorPrimitive { - - /** - * Bisection - */ - - public static int BISECTION = 0; - - /** - * False Position - */ - - public static int FALSE_POSITION = 1; - - /** - * Quadratic Interpolation - */ - - public static int QUADRATIC_INTERPOLATION = 2; - - /** - * Inverse Quadratic Interpolation - */ - - public static int INVERSE_QUADRATIC_INTERPOLATION = 3; - - /** - * Ridder's Method - */ - - public static int RIDDER = 4; - - /** - * Iterate for the next variate using bisection - * - * @param dblX1 Left variate - * @param dblX2 Right variate - * - * @return The next variate - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public static final double Bisection ( - final double dblX1, - final double dblX2) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX1) || !org.drip.quant.common.NumberUtil.IsValid - (dblX2)) - throw new java.lang.Exception ("VariateIteratorPrimitive::Bisection => Invalid inputs " + dblX2); - - return 0.5 * (dblX1 + dblX2); - } - - /** - * Iterate for the next variate using false position - * - * @param dblX1 Left variate - * @param dblX2 Right variate - * @param dblY1 Left OF value - * @param dblY2 Right OF value - * - * @return The next variate - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public static final double FalsePosition ( - final double dblX1, - final double dblX2, - final double dblY1, - final double dblY2) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX1) || !org.drip.quant.common.NumberUtil.IsValid - (dblX2) || !org.drip.quant.common.NumberUtil.IsValid (dblY1) || - !org.drip.quant.common.NumberUtil.IsValid (dblY2)) - throw new java.lang.Exception ("VariateIteratorPrimitive::FalsePosition => Invalid inputs"); - - return dblX1 + ((dblX1 - dblX2) / (dblY2 - dblY1) * dblY1); - } - - /** - * Iterate for the next variate using quadratic interpolation - * - * @param dblX1 Left variate - * @param dblX2 Intermediate variate - * @param dblX3 Right variate - * @param dblY1 Left OF value - * @param dblY2 Intermediate OF value - * @param dblY3 Right OF value - * - * @return The next variate - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public static final double QuadraticInterpolation ( - final double dblX1, - final double dblX2, - final double dblX3, - final double dblY1, - final double dblY2, - final double dblY3) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX1) || !org.drip.quant.common.NumberUtil.IsValid - (dblX2) || !org.drip.quant.common.NumberUtil.IsValid (dblX3) || - !org.drip.quant.common.NumberUtil.IsValid (dblY1) || !org.drip.quant.common.NumberUtil.IsValid - (dblY2) || !org.drip.quant.common.NumberUtil.IsValid (dblY3)) - throw new java.lang.Exception - ("VariateIteratorPrimitive.QuadraticInterpolation => Invalid inputs!"); - - double dblA = dblY1 / (dblX1 - dblX2) / (dblX1 - dblX3); - dblA += dblY2 / (dblX2 - dblX3) / (dblX2 - dblX1); - dblA += dblY3 / (dblX3 - dblX1) / (dblX3 - dblX2); - double dblB = -1. * (dblX2 + dblX3) * dblY1 / (dblX1 - dblX2) / (dblX1 - dblX3); - dblB -= (dblX3 + dblX1) * dblY2 / (dblX2 - dblX3) / (dblX2 - dblX1); - dblB -= (dblX1 + dblX2) * dblY3 / (dblX3 - dblX1) / (dblX3 - dblX2); - double dblC = dblX2 * dblX3 * dblY1 / (dblX1 - dblX2) / (dblX1 - dblX3); - dblC += dblX3 * dblX1 * dblY2 / (dblX2 - dblX3) / (dblX2 - dblX1); - dblC += dblX1 * dblX2 * dblY3 / (dblX3 - dblX1) / (dblX3 - dblX2); - double dblSQRTArg = dblB * dblB - 4. * dblA * dblC; - - if (0. > dblSQRTArg) - throw new java.lang.Exception - ("VariateIteratorPrimitive.QuadraticInterpolation => No real roots!"); - - double dblSQRT = java.lang.Math.sqrt (dblSQRTArg); - - double dblRoot1 = (-1. * dblB + dblSQRT) / 2. / dblA; - double dblRoot2 = (-1. * dblB - dblSQRT) / 2. / dblA; - - if (dblX1 > dblRoot1 || dblX3 < dblRoot1) return dblRoot2; - - if (dblX1 > dblRoot2 || dblX3 < dblRoot2) return dblRoot1; - - return java.lang.Math.abs (dblX2 - dblRoot1) < java.lang.Math.abs (dblX2 - dblRoot2) ? dblRoot1 : - dblRoot2; - } - - /** - * Iterate for the next variate using inverse quadratic interpolation - * - * @param dblX1 Left variate - * @param dblX2 Intermediate variate - * @param dblX3 Right variate - * @param dblY1 Left OF value - * @param dblY2 Intermediate OF value - * @param dblY3 Right OF value - * - * @return The next variate - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public static final double InverseQuadraticInterpolation ( - final double dblX1, - final double dblX2, - final double dblX3, - final double dblY1, - final double dblY2, - final double dblY3) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX1) || !org.drip.quant.common.NumberUtil.IsValid - (dblX2) || !org.drip.quant.common.NumberUtil.IsValid (dblX3) || - !org.drip.quant.common.NumberUtil.IsValid (dblY1) || !org.drip.quant.common.NumberUtil.IsValid - (dblY2) || !org.drip.quant.common.NumberUtil.IsValid (dblY3)) - throw new java.lang.Exception - ("VariateIteratorPrimitive.InverseQuadraticInterpolation => Invalid inputs!"); - - double dblNextRoot = (dblY2 * dblY3 * dblX1 / (dblY1 - dblY2) / (dblY1 - dblY3)); - dblNextRoot += (dblY3 * dblY1 * dblX2 / (dblY2 - dblY3) / (dblY2 - dblY1)); - dblNextRoot += (dblY1 * dblY2 * dblX3 / (dblY3 - dblY1) / (dblY3 - dblY2)); - return dblNextRoot; - } - - /** - * Iterate for the next variate using Ridder's method - * - * @param dblX1 Left variate - * @param dblX2 Intermediate variate - * @param dblX3 Right variate - * @param dblY1 Left OF value - * @param dblY2 Intermediate OF value - * @param dblY3 Right OF value - * - * @return The next variate - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public static final double Ridder ( - final double dblX1, - final double dblX2, - final double dblX3, - final double dblY1, - final double dblY2, - final double dblY3) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX1) || !org.drip.quant.common.NumberUtil.IsValid - (dblX2) || !org.drip.quant.common.NumberUtil.IsValid (dblX3) || - !org.drip.quant.common.NumberUtil.IsValid (dblY1) || !org.drip.quant.common.NumberUtil.IsValid - (dblY2) || !org.drip.quant.common.NumberUtil.IsValid (dblY3)) - throw new java.lang.Exception ("VariateIteratorPrimitive.Ridder => Invalid inputs!"); - - double dblSQRTArg = dblY3 * dblY3 - dblY1 * dblY2; - - if (0. > dblSQRTArg) - throw new java.lang.Exception ("VariateIteratorPrimitive.Ridder => No real roots!"); - - return dblX3 + (dblX3 - dblX1) * dblY3 * java.lang.Math.signum (dblY1 - dblY2) / java.lang.Math.sqrt - (dblSQRTArg); - } - - /** - * Iterate for the next variate using the multi-function method - * - * @param dblX1 Left variate - * @param dblX2 Intermediate variate - * @param dblX3 Right variate - * @param dblY1 Left OF value - * @param dblY2 Intermediate OF value - * @param dblY3 Right OF value - * @param of Objective Function - * @param dblOFTarget OF Target - * @param rfop Root Finder Output - * - * @return The next variate - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public static final double MultiFunction ( - final double dblX1, - final double dblX2, - final double dblX3, - final double dblY1, - final double dblY2, - final double dblY3, - final org.drip.function.definition.R1ToR1 of, - final double dblOFTarget, - final org.drip.function.r1tor1solver.FixedPointFinderOutput rfop) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX1) || !org.drip.quant.common.NumberUtil.IsValid - (dblX2) || !org.drip.quant.common.NumberUtil.IsValid (dblX3) || - !org.drip.quant.common.NumberUtil.IsValid (dblY1) || !org.drip.quant.common.NumberUtil.IsValid - (dblY2) || !org.drip.quant.common.NumberUtil.IsValid (dblY3) || - !org.drip.quant.common.NumberUtil.IsValid (dblOFTarget) || null == rfop || null == of) - throw new java.lang.Exception ("VariateIteratorPrimitive.MultiFunction => Invalid inputs!"); - - double dblNextRoot = Bisection (dblX1, dblX2); - - if (!rfop.incrOFCalcs()) - throw new java.lang.Exception - ("VariateIteratorPrimitive.MultiFunction => Cannot increment rfop!"); - - double dblTargetDiff = java.lang.Math.abs (of.evaluate (dblNextRoot) - dblOFTarget); - - try { - double dblRootSecant = FalsePosition (dblX1, dblX2, dblY1, dblY2); - - if (!rfop.incrOFCalcs()) - throw new java.lang.Exception - ("VariateIteratorPrimitive.MultiFunction => Cannot increment rfop!"); - - double dblTargetDiffSecant = java.lang.Math.abs (of.evaluate (dblRootSecant) - dblOFTarget); - - if (dblTargetDiffSecant < dblTargetDiff) { - dblNextRoot = dblRootSecant; - dblTargetDiff = dblTargetDiffSecant; - } - } catch (java.lang.Exception e) { - // e.printStackTrace(); - } - - try { - double dblRootQuadraticInterpolation = QuadraticInterpolation (dblX1, dblX2, dblX3, dblY1, dblY2, - dblY3); - - if (!rfop.incrOFCalcs()) - throw new java.lang.Exception - ("VariateIteratorPrimitive.MultiFunction => Cannot increment rfop!"); - - double dblTargetDiffQuadraticInterpolation = java.lang.Math.abs (of.evaluate - (dblRootQuadraticInterpolation) - dblOFTarget); - - if (dblTargetDiffQuadraticInterpolation < dblTargetDiff) { - dblNextRoot = dblRootQuadraticInterpolation; - dblTargetDiff = dblTargetDiffQuadraticInterpolation; - } - } catch (java.lang.Exception e) { - // e.printStackTrace(); - } - - try { - double dblRootInverseQuadraticInterpolation = QuadraticInterpolation (dblX1, dblX2, dblX3, dblY1, - dblY2, dblY3); - - if (!rfop.incrOFCalcs()) - throw new java.lang.Exception - ("VariateIteratorPrimitive.MultiFunction => Cannot increment rfop!"); - - double dblTargetDiffInverseQuadraticInterpolation = java.lang.Math.abs (of.evaluate - (dblRootInverseQuadraticInterpolation) - dblOFTarget); - - if (dblTargetDiffInverseQuadraticInterpolation < dblTargetDiff) { - dblNextRoot = dblRootInverseQuadraticInterpolation; - dblTargetDiff = dblTargetDiffInverseQuadraticInterpolation; - } - } catch (java.lang.Exception e) { - // e.printStackTrace(); - } - - try { - double dblRootRidder = Ridder (dblX1, dblX2, dblX3, dblY1, dblY2, dblY3); - - if (!rfop.incrOFCalcs()) - throw new java.lang.Exception - ("VariateIteratorPrimitive.MultiFunction => Cannot increment rfop!"); - - double dblTargetDiffRidder = java.lang.Math.abs (of.evaluate (dblRootRidder) - dblOFTarget); - - if (dblTargetDiffRidder < dblTargetDiff) { - dblNextRoot = dblRootRidder; - dblTargetDiff = dblTargetDiffRidder; - } - } catch (java.lang.Exception e) { - // e.printStackTrace(); - } - - return dblNextRoot; - } -} diff --git a/org/drip/function/rdtor1/AffineBoundMultivariate.java b/org/drip/function/rdtor1/AffineBoundMultivariate.java deleted file mode 100644 index 4c93eb5..0000000 --- a/org/drip/function/rdtor1/AffineBoundMultivariate.java +++ /dev/null @@ -1,162 +0,0 @@ - -package org.drip.function.rdtor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AffineBoundMultivariate implements a Bounded Planar Linear R^d To R^1 Function. - * - * @author Lakshmi Krishnamurthy - */ - -public class AffineBoundMultivariate extends org.drip.function.definition.RdToR1 implements - org.drip.function.rdtor1.BoundMultivariate, org.drip.function.rdtor1.ConvexMultivariate { - private boolean _bIsUpper = false; - private int _iNumTotalVariate = -1; - private int _iBoundVariateIndex = -1; - private double _dblBoundValue = java.lang.Double.NaN; - - /** - * AffineBoundMultivariate Constructor - * - * @param bIsUpper TRUE To The Bound is an Upper Bound - * @param iBoundVariateIndex The Bound Variate Index - * @param iNumTotalVariate The Total Number of Variates - * @param dblBoundValue The Bounding Value - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public AffineBoundMultivariate ( - final boolean bIsUpper, - final int iBoundVariateIndex, - final int iNumTotalVariate, - final double dblBoundValue) - throws java.lang.Exception - { - super (null); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblBoundValue = dblBoundValue) || 0 == - (_iNumTotalVariate = iNumTotalVariate) || _iNumTotalVariate <= (_iBoundVariateIndex = - iBoundVariateIndex)) - throw new java.lang.Exception ("AffineBoundMultivariate Constructor => Invalid Inputs"); - - _bIsUpper = bIsUpper; - } - - @Override public boolean isUpper() - { - return _bIsUpper; - } - - @Override public int boundVariateIndex() - { - return _iBoundVariateIndex; - } - - @Override public double boundValue() - { - return _dblBoundValue; - } - - @Override public boolean violated ( - final double dblVariate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate)) - throw new java.lang.Exception ("AffineBoundMultivariate::violated => Invalid Inputs"); - - if (_bIsUpper && dblVariate > _dblBoundValue) return true; - - if (!_bIsUpper && dblVariate < _dblBoundValue) return true; - - return false; - } - - @Override public int dimension() - { - return _iNumTotalVariate; - } - - @Override public double evaluate ( - final double[] adblVariate) - throws java.lang.Exception - { - if (null == adblVariate || !org.drip.quant.common.NumberUtil.IsValid (adblVariate) || - adblVariate.length != dimension()) - throw new java.lang.Exception ("AffineBoundMultivariate::evaluate => Invalid Inputs"); - - return _bIsUpper ? _dblBoundValue - adblVariate[_iBoundVariateIndex] : - adblVariate[_iBoundVariateIndex] - _dblBoundValue; - } - - @Override public double[] jacobian ( - final double[] adblVariate) - { - double[] adblJacobian = new double[_iNumTotalVariate]; - - for (int i = 0; i < _iNumTotalVariate; ++i) - adblJacobian[i] = i == _iBoundVariateIndex ? (_bIsUpper ? -1. : 1.) : 0.; - - return adblJacobian; - } - - @Override public double[][] hessian ( - final double[] adblVariate) - { - int iDimension = dimension(); - - double[][] aadblHessian = new double[iDimension][iDimension]; - - for (int i = 0; i < iDimension; ++i) { - for (int j = 0; j < iDimension; ++j) - aadblHessian[i][j] = 0.; - } - - return aadblHessian; - } -} diff --git a/org/drip/function/rdtor1/AffineMultivariate.java b/org/drip/function/rdtor1/AffineMultivariate.java deleted file mode 100644 index 438a0e4..0000000 --- a/org/drip/function/rdtor1/AffineMultivariate.java +++ /dev/null @@ -1,149 +0,0 @@ - -package org.drip.function.rdtor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AffineMultivariate implements a Planar Linear R^d To R^1 Function using a Multivariate Vector. - * - * @author Lakshmi Krishnamurthy - */ - -public class AffineMultivariate extends org.drip.function.definition.RdToR1 implements - org.drip.function.rdtor1.ConvexMultivariate { - private double[] _adblCoefficient = null; - private double _dblConstant = java.lang.Double.NaN; - - /** - * AffineMultivariate Constructor - * - * @param adblCoefficient Array of Variate Coefficients - * @param dblConstant The Constant Offset - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public AffineMultivariate ( - final double[] adblCoefficient, - final double dblConstant) - throws java.lang.Exception - { - super (null); - - if (null == (_adblCoefficient = adblCoefficient) || 0 == _adblCoefficient.length || - !org.drip.quant.common.NumberUtil.IsValid (_adblCoefficient) || - !org.drip.quant.common.NumberUtil.IsValid (_dblConstant = dblConstant)) - throw new java.lang.Exception ("AffineMultivariate Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Array of the Coefficients - * - * @return The Array of the Coefficients - */ - - public double[] coefficients() - { - return _adblCoefficient; - } - - /** - * Retrieve the Constant - * - * @return The Constant - */ - - public double constant() - { - return _dblConstant; - } - - @Override public int dimension() - { - return _adblCoefficient.length; - } - - @Override public double evaluate ( - final double[] adblVariate) - throws java.lang.Exception - { - if (null == adblVariate || !org.drip.quant.common.NumberUtil.IsValid (adblVariate)) - throw new java.lang.Exception ("AffineMultivariate::evaluate => Invalid Inputs"); - - double dblValue = 0.; - int iDimension = adblVariate.length; - - if (iDimension != dimension()) - throw new java.lang.Exception ("AffineMultivariate::evaluate => Invalid Inputs"); - - for (int i = 0; i < iDimension; ++i) - dblValue += adblVariate[i] * _adblCoefficient[i]; - - return dblValue + _dblConstant; - } - - @Override public double[] jacobian ( - final double[] adblVariate) - { - return _adblCoefficient; - } - - @Override public double[][] hessian ( - final double[] adblVariate) - { - int iDimension = dimension(); - - double[][] aadblHessian = new double[iDimension][iDimension]; - - for (int i = 0; i < iDimension; ++i) { - for (int j = 0; j < iDimension; ++j) - aadblHessian[i][j] = 0.; - } - - return aadblHessian; - } -} diff --git a/org/drip/function/rdtor1/BoundMultivariate.java b/org/drip/function/rdtor1/BoundMultivariate.java deleted file mode 100644 index f5fac41..0000000 --- a/org/drip/function/rdtor1/BoundMultivariate.java +++ /dev/null @@ -1,95 +0,0 @@ - -package org.drip.function.rdtor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * BoundMultivariate Interface implements R^d To R^1 Bounds. - * - * @author Lakshmi Krishnamurthy - */ - -public interface BoundMultivariate { - - /** - * Retrieve the Bound Type Indicator Flag - * - * @return TRUE - Bound is Upper Type - */ - - public abstract boolean isUpper(); - - /** - * Retrieve the Bound Variate Index - * - * @return The Bound Variate Index - */ - - public abstract int boundVariateIndex(); - - /** - * Retrieve the Bound Value - * - * @return The Bound Value - */ - - public abstract double boundValue(); - - /** - * Indicate if the Specified Bound has been violated by the Variate - * - * @param dblVariate The Variate - * - * @return TRUE - The Bound has been violated - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public abstract boolean violated ( - final double dblVariate) - throws java.lang.Exception; -} diff --git a/org/drip/function/rdtor1/ConvexMultivariate.java b/org/drip/function/rdtor1/ConvexMultivariate.java deleted file mode 100644 index c41569e..0000000 --- a/org/drip/function/rdtor1/ConvexMultivariate.java +++ /dev/null @@ -1,70 +0,0 @@ - -package org.drip.function.rdtor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ConvexMultivariate is a Shell Interface that "typifies" a Convex R^d To R^1. The References are: - * - * - Boyd, S., and L. van den Berghe (2009): Convex Optimization, Cambridge University Press, Cambridge UK. - * - * - Eustaquio, R., E. Karas, and A. Ribeiro (2008): Constraint Qualification for Nonlinear Programming, - * Technical Report, Federal University of Parana. - * - * - Karush, A. (1939): Minima of Functions of Several Variables with Inequalities as Side Constraints, - * M. Sc., University of Chicago, Chicago IL. - * - * - Kuhn, H. W., and A. W. Tucker (1951): Nonlinear Programming, Proceedings of the Second Berkeley - * Symposium, University of California, Berkeley CA 481-492. - * - * - Ruszczynski, A. (2006): Nonlinear Optimization, Princeton University Press, Princeton NJ. - * - * @author Lakshmi Krishnamurthy - */ - -public interface ConvexMultivariate { -} diff --git a/org/drip/function/rdtor1/CovarianceEllipsoidMultivariate.java b/org/drip/function/rdtor1/CovarianceEllipsoidMultivariate.java deleted file mode 100644 index 01178ec..0000000 --- a/org/drip/function/rdtor1/CovarianceEllipsoidMultivariate.java +++ /dev/null @@ -1,167 +0,0 @@ - -package org.drip.function.rdtor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CovarianceEllipsoidMultivariate implements an R^d To R^1 Co-variance Estimate of the specified - * Distribution. - * - * @author Lakshmi Krishnamurthy - */ - -public class CovarianceEllipsoidMultivariate extends org.drip.function.definition.RdToR1 { - private double[][] _aadblCovarianceMatrix = null; - - /** - * CovarianceEllipsoidMultivariate Constructor - * - * @param aadblCovarianceMatrix The Covariance Matrix - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CovarianceEllipsoidMultivariate ( - final double[][] aadblCovarianceMatrix) - throws java.lang.Exception - { - super (null); - - if (null == (_aadblCovarianceMatrix = aadblCovarianceMatrix)) - throw new java.lang.Exception ("CovarianceEllipsoidMultivariate Constructor => Invalid Inputs"); - - int iSize = _aadblCovarianceMatrix.length; - - if (0 == iSize) - throw new java.lang.Exception ("CovarianceEllipsoidMultivariate Constructor => Invalid Inputs"); - - for (int i = 0; i < iSize; ++i) { - if (null == _aadblCovarianceMatrix[i] || iSize != _aadblCovarianceMatrix[i].length || - !org.drip.quant.common.NumberUtil.IsValid (_aadblCovarianceMatrix[i])) - throw new java.lang.Exception - ("CovarianceEllipsoidMultivariate Constructor => Invalid Inputs"); - } - } - - /** - * Retrieve the Input Variate Dimension - * - * @return The Input Variate Dimension - */ - - public int dimension() - { - return _aadblCovarianceMatrix.length; - } - - /** - * Retrieve the Co-variance Matrix - * - * @return The Co-variance Matrix - */ - - public double[][] covariance() - { - return _aadblCovarianceMatrix; - } - - @Override public double evaluate ( - final double[] adblVariate) - throws java.lang.Exception - { - if (null == adblVariate || !org.drip.quant.common.NumberUtil.IsValid (adblVariate)) - throw new java.lang.Exception ("CovarianceEllipsoidMultivariate::evaluate => Invalid Inputs"); - - double dblCovariance = 0.; - int iDimension = adblVariate.length; - - if (iDimension != dimension()) - throw new java.lang.Exception ("CovarianceEllipsoidMultivariate::evaluate => Invalid Inputs"); - - for (int i = 0; i < iDimension; ++i) { - for (int j = 0; j < iDimension; ++j) - dblCovariance += adblVariate[i] * _aadblCovarianceMatrix[i][j] * adblVariate[j]; - } - - return dblCovariance; - } - - @Override public double[] jacobian ( - final double[] adblVariate) - { - if (null == adblVariate || !org.drip.quant.common.NumberUtil.IsValid (adblVariate)) return null; - - int iDimension = adblVariate.length; - double[] adblJacobian = new double[iDimension]; - - if (iDimension != dimension()) return null; - - for (int i = 0; i < iDimension; ++i) { - adblJacobian[i] = 0.; - - for (int j = 0; j < iDimension; ++j) - adblJacobian[i] += 2. * _aadblCovarianceMatrix[i][j] * adblVariate[j]; - } - - return adblJacobian; - } - - @Override public double[][] hessian ( - final double[] adblVariate) - { - int iDimension = dimension(); - - double[][] aadblHessian = new double[iDimension][iDimension]; - - for (int i = 0; i < iDimension; ++i) { - for (int j = 0; j < iDimension; ++j) - aadblHessian[i][j] += 2. * _aadblCovarianceMatrix[i][j]; - } - - return aadblHessian; - } -} diff --git a/org/drip/function/rdtor1/LagrangianMultivariate.java b/org/drip/function/rdtor1/LagrangianMultivariate.java deleted file mode 100644 index b497245..0000000 --- a/org/drip/function/rdtor1/LagrangianMultivariate.java +++ /dev/null @@ -1,284 +0,0 @@ - -package org.drip.function.rdtor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * LagrangianMultivariate implements an R^d To R^1 Multivariate Function along with the specified Set of - * Equality Constraints. - * - * @author Lakshmi Krishnamurthy - */ - -public class LagrangianMultivariate extends org.drip.function.definition.RdToR1 { - private org.drip.function.definition.RdToR1 _RdToR1Objective = null; - private org.drip.function.definition.RdToR1[] _aRdToR1EqualityConstraint = null; - - /** - * LagrangianMultivariate Constructor - * - * @param RdToR1Objective The Objective Function - * @param aRdToR1EqualityConstraint Array of Equality Constraint Functions - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public LagrangianMultivariate ( - final org.drip.function.definition.RdToR1 RdToR1Objective, - final org.drip.function.definition.RdToR1[] aRdToR1EqualityConstraint) - throws java.lang.Exception - { - super (null); - - if (null == (_RdToR1Objective = RdToR1Objective)) - throw new java.lang.Exception ("LagrangianMultivariate Constructor => Invalid Inputs"); - - _aRdToR1EqualityConstraint = aRdToR1EqualityConstraint; - } - - /** - * Retrieve the Objective R^d To R^1 Function Instance - * - * @return The Objective R^d To R^1 Function Instance - */ - - public org.drip.function.definition.RdToR1 objectiveFunction() - { - return _RdToR1Objective; - } - - /** - * Retrieve the Array of the Constraint R^d To R^1 Function Instances - * - * @return The Array of Constraint R^d To R^1 Function Instances - */ - - public org.drip.function.definition.RdToR1[] constraintFunctions() - { - return _aRdToR1EqualityConstraint; - } - - /** - * Retrieve the Objective Function Dimension - * - * @return The Objective Function Dimension - */ - - public int objectiveFunctionDimension() - { - return _RdToR1Objective.dimension(); - } - - /** - * Retrieve the Constraint Function Dimension - * - * @return The Constraint Function Dimension - */ - - public int constraintFunctionDimension() - { - return null == _aRdToR1EqualityConstraint ? 0 : _aRdToR1EqualityConstraint.length; - } - - @Override public int dimension() - { - return objectiveFunctionDimension() + constraintFunctionDimension(); - } - - @Override public double evaluate ( - final double[] adblVariate) - throws java.lang.Exception - { - org.drip.function.rdtor1.ObjectiveConstraintVariateSet ocvs = - org.drip.function.rdtor1.ObjectiveConstraintVariateSet.Partition (adblVariate, - objectiveFunctionDimension()); - - if (null == ocvs) - throw new java.lang.Exception ("LagrangianMultivariate::evaluate => Invalid Inputs"); - - double[] adblConstraintVariate = ocvs.constraintVariates(); - - double[] adblObjectiveVariate = ocvs.objectiveVariates(); - - int iNumConstraint = adblConstraintVariate.length; - - double dblValue = _RdToR1Objective.evaluate (adblObjectiveVariate); - - for (int i = 0; i < iNumConstraint; ++i) - dblValue += adblConstraintVariate[i] * _aRdToR1EqualityConstraint[i].evaluate - (adblObjectiveVariate); - - return dblValue; - } - - @Override public double[] jacobian ( - final double[] adblVariate) - { - int iObjectiveDimension = objectiveFunctionDimension(); - - int iConstraintDimension = constraintFunctionDimension(); - - double[] adblObjectiveVariate = null; - double[] adblConstraintVariate = null; - double[][] aadblConstraintJacobian = null; - double[] adblJacobian = new double[iObjectiveDimension + iConstraintDimension]; - - if (0 == iConstraintDimension) - adblObjectiveVariate = adblVariate; - else { - org.drip.function.rdtor1.ObjectiveConstraintVariateSet ocvs = - org.drip.function.rdtor1.ObjectiveConstraintVariateSet.Partition (adblVariate, - iObjectiveDimension); - - if (null == ocvs) return null; - - adblObjectiveVariate = ocvs.objectiveVariates(); - - adblConstraintVariate = ocvs.constraintVariates(); - } - - double[] adblObjectiveJacobian = _RdToR1Objective.jacobian (adblObjectiveVariate); - - if (null == adblObjectiveJacobian) return null; - - if (0 != iConstraintDimension) aadblConstraintJacobian = new double[iConstraintDimension][]; - - for (int i = 0; i < iConstraintDimension; ++i) { - if (null == (aadblConstraintJacobian[i] = _aRdToR1EqualityConstraint[i].jacobian - (adblObjectiveVariate))) - return null; - - try { - adblJacobian[iObjectiveDimension + i] = _aRdToR1EqualityConstraint[i].evaluate - (adblObjectiveVariate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - for (int i = 0; i < iObjectiveDimension; ++i) { - adblJacobian[i] = adblObjectiveJacobian[i]; - - for (int j = 0; j < iConstraintDimension; ++j) - adblJacobian[i] += adblConstraintVariate[j] * aadblConstraintJacobian[j][i]; - } - - return adblJacobian; - } - - @Override public double[][] hessian ( - final double[] adblVariate) - { - int iObjectiveDimension = objectiveFunctionDimension(); - - int iConstraintDimension = constraintFunctionDimension(); - - double[] adblObjectiveVariate = null; - double[] adblConstraintVariate = null; - - if (0 == iConstraintDimension) - adblObjectiveVariate = adblVariate; - else { - org.drip.function.rdtor1.ObjectiveConstraintVariateSet ocvs = - org.drip.function.rdtor1.ObjectiveConstraintVariateSet.Partition (adblVariate, - iObjectiveDimension); - - if (null == ocvs) return null; - - adblObjectiveVariate = ocvs.objectiveVariates(); - - adblConstraintVariate = ocvs.constraintVariates(); - } - - double[][] aadblObjectiveHessian = _RdToR1Objective.hessian (adblObjectiveVariate); - - double[][] aadblConstraintJacobian = null; - double[][][] aaadblConstraintHessian = null; - int iDimension = iObjectiveDimension + iConstraintDimension; - double[][] aadblHessian = new double[iDimension][iDimension]; - - if (0 != iConstraintDimension) { - aadblConstraintJacobian = new double[iConstraintDimension][]; - aaadblConstraintHessian = new double[iConstraintDimension][][]; - } - - for (int i = 0; i < iConstraintDimension; ++i) { - if (null == (aaadblConstraintHessian[i] = _aRdToR1EqualityConstraint[i].hessian - (adblObjectiveVariate))) - return null; - } - - for (int i = 0; i < iObjectiveDimension; ++i) { - for (int j = 0; j < iObjectiveDimension; ++j) { - aadblHessian[i][j] = aadblObjectiveHessian[i][j]; - - for (int k = 0; k < iConstraintDimension; ++k) - aadblHessian[i][j] += adblConstraintVariate[k] * aaadblConstraintHessian[k][i][j]; - } - } - - for (int i = 0; i < iConstraintDimension; ++i) { - for (int j = 0; j < iConstraintDimension; ++j) - aadblHessian[i + iObjectiveDimension][j + iObjectiveDimension] = 0.; - - if (null == (aadblConstraintJacobian[i] = _aRdToR1EqualityConstraint[i].jacobian - (adblObjectiveVariate))) - return null; - } - - for (int i = 0; i < iConstraintDimension; ++i) { - for (int j = 0; j < iObjectiveDimension; ++j) { - aadblHessian[iObjectiveDimension + i][j] = aadblConstraintJacobian[i][j]; - aadblHessian[j][iObjectiveDimension + i] = aadblConstraintJacobian[i][j]; - } - } - - return aadblHessian; - } -} diff --git a/org/drip/function/rdtor1/ObjectiveConstraintVariateSet.java b/org/drip/function/rdtor1/ObjectiveConstraintVariateSet.java deleted file mode 100644 index 718867d..0000000 --- a/org/drip/function/rdtor1/ObjectiveConstraintVariateSet.java +++ /dev/null @@ -1,238 +0,0 @@ - -package org.drip.function.rdtor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ObjectiveConstraintVariateSet holds the R^d and R^1 Variates corresponding to the Objective Function and - * the Constraint Function respectively. - * - * @author Lakshmi Krishnamurthy - */ - -public class ObjectiveConstraintVariateSet { - private double[] _adblObjectiveVariate = null; - private double[] _adblConstraintVariate = null; - - /** - * Make a Unitary Variate Set - * - * @param iNumVariate Number of Variates - * - * @return Unitary Variate Set - */ - - public static final double[] Unitary ( - final int iNumVariate) - { - if (0 >= iNumVariate) return null; - - double[] adblVariate = new double[iNumVariate]; - - for (int i = 0; i < iNumVariate; ++i) - adblVariate[i] = 1.; - - return adblVariate; - } - - /** - * Make a Variate Set with/without Constraint - * - * @param iNumObjectiveFunctionVariate Number of the Objective Function Variates - * @param iNumConstraintFunctionVariate Number of the Constraint Function Variates - * - * @return Variate Set with/without Constraint - */ - - public static final double[] Uniform ( - final int iNumObjectiveFunctionVariate, - final int iNumConstraintFunctionVariate) - { - if (0 >= iNumObjectiveFunctionVariate) return null; - - double[] adblVariate = new double[iNumObjectiveFunctionVariate + iNumConstraintFunctionVariate]; - - for (int i = 0; i < iNumObjectiveFunctionVariate; ++i) - adblVariate[i] = 1. / iNumObjectiveFunctionVariate; - - for (int i = 0; i < iNumConstraintFunctionVariate; ++i) - adblVariate[i + iNumObjectiveFunctionVariate] = 0.; - - return adblVariate; - } - - /** - * Make a Variate Set using a Pre-set Objective Variate Array with/without Constraint - * - * @param adblObjectiveFunctionVariate Array of Pre-set Objective Variates - * @param iNumConstraintFunctionVariate Number of the Constraint Function Variates - * - * @return Variate Set using a Pre-set Objective Variate Array with/without Constraint - */ - - public static final double[] Preset ( - final double[] adblObjectiveFunctionVariate, - final int iNumConstraintFunctionVariate) - { - if (null == adblObjectiveFunctionVariate) return null; - - int iNumObjectiveFunctionVariate = adblObjectiveFunctionVariate.length; - - if (0 >= iNumObjectiveFunctionVariate) return null; - - double[] adblVariate = new double[iNumObjectiveFunctionVariate + iNumConstraintFunctionVariate]; - - for (int i = 0; i < iNumObjectiveFunctionVariate; ++i) - adblVariate[i] = adblObjectiveFunctionVariate[i]; - - for (int i = 0; i < iNumConstraintFunctionVariate; ++i) - adblVariate[i + iNumObjectiveFunctionVariate] = 0.; - - return adblVariate; - } - - /** - * Partition the Variate Array into the Objective Function Input Variates and the Constraint Variate - * - * @param adblVariate The Input Variate Array - * @param iNumObjectiveFunctionVariate Number of the Objective Function Variates - * - * @return The ObjectiveConstraintVariateSet Instance - */ - - public static final ObjectiveConstraintVariateSet Partition ( - final double[] adblVariate, - final int iNumObjectiveFunctionVariate) - { - if (null == adblVariate || 0 == iNumObjectiveFunctionVariate) return null; - - int iNumVariate = adblVariate.length; - double[] adblObjectiveVariate = new double[iNumObjectiveFunctionVariate]; - double[] adblConstraintVariate = new double[iNumVariate - iNumObjectiveFunctionVariate]; - - if (iNumObjectiveFunctionVariate >= iNumVariate) return null; - - for (int i = 0; i < iNumObjectiveFunctionVariate; ++i) - adblObjectiveVariate[i] = adblVariate[i]; - - for (int i = iNumObjectiveFunctionVariate; i < iNumVariate; ++i) - adblConstraintVariate[i - iNumObjectiveFunctionVariate] = adblVariate[i]; - - try { - return new ObjectiveConstraintVariateSet (adblObjectiveVariate, adblConstraintVariate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * ObjectiveConstraintVariate Constructor - * - * @param adblObjectiveVariate Array of the Objective Function Variates - * @param adblConstraintVariate Array of the Constraint Function Variates - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ObjectiveConstraintVariateSet ( - final double[] adblObjectiveVariate, - final double[] adblConstraintVariate) - throws java.lang.Exception - { - if (null == (_adblObjectiveVariate = adblObjectiveVariate) || - !org.drip.quant.common.NumberUtil.IsValid (_adblObjectiveVariate) || null == - (_adblConstraintVariate = adblConstraintVariate) || !org.drip.quant.common.NumberUtil.IsValid - (adblConstraintVariate)) - throw new java.lang.Exception ("ObjectiveConstraintVariateSet Constructor => Invalid Inputs!"); - } - - /** - * Retrieve the Array of the Objective Function Variates - * - * @return The Array of the Objective Function Variates - */ - - public double[] objectiveVariates() - { - return _adblObjectiveVariate; - } - - /** - * Retrieve the Array of the Constraint Function Variates - * - * @return The Array of the Constraint Function Variates - */ - - public double[] constraintVariates() - { - return _adblConstraintVariate; - } - - /** - * Unify the Objective Function and the Constraint Function Input Variate Set - * - * @return The Unified Objective Function and the Constraint Function Input Variate Set - */ - - public double[] unify() - { - int iNumObjectiveFunctionVariate = _adblObjectiveVariate.length; - int iNumConstraintFunctionVariate = _adblConstraintVariate.length; - int iNumVariate = iNumObjectiveFunctionVariate + iNumConstraintFunctionVariate; - double[] adblVariate = new double[iNumVariate]; - - for (int i = 0; i < iNumObjectiveFunctionVariate; ++i) - adblVariate[i] = _adblObjectiveVariate[i]; - - for (int i = 0; i < iNumConstraintFunctionVariate; ++i) - adblVariate[iNumObjectiveFunctionVariate + i] = _adblConstraintVariate[i]; - - return adblVariate; - } -} diff --git a/org/drip/function/rdtor1/RiskObjectiveUtilityMultivariate.java b/org/drip/function/rdtor1/RiskObjectiveUtilityMultivariate.java deleted file mode 100644 index de3024b..0000000 --- a/org/drip/function/rdtor1/RiskObjectiveUtilityMultivariate.java +++ /dev/null @@ -1,231 +0,0 @@ - -package org.drip.function.rdtor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * RiskObjectiveUtilityMultivariate implements the Risk Objective R^d To R^1 Multivariate Function used in - * Portfolio Allocation. It accommodates both the Risk Tolerance and Risk Aversion Variants. - * - * @author Lakshmi Krishnamurthy - */ - -public class RiskObjectiveUtilityMultivariate extends org.drip.function.definition.RdToR1 { - private double[] _adblExpectedReturns = null; - private double[][] _aadblCovarianceMatrix = null; - private double _dblRiskFreeRate = java.lang.Double.NaN; - private double _dblRiskAversion = java.lang.Double.NaN; - private double _dblRiskTolerance = java.lang.Double.NaN; - - /** - * RiskObjectiveUtilityMultivariate Constructor - * - * @param aadblCovarianceMatrix The Co-variance Matrix Double Array - * @param adblExpectedReturns Array of Expected Returns - * @param dblRiskAversion The Risk Aversion Parameter - * @param dblRiskTolerance The Risk Tolerance Parameter - * @param dblRiskFreeRate The Risk Free Rate - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public RiskObjectiveUtilityMultivariate ( - final double[][] aadblCovarianceMatrix, - final double[] adblExpectedReturns, - final double dblRiskAversion, - final double dblRiskTolerance, - final double dblRiskFreeRate) - throws java.lang.Exception - { - super (null); - - if (null == (_aadblCovarianceMatrix = aadblCovarianceMatrix) || null == (_adblExpectedReturns = - adblExpectedReturns) || !org.drip.quant.common.NumberUtil.IsValid (_dblRiskAversion = - dblRiskAversion) || !org.drip.quant.common.NumberUtil.IsValid (_dblRiskTolerance = - dblRiskTolerance) || !org.drip.quant.common.NumberUtil.IsValid (_dblRiskFreeRate = - dblRiskFreeRate)) - throw new java.lang.Exception ("RiskObjectiveUtilityMultivariate Constructor => Invalid Inputs"); - - int iSize = _aadblCovarianceMatrix.length; - - if (0 == iSize || iSize != _adblExpectedReturns.length) - throw new java.lang.Exception ("RiskObjectiveUtilityMultivariate Constructor => Invalid Inputs"); - - for (int i = 0; i < iSize; ++i) { - if (null == _aadblCovarianceMatrix[i] || iSize != _aadblCovarianceMatrix[i].length || - !org.drip.quant.common.NumberUtil.IsValid (_aadblCovarianceMatrix[i]) || - !org.drip.quant.common.NumberUtil.IsValid (_adblExpectedReturns[i])) - throw new java.lang.Exception - ("RiskObjectiveUtilityMultivariate Constructor => Invalid Inputs"); - } - } - - /** - * Retrieve the Input Variate Dimension - * - * @return The Input Variate Dimension - */ - - public int dimension() - { - return _aadblCovarianceMatrix.length; - } - - /** - * Retrieve the Co-variance Matrix - * - * @return The Co-variance Matrix - */ - - public double[][] covariance() - { - return _aadblCovarianceMatrix; - } - - /** - * Retrieve the Array of Expected Returns - * - * @return The Array of Expected Returns - */ - - public double[] expectedReturns() - { - return _adblExpectedReturns; - } - - /** - * Retrieve the Risk Aversion Factor - * - * @return The Risk Aversion Factor - */ - - public double riskAversion() - { - return _dblRiskAversion; - } - - /** - * Retrieve the Risk Tolerance Factor - * - * @return The Risk Tolerance Factor - */ - - public double riskTolerance() - { - return _dblRiskTolerance; - } - - /** - * Retrieve the Risk Free Rate - * - * @return The Risk Free Rate - */ - - public double riskFreeRate() - { - return _dblRiskFreeRate; - } - - @Override public double evaluate ( - final double[] adblVariate) - throws java.lang.Exception - { - if (null == adblVariate || !org.drip.quant.common.NumberUtil.IsValid (adblVariate)) - throw new java.lang.Exception ("RiskObjectiveUtilityMultivariate::evaluate => Invalid Inputs"); - - double dblValue = 0.; - int iDimension = adblVariate.length; - - if (iDimension != dimension()) - throw new java.lang.Exception ("RiskObjectiveUtilityMultivariate::evaluate => Invalid Inputs"); - - for (int i = 0; i < iDimension; ++i) { - dblValue -= _dblRiskTolerance * adblVariate[i] * (_adblExpectedReturns[i] - _dblRiskFreeRate); - - for (int j = 0; j < iDimension; ++j) - dblValue += 0.5 * _dblRiskAversion * adblVariate[i] * _aadblCovarianceMatrix[i][j] * - adblVariate[j]; - } - - return dblValue; - } - - @Override public double[] jacobian ( - final double[] adblVariate) - { - if (null == adblVariate || !org.drip.quant.common.NumberUtil.IsValid (adblVariate)) return null; - - int iDimension = adblVariate.length; - double[] adblJacobian = new double[iDimension]; - - if (iDimension != dimension()) return null; - - for (int i = 0; i < iDimension; ++i) { - adblJacobian[i] = -1. * _dblRiskTolerance * (_adblExpectedReturns[i] - _dblRiskFreeRate); - - for (int j = 0; j < iDimension; ++j) - adblJacobian[i] += _dblRiskAversion * _aadblCovarianceMatrix[i][j] * adblVariate[j]; - } - - return adblJacobian; - } - - @Override public double[][] hessian ( - final double[] adblVariate) - { - int iDimension = dimension(); - - double[][] aadblHessian = new double[iDimension][iDimension]; - - for (int i = 0; i < iDimension; ++i) { - for (int j = 0; j < iDimension; ++j) - aadblHessian[i][j] += _dblRiskAversion * _aadblCovarianceMatrix[i][j]; - } - - return aadblHessian; - } -} diff --git a/org/drip/function/rdtor1descent/ArmijoEvolutionVerifier.java b/org/drip/function/rdtor1descent/ArmijoEvolutionVerifier.java deleted file mode 100644 index f7daade..0000000 --- a/org/drip/function/rdtor1descent/ArmijoEvolutionVerifier.java +++ /dev/null @@ -1,152 +0,0 @@ - -package org.drip.function.rdtor1descent; - - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ArmijoEvolutionVerifier implements the Armijo Criterion used for the Inexact Line Search Increment - * Generation to ascertain that the Function has reduced sufficiently. The Reference is: - * - * - Armijo, L. (1966): Minimization of Functions having Lipschitz-Continuous First Partial Derivatives, - * Pacific Journal of Mathematics 16 (1) 1-3. - * - * @author Lakshmi Krishnamurthy - */ - -public class ArmijoEvolutionVerifier extends org.drip.function.rdtor1descent.LineEvolutionVerifier { - - /** - * The Nocedal-Wright Armijo Parameter - */ - - public static final double NOCEDAL_WRIGHT_ARMIJO_PARAMETER = 0.0001; - - private boolean _bMaximizerCheck = false; - private double _dblArmijoParameter = java.lang.Double.NaN; - - /** - * Construct the Nocedal-Wright Armijo Evolution Verifier - * @param bMaximizerCheck TRUE - Perform a Check for the Function Maxima - * - * @return The Nocedal-Wright Armijo Evolution Verifier Instance - */ - - public static final ArmijoEvolutionVerifier NocedalWrightStandard ( - final boolean bMaximizerCheck) - { - try { - return new ArmijoEvolutionVerifier (NOCEDAL_WRIGHT_ARMIJO_PARAMETER, bMaximizerCheck); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * ArmijoEvolutionVerifier Constructor - * - * @param dblArmijoParameter The Armijo Parameter - * @param bMaximizerCheck TRUE - Perform a Check for the Function Maxima - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ArmijoEvolutionVerifier ( - final double dblArmijoParameter, - final boolean bMaximizerCheck) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblArmijoParameter = dblArmijoParameter)) - throw new java.lang.Exception ("ArmijoEvolutionVerifier Constructor => Invalid Inputs"); - - _bMaximizerCheck = bMaximizerCheck; - } - - /** - * Indicate if the Check is for Minimizer/Maximizer - * - * @return TRUE - The Check is for Maximizer - */ - - public boolean maximizerCheck() - { - return _bMaximizerCheck; - } - - /** - * Retrieve the Armijo Parameter - * - * @return The Armijo Parameter - */ - - public double armijoParameter() - { - return _dblArmijoParameter; - } - - @Override public org.drip.function.rdtor1descent.LineEvolutionVerifierMetrics metrics ( - final org.drip.function.definition.UnitVector uvTargetDirection, - final double[] adblCurrentVariate, - final org.drip.function.definition.RdToR1 funcRdToR1, - final double dblStepLength) - { - try { - return null == funcRdToR1 ? null : new - org.drip.function.rdtor1descent.ArmijoEvolutionVerifierMetrics (_dblArmijoParameter, - _bMaximizerCheck, uvTargetDirection, adblCurrentVariate, dblStepLength, - funcRdToR1.evaluate (adblCurrentVariate), funcRdToR1.evaluate (NextVariate - (uvTargetDirection, adblCurrentVariate, dblStepLength)), funcRdToR1.jacobian - (adblCurrentVariate)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/function/rdtor1descent/ArmijoEvolutionVerifierMetrics.java b/org/drip/function/rdtor1descent/ArmijoEvolutionVerifierMetrics.java deleted file mode 100644 index 3b3b076..0000000 --- a/org/drip/function/rdtor1descent/ArmijoEvolutionVerifierMetrics.java +++ /dev/null @@ -1,170 +0,0 @@ - -package org.drip.function.rdtor1descent; - - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ArmijoEvolutionVerifierMetrics implements the Armijo Criterion used for the Inexact Line Search Increment - * Generation to ascertain that the Function has reduced sufficiently. The Reference is: - * - * - Armijo, L. (1966): Minimization of Functions having Lipschitz-Continuous First Partial Derivatives, - * Pacific Journal of Mathematics 16 (1) 1-3. - * - * @author Lakshmi Krishnamurthy - */ - -public class ArmijoEvolutionVerifierMetrics extends - org.drip.function.rdtor1descent.LineEvolutionVerifierMetrics { - private boolean _bMaximizerCheck = false; - private double _dblArmijoParameter = java.lang.Double.NaN; - private double _dblNextVariateFunctionValue = java.lang.Double.NaN; - private double _dblCurrentVariateFunctionValue = java.lang.Double.NaN; - - /** - * ArmijoEvolutionVerifierMetrics Constructor - * - * @param dblArmijoParameter The Armijo Parameter - * @param bMaximizerCheck TRUE - Perform a Check for the Function Maxima - * @param uvTargetDirection the Target Direction Unit Vector - * @param adblCurrentVariate Array of the Current Variate - * @param dblStepLength The Incremental Step Length - * @param dblCurrentVariateFunctionValue The Function Value at the Current Variate - * @param dblNextVariateFunctionValue The Function Value at the Next Variate - * @param adblCurrentVariateFunctionJacobian The Function Jacobian at the Current Variate - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ArmijoEvolutionVerifierMetrics ( - final double dblArmijoParameter, - final boolean bMaximizerCheck, - final org.drip.function.definition.UnitVector uvTargetDirection, - final double[] adblCurrentVariate, - final double dblStepLength, - final double dblCurrentVariateFunctionValue, - final double dblNextVariateFunctionValue, - final double[] adblCurrentVariateFunctionJacobian) - throws java.lang.Exception - { - super (uvTargetDirection, adblCurrentVariate, dblStepLength, adblCurrentVariateFunctionJacobian); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblArmijoParameter = dblArmijoParameter) || - !org.drip.quant.common.NumberUtil.IsValid (_dblCurrentVariateFunctionValue = - dblCurrentVariateFunctionValue) || !org.drip.quant.common.NumberUtil.IsValid - (_dblNextVariateFunctionValue = dblNextVariateFunctionValue)) - throw new java.lang.Exception ("ArmijoEvolutionVerifierMetrics Constructor => Invalid Inputs"); - - _bMaximizerCheck = bMaximizerCheck; - } - - /** - * Retrieve the Armijo Parameter - * - * @return The Armijo Parameter - */ - - public double armijoParameter() - { - return _dblArmijoParameter; - } - - /** - * Indicate if the Check is for Minimizer/Maximizer - * - * @return TRUE - The Check is for Maximizer - */ - - public boolean maximizerCheck() - { - return _bMaximizerCheck; - } - - /** - * Retrieve the Function Value at the Current Variate - * - * @return The Function Value at the Current Variate - */ - - public double currentVariateFunctionValue() - { - return _dblCurrentVariateFunctionValue; - } - - /** - * Retrieve the Function Value at the Next Variate - * - * @return The Function Value at the Next Variate - */ - - public double nextVariateFunctionValue() - { - return _dblNextVariateFunctionValue; - } - - /** - * Indicate if the Armijo Criterion has been met - * - * @return TRUE - The Armijo Criterion has been met - */ - - public boolean verify() - { - try { - double dblGradientUpdatedFunctionValue = _dblCurrentVariateFunctionValue + _dblArmijoParameter * - stepLength() * org.drip.quant.linearalgebra.Matrix.DotProduct (targetDirection().component(), - currentVariateFunctionJacobian()); - - return _bMaximizerCheck ? _dblNextVariateFunctionValue >= dblGradientUpdatedFunctionValue : - _dblNextVariateFunctionValue <= dblGradientUpdatedFunctionValue; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } -} diff --git a/org/drip/function/rdtor1descent/CurvatureEvolutionVerifier.java b/org/drip/function/rdtor1descent/CurvatureEvolutionVerifier.java deleted file mode 100644 index 1cc81c7..0000000 --- a/org/drip/function/rdtor1descent/CurvatureEvolutionVerifier.java +++ /dev/null @@ -1,154 +0,0 @@ - -package org.drip.function.rdtor1descent; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CurvatuveEvolutionVerifier implements the Armijo Criterion used for the Inexact Line Search Increment - * Generation to ascertain that the Gradient of the Function has reduced sufficiently. The References are: - * - * - Wolfe, P. (1969): Convergence Conditions for Ascent Methods, SIAM Review 11 (2) 226-235. - * - * - Wolfe, P. (1971): Convergence Conditions for Ascent Methods; II: Some Corrections, SIAM Review 13 (2) - * 185-188. - * - * @author Lakshmi Krishnamurthy - */ - -public class CurvatureEvolutionVerifier extends org.drip.function.rdtor1descent.LineEvolutionVerifier { - - /** - * The Nocedal-Wright Curvature Parameter - */ - - public static final double NOCEDAL_WRIGHT_CURVATURE_PARAMETER = 0.9; - - private boolean _bStrongCurvatureCriterion = false; - private double _dblCurvatureParameter = java.lang.Double.NaN; - - /** - * Construct the Nocedal-Wright Curvature Evolution Verifier - * - * @param bStrongCurvatureCriterion TRUE - Apply the Strong Curvature Criterion - * - * @return The Nocedal-Wright Curvature Evolution Verifier Instance - */ - - public static final CurvatureEvolutionVerifier NocedalWrightStandard ( - final boolean bStrongCurvatureCriterion) - { - try { - return new CurvatureEvolutionVerifier (NOCEDAL_WRIGHT_CURVATURE_PARAMETER, - bStrongCurvatureCriterion); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * CurvatureEvolutionVerifier Constructor - * - * @param dblCurvatureParameter The Curvature Parameter - * @param bStrongCurvatureCriterion TRUE - Apply the Strong Curvature Criterion - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CurvatureEvolutionVerifier ( - final double dblCurvatureParameter, - final boolean bStrongCurvatureCriterion) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblCurvatureParameter = dblCurvatureParameter)) - throw new java.lang.Exception ("CurvatureEvolutionVerifier Constructor => Invalid Inputs"); - - _bStrongCurvatureCriterion = bStrongCurvatureCriterion; - } - - /** - * Retrieve the Curvature Parameter - * - * @return The Curvature Parameter - */ - - public double curvatureParameter() - { - return _dblCurvatureParameter; - } - - /** - * Retrieve Whether of not the "Strong" Curvature Criterion needs to be met - * - * @return TRUE - The "Strong" Curvature Criterion needs to be met - */ - - public boolean strongCriterion() - { - return _bStrongCurvatureCriterion; - } - - @Override public org.drip.function.rdtor1descent.LineEvolutionVerifierMetrics metrics ( - final org.drip.function.definition.UnitVector uvTargetDirection, - final double[] adblCurrentVariate, - final org.drip.function.definition.RdToR1 funcRdToR1, - final double dblStepLength) - { - try { - return null == funcRdToR1 ? null : new - org.drip.function.rdtor1descent.CurvatureEvolutionVerifierMetrics (_dblCurvatureParameter, - _bStrongCurvatureCriterion, uvTargetDirection, adblCurrentVariate, dblStepLength, - funcRdToR1.jacobian (adblCurrentVariate), funcRdToR1.jacobian (NextVariate - (uvTargetDirection, adblCurrentVariate, dblStepLength))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/function/rdtor1descent/CurvatureEvolutionVerifierMetrics.java b/org/drip/function/rdtor1descent/CurvatureEvolutionVerifierMetrics.java deleted file mode 100644 index fa2bef5..0000000 --- a/org/drip/function/rdtor1descent/CurvatureEvolutionVerifierMetrics.java +++ /dev/null @@ -1,164 +0,0 @@ - -package org.drip.function.rdtor1descent; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CurvatuveEvolutionVerifierMetrics implements the Armijo Criterion used for the Inexact Line Search - * Increment Generation to ascertain that the Gradient of the Function has reduced sufficiently. The - * References are: - * - * - Wolfe, P. (1969): Convergence Conditions for Ascent Methods, SIAM Review 11 (2) 226-235. - * - * - Wolfe, P. (1971): Convergence Conditions for Ascent Methods; II: Some Corrections, SIAM Review 13 (2) - * 185-188. - * - * @author Lakshmi Krishnamurthy - */ - -public class CurvatureEvolutionVerifierMetrics extends - org.drip.function.rdtor1descent.LineEvolutionVerifierMetrics { - private boolean _bStrongCurvatureCriterion = false; - private double[] _adblNextVariateFunctionJacobian = null; - private double _dblCurvatureParameter = java.lang.Double.NaN; - - /** - * CurvatureEvolutionVerifierMetrics Constructor - * - * @param dblCurvatureParameter The Curvature Criterion Parameter - * @param bStrongCurvatureCriterion TRUE - Apply the "Strong" Curvature Criterion - * @param uvTargetDirection The Target Direction Unit Vector - * @param adblCurrentVariate Array of Current Variate - * @param dblStepLength The Incremental Step Length - * @param adblCurrentVariateFunctionJacobian The Function Jacobian at the Current Variate - * @param adblNextVariateFunctionJacobian The Function Jacobian at the Next Variate - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CurvatureEvolutionVerifierMetrics ( - final double dblCurvatureParameter, - final boolean bStrongCurvatureCriterion, - final org.drip.function.definition.UnitVector uvTargetDirection, - final double[] adblCurrentVariate, - final double dblStepLength, - final double[] adblCurrentVariateFunctionJacobian, - final double[] adblNextVariateFunctionJacobian) - throws java.lang.Exception - { - super (uvTargetDirection, adblCurrentVariate, dblStepLength, adblCurrentVariateFunctionJacobian); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblCurvatureParameter = dblCurvatureParameter) || - null == (_adblNextVariateFunctionJacobian = adblNextVariateFunctionJacobian) || - adblCurrentVariate.length != _adblNextVariateFunctionJacobian.length) - throw new java.lang.Exception - ("CurvatureEvolutionVerifierMetrics Constructor => Invalid Inputs"); - - _bStrongCurvatureCriterion = bStrongCurvatureCriterion; - } - - /** - * Retrieve the Curvature Parameter - * - * @return The Curvature Parameter - */ - - public double curvatureParameter() - { - return _dblCurvatureParameter; - } - - /** - * Retrieve Whether of not the "Strong" Curvature Criterion needs to be met - * - * @return TRUE - The "Strong" Curvature Criterion needs to be met - */ - - public boolean strongCriterion() - { - return _bStrongCurvatureCriterion; - } - - /** - * Retrieve the Function Jacobian at the Next Variate - * - * @return The Function Jacobian at the Next Variate - */ - - public double[] nextVariateFunctionJacobian() - { - return _adblNextVariateFunctionJacobian; - } - - /** - * Indicate if the Curvature Criterion has been met - * - * @return TRUE - The Curvature Criterion has been met - */ - - public boolean verify() - { - double[] adblDirectionVector = targetDirection().component(); - - try { - double dblNextFunctionIncrement = org.drip.quant.linearalgebra.Matrix.DotProduct - (adblDirectionVector, _adblNextVariateFunctionJacobian); - - double dblParametrizedCurrentFunctionIncrement = _dblCurvatureParameter * - org.drip.quant.linearalgebra.Matrix.DotProduct (adblDirectionVector, - currentVariateFunctionJacobian()); - - return _bStrongCurvatureCriterion ? java.lang.Math.abs (dblNextFunctionIncrement) <= - java.lang.Math.abs (dblParametrizedCurrentFunctionIncrement) : dblNextFunctionIncrement >= - dblParametrizedCurrentFunctionIncrement; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } -} diff --git a/org/drip/function/rdtor1descent/LineEvolutionVerifier.java b/org/drip/function/rdtor1descent/LineEvolutionVerifier.java deleted file mode 100644 index 1f0909b..0000000 --- a/org/drip/function/rdtor1descent/LineEvolutionVerifier.java +++ /dev/null @@ -1,141 +0,0 @@ - -package org.drip.function.rdtor1descent; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * LineEvolutionVerifier implements the Step Length Verification Criterion used for the Inexact Line Search - * Increment Generation. The References are: - * - * - Armijo, L. (1966): Minimization of Functions having Lipschitz-Continuous First Partial Derivatives, - * Pacific Journal of Mathematics 16 (1) 1-3. - * - * - Wolfe, P. (1969): Convergence Conditions for Ascent Methods, SIAM Review 11 (2) 226-235. - * - * - Wolfe, P. (1971): Convergence Conditions for Ascent Methods; II: Some Corrections, SIAM Review 13 (2) - * 185-188. - * - * - Nocedal, J., and S. Wright (1999): Numerical Optimization, Wiley. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class LineEvolutionVerifier { - - protected static final double[] NextVariate ( - final org.drip.function.definition.UnitVector uvTargetDirection, - final double[] adblCurrentVariate, - final double dblStepLength) - { - if (null == adblCurrentVariate || !org.drip.quant.common.NumberUtil.IsValid (dblStepLength)) - return null; - - int iDimension = adblCurrentVariate.length; - double[] adblNextVariate = 0 == iDimension ? null : new double[iDimension]; - - if (null == adblNextVariate || null == uvTargetDirection) return null; - - double[] adblTargetDirection = uvTargetDirection.component(); - - if (null == adblTargetDirection || iDimension != adblTargetDirection.length) return null; - - for (int i = 0; i < iDimension; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (adblCurrentVariate[i]) || - !org.drip.quant.common.NumberUtil.IsValid (adblTargetDirection[i])) - return null; - - adblNextVariate[i] = adblCurrentVariate[i] + dblStepLength * adblTargetDirection[i]; - } - - return adblNextVariate; - } - - /** - * Verify if the specified Inputs satisfy the Criterion - * - * @param uvTargetDirection The Target Direction Unit Vector - * @param adblCurrentVariate The Current Variate - * @param funcRdToR1 The R^d To R^1 Function - * @param dblStepLength The Incremental Step Length - * - * @return TRUE - The Specified Inputs satisfy the Criterion - * - * @throws java.lang.Exception Thrown if the Verification cannot be performed - */ - - public boolean verify ( - final org.drip.function.definition.UnitVector uvTargetDirection, - final double[] adblCurrentVariate, - final org.drip.function.definition.RdToR1 funcRdToR1, - final double dblStepLength) - throws java.lang.Exception - { - org.drip.function.rdtor1descent.LineEvolutionVerifierMetrics levm = metrics (uvTargetDirection, - adblCurrentVariate, funcRdToR1, dblStepLength); - - if (null == levm) throw new java.lang.Exception ("LineEvolutionVerifier::verify => Cannot Verify"); - - return levm.verify(); - } - - /** - * Generate the Verifier Metrics for the Specified Inputs - * - * @param uvTargetDirection The Target Direction Unit Vector - * @param adblCurrentVariate The Current Variate - * @param funcRdToR1 The R^d To R^1 Function - * @param dblStepLength The Incremental Step Length - * - * @return The Verifier Metrics - */ - - public abstract org.drip.function.rdtor1descent.LineEvolutionVerifierMetrics metrics ( - final org.drip.function.definition.UnitVector uvTargetDirection, - final double[] adblCurrentVariate, - final org.drip.function.definition.RdToR1 funcRdToR1, - final double dblStepLength); -} diff --git a/org/drip/function/rdtor1descent/LineEvolutionVerifierMetrics.java b/org/drip/function/rdtor1descent/LineEvolutionVerifierMetrics.java deleted file mode 100644 index 1a4f35b..0000000 --- a/org/drip/function/rdtor1descent/LineEvolutionVerifierMetrics.java +++ /dev/null @@ -1,159 +0,0 @@ - -package org.drip.function.rdtor1descent; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * LineEvolutionVerifierMetrics implements the Step Length Verification Criterion used for the Inexact Line - * Search Increment Generation. The References are: - * - * - Armijo, L. (1966): Minimization of Functions having Lipschitz-Continuous First Partial Derivatives, - * Pacific Journal of Mathematics 16 (1) 1-3. - * - * - Wolfe, P. (1969): Convergence Conditions for Ascent Methods, SIAM Review 11 (2) 226-235. - * - * - Wolfe, P. (1971): Convergence Conditions for Ascent Methods; II: Some Corrections, SIAM Review 13 (2) - * 185-188. - * - * - Nocedal, J., and S. Wright (1999): Numerical Optimization, Wiley. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class LineEvolutionVerifierMetrics { - private double[] _adblCurrentVariate = null; - private double _dblStepLength = java.lang.Double.NaN; - private double[] _adblCurrentVariateFunctionJacobian = null; - private org.drip.function.definition.UnitVector _uvTargetDirection = null; - - protected LineEvolutionVerifierMetrics ( - final org.drip.function.definition.UnitVector uvTargetDirection, - final double[] adblCurrentVariate, - final double dblStepLength, - final double[] adblCurrentVariateFunctionJacobian) - throws java.lang.Exception - { - if (null == (_uvTargetDirection = uvTargetDirection) || null == (_adblCurrentVariate = - adblCurrentVariate) || !org.drip.quant.common.NumberUtil.IsValid (_dblStepLength = dblStepLength) - || null == (_adblCurrentVariateFunctionJacobian = adblCurrentVariateFunctionJacobian) || - _adblCurrentVariate.length != _adblCurrentVariateFunctionJacobian.length) - throw new java.lang.Exception ("LineEvolutionVerifierMetrics Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Current Variate Array - * - * @return The Current Variate Array - */ - - public double[] currentVariate() - { - return _adblCurrentVariate; - } - - /** - * Retrieve the Target Direction Unit Vector - * - * @return The Target Direction Unit Vector - */ - - public org.drip.function.definition.UnitVector targetDirection() - { - return _uvTargetDirection; - } - - /** - * Retrieve the Step Length - * - * @return The Step Length - */ - - public double stepLength() - { - return _dblStepLength; - } - - /** - * Retrieve the Function Jacobian at the Current Variate - * - * @return The Function Jacobian at the Current Variate - */ - - public double[] currentVariateFunctionJacobian() - { - return _adblCurrentVariateFunctionJacobian; - } - - @Override public java.lang.String toString() - { - double[] adblDirection = _uvTargetDirection.component(); - - java.lang.String strDump = "\t["; - int iNumVariate = _adblCurrentVariate.length; - - for (int i = 0; i < iNumVariate; ++i) - strDump = strDump + org.drip.quant.common.FormatUtil.FormatDouble (_adblCurrentVariate[i], 2, 3, - 1.) + " |"; - - strDump = strDump + "]" + org.drip.quant.common.FormatUtil.FormatDouble (_dblStepLength, 1, 3, 1.) + - " || {"; - - for (int i = 0; i < iNumVariate; ++i) - strDump = strDump + org.drip.quant.common.FormatUtil.FormatDouble (adblDirection[i], 1, 2, 1.) + - " |"; - - return strDump + " }"; - } - - /** - * Indicate if the Evolution Criterion has been met - * - * @return TRUE - The Evolution Criterion has been met - */ - - public abstract boolean verify(); -} diff --git a/org/drip/function/rdtor1descent/LineStepEvolutionControl.java b/org/drip/function/rdtor1descent/LineStepEvolutionControl.java deleted file mode 100644 index efb368a..0000000 --- a/org/drip/function/rdtor1descent/LineStepEvolutionControl.java +++ /dev/null @@ -1,230 +0,0 @@ - -package org.drip.function.rdtor1descent; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * LineStepEvolutionControl contains the Parameters required to compute the Valid a Line Step. The References - * are: - * - * - Armijo, L. (1966): Minimization of Functions having Lipschitz-Continuous First Partial Derivatives, - * Pacific Journal of Mathematics 16 (1) 1-3. - * - * - Wolfe, P. (1969): Convergence Conditions for Ascent Methods, SIAM Review 11 (2) 226-235. - * - * - Wolfe, P. (1971): Convergence Conditions for Ascent Methods; II: Some Corrections, SIAM Review 13 (2) - * 185-188. - * - * - Nocedal, J., and S. Wright (1999): Numerical Optimization, Wiley. - * - * @author Lakshmi Krishnamurthy - */ - -public class LineStepEvolutionControl { - private int _iNumReductionStep = -1; - private double _dblReductionFactor = java.lang.Double.NaN; - private org.drip.function.rdtor1descent.LineEvolutionVerifier _lev = null; - - /** - * Retrieve the Nocedal-Wright-Armijo Verifier Based Standard LineStepEvolutionControl Instance - * - * @param bMaximizerCheck TRUE - Perform a Check for the Function Maxima - * - * @return The Nocedal-Wright-Armijo Verifier Based Standard LineStepEvolutionControl Instance - */ - - public static final LineStepEvolutionControl NocedalWrightArmijo ( - final boolean bMaximizerCheck) - { - try { - return new LineStepEvolutionControl - (org.drip.function.rdtor1descent.ArmijoEvolutionVerifier.NocedalWrightStandard - (bMaximizerCheck), 0.75, 1); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Nocedal-Wright-Weak Curvature Verifier Based Standard LineStepEvolutionControl Instance - * - * @return The Nocedal-Wright-Weak Curvature Verifier Based Standard LineStepEvolutionControl Instance - */ - - public static final LineStepEvolutionControl NocedalWrightWeakCurvature() - { - try { - return new LineStepEvolutionControl - (org.drip.function.rdtor1descent.CurvatureEvolutionVerifier.NocedalWrightStandard (false), - 0.75, 1); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Nocedal-Wright-Strong Curvature Verifier Based Standard LineStepEvolutionControl Instance - * - * @return The Nocedal-Wright-Strong Curvature Verifier Based Standard LineStepEvolutionControl Instance - */ - - public static final LineStepEvolutionControl NocedalWrightStrongCurvature() - { - try { - return new LineStepEvolutionControl - (org.drip.function.rdtor1descent.CurvatureEvolutionVerifier.NocedalWrightStandard (true), - 0.75, 1); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Nocedal-Wright-Weak Wolfe Verifier Based Standard LineStepEvolutionControl Instance - * - * @param bMaximizerCheck TRUE - Perform a Check for the Function Maxima - * - * @return The Nocedal-Wright-Weak Wolfe Verifier Based Standard LineStepEvolutionControl Instance - */ - - public static final LineStepEvolutionControl NocedalWrightWeakWolfe ( - final boolean bMaximizerCheck) - { - try { - return new LineStepEvolutionControl - (org.drip.function.rdtor1descent.WolfeEvolutionVerifier.NocedalWrightStandard - (bMaximizerCheck, false), 0.75, 1); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Nocedal-Wright-Strong Wolfe Verifier Based Standard LineStepEvolutionControl Instance - * - * @param bMaximizerCheck TRUE - Perform a Check for the Function Maxima - * - * @return The Nocedal-Wright-Strong Wolfe Verifier Based Standard LineStepEvolutionControl Instance - */ - - public static final LineStepEvolutionControl NocedalWrightStrongWolfe ( - final boolean bMaximizerCheck) - { - try { - return new LineStepEvolutionControl - (org.drip.function.rdtor1descent.WolfeEvolutionVerifier.NocedalWrightStandard - (bMaximizerCheck, true), 0.75, 1); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * LineStepEvolutionControl Constructor - * - * @param lev The Lie Evolution Verifier Instance - * @param dblReductionFactor The Per-Step Reduction Factor - * @param iNumReductionStep Number of Reduction Steps - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public LineStepEvolutionControl ( - final org.drip.function.rdtor1descent.LineEvolutionVerifier lev, - final double dblReductionFactor, - final int iNumReductionStep) - throws java.lang.Exception - { - if (null == (_lev = lev) || !org.drip.quant.common.NumberUtil.IsValid (_dblReductionFactor = - dblReductionFactor) || 1. <= _dblReductionFactor || 0 >= (_iNumReductionStep = - iNumReductionStep)) - throw new java.lang.Exception ("LineStepEvolutionControl Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Line Evolution Verifier Instance - * - * @return The Line Evolution Verifier Instance - */ - - public org.drip.function.rdtor1descent.LineEvolutionVerifier lineEvolutionVerifier() - { - return _lev; - } - - /** - * Retrieve the Reduction Factor per Step - * - * @return The Reduction Factor per Step - */ - - public double reductionFactor() - { - return _dblReductionFactor; - } - - /** - * Retrieve the Number of Reduction Steps - * - * @return The Number of Reduction Steps - */ - - public int reductionSteps() - { - return _iNumReductionStep; - } -} diff --git a/org/drip/function/rdtor1descent/WolfeEvolutionVerifier.java b/org/drip/function/rdtor1descent/WolfeEvolutionVerifier.java deleted file mode 100644 index feb4a2e..0000000 --- a/org/drip/function/rdtor1descent/WolfeEvolutionVerifier.java +++ /dev/null @@ -1,190 +0,0 @@ - -package org.drip.function.rdtor1descent; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * WolfeEvolutionVerifier implements the Wolfe Criterion used for the Inexact Line Search Increment - * Generation. The References are: - * - * - Armijo, L. (1966): Minimization of Functions having Lipschitz-Continuous First Partial Derivatives, - * Pacific Journal of Mathematics 16 (1) 1-3. - * - * - Wolfe, P. (1969): Convergence Conditions for Ascent Methods, SIAM Review 11 (2) 226-235. - * - * - Wolfe, P. (1971): Convergence Conditions for Ascent Methods; II: Some Corrections, SIAM Review 13 (2) - * 185-188. - * - * - Nocedal, J., and S. Wright (1999): Numerical Optimization, Wiley. - * - * @author Lakshmi Krishnamurthy - */ - -public class WolfeEvolutionVerifier extends org.drip.function.rdtor1descent.LineEvolutionVerifier { - private boolean _bMaximizerCheck = false; - private boolean _bStrongCurvatureCriterion = false; - private double _dblArmijoParameter = java.lang.Double.NaN; - private double _dblCurvatureParameter = java.lang.Double.NaN; - - /** - * Construct the Nocedal-Wright Wolfe Evolution Verifier - * - * @param bMaximizerCheck TRUE - Perform a Check for the Function Maxima - * @param bStrongCurvatureCriterion TRUE - Apply the Strong Curvature Criterion - * - * @return The Nocedal-Wright Wolfe Evolution Verifier Instance - */ - - public static final WolfeEvolutionVerifier NocedalWrightStandard ( - final boolean bMaximizerCheck, - final boolean bStrongCurvatureCriterion) - { - try { - return new WolfeEvolutionVerifier - (org.drip.function.rdtor1descent.ArmijoEvolutionVerifier.NOCEDAL_WRIGHT_ARMIJO_PARAMETER, - bMaximizerCheck, - org.drip.function.rdtor1descent.CurvatureEvolutionVerifier.NOCEDAL_WRIGHT_CURVATURE_PARAMETER, - bStrongCurvatureCriterion); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * WolfeEvolutionVerifier Constructor - * - * @param dblArmijoParameter The Armijo Criterion Parameter - * @param bMaximizerCheck TRUE - Perform a Check for the Function Maxima - * @param dblCurvatureParameter The Curvature Parameter - * @param bStrongCurvatureCriterion TRUE - Apply the Strong Curvature Criterion - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public WolfeEvolutionVerifier ( - final double dblArmijoParameter, - final boolean bMaximizerCheck, - final double dblCurvatureParameter, - final boolean bStrongCurvatureCriterion) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblArmijoParameter = dblArmijoParameter) || - !org.drip.quant.common.NumberUtil.IsValid (_dblCurvatureParameter = dblCurvatureParameter)) - throw new java.lang.Exception ("WolfeEvolutionVerifier Constructor => Invalid Inputs"); - - _bMaximizerCheck = bMaximizerCheck; - _bStrongCurvatureCriterion = bStrongCurvatureCriterion; - } - - /** - * Retrieve the Armijo Parameter - * - * @return The Armijo Parameter - */ - - public double armijoParameter() - { - return _dblArmijoParameter; - } - - /** - * Indicate if the Check is for Minimizer/Maximizer - * - * @return TRUE - The Check is for Maximizer - */ - - public boolean maximizerCheck() - { - return _bMaximizerCheck; - } - - /** - * Retrieve the Curvature Parameter - * - * @return The Curvature Parameter - */ - - public double curvatureParameter() - { - return _dblCurvatureParameter; - } - - /** - * Retrieve Whether of not the "Strong" Curvature Criterion needs to be met - * - * @return TRUE - The "Strong" Curvature Criterion needs to be met - */ - - public boolean strongCriterion() - { - return _bStrongCurvatureCriterion; - } - - @Override public org.drip.function.rdtor1descent.LineEvolutionVerifierMetrics metrics ( - final org.drip.function.definition.UnitVector uvTargetDirection, - final double[] adblCurrentVariate, - final org.drip.function.definition.RdToR1 funcRdToR1, - final double dblStepLength) - { - double[] adblNextVariate = NextVariate (uvTargetDirection, adblCurrentVariate, dblStepLength); - - try { - return null == funcRdToR1 ? null : new - org.drip.function.rdtor1descent.WolfeEvolutionVerifierMetrics (_dblArmijoParameter, - _bMaximizerCheck, _dblCurvatureParameter, _bStrongCurvatureCriterion, uvTargetDirection, - adblCurrentVariate, dblStepLength, funcRdToR1.evaluate (adblCurrentVariate), - funcRdToR1.evaluate (adblNextVariate), funcRdToR1.jacobian (adblCurrentVariate), - funcRdToR1.jacobian (adblNextVariate)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/function/rdtor1descent/WolfeEvolutionVerifierMetrics.java b/org/drip/function/rdtor1descent/WolfeEvolutionVerifierMetrics.java deleted file mode 100644 index b12cdad..0000000 --- a/org/drip/function/rdtor1descent/WolfeEvolutionVerifierMetrics.java +++ /dev/null @@ -1,238 +0,0 @@ - -package org.drip.function.rdtor1descent; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * WolfeEvolutionVerifierMetrics implements the Wolfe Criterion used for the Inexact Line Search Increment - * Generation. The References are: - * - * - Armijo, L. (1966): Minimization of Functions having Lipschitz-Continuous First Partial Derivatives, - * Pacific Journal of Mathematics 16 (1) 1-3. - * - * - Wolfe, P. (1969): Convergence Conditions for Ascent Methods, SIAM Review 11 (2) 226-235. - * - * - Wolfe, P. (1971): Convergence Conditions for Ascent Methods; II: Some Corrections, SIAM Review 13 (2) - * 185-188. - * - * - Nocedal, J., and S. Wright (1999): Numerical Optimization, Wiley. - * - * @author Lakshmi Krishnamurthy - */ - -public class WolfeEvolutionVerifierMetrics extends - org.drip.function.rdtor1descent.LineEvolutionVerifierMetrics { - private boolean _bMaximizerCheck = false; - private boolean _bStrongCurvatureCriterion = false; - private double[] _adblNextVariateFunctionJacobian = null; - private double _dblArmijoParameter = java.lang.Double.NaN; - private double _dblCurvatureParameter = java.lang.Double.NaN; - private double _dblNextVariateFunctionValue = java.lang.Double.NaN; - private double _dblCurrentVariateFunctionValue = java.lang.Double.NaN; - - /** - * WolfeEvolutionVerifierMetrics Constructor - * - * @param dblArmijoParameter The Armijo Criterion Parameter - * @param bMaximizerCheck TRUE - Perform a Check for the Function Maxima - * @param dblCurvatureParameter The Curvature Criterion Parameter - * @param bStrongCurvatureCriterion TRUE - Apply the "Strong" Curvature Criterion - * @param uvTargetDirection The Target Direction Unit Vector - * @param adblCurrentVariate Array of the Current Variate - * @param dblStepLength The Incremental Step Length - * @param dblCurrentVariateFunctionValue The Function Value at the Current Variate - * @param dblNextVariateFunctionValue The Function Value at the Next Variate - * @param adblCurrentVariateFunctionJacobian The Function Jacobian at the Current Variate - * @param adblNextVariateFunctionJacobian The Function Jacobian at the Next Variate - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public WolfeEvolutionVerifierMetrics ( - final double dblArmijoParameter, - final boolean bMaximizerCheck, - final double dblCurvatureParameter, - final boolean bStrongCurvatureCriterion, - final org.drip.function.definition.UnitVector uvTargetDirection, - final double[] adblCurrentVariate, - final double dblStepLength, - final double dblCurrentVariateFunctionValue, - final double dblNextVariateFunctionValue, - final double[] adblCurrentVariateFunctionJacobian, - final double[] adblNextVariateFunctionJacobian) - throws java.lang.Exception - { - super (uvTargetDirection, adblCurrentVariate, dblStepLength, adblCurrentVariateFunctionJacobian); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblArmijoParameter = dblArmijoParameter) || - !org.drip.quant.common.NumberUtil.IsValid (_dblCurvatureParameter = dblCurvatureParameter) || - null == (_adblNextVariateFunctionJacobian = adblNextVariateFunctionJacobian) || - !org.drip.quant.common.NumberUtil.IsValid (_dblCurrentVariateFunctionValue = - dblCurrentVariateFunctionValue) || !org.drip.quant.common.NumberUtil.IsValid - (_dblNextVariateFunctionValue = dblNextVariateFunctionValue) || - adblCurrentVariate.length != _adblNextVariateFunctionJacobian.length) - throw new java.lang.Exception ("WolfeEvolutionVerifierMetrics Constructor => Invalid Inputs"); - - _bMaximizerCheck = bMaximizerCheck; - _bStrongCurvatureCriterion = bStrongCurvatureCriterion; - } - - /** - * Retrieve the Armijo Parameter - * - * @return The Armijo Parameter - */ - - public double armijoParameter() - { - return _dblArmijoParameter; - } - - /** - * Indicate if the Check is for Minimizer/Maximizer - * - * @return TRUE - The Check is for Maximizer - */ - - public boolean maximizerCheck() - { - return _bMaximizerCheck; - } - - /** - * Retrieve the Curvature Parameter - * - * @return The Curvature Parameter - */ - - public double curvatureParameter() - { - return _dblCurvatureParameter; - } - - /** - * Retrieve Whether of not the "Strong" Curvature Criterion needs to be met - * - * @return TRUE - The "Strong" Curvature Criterion needs to be met - */ - - public boolean strongCurvatureCriterion() - { - return _bStrongCurvatureCriterion; - } - - /** - * Retrieve the Function Value at the Current Variate - * - * @return The Function Value at the Current Variate - */ - - public double currentVariateFunctionValue() - { - return _dblCurrentVariateFunctionValue; - } - - /** - * Retrieve the Function Value at the Next Variate - * - * @return The Function Value at the Next Variate - */ - - public double nextVariateFunctionValue() - { - return _dblNextVariateFunctionValue; - } - - /** - * Retrieve the Function Jacobian at the Next Variate - * - * @return The Function Jacobian at the Next Variate - */ - - public double[] nextVariateFunctionJacobian() - { - return _adblNextVariateFunctionJacobian; - } - - /** - * Indicate if the Wolfe Criterion has been met - * - * @return TRUE - The Wolfe Criterion has been met - */ - - public boolean verify() - { - double[] adblDirectionVector = targetDirection().component(); - - double[] adblCurrentVariateFunctionJacobian = currentVariateFunctionJacobian(); - - try { - double dblGradientUpdatedFunctionValue = _dblCurrentVariateFunctionValue + _dblArmijoParameter * - stepLength() * org.drip.quant.linearalgebra.Matrix.DotProduct (adblDirectionVector, - adblCurrentVariateFunctionJacobian); - - if ((_bMaximizerCheck && _dblNextVariateFunctionValue < dblGradientUpdatedFunctionValue) || - (!_bMaximizerCheck && _dblNextVariateFunctionValue > dblGradientUpdatedFunctionValue)) - return false; - - double dblNextFunctionIncrement = org.drip.quant.linearalgebra.Matrix.DotProduct - (adblDirectionVector, _adblNextVariateFunctionJacobian); - - double dblParametrizedCurrentFunctionIncrement = _dblCurvatureParameter * - org.drip.quant.linearalgebra.Matrix.DotProduct (adblDirectionVector, - adblCurrentVariateFunctionJacobian); - - return _bStrongCurvatureCriterion ? java.lang.Math.abs (dblNextFunctionIncrement) <= - java.lang.Math.abs (dblParametrizedCurrentFunctionIncrement) : dblNextFunctionIncrement >= - dblParametrizedCurrentFunctionIncrement; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } -} diff --git a/org/drip/function/rdtor1solver/BarrierFixedPointFinder.java b/org/drip/function/rdtor1solver/BarrierFixedPointFinder.java deleted file mode 100644 index 7eff71e..0000000 --- a/org/drip/function/rdtor1solver/BarrierFixedPointFinder.java +++ /dev/null @@ -1,183 +0,0 @@ - -package org.drip.function.rdtor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * BarrierFixedPointFinder invokes the Iterative Finders for locating the Fixed Point for R^d To R^1 - * Convex/Non-Convex Functions Under Inequality Constraints using Barrier Sequences of decaying Strengths. - * - * @author Lakshmi Krishnamurthy - */ - -public class BarrierFixedPointFinder { - private org.drip.function.definition.RdToR1 _rdToR1ObjectiveFunction = null; - private org.drip.function.rdtor1descent.LineStepEvolutionControl _lsec = null; - private org.drip.function.rdtor1solver.InteriorPointBarrierControl _ipbc = null; - private org.drip.function.definition.RdToR1[] _aRdToR1InequalityConstraint = null; - - /** - * BarrierFixedPointFinder Constructor - * - * @param rdToR1ObjectiveFunction The Objective Function - * @param aRdToR1InequalityConstraint Array of Inequality Constraints - * @param ipbc Interior Point Barrier Strength Control Parameters - * @param lsec Line Step Evolution Verifier Control Parameters - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BarrierFixedPointFinder ( - final org.drip.function.definition.RdToR1 rdToR1ObjectiveFunction, - final org.drip.function.definition.RdToR1[] aRdToR1InequalityConstraint, - final org.drip.function.rdtor1solver.InteriorPointBarrierControl ipbc, - final org.drip.function.rdtor1descent.LineStepEvolutionControl lsec) - throws java.lang.Exception - { - if (null == (_rdToR1ObjectiveFunction = rdToR1ObjectiveFunction) || null == - (_aRdToR1InequalityConstraint = aRdToR1InequalityConstraint) || null == (_ipbc = ipbc)) - throw new java.lang.Exception ("BarrierFixedPointFinder Constructor => Invalid Inputs"); - - _lsec = lsec; - int iNumInequalityConstraint = _aRdToR1InequalityConstraint.length; - - if (0 == iNumInequalityConstraint) - throw new java.lang.Exception ("BarrierFixedPointFinder Constructor => Invalid Inputs"); - - for (int i = 0; i < iNumInequalityConstraint; ++i) { - if (null == _aRdToR1InequalityConstraint[i]) - throw new java.lang.Exception ("BarrierFixedPointFinder Constructor => Invalid Inputs"); - } - } - - /** - * Retrieve the Objective Function - * - * @return The Objective Function - */ - - public org.drip.function.definition.RdToR1 objectiveFunction() - { - return _rdToR1ObjectiveFunction; - } - - /** - * Retrieve the Array of Inequality Constraints - * - * @return The Array of Inequality Constraints - */ - - public org.drip.function.definition.RdToR1[] inequalityConstraints() - { - return _aRdToR1InequalityConstraint; - } - - /** - * Retrieve the Interior Point Barrier Strength Control Parameters - * - * @return The Interior Point Barrier Strength Control Parameters - */ - - public org.drip.function.rdtor1solver.InteriorPointBarrierControl control() - { - return _ipbc; - } - - /** - * Solve for the Optimal Variate-Inequality Constraint Multiplier Tuple using the Barrier Iteration - * Parameters provided by the IPBC Instance - * - * @param adblStartingVariate The Starting Variate Sequence - * - * @return The Optimal Variate-Inequality Constraint Multiplier Tuple - */ - - public org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier solve ( - final double[] adblStartingVariate) - { - int iOutstandingDecaySteps = _ipbc.numDecaySteps(); - - double dblBarrierStrength = _ipbc.initialStrength(); - - double dblBarrierDecayVelocity = _ipbc.decayVelocity(); - - int iNumInequalityConstraint = _aRdToR1InequalityConstraint.length; - org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier vicm = null; - double[] adblStartingInequalityConstraintMultiplier = new double[iNumInequalityConstraint]; - - try { - for (int i = 0; i < iNumInequalityConstraint; ++i) - adblStartingInequalityConstraintMultiplier[i] = dblBarrierStrength / - _aRdToR1InequalityConstraint[i].evaluate (adblStartingVariate); - - vicm = new org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier (false, - adblStartingVariate, adblStartingInequalityConstraintMultiplier); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - while (--iOutstandingDecaySteps >= 0) { - try { - org.drip.function.rdtor1solver.InteriorFixedPointFinder bfpf = new - org.drip.function.rdtor1solver.InteriorFixedPointFinder (_rdToR1ObjectiveFunction, - _aRdToR1InequalityConstraint, _lsec, _ipbc, dblBarrierStrength); - - if (null == (vicm = bfpf.find (vicm))) return null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - dblBarrierStrength *= dblBarrierDecayVelocity; - } - - return vicm; - } -} diff --git a/org/drip/function/rdtor1solver/ConstraintFunctionPointMetrics.java b/org/drip/function/rdtor1solver/ConstraintFunctionPointMetrics.java deleted file mode 100644 index 25ad841..0000000 --- a/org/drip/function/rdtor1solver/ConstraintFunctionPointMetrics.java +++ /dev/null @@ -1,156 +0,0 @@ - -package org.drip.function.rdtor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ConstraintFunctionPointMetrics holds the R^d Point Base and Sensitivity Metrics of the Constraint - * Function. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConstraintFunctionPointMetrics { - private double[] _adblValue = null; - private double[] _adblMultiplier = null; - private double[][] _aadblJacobian = null; - - /** - * ConstraintFunctionPointMetrics Constructor - * - * @param adblValue Constraint Value Array - * @param aadblJacobian Constraint Jacobian Matrix - * @param adblMultiplier Constraint Karush-Kahn-Tucker Multiplier Array - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ConstraintFunctionPointMetrics ( - final double[] adblValue, - final double[][] aadblJacobian, - final double[] adblMultiplier) - throws java.lang.Exception - { - if (null == (_adblValue = adblValue) || null == (_aadblJacobian = aadblJacobian) || null == - (_adblMultiplier = adblMultiplier)) - throw new java.lang.Exception ("ConstraintFunctionPointMetrics Constructor => Invalid Inputs"); - - int iDimension = _aadblJacobian.length; - int iNumConstraint = _adblValue.length; - - if (0 == iNumConstraint || iNumConstraint != adblMultiplier.length || 0 == iDimension) - throw new java.lang.Exception ("ConstraintFunctionPointMetrics Constructor => Invalid Inputs"); - - for (int i = 0; i < iNumConstraint; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (_adblValue[i]) || - !org.drip.quant.common.NumberUtil.IsValid (_adblMultiplier[i])) - throw new java.lang.Exception ("ConstraintFunctionPointMetrics Constructor => Invalid Inputs"); - } - - for (int i = 0; i < iDimension; ++i) { - if (null == _aadblJacobian[i] || iNumConstraint != _aadblJacobian[i].length || - !org.drip.quant.common.NumberUtil.IsValid (_aadblJacobian[i])) - throw new java.lang.Exception - ("ConstraintFunctionPointMetrics Constructor => Invalid Inputs"); - } - } - - /** - * Retrieve the Constraint Count - * - * @return The Constraint Count - */ - - public int count() - { - return _adblValue.length; - } - - /** - * Retrieve the Constraint Dimension - * - * @return The Constraint Dimension - */ - - public int dimension() - { - return _aadblJacobian.length; - } - - /** - * Retrieve the Constraint Value Array - * - * @return The Constraint Value Array - */ - - public double[] value() - { - return _adblValue; - } - - /** - * Retrieve the Constraint KKR Multiplier Array - * - * @return The Constraint KKR Multiplier Array - */ - - public double[] multiplier() - { - return _adblMultiplier; - } - - /** - * Retrieve the Constraint Jacobian Matrix - * - * @return The Constraint Jacobian Matrix - */ - - public double[][] jacobian() - { - return _aadblJacobian; - } -} diff --git a/org/drip/function/rdtor1solver/ConvergenceControl.java b/org/drip/function/rdtor1solver/ConvergenceControl.java deleted file mode 100644 index c59af10..0000000 --- a/org/drip/function/rdtor1solver/ConvergenceControl.java +++ /dev/null @@ -1,161 +0,0 @@ - -package org.drip.function.rdtor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ConvergenceControl contains the R^d To R^1 Convergence Control/Tuning Parameters. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConvergenceControl { - - /** - * Solve Using the Convergence of the Objective Function Realization - */ - - public static final int OBJECTIVE_FUNCTION_SEQUENCE_CONVERGENCE = 1; - - /** - * Solve Using the Convergence of the Variate/Constraint Multiplier Tuple Realization - */ - - public static final int VARIATE_CONSTRAINT_SEQUENCE_CONVERGENCE = 2; - - private int _iNumFinderSteps = -1; - private double _dblAbsoluteTolerance = java.lang.Double.NaN; - private double _dblRelativeTolerance = java.lang.Double.NaN; - private int _iConvergenceType = VARIATE_CONSTRAINT_SEQUENCE_CONVERGENCE; - - /** - * Construct a Standard ConvergenceControl Instance - * - * @return The Standard ConvergenceControl Instance - */ - - public static ConvergenceControl Standard() - { - try { - return new ConvergenceControl (VARIATE_CONSTRAINT_SEQUENCE_CONVERGENCE, 5.0e-02, 1.0e-06, 70); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * ConvergenceControl Constructor - * - * @param iConvergenceType The Convergence Type - * @param dblRelativeTolerance The Objective Function Relative Tolerance - * @param dblAbsoluteTolerance The Objective Function Absolute Tolerance - * @param iNumFinderSteps The Number of the Fixed Point Finder Steps - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ConvergenceControl ( - final int iConvergenceType, - final double dblRelativeTolerance, - final double dblAbsoluteTolerance, - final int iNumFinderSteps) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblRelativeTolerance = dblRelativeTolerance) || - !org.drip.quant.common.NumberUtil.IsValid (_dblAbsoluteTolerance = dblAbsoluteTolerance) || 1 > - (_iNumFinderSteps = iNumFinderSteps)) - throw new java.lang.Exception ("ConvergenceControl Constructor => Invalid Inputs"); - - _iConvergenceType = iConvergenceType; - } - - /** - * Retrieve the Convergence Type - * - * @return The Convergence Type - */ - - public int convergenceType() - { - return _iConvergenceType; - } - - /** - * Retrieve the Number of Finder Steps - * - * @return The Number of Finder Steps - */ - - public int numFinderSteps() - { - return _iNumFinderSteps; - } - - /** - * Retrieve the Relative Tolerance - * - * @return The Relative Tolerance - */ - - public double relativeTolerance() - { - return _dblRelativeTolerance; - } - - /** - * Retrieve the Absolute Tolerance - * - * @return The Absolute Tolerance - */ - - public double absoluteTolerance() - { - return _dblAbsoluteTolerance; - } -} diff --git a/org/drip/function/rdtor1solver/FixedRdFinder.java b/org/drip/function/rdtor1solver/FixedRdFinder.java deleted file mode 100644 index 64407f7..0000000 --- a/org/drip/function/rdtor1solver/FixedRdFinder.java +++ /dev/null @@ -1,331 +0,0 @@ - -package org.drip.function.rdtor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FixedRdFinder exports the Methods needed for the locating a Fixed R^d Point. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class FixedRdFinder { - - /** - * Flag Indicating whether the Verifier Increment Metrics are to be Traced - */ - - public static boolean s_bVerifierIncrementBlog = false; - - private org.drip.function.rdtor1solver.ConvergenceControl _cc = null; - private org.drip.function.definition.RdToR1 _rdToR1ObjectiveFunction = null; - private org.drip.function.rdtor1descent.LineStepEvolutionControl _lsec = null; - - protected FixedRdFinder ( - final org.drip.function.definition.RdToR1 rdToR1ObjectiveFunction, - final org.drip.function.rdtor1descent.LineStepEvolutionControl lsec, - final org.drip.function.rdtor1solver.ConvergenceControl cc) - throws java.lang.Exception - { - if (null == (_rdToR1ObjectiveFunction = rdToR1ObjectiveFunction) || null == (_cc = cc)) - throw new java.lang.Exception ("FixedRdFinder Constructor => Invalid Inputs"); - - _lsec = lsec; - } - - /** - * Retrieve the Objective Function - * - * @return The Objective Function - */ - - public org.drip.function.definition.RdToR1 objectiveFunction() - { - return _rdToR1ObjectiveFunction; - } - - /** - * Retrieve the Line Step Evolution Control - * - * @return The Line Step Evolution Control - */ - - public org.drip.function.rdtor1descent.LineStepEvolutionControl lineStepEvolutionControl() - { - return _lsec; - } - - /** - * Retrieve the Convergence Control Parameters - * - * @return The Convergence Control Parameters - */ - - public org.drip.function.rdtor1solver.ConvergenceControl control() - { - return _cc; - } - - /** - * Solve for the Optimal Variate-Inequality Constraint Multiplier Tuple Using the Variate/Inequality - * Constraint Tuple Convergence - * - * @param vicmStarting The Starting Variate/Inequality Constraint Tuple Set - * - * @return The Optimal Variate-Inequality Constraint Multiplier Tuple - */ - - public org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier convergeVariate ( - final org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier vicmStarting) - { - if (null == vicmStarting) return null; - - org.drip.function.definition.RdToR1 rdToR1ObjectiveFunction = objectiveFunction(); - - boolean bFixedPointFound = false; - org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier vicmCurrent = vicmStarting; - org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier vicmPrevious = vicmStarting; - - int iNumComparisonVariate = rdToR1ObjectiveFunction instanceof - org.drip.function.rdtor1.LagrangianMultivariate ? - ((org.drip.function.rdtor1.LagrangianMultivariate) - rdToR1ObjectiveFunction).objectiveFunctionDimension() : - rdToR1ObjectiveFunction.dimension(); - - org.drip.function.rdtor1solver.ConvergenceControl cc = control(); - - double dblAbsoluteToleranceFallback = cc.absoluteTolerance(); - - double dblRelativeTolerance = cc.relativeTolerance(); - - while (!bFixedPointFound) { - org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier vicmIncrement = increment - (vicmCurrent); - - if (null == vicmIncrement || null == (vicmCurrent = next (vicmPrevious, vicmIncrement, - incrementFraction (vicmCurrent, vicmIncrement)))) - return null; - - try { - bFixedPointFound = - org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier.Compare - (vicmCurrent, vicmPrevious, dblRelativeTolerance, dblAbsoluteToleranceFallback, - iNumComparisonVariate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - vicmPrevious = vicmCurrent; - } - - return vicmCurrent; - } - - /** - * Solve for the Optimal Variate-Inequality Constraint Multiplier Tuple Using the Objective Function - * Convergence - * - * @param vicmStarting The Starting Variate/Inequality Constraint Tuple Set - * - * @return The Optimal Variate-Inequality Constraint Multiplier Tuple - */ - - public org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier convergeObjectiveFunction ( - final org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier vicmStarting) - { - if (null == vicmStarting) return null; - - boolean bFixedPointFound = false; - double dblObjectiveFunctionPrevious = java.lang.Double.NaN; - org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier vicm = vicmStarting; - - org.drip.function.definition.RdToR1 rdToR1ObjectiveFunction = objectiveFunction(); - - try { - dblObjectiveFunctionPrevious = rdToR1ObjectiveFunction.evaluate (vicm.variates()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.function.rdtor1solver.ConvergenceControl cc = control(); - - double dblIPBCAbsoluteTolerance = cc.absoluteTolerance(); - - double dblOFAbsoluteTolerance = java.lang.Math.abs (dblObjectiveFunctionPrevious * - cc.relativeTolerance()); - - double dblAbsoluteTolerance = dblIPBCAbsoluteTolerance < dblOFAbsoluteTolerance ? - dblIPBCAbsoluteTolerance : dblOFAbsoluteTolerance; - - while (!bFixedPointFound) { - org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier vicmIncrement = increment - (vicm); - - if (null == vicmIncrement || null == (vicm = next (vicm, vicmIncrement, incrementFraction (vicm, - vicmIncrement)))) - return null; - - try { - double dblObjectiveFunction = rdToR1ObjectiveFunction.evaluate (vicm.variates()); - - if (java.lang.Math.abs (dblObjectiveFunctionPrevious - dblObjectiveFunction) < - dblAbsoluteTolerance) - bFixedPointFound = true; - - dblObjectiveFunctionPrevious = dblObjectiveFunction; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return vicm; - } - - /** - * Find the Optimal Variate-Inequality Constraint Multiplier Tuple using the Iteration Parameters - * provided by the Convergence Control Instance - * - * @param vicmStarting The Starting Variate-Inequality Constraint Multiplier Tuple - * - * @return The Optimal Variate-Inequality Constraint Multiplier Tuple - */ - - public org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier find ( - final org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier vicmStarting) - { - int iConvergenceType = control().convergenceType(); - - if (org.drip.function.rdtor1solver.InteriorPointBarrierControl.OBJECTIVE_FUNCTION_SEQUENCE_CONVERGENCE - == iConvergenceType) - return convergeObjectiveFunction (vicmStarting); - - if (org.drip.function.rdtor1solver.InteriorPointBarrierControl.VARIATE_CONSTRAINT_SEQUENCE_CONVERGENCE - == iConvergenceType) - return convergeVariate (vicmStarting); - - return null; - } - - /** - * Retrieve the Incremental Step Length Fraction - * - * @param vicm The VICM Base Instance - * @param vicmFullIncrement The Full VICM Instance Increment - * - * @return The VICM Incremental Step Length Fraction - */ - - public double incrementFraction ( - final org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier vicm, - final org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier vicmFullIncrement) - { - if (null == _lsec || null == vicm || vicm.incremental() || null == vicmFullIncrement || - !vicmFullIncrement.incremental()) - return 1.; - - org.drip.function.rdtor1descent.LineEvolutionVerifier lev = _lsec.lineEvolutionVerifier(); - - org.drip.function.definition.SizedVector sv = vicmFullIncrement.variateIncrementVector(); - - org.drip.function.definition.UnitVector uvDirection = sv.direction(); - - double dblReductionFactor = _lsec.reductionFactor(); - - int iReductionStep = _lsec.reductionSteps(); - - double[] adblVariate = vicm.variates(); - - double dblStepLength = 1.; - - while (0 <= --iReductionStep) { - org.drip.function.rdtor1descent.LineEvolutionVerifierMetrics levm = lev.metrics (uvDirection, - adblVariate, _rdToR1ObjectiveFunction, dblStepLength); - - if (null == levm) return 1.; - - if (s_bVerifierIncrementBlog) System.out.println (levm); - - if (levm.verify()) return dblStepLength; - - dblStepLength *= dblReductionFactor; - } - - return 1.; - } - - /** - * Produce the Incremental Variate-Constraint Multiplier - * - * @param vcmtCurrent The Current Variate-Constraint Multiplier Tuple - * - * @return The Incremental Variate-Constraint Multiplier - */ - - abstract public org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier increment ( - final org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier vcmtCurrent); - - /** - * Iterate Over to the Next Variate-Constraint Multiplier Tuple - * - * @param vcmtCurrent The Current Variate-Constraint Multiplier Tuple - * @param vcmtIncrement The Incremental Variate-Constraint Multiplier Tuple - * @param dblIncrementFraction The Incremental Fraction to be applied - * - * @return The Next Variate-Constraint Multiplier Set - */ - - abstract public org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier next ( - final org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier vcmtCurrent, - final org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier vcmtIncrement, - final double dblIncrementFraction); -} diff --git a/org/drip/function/rdtor1solver/InteriorFixedPointFinder.java b/org/drip/function/rdtor1solver/InteriorFixedPointFinder.java deleted file mode 100644 index f0632ef..0000000 --- a/org/drip/function/rdtor1solver/InteriorFixedPointFinder.java +++ /dev/null @@ -1,266 +0,0 @@ - -package org.drip.function.rdtor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * InteriorFixedPointFinder generates the Iterators for solving R^d To R^1 Convex/Non-Convex Functions Under - * Inequality Constraints loaded using a Barrier Coefficient. - * - * @author Lakshmi Krishnamurthy - */ - -public class InteriorFixedPointFinder extends org.drip.function.rdtor1solver.FixedRdFinder { - private double _dblBarrierStrength = java.lang.Double.NaN; - private org.drip.function.rdtor1.BoundMultivariate[] _aBM = null; - private org.drip.function.definition.RdToR1[] _aRdToR1InequalityConstraint = null; - - private org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier incremental ( - final org.drip.function.rdtor1solver.ObjectiveFunctionPointMetrics ofpm, - final org.drip.function.rdtor1solver.ConstraintFunctionPointMetrics cfpmInequality) - { - if (null == ofpm || null == cfpmInequality) return null; - - int iDimension = ofpm.dimension(); - - int iNumInequalityConstraint = cfpmInequality.count(); - - double[] adblObjectiveFunctionJacobian = ofpm.jacobian(); - - double[][] aadblObjectiveFunctionHessian = ofpm.hessian(); - - double[] adblInequalityConstraintMultiplierIncrement = new double[iNumInequalityConstraint]; - double[] adblVariateIncrement = new double[iDimension]; - int iMSize = iDimension + iNumInequalityConstraint; - double[][] aadblM = new double[iMSize][iMSize]; - double[] adblRHS = new double[iMSize]; - - if (0 == iDimension || iDimension != cfpmInequality.dimension()) return null; - - double[] adblInequalityConstraintMultiplier = cfpmInequality.multiplier(); - - double[][] aadblInequalityConstraintJacobian = cfpmInequality.jacobian(); - - double[] adblInequalityConstraintValue = cfpmInequality.value(); - - for (int i = 0; i < iDimension; ++i) { - for (int j = 0; j < iDimension; ++j) - aadblM[i][j] = aadblObjectiveFunctionHessian[i][j]; - - for (int j = 0; j < iNumInequalityConstraint; ++j) - aadblM[i][j + iDimension] = -1. * aadblInequalityConstraintJacobian[i][j]; - } - - for (int i = 0; i < iNumInequalityConstraint; ++i) { - for (int j = 0; j < iNumInequalityConstraint; ++j) - aadblM[i + iDimension][j + iDimension] = i == j ? adblInequalityConstraintValue[i] : 0.; - - for (int j = 0; j < iDimension; ++j) - aadblM[i + iDimension][j] = adblInequalityConstraintMultiplier[i] * - aadblInequalityConstraintJacobian[j][i]; - } - - for (int i = 0; i < iMSize; ++i) { - if (i < iDimension) { - adblRHS[i] = -1. * adblObjectiveFunctionJacobian[i]; - - for (int j = 0; j < iNumInequalityConstraint; ++j) - adblRHS[i] += aadblInequalityConstraintJacobian[i][j] * - adblInequalityConstraintMultiplier[j]; - } else { - int iConstraintIndex = i - iDimension; - adblRHS[i] = _dblBarrierStrength - adblInequalityConstraintValue[iConstraintIndex] * - adblInequalityConstraintMultiplier[iConstraintIndex]; - } - } - - org.drip.quant.linearalgebra.LinearizationOutput lo = - org.drip.quant.linearalgebra.LinearSystemSolver.SolveUsingMatrixInversion (aadblM, adblRHS); - - if (null == lo) return null; - - double[] adblIncrement = lo.getTransformedRHS(); - - if (null == adblIncrement || adblIncrement.length != iMSize) return null; - - for (int i = 0; i < iMSize; ++i) { - if (i < iDimension) - adblVariateIncrement[i] = adblIncrement[i]; - else - adblInequalityConstraintMultiplierIncrement[i - iDimension] = adblIncrement[i]; - } - - try { - return new org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier (true, - adblVariateIncrement, adblInequalityConstraintMultiplierIncrement); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * InteriorFixedPointFinder Constructor - * - * @param rdToR1ObjectiveFunction The Objective Function - * @param aRdToR1InequalityConstraint Array of Inequality Constraints - * @param lsec The Line Step Evolution Control - * @param cc Convergence Control Parameters - * @param dblBarrierStrength Barrier Strength - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public InteriorFixedPointFinder ( - final org.drip.function.definition.RdToR1 rdToR1ObjectiveFunction, - final org.drip.function.definition.RdToR1[] aRdToR1InequalityConstraint, - final org.drip.function.rdtor1descent.LineStepEvolutionControl lsec, - final org.drip.function.rdtor1solver.ConvergenceControl cc, - final double dblBarrierStrength) - throws java.lang.Exception - { - super (rdToR1ObjectiveFunction, lsec, cc); - - if (null == (_aRdToR1InequalityConstraint = aRdToR1InequalityConstraint) || - !org.drip.quant.common.NumberUtil.IsValid (_dblBarrierStrength = dblBarrierStrength)) - throw new java.lang.Exception ("InteriorFixedPointFinder Constructor => Invalid Inputs"); - - int iNumInequalityConstraint = _aRdToR1InequalityConstraint.length; - _aBM = 0 == iNumInequalityConstraint ? null : new - org.drip.function.rdtor1.BoundMultivariate[iNumInequalityConstraint]; - - if (0 == iNumInequalityConstraint) - throw new java.lang.Exception ("InteriorFixedPointFinder Constructor => Invalid Inputs"); - - for (int i = 0; i < iNumInequalityConstraint; ++i) { - if (null == _aRdToR1InequalityConstraint[i]) - throw new java.lang.Exception ("InteriorFixedPointFinder Constructor => Invalid Inputs"); - - if (_aRdToR1InequalityConstraint[i] instanceof org.drip.function.rdtor1.BoundMultivariate) - _aBM[i] = (org.drip.function.rdtor1.BoundMultivariate) _aRdToR1InequalityConstraint[i]; - } - } - - /** - * Retrieve the Array of Inequality Constraints - * - * @return The Array of Inequality Constraints - */ - - public org.drip.function.definition.RdToR1[] inequalityConstraints() - { - return _aRdToR1InequalityConstraint; - } - - /** - * Retrieve the Barrier Strength - * - * @return The Barrier Strength - */ - - public double barrierStrength() - { - return _dblBarrierStrength; - } - - @Override public org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier increment ( - final org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier vicmCurrent) - { - if (null == vicmCurrent) return null; - - double[] adblVariate = vicmCurrent.variates(); - - int iNumVariate = adblVariate.length; - int iNumInequalityConstraint = _aRdToR1InequalityConstraint.length; - double[] adblInequalityConstraintValue = new double[iNumInequalityConstraint]; - double[][] aadblInequalityConstraintJacobian = new double[iNumVariate][iNumInequalityConstraint]; - - if (0 == iNumInequalityConstraint) return null; - - for (int i = 0; i < iNumInequalityConstraint; ++i) { - try { - adblInequalityConstraintValue[i] = _aRdToR1InequalityConstraint[i].evaluate (adblVariate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - double[] adblInequalityConstraintJacobian = _aRdToR1InequalityConstraint[i].jacobian - (adblVariate); - - if (null == adblInequalityConstraintJacobian) return null; - - for (int j = 0; j < iNumVariate; ++j) - aadblInequalityConstraintJacobian[j][i] = adblInequalityConstraintJacobian[j]; - } - - org.drip.function.definition.RdToR1 rdToR1ObjectiveFunction = objectiveFunction(); - - try { - return incremental (new org.drip.function.rdtor1solver.ObjectiveFunctionPointMetrics - (rdToR1ObjectiveFunction.jacobian (adblVariate), rdToR1ObjectiveFunction.hessian - (adblVariate)), new org.drip.function.rdtor1solver.ConstraintFunctionPointMetrics - (adblInequalityConstraintValue, aadblInequalityConstraintJacobian, - vicmCurrent.constraintMultipliers())); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier next ( - final org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier vcmtCurrent, - final org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier vcmtIncrement, - final double dblIncrementFraction) - { - return org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier.Add (vcmtCurrent, - vcmtIncrement, dblIncrementFraction, _aBM); - } -} diff --git a/org/drip/function/rdtor1solver/InteriorPointBarrierControl.java b/org/drip/function/rdtor1solver/InteriorPointBarrierControl.java deleted file mode 100644 index ff52891..0000000 --- a/org/drip/function/rdtor1solver/InteriorPointBarrierControl.java +++ /dev/null @@ -1,141 +0,0 @@ - -package org.drip.function.rdtor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * InteriorPointBarrierControl contains the Barrier Iteration Control Parameters. - * - * @author Lakshmi Krishnamurthy - */ - -public class InteriorPointBarrierControl extends org.drip.function.rdtor1solver.ConvergenceControl { - private int _iNumDecaySteps = -1; - private double _dblDecayVelocity = java.lang.Double.NaN; - private double _dblInitialStrength = java.lang.Double.NaN; - - /** - * Construct a Standard InteriorPointBarrierControl Instance - * - * @return The Standard InteriorPointBarrierControl Instance - */ - - public static InteriorPointBarrierControl Standard() - { - try { - return new InteriorPointBarrierControl (VARIATE_CONSTRAINT_SEQUENCE_CONVERGENCE, 5.0e-02, - 1.0e-06, 1.0e+04, 0.5, 70); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * InteriorPointBarrierControl Constructor - * - * @param iConvergenceType The Convergence Type - * @param dblRelativeTolerance The Objective Function Relative Tolerance - * @param dblAbsoluteTolerance The Objective Function Absolute Tolerance - * @param dblInitialStrength The Initial Barrier Strength Level - * @param dblDecayVelocity The Barrier Decay Velocity - * @param iNumDecaySteps The Number Barrier Decay Steps - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public InteriorPointBarrierControl ( - final int iConvergenceType, - final double dblRelativeTolerance, - final double dblAbsoluteTolerance, - final double dblInitialStrength, - final double dblDecayVelocity, - final int iNumDecaySteps) - throws java.lang.Exception - { - super (iConvergenceType, dblRelativeTolerance, dblAbsoluteTolerance, 100); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblInitialStrength = dblInitialStrength) || - !org.drip.quant.common.NumberUtil.IsValid (_dblDecayVelocity = dblDecayVelocity) || 1 > - (_iNumDecaySteps = iNumDecaySteps)) - throw new java.lang.Exception ("InteriorPointBarrierControl Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Number of Decay Steps - * - * @return The Number of Decay Steps - */ - - public int numDecaySteps() - { - return _iNumDecaySteps; - } - - /** - * Retrieve the Initial Barrier Strength - * - * @return The Initial Barrier Strength - */ - - public double initialStrength() - { - return _dblInitialStrength; - } - - /** - * Retrieve the Decay Velocity - * - * @return The Decay Velocity - */ - - public double decayVelocity() - { - return _dblDecayVelocity; - } -} diff --git a/org/drip/function/rdtor1solver/NewtonFixedPointFinder.java b/org/drip/function/rdtor1solver/NewtonFixedPointFinder.java deleted file mode 100644 index fdf88dd..0000000 --- a/org/drip/function/rdtor1solver/NewtonFixedPointFinder.java +++ /dev/null @@ -1,117 +0,0 @@ - -package org.drip.function.rdtor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NewtonFixedPointFinder generates the Iterators for solving R^d To R^1 Convex/Non-Convex Functions Using - * the Multivariate Newton Method. - * - * @author Lakshmi Krishnamurthy - */ - -public class NewtonFixedPointFinder extends org.drip.function.rdtor1solver.FixedRdFinder { - - /** - * NewtonFixedPointFinder Constructor - * - * @param rdToR1ObjectiveFunction The Objective Function - * @param lsec The Line Step Evolution Control - * @param cc Convergence Control Parameters - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public NewtonFixedPointFinder ( - final org.drip.function.definition.RdToR1 rdToR1ObjectiveFunction, - final org.drip.function.rdtor1descent.LineStepEvolutionControl lsec, - final org.drip.function.rdtor1solver.ConvergenceControl cc) - throws java.lang.Exception - { - super (rdToR1ObjectiveFunction, lsec, cc); - } - - @Override public org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier increment ( - final org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier vcmtCurrent) - { - if (null == vcmtCurrent) return null; - - double[] adblVariate = vcmtCurrent.variates(); - - org.drip.function.definition.RdToR1 rdToR1ObjectiveFunction = objectiveFunction(); - - double[] adblVariateIncrement = org.drip.quant.linearalgebra.Matrix.Product - (org.drip.quant.linearalgebra.Matrix.InvertUsingGaussianElimination - (rdToR1ObjectiveFunction.hessian (adblVariate)), rdToR1ObjectiveFunction.jacobian - (adblVariate)); - - if (null == adblVariateIncrement) return null; - - int iVariateDimension = adblVariateIncrement.length; - - for (int i = 0; i < iVariateDimension; ++i) - adblVariateIncrement[i] = -1. * adblVariateIncrement[i]; - - try { - return new org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier (true, - adblVariateIncrement, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier next ( - final org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier vcmtCurrent, - final org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier vcmtIncrement, - final double dblIncrementFraction) - { - return org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier.Add (vcmtCurrent, - vcmtIncrement, dblIncrementFraction, null); - } -} diff --git a/org/drip/function/rdtor1solver/ObjectiveFunctionPointMetrics.java b/org/drip/function/rdtor1solver/ObjectiveFunctionPointMetrics.java deleted file mode 100644 index 6eaa0b7..0000000 --- a/org/drip/function/rdtor1solver/ObjectiveFunctionPointMetrics.java +++ /dev/null @@ -1,123 +0,0 @@ - -package org.drip.function.rdtor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ObjectiveFunctionPointMetrics holds the R^d Point Base and Sensitivity Metrics of the Objective Function. - * - * @author Lakshmi Krishnamurthy - */ - -public class ObjectiveFunctionPointMetrics { - private double[] _adblJacobian = null; - private double[][] _aadblHessian = null; - - /** - * ObjectiveFunctionPointMetrics Constructor - * - * @param adblJacobian The Jacobian Array - * @param aadblHessian The Hessian Matrix - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public ObjectiveFunctionPointMetrics ( - final double[] adblJacobian, - final double[][] aadblHessian) - throws java.lang.Exception - { - if (null == (_adblJacobian = adblJacobian) || null == (_aadblHessian = aadblHessian)) - throw new java.lang.Exception ("ObjectiveFunctionPointMetrics Constructor => Invalid Inputs"); - - int iDimension = _adblJacobian.length; - - if (0 == iDimension || iDimension != _aadblHessian.length) - throw new java.lang.Exception ("ObjectiveFunctionPointMetrics Constructor => Invalid Inputs"); - - for (int i = 0; i < iDimension; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (adblJacobian[i]) || null == _aadblHessian[i] || - iDimension != _aadblHessian[i].length || !org.drip.quant.common.NumberUtil.IsValid - (_aadblHessian[i])) - throw new java.lang.Exception - ("ObjectiveFunctionPointMetrics Constructor => Invalid Inputs"); - } - } - - /** - * Retrieve the Dimension - * - * @return The Dimension - */ - - public int dimension() - { - return _adblJacobian.length; - } - - /** - * Retrieve the Jacobian Array - * - * @return The Jacobian Array - */ - - public double[] jacobian() - { - return _adblJacobian; - } - - /** - * Retrieve the Hessian Matrix - * - * @return The Hessian Matrix - */ - - public double[][] hessian() - { - return _aadblHessian; - } -} diff --git a/org/drip/function/rdtor1solver/VariateInequalityConstraintMultiplier.java b/org/drip/function/rdtor1solver/VariateInequalityConstraintMultiplier.java deleted file mode 100644 index 06e84e5..0000000 --- a/org/drip/function/rdtor1solver/VariateInequalityConstraintMultiplier.java +++ /dev/null @@ -1,456 +0,0 @@ - -package org.drip.function.rdtor1solver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * VariateInequalityConstraintMultiplier holds the Variates and their Inequality Constraint Multipliers in - * either the Absolute or the Incremental Forms. - * - * @author Lakshmi Krishnamurthy - */ - -public class VariateInequalityConstraintMultiplier { - - /** - * Flag Indicating whether the Variate Contents are to be Logged "Before" Bounding - */ - - public static boolean s_bPreBoundBlog = false; - - /** - * Flag Indicating whether the Variate Contents are to be Logged "After" Bounding - */ - - public static boolean s_bPostBoundBlog = false; - - private double[] _adblVariate = null; - private boolean _bIncremental = false; - private double[] _adblConstraintMultiplier = null; - - /** - * Add the Specified VICM Instances together - * - * @param vicmBase VICM Instance Base - * @param vicmIncrement VICM Instance Increment - * @param dblIncrementFactor The Increment Factor - 1. corresponds to Full Increment - * @param aBM Array of Bounded Multivariate Stubs - * - * @return The Added VICM Instance - */ - - public static final VariateInequalityConstraintMultiplier Add ( - final VariateInequalityConstraintMultiplier vicmBase, - final VariateInequalityConstraintMultiplier vicmIncrement, - final double dblIncrementFactor, - final org.drip.function.rdtor1.BoundMultivariate[] aBM) - { - if (null == vicmBase || null == vicmIncrement || vicmBase.incremental() || - !vicmIncrement.incremental() || !org.drip.quant.common.NumberUtil.IsValid (dblIncrementFactor) || - 1. < dblIncrementFactor) - return null; - - double[] adblVariateBase = vicmBase.variates(); - - double[] adblVariateIncrement = vicmIncrement.variates(); - - double[] adblInequalityConstraintMultiplierBase = vicmBase.constraintMultipliers(); - - double[] adblInequalityConstraintMultiplierIncrement = vicmIncrement.constraintMultipliers(); - - int iNumVariate = adblVariateBase.length; - int iNumBounder = null == aBM ? 0 : aBM.length; - double[] adblVariate = new double[iNumVariate]; - int iNumInequalityConstraint = null == adblInequalityConstraintMultiplierBase ? 0 : - adblInequalityConstraintMultiplierBase.length; - int iNumInequalityConstraintIncrement = null == adblInequalityConstraintMultiplierIncrement ? 0 : - adblInequalityConstraintMultiplierIncrement.length; - double[] adblInequalityConstraintMultiplier = 0 == iNumInequalityConstraint ? null : new - double[iNumInequalityConstraint]; - - if (iNumVariate != adblVariateIncrement.length || iNumInequalityConstraint != - iNumInequalityConstraintIncrement) - return null; - - for (int i = 0; i < iNumVariate; ++i) - adblVariate[i] = adblVariateBase[i] + dblIncrementFactor * adblVariateIncrement[i]; - - if (s_bPreBoundBlog) { - java.lang.String strDump = "\tB"; - - for (int i = 0; i < iNumVariate; ++i) - strDump += " " + org.drip.quant.common.FormatUtil.FormatDouble (adblVariate[i], 2, 2, 100.) + - " |"; - - System.out.println (strDump); - } - - for (int i = 0; i < iNumInequalityConstraint; ++i) { - if (0. > (adblInequalityConstraintMultiplier[i] = adblInequalityConstraintMultiplierBase[i] + - dblIncrementFactor * adblInequalityConstraintMultiplierIncrement[i])) - adblInequalityConstraintMultiplier[i] = 0.; - - if (iNumBounder <= i || null == aBM[i]) continue; - - int iBoundVariateIndex = aBM[i].boundVariateIndex(); - - try { - if (aBM[i].violated (adblVariate[iBoundVariateIndex])) - adblVariate[iBoundVariateIndex] = aBM[i].boundValue(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - if (s_bPostBoundBlog) { - java.lang.String strDump = "\tA"; - - for (int i = 0; i < iNumVariate; ++i) - strDump += " " + org.drip.quant.common.FormatUtil.FormatDouble (adblVariate[i], 2, 2, 100.) + - " |"; - - System.out.println (strDump); - } - - try { - return new VariateInequalityConstraintMultiplier (false, adblVariate, - adblInequalityConstraintMultiplier); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Add the Specified VICM Instances together - * - * @param vicmBase VICM Instance Base - * @param vicmIncrement VICM Instance Increment - * @param aBM Array of Bounded Multivariate Stubs - * - * @return The Added VICM Instance - */ - - public static final VariateInequalityConstraintMultiplier Add ( - final VariateInequalityConstraintMultiplier vicmBase, - final VariateInequalityConstraintMultiplier vicmIncrement, - final org.drip.function.rdtor1.BoundMultivariate[] aBM) - { - return Add (vicmBase, vicmIncrement, 1., aBM); - } - - /** - * Subtract the Second VICM Instance from the First - * - * @param vicmBase VICM Instance Base - * @param vicmIncrement VICM Instance Increment - * @param dblIncrementFactor The Increment Factor - 1. corresponds to Full Increment - * @param aBM Array of Bounded Multivariate Stubs - * - * @return The Subtracted VICM Instance - */ - - public static final VariateInequalityConstraintMultiplier Subtract ( - final VariateInequalityConstraintMultiplier vicmBase, - final VariateInequalityConstraintMultiplier vicmIncrement, - final double dblIncrementFactor, - final org.drip.function.rdtor1.BoundMultivariate[] aBM) - { - if (null == vicmBase || null == vicmIncrement || vicmBase.incremental() || - !vicmIncrement.incremental() || !org.drip.quant.common.NumberUtil.IsValid (dblIncrementFactor) || - 1. < dblIncrementFactor) - return null; - - double[] adblVariateBase = vicmBase.variates(); - - double[] adblVariateIncrement = vicmIncrement.variates(); - - double[] adblInequalityConstraintMultiplierBase = vicmBase.constraintMultipliers(); - - double[] adblInequalityConstraintMultiplierIncrement = vicmIncrement.constraintMultipliers(); - - int iNumVariate = adblVariateBase.length; - int iNumBounder = null == aBM ? 0 : aBM.length; - double[] adblVariate = new double[iNumVariate]; - int iNumInequalityConstraint = null == adblInequalityConstraintMultiplierBase ? 0 : - adblInequalityConstraintMultiplierBase.length; - int iNumInequalityConstraintIncrement = null == adblInequalityConstraintMultiplierIncrement ? 0 : - adblInequalityConstraintMultiplierIncrement.length; - double[] adblInequalityConstraintMultiplier = 0 == iNumInequalityConstraint ? null : new - double[iNumInequalityConstraint]; - - if (iNumVariate != adblVariateIncrement.length || iNumInequalityConstraint != - iNumInequalityConstraintIncrement) - return null; - - for (int i = 0; i < iNumVariate; ++i) - adblVariate[i] = adblVariateBase[i] - dblIncrementFactor * adblVariateIncrement[i]; - - if (s_bPreBoundBlog) { - java.lang.String strDump = "\tB"; - - for (int i = 0; i < iNumVariate; ++i) - strDump += " " + org.drip.quant.common.FormatUtil.FormatDouble (adblVariate[i], 2, 2, 100.) + - " |"; - - System.out.println (strDump); - } - - for (int i = 0; i < iNumInequalityConstraint; ++i) { - if (0. > (adblInequalityConstraintMultiplier[i] = adblInequalityConstraintMultiplierBase[i] - - dblIncrementFactor * adblInequalityConstraintMultiplierIncrement[i])) - adblInequalityConstraintMultiplier[i] = 0.; - - if (iNumBounder <= i || null == aBM[i]) continue; - - int iBoundVariateIndex = aBM[i].boundVariateIndex(); - - try { - if (aBM[i].violated (adblVariate[iBoundVariateIndex])) - adblVariate[iBoundVariateIndex] = aBM[i].boundValue(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - if (s_bPostBoundBlog) { - java.lang.String strDump = "\tA"; - - for (int i = 0; i < iNumVariate; ++i) - strDump += " " + org.drip.quant.common.FormatUtil.FormatDouble (adblVariate[i], 2, 2, 100.) + - " |"; - - System.out.println (strDump); - } - - try { - return new VariateInequalityConstraintMultiplier (false, adblVariate, - adblInequalityConstraintMultiplier); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Subtract the Second VICM Instance from the First - * - * @param vicmBase VICM Instance Base - * @param vicmIncrement VICM Instance Increment - * @param aBM Array of Bounded Multivariate Stubs - * - * @return The Subtracted VICM Instance - */ - - public static final VariateInequalityConstraintMultiplier Subtract ( - final VariateInequalityConstraintMultiplier vicmBase, - final VariateInequalityConstraintMultiplier vicmIncrement, - final org.drip.function.rdtor1.BoundMultivariate[] aBM) - { - return Subtract (vicmBase, vicmIncrement, 1., aBM); - } - - /** - * Compare the Specified VICM Instances - * - * @param vicm1 VICM Instance #1 - * @param vicm2 VICM Instance #2 - * @param dblRelativeTolerance The Relative Tolerance Between the Variates - * @param dblAbsoluteToleranceFallback The Absolute Tolerance Fall-back Between the Variates - * @param iNumComparisonVariate The Number of Variates to Compare - * - * @return TRUE - The VICM Instances are Close (Enough) - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final boolean Compare ( - final VariateInequalityConstraintMultiplier vicm1, - final VariateInequalityConstraintMultiplier vicm2, - final double dblRelativeTolerance, - final double dblAbsoluteToleranceFallback, - final int iNumComparisonVariate) - throws java.lang.Exception - { - if (null == vicm1 || null == vicm2 || vicm1.incremental() || vicm2.incremental() || - !org.drip.quant.common.NumberUtil.IsValid (dblRelativeTolerance) || - !org.drip.quant.common.NumberUtil.IsValid (dblAbsoluteToleranceFallback) || 0 > - dblAbsoluteToleranceFallback) - throw new java.lang.Exception ("VariateInequalityConstraintMultiplier::Compare => Invalid Inputs"); - - double[] adblVariate1 = vicm1.variates(); - - double[] adblVariate2 = vicm2.variates(); - - int iNumVariate = adblVariate1.length; - - if (iNumVariate != adblVariate2.length || iNumComparisonVariate > iNumVariate) - throw new java.lang.Exception ("VariateInequalityConstraintMultiplier::Compare => Invalid Inputs"); - - for (int i = 0; i < iNumComparisonVariate; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (adblVariate1[i]) || - !org.drip.quant.common.NumberUtil.IsValid (adblVariate2[i])) - throw new java.lang.Exception - ("VariateInequalityConstraintMultiplier::Compare => Invalid Inputs"); - - double dblAbsoluteTolerance = java.lang.Math.abs (adblVariate1[i] * dblRelativeTolerance); - - if (dblAbsoluteTolerance < dblAbsoluteToleranceFallback) - dblAbsoluteTolerance = dblAbsoluteToleranceFallback; - - if (dblAbsoluteTolerance < java.lang.Math.abs (adblVariate1[i] - adblVariate2[i])) return false; - } - - return true; - } - - /** - * VariateInequalityConstraintMultiplier Constructor - * - * @param bIncremental TRUE - Tuple represents an Incremental Unit - * @param adblVariate Array of Variates - * @param adblConstraintMultiplier Array of Constraint Multipliers - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public VariateInequalityConstraintMultiplier ( - final boolean bIncremental, - final double[] adblVariate, - final double[] adblConstraintMultiplier) - throws java.lang.Exception - { - if (null == (_adblVariate = adblVariate) || 0 == _adblVariate.length) - throw new java.lang.Exception - ("VariateInequalityConstraintMultiplier Constructor => Invalid Inputs"); - - _bIncremental = bIncremental; - _adblConstraintMultiplier = adblConstraintMultiplier; - } - - /** - * Retrieve the Incremental Flag - * - * @return TRUE - Tuple is Incremental - */ - - public boolean incremental() - { - return _bIncremental; - } - - /** - * Retrieve the Array of Variates - * - * @return Array of Variates - */ - - public double[] variates() - { - return _adblVariate; - } - - /** - * Retrieve the Constraint Multipliers - * - * @return Array of Constraint Multipliers - */ - - public double[] constraintMultipliers() - { - return _adblConstraintMultiplier; - } - - /** - * Retrieve the Consolidated Variate/Constraint Multiplier Array - * - * @return The Consolidated Variate/Constraint Multiplier Array - */ - - public double[] variateConstraintMultipler() - { - int iNumVariate = _adblVariate.length; - int iNumVariateConstraintMultipler = iNumVariate + (null == _adblConstraintMultiplier ? 0 : - _adblConstraintMultiplier.length); - double[] adblVariateConstraintMultipler = new double[iNumVariateConstraintMultipler]; - - for (int i = 0; i < iNumVariateConstraintMultipler; ++i) - adblVariateConstraintMultipler[i] = i < iNumVariate ? _adblVariate[i] : - _adblConstraintMultiplier[i - iNumVariate]; - - return adblVariateConstraintMultipler; - } - - /** - * Retrieve the Sized Vector Instance corresponding to the Increment - * - * @return The Sized Vector Instance corresponding to the Increment - */ - - public org.drip.function.definition.SizedVector incrementVector() - { - return _bIncremental ? org.drip.function.definition.SizedVector.Standard - (variateConstraintMultipler()) : null; - } - - /** - * Retrieve the Sized Vector Instance corresponding to the Variate Increment - * - * @return The Sized Vector Instance corresponding to the Variate Increment - */ - - public org.drip.function.definition.SizedVector variateIncrementVector() - { - return _bIncremental ? org.drip.function.definition.SizedVector.Standard (_adblVariate) : null; - } -} diff --git a/org/drip/historical/attribution/BondMarketSnap.java b/org/drip/historical/attribution/BondMarketSnap.java deleted file mode 100644 index 866ae51..0000000 --- a/org/drip/historical/attribution/BondMarketSnap.java +++ /dev/null @@ -1,93 +0,0 @@ - -package org.drip.historical.attribution; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * BondMarketSnap contains the Metrics Snapshot associated with the relevant Manifest Measures for the given - * Bond Position. - * - * @author Lakshmi Krishnamurthy - */ - -public class BondMarketSnap extends org.drip.historical.attribution.PositionMarketSnap { - - /** - * BondMarketSnap Constructor - * - * @param dtSnap The Snapshot Date - * @param dblMarketValue The Snapshot Market Value - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BondMarketSnap ( - final org.drip.analytics.date.JulianDate dtSnap, - final double dblMarketValue) - throws java.lang.Exception - { - super (dtSnap, dblMarketValue); - } - - /** - * Set the Yield Level and Position Sensitivity - * - * @param dblYield The Yield Level - * @param dblYieldSensitivity The Position Yield Sensitivity - * @param dblYieldRollDown The Position Yield Roll Down - * - * @return TRUE - The Yield Level and the Position Sensitivity successfully set - */ - - public boolean setYieldMarketFactor ( - final double dblYield, - final double dblYieldSensitivity, - final double dblYieldRollDown) - { - return addManifestMeasureSnap ("Yield", dblYield, dblYieldSensitivity, dblYieldRollDown); - } -} diff --git a/org/drip/historical/attribution/CDSMarketSnap.java b/org/drip/historical/attribution/CDSMarketSnap.java deleted file mode 100644 index 444799d..0000000 --- a/org/drip/historical/attribution/CDSMarketSnap.java +++ /dev/null @@ -1,449 +0,0 @@ - -package org.drip.historical.attribution; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDSMarketSnap contains the Metrics Snapshot associated with the relevant Manifest Measures for the given - * Credit Default Swap Position. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDSMarketSnap extends org.drip.historical.attribution.PositionMarketSnap { - - /** - * CDSMarketSnap Constructor - * - * @param dtSnap The Snapshot Date - * @param dblMarketValue The Snapshot Market Value - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CDSMarketSnap ( - final org.drip.analytics.date.JulianDate dtSnap, - final double dblMarketValue) - throws java.lang.Exception - { - super (dtSnap, dblMarketValue); - } - - /** - * Set the Fair Premium and Position Sensitivity - * - * @param dblFairPremium The Fair Premium - * @param dblFairPremiumSensitivity The Position Fair Premium Sensitivity - * @param dblFairPremiumRollDown The Position Fair Premium Roll Down - * - * @return TRUE - The Fair Premium and the Position Sensitivity successfully set - */ - - public boolean setFairPremiumMarketFactor ( - final double dblFairPremium, - final double dblFairPremiumSensitivity, - final double dblFairPremiumRollDown) - { - return addManifestMeasureSnap ("FairPremium", dblFairPremium, dblFairPremiumSensitivity, - dblFairPremiumRollDown); - } - - /** - * Set the Effective Date - * - * @param dtEffective The Effective Date - * - * @return TRUE - The Effective Date successfully set - */ - - public boolean setEffectiveDate ( - final org.drip.analytics.date.JulianDate dtEffective) - { - return setDate ("EffectiveDate", dtEffective); - } - - /** - * Retrieve the Effective Date - * - * @return The Effective Date - */ - - public org.drip.analytics.date.JulianDate effectiveDate() - { - return date ("EffectiveDate"); - } - - /** - * Set the Maturity Date - * - * @param dtMaturity The Maturity Date - * - * @return TRUE - The Maturity Date successfully set - */ - - public boolean setMaturityDate ( - final org.drip.analytics.date.JulianDate dtMaturity) - { - return setDate ("MaturityDate", dtMaturity); - } - - /** - * Retrieve the Maturity Date - * - * @return The Maturity Date - */ - - public org.drip.analytics.date.JulianDate maturityDate() - { - return date ("MaturityDate"); - } - - /** - * Set the Initial Fair Premium - * - * @param dblInitialFairPremium The Initial Fair Premium - * - * @return TRUE - The Initial Fair Premium Successfully set - */ - - public boolean setInitialFairPremium ( - final double dblInitialFairPremium) - { - return setR1 ("InitialFairPremium", dblInitialFairPremium); - } - - /** - * Retrieve the Initial Fair Premium - * - * @return The Initial Fair Premium - * - * @throws java.lang.Exception Thrown if the Initial Fair Premium cannot be obtained - */ - - public double initialFairPremium() - throws java.lang.Exception - { - return r1 ("InitialFairPremium"); - } - - /** - * Set the Current Fair Premium - * - * @param dblCurrentFairPremium The Current Fair Premium - * - * @return TRUE - The Current Fair Premium Successfully Set - */ - - public boolean setCurrentFairPremium ( - final double dblCurrentFairPremium) - { - return setR1 ("CurrentFairPremium", dblCurrentFairPremium); - } - - /** - * Retrieve the Current Fair Premium - * - * @return The Current Fair Premium - * - * @throws java.lang.Exception Thrown if the Current Fair Premium cannot be obtained - */ - - public double currentFairPremium() - throws java.lang.Exception - { - return r1 ("CurrentFairPremium"); - } - - /** - * Set the Fixed Coupon - * - * @param dblFixedCoupon The Fixed Coupon - * - * @return TRUE - The Fixed Coupon Successfully Set - */ - - public boolean setFixedCoupon ( - final double dblFixedCoupon) - { - return setR1 ("FixedCoupon", dblFixedCoupon); - } - - /** - * Retrieve the Fixed Coupon - * - * @return The Fixed Coupon - * - * @throws java.lang.Exception Thrown if the Fixed Coupon cannot be obtained - */ - - public double fixedCoupon() - throws java.lang.Exception - { - return r1 ("FixedCoupon"); - } - - /** - * Set the Clean DV01 - * - * @param dblCleanDV01 The Clean DV01 - * - * @return TRUE - The Clean DV01 Successfully Set - */ - - public boolean setCleanDV01 ( - final double dblCleanDV01) - { - return setR1 ("CleanDV01", dblCleanDV01); - } - - /** - * Retrieve the Clean DV01 - * - * @return The Clean DV01 - * - * @throws java.lang.Exception Thrown if the Clean DV01 cannot be obtained - */ - - public double cleanDV01() - throws java.lang.Exception - { - return r1 ("CleanDV01"); - } - - /** - * Set the Roll Down Fair Premium - * - * @param dblRollDownFairPremium The Roll Down Fair Premium - * - * @return TRUE - The Roll Down Fair Premium Successfully Set - */ - - public boolean setRollDownFairPremium ( - final double dblRollDownFairPremium) - { - return setR1 ("RollDownFairPremium", dblRollDownFairPremium); - } - - /** - * Retrieve the Roll Down Fair Premium - * - * @return The Roll Down Fair Premium - * - * @throws java.lang.Exception Thrown if the Roll Down Fair Premium cannot be obtained - */ - - public double rollDownFairPremium() - throws java.lang.Exception - { - return r1 ("RollDownFairPremium"); - } - - /** - * Set the Accrued - * - * @param dblAccrued The Accrued - * - * @return TRUE - The Accrued successfully set - */ - - public boolean setAccrued ( - final double dblAccrued) - { - return setR1 ("Accrued", dblAccrued); - } - - /** - * Retrieve the Accrued - * - * @return The Accrued - * - * @throws java.lang.Exception Thrown if the Accrued cannot be obtained - */ - - public double accrued() - throws java.lang.Exception - { - return r1 ("Accrued"); - } - - /** - * Set the Cumulative Coupon Amount - * - * @param dblCumulativeCouponAmount The Cumulative Coupon Amount - * - * @return TRUE - The Cumulative Coupon Amount successfully set - */ - - public boolean setCumulativeCouponAmount ( - final double dblCumulativeCouponAmount) - { - return setR1 ("CumulativeCouponAmount", dblCumulativeCouponAmount); - } - - /** - * Retrieve the Cumulative Coupon Amount - * - * @return The Cumulative Coupon Amount - * - * @throws java.lang.Exception Thrown if the Cumulative Coupon Amount cannot be obtained - */ - - public double cumulativeCouponAmount() - throws java.lang.Exception - { - return r1 ("CumulativeCouponAmount"); - } - - /** - * Set the Credit Label - * - * @param strCreditLabel Credit Label - * - * @return TRUE - The Credit Label successfully set - */ - - public boolean setCreditLabel ( - final java.lang.String strCreditLabel) - { - return setC1 ("CreditLabel", strCreditLabel); - } - - /** - * Retrieve the Credit Label - * - * @return The Credit Label - */ - - public java.lang.String creditLabel() - { - return c1 ("CreditLabel"); - } - - /** - * Set the Recovery Rate - * - * @param dblRecoveryRate The Recovery Rate - * - * @return TRUE - The Recovery Rate successfully set - */ - - public boolean setRecoveryRate ( - final double dblRecoveryRate) - { - return setR1 ("RecoveryRate", dblRecoveryRate); - } - - /** - * Retrieve the Recovery Rate - * - * @return The Recovery Rate - * - * @throws java.lang.Exception Thrown if the Recovery Rate cannot be obtained - */ - - public double recoveryRate() - throws java.lang.Exception - { - return r1 ("RecoveryRate"); - } - - /** - * Set the Coupon PV - * - * @param dblCouponPV The Coupon PV - * - * @return TRUE - The Coupon PV successfully set - */ - - public boolean setCouponPV ( - final double dblCouponPV) - { - return setR1 ("CouponPV", dblCouponPV); - } - - /** - * Retrieve the Coupon PV - * - * @return The Coupon PV - * - * @throws java.lang.Exception Thrown if the Coupon PV cannot be obtained - */ - - public double couponPV() - throws java.lang.Exception - { - return r1 ("CouponPV"); - } - - /** - * Set the Loss PV - * - * @param dblLossPV The Loss PV - * - * @return TRUE - The Loss PV successfully set - */ - - public boolean setLossPV ( - final double dblLossPV) - { - return setR1 ("LossPV", dblLossPV); - } - - /** - * Retrieve the Loss PV - * - * @return The Loss PV - * - * @throws java.lang.Exception Thrown if the Loss PV cannot be obtained - */ - - public double lossPV() - throws java.lang.Exception - { - return r1 ("LossPV"); - } -} diff --git a/org/drip/historical/attribution/PositionChangeComponents.java b/org/drip/historical/attribution/PositionChangeComponents.java deleted file mode 100644 index d72f5fc..0000000 --- a/org/drip/historical/attribution/PositionChangeComponents.java +++ /dev/null @@ -1,454 +0,0 @@ - -package org.drip.historical.attribution; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * PositionChangeComponents contains the Decomposition of the Components of the Interval Change for a given - * Position. - * - * @author Lakshmi Krishnamurthy - */ - -public class PositionChangeComponents { - private boolean _bChangeTypeReturn = false; - private double _dblAccrualChange = java.lang.Double.NaN; - private org.drip.historical.attribution.PositionMarketSnap _pmsFirst = null; - private org.drip.historical.attribution.PositionMarketSnap _pmsSecond = null; - private org.drip.analytics.support.CaseInsensitiveHashMap _mapDifferenceMetric = null; - - /** - * PositionChangeComponents Constructor - * - * @param bChangeTypeReturn TRUE - Change Type is Return (Relative) - * @param pmsFirst The First Position Market Snapshot Instance - * @param pmsSecond The Second Position Market Snapshot Instance - * @param dblAccrualChange The Accrual Change Component of Interval Return/Change - * @param mapDifferenceMetric The Map of Difference Metrics - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public PositionChangeComponents ( - final boolean bChangeTypeReturn, - final org.drip.historical.attribution.PositionMarketSnap pmsFirst, - final org.drip.historical.attribution.PositionMarketSnap pmsSecond, - final double dblAccrualChange, - final org.drip.analytics.support.CaseInsensitiveHashMap mapDifferenceMetric) - throws java.lang.Exception - { - _bChangeTypeReturn = bChangeTypeReturn; - _mapDifferenceMetric = mapDifferenceMetric; - - if (null == (_pmsFirst = pmsFirst) || null == (_pmsSecond = pmsSecond) || - _pmsFirst.snapDate().julian() >= _pmsSecond.snapDate().julian() || - !org.drip.quant.common.NumberUtil.IsValid (_dblAccrualChange = dblAccrualChange)) - throw new java.lang.Exception ("PositionChangeComponents Constructor => Invalid Inputs!"); - } - - /** - * Return the Position Change Type - * - * @return TRUE - Change Type is Return (Relative) - */ - - public boolean changeTypeReturn() - { - return _bChangeTypeReturn; - } - - /** - * Retrieve the Set of Manifest Measures - * - * @return The Set of Manifest Measures - */ - - public java.util.Set manifestMeasures() - { - return _pmsFirst.manifestMeasures(); - } - - /** - * Retrieve the First Position Market Snapshot Instance - * - * @return The First Position Market Snapshot Instance - */ - - public org.drip.historical.attribution.PositionMarketSnap pmsFirst() - { - return _pmsFirst; - } - - /** - * Retrieve the Second Position Market Snapshot Instance - * - * @return The Second Position Market Snapshot Instance - */ - - public org.drip.historical.attribution.PositionMarketSnap pmsSecond() - { - return _pmsSecond; - } - - /** - * Retrieve the First Date - * - * @return The First Date - */ - - public org.drip.analytics.date.JulianDate firstDate() - { - return _pmsFirst.snapDate(); - } - - /** - * Retrieve the Second Date - * - * @return The Second Date - */ - - public org.drip.analytics.date.JulianDate secondDate() - { - return _pmsSecond.snapDate(); - } - - /** - * Retrieve the Gross Interval Clean Change - * - * @return The Gross Interval Clean Change - */ - - public double grossCleanChange() - { - return _pmsSecond.marketValue() - _pmsFirst.marketValue(); - } - - /** - * Retrieve the Gross Interval Change - * - * @return The Gross Interval Change - */ - - public double grossChange() - { - return grossCleanChange() + _dblAccrualChange; - } - - /** - * Retrieve the Specific Manifest Measure Market Realization Position Change - * - * @param strManifestMeasure The Manifest Measure - * - * @return The Specific Manifest Measure Market Realization Position Change - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public double specificMarketRealizationChange ( - final java.lang.String strManifestMeasure) - throws java.lang.Exception - { - org.drip.historical.attribution.PositionManifestMeasureSnap pmmsFirst = _pmsFirst.manifestMeasureSnap - (strManifestMeasure); - - org.drip.historical.attribution.PositionManifestMeasureSnap pmmsSecond = _pmsSecond.manifestMeasureSnap - (strManifestMeasure); - - if (null == pmmsFirst || null == pmmsSecond) - throw new java.lang.Exception - ("PositionChangeComponents::specificMarketRealizationChange => Invalid Inputs"); - - return 0.5 * (pmmsFirst.sensitivity() + pmmsSecond.sensitivity()) * (pmmsSecond.realization() - - pmmsFirst.realization()); - } - - /** - * Retrieve the Full Manifest Measure Realization Position Change - * - * @return The Full Manifest Measure Realization Position Change - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public double marketRealizationChange() - throws java.lang.Exception - { - java.util.Set setstrManiFestMeasure = _pmsFirst.manifestMeasures(); - - if (null == setstrManiFestMeasure || 0 == setstrManiFestMeasure.size()) - throw new java.lang.Exception - ("PositionChangeComponents::marketRealizationChange => No Manifest Measures"); - - double dblMarketRealizationChange = 0.; - - for (java.lang.String strManifestMeasure : setstrManiFestMeasure) - dblMarketRealizationChange += specificMarketRealizationChange (strManifestMeasure); - - return dblMarketRealizationChange; - } - - /** - * Retrieve the Specific Manifest Measure Market Sensitivity Position Change - * - * @param strManifestMeasure The Manifest Measure - * - * @return The Specific Manifest Measure Market Sensitivity Position Change - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public double specificMarketSensitivityChange ( - final java.lang.String strManifestMeasure) - throws java.lang.Exception - { - org.drip.historical.attribution.PositionManifestMeasureSnap pmmsFirst = _pmsFirst.manifestMeasureSnap - (strManifestMeasure); - - org.drip.historical.attribution.PositionManifestMeasureSnap pmmsSecond = - _pmsSecond.manifestMeasureSnap (strManifestMeasure); - - if (null == pmmsFirst || null == pmmsSecond) - throw new java.lang.Exception - ("PositionChangeComponents::specificMarketSensitivityChange => Invalid Inputs"); - - return 0.5 * (pmmsFirst.realization() + pmmsSecond.realization()) * (pmmsSecond.sensitivity() - - pmmsFirst.sensitivity()); - } - - /** - * Retrieve the Full Manifest Measure Market Sensitivity Position Change - * - * @return The Full Manifest Measure Market Sensitivity Position Change - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public double marketSensitivityChange() - throws java.lang.Exception - { - java.util.Set setstrManiFestMeasure = _pmsFirst.manifestMeasures(); - - if (null == setstrManiFestMeasure || 0 == setstrManiFestMeasure.size()) - throw new java.lang.Exception - ("PositionChangeComponents::marketSensitivityChange => No Manifest Measures"); - - double dblMarketSensitivityChange = 0.; - - for (java.lang.String strManifestMeasure : setstrManiFestMeasure) - dblMarketSensitivityChange += specificMarketSensitivityChange (strManifestMeasure); - - return dblMarketSensitivityChange; - } - - /** - * Retrieve the Specific Manifest Measure Market Roll-down Position Change - * - * @param strManifestMeasure The Manifest Measure - * - * @return The Specific Manifest Measure Market Roll-down Position Change - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public double specificMarketRollDownChange ( - final java.lang.String strManifestMeasure) - throws java.lang.Exception - { - org.drip.historical.attribution.PositionManifestMeasureSnap pmmsFirst = _pmsFirst.manifestMeasureSnap - (strManifestMeasure); - - if (null == pmmsFirst) - throw new java.lang.Exception - ("PositionChangeComponents::specificMarketRollDownChange => Invalid Inputs"); - - return pmmsFirst.sensitivity() * (pmmsFirst.rollDown() - pmmsFirst.realization()); - } - - /** - * Retrieve the Full Manifest Measure Roll-down Position Change - * - * @return The Full Manifest Measure Roll-down Position Change - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public double marketRollDownChange() - throws java.lang.Exception - { - java.util.Set setstrManiFestMeasure = _pmsFirst.manifestMeasures(); - - if (null == setstrManiFestMeasure || 0 == setstrManiFestMeasure.size()) - throw new java.lang.Exception - ("PositionChangeComponents::marketRollDownChange => No Manifest Measures"); - - double dblMarketRollDownChange = 0.; - - for (java.lang.String strManifestMeasure : setstrManiFestMeasure) - dblMarketRollDownChange += specificMarketRollDownChange (strManifestMeasure); - - return dblMarketRollDownChange; - } - - /** - * Retrieve the Accrual Interval Change - * - * @return The Accrual Interval Change - */ - - public double accrualChange() - { - return _dblAccrualChange; - } - - /** - * Retrieve the Explained Interval Change - * - * @return The Explained Interval Change - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public double explainedChange() - throws java.lang.Exception - { - return marketRealizationChange() + marketRollDownChange(); - } - - /** - * Retrieve the Unexplained Interval Change - * - * @return The Unexplained Interval Change - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public double unexplainedChange() - throws java.lang.Exception - { - return grossChange() - explainedChange(); - } - - /** - * Retrieve the Map of Difference Metrics - * - * @return The Map of Difference Metrics - */ - - public org.drip.analytics.support.CaseInsensitiveHashMap differenceMetric() - { - return _mapDifferenceMetric; - } - - /** - * Retrieve the Row of Header Fields - * - * @return The Row of Header Fields - */ - - public java.lang.String header() - { - java.lang.String strHeader = "FirstDate,SecondDate,TotalPnL,TotalCleanPnL,MarketShiftPnL," + - "RollDownPnL,AccrualPnL,ExplainedPnL,UnexplainedPnL," + _pmsFirst.header ("first") + - _pmsSecond.header ("second"); - - if (null == _mapDifferenceMetric) return strHeader; - - for (java.lang.String strKey : _mapDifferenceMetric.keySet()) - strHeader = strHeader + strKey + "change,"; - - return strHeader; - } - - /** - * Retrieve the Row of Content Fields - * - * @return The Row of Content Fields - */ - - public java.lang.String content() - { - java.lang.String strContent = firstDate().toString() + "," + secondDate().toString() + ","; - - strContent = strContent + org.drip.quant.common.FormatUtil.FormatDouble (grossChange(), 1, 8, 1.) + - ","; - - strContent = strContent + org.drip.quant.common.FormatUtil.FormatDouble (grossCleanChange(), 1, 8, - 1.) + ","; - - try { - strContent = strContent + org.drip.quant.common.FormatUtil.FormatDouble - (marketRealizationChange(), 1, 8, 1.) + ","; - - strContent = strContent + org.drip.quant.common.FormatUtil.FormatDouble (marketRollDownChange(), - 1, 8, 1.) + ","; - - strContent = strContent + org.drip.quant.common.FormatUtil.FormatDouble (_dblAccrualChange, 1, 8, - 1.) + ","; - - strContent = strContent + org.drip.quant.common.FormatUtil.FormatDouble (explainedChange(), 1, 8, - 1.) + ","; - - strContent = strContent + org.drip.quant.common.FormatUtil.FormatDouble (unexplainedChange(), 1, - 8, 1.) + ","; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - strContent = strContent + _pmsFirst.content() + _pmsSecond.content(); - - if (null == _mapDifferenceMetric) return strContent; - - for (java.lang.String strKey : _mapDifferenceMetric.keySet()) - strContent = strContent + org.drip.quant.common.FormatUtil.FormatDouble (_mapDifferenceMetric.get - (strKey), 1, 8, 1.) + ","; - - return strContent; - } -} diff --git a/org/drip/historical/attribution/PositionManifestMeasureSnap.java b/org/drip/historical/attribution/PositionManifestMeasureSnap.java deleted file mode 100644 index 91fd061..0000000 --- a/org/drip/historical/attribution/PositionManifestMeasureSnap.java +++ /dev/null @@ -1,116 +0,0 @@ - -package org.drip.historical.attribution; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PositionManifestMeasureSnap contains the Metrics Snapshot associated with a Specified Manifest Measure - * for a given Position. - * - * @author Lakshmi Krishnamurthy - */ - -public class PositionManifestMeasureSnap { - private double _dblRollDown = java.lang.Double.NaN; - private double _dblRealization = java.lang.Double.NaN; - private double _dblSensitivity = java.lang.Double.NaN; - - /** - * PositionManifestMeasureSnap Constructor - * - * @param dblRealization Manifest Measure Instance Realization - * @param dblSensitivity First-Order Sensitivity of the Position to the Manifest Measure - * @param dblRollDown Manifest Measure Roll Down - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public PositionManifestMeasureSnap ( - final double dblRealization, - final double dblSensitivity, - final double dblRollDown) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblRealization = dblRealization) || - !org.drip.quant.common.NumberUtil.IsValid (_dblSensitivity = dblSensitivity) || - !org.drip.quant.common.NumberUtil.IsValid (_dblRollDown = dblRollDown)) - throw new java.lang.Exception ("PositionManifestMeasureSnap ctr: Invalid Inputs"); - } - - /** - * Retrieve the Realized Manifest Measure Value - * - * @return The Manifest Measure Realization - */ - - public double realization() - { - return _dblRealization; - } - - /** - * Retrieve the Manifest Measure Sensitivity - * - * @return The Manifest Measure Sensitivity - */ - - public double sensitivity() - { - return _dblSensitivity; - } - - /** - * Retrieve the Manifest Measure Roll Down - * - * @return The Manifest Measure Roll Down - */ - - public double rollDown() - { - return _dblRollDown; - } -} diff --git a/org/drip/historical/attribution/PositionMarketSnap.java b/org/drip/historical/attribution/PositionMarketSnap.java deleted file mode 100644 index 433467b..0000000 --- a/org/drip/historical/attribution/PositionMarketSnap.java +++ /dev/null @@ -1,428 +0,0 @@ - -package org.drip.historical.attribution; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PositionMarketSnap contains the Metrics Snapshot associated with the relevant Manifest Measures for a - * given Position. - * - * @author Lakshmi Krishnamurthy - */ - -public class PositionMarketSnap { - private double _dblMarketValue = java.lang.Double.NaN; - private org.drip.analytics.date.JulianDate _dtSnap = null; - - private java.util.Map - _mapPMMS = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - private java.util.Map _mapCustomC1 = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - private java.util.Map _mapCustomR1 = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - private java.util.Map _mapCustomDate = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - /** - * PositionMarketSnap Constructor - * - * @param dtSnap The Snapshot Date - * @param dblMarketValue The Snapshot Market Value - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public PositionMarketSnap ( - final org.drip.analytics.date.JulianDate dtSnap, - final double dblMarketValue) - throws java.lang.Exception - { - if (null == (_dtSnap = dtSnap) || !org.drip.quant.common.NumberUtil.IsValid (_dblMarketValue = - dblMarketValue)) - throw new java.lang.Exception ("PositionMarketSnap Constructor: Invalid Inputs"); - } - - /** - * Retrieve the Date of the Snap - * - * @return Date of the Snap - */ - - public org.drip.analytics.date.JulianDate snapDate() - { - return _dtSnap; - } - - /** - * Retrieve the Position Market Value - * - * @return The Position Market Value - */ - - public double marketValue() - { - return _dblMarketValue; - } - - /** - * Add an Instance of the Position Manifest Measure Snap from the Specified Inputs - * - * @param strManifestMeasure The Manifest Measure - * @param dblManifestMeasureRealization The Manifest Measure Realization - * @param dblManifestMeasureSensitivity The Manifest Measure Sensitivity - * @param dblManifestMeasureRollDown The Manifest Measure Roll Down - * - * @return TRUE - The Manifest Measure Snap Metrics successfully added - */ - - public boolean addManifestMeasureSnap ( - final java.lang.String strManifestMeasure, - final double dblManifestMeasureRealization, - final double dblManifestMeasureSensitivity, - final double dblManifestMeasureRollDown) - { - if (null == strManifestMeasure || strManifestMeasure.isEmpty()) return false; - - try { - _mapPMMS.put (strManifestMeasure, new org.drip.historical.attribution.PositionManifestMeasureSnap - (dblManifestMeasureRealization, dblManifestMeasureSensitivity, dblManifestMeasureRollDown)); - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - /** - * Retrieve the Snapshot associated with the specified Manifest Measure - * - * @param strManifestMeasure The Manifest Measure - * - * @return The Snapshot associated with the specified Manifest Measure - */ - - public org.drip.historical.attribution.PositionManifestMeasureSnap manifestMeasureSnap ( - final java.lang.String strManifestMeasure) - { - return null == strManifestMeasure || !_mapPMMS.containsKey (strManifestMeasure) ? null : _mapPMMS.get - (strManifestMeasure); - } - - /** - * Retrieve the Set of Manifest Measures - * - * @return The Set of Manifest Measures - */ - - public java.util.Set manifestMeasures() - { - return _mapPMMS.keySet(); - } - - /** - * Set the Custom Date Entry corresponding to the Specified Key - * - * @param strKey The Key - * @param dtCustom The Custom Date Entry - * - * @return TRUE - Custom Date successfully set - */ - - public boolean setDate ( - final java.lang.String strKey, - final org.drip.analytics.date.JulianDate dtCustom) - { - if (null == strKey || strKey.isEmpty() || null == dtCustom) return false; - - _mapCustomDate.put (strKey, dtCustom); - - return true; - } - - /** - * Retrieve the Custom Date Entry corresponding to the Specified Key - * - * @param strKey The Key - * - * @return The Custom Date Entry - */ - - public org.drip.analytics.date.JulianDate date ( - final java.lang.String strKey) - { - return null == strKey || !_mapCustomDate.containsKey (strKey) ? null : _mapCustomDate.get (strKey); - } - - /** - * Set the Custom C^1 Entry corresponding to the Specified Key - * - * @param strKey The Key - * @param strC1 The Custom C^1 Entry - * - * @return TRUE - Custom C^1 Entry successfully set - */ - - public boolean setC1 ( - final java.lang.String strKey, - final java.lang.String strC1) - { - if (null == strKey || strKey.isEmpty() || null == strC1 || strC1.isEmpty()) return false; - - _mapCustomC1.put (strKey, strC1); - - return true; - } - - /** - * Retrieve the Custom C^1 Entry corresponding to the Specified Key - * - * @param strKey The Key - * - * @return The Custom C^1 Entry - */ - - public java.lang.String c1 ( - final java.lang.String strKey) - { - return null == strKey || !_mapCustomC1.containsKey (strKey) ? null : _mapCustomC1.get (strKey); - } - - /** - * Set the Custom R^1 Entry corresponding to the Specified Key - * - * @param strKey The Key - * @param dblR1 The Custom R^1 Entry - * @param bIgnoreNaN TRUE - Ignore NaN Entry - * - * @return TRUE - Custom Number successfully set - */ - - public boolean setR1 ( - final java.lang.String strKey, - final double dblR1, - final boolean bIgnoreNaN) - { - if (null == strKey || strKey.isEmpty() || (!bIgnoreNaN && !org.drip.quant.common.NumberUtil.IsValid - (dblR1))) - return false; - - _mapCustomR1.put (strKey, dblR1); - - return true; - } - - /** - * Set the Custom R^1 Entry corresponding to the Specified Key - * - * @param strKey The Key - * @param dblR1 The Custom R^1 Entry - * - * @return TRUE - Custom Number successfully set - */ - - public boolean setR1 ( - final java.lang.String strKey, - final double dblR1) - { - return setR1 (strKey, dblR1, true); - } - - /** - * Retrieve the Custom R^1 Entry corresponding to the Specified Key - * - * @param strKey The Key - * - * @return The Custom R^1 Entry - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double r1 ( - final java.lang.String strKey) - throws java.lang.Exception - { - if (null == strKey || !_mapCustomR1.containsKey (strKey)) - throw new java.lang.Exception ("PositionMarketSnap::r1 => Invalid Inputs"); - - return _mapCustomR1.get (strKey); - } - - /** - * Set the Market Measure Name - * - * @param strMarketMeasureName The Market Measure Name - * - * @return The Market Measure Name successfully set - */ - - public boolean setMarketMeasureName ( - final java.lang.String strMarketMeasureName) - { - return setC1 ("MarketMeasureName", strMarketMeasureName); - } - - /** - * Retrieve the Market Measure Name - * - * @return The Market Measure Name - */ - - public java.lang.String marketMeasureName() - { - return c1 ("MarketMeasureName"); - } - - /** - * Set the Market Measure Value - * - * @param dblMarketMeasureValue The Market Measure Value - * - * @return The Market Measure Value successfully set - */ - - public boolean setMarketMeasureValue ( - final double dblMarketMeasureValue) - { - return setR1 ("MarketMeasureValue", dblMarketMeasureValue); - } - - /** - * Retrieve the Market Measure Value - * - * @return The Market Measure Value - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double marketMeasureValue() - throws java.lang.Exception - { - return r1 ("MarketMeasureValue"); - } - - /** - * Set the Cumulative Coupon Amount - * - * @param dblCumulativeCouponAmount The Cumulative Coupon Amount - * - * @return TRUE - The Cumulative Coupon Amount successfully set - */ - - public boolean setCumulativeCouponAmount ( - final double dblCumulativeCouponAmount) - { - return setR1 ("CumulativeCouponAmount", dblCumulativeCouponAmount); - } - - /** - * Retrieve the Cumulative Coupon Amount - * - * @return The Cumulative Coupon Amount - * - * @throws java.lang.Exception Thrown if the Cumulative Coupon Amount cannot be obtained - */ - - public double cumulativeCouponAmount() - throws java.lang.Exception - { - return r1 ("CumulativeCouponAmount"); - } - - /** - * Retrieve the Row of Header Fields - * - * @param strPrefix The Prefix that precedes each Header Field - * - * @return The Row of Header Fields - */ - - public java.lang.String header ( - final java.lang.String strPrefix) - { - java.lang.String strHeader = ""; - - for (java.lang.String strR1Key : _mapCustomR1.keySet()) - strHeader = strHeader + strPrefix + strR1Key + ","; - - for (java.lang.String strC1Key : _mapCustomC1.keySet()) - strHeader = strHeader + strPrefix + strC1Key + ","; - - for (java.lang.String strDateKey : _mapCustomDate.keySet()) - strHeader = strHeader + strPrefix + strDateKey + ","; - - return strHeader; - } - - /** - * Retrieve the Row of Content Fields - * - * @return The Row of Content Fields - */ - - public java.lang.String content() - { - java.lang.String strContent = ""; - - for (java.lang.String strR1Key : _mapCustomR1.keySet()) - strContent = strContent + org.drip.quant.common.FormatUtil.FormatDouble (_mapCustomR1.get - (strR1Key), 1, 8, 1.) + ","; - - for (java.lang.String strC1Key : _mapCustomC1.keySet()) - strContent = strContent + _mapCustomC1.get (strC1Key) + ","; - - for (java.lang.String strDateKey : _mapCustomDate.keySet()) - strContent = strContent + _mapCustomDate.get (strDateKey).toString() + ","; - - return strContent; - } -} diff --git a/org/drip/historical/attribution/TreasuryFuturesMarketSnap.java b/org/drip/historical/attribution/TreasuryFuturesMarketSnap.java deleted file mode 100644 index c05780f..0000000 --- a/org/drip/historical/attribution/TreasuryFuturesMarketSnap.java +++ /dev/null @@ -1,199 +0,0 @@ - -package org.drip.historical.attribution; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TreasuryFuturesMarketSnap contains the Metrics Snapshot associated with the relevant Manifest Measures for - * the given Treasury Futures Position. - * - * @author Lakshmi Krishnamurthy - */ - -public class TreasuryFuturesMarketSnap extends org.drip.historical.attribution.PositionMarketSnap { - - /** - * TreasuryFuturesMarketSnap Constructor - * - * @param dtSnap The Snapshot Date - * @param dblMarketValue The Snapshot Market Value - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public TreasuryFuturesMarketSnap ( - final org.drip.analytics.date.JulianDate dtSnap, - final double dblMarketValue) - throws java.lang.Exception - { - super (dtSnap, dblMarketValue); - } - - /** - * Set the Yield Level and Position Sensitivity - * - * @param dblYield The Yield Level - * @param dblYieldSensitivity The Position Yield Sensitivity - * @param dblYieldRollDown The Position Yield Roll Down - * - * @return TRUE - The Yield Level and the Position Sensitivity successfully set - */ - - public boolean setYieldMarketFactor ( - final double dblYield, - final double dblYieldSensitivity, - final double dblYieldRollDown) - { - return addManifestMeasureSnap ("Yield", dblYield, dblYieldSensitivity, dblYieldRollDown); - } - - /** - * Set the Expiry Date - * - * @param dtExpiry The Expiry Date - * - * @return TRUE - The Expiry Date successfully set - */ - - public boolean setExpiryDate ( - final org.drip.analytics.date.JulianDate dtExpiry) - { - return setDate ("Expiry", dtExpiry); - } - - /** - * Retrieve the Expiry Date - * - * @return The Expiry Date - */ - - public org.drip.analytics.date.JulianDate expiryDate() - { - return date ("Expiry"); - } - - /** - * Set the CTD Bond Name - * - * @param strCTDName Name of the CTD Bond - * - * @return TRUE - The CTD Bond Name successfully set - */ - - public boolean setCTDName ( - final java.lang.String strCTDName) - { - return setC1 ("CTDBondName", strCTDName); - } - - /** - * Retrieve the CTD Name - * - * @return The CTD Name - */ - - public java.lang.String ctdName() - { - return c1 ("CTDBondName"); - } - - /** - * Set the Clean Expiry Price - * - * @param dblExpiryCleanPrice The Clean Price of the CTD at Expiry - * - * @return TRUE - The Clean Expiry Price Successfully Set - */ - - public boolean setCleanExpiryPrice ( - final double dblExpiryCleanPrice) - { - return setR1 ("ExpiryCleanPrice", dblExpiryCleanPrice); - } - - /** - * Retrieve the Clean Price at Expiry - * - * @return The Clean Price at Expiry - * - * @throws java.lang.Exception Thrown if the Clean Price at Expiry cannot be obtained - */ - - public double expiryCleanPrice() - throws java.lang.Exception - { - return r1 ("ExpiryCleanPrice"); - } - - /** - * Set the CTD Conversion Factor at Expiry - * - * @param dblConversionFactor The Conversion Factor at Expiry - * - * @return TRUE - The CTD Conversion Factor at Expiry Successfully Set - */ - - public boolean setConversionFactor ( - final double dblConversionFactor) - { - return setR1 ("ConversionFactor", dblConversionFactor); - } - - /** - * Retrieve the CTD Conversion Factor at Expiry - * - * @return The CTD Conversion Factor at Expiry - * - * @throws java.lang.Exception Thrown if the CTD Conversion Factor cannot be obtained - */ - - public double conversionFactor() - throws java.lang.Exception - { - return r1 ("ConversionFactor"); - } -} diff --git a/org/drip/historical/engine/FixFloatExplainProcessor.java b/org/drip/historical/engine/FixFloatExplainProcessor.java deleted file mode 100644 index a4b8996..0000000 --- a/org/drip/historical/engine/FixFloatExplainProcessor.java +++ /dev/null @@ -1,399 +0,0 @@ - -package org.drip.historical.engine; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FixFloatExplainProcessor contains the Functionality associated with the Horizon Analysis of the Fix Float - * Swap. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixFloatExplainProcessor extends org.drip.historical.engine.HorizonChangeExplainProcessor { - - /** - * FixFloatExplainProcessor Constructor - * - * @param ffc The Fix Float Component - * @param iSettleLag The Component's Settle Lag - * @param strMarketMeasureName The Market Measure Name - * @param dblMarketMeasureValue The Market Measure Value - * @param dtFirst First Date - * @param dtSecond Second Date - * @param csqcFirst First Market Parameters - * @param csqcSecond Second Market Parameters - * @param mapCSQCRollDown Map of the Roll Down Market Parameters - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public FixFloatExplainProcessor ( - final org.drip.product.rates.FixFloatComponent ffc, - final int iSettleLag, - final java.lang.String strMarketMeasureName, - final double dblMarketMeasureValue, - final org.drip.analytics.date.JulianDate dtFirst, - final org.drip.analytics.date.JulianDate dtSecond, - final org.drip.param.market.CurveSurfaceQuoteContainer csqcFirst, - final org.drip.param.market.CurveSurfaceQuoteContainer csqcSecond, - final - org.drip.analytics.support.CaseInsensitiveHashMap - mapCSQCRollDown) - throws java.lang.Exception - { - super (ffc, iSettleLag, strMarketMeasureName, dblMarketMeasureValue, dtFirst, dtSecond, csqcFirst, - csqcSecond, mapCSQCRollDown); - } - - @Override public org.drip.historical.attribution.PositionMarketSnap snapFirstMarketValue() - { - org.drip.analytics.date.JulianDate dtFirst = firstDate(); - - org.drip.product.rates.FixFloatComponent ffc = (org.drip.product.rates.FixFloatComponent) - component(); - - java.lang.String strPayCurrency = ffc.payCurrency(); - - java.util.Map mapFixFloat = ffc.value - (org.drip.param.valuation.ValuationParams.Spot (dtFirst.addBusDays (settleLag(), - strPayCurrency).julian()), null, firstMarketParameters(), null); - - if (null == mapFixFloat || !mapFixFloat.containsKey ("Accrued") || !mapFixFloat.containsKey - ("CleanFixedDV01") || !mapFixFloat.containsKey ("CleanFloatingDV01") || !mapFixFloat.containsKey - ("CleanPV") || !mapFixFloat.containsKey ("CumulativeCouponAmount") || - !mapFixFloat.containsKey ("CumulativeCouponDCF") || !mapFixFloat.containsKey - ("DerivedCleanPV") || !mapFixFloat.containsKey ("DerivedCumulativeCouponAmount") || - !mapFixFloat.containsKey ("DerivedCumulativeCouponDCF") || - !mapFixFloat.containsKey ("ReferenceCleanPV") || !mapFixFloat.containsKey - ("ReferenceCumulativeCouponAmount") || !mapFixFloat.containsKey - ("ReferenceCumulativeCouponDCF") || !mapFixFloat.containsKey - ("SwapRate")) - return null; - - double dblCleanPV = mapFixFloat.get ("CleanPV"); - - double dblSwapRate = mapFixFloat.get ("SwapRate"); - - double dblSwapRateSensitivity = 10000. * mapFixFloat.get ("CleanFixedDV01"); - - org.drip.state.identifier.ForwardLabel forwardLabel = ffc.derivedStream().forwardLabel(); - - org.drip.historical.engine.MarketMeasureRollDown mmrd = rollDownMeasureMap(); - - if (null == mmrd) return null; - - double dblRollDownInnate = mmrd.innate(); - - org.drip.analytics.support.CaseInsensitiveHashMap mapHorizonMetric = - mmrd.horizon(); - - try { - org.drip.historical.attribution.PositionMarketSnap pms = new - org.drip.historical.attribution.PositionMarketSnap (dtFirst, dblCleanPV); - - if (!pms.setR1 ("Accrued", mapFixFloat.get ("Accrued"))) return null; - - if (!pms.setR1 ("CleanFixedDV01", dblSwapRateSensitivity)) return null; - - if (!pms.setR1 ("CleanFloatingDV01", 10000. * mapFixFloat.get ("CleanFloatingDV01"))) - return null; - - if (!pms.setC1 ("CouponCurrency", forwardLabel.currency())) return null; - - if (!pms.setR1 ("CumulativeCouponAmount", mapFixFloat.get ("CumulativeCouponAmount"))) - return null; - - if (!pms.setR1 ("CumulativeCouponDCF", mapFixFloat.get ("CumulativeCouponDCF"))) return null; - - if (!pms.setR1 ("DerivedCleanPV", mapFixFloat.get ("DerivedCleanPV"))) return null; - - if (!pms.setDate ("EffectiveDate", ffc.effectiveDate())) return null; - - if (!pms.setC1 ("FixedAccrualDayCount", ffc.referenceStream().accrualDC())) return null; - - if (!pms.setR1 ("FixedCoupon", dblSwapRate)) return null; - - if (!pms.setR1 ("FixedCumulativeCouponAmount", mapFixFloat.get - ("ReferenceCumulativeCouponAmount"))) - return null; - - if (!pms.setR1 ("FixedCumulativeCouponDCF", mapFixFloat.get ("ReferenceCumulativeCouponDCF"))) - return null; - - if (!pms.setC1 ("FloatAccrualDayCount", forwardLabel.floaterIndex().dayCount())) return null; - - if (!pms.setR1 ("FloatCumulativeCouponAmount", mapFixFloat.get - ("DerivedCumulativeCouponAmount"))) - return null; - - if (!pms.setR1 ("FloatCumulativeCouponDCF", mapFixFloat.get ("DerivedCumulativeCouponDCF"))) - return null; - - if (!pms.setC1 ("FloaterLabel", forwardLabel.fullyQualifiedName())) return null; - - if (!pms.setDate ("MaturityDate", ffc.maturityDate())) return null; - - if (!pms.setC1 ("MaturityTenor", ffc.tenor())) return null; - - if (!pms.setC1 ("PayCurrency", strPayCurrency)) return null; - - if (!pms.setR1 ("ReferenceCleanPV", mapFixFloat.get ("ReferenceCleanPV"))) return null; - - if (!pms.setR1 ("SwapRate", dblSwapRate)) return null; - - if (!pms.setR1 ("SwapRateRollDown", dblRollDownInnate)) return null; - - for (java.lang.String strRollDownTenor : mapHorizonMetric.keySet()) { - if (!pms.setR1 ("SwapRateRollDown" + strRollDownTenor, mapHorizonMetric.get - (strRollDownTenor))) - return null; - } - - if (!pms.addManifestMeasureSnap ("SwapRate", dblSwapRate, -1. * dblSwapRateSensitivity, - dblRollDownInnate)) - return null; - - return pms; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public boolean updateFixings() - { - org.drip.product.rates.FixFloatComponent ffc = (org.drip.product.rates.FixFloatComponent) - component(); - - org.drip.product.rates.Stream floatingStream = ffc.derivedStream(); - - int iDate = secondDate().julian(); - - if (iDate > ffc.maturityDate().julian()) return false; - - int iEffectiveDate = ffc.effectiveDate().julian(); - - if (iDate <= iEffectiveDate) iDate = iEffectiveDate; - - org.drip.analytics.cashflow.CompositePeriod cpFixing = floatingStream.containingPeriod (iDate); - - if (null == cpFixing) return false; - - org.drip.analytics.cashflow.ComposableUnitPeriod cupEnclosing = cpFixing.enclosingCUP (iDate); - - if (null == cupEnclosing || !(cupEnclosing instanceof - org.drip.analytics.cashflow.ComposableUnitFloatingPeriod)) - return false; - - org.drip.param.market.CurveSurfaceQuoteContainer csqcFirst = firstMarketParameters(); - - org.drip.state.identifier.ForwardLabel forwardLabel = floatingStream.forwardLabel(); - - int iFixingDate = ((org.drip.analytics.cashflow.ComposableUnitFloatingPeriod) - cupEnclosing).referenceIndexPeriod().fixingDate(); - - try { - double dblResetFixingRate = cupEnclosing.baseRate (csqcFirst); - - return csqcFirst.setFixing (iFixingDate, forwardLabel, dblResetFixingRate) && - secondMarketParameters().setFixing (iFixingDate, forwardLabel, dblResetFixingRate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - @Override public org.drip.historical.attribution.PositionMarketSnap snapSecondMarketValue() - { - org.drip.analytics.date.JulianDate dtSecond = secondDate(); - - org.drip.product.rates.FixFloatComponent ffc = (org.drip.product.rates.FixFloatComponent) - component(); - - java.util.Map mapFixFloat = ffc.value - (org.drip.param.valuation.ValuationParams.Spot (dtSecond.addBusDays (settleLag(), - ffc.payCurrency()).julian()), null, secondMarketParameters(), null); - - if (null == mapFixFloat || !mapFixFloat.containsKey ("CleanFixedDV01") || !mapFixFloat.containsKey - ("CleanPV") || !mapFixFloat.containsKey ("CumulativeCouponAmount") || !mapFixFloat.containsKey - ("CumulativeCouponDCF") || !mapFixFloat.containsKey ("DerivedCumulativeCouponAmount") || - !mapFixFloat.containsKey ("DerivedCumulativeCouponDCF") || !mapFixFloat.containsKey - ("ReferenceCumulativeCouponAmount") || !mapFixFloat.containsKey - ("ReferenceCumulativeCouponDCF") || !mapFixFloat.containsKey ("ResetDate") || - !mapFixFloat.containsKey ("ResetRate") || !mapFixFloat.containsKey - ("SwapRate")) - return null; - - double dblSwapRate = mapFixFloat.get ("SwapRate"); - - try { - org.drip.historical.attribution.PositionMarketSnap pms = new - org.drip.historical.attribution.PositionMarketSnap (dtSecond, mapFixFloat.get ("CleanPV")); - - if (!pms.setR1 ("CumulativeCouponAmount", mapFixFloat.get ("CumulativeCouponAmount"))) - return null; - - if (!pms.setR1 ("CumulativeCouponDCF", mapFixFloat.get ("CumulativeCouponDCF"))) return null; - - if (!pms.setR1 ("FixedCumulativeCouponAmount", mapFixFloat.get - ("ReferenceCumulativeCouponAmount"))) - return null; - - if (!pms.setR1 ("FixedCumulativeCouponDCF", mapFixFloat.get ("ReferenceCumulativeCouponDCF"))) - return null; - - if (!pms.setR1 ("FloatCumulativeCouponAmount", mapFixFloat.get - ("DerivedCumulativeCouponAmount"))) - return null; - - if (!pms.setR1 ("FloatCumulativeCouponDCF", mapFixFloat.get ("DerivedCumulativeCouponDCF"))) - return null; - - if (!pms.setDate ("ResetDate", new org.drip.analytics.date.JulianDate ((int) (double) - mapFixFloat.get ("ResetDate")))) - return null; - - if (!pms.setR1 ("ResetRate", mapFixFloat.get ("ResetRate"))) return null; - - if (!pms.setR1 ("SwapRate", dblSwapRate)) return null; - - if (!pms.addManifestMeasureSnap ("SwapRate", dblSwapRate, -10000. * mapFixFloat.get - ("CleanFixedDV01"), 0.)) - return null; - - return pms; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.analytics.support.CaseInsensitiveHashMap - crossHorizonDifferentialMetrics ( - final org.drip.historical.attribution.PositionMarketSnap pmsFirst, - final org.drip.historical.attribution.PositionMarketSnap pmsSecond) - { - if (null == pmsFirst || null == pmsSecond) return null; - - org.drip.analytics.support.CaseInsensitiveHashMap mapDifferentialMetric = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - org.drip.analytics.date.JulianDate dtEffective = pmsFirst.date ("EffectiveDate"); - - java.lang.String strFixedAccrualDayCount = pmsFirst.c1 ("FixedAccrualDayCount"); - - java.lang.String strFloatAccrualDayCount = pmsFirst.c1 ("FloatAccrualDayCount"); - - java.lang.String strCalendar = pmsFirst.c1 ("PayCurrency"); - - int iDate1M = dtEffective.addTenor ("1M").julian(); - - int iDate3M = dtEffective.addTenor ("3M").julian(); - - int iEffectiveDate = dtEffective.julian(); - - try { - double dblFixedCumulativeCouponAmount = pmsSecond.r1 ("FixedCumulativeCouponAmount") - - pmsFirst.r1 ("FixedCumulativeCouponAmount"); - - double dblFixedCumulativeCouponDCF = pmsSecond.r1 ("FixedCumulativeCouponDCF") - pmsFirst.r1 - ("FixedCumulativeCouponDCF"); - - double dblFloatCumulativeCouponAmount = pmsSecond.r1 ("FloatCumulativeCouponAmount") - - pmsFirst.r1 ("FloatCumulativeCouponAmount"); - - double dblFloatCumulativeCouponDCF = pmsSecond.r1 ("FloatCumulativeCouponDCF") - pmsFirst.r1 - ("FloatCumulativeCouponDCF"); - - mapDifferentialMetric.put ("CumulativeCouponAmount", pmsSecond.r1 ("CumulativeCouponAmount") - - pmsFirst.r1 ("CumulativeCouponAmount")); - - mapDifferentialMetric.put ("CumulativeCouponDCF", pmsSecond.r1 ("CumulativeCouponDCF") - - pmsFirst.r1 ("CumulativeCouponDCF")); - - mapDifferentialMetric.put ("EffectiveFixedCouponRate", dblFixedCumulativeCouponAmount / - dblFixedCumulativeCouponDCF); - - mapDifferentialMetric.put ("EffectiveFloatCouponRate", dblFloatCumulativeCouponAmount / - dblFloatCumulativeCouponDCF); - - mapDifferentialMetric.put ("FixedAccrualDCF1M", - org.drip.analytics.daycount.Convention.YearFraction (iEffectiveDate, iDate1M, - strFixedAccrualDayCount, false, null, strCalendar)); - - mapDifferentialMetric.put ("FixedAccrualDCF3M", - org.drip.analytics.daycount.Convention.YearFraction (iEffectiveDate, iDate3M, - strFixedAccrualDayCount, false, null, strCalendar)); - - mapDifferentialMetric.put ("FixedCumulativeCouponAmount", dblFixedCumulativeCouponAmount); - - mapDifferentialMetric.put ("FixedCumulativeCouponDCF", dblFixedCumulativeCouponDCF); - - mapDifferentialMetric.put ("FloatAccrualDCF1M", - org.drip.analytics.daycount.Convention.YearFraction (iEffectiveDate, iDate1M, - strFloatAccrualDayCount, false, null, strCalendar)); - - mapDifferentialMetric.put ("FloatAccrualDCF3M", - org.drip.analytics.daycount.Convention.YearFraction (iEffectiveDate, iDate3M, - strFloatAccrualDayCount, false, null, strCalendar)); - - mapDifferentialMetric.put ("FloatCumulativeCouponAmount", dblFloatCumulativeCouponAmount); - - mapDifferentialMetric.put ("FloatCumulativeCouponDCF", dblFloatCumulativeCouponDCF); - - return mapDifferentialMetric; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/historical/engine/HorizonChangeExplainExecutor.java b/org/drip/historical/engine/HorizonChangeExplainExecutor.java deleted file mode 100644 index d8186a1..0000000 --- a/org/drip/historical/engine/HorizonChangeExplainExecutor.java +++ /dev/null @@ -1,98 +0,0 @@ - -package org.drip.historical.engine; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * HorizonChangeExplainExecutor executes the Sequence of Calls for the Calculation of the Component's Horizon - * Change Explain. - * - * @author Lakshmi Krishnamurthy - */ - -public class HorizonChangeExplainExecutor { - - /** - * Generate the Attribution for the Component's Horizon Change Explain Processor - * - * @param hcep The Component's Horizon Change Explain Processor - * - * @return The Position Change Components containing the Explains - */ - - public static final org.drip.historical.attribution.PositionChangeComponents GenerateAttribution ( - final org.drip.historical.engine.HorizonChangeExplainProcessor hcep) - { - if (null == hcep) return null; - - double dblMarketMeasureValue = hcep.marketMeasureValue(); - - java.lang.String strMarketMeasureName = hcep.marketMeasureName(); - - org.drip.historical.attribution.PositionMarketSnap pmsFirst = hcep.snapFirstMarketValue(); - - if (null == pmsFirst || !pmsFirst.setMarketMeasureName (strMarketMeasureName) || - !pmsFirst.setMarketMeasureValue (dblMarketMeasureValue) || !hcep.updateFixings()) - return null; - - org.drip.historical.attribution.PositionMarketSnap pmsSecond = hcep.snapSecondMarketValue(); - - if (null == pmsSecond || !pmsSecond.setMarketMeasureName (strMarketMeasureName) || - !pmsSecond.setMarketMeasureValue (dblMarketMeasureValue)) - return null; - - try { - return new org.drip.historical.attribution.PositionChangeComponents (false, pmsFirst, pmsSecond, - pmsSecond.cumulativeCouponAmount() - pmsFirst.cumulativeCouponAmount(), - hcep.crossHorizonDifferentialMetrics (pmsFirst, pmsSecond)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/historical/engine/HorizonChangeExplainProcessor.java b/org/drip/historical/engine/HorizonChangeExplainProcessor.java deleted file mode 100644 index 181d801..0000000 --- a/org/drip/historical/engine/HorizonChangeExplainProcessor.java +++ /dev/null @@ -1,272 +0,0 @@ - -package org.drip.historical.engine; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * - * This file is part of DRIP, a free-software/open-source library for fixed income analysts and developers - - * http://www.credit-trader.org/Begin.html - * - * DRIP is a free, full featured, fixed income rates, credit, and FX analytics library with a focus towards - * pricing/valuation, risk, and market making. - * - * 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. - */ - -/** - * HorizonChangeExplainProcessor holds the Stubs associated with the Computation of the Horizon Position - * Change Components for the given Product. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class HorizonChangeExplainProcessor { - private int _iSettleLag = -1; - private java.lang.String _strMarketMeasureName = ""; - private org.drip.product.definition.Component _comp = null; - private org.drip.analytics.date.JulianDate _dtFirst = null; - private org.drip.analytics.date.JulianDate _dtSecond = null; - private double _dblMarketMeasureValue = java.lang.Double.NaN; - private org.drip.param.market.CurveSurfaceQuoteContainer _csqcFirst = null; - private org.drip.param.market.CurveSurfaceQuoteContainer _csqcSecond = null; - private - org.drip.analytics.support.CaseInsensitiveHashMap - _mapCSQCRollDown = null; - - protected HorizonChangeExplainProcessor ( - final org.drip.product.definition.Component comp, - final int iSettleLag, - final java.lang.String strMarketMeasureName, - final double dblMarketMeasureValue, - final org.drip.analytics.date.JulianDate dtFirst, - final org.drip.analytics.date.JulianDate dtSecond, - final org.drip.param.market.CurveSurfaceQuoteContainer csqcFirst, - final org.drip.param.market.CurveSurfaceQuoteContainer csqcSecond, - final - org.drip.analytics.support.CaseInsensitiveHashMap - mapCSQCRollDown) - throws java.lang.Exception - { - if (null == (_comp = comp) || 0 > (_iSettleLag = iSettleLag) || null == (_strMarketMeasureName = - strMarketMeasureName) || _strMarketMeasureName.isEmpty() || - !org.drip.quant.common.NumberUtil.IsValid (_dblMarketMeasureValue = dblMarketMeasureValue) || - null == (_dtFirst = dtFirst) || null == (_dtSecond = dtSecond) || _dtSecond.julian() <= - _dtFirst.julian() || null == (_csqcFirst = csqcFirst) || null == (_csqcSecond = - csqcSecond) || null == (_mapCSQCRollDown = mapCSQCRollDown)) - throw new java.lang.Exception ("HorizonChangeExplainProcessor Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Component - * - * @return The Component - */ - - public org.drip.product.definition.Component component() - { - return _comp; - } - - /** - * Retrieve the Component Settle Lag - * - * @return The Component Settle Lag - */ - - public int settleLag() - { - return _iSettleLag; - } - - /** - * Retrieve the Component Market Measure Name - * - * @return The Component Market Measure Name - */ - - public java.lang.String marketMeasureName() - { - return _strMarketMeasureName; - } - - /** - * Retrieve the Component Market Measure Value - * - * @return The Component Market Measure Value - */ - - public double marketMeasureValue() - { - return _dblMarketMeasureValue; - } - - /** - * Retrieve the First Date of the Horizon Change - * - * @return The First Date of the Horizon Change - */ - - public org.drip.analytics.date.JulianDate firstDate() - { - return _dtFirst; - } - - /** - * Retrieve the First Date's Market Parameters - * - * @return The First Date's Market Parameters - */ - - public org.drip.param.market.CurveSurfaceQuoteContainer firstMarketParameters() - { - return _csqcFirst; - } - - /** - * Retrieve the Second Date of the Horizon Change - * - * @return The Second Date of the Horizon Change - */ - - public org.drip.analytics.date.JulianDate secondDate() - { - return _dtSecond; - } - - /** - * Retrieve the Second Date's Market Parameters - * - * @return The Second Date's Market Parameters - */ - - public org.drip.param.market.CurveSurfaceQuoteContainer secondMarketParameters() - { - return _csqcSecond; - } - - /** - * Retrieve the Map of the Roll Down Market Parameters - * - * @return Map of the Roll Down Market Parameters - */ - - public - org.drip.analytics.support.CaseInsensitiveHashMap - rollDownMarketParameters() - { - return _mapCSQCRollDown; - } - - /** - * Generate the Map of the Roll Down Market Quote Metrics - * - * @return Map of the Roll Down Market Quote Metrics - */ - - public org.drip.historical.engine.MarketMeasureRollDown rollDownMeasureMap() - { - org.drip.param.valuation.ValuationParams valParamsRollDown = - org.drip.param.valuation.ValuationParams.Spot (_dtSecond.addBusDays (_iSettleLag, - _comp.payCurrency()).julian()); - - java.util.Set setstrRollDownTenor = _mapCSQCRollDown.keySet(); - - org.drip.historical.engine.MarketMeasureRollDown mmrd = null; - - for (java.lang.String strRollDownTenor : setstrRollDownTenor) { - java.util.Map mapCompMeasures = _comp.value - (valParamsRollDown, null, _mapCSQCRollDown.get (strRollDownTenor), null); - - if (null == mapCompMeasures || !mapCompMeasures.containsKey (_strMarketMeasureName)) return null; - - if ("Native".equalsIgnoreCase (strRollDownTenor)) { - try { - mmrd = new org.drip.historical.engine.MarketMeasureRollDown (mapCompMeasures.get - (_strMarketMeasureName)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } else - mmrd.add (strRollDownTenor, mapCompMeasures.get (_strMarketMeasureName)); - } - - return mmrd; - } - - /** - * Generate the Roll Up Version of the Quote Metric - * - * @return The Roll Up Version of the Quote Metric - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double metricRollUp() - throws java.lang.Exception - { - java.util.Map mapCompMeasures = _comp.value - (org.drip.param.valuation.ValuationParams.Spot (_dtSecond.addBusDays (_iSettleLag, - _comp.payCurrency()).julian()), null, _csqcFirst, null); - - if (null == mapCompMeasures || !mapCompMeasures.containsKey (_strMarketMeasureName)) - throw new java.lang.Exception ("HorizonChangeExplainProcessor::metricRollUp => Invalid Inputs"); - - return mapCompMeasures.get (_strMarketMeasureName); - } - - /** - * Generate and Snap Relevant Fields from the First Market Valuation Parameters - * - * @return The First Market Parameters Valuation Snapshot - */ - - public abstract org.drip.historical.attribution.PositionMarketSnap snapFirstMarketValue(); - - /** - * Update the Fixings (if any) to the Second Market Parameters - * - * @return TRUE - The Fixings were successfully updated to the Second Market Parameters - */ - - public abstract boolean updateFixings(); - - /** - * Generate and Snap Relevant Fields from the Second Market Valuation Parameters - * - * @return The Second Market Parameters Valuation Snapshot - */ - - public abstract org.drip.historical.attribution.PositionMarketSnap snapSecondMarketValue(); - - /** - * Generate the Horizon Differential Metrics Map - * - * @param pmsFirst The First Position Market Snap - * @param pmsSecond The Second Position Market Snap - * - * @return The Horizon Differential Metrics Map - */ - - public abstract org.drip.analytics.support.CaseInsensitiveHashMap - crossHorizonDifferentialMetrics ( - final org.drip.historical.attribution.PositionMarketSnap pmsFirst, - final org.drip.historical.attribution.PositionMarketSnap pmsSecond); -} diff --git a/org/drip/historical/engine/MarketMeasureRollDown.java b/org/drip/historical/engine/MarketMeasureRollDown.java deleted file mode 100644 index 73c8228..0000000 --- a/org/drip/historical/engine/MarketMeasureRollDown.java +++ /dev/null @@ -1,142 +0,0 @@ - -package org.drip.historical.engine; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * MarketMeasureRollDown holds the Map of the Market Measure Roll Down Values for the Native as well as the - * Additional Horizon Tenors. - * - * @author Lakshmi Krishnamurthy - */ - -public class MarketMeasureRollDown { - private double _dblInnate = java.lang.Double.NaN; - - private org.drip.analytics.support.CaseInsensitiveHashMap _mapHorizonMetric = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - /** - * MarketMeasureRollDown Constructor - * - * @param dblInnate The Native Roll Down Market Metric - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public MarketMeasureRollDown ( - final double dblInnate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblInnate = dblInnate)) - throw new java.lang.Exception ("MarketMeasureRollDown Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Innate Roll Down Market Measure - * - * @return The Innate Roll Down Market Measure - */ - - public double innate() - { - return _dblInnate; - } - - /** - * Add the Custom Horizon Market Measure Roll Down Metric Value - * - * @param strHorizon The Custom Horizon - * @param dblHorizonRollDown The Custom Horizon Market Measure Roll Down Metric Value - * - * @return TRUE - The Custom Horizon Market Measure Roll Down Metric Value successfully set - */ - - public boolean add ( - final java.lang.String strHorizon, - final double dblHorizonRollDown) - { - if (null == strHorizon || strHorizon.isEmpty() || !org.drip.quant.common.NumberUtil.IsValid - (dblHorizonRollDown)) - return false; - - _mapHorizonMetric.put (strHorizon, dblHorizonRollDown); - - return true; - } - - /** - * Retrieve the Horizon Market Metric - * - * @param strHorizon The Horizon - * - * @return The Roll Down Market Metric corresponding to the Horizon - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double horizon ( - final java.lang.String strHorizon) - throws java.lang.Exception - { - if (null == strHorizon || strHorizon.isEmpty() || !_mapHorizonMetric.containsKey (strHorizon)) - throw new java.lang.Exception ("MarketMeasureRollDown::horizon => Invalid Inputs"); - - return _mapHorizonMetric.get (strHorizon); - } - - /** - * Retrieve the Roll Down Horizon Metric Map - * - * @return The Roll Down Horizon Metric Map - */ - - public org.drip.analytics.support.CaseInsensitiveHashMap horizon() - { - return _mapHorizonMetric; - } -} diff --git a/org/drip/historical/engine/TreasuryBondExplainProcessor.java b/org/drip/historical/engine/TreasuryBondExplainProcessor.java deleted file mode 100644 index 1b5dbaf..0000000 --- a/org/drip/historical/engine/TreasuryBondExplainProcessor.java +++ /dev/null @@ -1,327 +0,0 @@ - -package org.drip.historical.engine; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TreasuryBondExplainProcessor contains the Functionality associated with the Horizon Analysis of the - * Treasury Bond. - * - * @author Lakshmi Krishnamurthy - */ - -public class TreasuryBondExplainProcessor extends org.drip.historical.engine.HorizonChangeExplainProcessor { - - /** - * TreasuryBondExplainProcessor Constructor - * - * @param tsyComponent The Treasury Component - * @param strMarketMeasureName The Market Measure Name - * @param dblMarketMeasureValue The Market Measure Value - * @param dtFirst First Date - * @param dtSecond Second Date - * @param csqcFirst First Market Parameters - * @param csqcSecond Second Market Parameters - * @param mapCSQCRollDown Map of the Roll Down Market Parameters - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public TreasuryBondExplainProcessor ( - final org.drip.product.govvie.TreasuryComponent tsyComponent, - final java.lang.String strMarketMeasureName, - final double dblMarketMeasureValue, - final org.drip.analytics.date.JulianDate dtFirst, - final org.drip.analytics.date.JulianDate dtSecond, - final org.drip.param.market.CurveSurfaceQuoteContainer csqcFirst, - final org.drip.param.market.CurveSurfaceQuoteContainer csqcSecond, - final - org.drip.analytics.support.CaseInsensitiveHashMap - mapCSQCRollDown) - throws java.lang.Exception - { - super (tsyComponent, 0, strMarketMeasureName, dblMarketMeasureValue, dtFirst, dtSecond, csqcFirst, - csqcSecond, mapCSQCRollDown); - } - - @Override public org.drip.historical.engine.MarketMeasureRollDown rollDownMeasureMap() - { - org.drip.product.definition.Component comp = component(); - - int iMaturityDate = comp.maturityDate().julian(); - - org.drip.historical.engine.MarketMeasureRollDown mmrd = null; - - org.drip.state.identifier.GovvieLabel govvieLabel = comp.govvieLabel(); - - org.drip.analytics.support.CaseInsensitiveHashMap - mapCSQCRollDown = rollDownMarketParameters(); - - for (java.lang.String strRollDownTenor : mapCSQCRollDown.keySet()) { - org.drip.state.govvie.GovvieCurve gc = mapCSQCRollDown.get (strRollDownTenor).govvieState - (govvieLabel); - - try { - double dblMarketMeasureRollDown = gc.yield (iMaturityDate); - - if ("Native".equalsIgnoreCase (strRollDownTenor)) - mmrd = new org.drip.historical.engine.MarketMeasureRollDown (dblMarketMeasureRollDown); - else - mmrd.add (strRollDownTenor, dblMarketMeasureRollDown); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return mmrd; - } - - @Override public org.drip.historical.attribution.PositionMarketSnap snapFirstMarketValue() - { - org.drip.analytics.date.JulianDate dtValuation = firstDate(); - - org.drip.product.govvie.TreasuryComponent tsyComponent = (org.drip.product.govvie.TreasuryComponent) - component(); - - org.drip.param.market.CurveSurfaceQuoteContainer csqc = firstMarketParameters(); - - org.drip.state.identifier.GovvieLabel govvieLabel = tsyComponent.govvieLabel(); - - org.drip.analytics.date.JulianDate dtEffective = tsyComponent.effectiveDate(); - - org.drip.analytics.date.JulianDate dtMaturity = tsyComponent.maturityDate(); - - org.drip.state.govvie.GovvieCurve gc = csqc.govvieState (govvieLabel); - - double dblFixedCoupon = tsyComponent.couponSetting().couponRate(); - - java.lang.String strCurrency = tsyComponent.currency(); - - int iValuationDate = dtValuation.julian(); - - org.drip.param.valuation.ValuationParams valParams = org.drip.param.valuation.ValuationParams.Spot - (iValuationDate); - - org.drip.historical.engine.MarketMeasureRollDown mmrd = rollDownMeasureMap(); - - if (null == mmrd) return null; - - double dblRollDownInnate = mmrd.innate(); - - org.drip.analytics.support.CaseInsensitiveHashMap mapHorizonMetric = - mmrd.horizon(); - - java.lang.String strAccrualDC = tsyComponent.accrualDC(); - - try { - double dblYield = gc.yield (dtMaturity.julian()); - - double dblAccrued = tsyComponent.accrued (iValuationDate, csqc); - - double dblCleanPrice = tsyComponent.priceFromYield (valParams, csqc, null, dblYield); - - double dblYieldSensitivity = 10000. * tsyComponent.modifiedDurationFromYield (valParams, csqc, - null, dblYield); - - double dblCumulativeCouponDCF = org.drip.analytics.daycount.Convention.YearFraction - (dtEffective.julian(), iValuationDate, strAccrualDC, false, - org.drip.analytics.daycount.ActActDCParams.FromFrequency (gc.freq()), strCurrency); - - org.drip.historical.attribution.PositionMarketSnap pms = new - org.drip.historical.attribution.PositionMarketSnap (dtValuation, dblCleanPrice); - - if (!pms.setR1 ("Accrued", dblAccrued)) return null; - - if (!pms.setC1 ("AccruedDC", strAccrualDC)) return null; - - if (!pms.setR1 ("CleanPrice", dblCleanPrice)) return null; - - if (!pms.setR1 ("CumulativeCouponAmount", dblCumulativeCouponDCF * dblFixedCoupon)) return null; - - if (!pms.setR1 ("CumulativeCouponDCF", dblCumulativeCouponDCF)) return null; - - if (!pms.setC1 ("Currency", strCurrency)) return null; - - if (!pms.setR1 ("DirtyPrice", dblCleanPrice + dblAccrued)) return null; - - if (!pms.setDate ("EffectiveDate", dtEffective)) return null; - - if (!pms.setC1 ("FixedAccrualDayCount", strAccrualDC)) return null; - - if (!pms.setR1 ("FixedCoupon", dblFixedCoupon)) return null; - - if (!pms.setDate ("MaturityDate", dtMaturity)) return null; - - if (!pms.setC1 ("MaturityTenor", tsyComponent.tenor())) return null; - - if (!pms.setR1 ("ModifiedDuration", dblYieldSensitivity)) return null; - - if (!pms.setR1 ("Yield", dblYield)) return null; - - if (!pms.setR1 ("YieldRollDown", dblRollDownInnate)) return null; - - for (java.lang.String strRollDownTenor : mapHorizonMetric.keySet()) { - if (!pms.setR1 ("YieldRollDown" + strRollDownTenor, mapHorizonMetric.get (strRollDownTenor))) - return null; - } - - if (!pms.addManifestMeasureSnap ("Yield", dblYield, -1. * dblYieldSensitivity, - dblRollDownInnate)) - return null; - - return pms; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public boolean updateFixings() - { - return true; - } - - @Override public org.drip.historical.attribution.PositionMarketSnap snapSecondMarketValue() - { - org.drip.product.govvie.TreasuryComponent tsyComponent = (org.drip.product.govvie.TreasuryComponent) - component(); - - org.drip.analytics.date.JulianDate dtValuation = secondDate(); - - int iValuationDate = dtValuation.julian(); - - org.drip.param.market.CurveSurfaceQuoteContainer csqc = secondMarketParameters(); - - org.drip.param.valuation.ValuationParams valParams = org.drip.param.valuation.ValuationParams.Spot - (iValuationDate); - - try { - org.drip.state.govvie.GovvieCurve gc = csqc.govvieState (tsyComponent.govvieLabel()); - - double dblYield = gc.yield (tsyComponent.maturityDate().julian()); - - double dblCumulativeCouponDCF = org.drip.analytics.daycount.Convention.YearFraction - (tsyComponent.effectiveDate().julian(), iValuationDate, tsyComponent.accrualDC(), false, - org.drip.analytics.daycount.ActActDCParams.FromFrequency (gc.freq()), - tsyComponent.currency()); - - org.drip.historical.attribution.PositionMarketSnap pms = new - org.drip.historical.attribution.PositionMarketSnap (dtValuation, tsyComponent.priceFromYield - (valParams, csqc, null, dblYield)); - - if (!pms.setR1 ("CumulativeCouponAmount", dblCumulativeCouponDCF * - tsyComponent.couponSetting().couponRate())) - return null; - - if (!pms.setR1 ("CumulativeCouponDCF", dblCumulativeCouponDCF)) return null; - - if (!pms.setR1 ("Yield", dblYield)) return null; - - if (!pms.addManifestMeasureSnap ("Yield", dblYield, -10000. * - tsyComponent.modifiedDurationFromYield (valParams, csqc, null, dblYield), 0.)) - return null; - - return pms; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.analytics.support.CaseInsensitiveHashMap - crossHorizonDifferentialMetrics ( - final org.drip.historical.attribution.PositionMarketSnap pmsFirst, - final org.drip.historical.attribution.PositionMarketSnap pmsSecond) - { - if (null == pmsFirst || null == pmsSecond) return null; - - org.drip.analytics.support.CaseInsensitiveHashMap mapDifferentialMetric = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - org.drip.analytics.date.JulianDate dtEffective = pmsFirst.date ("EffectiveDate"); - - java.lang.String strAccrualDC = pmsFirst.c1 ("AccruedDC"); - - java.lang.String strCalendar = pmsFirst.c1 ("Currency"); - - int iDate1M = dtEffective.addTenor ("1M").julian(); - - int iDate3M = dtEffective.addTenor ("3M").julian(); - - int iEffectiveDate = dtEffective.julian(); - - org.drip.analytics.daycount.ActActDCParams aap = - org.drip.analytics.daycount.ActActDCParams.FromFrequency - (((org.drip.product.govvie.TreasuryComponent) component()).freq()); - - try { - mapDifferentialMetric.put ("CumulativeCouponAmount", pmsSecond.r1 ("CumulativeCouponAmount") - - pmsFirst.r1 ("CumulativeCouponAmount")); - - mapDifferentialMetric.put ("CumulativeCouponDCF", pmsSecond.r1 ("CumulativeCouponDCF") - - pmsFirst.r1 ("CumulativeCouponDCF")); - - mapDifferentialMetric.put ("CumulativeCouponDCF1M", - org.drip.analytics.daycount.Convention.YearFraction (iEffectiveDate, iDate1M, strAccrualDC, - false, aap, strCalendar)); - - mapDifferentialMetric.put ("CumulativeCouponDCF3M", - org.drip.analytics.daycount.Convention.YearFraction (iEffectiveDate, iDate3M, strAccrualDC, - false, aap, strCalendar)); - - return mapDifferentialMetric; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/historical/sensitivity/TenorDurationNodeMetrics.java b/org/drip/historical/sensitivity/TenorDurationNodeMetrics.java deleted file mode 100644 index 8b50620..0000000 --- a/org/drip/historical/sensitivity/TenorDurationNodeMetrics.java +++ /dev/null @@ -1,239 +0,0 @@ - -package org.drip.historical.sensitivity; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TenorDurationNodeMetrics holds the KRD Duration Nodes and associated Metrics. - * - * @author Lakshmi Krishnamurthy - */ - -public class TenorDurationNodeMetrics { - private org.drip.analytics.date.JulianDate _dtSnap = null; - - private java.util.Map _mapCustomC1 = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - private java.util.Map _mapCustomR1 = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap _mapKRD = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private java.util.Map _mapCustomDate = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - /** - * TenorDurationNodeMetrics Constructor - * - * @param dtSnap The Date Snap - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public TenorDurationNodeMetrics ( - final org.drip.analytics.date.JulianDate dtSnap) - throws java.lang.Exception - { - if (null == (_dtSnap = dtSnap)) - throw new java.lang.Exception ("TenorDurationNodeMetrics ctr: Invalid Inputs"); - } - - /** - * Retrieve the KRD Date Snap - * - * @return The KRD Date Snap - */ - - public org.drip.analytics.date.JulianDate dateSnap() - { - return _dtSnap; - } - - /** - * Insert a KRD Node - * - * @param strKRDNode KRD Node Key - * @param dblKRDValue KRD Node Value - * - * @return TRUE - The KRD Entry successfully inserted - */ - - public boolean addKRDNode ( - final java.lang.String strKRDNode, - final double dblKRDValue) - { - if (null == strKRDNode || strKRDNode.isEmpty() || !org.drip.quant.common.NumberUtil.IsValid - (dblKRDValue)) - return false; - - _mapKRD.put (strKRDNode, dblKRDValue); - - return true; - } - - /** - * Retrieve the KRD Map - * - * @return The KRD Map - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap krdMap() - { - return _mapKRD; - } - - /** - * Set the Custom Date Entry corresponding to the Specified Key - * - * @param strKey The Key - * @param dtCustom The Custom Date Entry - * - * @return TRUE - Custom Date successfully set - */ - - public boolean setDate ( - final java.lang.String strKey, - final org.drip.analytics.date.JulianDate dtCustom) - { - if (null == strKey || strKey.isEmpty() || null == dtCustom) return false; - - _mapCustomDate.put (strKey, dtCustom); - - return true; - } - - /** - * Retrieve the Custom Date Entry corresponding to the Specified Key - * - * @param strKey The Key - * - * @return The Custom Date Entry - */ - - public org.drip.analytics.date.JulianDate date ( - final java.lang.String strKey) - { - return null == strKey || !_mapCustomDate.containsKey (strKey) ? null : _mapCustomDate.get (strKey); - } - - /** - * Set the Custom C^1 Entry corresponding to the Specified Key - * - * @param strKey The Key - * @param strC1 The Custom C^1 Entry - * - * @return TRUE - Custom C^1 Entry successfully set - */ - - public boolean setC1 ( - final java.lang.String strKey, - final java.lang.String strC1) - { - if (null == strKey || strKey.isEmpty() || null == strC1 || strC1.isEmpty()) return false; - - _mapCustomC1.put (strKey, strC1); - - return true; - } - - /** - * Retrieve the Custom C^1 Entry corresponding to the Specified Key - * - * @param strKey The Key - * - * @return The Custom C^1 Entry - */ - - public java.lang.String c1 ( - final java.lang.String strKey) - { - return null == strKey || !_mapCustomC1.containsKey (strKey) ? null : _mapCustomC1.get (strKey); - } - - /** - * Set the Custom R^1 Entry corresponding to the Specified Key - * - * @param strKey The Key - * @param dblR1 The Custom R^1 Entry - * - * @return TRUE - Custom Number successfully set - */ - - public boolean setR1 ( - final java.lang.String strKey, - final double dblR1) - { - if (null == strKey || strKey.isEmpty() || !org.drip.quant.common.NumberUtil.IsValid (dblR1)) - return false; - - _mapCustomR1.put (strKey, dblR1); - - return true; - } - - /** - * Retrieve the Custom R^1 Entry corresponding to the Specified Key - * - * @param strKey The Key - * - * @return The Custom R^1 Entry - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double r1 ( - final java.lang.String strKey) - throws java.lang.Exception - { - if (null == strKey || !_mapCustomR1.containsKey (strKey)) - throw new java.lang.Exception ("PositionMarketSnap::r1 => Invalid Inputs"); - - return _mapCustomR1.get (strKey); - } -} diff --git a/org/drip/historical/state/CreditCurveMetrics.java b/org/drip/historical/state/CreditCurveMetrics.java deleted file mode 100644 index ca98629..0000000 --- a/org/drip/historical/state/CreditCurveMetrics.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.historical.state; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CreditCurveMetrics holds the computed Metrics associated the Credit Curve State. - * - * @author Lakshmi Krishnamurthy - */ - -public class CreditCurveMetrics { - private org.drip.analytics.date.JulianDate _dtClose = null; - - private java.util.TreeMap _mapSurvivalProbability = - new java.util.TreeMap(); - - private java.util.TreeMap _mapRecoveryRate = new - java.util.TreeMap(); - - /** - * CreditCurveMetrics Constructor - * - * @param dtClose The Closing Date - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public CreditCurveMetrics ( - final org.drip.analytics.date.JulianDate dtClose) - throws java.lang.Exception - { - if (null == (_dtClose = dtClose)) - throw new java.lang.Exception ("CreditCurveMetrics Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Closing Date - * - * @return The Closing Date - */ - - public org.drip.analytics.date.JulianDate close() - { - return _dtClose; - } - - /** - * Add the Survival Probability corresponding to the specified Date - * - * @param dt The Date - * @param dblSurvivalProbability The Survival Probability - * - * @return TRUE - The Dated Survival Probability successfully added - */ - - public boolean addSurvivalProbability ( - final org.drip.analytics.date.JulianDate dt, - final double dblSurvivalProbability) - { - if (null == dt || !org.drip.quant.common.NumberUtil.IsValid (dblSurvivalProbability)) return false; - - _mapSurvivalProbability.put (dt, dblSurvivalProbability); - - return true; - } - - /** - * Add the Recovery Rate corresponding to the specified Date - * - * @param dt The Date - * @param dblRecoveryRate The Recovery Rate - * - * @return TRUE - The Dated Recovery Rate successfully added - */ - - public boolean addRecoveryRate ( - final org.drip.analytics.date.JulianDate dt, - final double dblRecoveryRate) - { - if (null == dt || !org.drip.quant.common.NumberUtil.IsValid (dblRecoveryRate)) return false; - - _mapRecoveryRate.put (dt, dblRecoveryRate); - - return true; - } - - /** - * Retrieve the Survival Probability corresponding to the specified Date - * - * @param dt The Specified Date - * - * @return The corresponding Survival Probability - * - * @throws java.lang.Exception Thrown if the Survival Probability cannot be retrieved - */ - - public double survivalProbability ( - final org.drip.analytics.date.JulianDate dt) - throws java.lang.Exception - { - if (null == dt || !_mapSurvivalProbability.containsKey (dt)) - throw new java.lang.Exception ("CreditCurveMetrics::survivalProbability => Invalid Inputs"); - - return _mapSurvivalProbability.get (dt); - } - - /** - * Retrieve the Recovery Rate corresponding to the specified Date - * - * @param dt The Specified Date - * - * @return The corresponding Recovery Rate - * - * @throws java.lang.Exception Thrown if the Recovery Rate cannot be retrieved - */ - - public double recoveryRate ( - final org.drip.analytics.date.JulianDate dt) - throws java.lang.Exception - { - if (null == dt || !_mapRecoveryRate.containsKey (dt)) - throw new java.lang.Exception ("CreditCurveMetrics::recoveryRate => Invalid Inputs"); - - return _mapRecoveryRate.get (dt); - } -} diff --git a/org/drip/historical/state/FundingCurveMetrics.java b/org/drip/historical/state/FundingCurveMetrics.java deleted file mode 100644 index 5df7c57..0000000 --- a/org/drip/historical/state/FundingCurveMetrics.java +++ /dev/null @@ -1,151 +0,0 @@ - -package org.drip.historical.state; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FundingCurveMetrics holds the computed Metrics associated the Funding Curve State. - * - * @author Lakshmi Krishnamurthy - */ - -public class FundingCurveMetrics { - private org.drip.analytics.date.JulianDate _dtClose = null; - - private - org.drip.analytics.support.CaseInsensitiveHashMap> - _mapInForNativeLIBOR = new - org.drip.analytics.support.CaseInsensitiveHashMap>(); - - /** - * FundingCurveMetrics Constructor - * - * @param dtClose The Closing Date - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public FundingCurveMetrics ( - final org.drip.analytics.date.JulianDate dtClose) - throws java.lang.Exception - { - if (null == (_dtClose = dtClose)) - throw new java.lang.Exception ("FundingCurveMetrics Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Closing Date - * - * @return The Closing Date - */ - - public org.drip.analytics.date.JulianDate close() - { - return _dtClose; - } - - /** - * Add the Native Forward Rate for the specified In/For Start/Forward Tenors - * - * @param strInTenor "In" Start Tenor - * @param strForTenor "For" Forward Tenor - * @param dblForwardRate Forward Rate - * - * @return TRUE - The Native Forward Rate successfully added - */ - - public boolean addNativeForwardRate ( - final java.lang.String strInTenor, - final java.lang.String strForTenor, - final double dblForwardRate) - { - if (null == strInTenor || strInTenor.isEmpty() || null == strForTenor || strForTenor.isEmpty() || - !org.drip.quant.common.NumberUtil.IsValid (dblForwardRate)) - return false; - - if (!_mapInForNativeLIBOR.containsKey (strInTenor)) { - org.drip.analytics.support.CaseInsensitiveHashMap mapForwardRate = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - mapForwardRate.put (strForTenor, dblForwardRate); - - _mapInForNativeLIBOR.put (strInTenor, mapForwardRate); - } else - _mapInForNativeLIBOR.get (strInTenor).put (strForTenor, dblForwardRate); - - return true; - } - - /** - * Retrieve the Native Forward Rate given the In/For Tenors - * - * @param strInTenor "In" Start Tenor - * @param strForTenor "For" Forward Tenor - * - * @return The Native Forward Rate - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double nativeForwardRate ( - final java.lang.String strInTenor, - final java.lang.String strForTenor) - throws java.lang.Exception - { - if (null == strInTenor || strInTenor.isEmpty() || null == strForTenor || strForTenor.isEmpty() || - !_mapInForNativeLIBOR.containsKey (strInTenor)) - throw new java.lang.Exception ("FundingCurveMetrics::forwardRate => Invalid Inputs"); - - org.drip.analytics.support.CaseInsensitiveHashMap mapForwardRate = - _mapInForNativeLIBOR.get (strInTenor); - - if (null == mapForwardRate || !mapForwardRate.containsKey (strForTenor)) - throw new java.lang.Exception ("FundingCurveMetrics::forwardRate => Invalid Inputs"); - - return mapForwardRate.get (strForTenor); - } -} diff --git a/org/drip/json/assetallocation/BlackLittermanProcessor.java b/org/drip/json/assetallocation/BlackLittermanProcessor.java deleted file mode 100644 index 40ab243..0000000 --- a/org/drip/json/assetallocation/BlackLittermanProcessor.java +++ /dev/null @@ -1,185 +0,0 @@ - -package org.drip.json.assetallocation; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * BlackLittermanProcessor Sets Up and Executes a JSON Based In/Out Processing Service for the Black - * Litterman Bayesian View Incorporation/Parameter Estimation. - * - * @author Lakshmi Krishnamurthy - */ - -public class BlackLittermanProcessor { - - /** - * JSON Based in/out Bayesian Co-variance/Returns Estimation Thunker - * - * @param jsonParameter Bayesian Co-variance/Returns Estimation Parameters - * - * @return JSON Bayesian Co-variance/Returns Estimation Response - */ - - @SuppressWarnings ("unchecked") public static final org.drip.json.simple.JSONObject Estimate ( - final org.drip.json.simple.JSONObject jsonParameter) - { - java.lang.String[] astrAssetID = org.drip.json.parser.Converter.StringArrayEntry (jsonParameter, - "AssetSet"); - - double[][] aadblAssetSpaceViewProjection = org.drip.json.parser.Converter.DualDoubleArrayEntry - (jsonParameter, "AssetSpaceViewProjection"); - - double dblTau = java.lang.Double.NaN; - double dblRiskAversion = java.lang.Double.NaN; - double dblRiskFreeRate = java.lang.Double.NaN; - org.drip.measure.gaussian.R1MultivariateNormal viewDistribution = null; - org.drip.portfolioconstruction.bayesian.BlackLittermanCombinationEngine blce = null; - int iNumView = null == aadblAssetSpaceViewProjection ? 0 : aadblAssetSpaceViewProjection.length; - java.lang.String[] astrProjectionName = 0 == iNumView? null : new java.lang.String[iNumView]; - - double[] adblAssetEquilibriumWeight = org.drip.json.parser.Converter.DoubleArrayEntry (jsonParameter, - "AssetEquilibriumWeight"); - - double[][] aadblAssetExcessReturnsCovariance = org.drip.json.parser.Converter.DualDoubleArrayEntry - (jsonParameter, "AssetExcessReturnsCovariance"); - - double[] adblProjectionExpectedExcessReturns = org.drip.json.parser.Converter.DoubleArrayEntry - (jsonParameter, "ProjectionExpectedExcessReturns"); - - double[][] aadblProjectionExcessReturnsCovariance = - org.drip.json.parser.Converter.DualDoubleArrayEntry (jsonParameter, - "ProjectionExcessReturnsCovariance"); - - for (int i = 0; i < iNumView ; ++i) - astrProjectionName[i] = "PROJECTION #" + i; - - try { - dblTau = org.drip.json.parser.Converter.DoubleEntry (jsonParameter, "Tau"); - - dblRiskAversion = org.drip.json.parser.Converter.DoubleEntry (jsonParameter, "Delta"); - - dblRiskFreeRate = org.drip.json.parser.Converter.DoubleEntry (jsonParameter, "RiskFreeRate"); - - viewDistribution = org.drip.measure.gaussian.R1MultivariateNormal.Standard (new - org.drip.measure.continuousjoint.MultivariateMeta (astrProjectionName), - adblProjectionExpectedExcessReturns, aadblProjectionExcessReturnsCovariance); - - blce = new org.drip.portfolioconstruction.bayesian.BlackLittermanCombinationEngine - (org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput.Reverse - (org.drip.portfolioconstruction.asset.Portfolio.Standard (astrAssetID, - adblAssetEquilibriumWeight), aadblAssetExcessReturnsCovariance, dblRiskAversion), new - org.drip.portfolioconstruction.bayesian.PriorControlSpecification (false, - dblRiskFreeRate, dblTau), new - org.drip.portfolioconstruction.bayesian.ProjectionSpecification - (viewDistribution, aadblAssetSpaceViewProjection)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.portfolioconstruction.bayesian.BlackLittermanCustomConfidenceOutput blo = blce.customConfidenceRun(); - - if (null == blo) return null; - - org.drip.measure.bayesian.JointPosteriorMetrics jpm = blo.combinationMetrics(); - - org.drip.measure.continuousjoint.R1Multivariate r1mPrior = jpm.prior(); - - org.drip.measure.continuousjoint.R1Multivariate r1mJoint = jpm.joint(); - - org.drip.measure.continuousjoint.R1Multivariate r1mPosterior = jpm.posterior(); - - if (null == r1mPrior || !(r1mPrior instanceof org.drip.measure.gaussian.R1MultivariateNormal) || null - == r1mJoint || !(r1mJoint instanceof org.drip.measure.gaussian.R1MultivariateNormal) || null == - r1mPosterior || !(r1mPosterior instanceof org.drip.measure.gaussian.R1MultivariateNormal)) - return null; - - org.drip.measure.gaussian.R1MultivariateNormal r1mnPrior = - (org.drip.measure.gaussian.R1MultivariateNormal) r1mPrior; - org.drip.measure.gaussian.R1MultivariateNormal r1mnJoint = - (org.drip.measure.gaussian.R1MultivariateNormal) r1mJoint; - org.drip.measure.gaussian.R1MultivariateNormal r1mnPosterior = - (org.drip.measure.gaussian.R1MultivariateNormal) r1mPosterior; - - org.drip.json.simple.JSONObject jsonResponse = new org.drip.json.simple.JSONObject(); - - jsonResponse.put ("Tau", dblTau); - - jsonResponse.put ("Delta", dblRiskAversion); - - jsonResponse.put ("RiskFreeRate", dblRiskFreeRate); - - jsonResponse.put ("ScopingSet", org.drip.json.parser.Converter.Array (astrAssetID)); - - jsonResponse.put ("ScopingExpectedExcessReturns", org.drip.json.parser.Converter.Array - (r1mnPrior.mean())); - - jsonResponse.put ("ScopingExcessReturnsCovariance", org.drip.json.parser.Converter.Array - (r1mnPrior.covariance().covarianceMatrix())); - - jsonResponse.put ("ProjectionExpectedExcessReturns", org.drip.json.parser.Converter.Array - (adblProjectionExpectedExcessReturns)); - - jsonResponse.put ("ViewScopingProjectionLoading", org.drip.json.parser.Converter.Array - (aadblAssetSpaceViewProjection)); - - jsonResponse.put ("JointExcessReturnsCovariance", org.drip.json.parser.Converter.Array - (r1mnJoint.covariance().covarianceMatrix())); - - jsonResponse.put ("PosteriorExcessReturnsCovariance", org.drip.json.parser.Converter.Array - (r1mnPosterior.covariance().covarianceMatrix())); - - jsonResponse.put ("PriorExpectedExcessReturn", org.drip.json.parser.Converter.Array - (r1mPrior.mean())); - - jsonResponse.put ("PosteriorExpectedExcessReturn", org.drip.json.parser.Converter.Array - (r1mPosterior.mean())); - - return jsonResponse; - } -} diff --git a/org/drip/json/assetallocation/PortfolioConstructionProcessor.java b/org/drip/json/assetallocation/PortfolioConstructionProcessor.java deleted file mode 100644 index d683437..0000000 --- a/org/drip/json/assetallocation/PortfolioConstructionProcessor.java +++ /dev/null @@ -1,289 +0,0 @@ - -package org.drip.json.assetallocation; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PortfolioConstructionProcessor Sets Up and Executes a JSON Based In/Out Processing Service for Constrained - * and Unconstrained Portfolio Construction. - * - * @author Lakshmi Krishnamurthy - */ - -public class PortfolioConstructionProcessor { - - /** - * JSON Based in/out Budget Constrained Mean Variance Allocation Thunker - * - * @param jsonParameter Budget Constrained Mean Variance Allocation Parameters - * - * @return JSON Budget Constrained Mean Variance Allocation Response - */ - - @SuppressWarnings ("unchecked") public static final org.drip.json.simple.JSONObject - BudgetConstrainedAllocator ( - final org.drip.json.simple.JSONObject jsonParameter) - { - java.lang.String[] astrAssetID = org.drip.json.parser.Converter.StringArrayEntry (jsonParameter, - "AssetSet"); - - org.drip.portfolioconstruction.allocator.BoundedPortfolioConstructionParameters pdp = null; - int iNumAsset = null == astrAssetID ? 0 : astrAssetID.length; - double[] adblAssetLowerBound = new double[iNumAsset]; - double[] adblAssetUpperBound = new double[iNumAsset]; - - if (0 == iNumAsset) return null; - - double[] adblAssetExpectedReturns = org.drip.json.parser.Converter.DoubleArrayEntry (jsonParameter, - "AssetExpectedReturns"); - - double[][] aadblAssetReturnsCovariance = org.drip.json.parser.Converter.DualDoubleArrayEntry - (jsonParameter, "AssetReturnsCovariance"); - - for (int i = 0; i < iNumAsset; ++i) { - try { - adblAssetLowerBound[i] = org.drip.json.parser.Converter.DoubleEntry (jsonParameter, - astrAssetID[i] + "::LowerBound"); - - adblAssetUpperBound[i] = org.drip.json.parser.Converter.DoubleEntry (jsonParameter, - astrAssetID[i] + "::UpperBound"); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties ausp = - org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties.FromMultivariateMetrics - (org.drip.measure.statistics.MultivariateMoments.Standard (astrAssetID, - adblAssetExpectedReturns, aadblAssetReturnsCovariance)); - - if (null == ausp) return null; - - org.drip.portfolioconstruction.allocator.ConstrainedMeanVarianceOptimizer cmva = new - org.drip.portfolioconstruction.allocator.ConstrainedMeanVarianceOptimizer (null, - org.drip.function.rdtor1descent.LineStepEvolutionControl.NocedalWrightStrongWolfe (false)); - - try { - pdp = new org.drip.portfolioconstruction.allocator.BoundedPortfolioConstructionParameters - (astrAssetID, new org.drip.portfolioconstruction.allocator.CustomRiskUtilitySettings (1., - 0.), new org.drip.portfolioconstruction.allocator.PortfolioEqualityConstraintSettings - (org.drip.portfolioconstruction.allocator.PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT, - java.lang.Double.NaN)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int i = 0; i < astrAssetID.length; ++i) { - if (!pdp.addBound (astrAssetID[i], adblAssetLowerBound[i], adblAssetUpperBound[i])) return null; - } - - org.drip.portfolioconstruction.allocator.OptimizationOutput oo = cmva.allocate (pdp, ausp); - - if (null == oo) return null; - - org.drip.portfolioconstruction.asset.Portfolio pf = oo.optimalPortfolio(); - - org.drip.portfolioconstruction.asset.AssetComponent[] aAC = pf.assets(); - - if (null == aAC || aAC.length != iNumAsset) return null; - - org.drip.json.simple.JSONObject jsonResponse = new org.drip.json.simple.JSONObject(); - - jsonResponse.put ("AssetSet", org.drip.json.parser.Converter.Array (astrAssetID)); - - jsonResponse.put ("AssetExpectedReturns", org.drip.json.parser.Converter.Array - (adblAssetExpectedReturns)); - - jsonResponse.put ("AssetReturnsCovariance", org.drip.json.parser.Converter.Array - (aadblAssetReturnsCovariance)); - - for (int i = 0; i < adblAssetExpectedReturns.length; ++i) { - jsonResponse.put (astrAssetID[i] + "::LowerBound", adblAssetLowerBound[i]); - - jsonResponse.put (astrAssetID[i] + "::UpperBound", adblAssetUpperBound[i]); - } - - for (int i = 0; i < astrAssetID.length; ++i) - jsonResponse.put (aAC[i].id() + "::WEIGHT", aAC[i].amount()); - - jsonResponse.put ("PortfolioNotional", pf.notional()); - - try { - jsonResponse.put ("PortfolioExpectedReturn", pf.expectedReturn (ausp)); - - jsonResponse.put ("PortfolioStandardDeviation", java.lang.Math.sqrt (pf.variance (ausp))); - - return jsonResponse; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * JSON Based in/out Returns Constrained Mean Variance Allocation Thunker - * - * @param jsonParameter Returns Constrained Mean Variance Allocation Parameters - * - * @return JSON Returns Constrained Mean Variance Allocation Response - */ - - @SuppressWarnings ("unchecked") public static final org.drip.json.simple.JSONObject - ReturnsConstrainedAllocator ( - final org.drip.json.simple.JSONObject jsonParameter) - { - java.lang.String[] astrAssetID = org.drip.json.parser.Converter.StringArrayEntry (jsonParameter, - "AssetSet"); - - org.drip.portfolioconstruction.allocator.BoundedPortfolioConstructionParameters pdp = null; - int iNumAsset = null == astrAssetID ? 0 : astrAssetID.length; - double dblPortfolioDesignReturn = java.lang.Double.NaN; - double[] adblAssetLowerBound = new double[iNumAsset]; - double[] adblAssetUpperBound = new double[iNumAsset]; - - if (0 == iNumAsset) return null; - - double[] adblAssetReturnsMean = org.drip.json.parser.Converter.DoubleArrayEntry (jsonParameter, - "AssetReturnsMean"); - - double[][] aadblAssetReturnsCovariance = org.drip.json.parser.Converter.DualDoubleArrayEntry - (jsonParameter, "AssetReturnsCovariance"); - - try { - dblPortfolioDesignReturn = org.drip.json.parser.Converter.DoubleEntry (jsonParameter, - "PortfolioDesignReturn"); - - for (int i = 0; i < iNumAsset; ++i) { - adblAssetLowerBound[i] = org.drip.json.parser.Converter.DoubleEntry (jsonParameter, - astrAssetID[i] + "::LowerBound"); - - adblAssetUpperBound[i] = org.drip.json.parser.Converter.DoubleEntry (jsonParameter, - astrAssetID[i] + "::UpperBound"); - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties ausp = - org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties.FromMultivariateMetrics - (org.drip.measure.statistics.MultivariateMoments.Standard (astrAssetID, - adblAssetReturnsMean, aadblAssetReturnsCovariance)); - - if (null == ausp) return null; - - org.drip.portfolioconstruction.allocator.ConstrainedMeanVarianceOptimizer cmva = new - org.drip.portfolioconstruction.allocator.ConstrainedMeanVarianceOptimizer (null, null); - - try { - pdp = new org.drip.portfolioconstruction.allocator.BoundedPortfolioConstructionParameters - (astrAssetID, new org.drip.portfolioconstruction.allocator.CustomRiskUtilitySettings (1., - 0.), new org.drip.portfolioconstruction.allocator.PortfolioEqualityConstraintSettings - (org.drip.portfolioconstruction.allocator.PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT - | org.drip.portfolioconstruction.allocator.PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int i = 0; i < astrAssetID.length; ++i) { - if (!pdp.addBound (astrAssetID[i], adblAssetLowerBound[i], adblAssetUpperBound[i])) return null; - } - - org.drip.portfolioconstruction.allocator.OptimizationOutput oo = cmva.allocate (pdp, ausp); - - if (null == oo) return null; - - org.drip.portfolioconstruction.asset.Portfolio pf = oo.optimalPortfolio(); - - org.drip.portfolioconstruction.asset.AssetComponent[] aAC = pf.assets(); - - if (null == aAC || aAC.length != iNumAsset) return null; - - org.drip.json.simple.JSONObject jsonResponse = new org.drip.json.simple.JSONObject(); - - jsonResponse.put ("AssetSet", org.drip.json.parser.Converter.Array (astrAssetID)); - - jsonResponse.put ("AssetReturnsMean", org.drip.json.parser.Converter.Array (adblAssetReturnsMean)); - - jsonResponse.put ("AssetReturnsCovariance", org.drip.json.parser.Converter.Array - (aadblAssetReturnsCovariance)); - - for (int i = 0; i < adblAssetReturnsMean.length; ++i) { - jsonResponse.put (astrAssetID[i] + "::LowerBound", adblAssetLowerBound[i]); - - jsonResponse.put (astrAssetID[i] + "::UpperBound", adblAssetUpperBound[i]); - } - - for (int i = 0; i < astrAssetID.length; ++i) - jsonResponse.put (aAC[i].id() + "::WEIGHT", aAC[i].amount()); - - jsonResponse.put ("PortfolioNotional", pf.notional()); - - try { - jsonResponse.put ("PortfolioDesignReturn", dblPortfolioDesignReturn); - - jsonResponse.put ("PortfolioExpectedReturn", pf.expectedReturn (ausp)); - - jsonResponse.put ("PortfolioStandardDeviation", java.lang.Math.sqrt (pf.variance (ausp))); - - return jsonResponse; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/json/parser/ContainerFactory.java b/org/drip/json/parser/ContainerFactory.java deleted file mode 100644 index d4e86da..0000000 --- a/org/drip/json/parser/ContainerFactory.java +++ /dev/null @@ -1,72 +0,0 @@ - -package org.drip.json.parser; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ContainerFactory is an Adaptation of the ContainerFactory Interface from the RFC4627 compliant JSON Simple - * (https://code.google.com/p/json-simple/). - * - * @author Fang Yidong - * @author Lakshmi Krishnamurthy - */ - -public interface ContainerFactory { - - /** - * @return A Map instance to store JSON object, or null if you want to use org.json.simple.JSONObject. - */ - - @SuppressWarnings ("rawtypes") java.util.Map createObjectContainer(); - - /** - * @return A List instance to store JSON array, or null if you want to use org.json.simple.JSONArray. - */ - - @SuppressWarnings ("rawtypes") java.util.List creatArrayContainer(); -} diff --git a/org/drip/json/parser/ContentHandler.java b/org/drip/json/parser/ContentHandler.java deleted file mode 100644 index 6dd833d..0000000 --- a/org/drip/json/parser/ContentHandler.java +++ /dev/null @@ -1,178 +0,0 @@ - -package org.drip.json.parser; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ContentHandler is an Adaptation of the ContentHandler Interface from the RFC4627 compliant JSON Simple - * (https://code.google.com/p/json-simple/). - * - * @author Fang Yidong - * @author Lakshmi Krishnamurthy - */ - -public interface ContentHandler { - /** - * Receive notification of the beginning of JSON processing. - * The parser will invoke this method only once. - * - * @throws ParseException JSONParser will stop and throw the same exception to the caller when receiving this exception. - * - * @throws java.io.IOException JSONParser will stop and throw the same exception to the caller when receiving this exception. - */ - void startJSON() throws ParseException, java.io.IOException; - - /** - * Receive notification of the end of JSON processing. - * - * @throws ParseException JSONParser will stop and throw the same exception to the caller when receiving this exception. - * - * @throws java.io.IOException JSONParser will stop and throw the same exception to the caller when receiving this exception. - */ - void endJSON() throws ParseException, java.io.IOException; - - /** - * Receive notification of the beginning of a JSON object. - * - * @return false if the handler wants to stop parsing after return. - * - * @throws ParseException JSONParser will stop and throw the same exception to the caller when receiving this exception. - * - * @throws java.io.IOException JSONParser will stop and throw the same exception to the caller when receiving this exception. - * @see #endJSON - */ - boolean startObject() throws ParseException, java.io.IOException; - - /** - * Receive notification of the end of a JSON object. - * - * @return false if the handler wants to stop parsing after return. - * - * @throws ParseException JSONParser will stop and throw the same exception to the caller when receiving this exception. - * - * @throws java.io.IOException JSONParser will stop and throw the same exception to the caller when receiving this exception. - * - * @see #startObject - */ - boolean endObject() throws ParseException, java.io.IOException; - - /** - * Receive notification of the beginning of a JSON object entry. - * - * @param key - Key of a JSON object entry. - * - * @return false if the handler wants to stop parsing after return. - * - * @throws ParseException JSONParser will stop and throw the same exception to the caller when receiving this exception. - * - * @throws java.io.IOException JSONParser will stop and throw the same exception to the caller when receiving this exception. - * - * @see #endObjectEntry - */ - boolean startObjectEntry(String key) throws ParseException, java.io.IOException; - - /** - * Receive notification of the end of the value of previous object entry. - * - * @return false if the handler wants to stop parsing after return. - * - * @throws ParseException JSONParser will stop and throw the same exception to the caller when receiving this exception. - * - * @throws java.io.IOException JSONParser will stop and throw the same exception to the caller when receiving this exception. - * - * @see #startObjectEntry - */ - boolean endObjectEntry() throws ParseException, java.io.IOException; - - /** - * Receive notification of the beginning of a JSON array. - * - * @return false if the handler wants to stop parsing after return. - * - * @throws ParseException JSONParser will stop and throw the same exception to the caller when receiving this exception. - * - * @throws java.io.IOException JSONParser will stop and throw the same exception to the caller when receiving this exception. - * - * @see #endArray - */ - boolean startArray() throws ParseException, java.io.IOException; - - /** - * Receive notification of the end of a JSON array. - * - * @return false if the handler wants to stop parsing after return. - * - * @throws ParseException JSONParser will stop and throw the same exception to the caller when receiving this exception. - * - * @throws java.io.IOException JSONParser will stop and throw the same exception to the caller when receiving this exception. - * - * @see #startArray - */ - boolean endArray() throws ParseException, java.io.IOException; - - /** - * Receive notification of the JSON primitive values: - * java.lang.String, - * java.lang.Number, - * java.lang.Boolean - * null - * - * @param value - Instance of the following: - * java.lang.String, - * java.lang.Number, - * java.lang.Boolean - * null - * - * @return false if the handler wants to stop parsing after return. - * - * @throws ParseException JSONParser will stop and throw the same exception to the caller when receiving this exception. - * - * @throws java.io.IOException JSONParser will stop and throw the same exception to the caller when receiving this exception. - */ - boolean primitive(Object value) throws ParseException, java.io.IOException; -} diff --git a/org/drip/json/parser/Converter.java b/org/drip/json/parser/Converter.java deleted file mode 100644 index bb6f37b..0000000 --- a/org/drip/json/parser/Converter.java +++ /dev/null @@ -1,542 +0,0 @@ - -package org.drip.json.parser; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * TypeConverter transforms the JSON Object to certain Primitive/Simple Data Type Arrays, i.e., double, - * integer, String, or JulianDate Arrays. - * - * @author Lakshmi Krishnamurthy - */ - -public class Converter { - - /** - * Convert the JSON Entry to a String - * - * @param json The Object - * @param strEntryKey The Entry Key - * - * @return The String Form of the JSON Entry - */ - - public static final java.lang.String StringEntry ( - final org.drip.json.simple.JSONObject json, - final java.lang.String strEntryKey) - { - if (null == json || !json.containsKey (strEntryKey)) return null; - - java.lang.Object objEntry = json.get (strEntryKey); - - return null == objEntry || !(objEntry instanceof java.lang.String) ? null : (java.lang.String) - objEntry; - } - - /** - * Convert the JSON Entry to a String Array - * - * @param json The Object - * @param strEntryKey The Entry Key - * - * @return The String Array From of the JSON Entry - */ - - public static final java.lang.String[] StringArrayEntry ( - final org.drip.json.simple.JSONObject json, - final java.lang.String strEntryKey) - { - if (null == json || !json.containsKey (strEntryKey)) return null; - - java.lang.Object objEntry = json.get (strEntryKey); - - if (null == objEntry || !(objEntry instanceof org.drip.json.simple.JSONArray)) return null; - - org.drip.json.simple.JSONArray jsonArray = (org.drip.json.simple.JSONArray) objEntry; - - int iNumElement = jsonArray.size(); - - if (0 == iNumElement) return null; - - java.lang.String[] astr = new java.lang.String[iNumElement]; - - for (int i = 0; i < iNumElement; ++i) { - java.lang.Object objElement = jsonArray.get (i); - - astr[i] = null == objElement || !(objElement instanceof java.lang.String) ? null : - (java.lang.String) objElement; - } - - return astr; - } - - /** - * Convert the JSON Entry to a Date - * - * @param json The Object - * @param strEntryKey The Entry Key - * - * @return The Date Form of the JSON Entry - */ - - public static final org.drip.analytics.date.JulianDate DateEntry ( - final org.drip.json.simple.JSONObject json, - final java.lang.String strEntryKey) - { - return org.drip.analytics.date.DateUtil.CreateFromDDMMMYYYY (StringEntry (json, strEntryKey)); - } - - /** - * Convert the JSON Entry to a Date Array - * - * @param json The Object - * @param strEntryKey The Entry Key - * - * @return The Date Array From of the JSON Entry - */ - - public static final org.drip.analytics.date.JulianDate[] DateArrayEntry ( - final org.drip.json.simple.JSONObject json, - final java.lang.String strEntryKey) - { - if (null == json || !json.containsKey (strEntryKey)) return null; - - java.lang.Object objEntry = json.get (strEntryKey); - - if (null == objEntry || !(objEntry instanceof org.drip.json.simple.JSONArray)) return null; - - org.drip.json.simple.JSONArray jsonArray = (org.drip.json.simple.JSONArray) objEntry; - - int iNumElement = jsonArray.size(); - - if (0 == iNumElement) return null; - - org.drip.analytics.date.JulianDate[] adt = new org.drip.analytics.date.JulianDate[iNumElement]; - - for (int i = 0; i < iNumElement; ++i) { - java.lang.Object objElement = jsonArray.get (i); - - if (null == objElement || !(objElement instanceof java.lang.String) || null == (adt[i] = - org.drip.analytics.date.DateUtil.CreateFromMDY ((java.lang.String) objElement, "/"))) - return null; - } - - return adt; - } - - /** - * Convert the JSON Entry to a Double - * - * @param json The Object - * @param strEntryKey The Entry Key - * - * @return The Double Form of the JSON Entry - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final double DoubleEntry ( - final org.drip.json.simple.JSONObject json, - final java.lang.String strEntryKey) - throws java.lang.Exception - { - if (null == json || !json.containsKey (strEntryKey)) - throw new java.lang.Exception ("Converter::DoubleEntry => Invalid Inputs"); - - java.lang.Object objEntry = json.get (strEntryKey); - - if (null == objEntry) throw new java.lang.Exception ("Converter::DoubleEntry => Invalid Inputs"); - - return java.lang.Double.parseDouble (objEntry.toString().trim()); - } - - /** - * Convert the JSON Entry to a Double Array - * - * @param json The Object - * @param strEntryKey The Entry Key - * - * @return The Double Array From of the JSON Entry - */ - - public static final double[] DoubleArrayEntry ( - final org.drip.json.simple.JSONObject json, - final java.lang.String strEntryKey) - { - if (null == json || !json.containsKey (strEntryKey)) return null; - - java.lang.Object objEntry = json.get (strEntryKey); - - if (null == objEntry || !(objEntry instanceof org.drip.json.simple.JSONArray)) return null; - - org.drip.json.simple.JSONArray jsonArray = (org.drip.json.simple.JSONArray) objEntry; - - int iNumElement = jsonArray.size(); - - if (0 == iNumElement) return null; - - double[] adbl = new double[iNumElement]; - - for (int i = 0; i < iNumElement; ++i) { - java.lang.Object objElement = jsonArray.get (i); - - if (null == objElement) return null; - - try { - adbl[i] = java.lang.Double.parseDouble (objElement.toString().trim()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return adbl; - } - - /** - * Convert the JSON Entry to a Dual Double Array - * - * @param json The Object - * @param strEntryKey The Entry Key - * - * @return The Dual Double Array From of the JSON Entry - */ - - public static final double[][] DualDoubleArrayEntry ( - final org.drip.json.simple.JSONObject json, - final java.lang.String strEntryKey) - { - if (null == json || !json.containsKey (strEntryKey)) return null; - - java.lang.Object objEntry = json.get (strEntryKey); - - if (null == objEntry || !(objEntry instanceof org.drip.json.simple.JSONArray)) return null; - - org.drip.json.simple.JSONArray jsonArray = (org.drip.json.simple.JSONArray) objEntry; - - int iNumOuterElement = jsonArray.size(); - - if (0 == iNumOuterElement) return null; - - double[][] aadbl = new double[iNumOuterElement][]; - - for (int i = 0; i < iNumOuterElement; ++i) { - java.lang.Object objOuterElement = jsonArray.get (i); - - if (null == objOuterElement || !(objOuterElement instanceof org.drip.json.simple.JSONArray)) - return null; - - org.drip.json.simple.JSONArray jsonOuterArray = (org.drip.json.simple.JSONArray) objOuterElement; - - int iNumInnerElement = jsonOuterArray.size(); - - if (0 == iNumInnerElement) return null; - - aadbl[i] = new double[iNumInnerElement]; - - try { - for (int j = 0; j < iNumInnerElement; ++j) { - java.lang.Object objInnerElement = jsonOuterArray.get (j); - - if (null == objInnerElement) return null; - - aadbl[i][j] = java.lang.Double.parseDouble (objInnerElement.toString().trim()); - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return aadbl; - } - - /** - * Convert the JSON Entry to an Integer - * - * @param json The Object - * @param strEntryKey The Entry Key - * - * @return The Integer Form of the JSON Entry - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final int IntegerEntry ( - final org.drip.json.simple.JSONObject json, - final java.lang.String strEntryKey) - throws java.lang.Exception - { - if (null == json || !json.containsKey (strEntryKey)) - throw new java.lang.Exception ("Converter::IntegerEntry => Invalid Inputs"); - - java.lang.Object objEntry = json.get (strEntryKey); - - if (null == objEntry) throw new java.lang.Exception ("Converter::IntegerEntry => Invalid Inputs"); - - return java.lang.Integer.parseInt (objEntry.toString().trim()); - } - - /** - * Convert the JSON Entry to an Integer Array - * - * @param objJSON The JSON Object - * - * @return The Integer Array From of the JSON Entry - */ - - public static final int[] IntegerArrayEntry ( - final java.lang.Object objJSON) - { - if (null == objJSON || !(objJSON instanceof org.drip.json.simple.JSONArray)) return null; - - org.drip.json.simple.JSONArray jsonArray = (org.drip.json.simple.JSONArray) objJSON; - - int iNumElement = jsonArray.size(); - - if (0 == iNumElement) return null; - - int[] ai = new int[iNumElement]; - - for (int i = 0; i < iNumElement; ++i) { - java.lang.Object json = jsonArray.get (i); - - if (null == json) return null; - - ai[i] = java.lang.Integer.parseInt (json.toString().trim()); - } - - return ai; - } - - /** - * Convert the JSON Entry to an Boolean - * - * @param json The Object - * @param strEntryKey The Entry Key - * - * @return The Boolean Form of the JSON Entry - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final boolean BooleanEntry ( - final org.drip.json.simple.JSONObject json, - final java.lang.String strEntryKey) - throws java.lang.Exception - { - if (null == json || !json.containsKey (strEntryKey)) - throw new java.lang.Exception ("Converter::BooleanEntry => Invalid Inputs"); - - java.lang.Object objEntry = json.get (strEntryKey); - - if (null == objEntry) throw new java.lang.Exception ("Converter::BooleanEntry => Invalid Inputs"); - - return java.lang.Boolean.parseBoolean (objEntry.toString().trim()); - } - - /** - * Convert the JSON Entry to a Boolean Array - * - * @param objJSON The Object - * - * @return The Boolean Array From of the JSON Entry - */ - - public static final boolean[] BooleanArrayEntry ( - final java.lang.Object objJSON) - { - if (null == objJSON || !(objJSON instanceof org.drip.json.simple.JSONArray)) return null; - - org.drip.json.simple.JSONArray jsonArray = (org.drip.json.simple.JSONArray) objJSON; - - int iNumElement = jsonArray.size(); - - if (0 == iNumElement) return null; - - boolean[] ab = new boolean[iNumElement]; - - for (int i = 0; i < iNumElement; ++i) { - java.lang.Object json = jsonArray.get (i); - - if (null == json) return null; - - ab[i] = java.lang.Boolean.parseBoolean (json.toString().trim()); - } - - return ab; - } - - /** - * Construct a JSON Array out of the String Array - * - * @param astr The String Array - * - * @return The JSON Array Instance - */ - - @SuppressWarnings ("unchecked") public static final org.drip.json.simple.JSONArray Array ( - final java.lang.String[] astr) - { - if (null == astr || 0 == astr.length) return null; - - org.drip.json.simple.JSONArray jsonArray = new org.drip.json.simple.JSONArray(); - - for (java.lang.String str : astr) - jsonArray.add (str); - - return jsonArray; - } - - /** - * Construct a JSON Array out of the Integer Array - * - * @param ai The Integer Array - * - * @return The JSON Array Instance - */ - - @SuppressWarnings ("unchecked") public static final org.drip.json.simple.JSONArray Array ( - final int[] ai) - { - if (null == ai || 0 == ai.length) return null; - - org.drip.json.simple.JSONArray jsonArray = new org.drip.json.simple.JSONArray(); - - for (int i : ai) - jsonArray.add (i); - - return jsonArray; - } - - /** - * Construct a JSON Array out of the Double Array - * - * @param adbl The Double Array - * - * @return The JSON Array Instance - */ - - @SuppressWarnings ("unchecked") public static final org.drip.json.simple.JSONArray Array ( - final double[] adbl) - { - if (null == adbl || 0 == adbl.length) return null; - - org.drip.json.simple.JSONArray jsonArray = new org.drip.json.simple.JSONArray(); - - for (double dbl : adbl) - jsonArray.add (dbl); - - return jsonArray; - } - - /** - * Construct a JSON 2D Array out of the 2D Double Array - * - * @param aadbl The 2D Double Array - * - * @return The JSON 2D Array Instance - */ - - @SuppressWarnings ("unchecked") public static final org.drip.json.simple.JSONArray Array ( - final double[][] aadbl) - { - if (null == aadbl || 0 == aadbl.length) return null; - - org.drip.json.simple.JSONArray jsonArray = new org.drip.json.simple.JSONArray(); - - for (double[] adbl : aadbl) - jsonArray.add (Array (adbl)); - - return jsonArray; - } - - /** - * Construct a JSON Array out of the Boolean Array - * - * @param ab The Boolean Array - * - * @return The JSON Array Instance - */ - - @SuppressWarnings ("unchecked") public static final org.drip.json.simple.JSONArray Array ( - final boolean[] ab) - { - if (null == ab || 0 == ab.length) return null; - - org.drip.json.simple.JSONArray jsonArray = new org.drip.json.simple.JSONArray(); - - for (boolean b : ab) - jsonArray.add (b); - - return jsonArray; - } - - /** - * Construct a JSON Array out of the JulianDate Array - * - * @param adt The JulianDate Array - * - * @return The JSON Array Instance - */ - - @SuppressWarnings ("unchecked") public static final org.drip.json.simple.JSONArray Array ( - final org.drip.analytics.date.JulianDate[] adt) - { - if (null == adt || 0 == adt.length) return null; - - org.drip.json.simple.JSONArray jsonArray = new org.drip.json.simple.JSONArray(); - - for (org.drip.analytics.date.JulianDate dt : adt) - jsonArray.add (dt); - - return jsonArray; - } -} diff --git a/org/drip/json/parser/JSONParser.java b/org/drip/json/parser/JSONParser.java deleted file mode 100644 index b694758..0000000 --- a/org/drip/json/parser/JSONParser.java +++ /dev/null @@ -1,581 +0,0 @@ - -package org.drip.json.parser; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * JSONParser is an Adaptation of the JSONParser Class from the RFC4627 compliant JSON Simple - * (https://code.google.com/p/json-simple/). - * - * @author Fang Yidong - * @author Lakshmi Krishnamurthy - */ - -public class JSONParser { - public static final int S_INIT=0; - public static final int S_IN_FINISHED_VALUE=1;//string,number,boolean,null,object,array - public static final int S_IN_OBJECT=2; - public static final int S_IN_ARRAY=3; - public static final int S_PASSED_PAIR_KEY=4; - public static final int S_IN_PAIR_VALUE=5; - public static final int S_END=6; - public static final int S_IN_ERROR=-1; - - @SuppressWarnings ("rawtypes") private java.util.LinkedList handlerStatusStack; - - private Yylex lexer = new Yylex((java.io.Reader)null); - private Yytoken token = null; - private int status = S_INIT; - - @SuppressWarnings ("rawtypes") private int peekStatus(java.util.LinkedList statusStack){ - if(statusStack.size()==0) - return -1; - Integer status=(Integer)statusStack.getFirst(); - return status.intValue(); - } - -/** - * Reset the parser to the initial state without resetting the underlying reader. - * - */ -public void reset(){ - token = null; - status = S_INIT; - handlerStatusStack = null; -} - -/** - * Reset the parser to the initial state with a new character reader. - * - * @param in - The new character reader. - */ - public void reset(java.io.Reader in){ - lexer.yyreset(in); - reset(); - } - - /** - * @return The position of the beginning of the current token. - */ - public int getPosition(){ - return lexer.getPosition(); - } - - public Object parse(String s) throws ParseException{ - return parse(s, (ContainerFactory)null); - } - - /** - * Parse the JSON String - * - * @param s The String - * @param containerFactory The Container Factory - * - * @return The JSON Object - * - * @throws ParseException Thrown if the Inputs are Invalid - */ - - public Object parse(String s, ContainerFactory containerFactory) throws ParseException{ - java.io.StringReader in=new java.io.StringReader(s); - try{ - return parse(in, containerFactory); - } - catch(java.io.IOException ie){ - /* - * Actually it will never happen. - */ - throw new ParseException(-1, ParseException.ERROR_UNEXPECTED_EXCEPTION, ie); - } - } - - public Object parse(java.io.Reader in) throws java.io.IOException, ParseException{ - return parse(in, (ContainerFactory)null); - } - - /** - * Parse JSON text into java object from the input source. - * - * @param in The Input Reader - * @param containerFactory - Use this factory to createyour own JSON object and JSON array containers. - * @return Instance of the following: - * org.json.simple.JSONObject, - * org.json.simple.JSONArray, - * java.lang.String, - * java.lang.Number, - * java.lang.Boolean, - * null - * - * @throws java.io.IOException Thrown if the Inputs are Invalid - * - * @throws ParseException Thrown if the Inputs are Invalid - */ - @SuppressWarnings ({"rawtypes", "unchecked"}) public Object parse(java.io.Reader in, ContainerFactory containerFactory) throws java.io.IOException, ParseException{ - reset(in); - java.util.LinkedList statusStack = new java.util.LinkedList(); - java.util.LinkedList valueStack = new java.util.LinkedList(); - - try{ - do{ - nextToken(); - switch(status){ - case S_INIT: - switch(token.type){ - case Yytoken.TYPE_VALUE: - status=S_IN_FINISHED_VALUE; - statusStack.addFirst(new Integer(status)); - valueStack.addFirst(token.value); - break; - case Yytoken.TYPE_LEFT_BRACE: - status=S_IN_OBJECT; - statusStack.addFirst(new Integer(status)); - valueStack.addFirst(createObjectContainer(containerFactory)); - break; - case Yytoken.TYPE_LEFT_SQUARE: - status=S_IN_ARRAY; - statusStack.addFirst(new Integer(status)); - valueStack.addFirst(createArrayContainer(containerFactory)); - break; - default: - status=S_IN_ERROR; - }//inner switch - break; - - case S_IN_FINISHED_VALUE: - if(token.type==Yytoken.TYPE_EOF) - return valueStack.removeFirst(); - else - throw new ParseException(getPosition(), ParseException.ERROR_UNEXPECTED_TOKEN, token); - - case S_IN_OBJECT: - switch(token.type){ - case Yytoken.TYPE_COMMA: - break; - case Yytoken.TYPE_VALUE: - if(token.value instanceof String){ - String key=(String)token.value; - valueStack.addFirst(key); - status=S_PASSED_PAIR_KEY; - statusStack.addFirst(new Integer(status)); - } - else{ - status=S_IN_ERROR; - } - break; - case Yytoken.TYPE_RIGHT_BRACE: - if(valueStack.size()>1){ - statusStack.removeFirst(); - valueStack.removeFirst(); - status=peekStatus(statusStack); - } - else{ - status=S_IN_FINISHED_VALUE; - } - break; - default: - status=S_IN_ERROR; - break; - }//inner switch - break; - - case S_PASSED_PAIR_KEY: - switch(token.type){ - case Yytoken.TYPE_COLON: - break; - case Yytoken.TYPE_VALUE: - statusStack.removeFirst(); - String key=(String)valueStack.removeFirst(); - java.util.Map parent=(java.util.Map)valueStack.getFirst(); - parent.put(key,token.value); - status=peekStatus(statusStack); - break; - case Yytoken.TYPE_LEFT_SQUARE: - statusStack.removeFirst(); - key=(String)valueStack.removeFirst(); - parent=(java.util.Map)valueStack.getFirst(); - java.util.List newArray=createArrayContainer(containerFactory); - parent.put(key,newArray); - status=S_IN_ARRAY; - statusStack.addFirst(new Integer(status)); - valueStack.addFirst(newArray); - break; - case Yytoken.TYPE_LEFT_BRACE: - statusStack.removeFirst(); - key=(String)valueStack.removeFirst(); - parent=(java.util.Map)valueStack.getFirst(); - java.util.Map newObject=createObjectContainer(containerFactory); - parent.put(key,newObject); - status=S_IN_OBJECT; - statusStack.addFirst(new Integer(status)); - valueStack.addFirst(newObject); - break; - default: - status=S_IN_ERROR; - } - break; - - case S_IN_ARRAY: - switch(token.type){ - case Yytoken.TYPE_COMMA: - break; - case Yytoken.TYPE_VALUE: - java.util.List val=(java.util.List)valueStack.getFirst(); - val.add(token.value); - break; - case Yytoken.TYPE_RIGHT_SQUARE: - if(valueStack.size()>1){ - statusStack.removeFirst(); - valueStack.removeFirst(); - status=peekStatus(statusStack); - } - else{ - status=S_IN_FINISHED_VALUE; - } - break; - case Yytoken.TYPE_LEFT_BRACE: - val=(java.util.List)valueStack.getFirst(); - java.util.Map newObject=createObjectContainer(containerFactory); - val.add(newObject); - status=S_IN_OBJECT; - statusStack.addFirst(new Integer(status)); - valueStack.addFirst(newObject); - break; - case Yytoken.TYPE_LEFT_SQUARE: - val=(java.util.List)valueStack.getFirst(); - java.util.List newArray=createArrayContainer(containerFactory); - val.add(newArray); - status=S_IN_ARRAY; - statusStack.addFirst(new Integer(status)); - valueStack.addFirst(newArray); - break; - default: - status=S_IN_ERROR; - }//inner switch - break; - case S_IN_ERROR: - throw new ParseException(getPosition(), ParseException.ERROR_UNEXPECTED_TOKEN, token); - }//switch - if(status==S_IN_ERROR){ - throw new ParseException(getPosition(), ParseException.ERROR_UNEXPECTED_TOKEN, token); - } - }while(token.type!=Yytoken.TYPE_EOF); - } - catch(java.io.IOException ie){ - throw ie; - } - - throw new ParseException(getPosition(), ParseException.ERROR_UNEXPECTED_TOKEN, token); - } - - private void nextToken() throws ParseException, java.io.IOException{ - token = lexer.yylex(); - if(token == null) - token = new Yytoken(Yytoken.TYPE_EOF, null); - } - - @SuppressWarnings ("rawtypes") private java.util.Map createObjectContainer(ContainerFactory containerFactory){ - if(containerFactory == null) - return new org.drip.json.simple.JSONObject(); - java.util.Map m = containerFactory.createObjectContainer(); - - if(m == null) - return new org.drip.json.simple.JSONObject(); - return m; - } - - @SuppressWarnings ("rawtypes") private java.util.List createArrayContainer(ContainerFactory containerFactory){ - if(containerFactory == null) - return new org.drip.json.simple.JSONArray(); - java.util.List l = containerFactory.creatArrayContainer(); - - if(l == null) - return new org.drip.json.simple.JSONArray(); - return l; - } - - public void parse(String s, ContentHandler contentHandler) throws ParseException{ - parse(s, contentHandler, false); - } - - public void parse(String s, ContentHandler contentHandler, boolean isResume) throws ParseException{ - java.io.StringReader in=new java.io.StringReader(s); - try{ - parse(in, contentHandler, isResume); - } - catch(java.io.IOException ie){ - /* - * Actually it will never happen. - */ - throw new ParseException(-1, ParseException.ERROR_UNEXPECTED_EXCEPTION, ie); - } - } - - public void parse(java.io.Reader in, ContentHandler contentHandler) throws java.io.IOException, ParseException{ - parse(in, contentHandler, false); - } - - /** - * Stream processing of JSON text. - * - * @see ContentHandler - * - * @param in The Input Reader - * @param contentHandler The Content Handler Instance - * @param isResume - Indicates if it continues previous parsing operation. - * If set to true, resume parsing the old stream, and parameter 'in' will be ignored. - * If this method is called for the first time in this instance, isResume will be ignored. - * - * @throws java.io.IOException Thrown if the Inputs are Invalid - * - * @throws ParseException Thrown if the Inputs are Invalid - */ - @SuppressWarnings ({"rawtypes", "unchecked"}) public void parse(java.io.Reader in, ContentHandler contentHandler, boolean isResume) throws java.io.IOException, ParseException{ - if(!isResume){ - reset(in); - handlerStatusStack = new java.util.LinkedList(); - } - else{ - if(handlerStatusStack == null){ - isResume = false; - reset(in); - handlerStatusStack = new java.util.LinkedList(); - } - } - - java.util.LinkedList statusStack = handlerStatusStack; - - try{ - do{ - switch(status){ - case S_INIT: - contentHandler.startJSON(); - nextToken(); - switch(token.type){ - case Yytoken.TYPE_VALUE: - status=S_IN_FINISHED_VALUE; - statusStack.addFirst(new Integer(status)); - if(!contentHandler.primitive(token.value)) - return; - break; - case Yytoken.TYPE_LEFT_BRACE: - status=S_IN_OBJECT; - statusStack.addFirst(new Integer(status)); - if(!contentHandler.startObject()) - return; - break; - case Yytoken.TYPE_LEFT_SQUARE: - status=S_IN_ARRAY; - statusStack.addFirst(new Integer(status)); - if(!contentHandler.startArray()) - return; - break; - default: - status=S_IN_ERROR; - }//inner switch - break; - - case S_IN_FINISHED_VALUE: - nextToken(); - if(token.type==Yytoken.TYPE_EOF){ - contentHandler.endJSON(); - status = S_END; - return; - } - else{ - status = S_IN_ERROR; - throw new ParseException(getPosition(), ParseException.ERROR_UNEXPECTED_TOKEN, token); - } - - case S_IN_OBJECT: - nextToken(); - switch(token.type){ - case Yytoken.TYPE_COMMA: - break; - case Yytoken.TYPE_VALUE: - if(token.value instanceof String){ - String key=(String)token.value; - status=S_PASSED_PAIR_KEY; - statusStack.addFirst(new Integer(status)); - if(!contentHandler.startObjectEntry(key)) - return; - } - else{ - status=S_IN_ERROR; - } - break; - case Yytoken.TYPE_RIGHT_BRACE: - if(statusStack.size()>1){ - statusStack.removeFirst(); - status=peekStatus(statusStack); - } - else{ - status=S_IN_FINISHED_VALUE; - } - if(!contentHandler.endObject()) - return; - break; - default: - status=S_IN_ERROR; - break; - }//inner switch - break; - - case S_PASSED_PAIR_KEY: - nextToken(); - switch(token.type){ - case Yytoken.TYPE_COLON: - break; - case Yytoken.TYPE_VALUE: - statusStack.removeFirst(); - status=peekStatus(statusStack); - if(!contentHandler.primitive(token.value)) - return; - if(!contentHandler.endObjectEntry()) - return; - break; - case Yytoken.TYPE_LEFT_SQUARE: - statusStack.removeFirst(); - statusStack.addFirst(new Integer(S_IN_PAIR_VALUE)); - status=S_IN_ARRAY; - statusStack.addFirst(new Integer(status)); - if(!contentHandler.startArray()) - return; - break; - case Yytoken.TYPE_LEFT_BRACE: - statusStack.removeFirst(); - statusStack.addFirst(new Integer(S_IN_PAIR_VALUE)); - status=S_IN_OBJECT; - statusStack.addFirst(new Integer(status)); - if(!contentHandler.startObject()) - return; - break; - default: - status=S_IN_ERROR; - } - break; - - case S_IN_PAIR_VALUE: - /* - * S_IN_PAIR_VALUE is just a marker to indicate the end of an object entry, it doesn't proccess any token, - * therefore delay consuming token until next round. - */ - statusStack.removeFirst(); - status = peekStatus(statusStack); - if(!contentHandler.endObjectEntry()) - return; - break; - - case S_IN_ARRAY: - nextToken(); - switch(token.type){ - case Yytoken.TYPE_COMMA: - break; - case Yytoken.TYPE_VALUE: - if(!contentHandler.primitive(token.value)) - return; - break; - case Yytoken.TYPE_RIGHT_SQUARE: - if(statusStack.size()>1){ - statusStack.removeFirst(); - status=peekStatus(statusStack); - } - else{ - status=S_IN_FINISHED_VALUE; - } - if(!contentHandler.endArray()) - return; - break; - case Yytoken.TYPE_LEFT_BRACE: - status=S_IN_OBJECT; - statusStack.addFirst(new Integer(status)); - if(!contentHandler.startObject()) - return; - break; - case Yytoken.TYPE_LEFT_SQUARE: - status=S_IN_ARRAY; - statusStack.addFirst(new Integer(status)); - if(!contentHandler.startArray()) - return; - break; - default: - status=S_IN_ERROR; - }//inner switch - break; - - case S_END: - return; - - case S_IN_ERROR: - throw new ParseException(getPosition(), ParseException.ERROR_UNEXPECTED_TOKEN, token); - }//switch - if(status==S_IN_ERROR){ - throw new ParseException(getPosition(), ParseException.ERROR_UNEXPECTED_TOKEN, token); - } - }while(token.type!=Yytoken.TYPE_EOF); - } - catch(java.io.IOException ie){ - status = S_IN_ERROR; - throw ie; - } - catch(ParseException pe){ - status = S_IN_ERROR; - throw pe; - } - catch(RuntimeException re){ - status = S_IN_ERROR; - throw re; - } - catch(Error e){ - status = S_IN_ERROR; - throw e; - } - - status = S_IN_ERROR; - throw new ParseException(getPosition(), ParseException.ERROR_UNEXPECTED_TOKEN, token); - } -} diff --git a/org/drip/json/parser/ParseException.java b/org/drip/json/parser/ParseException.java deleted file mode 100644 index 9fc73ba..0000000 --- a/org/drip/json/parser/ParseException.java +++ /dev/null @@ -1,140 +0,0 @@ - -package org.drip.json.parser; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ParseException is an Adaptation of the ParseException Class from the RFC4627 compliant JSON Simple - * (https://code.google.com/p/json-simple/). - * - * @author Fang Yidong - * @author Lakshmi Krishnamurthy - */ - -public class ParseException extends java.lang.Exception { - private static final long serialVersionUID = -7880698968187728548L; - - public static final int ERROR_UNEXPECTED_CHAR = 0; - public static final int ERROR_UNEXPECTED_TOKEN = 1; - public static final int ERROR_UNEXPECTED_EXCEPTION = 2; - - private int errorType; - private Object unexpectedObject; - private int position; - - public ParseException(int errorType){ - this(-1, errorType, null); - } - - public ParseException(int errorType, Object unexpectedObject){ - this(-1, errorType, unexpectedObject); - } - - public ParseException(int position, int errorType, Object unexpectedObject){ - this.position = position; - this.errorType = errorType; - this.unexpectedObject = unexpectedObject; - } - - public int getErrorType() { - return errorType; - } - - public void setErrorType(int errorType) { - this.errorType = errorType; - } - - /** - * @see org.drip.json.parser.JSONParser#getPosition() - * - * @return The character position (starting with 0) of the input where the error occurs. - */ - public int getPosition() { - return position; - } - - public void setPosition(int position) { - this.position = position; - } - - /** - * @see org.drip.json.parser.Yytoken - * - * @return One of the following base on the value of errorType: - * ERROR_UNEXPECTED_CHAR java.lang.Character - * ERROR_UNEXPECTED_TOKEN org.json.simple.parser.Yytoken - * ERROR_UNEXPECTED_EXCEPTION java.lang.Exception - */ - public Object getUnexpectedObject() { - return unexpectedObject; - } - - public void setUnexpectedObject(Object unexpectedObject) { - this.unexpectedObject = unexpectedObject; - } - - public String toString(){ - StringBuffer sb = new StringBuffer(); - - switch(errorType){ - case ERROR_UNEXPECTED_CHAR: - sb.append("Unexpected character (").append(unexpectedObject).append(") at position ").append(position).append("."); - break; - case ERROR_UNEXPECTED_TOKEN: - sb.append("Unexpected token ").append(unexpectedObject).append(" at position ").append(position).append("."); - break; - case ERROR_UNEXPECTED_EXCEPTION: - sb.append("Unexpected exception at position ").append(position).append(": ").append(unexpectedObject); - break; - default: - sb.append("Unkown error at position ").append(position).append("."); - break; - } - return sb.toString(); - } -} diff --git a/org/drip/json/parser/Yylex.java b/org/drip/json/parser/Yylex.java deleted file mode 100644 index 41fe761..0000000 --- a/org/drip/json/parser/Yylex.java +++ /dev/null @@ -1,754 +0,0 @@ - -package org.drip.json.parser; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * Yylex is an Adaptation of the Yylex Class from the RFC4627 compliant JSON Simple - * (https://code.google.com/p/json-simple/). - * - * @author Fang Yidong - * @author Lakshmi Krishnamurthy - */ - -public class Yylex { - - /** This character denotes the end of file */ - public static final int YYEOF = -1; - - /** initial size of the lookahead buffer */ - private static final int ZZ_BUFFERSIZE = 16384; - - /** lexical states */ - public static final int YYINITIAL = 0; - public static final int STRING_BEGIN = 2; - - /** - * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l - * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l - * at the beginning of a line - * l is of the form l = 2*k, k a non negative integer - */ - private static final int ZZ_LEXSTATE[] = { - 0, 0, 1, 1 - }; - - /** - * Translates characters to character classes - */ - private static final String ZZ_CMAP_PACKED = - "\11\0\1\7\1\7\2\0\1\7\22\0\1\7\1\0\1\11\10\0"+ - "\1\6\1\31\1\2\1\4\1\12\12\3\1\32\6\0\4\1\1\5"+ - "\1\1\24\0\1\27\1\10\1\30\3\0\1\22\1\13\2\1\1\21"+ - "\1\14\5\0\1\23\1\0\1\15\3\0\1\16\1\24\1\17\1\20"+ - "\5\0\1\25\1\0\1\26\uff82\0"; - - /** - * Translates characters to character classes - */ - private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED); - - /** - * Translates DFA states to action switch labels. - */ - private static final int [] ZZ_ACTION = zzUnpackAction(); - - private static final String ZZ_ACTION_PACKED_0 = - "\2\0\2\1\1\2\1\3\1\4\3\1\1\5\1\6"+ - "\1\7\1\10\1\11\1\12\1\13\1\14\1\15\5\0"+ - "\1\14\1\16\1\17\1\20\1\21\1\22\1\23\1\24"+ - "\1\0\1\25\1\0\1\25\4\0\1\26\1\27\2\0"+ - "\1\30"; - - private static int [] zzUnpackAction() { - int [] result = new int[45]; - int offset = 0; - offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); - return result; - } - - private static int zzUnpackAction(String packed, int offset, int [] result) { - int i = 0; /* index in packed string */ - int j = offset; /* index in unpacked array */ - int l = packed.length(); - while (i < l) { - int count = packed.charAt(i++); - int value = packed.charAt(i++); - do result[j++] = value; while (--count > 0); - } - return j; - } - - - /** - * Translates a state to a row index in the transition table - */ - private static final int [] ZZ_ROWMAP = zzUnpackRowMap(); - - private static final String ZZ_ROWMAP_PACKED_0 = - "\0\0\0\33\0\66\0\121\0\154\0\207\0\66\0\242"+ - "\0\275\0\330\0\66\0\66\0\66\0\66\0\66\0\66"+ - "\0\363\0\u010e\0\66\0\u0129\0\u0144\0\u015f\0\u017a\0\u0195"+ - "\0\66\0\66\0\66\0\66\0\66\0\66\0\66\0\66"+ - "\0\u01b0\0\u01cb\0\u01e6\0\u01e6\0\u0201\0\u021c\0\u0237\0\u0252"+ - "\0\66\0\66\0\u026d\0\u0288\0\66"; - - private static int [] zzUnpackRowMap() { - int [] result = new int[45]; - int offset = 0; - offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); - return result; - } - - private static int zzUnpackRowMap(String packed, int offset, int [] result) { - int i = 0; /* index in packed string */ - int j = offset; /* index in unpacked array */ - int l = packed.length(); - while (i < l) { - int high = packed.charAt(i++) << 16; - result[j++] = high | packed.charAt(i++); - } - return j; - } - - /** - * The transition table of the DFA - */ - private static final int ZZ_TRANS [] = { - 2, 2, 3, 4, 2, 2, 2, 5, 2, 6, - 2, 2, 7, 8, 2, 9, 2, 2, 2, 2, - 2, 10, 11, 12, 13, 14, 15, 16, 16, 16, - 16, 16, 16, 16, 16, 17, 18, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 4, 19, 20, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 20, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 5, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 16, 16, 16, 16, 16, 16, 16, - 16, -1, -1, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - -1, -1, -1, -1, -1, -1, -1, -1, 24, 25, - 26, 27, 28, 29, 30, 31, 32, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 33, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 34, 35, -1, -1, - 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 36, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 37, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 38, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 39, -1, 39, -1, 39, -1, -1, - -1, -1, -1, 39, 39, -1, -1, -1, -1, 39, - 39, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 33, -1, 20, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 20, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 35, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 38, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 41, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 42, -1, 42, -1, 42, - -1, -1, -1, -1, -1, 42, 42, -1, -1, -1, - -1, 42, 42, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 43, -1, 43, -1, 43, -1, -1, -1, - -1, -1, 43, 43, -1, -1, -1, -1, 43, 43, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, - -1, 44, -1, 44, -1, -1, -1, -1, -1, 44, - 44, -1, -1, -1, -1, 44, 44, -1, -1, -1, - -1, -1, -1, -1, -1, - }; - - /* error codes */ - private static final int ZZ_UNKNOWN_ERROR = 0; - private static final int ZZ_NO_MATCH = 1; - private static final int ZZ_PUSHBACK_2BIG = 2; - - /* error messages for the codes above */ - private static final String ZZ_ERROR_MSG[] = { - "Unkown internal scanner error", - "Error: could not match input", - "Error: pushback value was too large" - }; - - /** - * ZZ_ATTRIBUTE[aState] contains the attributes of state aState - */ - private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute(); - - private static final String ZZ_ATTRIBUTE_PACKED_0 = - "\2\0\1\11\3\1\1\11\3\1\6\11\2\1\1\11"+ - "\5\0\10\11\1\0\1\1\1\0\1\1\4\0\2\11"+ - "\2\0\1\11"; - - private static int [] zzUnpackAttribute() { - int [] result = new int[45]; - int offset = 0; - offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); - return result; - } - - private static int zzUnpackAttribute(String packed, int offset, int [] result) { - int i = 0; /* index in packed string */ - int j = offset; /* index in unpacked array */ - int l = packed.length(); - while (i < l) { - int count = packed.charAt(i++); - int value = packed.charAt(i++); - do result[j++] = value; while (--count > 0); - } - return j; - } - - /** the input device */ - private java.io.Reader zzReader; - - /** the current state of the DFA */ - private int zzState; - - /** the current lexical state */ - private int zzLexicalState = YYINITIAL; - - /** this buffer contains the current text to be matched and is - the source of the yytext() string */ - private char zzBuffer[] = new char[ZZ_BUFFERSIZE]; - - /** the textposition at the last accepting state */ - private int zzMarkedPos; - - /** the current text position in the buffer */ - private int zzCurrentPos; - - /** startRead marks the beginning of the yytext() string in the buffer */ - private int zzStartRead; - - /** endRead marks the last character in the buffer, that has been read - from input */ - private int zzEndRead; - - /** number of newlines encountered up to the start of the matched text */ - int yyline; - - /** the number of characters up to the start of the matched text */ - private int yychar; - - /** - * the number of characters from the last newline up to the start of the - * matched text - */ - int yycolumn; - - /** - * zzAtBOL == true <=> the scanner is currently at the beginning of a line - */ - boolean zzAtBOL = true; - - /** zzAtEOF == true <=> the scanner is at the EOF */ - private boolean zzAtEOF; - - /* user code: */ - private StringBuffer sb=new StringBuffer(); - - int getPosition(){ - return yychar; - } - - - - /** - * Creates a new scanner - * There is also a java.io.InputStream version of this constructor. - * - * @param in the java.io.Reader to read input from. - */ - public Yylex(java.io.Reader in) { - this.zzReader = in; - } - - /** - * Creates a new scanner. - * There is also java.io.Reader version of this constructor. - * - * @param in the java.io.Inputstream to read input from. - */ - Yylex(java.io.InputStream in) { - this(new java.io.InputStreamReader(in)); - } - - /** - * Unpacks the compressed character translation table. - * - * @param packed the packed character translation table - * @return the unpacked character translation table - */ - private static char [] zzUnpackCMap(String packed) { - char [] map = new char[0x10000]; - int i = 0; /* index in packed string */ - int j = 0; /* index in unpacked array */ - while (i < 90) { - int count = packed.charAt(i++); - char value = packed.charAt(i++); - do map[j++] = value; while (--count > 0); - } - return map; - } - - - /** - * Refills the input buffer. - * - * @return false, iff there was new input. - * - * @exception java.io.IOException if any I/O-Error occurs - */ - private boolean zzRefill() throws java.io.IOException { - - /* first: make room (if you can) */ - if (zzStartRead > 0) { - System.arraycopy(zzBuffer, zzStartRead, - zzBuffer, 0, - zzEndRead-zzStartRead); - - /* translate stored positions */ - zzEndRead-= zzStartRead; - zzCurrentPos-= zzStartRead; - zzMarkedPos-= zzStartRead; - zzStartRead = 0; - } - - /* is the buffer big enough? */ - if (zzCurrentPos >= zzBuffer.length) { - /* if not: blow it up */ - char newBuffer[] = new char[zzCurrentPos*2]; - System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length); - zzBuffer = newBuffer; - } - - /* finally: fill the buffer with new input */ - int numRead = zzReader.read(zzBuffer, zzEndRead, - zzBuffer.length-zzEndRead); - - if (numRead > 0) { - zzEndRead+= numRead; - return false; - } - // unlikely but not impossible: read 0 characters, but not at end of stream - if (numRead == 0) { - int c = zzReader.read(); - if (c == -1) { - return true; - } else { - zzBuffer[zzEndRead++] = (char) c; - return false; - } - } - - // numRead < 0 - return true; - } - - - /** - * Closes the input stream. - * - * @throws java.io.IOException Thrown if the Inputs are Invalid - */ - public final void yyclose() throws java.io.IOException { - zzAtEOF = true; /* indicate end of file */ - zzEndRead = zzStartRead; /* invalidate buffer */ - - if (zzReader != null) - zzReader.close(); - } - - - /** - * Resets the scanner to read from a new input stream. - * Does not close the old reader. - * - * All internal variables are reset, the old input stream - * cannot be reused (internal buffer is discarded and lost). - * Lexical state is set to ZZ_INITIAL. - * - * @param reader the new input stream - */ - public final void yyreset(java.io.Reader reader) { - zzReader = reader; - zzAtBOL = true; - zzAtEOF = false; - zzEndRead = zzStartRead = 0; - zzCurrentPos = zzMarkedPos = 0; - yyline = yychar = yycolumn = 0; - zzLexicalState = YYINITIAL; - } - - - /** - * Returns the current lexical state. - * - * @return The Current Lexical State. - */ - - public final int yystate() { - return zzLexicalState; - } - - - /** - * Enters a new lexical state - * - * @param newState the new lexical state - */ - public final void yybegin(int newState) { - zzLexicalState = newState; - } - - - /** - * Returns the text matched by the current regular expression. - * - * @return The Text. - */ - - public final String yytext() { - return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead ); - } - - - /** - * Returns the character at position pos from the - * matched text. - * - * It is equivalent to yytext().charAt(pos), but faster - * - * @param pos the position of the character to fetch. - * A value from 0 to yylength()-1. - * - * @return the character at position pos - */ - public final char yycharat(int pos) { - return zzBuffer[zzStartRead+pos]; - } - - - /** - * Returns the length of the matched text region. - * - * @return The Length. - */ - public final int yylength() { - return zzMarkedPos-zzStartRead; - } - - - /** - * Reports an error that occured while scanning. - * - * In a wellformed scanner (no or only correct usage of - * yypushback(int) and a match-all fallback rule) this method - * will only be called with things that "Can't Possibly Happen". - * If this method is called, something is seriously wrong - * (e.g. a JFlex bug producing a faulty scanner etc.). - * - * Usual syntax/scanner level error handling should be done - * in error fallback rules. - * - * @param errorCode the code of the errormessage to display - */ - private void zzScanError(int errorCode) { - String message; - try { - message = ZZ_ERROR_MSG[errorCode]; - } - catch (ArrayIndexOutOfBoundsException e) { - message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR]; - } - - throw new Error(message); - } - - - /** - * Pushes the specified amount of characters back into the input stream. - * - * They will be read again by then next call of the scanning method - * - * @param number the number of characters to be read again. - * This number must not be greater than yylength()! - */ - public void yypushback(int number) { - if ( number > yylength() ) - zzScanError(ZZ_PUSHBACK_2BIG); - - zzMarkedPos -= number; - } - - - /** - * Resumes scanning until the next regular expression is matched, - * the end of input is encountered or an I/O-Error occurs. - * - * @return the next token - * - * @throws java.io.IOException if any I/O-Error occurs - * - * @throws ParseException Thrown if Inputs are Invalid - */ - - public Yytoken yylex() throws java.io.IOException, ParseException { - int zzInput; - int zzAction; - - // cached fields: - int zzCurrentPosL; - int zzMarkedPosL; - int zzEndReadL = zzEndRead; - char [] zzBufferL = zzBuffer; - char [] zzCMapL = ZZ_CMAP; - - int [] zzTransL = ZZ_TRANS; - int [] zzRowMapL = ZZ_ROWMAP; - int [] zzAttrL = ZZ_ATTRIBUTE; - - while (true) { - zzMarkedPosL = zzMarkedPos; - - yychar+= zzMarkedPosL-zzStartRead; - - zzAction = -1; - - zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL; - - zzState = ZZ_LEXSTATE[zzLexicalState]; - - - zzForAction: { - while (true) { - - if (zzCurrentPosL < zzEndReadL) - zzInput = zzBufferL[zzCurrentPosL++]; - else if (zzAtEOF) { - zzInput = YYEOF; - break zzForAction; - } - else { - // store back cached positions - zzCurrentPos = zzCurrentPosL; - zzMarkedPos = zzMarkedPosL; - boolean eof = zzRefill(); - // get translated positions and possibly new buffer - zzCurrentPosL = zzCurrentPos; - zzMarkedPosL = zzMarkedPos; - zzBufferL = zzBuffer; - zzEndReadL = zzEndRead; - if (eof) { - zzInput = YYEOF; - break zzForAction; - } - else { - zzInput = zzBufferL[zzCurrentPosL++]; - } - } - int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ]; - if (zzNext == -1) break zzForAction; - zzState = zzNext; - - int zzAttributes = zzAttrL[zzState]; - if ( (zzAttributes & 1) == 1 ) { - zzAction = zzState; - zzMarkedPosL = zzCurrentPosL; - if ( (zzAttributes & 8) == 8 ) break zzForAction; - } - - } - } - - // store back cached position - zzMarkedPos = zzMarkedPosL; - - switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { - case 11: - { sb.append(yytext()); - } - case 25: break; - case 4: - { sb.delete(0, sb.length());yybegin(STRING_BEGIN); - } - case 26: break; - case 16: - { sb.append('\b'); - } - case 27: break; - case 6: - { return new Yytoken(Yytoken.TYPE_RIGHT_BRACE,null); - } - case 28: break; - case 23: - { Boolean val=Boolean.valueOf(yytext()); return new Yytoken(Yytoken.TYPE_VALUE, val); - } - case 29: break; - case 22: - { return new Yytoken(Yytoken.TYPE_VALUE, null); - } - case 30: break; - case 13: - { yybegin(YYINITIAL);return new Yytoken(Yytoken.TYPE_VALUE, sb.toString()); - } - case 31: break; - case 12: - { sb.append('\\'); - } - case 32: break; - case 21: - { Double val=Double.valueOf(yytext()); return new Yytoken(Yytoken.TYPE_VALUE, val); - } - case 33: break; - case 1: - { throw new ParseException(yychar, ParseException.ERROR_UNEXPECTED_CHAR, new Character(yycharat(0))); - } - case 34: break; - case 8: - { return new Yytoken(Yytoken.TYPE_RIGHT_SQUARE,null); - } - case 35: break; - case 19: - { sb.append('\r'); - } - case 36: break; - case 15: - { sb.append('/'); - } - case 37: break; - case 10: - { return new Yytoken(Yytoken.TYPE_COLON,null); - } - case 38: break; - case 14: - { sb.append('"'); - } - case 39: break; - case 5: - { return new Yytoken(Yytoken.TYPE_LEFT_BRACE,null); - } - case 40: break; - case 17: - { sb.append('\f'); - } - case 41: break; - case 24: - { try{ - int ch=Integer.parseInt(yytext().substring(2),16); - sb.append((char)ch); - } - catch(Exception e){ - throw new ParseException(yychar, ParseException.ERROR_UNEXPECTED_EXCEPTION, e); - } - } - case 42: break; - case 20: - { sb.append('\t'); - } - case 43: break; - case 7: - { return new Yytoken(Yytoken.TYPE_LEFT_SQUARE,null); - } - case 44: break; - case 2: - { Long val=Long.valueOf(yytext()); return new Yytoken(Yytoken.TYPE_VALUE, val); - } - case 45: break; - case 18: - { sb.append('\n'); - } - case 46: break; - case 9: - { return new Yytoken(Yytoken.TYPE_COMMA,null); - } - case 47: break; - case 3: - { - } - case 48: break; - default: - if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { - zzAtEOF = true; - return null; - } - else { - zzScanError(ZZ_NO_MATCH); - } - } - } - } - } diff --git a/org/drip/json/parser/Yytoken.java b/org/drip/json/parser/Yytoken.java deleted file mode 100644 index 86f9da3..0000000 --- a/org/drip/json/parser/Yytoken.java +++ /dev/null @@ -1,107 +0,0 @@ - -package org.drip.json.parser; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * Yytoken is an Adaptation of the Yytoken Class from the RFC4627 compliant JSON Simple - * (https://code.google.com/p/json-simple/). - * - * @author Fang Yidong - * @author Lakshmi Krishnamurthy - */ - -public class Yytoken { - public static final int TYPE_VALUE=0;//JSON primitive value: string,number,boolean,null - public static final int TYPE_LEFT_BRACE=1; - public static final int TYPE_RIGHT_BRACE=2; - public static final int TYPE_LEFT_SQUARE=3; - public static final int TYPE_RIGHT_SQUARE=4; - public static final int TYPE_COMMA=5; - public static final int TYPE_COLON=6; - public static final int TYPE_EOF=-1;//end of file - - public int type=0; - public Object value=null; - - public Yytoken(int type,Object value){ - this.type=type; - this.value=value; - } - - public String toString(){ - StringBuffer sb = new StringBuffer(); - switch(type){ - case TYPE_VALUE: - sb.append("VALUE(").append(value).append(")"); - break; - case TYPE_LEFT_BRACE: - sb.append("LEFT BRACE({)"); - break; - case TYPE_RIGHT_BRACE: - sb.append("RIGHT BRACE(})"); - break; - case TYPE_LEFT_SQUARE: - sb.append("LEFT SQUARE([)"); - break; - case TYPE_RIGHT_SQUARE: - sb.append("RIGHT SQUARE(])"); - break; - case TYPE_COMMA: - sb.append("COMMA(,)"); - break; - case TYPE_COLON: - sb.append("COLON(:)"); - break; - case TYPE_EOF: - sb.append("END OF FILE"); - break; - } - return sb.toString(); - } -} diff --git a/org/drip/json/simple/ItemList.java b/org/drip/json/simple/ItemList.java deleted file mode 100644 index 9416074..0000000 --- a/org/drip/json/simple/ItemList.java +++ /dev/null @@ -1,193 +0,0 @@ - -package org.drip.json.simple; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ItemList is an Adaptation of the ItemList Interface from the RFC4627 compliant JSON Simple - * (https://code.google.com/p/json-simple/). - * - * |a:b:c| = |a|,|b|,|c| - * |:| = ||,|| - * |a:| = |a|,|| - * - * @author Fang Yidong - * @author Lakshmi Krishnamurthy - */ - -public class ItemList { - private String sp=","; - @SuppressWarnings ("rawtypes") java.util.List items=new java.util.ArrayList(); - - - public ItemList(){} - - - public ItemList(String s){ - this.split(s,sp,items); - } - - public ItemList(String s,String sp){ - this.sp=s; - this.split(s,sp,items); - } - - public ItemList(String s,String sp,boolean isMultiToken){ - split(s,sp,items,isMultiToken); - } - - @SuppressWarnings ("rawtypes") public java.util.List getItems(){ - return this.items; - } - - public String[] getArray(){ - return (String[])this.items.toArray(); - } - - @SuppressWarnings ({"rawtypes", "unchecked"}) public void split(String s,String sp,java.util.List append,boolean isMultiToken){ - if(s==null || sp==null) - return; - if(isMultiToken){ - java.util.StringTokenizer tokens=new java.util.StringTokenizer(s,sp); - while(tokens.hasMoreTokens()){ - append.add(tokens.nextToken().trim()); - } - } - else{ - this.split(s,sp,append); - } - } - - @SuppressWarnings ({"rawtypes", "unchecked"}) public void split(String s,String sp,java.util.List append){ - if(s==null || sp==null) - return; - int pos=0; - int prevPos=0; - do{ - prevPos=pos; - pos=s.indexOf(sp,pos); - if(pos==-1) - break; - append.add(s.substring(prevPos,pos).trim()); - pos+=sp.length(); - }while(pos!=-1); - append.add(s.substring(prevPos).trim()); - } - - public void setSP(String sp){ - this.sp=sp; - } - - @SuppressWarnings ("unchecked") public void add(int i,String item){ - if(item==null) - return; - items.add(i,item.trim()); - } - - @SuppressWarnings ("unchecked") public void add(String item){ - if(item==null) - return; - items.add(item.trim()); - } - - @SuppressWarnings ("unchecked") public void addAll(ItemList list){ - items.addAll(list.items); - } - - public void addAll(String s){ - this.split(s,sp,items); - } - - public void addAll(String s,String sp){ - this.split(s,sp,items); - } - - public void addAll(String s,String sp,boolean isMultiToken){ - this.split(s,sp,items,isMultiToken); - } - - /** - * @param i 0-based - * @return i - */ - public String get(int i){ - return (String)items.get(i); - } - - public int size(){ - return items.size(); - } - - public String toString(){ - return toString(sp); - } - - public String toString(String sp){ - StringBuffer sb=new StringBuffer(); - - for(int i=0;i - * If this object is a Map or a List, and it's also a JSONStreamAware or a JSONAware, JSONStreamAware or JSONAware will be considered firstly. - *

- * DO NOT call this method from writeJSONString(Writer) of a class that implements both JSONStreamAware and (Map or List) with - * "this" as the first parameter, use JSONObject.writeJSONString(Map, Writer) or JSONArray.writeJSONString(List, Writer) instead. - * - * @see org.drip.json.simple.JSONObject#writeJSONString(Map, Writer) - * @see org.drip.json.simple.JSONArray#writeJSONString(List, Writer) - * - * @param value The JSON Object - * @param out The JSON Writer - * - * @throws java.io.IOException Thrown if the Inputs are Invalid - */ - @SuppressWarnings ("rawtypes") public static void writeJSONString(Object value, java.io.Writer out) throws java.io.IOException { - if(value == null){ - out.write("null"); - return; - } - - if(value instanceof String){ - out.write('\"'); - out.write(escape((String)value)); - out.write('\"'); - return; - } - - if(value instanceof Double){ - if(((Double)value).isInfinite() || ((Double)value).isNaN()) - out.write("null"); - else - out.write(value.toString()); - return; - } - - if(value instanceof Float){ - if(((Float)value).isInfinite() || ((Float)value).isNaN()) - out.write("null"); - else - out.write(value.toString()); - return; - } - - if(value instanceof Number){ - out.write(value.toString()); - return; - } - - if(value instanceof Boolean){ - out.write(value.toString()); - return; - } - - if((value instanceof JSONStreamAware)){ - ((JSONStreamAware)value).writeJSONString(out); - return; - } - - if((value instanceof JSONAware)){ - out.write(((JSONAware)value).toJSONString()); - return; - } - - if(value instanceof java.util.Map){ - org.drip.json.simple.JSONObject.writeJSONString((java.util.Map)value, out); - return; - } - - if(value instanceof java.util.List){ - JSONArray.writeJSONString((java.util.List)value, out); - return; - } - - out.write(value.toString()); - } - - /** - * Convert an object to JSON text. - *

- * If this object is a Map or a List, and it's also a JSONAware, JSONAware will be considered firstly. - *

- * DO NOT call this method from toJSONString() of a class that implements both JSONAware and Map or List with - * "this" as the parameter, use JSONObject.toJSONString(Map) or JSONArray.toJSONString(List) instead. - * - * @see org.drip.json.simple.JSONObject#toJSONString(Map) - * @see org.drip.json.simple.JSONArray#toJSONString(List) - * - * @param value The JSON Object - * - * @return JSON text, or "null" if value is null or it's an NaN or an INF number. - */ - - @SuppressWarnings ("rawtypes") public static String toJSONString(Object value){ - if(value == null) - return "null"; - - if(value instanceof String) - return "\""+escape((String)value)+"\""; - - if(value instanceof Double){ - if(((Double)value).isInfinite() || ((Double)value).isNaN()) - return "null"; - else - return value.toString(); - } - - if(value instanceof Float){ - if(((Float)value).isInfinite() || ((Float)value).isNaN()) - return "null"; - else - return value.toString(); - } - - if(value instanceof Number) - return value.toString(); - - if(value instanceof Boolean) - return value.toString(); - - if((value instanceof JSONAware)) - return ((JSONAware)value).toJSONString(); - - if(value instanceof java.util.Map) - return org.drip.json.simple.JSONObject.toJSONString((java.util.Map)value); - - if(value instanceof java.util.List) - return org.drip.json.simple.JSONArray.toJSONString((java.util.List)value); - - return value.toString(); - } - - /** - * Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters (U+0000 through U+001F). - * - * @param s Pre-escape String - * - * @return The Escape String - */ - public static String escape(String s){ - if(s==null) - return null; - StringBuffer sb = new StringBuffer(); - escape(s, sb); - return sb.toString(); -} - -/** - * @param s - Must not be null. - * @param sb The StringBuffer - */ -static void escape(String s, StringBuffer sb) { - for(int i=0;i='\u0000' && ch<='\u001F') || (ch>='\u007F' && ch<='\u009F') || (ch>='\u2000' && ch<='\u20FF')){ - String ss=Integer.toHexString(ch); - sb.append("\\u"); - for(int k=0;k<4-ss.length();k++){ - sb.append('0'); - } - sb.append(ss.toUpperCase()); - } - else{ - sb.append(ch); - } - } - }//for - } -} diff --git a/org/drip/learning/bound/CoveringNumberBoundBuilder.java b/org/drip/learning/bound/CoveringNumberBoundBuilder.java deleted file mode 100644 index bb19553..0000000 --- a/org/drip/learning/bound/CoveringNumberBoundBuilder.java +++ /dev/null @@ -1,165 +0,0 @@ - -package org.drip.learning.bound; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CoveringNumberBoundBuilder constructs the CoveringNumberProbabilityBound Instances for specific Learning - * Situations. - * - * The References are: - * - * 1) Alon, N., S. Ben-David, N. Cesa Bianchi, and D. Haussler (1997): Scale-sensitive Dimensions, Uniform - * Convergence, and Learnability, Journal of Association of Computational Machinery, 44 (4) 615-631. - * - * 2) Anthony, M., and P. L. Bartlett (1999): Artificial Neural Network Learning - Theoretical Foundations, - * Cambridge University Press, Cambridge, UK. - * - * 3) Kearns, M. J., R. E. Schapire, and L. M. Sellie (1994): Towards Efficient Agnostic Learning, Machine - * Learning, 17 (2) 115-141. - * - * 4) Lee, W. S., P. L. Bartlett, and R. C. Williamson (1998): The Importance of Convexity in Learning with - * Squared Loss, IEEE Transactions on Information Theory, 44 1974-1980. - * - * 5) Vapnik, V. N. (1998): Statistical learning Theory, Wiley, New York. - * - * @author Lakshmi Krishnamurthy - */ - -public class CoveringNumberBoundBuilder { - - /** - * Epsilon Exponent for Regression Learning - */ - - public static final double EPSILON_EXPONENT_REGRESSION_LEARNING = 1.; - - /** - * Epsilon Exponent for Agnostic Learning - */ - - public static final double EPSILON_EXPONENT_AGNOSTIC_LEARNING = 2.; - - /** - * Epsilon Exponent for Agnostic Learning with Convex Functions - */ - - public static final double EPSILON_EXPONENT_AGNOSTIC_CONVEX_LEARNING = 1.; - - /** - * Construct the Regression Learning CoveringNumberProbabilityBound Instance - * - * @param funcSampleCoefficient The Sample Coefficient Function - * @param dblExponentScaler The Exponent Scaler - * - * @return The Regression Learning CoveringNumberProbabilityBound Instance - */ - - public static final org.drip.learning.bound.CoveringNumberLossBound - RegressionLearning ( - final org.drip.function.definition.R1ToR1 funcSampleCoefficient, - final double dblExponentScaler) - { - try { - return new org.drip.learning.bound.CoveringNumberLossBound (funcSampleCoefficient, - EPSILON_EXPONENT_REGRESSION_LEARNING, dblExponentScaler); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct the Agnostic Learning CoveringNumberProbabilityBound Instance - * - * @param funcSampleCoefficient The Sample Coefficient Function - * @param dblExponentScaler The Exponent Scaler - * - * @return The Agnostic Learning CoveringNumberProbabilityBound Instance - */ - - public static final org.drip.learning.bound.CoveringNumberLossBound - AgnosticLearning ( - final org.drip.function.definition.R1ToR1 funcSampleCoefficient, - final double dblExponentScaler) - { - try { - return new org.drip.learning.bound.CoveringNumberLossBound (funcSampleCoefficient, - EPSILON_EXPONENT_AGNOSTIC_LEARNING, dblExponentScaler); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct the Agnostic Convex Learning CoveringNumberProbabilityBound Instance - * - * @param funcSampleCoefficient The Sample Coefficient Function - * @param dblExponentScaler The Exponent Scaler - * - * @return The Agnostic Convex Learning CoveringNumberProbabilityBound Instance - */ - - public static final org.drip.learning.bound.CoveringNumberLossBound - AgnosticConvexLearning ( - final org.drip.function.definition.R1ToR1 funcSampleCoefficient, - final double dblExponentScaler) - { - try { - return new org.drip.learning.bound.CoveringNumberLossBound (funcSampleCoefficient, - EPSILON_EXPONENT_AGNOSTIC_CONVEX_LEARNING, dblExponentScaler); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/learning/bound/CoveringNumberLossBound.java b/org/drip/learning/bound/CoveringNumberLossBound.java deleted file mode 100644 index cbe1424..0000000 --- a/org/drip/learning/bound/CoveringNumberLossBound.java +++ /dev/null @@ -1,170 +0,0 @@ - -package org.drip.learning.bound; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CoveringNumberLossBound provides the Upper Probability Bound that the Loss/Deviation of the Empirical from - * the Actual Mean of the given Learner Class exceeds 'epsilon', using the Covering Number Generalization - * Bounds. This is expressed as - * - * C1 (n) * N (epsilon, n) * exp (-n.epsilon^b/C2), - * - * where: - * - n is the Size of the Sample - * - 'epsilon' is the Deviation Empirical Mean from the Population Mean - * - C1 (n) is the sample coefficient function - * - C2 is an exponent scaling constant - * - 'b' an exponent ((i.e., the Epsilon Exponent) that depends on the setting (i.e., - * agnostic/classification/regression/convex etc) - * - * The References are: - * - * 1) Alon, N., S. Ben-David, N. Cesa Bianchi, and D. Haussler (1997): Scale-sensitive Dimensions, Uniform - * Convergence, and Learnability, Journal of Association of Computational Machinery, 44 (4) 615-631. - * - * 2) Anthony, M., and P. L. Bartlett (1999): Artificial Neural Network Learning - Theoretical Foundations, - * Cambridge University Press, Cambridge, UK. - * - * 3) Kearns, M. J., R. E. Schapire, and L. M. Sellie (1994): Towards Efficient Agnostic Learning, Machine - * Learning, 17 (2) 115-141. - * - * 4) Lee, W. S., P. L. Bartlett, and R. C. Williamson (1998): The Importance of Convexity in Learning with - * Squared Loss, IEEE Transactions on Information Theory, 44 1974-1980. - * - * 5) Vapnik, V. N. (1998): Statistical learning Theory, Wiley, New York. - * - * @author Lakshmi Krishnamurthy - */ - -public class CoveringNumberLossBound { - private double _dblExponentScaler = java.lang.Double.NaN; - private double _dblEpsilonExponent = java.lang.Double.NaN; - private org.drip.function.definition.R1ToR1 _funcSampleCoefficient = null; - - /** - * CoveringNumberLossBound Constructor - * - * @param funcSampleCoefficient The Sample Coefficient Function - * @param dblEpsilonExponent The Epsilon Exponent - * @param dblExponentScaler The Exponent Scaler - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CoveringNumberLossBound ( - final org.drip.function.definition.R1ToR1 funcSampleCoefficient, - final double dblEpsilonExponent, - final double dblExponentScaler) - throws java.lang.Exception - { - if (null == (_funcSampleCoefficient = funcSampleCoefficient) || - !org.drip.quant.common.NumberUtil.IsValid (_dblEpsilonExponent = dblEpsilonExponent) || - !org.drip.quant.common.NumberUtil.IsValid (_dblExponentScaler = dblExponentScaler)) - throw new java.lang.Exception ("CoveringNumberLossBound ctr: Invalid Inputs"); - } - - /** - * Retrieve the Sample Coefficient Function - * - * @return The Sample Coefficient Function - */ - - public org.drip.function.definition.R1ToR1 sampleCoefficient() - { - return _funcSampleCoefficient; - } - - /** - * Retrieve the Exponential Epsilon Exponent - * - * @return The Exponential Epsilon Exponent - */ - - public double epsilonExponent() - { - return _dblEpsilonExponent; - } - - /** - * Retrieve the Exponent Scaler - * - * @return The Exponent Scaler - */ - - public double exponentScaler() - { - return _dblExponentScaler; - } - - /** - * Compute the Upper Bound of the Probability of the Absolute Deviation between the Empirical and the - * Population Means - * - * @param iSampleSize The Sample Size - * @param dblEpsilon The Deviation between Population and Empirical Means - * - * @return The Upper Bound of the Probability of the Deviation between the Empirical and the Population - * Means - * - * @throws java.lang.Exception Thrown if the Upper Bound of the Probability cannot be computed - */ - - public double deviationProbabilityUpperBound ( - final int iSampleSize, - final double dblEpsilon) - throws java.lang.Exception - { - if (0 >= iSampleSize || !org.drip.quant.common.NumberUtil.IsValid (dblEpsilon) || 0. >= dblEpsilon) - throw new java.lang.Exception - ("CoveringNumberLossBound::deviationProbabilityUpperBound => Invalid Inputs"); - - return _funcSampleCoefficient.evaluate (iSampleSize) * java.lang.Math.exp (-1. * iSampleSize * - java.lang.Math.pow (dblEpsilon, _dblEpsilonExponent) / _dblExponentScaler); - } -} diff --git a/org/drip/learning/bound/DiagonalOperatorCoveringBound.java b/org/drip/learning/bound/DiagonalOperatorCoveringBound.java deleted file mode 100644 index 123efbc..0000000 --- a/org/drip/learning/bound/DiagonalOperatorCoveringBound.java +++ /dev/null @@ -1,143 +0,0 @@ - -package org.drip.learning.bound; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * DiagonalOperatorCoveringBound implements the Behavior of the Bound on the Covering Number of the Diagonal - * Scaling Operator. The Asymptote is set as either - * - * log [e_n(A)] ~ O {(1/log n)^alpha} - * - * - OR - - * - * e_n(A) ~ O {(1/log n)^alpha} - * - * The References are: - * - * 1) Ash, R. (1965): Information Theory, Inter-science New York. - * - * 2) Konig, H. (1986): Eigenvalue Distribution of Compact Operators, Birkhauser, Basel, Switzerland. - * - * 3) Gordon, Y., H. Konig, and C. Schutt (1987): Geometric and Probabilistic Estimates of Entropy and - * Approximation Numbers of Operators, Journal of Approximation Theory 49 219-237. - * - * 4) Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * 5) Smola, A. J., A. Elisseff, B. Scholkopf, and R. C. Williamson (2000): Entropy Numbers for Convex - * Combinations and mlps, in: Advances in Large Margin Classifiers, A. Smola, P. Bartlett, B. Scholkopf, - * and D. Schuurmans - editors, MIT Press, Cambridge, MA. - * - * 6) Williamson, R. C., A. J. Smola, and B. Scholkopf (2001): Generalization Performance of Regularization - * Networks and Support Vector Machines via Entropy Numbers of Compact Operators, IEEE Transactions on - * Information Theory 47 (6) 2516-2532. - * - * @author Lakshmi Krishnamurthy - */ - -public class DiagonalOperatorCoveringBound { - - /** - * Asymptote on the Base Diagonal Operator Entropy Number - */ - - public static final int BASE_DIAGONAL_ENTROPY_ASYMPTOTE_EXPONENT = 1; - - /** - * Asymptote on the Log of the Diagonal Operator Entropy Number - */ - - public static final int LOG_DIAGONAL_ENTROPY_ASYMPTOTE_EXPONENT = 2; - - private double _dblOperatorEntropyAsymptoteExponent = java.lang.Double.NaN; - private int _iOperatorEntropyAsymptoteBase = BASE_DIAGONAL_ENTROPY_ASYMPTOTE_EXPONENT; - - /** - * DiagonalOperatorCoveringBound Constructor - * - * @param iOperatorEntropyAsymptoteBase Indicate the Asymptote is on the Base Value or Log Value - * @param dblOperatorEntropyAsymptoteExponent The Entropy Number Asymptote Exponent - * - * @throws java.lang.Exception Throws if the Inputs are Invalid - */ - - public DiagonalOperatorCoveringBound ( - final int iOperatorEntropyAsymptoteBase, - final double dblOperatorEntropyAsymptoteExponent) - throws java.lang.Exception - { - if ((BASE_DIAGONAL_ENTROPY_ASYMPTOTE_EXPONENT != (_iOperatorEntropyAsymptoteBase = - iOperatorEntropyAsymptoteBase) && LOG_DIAGONAL_ENTROPY_ASYMPTOTE_EXPONENT != - _iOperatorEntropyAsymptoteBase) || !org.drip.quant.common.NumberUtil.IsValid - (_dblOperatorEntropyAsymptoteExponent = dblOperatorEntropyAsymptoteExponent)) - throw new java.lang.Exception ("DiagonalOperatorCoveringBound ctr => Invalid Inputs"); - } - - /** - * Retrieve the Entropy Number Asymptote Type - * - * @return The Entropy Number Asymptote Type - */ - - public int entropyNumberAsymptoteType() - { - return _iOperatorEntropyAsymptoteBase; - } - - /** - * Retrieve the Entropy Number Asymptote Exponent - * - * @return The Entropy Number Asymptote Exponent - */ - - public double entropyNumberAsymptoteExponent() - { - return _dblOperatorEntropyAsymptoteExponent; - } -} diff --git a/org/drip/learning/bound/EmpiricalLearnerLoss.java b/org/drip/learning/bound/EmpiricalLearnerLoss.java deleted file mode 100644 index e0094ff..0000000 --- a/org/drip/learning/bound/EmpiricalLearnerLoss.java +++ /dev/null @@ -1,136 +0,0 @@ - -package org.drip.learning.bound; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * EmpiricalLearnerLoss Function computes the Empirical Loss of a Learning Operation resulting from the Use - * of a Learning Function in Conjunction with the corresponding Empirical Realization. - * - * The References are: - * - * 1) Lugosi, G. (2002): Pattern Classification and Learning Theory, in: L. Györ, editor, - * Principles of Non-parametric Learning, 5-62, Springer, Wien. - * - * 2) Boucheron, S., G. Lugosi, and P. Massart (2003): Concentration Inequalities Using the Entropy Method, - * Annals of Probability, 31, 1583-1614. - * - * @author Lakshmi Krishnamurthy - */ - -public class EmpiricalLearnerLoss extends org.drip.function.definition.R1ToR1 { - private double _dblRealization = java.lang.Double.NaN; - private org.drip.function.definition.R1ToR1 _learner = null; - - /** - * EmpiricalLearnerLoss Constructor - * - * @param learner The Learning Function - * @param dblRealization The Empirical Outcome - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public EmpiricalLearnerLoss ( - final org.drip.function.definition.R1ToR1 learner, - final double dblRealization) - throws java.lang.Exception - { - super (null); - - if (null == (_learner = learner) || !org.drip.quant.common.NumberUtil.IsValid (_dblRealization = - dblRealization)) - throw new java.lang.Exception ("EmpiricalLearnerLoss ctr: Invalid Inputs"); - } - - /** - * Retrieve the Empirical Realization - * - * @return The Empirical Realization - */ - - public double empiricalRealization() - { - return _dblRealization; - } - - /** - * Retrieve the Learning Function - * - * @return The Learning Function - */ - - public org.drip.function.definition.R1ToR1 learner() - { - return _learner; - } - - /** - * Compute the Loss for the specified Variate - * - * @param dblVariate The Variate - * - * @return Loss for the specified Variate - * - * @throws java.lang.Exception Thrown if the Loss cannot be computed - */ - - public double loss ( - final double dblVariate) - throws java.lang.Exception - { - return _dblRealization - _learner.evaluate (dblVariate); - } - - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - return loss (dblVariate); - } -} diff --git a/org/drip/learning/bound/LipschitzCoveringNumberBound.java b/org/drip/learning/bound/LipschitzCoveringNumberBound.java deleted file mode 100644 index dc53ab9..0000000 --- a/org/drip/learning/bound/LipschitzCoveringNumberBound.java +++ /dev/null @@ -1,121 +0,0 @@ - -package org.drip.learning.bound; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * LipschitzCoveringNumberBound contains the Upper Bounds of the Covering Numbers induced by Lipschitz and - * approximate Lipschitz Loss Function Class. - * - * The Reference are: - * - * 1) Bartlett, P. L., P. Long, and R. C. Williamson (1996): Fat-shattering and the Learnability of Real- - * Valued Functions, Journal of Computational System Science, 52 (3) 434-452. - * - * 2) Anthony, M., and P. L. Bartlett (1999): Artificial Neural Network Learning - Theoretical Foundations, - * Cambridge University Press, Cambridge, UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class LipschitzCoveringNumberBound { - private double _dblLpUpperBound = java.lang.Double.NaN; - private double _dblSupremumUpperBound = java.lang.Double.NaN; - - /** - * LipschitzCoveringNumberBound Constructor - * - * @param dblSupremumUpperBound Supremum Upper Bound for the Covering Number - * @param dblLpUpperBound The Lp Upper Bound for the Covering Number - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public LipschitzCoveringNumberBound ( - final double dblSupremumUpperBound, - final double dblLpUpperBound) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblSupremumUpperBound = dblSupremumUpperBound) || - !org.drip.quant.common.NumberUtil.IsValid (_dblLpUpperBound = dblLpUpperBound)) - throw new java.lang.Exception ("LipschitzCoveringNumberBound ctr: Invalid Inputs"); - } - - /** - * Retrieve the Supremum-based Covering Number Upper Bound - * - * @return The Supremum-based Covering Number Upper Bound - */ - - public double supremumUpperBound() - { - return _dblSupremumUpperBound; - } - - /** - * Retrieve the Lp-based Covering Number Upper Bound - * - * @return The Lp-based Covering Number Upper Bound - */ - - public double lpUpperBound() - { - return _dblLpUpperBound; - } - - /** - * Retrieve the Least Covering Number Upper Bound - * - * @return The Least Covering Number Upper Bound - */ - - public double leastUpperBound() - { - return _dblLpUpperBound > _dblSupremumUpperBound ? _dblSupremumUpperBound : _dblLpUpperBound; - } -} diff --git a/org/drip/learning/bound/MeasureConcentrationExpectationBound.java b/org/drip/learning/bound/MeasureConcentrationExpectationBound.java deleted file mode 100644 index fe76f04..0000000 --- a/org/drip/learning/bound/MeasureConcentrationExpectationBound.java +++ /dev/null @@ -1,134 +0,0 @@ - -package org.drip.learning.bound; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * MeasureConcentrationExpectationBound provides the Upper Bound of the Expected Loss between Empirical - * Outcome and the Prediction of the given Learner Class using the Concentration of Measure Inequalities. - * This is expressed as C * n^a, where n is the Size of the Sample, and 'C' and 'a' are Constants specific - * to the Learning Class. - * - * The References are: - * - * 1) Lugosi, G. (2002): Pattern Classification and Learning Theory, in: L. Györ, editor, - * Principles of Non-parametric Learning, 5-62, Springer, Wien. - * - * 2) Boucheron, S., G. Lugosi, and P. Massart (2003): Concentration Inequalities Using the Entropy Method, - * Annals of Probability, 31, 1583-1614. - * - * @author Lakshmi Krishnamurthy - */ - -public class MeasureConcentrationExpectationBound { - private double _dblConstant = java.lang.Double.NaN; - private double _dblExponent = java.lang.Double.NaN; - - /** - * MeasureConcentrationExpectationBound Constructor - * - * @param dblConstant Asymptote Constant - * @param dblExponent Asymptote Exponent - * - * @throws java.lang.Exception Thrown if the Constant and/or Exponent is Invalid - */ - - public MeasureConcentrationExpectationBound ( - final double dblConstant, - final double dblExponent) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblConstant = dblConstant) || - !org.drip.quant.common.NumberUtil.IsValid (_dblExponent = dblExponent)) - throw new java.lang.Exception ("MeasureConcentrationExpectationBound ctr: Invalid Inputs!"); - } - - /** - * Retrieve the Asymptote Constant - * - * @return The Asymptote Constant - */ - - public double constant() - { - return _dblConstant; - } - - /** - * Retrieve the Asymptote Exponent - * - * @return The Asymptote Exponent - */ - - public double exponent() - { - return _dblExponent; - } - - /** - * Compute the Expected Loss Upper Bound between the Sample and the Population for the specified Sample - * Size - * - * @param iSampleSize The Sample Size - * - * @return The Expected Loss Upper Bound the Sample and the Population for the specified Sample Size - * - * @throws java.lang.Exception Thrown if the Expected Loss Upper Bound cannot be computed - */ - - public double lossExpectationUpperBound ( - final int iSampleSize) - throws java.lang.Exception - { - if (0 >= iSampleSize) - throw new java.lang.Exception - ("MeasureConcentrationExpectationBound::lossExpectationUpperBound => Invalid Inputs"); - - return _dblConstant * java.lang.Math.pow (iSampleSize, _dblExponent); - } -} diff --git a/org/drip/learning/kernel/DiagonalScalingOperator.java b/org/drip/learning/kernel/DiagonalScalingOperator.java deleted file mode 100644 index 95ef738..0000000 --- a/org/drip/learning/kernel/DiagonalScalingOperator.java +++ /dev/null @@ -1,146 +0,0 @@ - -package org.drip.learning.kernel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * DiagonalScalingOperator implements the Scaling Operator that is used to determine the Bounds of the R^x L2 - * To R^x L2 Kernel Linear Integral Operator defined by: - * - * T_k [f(.)] := Integral Over Input Space {k (., y) * f(y) * d[Prob(y)]} - * - * The References are: - * - * 1) Ash, R. (1965): Information Theory, Inter-science New York. - * - * 2) Konig, H. (1986): Eigenvalue Distribution of Compact Operators, Birkhauser, Basel, Switzerland. - * - * 3) Gordon, Y., H. Konig, and C. Schutt (1987): Geometric and Probabilistic Estimates of Entropy and - * Approximation Numbers of Operators, Journal of Approximation Theory 49 219-237. - * - * 4) Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * 5) Smola, A. J., A. Elisseff, B. Scholkopf, and R. C. Williamson (2000): Entropy Numbers for Convex - * Combinations and mlps, in: Advances in Large Margin Classifiers, A. Smola, P. Bartlett, B. Scholkopf, - * and D. Schuurmans - editors, MIT Press, Cambridge, MA. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class DiagonalScalingOperator implements org.drip.spaces.cover.OperatorClassCoveringBounds { - private double[] _adblDiagonalScaler = null; - private double _dblScalingProductSupremumBound = java.lang.Double.NaN; - - /** - * DiagonalScalingOperator Constructor - * - * @param adblDiagonalScaler The Diagonal Scaling Multiplier Array - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public DiagonalScalingOperator ( - final double[] adblDiagonalScaler) - throws java.lang.Exception - { - if (null == (_adblDiagonalScaler = adblDiagonalScaler)) - throw new java.lang.Exception ("DiagonalScalingOperator Constructor: Invalid Inputs"); - - double dblScalingProduct = 1.; - int iScalingSize = _adblDiagonalScaler.length; - - if (0 == iScalingSize) - throw new java.lang.Exception ("DiagonalScalingOperator Constructor: Invalid Inputs"); - - for (int i = 0; i < iScalingSize; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (_adblDiagonalScaler[i]) || 0. > - _adblDiagonalScaler[i]) - throw new java.lang.Exception ("DiagonalScalingOperator Constructor: Invalid Inputs"); - - if (0 == i) _dblScalingProductSupremumBound = _adblDiagonalScaler[i]; - - if (i > 0) { - if (_adblDiagonalScaler[i - 1] < _adblDiagonalScaler[i]) - throw new java.lang.Exception ("DiagonalScalingOperator Constructor: Invalid Inputs"); - - double dblCurrentSupremumBound = java.lang.Math.pow ((dblScalingProduct *= - _adblDiagonalScaler[i]) / iScalingSize, 1. / i); - - if (_dblScalingProductSupremumBound < dblCurrentSupremumBound) - _dblScalingProductSupremumBound = dblCurrentSupremumBound; - } - } - } - - /** - * Retrieve the Diagonal Scaling Multiplier Array - * - * @return The Diagonal Scaling Multiplier Array - */ - - public double[] scaler() - { - return _adblDiagonalScaler; - } - - @Override public int entropyNumberIndex() - { - return _adblDiagonalScaler.length; - } - - @Override public double entropyNumberLowerBound() - { - return _dblScalingProductSupremumBound; - } - - @Override public double entropyNumberUpperBound() - { - return 6. * _dblScalingProductSupremumBound; - } -} diff --git a/org/drip/learning/kernel/EigenFunctionRdToR1.java b/org/drip/learning/kernel/EigenFunctionRdToR1.java deleted file mode 100644 index 82c5f5e..0000000 --- a/org/drip/learning/kernel/EigenFunctionRdToR1.java +++ /dev/null @@ -1,96 +0,0 @@ - -package org.drip.learning.kernel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * EigEigenFunctionRdToR1enFunction holds the Eigen-vector Function and its corresponding Space of the R^d To - * R^1 Kernel Linear Integral Operator defined by: - * - * T_k [f(.)] := Integral Over Input Space {k (., y) * f(y) * d[Prob(y)]} - * - * The References are: - * - * 1) Ash, R. (1965): Information Theory, Inter-science New York. - * - * 2) Konig, H. (1986): Eigenvalue Distribution of Compact Operators, Birkhauser, Basel, Switzerland. - * - * 3) Smola, A. J., A. Elisseff, B. Scholkopf, and R. C. Williamson (2000): Entropy Numbers for Convex - * Combinations and mlps, in: Advances in Large Margin Classifiers, A. Smola, P. Bartlett, B. Scholkopf, - * and D. Schuurmans - editors, MIT Press, Cambridge, MA. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class EigenFunctionRdToR1 extends org.drip.spaces.rxtor1.NormedRdToNormedR1 { - private double _dblAgnosticUpperBound = java.lang.Double.NaN; - - protected EigenFunctionRdToR1 ( - final org.drip.spaces.metric.RdNormed rdContinuousInput, - final org.drip.spaces.metric.R1Normed r1ContinuousOutput, - final org.drip.function.definition.RdToR1 funcRdToR1, - final double dblAgnosticUpperBound) - throws java.lang.Exception - { - super (rdContinuousInput, r1ContinuousOutput, funcRdToR1); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblAgnosticUpperBound = dblAgnosticUpperBound)) - throw new java.lang.Exception ("EigenFunctionRdToR1 ctr: Invalid Inputs"); - } - - /** - * Retrieve the Agnostic Upper Bound of the Eigen-Function - * - * @return The Agnostic Upper Bound of the Eigen-Function - */ - - public double agnosticUpperBound() - { - return _dblAgnosticUpperBound; - } -} diff --git a/org/drip/learning/kernel/HilbertSupremumKernelSpace.java b/org/drip/learning/kernel/HilbertSupremumKernelSpace.java deleted file mode 100644 index 9708a8f..0000000 --- a/org/drip/learning/kernel/HilbertSupremumKernelSpace.java +++ /dev/null @@ -1,71 +0,0 @@ - -package org.drip.learning.kernel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * HilbertSupremumKernelSpace contains the Space of Kernels S that are a Transform from the R^d L2 Hilbert To - * R^m L-Infinity Supremum Banach Spaces. - * - * The References are: - * - * 1) Carl, B. (1985): Inequalities of the Bernstein-Jackson type and the Degree of Compactness of Operators - * in Banach Spaces, Annals of the Fourier Institute 35 (3) 79-118. - * - * 2) Carl, B., and I. Stephani (1990): Entropy, Compactness, and the Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * 3) Williamson, R. C., A. J. Smola, and B. Scholkopf (2000): Entropy Numbers of Linear Function Classes, - * in: Proceedings of the 13th Annual Conference on Computational Learning Theory, ACM New York. - * - * @author Lakshmi Krishnamurthy - */ - -public class HilbertSupremumKernelSpace { - -} diff --git a/org/drip/learning/kernel/IntegralOperator.java b/org/drip/learning/kernel/IntegralOperator.java deleted file mode 100644 index dd352e9..0000000 --- a/org/drip/learning/kernel/IntegralOperator.java +++ /dev/null @@ -1,199 +0,0 @@ - -package org.drip.learning.kernel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * IntegralOperator implements the R^x L2 To R^x L2 Mercer Kernel Integral Operator defined by: - * - * T_k [f(.)] := Integral Over Input Space {k (., y) * f(y) * d[Prob(y)]} - * - * The References are: - * - * 1) Ash, R. (1965): Information Theory, Inter-science New York. - * - * 2) Konig, H. (1986): Eigenvalue Distribution of Compact Operators, Birkhauser, Basel, Switzerland. - * - * 3) Smola, A. J., A. Elisseff, B. Scholkopf, and R. C. Williamson (2000): Entropy Numbers for Convex - * Combinations and mlps, in: Advances in Large Margin Classifiers, A. Smola, P. Bartlett, B. Scholkopf, - * and D. Schuurmans - editors, MIT Press, Cambridge, MA. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class IntegralOperator { - private org.drip.measure.continuousmarginal.Rd _distRd = null; - private org.drip.function.definition.RdToR1 _funcRdToR1 = null; - private org.drip.spaces.metric.R1Normed _r1OperatorOutput = null; - private org.drip.learning.kernel.SymmetricRdToNormedR1Kernel _kernel = null; - - /** - * IntegralOperator Constructor - * - * @param kernel The Symmetric Mercer Kernel - this should be R^x L2 X R^x L2 To R^1 - * @param funcRdToR1 The R^d To R^1 Operator Function - * @param r1OperatorOutput The Kernel Integral Operator Output Space - this is R^1 L2 - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public IntegralOperator ( - final org.drip.learning.kernel.SymmetricRdToNormedR1Kernel kernel, - final org.drip.function.definition.RdToR1 funcRdToR1, - final org.drip.spaces.metric.R1Normed r1OperatorOutput) - throws java.lang.Exception - { - if (null == (_kernel = kernel) || null == (_funcRdToR1 = funcRdToR1) || null == (_r1OperatorOutput = - r1OperatorOutput) || null == (_distRd = _kernel.inputMetricVectorSpace().borelSigmaMeasure())) - throw new java.lang.Exception ("IntegralOperator ctr: Invalid Inputs"); - } - - /** - * Retrieve the Symmetric R^d To R^1 Kernel - * - * @return The Symmetric R^d To R^1 Kernel - */ - - public org.drip.learning.kernel.SymmetricRdToNormedR1Kernel kernel() - { - return _kernel; - } - - /** - * Retrieve the R^d To R^1 Kernel Operator Function - * - * @return The R^d To R^1 Kernel Operator Function - */ - - public org.drip.function.definition.RdToR1 kernelOperatorFunction() - { - return _funcRdToR1; - } - - /** - * Retrieve the Input Space Borel Sigma Measure - * - * @return The Input Space Borel Sigma Measure - */ - - public org.drip.measure.continuousmarginal.Rd inputSpaceBorelMeasure() - { - return _distRd; - } - - /** - * Retrieve the Kernel Integral Operator Output Space - * - * @return The Kernel Integral Operator Output Space - */ - - public org.drip.spaces.metric.R1Normed outputVectorMetricSpace() - { - return _r1OperatorOutput; - } - - /** - * Compute the Operator's Kernel Integral across the specified X Variate Instance - * - * @param adblX Validated Vector Instance X - * - * @return The Operator's Kernel Integral across the specified X Variate Instance - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public double computeOperatorIntegral ( - final double[] adblX) - throws java.lang.Exception - { - org.drip.function.definition.RdToR1 funcRdToR1 = new org.drip.function.definition.RdToR1 (null) { - @Override public int dimension() - { - return null == adblX ? 0 : adblX.length; - } - - @Override public double evaluate ( - final double[] adblY) - throws java.lang.Exception - { - return _kernel.evaluate (adblX, adblY) * _funcRdToR1.evaluate (adblY); - } - }; - - return _kernel.inputMetricVectorSpace().borelMeasureSpaceExpectation (funcRdToR1); - } - - /** - * Indicate the Kernel Operator Integral's Positive-definiteness across the specified X Variate Instance - * - * @param adblX Validated Vector Instance X - * - * @return TRUE - The Kernel Operator Integral is Positive Definite across the specified X Variate - * Instance - */ - - public boolean isPositiveDefinite ( - final double[] adblX) - { - try { - return 0 < computeOperatorIntegral (adblX); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - /** - * Eigenize the Kernel Integral Operator - * - * @return The Eigenization Output - */ - - public abstract org.drip.learning.kernel.IntegralOperatorEigenContainer eigenize(); -} diff --git a/org/drip/learning/kernel/IntegralOperatorEigenComponent.java b/org/drip/learning/kernel/IntegralOperatorEigenComponent.java deleted file mode 100644 index 83b9138..0000000 --- a/org/drip/learning/kernel/IntegralOperatorEigenComponent.java +++ /dev/null @@ -1,192 +0,0 @@ - -package org.drip.learning.kernel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * IntegralOperatorEigenComponent holds the Eigen-Function Space and the Eigenvalue Functions/Spaces of the - * R^x L2 To R^x L2 Kernel Linear Integral Operator defined by: - * - * T_k [f(.)] := Integral Over Input Space {k (., y) * f(y) * d[Prob(y)]} - * - * The References are: - * - * 1) Ash, R. (1965): Information Theory, Inter-science New York. - * - * 2) Konig, H. (1986): Eigenvalue Distribution of Compact Operators, Birkhauser, Basel, Switzerland. - * - * 3) Smola, A. J., A. Elisseff, B. Scholkopf, and R. C. Williamson (2000): Entropy Numbers for Convex - * Combinations and mlps, in: Advances in Large Margin Classifiers, A. Smola, P. Bartlett, B. Scholkopf, - * and D. Schuurmans - editors, MIT Press, Cambridge, MA. - * - * @author Lakshmi Krishnamurthy - */ - -public class IntegralOperatorEigenComponent { - private double _dblEigenValue = java.lang.Double.NaN; - private org.drip.learning.kernel.EigenFunctionRdToR1 _efRdToR1 = null; - private org.drip.spaces.rxtor1.NormedRdToNormedR1 _rkhsFeatureMap = null; - - /** - * IntegralOperatorEigenComponent Constructor - * - * @param efRdToR1 Normed R^d To Normed R^1 Eigen-Function - * @param dblEigenValue The Eigenvalue - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public IntegralOperatorEigenComponent ( - final org.drip.learning.kernel.EigenFunctionRdToR1 efRdToR1, - final double dblEigenValue) - throws java.lang.Exception - { - if (null == (_efRdToR1 = efRdToR1) || !org.drip.quant.common.NumberUtil.IsValid (_dblEigenValue = - dblEigenValue)) - throw new java.lang.Exception ("IntegralOperatorEigenComponent ctr: Invalid Inputs"); - - final org.drip.function.definition.RdToR1 eigenFuncRdToR1 = _efRdToR1.function(); - - if (null != eigenFuncRdToR1) { - org.drip.function.definition.RdToR1 rkhsFeatureMapRdToR1 = new - org.drip.function.definition.RdToR1 (null) { - @Override public int dimension() - { - return org.drip.function.definition.RdToR1.DIMENSION_NOT_FIXED; - } - - @Override public double evaluate ( - final double[] adblX) - throws java.lang.Exception - { - return java.lang.Math.sqrt (_dblEigenValue) * eigenFuncRdToR1.evaluate (adblX); - } - }; - - org.drip.spaces.metric.RdNormed rdContinuousInput = efRdToR1.inputMetricVectorSpace(); - - org.drip.spaces.metric.R1Normed r1ContinuousOutput = efRdToR1.outputMetricVectorSpace(); - - org.drip.spaces.metric.R1Continuous r1Continuous = org.drip.spaces.metric.R1Continuous.Standard - (r1ContinuousOutput.leftEdge(), r1ContinuousOutput.rightEdge(), - r1ContinuousOutput.borelSigmaMeasure(), 2); - - _rkhsFeatureMap = rdContinuousInput instanceof org.drip.spaces.metric.RdCombinatorialBanach ? new - org.drip.spaces.rxtor1.NormedRdCombinatorialToR1Continuous - ((org.drip.spaces.metric.RdCombinatorialBanach) rdContinuousInput, r1Continuous, - rkhsFeatureMapRdToR1) : new org.drip.spaces.rxtor1.NormedRdContinuousToR1Continuous - ((org.drip.spaces.metric.RdContinuousBanach) rdContinuousInput, r1Continuous, - rkhsFeatureMapRdToR1); - } - } - - /** - * Retrieve the Eigen-Function - * - * @return The Eigen-Function - */ - - public org.drip.learning.kernel.EigenFunctionRdToR1 eigenFunction() - { - return _efRdToR1; - } - - /** - * Retrieve the Eigenvalue - * - * @return The Eigenvalue - */ - - public double eigenvalue() - { - return _dblEigenValue; - } - - /** - * Retrieve the Feature Map Space represented via the Reproducing Kernel Hilbert Space - * - * @return The Feature Map Space representation using the Reproducing Kernel Hilbert Space - */ - - public org.drip.spaces.rxtor1.NormedRdToNormedR1 rkhsFeatureMap() - { - return _rkhsFeatureMap; - } - - /** - * Retrieve the RKHS Feature Map Parallelepiped Agnostic Upper Bound Length - * - * @return The RKHS Feature Map Parallelepiped Agnostic Upper Bound Length - */ - - public double rkhsFeatureParallelepipedLength() - { - return 2. * _efRdToR1.agnosticUpperBound() * java.lang.Math.sqrt (_dblEigenValue); - } - - /** - * Compute the Eigen-Component Contribution to the Kernel Value - * - * @param adblX The X Variate Array - * @param adblY The Y Variate Array - * - * @return The Eigen-Component Contribution to the Kernel Value - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public double evaluate ( - final double[] adblX, - final double[] adblY) - throws java.lang.Exception - { - org.drip.function.definition.RdToR1 eigenFuncRdToR1 = _efRdToR1.function(); - - return eigenFuncRdToR1.evaluate (adblX) * eigenFuncRdToR1.evaluate (adblY) * _dblEigenValue; - } -} diff --git a/org/drip/learning/kernel/IntegralOperatorEigenContainer.java b/org/drip/learning/kernel/IntegralOperatorEigenContainer.java deleted file mode 100644 index e11a13d..0000000 --- a/org/drip/learning/kernel/IntegralOperatorEigenContainer.java +++ /dev/null @@ -1,215 +0,0 @@ - -package org.drip.learning.kernel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * IntegralOperatorEigenContainer holds the Group of Eigen-Components that result from the Eigenization of - * the R^x L2 To R^x L2 Kernel Linear Integral Operator defined by: - * - * T_k [f(.)] := Integral Over Input Space {k (., y) * f(y) * d[Prob(y)]} - * - * The References are: - * - * 1) Ash, R. (1965): Information Theory, Inter-science New York. - * - * 2) Konig, H. (1986): Eigenvalue Distribution of Compact Operators, Birkhauser, Basel, Switzerland. - * - * 3) Smola, A. J., A. Elisseff, B. Scholkopf, and R. C. Williamson (2000): Entropy Numbers for Convex - * Combinations and mlps, in: Advances in Large Margin Classifiers, A. Smola, P. Bartlett, B. Scholkopf, - * and D. Schuurmans - editors, MIT Press, Cambridge, MA. - * - * @author Lakshmi Krishnamurthy - */ - -public class IntegralOperatorEigenContainer { - private org.drip.learning.kernel.IntegralOperatorEigenComponent[] _aIOEC = null; - - /** - * IntegralOperatorEigenContainer Constructor - * - * @param aIOEC Array of the Integral Operator Eigen-Components - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public IntegralOperatorEigenContainer ( - final org.drip.learning.kernel.IntegralOperatorEigenComponent[] aIOEC) - throws java.lang.Exception - { - if (null == (_aIOEC = aIOEC) || 0 == _aIOEC.length) - throw new java.lang.Exception ("IntegralOperatorEigenContainer ctr: Invalid Inputs"); - } - - /** - * Retrieve the Array of the Integral Operator Eigen-Components - * - * @return The Array of the Integral Operator Eigen-Components - */ - - public org.drip.learning.kernel.IntegralOperatorEigenComponent[] eigenComponents() - { - return _aIOEC; - } - - /** - * Retrieve the Eigen Input Space - * - * @return The Eigen Input Space - */ - - public org.drip.spaces.metric.RdNormed inputMetricVectorSpace() - { - return _aIOEC[0].eigenFunction().inputMetricVectorSpace(); - } - - /** - * Retrieve the Eigen Output Space - * - * @return The Eigen Output Space - */ - - public org.drip.spaces.metric.R1Normed outputMetricVectorSpace() - { - return _aIOEC[0].eigenFunction().outputMetricVectorSpace(); - } - - /** - * Generate the Diagonally Scaled Normed Vector Space of the RKHS Feature Space Bounds that results on - * applying the Diagonal Scaling Operator - * - * @param dso The Diagonal Scaling Operator - * - * @return The Diagonally Scaled Normed Vector Space of the RKHS Feature Space - */ - - public org.drip.spaces.metric.R1Combinatorial diagonallyScaledFeatureSpace ( - final org.drip.learning.kernel.DiagonalScalingOperator dso) - { - if (null == dso) return null; - - double[] adblDiagonalScalingOperator = dso.scaler(); - - int iDimension = adblDiagonalScalingOperator.length; - - if (iDimension != _aIOEC.length) return null; - - java.util.List lsElementSpace = new java.util.ArrayList(); - - for (int i = 0; i < iDimension; ++i) - lsElementSpace.add (0.5 * _aIOEC[i].rkhsFeatureParallelepipedLength() / - adblDiagonalScalingOperator[i]); - - try { - return new org.drip.spaces.metric.R1Combinatorial (lsElementSpace, null, 2); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Operator Class Covering Number Bounds of the RKHS Feature Space Bounds that result on the - * Application of the Diagonal Scaling Operator - * - * @param dso The Diagonal Scaling Operator - * - * @return The Operator Class Covering Number Bounds of the RKHS Feature Space - */ - - public org.drip.spaces.cover.OperatorClassCoveringBounds scaledCoveringNumberBounds ( - final org.drip.learning.kernel.DiagonalScalingOperator dso) - { - final org.drip.spaces.metric.R1Combinatorial r1ContinuousScaled = diagonallyScaledFeatureSpace (dso); - - if (null == r1ContinuousScaled) return null; - - try { - final double dblPopulationMetricNorm = r1ContinuousScaled.populationMetricNorm(); - - org.drip.spaces.cover.OperatorClassCoveringBounds occb = new - org.drip.spaces.cover.OperatorClassCoveringBounds() { - @Override public double entropyNumberLowerBound() - throws java.lang.Exception - { - return dso.entropyNumberLowerBound() * dblPopulationMetricNorm; - } - - @Override public double entropyNumberUpperBound() - throws java.lang.Exception - { - return dso.entropyNumberUpperBound() * dblPopulationMetricNorm; - } - - @Override public int entropyNumberIndex() - { - return dso.entropyNumberIndex(); - } - - @Override public double norm() - throws java.lang.Exception - { - return dso.norm() * dblPopulationMetricNorm; - } - - @Override public org.drip.learning.bound.DiagonalOperatorCoveringBound - entropyNumberAsymptote() - { - return dso.entropyNumberAsymptote(); - } - }; - - return occb; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/learning/kernel/MercerKernel.java b/org/drip/learning/kernel/MercerKernel.java deleted file mode 100644 index c18f8ee..0000000 --- a/org/drip/learning/kernel/MercerKernel.java +++ /dev/null @@ -1,114 +0,0 @@ - -package org.drip.learning.kernel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * MercerKernal exposes the Functionality behind the Eigenized Kernel that is Normed R^x X Normed R^x To - * Supremum R^1. - * - * The References are: - * - * 1) Ash, R. (1965): Information Theory, Inter-science New York. - * - * 2) Konig, H. (1986): Eigenvalue Distribution of Compact Operators, Birkhauser, Basel, Switzerland. - * - * 3) Smola, A. J., A. Elisseff, B. Scholkopf, and R. C. Williamson (2000): Entropy Numbers for Convex - * Combinations and mlps, in: Advances in Large Margin Classifiers, A. Smola, P. Bartlett, B. Scholkopf, - * and D. Schuurmans - editors, MIT Press, Cambridge, MA. - * - * @author Lakshmi Krishnamurthy - */ - -public class MercerKernel extends org.drip.learning.kernel.SymmetricRdToNormedR1Kernel { - private org.drip.learning.kernel.IntegralOperatorEigenContainer _ioec = null; - - /** - * MercerKernel Constructor - * - * @param ioec The Container of the Eigen Components - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public MercerKernel ( - final org.drip.learning.kernel.IntegralOperatorEigenContainer ioec) - throws java.lang.Exception - { - super (ioec.inputMetricVectorSpace(), ioec.outputMetricVectorSpace()); - - _ioec = ioec; - } - - /** - * Retrieve the Suite of Eigen Components - * - * @return The Suite of Eigen Components - */ - - public org.drip.learning.kernel.IntegralOperatorEigenContainer eigenComponentSuite() - { - return _ioec; - } - - @Override public double evaluate ( - final double[] adblX, - final double[] adblY) - throws java.lang.Exception - { - org.drip.learning.kernel.IntegralOperatorEigenComponent[] aEigenComp = _ioec.eigenComponents(); - - double dblValue = 0.; - int iNumEigenComp = aEigenComp.length; - - for (int i = 0; i < iNumEigenComp; ++i) - dblValue += aEigenComp[i].evaluate (adblX, adblY); - - return dblValue; - } -} diff --git a/org/drip/learning/kernel/SymmetricRdToNormedR1Kernel.java b/org/drip/learning/kernel/SymmetricRdToNormedR1Kernel.java deleted file mode 100644 index 671818b..0000000 --- a/org/drip/learning/kernel/SymmetricRdToNormedR1Kernel.java +++ /dev/null @@ -1,140 +0,0 @@ - -package org.drip.learning.kernel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * SymmetricRdToNormedR1Kernel exposes the Functionality behind the Kernel that is Normed R^d X Normed R^d To - * Supremum R^1, that is, a Kernel that symmetric in the Input Metric Vector Space in terms of both the - * Metric and the Dimensionality. - * - * The References are: - * - * 1) Ash, R. (1965): Information Theory, Inter-science New York. - * - * 2) Konig, H. (1986): Eigenvalue Distribution of Compact Operators, Birkhauser, Basel, Switzerland. - * - * 3) Smola, A. J., A. Elisseff, B. Scholkopf, and R. C. Williamson (2000): Entropy Numbers for Convex - * Combinations and mlps, in: Advances in Large Margin Classifiers, A. Smola, P. Bartlett, B. Scholkopf, - * and D. Schuurmans - editors, MIT Press, Cambridge, MA. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class SymmetricRdToNormedR1Kernel { - private org.drip.spaces.metric.RdNormed _rdContinuousInput = null; - private org.drip.spaces.metric.R1Normed _r1ContinuousOutput = null; - - /** - * SymmetricRdToNormedR1Kernel Constructor - * - * @param rdContinuousInput The Symmetric Input R^d Metric Vector Space - * @param r1ContinuousOutput The Output R^1 Metric Vector Space - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public SymmetricRdToNormedR1Kernel ( - final org.drip.spaces.metric.RdNormed rdContinuousInput, - final org.drip.spaces.metric.R1Normed r1ContinuousOutput) - throws java.lang.Exception - { - if (null == (_rdContinuousInput = rdContinuousInput) || null == (_r1ContinuousOutput = - r1ContinuousOutput)) - throw new java.lang.Exception ("SymmetricRdToNormedR1Kernel ctr: Invalid Inputs"); - } - - /** - * Retrieve the Symmetric Input Metric R^d Vector Space - * - * @return The Symmetric Input Metric R^d Vector Space - */ - - public org.drip.spaces.metric.RdNormed inputMetricVectorSpace() - { - return _rdContinuousInput; - } - - /** - * Retrieve the Output R^1 Metric Vector Space - * - * @return The Output R^1 Metric Vector Space - */ - - public org.drip.spaces.metric.R1Normed outputMetricVectorSpace() - { - return _r1ContinuousOutput; - } - - /** - * Compute the Feature Space Input Dimension - * - * @return The Feature Space Input Dimension - */ - - public int featureSpaceDimension() - { - return _rdContinuousInput.dimension(); - } - - /** - * Compute the Kernel's R^d X R^d To R^1 Value - * - * @param adblX Validated Vector Instance X - * @param adblY Validated Vector Instance Y - * - * @return The Kernel's R^d X R^d To R^1 Value - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public abstract double evaluate ( - final double[] adblX, - final double[] adblY) - throws java.lang.Exception; -} diff --git a/org/drip/learning/kernel/SymmetricRdToNormedRdKernel.java b/org/drip/learning/kernel/SymmetricRdToNormedRdKernel.java deleted file mode 100644 index 87e499b..0000000 --- a/org/drip/learning/kernel/SymmetricRdToNormedRdKernel.java +++ /dev/null @@ -1,140 +0,0 @@ - -package org.drip.learning.kernel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * SymmetricRdToNormedRdKernel exposes the Functionality behind the Kernel that is Normed R^d X Normed R^d To - * Normed R^d, that is, a Kernel that symmetric in the Input Metric Vector Space in terms of both the - * Metric and the Dimensionality. - * - * The References are: - * - * 1) Ash, R. (1965): Information Theory, Inter-science New York. - * - * 2) Konig, H. (1986): Eigenvalue Distribution of Compact Operators, Birkhauser, Basel, Switzerland. - * - * 3) Smola, A. J., A. Elisseff, B. Scholkopf, and R. C. Williamson (2000): Entropy Numbers for Convex - * Combinations and mlps, in: Advances in Large Margin Classifiers, A. Smola, P. Bartlett, B. Scholkopf, - * and D. Schuurmans - editors, MIT Press, Cambridge, MA. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class SymmetricRdToNormedRdKernel { - private org.drip.spaces.metric.RdNormed _rdContinuousInput = null; - private org.drip.spaces.metric.RdNormed _rdContinuousOutput = null; - - /** - * SymmetricRdToNormedRdKernel Constructor - * - * @param rdContinuousInput The Symmetric Input R^d Metric Vector Space - * @param rdContinuousOutput The Output R^d Metric Vector Space - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public SymmetricRdToNormedRdKernel ( - final org.drip.spaces.metric.RdNormed rdContinuousInput, - final org.drip.spaces.metric.RdNormed rdContinuousOutput) - throws java.lang.Exception - { - if (null == (_rdContinuousInput = rdContinuousInput) || null == (_rdContinuousOutput = - rdContinuousOutput)) - throw new java.lang.Exception ("SymmetricRdToNormedR1Kernel ctr: Invalid Inputs"); - } - - /** - * Retrieve the Symmetric Input Metric R^d Vector Space - * - * @return The Symmetric Input Metric R^d Vector Space - */ - - public org.drip.spaces.metric.RdNormed inputMetricVectorSpace() - { - return _rdContinuousInput; - } - - /** - * Retrieve the Output R^d Metric Vector Space - * - * @return The Output R^d Metric Vector Space - */ - - public org.drip.spaces.metric.RdNormed outputMetricVectorSpace() - { - return _rdContinuousOutput; - } - - /** - * Compute the Feature Space Input Dimension - * - * @return The Feature Space Input Dimension - */ - - public int featureSpaceDimension() - { - return _rdContinuousOutput.dimension(); - } - - /** - * Compute the Kernel's R^d X R^d To R^1 Dot-Product Value - * - * @param adblX Validated Vector Instance X - * @param adblY Validated Vector Instance Y - * - * @return The Kernel's R^d X R^d To R^1 Dot-Product Value - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public abstract double evaluate ( - final double[] adblX, - final double[] adblY) - throws java.lang.Exception; -} diff --git a/org/drip/learning/regularization/RegularizationFunction.java b/org/drip/learning/regularization/RegularizationFunction.java deleted file mode 100644 index 602c4ce..0000000 --- a/org/drip/learning/regularization/RegularizationFunction.java +++ /dev/null @@ -1,129 +0,0 @@ - -package org.drip.learning.regularization; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RegularizerFunction the R^1 To R^1 and the R^d To R^1 Regularization Functions. The References are: - * - * 1) Alon, N., S. Ben-David, N. Cesa Bianchi, and D. Haussler (1997): Scale-sensitive Dimensions, Uniform - * Convergence, and Learnability, Journal of Association of Computational Machinery, 44 (4) 615-631. - * - * 2) Anthony, M., and P. L. Bartlett (1999): Artificial Neural Network Learning - Theoretical Foundations, - * Cambridge University Press, Cambridge, UK. - * - * 3) Kearns, M. J., R. E. Schapire, and L. M. Sellie (1994): Towards Efficient Agnostic Learning, Machine - * Learning, 17 (2) 115-141. - * - * 4) Lee, W. S., P. L. Bartlett, and R. C. Williamson (1998): The Importance of Convexity in Learning with - * Squared Loss, IEEE Transactions on Information Theory, 44 1974-1980. - * - * 5) Vapnik, V. N. (1998): Statistical Learning Theory, Wiley, New York. - * - * @author Lakshmi Krishnamurthy - */ - -public class RegularizationFunction { - private double _dblLambda = java.lang.Double.NaN; - private org.drip.function.definition.R1ToR1 _regR1ToR1 = null; - private org.drip.function.definition.RdToR1 _regRdToR1 = null; - - /** - * RegularizationFunction Constructor - * - * @param regR1ToR1 R^1 To R^1 Regularization Function - * @param regRdToR1 R^d To R^1 Regularization Function - * @param dblLambda The Regularizer Lambda - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public RegularizationFunction ( - final org.drip.function.definition.R1ToR1 regR1ToR1, - final org.drip.function.definition.RdToR1 regRdToR1, - final double dblLambda) - throws java.lang.Exception - { - if (null == (_regR1ToR1 = regR1ToR1) && null == (_regRdToR1 = regRdToR1) || - !org.drip.quant.common.NumberUtil.IsValid (_dblLambda = dblLambda)) - throw new java.lang.Exception ("RegularizationFunction ctr: Invalid Inputs"); - } - - /** - * Retrieve the R^1 To R^1 Regularization Function - * - * @return The R^1 To R^1 Regularization Function Instance - */ - - public org.drip.function.definition.R1ToR1 r1Tor1() - { - return _regR1ToR1; - } - - /** - * Retrieve the R^d To R^1 Regularization Function - * - * @return The R^d To R^1 Regularization Function Instance - */ - - public org.drip.function.definition.RdToR1 rdTor1() - { - return _regRdToR1; - } - - /** - * Retrieve the Regularization Constant Lambda - * - * @return The Regularization Constant Lambda - */ - - public double lambda() - { - return _dblLambda; - } -} diff --git a/org/drip/learning/regularization/RegularizerBuilder.java b/org/drip/learning/regularization/RegularizerBuilder.java deleted file mode 100644 index 32be0bb..0000000 --- a/org/drip/learning/regularization/RegularizerBuilder.java +++ /dev/null @@ -1,255 +0,0 @@ - -package org.drip.learning.regularization; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RegularizerBuilder constructs Custom Regularizers for the different Normed Learner Function Types. The - * References are: - * - * 1) Alon, N., S. Ben-David, N. Cesa Bianchi, and D. Haussler (1997): Scale-sensitive Dimensions, Uniform - * Convergence, and Learnability, Journal of Association of Computational Machinery, 44 (4) 615-631. - * - * 2) Anthony, M., and P. L. Bartlett (1999): Artificial Neural Network Learning - Theoretical Foundations, - * Cambridge University Press, Cambridge, UK. - * - * 3) Kearns, M. J., R. E. Schapire, and L. M. Sellie (1994): Towards Efficient Agnostic Learning, Machine - * Learning, 17 (2) 115-141. - * - * 4) Lee, W. S., P. L. Bartlett, and R. C. Williamson (1998): The Importance of Convexity in Learning with - * Squared Loss, IEEE Transactions on Information Theory, 44 1974-1980. - * - * 5) Vapnik, V. N. (1998): Statistical Learning Theory, Wiley, New York. - * - * @author Lakshmi Krishnamurthy - */ - -public class RegularizerBuilder { - - /** - * Construct an Instance of R^1 Combinatorial To R^1 Continuous Regularizer - * - * @param funcRegularizerR1ToR1 The R^1 To R^1 Regularizer Function - * @param funcSpaceR1ToR1 The R^1 Combinatorial To R^1 Continuous Learner Function Space - * @param dblLambda The Regularization Lambda - * - * @return The R^1 Combinatorial To R^1 Continuous Regularizer Instance - */ - - public static final org.drip.learning.regularization.RegularizerR1ToR1 R1CombinatorialToR1Continuous ( - final org.drip.function.definition.R1ToR1 funcRegularizerR1ToR1, - final org.drip.spaces.rxtor1.NormedR1CombinatorialToR1Continuous funcSpaceR1ToR1, - final double dblLambda) - { - try { - return null == funcSpaceR1ToR1 ? null : new - org.drip.learning.regularization.RegularizerR1CombinatorialToR1Continuous - (funcRegularizerR1ToR1, (org.drip.spaces.metric.R1Combinatorial) - funcSpaceR1ToR1.inputMetricVectorSpace(), (org.drip.spaces.metric.R1Continuous) - funcSpaceR1ToR1.outputMetricVectorSpace(), dblLambda); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an Instance of R^1 Continuous To R^1 Continuous Regularizer - * - * @param funcRegularizerR1ToR1 The R^1 To R^1 Regularizer Function - * @param funcSpaceR1ToR1 The R^1 Continuous To R^1 Continuous Learner Function Space - * @param dblLambda The Regularization Lambda - * - * @return The R^1 Continuous To R^1 Continuous Regularizer Instance - */ - - public static final org.drip.learning.regularization.RegularizerR1ToR1 R1ContinuousToR1Continuous ( - final org.drip.function.definition.R1ToR1 funcRegularizerR1ToR1, - final org.drip.spaces.rxtor1.NormedR1ContinuousToR1Continuous funcSpaceR1ToR1, - final double dblLambda) - { - try { - return null == funcSpaceR1ToR1 ? null : new - org.drip.learning.regularization.RegularizerR1ContinuousToR1Continuous - (funcRegularizerR1ToR1, (org.drip.spaces.metric.R1Continuous) - funcSpaceR1ToR1.inputMetricVectorSpace(), (org.drip.spaces.metric.R1Continuous) - funcSpaceR1ToR1.outputMetricVectorSpace(), dblLambda); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an Instance of R^1 Combinatorial/Continuous To R^1 Continuous Regularizer - * - * @param funcRegularizerR1ToR1 The R^1 To R^1 Regularizer Function - * @param r1Input The R^1 Combinatorial/Continuous Input Space - * @param r1ContinuousOutput The R^1 Continuous Output Space - * @param dblLambda The Regularization Lambda - * - * @return The R^1 Combinatorial/Continuous To R^1 Continuous Regularizer Instance - */ - - public static final org.drip.learning.regularization.RegularizerR1ToR1 ToR1Continuous ( - final org.drip.function.definition.R1ToR1 funcRegularizerR1ToR1, - final org.drip.spaces.metric.R1Normed r1Input, - final org.drip.spaces.metric.R1Continuous r1ContinuousOutput, - final double dblLambda) - { - if (null == r1Input) return null; - - try { - if (r1Input instanceof org.drip.spaces.metric.R1Continuous) - return new org.drip.learning.regularization.RegularizerR1ContinuousToR1Continuous - (funcRegularizerR1ToR1, (org.drip.spaces.metric.R1Continuous) r1Input, - r1ContinuousOutput, dblLambda); - - return new org.drip.learning.regularization.RegularizerR1CombinatorialToR1Continuous - (funcRegularizerR1ToR1, (org.drip.spaces.metric.R1Combinatorial) r1Input, - r1ContinuousOutput, dblLambda); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an Instance of R^d Combinatorial To R^1 Continuous Regularizer - * - * @param funcRegularizerRdToR1 The R^d To R^1 Regularizer Function - * @param funcSpaceRdToR1 The R^d Combinatorial To R^1 Continuous Learner Function Space - * @param dblLambda The Regularization Lambda - * - * @return The R^d Combinatorial To R^1 Continuous Regularizer Instance - */ - - public static final org.drip.learning.regularization.RegularizerRdToR1 RdCombinatorialToR1Continuous ( - final org.drip.function.definition.RdToR1 funcRegularizerRdToR1, - final org.drip.spaces.rxtor1.NormedRdCombinatorialToR1Continuous funcSpaceRdToR1, - final double dblLambda) - { - try { - return null == funcSpaceRdToR1 ? null : new - org.drip.learning.regularization.RegularizerRdCombinatorialToR1Continuous - (funcRegularizerRdToR1, (org.drip.spaces.metric.RdCombinatorialBanach) - funcSpaceRdToR1.inputMetricVectorSpace(), (org.drip.spaces.metric.R1Continuous) - funcSpaceRdToR1.outputMetricVectorSpace(), dblLambda); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an Instance of R^d Continuous To R^1 Continuous Regularizer - * - * @param funcRegularizerRdToR1 The R^d To R^1 Regularizer Function - * @param funcSpaceRdToR1 The R^d Continuous To R^1 Continuous Learner Function Space - * @param dblLambda The Regularization Lambda - * - * @return The R^d Continuous To R^1 Continuous Regularizer Instance - */ - - public static final org.drip.learning.regularization.RegularizerRdToR1 RdContinuousToR1Continuous ( - final org.drip.function.definition.RdToR1 funcRegularizerRdToR1, - final org.drip.spaces.rxtor1.NormedRdContinuousToR1Continuous funcSpaceRdToR1, - final double dblLambda) - { - try { - return null == funcSpaceRdToR1 ? null : new - org.drip.learning.regularization.RegularizerRdContinuousToR1Continuous - (funcRegularizerRdToR1, (org.drip.spaces.metric.RdContinuousBanach) - funcSpaceRdToR1.inputMetricVectorSpace(), (org.drip.spaces.metric.R1Continuous) - funcSpaceRdToR1.outputMetricVectorSpace(), dblLambda); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an Instance of R^d Combinatorial/Continuous To R^1 Continuous Regularizer - * - * @param funcRegularizerRdToR1 The R^d To R^1 Regularizer Function - * @param rdInput The R^d Combinatorial/Continuous Input Space - * @param r1ContinuousOutput The R^1 Continuous Output Space - * @param dblLambda The Regularization Lambda - * - * @return The R^1 Combinatorial/Continuous To R^1 Continuous Regularizer Instance - */ - - public static final org.drip.learning.regularization.RegularizerRdToR1 ToRdContinuous ( - final org.drip.function.definition.RdToR1 funcRegularizerRdToR1, - final org.drip.spaces.metric.RdNormed rdInput, - final org.drip.spaces.metric.R1Continuous r1ContinuousOutput, - final double dblLambda) - { - if (null == rdInput) return null; - - try { - if (rdInput instanceof org.drip.spaces.metric.RdContinuousBanach) - return new org.drip.learning.regularization.RegularizerRdContinuousToR1Continuous - (funcRegularizerRdToR1, (org.drip.spaces.metric.RdContinuousBanach) rdInput, - r1ContinuousOutput, dblLambda); - - return new org.drip.learning.regularization.RegularizerRdCombinatorialToR1Continuous - (funcRegularizerRdToR1, (org.drip.spaces.metric.RdCombinatorialBanach) rdInput, - r1ContinuousOutput, dblLambda); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/learning/regularization/RegularizerR1CombinatorialToR1Continuous.java b/org/drip/learning/regularization/RegularizerR1CombinatorialToR1Continuous.java deleted file mode 100644 index da4d8a0..0000000 --- a/org/drip/learning/regularization/RegularizerR1CombinatorialToR1Continuous.java +++ /dev/null @@ -1,202 +0,0 @@ - -package org.drip.learning.regularization; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RegularizerR1CombinatorialToR1Continuous computes the Structural Loss and Risk for the specified Normed - * R^1 Combinatorial To Normed R^1 Continuous Learning Function. - * - * The References are: - * - * 1) Alon, N., S. Ben-David, N. Cesa Bianchi, and D. Haussler (1997): Scale-sensitive Dimensions, Uniform - * Convergence, and Learnability, Journal of Association of Computational Machinery, 44 (4) 615-631. - * - * 2) Anthony, M., and P. L. Bartlett (1999): Artificial Neural Network Learning - Theoretical Foundations, - * Cambridge University Press, Cambridge, UK. - * - * 3) Kearns, M. J., R. E. Schapire, and L. M. Sellie (1994): Towards Efficient Agnostic Learning, Machine - * Learning, 17 (2) 115-141. - * - * 4) Lee, W. S., P. L. Bartlett, and R. C. Williamson (1998): The Importance of Convexity in Learning with - * Squared Loss, IEEE Transactions on Information Theory, 44 1974-1980. - * - * 5) Vapnik, V. N. (1998): Statistical Learning Theory, Wiley, New York. - * - * @author Lakshmi Krishnamurthy - */ - -public class RegularizerR1CombinatorialToR1Continuous extends - org.drip.spaces.rxtor1.NormedR1CombinatorialToR1Continuous implements - org.drip.learning.regularization.RegularizerR1ToR1 { - private double _dblLambda = java.lang.Double.NaN; - - /** - * RegularizerR1CombinatorialToR1Continuous Function Space Constructor - * - * @param funcRegularizerR1ToR1 The R^1 To R^1 Regularizer Function - * @param r1CombinatorialInput The Combinatorial R^1 Input Metric Vector Space - * @param r1ContinuousOutput The Continuous R^1 Output Metric Vector Space - * @param dblLambda The Regularization Lambda - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public RegularizerR1CombinatorialToR1Continuous ( - final org.drip.function.definition.R1ToR1 funcRegularizerR1ToR1, - final org.drip.spaces.metric.R1Combinatorial r1CombinatorialInput, - final org.drip.spaces.metric.R1Continuous r1ContinuousOutput, - final double dblLambda) - throws java.lang.Exception - { - super (r1CombinatorialInput, r1ContinuousOutput, funcRegularizerR1ToR1); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblLambda = dblLambda) || 0 > _dblLambda) - throw new java.lang.Exception - ("RegularizerR1CombinatorialToR1Continuous Constructor => Invalid Inputs"); - } - - @Override public double lambda() - { - return _dblLambda; - } - - @Override public double structuralLoss ( - final org.drip.function.definition.R1ToR1 funcR1ToR1, - final double[] adblX) - throws java.lang.Exception - { - if (null == funcR1ToR1 || null == adblX) - throw new java.lang.Exception - ("RegularizerR1CombinatorialToR1Continuous::structuralLoss => Invalid Inputs"); - - double dblLoss = 0.; - int iNumSample = adblX.length; - - if (0 == iNumSample) - throw new java.lang.Exception - ("RegularizerR1CombinatorialToR1Continuous::structuralLoss => Invalid Inputs"); - - int iPNorm = outputMetricVectorSpace().pNorm(); - - org.drip.function.definition.R1ToR1 funcRegularizerR1ToR1 = function(); - - if (java.lang.Integer.MAX_VALUE == iPNorm) { - double dblSupremum = 0.; - - for (int i = 0; i < iNumSample; ++i) { - double dblNodeValue = java.lang.Math.abs (funcRegularizerR1ToR1.evaluate (adblX[i]) * - funcR1ToR1.evaluate (adblX[i])); - - if (dblNodeValue > dblSupremum) dblSupremum = dblNodeValue; - } - - return dblSupremum; - } - - for (int i = 0; i < iNumSample; ++i) - dblLoss += java.lang.Math.pow (java.lang.Math.abs (funcRegularizerR1ToR1.evaluate (adblX[i]) * - funcR1ToR1.evaluate (adblX[i])), iPNorm); - - return dblLoss / iPNorm; - } - - @Override public double structuralRisk ( - final org.drip.measure.continuousjoint.R1R1 distR1R1, - final org.drip.function.definition.R1ToR1 funcR1ToR1, - final double[] adblX, - final double[] adblY) - throws java.lang.Exception - { - if (null == funcR1ToR1 || null == adblX || null == adblY) - throw new java.lang.Exception - ("RegularizerR1CombinatorialToR1Continuous::structuralRisk => Invalid Inputs"); - - double dblLoss = 0.; - double dblNormalizer = 0.; - int iNumSample = adblX.length; - - if (0 == iNumSample || iNumSample != adblY.length) - throw new java.lang.Exception - ("RegularizerR1CombinatorialToR1Continuous::structuralRisk => Invalid Inputs"); - - int iPNorm = outputMetricVectorSpace().pNorm(); - - org.drip.function.definition.R1ToR1 funcRegularizerR1ToR1 = function(); - - if (java.lang.Integer.MAX_VALUE == iPNorm) { - double dblWeightedSupremum = 0.; - double dblSupremumNodeValue = 0.; - - for (int i = 0; i < iNumSample; ++i) { - double dblNodeValue = java.lang.Math.abs (funcRegularizerR1ToR1.evaluate (adblX[i]) * - funcR1ToR1.evaluate (adblX[i])); - - double dblWeightedNodeValue = distR1R1.density (adblX[i], adblY[i]) * dblNodeValue; - - if (dblWeightedNodeValue > dblWeightedSupremum) { - dblSupremumNodeValue = dblNodeValue; - dblWeightedSupremum = dblWeightedNodeValue; - } - } - - return dblSupremumNodeValue; - } - - for (int i = 0; i < iNumSample; ++i) { - double dblDensity = distR1R1.density (adblX[i], adblY[i]); - - dblNormalizer += dblDensity; - - dblLoss += dblDensity * java.lang.Math.pow (java.lang.Math.abs (funcRegularizerR1ToR1.evaluate - (adblX[i]) * funcR1ToR1.evaluate (adblX[i])), iPNorm); - } - - return dblLoss / iPNorm / dblNormalizer; - } -} diff --git a/org/drip/learning/regularization/RegularizerR1ContinuousToR1Continuous.java b/org/drip/learning/regularization/RegularizerR1ContinuousToR1Continuous.java deleted file mode 100644 index 4eacb53..0000000 --- a/org/drip/learning/regularization/RegularizerR1ContinuousToR1Continuous.java +++ /dev/null @@ -1,202 +0,0 @@ - -package org.drip.learning.regularization; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RegularizerR1ContinuousToR1Continuous computes the Structural Loss and Risk for the specified Normed R^1 - * Continuous To Normed R^1 Continuous Learning Function. - * - * The References are: - * - * 1) Alon, N., S. Ben-David, N. Cesa Bianchi, and D. Haussler (1997): Scale-sensitive Dimensions, Uniform - * Convergence, and Learnability, Journal of Association of Computational Machinery, 44 (4) 615-631. - * - * 2) Anthony, M., and P. L. Bartlett (1999): Artificial Neural Network Learning - Theoretical Foundations, - * Cambridge University Press, Cambridge, UK. - * - * 3) Kearns, M. J., R. E. Schapire, and L. M. Sellie (1994): Towards Efficient Agnostic Learning, Machine - * Learning, 17 (2) 115-141. - * - * 4) Lee, W. S., P. L. Bartlett, and R. C. Williamson (1998): The Importance of Convexity in Learning with - * Squared Loss, IEEE Transactions on Information Theory, 44 1974-1980. - * - * 5) Vapnik, V. N. (1998): Statistical Learning Theory, Wiley, New York. - * - * @author Lakshmi Krishnamurthy - */ - -public class RegularizerR1ContinuousToR1Continuous extends - org.drip.spaces.rxtor1.NormedR1ContinuousToR1Continuous implements - org.drip.learning.regularization.RegularizerR1ToR1 { - private double _dblLambda = java.lang.Double.NaN; - - /** - * RegularizerR1ContinuousToR1Continuous Function Space Constructor - * - * @param funcRegularizerR1ToR1 The R^1 To R^1 Regularizer Function - * @param r1ContinuousInput The Continuous R^1 Input Metric Vector Space - * @param r1ContinuousOutput The Continuous R^1 Output Metric Vector Space - * @param dblLambda The Regularization Lambda - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public RegularizerR1ContinuousToR1Continuous ( - final org.drip.function.definition.R1ToR1 funcRegularizerR1ToR1, - final org.drip.spaces.metric.R1Continuous r1ContinuousInput, - final org.drip.spaces.metric.R1Continuous r1ContinuousOutput, - final double dblLambda) - throws java.lang.Exception - { - super (r1ContinuousInput, r1ContinuousOutput, funcRegularizerR1ToR1); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblLambda = dblLambda) || 0 > _dblLambda) - throw new java.lang.Exception - ("RegularizerR1ContinuousToR1Continuous Constructor => Invalid Inputs"); - } - - @Override public double lambda() - { - return _dblLambda; - } - - @Override public double structuralLoss ( - final org.drip.function.definition.R1ToR1 funcR1ToR1, - final double[] adblX) - throws java.lang.Exception - { - if (null == funcR1ToR1 || null == adblX) - throw new java.lang.Exception - ("RegularizerR1ContinuousToR1Continuous::structuralLoss => Invalid Inputs"); - - double dblLoss = 0.; - int iNumSample = adblX.length; - - if (0 == iNumSample) - throw new java.lang.Exception - ("RegularizerR1ContinuousToR1Continuous::structuralLoss => Invalid Inputs"); - - org.drip.function.definition.R1ToR1 funcRegularizerR1ToR1 = function(); - - int iPNorm = outputMetricVectorSpace().pNorm(); - - if (java.lang.Integer.MAX_VALUE == iPNorm) { - double dblSupremum = 0.; - - for (int i = 0; i < iNumSample; ++i) { - double dblNodeValue = java.lang.Math.abs (funcRegularizerR1ToR1.evaluate (adblX[i]) * - funcR1ToR1.evaluate (adblX[i])); - - if (dblSupremum < dblNodeValue) dblSupremum = dblNodeValue; - } - - return dblSupremum; - } - - for (int i = 0; i < iNumSample; ++i) - dblLoss += java.lang.Math.pow (java.lang.Math.abs (funcRegularizerR1ToR1.evaluate (adblX[i]) * - funcR1ToR1.evaluate (adblX[i])), iPNorm); - - return dblLoss / iPNorm; - } - - @Override public double structuralRisk ( - final org.drip.measure.continuousjoint.R1R1 distR1R1, - final org.drip.function.definition.R1ToR1 funcR1ToR1, - final double[] adblX, - final double[] adblY) - throws java.lang.Exception - { - if (null == funcR1ToR1 || null == adblX || null == adblY) - throw new java.lang.Exception - ("RegularizerR1ContinuousToR1Continuous::structuralRisk => Invalid Inputs"); - - double dblLoss = 0.; - double dblNormalizer = 0.; - int iNumSample = adblX.length; - - if (0 == iNumSample || iNumSample != adblY.length) - throw new java.lang.Exception - ("RegularizerR1ContinuousToR1Continuous::structuralRisk => Invalid Inputs"); - - int iPNorm = outputMetricVectorSpace().pNorm(); - - org.drip.function.definition.R1ToR1 funcRegularizerR1ToR1 = function(); - - if (java.lang.Integer.MAX_VALUE == iPNorm) { - double dblWeightedSupremum = 0.; - double dblSupremumNodeValue = 0.; - - for (int i = 0; i < iNumSample; ++i) { - double dblNodeValue = java.lang.Math.abs (funcRegularizerR1ToR1.evaluate (adblX[i]) * - funcR1ToR1.evaluate (adblX[i])); - - double dblWeightedNodeValue = distR1R1.density (adblX[i], adblY[i]) * dblNodeValue; - - if (dblWeightedNodeValue > dblWeightedSupremum) { - dblSupremumNodeValue = dblNodeValue; - dblWeightedSupremum = dblWeightedNodeValue; - } - } - - return dblSupremumNodeValue; - } - - for (int i = 0; i < iNumSample; ++i) { - double dblDensity = distR1R1.density (adblX[i], adblY[i]); - - dblNormalizer += dblDensity; - - dblLoss += dblDensity * java.lang.Math.pow (java.lang.Math.abs (funcRegularizerR1ToR1.evaluate - (adblX[i]) * funcR1ToR1.evaluate (adblX[i])), iPNorm); - } - - return dblLoss / iPNorm / dblNormalizer; - } -} diff --git a/org/drip/learning/regularization/RegularizerR1ToR1.java b/org/drip/learning/regularization/RegularizerR1ToR1.java deleted file mode 100644 index ea2aebc..0000000 --- a/org/drip/learning/regularization/RegularizerR1ToR1.java +++ /dev/null @@ -1,119 +0,0 @@ - -package org.drip.learning.regularization; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RegularizerR1ToR1 exposes the Structural Loss and Risk Calculations for the specified Normed R^1 To Normed - * R^1 Learning Function. - * - * The References are: - * - * 1) Alon, N., S. Ben-David, N. Cesa Bianchi, and D. Haussler (1997): Scale-sensitive Dimensions, Uniform - * Convergence, and Learnability, Journal of Association of Computational Machinery, 44 (4) 615-631. - * - * 2) Anthony, M., and P. L. Bartlett (1999): Artificial Neural Network Learning - Theoretical Foundations, - * Cambridge University Press, Cambridge, UK. - * - * 3) Kearns, M. J., R. E. Schapire, and L. M. Sellie (1994): Towards Efficient Agnostic Learning, Machine - * Learning, 17 (2) 115-141. - * - * 4) Lee, W. S., P. L. Bartlett, and R. C. Williamson (1998): The Importance of Convexity in Learning with - * Squared Loss, IEEE Transactions on Information Theory, 44 1974-1980. - * - * 5) Vapnik, V. N. (1998): Statistical Learning Theory, Wiley, New York. - * - * @author Lakshmi Krishnamurthy - */ - -public interface RegularizerR1ToR1 { - - /** - * Retrieve the Regularization Constant Lambda - * - * @return The Regularization Constant Lambda - */ - - public abstract double lambda(); - - /** - * Compute the Regularization Sample Structural Loss - * - * @param funcR1ToR1 R^1 To R^1 Function Instance - * @param adblX The Predictor Instance - * - * @return The Regularization Sample Structural Loss - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public abstract double structuralLoss ( - final org.drip.function.definition.R1ToR1 funcR1ToR1, - final double[] adblX) - throws java.lang.Exception; - - /** - * Compute the Regularization Sample Structural Loss - * - * @param distR1R1 R^1 R^1 Multivariate Measure - * @param funcR1ToR1 R^1 To R^1 Function Instance - * @param adblX The Predictor Instance - * @param adblY The Response Instance - * - * @return The Regularization Sample Structural Loss - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public abstract double structuralRisk ( - final org.drip.measure.continuousjoint.R1R1 distR1R1, - final org.drip.function.definition.R1ToR1 funcR1ToR1, - final double[] adblX, - final double[] adblY) - throws java.lang.Exception; -} diff --git a/org/drip/learning/regularization/RegularizerRdCombinatorialToR1Continuous.java b/org/drip/learning/regularization/RegularizerRdCombinatorialToR1Continuous.java deleted file mode 100644 index 28890f3..0000000 --- a/org/drip/learning/regularization/RegularizerRdCombinatorialToR1Continuous.java +++ /dev/null @@ -1,201 +0,0 @@ - -package org.drip.learning.regularization; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RegularizerRdCombinatorialToR1Continuous computes the Structural Loss and Risk for the specified Normed - * R^d Combinatorial To Normed R^1 Continuous Learning Function. - * - * The References are: - * - * 1) Alon, N., S. Ben-David, N. Cesa Bianchi, and D. Haussler (1997): Scale-sensitive Dimensions, Uniform - * Convergence, and Learnability, Journal of Association of Computational Machinery, 44 (4) 615-631. - * - * 2) Anthony, M., and P. L. Bartlett (1999): Artificial Neural Network Learning - Theoretical Foundations, - * Cambridge University Press, Cambridge, UK. - * - * 3) Kearns, M. J., R. E. Schapire, and L. M. Sellie (1994): Towards Efficient Agnostic Learning, Machine - * Learning, 17 (2) 115-141. - * - * 4) Lee, W. S., P. L. Bartlett, and R. C. Williamson (1998): The Importance of Convexity in Learning with - * Squared Loss, IEEE Transactions on Information Theory, 44 1974-1980. - * - * 5) Vapnik, V. N. (1998): Statistical Learning Theory, Wiley, New York. - * - * @author Lakshmi Krishnamurthy - */ - -public class RegularizerRdCombinatorialToR1Continuous extends - org.drip.spaces.rxtor1.NormedRdCombinatorialToR1Continuous implements - org.drip.learning.regularization.RegularizerRdToR1 { - private double _dblLambda = java.lang.Double.NaN; - - /** - * RegularizerRdCombinatorialToR1Continuous Function Space Constructor - * - * @param funcRegularizerRdToR1 The R^d To R^1 Regularizer Function - * @param rdCombinatorialInput The Combinatorial R^d Input Metric Vector Space - * @param r1ContinuousOutput The Continuous R^1 Output Metric Vector Space - * @param dblLambda The Regularization Lambda - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public RegularizerRdCombinatorialToR1Continuous ( - final org.drip.function.definition.RdToR1 funcRegularizerRdToR1, - final org.drip.spaces.metric.RdCombinatorialBanach rdCombinatorialInput, - final org.drip.spaces.metric.R1Continuous r1ContinuousOutput, - final double dblLambda) - throws java.lang.Exception - { - super (rdCombinatorialInput, r1ContinuousOutput, funcRegularizerRdToR1); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblLambda = dblLambda) || 0 > _dblLambda) - throw new java.lang.Exception - ("RegularizerRdCombinatorialToR1Continuous Constructor => Invalid Inputs"); - } - - @Override public double lambda() - { - return _dblLambda; - } - - @Override public double structuralLoss ( - final org.drip.function.definition.RdToR1 funcRdToR1, - final double[][] aadblX) - throws java.lang.Exception - { - if (null == funcRdToR1 || null == aadblX) - throw new java.lang.Exception - ("RegularizerRdCombinatorialToR1Continuous::structuralLoss => Invalid Inputs"); - - double dblLoss = 0.; - int iNumSample = aadblX.length; - - if (0 == iNumSample) - throw new java.lang.Exception - ("RegularizerRdCombinatorialToR1Continuous::structuralLoss => Invalid Inputs"); - - int iPNorm = outputMetricVectorSpace().pNorm(); - - org.drip.function.definition.RdToR1 funcRegularizerRdToR1 = function(); - - if (java.lang.Integer.MAX_VALUE == iPNorm) { - double dblSupremum = 0.; - - for (int i = 0; i < iNumSample; ++i) { - double dblRegularizedValue = java.lang.Math.abs (funcRegularizerRdToR1.evaluate (aadblX[i]) * - funcRdToR1.evaluate (aadblX[i])); - - if (dblSupremum < dblRegularizedValue) dblSupremum = dblRegularizedValue; - } - - return dblSupremum; - } - - for (int i = 0; i < iNumSample; ++i) - dblLoss += java.lang.Math.pow (java.lang.Math.abs (funcRegularizerRdToR1.evaluate (aadblX[i]) * - funcRdToR1.evaluate (aadblX[i])), iPNorm); - - return dblLoss / iPNorm; - } - - @Override public double structuralRisk ( - final org.drip.measure.continuousjoint.RdR1 distRdR1, - final org.drip.function.definition.RdToR1 funcRdToR1, - final double[][] aadblX, - final double[] adblY) - throws java.lang.Exception - { - if (null == funcRdToR1 || null == aadblX || null == adblY) - throw new java.lang.Exception - ("RegularizerRdCombinatorialToR1Continuous::structuralRisk => Invalid Inputs"); - - double dblLoss = 0.; - double dblNormalizer = 0.; - int iNumSample = aadblX.length; - - if (0 == iNumSample || iNumSample != adblY.length) - throw new java.lang.Exception - ("RegularizerRdCombinatorialToR1Continuous::structuralRisk => Invalid Inputs"); - - int iPNorm = outputMetricVectorSpace().pNorm(); - - org.drip.function.definition.RdToR1 funcRegularizerRdToR1 = function(); - - if (java.lang.Integer.MAX_VALUE == iPNorm) { - double dblSupremumDensity = 0.; - double dblSupremumNodeValue = 0.; - - for (int i = 0; i < iNumSample; ++i) { - double dblDensity = distRdR1.density (aadblX[i], adblY[i]); - - if (dblDensity > dblSupremumDensity) { - dblSupremumDensity = dblDensity; - - dblSupremumNodeValue = java.lang.Math.abs (funcRegularizerRdToR1.evaluate (aadblX[i]) * - funcRdToR1.evaluate (aadblX[i])); - } - } - - return dblSupremumNodeValue; - } - - for (int i = 0; i < iNumSample; ++i) { - double dblDensity = distRdR1.density (aadblX[i], adblY[i]); - - dblNormalizer += dblDensity; - - dblLoss += dblDensity * java.lang.Math.pow (java.lang.Math.abs (funcRegularizerRdToR1.evaluate - (aadblX[i]) * funcRdToR1.evaluate (aadblX[i])), iPNorm); - } - - return dblLoss / iPNorm / dblNormalizer; - } -} diff --git a/org/drip/learning/regularization/RegularizerRdContinuousToR1Continuous.java b/org/drip/learning/regularization/RegularizerRdContinuousToR1Continuous.java deleted file mode 100644 index 2974d30..0000000 --- a/org/drip/learning/regularization/RegularizerRdContinuousToR1Continuous.java +++ /dev/null @@ -1,201 +0,0 @@ - -package org.drip.learning.regularization; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RegularizerRdContinuousToR1Continuous computes the Structural Loss and Risk for the specified Normed R^d - * Continuous To Normed R^1 Continuous Learning Function. - * - * The References are: - * - * 1) Alon, N., S. Ben-David, N. Cesa Bianchi, and D. Haussler (1997): Scale-sensitive Dimensions, Uniform - * Convergence, and Learnability, Journal of Association of Computational Machinery, 44 (4) 615-631. - * - * 2) Anthony, M., and P. L. Bartlett (1999): Artificial Neural Network Learning - Theoretical Foundations, - * Cambridge University Press, Cambridge, UK. - * - * 3) Kearns, M. J., R. E. Schapire, and L. M. Sellie (1994): Towards Efficient Agnostic Learning, Machine - * Learning, 17 (2) 115-141. - * - * 4) Lee, W. S., P. L. Bartlett, and R. C. Williamson (1998): The Importance of Convexity in Learning with - * Squared Loss, IEEE Transactions on Information Theory, 44 1974-1980. - * - * 5) Vapnik, V. N. (1998): Statistical Learning Theory, Wiley, New York. - * - * @author Lakshmi Krishnamurthy - */ - -public class RegularizerRdContinuousToR1Continuous extends - org.drip.spaces.rxtor1.NormedRdContinuousToR1Continuous implements - org.drip.learning.regularization.RegularizerRdToR1 { - private double _dblLambda = java.lang.Double.NaN; - - /** - * RegularizerRdContinuousToR1Continuous Function Space Constructor - * - * @param funcRdToR1 The R^d To R^1 Function - * @param rdContinuousInput The Continuous R^d Input Metric Vector Space - * @param r1ContinuousOutput The Continuous R^1 Output Metric Vector Space - * @param dblLambda The Regularization Lambda - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public RegularizerRdContinuousToR1Continuous ( - final org.drip.function.definition.RdToR1 funcRdToR1, - final org.drip.spaces.metric.RdContinuousBanach rdContinuousInput, - final org.drip.spaces.metric.R1Continuous r1ContinuousOutput, - final double dblLambda) - throws java.lang.Exception - { - super (rdContinuousInput, r1ContinuousOutput, funcRdToR1); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblLambda = dblLambda) || 0 > _dblLambda) - throw new java.lang.Exception - ("RegularizerRdContinuousToR1Continuous Constructor => Invalid Inputs"); - } - - @Override public double lambda() - { - return _dblLambda; - } - - @Override public double structuralLoss ( - final org.drip.function.definition.RdToR1 funcRdToR1, - final double[][] aadblX) - throws java.lang.Exception - { - if (null == funcRdToR1 || null == aadblX) - throw new java.lang.Exception - ("RegularizerRdContinuousToR1Continuous::structuralLoss => Invalid Inputs"); - - double dblLoss = 0.; - int iNumSample = aadblX.length; - - if (0 == iNumSample) - throw new java.lang.Exception - ("RegularizerRdContinuousToR1Continuous::structuralLoss => Invalid Inputs"); - - int iPNorm = outputMetricVectorSpace().pNorm(); - - org.drip.function.definition.RdToR1 funcRegularizerRdToR1 = function(); - - if (java.lang.Integer.MAX_VALUE == iPNorm) { - double dblSupremum = 0.; - - for (int i = 0; i < iNumSample; ++i) { - double dblRegularizedValue = java.lang.Math.abs (funcRegularizerRdToR1.evaluate (aadblX[i]) * - funcRdToR1.evaluate (aadblX[i])); - - if (dblSupremum < dblRegularizedValue) dblSupremum = dblRegularizedValue; - } - - return dblSupremum; - } - - for (int i = 0; i < iNumSample; ++i) - dblLoss += java.lang.Math.pow (java.lang.Math.abs (funcRegularizerRdToR1.evaluate (aadblX[i]) * - funcRdToR1.evaluate (aadblX[i])), iPNorm); - - return dblLoss / iPNorm; - } - - @Override public double structuralRisk ( - final org.drip.measure.continuousjoint.RdR1 distRdR1, - final org.drip.function.definition.RdToR1 funcRdToR1, - final double[][] aadblX, - final double[] adblY) - throws java.lang.Exception - { - if (null == funcRdToR1 || null == aadblX || null == adblY) - throw new java.lang.Exception - ("RegularizerRdContinuousToR1Continuous::structuralRisk => Invalid Inputs"); - - double dblLoss = 0.; - double dblNormalizer = 0.; - int iNumSample = aadblX.length; - - if (0 == iNumSample || iNumSample != adblY.length) - throw new java.lang.Exception - ("RegularizerRdContinuousToR1Continuous::structuralRisk => Invalid Inputs"); - - int iPNorm = outputMetricVectorSpace().pNorm(); - - org.drip.function.definition.RdToR1 funcRegularizerRdToR1 = function(); - - if (java.lang.Integer.MAX_VALUE == iPNorm) { - double dblSupremumDensity = 0.; - double dblSupremumNodeValue = 0.; - - for (int i = 0; i < iNumSample; ++i) { - double dblDensity = distRdR1.density (aadblX[i], adblY[i]); - - if (dblDensity > dblSupremumDensity) { - dblSupremumDensity = dblDensity; - - dblSupremumNodeValue = java.lang.Math.abs (funcRegularizerRdToR1.evaluate (aadblX[i]) * - funcRdToR1.evaluate (aadblX[i])); - } - } - - return dblSupremumNodeValue; - } - - for (int i = 0; i < iNumSample; ++i) { - double dblDensity = distRdR1.density (aadblX[i], adblY[i]); - - dblNormalizer += dblDensity; - - dblLoss += dblDensity * java.lang.Math.pow (java.lang.Math.abs (funcRegularizerRdToR1.evaluate - (aadblX[i]) * funcRdToR1.evaluate (aadblX[i])), iPNorm); - } - - return dblLoss / iPNorm / dblNormalizer; - } -} diff --git a/org/drip/learning/regularization/RegularizerRdToR1.java b/org/drip/learning/regularization/RegularizerRdToR1.java deleted file mode 100644 index 523594e..0000000 --- a/org/drip/learning/regularization/RegularizerRdToR1.java +++ /dev/null @@ -1,119 +0,0 @@ - -package org.drip.learning.regularization; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RegularizerRdxToR1 exposes the Structural Loss and Risk Calculations for the specified Normed R^d To Normed - * R^1 Learning Function. - * - * The References are: - * - * 1) Alon, N., S. Ben-David, N. Cesa Bianchi, and D. Haussler (1997): Scale-sensitive Dimensions, Uniform - * Convergence, and Learnability, Journal of Association of Computational Machinery, 44 (4) 615-631. - * - * 2) Anthony, M., and P. L. Bartlett (1999): Artificial Neural Network Learning - Theoretical Foundations, - * Cambridge University Press, Cambridge, UK. - * - * 3) Kearns, M. J., R. E. Schapire, and L. M. Sellie (1994): Towards Efficient Agnostic Learning, Machine - * Learning, 17 (2) 115-141. - * - * 4) Lee, W. S., P. L. Bartlett, and R. C. Williamson (1998): The Importance of Convexity in Learning with - * Squared Loss, IEEE Transactions on Information Theory, 44 1974-1980. - * - * 5) Vapnik, V. N. (1998): Statistical Learning Theory, Wiley, New York. - * - * @author Lakshmi Krishnamurthy - */ - -public interface RegularizerRdToR1 { - - /** - * Retrieve the Regularization Constant Lambda - * - * @return The Regularization Constant Lambda - */ - - public abstract double lambda(); - - /** - * Compute the Regularization Sample Structural Loss - * - * @param funcRdToR1 R^d To R^1 Function Instance - * @param aadblX The Sample Instance - * - * @return The Regularization Sample Structural Loss - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public abstract double structuralLoss ( - final org.drip.function.definition.RdToR1 funcRdToR1, - final double[][] aadblX) - throws java.lang.Exception; - - /** - * Compute the Regularization Sample Structural Loss - * - * @param distRdR1 R^d R^1 Multivariate Measure - * @param funcRdToR1 R^d To R^1 Function Instance - * @param aadblX The Sample Instance - * @param adblY The Response Instance - * - * @return The Regularization Sample Structural Loss - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public abstract double structuralRisk ( - final org.drip.measure.continuousjoint.RdR1 distRdR1, - final org.drip.function.definition.RdToR1 funcRdToR1, - final double[][] aadblX, - final double[] adblY) - throws java.lang.Exception; -} diff --git a/org/drip/learning/rxtor1/ApproximateLipschitzLossLearner.java b/org/drip/learning/rxtor1/ApproximateLipschitzLossLearner.java deleted file mode 100644 index 2b1c426..0000000 --- a/org/drip/learning/rxtor1/ApproximateLipschitzLossLearner.java +++ /dev/null @@ -1,129 +0,0 @@ - -package org.drip.learning.rxtor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ApproximateLipschitzLossLearner implements the Learner Class that holds the Space of Normed R^d To Normed - * R^1 Learning Functions for the Family of Loss Functions that are "approximately" Lipschitz, i.e., - * - * loss (ep) - loss (ep') Less Than max (C * |ep-ep'|, C') - * - * The References are: - * - * 1) Alon, N., S. Ben-David, N. Cesa Bianchi, and D. Haussler (1997): Scale-sensitive Dimensions, Uniform - * Convergence, and Learnability, Journal of Association of Computational Machinery, 44 (4) 615-631. - * - * 2) Anthony, M., and P. L. Bartlett (1999): Artificial Neural Network Learning - Theoretical Foundations, - * Cambridge University Press, Cambridge, UK. - * - * 3) Kearns, M. J., R. E. Schapire, and L. M. Sellie (1994): Towards Efficient Agnostic Learning, Machine - * Learning, 17 (2) 115-141. - * - * 4) Lee, W. S., P. L. Bartlett, and R. C. Williamson (1998): The Importance of Convexity in Learning with - * Squared Loss, IEEE Transactions on Information Theory, 44 1974-1980. - * - * 5) Vapnik, V. N. (1998): Statistical learning Theory, Wiley, New York. - * - * @author Lakshmi Krishnamurthy - */ - -public class ApproximateLipschitzLossLearner extends org.drip.learning.rxtor1.LipschitzLossLearner { - private double _dblLipschitzFloor = java.lang.Double.NaN; - - /** - * ApproximateLipschitzLossLearner Constructor - * - * @param funcClassRxToR1 R^x To R^1 Function Class - * @param cdpb The Covering Number based Deviation Upper Probability Bound Generator - * @param regularizerFunc The Regularizer Function - * @param dblLipschitzSlope The Lipschitz Slope Bound - * @param dblLipschitzFloor The Lipschitz Floor Bound - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ApproximateLipschitzLossLearner ( - final org.drip.spaces.functionclass.NormedRxToNormedR1Finite funcClassRxToR1, - final org.drip.learning.bound.CoveringNumberLossBound cdpb, - final org.drip.learning.regularization.RegularizationFunction regularizerFunc, - final double dblLipschitzSlope, - final double dblLipschitzFloor) - throws java.lang.Exception - { - super (funcClassRxToR1, cdpb, regularizerFunc, dblLipschitzSlope); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblLipschitzFloor = dblLipschitzFloor)) - throw new java.lang.Exception ("ApproximateLipschitzLossLearner ctr: Invalid Inputs"); - } - - /** - * Retrieve the Lipschitz Floor - * - * @return The Lipschitz Floor - */ - - public double lipschitzFloor() - { - return _dblLipschitzFloor; - } - - @Override public double lossSampleCoveringNumber ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi, - final double dblEpsilon, - final boolean bSupremum) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblEpsilon) || dblEpsilon <= (_dblLipschitzFloor / - lipschitzSlope())) - throw new java.lang.Exception - ("ApproximateLipschitzLossLearner::lossSampleCoveringNumber => Invalid Inputs"); - - return super.lossSampleCoveringNumber (gvvi, dblEpsilon, bSupremum); - } -} diff --git a/org/drip/learning/rxtor1/EmpiricalLearningMetricEstimator.java b/org/drip/learning/rxtor1/EmpiricalLearningMetricEstimator.java deleted file mode 100644 index 540ee62..0000000 --- a/org/drip/learning/rxtor1/EmpiricalLearningMetricEstimator.java +++ /dev/null @@ -1,487 +0,0 @@ - -package org.drip.learning.rxtor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * EmpiricalLearningMetricEstimator is the Estimator of the Empirical Loss and Risk, as well as the - * corresponding Covering Numbers. - * - * The References are: - * - * 1) Alon, N., S. Ben-David, N. Cesa Bianchi, and D. Haussler (1997): Scale-sensitive Dimensions, Uniform - * Convergence, and Learnability, Journal of Association of Computational Machinery, 44 (4) 615-631. - * - * 2) Anthony, M., and P. L. Bartlett (1999): Artificial Neural Network Learning - Theoretical Foundations, - * Cambridge University Press, Cambridge, UK. - * - * 3) Kearns, M. J., R. E. Schapire, and L. M. Sellie (1994): Towards Efficient Agnostic Learning, Machine - * Learning, 17 (2) 115-141. - * - * 4) Lee, W. S., P. L. Bartlett, and R. C. Williamson (1998): The Importance of Convexity in Learning with - * Squared Loss, IEEE Transactions on Information Theory, 44 1974-1980. - * - * 5) Vapnik, V. N. (1998): Statistical Learning Theory, Wiley, New York. - * - * @author Lakshmi Krishnamurthy - */ - -public interface EmpiricalLearningMetricEstimator { - - /** - * Retrieve the Underlying Learner Function Class - * - * @return The Underlying Learner Function Class - */ - - public abstract org.drip.spaces.functionclass.NormedRxToNormedR1Finite functionClass(); - - /** - * Retrieve the Regularizer Function - * - * @return The Regularizer Function - */ - - public abstract org.drip.learning.regularization.RegularizationFunction regularizerFunction(); - - /** - * Retrieve the Loss Class Sample Covering Number - L-Infinity or L-p based Based - * - * @param gvvi The Validated Instance Vector Sequence - * @param dblEpsilon The Deviation of the Empirical Mean from the Population Mean - * @param bSupremum TRUE To Use the Supremum Metric in place of the Built-in Metric - * - * @return The Loss Class Sample Covering Number - L-Infinity or L-p based Based - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public abstract double lossSampleCoveringNumber ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi, - final double dblEpsilon, - final boolean bSupremum) - throws java.lang.Exception; - - /** - * Compute the Empirical Sample Loss - * - * @param funcLearnerR1ToR1 The R^1 To R^1 Learner Function - * @param gvviX The Validated Predictor Instance - * @param gvviY The Validated Response Instance - * - * @return The Empirical Loss - * - * @throws java.lang.Exception Thrown if the Empirical Loss cannot be computed - */ - - public abstract double empiricalLoss ( - final org.drip.function.definition.R1ToR1 funcLearnerR1ToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception; - - /** - * Compute the Empirical Sample Loss - * - * @param funcLearnerRdToR1 The R^d To R^1 Learner Function - * @param gvviX The Validated Predictor Instance - * @param gvviY The Validated Response Instance - * - * @return The Empirical Loss - * - * @throws java.lang.Exception Thrown if the Empirical Loss cannot be computed - */ - - public abstract double empiricalLoss ( - final org.drip.function.definition.RdToR1 funcLearnerRdToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception; - - /** - * Compute the Supremum Empirical Sample Loss - * - * @param gvviX The Validated Predictor Instance - * @param gvviY The Validated Response Instance - * - * @return The Supremum Empirical Sample Loss - * - * @throws java.lang.Exception Thrown if the Supremum Empirical Sample Loss cannot be computed - */ - - public abstract org.drip.learning.rxtor1.EmpiricalPenaltySupremum supremumEmpiricalLoss ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception; - - /** - * Compute the Structural Sample Loss - * - * @param funcLearnerR1ToR1 The R^1 To R^1 Learner Function - * @param gvvi The Validated Predictor Instance - * - * @return The Structural Loss - * - * @throws java.lang.Exception Thrown if the Structural Loss cannot be computed - */ - - public abstract double structuralLoss ( - final org.drip.function.definition.R1ToR1 funcLearnerR1ToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi) - throws java.lang.Exception; - - /** - * Compute the Structural Sample Loss - * - * @param funcLearnerRdToR1 The R^d To R^1 Learner Function - * @param gvvi The Validated Predictor Instance - * - * @return The Structural Loss - * - * @throws java.lang.Exception Thrown if the Structural Loss cannot be computed - */ - - public abstract double structuralLoss ( - final org.drip.function.definition.RdToR1 funcLearnerRdToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi) - throws java.lang.Exception; - - /** - * Compute the Supremum Structural Sample Loss - * - * @param gvviX The Validated Predictor Instance - * - * @return The Supremum Structural Sample Loss - * - * @throws java.lang.Exception Thrown if the Supremum Structural Sample Loss cannot be computed - */ - - public abstract org.drip.learning.rxtor1.EmpiricalPenaltySupremum supremumStructuralLoss ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX) - throws java.lang.Exception; - - /** - * Compute the Regularized Sample Loss (Empirical + Structural) - * - * @param funcLearnerR1ToR1 The R^1 To R^1 Learner Function - * @param gvviX The Validated Predictor Instance - * @param gvviY The Validated Response Instance - * - * @return The Regularized Loss - * - * @throws java.lang.Exception Thrown if the Regularized Loss cannot be computed - */ - - public abstract double regularizedLoss ( - final org.drip.function.definition.R1ToR1 funcLearnerR1ToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception; - - /** - * Compute the Regularized Sample Loss (Empirical + Structural) - * - * @param funcLearnerRdToR1 The R^d To R^1 Learner Function - * @param gvviX The Validated Predictor Instance - * @param gvviY The Validated Response Instance - * - * @return The Regularized Loss - * - * @throws java.lang.Exception Thrown if the Regularized Loss cannot be computed - */ - - public abstract double regularizedLoss ( - final org.drip.function.definition.RdToR1 funcLearnerRdToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception; - - /** - * Compute the Supremum Regularized Sample Loss - * - * @param gvviX The Validated Predictor Instance - * @param gvviY The Validated Response Instance - * - * @return The Supremum Regularized Sample Loss - * - * @throws java.lang.Exception Thrown if the Supremum Regularized Sample Loss cannot be computed - */ - - public abstract org.drip.learning.rxtor1.EmpiricalPenaltySupremum supremumRegularizedLoss ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception; - - /** - * Compute the Empirical Sample Risk - * - * @param distR1R1 R^1 R^1 Multivariate Measure - * @param funcLearnerR1ToR1 The R^1 To R^1 Learner Function - * @param gvviX The Validated Predictor Instance - * @param gvviY The Validated Response Instance - * - * @return The Empirical Sample Risk - * - * @throws java.lang.Exception Thrown if the Empirical Sample Risk cannot be computed - */ - - public abstract double empiricalRisk ( - final org.drip.measure.continuousjoint.R1R1 distR1R1, - final org.drip.function.definition.R1ToR1 funcLearnerR1ToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception; - - /** - * Compute the Empirical Sample Risk - * - * @param distRdR1 R^d R^1 Multivariate Measure - * @param funcLearnerRdToR1 The R^d To R^1 Learner Function - * @param gvviX The Validated Predictor Instance - * @param gvviY The Validated Response Instance - * - * @return The Empirical Sample Risk - * - * @throws java.lang.Exception Thrown if the Empirical Sample Risk cannot be computed - */ - - public abstract double empiricalRisk ( - final org.drip.measure.continuousjoint.RdR1 distRdR1, - final org.drip.function.definition.RdToR1 funcLearnerRdToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception; - - /** - * Compute the Supremum Empirical Sample Risk - * - * @param distR1R1 R^1 R^1 Multivariate Measure - * @param gvviX The Validated Predictor Instance - * @param gvviY The Validated Response Instance - * - * @return The Supremum Empirical Sample Loss - * - * @throws java.lang.Exception Thrown if the Supremum Empirical Sample Loss cannot be computed - */ - - public abstract org.drip.learning.rxtor1.EmpiricalPenaltySupremum supremumEmpiricalRisk ( - final org.drip.measure.continuousjoint.R1R1 distR1R1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception; - - /** - * Compute the Supremum Empirical Sample Risk - * - * @param distRdR1 R^d R^1 Multivariate Measure - * @param gvviX The Validated Predictor Instance - * @param gvviY The Validated Response Instance - * - * @return The Supremum Empirical Sample Loss - * - * @throws java.lang.Exception Thrown if the Supremum Empirical Sample Loss cannot be computed - */ - - public abstract org.drip.learning.rxtor1.EmpiricalPenaltySupremum supremumEmpiricalRisk ( - final org.drip.measure.continuousjoint.RdR1 distRdR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception; - - /** - * Compute the Structural Sample Risk - * - * @param distR1R1 R^1 R^1 Multivariate Measure - * @param funcLearnerR1ToR1 The R^1 To R^1 Learner Function - * @param gvviX The Validated Predictor Instance - * @param gvviY The Validated Response Instance - * - * @return The Structural Risk - * - * @throws java.lang.Exception Thrown if the Structural Risk cannot be computed - */ - - public abstract double structuralRisk ( - final org.drip.measure.continuousjoint.R1R1 distR1R1, - final org.drip.function.definition.R1ToR1 funcLearnerR1ToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception; - - /** - * Compute the Structural Sample Risk - * - * @param distRdR1 R^d R^1 Multivariate Measure - * @param funcLearnerRdToR1 The R^d To R^1 Learner Function - * @param gvviX The Validated Predictor Instance - * @param gvviY The Validated Response Instance - * - * @return The Structural Risk - * - * @throws java.lang.Exception Thrown if the Structural Risk cannot be computed - */ - - public abstract double structuralRisk ( - final org.drip.measure.continuousjoint.RdR1 distRdR1, - final org.drip.function.definition.RdToR1 funcLearnerRdToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception; - - /** - * Compute the Supremum Structural Sample Risk - * - * @param distR1R1 R^1 R^1 Multivariate Measure - * @param gvviX The Validated Predictor Instance - * @param gvviY The Validated Response Instance - * - * @return The Supremum Structural Sample Loss - * - * @throws java.lang.Exception Thrown if the Supremum Structural Sample Risk cannot be computed - */ - - public abstract org.drip.learning.rxtor1.EmpiricalPenaltySupremum supremumStructuralRisk ( - final org.drip.measure.continuousjoint.R1R1 distR1R1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception; - - /** - * Compute the Supremum Structural Sample Risk - * - * @param distRdR1 R^d R^1 Multivariate Measure - * @param gvviX The Validated Predictor Instance - * @param gvviY The Validated Response Instance - * - * @return The Supremum Structural Sample Risk - * - * @throws java.lang.Exception Thrown if the Supremum Structural Sample Risk cannot be computed - */ - - public abstract org.drip.learning.rxtor1.EmpiricalPenaltySupremum supremumStructuralRisk ( - final org.drip.measure.continuousjoint.RdR1 distRdR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception; - - /** - * Compute the Regularized Sample Risk (Empirical + Structural) - * - * @param distR1R1 R^1 R^1 Multivariate Measure - * @param funcLearnerR1ToR1 The R^1 To R^1 Learner Function - * @param gvviX The Validated Predictor Instance - * @param gvviY The Validated Response Instance - * - * @return The Regularized Sample Risk - * - * @throws java.lang.Exception Thrown if the Regularized Sample Risk cannot be computed - */ - - public abstract double regularizedRisk ( - final org.drip.measure.continuousjoint.R1R1 distR1R1, - final org.drip.function.definition.R1ToR1 funcLearnerR1ToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception; - - /** - * Compute the Regularized Sample Risk (Empirical + Structural) - * - * @param distRdR1 R^d R^1 Multivariate Measure - * @param funcLearnerRdToR1 The R^d To R^1 Learner Function - * @param gvviX The Validated Predictor Instance - * @param gvviY The Validated Response Instance - * - * @return The Regularized Sample Risk - * - * @throws java.lang.Exception Thrown if the Regularized Sample Risk cannot be computed - */ - - public abstract double regularizedRisk ( - final org.drip.measure.continuousjoint.RdR1 distRdR1, - final org.drip.function.definition.RdToR1 funcLearnerRdToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception; - - /** - * Compute the Supremum Regularized Sample Risk - * - * @param distR1R1 R^1 R^1 Multivariate Measure - * @param gvviX The Validated Predictor Instance - * @param gvviY The Validated Response Instance - * - * @return The Supremum Regularized Sample Risk - * - * @throws java.lang.Exception Thrown if the Supremum Regularized Sample Risk cannot be computed - */ - - public abstract org.drip.learning.rxtor1.EmpiricalPenaltySupremum supremumRegularizedRisk ( - final org.drip.measure.continuousjoint.R1R1 distR1R1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception; - - /** - * Compute the Supremum Regularized Sample Risk - * - * @param distRdR1 R^d R^1 Multivariate Measure - * @param gvviX The Validated Predictor Instance - * @param gvviY The Validated Response Instance - * - * @return The Supremum Regularized Sample Risk - * - * @throws java.lang.Exception Thrown if the Supremum Regularized Sample Risk cannot be computed - */ - - public abstract org.drip.learning.rxtor1.EmpiricalPenaltySupremum supremumRegularizedRisk ( - final org.drip.measure.continuousjoint.RdR1 distRdR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception; -} diff --git a/org/drip/learning/rxtor1/EmpiricalPenaltySupremum.java b/org/drip/learning/rxtor1/EmpiricalPenaltySupremum.java deleted file mode 100644 index b4a3bf0..0000000 --- a/org/drip/learning/rxtor1/EmpiricalPenaltySupremum.java +++ /dev/null @@ -1,92 +0,0 @@ - -package org.drip.learning.rxtor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * EmpiricalPenaltySupremum holds the Learning Function that corresponds to the Empirical Supremum, as well - * as the corresponding Supremum Value. - * - * @author Lakshmi Krishnamurthy - */ - -public class EmpiricalPenaltySupremum { - private int _iIndex = -1; - private double _dblValue = java.lang.Double.NaN; - - public EmpiricalPenaltySupremum ( - final int iIndex, - final double dblValue) - throws java.lang.Exception - { - if (0 > (_iIndex = iIndex) || !org.drip.quant.common.NumberUtil.IsValid (_dblValue = dblValue)) - throw new java.lang.Exception ("EmpiricalPenaltySupremum Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Index of the Supremum Empirical Function - * - * @return The Index of the Supremum Empirical Function - */ - - public int index() - { - return _iIndex; - } - - /** - * Retrieve the Value of the Supremum Empirical Function - * - * @return The Value of the Supremum Empirical Function - */ - - public double value() - { - return _dblValue; - } -} diff --git a/org/drip/learning/rxtor1/EmpiricalPenaltySupremumEstimator.java b/org/drip/learning/rxtor1/EmpiricalPenaltySupremumEstimator.java deleted file mode 100644 index 7ad213d..0000000 --- a/org/drip/learning/rxtor1/EmpiricalPenaltySupremumEstimator.java +++ /dev/null @@ -1,422 +0,0 @@ - -package org.drip.learning.rxtor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * EmpiricalPenaltySupremumEstimator contains the Implementation of the Empirical Penalty Supremum Estimator - * dependent on Multivariate Random Variables where the Multivariate Function is a Linear Combination of - * Bounded Univariate Functions acting on each Random Variate. - * - * @author Lakshmi Krishnamurthy - */ - -public class EmpiricalPenaltySupremumEstimator extends org.drip.sequence.functional.BoundedMultivariateRandom { - - /** - * Supremum Penalty computed off of Empirical Loss - */ - - public static final int SUPREMUM_PENALTY_EMPIRICAL_LOSS = 1; - - /** - * Supremum Penalty computed off of Structural Loss - */ - - public static final int SUPREMUM_PENALTY_STRUCTURAL_LOSS = 2; - - /** - * Supremum Penalty computed off of Regularized Loss - */ - - public static final int SUPREMUM_PENALTY_REGULARIZED_LOSS = 4; - - /** - * Supremum Penalty computed off of Empirical Risk - */ - - public static final int SUPREMUM_PENALTY_EMPIRICAL_RISK = 8; - - /** - * Supremum Penalty computed off of Structural Risk - */ - - public static final int SUPREMUM_PENALTY_STRUCTURAL_RISK = 16; - - /** - * Supremum Penalty computed off of Regularized Risk - */ - - public static final int SUPREMUM_PENALTY_REGULARIZED_RISK = 32; - - private int _iSupremumPenaltyLossMode = -1; - private org.drip.measure.continuousjoint.R1R1 _distR1R1 = null; - private org.drip.measure.continuousjoint.RdR1 _distRdR1 = null; - private org.drip.spaces.rxtor1.NormedR1ToNormedR1[] _aR1ToR1 = null; - private org.drip.spaces.rxtor1.NormedRdToNormedR1[] _aRdToR1 = null; - private org.drip.spaces.instance.GeneralizedValidatedVector _gvviY = null; - private org.drip.learning.rxtor1.EmpiricalLearningMetricEstimator _elme = null; - - /** - * EmpiricalPenaltySupremumEstimator Constructor - * - * @param iSupremumPenaltyLossMode Supremum Loss Penalty Mode - * @param elme The Empirical Learning Metric Estimator Instance - * @param gvviY The Validated Outcome Instance - * @param distR1R1 R^1 R^1 Multivariate Measure - * @param distRdR1 R^d R^1 Multivariate Measure - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public EmpiricalPenaltySupremumEstimator ( - final int iSupremumPenaltyLossMode, - final org.drip.learning.rxtor1.EmpiricalLearningMetricEstimator elme, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY, - final org.drip.measure.continuousjoint.R1R1 distR1R1, - final org.drip.measure.continuousjoint.RdR1 distRdR1) - throws java.lang.Exception - { - if (null == (_elme = elme)) - throw new java.lang.Exception ("EmpiricalPenaltySupremumEstimator ctr: Invalid Inputs"); - - org.drip.spaces.rxtor1.NormedRxToNormedR1[] aRxToR1 = _elme.functionClass().functionSpaces(); - - if (null == aRxToR1) - throw new java.lang.Exception ("EmpiricalPenaltySupremumEstimator ctr: Invalid Inputs"); - - if (aRxToR1 instanceof org.drip.spaces.rxtor1.NormedR1ToNormedR1[]) - _aR1ToR1 = (org.drip.spaces.rxtor1.NormedR1ToNormedR1[]) aRxToR1; - else - _aRdToR1 = (org.drip.spaces.rxtor1.NormedRdToNormedR1[]) aRxToR1; - - _gvviY = gvviY; - _distR1R1 = distR1R1; - _distRdR1 = distRdR1; - int iNumRxToR1 = aRxToR1.length; - _iSupremumPenaltyLossMode = iSupremumPenaltyLossMode; - - if (SUPREMUM_PENALTY_EMPIRICAL_LOSS == _iSupremumPenaltyLossMode && null == _gvviY) - throw new java.lang.Exception ("EmpiricalPenaltySupremumEstimator ctr: Invalid Inputs"); - - for (int i = 0; i < iNumRxToR1; ++i) { - if (null == aRxToR1[i]) - throw new java.lang.Exception ("EmpiricalPenaltySupremumEstimator ctr: Invalid Inputs"); - } - } - - /** - * The Supremum Penalty Loss Mode Flag - * - * @return The Supremum Penalty Loss Mode Flag - */ - - public int supremumPenaltyLossMode() - { - return _iSupremumPenaltyLossMode; - } - - /** - * Retrieve the Empirical Learning Metric Estimator Instance - * - * @return The Empirical Learning Metric Estimator Instance - */ - - public org.drip.learning.rxtor1.EmpiricalLearningMetricEstimator elme() - { - return _elme; - } - - /** - * Retrieve the Validated Outcome Instance - * - * @return The Validated Outcome Instance - */ - - public org.drip.spaces.instance.GeneralizedValidatedVector empiricalOutcomes() - { - return _gvviY; - } - - /** - * Compute the Empirical Penalty Supremum for the specified R^1 Input Space - * - * @param gvviX The R^1 Input Space - * - * @return The Empirical Penalty Supremum for the specified R^1 Input Space - */ - - public org.drip.learning.rxtor1.EmpiricalPenaltySupremum supremumR1 ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX) - { - if (null == _aR1ToR1) return null; - - int iSupremumIndex = 0; - int iNumR1ToR1 = _aR1ToR1.length; - double dblSupremumPenaltyLoss = 0.; - - for (int i = 0 ; i < iNumR1ToR1; ++i) { - org.drip.function.definition.R1ToR1 funcR1ToR1 = _aR1ToR1[i].function(); - - if (null == funcR1ToR1) return null; - - double dblPenaltyLoss = 0.; - - try { - if (SUPREMUM_PENALTY_EMPIRICAL_LOSS == _iSupremumPenaltyLossMode) - dblPenaltyLoss += _elme.empiricalLoss (funcR1ToR1, gvviX, _gvviY); - else if (SUPREMUM_PENALTY_STRUCTURAL_LOSS == _iSupremumPenaltyLossMode) - dblPenaltyLoss += _elme.structuralLoss (funcR1ToR1, gvviX); - else if (SUPREMUM_PENALTY_REGULARIZED_LOSS == _iSupremumPenaltyLossMode) - dblPenaltyLoss += _elme.regularizedLoss (funcR1ToR1, gvviX, _gvviY); - else if (SUPREMUM_PENALTY_EMPIRICAL_RISK == _iSupremumPenaltyLossMode) - dblPenaltyLoss += _elme.empiricalRisk (_distR1R1, funcR1ToR1, gvviX, _gvviY); - else if (SUPREMUM_PENALTY_STRUCTURAL_RISK == _iSupremumPenaltyLossMode) - dblPenaltyLoss += _elme.structuralRisk (_distR1R1, funcR1ToR1, gvviX, _gvviY); - else if (SUPREMUM_PENALTY_REGULARIZED_RISK == _iSupremumPenaltyLossMode) - dblPenaltyLoss += _elme.regularizedRisk (_distR1R1, funcR1ToR1, gvviX, _gvviY); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (dblPenaltyLoss > dblSupremumPenaltyLoss) { - iSupremumIndex = i; - dblSupremumPenaltyLoss = dblPenaltyLoss; - } - } - - try { - return new org.drip.learning.rxtor1.EmpiricalPenaltySupremum (iSupremumIndex, - dblSupremumPenaltyLoss / gvviX.sampleSize()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Empirical Penalty Supremum for the specified R^d Input Space - * - * @param gvviX The R^d Input Space - * - * @return The Empirical Penalty Supremum for the specified R^d Input Space - */ - - public org.drip.learning.rxtor1.EmpiricalPenaltySupremum supremumRd ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX) - { - if (null == _aRdToR1) return null; - - int iSupremumIndex = 0; - int iNumRdToR1 = _aRdToR1.length; - double dblSupremumPenaltyLoss = 0.; - - for (int i = 0 ; i < iNumRdToR1; ++i) { - org.drip.function.definition.RdToR1 funcRdToR1 = _aRdToR1[i].function(); - - if (null == funcRdToR1) return null; - - double dblPenaltyLoss = 0.; - - try { - if (SUPREMUM_PENALTY_EMPIRICAL_LOSS == _iSupremumPenaltyLossMode) - dblPenaltyLoss += _elme.empiricalLoss (funcRdToR1, gvviX, _gvviY); - else if (SUPREMUM_PENALTY_STRUCTURAL_LOSS == _iSupremumPenaltyLossMode) - dblPenaltyLoss += _elme.structuralLoss (funcRdToR1, gvviX); - else if (SUPREMUM_PENALTY_REGULARIZED_LOSS == _iSupremumPenaltyLossMode) - dblPenaltyLoss += _elme.regularizedLoss (funcRdToR1, gvviX, _gvviY); - else if (SUPREMUM_PENALTY_EMPIRICAL_RISK == _iSupremumPenaltyLossMode) - dblPenaltyLoss += _elme.empiricalRisk (_distRdR1, funcRdToR1, gvviX, _gvviY); - else if (SUPREMUM_PENALTY_STRUCTURAL_RISK == _iSupremumPenaltyLossMode) - dblPenaltyLoss += _elme.structuralRisk (_distRdR1, funcRdToR1, gvviX, _gvviY); - else if (SUPREMUM_PENALTY_REGULARIZED_RISK == _iSupremumPenaltyLossMode) - dblPenaltyLoss += _elme.regularizedRisk (_distRdR1, funcRdToR1, gvviX, _gvviY); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (dblPenaltyLoss > dblSupremumPenaltyLoss) { - iSupremumIndex = i; - dblSupremumPenaltyLoss = dblPenaltyLoss; - } - } - - try { - return new org.drip.learning.rxtor1.EmpiricalPenaltySupremum (iSupremumIndex, - dblSupremumPenaltyLoss / gvviX.sampleSize()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Empirical Penalty Supremum for the specified R^1/R^d Input Space - * - * @param gvviX The R^1/R^d Input Space - * - * @return The Empirical Penalty Supremum for the specified R^1/R^d Input Space - */ - - public org.drip.learning.rxtor1.EmpiricalPenaltySupremum supremum ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX) - { - org.drip.learning.rxtor1.EmpiricalPenaltySupremum epsR1 = supremumR1 (gvviX); - - return null == epsR1 ? supremumRd (gvviX) : epsR1; - } - - /** - * Retrieve the Supremum R^1 To R^1 Function Instance for the specified Variate Sequence - * - * @param adblX The Predictor Instance - * - * @return The Supremum R^1 To R^1 Function Instance - */ - - public org.drip.function.definition.R1ToR1 supremumR1ToR1 ( - final double[] adblX) - { - org.drip.learning.rxtor1.EmpiricalPenaltySupremum eps = null; - - try { - eps = supremumR1 (new org.drip.spaces.instance.ValidatedR1 - (org.drip.spaces.tensor.R1ContinuousVector.Standard(), adblX)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return _aR1ToR1[eps.index()].function(); - } - - /** - * Retrieve the Supremum R^d To R^1 Function Instance for the specified Variate Sequence - * - * @param aadblX The Predictor Instance - * - * @return The Supremum R^d To R^1 Function Instance - */ - - public org.drip.function.definition.RdToR1 supremumRdToR1 ( - final double[][] aadblX) - { - org.drip.learning.rxtor1.EmpiricalPenaltySupremum eps = null; - - try { - eps = supremumRd (new org.drip.spaces.instance.ValidatedRd - (org.drip.spaces.tensor.RdContinuousVector.Standard (aadblX.length), aadblX)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return _aRdToR1[eps.index()].function(); - } - - @Override public int dimension() - { - return -1; - } - - @Override public double evaluate ( - final double[] adblX) - throws java.lang.Exception - { - org.drip.learning.rxtor1.EmpiricalPenaltySupremum eps = supremumR1 (new - org.drip.spaces.instance.ValidatedR1 (org.drip.spaces.tensor.R1ContinuousVector.Standard(), - adblX)); - - if (null == eps) - throw new java.lang.Exception ("EmpiricalPenaltySupremumEstimator::evaluate => Invalid Inputs"); - - return eps.value(); - } - - /** - * Retrieve the Worst-case Loss over the Multivariate Sequence - * - * @param aadblX The Multivariate Array - * - * @return The Worst-case Loss over the Multivariate Sequence - * - * @throws java.lang.Exception Thrown if the Worst-Case Loss cannot be computed - */ - - public double evaluate ( - final double[][] aadblX) - throws java.lang.Exception - { - if (null == aadblX) - throw new java.lang.Exception ("EmpiricalPenaltySupremumEstimator::evaluate => Invalid Inputs"); - - org.drip.learning.rxtor1.EmpiricalPenaltySupremum eps = supremumRd (new - org.drip.spaces.instance.ValidatedRd (org.drip.spaces.tensor.RdContinuousVector.Standard - (aadblX.length), aadblX)); - - if (null == eps) - throw new java.lang.Exception ("EmpiricalPenaltySupremumEstimator::evaluate => Invalid Inputs"); - - return eps.value(); - } - - @Override public double targetVariateVarianceBound ( - final int iTargetVariateIndex) - throws java.lang.Exception - { - return 1. / (_gvviY.sampleSize() * _gvviY.sampleSize()); - } -} diff --git a/org/drip/learning/rxtor1/EmpiricalPenaltySupremumMetrics.java b/org/drip/learning/rxtor1/EmpiricalPenaltySupremumMetrics.java deleted file mode 100644 index f562940..0000000 --- a/org/drip/learning/rxtor1/EmpiricalPenaltySupremumMetrics.java +++ /dev/null @@ -1,184 +0,0 @@ - -package org.drip.learning.rxtor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * EmpiricalPenaltySupremumMetrics computes Efron-Stein Metrics for the Penalty Supremum R^x To R^1 - * Functions. - * - * @author Lakshmi Krishnamurthy - */ - -public class EmpiricalPenaltySupremumMetrics extends org.drip.sequence.functional.EfronSteinMetrics { - private org.drip.learning.rxtor1.EmpiricalPenaltySupremumEstimator _epse = null; - private org.drip.learning.bound.MeasureConcentrationExpectationBound _mceb = null; - - /** - * EmpiricalPenaltySupremumMetrics Constructor - * - * @param epse R^x To R^1 The Empirical Penalty Supremum Estimator Instance - * @param aSSAM Array of the Individual Single Sequence Metrics - * @param mceb The Concentration-of-Measure Loss Expectation Bound Estimator - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public EmpiricalPenaltySupremumMetrics ( - final org.drip.learning.rxtor1.EmpiricalPenaltySupremumEstimator epse, - final org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] aSSAM, - final org.drip.learning.bound.MeasureConcentrationExpectationBound mceb) - throws java.lang.Exception - { - super (epse, aSSAM); - - if (null == (_epse = epse) || null == (_mceb = mceb)) - throw new java.lang.Exception ("EmpiricalPenaltySupremumMetrics ctr: Invalid Inputs"); - } - - /** - * Retrieve the Empirical Penalty Supremum Function - * - * @return The Empirical Penalty Supremum Function - */ - - public org.drip.learning.rxtor1.EmpiricalPenaltySupremumEstimator empiricalPenaltySupremumEstimator() - { - return _epse; - } - - /** - * Retrieve the Univariate Sequence Dependent Variance Bound - * - * @param adblVariate The univariate Sequence - * - * @return The Univariate Sequence Dependent Variance Bound - * - * @throws java.lang.Exception Thrown if the Date Dependent Variance Bound cannot be Computed - */ - - public double dataDependentVarianceBound ( - final double[] adblVariate) - throws java.lang.Exception - { - return _epse.evaluate (adblVariate) / adblVariate.length; - } - - /** - * Retrieve the Multivariate Sequence Dependent Variance Bound - * - * @param aadblVariate The Multivariate Sequence - * - * @return The Multivariate Sequence Dependent Variance Bound - * - * @throws java.lang.Exception Thrown if the Date Dependent Variance Bound cannot be Computed - */ - - public double dataDependentVarianceBound ( - final double[][] aadblVariate) - throws java.lang.Exception - { - return _epse.evaluate (aadblVariate) / aadblVariate.length; - } - - /** - * Compute the Lugosi Data-Dependent Variance Bound from the Sample and the Classifier Class Asymptotic - * Behavior. The Reference is: - * - * G. Lugosi (2002): Pattern Classification and Learning Theory, in: L.Gyorfi, editor, Principles of - * Non-parametric Learning, 5-62, Springer, Wien. - * - * @param adblVariate The Sample Univariate Array - * - * @return The Lugosi Data-Dependent Variance Bound - * - * @throws java.lang.Exception Thrown if the Lugosi Data-Dependent Variance Bound cannot be computed - */ - - public double lugosiVarianceBound ( - final double[] adblVariate) - throws java.lang.Exception - { - org.drip.function.definition.R1ToR1 supR1ToR1 = _epse.supremumR1ToR1 (adblVariate); - - if (null == supR1ToR1) - throw new java.lang.Exception - ("EmpiricalPenaltySupremumMetrics::lugosiVarianceBound => Cannot Find Supremum Classifier"); - - return dataDependentVarianceBound (adblVariate) + _mceb.constant() + java.lang.Math.pow - (adblVariate.length, _mceb.exponent()); - } - - /** - * Compute the Lugosi Data-Dependent Variance Bound from the Sample and the Classifier Class Asymptotic - * Behavior. The Reference is: - * - * G. Lugosi (2002): Pattern Classification and Learning Theory, in: L.Gyorfi, editor, Principles of - * Non-parametric Learning, 5-62, Springer, Wien. - * - * @param aadblVariate The Sample Multivariate Array - * - * @return The Lugosi Data-Dependent Variance Bound - * - * @throws java.lang.Exception Thrown if the Lugosi Data-Dependent Variance Bound cannot be computed - */ - - public double lugosiVarianceBound ( - final double[][] aadblVariate) - throws java.lang.Exception - { - org.drip.function.definition.RdToR1 supRdToR1 = _epse.supremumRdToR1 (aadblVariate); - - if (null == supRdToR1) - throw new java.lang.Exception - ("EmpiricalPenaltySupremumMetrics::lugosiVarianceBound => Cannot Find Supremum Classifier"); - - return dataDependentVarianceBound (aadblVariate) + _mceb.constant() + java.lang.Math.pow - (aadblVariate.length, _mceb.exponent()); - } -} diff --git a/org/drip/learning/rxtor1/GeneralizedLearner.java b/org/drip/learning/rxtor1/GeneralizedLearner.java deleted file mode 100644 index b93042b..0000000 --- a/org/drip/learning/rxtor1/GeneralizedLearner.java +++ /dev/null @@ -1,801 +0,0 @@ - -package org.drip.learning.rxtor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * GeneralizedLearner implements the Learner Class that holds the Space of Normed R^x To Normed R^1 Learning - * Functions along with their Custom Empirical Loss. Class-Specific Asymptotic Sample, Covering Number based - * Upper Probability Bounds and other Parameters are also maintained. - * - * The References are: - * - * 1) Alon, N., S. Ben-David, N. Cesa Bianchi, and D. Haussler (1997): Scale-sensitive Dimensions, Uniform - * Convergence, and Learnability, Journal of Association of Computational Machinery, 44 (4) 615-631. - * - * 2) Anthony, M., and P. L. Bartlett (1999): Artificial Neural Network Learning - Theoretical Foundations, - * Cambridge University Press, Cambridge, UK. - * - * 3) Kearns, M. J., R. E. Schapire, and L. M. Sellie (1994): Towards Efficient Agnostic Learning, Machine - * Learning, 17 (2) 115-141. - * - * 4) Lee, W. S., P. L. Bartlett, and R. C. Williamson (1998): The Importance of Convexity in Learning with - * Squared Loss, IEEE Transactions on Information Theory, 44 1974-1980. - * - * 5) Vapnik, V. N. (1998): Statistical Learning Theory, Wiley, New York. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class GeneralizedLearner implements org.drip.learning.rxtor1.EmpiricalLearningMetricEstimator -{ - private org.drip.learning.bound.CoveringNumberLossBound _funcClassCNLB = null; - private org.drip.spaces.functionclass.NormedRxToNormedR1Finite _funcClassRxToR1 = null; - private org.drip.learning.regularization.RegularizationFunction _regularizerFunc = null; - - /** - * GeneralizedLearner Constructor - * - * @param funcClassRxToR1 R^x To R^1 Function Class - * @param funcClassCNLB The Function Class Covering Number based Deviation Upper Probability Bound - * Generator - * @param regularizerFunc The Regularizer Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public GeneralizedLearner ( - final org.drip.spaces.functionclass.NormedRxToNormedR1Finite funcClassRxToR1, - final org.drip.learning.bound.CoveringNumberLossBound funcClassCNLB, - final org.drip.learning.regularization.RegularizationFunction regularizerFunc) - throws java.lang.Exception - { - if (null == (_funcClassRxToR1 = funcClassRxToR1) || null == (_funcClassCNLB = funcClassCNLB) || null - == (_regularizerFunc = regularizerFunc)) - throw new java.lang.Exception ("GeneralizedLearner ctr: Invalid Inputs"); - } - - @Override public org.drip.spaces.functionclass.NormedRxToNormedR1Finite functionClass() - { - return _funcClassRxToR1; - } - - @Override public org.drip.learning.regularization.RegularizationFunction regularizerFunction() - { - return _regularizerFunc; - } - - @Override public org.drip.learning.rxtor1.EmpiricalPenaltySupremum supremumEmpiricalLoss ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - { - try { - return new org.drip.learning.rxtor1.EmpiricalPenaltySupremumEstimator - (org.drip.learning.rxtor1.EmpiricalPenaltySupremumEstimator.SUPREMUM_PENALTY_EMPIRICAL_LOSS, - this, gvviY, null, null).supremum (gvviX); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public double structuralLoss ( - final org.drip.function.definition.R1ToR1 funcLearnerR1ToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi) - throws java.lang.Exception - { - if (null == gvvi || !(gvvi instanceof org.drip.spaces.instance.ValidatedR1) && - (_funcClassRxToR1 instanceof org.drip.spaces.functionclass.NormedR1ToNormedR1Finite)) - throw new java.lang.Exception ("GeneralizedLearner::structuralLoss => Invalid Inputs"); - - org.drip.function.definition.R1ToR1 funcRegularizerR1ToR1 = _regularizerFunc.r1Tor1(); - - if (null == funcRegularizerR1ToR1) - throw new java.lang.Exception ("GeneralizedLearner::structuralLoss => Invalid Inputs"); - - org.drip.spaces.functionclass.NormedR1ToNormedR1Finite finiteClassR1ToR1 = - (org.drip.spaces.functionclass.NormedR1ToNormedR1Finite) _funcClassRxToR1; - - org.drip.spaces.metric.GeneralizedMetricVectorSpace gmvsInput = - finiteClassR1ToR1.inputMetricVectorSpace(); - - if (gmvsInput instanceof org.drip.spaces.metric.R1Normed) - throw new java.lang.Exception ("GeneralizedLearner::structuralLoss => Invalid Inputs"); - - org.drip.spaces.metric.GeneralizedMetricVectorSpace gmvsOutput = - finiteClassR1ToR1.outputMetricVectorSpace(); - - if (gmvsOutput instanceof org.drip.spaces.metric.R1Continuous) - throw new java.lang.Exception ("GeneralizedLearner::structuralLoss => Invalid Inputs"); - - org.drip.learning.regularization.RegularizerR1ToR1 regularizerR1ToR1 = - org.drip.learning.regularization.RegularizerBuilder.ToR1Continuous (funcRegularizerR1ToR1, - (org.drip.spaces.metric.R1Normed) gmvsInput, (org.drip.spaces.metric.R1Continuous) - gmvsOutput, _regularizerFunc.lambda()); - - if (null == regularizerR1ToR1) - throw new java.lang.Exception ("GeneralizedLearner::structuralLoss => Invalid Inputs"); - - return regularizerR1ToR1.structuralLoss (funcLearnerR1ToR1, ((org.drip.spaces.instance.ValidatedR1) - gvvi).instance()); - } - - @Override public double structuralLoss ( - final org.drip.function.definition.RdToR1 funcLearnerRdToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi) - throws java.lang.Exception - { - if (null == gvvi || !(gvvi instanceof org.drip.spaces.instance.ValidatedRd) && - (_funcClassRxToR1 instanceof org.drip.spaces.functionclass.NormedRdToNormedR1Finite)) - throw new java.lang.Exception ("GeneralizedLearner::structuralLoss => Invalid Inputs"); - - org.drip.function.definition.RdToR1 funcRegularizerRdToR1 = _regularizerFunc.rdTor1(); - - if (null == funcRegularizerRdToR1) - throw new java.lang.Exception ("GeneralizedLearner::structuralLoss => Invalid Inputs"); - - org.drip.spaces.functionclass.NormedRdToNormedR1Finite finiteClassRdToR1 = - (org.drip.spaces.functionclass.NormedRdToNormedR1Finite) _funcClassRxToR1; - - org.drip.spaces.metric.GeneralizedMetricVectorSpace gmvsInput = - finiteClassRdToR1.inputMetricVectorSpace(); - - if (gmvsInput instanceof org.drip.spaces.metric.RdNormed) - throw new java.lang.Exception ("GeneralizedLearner::structuralLoss => Invalid Inputs"); - - org.drip.spaces.metric.GeneralizedMetricVectorSpace gmvsOutput = - finiteClassRdToR1.outputMetricVectorSpace(); - - if (gmvsOutput instanceof org.drip.spaces.metric.R1Continuous) - throw new java.lang.Exception ("GeneralizedLearner::structuralLoss => Invalid Inputs"); - - org.drip.learning.regularization.RegularizerRdToR1 regularizerRdToR1 = - org.drip.learning.regularization.RegularizerBuilder.ToRdContinuous (funcRegularizerRdToR1, - (org.drip.spaces.metric.RdNormed) gmvsInput, (org.drip.spaces.metric.R1Continuous) - gmvsOutput, _regularizerFunc.lambda()); - - if (null == regularizerRdToR1) - throw new java.lang.Exception ("GeneralizedLearner::structuralLoss => Invalid Inputs"); - - return regularizerRdToR1.structuralLoss (funcLearnerRdToR1, ((org.drip.spaces.instance.ValidatedRd) - gvvi).instance()); - } - - @Override public org.drip.learning.rxtor1.EmpiricalPenaltySupremum supremumStructuralLoss ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX) - { - try { - return new org.drip.learning.rxtor1.EmpiricalPenaltySupremumEstimator - (org.drip.learning.rxtor1.EmpiricalPenaltySupremumEstimator.SUPREMUM_PENALTY_STRUCTURAL_LOSS, - this, null, null, null).supremum (gvviX); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public double regularizedLoss ( - final org.drip.function.definition.R1ToR1 funcLearnerR1ToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception - { - return empiricalLoss (funcLearnerR1ToR1, gvviX, gvviY) + structuralLoss (funcLearnerR1ToR1, gvviX); - } - - @Override public double regularizedLoss ( - final org.drip.function.definition.RdToR1 funcLearnerRdToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception - { - return empiricalLoss (funcLearnerRdToR1, gvviX, gvviY) + structuralLoss (funcLearnerRdToR1, gvviX); - } - - @Override public org.drip.learning.rxtor1.EmpiricalPenaltySupremum supremumRegularizedLoss ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - { - try { - return new org.drip.learning.rxtor1.EmpiricalPenaltySupremumEstimator - (org.drip.learning.rxtor1.EmpiricalPenaltySupremumEstimator.SUPREMUM_PENALTY_REGULARIZED_LOSS, - this, gvviY, null, null).supremum (gvviX); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.learning.rxtor1.EmpiricalPenaltySupremum supremumEmpiricalRisk ( - final org.drip.measure.continuousjoint.R1R1 distR1R1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - { - try { - return new org.drip.learning.rxtor1.EmpiricalPenaltySupremumEstimator - (org.drip.learning.rxtor1.EmpiricalPenaltySupremumEstimator.SUPREMUM_PENALTY_EMPIRICAL_RISK, - this, gvviY, distR1R1, null).supremum (gvviX); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.learning.rxtor1.EmpiricalPenaltySupremum supremumEmpiricalRisk ( - final org.drip.measure.continuousjoint.RdR1 distRdR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - { - try { - return new org.drip.learning.rxtor1.EmpiricalPenaltySupremumEstimator - (org.drip.learning.rxtor1.EmpiricalPenaltySupremumEstimator.SUPREMUM_PENALTY_EMPIRICAL_RISK, - this, gvviY, null, distRdR1).supremum (gvviX); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public double structuralRisk ( - final org.drip.measure.continuousjoint.R1R1 distR1R1, - final org.drip.function.definition.R1ToR1 funcLearnerR1ToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception - { - if (null == distR1R1 || null == gvviX || null == gvviY || !(gvviX instanceof - org.drip.spaces.instance.ValidatedR1) || !(gvviY instanceof - org.drip.spaces.instance.ValidatedR1) && !(_funcClassRxToR1 instanceof - org.drip.spaces.functionclass.NormedR1ToNormedR1Finite)) - throw new java.lang.Exception ("GeneralizedLearner::structuralRisk => Invalid Inputs"); - - org.drip.function.definition.R1ToR1 funcRegularizerR1ToR1 = _regularizerFunc.r1Tor1(); - - if (null == funcRegularizerR1ToR1) - throw new java.lang.Exception ("GeneralizedLearner::structuralRisk => Invalid Inputs"); - - org.drip.spaces.functionclass.NormedR1ToNormedR1Finite finiteClassR1ToR1 = - (org.drip.spaces.functionclass.NormedR1ToNormedR1Finite) _funcClassRxToR1; - - org.drip.spaces.metric.GeneralizedMetricVectorSpace gmvsInput = - finiteClassR1ToR1.inputMetricVectorSpace(); - - if (gmvsInput instanceof org.drip.spaces.metric.R1Normed) - throw new java.lang.Exception ("GeneralizedLearner::structuralRisk => Invalid Inputs"); - - org.drip.spaces.metric.GeneralizedMetricVectorSpace gmvsOutput = - finiteClassR1ToR1.outputMetricVectorSpace(); - - if (gmvsOutput instanceof org.drip.spaces.metric.R1Continuous) - throw new java.lang.Exception ("GeneralizedLearner::structuralRisk => Invalid Inputs"); - - org.drip.learning.regularization.RegularizerR1ToR1 regularizerR1ToR1 = - org.drip.learning.regularization.RegularizerBuilder.ToR1Continuous (funcRegularizerR1ToR1, - (org.drip.spaces.metric.R1Normed) gmvsInput, (org.drip.spaces.metric.R1Continuous) - gmvsOutput, _regularizerFunc.lambda()); - - if (null == regularizerR1ToR1) - throw new java.lang.Exception ("GeneralizedLearner::structuralRisk => Invalid Inputs"); - - return regularizerR1ToR1.structuralRisk (distR1R1, funcLearnerR1ToR1, - ((org.drip.spaces.instance.ValidatedR1) gvviX).instance(), - ((org.drip.spaces.instance.ValidatedR1) gvviY).instance()); - } - - @Override public double structuralRisk ( - final org.drip.measure.continuousjoint.RdR1 distRdR1, - final org.drip.function.definition.RdToR1 funcLearnerRdToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception - { - if (null == distRdR1 || null == gvviX || null == gvviY || !(gvviX instanceof - org.drip.spaces.instance.ValidatedRd) || !(gvviY instanceof - org.drip.spaces.instance.ValidatedR1) && !(_funcClassRxToR1 instanceof - org.drip.spaces.functionclass.NormedR1ToNormedR1Finite)) - throw new java.lang.Exception ("GeneralizedLearner::structuralRisk => Invalid Inputs"); - - org.drip.function.definition.RdToR1 funcRegularizerRdToR1 = _regularizerFunc.rdTor1(); - - if (null == funcRegularizerRdToR1) - throw new java.lang.Exception ("GeneralizedLearner::structuralRisk => Invalid Inputs"); - - org.drip.spaces.functionclass.NormedRdToNormedR1Finite finiteClassRdToR1 = - (org.drip.spaces.functionclass.NormedRdToNormedR1Finite) _funcClassRxToR1; - - org.drip.spaces.metric.GeneralizedMetricVectorSpace gmvsInput = - finiteClassRdToR1.inputMetricVectorSpace(); - - if (gmvsInput instanceof org.drip.spaces.metric.RdNormed) - throw new java.lang.Exception ("GeneralizedLearner::structuralRisk => Invalid Inputs"); - - org.drip.spaces.metric.GeneralizedMetricVectorSpace gmvsOutput = - finiteClassRdToR1.outputMetricVectorSpace(); - - if (gmvsOutput instanceof org.drip.spaces.metric.R1Continuous) - throw new java.lang.Exception ("GeneralizedLearner::structuralRisk => Invalid Inputs"); - - org.drip.learning.regularization.RegularizerRdToR1 regularizerRdToR1 = - org.drip.learning.regularization.RegularizerBuilder.ToRdContinuous (funcRegularizerRdToR1, - (org.drip.spaces.metric.RdNormed) gmvsInput, (org.drip.spaces.metric.R1Continuous) - gmvsOutput, _regularizerFunc.lambda()); - - if (null == regularizerRdToR1) - throw new java.lang.Exception ("GeneralizedLearner::structuralRisk => Invalid Inputs"); - - return regularizerRdToR1.structuralRisk (distRdR1, funcLearnerRdToR1, - ((org.drip.spaces.instance.ValidatedRd) gvviX).instance(), - ((org.drip.spaces.instance.ValidatedR1) gvviY).instance()); - } - - @Override public org.drip.learning.rxtor1.EmpiricalPenaltySupremum supremumStructuralRisk ( - final org.drip.measure.continuousjoint.R1R1 distR1R1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - { - try { - return new org.drip.learning.rxtor1.EmpiricalPenaltySupremumEstimator - (org.drip.learning.rxtor1.EmpiricalPenaltySupremumEstimator.SUPREMUM_PENALTY_STRUCTURAL_RISK, - this, gvviY, distR1R1, null).supremum (gvviX); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.learning.rxtor1.EmpiricalPenaltySupremum supremumStructuralRisk ( - final org.drip.measure.continuousjoint.RdR1 distRdR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - { - try { - return new org.drip.learning.rxtor1.EmpiricalPenaltySupremumEstimator - (org.drip.learning.rxtor1.EmpiricalPenaltySupremumEstimator.SUPREMUM_PENALTY_STRUCTURAL_RISK, - this, gvviY, null, distRdR1).supremum (gvviX); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public double regularizedRisk ( - final org.drip.measure.continuousjoint.R1R1 distR1R1, - final org.drip.function.definition.R1ToR1 funcLearnerR1ToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception - { - return empiricalRisk (distR1R1, funcLearnerR1ToR1, gvviX, gvviY) + structuralRisk (distR1R1, - funcLearnerR1ToR1, gvviX, gvviY); - } - - @Override public double regularizedRisk ( - final org.drip.measure.continuousjoint.RdR1 distRdR1, - final org.drip.function.definition.RdToR1 funcLearnerRdToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception - { - return empiricalRisk (distRdR1, funcLearnerRdToR1, gvviX, gvviY) + structuralRisk (distRdR1, - funcLearnerRdToR1, gvviX, gvviY); - } - - @Override public org.drip.learning.rxtor1.EmpiricalPenaltySupremum supremumRegularizedRisk ( - final org.drip.measure.continuousjoint.R1R1 distR1R1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - { - try { - return new org.drip.learning.rxtor1.EmpiricalPenaltySupremumEstimator - (org.drip.learning.rxtor1.EmpiricalPenaltySupremumEstimator.SUPREMUM_PENALTY_REGULARIZED_RISK, - this, gvviY, distR1R1, null).supremum (gvviX); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.learning.rxtor1.EmpiricalPenaltySupremum supremumRegularizedRisk ( - final org.drip.measure.continuousjoint.RdR1 distRdR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - { - try { - return new org.drip.learning.rxtor1.EmpiricalPenaltySupremumEstimator - (org.drip.learning.rxtor1.EmpiricalPenaltySupremumEstimator.SUPREMUM_PENALTY_REGULARIZED_RISK, - this, gvviY, null, distRdR1).supremum (gvviX); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Covering Number based Deviation Upper Probability Bound Generator - * - * @return The Covering Number based Deviation Upper Probability Bound Generator - */ - - public org.drip.learning.bound.CoveringNumberLossBound coveringLossBoundEvaluator() - { - return _funcClassCNLB; - } - - /** - * Compute the Upper Bound of the Probability of the Absolute Deviation of the Empirical Mean from the - * Population Mean using the Function Class Supremum Covering Number for General-Purpose Learning - * - * @param iSampleSize The Sample Size - * @param dblEpsilon The Deviation of the Empirical Mean from the Population Mean - * @param bSupremum TRUE To Use the Supremum Metric in place of the Built-in Metric - * - * @return The Upper Bound of the Probability of the Absolute Deviation of the Empirical Mean from the - * Population Mean using the Function Class Supremum Covering Number for General-Purpose Learning - * - * @throws java.lang.Exception Thrown if the Upper Probability Bound cannot be computed - */ - - public double genericCoveringProbabilityBound ( - final int iSampleSize, - final double dblEpsilon, - final boolean bSupremum) - throws java.lang.Exception - { - return _funcClassCNLB.deviationProbabilityUpperBound (iSampleSize, dblEpsilon) * (bSupremum ? - _funcClassRxToR1.populationSupremumCoveringNumber (dblEpsilon) : - _funcClassRxToR1.populationCoveringNumber (dblEpsilon)); - } - - /** - * Compute the Minimum Possible Sample Size needed to generate the required Upper Probability Bound for - * the Specified Empirical Deviation using the Covering Number Convergence Bounds. - * - * @param dblEpsilon The Deviation of the Empirical Mean from the Population Mean - * @param dblDeviationUpperProbabilityBound The Upper Bound of the Probability for the given Deviation - * @param bSupremum TRUE To Use the Supremum Metric in place of the Built-in Metric - * - * @return The Minimum Possible Sample Size - * - * @throws java.lang.Exception Thrown if the Minimum Sample Size cannot be computed - */ - - public double genericCoveringSampleSize ( - final double dblEpsilon, - final double dblDeviationUpperProbabilityBound, - final boolean bSupremum) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblEpsilon) || - !org.drip.quant.common.NumberUtil.IsValid (dblDeviationUpperProbabilityBound)) - throw new java.lang.Exception - ("GeneralizedLearner::genericCoveringSampleSize => Invalid Inputs"); - - org.drip.function.definition.R1ToR1 funcDeviationUpperProbabilityBound = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblSampleSize) - throws java.lang.Exception - { - return genericCoveringProbabilityBound ((int) dblSampleSize, dblEpsilon, bSupremum); - } - }; - - org.drip.function.r1tor1solver.FixedPointFinderOutput fpfo = new - org.drip.function.r1tor1solver.FixedPointFinderZheng (dblDeviationUpperProbabilityBound, - funcDeviationUpperProbabilityBound, false).findRoot(); - - if (null == fpfo || !fpfo.containsRoot()) - throw new java.lang.Exception - ("GeneralizedLearner::genericCoveringSampleSize => Cannot Estimate Minimal Sample Size"); - - return fpfo.getRoot(); - } - - /** - * Compute the Sample/Data Dependent Upper Bound of the Probability of the Absolute Deviation between - * the Empirical and the Population Means using the Function Class Supremum Covering Number for - * General-Purpose Learning - * - * @param gvvi The Validated Instance Vector Sequence - * @param iSampleSize The Sample Size - * @param dblEpsilon The Deviation of the Empirical Mean from the Population Mean - * @param bSupremum TRUE To Use the Supremum Metric in place of the Built-in Metric - * - * @return The Sample/Data Dependent Upper Bound of the Probability of the Absolute Deviation between - * the Empirical and the Population Means using the Function Class Supremum Covering Number for - * General-Purpose Learning - * - * @throws java.lang.Exception Thrown if the Upper Probability Bound cannot be computed - */ - - public double genericCoveringProbabilityBound ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi, - final int iSampleSize, - final double dblEpsilon, - final boolean bSupremum) - throws java.lang.Exception - { - return _funcClassCNLB.deviationProbabilityUpperBound (iSampleSize, dblEpsilon) * - lossSampleCoveringNumber (gvvi, dblEpsilon, bSupremum); - } - - /** - * Compute the Minimum Possible Sample Size needed to generate the required Upper Probability Bound for - * the Specified Empirical Deviation using the Covering Number Convergence Bounds. - * - * @param gvvi The Validated Instance Vector Sequence - * @param dblEpsilon The Deviation of the Empirical Mean from the Population Mean - * @param dblDeviationUpperProbabilityBound The Upper Bound of the Probability for the given Deviation - * @param bSupremum TRUE To Use the Supremum Metric in place of the Built-in Metric - * - * @return The Minimum Possible Sample Size - * - * @throws java.lang.Exception Thrown if the Minimum Sample Size cannot be computed - */ - - public double genericCoveringSampleSize ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi, - final double dblEpsilon, - final double dblDeviationUpperProbabilityBound, - final boolean bSupremum) - throws java.lang.Exception - { - if (null == gvvi || !org.drip.quant.common.NumberUtil.IsValid (dblEpsilon) || - !org.drip.quant.common.NumberUtil.IsValid (dblDeviationUpperProbabilityBound)) - throw new java.lang.Exception - ("GeneralizedLearner::genericCoveringSampleSize => Invalid Inputs"); - - org.drip.function.definition.R1ToR1 funcDeviationUpperProbabilityBound = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblSampleSize) - throws java.lang.Exception - { - return genericCoveringProbabilityBound (gvvi, (int) dblSampleSize, dblEpsilon, bSupremum); - } - }; - - org.drip.function.r1tor1solver.FixedPointFinderOutput fpfo = new - org.drip.function.r1tor1solver.FixedPointFinderZheng (dblDeviationUpperProbabilityBound, - funcDeviationUpperProbabilityBound, false).findRoot(); - - if (null == fpfo || !fpfo.containsRoot()) - throw new java.lang.Exception - ("GeneralizedLearner::genericCoveringSampleSize => Cannot Estimate Minimal Sample Size"); - - return fpfo.getRoot(); - } - - /** - * Compute the Upper Bound of the Probability of the Absolute Deviation between the Empirical and the - * Population Means using the Function Class Supremum Covering Number for Regression Learning - * - * @param iSampleSize The Sample Size - * @param dblEpsilon The Deviation of the Empirical Mean from the Population Mean - * @param bSupremum TRUE To Use the Supremum Metric in place of the Built-in Metric - * - * @return The Upper Bound of the Probability of the Absolute Deviation between the Empirical and the - * Population Means using the Function Class Supremum Covering Number for Regression Learning - * - * @throws java.lang.Exception Thrown if the Upper Probability Bound cannot be computed - */ - - public double regressorCoveringProbabilityBound ( - final int iSampleSize, - final double dblEpsilon, - final boolean bSupremum) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblEpsilon) || 0. >= dblEpsilon || iSampleSize < (2. / - (dblEpsilon * dblEpsilon))) - throw new java.lang.Exception - ("GeneralizedLearner::regressorCoveringProbabilityBound => Invalid Inputs"); - - org.drip.function.definition.R1ToR1 funcSampleCoefficient = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblSampleSize) - throws java.lang.Exception - { - return 12. * dblSampleSize; - } - }; - - return (new org.drip.learning.bound.CoveringNumberLossBound (funcSampleCoefficient, 2., - 36.)).deviationProbabilityUpperBound (iSampleSize, dblEpsilon) * (bSupremum ? - _funcClassRxToR1.populationSupremumCoveringNumber (dblEpsilon / 6.) : - _funcClassRxToR1.populationCoveringNumber (dblEpsilon / 6.)); - } - - /** - * Compute the Minimum Possible Sample Size needed to generate the required Upper Probability Bound for - * the Specified Empirical Deviation using the Covering Number Convergence Bounds for Regression - * Learning. - * - * @param dblEpsilon The Deviation of the Empirical Mean from the Population Mean - * @param dblDeviationUpperProbabilityBound The Upper Bound of the Probability for the given Deviation - * @param bSupremum TRUE To Use the Supremum Metric in place of the Built-in Metric - * - * @return The Minimum Possible Sample Size - * - * @throws java.lang.Exception Thrown if the Minimum Sample Size cannot be computed - */ - - public double regressorCoveringSampleSize ( - final double dblEpsilon, - final double dblDeviationUpperProbabilityBound, - final boolean bSupremum) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblEpsilon) || - !org.drip.quant.common.NumberUtil.IsValid (dblDeviationUpperProbabilityBound)) - throw new java.lang.Exception - ("GeneralizedLearner::regressorCoveringSampleSize => Invalid Inputs"); - - org.drip.function.definition.R1ToR1 funcDeviationUpperProbabilityBound = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblSampleSize) - throws java.lang.Exception - { - return regressorCoveringProbabilityBound ((int) dblSampleSize, dblEpsilon, bSupremum); - } - }; - - org.drip.function.r1tor1solver.FixedPointFinderOutput fpfo = new - org.drip.function.r1tor1solver.FixedPointFinderZheng (dblDeviationUpperProbabilityBound, - funcDeviationUpperProbabilityBound, false).findRoot(); - - if (null == fpfo || !fpfo.containsRoot()) - throw new java.lang.Exception - ("GeneralizedLearner::regressorCoveringSampleSize => Cannot Estimate Minimal Sample Size"); - - return fpfo.getRoot(); - } - - /** - * Compute the Sample/Data Dependent Upper Bound of the Probability of the Absolute Deviation between - * the Empirical and the Population Means using the Function Class Supremum Covering Number for - * Regression Learning - * - * @param gvvi The Validated Instance Vector Sequence - * @param iSampleSize The Sample Size - * @param dblEpsilon The Deviation of the Empirical Mean from the Population Mean - * @param bSupremum TRUE To Use the Supremum Metric in place of the Built-in Metric - * - * @return The Sample/Data Dependent Upper Bound of the Probability of the Absolute Deviation between - * the Empirical and the Population Means using the Function Class Supremum Covering Number for - * Regression Learning - * - * @throws java.lang.Exception Thrown if the Upper Probability Bound cannot be computed - */ - - public double regressorCoveringProbabilityBound ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi, - final int iSampleSize, - final double dblEpsilon, - final boolean bSupremum) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblEpsilon) || 0. >= dblEpsilon || iSampleSize < (2. / - (dblEpsilon * dblEpsilon))) - throw new java.lang.Exception - ("GeneralizedLearner::regressorCoveringProbabilityBound => Invalid Inputs"); - - org.drip.function.definition.R1ToR1 funcSampleCoefficient = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblSampleSize) - throws java.lang.Exception - { - return 12. * dblSampleSize; - } - }; - - return (new org.drip.learning.bound.CoveringNumberLossBound (funcSampleCoefficient, 2., - 36.)).deviationProbabilityUpperBound (iSampleSize, dblEpsilon) * lossSampleCoveringNumber (gvvi, - dblEpsilon / 6., bSupremum); - } - - /** - * Compute the Minimum Possible Sample Size needed to generate the required Upper Probability Bound for - * the Specified Empirical Deviation using the Covering Number Convergence Bounds for Regression - * Learning. - * - * @param gvvi The Validated Instance Vector Sequence - * @param dblEpsilon The Deviation of the Empirical Mean from the Population Mean - * @param dblDeviationUpperProbabilityBound The Upper Bound of the Probability for the given Deviation - * @param bSupremum TRUE To Use the Supremum Metric in place of the Built-in Metric - * - * @return The Minimum Possible Sample Size - * - * @throws java.lang.Exception Thrown if the Minimum Sample Size cannot be computed - */ - - public double regressorCoveringSampleSize ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi, - final double dblEpsilon, - final double dblDeviationUpperProbabilityBound, - final boolean bSupremum) - throws java.lang.Exception - { - if (null == gvvi || !org.drip.quant.common.NumberUtil.IsValid (dblEpsilon) || - !org.drip.quant.common.NumberUtil.IsValid (dblDeviationUpperProbabilityBound)) - throw new java.lang.Exception - ("GeneralizedLearner::regressorCoveringSampleSize => Invalid Inputs"); - - org.drip.function.definition.R1ToR1 funcDeviationUpperProbabilityBound = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblSampleSize) - throws java.lang.Exception - { - return regressorCoveringProbabilityBound (gvvi, (int) dblSampleSize, dblEpsilon, bSupremum); - } - }; - - org.drip.function.r1tor1solver.FixedPointFinderOutput fpfo = new - org.drip.function.r1tor1solver.FixedPointFinderZheng (dblDeviationUpperProbabilityBound, - funcDeviationUpperProbabilityBound, false).findRoot(); - - if (null == fpfo || !fpfo.containsRoot()) - throw new java.lang.Exception - ("GeneralizedLearner::regressorCoveringSampleSize => Cannot Estimate Minimal Sample Size"); - - return fpfo.getRoot(); - } -} diff --git a/org/drip/learning/rxtor1/L1LossLearner.java b/org/drip/learning/rxtor1/L1LossLearner.java deleted file mode 100644 index 0eb571d..0000000 --- a/org/drip/learning/rxtor1/L1LossLearner.java +++ /dev/null @@ -1,247 +0,0 @@ - -package org.drip.learning.rxtor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * L1LossLearner implements the Learner Class that holds the Space of Normed R^x To Normed R^1 Learning - * Functions that employs L1 Empirical Loss Routine. Class-Specific Asymptotic Sample, Covering Number based - * Upper Probability Bounds and other Parameters are also maintained. - * - * The References are: - * - * 1) Alon, N., S. Ben-David, N. Cesa Bianchi, and D. Haussler (1997): Scale-sensitive Dimensions, Uniform - * Convergence, and Learnability, Journal of Association of Computational Machinery, 44 (4) 615-631. - * - * 2) Anthony, M., and P. L. Bartlett (1999): Artificial Neural Network Learning - Theoretical Foundations, - * Cambridge University Press, Cambridge, UK. - * - * 3) Kearns, M. J., R. E. Schapire, and L. M. Sellie (1994): Towards Efficient Agnostic Learning, Machine - * Learning, 17 (2) 115-141. - * - * 4) Lee, W. S., P. L. Bartlett, and R. C. Williamson (1998): The Importance of Convexity in Learning with - * Squared Loss, IEEE Transactions on Information Theory, 44 1974-1980. - * - * 5) Vapnik, V. N. (1998): Statistical Learning Theory, Wiley, New York. - * - * @author Lakshmi Krishnamurthy - */ - -public class L1LossLearner extends org.drip.learning.rxtor1.GeneralizedLearner { - private org.drip.learning.bound.MeasureConcentrationExpectationBound _cleb = null; - - /** - * L1LossLearner Constructor - * - * @param funcClassRxToR1 R^x To R^1 Function Class - * @param cdpb The Covering Number based Deviation Upper Probability Bound Generator - * @param regularizerFunc The Regularizer Function - * @param cleb The Concentration of Measure based Loss Expectation Upper Bound Evaluator - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public L1LossLearner ( - final org.drip.spaces.functionclass.NormedRxToNormedR1Finite funcClassRxToR1, - final org.drip.learning.bound.CoveringNumberLossBound cdpb, - final org.drip.learning.regularization.RegularizationFunction regularizerFunc, - final org.drip.learning.bound.MeasureConcentrationExpectationBound cleb) - throws java.lang.Exception - { - super (funcClassRxToR1, cdpb, regularizerFunc); - - if (null == (_cleb = cleb)) throw new java.lang.Exception ("L1LossLearner ctr: Invalid Inputs"); - } - - /** - * Retrieve the Concentration of Measure based Loss Expectation Upper Bound Evaluator Instance - * - * @return The Concentration of Measure based Loss Expectation Upper Bound Evaluator Instance - */ - - public org.drip.learning.bound.MeasureConcentrationExpectationBound concentrationLossBoundEvaluator() - { - return _cleb; - } - - @Override public double lossSampleCoveringNumber ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi, - final double dblEpsilon, - final boolean bSupremum) - throws java.lang.Exception - { - org.drip.spaces.functionclass.NormedRxToNormedR1Finite funcClassRxToR1 = functionClass(); - - return bSupremum ? funcClassRxToR1.sampleSupremumCoveringNumber (gvvi, dblEpsilon) : - funcClassRxToR1.sampleCoveringNumber (gvvi, dblEpsilon); - } - - @Override public double empiricalLoss ( - final org.drip.function.definition.R1ToR1 funcLearnerR1ToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception - { - if (null == funcLearnerR1ToR1 || null == gvviX || !(gvviX instanceof - org.drip.spaces.instance.ValidatedR1) || null == gvviY || !(gvviY instanceof - org.drip.spaces.instance.ValidatedR1)) - throw new java.lang.Exception ("L1LossLearner::empiricalLoss => Invalid Inputs"); - - double[] adblX = ((org.drip.spaces.instance.ValidatedR1) gvviX).instance(); - - double[] adblY = ((org.drip.spaces.instance.ValidatedR1) gvviY).instance(); - - double dblEmpiricalLoss = 0.; - int iNumSample = adblX.length; - - if (iNumSample != adblY.length) - throw new java.lang.Exception ("L1LossLearner::empiricalLoss => Invalid Inputs"); - - for (int i = 0; i < iNumSample; ++i) - dblEmpiricalLoss += java.lang.Math.abs (funcLearnerR1ToR1.evaluate (adblX[i]) - adblY[i]); - - return dblEmpiricalLoss; - } - - @Override public double empiricalLoss ( - final org.drip.function.definition.RdToR1 funcLearnerRdToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception - { - if (null == funcLearnerRdToR1 || null == gvviX || !(gvviX instanceof - org.drip.spaces.instance.ValidatedRd) || null == gvviY || !(gvviY instanceof - org.drip.spaces.instance.ValidatedR1)) - throw new java.lang.Exception ("L1LossLearner::empiricalLoss => Invalid Inputs"); - - double[][] aadblX = ((org.drip.spaces.instance.ValidatedRd) gvviX).instance(); - - double[] adblY = ((org.drip.spaces.instance.ValidatedR1) gvviY).instance(); - - double dblEmpiricalLoss = 0.; - int iNumSample = aadblX.length; - - if (iNumSample != adblY.length) - throw new java.lang.Exception ("L1LossLearner::empiricalLoss => Invalid Inputs"); - - for (int i = 0; i < iNumSample; ++i) - dblEmpiricalLoss += java.lang.Math.abs (funcLearnerRdToR1.evaluate (aadblX[i]) - adblY[i]); - - return dblEmpiricalLoss; - } - - @Override public double empiricalRisk ( - final org.drip.measure.continuousjoint.R1R1 distR1R1, - final org.drip.function.definition.R1ToR1 funcLearnerR1ToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception - { - if (null == distR1R1 || null == funcLearnerR1ToR1 || null == gvviX || !(gvviX instanceof - org.drip.spaces.instance.ValidatedR1) || null == gvviY || !(gvviY instanceof - org.drip.spaces.instance.ValidatedR1)) - throw new java.lang.Exception ("L1LossLearner::empiricalRisk => Invalid Inputs"); - - double[] adblX = ((org.drip.spaces.instance.ValidatedR1) gvviX).instance(); - - double[] adblY = ((org.drip.spaces.instance.ValidatedR1) gvviY).instance(); - - double dblNormalizer = 0.; - double dblEmpiricalLoss = 0.; - int iNumSample = adblX.length; - - if (iNumSample != adblY.length) - throw new java.lang.Exception ("L1LossLearner::empiricalRisk => Invalid Inputs"); - - for (int i = 0; i < iNumSample; ++i) { - double dblDensity = distR1R1.density (adblX[i], adblY[i]); - - dblNormalizer += dblDensity; - - dblEmpiricalLoss += dblDensity * java.lang.Math.abs (funcLearnerR1ToR1.evaluate (adblX[i]) - - adblY[i]); - } - - return dblEmpiricalLoss / dblNormalizer; - } - - @Override public double empiricalRisk ( - final org.drip.measure.continuousjoint.RdR1 distRdR1, - final org.drip.function.definition.RdToR1 funcLearnerRdToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception - { - if (null == distRdR1 || null == funcLearnerRdToR1 || null == gvviX || !(gvviX instanceof - org.drip.spaces.instance.ValidatedRd) || null == gvviY || !(gvviY instanceof - org.drip.spaces.instance.ValidatedR1)) - throw new java.lang.Exception ("L1LossLearner::empiricalRisk => Invalid Inputs"); - - double[][] aadblX = ((org.drip.spaces.instance.ValidatedRd) gvviX).instance(); - - double[] adblY = ((org.drip.spaces.instance.ValidatedR1) gvviY).instance(); - - double dblNormalizer = 0.; - double dblEmpiricalLoss = 0.; - int iNumSample = aadblX.length; - - if (iNumSample != adblY.length) - throw new java.lang.Exception ("L1LossLearner::empiricalRisk => Invalid Inputs"); - - for (int i = 0; i < iNumSample; ++i) { - double dblDensity = distRdR1.density (aadblX[i], adblY[i]); - - dblNormalizer += dblDensity; - - dblEmpiricalLoss += dblDensity * java.lang.Math.abs (funcLearnerRdToR1.evaluate (aadblX[i]) - - adblY[i]); - } - - return dblEmpiricalLoss / dblNormalizer; - } -} diff --git a/org/drip/learning/rxtor1/LipschitzLossLearner.java b/org/drip/learning/rxtor1/LipschitzLossLearner.java deleted file mode 100644 index 0e694dc..0000000 --- a/org/drip/learning/rxtor1/LipschitzLossLearner.java +++ /dev/null @@ -1,173 +0,0 @@ - -package org.drip.learning.rxtor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * LipschitzLossLearner implements the Learner Class that holds the Space of Normed R^1 To Normed R^1 - * Learning Functions for the Family of Loss Functions that are Lipschitz, i.e., - * - * loss (ep) - loss (ep') Less Than C * |ep-ep'| - * - * The References are: - * - * 1) Alon, N., S. Ben-David, N. Cesa Bianchi, and D. Haussler (1997): Scale-sensitive Dimensions, Uniform - * Convergence, and Learnability, Journal of Association of Computational Machinery, 44 (4) 615-631. - * - * 2) Anthony, M., and P. L. Bartlett (1999): Artificial Neural Network Learning - Theoretical Foundations, - * Cambridge University Press, Cambridge, UK. - * - * 3) Kearns, M. J., R. E. Schapire, and L. M. Sellie (1994): Towards Efficient Agnostic Learning, Machine - * Learning, 17 (2) 115-141. - * - * 4) Lee, W. S., P. L. Bartlett, and R. C. Williamson (1998): The Importance of Convexity in Learning with - * Squared Loss, IEEE Transactions on Information Theory, 44 1974-1980. - * - * 5) Vapnik, V. N. (1998): Statistical Learning Theory, Wiley, New York. - * - * @author Lakshmi Krishnamurthy - */ - -public class LipschitzLossLearner extends org.drip.learning.rxtor1.GeneralizedLearner { - private double _dblLipschitzSlope = java.lang.Double.NaN; - - /** - * LipschitzLossLearner Constructor - * - * @param funcClassRxToR1 R^x To R^1 Function Class - * @param cdpb The Covering Number based Deviation Upper Probability Bound Generator - * @param regularizerFunc The Regularizer Function - * @param dblLipschitzSlope The Lipschitz Slope Bound - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public LipschitzLossLearner ( - final org.drip.spaces.functionclass.NormedRxToNormedR1Finite funcClassRxToR1, - final org.drip.learning.bound.CoveringNumberLossBound cdpb, - final org.drip.learning.regularization.RegularizationFunction regularizerFunc, - final double dblLipschitzSlope) - throws java.lang.Exception - { - super (funcClassRxToR1, cdpb, regularizerFunc); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblLipschitzSlope = dblLipschitzSlope)) - throw new java.lang.Exception ("LipschitzLossLearner ctr: Invalid Inputs"); - } - - /** - * Retrieve the Lipschitz Slope Bound - * - * @return The Lipschitz Slope Bound - */ - - public double lipschitzSlope() - { - return _dblLipschitzSlope; - } - - @Override public double lossSampleCoveringNumber ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi, - final double dblEpsilon, - final boolean bSupremum) - throws java.lang.Exception - { - if (null == gvvi || !org.drip.quant.common.NumberUtil.IsValid (dblEpsilon) || 0. >= dblEpsilon) - throw new java.lang.Exception - ("LipschitzLossLearner::lossSampleCoveringNumber => Invalid Inputs"); - - double dblLipschitzCover = dblEpsilon / _dblLipschitzSlope; - - org.drip.spaces.functionclass.NormedRxToNormedR1Finite funcClassRxToR1 = functionClass(); - - org.drip.learning.bound.LipschitzCoveringNumberBound llcn = new - org.drip.learning.bound.LipschitzCoveringNumberBound (funcClassRxToR1.sampleSupremumCoveringNumber - (gvvi, dblLipschitzCover), funcClassRxToR1.sampleCoveringNumber (gvvi, gvvi.sampleSize() * - dblLipschitzCover)); - - return bSupremum ? llcn.supremumUpperBound() : llcn.lpUpperBound(); - } - - @Override public double empiricalLoss ( - final org.drip.function.definition.R1ToR1 funcLearnerR1ToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception - { - throw new java.lang.Exception ("LipschitzLossLearner::empiricalLoss => No Generic Implementation"); - } - - @Override public double empiricalLoss ( - final org.drip.function.definition.RdToR1 funcLearnerRdToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception - { - throw new java.lang.Exception ("LipschitzLossLearner::empiricalLoss => No Generic Implementation"); - } - - @Override public double empiricalRisk ( - final org.drip.measure.continuousjoint.R1R1 distR1R1, - final org.drip.function.definition.R1ToR1 funcLearnerR1ToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception - { - throw new java.lang.Exception ("LipschitzLossLearner::empiricalRisk => No Generic Implementation"); - } - - @Override public double empiricalRisk ( - final org.drip.measure.continuousjoint.RdR1 distRdR1, - final org.drip.function.definition.RdToR1 funcLearnerRdToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception - { - throw new java.lang.Exception ("LipschitzLossLearner::empiricalRisk => No Generic Implementation"); - } -} diff --git a/org/drip/learning/rxtor1/LpLossLearner.java b/org/drip/learning/rxtor1/LpLossLearner.java deleted file mode 100644 index ad0be73..0000000 --- a/org/drip/learning/rxtor1/LpLossLearner.java +++ /dev/null @@ -1,279 +0,0 @@ - -package org.drip.learning.rxtor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * LpLossLearner implements the Learner Class that holds the Space of Normed R^x To Normed R^1 Learning - * Functions for the Family of Loss Functions that are Polynomial, i.e., - * - * loss (eta) = (eta ^ p) / p, for p greater than 1. - * - * This is Lipschitz, with a Lipschitz Slope of - * - * C = (b - a) ^ (p - 1) - * - * The References are: - * - * 1) Alon, N., S. Ben-David, N. Cesa Bianchi, and D. Haussler (1997): Scale-sensitive Dimensions, Uniform - * Convergence, and Learnability, Journal of Association of Computational Machinery, 44 (4) 615-631. - * - * 2) Anthony, M., and P. L. Bartlett (1999): Artificial Neural Network Learning - Theoretical Foundations, - * Cambridge University Press, Cambridge, UK. - * - * 3) Kearns, M. J., R. E. Schapire, and L. M. Sellie (1994): Towards Efficient Agnostic Learning, Machine - * Learning, 17 (2) 115-141. - * - * 4) Lee, W. S., P. L. Bartlett, and R. C. Williamson (1998): The Importance of Convexity in Learning with - * Squared Loss, IEEE Transactions on Information Theory, 44 1974-1980. - * - * 5) Vapnik, V. N. (1998): Statistical learning Theory, Wiley, New York. - * - * @author Lakshmi Krishnamurthy - */ - -public class LpLossLearner extends org.drip.learning.rxtor1.GeneralizedLearner { - private double _dblLossExponent = java.lang.Double.NaN; - - /** - * LpLossLearner Constructor - * - * @param funcClassRxToR1 R^x To R^1 Function Class - * @param cdpb The Covering Number based Deviation Upper Probability Bound Generator - * @param regularizerFunc The Regularizer Function - * @param dblLossExponent The Loss Exponent - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public LpLossLearner ( - final org.drip.spaces.functionclass.NormedRxToNormedR1Finite funcClassRxToR1, - final org.drip.learning.bound.CoveringNumberLossBound cdpb, - final org.drip.learning.regularization.RegularizationFunction regularizerFunc, - final double dblLossExponent) - throws java.lang.Exception - { - super (funcClassRxToR1, cdpb, regularizerFunc); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblLossExponent = dblLossExponent) || 1. > - _dblLossExponent) - throw new java.lang.Exception ("LpLossLearner ctr: Invalid Inputs"); - } - - /** - * Retrieve the Loss Exponent - * - * @return The Loss Exponent - */ - - public double lossExponent() - { - return _dblLossExponent; - } - - /** - * Retrieve the Lipschitz Slope Bound - * - * @return The Lipschitz Slope Bound - */ - - public double lipschitzSlope() - { - org.drip.spaces.metric.GeneralizedMetricVectorSpace gmvsInput = - functionClass().inputMetricVectorSpace(); - - return java.lang.Math.pow (gmvsInput.rightEdge() - gmvsInput.leftEdge(), _dblLossExponent - 1.); - } - - @Override public double lossSampleCoveringNumber ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi, - final double dblEpsilon, - final boolean bSupremum) - throws java.lang.Exception - { - if (null == gvvi || !org.drip.quant.common.NumberUtil.IsValid (dblEpsilon) || 0. >= dblEpsilon) - throw new java.lang.Exception ("LpLossLearner::lossSampleCoveringNumber => Invalid Inputs"); - - double dblLipschitzCover = dblEpsilon / lipschitzSlope(); - - org.drip.spaces.functionclass.NormedRxToNormedR1Finite funcClassRxToR1 = functionClass(); - - org.drip.learning.bound.LipschitzCoveringNumberBound llcn = new - org.drip.learning.bound.LipschitzCoveringNumberBound - (funcClassRxToR1.sampleSupremumCoveringNumber (gvvi, dblLipschitzCover), - funcClassRxToR1.sampleCoveringNumber (gvvi, gvvi.sampleSize() * dblLipschitzCover)); - - return bSupremum ? llcn.supremumUpperBound() : llcn.lpUpperBound(); - } - - @Override public double empiricalLoss ( - final org.drip.function.definition.R1ToR1 funcLearnerR1ToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception - { - if (null == funcLearnerR1ToR1 || null == gvviX || !(gvviX instanceof - org.drip.spaces.instance.ValidatedR1) || null == gvviY || !(gvviY instanceof - org.drip.spaces.instance.ValidatedR1)) - throw new java.lang.Exception ("LpLossLearner::empiricalLoss => Invalid Inputs"); - - double[] adblX = ((org.drip.spaces.instance.ValidatedR1) gvviX).instance(); - - double[] adblY = ((org.drip.spaces.instance.ValidatedR1) gvviY).instance(); - - double dblEmpiricalLoss = 0.; - int iNumSample = adblX.length; - - if (iNumSample != adblY.length) - throw new java.lang.Exception ("LpLossLearner::empiricalLoss => Invalid Inputs"); - - for (int i = 0; i < iNumSample; ++i) - dblEmpiricalLoss += java.lang.Math.pow (java.lang.Math.abs (funcLearnerR1ToR1.evaluate (adblX[i]) - - adblY[i]), _dblLossExponent); - - return dblEmpiricalLoss / _dblLossExponent; - } - - @Override public double empiricalLoss ( - final org.drip.function.definition.RdToR1 funcLearnerRdToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception - { - if (null == funcLearnerRdToR1 || null == gvviX || !(gvviX instanceof - org.drip.spaces.instance.ValidatedRd) || null == gvviY || !(gvviY instanceof - org.drip.spaces.instance.ValidatedR1)) - throw new java.lang.Exception ("LpLossLearner::empiricalLoss => Invalid Inputs"); - - double[][] aadblX = ((org.drip.spaces.instance.ValidatedRd) gvviX).instance(); - - double[] adblY = ((org.drip.spaces.instance.ValidatedR1) gvviY).instance(); - - double dblEmpiricalLoss = 0.; - int iNumSample = aadblX.length; - - if (iNumSample != adblY.length) - throw new java.lang.Exception ("LpLossLearner::empiricalLoss => Invalid Inputs"); - - for (int i = 0; i < iNumSample; ++i) - dblEmpiricalLoss += java.lang.Math.pow (java.lang.Math.abs (funcLearnerRdToR1.evaluate - (aadblX[i]) - adblY[i]), _dblLossExponent); - - return dblEmpiricalLoss / _dblLossExponent; - } - - @Override public double empiricalRisk ( - final org.drip.measure.continuousjoint.R1R1 distR1R1, - final org.drip.function.definition.R1ToR1 funcLearnerR1ToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception - { - if (null == distR1R1 || null == funcLearnerR1ToR1 || null == gvviX || !(gvviX instanceof - org.drip.spaces.instance.ValidatedR1) || null == gvviY || !(gvviY instanceof - org.drip.spaces.instance.ValidatedR1)) - throw new java.lang.Exception ("LpLossLearner::empiricalRisk => Invalid Inputs"); - - double[] adblX = ((org.drip.spaces.instance.ValidatedR1) gvviX).instance(); - - double[] adblY = ((org.drip.spaces.instance.ValidatedR1) gvviY).instance(); - - double dblNormalizer = 0.; - double dblEmpiricalLoss = 0.; - int iNumSample = adblX.length; - - if (iNumSample != adblY.length) - throw new java.lang.Exception ("LpLossLearner::empiricalRisk => Invalid Inputs"); - - for (int i = 0; i < iNumSample; ++i) { - double dblDensity = distR1R1.density (adblX[i], adblY[i]); - - dblNormalizer += dblDensity; - - dblEmpiricalLoss += dblDensity * java.lang.Math.pow (java.lang.Math.abs - (funcLearnerR1ToR1.evaluate (adblX[i]) - adblY[i]), _dblLossExponent); - } - - return dblEmpiricalLoss / _dblLossExponent / dblNormalizer; - } - - @Override public double empiricalRisk ( - final org.drip.measure.continuousjoint.RdR1 distRdR1, - final org.drip.function.definition.RdToR1 funcLearnerRdToR1, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviX, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviY) - throws java.lang.Exception - { - if (null == distRdR1 || null == funcLearnerRdToR1 || null == gvviX || !(gvviX instanceof - org.drip.spaces.instance.ValidatedRd) || null == gvviY || !(gvviY instanceof - org.drip.spaces.instance.ValidatedR1)) - throw new java.lang.Exception ("LpLossLearner::empiricalRisk => Invalid Inputs"); - - double[][] aadblX = ((org.drip.spaces.instance.ValidatedRd) gvviX).instance(); - - double[] adblY = ((org.drip.spaces.instance.ValidatedR1) gvviY).instance(); - - double dblNormalizer = 0.; - double dblEmpiricalLoss = 0.; - int iNumSample = aadblX.length; - - if (iNumSample != adblY.length) - throw new java.lang.Exception ("LpLossLearner::empiricalRisk => Invalid Inputs"); - - for (int i = 0; i < iNumSample; ++i) { - double dblDensity = distRdR1.density (aadblX[i], adblY[i]); - - dblNormalizer += dblDensity; - - dblEmpiricalLoss += dblDensity * java.lang.Math.pow (java.lang.Math.abs - (funcLearnerRdToR1.evaluate (aadblX[i]) - adblY[i]), _dblLossExponent); - } - - return dblEmpiricalLoss / _dblLossExponent / dblNormalizer; - } -} diff --git a/org/drip/learning/svm/DecisionFunctionOperatorBounds.java b/org/drip/learning/svm/DecisionFunctionOperatorBounds.java deleted file mode 100644 index 3fc41a9..0000000 --- a/org/drip/learning/svm/DecisionFunctionOperatorBounds.java +++ /dev/null @@ -1,278 +0,0 @@ - -package org.drip.learning.svm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * DecisionFunctionOperatorBounds implements the Dot Product Entropy Number Upper Bounds for the Product of - * Kernel Feature Map Function and the Scaling Diagonal Operator. - * - * The References are: - * - * 1) Ash, R. (1965): Information Theory, Inter-science New York. - * - * 2) Konig, H. (1986): Eigenvalue Distribution of Compact Operators, Birkhauser, Basel, Switzerland. - * - * 3) Gordon, Y., H. Konig, and C. Schutt (1987): Geometric and Probabilistic Estimates of Entropy and - * Approximation Numbers of Operators, Journal of Approximation Theory 49 219-237. - * - * 4) Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * 5) Smola, A. J., A. Elisseff, B. Scholkopf, and R. C. Williamson (2000): Entropy Numbers for Convex - * Combinations and mlps, in: Advances in Large Margin Classifiers, A. Smola, P. Bartlett, B. Scholkopf, - * and D. Schuurmans - editors, MIT Press, Cambridge, MA. - * - * @author Lakshmi Krishnamurthy - */ - -public class DecisionFunctionOperatorBounds { - private int _iFeatureSpaceDimension = -1; - private double _dblInverseMarginNormBound = java.lang.Double.NaN; - private double _dblFeatureSpaceMaureyConstant = java.lang.Double.NaN; - private org.drip.learning.kernel.DiagonalScalingOperator _dsoFactorizer = null; - - /** - * DecisionFunctionOperatorBounds Constructor - * - * @param dsoFactorizer The Factorizing Diagonal Scaling Operator - * @param dblInverseMarginNormBound The Decision Function Inverse Margin Norm Bound - * @param dblFeatureSpaceMaureyConstant The Kernel Feature Space Function Maurey Constant - * @param iFeatureSpaceDimension The Kernel Feature Space Dimension - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public DecisionFunctionOperatorBounds ( - final org.drip.learning.kernel.DiagonalScalingOperator dsoFactorizer, - final double dblInverseMarginNormBound, - final double dblFeatureSpaceMaureyConstant, - final int iFeatureSpaceDimension) - throws java.lang.Exception - { - if (null == (_dsoFactorizer = dsoFactorizer) || !org.drip.quant.common.NumberUtil.IsValid - (_dblInverseMarginNormBound = dblInverseMarginNormBound) || - !org.drip.quant.common.NumberUtil.IsValid (_dblFeatureSpaceMaureyConstant = - dblFeatureSpaceMaureyConstant) || 0 >= (_iFeatureSpaceDimension = - iFeatureSpaceDimension)) - throw new java.lang.Exception ("DecisionFunctionOperatorBounds ctr => Invalid Inputs"); - } - - /** - * Retrieve the Factorizing Diagonal Scaling Operator Instance - * - * @return The Factorizing Diagonal Scaling Operator Instance - */ - - public org.drip.learning.kernel.DiagonalScalingOperator factorizingOperator() - { - return _dsoFactorizer; - } - - /** - * Retrieve the Norm Upper Bound of the Inverse Margin - * - * @return The Norm Upper Bound of the Inverse Margin - */ - - public double inverseMarginNormBound() - { - return _dblInverseMarginNormBound; - } - - /** - * Retrieve the Feature Space Maurey Constant - * - * @return The Feature Space Maurey Constant - */ - - public double featureSpaceMaureyConstant() - { - return _dblFeatureSpaceMaureyConstant; - } - - /** - * Retrieve the Feature Space Dimension - * - * @return The Feature Space Dimension - */ - - public double featureSpaceDimension() - { - return _iFeatureSpaceDimension; - } - - /** - * Compute the Feature Space's Maurey Bound for the Entropy Number given the specified Entropy Number - * - * @param iFeatureSpaceEntropyNumber The Feature Space Entropy Number - * - * @return The Feature Space's Maurey Bound for the specified Entropy Number - * - * @throws java.lang.Exception The Feature Space's Maurey Bound cannot be computed - */ - - public double featureSpaceMaureyBound ( - final int iFeatureSpaceEntropyNumber) - throws java.lang.Exception - { - if (0 >= iFeatureSpaceEntropyNumber) - throw new java.lang.Exception - ("DecisionFunctionOperatorBounds::featureSpaceMaureyBound => Invalid Inputs"); - - return java.lang.Math.sqrt (1. / (iFeatureSpaceEntropyNumber * java.lang.Math.sqrt - (java.lang.Math.log (1. + (((double) _iFeatureSpaceDimension) / java.lang.Math.log - (iFeatureSpaceEntropyNumber)))))); - } - - /** - * Compute the Decision Function Entropy Number Upper Bound using the Product of the Feature Space's - * Maurey Upper Bound for the Entropy for the specified Entropy Number and the Scaling Operator Entropy - * Number Upper Bound - * - * @param iFeatureSpaceEntropyNumber The Feature Space Entropy Number - * - * @return The Feature Space's Operator Entropy for the specified Entropy Number - * - * @throws java.lang.Exception The Feature Space's Operator Entropy cannot be computed - */ - - public double featureMaureyOperatorEntropy ( - final int iFeatureSpaceEntropyNumber) - throws java.lang.Exception - { - return _dblInverseMarginNormBound * _dsoFactorizer.entropyNumberUpperBound() * - featureSpaceMaureyBound (iFeatureSpaceEntropyNumber); - } - - /** - * Compute the Decision Function Entropy Number Upper Bound using the Product of the Feature Space's - * Maurey Upper Bound for the Entropy for the specified Entropy Number and the Scaling Operator Norm - * - * @param iFeatureSpaceEntropyNumber The Feature Space Entropy Number - * - * @return The Feature Space's Operator Norm for the specified Entropy Number - * - * @throws java.lang.Exception The Feature Space's Operator Norm cannot be computed - */ - - public double featureMaureyOperatorNorm ( - final int iFeatureSpaceEntropyNumber) - throws java.lang.Exception - { - return _dblInverseMarginNormBound * _dsoFactorizer.norm() * featureSpaceMaureyBound - (iFeatureSpaceEntropyNumber); - } - - /** - * Compute the Decision Function Entropy Number Upper Bound using the Product of the Feature Space's - * Norm for the Upper Bound of the Entropy Number and the Scaling Operator Norm - * - * @return The Entropy Number Upper Bound using the Product Norm - * - * @throws java.lang.Exception The Entropy Number Upper Bound cannot be computed - */ - - public double productFeatureOperatorNorm() - throws java.lang.Exception - { - return _dblInverseMarginNormBound * _dsoFactorizer.norm(); - } - - /** - * Compute the Decision Function Entropy Number Upper Bound using the Product of the Feature Space's - * Norm for the Upper Bound of the Entropy Number and the Scaling Operator Entropy Number Upper Bound - * - * @return The Entropy Number Upper Bound using the Product Norm - * - * @throws java.lang.Exception The Entropy Number Upper Bound cannot be computed - */ - - public double featureNormOperatorEntropy() - throws java.lang.Exception - { - return _dblInverseMarginNormBound * _dsoFactorizer.entropyNumberUpperBound(); - } - - /** - * Compute the Infimum of the Decision Function Operator Upper Bound across all the Product Bounds for - * the specified Feature Space Entropy Number - * - * @param iFeatureSpaceEntropyNumber The specified Feature Space Entropy Number - * - * @return Infimum of the Decision Function Operator Upper Bound - * - * @throws java.lang.Exception Thrown if the Infimum of the Decision Function Operator Upper Bound cannot - * be calculated - */ - - public double infimumUpperBound ( - final int iFeatureSpaceEntropyNumber) - throws java.lang.Exception - { - double dblFactorizerNorm = _dsoFactorizer.norm(); - - double dblFactorizerEntropyUpperBound = _dsoFactorizer.entropyNumberUpperBound(); - - double dblFeatureSpaceMaureyBound = featureSpaceMaureyBound (iFeatureSpaceEntropyNumber); - - double dblProductFeatureOperatorNorm = _dblInverseMarginNormBound * dblFactorizerNorm; - double dblFeatureMaureyOperatorNorm = dblProductFeatureOperatorNorm * dblFeatureSpaceMaureyBound; - double dblFeatureNormOperatorEntropy = _dblInverseMarginNormBound * dblFactorizerEntropyUpperBound; - double dblInfimumUpperBound = dblFeatureNormOperatorEntropy * dblFeatureSpaceMaureyBound; - - if (dblInfimumUpperBound > dblFeatureMaureyOperatorNorm) - dblInfimumUpperBound = dblFeatureMaureyOperatorNorm; - - if (dblInfimumUpperBound > dblProductFeatureOperatorNorm) - dblInfimumUpperBound = dblProductFeatureOperatorNorm; - - return dblInfimumUpperBound > dblFeatureNormOperatorEntropy ? dblInfimumUpperBound : - dblFeatureNormOperatorEntropy; - } -} diff --git a/org/drip/learning/svm/KernelRdDecisionFunction.java b/org/drip/learning/svm/KernelRdDecisionFunction.java deleted file mode 100644 index 3c28d95..0000000 --- a/org/drip/learning/svm/KernelRdDecisionFunction.java +++ /dev/null @@ -1,141 +0,0 @@ - -package org.drip.learning.svm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * KernelRdDecisionFunction implements the Kernel-based R^d Decision Function-Based SVM Functionality for - * Classification and Regression. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class KernelRdDecisionFunction extends org.drip.learning.svm.RdDecisionFunction { - private double[][] _aadblKernelPredictorPivot = null; - private org.drip.learning.kernel.SymmetricRdToNormedRdKernel _kernel = null; - - /** - * KernelRdDecisionFunction Constructor - * - * @param rdInverseMargin The Inverse Margin Weights R^d Space - * @param adblInverseMarginWeight Array of Inverse Margin Weights - * @param dblB The Kernel Offset - * @param kernel The Kernel - * @param aadblKernelPredictorPivot Array of the Kernel R^d Predictor Pivot Nodes - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public KernelRdDecisionFunction ( - final org.drip.spaces.metric.RdNormed rdInverseMargin, - final double[] adblInverseMarginWeight, - final double dblB, - final org.drip.learning.kernel.SymmetricRdToNormedRdKernel kernel, - final double[][] aadblKernelPredictorPivot) - throws java.lang.Exception - { - super (kernel.inputMetricVectorSpace(), rdInverseMargin, adblInverseMarginWeight, dblB); - - if (null == (_kernel = kernel) || null == (_aadblKernelPredictorPivot = aadblKernelPredictorPivot)) - throw new java.lang.Exception ("KernelRdDecisionFunction ctr: Invalid Inputs"); - - int iKernelInputDimension = _kernel.inputMetricVectorSpace().dimension(); - - int iNumPredictorPivot = adblInverseMarginWeight.length; - - if (0 == iNumPredictorPivot || iNumPredictorPivot != _aadblKernelPredictorPivot.length) - throw new java.lang.Exception ("KernelRdDecisionFunction ctr: Invalid Inputs"); - - for (int i = 0; i < iNumPredictorPivot; ++i) { - if (null == _aadblKernelPredictorPivot[i] || _aadblKernelPredictorPivot[i].length != - iKernelInputDimension) - throw new java.lang.Exception ("KernelRdDecisionFunction ctr: Invalid Inputs"); - } - } - - @Override public double evaluate ( - final double[] adblX) - throws java.lang.Exception - { - if (null == adblX || adblX.length != _kernel.inputMetricVectorSpace().dimension()) - throw new java.lang.Exception ("KernelRdDecisionFunction::evaluate => Invalid Inputs"); - - double[] adblInverseMarginWeight = inverseMarginWeights(); - - double dblDotProduct = 0.; - int iNumPredictorPivot = adblInverseMarginWeight.length; - - for (int i = 0; i < iNumPredictorPivot; ++i) - dblDotProduct += adblInverseMarginWeight[i] * _kernel.evaluate (_aadblKernelPredictorPivot[i], - adblX); - - return dblDotProduct + offset(); - } - - /** - * Retrieve the Decision Kernel - * - * @return The Decision Kernel - */ - - public org.drip.learning.kernel.SymmetricRdToNormedRdKernel kernel() - { - return _kernel; - } - - /** - * Retrieve the Decision Kernel Predictor Pivot Nodes - * - * @return The Decision Kernel Predictor Pivot Nodes - */ - - public double[][] kernelPredictorPivot() - { - return _aadblKernelPredictorPivot; - } -} diff --git a/org/drip/learning/svm/LinearRdDecisionFunction.java b/org/drip/learning/svm/LinearRdDecisionFunction.java deleted file mode 100644 index 0e910ef..0000000 --- a/org/drip/learning/svm/LinearRdDecisionFunction.java +++ /dev/null @@ -1,98 +0,0 @@ - -package org.drip.learning.svm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * LinearRdDecisionFunction implements the Linear R^d Decision Function-Based SVM Functionality for - * Classification and Regression. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class LinearRdDecisionFunction extends org.drip.learning.svm.RdDecisionFunction { - - /** - * LinearRdDecisionFunction Constructor - * - * @param gmvsPredictor The R^d Metric Input Predictor Space - * @param rmnsInverseMargin The Inverse Margin Weights R^d L2 Space - * @param adblInverseMarginWeight Array of Inverse Margin Weights - * @param dblB The Offset - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public LinearRdDecisionFunction ( - final org.drip.spaces.tensor.RdGeneralizedVector gmvsPredictor, - final org.drip.spaces.metric.RdNormed rmnsInverseMargin, - final double[] adblInverseMarginWeight, - final double dblB) - throws java.lang.Exception - { - super (gmvsPredictor, rmnsInverseMargin, adblInverseMarginWeight, dblB); - } - - @Override public double evaluate ( - final double[] adblX) - throws java.lang.Exception - { - if (!predictorSpace().validateInstance (adblX)) - throw new java.lang.Exception ("LinearRdDecisionFunction::evaluate => Invalid Inputs"); - - double dblDotProduct = 0.; - int iDimension = adblX.length; - - double[] adblInverseMarginWeight = inverseMarginWeights(); - - for (int i = 0; i < iDimension; ++i) - dblDotProduct += adblInverseMarginWeight[i] * adblX[i]; - - return dblDotProduct + offset(); - } -} diff --git a/org/drip/learning/svm/RdDecisionFunction.java b/org/drip/learning/svm/RdDecisionFunction.java deleted file mode 100644 index ab6e85d..0000000 --- a/org/drip/learning/svm/RdDecisionFunction.java +++ /dev/null @@ -1,269 +0,0 @@ - -package org.drip.learning.svm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RdDecisionFunction exposes the R^d Decision-Function Based SVM Functionality for Classification and - * Regression. - * - * The References are: - * - * 1) Vapnik, V., and A. Chervonenkis (1974): Theory of Pattern Recognition (in Russian), Nauka, Moscow - * USSR. - * - * 2) Vapnik, V. (1995): The Nature of Statistical Learning, Springer-Verlag, New York. - * - * 3) Shawe-Taylor, J., P. L. Bartlett, R. C. Williamson, and M. Anthony (1996): A Framework for Structural - * Risk Minimization, in: Proceedings of the 9th Annual Conference on Computational Learning Theory, ACM - * New York 68-76. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class RdDecisionFunction extends org.drip.function.definition.RdToR1 { - private double _dblB = java.lang.Double.NaN; - private double[] _adblInverseMarginWeight = null; - private org.drip.spaces.metric.RdNormed _rdInverseMargin = null; - private org.drip.spaces.tensor.RdGeneralizedVector _rdPredictor = null; - - /** - * RdDecisionFunction Constructor - * - * @param rdPredictor The R^d Metric Input Predictor Space - * @param rdInverseMargin The Inverse Margin Weights R^d Space - * @param adblInverseMarginWeight Array of Inverse Margin Weights - * @param dblB The Kernel Offset - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public RdDecisionFunction ( - final org.drip.spaces.tensor.RdGeneralizedVector rdPredictor, - final org.drip.spaces.metric.RdNormed rdInverseMargin, - final double[] adblInverseMarginWeight, - final double dblB) - throws java.lang.Exception - { - super (null); - - if (null == (_rdPredictor = rdPredictor) || null == (_rdInverseMargin = rdInverseMargin) || null == - (_adblInverseMarginWeight = adblInverseMarginWeight) || !org.drip.quant.common.NumberUtil.IsValid - (_dblB = dblB)) - throw new java.lang.Exception ("RdDecisionFunction ctr: Invalid Inputs"); - - int iNumMarginWeight = _adblInverseMarginWeight.length; - - if (0 == iNumMarginWeight || iNumMarginWeight != _rdPredictor.dimension()) - throw new java.lang.Exception ("RdDecisionFunction ctr: Invalid Inputs"); - } - - /** - * Retrieve the Input Predictor Metric Vector Space - * - * @return The Input Predictor Metric Vector Space - */ - - public org.drip.spaces.tensor.RdGeneralizedVector predictorSpace() - { - return _rdPredictor; - } - - /** - * Retrieve the Inverse Margin Weight Metric Vector Space - * - * @return The Inverse Margin Weight Metric Vector Space - */ - - public org.drip.spaces.metric.RdNormed inverseMarginSpace() - { - return _rdInverseMargin; - } - - /** - * Retrieve the Decision Kernel Weights - * - * @return The Decision Kernel Weights - */ - - public double[] inverseMarginWeights() - { - return _adblInverseMarginWeight; - } - - /** - * Retrieve the Offset - * - * @return The Offset - */ - - public double offset() - { - return _dblB; - } - - /** - * Classify the Specified Multi-dimensional Point - * - * @param adblX The Multi-dimensional Input Point - * - * @return +1/-1 Boolean Space Output Equivalents - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public short classify ( - final double[] adblX) - throws java.lang.Exception - { - return evaluate (adblX) > 0. ? org.drip.spaces.tensor.BinaryBooleanVector.BBV_UP : - org.drip.spaces.tensor.BinaryBooleanVector.BBV_DOWN; - } - - /** - * Regress on the Specified Multi-dimensional Point - * - * @param adblX The Multi-dimensional Input Point - * - * @return The Regression Output - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double regress ( - final double[] adblX) - throws java.lang.Exception - { - return evaluate (adblX); - } - - /** - * Compute the Entropy Number Upper Bounds Instance for the Specified Inputs - * - * @param dsoFactorizer The Factorizing Diagonal Scaling Operator - * @param dblFeatureSpaceMaureyConstant The Feature Space Maurey Constant - * - * @return The Entropy Number Upper Bounds Instance - */ - - public org.drip.learning.svm.DecisionFunctionOperatorBounds entropyNumberUpperBounds ( - final org.drip.learning.kernel.DiagonalScalingOperator dsoFactorizer, - final double dblFeatureSpaceMaureyConstant) - { - try { - return new org.drip.learning.svm.DecisionFunctionOperatorBounds (dsoFactorizer, - inverseMarginSpace().populationMetricNorm(), dblFeatureSpaceMaureyConstant, - predictorSpace().dimension()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Decision Function's Asymptotic Exponent for the Entropy Number - * - * @param dsoFactorizer The Factorizing Diagonal Scaling Operator - * - * @return The Decision Function's Asymptotic Exponent for the Entropy Number - * - * @throws java.lang.Exception Thrown if the Asymptotoc Exponent cannot be computed - */ - - public double logEntropyNumberAsymptote ( - final org.drip.learning.kernel.DiagonalScalingOperator dsoFactorizer) - throws java.lang.Exception - { - if (null == dsoFactorizer) - throw new java.lang.Exception - ("RdDecisionFunction::logEntropyNumberAsymptote => Invalid Inputs"); - - org.drip.learning.bound.DiagonalOperatorCoveringBound docb = dsoFactorizer.entropyNumberAsymptote(); - - if (null == docb) - throw new java.lang.Exception - ("RdDecisionFunction::logEntropyNumberAsymptote => Cannot get Diagonal Operator Covering Bounds"); - - return org.drip.learning.bound.DiagonalOperatorCoveringBound.BASE_DIAGONAL_ENTROPY_ASYMPTOTE_EXPONENT - == docb.entropyNumberAsymptoteType() ? -1. * docb.entropyNumberAsymptoteExponent() - 0.5 : - -1. * docb.entropyNumberAsymptoteExponent(); - } - - /** - * Optimize the Hyper-plane for the Purposes of Regression - * - * @param adblEmpirical The Empirical Observation Array - * @param dblMargin The Optimization Margin - * @param dblInverseWidthNormConstraint The Inverse Width Norm Constraint - * - * @return TRUE - The Hyper-plane has been successfully Optimized for Regression - */ - - public abstract boolean optimizeRegressionHyperplane ( - final double[] adblEmpirical, - final double dblMargin, - final double dblInverseWidthNormConstraint - ); - - /** - * Optimize the Hyper-plane for the Purposes of Classification - * - * @param asEmpirical The Empirical Observation Array - * @param dblMargin The Optimization Margin - * @param dblInverseWidthNormConstraint The Inverse Width Norm Constraint - * - * @return TRUE - The Hyper-plane has been successfully Optimized for Classification - */ - - public abstract boolean optimizeClassificationHyperplane ( - final short[] asEmpirical, - final double dblMargin, - final double dblInverseWidthNormConstraint - ); -} diff --git a/org/drip/market/definition/FXSettingContainer.java b/org/drip/market/definition/FXSettingContainer.java deleted file mode 100644 index 1755a17..0000000 --- a/org/drip/market/definition/FXSettingContainer.java +++ /dev/null @@ -1,211 +0,0 @@ - -package org.drip.market.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FXSettingContainer contains the Parameters related to the FX Settings. - * - * @author Lakshmi Krishnamurthy - */ - -public class FXSettingContainer { - private static final java.util.Map _mapCurrencyOrder = new - java.util.TreeMap(); - - private static final java.util.Map - _mapCurrencyPair = new java.util.TreeMap(); - - private static final void SetUpCurrencyPair ( - final java.lang.String strCurrency1, - final java.lang.String strCurrency2, - final org.drip.product.params.CurrencyPair cp) - { - _mapCurrencyPair.put (strCurrency1 + strCurrency2, cp); - - _mapCurrencyPair.put (strCurrency2 + strCurrency1, cp); - } - - /** - * Initialize the FXSettingContainer - * - * @return TRUE - FXSettingsContainer successfully initialized - */ - - public static final boolean Init() - { - _mapCurrencyOrder.put ("EUR", 1); - - _mapCurrencyOrder.put ("GBP", 2); - - _mapCurrencyOrder.put ("AUD", 3); - - _mapCurrencyOrder.put ("NZD", 4); - - _mapCurrencyOrder.put ("USD", 5); - - _mapCurrencyOrder.put ("CAD", 6); - - _mapCurrencyOrder.put ("CHF", 7); - - _mapCurrencyOrder.put ("JPY", 8); - - try { - SetUpCurrencyPair ("AUD", "EUR", new org.drip.product.params.CurrencyPair ("AUD", "EUR", "EUR", - 10000.)); - - SetUpCurrencyPair ("AUD", "USD", new org.drip.product.params.CurrencyPair ("AUD", "USD", "USD", - 10000.)); - - SetUpCurrencyPair ("EUR", "GBP", new org.drip.product.params.CurrencyPair ("EUR", "GBP", "GBP", - 10000.)); - - SetUpCurrencyPair ("EUR", "JPY", new org.drip.product.params.CurrencyPair ("EUR", "JPY", "JPY", - 100.)); - - SetUpCurrencyPair ("EUR", "USD", new org.drip.product.params.CurrencyPair ("EUR", "USD", "USD", - 10000.)); - - SetUpCurrencyPair ("GBP", "JPY", new org.drip.product.params.CurrencyPair ("GBP", "JPY", "JPY", - 100.)); - - SetUpCurrencyPair ("GBP", "USD", new org.drip.product.params.CurrencyPair ("GBP", "USD", "USD", - 10000.)); - - SetUpCurrencyPair ("USD", "BRL", new org.drip.product.params.CurrencyPair ("USD", "BRL", "BRL", - 10000.)); - - SetUpCurrencyPair ("USD", "CAD", new org.drip.product.params.CurrencyPair ("USD", "CAD", "CAD", - 10000.)); - - SetUpCurrencyPair ("USD", "CHF", new org.drip.product.params.CurrencyPair ("USD", "CHF", "CHF", - 10000.)); - - SetUpCurrencyPair ("USD", "CNY", new org.drip.product.params.CurrencyPair ("USD", "CNY", "CNY", - 1.)); - - SetUpCurrencyPair ("USD", "EGP", new org.drip.product.params.CurrencyPair ("USD", "EGP", "EGP", - 10000.)); - - SetUpCurrencyPair ("USD", "HUF", new org.drip.product.params.CurrencyPair ("USD", "HUF", "HUF", - 100.)); - - SetUpCurrencyPair ("USD", "INR", new org.drip.product.params.CurrencyPair ("USD", "INR", "INR", - 100.)); - - SetUpCurrencyPair ("USD", "JPY", new org.drip.product.params.CurrencyPair ("USD", "JPY", "JPY", - 100.)); - - SetUpCurrencyPair ("USD", "KRW", new org.drip.product.params.CurrencyPair ("USD", "KRW", "KRW", - 1.)); - - SetUpCurrencyPair ("USD", "MXN", new org.drip.product.params.CurrencyPair ("USD", "MXN", "MXN", - 10000.)); - - SetUpCurrencyPair ("USD", "PLN", new org.drip.product.params.CurrencyPair ("USD", "PLN", "PLN", - 100.)); - - SetUpCurrencyPair ("USD", "TRY", new org.drip.product.params.CurrencyPair ("USD", "TRY", "TRY", - 100.)); - - SetUpCurrencyPair ("USD", "TWD", new org.drip.product.params.CurrencyPair ("USD", "TWD", "TWD", - 1.)); - - SetUpCurrencyPair ("USD", "ZAR", new org.drip.product.params.CurrencyPair ("USD", "ZAR", "ZAR", - 10000.)); - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - /** - * Retrieve the Order corresponding to the specified Currency - * - * @param strCurrency The Currency - * - * @return The Order corresponding to the specified Currency - * - * @throws java.lang.Exception Thrown if Inputs of Invalid - */ - - public static final int CurrencyOrder ( - final java.lang.String strCurrency) - throws java.lang.Exception - { - if (null == strCurrency || strCurrency.isEmpty()) - throw new java.lang.Exception ("FXSettingsContainer::CurrencyOrder => Invalid Input"); - - return _mapCurrencyOrder.containsKey (strCurrency) ? _mapCurrencyOrder.get (strCurrency) : 0; - } - - /** - * Retrieve the Currency Pair Instance from the specified Currencies - * - * @param strCurrency1 Currency #1 - * @param strCurrency2 Currency #2 - * - * @return The Currency Pair Instance - */ - - public static final org.drip.product.params.CurrencyPair CurrencyPair ( - final java.lang.String strCurrency1, - final java.lang.String strCurrency2) - { - if (null == strCurrency1 || strCurrency1.isEmpty() || null == strCurrency2 || strCurrency2.isEmpty()) - return null; - - java.lang.String strCurrencyPairCode = strCurrency1 + strCurrency2; - - return _mapCurrencyPair.containsKey (strCurrencyPairCode) ? _mapCurrencyPair.get - (strCurrencyPairCode) : null; - } -} diff --git a/org/drip/market/definition/FloaterIndex.java b/org/drip/market/definition/FloaterIndex.java deleted file mode 100644 index aaede62..0000000 --- a/org/drip/market/definition/FloaterIndex.java +++ /dev/null @@ -1,194 +0,0 @@ - -package org.drip.market.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FloaterIndex contains the definitions of the floating rate indexes of different jurisdictions. - * - * @author Lakshmi Krishnamurthy - */ - -abstract public class FloaterIndex { - private java.lang.String _strName = ""; - private java.lang.String _strFamily = ""; - private int _iAccrualCompoundingRule = -1; - private java.lang.String _strCalendar = ""; - private java.lang.String _strCurrency = ""; - private java.lang.String _strDayCount = ""; - - /** - * FloaterIndex Constructor - * - * @param strName Index Name - * @param strFamily Index Family - * @param strCurrency Index Currency - * @param strDayCount Index Day Count - * @param strCalendar Index Holiday Calendar - * @param iAccrualCompoundingRule Accrual Compounding Rule - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public FloaterIndex ( - final java.lang.String strName, - final java.lang.String strFamily, - final java.lang.String strCurrency, - final java.lang.String strDayCount, - final java.lang.String strCalendar, - final int iAccrualCompoundingRule) - throws java.lang.Exception - { - if (null == (_strName = strName) || _strName.isEmpty() || null == (_strFamily = strFamily) || - _strFamily.isEmpty() || null == (_strCurrency = strCurrency) || _strCurrency.isEmpty() || null == - (_strDayCount = strDayCount) || _strDayCount.isEmpty() || - !org.drip.analytics.support.CompositePeriodBuilder.ValidateCompoundingRule - (_iAccrualCompoundingRule = iAccrualCompoundingRule)) - throw new java.lang.Exception ("FloaterIndex ctr: Invalid Inputs"); - - _strCalendar = strCalendar; - } - - /** - * Retrieve the Index Name - * - * @return The Index Name - */ - - public java.lang.String name() - { - return _strName; - } - - /** - * Retrieve the Index Family - * - * @return The Index Family - */ - - public java.lang.String family() - { - return _strFamily; - } - - /** - * Retrieve the Index Holiday Calendar - * - * @return The Index Holiday Calendar - */ - - public java.lang.String calendar() - { - return _strCalendar; - } - - /** - * Retrieve the Index Currency - * - * @return The Index Currency - */ - - public java.lang.String currency() - { - return _strCurrency; - } - - /** - * Retrieve the Index Day Count Convention - * - * @return The Index Day Count Convention - */ - - public java.lang.String dayCount() - { - return _strDayCount; - } - - /** - * Retrieve the Accrual Compounding Rule - * - * @return The Accrual Compounding Rule - */ - - public int accrualCompoundingRule() - { - return _iAccrualCompoundingRule; - } - - /** - * Retrieve the Spot Lag DAP with Date Roll Previous - * - * @return The Spot Lag DAP with Date Roll Previous - */ - - public org.drip.analytics.daycount.DateAdjustParams spotLagDAPBackward() - { - return new org.drip.analytics.daycount.DateAdjustParams - (org.drip.analytics.daycount.Convention.DATE_ROLL_PREVIOUS, spotLag(), _strCalendar); - } - - /** - * Retrieve the Spot Lag DAP with Date Roll Following - * - * @return The Spot Lag DAP with Date Roll Following - */ - - public org.drip.analytics.daycount.DateAdjustParams spotLagDAPForward() - { - return new org.drip.analytics.daycount.DateAdjustParams - (org.drip.analytics.daycount.Convention.DATE_ROLL_FOLLOWING, spotLag(), _strCalendar); - } - - /** - * Retrieve the Index Spot Lag - * - * @return The Index Spot Lag - */ - - abstract public int spotLag(); -} diff --git a/org/drip/market/definition/IBORIndex.java b/org/drip/market/definition/IBORIndex.java deleted file mode 100644 index f775b54..0000000 --- a/org/drip/market/definition/IBORIndex.java +++ /dev/null @@ -1,124 +0,0 @@ - -package org.drip.market.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * IBORIndex contains the definitions of the IBOR indexes of different jurisdictions. - * - * @author Lakshmi Krishnamurthy - */ - -public class IBORIndex extends org.drip.market.definition.FloaterIndex { - private int _iSpotLag = 0; - private java.lang.String _strLongestMaturity = ""; - private java.lang.String _strShortestMaturity = ""; - - /** - * IBORIndex Constructor - * - * @param strName Index Name - * @param strFamily Index Family - * @param strCurrency Index Currency - * @param strDayCount Index Day Count - * @param strCalendar Index Holiday Calendar - * @param iSpotLag The Spot Lag - * @param strShortestMaturity Index Shortest Maturity - * @param strLongestMaturity Index Longest Maturity - * @param iAccrualCompoundingRule Accrual Compounding Rule - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public IBORIndex ( - final java.lang.String strName, - final java.lang.String strFamily, - final java.lang.String strCurrency, - final java.lang.String strDayCount, - final java.lang.String strCalendar, - final int iSpotLag, - final java.lang.String strShortestMaturity, - final java.lang.String strLongestMaturity, - final int iAccrualCompoundingRule) - throws java.lang.Exception - { - super (strName, strFamily, strCurrency, strDayCount, strCalendar, iAccrualCompoundingRule); - - if (0 > (_iSpotLag = iSpotLag)) throw new java.lang.Exception ("IBORIndex ctr: Invalid Inputs"); - - _strLongestMaturity = strLongestMaturity; - _strShortestMaturity = strShortestMaturity; - } - - @Override public int spotLag() - { - return _iSpotLag; - } - - /** - * Retrieve the Index Shortest Maturity - * - * @return The Index Shortest Maturity - */ - - public java.lang.String shortestMaturity() - { - return _strShortestMaturity; - } - - /** - * Retrieve the Longest Maturity - * - * @return The Index Longest Maturity - */ - - public java.lang.String longestMaturity() - { - return _strLongestMaturity; - } -} diff --git a/org/drip/market/definition/IBORIndexContainer.java b/org/drip/market/definition/IBORIndexContainer.java deleted file mode 100644 index 0e34a6f..0000000 --- a/org/drip/market/definition/IBORIndexContainer.java +++ /dev/null @@ -1,394 +0,0 @@ - -package org.drip.market.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * IBORIndexContainer holds the definitions of the IBOR index definitions corresponding to the different - * jurisdictions. - * - * @author Lakshmi Krishnamurthy - */ - -public class IBORIndexContainer { - private static final - org.drip.analytics.support.CaseInsensitiveTreeMap - _mapJurisdictionIBORIndex = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private static final - org.drip.analytics.support.CaseInsensitiveTreeMap - _mapNamedIBORIndex = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - /** - * Initialize the IBOR Index Container with the Overnight Indexes - * - * @return TRUE - The IBOR Index Container successfully initialized with the indexes - */ - - public static final boolean Init() - { - try { - org.drip.market.definition.IBORIndex iborAUD = new org.drip.market.definition.IBORIndex - ("AUD-BBSW", "BBSW", "AUD", "Act/365", "AUD", 0, "1M", "6M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("AUD", iborAUD); - - _mapNamedIBORIndex.put ("AUD-BBSW", iborAUD); - - _mapNamedIBORIndex.put ("AUD-LIBOR", iborAUD); - - org.drip.market.definition.IBORIndex iborCAD = new org.drip.market.definition.IBORIndex - ("CAD-CDOR", "CDOR", "CAD", "Act/365", "CAD", 0, "1M", "12M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("CAD", iborCAD); - - _mapNamedIBORIndex.put ("CAD-CDOR", iborCAD); - - _mapNamedIBORIndex.put ("CAD-LIBOR", iborCAD); - - org.drip.market.definition.IBORIndex iborCHF = new org.drip.market.definition.IBORIndex - ("CHF-LIBOR", "LIBOR", "CHF", "Act/360", "CHF", 2, "ON", "12M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("CHF", iborCHF); - - _mapNamedIBORIndex.put ("CHF-LIBOR", iborCHF); - - org.drip.market.definition.IBORIndex iborCLP = new org.drip.market.definition.IBORIndex - ("CLP-LIBOR", "LIBOR", "CLP", "Act/360", "CLP", 2, "ON", "12M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("CLP", iborCLP); - - _mapNamedIBORIndex.put ("CLP-LIBOR", iborCLP); - - org.drip.market.definition.IBORIndex iborCNY = new org.drip.market.definition.IBORIndex - ("CNY-Repo", "Repo", "CNY", "Act/365", "CNY", 0, "ON", "12M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("CNY", iborCNY); - - _mapNamedIBORIndex.put ("CNY-LIBOR", iborCNY); - - _mapNamedIBORIndex.put ("CNY-Repo", iborCNY); - - org.drip.market.definition.IBORIndex iborCZK = new org.drip.market.definition.IBORIndex - ("CZK-PRIBOR", "PRIBOR", "CZK", "Act/360", "CZK", 2, "", "", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("CZK", iborCZK); - - _mapNamedIBORIndex.put ("CZK-LIBOR", iborCZK); - - _mapNamedIBORIndex.put ("CZK-PRIBOR", iborCZK); - - org.drip.market.definition.IBORIndex iborDKK = new org.drip.market.definition.IBORIndex - ("DKK-CIBOR", "CIBOR", "DKK", "Act/360", "DKK", 2, "1W", "12M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("DKK", iborDKK); - - _mapNamedIBORIndex.put ("DKK-CIBOR", iborDKK); - - _mapNamedIBORIndex.put ("DKK-LIBOR", iborDKK); - - org.drip.market.definition.IBORIndex iborEUR = new org.drip.market.definition.IBORIndex - ("EUR-EURIBOR", "EURIBOR", "EUR", "Act/360", "EUR", 2, "1W", "12M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("EUR", iborEUR); - - _mapNamedIBORIndex.put ("EUR-EURIBOR", iborEUR); - - org.drip.market.definition.IBORIndex iborEUR2 = new org.drip.market.definition.IBORIndex - ("EUR-EURIBOR", "EURIBOR", "EUR", "Act/365", "EUR", 2, "1W", "12M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapNamedIBORIndex.put ("EUR-EURIBOR2", iborEUR2); - - org.drip.market.definition.IBORIndex iborEUR3 = new org.drip.market.definition.IBORIndex - ("EUR-LIBOR", "LIBOR", "EUR", "Act/360", "EUR", 2, "ON", "12M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapNamedIBORIndex.put ("EUR-LIBOR", iborEUR3); - - org.drip.market.definition.IBORIndex iborEUR4 = new org.drip.market.definition.IBORIndex - ("EUR-LIBOR", "LIBOR", "EUR", "Act/360", "EUR", 0, "ON", "12M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapNamedIBORIndex.put ("EUR-LIBOR2", iborEUR4); - - org.drip.market.definition.IBORIndex iborGBP = new org.drip.market.definition.IBORIndex - ("GBP-LIBOR", "LIBOR", "GBP", "Act/365", "GBP", 0, "ON", "12M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("GBP", iborGBP); - - _mapNamedIBORIndex.put ("GBP-LIBOR", iborGBP); - - org.drip.market.definition.IBORIndex iborHKD = new org.drip.market.definition.IBORIndex - ("HKD-HIBOR", "HIBOR", "HKD", "Act/365", "HKD", 2, "1M", "12M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("HKD", iborHKD); - - _mapNamedIBORIndex.put ("HKD-HIBOR", iborHKD); - - _mapNamedIBORIndex.put ("HKD-LIBOR", iborHKD); - - org.drip.market.definition.IBORIndex iborHUF = new org.drip.market.definition.IBORIndex - ("HUF-BUBOR", "BUBOR", "HUF", "Act/360", "HUF", 2, "", "", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("HUF", iborHUF); - - _mapNamedIBORIndex.put ("HUF-BUBOR", iborHUF); - - _mapNamedIBORIndex.put ("HUF-LIBOR", iborHUF); - - org.drip.market.definition.IBORIndex iborILS = new org.drip.market.definition.IBORIndex - ("ILS-LIBOR", "LIBOR", "ILS", "Act/360", "ILS", 2, "", "", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("ILS", iborILS); - - _mapNamedIBORIndex.put ("ILS-LIBOR", iborILS); - - org.drip.market.definition.IBORIndex iborIDR = new org.drip.market.definition.IBORIndex - ("IDR-IDRFIX", "IDRFIX", "IDR", "Act/360", "IDR", 2, "", "", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("IDR", iborIDR); - - _mapNamedIBORIndex.put ("IDR-IDRFIX", iborIDR); - - _mapNamedIBORIndex.put ("IDR-LIBOR", iborIDR); - - org.drip.market.definition.IBORIndex iborINR = new org.drip.market.definition.IBORIndex - ("INR-MIFOR", "MIFOR", "INR", "Act/365", "INR", 2, "", "", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("INR", iborINR); - - _mapNamedIBORIndex.put ("INR-LIBOR", iborINR); - - _mapNamedIBORIndex.put ("INR-MIFOR", iborINR); - - org.drip.market.definition.IBORIndex iborJPY = new org.drip.market.definition.IBORIndex - ("JPY-LIBOR", "LIBOR", "JPY", "Act/360", "JPY", 2, "ON", "12M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("JPY", iborJPY); - - _mapNamedIBORIndex.put ("JPY-LIBOR", iborJPY); - - org.drip.market.definition.IBORIndex iborJPYTIBOR = new org.drip.market.definition.IBORIndex - ("JPY-Japan TIBOR", "TIBOR", "JPY", "Act/365", "JPY", 2, "1W", "12M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapNamedIBORIndex.put ("JPY-TIBOR", iborJPYTIBOR); - - _mapNamedIBORIndex.put ("JPY-TIBOR", iborJPYTIBOR); - - org.drip.market.definition.IBORIndex iborJPYEuroyen = new org.drip.market.definition.IBORIndex - ("JPY-Euroyen TIBOR", "TIBOR", "JPY", "Act/360", "JPY", 2, "1W", "12M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapNamedIBORIndex.put ("JPY-EUROYEN", iborJPYEuroyen); - - _mapNamedIBORIndex.put ("JPY-EURTIBOR", iborJPYEuroyen); - - org.drip.market.definition.IBORIndex iborMXN = new org.drip.market.definition.IBORIndex - ("MXN-LIBOR", "LIBOR", "MXN", "Act/360", "MXN", 2, "ON", "12M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("MXN", iborMXN); - - _mapNamedIBORIndex.put ("MXN-LIBOR", iborMXN); - - org.drip.market.definition.IBORIndex iborNOK = new org.drip.market.definition.IBORIndex - ("NOK-NIBOR", "NIBOR", "NOK", "Act/360", "NOK", 2, "", "", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("NOK", iborNOK); - - _mapNamedIBORIndex.put ("NOK-LIBOR", iborNOK); - - _mapNamedIBORIndex.put ("NOK-NIBOR", iborNOK); - - org.drip.market.definition.IBORIndex iborNZD = new org.drip.market.definition.IBORIndex - ("NZD-BBR", "BBR", "NZD", "Act/365", "NZD", 0, "", "", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("NZD", iborNZD); - - _mapNamedIBORIndex.put ("NZD-BBR", iborNZD); - - _mapNamedIBORIndex.put ("NZD-BKBM", iborNZD); - - _mapNamedIBORIndex.put ("NZD-LIBOR", iborNZD); - - org.drip.market.definition.IBORIndex iborPLN = new org.drip.market.definition.IBORIndex - ("PLN-WIBOR", "WIBOR", "PLN", "Act/365", "PLN", 2, "", "", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("PLN", iborPLN); - - _mapNamedIBORIndex.put ("PLN-LIBOR", iborPLN); - - _mapNamedIBORIndex.put ("PLN-WIBOR", iborPLN); - - org.drip.market.definition.IBORIndex iborRMB = new org.drip.market.definition.IBORIndex - ("RMB-SHIBOR", "SHIBOR", "RMB", "Act/360", "RMB", 0, "ON", "12M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("RMB", iborRMB); - - _mapNamedIBORIndex.put ("RMB-LIBOR", iborRMB); - - _mapNamedIBORIndex.put ("RMB-SHIBOR", iborRMB); - - org.drip.market.definition.IBORIndex iborSEK = new org.drip.market.definition.IBORIndex - ("SEK-STIBOR", "STIBOR", "SEK", "Act/360", "SEK", 2, "", "", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("SEK", iborSEK); - - _mapNamedIBORIndex.put ("SEK-LIBOR", iborSEK); - - _mapNamedIBORIndex.put ("SEK-STIBOR", iborSEK); - - org.drip.market.definition.IBORIndex iborSGD = new org.drip.market.definition.IBORIndex - ("SGD-SIBOR", "SIBOR", "SGD", "Act/365", "SGD", 2, "", "", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("SGD", iborSGD); - - _mapNamedIBORIndex.put ("SGD-LIBOR", iborSGD); - - _mapNamedIBORIndex.put ("SGD-SIBOR", iborSGD); - - _mapNamedIBORIndex.put ("SGD-SOR", iborSGD); - - org.drip.market.definition.IBORIndex iborSKK = new org.drip.market.definition.IBORIndex - ("SKK-BRIBOR", "BRIBOR", "SKK", "Act/360", "SKK", 2, "", "", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("SKK", iborSKK); - - _mapNamedIBORIndex.put ("SKK-BRIBOR", iborSKK); - - _mapNamedIBORIndex.put ("SKK-LIBOR", iborSKK); - - org.drip.market.definition.IBORIndex iborTRY = new org.drip.market.definition.IBORIndex - ("TRY-LIBOR", "LIBOR", "TRY", "Act/360", "TRY", 2, "ON", "12M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("TRY", iborTRY); - - _mapNamedIBORIndex.put ("TRY-LIBOR", iborTRY); - - org.drip.market.definition.IBORIndex iborUSD = new org.drip.market.definition.IBORIndex - ("USD-LIBOR", "LIBOR", "USD", "Act/360", "USD", 2, "ON", "12M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("USD", iborUSD); - - _mapNamedIBORIndex.put ("USD-LIBOR", iborUSD); - - org.drip.market.definition.IBORIndex iborZAR = new org.drip.market.definition.IBORIndex - ("ZAR-JIBAR", "JIBAR", "ZAR", "Act/365", "ZAR", 0, "1M", "12M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionIBORIndex.put ("ZAR", iborZAR); - - _mapNamedIBORIndex.put ("ZAR-JIBAR", iborZAR); - - _mapNamedIBORIndex.put ("ZAR-LIBOR", iborZAR); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - return true; - } - - /** - * Retrieve the IBOR Index from the Jurisdiction Name - * - * @param strName The IBOR Index Jurisdiction Name - * - * @return The IBOR Index - */ - - public static final org.drip.market.definition.IBORIndex IndexFromJurisdiction ( - final java.lang.String strName) - { - return _mapJurisdictionIBORIndex.containsKey (strName) ? _mapJurisdictionIBORIndex.get (strName) : - null; - } - - /** - * Retrieve the IBOR Index from the Index Name - * - * @param strName The IBOR Index Index Name - * - * @return The IBOR Index - */ - - public static final org.drip.market.definition.IBORIndex IndexFromName ( - final java.lang.String strName) - { - return _mapNamedIBORIndex.containsKey (strName) ? _mapNamedIBORIndex.get (strName) : null; - } -} diff --git a/org/drip/market/definition/OvernightIndex.java b/org/drip/market/definition/OvernightIndex.java deleted file mode 100644 index 1098f8f..0000000 --- a/org/drip/market/definition/OvernightIndex.java +++ /dev/null @@ -1,121 +0,0 @@ - -package org.drip.market.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * OvernightIndex contains the definitions of the overnight indexes of different jurisdictions. - * - * @author Lakshmi Krishnamurthy - */ - -public class OvernightIndex extends org.drip.market.definition.FloaterIndex { - private int _iPublicationLag = 0; - private java.lang.String _strReferenceLag = ""; - - /** - * OvernightIndex Constructor - * - * @param strName Index Name - * @param strFamily Index Family - * @param strCurrency Index Currency - * @param strDayCount Index Day Count - * @param strCalendar Index Holiday Calendar - * @param strReferenceLag Index Reference Lag - * @param iPublicationLag Index Publication Lag - * @param iAccrualCompoundingRule Accrual Compounding Rule - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public OvernightIndex ( - final java.lang.String strName, - final java.lang.String strFamily, - final java.lang.String strCurrency, - final java.lang.String strDayCount, - final java.lang.String strCalendar, - final java.lang.String strReferenceLag, - final int iPublicationLag, - final int iAccrualCompoundingRule) - throws java.lang.Exception - { - super (strName, strFamily, strCurrency, strDayCount, strCalendar, iAccrualCompoundingRule); - - if (null == (_strReferenceLag = strReferenceLag) || _strReferenceLag.isEmpty()) - throw new java.lang.Exception ("OvernightIndex ctr => Invalid Inputs!"); - - _iPublicationLag = iPublicationLag; - } - - @Override public int spotLag() - { - return "ON".equalsIgnoreCase (_strReferenceLag) ? 0 : 1; - } - - /** - * Retrieve the Index Reference Lag - * - * @return The Index Reference Lag - */ - - public java.lang.String referenceLag() - { - return _strReferenceLag; - } - - /** - * Retrieve the Index Publication Lag - * - * @return The Index Publication Lag - */ - - public int publicationLag() - { - return _iPublicationLag; - } -} diff --git a/org/drip/market/definition/OvernightIndexContainer.java b/org/drip/market/definition/OvernightIndexContainer.java deleted file mode 100644 index ee91993..0000000 --- a/org/drip/market/definition/OvernightIndexContainer.java +++ /dev/null @@ -1,290 +0,0 @@ - -package org.drip.market.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * OvernightIndexContainer holds the definitions of the overnight index definitions corresponding to - * different jurisdictions. - * - * @author Lakshmi Krishnamurthy - */ - -public class OvernightIndexContainer { - private static final - org.drip.analytics.support.CaseInsensitiveTreeMap - _mapJurisdictionOvernightIndex = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private static final - org.drip.analytics.support.CaseInsensitiveTreeMap - _mapNamedOvernightIndex = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - /** - * Initialize the Overnight Index Container with the Overnight Indexes - * - * @return TRUE - The Overnight Index Container successfully initialized with the indexes - */ - - public static final boolean Init() - { - try { - org.drip.market.definition.OvernightIndex oiAUD = new org.drip.market.definition.OvernightIndex - ("AUD-RBA ON AONIA", "AONIA", "AUD", "Act/365", "AUD", "ON", 0, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionOvernightIndex.put ("AUD", oiAUD); - - _mapNamedOvernightIndex.put ("AUD-AONIA", oiAUD); - - _mapNamedOvernightIndex.put ("AUD-RBA ON AONIA", oiAUD); - - org.drip.market.definition.OvernightIndex oiBRL = new org.drip.market.definition.OvernightIndex - ("BRL-CETIP", "CETIP", "BRL", "Bus/252", "BRL", "ON", 1, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionOvernightIndex.put ("BRL", oiBRL); - - _mapNamedOvernightIndex.put ("BRL-CETIP", oiBRL); - - _mapNamedOvernightIndex.put ("BRL-DI", oiBRL); - - org.drip.market.definition.OvernightIndex oiCAD = new org.drip.market.definition.OvernightIndex - ("CAD-CORRA", "CORRA", "CAD", "Act/365", "CAD", "ON", 1, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionOvernightIndex.put ("CAD", oiCAD); - - _mapNamedOvernightIndex.put ("CAD-CORRA", oiCAD); - - org.drip.market.definition.OvernightIndex oiCHF = new org.drip.market.definition.OvernightIndex - ("CHF-TOIS", "TOIS", "CHF", "Act/360", "CHF", "TN", -1, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionOvernightIndex.put ("CHF", oiCHF); - - _mapNamedOvernightIndex.put ("CHF-TOIS", oiCHF); - - org.drip.market.definition.OvernightIndex oiCZK = new org.drip.market.definition.OvernightIndex - ("CZK-CZEONIA", "CZEONIA", "CZK", "Act/360", "CZK", "ON", 0, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionOvernightIndex.put ("CZK", oiCZK); - - _mapNamedOvernightIndex.put ("CZK-CZEONIA", oiCZK); - - org.drip.market.definition.OvernightIndex oiDKK = new org.drip.market.definition.OvernightIndex - ("DKK-DNB TN", "DNBTN", "DKK", "Act/360", "DKK", "TN", -1, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionOvernightIndex.put ("DKK", oiDKK); - - _mapNamedOvernightIndex.put ("DKK-DNBTN", oiDKK); - - _mapNamedOvernightIndex.put ("DKK-DNB TN", oiDKK); - - org.drip.market.definition.OvernightIndex oiEUR = new org.drip.market.definition.OvernightIndex - ("EUR-EONIA", "EONIA", "EUR", "Act/360", "EUR", "ON", 0, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionOvernightIndex.put ("EUR", oiEUR); - - _mapNamedOvernightIndex.put ("EUR-EONIA", oiEUR); - - org.drip.market.definition.OvernightIndex oiGBP = new org.drip.market.definition.OvernightIndex - ("GBP-SONIA", "SONIA", "GBP", "Act/365", "GBP", "ON", 0, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionOvernightIndex.put ("GBP", oiGBP); - - _mapNamedOvernightIndex.put ("GBP-SONIA", oiGBP); - - org.drip.market.definition.OvernightIndex oiHKD = new org.drip.market.definition.OvernightIndex - ("HKD-HONIX", "HONIX", "HKD", "Act/365", "HKD", "ON", 0, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionOvernightIndex.put ("HKD", oiHKD); - - _mapNamedOvernightIndex.put ("HKD-HONIX", oiHKD); - - org.drip.market.definition.OvernightIndex oiHUF = new org.drip.market.definition.OvernightIndex - ("HUF-HUFONIA", "HUFONIA", "HUF", "Act/360", "HUF", "ON", 0, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionOvernightIndex.put ("HUF", oiHUF); - - _mapNamedOvernightIndex.put ("HUF-HUFONIA", oiHUF); - - org.drip.market.definition.OvernightIndex oiINR = new org.drip.market.definition.OvernightIndex - ("INR-ON MIBOR", "MIBOR", "INR", "Act/365", "INR", "ON", 0, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionOvernightIndex.put ("INR", oiINR); - - _mapNamedOvernightIndex.put ("INR-MIBOR", oiINR); - - _mapNamedOvernightIndex.put ("INR-ON MIBOR", oiINR); - - org.drip.market.definition.OvernightIndex oiINR2 = new org.drip.market.definition.OvernightIndex - ("INR-MITOR", "MITOR", "INR", "Act/365", "INR", "TN", 0, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionOvernightIndex.put ("INR2", oiINR2); - - _mapNamedOvernightIndex.put ("INR-MITOR", oiINR2); - - org.drip.market.definition.OvernightIndex oiJPY = new org.drip.market.definition.OvernightIndex - ("JPY-TONAR", "TONAR", "JPY", "Act/365", "JPY", "ON", 1, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionOvernightIndex.put ("JPY", oiJPY); - - _mapNamedOvernightIndex.put ("JPY-TONAR", oiJPY); - - org.drip.market.definition.OvernightIndex oiNZD = new org.drip.market.definition.OvernightIndex - ("NZD-NZIONA", "NZIONA", "NZD", "Act/365", "NZD", "ON", 0, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionOvernightIndex.put ("NZD", oiNZD); - - _mapNamedOvernightIndex.put ("NZD-NZIONA", oiNZD); - - org.drip.market.definition.OvernightIndex oiPLN = new org.drip.market.definition.OvernightIndex - ("PLN-POLONIA", "POLONIA", "PLN", "Act/365", "PLN", "ON", 0, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionOvernightIndex.put ("PLN", oiPLN); - - _mapNamedOvernightIndex.put ("PLN-POLONIA", oiPLN); - - org.drip.market.definition.OvernightIndex oiSEK = new org.drip.market.definition.OvernightIndex - ("SEK-SIOR TN STIBOR", "STIBOR", "SEK", "Act/360", "SEK", "ON", -1, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionOvernightIndex.put ("SEK", oiSEK); - - _mapNamedOvernightIndex.put ("SEK-SIOR", oiSEK); - - _mapNamedOvernightIndex.put ("SEK-SIOR TN STIBOR", oiSEK); - - _mapNamedOvernightIndex.put ("SEK-STIBOR", oiSEK); - - org.drip.market.definition.OvernightIndex oiSGD = new org.drip.market.definition.OvernightIndex - ("SGD-SONAR", "SONAR", "SGD", "Act/365", "SGD", "ON", 0, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionOvernightIndex.put ("SGD", oiSGD); - - _mapNamedOvernightIndex.put ("SGD-SONAR", oiSGD); - - org.drip.market.definition.OvernightIndex oiUSD = new org.drip.market.definition.OvernightIndex - ("USD-Fed Fund", "FedFund", "USD", "Act/360", "USD", "ON", 1, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_ARITHMETIC); - - _mapJurisdictionOvernightIndex.put ("USD", oiUSD); - - _mapNamedOvernightIndex.put ("USD-Fed Fund", oiUSD); - - _mapNamedOvernightIndex.put ("USD-FedFund", oiUSD); - - org.drip.market.definition.OvernightIndex oiZAR = new org.drip.market.definition.OvernightIndex - ("ZAR-SAFEX ON Dep Rate", "SAFEX", "ZAR", "Act/365", "ZAR", "ON", 0, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionOvernightIndex.put ("ZAR", oiZAR); - - _mapNamedOvernightIndex.put ("ZAR-SAFEX", oiZAR); - - _mapNamedOvernightIndex.put ("ZAR-SAFEX ON Dep Rate", oiZAR); - - org.drip.market.definition.OvernightIndex oiZAR2 = new org.drip.market.definition.OvernightIndex - ("ZAR-SAONIA", "SAONIA", "ZAR", "Act/365", "ZAR", "ON", 0, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - _mapJurisdictionOvernightIndex.put ("ZAR2", oiZAR2); - - _mapNamedOvernightIndex.put ("ZAR-SAONIA", oiZAR2); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - return true; - } - - /** - * Retrieve the Overnight Index from the Jurisdiction Name - * - * @param strName The Overnight Index Jurisdiction Name - * - * @return The Overnight Index - */ - - public static final org.drip.market.definition.OvernightIndex IndexFromJurisdiction ( - final java.lang.String strName) - { - return _mapJurisdictionOvernightIndex.containsKey (strName) ? _mapJurisdictionOvernightIndex.get - (strName) : null; - } - - /** - * Retrieve the Overnight Index from the Index Name - * - * @param strName The Overnight Index Index Name - * - * @return The Overnight Index - */ - - public static final org.drip.market.definition.OvernightIndex IndexFromName ( - final java.lang.String strName) - { - return _mapNamedOvernightIndex.containsKey (strName) ? _mapNamedOvernightIndex.get (strName) : null; - } -} diff --git a/org/drip/market/exchange/DeliverableSwapFutures.java b/org/drip/market/exchange/DeliverableSwapFutures.java deleted file mode 100644 index 229f206..0000000 --- a/org/drip/market/exchange/DeliverableSwapFutures.java +++ /dev/null @@ -1,166 +0,0 @@ - -package org.drip.market.exchange; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * DeliverableSwapFutures contains the details of the exchange-traded Deliverable Swap Futures Contracts. - * - * @author Lakshmi Krishnamurthy - */ - -public class DeliverableSwapFutures { - private java.lang.String _strTenor = ""; - private java.lang.String _strCurrency = ""; - private double _dblNominal = java.lang.Double.NaN; - private double _dblRateIncrement = java.lang.Double.NaN; - private org.drip.product.params.LastTradingDateSetting _ltds = null; - - /** - * DeliverableSwapFutures constructor - * - * @param strCurrency Currency - * @param strTenor Tenor - * @param dblNominal Nominal - * @param dblRateIncrement Rate Increment - * @param ltds Late Trading Date Setting - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public DeliverableSwapFutures ( - final java.lang.String strCurrency, - final java.lang.String strTenor, - final double dblNominal, - final double dblRateIncrement, - final org.drip.product.params.LastTradingDateSetting ltds) - throws java.lang.Exception - { - if (null == (_strCurrency = strCurrency) || _strCurrency.isEmpty() || null == (_strTenor = strTenor) - || _strTenor.isEmpty() || !org.drip.quant.common.NumberUtil.IsValid (_dblNominal = dblNominal) || - !org.drip.quant.common.NumberUtil.IsValid (_dblRateIncrement = dblRateIncrement)) - throw new java.lang.Exception ("DeliverableSwapFutures ctr: Invalid Inputs"); - - _ltds = ltds; - } - - /** - * Retrieve the Currency - * - * @return The Currency - */ - - public java.lang.String currency() - { - return _strCurrency; - } - - /** - * Retrieve the Tenor - * - * @return The Tenor - */ - - public java.lang.String tenor() - { - return _strTenor; - } - - /** - * Retrieve the Nominal - * - * @return The Nominal - */ - - public double nominal() - { - return _dblNominal; - } - - /** - * Retrieve the Rate Increment - * - * @return The Rate Increment - */ - - public double rateIncrement() - { - return _dblRateIncrement; - } - - /** - * Retrieve the Last Trading Date Setting - * - * @return The Last Trading Date Setting - */ - - public org.drip.product.params.LastTradingDateSetting ltds() - { - return _ltds; - } - - /** - * Create an Instance of the Deliverable Swaps Futures - * - * @param dtSpot Spot Date - * @param dblFixedCoupon Fixed Coupon - * - * @return Instance of the Deliverable Swaps Futures - */ - - public org.drip.product.rates.FixFloatComponent Create ( - final org.drip.analytics.date.JulianDate dtSpot, - final double dblFixedCoupon) - { - org.drip.market.otc.FixedFloatSwapConvention ffConv = - org.drip.market.otc.IBORFixedFloatContainer.ConventionFromJurisdictionMaturity (_strCurrency, - _strTenor); - - return null == ffConv ? null : ffConv.createFixFloatComponent (dtSpot, _strTenor, dblFixedCoupon, 0., - _dblNominal); - } -} diff --git a/org/drip/market/exchange/DeliverableSwapFuturesContainer.java b/org/drip/market/exchange/DeliverableSwapFuturesContainer.java deleted file mode 100644 index e2453a7..0000000 --- a/org/drip/market/exchange/DeliverableSwapFuturesContainer.java +++ /dev/null @@ -1,120 +0,0 @@ - -package org.drip.market.exchange; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * DeliverableSwapFuturesContainer holds the Deliverable Swap Futures Contracts. - * - * @author Lakshmi Krishnamurthy - */ - -public class DeliverableSwapFuturesContainer { - private static final java.util.Map - _mapFutures = new - java.util.TreeMap(); - - - /** - * Initialize the Deliverable Swap Futures Container with the pre-set Deliverable Swap Futures Contract - * - * @return TRUE - The Deliverable Swap Futures Container successfully initialized with the pre-set - * Deliverable Swap Futures Contract - */ - - public static final boolean Init() - { - try { - _mapFutures.put ("USD-2Y", new org.drip.market.exchange.DeliverableSwapFutures ("USD", "2Y", - 100000., 0.0025, new org.drip.product.params.LastTradingDateSetting - (org.drip.product.params.LastTradingDateSetting.MID_CURVE_OPTION, "2D", - java.lang.Integer.MIN_VALUE))); - - _mapFutures.put ("USD-5Y", new org.drip.market.exchange.DeliverableSwapFutures ("USD", "5Y", - 100000., 0.0025, new org.drip.product.params.LastTradingDateSetting - (org.drip.product.params.LastTradingDateSetting.MID_CURVE_OPTION, "2D", - java.lang.Integer.MIN_VALUE))); - - _mapFutures.put ("USD-10Y", new org.drip.market.exchange.DeliverableSwapFutures ("USD", "10Y", - 100000., 0.0025, new org.drip.product.params.LastTradingDateSetting - (org.drip.product.params.LastTradingDateSetting.MID_CURVE_OPTION, "2D", - java.lang.Integer.MIN_VALUE))); - - _mapFutures.put ("USD-30Y", new org.drip.market.exchange.DeliverableSwapFutures ("USD", "30Y", - 100000., 0.0025, new org.drip.product.params.LastTradingDateSetting - (org.drip.product.params.LastTradingDateSetting.MID_CURVE_OPTION, "2D", - java.lang.Integer.MIN_VALUE))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - return true; - } - - /** - * Retrieve the Deliverable Swap Futures Info from the Currency and the Tenor - * - * @param strCurrency The Currency - * @param strTenor The Tenor - * - * @return The Deliverable Swap Futures Instance - */ - - public static final org.drip.market.exchange.DeliverableSwapFutures ProductInfo ( - final java.lang.String strCurrency, - final java.lang.String strTenor) - { - if (null == strCurrency || strCurrency.isEmpty() || null == strTenor || strTenor.isEmpty()) - return null; - - java.lang.String strKey = strCurrency + "-" + strTenor; - - return _mapFutures.containsKey (strKey) ? _mapFutures.get (strKey) : null; - } -} diff --git a/org/drip/market/exchange/FuturesOptions.java b/org/drip/market/exchange/FuturesOptions.java deleted file mode 100644 index a825eb5..0000000 --- a/org/drip/market/exchange/FuturesOptions.java +++ /dev/null @@ -1,152 +0,0 @@ - -package org.drip.market.exchange; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FuturesOptions contains the details of the exchange-traded Short-Term Futures Options Contracts. - * - * @author Lakshmi Krishnamurthy - */ - -public class FuturesOptions { - private java.lang.String _strTradingMode = ""; - private java.lang.String _strFullyQualifiedName = ""; - private - org.drip.analytics.support.CaseInsensitiveHashMap - _mapLTDS = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - /** - * FuturesOptions Constructor - * - * @param strFullyQualifiedName Fully Qualified Name - * @param strTradingMode Trading Mode - PREMIUM | MARGIN - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public FuturesOptions ( - final java.lang.String strFullyQualifiedName, - final java.lang.String strTradingMode) - throws java.lang.Exception - { - if (null == (_strFullyQualifiedName = strFullyQualifiedName) || _strFullyQualifiedName.isEmpty() || - null == (_strTradingMode = strTradingMode) || _strTradingMode.isEmpty()) - throw new java.lang.Exception ("FuturesOptions ctr: Invalid Inputs"); - } - - /** - * Retrieve the Fully Qualified Name - * - * @return The Fully Qualified Name - */ - - public java.lang.String fullyQualifiedName() - { - return _strFullyQualifiedName; - } - - /** - * Retrieve the Trading Mode - * - * @return The Trading Mode - */ - - public java.lang.String tradingMode() - { - return _strTradingMode; - } - - /** - * Add a Named Exchange LTDS Array Map Entry - * - * @param strExchange Named Exchange - * @param aLTDS Array of LTDS - * - * @return TRUE - Named Exchange LTDS Array Map Entry successfully added - */ - - public boolean setLDTS ( - final java.lang.String strExchange, - final org.drip.product.params.LastTradingDateSetting[] aLTDS) - { - if (null == strExchange || strExchange.isEmpty() || null == aLTDS || 0 == aLTDS.length) return false; - - _mapLTDS.put (strExchange, aLTDS); - - return true; - } - - /** - * Retrieve the LTDS Array corresponding to the Exchange - * - * @param strExchange The Exchange - * - * @return The LTDS Array - */ - - public org.drip.product.params.LastTradingDateSetting[] ltdsArray ( - final java.lang.String strExchange) - { - if (null == strExchange || strExchange.isEmpty() || !_mapLTDS.containsKey (strExchange)) return null; - - return _mapLTDS.get (strExchange); - } - - /** - * Retrieve the Set of Traded Exchanges - * - * @return The Set of Traded Exchanges - */ - - public java.util.Set exchanges() - { - return 0 == _mapLTDS.size() ? null : _mapLTDS.keySet(); - } -} diff --git a/org/drip/market/exchange/FuturesOptionsContainer.java b/org/drip/market/exchange/FuturesOptionsContainer.java deleted file mode 100644 index 13f067e..0000000 --- a/org/drip/market/exchange/FuturesOptionsContainer.java +++ /dev/null @@ -1,199 +0,0 @@ - -package org.drip.market.exchange; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FuturesOptionsContainer holds the short term futures options contracts. - * - * @author Lakshmi Krishnamurthy - */ - -public class FuturesOptionsContainer { - private static final java.util.Map - _mapFuturesOptions = new - java.util.TreeMap(); - - /** - * Initialize the Overnight Index Container with the Overnight Indexes - * - * @return TRUE - The Overnight Index Container successfully initialized with the indexes - */ - - public static final boolean Init() - { - try { - org.drip.product.params.LastTradingDateSetting ltdsMidCurveQuarterly = new - org.drip.product.params.LastTradingDateSetting - (org.drip.product.params.LastTradingDateSetting.MID_CURVE_OPTION_QUARTERLY, "", - java.lang.Integer.MIN_VALUE); - - org.drip.product.params.LastTradingDateSetting ltdsMidCurve1M = new - org.drip.product.params.LastTradingDateSetting - (org.drip.product.params.LastTradingDateSetting.MID_CURVE_OPTION, "1M", - java.lang.Integer.MIN_VALUE); - - org.drip.product.params.LastTradingDateSetting ltdsMidCurve2M = new - org.drip.product.params.LastTradingDateSetting - (org.drip.product.params.LastTradingDateSetting.MID_CURVE_OPTION, "2M", - java.lang.Integer.MIN_VALUE); - - org.drip.product.params.LastTradingDateSetting ltdsMidCurve1Y = new - org.drip.product.params.LastTradingDateSetting - (org.drip.product.params.LastTradingDateSetting.MID_CURVE_OPTION, "1Y", - java.lang.Integer.MIN_VALUE); - - org.drip.product.params.LastTradingDateSetting ltdsMidCurve2Y = new - org.drip.product.params.LastTradingDateSetting - (org.drip.product.params.LastTradingDateSetting.MID_CURVE_OPTION, "2Y", - java.lang.Integer.MIN_VALUE); - - org.drip.product.params.LastTradingDateSetting[] s_aLTDSMidCurveAll = new - org.drip.product.params.LastTradingDateSetting[] {ltdsMidCurveQuarterly, ltdsMidCurve1M, - ltdsMidCurve2M, ltdsMidCurve1Y, ltdsMidCurve2Y, new - org.drip.product.params.LastTradingDateSetting - (org.drip.product.params.LastTradingDateSetting.MID_CURVE_OPTION, "4Y", - java.lang.Integer.MIN_VALUE)}; - - org.drip.market.exchange.FuturesOptions foCHFLIBOR3M_MARGIN = new - org.drip.market.exchange.FuturesOptions ("CHF-LIBOR-3M", "MARGIN"); - - foCHFLIBOR3M_MARGIN.setLDTS ("LIFFE", new org.drip.product.params.LastTradingDateSetting[] - {ltdsMidCurveQuarterly}); - - _mapFuturesOptions.put ("CHF-LIBOR-3M|MARGIN", foCHFLIBOR3M_MARGIN); - - org.drip.market.exchange.FuturesOptions foGBPLIBOR3M_MARGIN = new - org.drip.market.exchange.FuturesOptions ("GBP-LIBOR-3M", "MARGIN"); - - foGBPLIBOR3M_MARGIN.setLDTS ("LIFFE", new org.drip.product.params.LastTradingDateSetting[] - {ltdsMidCurveQuarterly, ltdsMidCurve1M, ltdsMidCurve2M, ltdsMidCurve2Y}); - - _mapFuturesOptions.put ("GBP-LIBOR-3M|MARGIN", foGBPLIBOR3M_MARGIN); - - org.drip.market.exchange.FuturesOptions foEUREURIBOR3M_MARGIN = new - org.drip.market.exchange.FuturesOptions ("EUR-EURIBOR-3M", "MARGIN"); - - foEUREURIBOR3M_MARGIN.setLDTS ("EUREX", new org.drip.product.params.LastTradingDateSetting[] - {ltdsMidCurveQuarterly, ltdsMidCurve1Y}); - - foEUREURIBOR3M_MARGIN.setLDTS ("LIFFE", new org.drip.product.params.LastTradingDateSetting[] - {ltdsMidCurveQuarterly, ltdsMidCurve1M, ltdsMidCurve2M, ltdsMidCurve2Y}); - - _mapFuturesOptions.put ("EUR-EURIBOR-3M|MARGIN", foEUREURIBOR3M_MARGIN); - - org.drip.market.exchange.FuturesOptions foJPYLIBOR3M_PREMIUM = new - org.drip.market.exchange.FuturesOptions ("JPY-LIBOR-3M", "PREMIUM"); - - foJPYLIBOR3M_PREMIUM.setLDTS ("SGX", s_aLTDSMidCurveAll); - - _mapFuturesOptions.put ("JPY-LIBOR-3M|PREMIUM", foJPYLIBOR3M_PREMIUM); - - org.drip.market.exchange.FuturesOptions foJPYTIBOR3M_PREMIUM = new - org.drip.market.exchange.FuturesOptions ("JPY-TIBOR-3M", "PREMIUM"); - - foJPYTIBOR3M_PREMIUM.setLDTS ("SGX", s_aLTDSMidCurveAll); - - _mapFuturesOptions.put ("JPY-TIBOR-3M|PREMIUM", foJPYTIBOR3M_PREMIUM); - - org.drip.market.exchange.FuturesOptions foUSDLIBOR1M_PREMIUM = new - org.drip.market.exchange.FuturesOptions ("USD-LIBOR-1M", "PREMIUM"); - - foUSDLIBOR1M_PREMIUM.setLDTS ("CME", s_aLTDSMidCurveAll); - - _mapFuturesOptions.put ("USD-LIBOR-1M|PREMIUM", foUSDLIBOR1M_PREMIUM); - - org.drip.market.exchange.FuturesOptions foUSDLIBOR3M_MARGIN = new - org.drip.market.exchange.FuturesOptions ("USD-LIBOR-3M", "MARGIN"); - - foUSDLIBOR3M_MARGIN.setLDTS ("LIFFE", new org.drip.product.params.LastTradingDateSetting[] - {ltdsMidCurveQuarterly, ltdsMidCurve1M, ltdsMidCurve2M}); - - _mapFuturesOptions.put ("USD-LIBOR-3M|MARGIN", foUSDLIBOR3M_MARGIN); - - org.drip.market.exchange.FuturesOptions foUSDLIBOR3M_PREMIUM = new - org.drip.market.exchange.FuturesOptions ("USD-LIBOR-3M", "PREMIUM"); - - foUSDLIBOR3M_PREMIUM.setLDTS ("CME", s_aLTDSMidCurveAll); - - foUSDLIBOR3M_PREMIUM.setLDTS ("SGX", s_aLTDSMidCurveAll); - - _mapFuturesOptions.put ("USD-LIBOR-3M|PREMIUM", foUSDLIBOR3M_PREMIUM); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - return true; - } - - /** - * Retrieve the FuturesOptions Exchange Info - * - * @param strFullyQualifiedName Fully Qualified Name - * @param strTradingMode Trading Mode - * - * @return The FuturesOptions Exchange Info - */ - - public static final org.drip.market.exchange.FuturesOptions ExchangeInfo ( - final java.lang.String strFullyQualifiedName, - final java.lang.String strTradingMode) - { - if (null == strFullyQualifiedName || strFullyQualifiedName.isEmpty() || null == strTradingMode || - strTradingMode.isEmpty() || !_mapFuturesOptions.containsKey (strFullyQualifiedName + "|" + - strTradingMode)) - return null; - - java.lang.String strFuturesOptionsKey = strFullyQualifiedName + "|" + strTradingMode; - - return !_mapFuturesOptions.containsKey (strFuturesOptionsKey) ? null : _mapFuturesOptions.get - (strFuturesOptionsKey); - } -} diff --git a/org/drip/market/exchange/ShortTermFutures.java b/org/drip/market/exchange/ShortTermFutures.java deleted file mode 100644 index fdfd598..0000000 --- a/org/drip/market/exchange/ShortTermFutures.java +++ /dev/null @@ -1,101 +0,0 @@ - -package org.drip.market.exchange; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ShortTermFutures contains the details of the exchange-traded Short-Term Futures Contracts. - * - * @author Lakshmi Krishnamurthy - */ - -public class ShortTermFutures { - private java.lang.String[] _astrExchange = null; - private double _dblNotional = java.lang.Double.NaN; - - /** - * ShortTermFutures constructor - * - * @param astrExchange Array of Exchanges - * @param dblNotional Notional - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public ShortTermFutures ( - final java.lang.String[] astrExchange, - final double dblNotional) - throws java.lang.Exception - { - if (null == (_astrExchange = astrExchange) || 0 == _astrExchange.length || - !org.drip.quant.common.NumberUtil.IsValid (_dblNotional = dblNotional)) - throw new java.lang.Exception ("ShortTermFutures ctr: Invalid Inputs"); - } - - /** - * Retrieve the List of Exchanges - * - * @return The List of Exchanges - */ - - public java.lang.String[] exchanges() - { - return _astrExchange; - } - - /** - * Retrieve the Traded Notional - * - * @return The Exchange Notional - */ - - public double notional() - { - return _dblNotional; - } -} diff --git a/org/drip/market/exchange/ShortTermFuturesContainer.java b/org/drip/market/exchange/ShortTermFuturesContainer.java deleted file mode 100644 index e0e4d7d..0000000 --- a/org/drip/market/exchange/ShortTermFuturesContainer.java +++ /dev/null @@ -1,143 +0,0 @@ - -package org.drip.market.exchange; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ShortTermFuturesContainer holds the short term futures contracts. - * - * @author Lakshmi Krishnamurthy - */ - -public class ShortTermFuturesContainer { - private static final java.util.Map - _mapFutures = new - java.util.TreeMap(); - - /** - * Initialize the Short Term Futures Container with the pre-set Short Term Contracts - * - * @return TRUE - The Short Term Futures Container successfully initialized with the pre-set Short Term - * Contracts - */ - - public static final boolean Init() - { - try { - _mapFutures.put ("CAD-CDOR-3M", new org.drip.market.exchange.ShortTermFutures (new - java.lang.String[] {"MX"}, 1000000.)); - - _mapFutures.put ("CHF-LIBOR-3M", new org.drip.market.exchange.ShortTermFutures (new - java.lang.String[] {"LIFFE"}, 1000000.)); - - _mapFutures.put ("DKK-CIBOR-3M", new org.drip.market.exchange.ShortTermFutures (new - java.lang.String[] {"OMX"}, 1000000.)); - - _mapFutures.put ("EUR-EURIBOR-3M", new org.drip.market.exchange.ShortTermFutures (new - java.lang.String[] {"EUREX", "LIFFE", "NLX"}, 1000000.)); - - _mapFutures.put ("GBP-LIBOR-3M", new org.drip.market.exchange.ShortTermFutures (new - java.lang.String[] {"LIFFE", "NLX"}, 500000.)); - - _mapFutures.put ("JPY-LIBOR-3M", new org.drip.market.exchange.ShortTermFutures (new - java.lang.String[] {"SGX"}, 100000000.)); - - _mapFutures.put ("JPY-TIBOR-3M", new org.drip.market.exchange.ShortTermFutures (new - java.lang.String[] {"CME", "SGX"}, 100000000.)); - - _mapFutures.put ("USD-LIBOR-1M", new org.drip.market.exchange.ShortTermFutures (new - java.lang.String[] {"CME"}, 3000000.)); - - _mapFutures.put ("USD-LIBOR-3M", new org.drip.market.exchange.ShortTermFutures (new - java.lang.String[] {"CME", "SGX"}, 1000000.)); - - _mapFutures.put ("ZAR-JIBAR-3M", new org.drip.market.exchange.ShortTermFutures (new - java.lang.String[] {"SAFEX"}, 1000000.)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - return true; - } - - /** - * Retrieve the Short Term Futures Exchange Info From the Corresponding Forward Label - * - * @param forwardLabel The Forward Label - * - * @return The Short Term Futures Exchange Info - */ - - public static final org.drip.market.exchange.ShortTermFutures ExchangeInfo ( - final org.drip.state.identifier.ForwardLabel forwardLabel) - { - if (null == forwardLabel) return null; - - java.lang.String strFullyQualifiedName = forwardLabel.fullyQualifiedName(); - - return _mapFutures.containsKey (strFullyQualifiedName) ? _mapFutures.get (strFullyQualifiedName) : - null; - } - - /** - * Retrieve the Short Term Futures Exchange Info From the Corresponding Forward Label - * - * @param strFullyQualifiedName The Forward Label - * - * @return The Short Term Futures Exchange Info - */ - - public static final org.drip.market.exchange.ShortTermFutures ExchangeInfo ( - final java.lang.String strFullyQualifiedName) - { - return null != strFullyQualifiedName && _mapFutures.containsKey (strFullyQualifiedName) ? - _mapFutures.get (strFullyQualifiedName) : null; - } -} diff --git a/org/drip/market/exchange/TreasuryFuturesContract.java b/org/drip/market/exchange/TreasuryFuturesContract.java deleted file mode 100644 index e8f1ce2..0000000 --- a/org/drip/market/exchange/TreasuryFuturesContract.java +++ /dev/null @@ -1,128 +0,0 @@ - -package org.drip.market.exchange; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 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. - */ - -/** - * TreasuryFuturesContract holds the Parameters/Settings of the Common Treasury Futures Contracts. - * - * @author Lakshmi Krishnamurthy - */ - -public class TreasuryFuturesContract { - private java.lang.String _strID = ""; - private java.lang.String _strCode = ""; - private java.lang.String _strType = ""; - private java.lang.String _strTenor = ""; - - /** - * TreasuryFuturesContract Constructor - * - * @param strID Contract ID - * @param strCode Underling Treasury Code - * @param strType Underlying Treasury Type - * @param strTenor Contract Tenor - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public TreasuryFuturesContract ( - final java.lang.String strID, - final java.lang.String strCode, - final java.lang.String strType, - final java.lang.String strTenor) - throws java.lang.Exception - { - if (null == (_strID = strID) || _strID.isEmpty() || null == (_strCode = strCode) || - _strCode.isEmpty() || null == (_strType = strType) || _strType.isEmpty() || null == (_strTenor = - strTenor) || _strTenor.isEmpty()) - throw new java.lang.Exception ("TreasuryFuturesContract ctr => Invalid Inputs!"); - } - - /** - * Retrieve the Treasury Futures Contract ID - * - * @return The Contract ID - */ - - public java.lang.String id() - { - return _strID; - } - - /** - * Retrieve the Underlying Treasury Code - * - * @return The Underlying Treasury Code - */ - - public java.lang.String code() - { - return _strCode; - } - - /** - * Retrieve the Underlying Treasury Type - * - * @return The Underlying Treasury Type - */ - - public java.lang.String type() - { - return _strType; - } - - /** - * Retrieve the Contract Tenor - * - * @return The Contract Tenor - */ - - public java.lang.String tenor() - { - return _strTenor; - } -} diff --git a/org/drip/market/exchange/TreasuryFuturesContractContainer.java b/org/drip/market/exchange/TreasuryFuturesContractContainer.java deleted file mode 100644 index 2acb374..0000000 --- a/org/drip/market/exchange/TreasuryFuturesContractContainer.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.market.exchange; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 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. - */ - -/** - * TreasuryFuturesContractContainer holds the Details of some of the Common Treasury Futures Contracts. - * - * @author Lakshmi Krishnamurthy - */ - -public class TreasuryFuturesContractContainer { - private static final - org.drip.analytics.support.CaseInsensitiveTreeMap - _mapNameContract = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private static final - org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCodeTenorContract = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private static final boolean AddContract ( - final java.lang.String[] astrName, - final java.lang.String strID, - final java.lang.String strCode, - final java.lang.String strType, - final java.lang.String strTenor) - { - try { - org.drip.market.exchange.TreasuryFuturesContract tfc = new - org.drip.market.exchange.TreasuryFuturesContract (strID, strCode, strType, strTenor); - - for (java.lang.String strName : astrName) - _mapNameContract.put (strName, tfc); - - _mapCodeTenorContract.put (strCode + "::" + strTenor, tfc); - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - /** - * Initialize the Treasury Futures Contract Container with the Conventions - * - * @return TRUE - The Treasury Futures Contracts Container successfully initialized with the Contracts - */ - - public static final boolean Init() - { - /* - * Australian Treasury Futures - */ - - if (!AddContract (new java.lang.String[] {"YM1"}, "YM1", "AGB", "NOTE", "03Y")) return false; - - if (!AddContract (new java.lang.String[] {"XM1"}, "XM1", "AGB", "NOTE", "10Y")) return false; - - /* - * Canadian Treasury Futures - */ - - if (!AddContract (new java.lang.String[] {"CN1"}, "CN1", "CAN", "NOTE", "10Y")) return false; - - /* - * Danish Treasury Futures - */ - - if (!AddContract (new java.lang.String[] {"DGB"}, "DGB", "DGB", "NOTE", "10Y")) return false; - - /* - * French Treasury Futures - */ - - if (!AddContract (new java.lang.String[] {"OAT1"}, "OAT1", "FRTR", "NOTE", "10Y")) return false; - - /* - * German Treasury Futures - */ - - if (!AddContract (new java.lang.String[] {"DU1", "SCHATZ"}, "DU1", "DBR", "NOTE", "02Y")) - return false; - - if (!AddContract (new java.lang.String[] {"OE1", "BOBL"}, "OE1", "DBR", "NOTE", "05Y")) return false; - - if (!AddContract (new java.lang.String[] {"RX1", "BUND"}, "RX1", "DBR", "NOTE", "10Y")) return false; - - if (!AddContract (new java.lang.String[] {"UB1", "BUXL"}, "UB1", "DBR", "NOTE", "30Y")) return false; - - /* - * Italian Treasury Futures - */ - - if (!AddContract (new java.lang.String[] {"IK1"}, "IK1", "BTPS", "NOTE", "10Y")) return false; - - /* - * Japanese Treasury Futures - */ - - if (!AddContract (new java.lang.String[] {"JB1"}, "JB1", "JGB", "NOTE", "10Y")) return false; - - /* - * Spanish Treasury Futures - */ - - if (!AddContract (new java.lang.String[] {"FBB1"}, "FBB1", "SPGB", "NOTE", "10Y")) return false; - - /* - * Swiss Treasury Futures - */ - - if (!AddContract (new java.lang.String[] {"GSWISS"}, "GSWISS", "GSWISS", "NOTE", "10Y")) - return false; - - /* - * UK Treasury Futures - */ - - if (!AddContract (new java.lang.String[] {"WB1"}, "WB1", "GILT", "NOTE", "02Y")) return false; - - if (!AddContract (new java.lang.String[] {"G1"}, "G1", "GILT", "NOTE", "10Y")) return false; - - /* - * US Treasury Futures - */ - - if (!AddContract (new java.lang.String[] {"TU1"}, "TU1", "UST", "NOTE", "02Y")) return false; - - if (!AddContract (new java.lang.String[] {"FV1"}, "FV1", "UST", "NOTE", "05Y")) return false; - - if (!AddContract (new java.lang.String[] {"TY1"}, "TY1", "UST", "NOTE", "10Y")) return false; - - if (!AddContract (new java.lang.String[] {"US1"}, "US1", "UST", "NOTE", "20Y")) return false; - - if (!AddContract (new java.lang.String[] {"WN1", "ULTRA"}, "WN1", "UST", "NOTE", "30Y")) - return false; - - return true; - } - - /** - * Retrieve the Treasury Futures Contract by Name - * - * @param strTreasuryFuturesName The Treasury Futures Name - * - * @return The Treasury Futures Contract - */ - - public static final org.drip.market.exchange.TreasuryFuturesContract TreasuryFuturesContract ( - final java.lang.String strTreasuryFuturesName) - { - return !_mapNameContract.containsKey (strTreasuryFuturesName) ? null : _mapNameContract.get - (strTreasuryFuturesName); - } - - /** - * Retrieve the Treasury Futures Contract by Code and Tenor - * - * @param strCode The Treasury Code - * @param strTenor The Futures Tenor - * - * @return The Treasury Futures Contract - */ - - public static final org.drip.market.exchange.TreasuryFuturesContract TreasuryFuturesContract ( - final java.lang.String strCode, - final java.lang.String strTenor) - { - java.lang.String strCodeTenor = strCode + "::" + strTenor; - - return !_mapNameContract.containsKey (strCodeTenor) ? null : _mapNameContract.get (strCodeTenor); - } -} diff --git a/org/drip/market/exchange/TreasuryFuturesConvention.java b/org/drip/market/exchange/TreasuryFuturesConvention.java deleted file mode 100644 index 4034cce..0000000 --- a/org/drip/market/exchange/TreasuryFuturesConvention.java +++ /dev/null @@ -1,418 +0,0 @@ - -package org.drip.market.exchange; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * TreasuryFuturesConvention contains the Details for the Futures Basket of the Exchange-Traded Treasury - * Futures Contracts. - * - * @author Lakshmi Krishnamurthy - */ - -public class TreasuryFuturesConvention { - private java.lang.String _strName = ""; - private java.lang.String _strCalendar = ""; - private java.lang.String _strCurrency = ""; - private java.lang.String[] _astrCode = null; - private java.lang.String[] _astrExchange = null; - private java.lang.String _strMaturityTenor = ""; - private java.lang.String _strUnderlierType = ""; - private java.lang.String _strUnderlierSubtype = ""; - private double _dblBasketNotional = java.lang.Double.NaN; - private double _dblMinimumPriceMovement = java.lang.Double.NaN; - private org.drip.market.exchange.TreasuryFuturesSettle _bfs = null; - private org.drip.analytics.eventday.DateInMonth _dimExpiry = null; - private double _dblComponentNotionalMinimum = java.lang.Double.NaN; - private org.drip.market.exchange.TreasuryFuturesEligibility _bfe = null; - - /** - * TreasuryFuturesConvention Constructor - * - * @param strName The Futures Name - * @param astrCode The Array of the Futures Codes - * @param strCurrency The Futures Currency - * @param strCalendar The Futures Settle Calendar - * @param strMaturityTenor The Maturity Tenor - * @param dblBasketNotional Basket Notional - * @param dblMinimumPriceMovement The Minimum Price Movement - * @param dblComponentNotionalMinimum The Minimum Component Notional - * @param astrExchange Exchange Array - * @param strUnderlierType Underlier Type - * @param strUnderlierSubtype Underlier Sub-Type - * @param dimExpiry The Expiry Date-In-Month Setting - * @param bfe Eligibility Settings - * @param bfs Settlement Settings - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public TreasuryFuturesConvention ( - final java.lang.String strName, - final java.lang.String[] astrCode, - final java.lang.String strCurrency, - final java.lang.String strCalendar, - final java.lang.String strMaturityTenor, - final double dblBasketNotional, - final double dblMinimumPriceMovement, - final double dblComponentNotionalMinimum, - final java.lang.String[] astrExchange, - final java.lang.String strUnderlierType, - final java.lang.String strUnderlierSubtype, - final org.drip.analytics.eventday.DateInMonth dimExpiry, - final org.drip.market.exchange.TreasuryFuturesEligibility bfe, - final org.drip.market.exchange.TreasuryFuturesSettle bfs) - throws java.lang.Exception - { - if (null == (_strName = strName) || _strName.isEmpty() || null == (_astrCode = astrCode) || 0 == - _astrCode.length || null == (_strCurrency = strCurrency) || _strCurrency.isEmpty() || null == - (_strMaturityTenor = strMaturityTenor) || _strMaturityTenor.isEmpty() || - !org.drip.quant.common.NumberUtil.IsValid (_dblBasketNotional = dblBasketNotional) || - !org.drip.quant.common.NumberUtil.IsValid (_dblMinimumPriceMovement = - dblMinimumPriceMovement) || !org.drip.quant.common.NumberUtil.IsValid - (_dblComponentNotionalMinimum = dblComponentNotionalMinimum) || null == - (_astrExchange = astrExchange) || 0 == _astrExchange.length || null == - (_strUnderlierType = strUnderlierType) || _strUnderlierType.isEmpty() - || null == (_strUnderlierSubtype = strUnderlierSubtype) || - _strUnderlierSubtype.isEmpty() || null == (_dimExpiry = - dimExpiry) || null == (_bfe = bfe) || null == (_bfs = - bfs)) - throw new java.lang.Exception ("TreasuryFuturesConvention ctr: Invalid Inputs"); - - _strCalendar = strCalendar; - } - - /** - * Retrieve the Treasury Futures Name - * - * @return The Treasury Futures Name - */ - - public java.lang.String name() - { - return _strName; - } - - /** - * Retrieve the Treasury Futures Settle Calendar - * - * @return The Treasury Futures Settle Calendar - */ - - public java.lang.String calendar() - { - return _strCalendar; - } - - /** - * Retrieve the Treasury Futures Code Array - * - * @return The Treasury Futures Code Array - */ - - public java.lang.String[] codes() - { - return _astrCode; - } - - /** - * Retrieve the Treasury Futures Currency - * - * @return The Treasury Futures Currency - */ - - public java.lang.String currency() - { - return _strCurrency; - } - - /** - * Retrieve the Treasury Futures Maturity Tenor - * - * @return The Treasury Futures Maturity Tenor - */ - - public java.lang.String maturityTenor() - { - return _strMaturityTenor; - } - - /** - * Retrieve the Treasury Futures Basket Notional - * - * @return The Treasury Futures Basket Notional - */ - - public double basketNotional() - { - return _dblBasketNotional; - } - - /** - * Retrieve the Minimimum Price Movement - a.k.a Tick - * - * @return The Minimum Price Movement - */ - - public double minimumPriceMovement() - { - return _dblMinimumPriceMovement; - } - - /** - * Retrieve the Minimum Treasury Futures Component Notional - * - * @return The Minimum Treasury Futures Component Notional - */ - - public double minimumComponentNotional() - { - return _dblComponentNotionalMinimum; - } - - /** - * Retrieve the Bond Futures Exchanges Array - * - * @return The Bond Futures Exchanges Array - */ - - public java.lang.String[] exchanges() - { - return _astrExchange; - } - - /** - * Retrieve the Treasury Futures Underlier Type - * - * @return The Treasury Futures Underlier Type - */ - - public java.lang.String underlierType() - { - return _strUnderlierType; - } - - /** - * Retrieve the Treasury Futures Underlier Sub-type - * - * @return The Treasury Futures Underlier Sub-type - */ - - public java.lang.String underlierSubtype() - { - return _strUnderlierSubtype; - } - - /** - * Retrieve the Date In Month Expiry Settings - * - * @return The Date In Month Expiry Settings - */ - - public org.drip.analytics.eventday.DateInMonth dimExpiry() - { - return _dimExpiry; - } - - /** - * Retrieve the Treasury Futures Eligibility Settings - * - * @return The Treasury Futures Eligibility Settings - */ - - public org.drip.market.exchange.TreasuryFuturesEligibility eligibility() - { - return _bfe; - } - - /** - * Retrieve the Treasury Futures Settle Settings - * - * @return The Treasury Futures Settle Settings - */ - - public org.drip.market.exchange.TreasuryFuturesSettle settle() - { - return _bfs; - } - - /** - * Retrieve the TreasuryFuturesEventDates Instance corresponding to the Futures Expiry Year/Month - * - * @param iYear Futures Year - * @param iMonth Futures Month - * - * @return The TreasuryFuturesEventDates Instance - */ - - public org.drip.market.exchange.TreasuryFuturesEventDates eventDates ( - final int iYear, - final int iMonth) - { - org.drip.analytics.date.JulianDate dtExpiry = _dimExpiry.instanceDay (iYear, iMonth, _strCalendar); - - if (null == dtExpiry) return null; - - try { - return new org.drip.market.exchange.TreasuryFuturesEventDates (dtExpiry, dtExpiry.addBusDays - (_bfs.expiryFirstDeliveryLag(), _strCalendar), dtExpiry.addBusDays - (_bfs.expiryFinalDeliveryLag(), _strCalendar), dtExpiry.addBusDays - (_bfs.expiryDeliveryNoticeLag(), _strCalendar), dtExpiry.addBusDays - (_bfs.expiryFirstDeliveryLag(), _strCalendar)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Reference Bond Price from the Quoted Futures Index Level - * - * @param dblFuturesQuotedIndex The Quoted Futures Index Level - * - * @return The Reference Price - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public double referencePrice ( - final double dblFuturesQuotedIndex) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblFuturesQuotedIndex)) - throw new java.lang.Exception ("TreasuryFuturesConvention::referencePrice => Invalid Inputs!"); - - double dblPeriodReferenceYield = 0.5 * (1. - dblFuturesQuotedIndex); - - double dblCompoundedDF = java.lang.Math.pow (1. / (1. + dblPeriodReferenceYield), - org.drip.analytics.support.Helper.TenorToMonths (_strMaturityTenor) / 6); - - return dblCompoundedDF + 0.5 * _bfs.currentReferenceYield() * (1. - dblCompoundedDF) / - dblPeriodReferenceYield; - } - - /** - * Compute the Reference Bond Price from the Quoted Futures Index Level - * - * @param dtValue The Valuation Date - * @param bond The Bond Instance - * @param dblFuturesQuotedIndex The Quoted Futures Index Level - * - * @return The Reference Price - * - * @throws java.lang.Exception Thrown if the Treasury Futures Price Generic cannot be computed - */ - - public double referencePrice ( - final org.drip.analytics.date.JulianDate dtValue, - final org.drip.product.definition.Bond bond, - final double dblFuturesQuotedIndex) - throws java.lang.Exception - { - if (null == dtValue || null == bond) return referencePrice (dblFuturesQuotedIndex); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblFuturesQuotedIndex)) - throw new java.lang.Exception ("AnalyticsHelper::referencePrice => Invalid Inputs"); - - return bond.priceFromYield (new org.drip.param.valuation.ValuationParams (dtValue, dtValue, null), - null, null, 1. - dblFuturesQuotedIndex); - } - - /** - * Indicate whether the given bond is eligible to be delivered - * - * @param dtValue The Value Date - * @param bond The Bond whose Eligibility is to be evaluated - * @param dblOutstandingNotional The Outstanding Notional - * @param strIssuer The Issuer - * - * @return TRUE - The given bond is eligible to be delivered - */ - - public boolean isEligible ( - final org.drip.analytics.date.JulianDate dtValue, - final org.drip.product.definition.Bond bond, - final double dblOutstandingNotional, - final java.lang.String strIssuer) - { - return _bfe.isEligible (dtValue, bond, dblOutstandingNotional, strIssuer); - } - - @Override public java.lang.String toString() - { - java.lang.String strDump = "Name: " + _strName + " | Currency: " + _strCurrency + " | Calendar: " + - _strCalendar + " | Underlier Type: " + _strUnderlierType + " | Underlier Sub-type: " + - _strUnderlierSubtype + " | Maturity Tenor: " + _strMaturityTenor + " | Basket Notional: " + - _dblBasketNotional + " | Minimum Price Movement: " + _dblMinimumPriceMovement + - " | Component Notional Minimum: " + _dblComponentNotionalMinimum; - - for (int i = 0; i < _astrCode.length; ++i) { - if (0 == i) - strDump += " | CODES => {"; - else - strDump += ", "; - - strDump += _astrCode[i]; - - if (_astrExchange.length - 1 == i) strDump += "}"; - } - - for (int i = 0; i < _astrExchange.length; ++i) { - if (0 == i) - strDump += " | EXCHANGES => ("; - else - strDump += ", "; - - strDump += _astrExchange[i]; - - if (_astrExchange.length - 1 == i) strDump += ") "; - } - - return strDump + "\n\t\t" + _dimExpiry + "\n\t\t" + _bfe + "\n\t\t" + _bfs; - } -} diff --git a/org/drip/market/exchange/TreasuryFuturesConventionContainer.java b/org/drip/market/exchange/TreasuryFuturesConventionContainer.java deleted file mode 100644 index 4a9f49a..0000000 --- a/org/drip/market/exchange/TreasuryFuturesConventionContainer.java +++ /dev/null @@ -1,344 +0,0 @@ - -package org.drip.market.exchange; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * TreasuryFuturesConventionContainer holds the Details of the Treasury Futures Contracts. - * - * @author Lakshmi Krishnamurthy - */ - -public class TreasuryFuturesConventionContainer { - private static final java.util.Map - _mapFutures = new - java.util.TreeMap(); - - /** - * Initialize the Bond Futures Convention Container with the Conventions - * - * @return TRUE - The Bond Futures Convention Container successfully initialized with the Conventions - */ - - public static final boolean Init() - { - int[] aiStandardDeliveryMonth = {org.drip.analytics.date.DateUtil.FEBRUARY, - org.drip.analytics.date.DateUtil.MAY, org.drip.analytics.date.DateUtil.AUGUST, - org.drip.analytics.date.DateUtil.NOVEMBER}; - - try { - _mapFutures.put ("AUD-BANK-BILLS-3M", new org.drip.market.exchange.TreasuryFuturesConvention - ("AUD-BANKBILLS-3M", new java.lang.String[] {"AUD-BANKBILLS-3M"}, "AUD", "AUD", "3M", - 1000000., 0.03125, 100000., new java.lang.String[] {"ASX"}, "BANK", "BILLS", new - org.drip.analytics.eventday.DateInMonth - (org.drip.analytics.eventday.DateInMonth.INSTANCE_GENERATOR_RULE_WEEK_DAY, false, - -1, org.drip.analytics.date.DateUtil.FRIDAY, 2, -1), new - org.drip.market.exchange.TreasuryFuturesEligibility ("85D", "95D", new - java.lang.String[] - {"Australia and New Zealand Banking Group Limited", - "Commonwealth Bank of Australia", - "National Australia Bank Limited", - "Westpac Banking Corporation"}, 0.), new - org.drip.market.exchange.TreasuryFuturesSettle (1, 1, - 0, 0, - org.drip.market.exchange.TreasuryFuturesSettle.SETTLE_TYPE_PHYSICAL_DELIVERY, - org.drip.market.exchange.TreasuryFuturesSettle.QUOTE_REFERENCE_INDEX_FLAT, false, - java.lang.Double.NaN, java.lang.Double.NaN, aiStandardDeliveryMonth))); - - _mapFutures.put ("AUD-TREASURY-BOND-3Y", new org.drip.market.exchange.TreasuryFuturesConvention - ("AUD-TREASURY-BOND-3Y", new java.lang.String[] {"YMA"}, "AUD", "AUD", "3Y", 100000., 0.03125, - 0., new java.lang.String[] {"SFE"}, "TREASURY", "BOND", new - org.drip.analytics.eventday.DateInMonth - (org.drip.analytics.eventday.DateInMonth.INSTANCE_GENERATOR_RULE_WEEK_DAY, false, - -1, org.drip.analytics.date.DateUtil.FRIDAY, 2, -1), new - org.drip.market.exchange.TreasuryFuturesEligibility ("2Y", "4Y", new - java.lang.String[] {}, 0.), new - org.drip.market.exchange.TreasuryFuturesSettle (1, 1, 0, 0, - org.drip.market.exchange.TreasuryFuturesSettle.SETTLE_TYPE_CASH, - org.drip.market.exchange.TreasuryFuturesSettle.QUOTE_REFERENCE_INDEX_AUD_BOND_FUTURES_STYLE, - false, java.lang.Double.NaN, java.lang.Double.NaN, aiStandardDeliveryMonth))); - - _mapFutures.put ("AUD-TREASURY-BOND-10Y", new org.drip.market.exchange.TreasuryFuturesConvention - ("AUD-TREASURY-BOND-10Y", new java.lang.String[] {"XMA"}, "AUD", "AUD", "10Y", 100000., - 0.03125, 0., new java.lang.String[] {"SFE"}, "TREASURY", "BOND", new - org.drip.analytics.eventday.DateInMonth - (org.drip.analytics.eventday.DateInMonth.INSTANCE_GENERATOR_RULE_WEEK_DAY, false, - -1, org.drip.analytics.date.DateUtil.FRIDAY, 2, -1), new - org.drip.market.exchange.TreasuryFuturesEligibility ("8Y", "12Y", new - java.lang.String[] {}, 0.), new - org.drip.market.exchange.TreasuryFuturesSettle (1, 1, 0, 0, - org.drip.market.exchange.TreasuryFuturesSettle.SETTLE_TYPE_CASH, - org.drip.market.exchange.TreasuryFuturesSettle.QUOTE_REFERENCE_INDEX_AUD_BOND_FUTURES_STYLE, - false, java.lang.Double.NaN, java.lang.Double.NaN, aiStandardDeliveryMonth))); - - _mapFutures.put ("USD-TREASURY-BOND-ULTRA", new org.drip.market.exchange.TreasuryFuturesConvention - ("ULTRA T-BOND", new java.lang.String[] {"UB", "UL", "UBE"}, "USD", "USD", "ULTRA", 100000., - 0.03125, 0., new java.lang.String[] {"CBOT"}, "TREASURY", "BOND", new - org.drip.analytics.eventday.DateInMonth - (org.drip.analytics.eventday.DateInMonth.INSTANCE_GENERATOR_RULE_EDGE_LAG, true, - 7, -1, -1, -1), new org.drip.market.exchange.TreasuryFuturesEligibility ("25Y", - "MAX", new java.lang.String[] {"US Government Bonds"}, 0.), new - org.drip.market.exchange.TreasuryFuturesSettle (1, 1, -1, 0, - org.drip.market.exchange.TreasuryFuturesSettle.SETTLE_TYPE_PHYSICAL_DELIVERY, - org.drip.market.exchange.TreasuryFuturesSettle.QUOTE_REFERENCE_INDEX_CONVERSION_FACTOR, false, - 0.06, 0.06, aiStandardDeliveryMonth))); - - _mapFutures.put ("USD-TREASURY-BOND-30Y", new org.drip.market.exchange.TreasuryFuturesConvention - ("USD 30-YR BOND", new java.lang.String[] {"ZB", "US"}, "USD", "USD", "30Y", 100000., 0.03125, - 0., new java.lang.String[] {"CBOT"}, "TREASURY", "BOND", new - org.drip.analytics.eventday.DateInMonth - (org.drip.analytics.eventday.DateInMonth.INSTANCE_GENERATOR_RULE_EDGE_LAG, true, - 7, -1, -1, -1), new org.drip.market.exchange.TreasuryFuturesEligibility ("15Y", - "25Y", new java.lang.String[] {"US Government Bonds"}, 0.), new - org.drip.market.exchange.TreasuryFuturesSettle (1, 1, -1, 0, - org.drip.market.exchange.TreasuryFuturesSettle.SETTLE_TYPE_PHYSICAL_DELIVERY, - org.drip.market.exchange.TreasuryFuturesSettle.QUOTE_REFERENCE_INDEX_CONVERSION_FACTOR, false, - 0.06, 0.06, aiStandardDeliveryMonth))); - - _mapFutures.put ("USD-TREASURY-NOTE-10Y", new org.drip.market.exchange.TreasuryFuturesConvention - ("USD 10-YR NOTE", new java.lang.String[] {"ZN", "TY"}, "USD", "USD", "10Y", 100000., 0.03125, - 0., new java.lang.String[] {"CBOT"}, "TREASURY", "NOTE", new - org.drip.analytics.eventday.DateInMonth - (org.drip.analytics.eventday.DateInMonth.INSTANCE_GENERATOR_RULE_EDGE_LAG, true, - 7, -1, -1, -1), new org.drip.market.exchange.TreasuryFuturesEligibility ("78M", - "10Y", new java.lang.String[] {"US Government Bonds"}, 0.), new - org.drip.market.exchange.TreasuryFuturesSettle (1, 1, -1, 0, - org.drip.market.exchange.TreasuryFuturesSettle.SETTLE_TYPE_PHYSICAL_DELIVERY, - org.drip.market.exchange.TreasuryFuturesSettle.QUOTE_REFERENCE_INDEX_CONVERSION_FACTOR, false, - 0.06, 0.06, aiStandardDeliveryMonth))); - - _mapFutures.put ("USD-TREASURY-NOTE-5Y", new org.drip.market.exchange.TreasuryFuturesConvention - ("USD 5-YR NOTE", new java.lang.String[] {"ZF", "FV"}, "USD", "USD", "5Y", 100000., 0.03125, - 0., new java.lang.String[] {"CBOT"}, "TREASURY", "NOTE", new - org.drip.analytics.eventday.DateInMonth - (org.drip.analytics.eventday.DateInMonth.INSTANCE_GENERATOR_RULE_EDGE_LAG, true, - 0, -1, -1, -1), new org.drip.market.exchange.TreasuryFuturesEligibility ("50M", - "63M", new java.lang.String[] {"US Government Bonds"}, 0.), new - org.drip.market.exchange.TreasuryFuturesSettle (3, 3, 0, 0, - org.drip.market.exchange.TreasuryFuturesSettle.SETTLE_TYPE_PHYSICAL_DELIVERY, - org.drip.market.exchange.TreasuryFuturesSettle.QUOTE_REFERENCE_INDEX_CONVERSION_FACTOR, false, - 0.06, 0.06, aiStandardDeliveryMonth))); - - _mapFutures.put ("USD-TREASURY-NOTE-3Y", new org.drip.market.exchange.TreasuryFuturesConvention - ("USD 3-YR NOTE", new java.lang.String[] {"Z3N", "3YR"}, "USD", "USD", "3Y", 200000., 0.03125, - 0., new java.lang.String[] {"CBOT"}, "TREASURY", "NOTE", new - org.drip.analytics.eventday.DateInMonth - (org.drip.analytics.eventday.DateInMonth.INSTANCE_GENERATOR_RULE_EDGE_LAG, true, - 0, -1, -1, -1), new org.drip.market.exchange.TreasuryFuturesEligibility ("33M", - "3Y", new java.lang.String[] {"US Government Bonds"}, 0.), new - org.drip.market.exchange.TreasuryFuturesSettle (1, 1, 0, 0, - org.drip.market.exchange.TreasuryFuturesSettle.SETTLE_TYPE_PHYSICAL_DELIVERY, - org.drip.market.exchange.TreasuryFuturesSettle.QUOTE_REFERENCE_INDEX_CONVERSION_FACTOR, false, - 0.06, 0.06, aiStandardDeliveryMonth))); - - _mapFutures.put ("USD-TREASURY-NOTE-2Y", new org.drip.market.exchange.TreasuryFuturesConvention - ("USD 2-YR NOTE", new java.lang.String[] {"ZT", "TU"}, "USD", "USD", "2Y", 200000., 0.03125, - 0., new java.lang.String[] {"CBOT"}, "TREASURY", "NOTE", new - org.drip.analytics.eventday.DateInMonth - (org.drip.analytics.eventday.DateInMonth.INSTANCE_GENERATOR_RULE_EDGE_LAG, true, - 0, -1, -1, -1), new org.drip.market.exchange.TreasuryFuturesEligibility ("21M", - "2Y", new java.lang.String[] {"US Government Bonds"}, 0.), new - org.drip.market.exchange.TreasuryFuturesSettle (1, 1, 0, 0, - org.drip.market.exchange.TreasuryFuturesSettle.SETTLE_TYPE_PHYSICAL_DELIVERY, - org.drip.market.exchange.TreasuryFuturesSettle.QUOTE_REFERENCE_INDEX_CONVERSION_FACTOR, false, - 0.06, 0.06, aiStandardDeliveryMonth))); - - _mapFutures.put ("EUR-EURO-BUXL-30Y", new org.drip.market.exchange.TreasuryFuturesConvention - ("EUR EURO-BUXL", new java.lang.String[] {"BUXL"}, "EUR", "EUR", "30Y", 100000., 0.03125, 0., - new java.lang.String[] {"EUREX"}, "EURO", "BUXL", new - org.drip.analytics.eventday.DateInMonth - (org.drip.analytics.eventday.DateInMonth.INSTANCE_GENERATOR_RULE_EDGE_LAG, true, - 10, -1, -1, -1), new org.drip.market.exchange.TreasuryFuturesEligibility ("24Y", - "35Y", new java.lang.String[] {"EUR-Germany BUXL Bonds"}, 5000000000.), - new org.drip.market.exchange.TreasuryFuturesSettle (1, 1, 0, 2, - org.drip.market.exchange.TreasuryFuturesSettle.SETTLE_TYPE_PHYSICAL_DELIVERY, - org.drip.market.exchange.TreasuryFuturesSettle.QUOTE_REFERENCE_INDEX_CONVERSION_FACTOR, false, - 0.04, 0.04, aiStandardDeliveryMonth))); - - _mapFutures.put ("EUR-EURO-BUND-10Y", new org.drip.market.exchange.TreasuryFuturesConvention - ("EUR EURO-BUND", new java.lang.String[] {"BUND"}, "EUR", "EUR", "10Y", 100000., 0.03125, 0., - new java.lang.String[] {"EUREX", "NLX"}, "EURO", "BUND", new - org.drip.analytics.eventday.DateInMonth - (org.drip.analytics.eventday.DateInMonth.INSTANCE_GENERATOR_RULE_EDGE_LAG, true, - 10, -1, -1, -1), new org.drip.market.exchange.TreasuryFuturesEligibility ("102M", - "126M", new java.lang.String[] {"EUR-Germany BUND Bonds"}, 5000000000.), - new org.drip.market.exchange.TreasuryFuturesSettle (1, 1, 0, 2, - org.drip.market.exchange.TreasuryFuturesSettle.SETTLE_TYPE_PHYSICAL_DELIVERY, - org.drip.market.exchange.TreasuryFuturesSettle.QUOTE_REFERENCE_INDEX_CONVERSION_FACTOR, false, - 0.06, 0.06, aiStandardDeliveryMonth))); - - _mapFutures.put ("EUR-EURO-BOBL-5Y", new org.drip.market.exchange.TreasuryFuturesConvention - ("EUR EURO-BUND", new java.lang.String[] {"BOBL"}, "EUR", "EUR", "5Y", 100000., 0.03125, 0., - new java.lang.String[] {"EUREX", "NLX"}, "EURO", "BOBL", new - org.drip.analytics.eventday.DateInMonth - (org.drip.analytics.eventday.DateInMonth.INSTANCE_GENERATOR_RULE_EDGE_LAG, true, - 10, -1, -1, -1), new org.drip.market.exchange.TreasuryFuturesEligibility ("54M", - "66M", new java.lang.String[] {"EUR-Germany BOBL Bonds"}, 5000000000.), - new org.drip.market.exchange.TreasuryFuturesSettle (1, 1, 0, 2, - org.drip.market.exchange.TreasuryFuturesSettle.SETTLE_TYPE_PHYSICAL_DELIVERY, - org.drip.market.exchange.TreasuryFuturesSettle.QUOTE_REFERENCE_INDEX_CONVERSION_FACTOR, false, - 0.06, 0.06, aiStandardDeliveryMonth))); - - _mapFutures.put ("EUR-EURO-SCHATZ-2Y", new org.drip.market.exchange.TreasuryFuturesConvention - ("EUR EURO-BUND", new java.lang.String[] {"SCHATZ"}, "EUR", "EUR", "2Y", 100000., 0.03125, 0., - new java.lang.String[] {"EUREX", "NLX"}, "EURO", "SCHATZ", new - org.drip.analytics.eventday.DateInMonth - (org.drip.analytics.eventday.DateInMonth.INSTANCE_GENERATOR_RULE_EDGE_LAG, true, - 10, -1, -1, -1), new org.drip.market.exchange.TreasuryFuturesEligibility ("21M", - "27M", new java.lang.String[] {"EUR-Germany SCHATZ Bonds"}, 5000000000.), - new org.drip.market.exchange.TreasuryFuturesSettle (1, 1, 0, 2, - org.drip.market.exchange.TreasuryFuturesSettle.SETTLE_TYPE_PHYSICAL_DELIVERY, - org.drip.market.exchange.TreasuryFuturesSettle.QUOTE_REFERENCE_INDEX_CONVERSION_FACTOR, false, - 0.06, 0.06, aiStandardDeliveryMonth))); - - _mapFutures.put ("EUR-TREASURY-BONO-10Y", new org.drip.market.exchange.TreasuryFuturesConvention - ("EUR 10Y BONO", new java.lang.String[] {"10Y-BONO"}, "EUR", "EUR", "10Y", 100000., 0.03125, - 0., new java.lang.String[] {"MEFF", "SENAF"}, "TREASURY", "BONO", new - org.drip.analytics.eventday.DateInMonth - (org.drip.analytics.eventday.DateInMonth.INSTANCE_GENERATOR_RULE_SPECIFIC_DAY_OF_MONTH, - false, 7, -1, -1, 10), new org.drip.market.exchange.TreasuryFuturesEligibility ("102M", "MAX", - new java.lang.String[] {"EUR BONO"}, 0.), new org.drip.market.exchange.TreasuryFuturesSettle - (1, 1, -2, -2, - org.drip.market.exchange.TreasuryFuturesSettle.SETTLE_TYPE_PHYSICAL_DELIVERY, - org.drip.market.exchange.TreasuryFuturesSettle.QUOTE_REFERENCE_INDEX_CONVERSION_FACTOR, - false, 0.06, 0.06, aiStandardDeliveryMonth))); - - _mapFutures.put ("GBP-SHORT-GILT-2Y", new org.drip.market.exchange.TreasuryFuturesConvention - ("GBP SHORT-GILT", new java.lang.String[] {"SHORT-GILT"}, "GBP", "GBP", "2Y", 100000., - 0.03125, 0., new java.lang.String[] {"LIFFE"}, "SHORT", "GILT", new - org.drip.analytics.eventday.DateInMonth - (org.drip.analytics.eventday.DateInMonth.INSTANCE_GENERATOR_RULE_EDGE_LAG, true, - 2, -1, -1, -1), new org.drip.market.exchange.TreasuryFuturesEligibility ("18M", - "39M", new java.lang.String[] {"GBP Short GILT Bonds"}, 0.), new - org.drip.market.exchange.TreasuryFuturesSettle (0, 22, -2, 0, - org.drip.market.exchange.TreasuryFuturesSettle.SETTLE_TYPE_PHYSICAL_DELIVERY, - org.drip.market.exchange.TreasuryFuturesSettle.QUOTE_REFERENCE_INDEX_CONVERSION_FACTOR, false, - 0.04, 0.06, aiStandardDeliveryMonth))); - - _mapFutures.put ("GBP-MEDIUM-GILT-5Y", new org.drip.market.exchange.TreasuryFuturesConvention - ("GBP MEDIUM-GILT", new java.lang.String[] {"MEDIUM-GILT"}, "GBP", "GBP", "5Y", 100000., - 0.03125, 0., new java.lang.String[] {"LIFFE"}, "MEDIUM", "GILT", new - org.drip.analytics.eventday.DateInMonth - (org.drip.analytics.eventday.DateInMonth.INSTANCE_GENERATOR_RULE_EDGE_LAG, true, - 2, -1, -1, -1), new org.drip.market.exchange.TreasuryFuturesEligibility ("4Y", - "75M", new java.lang.String[] {"GBP Medium GILT Bonds"}, 0.), new - org.drip.market.exchange.TreasuryFuturesSettle (0, 22, -2, 0, - org.drip.market.exchange.TreasuryFuturesSettle.SETTLE_TYPE_PHYSICAL_DELIVERY, - org.drip.market.exchange.TreasuryFuturesSettle.QUOTE_REFERENCE_INDEX_CONVERSION_FACTOR, false, - 0.04, 0.06, aiStandardDeliveryMonth))); - - _mapFutures.put ("GBP-LONG-GILT-10Y", new org.drip.market.exchange.TreasuryFuturesConvention - ("GBP LONG-GILT", new java.lang.String[] {"LONG-GILT"}, "GBP", "GBP", "10Y", 100000., 0.03125, - 0., new java.lang.String[] {"LIFFE", "NLX"}, "MEDIUM", "GILT", new - org.drip.analytics.eventday.DateInMonth - (org.drip.analytics.eventday.DateInMonth.INSTANCE_GENERATOR_RULE_EDGE_LAG, true, - 2, -1, -1, -1), new org.drip.market.exchange.TreasuryFuturesEligibility ("105M", - "13Y", new java.lang.String[] {"GBP Long GILT Bonds"}, 0.), new - org.drip.market.exchange.TreasuryFuturesSettle (0, 22, -2, 0, - org.drip.market.exchange.TreasuryFuturesSettle.SETTLE_TYPE_PHYSICAL_DELIVERY, - org.drip.market.exchange.TreasuryFuturesSettle.QUOTE_REFERENCE_INDEX_CONVERSION_FACTOR, false, - 0.03, 0.06, aiStandardDeliveryMonth))); - - _mapFutures.put ("JPY-TREASURY-JGB-5Y", new org.drip.market.exchange.TreasuryFuturesConvention - ("JPY 5Y JGB", new java.lang.String[] {"5Y-JGB"}, "JPY", "JPY", "5Y", 1000000000., 0.03125, - 0., new java.lang.String[] {"TSE"}, "TREASURY", "JGB", new - org.drip.analytics.eventday.DateInMonth - (org.drip.analytics.eventday.DateInMonth.INSTANCE_GENERATOR_RULE_SPECIFIC_DAY_OF_MONTH, - true, 7, -1, -1, 20), new org.drip.market.exchange.TreasuryFuturesEligibility ("4Y", "63M", new - java.lang.String[] {"JPY JGB"}, 0.), new org.drip.market.exchange.TreasuryFuturesSettle (1, - 1, 0, -7, org.drip.market.exchange.TreasuryFuturesSettle.SETTLE_TYPE_PHYSICAL_DELIVERY, - org.drip.market.exchange.TreasuryFuturesSettle.QUOTE_REFERENCE_INDEX_CONVERSION_FACTOR, - false, 0.03, 0.03, aiStandardDeliveryMonth))); - - _mapFutures.put ("JPY-TREASURY-JGB-10Y", new org.drip.market.exchange.TreasuryFuturesConvention - ("JPY 10Y JGB", new java.lang.String[] {"10Y-JGB"}, "JPY", "JPY", "10Y", 1000000000., 0.03125, - 0., new java.lang.String[] {"TSE"}, "TREASURY", "JGB", new - org.drip.analytics.eventday.DateInMonth - (org.drip.analytics.eventday.DateInMonth.INSTANCE_GENERATOR_RULE_SPECIFIC_DAY_OF_MONTH, - true, 7, -1, -1, 20), new org.drip.market.exchange.TreasuryFuturesEligibility ("7Y", "10Y", new - java.lang.String[] {"JPY JGB"}, 0.), new org.drip.market.exchange.TreasuryFuturesSettle (1, - 1, 0, -7, org.drip.market.exchange.TreasuryFuturesSettle.SETTLE_TYPE_PHYSICAL_DELIVERY, - org.drip.market.exchange.TreasuryFuturesSettle.QUOTE_REFERENCE_INDEX_CONVERSION_FACTOR, - false, 0.06, 0.06, aiStandardDeliveryMonth))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - return true; - } - - /** - * Retrieve the Treasury Futures Convention from the Currency, the Type, the Sub-type, and the Maturity - * Tenor - * - * @param strCurrency The Currency - * @param strUnderlierType The Underlier Type - * @param strUnderlierSubtype The Underlier Sub-type - * @param strMaturityTenor The Maturity Tenor - * - * @return The Treasury Futures Instance - */ - - public static final org.drip.market.exchange.TreasuryFuturesConvention FromJurisdictionTypeMaturity ( - final java.lang.String strCurrency, - final java.lang.String strUnderlierType, - final java.lang.String strUnderlierSubtype, - final java.lang.String strMaturityTenor) - { - if (null == strCurrency || strCurrency.isEmpty() || null == strUnderlierType || - strUnderlierType.isEmpty() || null == strUnderlierSubtype || strUnderlierSubtype.isEmpty() || - null == strMaturityTenor || strMaturityTenor.isEmpty()) - return null; - - java.lang.String strKey = strCurrency + "-" + strUnderlierType + "-" + strUnderlierSubtype + "-" + - strMaturityTenor; - - return _mapFutures.containsKey (strKey) ? _mapFutures.get (strKey) : null; - } -} diff --git a/org/drip/market/exchange/TreasuryFuturesEligibility.java b/org/drip/market/exchange/TreasuryFuturesEligibility.java deleted file mode 100644 index fefcfca..0000000 --- a/org/drip/market/exchange/TreasuryFuturesEligibility.java +++ /dev/null @@ -1,202 +0,0 @@ - -package org.drip.market.exchange; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * TreasuryFuturesEligibility contains the Eligibility Criterion for a Bond in the Futures Basket of the - * Exchange-Traded Treasury Futures Contracts. - * - * @author Lakshmi Krishnamurthy - */ - -public class TreasuryFuturesEligibility { - private java.lang.String[] _astrIssuer = null; - private java.lang.String _strMaturityFloor = ""; - private java.lang.String _strMaturityCeiling = ""; - private double _dblMinimumOutstandingNotional = java.lang.Double.NaN; - - /** - * TreasuryFuturesEligibility Constructor - * - * @param strMaturityFloor Maturity Floor - * @param strMaturityCeiling Maturity Floor - * @param astrIssuer Array of Issuers - * @param dblMinimumOutstandingNotional Minimum Outstanding Notional - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public TreasuryFuturesEligibility ( - final java.lang.String strMaturityFloor, - final java.lang.String strMaturityCeiling, - final java.lang.String[] astrIssuer, - final double dblMinimumOutstandingNotional) - throws java.lang.Exception - { - if (null == (_strMaturityFloor = strMaturityFloor) || _strMaturityFloor.isEmpty() || null == - (_strMaturityCeiling = strMaturityCeiling) || _strMaturityCeiling.isEmpty() || - !org.drip.quant.common.NumberUtil.IsValid (_dblMinimumOutstandingNotional = - dblMinimumOutstandingNotional)) - throw new java.lang.Exception ("TreasuryFuturesEligibility ctr: Invalid Inputs"); - - if (null != (_astrIssuer = astrIssuer)) { - int iNumIssuer = _astrIssuer.length; - - for (int i = 0; i < iNumIssuer; ++i) { - if (null == _astrIssuer[i] || _astrIssuer[i].isEmpty()) - throw new java.lang.Exception ("TreasuryFuturesEligibility ctr: Invalid Issuer"); - } - } - } - - /** - * Retrieve the Eligible Maturity Floor - * - * @return Array of Eligible Maturity Floor - */ - - public java.lang.String maturityFloor() - { - return _strMaturityFloor; - } - - /** - * Retrieve the Eligible Maturity Ceiling - * - * @return Array of Eligible Maturity Ceiling - */ - - public java.lang.String maturityCeiling() - { - return _strMaturityCeiling; - } - - /** - * Retrieve the Array of Eligible Issuers - * - * @return Array of Eligible Issuers - */ - - public java.lang.String[] issuer() - { - return _astrIssuer; - } - - /** - * Retrieve the Minimum Outstanding Notional - * - * @return The Minimum Outstanding Notional - */ - - public double minimumOutstandingNotional() - { - return _dblMinimumOutstandingNotional; - } - - /** - * Indicate whether the given bond is eligible to be delivered - * - * @param dtValue The Value Date - * @param bond The Bond whose Eligibility is to be evaluated - * @param dblOutstandingNotional The Outstanding Notional - * @param strIssuer The Issuer - * - * @return TRUE - The given bond is eligible to be delivered - */ - - public boolean isEligible ( - final org.drip.analytics.date.JulianDate dtValue, - final org.drip.product.definition.Bond bond, - final double dblOutstandingNotional, - final java.lang.String strIssuer) - { - if (null == bond || null == dtValue) return false; - - org.drip.analytics.date.JulianDate dtFloorMaturity = dtValue.addTenor (_strMaturityFloor); - - org.drip.analytics.date.JulianDate dtCeilingMaturity = dtValue.addTenor (_strMaturityCeiling); - - if (null == dtFloorMaturity || null == dtFloorMaturity) return false; - - int iValueDate = dtValue.julian(); - - if (iValueDate < dtFloorMaturity.julian() || iValueDate > dtCeilingMaturity.julian()) return false; - - if (0. != _dblMinimumOutstandingNotional && org.drip.quant.common.NumberUtil.IsValid - (dblOutstandingNotional) && dblOutstandingNotional < _dblMinimumOutstandingNotional) - return false; - - if (null == strIssuer || strIssuer.isEmpty() || null == _astrIssuer) return true; - - int iNumIssuer = _astrIssuer.length; - - if (0 == iNumIssuer) return true; - - for (int i = 0; i < iNumIssuer; ++i) { - if (_astrIssuer[i].equalsIgnoreCase (strIssuer)) return true; - } - - return false; - } - - @Override public java.lang.String toString() - { - java.lang.String strDump = "[Futures Eligibility => Maturity Band: " + _strMaturityFloor + " -> " + - _strMaturityCeiling + "] [Issuers: "; - - if (null == _astrIssuer) return strDump + "]"; - - for (int i = 0; i < _astrIssuer.length; ++i) { - if (0 != i) strDump += " | "; - - strDump += _astrIssuer[i]; - } - - return strDump + "] [Minimum Outstanding Notional: " + _dblMinimumOutstandingNotional + "]"; - } -} diff --git a/org/drip/market/exchange/TreasuryFuturesEventDates.java b/org/drip/market/exchange/TreasuryFuturesEventDates.java deleted file mode 100644 index 1c9551a..0000000 --- a/org/drip/market/exchange/TreasuryFuturesEventDates.java +++ /dev/null @@ -1,150 +0,0 @@ - -package org.drip.market.exchange; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * TreasuryFuturesEventDates contains the actually realized Event Dates related to a Treasury Futures - * Contract. - * - * @author Lakshmi Krishnamurthy - */ - -public class TreasuryFuturesEventDates { - private org.drip.analytics.date.JulianDate _dtExpiry = null; - private org.drip.analytics.date.JulianDate _dtLastTrading = null; - private org.drip.analytics.date.JulianDate _dtFirstDelivery = null; - private org.drip.analytics.date.JulianDate _dtFinalDelivery = null; - private org.drip.analytics.date.JulianDate _dtDeliveryNotice = null; - - /** - * TreasuryFuturesEventDates Constructor - * - * @param dtExpiry The Expiry Date - * @param dtFirstDelivery The First Delivery Date - * @param dtFinalDelivery The Final Delivery Date - * @param dtDeliveryNotice The Delivery Notice Date - * @param dtLastTrading The Last Trading Date - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public TreasuryFuturesEventDates ( - final org.drip.analytics.date.JulianDate dtExpiry, - final org.drip.analytics.date.JulianDate dtFirstDelivery, - final org.drip.analytics.date.JulianDate dtFinalDelivery, - final org.drip.analytics.date.JulianDate dtDeliveryNotice, - final org.drip.analytics.date.JulianDate dtLastTrading) - throws java.lang.Exception - { - if (null == (_dtExpiry = dtExpiry) || null == (_dtFirstDelivery = dtFirstDelivery) || null == - (_dtFinalDelivery = dtFinalDelivery) || null == (_dtDeliveryNotice = dtDeliveryNotice) || null == - (_dtLastTrading = dtLastTrading)) - throw new java.lang.Exception ("TreasuryFuturesEventDates ctr: Invalid Inputs"); - } - - /** - * Retrieve the Expiry Date - * - * @return The Expiry Date - */ - - public org.drip.analytics.date.JulianDate expiry() - { - return _dtExpiry; - } - - /** - * Retrieve the First Delivery Date - * - * @return The First Delivery Date - */ - - public org.drip.analytics.date.JulianDate firstDelivery() - { - return _dtFirstDelivery; - } - - /** - * Retrieve the Final Delivery Date - * - * @return The Final Delivery Date - */ - - public org.drip.analytics.date.JulianDate finalDelivery() - { - return _dtFinalDelivery; - } - - /** - * Retrieve the Delivery Notice Date - * - * @return The Delivery Notice Date - */ - - public org.drip.analytics.date.JulianDate deliveryNotice() - { - return _dtDeliveryNotice; - } - - /** - * Retrieve the Last Trading Date - * - * @return The Last Trading Date - */ - - public org.drip.analytics.date.JulianDate lastTrading() - { - return _dtLastTrading; - } - - @Override public java.lang.String toString() - { - return _dtExpiry + " | " + _dtFirstDelivery + " | " + _dtFirstDelivery + " | " + _dtDeliveryNotice - + " | " + _dtLastTrading; - } -} diff --git a/org/drip/market/exchange/TreasuryFuturesOptionContainer.java b/org/drip/market/exchange/TreasuryFuturesOptionContainer.java deleted file mode 100644 index 2f174e6..0000000 --- a/org/drip/market/exchange/TreasuryFuturesOptionContainer.java +++ /dev/null @@ -1,140 +0,0 @@ - -package org.drip.market.exchange; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * TreasuryFuturesOptionContainer holds the Details of the Treasury Futures Options Contracts. - * - * @author Lakshmi Krishnamurthy - */ - -public class TreasuryFuturesOptionContainer { - private static final java.util.Map _mapFuturesOptions = new - java.util.TreeMap(); - - /** - * Initialize the Treasury Futures Options Convention Container with the Conventions - * - * @return TRUE - The Treasury Futures Options Convention Container successfully initialized - */ - - public static final boolean Init() - { - try { - org.drip.product.params.LastTradingDateSetting[] aLTDS = new - org.drip.product.params.LastTradingDateSetting[] {new - org.drip.product.params.LastTradingDateSetting - (org.drip.product.params.LastTradingDateSetting.MID_CURVE_OPTION, "2D", - java.lang.Integer.MIN_VALUE), new org.drip.product.params.LastTradingDateSetting - (org.drip.product.params.LastTradingDateSetting.MID_CURVE_OPTION_QUARTERLY, - "", java.lang.Integer.MIN_VALUE)}; - - _mapFuturesOptions.put ("USD-TREASURY-BOND-ULTRA", new - org.drip.market.exchange.TreasuryFuturesOptionConvention (new java.lang.String[] {"OUB", - "OUL"}, "USD-TREASURY-BOND-ULTRA", 100000., true, aLTDS)); - - _mapFuturesOptions.put ("USD-TREASURY-BOND-30Y", new - org.drip.market.exchange.TreasuryFuturesOptionConvention (new java.lang.String[] {"OZB", - "CG-PG"}, "USD-TREASURY-BOND-30Y", 100000., true, aLTDS)); - - _mapFuturesOptions.put ("USD-TREASURY-NOTE-10Y", new - org.drip.market.exchange.TreasuryFuturesOptionConvention (new java.lang.String[] {"OZN", - "TC-TP"}, "USD-TREASURY-NOTE-10Y", 100000., true, aLTDS)); - - _mapFuturesOptions.put ("USD-TREASURY-NOTE-5Y", new - org.drip.market.exchange.TreasuryFuturesOptionConvention (new java.lang.String[] {"OZF", - "FL-FP"}, "USD-TREASURY-NOTE-5Y", 100000., true, aLTDS)); - - _mapFuturesOptions.put ("USD-TREASURY-NOTE-2Y", new - org.drip.market.exchange.TreasuryFuturesOptionConvention (new java.lang.String[] {"OZT", - "TUC-TUP"}, "USD-TREASURY-NOTE-2Y", 200000., true, aLTDS)); - - _mapFuturesOptions.put ("EUR-EURO-BUXL-30Y", new - org.drip.market.exchange.TreasuryFuturesOptionConvention (new java.lang.String[] {"BUXL"}, - "EUR-EURO-BUXL-30Y", 100000., false, aLTDS)); - - _mapFuturesOptions.put ("EUR-EURO-BUND-10Y", new - org.drip.market.exchange.TreasuryFuturesOptionConvention (new java.lang.String[] {"BUND"}, - "EUR-EURO-BUND-10Y", 100000., false, aLTDS)); - - _mapFuturesOptions.put ("EUR-EURO-BOBL-5Y", new - org.drip.market.exchange.TreasuryFuturesOptionConvention (new java.lang.String[] {"BOBL"}, - "EUR-EURO-BOBL-10Y", 100000., false, aLTDS)); - - _mapFuturesOptions.put ("EUR-EURO-SCHATZ-2Y", new - org.drip.market.exchange.TreasuryFuturesOptionConvention (new java.lang.String[] {"SCHATZ"}, - "EUR-EURO-SCHATZ-10Y", 100000., false, aLTDS)); - - _mapFuturesOptions.put ("EUR-TREASURY-BONO-10Y", new - org.drip.market.exchange.TreasuryFuturesOptionConvention (new java.lang.String[] {"BONO"}, - "EUR-TREASURY-BONO-10Y", 100000., false, aLTDS)); - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - /** - * Retrieve the Treasury Futures Option Convention from the Contract Name - * - * @param strContractName The Options Contract Name - * - * @return The Treasury Futures Option Convention - */ - - public static final org.drip.market.exchange.TreasuryFuturesOptionConvention FromContract ( - final java.lang.String strContractName) - { - return null == strContractName || strContractName.isEmpty() || !_mapFuturesOptions.containsKey - (strContractName) ? null : _mapFuturesOptions.get (strContractName); - } -} diff --git a/org/drip/market/exchange/TreasuryFuturesOptionConvention.java b/org/drip/market/exchange/TreasuryFuturesOptionConvention.java deleted file mode 100644 index c021fbb..0000000 --- a/org/drip/market/exchange/TreasuryFuturesOptionConvention.java +++ /dev/null @@ -1,183 +0,0 @@ - -package org.drip.market.exchange; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * TreasuryFuturesOptionConvention contains the Details for the Exchange-Traded Options of the - * Exchange-Traded Treasury Futures Contracts. - * - * @author Lakshmi Krishnamurthy - */ - -public class TreasuryFuturesOptionConvention { - private boolean _bPremiumType = false; - private java.lang.String[] _astrCode = null; - private double _dblNotional = java.lang.Double.NaN; - private java.lang.String _strTreasuryFuturesIndex = ""; - private org.drip.product.params.LastTradingDateSetting[] _aLTDS = null; - - /** - * TreasuryFuturesOptionConvention Constructor - * - * @param astrCode Array of Option Codes - * @param strTreasuryFuturesIndex Underlying Futures Index - * @param dblNotional Exchange Notional - * @param bPremiumType TRUE - Premium Up-front Type; FALSE - Margin Type - * @param aLTDS Array of Last Trading Date Settings - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public TreasuryFuturesOptionConvention ( - final java.lang.String[] astrCode, - final java.lang.String strTreasuryFuturesIndex, - final double dblNotional, - final boolean bPremiumType, - final org.drip.product.params.LastTradingDateSetting[] aLTDS) - throws java.lang.Exception - { - if (null == (_astrCode = astrCode) || null == (_strTreasuryFuturesIndex = strTreasuryFuturesIndex) || - !org.drip.quant.common.NumberUtil.IsValid (_dblNotional = dblNotional) || null == (_aLTDS = - aLTDS)) - throw new java.lang.Exception ("TreasuryFuturesOptionConvention ctr: Invalid Inputs!"); - - _bPremiumType = bPremiumType; - int iNumLTDS = _aLTDS.length; - int iNumCode = _astrCode.length; - - if (0 == iNumLTDS || 0 == iNumCode) - throw new java.lang.Exception ("TreasuryFuturesOptionConvention ctr: Invalid Inputs!"); - - for (java.lang.String strCode : _astrCode) { - if (null == strCode || strCode.isEmpty()) - throw new java.lang.Exception ("TreasuryFuturesOptionConvention ctr: Invalid Inputs!"); - } - - for (org.drip.product.params.LastTradingDateSetting ltds : _aLTDS) { - if (null == ltds) - throw new java.lang.Exception ("TreasuryFuturesOptionConvention ctr: Invalid Inputs!"); - } - } - - /** - * Retrieve the Array of the Exchange Codes - * - * @return The Array of the Exchange Codes - */ - - public java.lang.String[] codes() - { - return _astrCode; - } - - /** - * Retrieve the Array of Last Trading Date Settings - * - * @return The Array of Last Trading Date Settings - */ - - public org.drip.product.params.LastTradingDateSetting[] ltds() - { - return _aLTDS; - } - - /** - * Retrieve the Treasury Futures Index - * - * @return The Treasury Futures Index - */ - - public java.lang.String FuturesIndex() - { - return _strTreasuryFuturesIndex; - } - - /** - * Retrieve the Option Exchange Notional - * - * @return The Option Exchange Notional - */ - - public double notional() - { - return _dblNotional; - } - - /** - * Retrieve the Trading Type PREMIUM/MARGIN - * - * @return TRUE - Trading Type is PREMIUM - */ - - public boolean premiumType() - { - return _bPremiumType; - } - - @Override public java.lang.String toString() - { - java.lang.String strDump = "TreasuryFuturesIndex: " + _strTreasuryFuturesIndex + " | Premium Type: " - + (_bPremiumType ? "PREMIUM" : "MARGIN "); - - for (int i = 0; i < _astrCode.length; ++i) { - if (0 == i) - strDump += " | CODES => {"; - else - strDump += ", "; - - strDump += _astrCode[i]; - - if (_astrCode.length - 1 == i) strDump += "}"; - } - - for (int i = 0; i < _aLTDS.length; ++i) - strDump += "\n\t" + _aLTDS[i]; - - return strDump; - } -} diff --git a/org/drip/market/exchange/TreasuryFuturesSettle.java b/org/drip/market/exchange/TreasuryFuturesSettle.java deleted file mode 100644 index 5d74ce3..0000000 --- a/org/drip/market/exchange/TreasuryFuturesSettle.java +++ /dev/null @@ -1,284 +0,0 @@ - -package org.drip.market.exchange; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * TreasuryFuturesSettle contains the Settlement Details for the Futures Basket of the Exchange-Traded - * Treasury Futures Contracts. - * - * @author Lakshmi Krishnamurthy - */ - -public class TreasuryFuturesSettle { - - /** - * Cash Settled Futures - */ - - public static final int SETTLE_TYPE_CASH = 1; - - /** - * Physically Settled Futures - */ - - public static final int SETTLE_TYPE_PHYSICAL_DELIVERY = 2; - - /** - * Settle Quote Type - AUD Bank Bill Type - Uses a Flat Reference Index - */ - - public static final int QUOTE_REFERENCE_INDEX_FLAT = 1; - - /** - * Settle Quote Type - Uses a Reference Index Based off of Conversion Factor - */ - - public static final int QUOTE_REFERENCE_INDEX_CONVERSION_FACTOR = 2; - - /** - * Settle Quote Type - Uses a Reference Index Based off of Conversion Factor Computed AUD Bond Futures - * Style - */ - - public static final int QUOTE_REFERENCE_INDEX_AUD_BOND_FUTURES_STYLE = 3; - - private int _iSettleType = -1; - private int _iSettleQuoteStyle = -1; - private int[] _aiDeliveryMonth = null; - private int _iExpiryLastTradingLag = -1; - private boolean _bWildCardOption = false; - private int _iExpiryFirstDeliveryLag = -1; - private int _iExpiryFinalDeliveryLag = -1; - private int _iExpiryDeliveryNoticeLag = -1; - private double _dblReferenceCouponCurrent = java.lang.Double.NaN; - private double _dblReferenceCouponOriginal = java.lang.Double.NaN; - - /** - * TreasuryFuturesSettle Constructor - * - * @param iExpiryFirstDeliveryLag Lag Between the Expiry and the First Delivery Dates - * @param iExpiryFinalDeliveryLag Lag Between the Expiry and the Final Delivery Dates - * @param iExpiryDeliveryNoticeLag Lag between the Expiry and the Delivery Notice - * @param iExpiryLastTradingLag Lag between the Expiry and the Last Trading Day - * @param iSettleType Settlement Type - * @param iSettleQuoteStyle Settlement Quote Style - * @param bWildCardOption TRUE - Turn ON the Wild Card Option - * @param dblReferenceCouponCurrent The Current Reference Coupon - * @param dblReferenceCouponOriginal The Original Reference Coupon - * @param aiDeliveryMonth Array of the Delivery Months - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public TreasuryFuturesSettle ( - final int iExpiryFirstDeliveryLag, - final int iExpiryFinalDeliveryLag, - final int iExpiryDeliveryNoticeLag, - final int iExpiryLastTradingLag, - final int iSettleType, - final int iSettleQuoteStyle, - final boolean bWildCardOption, - final double dblReferenceCouponCurrent, - final double dblReferenceCouponOriginal, - final int[] aiDeliveryMonth) - throws java.lang.Exception - { - if ((_iExpiryFinalDeliveryLag = iExpiryFinalDeliveryLag) < (_iExpiryFirstDeliveryLag = - iExpiryFirstDeliveryLag) || _iExpiryFirstDeliveryLag < 0) - throw new java.lang.Exception ("TreasuryFuturesSettle ctr: Invalid Inputs"); - - _iSettleType = iSettleType; - _aiDeliveryMonth = aiDeliveryMonth; - _bWildCardOption = bWildCardOption; - _iSettleQuoteStyle = iSettleQuoteStyle; - _iExpiryLastTradingLag = iExpiryLastTradingLag; - _iExpiryFirstDeliveryLag = iExpiryFirstDeliveryLag; - _iExpiryFinalDeliveryLag = iExpiryFinalDeliveryLag; - _iExpiryDeliveryNoticeLag = iExpiryDeliveryNoticeLag; - _dblReferenceCouponCurrent = dblReferenceCouponCurrent; - _dblReferenceCouponOriginal = dblReferenceCouponOriginal; - } - - /** - * Retrieve the Lag Between the Expiry and the First Delivery Dates - * - * @return The Lag Between the Expiry and the First Delivery Dates - */ - - public int expiryFirstDeliveryLag() - { - return _iExpiryFirstDeliveryLag; - } - - /** - * Retrieve the Lag Between the Expiry and the Final Delivery Dates - * - * @return The Lag Between the Expiry and the Final Delivery Dates - */ - - public int expiryFinalDeliveryLag() - { - return _iExpiryFinalDeliveryLag; - } - - /** - * Retrieve the Lag Between the Expiry and the Delivery Notice Dates - * - * @return The Lag Between the Expiry and the Delivery Notice Dates - */ - - public int expiryDeliveryNoticeLag() - { - return _iExpiryDeliveryNoticeLag; - } - - /** - * Retrieve the Lag Between the Expiry and the Last Trading Dates - * - * @return The Lag Between the Expiry and the Last Trading Dates - */ - - public int expiryLastTradingLag() - { - return _iExpiryLastTradingLag; - } - - /** - * Retrieve the Settle Type - * - * @return The Settle Type - */ - - public int settleType() - { - return _iSettleType; - } - - /** - * Retrieve the Settle Quote Style - * - * @return The Settle Quote Style - */ - - public int settleQuoteStyle() - { - return _iSettleQuoteStyle; - } - - /** - * Retrieve the Bond Futures Wild Card Option Setting - * - * @return Bond Futures Wild Card Option Setting - */ - - public boolean wildCardOption() - { - return _bWildCardOption; - } - - /** - * Retrieve the Current Reference Coupon - * - * @return The Current Reference Coupon - */ - - public double currentReferenceYield() - { - return _dblReferenceCouponCurrent; - } - - /** - * Retrieve the Original Reference Coupon - * - * @return The Original Reference Coupon - */ - - public double originalReferenceCoupon() - { - return _dblReferenceCouponOriginal; - } - - /** - * Retrieve the Delivery Months - * - * @return The Array of Delivery Months - */ - - public int[] deliveryMonths() - { - return _aiDeliveryMonth; - } - - @Override public java.lang.String toString() - { - java.lang.String strDeliveryMonths = ""; - int iNumDeliveryMonth = null == _aiDeliveryMonth ? 0 : _aiDeliveryMonth.length; - - if (0 != iNumDeliveryMonth) { - for (int i = 0; i < iNumDeliveryMonth; ++i) { - if (0 == i) - strDeliveryMonths += " | Delivery Months: {"; - else - strDeliveryMonths += ","; - - strDeliveryMonths += org.drip.analytics.date.DateUtil.MonthChar (_aiDeliveryMonth[i]); - } - - strDeliveryMonths += "}"; - } - - return "[Futures Settle => Expiry To First Delivery Lag: " + _iExpiryFirstDeliveryLag + - " | Expiry To Final Delivery Lag: " + _iExpiryFinalDeliveryLag + - " | Expiry To Delivery Notice Lag: " + _iExpiryDeliveryNoticeLag + - " | Expiry To Last Trading Lag: " + _iExpiryLastTradingLag + " | Settlement Type: " + - _iSettleType + " | Settlement Quote Style: " + _iSettleQuoteStyle + " | Wild Card: " - + _bWildCardOption + " | Current Reference Coupon: " + _dblReferenceCouponCurrent - + " | Original Reference Coupon: " + _dblReferenceCouponOriginal + - strDeliveryMonths + "]"; - } -} diff --git a/org/drip/market/issue/TreasurySetting.java b/org/drip/market/issue/TreasurySetting.java deleted file mode 100644 index edb3f61..0000000 --- a/org/drip/market/issue/TreasurySetting.java +++ /dev/null @@ -1,145 +0,0 @@ - -package org.drip.market.issue; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * TreasurySetting contains the Definitions of the Settings of different Jurisdiction Treasuries. - * - * @author Lakshmi Krishnamurthy - */ - -public class TreasurySetting { - private int _iFrequency = -1; - private java.lang.String _strCode = ""; - private java.lang.String _strCalendar = ""; - private java.lang.String _strCurrency = ""; - private java.lang.String _strDayCount = ""; - - /** - * TreasurySetting Constructor - * - * @param strCode Treasury Code - * @param strCurrency Currency - * @param iFrequency Frequency - * @param strDayCount Day Count - * @param strCalendar Calendar - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public TreasurySetting ( - final java.lang.String strCode, - final java.lang.String strCurrency, - final int iFrequency, - final java.lang.String strDayCount, - final java.lang.String strCalendar) - throws java.lang.Exception - { - if (null == (_strCode = strCode) || _strCode.isEmpty() || null == (_strCurrency = strCurrency) || - _strCurrency.isEmpty() || 0 >= (_iFrequency = iFrequency) || null == (_strDayCount = - strDayCount) || _strDayCount.isEmpty() || null == (_strCalendar = strCalendar) || - _strCalendar.isEmpty()) - throw new java.lang.Exception ("TreasurySetting ctr => Invalid Inputs"); - } - - /** - * Retrieve the Treasury Code - * - * @return The Treasury Code - */ - - public java.lang.String code() - { - return _strCode; - } - - /** - * Retrieve the Currency - * - * @return The Currency - */ - - public java.lang.String currency() - { - return _strCurrency; - } - - /** - * Retrieve the Frequency - * - * @return The Frequency - */ - - public int frequency() - { - return _iFrequency; - } - - /** - * Retrieve the Day Count - * - * @return The Day Count - */ - - public java.lang.String dayCount() - { - return _strDayCount; - } - - /** - * Retrieve the Calendar - * - * @return The Calendar - */ - - public java.lang.String calendar() - { - return _strCalendar; - } -} diff --git a/org/drip/market/issue/TreasurySettingContainer.java b/org/drip/market/issue/TreasurySettingContainer.java deleted file mode 100644 index e8e30e5..0000000 --- a/org/drip/market/issue/TreasurySettingContainer.java +++ /dev/null @@ -1,178 +0,0 @@ - -package org.drip.market.issue; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 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. - */ - -/** - * TreasurySettingContainer contains the Parameters related to the Jurisdiction-specific Treasuries. - * - * @author Lakshmi Krishnamurthy - */ - -public class TreasurySettingContainer { - private static final java.util.Map - _mapTreasurySetting = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - private static final java.util.Map _mapCurrencyTreasuryCode = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - private static final boolean AddSetting ( - final java.lang.String strCode, - final java.lang.String strCurrency, - final int iFrequency, - final java.lang.String strDayCount, - final java.lang.String strCalendar) - { - try { - _mapTreasurySetting.put (strCode, new org.drip.market.issue.TreasurySetting (strCode, - strCurrency, iFrequency, strDayCount, strCalendar)); - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - /** - * Initialize the Treasury Settings Container - * - * @return TRUE - Initialization Successful - */ - - public static final boolean Init() - { - if (!AddSetting ("AGB", "AUD", 2, "DCAct_Act_UST", "AUD")) return false; - - if (!AddSetting ("BTPS", "EUR", 2, "DCAct_Act_UST", "EUR")) return false; - - if (!AddSetting ("CAN", "CAD", 2, "DCAct_Act_UST", "CAD")) return false; - - if (!AddSetting ("DBR", "EUR", 2, "DCAct_Act_UST", "EUR")) return false; - - if (!AddSetting ("DGB", "DKK", 2, "DCAct_Act_UST", "DKK")) return false; - - if (!AddSetting ("FRTR", "EUR", 2, "DCAct_Act_UST", "EUR")) return false; - - if (!AddSetting ("GGB", "EUR", 2, "DCAct_Act_UST", "EUR")) return false; - - if (!AddSetting ("GILT", "GBP", 2, "DCAct_Act_UST", "GBP")) return false; - - if (!AddSetting ("GSWISS", "CHF", 2, "DCAct_Act_UST", "CHF")) return false; - - if (!AddSetting ("JGB", "JPY", 2, "DCAct_Act_UST", "JPY")) return false; - - if (!AddSetting ("MBONO", "MXN", 2, "DCAct_364", "MXN")) return false; - - if (!AddSetting ("NGB", "NOK", 2, "DCAct_Act_UST", "NOK")) return false; - - if (!AddSetting ("NZGB", "NZD", 2, "DCAct_Act_UST", "NZD")) return false; - - if (!AddSetting ("SGB", "SEK", 2, "DCAct_Act_UST", "SEK")) return false; - - if (!AddSetting ("SPGB", "EUR", 2, "DCAct_Act_UST", "EUR")) return false; - - if (!AddSetting ("UST", "USD", 2, "DCAct_Act_UST", "USD")) return false; - - _mapCurrencyTreasuryCode.put ("AUD", "AGB"); - - _mapCurrencyTreasuryCode.put ("CAD", "CAN"); - - _mapCurrencyTreasuryCode.put ("CHF", "GSWISS"); - - _mapCurrencyTreasuryCode.put ("DKK", "DGB"); - - _mapCurrencyTreasuryCode.put ("EUR", "DBR"); - - _mapCurrencyTreasuryCode.put ("GBP", "GILT"); - - _mapCurrencyTreasuryCode.put ("JPY", "JGB"); - - _mapCurrencyTreasuryCode.put ("MXN", "MBONO"); - - _mapCurrencyTreasuryCode.put ("NOK", "NGB"); - - _mapCurrencyTreasuryCode.put ("NZD", "NZGB"); - - _mapCurrencyTreasuryCode.put ("SEK", "SGB"); - - _mapCurrencyTreasuryCode.put ("USD", "UST"); - - return true; - } - - /** - * Retrieve the Treasury Settings corresponding to the Code - * - * @param strTreasuryCode The Treasury Code - * - * @return The Settings that correspond to the Code - */ - - public static final org.drip.market.issue.TreasurySetting TreasurySetting ( - final java.lang.String strTreasuryCode) - { - return !_mapTreasurySetting.containsKey (strTreasuryCode) ? null : _mapTreasurySetting.get - (strTreasuryCode); - } - - /** - * Retrieve the Benchmark Treasury Code for the specified Currency - * - * @param strCurrency The Currency - * - * @return The Benchmark Treasury Code - */ - - public static final java.lang.String CurrencyBenchmarkCode ( - final java.lang.String strCurrency) - { - return !_mapCurrencyTreasuryCode.containsKey (strCurrency) ? null : _mapCurrencyTreasuryCode.get - (strCurrency); - } -} diff --git a/org/drip/market/otc/CreditIndexConvention.java b/org/drip/market/otc/CreditIndexConvention.java deleted file mode 100644 index 28d5051..0000000 --- a/org/drip/market/otc/CreditIndexConvention.java +++ /dev/null @@ -1,272 +0,0 @@ - -package org.drip.market.otc; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 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. - */ - -/** - * CreditIndexConvention contains the details of the Credit Index of an OTC Index CDS Contract. - * - * @author Lakshmi Krishnamurthy - */ - -public class CreditIndexConvention { - private int _iFreq = -1; - private int _iNumConstituent = -1; - private java.lang.String _strTenor = ""; - private java.lang.String _strCurrency = ""; - private java.lang.String _strDayCount = ""; - private java.lang.String _strIndexType = ""; - private java.lang.String _strSeriesName = ""; - private java.lang.String _strIndexSubType = ""; - private double _dblFixedCoupon = java.lang.Double.NaN; - private double _dblRecoveryRate = java.lang.Double.NaN; - private org.drip.analytics.date.JulianDate _dtMaturity = null; - private org.drip.analytics.date.JulianDate _dtEffective = null; - - /** - * CreditIndexConvention Constructor - * - * @param strIndexType Index Type - * @param strIndexSubType Index Sub-Type - * @param strSeriesName Series Name - * @param strTenor Index Tenor - * @param strCurrency Index Currency - * @param dtEffective Effective Date - * @param dtMaturity Maturity Date - * @param iFreq Coupon/Pay Frequency - * @param strDayCount Index Day Count - * @param dblFixedCoupon Index Fixed Coupon - * @param dblRecoveryRate Fixed Recovery Rate - * @param iNumConstituent Number of Constituents - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public CreditIndexConvention ( - final java.lang.String strIndexType, - final java.lang.String strIndexSubType, - final java.lang.String strSeriesName, - final java.lang.String strTenor, - final java.lang.String strCurrency, - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity, - final int iFreq, - final java.lang.String strDayCount, - final double dblFixedCoupon, - final double dblRecoveryRate, - final int iNumConstituent) - throws java.lang.Exception - { - if (null == (_strIndexType = strIndexType) || _strIndexType.isEmpty() || null == (_strIndexSubType = - strIndexSubType) || _strIndexType.isEmpty() || null == (_strSeriesName = strSeriesName) || - _strSeriesName.isEmpty() || null == (_strTenor = strTenor) || _strTenor.isEmpty() || null == - (_strCurrency = strCurrency) || _strCurrency.isEmpty() || null == (_dtEffective = - dtEffective) || null == (_dtMaturity = dtMaturity) || 0 >= (_iFreq = iFreq) || null - == (_strDayCount = strDayCount) || _strDayCount.isEmpty() || - !org.drip.quant.common.NumberUtil.IsValid (_dblFixedCoupon = dblFixedCoupon) - || !org.drip.quant.common.NumberUtil.IsValid (_dblRecoveryRate = - dblRecoveryRate) || 0 >= (_iNumConstituent = iNumConstituent)) - throw new java.lang.Exception ("CreditIndexConvention Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Index Type - * - * @return The Index Type - */ - - public java.lang.String indexType() - { - return _strIndexType; - } - - /** - * Retrieve the Index Sub-Type - * - * @return The Index Sub-Type - */ - - public java.lang.String indexSubType() - { - return _strIndexSubType; - } - - /** - * Retrieve the Series Name - * - * @return The Series Name - */ - - public java.lang.String seriesName() - { - return _strSeriesName; - } - - /** - * Retrieve the Tenor - * - * @return The Tenor - */ - - public java.lang.String tenor() - { - return _strTenor; - } - - /** - * Retrieve the Currency - * - * @return The Currency - */ - - public java.lang.String currency() - { - return _strCurrency; - } - - /** - * Retrieve the Effective Date - * - * @return The Effective Date - */ - - public org.drip.analytics.date.JulianDate effectiveDate() - { - return _dtEffective; - } - - /** - * Retrieve the Maturity Date - * - * @return The Maturity Date - */ - - public org.drip.analytics.date.JulianDate maturityDate() - { - return _dtMaturity; - } - - /** - * Retrieve the Coupon Frequency - * - * @return The Coupon Frequency - */ - - public int frequency() - { - return _iFreq; - } - - /** - * Retrieve the Day Count - * - * @return The Day Count - */ - - public java.lang.String dayCount() - { - return _strDayCount; - } - - /** - * Retrieve the Fixed Coupon - * - * @return The Fixed Coupon - */ - - public double fixedCoupon() - { - return _dblFixedCoupon; - } - - /** - * Retrieve the Recovery Rate - * - * @return The Recovery Rate - */ - - public double recoveryRate() - { - return _dblRecoveryRate; - } - - /** - * Retrieve the Number of Constituents - * - * @return The Number of Constituents - */ - - public int numberOfConstituents() - { - return _iNumConstituent; - } - - /** - * Retrieve the Full Name of the Credit Index - * - * @return The Full Name of the Credit Index - */ - - public java.lang.String fullName() - { - return _strIndexType + "." + _strIndexSubType + "." + _strSeriesName + "." + _strTenor; - } - - /** - * Create an Instance of the Specified Index CDS Product - * - * @return Instance of the Specified Index CDS Product - */ - - public org.drip.product.definition.CreditDefaultSwap indexCDS() - { - org.drip.product.params.CreditSetting cs = new org.drip.product.params.CreditSetting (30, - _dblRecoveryRate, false, _strIndexType + "." + _strIndexSubType + "." + _strSeriesName, true); - - return cs.validate() ? org.drip.product.creator.CDSBuilder.CreateCDS (_dtEffective, _dtMaturity, - _dblFixedCoupon, _strCurrency, cs, _strCurrency, true) : null; - } -} diff --git a/org/drip/market/otc/CreditIndexConventionContainer.java b/org/drip/market/otc/CreditIndexConventionContainer.java deleted file mode 100644 index f5f1d73..0000000 --- a/org/drip/market/otc/CreditIndexConventionContainer.java +++ /dev/null @@ -1,183 +0,0 @@ - -package org.drip.market.otc; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 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. - */ - -/** - * CreditIndexConventionContainer contains the Conventions of the Credit Index of an OTC Index CDS Contract. - * - * @author Lakshmi Krishnamurthy - */ - -public class CreditIndexConventionContainer { - private static final java.util.Map - _mapIndexConvention = new java.util.TreeMap(); - - private static final boolean AddIndexConvention ( - final java.lang.String strIndexType, - final java.lang.String strIndexSubType, - final java.lang.String strSeriesName, - final java.lang.String strTenor, - final java.lang.String strCurrency, - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity, - final int iFreq, - final java.lang.String strDayCount, - final double dblFixedCoupon, - final double dblRecoveryRate, - final int iNumConstituent) - { - try { - org.drip.market.otc.CreditIndexConvention cic = new org.drip.market.otc.CreditIndexConvention - (strIndexType, strIndexSubType, strSeriesName, strTenor, strCurrency, dtEffective, - dtMaturity, iFreq, strDayCount, dblFixedCoupon, dblRecoveryRate, iNumConstituent); - - _mapIndexConvention.put (cic.fullName(), cic); - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - private static final boolean AddCDXNAIG5YSeries ( - final java.lang.String strSeriesName, - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity) - { - return AddIndexConvention ("CDX.NA", "IG", strSeriesName, "5Y", "USD", dtEffective, dtMaturity, 4, - "Act/360", 0.01, 0.4, 125); - } - - /** - * Initialize the Credit Index Conventions Container with the pre-set CDX Contract Settings - * - * @return TRUE - The Credit Index Conventions Container successfully initialized - */ - - public static final boolean Init() - { - if (!AddCDXNAIG5YSeries ("S15", org.drip.analytics.date.DateUtil.CreateFromYMD (2010, - org.drip.analytics.date.DateUtil.SEPTEMBER, 20), org.drip.analytics.date.DateUtil.CreateFromYMD - (2015, org.drip.analytics.date.DateUtil.DECEMBER, 20))) - return false; - - if (!AddCDXNAIG5YSeries ("S16", org.drip.analytics.date.DateUtil.CreateFromYMD (2011, - org.drip.analytics.date.DateUtil.MARCH, 21), org.drip.analytics.date.DateUtil.CreateFromYMD - (2016, org.drip.analytics.date.DateUtil.JUNE, 20))) - return false; - - if (!AddCDXNAIG5YSeries ("S17", org.drip.analytics.date.DateUtil.CreateFromYMD (2011, - org.drip.analytics.date.DateUtil.SEPTEMBER, 20), org.drip.analytics.date.DateUtil.CreateFromYMD - (2016, org.drip.analytics.date.DateUtil.DECEMBER, 20))) - return false; - - if (!AddCDXNAIG5YSeries ("S18", org.drip.analytics.date.DateUtil.CreateFromYMD (2012, - org.drip.analytics.date.DateUtil.MARCH, 20), org.drip.analytics.date.DateUtil.CreateFromYMD - (2017, org.drip.analytics.date.DateUtil.JUNE, 20))) - return false; - - if (!AddCDXNAIG5YSeries ("S19", org.drip.analytics.date.DateUtil.CreateFromYMD (2012, - org.drip.analytics.date.DateUtil.SEPTEMBER, 20), org.drip.analytics.date.DateUtil.CreateFromYMD - (2017, org.drip.analytics.date.DateUtil.DECEMBER, 20))) - return false; - - if (!AddCDXNAIG5YSeries ("S20", org.drip.analytics.date.DateUtil.CreateFromYMD (2013, - org.drip.analytics.date.DateUtil.MARCH, 20), org.drip.analytics.date.DateUtil.CreateFromYMD - (2018, org.drip.analytics.date.DateUtil.JUNE, 20))) - return false; - - if (!AddCDXNAIG5YSeries ("S21", org.drip.analytics.date.DateUtil.CreateFromYMD (2013, - org.drip.analytics.date.DateUtil.SEPTEMBER, 20), org.drip.analytics.date.DateUtil.CreateFromYMD - (2018, org.drip.analytics.date.DateUtil.DECEMBER, 20))) - return false; - - if (!AddCDXNAIG5YSeries ("S22", org.drip.analytics.date.DateUtil.CreateFromYMD (2014, - org.drip.analytics.date.DateUtil.MARCH, 20), org.drip.analytics.date.DateUtil.CreateFromYMD - (2019, org.drip.analytics.date.DateUtil.JUNE, 20))) - return false; - - if (!AddCDXNAIG5YSeries ("S23", org.drip.analytics.date.DateUtil.CreateFromYMD (2014, - org.drip.analytics.date.DateUtil.SEPTEMBER, 22), org.drip.analytics.date.DateUtil.CreateFromYMD - (2019, org.drip.analytics.date.DateUtil.DECEMBER, 20))) - return false; - - if (!AddCDXNAIG5YSeries ("S24", org.drip.analytics.date.DateUtil.CreateFromYMD (2015, - org.drip.analytics.date.DateUtil.MARCH, 20), org.drip.analytics.date.DateUtil.CreateFromYMD - (2020, org.drip.analytics.date.DateUtil.JUNE, 20))) - return false; - - if (!AddCDXNAIG5YSeries ("S25", org.drip.analytics.date.DateUtil.CreateFromYMD (2015, - org.drip.analytics.date.DateUtil.SEPTEMBER, 21), org.drip.analytics.date.DateUtil.CreateFromYMD - (2020, org.drip.analytics.date.DateUtil.DECEMBER, 20))) - return false; - - if (!AddCDXNAIG5YSeries ("S26", org.drip.analytics.date.DateUtil.CreateFromYMD (2016, - org.drip.analytics.date.DateUtil.MARCH, 21), org.drip.analytics.date.DateUtil.CreateFromYMD - (2021, org.drip.analytics.date.DateUtil.JUNE, 20))) - return false; - - return true; - } - - /** - * Retrieve the OTC Credit Index Convention Instance from the Full Index Name - * - * @param strCreditIndexFullName The Credit index Full Name - * - * @return The OTC Credit Index Convention Instance - */ - - public static final org.drip.market.otc.CreditIndexConvention ConventionFromFullName ( - final java.lang.String strCreditIndexFullName) - { - return null == strCreditIndexFullName || !_mapIndexConvention.containsKey (strCreditIndexFullName) ? - null : _mapIndexConvention.get (strCreditIndexFullName); - } -} diff --git a/org/drip/market/otc/CrossFloatConventionContainer.java b/org/drip/market/otc/CrossFloatConventionContainer.java deleted file mode 100644 index b97949f..0000000 --- a/org/drip/market/otc/CrossFloatConventionContainer.java +++ /dev/null @@ -1,199 +0,0 @@ - -package org.drip.market.otc; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CrossFloatConventionContainer contains the Conventions of Standard OTC Cross-Currency Float-Float Swaps. - * - * @author Lakshmi Krishnamurthy - */ - -public class CrossFloatConventionContainer { - private static final java.util.Map - _mapConvention = new java.util.TreeMap(); - - private static final boolean AddCrossCurrencyConvention ( - final org.drip.market.otc.CrossFloatStreamConvention referenceConvention, - final org.drip.market.otc.CrossFloatStreamConvention derivedConvention) - { - org.drip.market.otc.CrossFloatSwapConvention xccyConvention = null; - - try { - xccyConvention = new org.drip.market.otc.CrossFloatSwapConvention (referenceConvention, - derivedConvention, org.drip.param.period.FixingSetting.FIXING_PRESET_STATIC, false, 2); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - java.lang.String strDerivedCurrency = derivedConvention.currency(); - - java.lang.String strReferenceCurrency = referenceConvention.currency(); - - _mapConvention.put (strReferenceCurrency + "_" + strDerivedCurrency, xccyConvention); - - _mapConvention.put (strDerivedCurrency + "_" + strReferenceCurrency, xccyConvention); - - return true; - } - - /** - * Initialize the Cross-Currency Float-Float Conventions Container with the pre-set Floating Stream - * Contracts - * - * @return TRUE - The Cross-Currency Float-Float Conventions Container successfully initialized - */ - - public static final boolean Init() - { - try { - org.drip.market.otc.CrossFloatStreamConvention referenceConventionDerivedQuote = new - org.drip.market.otc.CrossFloatStreamConvention ("USD", "3M", false); - - if (!AddCrossCurrencyConvention (referenceConventionDerivedQuote, new - org.drip.market.otc.CrossFloatStreamConvention ("AUD", "3M", true))) - return false; - - if (!AddCrossCurrencyConvention (referenceConventionDerivedQuote, new - org.drip.market.otc.CrossFloatStreamConvention ("CAD", "3M", true))) - return false; - - if (!AddCrossCurrencyConvention (referenceConventionDerivedQuote, new - org.drip.market.otc.CrossFloatStreamConvention ("CHF", "3M", true))) - return false; - - if (!AddCrossCurrencyConvention (referenceConventionDerivedQuote, new - org.drip.market.otc.CrossFloatStreamConvention ("DKK", "3M", true))) - return false; - - if (!AddCrossCurrencyConvention (referenceConventionDerivedQuote, new - org.drip.market.otc.CrossFloatStreamConvention ("EUR", "3M", true))) - return false; - - if (!AddCrossCurrencyConvention (referenceConventionDerivedQuote, new - org.drip.market.otc.CrossFloatStreamConvention ("GBP", "3M", true))) - return false; - - if (!AddCrossCurrencyConvention (referenceConventionDerivedQuote, new - org.drip.market.otc.CrossFloatStreamConvention ("JPY", "3M", true))) - return false; - - if (!AddCrossCurrencyConvention (referenceConventionDerivedQuote, new - org.drip.market.otc.CrossFloatStreamConvention ("NOK", "3M", true))) - return false; - - if (!AddCrossCurrencyConvention (referenceConventionDerivedQuote, new - org.drip.market.otc.CrossFloatStreamConvention ("PLN", "3M", true))) - return false; - - if (!AddCrossCurrencyConvention (referenceConventionDerivedQuote, new - org.drip.market.otc.CrossFloatStreamConvention ("SEK", "3M", true))) - return false; - - org.drip.market.otc.CrossFloatStreamConvention referenceConventionReferenceQuote = new - org.drip.market.otc.CrossFloatStreamConvention ("USD", "3M", true); - - if (!AddCrossCurrencyConvention (referenceConventionReferenceQuote, new - org.drip.market.otc.CrossFloatStreamConvention ("CLP", "3M", false))) - return false; - - if (!AddCrossCurrencyConvention (referenceConventionReferenceQuote, new - org.drip.market.otc.CrossFloatStreamConvention ("MXN", "3M", false))) - return false; - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - /** - * Retrieve the Cross-Currency Float-Float Convention Instance from the Jurisdiction Name - * - * @param strCurrency The Jurisdiction Name - * - * @return The Float-Float Convention Instance - */ - - public static final org.drip.market.otc.CrossFloatSwapConvention ConventionFromJurisdiction ( - final java.lang.String strCurrency) - { - if (null == strCurrency || strCurrency.isEmpty()) return null; - - java.lang.String strKey = "USD_" + strCurrency; - - return !_mapConvention.containsKey (strKey) ? null : _mapConvention.get (strKey); - } - - /** - * Retrieve the Cross-Currency Float-Float Convention Instance from the Reference/Derived Jurisdiction - * Names - * - * @param strReferenceCurrency The Reference Jurisdiction Name - * @param strDerivedCurrency The Derived Jurisdiction Name - * - * @return The Float-Float Convention Instance - */ - - public static final org.drip.market.otc.CrossFloatSwapConvention ConventionFromJurisdiction ( - final java.lang.String strReferenceCurrency, - final java.lang.String strDerivedCurrency) - { - if (null == strReferenceCurrency || strReferenceCurrency.isEmpty() || null == strDerivedCurrency || - strDerivedCurrency.isEmpty()) - return null; - - java.lang.String strKey = strReferenceCurrency + "_" + strDerivedCurrency; - - return !_mapConvention.containsKey (strKey) ? null : _mapConvention.get (strKey); - } -} diff --git a/org/drip/market/otc/CrossFloatStreamConvention.java b/org/drip/market/otc/CrossFloatStreamConvention.java deleted file mode 100644 index 7a42b40..0000000 --- a/org/drip/market/otc/CrossFloatStreamConvention.java +++ /dev/null @@ -1,121 +0,0 @@ - -package org.drip.market.otc; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CrossFloatStreamConvention contains the Details of the Single Currency Floating Stream of an OTC Contact. - * - * @author Lakshmi Krishnamurthy - */ - -public class CrossFloatStreamConvention { - private boolean _bApplySpread = false; - private java.lang.String _strTenor = ""; - private java.lang.String _strCurrency = ""; - - /** - * CrossFloatStreamConvention Constructor - * - * @param strCurrency Floating Stream Currency - * @param strTenor Floating Stream Tenor - * @param bApplySpread TRUE - Apply Spread to this Stream - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public CrossFloatStreamConvention ( - final java.lang.String strCurrency, - final java.lang.String strTenor, - final boolean bApplySpread) - throws java.lang.Exception - { - if (null == (_strCurrency = strCurrency) || _strCurrency.isEmpty() || null == (_strTenor = strTenor) - || _strTenor.isEmpty()) - throw new java.lang.Exception ("CrossFloatStreamConvention ctr: Invalid Inputs"); - - _bApplySpread = bApplySpread; - } - - /** - * Retrieve the Currency - * - * @return The Currency - */ - - public java.lang.String currency() - { - return _strCurrency; - } - - /** - * Retrieve the Tenor - * - * @return The Tenor - */ - - public java.lang.String tenor() - { - return _strTenor; - } - - /** - * Retrieve the "Apply Spread" Flag - * - * @return The "Apply Spread" Flag - */ - - public boolean applySpread() - { - return _bApplySpread; - } - - @Override public java.lang.String toString() - { - return "[" + _strCurrency + " | " + _strTenor + " | " + _bApplySpread + "]"; - } -} diff --git a/org/drip/market/otc/CrossFloatSwapConvention.java b/org/drip/market/otc/CrossFloatSwapConvention.java deleted file mode 100644 index caeace1..0000000 --- a/org/drip/market/otc/CrossFloatSwapConvention.java +++ /dev/null @@ -1,237 +0,0 @@ - -package org.drip.market.otc; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CrossFloatSwapConvention contains the Details of the Cross-Currency Floating Swap of an OTC contact. - * - * @author Lakshmi Krishnamurthy - */ - -public class CrossFloatSwapConvention { - private int _iSpotLag = -1; - private int _iFixingType = -1; - private boolean _bFXMTM = false; - private org.drip.market.otc.CrossFloatStreamConvention _crossStreamDerived = null; - private org.drip.market.otc.CrossFloatStreamConvention _crossStreamReference = null; - - private org.drip.product.rates.Stream floatingStream ( - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.market.otc.CrossFloatStreamConvention cfsc, - final org.drip.param.period.FixingSetting fxFixingSetting, - final java.lang.String strMaturityTenor, - final double dblBasis, - final double dblNotional) - { - java.lang.String strFloaterTenor = cfsc.tenor(); - - org.drip.state.identifier.ForwardLabel forwardLabel = org.drip.state.identifier.ForwardLabel.Create - (org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction (cfsc.currency()), - strFloaterTenor); - - if (null == forwardLabel) return null; - - try { - org.drip.param.period.ComposableFloatingUnitSetting cfusReference = new - org.drip.param.period.ComposableFloatingUnitSetting (strFloaterTenor, - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, null, - forwardLabel, - org.drip.analytics.support.CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - cfsc.applySpread() ? dblBasis : 0.); - - org.drip.param.period.CompositePeriodSetting cpsReference = new - org.drip.param.period.CompositePeriodSetting - (org.drip.analytics.support.Helper.TenorToFreq (strFloaterTenor), - strFloaterTenor, _crossStreamReference.currency(), null, dblNotional, null, null, - fxFixingSetting, null); - - java.util.List lsReferenceEdgeDate = - org.drip.analytics.support.CompositePeriodBuilder.RegularEdgeDates (dtEffective, - strFloaterTenor, strMaturityTenor, null); - - return new org.drip.product.rates.Stream - (org.drip.analytics.support.CompositePeriodBuilder.FloatingCompositeUnit - (lsReferenceEdgeDate, cpsReference, cfusReference)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * CrossFloatSwapConvention Constructor - * - * @param crossStreamReference Reference Cross Float Stream - * @param crossStreamDerived Derived Cross Float Stream - * @param iFixingType Fixing Type - * @param bFXMTM TRUE - The Cross Currency Swap is of the FX MTM type - * @param iSpotLag Spot Lag - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public CrossFloatSwapConvention ( - final org.drip.market.otc.CrossFloatStreamConvention crossStreamReference, - final org.drip.market.otc.CrossFloatStreamConvention crossStreamDerived, - final int iFixingType, - final boolean bFXMTM, - final int iSpotLag) - throws java.lang.Exception - { - if (null == (_crossStreamReference = crossStreamReference) || null == (_crossStreamDerived = - crossStreamDerived) || !org.drip.param.period.FixingSetting.ValidateType (_iFixingType = - iFixingType) || 0 > (_iSpotLag = iSpotLag)) - throw new java.lang.Exception ("CrossFloatSwapConvention ctr: Invalid Inputs"); - - _bFXMTM = bFXMTM; - } - - /** - * Retrieve the Reference Convention - * - * @return The Reference Convention - */ - - public org.drip.market.otc.CrossFloatStreamConvention referenceConvention() - { - return _crossStreamReference; - } - - /** - * Retrieve the Derived Convention - * - * @return The Derived Convention - */ - - public org.drip.market.otc.CrossFloatStreamConvention derivedConvention() - { - return _crossStreamDerived; - } - - /** - * Retrieve the Fixing Setting Type - * - * @return The Fixing Setting Type - */ - - public int fixingType() - { - return _iFixingType; - } - - /** - * Retrieve the Spot Lag - * - * @return The Spot Lag - */ - - public int spotLag() - { - return _iSpotLag; - } - - /** - * Retrieve the FX MTM Flag - * - * @return The FX MTM Flag - */ - - public boolean isFXMTM() - { - return _bFXMTM; - } - - /** - * Create an Instance of the Float-Float Component - * - * @param dtSpot Spot Date - * @param strMaturityTenor The Maturity Tenor - * @param dblBasis Basis - * @param dblReferenceNotional Notional of the Reference Stream - * @param dblDerivedNotional Notional of the Derived Stream - * - * @return Instance of the Float-Float Component - */ - - public org.drip.product.rates.FloatFloatComponent createFloatFloatComponent ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strMaturityTenor, - final double dblBasis, - final double dblReferenceNotional, - final double dblDerivedNotional) - { - if (null == dtSpot) return null; - - org.drip.analytics.date.JulianDate dtEffective = dtSpot.addBusDays (_iSpotLag, - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction - (_crossStreamReference.currency()).calendar() + "," + - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction - (_crossStreamDerived.currency()).calendar()); - - try { - org.drip.param.period.FixingSetting fxFixingSetting = _bFXMTM ? null : new - org.drip.param.period.FixingSetting (_iFixingType, null, dtEffective.julian()); - - return new org.drip.product.rates.FloatFloatComponent (floatingStream (dtEffective, - _crossStreamReference, fxFixingSetting, strMaturityTenor, dblBasis, dblReferenceNotional), - floatingStream (dtEffective, _crossStreamDerived, fxFixingSetting, strMaturityTenor, - dblBasis, dblDerivedNotional), null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public java.lang.String toString() - { - return _crossStreamReference + " " + _crossStreamDerived + " " + _iFixingType + " " + _iSpotLag + " " - + _bFXMTM; - } -} diff --git a/org/drip/market/otc/FixedFloatSwapConvention.java b/org/drip/market/otc/FixedFloatSwapConvention.java deleted file mode 100644 index f9a15dc..0000000 --- a/org/drip/market/otc/FixedFloatSwapConvention.java +++ /dev/null @@ -1,160 +0,0 @@ - -package org.drip.market.otc; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FixedFloatSwapConvention contains the Details of the Fixed-Float Swap Component of an OTC contact. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixedFloatSwapConvention { - private int _iSpotLag = -1; - private org.drip.market.otc.FixedStreamConvention _fixedConv = null; - private org.drip.market.otc.FloatStreamConvention _floatConv = null; - - /** - * FixedFloatSwapConvention Constructor - * - * @param fixedConv Fixed Stream Convention - * @param floatConv Float Stream Convention - * @param iSpotLag Spot Lag - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public FixedFloatSwapConvention ( - final org.drip.market.otc.FixedStreamConvention fixedConv, - final org.drip.market.otc.FloatStreamConvention floatConv, - final int iSpotLag) - throws java.lang.Exception - { - if (null == (_fixedConv = fixedConv) || null == (_floatConv = floatConv) || 0 > (_iSpotLag = - iSpotLag)) - throw new java.lang.Exception ("FixedFloatSwapConvention ctr: Invalid Inputs"); - } - - /** - * Retrieve the Fixed Stream Convention - * - * @return The Fixed Stream Convention - */ - - public org.drip.market.otc.FixedStreamConvention fixedStreamConvention() - { - return _fixedConv; - } - - /** - * Retrieve the Float Stream Convention - * - * @return The Float Stream Convention - */ - - public org.drip.market.otc.FloatStreamConvention floatStreamConvention() - { - return _floatConv; - } - - /** - * Retrieve the Spot Lag - * - * @return The Spot Lag - */ - - public int spotLag() - { - return _iSpotLag; - } - - /** - * Create a Standardized Fixed-Float Component Instance from the Inputs - * - * @param dtSpot The Spot Date - * @param strMaturityTenor The Maturity Tenor - * @param dblFixedCoupon The Fixed Coupon - * @param dblFloatBasis The Float Basis - * @param dblNotional Notional - * - * @return The Standardized Fixed-Float Component Instance - */ - - public org.drip.product.rates.FixFloatComponent createFixFloatComponent ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strMaturityTenor, - final double dblFixedCoupon, - final double dblFloatBasis, - final double dblNotional) - { - if (null == dtSpot) return null; - - org.drip.analytics.date.JulianDate dtEffective = dtSpot.addBusDays (_iSpotLag, - _fixedConv.calendar()); - - try { - org.drip.product.rates.FixFloatComponent ffc = new org.drip.product.rates.FixFloatComponent - (_fixedConv.createStream (dtEffective, strMaturityTenor, dblFixedCoupon, dblNotional), - _floatConv.createStream (dtEffective, strMaturityTenor, dblFloatBasis, -1. * - dblNotional), null); - - ffc.setPrimaryCode ("IRS::" + ffc.forwardLabel().get ("DERIVED").fullyQualifiedName() + "." + - strMaturityTenor); - - return ffc; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public java.lang.String toString() - { - return "[SPOT LAG: " + _iSpotLag + "] " + _fixedConv + " " + _floatConv; - } -} diff --git a/org/drip/market/otc/FixedStreamConvention.java b/org/drip/market/otc/FixedStreamConvention.java deleted file mode 100644 index ef2f734..0000000 --- a/org/drip/market/otc/FixedStreamConvention.java +++ /dev/null @@ -1,216 +0,0 @@ - -package org.drip.market.otc; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FixedStreamConvention contains the details of the fixed stream of an OTC fixed-float IBOR/Overnight Swap - * Contact. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixedStreamConvention { - private int _iAccrualCompoundingRule = -1; - private java.lang.String _strCalendar = ""; - private java.lang.String _strCurrency = ""; - private java.lang.String _strDayCount = ""; - private java.lang.String _strUnitPeriodTenor = ""; - private java.lang.String _strCompositePeriodTenor = ""; - - /** - * FixedStreamConvention Constructor - * - * @param strCurrency Currency - * @param strDayCount Day Count - * @param strCalendar Calendar - * @param strUnitPeriodTenor Unit Period Tenor - * @param strCompositePeriodTenor Composite Period Tenor - * @param iAccrualCompoundingRule Accrual Compounding Rule - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public FixedStreamConvention ( - final java.lang.String strCurrency, - final java.lang.String strDayCount, - final java.lang.String strCalendar, - final java.lang.String strUnitPeriodTenor, - final java.lang.String strCompositePeriodTenor, - final int iAccrualCompoundingRule) - throws java.lang.Exception - { - if (null == (_strCurrency = strCurrency) || _strCurrency.isEmpty() || null == (_strDayCount = - strDayCount) || _strDayCount.isEmpty() || null == (_strCalendar = strCalendar) || - _strCalendar.isEmpty() || null == (_strUnitPeriodTenor = strUnitPeriodTenor) || - _strUnitPeriodTenor.isEmpty() || null == (_strCompositePeriodTenor = - strCompositePeriodTenor) || _strCompositePeriodTenor.isEmpty() || - !org.drip.analytics.support.CompositePeriodBuilder.ValidateCompoundingRule - (_iAccrualCompoundingRule = iAccrualCompoundingRule)) - throw new java.lang.Exception ("FixedStreamConvention ctr => Invalid Inputs!"); - } - - /** - * Retrieve the Holiday Calendar - * - * @return The Holiday Calendar - */ - - public java.lang.String calendar() - { - return _strCalendar; - } - - /** - * Retrieve the Currency - * - * @return The Currency - */ - - public java.lang.String currency() - { - return _strCurrency; - } - - /** - * Retrieve the Day Count Convention - * - * @return The Day Count Convention - */ - - public java.lang.String dayCount() - { - return _strDayCount; - } - - /** - * Retrieve the Unit Period Tenor - * - * @return The Unit Period Tenor - */ - - public java.lang.String unitPeriodTenor() - { - return _strUnitPeriodTenor; - } - - /** - * Retrieve the Composite Period Tenor - * - * @return The Composite Period Tenor - */ - - public java.lang.String compositePeriodTenor() - { - return _strCompositePeriodTenor; - } - - /** - * Retrieve the Accrual Compounding Rule - * - * @return The Accrual Compounding Rule - */ - - public int accrualCompoundingRule() - { - return _iAccrualCompoundingRule; - } - - /** - * Create a Fixed Stream Instance - * - * @param dtEffective Effective Date - * @param strMaturityTenor Maturity Tenor - * @param dblCoupon Coupon - * @param dblNotional Notional - * - * @return The Fixed Stream Instance - */ - - public org.drip.product.rates.Stream createStream ( - final org.drip.analytics.date.JulianDate dtEffective, - final java.lang.String strMaturityTenor, - final double dblCoupon, - final double dblNotional) - { - try { - org.drip.param.period.UnitCouponAccrualSetting ucas = new - org.drip.param.period.UnitCouponAccrualSetting - (org.drip.analytics.support.Helper.TenorToFreq (_strUnitPeriodTenor), - _strDayCount, false, _strDayCount, false, _strCurrency, false, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - org.drip.param.period.ComposableFixedUnitSetting cfus = new - org.drip.param.period.ComposableFixedUnitSetting (_strUnitPeriodTenor, - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, null, - dblCoupon, 0., _strCurrency); - - org.drip.param.period.CompositePeriodSetting cps = new - org.drip.param.period.CompositePeriodSetting - (org.drip.analytics.support.Helper.TenorToFreq (_strCompositePeriodTenor), - _strCompositePeriodTenor, _strCurrency, null, dblNotional, null, null, null, null); - - java.util.List lsEdgeDate = - org.drip.analytics.support.CompositePeriodBuilder.RegularEdgeDates (dtEffective, - _strCompositePeriodTenor, strMaturityTenor, null); - - return new org.drip.product.rates.Stream - (org.drip.analytics.support.CompositePeriodBuilder.FixedCompositeUnit (lsEdgeDate, cps, ucas, - cfus)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public java.lang.String toString() - { - return "[FIXED: " + _strCurrency + " | " + _strDayCount + " | " + _strCalendar + " | " + - _strUnitPeriodTenor + " | " + _strCompositePeriodTenor + " | " + _iAccrualCompoundingRule + "]"; - } -} diff --git a/org/drip/market/otc/FloatFloatSwapConvention.java b/org/drip/market/otc/FloatFloatSwapConvention.java deleted file mode 100644 index 1bf341d..0000000 --- a/org/drip/market/otc/FloatFloatSwapConvention.java +++ /dev/null @@ -1,380 +0,0 @@ - -package org.drip.market.otc; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FloatFloatSwapConvention contains the Details of the IBOR Float-Float Component of an OTC contact. - * - * @author Lakshmi Krishnamurthy - */ - -public class FloatFloatSwapConvention { - private int _iSpotLag = -1; - private boolean _bIsComponentPair = false; - private java.lang.String _strCurrency = ""; - private boolean _bBasisOnDerivedStream = true; - private boolean _bBasisOnDerivedComponent = true; - private java.lang.String _strReferenceTenor = ""; - private boolean _bIsDerivedCompoundedToReference = true; - - private org.drip.product.rates.FixFloatComponent fixFloatComponent ( - final org.drip.analytics.date.JulianDate dtEffective, - final java.lang.String strFloaterTenor, - final java.lang.String strMaturityTenor, - final double dblFixedCoupon, - final double dblBasis, - final double dblNotional) - { - org.drip.market.otc.FixedFloatSwapConvention ffConv = - org.drip.market.otc.IBORFixedFloatContainer.ConventionFromJurisdiction (_strCurrency); - - if (null == ffConv) return null; - - org.drip.market.otc.FixedStreamConvention fixedConv = ffConv.fixedStreamConvention(); - - org.drip.product.rates.Stream streamFixed = fixedConv.createStream (dtEffective, strMaturityTenor, - dblFixedCoupon + (_bBasisOnDerivedStream ? 0. : dblBasis), dblNotional); - - org.drip.state.identifier.ForwardLabel forwardLabel = org.drip.state.identifier.ForwardLabel.Create - (org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction (_strCurrency), - strFloaterTenor); - - java.lang.String strFloaterTenorComposite = _bIsDerivedCompoundedToReference ? - fixedConv.compositePeriodTenor() : strFloaterTenor; - - try { - org.drip.param.period.ComposableFloatingUnitSetting cfus = new - org.drip.param.period.ComposableFloatingUnitSetting (strFloaterTenor, - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, null, - forwardLabel, - org.drip.analytics.support.CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - _bBasisOnDerivedStream ? dblBasis : 0.); - - org.drip.param.period.CompositePeriodSetting cps = new - org.drip.param.period.CompositePeriodSetting - (org.drip.analytics.support.Helper.TenorToFreq (strFloaterTenorComposite), - strFloaterTenorComposite, _strCurrency, null, -1. * dblNotional, null, null, null, - null); - - java.util.List lsEdgeDate = - org.drip.analytics.support.CompositePeriodBuilder.RegularEdgeDates (dtEffective, - strFloaterTenorComposite, strMaturityTenor, null); - - org.drip.product.rates.Stream streamFloater = new org.drip.product.rates.Stream - (org.drip.analytics.support.CompositePeriodBuilder.FloatingCompositeUnit (lsEdgeDate, cps, - cfus)); - - org.drip.product.rates.FixFloatComponent ffc = new org.drip.product.rates.FixFloatComponent - (streamFixed, streamFloater, null); - - ffc.setPrimaryCode ("IRS::" + ffc.forwardLabel().get ("DERIVED").fullyQualifiedName() + "." + - strMaturityTenor); - - return ffc; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * FloatFloatSwapConvention Constructor - * - * @param strCurrency The Currency - * @param strReferenceTenor The Reference Tenor - * @param bBasisOnDerivedStream TRUE - Apply the Basis to the Derived Stream - * @param bBasisOnDerivedComponent TRUE - Apply the Basis to the Derived Component - * @param bIsDerivedCompoundedToReference TRUE - The Derived Periods are Compounded onto the Reference - * @param bIsComponentPair TRUE - The Float-Float Swap is a Component Pair of 2 Fix-Float Swaps - * @param iSpotLag Spot Lag - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public FloatFloatSwapConvention ( - final java.lang.String strCurrency, - final java.lang.String strReferenceTenor, - final boolean bBasisOnDerivedStream, - final boolean bBasisOnDerivedComponent, - final boolean bIsDerivedCompoundedToReference, - final boolean bIsComponentPair, - final int iSpotLag) - throws java.lang.Exception - { - if (null == (_strCurrency = strCurrency) || _strCurrency.isEmpty() || null == (_strReferenceTenor = - strReferenceTenor) || _strReferenceTenor.isEmpty() || 0 > (_iSpotLag = iSpotLag)) - throw new java.lang.Exception ("FloatFloatSwapConvention ctr: Invalid Inputs"); - - _bIsComponentPair = bIsComponentPair; - _bBasisOnDerivedStream = bBasisOnDerivedStream; - _bBasisOnDerivedComponent = bBasisOnDerivedComponent; - _bIsDerivedCompoundedToReference = bIsDerivedCompoundedToReference; - } - - /** - * Retrieve the Currency - * - * @return The Currency - */ - - public java.lang.String currency() - { - return _strCurrency; - } - - /** - * Retrieve the Reference Tenor - * - * @return The Reference Tenor - */ - - public java.lang.String referenceTenor() - { - return _strReferenceTenor; - } - - /** - * Retrieve the Flag indicating whether the Basis is to be applied to the Derived or the Reference Stream - * - * @return TRUE - The Basis is applied to the Derived Stream - */ - - public boolean basisOnDerivedStream() - { - return _bBasisOnDerivedStream; - } - - /** - * Retrieve the Flag indicating whether the Basis is to be applied to the Derived or the Reference - * Component - * - * @return TRUE - The Basis is applied to the Derived Component - */ - - public boolean basisOnDerivedComponent() - { - return _bBasisOnDerivedComponent; - } - - /** - * Retrieve the Flag indicating whether the Derived Periods are to be compounded onto the Reference - * Period - * - * @return TRUE - The Derived Periods are Compounded onto the Reference - */ - - public boolean derivedCompoundedToReference() - { - return _bIsDerivedCompoundedToReference; - } - - /** - * Retrieve the Flag indicating whether the Float-Float Swap is a Component Pair of 2 Fix-Float Swaps - * - * @return TRUE - The Float-Float Swap is a Component Pair of 2 Fix-Float Swaps - */ - - public boolean componentPair() - { - return _bIsComponentPair; - } - - /** - * Retrieve the Spot Lag - * - * @return The Spot Lag - */ - - public int spotLag() - { - return _iSpotLag; - } - - /** - * Create an Instance of the Float-Float Component - * - * @param dtSpot Spot Date - * @param strDerivedTenor The Derived Tenor - * @param strMaturityTenor The Maturity Tenor - * @param dblBasis Basis - * @param dblNotional Notional - * - * @return Instance of the Float-Float Component - */ - - public org.drip.product.rates.FloatFloatComponent createFloatFloatComponent ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strDerivedTenor, - final java.lang.String strMaturityTenor, - final double dblBasis, - final double dblNotional) - { - if (_bIsComponentPair || null == dtSpot) return null; - - org.drip.state.identifier.ForwardLabel forwardLabelReference = - org.drip.state.identifier.ForwardLabel.Create - (org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction (_strCurrency), - _strReferenceTenor); - - if (null == forwardLabelReference) return null; - - org.drip.analytics.date.JulianDate dtEffective = dtSpot.addBusDays (_iSpotLag, - forwardLabelReference.floaterIndex().calendar()); - - org.drip.state.identifier.ForwardLabel forwardLabelDerived = - org.drip.state.identifier.ForwardLabel.Create - (org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction (_strCurrency), - strDerivedTenor); - - if (null == forwardLabelDerived) return null; - - java.lang.String strDerivedTenorComposite = _bIsDerivedCompoundedToReference ? _strReferenceTenor : - strDerivedTenor; - - try { - org.drip.param.period.ComposableFloatingUnitSetting cfusReference = new - org.drip.param.period.ComposableFloatingUnitSetting (_strReferenceTenor, - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, null, - forwardLabelReference, - org.drip.analytics.support.CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - !_bBasisOnDerivedStream ? dblBasis : 0.); - - org.drip.param.period.CompositePeriodSetting cpsReference = new - org.drip.param.period.CompositePeriodSetting - (org.drip.analytics.support.Helper.TenorToFreq (_strReferenceTenor), - _strReferenceTenor, _strCurrency, null, dblNotional, null, null, null, null); - - java.util.List lsReferenceEdgeDate = - org.drip.analytics.support.CompositePeriodBuilder.RegularEdgeDates (dtEffective, - _strReferenceTenor, strMaturityTenor, null); - - org.drip.product.rates.Stream streamReference = new org.drip.product.rates.Stream - (org.drip.analytics.support.CompositePeriodBuilder.FloatingCompositeUnit - (lsReferenceEdgeDate, cpsReference, cfusReference)); - - org.drip.param.period.ComposableFloatingUnitSetting cfusDerived = new - org.drip.param.period.ComposableFloatingUnitSetting (strDerivedTenor, - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, null, - forwardLabelDerived, - org.drip.analytics.support.CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - _bBasisOnDerivedStream ? dblBasis : 0.); - - org.drip.param.period.CompositePeriodSetting cpsDerived = new - org.drip.param.period.CompositePeriodSetting - (org.drip.analytics.support.Helper.TenorToFreq (strDerivedTenorComposite), - strDerivedTenorComposite, _strCurrency, null, -1. * dblNotional, null, null, null, - null); - - java.util.List lsDerivedEdgeDate = - org.drip.analytics.support.CompositePeriodBuilder.RegularEdgeDates (dtEffective, - strDerivedTenor, strMaturityTenor, null); - - org.drip.product.rates.Stream streamDerived = new org.drip.product.rates.Stream - (org.drip.analytics.support.CompositePeriodBuilder.FloatingCompositeUnit (lsDerivedEdgeDate, - cpsDerived, cfusDerived)); - - return new org.drip.product.rates.FloatFloatComponent (streamReference, streamDerived, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the Fix-Float Component Pair - * - * @param dtSpot Spot Date - * @param strDerivedTenor The Derived Tenor - * @param strMaturityTenor The Maturity Tenor - * @param dblReferenceFixedCoupon Fixed Coupon Rate for the Reference Component - * @param dblDerivedFixedCoupon Fixed Coupon Rate for the Derived Component - * @param dblBasis Basis - * @param dblNotional Notional - * - * @return Instance of the Fix-Float Component Pair - */ - - public org.drip.product.fx.ComponentPair createFixFloatComponentPair ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strDerivedTenor, - final java.lang.String strMaturityTenor, - final double dblReferenceFixedCoupon, - final double dblDerivedFixedCoupon, - final double dblBasis, - final double dblNotional) - { - if (!_bIsComponentPair || null == dtSpot) return null; - - org.drip.market.definition.IBORIndex floaterIndex = - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction (_strCurrency); - - if (null == floaterIndex) return null; - - org.drip.analytics.date.JulianDate dtEffective = dtSpot.addBusDays (_iSpotLag, - floaterIndex.calendar()); - - org.drip.product.rates.FixFloatComponent ffcReference = fixFloatComponent (dtEffective, - _strReferenceTenor, strMaturityTenor, dblReferenceFixedCoupon, !_bBasisOnDerivedComponent ? - dblBasis : 0., dblNotional); - - org.drip.product.rates.FixFloatComponent ffcDerived = fixFloatComponent (dtEffective, - strDerivedTenor, strMaturityTenor, dblDerivedFixedCoupon, _bBasisOnDerivedComponent ? dblBasis : - 0., -1. * dblNotional); - - try { - return new org.drip.product.fx.ComponentPair (_strCurrency + "::" + _strReferenceTenor + "/" + - strDerivedTenor + "_" + strMaturityTenor, ffcReference, ffcDerived, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/market/otc/FloatStreamConvention.java b/org/drip/market/otc/FloatStreamConvention.java deleted file mode 100644 index 98d9748..0000000 --- a/org/drip/market/otc/FloatStreamConvention.java +++ /dev/null @@ -1,157 +0,0 @@ - -package org.drip.market.otc; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FloatStreamConvention contains the details of the Floating Stream of an OTC IBOR/Overnight fix-float Swap - * Contract. - * - * @author Lakshmi Krishnamurthy - */ - -public class FloatStreamConvention { - private java.lang.String _strCompositePeriodTenor = ""; - private org.drip.state.identifier.ForwardLabel _forwardLabel = null; - - /** - * FloatStreamConvention Constructor - * - * @param forwardLabel The Forward Label - * @param strCompositePeriodTenor Composite Period Tenor - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public FloatStreamConvention ( - final org.drip.state.identifier.ForwardLabel forwardLabel, - final java.lang.String strCompositePeriodTenor) - throws java.lang.Exception - { - if (null == (_forwardLabel = forwardLabel) || null == (_strCompositePeriodTenor = - strCompositePeriodTenor) || _strCompositePeriodTenor.isEmpty()) - throw new java.lang.Exception ("FloatStreamConvention ctr: Invalid Inputs"); - } - - /** - * Retrieve the Forward Label - * - * @return The Forward Label - */ - - public org.drip.state.identifier.ForwardLabel floaterIndex() - { - return _forwardLabel; - } - - /** - * Retrieve the Composite Period Tenor - * - * @return The Composite Period Tenor - */ - - public java.lang.String compositePeriodTenor() - { - return _strCompositePeriodTenor; - } - - /** - * Create a Floating Stream Instance - * - * @param dtEffective Effective Date - * @param strMaturityTenor Maturity Tenor - * @param dblBasis Basis - * @param dblNotional Notional - * - * @return The Fixed Stream Instance - */ - - public org.drip.product.rates.Stream createStream ( - final org.drip.analytics.date.JulianDate dtEffective, - final java.lang.String strMaturityTenor, - final double dblBasis, - final double dblNotional) - { - boolean bOvernight = _forwardLabel.overnight(); - - try { - org.drip.param.period.ComposableFloatingUnitSetting cfus = new - org.drip.param.period.ComposableFloatingUnitSetting (bOvernight ? "ON" : - _forwardLabel.tenor(), bOvernight ? - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_OVERNIGHT : - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, _forwardLabel, - org.drip.analytics.support.CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - dblBasis); - - org.drip.param.period.CompositePeriodSetting cps = new - org.drip.param.period.CompositePeriodSetting (bOvernight ? 360 : - org.drip.analytics.support.Helper.TenorToFreq (_strCompositePeriodTenor), - _strCompositePeriodTenor, _forwardLabel.currency(), null, dblNotional, null, null, - null, null); - - java.util.List lsEdgeDate = bOvernight ? - org.drip.analytics.support.CompositePeriodBuilder.OvernightEdgeDates (dtEffective, - dtEffective.addTenor (strMaturityTenor), null): - org.drip.analytics.support.CompositePeriodBuilder.RegularEdgeDates (dtEffective, - _strCompositePeriodTenor, strMaturityTenor, null); - - return new org.drip.product.rates.Stream - (org.drip.analytics.support.CompositePeriodBuilder.FloatingCompositeUnit (lsEdgeDate, cps, - cfus)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public java.lang.String toString() - { - return "[FLOAT: " + _forwardLabel.fullyQualifiedName() + " | " + _strCompositePeriodTenor + "]"; - } -} diff --git a/org/drip/market/otc/IBORFixedFloatContainer.java b/org/drip/market/otc/IBORFixedFloatContainer.java deleted file mode 100644 index 4f5d022..0000000 --- a/org/drip/market/otc/IBORFixedFloatContainer.java +++ /dev/null @@ -1,458 +0,0 @@ - -package org.drip.market.otc; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * IBORFixedFloatContainer holds the settings of the standard OTC IBOR fix-float swap contract conventions. - * - * @author Lakshmi Krishnamurthy - */ - -public class IBORFixedFloatContainer { - private static final java.util.Map - _mapConvention = new java.util.TreeMap(); - - private static final java.lang.String TenorSubKey ( - final java.lang.String strCurrency, - final java.lang.String strMaturityTenor) - { - if (null == strCurrency) return null; - - try { - if ("AUD".equalsIgnoreCase (strCurrency)) - return 36 >= org.drip.analytics.support.Helper.TenorToMonths (strMaturityTenor) ? "36M" : - "MAX"; - - if ("CAD".equalsIgnoreCase (strCurrency) || "CHF".equalsIgnoreCase (strCurrency) || - "EUR".equalsIgnoreCase (strCurrency) || "GBP".equalsIgnoreCase (strCurrency) || - "INR".equalsIgnoreCase (strCurrency)) - return 12 >= org.drip.analytics.support.Helper.TenorToMonths (strMaturityTenor) ? "12M" : - "MAX"; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return "MAX"; - } - - /** - * Initialize the Fix-Float Conventions Container with the pre-set Fix-Float Contracts - * - * @return TRUE - The Fix-Float Conventions Container successfully initialized with the pre-set - * Fix-Float Contracts - */ - - public static final boolean Init() - { - try { - _mapConvention.put ("AUD|ALL|36M|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("AUD", "Act/365", "AUD", "3M", "3M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("AUD"), - "3M"), "3M"), 1)); - - _mapConvention.put ("AUD|ALL|MAX|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("AUD", "Act/365", "AUD", "6M", "6M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("AUD"), - "6M"), "6M"), 1)); - - _mapConvention.put ("CAD|ALL|12M|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("CAD", "Act/365", "CAD", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("CAD"), - "3M"), "1Y"), 0)); - - _mapConvention.put ("CAD|ALL|MAX|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("CAD", "Act/365", "CAD", "6M", "6M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("CAD"), - "3M"), "6M"), 0)); - - _mapConvention.put ("CHF|ALL|12M|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("CHF", "30/360", "CHF", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("CHF"), - "3M"), "3M"), 2)); - - _mapConvention.put ("CHF|ALL|MAX|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("CHF", "30/360", "CHF", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("CHF"), - "6M"), "6M"), 2)); - - _mapConvention.put ("CNY|ALL|MAX|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("CNY", "Act/365", "CNY", "3M", "3M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("CNY"), - "1W"), "3M"), 2)); - - _mapConvention.put ("CZK|ALL|MAX|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("CZK", "30/360", "CZK", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("CZK"), - "6M"), "6M"), 2)); - - _mapConvention.put ("DKK|ALL|MAX|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("DKK", "30/360", "DKK", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("DKK"), - "6M"), "6M"), 2)); - - _mapConvention.put ("EUR|ALL|12M|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("EUR", "30/360", "EUR", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("EUR"), - "3M"), "3M"), 2)); - - _mapConvention.put ("EUR|ALL|MAX|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("EUR", "30/360", "EUR", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("EUR"), - "6M"), "6M"), 2)); - - _mapConvention.put ("GBP|ALL|12M|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("GBP", "Act/365", "GBP", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("GBP"), - "3M"), "3M"), 0)); - - _mapConvention.put ("GBP|ALL|MAX|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("GBP", "Act/365", "GBP", "6M", "6M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("GBP"), - "6M"), "6M"), 0)); - - _mapConvention.put ("HKD|ALL|MAX|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("HKD", "Act/365", "HKD", "3M", "3M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("HKD"), - "3M"), "3M"), 0)); - - _mapConvention.put ("HUF|ALL|MAX|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("HUF", "30/360", "HUF", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("HUF"), - "6M"), "6M"), 2)); - - _mapConvention.put ("ILS|ALL|MAX|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("ILS", "30/360", "ILS", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("ILS"), - "6M"), "6M"), 2)); - - _mapConvention.put ("INR|ALL|12M|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("INR", "Act/365", "INR", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("INR"), - "3M"), "3M"), 2)); - - _mapConvention.put ("INR|ALL|MAX|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("INR", "Act/365", "INR", "6M", "6M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("INR"), - "6M"), "6M"), 2)); - - _mapConvention.put ("JPY|ALL|MAX|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("JPY", "Act/365", "JPY", "6M", "6M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("JPY"), - "6M"), "6M"), 2)); - - _mapConvention.put ("JPY|ALL|MAX|TIBOR", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("JPY", "Act/365", "JPY", "6M", "6M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromName ("JPY-TIBOR"), - "3M"), "3M"), 2)); - - _mapConvention.put ("MXN|ALL|MAX|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("MXN", "28/360", "MXN", "3M", "3M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("MXN"), - "3M"), "3M"), 2)); - - _mapConvention.put ("NOK|ALL|MAX|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("NOK", "30/360", "NOK", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("NOK"), - "6M"), "6M"), 2)); - - _mapConvention.put ("NZD|ALL|MAX|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("NZD", "Act/365", "NZD", "6M", "6M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("NZD"), - "3M"), "3M"), 0)); - - _mapConvention.put ("PLN|ALL|MAX|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("PLN", "Act/Act ISDA", "PLN", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("PLN"), - "6M"), "6M"), 2)); - - _mapConvention.put ("SEK|ALL|MAX|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("SEK", "30/360", "SEK", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("SEK"), - "6M"), "6M"), 2)); - - _mapConvention.put ("SGD|ALL|MAX|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("SGD", "Act/365", "SGD", "6M", "6M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("SGD"), - "6M"), "6M"), 2)); - - _mapConvention.put ("TRY|ALL|MAX|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("TRY", "30/360", "TRY", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("TRY"), - "6M"), "6M"), 2)); - - _mapConvention.put ("USD|ALL|MAX|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("USD", "30/360", "USD", "6M", "6M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("USD"), - "3M"), "3M"), 2)); - - _mapConvention.put ("USD|LON|MAX|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("USD", "Act/360", "USD", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("USD"), - "3M"), "3M"), 2)); - - _mapConvention.put ("USD|NYC|MAX|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("USD", "30/360", "USD", "6M", "6M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("USD"), - "3M"), "3M"), 2)); - - _mapConvention.put ("ZAR|ALL|MAX|MAIN", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("ZAR", "Act/365", "ZAR", "3M", "3M", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction ("ZAR"), - "3M"), "3M"), 0)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - return true; - } - - /** - * Retrieve the Fix-Float Convention for the specified Jurisdiction - * - * @param strJurisdictionName The Jurisdiction Name - * - * @return The Fix-Float Convention - */ - - public static final org.drip.market.otc.FixedFloatSwapConvention ConventionFromJurisdiction ( - final java.lang.String strJurisdictionName) - { - if (null == strJurisdictionName) return null; - - java.lang.String strKey = strJurisdictionName + "|ALL|MAX|MAIN"; - - return _mapConvention.containsKey (strKey) ? _mapConvention.get (strKey) : null; - } - - /** - * Retrieve the Fix-Float Convention for the specified Jurisdiction for the specified Maturity Tenor - * - * @param strJurisdictionName The Jurisdiction Name - * @param strMaturityTenor The Maturity Tenor - * - * @return The Fix-Float Convention - */ - - public static final org.drip.market.otc.FixedFloatSwapConvention ConventionFromJurisdictionMaturity ( - final java.lang.String strJurisdictionName, - final java.lang.String strMaturityTenor) - { - if (null == strJurisdictionName || null == strMaturityTenor) return null; - - java.lang.String strKey = strJurisdictionName + "|ALL|" + TenorSubKey (strJurisdictionName, - strMaturityTenor) + "|MAIN"; - - return _mapConvention.containsKey (strKey) ? _mapConvention.get (strKey) : null; - } - - /** - * Retrieve the Fix-Float Convention for the specified Jurisdiction for the specified Location - * - * @param strJurisdictionName The Jurisdiction Name - * @param strLocation The Location - * - * @return The Fix-Float Convention - */ - - public static final org.drip.market.otc.FixedFloatSwapConvention ConventionFromJurisdictionLocation ( - final java.lang.String strJurisdictionName, - final java.lang.String strLocation) - { - if (null == strJurisdictionName || null == strLocation) return null; - - java.lang.String strKey = strJurisdictionName + "|" + strLocation + "|MAX|MAIN"; - - return _mapConvention.containsKey (strKey) ? _mapConvention.get (strKey) : null; - } - - /** - * Retrieve the Fix-Float Convention for the specified Jurisdiction for the specified Index - * - * @param strJurisdictionName The Jurisdiction Name - * @param strIndexName The Index Name - * - * @return The Fix-Float Convention - */ - - public static final org.drip.market.otc.FixedFloatSwapConvention ConventionFromJurisdictionIndex ( - final java.lang.String strJurisdictionName, - final java.lang.String strIndexName) - { - if (null == strJurisdictionName || null == strIndexName) return null; - - java.lang.String strKey = strJurisdictionName + "|ALL|MAX|" + strIndexName; - - return _mapConvention.containsKey (strKey) ? _mapConvention.get (strKey) : null; - } - - /** - * Retrieve the Fix-Float Convention for the specified Jurisdiction for the specified Index, Location, - * and Maturity Tenor - * - * @param strJurisdictionName The Jurisdiction Name - * @param strLocation The Location - * @param strMaturityTenor Maturity Tenor - * @param strIndexName The Index Name - * - * @return The Fix-Float Convention - */ - - public static final org.drip.market.otc.FixedFloatSwapConvention ConventionFromJurisdiction ( - final java.lang.String strJurisdictionName, - final java.lang.String strLocation, - final java.lang.String strMaturityTenor, - final java.lang.String strIndexName) - { - if (null == strJurisdictionName || null == strLocation || null == strMaturityTenor || null == - strIndexName) - return null; - - java.lang.String strKey = strJurisdictionName + "|" + strLocation + "|" + TenorSubKey - (strJurisdictionName, strMaturityTenor) + "|" + strIndexName; - - return _mapConvention.containsKey (strKey) ? _mapConvention.get (strKey) : null; - } -} diff --git a/org/drip/market/otc/IBORFloatFloatContainer.java b/org/drip/market/otc/IBORFloatFloatContainer.java deleted file mode 100644 index 6efa9bc..0000000 --- a/org/drip/market/otc/IBORFloatFloatContainer.java +++ /dev/null @@ -1,143 +0,0 @@ - -package org.drip.market.otc; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * IBORFloatFloatContainer holds the settings of the standard OTC float-float swap contract Conventions. - * - * @author Lakshmi Krishnamurthy - */ - -public class IBORFloatFloatContainer { - private static final java.util.Map - _mapConvention = new java.util.TreeMap(); - - /** - * Initialize the Float-Float Conventions Container with the pre-set Float-Float Contracts - * - * @return TRUE - The Float-Float Conventions Container successfully initialized with the pre-set - * Float-Float Contracts - */ - - public static final boolean Init() - { - try { - _mapConvention.put ("AUD", new org.drip.market.otc.FloatFloatSwapConvention ("AUD", "6M", true, - false, true, false, 1)); - - _mapConvention.put ("CAD", new org.drip.market.otc.FloatFloatSwapConvention ("CAD", "6M", true, - false, true, false, 0)); - - _mapConvention.put ("CHF", new org.drip.market.otc.FloatFloatSwapConvention ("CHF", "6M", true, - false, true, false, 2)); - - _mapConvention.put ("CNY", new org.drip.market.otc.FloatFloatSwapConvention ("CNY", "6M", true, - false, true, false, 2)); - - _mapConvention.put ("DKK", new org.drip.market.otc.FloatFloatSwapConvention ("DKK", "6M", true, - false, true, false, 2)); - - _mapConvention.put ("EUR", new org.drip.market.otc.FloatFloatSwapConvention ("EUR", "6M", false, - true, false, true, 2)); - - _mapConvention.put ("GBP", new org.drip.market.otc.FloatFloatSwapConvention ("GBP", "6M", true, - false, true, false, 0)); - - _mapConvention.put ("HKD", new org.drip.market.otc.FloatFloatSwapConvention ("HKD", "6M", true, - false, true, false, 0)); - - _mapConvention.put ("INR", new org.drip.market.otc.FloatFloatSwapConvention ("INR", "6M", true, - false, true, false, 2)); - - _mapConvention.put ("JPY", new org.drip.market.otc.FloatFloatSwapConvention ("JPY", "6M", true, - false, true, false, 2)); - - _mapConvention.put ("NOK", new org.drip.market.otc.FloatFloatSwapConvention ("NOK", "6M", true, - false, true, false, 2)); - - _mapConvention.put ("NZD", new org.drip.market.otc.FloatFloatSwapConvention ("NZD", "6M", true, - false, true, false, 0)); - - _mapConvention.put ("PLN", new org.drip.market.otc.FloatFloatSwapConvention ("PLN", "6M", true, - false, true, false, 2)); - - _mapConvention.put ("SEK", new org.drip.market.otc.FloatFloatSwapConvention ("SEK", "6M", true, - false, true, false, 2)); - - _mapConvention.put ("SGD", new org.drip.market.otc.FloatFloatSwapConvention ("SGD", "6M", true, - false, true, false, 2)); - - _mapConvention.put ("USD", new org.drip.market.otc.FloatFloatSwapConvention ("USD", "6M", true, - false, true, false, 2)); - - _mapConvention.put ("ZAR", new org.drip.market.otc.FloatFloatSwapConvention ("ZAR", "6M", true, - false, true, false, 0)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - return true; - } - - /** - * Retrieve the Float-Float Convention Instance from the Jurisdiction Name - * - * @param strCurrency The Jurisdiction Name - * - * @return The Float-Float Convention Instance - */ - - public static final org.drip.market.otc.FloatFloatSwapConvention ConventionFromJurisdiction ( - final java.lang.String strCurrency) - { - return null == strCurrency || strCurrency.isEmpty() || !_mapConvention.containsKey (strCurrency) ? - null : _mapConvention.get (strCurrency); - } -} diff --git a/org/drip/market/otc/OvernightFixedFloatContainer.java b/org/drip/market/otc/OvernightFixedFloatContainer.java deleted file mode 100644 index 9518d7a..0000000 --- a/org/drip/market/otc/OvernightFixedFloatContainer.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.market.otc; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * OvernightFixedFloatContainer holds the settings of the standard OTC Overnight Fix-Float Swap Contract - * Conventions. - * - * @author Lakshmi Krishnamurthy - */ - -public class OvernightFixedFloatContainer { - private static final java.util.Map - _mapFundConvention = new java.util.TreeMap(); - - /** - * Initialize the Fix-Float Conventions Container with the pre-set Fix-Float Contracts - * - * @return TRUE - The Fix-Float Conventions Container successfully initialized with the pre-set - * Fix-Float Contracts - */ - - public static final boolean Init() - { - try { - _mapFundConvention.put ("AUD", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("AUD", "Act/365", "AUD", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention - (org.drip.state.identifier.ForwardLabel.Create - (org.drip.market.definition.OvernightIndexContainer.IndexFromJurisdiction - ("AUD"), "ON"), "ON"), 1)); - - _mapFundConvention.put ("CAD", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("CAD", "Act/365", "CAD", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.OvernightIndexContainer.IndexFromJurisdiction - ("CAD"), "ON"), "ON"), 0)); - - _mapFundConvention.put ("CHF", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("CHF", "Act/360", "CHF", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.OvernightIndexContainer.IndexFromJurisdiction - ("CHF"), "ON"), "ON"), 2)); - - _mapFundConvention.put ("EUR", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("EUR", "Act/360", "EUR", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.OvernightIndexContainer.IndexFromJurisdiction - ("EUR"), "ON"), "ON"), 2)); - - _mapFundConvention.put ("GBP", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("GBP", "Act/365", "GBP", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.OvernightIndexContainer.IndexFromJurisdiction - ("GBP"), "ON"), "ON"), 1)); - - _mapFundConvention.put ("INR", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("INR", "Act/365", "INR", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.OvernightIndexContainer.IndexFromJurisdiction - ("INR"), "ON"), "ON"), 1)); - - _mapFundConvention.put ("JPY", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("JPY", "Act/365", "JPY", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.OvernightIndexContainer.IndexFromJurisdiction - ("JPY"), "ON"), "ON"), 2)); - - _mapFundConvention.put ("NZD", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("NZD", "Act/365", "NZD", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention - (org.drip.state.identifier.ForwardLabel.Create - (org.drip.market.definition.OvernightIndexContainer.IndexFromJurisdiction - ("NZD"), "ON"), "ON"), 1)); - - _mapFundConvention.put ("SEK", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("SEK", "Act/360", "SEK", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.OvernightIndexContainer.IndexFromJurisdiction - ("SEK"), "ON"), "ON"), 2)); - - _mapFundConvention.put ("SGD", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("SGD", "Act/365", "SGD", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.OvernightIndexContainer.IndexFromJurisdiction - ("SGD"), "ON"), "ON"), 2)); - - _mapFundConvention.put ("USD", new org.drip.market.otc.FixedFloatSwapConvention (new - org.drip.market.otc.FixedStreamConvention ("USD", "Act/360", "USD", "1Y", "1Y", - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.market.otc.FloatStreamConvention ( - org.drip.state.identifier.ForwardLabel.Create ( - org.drip.market.definition.OvernightIndexContainer.IndexFromJurisdiction - ("USD"), "ON"), "ON"), 2)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - return true; - } - - /** - * Retrieve the Fix-Float Overnight Fund Convention for the specified Jurisdiction - * - * @param strJurisdictionName The Jurisdiction Name - * - * @return The Fix-Float Overnight Fund Convention - */ - - public static final org.drip.market.otc.FixedFloatSwapConvention FundConventionFromJurisdiction ( - final java.lang.String strJurisdictionName) - { - return null == strJurisdictionName || strJurisdictionName.isEmpty() || - !_mapFundConvention.containsKey (strJurisdictionName) ? null : _mapFundConvention.get - (strJurisdictionName); - } - - /** - * Retrieve the Fix-Float Overnight Index Convention for the specified Jurisdiction - * - * @param strJurisdictionName The Jurisdiction Name - * @param strMaturityTenor The Maturity Tenor - * - * @return The Fix-Float Overnight Index Convention - */ - - public static final org.drip.market.otc.FixedFloatSwapConvention IndexConventionFromJurisdiction ( - final java.lang.String strJurisdictionName, - final java.lang.String strMaturityTenor) - { - org.drip.market.otc.FixedFloatSwapConvention ffscFund = null == strJurisdictionName || - strJurisdictionName.isEmpty() || !_mapFundConvention.containsKey (strJurisdictionName) ? null : - _mapFundConvention.get (strJurisdictionName); - - if (null == ffscFund) return null; - - org.drip.market.otc.FloatStreamConvention fundFloatConvention = ffscFund.floatStreamConvention(); - - try { - org.drip.market.otc.FloatStreamConvention overnightFloatConvention = new - org.drip.market.otc.FloatStreamConvention (fundFloatConvention.floaterIndex(), - org.drip.analytics.support.Helper.LEFT_TENOR_LESSER == - org.drip.analytics.support.Helper.TenorCompare (strMaturityTenor, "1Y") ? - strMaturityTenor : "1Y"); - - return new org.drip.market.otc.FixedFloatSwapConvention (ffscFund.fixedStreamConvention(), - overnightFloatConvention, ffscFund.spotLag()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/market/otc/SwapOptionSettlement.java b/org/drip/market/otc/SwapOptionSettlement.java deleted file mode 100644 index 094b4ca..0000000 --- a/org/drip/market/otc/SwapOptionSettlement.java +++ /dev/null @@ -1,137 +0,0 @@ - -package org.drip.market.otc; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * SwapOptionSettlement contains the details of the OTC Swap Option Settlements. - * - * @author Lakshmi Krishnamurthy - */ - -public class SwapOptionSettlement { - - /** - * Swap Option Settlement Type - Cash Settled - */ - - public static final int SETTLEMENT_TYPE_CASH_SETTLED = 1; - - /** - * Swap Option Settlement Type - Physical Delivery - */ - - public static final int SETTLEMENT_TYPE_PHYSICAL_DELIVERY = 2; - - /** - * Swap Option Cash Settlement Quote Method - Internal Rate of Return - */ - - public static final int SETTLEMENT_QUOTE_IRR = 1; - - /** - * Swap Option Cash Settlement Quote Method - Exact Curve - */ - - public static final int SETTLEMENT_QUOTE_EXACT_CURVE = 2; - - private int _iSettlementType = -1; - private int _iSettlementQuote = -1; - - /** - * SwapOptionSettlement Constructor - * - * @param iSettlementType Settlement Type - * @param iSettlementQuote Settlement Quote - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public SwapOptionSettlement ( - final int iSettlementType, - final int iSettlementQuote) - throws java.lang.Exception - { - if (SETTLEMENT_TYPE_CASH_SETTLED != (_iSettlementType = iSettlementType) && - SETTLEMENT_TYPE_PHYSICAL_DELIVERY != _iSettlementType) - throw new java.lang.Exception ("SwapOptionSettlement ctr: Invalid Settlement Type"); - - if (SETTLEMENT_TYPE_CASH_SETTLED == _iSettlementType && SETTLEMENT_QUOTE_IRR != (_iSettlementQuote = - iSettlementQuote) && SETTLEMENT_QUOTE_EXACT_CURVE != _iSettlementQuote) - throw new java.lang.Exception ("SwapOptionSettlement ctr: Invalid Settlement Quote"); - } - - /** - * Retrieve the Settlement Type - * - * @return The Settlement Type - */ - - public int settlementType() - { - return _iSettlementType; - } - - /** - * Retrieve the Settlement Quote - * - * @return The Settlement Quote - */ - - public int settlementQuote() - { - return _iSettlementQuote; - } - - @Override public java.lang.String toString() - { - if (SETTLEMENT_TYPE_PHYSICAL_DELIVERY == _iSettlementType) return "PHYSICAL DELIVERY"; - - return "CASH SETTLED | " + (SETTLEMENT_QUOTE_IRR == _iSettlementQuote ? "INTERNAL RATE OF RETURN" : - "EXACT CURVE"); - } -} diff --git a/org/drip/market/otc/SwapOptionSettlementContainer.java b/org/drip/market/otc/SwapOptionSettlementContainer.java deleted file mode 100644 index 235f4af..0000000 --- a/org/drip/market/otc/SwapOptionSettlementContainer.java +++ /dev/null @@ -1,128 +0,0 @@ - -package org.drip.market.otc; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * SwapOptionSettlementContainer holds the Settlement Settings of the standard Option on an OTC Fix-Float - * Swap Contract. - * - * @author Lakshmi Krishnamurthy - */ - -public class SwapOptionSettlementContainer { - private static final java.util.Map - _mapConvention = new java.util.TreeMap(); - - /** - * Initialize the Swap Option Settlement Conventions Container with the pre-set Swap Option Settlement - * Conventions - * - * @return TRUE - The Swap Option Settlement Conventions Container successfully initialized with the - * pre-set Swap Option Settlement Conventions - */ - - public static final boolean Init() - { - try { - _mapConvention.put ("AUD", new org.drip.market.otc.SwapOptionSettlement - (org.drip.market.otc.SwapOptionSettlement.SETTLEMENT_TYPE_PHYSICAL_DELIVERY, 0)); - - _mapConvention.put ("CHF", new org.drip.market.otc.SwapOptionSettlement - (org.drip.market.otc.SwapOptionSettlement.SETTLEMENT_TYPE_CASH_SETTLED, - org.drip.market.otc.SwapOptionSettlement.SETTLEMENT_QUOTE_IRR)); - - _mapConvention.put ("DKK", new org.drip.market.otc.SwapOptionSettlement - (org.drip.market.otc.SwapOptionSettlement.SETTLEMENT_TYPE_CASH_SETTLED, - org.drip.market.otc.SwapOptionSettlement.SETTLEMENT_QUOTE_IRR)); - - _mapConvention.put ("EUR", new org.drip.market.otc.SwapOptionSettlement - (org.drip.market.otc.SwapOptionSettlement.SETTLEMENT_TYPE_CASH_SETTLED, - org.drip.market.otc.SwapOptionSettlement.SETTLEMENT_QUOTE_IRR)); - - _mapConvention.put ("GBP", new org.drip.market.otc.SwapOptionSettlement - (org.drip.market.otc.SwapOptionSettlement.SETTLEMENT_TYPE_CASH_SETTLED, - org.drip.market.otc.SwapOptionSettlement.SETTLEMENT_QUOTE_IRR)); - - _mapConvention.put ("JPY", new org.drip.market.otc.SwapOptionSettlement - (org.drip.market.otc.SwapOptionSettlement.SETTLEMENT_TYPE_PHYSICAL_DELIVERY, 0)); - - _mapConvention.put ("NOK", new org.drip.market.otc.SwapOptionSettlement - (org.drip.market.otc.SwapOptionSettlement.SETTLEMENT_TYPE_CASH_SETTLED, - org.drip.market.otc.SwapOptionSettlement.SETTLEMENT_QUOTE_IRR)); - - _mapConvention.put ("USD", new org.drip.market.otc.SwapOptionSettlement - (org.drip.market.otc.SwapOptionSettlement.SETTLEMENT_TYPE_CASH_SETTLED, - org.drip.market.otc.SwapOptionSettlement.SETTLEMENT_QUOTE_EXACT_CURVE)); - - _mapConvention.put ("SEK", new org.drip.market.otc.SwapOptionSettlement - (org.drip.market.otc.SwapOptionSettlement.SETTLEMENT_TYPE_CASH_SETTLED, - org.drip.market.otc.SwapOptionSettlement.SETTLEMENT_QUOTE_IRR)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - return true; - } - - /** - * Retrieve the Swap Option Settlement Convention for the specified Jurisdiction - * - * @param strJurisdictionName The Jurisdiction Name - * - * @return The Swap Option Settlement Convention - */ - - public static final org.drip.market.otc.SwapOptionSettlement ConventionFromJurisdiction ( - final java.lang.String strJurisdictionName) - { - return null == strJurisdictionName || strJurisdictionName.isEmpty() || !_mapConvention.containsKey - (strJurisdictionName) ? null : _mapConvention.get (strJurisdictionName); - } -} diff --git a/org/drip/measure/bayesian/JointPosteriorMetrics.java b/org/drip/measure/bayesian/JointPosteriorMetrics.java deleted file mode 100644 index 3634c3d..0000000 --- a/org/drip/measure/bayesian/JointPosteriorMetrics.java +++ /dev/null @@ -1,143 +0,0 @@ - -package org.drip.measure.bayesian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * JointPosteriorMetrics holds the Inputs and the Results of a Bayesian Computation Execution. - * - * @author Lakshmi Krishnamurthy - */ - -public class JointPosteriorMetrics { - private org.drip.measure.continuousjoint.R1Multivariate _r1mJoint = null; - private org.drip.measure.continuousjoint.R1Multivariate _r1mPrior = null; - private org.drip.measure.continuousjoint.R1Multivariate _r1mPosterior = null; - private org.drip.measure.continuousjoint.R1Multivariate _r1mConditional = null; - private org.drip.measure.continuousjoint.R1Multivariate _r1mUnconditional = null; - - /** - * JointPosteriorMetrics Constructor - * - * @param r1mPrior The R^1 Multivariate Prior Distribution (Input) - * @param r1mUnconditional The R^1 Multivariate Unconditional Distribution (Input) - * @param r1mConditional The R^1 Multivariate Conditional Distribution (Input) - * @param r1mJoint The R^1 Multivariate Joint Distribution (Output) - * @param r1mPosterior The R^1 Multivariate Posterior Distribution (Output) - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public JointPosteriorMetrics ( - final org.drip.measure.continuousjoint.R1Multivariate r1mPrior, - final org.drip.measure.continuousjoint.R1Multivariate r1mUnconditional, - final org.drip.measure.continuousjoint.R1Multivariate r1mConditional, - final org.drip.measure.continuousjoint.R1Multivariate r1mJoint, - final org.drip.measure.continuousjoint.R1Multivariate r1mPosterior) - throws java.lang.Exception - { - if (null == (_r1mPrior = r1mPrior) || null == (_r1mUnconditional = r1mUnconditional) || null == - (_r1mConditional= r1mConditional) || null == (_r1mJoint= r1mJoint) || null == (_r1mPosterior = - r1mPosterior)) - throw new java.lang.Exception ("JointPosteriorMetrics Constructor => Invalid Inputs!"); - } - - /** - * Retrieve the Prior Distribution - * - * @return The Prior Distribution - */ - - public org.drip.measure.continuousjoint.R1Multivariate prior() - { - return _r1mPrior; - } - - /** - * Retrieve the Unconditional Distribution - * - * @return The Unconditional Distribution - */ - - public org.drip.measure.continuousjoint.R1Multivariate unconditional() - { - return _r1mUnconditional; - } - - /** - * Retrieve the Conditional Distribution - * - * @return The Conditional Distribution - */ - - public org.drip.measure.continuousjoint.R1Multivariate conditional() - { - return _r1mConditional; - } - - /** - * Retrieve the Joint Distribution - * - * @return The Joint Distribution - */ - - public org.drip.measure.continuousjoint.R1Multivariate joint() - { - return _r1mJoint; - } - - /** - * Retrieve the Posterior Distribution - * - * @return The Posterior Distribution - */ - - public org.drip.measure.continuousjoint.R1Multivariate posterior() - { - return _r1mPosterior; - } -} diff --git a/org/drip/measure/bayesian/JointR1CombinationEngine.java b/org/drip/measure/bayesian/JointR1CombinationEngine.java deleted file mode 100644 index d642a41..0000000 --- a/org/drip/measure/bayesian/JointR1CombinationEngine.java +++ /dev/null @@ -1,73 +0,0 @@ - -package org.drip.measure.bayesian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * JointR1CombinationEngine implements the Engine that generates the Combined/Posterior Distributions from - * the Prior and the Conditional Joint Multivariate R^1 Distributions. - * - * @author Lakshmi Krishnamurthy - */ - -public interface JointR1CombinationEngine { - - /** - * Generate the Joint R^1 Multivariate Combined Distribution - * - * @param rmPrior The Prior Distribution - * @param rmUnconditional The Unconditional Distribution - * @param rmConditional The Conditional Distribution - * - * @return The Joint R^1 Multivariate Combined Distribution - */ - - public abstract org.drip.measure.bayesian.JointPosteriorMetrics process ( - final org.drip.measure.continuousjoint.R1Multivariate rmPrior, - final org.drip.measure.continuousjoint.R1Multivariate rmUnconditional, - final org.drip.measure.continuousjoint.R1Multivariate rmConditional); -} diff --git a/org/drip/measure/bayesian/JointR1NormalCombinationEngine.java b/org/drip/measure/bayesian/JointR1NormalCombinationEngine.java deleted file mode 100644 index 39df10b..0000000 --- a/org/drip/measure/bayesian/JointR1NormalCombinationEngine.java +++ /dev/null @@ -1,141 +0,0 @@ - -package org.drip.measure.bayesian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * JointR1NormalCombinationEngine implements the Engine that generates the Combined/Posterior Distribution - * from the Prior and the Conditional Joint R^1 Multivariate Normal Distributions. - * - * @author Lakshmi Krishnamurthy - */ - -public class JointR1NormalCombinationEngine implements org.drip.measure.bayesian.JointR1CombinationEngine { - - /** - * Empty JointR1NormalConvolutionEngine Construction - */ - - public JointR1NormalCombinationEngine() - { - } - - @Override public org.drip.measure.bayesian.JointPosteriorMetrics process ( - final org.drip.measure.continuousjoint.R1Multivariate r1mPrior, - final org.drip.measure.continuousjoint.R1Multivariate r1mUnconditional, - final org.drip.measure.continuousjoint.R1Multivariate r1mConditional) - { - if (null == r1mPrior || !(r1mPrior instanceof org.drip.measure.gaussian.R1MultivariateNormal) || null - == r1mConditional || !(r1mConditional instanceof org.drip.measure.gaussian.R1MultivariateNormal) - || null == r1mUnconditional || !(r1mUnconditional instanceof - org.drip.measure.gaussian.R1MultivariateNormal)) - return null; - - org.drip.measure.gaussian.R1MultivariateNormal r1mnPrior = - (org.drip.measure.gaussian.R1MultivariateNormal) r1mPrior; - org.drip.measure.gaussian.R1MultivariateNormal r1mnConditional = - (org.drip.measure.gaussian.R1MultivariateNormal) r1mConditional; - org.drip.measure.gaussian.R1MultivariateNormal r1mnUnconditional = - (org.drip.measure.gaussian.R1MultivariateNormal) r1mUnconditional; - - double[][] aadblPriorPrecision = r1mnPrior.covariance().precisionMatrix(); - - double[][] aadblConditionalPrecision = r1mnConditional.covariance().precisionMatrix(); - - int iNumVariate = aadblConditionalPrecision.length; - double[] adblJointMean = new double[iNumVariate]; - double[][] aadblJointPrecision = new double[iNumVariate][iNumVariate]; - double[][] aadblPosteriorCovariance = new double[iNumVariate][iNumVariate]; - - if (aadblPriorPrecision.length != iNumVariate) return null; - - double[] adblPrecisionWeightedPriorMean = org.drip.quant.linearalgebra.Matrix.Product - (aadblPriorPrecision, r1mnPrior.mean()); - - if (null == adblPrecisionWeightedPriorMean) return null; - - double[] adblPrecisionWeightedConditionalMean = org.drip.quant.linearalgebra.Matrix.Product - (aadblConditionalPrecision, r1mnConditional.mean()); - - if (null == adblPrecisionWeightedConditionalMean) return null; - - for (int i = 0; i < iNumVariate; ++i) { - adblJointMean[i] = adblPrecisionWeightedPriorMean[i] + adblPrecisionWeightedConditionalMean[i]; - - for (int j = 0; j < iNumVariate; ++j) - aadblJointPrecision[i][j] = aadblPriorPrecision[i][j] + aadblConditionalPrecision[i][j]; - } - - double[][] aadblJointCovariance = org.drip.quant.linearalgebra.Matrix.InvertUsingGaussianElimination - (aadblJointPrecision); - - double[] adblJointPosteriorMean = org.drip.quant.linearalgebra.Matrix.Product (aadblJointCovariance, - adblJointMean); - - double[][] aadblUnconditionalCovariance = r1mnUnconditional.covariance().covarianceMatrix(); - - org.drip.measure.continuousjoint.MultivariateMeta meta = r1mnPrior.meta(); - - for (int i = 0; i < iNumVariate; ++i) { - for (int j = 0; j < iNumVariate; ++j) - aadblPosteriorCovariance[i][j] = aadblJointCovariance[i][j] + - aadblUnconditionalCovariance[i][j]; - } - - try { - return new org.drip.measure.bayesian.JointPosteriorMetrics (r1mPrior, r1mUnconditional, - r1mConditional, new org.drip.measure.gaussian.R1MultivariateNormal (meta, - adblJointPosteriorMean, new org.drip.measure.gaussian.Covariance (aadblJointCovariance)), - new org.drip.measure.gaussian.R1MultivariateNormal (meta, adblJointPosteriorMean, new - org.drip.measure.gaussian.Covariance (aadblPosteriorCovariance))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/measure/bayesian/ProjectionDistributionLoading.java b/org/drip/measure/bayesian/ProjectionDistributionLoading.java deleted file mode 100644 index 554cf7d..0000000 --- a/org/drip/measure/bayesian/ProjectionDistributionLoading.java +++ /dev/null @@ -1,208 +0,0 @@ - -package org.drip.measure.bayesian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ProjectionDistributionLoading contains the Projection Distribution and its Loadings to the Scoping - * Distribution. - * - * @author Lakshmi Krishnamurthy - */ - -public class ProjectionDistributionLoading { - private double[][] _aadblScopingLoading = null; - private org.drip.measure.continuousjoint.R1Multivariate _r1mDistribution = null; - - /** - * Generate the Projection Co-variance Matrix from the Confidence Level - * - * @param aadblScopingCovariance The Scoping Co-variance Matrix - * @param aadblScopingLoading The Projection-Scoping Variate Loadings - * @param dblTau The Tau Parameter - * - * @return The Projection Co-variance Matrix - */ - - public static final double[][] ProjectionCovariance ( - final double[][] aadblScopingCovariance, - final double[][] aadblScopingLoading, - final double dblTau) - { - if (null == aadblScopingCovariance || null == aadblScopingLoading || - !org.drip.quant.common.NumberUtil.IsValid (dblTau)) - return null; - - int iNumProjection = aadblScopingLoading.length; - double[][] aadblProjectionCovariance = 0 == iNumProjection ? null : new - double[iNumProjection][iNumProjection]; - - if (0 == iNumProjection || iNumProjection != aadblScopingLoading.length) return null; - - for (int i = 0; i < iNumProjection; ++i) { - for (int j = 0; j < iNumProjection; ++j) { - try { - aadblProjectionCovariance[i][j] = i != j ? 0. : dblTau * - org.drip.quant.linearalgebra.Matrix.DotProduct (aadblScopingLoading[i], - org.drip.quant.linearalgebra.Matrix.Product (aadblScopingCovariance, - aadblScopingLoading[j])); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - } - - return aadblProjectionCovariance; - } - - /** - * Generate the ProjectionDistributionLoading Instance from the Confidence Level - * - * @param meta The R^1 Multivariate Meta Headers - * @param adblMean Array of the Univariate Means - * @param aadblScopingCovariance The Scoping Co-variance Matrix - * @param aadblScopingLoading The Projection-Scoping Variate Loadings - * @param dblTau The Tau Parameter - * - * @return The ProjectionDistributionLoading Instance - */ - - public static final ProjectionDistributionLoading FromConfidence ( - final org.drip.measure.continuousjoint.MultivariateMeta meta, - final double[] adblMean, - final double[][] aadblScopingCovariance, - final double[][] aadblScopingLoading, - final double dblTau) - { - try { - return new ProjectionDistributionLoading (new org.drip.measure.gaussian.R1MultivariateNormal - (meta, adblMean, new org.drip.measure.gaussian.Covariance (ProjectionCovariance - (aadblScopingCovariance, aadblScopingLoading, dblTau))), aadblScopingLoading); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * ProjectionDistributionLoading Constructor - * - * @param r1mDistribution The Projection Distribution Instance - * @param aadblScopingLoading The Projection-Scoping Variate Loadings - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ProjectionDistributionLoading ( - final org.drip.measure.continuousjoint.R1Multivariate r1mDistribution, - final double[][] aadblScopingLoading) - throws java.lang.Exception - { - if (null == (_r1mDistribution = r1mDistribution) || null == (_aadblScopingLoading = - aadblScopingLoading)) - throw new java.lang.Exception ("ProjectionDistributionLoading Constructor => Invalid Inputs!"); - - int iNumProjectionView = _r1mDistribution.meta().numVariable(); - - if (iNumProjectionView != _aadblScopingLoading.length) - throw new java.lang.Exception ("ProjectionDistributionLoading Constructor => Invalid Inputs!"); - - for (int i = 0; i < iNumProjectionView; ++i) { - if (null == _aadblScopingLoading[i] || 0 == _aadblScopingLoading[i].length || - !org.drip.quant.common.NumberUtil.IsValid (_aadblScopingLoading[i])) - throw new java.lang.Exception - ("ProjectionDistributionLoading Constructor => Invalid Inputs!"); - } - } - - /** - * Retrieve the Projection Distribution - * - * @return The Projection Distribution - */ - - public org.drip.measure.continuousjoint.R1Multivariate distribution() - { - return _r1mDistribution; - } - - /** - * Retrieve the Matrix of the Scoping Loadings - * - * @return The Matrix of the Scoping Loadings - */ - - public double[][] scopingLoading() - { - return _aadblScopingLoading; - } - - /** - * Retrieve the Number of the Projection Variates - * - * @return The Number of the Projection Variates - */ - - public int numberOfProjectionVariate() - { - return _aadblScopingLoading.length; - } - - /** - * Retrieve the Number of the Scoping Variate - * - * @return The Number of the Scoping Variate - */ - - public int numberOfScopingVariate() - { - return _aadblScopingLoading[0].length; - } -} diff --git a/org/drip/measure/bayesian/ScopingProjectionVariateDistribution.java b/org/drip/measure/bayesian/ScopingProjectionVariateDistribution.java deleted file mode 100644 index 32e25a3..0000000 --- a/org/drip/measure/bayesian/ScopingProjectionVariateDistribution.java +++ /dev/null @@ -1,158 +0,0 @@ - -package org.drip.measure.bayesian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ScopingProjectionVariateContainer holds the Scoping Variate Distribution, the Projection Variate - * Distributions, and the Projection Variate Loadings based off of the Scoping Variates. - * - * @author Lakshmi Krishnamurthy - */ - -public class ScopingProjectionVariateDistribution { - private org.drip.measure.continuousjoint.R1Multivariate _r1mScopingDistribution = null; - - private java.util.Map _mapPDL - = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - /** - * ScopingProjectionVariateDistribution Constructor - * - * @param r1mScopingDistribution The Multivariate R^1 Scoping Distribution - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ScopingProjectionVariateDistribution ( - final org.drip.measure.continuousjoint.R1Multivariate r1mScopingDistribution) - throws java.lang.Exception - { - if (null == (_r1mScopingDistribution = r1mScopingDistribution)) - throw new java.lang.Exception - ("ScopingProjectionVariateDistribution Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Scoping Distribution - * - * @return The Scoping Distribution - */ - - public org.drip.measure.continuousjoint.R1Multivariate scopingDistribution() - { - return _r1mScopingDistribution; - } - - /** - * Generate Loadings Native to the Scoping Distribution - * - * @return The Matrix of Loadings Native to the Scoping Distribution - */ - - public double[][] nativeLoading() - { - int iNumScopingVariate = _r1mScopingDistribution.meta().numVariable(); - - double[][] aadblNativeLoading = new double[iNumScopingVariate][iNumScopingVariate]; - - for (int i = 0; i < iNumScopingVariate; ++i) { - for (int j = 0; j < iNumScopingVariate; ++j) - aadblNativeLoading[i][j] = i == j ? 1. : 0.; - } - - return aadblNativeLoading; - } - - /** - * Add the Named Projection Distribution Loading - * - * @param strName The Projection Distribution Name - * @param pdl The Projection Distribution Loading - * - * @return TRUE - The Projection Distribution Loading successfully added - */ - - public boolean addProjectionDistributionLoading ( - final java.lang.String strName, - final org.drip.measure.bayesian.ProjectionDistributionLoading pdl) - { - if (null == strName || strName.isEmpty() || null == pdl) return false; - - _mapPDL.put (strName, pdl); - - return true; - } - - /** - * Retrieve the Named Projection Distribution Loading - * - * @param strName The Projection Distribution Name - * - * @return The Projection Distribution Loading - */ - - public org.drip.measure.bayesian.ProjectionDistributionLoading projectionDistributionLoading ( - final java.lang.String strName) - { - if (null == strName || strName.isEmpty()) return null; - - if (strName.equalsIgnoreCase ("NATIVE")) { - try { - return new org.drip.measure.bayesian.ProjectionDistributionLoading (_r1mScopingDistribution, - nativeLoading()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return _mapPDL.containsKey (strName) ? _mapPDL.get (strName) : null; - } -} diff --git a/org/drip/measure/bayesian/TheilMixedEstimationModel.java b/org/drip/measure/bayesian/TheilMixedEstimationModel.java deleted file mode 100644 index 594a657..0000000 --- a/org/drip/measure/bayesian/TheilMixedEstimationModel.java +++ /dev/null @@ -1,666 +0,0 @@ - -package org.drip.measure.bayesian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TheilMixedEstimationModel implements the Theil's Mixed Model for the Estimation of the Distribution - * Parameters. The Reference is: - * - * - Theil, H. (1971): Principles of Econometrics, Wiley. - * - * @author Lakshmi Krishnamurthy - */ - -public class TheilMixedEstimationModel { - - /** - * Generate the Joint Mixed Estimation Model Joint/Posterior Metrics - * - * @param meta The R^1 Multivariate Meta Descriptors - * @param pdl1 Projection Distribution and Loading #1 - * @param pdl2 Projection Distribution and Loading #2 - * @param r1mnUnconditional The R^1 Multivariate Normal Unconditional Distribution - * - * @return The Joint Mixed Estimation Model Joint/Posterior Metrics - */ - - public static final org.drip.measure.bayesian.JointPosteriorMetrics GenerateComposite ( - final org.drip.measure.continuousjoint.MultivariateMeta meta, - final org.drip.measure.bayesian.ProjectionDistributionLoading pdl1, - final org.drip.measure.bayesian.ProjectionDistributionLoading pdl2, - final org.drip.measure.gaussian.R1MultivariateNormal r1mnUnconditional) - { - if (null == meta || null == pdl1 || null == pdl2 || null == r1mnUnconditional) return null; - - int iNumScopingVariate = meta.numVariable(); - - if (iNumScopingVariate != pdl1.numberOfScopingVariate() || iNumScopingVariate != - pdl2.numberOfScopingVariate() || iNumScopingVariate != r1mnUnconditional.meta().numVariable()) - return null; - - org.drip.measure.continuousjoint.R1Multivariate r1m1 = pdl1.distribution(); - - org.drip.measure.continuousjoint.R1Multivariate r1m2 = pdl2.distribution(); - - if (!(r1m1 instanceof org.drip.measure.gaussian.R1MultivariateNormal) || !(r1m2 instanceof - org.drip.measure.gaussian.R1MultivariateNormal)) - return null; - - double[] adblJointPrecisionWeightedMean = new double[iNumScopingVariate]; - double[][] aadblJointPrecision = new double[iNumScopingVariate][iNumScopingVariate]; - double[][] aadblPosteriorCovariance = new double[iNumScopingVariate][iNumScopingVariate]; - org.drip.measure.gaussian.R1MultivariateNormal r1mn1 = - (org.drip.measure.gaussian.R1MultivariateNormal) r1m1; - org.drip.measure.gaussian.R1MultivariateNormal r1mn2 = - (org.drip.measure.gaussian.R1MultivariateNormal) r1m2; - - double[][] aadblScopingLoading1 = pdl1.scopingLoading(); - - double[][] aadblScopingLoading2 = pdl2.scopingLoading(); - - double[][] aadblScopingWeightedPrecision1 = org.drip.quant.linearalgebra.Matrix.Product - (org.drip.quant.linearalgebra.Matrix.Transpose (aadblScopingLoading1), - r1mn1.covariance().precisionMatrix()); - - double[][] aadblScopingWeightedPrecision2 = org.drip.quant.linearalgebra.Matrix.Product - (org.drip.quant.linearalgebra.Matrix.Transpose (aadblScopingLoading2), - r1mn2.covariance().precisionMatrix()); - - double[][] aadblScopingSpacePrecision1 = org.drip.quant.linearalgebra.Matrix.Product - (aadblScopingWeightedPrecision1, aadblScopingLoading1); - - double[][] aadblScopingSpacePrecision2 = org.drip.quant.linearalgebra.Matrix.Product - (aadblScopingWeightedPrecision2, aadblScopingLoading2); - - if (null == aadblScopingSpacePrecision1 || null == aadblScopingSpacePrecision2) return null; - - double[] adblPrecisionWeightedMean1 = org.drip.quant.linearalgebra.Matrix.Product - (aadblScopingWeightedPrecision1, r1mn1.mean()); - - double[] adblPrecisionWeightedMean2 = org.drip.quant.linearalgebra.Matrix.Product - (aadblScopingWeightedPrecision2, r1mn2.mean()); - - if (null == adblPrecisionWeightedMean1 || null == adblPrecisionWeightedMean2) return null; - - for (int i = 0; i < iNumScopingVariate; ++i) { - adblJointPrecisionWeightedMean[i] = adblPrecisionWeightedMean1[i] + - adblPrecisionWeightedMean2[i]; - - for (int j = 0; j < iNumScopingVariate; ++j) - aadblJointPrecision[i][j] = aadblScopingSpacePrecision1[i][j] + - aadblScopingSpacePrecision2[i][j]; - } - - double[][] aadblJointCovariance = org.drip.quant.linearalgebra.Matrix.InvertUsingGaussianElimination - (aadblJointPrecision); - - double[] adblJointPosteriorMean = org.drip.quant.linearalgebra.Matrix.Product (aadblJointCovariance, - adblJointPrecisionWeightedMean); - - double[][] aadblUnconditionalCovariance = r1mnUnconditional.covariance().covarianceMatrix(); - - for (int i = 0; i < iNumScopingVariate; ++i) { - for (int j = 0; j < iNumScopingVariate; ++j) - aadblPosteriorCovariance[i][j] = aadblJointCovariance[i][j] + - aadblUnconditionalCovariance[i][j]; - } - - try { - return new org.drip.measure.bayesian.JointPosteriorMetrics (r1mn1, r1mnUnconditional, r1mn2, new - org.drip.measure.gaussian.R1MultivariateNormal (meta, adblJointPosteriorMean, new - org.drip.measure.gaussian.Covariance (aadblJointCovariance)), new - org.drip.measure.gaussian.R1MultivariateNormal (meta, adblJointPosteriorMean, new - org.drip.measure.gaussian.Covariance (aadblPosteriorCovariance))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Combined R^1 Multivariate Normal Distribution from the SPVD and the Named Projections - * - * @param spvd The Scoping/Projection Distribution - * @param strProjection1 Name of Projection #1 - * @param strProjection2 Name of Projection #2 - * @param r1mnUnconditional The R^1 Multivariate Normal Unconditional Distribution - * - * @return The Combined R^1 Multivariate Normal Distribution - */ - - public static final org.drip.measure.bayesian.JointPosteriorMetrics GenerateComposite ( - final org.drip.measure.bayesian.ScopingProjectionVariateDistribution spvd, - final java.lang.String strProjection1, - final java.lang.String strProjection2, - final org.drip.measure.gaussian.R1MultivariateNormal r1mnUnconditional) - { - return null == spvd ? null : GenerateComposite (spvd.scopingDistribution().meta(), - spvd.projectionDistributionLoading (strProjection1), spvd.projectionDistributionLoading - (strProjection2), r1mnUnconditional); - } - - /** - * Generate the Combined R^1 Multivariate Normal Distribution from the SPVD, the NATIVE Projection, and - * the Named Projection - * - * @param spvd The Scoping/Projection Distribution - * @param strProjection Name of Projection - * @param r1mnUnconditional The R^1 Multivariate Normal Unconditional Distribution - * - * @return The Combined R^1 Multivariate Normal Distribution - */ - - public static final org.drip.measure.bayesian.JointPosteriorMetrics GenerateComposite ( - final org.drip.measure.bayesian.ScopingProjectionVariateDistribution spvd, - final java.lang.String strProjection, - final org.drip.measure.gaussian.R1MultivariateNormal r1mnUnconditional) - { - if (null == spvd) return null; - - org.drip.measure.continuousjoint.R1Multivariate r1m = spvd.scopingDistribution(); - - if (!(r1m instanceof org.drip.measure.gaussian.R1MultivariateNormal)) return null; - - org.drip.measure.gaussian.R1MultivariateNormal r1mnScoping = - (org.drip.measure.gaussian.R1MultivariateNormal) r1m; - - return GenerateComposite (r1mnScoping.meta(), spvd.projectionDistributionLoading ("NATIVE"), - spvd.projectionDistributionLoading (strProjection), r1mnUnconditional); - } - - /** - * Generate the Projection Space Scoping Mean - * - * @param spvd The Scoping/Projection Distribution - * @param strProjection Name of Projection - * - * @return The Projection Space Scoping Mean - */ - - public static final double[] ProjectionSpaceScopingMean ( - final org.drip.measure.bayesian.ScopingProjectionVariateDistribution spvd, - final java.lang.String strProjection) - { - if (null == spvd) return null; - - org.drip.measure.bayesian.ProjectionDistributionLoading pdl = spvd.projectionDistributionLoading - (strProjection); - - return null == pdl ? null : org.drip.quant.linearalgebra.Matrix.Product (pdl.scopingLoading(), - spvd.scopingDistribution().mean()); - } - - /** - * Generate the Projection Space Projection-Scoping Mean Differential - * - * @param spvd The Scoping/Projection Distribution - * @param strProjection Name of Projection - * - * @return The Projection Space Projection-Scoping Mean Differential - */ - - public static final double[] ProjectionSpaceScopingDifferential ( - final org.drip.measure.bayesian.ScopingProjectionVariateDistribution spvd, - final java.lang.String strProjection) - { - if (null == spvd) return null; - - org.drip.measure.bayesian.ProjectionDistributionLoading pdl = spvd.projectionDistributionLoading - (strProjection); - - if (null == pdl) return null; - - double[] adblProjectionSpaceScopingMean = org.drip.quant.linearalgebra.Matrix.Product - (pdl.scopingLoading(), spvd.scopingDistribution().mean()); - - if (null == adblProjectionSpaceScopingMean) return null; - - int iNumProjection = adblProjectionSpaceScopingMean.length; - double[] adblProjectionSpaceScopingDifferential = new double[iNumProjection]; - - double[] adblProjectionMean = pdl.distribution().mean(); - - for (int i = 0; i < iNumProjection; ++i) - adblProjectionSpaceScopingDifferential[i] = adblProjectionMean[i] - - adblProjectionSpaceScopingMean[i]; - - return adblProjectionSpaceScopingDifferential; - } - - /** - * Generate the Projection Space Scoping Co-variance - * - * @param spvd The Scoping/Projection Distribution - * @param strProjection Name of Projection - * - * @return The Projection Space Scoping Co-variance - */ - - public static final org.drip.measure.gaussian.Covariance ProjectionSpaceScopingCovariance ( - final org.drip.measure.bayesian.ScopingProjectionVariateDistribution spvd, - final java.lang.String strProjection) - { - if (null == spvd) return null; - - org.drip.measure.continuousjoint.R1Multivariate r1mScoping = spvd.scopingDistribution(); - - if (!(r1mScoping instanceof org.drip.measure.gaussian.R1MultivariateNormal)) return null; - - org.drip.measure.gaussian.R1MultivariateNormal r1mnScoping = - (org.drip.measure.gaussian.R1MultivariateNormal) r1mScoping; - - org.drip.measure.bayesian.ProjectionDistributionLoading pdl = spvd.projectionDistributionLoading - (strProjection); - - if (null == pdl) return null; - - double[][] aadblScopingLoading = pdl.scopingLoading(); - - try { - return new org.drip.measure.gaussian.Covariance (org.drip.quant.linearalgebra.Matrix.Product - (aadblScopingLoading, org.drip.quant.linearalgebra.Matrix.Product - (r1mnScoping.covariance().covarianceMatrix(), - org.drip.quant.linearalgebra.Matrix.Transpose (aadblScopingLoading)))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Shadow of the Scoping on Projection Transpose - * - * @param spvd The Scoping/Projection Distribution - * @param strProjection Name of Projection - * - * @return The Shadow of the Scoping on Projection Transpose - */ - - public static final double[][] ShadowScopingProjectionTranspose ( - final org.drip.measure.bayesian.ScopingProjectionVariateDistribution spvd, - final java.lang.String strProjection) - { - if (null == spvd) return null; - - org.drip.measure.continuousjoint.R1Multivariate r1mScoping = spvd.scopingDistribution(); - - if (!(r1mScoping instanceof org.drip.measure.gaussian.R1MultivariateNormal)) return null; - - org.drip.measure.bayesian.ProjectionDistributionLoading pdl = spvd.projectionDistributionLoading - (strProjection); - - return null == pdl ? null : org.drip.quant.linearalgebra.Matrix.Product - (((org.drip.measure.gaussian.R1MultivariateNormal) r1mScoping).covariance().covarianceMatrix(), - org.drip.quant.linearalgebra.Matrix.Transpose (pdl.scopingLoading())); - } - - /** - * Compute the Shadow of the Scoping on Projection - * - * @param spvd The Scoping/Projection Distribution - * @param strProjection Name of Projection - * - * @return The Shadow of the Scoping on Projection - */ - - public static final double[][] ShadowScopingProjection ( - final org.drip.measure.bayesian.ScopingProjectionVariateDistribution spvd, - final java.lang.String strProjection) - { - if (null == spvd) return null; - - org.drip.measure.continuousjoint.R1Multivariate r1mScoping = spvd.scopingDistribution(); - - org.drip.measure.bayesian.ProjectionDistributionLoading pdl = spvd.projectionDistributionLoading - (strProjection); - - return !(r1mScoping instanceof org.drip.measure.gaussian.R1MultivariateNormal) || null == pdl ? null - : org.drip.quant.linearalgebra.Matrix.Product (pdl.scopingLoading(), - ((org.drip.measure.gaussian.R1MultivariateNormal) - r1mScoping).covariance().covarianceMatrix()); - } - - /** - * Compute the Projection Precision Mean Dot Product Array - * - * @param spvd The Scoping/Projection Distribution - * @param strProjection Name of Projection - * - * @return The Projection Precision Mean Dot Product Array - */ - - public static final double[] ProjectionPrecisionMeanProduct ( - final org.drip.measure.bayesian.ScopingProjectionVariateDistribution spvd, - final java.lang.String strProjection) - { - if (null == spvd) return null; - - org.drip.measure.bayesian.ProjectionDistributionLoading pdl = spvd.projectionDistributionLoading - (strProjection); - - if (null == pdl) return null; - - org.drip.measure.continuousjoint.R1Multivariate r1mProjection = pdl.distribution(); - - return !(r1mProjection instanceof org.drip.measure.gaussian.R1MultivariateNormal) ? null : - org.drip.quant.linearalgebra.Matrix.Product (((org.drip.measure.gaussian.R1MultivariateNormal) - r1mProjection).covariance().precisionMatrix(), r1mProjection.mean()); - } - - /** - * Compute the Projection Induced Scoping Mean Deviation - * - * @param spvd The Scoping/Projection Distribution - * @param strProjection Name of Projection - * - * @return The Projection Induced Scoping Mean Deviation - */ - - public static final double[] ProjectionInducedScopingDeviation ( - final org.drip.measure.bayesian.ScopingProjectionVariateDistribution spvd, - final java.lang.String strProjection) - { - if (null == spvd) return null; - - org.drip.measure.continuousjoint.R1Multivariate r1mScoping = spvd.scopingDistribution(); - - if (!(r1mScoping instanceof org.drip.measure.gaussian.R1MultivariateNormal)) return null; - - org.drip.measure.gaussian.R1MultivariateNormal r1mnScoping = - (org.drip.measure.gaussian.R1MultivariateNormal) r1mScoping; - - org.drip.measure.bayesian.ProjectionDistributionLoading pdl = spvd.projectionDistributionLoading - (strProjection); - - if (null == pdl) return null; - - double[][] aadblScopingLoading = pdl.scopingLoading(); - - double[][] aadblProjectionScopingShadow = org.drip.quant.linearalgebra.Matrix.Product - (r1mnScoping.covariance().covarianceMatrix(), org.drip.quant.linearalgebra.Matrix.Transpose - (aadblScopingLoading)); - - double[] adblProjectionSpaceScopingMean = org.drip.quant.linearalgebra.Matrix.Product - (aadblScopingLoading, r1mScoping.mean()); - - if (null == adblProjectionSpaceScopingMean) return null; - - int iNumProjection = adblProjectionSpaceScopingMean.length; - double[] adblProjectionSpaceScopingDifferential = new double[iNumProjection]; - - double[] adblProjectionMean = pdl.distribution().mean(); - - for (int i = 0; i < iNumProjection; ++i) - adblProjectionSpaceScopingDifferential[i] = adblProjectionMean[i] - - adblProjectionSpaceScopingMean[i]; - - return org.drip.quant.linearalgebra.Matrix.Product (aadblProjectionScopingShadow, - org.drip.quant.linearalgebra.Matrix.Product - (org.drip.quant.linearalgebra.Matrix.InvertUsingGaussianElimination - (org.drip.quant.linearalgebra.Matrix.Product (aadblScopingLoading, - aadblProjectionScopingShadow)), adblProjectionSpaceScopingDifferential)); - } - - /** - * Compute the Projection Induced Scoping Deviation Adjusted Mean - * - * @param spvd The Scoping/Projection Distribution - * @param strProjection Name of Projection - * - * @return The Projection Induced Scoping Deviation Adjusted Mean - */ - - public static final double[] ProjectionInducedScopingMean ( - final org.drip.measure.bayesian.ScopingProjectionVariateDistribution spvd, - final java.lang.String strProjection) - { - if (null == spvd) return null; - - org.drip.measure.continuousjoint.R1Multivariate r1mScoping = spvd.scopingDistribution(); - - double[] adblScopingMean = r1mScoping.mean(); - - int iNumScopingVariate = r1mScoping.meta().numVariable(); - - if (!(r1mScoping instanceof org.drip.measure.gaussian.R1MultivariateNormal)) return null; - - org.drip.measure.gaussian.R1MultivariateNormal r1mnScoping = - (org.drip.measure.gaussian.R1MultivariateNormal) r1mScoping; - - org.drip.measure.bayesian.ProjectionDistributionLoading pdl = spvd.projectionDistributionLoading - (strProjection); - - if (null == pdl) return null; - - double[][] aadblScopingLoading = pdl.scopingLoading(); - - double[][] aadblProjectionScopingShadow = org.drip.quant.linearalgebra.Matrix.Product - (r1mnScoping.covariance().covarianceMatrix(), org.drip.quant.linearalgebra.Matrix.Transpose - (aadblScopingLoading)); - - double[] adblProjectionSpaceScopingMean = org.drip.quant.linearalgebra.Matrix.Product - (aadblScopingLoading, adblScopingMean); - - if (null == adblProjectionSpaceScopingMean) return null; - - int iNumProjection = adblProjectionSpaceScopingMean.length; - double[] adblProjectionInducedScopingMean = new double[iNumScopingVariate]; - double[] adblProjectionSpaceScopingDifferential = new double[iNumProjection]; - - double[] adblProjectionMean = pdl.distribution().mean(); - - for (int i = 0; i < iNumProjection; ++i) - adblProjectionSpaceScopingDifferential[i] = adblProjectionMean[i] - - adblProjectionSpaceScopingMean[i]; - - double[] adblProjectionInducedScopingDeviation = org.drip.quant.linearalgebra.Matrix.Product - (aadblProjectionScopingShadow, org.drip.quant.linearalgebra.Matrix.Product - (org.drip.quant.linearalgebra.Matrix.InvertUsingGaussianElimination - (org.drip.quant.linearalgebra.Matrix.Product (aadblScopingLoading, - aadblProjectionScopingShadow)), adblProjectionSpaceScopingDifferential)); - - if (null == adblProjectionInducedScopingDeviation) return null; - - for (int i = 0; i < iNumScopingVariate; ++i) - adblProjectionInducedScopingMean[i] = adblScopingMean[i] + - adblProjectionInducedScopingDeviation[i]; - - return adblProjectionInducedScopingMean; - } - - /** - * Compute the Asset Space Projection Co-variance - * - * @param spvd The Scoping/Projection Distribution - * @param strProjection Name of Projection - * - * @return The Asset Space Projection Co-variance - */ - - public static final double[][] AssetSpaceProjectionCovariance ( - final org.drip.measure.bayesian.ScopingProjectionVariateDistribution spvd, - final java.lang.String strProjection) - { - if (null == spvd) return null; - - org.drip.measure.bayesian.ProjectionDistributionLoading pdl = spvd.projectionDistributionLoading - (strProjection); - - if (null == pdl) return null; - - org.drip.measure.continuousjoint.R1Multivariate r1mProjection = pdl.distribution(); - - if (!(r1mProjection instanceof org.drip.measure.gaussian.R1MultivariateNormal)) return null; - - double[][] aadblScopingLoading = pdl.scopingLoading(); - - return org.drip.quant.linearalgebra.Matrix.Product (org.drip.quant.linearalgebra.Matrix.Transpose - (aadblScopingLoading), org.drip.quant.linearalgebra.Matrix.Product - (((org.drip.measure.gaussian.R1MultivariateNormal) - r1mProjection).covariance().covarianceMatrix(), aadblScopingLoading)); - } - - /** - * Compute the Projection Space Asset Co-variance - * - * @param spvd The Scoping/Projection Distribution - * @param strProjection Name of Projection - * - * @return The Projection Space Asset Co-variance - */ - - public static final double[][] ProjectionSpaceAssetCovariance ( - final org.drip.measure.bayesian.ScopingProjectionVariateDistribution spvd, - final java.lang.String strProjection) - { - if (null == spvd) return null; - - org.drip.measure.continuousjoint.R1Multivariate r1mScoping = spvd.scopingDistribution(); - - if (!(r1mScoping instanceof org.drip.measure.gaussian.R1MultivariateNormal)) return null; - - org.drip.measure.bayesian.ProjectionDistributionLoading pdl = spvd.projectionDistributionLoading - (strProjection); - - if (null == pdl) return null; - - double[][] aadblScopingLoading = pdl.scopingLoading(); - - return org.drip.quant.linearalgebra.Matrix.Product (aadblScopingLoading, - org.drip.quant.linearalgebra.Matrix.Product (((org.drip.measure.gaussian.R1MultivariateNormal) - r1mScoping).covariance().covarianceMatrix(), org.drip.quant.linearalgebra.Matrix.Transpose - (aadblScopingLoading))); - } - - /** - * Compute the Projection Induced Scoping Deviation Adjusted Mean - * - * @param spvd The Scoping/Projection Distribution - * @param strProjection Name of Projection - * @param r1mnUnconditional The Unconditional Distribution - * - * @return The Projection Induced Scoping Deviation Adjusted Mean - */ - - public static final org.drip.measure.gaussian.R1MultivariateNormal ProjectionInducedScopingDistribution ( - final org.drip.measure.bayesian.ScopingProjectionVariateDistribution spvd, - final java.lang.String strProjection, - final org.drip.measure.gaussian.R1MultivariateNormal r1mnUnconditional) - { - if (null == spvd || null == r1mnUnconditional) return null; - - org.drip.measure.continuousjoint.R1Multivariate r1mScoping = spvd.scopingDistribution(); - - double[] adblScopingMean = r1mScoping.mean(); - - int iNumScopingVariate = r1mScoping.meta().numVariable(); - - if (!(r1mScoping instanceof org.drip.measure.gaussian.R1MultivariateNormal)) return null; - - org.drip.measure.gaussian.R1MultivariateNormal r1mnScoping = - (org.drip.measure.gaussian.R1MultivariateNormal) r1mScoping; - - org.drip.measure.bayesian.ProjectionDistributionLoading pdl = spvd.projectionDistributionLoading - (strProjection); - - if (null == pdl) return null; - - double[][] aadblScopingLoading = pdl.scopingLoading(); - - double[][] aadblProjectionScopingShadow = org.drip.quant.linearalgebra.Matrix.Product - (r1mnScoping.covariance().covarianceMatrix(), org.drip.quant.linearalgebra.Matrix.Transpose - (aadblScopingLoading)); - - double[] adblProjectionSpaceScopingMean = org.drip.quant.linearalgebra.Matrix.Product - (aadblScopingLoading, adblScopingMean); - - if (null == adblProjectionSpaceScopingMean) return null; - - int iNumProjection = adblProjectionSpaceScopingMean.length; - double[] adblProjectionInducedScopingMean = new double[iNumScopingVariate]; - double[] adblProjectionSpaceScopingDifferential = new double[iNumProjection]; - - double[] adblProjectionMean = pdl.distribution().mean(); - - for (int i = 0; i < iNumProjection; ++i) - adblProjectionSpaceScopingDifferential[i] = adblProjectionMean[i] - - adblProjectionSpaceScopingMean[i]; - - double[] adblProjectionInducedScopingDeviation = org.drip.quant.linearalgebra.Matrix.Product - (aadblProjectionScopingShadow, org.drip.quant.linearalgebra.Matrix.Product - (org.drip.quant.linearalgebra.Matrix.InvertUsingGaussianElimination - (org.drip.quant.linearalgebra.Matrix.Product (aadblScopingLoading, - aadblProjectionScopingShadow)), adblProjectionSpaceScopingDifferential)); - - if (null == adblProjectionInducedScopingDeviation) return null; - - for (int i = 0; i < iNumScopingVariate; ++i) - adblProjectionInducedScopingMean[i] = adblScopingMean[i] + - adblProjectionInducedScopingDeviation[i]; - - org.drip.measure.continuousjoint.R1Multivariate r1mProjection = pdl.distribution(); - - if (!(r1mProjection instanceof org.drip.measure.gaussian.R1MultivariateNormal)) return null; - - try { - return new org.drip.measure.gaussian.R1MultivariateNormal (r1mnUnconditional.meta(), - adblProjectionInducedScopingMean, new org.drip.measure.gaussian.Covariance - (org.drip.quant.linearalgebra.Matrix.Product - (org.drip.quant.linearalgebra.Matrix.Transpose (aadblScopingLoading), - org.drip.quant.linearalgebra.Matrix.Product - (((org.drip.measure.gaussian.R1MultivariateNormal) - r1mProjection).covariance().covarianceMatrix(), aadblScopingLoading)))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/measure/continuousjoint/MultivariateMeta.java b/org/drip/measure/continuousjoint/MultivariateMeta.java deleted file mode 100644 index 5766c5b..0000000 --- a/org/drip/measure/continuousjoint/MultivariateMeta.java +++ /dev/null @@ -1,129 +0,0 @@ - -package org.drip.measure.continuousjoint; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * MultivariateMeta holds a Group of Variable Names - each of which separately is a Valid Single R^1/R^d - * Variable. - * - * @author Lakshmi Krishnamurthy - */ - -public class MultivariateMeta { - private java.lang.String[] _astrName = null; - - /** - * MultivariateMeta Constructor - * - * @param astrName Array of the Variate Names - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public MultivariateMeta ( - final java.lang.String[] astrName) - throws java.lang.Exception - { - if (null == (_astrName = astrName)) - throw new java.lang.Exception ("MultivariateMeta Constructor => Invalid Inputs"); - - int iNumVariable = _astrName.length; - - if (0 >= iNumVariable) - throw new java.lang.Exception ("MultivariateMeta Constructor => Invalid Inputs"); - - for (int i = 0; i < iNumVariable; ++i) { - if (null == _astrName[i] || _astrName[i].isEmpty()) - throw new java.lang.Exception ("MultivariateMeta Constructor => Invalid Inputs"); - } - } - - /** - * Retrieve the Number of Variate - * - * @return The Number of Variate - */ - - public int numVariable() - { - return _astrName.length; - } - - /** - * Retrieve the Array of the Variate Names - * - * @return The Array of the Variate Names - */ - - public java.lang.String[] names() - { - return _astrName; - } - - /** - * Retrieve the Index of the Named Variate - * - * @param strName The Named Variate - * - * @return Index of the Named Variate - */ - - public int variateIndex ( - final java.lang.String strName) - { - if (null == strName || strName.isEmpty()) return -1; - - int iNumVariable = numVariable(); - - for (int i = 0; i < iNumVariable; ++i) { - if (strName.equalsIgnoreCase (_astrName[i])) return i; - } - - return -1; - } -} diff --git a/org/drip/measure/continuousjoint/R1Multivariate.java b/org/drip/measure/continuousjoint/R1Multivariate.java deleted file mode 100644 index 6d3f42c..0000000 --- a/org/drip/measure/continuousjoint/R1Multivariate.java +++ /dev/null @@ -1,306 +0,0 @@ - -package org.drip.measure.continuousjoint; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * R1Multivariate contains the Generalized Joint Multivariate R^1 Distributions. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class R1Multivariate { - private org.drip.measure.continuousjoint.MultivariateMeta _meta = null; - - protected R1Multivariate ( - final org.drip.measure.continuousjoint.MultivariateMeta meta) - throws java.lang.Exception - { - if (null == (_meta = meta)) - throw new java.lang.Exception ("R1Multivariate Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Multivariate Meta Instance - * - * @return The Multivariate Meta Instance - */ - - public org.drip.measure.continuousjoint.MultivariateMeta meta() - { - return _meta; - } - - /** - * Retrieve the Left Edge Bounding Multivariate - * - * @return The Left Edge Bounding Multivariate - */ - - public double[] leftEdge() - { - int iNumVariate = _meta.numVariable(); - - double[] adblLeftEdge = new double[iNumVariate]; - - for (int i = 0; i < iNumVariate; ++i) - adblLeftEdge[i] = java.lang.Double.MIN_NORMAL; - - return adblLeftEdge; - } - - /** - * Retrieve the Right Edge Bounding Multivariate - * - * @return The Right Edge Bounding Multivariate - */ - - public double[] rightEdge() - { - int iNumVariate = _meta.numVariable(); - - double[] adblRightEdge = new double[iNumVariate]; - - for (int i = 0; i < iNumVariate; ++i) - adblRightEdge[i] = java.lang.Double.MAX_VALUE; - - return adblRightEdge; - } - - /** - * Compute the Density under the Distribution at the given Multivariate - * - * @param adblVariate The Multivariate at which the Density needs to be computed - * - * @return The Density - * - * @throws java.lang.Exception Thrown if the Density cannot be computed - */ - - public abstract double density ( - final double[] adblVariate) - throws java.lang.Exception; - - /** - * Convert the Multivariate Density into an RdToR1 Functions Instance - * - * @return The Multivariate Density converted into an RdToR1 Functions Instance - */ - - public org.drip.function.definition.RdToR1 densityRdToR1() - { - return new org.drip.function.definition.RdToR1 (null) { - @Override public int dimension() - { - return _meta.numVariable(); - } - - @Override public double evaluate ( - final double[] adblVariate) - throws java.lang.Exception - { - return density (adblVariate); - } - }; - } - - /** - * Compute the Cumulative under the Distribution to the given Variate Values - * - * @param adblVariate Array of Variate Values to which the Cumulative is to be computed - * - * @return The Cumulative - * - * @throws java.lang.Exception Thrown if the Cumulative cannot be computed - */ - - public double cumulative ( - final double[] adblVariate) - throws java.lang.Exception - { - return densityRdToR1().integrate (leftEdge(), adblVariate); - } - - /** - * Compute the Incremental under the Distribution between the 2 Multivariate Instances - * - * @param adblVariateLeft Left Multivariate Instance to which the Cumulative is to be computed - * @param adblVariateRight Right Multivariate Instance to which the Cumulative is to be computed - * - * @return The Incremental - * - * @throws java.lang.Exception Thrown if the Incremental cannot be computed - */ - - public double incremental ( - final double[] adblVariateLeft, - final double[] adblVariateRight) - throws java.lang.Exception - { - return densityRdToR1().integrate (adblVariateLeft, adblVariateRight); - } - - /** - * Compute the Expectation of the Specified R^d To R^1 Function Instance - * - * @param funcRdToR1 The R^d To R^1 Function Instance - * - * @return The Expectation of the Specified R^d To R^1 Function Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double expectation ( - final org.drip.function.definition.RdToR1 funcRdToR1) - throws java.lang.Exception - { - if (null == funcRdToR1) - throw new java.lang.Exception ("R1Multivariate::expectation => Invalid Inputs"); - - return new org.drip.function.definition.RdToR1 (null) { - @Override public int dimension() - { - return _meta.numVariable(); - } - - @Override public double evaluate ( - final double[] adblVariate) - throws java.lang.Exception - { - return density (adblVariate) * funcRdToR1.evaluate (adblVariate); - } - }.integrate (leftEdge(), rightEdge()); - } - - /** - * Compute the Mean of the Distribution - * - * @return The Mean of the Distribution - */ - - public double[] mean() - { - int iNumVariate = _meta.numVariable(); - - double[] adblMean = new double[iNumVariate]; - - for (int i = 0; i < iNumVariate; ++i) { - final int iVariate = i; - - try { - adblMean[i] = expectation (new org.drip.function.definition.RdToR1 (null) { - @Override public int dimension() - { - return _meta.numVariable(); - } - - @Override public double evaluate ( - final double[] adblVariate) - throws java.lang.Exception - { - return density (adblVariate) * adblVariate[iVariate]; - } - }); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return adblMean; - } - - /** - * Compute the Variance of the Distribution - * - * @return The Variance of the Distribution - */ - - public double[] variance() - { - final double[] adblMean = mean(); - - if (null == adblMean) return null; - - final int iNumVariate = adblMean.length; - double[] adblVariance = new double[iNumVariate]; - - for (int i = 0; i < iNumVariate; ++i) { - final int iVariate = i; - - try { - adblVariance[i] = expectation (new org.drip.function.definition.RdToR1 (null) { - @Override public int dimension() - { - return _meta.numVariable(); - } - - @Override public double evaluate ( - final double[] adblVariate) - throws java.lang.Exception - { - double dblSecondMoment = 0.; - - for (int i = 0; i < iNumVariate; ++i) { - double dblOffset = adblVariate[iVariate] - adblMean[iVariate]; - dblSecondMoment = dblSecondMoment + dblOffset * dblOffset; - } - - return density (adblVariate) * dblSecondMoment; - } - }); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return adblVariance; - } -} diff --git a/org/drip/measure/continuousjoint/R1R1.java b/org/drip/measure/continuousjoint/R1R1.java deleted file mode 100644 index 3d6932a..0000000 --- a/org/drip/measure/continuousjoint/R1R1.java +++ /dev/null @@ -1,111 +0,0 @@ - -package org.drip.measure.continuousjoint; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * R1R1 implements the Base Abstract Class behind Bivariate R^1 Distributions. It exports Methods for - * Incremental, Cumulative, and Inverse Cumulative Distribution Densities. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class R1R1 { - - /** - * Compute the Cumulative under the Distribution to the given Variate Pair - * - * @param dblX R^1 The X Variate to which the Cumulative is to be computed - * @param dblY R^1 The Y Variate to which the Cumulative is to be computed - * - * @return The Cumulative under the Distribution to the given Variate Pair - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public abstract double cumulative ( - final double dblX, - final double dblY) - throws java.lang.Exception; - - /** - * Compute the Incremental under the Distribution between the Variate Pair - * - * @param dblXLeft R^1 Left X Variate from which the Cumulative is to be computed - * @param dblYLeft R^1 Left Y Variate from which the Cumulative is to be computed - * @param dblXRight R^1 Right X Variate to which the Cumulative is to be computed - * @param dblYRight R^1 Right Y Variate to which the Cumulative is to be computed - * - * @return The Incremental under the Distribution between the Variate Pair - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public abstract double incremental ( - final double dblXLeft, - final double dblYLeft, - final double dblXRight, - final double dblYRight) - throws java.lang.Exception; - - /** - * Compute the Density under the Distribution at the given Variate Pair - * - * @param dblX R^1 The Variate to which the Cumulative is to be computed - * @param dblY R^1 The Variate to which the Cumulative is to be computed - * - * @return The Density under the Distribution at the given Variate Pair - * - * @throws java.lang.Exception Thrown if the Input is Invalid - */ - - public abstract double density ( - final double dblX, - final double dblY) - throws java.lang.Exception; -} diff --git a/org/drip/measure/continuousjoint/RdR1.java b/org/drip/measure/continuousjoint/RdR1.java deleted file mode 100644 index 7bcaef7..0000000 --- a/org/drip/measure/continuousjoint/RdR1.java +++ /dev/null @@ -1,111 +0,0 @@ - -package org.drip.measure.continuousjoint; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * Rd implements the Base Abstract Class behind R^d X R^1 Distributions. It exports Methods for incremental, - * cumulative, and inverse cumulative Distribution Densities. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class RdR1 { - - /** - * Compute the Cumulative under the Distribution to the given Variate Array/Variate Combination - * - * @param adblX R^d The Variate Array to which the Cumulative is to be computed - * @param dblY R^1 The Variate to which the Cumulative is to be computed - * - * @return The Cumulative under the Distribution to the given Variate Array/Variate Combination - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public abstract double cumulative ( - final double[] adblX, - final double dblY) - throws java.lang.Exception; - - /** - * Compute the Incremental under the Distribution between the Variate Array/Variate Pair - * - * @param adblXLeft Left R^d Variate Array from which the Cumulative is to be computed - * @param dblYLeft Left R^1 Variate from which the Cumulative is to be computed - * @param adblXRight Right R^d Variate Array to which the Cumulative is to be computed - * @param dblYRight Right R^1 Variate to which the Cumulative is to be computed - * - * @return The Incremental under the Distribution between the Variate Array/Variate Pair - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public abstract double incremental ( - final double[] adblXLeft, - final double dblYLeft, - final double[] adblXRight, - final double dblYRight) - throws java.lang.Exception; - - /** - * Compute the Density under the Distribution at the given Variate Array/Variate - * - * @param adblX R^d The Variate Array to which the Cumulative is to be computed - * @param dblY R^1 The Variate to which the Cumulative is to be computed - * - * @return The Density under the Distribution at the given Variate Array/Variate - * - * @throws java.lang.Exception Thrown if the Input is Invalid - */ - - public abstract double density ( - final double[] adblX, - final double dblY) - throws java.lang.Exception; -} diff --git a/org/drip/measure/continuousmarginal/BrokenDateBridge.java b/org/drip/measure/continuousmarginal/BrokenDateBridge.java deleted file mode 100644 index 5435e21..0000000 --- a/org/drip/measure/continuousmarginal/BrokenDateBridge.java +++ /dev/null @@ -1,71 +0,0 @@ - -package org.drip.measure.continuousmarginal; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * BrokenDateBridgeLinearT exposes the Ability to Interpolate the Realized Path Value between two Broken - * Dates. - * - * @author Lakshmi Krishnamurthy - */ - -public interface BrokenDateBridge { - - /** - * Interpolate the Value at T - * - * @param dblT T - * - * @return The Interpolated Value - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public abstract double interpolate ( - final double dblT) - throws java.lang.Exception; -} diff --git a/org/drip/measure/continuousmarginal/BrokenDateBridgeBrownian3P.java b/org/drip/measure/continuousmarginal/BrokenDateBridgeBrownian3P.java deleted file mode 100644 index 68ab45e..0000000 --- a/org/drip/measure/continuousmarginal/BrokenDateBridgeBrownian3P.java +++ /dev/null @@ -1,195 +0,0 @@ - -package org.drip.measure.continuousmarginal; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * BrokenDateBridgeBrownian3P Interpolates the Broken Dates using Three Stochastic Value Nodes using the - * Brownian Bridge Scheme. - * - * @author Lakshmi Krishnamurthy - */ - -public class BrokenDateBridgeBrownian3P implements org.drip.measure.continuousmarginal.BrokenDateBridge { - private double _dblT1 = java.lang.Double.NaN; - private double _dblT2 = java.lang.Double.NaN; - private double _dblT3 = java.lang.Double.NaN; - private double _dblV1 = java.lang.Double.NaN; - private double _dblV2 = java.lang.Double.NaN; - private double _dblV3 = java.lang.Double.NaN; - private double _dblBrownianBridgeFactor = java.lang.Double.NaN; - - /** - * BrokenDateBridgeBrownian3P Constructor - * - * @param dblT1 T1 - * @param dblT2 T2 - * @param dblT3 T3 - * @param dblV1 V1 - * @param dblV2 V2 - * @param dblV3 V3 - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BrokenDateBridgeBrownian3P ( - final double dblT1, - final double dblT2, - final double dblT3, - final double dblV1, - final double dblV2, - final double dblV3) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblT1 = dblT1) || - !org.drip.quant.common.NumberUtil.IsValid (_dblT2 = dblT2) || - !org.drip.quant.common.NumberUtil.IsValid (_dblT3 = dblT3) || - !org.drip.quant.common.NumberUtil.IsValid (_dblV1 = dblV1) || - !org.drip.quant.common.NumberUtil.IsValid (_dblV2 = dblV2) || - !org.drip.quant.common.NumberUtil.IsValid (_dblV3 = dblV3) || _dblT1 >= _dblT2 || - _dblT2 >= _dblT3) - throw new java.lang.Exception ("BrokenDateBridgeBrownian3P Constructor => Invalid Inputs"); - - double dblT3MinusT1 = _dblT3 - _dblT1; - double dblT3MinusT2 = _dblT3 - _dblT2; - double dblT2MinusT1 = _dblT2 - _dblT1; - - _dblBrownianBridgeFactor = java.lang.Math.sqrt (dblT3MinusT1 / (dblT3MinusT2 * dblT2MinusT1)) * - (_dblV2 - (dblT3MinusT2 * _dblV1 / dblT3MinusT1) - (dblT2MinusT1 * _dblV3 / dblT3MinusT1)); - } - - /** - * Retrieve T1 - * - * @return T1 - */ - - public double t1() - { - return _dblT1; - } - - /** - * Retrieve T2 - * - * @return T2 - */ - - public double t2() - { - return _dblT2; - } - - /** - * Retrieve T3 - * - * @return T3 - */ - - public double t3() - { - return _dblT3; - } - - /** - * Retrieve V1 - * - * @return V1 - */ - - public double v1() - { - return _dblV1; - } - - /** - * Retrieve V2 - * - * @return V2 - */ - - public double v2() - { - return _dblV2; - } - - /** - * Retrieve V3 - * - * @return V3 - */ - - public double v3() - { - return _dblV3; - } - - /** - * Retrieve the Brownian Bridge Factor - * - * @return The Brownian Bridge Factor - */ - - public double brownianBridgeFactor() - { - return _dblBrownianBridgeFactor; - } - - @Override public double interpolate ( - final double dblT) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblT) || dblT < _dblT1 || dblT > _dblT3) - throw new java.lang.Exception ("BrokenDateBridgeBrownian3P::interpolate => Invalid Inputs"); - - double dblT3MinusT1 = _dblT3 - _dblT1; - double dblT3MinusT = _dblT3 - dblT; - double dblTMinusT1 = dblT - _dblT1; - - return (dblT3MinusT * _dblV1 / dblT3MinusT1) + (dblTMinusT1 * _dblV3 / dblT3MinusT1) + - _dblBrownianBridgeFactor * java.lang.Math.sqrt (dblT3MinusT * dblTMinusT1 / dblT3MinusT1); - } -} diff --git a/org/drip/measure/continuousmarginal/BrokenDateBridgeLinearT.java b/org/drip/measure/continuousmarginal/BrokenDateBridgeLinearT.java deleted file mode 100644 index 86188ea..0000000 --- a/org/drip/measure/continuousmarginal/BrokenDateBridgeLinearT.java +++ /dev/null @@ -1,140 +0,0 @@ - -package org.drip.measure.continuousmarginal; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * BrokenDateBridgeLinearT Interpolates using Two Stochastic Value Nodes with Linear Scheme. The Scheme is - * Linear in Time. - * - * @author Lakshmi Krishnamurthy - */ - -public class BrokenDateBridgeLinearT implements org.drip.measure.continuousmarginal.BrokenDateBridge { - private double _dblT1 = java.lang.Double.NaN; - private double _dblT2 = java.lang.Double.NaN; - private double _dblV1 = java.lang.Double.NaN; - private double _dblV2 = java.lang.Double.NaN; - - /** - * BrokenDateBridgeLinearT Constructor - * - * @param dblT1 T1 - * @param dblT2 T2 - * @param dblV1 V1 - * @param dblV2 V2 - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BrokenDateBridgeLinearT ( - final double dblT1, - final double dblT2, - final double dblV1, - final double dblV2) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblT1 = dblT1) || - !org.drip.quant.common.NumberUtil.IsValid (_dblT2 = dblT2) || - !org.drip.quant.common.NumberUtil.IsValid (_dblV1 = dblV1) || - !org.drip.quant.common.NumberUtil.IsValid (_dblV2 = dblV2)|| _dblT1 >= _dblT2) - throw new java.lang.Exception ("BrokenDateBridgeLinearT Constructor => Invalid Inputs"); - } - - /** - * Retrieve T1 - * - * @return T1 - */ - - public double t1() - { - return _dblT1; - } - - /** - * Retrieve T2 - * - * @return T2 - */ - - public double t2() - { - return _dblT2; - } - - /** - * Retrieve V1 - * - * @return V1 - */ - - public double v1() - { - return _dblV1; - } - - /** - * Retrieve V2 - * - * @return V2 - */ - - public double v2() - { - return _dblV2; - } - - @Override public double interpolate ( - final double dblT) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblT) || dblT < _dblT1 || dblT > _dblT2) - throw new java.lang.Exception ("BrokenDateBridgeLinearT::interpolate => Invalid Inputs"); - - return ((_dblT2 - dblT) * _dblV1 + (dblT - _dblT1) * _dblV2) / (_dblT2 - _dblT1); - } -} diff --git a/org/drip/measure/continuousmarginal/BrokenDateBridgeSqrtT.java b/org/drip/measure/continuousmarginal/BrokenDateBridgeSqrtT.java deleted file mode 100644 index 1026283..0000000 --- a/org/drip/measure/continuousmarginal/BrokenDateBridgeSqrtT.java +++ /dev/null @@ -1,141 +0,0 @@ - -package org.drip.measure.continuousmarginal; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * BrokenDateBridgeSqrtT Interpolates using Two Stochastic Value Nodes with Linear Scheme. The Scheme is - * Linear in Square Root of Time. - * - * @author Lakshmi Krishnamurthy - */ - -public class BrokenDateBridgeSqrtT implements org.drip.measure.continuousmarginal.BrokenDateBridge { - private double _dblT1 = java.lang.Double.NaN; - private double _dblT2 = java.lang.Double.NaN; - private double _dblV1 = java.lang.Double.NaN; - private double _dblV2 = java.lang.Double.NaN; - - /** - * BrokenDateBridgeSqrtT Constructor - * - * @param dblT1 T1 - * @param dblT2 T2 - * @param dblV1 V1 - * @param dblV2 V2 - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BrokenDateBridgeSqrtT ( - final double dblT1, - final double dblT2, - final double dblV1, - final double dblV2) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblT1 = dblT1) || - !org.drip.quant.common.NumberUtil.IsValid (_dblT2 = dblT2) || - !org.drip.quant.common.NumberUtil.IsValid (_dblV1 = dblV1) || - !org.drip.quant.common.NumberUtil.IsValid (_dblV2 = dblV2)|| _dblT1 >= _dblT2) - throw new java.lang.Exception ("BrokenDateBridgeSqrtT Constructor => Invalid Inputs"); - } - - /** - * Retrieve T1 - * - * @return T1 - */ - - public double t1() - { - return _dblT1; - } - - /** - * Retrieve T2 - * - * @return T2 - */ - - public double t2() - { - return _dblT2; - } - - /** - * Retrieve V1 - * - * @return V1 - */ - - public double v1() - { - return _dblV1; - } - - /** - * Retrieve V2 - * - * @return V2 - */ - - public double v2() - { - return _dblV2; - } - - @Override public double interpolate ( - final double dblT) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblT) || dblT < _dblT1 || dblT > _dblT2) - throw new java.lang.Exception ("BrokenDateBridgeSqrtT::interpolate => Invalid Inputs"); - - return (java.lang.Math.sqrt (_dblT2 - dblT) * _dblV1 + java.lang.Math.sqrt (dblT - _dblT1) * _dblV2) - / java.lang.Math.sqrt (_dblT2 - _dblT1); - } -} diff --git a/org/drip/measure/continuousmarginal/R1.java b/org/drip/measure/continuousmarginal/R1.java deleted file mode 100644 index 6736b64..0000000 --- a/org/drip/measure/continuousmarginal/R1.java +++ /dev/null @@ -1,146 +0,0 @@ - -package org.drip.measure.continuousmarginal; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * R1 implements the Base Abstract Class behind R^1 Distributions. It exports the Methods for incremental, - * cumulative, and inverse cumulative distribution densities. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class R1 { - - /** - * Compute the cumulative under the distribution to the given value - * - * @param dblX Variate to which the cumulative is to be computed - * - * @return The cumulative - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public abstract double cumulative ( - final double dblX) - throws java.lang.Exception; - - /** - * Compute the Incremental under the Distribution between the 2 variates - * - * @param dblXLeft Left Variate to which the cumulative is to be computed - * @param dblXRight Right Variate to which the cumulative is to be computed - * - * @return The Incremental under the Distribution between the 2 variates - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public double incremental ( - final double dblXLeft, - final double dblXRight) - throws java.lang.Exception - { - return cumulative (dblXRight) - cumulative (dblXLeft); - } - - /** - * Compute the inverse cumulative under the distribution corresponding to the given value - * - * @param dblX Value corresponding to which the inverse cumulative is to be computed - * - * @return The inverse cumulative - * - * @throws java.lang.Exception Thrown if the input is invalid - */ - - public abstract double invCumulative ( - final double dblX) - throws java.lang.Exception; - - /** - * Compute the Density under the Distribution at the given Variate - * - * @param dblX Variate at which the Density needs to be computed - * - * @return The Density - * - * @throws java.lang.Exception Thrown if the input is invalid - */ - - public abstract double density ( - final double dblX) - throws java.lang.Exception; - - /** - * Retrieve the Mean of the Distribution - * - * @return The Mean of the Distribution - */ - - public abstract double mean(); - - /** - * Retrieve the Variance of the Distribution - * - * @return The Variance of the Distribution - */ - - public abstract double variance(); - - /** - * Retrieve the Univariate Weighted Histogram - * - * @return The Univariate Weighted Histogram - */ - - public abstract org.drip.quant.common.Array2D histogram(); -} diff --git a/org/drip/measure/continuousmarginal/Rd.java b/org/drip/measure/continuousmarginal/Rd.java deleted file mode 100644 index 822a8b6..0000000 --- a/org/drip/measure/continuousmarginal/Rd.java +++ /dev/null @@ -1,103 +0,0 @@ - -package org.drip.measure.continuousmarginal; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * Rd implements the Base Abstract Class behind R^d Distributions. It exports Methods for incremental, - * cumulative, and inverse cumulative Distribution Densities. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class Rd { - - /** - * Compute the Cumulative under the Distribution to the given Variaate Array - * - * @param adblX Variate Array to which the Cumulative is to be computed - * - * @return The Cumulative - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public abstract double cumulative ( - final double[] adblX) - throws java.lang.Exception; - - /** - * Compute the Incremental under the Distribution between the 2 Variate Arrays - * - * @param adblXLeft Left Variate Array to which the Cumulative is to be computed - * @param adblXRight Right Variate Array to which the Cumulative is to be computed - * - * @return The Incremental - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public abstract double incremental ( - final double[] adblXLeft, - final double[] adblXRight) - throws java.lang.Exception; - - /** - * Compute the Density under the Distribution at the given Variate Array - * - * @param adblX Variate Array at which the Density needs to be computed - * - * @return The Density - * - * @throws java.lang.Exception Thrown if the input is invalid - */ - - public abstract double density ( - final double[] adblX) - throws java.lang.Exception; -} diff --git a/org/drip/measure/crng/LinearCongruentialGenerator.java b/org/drip/measure/crng/LinearCongruentialGenerator.java deleted file mode 100644 index 7b077c2..0000000 --- a/org/drip/measure/crng/LinearCongruentialGenerator.java +++ /dev/null @@ -1,206 +0,0 @@ - -package org.drip.measure.crng; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * LinearCongruentialGenerator implements a RNG based on Recurrence Based on Modular Integer Arithmetic. - * - * @author Lakshmi Krishnamurthy - */ - -public class LinearCongruentialGenerator extends org.drip.measure.crng.RandomNumberGenerator { - private long _lA = java.lang.Long.MIN_VALUE; - private long _lB = java.lang.Long.MIN_VALUE; - private long _lM = java.lang.Long.MIN_VALUE; - private org.drip.measure.crng.RecursiveGenerator _rg = null; - - /** - * Construct an Instance of LinearCongruentialGenerator with the MRG of Type MRG32k3a - * - * @param lA A - * @param lB B - * @param lM M - * - * @return Instance of LinearCongruentialGenerator with the MRG of Type MRG32k3a - */ - - public static final LinearCongruentialGenerator MRG32k3a ( - final long lA, - final long lB, - final long lM) - { - try { - return new LinearCongruentialGenerator (lA, lB, lM, - org.drip.measure.crng.MultipleRecursiveGeneratorLEcuyer.MRG32k3a()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a NumericalRecipes Version of LinearCongruentialGenerator - * - * @param lA A - * @param lB B - * @param lM M - * - * @return NumericalRecipes Version of LinearCongruentialGenerator - */ - - public static final LinearCongruentialGenerator NumericalRecipes ( - final org.drip.measure.crng.RecursiveGenerator rg) - { - long l2Power32 = 1; - - for (int i = 0; i < 32; ++i) - l2Power32 *= 2; - - try { - return new LinearCongruentialGenerator (1664525L, 1013904223L, l2Power32, rg); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * LinearCongruentialGenerator Contructor - * - * @param lA A - * @param lB B - * @param lM M - * @param rg The MultipleRecursiveGenerator Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public LinearCongruentialGenerator ( - final long lA, - final long lB, - final long lM, - final org.drip.measure.crng.RecursiveGenerator rg) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_lA = lA) || !org.drip.quant.common.NumberUtil.IsValid - (_lB = lB) || !org.drip.quant.common.NumberUtil.IsValid (_lM = lM) || null == (_rg = rg)) - throw new java.lang.Exception ("LinearCongruentialGenerator Constructor => Invalid Inputs"); - } - - /** - * Retrieve A - * - * @return A - */ - - public long a() - { - return _lA; - } - - /** - * Retrieve B - * - * @return B - */ - - public long b() - { - return _lB; - } - - /** - * Retrieve M - * - * @return M - */ - - public long m() - { - return _lM; - } - - /** - * Retrieve the Recursive Generator Instance - * - * @return The Recursive Generator Instance - */ - - public org.drip.measure.crng.RecursiveGenerator recursiveGenerator() - { - return _rg; - } - - /** - * Retrieve the Next Pseudo-random Long - * - * @return The Next Pseudo-random Long - */ - - public long nextLong() - { - return (_lA * _rg.next() + _lB) % _lM; - } - - /** - * Retrieve a Random Number between -1 and 1 - * - * @return Random Number between -1 and 1 - */ - - public double nextDouble() - { - return ((double) nextLong()) / ((double) _lM); - } - - @Override public double nextDouble01() - { - return 0.5 * (1. + nextDouble()); - } -} diff --git a/org/drip/measure/crng/MultiStreamGenerator.java b/org/drip/measure/crng/MultiStreamGenerator.java deleted file mode 100644 index 5426de9..0000000 --- a/org/drip/measure/crng/MultiStreamGenerator.java +++ /dev/null @@ -1,147 +0,0 @@ - -package org.drip.measure.crng; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * MultiStreamGenerator helps generate Multiple Independent (i.e., Non-Overlapping) Streams of Random - * Numbers. - * - * @author Lakshmi Krishnamurthy - */ - -public class MultiStreamGenerator { - - /** - * Generate Multiple Independent Streams using the Skip Ahead Technique - * - * @param rng The Random Number Generator - * @param iNumStream Number of Streams to be Generated - * @param iNumElementsPerStream Number of Elements Per Stream - * - * @return Double Array of Multiple Independent Streams - */ - - public static final double[][] SkipAhead ( - final org.drip.measure.crng.RandomNumberGenerator rng, - final int iNumStream, - final int iNumElementsPerStream) - { - if (null == rng || 0 >= iNumStream || 0 >= iNumElementsPerStream) return null; - - double[][] aadblRandomStream = new double[iNumStream][iNumElementsPerStream]; - - for (int iStream = 0; iStream < iNumStream; ++iStream) { - for (int iElement = 0; iElement < iNumElementsPerStream; ++iElement) - aadblRandomStream[iStream][iElement] = rng.nextDouble01(); - } - - return aadblRandomStream; - } - - /** - * Generate Multiple Independent Streams using the Leap Frog Technique - * - * @param rng The Random Number Generator - * @param iNumStream Number of Streams to be Generated - * @param iNumElementsPerStream Number of Elements Per Stream - * - * @return Double Array of Multiple Independent Streams - */ - - public static final double[][] LeapFrog ( - final org.drip.measure.crng.RandomNumberGenerator rng, - final int iNumStream, - final int iNumElementsPerStream) - { - if (null == rng || 0 >= iNumStream || 0 >= iNumElementsPerStream) return null; - - double[][] aadblRandomStream = new double[iNumStream][iNumElementsPerStream]; - - for (int iElement = 0; iElement < iNumElementsPerStream; ++iElement) { - for (int iStream = 0; iStream < iNumStream; ++iStream) - aadblRandomStream[iStream][iElement] = rng.nextDouble01(); - } - - return aadblRandomStream; - } - - /** - * Generate Multiple Independent Streams using the Skip Ahead Technique from the Default Random Number - * Generator - * - * @param iNumStream Number of Streams to be Generated - * @param iNumElementsPerStream Number of Elements Per Stream - * - * @return Double Array of Multiple Independent Streams - */ - - public static final double[][] SkipAhead ( - final int iNumStream, - final int iNumElementsPerStream) - { - return SkipAhead (new org.drip.measure.crng.RandomNumberGenerator(), iNumStream, - iNumElementsPerStream); - } - - /** - * Generate Multiple Independent Streams using the Leap Frog Technique from the Default Random Number - * Generator - * - * @param iNumStream Number of Streams to be Generated - * @param iNumElementsPerStream Number of Elements Per Stream - * - * @return Double Array of Multiple Independent Streams - */ - - public static final double[][] LeapFrog ( - final int iNumStream, - final int iNumElementsPerStream) - { - return LeapFrog (new org.drip.measure.crng.RandomNumberGenerator(), iNumStream, - iNumElementsPerStream); - } -} diff --git a/org/drip/measure/crng/MultipleRecursiveGeneratorLEcuyer.java b/org/drip/measure/crng/MultipleRecursiveGeneratorLEcuyer.java deleted file mode 100644 index bc1ec55..0000000 --- a/org/drip/measure/crng/MultipleRecursiveGeneratorLEcuyer.java +++ /dev/null @@ -1,300 +0,0 @@ - -package org.drip.measure.crng; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * MultipleRecursiveGeneratorLEcuyer - L'Ecuyer's Multiple Recursive Generator - combines Multiple Recursive - * Sequences to produce a Large State Space with good Randomness Properties. MRG32k3a is a special Type of - * MultipleRecursiveGeneratorLEcuyer. - * - * @author Lakshmi Krishnamurthy - */ - -public class MultipleRecursiveGeneratorLEcuyer implements org.drip.measure.crng.RecursiveGenerator { - private long _lM1 = java.lang.Long.MIN_VALUE; - private long _lM2 = java.lang.Long.MIN_VALUE; - private long _lA12 = java.lang.Long.MIN_VALUE; - private long _lA13 = java.lang.Long.MIN_VALUE; - private long _lA21 = java.lang.Long.MIN_VALUE; - private long _lA23 = java.lang.Long.MIN_VALUE; - private long _lY1Prev = java.lang.Long.MIN_VALUE; - private long _lY2Prev = java.lang.Long.MIN_VALUE; - private long _lY1PrevPrev = java.lang.Long.MIN_VALUE; - private long _lY2PrevPrev = java.lang.Long.MIN_VALUE; - private long _lY1PrevPrevPrev = java.lang.Long.MIN_VALUE; - private long _lY2PrevPrevPrev = java.lang.Long.MIN_VALUE; - - /** - * Generate the MRG32k3a Variant of the L'Ecuyer's Multiple Recursive Generator - * - * @return The MRG32k3a Variant of the L'Ecuyer's Multiple Recursive Generator - */ - - public static final MultipleRecursiveGeneratorLEcuyer MRG32k3a() - { - long l2Power32 = 1; - - for (int i = 0; i < 32; ++i) - l2Power32 *= 2; - - try { - return new MultipleRecursiveGeneratorLEcuyer ( - System.nanoTime(), - System.nanoTime(), - System.nanoTime(), - System.nanoTime(), - System.nanoTime(), - System.nanoTime(), - 1403580, - -810728, - 527612, - -1370589, - l2Power32 - 209, - l2Power32 - 22853 - ); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * MultipleRecursiveGeneratorLEcuyer Constructor - * - * @param lY1Prev Y1 Previous - * @param lY1PrevPrev Y1 Previous Previous - * @param lY1PrevPrevPrev Y1 Previous Previous Previous - * @param lY2Prev Y2 Previous - * @param lY2PrevPrev Y2 Previous Previous - * @param lY2PrevPrevPrev Y2 Previous Previous Previous - * @param lA12 A12 - * @param lA13 A13 - * @param lA21 A21 - * @param lA23 A23 - * @param lM1 M1 - * @param lM2 M2 - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public MultipleRecursiveGeneratorLEcuyer ( - final long lY1Prev, - final long lY1PrevPrev, - final long lY1PrevPrevPrev, - final long lY2Prev, - final long lY2PrevPrev, - final long lY2PrevPrevPrev, - final long lA12, - final long lA13, - final long lA21, - final long lA23, - final long lM1, - final long lM2) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_lY1Prev = lY1Prev) || - !org.drip.quant.common.NumberUtil.IsValid (_lY1PrevPrev = lY1PrevPrev) || - !org.drip.quant.common.NumberUtil.IsValid (_lY1PrevPrevPrev = lY1PrevPrevPrev) || - !org.drip.quant.common.NumberUtil.IsValid (_lY2Prev = lY2Prev) || - !org.drip.quant.common.NumberUtil.IsValid (_lY2PrevPrev = lY2PrevPrev) || - !org.drip.quant.common.NumberUtil.IsValid (_lY2PrevPrevPrev = lY2PrevPrevPrev) || - !org.drip.quant.common.NumberUtil.IsValid (_lA12 = lA12) || - !org.drip.quant.common.NumberUtil.IsValid (_lA13 = lA13) || - !org.drip.quant.common.NumberUtil.IsValid (_lA21 = lA21) || - !org.drip.quant.common.NumberUtil.IsValid (_lA23 = lA23) || - !org.drip.quant.common.NumberUtil.IsValid (_lM1 = lM1) || - !org.drip.quant.common.NumberUtil.IsValid (_lM2 = lM2)) - throw new java.lang.Exception - ("MultipleRecursiveGeneratorLEcuyer Constructor => Invalid Inputs"); - } - - /** - * Retrieve M1 - * - * @return M1 - */ - - public long m1() - { - return _lM1; - } - - /** - * Retrieve M2 - * - * @return M2 - */ - - public long m2() - { - return _lM2; - } - - /** - * Retrieve A12 - * - * @return A12 - */ - - public long a12() - { - return _lA12; - } - - /** - * Retrieve A13 - * - * @return A13 - */ - - public long a13() - { - return _lA13; - } - - /** - * Retrieve A21 - * - * @return A21 - */ - - public long a21() - { - return _lA21; - } - - /** - * Retrieve A23 - * - * @return A23 - */ - - public long a23() - { - return _lA23; - } - - /** - * Retrieve Y1 Previous - * - * @return Y1 Previous - */ - - public long y1Prev() - { - return _lY1Prev; - } - - /** - * Retrieve Y1 Previous Previous - * - * @return Y1 Previous Previous - */ - - public long y1PrevPrev() - { - return _lY1PrevPrev; - } - - /** - * Retrieve Y1 Previous Previous Previous - * - * @return Y1 Previous Previous Previous - */ - - public long y1PrevPrevPrev() - { - return _lY1PrevPrevPrev; - } - - /** - * Retrieve Y2 Previous - * - * @return Y2 Previous - */ - - public long y2Prev() - { - return _lY2Prev; - } - - /** - * Retrieve Y2 Previous Previous - * - * @return Y2 Previous Previous - */ - - public long y2PrevPrev() - { - return _lY2PrevPrev; - } - - /** - * Retrieve Y2 Previous Previous Previous - * - * @return Y2 Previous Previous Previous - */ - - public long y2PrevPrevPrev() - { - return _lY2PrevPrevPrev; - } - - @Override public long next() - { - long lY1 = (_lA12 * _lY1PrevPrev + _lA13 * _lY1PrevPrevPrev) % _lM1; - long lY2 = (_lA21 * _lY2Prev + _lA23 * _lY2PrevPrevPrev) % _lM2; - _lY2PrevPrevPrev = _lY2PrevPrev; - _lY1PrevPrevPrev = _lY1PrevPrev; - _lY2PrevPrev = _lY2Prev; - _lY1PrevPrev = _lY1Prev; - _lY2Prev = lY2; - _lY1Prev = lY1; - return lY1 + lY2; - } -} diff --git a/org/drip/measure/crng/RandomNumberGenerator.java b/org/drip/measure/crng/RandomNumberGenerator.java deleted file mode 100644 index dfc2220..0000000 --- a/org/drip/measure/crng/RandomNumberGenerator.java +++ /dev/null @@ -1,76 +0,0 @@ - -package org.drip.measure.crng; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * RandomNumberGenerator provides the Functionality to generate Random Numbers. Default simply forwards to - * the Native JRE/JDK Implementation. - * - * @author Lakshmi Krishnamurthy - */ - -public class RandomNumberGenerator { - - /** - * Empty RandomNumberGenerator Constructor - */ - - public RandomNumberGenerator() - { - } - - /** - * Retrieve a Random Number between 0 and 1 - * - * @return Random Number between 0 and 1 - */ - - public double nextDouble01() - { - return java.lang.Math.random(); - } -} diff --git a/org/drip/measure/crng/RecursiveGenerator.java b/org/drip/measure/crng/RecursiveGenerator.java deleted file mode 100644 index 0afdd31..0000000 --- a/org/drip/measure/crng/RecursiveGenerator.java +++ /dev/null @@ -1,65 +0,0 @@ - -package org.drip.measure.crng; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * RecursiveGenerator exposes Sequence Generation using Recursive Schemes. The Recursion Schemes can be - * Single or Multiple. The Sequence Numbers can then be used for generating Random Numbers. - * - * @author Lakshmi Krishnamurthy - */ - -public interface RecursiveGenerator { - - /** - * Generate the Next Number in the Sequence - * - * @return The Next Number in the Sequence - */ - - public abstract long next(); -} diff --git a/org/drip/measure/crng/ShiftRegisterGenerator.java b/org/drip/measure/crng/ShiftRegisterGenerator.java deleted file mode 100644 index 11a264b..0000000 --- a/org/drip/measure/crng/ShiftRegisterGenerator.java +++ /dev/null @@ -1,183 +0,0 @@ - -package org.drip.measure.crng; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * ShiftRegisterGenerator implements a RNG based on the Shift Register Generation Scheme. - * - * @author Lakshmi Krishnamurthy - */ - -public class ShiftRegisterGenerator extends org.drip.measure.crng.RandomNumberGenerator { - private boolean[] _abA = null; - private boolean[] _abX = null; - private long _lMaximumPeriod = java.lang.Long.MIN_VALUE; - - /** - * Construct a Standard Instance of ShiftRegisterGenerator from the Specified Period Power - * - * @param iK The Period Power - * - * @return Instance of ShiftRegisterGenerator - */ - - public static final ShiftRegisterGenerator Standard ( - final int iK) - { - if (3 >= iK) return null; - - boolean[] abA = new boolean[iK]; - boolean[] abX = new boolean[iK]; - - for (int i = 0; i < iK; ++i) { - abA[i] = true; - - abX[i] = 1 == (System.nanoTime() % 2) ? true : false; - } - - try { - return new ShiftRegisterGenerator (abA, abX); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * ShiftRegisterGenerator Constructor - * - * @param abA Array of Coefficients - * @param abX Array of State Values - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ShiftRegisterGenerator ( - final boolean[] abA, - final boolean[] abX) - throws java.lang.Exception - { - if (null == (_abA = abA) || null == (_abX = abX)) - throw new java.lang.Exception ("ShiftRegisterGenerator Constructor => Invalid Inputs"); - - _lMaximumPeriod = 1; - int iK = _abA.length; - - if (0 == iK || iK != _abX.length) - throw new java.lang.Exception ("ShiftRegisterGenerator Constructor => Invalid Inputs"); - - for (int i = 0; i < iK; ++i) - _lMaximumPeriod = _lMaximumPeriod * 2; - - _lMaximumPeriod -= 1; - } - - /** - * Retrieve the Array of Coefficients - * - * @return The Array of Coefficients - */ - - public boolean[] a() - { - return _abA; - } - - /** - * Retrieve the Array of State Values - * - * @return The Array of State Values - */ - - public boolean[] x() - { - return _abX; - } - - /** - * Retrieve the Maximum Period - * - * @return The Maximum Period - */ - - public long maximumPeriod() - { - return _lMaximumPeriod; - } - - /** - * Generate the Next Long in the Sequence - * - * @return The Next Long in the Sequence - */ - - public long nextLong() - { - long lNext = 0L; - int iTwosIndex = 1; - int iK = _abA.length; - - for (int i = 0; i < iK; ++i) { - if (_abA[i] && _abX[i]) lNext = lNext + iTwosIndex; - - iTwosIndex *= 2; - } - - _abX[iK - 1] = 1 == (lNext % 2) ? true : false; - - for (int i = 0; i < iK - 1; ++i) - _abX[i] = _abX[i + 1]; - - return lNext; - } - - @Override public double nextDouble01() - { - return ((double) nextLong()) / ((double) _lMaximumPeriod); - } -} diff --git a/org/drip/measure/discretemarginal/BoundedUniformIntegerDistribution.java b/org/drip/measure/discretemarginal/BoundedUniformIntegerDistribution.java deleted file mode 100644 index ca5a0e1..0000000 --- a/org/drip/measure/discretemarginal/BoundedUniformIntegerDistribution.java +++ /dev/null @@ -1,173 +0,0 @@ - -package org.drip.measure.discretemarginal; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BoundedUniformIntegerDistribution implements the Univariate Bounded Uniform Integer Distribution, with the - * Integer being generated between a(n inclusive) lower and an upper Bound. - * - * @author Lakshmi Krishnamurthy - */ - -public class BoundedUniformIntegerDistribution extends org.drip.measure.continuousmarginal.R1 { - private int _iStart = -1; - private int _iFinish = -1; - - /** - * Construct a Univariate Bounded Uniform Integer Distribution - * - * @param iStart The Starting Integer - * @param iFinish The Finishing Integer - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public BoundedUniformIntegerDistribution ( - final int iStart, - final int iFinish) - throws java.lang.Exception - { - if ((_iFinish = iFinish) <= (_iStart = iStart)) - throw new java.lang.Exception ("BoundedUniformIntegerDistribution constructor: Invalid inputs"); - } - - /** - * Retrieve the Start - * - * @return The Start - */ - - public int start() - { - return _iStart; - } - - /** - * Retrieve the Finish - * - * @return The Finish - */ - - public int finish() - { - return _iFinish; - } - - @Override public double cumulative ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception - ("BoundedUniformIntegerDistribution::cumulative => Invalid inputs"); - - if (dblX <= _iStart) return 0.; - - if (dblX >= _iFinish) return 1.; - - return (dblX - _iStart) / (_iFinish - _iStart); - } - - @Override public double incremental ( - final double dblXLeft, - final double dblXRight) - throws java.lang.Exception - { - return cumulative (dblXRight) - cumulative (dblXLeft); - } - - @Override public double invCumulative ( - final double dblY) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblY) || dblY < 0. || dblY > 1.) - throw new java.lang.Exception - ("BoundedUniformIntegerDistribution::invCumulative => Invalid inputs"); - - return dblY * (_iFinish - _iStart) + _iStart; - } - - @Override public double density ( - final double dblX) - throws java.lang.Exception - { - throw new java.lang.Exception - ("BoundedUniformIntegerDistribution::density => Not available for discrete distributions"); - } - - @Override public double mean() - { - return 0.5 * (_iFinish + _iStart); - } - - @Override public double variance() - { - return (_iFinish - _iStart) * (_iFinish - _iStart) / 12.; - } - - @Override public org.drip.quant.common.Array2D histogram() - { - int iGridWidth = _iFinish - _iStart; - double[] adblX = new double[iGridWidth]; - double[] adblY = new double[iGridWidth]; - - for (int i = 0; i < iGridWidth; ++i) { - adblY[i] = 1. / iGridWidth; - adblX[i] = _iStart + (i + 1); - } - - try { - - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/measure/discretemarginal/CorrelatedPathVertexDimension.java b/org/drip/measure/discretemarginal/CorrelatedPathVertexDimension.java deleted file mode 100644 index 0d02ff7..0000000 --- a/org/drip/measure/discretemarginal/CorrelatedPathVertexDimension.java +++ /dev/null @@ -1,168 +0,0 @@ - -package org.drip.measure.discretemarginal; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CorrelatedPathVertexDimension generates Correlated R^d Random Numbers at the specified Vertexes, over the - * Specified Paths. - * - * @author Lakshmi Krishnamurthy - */ - -public class CorrelatedPathVertexDimension { - private int _iNumPath = -1; - private int _iNumVertex = -1; - private boolean _bApplyAntithetic = false; - private double[][] _aadblCorrelation = null; - private org.drip.measure.crng.RandomNumberGenerator _rng = null; - - /** - * CorrelatedPathVertexDimension Constructor - * - * @param rng The Random Number Generator - * @param aadblCorrelation The Correlation Matrix - * @param iNumVertex Number of Vertexes - * @param iNumPath Number of Paths - * @param bApplyAntithetic TRUE - Apply Antithetic Variables Based Variance Reduction - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CorrelatedPathVertexDimension ( - final org.drip.measure.crng.RandomNumberGenerator rng, - final double[][] aadblCorrelation, - final int iNumVertex, - final int iNumPath, - final boolean bApplyAntithetic) - throws java.lang.Exception - { - if (null == (_rng = rng) || null == (_aadblCorrelation = aadblCorrelation) || 0 >= (_iNumVertex = - iNumVertex) || 0 >= (_iNumPath = iNumPath)) - throw new java.lang.Exception ("CorrelatedPathVertexDimension Constructor => Invalid Inputs"); - - _bApplyAntithetic = bApplyAntithetic; - int iDimension = _aadblCorrelation.length; - - if (0 == iDimension) - throw new java.lang.Exception ("CorrelatedPathVertexDimension Constructor => Invalid Inputs"); - - for (int i = 0; i < iDimension; ++i) { - if (null == _aadblCorrelation[i] || iDimension != _aadblCorrelation[i].length || - !org.drip.quant.common.NumberUtil.IsValid (_aadblCorrelation[i])) - throw new java.lang.Exception - ("CorrelatedPathVertexDimension Constructor => Invalid Inputs"); - } - } - - /** - * Retrieve the Random Number Generator - * - * @return The Random Number Generator Instance - */ - - public org.drip.measure.crng.RandomNumberGenerator randomNumberGenerator() - { - return _rng; - } - - /** - * Retrieve the Correlation Matrix - * - * @return The Correlation Matrix - */ - - public double[][] correlation() - { - return _aadblCorrelation; - } - - /** - * Retrieve the Number of Vertexes - * - * @return The Number of Vertexes - */ - - public int numVertex() - { - return _iNumVertex; - } - - /** - * Retrieve the Number of Paths - * - * @return The Number of Paths - */ - - public int numPath() - { - return _iNumPath; - } - - /** - * Retrieve the Number of Dimensions - * - * @return The Number of Dimensions - */ - - public int numDimension() - { - return _aadblCorrelation.length; - } - - /** - * Indicate if the Antitehtic Variable Generation is to be applied - * - * @return TRUE - Apply Antithetic Variables Based Variance Reduction - */ - - public boolean applyAntithetic() - { - return _bApplyAntithetic; - } -} diff --git a/org/drip/measure/discretemarginal/PoissonDistribution.java b/org/drip/measure/discretemarginal/PoissonDistribution.java deleted file mode 100644 index e3306f5..0000000 --- a/org/drip/measure/discretemarginal/PoissonDistribution.java +++ /dev/null @@ -1,160 +0,0 @@ - -package org.drip.measure.discretemarginal; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * PoissonDistribution implements the Univariate Poisson Distribution using the specified Mean/Variance. - * - * @author Lakshmi Krishnamurthy - */ - -public class PoissonDistribution extends org.drip.measure.continuousmarginal.R1 { - private double _dblLambda = java.lang.Double.NaN; - private double _dblExponentialLambda = java.lang.Double.NaN; - - /** - * Construct a PoissonDistribution Instance - * - * @param dblLambda Lambda - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public PoissonDistribution ( - final double dblLambda) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblLambda = dblLambda) || 0. >= _dblLambda) - throw new java.lang.Exception ("PoissonDistribution constructor: Invalid inputs"); - - _dblExponentialLambda = java.lang.Math.exp (-1. * _dblLambda); - } - - /** - * Retrieve Lambda - * - * @return Lambda - */ - - public double lambda() - { - return _dblLambda; - } - - @Override public double cumulative ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception ("PoissonDistribution::cumulative => Invalid inputs"); - - int iEnd = (int) dblX; - double dblYLocal = 1.; - double dblYCumulative = 0.; - - for (int i = 1; i < iEnd; ++i) { - i = i + 1; - dblYLocal *= _dblLambda / i; - dblYCumulative += _dblExponentialLambda * dblYLocal; - } - - return dblYCumulative; - } - - @Override public double incremental ( - final double dblXLeft, - final double dblXRight) - throws java.lang.Exception - { - return cumulative (dblXRight) - cumulative (dblXLeft); - } - - @Override public double invCumulative ( - final double dblY) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblY)) - throw new java.lang.Exception ("PoissonDistribution::invCumulative => Invalid inputs"); - - int i = 0; - double dblYLocal = 1.; - double dblYCumulative = 0.; - - while (dblYCumulative < dblY) { - i = i + 1; - dblYLocal *= _dblLambda / i; - dblYCumulative += _dblExponentialLambda * dblYLocal; - } - - return i - 1; - } - - @Override public double density ( - final double dblX) - throws java.lang.Exception - { - throw new java.lang.Exception - ("PoissonDistribution::density => Not available for discrete distributions"); - } - - @Override public double mean() - { - return _dblLambda; - } - - @Override public double variance() - { - return _dblLambda; - } - - @Override public org.drip.quant.common.Array2D histogram() - { - return null; - } -} diff --git a/org/drip/measure/discretemarginal/SequenceGenerator.java b/org/drip/measure/discretemarginal/SequenceGenerator.java deleted file mode 100644 index 8ecb03d..0000000 --- a/org/drip/measure/discretemarginal/SequenceGenerator.java +++ /dev/null @@ -1,149 +0,0 @@ - -package org.drip.measure.discretemarginal; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * SequenceGenerator generates the specified Univariate Sequence of the Given Distribution Type. - * - * @author Lakshmi Krishnamurthy - */ - -public class SequenceGenerator { - - /** - * Generate a Sequence of Uniform Random Numbers - * - * @param iCount The Count in the Sequence - * - * @return The Sequence of Uniform Random Numbers - */ - - public static final double[] Uniform ( - final int iCount) - { - if (0 >= iCount) return null; - - double[] adblRandom = new double[iCount]; - - for (int i = 0; i < iCount; ++i) - adblRandom[i] = java.lang.Math.random(); - - return adblRandom; - } - - /** - * Generate a Sequence of Gaussian Random Numbers - * - * @param iCount The Count in the Sequence - * - * @return The Sequence of Gaussian Random Numbers - */ - - public static final double[] Gaussian ( - final int iCount) - { - if (0 >= iCount) return null; - - double[] adblRandom = new double[iCount]; - - for (int i = 0; i < iCount; ++i) { - try { - adblRandom[i] = org.drip.measure.gaussian.NormalQuadrature.Random(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return adblRandom; - } - - /** - * Generate a Sequence of R^d Correlated Gaussian Random Numbers - * - * @param iCount The Count in the Sequence - * - * @return The Sequence of R^d Correlated Gaussian Random Numbers - */ - - public static final double[][] GaussianJoint ( - final int iCount, - final double[][] aadblCorrelation) - { - if (0 >= iCount) return null; - - double[][] aadblCholesky = org.drip.quant.linearalgebra.Matrix.CholeskyBanachiewiczFactorization - (aadblCorrelation); - - if (null == aadblCholesky) return null; - - int iDimension = aadblCholesky.length; - double[][] aadblRandom = new double[iCount][]; - - for (int k = 0; k < iCount; ++k) { - double[] adblUncorrelatedRandom = Gaussian (iDimension); - - if (null == adblUncorrelatedRandom || iDimension != adblUncorrelatedRandom.length) return null; - - double[] adblCorrelatedRandom = new double[iDimension]; - - for (int i = 0; i < iDimension; ++i) { - adblCorrelatedRandom[i] = 0.; - - for (int j = 0; j < iDimension; ++j) - adblCorrelatedRandom[i] += aadblCholesky[i][j] * adblUncorrelatedRandom[j]; - } - - aadblRandom[k] = adblCorrelatedRandom; - } - - return aadblRandom; - } -} diff --git a/org/drip/measure/dynamics/DiffusionEvaluator.java b/org/drip/measure/dynamics/DiffusionEvaluator.java deleted file mode 100644 index d8b4508..0000000 --- a/org/drip/measure/dynamics/DiffusionEvaluator.java +++ /dev/null @@ -1,98 +0,0 @@ - -package org.drip.measure.dynamics; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * DiffusionEvaluator implements the Drift/Volatility Evaluators for R^1 Random Diffusion Process. - * - * @author Lakshmi Krishnamurthy - */ - -public class DiffusionEvaluator { - private org.drip.measure.dynamics.LocalEvaluator _leDrift = null; - private org.drip.measure.dynamics.LocalEvaluator _leVolatility = null; - - /** - * DiffusionEvaluator Constructor - * - * @param leDrift The Drift Evaluator - * @param leVolatility The Volatility Evaluator - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public DiffusionEvaluator ( - final org.drip.measure.dynamics.LocalEvaluator leDrift, - final org.drip.measure.dynamics.LocalEvaluator leVolatility) - throws java.lang.Exception - { - if (null == (_leDrift = leDrift) || null == (_leVolatility = leVolatility)) - throw new java.lang.Exception ("DiffusionEvaluator Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Drift Evaluator - * - * @return The Drift Evaluator - */ - - public org.drip.measure.dynamics.LocalEvaluator drift() - { - return _leDrift; - } - - /** - * Retrieve the Volatility Evaluator - * - * @return The Volatility Evaluator - */ - - public org.drip.measure.dynamics.LocalEvaluator volatility() - { - return _leVolatility; - } -} diff --git a/org/drip/measure/dynamics/DiffusionEvaluatorLinear.java b/org/drip/measure/dynamics/DiffusionEvaluatorLinear.java deleted file mode 100644 index 8ef86e4..0000000 --- a/org/drip/measure/dynamics/DiffusionEvaluatorLinear.java +++ /dev/null @@ -1,136 +0,0 @@ - -package org.drip.measure.dynamics; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * DiffusionEvaluatorLinear implements the Linear Drift and Volatility Evaluators for R^1 Random Diffusion - * Process. - * - * @author Lakshmi Krishnamurthy - */ - -public class DiffusionEvaluatorLinear extends org.drip.measure.dynamics.DiffusionEvaluator { - private double _dblDrift = java.lang.Double.NaN; - private double _dblVolatility = java.lang.Double.NaN; - - /** - * Generate a Standard Instance of DiffusionEvaluatorLinear - * - * @param dblDrift The Drift - * @param dblVolatility The Volatility - * - * @return The Standard Instance of DiffusionEvaluatorLinear - */ - - public static final DiffusionEvaluatorLinear Standard ( - final double dblDrift, - final double dblVolatility) - { - org.drip.measure.dynamics.LocalEvaluator leDrift = new org.drip.measure.dynamics.LocalEvaluator() { - @Override public double value ( - final org.drip.measure.realization.JumpDiffusionVertex jdv) - throws java.lang.Exception - { - return dblDrift; - } - }; - - org.drip.measure.dynamics.LocalEvaluator leVolatility = new - org.drip.measure.dynamics.LocalEvaluator() { - @Override public double value ( - final org.drip.measure.realization.JumpDiffusionVertex jdv) - throws java.lang.Exception - { - return dblVolatility; - } - }; - - try { - return new DiffusionEvaluatorLinear (dblDrift, dblVolatility, leDrift, leVolatility); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private DiffusionEvaluatorLinear ( - final double dblDrift, - final double dblVolatility, - final org.drip.measure.dynamics.LocalEvaluator leDrift, - final org.drip.measure.dynamics.LocalEvaluator leVolatility) - throws java.lang.Exception - { - super (leDrift, leVolatility); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblDrift = dblDrift) || - !org.drip.quant.common.NumberUtil.IsValid (_dblVolatility = dblVolatility)) - throw new java.lang.Exception ("DiffusionEvaluatorLinear Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Linear Drift Value - * - * @return The Linear Drift Value - */ - - public double driftValue() - { - return _dblDrift; - } - - /** - * Retrieve the Linear Volatility Value - * - * @return The Linear Volatility Value - */ - - public double volatilityValue() - { - return _dblVolatility; - } -} diff --git a/org/drip/measure/dynamics/DiffusionEvaluatorLogarithmic.java b/org/drip/measure/dynamics/DiffusionEvaluatorLogarithmic.java deleted file mode 100644 index 2f41f14..0000000 --- a/org/drip/measure/dynamics/DiffusionEvaluatorLogarithmic.java +++ /dev/null @@ -1,144 +0,0 @@ - -package org.drip.measure.dynamics; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * DiffusionEvaluatorLogarithmic evaluates the Drift/Volatility of the Diffusion Random Variable Evolution - * according to R^1 Logarithmic Process. - * - * @author Lakshmi Krishnamurthy - */ - -public class DiffusionEvaluatorLogarithmic extends org.drip.measure.dynamics.DiffusionEvaluator { - private double _dblDrift = java.lang.Double.NaN; - private double _dblVolatility = java.lang.Double.NaN; - - /** - * Generate a Standard Instance of DiffusionEvaluatorLogarithmic - * - * @param dblDrift The Drift - * @param dblVolatility The Volatility - * - * @return The Standard Instance of DiffusionEvaluatorLogarithmic - */ - - public static final DiffusionEvaluatorLogarithmic Standard ( - final double dblDrift, - final double dblVolatility) - { - org.drip.measure.dynamics.LocalEvaluator leDrift = new org.drip.measure.dynamics.LocalEvaluator() { - @Override public double value ( - final org.drip.measure.realization.JumpDiffusionVertex jdv) - throws java.lang.Exception - { - if (null == jdv) - throw new java.lang.Exception - ("DiffusionEvaluatorLogarithmic::DriftEvaluator::value => Invalid Inputs"); - - return jdv.value() * dblDrift; - } - }; - - org.drip.measure.dynamics.LocalEvaluator leVolatility = new - org.drip.measure.dynamics.LocalEvaluator() { - @Override public double value ( - final org.drip.measure.realization.JumpDiffusionVertex jdv) - throws java.lang.Exception - { - if (null == jdv) - throw new java.lang.Exception - ("DiffusionEvaluatorLogarithmic::volatilityEvaluator::value => Invalid Inputs"); - - return jdv.value() * dblVolatility; - } - }; - - try { - return new DiffusionEvaluatorLogarithmic (dblDrift, dblVolatility, leDrift, leVolatility); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private DiffusionEvaluatorLogarithmic ( - final double dblDrift, - final double dblVolatility, - final org.drip.measure.dynamics.LocalEvaluator leDrift, - final org.drip.measure.dynamics.LocalEvaluator leVolatility) - throws java.lang.Exception - { - super (leDrift, leVolatility); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblDrift = dblDrift) || - !org.drip.quant.common.NumberUtil.IsValid (_dblVolatility = dblVolatility)) - throw new java.lang.Exception ("DiffusionEvaluatorLogarithmic Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Logarithmic Drift Value - * - * @return The Logarithmic Drift Value - */ - - public double driftValue() - { - return _dblDrift; - } - - /** - * Retrieve the Logarithmic Volatility Value - * - * @return The Logarithmic Volatility Value - */ - - public double volatilityValue() - { - return _dblVolatility; - } -} diff --git a/org/drip/measure/dynamics/DiffusionEvaluatorMeanReversion.java b/org/drip/measure/dynamics/DiffusionEvaluatorMeanReversion.java deleted file mode 100644 index 95af5e5..0000000 --- a/org/drip/measure/dynamics/DiffusionEvaluatorMeanReversion.java +++ /dev/null @@ -1,157 +0,0 @@ - -package org.drip.measure.dynamics; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * DiffusionEvaluatorMeanReversion evaluates the Drift/Volatility of the Diffusion Random Variable Evolution - * according to R^1 Mean Reversion Process. - * - * @author Lakshmi Krishnamurthy - */ - -public class DiffusionEvaluatorMeanReversion extends org.drip.measure.dynamics.DiffusionEvaluator { - private double _dblVolatility = java.lang.Double.NaN; - private double _dblMeanReversionRate = java.lang.Double.NaN; - private double _dblMeanReversionLevel = java.lang.Double.NaN; - - /** - * Generate a Standard Instance of DiffusionEvaluatorMeanReversion - * - * @param dblMeanReversionRate The Mean Reversion Rate - * @param dblMeanReversionLevel The Mean Reversion Level - * @param dblVolatility The Volatility - * - * @return The Standard Instance of DiffusionEvaluatorMeanReversion - */ - - public static final DiffusionEvaluatorMeanReversion Standard ( - final double dblMeanReversionRate, - final double dblMeanReversionLevel, - final double dblVolatility) - { - org.drip.measure.dynamics.LocalEvaluator leDrift = new org.drip.measure.dynamics.LocalEvaluator() { - @Override public double value ( - final org.drip.measure.realization.JumpDiffusionVertex jdv) - throws java.lang.Exception - { - if (null == jdv) - throw new java.lang.Exception - ("DiffusionEvaluatorMeanReversion::driftEvaluator::value => Invalid Inputs"); - - return -1. * dblMeanReversionRate * (dblMeanReversionLevel - jdv.value()); - } - }; - - org.drip.measure.dynamics.LocalEvaluator leVolatility = new - org.drip.measure.dynamics.LocalEvaluator() { - @Override public double value ( - final org.drip.measure.realization.JumpDiffusionVertex jdv) - throws java.lang.Exception - { - return dblVolatility; - } - }; - - try { - return new DiffusionEvaluatorMeanReversion (dblMeanReversionRate, dblMeanReversionLevel, - dblVolatility, leDrift, leVolatility); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private DiffusionEvaluatorMeanReversion ( - final double dblMeanReversionRate, - final double dblMeanReversionLevel, - final double dblVolatility, - final org.drip.measure.dynamics.LocalEvaluator leDrift, - final org.drip.measure.dynamics.LocalEvaluator leVolatility) - throws java.lang.Exception - { - super (leDrift, leVolatility); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblMeanReversionRate = dblMeanReversionRate) || - !org.drip.quant.common.NumberUtil.IsValid (_dblMeanReversionLevel = dblMeanReversionLevel) || - !org.drip.quant.common.NumberUtil.IsValid (_dblVolatility = dblVolatility)) - throw new java.lang.Exception ("DiffusionEvaluatorMeanReversion Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Mean Reversion Speed - * - * @return The Mean Reversion Speed - */ - - public double meanReversionRate() - { - return _dblMeanReversionRate; - } - - /** - * Retrieve the Mean Reversion Level - * - * @return The Mean Reversion Level - */ - - public double meanReversionLevel() - { - return _dblMeanReversionLevel; - } - - /** - * Retrieve the Logarithmic Volatility Value - * - * @return The Logarithmic Volatility Value - */ - - public double volatilityValue() - { - return _dblVolatility; - } -} diff --git a/org/drip/measure/dynamics/DiffusionEvaluatorOrnsteinUhlenbeck.java b/org/drip/measure/dynamics/DiffusionEvaluatorOrnsteinUhlenbeck.java deleted file mode 100644 index ada7f4e..0000000 --- a/org/drip/measure/dynamics/DiffusionEvaluatorOrnsteinUhlenbeck.java +++ /dev/null @@ -1,191 +0,0 @@ - -package org.drip.measure.dynamics; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * DiffusionEvaluatorOrnsteinUhlenbeck evaluates the Drift/Volatility of the Diffusion Random Variable - * Evolution according to R^1 Ornstein Uhlenbeck Process. - * - * @author Lakshmi Krishnamurthy - */ - -public class DiffusionEvaluatorOrnsteinUhlenbeck extends org.drip.measure.dynamics.DiffusionEvaluator - implements org.drip.measure.process.OrnsteinUhlenbeck { - private double _dblBurstiness = java.lang.Double.NaN; - private double _dblRelaxationTime = java.lang.Double.NaN; - private double _dblMeanReversionLevel = java.lang.Double.NaN; - - /** - * Construct a Standard Instance of DiffusionEvaluatorOrnsteinUhlenbeck - * - * @param dblMeanReversionLevel The Mean Reversion Level - * @param dblBurstiness The Burstiness Parameter - * @param dblRelaxationTime The Relaxation Time - * - * @return The Standard Instance of DiffusionEvaluatorOrnsteinUhlenbeck - */ - - public static final DiffusionEvaluatorOrnsteinUhlenbeck Standard ( - final double dblMeanReversionLevel, - final double dblBurstiness, - final double dblRelaxationTime) - { - org.drip.measure.dynamics.LocalEvaluator leDrift = new org.drip.measure.dynamics.LocalEvaluator() { - @Override public double value ( - final org.drip.measure.realization.JumpDiffusionVertex jdv) - throws java.lang.Exception - { - if (null == jdv) - throw new java.lang.Exception - ("DiffusionEvaluatorOrnsteinUhlenbeck::DriftLDEV::value => Invalid Inputs"); - - return -1. * jdv.value() / dblRelaxationTime; - } - }; - - org.drip.measure.dynamics.LocalEvaluator leVolatility = new - org.drip.measure.dynamics.LocalEvaluator() { - @Override public double value ( - final org.drip.measure.realization.JumpDiffusionVertex jdv) - throws java.lang.Exception - { - return dblBurstiness * java.lang.Math.sqrt (1. / dblRelaxationTime); - } - }; - - try { - return new DiffusionEvaluatorOrnsteinUhlenbeck (dblMeanReversionLevel, dblBurstiness, - dblRelaxationTime, leDrift, leVolatility); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Zero-Mean Instance of DiffusionEvaluatorOrnsteinUhlenbeck - * - * @param dblBurstiness The Burstiness Parameter - * @param dblRelaxationTime The Relaxation Time - * - * @return The Zero-Mean Instance of DiffusionEvaluatorOrnsteinUhlenbeck - */ - - public static final DiffusionEvaluatorOrnsteinUhlenbeck ZeroMean ( - final double dblBurstiness, - final double dblRelaxationTime) - { - return Standard (0., dblBurstiness, dblRelaxationTime); - } - - private DiffusionEvaluatorOrnsteinUhlenbeck ( - final double dblMeanReversionLevel, - final double dblBurstiness, - final double dblRelaxationTime, - final org.drip.measure.dynamics.LocalEvaluator leDrift, - final org.drip.measure.dynamics.LocalEvaluator leVolatility) - throws java.lang.Exception - { - super (leDrift, leVolatility); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblMeanReversionLevel = dblMeanReversionLevel) || - !org.drip.quant.common.NumberUtil.IsValid (_dblBurstiness = dblBurstiness) || 0. >= - _dblBurstiness || !org.drip.quant.common.NumberUtil.IsValid (_dblRelaxationTime = - dblRelaxationTime) || 0. >= _dblRelaxationTime) - throw new java.lang.Exception - ("DiffusionEvaluatorOrnsteinUhlenbeck Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Mean Reversion Level - * - * @return The Mean Reversion Level - */ - - public double meanReversionLevel() - { - return _dblMeanReversionLevel; - } - - /** - * Retrieve the Burstiness Parameter - * - * @return The Burstiness Parameter - */ - - public double burstiness() - { - return _dblBurstiness; - } - - /** - * Retrieve the Relaxation Time - * - * @return The Relaxation Time - */ - - public double relaxationTime() - { - return _dblRelaxationTime; - } - - @Override public double referenceRelaxationTime() - { - return relaxationTime(); - } - - @Override public double referenceBurstiness() - { - return burstiness(); - } - - @Override public double referenceMeanReversionLevel() - { - return meanReversionLevel(); - } -} diff --git a/org/drip/measure/dynamics/HazardJumpEvaluator.java b/org/drip/measure/dynamics/HazardJumpEvaluator.java deleted file mode 100644 index ea4554c..0000000 --- a/org/drip/measure/dynamics/HazardJumpEvaluator.java +++ /dev/null @@ -1,138 +0,0 @@ - -package org.drip.measure.dynamics; - - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * HazardJumpEvaluator implements the Hazard Jump Process Point Event Indication Evaluator that guides the - * Single Factor Jump-Termination Random Process Variable Evolution. - * - * @author Lakshmi Krishnamurthy - */ - -public class HazardJumpEvaluator extends org.drip.measure.dynamics.SingleJumpEvaluator { - private double _dblMagnitude = java.lang.Double.NaN; - private double _dblHazardRate = java.lang.Double.NaN; - - /** - * Generate a Standard Instance of HazardJumpEvaluator - * - * @param dblHazardRate The Hazard Rate - * @param dblMagnitude The Magnitude - * - * @return The Standard Instance of HazardJumpEvaluator - */ - - public static final HazardJumpEvaluator Standard ( - final double dblHazardRate, - final double dblMagnitude) - { - org.drip.measure.dynamics.LocalEvaluator leDensity = new org.drip.measure.dynamics.LocalEvaluator() { - @Override public double value ( - final org.drip.measure.realization.JumpDiffusionVertex jdv) - throws java.lang.Exception - { - return -1. * dblHazardRate * java.lang.Math.exp (-1. * dblHazardRate); - } - }; - - org.drip.measure.dynamics.LocalEvaluator leMagnitude = new org.drip.measure.dynamics.LocalEvaluator() - { - @Override public double value ( - final org.drip.measure.realization.JumpDiffusionVertex jdv) - throws java.lang.Exception - { - return dblMagnitude; - } - }; - - try { - return new HazardJumpEvaluator (dblHazardRate, dblMagnitude, leDensity, leMagnitude); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private HazardJumpEvaluator ( - final double dblHazardRate, - final double dblMagnitude, - final org.drip.measure.dynamics.LocalEvaluator leDensity, - final org.drip.measure.dynamics.LocalEvaluator leMagnitude) - throws java.lang.Exception - { - super (leDensity, leMagnitude); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblHazardRate = dblHazardRate) || 0. > _dblHazardRate - || !org.drip.quant.common.NumberUtil.IsValid (_dblMagnitude = dblMagnitude) || 0. > - _dblMagnitude) - throw new java.lang.Exception ("HazardJumpEvaluator Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Hazard Rate - * - * @return The Hazard Rate - */ - - public double hazardRate() - { - return _dblHazardRate; - } - - /** - * Retrieve the Magnitude - * - * @return The Magnitude - */ - - public double magnitude() - { - return _dblMagnitude; - } -} diff --git a/org/drip/measure/dynamics/LocalEvaluator.java b/org/drip/measure/dynamics/LocalEvaluator.java deleted file mode 100644 index 9754d5d..0000000 --- a/org/drip/measure/dynamics/LocalEvaluator.java +++ /dev/null @@ -1,70 +0,0 @@ - -package org.drip.measure.dynamics; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * LocalEvaluator exposes the Random Evolution's Local/Deterministic Evaluators. - * - * @author Lakshmi Krishnamurthy - */ - -public interface LocalEvaluator { - - /** - * Determine the Value of the Evolution Function from the given Random Variate and Time - * - * @param jdv The Realized Diffusion Vertex - * - * @return The Value of the Evolution Function - * - * @throws java.lang.Exception Thrown if the Value cannot be evaluated - */ - - public abstract double value ( - final org.drip.measure.realization.JumpDiffusionVertex jdv) - throws java.lang.Exception; -} diff --git a/org/drip/measure/dynamics/SingleJumpEvaluator.java b/org/drip/measure/dynamics/SingleJumpEvaluator.java deleted file mode 100644 index cab49e3..0000000 --- a/org/drip/measure/dynamics/SingleJumpEvaluator.java +++ /dev/null @@ -1,99 +0,0 @@ - -package org.drip.measure.dynamics; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * SingleJumpEvaluator implements the Single Point Jump Event Indication Evaluator that guides the One Factor - * Jump Random Process Variable Evolution. - * - * @author Lakshmi Krishnamurthy - */ - -public class SingleJumpEvaluator { - private org.drip.measure.dynamics.LocalEvaluator _leDensity = null; - private org.drip.measure.dynamics.LocalEvaluator _leMagnitude = null; - - /** - * SingleJumpEvaluator Constructor - * - * @param leDensity The Jump Density Evaluator - * @param leMagnitude The Jump Magnitude Evaluator - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public SingleJumpEvaluator ( - final org.drip.measure.dynamics.LocalEvaluator leDensity, - final org.drip.measure.dynamics.LocalEvaluator leMagnitude) - throws java.lang.Exception - { - if (null == (_leDensity = leDensity) || null == (_leMagnitude = leMagnitude)) - throw new java.lang.Exception ("SingleJumpEvaluator Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Jump Density Evaluator - * - * @return The Jump Density Evaluator - */ - - public org.drip.measure.dynamics.LocalEvaluator densityEvaluator() - { - return _leDensity; - } - - /** - * Retrieve the Jump Magnitude Evaluator - * - * @return The Jump Magnitude Evaluator - */ - - public org.drip.measure.dynamics.LocalEvaluator magnitudeEvaluator() - { - return _leMagnitude; - } -} diff --git a/org/drip/measure/gaussian/Covariance.java b/org/drip/measure/gaussian/Covariance.java deleted file mode 100644 index 61e44db..0000000 --- a/org/drip/measure/gaussian/Covariance.java +++ /dev/null @@ -1,178 +0,0 @@ - -package org.drip.measure.gaussian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * Covariance holds the Standard Covariance Matrix, and provides functions to manipulate it. - * - * @author Lakshmi Krishnamurthy - */ - -public class Covariance { - private double[][] _aadblPrecision = null; - private double[][] _aadblCovariance = null; - - /** - * Covariance Constructor - * - * @param aadblCovariance Double Array of the Covariance Matrix - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public Covariance ( - final double[][] aadblCovariance) - throws java.lang.Exception - { - if (null == (_aadblCovariance = aadblCovariance)) - throw new java.lang.Exception ("Covariance Constructor => Invalid Inputs!"); - - int iNumVariate = _aadblCovariance.length; - - if (0 == iNumVariate) - throw new java.lang.Exception ("R1MultivariateNormal Constructor => Invalid Inputs!"); - - for (int i = 0; i < iNumVariate; ++i) { - if (null == _aadblCovariance[i] || iNumVariate != _aadblCovariance[i].length || - !org.drip.quant.common.NumberUtil.IsValid (_aadblCovariance[i])) - throw new java.lang.Exception ("R1MultivariateNormal Constructor => Invalid Inputs!"); - } - - if (null == (_aadblPrecision = org.drip.quant.linearalgebra.Matrix.InvertUsingGaussianElimination - (_aadblCovariance))) - throw new java.lang.Exception ("R1MultivariateNormal Constructor => Invalid Inputs!"); - } - - /** - * Retrieve the Number of Variates - * - * @return The Number of Variates - */ - - public int numVariate() - { - return _aadblCovariance.length; - } - - /** - * Retrieve the Covariance Matrix - * - * @return The Covariance Matrix - */ - - public double[][] covarianceMatrix() - { - return _aadblCovariance; - } - - /** - * Retrieve the Precision Matrix - * - * @return The Precision Matrix - */ - - public double[][] precisionMatrix() - { - return _aadblPrecision; - } - - /** - * Retrieve the Variance Array - * - * @return The Variance Array - */ - - public double[] variance() - { - int iNumVariate = _aadblCovariance.length; - double[] adblVariance = new double[iNumVariate]; - - for (int i = 0; i < iNumVariate; ++i) - adblVariance[i] = _aadblCovariance[i][i]; - - return adblVariance; - } - - /** - * Retrieve the Volatility Array - * - * @return The Volatility Array - */ - - public double[] volatility() - { - int iNumVariate = _aadblCovariance.length; - double[] adblVolatility = new double[iNumVariate]; - - for (int i = 0; i < iNumVariate; ++i) - adblVolatility[i] = java.lang.Math.sqrt (_aadblCovariance[i][i]); - - return adblVolatility; - } - - /** - * Retrieve the Correlation Matrix - * - * @return The Correlation Matrix - */ - - public double[][] correlationMatrix() - { - int iNumVariate = _aadblCovariance.length; - double[][] aadblCorrelation = new double[iNumVariate][iNumVariate]; - - double[] adblVolatility = volatility(); - - for (int i = 0; i < iNumVariate; ++i) { - for (int j = 0; j < iNumVariate; ++j) - aadblCorrelation[i][j] = _aadblCovariance[i][j] / (adblVolatility[i] * adblVolatility[j]); - } - - return aadblCorrelation; - } -} diff --git a/org/drip/measure/gaussian/NormalQuadrature.java b/org/drip/measure/gaussian/NormalQuadrature.java deleted file mode 100644 index 9ad8e41..0000000 --- a/org/drip/measure/gaussian/NormalQuadrature.java +++ /dev/null @@ -1,161 +0,0 @@ - -package org.drip.measure.gaussian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2011 Robert Sedgewick - * - * 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. - */ - -/** - * NormalQuadrature implements the Quadrature Metrics behind the Univariate Normal Distribution. It - * implements the Incremental, the Cumulative, and the Inverse Cumulative Distribution Densities. - * - * @author Robert Sedgewick - */ - -public class NormalQuadrature { - private static final double InverseCDF ( - final double dblY, - final double dblTolerance, - final double dblLowCutoff, - final double dblHighCutoff) - throws java.lang.Exception - { - double dblMid = 0.5 * (dblHighCutoff + dblLowCutoff); - - if (dblHighCutoff - dblLowCutoff < dblTolerance) return dblMid; - - return CDF (dblMid) > dblY ? InverseCDF (dblY, dblTolerance, dblLowCutoff, dblMid) : InverseCDF - (dblY, dblTolerance, dblMid, dblHighCutoff); - } - - /** - * Retrieve the Density at the specified Point using Zero Mean and Unit Variance - * - * @param dblX The Ordinate - * - * @return The Density at the specified Point Zero Mean and Unit Variance - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public static final double Density ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception ("NormalQuadrature::Density => Invalid Inputs"); - - return java.lang.Math.exp (-0.5 * dblX * dblX) / java.lang.Math.sqrt (2 * java.lang.Math.PI); - } - - /** - * Compute the Cumulative Distribution Function up to the specified variate - * - * @param dblX The Variate - * - * @return The Cumulative Distribution Function up to the specified variate - * - * @throws java.lang.Exception thrown if the Inputs are Invalid - */ - - public static final double CDF ( - final double dblX) - throws java.lang.Exception - { - if (java.lang.Double.isNaN (dblX)) - throw new java.lang.Exception ("NormalQuadrature::CDF => Invalid Inputs"); - - if (dblX < -8.) return 0.; - - if (dblX > 8.) return 1.; - - double dblSum = 0.; - double dblTerm = dblX; - - for (int i = 3; dblSum + dblTerm != dblSum; i += 2) { - dblSum = dblSum + dblTerm; - dblTerm = dblTerm * dblX * dblX / i; - } - - return 0.5 + dblSum * Density (dblX); - } - - /** - * Compute the Inverse CDF of the Distribution up to the specified Y - * - * @param dblY Y - * - * @return The Inverse CDF of the Distribution up to the specified Y - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public static final double InverseCDF ( - final double dblY) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblY)) - throw new java.lang.Exception ("NormalQuadrature::InverseCDF => Invalid Inputs"); - - return InverseCDF (dblY, .00000001, -8., 8.); - } - - /** - * Generate a Random Univariate Number following a Gaussian Distribution - * - * @return The Random Univariate Number - * - * @throws java.lang.Exception Thrown the Random Number cannot be generated - */ - - public static final double Random() - throws java.lang.Exception - { - return InverseCDF (java.lang.Math.random()); - } -} diff --git a/org/drip/measure/gaussian/R1MultivariateNormal.java b/org/drip/measure/gaussian/R1MultivariateNormal.java deleted file mode 100644 index 35fff1b..0000000 --- a/org/drip/measure/gaussian/R1MultivariateNormal.java +++ /dev/null @@ -1,192 +0,0 @@ - -package org.drip.measure.gaussian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * R1MultivariateNormal contains the Generalized Joint Multivariate R^1 Normal Distributions. - * - * @author Lakshmi Krishnamurthy - */ - -public class R1MultivariateNormal extends org.drip.measure.continuousjoint.R1Multivariate { - private double[] _adblMean = null; - private org.drip.measure.gaussian.Covariance _covariance = null; - - /** - * Construct a Standard R1MultivariateNormal Instance - * - * @param meta The R^1 Multivariate Meta Headers - * @param adblMean Array of the Univariate Means - * @param aadblCovariance The Covariance Matrix - * - * @return The Standard Normal Univariate Distribution - */ - - public static final R1MultivariateNormal Standard ( - final org.drip.measure.continuousjoint.MultivariateMeta meta, - final double[] adblMean, - final double[][] aadblCovariance) - { - try { - return new R1MultivariateNormal (meta, adblMean, new org.drip.measure.gaussian.Covariance - (aadblCovariance)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Standard R1MultivariateNormal Instance - * - * @param astrVariateID Array of Variate IDs - * @param adblMean Array of the Univariate Means - * @param aadblCovariance The Covariance Matrix - * - * @return The Standard Normal Univariate Distribution - */ - - public static final R1MultivariateNormal Standard ( - final java.lang.String[] astrVariateID, - final double[] adblMean, - final double[][] aadblCovariance) - { - try { - return new R1MultivariateNormal (new org.drip.measure.continuousjoint.MultivariateMeta - (astrVariateID), adblMean, new org.drip.measure.gaussian.Covariance (aadblCovariance)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * R1MultivariateNormal Constructor - * - * @param meta The R^1 Multivariate Meta Headers - * @param adblMean Array of the Univariate Means - * @param covariance The Multivariate Covariance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public R1MultivariateNormal ( - final org.drip.measure.continuousjoint.MultivariateMeta meta, - final double[] adblMean, - final org.drip.measure.gaussian.Covariance covariance) - throws java.lang.Exception - { - super (meta); - - if (null == (_adblMean = adblMean) || null == (_covariance = covariance)) - throw new java.lang.Exception ("R1MultivariateNormal Constructor => Invalid Inputs!"); - - int iNumVariate = meta.numVariable(); - - if (iNumVariate != _adblMean.length || iNumVariate != _covariance.numVariate() || - !org.drip.quant.common.NumberUtil.IsValid (_adblMean)) { - System.out.println ("iNumVariate = " + iNumVariate); - - System.out.println ("_adblMean = " + _adblMean.length); - - throw new java.lang.Exception ("R1MultivariateNormal Constructor => Invalid Inputs!"); - } - } - - /** - * Compute the Co-variance of the Distribution - * - * @return The Co-variance of the Distribution - */ - - public org.drip.measure.gaussian.Covariance covariance() - { - return _covariance; - } - - @Override public double density ( - final double[] adblVariate) - throws java.lang.Exception - { - if (null == adblVariate || !org.drip.quant.common.NumberUtil.IsValid (adblVariate)) - throw new java.lang.Exception ("R1MultivariateNormal::density => Invalid Inputs"); - - double dblDensity = 0.; - int iNumVariate = _adblMean.length; - double[] adblVariateOffset = new double[iNumVariate]; - - if (iNumVariate != adblVariate.length) - throw new java.lang.Exception ("R1MultivariateNormal Constructor => Invalid Inputs!"); - - for (int i = 0; i < iNumVariate; ++i) - adblVariateOffset[i] = adblVariate[i] - _adblMean[i]; - - double[][] aadblPrecision = _covariance.precisionMatrix(); - - for (int i = 0; i < iNumVariate; ++i) { - for (int j = 0; j < iNumVariate; ++j) - dblDensity = dblDensity + adblVariateOffset[i] * aadblPrecision[i][j] * - adblVariateOffset[j]; - } - - return java.lang.Math.exp (dblDensity) * java.lang.Math.pow (2. * java.lang.Math.PI, -0.5 * - iNumVariate); - } - - @Override public double[] mean() - { - return _adblMean; - } - - @Override public double[] variance() - { - return _covariance.variance(); - } -} diff --git a/org/drip/measure/gaussian/R1UnivariateNormal.java b/org/drip/measure/gaussian/R1UnivariateNormal.java deleted file mode 100644 index eb6fa16..0000000 --- a/org/drip/measure/gaussian/R1UnivariateNormal.java +++ /dev/null @@ -1,218 +0,0 @@ - -package org.drip.measure.gaussian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * R1UnivariateNormal implements the Univariate R^1 Normal Distribution. It implements the Incremental, the - * Cumulative, and the Inverse Cumulative Distribution Densities. - * - * @author Lakshmi Krishnamurthy - */ - -public class R1UnivariateNormal extends org.drip.measure.continuousmarginal.R1 { - private double _dblMean = java.lang.Double.NaN; - private double _dblSigma = java.lang.Double.NaN; - - /** - * Generate a N (0, 1) distribution - * - * @return The N (0, 1) distribution - */ - - public static final org.drip.measure.gaussian.R1UnivariateNormal Standard() - { - try { - return new R1UnivariateNormal (0., 1.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a R1 Normal/Gaussian Distribution - * - * @param dblMean Mean of the Distribution - * @param dblSigma Sigma of the Distribution - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public R1UnivariateNormal ( - final double dblMean, - final double dblSigma) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblMean = dblMean) || - !org.drip.quant.common.NumberUtil.IsValid (_dblSigma = dblSigma) || 0. > _dblSigma) - throw new java.lang.Exception ("R1UnivariateNormal Constructor: Invalid Inputs"); - } - - @Override public double cumulative ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception ("R1UnivariateNormal::cumulative => Invalid Inputs"); - - if (0. == _dblSigma) return dblX >= _dblMean ? 1. : 0.; - - return org.drip.measure.gaussian.NormalQuadrature.CDF ((dblX - _dblMean) / _dblSigma); - } - - @Override public double incremental ( - final double dblXLeft, - final double dblXRight) - throws java.lang.Exception - { - return cumulative (dblXRight) - cumulative (dblXLeft); - } - - @Override public double invCumulative ( - final double dblY) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblY) || 0. == _dblSigma) - throw new java.lang.Exception ("R1UnivariateNormal::invCumulative => Cannot calculate"); - - return org.drip.measure.gaussian.NormalQuadrature.InverseCDF (dblY) * _dblSigma + _dblMean; - } - - @Override public double density ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception ("R1UnivariateNormal::density => Invalid Inputs"); - - if (0. == _dblSigma) return dblX == _dblMean ? 1. : 0.; - - double dblMeanShift = (dblX - _dblMean) / _dblSigma; - - return java.lang.Math.exp (-0.5 * dblMeanShift * dblMeanShift); - } - - @Override public double mean() - { - return _dblMean; - } - - @Override public double variance() - { - return _dblSigma * _dblSigma; - } - - @Override public org.drip.quant.common.Array2D histogram() - { - return null; - } - - /** - * Compute the Error Function Around an Absolute Width around the Mean - * - * @param dblX The Width - * - * @return The Error Function Around an Absolute Width around the Mean - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double errorFunction ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception ("R1UnivariateNormal::errorFunction => Invalid Inputs"); - - double dblWidth = java.lang.Math.abs (dblX); - - return cumulative (_dblMean + dblWidth) - cumulative (_dblMean - dblWidth); - } - - /** - * Compute the Confidence given the Width around the Mean - * - * @param dblWidth The Width - * - * @return The Error Function Around an Absolute Width around the Mean - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double confidence ( - final double dblWidth) - throws java.lang.Exception - { - return errorFunction (dblWidth); - } - - /** - * Compute the Width around the Mean given the Confidence Level - * - * @param dblConfidence The Confidence Level - * - * @return The Width around the Mean given the Confidence Level - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double confidenceInterval ( - final double dblConfidence) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblConfidence) || 0. >= dblConfidence || 1. <= - dblConfidence) - throw new java.lang.Exception ("R1UnivariateNormal::confidenceInterval => Invalid Inputs"); - - return invCumulative (0.5 * (1. + dblConfidence)); - } -} diff --git a/org/drip/measure/joint/Evolver.java b/org/drip/measure/joint/Evolver.java deleted file mode 100644 index caccffc..0000000 --- a/org/drip/measure/joint/Evolver.java +++ /dev/null @@ -1,150 +0,0 @@ - -package org.drip.measure.joint; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * Evolver exposes the Functionality that guides the Multi-Factor Random Process Variable Evolution. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class Evolver { - private double[][] _aadblCorrelation = null; - private org.drip.measure.dynamics.LocalEvaluator[] _aLDEVDrift = null; - private org.drip.measure.dynamics.LocalEvaluator[] _aLDEVVolatility = null; - - protected Evolver ( - final org.drip.measure.dynamics.LocalEvaluator[] aLDEVDrift, - final org.drip.measure.dynamics.LocalEvaluator[] aLDEVVolatility, - final double[][] aadblCorrelation) - throws java.lang.Exception - { - if (null == (_aLDEVDrift = aLDEVDrift) || null == (_aLDEVVolatility = aLDEVVolatility) || null == - (_aadblCorrelation = aadblCorrelation)) - throw new java.lang.Exception ("Evolver Constructor => Invalid Inputs"); - - int iNumFactor = _aLDEVDrift.length; - - if (0 == iNumFactor || iNumFactor != _aLDEVVolatility.length || iNumFactor != - _aadblCorrelation.length) - throw new java.lang.Exception ("Evolver Constructor => Invalid Inputs"); - - for (int i = 0; i < iNumFactor; ++i) { - if (null == _aLDEVDrift[i] || null == _aLDEVVolatility[i] || null == _aadblCorrelation[i] || - iNumFactor != _aadblCorrelation[i].length || !org.drip.quant.common.NumberUtil.IsValid - (_aadblCorrelation[i])) - throw new java.lang.Exception ("Evolver Constructor => Invalid Inputs"); - } - } - - /** - * Retrieve the Array of the LDEV Drift Functions of the Individual Marginal Processes - * - * @return The Array of the LDEV Drift Function of the Individual Marginal Processes - */ - - public org.drip.measure.dynamics.LocalEvaluator[] driftLDEV() - { - return _aLDEVDrift; - } - - /** - * Retrieve the Array of the LDEV Volatility Function of the Individual Marginal Processes - * - * @return The Array of the LDEV Volatility Function of the Individual Marginal Processes - */ - - public org.drip.measure.dynamics.LocalEvaluator[] volatilityLDEV() - { - return _aLDEVVolatility; - } - - /** - * Retrieve the Correlation Matrix - * - * @return The Correlation Matrix - */ - - public double[][] correlation() - { - return _aadblCorrelation; - } - - /** - * Generate the Adjacent Increment from the Array of the specified Random Variate - * - * @param js The Joint Snap - * @param adblRandomVariate The Array of Random Variates - * @param adblRandomUnitRealization The Array of Random Stochastic Realization Variate Units - * @param dblTimeIncrement The Time Increment Evolution Unit - * - * @return The Joint Level Realization - */ - - public abstract org.drip.measure.joint.LevelRealization increment ( - final org.drip.measure.joint.Snap js, - final double[] adblRandomVariate, - final double[] adblRandomUnitRealization, - final double dblTimeIncrement); - - /** - * Generate the Array of the Adjacent Increments from the Array of the specified Random Variate - * - * @param aJS Array of Joint Snap Instances - * @param aadblRandomVariate Array of R^d Variates - * @param aadblRandomUnitRealization Array of R^d Stochastic Realization Units - * @param dblTimeIncrement The Time Increment Evolution Unit - * - * @return Array of the Joint Level Realization - */ - - public abstract org.drip.measure.joint.LevelRealization[][] incrementSequence ( - final org.drip.measure.joint.Snap[] aJS, - final double[][] aadblRandomVariate, - final double[][] aadblRandomUnitRealization, - final double dblTimeIncrement); -} diff --git a/org/drip/measure/joint/LevelRealization.java b/org/drip/measure/joint/LevelRealization.java deleted file mode 100644 index b6b07aa..0000000 --- a/org/drip/measure/joint/LevelRealization.java +++ /dev/null @@ -1,110 +0,0 @@ - -package org.drip.measure.joint; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * LevelRealization implements the Deterministic and the Stochastic Components of a Joint R^1 Random - * Increment. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class LevelRealization { - private org.drip.measure.realization.JumpDiffusionEdge[] _aMLR = null; - - /** - * LevelRealization Constructor - * - * @param aMLR Array of the Marginal Level Realizations - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public LevelRealization ( - final org.drip.measure.realization.JumpDiffusionEdge[] aMLR) - throws java.lang.Exception - { - if (null == (_aMLR = aMLR)) - throw new java.lang.Exception ("LevelRealization Constructor => Invalid Inputs"); - - int iNumVariate = _aMLR.length; - - if (0 == iNumVariate) - throw new java.lang.Exception ("LevelRealization Constructor => Invalid Inputs"); - - for (int i = 0; i < iNumVariate; ++i) { - if (null == _aMLR[i]) - throw new java.lang.Exception ("LevelRealization Constructor => Invalid Inputs"); - } - } - - /** - * Retrieve the Array of the Marginal Level Realizations - * - * @return The Array of the Marginal Level Realizations - */ - - public org.drip.measure.realization.JumpDiffusionEdge[] marginal() - { - return _aMLR; - } -} diff --git a/org/drip/measure/joint/Snap.java b/org/drip/measure/joint/Snap.java deleted file mode 100644 index 282d673..0000000 --- a/org/drip/measure/joint/Snap.java +++ /dev/null @@ -1,99 +0,0 @@ - -package org.drip.measure.joint; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * Snap holds the Snapshot Joint Values of the Realized Joint R^1 Variate and Time. - * - * @author Lakshmi Krishnamurthy - */ - -public class Snap { - private double[] _adblValue = null; - private double _dblTime = java.lang.Double.NaN; - - /** - * Snap Constructor - * - * @param dblTime The Time Instant - * @param adblValue The Realized R^d Variate - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public Snap ( - final double dblTime, - final double[] adblValue) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblTime = dblTime) || null == (_adblValue = - adblValue) || 0 == _adblValue.length || !org.drip.quant.common.NumberUtil.IsValid (_adblValue)) - throw new java.lang.Exception ("Snap Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Evolution Time Instant - * - * @return The Evolution Time Instant - */ - - public double time() - { - return _dblTime; - } - - /** - * Retrieve the Realized R^d Variate - * - * @return The Realized R^d Variate - */ - - public double[] value() - { - return _adblValue; - } -} diff --git a/org/drip/measure/lebesgue/R1PiecewiseDisplaced.java b/org/drip/measure/lebesgue/R1PiecewiseDisplaced.java deleted file mode 100644 index 6f88ac4..0000000 --- a/org/drip/measure/lebesgue/R1PiecewiseDisplaced.java +++ /dev/null @@ -1,328 +0,0 @@ - -package org.drip.measure.lebesgue; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * R1PiecewiseDisplaced implements the Displaced Piecewise Linear R^1 Distributions. It exports the Methods - * corresponding to the R^1 Lebesgue Base Class. - * - * @author Lakshmi Krishnamurthy - */ - -public class R1PiecewiseDisplaced extends org.drip.measure.lebesgue.R1Uniform { - private double[] _adblPredictorOrdinate = null; - private double[] _adblPiecewiseDensitySlope = null; - private double _dblDensityDisplacement = java.lang.Double.NaN; - - /** - * Calibrate an R1PiecewiseDisplaced Lebesgue Instance - * - * @param dblLeftPredictorOrdinateEdge Left Predictor Ordinate Edge - * @param dblRightPredictorOrdinateEdge Right Predictor Ordinate Edge - * @param adblPredictorOrdinate Array of Intermediate Predictor Ordinates - * @param adblCumulativeProbability Array of corresponding Cumulative Probabilities - * @param dblMean The Distribution Mean - * - * @return The R1PiecewiseDisplacedLebesgue Instance - */ - - public static final R1PiecewiseDisplaced Standard ( - final double dblLeftPredictorOrdinateEdge, - final double dblRightPredictorOrdinateEdge, - final double[] adblPredictorOrdinate, - final double[] adblCumulativeProbability, - final double dblMean) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblLeftPredictorOrdinateEdge) || - !org.drip.quant.common.NumberUtil.IsValid (dblRightPredictorOrdinateEdge) || - dblLeftPredictorOrdinateEdge >= dblRightPredictorOrdinateEdge || null == - adblPredictorOrdinate || null == adblCumulativeProbability || - !org.drip.quant.common.NumberUtil.IsValid (dblMean)) - return null; - - int iNumSegment = adblPredictorOrdinate.length + 1; - double[][] aadblM = new double[iNumSegment + 1][iNumSegment + 1]; - double[] adblSecondDegreeIntegral = new double[iNumSegment]; - double[] adblSlope = new double[iNumSegment]; - double[] adblY = new double[iNumSegment + 1]; - adblY[iNumSegment] = dblMean; - aadblM[iNumSegment][iNumSegment] = 0.5 * (dblRightPredictorOrdinateEdge * - dblRightPredictorOrdinateEdge - dblLeftPredictorOrdinateEdge * dblLeftPredictorOrdinateEdge); - - if (1 == iNumSegment || iNumSegment - 1 != adblCumulativeProbability.length) return null; - - for (int i = 0; i < iNumSegment; ++i) { - adblY[i] = i == iNumSegment - 1 ? 1. : adblCumulativeProbability[i]; - double dblSegmentLeft = 0 == i ? dblLeftPredictorOrdinateEdge : adblPredictorOrdinate[i - 1]; - double dblSegmentRight = iNumSegment - 1 == i ? dblRightPredictorOrdinateEdge : - adblPredictorOrdinate[i]; - adblSecondDegreeIntegral[i] = 0.5 * (dblSegmentRight * dblSegmentRight - dblSegmentLeft * - dblSegmentLeft); - aadblM[i][iNumSegment] = dblSegmentRight - dblLeftPredictorOrdinateEdge; - aadblM[iNumSegment][i] = (dblSegmentRight * dblSegmentRight * dblSegmentRight - dblSegmentLeft * - dblSegmentLeft * dblSegmentLeft) / 6.; - - if (!org.drip.quant.common.NumberUtil.IsValid (dblSegmentLeft) || dblSegmentLeft < - dblLeftPredictorOrdinateEdge) - return null; - - if (!org.drip.quant.common.NumberUtil.IsValid (dblSegmentRight) || dblSegmentRight <= - dblSegmentLeft || dblSegmentRight > dblRightPredictorOrdinateEdge) - return null; - } - - for (int i = 0; i < iNumSegment; ++i) { - for (int k = 0; k < iNumSegment; ++k) - aadblM[i][k] = k > i ? 0. : adblSecondDegreeIntegral[k]; - } - - org.drip.quant.linearalgebra.LinearizationOutput lo = - org.drip.quant.linearalgebra.LinearSystemSolver.SolveUsingMatrixInversion (aadblM, adblY); - - if (null == lo) return null; - - double[] adblSlopeDisplacement = lo.getTransformedRHS(); - - if (null == adblSlopeDisplacement || adblSlopeDisplacement.length != iNumSegment + 1) return null; - - for (int i = 0; i < iNumSegment; ++i) - adblSlope[i] = adblSlopeDisplacement[i]; - - try { - return new R1PiecewiseDisplaced (dblLeftPredictorOrdinateEdge, - dblRightPredictorOrdinateEdge, adblPredictorOrdinate, adblSlope, - adblSlopeDisplacement[iNumSegment]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * R1PiecewiseDisplaced Constructor - * - * @param dblLeftPredictorOrdinateEdge Left Predictor Ordinate Edge - * @param dblRightPredictorOrdinateEdge Right Predictor Ordinate Edge - * @param adblPredictorOrdinate Array of Intermediate Predictor Ordinates - * @param adblPiecewiseDensitySlope Array of corresponding Piece-wise Density Slopes - * @param dblDensityDisplacement Uniform Density Displacement - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public R1PiecewiseDisplaced ( - final double dblLeftPredictorOrdinateEdge, - final double dblRightPredictorOrdinateEdge, - final double[] adblPredictorOrdinate, - final double[] adblPiecewiseDensitySlope, - final double dblDensityDisplacement) - throws java.lang.Exception - { - super (dblLeftPredictorOrdinateEdge, dblRightPredictorOrdinateEdge); - - if (null == (_adblPredictorOrdinate = adblPredictorOrdinate) || null == (_adblPiecewiseDensitySlope = - adblPiecewiseDensitySlope) || !org.drip.quant.common.NumberUtil.IsValid (_dblDensityDisplacement - = dblDensityDisplacement)) - throw new java.lang.Exception ("R1PiecewiseDisplaced Constructor: Invalid Inputs"); - - int iNumPredictorOrdinate = _adblPredictorOrdinate.length; - - if (0 == iNumPredictorOrdinate || iNumPredictorOrdinate + 1 != _adblPiecewiseDensitySlope.length) - throw new java.lang.Exception ("R1PiecewiseDisplaced Constructor: Invalid Inputs"); - } - - /** - * Retrieve the Array of Predictor Ordinates - * - * @return The Array of Predictor Ordinates - */ - - public double[] predictorOrdinates() - { - return _adblPredictorOrdinate; - } - - /** - * Retrieve the Array of Piecewise Density Slopes - * - * @return The Array of Piecewise Density Slopes - */ - - public double[] piecewiseDensitySlopes() - { - return _adblPiecewiseDensitySlope; - } - - /** - * Retrieve the Density Displacement - * - * @return The Density Displacement - */ - - public double densityDisplacement() - { - return _dblDensityDisplacement; - } - - @Override public double cumulative ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception ("R1PiecewiseDisplaced::cumulative => Invalid Inputs"); - - double dblLeftEdge = leftEdge(); - - double dblRightEdge = rightEdge(); - - if (dblX <= dblLeftEdge) return 0.; - - if (dblX >= dblRightEdge) return 1.; - - int iSegmentIndex = 0; - double dblSegmentLeft = dblLeftEdge; - double dblCumulativeProbability = 0.; - int iMaxSegmentIndex = _adblPiecewiseDensitySlope.length - 1; - - while (iSegmentIndex < iMaxSegmentIndex) { - double dblSegmentRight = _adblPredictorOrdinate[iSegmentIndex]; - - if (dblX >= dblSegmentLeft && dblX <= dblSegmentRight) - return dblCumulativeProbability + 0.5 * _adblPiecewiseDensitySlope[iSegmentIndex] * (dblX * - dblX - dblSegmentLeft * dblSegmentLeft) + _dblDensityDisplacement * (dblX - - dblSegmentLeft); - - dblCumulativeProbability += (0.5 * _adblPiecewiseDensitySlope[iSegmentIndex] * (dblSegmentRight * - dblSegmentRight - dblSegmentLeft * dblSegmentLeft) + _dblDensityDisplacement * - (dblSegmentRight - dblSegmentLeft)); - dblSegmentLeft = dblSegmentRight; - ++iSegmentIndex; - } - - return dblCumulativeProbability + 0.5 * _adblPiecewiseDensitySlope[iMaxSegmentIndex] * (dblX * dblX - - _adblPredictorOrdinate[iMaxSegmentIndex - 1] * _adblPredictorOrdinate[iMaxSegmentIndex - 1]) + - _dblDensityDisplacement * (dblX - _adblPredictorOrdinate[iMaxSegmentIndex - 1]); - } - - @Override public double invCumulative ( - final double dblY) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblY) || dblY < 0. || dblY > 1.) - throw new java.lang.Exception ("R1PiecewiseDisplaced::invCumulative => Invalid inputs"); - - org.drip.function.definition.R1ToR1 r1ToR1CumulativeProbability = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - return cumulative (dblX); - } - }; - - org.drip.function.r1tor1solver.FixedPointFinderOutput fpfo = new - org.drip.function.r1tor1solver.FixedPointFinderBracketing (dblY, r1ToR1CumulativeProbability, - null, org.drip.function.r1tor1solver.VariateIteratorPrimitive.BISECTION, true).findRoot - (org.drip.function.r1tor1solver.InitializationHeuristics.FromHardSearchEdges (leftEdge(), - rightEdge())); - - if (null == fpfo || !fpfo.containsRoot()) - throw new java.lang.Exception ("R1PiecewiseDisplaced::invCumulative => No roots"); - - return fpfo.getRoot(); - } - - @Override public double density ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception ("R1PiecewiseDisplaced::density => Invalid Inputs"); - - if (dblX <= leftEdge() || dblX >= rightEdge()) return 0.; - - int iSegmentIndex = 0; - int iMaxSegmentIndex = _adblPiecewiseDensitySlope.length - 1; - - while (iSegmentIndex < iMaxSegmentIndex) { - if (dblX >= _adblPredictorOrdinate[iSegmentIndex] && dblX <= - _adblPredictorOrdinate[iSegmentIndex + 1]) - break; - - ++iSegmentIndex; - } - - return _adblPiecewiseDensitySlope[iSegmentIndex] * dblX + _dblDensityDisplacement; - } - - @Override public org.drip.quant.common.Array2D histogram() - { - double dblLeftEdge = leftEdge(); - - double[] adblX = new double[GRID_WIDTH]; - double[] adblY = new double[GRID_WIDTH]; - - double dblWidth = (rightEdge() - dblLeftEdge) / GRID_WIDTH; - - for (int i = 0; i < GRID_WIDTH; ++i) { - adblX[i] = dblLeftEdge + (i + 1) * dblWidth; - - try { - adblY[i] = incremental (adblX[i] - dblWidth, adblX[i]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return org.drip.quant.common.Array2D.FromArray (adblX, adblY); - } -} diff --git a/org/drip/measure/lebesgue/R1PiecewiseLinear.java b/org/drip/measure/lebesgue/R1PiecewiseLinear.java deleted file mode 100644 index 594a53c..0000000 --- a/org/drip/measure/lebesgue/R1PiecewiseLinear.java +++ /dev/null @@ -1,286 +0,0 @@ - -package org.drip.measure.lebesgue; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * R1PiecewiseLinear implements the Piecewise Linear R^1 Distributions. It exports the Methods corresponding - * to the R^1 Lebesgue Base Class. - * - * @author Lakshmi Krishnamurthy - */ - -public class R1PiecewiseLinear extends org.drip.measure.lebesgue.R1Uniform { - private double[] _adblPiecewiseDensity = null; - private double[] _adblPredictorOrdinate = null; - - /** - * Calibrate an R1PiecewiseLinear Lebesgue Instance - * - * @param dblLeftPredictorOrdinateEdge Left Predictor Ordinate Edge - * @param dblRightPredictorOrdinateEdge Right Predictor Ordinate Edge - * @param adblPredictorOrdinate Array of Intermediate Predictor Ordinates - * @param adblCumulativeProbability Array of corresponding Cumulative Probabilities - * - * @return The R1PiecewiseLinearLebesgue Instance - */ - - public static final R1PiecewiseLinear Standard ( - final double dblLeftPredictorOrdinateEdge, - final double dblRightPredictorOrdinateEdge, - final double[] adblPredictorOrdinate, - final double[] adblCumulativeProbability) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblLeftPredictorOrdinateEdge) || - !org.drip.quant.common.NumberUtil.IsValid (dblRightPredictorOrdinateEdge) || - dblLeftPredictorOrdinateEdge >= dblRightPredictorOrdinateEdge || null == - adblPredictorOrdinate || null == adblCumulativeProbability) - return null; - - int iNumPredictorOrdinate = adblPredictorOrdinate.length; - double[] adblPiecewiseDensity = new double[iNumPredictorOrdinate + 1]; - - if (0 == iNumPredictorOrdinate || iNumPredictorOrdinate != adblCumulativeProbability.length) - return null; - - for (int i = 0; i <= iNumPredictorOrdinate; ++i) { - double dblLeftPredictorOrdinate = 0 == i ? dblLeftPredictorOrdinateEdge : - adblPredictorOrdinate[i - 1]; - - if (!org.drip.quant.common.NumberUtil.IsValid (dblLeftPredictorOrdinate) || - dblLeftPredictorOrdinate < dblLeftPredictorOrdinateEdge) - return null; - - double dblRightPredictorOrdinate = iNumPredictorOrdinate == i ? dblRightPredictorOrdinateEdge : - adblPredictorOrdinate[i]; - - if (!org.drip.quant.common.NumberUtil.IsValid (dblRightPredictorOrdinate) || - dblRightPredictorOrdinate <= dblLeftPredictorOrdinate || dblRightPredictorOrdinate > - dblRightPredictorOrdinateEdge) - return null; - - double dblLeftCumulativeProbability = 0 == i ? 0. : adblCumulativeProbability[i - 1]; - double dblRightCumulativeProbability = iNumPredictorOrdinate == i ? 1. : - adblCumulativeProbability[i]; - adblPiecewiseDensity[i] = 2. * (dblRightCumulativeProbability - dblLeftCumulativeProbability) / - (dblRightPredictorOrdinate * dblRightPredictorOrdinate - dblLeftPredictorOrdinate * - dblLeftPredictorOrdinate); - } - - try { - return new R1PiecewiseLinear (dblLeftPredictorOrdinateEdge, - dblRightPredictorOrdinateEdge, adblPredictorOrdinate, adblPiecewiseDensity); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * R1PiecewiseLinear Constructor - * - * @param dblLeftPredictorOrdinateEdge Left Predictor Ordinate Edge - * @param dblRightPredictorOrdinateEdge Right Predictor Ordinate Edge - * @param adblPredictorOrdinate Array of Intermediate Predictor Ordinates - * @param adblPiecewiseDensity Array of corresponding Piece-wise Densities - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public R1PiecewiseLinear ( - final double dblLeftPredictorOrdinateEdge, - final double dblRightPredictorOrdinateEdge, - final double[] adblPredictorOrdinate, - final double[] adblPiecewiseDensity) - throws java.lang.Exception - { - super (dblLeftPredictorOrdinateEdge, dblRightPredictorOrdinateEdge); - - if (null == (_adblPredictorOrdinate = adblPredictorOrdinate) || null == (_adblPiecewiseDensity = - adblPiecewiseDensity)) - throw new java.lang.Exception ("R1PiecewiseLinear Constructor: Invalid Inputs"); - - int iNumPredictorOrdinate = _adblPredictorOrdinate.length; - - if (0 == iNumPredictorOrdinate || iNumPredictorOrdinate + 1 != _adblPiecewiseDensity.length) - throw new java.lang.Exception ("R1PiecewiseLinear Constructor: Invalid Inputs"); - } - - /** - * Retrieve the Array of Predictor Ordinates - * - * @return The Array of Predictor Ordinates - */ - - public double[] predictorOrdinates() - { - return _adblPredictorOrdinate; - } - - /** - * Retrieve the Array of Piecewise Densities - * - * @return The Array of Piecewise Densities - */ - - public double[] piecewiseDensities() - { - return _adblPiecewiseDensity; - } - - @Override public double cumulative ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception ("R1PiecewiseLinear::cumulative => Invalid Inputs"); - - double dblLeftEdge = leftEdge(); - - double dblRightEdge = rightEdge(); - - if (dblX <= dblLeftEdge) return 0.; - - if (dblX >= dblRightEdge) return 1.; - - int iSegmentIndex = 0; - double dblSegmentLeft = dblLeftEdge; - double dblCumulativeProbability = 0.; - int iMaxSegmentIndex = _adblPiecewiseDensity.length - 1; - - while (iSegmentIndex < iMaxSegmentIndex) { - double dblSegmentRight = _adblPredictorOrdinate[iSegmentIndex]; - - if (dblX >= dblSegmentLeft && dblX <= dblSegmentRight) - return dblCumulativeProbability + 0.5 * _adblPiecewiseDensity[iSegmentIndex] * (dblX * dblX - - dblSegmentLeft * dblSegmentLeft); - - dblCumulativeProbability += 0.5 * _adblPiecewiseDensity[iSegmentIndex] * (dblSegmentRight * - dblSegmentRight - dblSegmentLeft * dblSegmentLeft); - dblSegmentLeft = dblSegmentRight; - ++iSegmentIndex; - } - - return dblCumulativeProbability + 0.5 * _adblPiecewiseDensity[iMaxSegmentIndex] * (dblX * dblX - - dblRightEdge * dblRightEdge); - } - - @Override public double invCumulative ( - final double dblY) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblY) || dblY < 0. || dblY > 1.) - throw new java.lang.Exception ("R1PiecewiseLinear::invCumulative => Invalid inputs"); - - org.drip.function.definition.R1ToR1 r1ToR1CumulativeProbability = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - return cumulative (dblX); - } - }; - - org.drip.function.r1tor1solver.FixedPointFinderOutput fpfo = new - org.drip.function.r1tor1solver.FixedPointFinderBracketing (dblY, r1ToR1CumulativeProbability, - null, org.drip.function.r1tor1solver.VariateIteratorPrimitive.BISECTION, true).findRoot(); - - if (null == fpfo || !fpfo.containsRoot()) - throw new java.lang.Exception ("R1PiecewiseLinear::invCumulative => No roots"); - - return fpfo.getRoot(); - } - - @Override public double density ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception ("R1PiecewiseLinear::density => Invalid Inputs"); - - if (dblX <= leftEdge() || dblX >= rightEdge()) return 0.; - - int iSegmentIndex = 0; - int iMaxSegmentIndex = _adblPiecewiseDensity.length - 1; - - while (iSegmentIndex < iMaxSegmentIndex) { - if (dblX >= _adblPredictorOrdinate[iSegmentIndex] && dblX <= - _adblPredictorOrdinate[iSegmentIndex + 1]) - break; - - ++iSegmentIndex; - } - - return _adblPiecewiseDensity[iSegmentIndex] * dblX; - } - - @Override public org.drip.quant.common.Array2D histogram() - { - double dblLeftEdge = leftEdge(); - - double[] adblX = new double[GRID_WIDTH]; - double[] adblY = new double[GRID_WIDTH]; - - double dblWidth = (rightEdge() - dblLeftEdge) / GRID_WIDTH; - - for (int i = 0; i < GRID_WIDTH; ++i) { - adblX[i] = dblLeftEdge + (i + 1) * dblWidth; - - try { - adblY[i] = incremental (adblX[i] - dblWidth, adblX[i]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return org.drip.quant.common.Array2D.FromArray (adblX, adblY); - } -} diff --git a/org/drip/measure/lebesgue/R1Uniform.java b/org/drip/measure/lebesgue/R1Uniform.java deleted file mode 100644 index 8229e67..0000000 --- a/org/drip/measure/lebesgue/R1Uniform.java +++ /dev/null @@ -1,173 +0,0 @@ - -package org.drip.measure.lebesgue; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * R1Uniform implements the R^1 Lebesgue (i.e., Bounded Uniform) Distribution, with a Uniform Distribution - * between a Lower and an Upper Bound. - * - * @author Lakshmi Krishnamurthy - */ - -public class R1Uniform extends org.drip.measure.continuousmarginal.R1 { - protected static final int GRID_WIDTH = 100; - - private double _dblLeftPredictorOrdinateEdge = java.lang.Double.NaN; - private double _dblRightPredictorOrdinateEdge = java.lang.Double.NaN; - - /** - * Construct a R^1 Bounded Uniform Distribution - * - * @param dblLeftPredictorOrdinateEdge The Left Predictor Ordinate Edge - * @param dblRightPredictorOrdinateEdge The Right Predictor Ordinate Edge - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public R1Uniform ( - final double dblLeftPredictorOrdinateEdge, - final double dblRightPredictorOrdinateEdge) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblLeftPredictorOrdinateEdge = - dblLeftPredictorOrdinateEdge) || !org.drip.quant.common.NumberUtil.IsValid - (_dblRightPredictorOrdinateEdge = dblRightPredictorOrdinateEdge) || - _dblRightPredictorOrdinateEdge <= _dblLeftPredictorOrdinateEdge) - throw new java.lang.Exception ("R1Uniform Constructor: Invalid Inputs"); - } - - /** - * Retrieve the Left Predictor Ordinate Edge - * - * @return The Left Predictor Ordinate Edge - */ - - public double leftEdge() - { - return _dblLeftPredictorOrdinateEdge; - } - - /** - * Retrieve the Right Predictor Ordinate Edge - * - * @return The Right Predictor Ordinat Edge - */ - - public double rightEdge() - { - return _dblRightPredictorOrdinateEdge; - } - - @Override public double cumulative ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception ("R1Uniform::cumulative => Invalid Inputs"); - - if (dblX <= _dblLeftPredictorOrdinateEdge) return 0.; - - if (dblX >= _dblRightPredictorOrdinateEdge) return 1.; - - return (dblX - _dblLeftPredictorOrdinateEdge) / (_dblRightPredictorOrdinateEdge - - _dblLeftPredictorOrdinateEdge); - } - - @Override public double incremental ( - final double dblXLeft, - final double dblXRight) - throws java.lang.Exception - { - return cumulative (dblXRight) - cumulative (dblXLeft); - } - - @Override public double invCumulative ( - final double dblY) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblY) || dblY < 0. || dblY > 1.) - throw new java.lang.Exception ("R1Uniform::invCumulative => Invalid inputs"); - - return dblY * (_dblRightPredictorOrdinateEdge - _dblLeftPredictorOrdinateEdge) + - _dblLeftPredictorOrdinateEdge; - } - - @Override public double density ( - final double dblX) - throws java.lang.Exception - { - return dblX <= _dblLeftPredictorOrdinateEdge || dblX >= _dblRightPredictorOrdinateEdge ? 0. : 1. / - (_dblRightPredictorOrdinateEdge - _dblLeftPredictorOrdinateEdge); - } - - @Override public double mean() - { - return 0.5 * (_dblRightPredictorOrdinateEdge + _dblLeftPredictorOrdinateEdge); - } - - @Override public double variance() - { - return (_dblRightPredictorOrdinateEdge - _dblLeftPredictorOrdinateEdge) * - (_dblRightPredictorOrdinateEdge - _dblLeftPredictorOrdinateEdge) / 12.; - } - - @Override public org.drip.quant.common.Array2D histogram() - { - double[] adblX = new double[GRID_WIDTH]; - double[] adblY = new double[GRID_WIDTH]; - double dblWidth = (_dblRightPredictorOrdinateEdge - _dblLeftPredictorOrdinateEdge) / GRID_WIDTH; - - for (int i = 0; i < GRID_WIDTH; ++i) { - adblY[i] = 1. / GRID_WIDTH; - adblX[i] = _dblLeftPredictorOrdinateEdge + (i + 1) * dblWidth; - } - - return org.drip.quant.common.Array2D.FromArray (adblX, adblY); - } -} diff --git a/org/drip/measure/lebesgue/RdUniform.java b/org/drip/measure/lebesgue/RdUniform.java deleted file mode 100644 index d814af0..0000000 --- a/org/drip/measure/lebesgue/RdUniform.java +++ /dev/null @@ -1,147 +0,0 @@ - -package org.drip.measure.lebesgue; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RdUniform implements the R^d Lebesgue Measure Distribution that corresponds to a Uniform R^d d-Volume - * Space. - * - * @author Lakshmi Krishnamurthy - */ - -public class RdUniform extends org.drip.measure.continuousmarginal.Rd { - private org.drip.spaces.tensor.RdGeneralizedVector _gmvs = null; - - /** - * RdUniform Constructor - * - * @param gmvs The Vector Space Underlying the Measure - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public RdUniform ( - final org.drip.spaces.tensor.RdGeneralizedVector gmvs) - throws java.lang.Exception - { - if (null == (_gmvs = gmvs)) throw new java.lang.Exception ("RdUniform ctr: Invalid Inputs"); - } - - /** - * Retrieve the Vector Space Underlying the Measure - * - * @return The Vector Space Underlying the Measure - */ - - public org.drip.spaces.tensor.RdGeneralizedVector measureSpace() - { - return _gmvs; - } - - @Override public double cumulative ( - final double[] adblX) - throws java.lang.Exception - { - double[] adblLeftEdge = _gmvs.leftDimensionEdge(); - - double dblCumulative = 1.; - int iDimension = adblLeftEdge.length; - - if (null == adblX || iDimension != adblX.length) - throw new java.lang.Exception ("RdLebesgue::cumulative => Invalid Inputs"); - - double[] adblRightEdge = _gmvs.rightDimensionEdge(); - - for (int i = 0; i < iDimension; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (adblX[i]) || adblX[i] > adblRightEdge[i]) - throw new java.lang.Exception ("RdUniform::cumulative => Invalid Inputs"); - - dblCumulative *= (adblX[i] - adblLeftEdge[i]) / (adblRightEdge[i] - adblLeftEdge[i]); - } - - return dblCumulative; - } - - @Override public double incremental ( - final double[] adblXLeft, - final double[] adblXRight) - throws java.lang.Exception - { - if (null == adblXLeft || null == adblXRight) - throw new java.lang.Exception ("RdUniform::incremental => Invalid Inputs"); - - double[] adblLeftEdge = _gmvs.leftDimensionEdge(); - - double dblIncremental = 1.; - int iDimension = adblLeftEdge.length; - - if (iDimension != adblXLeft.length || iDimension != adblXRight.length) - throw new java.lang.Exception ("RdUniform::incremental => Invalid Inputs"); - - double[] adblRightEdge = _gmvs.rightDimensionEdge(); - - for (int i = 0; i < iDimension; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (adblXLeft[i]) || adblXLeft[i] < adblLeftEdge[i] || - !org.drip.quant.common.NumberUtil.IsValid (adblXRight[i]) || adblXRight[i] > - adblRightEdge[i]) - throw new java.lang.Exception ("RdUniform::incremental => Invalid Inputs"); - - dblIncremental *= (adblXRight[i] - adblXLeft[i]) / (adblRightEdge[i] - adblLeftEdge[i]); - } - - return dblIncremental; - } - - @Override public double density ( - final double[] adblX) - throws java.lang.Exception - { - return 1. / _gmvs.hyperVolume(); - } -} diff --git a/org/drip/measure/process/DiffusionEvolver.java b/org/drip/measure/process/DiffusionEvolver.java deleted file mode 100644 index a50e506..0000000 --- a/org/drip/measure/process/DiffusionEvolver.java +++ /dev/null @@ -1,315 +0,0 @@ - -package org.drip.measure.process; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * DiffusionEvolver implements the Functionality that guides the Single Factor R^1 Diffusion Random Process - * Variable Evolution. - * - * @author Lakshmi Krishnamurthy - */ - -public class DiffusionEvolver { - private org.drip.measure.dynamics.DiffusionEvaluator _de = null; - - /** - * DiffusionEvolver Constructor - * - * @param de The Diffusion Evaluator Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public DiffusionEvolver ( - final org.drip.measure.dynamics.DiffusionEvaluator de) - throws java.lang.Exception - { - if (null == (_de = de)) - throw new java.lang.Exception ("DiffusionEvolver Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Diffusion Evaluator - * - * @return The Diffusion Evaluator - */ - - public org.drip.measure.dynamics.DiffusionEvaluator evaluator() - { - return _de; - } - - /** - * Generate the JumpDiffusionEdge Instance from the specified Jump Diffusion Instance - * - * @param jdv The JumpDiffusionVertex Instance - * @param ur The Random Unit Realization - * @param dblTimeIncrement The Time Increment Evolution Unit - * - * @return The JumpDiffusionEdge Instance - */ - - public org.drip.measure.realization.JumpDiffusionEdge increment ( - final org.drip.measure.realization.JumpDiffusionVertex jdv, - final org.drip.measure.realization.UnitRandom ur, - final double dblTimeIncrement) - { - if (null == jdv || null == ur || !org.drip.quant.common.NumberUtil.IsValid (dblTimeIncrement)) - return null; - - double dblPreviousValue = jdv.value(); - - try { - org.drip.measure.dynamics.LocalEvaluator leVolatility = _de.volatility(); - - return org.drip.measure.realization.JumpDiffusionEdge.Standard (dblPreviousValue, - _de.drift().value (jdv) * dblTimeIncrement, null == leVolatility ? 0. : leVolatility.value - (jdv) * ur.diffusion() * java.lang.Math.sqrt (java.lang.Math.abs (dblTimeIncrement)), - null, ur); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Array of Adjacent JumpDiffusionEdge from the specified Random Variate Array - * - * @param jdv The JumpDiffusionVertex Instance - * @param aUR Array of Random Unit Realizations - * @param dblTimeIncrement The Time Increment Evolution Unit - * - * @return The Array of Adjacent JumpDiffusionEdge - */ - - public org.drip.measure.realization.JumpDiffusionEdge[] incrementSequence ( - final org.drip.measure.realization.JumpDiffusionVertex jdv, - final org.drip.measure.realization.UnitRandom[] aUR, - final double dblTimeIncrement) - { - if (null == aUR) return null; - - int iNumTimeStep = aUR.length; - org.drip.measure.realization.JumpDiffusionVertex jdvIter = jdv; - org.drip.measure.realization.JumpDiffusionEdge[] aJDE = 0 == iNumTimeStep ? null : new - org.drip.measure.realization.JumpDiffusionEdge[iNumTimeStep]; - - if (0 == iNumTimeStep) return null; - - for (int i = 0; i < iNumTimeStep; ++i) { - if (null == (aJDE[i] = increment (jdvIter, aUR[i], dblTimeIncrement))) return null; - - try { - boolean bJumpOccurred = false; - double dblHazardIntegral = 0.; - - org.drip.measure.realization.StochasticEdgeJump sej = aJDE[i].stochasticJumpEdge(); - - if (null != sej) { - bJumpOccurred = sej.jumpOccurred(); - - dblHazardIntegral = sej.hazardIntegral(); - } - - jdvIter = new org.drip.measure.realization.JumpDiffusionVertex (jdvIter.time() + - dblTimeIncrement, aJDE[i].finish(), jdvIter.cumulativeHazardIntegral() + - dblHazardIntegral, bJumpOccurred || jdvIter.jumpOccurred()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return aJDE; - } - - /** - * Generate the Array of JumpDiffusionVertex Snaps from the specified Random Variate Array - * - * @param jdv The JumpDiffusionVertex Instance - * @param aUR Array of Random Unit Realizations - * @param dblTimeIncrement The Time Increment Evolution Unit - * - * @return The Array of JumpDiffusionVertex Snaps - */ - - public org.drip.measure.realization.JumpDiffusionVertex[] vertexSequence ( - final org.drip.measure.realization.JumpDiffusionVertex jdv, - final org.drip.measure.realization.UnitRandom[] aUR, - final double dblTimeIncrement) - { - if (null == aUR) return null; - - int iNumTimeStep = aUR.length; - org.drip.measure.realization.JumpDiffusionVertex jdvPrev = jdv; - org.drip.measure.realization.JumpDiffusionVertex[] aJDV = 0 == iNumTimeStep ? null : new - org.drip.measure.realization.JumpDiffusionVertex[iNumTimeStep]; - - if (0 == iNumTimeStep) return null; - - for (int i = 0; i < iNumTimeStep; ++i) { - org.drip.measure.realization.JumpDiffusionEdge jde = increment (jdvPrev, aUR[i], - dblTimeIncrement); - - if (null == jde) return null; - - try { - org.drip.measure.realization.StochasticEdgeJump sej = jde.stochasticJumpEdge(); - - boolean bJumpOccurred = false; - double dblHazardIntegral = 0.; - - if (null != sej) { - bJumpOccurred = sej.jumpOccurred(); - - dblHazardIntegral = sej.hazardIntegral(); - } - - jdvPrev = aJDV[i] = new org.drip.measure.realization.JumpDiffusionVertex (jdvPrev.time() + - dblTimeIncrement, jde.finish(), jdvPrev.cumulativeHazardIntegral() + dblHazardIntegral, - bJumpOccurred || jdvPrev.jumpOccurred()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return aJDV; - } - - /** - * Generate the Adjacent JumpDiffusionDAG Increment from the specified Random Variate and a Weiner Driver - * - * @param jdv The JumpDiffusionVertex Instance - * @param dblTimeIncrement The Time Increment Evolution Unit - * - * @return The Adjacent JumpDiffusionDAG Increment - */ - - public org.drip.measure.realization.JumpDiffusionEdge weinerIncrement ( - final org.drip.measure.realization.JumpDiffusionVertex jdv, - final double dblTimeIncrement) - { - try { - return increment (jdv, org.drip.measure.realization.UnitRandom.GaussianDiffusion(), - dblTimeIncrement); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Adjacent JumpDiffusionDAG Increment from the specified Random Variate and a Jump Driver - * - * @param jdv The JumpDiffusionVertex Instance - * @param dblTimeIncrement The Time Increment Evolution Unit - * - * @return The Adjacent JumpDiffusionDAG Increment - */ - - public org.drip.measure.realization.JumpDiffusionEdge jumpIncrement ( - final org.drip.measure.realization.JumpDiffusionVertex jdv, - final double dblTimeIncrement) - { - return increment (jdv, org.drip.measure.realization.UnitRandom.UniformJump(), dblTimeIncrement); - } - - /** - * Generate the Adjacent JumpDiffusionDAG Increment from the specified Random Variate and Jump/Weiner - * Drivers - * - * @param jdv The JumpDiffusionVertex Instance - * @param dblTimeIncrement The Time Increment Evolution Unit - * - * @return The Adjacent JumpDiffusionDAG Increment - */ - - public org.drip.measure.realization.JumpDiffusionEdge jumpWeinerIncrement ( - final org.drip.measure.realization.JumpDiffusionVertex jdv, - final double dblTimeIncrement) - { - try { - return increment (jdv, new org.drip.measure.realization.UnitRandom - (org.drip.measure.gaussian.NormalQuadrature.Random(), java.lang.Math.random()), - dblTimeIncrement); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Adjacent JumpDiffusionDAG Increment from the specified Random Variate and Weiner/Jump - * Drivers - * - * @param jdv The JumpDiffusionVertex Instance - * @param dblTimeIncrement The Time Increment Evolution Unit - * - * @return The Adjacent JumpDiffusionDAG Increment - */ - - public org.drip.measure.realization.JumpDiffusionEdge weinerJumpIncrement ( - final org.drip.measure.realization.JumpDiffusionVertex jdv, - final double dblTimeIncrement) - { - try { - return increment (jdv, new org.drip.measure.realization.UnitRandom - (org.drip.measure.gaussian.NormalQuadrature.Random(), java.lang.Math.random()), - dblTimeIncrement); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/measure/process/JumpDiffusionEvolver.java b/org/drip/measure/process/JumpDiffusionEvolver.java deleted file mode 100644 index 3a31f57..0000000 --- a/org/drip/measure/process/JumpDiffusionEvolver.java +++ /dev/null @@ -1,140 +0,0 @@ - -package org.drip.measure.process; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * JumpDiffusionEvolver implements the Functionality that guides the Single Factor R^1 Jump Diffusion Random - * Process Variable Evolution. - * - * @author Lakshmi Krishnamurthy - */ - -public class JumpDiffusionEvolver extends org.drip.measure.process.DiffusionEvolver { - private org.drip.measure.dynamics.HazardJumpEvaluator _heie = null; - - /** - * JumpDiffusionEvolver Constructor - * - * @param de The Diffusion Evaluator Instance - * @param heie The Hazard Point Event Indicator Function Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public JumpDiffusionEvolver ( - final org.drip.measure.dynamics.DiffusionEvaluator de, - final org.drip.measure.dynamics.HazardJumpEvaluator heie) - throws java.lang.Exception - { - super (de); - - if (null == (_heie = heie)) - throw new java.lang.Exception ("JumpDiffusionEvolver Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Hazard Point Event Indicator Instance - * - * @return The Hazard Point Event Indicator Instance - */ - - public org.drip.measure.dynamics.HazardJumpEvaluator eventIndicationEvaluator() - { - return _heie; - } - - @Override public org.drip.measure.realization.JumpDiffusionEdge increment ( - final org.drip.measure.realization.JumpDiffusionVertex jdv, - final org.drip.measure.realization.UnitRandom ur, - final double dblTimeIncrement) - { - if (null == jdv || null == ur || !org.drip.quant.common.NumberUtil.IsValid (dblTimeIncrement)) - return null; - - double dblPreviousValue = jdv.value(); - - try { - if (jdv.jumpOccurred()) - return org.drip.measure.realization.JumpDiffusionEdge.Standard (dblPreviousValue, 0., 0., new - org.drip.measure.realization.StochasticEdgeJump (false, 0., 0., dblPreviousValue), ur); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - double dblHazardRate = _heie.hazardRate(); - - org.drip.measure.dynamics.DiffusionEvaluator de = evaluator(); - - double dblLevelHazardIntegral = dblHazardRate * dblTimeIncrement; - - boolean bEventOccurred = java.lang.Math.exp (-1. * (jdv.cumulativeHazardIntegral() + - dblLevelHazardIntegral)) <= ur.jump(); - - try { - org.drip.measure.realization.StochasticEdgeJump sej = new - org.drip.measure.realization.StochasticEdgeJump (bEventOccurred, dblHazardRate, - dblLevelHazardIntegral, _heie.magnitudeEvaluator().value (jdv)); - - if (bEventOccurred) - return org.drip.measure.realization.JumpDiffusionEdge.Standard (dblPreviousValue, 0., 0., - sej, ur); - - org.drip.measure.dynamics.LocalEvaluator leVolatility = de.volatility(); - - return org.drip.measure.realization.JumpDiffusionEdge.Standard (dblPreviousValue, - de.drift().value (jdv) * dblTimeIncrement, null == leVolatility ? 0. : leVolatility.value - (jdv) * ur.diffusion() * java.lang.Math.sqrt (java.lang.Math.abs (dblTimeIncrement)), - sej, ur); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/measure/process/OrnsteinUhlenbeck.java b/org/drip/measure/process/OrnsteinUhlenbeck.java deleted file mode 100644 index 60d3458..0000000 --- a/org/drip/measure/process/OrnsteinUhlenbeck.java +++ /dev/null @@ -1,97 +0,0 @@ - -package org.drip.measure.process; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OrnsteinUhlenbeck Interface exposes the Reference Parameter Scales the guide the Random Variable Evolution - * according to Ornstein-Uhlenbeck Mean Reverting Process. The References are: - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * - Walia, N. (2006): Optimal Trading - Dynamic Stock Liquidation Strategies, Senior Thesis, Princeton - * University. - * - * @author Lakshmi Krishnamurthy - */ - -public interface OrnsteinUhlenbeck { - - /** - * Retrieve the Reference Relaxation Time Scale - * - * @return The Reference Relaxation Time Scale - */ - - public abstract double referenceRelaxationTime(); - - /** - * Retrieve the Reference Burstiness Scale - * - * @return The Reference Burstiness Scale - */ - - public abstract double referenceBurstiness(); - - /** - * Retrieve the Reference Mean Reversion Level Scale - * - * @return The Reference Mean Reversion Level Scale - */ - - public abstract double referenceMeanReversionLevel(); -} diff --git a/org/drip/measure/process/OrnsteinUhlenbeckPair.java b/org/drip/measure/process/OrnsteinUhlenbeckPair.java deleted file mode 100644 index c4088d5..0000000 --- a/org/drip/measure/process/OrnsteinUhlenbeckPair.java +++ /dev/null @@ -1,230 +0,0 @@ - -package org.drip.measure.process; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OrnsteinUhlenbeckPair guides the Random Variable Evolution according to 2D Ornstein-Uhlenbeck Mean - * Reverting Process. The References are: - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * - Walia, N. (2006): Optimal Trading - Dynamic Stock Liquidation Strategies, Senior Thesis, Princeton - * University. - * - * @author Lakshmi Krishnamurthy - */ - -public class OrnsteinUhlenbeckPair implements org.drip.measure.process.OrnsteinUhlenbeck { - private double _dblCorrelation = java.lang.Double.NaN; - private org.drip.measure.dynamics.DiffusionEvaluatorOrnsteinUhlenbeck _deouDerived = null; - private org.drip.measure.dynamics.DiffusionEvaluatorOrnsteinUhlenbeck _deouReference = null; - - /** - * OrnsteinUhlenbeckPair Constructor - * - * @param deouReference The Reference R^1 Ornstein-Uhlenbeck Evaluator - * @param deouDerived The Derived R^1 Ornstein-Uhlenbeck Evaluator - * @param dblCorrelation The Correlation between the Two Ornstein-Uhlenbeck Processes - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public OrnsteinUhlenbeckPair ( - final org.drip.measure.dynamics.DiffusionEvaluatorOrnsteinUhlenbeck deouReference, - final org.drip.measure.dynamics.DiffusionEvaluatorOrnsteinUhlenbeck deouDerived, - final double dblCorrelation) - throws java.lang.Exception - { - if (null == (_deouReference = deouReference) || null == (_deouDerived = deouDerived) || - !org.drip.quant.common.NumberUtil.IsValid (_dblCorrelation = dblCorrelation) || _dblCorrelation < - -1. || _dblCorrelation > 1.) - throw new java.lang.Exception ("OrnsteinUhlenbeckPair Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Reference R^1 Ornstein-Uhlenbeck Evaluator - * - * @return The Reference R^1 Ornstein-Uhlenbeck Evaluator - */ - - public org.drip.measure.dynamics.DiffusionEvaluatorOrnsteinUhlenbeck reference() - { - return _deouReference; - } - - /** - * Retrieve the Derived R^1 Ornstein-Uhlenbeck Evaluator - * - * @return The Derived R^1 Ornstein-Uhlenbeck Evaluator - */ - - public org.drip.measure.dynamics.DiffusionEvaluatorOrnsteinUhlenbeck derived() - { - return _deouDerived; - } - - /** - * Retrieve the Correlation between the Ornstein-Uhlenbeck Processes - * - * @return The Correlation between the Ornstein-Uhlenbeck Processes - */ - - public double correlation() - { - return _dblCorrelation; - } - - /** - * Generate the Adjacent JumpDiffusionEdge Increment Array from the specified Ornstein Uhlenbeck Random - * Variate Pair - * - * @param adblVariatePair The Pair of the Ornstein Uhlenbeck Random Variates - * @param adblDiffusionPair The Pair of Diffusion Realizations - * @param dblTimeIncrement The Time Increment Evolution Unit - * - * @return The Adjacent JumpDiffusionEdge Increment Array - */ - - public org.drip.measure.realization.JumpDiffusionEdge[] increment ( - final double[] adblVariatePair, - final double[] adblDiffusionPair, - final double dblTimeIncrement) - { - if (null == adblVariatePair || 2 != adblVariatePair.length || - !org.drip.quant.common.NumberUtil.IsValid (adblVariatePair) || null == adblDiffusionPair || 2 != - adblDiffusionPair.length || !org.drip.quant.common.NumberUtil.IsValid (adblDiffusionPair) || - !org.drip.quant.common.NumberUtil.IsValid (dblTimeIncrement) || 0. >= dblTimeIncrement) - return null; - - double dblRelaxationTime0 = _deouReference.relaxationTime(); - - double dblRelaxationTime1 = _deouDerived.relaxationTime(); - - try { - return new org.drip.measure.realization.JumpDiffusionEdge[] { - org.drip.measure.realization.JumpDiffusionEdge.Standard ( - adblVariatePair[0], - -1. * adblVariatePair[0] / dblRelaxationTime0 * dblTimeIncrement, - _deouReference.burstiness() * adblDiffusionPair[0] * java.lang.Math.sqrt (dblTimeIncrement / dblRelaxationTime0), - null, - new org.drip.measure.realization.UnitRandom ( - adblDiffusionPair[0], - 0. - ) - ), - org.drip.measure.realization.JumpDiffusionEdge.Standard ( - adblVariatePair[1], - -1. * adblVariatePair[1] / dblRelaxationTime1 * dblTimeIncrement, - _deouDerived.burstiness() * adblDiffusionPair[1] * java.lang.Math.sqrt (dblTimeIncrement / dblRelaxationTime1), - null, - new org.drip.measure.realization.UnitRandom ( - adblDiffusionPair[1], - 0. - ) - ) - }; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Weiner Based JumpDiffusionEdge Increment Sequence from the Current Ornstein Uhlenbeck - * Random Variate - * - * @param adblVariatePair The Ornstein Uhlenbeck Random Variate Pair - * @param dblTimeIncrement The Time Increment - * - * @return The Weiner Based JumpDiffusionEdge Increment Sequence from the Current Ornstein Uhlenbeck - * Random Variate - */ - - public org.drip.measure.realization.JumpDiffusionEdge[] weinerIncrement ( - final double[] adblVariatePair, - final double dblTimeIncrement) - { - try { - double dblFirstWeiner = org.drip.measure.gaussian.NormalQuadrature.Random(); - - return increment (adblVariatePair, new double[] {dblFirstWeiner, dblFirstWeiner * _dblCorrelation - + org.drip.measure.gaussian.NormalQuadrature.Random() * java.lang.Math.sqrt (1. - - _dblCorrelation * _dblCorrelation)}, dblTimeIncrement); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public double referenceRelaxationTime() - { - return _deouReference.relaxationTime(); - } - - @Override public double referenceBurstiness() - { - return _deouReference.burstiness(); - } - - @Override public double referenceMeanReversionLevel() - { - return _deouReference.meanReversionLevel(); - } -} diff --git a/org/drip/measure/realization/JumpDiffusionEdge.java b/org/drip/measure/realization/JumpDiffusionEdge.java deleted file mode 100644 index f3f1cb6..0000000 --- a/org/drip/measure/realization/JumpDiffusionEdge.java +++ /dev/null @@ -1,287 +0,0 @@ - -package org.drip.measure.realization; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * JumpDiffusionEdge implements the Deterministic and the Stochastic Components of a R^1 Marginal Random - * Increment Edge as well the Original Marginal Random Variate. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Jones, C. M., G. Kaul, and M. L. Lipson (1994): Transactions, Volume, and Volatility, Review of - * Financial Studies 7 (4) 631-651. - * - * @author Lakshmi Krishnamurthy - */ - -public class JumpDiffusionEdge { - private double _dblStart = java.lang.Double.NaN; - private double _dblDeterministic = java.lang.Double.NaN; - private org.drip.measure.realization.UnitRandom _ur = null; - private org.drip.measure.realization.StochasticEdgeJump _sej = null; - private org.drip.measure.realization.StochasticEdgeDiffusion _sed = null; - - /** - * Construct the Standard JumpDiffusionEdge Instance - * - * @param dblStart The Starting Random Variable Realization - * @param dblDeterministic The Deterministic Increment Component - * @param dblDiffusionStochastic The Diffusion Stochastic Edge Change Amount - * @param bJumpOccurred TRUE - The Jump Occurred in this Edge Period - * @param dblHazardRate The Hazard Rate - * @param dblHazardIntegral The Level Hazard Integral - * @param dblJumpTarget The Jump Target - * @param dblUnitDiffusion The Diffusion Random Variable - * @param dblUnitJump The Jump Random Variable - * - * @return The JumpDiffusionEdge Instance - */ - - public static final JumpDiffusionEdge Standard ( - final double dblStart, - final double dblDeterministic, - final double dblDiffusionStochastic, - final boolean bJumpOccurred, - final double dblHazardRate, - final double dblHazardIntegral, - final double dblJumpTarget, - final double dblUnitDiffusion, - final double dblUnitJump) - { - try { - return new JumpDiffusionEdge (dblStart, dblDeterministic, new - org.drip.measure.realization.StochasticEdgeDiffusion (dblDiffusionStochastic), new - org.drip.measure.realization.StochasticEdgeJump (bJumpOccurred, dblHazardRate, - dblHazardIntegral, dblJumpTarget), new org.drip.measure.realization.UnitRandom - (dblUnitDiffusion, dblUnitJump)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct the Standard JumpDiffusionEdge Instance - * - * @param dblStart The Starting Random Variable Realization - * @param dblDeterministic The Deterministic Increment Component - * @param dblDiffusionStochastic The Diffusion Stochastic Edge Change Amount - * @param sej The Stochastic Jump Edge Instance - * @param ur The Random Unit Realization - * - * @return The JumpDiffusionEdge Instance - */ - - public static final JumpDiffusionEdge Standard ( - final double dblStart, - final double dblDeterministic, - final double dblDiffusionStochastic, - final org.drip.measure.realization.StochasticEdgeJump sej, - final org.drip.measure.realization.UnitRandom ur) - { - try { - return new JumpDiffusionEdge (dblStart, dblDeterministic, new - org.drip.measure.realization.StochasticEdgeDiffusion (dblDiffusionStochastic), sej, ur); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * JumpDiffusionEdge Constructor - * - * @param dblStart The Starting Random Variable Realization - * @param dblDeterministic The Deterministic Increment Component - * @param sed The Stochastic Diffusion Edge Instance - * @param sej The Stochastic Jump Edge Instance - * @param ur The Random Unit Realization - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public JumpDiffusionEdge ( - final double dblStart, - final double dblDeterministic, - final org.drip.measure.realization.StochasticEdgeDiffusion sed, - final org.drip.measure.realization.StochasticEdgeJump sej, - final org.drip.measure.realization.UnitRandom ur) - throws java.lang.Exception - { - _sed = sed; - _sej = sej; - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblStart = dblStart) || - !org.drip.quant.common.NumberUtil.IsValid (_dblDeterministic = dblDeterministic) || (null == _sed - && null == _sej) || null == (_ur = ur)) - throw new java.lang.Exception ("JumpDiffusionEdge Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Start Realization - * - * @return The Start Realization - */ - - public double start() - { - return _dblStart; - } - - /** - * Retrieve the Deterministic Component - * - * @return The Deterministic Component - */ - - public double deterministic() - { - return _dblDeterministic; - } - - /** - * Retrieve the Diffusion Stochastic Component - * - * @return The Diffusion Stochastic Component - */ - - public double diffusionStochastic() - { - return null == _sed ? 0. : _sed.change(); - } - - /** - * Retrieve the Diffusion Wander Realization - * - * @return The Diffusion Wander Realization - */ - - public double diffusionWander() - { - return _ur.diffusion(); - } - - /** - * Retrieve the Jump Stochastic Component - * - * @return The Jump Stochastic Component - */ - - public double jumpStochastic() - { - return null == _sej ? 0. : _sej.target(); - } - - /** - * Retrieve the Jump Wander Realization - * - * @return The Jump Wander Realization - */ - - public double jumpWander() - { - return _ur.jump(); - } - - /** - * Retrieve the Finish Realization - * - * @return The Finish Realization - */ - - public double finish() - { - return null == _sej || !_sej.jumpOccurred() ? _dblStart + _dblDeterministic + diffusionStochastic() : - _sej.target(); - } - - /** - * Retrieve the Gross Change - * - * @return The Gross Change - */ - - public double grossChange() - { - return finish() - _dblStart; - } - - /** - * Retrieve the Stochastic Diffusion Edge Instance - * - * @return The Stochastic Diffusion Edge Instance - */ - - public org.drip.measure.realization.StochasticEdgeDiffusion stochasticDiffusionEdge() - { - return _sed; - } - - /** - * Retrieve the Stochastic Jump Edge Instance - * - * @return The Stochastic Jump Edge Instance - */ - - public org.drip.measure.realization.StochasticEdgeJump stochasticJumpEdge() - { - return _sej; - } -} diff --git a/org/drip/measure/realization/JumpDiffusionVertex.java b/org/drip/measure/realization/JumpDiffusionVertex.java deleted file mode 100644 index 7328471..0000000 --- a/org/drip/measure/realization/JumpDiffusionVertex.java +++ /dev/null @@ -1,132 +0,0 @@ - -package org.drip.measure.realization; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * JumpDiffusionVertex holds the Snapshot Values of the Realized R^1 Variable - its Value, whether it has - * terminated, and the Cumulative Hazard Integral - and Time. - * - * @author Lakshmi Krishnamurthy - */ - -public class JumpDiffusionVertex { - private boolean _bJumpOccurred = false; - private double _dblTime = java.lang.Double.NaN; - private double _dblValue = java.lang.Double.NaN; - private double _dblCumulativeHazardIntegral = java.lang.Double.NaN; - - /** - * JumpDiffusionVertex Constructor - * - * @param dblTime The Time Instant - * @param dblValue The Random Variable Value - * @param dblCumulativeHazardIntegral The Jump Occurrence Cumulative Hazard Integral - * @param bJumpOccurred TRUE - Jump Occurred - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public JumpDiffusionVertex ( - final double dblTime, - final double dblValue, - final double dblCumulativeHazardIntegral, - final boolean bJumpOccurred) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblTime = dblTime) || - !org.drip.quant.common.NumberUtil.IsValid (_dblValue = dblValue) || - !org.drip.quant.common.NumberUtil.IsValid (_dblCumulativeHazardIntegral = - dblCumulativeHazardIntegral)) - throw new java.lang.Exception ("JumpDiffusionVertex Constructor => Invalid Inputs"); - - _bJumpOccurred = bJumpOccurred; - } - - /** - * Retrieve the Evolution Time Instant - * - * @return The Evolution Time Instant - */ - - public double time() - { - return _dblTime; - } - - /** - * Retrieve the Realized Random Value - * - * @return The Realized Random Value - */ - - public double value() - { - return _dblValue; - } - - /** - * Retrieve the Jump Occurred Flag - * - * @return TRUE - Jump Occurred - */ - - public boolean jumpOccurred() - { - return _bJumpOccurred; - } - - /** - * Retrieve the Jump Occurrence Cumulative Hazard Integral - * - * @return The Jump Occurrence Cumulative Hazard Integral - */ - - public final double cumulativeHazardIntegral() - { - return _dblCumulativeHazardIntegral; - } -} diff --git a/org/drip/measure/realization/StochasticEdgeDiffusion.java b/org/drip/measure/realization/StochasticEdgeDiffusion.java deleted file mode 100644 index e2f7990..0000000 --- a/org/drip/measure/realization/StochasticEdgeDiffusion.java +++ /dev/null @@ -1,84 +0,0 @@ - -package org.drip.measure.realization; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * StochasticEdgeDiffusion holds the Edge of the Diffusion Stochastic Evaluator Outcome. - * - * @author Lakshmi Krishnamurthy - */ - -public class StochasticEdgeDiffusion { - private double _dblChange = java.lang.Double.NaN; - - /** - * StochasticEdgeDiffusion Constructor - * - * @param dblChange The Diffusion Stochastic Edge Change Amount - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public StochasticEdgeDiffusion ( - final double dblChange) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblChange = dblChange)) - throw new java.lang.Exception ("StochasticEdgeDiffusion Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Diffusion Stochastic Edge Change Amount - * - * @return The Diffusion Stochastic Edge Change Amount - */ - - public double change() - { - return _dblChange; - } -} diff --git a/org/drip/measure/realization/StochasticEdgeJump.java b/org/drip/measure/realization/StochasticEdgeJump.java deleted file mode 100644 index 760aaf7..0000000 --- a/org/drip/measure/realization/StochasticEdgeJump.java +++ /dev/null @@ -1,130 +0,0 @@ - -package org.drip.measure.realization; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * StochasticEdgeJump holds the Edge of the Jump Stochastic Evaluator Outcome. - * - * @author Lakshmi Krishnamurthy - */ - -public class StochasticEdgeJump { - private boolean _bOccurred = false; - private double _dblTarget = java.lang.Double.NaN; - private double _dblHazardRate = java.lang.Double.NaN; - private double _dblHazardIntegral = java.lang.Double.NaN; - - /** - * StochasticEdgeJump Constructor - * - * @param bOccurred TRUE - The Jump Occurred in this Edge Period - * @param dblHazardRate The Hazard Rate - * @param dblHazardIntegral The Level Hazard Integral - * @param dblTarget The Jump Target - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public StochasticEdgeJump ( - final boolean bOccurred, - final double dblHazardRate, - final double dblHazardIntegral, - final double dblTarget) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblHazardRate = dblHazardRate) || - !org.drip.quant.common.NumberUtil.IsValid (_dblHazardIntegral = dblHazardIntegral) || - !org.drip.quant.common.NumberUtil.IsValid (_dblTarget = dblTarget)) - throw new java.lang.Exception ("StochasticEdgeJump Constructor => Invalid Inputs"); - - _bOccurred = bOccurred; - } - - /** - * Retrieve the "Jump Occurred in this Level Period" Flag - * - * @return The "Jump Occurred in this Level Period" Flag - */ - - public final boolean jumpOccurred() - { - return _bOccurred; - } - - /** - * Retrieve the Jump Occurrence Probability Density - * - * @return The Jump Occurrence Probability Density - */ - - public final double hazardRate() - { - return _dblHazardRate; - } - - /** - * Retrieve the Jump Occurrence Hazard Integral - * - * @return The Jump Occurrence Hazard Integral - */ - - public final double hazardIntegral() - { - return _dblHazardIntegral; - } - - /** - * Retrieve the Jump Target Value - * - * @return The Jump Target Value - */ - - public final double target() - { - return _dblTarget; - } -} diff --git a/org/drip/measure/realization/UnitRandom.java b/org/drip/measure/realization/UnitRandom.java deleted file mode 100644 index c44ebc0..0000000 --- a/org/drip/measure/realization/UnitRandom.java +++ /dev/null @@ -1,258 +0,0 @@ - -package org.drip.measure.realization; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * UnitRandom holds the Jump Diffusion R^1 Unit Edge Realizations. - * - * @author Lakshmi Krishnamurthy - */ - -public class UnitRandom { - private double _dblJump = java.lang.Double.NaN; - private double _dblDiffusion = java.lang.Double.NaN; - - /** - * Generate a R^1 Uniform Diffusion Realization - * - * @return The R^1 Uniform Diffusion Realization - */ - - public static final UnitRandom UniformDiffusion() - { - try { - return new UnitRandom (java.lang.Math.random(), 0.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate a R^1 Gaussian Diffusion Realization - * - * @return The R^1 Gaussian Diffusion Realization - */ - - public static final UnitRandom GaussianDiffusion() - { - try { - return new UnitRandom (org.drip.measure.gaussian.NormalQuadrature.Random(), 0.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate a R^1 Uniform Jump Realization - * - * @return The R^1 Uniform Jump Realization - */ - - public static final UnitRandom UniformJump() - { - try { - return new UnitRandom (0., java.lang.Math.random()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate a R^1 Gaussian Jump Realization - * - * @return The R^1 Gaussian Jump Realization - */ - - public static final UnitRandom GaussianJump() - { - try { - return new UnitRandom (0., org.drip.measure.gaussian.NormalQuadrature.Random()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate an Array of R^1 Diffusion Realizations - * - * @param adblDiffusionRealization The Array of Diffusion Realizations - * - * @return Array of R^1 Diffusion Realizations - */ - - public static final UnitRandom[] Diffusion ( - final double[] adblDiffusionRealization) - { - if (null == adblDiffusionRealization) return null; - - int iSize = adblDiffusionRealization.length; - UnitRandom[] aJDU = 0 == iSize ? null : new UnitRandom[iSize]; - - for (int i = 0; i < iSize; ++i) { - try { - aJDU[i] = new UnitRandom (adblDiffusionRealization[i], 0.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return aJDU; - } - - /** - * Generate an Array of R^1 Jump Realizations - * - * @param adblJumpRealization The Array of Jump Realizations - * - * @return Array of R^1 Jump Realizations - */ - - public static final UnitRandom[] Jump ( - final double[] adblJumpRealization) - { - if (null == adblJumpRealization) return null; - - int iSize = adblJumpRealization.length; - UnitRandom[] aJDU = 0 == iSize ? null : new UnitRandom[iSize]; - - for (int i = 0; i < iSize; ++i) { - try { - aJDU[i] = new UnitRandom (0., adblJumpRealization[i]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return aJDU; - } - - /** - * Generate an Array of R^1 Jump Diffusion Realizations - * - * @param adblDiffusionRealization The Array of Diffusion Realizations - * @param adblJumpRealization The Array of Jump Realizations - * - * @return Array of R^1 Jump Diffusion Realizations - */ - - public static final UnitRandom[] JumpDiffusion ( - final double[] adblDiffusionRealization, - final double[] adblJumpRealization) - { - if (null == adblDiffusionRealization || null == adblJumpRealization) return null; - - int iSize = adblDiffusionRealization.length; - UnitRandom[] aJDU = 0 == iSize ? null : new UnitRandom[iSize]; - - if (0 == iSize || iSize != adblJumpRealization.length) return null; - - for (int i = 0; i < iSize; ++i) { - try { - aJDU[i] = new UnitRandom (adblDiffusionRealization[i], adblJumpRealization[i]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return aJDU; - } - - /** - * UnitRandom Constructor - * - * @param dblDiffusion The Diffusion Random Variable - * @param dblJump The Jump Random Variable - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public UnitRandom ( - final double dblDiffusion, - final double dblJump) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblDiffusion = dblDiffusion) || - !org.drip.quant.common.NumberUtil.IsValid (_dblJump = dblJump)) - throw new java.lang.Exception ("UnitRandom Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Diffusion Unit Random Variable - * - * @return The Diffusion Unit Random Variable - */ - - public double diffusion() - { - return _dblDiffusion; - } - - /** - * Retrieve the Jump Unit Random Variable - * - * @return The Jump Unit Random Variable - */ - - public double jump() - { - return _dblJump; - } -} diff --git a/org/drip/measure/statistics/MultivariateMoments.java b/org/drip/measure/statistics/MultivariateMoments.java deleted file mode 100644 index 45054e3..0000000 --- a/org/drip/measure/statistics/MultivariateMoments.java +++ /dev/null @@ -1,325 +0,0 @@ - -package org.drip.measure.statistics; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * MultivariateMoments generates and holds the Specified Multivariate Series Mean, Co-variance, and other - * selected Moments. - * - * @author Lakshmi Krishnamurthy - */ - -public class MultivariateMoments { - private org.drip.analytics.support.CaseInsensitiveHashMap _mapMean = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - private org.drip.analytics.support.CaseInsensitiveHashMap _mapCovariance = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - /** - * Generate the MultivariateMetrics Instance from the Series Realizations provided - * - * @param astrVariateName Array of Variate Name Headers - * @param aadblVariate Array of Variate Realization Arrays - * - * @return The MultivariateMetrics Instance - */ - - public static final MultivariateMoments Standard ( - final java.lang.String[] astrVariateName, - final double[][] aadblVariate) - { - if (null == astrVariateName || null == aadblVariate) return null; - - int iNumVariate = astrVariateName.length; - double[] adblMean = new double[iNumVariate]; - - if (0 == iNumVariate || iNumVariate != aadblVariate.length) return null; - - int iNumSample = aadblVariate[0].length; - - if (0 == iNumSample) return null; - - MultivariateMoments mvm = new MultivariateMoments(); - - for (int i = 0; i < iNumVariate; ++i) { - adblMean[i] = 0.; - double[] adblVariateSample = aadblVariate[i]; - - if (null == adblVariateSample || adblVariateSample.length != iNumSample) return null; - - for (int k = 0; k < iNumSample; ++k) { - if (!org.drip.quant.common.NumberUtil.IsValid (adblVariateSample[k])) return null; - - adblMean[i] += adblVariateSample[k]; - } - - if (!mvm.addMean (astrVariateName[i], adblMean[i] /= iNumSample)) return null; - } - - for (int i = 0; i < iNumVariate; ++i) { - for (int j = 0; j < iNumVariate; ++j) { - double dblCovariance = 0.; - - for (int k = 0; k < iNumSample; ++k) - dblCovariance += (aadblVariate[i][k] - adblMean[i]) * (aadblVariate[j][k] - adblMean[j]); - - if (!mvm.addCovariance (astrVariateName[i], astrVariateName[j], dblCovariance / iNumSample)) - return null; - } - } - - return mvm; - } - - /** - * Generate the MultivariateMetrics Instance from the Specified Mean and Co-variance Inputs - * - * @param astrVariateName Array of Variate Name Headers - * @param adblMean Array of Variate Means - * @param aadblCovariance Double Array of the Variate Co-variance - * - * @return The MultivariateMetrics Instance - */ - - public static final MultivariateMoments Standard ( - final java.lang.String[] astrVariateName, - final double[] adblMean, - final double[][] aadblCovariance) - { - if (null == astrVariateName || null == adblMean || null == aadblCovariance) return null; - - int iNumVariate = astrVariateName.length; - - if (0 == iNumVariate || iNumVariate != adblMean.length || iNumVariate != aadblCovariance.length || - null == aadblCovariance[0] || iNumVariate != aadblCovariance[0].length) - return null; - - MultivariateMoments mvm = new MultivariateMoments(); - - for (int i = 0; i < iNumVariate; ++i) { - if (!mvm.addMean (astrVariateName[i], adblMean[i])) return null; - } - - for (int i = 0; i < iNumVariate; ++i) { - for (int j = 0; j < iNumVariate; ++j) { - if (!mvm.addCovariance (astrVariateName[i], astrVariateName[j], aadblCovariance[i][j])) - return null; - } - } - - return mvm; - } - - protected MultivariateMoments() - { - } - - /** - * Retrieve the Number of Variates in the Distribution - * - * @return The Number of Variates in the Distribution - */ - - public int numVariate() - { - return _mapMean.size(); - } - - /** - * Retrieve the Variates for which the Metrics are available - * - * @return The Set of Variates - */ - - public java.util.Set variateList() - { - return _mapMean.keySet(); - } - - /** - * Add the Mean for the Named Variate - * - * @param strVariateName The Named Variate - * @param dblMean The Variate Mean - * - * @return TRUE - The Variate Mean successfully added - */ - - public boolean addMean ( - final java.lang.String strVariateName, - final double dblMean) - { - if (null == strVariateName || strVariateName.isEmpty() || !org.drip.quant.common.NumberUtil.IsValid - (dblMean)) - return false; - - _mapMean.put (strVariateName, dblMean); - - return true; - } - - /** - * Retrieve the Mean of the Named Variate - * - * @param strVariateName The Named Variate - * - * @return Mean of the Named Variate - * - * @throws java.lang.Exception Thrown if the Named Variate Mean cannot be retrieved - */ - - public double mean ( - final java.lang.String strVariateName) - throws java.lang.Exception - { - if (null == strVariateName || strVariateName.isEmpty() || !_mapMean.containsKey (strVariateName)) - throw new java.lang.Exception ("MultivariateMetrics::mean => Invalid Inputs"); - - return _mapMean.get (strVariateName); - } - - /** - * Add the Co-variance for the Named Variate Pair - * - * @param strVariate1Name The Named Variate #1 - * @param strVariate2Name The Named Variate #2 - * @param dblCovariance The Variate Mean - * - * @return TRUE - The Variate Pair Co-variance successfully added - */ - - public boolean addCovariance ( - final java.lang.String strVariate1Name, - final java.lang.String strVariate2Name, - final double dblCovariance) - { - if (null == strVariate1Name || strVariate1Name.isEmpty() || null == strVariate2Name || - strVariate2Name.isEmpty() || !org.drip.quant.common.NumberUtil.IsValid (dblCovariance)) - return false; - - _mapCovariance.put (strVariate1Name + "@#" + strVariate2Name, dblCovariance); - - _mapCovariance.put (strVariate2Name + "@#" + strVariate1Name, dblCovariance); - - return true; - } - - /** - * Retrieve the Variance of the Named Variate - * - * @param strVariateName The Named Variate - * - * @return Variance of the Named Variate - * - * @throws java.lang.Exception Thrown if the Named Variate Variance cannot be retrieved - */ - - public double variance ( - final java.lang.String strVariateName) - throws java.lang.Exception - { - if (null == strVariateName || strVariateName.isEmpty()) - throw new java.lang.Exception ("MultivariateMetrics::variance => Invalid Inputs"); - - java.lang.String strVarianceEntry = strVariateName + "@#" + strVariateName; - - if (!_mapCovariance.containsKey (strVarianceEntry)) - throw new java.lang.Exception ("MultivariateMetrics::variance => Invalid Inputs"); - - return _mapCovariance.get (strVarianceEntry); - } - - /** - * Retrieve the Co-variance of the Named Variate Pair - * - * @param strVariate1Name The Named Variate #1 - * @param strVariate2Name The Named Variate #2 - * - * @return Co-variance of the Named Variate Pair - * - * @throws java.lang.Exception Thrown if the Named Variate Co-variance cannot be retrieved - */ - - public double covariance ( - final java.lang.String strVariate1Name, - final java.lang.String strVariate2Name) - throws java.lang.Exception - { - if (null == strVariate1Name || strVariate1Name.isEmpty() || null == strVariate2Name || - strVariate2Name.isEmpty()) - throw new java.lang.Exception ("MultivariateMetrics::covariance => Invalid Inputs"); - - java.lang.String strCovarianceEntry = strVariate1Name + "@#" + strVariate2Name; - - if (!_mapCovariance.containsKey (strCovarianceEntry)) - throw new java.lang.Exception ("MultivariateMetrics::coariance => Invalid Inputs"); - - return _mapCovariance.get (strCovarianceEntry); - } - - /** - * Retrieve the Correlation between the Named Variate Pair - * - * @param strVariate1Name The Named Variate #1 - * @param strVariate2Name The Named Variate #2 - * - * @return Correlation between the Named Variate Pair - * - * @throws java.lang.Exception Thrown if the Named Variate Correlation cannot be retrieved - */ - - public double correlation ( - final java.lang.String strVariate1Name, - final java.lang.String strVariate2Name) - throws java.lang.Exception - { - return covariance (strVariate1Name, strVariate2Name) / java.lang.Math.sqrt (variance - (strVariate1Name) * variance (strVariate2Name)); - } -} diff --git a/org/drip/measure/statistics/UnivariateMoments.java b/org/drip/measure/statistics/UnivariateMoments.java deleted file mode 100644 index 84e026c..0000000 --- a/org/drip/measure/statistics/UnivariateMoments.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.measure.statistics; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * UnivariateMoments generates and holds the Specified Univariate Series Mean, Variance, and a few selected - * Moments. - * - * @author Lakshmi Krishnamurthy - */ - -public class UnivariateMoments { - private int _iNumSample = 0; - private java.lang.String _strName = ""; - private double _dblMean = java.lang.Double.NaN; - private double _dblVariance = java.lang.Double.NaN; - private java.util.Map _mapMoment = null; - - /** - * Construct a UnivariateMoments Instance for the specified Series - * - * @param strName Series Name - * @param adblEntry Series Entry - * @param aiMoment Array of Moments to be Calculated - * - * @return The UnivariateMoments Instance - */ - - public static final UnivariateMoments Standard ( - final java.lang.String strName, - final double[] adblEntry, - final int[] aiMoment) - { - if (null == adblEntry) return null; - - double dblMean = 0.; - double dblVariance = 0.; - int iNumSample = adblEntry.length; - int iNumMoment = null == aiMoment ? 0 : aiMoment.length; - double[] adblMoment = 0 == iNumMoment ? null : new double[iNumMoment]; - - java.util.Map mapMoment = 0 == iNumMoment ? null : new - java.util.TreeMap(); - - if (0 == iNumSample) return null; - - for (int i = 0; i < iNumSample; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (adblEntry[i])) return null; - - dblMean += adblEntry[i]; - } - - dblMean /= iNumSample; - - for (int j = 0; j < iNumMoment; ++j) - adblMoment[j] = 0.; - - for (int i = 0; i < iNumSample; ++i) { - double dblError = dblMean - adblEntry[i]; - dblVariance += (dblError * dblError); - - for (int j = 0; j < iNumMoment; ++j) - adblMoment[j] = adblMoment[j] + java.lang.Math.pow (dblError, aiMoment[j]); - } - - for (int j = 0; j < iNumMoment; ++j) - mapMoment.put (aiMoment[j], adblMoment[j]); - - try { - return new UnivariateMoments (strName, dblMean, dblVariance / iNumSample, iNumSample, mapMoment); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a UnivariateMoments Instance for the specified Series - * - * @param strName Series Name - * @param adblEntry Series Entry - * - * @return The UnivariateMoments Instance - */ - - public static final UnivariateMoments Standard ( - final java.lang.String strName, - final double[] adblEntry) - { - return Standard (strName, adblEntry, null); - } - - protected UnivariateMoments ( - final java.lang.String strName, - final double dblMean, - final double dblVariance, - final int iNumSample, - final java.util.Map mapMoment) - throws java.lang.Exception - { - if (null == (_strName = strName) || _strName.isEmpty() || !org.drip.quant.common.NumberUtil.IsValid - (_dblMean = dblMean) || !org.drip.quant.common.NumberUtil.IsValid (_dblVariance = dblVariance) || - 0 >= (_iNumSample = iNumSample)) - throw new java.lang.Exception ("UnivariateMetrics Constructor => Invalid Inputs!"); - - _mapMoment = mapMoment; - } - - /** - * Retrieve the Series Name - * - * @return The Series Name - */ - - public java.lang.String name() - { - return _strName; - } - - /** - * Retrieve the Number of Samples - * - * @return The Number of Samples - */ - - public int numSample() - { - return _iNumSample; - } - - /** - * Retrieve the Series Mean - * - * @return The Series Mean - */ - - public double mean() - { - return _dblMean; - } - - /** - * Retrieve the Series Variance - * - * @return The Series Variance - */ - - public double variance() - { - return _dblVariance; - } - - /** - * Retrieve the Series Standard Deviation - * - * @return The Series Standard Deviation - */ - - public double stdDev() - { - return java.lang.Math.sqrt (_dblVariance); - } - - /** - * Retrieve the Moments Map - * - * @return The Map of Moments - */ - - public java.util.Map momentMap() - { - return _mapMoment; - } -} diff --git a/org/drip/measure/stochastic/R1R1ToR1.java b/org/drip/measure/stochastic/R1R1ToR1.java deleted file mode 100644 index 4cd5095..0000000 --- a/org/drip/measure/stochastic/R1R1ToR1.java +++ /dev/null @@ -1,151 +0,0 @@ - -package org.drip.measure.stochastic; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * R1R1ToR1 interface exposes the stubs for the evaluation of the objective function and its derivatives for - * a R^1 Deterministic + R^1 Random To R^1 Stochastic Function with one Random Component. - * - * @author Lakshmi Krishnamurthy - */ - -public interface R1R1ToR1 { - - /** - * Evaluate a Single Realization for the given variate - * - * @param dblVariate Variate - * - * @return Return the Single Realization for the given variate - * - * @throws java.lang.Exception Thrown if evaluation cannot be done - */ - - public abstract double evaluateRealization ( - final double dblVariate) - throws java.lang.Exception; - - /** - * Evaluate the Expectation for the given variate - * - * @param dblVariate Variate - * - * @return Return the Expectation for the given variate - * - * @throws java.lang.Exception Thrown if evaluation cannot be done - */ - - public abstract double evaluateExpectation ( - final double dblVariate) - throws java.lang.Exception; - - /** - * Evaluate the Derivative for a Single Realization for the given variate - * - * @param dblVariate Variate at which the derivative is to be calculated - * @param iOrder Order of the derivative to be computed - * - * @return Return the Derivative for a Single Realization for the given variate - * - * @throws java.lang.Exception Thrown if evaluation cannot be done - */ - - public abstract double derivativeRealization ( - final double dblVariate, - final int iOrder) - throws java.lang.Exception; - - /** - * Evaluate the Derivative Expectation at the given variate - * - * @param dblVariate Variate at which the derivative is to be calculated - * @param iOrder Order of the derivative to be computed - * - * @return Return the Derivative Expectation at the given variate - * - * @throws java.lang.Exception Thrown if evaluation cannot be done - */ - - public abstract double derivativeExpectation ( - final double dblVariate, - final int iOrder) - throws java.lang.Exception; - - /** - * Evaluate a Path-wise Integral between the Vriates - * - * @param dblStart Variate Start - * @param dblEnd Variate End - * - * @return The Path-wise Integral between the Variates - * - * @throws java.lang.Exception Thrown if evaluation cannot be done - */ - - public abstract double integralRealization ( - final double dblStart, - final double dblEnd) - throws java.lang.Exception; - - /** - * Evaluate the Expected Path-wise Integral between the Vriates - * - * @param dblStart Variate Start - * @param dblEnd Variate End - * - * @return The Expected Path-wise Integral between the Variates - * - * @throws java.lang.Exception Thrown if evaluation cannot be done - */ - - public abstract double integralExpectation ( - final double dblStart, - final double dblEnd) - throws java.lang.Exception; -} diff --git a/org/drip/optimization/constrained/FritzJohnMultipliers.java b/org/drip/optimization/constrained/FritzJohnMultipliers.java deleted file mode 100644 index 0690e64..0000000 --- a/org/drip/optimization/constrained/FritzJohnMultipliers.java +++ /dev/null @@ -1,202 +0,0 @@ - -package org.drip.optimization.constrained; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FritzJohnMultipliers holds the Array of the Fritz John/KKT Multipliers for the Array of the Equality and - * the Inequality Constraints, one per each Constraint. The References are: - * - * - Boyd, S., and L. van den Berghe (2009): Convex Optimization, Cambridge University Press, Cambridge UK. - * - * - Eustaquio, R., E. Karas, and A. Ribeiro (2008): Constraint Qualification for Nonlinear Programming, - * Technical Report, Federal University of Parana. - * - * - Karush, A. (1939): Minima of Functions of Several Variables with Inequalities as Side Constraints, - * M. Sc., University of Chicago, Chicago IL. - * - * - Kuhn, H. W., and A. W. Tucker (1951): Nonlinear Programming, Proceedings of the Second Berkeley - * Symposium, University of California, Berkeley CA 481-492. - * - * - Ruszczynski, A. (2006): Nonlinear Optimization, Princeton University Press, Princeton NJ. - * - * @author Lakshmi Krishnamurthy - */ - -public class FritzJohnMultipliers { - private double[] _adblEquality = null; - private double[] _adblInequality = null; - private double _dblObjectiveCoefficient = java.lang.Double.NaN; - - /** - * Construct a Standard KarushKuhnTucker (KKT) Instance of the Fritz John Multipliers - * - * @param adblEquality Array of the Equality Constraint Coefficients - * @param adblInequality Array of the Inequality Constraint Coefficients - * - * @return The KKT Instance of Fritz John Multipliers - */ - - public static final FritzJohnMultipliers KarushKuhnTucker ( - final double[] adblEquality, - final double[] adblInequality) - { - try { - return new FritzJohnMultipliers (1., adblEquality, adblInequality); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * FritzJohnMultipliers Constructor - * - * @param dblObjectiveCoefficient The Objective Function Coefficient - * @param adblEquality Array of the Equality Constraint Coefficients - * @param adblInequality Array of the Inequality Constraint Coefficients - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public FritzJohnMultipliers ( - final double dblObjectiveCoefficient, - final double[] adblEquality, - final double[] adblInequality) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblObjectiveCoefficient = dblObjectiveCoefficient)) - throw new java.lang.Exception ("FritzJohnMultipliers Constructor => Invalid Inputs"); - - _adblEquality = adblEquality; - _adblInequality = adblInequality; - } - - /** - * Retrieve the Fritz John Objective Function Multiplier - * - * @return The Fritz John Objective Function Multiplier - */ - - public double objectiveCoefficient() - { - return _dblObjectiveCoefficient; - } - - /** - * Retrieve the Array of the Equality Constraint Coefficients - * - * @return The Array of the Equality Constraint Coefficients - */ - - public double[] equalityConstraintCoefficient() - { - return _adblEquality; - } - - /** - * Retrieve the Array of the Inequality Constraint Coefficients - * - * @return The Array of the Inequality Constraint Coefficients - */ - - public double[] inequalityConstraintCoefficient() - { - return _adblInequality; - } - - /** - * Retrieve the Number of Equality Multiplier Coefficients - * - * @return The Number of Equality Multiplier Coefficients - */ - - public int numEqualityCoefficients() - { - return null == _adblEquality ? 0 : _adblEquality.length; - } - - /** - * Retrieve the Number of Inequality Multiplier Coefficients - * - * @return The Number of Inequality Multiplier Coefficients - */ - - public int numInequalityCoefficients() - { - return null == _adblInequality ? 0 : _adblInequality.length; - } - - /** - * Retrieve the Number of Total KKT Multiplier Coefficients - * - * @return The Number of Total KKT Multiplier Coefficients - */ - - public int numTotalCoefficients() - { - return numEqualityCoefficients() + numInequalityCoefficients(); - } - - /** - * Indicate of the Multipliers constitute Valid Dual Feasibility - * - * @return TRUE - The Multipliers constitute Valid Dual Feasibility - */ - - public boolean dualFeasibilityCheck() - { - int iNumInequalityCoefficient = numInequalityCoefficients(); - - for (int i = 0; i < iNumInequalityCoefficient; ++i) { - if (0. > _adblInequality[i]) return false; - } - - return true; - } -} diff --git a/org/drip/optimization/constrained/NecessarySufficientConditions.java b/org/drip/optimization/constrained/NecessarySufficientConditions.java deleted file mode 100644 index aba5784..0000000 --- a/org/drip/optimization/constrained/NecessarySufficientConditions.java +++ /dev/null @@ -1,276 +0,0 @@ - -package org.drip.optimization.constrained; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NecessarySufficientConditions holds the Results of the Verification of the Necessary and the Sufficient - * Conditions at the specified (possibly) Optimal Variate and the corresponding Fritz John Multiplier Suite. - * The References are: - * - * - Boyd, S., and L. van den Berghe (2009): Convex Optimization, Cambridge University Press, Cambridge UK. - * - * - Eustaquio, R., E. Karas, and A. Ribeiro (2008): Constraint Qualification for Nonlinear Programming, - * Technical Report, Federal University of Parana. - * - * - Karush, A. (1939): Minima of Functions of Several Variables with Inequalities as Side Constraints, - * M. Sc., University of Chicago, Chicago IL. - * - * - Kuhn, H. W., and A. W. Tucker (1951): Nonlinear Programming, Proceedings of the Second Berkeley - * Symposium, University of California, Berkeley CA 481-492. - * - * - Ruszczynski, A. (2006): Nonlinear Optimization, Princeton University Press, Princeton NJ. - * - * @author Lakshmi Krishnamurthy - */ - -public class NecessarySufficientConditions { - private double[] _adblVariate = null; - private boolean _bCheckForMinima = false; - private org.drip.optimization.constrained.FritzJohnMultipliers _fjm = null; - private org.drip.optimization.necessary.ConditionQualifierFONC _cqFONC = null; - private org.drip.optimization.necessary.ConditionQualifierSOSC _cqSOSC = null; - private org.drip.optimization.necessary.ConditionQualifierDualFeasibility _cqDualFeasibility = null; - private org.drip.optimization.necessary.ConditionQualifierPrimalFeasibility _cqPrimalFeasibility = - null; - private org.drip.optimization.necessary.ConditionQualifierComplementarySlackness - _cqComplementarySlackness = null; - - /** - * Create a Standard Instance of NecessarySufficientConditions - * - * @param adblVariate The Candidate Variate Array - * @param fjm The Fritz John Multipliers - * @param bCheckForMinima TRUE - Check For Minima - * @param bPrimalFeasibilityValidity The Primal Feasibility Validity - * @param bDualFeasibilityValidity The Dual Feasibility Validity - * @param bComplementarySlacknessValidity The Complementary Slackness Validity - * @param bFONCValidity The FONC Validity - * @param bSOSCValidity The SOSC Validity - * - * @return The Standard NecessarySufficientConditions Instance - */ - - public static final NecessarySufficientConditions Standard ( - final double[] adblVariate, - final org.drip.optimization.constrained.FritzJohnMultipliers fjm, - final boolean bCheckForMinima, - final boolean bPrimalFeasibilityValidity, - final boolean bDualFeasibilityValidity, - final boolean bComplementarySlacknessValidity, - final boolean bFONCValidity, - final boolean bSOSCValidity) - { - try { - return new NecessarySufficientConditions (adblVariate, fjm, bCheckForMinima, new - org.drip.optimization.necessary.ConditionQualifierPrimalFeasibility - (bPrimalFeasibilityValidity), new - org.drip.optimization.necessary.ConditionQualifierDualFeasibility - (bDualFeasibilityValidity), new - org.drip.optimization.necessary.ConditionQualifierComplementarySlackness - (bComplementarySlacknessValidity), new - org.drip.optimization.necessary.ConditionQualifierFONC - (bFONCValidity), new - org.drip.optimization.necessary.ConditionQualifierSOSC - (bSOSCValidity)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * NecessarySufficientConditions Constructor - * - * @param adblVariate The Candidate Variate Array - * @param fjm The Fritz John Multipliers - * @param bCheckForMinima TRUE - Check For Minima - * @param cqPrimalFeasibility The Primal Feasibility Necessary Condition - * @param cqDualFeasibility The Dual Feasibility Necessary Condition - * @param cqComplementarySlackness The Complementary Slackness Necessary Condition - * @param cqFONC The First Order Necessary Condition - * @param cqSOSC The Second Order Sufficiency Condition - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public NecessarySufficientConditions ( - final double[] adblVariate, - final org.drip.optimization.constrained.FritzJohnMultipliers fjm, - final boolean bCheckForMinima, - final org.drip.optimization.necessary.ConditionQualifierPrimalFeasibility cqPrimalFeasibility, - final org.drip.optimization.necessary.ConditionQualifierDualFeasibility cqDualFeasibility, - final org.drip.optimization.necessary.ConditionQualifierComplementarySlackness - cqComplementarySlackness, - final org.drip.optimization.necessary.ConditionQualifierFONC cqFONC, - final org.drip.optimization.necessary.ConditionQualifierSOSC cqSOSC) - throws java.lang.Exception - { - if (null == (_adblVariate = adblVariate) || 0 == _adblVariate.length || null == (_fjm = fjm) || null - == (_cqPrimalFeasibility = cqPrimalFeasibility) || null == (_cqDualFeasibility = - cqDualFeasibility) || null == (_cqComplementarySlackness = cqComplementarySlackness) || null - == (_cqFONC = cqFONC) || null == (_cqSOSC = cqSOSC)) - throw new java.lang.Exception ("NecessarySufficientConditions Constructor => Invalid Inputs"); - - _bCheckForMinima = bCheckForMinima; - } - - /** - * Retrieve the Candidate Variate Array - * - * @return The Candidate Variate Array - */ - - public double[] variate() - { - return _adblVariate; - } - - /** - * Retrieve the Fritz John Mutipliers - * - * @return The Fritz John Mutipliers - */ - - public org.drip.optimization.constrained.FritzJohnMultipliers fritzJohnMultipliers() - { - return _fjm; - } - - /** - * Retrieve if the Check corresponds to Local Minima - * - * @return TRUE - The Check corresponds to Local Minima - */ - - public boolean checkFroMinima() - { - return _bCheckForMinima; - } - - /** - * Retrieve the Primal Feasibility Necessary Condition - * - * @return The Primal Feasibility Necessary Condition - */ - - public org.drip.optimization.necessary.ConditionQualifierPrimalFeasibility primalFeasibility() - { - return _cqPrimalFeasibility; - } - - /** - * Retrieve the Dual Feasibility Necessary Condition - * - * @return The Dual Feasibility Necessary Condition - */ - - public org.drip.optimization.necessary.ConditionQualifierDualFeasibility dualFeasibility() - { - return _cqDualFeasibility; - } - - /** - * Retrieve the Complementary Slackness Necessary Condition - * - * @return The Complementary Slackness Necessary Condition - */ - - public org.drip.optimization.necessary.ConditionQualifierComplementarySlackness - complementarySlackness() - { - return _cqComplementarySlackness; - } - - /** - * Retrieve the First Order Necessary Condition - * - * @return The First Order Necessary Condition - */ - - public org.drip.optimization.necessary.ConditionQualifierFONC fonc() - { - return _cqFONC; - } - - /** - * Retrieve the Second Order Sufficiency Condition - * - * @return The Second Order Sufficiency Condition - */ - - public org.drip.optimization.necessary.ConditionQualifierSOSC sosc() - { - return _cqSOSC; - } - - /** - * Indicate the Necessary/Sufficient Validity across all the Condition Qualifiers - * - * @return TRUE - The Necessary/Sufficient Criteria is satisfied across all the Condition Qualifiers - */ - - public boolean valid() - { - return _cqPrimalFeasibility.valid() && _cqDualFeasibility.valid() && - _cqComplementarySlackness.valid() && _cqFONC.valid() && _cqSOSC.valid(); - } - - /** - * Retrieve the Array of Condition Orders - * - * @return The Array of Condition Orders - */ - - public java.lang.String[] conditionOrder() - { - return new java.lang.String[] {"ZERO ORDER: " + _cqPrimalFeasibility.display() + " >> " + - _cqDualFeasibility.display() + " >> " + _cqComplementarySlackness.display(), "FIRST ORDER: " + - _cqFONC.display(), "SECOND ORDER: " + _cqSOSC.display()}; - } -} diff --git a/org/drip/optimization/constrained/OptimizationFramework.java b/org/drip/optimization/constrained/OptimizationFramework.java deleted file mode 100644 index 42305df..0000000 --- a/org/drip/optimization/constrained/OptimizationFramework.java +++ /dev/null @@ -1,857 +0,0 @@ - -package org.drip.optimization.constrained; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OptimizationFramework holds the Non Linear Objective Function and the Collection of Equality and the - * Inequality Constraints that correspond to the Optimization Setup. The References are: - * - * - Boyd, S., and L. van den Berghe (2009): Convex Optimization, Cambridge University Press, Cambridge UK. - * - * - Eustaquio, R., E. Karas, and A. Ribeiro (2008): Constraint Qualification for Nonlinear Programming, - * Technical Report, Federal University of Parana. - * - * - Karush, A. (1939): Minima of Functions of Several Variables with Inequalities as Side Constraints, - * M. Sc., University of Chicago, Chicago IL. - * - * - Kuhn, H. W., and A. W. Tucker (1951): Nonlinear Programming, Proceedings of the Second Berkeley - * Symposium, University of California, Berkeley CA 481-492. - * - * - Ruszczynski, A. (2006): Nonlinear Optimization, Princeton University Press, Princeton NJ. - * - * @author Lakshmi Krishnamurthy - */ - -public class OptimizationFramework { - private org.drip.function.definition.RdToR1 _rdToR1Objective = null; - private org.drip.function.definition.RdToR1[] _aRdToR1EqualityConstraint = null; - private org.drip.function.definition.RdToR1[] _aRdToR1InequalityConstraint = null; - - /** - * OptimizationFramework Constructor - * - * @param rdToR1Objective The R^d To R^1 Objective Function - * @param aRdToR1EqualityConstraint The Array of R^d To R^1 Equality Constraint Functions - * @param aRdToR1InequalityConstraint The Array of R^d To R^1 Inequality Constraint Functions - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public OptimizationFramework ( - final org.drip.function.definition.RdToR1 rdToR1Objective, - final org.drip.function.definition.RdToR1[] aRdToR1EqualityConstraint, - final org.drip.function.definition.RdToR1[] aRdToR1InequalityConstraint) - throws java.lang.Exception - { - if (null == (_rdToR1Objective = rdToR1Objective)) - throw new java.lang.Exception ("OptimizationFramework Constructor => Invalid Inputs"); - - int iObjectiveDimension = _rdToR1Objective.dimension(); - - if (null != (_aRdToR1EqualityConstraint = aRdToR1EqualityConstraint)) { - int iNumEqualityConstraint = _aRdToR1EqualityConstraint.length; - - for (int i = 0; i < iNumEqualityConstraint; ++i) { - if (null == _aRdToR1EqualityConstraint[i] || _aRdToR1EqualityConstraint[i].dimension() != - iObjectiveDimension) - throw new java.lang.Exception ("OptimizationFramework Constructor => Invalid Inputs"); - } - } - - if (null != (_aRdToR1InequalityConstraint = aRdToR1InequalityConstraint)) { - int iNumInequalityConstraint = _aRdToR1InequalityConstraint.length; - - for (int i = 0; i < iNumInequalityConstraint; ++i) { - if (null == _aRdToR1InequalityConstraint[i] || _aRdToR1InequalityConstraint[i].dimension() != - iObjectiveDimension) - throw new java.lang.Exception ("OptimizationFramework Constructor => Invalid Inputs"); - } - } - } - - /** - * Retrieve the R^d To R^1 Objective Function - * - * @return The R^d To R^1 Objective Function - */ - - public org.drip.function.definition.RdToR1 objectiveFunction() - { - return _rdToR1Objective; - } - - /** - * Retrieve the Array of R^d To R^1 Equality Constraint Functions - * - * @return The Array of R^d To R^1 Equality Constraint Functions - */ - - public org.drip.function.definition.RdToR1[] equalityConstraint() - { - return _aRdToR1EqualityConstraint; - } - - /** - * Retrieve the Array of R^d To R^1 Inequality Constraint Functions - * - * @return The Array of R^d To R^1 Inequality Constraint Functions - */ - - public org.drip.function.definition.RdToR1[] inequalityConstraint() - { - return _aRdToR1InequalityConstraint; - } - - /** - * Retrieve the Number of Equality Constraints - * - * @return The Number of Equality Constraints - */ - - public int numEqualityConstraint() - { - return null == _aRdToR1EqualityConstraint ? 0 : _aRdToR1EqualityConstraint.length; - } - - /** - * Retrieve the Number of Inequality Constraints - * - * @return The Number of Inequality Constraints - */ - - public int numInequalityConstraint() - { - return null == _aRdToR1InequalityConstraint ? 0 : _aRdToR1InequalityConstraint.length; - } - - /** - * Indicate if the Optimizer Framework is Lagrangian - * - * @return TRUE - The Optimizer Framework is Lagrangian - */ - - public boolean isLagrangian() - { - return 0 == numInequalityConstraint() && 0 != numEqualityConstraint(); - } - - /** - * Indicate if the Optimizer Framework is Unconstrained - * - * @return TRUE - The Optimizer Framework is Unconstrained - */ - - public boolean isUnconstrained() - { - return 0 == numInequalityConstraint() && 0 == numEqualityConstraint(); - } - - /** - * Indicate if the specified Fritz John Multipliers are compatible with the Optimization Framework - * - * @param fjm The specified FJM Multipliers - * - * @return TRUE - The specified Fritz John Multipliers are compatible with the Optimization Framework - */ - - public boolean isCompatible ( - final org.drip.optimization.constrained.FritzJohnMultipliers fjm) - { - int iNumEqualityConstraint = numEqualityConstraint(); - - int iNumInequalityConstraint = numInequalityConstraint(); - - int iNumEqualityFJMMultiplier = null == fjm ? 0 : fjm.numEqualityCoefficients(); - - if (iNumEqualityConstraint != iNumEqualityFJMMultiplier) return false; - - int iNumInequalityFJMMultiplier = null == fjm ? 0 : fjm.numInequalityCoefficients(); - - return iNumInequalityConstraint == iNumInequalityFJMMultiplier; - } - - /** - * Check the Candidate Point for Primal Feasibility - * - * @param adblVariate The Candidate R^d Variate - * - * @return TRUE - The Candidate Point has passed the Primal Feasibility Test - * - * @throws java.lang.Exception Thrown if the Input in Invalid - */ - - public boolean primalFeasibilityCheck ( - final double[] adblVariate) - throws java.lang.Exception - { - int iNumEqualityConstraint = numEqualityConstraint(); - - int iNumInequalityConstraint = numInequalityConstraint(); - - for (int i = 0; i < iNumEqualityConstraint; ++i) { - if (0. != _aRdToR1EqualityConstraint[i].evaluate (adblVariate)) return false; - } - - for (int i = 0; i < iNumInequalityConstraint; ++i) { - if (0. < _aRdToR1InequalityConstraint[i].evaluate (adblVariate)) return false; - } - - return true; - } - - /** - * Check for Complementary Slackness across the Inequality Constraints - * - * @param fjm The specified Fritz John Multipliers - * @param adblVariate The Candidate R^d Variate - * - * @return TRUE - The Complementary Slackness Test passed - * - * @throws java.lang.Exception Thrown if the Input in Invalid - */ - - public boolean complementarySlacknessCheck ( - final org.drip.optimization.constrained.FritzJohnMultipliers fjm, - final double[] adblVariate) - throws java.lang.Exception - { - if (!isCompatible (fjm)) - throw new java.lang.Exception - ("OptimizationFramework::complementarySlacknessCheck => Invalid Inputs"); - - int iNumInequalityConstraint = numInequalityConstraint(); - - double[] adblInequalityConstraintCoefficient = null == fjm ? null : - fjm.inequalityConstraintCoefficient(); - - for (int i = 0; i < iNumInequalityConstraint; ++i) { - if (0. != _aRdToR1InequalityConstraint[i].evaluate (adblVariate) * - adblInequalityConstraintCoefficient[i]) - return false; - } - - return true; - } - - /** - * Check the Candidate Point for First Order Necessary Condition - * - * @param fjm The specified Fritz John Multipliers - * @param adblVariate The Candidate R^d Variate - * - * @return TRUE - The Candidate Point satisfied the First Order Necessary Condition - * - * @throws java.lang.Exception Thrown if the Input in Invalid - */ - - public boolean isFONC ( - final org.drip.optimization.constrained.FritzJohnMultipliers fjm, - final double[] adblVariate) - throws java.lang.Exception - { - if (!isCompatible (fjm)) - throw new java.lang.Exception ("OptimizationFramework::isFONC => Invalid Inputs"); - - double[] adblFONCJacobian = _rdToR1Objective.jacobian (adblVariate); - - if (null == adblFONCJacobian) - throw new java.lang.Exception ("OptimizationFramework::isFONC => Cannot calculate Jacobian"); - - int iNumEqualityConstraint = numEqualityConstraint(); - - int iNumInequalityConstraint = numInequalityConstraint(); - - double[] adblEqualityConstraintCoefficient = null == fjm ? null : - fjm.equalityConstraintCoefficient(); - - double[] adblInequalityConstraintCoefficient = null == fjm ? null : - fjm.inequalityConstraintCoefficient(); - - int iDimension = _rdToR1Objective.dimension(); - - for (int i = 0; i < iNumEqualityConstraint; ++i) { - double[] adblJacobian = _aRdToR1EqualityConstraint[i].jacobian (adblVariate); - - if (null == adblJacobian) - throw new java.lang.Exception ("OptimizationFramework::isFONC => Cannot calculate Jacobian"); - - for (int j = 0; j < iDimension; ++j) - adblFONCJacobian[j] = adblFONCJacobian[j] + adblEqualityConstraintCoefficient[j] * - adblJacobian[j]; - } - - for (int i = 0; i < iNumInequalityConstraint; ++i) { - double[] adblJacobian = _aRdToR1InequalityConstraint[i].jacobian (adblVariate); - - if (null == adblJacobian) - throw new java.lang.Exception ("OptimizationFramework::isFONC => Cannot calculate Jacobian"); - - for (int j = 0; j < iDimension; ++j) - adblFONCJacobian[j] = adblFONCJacobian[j] + adblInequalityConstraintCoefficient[j] * - adblJacobian[j]; - } - - for (int j = 0; j < iDimension; ++j) { - if (0. != adblFONCJacobian[j]) return false; - } - - return true; - } - - /** - * Check the Candidate Point for Second Order Sufficiency Condition - * - * @param fjm The specified Fritz John Multipliers - * @param adblVariate The Candidate R^d Variate - * @param bCheckForMinima TRUE - Check whether the R^d Variate corresponds to the SOSC Minimum - * - * @return TRUE - The Candidate Point satisfies the Second Order Sufficiency Condition - * - * @throws java.lang.Exception Thrown if the Input in Invalid - */ - - public boolean isSOSC ( - final org.drip.optimization.constrained.FritzJohnMultipliers fjm, - final double[] adblVariate, - final boolean bCheckForMinima) - throws java.lang.Exception - { - if (!isFONC (fjm, adblVariate)) return false; - - double[][] aadblSOSCHessian = _rdToR1Objective.hessian (adblVariate); - - if (null == aadblSOSCHessian) - throw new java.lang.Exception ("OptimizationFramework::isSOSC => Cannot calculate Jacobian"); - - int iNumEqualityConstraint = numEqualityConstraint(); - - int iNumInequalityConstraint = numInequalityConstraint(); - - double[] adblEqualityConstraintCoefficient = null == fjm ? null : - fjm.equalityConstraintCoefficient(); - - double[] adblInequalityConstraintCoefficient = null == fjm ? null : - fjm.inequalityConstraintCoefficient(); - - int iDimension = _rdToR1Objective.dimension(); - - for (int i = 0; i < iNumEqualityConstraint; ++i) { - double[][] aadblHessian = _aRdToR1EqualityConstraint[i].hessian (adblVariate); - - if (null == aadblHessian) - throw new java.lang.Exception ("OptimizationFramework::isSOSC => Cannot calculate Jacobian"); - - for (int j = 0; j < iDimension; ++j) { - for (int k = 0; k < iDimension; ++k) - aadblSOSCHessian[j][k] = aadblSOSCHessian[j][k] + adblEqualityConstraintCoefficient[j] * - aadblHessian[j][k]; - } - } - - for (int i = 0; i < iNumInequalityConstraint; ++i) { - double[][] aadblHessian = _aRdToR1InequalityConstraint[i].hessian (adblVariate); - - if (null == aadblHessian) - throw new java.lang.Exception ("OptimizationFramework::isSOSC => Cannot calculate Jacobian"); - - for (int j = 0; j < iDimension; ++j) { - for (int k = 0; k < iDimension; ++k) - aadblSOSCHessian[j][k] = aadblSOSCHessian[j][k] + adblInequalityConstraintCoefficient[j] - * aadblHessian[j][k]; - } - } - - double dblSOSC = org.drip.quant.linearalgebra.Matrix.DotProduct (adblVariate, - org.drip.quant.linearalgebra.Matrix.Product (aadblSOSCHessian, adblVariate)); - - return (bCheckForMinima && dblSOSC > 0.) || (!bCheckForMinima && dblSOSC < 0.); - } - - /** - * Generate the Battery of Necessary and Sufficient Qualification Tests - * - * @param fjm The specified Fritz John Multipliers - * @param adblVariate The Candidate R^d Variate - * @param bCheckForMinima TRUE - Check whether the R^d Variate corresponds to the SOSC Minimum - * - * @return The Necessary and Sufficient Conditions Qualifier Instance - */ - - public org.drip.optimization.constrained.NecessarySufficientConditions necessarySufficientQualifier ( - final org.drip.optimization.constrained.FritzJohnMultipliers fjm, - final double[] adblVariate, - final boolean bCheckForMinima) - { - try { - return org.drip.optimization.constrained.NecessarySufficientConditions.Standard (adblVariate, fjm, - bCheckForMinima, primalFeasibilityCheck (adblVariate), fjm.dualFeasibilityCheck(), - complementarySlacknessCheck (fjm, adblVariate), isFONC (fjm, adblVariate), isSOSC (fjm, - adblVariate, bCheckForMinima)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Array of Active Constraints - * - * @param adblVariate The R^d Variate - * - * @return The Array of Active Constraints - */ - - public org.drip.function.definition.RdToR1[] activeConstraints ( - final double[] adblVariate) - { - int iNumEqualityConstraint = numEqualityConstraint(); - - int iNumInequalityConstraint = numInequalityConstraint(); - - java.util.List lsActiveConstraint = new - java.util.ArrayList(); - - for (int i = 0; i < iNumEqualityConstraint; ++i) - lsActiveConstraint.add (_aRdToR1EqualityConstraint[i]); - - for (int i = 0; i < iNumInequalityConstraint; ++i) { - try { - if (0. == _aRdToR1InequalityConstraint[i].evaluate (adblVariate)) - lsActiveConstraint.add (_aRdToR1InequalityConstraint[i]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - int iNumActiveConstraint = lsActiveConstraint.size(); - - org.drip.function.definition.RdToR1[] aRdToR1ActiveConstraint = new - org.drip.function.definition.RdToR1[iNumActiveConstraint]; - - for (int i = 0; i < iNumActiveConstraint; ++i) - aRdToR1ActiveConstraint[i] = lsActiveConstraint.get (i); - - return aRdToR1ActiveConstraint; - } - - /** - * Active Constraint Set Rank Computation - * - * @param adblVariate The Candidate R^d Variate - * - * @return The Active Constraint Set Rank - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public int activeConstraintRank ( - final double[] adblVariate) - throws java.lang.Exception - { - int iNumEqualityConstraint = numEqualityConstraint(); - - int iNumInequalityConstraint = numInequalityConstraint(); - - java.util.List lsJacobian = new java.util.ArrayList(); - - double[] adblJacobian = _rdToR1Objective.jacobian (adblVariate); - - if (null == adblJacobian) - throw new java.lang.Exception ("OptimizationFramework::activeConstraintRank => Cannot Compute"); - - lsJacobian.add (adblJacobian); - - for (int i = 0; i < iNumEqualityConstraint; ++i) { - if (null == (adblJacobian = _aRdToR1EqualityConstraint[i].jacobian (adblVariate))) - throw new java.lang.Exception - ("OptimizationFramework::activeConstraintRank => Cannot Compute"); - - lsJacobian.add (adblJacobian); - } - - for (int i = 0; i < iNumInequalityConstraint; ++i) { - if (0. == _aRdToR1InequalityConstraint[i].evaluate (adblVariate)) { - if (null == (adblJacobian = _aRdToR1InequalityConstraint[i].jacobian (adblVariate))) - throw new java.lang.Exception - ("OptimizationFramework::activeConstraintRank => Cannot Compute"); - - lsJacobian.add (adblJacobian); - } - } - - int iNumJacobian = lsJacobian.size(); - - double[][] aadblJacobian = new double[iNumJacobian][]; - - for (int i = 0; i < iNumJacobian; ++i) - aadblJacobian[i] = lsJacobian.get (i); - - return org.drip.quant.linearalgebra.Matrix.Rank (aadblJacobian); - } - - /** - * Compare the Active Constraint Set Rank at the specified against the specified Rank - * - * @param adblVariate The Candidate R^d Variate - * @param iRank The specified Rank - * - * @return TRUE - Active Constraint Set Rank matches the specified Rank - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public boolean activeConstraintRankComparison ( - final double[] adblVariate, - final int iRank) - throws java.lang.Exception - { - return activeConstraintRank (adblVariate) == iRank; - } - - /** - * Active Constraint Set Linear Dependence Check - * - * @param adblVariate The Candidate R^d Variate - * @param bPositiveLinearDependenceCheck TRUE - Perform an Additional Positive Dependence Check - * - * @return TRUE - Active Constraint Set Linear Dependence Check is satisfied - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public boolean activeConstraintLinearDependence ( - final double[] adblVariate, - final boolean bPositiveLinearDependenceCheck) - throws java.lang.Exception - { - int iNumEqualityConstraint = numEqualityConstraint(); - - int iNumInequalityConstraint = numInequalityConstraint(); - - int iNumConstraint = iNumEqualityConstraint + iNumInequalityConstraint; - double[][] aadblJacobian = new double[iNumConstraint][]; - - for (int i = 0; i < iNumEqualityConstraint; ++i) { - if (null == (aadblJacobian[i] = _aRdToR1EqualityConstraint[i].jacobian (adblVariate))) - return false; - } - - for (int i = iNumEqualityConstraint; i < iNumConstraint; ++i) { - aadblJacobian[i] = null; - org.drip.function.definition.RdToR1 rdToR1InequalityConstraint = - _aRdToR1InequalityConstraint[i - iNumEqualityConstraint]; - - if (0. == rdToR1InequalityConstraint.evaluate (adblVariate)) { - if (null == (aadblJacobian[i] = rdToR1InequalityConstraint.jacobian (adblVariate))) - return false; - } - } - - for (int i = 0; i < iNumConstraint; ++i) { - if (null != aadblJacobian[i]) { - for (int j = i + 1; j < iNumConstraint; ++j) { - if (null != aadblJacobian[j] && 0. != org.drip.quant.linearalgebra.Matrix.DotProduct - (aadblJacobian[i], aadblJacobian[j])) - return false; - } - } - } - - if (bPositiveLinearDependenceCheck) { - for (int i = 0; i < iNumConstraint; ++i) { - if (null != aadblJacobian[i] && - !org.drip.quant.linearalgebra.Matrix.PositiveLinearlyIndependent (aadblJacobian[i])) - return false; - } - } - - return true; - } - - /** - * Compute the Along/Away "Naturally" Incremented Variates - * - * @param adblVariate The Candidate R^d Variate - * - * @return The Along/Away "Natural" Incremented Variates - */ - - public double[][] alongAwayVariate ( - final double[] adblVariate) - { - double[] adblVariateIncrement = org.drip.quant.linearalgebra.Matrix.Product - (org.drip.quant.linearalgebra.Matrix.InvertUsingGaussianElimination (_rdToR1Objective.hessian - (adblVariate)), _rdToR1Objective.jacobian (adblVariate)); - - if (null == adblVariateIncrement) return null; - - int iVariateDimension = adblVariate.length; - double[] adblVariateAway = new double[iVariateDimension]; - double[] adblVariateAlong = new double[iVariateDimension]; - - for (int i = 0; i < iVariateDimension; ++i) { - adblVariateAway[i] = adblVariate[i] - adblVariateIncrement[i]; - adblVariateAlong[i] = adblVariate[i] + adblVariateIncrement[i]; - } - - return new double[][] {adblVariateAlong, adblVariateAway}; - } - - /** - * Check for Linearity Constraint Qualification - * - * @return TRUE - Linearity Constraint Qualification is satisfied - */ - - public boolean isLCQ() - { - int iNumEqualityConstraint = numEqualityConstraint(); - - int iNumInequalityConstraint = numInequalityConstraint(); - - for (int i = 0; i < iNumEqualityConstraint; ++i) { - if (!(_aRdToR1EqualityConstraint[i] instanceof org.drip.function.rdtor1.AffineMultivariate)) - return false; - } - - for (int i = 0; i < iNumInequalityConstraint; ++i) { - if (!(_aRdToR1InequalityConstraint[i] instanceof org.drip.function.rdtor1.AffineMultivariate)) - return false; - } - - return true; - } - - /** - * Check for Linearity Independent Constraint Qualification - * - * @param adblVariate The Candidate R^d Variate - * - * @return TRUE - Linearity Independent Constraint Qualification is satisfied - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public boolean isLICQ ( - final double[] adblVariate) - throws java.lang.Exception - { - return activeConstraintLinearDependence (adblVariate, false); - } - - /** - * Check for Mangasarian Fromovitz Constraint Qualification - * - * @param adblVariate The Candidate R^d Variate - * - * @return TRUE - The Mangasarian Fromovitz Constraint Qualification is satisfied - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public boolean isMFCQ ( - final double[] adblVariate) - throws java.lang.Exception - { - return activeConstraintLinearDependence (adblVariate, true); - } - - /** - * Check for Constant Rank Constraint Qualification - * - * @param adblVariate The Candidate R^d Variate - * - * @return TRUE - The Constant Rank Constraint Qualification is satisfied - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public boolean isCRCQ ( - final double[] adblVariate) - throws java.lang.Exception - { - int iRank = activeConstraintRank (adblVariate); - - double[][] aadblAlongAwayVariatePair = alongAwayVariate (adblVariate); - - if (null == aadblAlongAwayVariatePair) - throw new java.lang.Exception ("OptimizationFramework::isCRCQ => Cannot generate along/away"); - - return iRank == activeConstraintRank (aadblAlongAwayVariatePair[0]) && iRank == activeConstraintRank - (aadblAlongAwayVariatePair[1]); - } - - /** - * Check for Constant Positive Linear Dependence Constraint Qualification - * - * @param adblVariate The Candidate R^d Variate - * - * @return TRUE - The Constant Positive Linear Dependence Constraint Qualification is satisfied - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public boolean isCPLDCQ ( - final double[] adblVariate) - throws java.lang.Exception - { - if (!isMFCQ (adblVariate)) return false; - - double[][] aadblAlongAwayVariatePair = alongAwayVariate (adblVariate); - - if (null == aadblAlongAwayVariatePair) - throw new java.lang.Exception ("OptimizationFramework::isCPLDCQ => Cannot generate along/away"); - - return isMFCQ (aadblAlongAwayVariatePair[0]) && isMFCQ (aadblAlongAwayVariatePair[1]); - } - - /** - * Check for Quasi Normal Constraint Qualification - * - * @param fjm The specified Fritz John Multipliers - * @param adblVariate The Candidate R^d Variate - * - * @return TRUE - The Quasi Normal Constraint Qualification is satisfied - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public boolean isQNCQ ( - final org.drip.optimization.constrained.FritzJohnMultipliers fjm, - final double[] adblVariate) - throws java.lang.Exception - { - if (!isCompatible (fjm)) - throw new java.lang.Exception ("OptimizationFramework::isQNCQ => Invalid Inputs"); - - if (!isMFCQ (adblVariate)) return false; - - int iNumEqualityConstraint = numEqualityConstraint(); - - double[] adblEqualityConstraintCoefficient = null == fjm ? null : - fjm.equalityConstraintCoefficient(); - - for (int i = 0; i < iNumEqualityConstraint; ++i) { - if (0. != adblEqualityConstraintCoefficient[i] && 0. <= _aRdToR1EqualityConstraint[i].evaluate - (adblVariate) * adblEqualityConstraintCoefficient[i]) - return false; - } - - int iNumInequalityConstraint = numInequalityConstraint(); - - double[] adblInequalityConstraintCoefficient = null == fjm ? null : - fjm.inequalityConstraintCoefficient(); - - for (int i = 0; i < iNumInequalityConstraint; ++i) { - if (0. != adblInequalityConstraintCoefficient[i] && 0. <= - _aRdToR1InequalityConstraint[i].evaluate (adblVariate) * - adblInequalityConstraintCoefficient[i]) - return false; - } - - return true; - } - - /** - * Check for Slater Condition Constraint Qualification - * - * @param adblVariate The Candidate R^d Variate - * - * @return TRUE - The Slater Condition Constraint Qualification is satisfied - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public boolean isSCCQ ( - final double[] adblVariate) - throws java.lang.Exception - { - if (!(_rdToR1Objective instanceof org.drip.function.rdtor1.ConvexMultivariate)) return false; - - int iNumEqualityConstraint = numEqualityConstraint(); - - int iNumInequalityConstraint = numInequalityConstraint(); - - for (int i = 0; i < iNumEqualityConstraint; ++i) { - if (0. != _aRdToR1EqualityConstraint[i].evaluate (adblVariate)) return false; - } - - for (int i = 0; i < iNumInequalityConstraint; ++i) { - if (0. <= _aRdToR1InequalityConstraint[i].evaluate (adblVariate)) return false; - } - - return true; - } - - /** - * Generate the Battery of Regularity Constraint Qualification Tests - * - * @param fjm The specified Fritz John Multipliers - * @param adblVariate The Candidate R^d Variate - * - * @return The Regularity Constraint Qualifier Instance - */ - - public org.drip.optimization.constrained.RegularityConditions regularityQualifier ( - final org.drip.optimization.constrained.FritzJohnMultipliers fjm, - final double[] adblVariate) - { - try { - return org.drip.optimization.constrained.RegularityConditions.Standard (adblVariate, fjm, - isLCQ(), isLICQ (adblVariate), isMFCQ (adblVariate), isCRCQ (adblVariate), isCPLDCQ - (adblVariate), isQNCQ (fjm, adblVariate), isSCCQ (adblVariate)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/optimization/constrained/RegularityConditions.java b/org/drip/optimization/constrained/RegularityConditions.java deleted file mode 100644 index 7c39f13..0000000 --- a/org/drip/optimization/constrained/RegularityConditions.java +++ /dev/null @@ -1,289 +0,0 @@ - -package org.drip.optimization.constrained; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * RegularityConditions holds the Results of the Verification of the Regularity Conditions/Constraint - * Qualifications at the specified (possibly) Optimal Variate and the corresponding Fritz John Multipliers. - * The References are: - * - * - Boyd, S., and L. van den Berghe (2009): Convex Optimization, Cambridge University Press, Cambridge UK. - * - * - Eustaquio, R., E. Karas, and A. Ribeiro (2008): Constraint Qualification for Nonlinear Programming, - * Technical Report, Federal University of Parana. - * - * - Karush, A. (1939): Minima of Functions of Several Variables with Inequalities as Side Constraints, - * M. Sc., University of Chicago, Chicago IL. - * - * - Kuhn, H. W., and A. W. Tucker (1951): Nonlinear Programming, Proceedings of the Second Berkeley - * Symposium, University of California, Berkeley CA 481-492. - * - * - Ruszczynski, A. (2006): Nonlinear Optimization, Princeton University Press, Princeton NJ. - * - * @author Lakshmi Krishnamurthy - */ - -public class RegularityConditions { - private double[] _adblVariate = null; - private org.drip.optimization.constrained.FritzJohnMultipliers _fjm = null; - private org.drip.optimization.regularity.ConstraintQualifierLCQ _cqLCQ = null; - private org.drip.optimization.regularity.ConstraintQualifierCRCQ _cqCRCQ = null; - private org.drip.optimization.regularity.ConstraintQualifierLICQ _cqLICQ = null; - private org.drip.optimization.regularity.ConstraintQualifierMFCQ _cqMFCQ = null; - private org.drip.optimization.regularity.ConstraintQualifierQNCQ _cqQNCQ = null; - private org.drip.optimization.regularity.ConstraintQualifierSCCQ _cqSCCQ = null; - private org.drip.optimization.regularity.ConstraintQualifierCPLDCQ _cqCPLDCQ = null; - - /** - * Construct a Standard Instance of RegularityConditions - * - * @param adblVariate The Candidate Variate Array - * @param fjm The Fritz John Multipliers - * @param bValidLCQ The LCQ Validity Flag - * @param bValidLICQ The LICQ Validity Flag - * @param bValidMFCQ The MFCQ Validity Flag - * @param bValidCRCQ The CRCQ Validity Flag - * @param bValidCPLDCQ The CPLDCQ Validity Flag - * @param bValidQNCQ The QNCQ Validity Flag - * @param bValidSCCQ The SCCQ Validity Flag - * - * @return The Standard Instance of CandidateRegularity - */ - - public static final RegularityConditions Standard ( - final double[] adblVariate, - final org.drip.optimization.constrained.FritzJohnMultipliers fjm, - final boolean bValidLCQ, - final boolean bValidLICQ, - final boolean bValidMFCQ, - final boolean bValidCRCQ, - final boolean bValidCPLDCQ, - final boolean bValidQNCQ, - final boolean bValidSCCQ) - { - try { - return new RegularityConditions (adblVariate, fjm, new - org.drip.optimization.regularity.ConstraintQualifierLCQ (bValidLCQ), new - org.drip.optimization.regularity.ConstraintQualifierLICQ (bValidLICQ), new - org.drip.optimization.regularity.ConstraintQualifierMFCQ (bValidMFCQ), new - org.drip.optimization.regularity.ConstraintQualifierCRCQ (bValidCRCQ), new - org.drip.optimization.regularity.ConstraintQualifierCPLDCQ (bValidCPLDCQ), - new org.drip.optimization.regularity.ConstraintQualifierQNCQ - (bValidQNCQ), new - org.drip.optimization.regularity.ConstraintQualifierSCCQ - (bValidSCCQ)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * RegularityConditions Constructor - * - * @param adblVariate The Candidate Variate Array - * @param fjm The Fritz John Multipliers - * @param cqLCQ LCQ Constraint Qualifier Instance - * @param cqLICQ LICQ Constraint Qualifier Instance - * @param cqMFCQ MFCQ Constraint Qualifier Instance - * @param cqCRCQ CRCQ Constraint Qualifier Instance - * @param cqCPLDCQ CPLDCQ Constraint Qualifier Instance - * @param cqQNCQ QNCQ Constraint Qualifier Instance - * @param cqSCCQ SCCQ Constraint Qualifier Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public RegularityConditions ( - final double[] adblVariate, - final org.drip.optimization.constrained.FritzJohnMultipliers fjm, - final org.drip.optimization.regularity.ConstraintQualifierLCQ cqLCQ, - final org.drip.optimization.regularity.ConstraintQualifierLICQ cqLICQ, - final org.drip.optimization.regularity.ConstraintQualifierMFCQ cqMFCQ, - final org.drip.optimization.regularity.ConstraintQualifierCRCQ cqCRCQ, - final org.drip.optimization.regularity.ConstraintQualifierCPLDCQ cqCPLDCQ, - final org.drip.optimization.regularity.ConstraintQualifierQNCQ cqQNCQ, - final org.drip.optimization.regularity.ConstraintQualifierSCCQ cqSCCQ) - throws java.lang.Exception - { - if (null == (_adblVariate = adblVariate) || 0 == _adblVariate.length || null == (_fjm = fjm) || null - == (_cqLCQ = cqLCQ) || null == (_cqLICQ = cqLICQ) || null == (_cqMFCQ = cqMFCQ) || null == - (_cqCRCQ = cqCRCQ) || null == (_cqCPLDCQ = cqCPLDCQ) || null == (_cqQNCQ = cqQNCQ) || null == - (_cqSCCQ = cqSCCQ)) - throw new java.lang.Exception ("RegularityConditions Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Candidate Variate Array - * - * @return The Candidate Variate Array - */ - - public double[] variate() - { - return _adblVariate; - } - - /** - * Retrieve the Fritz John Mutipliers - * - * @return The Fritz John Mutipliers - */ - - public org.drip.optimization.constrained.FritzJohnMultipliers fjm() - { - return _fjm; - } - - /** - * Retrieve the LCQ Constraint Qualifier - * - * @return The LCQ Constraint Qualifier - */ - - public org.drip.optimization.regularity.ConstraintQualifierLCQ lcq() - { - return _cqLCQ; - } - - /** - * Retrieve the LICQ Constraint Qualifier - * - * @return The LICQ Constraint Qualifier - */ - - public org.drip.optimization.regularity.ConstraintQualifierLICQ licq() - { - return _cqLICQ; - } - - /** - * Retrieve the MFCQ Constraint Qualifier - * - * @return The MFCQ Constraint Qualifier - */ - - public org.drip.optimization.regularity.ConstraintQualifierMFCQ mfcq() - { - return _cqMFCQ; - } - - /** - * Retrieve the CRCQ Constraint Qualifier - * - * @return The CRCQ Constraint Qualifier - */ - - public org.drip.optimization.regularity.ConstraintQualifierCRCQ crcq() - { - return _cqCRCQ; - } - - /** - * Retrieve the CPLDCQ Constraint Qualifier - * - * @return The CPLDCQ Constraint Qualifier - */ - - public org.drip.optimization.regularity.ConstraintQualifierCPLDCQ cpldcq() - { - return _cqCPLDCQ; - } - - /** - * Retrieve the QNCQ Constraint Qualifier - * - * @return The QNCQ Constraint Qualifier - */ - - public org.drip.optimization.regularity.ConstraintQualifierQNCQ qncq() - { - return _cqQNCQ; - } - - /** - * Retrieve the SCCQ Constraint Qualifier - * - * @return The SCCQ Constraint Qualifier - */ - - public org.drip.optimization.regularity.ConstraintQualifierSCCQ sccq() - { - return _cqSCCQ; - } - - /** - * Indicate the Ordered Gross Regularity Validity across all the Constraint Qualifiers - * - * @return TRUE - The Ordered Regularity Criteria is satisfied across all the Constraint Qualifiers - */ - - public boolean valid() - { - return _cqLICQ.valid() && _cqCRCQ.valid() && _cqMFCQ.valid() && _cqCPLDCQ.valid() && _cqQNCQ.valid(); - } - - /** - * Retrieve the Array of Strength Orders as specified in Eustaquio, Karas, and Ribeiro (2008) - * - * @return The Array of Strength Orders as specified in Eustaquio, Karas, and Ribeiro (2008) - */ - - public java.lang.String[] strengthOrder() - { - return new java.lang.String[] {"EUSTAQUIO KARAS RIBEIRO STRENGTH ORDER #1: " + _cqLICQ.display() + - " >> " + _cqMFCQ.display() + " >> " + _cqCPLDCQ.display() + " >> " + _cqQNCQ.display(), - "EUSTAQUIO KARAS RIBEIRO STRENGTH ORDER #2: " + _cqLICQ.display() + " >> " + - _cqCRCQ.display() + " >> " + _cqCPLDCQ.display() + " >> " + _cqQNCQ.display(), - "EUSTAQUIO KARAS RIBEIRO STRENGTH ORDER #3: " + _cqLCQ.display() + " >> " + - _cqLICQ.display() + " >> " + _cqMFCQ.display() + " >> " + _cqCRCQ.display() + - " >> " + _cqCPLDCQ.display() + " >> " + _cqQNCQ.display() + " >> " + " >> " + - _cqSCCQ.display()}; - } -} diff --git a/org/drip/optimization/necessary/ConditionQualifier.java b/org/drip/optimization/necessary/ConditionQualifier.java deleted file mode 100644 index dcd58ef..0000000 --- a/org/drip/optimization/necessary/ConditionQualifier.java +++ /dev/null @@ -1,141 +0,0 @@ - -package org.drip.optimization.necessary; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ConditionQualifier holds the Condition Name, the Condition Order, and the Condition Validity Flag that - * correspond to the Necessary and the Sufficient Conditions. The References are: - * - * - Boyd, S., and L. van den Berghe (2009): Convex Optimization, Cambridge University Press, Cambridge UK. - * - * - Eustaquio, R., E. Karas, and A. Ribeiro (2008): Constraint Qualification for Nonlinear Programming, - * Technical Report, Federal University of Parana. - * - * - Karush, A. (1939): Minima of Functions of Several Variables with Inequalities as Side Constraints, - * M. Sc., University of Chicago, Chicago IL. - * - * - Kuhn, H. W., and A. W. Tucker (1951): Nonlinear Programming, Proceedings of the Second Berkeley - * Symposium, University of California, Berkeley CA 481-492. - * - * - Ruszczynski, A. (2006): Nonlinear Optimization, Princeton University Press, Princeton NJ. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConditionQualifier { - private int _iOrder = -1; - private boolean _bValid = false; - private java.lang.String _strDescription = ""; - - /** - * ConditionQualifier Constructor - * - * @param strDescription Condition Qualifier Description - * @param iOrder Order of the Condition - Typically First/Second - * @param bValid Condition Qualifier Validity - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ConditionQualifier ( - final java.lang.String strDescription, - final int iOrder, - final boolean bValid) - throws java.lang.Exception - { - if (null == (_strDescription = strDescription) || _strDescription.isEmpty() || 0 > (_iOrder = - iOrder)) - throw new java.lang.Exception ("ConditionQualifier Constructor => Invalid Inputs"); - - _bValid = bValid; - } - - /** - * Retrieve the Condition Qualifier Description - * - * @return The Condition Qualifier Description - */ - - public java.lang.String description() - { - return _strDescription; - } - - /** - * Retrieve the Condition Qualifier Order - * - * @return The Condition Qualifier Order - */ - - public int order() - { - return _iOrder; - } - - /** - * Retrieve the Condition Qualifier Validity - * - * @return The Condition Qualifier Validity - */ - - public boolean valid() - { - return _bValid; - } - - /** - * Convert the Condition Qualifier into a Display String - * - * @return The Condition Qualifier into a Display String - */ - - public java.lang.String display() - { - return "[ " + _strDescription + " | " + _iOrder + " ORDER => " + _bValid + "]"; - } -} diff --git a/org/drip/optimization/necessary/ConditionQualifierComplementarySlackness.java b/org/drip/optimization/necessary/ConditionQualifierComplementarySlackness.java deleted file mode 100644 index ef28db7..0000000 --- a/org/drip/optimization/necessary/ConditionQualifierComplementarySlackness.java +++ /dev/null @@ -1,87 +0,0 @@ - -package org.drip.optimization.necessary; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ConditionQualifierComplementarySlackness holds the Zero Order Necessary Complementary Slackness Condition. - * The References are: - * - * - Boyd, S., and L. van den Berghe (2009): Convex Optimization, Cambridge University Press, Cambridge UK. - * - * - Eustaquio, R., E. Karas, and A. Ribeiro (2008): Constraint Qualification for Nonlinear Programming, - * Technical Report, Federal University of Parana. - * - * - Karush, A. (1939): Minima of Functions of Several Variables with Inequalities as Side Constraints, - * M. Sc., University of Chicago, Chicago IL. - * - * - Kuhn, H. W., and A. W. Tucker (1951): Nonlinear Programming, Proceedings of the Second Berkeley - * Symposium, University of California, Berkeley CA 481-492. - * - * - Ruszczynski, A. (2006): Nonlinear Optimization, Princeton University Press, Princeton NJ. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConditionQualifierComplementarySlackness extends - org.drip.optimization.necessary.ConditionQualifier { - - /** - * ConditionQualifierComplementarySlackness Constructor - * - * @param bValid Condition Qualifier Validity - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ConditionQualifierComplementarySlackness ( - final boolean bValid) - throws java.lang.Exception - { - super ("COMPLEMENTARY SLACKNESS", 0, bValid); - } -} diff --git a/org/drip/optimization/necessary/ConditionQualifierDualFeasibility.java b/org/drip/optimization/necessary/ConditionQualifierDualFeasibility.java deleted file mode 100644 index 2a28573..0000000 --- a/org/drip/optimization/necessary/ConditionQualifierDualFeasibility.java +++ /dev/null @@ -1,87 +0,0 @@ - -package org.drip.optimization.necessary; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ConditionQualifierDualFeasibility holds the Zero Order Necessary Dual Feasibility Condition. The - * References are: - * - * - Boyd, S., and L. van den Berghe (2009): Convex Optimization, Cambridge University Press, Cambridge UK. - * - * - Eustaquio, R., E. Karas, and A. Ribeiro (2008): Constraint Qualification for Nonlinear Programming, - * Technical Report, Federal University of Parana. - * - * - Karush, A. (1939): Minima of Functions of Several Variables with Inequalities as Side Constraints, - * M. Sc., University of Chicago, Chicago IL. - * - * - Kuhn, H. W., and A. W. Tucker (1951): Nonlinear Programming, Proceedings of the Second Berkeley - * Symposium, University of California, Berkeley CA 481-492. - * - * - Ruszczynski, A. (2006): Nonlinear Optimization, Princeton University Press, Princeton NJ. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConditionQualifierDualFeasibility extends org.drip.optimization.necessary.ConditionQualifier -{ - - /** - * ConditionQualifierDualFeasibility Constructor - * - * @param bValid Condition Qualifier Validity - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ConditionQualifierDualFeasibility ( - final boolean bValid) - throws java.lang.Exception - { - super ("DUAL FEASIBILITY", 0, bValid); - } -} diff --git a/org/drip/optimization/necessary/ConditionQualifierFONC.java b/org/drip/optimization/necessary/ConditionQualifierFONC.java deleted file mode 100644 index b534e39..0000000 --- a/org/drip/optimization/necessary/ConditionQualifierFONC.java +++ /dev/null @@ -1,85 +0,0 @@ - -package org.drip.optimization.necessary; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ConditionQualifierFONC holds the First Order Necessary Condition. The References are: - * - * - Boyd, S., and L. van den Berghe (2009): Convex Optimization, Cambridge University Press, Cambridge UK. - * - * - Eustaquio, R., E. Karas, and A. Ribeiro (2008): Constraint Qualification for Nonlinear Programming, - * Technical Report, Federal University of Parana. - * - * - Karush, A. (1939): Minima of Functions of Several Variables with Inequalities as Side Constraints, - * M. Sc., University of Chicago, Chicago IL. - * - * - Kuhn, H. W., and A. W. Tucker (1951): Nonlinear Programming, Proceedings of the Second Berkeley - * Symposium, University of California, Berkeley CA 481-492. - * - * - Ruszczynski, A. (2006): Nonlinear Optimization, Princeton University Press, Princeton NJ. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConditionQualifierFONC extends org.drip.optimization.necessary.ConditionQualifier { - - /** - * ConditionQualifierFONC Constructor - * - * @param bValid Condition Qualifier Validity - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ConditionQualifierFONC ( - final boolean bValid) - throws java.lang.Exception - { - super ("FONC", 1, bValid); - } -} diff --git a/org/drip/optimization/necessary/ConditionQualifierPrimalFeasibility.java b/org/drip/optimization/necessary/ConditionQualifierPrimalFeasibility.java deleted file mode 100644 index f75bdee..0000000 --- a/org/drip/optimization/necessary/ConditionQualifierPrimalFeasibility.java +++ /dev/null @@ -1,87 +0,0 @@ - -package org.drip.optimization.necessary; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ConditionQualifierPrimalFeasibility holds the Zero Order Necessary Primal Feasibility Condition. The - * References are: - * - * - Boyd, S., and L. van den Berghe (2009): Convex Optimization, Cambridge University Press, Cambridge UK. - * - * - Eustaquio, R., E. Karas, and A. Ribeiro (2008): Constraint Qualification for Nonlinear Programming, - * Technical Report, Federal University of Parana. - * - * - Karush, A. (1939): Minima of Functions of Several Variables with Inequalities as Side Constraints, - * M. Sc., University of Chicago, Chicago IL. - * - * - Kuhn, H. W., and A. W. Tucker (1951): Nonlinear Programming, Proceedings of the Second Berkeley - * Symposium, University of California, Berkeley CA 481-492. - * - * - Ruszczynski, A. (2006): Nonlinear Optimization, Princeton University Press, Princeton NJ. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConditionQualifierPrimalFeasibility extends - org.drip.optimization.necessary.ConditionQualifier { - - /** - * ConditionQualifierPrimalFeasibility Constructor - * - * @param bValid Condition Qualifier Validity - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ConditionQualifierPrimalFeasibility ( - final boolean bValid) - throws java.lang.Exception - { - super ("PRIMAL FEASIBILITY", 0, bValid); - } -} diff --git a/org/drip/optimization/necessary/ConditionQualifierSOSC.java b/org/drip/optimization/necessary/ConditionQualifierSOSC.java deleted file mode 100644 index 97245ab..0000000 --- a/org/drip/optimization/necessary/ConditionQualifierSOSC.java +++ /dev/null @@ -1,85 +0,0 @@ - -package org.drip.optimization.necessary; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ConditionQualifierSOSC holds the Second Order Sufficiency Condition. The References are: - * - * - Boyd, S., and L. van den Berghe (2009): Convex Optimization, Cambridge University Press, Cambridge UK. - * - * - Eustaquio, R., E. Karas, and A. Ribeiro (2008): Constraint Qualification for Nonlinear Programming, - * Technical Report, Federal University of Parana. - * - * - Karush, A. (1939): Minima of Functions of Several Variables with Inequalities as Side Constraints, - * M. Sc., University of Chicago, Chicago IL. - * - * - Kuhn, H. W., and A. W. Tucker (1951): Nonlinear Programming, Proceedings of the Second Berkeley - * Symposium, University of California, Berkeley CA 481-492. - * - * - Ruszczynski, A. (2006): Nonlinear Optimization, Princeton University Press, Princeton NJ. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConditionQualifierSOSC extends org.drip.optimization.necessary.ConditionQualifier { - - /** - * ConditionQualifierSOSC Constructor - * - * @param bValid Condition Qualifier Validity - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ConditionQualifierSOSC ( - final boolean bValid) - throws java.lang.Exception - { - super ("SOSC", 2, bValid); - } -} diff --git a/org/drip/optimization/regularity/ConstraintQualifier.java b/org/drip/optimization/regularity/ConstraintQualifier.java deleted file mode 100644 index d0c86ac..0000000 --- a/org/drip/optimization/regularity/ConstraintQualifier.java +++ /dev/null @@ -1,141 +0,0 @@ - -package org.drip.optimization.regularity; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ConstraintQualifier holds the Constraint Name, the Constraint Code, and the Constraint Validity Flag that - * correspond to the Regularity Conditions. The References are: - * - * - Boyd, S., and L. van den Berghe (2009): Convex Optimization, Cambridge University Press, Cambridge UK. - * - * - Eustaquio, R., E. Karas, and A. Ribeiro (2008): Constraint Qualification for Nonlinear Programming, - * Technical Report, Federal University of Parana. - * - * - Karush, A. (1939): Minima of Functions of Several Variables with Inequalities as Side Constraints, - * M. Sc., University of Chicago, Chicago IL. - * - * - Kuhn, H. W., and A. W. Tucker (1951): Nonlinear Programming, Proceedings of the Second Berkeley - * Symposium, University of California, Berkeley CA 481-492. - * - * - Ruszczynski, A. (2006): Nonlinear Optimization, Princeton University Press, Princeton NJ. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConstraintQualifier { - private boolean _bValid = false; - private java.lang.String _strCode = ""; - private java.lang.String _strDescription = ""; - - /** - * ConstraintQualifier Constructor - * - * @param strCode Constraint Qualifier Code - * @param strDescription Constraint Qualifier Description - * @param bValid Constraint Qualifier Validity - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ConstraintQualifier ( - final java.lang.String strCode, - final java.lang.String strDescription, - final boolean bValid) - throws java.lang.Exception - { - if (null == (_strCode = strCode) || _strCode.isEmpty() || null == (_strDescription = strDescription) - || _strDescription.isEmpty()) - throw new java.lang.Exception ("ConstraintQualifier Constructor => Invalid Inputs"); - - _bValid = bValid; - } - - /** - * Retrieve the Constraint Qualifier Code - * - * @return The Constraint Qualifier Code - */ - - public java.lang.String code() - { - return _strCode; - } - - /** - * Retrieve the Constraint Qualifier Description - * - * @return The Constraint Qualifier Description - */ - - public java.lang.String description() - { - return _strDescription; - } - - /** - * Retrieve the Constraint Qualifier Validity - * - * @return The Constraint Qualifier Validity - */ - - public boolean valid() - { - return _bValid; - } - - /** - * Convert the Constraint Qualifier into a Display String - * - * @return The Constraint Qualifier into a Display String - */ - - public java.lang.String display() - { - return "[ " + _strCode + " | " + _strDescription + " => " + _bValid + "]"; - } -} diff --git a/org/drip/optimization/regularity/ConstraintQualifierCPLDCQ.java b/org/drip/optimization/regularity/ConstraintQualifierCPLDCQ.java deleted file mode 100644 index 4167d75..0000000 --- a/org/drip/optimization/regularity/ConstraintQualifierCPLDCQ.java +++ /dev/null @@ -1,86 +0,0 @@ - -package org.drip.optimization.regularity; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ConstraintQualifierCPLDCQ holds the Constant Positive Linear Dependence Constraint Qualifier (CPLDCQ). The - * References are: - * - * - Boyd, S., and L. van den Berghe (2009): Convex Optimization, Cambridge University Press, Cambridge UK. - * - * - Eustaquio, R., E. Karas, and A. Ribeiro (2008): Constraint Qualification for Nonlinear Programming, - * Technical Report, Federal University of Parana. - * - * - Karush, A. (1939): Minima of Functions of Several Variables with Inequalities as Side Constraints, - * M. Sc., University of Chicago, Chicago IL. - * - * - Kuhn, H. W., and A. W. Tucker (1951): Nonlinear Programming, Proceedings of the Second Berkeley - * Symposium, University of California, Berkeley CA 481-492. - * - * - Ruszczynski, A. (2006): Nonlinear Optimization, Princeton University Press, Princeton NJ. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConstraintQualifierCPLDCQ extends org.drip.optimization.regularity.ConstraintQualifier { - - /** - * ConstraintQualifierCPLDCQ Constructor - * - * @param bValid Constraint Qualifier Validity - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ConstraintQualifierCPLDCQ ( - final boolean bValid) - throws java.lang.Exception - { - super ("CPLDCQ", "CONSTANT POSITIVE LINEAR DEPENDENCE CONSTRAINT QUALIFICATION", bValid); - } -} diff --git a/org/drip/optimization/regularity/ConstraintQualifierCRCQ.java b/org/drip/optimization/regularity/ConstraintQualifierCRCQ.java deleted file mode 100644 index 0fa87ad..0000000 --- a/org/drip/optimization/regularity/ConstraintQualifierCRCQ.java +++ /dev/null @@ -1,85 +0,0 @@ - -package org.drip.optimization.regularity; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ConstraintQualifierCRCQ holds the Constant Rank Constraint Qualifier (CRCQ). The References are: - * - * - Boyd, S., and L. van den Berghe (2009): Convex Optimization, Cambridge University Press, Cambridge UK. - * - * - Eustaquio, R., E. Karas, and A. Ribeiro (2008): Constraint Qualification for Nonlinear Programming, - * Technical Report, Federal University of Parana. - * - * - Karush, A. (1939): Minima of Functions of Several Variables with Inequalities as Side Constraints, - * M. Sc., University of Chicago, Chicago IL. - * - * - Kuhn, H. W., and A. W. Tucker (1951): Nonlinear Programming, Proceedings of the Second Berkeley - * Symposium, University of California, Berkeley CA 481-492. - * - * - Ruszczynski, A. (2006): Nonlinear Optimization, Princeton University Press, Princeton NJ. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConstraintQualifierCRCQ extends org.drip.optimization.regularity.ConstraintQualifier { - - /** - * ConstraintQualifierCRCQ Constructor - * - * @param bValid Constraint Qualifier Validity - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ConstraintQualifierCRCQ ( - final boolean bValid) - throws java.lang.Exception - { - super ("CRCQ", "CONSTANT RANK CONSTRAINT QUALIFICATION", bValid); - } -} diff --git a/org/drip/optimization/regularity/ConstraintQualifierLCQ.java b/org/drip/optimization/regularity/ConstraintQualifierLCQ.java deleted file mode 100644 index 445a087..0000000 --- a/org/drip/optimization/regularity/ConstraintQualifierLCQ.java +++ /dev/null @@ -1,85 +0,0 @@ - -package org.drip.optimization.regularity; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ConstraintQualifierLCQ holds the Linear Constraint Qualifier (LCQ). The References are: - * - * - Boyd, S., and L. van den Berghe (2009): Convex Optimization, Cambridge University Press, Cambridge UK. - * - * - Eustaquio, R., E. Karas, and A. Ribeiro (2008): Constraint Qualification for Nonlinear Programming, - * Technical Report, Federal University of Parana. - * - * - Karush, A. (1939): Minima of Functions of Several Variables with Inequalities as Side Constraints, - * M. Sc., University of Chicago, Chicago IL. - * - * - Kuhn, H. W., and A. W. Tucker (1951): Nonlinear Programming, Proceedings of the Second Berkeley - * Symposium, University of California, Berkeley CA 481-492. - * - * - Ruszczynski, A. (2006): Nonlinear Optimization, Princeton University Press, Princeton NJ. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConstraintQualifierLCQ extends org.drip.optimization.regularity.ConstraintQualifier { - - /** - * ConstraintQualifierLCQ Constructor - * - * @param bValid Constraint Qualifier Validity - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ConstraintQualifierLCQ ( - final boolean bValid) - throws java.lang.Exception - { - super ("LCQ", "LINEAR CONSTRAINT QUALIFICATION", bValid); - } -} diff --git a/org/drip/optimization/regularity/ConstraintQualifierLICQ.java b/org/drip/optimization/regularity/ConstraintQualifierLICQ.java deleted file mode 100644 index aef863e..0000000 --- a/org/drip/optimization/regularity/ConstraintQualifierLICQ.java +++ /dev/null @@ -1,85 +0,0 @@ - -package org.drip.optimization.regularity; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ConstraintQualifierLICQ holds the Linear Independence Constraint Qualifier (LICQ). The References are: - * - * - Boyd, S., and L. van den Berghe (2009): Convex Optimization, Cambridge University Press, Cambridge UK. - * - * - Eustaquio, R., E. Karas, and A. Ribeiro (2008): Constraint Qualification for Nonlinear Programming, - * Technical Report, Federal University of Parana. - * - * - Karush, A. (1939): Minima of Functions of Several Variables with Inequalities as Side Constraints, - * M. Sc., University of Chicago, Chicago IL. - * - * - Kuhn, H. W., and A. W. Tucker (1951): Nonlinear Programming, Proceedings of the Second Berkeley - * Symposium, University of California, Berkeley CA 481-492. - * - * - Ruszczynski, A. (2006): Nonlinear Optimization, Princeton University Press, Princeton NJ. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConstraintQualifierLICQ extends org.drip.optimization.regularity.ConstraintQualifier { - - /** - * ConstraintQualifierLICQ Constructor - * - * @param bValid Constraint Qualifier Validity - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ConstraintQualifierLICQ ( - final boolean bValid) - throws java.lang.Exception - { - super ("LICQ", "LINEAR INDEPENDENCE CONSTRAINT QUALIFICATION", bValid); - } -} diff --git a/org/drip/optimization/regularity/ConstraintQualifierMFCQ.java b/org/drip/optimization/regularity/ConstraintQualifierMFCQ.java deleted file mode 100644 index 116d0b3..0000000 --- a/org/drip/optimization/regularity/ConstraintQualifierMFCQ.java +++ /dev/null @@ -1,85 +0,0 @@ - -package org.drip.optimization.regularity; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ConstraintQualifierMFCQ holds the Mangasarian-Fromovitz Constraint Qualifier (MFCQ). The References are: - * - * - Boyd, S., and L. van den Berghe (2009): Convex Optimization, Cambridge University Press, Cambridge UK. - * - * - Eustaquio, R., E. Karas, and A. Ribeiro (2008): Constraint Qualification for Nonlinear Programming, - * Technical Report, Federal University of Parana. - * - * - Karush, A. (1939): Minima of Functions of Several Variables with Inequalities as Side Constraints, - * M. Sc., University of Chicago, Chicago IL. - * - * - Kuhn, H. W., and A. W. Tucker (1951): Nonlinear Programming, Proceedings of the Second Berkeley - * Symposium, University of California, Berkeley CA 481-492. - * - * - Ruszczynski, A. (2006): Nonlinear Optimization, Princeton University Press, Princeton NJ. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConstraintQualifierMFCQ extends org.drip.optimization.regularity.ConstraintQualifier { - - /** - * ConstraintQualifierMFCQ Constructor - * - * @param bValid Constraint Qualifier Validity - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ConstraintQualifierMFCQ ( - final boolean bValid) - throws java.lang.Exception - { - super ("MFCQ", "MANGASARIAN FROMOVITZ CONSTRAINT QUALIFICATION", bValid); - } -} diff --git a/org/drip/optimization/regularity/ConstraintQualifierQNCQ.java b/org/drip/optimization/regularity/ConstraintQualifierQNCQ.java deleted file mode 100644 index aa9d076..0000000 --- a/org/drip/optimization/regularity/ConstraintQualifierQNCQ.java +++ /dev/null @@ -1,85 +0,0 @@ - -package org.drip.optimization.regularity; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ConstraintQualifierQNCQ holds the Quasi Normal Constraint Qualifier (QNCQ). The References are: - * - * - Boyd, S., and L. van den Berghe (2009): Convex Optimization, Cambridge University Press, Cambridge UK. - * - * - Eustaquio, R., E. Karas, and A. Ribeiro (2008): Constraint Qualification for Nonlinear Programming, - * Technical Report, Federal University of Parana. - * - * - Karush, A. (1939): Minima of Functions of Several Variables with Inequalities as Side Constraints, - * M. Sc., University of Chicago, Chicago IL. - * - * - Kuhn, H. W., and A. W. Tucker (1951): Nonlinear Programming, Proceedings of the Second Berkeley - * Symposium, University of California, Berkeley CA 481-492. - * - * - Ruszczynski, A. (2006): Nonlinear Optimization, Princeton University Press, Princeton NJ. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConstraintQualifierQNCQ extends org.drip.optimization.regularity.ConstraintQualifier { - - /** - * ConstraintQualifierQNCQ Constructor - * - * @param bValid Constraint Qualifier Validity - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ConstraintQualifierQNCQ ( - final boolean bValid) - throws java.lang.Exception - { - super ("CNCQ", "QUASI NORMAL CONSTRAINT QUALIFICATION", bValid); - } -} diff --git a/org/drip/optimization/regularity/ConstraintQualifierSCCQ.java b/org/drip/optimization/regularity/ConstraintQualifierSCCQ.java deleted file mode 100644 index df77f25..0000000 --- a/org/drip/optimization/regularity/ConstraintQualifierSCCQ.java +++ /dev/null @@ -1,85 +0,0 @@ - -package org.drip.optimization.regularity; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ConstraintQualifierSCCQ holds the Slater Condition Constraint Qualifier (SCCQ). The References are: - * - * - Boyd, S., and L. van den Berghe (2009): Convex Optimization, Cambridge University Press, Cambridge UK. - * - * - Eustaquio, R., E. Karas, and A. Ribeiro (2008): Constraint Qualification for Nonlinear Programming, - * Technical Report, Federal University of Parana. - * - * - Karush, A. (1939): Minima of Functions of Several Variables with Inequalities as Side Constraints, - * M. Sc., University of Chicago, Chicago IL. - * - * - Kuhn, H. W., and A. W. Tucker (1951): Nonlinear Programming, Proceedings of the Second Berkeley - * Symposium, University of California, Berkeley CA 481-492. - * - * - Ruszczynski, A. (2006): Nonlinear Optimization, Princeton University Press, Princeton NJ. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConstraintQualifierSCCQ extends org.drip.optimization.regularity.ConstraintQualifier { - - /** - * ConstraintQualifierSCCQ Constructor - * - * @param bValid Constraint Qualifier Validity - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ConstraintQualifierSCCQ ( - final boolean bValid) - throws java.lang.Exception - { - super ("SCCQ", "SLATER CONDITION CONSTRAINT QUALIFICATION", bValid); - } -} diff --git a/org/drip/param/config/ConfigLoader.java b/org/drip/param/config/ConfigLoader.java deleted file mode 100644 index 968c34c..0000000 --- a/org/drip/param/config/ConfigLoader.java +++ /dev/null @@ -1,509 +0,0 @@ - -package org.drip.param.config; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * ConfigLoader implements the configuration functionality. It exposes the following: - * - Parses the XML configuration file and extract the tag pairs information. - * - Retrieve the logger. - * - Load the holiday calendars and retrieve the location holidays. - * - Connect to analytics server and the database server. - * - * Depending on the configuration setting, ConfigLoader loads the above from either a file or the specified - * database. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConfigLoader { - private static final int IntegerTagValue ( - final org.w3c.dom.Element eTag, - final java.lang.String strTag) - throws java.lang.Exception { - if (null == eTag || null == strTag || null == eTag.getElementsByTagName (strTag)) - throw new java.lang.Exception ("Cannot get int value for <" + strTag + ">"); - - org.w3c.dom.NodeList nl = eTag.getElementsByTagName (strTag); - - if (null == nl.item (0) || !(nl.item (0) instanceof org.w3c.dom.Element)) - throw new java.lang.Exception ("Cannot get int value for <" + strTag + ">"); - - org.w3c.dom.Element elem = (org.w3c.dom.Element) nl.item (0); - - if (null == elem || null == elem.getChildNodes() || null == elem.getChildNodes().item (0) || - !(elem.getChildNodes().item (0) instanceof org.w3c.dom.Node)) - throw new java.lang.Exception ("Cannot get int value for <" + strTag + ">"); - - org.w3c.dom.Node node = elem.getChildNodes().item (0); - - if (null == node || null == node.getNodeValue()) - throw new java.lang.Exception ("Cannot get int value for <" + strTag + ">"); - - return new java.lang.Integer (node.getNodeValue()).intValue(); - } - - private static final boolean BooleanTagValue ( - final org.w3c.dom.Element eTag, - final java.lang.String strTag) - throws java.lang.Exception - { - if (null == eTag || null == strTag || null == eTag.getElementsByTagName (strTag)) - throw new java.lang.Exception ("Cannot get bool value for <" + strTag + ">"); - - org.w3c.dom.NodeList nl = eTag.getElementsByTagName (strTag); - - if (null == nl.item (0) || !(nl.item (0) instanceof org.w3c.dom.Element)) - throw new java.lang.Exception ("Cannot get bool value for <" + strTag + ">"); - - org.w3c.dom.Element elem = (org.w3c.dom.Element) nl.item (0); - - if (null == elem || null == elem.getChildNodes() || null == elem.getChildNodes().item (0) || - !(elem.getChildNodes().item (0) instanceof org.w3c.dom.Node)) - throw new java.lang.Exception ("Cannot get bool value for <" + strTag + ">"); - - org.w3c.dom.Node node = elem.getChildNodes().item (0); - - if (null == node || null == node.getNodeValue()) - throw new java.lang.Exception ("Cannot get bool value for <" + strTag + ">"); - - return new java.lang.Boolean (node.getNodeValue()).booleanValue(); - } - - private static final java.lang.String StringTagValue ( - final org.w3c.dom.Element eTag, - final java.lang.String strTag) - { - if (null == eTag || null == strTag || null == eTag.getElementsByTagName (strTag)) return null; - - org.w3c.dom.NodeList nl = eTag.getElementsByTagName (strTag); - - if (null == nl.item (0) || !(nl.item (0) instanceof org.w3c.dom.Element)) return null; - - org.w3c.dom.Element elem = (org.w3c.dom.Element) nl.item (0); - - if (null == elem || null == elem.getChildNodes() || null == elem.getChildNodes().item (0) || - !(elem.getChildNodes().item (0) instanceof org.w3c.dom.Node)) - return null; - - org.w3c.dom.Node node = elem.getChildNodes().item (0); - - if (null == node || null == node.getNodeValue()) return null; - - return node.getNodeValue(); - } - - private static final int[] IntegerArrayTagValue ( - final org.w3c.dom.Element eTag, - final java.lang.String strTag) - { - if (null == eTag || null == strTag || null == eTag.getElementsByTagName (strTag)) return null; - - org.w3c.dom.NodeList nl = eTag.getElementsByTagName (strTag); - - if (!(nl.item (0) instanceof org.w3c.dom.Element)) return null; - - org.w3c.dom.Element elem = (org.w3c.dom.Element) nl.item (0); - - if (null == elem || null == elem.getChildNodes() || null == elem.getChildNodes().item (0) || - !(elem.getChildNodes().item (0) instanceof org.w3c.dom.Node)) - return null; - - java.lang.String strValue = elem.getChildNodes().item (0).getNodeValue(); - - if (null == strValue || strValue.isEmpty()) return null; - - java.lang.String[] astrValue = strValue.split (","); - - int[] ai = new int[astrValue.length]; - - for (int i = 0; i < astrValue.length; ++i) - ai[i] = new java.lang.Integer (astrValue[i]).intValue(); - - return ai; - } - - private static final org.w3c.dom.Document NormalizedXMLDoc ( - final java.lang.String strXMLFile) - { - if (null == strXMLFile || strXMLFile.isEmpty()) return null; - - org.w3c.dom.Document doc = null; - - try { - doc = javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder().parse (new - java.io.File (strXMLFile)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (null == doc || null == doc.getDocumentElement()) return null; - - doc.getDocumentElement().normalize(); - - return doc; - } - - /** - * Create a LocHolidays object from the XML Document and the Location Tag - * - * @param doc XML Document - * @param strLoc Location Tag - * - * @return LocHolidays - */ - - public static org.drip.analytics.eventday.Locale LocationHolidays ( - final org.w3c.dom.Document doc, - final java.lang.String strLoc) - { - if (null == doc || null == strLoc) return null; - - org.w3c.dom.NodeList nlLoc = doc.getElementsByTagName (strLoc); - - if (null == nlLoc || null == nlLoc.item (0) || org.w3c.dom.Node.ELEMENT_NODE != nlLoc.item - (0).getNodeType()) - return null; - - org.drip.analytics.eventday.Locale locHols = new org.drip.analytics.eventday.Locale(); - - org.w3c.dom.Element e = (org.w3c.dom.Element) nlLoc.item (0); - - org.w3c.dom.NodeList nlHols = e.getElementsByTagName ("Weekend"); - - if (null != nlHols && null != nlHols.item (0) && org.w3c.dom.Node.ELEMENT_NODE == nlHols.item - (0).getNodeType()) - locHols.addWeekend (IntegerArrayTagValue ((org.w3c.dom.Element) nlHols.item (0), "DaysInWeek")); - - if (null != (nlHols = e.getElementsByTagName ("FixedHoliday"))) { - for (int j = 0; j < nlHols.getLength(); ++j) { - if (null == nlHols.item (j) || org.w3c.dom.Node.ELEMENT_NODE != nlHols.item - (j).getNodeType()) - continue; - - org.w3c.dom.Element elemHol = (org.w3c.dom.Element) nlHols.item (j); - - if (null != elemHol) { - try { - locHols.addFixedHoliday (IntegerTagValue (elemHol, "Date"), IntegerTagValue (elemHol, - "Month"), ""); - } catch (java.lang.Exception ex) { - ex.printStackTrace(); - } - } - } - } - - if (null != (nlHols = e.getElementsByTagName ("FloatingHoliday"))) { - for (int j = 0; j < nlHols.getLength(); ++j) { - if (null == nlHols.item (j) || org.w3c.dom.Node.ELEMENT_NODE != nlHols.item - (j).getNodeType()) - continue; - - org.w3c.dom.Element elemHol = (org.w3c.dom.Element) nlHols.item (j); - - if (null != elemHol) { - try { - locHols.addFloatingHoliday (IntegerTagValue (elemHol, "WeekInMonth"), IntegerTagValue - (elemHol, "WeekDay"), IntegerTagValue (elemHol, "Month"), BooleanTagValue - (elemHol, "FromFront"), ""); - } catch (java.lang.Exception ex) { - ex.printStackTrace(); - } - } - } - } - - return locHols; - } - - /** - * Get the logger location from the XML Configuration file - * - * @param strConfigFile XML Configuration file - * - * @return String representing the logger location's full path - */ - - public static java.lang.String LoggerLocation ( - final java.lang.String strConfigFile) - { - org.w3c.dom.Document doc = NormalizedXMLDoc (strConfigFile); - - if (null == doc) return null; - - org.w3c.dom.NodeList nlLogger = doc.getElementsByTagName ("logger"); - - if (null == nlLogger || null == nlLogger.item (0) || org.w3c.dom.Node.ELEMENT_NODE != - nlLogger.item (0).getNodeType()) - return null; - - return StringTagValue ((org.w3c.dom.Element) nlLogger.item (0), "Location"); - } - - /** - * Connect to the analytics server from the connection parameters set in the XML Configuration file - * - * @param strConfigFile XML Configuration file - * - * @return java.net.Socket - */ - - public static java.net.Socket ConnectToAnalServer ( - final java.lang.String strConfigFile) - { - org.w3c.dom.Document doc = NormalizedXMLDoc (strConfigFile); - - if (null == doc) return null; - - org.w3c.dom.NodeList nlLogger = doc.getElementsByTagName ("analserver"); - - if (null == nlLogger || null == nlLogger.item (0) || org.w3c.dom.Node.ELEMENT_NODE != - nlLogger.item (0).getNodeType()) - return null; - - try { - return new java.net.Socket (StringTagValue ((org.w3c.dom.Element) nlLogger.item (0), "host"), - IntegerTagValue ((org.w3c.dom.Element) nlLogger.item (0), "port")); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Initialize the analytics server from the connection parameters set in the XML Configuration file - * - * @param strConfigFile XML Configuration file - * - * @return java.net.ServerSocket - */ - - public static java.net.ServerSocket InitAnalServer ( - final java.lang.String strConfigFile) - { - org.w3c.dom.Document doc = NormalizedXMLDoc (strConfigFile); - - if (null == doc) return null; - - org.w3c.dom.NodeList nlLogger = doc.getElementsByTagName ("analserver"); - - if (null == nlLogger || null == nlLogger.item (0) || org.w3c.dom.Node.ELEMENT_NODE != - nlLogger.item (0).getNodeType()) - return null; - - try { - return new java.net.ServerSocket (IntegerTagValue ((org.w3c.dom.Element) nlLogger.item (0), - "port"), IntegerTagValue ((org.w3c.dom.Element) nlLogger.item (0), "maxconn")); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Load the map of the holiday calendars from the entries set in the XML Configuration file - * - * @param strConfigFile XML Configuration file - * - * @return Map of the holiday calendars - */ - - public static org.drip.analytics.support.CaseInsensitiveTreeMap - LoadHolidayCalendars ( - final java.lang.String strConfigFile) - { - org.w3c.dom.Document doc = NormalizedXMLDoc (strConfigFile); - - if (null == doc) return null; - - org.drip.analytics.eventday.Locale lhNYB = LocationHolidays (doc, "NYB"); - - if (null == lhNYB) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapHols = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapHols.put ("NYB", lhNYB); - - return mapHols; - } - - /** - * Initialize the Oracle database from the connection parameters set in the XML Configuration file - * - * @param strConfigFile XML Configuration file - * - * @return Connection Statement object - */ - - public static java.sql.Statement OracleInit ( - final java.lang.String strConfigFile) - { - org.w3c.dom.Document doc = NormalizedXMLDoc (strConfigFile); - - if (null == doc) return null; - - org.w3c.dom.NodeList nlDBConn = doc.getElementsByTagName ("dbconn"); - - if (null == nlDBConn || null == nlDBConn.item (0) || org.w3c.dom.Node.ELEMENT_NODE != - nlDBConn.item (0).getNodeType()) - return null; - - org.w3c.dom.Element elemDBConn = (org.w3c.dom.Element) nlDBConn.item (0); - - try { - java.lang.Class.forName ("oracle.jdbc.driver.OracleDriver"); - - java.lang.String strURL = "jdbc:oracle:thin:@//" + StringTagValue (elemDBConn, "host") + ":" + - StringTagValue (elemDBConn, "port") + "/" + StringTagValue (elemDBConn, "dbname"); - - // java.lang.String strURL = "jdbc:oracle:thin:@//localhost:1521/XE"; - - System.out.println ("URL: " + strURL); - - java.sql.Connection conn = java.sql.DriverManager.getConnection (strURL, "hr", "hr"); - - System.out.println ("Conn: " + conn); - - conn.setAutoCommit (false); - - return conn.createStatement(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Load the map of the holiday calendars from the database settings set in the XML Configuration file - * - * @param strConfigFile XML Configuration file - * - * @return Map of the holiday calendars - */ - - public static final org.drip.analytics.support.CaseInsensitiveTreeMap - LoadHolidayCalendarsFromDB ( - final java.lang.String strConfigFile) - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapHols = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - java.sql.Statement stmt = OracleInit (strConfigFile); - - if (null == stmt) return null; - - long lStart = System.nanoTime(); - - try { - java.sql.ResultSet rs = stmt.executeQuery ("SELECT Location, Holiday FROM Holidays"); - - while (null != rs && rs.next()) { - java.lang.String strLocation = rs.getString ("Location"); - - java.util.Date dtSQLHoliday = rs.getDate ("Holiday"); - - if (null != dtSQLHoliday) { - org.drip.analytics.eventday.Locale lh = mapHols.get (strLocation); - - if (null == lh) lh = new org.drip.analytics.eventday.Locale(); - - lh.addStaticHoliday (org.drip.analytics.date.DateUtil.CreateFromYMD - (org.drip.analytics.date.DateUtil.Year (dtSQLHoliday), - org.drip.analytics.date.DateUtil.Month (dtSQLHoliday), - org.drip.analytics.date.DateUtil.Year (dtSQLHoliday)), ""); - - mapHols.put (strLocation, lh); - } - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - int[] aiWeekend = new int[2]; - aiWeekend[1] = org.drip.analytics.date.DateUtil.SUNDAY; - aiWeekend[0] = org.drip.analytics.date.DateUtil.SATURDAY; - - for (java.util.Map.Entry me : - mapHols.entrySet()) - me.getValue().addWeekend (aiWeekend); - - System.out.println ("Loading hols from DB took " + (System.nanoTime() - lStart) * 1.e-06 + - " m-sec\n"); - - return mapHols; - } - - public static void main ( - final java.lang.String[] astrArgs) - throws java.lang.Exception - { - java.lang.String strConfigFile = "c:\\Lakshmi\\java\\BondAnal\\Config.xml"; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapHols = - LoadHolidayCalendars (strConfigFile); - - for (java.util.Map.Entry me : - mapHols.entrySet()) - System.out.println (me.getKey() + "=" + me.getValue()); - - System.out.println ("Logger: " + LoggerLocation (strConfigFile)); - } -} diff --git a/org/drip/param/creator/MarketParamsBuilder.java b/org/drip/param/creator/MarketParamsBuilder.java deleted file mode 100644 index b49ffaa..0000000 --- a/org/drip/param/creator/MarketParamsBuilder.java +++ /dev/null @@ -1,219 +0,0 @@ - -package org.drip.param.creator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * MarketParamsBuilder implements the various ways of constructing, de-serializing, and building the Market - * Parameters. - * - * @author Lakshmi Krishnamurthy - */ - -public class MarketParamsBuilder { - - /** - * Create a Market Parameters instance with the funding discount curve, the forward discount curve, the - * govvie curve, the credit curve, the component quote, the map of treasury benchmark quotes, and the - * Latent State Fixings Instance. - * - * @param dcFunding Funding Curve - * @param fc Forward Curve - * @param gc Govvie Curve - * @param cc Credit Curve - * @param strComponentCode Component Code - * @param compQuote Component quote - * @param mTSYQuotes Map of Treasury Benchmark Quotes - * @param lsfc The Latent State Fixings Instance - * - * @return Market Parameters Instance - */ - - public static final org.drip.param.market.CurveSurfaceQuoteContainer Create ( - final org.drip.state.discount.MergedDiscountForwardCurve dcFunding, - final org.drip.state.forward.ForwardCurve fc, - final org.drip.state.govvie.GovvieCurve gc, - final org.drip.state.credit.CreditCurve cc, - final java.lang.String strComponentCode, - final org.drip.param.definition.ProductQuote compQuote, - final org.drip.analytics.support.CaseInsensitiveTreeMap - mTSYQuotes, - final org.drip.param.market.LatentStateFixingsContainer lsfc) - { - org.drip.param.market.CurveSurfaceQuoteContainer csqs = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - if (null != cc && !csqs.setCreditState (cc)) return null; - - if (null != gc && !csqs.setGovvieState (gc)) return null; - - if (null != lsfc && !csqs.setFixings (lsfc)) return null; - - if (null != dcFunding && !csqs.setFundingState (dcFunding)) return null; - - if (null != mTSYQuotes && !csqs.setQuoteMap (mTSYQuotes)) return null; - - if (null != compQuote && null != strComponentCode && !strComponentCode.isEmpty() && - !csqs.setProductQuote (strComponentCode, compQuote)) - return null; - - if (null != fc && !csqs.setForwardState (fc)) return null; - - return csqs; - } - - /** - * Create a Market Parameters instance with the Funding Curve alone - * - * @param dcFunding Funding Curve - * - * @return Market Parameters instance - */ - - public static final org.drip.param.market.CurveSurfaceQuoteContainer Discount ( - final org.drip.state.discount.MergedDiscountForwardCurve dcFunding) - { - return Create (dcFunding, null, null, null, "", null, null, null); - } - - /** - * Create a Market Parameters instance with the Funding Curve and the forward Curve - * - * @param dcFunding Funding Curve - * @param fc Forward Curve - * - * @return Market Parameters instance - */ - - public static final org.drip.param.market.CurveSurfaceQuoteContainer DiscountForward ( - final org.drip.state.discount.MergedDiscountForwardCurve dcFunding, - final org.drip.state.forward.ForwardCurve fc) - { - return Create (dcFunding, fc, null, null, "", null, null, null); - } - - /** - * Create a Market Parameters instance with the rates discount curve and the treasury discount curve alone - * - * @param dcFunding Funding Curve - * @param gc Govvie Curve - * - * @return Market Parameters instance - */ - - public static final org.drip.param.market.CurveSurfaceQuoteContainer Govvie ( - final org.drip.state.discount.MergedDiscountForwardCurve dcFunding, - final org.drip.state.govvie.GovvieCurve gc) - { - return Create (dcFunding, null, gc, null, "", null, null, null); - } - - /** - * Create a Market Parameters Instance with the Funding Curve and the credit curve - * - * @param dcFunding Funding Curve - * @param cc Credit Curve - * - * @return The Market Parameters Instance - */ - - public static final org.drip.param.market.CurveSurfaceQuoteContainer Credit ( - final org.drip.state.discount.MergedDiscountForwardCurve dcFunding, - final org.drip.state.credit.CreditCurve cc) - { - return Create (dcFunding, null, null, cc, "", null, null, null); - } - - /** - * Create a Market Parameters Instance with the Funding Curve, the Govvie Curve, the Credit Curve, the - * component quote, the map of treasury benchmark quotes, and the Latent State Fixings Container - * - * @param dcFunding Funding Curve - * @param gc Govvie Curve - * @param cc Credit Curve - * @param strComponentCode Component Code - * @param compQuote Component quote - * @param mTSYQuotes Map of Treasury Benchmark Quotes - * @param lsfc Latent State Fixings Container - * - * @return Market Parameters Instance - */ - - public static final org.drip.param.market.CurveSurfaceQuoteContainer Create ( - final org.drip.state.discount.MergedDiscountForwardCurve dcFunding, - final org.drip.state.govvie.GovvieCurve gc, - final org.drip.state.credit.CreditCurve cc, - final java.lang.String strComponentCode, - final org.drip.param.definition.ProductQuote compQuote, - final org.drip.analytics.support.CaseInsensitiveTreeMap - mTSYQuotes, - final org.drip.param.market.LatentStateFixingsContainer lsfc) - { - return Create (dcFunding, null, gc, cc, strComponentCode, compQuote, mTSYQuotes, lsfc); - } - - /** - * Create MarketParams from the array of calibration instruments - * - * @return MarketParams object - */ - - public static final org.drip.param.definition.ScenarioMarketParams CreateMarketParams() - { - try { - return new org.drip.param.market.CurveSurfaceScenarioContainer(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/param/creator/QuoteBuilder.java b/org/drip/param/creator/QuoteBuilder.java deleted file mode 100644 index be9544f..0000000 --- a/org/drip/param/creator/QuoteBuilder.java +++ /dev/null @@ -1,114 +0,0 @@ - -package org.drip.param.creator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * QuoteBuilder contains the quote builder object. It contains static functions that build 2 sided quotes - * from inputs, as well as from a byte stream. - * - * @author Lakshmi Krishnamurthy - */ - -public class QuoteBuilder { - - /** - * Constructor: Constructs a Quote object from the quote value and the side string. - * - * @param strSide bid/ask/mid - * @param dblQuote Quote Value - * @param dblSize Size - * - * @return Quote Instance - */ - - public static final org.drip.param.definition.Quote CreateQuote ( - final java.lang.String strSide, - final double dblQuote, - final double dblSize) - { - try { - return new org.drip.param.quote.MultiSided (strSide, dblQuote, dblSize); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Constructor: Constructs an Empty Product Quote instance. - * - * @return ProductQuote Instance - */ - - public static final org.drip.param.definition.ProductQuote CreateProductQuote() - { - try { - return new org.drip.param.quote.ProductMultiMeasure(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Constructor: Constructs an Empty Product Tick Quote instance. - * - * @return Product Tick Quote Instance - */ - - public static final org.drip.param.quote.ProductTick CreateProductTickQuote() - { - return new org.drip.param.quote.ProductTick(); - } -} diff --git a/org/drip/param/definition/CalibrationParams.java b/org/drip/param/definition/CalibrationParams.java deleted file mode 100644 index c6da1b5..0000000 --- a/org/drip/param/definition/CalibrationParams.java +++ /dev/null @@ -1,138 +0,0 @@ - -package org.drip.param.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * CalibrationParams the calibration parameters - the measure to be calibrated, the type/nature of the - * calibration to be performed, and the work-out date to which the calibration is done. - * - * @author Lakshmi Krishnamurthy - */ - -public class CalibrationParams { - private int _iType = 0; - private java.lang.String _strMeasure = ""; - private org.drip.param.valuation.WorkoutInfo _wi = null; - - /** - * Create a standard calibration parameter instance around the price measure and base type - * - * @return CalibrationParams instance - */ - - public static final CalibrationParams Standard() - { - try { - return new CalibrationParams ("Price", 0, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * CalibrationParams constructor - * - * @param strMeasure Measure to be calibrated - * @param iType Calibration Type - * @param wi Work out Information - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public CalibrationParams ( - final java.lang.String strMeasure, - final int iType, - final org.drip.param.valuation.WorkoutInfo wi) - throws java.lang.Exception - { - if (null == (_strMeasure = strMeasure) || _strMeasure.isEmpty()) - throw new java.lang.Exception ("CalibrationParams ctr => Invalid Inputs"); - - _wi = wi; - _iType = iType; - } - - /** - * Retrieve the Calibration Type - * - * @return The Calibration Type - */ - - public int type() - { - return _iType; - } - - /** - * Retrieve the Calibration Measure - * - * @return The Calibration Measure - */ - - public java.lang.String measure() - { - return _strMeasure; - } - - /** - * Retrieve the Work-out Info - * - * @return The Work-out Info - */ - - public org.drip.param.valuation.WorkoutInfo workout() - { - return _wi; - } -} diff --git a/org/drip/param/definition/CreditManifestMeasureTweak.java b/org/drip/param/definition/CreditManifestMeasureTweak.java deleted file mode 100644 index 6aedc52..0000000 --- a/org/drip/param/definition/CreditManifestMeasureTweak.java +++ /dev/null @@ -1,160 +0,0 @@ - -package org.drip.param.definition; - - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * CreditManifestMeasureTweak contains the place holder for the credit curve scenario tweak parameters: in - * addition to the ResponseValueTweakParams fields, this exposes the calibration manifest measure, the curve - * node, and the nodal calibration type (entire curve/flat or a given tenor point). - * - * @author Lakshmi Krishnamurthy - */ - -public class CreditManifestMeasureTweak extends ManifestMeasureTweak { - - /** - * Tweak Parameter Type of Quote - */ - - public static final java.lang.String CREDIT_TWEAK_NODE_PARAM_QUOTE = "Quote"; - - /** - * Tweak Parameter Type of Recovery - */ - - public static final java.lang.String CREDIT_TWEAK_NODE_PARAM_RECOVERY = "Recovery"; - - /** - * Tweak Measure Type of Quote - */ - - public static final java.lang.String CREDIT_TWEAK_NODE_MEASURE_QUOTE = "Quote"; - - /** - * Tweak Measure Type of Hazard - */ - - public static final java.lang.String CREDIT_TWEAK_NODE_MEASURE_HAZARD = "Hazard"; - - private boolean _bSingleNodeCalib = false; - private java.lang.String _strParamType = ""; - private java.lang.String _strMeasureType = ""; - - /** - * CreditManifestMeasureTweak constructor - * - * @param strParamType Node Tweak Parameter Type - * @param strMeasureType Node Tweak Measure Type - * @param iNode Node to be tweaked - Set to NODE_FLAT_TWEAK for flat curve tweak - * @param bIsProportional True - Tweak is proportional, False - parallel - * @param dblAmount Amount to be tweaked - proportional tweaks are represented as percent, parallel - * tweaks are absolute numbers - * @param bSingleNodeCalib Flat Calibration using a single node? - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CreditManifestMeasureTweak ( - final java.lang.String strParamType, - final java.lang.String strMeasureType, - final int iNode, - final boolean bIsProportional, - final double dblAmount, - final boolean bSingleNodeCalib) - throws java.lang.Exception - { - super (iNode, bIsProportional, dblAmount); - - if (null == (_strParamType = strParamType)) - throw new java.lang.Exception - ("CreditManifestMeasureTweak ctr => Invalid Tweak Parameter Type!"); - - if (null == (_strMeasureType = strMeasureType)) - throw new java.lang.Exception ("CreditManifestMeasureTweak ctr => Invalid Tweak Measure Type!"); - - _bSingleNodeCalib = bSingleNodeCalib; - } - - /** - * Single Node Calibration Flag - * - * @return TRUE - Turn on Single Node Calibration - */ - - public boolean singleNodeCalib() - { - return _bSingleNodeCalib; - } - - /** - * Retrieve the Tweak Parameter Type - * - * @return The Tweak Parameter Type - */ - - public java.lang.String paramType() - { - return _strParamType; - } - - /** - * Retrieve the Tweak Measure Type - * - * @return The Tweak Measure Type - */ - - public java.lang.String measureType() - { - return _strMeasureType; - } -} diff --git a/org/drip/param/definition/ManifestMeasureTweak.java b/org/drip/param/definition/ManifestMeasureTweak.java deleted file mode 100644 index 5d7ce37..0000000 --- a/org/drip/param/definition/ManifestMeasureTweak.java +++ /dev/null @@ -1,129 +0,0 @@ - -package org.drip.param.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * ManifestMeasureTweak contains the place holder for the scenario tweak parameters, for either a specific curve - * node, or the entire curve (flat). Parameter bumps can be parallel or proportional. - * - * @author Lakshmi Krishnamurthy - */ - -public class ManifestMeasureTweak { - - /** - * Flat Manifest Measure Tweak Mode - */ - - public static final int FLAT = -1; - - private int _iNode = FLAT; - private boolean _bIsProportional = false; - private double _dblAmount = java.lang.Double.NaN; - - /** - * ManifestMeasureTweak constructor - * - * @param iNode Node to be tweaked - Set to NODE_FLAT_TWEAK for flat curve tweak - * @param bIsProportional True - Tweak is proportional, False - parallel - * @param dblAmount Amount to be tweaked - proportional tweaks are represented as percent, parallel - * tweaks are absolute numbers - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public ManifestMeasureTweak ( - final int iNode, - final boolean bIsProportional, - final double dblAmount) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblAmount = dblAmount)) - throw new java.lang.Exception ("ManifestMeasureTweak ctr => Invalid Inputs"); - - _iNode = iNode; - _bIsProportional = bIsProportional; - } - - /** - * Index of the Node to be tweaked - * - * @return Index of the Node to be tweaked - */ - - public int node() - { - return _iNode; - } - - /** - * Amount to be tweaked by - * - * @return Amount to be tweaked by - */ - - public double amount() - { - return _dblAmount; - } - - /** - * Is the Tweak Proportional - * - * @return TRUE - The Tweak is Proportional - */ - - public boolean isProportional() - { - return _bIsProportional; - } -} diff --git a/org/drip/param/definition/ProductQuote.java b/org/drip/param/definition/ProductQuote.java deleted file mode 100644 index dd28c1b..0000000 --- a/org/drip/param/definition/ProductQuote.java +++ /dev/null @@ -1,147 +0,0 @@ - -package org.drip.param.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * ProductQuote abstract class holds the different types of quotes for a given product. It contains a single - * market field/quote pair, but multiple alternate named quotes (to accommodate quotes on different - * measures for the component). - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class ProductQuote { - - /** - * Add a regular or a market quote for the component - * - * @param strQuoteField The quote field - * @param q Quote to be added - * @param bIsMarketQuote Whether the quote is a market quote - */ - - public abstract void addQuote ( - final java.lang.String strQuoteField, - final org.drip.param.definition.Quote q, - final boolean bIsMarketQuote); - - /** - * Set the market quote for the component - * - * @param strMarketQuoteField Market Quote field - * @param q Quote - * - * @return True if successfully added - */ - - public abstract boolean setMarketQuote ( - final java.lang.String strMarketQuoteField, - final org.drip.param.definition.Quote q); - - /** - * Remove the market quote - * - * @return TRUE - The Market Quote has been removed - */ - - public abstract boolean removeMarketQuote(); - - /** - * Get the Quote for the given Field - * - * @param strQuoteField Field Name - * - * @return Quote object - */ - - public abstract org.drip.param.definition.Quote quote ( - final java.lang.String strQuoteField); - - /** - * Return the market quote object - * - * @return Quote object - */ - - public abstract org.drip.param.definition.Quote marketQuote(); - - /** - * Retrieve the market quote field - * - * @return Field name - */ - - public abstract java.lang.String marketQuoteField(); - - /** - * Remove the named Quote - * - * @param strQuoteField Named Quote Field - * - * @return Success (true) or failure (false) - */ - - public abstract boolean removeQuote ( - final java.lang.String strQuoteField); - - /** - * Indicate if the named quote is available - * - * @param strQuoteField The Quote Name - * - * @return TRUE - Named Quote is present - */ - - public abstract boolean containsQuote ( - final java.lang.String strQuoteField); -} diff --git a/org/drip/param/definition/Quote.java b/org/drip/param/definition/Quote.java deleted file mode 100644 index 71939a2..0000000 --- a/org/drip/param/definition/Quote.java +++ /dev/null @@ -1,111 +0,0 @@ - -package org.drip.param.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * Quote interface contains the stubs corresponding to a product quote. It contains the quote value, quote - * instant for the different quote sides (bid/ask/mid). - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class Quote { - - /** - * Get the quote value for the given side - * - * @param strSide bid/ask/mid - * - * @return Quote Value - */ - - public abstract double value ( - final java.lang.String strSide); - - /** - * Get the quote size for the given side - * - * @param strSide bid/ask/mid - * - * @return Size - */ - - public abstract double size ( - final java.lang.String strSide); - - /** - * Get the time of the quote - * - * @param strSide bid/ask/mid - * - * @return DateTime - */ - - public abstract org.drip.analytics.date.DateTime time ( - final java.lang.String strSide); - - /** - * Set the quote for the specified side - * - * @param strSide bid/ask/mid - * @param dblQuote Quote value - * @param dblSize Size - * - * @return Success (true) or failure (false) - */ - - public abstract boolean setSide ( - final java.lang.String strSide, - final double dblQuote, - final double dblSize); -} diff --git a/org/drip/param/definition/ScenarioMarketParams.java b/org/drip/param/definition/ScenarioMarketParams.java deleted file mode 100644 index 32785c5..0000000 --- a/org/drip/param/definition/ScenarioMarketParams.java +++ /dev/null @@ -1,446 +0,0 @@ - -package org.drip.param.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * ScenarioMarketParams is the place holder for the comprehensive suite of the market set of curves for the - * given date. It exports the following functionality: - * - add/remove/retrieve scenario discount curve - * - add/remove/retrieve scenario forward curve - * - add/remove/retrieve scenario zero curve - * - add/remove/retrieve scenario credit curve - * - add/remove/retrieve scenario recovery curve - * - add/remove/retrieve scenario FXForward curve - * - add/remove/retrieve scenario FXBasis curve - * - add/remove/retrieve scenario fixings - * - add/remove/retrieve Treasury/component quotes - * - retrieve scenario Market Parameters - * - retrieve map of flat rates/credit/recovery Market Parameters - * - retrieve double map of tenor rates/credit/recovery Market Parameters - * - retrieve rates/credit scenario generator - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class ScenarioMarketParams { - - /** - * Add the named scenario DC - * - * @param strName Name - * @param dcsc Corresponding DiscountCurveScenarioContainer instance - * - * @return Added successfully (true) - */ - - public abstract boolean addScenarioDiscountCurve ( - final java.lang.String strName, - final org.drip.param.market.DiscountCurveScenarioContainer dcsc); - - /** - * Remove the named scenario DC - * - * @param strName Name - * - * @return Removed successfully (true) - */ - - public abstract boolean removeScenarioDiscountCurve ( - final java.lang.String strName); - - /** - * Add the named scenario CC - * - * @param strName Name - * @param scc ScenarioCreditCurve Instance - * - * @return Added successfully (true) - */ - - public abstract boolean addScenarioCreditCurve ( - final java.lang.String strName, - final org.drip.param.market.CreditCurveScenarioContainer scc); - - /** - * Removes the named scenario CC - * - * @param strName Name - * - * @return Removed successfully (true) - */ - - public abstract boolean removeScenarioCreditCurve ( - final java.lang.String strName); - - /** - * Add the named Treasury Quote - * - * @param strBenchmark Name - * @param pqTSY Treasury Quote - * - * @return Added successfully (true) - */ - - public abstract boolean addTSYQuote ( - final java.lang.String strBenchmark, - final org.drip.param.definition.ProductQuote pqTSY); - - /** - * Remove the named Treasury Quote - * - * @param strBenchmark Name - * - * @return Removed successfully (true) - */ - - public abstract boolean removeTSYQuote ( - final java.lang.String strBenchmark); - - /** - * Set the full set of named Treasury Quote Map - * - * @param mapCQTSY Named Treasury Quote Map - * - * @return Set successfully (true) - */ - - public abstract boolean setTSYQuotes ( - final org.drip.analytics.support.CaseInsensitiveTreeMap - mapCQTSY); - - /** - * Get the named Treasury Quote Map corresponding to the desired benchmark - * - * @param strBenchmark The treasury benchmark - * - * @return Treasury Quote - */ - - public abstract org.drip.param.definition.ProductQuote tsyQuote ( - final java.lang.String strBenchmark); - - /** - * Get the full set of named Treasury Quote Map - * - * @return Named Treasury Quote Map - */ - - public abstract org.drip.analytics.support.CaseInsensitiveTreeMap - tsyQuotes(); - - /** - * Add the fixing for the given Latent State Label and the given date - * - * @param dtFix The fixing date - * @param lsl The Latent State Label - * @param dblFixing The fixing - * - * @return Added successfully (true) - */ - - public abstract boolean addFixing ( - final org.drip.analytics.date.JulianDate dtFix, - final org.drip.state.identifier.LatentStateLabel lsl, - final double dblFixing); - - /** - * Remove the fixing corresponding to the given date and the Latent State Label - * - * @param dtFix Fixing date - * @param lsl The Latent State label - * - * @return Successfully removed (true) - */ - - public abstract boolean removeFixing ( - final org.drip.analytics.date.JulianDate dtFix, - final org.drip.state.identifier.LatentStateLabel lsl); - - /** - * Retrieve the Latent State Fixings Container - * - * @return The Latent State Fixings Container - */ - - public abstract org.drip.param.market.LatentStateFixingsContainer fixings(); - - /** - * Add the component quote - * - * @param strComponentID Component ID - * @param cqComponent Component Quote - * - * @return Added successfully (true) - */ - - public abstract boolean addComponentQuote ( - final java.lang.String strComponentID, - final org.drip.param.definition.ProductQuote cqComponent); - - /** - * Remove the component quote - * - * @param strComponentID Component ID - * - * @return Removed successfully (true) - */ - - public abstract boolean removeComponentQuote ( - final java.lang.String strComponentID); - - /** - * Add the full map of component quotes - * - * @param mapComponentQuote Map of Component Quotes - * - * @return Added successfully (true) - */ - - public abstract boolean addComponentQuote ( - final org.drip.analytics.support.CaseInsensitiveTreeMap - mapComponentQuote); - - /** - * Retrieve the quote for the given component - * - * @param strComponentID Component ID - * - * @return ComponentQuote - */ - - public abstract org.drip.param.definition.ProductQuote componentQuote ( - final java.lang.String strComponentID); - - /** - * Retrieve the full map of component quotes - * - * @return The Map of Component Quotes - */ - - public abstract org.drip.analytics.support.CaseInsensitiveTreeMap - componentQuotes(); - - /** - * Add the named scenario Market Parameters - * - * @param strScenarioName Scenario Name - * @param csqs Market Parameters - * - * @return True - Added successfully - */ - - public abstract boolean addScenarioMarketParams ( - final java.lang.String strScenarioName, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs); - - /** - * Retrieve the Named Scenario Market Parameters - * - * @param strScenarioName Scenario Name - * - * @return Named Market Parameters - */ - - public abstract org.drip.param.market.CurveSurfaceQuoteContainer scenarioMarketParams ( - final java.lang.String strScenarioName); - - /** - * Get the Market Parameters corresponding to the component and the scenario - * - * @param comp Component - * @param strScenario Scenario - * - * @return The Market Parameters - */ - - public abstract org.drip.param.market.CurveSurfaceQuoteContainer scenarioMarketParams ( - final org.drip.product.definition.Component comp, - final java.lang.String strScenario); - - /** - * Get the Map of Funding Tenor Bumped Market Parameters corresponding to the Component - * - * @param comp Component - * @param bBumpUp TRUE - Bump Up - * - * @return Map of the Funding Tenor Bumped Market Parameters - */ - - public abstract - org.drip.analytics.support.CaseInsensitiveTreeMap - fundingTenorMarketParams ( - final org.drip.product.definition.Component comp, - final boolean bBumpUp); - - /** - * Get the map of tenor credit bumped Market Parameters corresponding to the component - * - * @param comp Component - * @param bBumpUp Bump up (True) - * - * @return Map of the tenor credit bumped Market Parameters - */ - - public abstract - org.drip.analytics.support.CaseInsensitiveTreeMap - creditTenorMarketParams ( - final org.drip.product.definition.Component comp, - final boolean bBumpUp); - - /** - * Get the Market Parameters for the given basket product and the scenario - * - * @param bp BasketProduct - * @param strScenario Named Scenario - * - * @return Market Parameters Instance - */ - - public abstract org.drip.param.market.CurveSurfaceQuoteContainer scenarioMarketParams ( - final org.drip.product.definition.BasketProduct bp, - final java.lang.String strScenario); - - /** - * Get the Map of Funding Parallel Bumped Curves for the given Basket Product - * - * @param bp BasketProduct - * @param bBump True (Bump Up), False (Bump Down) - * - * @return Map of the Funding Parallel Bumped curves - */ - - public abstract - org.drip.analytics.support.CaseInsensitiveTreeMap - fundingFlatBump ( - final org.drip.product.definition.BasketProduct bp, - final boolean bBump); - - /** - * Get the Map of credit Flat Bumped Curves for the given Basket Product - * - * @param bp BasketProduct - * @param bBump True (Bump Up), False (Bump Down) - * - * @return Map of the Credit Flat Bumped Curves - */ - - public abstract - org.drip.analytics.support.CaseInsensitiveTreeMap - creditFlatBump ( - final org.drip.product.definition.BasketProduct bp, - final boolean bBump); - - /** - * Get the map of Recovery Flat Bumped Curves for the given Basket Product - * - * @param bp BasketProduct - * @param bBump True (Bump Up), False (Bump Down) - * - * @return Map of the Recovery Flat Bumped Curves - */ - - public abstract - org.drip.analytics.support.CaseInsensitiveTreeMap - recoveryFlatBump ( - final org.drip.product.definition.BasketProduct bp, - final boolean bBump); - - /** - * Get the Double Map of Funding Tenor Bumped Curves for each Funding Curve for the given Basket Product - * - * @param bp BasketProduct - * @param bBump True (Bump Up), False (Bump Down) - * - * @return Double Map of the Funding Tenor Bumped Market Parameters - */ - - public abstract - org.drip.analytics.support.CaseInsensitiveTreeMap> - fundingTenorBump ( - final org.drip.product.definition.BasketProduct bp, - final boolean bBump); - - /** - * Get the double map of credit Tenor bumped curves for each credit curve for the given Basket Product - * - * @param bp BasketProduct - * @param bBump True (Bump Up), False (Bump Down) - * - * @return Double Map of the credit Tenor bumped Market Parameters - */ - - public abstract - org.drip.analytics.support.CaseInsensitiveTreeMap> - creditTenorBump ( - final org.drip.product.definition.BasketProduct bp, - final boolean bBump); - - /** - * Retrieve the Map of DiscountCurveScenarioContainer Instances - * - * @return Map of DiscountCurveScenarioContainer Instances - */ - - public abstract - org.drip.analytics.support.CaseInsensitiveTreeMap - scenarioDiscountCurveMap(); - - /** - * Retrieve the Map of ScenarioCreditCurve Instances - * - * @return Map of ScenarioCreditCurve Instances - */ - - public abstract - org.drip.analytics.support.CaseInsensitiveTreeMap - scenarioCreditCurveMap(); -} diff --git a/org/drip/param/market/CreditCurveScenarioContainer.java b/org/drip/param/market/CreditCurveScenarioContainer.java deleted file mode 100644 index 9104927..0000000 --- a/org/drip/param/market/CreditCurveScenarioContainer.java +++ /dev/null @@ -1,381 +0,0 @@ - -package org.drip.param.market; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * CreditCurveScenarioContainer contains the place holder for the bump parameters and the curves for the - * different credit curve scenarios. Contains the spread and the recovery bumps, and the credit curve - * scenario generator object that wraps the calibration instruments. It also contains the base credit curve, - * spread bumped up/down credit curves, recovery bumped up/down credit curves, and the tenor mapped up/down - * credit curves. - * - * @author Lakshmi Krishnamurthy - */ - -public class CreditCurveScenarioContainer { - - /** - * CC Scenario Base - */ - - public static final int CC_BASE = 0; - - /** - * CC Scenario Parallel Up - */ - - public static final int CC_FLAT_UP = 1; - - /** - * CC Scenario Parallel Down - */ - - public static final int CC_FLAT_DN = 2; - - /** - * CC Scenario Tenor Up - */ - - public static final int CC_TENOR_UP = 4; - - /** - * CC Scenario Tenor Down - */ - - public static final int CC_TENOR_DN = 8; - - /** - * CC Scenario Recovery Parallel Up - */ - - public static final int CC_RR_FLAT_UP = 16; - - /** - * CC Scenario Recovery Parallel Down - */ - - public static final int CC_RR_FLAT_DN = 32; - - private double _dblCouponBump = java.lang.Double.NaN; - private double _dblRecoveryBump = java.lang.Double.NaN; - private org.drip.state.credit.CreditCurve _ccBase = null; - private org.drip.state.credit.CreditCurve _ccBumpUp = null; - private org.drip.state.credit.CreditCurve _ccBumpDn = null; - private org.drip.state.credit.CreditCurve _ccRecoveryUp = null; - private org.drip.state.credit.CreditCurve _ccRecoveryDn = null; - private org.drip.product.definition.CalibratableComponent[] _aCalibInst = null; - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCCCustom = null; - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCCTenorBumpUp = null; - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCCTenorBumpDn = null; - - /** - * Construct CreditCurveScenarioContainer from the array of calibration instruments, the coupon bump - * parameter, and the recovery bump parameter - * - * @param aCalibInst Array of calibration instruments - * @param dblCouponBump Coupon Bump - * @param dblRecoveryBump Recovery Bump - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public CreditCurveScenarioContainer ( - final org.drip.product.definition.CalibratableComponent[] aCalibInst, - final double dblCouponBump, - final double dblRecoveryBump) - throws java.lang.Exception - { - if (null == (_aCalibInst = aCalibInst) || 0 == _aCalibInst.length || - !org.drip.quant.common.NumberUtil.IsValid (_dblCouponBump = dblCouponBump) || - !org.drip.quant.common.NumberUtil.IsValid (_dblRecoveryBump = dblRecoveryBump)) - throw new java.lang.Exception ("CreditCurveScenarioContainer ctr => Invalid Inputs!"); - } - - /** - * Cook and save the credit curves corresponding to the scenario specified - * - * @param strName Credit Curve Name - * @param valParams ValuationParams - * @param dc Base Discount Curve - * @param gc Govvie Curve - * @param astrCalibMeasure Matched array of Calibration measures - * @param adblQuote Matched array of Quotes - * @param dblRecovery Curve Recovery - * @param lsfc Latent State Fixings Container - * @param vcp Valuation Customization Parameters - * @param bFlat Whether the calibration is to a flat curve - * @param iScenario One of the values in the CC_ enum listed above. - * - * @return Success (true), failure (false) - */ - - public boolean cookScenarioCC ( - final java.lang.String strName, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.state.govvie.GovvieCurve gc, - final java.lang.String[] astrCalibMeasure, - final double[] adblQuote, - final double dblRecovery, - final org.drip.param.market.LatentStateFixingsContainer lsfc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final boolean bFlat, - final int iScenario) - { - if (null == (_ccBase = org.drip.state.boot.CreditCurveScenario.Standard (strName, valParams, - _aCalibInst, adblQuote, astrCalibMeasure, dblRecovery, bFlat, dc, gc, lsfc, vcp))) - return false; - - if (0 != (org.drip.param.market.CreditCurveScenarioContainer.CC_FLAT_UP & iScenario)) { - if (null == (_ccBumpUp = org.drip.state.boot.CreditCurveScenario.Standard (strName, valParams, - _aCalibInst, org.drip.analytics.support.Helper.BumpQuotes (adblQuote, - _dblCouponBump, false), astrCalibMeasure, dblRecovery, bFlat, dc, gc, lsfc, vcp))) - return false; - } - - if (0 != (org.drip.param.market.CreditCurveScenarioContainer.CC_FLAT_DN & iScenario)) { - if (null == (_ccBumpDn = org.drip.state.boot.CreditCurveScenario.Standard (strName, valParams, - _aCalibInst, org.drip.analytics.support.Helper.BumpQuotes (adblQuote, -_dblCouponBump, - false), astrCalibMeasure, dblRecovery, bFlat, dc, gc, lsfc, vcp))) - return false; - } - - if (0 != (org.drip.param.market.CreditCurveScenarioContainer.CC_TENOR_UP & iScenario)) { - if (null == (_mapCCTenorBumpUp = org.drip.state.boot.CreditCurveScenario.TenorMap (strName, - valParams, _aCalibInst, adblQuote, astrCalibMeasure, dblRecovery, bFlat, _dblCouponBump, dc, - gc, lsfc, vcp))) - return false; - } - - if (0 != (org.drip.param.market.CreditCurveScenarioContainer.CC_TENOR_DN & iScenario)) { - if (null == (_mapCCTenorBumpDn = org.drip.state.boot.CreditCurveScenario.TenorMap (strName, - valParams, _aCalibInst, adblQuote, astrCalibMeasure, dblRecovery, bFlat, -_dblCouponBump, dc, - gc, lsfc, vcp))) - return false; - } - - if (0 != (org.drip.param.market.CreditCurveScenarioContainer.CC_RR_FLAT_UP & iScenario)) { - if (null == (_ccRecoveryUp = org.drip.state.boot.CreditCurveScenario.Standard (strName, - valParams, _aCalibInst, adblQuote, astrCalibMeasure, dblRecovery + _dblRecoveryBump, bFlat, - dc, gc, lsfc, vcp))) - return false; - } - - if (0 != (org.drip.param.market.CreditCurveScenarioContainer.CC_RR_FLAT_DN & iScenario)) { - if (null == (_ccRecoveryDn = org.drip.state.boot.CreditCurveScenario.Standard (strName, - valParams, _aCalibInst, adblQuote, astrCalibMeasure, dblRecovery - _dblRecoveryBump, bFlat, - dc, gc, lsfc, vcp))) - return false; - } - - return true; - } - - /** - * Cook the credit curve according to the desired tweak parameters - * - * @param strName Scenario Credit Curve Name - * @param strCustomName Scenario Name - * @param valParams Valuation Parameters - * @param dc Discount Curve - * @param gc Govvie Curve - * @param astrCalibMeasure Array of calibration measures - * @param adblQuote Double array of input quotes - * @param dblRecovery Recovery Rate - * @param lsfc Latent State Fixings Container - * @param vcp Valuation Customization Parameters - * @param bFlat Whether the calibration is flat - * @param rvtpDC Node Tweak Parameters for the Base Discount Curve - * @param rvtpTSY Node Tweak Parameters for the TSY Discount Curve - * @param rvtpCC Node Tweak Parameters for the Credit Curve - * - * @return True - Credit Curve successfully created - */ - - public boolean cookCustomCC ( - final java.lang.String strName, - final java.lang.String strCustomName, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.state.govvie.GovvieCurve gc, - final java.lang.String[] astrCalibMeasure, - final double[] adblQuote, - final double dblRecovery, - final org.drip.param.market.LatentStateFixingsContainer lsfc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final boolean bFlat, - final org.drip.param.definition.ManifestMeasureTweak rvtpDC, - final org.drip.param.definition.ManifestMeasureTweak rvtpTSY, - final org.drip.param.definition.ManifestMeasureTweak rvtpCC) - { - if (null == dc) return false; - - org.drip.state.discount.MergedDiscountForwardCurve dcAdj = (org.drip.state.discount.MergedDiscountForwardCurve) - dc.customTweakManifestMeasure ("Rate", rvtpDC); - - org.drip.state.govvie.GovvieCurve gcAdj = (org.drip.state.govvie.GovvieCurve) - gc.customTweakManifestMeasure ("Rate", rvtpTSY); - - org.drip.state.credit.CreditCurve ccBaseCustom = org.drip.state.boot.CreditCurveScenario.Standard - (strName, valParams, _aCalibInst, adblQuote, astrCalibMeasure, dblRecovery, bFlat, null == dcAdj - ? dc : dcAdj, null == gcAdj ? gc : gcAdj, lsfc, vcp); - - if (null == ccBaseCustom) return false; - - if (null == _mapCCCustom) - _mapCCCustom = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - org.drip.state.credit.CreditCurve ccCustom = (org.drip.state.credit.CreditCurve) - ccBaseCustom.customTweakManifestMeasure ("Rate", rvtpCC); - - if (null == ccCustom) - _mapCCCustom.put (strCustomName, ccBaseCustom); - else - _mapCCCustom.put (strCustomName, ccCustom); - - return true; - } - - /** - * Return the base credit curve - * - * @return The base credit curve - */ - - public org.drip.state.credit.CreditCurve base() - { - return _ccBase; - } - - /** - * Return the bump up credit curve - * - * @return The Bumped up credit curve - */ - - public org.drip.state.credit.CreditCurve bumpUp() - { - return _ccBumpUp; - } - - /** - * Return the bump Down credit curve - * - * @return The Bumped Down credit curve - */ - - public org.drip.state.credit.CreditCurve bumpDown() - { - return _ccBumpDn; - } - - /** - * Return the recovery bump up credit curve - * - * @return The Recovery Bumped up credit curve - */ - - public org.drip.state.credit.CreditCurve bumpRecoveryUp() - { - return _ccRecoveryUp; - } - - /** - * Return the recovery bump Down credit curve - * - * @return The Recovery Bumped Down credit curve - */ - - public org.drip.state.credit.CreditCurve bumpRecoveryDown() - { - return _ccRecoveryDn; - } - - /** - * Return the tenor bump up credit curve map - * - * @return The Tenor Bumped up credit curve Map - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap tenorBumpUp() - { - return _mapCCTenorBumpUp; - } - - /** - * Return the tenor bump Down credit curve map - * - * @return The Tenor Bumped Down credit curve Map - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap - tenorBumpDown() - { - return _mapCCTenorBumpDn; - } - - /** - * Return the Custom credit curve map - * - * @return The Custom credit curve Map - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap custom() - { - return _mapCCCustom; - } -} diff --git a/org/drip/param/market/CurveSurfaceQuoteContainer.java b/org/drip/param/market/CurveSurfaceQuoteContainer.java deleted file mode 100644 index 58ad01b..0000000 --- a/org/drip/param/market/CurveSurfaceQuoteContainer.java +++ /dev/null @@ -1,5980 +0,0 @@ - -package org.drip.param.market; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * CurveSurfaceQuoteContainer provides implementation of the set of the market curve parameters. It serves as - * a place holder for the market parameters needed to value the product – discount curve, forward curve, - * treasury curve, credit curve, product quote, treasury quote map, and fixings map. - * - * @author Lakshmi Krishnamurthy - */ - -public class CurveSurfaceQuoteContainer { - private - org.drip.analytics.support.CaseInsensitiveTreeMap> - _mapPayCurrencyForeignCollateralDC = new - org.drip.analytics.support.CaseInsensitiveTreeMap>(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCreditState = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapEquityState = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapForwardState = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapFundingState = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapFXState = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapGovvieState = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapOvernightState = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapPaydownState = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapRatingState = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapRecoveryState = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap _mapRepoState = - new org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCollateralVolatility = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCreditVolatility = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCustomVolatility = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapEquityVolatility = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapForwardVolatility = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapFundingVolatility = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapFXVolatility = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapGovvieVolatility = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapOvernightVolatility = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapPaydownVolatility = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapRatingVolatility = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapRecoveryVolatility = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapRepoVolatility = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCollateralCollateralCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCollateralCreditCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCollateralCustomCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCollateralEquityCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCollateralForwardCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCollateralFundingCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCollateralFXCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCollateralGovvieCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCollateralOvernightCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCollateralPaydownCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCollateralRatingCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCollateralRecoveryCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCollateralRepoCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCreditCreditCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCreditCustomCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCreditEquityCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCreditForwardCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCreditFundingCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCreditFXCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCreditGovvieCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCreditOvernightCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCreditPaydownCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCreditRatingCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCreditRecoveryCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCreditRepoCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCustomCustomCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCustomEquityCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCustomForwardCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCustomFundingCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCustomFXCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCustomGovvieCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCustomOvernightCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCustomPaydownCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCustomRatingCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCustomRecoveryCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCustomRepoCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapEquityEquityCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapEquityForwardCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapEquityFundingCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapEquityFXCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapEquityGovvieCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapEquityOvernightCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapEquityPaydownCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapEquityRatingCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapEquityRecoveryCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapEquityRepoCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapForwardForwardCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapForwardFundingCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapForwardFXCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapForwardGovvieCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapForwardOvernightCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapForwardPaydownCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapForwardRatingCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapForwardRecoveryCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapForwardRepoCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapFundingFundingCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapFundingFXCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapFundingGovvieCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapFundingOvernightCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapFundingPaydownCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapFundingRatingCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapFundingRecoveryCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapFundingRepoCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapFXFXCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapFXGovvieCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapFXOvernightCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapFXPaydownCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapFXRatingCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapFXRecoveryCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapFXRepoCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapGovvieGovvieCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapGovvieOvernightCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapGovviePaydownCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapGovvieRatingCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapGovvieRecoveryCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapGovvieRepoCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapOvernightOvernightCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapOvernightPaydownCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapOvernightRatingCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapOvernightRecoveryCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapOvernightRepoCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapPaydownPaydownCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapPaydownRatingCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapPaydownRecoveryCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapPaydownRepoCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapRatingRatingCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapRatingRecoveryCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapRatingRepoCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapRecoveryRecoveryCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapRecoveryRepoCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapRepoRepoCorrelation = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapProductQuote = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.param.market.LatentStateFixingsContainer _lsfc = new - org.drip.param.market.LatentStateFixingsContainer(); - - /** - * Empty CurveSurfaceQuoteSet Constructor - */ - - public CurveSurfaceQuoteContainer() - { - } - - /** - * Retrieve the Discount Curve associated with the Pay Cash-flow Collateralized using a different - * Collateral Currency Numeraire - * - * @param strPayCurrency The Pay Currency - * @param strCollateralCurrency The Collateral Currency - * - * @return The Discount Curve associated with the Pay Cash-flow Collateralized using a different - * Collateral Currency Numeraire - */ - - public org.drip.state.discount.MergedDiscountForwardCurve payCurrencyCollateralCurrencyCurve ( - final java.lang.String strPayCurrency, - final java.lang.String strCollateralCurrency) - { - if (null == strPayCurrency || !_mapPayCurrencyForeignCollateralDC.containsKey (strPayCurrency) || - null == strCollateralCurrency) - return null; - - return _mapPayCurrencyForeignCollateralDC.get (strPayCurrency).get (strCollateralCurrency); - } - - /** - * Set the Discount Curve associated with the Pay Cash-flow Collateralized using a different - * Collateral Currency Numeraire - * - * @param strPayCurrency The Pay Currency - * @param strCollateralCurrency The Collateral Currency - * @param dcPayCurrencyCollateralCurrency The Discount Curve associated with the Pay Cash-flow - * Collateralized using a different Collateral Currency Numeraire - * - * @return TRUE - Successfully set - */ - - public boolean setPayCurrencyCollateralCurrencyCurve ( - final java.lang.String strPayCurrency, - final java.lang.String strCollateralCurrency, - final org.drip.state.discount.MergedDiscountForwardCurve dcPayCurrencyCollateralCurrency) - { - if (null == strPayCurrency || strPayCurrency.isEmpty() || null == strCollateralCurrency || - strCollateralCurrency.isEmpty() || null == dcPayCurrencyCollateralCurrency) - return false; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapCollateralCurrencyDC = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapCollateralCurrencyDC.put (strCollateralCurrency, dcPayCurrencyCollateralCurrency); - - _mapPayCurrencyForeignCollateralDC.put (strPayCurrency, mapCollateralCurrencyDC); - - return true; - } - - /** - * Retrieve the Collateral Choice Discount Curve for the specified Pay Currency - * - * @param strPayCurrency The Pay Currency - * - * @return Collateral Choice Discount Curve - */ - - public org.drip.state.discount.MergedDiscountForwardCurve collateralChoiceDiscountCurve ( - final java.lang.String strPayCurrency) - { - if (null == strPayCurrency || !_mapPayCurrencyForeignCollateralDC.containsKey (strPayCurrency)) - return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapCollateralCurrencyDC = _mapPayCurrencyForeignCollateralDC.get (strPayCurrency); - - int iNumCollateralizer = mapCollateralCurrencyDC.size(); - - org.drip.state.curve.ForeignCollateralizedDiscountCurve[] aFCDC = new - org.drip.state.curve.ForeignCollateralizedDiscountCurve[iNumCollateralizer]; - - int i = 0; - - for (java.util.Map.Entry me : - mapCollateralCurrencyDC.entrySet()) { - org.drip.state.discount.MergedDiscountForwardCurve fcdc = me.getValue(); - - if (!(fcdc instanceof org.drip.state.curve.ForeignCollateralizedDiscountCurve)) return null; - - aFCDC[i++] = (org.drip.state.curve.ForeignCollateralizedDiscountCurve) fcdc; - } - - try { - return new org.drip.state.curve.DeterministicCollateralChoiceDiscountCurve - (mapCollateralCurrencyDC.get (strPayCurrency), aFCDC, 30); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Credit Latent State from the Label - * - * @param creditLabel The Credit Latent State Label - * - * @return The Credit Latent State from the Label - */ - - public org.drip.state.credit.CreditCurve creditState ( - final org.drip.state.identifier.CreditLabel creditLabel) - { - if (null == creditLabel) return null; - - java.lang.String strCreditLabel = creditLabel.fullyQualifiedName(); - - return !_mapCreditState.containsKey (strCreditLabel) ? null : _mapCreditState.get (strCreditLabel); - } - - /** - * (Re)-set the Credit State - * - * @param cc The Credit State - * - * @return TRUE - Successfully set - */ - - public boolean setCreditState ( - final org.drip.state.credit.CreditCurve cc) - { - if (null == cc) return false; - - _mapCreditState.put (cc.label().fullyQualifiedName(), cc); - - return true; - } - - /** - * Retrieve the Equity State for the specified Equity Latent State Label - * - * @param equityLabel The Equity Latent State Label - * - * @return Equity Curve - */ - - public org.drip.function.definition.R1ToR1 equityState ( - final org.drip.state.identifier.EquityLabel equityLabel) - { - if (null == equityLabel) return null; - - java.lang.String strCode = equityLabel.fullyQualifiedName(); - - return _mapEquityState.containsKey (strCode) ? _mapEquityState.get (strCode) : null; - } - - /** - * (Re)-set the Equity State for the specified Equity Latent State Label - * - * @param equityLabel The Equity Latent State Label - * @param auEquity The Equity State - * - * @return TRUE - Successfully set - */ - - public boolean setEquityState ( - final org.drip.state.identifier.EquityLabel equityLabel, - final org.drip.function.definition.R1ToR1 auEquity) - { - if (null == equityLabel || null == auEquity) return false; - - _mapEquityState.put (equityLabel.fullyQualifiedName(), auEquity); - - return true; - } - - /** - * Retrieve the Forward State corresponding to the Label - * - * @param forwardLabel Forward Latent State Label - * - * @return Forward Curve - */ - - public org.drip.state.forward.ForwardCurve forwardState ( - final org.drip.state.identifier.ForwardLabel forwardLabel) - { - if (null == forwardLabel) return null; - - java.lang.String strForwardLabel = forwardLabel.fullyQualifiedName(); - - return _mapForwardState.containsKey (strForwardLabel) ? _mapForwardState.get (strForwardLabel) : - null; - } - - /** - * (Re)-set the Forward State - * - * @param fc Forward State - * - * @return TRUE - Successfully set - */ - - public boolean setForwardState ( - final org.drip.state.forward.ForwardCurve fc) - { - if (null == fc) return false; - - _mapForwardState.put (fc.label().fullyQualifiedName(), fc); - - return true; - } - - /** - * Retrieve the Funding Latent State Corresponding to the Label - * - * @param fundingLabel Funding Latent State Label - * - * @return The Funding Latent State - */ - - public org.drip.state.discount.MergedDiscountForwardCurve fundingState ( - final org.drip.state.identifier.FundingLabel fundingLabel) - { - if (null == fundingLabel) return null; - - java.lang.String strFundingLabel = fundingLabel.fullyQualifiedName(); - - return _mapFundingState.containsKey (strFundingLabel) ? _mapFundingState.get (strFundingLabel) : - null; - } - - /** - * (Re)-set the Funding State - * - * @param dc Funding State - * - * @return TRUE - Successfully set - */ - - public boolean setFundingState ( - final org.drip.state.discount.MergedDiscountForwardCurve dc) - { - if (null == dc) return false; - - _mapFundingState.put (dc.label().fullyQualifiedName(), dc); - - return true; - } - - /** - * Retrieve the FX State for the specified FX Latent State Label - * - * @param fxLabel The FX Latent State Label - * - * @return FX Curve - */ - - public org.drip.state.fx.FXCurve fxState ( - final org.drip.state.identifier.FXLabel fxLabel) - { - if (null == fxLabel) return null; - - java.lang.String strCode = fxLabel.fullyQualifiedName(); - - return _mapFXState.containsKey (strCode) ? _mapFXState.get (strCode) : null; - } - - /** - * (Re)-set the FX State for the specified FX Latent State Label - * - * @param fxfc The FX State - * - * @return TRUE - Successfully set - */ - - public boolean setFXState ( - final org.drip.state.fx.FXCurve fxfc) - { - if (null == fxfc) return false; - - org.drip.state.identifier.FXLabel fxLabel = (org.drip.state.identifier.FXLabel) fxfc.label(); - - _mapFXState.put (fxLabel.fullyQualifiedName(), fxfc); - - return true; - } - - /** - * Retrieve the Government State for the specified Label - * - * @param govvieLabel Govvie Latent State Label - * - * @return Government Curve for the specified Label - */ - - public org.drip.state.govvie.GovvieCurve govvieState ( - final org.drip.state.identifier.GovvieLabel govvieLabel) - { - if (null == govvieLabel) return null; - - java.lang.String strGovvieLabel = govvieLabel.fullyQualifiedName(); - - return !_mapGovvieState.containsKey (strGovvieLabel) ? null : _mapGovvieState.get (strGovvieLabel); - } - - /** - * (Re)-set the Govvie State Curve - * - * @param gc Govvie State Curve - * - * @return TRUE - Successfully set - */ - - public boolean setGovvieState ( - final org.drip.state.govvie.GovvieCurve gc) - { - if (null == gc) return false; - - _mapGovvieState.put (gc.label().fullyQualifiedName(), gc); - - return true; - } - - /** - * Retrieve the Overnight Latent State Corresponding to the Label - * - * @param overnightLabel Overnight Latent State Label - * - * @return The Overnight Latent State - */ - - public org.drip.state.discount.MergedDiscountForwardCurve overnightState ( - final org.drip.state.identifier.OvernightLabel overnightLabel) - { - if (null == overnightLabel) return null; - - java.lang.String strOvernightLabel = overnightLabel.fullyQualifiedName(); - - return _mapOvernightState.containsKey (strOvernightLabel) ? _mapOvernightState.get - (strOvernightLabel) : null; - } - - /** - * (Re)-set the Overnight State - * - * @param dcOvernight Overnight State Curve - * - * @return TRUE - Successfully set - */ - - public boolean setOvernightState ( - final org.drip.state.discount.MergedDiscountForwardCurve dcOvernight) - { - if (null == dcOvernight) return false; - - _mapOvernightState.put (dcOvernight.label().fullyQualifiedName(), dcOvernight); - - return true; - } - - /** - * Retrieve the Pay-down State for the specified Pay-down Latent State Label - * - * @param paydownLabel The Pay-down Latent State Label - * - * @return Pay-down State - */ - - public org.drip.function.definition.R1ToR1 paydownState ( - final org.drip.state.identifier.PaydownLabel paydownLabel) - { - if (null == paydownLabel) return null; - - java.lang.String strCode = paydownLabel.fullyQualifiedName(); - - return _mapPaydownState.containsKey (strCode) ? _mapPaydownState.get (strCode) : null; - } - - /** - * (Re)-set the Pay-down State for the specified Pay-down Latent State Label - * - * @param paydownLabel The Pay-down Latent State Label - * @param auPaydown The Pay-down State - * - * @return TRUE - Successfully set - */ - - public boolean setPaydownCurve ( - final org.drip.state.identifier.PaydownLabel paydownLabel, - final org.drip.function.definition.R1ToR1 auPaydown) - { - if (null == paydownLabel || null == auPaydown) return false; - - _mapPaydownState.put (paydownLabel.fullyQualifiedName(), auPaydown); - - return true; - } - - /** - * Retrieve the Rating State for the specified Rating Latent State Label - * - * @param ratingLabel The Rating Latent State Label - * - * @return Rating State - */ - - public org.drip.state.discount.MergedDiscountForwardCurve ratingState ( - final org.drip.state.identifier.RatingLabel ratingLabel) - { - if (null == ratingLabel) return null; - - java.lang.String strCode = ratingLabel.fullyQualifiedName(); - - return _mapRatingState.containsKey (strCode) ? _mapRatingState.get (strCode) : null; - } - - /** - * (Re)-set the Rating State for the specified Rating Latent State Label - * - * @param ratingLabel The Rating Latent State Label - * @param dcRating The Rating State - * - * @return TRUE - Successfully set - */ - - public boolean setRatingCurve ( - final org.drip.state.identifier.RatingLabel ratingLabel, - final org.drip.state.discount.MergedDiscountForwardCurve dcRating) - { - if (null == ratingLabel || null == dcRating) return false; - - _mapRatingState.put (ratingLabel.fullyQualifiedName(), dcRating); - - return true; - } - - /** - * Retrieve the Recovery Latent State from the Label - * - * @param recoveryLabel The Recovery Latent State Label - * - * @return The Recovery Latent State from the Label - */ - - public org.drip.state.credit.CreditCurve recoveryState ( - final org.drip.state.identifier.RecoveryLabel recoveryLabel) - { - if (null == recoveryLabel) return null; - - java.lang.String strRecoveryLabel = recoveryLabel.fullyQualifiedName(); - - return !_mapRecoveryState.containsKey (strRecoveryLabel) ? null : _mapRecoveryState.get - (strRecoveryLabel); - } - - /** - * (Re)-set the Recovery State for the specified Recovery Latent State Label - * - * @param rc The Recovery State - * - * @return TRUE - Successfully set - */ - - public boolean setRecoveryState ( - final org.drip.state.credit.CreditCurve rc) - { - if (null == rc) return false; - - _mapRecoveryState.put (rc.label().fullyQualifiedName(), rc); - - return true; - } - - /** - * Retrieve the Repo Latent State Corresponding to the Label - * - * @param repoLabel Repo Latent State Label - * - * @return The Repo Latent State - */ - - public org.drip.state.repo.RepoCurve repoState ( - final org.drip.state.identifier.RepoLabel repoLabel) - { - if (null == repoLabel) return null; - - java.lang.String strRepoLabel = repoLabel.fullyQualifiedName(); - - return _mapRepoState.containsKey (strRepoLabel) ? _mapRepoState.get (strRepoLabel) : null; - } - - /** - * (Re)-set the Repo State - * - * @param repoState Repo State - * - * @return TRUE - Successfully set - */ - - public boolean setRepoState ( - final org.drip.state.repo.RepoCurve repoState) - { - if (null == repoState) return false; - - _mapRepoState.put (repoState.label().fullyQualifiedName(), repoState); - - return true; - } - - /** - * Retrieve the Volatility Curve for the specified Collateral Label - * - * @param collateralLabel The Collateral Currency - * - * @return The Volatility Curve for the Collateral Label - */ - - public org.drip.state.volatility.VolatilityCurve collateralVolatility ( - final org.drip.state.identifier.CollateralLabel collateralLabel) - { - if (null == collateralLabel) return null; - - java.lang.String strCollateralLabel = collateralLabel.fullyQualifiedName(); - - return !_mapCollateralVolatility.containsKey (strCollateralLabel) ? null : - _mapCollateralVolatility.get (strCollateralLabel); - } - - /** - * (Re)-set the Volatility Curve for the specified Collateral Label - * - * @param vcCollateral The Collateral Volatility Curve - * - * @return TRUE - Successfully set - */ - - public boolean setCollateralVolatility ( - final org.drip.state.volatility.VolatilityCurve vcCollateral) - { - if (null == vcCollateral) return false; - - _mapCollateralVolatility.put (vcCollateral.label().fullyQualifiedName(), vcCollateral); - - return true; - } - - /** - * Retrieve the Volatility Curve for the Credit Latent State - * - * @param creditLabel The Credit Curve Latent State Label - * - * @return The Volatility Curve for the Credit Latent State - */ - - public org.drip.state.volatility.VolatilityCurve creditVolatility ( - final org.drip.state.identifier.CreditLabel creditLabel) - { - if (null == creditLabel) return null; - - java.lang.String strCreditLabel = creditLabel.fullyQualifiedName(); - - return !_mapCreditVolatility.containsKey (strCreditLabel) ? null : _mapCreditVolatility.get - (strCreditLabel); - } - - /** - * (Re)-set the Volatility Curve for the Credit Latent State - * - * @param vcCredit The Credit Volatility Curve - * - * @return TRUE - Successfully set - */ - - public boolean setCreditVolatility ( - final org.drip.state.volatility.VolatilityCurve vcCredit) - { - if (null == vcCredit) return false; - - _mapCreditVolatility.put (vcCredit.label().fullyQualifiedName(), vcCredit); - - return true; - } - - /** - * Retrieve the Volatility Curve for the Custom Metric Latent State - * - * @param customLabel The Custom Metric Latent State Label - * - * @return The Volatility Curve for the Custom Metric Latent State - */ - - public org.drip.state.volatility.VolatilityCurve customVolatility ( - final org.drip.state.identifier.CustomLabel customLabel) - { - if (null == customLabel) return null; - - java.lang.String strCustomLabel = customLabel.fullyQualifiedName(); - - return _mapCustomVolatility.containsKey (strCustomLabel) ? _mapCustomVolatility.get (strCustomLabel) - : null; - } - - /** - * (Re)-set the Custom Metric Volatility Curve - * - * @param vcCustom The Custom Metric Volatility Curve - * - * @return TRUE - Successfully set - */ - - public boolean setCustomVolatility ( - final org.drip.state.volatility.VolatilityCurve vcCustom) - { - if (null == vcCustom) return false; - - _mapCustomVolatility.put (vcCustom.label().fullyQualifiedName(), vcCustom); - - return true; - } - - /** - * Retrieve the Volatility Curve for the Equity Latent State - * - * @param equityLabel The Equity Latent State Label - * - * @return The Volatility Curve for the Equity Latent State - */ - - public org.drip.state.volatility.VolatilityCurve equityVolatility ( - final org.drip.state.identifier.EquityLabel equityLabel) - { - if (null == equityLabel) return null; - - java.lang.String strEquityLabel = equityLabel.fullyQualifiedName(); - - return !_mapEquityVolatility.containsKey (strEquityLabel) ? null : _mapEquityVolatility.get - (strEquityLabel); - } - - /** - * (Re)-set the Volatility Curve for the Equity Latent State - * - * @param vcEquity The Equity Volatility Curve - * - * @return TRUE - Successfully set - */ - - public boolean setEquityVolatility ( - final org.drip.state.volatility.VolatilityCurve vcEquity) - { - if (null == vcEquity) return false; - - _mapEquityVolatility.put (vcEquity.label().fullyQualifiedName(), vcEquity); - - return true; - } - - /** - * Retrieve the Volatility Curve for the specified Forward Latent State Label - * - * @param forwardLabel The Forward Latent State Label - * - * @return The Volatility Curve for the Forward Label - */ - - public org.drip.state.volatility.VolatilityCurve forwardVolatility ( - final org.drip.state.identifier.ForwardLabel forwardLabel) - { - if (null == forwardLabel) return null; - - java.lang.String strForwardLabel = forwardLabel.fullyQualifiedName(); - - return _mapForwardVolatility.containsKey (strForwardLabel) ? _mapForwardVolatility.get - (strForwardLabel) : null; - } - - /** - * (Re)-set the Volatility Curve for the specified Forward Latent State Label - * - * @param vcForward The Forward Volatility Curve - * - * @return TRUE - Successfully set - */ - - public boolean setForwardVolatility ( - final org.drip.state.volatility.VolatilityCurve vcForward) - { - if (null == vcForward) return false; - - _mapForwardVolatility.put (vcForward.label().fullyQualifiedName(), vcForward); - - return true; - } - - /** - * Retrieve the Volatility Curve for the Funding Latent State Label - * - * @param fundingLabel The Funding Latent State Label - * - * @return The Volatility Curve for the Funding Label - */ - - public org.drip.state.volatility.VolatilityCurve fundingVolatility ( - final org.drip.state.identifier.FundingLabel fundingLabel) - { - if (null == fundingLabel) return null; - - java.lang.String strFundingLabel = fundingLabel.fullyQualifiedName(); - - return _mapFundingVolatility.containsKey (strFundingLabel) ? _mapFundingVolatility.get - (strFundingLabel) : null; - } - - /** - * (Re)-set the Volatility Curve for the Funding Latent State Label - * - * @param vcFunding The Funding Volatility Curve - * - * @return TRUE - Successfully set - */ - - public boolean setFundingVolatility ( - final org.drip.state.volatility.VolatilityCurve vcFunding) - { - if (null == vcFunding) return false; - - _mapFundingVolatility.put (vcFunding.label().fullyQualifiedName(), vcFunding); - - return true; - } - - /** - * Retrieve the Volatility Curve for the specified FX Latent State Label - * - * @param fxLabel The FX Latent State Label - * - * @return The Volatility Curve for the FX Latent State Label - */ - - public org.drip.state.volatility.VolatilityCurve fxVolatility ( - final org.drip.state.identifier.FXLabel fxLabel) - { - if (null == fxLabel) return null; - - java.lang.String strFXLabel = fxLabel.fullyQualifiedName(); - - return !_mapFXVolatility.containsKey (strFXLabel) ? null : _mapFXVolatility.get (strFXLabel); - } - - /** - * (Re)-set the Volatility Curve for the specified FX Latent State - * - * @param vcFX The FX Volatility Surface - * - * @return TRUE - Successfully set - */ - - public boolean setFXVolatility ( - final org.drip.state.volatility.VolatilityCurve vcFX) - { - if (null == vcFX) return false; - - _mapFXVolatility.put (vcFX.label().fullyQualifiedName(), vcFX); - - return true; - } - - /** - * Retrieve the Volatility Curve for the specified Govvie Latent State - * - * @param govvieLabel The Govvie Latent State Label - * - * @return The Volatility Curve for the Govvie Latent State - */ - - public org.drip.state.volatility.VolatilityCurve govvieVolatility ( - final org.drip.state.identifier.GovvieLabel govvieLabel) - { - if (null == govvieLabel) return null; - - java.lang.String strGovvieLabel = govvieLabel.fullyQualifiedName(); - - return !_mapGovvieVolatility.containsKey (strGovvieLabel) ? null : _mapGovvieVolatility.get - (strGovvieLabel); - } - - /** - * (Re)-set the Volatility Curve for the Govvie Latent State - * - * @param vcGovvie The Govvie Volatility Curve - * - * @return TRUE - Successfully set - */ - - public boolean setGovvieVolatility ( - final org.drip.state.volatility.VolatilityCurve vcGovvie) - { - if (null == vcGovvie) return false; - - _mapGovvieVolatility.put (vcGovvie.label().fullyQualifiedName(), vcGovvie); - - return true; - } - - /** - * Retrieve the Volatility Curve for the Overnight Latent State Label - * - * @param overnightLabel The Overnight Latent State Label - * - * @return The Volatility Curve for the Overnight Label - */ - - public org.drip.state.volatility.VolatilityCurve overnightVolatility ( - final org.drip.state.identifier.OvernightLabel overnightLabel) - { - if (null == overnightLabel) return null; - - java.lang.String strOvernightLabel = overnightLabel.fullyQualifiedName(); - - return _mapOvernightVolatility.containsKey (strOvernightLabel) ? _mapOvernightVolatility.get - (strOvernightLabel) : null; - } - - /** - * (Re)-set the Volatility Curve for the Overnight Latent State Label - * - * @param vcOvernight The Overnight Volatility Surface - * - * @return TRUE - Successfully set - */ - - public boolean setOvernightVolatility ( - final org.drip.state.volatility.VolatilityCurve vcOvernight) - { - if (null == vcOvernight) return false; - - _mapOvernightVolatility.put (vcOvernight.label().fullyQualifiedName(), vcOvernight); - - return true; - } - - /** - * Retrieve the Volatility Curve for the specified Pay-down Latent State - * - * @param paydownLabel The Pay Down Latent State Label - * - * @return The Volatility Curve for the Pay-down Latent State - */ - - public org.drip.state.volatility.VolatilityCurve paydownVolaitlity ( - final org.drip.state.identifier.PaydownLabel paydownLabel) - { - if (null == paydownLabel) return null; - - java.lang.String strPaydownLabel = paydownLabel.fullyQualifiedName(); - - return !_mapPaydownVolatility.containsKey (strPaydownLabel) ? null : _mapPaydownVolatility.get - (strPaydownLabel); - } - - /** - * (Re)-set the Volatility Curve for the Pay-down Latent State - * - * @param vcPaydown The Pay down Volatility Curve - * - * @return TRUE - Successfully set - */ - - public boolean setPaydownVolatility ( - final org.drip.state.volatility.VolatilityCurve vcPaydown) - { - if (null == vcPaydown) return false; - - _mapPaydownVolatility.put (vcPaydown.label().fullyQualifiedName(), vcPaydown); - - return true; - } - - /** - * Retrieve the Volatility Curve for the specified Rating Latent State - * - * @param ratingLabel The Rating Latent State Label - * - * @return The Volatility Curve for the Rating Latent State - */ - - public org.drip.state.volatility.VolatilityCurve ratingVolaitlity ( - final org.drip.state.identifier.RatingLabel ratingLabel) - { - if (null == ratingLabel) return null; - - java.lang.String strRatingLabel = ratingLabel.fullyQualifiedName(); - - return !_mapRatingVolatility.containsKey (strRatingLabel) ? null : _mapRatingVolatility.get - (strRatingLabel); - } - - /** - * (Re)-set the Volatility Curve for the Rating Latent State - * - * @param vcRating The Rating Volatility Curve - * - * @return TRUE - Successfully set - */ - - public boolean setRatingVolatility ( - final org.drip.state.volatility.VolatilityCurve vcRating) - { - if (null == vcRating) return false; - - _mapRatingVolatility.put (vcRating.label().fullyQualifiedName(), vcRating); - - return true; - } - - /** - * Retrieve the Volatility Curve for the specified Recovery Latent State - * - * @param recoveryLabel The Recovery Latent State Label - * - * @return The Volatility Curve for the Recovery Latent State - */ - - public org.drip.state.volatility.VolatilityCurve recoveryVolatility ( - final org.drip.state.identifier.RecoveryLabel recoveryLabel) - { - if (null == recoveryLabel) return null; - - java.lang.String strRecoveryLabel = recoveryLabel.fullyQualifiedName(); - - return !_mapRecoveryVolatility.containsKey (strRecoveryLabel) ? null : _mapRecoveryVolatility.get - (strRecoveryLabel); - } - - /** - * (Re)-set the Volatility Curve for the Recovery Latent State - * - * @param vcRecovery The Recovery Volatility Surface - * - * @return TRUE - Successfully set - */ - - public boolean setRecoveryVolatility ( - final org.drip.state.volatility.VolatilityCurve vcRecovery) - { - if (null == vcRecovery) return false; - - _mapRecoveryVolatility.put (vcRecovery.label().fullyQualifiedName(), vcRecovery); - - return true; - } - - /** - * Retrieve the Volatility Curve for the Repo Latent State Label - * - * @param repoLabel The Repo Latent State Label - * - * @return The Volatility Curve for the Repo Label - */ - - public org.drip.state.volatility.VolatilityCurve repoVolatility ( - final org.drip.state.identifier.RepoLabel repoLabel) - { - if (null == repoLabel) return null; - - java.lang.String strRepoLabel = repoLabel.fullyQualifiedName(); - - return _mapRepoVolatility.containsKey (strRepoLabel) ? _mapRepoVolatility.get (strRepoLabel) : null; - } - - /** - * (Re)-set the Volatility Curve for the Repo Latent State Label - * - * @param vcRepo The Repo Volatility Curve - * - * @return TRUE - Successfully set - */ - - public boolean setRepoVolatility ( - final org.drip.state.volatility.VolatilityCurve vcRepo) - { - if (null == vcRepo) return false; - - _mapRepoVolatility.put (vcRepo.label().fullyQualifiedName(), vcRepo); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Collateral Currency Pair - * - * @param strCurrency1 Collateral Currency #1 - * @param strCurrency2 Collateral Currency #2 - * - * @return The Correlation Surface for the specified Collateral Currency Pair - */ - - public org.drip.function.definition.R1ToR1 collateralCollateralCorrelation ( - final java.lang.String strCurrency1, - final java.lang.String strCurrency2) - { - if (null == strCurrency1 || strCurrency1.isEmpty() || null == strCurrency2 || strCurrency2.isEmpty()) - return null; - - java.lang.String strCode = strCurrency1 + "@#" + strCurrency2; - - if (!_mapCollateralCollateralCorrelation.containsKey (strCode)) return null; - - return _mapCollateralCollateralCorrelation.get (strCode); - } - - /** - * (Re)-set the Correlation Surface for the specified Collateral Currency Pair - * - * @param strCurrency1 Collateral Currency #1 - * @param strCurrency2 Collateral Currency #2 - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCollateralCollateralCorrelation ( - final java.lang.String strCurrency1, - final java.lang.String strCurrency2, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == strCurrency1 || strCurrency1.isEmpty() || null == strCurrency2 || strCurrency2.isEmpty() - || null == auCorrelation) - return false; - - _mapCollateralCollateralCorrelation.put (strCurrency1 + "@#" + strCurrency2, auCorrelation); - - _mapCollateralCollateralCorrelation.put (strCurrency2 + "@#" + strCurrency1, auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Pair of Credit Latent States - * - * @param creditLabel1 The Credit Curve Latent State Label #1 - * @param creditLabel2 The Credit Curve Latent State Label #2 - * - * @return The Correlation Surface between the Pair of Credit Latent States - */ - - public org.drip.function.definition.R1ToR1 creditCreditCorrelation ( - final org.drip.state.identifier.CreditLabel creditLabel1, - final org.drip.state.identifier.CreditLabel creditLabel2) - { - if (null == creditLabel1 || null == creditLabel2) return null; - - java.lang.String strCode12 = creditLabel1.fullyQualifiedName() + "@#" + - creditLabel2.fullyQualifiedName(); - - if (_mapCreditCreditCorrelation.containsKey (strCode12)) - return _mapCreditCreditCorrelation.get (strCode12); - - java.lang.String strCode21 = creditLabel2.fullyQualifiedName() + "@#" + - creditLabel1.fullyQualifiedName(); - - return !_mapCreditCreditCorrelation.containsKey (strCode21) ? null : - _mapCreditCreditCorrelation.get (strCode21); - } - - /** - * (Re)-set the Correlation Surface between the Pair of Credit Latent States - * - * @param creditLabel1 The Credit Curve Latent State Label #1 - * @param creditLabel2 The Credit Curve Latent State Label #2 - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCreditCreditCorrelation ( - final org.drip.state.identifier.CreditLabel creditLabel1, - final org.drip.state.identifier.CreditLabel creditLabel2, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == creditLabel1 || null == creditLabel2 || null == auCorrelation) return false; - - java.lang.String strCreditLabel1 = creditLabel1.fullyQualifiedName(); - - java.lang.String strCreditLabel2 = creditLabel2.fullyQualifiedName(); - - _mapCreditCreditCorrelation.put (strCreditLabel1 + "@#" + strCreditLabel2, auCorrelation); - - _mapCreditCreditCorrelation.put (strCreditLabel2 + "@#" + strCreditLabel1, auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Custom Metric Latent State Pair - * - * @param customLabel1 The Custom Metric Latent State Label #1 - * @param customLabel2 The Custom Metric Latent State Label #2 - * - * @return The Correlation Surface between the Custom Metric Latent State Pair - */ - - public org.drip.function.definition.R1ToR1 customCustomCorrelation ( - final org.drip.state.identifier.CustomLabel customLabel1, - final org.drip.state.identifier.CustomLabel customLabel2) - { - if (null == customLabel1 || null == customLabel2) return null; - - java.lang.String strCode12 = customLabel1.fullyQualifiedName() + "@#" + - customLabel2.fullyQualifiedName(); - - if (_mapCustomCustomCorrelation.containsKey (strCode12)) - return _mapCustomCustomCorrelation.get (strCode12); - - java.lang.String strCode21 = customLabel2.fullyQualifiedName() + "@#" + - customLabel1.fullyQualifiedName(); - - return _mapCustomCustomCorrelation.containsKey (strCode21) ? - _mapCustomCustomCorrelation.get (strCode21) : null; - } - - /** - * (Re)-set the Correlation Surface between the Custom Metric Latent State Pair - * - * @param customLabel1 The Custom Metric Latent State Label #1 - * @param customLabel2 The Custom Metric Latent State Label #2 - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCustomCustomCorrelation ( - final org.drip.state.identifier.CustomLabel customLabel1, - final org.drip.state.identifier.CustomLabel customLabel2, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == customLabel1 || null == customLabel2 || customLabel1.match (customLabel2) || null == - auCorrelation) - return false; - - _mapCustomCustomCorrelation.put (customLabel1.fullyQualifiedName() + "@#" + - customLabel2.fullyQualifiedName(), auCorrelation); - - _mapCustomCustomCorrelation.put (customLabel2.fullyQualifiedName() + "@#" + - customLabel1.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Pair of Equity Latent States - * - * @param equityLabel1 Equity Curve Latent State Label #1 - * @param equityLabel2 EquityCurve Latent State Label #2 - * - * @return The Correlation Surface between the Pair of Equity Latent States - */ - - public org.drip.function.definition.R1ToR1 equityEquityCorrelation ( - final org.drip.state.identifier.EquityLabel equityLabel1, - final org.drip.state.identifier.EquityLabel equityLabel2) - { - if (null == equityLabel1 || null == equityLabel2) return null; - - java.lang.String strCode = equityLabel1.fullyQualifiedName() + "@#" + - equityLabel2.fullyQualifiedName(); - - return _mapEquityEquityCorrelation.containsKey (strCode) ? - _mapEquityEquityCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Pair of Equity Latent States - * - * @param equityLabel1 EquityCurve Latent State Label #1 - * @param equityLabel2 EquityCurve Latent State Label #2 - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setEquityEquityCorrelation ( - final org.drip.state.identifier.EquityLabel equityLabel1, - final org.drip.state.identifier.EquityLabel equityLabel2, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == equityLabel1 || null == equityLabel2 || equityLabel1.match (equityLabel2) || null == - auCorrelation) - return false; - - java.lang.String strEquityLabel1 = equityLabel1.fullyQualifiedName(); - - java.lang.String strEquityLabel2 = equityLabel2.fullyQualifiedName(); - - _mapEquityEquityCorrelation.put (strEquityLabel1 + "@#" + strEquityLabel2, auCorrelation); - - _mapEquityEquityCorrelation.put (strEquityLabel2 + "@#" + strEquityLabel1, auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Pair of Forward Latent States - * - * @param forwardLabel1 Forward Curve Latent State Label #1 - * @param forwardLabel2 Forward Curve Latent State Label #2 - * - * @return The Correlation Surface between the Pair of Forward Latent States - */ - - public org.drip.function.definition.R1ToR1 forwardForwardCorrelation ( - final org.drip.state.identifier.ForwardLabel forwardLabel1, - final org.drip.state.identifier.ForwardLabel forwardLabel2) - { - if (null == forwardLabel1 || null == forwardLabel2) return null; - - java.lang.String strCode = forwardLabel1.fullyQualifiedName() + "@#" + - forwardLabel2.fullyQualifiedName(); - - return _mapForwardForwardCorrelation.containsKey (strCode) ? - _mapForwardForwardCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Pair of Forward Latent States - * - * @param forwardLabel1 Forward Curve Latent State Label #1 - * @param forwardLabel2 Forward Curve Latent State Label #2 - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setForwardForwardCorrelation ( - final org.drip.state.identifier.ForwardLabel forwardLabel1, - final org.drip.state.identifier.ForwardLabel forwardLabel2, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == forwardLabel1 || null == forwardLabel2 || forwardLabel1.match (forwardLabel2) || null == - auCorrelation) - return false; - - java.lang.String strForwardLabel1 = forwardLabel1.fullyQualifiedName(); - - java.lang.String strForwardLabel2 = forwardLabel2.fullyQualifiedName(); - - _mapForwardForwardCorrelation.put (strForwardLabel1 + "@#" + strForwardLabel2, auCorrelation); - - _mapForwardForwardCorrelation.put (strForwardLabel2 + "@#" + strForwardLabel1, auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Pair of Funding Latent States - * - * @param fundingLabel1 Funding Latent State Label #1 - * @param fundingLabel2 Funding Latent State Label #2 - * - * @return The Correlation Surface between the Pair of Funding Latent States - */ - - public org.drip.function.definition.R1ToR1 fundingFundingCorrelation ( - final org.drip.state.identifier.FundingLabel fundingLabel1, - final org.drip.state.identifier.FundingLabel fundingLabel2) - { - if (null == fundingLabel1 || null == fundingLabel2 || fundingLabel1.match (fundingLabel2)) - return null; - - java.lang.String strCode = fundingLabel1.fullyQualifiedName() + "@#" + - fundingLabel2.fullyQualifiedName(); - - return _mapFundingFundingCorrelation.containsKey (strCode) ? - _mapFundingFundingCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Pair of Funding Latent States - * - * @param fundingLabel1 Funding Latent State Label #1 - * @param fundingLabel2 Funding Latent State Label #2 - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setFundingFundingCorrelation ( - final org.drip.state.identifier.FundingLabel fundingLabel1, - final org.drip.state.identifier.FundingLabel fundingLabel2, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == fundingLabel1 || null == fundingLabel2 || fundingLabel1.match (fundingLabel2) || null == - auCorrelation) - return false; - - java.lang.String strFundingLabel1 = fundingLabel1.fullyQualifiedName(); - - java.lang.String strFundingLabel2 = fundingLabel2.fullyQualifiedName(); - - _mapFundingFundingCorrelation.put (strFundingLabel1 + "@#" + strFundingLabel2, auCorrelation); - - _mapFundingFundingCorrelation.put (strFundingLabel2 + "@#" + strFundingLabel1, auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified FX Latent State Label Set - * - * @param fxLabel1 The FX Latent State Label #1 - * @param fxLabel2 The FX Latent State Label #2 - * - * @return The Correlation Surface for the specified FX Latent State Label Set - */ - - public org.drip.function.definition.R1ToR1 fxFXCorrelation ( - final org.drip.state.identifier.FXLabel fxLabel1, - final org.drip.state.identifier.FXLabel fxLabel2) - { - if (null == fxLabel1 || null == fxLabel2 || fxLabel1.match (fxLabel2)) return null; - - java.lang.String strCode = fxLabel1.fullyQualifiedName() + "@#" + fxLabel2.fullyQualifiedName(); - - return !_mapFXFXCorrelation.containsKey (strCode) ? null : _mapFXFXCorrelation.get - (strCode); - } - - /** - * (Re)-set the Correlation Surface for the specified FX Latent State Label Set - * - * @param fxLabel1 The FX Latent State Label #1 - * @param fxLabel2 The FX Latent State Label #2 - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setFXFXCorrelation ( - final org.drip.state.identifier.FXLabel fxLabel1, - final org.drip.state.identifier.FXLabel fxLabel2, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == fxLabel1 || null == fxLabel2 || fxLabel1.match (fxLabel2) || null == auCorrelation) - return false; - - java.lang.String strCode1 = fxLabel1.fullyQualifiedName(); - - java.lang.String strCode2 = fxLabel2.fullyQualifiedName(); - - _mapFXFXCorrelation.put (strCode1 + "@#" + strCode2, auCorrelation); - - _mapFXFXCorrelation.put (strCode2 + "@#" + strCode1, auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Govvie Latent State Pair - * - * @param govvieLabel1 The Govvie Curve Latent State Label #1 - * @param govvieLabel2 The Govvie Curve Latent State Label #2 - * - * @return The Correlation Surface for the specified Govvie Latent State Pair - */ - - public org.drip.function.definition.R1ToR1 govvieGovvieCorrelation ( - final org.drip.state.identifier.GovvieLabel govvieLabel1, - final org.drip.state.identifier.GovvieLabel govvieLabel2) - { - if (null == govvieLabel1 || null == govvieLabel2 || govvieLabel1.match (govvieLabel2)) return null; - - java.lang.String strCode12 = govvieLabel1.fullyQualifiedName() + "@#" + - govvieLabel2.fullyQualifiedName(); - - if (_mapGovvieGovvieCorrelation.containsKey (strCode12)) - return _mapGovvieGovvieCorrelation.get (strCode12); - - java.lang.String strCode21 = govvieLabel2.fullyQualifiedName() + "@#" + - govvieLabel1.fullyQualifiedName(); - - return _mapGovvieGovvieCorrelation.containsKey (strCode21) ? - _mapGovvieGovvieCorrelation.get (strCode21) : null; - } - - /** - * (Re)-set the Correlation Surface for the Govvie Latent State Pair - * - * @param govvieLabel1 The Govvie Curve Latent State Label #1 - * @param govvieLabel2 The Govvie Curve Latent State Label #2 - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setGovvieGovvieCorrelation ( - final org.drip.state.identifier.GovvieLabel govvieLabel1, - final org.drip.state.identifier.GovvieLabel govvieLabel2, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == govvieLabel1 || null == govvieLabel2 || govvieLabel1.match (govvieLabel2) || null == - auCorrelation) - return false; - - java.lang.String strGovvieLabel1 = govvieLabel1.fullyQualifiedName(); - - java.lang.String strGovvieLabel2 = govvieLabel2.fullyQualifiedName(); - - _mapGovvieGovvieCorrelation.put (strGovvieLabel1 + "@#" + strGovvieLabel2, auCorrelation); - - _mapGovvieGovvieCorrelation.put (strGovvieLabel2 + "@#" + strGovvieLabel1, auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Pair of Overnight Latent States - * - * @param overnightLabel1 Overnight Latent State Label #1 - * @param overnightLabel2 Overnight Latent State Label #2 - * - * @return The Correlation Surface between the Pair of Overnight Latent States - */ - - public org.drip.function.definition.R1ToR1 overnightOvernightCorrelation ( - final org.drip.state.identifier.OvernightLabel overnightLabel1, - final org.drip.state.identifier.OvernightLabel overnightLabel2) - { - if (null == overnightLabel1 || null == overnightLabel2 || overnightLabel1.match (overnightLabel2)) - return null; - - java.lang.String strCode = overnightLabel1.fullyQualifiedName() + "@#" + - overnightLabel2.fullyQualifiedName(); - - return _mapOvernightOvernightCorrelation.containsKey (strCode) ? - _mapOvernightOvernightCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Pair of Overnight Latent States - * - * @param overnightLabel1 Overnight Latent State Label #1 - * @param overnightLabel2 Overnight Latent State Label #2 - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setOvernightOvernightCorrelation ( - final org.drip.state.identifier.OvernightLabel overnightLabel1, - final org.drip.state.identifier.OvernightLabel overnightLabel2, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == overnightLabel1 || null == overnightLabel2 || overnightLabel1.match (overnightLabel2) || - null == auCorrelation) - return false; - - java.lang.String strOvernightLabel1 = overnightLabel1.fullyQualifiedName(); - - java.lang.String strOvernightLabel2 = overnightLabel2.fullyQualifiedName(); - - _mapOvernightOvernightCorrelation.put (strOvernightLabel1 + "@#" + strOvernightLabel2, - auCorrelation); - - _mapOvernightOvernightCorrelation.put (strOvernightLabel2 + "@#" + strOvernightLabel1, - auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Pay-down Latent State Pair - * - * @param paydownLabel1 The Pay-down Curve Latent State Label #1 - * @param paydownLabel2 The Pay-down Curve Latent State Label #2 - * - * @return The Correlation Surface for the specified Pay-down Latent State Pair - */ - - public org.drip.function.definition.R1ToR1 paydownPaydownCorrelation ( - final org.drip.state.identifier.PaydownLabel paydownLabel1, - final org.drip.state.identifier.PaydownLabel paydownLabel2) - { - if (null == paydownLabel1 || null == paydownLabel2 || paydownLabel1.match (paydownLabel2)) - return null; - - java.lang.String strCode12 = paydownLabel1.fullyQualifiedName() + "@#" + - paydownLabel2.fullyQualifiedName(); - - if (_mapPaydownPaydownCorrelation.containsKey (strCode12)) - return _mapPaydownPaydownCorrelation.get (strCode12); - - java.lang.String strCode21 = paydownLabel2.fullyQualifiedName() + "@#" + - paydownLabel1.fullyQualifiedName(); - - return _mapPaydownPaydownCorrelation.containsKey (strCode21) ? - _mapPaydownPaydownCorrelation.get (strCode21) : null; - } - - /** - * (Re)-set the Correlation Surface for the Pay-down Latent State Pair - * - * @param paydownLabel1 The Pay-down Curve Latent State Label #1 - * @param paydownLabel2 The Pay-down Curve Latent State Label #2 - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setPaydownPaydownCorrelation ( - final org.drip.state.identifier.PaydownLabel paydownLabel1, - final org.drip.state.identifier.PaydownLabel paydownLabel2, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == paydownLabel1 || null == paydownLabel2 || paydownLabel1.match (paydownLabel2) || null == - auCorrelation) - return false; - - java.lang.String strPaydownLabel1 = paydownLabel1.fullyQualifiedName(); - - java.lang.String strPaydownLabel2 = paydownLabel2.fullyQualifiedName(); - - _mapPaydownPaydownCorrelation.put (strPaydownLabel1 + "@#" + strPaydownLabel2, auCorrelation); - - _mapPaydownPaydownCorrelation.put (strPaydownLabel2 + "@#" + strPaydownLabel1, auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Recovery Latent State Pair - * - * @param recoveryLabel1 The Recovery Curve Latent State Label #1 - * @param recoveryLabel2 The Recovery Curve Latent State Label #2 - * - * @return The Correlation Surface for the specified Recovery Latent State Pair - */ - - public org.drip.function.definition.R1ToR1 recoveryRecoveryCorrelation ( - final org.drip.state.identifier.RecoveryLabel recoveryLabel1, - final org.drip.state.identifier.RecoveryLabel recoveryLabel2) - { - if (null == recoveryLabel1 || null == recoveryLabel2 || recoveryLabel1.match (recoveryLabel2)) - return null; - - java.lang.String strCode12 = recoveryLabel1.fullyQualifiedName() + "@#" + - recoveryLabel2.fullyQualifiedName(); - - if (_mapRecoveryRecoveryCorrelation.containsKey (strCode12)) - return _mapRecoveryRecoveryCorrelation.get (strCode12); - - java.lang.String strCode21 = recoveryLabel2.fullyQualifiedName() + "@#" + - recoveryLabel1.fullyQualifiedName(); - - return _mapRecoveryRecoveryCorrelation.containsKey (strCode21) ? - _mapRecoveryRecoveryCorrelation.get (strCode21) : null; - } - - /** - * (Re)-set the Correlation Surface for the Recovery Latent State Pair - * - * @param recoveryLabel1 The Recovery Curve Latent State Label #1 - * @param recoveryLabel2 The Recovery Curve Latent State Label #2 - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setRecoveryRecoveryCorrelation ( - final org.drip.state.identifier.RecoveryLabel recoveryLabel1, - final org.drip.state.identifier.RecoveryLabel recoveryLabel2, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == recoveryLabel1 || null == recoveryLabel2 || recoveryLabel1.match (recoveryLabel2) || null - == auCorrelation) - return false; - - java.lang.String strRecoveryLabel1 = recoveryLabel1.fullyQualifiedName(); - - java.lang.String strRecoveryLabel2 = recoveryLabel2.fullyQualifiedName(); - - _mapRecoveryRecoveryCorrelation.put (strRecoveryLabel1 + "@#" + strRecoveryLabel2, - auCorrelation); - - _mapRecoveryRecoveryCorrelation.put (strRecoveryLabel2 + "@#" + strRecoveryLabel1, - auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Pair of Repo Latent States - * - * @param repoLabel1 Repo Latent State Label #1 - * @param repoLabel2 Repo Latent State Label #2 - * - * @return The Correlation Surface between the Pair of Repo Latent States - */ - - public org.drip.function.definition.R1ToR1 repoRepoCorrelation ( - final org.drip.state.identifier.RepoLabel repoLabel1, - final org.drip.state.identifier.RepoLabel repoLabel2) - { - if (null == repoLabel1 || null == repoLabel2 || repoLabel1.match (repoLabel2)) return null; - - java.lang.String strCode = repoLabel1.fullyQualifiedName() + "@#" + repoLabel2.fullyQualifiedName(); - - return _mapRepoRepoCorrelation.containsKey (strCode) ? _mapRepoRepoCorrelation.get - (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Pair of Repo Latent States - * - * @param repoLabel1 Repo Latent State Label #1 - * @param repoLabel2 Repo Latent State Label #2 - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setRepoRepoCorrelation ( - final org.drip.state.identifier.RepoLabel repoLabel1, - final org.drip.state.identifier.RepoLabel repoLabel2, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == repoLabel1 || null == repoLabel2 || repoLabel1.match (repoLabel2) || null == - auCorrelation) - return false; - - java.lang.String strRepoLabel1 = repoLabel1.fullyQualifiedName(); - - java.lang.String strRepoLabel2 = repoLabel2.fullyQualifiedName(); - - _mapRepoRepoCorrelation.put (strRepoLabel1 + "@#" + strRepoLabel2, auCorrelation); - - _mapRepoRepoCorrelation.put (strRepoLabel2 + "@#" + strRepoLabel1, auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Collateral and the Credit Latent States - * - * @param strCollateralCurrency The Collateral Currency - * @param creditLabel The Credit Curve Latent State Label - * - * @return The Correlation Surface between the Collateral and the Credit Latent States - */ - - public org.drip.function.definition.R1ToR1 collateralCreditCorrelation ( - final java.lang.String strCollateralCurrency, - final org.drip.state.identifier.CreditLabel creditLabel) - { - if (null == strCollateralCurrency || strCollateralCurrency.isEmpty() || null == creditLabel) - return null; - - java.lang.String strCode = strCollateralCurrency + "@#" + creditLabel.fullyQualifiedName(); - - return _mapCollateralCreditCorrelation.containsKey (strCode) ? null : - _mapCollateralCreditCorrelation.get (strCode); - } - - /** - * (Re)-set the Correlation Surface between the Collateral and the Credit Latent States - * - * @param strCollateralCurrency The Collateral Currency - * @param creditLabel The Credit Curve Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCollateralCreditCorrelation ( - final java.lang.String strCollateralCurrency, - final org.drip.state.identifier.CreditLabel creditLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == strCollateralCurrency || strCollateralCurrency.isEmpty() || null == creditLabel) - return false; - - _mapCollateralCreditCorrelation.put (strCollateralCurrency + "@#" + - creditLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Collateral and the Custom Metric Latent States - * - * @param strCollateralCurrency The Collateral Currency - * @param customLabel The Custom Metric Latent State Label - * - * @return The Correlation Surface between the Collateral and the Custom Metric Latent States - */ - - public org.drip.function.definition.R1ToR1 collateralCustomCorrelation ( - final java.lang.String strCollateralCurrency, - final org.drip.state.identifier.CustomLabel customLabel) - { - if (null == strCollateralCurrency || strCollateralCurrency.isEmpty() || null == customLabel) - return null; - - java.lang.String strCode = strCollateralCurrency + "@#" + customLabel.fullyQualifiedName(); - - return _mapCollateralCustomCorrelation.containsKey (strCode) ? - _mapCollateralCustomCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Collateral and the Custom Metric Latent States - * - * @param strCollateralCurrency The Collateral Currency - * @param customLabel The Custom Metric Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCollateralCustomCorrelation ( - final java.lang.String strCollateralCurrency, - final org.drip.state.identifier.CustomLabel customLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == strCollateralCurrency || strCollateralCurrency.isEmpty() || null == customLabel) - return false; - - _mapCollateralCustomCorrelation.put (strCollateralCurrency + "@#" + - customLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Collateral and the Forward Latent States - * - * @param strCollateralCurrency The Collateral Currency - * @param forwardLabel The Forward Latent State Label - * - * @return The Correlation Surface between the Collateral and the Forward Latent States - */ - - public org.drip.function.definition.R1ToR1 collateralForwardCorrelation ( - final java.lang.String strCollateralCurrency, - final org.drip.state.identifier.ForwardLabel forwardLabel) - { - if (null == strCollateralCurrency || strCollateralCurrency.isEmpty() || null == forwardLabel) - return null; - - java.lang.String strCode = strCollateralCurrency + "@#" + forwardLabel.fullyQualifiedName(); - - return _mapCollateralForwardCorrelation.containsKey (strCode) ? - _mapCollateralForwardCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Collateral and the Equity Latent States - * - * @param strCollateralCurrency The Collateral Currency - * @param equityLabel The Equity Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCollateralEquityCorrelation ( - final java.lang.String strCollateralCurrency, - final org.drip.state.identifier.EquityLabel equityLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == strCollateralCurrency || strCollateralCurrency.isEmpty() || null == equityLabel || null - == auCorrelation) - return false; - - _mapCollateralEquityCorrelation.put (strCollateralCurrency + "@#" + - equityLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Collateral and the Equity Latent States - * - * @param strCollateralCurrency The Collateral Currency - * @param equityLabel The Equity Latent State Label - * - * @return The Correlation Surface between the Collateral and the Equity Latent States - */ - - public org.drip.function.definition.R1ToR1 collateralEquityCorrelation ( - final java.lang.String strCollateralCurrency, - final org.drip.state.identifier.EquityLabel equityLabel) - { - if (null == strCollateralCurrency || strCollateralCurrency.isEmpty() || null == equityLabel) - return null; - - java.lang.String strCode = strCollateralCurrency + "@#" + equityLabel.fullyQualifiedName(); - - return _mapCollateralEquityCorrelation.containsKey (strCode) ? - _mapCollateralEquityCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Collateral and the Forward Latent States - * - * @param strCollateralCurrency The Collateral Currency - * @param forwardLabel The Forward Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCollateralForwardCorrelation ( - final java.lang.String strCollateralCurrency, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == strCollateralCurrency || strCollateralCurrency.isEmpty() || null == forwardLabel || null - == auCorrelation) - return false; - - _mapCollateralForwardCorrelation.put (strCollateralCurrency + "@#" + - forwardLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Collateral and the Funding Latent States - * - * @param strCollateralCurrency The Collateral Currency - * @param fundingLabel The Funding Latent State Label - * - * @return The Correlation Surface between the Collateral and the Funding Latent States - */ - - public org.drip.function.definition.R1ToR1 collateralFundingCorrelation ( - final java.lang.String strCollateralCurrency, - final org.drip.state.identifier.FundingLabel fundingLabel) - { - if (null == strCollateralCurrency || strCollateralCurrency.isEmpty() || null == fundingLabel) - return null; - - java.lang.String strCode = strCollateralCurrency + "@#" + fundingLabel.fullyQualifiedName(); - - return _mapCollateralFundingCorrelation.containsKey (strCode) ? - _mapCollateralFundingCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Collateral and the Funding Latent States - * - * @param strCollateralCurrency The Collateral Currency - * @param fundingLabel The Funding Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCollateralFundingCorrelation ( - final java.lang.String strCollateralCurrency, - final org.drip.state.identifier.FundingLabel fundingLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == strCollateralCurrency || strCollateralCurrency.isEmpty() || null == fundingLabel || null - == auCorrelation) - return false; - - _mapCollateralFundingCorrelation.put (strCollateralCurrency + "@#" + - fundingLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Collateral and the FX Latent State Label - * - * @param strCollateralCurrency The Collateral Currency - * @param fxLabel The FX Latent State Label - * - * @return The Correlation Surface for the specified Collateral and the FX Latent State Label - */ - - public org.drip.function.definition.R1ToR1 collateralFXCorrelation ( - final java.lang.String strCollateralCurrency, - final org.drip.state.identifier.FXLabel fxLabel) - { - if (null == strCollateralCurrency || strCollateralCurrency.isEmpty() || null == fxLabel) return null; - - java.lang.String strCode = strCollateralCurrency + "@#" + fxLabel.fullyQualifiedName(); - - return _mapCollateralFXCorrelation.containsKey (strCode) ? - _mapCollateralFXCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified Collateral and FX Latent States - * - * @param strCollateralCurrency The Collateral Currency - * @param fxLabel The FX Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCollateralFXCorrelation ( - final java.lang.String strCollateralCurrency, - final org.drip.state.identifier.FXLabel fxLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == strCollateralCurrency || strCollateralCurrency.isEmpty() || null == fxLabel || null == - auCorrelation) - return false; - - _mapCollateralFXCorrelation.put (strCollateralCurrency + "@#" + fxLabel.fullyQualifiedName(), - auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Collateral and Govvie Latent State Labels - * - * @param strCollateralCurrency The Collateral Currency - * @param govvieLabel The Govvie Latent State Label - * - * @return The Correlation Surface for the specified Collateral and Govvie Latent State Labels - */ - - public org.drip.function.definition.R1ToR1 collateralGovvieCorrelation ( - final java.lang.String strCollateralCurrency, - final org.drip.state.identifier.GovvieLabel govvieLabel) - { - if (null == strCollateralCurrency || strCollateralCurrency.isEmpty() || null == govvieLabel) - return null; - - java.lang.String strCode = strCollateralCurrency + "@#" + govvieLabel.fullyQualifiedName(); - - return _mapCollateralGovvieCorrelation.containsKey (strCode) ? - _mapCollateralGovvieCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified Collateral and Govvie Latent State Labels - * - * @param strCollateralCurrency The Collateral Currency - * @param govvieLabel The Govvie Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCollateralGovvieCorrelation ( - final java.lang.String strCollateralCurrency, - final org.drip.state.identifier.GovvieLabel govvieLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == strCollateralCurrency || strCollateralCurrency.isEmpty() || null == govvieLabel || null - == auCorrelation) - return false; - - _mapCollateralGovvieCorrelation.put (strCollateralCurrency + "@#" + - govvieLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Collateral and the Overnight Latent States - * - * @param strCollateralCurrency The Collateral Currency - * @param overnightLabel The Overnight Latent State Label - * - * @return The Correlation Surface between the Collateral and the Overnight Latent States - */ - - public org.drip.function.definition.R1ToR1 collateralOvernightCorrelation ( - final java.lang.String strCollateralCurrency, - final org.drip.state.identifier.OvernightLabel overnightLabel) - { - if (null == strCollateralCurrency || strCollateralCurrency.isEmpty() || null == overnightLabel) - return null; - - java.lang.String strCode = strCollateralCurrency + "@#" + overnightLabel.fullyQualifiedName(); - - return _mapCollateralOvernightCorrelation.containsKey (strCode) ? - _mapCollateralOvernightCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Collateral and the Overnight Latent States - * - * @param strCollateralCurrency The Collateral Currency - * @param overnightLabel The Overnight Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCollateralOvernightCorrelation ( - final java.lang.String strCollateralCurrency, - final org.drip.state.identifier.OvernightLabel overnightLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == strCollateralCurrency || strCollateralCurrency.isEmpty() || null == overnightLabel || - null == auCorrelation) - return false; - - _mapCollateralOvernightCorrelation.put (strCollateralCurrency + "@#" + - overnightLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Collateral and Pay-down Latent State Labels - * - * @param strCollateralCurrency The Collateral Currency - * @param paydownLabel The Pay-down Latent State Label - * - * @return The Correlation Surface for the specified Collateral and Pay-down Latent State Labels - */ - - public org.drip.function.definition.R1ToR1 collateralPaydownCorrelation ( - final java.lang.String strCollateralCurrency, - final org.drip.state.identifier.PaydownLabel paydownLabel) - { - if (null == strCollateralCurrency || strCollateralCurrency.isEmpty() || null == paydownLabel) - return null; - - java.lang.String strCode = strCollateralCurrency + "@#" + paydownLabel.fullyQualifiedName(); - - return _mapCollateralPaydownCorrelation.containsKey (strCode) ? - _mapCollateralPaydownCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified Collateral and Pay-down Latent State Labels - * - * @param strCollateralCurrency The Collateral Currency - * @param paydownLabel The Pay-down Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCollateralPaydownCorrelation ( - final java.lang.String strCollateralCurrency, - final org.drip.state.identifier.PaydownLabel paydownLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == strCollateralCurrency || strCollateralCurrency.isEmpty() || null == paydownLabel || null - == auCorrelation) - return false; - - _mapCollateralPaydownCorrelation.put (strCollateralCurrency + "@#" + - paydownLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Collateral and Rating Latent State Labels - * - * @param strCollateralCurrency The Collateral Currency - * @param ratingLabel The Rating Latent State Label - * - * @return The Correlation Surface for the specified Collateral and Rating Latent State Labels - */ - - public org.drip.function.definition.R1ToR1 collateralRatingCorrelation ( - final java.lang.String strCollateralCurrency, - final org.drip.state.identifier.RatingLabel ratingLabel) - { - if (null == strCollateralCurrency || strCollateralCurrency.isEmpty() || null == ratingLabel) - return null; - - java.lang.String strCode = strCollateralCurrency + "@#" + ratingLabel.fullyQualifiedName(); - - return _mapCollateralRatingCorrelation.containsKey (strCode) ? - _mapCollateralRatingCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified Collateral and Rating Latent State Labels - * - * @param strCollateralCurrency The Collateral Currency - * @param ratingLabel The Rating Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCollateralRatingCorrelation ( - final java.lang.String strCollateralCurrency, - final org.drip.state.identifier.RatingLabel ratingLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == strCollateralCurrency || strCollateralCurrency.isEmpty() || null == ratingLabel || null - == auCorrelation) - return false; - - _mapCollateralRatingCorrelation.put (strCollateralCurrency + "@#" + - ratingLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Collateral and Recovery Latent State Labels - * - * @param strCollateralCurrency The Collateral Currency - * @param recoveryLabel The Recovery Latent State Label - * - * @return The Correlation Surface for the specified Collateral and Recovery Latent State Labels - */ - - public org.drip.function.definition.R1ToR1 collateralRecoveryCorrelation ( - final java.lang.String strCollateralCurrency, - final org.drip.state.identifier.RecoveryLabel recoveryLabel) - { - if (null == strCollateralCurrency || strCollateralCurrency.isEmpty() || null == recoveryLabel) - return null; - - java.lang.String strCode = strCollateralCurrency + "@#" + recoveryLabel.fullyQualifiedName(); - - return _mapCollateralRecoveryCorrelation.containsKey (strCode) ? - _mapCollateralRecoveryCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified Collateral and Recovery Latent State Labels - * - * @param strCollateralCurrency The Collateral Currency - * @param recoveryLabel The Recovery Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCollateralRecoveryCorrelation ( - final java.lang.String strCollateralCurrency, - final org.drip.state.identifier.RecoveryLabel recoveryLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == strCollateralCurrency || strCollateralCurrency.isEmpty() || null == recoveryLabel || null - == auCorrelation) - return false; - - _mapCollateralRecoveryCorrelation.put (strCollateralCurrency + "@#" + - recoveryLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Collateral and Repo Latent State Labels - * - * @param strCollateralCurrency The Collateral Currency - * @param repoLabel The Repo Latent State Label - * - * @return The Correlation Surface for the specified Collateral and Repo Latent State Labels - */ - - public org.drip.function.definition.R1ToR1 collateralRepoCorrelation ( - final java.lang.String strCollateralCurrency, - final org.drip.state.identifier.RepoLabel repoLabel) - { - if (null == strCollateralCurrency || strCollateralCurrency.isEmpty() || null == repoLabel) - return null; - - java.lang.String strCode = strCollateralCurrency + "@#" + repoLabel.fullyQualifiedName(); - - return _mapCollateralRepoCorrelation.containsKey (strCode) ? - _mapCollateralRepoCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified Collateral and Repo Latent State Labels - * - * @param strCollateralCurrency The Collateral Currency - * @param repoLabel The Repo Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCollateralRepoCorrelation ( - final java.lang.String strCollateralCurrency, - final org.drip.state.identifier.RepoLabel repoLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == strCollateralCurrency || strCollateralCurrency.isEmpty() || null == repoLabel || null == - auCorrelation) - return false; - - _mapCollateralRepoCorrelation.put (strCollateralCurrency + "@#" + - repoLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Credit and the Custom Metric Latent States - * - * @param creditLabel The Credit Latent State Label - * @param customLabel The Custom Metric Latent State Label - * - * @return The Correlation Surface between the Credit and the Custom Metric Latent States - */ - - public org.drip.function.definition.R1ToR1 creditCustomMetricCorrelation ( - final org.drip.state.identifier.CreditLabel creditLabel, - final org.drip.state.identifier.CustomLabel customLabel) - { - if (null == creditLabel || null == customLabel) return null; - - java.lang.String strCode = creditLabel.fullyQualifiedName() + "@#" + - customLabel.fullyQualifiedName(); - - return _mapCreditCustomCorrelation.containsKey (strCode) ? - _mapCreditCustomCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Credit and the Custom Metric Latent States - * - * @param creditLabel The Credit Latent State Label - * @param customLabel The Custom Metric Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCreditCustomCorrelation ( - final org.drip.state.identifier.CreditLabel creditLabel, - final org.drip.state.identifier.CustomLabel customLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == creditLabel || null == customLabel || null == auCorrelation) return false; - - _mapCreditCustomCorrelation.put (creditLabel.fullyQualifiedName() + "@#" + - customLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Credit and the Equity Latent States - * - * @param creditLabel The Credit Curve Label - * @param equityLabel The Equity Latent State Label - * - * @return The Correlation Surface between the Credit and the Equity Latent States - */ - - public org.drip.function.definition.R1ToR1 creditEquityCorrelation ( - final org.drip.state.identifier.CreditLabel creditLabel, - final org.drip.state.identifier.EquityLabel equityLabel) - { - if (null == creditLabel || null == equityLabel) return null; - - java.lang.String strCode = creditLabel.fullyQualifiedName() + "@#" + - equityLabel.fullyQualifiedName(); - - return _mapCreditEquityCorrelation.containsKey (strCode) ? - _mapCreditEquityCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Credit and the Equity Latent States - * - * @param creditLabel The Credit Curve Label - * @param equityLabel The Equity Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCreditEquityCorrelation ( - final org.drip.state.identifier.CreditLabel creditLabel, - final org.drip.state.identifier.EquityLabel equityLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == creditLabel || null == equityLabel || null == auCorrelation) return false; - - _mapCreditEquityCorrelation.put (creditLabel.fullyQualifiedName() + "@#" + - equityLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Credit and the Forward Latent States - * - * @param creditLabel The Credit Curve Label - * @param forwardLabel The Forward Latent State Label - * - * @return The Correlation Surface between the Credit and the Forward Latent States - */ - - public org.drip.function.definition.R1ToR1 creditForwardCorrelation ( - final org.drip.state.identifier.CreditLabel creditLabel, - final org.drip.state.identifier.ForwardLabel forwardLabel) - { - if (null == creditLabel || null == forwardLabel) return null; - - java.lang.String strCode = creditLabel.fullyQualifiedName() + "@#" + - forwardLabel.fullyQualifiedName(); - - return _mapCreditForwardCorrelation.containsKey (strCode) ? - _mapCreditForwardCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Credit and the Forward Latent States - * - * @param creditLabel The Credit Curve Label - * @param forwardLabel The Forward Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCreditForwardCorrelation ( - final org.drip.state.identifier.CreditLabel creditLabel, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == creditLabel || null == forwardLabel || null == auCorrelation) return false; - - _mapCreditForwardCorrelation.put (creditLabel.fullyQualifiedName() + "@#" + - forwardLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Credit and the Funding Latent States - * - * @param creditLabel The Credit Curve Latent State Label - * @param fundingLabel The Funding Latent State Label - * - * @return The Correlation Surface between the Credit and the Funding Latent States - */ - - public org.drip.function.definition.R1ToR1 creditFundingCorrelation ( - final org.drip.state.identifier.CreditLabel creditLabel, - final org.drip.state.identifier.FundingLabel fundingLabel) - { - if (null == creditLabel || null == fundingLabel) return null; - - java.lang.String strCode = creditLabel.fullyQualifiedName() + "@#" + - fundingLabel.fullyQualifiedName(); - - return _mapCreditFundingCorrelation.containsKey (strCode) ? - _mapCreditFundingCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Credit and the Funding Latent States - * - * @param creditLabel The Credit Curve Label - * @param fundingLabel The Funding Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCreditFundingCorrelation ( - final org.drip.state.identifier.CreditLabel creditLabel, - final org.drip.state.identifier.FundingLabel fundingLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == creditLabel || null == fundingLabel || null == auCorrelation) return false; - - _mapCreditFundingCorrelation.put (creditLabel.fullyQualifiedName() + "@#" + - fundingLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Credit and the FX Latent State Labels - * - * @param creditLabel The Credit Curve Label - * @param fxLabel The FX Latent State Label - * - * @return The Correlation Surface between the Credit and the FX Latent State Labels - */ - - public org.drip.function.definition.R1ToR1 creditFXCorrelation ( - final org.drip.state.identifier.CreditLabel creditLabel, - final org.drip.state.identifier.FXLabel fxLabel) - { - if (null == creditLabel || null == fxLabel) return null; - - java.lang.String strCode = creditLabel.fullyQualifiedName() + "@#" + fxLabel.fullyQualifiedName(); - - return _mapCreditFXCorrelation.containsKey (strCode) ? _mapCreditFXCorrelation.get - (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Credit and the FX Latent States - * - * @param creditLabel The Credit Curve Label - * @param fxLabel The FX Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCreditFXCorrelation ( - final org.drip.state.identifier.CreditLabel creditLabel, - final org.drip.state.identifier.FXLabel fxLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == creditLabel || null == fxLabel || null == auCorrelation) return false; - - _mapCreditFXCorrelation.get (creditLabel.fullyQualifiedName() + "@#" + - fxLabel.fullyQualifiedName()); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Credit and the Govvie Latent State Labels - * - * @param creditLabel The Credit Curve Label - * @param govvieLabel The Govvie Latent State Label - * - * @return The Correlation Surface between the Credit and the Govvie Latent State Labels - */ - - public org.drip.function.definition.R1ToR1 creditGovvieCorrelation ( - final org.drip.state.identifier.CreditLabel creditLabel, - final org.drip.state.identifier.GovvieLabel govvieLabel) - { - if (null == creditLabel || null == govvieLabel) return null; - - java.lang.String strCode = creditLabel.fullyQualifiedName() + "@#" + - govvieLabel.fullyQualifiedName(); - - return _mapCreditGovvieCorrelation.containsKey (strCode) ? - _mapCreditGovvieCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Credit and the Govvie Latent States - * - * @param creditLabel The Credit Curve Latent State Label - * @param govvieLabel The Govvie Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCreditGovvieCorrelation ( - final org.drip.state.identifier.CreditLabel creditLabel, - final org.drip.state.identifier.GovvieLabel govvieLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == creditLabel || null == govvieLabel || null == auCorrelation) return false; - - _mapCreditGovvieCorrelation.put (creditLabel.fullyQualifiedName() + "@#" + - govvieLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Credit and the Overnight Latent States - * - * @param creditLabel The Credit Curve Latent State Label - * @param overnightLabel The Overnight Latent State Label - * - * @return The Correlation Surface between the Credit and the Overnight Latent States - */ - - public org.drip.function.definition.R1ToR1 creditOvernightCorrelation ( - final org.drip.state.identifier.CreditLabel creditLabel, - final org.drip.state.identifier.OvernightLabel overnightLabel) - { - if (null == creditLabel || null == overnightLabel) return null; - - java.lang.String strCode = creditLabel.fullyQualifiedName() + "@#" + - overnightLabel.fullyQualifiedName(); - - return _mapCreditOvernightCorrelation.containsKey (strCode) ? - _mapCreditOvernightCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Credit and the Overnight Latent States - * - * @param creditLabel The Credit Curve Label - * @param overnightLabel The Overnight Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCreditOvernightCorrelation ( - final org.drip.state.identifier.CreditLabel creditLabel, - final org.drip.state.identifier.OvernightLabel overnightLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == creditLabel || null == overnightLabel || null == auCorrelation) return false; - - _mapCreditOvernightCorrelation.put (creditLabel.fullyQualifiedName() + "@#" + - overnightLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Credit and the Pay-down Latent State Labels - * - * @param creditLabel The Credit Curve Label - * @param paydownLabel The Pay-down Latent State Label - * - * @return The Correlation Surface between the Credit and the Pay-down Latent State Labels - */ - - public org.drip.function.definition.R1ToR1 creditPaydownCorrelation ( - final org.drip.state.identifier.CreditLabel creditLabel, - final org.drip.state.identifier.PaydownLabel paydownLabel) - { - if (null == creditLabel || null == paydownLabel) return null; - - java.lang.String strCode = creditLabel.fullyQualifiedName() + "@#" + - paydownLabel.fullyQualifiedName(); - - return _mapCreditPaydownCorrelation.containsKey (strCode) ? - _mapCreditPaydownCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Credit and the Pay-down Latent States - * - * @param creditLabel The Credit Curve Latent State Label - * @param paydownLabel The Pay-down Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCreditPaydownCorrelation ( - final org.drip.state.identifier.CreditLabel creditLabel, - final org.drip.state.identifier.PaydownLabel paydownLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == creditLabel || null == paydownLabel || null == auCorrelation) return false; - - _mapCreditPaydownCorrelation.put (creditLabel.fullyQualifiedName() + "@#" + - paydownLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Credit and the Rating Latent State Labels - * - * @param creditLabel The Credit Curve Label - * @param ratingLabel The Rating Latent State Label - * - * @return The Correlation Surface between the Credit and the Rating Latent State Labels - */ - - public org.drip.function.definition.R1ToR1 creditRatingCorrelation ( - final org.drip.state.identifier.CreditLabel creditLabel, - final org.drip.state.identifier.RatingLabel ratingLabel) - { - if (null == creditLabel || null == ratingLabel) return null; - - java.lang.String strCode = creditLabel.fullyQualifiedName() + "@#" + - ratingLabel.fullyQualifiedName(); - - return _mapCreditRatingCorrelation.containsKey (strCode) ? - _mapCreditRatingCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Credit and the Rating Latent States - * - * @param creditLabel The Credit Curve Latent State Label - * @param ratingLabel The Rating Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCreditRatingCorrelation ( - final org.drip.state.identifier.CreditLabel creditLabel, - final org.drip.state.identifier.RatingLabel ratingLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == creditLabel || null == ratingLabel || null == auCorrelation) return false; - - _mapCreditRatingCorrelation.put (creditLabel.fullyQualifiedName() + "@#" + - ratingLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Credit and the Repo Latent State Labels - * - * @param creditLabel The Credit Curve Label - * @param repoLabel The Repo Latent State Label - * - * @return The Correlation Surface between the Credit and the Repo Latent State Labels - */ - - public org.drip.function.definition.R1ToR1 creditRepoCorrelation ( - final org.drip.state.identifier.CreditLabel creditLabel, - final org.drip.state.identifier.RepoLabel repoLabel) - { - if (null == creditLabel || null == repoLabel) return null; - - java.lang.String strCode = creditLabel.fullyQualifiedName() + "@#" + repoLabel.fullyQualifiedName(); - - return _mapCreditRepoCorrelation.containsKey (strCode) ? _mapCreditRepoCorrelation.get - (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Credit and the Repo Latent States - * - * @param creditLabel The Credit Curve Latent State Label - * @param repoLabel The Repo Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCreditRepoCorrelation ( - final org.drip.state.identifier.CreditLabel creditLabel, - final org.drip.state.identifier.RepoLabel repoLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == creditLabel || null == repoLabel || null == auCorrelation) return false; - - _mapCreditRepoCorrelation.put (creditLabel.fullyQualifiedName() + "@#" + - repoLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Credit and the Recovery Latent State Labels - * - * @param creditLabel The Credit Curve Label - * @param recoveryLabel The Recovery Latent State Label - * - * @return The Correlation Surface between the Credit and the Recovery Latent State Labels - */ - - public org.drip.function.definition.R1ToR1 creditRecoveryCorrelation ( - final org.drip.state.identifier.CreditLabel creditLabel, - final org.drip.state.identifier.RecoveryLabel recoveryLabel) - { - if (null == creditLabel || null == recoveryLabel) return null; - - java.lang.String strCode = creditLabel.fullyQualifiedName() + "@#" + - recoveryLabel.fullyQualifiedName(); - - return _mapCreditRecoveryCorrelation.containsKey (strCode) ? - _mapCreditRecoveryCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Credit and the Recovery Latent States - * - * @param creditLabel The Credit Curve Latent State Label - * @param recoveryLabel The Recovery Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCreditRecoveryCorrelation ( - final org.drip.state.identifier.CreditLabel creditLabel, - final org.drip.state.identifier.RecoveryLabel recoveryLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == creditLabel || null == recoveryLabel || null == auCorrelation) return false; - - _mapCreditRecoveryCorrelation.put (creditLabel.fullyQualifiedName() + "@#" + - recoveryLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Custom Metric and the Equity Latent States - * - * @param customLabel The Custom Metric Latent State Label - * @param equityLabel The Equity Latent State Label - * - * @return The Correlation Surface between the Custom Metric and the Equity Latent States - */ - - public org.drip.function.definition.R1ToR1 customEquityCorrelation ( - final org.drip.state.identifier.CustomLabel customLabel, - final org.drip.state.identifier.EquityLabel equityLabel) - { - if (null == customLabel || null == equityLabel) return null; - - java.lang.String strCode = customLabel.fullyQualifiedName() + "@#" + - equityLabel.fullyQualifiedName(); - - return _mapCustomEquityCorrelation.containsKey (strCode) ? - _mapCustomEquityCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Custom Metric and the Equity Latent States - * - * @param customLabel The Custom Metric Label - * @param equityLabel The Equity Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCustomEquityCorrelation ( - final org.drip.state.identifier.CustomLabel customLabel, - final org.drip.state.identifier.EquityLabel equityLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == customLabel || null == equityLabel || null == auCorrelation) return false; - - _mapCustomEquityCorrelation.put (customLabel.fullyQualifiedName() + "@#" + - equityLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Custom Metric and the Forward Latent States - * - * @param customLabel The Custom Metric Latent State Label - * @param forwardLabel The Forward Latent State Label - * - * @return The Correlation Surface between the Custom Metric and the Forward Latent States - */ - - public org.drip.function.definition.R1ToR1 customForwardCorrelation ( - final org.drip.state.identifier.CustomLabel customLabel, - final org.drip.state.identifier.ForwardLabel forwardLabel) - { - if (null == customLabel || null == forwardLabel) return null; - - java.lang.String strCode = customLabel.fullyQualifiedName() + "@#" + - forwardLabel.fullyQualifiedName(); - - return _mapCustomForwardCorrelation.containsKey (strCode) ? - _mapCustomForwardCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Custom Metric and the Forward Latent States - * - * @param customLabel The Custom Metric Label - * @param forwardLabel The Forward Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCustomForwardCorrelation ( - final org.drip.state.identifier.CustomLabel customLabel, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == customLabel || null == forwardLabel || null == auCorrelation) return false; - - _mapCustomForwardCorrelation.put (customLabel.fullyQualifiedName() + "@#" + - forwardLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between Custom Metric and the Funding Latent States - * - * @param customLabel The Custom Metric Latent State Label - * @param fundingLabel The Funding Latent State Label - * - * @return The Correlation Surface between the Custom Metric and the Funding Latent States - */ - - public org.drip.function.definition.R1ToR1 customMetricFundingCorrelation ( - final org.drip.state.identifier.CustomLabel customLabel, - final org.drip.state.identifier.FundingLabel fundingLabel) - { - if (null == customLabel || null == fundingLabel) return null; - - java.lang.String strCode = customLabel.fullyQualifiedName() + "@#" + - fundingLabel.fullyQualifiedName(); - - return _mapCustomFundingCorrelation.containsKey (strCode) ? - _mapCustomFundingCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Custom Metric and the Funding Latent States - * - * @param customLabel The Custom Metric Latent State Label - * @param fundingLabel The Funding Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCustomFundingCorrelation ( - final org.drip.state.identifier.CustomLabel customLabel, - final org.drip.state.identifier.FundingLabel fundingLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == customLabel || null == fundingLabel) return false; - - _mapCustomFundingCorrelation.put (customLabel.fullyQualifiedName() + "@#" + - fundingLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Custom Metric and the FX Latent States - * - * @param customLabel The Custom Metric Latent State Label - * @param fxLabel The FX Latent State Label - * - * @return The Correlation Surface between the Custom Metric and the FX Latent States - */ - - public org.drip.function.definition.R1ToR1 customFXCorrelation ( - final org.drip.state.identifier.CustomLabel customLabel, - final org.drip.state.identifier.FXLabel fxLabel) - { - if (null == customLabel || null == fxLabel) return null; - - java.lang.String strCode = customLabel.fullyQualifiedName() + "@#" + fxLabel.fullyQualifiedName(); - - return _mapCustomFXCorrelation.containsKey (strCode) ? _mapCustomFXCorrelation.get - (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Custom Metric and the FX Latent States - * - * @param customLabel The Custom Metric Latent State Label - * @param fxLabel The FX Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCustomFXCorrelation ( - final org.drip.state.identifier.CustomLabel customLabel, - final org.drip.state.identifier.FXLabel fxLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == customLabel || null == fxLabel || null == auCorrelation) return false; - - _mapCustomFXCorrelation.get (customLabel.fullyQualifiedName() + "@#" + - fxLabel.fullyQualifiedName()); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Custom Metric and the Govvie Latent States - * - * @param customLabel The Custom Metric Latent State Label - * @param govvieLabel The Govvie Latent State Label - * - * @return The Correlation Surface between the Custom Metric and the Govvie Latent States - */ - - public org.drip.function.definition.R1ToR1 customGovvieCorrelation ( - final org.drip.state.identifier.CustomLabel customLabel, - final org.drip.state.identifier.GovvieLabel govvieLabel) - { - if (null == customLabel || null == govvieLabel) return null; - - java.lang.String strCode = customLabel.fullyQualifiedName() + "@#" + - govvieLabel.fullyQualifiedName(); - - return _mapCustomGovvieCorrelation.containsKey (strCode) ? - _mapCustomGovvieCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Custom Metric and the Govvie Latent States - * - * @param customLabel The Custom Metric Latent State Label - * @param govvieLabel The Govvie Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCustomGovvieCorrelation ( - final org.drip.state.identifier.CustomLabel customLabel, - final org.drip.state.identifier.GovvieLabel govvieLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == customLabel || null == govvieLabel) return false; - - _mapCustomGovvieCorrelation.put (customLabel.fullyQualifiedName() + "@#" + - govvieLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Custom Metric and the Overnight Latent States - * - * @param customLabel The Custom Metric Latent State Label - * @param overnightLabel The Overnight Latent State Label - * - * @return The Correlation Surface between the Custom Metric and the Overnight Latent States - */ - - public org.drip.function.definition.R1ToR1 customOvernightCorrelation ( - final org.drip.state.identifier.CustomLabel customLabel, - final org.drip.state.identifier.OvernightLabel overnightLabel) - { - if (null == customLabel || null == overnightLabel) return null; - - java.lang.String strCode = customLabel.fullyQualifiedName() + "@#" + - overnightLabel.fullyQualifiedName(); - - return _mapCustomOvernightCorrelation.containsKey (strCode) ? - _mapCustomOvernightCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Custom Metric and the Overnight Latent States - * - * @param customLabel The Custom Metric Latent State Label - * @param overnightLabel The Overnight Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCustomOvernightCorrelation ( - final org.drip.state.identifier.CustomLabel customLabel, - final org.drip.state.identifier.OvernightLabel overnightLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == customLabel || null == overnightLabel) return false; - - _mapCustomOvernightCorrelation.put (customLabel.fullyQualifiedName() + "@#" + - overnightLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Custom Metric and the Pay-down Latent States - * - * @param customLabel The Custom Metric Latent State Label - * @param paydownLabel The Pay-down Latent State Label - * - * @return The Correlation Surface between the Custom Metric and the Pay-down Latent States - */ - - public org.drip.function.definition.R1ToR1 customPaydownCorrelation ( - final org.drip.state.identifier.CustomLabel customLabel, - final org.drip.state.identifier.PaydownLabel paydownLabel) - { - if (null == customLabel || null == paydownLabel) return null; - - java.lang.String strCode = customLabel.fullyQualifiedName() + "@#" + - paydownLabel.fullyQualifiedName(); - - return _mapCustomPaydownCorrelation.containsKey (strCode) ? - _mapCustomPaydownCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Custom Metric and the Pay-down Latent States - * - * @param customLabel The Custom Metric Latent State Label - * @param paydownLabel The Pay-down Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCustomPaydownCorrelation ( - final org.drip.state.identifier.CustomLabel customLabel, - final org.drip.state.identifier.PaydownLabel paydownLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == customLabel || null == paydownLabel) return false; - - _mapCustomPaydownCorrelation.put (customLabel.fullyQualifiedName() + "@#" + - paydownLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Custom Metric and the Rating Latent States - * - * @param customLabel The Custom Metric Latent State Label - * @param ratingLabel The Rating Latent State Label - * - * @return The Correlation Surface between the Custom Metric and the Rating Latent States - */ - - public org.drip.function.definition.R1ToR1 customRatingCorrelation ( - final org.drip.state.identifier.CustomLabel customLabel, - final org.drip.state.identifier.RatingLabel ratingLabel) - { - if (null == customLabel || null == ratingLabel) return null; - - java.lang.String strCode = customLabel.fullyQualifiedName() + "@#" + - ratingLabel.fullyQualifiedName(); - - return _mapCustomRatingCorrelation.containsKey (strCode) ? - _mapCustomRatingCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Custom Metric and the Rating Latent States - * - * @param customLabel The Custom Metric Latent State Label - * @param ratingLabel The Rating Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCustomRatingCorrelation ( - final org.drip.state.identifier.CustomLabel customLabel, - final org.drip.state.identifier.RatingLabel ratingLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == customLabel || null == ratingLabel) return false; - - _mapCustomRatingCorrelation.put (customLabel.fullyQualifiedName() + "@#" + - ratingLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Custom Metric and the Recovery Latent States - * - * @param customLabel The Custom Metric Latent State Label - * @param recoveryLabel The Recovery Latent State Label - * - * @return The Correlation Surface between the Custom Metric and the Recovery Latent States - */ - - public org.drip.function.definition.R1ToR1 customRecoveryCorrelation ( - final org.drip.state.identifier.CustomLabel customLabel, - final org.drip.state.identifier.RecoveryLabel recoveryLabel) - { - if (null == customLabel || null == recoveryLabel) return null; - - java.lang.String strCode = customLabel.fullyQualifiedName() + "@#" + - recoveryLabel.fullyQualifiedName(); - - return _mapCustomRecoveryCorrelation.containsKey (strCode) ? - _mapCustomRecoveryCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Custom Metric and the Recovery Latent States - * - * @param customLabel The Custom Metric Latent State Label - * @param recoveryLabel The Recovery Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCustomRecoveryCorrelation ( - final org.drip.state.identifier.CustomLabel customLabel, - final org.drip.state.identifier.RecoveryLabel recoveryLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == customLabel || null == recoveryLabel) return false; - - _mapCustomRecoveryCorrelation.put (customLabel.fullyQualifiedName() + "@#" + - recoveryLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Custom Metric and the Repo Latent States - * - * @param customLabel The Custom Metric Latent State Label - * @param repoLabel The Repo Latent State Label - * - * @return The Correlation Surface between the Custom Metric and the Repo Latent States - */ - - public org.drip.function.definition.R1ToR1 customRepoCorrelation ( - final org.drip.state.identifier.CustomLabel customLabel, - final org.drip.state.identifier.RepoLabel repoLabel) - { - if (null == customLabel || null == repoLabel) return null; - - java.lang.String strCode = customLabel.fullyQualifiedName() + "@#" + repoLabel.fullyQualifiedName(); - - return _mapCustomRepoCorrelation.containsKey (strCode) ? _mapCustomRepoCorrelation.get - (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Custom Metric and the Repo Latent States - * - * @param customLabel The Custom Metric Latent State Label - * @param repoLabel The Repo Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setCustomRepoCorrelation ( - final org.drip.state.identifier.CustomLabel customLabel, - final org.drip.state.identifier.RepoLabel repoLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == customLabel || null == repoLabel) return false; - - _mapCustomRepoCorrelation.put (customLabel.fullyQualifiedName() + "@#" + - repoLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Equity and the Forward Latent States - * - * @param equityLabel The Equity Latent State Label - * @param forwardLabel The Forward Latent State Label - * - * @return The Correlation Surface between the Equity and the Forward Latent States - */ - - public org.drip.function.definition.R1ToR1 equityForwardCorrelation ( - final org.drip.state.identifier.EquityLabel equityLabel, - final org.drip.state.identifier.ForwardLabel forwardLabel) - { - if (null == equityLabel || null == forwardLabel) return null; - - java.lang.String strCode = equityLabel.fullyQualifiedName() + "@#" + - forwardLabel.fullyQualifiedName(); - - return _mapEquityForwardCorrelation.containsKey (strCode) ? - _mapEquityForwardCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Equity and the Forward Latent States - * - * @param equityLabel The Equity Label - * @param forwardLabel The Forward Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setEquityForwardCorrelation ( - final org.drip.state.identifier.EquityLabel equityLabel, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == equityLabel || null == forwardLabel || null == auCorrelation) return false; - - _mapEquityForwardCorrelation.put (equityLabel.fullyQualifiedName() + "@#" + - forwardLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between Equity and the Funding Latent States - * - * @param equityLabel The Equity Latent State Label - * @param fundingLabel The Funding Latent State Label - * - * @return The Correlation Surface between the Equity and the Funding Latent States - */ - - public org.drip.function.definition.R1ToR1 equityFundingCorrelation ( - final org.drip.state.identifier.EquityLabel equityLabel, - final org.drip.state.identifier.FundingLabel fundingLabel) - { - if (null == equityLabel || null == fundingLabel) return null; - - java.lang.String strCode = equityLabel.fullyQualifiedName() + "@#" + - fundingLabel.fullyQualifiedName(); - - return _mapEquityFundingCorrelation.containsKey (strCode) ? - _mapEquityFundingCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Equity and the Funding Latent States - * - * @param equityLabel The Equity Latent State Label - * @param fundingLabel The Funding Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setEquityFundingCorrelation ( - final org.drip.state.identifier.EquityLabel equityLabel, - final org.drip.state.identifier.FundingLabel fundingLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == equityLabel || null == fundingLabel) return false; - - _mapEquityFundingCorrelation.put (equityLabel.fullyQualifiedName() + "@#" + - fundingLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Equity and the FX Latent States - * - * @param equityLabel The Equity Latent State Label - * @param fxLabel The FX Latent State Label - * - * @return The Correlation Surface between the Equity and the FX Latent States - */ - - public org.drip.function.definition.R1ToR1 equityFXCorrelation ( - final org.drip.state.identifier.EquityLabel equityLabel, - final org.drip.state.identifier.FXLabel fxLabel) - { - if (null == equityLabel || null == fxLabel) return null; - - java.lang.String strCode = equityLabel.fullyQualifiedName() + "@#" + fxLabel.fullyQualifiedName(); - - return _mapEquityFXCorrelation.containsKey (strCode) ? _mapEquityFXCorrelation.get - (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Equity and the FX Latent States - * - * @param equityLabel The Equity Latent State Label - * @param fxLabel The FX Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setEquityFXCorrelation ( - final org.drip.state.identifier.EquityLabel equityLabel, - final org.drip.state.identifier.FXLabel fxLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == equityLabel || null == fxLabel || null == auCorrelation) return false; - - _mapEquityFXCorrelation.get (equityLabel.fullyQualifiedName() + "@#" + - fxLabel.fullyQualifiedName()); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Equity and the Govvie Latent States - * - * @param equityLabel The Equity Latent State Label - * @param govvieLabel The Govvie Latent State Label - * - * @return The Correlation Surface between the Equity and the Govvie Latent States - */ - - public org.drip.function.definition.R1ToR1 equityGovvieCorrelation ( - final org.drip.state.identifier.EquityLabel equityLabel, - final org.drip.state.identifier.GovvieLabel govvieLabel) - { - if (null == equityLabel || null == govvieLabel) return null; - - java.lang.String strCode = equityLabel.fullyQualifiedName() + "@#" + - govvieLabel.fullyQualifiedName(); - - return _mapEquityGovvieCorrelation.containsKey (strCode) ? - _mapEquityGovvieCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Equity and the Govvie Latent States - * - * @param equityLabel The Equity Latent State Label - * @param govvieLabel The Govvie Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setEquityGovvieCorrelation ( - final org.drip.state.identifier.EquityLabel equityLabel, - final org.drip.state.identifier.GovvieLabel govvieLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == equityLabel || null == govvieLabel) return false; - - _mapEquityGovvieCorrelation.put (equityLabel.fullyQualifiedName() + "@#" + - govvieLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between Equity and the Overnight Latent States - * - * @param equityLabel The Equity Latent State Label - * @param overnightLabel The Overnight Latent State Label - * - * @return The Correlation Surface between the Equity and the Overnight Latent States - */ - - public org.drip.function.definition.R1ToR1 equityOvernightCorrelation ( - final org.drip.state.identifier.EquityLabel equityLabel, - final org.drip.state.identifier.OvernightLabel overnightLabel) - { - if (null == equityLabel || null == overnightLabel) return null; - - java.lang.String strCode = equityLabel.fullyQualifiedName() + "@#" + - overnightLabel.fullyQualifiedName(); - - return _mapEquityOvernightCorrelation.containsKey (strCode) ? - _mapEquityOvernightCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Equity and the Overnight Latent States - * - * @param equityLabel The Equity Latent State Label - * @param overnightLabel The Overnight Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setEquityOvernightCorrelation ( - final org.drip.state.identifier.EquityLabel equityLabel, - final org.drip.state.identifier.OvernightLabel overnightLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == equityLabel || null == overnightLabel) return false; - - _mapEquityOvernightCorrelation.put (equityLabel.fullyQualifiedName() + "@#" + - overnightLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Equity and the Pay-down Latent States - * - * @param equityLabel The Equity Latent State Label - * @param paydownLabel The Pay-down Latent State Label - * - * @return The Correlation Surface between the Equity and the Pay-down Latent States - */ - - public org.drip.function.definition.R1ToR1 equityPaydownCorrelation ( - final org.drip.state.identifier.EquityLabel equityLabel, - final org.drip.state.identifier.PaydownLabel paydownLabel) - { - if (null == equityLabel || null == paydownLabel) return null; - - java.lang.String strCode = equityLabel.fullyQualifiedName() + "@#" + - paydownLabel.fullyQualifiedName(); - - return _mapEquityPaydownCorrelation.containsKey (strCode) ? - _mapEquityPaydownCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Equity and the Pay-down Latent States - * - * @param equityLabel The Equity Latent State Label - * @param paydownLabel The Pay-down Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setEquityPaydownCorrelation ( - final org.drip.state.identifier.EquityLabel equityLabel, - final org.drip.state.identifier.PaydownLabel paydownLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == equityLabel || null == paydownLabel) return false; - - _mapEquityPaydownCorrelation.put (equityLabel.fullyQualifiedName() + "@#" + - paydownLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Equity and the Recovery Latent States - * - * @param equityLabel The Equity Latent State Label - * @param recoveryLabel The Recovery Latent State Label - * - * @return The Correlation Surface between the Equity and the Recovery Latent States - */ - - public org.drip.function.definition.R1ToR1 equityRecoveryCorrelation ( - final org.drip.state.identifier.EquityLabel equityLabel, - final org.drip.state.identifier.RecoveryLabel recoveryLabel) - { - if (null == equityLabel || null == recoveryLabel) return null; - - java.lang.String strCode = equityLabel.fullyQualifiedName() + "@#" + - recoveryLabel.fullyQualifiedName(); - - return _mapEquityRecoveryCorrelation.containsKey (strCode) ? - _mapEquityRecoveryCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Equity and the Recovery Latent States - * - * @param equityLabel The Equity Latent State Label - * @param recoveryLabel The Recovery Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setEquityRecoveryCorrelation ( - final org.drip.state.identifier.EquityLabel equityLabel, - final org.drip.state.identifier.RecoveryLabel recoveryLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == equityLabel || null == recoveryLabel) return false; - - _mapEquityRecoveryCorrelation.put (equityLabel.fullyQualifiedName() + "@#" + - recoveryLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Equity and the Rating Latent States - * - * @param equityLabel The Equity Latent State Label - * @param ratingLabel The Rating Latent State Label - * - * @return The Correlation Surface between the Equity and the Rating Latent States - */ - - public org.drip.function.definition.R1ToR1 equityRatingCorrelation ( - final org.drip.state.identifier.EquityLabel equityLabel, - final org.drip.state.identifier.RatingLabel ratingLabel) - { - if (null == equityLabel || null == ratingLabel) return null; - - java.lang.String strCode = equityLabel.fullyQualifiedName() + "@#" + - ratingLabel.fullyQualifiedName(); - - return _mapEquityRatingCorrelation.containsKey (strCode) ? - _mapEquityRatingCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Equity and the Rating Latent States - * - * @param equityLabel The Equity Latent State Label - * @param ratingLabel The Rating Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setEquityRatingCorrelation ( - final org.drip.state.identifier.EquityLabel equityLabel, - final org.drip.state.identifier.RatingLabel ratingLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == equityLabel || null == ratingLabel) return false; - - _mapEquityRatingCorrelation.put (equityLabel.fullyQualifiedName() + "@#" + - ratingLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Equity and the Repo Latent States - * - * @param equityLabel The Equity Latent State Label - * @param repoLabel The Repo Latent State Label - * - * @return The Correlation Surface between the Equity and the Repo Latent States - */ - - public org.drip.function.definition.R1ToR1 equityRepoCorrelation ( - final org.drip.state.identifier.EquityLabel equityLabel, - final org.drip.state.identifier.RepoLabel repoLabel) - { - if (null == equityLabel || null == repoLabel) return null; - - java.lang.String strCode = equityLabel.fullyQualifiedName() + "@#" + repoLabel.fullyQualifiedName(); - - return _mapEquityRepoCorrelation.containsKey (strCode) ? _mapEquityRepoCorrelation.get - (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Equity and the Repo Latent States - * - * @param equityLabel The Equity Latent State Label - * @param repoLabel The Repo Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setEquityRepoCorrelation ( - final org.drip.state.identifier.EquityLabel equityLabel, - final org.drip.state.identifier.RepoLabel repoLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == equityLabel || null == repoLabel) return false; - - _mapEquityRepoCorrelation.put (equityLabel.fullyQualifiedName() + "@#" + - repoLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Forward and the Funding Latent States - * - * @param forwardLabel The Forward Latent State Label - * @param fundingLabel The Funding Latent State Label - * - * @return The Correlation Surface between the Forward and the Funding Latent States - */ - - public org.drip.function.definition.R1ToR1 forwardFundingCorrelation ( - final org.drip.state.identifier.ForwardLabel forwardLabel, - final org.drip.state.identifier.FundingLabel fundingLabel) - { - if (null == forwardLabel || null == fundingLabel) return null; - - java.lang.String strCode = forwardLabel.fullyQualifiedName() + "@#" + - fundingLabel.fullyQualifiedName(); - - return _mapForwardFundingCorrelation.containsKey (strCode) ? - _mapForwardFundingCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Forward and the Funding Latent States - * - * @param forwardLabel The Forward Curve Latent State Label - * @param fundingLabel The Funding Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setForwardFundingCorrelation ( - final org.drip.state.identifier.ForwardLabel forwardLabel, - final org.drip.state.identifier.FundingLabel fundingLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == forwardLabel || null == fundingLabel || null == auCorrelation) return false; - - _mapForwardFundingCorrelation.put (forwardLabel.fullyQualifiedName() + "@#" + - fundingLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Forward and the FX Latent State Labels - * - * @param forwardLabel The Forward Curve Latent State Label - * @param fxLabel The FX Latent State Label - * - * @return The Correlation Surface between the Forward and the FX Latent State Labels - */ - - public org.drip.function.definition.R1ToR1 forwardFXCorrelation ( - final org.drip.state.identifier.ForwardLabel forwardLabel, - final org.drip.state.identifier.FXLabel fxLabel) - { - if (null == forwardLabel || null == fxLabel) return null; - - java.lang.String strCode = forwardLabel.fullyQualifiedName() + "@#" + fxLabel.fullyQualifiedName(); - - return _mapForwardFXCorrelation.containsKey (strCode) ? _mapForwardFXCorrelation.get - (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Forward and the FX Latent State Labels - * - * @param forwardLabel The Forward Curve Latent State Label - * @param fxLabel The FX Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setForwardFXCorrelation ( - final org.drip.state.identifier.ForwardLabel forwardLabel, - final org.drip.state.identifier.FXLabel fxLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == forwardLabel || null == fxLabel || null == auCorrelation) return false; - - _mapForwardFXCorrelation.get (forwardLabel.fullyQualifiedName() + "@#" + - fxLabel.fullyQualifiedName()); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Forward and the Govvie Latent States - * - * @param forwardLabel The Forward Curve Latent State Label - * @param govvieLabel The Govvie Latent State Label - * - * @return The Correlation Surface between the Forward and the Govvie Latent States - */ - - public org.drip.function.definition.R1ToR1 forwardGovvieCorrelation ( - final org.drip.state.identifier.ForwardLabel forwardLabel, - final org.drip.state.identifier.GovvieLabel govvieLabel) - { - if (null == forwardLabel || null == govvieLabel) return null; - - java.lang.String strCode = forwardLabel.fullyQualifiedName() + "@#" + - govvieLabel.fullyQualifiedName(); - - return _mapForwardGovvieCorrelation.containsKey (strCode) ? - _mapForwardGovvieCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Forward and the Govvie Latent States - * - * @param forwardLabel The Forward Curve Latent State Label - * @param govvieLabel The Govvie Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setForwardGovvieCorrelation ( - final org.drip.state.identifier.ForwardLabel forwardLabel, - final org.drip.state.identifier.GovvieLabel govvieLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == forwardLabel || null == govvieLabel || null == auCorrelation) return false; - - _mapForwardGovvieCorrelation.put (forwardLabel.fullyQualifiedName() + "@#" + - govvieLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Forward and the Overnight Latent States - * - * @param forwardLabel The Forward Latent State Label - * @param overnightLabel The Overnight Latent State Label - * - * @return The Correlation Surface between the Forward and the Overnight Latent States - */ - - public org.drip.function.definition.R1ToR1 forwardOvernightCorrelation ( - final org.drip.state.identifier.ForwardLabel forwardLabel, - final org.drip.state.identifier.OvernightLabel overnightLabel) - { - if (null == forwardLabel || null == overnightLabel) return null; - - java.lang.String strCode = forwardLabel.fullyQualifiedName() + "@#" + - overnightLabel.fullyQualifiedName(); - - return _mapForwardOvernightCorrelation.containsKey (strCode) ? - _mapForwardOvernightCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Forward and the Overnight Latent States - * - * @param forwardLabel The Forward Curve Latent State Label - * @param overnightLabel The Overnight Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setForwardOvernightCorrelation ( - final org.drip.state.identifier.ForwardLabel forwardLabel, - final org.drip.state.identifier.OvernightLabel overnightLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == forwardLabel || null == overnightLabel || null == auCorrelation) return false; - - _mapForwardOvernightCorrelation.put (forwardLabel.fullyQualifiedName() + "@#" + - overnightLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Forward and the Pay-down Latent States - * - * @param forwardLabel The Forward Curve Latent State Label - * @param paydownLabel The Pay-down Latent State Label - * - * @return The Correlation Surface between the Forward and the Pay-down Latent States - */ - - public org.drip.function.definition.R1ToR1 forwardPaydownCorrelation ( - final org.drip.state.identifier.ForwardLabel forwardLabel, - final org.drip.state.identifier.PaydownLabel paydownLabel) - { - if (null == forwardLabel || null == paydownLabel) return null; - - java.lang.String strCode = forwardLabel.fullyQualifiedName() + "@#" + - paydownLabel.fullyQualifiedName(); - - return _mapForwardPaydownCorrelation.containsKey (strCode) ? - _mapForwardPaydownCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Forward and the Pay-down Latent States - * - * @param forwardLabel The Forward Curve Latent State Label - * @param paydownLabel The Pay-down Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setForwardPaydownCorrelation ( - final org.drip.state.identifier.ForwardLabel forwardLabel, - final org.drip.state.identifier.PaydownLabel paydownLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == forwardLabel || null == paydownLabel || null == auCorrelation) return false; - - _mapForwardPaydownCorrelation.put (forwardLabel.fullyQualifiedName() + "@#" + - paydownLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Forward and the Rating Latent States - * - * @param forwardLabel The Forward Curve Latent State Label - * @param ratingLabel The Rating Latent State Label - * - * @return The Correlation Surface between the Forward and the Rating Latent States - */ - - public org.drip.function.definition.R1ToR1 forwardRatingCorrelation ( - final org.drip.state.identifier.ForwardLabel forwardLabel, - final org.drip.state.identifier.RatingLabel ratingLabel) - { - if (null == forwardLabel || null == ratingLabel) return null; - - java.lang.String strCode = forwardLabel.fullyQualifiedName() + "@#" + - ratingLabel.fullyQualifiedName(); - - return _mapForwardRatingCorrelation.containsKey (strCode) ? - _mapForwardRatingCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Forward and the Rating Latent States - * - * @param forwardLabel The Forward Curve Latent State Label - * @param ratingLabel The Rating Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setForwardRatingCorrelation ( - final org.drip.state.identifier.ForwardLabel forwardLabel, - final org.drip.state.identifier.RatingLabel ratingLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == forwardLabel || null == ratingLabel || null == auCorrelation) return false; - - _mapForwardRatingCorrelation.put (forwardLabel.fullyQualifiedName() + "@#" + - ratingLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Forward and the Recovery Latent States - * - * @param forwardLabel The Forward Curve Latent State Label - * @param recoveryLabel The Recovery Latent State Label - * - * @return The Correlation Surface between the Forward and the Recovery Latent States - */ - - public org.drip.function.definition.R1ToR1 forwardRecoveryCorrelation ( - final org.drip.state.identifier.ForwardLabel forwardLabel, - final org.drip.state.identifier.RecoveryLabel recoveryLabel) - { - if (null == forwardLabel || null == recoveryLabel) return null; - - java.lang.String strCode = forwardLabel.fullyQualifiedName() + "@#" + - recoveryLabel.fullyQualifiedName(); - - return _mapForwardRecoveryCorrelation.containsKey (strCode) ? - _mapForwardRecoveryCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Forward and the Recovery Latent States - * - * @param forwardLabel The Forward Curve Latent State Label - * @param recoveryLabel The Recovery Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setForwardRecoveryCorrelation ( - final org.drip.state.identifier.ForwardLabel forwardLabel, - final org.drip.state.identifier.RecoveryLabel recoveryLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == forwardLabel || null == recoveryLabel || null == auCorrelation) return false; - - _mapForwardRecoveryCorrelation.put (forwardLabel.fullyQualifiedName() + "@#" + - recoveryLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Forward and the Repo Latent States - * - * @param forwardLabel The Forward Curve Latent State Label - * @param repoLabel The Repo Latent State Label - * - * @return The Correlation Surface between the Forward and the Repo Latent States - */ - - public org.drip.function.definition.R1ToR1 forwardRepoCorrelation ( - final org.drip.state.identifier.ForwardLabel forwardLabel, - final org.drip.state.identifier.RepoLabel repoLabel) - { - if (null == forwardLabel || null == repoLabel) return null; - - java.lang.String strCode = forwardLabel.fullyQualifiedName() + "@#" + repoLabel.fullyQualifiedName(); - - return _mapForwardRepoCorrelation.containsKey (strCode) ? - _mapForwardRepoCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Forward and the Repo Latent States - * - * @param forwardLabel The Forward Curve Latent State Label - * @param repoLabel The Repo Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setForwardRepoCorrelation ( - final org.drip.state.identifier.ForwardLabel forwardLabel, - final org.drip.state.identifier.RepoLabel repoLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == forwardLabel || null == repoLabel || null == auCorrelation) return false; - - _mapForwardRepoCorrelation.put (forwardLabel.fullyQualifiedName() + "@#" + - repoLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Funding and the FX Latent States - * - * @param fundingLabel The Funding Latent State Label - * @param fxLabel The FX Latent State Label - * - * @return The Correlation Surface between the Funding and the FX Latent States - */ - - public org.drip.function.definition.R1ToR1 fundingFXCorrelation ( - final org.drip.state.identifier.FundingLabel fundingLabel, - final org.drip.state.identifier.FXLabel fxLabel) - { - if (null == fundingLabel || null == fxLabel) return null; - - java.lang.String strCode = fundingLabel.fullyQualifiedName() + "@#" + fxLabel.fullyQualifiedName(); - - return _mapFundingFXCorrelation.containsKey (strCode) ? _mapFundingFXCorrelation.get - (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Funding and the FX Latent States - * - * @param fundingLabel The Funding Latent State Label - * @param fxLabel The FX Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setFundingFXCorrelation ( - final org.drip.state.identifier.FundingLabel fundingLabel, - final org.drip.state.identifier.FXLabel fxLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == fundingLabel || null == fxLabel || null == auCorrelation) return false; - - _mapFundingFXCorrelation.put (fundingLabel.fullyQualifiedName() + "@#" + - fxLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Funding and the Govvie Latent States - * - * @param fundingLabel The Funding Latent State Label - * @param govvieLabel The Govvie Latent State Label - * - * @return The Correlation Surface between the Funding and the Govvie Latent States - */ - - public org.drip.function.definition.R1ToR1 fundingGovvieCorrelation ( - final org.drip.state.identifier.FundingLabel fundingLabel, - final org.drip.state.identifier.GovvieLabel govvieLabel) - { - if (null == fundingLabel || null == govvieLabel) return null; - - java.lang.String strCode = fundingLabel.fullyQualifiedName() + "@#" + - govvieLabel.fullyQualifiedName(); - - return _mapFundingGovvieCorrelation.containsKey (strCode) ? - _mapFundingGovvieCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Funding and the Govvie Latent States - * - * @param fundingLabel The Funding Latent State Label - * @param govvieLabel The Govvie Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setFundingGovvieCorrelation ( - final org.drip.state.identifier.FundingLabel fundingLabel, - final org.drip.state.identifier.GovvieLabel govvieLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == fundingLabel || null == govvieLabel || null == auCorrelation) return false; - - _mapFundingGovvieCorrelation.put (fundingLabel.fullyQualifiedName() + "@#" + - govvieLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Funding and the Overnight Latent States - * - * @param fundingLabel The Funding Latent State Label - * @param overnightLabel The Overnight Latent State Label - * - * @return The Correlation Surface between the Funding and the Overnight Latent States - */ - - public org.drip.function.definition.R1ToR1 fundingOvernightCorrelation ( - final org.drip.state.identifier.FundingLabel fundingLabel, - final org.drip.state.identifier.OvernightLabel overnightLabel) - { - if (null == fundingLabel || null == overnightLabel) return null; - - java.lang.String strCode = fundingLabel.fullyQualifiedName() + "@#" + - overnightLabel.fullyQualifiedName(); - - return _mapFundingOvernightCorrelation.containsKey (strCode) ? - _mapFundingOvernightCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Funding and the Overnight Latent States - * - * @param fundingLabel The Funding Latent State Label - * @param overnightLabel The Overnight Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setFundingOvernightCorrelation ( - final org.drip.state.identifier.FundingLabel fundingLabel, - final org.drip.state.identifier.OvernightLabel overnightLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == fundingLabel || null == overnightLabel || null == auCorrelation) return false; - - _mapFundingOvernightCorrelation.put (fundingLabel.fullyQualifiedName() + "@#" + - overnightLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Funding and the Pay-down Latent States - * - * @param fundingLabel The Funding Latent State Label - * @param paydownLabel The Pay-down Latent State Label - * - * @return The Correlation Surface between the Funding and the Pay-down Latent States - */ - - public org.drip.function.definition.R1ToR1 fundingPaydownCorrelation ( - final org.drip.state.identifier.FundingLabel fundingLabel, - final org.drip.state.identifier.PaydownLabel paydownLabel) - { - if (null == fundingLabel || null == paydownLabel) return null; - - java.lang.String strCode = fundingLabel.fullyQualifiedName() + "@#" + - paydownLabel.fullyQualifiedName(); - - return _mapFundingPaydownCorrelation.containsKey (strCode) ? - _mapFundingPaydownCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Funding and the Pay-down Latent States - * - * @param fundingLabel The Funding Latent State Label - * @param paydownLabel The Pay-down Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setFundingPaydownCorrelation ( - final org.drip.state.identifier.FundingLabel fundingLabel, - final org.drip.state.identifier.PaydownLabel paydownLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == fundingLabel || null == paydownLabel || null == auCorrelation) return false; - - _mapFundingPaydownCorrelation.put (fundingLabel.fullyQualifiedName() + "@#" + - paydownLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Funding and the Rating Latent States - * - * @param fundingLabel The Funding Latent State Label - * @param ratingLabel The Rating Latent State Label - * - * @return The Correlation Surface between the Funding and the Rating Latent States - */ - - public org.drip.function.definition.R1ToR1 fundingRatingCorrelation ( - final org.drip.state.identifier.FundingLabel fundingLabel, - final org.drip.state.identifier.RatingLabel ratingLabel) - { - if (null == fundingLabel || null == ratingLabel) return null; - - java.lang.String strCode = fundingLabel.fullyQualifiedName() + "@#" + - ratingLabel.fullyQualifiedName(); - - return _mapFundingRatingCorrelation.containsKey (strCode) ? - _mapFundingRatingCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Funding and the Rating Latent States - * - * @param fundingLabel The Funding Latent State Label - * @param ratingLabel The Rating Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setFundingRecoveryCorrelation ( - final org.drip.state.identifier.FundingLabel fundingLabel, - final org.drip.state.identifier.RatingLabel ratingLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == fundingLabel || null == ratingLabel || null == auCorrelation) return false; - - _mapFundingRatingCorrelation.put (fundingLabel.fullyQualifiedName() + "@#" + - ratingLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Funding and the Recovery Latent States - * - * @param fundingLabel The Funding Latent State Label - * @param recoveryLabel The Recovery Latent State Label - * - * @return The Correlation Surface between the Funding and the Recovery Latent States - */ - - public org.drip.function.definition.R1ToR1 fundingRecoveryCorrelation ( - final org.drip.state.identifier.FundingLabel fundingLabel, - final org.drip.state.identifier.RecoveryLabel recoveryLabel) - { - if (null == fundingLabel || null == recoveryLabel) return null; - - java.lang.String strCode = fundingLabel.fullyQualifiedName() + "@#" + - recoveryLabel.fullyQualifiedName(); - - return _mapFundingRecoveryCorrelation.containsKey (strCode) ? - _mapFundingRecoveryCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Funding and the Recovery Latent States - * - * @param fundingLabel The Funding Latent State Label - * @param recoveryLabel The Recovery Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setFundingRecoveryCorrelation ( - final org.drip.state.identifier.FundingLabel fundingLabel, - final org.drip.state.identifier.RecoveryLabel recoveryLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == fundingLabel || null == recoveryLabel || null == auCorrelation) return false; - - _mapFundingRecoveryCorrelation.put (fundingLabel.fullyQualifiedName() + "@#" + - recoveryLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface between the Funding and the Repo Latent States - * - * @param fundingLabel The Funding Latent State Label - * @param repoLabel The Repo Latent State Label - * - * @return The Correlation Surface between the Funding and the Repo Latent States - */ - - public org.drip.function.definition.R1ToR1 fundingRepoCorrelation ( - final org.drip.state.identifier.FundingLabel fundingLabel, - final org.drip.state.identifier.RepoLabel repoLabel) - { - if (null == fundingLabel || null == repoLabel) return null; - - java.lang.String strCode = fundingLabel.fullyQualifiedName() + "@#" + repoLabel.fullyQualifiedName(); - - return _mapFundingRepoCorrelation.containsKey (strCode) ? - _mapFundingRepoCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface between the Funding and the Repo Latent States - * - * @param fundingLabel The Funding Latent State Label - * @param repoLabel The Repo Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setFundingRepoCorrelation ( - final org.drip.state.identifier.FundingLabel fundingLabel, - final org.drip.state.identifier.RepoLabel repoLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == fundingLabel || null == repoLabel || null == auCorrelation) return false; - - _mapFundingRepoCorrelation.put (fundingLabel.fullyQualifiedName() + "@#" + - repoLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified FX and the Govvie Latent States - * - * @param fxLabel The FX Latent State Label - * @param govvieLabel The Govvie Latent State Label - * - * @return The Correlation Surface for the specified FX and the Govvie Latent States - */ - - public org.drip.function.definition.R1ToR1 fxGovvieCorrelation ( - final org.drip.state.identifier.FXLabel fxLabel, - final org.drip.state.identifier.GovvieLabel govvieLabel) - { - if (null == fxLabel || null == govvieLabel) return null; - - java.lang.String strCode = fxLabel.fullyQualifiedName() + "@#" + govvieLabel.fullyQualifiedName(); - - return _mapFXGovvieCorrelation.containsKey (strCode) ? _mapFXGovvieCorrelation.get - (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified FX and the Govvie Latent States - * - * @param fxLabel The FX Latent State Label - * @param govvieLabel The Govvie Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setFXGovvieCorrelation ( - final org.drip.state.identifier.FXLabel fxLabel, - final org.drip.state.identifier.GovvieLabel govvieLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == fxLabel || null == govvieLabel || null == auCorrelation) return false; - - _mapFXGovvieCorrelation.put (fxLabel.fullyQualifiedName() + "@#" + - govvieLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified FX and the Overnight Latent States - * - * @param fxLabel The FX Latent State Label - * @param overnightLabel The Overnight Latent State Label - * - * @return The Correlation Surface for the specified FX and the Overnight Latent States - */ - - public org.drip.function.definition.R1ToR1 fxOvernightCorrelation ( - final org.drip.state.identifier.FXLabel fxLabel, - final org.drip.state.identifier.OvernightLabel overnightLabel) - { - if (null == fxLabel || null == overnightLabel) return null; - - java.lang.String strCode = fxLabel.fullyQualifiedName() + "@#" + overnightLabel.fullyQualifiedName(); - - return _mapFXOvernightCorrelation.containsKey (strCode) ? - _mapFXOvernightCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified FX and the Overnight Latent States - * - * @param fxLabel The FX Latent State Label - * @param overnightLabel The Overnight Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setFXOvernightCorrelation ( - final org.drip.state.identifier.FXLabel fxLabel, - final org.drip.state.identifier.OvernightLabel overnightLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == fxLabel || null == overnightLabel || null == auCorrelation) return false; - - _mapFXOvernightCorrelation.put (fxLabel.fullyQualifiedName() + "@#" + - overnightLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified FX and the Pay-down Latent States - * - * @param fxLabel The FX Latent State Label - * @param paydownLabel The Pay-down Latent State Label - * - * @return The Correlation Surface for the specified FX and the Pay-down Latent States - */ - - public org.drip.function.definition.R1ToR1 fxPaydownCorrelation ( - final org.drip.state.identifier.FXLabel fxLabel, - final org.drip.state.identifier.PaydownLabel paydownLabel) - { - if (null == fxLabel || null == paydownLabel) return null; - - java.lang.String strCode = fxLabel.fullyQualifiedName() + "@#" + paydownLabel.fullyQualifiedName(); - - return _mapFXPaydownCorrelation.containsKey (strCode) ? _mapFXPaydownCorrelation.get - (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified FX and the Pay-down Latent States - * - * @param fxLabel The FX Latent State Label - * @param paydownLabel The Pay-down Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setFXPaydownCorrelation ( - final org.drip.state.identifier.FXLabel fxLabel, - final org.drip.state.identifier.PaydownLabel paydownLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == fxLabel || null == paydownLabel || null == auCorrelation) return false; - - _mapFXPaydownCorrelation.put (fxLabel.fullyQualifiedName() + "@#" + - paydownLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified FX and the Rating Latent States - * - * @param fxLabel The FX Latent State Label - * @param ratingLabel The Rating Latent State Label - * - * @return The Correlation Surface for the specified FX and the Rating Latent States - */ - - public org.drip.function.definition.R1ToR1 fxRatingCorrelation ( - final org.drip.state.identifier.FXLabel fxLabel, - final org.drip.state.identifier.RatingLabel ratingLabel) - { - if (null == fxLabel || null == ratingLabel) return null; - - java.lang.String strCode = fxLabel.fullyQualifiedName() + "@#" + ratingLabel.fullyQualifiedName(); - - return _mapFXRatingCorrelation.containsKey (strCode) ? _mapFXRatingCorrelation.get - (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified FX and the Rating Latent States - * - * @param fxLabel The FX Latent State Label - * @param ratingLabel The Rating Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setFXRatingCorrelation ( - final org.drip.state.identifier.FXLabel fxLabel, - final org.drip.state.identifier.RatingLabel ratingLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == fxLabel || null == ratingLabel || null == auCorrelation) return false; - - _mapFXRatingCorrelation.put (fxLabel.fullyQualifiedName() + "@#" + - ratingLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified FX and the Recovery Latent States - * - * @param fxLabel The FX Latent State Label - * @param recoveryLabel The Recovery Latent State Label - * - * @return The Correlation Surface for the specified FX and the Recovery Latent States - */ - - public org.drip.function.definition.R1ToR1 fxRecoveryCorrelation ( - final org.drip.state.identifier.FXLabel fxLabel, - final org.drip.state.identifier.RecoveryLabel recoveryLabel) - { - if (null == fxLabel || null == recoveryLabel) return null; - - java.lang.String strCode = fxLabel.fullyQualifiedName() + "@#" + recoveryLabel.fullyQualifiedName(); - - return _mapFXRecoveryCorrelation.containsKey (strCode) ? _mapFXRecoveryCorrelation.get - (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified FX and the Recovery Latent States - * - * @param fxLabel The FX Latent State Label - * @param recoveryLabel The Recovery Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setFXRecoveryCorrelation ( - final org.drip.state.identifier.FXLabel fxLabel, - final org.drip.state.identifier.RecoveryLabel recoveryLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == fxLabel || null == recoveryLabel || null == auCorrelation) return false; - - _mapFXRecoveryCorrelation.put (fxLabel.fullyQualifiedName() + "@#" + - recoveryLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified FX and the Repo Latent States - * - * @param fxLabel The FX Latent State Label - * @param repoLabel The Repo Latent State Label - * - * @return The Correlation Surface for the specified FX and the Repo Latent States - */ - - public org.drip.function.definition.R1ToR1 fxRepoCorrelation ( - final org.drip.state.identifier.FXLabel fxLabel, - final org.drip.state.identifier.RepoLabel repoLabel) - { - if (null == fxLabel || null == repoLabel) return null; - - java.lang.String strCode = fxLabel.fullyQualifiedName() + "@#" + repoLabel.fullyQualifiedName(); - - return _mapFXRepoCorrelation.containsKey (strCode) ? _mapFXRepoCorrelation.get - (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified FX and the Repo Latent States - * - * @param fxLabel The FX Latent State Label - * @param repoLabel The Repo Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setFXRepoCorrelation ( - final org.drip.state.identifier.FXLabel fxLabel, - final org.drip.state.identifier.RepoLabel repoLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == fxLabel || null == repoLabel || null == auCorrelation) return false; - - _mapFXRepoCorrelation.put (fxLabel.fullyQualifiedName() + "@#" + - repoLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * (Re)-set the Correlation Surface for the specified Govvie and the Overnight Latent States - * - * @param govvieLabel The Govvie Latent State Label - * @param overnightLabel The Overnight Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setGovvieOvernightCorrelation ( - final org.drip.state.identifier.GovvieLabel govvieLabel, - final org.drip.state.identifier.OvernightLabel overnightLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == govvieLabel || null == overnightLabel || null == auCorrelation) return false; - - _mapGovvieOvernightCorrelation.put (govvieLabel.fullyQualifiedName() + "@#" + - overnightLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Govvie and the Overnight Latent States - * - * @param govvieLabel The Govvie Latent State Label - * @param overnightLabel The Overnight Latent State Label - * - * @return The Correlation Surface for the specified Govvie and the Overnight Latent States - */ - - public org.drip.function.definition.R1ToR1 govvieOvernightCorrelation ( - final org.drip.state.identifier.GovvieLabel govvieLabel, - final org.drip.state.identifier.OvernightLabel overnightLabel) - { - if (null == govvieLabel || null == overnightLabel) return null; - - java.lang.String strCode = govvieLabel.fullyQualifiedName() + "@#" + - overnightLabel.fullyQualifiedName(); - - return _mapGovvieOvernightCorrelation.containsKey (strCode) ? - _mapGovvieOvernightCorrelation.get (strCode) : null; - } - - /** - * Retrieve the Correlation Surface for the specified Govvie and the Pay-down Latent States - * - * @param govvieLabel The Govvie Latent State Label - * @param paydownLabel The Pay-down Latent State Label - * - * @return The Correlation Surface for the specified Govvie and the Pay-down Latent States - */ - - public org.drip.function.definition.R1ToR1 govviePaydownCorrelation ( - final org.drip.state.identifier.GovvieLabel govvieLabel, - final org.drip.state.identifier.PaydownLabel paydownLabel) - { - if (null == govvieLabel || null == paydownLabel) return null; - - java.lang.String strCode = govvieLabel.fullyQualifiedName() + "@#" + - paydownLabel.fullyQualifiedName(); - - return _mapGovviePaydownCorrelation.containsKey (strCode) ? - _mapGovviePaydownCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified Govvie and the Pay-down Latent States - * - * @param govvieLabel The Govvie Latent State Label - * @param paydownLabel The Pay-down Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setGovviePaydownCorrelation ( - final org.drip.state.identifier.GovvieLabel govvieLabel, - final org.drip.state.identifier.PaydownLabel paydownLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == govvieLabel || null == paydownLabel || null == auCorrelation) return false; - - _mapGovviePaydownCorrelation.put (govvieLabel.fullyQualifiedName() + "@#" + - paydownLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Govvie and the Rating Latent States - * - * @param govvieLabel The Govvie Latent State Label - * @param ratingLabel The Rating Latent State Label - * - * @return The Correlation Surface for the specified Govvie and the Rating Latent States - */ - - public org.drip.function.definition.R1ToR1 govvieRecoveryCorrelation ( - final org.drip.state.identifier.GovvieLabel govvieLabel, - final org.drip.state.identifier.RatingLabel ratingLabel) - { - if (null == govvieLabel || null == ratingLabel) return null; - - java.lang.String strCode = govvieLabel.fullyQualifiedName() + "@#" + - ratingLabel.fullyQualifiedName(); - - return _mapGovvieRecoveryCorrelation.containsKey (strCode) ? - _mapGovvieRecoveryCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified Govvie and the Rating Latent States - * - * @param govvieLabel The Govvie Latent State Label - * @param ratingLabel The Rating Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setGovvieRatingCorrelation ( - final org.drip.state.identifier.GovvieLabel govvieLabel, - final org.drip.state.identifier.RatingLabel ratingLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == govvieLabel || null == ratingLabel || null == auCorrelation) return false; - - _mapGovvieRatingCorrelation.put (govvieLabel.fullyQualifiedName() + "@#" + - ratingLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Govvie and the Recovery Latent States - * - * @param govvieLabel The Govvie Latent State Label - * @param recoveryLabel The Recovery Latent State Label - * - * @return The Correlation Surface for the specified Govvie and the Recovery Latent States - */ - - public org.drip.function.definition.R1ToR1 govvieRecoveryCorrelation ( - final org.drip.state.identifier.GovvieLabel govvieLabel, - final org.drip.state.identifier.RecoveryLabel recoveryLabel) - { - if (null == govvieLabel || null == recoveryLabel) return null; - - java.lang.String strCode = govvieLabel.fullyQualifiedName() + "@#" + - recoveryLabel.fullyQualifiedName(); - - return _mapGovvieRecoveryCorrelation.containsKey (strCode) ? - _mapGovvieRecoveryCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified Govvie and the Recovery Latent States - * - * @param govvieLabel The Govvie Latent State Label - * @param recoveryLabel The Recovery Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setGovvieRecoveryCorrelation ( - final org.drip.state.identifier.GovvieLabel govvieLabel, - final org.drip.state.identifier.RecoveryLabel recoveryLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == govvieLabel || null == recoveryLabel || null == auCorrelation) return false; - - _mapGovvieRecoveryCorrelation.put (govvieLabel.fullyQualifiedName() + "@#" + - recoveryLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Govvie and the Repo Latent States - * - * @param govvieLabel The Govvie Latent State Label - * @param repoLabel The Repo Latent State Label - * - * @return The Correlation Surface for the specified Govvie and the Repo Latent States - */ - - public org.drip.function.definition.R1ToR1 govvieRepoCorrelation ( - final org.drip.state.identifier.GovvieLabel govvieLabel, - final org.drip.state.identifier.RepoLabel repoLabel) - { - if (null == govvieLabel || null == repoLabel) return null; - - java.lang.String strCode = govvieLabel.fullyQualifiedName() + "@#" + repoLabel.fullyQualifiedName(); - - return _mapGovvieRepoCorrelation.containsKey (strCode) ? _mapGovvieRepoCorrelation.get - (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified Govvie and the Repo Latent States - * - * @param govvieLabel The Govvie Latent State Label - * @param repoLabel The Repo Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setGovvieRepoCorrelation ( - final org.drip.state.identifier.GovvieLabel govvieLabel, - final org.drip.state.identifier.RepoLabel repoLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == govvieLabel || null == repoLabel || null == auCorrelation) return false; - - _mapGovvieRepoCorrelation.put (govvieLabel.fullyQualifiedName() + "@#" + - repoLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Overnight and the Pay-down Latent States - * - * @param overnightLabel The Overnight Latent State Label - * @param paydownLabel The Pay-down Latent State Label - * - * @return The Correlation Surface for the specified Overnight and the Pay-down Latent States - */ - - public org.drip.function.definition.R1ToR1 overnightPaydownCorrelation ( - final org.drip.state.identifier.OvernightLabel overnightLabel, - final org.drip.state.identifier.PaydownLabel paydownLabel) - { - if (null == overnightLabel || null == paydownLabel) return null; - - java.lang.String strCode = overnightLabel.fullyQualifiedName() + "@#" + - paydownLabel.fullyQualifiedName(); - - return _mapOvernightPaydownCorrelation.containsKey (strCode) ? - _mapOvernightPaydownCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified Overnight and the Pay-down Latent States - * - * @param overnightLabel The Overnight Latent State Label - * @param paydownLabel The Pay-down Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setOvernightPaydownCorrelation ( - final org.drip.state.identifier.OvernightLabel overnightLabel, - final org.drip.state.identifier.PaydownLabel paydownLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == overnightLabel || null == paydownLabel || null == auCorrelation) return false; - - _mapOvernightPaydownCorrelation.put (overnightLabel.fullyQualifiedName() + "@#" + - paydownLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Overnight and the Rating Latent States - * - * @param overnightLabel The Overnight Latent State Label - * @param ratingLabel The Rating Latent State Label - * - * @return The Correlation Surface for the specified Overnight and the Rating Latent States - */ - - public org.drip.function.definition.R1ToR1 overnightRatingCorrelation ( - final org.drip.state.identifier.OvernightLabel overnightLabel, - final org.drip.state.identifier.RatingLabel ratingLabel) - { - if (null == overnightLabel || null == ratingLabel) return null; - - java.lang.String strCode = overnightLabel.fullyQualifiedName() + "@#" + - ratingLabel.fullyQualifiedName(); - - return _mapOvernightRatingCorrelation.containsKey (strCode) ? - _mapOvernightRatingCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified Overnight and the Rating Latent States - * - * @param overnightLabel The Overnight Latent State Label - * @param ratingLabel The Rating Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setOvernightRatingCorrelation ( - final org.drip.state.identifier.OvernightLabel overnightLabel, - final org.drip.state.identifier.RatingLabel ratingLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == overnightLabel || null == ratingLabel || null == auCorrelation) return false; - - _mapOvernightRatingCorrelation.put (overnightLabel.fullyQualifiedName() + "@#" + - ratingLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Overnight and the Recovery Latent States - * - * @param overnightLabel The Overnight Latent State Label - * @param recoveryLabel The Recovery Latent State Label - * - * @return The Correlation Surface for the specified Overnight and the Recovery Latent States - */ - - public org.drip.function.definition.R1ToR1 overnightRecoveryCorrelation ( - final org.drip.state.identifier.OvernightLabel overnightLabel, - final org.drip.state.identifier.RecoveryLabel recoveryLabel) - { - if (null == overnightLabel || null == recoveryLabel) return null; - - java.lang.String strCode = overnightLabel.fullyQualifiedName() + "@#" + - recoveryLabel.fullyQualifiedName(); - - return _mapOvernightRecoveryCorrelation.containsKey (strCode) ? - _mapOvernightRecoveryCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified Overnight and the Recovery Latent States - * - * @param overnightLabel The Overnight Latent State Label - * @param recoveryLabel The Recovery Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setOvernightRecoveryCorrelation ( - final org.drip.state.identifier.OvernightLabel overnightLabel, - final org.drip.state.identifier.RecoveryLabel recoveryLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == overnightLabel || null == recoveryLabel || null == auCorrelation) return false; - - _mapOvernightRecoveryCorrelation.put (overnightLabel.fullyQualifiedName() + "@#" + - recoveryLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Overnight and the Repo Latent States - * - * @param overnightLabel The Overnight Latent State Label - * @param repoLabel The Repo Latent State Label - * - * @return The Correlation Surface for the specified Overnight and the Repo Latent States - */ - - public org.drip.function.definition.R1ToR1 overnightRepoCorrelation ( - final org.drip.state.identifier.OvernightLabel overnightLabel, - final org.drip.state.identifier.RepoLabel repoLabel) - { - if (null == overnightLabel || null == repoLabel) return null; - - java.lang.String strCode = overnightLabel.fullyQualifiedName() + "@#" + - repoLabel.fullyQualifiedName(); - - return _mapOvernightRepoCorrelation.containsKey (strCode) ? - _mapOvernightRepoCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified Overnight and the Repo Latent States - * - * @param overnightLabel The Overnight Latent State Label - * @param repoLabel The Repo Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setOvernightRepoCorrelation ( - final org.drip.state.identifier.OvernightLabel overnightLabel, - final org.drip.state.identifier.RepoLabel repoLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == overnightLabel || null == repoLabel || null == auCorrelation) return false; - - _mapOvernightRepoCorrelation.put (overnightLabel.fullyQualifiedName() + "@#" + - repoLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Pay-down and the Rating Latent States - * - * @param paydownLabel The Pay-down Latent State Label - * @param ratingLabel The Rating Latent State Label - * - * @return The Correlation Surface for the specified Pay-down and the Rating Latent States - */ - - public org.drip.function.definition.R1ToR1 paydownRatingCorrelation ( - final org.drip.state.identifier.PaydownLabel paydownLabel, - final org.drip.state.identifier.RatingLabel ratingLabel) - { - if (null == paydownLabel || null == ratingLabel) return null; - - java.lang.String strCode = paydownLabel.fullyQualifiedName() + "@#" + - ratingLabel.fullyQualifiedName(); - - return _mapPaydownRatingCorrelation.containsKey (strCode) ? - _mapPaydownRatingCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified Pay-down and the Rating Latent States - * - * @param paydownLabel The Pay-down Latent State Label - * @param ratingLabel The Rating Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setPaydownRatingCorrelation ( - final org.drip.state.identifier.PaydownLabel paydownLabel, - final org.drip.state.identifier.RatingLabel ratingLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == paydownLabel || null == ratingLabel || null == auCorrelation) return false; - - _mapPaydownRatingCorrelation.put (paydownLabel.fullyQualifiedName() + "@#" + - ratingLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Pay-down and the Recovery Latent States - * - * @param paydownLabel The Pay-down Latent State Label - * @param recoveryLabel The Recovery Latent State Label - * - * @return The Correlation Surface for the specified Pay-down and the Recovery Latent States - */ - - public org.drip.function.definition.R1ToR1 paydownRecoveryCorrelation ( - final org.drip.state.identifier.PaydownLabel paydownLabel, - final org.drip.state.identifier.RecoveryLabel recoveryLabel) - { - if (null == paydownLabel || null == recoveryLabel) return null; - - java.lang.String strCode = paydownLabel.fullyQualifiedName() + "@#" + - recoveryLabel.fullyQualifiedName(); - - return _mapPaydownRecoveryCorrelation.containsKey (strCode) ? - _mapPaydownRecoveryCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified Pay-down and the Recovery Latent States - * - * @param paydownLabel The Pay-down Latent State Label - * @param recoveryLabel The Recovery Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setPaydownRecoveryCorrelation ( - final org.drip.state.identifier.PaydownLabel paydownLabel, - final org.drip.state.identifier.RecoveryLabel recoveryLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == paydownLabel || null == recoveryLabel || null == auCorrelation) return false; - - _mapPaydownRecoveryCorrelation.put (paydownLabel.fullyQualifiedName() + "@#" + - recoveryLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Pay-down and the Repo Latent States - * - * @param paydownLabel The Pay-down Latent State Label - * @param repoLabel The Repo Latent State Label - * - * @return The Correlation Surface for the specified Pay-down and the Repo Latent States - */ - - public org.drip.function.definition.R1ToR1 paydownRepoCorrelation ( - final org.drip.state.identifier.PaydownLabel paydownLabel, - final org.drip.state.identifier.RepoLabel repoLabel) - { - if (null == paydownLabel || null == repoLabel) return null; - - java.lang.String strCode = paydownLabel.fullyQualifiedName() + "@#" + repoLabel.fullyQualifiedName(); - - return _mapPaydownRepoCorrelation.containsKey (strCode) ? - _mapPaydownRepoCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified Pay-down and the Repo Latent States - * - * @param paydownLabel The Pay-down Latent State Label - * @param repoLabel The Repo Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setPaydownRepoCorrelation ( - final org.drip.state.identifier.PaydownLabel paydownLabel, - final org.drip.state.identifier.RepoLabel repoLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == paydownLabel || null == repoLabel || null == auCorrelation) return false; - - _mapPaydownRepoCorrelation.put (paydownLabel.fullyQualifiedName() + "@#" + - repoLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Rating and the Rating Latent States - * - * @param ratingLabel1 The Rating Latent State Label #1 - * @param ratingLabel2 The Rating Latent State Label #2 - * - * @return The Correlation Surface for the specified Pair of Rating Latent States - */ - - public org.drip.function.definition.R1ToR1 ratingRatingCorrelation ( - final org.drip.state.identifier.RatingLabel ratingLabel1, - final org.drip.state.identifier.RatingLabel ratingLabel2) - { - if (null == ratingLabel1 || null == ratingLabel2) return null; - - java.lang.String strCode = ratingLabel1.fullyQualifiedName() + "@#" + - ratingLabel2.fullyQualifiedName(); - - return _mapRatingRatingCorrelation.containsKey (strCode) ? - _mapRatingRatingCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified Pair of Rating Latent States - * - * @param ratingLabel1 The Rating Latent State Label #1 - * @param ratingLabel2 The Rating Latent State Label #2 - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setRatingRatingCorrelation ( - final org.drip.state.identifier.RatingLabel ratingLabel1, - final org.drip.state.identifier.RatingLabel ratingLabel2, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == ratingLabel1 || null == ratingLabel2 || null == auCorrelation) return false; - - _mapRatingRatingCorrelation.put (ratingLabel1.fullyQualifiedName() + "@#" + - ratingLabel2.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Rating and Recovery Latent States - * - * @param ratingLabel The Rating Latent State Label - * @param recoveryLabel The Recovery Latent State Label - * - * @return The Correlation Surface for the specified Rating and Recovery Latent States - */ - - public org.drip.function.definition.R1ToR1 ratingRecoveryCorrelation ( - final org.drip.state.identifier.RatingLabel ratingLabel, - final org.drip.state.identifier.RecoveryLabel recoveryLabel) - { - if (null == ratingLabel || null == recoveryLabel) return null; - - java.lang.String strCode = ratingLabel.fullyQualifiedName() + "@#" + - recoveryLabel.fullyQualifiedName(); - - return _mapRatingRecoveryCorrelation.containsKey (strCode) ? - _mapRatingRecoveryCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified Rating and Recovery Latent States - * - * @param ratingLabel The Rating Latent State Label - * @param recoveryLabel The Recovery Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setRatingRecoveryCorrelation ( - final org.drip.state.identifier.RatingLabel ratingLabel, - final org.drip.state.identifier.RecoveryLabel recoveryLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == ratingLabel || null == recoveryLabel || null == auCorrelation) return false; - - _mapRatingRecoveryCorrelation.put (ratingLabel.fullyQualifiedName() + "@#" + - recoveryLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Rating and Repo Latent States - * - * @param ratingLabel The Rating Latent State Label - * @param repoLabel The Repo Latent State Label - * - * @return The Correlation Surface for the specified Rating and Repo Latent States - */ - - public org.drip.function.definition.R1ToR1 ratingRepoCorrelation ( - final org.drip.state.identifier.RatingLabel ratingLabel, - final org.drip.state.identifier.RepoLabel repoLabel) - { - if (null == ratingLabel || null == repoLabel) return null; - - java.lang.String strCode = ratingLabel.fullyQualifiedName() + "@#" + repoLabel.fullyQualifiedName(); - - return _mapRatingRepoCorrelation.containsKey (strCode) ? _mapRatingRepoCorrelation.get - (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified Rating and Repo Latent States - * - * @param ratingLabel The Rating Latent State Label - * @param repoLabel The Repo Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setRatingRepoCorrelation ( - final org.drip.state.identifier.RatingLabel ratingLabel, - final org.drip.state.identifier.RepoLabel repoLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == ratingLabel || null == repoLabel || null == auCorrelation) return false; - - _mapRatingRepoCorrelation.put (ratingLabel.fullyQualifiedName() + "@#" + - repoLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Correlation Surface for the specified Recovery and the Repo Latent States - * - * @param recoveryLabel The Recovery Latent State Label - * @param repoLabel The Repo Latent State Label - * - * @return The Correlation Surface for the specified Recovery and the Repo Latent States - */ - - public org.drip.function.definition.R1ToR1 recoveryRepoCorrelation ( - final org.drip.state.identifier.RecoveryLabel recoveryLabel, - final org.drip.state.identifier.RepoLabel repoLabel) - { - if (null == recoveryLabel || null == repoLabel) return null; - - java.lang.String strCode = recoveryLabel.fullyQualifiedName() + "@#" + - repoLabel.fullyQualifiedName(); - - return _mapRecoveryRepoCorrelation.containsKey (strCode) ? - _mapRecoveryRepoCorrelation.get (strCode) : null; - } - - /** - * (Re)-set the Correlation Surface for the specified Recovery and the Repo Latent States - * - * @param recoveryLabel The Recovery Latent State Label - * @param repoLabel The Repo Latent State Label - * @param auCorrelation The Correlation Surface - * - * @return TRUE - Successfully set - */ - - public boolean setRecoveryRepoCorrelation ( - final org.drip.state.identifier.RecoveryLabel recoveryLabel, - final org.drip.state.identifier.RepoLabel repoLabel, - final org.drip.function.definition.R1ToR1 auCorrelation) - { - if (null == recoveryLabel || null == repoLabel || null == auCorrelation) return false; - - _mapRecoveryRepoCorrelation.put (recoveryLabel.fullyQualifiedName() + "@#" + - repoLabel.fullyQualifiedName(), auCorrelation); - - return true; - } - - /** - * Retrieve the Product Quote - * - * @param strProductCode Product Code - * - * @return Product Quote - */ - - public org.drip.param.definition.ProductQuote productQuote ( - final java.lang.String strProductCode) - { - if (null == strProductCode || strProductCode.isEmpty() || !_mapProductQuote.containsKey - (strProductCode)) - return null; - - return _mapProductQuote.get (strProductCode); - } - - /** - * (Re)-set the Product Quote - * - * @param strProductCode Product Code - * @param pq Product Quote - * - * @return TRUE - Successfully set - */ - - public boolean setProductQuote ( - final java.lang.String strProductCode, - final org.drip.param.definition.ProductQuote pq) - { - if (null == strProductCode || strProductCode.isEmpty() || null == pq) return false; - - _mapProductQuote.put (strProductCode, pq); - - return true; - } - - /** - * Retrieve the Full Set of Quotes - * - * @return The Full Set of Quotes - */ - - public - org.drip.analytics.support.CaseInsensitiveTreeMap - quoteMap() - { - return _mapProductQuote; - } - - /** - * (Re)-set the Map of Quote - * - * @param mapQuote Map of Quotes - * - * @return TRUE - Successfully set - */ - - public boolean setQuoteMap ( - final org.drip.analytics.support.CaseInsensitiveTreeMap - mapQuote) - { - if (null == mapQuote || 0 == mapQuote.size()) return false; - - for (java.util.Map.Entry meCQ : - mapQuote.entrySet()) { - if (null == meCQ) continue; - - java.lang.String strKey = meCQ.getKey(); - - org.drip.param.definition.ProductQuote cq = meCQ.getValue(); - - if (null == strKey || strKey.isEmpty() || null == cq) continue; - - _mapProductQuote.put (strKey, cq); - } - - return true; - } - - /** - * Set the Fixing corresponding to the Date/Label Pair - * - * @param dt The Fixing Date - * @param lsl The Fixing Label - * @param dblFixing The Fixing Amount - * - * @return TRUE - Entry successfully added - */ - - public boolean setFixing ( - final org.drip.analytics.date.JulianDate dt, - final org.drip.state.identifier.LatentStateLabel lsl, - final double dblFixing) - { - return _lsfc.add (dt, lsl, dblFixing); - } - - /** - * Set the Fixing corresponding to the Date/Label Pair - * - * @param iDate The Fixing Date - * @param lsl The Fixing Label - * @param dblFixing The Fixing Amount - * - * @return TRUE - Entry successfully added - */ - - public boolean setFixing ( - final int iDate, - final org.drip.state.identifier.LatentStateLabel lsl, - final double dblFixing) - { - return _lsfc.add (iDate, lsl, dblFixing); - } - - /** - * Remove the Fixing corresponding to the Date/Label Pair it if exists - * - * @param dt The Fixing Date - * @param lsl The Fixing Label - * - * @return TRUE - Entry successfully removed if it existed - */ - - public boolean removeFixing ( - final org.drip.analytics.date.JulianDate dt, - final org.drip.state.identifier.LatentStateLabel lsl) - { - return _lsfc.remove (dt, lsl); - } - - /** - * Remove the Fixing corresponding to the Date/Label Pair it if exists - * - * @param iDate The Fixing Date - * @param lsl The Fixing Label - * - * @return TRUE - Entry successfully removed if it existed - */ - - public boolean removeFixing ( - final int iDate, - final org.drip.state.identifier.LatentStateLabel lsl) - { - return _lsfc.remove (iDate, lsl); - } - - /** - * Retrieve the Fixing for the Specified Date/LSL Combination - * - * @param dt Date - * @param lsl The Latent State Label - * - * @return The Fixing for the Specified Date/LSL Combination - * - * @throws java.lang.Exception Thrown if the Fixing cannot be found - */ - - public double fixing ( - final org.drip.analytics.date.JulianDate dt, - final org.drip.state.identifier.LatentStateLabel lsl) - throws java.lang.Exception - { - return _lsfc.fixing (dt, lsl); - } - - /** - * Retrieve the Fixing for the Specified Date/LSL Combination - * - * @param iDate Date - * @param lsl The Latent State Label - * - * @return The Fixing for the Specified Date/LSL Combination - * - * @throws java.lang.Exception Thrown if the Fixing cannot be found - */ - - public double fixing ( - final int iDate, - final org.drip.state.identifier.LatentStateLabel lsl) - throws java.lang.Exception - { - return _lsfc.fixing (iDate, lsl); - } - - /** - * Indicates the Availability of the Fixing for the Specified LSL Label on the specified Date - * - * @param dt The Date - * @param lsl The Label - * - * @return TRUE - The Fixing for the Specified LSL Label on the specified Date - */ - - public boolean available ( - final org.drip.analytics.date.JulianDate dt, - final org.drip.state.identifier.LatentStateLabel lsl) - { - return _lsfc.available (dt, lsl); - } - - /** - * Indicates the Availability of the Fixing for the Specified LSL Label on the specified Date - * - * @param iDate The Date - * @param lsl The Label - * - * @return TRUE - The Fixing for the Specified LSL Label on the specified Date - */ - - public boolean available ( - final int iDate, - final org.drip.state.identifier.LatentStateLabel lsl) - { - return _lsfc.available (iDate, lsl); - } - - /** - * Retrieve the Latent State Fixings - * - * @return The Latent State Fixings - */ - - public org.drip.param.market.LatentStateFixingsContainer fixings() - { - return _lsfc; - } - - /** - * Set the Latent State Fixings Container Instance - * - * @param lsfc The Latent State Fixings Container Instance - * - * @return The Latent State Fixings Container Instance successfully set - */ - - public boolean setFixings ( - final org.drip.param.market.LatentStateFixingsContainer lsfc) - { - _lsfc = lsfc; - return true; - } -} diff --git a/org/drip/param/market/CurveSurfaceScenarioContainer.java b/org/drip/param/market/CurveSurfaceScenarioContainer.java deleted file mode 100644 index b0be83b..0000000 --- a/org/drip/param/market/CurveSurfaceScenarioContainer.java +++ /dev/null @@ -1,896 +0,0 @@ - -package org.drip.param.market; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * CurveSurfaceScenarioContainer extends MarketParams abstract class, and is the place holder for the - * comprehensive suite of the market set of curves for the given date. It exports the following - * functionality: - * - add/remove/retrieve scenario discount curve - * - add/remove/retrieve scenario Forward curve - * - add/remove/retrieve scenario zero curve - * - add/remove/retrieve scenario credit curve - * - add/remove/retrieve scenario recovery curve - * - add/remove/retrieve scenario FXForward curve - * - add/remove/retrieve scenario FXBasis curve - * - add/remove/retrieve scenario fixings - * - add/remove/retrieve Treasury/component quotes - * - retrieve scenario Market Parameters - * - retrieve map of flat rates/credit/recovery Market Parameters - * - retrieve double map of tenor rates/credit/recovery Market Parameters - * - retrieve rates/credit scenario generator - * - * @author Lakshmi Krishnamurthy - */ - -public class CurveSurfaceScenarioContainer extends org.drip.param.definition.ScenarioMarketParams { - private static final int BASE = 0; - private static final int BUMP_UP = 1; - private static final int BUMP_DN = 2; - private static final int RR_BUMP_UP = 4; - private static final int RR_BUMP_DN = 8; - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapTSYQuote = null; - - private org.drip.param.market.LatentStateFixingsContainer _lsfc = new - org.drip.param.market.LatentStateFixingsContainer(); - - private - org.drip.analytics.support.CaseInsensitiveTreeMap - _mapScenarioDiscountCurve = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private - org.drip.analytics.support.CaseInsensitiveTreeMap - _mapScenarioCreditCurve = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapQuote = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapScenarioMarketParams = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private org.drip.analytics.support.CaseInsensitiveTreeMap dcSet ( - final int iBumpType) - { - if (null == _mapScenarioDiscountCurve.entrySet()) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapDC = - new org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry - meSDC : _mapScenarioDiscountCurve.entrySet()) { - java.lang.String strKey = meSDC.getKey(); - - org.drip.param.market.DiscountCurveScenarioContainer sdc = meSDC.getValue(); - - if (null == strKey || strKey.isEmpty() || null == sdc) continue; - - if (BASE == iBumpType) - mapDC.put (strKey, sdc.base()); - else if (BUMP_UP == iBumpType) - mapDC.put (strKey, sdc.bumpUp()); - else if (BUMP_DN == iBumpType) - mapDC.put (strKey, sdc.bumpDown()); - } - - return mapDC; - } - - private org.drip.analytics.support.CaseInsensitiveTreeMap - ccSet ( - final int iBumpType) - { - if (null == _mapScenarioCreditCurve.entrySet()) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapCC = - new org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry meSCC - : _mapScenarioCreditCurve.entrySet()) { - java.lang.String strKey = meSCC.getKey(); - - org.drip.param.market.CreditCurveScenarioContainer scc = meSCC.getValue(); - - if (null == strKey || strKey.isEmpty() || null == scc) continue; - - if (BASE == iBumpType) - mapCC.put (strKey, scc.base()); - else if (BUMP_UP == iBumpType) - mapCC.put (strKey, scc.bumpUp()); - else if (BUMP_DN == iBumpType) - mapCC.put (strKey, scc.bumpDown()); - } - - return mapCC; - } - - private org.drip.analytics.support.CaseInsensitiveTreeMap - specificIRFlatBumpDCSet ( - final java.lang.String strIRCurve, - final boolean bBumpUp) - { - if (null == strIRCurve || strIRCurve.isEmpty() || null == _mapScenarioDiscountCurve.get (strIRCurve)) - return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapDC = - dcSet (BASE); - - if (null == mapDC) return null; - - org.drip.param.market.DiscountCurveScenarioContainer dcsc = _mapScenarioDiscountCurve.get (strIRCurve); - - if (null == dcsc) return null; - - mapDC.put (strIRCurve, bBumpUp ? dcsc.bumpUp() : dcsc.bumpDown()); - - return mapDC; - } - - private org.drip.analytics.support.CaseInsensitiveTreeMap - specificCreditFlatBumpCCSet ( - final java.lang.String strCreditCurve, - final boolean bBumpUp) - { - if (null == strCreditCurve || strCreditCurve.isEmpty() || null == _mapScenarioCreditCurve.get - (strCreditCurve)) - return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapCC = - ccSet (BASE); - - if (null == mapCC) return null; - - org.drip.param.market.CreditCurveScenarioContainer scc = _mapScenarioCreditCurve.get - (strCreditCurve); - - if (null == scc) return null; - - mapCC.put (strCreditCurve, bBumpUp ? scc.bumpUp() : scc.bumpDown()); - - return mapCC; - } - - private org.drip.analytics.support.CaseInsensitiveTreeMap - specificCreditFlatBumpRRSet ( - final java.lang.String strCreditCurve, - final boolean bBumpUp) - { - if (null == strCreditCurve || strCreditCurve.isEmpty() || null == _mapScenarioCreditCurve.get - (strCreditCurve)) - return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapCC = - ccSet (BASE); - - org.drip.param.market.CreditCurveScenarioContainer scc = _mapScenarioCreditCurve.get - (strCreditCurve); - - if (null == scc) return null; - - mapCC.put (strCreditCurve, bBumpUp ? scc.bumpRecoveryUp() : scc.bumpRecoveryDown()); - - return mapCC; - } - - private org.drip.param.market.CurveSurfaceQuoteContainer customMarketParams ( - final org.drip.analytics.support.CaseInsensitiveTreeMap - mapDC, - final org.drip.analytics.support.CaseInsensitiveTreeMap mapFC, - final org.drip.analytics.support.CaseInsensitiveTreeMap - mapCC) - { - org.drip.param.market.CurveSurfaceQuoteContainer csqs = new org.drip.param.market.CurveSurfaceQuoteContainer(); - - if (null != mapDC && 0 != mapDC.size()) { - for (java.util.Map.Entry - meDC : mapDC.entrySet()) { - if (null == meDC) continue; - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = meDC.getValue(); - - if (null != dcFunding && !csqs.setFundingState (dcFunding)) return null; - } - } - - if (null != mapFC && 0 != mapFC.size()) { - for (java.util.Map.Entry - meFC : mapFC.entrySet()) { - if (null == meFC) continue; - - org.drip.state.forward.ForwardCurve fc = meFC.getValue(); - - if (null != fc && !csqs.setForwardState (fc)) return null; - } - } - - if (null != mapCC && 0 != mapCC.size()) { - for (java.util.Map.Entry - meCC : mapCC.entrySet()) { - if (null == meCC) continue; - - org.drip.state.credit.CreditCurve cc = meCC.getValue(); - - if (null != cc && !csqs.setCreditState (cc)) return null; - } - } - - return csqs.setFixings (_lsfc) ? csqs : null; - } - - /** - * Construct an empty MarketParamsContainer instance - */ - - public CurveSurfaceScenarioContainer() - { - } - - @Override public boolean addScenarioDiscountCurve ( - final java.lang.String strName, - final org.drip.param.market.DiscountCurveScenarioContainer sdc) - { - if (null != strName && !strName.isEmpty() && null != sdc) { - _mapScenarioDiscountCurve.put (strName, sdc); - - return true; - } - - return false; - } - - @Override public boolean removeScenarioDiscountCurve ( - final java.lang.String strName) - { - if (null != strName && !strName.isEmpty()) { - _mapScenarioDiscountCurve.remove (strName); - - return true; - } - - return false; - } - - @Override public boolean addScenarioCreditCurve ( - final java.lang.String strName, - final org.drip.param.market.CreditCurveScenarioContainer scc) - { - if (null != strName && !strName.isEmpty() && null != scc) { - _mapScenarioCreditCurve.put (strName, scc); - - return true; - } - - return false; - } - - @Override public boolean removeScenarioCreditCurve ( - final java.lang.String strName) - { - if (null != strName && !strName.isEmpty()) { - _mapScenarioCreditCurve.remove (strName); - - return true; - } - - return false; - } - - @Override public boolean addTSYQuote ( - final java.lang.String strBenchmark, - final org.drip.param.definition.ProductQuote pqTSY) - { - if (null == strBenchmark || strBenchmark.isEmpty() || null == pqTSY) return false; - - if (null == _mapTSYQuote) - _mapTSYQuote = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - _mapTSYQuote.put (strBenchmark, pqTSY); - - return true; - } - - @Override public boolean removeTSYQuote ( - final java.lang.String strBenchmark) - { - if (null == strBenchmark || strBenchmark.isEmpty()) return false; - - if (null == _mapTSYQuote) return true; - - _mapTSYQuote.remove (strBenchmark); - - return true; - } - - @Override public boolean setTSYQuotes ( - final org.drip.analytics.support.CaseInsensitiveTreeMap mapCQTSY) - { - _mapTSYQuote = mapCQTSY; - return true; - } - - @Override public org.drip.param.definition.ProductQuote tsyQuote ( - final java.lang.String strBenchmark) - { - if (null == _mapTSYQuote || null == strBenchmark || strBenchmark.isEmpty()) return null; - - return _mapTSYQuote.get (strBenchmark); - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - tsyQuotes() - { - return _mapTSYQuote; - } - - @Override public boolean addFixing ( - final org.drip.analytics.date.JulianDate dtFix, - final org.drip.state.identifier.LatentStateLabel lsl, - final double dblFixing) - { - return _lsfc.add (dtFix, lsl, dblFixing); - } - - @Override public boolean removeFixing ( - final org.drip.analytics.date.JulianDate dtFix, - final org.drip.state.identifier.LatentStateLabel lsl) - { - return _lsfc.remove (dtFix, lsl); - } - - @Override public org.drip.param.market.LatentStateFixingsContainer fixings() - { - return _lsfc; - } - - @Override public boolean addComponentQuote ( - final java.lang.String strComponentID, - final org.drip.param.definition.ProductQuote cqComponent) - { - if (null == strComponentID || strComponentID.isEmpty() || null == cqComponent) return false; - - if (null == _mapQuote) - _mapQuote = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - _mapQuote.put (strComponentID, cqComponent); - - return true; - } - - @Override public boolean removeComponentQuote ( - final java.lang.String strComponentID) - { - if (null == strComponentID || strComponentID.isEmpty()) return false; - - if (null == _mapQuote) return true; - - _mapQuote.remove (strComponentID); - - return true; - } - - @Override public boolean addComponentQuote ( - final org.drip.analytics.support.CaseInsensitiveTreeMap - mapComponentQuote) - { - _mapQuote = mapComponentQuote; - return true; - } - - @Override public org.drip.param.definition.ProductQuote componentQuote ( - final java.lang.String strComponentID) - { - if (null == _mapQuote || null == strComponentID || strComponentID.isEmpty()) return null; - - return _mapQuote.get (strComponentID); - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - componentQuotes() - { - return _mapQuote; - } - - @Override public boolean addScenarioMarketParams ( - final java.lang.String strScenarioName, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - if (null == strScenarioName || strScenarioName.isEmpty() || null == csqs) return false; - - _mapScenarioMarketParams.put (strScenarioName, csqs); - - return true; - } - - @Override public org.drip.param.market.CurveSurfaceQuoteContainer scenarioMarketParams ( - final java.lang.String strScenarioName) - { - return null == strScenarioName || strScenarioName.isEmpty() ? null : _mapScenarioMarketParams.get - (strScenarioName); - } - - @Override public org.drip.param.market.CurveSurfaceQuoteContainer scenarioMarketParams ( - final org.drip.product.definition.Component comp, - final java.lang.String strScenario) - { - if (null == comp || null == strScenario || strScenario.isEmpty()) return null; - - org.drip.state.forward.ForwardCurve fc = null; - org.drip.state.discount.MergedDiscountForwardCurve dc = null; - org.drip.state.credit.CreditCurve cc = null; - - java.lang.String strPayCurrency = comp.payCurrency(); - - org.drip.param.market.DiscountCurveScenarioContainer sdc = _mapScenarioDiscountCurve.get - (strPayCurrency); - - if (null != sdc) { - dc = sdc.base(); - - if ("FlatIRBumpUp".equalsIgnoreCase (strScenario)) - dc = sdc.bumpUp(); - else if ("FlatIRBumpDn".equalsIgnoreCase (strScenario)) - dc = sdc.bumpDown(); - } - - org.drip.state.identifier.CreditLabel creditLabel = comp.creditLabel(); - - org.drip.param.market.CreditCurveScenarioContainer scc = null == creditLabel ? null : - _mapScenarioCreditCurve.get (creditLabel); - - if (null != scc) { - if ("FlatCreditBumpUp".equalsIgnoreCase (strScenario)) - cc = scc.bumpUp(); - else if ("FlatCreditBumpDn".equalsIgnoreCase (strScenario)) - cc = scc.bumpDown(); - else - cc = scc.base(); - } - - return org.drip.param.creator.MarketParamsBuilder.Create (dc, fc, null, cc, comp.name(), - _mapQuote.get (comp.name()), _mapTSYQuote, _lsfc); - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - fundingTenorMarketParams ( - final org.drip.product.definition.Component comp, - final boolean bBumpUp) - { - if (null == comp) return null; - - java.lang.String strPayCurrency = comp.payCurrency(); - - org.drip.param.market.DiscountCurveScenarioContainer sdc = _mapScenarioDiscountCurve.get - (strPayCurrency); - - if (null == sdc) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapDCBumpUp - = sdc.tenorBumpUp(); - - if (bBumpUp && (null == mapDCBumpUp || 0 == mapDCBumpUp.size())) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapDCBumpDown = sdc.tenorBumpDown(); - - if (!bBumpUp && (null == mapDCBumpDown || 0 == mapDCBumpDown.size())) return null; - - org.drip.state.identifier.CreditLabel creditLabel = comp.creditLabel(); - - org.drip.param.market.CreditCurveScenarioContainer scc = null == creditLabel ? null : - _mapScenarioCreditCurve.get (creditLabel); - - org.drip.state.credit.CreditCurve cc = null == scc ? null : scc.base(); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapCSQS - = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - java.lang.String strComponentName = comp.name(); - - if (bBumpUp) { - for (java.util.Map.Entry meDC : - mapDCBumpUp.entrySet()) { - if (null == meDC) continue; - - java.lang.String strKey = meDC.getKey(); - - org.drip.state.discount.MergedDiscountForwardCurve dc = meDC.getValue(); - - if (null == dc || null == strKey || strKey.isEmpty()) continue; - - mapCSQS.put (strKey, org.drip.param.creator.MarketParamsBuilder.Create (dc, null, null, cc, - strComponentName, _mapQuote.get (strComponentName), _mapTSYQuote, _lsfc)); - } - } else { - for (java.util.Map.Entry meDC : - mapDCBumpDown.entrySet()) { - if (null == meDC) continue; - - java.lang.String strKey = meDC.getKey(); - - org.drip.state.discount.MergedDiscountForwardCurve dc = meDC.getValue(); - - if (null == dc || null == strKey || strKey.isEmpty()) continue; - - mapCSQS.put (strKey, org.drip.param.creator.MarketParamsBuilder.Create (dc, null, null, cc, - strComponentName, _mapQuote.get (strComponentName), _mapTSYQuote, _lsfc)); - } - } - - return mapCSQS; - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - creditTenorMarketParams ( - final org.drip.product.definition.Component comp, - final boolean bBumpUp) - { - if (null == comp) return null; - - org.drip.state.identifier.CreditLabel creditLabel = comp.creditLabel(); - - if (null == creditLabel) return null; - - org.drip.param.market.CreditCurveScenarioContainer scc = _mapScenarioCreditCurve.get (creditLabel); - - if (null == scc) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapCCBumpUp = scc.tenorBumpUp(); - - if (bBumpUp && (null == mapCCBumpUp || 0 == mapCCBumpUp.size())) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapCCBumpDown = scc.tenorBumpDown(); - - if (!bBumpUp && (null == mapCCBumpDown || 0 == mapCCBumpDown.size())) return null; - - java.lang.String strPayCurrency = comp.payCurrency(); - - org.drip.param.market.DiscountCurveScenarioContainer sdc = _mapScenarioDiscountCurve.get - (strPayCurrency); - - if (null == sdc) return null; - - org.drip.state.discount.MergedDiscountForwardCurve dc = sdc.base(); - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapCSQS = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - java.lang.String strComponentName = comp.name(); - - if (bBumpUp) { - for (java.util.Map.Entry meCC : - mapCCBumpUp.entrySet()) { - if (null == meCC) continue; - - java.lang.String strKey = meCC.getKey(); - - org.drip.state.credit.CreditCurve cc = meCC.getValue(); - - if (null == strKey || strKey.isEmpty()) continue; - - mapCSQS.put (strKey, org.drip.param.creator.MarketParamsBuilder.Create (dc, null, null, cc, - strComponentName, _mapQuote.get (strComponentName), _mapTSYQuote, _lsfc)); - } - } else { - for (java.util.Map.Entry meCC : - mapCCBumpDown.entrySet()) { - if (null == meCC) continue; - - java.lang.String strKey = meCC.getKey(); - - org.drip.state.credit.CreditCurve cc = meCC.getValue(); - - if (null == strKey || strKey.isEmpty()) continue; - - mapCSQS.put (strKey, org.drip.param.creator.MarketParamsBuilder.Create (dc, null, null, cc, - strComponentName, _mapQuote.get (strComponentName), _mapTSYQuote, _lsfc)); - } - } - - return mapCSQS; - } - - @Override public org.drip.param.market.CurveSurfaceQuoteContainer scenarioMarketParams ( - final org.drip.product.definition.BasketProduct bp, - final java.lang.String strScenario) - { - if (null == strScenario || strScenario.isEmpty()) return null; - - if ("Base".equalsIgnoreCase (strScenario)) - return customMarketParams (dcSet (BASE), null, ccSet (BASE)); - - if ("FlatIRBumpUp".equalsIgnoreCase (strScenario)) - return customMarketParams (dcSet (BUMP_UP), null, ccSet (BASE)); - - if ("FlatIRBumpDn".equalsIgnoreCase (strScenario)) - return customMarketParams (dcSet (BUMP_DN), null, ccSet (BASE)); - - if ("FlatForwardBumpUp".equalsIgnoreCase (strScenario)) - return customMarketParams (dcSet (BASE), null, ccSet (BASE)); - - if ("FlatForwardBumpDn".equalsIgnoreCase (strScenario)) - return customMarketParams (dcSet (BASE), null, ccSet (BASE)); - - if ("FlatCreditBumpUp".equalsIgnoreCase (strScenario)) - return customMarketParams (dcSet (BASE), null, ccSet (BUMP_UP)); - - if ("FlatCreditBumpDn".equalsIgnoreCase (strScenario)) - return customMarketParams (dcSet (BASE), null, ccSet (BUMP_DN)); - - if ("FlatRRBumpUp".equalsIgnoreCase (strScenario)) - return customMarketParams (dcSet (BASE), null, ccSet (RR_BUMP_UP)); - - if ("FlatRRBumpDn".equalsIgnoreCase (strScenario)) - return customMarketParams (dcSet (BASE), null, ccSet (RR_BUMP_DN)); - - return null; - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - fundingFlatBump ( - final org.drip.product.definition.BasketProduct bp, - final boolean bBump) - { - org.drip.analytics.support.CaseInsensitiveTreeMap - mapCSQS = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry - meSDC : _mapScenarioDiscountCurve.entrySet()) { - if (null != meSDC) { - java.lang.String strKey = meSDC.getKey(); - - if (null != strKey && !strKey.isEmpty()) - mapCSQS.put (strKey, customMarketParams (specificIRFlatBumpDCSet (strKey, bBump), null, - ccSet (BASE))); - } - } - - return mapCSQS; - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - creditFlatBump ( - final org.drip.product.definition.BasketProduct bp, - final boolean bBump) - { - org.drip.analytics.support.CaseInsensitiveTreeMap - mapCSQS = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry meSCC - : _mapScenarioCreditCurve.entrySet()) { - if (null != meSCC) { - java.lang.String strKey = meSCC.getKey(); - - if (null != strKey && !strKey.isEmpty()) - mapCSQS.put (strKey, customMarketParams (dcSet (BASE), null, specificCreditFlatBumpCCSet - (strKey, bBump))); - } - } - - return mapCSQS; - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - recoveryFlatBump ( - final org.drip.product.definition.BasketProduct bp, - final boolean bBump) - { - org.drip.analytics.support.CaseInsensitiveTreeMap - mapCSQS = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry meSCC - : _mapScenarioCreditCurve.entrySet()) { - if (null != meSCC) { - java.lang.String strKey = meSCC.getKey(); - - if (null != strKey && !strKey.isEmpty()) - mapCSQS.put (strKey, customMarketParams (dcSet (BASE), null, specificCreditFlatBumpRRSet - (strKey, bBump))); - } - } - - return mapCSQS; - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap> - fundingTenorBump ( - final org.drip.product.definition.BasketProduct bp, - final boolean bBump) - { - if (null == bp) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap> - mmFundingTenorCSQS = new - org.drip.analytics.support.CaseInsensitiveTreeMap>(); - - for (java.util.Map.Entry - meSDC : _mapScenarioDiscountCurve.entrySet()) { - if (null == meSDC) continue; - - java.lang.String strOuterKey = meSDC.getKey(); - - org.drip.param.market.DiscountCurveScenarioContainer sdc = meSDC.getValue(); - - if (null == sdc || null == strOuterKey || strOuterKey.isEmpty()) continue; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapDCBumpUp = sdc.tenorBumpUp(); - - if (bBump && (null == mapDCBumpUp || 0 == mapDCBumpUp.size())) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapDCBumpDown = sdc.tenorBumpDown(); - - if (!bBump && (null == mapDCBumpDown || 0 == mapDCBumpDown.size())) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapTenorCSQS = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry meDC : (bBump - ? mapDCBumpUp.entrySet() : mapDCBumpDown.entrySet())) { - if (null == meDC) continue; - - java.lang.String strInnerKey = meDC.getKey(); - - org.drip.state.discount.MergedDiscountForwardCurve dc = meDC.getValue(); - - if (null == dc || null == strInnerKey || strInnerKey.isEmpty()) continue; - - org.drip.param.market.CurveSurfaceQuoteContainer csqs = scenarioMarketParams (bp, "Base"); - - if (null == csqs || !csqs.setFundingState (dc)) continue; - - mapTenorCSQS.put (strInnerKey, csqs); - } - - mmFundingTenorCSQS.put (strOuterKey, mapTenorCSQS); - } - - return mmFundingTenorCSQS; - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap> - creditTenorBump ( - final org.drip.product.definition.BasketProduct bp, - final boolean bBump) - { - if (null == bp) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap> - mmCreditTenorCSQS = new - org.drip.analytics.support.CaseInsensitiveTreeMap>(); - - for (java.util.Map.Entry meSCC - : _mapScenarioCreditCurve.entrySet()) { - if (null == meSCC) continue; - - java.lang.String strOuterKey = meSCC.getKey(); - - org.drip.param.market.CreditCurveScenarioContainer scc = meSCC.getValue(); - - if (null == scc || null == strOuterKey || strOuterKey.isEmpty()) continue; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapCCBumpUp = scc.tenorBumpUp(); - - if (bBump && (null == mapCCBumpUp || 0 == mapCCBumpUp.size())) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapCCBumpDown = scc.tenorBumpDown(); - - if (!bBump && (null == mapCCBumpDown || 0 == mapCCBumpDown.size())) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapTenorCSQS = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry meCC : - (bBump ? mapCCBumpUp.entrySet() : mapCCBumpDown.entrySet())) { - if (null == meCC) continue; - - java.lang.String strInnerKey = meCC.getKey(); - - org.drip.state.credit.CreditCurve cc = meCC.getValue(); - - if (null == cc || null == strInnerKey || strInnerKey.isEmpty()) continue; - - org.drip.param.market.CurveSurfaceQuoteContainer csqs = scenarioMarketParams (bp, "Base"); - - if (null == csqs || !csqs.setCreditState (cc)) continue; - - mapTenorCSQS.put (strInnerKey, csqs); - } - - mmCreditTenorCSQS.put (strOuterKey, mapTenorCSQS); - } - - return mmCreditTenorCSQS; - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - scenarioDiscountCurveMap() - { - return _mapScenarioDiscountCurve; - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - scenarioCreditCurveMap() - { - return _mapScenarioCreditCurve; - } -} diff --git a/org/drip/param/market/DiscountCurveScenarioContainer.java b/org/drip/param/market/DiscountCurveScenarioContainer.java deleted file mode 100644 index 09e903e..0000000 --- a/org/drip/param/market/DiscountCurveScenarioContainer.java +++ /dev/null @@ -1,248 +0,0 @@ - -package org.drip.param.market; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * DiscountCurveScenarioContainer implements the RatesScenarioCurve abstract class that exposes the interface - * the constructs scenario discount curves. The following curve construction scenarios are supported: - * - Base, flat/tenor up/down by arbitrary bumps - * - Tenor bumped discount curve set - keyed using the tenor. - * - NTP-based custom scenario curves. - * - * @author Lakshmi Krishnamurthy - */ - -public class DiscountCurveScenarioContainer { - - /** - * Base Discount Curve - */ - - public static final int DC_BASE = 0; - - /** - * Discount Curve Parallel Bump Up - */ - - public static final int DC_FLAT_UP = 1; - - /** - * Discount Curve Parallel Bump Down - */ - - public static final int DC_FLAT_DN = 2; - - /** - * Discount Curve Tenor Bump Up - */ - - public static final int DC_TENOR_UP = 4; - - /** - * Discount Curve Tenor Bump Down - */ - - public static final int DC_TENOR_DN = 8; - - private org.drip.state.discount.MergedDiscountForwardCurve _dcBase = null; - private org.drip.state.discount.MergedDiscountForwardCurve _dcBumpUp = null; - private org.drip.state.discount.MergedDiscountForwardCurve _dcBumpDn = null; - private org.drip.product.definition.CalibratableComponent[] _aCalibInst = null; - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapDCCustom = null; - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapDCBumpUp = null; - private org.drip.analytics.support.CaseInsensitiveTreeMap - _mapDCBumpDn = null; - - /** - * Constructs an DiscountCurveScenarioContainer instance from the corresponding - * DiscountCurveScenarioGenerator - * - * @param aCalibInst Array of calibration instruments - * - * @throws java.lang.Exception Thrown if the IRCurveScenarioGenerator instance is invalid - */ - - public DiscountCurveScenarioContainer ( - final org.drip.product.definition.CalibratableComponent[] aCalibInst) - throws java.lang.Exception - { - if (null == (_aCalibInst = aCalibInst) || 0 == _aCalibInst.length) - throw new java.lang.Exception ("DiscountCurveScenarioContainer ctr => Invalid Inputs"); - } - - /** - * Generate the set of discount curves from the scenario specified, and the instrument quotes - * - * @param valParams Valuation Parameters - * @param gc The Govvie Curve - * @param adblCalibQuote Matched array of the calibration instrument quotes - * @param astrCalibMeasure Matched array of the calibration instrument measures - * @param dblBump Amount of bump to be applied - * @param lsfc Latent State Fixings Container - * @param vcp Valuation Customization Parameters - * @param iDCMode One of the values in the DC_ enum listed above. - * - * @return Success (true), failure (false) - */ - - public boolean cookScenarioDC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.govvie.GovvieCurve gc, - final double[] adblCalibQuote, - final java.lang.String[] astrCalibMeasure, - final double dblBump, - final org.drip.param.market.LatentStateFixingsContainer lsfc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iDCMode) - { - if (null == (_dcBase = org.drip.state.boot.DiscountCurveScenario.Standard (valParams, _aCalibInst, - adblCalibQuote, astrCalibMeasure, 0., gc, lsfc, vcp))) - return false; - - if (0 != (org.drip.param.market.DiscountCurveScenarioContainer.DC_FLAT_UP & iDCMode)) { - if (null == (_dcBumpUp = org.drip.state.boot.DiscountCurveScenario.Standard (valParams, - _aCalibInst, adblCalibQuote, astrCalibMeasure, dblBump, gc, lsfc, vcp))) - return false; - } - - if (0 != (org.drip.param.market.DiscountCurveScenarioContainer.DC_FLAT_DN & iDCMode)) { - if (null == (_dcBumpDn = org.drip.state.boot.DiscountCurveScenario.Standard (valParams, - _aCalibInst, adblCalibQuote, astrCalibMeasure, -dblBump, gc, lsfc, vcp))) - return false; - } - - if (0 != (org.drip.param.market.DiscountCurveScenarioContainer.DC_TENOR_UP & iDCMode)) { - if (null == (_mapDCBumpUp = org.drip.state.boot.DiscountCurveScenario.TenorMap (valParams, - _aCalibInst, adblCalibQuote, astrCalibMeasure, dblBump, gc, lsfc, vcp))) - return false; - } - - if (0 != (org.drip.param.market.DiscountCurveScenarioContainer.DC_TENOR_DN & iDCMode)) { - if (null == (_mapDCBumpDn = org.drip.state.boot.DiscountCurveScenario.TenorMap (valParams, - _aCalibInst, adblCalibQuote, astrCalibMeasure, -dblBump, gc, lsfc, vcp))) - return false; - } - - return true; - } - - /** - * Return the base Discount Curve - * - * @return The base Discount Curve - */ - - public org.drip.state.discount.MergedDiscountForwardCurve base() - { - return _dcBase; - } - - /** - * Return the Bump Up Discount Curve - * - * @return The Bump Up Discount Curve - */ - - public org.drip.state.discount.MergedDiscountForwardCurve bumpUp() - { - return _dcBumpUp; - } - - /** - * Return the Bump Down Discount Curve - * - * @return The Bump Down Discount Curve - */ - - public org.drip.state.discount.MergedDiscountForwardCurve bumpDown() - { - return _dcBumpDn; - } - - /** - * Return the map of the tenor Bump Up Discount Curve - * - * @return The map of the tenor Bump Up Discount Curve - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap - tenorBumpUp() - { - return _mapDCBumpUp; - } - - /** - * Return the map of the tenor Bump Down Discount Curve - * - * @return The map of the tenor Bump Down Discount Curve - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap - tenorBumpDown() - { - return _mapDCBumpDn; - } - - /** - * Return the Custom Discount curve map - * - * @return The Custom Discount curve Map - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap custom() - { - return _mapDCCustom; - } -} diff --git a/org/drip/param/market/LatentStateFixingsContainer.java b/org/drip/param/market/LatentStateFixingsContainer.java deleted file mode 100644 index a9ada14..0000000 --- a/org/drip/param/market/LatentStateFixingsContainer.java +++ /dev/null @@ -1,314 +0,0 @@ - -package org.drip.param.market; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * LatentStateFixingsContainer holds the explicit fixings for a specified Latent State Quantification along - * the date ordinate. - * - * @author Lakshmi Krishnamurthy - */ - -public class LatentStateFixingsContainer { - private java.util.Map> _mmForwardFixing = new - java.util.TreeMap>(); - - private java.util.Map> _mmFXFixing = new - java.util.TreeMap>(); - - /** - * Empty LatentStateFixingsContainer Instance Constructor - */ - - public LatentStateFixingsContainer() - { - } - - /** - * Add the Fixing corresponding to the Date/Label Pair - * - * @param dt The Fixing Date - * @param lsl The Latent State Label - * @param dblFixing The Fixing Amount - * - * @return TRUE - Entry successfully added - */ - - public boolean add ( - final org.drip.analytics.date.JulianDate dt, - final org.drip.state.identifier.LatentStateLabel lsl, - final double dblFixing) - { - if (null == dt || null == lsl || !org.drip.quant.common.NumberUtil.IsValid (dblFixing)) return false; - - if (lsl instanceof org.drip.state.identifier.ForwardLabel) { - if (!_mmForwardFixing.containsKey (dt)) - _mmForwardFixing.put (dt, new - org.drip.analytics.support.CaseInsensitiveTreeMap()); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapForwardFixing = - _mmForwardFixing.get (dt); - - mapForwardFixing.put (lsl.fullyQualifiedName(), dblFixing); - - return true; - } - - if (lsl instanceof org.drip.state.identifier.FXLabel) { - if (!_mmFXFixing.containsKey (dt)) - _mmFXFixing.put (dt, new - org.drip.analytics.support.CaseInsensitiveTreeMap()); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapFXFixing = _mmFXFixing.get - (dt); - - mapFXFixing.put (lsl.fullyQualifiedName(), dblFixing); - - return true; - } - - return false; - } - - /** - * Add the Latent State Fixing corresponding to the Date/Label Pair - * - * @param iDate The Fixing Date - * @param lsl The Latent State Fixing Label - * @param dblFixing The Fixing Amount - * - * @return TRUE - Entry successfully added - */ - - public boolean add ( - final int iDate, - final org.drip.state.identifier.LatentStateLabel lsl, - final double dblFixing) - { - return add (new org.drip.analytics.date.JulianDate (iDate), lsl, dblFixing); - } - - /** - * Remove the Latent State Fixing corresponding to the Date/Label Pair it if exists - * - * @param dt The Fixing Date - * @param lsl The Latent State Fixing Label - * - * @return TRUE - Entry successfully removed if it existed - */ - - public boolean remove ( - final org.drip.analytics.date.JulianDate dt, - final org.drip.state.identifier.LatentStateLabel lsl) - { - if (null == dt || null == lsl) return false; - - if (lsl instanceof org.drip.state.identifier.ForwardLabel) { - if (!_mmForwardFixing.containsKey (dt)) return true; - - _mmForwardFixing.get (dt).remove (lsl.fullyQualifiedName()); - - return true; - } - - if (lsl instanceof org.drip.state.identifier.FXLabel) { - if (!_mmFXFixing.containsKey (dt)) return true; - - _mmFXFixing.get (dt).remove (lsl.fullyQualifiedName()); - - return true; - } - - return false; - } - - /** - * Remove the Latent State Fixing corresponding to the Date/Label Pair it if exists - * - * @param iDate The Fixing Date - * @param lsl The Latent State Fixing Label - * - * @return TRUE - Entry successfully removed if it existed - */ - - public boolean remove ( - final int iDate, - final org.drip.state.identifier.LatentStateLabel lsl) - { - return remove (new org.drip.analytics.date.JulianDate (iDate), lsl); - } - - /** - * Retrieve the Latent State Fixing for the Specified Date/LSL Combination - * - * @param dt Date - * @param lsl The Latent State Latent State Label - * - * @return The Latent State Fixing for the Specified Date - * - * @throws java.lang.Exception Thrown if the Fixing cannot be found - */ - - public double fixing ( - final org.drip.analytics.date.JulianDate dt, - final org.drip.state.identifier.LatentStateLabel lsl) - throws java.lang.Exception - { - if (null == dt || null == lsl) - throw new java.lang.Exception - ("LatentStateFixingsContainer::fixing => Cannot locate Latent State Fixing for the Date"); - - if (lsl instanceof org.drip.state.identifier.ForwardLabel) { - if (!_mmForwardFixing.containsKey (dt)) - throw new java.lang.Exception - ("LatentStateFixingsContainer::fixing => Cannot locate Forward Fixing for the Date"); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapForwardFixing = - _mmForwardFixing.get (dt); - - java.lang.String strLabel = lsl.fullyQualifiedName(); - - if (!mapForwardFixing.containsKey (strLabel)) - throw new java.lang.Exception - ("LatentStateFixingsContainer::fixing => Cannot locate the Forward Label Entry for the Date!"); - - return mapForwardFixing.get (strLabel); - } - - if (lsl instanceof org.drip.state.identifier.FXLabel) { - if (!_mmFXFixing.containsKey (dt)) - throw new java.lang.Exception - ("LatentStateFixingsContainer::fixing => Cannot locate FX Fixing for the Date"); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapFXFixing = _mmFXFixing.get - (dt); - - java.lang.String strLabel = lsl.fullyQualifiedName(); - - if (!mapFXFixing.containsKey (strLabel)) - throw new java.lang.Exception - ("LatentStateFixingsContainer::fixing => Cannot locate the FX Label Entry for the Date!"); - - return mapFXFixing.get (strLabel); - } - - throw new java.lang.Exception - ("LatentStateFixingsContainer::fixing => No Fixings available for the Latent State"); - } - - /** - * Retrieve the Latent State Fixing for the Specified Date - * - * @param iDate Date - * @param lsl The Latent State Label - * - * @return The Fixing for the Specified Date - * - * @throws java.lang.Exception Thrown if the Fixing cannot be found - */ - - public double fixing ( - final int iDate, - final org.drip.state.identifier.LatentStateLabel lsl) - throws java.lang.Exception - { - return fixing (new org.drip.analytics.date.JulianDate (iDate), lsl); - } - - /** - * Indicate the Availability of the Fixing for the Specified LSL Label on the specified Date - * - * @param dt The Date - * @param lsl The Label - * - * @return TRUE - The Fixing for the Specified LSL Label on the specified Date - */ - - public boolean available ( - final org.drip.analytics.date.JulianDate dt, - final org.drip.state.identifier.LatentStateLabel lsl) - { - if (null == dt || null == lsl) return false; - - if (lsl instanceof org.drip.state.identifier.ForwardLabel) { - if (!_mmForwardFixing.containsKey (dt)) return false; - - return _mmForwardFixing.get (dt).containsKey (lsl.fullyQualifiedName()); - } - - if (lsl instanceof org.drip.state.identifier.FXLabel) { - if (!_mmFXFixing.containsKey (dt)) return false; - - return _mmFXFixing.get (dt).containsKey (lsl.fullyQualifiedName()); - } - - return false; - } - - /** - * Indicate the Availability of the Fixing for the Specified LSL on the specified Date - * - * @param iDate The Date - * @param lsl The Label - * - * @return TRUE - The Fixing for the Specified LSL on the specified Date - */ - - public boolean available ( - final int iDate, - final org.drip.state.identifier.LatentStateLabel lsl) - { - return available (new org.drip.analytics.date.JulianDate (iDate), lsl); - } -} diff --git a/org/drip/param/period/ComposableFixedUnitSetting.java b/org/drip/param/period/ComposableFixedUnitSetting.java deleted file mode 100644 index d17da3f..0000000 --- a/org/drip/param/period/ComposableFixedUnitSetting.java +++ /dev/null @@ -1,126 +0,0 @@ - -package org.drip.param.period; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ComposableFixedUnitSetting contains the fixed unit details. Currently it holds the coupon currency, the - * fixed coupon, and the basis. - * - * @author Lakshmi Krishnamurthy - */ - -public class ComposableFixedUnitSetting extends org.drip.param.period.ComposableUnitBuilderSetting { - private double _dblBasis = java.lang.Double.NaN; - private java.lang.String _strCouponCurrency = ""; - private double _dblFixedCoupon = java.lang.Double.NaN; - - /** - * ComposableFixedUnitSetting constructor - * - * @param strTenor Unit Tenor - * @param iEdgeDateSequenceScheme Edge Date Generation Scheme - * @param dapEdge Date Adjust Parameter Settings for the Edge Dates - * @param dblFixedCoupon Fixed Coupon (Annualized) - * @param dblBasis Basis over the Fixed Coupon in the same units - * @param strCouponCurrency Coupon Currency - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public ComposableFixedUnitSetting ( - final java.lang.String strTenor, - final int iEdgeDateSequenceScheme, - final org.drip.analytics.daycount.DateAdjustParams dapEdge, - final double dblFixedCoupon, - final double dblBasis, - final java.lang.String strCouponCurrency) - throws java.lang.Exception - { - super (strTenor, iEdgeDateSequenceScheme, dapEdge); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblFixedCoupon = dblFixedCoupon) || - !org.drip.quant.common.NumberUtil.IsValid (_dblBasis = dblBasis) || null == - (_strCouponCurrency = strCouponCurrency) || _strCouponCurrency.isEmpty()) - throw new java.lang.Exception ("ComposableFixedUnitSetting ctr: Invalid Inputs"); - } - - /** - * Retrieve the Fixed Coupon - * - * @return The Fixed Coupon - */ - - public double fixedCoupon() - { - return _dblFixedCoupon; - } - - /** - * Retrieve the Fixed Coupon Basis - * - * @return The Fixed Coupon Basis - */ - - public double basis() - { - return _dblBasis; - } - - /** - * Retrieve the Fixed Coupon Currency - * - * @return The Fixed Coupon Currency - */ - - public java.lang.String couponCurrency() - { - return _strCouponCurrency; - } -} diff --git a/org/drip/param/period/ComposableFloatingUnitSetting.java b/org/drip/param/period/ComposableFloatingUnitSetting.java deleted file mode 100644 index 8802ec6..0000000 --- a/org/drip/param/period/ComposableFloatingUnitSetting.java +++ /dev/null @@ -1,126 +0,0 @@ - -package org.drip.param.period; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ComposableFloatingUnitSetting contains the cash flow periods' composable sub period details. - * - * @author Lakshmi Krishnamurthy - */ - -public class ComposableFloatingUnitSetting extends org.drip.param.period.ComposableUnitBuilderSetting { - private int _iReferencePeriodArrearsType = -1; - private double _dblSpread = java.lang.Double.NaN; - private org.drip.state.identifier.ForwardLabel _forwardLabel = null; - - /** - * ComposableFloatingUnitSetting constructor - * - * @param strTenor Unit Tenor - * @param iEdgeDateSequenceScheme Edge Date Generation Scheme - * @param dapEdge Date Adjust Parameter Settings for the Edge Dates - * @param forwardLabel Forward Label - * @param iReferencePeriodArrearsType Reference Period Arrears Type - * @param dblSpread Floater Spread - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public ComposableFloatingUnitSetting ( - final java.lang.String strTenor, - final int iEdgeDateSequenceScheme, - final org.drip.analytics.daycount.DateAdjustParams dapEdge, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final int iReferencePeriodArrearsType, - final double dblSpread) - throws java.lang.Exception - { - super (strTenor, iEdgeDateSequenceScheme, dapEdge); - - if (null == (_forwardLabel = forwardLabel) || !org.drip.quant.common.NumberUtil.IsValid (_dblSpread = - dblSpread)) - throw new java.lang.Exception ("ComposableFloatingUnitSetting ctr: Invalid Inputs"); - - _iReferencePeriodArrearsType = iReferencePeriodArrearsType; - } - - /** - * Retrieve the Forward Label - * - * @return The Forward Label - */ - - public org.drip.state.identifier.ForwardLabel forwardLabel() - { - return _forwardLabel; - } - - /** - * Retrieve the Reference Period Arrears Type - * - * @return The Reference Period Arrears Type - */ - - public int referencePeriodArrearsType() - { - return _iReferencePeriodArrearsType; - } - - /** - * Retrieve the Floating Unit Spread - * - * @return The Floating Unit Spread - */ - - public double spread() - { - return _dblSpread; - } -} diff --git a/org/drip/param/period/ComposableUnitBuilderSetting.java b/org/drip/param/period/ComposableUnitBuilderSetting.java deleted file mode 100644 index fd9d0e6..0000000 --- a/org/drip/param/period/ComposableUnitBuilderSetting.java +++ /dev/null @@ -1,109 +0,0 @@ - -package org.drip.param.period; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ComposableUnitBuilderSetting contains the composable unit builder details. Currently it holds the coupon - * currency, the fixed coupon, and the basis. - * - * @author Lakshmi Krishnamurthy - */ - -public class ComposableUnitBuilderSetting { - private java.lang.String _strTenor = ""; - private int _iEdgeDateSequenceScheme = -1; - private org.drip.analytics.daycount.DateAdjustParams _dapEdge = null; - - protected ComposableUnitBuilderSetting ( - final java.lang.String strTenor, - final int iEdgeDateSequenceScheme, - final org.drip.analytics.daycount.DateAdjustParams dapEdge) - throws java.lang.Exception - { - if (null == (_strTenor = strTenor) || _strTenor.isEmpty()) - throw new java.lang.Exception ("ComposableUnitBuilderSetting ctr: Invalid Inputs"); - - _dapEdge = dapEdge; - _iEdgeDateSequenceScheme = iEdgeDateSequenceScheme; - } - - /** - * Retrieve the Tenor - * - * @return The Tenor - */ - - public java.lang.String tenor() - { - return _strTenor; - } - - /** - * Retrieve the Edge Date Generation Scheme - * - * @return The Edge Date Generation Scheme - */ - - public int edgeDateSequenceScheme() - { - return _iEdgeDateSequenceScheme; - } - - /** - * Retrieve the Edge Date Adjust Parameters - * - * @return The Edge Date Adjust Parameters - */ - - public org.drip.analytics.daycount.DateAdjustParams dapEdge() - { - return _dapEdge; - } -} diff --git a/org/drip/param/period/CompositePeriodSetting.java b/org/drip/param/period/CompositePeriodSetting.java deleted file mode 100644 index 5447f3a..0000000 --- a/org/drip/param/period/CompositePeriodSetting.java +++ /dev/null @@ -1,210 +0,0 @@ - -package org.drip.param.period; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * CompositePeriodSetting implements the custom setting parameters for the composite coupon period. - * - * @author Lakshmi Krishnamurthy - */ - -public class CompositePeriodSetting { - private int _iFreq = -1; - private java.lang.String _strTenor = ""; - private java.lang.String _strPayCurrency = ""; - private double _dblBaseNotional = java.lang.Double.NaN; - private org.drip.quant.common.Array2D _fsCoupon = null; - private org.drip.quant.common.Array2D _fsNotional = null; - private org.drip.state.identifier.CreditLabel _creditLabel = null; - private org.drip.param.period.FixingSetting _fxFixingSetting = null; - private org.drip.analytics.daycount.DateAdjustParams _dapPay = null; - - /** - * CompositePeriodSetting Constructor - * - * @param iFreq The Frequency - * @param strTenor The Period Tenor - * @param strPayCurrency The Pay Currency - * @param dapPay Composite Pay Date Adjust Parameters - * @param dblBaseNotional The Period Base Notional - * @param fsCoupon The Period Coupon Schedule - * @param fsNotional The Period Notional Schedule - * @param fxFixingSetting The FX Fixing Setting - * @param creditLabel The Period Credit Label - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public CompositePeriodSetting ( - final int iFreq, - final java.lang.String strTenor, - final java.lang.String strPayCurrency, - final org.drip.analytics.daycount.DateAdjustParams dapPay, - final double dblBaseNotional, - final org.drip.quant.common.Array2D fsCoupon, - final org.drip.quant.common.Array2D fsNotional, - final org.drip.param.period.FixingSetting fxFixingSetting, - final org.drip.state.identifier.CreditLabel creditLabel) - throws java.lang.Exception - { - if (0 >= (_iFreq = iFreq) || null == (_strTenor = strTenor) || _strTenor.isEmpty() || null == - (_strPayCurrency = strPayCurrency) || _strPayCurrency.isEmpty() || - !org.drip.quant.common.NumberUtil.IsValid (_dblBaseNotional = dblBaseNotional)) - throw new java.lang.Exception ("CompositePeriodSetting ctr: Invalid Inputs"); - - _dapPay = dapPay; - _creditLabel = creditLabel; - _fxFixingSetting = fxFixingSetting; - - if (null == (_fsCoupon = fsCoupon)) _fsCoupon = org.drip.quant.common.Array2D.BulletSchedule(); - - if (null == (_fsNotional = fsNotional)) - _fsNotional = org.drip.quant.common.Array2D.BulletSchedule(); - } - - /** - * Retrieve the Frequency - * - * @return The Frequency - */ - - public int freq() - { - return _iFreq; - } - - /** - * Retrieve the Tenor - * - * @return The Tenor - */ - - public java.lang.String tenor() - { - return _strTenor; - } - - /** - * Retrieve the Pay Currency - * - * @return The Pay Currency - */ - - public java.lang.String payCurrency() - { - return _strPayCurrency; - } - - /** - * Retrieve the Pay DAP - * - * @return The Pay DAP - */ - - public org.drip.analytics.daycount.DateAdjustParams dapPay() - { - return _dapPay; - } - - /** - * Retrieve the Base Notional - * - * @return The Base Notional - */ - - public double baseNotional() - { - return _dblBaseNotional; - } - - /** - * Retrieve the Notional Schedule - * - * @return The Notional Schedule - */ - - public org.drip.quant.common.Array2D notionalSchedule() - { - return _fsNotional; - } - - /** - * Retrieve the Coupon Schedule - * - * @return The Coupon Schedule - */ - - public org.drip.quant.common.Array2D couponSchedule() - { - return _fsCoupon; - } - - /** - * Retrieve the FX Fixing Setting - * - * @return The FX Fixing Setting - */ - - public org.drip.param.period.FixingSetting fxFixingSetting() - { - return _fxFixingSetting; - } - - /** - * Retrieve the Credit Label - * - * @return The Credit Label - */ - - public org.drip.state.identifier.CreditLabel creditLabel() - { - return _creditLabel; - } -} diff --git a/org/drip/param/period/FixingSetting.java b/org/drip/param/period/FixingSetting.java deleted file mode 100644 index a2cdd63..0000000 --- a/org/drip/param/period/FixingSetting.java +++ /dev/null @@ -1,152 +0,0 @@ - -package org.drip.param.period; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FixingSetting implements the custom setting parameters for the Latent State Fixing Settings. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixingSetting { - - /** - * Fixing Based off of the Start of the Composite Period - */ - - public static final int FIXING_COMPOSITE_PERIOD_START = 1; - - /** - * Fixing Based off of the End of the Composite Period - */ - - public static final int FIXING_COMPOSITE_PERIOD_END = 2; - - /** - * Fixing Based off of the Start of a Pre-determined Static Date - */ - - public static final int FIXING_PRESET_STATIC = 4; - - private int _iType = -1; - private int _iStaticDate = java.lang.Integer.MIN_VALUE; - private org.drip.analytics.daycount.DateAdjustParams _dap = null; - - /** - * Validate the Type of FX Fixing - * - * @param iType The FX Fixing Type - * - * @return TRUE - FX Fixing is One of the Valid Types - */ - - public static final boolean ValidateType ( - final int iType) - { - return FIXING_COMPOSITE_PERIOD_START == iType || FIXING_COMPOSITE_PERIOD_END == iType || - FIXING_PRESET_STATIC == iType; - } - - /** - * FixingSetting Constructor - * - * @param iType The Fixing Type - * @param dap The Fixing DAP - * @param iStaticDate Static Fixing Date - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public FixingSetting ( - final int iType, - final org.drip.analytics.daycount.DateAdjustParams dap, - final int iStaticDate) - throws java.lang.Exception - { - if (!ValidateType (_iType = iType)) - throw new java.lang.Exception ("FixingSetting ctr: Invalid Inputs"); - - _dap = dap; - _iStaticDate = iStaticDate; - } - - /** - * Retrieve the Fixing Type - * - * @return The Fixing Type - */ - - public int type() - { - return _iType; - } - - /** - * Retrieve the Fixing DAP - * - * @return The Fixing DAP - */ - - public org.drip.analytics.daycount.DateAdjustParams dap() - { - return _dap; - } - - /** - * Retrieve the Static Fixing Date - * - * @return The Static Fixing Date - */ - - public int staticDate() - { - return _iStaticDate; - } -} diff --git a/org/drip/param/period/UnitCouponAccrualSetting.java b/org/drip/param/period/UnitCouponAccrualSetting.java deleted file mode 100644 index 053f48c..0000000 --- a/org/drip/param/period/UnitCouponAccrualSetting.java +++ /dev/null @@ -1,195 +0,0 @@ - -package org.drip.param.period; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * UnitCouponAccrualSetting contains the cash flow periods' Coupon/Accrual details. Currently it holds the - * frequency, the calendar, the coupon/accrual day counts and the EOM adjustment flags, and flag indicating - * whether the coupon is computed from frequency. - * - * @author Lakshmi Krishnamurthy - */ - -public class UnitCouponAccrualSetting { - private int _iFreq = -1; - private int _iAccrualCompoundingRule = -1; - private java.lang.String _strCalendar = ""; - private java.lang.String _strCouponDC = ""; - private java.lang.String _strAccrualDC = ""; - private boolean _bCouponDCFOffOfFreq = false; - private boolean _bCouponEOMAdjustment = false; - private boolean _bAccrualEOMAdjustment = false; - - /** - * UnitCouponAccrualSetting constructor - * - * @param iFreq Frequency - * @param strCouponDC Coupon Day Count - * @param bCouponEOMAdjustment Coupon EOM Adjustment Flag - * @param strAccrualDC Accrual Day Count - * @param bAccrualEOMAdjustment Accrual EOM Adjustment Flag - * @param strCalendar Calendar - * @param bCouponDCFOffOfFreq Compute Full Coupon DCF from the Frequency - * @param iAccrualCompoundingRule The Accrual Compounding Rule - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public UnitCouponAccrualSetting ( - final int iFreq, - final java.lang.String strCouponDC, - final boolean bCouponEOMAdjustment, - final java.lang.String strAccrualDC, - final boolean bAccrualEOMAdjustment, - final java.lang.String strCalendar, - final boolean bCouponDCFOffOfFreq, - final int iAccrualCompoundingRule) - throws java.lang.Exception - { - if (0 >= (_iFreq = iFreq) || null == (_strCouponDC = strCouponDC) || _strCouponDC.isEmpty() || null - == (_strAccrualDC = strAccrualDC) || _strAccrualDC.isEmpty() || null == (_strCalendar = - strCalendar) || _strCalendar.isEmpty() || - !org.drip.analytics.support.CompositePeriodBuilder.ValidateCompoundingRule - (_iAccrualCompoundingRule = iAccrualCompoundingRule)) - throw new java.lang.Exception ("UnitCouponAccrualSetting ctr: Invalid Inputs"); - - _bCouponDCFOffOfFreq = bCouponDCFOffOfFreq; - _bCouponEOMAdjustment = bCouponEOMAdjustment; - _bAccrualEOMAdjustment = bAccrualEOMAdjustment; - } - - /** - * Retrieve the Coupon Frequency - * - * @return The Coupon Frequency - */ - - public int freq() - { - return _iFreq; - } - - /** - * Retrieve the Coupon Day Count - * - * @return The Coupon Day Count - */ - - public java.lang.String couponDC() - { - return _strCouponDC; - } - - /** - * Retrieve the Coupon EOM Adjustment Flag - * - * @return The Coupon EOM Adjustment Flag - */ - - public boolean couponEOMAdjustment() - { - return _bCouponEOMAdjustment; - } - - /** - * Retrieve the Accrual Day Count - * - * @return The Accrual Day Count - */ - - public java.lang.String accrualDC() - { - return _strAccrualDC; - } - - /** - * Retrieve the Accrual EOM Adjustment Flag - * - * @return The Accrual EOM Adjustment Flag - */ - - public boolean accrualEOMAdjustment() - { - return _bAccrualEOMAdjustment; - } - - /** - * Retrieve the Flag indicating whether Coupon DCF is computed off of the DCF Flag - * - * @return TRUE - The Flag indicating whether Coupon DCF is computed off of the DCF Flag - */ - - public boolean couponDCFOffOfFreq() - { - return _bCouponDCFOffOfFreq; - } - - /** - * Retrieve the Calendar - * - * @return The Calendar - */ - - public java.lang.String calendar() - { - return _strCalendar; - } - - /** - * Retrieve the Accrual Compounding Rule - * - * @return The Accrual Compounding Rule - */ - - public int accrualCompoundingRule() - { - return _iAccrualCompoundingRule; - } -} diff --git a/org/drip/param/pricer/CreditPricerParams.java b/org/drip/param/pricer/CreditPricerParams.java deleted file mode 100644 index 4710187..0000000 --- a/org/drip/param/pricer/CreditPricerParams.java +++ /dev/null @@ -1,173 +0,0 @@ - -package org.drip.param.pricer; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * CreditPricerParams contains the Credit Pricer Parameters - the discrete unit size, calibration mode - * on/off, survival to pay/end date, and the discretization scheme - * - * @author Lakshmi Krishnamurthy - */ - -public class CreditPricerParams implements org.drip.param.pricer.PricerParams { - - /* - * Loss period Grid discretization scheme - */ - - /** - * Minimum number of days per unit - */ - - public static final int PERIOD_DAY_STEPS_MINIMUM = 7; - - /** - * Discretization as a sequence of day steps - */ - - public static final int PERIOD_DISCRETIZATION_DAY_STEP = 1; - - /** - * Discretization as a sequence of time space divided periods - */ - - public static final int PERIOD_DISCRETIZATION_PERIOD_STEP = 2; - - /** - * No discretization at all - just the full coupon period - */ - - public static final int PERIOD_DISCRETIZATION_FULL_COUPON = 3; - - private int _iUnitSize = 7; - private boolean _bSurvToPayDate = false; - private int _iDiscretizationScheme = PERIOD_DISCRETIZATION_DAY_STEP; - private org.drip.param.definition.CalibrationParams _calibParams = null; - - /** - * Create the standard Credit pricer parameters object instance - * - * @return CreditPricerParams object instance - */ - - public static final CreditPricerParams Standard() - { - return new CreditPricerParams (7, null, false, PERIOD_DISCRETIZATION_DAY_STEP); - } - - /** - * Create the pricer parameters from the discrete unit size, calibration mode on/off, survival to - * pay/end date, and the discretization scheme - * - * @param iUnitSize Discretization Unit Size - * @param calibParams Optional Calibration Params - * @param bSurvToPayDate Survival to Pay Date (True) or Period End Date (false) - * @param iDiscretizationScheme Discretization Scheme In Use - */ - - public CreditPricerParams ( - final int iUnitSize, - final org.drip.param.definition.CalibrationParams calibParams, - final boolean bSurvToPayDate, - final int iDiscretizationScheme) - { - _iUnitSize = iUnitSize; - _calibParams = calibParams; - _bSurvToPayDate = bSurvToPayDate; - _iDiscretizationScheme = iDiscretizationScheme; - } - - /** - * Retrieve the Discretized Loss Unit Size - * - * @return The Discretized Loss Unit Size - */ - - public int unitSize() - { - return _iUnitSize; - } - - /** - * Retrieve the Calibration Parameters Instance - * - * @return The Calibration Parameters Instance - */ - - public org.drip.param.definition.CalibrationParams calibParams() - { - return _calibParams; - } - - /** - * Retrieve the flag indicating whether the Survival is to be computed to the Pay Date (TRUE) or not - * - * @return TRUE - Survival is to be computed to the Pay Date - */ - - public boolean survivalToPayDate() - { - return _bSurvToPayDate; - } - - /** - * Retrieve the Discretization Scheme - * - * @return The Discretization Scheme - */ - - public int discretizationScheme() - { - return _iDiscretizationScheme; - } -} diff --git a/org/drip/param/pricer/GenericPricer.java b/org/drip/param/pricer/GenericPricer.java deleted file mode 100644 index 0f10513..0000000 --- a/org/drip/param/pricer/GenericPricer.java +++ /dev/null @@ -1,58 +0,0 @@ - -package org.drip.param.pricer; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * GenericPricer is the Base Stub on top which all the Custom Pricers are implemented. - * - * @author Lakshmi Krishnamurthy - */ - -public interface GenericPricer { -} diff --git a/org/drip/param/pricer/HestonOptionPricerParams.java b/org/drip/param/pricer/HestonOptionPricerParams.java deleted file mode 100644 index ddee00b..0000000 --- a/org/drip/param/pricer/HestonOptionPricerParams.java +++ /dev/null @@ -1,180 +0,0 @@ - -package org.drip.param.pricer; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * HestonOptionPricerParams holds the parameters that drive the dynamics of the Heston stochastic volatility - * model. - * - * @author Lakshmi Krishnamurthy - */ - -public class HestonOptionPricerParams { - private int _iPayoffTransformScheme = -1; - private double _dblRho = java.lang.Double.NaN; - private double _dblKappa = java.lang.Double.NaN; - private double _dblSigma = java.lang.Double.NaN; - private double _dblTheta = java.lang.Double.NaN; - private double _dblLambda = java.lang.Double.NaN; - private int _iMultiValuePhaseTrackerType = - org.drip.quant.fourier.PhaseAdjuster.MULTI_VALUE_BRANCH_POWER_PHASE_TRACKER_KAHL_JACKEL; - - /** - * HestonOptionPricerParams constructor - * - * @param iPayoffTransformScheme The Payoff Transformation Scheme - * @param dblRho Rho - * @param dblKappa Kappa - * @param dblSigma Sigma - * @param dblTheta Theta - * @param dblLambda Lambda - * @param iMultiValuePhaseTrackerType The Multi Valued Phase Tracking Error Corrector - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public HestonOptionPricerParams ( - final int iPayoffTransformScheme, - final double dblRho, - final double dblKappa, - final double dblSigma, - final double dblTheta, - final double dblLambda, - final int iMultiValuePhaseTrackerType) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblRho = dblRho) || - !org.drip.quant.common.NumberUtil.IsValid (_dblKappa = dblKappa) || - !org.drip.quant.common.NumberUtil.IsValid (_dblSigma = dblSigma) || - !org.drip.quant.common.NumberUtil.IsValid (_dblTheta = dblTheta) || - !org.drip.quant.common.NumberUtil.IsValid (_dblLambda = dblLambda)) - throw new java.lang.Exception ("HestonOptionPricerParams ctr: Invalid Inputs!"); - - _iPayoffTransformScheme = iPayoffTransformScheme; - _iMultiValuePhaseTrackerType = iMultiValuePhaseTrackerType; - } - - /** - * Retrieve Kappa - * - * @return The Kappa - */ - - public double kappa() - { - return _dblKappa; - } - - /** - * Retrieve Lambda - * - * @return The Lambda - */ - - public double lambda() - { - return _dblLambda; - } - - /** - * Retrieve Rho - * - * @return The Rho - */ - - public double rho() - { - return _dblRho; - } - - /** - * Retrieve Sigma - * - * @return The Sigma - */ - - public double sigma() - { - return _dblSigma; - } - - /** - * Retrieve Theta - * - * @return The Theta - */ - - public double theta() - { - return _dblTheta; - } - - /** - * Return the Multi Valued Principal Branch Maintaining Phase Tracker Type - * - * @return The Multi Valued Principal Branch Maintaining Phase Tracker Type - */ - - public int phaseTrackerType() - { - return _iMultiValuePhaseTrackerType; - } - - /** - * Return the Payoff Fourier Transformation Scheme - * - * @return The Payoff Fourier Transformation Scheme - */ - - public int payoffTransformScheme() - { - return _iPayoffTransformScheme; - } -} diff --git a/org/drip/param/pricer/PricerParams.java b/org/drip/param/pricer/PricerParams.java deleted file mode 100644 index 06847e7..0000000 --- a/org/drip/param/pricer/PricerParams.java +++ /dev/null @@ -1,58 +0,0 @@ - -package org.drip.param.pricer; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * GenericPricerParams exposes the Parameters needed for the Pricing Run. - * - * @author Lakshmi Krishnamurthy - */ - -public interface PricerParams { -} diff --git a/org/drip/param/quote/MultiSided.java b/org/drip/param/quote/MultiSided.java deleted file mode 100644 index deeb39a..0000000 --- a/org/drip/param/quote/MultiSided.java +++ /dev/null @@ -1,202 +0,0 @@ - -package org.drip.param.quote; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * MultiSided implements the Quote interface, which contains the stubs corresponding to a product quote. It - * contains the quote value, quote instant for the different quote sides (bid/ask/mid). - * - * @author Lakshmi Krishnamurthy - */ - -public class MultiSided extends org.drip.param.definition.Quote { - class SingleSided { - double _dblSize = java.lang.Double.NaN; - double _dblQuote = java.lang.Double.NaN; - org.drip.analytics.date.DateTime _dt = null; - - SingleSided ( - final double dblQuote, - final double dblSize) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblQuote = dblQuote)) - throw new java.lang.Exception ("MultiSided::SingleSided ctr: Invalid Inputs!"); - - _dblSize = dblSize; - - _dt = new org.drip.analytics.date.DateTime(); - } - - double quote() - { - return _dblQuote; - } - - double size() - { - return _dblSize; - } - - org.drip.analytics.date.DateTime time() - { - return _dt; - } - - boolean setQuote ( - final double dblQuote) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblQuote)) return false; - - _dblQuote = dblQuote; - return true; - } - - boolean setSize ( - final double dblSize) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblSize)) return false; - - _dblSize = dblSize; - return true; - } - }; - - private org.drip.analytics.support.CaseInsensitiveTreeMap _mapSingleSidedQuote = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - /** - * MultiSidedQuote Constructor: Constructs a Quote object from the quote value and the side string. - * - * @param strSide bid/ask/mid - * @param dblQuote Quote Value - * - * @throws java.lang.Exception Thrown on invalid inputs - */ - - public MultiSided ( - final java.lang.String strSide, - final double dblQuote) - throws java.lang.Exception - { - if (null == strSide || strSide.isEmpty() || !org.drip.quant.common.NumberUtil.IsValid (dblQuote)) - throw new java.lang.Exception ("MultiSided ctr: Invalid Side/Quote/Size!"); - - _mapSingleSidedQuote.put (strSide, new SingleSided (dblQuote, java.lang.Double.NaN)); - } - - /** - * MultiSided Constructor: Constructs a Quote object from the quote size/value and the side string. - * - * @param strSide bid/ask/mid - * @param dblQuote Quote Value - * @param dblSize Size - * - * @throws java.lang.Exception Thrown on invalid inputs - */ - - public MultiSided ( - final java.lang.String strSide, - final double dblQuote, - final double dblSize) - throws java.lang.Exception - { - if (null == strSide || strSide.isEmpty() || !org.drip.quant.common.NumberUtil.IsValid (dblQuote)) - throw new java.lang.Exception ("MultiSided ctr: Invalid Side/Quote/Size!"); - - _mapSingleSidedQuote.put (strSide, new SingleSided (dblQuote, dblSize)); - } - - @Override public double value ( - final java.lang.String strSide) - { - if (null == strSide || strSide.isEmpty()) return java.lang.Double.NaN; - - return _mapSingleSidedQuote.get (strSide).quote(); - } - - @Override public double size ( - final java.lang.String strSide) - { - if (null == strSide || strSide.isEmpty()) return java.lang.Double.NaN; - - return _mapSingleSidedQuote.get (strSide).size(); - } - - @Override public org.drip.analytics.date.DateTime time ( - final java.lang.String strSide) - { - if (null == strSide || strSide.isEmpty()) return null; - - return _mapSingleSidedQuote.get (strSide).time(); - } - - @Override public boolean setSide ( - final java.lang.String strSide, - final double dblQuote, - final double dblSize) - { - if (null != strSide && !strSide.isEmpty() && !org.drip.quant.common.NumberUtil.IsValid (dblQuote)) - return false; - - try { - _mapSingleSidedQuote.put (strSide, new SingleSided (dblQuote, dblSize)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - return true; - } -} diff --git a/org/drip/param/quote/ProductMultiMeasure.java b/org/drip/param/quote/ProductMultiMeasure.java deleted file mode 100644 index 807fc6c..0000000 --- a/org/drip/param/quote/ProductMultiMeasure.java +++ /dev/null @@ -1,145 +0,0 @@ - -package org.drip.param.quote; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * ProductMultiMeasureQuote holds the different types of quotes for a given component. It contains a single - * market field/quote pair, but multiple alternate named quotes (to accommodate quotes on different measures - * for the component). - * - * @author Lakshmi Krishnamurthy - */ - -public class ProductMultiMeasure extends org.drip.param.definition.ProductQuote { - private java.lang.String _strMarketQuoteField = ""; - private org.drip.param.definition.Quote _mktQuote = null; - - org.drip.analytics.support.CaseInsensitiveTreeMap _mapQuote = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - /** - * Construct an empty instance of ProductMultiMeasure - */ - - public ProductMultiMeasure() - { - } - - @Override public void addQuote ( - final java.lang.String strQuoteField, - final org.drip.param.definition.Quote q, - final boolean bIsMarketQuote) - { - _mapQuote.put (strQuoteField, q); - - if (bIsMarketQuote) { - _mktQuote = q; - _strMarketQuoteField = strQuoteField; - } - } - - @Override public boolean setMarketQuote ( - final java.lang.String strMarketQuoteField, - final org.drip.param.definition.Quote q) - { - if (null == strMarketQuoteField || strMarketQuoteField.isEmpty() || null == q) return false; - - _strMarketQuoteField = strMarketQuoteField; - _mktQuote = q; - return true; - } - - @Override public boolean removeMarketQuote() - { - _strMarketQuoteField = ""; - _mktQuote = null; - return true; - } - - @Override public org.drip.param.definition.Quote quote ( - final java.lang.String strQuoteField) - { - return null == strQuoteField || strQuoteField.isEmpty() ? null : _mapQuote.get (strQuoteField); - } - - @Override public org.drip.param.definition.Quote marketQuote() - { - return _mktQuote; - } - - @Override public java.lang.String marketQuoteField() - { - return _strMarketQuoteField; - } - - @Override public boolean removeQuote ( - final java.lang.String strQuoteField) - { - if (null == strQuoteField || strQuoteField.isEmpty()) return false; - - _mapQuote.remove (strQuoteField); - - if (!_strMarketQuoteField.equalsIgnoreCase (strQuoteField)) return true; - - return removeMarketQuote(); - } - - @Override public boolean containsQuote ( - final java.lang.String strQuoteField) - { - if (null == strQuoteField || strQuoteField.isEmpty()) return false; - - return _mapQuote.containsKey (strQuoteField) || (null != _strMarketQuoteField && - _strMarketQuoteField.equalsIgnoreCase (strQuoteField)); - } -} diff --git a/org/drip/param/quote/ProductTick.java b/org/drip/param/quote/ProductTick.java deleted file mode 100644 index 10d279f..0000000 --- a/org/drip/param/quote/ProductTick.java +++ /dev/null @@ -1,157 +0,0 @@ - -package org.drip.param.quote; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * ProductTick holds the tick related product parameters - it contains the product ID, the quote composite, - * the source, the counter party, and whether the quote can be treated as a mark. - * - * @author Lakshmi Krishnamurthy - */ - -public class ProductTick { - private boolean _bIsMark = false; - private java.lang.String _strSource = ""; - private java.lang.String _strProductID = ""; - private java.lang.String _strCounterParty = ""; - private org.drip.param.definition.ProductQuote _pq = null; - - /** - * Empty ProductTick constructor - */ - - public ProductTick() - { - } - - /** - * ProductTick constructor - * - * @param strProductID Product ID - * @param pq Product Quote - * @param strCounterParty Counter Party - * @param strSource Quote Source - * @param bIsMark TRUE - This Quote may be treated as a Mark - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public ProductTick ( - final java.lang.String strProductID, - final org.drip.param.definition.ProductQuote pq, - final java.lang.String strCounterParty, - final java.lang.String strSource, - final boolean bIsMark) - throws java.lang.Exception - { - if (null == (_strProductID = strProductID) || _strProductID.isEmpty() || null == (_pq = pq)) - throw new java.lang.Exception ("ProductTick ctr: Invalid Inputs"); - - _bIsMark = bIsMark; - _strSource = strSource; - _strCounterParty = strCounterParty; - } - - /** - * Retrieve the Product ID - * - * @return Product ID - */ - - public java.lang.String productID() - { - return _strProductID; - } - - /** - * Retrieve the Product Quote - * - * @return Product Quote - */ - - public org.drip.param.definition.ProductQuote productQuote() - { - return _pq; - } - - /** - * Retrieve the Quote Source - * - * @return Quote Source - */ - - public java.lang.String source() - { - return _strSource; - } - - /** - * Retrieve the Counter Party - * - * @return Counter Party - */ - - public java.lang.String counterParty() - { - return _strCounterParty; - } - - /** - * Indicate whether the quote may be treated as a mark - * - * @return TRUE - Treat the Quote as a Mark - */ - - public boolean isMark() - { - return _bIsMark; - } -} diff --git a/org/drip/param/quoting/MeasureInterpreter.java b/org/drip/param/quoting/MeasureInterpreter.java deleted file mode 100644 index 3ea99ba..0000000 --- a/org/drip/param/quoting/MeasureInterpreter.java +++ /dev/null @@ -1,61 +0,0 @@ - -package org.drip.param.quoting; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * MeasureInterpreter is the abstract shell stub class from which all product measure quoting parameters are - * derived. It contains fields needed to interpret a measure quote. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class MeasureInterpreter { -} diff --git a/org/drip/param/quoting/QuotedSpreadInterpreter.java b/org/drip/param/quoting/QuotedSpreadInterpreter.java deleted file mode 100644 index d93885f..0000000 --- a/org/drip/param/quoting/QuotedSpreadInterpreter.java +++ /dev/null @@ -1,126 +0,0 @@ - -package org.drip.param.quoting; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * QuotedSpreadInterpreter holds the fields needed to interpret a Quoted Spread Quote. It contains the - * contract type and the coupon. - * - * @author Lakshmi Krishnamurthy - */ - -public class QuotedSpreadInterpreter extends org.drip.param.quoting.MeasureInterpreter { - - /** - * SNAC CDS Contract - */ - - public static final java.lang.String SNAC_CDS = "SNAC"; - - /** - * Conventional CDS Contract - */ - - public static final java.lang.String CONV_CDS = "CONV"; - - /** - * STEM CDS Contract - */ - - public static final java.lang.String STEM_CDS = "CONV"; - - private java.lang.String _strCDSContractType = ""; - private double _dblCouponStrike = java.lang.Double.NaN; - - /** - * QuotedSpreadInterpreter constructor - * - * @param strCDSContractType The CDS Contract Type - * @param dblCouponStrike The Coupon Strike - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public QuotedSpreadInterpreter ( - final java.lang.String strCDSContractType, - final double dblCouponStrike) - throws java.lang.Exception - { - if (null == (_strCDSContractType = strCDSContractType) || (!CONV_CDS.equalsIgnoreCase - (_strCDSContractType) && !SNAC_CDS.equalsIgnoreCase (_strCDSContractType) && - !STEM_CDS.equalsIgnoreCase (_strCDSContractType))) - throw new java.lang.Exception ("QuotedSpreadInterpreter ctr: Invalid Inputs"); - - _dblCouponStrike = dblCouponStrike; - } - - /** - * Retrieve the CDS Contract Type - * - * @return The CDS Contract Type - */ - - public java.lang.String cdsContractType() - { - return _strCDSContractType; - } - - /** - * Retrieve the Coupon Strike - * - * @return The Coupon Strike - */ - - public double couponStrike() - { - return _dblCouponStrike; - } -} diff --git a/org/drip/param/quoting/YieldInterpreter.java b/org/drip/param/quoting/YieldInterpreter.java deleted file mode 100644 index fcf4c45..0000000 --- a/org/drip/param/quoting/YieldInterpreter.java +++ /dev/null @@ -1,174 +0,0 @@ - -package org.drip.param.quoting; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * YieldInterpreter holds the fields needed to interpret a Yield Quote. It contains the quote day count, - * quote frequency, quote EOM Adjustment, quote Act/Act parameters, and quote Calendar. - * - * @author Lakshmi Krishnamurthy - */ - -public class YieldInterpreter extends org.drip.param.quoting.MeasureInterpreter { - - /* - * Quote Day Count - */ - - private java.lang.String _strDC = ""; - - /* - * Quote Frequency - */ - - private int _iFreq = 0; - - /* - * Quote Apply EOM Adjustment? - */ - - private boolean _bApplyEOMAdj = false; - - /* - * Quote Act Act DC Params - */ - - private org.drip.analytics.daycount.ActActDCParams _aap = null; - - /* - * Quote Calendar - */ - - private java.lang.String _strCalendar = ""; - - /** - * Construct YieldInterpreter from the Day Count and the Frequency parameters - * - * @param strDC Quoting Day Count - * @param iFreq Quoting Frequency - * @param bApplyEOMAdj TRUE - Apply the EOM Adjustment - * @param aap The ActActDCParams Instance - * @param strCalendar The Calendar - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public YieldInterpreter ( - final java.lang.String strDC, - final int iFreq, - final boolean bApplyEOMAdj, - final org.drip.analytics.daycount.ActActDCParams aap, - final java.lang.String strCalendar) - throws java.lang.Exception - { - if (null == (_strDC = strDC) || _strDC.isEmpty() || 0 == (_iFreq = iFreq)) - throw new java.lang.Exception ("YieldInterpreter ctr: Invalid quoting params!"); - - _aap = aap; - _strCalendar = strCalendar; - _bApplyEOMAdj = bApplyEOMAdj; - } - - /** - * Retrieve the Day Count Convention - * - * @return The Day Count Convention - */ - - public java.lang.String dayCount() - { - return _strDC; - } - - /** - * Retrieve the Frequency - * - * @return The Frequency - */ - - public int freq() - { - return _iFreq; - } - - /** - * Retrieve the EOM Adjustment - * - * @return The EOM Adjustment - */ - - public boolean eomAdj() - { - return _bApplyEOMAdj; - } - - /** - * Retrieve the Act/Act Day Count Parameters - * - * @return The Act/Act Day Count Parameters - */ - - public org.drip.analytics.daycount.ActActDCParams aap() - { - return _aap; - } - - /** - * Retrieve the Calendar - * - * @return The Calendar - */ - - public java.lang.String calendar() - { - return _strCalendar; - } -} diff --git a/org/drip/param/valuation/CashSettleParams.java b/org/drip/param/valuation/CashSettleParams.java deleted file mode 100644 index 68a080d..0000000 --- a/org/drip/param/valuation/CashSettleParams.java +++ /dev/null @@ -1,132 +0,0 @@ - -package org.drip.param.valuation; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * CashSettleParams is the place-holder for the cash settlement parameters for a given product. It contains - * the cash settle lag, the calendar, and the date adjustment mode. - * - * @author Lakshmi Krishnamurthy - */ - -public class CashSettleParams { - private int _iLag = 3; - private java.lang.String _strCalendar = ""; - private int _iAdjustMode = org.drip.analytics.daycount.Convention.DATE_ROLL_FOLLOWING; - - /** - * Construct the CashSettleParams object from the settle lag and the settle calendar objects - * - * @param iLag Cash Settle Lag - * @param iAdjustMode Settle adjust Mode - * @param strCalendar Settlement Calendar - */ - - public CashSettleParams ( - final int iLag, - final java.lang.String strCalendar, - final int iAdjustMode) - { - _iLag = iLag; - _iAdjustMode = iAdjustMode; - _strCalendar = strCalendar; - } - - /** - * Retrieve the Settle Lag - * - * @return The Settle Lag - */ - - public int lag() - { - return _iLag; - } - - /** - * Retrieve the Settle Calendar - * - * @return The Settle Calendar - */ - - public java.lang.String calendar() - { - return _strCalendar; - } - - /** - * Retrieve the Adjustment Mode - * - * @return The Adjustment Mode - */ - - public int adjustMode() - { - return _iAdjustMode; - } - - /** - * Construct and return the cash settle date from the valuation date - * - * @param iValueDate Valuation Date - * - * @return Cash settle date - */ - - public int cashSettleDate ( - final int iValueDate) - { - return org.drip.analytics.daycount.Convention.Adjust (iValueDate + _iLag, _strCalendar, - _iAdjustMode); - } -} diff --git a/org/drip/param/valuation/ValuationCustomizationParams.java b/org/drip/param/valuation/ValuationCustomizationParams.java deleted file mode 100644 index 336d744..0000000 --- a/org/drip/param/valuation/ValuationCustomizationParams.java +++ /dev/null @@ -1,170 +0,0 @@ - -package org.drip.param.valuation; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * ValuationCustomizationParams holds the parameters needed to interpret the input quotes. It contains the - * quote day count, the quote frequency, the quote EOM Adjustment, the quote Act/Act parameters, the quote - * Calendar, the Core Collateralization Parameters, and the Switchable Alternate Collateralization - * Parameters. It also indicates if the native quote is spread based. - * - * @author Lakshmi Krishnamurthy - */ - -public class ValuationCustomizationParams { - private int _iYieldFrequency = 0; - private boolean _bSpreadQuoted = false; - private java.lang.String _strYieldDC = ""; - private boolean _bYieldApplyEOMAdj = false; - private java.lang.String _strYieldCalendar = ""; - private org.drip.analytics.daycount.ActActDCParams _aapYield = null; - - /** - * Construct ValuationCustomizationParams from the Day Count and the Frequency parameters - * - * @param strDC Quoting Day Count - * @param iFrequency Quoting Frequency - * @param bApplyEOMAdj TRUE - Apply the EOM Adjustment - * @param aap - Quoting Act/Act Parameters - * @param strCalendar - Quoting Calendar - * @param bSpreadQuoted - TRUE - Market Quotes are Spread Quoted - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public ValuationCustomizationParams ( - final java.lang.String strDC, - final int iFrequency, - final boolean bApplyEOMAdj, - final org.drip.analytics.daycount.ActActDCParams aap, - final java.lang.String strCalendar, - final boolean bSpreadQuoted) - throws java.lang.Exception - { - if (null == strDC || strDC.isEmpty() || 0 == iFrequency) - throw new java.lang.Exception ("ValuationCustomizationParams ctr: Invalid quoting params!"); - - _aapYield = aap; - _strYieldDC = strDC; - _iYieldFrequency = iFrequency; - _bSpreadQuoted = bSpreadQuoted; - _strYieldCalendar = strCalendar; - _bYieldApplyEOMAdj = bApplyEOMAdj; - } - - /** - * Retrieve the Yield Act Act Day Count Parameters - * - * @return The Yield Act Act Day Count Parameters - */ - - public org.drip.analytics.daycount.ActActDCParams yieldAAP() - { - return _aapYield; - } - - /** - * Retrieve the Yield Day Count - * - * @return The Yield Day Count - */ - - public java.lang.String yieldDayCount() - { - return _strYieldDC; - } - - /** - * Retrieve the Yield Frequency - * - * @return The Yield Frequency - */ - - public int yieldFreq() - { - return _iYieldFrequency; - } - - /** - * Indicate if spread Quoted - * - * @return TRUE - Spread Quoted - */ - - public boolean spreadQuoted() - { - return _bSpreadQuoted; - } - - /** - * Retrieve the Yield Calendar - * - * @return The Yield Calendar - */ - - public java.lang.String yieldCalendar() - { - return _strYieldCalendar; - } - - /** - * Indicate if EOM Adjustment is to be made for the Yield Calculation - * - * @return TRUE - EOM Adjustment is to be made for the Yield Calculation - */ - - public boolean applyYieldEOMAdj() - { - return _bYieldApplyEOMAdj; - } -} diff --git a/org/drip/param/valuation/ValuationParams.java b/org/drip/param/valuation/ValuationParams.java deleted file mode 100644 index cf849a2..0000000 --- a/org/drip/param/valuation/ValuationParams.java +++ /dev/null @@ -1,193 +0,0 @@ - -package org.drip.param.valuation; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * ValuationParams is the place-holder for the valuation parameters for a given product. It contains the - * valuation and the cash pay/settle dates, as well as the calendar. It also exposes a number of methods to - * construct standard valuation parameters. - * - * @author Lakshmi Krishnamurthy - */ - -public class ValuationParams { - private java.lang.String _strCalendar = ""; - private int _iValueDate = java.lang.Integer.MIN_VALUE; - private int _iCashPayDate = java.lang.Integer.MIN_VALUE; - - /** - * Create the valuation parameters object instance from the valuation date, the cash settle lag, and the - * settle calendar. - * - * @param dtValue Valuation Date - * @param iCashSettleLag Cash settle lag - * @param strCalendar Calendar Set - * @param iAdjustMode The Adjustment Mode Flag - * - * @return Valuation Parameters instance - */ - - public static final ValuationParams Spot ( - final org.drip.analytics.date.JulianDate dtValue, - final int iCashSettleLag, - final java.lang.String strCalendar, - final int iAdjustMode) - { - try { - return null == dtValue ? null : new ValuationParams (dtValue, new - org.drip.analytics.date.JulianDate (org.drip.analytics.daycount.Convention.Adjust - (dtValue.addDays (iCashSettleLag).julian(), strCalendar, iAdjustMode)), strCalendar); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create the spot valuation parameters for the given valuation date (uses the T+0 settle) - * - * @param iDate Valuation Date - * - * @return Valuation Parameters instance - */ - - public static final ValuationParams Spot ( - final int iDate) - { - org.drip.analytics.date.JulianDate dtValue = new org.drip.analytics.date.JulianDate (iDate); - - try { - return new ValuationParams (dtValue, dtValue, ""); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create the standard T+2B settle parameters for the given valuation date and calendar - * - * @param dtValue Valuation Date - * @param strCalendar Settle Calendar - * - * @return Valuation Parameters instance - */ - - public static final ValuationParams Standard ( - final org.drip.analytics.date.JulianDate dtValue, - final java.lang.String strCalendar) - { - return Spot (dtValue, 2, strCalendar, org.drip.analytics.daycount.Convention.DATE_ROLL_FOLLOWING); - } - - /** - * Construct ValuationParams from the Valuation Date and the Cash Pay Date parameters - * - * @param dtValue Valuation Date - * @param dtCashPay Cash Pay Date - * @param strCalendar Calendar Set - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public ValuationParams ( - final org.drip.analytics.date.JulianDate dtValue, - final org.drip.analytics.date.JulianDate dtCashPay, - final java.lang.String strCalendar) - throws java.lang.Exception - { - if (null == dtValue || null == dtCashPay) - throw new java.lang.Exception ("ValuationParams ctr: Invalid settle/Cash pay into Val Params!"); - - _iValueDate = dtValue.julian(); - - _iCashPayDate = dtCashPay.julian(); - - _strCalendar = strCalendar; - } - - /** - * Retrieve the Valuation Date - * - * @return The Valuation Date - */ - - public int valueDate() - { - return _iValueDate; - } - - /** - * Retrieve the Cash Pay Date - * - * @return The Cash Pay Date - */ - - public int cashPayDate() - { - return _iCashPayDate; - } - - /** - * Retrieve the Calendar - * - * @return The Calendar - */ - - public java.lang.String calendar() - { - return _strCalendar; - } -} diff --git a/org/drip/param/valuation/WorkoutInfo.java b/org/drip/param/valuation/WorkoutInfo.java deleted file mode 100644 index 021da44..0000000 --- a/org/drip/param/valuation/WorkoutInfo.java +++ /dev/null @@ -1,156 +0,0 @@ - -package org.drip.param.valuation; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * WorkoutInfo is the place-holder for the work-out parameters. It contains the date, the factor, the type, - * and the yield of the work-out. - * - * @author Lakshmi Krishnamurthy - */ - -public class WorkoutInfo { - - /** - * Work out type Call - */ - - public static final int WO_TYPE_CALL = 1; - - /** - * Work out type Put - */ - - public static final int WO_TYPE_PUT = 2; - - /** - * Work out type Maturity - */ - - public static final int WO_TYPE_MATURITY = 3; - - private int _iWOType = WO_TYPE_MATURITY; - private int _iDate = java.lang.Integer.MIN_VALUE; - private double _dblYield = java.lang.Double.NaN; - private double _dblExerciseFactor = java.lang.Double.NaN; - - /** - * Constructor: Construct the class from the work-out date, yield, exercise factor, and type - * - * @param iDate Work-out Date - * @param dblYield Work-out Yield - * @param dblExerciseFactor Work-out Factor - * @param iWOType Work out Type - * - * @throws java.lang.Exception Thrown if input is invalid - */ - - public WorkoutInfo ( - final int iDate, - final double dblYield, - final double dblExerciseFactor, - final int iWOType) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblYield = dblYield) || - !org.drip.quant.common.NumberUtil.IsValid (_dblExerciseFactor = dblExerciseFactor)) - throw new java.lang.Exception ("WorkoutInfo ctr: One of wkout dat/yld/ex factor came out NaN!"); - - _iDate = iDate; - _iWOType = iWOType; - } - - /** - * Retrieve the Work-out Date - * - * @return The Work-out Date - */ - - public int date() - { - return _iDate; - } - - /** - * Retrieve the Work-out Yield - * - * @return The Work-out Yield - */ - - public double yield() - { - return _dblYield; - } - - /** - * Retrieve the Work-out Factor - * - * @return The Work-out Factor - */ - - public double factor() - { - return _dblExerciseFactor; - } - - /** - * Retrieve the Work-out Type - * - * @return The Work-out Type - */ - - public int type() - { - return _iWOType; - } -} diff --git a/org/drip/portfolioconstruction/allocator/BoundedPortfolioConstructionParameters.java b/org/drip/portfolioconstruction/allocator/BoundedPortfolioConstructionParameters.java deleted file mode 100644 index 4edc4cd..0000000 --- a/org/drip/portfolioconstruction/allocator/BoundedPortfolioConstructionParameters.java +++ /dev/null @@ -1,268 +0,0 @@ - -package org.drip.portfolioconstruction.allocator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * BoundedPortfolioConstructionParameters holds the Parameters needed to build the Portfolio with Bounds on - * the Underlying Assets. - * - * @author Lakshmi Krishnamurthy - */ - -public class BoundedPortfolioConstructionParameters extends - org.drip.portfolioconstruction.allocator.PortfolioConstructionParameters { - private org.drip.analytics.support.CaseInsensitiveHashMap - _mapBounds = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - /** - * BoundedPortfolioConstructionParameters Constructor - * - * @param astrAssetID Array of Assets ID - * @param qcru The Quadratic Custom Risk Utility Settings - * @param pecs The Portfolio Equality Constraint Settings - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BoundedPortfolioConstructionParameters ( - final java.lang.String[] astrAssetID, - final org.drip.portfolioconstruction.allocator.CustomRiskUtilitySettings qcru, - final org.drip.portfolioconstruction.allocator.PortfolioEqualityConstraintSettings pecs) - throws java.lang.Exception - { - super (astrAssetID, qcru, pecs); - } - - /** - * Set the Bounds for the specified Asset - * - * @param strAssetID The Asset ID - * @param dblLowerBound The Asset Share Lower Bound - * @param dblUpperBound The Asset Share Upper Bound - * - * @return TRUE - The Asset Bounds successfully set - */ - - public boolean addBound ( - final java.lang.String strAssetID, - final double dblLowerBound, - final double dblUpperBound) - { - if (null == strAssetID || strAssetID.isEmpty()) return false; - - try { - _mapBounds.put (strAssetID, new org.drip.portfolioconstruction.asset.AssetBounds (dblLowerBound, - dblUpperBound)); - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - /** - * Retrieve the Lower Bound for the Specified Asset ID - * - * @param strAssetID The Asset ID - * - * @return The Lower Bound for the Specified Asset ID - * - * @throws java.lang.Exception Thrown if the Bound cannot be extracted - */ - - public double lowerBound ( - final java.lang.String strAssetID) - throws java.lang.Exception - { - if (!_mapBounds.containsKey (strAssetID)) - throw new java.lang.Exception - ("BoundedPortfolioConstructionParameters::lowerBound => Invalid Inputs"); - - return _mapBounds.get (strAssetID).lower(); - } - - /** - * Retrieve the Upper Bound for the Specified Asset ID - * - * @param strAssetID The Asset ID - * - * @return The Upper Bound for the Specified Asset ID - * - * @throws java.lang.Exception Thrown if the Bound cannot be extracted - */ - - public double upperBound ( - final java.lang.String strAssetID) - throws java.lang.Exception - { - if (!_mapBounds.containsKey (strAssetID)) - throw new java.lang.Exception - ("BoundedPortfolioConstructionParameters::upperBound => Invalid Inputs"); - - return _mapBounds.get (strAssetID).upper(); - } - - /** - * Retrieve the Array of the Inequality Constraint Functions - * - * @param iNumExtraneousVariate Number of Extraneous Variatea - * - * @return The Array of the Inequality Constraint Functions - */ - - public org.drip.function.rdtor1.AffineBoundMultivariate[] boundingConstraints ( - final int iNumExtraneousVariate) - { - java.lang.String[] astrAssetID = assets(); - - int iNumAsset = astrAssetID.length; - - java.util.List lsRdToR1 = new - java.util.ArrayList(); - - for (int i = 0; i < iNumAsset; ++i) { - if (!_mapBounds.containsKey (astrAssetID[i])) continue; - - org.drip.portfolioconstruction.asset.AssetBounds ab = _mapBounds.get (astrAssetID[i]); - - double dblLowerBound = ab.lower(); - - double dblUpperBound = ab.upper(); - - try { - if (org.drip.quant.common.NumberUtil.IsValid (dblLowerBound)) - lsRdToR1.add (new org.drip.function.rdtor1.AffineBoundMultivariate (false, i, iNumAsset + - iNumExtraneousVariate, dblLowerBound)); - - if (org.drip.quant.common.NumberUtil.IsValid (dblUpperBound)) - lsRdToR1.add (new org.drip.function.rdtor1.AffineBoundMultivariate (true, i, iNumAsset + - iNumExtraneousVariate, dblUpperBound)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - int iNumConstraint = lsRdToR1.size(); - - if (0 == iNumConstraint) return null; - - org.drip.function.rdtor1.AffineBoundMultivariate[] aRdToR1Constraint = new - org.drip.function.rdtor1.AffineBoundMultivariate[iNumConstraint]; - - for (int i = 0; i < iNumConstraint; ++i) - aRdToR1Constraint[i] = lsRdToR1.get (i); - - return aRdToR1Constraint; - } - - /** - * Retrieve an Array of Viable Starting Variates From Within the Feasible Region - * - * @return An Array of Viable Starting Variates From Within the Feasible Region - */ - - public double[] feasibleStart() - { - boolean bReturnsConstraintPresent = org.drip.quant.common.NumberUtil.IsValid - (constraintSettings().returnsConstraint()); - - java.lang.String[] astrAssetID = assets(); - - int iNumAsset = astrAssetID.length; - double[] adblStartingVariate = new double[iNumAsset + (bReturnsConstraintPresent ? 2 : 1)]; - - for (int i = 0; i < iNumAsset; ++i) - adblStartingVariate[i] = _mapBounds.get (astrAssetID[i]).feasibleStart(); - - if (bReturnsConstraintPresent) adblStartingVariate[iNumAsset + 1] = 0.; - - adblStartingVariate[iNumAsset] = 0.; - return adblStartingVariate; - } - - /** - * Retrieve an Array of Viable Weight Constrained Starting Variates From Within the Feasible Region - * - * @return An Array of Viable Weight Constrained Starting Variates From Within the Feasible Region - */ - - public double[] weightConstrainedFeasibleStart() - { - boolean bReturnsConstraintPresent = org.drip.quant.common.NumberUtil.IsValid - (constraintSettings().returnsConstraint()); - - java.lang.String[] astrAssetID = assets(); - - double dblCumulativeWeight = 0.; - int iNumAsset = astrAssetID.length; - double[] adblStartingVariate = new double[iNumAsset + (bReturnsConstraintPresent ? 2 : 1)]; - - for (int i = 0; i < iNumAsset; ++i) { - adblStartingVariate[i] = _mapBounds.get (astrAssetID[i]).lower(); - - dblCumulativeWeight += adblStartingVariate[i]; - } - - if (1. < dblCumulativeWeight) return null; - - double dblWeightGap = (1. - dblCumulativeWeight) / iNumAsset; - - for (int i = 0; i < iNumAsset; ++i) - adblStartingVariate[i] += dblWeightGap; - - if (bReturnsConstraintPresent) adblStartingVariate[iNumAsset + 1] = 0.; - - adblStartingVariate[iNumAsset] = 0.; - return adblStartingVariate; - } -} diff --git a/org/drip/portfolioconstruction/allocator/ConstrainedMeanVarianceOptimizer.java b/org/drip/portfolioconstruction/allocator/ConstrainedMeanVarianceOptimizer.java deleted file mode 100644 index 86e835c..0000000 --- a/org/drip/portfolioconstruction/allocator/ConstrainedMeanVarianceOptimizer.java +++ /dev/null @@ -1,264 +0,0 @@ - -package org.drip.portfolioconstruction.allocator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ConstrainedMeanVarianceOptimizer builds an Optimal Portfolio Based on MPT Using the Asset Pool Statistical - * Properties with the Specified Lower/Upper Bounds on the Component Assets. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConstrainedMeanVarianceOptimizer extends - org.drip.portfolioconstruction.allocator.MeanVarianceOptimizer { - private org.drip.function.rdtor1descent.LineStepEvolutionControl _lsec = null; - private org.drip.function.rdtor1solver.InteriorPointBarrierControl _ipbc = null; - - protected org.drip.portfolioconstruction.allocator.PortfolioConstructionParameters constrainedPCP ( - final org.drip.portfolioconstruction.allocator.PortfolioConstructionParameters pcpDesign, - final double dblReturnsConstraint) - { - java.lang.String[] astrAssetID = pcpDesign.assets(); - - org.drip.portfolioconstruction.allocator.BoundedPortfolioConstructionParameters bpcp = - (org.drip.portfolioconstruction.allocator.BoundedPortfolioConstructionParameters) pcpDesign; - - try { - org.drip.portfolioconstruction.allocator.BoundedPortfolioConstructionParameters bpcpMB = new - org.drip.portfolioconstruction.allocator.BoundedPortfolioConstructionParameters (astrAssetID, - pcpDesign.optimizerSettings(), new - org.drip.portfolioconstruction.allocator.PortfolioEqualityConstraintSettings - (pcpDesign.constraintSettings().constraintType() | - org.drip.portfolioconstruction.allocator.PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblReturnsConstraint)); - - for (int i = 0; i < astrAssetID.length; ++i) { - if (!bpcpMB.addBound (astrAssetID[i], bpcp.lowerBound (astrAssetID[i]), bpcp.upperBound - (astrAssetID[i]))) - return null; - } - - return bpcpMB; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * ConstrainedMeanVarianceOptimizer Constructor - * - * @param ipbc Interior Fixed Point Barrier Control Parameters - * @param lsec Line Step Evolution Control Parameters - */ - - public ConstrainedMeanVarianceOptimizer ( - final org.drip.function.rdtor1solver.InteriorPointBarrierControl ipbc, - final org.drip.function.rdtor1descent.LineStepEvolutionControl lsec) - { - if (null == (_ipbc = ipbc)) - _ipbc = org.drip.function.rdtor1solver.InteriorPointBarrierControl.Standard(); - - _lsec = lsec; - } - - @Override public org.drip.portfolioconstruction.allocator.OptimizationOutput longOnlyMaximumReturnsAllocate - (final org.drip.portfolioconstruction.allocator.PortfolioConstructionParameters pcp, - final org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties ausp) - { - if (null == pcp || !(pcp instanceof - org.drip.portfolioconstruction.allocator.BoundedPortfolioConstructionParameters) || null == ausp) - return null; - - java.lang.String[] astrAssetID = pcp.assets(); - - int iPortfolioAssetIndex = 0; - double dblCumulativeWeight = 0.; - int iNumAsset = astrAssetID.length; - org.drip.portfolioconstruction.asset.AssetComponent[] aAC = new - org.drip.portfolioconstruction.asset.AssetComponent[iNumAsset]; - org.drip.portfolioconstruction.allocator.BoundedPortfolioConstructionParameters bpcp = - (org.drip.portfolioconstruction.allocator.BoundedPortfolioConstructionParameters) pcp; - - double[] adblExpectedAssetReturns = ausp.expectedReturns (astrAssetID); - - if (null == adblExpectedAssetReturns || iNumAsset != adblExpectedAssetReturns.length) return null; - - java.util.TreeMap mapAssetReturns = new - java.util.TreeMap(); - - for (int i = 0; i < iNumAsset; ++i) - mapAssetReturns.put (adblExpectedAssetReturns[i], astrAssetID[i]); - - java.util.Set setAssetReturns = mapAssetReturns.descendingKeySet(); - - for (double dblAssetReturns : setAssetReturns) { - double dblAssetWeight = 0.; - - java.lang.String strAssetID = mapAssetReturns.get (dblAssetReturns); - - try { - if (1. > dblCumulativeWeight) { - double dblMaxAssetWeight = bpcp.upperBound (strAssetID); - - double dblMaxAllowedAssetWeight = 1. - dblCumulativeWeight; - - if (!org.drip.quant.common.NumberUtil.IsValid (dblMaxAssetWeight)) - dblMaxAssetWeight = dblMaxAllowedAssetWeight; - - dblAssetWeight = dblMaxAssetWeight < dblMaxAllowedAssetWeight ? dblMaxAssetWeight : - dblMaxAllowedAssetWeight; - dblCumulativeWeight += dblAssetWeight; - } - - aAC[iPortfolioAssetIndex++] = new org.drip.portfolioconstruction.asset.AssetComponent - (strAssetID, dblAssetWeight); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return org.drip.portfolioconstruction.allocator.OptimizationOutput.Create (aAC, ausp); - } - - @Override public org.drip.portfolioconstruction.allocator.OptimizationOutput globalMinimumVarianceAllocate - (final org.drip.portfolioconstruction.allocator.PortfolioConstructionParameters pcp, - final org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties ausp) - { - if (null == pcp || !(pcp instanceof - org.drip.portfolioconstruction.allocator.BoundedPortfolioConstructionParameters) || null == ausp) - return null; - - java.lang.String[] astrAssetID = pcp.assets(); - - double[][] aadblCovariance = ausp.covariance (astrAssetID); - - if (null == aadblCovariance) return null; - - int iNumAsset = astrAssetID.length; - org.drip.portfolioconstruction.asset.AssetComponent[] aAC = new - org.drip.portfolioconstruction.asset.AssetComponent[iNumAsset]; - org.drip.portfolioconstruction.allocator.BoundedPortfolioConstructionParameters bpcp = - (org.drip.portfolioconstruction.allocator.BoundedPortfolioConstructionParameters) pcp; - - try { - org.drip.function.rdtor1.LagrangianMultivariate lm = new - org.drip.function.rdtor1.LagrangianMultivariate (pcp.optimizerSettings().riskObjectiveUtility - (astrAssetID, ausp), new org.drip.function.definition.RdToR1[] - {bpcp.fullyInvestedConstraint()}); - - org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier vcmt = new - org.drip.function.rdtor1solver.BarrierFixedPointFinder (lm, bpcp.boundingConstraints - (lm.constraintFunctionDimension()), _ipbc, _lsec).solve - (bpcp.weightConstrainedFeasibleStart()); - - if (null == vcmt) return null; - - double[] adblOptimalWeight = vcmt.variates(); - - for (int i = 0; i < iNumAsset; ++i) - aAC[i] = new org.drip.portfolioconstruction.asset.AssetComponent (astrAssetID[i], - adblOptimalWeight[i]); - - return org.drip.portfolioconstruction.allocator.OptimizationOutput.Create (aAC, ausp); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.portfolioconstruction.allocator.OptimizationOutput allocate ( - final org.drip.portfolioconstruction.allocator.PortfolioConstructionParameters pcp, - final org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties ausp) - { - if (null == pcp || !(pcp instanceof - org.drip.portfolioconstruction.allocator.BoundedPortfolioConstructionParameters) || null == ausp) - return null; - - java.lang.String[] astrAssetID = pcp.assets(); - - double[][] aadblCovariance = ausp.covariance (astrAssetID); - - if (null == aadblCovariance) return null; - - int iNumAsset = astrAssetID.length; - org.drip.portfolioconstruction.asset.AssetComponent[] aAC = new - org.drip.portfolioconstruction.asset.AssetComponent[iNumAsset]; - org.drip.portfolioconstruction.allocator.BoundedPortfolioConstructionParameters bpcp = - (org.drip.portfolioconstruction.allocator.BoundedPortfolioConstructionParameters) pcp; - - try { - org.drip.function.rdtor1.LagrangianMultivariate lm = new - org.drip.function.rdtor1.LagrangianMultivariate (pcp.optimizerSettings().riskObjectiveUtility - (astrAssetID, ausp), bpcp.equalityConstraintRdToR1 (ausp)); - - org.drip.function.rdtor1solver.VariateInequalityConstraintMultiplier vcmt = new - org.drip.function.rdtor1solver.BarrierFixedPointFinder (lm, bpcp.boundingConstraints - (lm.constraintFunctionDimension()), _ipbc, _lsec).solve - (bpcp.weightConstrainedFeasibleStart()); - - if (null == vcmt) return null; - - double[] adblOptimalWeight = vcmt.variates(); - - for (int i = 0; i < iNumAsset; ++i) - aAC[i] = new org.drip.portfolioconstruction.asset.AssetComponent (astrAssetID[i], - adblOptimalWeight[i]); - - return org.drip.portfolioconstruction.allocator.OptimizationOutput.Create (aAC, ausp); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/portfolioconstruction/allocator/CustomRiskUtilitySettings.java b/org/drip/portfolioconstruction/allocator/CustomRiskUtilitySettings.java deleted file mode 100644 index aa001f9..0000000 --- a/org/drip/portfolioconstruction/allocator/CustomRiskUtilitySettings.java +++ /dev/null @@ -1,213 +0,0 @@ - -package org.drip.portfolioconstruction.allocator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CustomRiskUtilitySettings contains the settings used to generate the Risk Objective Utility Function. It - * accommodates both the Risk Tolerance and Risk Aversion Variants. - * - * @author Lakshmi Krishnamurthy - */ - -public class CustomRiskUtilitySettings { - private double _dblRiskAversion = java.lang.Double.NaN; - private double _dblRiskTolerance = java.lang.Double.NaN; - - /** - * The Variance Minimizer CustomRiskUtilitySettings Instance - * - * @return The Variance Minimizer CustomRiskUtilitySettings Instance - */ - - public static final CustomRiskUtilitySettings VarianceMinimizer() - { - try { - return new CustomRiskUtilitySettings (1., 0.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * The Risk Tolerant Variance Minimizer CustomRiskUtilitySettings Instance - * - * @param dblRiskTolerance The Risk Tolerance Parameter - * - * @return The Risk Tolerant Variance Minimizer CustomRiskUtilitySettings Instance - */ - - public static final CustomRiskUtilitySettings RiskTolerant ( - final double dblRiskTolerance) - { - try { - return new CustomRiskUtilitySettings (1., dblRiskTolerance); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * The Risk Aversion Variance Minimizer CustomRiskUtilitySettings Instance - * - * @param dblRiskAversion The Risk Aversion Parameter - * - * @return The Risk Aversion Variance Minimizer CustomRiskUtilitySettings Instance - */ - - public static final CustomRiskUtilitySettings RiskAversion ( - final double dblRiskAversion) - { - try { - return new CustomRiskUtilitySettings (dblRiskAversion, 1.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * CustomRiskUtilitySettings Constructor - * - * @param dblRiskAversion The Risk Aversion Parameter - * @param dblRiskTolerance The Risk Tolerance Parameter - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CustomRiskUtilitySettings ( - final double dblRiskAversion, - final double dblRiskTolerance) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblRiskAversion = dblRiskAversion) || - !org.drip.quant.common.NumberUtil.IsValid (_dblRiskTolerance = dblRiskTolerance) || 0. > - _dblRiskTolerance) - throw new java.lang.Exception ("CustomRiskUtilitySettings Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Risk Aversion Factor - * - * @return The Risk Aversion Factor - */ - - public double riskAversion() - { - return _dblRiskAversion; - } - - /** - * Retrieve the Risk Tolerance Factor - * - * @return The Risk Tolerance Factor - */ - - public double riskTolerance() - { - return _dblRiskTolerance; - } - - /** - * Retrieve the Custom Risk Objective Utility Multivariate - * - * @param astrAssetID Array of the Asset IDs - * @param ausp The Asset Universe Statistical Properties Instance - * - * @return The Custom Risk Objective Utility Multivariate - */ - - public org.drip.function.definition.RdToR1 riskObjectiveUtility ( - final java.lang.String[] astrAssetID, - final org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties ausp) - { - if (null == astrAssetID || null == ausp) return null; - - int iNumAsset = astrAssetID.length; - double[] adblExpectedReturns = new double[iNumAsset]; - double[][] aadblCovariance = new double[iNumAsset][iNumAsset]; - org.drip.portfolioconstruction.params.AssetStatisticalProperties[] aASP = new - org.drip.portfolioconstruction.params.AssetStatisticalProperties[iNumAsset]; - - if (0 == iNumAsset) return null; - - for (int i = 0; i < iNumAsset; ++i) { - if (null == (aASP[i] = ausp.asp (astrAssetID[i]))) return null; - - adblExpectedReturns[i] = aASP[i].expectedReturn(); - } - - for (int i = 0; i < iNumAsset; ++i) { - double dblVarianceI = aASP[i].variance(); - - for (int j = 0; j < iNumAsset; ++j) { - try { - aadblCovariance[i][j] = java.lang.Math.sqrt (dblVarianceI * aASP[j].variance()) * (i == j - ? 1. : ausp.correlation (astrAssetID[i], astrAssetID[j])); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - } - - try { - return new org.drip.function.rdtor1.RiskObjectiveUtilityMultivariate (aadblCovariance, - adblExpectedReturns, _dblRiskAversion, _dblRiskTolerance, ausp.riskFreeRate()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/portfolioconstruction/allocator/ForwardReverseOptimizationOutput.java b/org/drip/portfolioconstruction/allocator/ForwardReverseOptimizationOutput.java deleted file mode 100644 index 02ae39c..0000000 --- a/org/drip/portfolioconstruction/allocator/ForwardReverseOptimizationOutput.java +++ /dev/null @@ -1,291 +0,0 @@ - -package org.drip.portfolioconstruction.allocator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ForwardReverseOptimizationOutput holds the Metrics that result from a Forward/Reverse Optimization Run. - * - * @author Lakshmi Krishnamurthy - */ - -public class ForwardReverseOptimizationOutput extends - org.drip.portfolioconstruction.allocator.OptimizationOutput { - private double _dblRiskAversion = java.lang.Double.NaN; - private double[] _adblExpectedAssetExcessReturns = null; - private double[][] _aadblAssetExcessReturnsCovariance = null; - - /** - * Construct an Instance of ForwardReverseOptimizationOutput from a Standard Reverse Optimize Operation - * - * @param pfEquilibrium The Equilibrium Portfolio - * @param aadblAssetExcessReturnsCovariance Pair-wse Asset Excess Returns Co-variance Matrix - * @param dblRiskAversion The Risk Aversion Parameter - * - * @return The Instance of ForwardReverseOptimizationOutput from a Standard Reverse Optimize Operation - */ - - public static final ForwardReverseOptimizationOutput Reverse ( - final org.drip.portfolioconstruction.asset.Portfolio pfEquilibrium, - final double[][] aadblAssetExcessReturnsCovariance, - final double dblRiskAversion) - { - if (null == pfEquilibrium) return null; - - double[] adblAssetWeight = pfEquilibrium.weights(); - - int iNumAsset = adblAssetWeight.length; - - double[] adblExpectedAssetExcessReturns = org.drip.quant.linearalgebra.Matrix.Product - (aadblAssetExcessReturnsCovariance, pfEquilibrium.weights()); - - if (null == adblExpectedAssetExcessReturns); - - for (int i = 0; i < iNumAsset; ++i) - adblExpectedAssetExcessReturns[i] = adblExpectedAssetExcessReturns [i] * dblRiskAversion; - - return ForwardReverseOptimizationOutput.Standard (pfEquilibrium, dblRiskAversion, - aadblAssetExcessReturnsCovariance, adblExpectedAssetExcessReturns); - } - - /** - * Construct an Instance of ForwardReverseOptimizationOutput from a Standard Forward Optimize Operation - * - * @param astrAssetID The Array of the Assets in the Portfolio - * @param adblExpectedAssetExcessReturns Array of Expected Excess Returns - * @param aadblAssetExcessReturnsCovariance Excess Returns Co-variance Matrix - * @param dblRiskAversion The Risk Aversion Parameter - * - * @return The Instance of ForwardReverseOptimizationOutput from a Standard Forward Optimize Operation - */ - - public static final ForwardReverseOptimizationOutput Forward ( - final java.lang.String[] astrAssetID, - final double[] adblExpectedAssetExcessReturns, - final double[][] aadblAssetExcessReturnsCovariance, - final double dblRiskAversion) - { - if (null == astrAssetID) return null; - - int iNumAsset = astrAssetID.length; - - double[] adblAssetWeight = org.drip.quant.linearalgebra.Matrix.Product - (org.drip.quant.linearalgebra.Matrix.InvertUsingGaussianElimination - (aadblAssetExcessReturnsCovariance), adblExpectedAssetExcessReturns); - - if (null == adblAssetWeight || iNumAsset != adblAssetWeight.length) return null; - - for (int i = 0; i < iNumAsset; ++i) - adblAssetWeight[i] = adblAssetWeight[i] / dblRiskAversion; - - return ForwardReverseOptimizationOutput.Standard - (org.drip.portfolioconstruction.asset.Portfolio.Standard (astrAssetID, adblAssetWeight), - dblRiskAversion, aadblAssetExcessReturnsCovariance, adblExpectedAssetExcessReturns); - } - - /** - * Construct a Standard Instance of ForwardReverseOptimizationOutput - * - * @param pfOptimal The Optimal Equilibrium Portfolio - * @param dblRiskAversion The Risk Aversion Parameter - * @param aadblAssetExcessReturnsCovariance Pair-wise Asset Excess Returns Co-variance Matrix - * @param adblExpectedAssetExcessReturns Array of Expected Excess Returns - * - * @return The Standard Instance of ForwardReverseOptimizationOutput - */ - - public static final ForwardReverseOptimizationOutput Standard ( - final org.drip.portfolioconstruction.asset.Portfolio pfOptimal, - final double dblRiskAversion, - final double[][] aadblAssetExcessReturnsCovariance, - final double[] adblExpectedAssetExcessReturns) - { - if (null == pfOptimal || null == adblExpectedAssetExcessReturns) return null; - - double[] adblAssetWeight = pfOptimal.weights(); - - int iNumAsset = adblAssetWeight.length; - double dblPortfolioExcessReturnsMean = 0.; - double dblPortfolioExcessReturnsVariance = 0.; - - if (iNumAsset != adblExpectedAssetExcessReturns.length) return null; - - double[] adblImpliedBeta = org.drip.quant.linearalgebra.Matrix.Product - (aadblAssetExcessReturnsCovariance, adblAssetWeight); - - if (null == adblImpliedBeta) return null; - - for (int i = 0; i < iNumAsset; ++i) { - dblPortfolioExcessReturnsMean += adblAssetWeight[i] * adblExpectedAssetExcessReturns[i]; - - for (int j = 0; j < iNumAsset; ++j) - dblPortfolioExcessReturnsVariance += adblAssetWeight[i] * adblAssetWeight[j] * - aadblAssetExcessReturnsCovariance[i][j]; - } - - for (int i = 0; i < iNumAsset; ++i) - adblImpliedBeta[i] = adblImpliedBeta[i] / dblPortfolioExcessReturnsVariance; - - double dblPortfolioExcessReturnsSigma = java.lang.Math.sqrt (dblPortfolioExcessReturnsVariance); - - try { - return new ForwardReverseOptimizationOutput (pfOptimal, new - org.drip.portfolioconstruction.asset.PortfolioMetrics (dblPortfolioExcessReturnsMean, - dblPortfolioExcessReturnsVariance, dblPortfolioExcessReturnsSigma, - dblPortfolioExcessReturnsMean / dblPortfolioExcessReturnsSigma, adblImpliedBeta), - dblRiskAversion, aadblAssetExcessReturnsCovariance, - adblExpectedAssetExcessReturns); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * ForwardReverseOptimizationOutput Constructor - * - * @param pfOptimal The Optimal Equilibrium Portfolio - * @param pmOptimal The Optimal Equilibrium Portfolio Metrics - * @param dblRiskAversion The Risk Aversion Parameter - * @param aadblAssetExcessReturnsCovariance Pair-wise Asset Excess Returns Co-variance Matrix - * @param adblExpectedAssetExcessReturns Array of Expected Excess Returns - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ForwardReverseOptimizationOutput ( - final org.drip.portfolioconstruction.asset.Portfolio pfOptimal, - final org.drip.portfolioconstruction.asset.PortfolioMetrics pmOptimal, - final double dblRiskAversion, - final double[][] aadblAssetExcessReturnsCovariance, - final double[] adblExpectedAssetExcessReturns) - throws java.lang.Exception - { - super (pfOptimal, pmOptimal); - - if (null == (_aadblAssetExcessReturnsCovariance = aadblAssetExcessReturnsCovariance) || - !org.drip.quant.common.NumberUtil.IsValid (_dblRiskAversion = dblRiskAversion) || null == - (_adblExpectedAssetExcessReturns = adblExpectedAssetExcessReturns)) - throw new java.lang.Exception ("ForwardReverseOptimizationOutput Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Excess Returns Co-variance Matrix between each Pair-wise Asset - * - * @return The Excess Returns Co-variance Matrix between each Pair-wise Asset - */ - - public double[][] assetExcessReturnsCovariance() - { - return _aadblAssetExcessReturnsCovariance; - } - - /** - * Retrieve the Risk Aversion Coefficient - * - * @return The Risk Aversion Coefficient - */ - - public double riskAversion() - { - return _dblRiskAversion; - } - - /** - * Retrieve the Array of Expected Excess Returns for each Asset - * - * @return The Array of Expected Excess Returns for each Asset - */ - - public double[] expectedAssetExcessReturns() - { - return _adblExpectedAssetExcessReturns; - } - - /** - * Compute the Portfolio Relative Metrics using the specified Benchmark - * - * @param pmBenchmark The Benchmark Metrics - * - * @return The Portfolio Relative Metrics using the specified Benchmark - */ - - public org.drip.portfolioconstruction.asset.PortfolioBenchmarkMetrics benchmarkMetrics ( - final org.drip.portfolioconstruction.asset.PortfolioMetrics pmBenchmark) - { - if (null == pmBenchmark) return null; - - org.drip.portfolioconstruction.asset.PortfolioMetrics pm = optimalMetrics(); - - try { - double dblBeta = org.drip.quant.linearalgebra.Matrix.DotProduct (optimalPortfolio().weights(), - pmBenchmark.impliedBeta()); - - double dblActiveBeta = dblBeta - 1.; - - double dblPortfolioExcessReturnsMean = pm.excessReturnsMean(); - - double dblBenchmarkExcessReturnsMean = pmBenchmark.excessReturnsMean(); - - double dblBenchmarkExcessReturnsVariance = pmBenchmark.excessReturnsVariance(); - - double dblResidualRisk = java.lang.Math.sqrt (pm.excessReturnsVariance() - dblBeta * dblBeta * - dblBenchmarkExcessReturnsVariance); - - return new org.drip.portfolioconstruction.asset.PortfolioBenchmarkMetrics (dblBeta, - dblActiveBeta, java.lang.Math.sqrt (dblResidualRisk * dblResidualRisk + dblActiveBeta * - dblActiveBeta * dblBenchmarkExcessReturnsVariance), dblPortfolioExcessReturnsMean - - dblBenchmarkExcessReturnsMean, dblResidualRisk, dblPortfolioExcessReturnsMean - - dblBeta * dblBenchmarkExcessReturnsMean); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/portfolioconstruction/allocator/MeanVarianceOptimizer.java b/org/drip/portfolioconstruction/allocator/MeanVarianceOptimizer.java deleted file mode 100644 index 6a6fa51..0000000 --- a/org/drip/portfolioconstruction/allocator/MeanVarianceOptimizer.java +++ /dev/null @@ -1,163 +0,0 @@ - -package org.drip.portfolioconstruction.allocator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * MeanVarianceOptimizer exposes Portfolio Construction using Mean Variance Optimization Techniques. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class MeanVarianceOptimizer { - - protected abstract org.drip.portfolioconstruction.allocator.PortfolioConstructionParameters - constrainedPCP ( - final org.drip.portfolioconstruction.allocator.PortfolioConstructionParameters pcpDesign, - final double dblReturnsConstraint); - - /** - * Allocate the Long-Only Maximum Returns Portfolio - * - * @param pcp The Portfolio Construction Parameters - * @param ausp The Asset Universe Statistical Properties Instance - * - * @return The Long-Only Maximum Returns Portfolio - */ - - public abstract org.drip.portfolioconstruction.allocator.OptimizationOutput longOnlyMaximumReturnsAllocate - (final org.drip.portfolioconstruction.allocator.PortfolioConstructionParameters pcp, - final org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties ausp); - - /** - * Allocate the Global Minimum Variance Portfolio without any Returns Constraints in the Parameters - * - * @param pcp The Portfolio Construction Parameters - * @param ausp The Asset Universe Statistical Properties Instance - * - * @return The Global Minimum Variance Portfolio - */ - - public abstract org.drip.portfolioconstruction.allocator.OptimizationOutput globalMinimumVarianceAllocate ( - final org.drip.portfolioconstruction.allocator.PortfolioConstructionParameters pcp, - final org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties ausp); - - /** - * Allocate the Optimal Portfolio Weights given the Portfolio Construction Parameters - * - * @param pcp The Portfolio Construction Parameters - * @param ausp The Asset Universe Statistical Properties Instance - * - * @return The Optimal Portfolio - */ - - public abstract org.drip.portfolioconstruction.allocator.OptimizationOutput allocate ( - final org.drip.portfolioconstruction.allocator.PortfolioConstructionParameters pcp, - final org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties ausp); - - /** - * Generate the Efficient Frontier given the Portfolio Construction Parameters - * - * @param pcp The Portfolio Construction Parameters - * @param ausp The Asset Universe Statistical Properties Instance - * @param iFrontierSampleUnits The Number of Frontier Sample Units - * - * @return The Efficient Frontier - */ - - public org.drip.portfolioconstruction.mpt.MarkovitzBullet efficientFrontier ( - final org.drip.portfolioconstruction.allocator.PortfolioConstructionParameters pcp, - final org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties ausp, - final int iFrontierSampleUnits) - { - if (0 >= iFrontierSampleUnits) return null; - - org.drip.portfolioconstruction.allocator.OptimizationOutput opGlobalMinimumVariance = - globalMinimumVarianceAllocate (pcp, ausp); - - if (null == opGlobalMinimumVariance) return null; - - org.drip.portfolioconstruction.allocator.OptimizationOutput opLongOnlyMaximumReturns = - longOnlyMaximumReturnsAllocate (pcp, ausp); - - if (null == opLongOnlyMaximumReturns) return null; - - double dblReturnsGlobalMinimumVariance = - opGlobalMinimumVariance.optimalMetrics().excessReturnsMean(); - - double dblReturnsLongOnlyMaximumReturns = - opLongOnlyMaximumReturns.optimalMetrics().excessReturnsMean(); - - double dblReturnsConstraintGridWidth = (dblReturnsLongOnlyMaximumReturns - - dblReturnsGlobalMinimumVariance) / iFrontierSampleUnits; - double dblReturnsConstraint = dblReturnsGlobalMinimumVariance + dblReturnsConstraintGridWidth; - org.drip.portfolioconstruction.mpt.MarkovitzBullet mb = null; - - try { - mb = new org.drip.portfolioconstruction.mpt.MarkovitzBullet (opGlobalMinimumVariance, - opLongOnlyMaximumReturns); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - while (dblReturnsConstraint <= dblReturnsLongOnlyMaximumReturns) { - try { - mb.addOptimalPortfolio (allocate (constrainedPCP (pcp, dblReturnsConstraint), ausp)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - dblReturnsConstraint += dblReturnsConstraintGridWidth; - } - - return mb; - } -} diff --git a/org/drip/portfolioconstruction/allocator/OptimizationOutput.java b/org/drip/portfolioconstruction/allocator/OptimizationOutput.java deleted file mode 100644 index 72565a3..0000000 --- a/org/drip/portfolioconstruction/allocator/OptimizationOutput.java +++ /dev/null @@ -1,151 +0,0 @@ - -package org.drip.portfolioconstruction.allocator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OptimizationOutput holds the Output of an Optimal Portfolio Construction Run, i.e., the Optimal Asset - * Weights in the Portfolio and the related Portfolio Metrics. - * - * @author Lakshmi Krishnamurthy - */ - -public class OptimizationOutput { - private org.drip.portfolioconstruction.asset.Portfolio _pfOptimal = null; - private org.drip.portfolioconstruction.asset.PortfolioMetrics _pmOptimal = null; - - /** - * Create an Instance of the Optimal Portfolio - * - * @param aACOptimal The Array of the Optimal Asset Components - * @param ausp The AUSP Instance - * - * @return The Instance of the Optimal Portfolio - */ - - public static final OptimizationOutput Create ( - final org.drip.portfolioconstruction.asset.AssetComponent[] aACOptimal, - final org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties ausp) - { - if (null == aACOptimal || null == ausp) return null; - - int iNumAsset = aACOptimal.length; - - if (0 == iNumAsset) return null; - - try { - org.drip.portfolioconstruction.asset.Portfolio pfOptimal = new - org.drip.portfolioconstruction.asset.Portfolio (aACOptimal); - - double dblPortfolioExcessReturnsMean = pfOptimal.expectedReturn (ausp); - - double dblPortfolioExcessReturnsVariance = pfOptimal.variance (ausp); - - double dblPortfolioExcessReturnsSigma = java.lang.Math.sqrt - (dblPortfolioExcessReturnsVariance); - - double[] adblImpliedBeta = org.drip.quant.linearalgebra.Matrix.Product (ausp.covariance - (pfOptimal.id()), pfOptimal.weights()); - - if (null == adblImpliedBeta) return null; - - for (int i = 0; i < iNumAsset; ++i) - adblImpliedBeta[i] = adblImpliedBeta[i] / dblPortfolioExcessReturnsVariance; - - return new org.drip.portfolioconstruction.allocator.OptimizationOutput (new - org.drip.portfolioconstruction.asset.Portfolio (aACOptimal), new - org.drip.portfolioconstruction.asset.PortfolioMetrics (dblPortfolioExcessReturnsMean, - dblPortfolioExcessReturnsVariance, dblPortfolioExcessReturnsSigma, - dblPortfolioExcessReturnsMean / dblPortfolioExcessReturnsSigma, - adblImpliedBeta)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * OptimizationOutput Constructor - * - * @param pfOptimal The Optimal Portfolio - * @param pmOptimal The Optimal Portfolio Metrics - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public OptimizationOutput ( - final org.drip.portfolioconstruction.asset.Portfolio pfOptimal, - final org.drip.portfolioconstruction.asset.PortfolioMetrics pmOptimal) - throws java.lang.Exception - { - if (null == (_pfOptimal = pfOptimal) || null == (_pmOptimal = pmOptimal)) - throw new java.lang.Exception ("OptimizationOutput Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Optimal Portfolio Metrics - * - * @return The Optimal Portfolio Metrics - */ - - public org.drip.portfolioconstruction.asset.PortfolioMetrics optimalMetrics() - { - return _pmOptimal; - } - - /** - * Retrieve the Optimal Portfolio Instance - * - * @return The Optimal Portfolio Instance - */ - - public org.drip.portfolioconstruction.asset.Portfolio optimalPortfolio() - { - return _pfOptimal; - } -} diff --git a/org/drip/portfolioconstruction/allocator/PortfolioConstructionParameters.java b/org/drip/portfolioconstruction/allocator/PortfolioConstructionParameters.java deleted file mode 100644 index d387b4e..0000000 --- a/org/drip/portfolioconstruction/allocator/PortfolioConstructionParameters.java +++ /dev/null @@ -1,230 +0,0 @@ - -package org.drip.portfolioconstruction.allocator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PortfolioConstructionParameters holds the Parameters needed to construct the Portfolio. - * - * @author Lakshmi Krishnamurthy - */ - -public class PortfolioConstructionParameters { - private java.lang.String[] _astrAssetID = null; - private org.drip.portfolioconstruction.allocator.CustomRiskUtilitySettings _crus = null; - private org.drip.portfolioconstruction.allocator.PortfolioEqualityConstraintSettings _pecs = null; - - /** - * PortfolioConstructionParameters Constructor - * - * @param astrAssetID Array of Asset IDs - * @param crus The Quadratic Custom Risk Utility Settings - * @param pecs The Portfolio Equality Constraint Settings - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public PortfolioConstructionParameters ( - final java.lang.String[] astrAssetID, - final org.drip.portfolioconstruction.allocator.CustomRiskUtilitySettings crus, - final org.drip.portfolioconstruction.allocator.PortfolioEqualityConstraintSettings pecs) - throws java.lang.Exception - { - if (null == (_astrAssetID = astrAssetID) || 0 == _astrAssetID.length || null == (_crus = crus) || - null == (_pecs = pecs)) - throw new java.lang.Exception ("PortfolioConstructionParameters Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Asset ID Array - * - * @return The Asset ID Array - */ - - public java.lang.String[] assets() - { - return _astrAssetID; - } - - /** - * Retrieve the Instance of the Quadratic Custom Risk Utility Settings - * - * @return The Quadratic Custom Risk Utility Settings - */ - - public org.drip.portfolioconstruction.allocator.CustomRiskUtilitySettings optimizerSettings() - { - return _crus; - } - - /** - * Retrieve the Instance of the Portfolio Equality Constraint Settings - * - * @return The Portfolio Equality Constraint Settings - */ - - public org.drip.portfolioconstruction.allocator.PortfolioEqualityConstraintSettings constraintSettings() - { - return _pecs; - } - - /** - * Retrieve the Fully Invested Equality Constraint - - * @return The Fully Invested Equality Constraint - */ - - public org.drip.function.definition.RdToR1 fullyInvestedConstraint() - { - try { - return new org.drip.function.rdtor1.AffineMultivariate - (org.drip.function.rdtor1.ObjectiveConstraintVariateSet.Unitary (assets().length), -1.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Mandatory Returns Constraint - * - * @param ausp The Asset Universe Statistical Properties Instance - * - * @return The Mandatory Returns Constraint - */ - - public org.drip.function.definition.RdToR1 returnsConstraint ( - final org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties ausp) - { - if (null == ausp) return null; - - java.lang.String[] astrAssetID = assets(); - - int iNumAsset = astrAssetID.length; - double[] adblAssetReturn = new double[iNumAsset]; - - for (int i = 0; i < iNumAsset; ++i) { - org.drip.portfolioconstruction.params.AssetStatisticalProperties aspAsset = ausp.asp - (astrAssetID[i]); - - if (null == aspAsset) return null; - - adblAssetReturn[i] = aspAsset.expectedReturn(); - } - - try { - return new org.drip.function.rdtor1.AffineMultivariate (adblAssetReturn, -1. * - _pecs.returnsConstraint()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Equality Constraint R^d To R^1 Corresponding to the Specified Constraint Type - * - * @param ausp The Asset Universe Statistical Properties Instance - * - * @return The Equality Constraint R^d To R^1 Corresponding to the Specified Constraint Type - */ - - public org.drip.function.definition.RdToR1[] equalityConstraintRdToR1 ( - final org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties ausp) - { - if (org.drip.portfolioconstruction.allocator.PortfolioEqualityConstraintSettings.NO_CONSTRAINT == - _pecs.constraintType()) - return null; - - java.util.List lsRdToR1 = new - java.util.ArrayList(); - - if (0 != - (org.drip.portfolioconstruction.allocator.PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT - & _pecs.constraintType())) - lsRdToR1.add (fullyInvestedConstraint()); - - if (0 != - (org.drip.portfolioconstruction.allocator.PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT - & _pecs.constraintType())) { - org.drip.function.definition.RdToR1 rdToR1ReturnsConstraint = returnsConstraint (ausp); - - if (null == rdToR1ReturnsConstraint) return null; - - lsRdToR1.add (rdToR1ReturnsConstraint); - } - - int iNumConstraint = lsRdToR1.size(); - - org.drip.function.definition.RdToR1[] aConstraintRdToR1 = new - org.drip.function.definition.RdToR1[iNumConstraint]; - - for (int i = 0; i < iNumConstraint; ++i) - aConstraintRdToR1[i] = lsRdToR1.get (i); - - return aConstraintRdToR1; - } - - /** - * Retrieve the Equality Constraint Values Corresponding to the Specified Constraint Type - * - * @param ausp The Asset Universe Statistical Properties Instance - * - * @return The Equality Constraint Values Corresponding to the Specified Constraint Type - */ - - public double[] equalityConstraintValue ( - final org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties ausp) - { - double dblReturnsConstraint = _pecs.returnsConstraint(); - - return org.drip.quant.common.NumberUtil.IsValid (dblReturnsConstraint) ? new double[] {1., - dblReturnsConstraint} : new double[] {1.}; - } -} diff --git a/org/drip/portfolioconstruction/allocator/PortfolioEqualityConstraintSettings.java b/org/drip/portfolioconstruction/allocator/PortfolioEqualityConstraintSettings.java deleted file mode 100644 index 5bea431..0000000 --- a/org/drip/portfolioconstruction/allocator/PortfolioEqualityConstraintSettings.java +++ /dev/null @@ -1,184 +0,0 @@ - -package org.drip.portfolioconstruction.allocator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PortfolioEqualityConstraintSettings holds the Parameters required to generate the Mandatory Constraints - * for the Portfolio. - * - * @author Lakshmi Krishnamurthy - */ - -public class PortfolioEqualityConstraintSettings { - - /** - * NO_CONSTRAINT - No Constraint of any Kind - */ - - public static final int NO_CONSTRAINT = 1; - - /** - * FULLY_INVESTED_CONSTRAINT - The Mandatory Completely Invested Constraint - */ - - public static final int FULLY_INVESTED_CONSTRAINT = 2; - - /** - * RETURNS_CONSTRAINT - The Mandatory Returns Constraint - */ - - public static final int RETURNS_CONSTRAINT = 4; - - private int _iConstraintType = -1; - private double _dblReturnsConstraint = java.lang.Double.NaN; - - /** - * Construct an Unconstrained Instance of PortfolioEqualityConstraintSettings - * - * @return Unconstrained PortfolioEqualityConstraintSettings Instance - */ - - public static final PortfolioEqualityConstraintSettings Unconstrained() - { - try { - return new PortfolioEqualityConstraintSettings (NO_CONSTRAINT, java.lang.Double.NaN); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Fully Invested Instance of PortfolioEqualityConstraintSettings - * - * @return Fully Invested PortfolioEqualityConstraintSettings Instance - */ - - public static final PortfolioEqualityConstraintSettings FullyInvested() - { - try { - return new PortfolioEqualityConstraintSettings (FULLY_INVESTED_CONSTRAINT, java.lang.Double.NaN); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Returns Constrained Instance of PortfolioEqualityConstraintSettings - * - * @param dblReturnsConstraint The Returns Constraint - * - * @return Returns Constrained PortfolioEqualityConstraintSettings Instance - */ - - public static final PortfolioEqualityConstraintSettings ReturnsConstrained ( - final double dblReturnsConstraint) - { - try { - return new PortfolioEqualityConstraintSettings (FULLY_INVESTED_CONSTRAINT | RETURNS_CONSTRAINT, - dblReturnsConstraint); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * PortfolioEqualityConstraintSettings Constructor - * - * @param iConstraintType The Constraint Type - * @param dblReturnsConstraint The Returns Constraint - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public PortfolioEqualityConstraintSettings ( - final int iConstraintType, - final double dblReturnsConstraint) - throws java.lang.Exception - { - _iConstraintType = iConstraintType; - _dblReturnsConstraint = dblReturnsConstraint; - - if (0 == (NO_CONSTRAINT & _iConstraintType) && 0 == (FULLY_INVESTED_CONSTRAINT & _iConstraintType) && - 0 == (RETURNS_CONSTRAINT & _iConstraintType)) - throw new java.lang.Exception - ("PortfolioEqualityConstraintSettings Constructor => Invalid Inputs!"); - - if (0 != (RETURNS_CONSTRAINT & _iConstraintType) && !org.drip.quant.common.NumberUtil.IsValid - (_dblReturnsConstraint = dblReturnsConstraint)) - throw new java.lang.Exception - ("PortfolioEqualityConstraintSettings Constructor => Invalid Inputs!"); - } - - /** - * Retrieve the Constraint Type - * - * @return The Constraint Type - */ - - public int constraintType() - { - return _iConstraintType; - } - - /** - * Retrieve the Returns Constraint - * - * @return The Returns Constraint - */ - - public double returnsConstraint() - { - return _dblReturnsConstraint; - } -} diff --git a/org/drip/portfolioconstruction/allocator/QuadraticMeanVarianceOptimizer.java b/org/drip/portfolioconstruction/allocator/QuadraticMeanVarianceOptimizer.java deleted file mode 100644 index e5a7dd6..0000000 --- a/org/drip/portfolioconstruction/allocator/QuadraticMeanVarianceOptimizer.java +++ /dev/null @@ -1,242 +0,0 @@ - -package org.drip.portfolioconstruction.allocator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * QuadraticMeanVarianceOptimizer builds an Optimal Portfolio Based on MPT Using the Asset Pool Statistical - * Properties using a Quadratic Optimization Function and Equality Constraints (if any). - * - * @author Lakshmi Krishnamurthy - */ - -public class QuadraticMeanVarianceOptimizer extends - org.drip.portfolioconstruction.allocator.MeanVarianceOptimizer { - - protected org.drip.portfolioconstruction.allocator.PortfolioConstructionParameters constrainedPCP ( - final org.drip.portfolioconstruction.allocator.PortfolioConstructionParameters pcpDesign, - final double dblReturnsConstraint) - { - try { - return new org.drip.portfolioconstruction.allocator.PortfolioConstructionParameters - (pcpDesign.assets(), pcpDesign.optimizerSettings(), new - org.drip.portfolioconstruction.allocator.PortfolioEqualityConstraintSettings - (pcpDesign.constraintSettings().constraintType() | - org.drip.portfolioconstruction.allocator.PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblReturnsConstraint)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Empty QuadraticMeanVarianceOptimizer Constructor - */ - - public QuadraticMeanVarianceOptimizer() - { - } - - @Override public org.drip.portfolioconstruction.allocator.OptimizationOutput longOnlyMaximumReturnsAllocate - (final org.drip.portfolioconstruction.allocator.PortfolioConstructionParameters pcp, - final org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties ausp) - { - if (null == pcp || null == ausp) return null; - - java.lang.String[] astrAssetID = pcp.assets(); - - int iNumAsset = astrAssetID.length; - org.drip.portfolioconstruction.asset.AssetComponent[] aAC = new - org.drip.portfolioconstruction.asset.AssetComponent[iNumAsset]; - - double[] adblExpectedAssetReturns = ausp.expectedReturns (astrAssetID); - - if (null == adblExpectedAssetReturns || iNumAsset != adblExpectedAssetReturns.length) return null; - - double dblMaximumReturns = adblExpectedAssetReturns[0]; - java.lang.String strMaximumReturnsAsset = astrAssetID[0]; - - for (int i = 1; i < iNumAsset; ++i) { - if (adblExpectedAssetReturns[i] > dblMaximumReturns) { - strMaximumReturnsAsset = astrAssetID[i]; - dblMaximumReturns = adblExpectedAssetReturns[i]; - } - } - - try { - for (int i = 0; i < iNumAsset; ++i) - aAC[i] = new org.drip.portfolioconstruction.asset.AssetComponent (astrAssetID[i], - astrAssetID[i].equalsIgnoreCase (strMaximumReturnsAsset) ? 1. : 0.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return org.drip.portfolioconstruction.allocator.OptimizationOutput.Create (aAC, ausp); - } - - @Override public org.drip.portfolioconstruction.allocator.OptimizationOutput globalMinimumVarianceAllocate - (final org.drip.portfolioconstruction.allocator.PortfolioConstructionParameters pcp, - final org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties ausp) - { - if (null == pcp || null == ausp) return null; - - java.lang.String[] astrAssetID = pcp.assets(); - - int iNumAsset = astrAssetID.length; - org.drip.function.rdtor1.LagrangianMultivariate lm = null; - org.drip.portfolioconstruction.asset.AssetComponent[] aAC = new - org.drip.portfolioconstruction.asset.AssetComponent[iNumAsset]; - - try { - lm = new org.drip.function.rdtor1.LagrangianMultivariate - (pcp.optimizerSettings().riskObjectiveUtility (astrAssetID, ausp), new - org.drip.function.definition.RdToR1[] {pcp.fullyInvestedConstraint()}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - int iLagrangianDimension = lm.dimension(); - - double[] adblRHS = new double[iLagrangianDimension]; - double[] adblVariate = new double[iLagrangianDimension]; - - double dblRiskToleranceFactor = pcp.optimizerSettings().riskTolerance(); - - double[] adblEqualityConstraintValue = pcp.equalityConstraintValue (ausp); - - for (int i = 0; i < iLagrangianDimension; ++i) { - adblVariate[i] = 0.; - - if (i < iNumAsset) { - if (0. != dblRiskToleranceFactor) { - org.drip.portfolioconstruction.params.AssetStatisticalProperties asp = ausp.asp - (astrAssetID[i]); - - if (null == asp) return null; - - adblRHS[i] = asp.expectedReturn() * dblRiskToleranceFactor; - } else - adblRHS[i] = 0.; - } else - adblRHS[i] = adblEqualityConstraintValue[i - iNumAsset]; - } - - org.drip.quant.linearalgebra.LinearizationOutput lo = - org.drip.quant.linearalgebra.LinearSystemSolver.SolveUsingMatrixInversion (lm.hessian - (adblVariate), adblRHS); - - if (null == lo) return null; - - double[] adblAmount = lo.getTransformedRHS(); - - if (null == adblAmount || adblAmount.length != iLagrangianDimension) return null; - - try { - for (int i = 0; i < iNumAsset; ++i) - aAC[i] = new org.drip.portfolioconstruction.asset.AssetComponent (astrAssetID[i], - adblAmount[i]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return org.drip.portfolioconstruction.allocator.OptimizationOutput.Create (aAC, ausp); - } - - @Override public org.drip.portfolioconstruction.allocator.OptimizationOutput allocate ( - final org.drip.portfolioconstruction.allocator.PortfolioConstructionParameters pcp, - final org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties ausp) - { - if (null == pcp || null == ausp) return null; - - java.lang.String[] astrAssetID = pcp.assets(); - - int iNumAsset = astrAssetID.length; - org.drip.function.rdtor1.LagrangianMultivariate lm = null; - org.drip.portfolioconstruction.asset.AssetComponent[] aAC = new - org.drip.portfolioconstruction.asset.AssetComponent[iNumAsset]; - - try { - lm = new org.drip.function.rdtor1.LagrangianMultivariate - (pcp.optimizerSettings().riskObjectiveUtility (astrAssetID, ausp), - pcp.equalityConstraintRdToR1 (ausp)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - int iLagrangianDimension = lm.dimension(); - - double[] adblVariate = new double[iLagrangianDimension]; - - org.drip.quant.linearalgebra.LinearizationOutput lo = - org.drip.quant.linearalgebra.LinearSystemSolver.SolveUsingMatrixInversion (lm.hessian - (adblVariate), lm.jacobian (adblVariate)); - - if (null == lo) return null; - - double[] adblAmount = lo.getTransformedRHS(); - - if (null == adblAmount || adblAmount.length != iLagrangianDimension) return null; - - try { - for (int i = 0; i < iNumAsset; ++i) - aAC[i] = new org.drip.portfolioconstruction.asset.AssetComponent (astrAssetID[i], -1. * - adblAmount[i]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return org.drip.portfolioconstruction.allocator.OptimizationOutput.Create (aAC, ausp); - } -} diff --git a/org/drip/portfolioconstruction/allocator/RiskUtilitySettingsEstimator.java b/org/drip/portfolioconstruction/allocator/RiskUtilitySettingsEstimator.java deleted file mode 100644 index c79c3ca..0000000 --- a/org/drip/portfolioconstruction/allocator/RiskUtilitySettingsEstimator.java +++ /dev/null @@ -1,110 +0,0 @@ - -package org.drip.portfolioconstruction.allocator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * RiskUtilitySettingsEstimator contains Utility Functions that help estimate the CustomRiskUtilitySettings - * Inputs Parameters. - * - * @author Lakshmi Krishnamurthy - */ - -public class RiskUtilitySettingsEstimator { - - /** - * Compute the Equilibrium Risk Aversion from the Portfolio Equilibrium Returns/Variance and the Risk - * Free Rate - * - * @param dblEquilibriumReturns The Portfolio Equilibrium Returns - * @param dblRiskFreeRate The Risk Free Rate - * @param dblEquilibriumVariance The Portfolio Equilibrium Variance - * - * @return The Estimated Equilibrium Risk Aversion Value - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final double EquilibriumRiskAversion ( - final double dblEquilibriumReturns, - final double dblRiskFreeRate, - final double dblEquilibriumVariance) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblEquilibriumReturns) || - !org.drip.quant.common.NumberUtil.IsValid (dblRiskFreeRate) || - !org.drip.quant.common.NumberUtil.IsValid (dblEquilibriumVariance)) - throw new java.lang.Exception - ("RiskUtilitySettingsEstimator::EquilibriumRiskAversion => Invalid Inputs"); - - return (dblEquilibriumReturns - dblRiskFreeRate) / dblEquilibriumVariance; - } - - /** - * Compute the Equilibrium Risk Aversion from the Portfolio Equilibrium Returns/Variance - * - * @param dblEquilibriumReturns The Portfolio Equilibrium Returns - * @param dblEquilibriumVariance The Portfolio Equilibrium Variance - * - * @return The Estimated Equilibrium Risk Aversion Value - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final double EquilibriumRiskAversion ( - final double dblEquilibriumReturns, - final double dblEquilibriumVariance) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblEquilibriumReturns) || - !org.drip.quant.common.NumberUtil.IsValid (dblEquilibriumVariance)) - throw new java.lang.Exception - ("RiskUtilitySettingsEstimator::EquilibriumRiskAversion => Invalid Inputs"); - - return dblEquilibriumReturns / dblEquilibriumVariance; - } -} diff --git a/org/drip/portfolioconstruction/alm/DiscountRate.java b/org/drip/portfolioconstruction/alm/DiscountRate.java deleted file mode 100644 index 99a256e..0000000 --- a/org/drip/portfolioconstruction/alm/DiscountRate.java +++ /dev/null @@ -1,226 +0,0 @@ - -package org.drip.portfolioconstruction.alm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DiscountRate holds the Cash Flow Discount Rate Parameters for each Type, i.e., Discount Rates for Working - * Age Income, Pension Benefits, and Basic Consumption. - * - * @author Lakshmi Krishnamurthy - */ - -public class DiscountRate { - private double _dblYield = java.lang.Double.NaN; - private double _dblBasicConsumptionSpread = java.lang.Double.NaN; - private double _dblWorkingAgeIncomeSpread = java.lang.Double.NaN; - private double _dblPensionBenefitsIncomeSpread = java.lang.Double.NaN; - - /** - * DiscountRate Constructor - * - * @param dblYield The Base Discounting Yield - * @param dblWorkingAgeIncomeSpread The Working Age Income Spread - * @param dblPensionBenefitsIncomeSpread The Pension Benefits Income Spread - * @param dblBasicConsumptionSpread The Basic Consumption Spread - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public DiscountRate ( - final double dblYield, - final double dblWorkingAgeIncomeSpread, - final double dblPensionBenefitsIncomeSpread, - final double dblBasicConsumptionSpread) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblYield = dblYield) || - !org.drip.quant.common.NumberUtil.IsValid (_dblWorkingAgeIncomeSpread = - dblWorkingAgeIncomeSpread) || !org.drip.quant.common.NumberUtil.IsValid - (_dblBasicConsumptionSpread = dblBasicConsumptionSpread) || - !org.drip.quant.common.NumberUtil.IsValid (_dblPensionBenefitsIncomeSpread = - dblPensionBenefitsIncomeSpread)) - throw new java.lang.Exception ("DiscountRate Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Base Discounting Yield - * - * @return The Base Discounting Yield - */ - - public double yield() - { - return _dblYield; - } - - /** - * Retrieve the Working Age Income Spread - * - * @return The Working Age Income Spread - */ - - public double workingAgeIncomeSpread() - { - return _dblWorkingAgeIncomeSpread; - } - - /** - * Retrieve the Working Age Income Discount Rate - * - * @return The Working Age Income Discount Rate - */ - - public double workingAgeIncomeRate() - { - return _dblYield + _dblWorkingAgeIncomeSpread; - } - - /** - * Retrieve the Working Age Income Discount Factor - * - * @param dblHorizon The Horizon to which the Discount Factor is to be computed - * - * @return The Working Age Income Discount Factor - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double workingAgeIncomeDF ( - final double dblHorizon) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblHorizon)) - throw new java.lang.Exception ("DiscountRate::workingAgeIncomeDF => Invalid Inputs"); - - return java.lang.Math.exp (-1. * dblHorizon * (_dblYield + _dblWorkingAgeIncomeSpread)); - } - - /** - * Retrieve the Pension Benefits Income Spread - * - * @return The Pension Benefits Income Spread - */ - - public double pensionBenefitsIncomeSpread() - { - return _dblPensionBenefitsIncomeSpread; - } - - /** - * Retrieve the Pension Benefits Income Discount Rate - * - * @return The Pension Benefits Income Discount Rate - */ - - public double pensionBenefitsIncomeRate() - { - return _dblYield + _dblPensionBenefitsIncomeSpread; - } - - /** - * Retrieve the Pension Benefits Income Discount Factor - * - * @param dblHorizon The Horizon to which the Discount Factor is to be computed - * - * @return The Pension Benefits Income Discount Factor - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double pensionBenefitsIncomeDF ( - final double dblHorizon) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblHorizon)) - throw new java.lang.Exception ("DiscountRate::pensionBenefitsIncomeDF => Invalid Inputs"); - - return java.lang.Math.exp (-1. * dblHorizon * (_dblYield + _dblPensionBenefitsIncomeSpread)); - } - - /** - * Retrieve the Basic Consumption Spread - * - * @return The Basic Consumption Spread - */ - - public double basicConsumptionSpread() - { - return _dblBasicConsumptionSpread; - } - - /** - * Retrieve the Basic Consumption Discount Rate - * - * @return The Basic Consumption Discount Rate - */ - - public double basicConsumptionRate() - { - return _dblYield + _dblBasicConsumptionSpread; - } - - /** - * Retrieve the Basic Consumption Discount Factor - * - * @param dblHorizon The Horizon to which the Discount Factor is to be computed - * - * @return The Basic Consumption Discount Factor - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double basicConsumptionDF ( - final double dblHorizon) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblHorizon)) - throw new java.lang.Exception ("DiscountRate::basicConsumptionDF => Invalid Inputs"); - - return java.lang.Math.exp (-1. * dblHorizon * (_dblYield + _dblBasicConsumptionSpread)); - } -} diff --git a/org/drip/portfolioconstruction/alm/ExpectedBasicConsumption.java b/org/drip/portfolioconstruction/alm/ExpectedBasicConsumption.java deleted file mode 100644 index 636d3c4..0000000 --- a/org/drip/portfolioconstruction/alm/ExpectedBasicConsumption.java +++ /dev/null @@ -1,133 +0,0 @@ - -package org.drip.portfolioconstruction.alm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ExpectedBasicConsumption holds the Parameters required for estimating the Investor's Basic Consumption - * Profile. - * - * @author Lakshmi Krishnamurthy - */ - -public class ExpectedBasicConsumption { - private double _dblWorkingAgeConsumptionRate = java.lang.Double.NaN; - private double _dblRetirementAgeConsumptionRate = java.lang.Double.NaN; - - /** - * ExpectedBasicConsumption Constructor - * - * @param dblWorkingAgeConsumptionRate The Working Age Consumption Rate - * @param dblRetirementAgeConsumptionRate The Retirement Age Consumption Rate - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ExpectedBasicConsumption ( - final double dblWorkingAgeConsumptionRate, - final double dblRetirementAgeConsumptionRate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblWorkingAgeConsumptionRate = - dblWorkingAgeConsumptionRate) || !org.drip.quant.common.NumberUtil.IsValid - (_dblRetirementAgeConsumptionRate = dblRetirementAgeConsumptionRate)) - throw new java.lang.Exception ("ExpectedBasicConsumption Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Working Age Consumption Rate - * - * @return The Working Age Consumption Rate - */ - - public double workingAgeConsumptionRate() - { - return _dblWorkingAgeConsumptionRate; - } - - /** - * Retrieve the Retirement Age Consumption Rate - * - * @return The Retirement Age Consumption Rate - */ - - public double retirementAgeConsumptionRate() - { - return _dblRetirementAgeConsumptionRate; - } - - /** - * Compute the Expected Consumption Rate - * - * @param dblAge The Age whose Investment Phase is needed - * @param ics The Investor's Time Cliff Settings Instance - * - * @return The Expected Consumption Rate - * - * @throws java.lang.Exception Thrown if the Expected Consumption Rate cannot be computed - */ - - public double rate ( - final double dblAge, - final org.drip.portfolioconstruction.alm.InvestorCliffSettings ics) - throws java.lang.Exception - { - if (null == ics) throw new java.lang.Exception ("ExpectedBasicConsumption::rate => Invalid Inputs"); - - int iAgePhase = ics.phase (dblAge); - - if (org.drip.portfolioconstruction.alm.InvestorCliffSettings.DATE_PHASE_BEFORE_RETIREMENT == - iAgePhase) - return _dblWorkingAgeConsumptionRate; - - if (org.drip.portfolioconstruction.alm.InvestorCliffSettings.DATE_PHASE_AFTER_RETIREMENT == - iAgePhase) - return _dblRetirementAgeConsumptionRate; - - return 0.; - } -} diff --git a/org/drip/portfolioconstruction/alm/ExpectedNonFinancialIncome.java b/org/drip/portfolioconstruction/alm/ExpectedNonFinancialIncome.java deleted file mode 100644 index fbf7785..0000000 --- a/org/drip/portfolioconstruction/alm/ExpectedNonFinancialIncome.java +++ /dev/null @@ -1,118 +0,0 @@ - -package org.drip.portfolioconstruction.alm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ExpectedNonFinancialIncome holds the Parameters required for estimating the Investor's Non-Financial - * Income Profile. - * - * @author Lakshmi Krishnamurthy - */ - -public class ExpectedNonFinancialIncome { - private double _dblIncomeReplacementRate = java.lang.Double.NaN; - - /** - * ExpectedNonFinancialIncome Constructor - * - * @param dblIncomeReplacementRate The Pension Based Income Replacement Rate - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ExpectedNonFinancialIncome ( - final double dblIncomeReplacementRate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblIncomeReplacementRate = dblIncomeReplacementRate)) - throw new java.lang.Exception ("ExpectedNonFinancialIncome Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Retirement Age Income Replacement Rate - * - * @return The Retirement Age Income Replacement Rate - */ - - public double incomeReplacementRate() - { - return _dblIncomeReplacementRate; - } - - /** - * Compute the Retirement Age Income Replacement Rate - * - * @param dblAge The Age whose Investment Phase is needed - * @param ics The Investor's Time Cliff Settings Instance - * - * @return The Retirement Age Income Replacement Rate - * - * @throws java.lang.Exception Thrown if the Retirement Age Income Replacement Rate cannot be computed - */ - - public double rate ( - final double dblAge, - final org.drip.portfolioconstruction.alm.InvestorCliffSettings ics) - throws java.lang.Exception - { - if (null == ics) - throw new java.lang.Exception ("ExpectedNonFinancialIncome::rate => Invalid Inputs"); - - int iAgePhase = ics.phase (dblAge); - - if (org.drip.portfolioconstruction.alm.InvestorCliffSettings.DATE_PHASE_BEFORE_RETIREMENT == - iAgePhase) - return 1.; - - if (org.drip.portfolioconstruction.alm.InvestorCliffSettings.DATE_PHASE_AFTER_RETIREMENT == - iAgePhase) - return _dblIncomeReplacementRate; - - return 0.; - } -} diff --git a/org/drip/portfolioconstruction/alm/InvestorCliffSettings.java b/org/drip/portfolioconstruction/alm/InvestorCliffSettings.java deleted file mode 100644 index 2d07c1c..0000000 --- a/org/drip/portfolioconstruction/alm/InvestorCliffSettings.java +++ /dev/null @@ -1,179 +0,0 @@ - -package org.drip.portfolioconstruction.alm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * InvestorCliffSettings contains the Investor's Time Cliff Settings Parameters such as the Retirement and - * the Mortality Ages. - * - * @author Lakshmi Krishnamurthy - */ - -public class InvestorCliffSettings { - - /** - * Date Phase - Before Retirement - */ - - public static final int DATE_PHASE_BEFORE_RETIREMENT = 0; - - /** - * Date Phase - After Retirement - */ - - public static final int DATE_PHASE_AFTER_RETIREMENT = 1; - - /** - * Date Phase - After Death - */ - - public static final int DATE_PHASE_AFTER_MORTALITY = 2; - - private double _dblMaximumAge = java.lang.Double.NaN; - private double _dblRetirementAge = java.lang.Double.NaN; - - /** - * InvestorCliffSettings Constructor - * - * @param dblRetirementAge The Investor Retirement Age - * @param dblMaximumAge The Investor Maximum Age - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public InvestorCliffSettings ( - final double dblRetirementAge, - final double dblMaximumAge) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblRetirementAge = dblRetirementAge) || - !org.drip.quant.common.NumberUtil.IsValid (_dblMaximumAge = dblMaximumAge) || _dblRetirementAge - >= _dblMaximumAge) - throw new java.lang.Exception ("InvestorCliffSettings Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Investor Retirement Age - * - * @return The Investor Retirement Age - */ - - public double retirementAge() - { - return _dblRetirementAge; - } - - /** - * Retrieve the Investor Maximum Age - * - * @return The Investor Maximum Age - */ - - public double maximumAge() - { - return _dblMaximumAge; - } - - /** - * Retrieve the Investment Phase corresponding to the specified Age - * - * @param dblAge The Age whose Investment Phase is needed - * - * @return The Investment Phase - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public int phase ( - final double dblAge) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblAge)) - throw new java.lang.Exception ("InvestorHorizon::phase => Invalid Inputs"); - - if (dblAge <= _dblRetirementAge) return DATE_PHASE_BEFORE_RETIREMENT; - - if (dblAge <= _dblMaximumAge) return DATE_PHASE_AFTER_RETIREMENT; - - return DATE_PHASE_AFTER_MORTALITY; - } - - /** - * Retrieve the Investor Retirement Indicator Flag corresponding to the specified Age - * - * @param dblAge The Age whose Retirement Indicator is needed - * - * @return TRUE - The Age indicates that the Investor has retired - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public boolean retirementIndicator ( - final double dblAge) - throws java.lang.Exception - { - return DATE_PHASE_BEFORE_RETIREMENT != phase (dblAge); - } - - /** - * Retrieve the Investor "Is Alive" Indicator Flag corresponding to the specified Age - * - * @param dblAge The Age whose "Is Alive" Indicator is needed - * - * @return TRUE - The Age indicates that the Investor "Is Alive" - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public boolean isAlive ( - final double dblAge) - throws java.lang.Exception - { - return DATE_PHASE_AFTER_MORTALITY != phase (dblAge); - } -} diff --git a/org/drip/portfolioconstruction/alm/NetLiabilityCashFlow.java b/org/drip/portfolioconstruction/alm/NetLiabilityCashFlow.java deleted file mode 100644 index f02e75b..0000000 --- a/org/drip/portfolioconstruction/alm/NetLiabilityCashFlow.java +++ /dev/null @@ -1,239 +0,0 @@ - -package org.drip.portfolioconstruction.alm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NetLiabilityCashFlow holds the Investor Time Snap's Singular Liability Flow Details. - * - * @author Lakshmi Krishnamurthy - */ - -public class NetLiabilityCashFlow { - private boolean _bIsAlive = false; - private boolean _bIsRetired = false; - private double _dblAge = java.lang.Double.NaN; - private double _dblHorizon = java.lang.Double.NaN; - private double _dblAfterTaxIncome = java.lang.Double.NaN; - private double _dblPensionBenefits = java.lang.Double.NaN; - private double _dblBasicConsumption = java.lang.Double.NaN; - private double _dblWorkingAgeIncome = java.lang.Double.NaN; - private double _dblPensionBenefitsDF = java.lang.Double.NaN; - private double _dblBasicConsumptionDF = java.lang.Double.NaN; - private double _dblWorkingAgeIncomeDF = java.lang.Double.NaN; - - /** - * NetLiabilityCashFlow Constructor - * - * @param dblAge The Investor Age - * @param bIsRetired The Retirement Indicator Flag - * @param bIsAlive The "Is Alive" Indicator Flag - * @param dblHorizon The Snapshot's Investment Horizon - * @param dblAfterTaxIncome The Basic After-Tax Income - * @param dblWorkingAgeIncome The Investor Working Age Income - * @param dblPensionBenefits The Investor Pension Benefits - * @param dblBasicConsumption The Investor Basic Consumption - * @param dblWorkingAgeIncomeDF The Investor Working Age Income Discount Factor - * @param dblPensionBenefitsDF The Investor Pension Benefits Discount Factor - * @param dblBasicConsumptionDF The Investor Basic Consumption Discount Factor - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public NetLiabilityCashFlow ( - final double dblAge, - final boolean bIsRetired, - final boolean bIsAlive, - final double dblHorizon, - final double dblAfterTaxIncome, - final double dblWorkingAgeIncome, - final double dblPensionBenefits, - final double dblBasicConsumption, - final double dblWorkingAgeIncomeDF, - final double dblPensionBenefitsDF, - final double dblBasicConsumptionDF) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblAge = dblAge) || - !org.drip.quant.common.NumberUtil.IsValid (_dblHorizon = dblHorizon) || - !org.drip.quant.common.NumberUtil.IsValid (_dblAfterTaxIncome = dblAfterTaxIncome) || - !org.drip.quant.common.NumberUtil.IsValid (_dblWorkingAgeIncome = dblWorkingAgeIncome) || - !org.drip.quant.common.NumberUtil.IsValid (_dblPensionBenefits = dblPensionBenefits) - || !org.drip.quant.common.NumberUtil.IsValid (_dblBasicConsumption = - dblBasicConsumption) || !org.drip.quant.common.NumberUtil.IsValid - (_dblWorkingAgeIncomeDF = dblWorkingAgeIncomeDF) || - !org.drip.quant.common.NumberUtil.IsValid (_dblPensionBenefitsDF = - dblPensionBenefitsDF) || - !org.drip.quant.common.NumberUtil.IsValid - (_dblBasicConsumptionDF = dblBasicConsumptionDF)) - throw new java.lang.Exception ("NetLiabilityCashFlow Constructor => Invalid Inputs"); - - _bIsAlive = bIsAlive; - _bIsRetired = bIsRetired; - } - - /** - * Retrieve the Investor Age - * - * @return The Investor Age - */ - - public double age() - { - return _dblAge; - } - - /** - * Retrieve the Retirement Indicator Flag - * - * @return The Retirement Indicator Flag - */ - - public boolean isRetired() - { - return _bIsRetired; - } - - /** - * Retrieve the "Is Alive" Indicator Flag - * - * @return The "Is Alive" Indicator Flag - */ - - public boolean isAlive() - { - return _bIsAlive; - } - - /** - * Retrieve the Snapshot's Investment Horizon - * - * @return The Snapshot's Investment Horizon - */ - - public double horizon() - { - return _dblHorizon; - } - - /** - * Retrieve the Basic After-Tax Income - * - * @return The Basic After-Tax Income - */ - - public double afterTaxIncome() - { - return _dblAfterTaxIncome; - } - - /** - * Retrieve the Investor Working Age Income - * - * @return The Investor Working Age Income - */ - - public double workingAgeIncome() - { - return _dblWorkingAgeIncome; - } - - /** - * Retrieve the Investor Pension Benefits - * - * @return The Investor Pension Benefits - */ - - public double pensionBenefits() - { - return _dblPensionBenefits; - } - - /** - * Retrieve the Investor Basic Consumption - * - * @return The Investor Basic Consumption - */ - - public double basicConsumption() - { - return _dblBasicConsumption; - } - - /** - * Retrieve the Investor Working Age Income Discount Factor - * - * @return The Investor Working Age Income Discount Factor - */ - - public double workingAgeIncomeDF() - { - return _dblWorkingAgeIncomeDF; - } - - /** - * Retrieve the Investor Pension Benefits Discount Factor - * - * @return The Investor Pension Benefits Discount Factor - */ - - public double pensionBenefitsDF() - { - return _dblPensionBenefitsDF; - } - - /** - * Retrieve the Investor Basic Consumption Discount Factor - * - * @return The Investor Basic Consumption Discount Factor - */ - - public double basicConsumptionDF() - { - return _dblBasicConsumptionDF; - } -} diff --git a/org/drip/portfolioconstruction/alm/NetLiabilityMetrics.java b/org/drip/portfolioconstruction/alm/NetLiabilityMetrics.java deleted file mode 100644 index 1dec558..0000000 --- a/org/drip/portfolioconstruction/alm/NetLiabilityMetrics.java +++ /dev/null @@ -1,130 +0,0 @@ - -package org.drip.portfolioconstruction.alm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NetLiabilityMetrics holds the Results of the Computation of the Net Liability Cash Flows and PV Metrics. - * - * @author Lakshmi Krishnamurthy - */ - -public class NetLiabilityMetrics { - private double _dblBasicConsumptionPV = java.lang.Double.NaN; - private double _dblWorkingAgeIncomePV = java.lang.Double.NaN; - private double _dblPensionBenefitsIncomePV = java.lang.Double.NaN; - private java.util.List _lsNLCF = null; - - /** - * NetLiabilityMetrics Constructor - * - * @param lsNLCF List of Net Liability Cash Flows - * @param dblWorkingAgeIncomePV PV of the Working Age Income - * @param dblPensionBenefitsIncomePV PV of the Pension Benefits Income - * @param dblBasicConsumptionPV PV of the Basic Consumption - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public NetLiabilityMetrics ( - final java.util.List lsNLCF, - final double dblWorkingAgeIncomePV, - final double dblPensionBenefitsIncomePV, - final double dblBasicConsumptionPV) - throws java.lang.Exception - { - if (null == (_lsNLCF = lsNLCF) || !org.drip.quant.common.NumberUtil.IsValid (_dblWorkingAgeIncomePV = - dblWorkingAgeIncomePV) || !org.drip.quant.common.NumberUtil.IsValid (_dblPensionBenefitsIncomePV - = dblPensionBenefitsIncomePV) || !org.drip.quant.common.NumberUtil.IsValid - (_dblBasicConsumptionPV = dblBasicConsumptionPV)) - throw new java.lang.Exception ("NetLiabilityMetrics Constructor => Invalid Inputs"); - } - - /** - * Retrieve the List of Net Liability Cash Flows - * - * @return The List of Net Liability Cash Flows - */ - - public java.util.List cashFlowList() - { - return _lsNLCF; - } - - /** - * Retrieve the PV of the Working Age Income - * - * @return The PV of the Working Age Income - */ - - public double workingAgeIncomePV() - { - return _dblWorkingAgeIncomePV; - } - - /** - * Retrieve the PV of the Pension Benefits Income - * - * @return The PV of the Pension Benefits Income - */ - - public double pensionBenefitsIncomePV() - { - return _dblPensionBenefitsIncomePV; - } - - /** - * Retrieve the PV of the Basic Consumption - * - * @return The PV of the Basic Consumption - */ - - public double basicConsumptionPV() - { - return _dblBasicConsumptionPV; - } -} diff --git a/org/drip/portfolioconstruction/alm/NetLiabilityStream.java b/org/drip/portfolioconstruction/alm/NetLiabilityStream.java deleted file mode 100644 index 09a3fc5..0000000 --- a/org/drip/portfolioconstruction/alm/NetLiabilityStream.java +++ /dev/null @@ -1,202 +0,0 @@ - -package org.drip.portfolioconstruction.alm; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NetLiabilityStream holds the Investor's Horizon, Consumption, and Income Settings needed to generate and - * value the Net Liability Cash Flow Stream. - * - * @author Lakshmi Krishnamurthy - */ - -public class NetLiabilityStream { - private double _dblAfterTaxIncome = java.lang.Double.NaN; - private org.drip.portfolioconstruction.alm.InvestorCliffSettings _ics = null; - private org.drip.portfolioconstruction.alm.ExpectedBasicConsumption _ebc = null; - private org.drip.portfolioconstruction.alm.ExpectedNonFinancialIncome _enfi = null; - - /** - * NetLiabilityStream Constructor - * - * @param ics The Investor's Time Cliff Settings - * @param enfi The Investor's Non-Financial Income Settings - * @param ebc The Investor's Basic Consumption Settings - * @param dblAfterTaxIncome The Basic After-Tax Income - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public NetLiabilityStream ( - final org.drip.portfolioconstruction.alm.InvestorCliffSettings ics, - final org.drip.portfolioconstruction.alm.ExpectedNonFinancialIncome enfi, - final org.drip.portfolioconstruction.alm.ExpectedBasicConsumption ebc, - final double dblAfterTaxIncome) - throws java.lang.Exception - { - if (null == (_ics = ics) || null == (_enfi = enfi) || null == (_ebc = ebc) || - !org.drip.quant.common.NumberUtil.IsValid (_dblAfterTaxIncome = dblAfterTaxIncome)) - throw new java.lang.Exception ("NetLiabilityStream Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Investor's Time Horizon Settings - * - * @return The Investor's Time Horizon Settings - */ - - public org.drip.portfolioconstruction.alm.InvestorCliffSettings investorCliffSettings() - { - return _ics; - } - - /** - * Retrieve the Investor's Basic Consumption Settings - * - * @return The Investor's Basic Consumption Settings - */ - - public org.drip.portfolioconstruction.alm.ExpectedBasicConsumption basicConsumption() - { - return _ebc; - } - - /** - * Retrieve the Investor's Non-Financial Income Settings - * - * @return The Investor's Non-Financial Income Settings - */ - - public org.drip.portfolioconstruction.alm.ExpectedNonFinancialIncome nonFinancialIncome() - { - return _enfi; - } - - /** - * Retrieve the Basic After-Tax Income - * - * @return The Basic After-Tax Income - */ - - public double afterTaxIncome() - { - return _dblAfterTaxIncome; - } - - /** - * Generate the NetLiabilityMetrics Instance - * - * @param dblStartAge The Starting Age - * @param dblEndAge The Ending Age - * @param dr The Discount Rate Instance - * - * @return The NetLiabilityMetrics Instance - */ - - public org.drip.portfolioconstruction.alm.NetLiabilityMetrics metrics ( - final double dblStartAge, - final double dblEndAge, - final org.drip.portfolioconstruction.alm.DiscountRate dr) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblStartAge) || - !org.drip.quant.common.NumberUtil.IsValid (dblEndAge) || dblStartAge >= dblEndAge || null == dr) - return null; - - java.util.List lsNLCF = new - java.util.ArrayList(); - - double dblBasicConsumptionPV = 0.; - double dblWorkingAgeIncomePV = 0.; - double dblPensionBenefitsIncomePV = 0.; - - for (double dblCurrentAge = dblStartAge + 1.; dblCurrentAge <= dblEndAge; ++dblCurrentAge) { - try { - double dblHorizon = dblCurrentAge - dblStartAge; - - boolean bIsAlive = _ics.isAlive (dblCurrentAge); - - boolean bIsRetirement = _ics.retirementIndicator (dblCurrentAge); - - double dblBasicConsumptionDF = dr.basicConsumptionDF (dblHorizon); - - double dblWorkingAgeIncomeDF = dr.workingAgeIncomeDF (dblHorizon); - - double dblPensionBenefitsIncomeDF = dr.pensionBenefitsIncomeDF (dblHorizon); - - double dblBasicConsumption = _dblAfterTaxIncome * _ebc.rate (dblCurrentAge, _ics); - - double dblWorkingAgeIncome = !bIsRetirement && bIsAlive ? _dblAfterTaxIncome * _enfi.rate - (dblCurrentAge, _ics) : 0.; - - double dblPensionBenefitsIncome = bIsRetirement && bIsAlive ? _dblAfterTaxIncome * _enfi.rate - (dblCurrentAge, _ics) : 0.; - - lsNLCF.add (new org.drip.portfolioconstruction.alm.NetLiabilityCashFlow (dblCurrentAge, - bIsRetirement, bIsAlive, dblHorizon, _dblAfterTaxIncome, dblWorkingAgeIncome, - dblPensionBenefitsIncome, dblBasicConsumption, dblWorkingAgeIncomeDF, - dblPensionBenefitsIncomeDF, dblBasicConsumptionDF)); - - dblBasicConsumptionPV += dblBasicConsumption * dblBasicConsumptionDF; - dblWorkingAgeIncomePV += dblWorkingAgeIncome * dblWorkingAgeIncomeDF; - dblPensionBenefitsIncomePV += dblPensionBenefitsIncome * dblPensionBenefitsIncomeDF; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - try { - return new org.drip.portfolioconstruction.alm.NetLiabilityMetrics (lsNLCF, dblWorkingAgeIncomePV, - dblPensionBenefitsIncomePV, dblBasicConsumptionPV); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/portfolioconstruction/asset/AssetBounds.java b/org/drip/portfolioconstruction/asset/AssetBounds.java deleted file mode 100644 index c1ad0c7..0000000 --- a/org/drip/portfolioconstruction/asset/AssetBounds.java +++ /dev/null @@ -1,150 +0,0 @@ - -package org.drip.portfolioconstruction.asset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AssetBounds holds the Upper/Lower Bounds on an Asset. - * - * @author Lakshmi Krishnamurthy - */ - -public class AssetBounds { - private double _dblLower = java.lang.Double.NaN; - private double _dblUpper = java.lang.Double.NaN; - - /** - * AssetBounds Constructor - * - * @param dblLower The Asset Lower Bound - * @param dblUpper The Asset Upper Bound - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public AssetBounds ( - final double dblLower, - final double dblUpper) - throws java.lang.Exception - { - _dblLower = dblLower; - _dblUpper = dblUpper; - - if (org.drip.quant.common.NumberUtil.IsValid (_dblLower) && org.drip.quant.common.NumberUtil.IsValid - (_dblUpper) && _dblLower >= _dblUpper) - throw new java.lang.Exception ("AssetBounds Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Lower Bound - * - * @return The Lower Bound - */ - - public double lower() - { - return _dblLower; - } - - /** - * Retrieve the Upper Bound - * - * @return The Upper Bound - */ - - public double upper() - { - return _dblUpper; - } - - /** - * Retrieve a Viable Feasible Starting Point - * - * @return A Viable Feasible Starting Point - */ - - public double feasibleStart() - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblLower) && - !org.drip.quant.common.NumberUtil.IsValid (_dblUpper)) - return 0.; - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblLower)) return 0.5 * _dblUpper; - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblUpper)) return 2.0 * _dblLower; - - return 0.5 * (_dblLower + _dblUpper); - } - - /** - * Localize the Variate Value to within the Bounds - * - * @param dblVariate The Variate Value - * - * @return The Localized Variate Value - * - * @throws java.lang.Exception Thrown if the Input is Invalid - */ - - public double localize ( - final double dblVariate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate)) - throw new java.lang.Exception ("AssetBounds::localize => Invalid Inputs"); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblLower) && - !org.drip.quant.common.NumberUtil.IsValid (_dblUpper)) - return dblVariate; - - if (org.drip.quant.common.NumberUtil.IsValid (_dblLower) && dblVariate < _dblLower) return _dblLower; - - if (org.drip.quant.common.NumberUtil.IsValid (_dblUpper) && dblVariate > _dblUpper) return _dblUpper; - - return dblVariate; - } -} diff --git a/org/drip/portfolioconstruction/asset/AssetComponent.java b/org/drip/portfolioconstruction/asset/AssetComponent.java deleted file mode 100644 index f289b10..0000000 --- a/org/drip/portfolioconstruction/asset/AssetComponent.java +++ /dev/null @@ -1,100 +0,0 @@ - -package org.drip.portfolioconstruction.asset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AssetComponent holds the Amount of an Asset given by the corresponding ID. - * - * @author Lakshmi Krishnamurthy - */ - -public class AssetComponent { - private java.lang.String _strID = ""; - private double _dblAmount = java.lang.Double.NaN; - - /** - * AssetComponent Constructor - * - * @param strID Asset ID - * @param dblAmount Asset Amount - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public AssetComponent ( - final java.lang.String strID, - final double dblAmount) - throws java.lang.Exception - { - if (null == (_strID = strID) || _strID.isEmpty() || !org.drip.quant.common.NumberUtil.IsValid - (_dblAmount = dblAmount)) - throw new java.lang.Exception ("AssetComponent Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Asset ID - * - * @return The Asset ID - */ - - public java.lang.String id() - { - return _strID; - } - - /** - * Retrieve the Asset Amount - * - * @return The Asset Amount - */ - - public double amount() - { - return _dblAmount; - } -} diff --git a/org/drip/portfolioconstruction/asset/Portfolio.java b/org/drip/portfolioconstruction/asset/Portfolio.java deleted file mode 100644 index 2dc7783..0000000 --- a/org/drip/portfolioconstruction/asset/Portfolio.java +++ /dev/null @@ -1,315 +0,0 @@ - -package org.drip.portfolioconstruction.asset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * Portfolio implements an Instance of the Portfolio of Assets. - * - * @author Lakshmi Krishnamurthy - */ - -public class Portfolio { - private org.drip.portfolioconstruction.asset.AssetComponent[] _aAC = null; - - /** - * Construct a Portfolio Instance from the Array of Asset ID's and their Amounts - * - * @param astrAssetID Array of Asset IDs - * @param adblAmount Array of Amounts - * - * @return The Portfolio Instance - */ - - public static final Portfolio Standard ( - final java.lang.String[] astrAssetID, - final double[] adblAmount) - { - if (null == astrAssetID || null == adblAmount) return null; - - int iNumAsset = astrAssetID.length; - org.drip.portfolioconstruction.asset.AssetComponent[] aAC = 0 == iNumAsset ? null : new - org.drip.portfolioconstruction.asset.AssetComponent[iNumAsset]; - - if (0 == iNumAsset || iNumAsset != adblAmount.length) return null; - - try { - for (int i = 0; i < iNumAsset; ++i) - aAC[i] = new org.drip.portfolioconstruction.asset.AssetComponent (astrAssetID[i], - adblAmount[i]); - - return new Portfolio (aAC); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Portfolio Constructor - * - * @param aAC Array of the Asset Components - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public Portfolio ( - final org.drip.portfolioconstruction.asset.AssetComponent[] aAC) - throws java.lang.Exception - { - if (null == (_aAC = aAC)) throw new java.lang.Exception ("Portfolio Constructor => Invalid Inputs"); - - int iNumAsset = _aAC.length; - - if (0 == iNumAsset) throw new java.lang.Exception ("Portfolio Constructor => Invalid Inputs"); - - for (int i = 0; i < iNumAsset; ++i) { - if (null == _aAC[i]) throw new java.lang.Exception ("Portfolio Constructor => Invalid Inputs"); - } - } - - /** - * Retrieve the Array of the Asset Components - * - * @return Array of the Asset Components - */ - - public org.drip.portfolioconstruction.asset.AssetComponent[] assets() - { - return _aAC; - } - - /** - * Retrieve the Notional of the Portfolio - * - * @return Notional of the Portfolio - */ - - public double notional() - { - double dblTotalWeight = 0.; - int iNumAsset = _aAC.length; - - for (int i = 0; i < iNumAsset; ++i) - dblTotalWeight += _aAC[i].amount(); - - return dblTotalWeight; - } - - /** - * Retrieve the Array of Asset IDs - * - * @return The Array of Asset IDs - */ - - public java.lang.String[] id() - { - int iNumAsset = _aAC.length; - java.lang.String[] astrAssetID = new java.lang.String[iNumAsset]; - - for (int i = 0; i < iNumAsset; ++i) - astrAssetID[i] = _aAC[i].id(); - - return astrAssetID; - } - - /** - * Retrieve the Multivariate Meta Instance around the Assets - * - * @return The Multivariate Meta Instance around the Assets - */ - - public org.drip.measure.continuousjoint.MultivariateMeta meta() - { - try { - return new org.drip.measure.continuousjoint.MultivariateMeta (id()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Array of Asset Weights - * - * @return The Array of Asset Weights - */ - - public double[] weights() - { - int iNumAsset = _aAC.length; - double[] adblWeight = new double[iNumAsset]; - - for (int i = 0; i < iNumAsset; ++i) - adblWeight[i] = _aAC[i].amount(); - - return adblWeight; - } - - /** - * Retrieve the Asset Component with the Minimal Weight - * - * @return The Asset Component with the Minimal Weight - */ - - public org.drip.portfolioconstruction.asset.AssetComponent minWeight() - { - int iNumAsset = _aAC.length; - org.drip.portfolioconstruction.asset.AssetComponent acMinWeight = _aAC[0]; - - double dblMinWeight = _aAC[0].amount(); - - for (int i = 0; i < iNumAsset; ++i) { - double dblAmount = _aAC[i].amount(); - - if (dblAmount < dblMinWeight) { - acMinWeight = _aAC[i]; - dblMinWeight = dblAmount; - } - } - - return acMinWeight; - } - - /** - * Retrieve the Asset Component with the Maximal Weight - * - * @return The Asset Component with the Maximal Weight - */ - - public org.drip.portfolioconstruction.asset.AssetComponent maxWeight() - { - int iNumAsset = _aAC.length; - org.drip.portfolioconstruction.asset.AssetComponent acMaxWeight = _aAC[0]; - - double dblMaxWeight = _aAC[0].amount(); - - for (int i = 0; i < iNumAsset; ++i) { - double dblAmount = _aAC[i].amount(); - - if (dblAmount > dblMaxWeight) { - acMaxWeight = _aAC[i]; - dblMaxWeight = dblAmount; - } - } - - return acMaxWeight; - } - - /** - * Retrieve the Expected Returns of the Portfolio - * - * @param apsp The Asset Pool Statistical Properties Instance - * - * @return Expected Returns of the Portfolio - * - * @throws java.lang.Exception Thrown if the Expected Returns cannot be calculated - */ - - public double expectedReturn ( - final org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties apsp) - throws java.lang.Exception - { - int iNumAsset = _aAC.length; - double dblExpectedReturn = 0.; - - for (int i = 0; i < iNumAsset; ++i) { - org.drip.portfolioconstruction.params.AssetStatisticalProperties asp = apsp.asp (_aAC[i].id()); - - if (null == asp) throw new java.lang.Exception ("Portfolio::expectedReturn => Invalid Inputs"); - - dblExpectedReturn += _aAC[i].amount() * asp.expectedReturn(); - } - - return dblExpectedReturn; - } - - /** - * Retrieve the Variance of the Portfolio - * - * @param apsp The Asset Pool Statistical Properties Instance - * - * @return Variance of the Portfolio - * - * @throws java.lang.Exception Thrown if the Variance cannot be calculated - */ - - public double variance ( - final org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties apsp) - throws java.lang.Exception - { - double dblVariance = 0.; - int iNumAsset = _aAC.length; - - for (int i = 0; i < iNumAsset; ++i) { - double dblAmountI = _aAC[i].amount(); - - java.lang.String strIDI = _aAC[i].id(); - - org.drip.portfolioconstruction.params.AssetStatisticalProperties aspI = apsp.asp (strIDI); - - if (null == aspI) throw new java.lang.Exception ("Portfolio::variance => Invalid Inputs"); - - double dblVarianceI = aspI.variance(); - - for (int j = 0; j < iNumAsset; ++j) { - java.lang.String strIDJ = _aAC[j].id(); - - org.drip.portfolioconstruction.params.AssetStatisticalProperties aspJ = apsp.asp (strIDJ); - - if (null == aspJ) throw new java.lang.Exception ("Portfolio::variance => Invalid Inputs"); - - dblVariance += dblAmountI * _aAC[j].amount() * java.lang.Math.sqrt (dblVarianceI * - aspJ.variance()) * (i == j ? 1. : apsp.correlation (strIDI, strIDJ)); - } - } - - return dblVariance; - } -} diff --git a/org/drip/portfolioconstruction/asset/PortfolioBenchmarkMetrics.java b/org/drip/portfolioconstruction/asset/PortfolioBenchmarkMetrics.java deleted file mode 100644 index e9e5c54..0000000 --- a/org/drip/portfolioconstruction/asset/PortfolioBenchmarkMetrics.java +++ /dev/null @@ -1,167 +0,0 @@ - -package org.drip.portfolioconstruction.asset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PortfolioBenchmarkMetrics holds the Metrics that result from a Relative Valuation of a Portfolio with - * respect to a Benchmark. - * - * - Grinold, R. C., and R. N. Kahn (1999): Active Portfolio Management, 2nd Edition, McGraw-Hill, NY. - * - * - Idzorek, T. (2005): A Step-by-Step Guide to the Black-Litterman Model: Incorporating User-Specified - * Confidence Levels, Ibbotson Associates, Chicago - * - * @author Lakshmi Krishnamurthy - */ - -public class PortfolioBenchmarkMetrics { - private double _dblBeta = java.lang.Double.NaN; - private double _dblActiveBeta = java.lang.Double.NaN; - private double _dblActiveRisk = java.lang.Double.NaN; - private double _dblActiveReturn = java.lang.Double.NaN; - private double _dblResidualRisk = java.lang.Double.NaN; - private double _dblResidualReturn = java.lang.Double.NaN; - - /** - * PortfolioBenchmarkMetrics Constructor - * - * @param dblBeta Portfolio-to-Benchmark Beta - * @param dblActiveBeta Portfolio-to-Benchmark Active Beta - * @param dblActiveRisk Portfolio-to-Benchmark Active Risk - * @param dblActiveReturn Portfolio-to-Benchmark Active Return - * @param dblResidualRisk Portfolio-to-Benchmark Residual Risk - * @param dblResidualReturn Portfolio-to-Benchmark Residual Return - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public PortfolioBenchmarkMetrics ( - final double dblBeta, - final double dblActiveBeta, - final double dblActiveRisk, - final double dblActiveReturn, - final double dblResidualRisk, - final double dblResidualReturn) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblBeta = dblBeta) || - !org.drip.quant.common.NumberUtil.IsValid (_dblActiveBeta = dblActiveBeta) || - !org.drip.quant.common.NumberUtil.IsValid (_dblActiveRisk = dblActiveRisk) || - !org.drip.quant.common.NumberUtil.IsValid (_dblActiveReturn = dblActiveReturn) || - !org.drip.quant.common.NumberUtil.IsValid (_dblResidualRisk = dblResidualRisk) || - !org.drip.quant.common.NumberUtil.IsValid (_dblResidualReturn = - dblResidualReturn)) - throw new java.lang.Exception ("PortfolioBenchmarkMetrics Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Portfolio-to-Benchmark Beta - * - * @return The Portfolio-to-Benchmark Beta - */ - - public double beta() - { - return _dblBeta; - } - - /** - * Retrieve the Portfolio-to-Benchmark Active Beta - * - * @return The Portfolio-to-Benchmark Active Beta - */ - - public double activeBeta() - { - return _dblActiveBeta; - } - - /** - * Retrieve the Portfolio-to-Benchmark Active Risk - * - * @return The Portfolio-to-Benchmark Active Risk - */ - - public double activeRisk() - { - return _dblActiveRisk; - } - - /** - * Retrieve the Portfolio-to-Benchmark Active Return - * - * @return The Portfolio-to-Benchmark Active Return - */ - - public double activeReturn() - { - return _dblActiveReturn; - } - - /** - * Retrieve the Portfolio-to-Benchmark Residual Risk - * - * @return The Portfolio-to-Benchmark Residual Risk - */ - - public double residualRisk() - { - return _dblResidualRisk; - } - - /** - * Retrieve the Portfolio-to-Benchmark Residual Return - * - * @return The Portfolio-to-Benchmark Residual Return - */ - - public double residualReturn() - { - return _dblResidualReturn; - } -} diff --git a/org/drip/portfolioconstruction/asset/PortfolioMetrics.java b/org/drip/portfolioconstruction/asset/PortfolioMetrics.java deleted file mode 100644 index 1ae01e0..0000000 --- a/org/drip/portfolioconstruction/asset/PortfolioMetrics.java +++ /dev/null @@ -1,146 +0,0 @@ - -package org.drip.portfolioconstruction.asset; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PortfolioMetrics holds the Expected Portfolio Returns and the Standard Deviation. - * - * @author Lakshmi Krishnamurthy - */ - -public class PortfolioMetrics { - private double[] _adblImpliedBeta = null; - private double _dblSharpeRatio = java.lang.Double.NaN; - private double _dblExcessReturnsMean = java.lang.Double.NaN; - private double _dblExcessReturnsVariance = java.lang.Double.NaN; - private double _dblExcessReturnsStandardDeviation = java.lang.Double.NaN; - - /** - * PortfolioMetrics Constructor - * - * @param dblExcessReturnsMean The Expected Portfolio Excess Returns Mean - * @param dblExcessReturnsVariance The Portfolio Excess Returns Variance - * @param dblExcessReturnsStandardDeviation The Excess Returns Portfolio Standard Deviation - * @param dblSharpeRatio Portfolio Sharpe Ratio - * @param adblImpliedBeta Portfolio Implied Beta Vector - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public PortfolioMetrics ( - final double dblExcessReturnsMean, - final double dblExcessReturnsVariance, - final double dblExcessReturnsStandardDeviation, - final double dblSharpeRatio, - final double[] adblImpliedBeta) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblExcessReturnsMean = dblExcessReturnsMean) || - !org.drip.quant.common.NumberUtil.IsValid (_dblExcessReturnsVariance = dblExcessReturnsVariance) - || !org.drip.quant.common.NumberUtil.IsValid (_dblExcessReturnsStandardDeviation = - dblExcessReturnsStandardDeviation)|| !org.drip.quant.common.NumberUtil.IsValid - (_dblSharpeRatio = dblSharpeRatio) || null == (_adblImpliedBeta = adblImpliedBeta) || - 0 == _adblImpliedBeta.length) - throw new java.lang.Exception ("PortfolioMetrics Constructor => Invalid Inputs!"); - } - - /** - * Retrieve the Portfolio Expected Excess Returns - * - * @return The Portfolio Expected Excess Returns - */ - - public double excessReturnsMean() - { - return _dblExcessReturnsMean; - } - - /** - * Retrieve the Portfolio Excess Returns Variance - * - * @return The Portfolio Excess Returns Variance - */ - - public double excessReturnsVariance() - { - return _dblExcessReturnsVariance; - } - - /** - * Retrieve the Portfolio Excess Returns Standard Deviation - * - * @return The Portfolio Excess Returns Standard Deviation - */ - - public double excessReturnsStandardDeviation() - { - return _dblExcessReturnsStandardDeviation; - } - - /** - * Retrieve the Portfolio Sharpe Ratio - * - * @return The Portfolio Sharpe Ratio - */ - - public double sharpeRatio() - { - return _dblSharpeRatio; - } - - /** - * Retrieve the Portfolio Implied Beta Vector - * - * @return The Portfolio Implied Beta Vector - */ - - public double[] impliedBeta() - { - return _adblImpliedBeta; - } -} diff --git a/org/drip/portfolioconstruction/bayesian/BlackLittermanCombinationEngine.java b/org/drip/portfolioconstruction/bayesian/BlackLittermanCombinationEngine.java deleted file mode 100644 index a655473..0000000 --- a/org/drip/portfolioconstruction/bayesian/BlackLittermanCombinationEngine.java +++ /dev/null @@ -1,579 +0,0 @@ - -package org.drip.portfolioconstruction.bayesian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * BlackLittermanCombinationEngine implements the Engine that generates the Combined/Posterior Distributions - * from the Prior and the Conditional Joint R^1 Multivariate Normal Distributions. The References are: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * - Idzorek, T. (2005): A Step-by-Step Guide to the Black-Litterman Model: Incorporating User-Specified - * Confidence Levels, Ibbotson Associates, Chicago - * - * @author Lakshmi Krishnamurthy - */ - -public class BlackLittermanCombinationEngine { - private org.drip.portfolioconstruction.bayesian.ProjectionSpecification _ps = null; - private org.drip.portfolioconstruction.bayesian.PriorControlSpecification _pcs = null; - private org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput _frooUnadjusted = null; - - private org.drip.measure.bayesian.ScopingProjectionVariateDistribution scopingProjectionDistribution() - { - double[][] aadblAssetSpaceExcessReturnsCovariance = _frooUnadjusted.assetExcessReturnsCovariance(); - - double[] adblPriorMean = _frooUnadjusted.expectedAssetExcessReturns(); - - int iNumAsset = aadblAssetSpaceExcessReturnsCovariance.length; - double[][] aadblPriorCovariance = new double[iNumAsset][iNumAsset]; - - double dblRiskFreeRate = _pcs.riskFreeRate(); - - double dblTau = _pcs.tau(); - - for (int i = 0; i < iNumAsset; ++i) { - adblPriorMean[i] = adblPriorMean[i] + dblRiskFreeRate; - - for (int j = 0; j < iNumAsset; ++j) - aadblPriorCovariance[i][j] = aadblAssetSpaceExcessReturnsCovariance[i][j] * dblTau; - } - - try { - org.drip.measure.bayesian.ScopingProjectionVariateDistribution spvd = new - org.drip.measure.bayesian.ScopingProjectionVariateDistribution - (org.drip.measure.gaussian.R1MultivariateNormal.Standard - (_frooUnadjusted.optimalPortfolio().meta(), adblPriorMean, aadblPriorCovariance)); - - return spvd.addProjectionDistributionLoading ("VIEW", new - org.drip.measure.bayesian.ProjectionDistributionLoading (_ps.excessReturnsDistribution(), - _ps.assetSpaceLoading())) ? spvd : null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private double[] allocationTilt ( - final org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput frooAdjusted) - { - double[] adblUnadjustedWeights = _frooUnadjusted.optimalPortfolio().weights(); - - double[] adblAdjustedWeights = frooAdjusted.optimalPortfolio().weights(); - - int iNumAsset = adblUnadjustedWeights.length; - double[] adblAllocationTilt = new double[iNumAsset]; - - for (int i = 0; i < iNumAsset; ++i) - adblAllocationTilt[i] = adblAdjustedWeights[i] - adblUnadjustedWeights[i]; - - return adblAllocationTilt; - } - - /** - * BlackLittermanCombinationEngine Construction - * - * @param frooUnadjusted The Unadjusted Instance of FROO - * @param pcs The Prior Control Specification Instance - * @param ps The View Projection Specification Settings - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BlackLittermanCombinationEngine ( - final org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput frooUnadjusted, - final org.drip.portfolioconstruction.bayesian.PriorControlSpecification pcs, - final org.drip.portfolioconstruction.bayesian.ProjectionSpecification ps) - throws java.lang.Exception - { - if (null == (_frooUnadjusted = frooUnadjusted) || null == (_pcs = pcs) || null == (_ps = ps)) - throw new java.lang.Exception ("BlackLittermanCombinationEngine Constructor => Invalid Inputs"); - } - - /** - * Conduct a Black Litterman Run using a Theil-like Mixed Model Estimator For 0% Confidence in the - * Projection - * - * @return Output of the Black Litterman Run - */ - - public org.drip.portfolioconstruction.bayesian.BlackLittermanOutput noConfidenceRun() - { - double[][] aadblAssetSpaceExcessReturnsCovariance = _frooUnadjusted.assetExcessReturnsCovariance(); - - double dblTau = _pcs.tau(); - - int iNumAsset = aadblAssetSpaceExcessReturnsCovariance.length; - double[][] aadblBayesianExcessReturnsCovariance = new double[iNumAsset][iNumAsset]; - - for (int i = 0; i < iNumAsset; ++i) { - for (int j = 0; j < iNumAsset; ++j) - aadblBayesianExcessReturnsCovariance[i][j] = aadblAssetSpaceExcessReturnsCovariance[i][j] * - dblTau; - } - - org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput frooAdjusted = - org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput.Forward - (_frooUnadjusted.optimalPortfolio().meta().names(), - _frooUnadjusted.expectedAssetExcessReturns(), aadblBayesianExcessReturnsCovariance, - _frooUnadjusted.riskAversion()); - - try { - return null == frooAdjusted ? null : new - org.drip.portfolioconstruction.bayesian.BlackLittermanOutput (frooAdjusted, allocationTilt - (frooAdjusted)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Conduct a Black Litterman Run using a Theil-like Mixed Model Estimator Using the specified Confidence - * Level - * - * @return Output of the Black Litterman Run - */ - - public org.drip.portfolioconstruction.bayesian.BlackLittermanCustomConfidenceOutput customConfidenceRun() - { - double[][] aadblAssetSpaceExcessReturnsCovariance = _frooUnadjusted.assetExcessReturnsCovariance(); - - org.drip.measure.continuousjoint.MultivariateMeta meta = _frooUnadjusted.optimalPortfolio().meta(); - - org.drip.measure.bayesian.ScopingProjectionVariateDistribution spvd = - scopingProjectionDistribution(); - - if (null == spvd) return null; - - org.drip.measure.bayesian.JointPosteriorMetrics jpm = - org.drip.measure.bayesian.TheilMixedEstimationModel.GenerateComposite (spvd, "VIEW", - org.drip.measure.gaussian.R1MultivariateNormal.Standard (meta, - spvd.scopingDistribution().mean(), aadblAssetSpaceExcessReturnsCovariance)); - - if (null == jpm) return null; - - org.drip.measure.continuousjoint.R1Multivariate r1mPosterior = jpm.posterior(); - - org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput frooAdjusted = - org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput.Forward (meta.names(), - r1mPosterior.mean(), _pcs.useAlternateReferenceModel() ? - aadblAssetSpaceExcessReturnsCovariance : - ((org.drip.measure.gaussian.R1MultivariateNormal) - r1mPosterior).covariance().covarianceMatrix(), _frooUnadjusted.riskAversion()); - - if (null == frooAdjusted) return null; - - try { - return new org.drip.portfolioconstruction.bayesian.BlackLittermanCustomConfidenceOutput - (frooAdjusted, allocationTilt (frooAdjusted), jpm); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Conduct a Black Litterman Run using a Theil-like Mixed Model Estimator For 100% Confidence in the - * Projection - * - * @return Output of the Black Litterman Run - */ - - public org.drip.portfolioconstruction.bayesian.BlackLittermanOutput fullConfidenceRun() - { - org.drip.measure.continuousjoint.MultivariateMeta meta = _frooUnadjusted.optimalPortfolio().meta(); - - double[][] aadblAssetSpaceExcessReturnsCovariance = _frooUnadjusted.assetExcessReturnsCovariance(); - - double dblRiskAversion = _frooUnadjusted.riskAversion(); - - java.lang.String[] astrAssetID = meta.names(); - - org.drip.measure.bayesian.ScopingProjectionVariateDistribution spvd = - scopingProjectionDistribution(); - - if (null == spvd) return null; - - org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput frooAdjusted = null; - - if (_pcs.useAlternateReferenceModel()) - frooAdjusted = org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput.Forward - (astrAssetID, - org.drip.measure.bayesian.TheilMixedEstimationModel.ProjectionInducedScopingMean (spvd, - "VIEW"), aadblAssetSpaceExcessReturnsCovariance, dblRiskAversion); - else { - org.drip.measure.gaussian.R1MultivariateNormal r1mnCombined = - org.drip.measure.bayesian.TheilMixedEstimationModel.ProjectionInducedScopingDistribution - (spvd, "VIEW", org.drip.measure.gaussian.R1MultivariateNormal.Standard (meta, - spvd.scopingDistribution().mean(), aadblAssetSpaceExcessReturnsCovariance)); - - frooAdjusted = null == r1mnCombined ? null : - org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput.Forward - (astrAssetID, r1mnCombined.mean(), aadblAssetSpaceExcessReturnsCovariance, - dblRiskAversion); - } - - try { - return null == frooAdjusted ? null : new - org.drip.portfolioconstruction.bayesian.BlackLittermanOutput (frooAdjusted, allocationTilt - (frooAdjusted)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Idzorek Implied Projection Confidence Level - * - * @return The Idzorek Implied Projection Confidence Level - */ - - public org.drip.portfolioconstruction.bayesian.ProjectionImpliedConfidenceOutput impliedConfidenceRun() - { - double[][] aadblAssetSpaceExcessReturnsCovariance = _frooUnadjusted.assetExcessReturnsCovariance(); - - org.drip.portfolioconstruction.asset.Portfolio pfUnadjusted = _frooUnadjusted.optimalPortfolio(); - - org.drip.measure.continuousjoint.MultivariateMeta meta = pfUnadjusted.meta(); - - boolean bUseAlternateReferenceModel = _pcs.useAlternateReferenceModel(); - - double dblRiskAversion = _frooUnadjusted.riskAversion(); - - java.lang.String[] astrAssetID = meta.names(); - - org.drip.measure.bayesian.ScopingProjectionVariateDistribution spvd = - scopingProjectionDistribution(); - - if (null == spvd) return null; - - org.drip.measure.bayesian.JointPosteriorMetrics jpm = - org.drip.measure.bayesian.TheilMixedEstimationModel.GenerateComposite (spvd, "VIEW", - org.drip.measure.gaussian.R1MultivariateNormal.Standard (meta, - spvd.scopingDistribution().mean(), aadblAssetSpaceExcessReturnsCovariance)); - - if (null == jpm) return null; - - org.drip.measure.continuousjoint.R1Multivariate r1mPosterior = jpm.posterior(); - - org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput frooCustomConfidence = - org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput.Forward (astrAssetID, - r1mPosterior.mean(), bUseAlternateReferenceModel ? aadblAssetSpaceExcessReturnsCovariance : - ((org.drip.measure.gaussian.R1MultivariateNormal) - r1mPosterior).covariance().covarianceMatrix(), dblRiskAversion); - - if (null == frooCustomConfidence) return null; - - org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput frooFullConfidence = null; - - if (bUseAlternateReferenceModel) - frooFullConfidence = - org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput.Forward - (astrAssetID, - org.drip.measure.bayesian.TheilMixedEstimationModel.ProjectionInducedScopingMean - (spvd, "VIEW"), aadblAssetSpaceExcessReturnsCovariance, dblRiskAversion); - else { - org.drip.measure.gaussian.R1MultivariateNormal r1mnCombined = - org.drip.measure.bayesian.TheilMixedEstimationModel.ProjectionInducedScopingDistribution - (spvd, "VIEW", org.drip.measure.gaussian.R1MultivariateNormal.Standard (meta, - spvd.scopingDistribution().mean(), aadblAssetSpaceExcessReturnsCovariance)); - - frooFullConfidence = null == r1mnCombined ? null : - org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput.Forward - (astrAssetID, r1mnCombined.mean(), aadblAssetSpaceExcessReturnsCovariance, - dblRiskAversion); - } - - try { - return new org.drip.portfolioconstruction.bayesian.ProjectionImpliedConfidenceOutput - (pfUnadjusted.weights(), new - org.drip.portfolioconstruction.bayesian.BlackLittermanCustomConfidenceOutput - (frooCustomConfidence, allocationTilt (frooCustomConfidence), jpm), new - org.drip.portfolioconstruction.bayesian.BlackLittermanOutput (frooFullConfidence, - allocationTilt (frooFullConfidence))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Exposure Loadings Attribution on a per-Projection Basis - * - * @return The Exposure Loadings Attribution on a per-Projection Basis - */ - - public org.drip.portfolioconstruction.bayesian.ProjectionExposure projectionExposureAttribution() - { - org.drip.measure.bayesian.ScopingProjectionVariateDistribution spvd = - scopingProjectionDistribution(); - - if (null == spvd) return null; - - double[] adblIntraViewComponent = - org.drip.measure.bayesian.TheilMixedEstimationModel.ProjectionPrecisionMeanProduct (spvd, - "VIEW"); - - if (null == adblIntraViewComponent) return null; - - double dblTau = _pcs.tau(); - - double dblRiskAversion = _frooUnadjusted.riskAversion(); - - double[][] aadblProjectionSpaceLoading = _ps.assetSpaceLoading(); - - double[][] aadblAssetExcessReturnsCovariance = _frooUnadjusted.assetExcessReturnsCovariance(); - - int iNumView = adblIntraViewComponent.length; - double dblProjectionConfidenceScaler = 1. / dblTau; - double dblAssetConfidenceScaler = 1. / (1. + dblTau); - int iNumAsset = aadblAssetExcessReturnsCovariance.length; - double[][] aadblCompositeConfidenceCovariance = new double[iNumView][iNumView]; - - for (int i = 0; i < iNumView; ++i) - adblIntraViewComponent[i] = adblIntraViewComponent[i] * dblTau / dblRiskAversion; - - double[][] aadblProjectionSpaceAssetCovariance = org.drip.quant.linearalgebra.Matrix.Product - (org.drip.quant.linearalgebra.Matrix.Product (aadblProjectionSpaceLoading, - aadblAssetExcessReturnsCovariance), org.drip.quant.linearalgebra.Matrix.Transpose - (aadblProjectionSpaceLoading)); - - if (null == aadblProjectionSpaceAssetCovariance) return null; - - double[][] aadblProjectionCovariance = - _ps.excessReturnsDistribution().covariance().covarianceMatrix(); - - for (int i = 0; i < iNumView; ++i) { - for (int j = 0; j < iNumView; ++j) - aadblCompositeConfidenceCovariance[i][j] = aadblProjectionCovariance[i][j] * - dblProjectionConfidenceScaler + aadblProjectionSpaceAssetCovariance[i][j] * - dblAssetConfidenceScaler; - } - - double[][] aadblCompositePrecisionProjectionScoping = org.drip.quant.linearalgebra.Matrix.Product - (org.drip.quant.linearalgebra.Matrix.Product - (org.drip.quant.linearalgebra.Matrix.InvertUsingGaussianElimination - (aadblCompositeConfidenceCovariance), aadblProjectionSpaceLoading), - aadblAssetExcessReturnsCovariance); - - if (null == aadblCompositePrecisionProjectionScoping) return null; - - for (int i = 0; i < iNumView; ++i) { - for (int j = 0; j < iNumAsset; ++j) - aadblCompositePrecisionProjectionScoping[i][j] = -1. * dblAssetConfidenceScaler * - aadblCompositePrecisionProjectionScoping[i][j]; - } - - try { - return new org.drip.portfolioconstruction.bayesian.ProjectionExposure (adblIntraViewComponent, - org.drip.quant.linearalgebra.Matrix.Product (aadblCompositePrecisionProjectionScoping, - _frooUnadjusted.optimalPortfolio().weights()), - org.drip.quant.linearalgebra.Matrix.Product - (org.drip.quant.linearalgebra.Matrix.Product - (aadblCompositePrecisionProjectionScoping, - org.drip.quant.linearalgebra.Matrix.Transpose - (aadblProjectionSpaceLoading)), adblIntraViewComponent), - aadblCompositeConfidenceCovariance); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Idzorek Implied Tilt from the User Projection Confidence Level - * - * @param adblUserSpecifiedProjectionConfidence Array of User-specified Projection Confidence - * - * @return The Idzorek Implied Tilt from the Projection Confidence Level - */ - - public double[][] userConfidenceProjectionTilt ( - final double[] adblUserSpecifiedProjectionConfidence) - { - if (null == adblUserSpecifiedProjectionConfidence) return null; - - double[][] aadblAssetSpaceLoading = _ps.assetSpaceLoading(); - - int iNumAsset = aadblAssetSpaceLoading[0].length; - int iNumProjection = aadblAssetSpaceLoading.length; - double[][] aadblProjectionTilt = new double[iNumProjection][iNumAsset]; - - if (iNumProjection != adblUserSpecifiedProjectionConfidence.length) return null; - - org.drip.portfolioconstruction.bayesian.BlackLittermanOutput bloFullConfidence = fullConfidenceRun(); - - if (null == bloFullConfidence) return null; - - double[] adblFullConfidenceWeightsDeviation = bloFullConfidence.allocationAdjustmentTilt(); - - for (int i = 0; i < iNumProjection; ++i) { - for (int j = 0; j < iNumAsset; ++j) - aadblProjectionTilt[i][j] = adblFullConfidenceWeightsDeviation[j] * - aadblAssetSpaceLoading[i][j] * adblUserSpecifiedProjectionConfidence[i]; - } - - return aadblProjectionTilt; - } - - /** - * Compute the Mismatch between the User Specified Projection and the Custom Confidence Implied Tilts - * - * @param adblUserConfidenceProjectionTilt Array of the User Confidence induced Projection Tilts - * @param iProjectionIndex The Index into the Projection Meta - * @param dblProjectionVariance The Projection Variance - * - * @return The Squared Mismatch - * - * @throws java.lang.Exception Thrown if the Squared Mismatch cannot be calculated - */ - - public double tiltMismatch ( - final double[] adblUserConfidenceProjectionTilt, - final int iProjectionIndex, - final double dblProjectionVariance) - throws java.lang.Exception - { - if (null == adblUserConfidenceProjectionTilt || !org.drip.quant.common.NumberUtil.IsValid - (dblProjectionVariance)) - throw new java.lang.Exception - ("BlackLittermanCombinationEngine::tiltMismatch => Invalid Inputs"); - - org.drip.measure.gaussian.R1MultivariateNormal r1mnTotal = _ps.excessReturnsDistribution(); - - org.drip.measure.gaussian.R1MultivariateNormal r1mnProjection = - org.drip.measure.gaussian.R1MultivariateNormal.Standard (new java.lang.String[] - {r1mnTotal.meta().names()[iProjectionIndex]}, new double[] - {r1mnTotal.mean()[iProjectionIndex]}, new double[][] {{dblProjectionVariance}}); - - if (null == r1mnProjection) - throw new java.lang.Exception - ("BlackLittermanCombinationEngine::tiltMismatch => Invalid Inputs"); - - org.drip.portfolioconstruction.bayesian.ProjectionSpecification psProjection = new - org.drip.portfolioconstruction.bayesian.ProjectionSpecification (r1mnProjection, new double[][] - {_ps.assetSpaceLoading()[iProjectionIndex]}); - - BlackLittermanCombinationEngine blceProjection = new BlackLittermanCombinationEngine - (_frooUnadjusted, _pcs, psProjection); - - org.drip.portfolioconstruction.bayesian.BlackLittermanCustomConfidenceOutput blcco = - blceProjection.customConfidenceRun(); - - if (null == blcco) - throw new java.lang.Exception - ("BlackLittermanCombinationEngine::tiltMismatch => Invalid Inputs"); - - double[] adblPosteriorTilt = blcco.allocationAdjustmentTilt(); - - int iNumAsset = adblPosteriorTilt.length; - double dblTiltGap = 0.; - - if (iNumAsset != adblUserConfidenceProjectionTilt.length) - throw new java.lang.Exception - ("BlackLittermanCombinationEngine::tiltMismatch => Invalid Inputs"); - - for (int i = 0; i < iNumAsset; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (adblUserConfidenceProjectionTilt[i])) - throw new java.lang.Exception - ("BlackLittermanCombinationEngine::tiltMismatch => Invalid Inputs"); - - double dblAssetTiltGap = adblPosteriorTilt[i] - adblUserConfidenceProjectionTilt[i]; - dblTiltGap = dblTiltGap + dblAssetTiltGap * dblAssetTiltGap; - } - - return dblTiltGap; - } - - /** - * Generate the Squared Tilt Departure R^1 To R^1 - * - * @param adblUserConfidenceProjectionTilt Array of the User Confidence induced Projection Tilts - * @param iProjectionIndex The Index into the Projection Meta - * @param bDerivative TRUE - Generate the Derivative of the Tilt Departure - * - * @return The Squared Tilt Departure R^1 To R^1 - */ - - public org.drip.function.definition.R1ToR1 tiltDepartureR1ToR1 ( - final double[] adblUserConfidenceProjectionTilt, - final int iProjectionIndex, - final boolean bDerivative) - { - final org.drip.function.definition.R1ToR1 r1ToR1TiltDeparture = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblProjectionVariance) - throws java.lang.Exception - { - return tiltMismatch (adblUserConfidenceProjectionTilt, iProjectionIndex, - dblProjectionVariance); - } - }; - - if (!bDerivative) return r1ToR1TiltDeparture; - - return new org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblProjectionVariance) - throws java.lang.Exception - { - return r1ToR1TiltDeparture.derivative (dblProjectionVariance, 1); - } - }; - } -} diff --git a/org/drip/portfolioconstruction/bayesian/BlackLittermanCustomConfidenceOutput.java b/org/drip/portfolioconstruction/bayesian/BlackLittermanCustomConfidenceOutput.java deleted file mode 100644 index 54bce26..0000000 --- a/org/drip/portfolioconstruction/bayesian/BlackLittermanCustomConfidenceOutput.java +++ /dev/null @@ -1,100 +0,0 @@ - -package org.drip.portfolioconstruction.bayesian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * BlackLittermanCustomConfidenceOutput holds the Outputs generated from a Custom COnfidence Black Litterman - * Bayesian COmbination Run. The References are: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * - Idzorek, T. (2005): A Step-by-Step Guide to the Black-Litterman Model: Incorporating User-Specified - * Confidence Levels, Ibbotson Associates, Chicago - * - * @author Lakshmi Krishnamurthy - */ - -public class BlackLittermanCustomConfidenceOutput extends - org.drip.portfolioconstruction.bayesian.BlackLittermanOutput { - private org.drip.measure.bayesian.JointPosteriorMetrics _jpm = null; - - /** - * BlackLittermanCustomConfidenceOutput Constructor - * - * @param frooAdjusted The Adjusted Forward Reverse Equilibrium Optimization Output - * @param adblAllocationAdjustmentTilt Array of the Allocation Adjustment Tilts - * @param jpm The Bayesian Joint/Posterior Metrics Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BlackLittermanCustomConfidenceOutput ( - final org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput frooAdjusted, - final double[] adblAllocationAdjustmentTilt, - final org.drip.measure.bayesian.JointPosteriorMetrics jpm) - throws java.lang.Exception - { - super (frooAdjusted, adblAllocationAdjustmentTilt); - - if (null == (_jpm = jpm)) - throw new java.lang.Exception - ("BlackLittermanCustomConfidenceOutput Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Bayesian Joint/Posterior Metrics - * - * @return The Bayesian Joint/Posterior Metrics - */ - - public org.drip.measure.bayesian.JointPosteriorMetrics combinationMetrics() - { - return _jpm; - } -} diff --git a/org/drip/portfolioconstruction/bayesian/BlackLittermanOutput.java b/org/drip/portfolioconstruction/bayesian/BlackLittermanOutput.java deleted file mode 100644 index e323119..0000000 --- a/org/drip/portfolioconstruction/bayesian/BlackLittermanOutput.java +++ /dev/null @@ -1,107 +0,0 @@ - -package org.drip.portfolioconstruction.bayesian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * BlackLittermanOutput holds the essential Outputs generated from either a Full or a Custom Confidence of - * the Projection Black Litterman Bayesian Combination Run. The References are: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * - Idzorek, T. (2005): A Step-by-Step Guide to the Black-Litterman Model: Incorporating User-Specified - * Confidence Levels, Ibbotson Associates, Chicago - * - * @author Lakshmi Krishnamurthy - */ - -public class BlackLittermanOutput { - private double[] _adblAllocationAdjustmentTilt = null; - private org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput _frooAdjusted = null; - - /** - * BlackLittermanOutput Constructor - * - * @param frooAdjusted The Black Litterman Adjusted Forward Reverse Equilibrium Optimization Output - * @param adblAllocationAdjustmentTilt Array of the Allocation Adjustment Tilts - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BlackLittermanOutput ( - final org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput frooAdjusted, - final double[] adblAllocationAdjustmentTilt) - throws java.lang.Exception - { - if (null == (_frooAdjusted = frooAdjusted) || null == (_adblAllocationAdjustmentTilt = - adblAllocationAdjustmentTilt) || 0 == _adblAllocationAdjustmentTilt.length) - throw new java.lang.Exception ("BlackLittermanOutput Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Adjusted Forward Equilibrium Optimization Metrics - * - * @return The Adjusted Forward Equilibrium Optimization Metrics - */ - - public org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput adjustedMetrics() - { - return _frooAdjusted; - } - - /** - * Retrieve the Array of the Black Litterman Allocation Adjustment Tilts - * - * @return The Array of the Black Litterman Allocation Adjustment Tilts - */ - - public double[] allocationAdjustmentTilt() - { - return _adblAllocationAdjustmentTilt; - } -} diff --git a/org/drip/portfolioconstruction/bayesian/MeucciViewUncertaintyParameterization.java b/org/drip/portfolioconstruction/bayesian/MeucciViewUncertaintyParameterization.java deleted file mode 100644 index 97af556..0000000 --- a/org/drip/portfolioconstruction/bayesian/MeucciViewUncertaintyParameterization.java +++ /dev/null @@ -1,102 +0,0 @@ - -package org.drip.portfolioconstruction.bayesian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * MeucciViewUncertaintyParameterization demonstrates the Meucci Parameterization for the View Projection - * Uncertainty Matrix. The Reference is: - * - * - Meucci, A. (2005): Risk and Asset Allocation, Springer Finance. - * - * @author Lakshmi Krishnamurthy - */ - -public class MeucciViewUncertaintyParameterization { - - /** - * Generate the Projection Co-variance from the Scoping Co-variance and the Meucci Alpha Parameter - * - * @param aadblScopingCovariance The Scoping Co-variance - * @param dblAlpha Meucci Alpha Parameter - * - * @return The Projection Co-variance Instance - */ - - public static final org.drip.measure.gaussian.Covariance ProjectionCovariance ( - final double[][] aadblScopingCovariance, - final double dblAlpha) - { - if (null == aadblScopingCovariance || !org.drip.quant.common.NumberUtil.IsValid (dblAlpha)) - return null; - - int iNumScopingEntity = aadblScopingCovariance.length; - double[][] aadblProjectionCovariance = 0 == iNumScopingEntity ? null : new - double[iNumScopingEntity][iNumScopingEntity]; - - if (0 == iNumScopingEntity) return null; - - for (int i = 0; i < iNumScopingEntity; ++i) { - if (null == aadblScopingCovariance[i] || iNumScopingEntity != aadblScopingCovariance[i].length) - return null; - - for (int j = 0; j < iNumScopingEntity; ++j) { - if (!org.drip.quant.common.NumberUtil.IsValid (aadblScopingCovariance[i][j])) return null; - - aadblProjectionCovariance[i][j] = dblAlpha * aadblScopingCovariance[i][j]; - } - } - - try { - return new org.drip.measure.gaussian.Covariance (aadblProjectionCovariance); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/portfolioconstruction/bayesian/PriorControlSpecification.java b/org/drip/portfolioconstruction/bayesian/PriorControlSpecification.java deleted file mode 100644 index c67f026..0000000 --- a/org/drip/portfolioconstruction/bayesian/PriorControlSpecification.java +++ /dev/null @@ -1,123 +0,0 @@ - -package org.drip.portfolioconstruction.bayesian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PriorControlSpecification contains the Black Litterman Prior Specification Settings. The References are: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * - Idzorek, T. (2005): A Step-by-Step Guide to the Black-Litterman Model: Incorporating User-Specified - * Confidence Levels, Ibbotson Associates, Chicago - * - * @author Lakshmi Krishnamurthy - */ - -public class PriorControlSpecification { - private double _dblTau = java.lang.Double.NaN; - private boolean _bAlternateReferenceModel = false; - private double _dblRiskFreeRate = java.lang.Double.NaN; - - /** - * PriorControlSpecification Constructor - * - * @param bAlternateReferenceModel TRUE - Use Alternate Reference in place of the Traditional Black - * Litterman Model - * @param dblRiskFreeRate The Risk Free Rate - * @param dblTau The Asset Space Excess Returns "Confidence" Parameter - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public PriorControlSpecification ( - final boolean bAlternateReferenceModel, - final double dblRiskFreeRate, - final double dblTau) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblRiskFreeRate = dblRiskFreeRate) || - !org.drip.quant.common.NumberUtil.IsValid (_dblTau = dblTau)) - throw new java.lang.Exception ("PriorControlSpecification Constructor => Invalid Inputs"); - - _bAlternateReferenceModel = bAlternateReferenceModel; - } - - /** - * Retrieve the Flag indicating if the Alternate Reference Model is to be used - * - * @return TRUE - Use Alternate Reference in place of the Traditional Black Litterman Model - */ - - public boolean useAlternateReferenceModel() - { - return _bAlternateReferenceModel; - } - - /** - * Retrieve the Risk Free Rate - * - * @return The Risk Free Rate - */ - - public double riskFreeRate() - { - return _dblRiskFreeRate; - } - - /** - * Retrieve Tau - * - * @return Tau - */ - - public double tau() - { - return _dblTau; - } -} diff --git a/org/drip/portfolioconstruction/bayesian/ProjectionExposure.java b/org/drip/portfolioconstruction/bayesian/ProjectionExposure.java deleted file mode 100644 index a2189fb..0000000 --- a/org/drip/portfolioconstruction/bayesian/ProjectionExposure.java +++ /dev/null @@ -1,166 +0,0 @@ - -package org.drip.portfolioconstruction.bayesian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ProjectionExposure holds the Projection Exposure Loadings that Weight the Exposure to the Projection Pick - * Portfolio. The Reference is: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * @author Lakshmi Krishnamurthy - */ - -public class ProjectionExposure { - private double[] _adblIntraViewComponent = null; - private double[] _adblInterViewComponent = null; - private double[] _adblPriorViewComponent = null; - private double[][] _aadblCompositeConfidenceCovariance = null; - - /** - * ProjectionExposure Constructor - * - * @param adblIntraViewComponent Array of Per-View View-Specific Exposure Component - * @param adblInterViewComponent Array of Per-View Exposure Contribution from other Views - * @param adblPriorViewComponent Array of View-Specific Per-View Components - * @param aadblCompositeConfidenceCovariance Composite Confidence Co-variance Matrix - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ProjectionExposure ( - final double[] adblIntraViewComponent, - final double[] adblInterViewComponent, - final double[] adblPriorViewComponent, - final double[][] aadblCompositeConfidenceCovariance) - throws java.lang.Exception - { - if (null == (_adblIntraViewComponent = adblIntraViewComponent) || null == (_adblInterViewComponent = - adblInterViewComponent) || null == (_adblPriorViewComponent = adblPriorViewComponent) || null == - (_aadblCompositeConfidenceCovariance = aadblCompositeConfidenceCovariance)) - throw new java.lang.Exception ("ProjectionExposure Constructor => Invalid Inputs"); - - int iNumView = _adblIntraViewComponent.length; - - if (0 == iNumView || iNumView != _adblInterViewComponent.length || iNumView != - _adblPriorViewComponent.length || iNumView != _aadblCompositeConfidenceCovariance.length) - throw new java.lang.Exception ("ProjectionExposure Constructor => Invalid Inputs"); - - for (int i = 0; i < iNumView; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (_adblIntraViewComponent[i]) || - !org.drip.quant.common.NumberUtil.IsValid (_adblInterViewComponent[i]) || - !org.drip.quant.common.NumberUtil.IsValid (_adblPriorViewComponent[i]) || null == - _aadblCompositeConfidenceCovariance[i] || iNumView != - _aadblCompositeConfidenceCovariance[i].length) - throw new java.lang.Exception ("ProjectionExposure Constructor => Invalid Inputs"); - } - } - - /** - * Retrieve the Single View Joint Contribution Component - * - * @return The Single View Joint Contribution Component - */ - - public double[] intraViewComponent() - { - return _adblIntraViewComponent; - } - - /** - * Retrieve the View/View Joint Contribution Component - * - * @return The View/View Joint Contribution Component - */ - - public double[] interViewComponent() - { - return _adblInterViewComponent; - } - - /** - * Retrieve the Prior/View Joint Contribution Component - * - * @return The Prior/View Joint Contribution Component - */ - - public double[] priorViewComponent() - { - return _adblPriorViewComponent; - } - - /** - * Retrieve the Composite Confidence Co-variance - * - * @return The Composite Confidence Co-variance - */ - - public double[][] compositeConfidenceCovariance() - { - return _aadblCompositeConfidenceCovariance; - } - - /** - * Compute the Array of Cumulative View Loading Components - * - * @return The Array of Cumulative View Loading Components - */ - - public double[] cumulativeViewComponent() - { - int iNumView = _adblIntraViewComponent.length; - double[] adblViewLoading = new double[iNumView]; - - for (int i = 0; i < iNumView; ++i) - adblViewLoading[i] = _adblIntraViewComponent[i] + _adblInterViewComponent[i] + - _adblPriorViewComponent[i]; - - return adblViewLoading; - } -} diff --git a/org/drip/portfolioconstruction/bayesian/ProjectionImpliedConfidenceOutput.java b/org/drip/portfolioconstruction/bayesian/ProjectionImpliedConfidenceOutput.java deleted file mode 100644 index 0d701cd..0000000 --- a/org/drip/portfolioconstruction/bayesian/ProjectionImpliedConfidenceOutput.java +++ /dev/null @@ -1,189 +0,0 @@ - -package org.drip.portfolioconstruction.bayesian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ProjectionImpliedConfidenceOutput holds the Results of the Idzorek 2005 Black Litterman Intuitive - * Projection Confidence Level Estimation Run. The References are: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * - Idzorek, T. (2005): A Step-by-Step Guide to the Black-Litterman Model: Incorporating User-Specified - * Confidence Levels, Ibbotson Associates, Chicago - * - * @author Lakshmi Krishnamurthy - */ - -public class ProjectionImpliedConfidenceOutput { - private double[] _adblUnadjustedWeight = null; - private org.drip.portfolioconstruction.bayesian.BlackLittermanOutput _bloFullConfidence = null; - private org.drip.portfolioconstruction.bayesian.BlackLittermanCustomConfidenceOutput _blcco = null; - - /** - * ProjectionImpliedConfidenceOutput Constructor - * - * @param adblUnadjustedWeight Array of the Unadjusted Weights - * @param blcco The Custom Confidence Black Litterman Run Output - * @param bloFullConfidence The Full Confidence Black Litterman Run Output - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ProjectionImpliedConfidenceOutput ( - final double[] adblUnadjustedWeight, - final org.drip.portfolioconstruction.bayesian.BlackLittermanCustomConfidenceOutput blcco, - final org.drip.portfolioconstruction.bayesian.BlackLittermanOutput bloFullConfidence) - throws java.lang.Exception - { - if (null == (_adblUnadjustedWeight = adblUnadjustedWeight) || 0 == _adblUnadjustedWeight.length || - null == (_blcco = blcco) || null == (_bloFullConfidence = bloFullConfidence)) - throw new java.lang.Exception - ("ProjectionImpliedConfidenceOutput Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Array of the Unadjusted Equilibrium Weights - * - * @return The Array of the Unadjusted Equilibrium Weights - */ - - public double[] unadjustedWeights() - { - return _adblUnadjustedWeight; - } - - /** - * Retrieve the Custom Projection Confidence Black Litterman Run Output - * - * @return The Custom Projection Confidence Black Litterman Run Output - */ - - public org.drip.portfolioconstruction.bayesian.BlackLittermanCustomConfidenceOutput - customConfidenceOutput() - { - return _blcco; - } - - /** - * Retrieve the Full Projection Confidence Black Litterman Run Output - * - * @return The Full Projection Confidence Black Litterman Run Output - */ - - public org.drip.portfolioconstruction.bayesian.BlackLittermanOutput fullConfidenceOutput() - { - return _bloFullConfidence; - } - - /** - * Retrieve the Custom Projection Induced Equilibrium Asset Deviation Array - * - * @return The Custom Projection Induced Equilibrium Asset Deviation Array - */ - - public double[] customProjectionConfidenceDeviation() - { - return _blcco.allocationAdjustmentTilt(); - } - - /** - * Retrieve the Custom Projection Induced Equilibrium Asset Weight Array - * - * @return The Custom Projection Induced Equilibrium Asset Weight Array - */ - - public double[] customProjectionConfidenceWeight() - { - return _blcco.adjustedMetrics().optimalPortfolio().weights(); - } - - /** - * Retrieve the Full Projection Induced Equilibrium Asset Deviation Array - * - * @return The Full Projection Induced Equilibrium Asset Deviation Array - */ - - public double[] fullProjectionConfidenceDeviation() - { - return _bloFullConfidence.allocationAdjustmentTilt(); - } - - /** - * Retrieve the Full Projection Induced Equilibrium Asset Weight Array - * - * @return The Full Projection Induced Equilibrium Asset Weight Array - */ - - public double[] fullProjectionConfidenceWeight() - { - return _bloFullConfidence.adjustedMetrics().optimalPortfolio().weights(); - } - - /** - * Compute the Array of the Custom Projection Induced Confidence Level - * - * @return The Array of the Custom Projection Induced Confidence Level - */ - - public double[] level() - { - int iNumAsset = _adblUnadjustedWeight.length; - double[] adblImpliedConfidenceLevel = new double[iNumAsset]; - - double[] adblCustomProjectionConfidenceDeviation = _blcco.allocationAdjustmentTilt(); - - double[] adblFullProjectionConfidenceDeviation = _bloFullConfidence.allocationAdjustmentTilt(); - - for (int i = 0; i < iNumAsset; ++i) - adblImpliedConfidenceLevel[i] = adblCustomProjectionConfidenceDeviation[i] / - adblFullProjectionConfidenceDeviation[i]; - - return adblImpliedConfidenceLevel; - } -} diff --git a/org/drip/portfolioconstruction/bayesian/ProjectionSpecification.java b/org/drip/portfolioconstruction/bayesian/ProjectionSpecification.java deleted file mode 100644 index f922114..0000000 --- a/org/drip/portfolioconstruction/bayesian/ProjectionSpecification.java +++ /dev/null @@ -1,115 +0,0 @@ - -package org.drip.portfolioconstruction.bayesian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ProjectionSpecification contains the Black Litterman Projection Specification Settings. The References - * are: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * - Idzorek, T. (2005): A Step-by-Step Guide to the Black-Litterman Model: Incorporating User-Specified - * Confidence Levels, Ibbotson Associates, Chicago - * - * @author Lakshmi Krishnamurthy - */ - -public class ProjectionSpecification { - private double[][] _aadblAssetSpaceLoading = null; - private org.drip.measure.gaussian.R1MultivariateNormal _r1mnExcessReturnsDistribution = null; - - /** - * ProjectionSpecification Constructor - * - * @param r1mnExcessReturnsDistribution The R^1 Projection Space Excess Returns Normal Distribution - * @param aadblAssetSpaceLoading Double Array of Asset To-From Projection Portfolio Pick Weights - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ProjectionSpecification ( - final org.drip.measure.gaussian.R1MultivariateNormal r1mnExcessReturnsDistribution, - final double[][] aadblAssetSpaceLoading) - throws java.lang.Exception - { - if (null == (_r1mnExcessReturnsDistribution = r1mnExcessReturnsDistribution) || null == - (_aadblAssetSpaceLoading = aadblAssetSpaceLoading)) - throw new java.lang.Exception ("ProjectionSpecification Constructor => Invalid Inputs"); - - int iNumProjection = _aadblAssetSpaceLoading.length; - - for (int i = 0; i < iNumProjection; ++i) { - if (null == _aadblAssetSpaceLoading[i] || !org.drip.quant.common.NumberUtil.IsValid - (_aadblAssetSpaceLoading[i])) - throw new java.lang.Exception ("ProjectionSpecification Constructor => Invalid Inputs"); - } - } - - /** - * Retrieve the R^1 Projection Space Excess Returns Normal Distribution - * - * @return The R^1 Projection Space Excess Returns Normal Distribution - */ - - public org.drip.measure.gaussian.R1MultivariateNormal excessReturnsDistribution() - { - return _r1mnExcessReturnsDistribution; - } - - /** - * Retrieve the Matrix of Asset To-From Projection Portfolio Pick Weights - * - * @return The Matrix of Asset To-From Projection Portfolio Pick Weights - */ - - public double[][] assetSpaceLoading() - { - return _aadblAssetSpaceLoading; - } -} diff --git a/org/drip/portfolioconstruction/mpt/AssetSecurityCharacteristicLine.java b/org/drip/portfolioconstruction/mpt/AssetSecurityCharacteristicLine.java deleted file mode 100644 index ed0577f..0000000 --- a/org/drip/portfolioconstruction/mpt/AssetSecurityCharacteristicLine.java +++ /dev/null @@ -1,123 +0,0 @@ - -package org.drip.portfolioconstruction.mpt; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AssetSecurityCharacteristicLine holds the Asset's Alpha and Beta from which the Asset's Excess Returns - * over the Risk-Free Rate are estimated. - * - * @author Lakshmi Krishnamurthy - */ - -public class AssetSecurityCharacteristicLine { - private double _dblBeta = java.lang.Double.NaN; - private double _dblAlpha = java.lang.Double.NaN; - - /** - * AssetSecurityCharacteristicLine Constructor - * - * @param dblAlpha The Asset's Alpha - * @param dblBeta The Asset's Beta - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public AssetSecurityCharacteristicLine ( - final double dblAlpha, - final double dblBeta) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblAlpha = dblAlpha) || - !org.drip.quant.common.NumberUtil.IsValid (_dblBeta = dblBeta)) - throw new java.lang.Exception ("AssetSecurityCharacteristicLine Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Asset's Alpha - * - * @return The Asset's Alpha - */ - - public double alpha() - { - return _dblAlpha; - } - - /** - * Retrieve the Asset's Beta - * - * @return The Asset's Beta - */ - - public double beta() - { - return _dblBeta; - } - - /** - * Retrieve the Excess Returns over the Market for the Asset - * - * @param dblMarketExcessReturns The Market Premium, i.e., the Excess Market Returns over the Risk Free - * Rate - * - * @return The Excess Returns over the Market for the Asset - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double excessReturns ( - final double dblMarketExcessReturns) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblMarketExcessReturns)) - throw new java.lang.Exception - ("AssetSecurityCharacteristicLine::excessReturns => Invalid Inputs"); - - return _dblAlpha + _dblBeta * dblMarketExcessReturns; - } -} diff --git a/org/drip/portfolioconstruction/mpt/CapitalAllocationLine.java b/org/drip/portfolioconstruction/mpt/CapitalAllocationLine.java deleted file mode 100644 index d677698..0000000 --- a/org/drip/portfolioconstruction/mpt/CapitalAllocationLine.java +++ /dev/null @@ -1,145 +0,0 @@ - -package org.drip.portfolioconstruction.mpt; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CapitalAllocationLine implements the Efficient Half-line created from the Combination of the Risk Free - * Asset and the Tangency Point of the CAPM Market Portfolio. - * - * @author Lakshmi Krishnamurthy - */ - -public class CapitalAllocationLine { - private double _dblRiskFreeRate = java.lang.Double.NaN; - private org.drip.portfolioconstruction.asset.PortfolioMetrics _pmTangency = null; - - /** - * CapitalAllocationLine Constructor - * - * @param dblRiskFreeRate The Risk Free Rate - * @param pmTangency The Tangency Portfolio Metrics - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CapitalAllocationLine ( - final double dblRiskFreeRate, - final org.drip.portfolioconstruction.asset.PortfolioMetrics pmTangency) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblRiskFreeRate = dblRiskFreeRate) || null == - (_pmTangency = pmTangency)) - throw new java.lang.Exception ("CapitalAllocationLine Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Risk-Free Rate - * - * @return The Risk-Free Rate - */ - - public double riskFreeRate() - { - return _dblRiskFreeRate; - } - - /** - * Retrieve the Tangency Portfolio Metrics - * - * @return The Tangency Portfolio Metrics - */ - - public org.drip.portfolioconstruction.asset.PortfolioMetrics tangencyPortfolioMetrics() - { - return _pmTangency; - } - - /** - * Calculate the Combination Portfolio's Expected Returns from the corresponding Standard Deviation - * - * @param dblCombinationPortfolioStandardDeviation The Combination Portfolio's Standard Deviation - * - * @return The Combination Portfolio's Expected Returns - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double combinationPortfolioExpectedReturn ( - final double dblCombinationPortfolioStandardDeviation) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCombinationPortfolioStandardDeviation)) - throw new java.lang.Exception - ("CapitalAllocationLine::combinationPortfolioExpectedReturn => Invalid Inputs"); - - return _dblRiskFreeRate + dblCombinationPortfolioStandardDeviation * (_pmTangency.excessReturnsMean() - - _dblRiskFreeRate) / _pmTangency.excessReturnsStandardDeviation(); - } - - /** - * Compute the Combination Portfolio's Standard Deviation - * - * @param dblCombinationPortfolioExpectedReturn The Expected Returns of the Combination Portfolio - * - * @return The Combination Portfolio's Standard Deviation - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double combinationPortfolioStandardDeviation ( - final double dblCombinationPortfolioExpectedReturn) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCombinationPortfolioExpectedReturn)) - throw new java.lang.Exception - ("CapitalAllocationLine::combinationPortfolioStandardDeviation => Invalid Inputs"); - - return (dblCombinationPortfolioExpectedReturn - _dblRiskFreeRate) / (_pmTangency.excessReturnsMean() - - _dblRiskFreeRate) * _pmTangency.excessReturnsStandardDeviation(); - } -} diff --git a/org/drip/portfolioconstruction/mpt/MarkovitzBullet.java b/org/drip/portfolioconstruction/mpt/MarkovitzBullet.java deleted file mode 100644 index 7f94ea6..0000000 --- a/org/drip/portfolioconstruction/mpt/MarkovitzBullet.java +++ /dev/null @@ -1,140 +0,0 @@ - -package org.drip.portfolioconstruction.mpt; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * MarkovitzBullet holds the Portfolio Performance Metrics across a Variety of Return Constraints. - * - * @author Lakshmi Krishnamurthy - */ - -public class MarkovitzBullet { - private org.drip.portfolioconstruction.allocator.OptimizationOutput _opGlobalMinimumVariance = null; - private org.drip.portfolioconstruction.allocator.OptimizationOutput _opLongOnlyMaximumReturns = null; - - private java.util.TreeMap - _mapOptimalPortfolio = new java.util.TreeMap(); - - /** - * MarkovitzBullet Constructor - * - * @param opGlobalMinimumVariance The Global Minimum Variance Optimal Portfolio - * @param opLongOnlyMaximumReturns The Long Only Maximum Returns Optimal Portfolio - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public MarkovitzBullet ( - final org.drip.portfolioconstruction.allocator.OptimizationOutput opGlobalMinimumVariance, - final org.drip.portfolioconstruction.allocator.OptimizationOutput opLongOnlyMaximumReturns) - throws java.lang.Exception - { - if (null == (_opGlobalMinimumVariance = opGlobalMinimumVariance) || null == - (_opLongOnlyMaximumReturns = opLongOnlyMaximumReturns)) - throw new java.lang.Exception ("MarkovitzBullet Constructor => Invalid inputs"); - - _mapOptimalPortfolio.put (_opGlobalMinimumVariance.optimalMetrics().excessReturnsMean(), - _opGlobalMinimumVariance); - - _mapOptimalPortfolio.put (_opLongOnlyMaximumReturns.optimalMetrics().excessReturnsMean(), - _opLongOnlyMaximumReturns); - } - - /** - * Retrieve the Global Minimum Variance Portfolio Metrics - * - * @return The Global Minimum Variance Portfolio Metrics - */ - - public org.drip.portfolioconstruction.allocator.OptimizationOutput globalMinimumVariance() - { - return _opGlobalMinimumVariance; - } - - /** - * Retrieve the Long Only Maximum Returns Portfolio Metrics - * - * @return The Long Only Maximum Returns Portfolio Metrics - */ - - public org.drip.portfolioconstruction.allocator.OptimizationOutput longOnlyMaximumReturns() - { - return _opLongOnlyMaximumReturns; - } - - /** - * Add a Returns Constrained Optimal Portfolio - * - * @param op The Returns Constrained Optimal Portfolio - * - * @return TRUE - The Returns Constrained Optimal Portfolio Successfully Added - */ - - public boolean addOptimalPortfolio ( - final org.drip.portfolioconstruction.allocator.OptimizationOutput op) - { - if (null == op) return false; - - _mapOptimalPortfolio.put (op.optimalMetrics().excessReturnsMean(), op); - - return true; - } - - /** - * Retrieve the Map of Optimal Portfolios - * - * @return The Map of Optimal Portfolios - */ - - public java.util.TreeMap - optimalPortfolios() - { - return _mapOptimalPortfolio; - } -} diff --git a/org/drip/portfolioconstruction/params/AssetStatisticalProperties.java b/org/drip/portfolioconstruction/params/AssetStatisticalProperties.java deleted file mode 100644 index 26f2202..0000000 --- a/org/drip/portfolioconstruction/params/AssetStatisticalProperties.java +++ /dev/null @@ -1,129 +0,0 @@ - -package org.drip.portfolioconstruction.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AssetStatisticalProperties holds the Statistical Properties of a given Asset. - * - * @author Lakshmi Krishnamurthy - */ - -public class AssetStatisticalProperties { - private java.lang.String _strID = ""; - private java.lang.String _strName = ""; - private double _dblVariance = java.lang.Double.NaN; - private double _dblExpectedReturn = java.lang.Double.NaN; - - /** - * AssetStatisticalProperties Constructor - * - * @param strName Name of the Asset - * @param strID ID of the Asset - * @param dblExpectedReturn Expected Return of the Asset - * @param dblVariance Variance of the Assert - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public AssetStatisticalProperties ( - final java.lang.String strName, - final java.lang.String strID, - final double dblExpectedReturn, - final double dblVariance) - throws java.lang.Exception - { - if (null == (_strName = strName) || _strName.isEmpty() || null == (_strID = strID) || - _strID.isEmpty() || !org.drip.quant.common.NumberUtil.IsValid (_dblExpectedReturn = - dblExpectedReturn) || !org.drip.quant.common.NumberUtil.IsValid (_dblVariance = dblVariance)) - throw new java.lang.Exception ("AssetStatisticalProperties Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Name of the Asset - * - * @return Name of the Asset - */ - - public java.lang.String name() - { - return _strName; - } - - /** - * Retrieve the ID of the Asset - * - * @return ID of the Asset - */ - - public java.lang.String id() - { - return _strID; - } - - /** - * Retrieve the Expected Returns of the Asset - * - * @return Expected Returns of the Asset - */ - - public double expectedReturn() - { - return _dblExpectedReturn; - } - - /** - * Retrieve the Variance of the Asset - * - * @return Variance of the Asset - */ - - public double variance() - { - return _dblVariance; - } -} diff --git a/org/drip/portfolioconstruction/params/AssetUniverseStatisticalProperties.java b/org/drip/portfolioconstruction/params/AssetUniverseStatisticalProperties.java deleted file mode 100644 index 0bafe6f..0000000 --- a/org/drip/portfolioconstruction/params/AssetUniverseStatisticalProperties.java +++ /dev/null @@ -1,294 +0,0 @@ - -package org.drip.portfolioconstruction.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AssetUniverseStatisticalProperties holds the Statistical Properties of a Pool of Assets. - * - * @author Lakshmi Krishnamurthy - */ - -public class AssetUniverseStatisticalProperties { - private double _dblRiskFreeRate = java.lang.Double.NaN; - - private - org.drip.analytics.support.CaseInsensitiveHashMap - _mapASP = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - private org.drip.analytics.support.CaseInsensitiveHashMap _mapCorrelation = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - /** - * Construct an Instance of AUSP from the corresponding MultivariateMetrics Instance - * - * @param mvm The MultivariateMetrics Instance - * - * @return The AUSP Instance - */ - - public static final AssetUniverseStatisticalProperties FromMultivariateMetrics ( - final org.drip.measure.statistics.MultivariateMoments mvm) - { - if (null == mvm) return null; - - java.util.Set setstrAsset = mvm.variateList(); - - if (null == setstrAsset|| 0 == setstrAsset.size()) return null; - - try { - AssetUniverseStatisticalProperties ausp = new AssetUniverseStatisticalProperties (0.); - - for (java.lang.String strAsset : setstrAsset) { - if (!ausp.setASP (new org.drip.portfolioconstruction.params.AssetStatisticalProperties - (strAsset, strAsset, mvm.mean (strAsset), mvm.variance (strAsset)))) - return null; - } - - for (java.lang.String strAsset1 : setstrAsset) { - for (java.lang.String strAsset2 : setstrAsset) { - if (!ausp.setCorrelation (strAsset1, strAsset2, mvm.correlation (strAsset1, strAsset2))) - return null; - } - } - - return ausp; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * AssetUniverseStatisticalProperties Constructor - * - * @param dblRiskFreeRate The Risk Free Rate - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public AssetUniverseStatisticalProperties ( - final double dblRiskFreeRate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblRiskFreeRate = dblRiskFreeRate)) - throw new java.lang.Exception - ("AssetUniverseStatisticalProperties Constructor => Invalid Inputs"); - } - - /** - * Set the ASP Instance - * - * @param asp ASP Instance - * - * @return TRUE - ASP Instance Successfully added - */ - - public boolean setASP ( - final org.drip.portfolioconstruction.params.AssetStatisticalProperties asp) - { - if (null == asp) return false; - - _mapASP.put (asp.id(), asp); - - return true; - } - - /** - * Set the Correlation Between the Specified Assets - * - * @param strID1 Asset #1 - * @param strID2 Asset #2 - * @param dblCorrelation Cross-asset Correlation - * - * @return Correlation Between the Specified Assets - */ - - public boolean setCorrelation ( - final java.lang.String strID1, - final java.lang.String strID2, - final double dblCorrelation) - { - if (null == strID1 || strID1.isEmpty() || null == strID2 || strID2.isEmpty() || - !org.drip.quant.common.NumberUtil.IsValid (dblCorrelation) || 1. < dblCorrelation || -1. > - dblCorrelation) - return false; - - _mapCorrelation.put (strID1 + "@#" + strID2, dblCorrelation); - - _mapCorrelation.put (strID2 + "@#" + strID1, dblCorrelation); - - return true; - } - - /** - * Retrieve the Risk Free Rate - * - * @return The Risk Free Rate - */ - - public double riskFreeRate() - { - return _dblRiskFreeRate; - } - - /** - * Retrieve the ASP Instance corresponding to the specified ID - * - * @param strID The ASP ID - * - * @return The ASP Instance - */ - - public org.drip.portfolioconstruction.params.AssetStatisticalProperties asp ( - final java.lang.String strID) - { - return null == strID || strID.isEmpty() || !_mapASP.containsKey (strID) ? null : _mapASP.get (strID); - } - - /** - * Retrieve the Correlation between the Specified Assets - * - * @param strID1 Asset #1 - * @param strID2 Asset #2 - * - * @return Correlation between the Specified Assets - * - * @throws java.lang.Exception Thtrown if the Inputs are Invalid - */ - - public double correlation ( - final java.lang.String strID1, - final java.lang.String strID2) - throws java.lang.Exception - { - if (null == strID1 || strID1.isEmpty() || null == strID2 || strID2.isEmpty()) - throw new java.lang.Exception ("AssetPoolStatisticalProperties::correlation => Invalid Inputs"); - - if (strID1.equalsIgnoreCase (strID2)) return 1.; - - java.lang.String strCorrelationSlot = strID1 + "@#" + strID2; - - return _mapCorrelation.containsKey (strCorrelationSlot) ? _mapCorrelation.get (strCorrelationSlot) : - null; - } - - /** - * Retrieve the Asset Expected Returns Array - * - * @param astrAssetID Array of Asset IDs - * - * @return The Asset Covariance Matrix - */ - - public double[] expectedReturns ( - final java.lang.String[] astrAssetID) - { - if (null == astrAssetID) return null; - - int iNumAsset = astrAssetID.length; - double[] adblExpectedReturns = new double[iNumAsset]; - - if (0 == iNumAsset) return null; - - for (int i = 0; i < iNumAsset; ++i) { - org.drip.portfolioconstruction.params.AssetStatisticalProperties asp = asp (astrAssetID[i]); - - if (null == asp) return null; - - adblExpectedReturns[i] = asp.expectedReturn(); - } - - return adblExpectedReturns; - } - - /** - * Retrieve the Asset Covariance Matrix - * - * @param astrID Array of Asset ID - * - * @return The Asset Covariance Matrix - */ - - public double[][] covariance ( - final java.lang.String[] astrID) - { - if (null == astrID) return null; - - int iNumAsset = astrID.length; - double[][] aadblCovariance = new double[iNumAsset][iNumAsset]; - - if (0 == iNumAsset) return null; - - for (int i = 0; i < iNumAsset; ++i) { - org.drip.portfolioconstruction.params.AssetStatisticalProperties asp1 = asp (astrID[i]); - - if (null == asp1) return null; - - double dblVarianceI = asp1.variance(); - - for (int j = 0; j < iNumAsset; ++j) { - org.drip.portfolioconstruction.params.AssetStatisticalProperties asp2 = asp (astrID[j]); - - if (null == asp2) return null; - - try { - aadblCovariance[i][j] = java.lang.Math.sqrt (dblVarianceI * asp2.variance()) * - correlation (astrID[i], astrID[j]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - } - - return aadblCovariance; - } -} diff --git a/org/drip/pricer/option/BlackNormalAlgorithm.java b/org/drip/pricer/option/BlackNormalAlgorithm.java deleted file mode 100644 index 6613049..0000000 --- a/org/drip/pricer/option/BlackNormalAlgorithm.java +++ /dev/null @@ -1,193 +0,0 @@ - -package org.drip.pricer.option; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * BlackNormalAlgorithm implements the Black Normal European Call and Put Options Pricer. - * - * @author Lakshmi Krishnamurthy - */ - -public class BlackNormalAlgorithm extends org.drip.pricer.option.FokkerPlanckGenerator { - - /** - * Empty BlackNormalAlgorithm Constructor - nothing to be filled in with - */ - - public BlackNormalAlgorithm() - { - } - - @Override public double payoff ( - final double dblStrike, - final double dblTimeToExpiry, - final double dblRiskFreeRate, - final double dblUnderlier, - final boolean bIsPut, - final boolean bIsForward, - final double dblVolatility, - final boolean bAsPrice) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblStrike) || - !org.drip.quant.common.NumberUtil.IsValid (dblUnderlier) || - !org.drip.quant.common.NumberUtil.IsValid (dblVolatility) || - !org.drip.quant.common.NumberUtil.IsValid (dblTimeToExpiry) || - !org.drip.quant.common.NumberUtil.IsValid (dblRiskFreeRate)) - throw new java.lang.Exception ("BlackNormalAlgorithm::payoff => Invalid Inputs"); - - double dblD1D2Diff = dblVolatility * java.lang.Math.sqrt (dblTimeToExpiry); - - double dblDF = java.lang.Math.exp (-1. * dblRiskFreeRate * dblTimeToExpiry); - - double dblForward = bIsForward ? dblUnderlier : dblUnderlier / dblDF; - double dblD = (dblForward - dblStrike) / dblD1D2Diff; - - double dblCallPayoff = dblForward * dblD1D2Diff * java.lang.Math.exp (-0.5 * dblD * dblD) / - java.lang.Math.sqrt (2. * java.lang.Math.PI) / dblForward - dblStrike * -1. * dblD1D2Diff * dblD - * org.drip.measure.gaussian.NormalQuadrature.CDF (dblD) / dblStrike; - - if (!bAsPrice) return bIsPut ? dblCallPayoff + dblStrike - dblForward : dblCallPayoff; - - return bIsPut ? dblDF * (dblCallPayoff + dblStrike - dblForward) : dblDF * dblCallPayoff; - } - - @Override public org.drip.pricer.option.Greeks greeks ( - final double dblStrike, - final double dblTimeToExpiry, - final double dblRiskFreeRate, - final double dblUnderlier, - final boolean bIsPut, - final boolean bIsForward, - final double dblVolatility) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblStrike) || - !org.drip.quant.common.NumberUtil.IsValid (dblUnderlier) || - !org.drip.quant.common.NumberUtil.IsValid (dblVolatility) || - !org.drip.quant.common.NumberUtil.IsValid (dblTimeToExpiry) || - !org.drip.quant.common.NumberUtil.IsValid (dblRiskFreeRate)) - return null; - - double dblD1D2Diff = dblVolatility * java.lang.Math.sqrt (dblTimeToExpiry); - - double dblDF = java.lang.Math.exp (-1. * dblRiskFreeRate * dblTimeToExpiry); - - double dblForward = bIsForward ? dblUnderlier : dblUnderlier / dblDF; - double dblD = (dblForward - dblStrike) / dblD1D2Diff; - - double dblN = java.lang.Math.exp (-0.5 * dblD * dblD) / java.lang.Math.sqrt (2. * java.lang.Math.PI); - - double dblCallProb1 = dblD1D2Diff * dblN / dblForward; - - try { - double dblCallProb2 = -1. * dblD1D2Diff * dblD * org.drip.measure.gaussian.NormalQuadrature.CDF (dblD) - / dblStrike; - - double dblExpectedCallPayoff = dblForward * dblCallProb1 - dblStrike * dblCallProb2; - double dblATMCallPayoff = dblForward * (dblCallProb1 - dblCallProb2); - double dblCallPrice = dblDF * dblExpectedCallPayoff; - - if (!bIsPut) - return new org.drip.pricer.option.Greeks ( - dblDF, - dblVolatility, - dblExpectedCallPayoff, - dblATMCallPayoff, - dblCallPrice, - dblCallProb1, - dblCallProb2, - dblCallProb1, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN - ); - - double dblPutProb1 = dblD * dblD1D2Diff * org.drip.measure.gaussian.NormalQuadrature.CDF (-1. * dblD) / - dblForward; - - double dblPutProb2 = dblD1D2Diff * dblN / dblStrike; - - return new org.drip.pricer.option.PutGreeks ( - dblDF, - dblVolatility, - dblExpectedCallPayoff + dblStrike - dblForward, - dblATMCallPayoff, - dblDF * (-1. * dblForward * dblPutProb1 + dblStrike * dblPutProb2), - dblCallPrice + dblDF * (dblStrike - dblForward), - dblPutProb1, - dblPutProb2, - -1. * dblPutProb1, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN - ); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/pricer/option/BlackScholesAlgorithm.java b/org/drip/pricer/option/BlackScholesAlgorithm.java deleted file mode 100644 index ee8789e..0000000 --- a/org/drip/pricer/option/BlackScholesAlgorithm.java +++ /dev/null @@ -1,251 +0,0 @@ - -package org.drip.pricer.option; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * BlackScholesAlgorithm implements the Black Scholes based European Call and Put Options Pricer. - * - * @author Lakshmi Krishnamurthy - */ - -public class BlackScholesAlgorithm extends org.drip.pricer.option.FokkerPlanckGenerator { - - /** - * Empty BlackScholesAlgorithm Constructor - nothing to be filled in with - */ - - public BlackScholesAlgorithm() - { - } - - @Override public double payoff ( - final double dblStrike, - final double dblTimeToExpiry, - final double dblRiskFreeRate, - final double dblUnderlier, - final boolean bIsPut, - final boolean bIsForward, - final double dblVolatility, - final boolean bAsPrice) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblStrike) || - !org.drip.quant.common.NumberUtil.IsValid (dblUnderlier) || - !org.drip.quant.common.NumberUtil.IsValid (dblVolatility) || - !org.drip.quant.common.NumberUtil.IsValid (dblTimeToExpiry) || - !org.drip.quant.common.NumberUtil.IsValid (dblRiskFreeRate)) - throw new java.lang.Exception ("BlackScholesAlgorithm::payoff => Invalid Inputs"); - - double dblD1D2Diff = dblVolatility * java.lang.Math.sqrt (dblTimeToExpiry); - - double dblDF = java.lang.Math.exp (-1. * dblRiskFreeRate * dblTimeToExpiry); - - double dblD1 = java.lang.Double.NaN; - double dblD2 = java.lang.Double.NaN; - double dblForward = bIsForward ? dblUnderlier : dblUnderlier / dblDF; - - if (0. != dblVolatility) { - dblD1 = (java.lang.Math.log (dblForward / dblStrike) + dblTimeToExpiry * (dblRiskFreeRate + (0.5 - * dblVolatility * dblVolatility))) / dblD1D2Diff; - - dblD2 = dblD1 - dblD1D2Diff; - } else { - dblD1 = dblForward > dblStrike ? java.lang.Double.POSITIVE_INFINITY : - java.lang.Double.NEGATIVE_INFINITY; - dblD2 = dblD1; - } - - double dblCallPayoff = dblForward * org.drip.measure.gaussian.NormalQuadrature.CDF (dblD1) - dblStrike * - org.drip.measure.gaussian.NormalQuadrature.CDF (dblD2); - - if (!bAsPrice) return bIsPut ? dblCallPayoff + dblStrike - dblForward : dblCallPayoff; - - return bIsPut ? dblDF * (dblCallPayoff + dblStrike - dblForward) : dblDF * dblCallPayoff; - } - - @Override public org.drip.pricer.option.Greeks greeks ( - final double dblStrike, - final double dblTimeToExpiry, - final double dblRiskFreeRate, - final double dblUnderlier, - final boolean bIsPut, - final boolean bIsForward, - final double dblVolatility) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblStrike) || - !org.drip.quant.common.NumberUtil.IsValid (dblUnderlier) || - !org.drip.quant.common.NumberUtil.IsValid (dblVolatility) || - !org.drip.quant.common.NumberUtil.IsValid (dblTimeToExpiry) || - !org.drip.quant.common.NumberUtil.IsValid (dblRiskFreeRate)) - return null; - - double dblTimeRoot = java.lang.Math.sqrt (dblTimeToExpiry); - - double dblDF = java.lang.Math.exp (-1. * dblRiskFreeRate * dblTimeToExpiry); - - double dblVega = java.lang.Double.NaN; - double dblVeta = java.lang.Double.NaN; - double dblCharm = java.lang.Double.NaN; - double dblColor = java.lang.Double.NaN; - double dblGamma = java.lang.Double.NaN; - double dblSpeed = java.lang.Double.NaN; - double dblVanna = java.lang.Double.NaN; - double dblVomma = java.lang.Double.NaN; - double dblUltima = java.lang.Double.NaN; - double dblCallProb1 = java.lang.Double.NaN; - double dblCallProb2 = java.lang.Double.NaN; - double dblTimeDecay = java.lang.Double.NaN; - double dblATMCallProb1 = java.lang.Double.NaN; - double dblATMCallProb2 = java.lang.Double.NaN; - double dblD1D2Diff = dblVolatility * dblTimeRoot; - double dblForward = bIsForward ? dblUnderlier : dblUnderlier / dblDF; - - double dblATMD1 = dblTimeToExpiry * (dblRiskFreeRate + (0.5 * dblVolatility * dblVolatility)) / - dblD1D2Diff; - double dblATMD2 = dblATMD1 - dblD1D2Diff; - - double dblD1 = dblATMD1 + (java.lang.Math.log (dblForward / dblStrike)) / dblD1D2Diff; - - double dblD2 = dblD1 - dblD1D2Diff; - double dblD1D2 = dblD1 * dblD2; - - try { - dblCallProb1 = org.drip.measure.gaussian.NormalQuadrature.CDF (dblD1); - - dblCallProb2 = org.drip.measure.gaussian.NormalQuadrature.CDF (dblD2); - - dblATMCallProb1 = org.drip.measure.gaussian.NormalQuadrature.CDF (dblATMD1); - - dblATMCallProb2 = org.drip.measure.gaussian.NormalQuadrature.CDF (dblATMD2); - - double dblD1Density = org.drip.measure.gaussian.NormalQuadrature.Density (dblD1); - - dblVega = dblForward * dblD1Density * dblTimeRoot; - dblVomma = dblVega * dblD1 * dblD2 / dblVolatility; - dblGamma = dblD1Density / (dblForward * dblD1D2Diff); - dblUltima = -1. * dblVega * (dblD1D2 * (1. - dblD1D2) + dblD1 * dblD1 + dblD2 * dblD2) / - (dblVolatility * dblVolatility); - dblSpeed = -1. * dblGamma / dblForward * (1. + (dblD1 / dblD1D2Diff)); - dblTimeDecay = -0.5 * dblForward * dblD1Density * dblVolatility / dblTimeRoot; - dblVanna = dblVega / dblForward * (1. - (dblD1 / dblD1D2Diff)); - dblCharm = dblD1Density * (2. * dblRiskFreeRate * dblTimeToExpiry - dblD2 * dblD1D2Diff) / (2. * - dblVolatility * dblD1D2Diff); - dblVeta = dblForward * dblD1Density * dblTimeRoot * ((dblRiskFreeRate * dblD1 / (dblD1D2Diff)) - - ((1. + dblD1D2) / (2. * dblTimeToExpiry))); - dblColor = -0.5 * dblD1Density / (dblForward * dblTimeToExpiry * dblD1D2Diff) * (1. + dblD1 * - (2. * dblRiskFreeRate * dblTimeToExpiry - dblD2 * dblD1D2Diff) / dblD1D2Diff); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - double dblExpectedCallPayoff = dblForward * dblCallProb1 - dblStrike * dblCallProb2; - double dblExpectedATMCallPayoff = dblStrike * (dblATMCallProb1 - dblATMCallProb2); - double dblCallRho = dblStrike * dblTimeToExpiry * dblCallProb2; - double dblCallPrice = dblDF * dblExpectedCallPayoff; - - try { - if (!bIsPut) - return new org.drip.pricer.option.Greeks ( - dblDF, - dblVolatility, - dblExpectedCallPayoff, - dblExpectedATMCallPayoff, - dblCallPrice, - dblCallProb1, - dblCallProb2, - dblCallProb1, - dblVega, - dblTimeDecay - dblRiskFreeRate * dblStrike * dblCallProb2, - dblCallRho, - dblGamma, - dblVanna, - dblVomma, - dblCharm, - dblVeta, - dblColor, - dblSpeed, - dblUltima - ); - - double dblPutProb1 = org.drip.measure.gaussian.NormalQuadrature.CDF (-1. * dblD1); - - double dblPutProb2 = org.drip.measure.gaussian.NormalQuadrature.CDF (-1. * dblD2); - - return new org.drip.pricer.option.PutGreeks ( - dblDF, - dblVolatility, - dblExpectedCallPayoff + dblStrike - dblForward, - dblExpectedATMCallPayoff, - dblDF * (dblStrike * dblPutProb2 - dblForward * dblPutProb1), - dblCallPrice + dblDF * (dblStrike - dblForward), - dblPutProb1, - dblPutProb2, - -1. * dblPutProb1, - dblVega, - dblTimeDecay + dblRiskFreeRate * dblStrike * dblPutProb2, - -1. * dblStrike * dblTimeToExpiry * dblPutProb2, - dblGamma, - dblVanna, - dblVomma, - dblCharm, - dblVeta, - dblColor, - dblSpeed, - dblUltima - ); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/pricer/option/FokkerPlanckGenerator.java b/org/drip/pricer/option/FokkerPlanckGenerator.java deleted file mode 100644 index e2b270d..0000000 --- a/org/drip/pricer/option/FokkerPlanckGenerator.java +++ /dev/null @@ -1,428 +0,0 @@ - -package org.drip.pricer.option; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FokkerPlanckGenerator holds the base functionality that the performs the PDF evolution oriented Option - * Pricing. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class FokkerPlanckGenerator implements org.drip.param.pricer.GenericPricer { - - /** - * Compute the Expected Payoff of the Option from the Inputs - * - * @param dblStrike Option Strike - * @param dblTimeToExpiry Option Time To Expiry - * @param dblRiskFreeRate Option Risk Free Rate - * @param dblUnderlier Option Underlier Value - * @param bIsPut TRUE - The Option is a Put - * @param bIsForward TRUE - The Underlier represents the Forward, FALSE - it represents Spot - * @param dblInitialVolatility Option Initial Volatility Value - * @param bAsPrice TRUE - Return the Discounted Payoff - * - * @return The Expected Option Payoff - * - * @throws java.lang.Exception Thrown if the Expected Payoff cannot be calculated - */ - - public abstract double payoff ( - final double dblStrike, - final double dblTimeToExpiry, - final double dblRiskFreeRate, - final double dblUnderlier, - final boolean bIsPut, - final boolean bIsForward, - final double dblInitialVolatility, - final boolean bAsPrice) - throws java.lang.Exception; - - /** - * Carry out a Sensitivity Run and generate the Pricing related measure set - * - * @param dblStrike Option Strike - * @param dblTimeToExpiry Option Time To Expiry - * @param dblRiskFreeRate Option Risk Free Rate - * @param dblUnderlier Option Underlier Value - * @param bIsPut TRUE - The Option is a Put - * @param bIsForward TRUE - The Underlier represents the Forward, FALSE - it represents Spot - * @param dblInitialVolatility Option Initial Volatility Value - * - * @return The Greeks Sensitivities Output - */ - - public abstract org.drip.pricer.option.Greeks greeks ( - final double dblStrike, - final double dblTimeToExpiry, - final double dblRiskFreeRate, - final double dblUnderlier, - final boolean bIsPut, - final boolean bIsForward, - final double dblInitialVolatility); - - /** - * Compute the Expected Payoff of the Option from the Inputs - * - * @param iSpotDate Spot Date - * @param iExpiryDate Expiry Date - * @param dblStrike Option Strike - * @param dcFunding The Funding Curve - * @param dblUnderlier Option Underlier Value - * @param bIsPut TRUE - The Option is a Put - * @param bIsForward TRUE - The Underlier represents the Forward, FALSE - it represents Spot - * @param dblInitialVolatility Option Initial Volatility Value - * @param bAsPrice TRUE - Return the Discounted Payoff - * - * @return The Expected Option Payoff - * - * @throws java.lang.Exception Thrown if the Expected Payoff cannot be calculated - */ - - public double payoff ( - final int iSpotDate, - final int iExpiryDate, - final double dblStrike, - final org.drip.state.discount.MergedDiscountForwardCurve dcFunding, - final double dblUnderlier, - final boolean bIsPut, - final boolean bIsForward, - final double dblInitialVolatility, - final boolean bAsPrice) - throws java.lang.Exception - { - if (iExpiryDate <= iSpotDate || !org.drip.quant.common.NumberUtil.IsValid (dblStrike) || null == - dcFunding || !org.drip.quant.common.NumberUtil.IsValid (dblInitialVolatility)) - throw new java.lang.Exception ("FokkerPlanckGenerator::payoff => Invalid Inputs"); - - return payoff (dblStrike, 1. * (iExpiryDate - iSpotDate) / 365.25, dcFunding.libor (iSpotDate, - iExpiryDate), dblUnderlier, bIsPut, bIsForward, dblInitialVolatility, bAsPrice); - } - - /** - * Compute the Expected Payoff of the Option from the Inputs - * - * @param iSpotDate Spot Date - * @param iExpiryDate Expiry Date - * @param dblStrike Option Strike - * @param dcFunding The Funding Curve - * @param dblUnderlier Option Underlier Value - * @param bIsPut TRUE - The Option is a Put - * @param bIsForward TRUE - The Underlier represents the Forward, FALSE - it represents Spot - * @param funcVolatilityR1ToR1 The R^1 To R^1 Volatility Term Structure - * @param bAsPrice TRUE - Return the Discounted Payoff - * - * @return The Expected Option Payoff - * - * @throws java.lang.Exception Thrown if the Expected Payoff cannot be calculated - */ - - public double payoff ( - final int iSpotDate, - final int iExpiryDate, - final double dblStrike, - final org.drip.state.discount.MergedDiscountForwardCurve dcFunding, - final double dblUnderlier, - final boolean bIsPut, - final boolean bIsForward, - final org.drip.function.definition.R1ToR1 funcVolatilityR1ToR1, - final boolean bAsPrice) - throws java.lang.Exception - { - if (iExpiryDate <= iSpotDate || !org.drip.quant.common.NumberUtil.IsValid (dblStrike) || null == - dcFunding || null == funcVolatilityR1ToR1) - throw new java.lang.Exception ("FokkerPlanckGenerator::payoff => Invalid Inputs"); - - int iDaysToExpiry = iExpiryDate - iSpotDate; - - double dblRiskFreeRate = dcFunding.libor (iSpotDate, iExpiryDate); - - org.drip.function.definition.R1ToR1 funcVarianceR1ToR1 = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - return funcVolatilityR1ToR1.evaluate (dblX) * funcVolatilityR1ToR1.evaluate (dblX); - } - }; - - double dblEffectiveVolatility = java.lang.Math.sqrt (funcVarianceR1ToR1.integrate (iSpotDate, - iExpiryDate) / iDaysToExpiry); - - return payoff (dblStrike, 1. * iDaysToExpiry / 365.25, dblRiskFreeRate, dblUnderlier, bIsPut, - bIsForward, dblEffectiveVolatility, bAsPrice); - } - - /** - * Carry out a Sensitivity Run and generate the Pricing related measure set - * - * @param iSpotDate Spot Date - * @param iExpiryDate Expiry Date - * @param dblStrike Option Strike - * @param dcFunding The Funding Curve - * @param dblUnderlier Option Underlier Value - * @param bIsPut TRUE - The Option is a Put - * @param bIsForward TRUE - The Underlier represents the Forward, FALSE - it represents Spot - * @param dblIntegratedSurfaceVariance The Integrated Surface Variance - * - * @return The Greeks Output generated from the Sensitivities Run - */ - - public org.drip.pricer.option.Greeks greeks ( - final int iSpotDate, - final int iExpiryDate, - final double dblStrike, - final org.drip.state.discount.MergedDiscountForwardCurve dcFunding, - final double dblUnderlier, - final boolean bIsPut, - final boolean bIsForward, - final double dblIntegratedSurfaceVariance) - { - if (iExpiryDate <= iSpotDate || !org.drip.quant.common.NumberUtil.IsValid (dblStrike) || null == - dcFunding || !org.drip.quant.common.NumberUtil.IsValid (dblIntegratedSurfaceVariance)) - return null; - - double dblTimeToExpiry = 1. * (iExpiryDate - iSpotDate) / 365.25; - - try { - return greeks (dblStrike, dblTimeToExpiry, dcFunding.libor (iSpotDate, iExpiryDate), - dblUnderlier, bIsPut, bIsForward, java.lang.Math.sqrt (dblIntegratedSurfaceVariance / - dblTimeToExpiry)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Carry out a Sensitivity Run and generate the Pricing related measure set - * - * @param iSpotDate Spot Date - * @param iExpiryDate Expiry Date - * @param dblStrike Option Strike - * @param dcFunding The Funding Curve - * @param dblUnderlier Option Underlier Value - * @param bIsPut TRUE - The Option is a Put - * @param bIsForward TRUE - The Underlier represents the Forward, FALSE - it represents Spot - * @param funcVolatilityR1ToR1 The R^1 To R^1 Volatility Term Structure - * - * @return The Greeks Output generated from the Sensitivities Run - */ - - public org.drip.pricer.option.Greeks greeks ( - final int iSpotDate, - final int iExpiryDate, - final double dblStrike, - final org.drip.state.discount.MergedDiscountForwardCurve dcFunding, - final double dblUnderlier, - final boolean bIsPut, - final boolean bIsForward, - final org.drip.function.definition.R1ToR1 funcVolatilityR1ToR1) - { - if (iExpiryDate <= iSpotDate || !org.drip.quant.common.NumberUtil.IsValid (dblStrike) || null == - dcFunding || null == funcVolatilityR1ToR1) - return null; - - double dblRiskFreeRate = java.lang.Double.NaN; - double dblEffectiveVolatility = java.lang.Double.NaN; - double dblTimeToExpiry = 1. * (iExpiryDate - iSpotDate) / 365.25; - - org.drip.function.definition.R1ToR1 funcVarianceR1ToR1 = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - return funcVolatilityR1ToR1.evaluate (dblX) * funcVolatilityR1ToR1.evaluate (dblX); - } - }; - - try { - dblRiskFreeRate = dcFunding.libor (iSpotDate, iExpiryDate); - - dblEffectiveVolatility = java.lang.Math.sqrt (funcVarianceR1ToR1.integrate (iSpotDate, - iExpiryDate) / (365.25 * dblTimeToExpiry)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return greeks (dblStrike, dblTimeToExpiry, dblRiskFreeRate, dblUnderlier, bIsPut, bIsForward, - dblEffectiveVolatility); - } - - /** - * Imply the Effective Volatility From the Option Price - * - * @param dblStrike Strike - * @param dblTimeToExpiry Time To Expiry - * @param dblRiskFreeRate Risk Free Rate - * @param dblUnderlier The Underlier - * @param bIsPut TRUE - The Option is a Put - * @param bIsForward TRUE - The Underlier represents the Forward, FALSE - it represents Spot - * @param dblPrice The Price - * - * @return The Implied Effective Volatility - * - * @throws java.lang.Exception Thrown if the Effective Volatility cannot be implied - */ - - public double impliedVolatilityFromPrice ( - final double dblStrike, - final double dblTimeToExpiry, - final double dblRiskFreeRate, - final double dblUnderlier, - final boolean bIsPut, - final boolean bIsForward, - final double dblPrice) - throws java.lang.Exception - { - org.drip.function.definition.R1ToR1 au = new org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblSpotVolatility) - throws java.lang.Exception - { - return payoff (dblStrike, dblTimeToExpiry, dblRiskFreeRate, dblUnderlier, bIsPut, bIsForward, - dblSpotVolatility, true) - dblPrice; - } - }; - - org.drip.function.r1tor1solver.FixedPointFinderOutput fpop = new - org.drip.function.r1tor1solver.FixedPointFinderBrent (0., au, true).findRoot(); - - if (null == fpop || !fpop.containsRoot()) - throw new java.lang.Exception - ("FokkerPlanckGenerator::impliedVolatilityFromPrice => Cannot imply Volatility"); - - return java.lang.Math.abs (fpop.getRoot()); - } - - /** - * Imply the Effective Volatility From the Option Price - * - * @param iSpotDate Spot Date - * @param iExpiryDate Expiry Date - * @param dblStrike Option Strike - * @param dcFunding The Funding Curve - * @param dblUnderlier Option Underlier Value - * @param bIsPut TRUE - The Option is a Put - * @param bIsForward TRUE - The Underlier represents the Forward, FALSE - it represents Spot - * @param dblPrice The Price - * - * @return The Implied Effective Volatility - * - * @throws java.lang.Exception Thrown if the Effective Volatility cannot be implied - */ - - public double impliedVolatilityFromPrice ( - final int iSpotDate, - final int iExpiryDate, - final double dblStrike, - final org.drip.state.discount.MergedDiscountForwardCurve dcFunding, - final double dblUnderlier, - final boolean bIsPut, - final boolean bIsForward, - final double dblPrice) - throws java.lang.Exception - { - org.drip.function.definition.R1ToR1 au = new org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblInitialVolatility) - throws java.lang.Exception - { - return payoff (iSpotDate, iExpiryDate, dblStrike, dcFunding, dblUnderlier, bIsPut, - bIsForward, dblInitialVolatility, true) - dblPrice; - } - }; - - org.drip.function.r1tor1solver.FixedPointFinderOutput fpop = new - org.drip.function.r1tor1solver.FixedPointFinderBrent (0., au, true).findRoot(); - - if (null == fpop || !fpop.containsRoot()) - throw new java.lang.Exception - ("FokkerPlanckGenerator::impliedVolatilityFromPrice => Cannot imply Volatility"); - - return java.lang.Math.abs (fpop.getRoot()); - } - - /** - * Imply the Effective Black-Scholes Volatility From the Option Price - * - * @param dblStrike Strike - * @param dblTimeToExpiry Time To Expiry - * @param dblRiskFreeRate Risk Free Rate - * @param dblUnderlier The Underlier - * @param bIsPut TRUE - The Option is a Put - * @param bIsForward TRUE - The Underlier represents the Forward, FALSE - it represents Spot - * @param dblPrice The Price - * - * @return The Implied Black Scholes Effective Volatility - * - * @throws java.lang.Exception Thrown if the Black Scholes Effective Volatility cannot be implied - */ - - public double impliedBlackScholesVolatility ( - final double dblStrike, - final double dblTimeToExpiry, - final double dblRiskFreeRate, - final double dblUnderlier, - final boolean bIsPut, - final boolean bIsForward, - final double dblPrice) - throws java.lang.Exception - { - return new org.drip.pricer.option.BlackScholesAlgorithm().impliedVolatilityFromPrice (dblStrike, - dblTimeToExpiry, dblRiskFreeRate, dblUnderlier, bIsPut, bIsForward, dblPrice); - } -} diff --git a/org/drip/pricer/option/Greeks.java b/org/drip/pricer/option/Greeks.java deleted file mode 100644 index e132a23..0000000 --- a/org/drip/pricer/option/Greeks.java +++ /dev/null @@ -1,357 +0,0 @@ - -package org.drip.pricer.option; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * Greeks contains the Sensitivities/Pricing Measures common across both Call and Put Option Pricing Runs. - * - * @author Lakshmi Krishnamurthy - */ - -public class Greeks { - private double _dblDF = java.lang.Double.NaN; - private double _dblRho = java.lang.Double.NaN; - private double _dblVega = java.lang.Double.NaN; - private double _dblVeta = java.lang.Double.NaN; - private double _dblCharm = java.lang.Double.NaN; - private double _dblColor = java.lang.Double.NaN; - private double _dblDelta = java.lang.Double.NaN; - private double _dblGamma = java.lang.Double.NaN; - private double _dblPrice = java.lang.Double.NaN; - private double _dblProb1 = java.lang.Double.NaN; - private double _dblProb2 = java.lang.Double.NaN; - private double _dblSpeed = java.lang.Double.NaN; - private double _dblTheta = java.lang.Double.NaN; - private double _dblVanna = java.lang.Double.NaN; - private double _dblVomma = java.lang.Double.NaN; - private double _dblUltima = java.lang.Double.NaN; - private double _dblExpectedPayoff = java.lang.Double.NaN; - private double _dblExpectedATMPayoff = java.lang.Double.NaN; - private double _dblEffectiveVolatility = java.lang.Double.NaN; - - /** - * The Greeks Constructor - * - * @param dblDF The Payoff Discount Factor - * @param dblEffectiveVolatility Effective Volatility - * @param dblExpectedPayoff Expected Forward Payoff - * @param dblExpectedATMPayoff Expected ATM Forward Payoff - * @param dblPrice Price - * @param dblProb1 Probability Term #1 - * @param dblProb2 Probability Term #2 - * @param dblDelta Delta - * @param dblVega Vega - * @param dblTheta Theta - * @param dblRho Rho - * @param dblGamma Gamma - * @param dblVanna Vanna - * @param dblVomma Vomma - * @param dblCharm Charm - * @param dblVeta Veta - * @param dblColor Color - * @param dblSpeed Speed - * @param dblUltima Ultima - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public Greeks ( - final double dblDF, - final double dblEffectiveVolatility, - final double dblExpectedPayoff, - final double dblExpectedATMPayoff, - final double dblPrice, - final double dblProb1, - final double dblProb2, - final double dblDelta, - final double dblVega, - final double dblTheta, - final double dblRho, - final double dblGamma, - final double dblVanna, - final double dblVomma, - final double dblCharm, - final double dblVeta, - final double dblColor, - final double dblSpeed, - final double dblUltima) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblDF = dblDF) || - !org.drip.quant.common.NumberUtil.IsValid (_dblEffectiveVolatility = dblEffectiveVolatility)) - throw new java.lang.Exception ("Greeks ctr: Invalid Inputs"); - - _dblExpectedPayoff = dblExpectedPayoff; - _dblExpectedATMPayoff = dblExpectedATMPayoff; - _dblPrice = dblPrice; - _dblProb1 = dblProb1; - _dblProb2 = dblProb2; - _dblDelta = dblDelta; - _dblVega = dblVega; - _dblTheta = dblTheta; - _dblRho = dblRho; - _dblGamma = dblGamma; - _dblVanna = dblVanna; - _dblVomma = dblVomma; - _dblCharm = dblCharm; - _dblVeta = dblVeta; - _dblColor = dblColor; - _dblSpeed = dblSpeed; - _dblUltima = dblUltima; - } - - /** - * The Option Terminal Discount Factor - * - * @return The Option Terminal Discount Factor - */ - - public double df() - { - return _dblDF; - } - - /** - * The "Effective" Volatility - * - * @return The "Effective" Volatility - */ - - public double effectiveVolatility() - { - return _dblEffectiveVolatility; - } - - /** - * The Expected Payoff - * - * @return The Expected Payoff - */ - - public double expectedPayoff() - { - return _dblExpectedPayoff; - } - - /** - * The Expected ATM Payoff - * - * @return The Expected ATM Payoff - */ - - public double expectedATMPayoff() - { - return _dblExpectedATMPayoff; - } - - /** - * The Option Price - * - * @return The Option Price - */ - - public double price() - { - return _dblPrice; - } - - /** - * The Prob 1 Term - * - * @return The Prob 1 Term - */ - - public double prob1() - { - return _dblProb1; - } - - /** - * The Prob 2 Term - * - * @return The Prob 2 Term - */ - - public double prob2() - { - return _dblProb2; - } - - /** - * The Option Delta - * - * @return The Option Delta - */ - - public double delta() - { - return _dblDelta; - } - - /** - * The Option Vega - * - * @return The Option Vega - */ - - public double vega() - { - return _dblVega; - } - - /** - * The Option Theta - * - * @return The Option Theta - */ - - public double theta() - { - return _dblTheta; - } - - /** - * The Option Rho - * - * @return The Option Rho - */ - - public double rho() - { - return _dblRho; - } - - /** - * The Option Gamma - * - * @return The Option Gamma - */ - - public double gamma() - { - return _dblGamma; - } - - /** - * The Option Vanna - * - * @return The Option Vanna - */ - - public double vanna() - { - return _dblVanna; - } - - /** - * The Option Vomma - * - * @return The Option Vomma - */ - - public double vomma() - { - return _dblVomma; - } - - /** - * The Option Charm - * - * @return The Option Charm - */ - - public double charm() - { - return _dblCharm; - } - - /** - * The Option Veta - * - * @return The Option Veta - */ - - public double veta() - { - return _dblVeta; - } - - /** - * The Option Color - * - * @return The Option Color - */ - - public double color() - { - return _dblColor; - } - - /** - * The Option Speed - * - * @return The Option Speed - */ - - public double speed() - { - return _dblSpeed; - } - - /** - * The Option Ultima - * - * @return The Option Ultima - */ - - public double ultima() - { - return _dblUltima; - } -} diff --git a/org/drip/pricer/option/HestonStochasticVolatilityAlgorithm.java b/org/drip/pricer/option/HestonStochasticVolatilityAlgorithm.java deleted file mode 100644 index 0d382b0..0000000 --- a/org/drip/pricer/option/HestonStochasticVolatilityAlgorithm.java +++ /dev/null @@ -1,770 +0,0 @@ - -package org.drip.pricer.option; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * HestonStochasticVolatilityAlgorithm implements the Heston 1993 Stochastic Volatility European Call and Put - * Options Pricer. - * - * @author Lakshmi Krishnamurthy - */ - -public class HestonStochasticVolatilityAlgorithm extends org.drip.pricer.option.FokkerPlanckGenerator { - - /** - * Payoff Transformation Type - The Original Heston 1993 Scheme - */ - - public static final int PAYOFF_TRANSFORM_SCHEME_HESTON_1993 = 1; - - /** - * Payoff Transformation Type - The Albrecher, Mayer, Schoutens, and Tistaert Scheme - */ - - public static final int PAYOFF_TRANSFORM_SCHEME_AMST_2007 = 1; - - private static final double FOURIER_FREQ_INIT = 0.01; - private static final double FOURIER_FREQ_INCREMENT = 0.1; - private static final double FOURIER_FREQ_FINAL = 25.; - - private org.drip.param.pricer.HestonOptionPricerParams _fphp = null; - - class PhaseCorrectedF { - double _dblCorrectedPhase = java.lang.Double.NaN; - org.drip.quant.fourier.ComplexNumber _cnF = null; - - PhaseCorrectedF ( - final double dblCorrectedPhase, - final org.drip.quant.fourier.ComplexNumber cnF) - { - _cnF = cnF; - _dblCorrectedPhase = dblCorrectedPhase; - } - } - - private PhaseCorrectedF fourierTransformHeston93 ( - final double dblStrike, - final double dbTimeToExpiry, - final double dblRiskFreeRate, - final double dblSpot, - final double dblInitialVolatility, - final double dblA, - final double dblFreq, - final double dblB, - final double dblU, - final org.drip.quant.fourier.RotationCountPhaseTracker rcpt) - { - try { - org.drip.quant.fourier.ComplexNumber cnSmallDLHS = new org.drip.quant.fourier.ComplexNumber (dblB, - -1. * _fphp.rho() * _fphp.sigma() * dblFreq); - - org.drip.quant.fourier.ComplexNumber cnSmallD = org.drip.quant.fourier.ComplexNumber.Square - (cnSmallDLHS); - - if (null == cnSmallD) return null; - - double dblSigmaScaler = _fphp.sigma() * _fphp.sigma(); - - if (null == (cnSmallD = org.drip.quant.fourier.ComplexNumber.Add (cnSmallD, new - org.drip.quant.fourier.ComplexNumber (dblSigmaScaler * dblFreq * dblFreq, -2. * dblSigmaScaler - * dblFreq * dblU)))) - return null; - - if (null == (cnSmallD = org.drip.quant.fourier.ComplexNumber.SquareRoot (cnSmallD))) return null; - - org.drip.quant.fourier.ComplexNumber cnGNumerator = org.drip.quant.fourier.ComplexNumber.Subtract - (cnSmallDLHS, cnSmallD); - - if (null == cnGNumerator) return null; - - org.drip.quant.fourier.ComplexNumber cnG = org.drip.quant.fourier.ComplexNumber.Add (cnSmallDLHS, - cnSmallD); - - if (null == cnG) return null; - - if (null == (cnG = org.drip.quant.fourier.ComplexNumber.Divide (cnGNumerator, cnG))) return null; - - int iM = 0; - int iN = 0; - - if (org.drip.quant.fourier.PhaseAdjuster.MULTI_VALUE_BRANCH_POWER_PHASE_TRACKER_KAHL_JACKEL == - _fphp.phaseTrackerType()) { - iM = (int) ((cnG.argument() + java.lang.Math.PI) / (2. * java.lang.Math.PI)); - - iN = (int) ((cnG.argument() + (dbTimeToExpiry * cnSmallD.argument()) + java.lang.Math.PI) / - (2. * java.lang.Math.PI)); - } - - org.drip.quant.fourier.ComplexNumber cnExpTTEScaledSmallD = - org.drip.quant.fourier.ComplexNumber.Scale (cnSmallD, -1. * dbTimeToExpiry); - - if (null == cnExpTTEScaledSmallD) return null; - - if (null == (cnExpTTEScaledSmallD = org.drip.quant.fourier.ComplexNumber.Exponentiate - (cnExpTTEScaledSmallD))) - return null; - - org.drip.quant.fourier.ComplexNumber cnD = new org.drip.quant.fourier.ComplexNumber (1. - - cnExpTTEScaledSmallD.real(), -1. * cnExpTTEScaledSmallD.imaginary()); - - org.drip.quant.fourier.ComplexNumber cnInvGExpTTEScaledSmallD = - org.drip.quant.fourier.ComplexNumber.Multiply (cnExpTTEScaledSmallD, cnG); - - if (null == cnInvGExpTTEScaledSmallD) return null; - - cnInvGExpTTEScaledSmallD = new org.drip.quant.fourier.ComplexNumber (1. - - cnInvGExpTTEScaledSmallD.real(), -1. * cnInvGExpTTEScaledSmallD.imaginary()); - - if (null == (cnD = org.drip.quant.fourier.ComplexNumber.Divide (cnD, cnInvGExpTTEScaledSmallD))) - return null; - - if (null == (cnD = org.drip.quant.fourier.ComplexNumber.Multiply (cnGNumerator, cnD))) - return null; - - dblSigmaScaler = 1. / dblSigmaScaler; - - if (null == (cnD = org.drip.quant.fourier.ComplexNumber.Scale (cnD, dblSigmaScaler))) return null; - - org.drip.quant.fourier.ComplexNumber cnC = new org.drip.quant.fourier.ComplexNumber (1. - - cnG.real(), -1. * cnG.imaginary()); - - if (org.drip.quant.fourier.PhaseAdjuster.MULTI_VALUE_BRANCH_POWER_PHASE_TRACKER_KAHL_JACKEL == - _fphp.phaseTrackerType()) { - if (null == (cnC = org.drip.quant.fourier.PhaseAdjuster.PowerLogPhaseTracker - (cnInvGExpTTEScaledSmallD, cnC, iN, iM))) - return null; - } else if (org.drip.quant.fourier.PhaseAdjuster.MULTI_VALUE_BRANCH_PHASE_TRACKER_ROTATION_COUNT - == _fphp.phaseTrackerType()) { - if (null == (cnC = org.drip.quant.fourier.ComplexNumber.Logarithm (cnC))) return null; - - cnC = new org.drip.quant.fourier.ComplexNumber (cnC.real(), rcpt.updateAndApply - (cnC.argument(), true)); - } - - double dblCorrectedPhase = cnC.argument(); - - if (null == (cnC = org.drip.quant.fourier.ComplexNumber.Scale (cnC, -2.))) return null; - - org.drip.quant.fourier.ComplexNumber cnTTEScaledGNumerator = - org.drip.quant.fourier.ComplexNumber.Scale (cnGNumerator, dbTimeToExpiry); - - if (null == cnTTEScaledGNumerator) return null; - - if (null == (cnC = org.drip.quant.fourier.ComplexNumber.Add (cnTTEScaledGNumerator, cnC))) - return null; - - if (null == (cnC = org.drip.quant.fourier.ComplexNumber.Scale (cnC, dblA * dblSigmaScaler))) - return null; - - if (null == (cnC = org.drip.quant.fourier.ComplexNumber.Add (new - org.drip.quant.fourier.ComplexNumber (0., dblRiskFreeRate * dbTimeToExpiry * dblFreq), - cnC))) - return null; - - org.drip.quant.fourier.ComplexNumber cnF = org.drip.quant.fourier.ComplexNumber.Scale (cnD, - dblInitialVolatility); - - if (null == cnF) return null; - - if (null == (cnF = org.drip.quant.fourier.ComplexNumber.Add (cnF, new - org.drip.quant.fourier.ComplexNumber (0., java.lang.Math.log (dblSpot) * dblFreq)))) - return null; - - if (null == (cnF = org.drip.quant.fourier.ComplexNumber.Add (cnF, cnC))) return null; - - if (null == (cnF = org.drip.quant.fourier.ComplexNumber.Add (cnF, new - org.drip.quant.fourier.ComplexNumber (0., -1. * java.lang.Math.log (dblStrike) * dblFreq)))) - return null; - - if (null == (cnF = org.drip.quant.fourier.ComplexNumber.Exponentiate (cnF))) return null; - - if (null == (cnF = org.drip.quant.fourier.ComplexNumber.Divide (cnF, new - org.drip.quant.fourier.ComplexNumber (0., dblFreq)))) - return null; - - return new PhaseCorrectedF (dblCorrectedPhase, cnF); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private PhaseCorrectedF fourierTransformAMST07 ( - final double dblStrike, - final double dbTimeToExpiry, - final double dblRiskFreeRate, - final double dblSpot, - final double dblInitialVolatility, - final double dblA, - final double dblFreq, - final double dblB, - final double dblU, - final org.drip.quant.fourier.RotationCountPhaseTracker rcpt) - { - try { - org.drip.quant.fourier.ComplexNumber cnSmallDLHS = new org.drip.quant.fourier.ComplexNumber (dblB, - -1. * _fphp.rho() * _fphp.sigma() * dblFreq); - - org.drip.quant.fourier.ComplexNumber cnSmallD = org.drip.quant.fourier.ComplexNumber.Square - (cnSmallDLHS); - - if (null == cnSmallD) return null; - - double dblSigmaScaler = _fphp.sigma() * _fphp.sigma(); - - if (null == (cnSmallD = org.drip.quant.fourier.ComplexNumber.Add (cnSmallD, new - org.drip.quant.fourier.ComplexNumber (dblSigmaScaler * dblFreq * dblFreq, -2. * dblSigmaScaler - * dblFreq * dblU)))) - return null; - - if (null == (cnSmallD = org.drip.quant.fourier.ComplexNumber.SquareRoot (cnSmallD))) return null; - - org.drip.quant.fourier.ComplexNumber cnGNumerator = org.drip.quant.fourier.ComplexNumber.Add - (cnSmallDLHS, cnSmallD); - - if (null == cnGNumerator) return null; - - org.drip.quant.fourier.ComplexNumber cnG = org.drip.quant.fourier.ComplexNumber.Subtract - (cnSmallDLHS, cnSmallD); - - if (null == cnG) return null; - - if (null == (cnG = org.drip.quant.fourier.ComplexNumber.Divide (cnGNumerator, cnG))) return null; - - int iM = 0; - int iN = 0; - - if (org.drip.quant.fourier.PhaseAdjuster.MULTI_VALUE_BRANCH_POWER_PHASE_TRACKER_KAHL_JACKEL == - _fphp.phaseTrackerType()) { - iM = (int) ((cnG.argument() + java.lang.Math.PI) / (2. * java.lang.Math.PI)); - - iN = (int) ((cnG.argument() + (dbTimeToExpiry * cnSmallD.argument()) + java.lang.Math.PI) / - (2. * java.lang.Math.PI)); - } - - org.drip.quant.fourier.ComplexNumber cnExpTTEScaledSmallD = - org.drip.quant.fourier.ComplexNumber.Scale (cnSmallD, dbTimeToExpiry); - - if (null == cnExpTTEScaledSmallD) return null; - - if (null == (cnExpTTEScaledSmallD = org.drip.quant.fourier.ComplexNumber.Exponentiate - (cnExpTTEScaledSmallD))) - return null; - - org.drip.quant.fourier.ComplexNumber cnD = new org.drip.quant.fourier.ComplexNumber (1. - - cnExpTTEScaledSmallD.real(), -1. * cnExpTTEScaledSmallD.imaginary()); - - org.drip.quant.fourier.ComplexNumber cnInvGExpTTEScaledSmallD = - org.drip.quant.fourier.ComplexNumber.Multiply (cnG, cnExpTTEScaledSmallD); - - if (null == cnInvGExpTTEScaledSmallD) return null; - - cnInvGExpTTEScaledSmallD = new org.drip.quant.fourier.ComplexNumber (1. - - cnInvGExpTTEScaledSmallD.real(), -1. * cnInvGExpTTEScaledSmallD.imaginary()); - - if (null == (cnD = org.drip.quant.fourier.ComplexNumber.Divide (cnD, cnInvGExpTTEScaledSmallD))) - return null; - - if (null == (cnD = org.drip.quant.fourier.ComplexNumber.Multiply (cnGNumerator, cnD))) - return null; - - dblSigmaScaler = 1. / dblSigmaScaler; - - if (null == (cnD = org.drip.quant.fourier.ComplexNumber.Scale (cnD, dblSigmaScaler))) return null; - - org.drip.quant.fourier.ComplexNumber cnC = new org.drip.quant.fourier.ComplexNumber (1. - - cnG.real(), -1. * cnG.imaginary()); - - if (org.drip.quant.fourier.PhaseAdjuster.MULTI_VALUE_BRANCH_POWER_PHASE_TRACKER_KAHL_JACKEL == - _fphp.phaseTrackerType()) { - if (null == (cnC = org.drip.quant.fourier.PhaseAdjuster.PowerLogPhaseTracker - (cnInvGExpTTEScaledSmallD, cnC, iN, iM))) - return null; - } else if (org.drip.quant.fourier.PhaseAdjuster.MULTI_VALUE_BRANCH_PHASE_TRACKER_ROTATION_COUNT - == _fphp.phaseTrackerType()) { - if (null == (cnC = org.drip.quant.fourier.ComplexNumber.Logarithm (cnC))) return null; - - cnC = new org.drip.quant.fourier.ComplexNumber (cnC.real(), rcpt.updateAndApply - (cnC.argument(), true)); - } - - double dblCorrectedPhase = cnC.argument(); - - if (null == (cnC = org.drip.quant.fourier.ComplexNumber.Scale (cnC, -2.))) return null; - - org.drip.quant.fourier.ComplexNumber cnTTEScaledGNumerator = - org.drip.quant.fourier.ComplexNumber.Scale (cnGNumerator, dbTimeToExpiry); - - if (null == cnTTEScaledGNumerator) return null; - - if (null == (cnC = org.drip.quant.fourier.ComplexNumber.Add (cnTTEScaledGNumerator, cnC))) - return null; - - if (null == (cnC = org.drip.quant.fourier.ComplexNumber.Scale (cnC, dblA * dblSigmaScaler))) - return null; - - if (null == (cnC = org.drip.quant.fourier.ComplexNumber.Add (new - org.drip.quant.fourier.ComplexNumber (0., dblRiskFreeRate * dbTimeToExpiry * dblFreq), - cnC))) - return null; - - org.drip.quant.fourier.ComplexNumber cnF = org.drip.quant.fourier.ComplexNumber.Scale (cnD, - dblInitialVolatility); - - if (null == cnF) return null; - - if (null == (cnF = org.drip.quant.fourier.ComplexNumber.Add (cnF, new - org.drip.quant.fourier.ComplexNumber (0., java.lang.Math.log (dblSpot) * dblFreq)))) - return null; - - if (null == (cnF = org.drip.quant.fourier.ComplexNumber.Add (cnF, cnC))) return null; - - if (null == (cnF = org.drip.quant.fourier.ComplexNumber.Add (cnF, new - org.drip.quant.fourier.ComplexNumber (0., -1. * java.lang.Math.log (dblStrike) * dblFreq)))) - return null; - - if (null == (cnF = org.drip.quant.fourier.ComplexNumber.Exponentiate (cnF))) return null; - - if (null == (cnF = org.drip.quant.fourier.ComplexNumber.Divide (cnF, new - org.drip.quant.fourier.ComplexNumber (0., dblFreq)))) - return null; - - return new PhaseCorrectedF (dblCorrectedPhase, cnF); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private PhaseCorrectedF payoffTransform ( - final double dblStrike, - final double dbTimeToExpiry, - final double dblRiskFreeRate, - final double dblSpot, - final double dblInitialVolatility, - final double dblA, - final double dblFreq, - final double dblB, - final double dblU, - final org.drip.quant.fourier.RotationCountPhaseTracker rcpt) - { - if (org.drip.quant.fourier.PhaseAdjuster.MULTI_VALUE_BRANCH_PHASE_TRACKER_ROTATION_COUNT == - _fphp.phaseTrackerType() && null == rcpt) - return null; - - if (PAYOFF_TRANSFORM_SCHEME_HESTON_1993 == _fphp.payoffTransformScheme()) - return fourierTransformHeston93 (dblStrike, dbTimeToExpiry, dblRiskFreeRate, dblSpot, - dblInitialVolatility, dblA, dblFreq, dblB, dblU, rcpt); - - if (PAYOFF_TRANSFORM_SCHEME_AMST_2007 == _fphp.payoffTransformScheme()) - return fourierTransformAMST07 (dblStrike, dbTimeToExpiry, dblRiskFreeRate, dblSpot, - dblInitialVolatility, dblA, dblFreq, dblB, dblU, rcpt); - - return null; - } - - /** - * HestonStochasticVolatilityAlgorithm constructor - * - * @param fphp The Heston Algorithm Parameters - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public HestonStochasticVolatilityAlgorithm ( - final org.drip.param.pricer.HestonOptionPricerParams fphp) - throws java.lang.Exception - { - if (null == (_fphp = fphp)) - throw new java.lang.Exception ("HestonStochasticVolatilityAlgorithm ctr: Invalid Inputs"); - } - - /** - * Record the Details of a Single Phase Adjustment Run - * - * @param dblStrike Strike - * @param dbTimeToExpiry TTE - * @param dblRiskFreeRate Risk Free Rate - * @param dblSpot Spot - * @param dblInitialVolatility Initial Volatility - * @param bLeft TRUE - Phase Correction applied to Left - * - * @return Map of the Phase Correction Record - */ - - public java.util.Map recordPhase ( - final double dblStrike, - final double dbTimeToExpiry, - final double dblRiskFreeRate, - final double dblSpot, - final double dblInitialVolatility, - final boolean bLeft) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblStrike) ||!org.drip.quant.common.NumberUtil.IsValid - (dblSpot) ||!org.drip.quant.common.NumberUtil.IsValid (dblInitialVolatility) || - !org.drip.quant.common.NumberUtil.IsValid (dbTimeToExpiry) || - !org.drip.quant.common.NumberUtil.IsValid (dblRiskFreeRate)) - return null; - - int i = 0; - double dblU1 = 0.5; - double dblU2 = -0.5; - double dblPreviousPhase = 0.; - - org.drip.quant.fourier.RotationCountPhaseTracker rcpt = - org.drip.quant.fourier.PhaseAdjuster.MULTI_VALUE_BRANCH_PHASE_TRACKER_ROTATION_COUNT == - _fphp.phaseTrackerType() ? new org.drip.quant.fourier.RotationCountPhaseTracker() : null; - - double dblA = _fphp.kappa() * _fphp.theta(); - - double dblB2 = _fphp.kappa() + _fphp.lambda(); - - double dblB1 = dblB2 - _fphp.rho() * _fphp.sigma(); - - java.util.Map mapPhaseRun = new - java.util.TreeMap(); - - for (double dblFreq = FOURIER_FREQ_INIT; dblFreq <= FOURIER_FREQ_FINAL; dblFreq += - FOURIER_FREQ_INCREMENT, ++i) { - PhaseCorrectedF pcf = bLeft ? payoffTransform (dblStrike, dbTimeToExpiry, dblRiskFreeRate, - dblSpot, dblInitialVolatility, dblA, dblFreq, dblB1, dblU1, rcpt) : payoffTransform - (dblStrike, dbTimeToExpiry, dblRiskFreeRate, dblSpot, dblInitialVolatility, dblA, - dblFreq, dblB2, dblU2, rcpt); - - if (null != rcpt) { - if (0 == i) - dblPreviousPhase = rcpt.getPreviousPhase(); - else if (1 == i) { - double dblCurrentPhase = rcpt.getPreviousPhase(); - - if (dblCurrentPhase < dblPreviousPhase) { - if (!rcpt.setDirection - (org.drip.quant.fourier.RotationCountPhaseTracker.APPLY_BACKWARD)) - return null; - } else if (dblCurrentPhase > dblPreviousPhase) { - if (!rcpt.setDirection - (org.drip.quant.fourier.RotationCountPhaseTracker.APPLY_FORWARD)) - return null; - } else - return null; - } - } - - mapPhaseRun.put (dblFreq, pcf._dblCorrectedPhase); - } - - return mapPhaseRun; - } - - @Override public double payoff ( - final double dblStrike, - final double dblTimeToExpiry, - final double dblRiskFreeRate, - final double dblUnderlier, - final boolean bIsPut, - final boolean bIsForward, - final double dblInitialVolatility, - final boolean bAsPrice) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblStrike) || - !org.drip.quant.common.NumberUtil.IsValid (dblUnderlier) || - !org.drip.quant.common.NumberUtil.IsValid (dblInitialVolatility) || - !org.drip.quant.common.NumberUtil.IsValid (dblTimeToExpiry) || - !org.drip.quant.common.NumberUtil.IsValid (dblRiskFreeRate)) - throw new java.lang.Exception ("HestonStochasticVolatilityAlgorithm::payoff => Invalid Inputs"); - - org.drip.quant.fourier.RotationCountPhaseTracker rcpt1 = - org.drip.quant.fourier.PhaseAdjuster.MULTI_VALUE_BRANCH_PHASE_TRACKER_ROTATION_COUNT == - _fphp.phaseTrackerType() ? new org.drip.quant.fourier.RotationCountPhaseTracker() : null; - - org.drip.quant.fourier.RotationCountPhaseTracker rcpt2 = - org.drip.quant.fourier.PhaseAdjuster.MULTI_VALUE_BRANCH_PHASE_TRACKER_ROTATION_COUNT == - _fphp.phaseTrackerType() ? new org.drip.quant.fourier.RotationCountPhaseTracker() : null; - - double dblA = _fphp.kappa() * _fphp.theta(); - - double dblB2 = _fphp.kappa() + _fphp.lambda(); - - double dblB1 = dblB2 - _fphp.rho() * _fphp.sigma(); - - double dblDF = java.lang.Math.exp (-1. * dblRiskFreeRate * dblTimeToExpiry); - - int i = 0; - double dblU1 = 0.5; - double dblU2 = -0.5; - double dblCallProb1 = 0.; - double dblCallProb2 = 0.; - double dblPreviousPhase = 0.; - double dblSpot = bIsForward ? dblUnderlier * dblDF : dblUnderlier; - - for (double dblFreq = FOURIER_FREQ_INIT; dblFreq <= FOURIER_FREQ_FINAL; dblFreq += - FOURIER_FREQ_INCREMENT, ++i) { - PhaseCorrectedF pcf1 = payoffTransform (dblStrike, dblTimeToExpiry, dblRiskFreeRate, dblSpot, - dblInitialVolatility, dblA, dblFreq, dblB1, dblU1, rcpt1); - - if (null != rcpt1) { - if (0 == i) - dblPreviousPhase = rcpt1.getPreviousPhase(); - else if (1 == i) { - double dblCurrentPhase = rcpt1.getPreviousPhase(); - - if (dblCurrentPhase < dblPreviousPhase) { - if (!rcpt1.setDirection - (org.drip.quant.fourier.RotationCountPhaseTracker.APPLY_BACKWARD)) - throw new java.lang.Exception - ("HestonStochasticVolatilityAlgorithm::payoff => Cannot compute payoff"); - } else if (dblCurrentPhase > dblPreviousPhase) { - if (!rcpt1.setDirection - (org.drip.quant.fourier.RotationCountPhaseTracker.APPLY_FORWARD)) - throw new java.lang.Exception - ("HestonStochasticVolatilityAlgorithm::payoff => Cannot compute payoff"); - } else - throw new java.lang.Exception - ("HestonStochasticVolatilityAlgorithm::payoff => Cannot compute payoff"); - } - } - - PhaseCorrectedF pcf2 = payoffTransform (dblStrike, dblTimeToExpiry, dblRiskFreeRate, dblSpot, - dblInitialVolatility, dblA, dblFreq, dblB2, dblU2, rcpt2); - - if (null != rcpt2) { - if (0 == i) - dblPreviousPhase = rcpt2.getPreviousPhase(); - else if (1 == i) { - double dblCurrentPhase = rcpt2.getPreviousPhase(); - - if (dblCurrentPhase < dblPreviousPhase) { - if (!rcpt2.setDirection - (org.drip.quant.fourier.RotationCountPhaseTracker.APPLY_BACKWARD)) - throw new java.lang.Exception - ("HestonStochasticVolatilityAlgorithm::payoff => Cannot compute payoff"); - } else if (dblCurrentPhase > dblPreviousPhase) { - if (!rcpt2.setDirection - (org.drip.quant.fourier.RotationCountPhaseTracker.APPLY_FORWARD)) - throw new java.lang.Exception - ("HestonStochasticVolatilityAlgorithm::payoff => Cannot compute payoff"); - } else - throw new java.lang.Exception - ("HestonStochasticVolatilityAlgorithm::payoff => Cannot compute payoff"); - } - } - - dblCallProb1 += pcf1._cnF.real() * FOURIER_FREQ_INCREMENT; - - dblCallProb2 += pcf2._cnF.real() * FOURIER_FREQ_INCREMENT; - } - - double dblForward = dblSpot / dblDF; - double dblPIScaler = 1. / java.lang.Math.PI; - double dblCallPayoff = dblForward * (0.5 + dblCallProb1 * dblPIScaler) - dblStrike * (0.5 + - dblCallProb2 * dblPIScaler); - - if (!bAsPrice) return bIsPut ? dblCallPayoff + dblStrike - dblForward : dblCallPayoff; - - return bIsPut ? dblDF * (dblCallPayoff + dblStrike - dblForward) : dblDF * dblCallPayoff; - } - - @Override public org.drip.pricer.option.Greeks greeks ( - final double dblStrike, - final double dblTimeToExpiry, - final double dblRiskFreeRate, - final double dblUnderlier, - final boolean bIsPut, - final boolean bIsForward, - final double dblInitialVolatility) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblStrike) || - !org.drip.quant.common.NumberUtil.IsValid (dblUnderlier) || - !org.drip.quant.common.NumberUtil.IsValid (dblInitialVolatility) || - !org.drip.quant.common.NumberUtil.IsValid (dblTimeToExpiry) || - !org.drip.quant.common.NumberUtil.IsValid (dblRiskFreeRate)) - return null; - - org.drip.quant.fourier.RotationCountPhaseTracker rcpt1 = - org.drip.quant.fourier.PhaseAdjuster.MULTI_VALUE_BRANCH_PHASE_TRACKER_ROTATION_COUNT == - _fphp.phaseTrackerType() ? new org.drip.quant.fourier.RotationCountPhaseTracker() : null; - - org.drip.quant.fourier.RotationCountPhaseTracker rcpt2 = - org.drip.quant.fourier.PhaseAdjuster.MULTI_VALUE_BRANCH_PHASE_TRACKER_ROTATION_COUNT == - _fphp.phaseTrackerType() ? new org.drip.quant.fourier.RotationCountPhaseTracker() : null; - - double dblA = _fphp.kappa() * _fphp.theta(); - - double dblB2 = _fphp.kappa() + _fphp.lambda(); - - double dblB1 = dblB2 - _fphp.rho() * _fphp.sigma(); - - double dblDF = java.lang.Math.exp (-1. * dblRiskFreeRate * dblTimeToExpiry); - - int i = 0; - double dblU1 = 0.5; - double dblU2 = -0.5; - double dblCallProb1 = 0.; - double dblCallProb2 = 0.; - double dblPreviousPhase = 0.; - double dblSpot = bIsForward ? dblUnderlier * dblDF : dblUnderlier; - - for (double dblFreq = FOURIER_FREQ_INIT; dblFreq <= FOURIER_FREQ_FINAL; dblFreq += - FOURIER_FREQ_INCREMENT, ++i) { - PhaseCorrectedF pcf1 = payoffTransform (dblStrike, dblTimeToExpiry, dblRiskFreeRate, dblSpot, - dblInitialVolatility, dblA, dblFreq, dblB1, dblU1, rcpt1); - - if (null != rcpt1) { - if (0 == i) - dblPreviousPhase = rcpt1.getPreviousPhase(); - else if (1 == i) { - double dblCurrentPhase = rcpt1.getPreviousPhase(); - - if (dblCurrentPhase < dblPreviousPhase) { - if (!rcpt1.setDirection - (org.drip.quant.fourier.RotationCountPhaseTracker.APPLY_BACKWARD)) - return null; - } else if (dblCurrentPhase > dblPreviousPhase) { - if (!rcpt1.setDirection - (org.drip.quant.fourier.RotationCountPhaseTracker.APPLY_FORWARD)) - return null; - } else - return null; - } - } - - PhaseCorrectedF pcf2 = payoffTransform (dblStrike, dblTimeToExpiry, dblRiskFreeRate, dblSpot, - dblInitialVolatility, dblA, dblFreq, dblB2, dblU2, rcpt2); - - if (null != rcpt2) { - if (0 == i) - dblPreviousPhase = rcpt2.getPreviousPhase(); - else if (1 == i) { - double dblCurrentPhase = rcpt2.getPreviousPhase(); - - if (dblCurrentPhase < dblPreviousPhase) { - if (!rcpt2.setDirection - (org.drip.quant.fourier.RotationCountPhaseTracker.APPLY_BACKWARD)) - return null; - } else if (dblCurrentPhase > dblPreviousPhase) { - if (!rcpt2.setDirection - (org.drip.quant.fourier.RotationCountPhaseTracker.APPLY_FORWARD)) - return null; - } else - return null; - } - } - - dblCallProb1 += pcf1._cnF.real() * FOURIER_FREQ_INCREMENT; - - dblCallProb2 += pcf2._cnF.real() * FOURIER_FREQ_INCREMENT; - } - - double dblForward = dblSpot / dblDF; - double dblPIScaler = 1. / java.lang.Math.PI; - dblCallProb1 = 0.5 + dblCallProb1 * dblPIScaler; - dblCallProb2 = 0.5 + dblCallProb2 * dblPIScaler; - double dblATMCallPayoff = dblForward * (dblCallProb1 - dblCallProb2); - double dblCallPrice = dblSpot * dblCallProb1 - dblStrike * dblDF * dblCallProb2; - double dblExpectedCallPayoff = dblForward * dblCallProb1 - dblStrike * dblDF * dblCallProb2; - - try { - if (!bIsPut) - return new org.drip.pricer.option.Greeks ( - dblDF, - dblInitialVolatility, - dblExpectedCallPayoff, - dblATMCallPayoff, - dblCallPrice, - dblCallProb1, - dblCallProb2, - dblCallProb1, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN - ); - - double dblPutPriceFromParity = dblCallPrice + dblStrike * dblDF - dblSpot; - - return new org.drip.pricer.option.PutGreeks ( - dblDF, - dblInitialVolatility, - dblExpectedCallPayoff + dblStrike - dblSpot, - dblATMCallPayoff, - dblPutPriceFromParity, - dblPutPriceFromParity, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN, - java.lang.Double.NaN - ); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/pricer/option/PutGreeks.java b/org/drip/pricer/option/PutGreeks.java deleted file mode 100644 index 0fdf3c1..0000000 --- a/org/drip/pricer/option/PutGreeks.java +++ /dev/null @@ -1,131 +0,0 @@ - -package org.drip.pricer.option; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * PutGreeks contains the Sensitivities generated during the Put Option Pricing Run. - * - * @author Lakshmi Krishnamurthy - */ - -public class PutGreeks extends org.drip.pricer.option.Greeks { - private double _dblPutPriceFromParity = java.lang.Double.NaN; - - /** - * The PutGreeks Constructor - * - * @param dblDF The Payoff Discount Factor - * @param dblEffectiveVolatility Effective Volatility - * @param dblExpectedPayoff Expected Forward Payoff - * @param dblExpectedATMPayoff Expected ATM Forward Payoff - * @param dblPutPrice Put Price - * @param dblPutPriceFromParity Put Price Computed from Put-Call Parity - * @param dblPutProb1 Put Probability Term #1 - * @param dblPutProb2 Put Probability Term #2 - * @param dblPutDelta Put Delta - * @param dblPutVega Put Vega - * @param dblPutTheta Put Theta - * @param dblPutRho Put Rho - * @param dblPutGamma Put Gamma - * @param dblPutVanna Put Vanna - * @param dblPutVomma Put Vomma - * @param dblPutCharm Put Charm - * @param dblPutVeta Put Veta - * @param dblPutColor Put Color - * @param dblPutSpeed Put Speed - * @param dblPutUltima Put Ultima - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public PutGreeks ( - final double dblDF, - final double dblEffectiveVolatility, - final double dblExpectedPayoff, - final double dblExpectedATMPayoff, - final double dblPutPrice, - final double dblPutPriceFromParity, - final double dblPutProb1, - final double dblPutProb2, - final double dblPutDelta, - final double dblPutVega, - final double dblPutTheta, - final double dblPutRho, - final double dblPutGamma, - final double dblPutVanna, - final double dblPutVomma, - final double dblPutCharm, - final double dblPutVeta, - final double dblPutColor, - final double dblPutSpeed, - final double dblPutUltima) - throws java.lang.Exception - { - super (dblDF, dblEffectiveVolatility, dblExpectedPayoff, dblExpectedATMPayoff, dblPutPrice, - dblPutProb1, dblPutProb2, dblPutDelta, dblPutVega, dblPutTheta, dblPutRho, dblPutGamma, - dblPutVanna, dblPutVomma, dblPutCharm, dblPutVeta, dblPutColor, dblPutSpeed, dblPutUltima); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblPutPrice) && - !org.drip.quant.common.NumberUtil.IsValid (_dblPutPriceFromParity = dblPutPriceFromParity)) - throw new java.lang.Exception ("PutGreeks ctr: Invalid Inputs"); - - _dblPutPriceFromParity = dblPutPriceFromParity; - } - - /** - * The Put Option Price Computed from the Put-Call Parity Relation - * - * @return The Put Option Price Computed from the Put-Call Parity Relation - */ - - public double putPriceFromParity() - { - return _dblPutPriceFromParity; - } -} diff --git a/org/drip/product/calib/CompositePeriodQuoteSet.java b/org/drip/product/calib/CompositePeriodQuoteSet.java deleted file mode 100644 index 243c07d..0000000 --- a/org/drip/product/calib/CompositePeriodQuoteSet.java +++ /dev/null @@ -1,152 +0,0 @@ - -package org.drip.product.calib; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * CompositePeriodQuoteSet implements the composite period's calibration quote set functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class CompositePeriodQuoteSet extends org.drip.product.calib.ProductQuoteSet { - - /** - * CompositePeriodQuoteSet constructor - * - * @param aLSS Array of Latent State Specification - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public CompositePeriodQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - throws java.lang.Exception - { - super (aLSS); - } - - /** - * Set the Base Rate - * - * @param dblBaseRate The Base Rate - * - * @return TRUE - Base Rate successfully set - */ - - public boolean setBaseRate ( - final double dblBaseRate) - { - return set ("BaseRate", dblBaseRate); - } - - /** - * Indicate if the Base Rate Field exists - * - * @return TRUE - Base Rate Field Exists - */ - - public boolean containsBaseRate() - { - return contains ("BaseRate"); - } - - /** - * Get the Period Base Coupon Rate - * - * @return The Period Base Coupon Rate - * - * @throws java.lang.Exception Thrown if the Base Rate Field does not exist - */ - - public double baseRate() - throws java.lang.Exception - { - return get ("BaseRate"); - } - - /** - * Set the Basis - * - * @param dblBasis The Basis - * - * @return TRUE - Basis successfully set - */ - - public boolean setBasis ( - final double dblBasis) - { - return set ("Basis", dblBasis); - } - - /** - * Indicate if the Basis Field exists - * - * @return TRUE - Basis Field Exists - */ - - public boolean containsBasis() - { - return contains ("Basis"); - } - - /** - * Get the Period Coupon Basis - * - * @return The Period Coupon Basis - * - * @throws java.lang.Exception Thrown if the Basis Field does not exist - */ - - public double basis() - throws java.lang.Exception - { - return get ("Basis"); - } -} diff --git a/org/drip/product/calib/DepositComponentQuoteSet.java b/org/drip/product/calib/DepositComponentQuoteSet.java deleted file mode 100644 index 75df442..0000000 --- a/org/drip/product/calib/DepositComponentQuoteSet.java +++ /dev/null @@ -1,192 +0,0 @@ - -package org.drip.product.calib; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * DepositComponentQuoteSet extends the ProductQuoteSet by implementing the Calibration Parameters for the - * Deposit Component. Currently it exposes the PV and the Rate Quote Fields. - * - * @author Lakshmi Krishnamurthy - */ - -public class DepositComponentQuoteSet extends org.drip.product.calib.ProductQuoteSet { - - /** - * DepositComponentQuoteSet Constructor - * - * @param aLSS Array of Latent State Specification - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public DepositComponentQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - throws java.lang.Exception - { - super (aLSS); - } - - /** - * Set the PV - * - * @param dblPV The PV - * - * @return TRUE - PV successfully set - */ - - public boolean setPV ( - final double dblPV) - { - return set ("PV", dblPV); - } - - /** - * Indicate if the PV Field exists - * - * @return TRUE - PV Field Exists - */ - - public boolean containsPV() - { - return contains ("PV"); - } - - /** - * Retrieve the PV - * - * @return The PV - * - * @throws java.lang.Exception Thrown if the PV Field does not exist - */ - - public double pv() - throws java.lang.Exception - { - return get ("PV"); - } - - /** - * Set the Forward Rate - * - * @param dblForwardRate The Forward Rate - * - * @return TRUE - The Forward Rate successfully set - */ - - public boolean setForwardRate ( - final double dblForwardRate) - { - return set ("ForwardRate", dblForwardRate); - } - - /** - * Indicate if the Forward Rate Field exists - * - * @return TRUE - Forward Rate Field Exists - */ - - public boolean containsForwardRate() - { - return contains ("ForwardRate"); - } - - /** - * Retrieve the Forward Rate - * - * @return The Forward Rate - * - * @throws java.lang.Exception Thrown if the Forward Rate Field does not exist - */ - - public double forwardRate() - throws java.lang.Exception - { - return get ("ForwardRate"); - } - - /** - * Set the Rate - * - * @param dblRate The Rate - * - * @return TRUE - The Rate successfully set - */ - - public boolean setRate ( - final double dblRate) - { - return set ("Rate", dblRate); - } - - /** - * Indicate if the Rate Field exists - * - * @return TRUE - Rate Field Exists - */ - - public boolean containsRate() - { - return contains ("Rate"); - } - - /** - * Retrieve the Rate - * - * @return The Rate - * - * @throws java.lang.Exception Thrown if the Rate Field does not exist - */ - - public double rate() - throws java.lang.Exception - { - return get ("Rate"); - } -} diff --git a/org/drip/product/calib/FRAComponentQuoteSet.java b/org/drip/product/calib/FRAComponentQuoteSet.java deleted file mode 100644 index 861c82b..0000000 --- a/org/drip/product/calib/FRAComponentQuoteSet.java +++ /dev/null @@ -1,153 +0,0 @@ - -package org.drip.product.calib; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FRAComponentQuoteSet extends the ProductQuoteSet by implementing the Calibration Parameters for the FRA - * Component. Currently it only exposes the FRA Rate Quote Field. - * - * @author Lakshmi Krishnamurthy - */ - -public class FRAComponentQuoteSet extends org.drip.product.calib.ProductQuoteSet { - - /** - * FRAComponentQuoteSet Constructor - * - * @param aLSS Array of Latent State Specification - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public FRAComponentQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - throws java.lang.Exception - { - super (aLSS); - } - - /** - * Set the FRA Rate - * - * @param dblFRARate The FRA Rate - * - * @return TRUE - The FRA Rate successfully set - */ - - public boolean setFRARate ( - final double dblFRARate) - { - return set ("FRARate", dblFRARate); - } - - /** - * Indicate if the FRA Rate Field exists - * - * @return TRUE - FRA Rate Field Exists - */ - - public boolean containsFRARate() - { - return contains ("FRARate"); - } - - /** - * Retrieve the FRA Rate - * - * @return The FRA Rate - * - * @throws java.lang.Exception Thrown if the FRA Rate Field does not exist - */ - - public double fraRate() - throws java.lang.Exception - { - return get ("FRARate"); - } - - /** - * Set the Par Forward Rate - * - * @param dblParForwardRate The Par Forward Rate - * - * @return TRUE - The Par Forward Rate successfully set - */ - - public boolean setParForwardRate ( - final double dblParForwardRate) - { - return set ("ParForwardRate", dblParForwardRate); - } - - /** - * Indicate if the Par Forward Rate Field exists - * - * @return TRUE - Par Forward Rate Field Exists - */ - - public boolean containsParForwardRate() - { - return contains ("ParForwardRate"); - } - - /** - * Retrieve the Par Forward Rate - * - * @return The Par Forward Rate - * - * @throws java.lang.Exception Thrown if the Par Forward Rate Field does not exist - */ - - public double parForwardRate() - throws java.lang.Exception - { - return get ("ParForwardRate"); - } -} diff --git a/org/drip/product/calib/FXForwardQuoteSet.java b/org/drip/product/calib/FXForwardQuoteSet.java deleted file mode 100644 index 83be900..0000000 --- a/org/drip/product/calib/FXForwardQuoteSet.java +++ /dev/null @@ -1,153 +0,0 @@ - -package org.drip.product.calib; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FXForwardQuoteSet extends the ProductQuoteSet by implementing the Calibration Parameters for the FX - * Forward Component. Currently it exposes the Outright and the PIP Fields. - * - * @author Lakshmi Krishnamurthy - */ - -public class FXForwardQuoteSet extends org.drip.product.calib.ProductQuoteSet { - - /** - * FXForwardQuoteSet Constructor - * - * @param aLSS Array of Latent State Specification - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public FXForwardQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - throws java.lang.Exception - { - super (aLSS); - } - - /** - * Set the Terminal FX Forward Outright - * - * @param dblFXForwardOutright The Terminal FX Forward Outright - * - * @return TRUE - The Terminal FX Forward Outright successfully set - */ - - public boolean setOutright ( - final double dblFXForwardOutright) - { - return set ("Outright", dblFXForwardOutright); - } - - /** - * Indicate if the Terminal FX Forward Outright Field exists - * - * @return TRUE - Terminal FX Forward Outright Field Exists - */ - - public boolean containsOutright() - { - return contains ("Outright"); - } - - /** - * Retrieve the Terminal FX Forward Outright - * - * @return Terminal FX Forward Outright Basis - * - * @throws java.lang.Exception Thrown if the Terminal FX Forward Outright Field does not exist - */ - - public double outright() - throws java.lang.Exception - { - return get ("Outright"); - } - - /** - * Set the Terminal FX Forward PIP - * - * @param dblFXForwardPIP The Terminal FX Forward PIP - * - * @return TRUE - The Terminal FX Forward PIP successfully set - */ - - public boolean setPIP ( - final double dblFXForwardPIP) - { - return set ("PIP", dblFXForwardPIP); - } - - /** - * Indicate if the Terminal FX Forward PIP Field exists - * - * @return TRUE - Terminal FX Forward PIP Field Exists - */ - - public boolean containsPIP() - { - return contains ("PIP"); - } - - /** - * Retrieve the Terminal FX Forward PIP - * - * @return Terminal FX Forward PIP Basis - * - * @throws java.lang.Exception Thrown if the Terminal FX Forward PIP Field does not exist - */ - - public double pip() - throws java.lang.Exception - { - return get ("PIP"); - } -} diff --git a/org/drip/product/calib/FixFloatQuoteSet.java b/org/drip/product/calib/FixFloatQuoteSet.java deleted file mode 100644 index 2a90cf5..0000000 --- a/org/drip/product/calib/FixFloatQuoteSet.java +++ /dev/null @@ -1,270 +0,0 @@ - -package org.drip.product.calib; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FixFloatQuoteSet extends the ProductQuoteSet by implementing the Calibration Parameters for the Fix-Float - * Swap Component. Currently it exposes the PV, the Reference Basis, and the Derived Basis Quote Fields. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixFloatQuoteSet extends org.drip.product.calib.ProductQuoteSet { - - /** - * FixFloatQuoteSet Constructor - * - * @param aLSS Array of Latent State Specification - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public FixFloatQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - throws java.lang.Exception - { - super (aLSS); - } - - /** - * Set the PV - * - * @param dblPV The PV - * - * @return TRUE - PV successfully set - */ - - public boolean setPV ( - final double dblPV) - { - return set ("PV", dblPV); - } - - /** - * Indicate if the PV Field exists - * - * @return TRUE - PV Field Exists - */ - - public boolean containsPV() - { - return contains ("PV"); - } - - /** - * Retrieve the PV - * - * @return The PV - * - * @throws java.lang.Exception Thrown if the PV Field does not exist - */ - - public double pv() - throws java.lang.Exception - { - return get ("PV"); - } - - /** - * Set the Derived Par Basis Spread - * - * @param dblDerivedParBasisSpread The Derived Par Basis Spread - * - * @return TRUE - The Derived Par Basis Spread successfully set - */ - - public boolean setDerivedParBasisSpread ( - final double dblDerivedParBasisSpread) - { - return set ("DerivedParBasisSpread", dblDerivedParBasisSpread); - } - - /** - * Indicate if the Derived Par Basis Spread Field exists - * - * @return TRUE - The Derived Par Basis Spread Field Exists - */ - - public boolean containsDerivedParBasisSpread() - { - return contains ("DerivedParBasisSpread"); - } - - /** - * Retrieve the Derived Par Basis Spread - * - * @return The Derived Par Basis Spread - * - * @throws java.lang.Exception Thrown if the Derived Par Basis Spread Field does not exist - */ - - public double derivedParBasisSpread() - throws java.lang.Exception - { - return get ("DerivedParBasisSpread"); - } - - /** - * Set the Reference Par Basis Spread - * - * @param dblReferenceParBasisSpread The Reference Par Basis Spread - * - * @return TRUE - The Reference Par Basis Spread successfully set - */ - - public boolean setReferenceParBasisSpread ( - final double dblReferenceParBasisSpread) - { - return set ("ReferenceParBasisSpread", dblReferenceParBasisSpread); - } - - /** - * Indicate if the Reference Par Basis Spread Field exists - * - * @return TRUE - The Reference Par Basis Spread Field Exists - */ - - public boolean containsReferenceParBasisSpread() - { - return contains ("ReferenceParBasisSpread"); - } - - /** - * Retrieve the Reference Par Basis Spread - * - * @return The Reference Par Basis Spread - * - * @throws java.lang.Exception Thrown if the Reference Par Basis Spread Field does not exist - */ - - public double referenceParBasisSpread() - throws java.lang.Exception - { - return get ("ReferenceParBasisSpread"); - } - - /** - * Set the Swap Rate - * - * @param dblSwapRate The Swap Rate - * - * @return TRUE - The Swap Rate successfully set - */ - - public boolean setSwapRate ( - final double dblSwapRate) - { - return set ("SwapRate", dblSwapRate); - } - - /** - * Indicate if the Swap Rate Field exists - * - * @return TRUE - The Swap Rate Field Exists - */ - - public boolean containsSwapRate() - { - return contains ("SwapRate"); - } - - /** - * Retrieve the Swap Rate - * - * @return The Swap Rate - * - * @throws java.lang.Exception Thrown if the Swap Rate Field does not exist - */ - - public double swapRate() - throws java.lang.Exception - { - return get ("SwapRate"); - } - - /** - * Set the Rate - * - * @param dblRate The Rate - * - * @return TRUE - The Rate successfully set - */ - - public boolean setRate ( - final double dblRate) - { - return set ("Rate", dblRate); - } - - /** - * Indicate if the Rate Field exists - * - * @return TRUE - The Rate Field Exists - */ - - public boolean containsRate() - { - return contains ("Rate"); - } - - /** - * Retrieve the Rate - * - * @return The Rate - * - * @throws java.lang.Exception Thrown if the Rate Field does not exist - */ - - public double rate() - throws java.lang.Exception - { - return get ("Rate"); - } -} diff --git a/org/drip/product/calib/FixedStreamQuoteSet.java b/org/drip/product/calib/FixedStreamQuoteSet.java deleted file mode 100644 index 02a2f38..0000000 --- a/org/drip/product/calib/FixedStreamQuoteSet.java +++ /dev/null @@ -1,192 +0,0 @@ - -package org.drip.product.calib; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FixedStreamQuoteSet extends the ProductQuoteSet by implementing the Calibration Parameters for the Fixed - * Stream. Currently it exposes the PV and the Coupon Quote Fields. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixedStreamQuoteSet extends org.drip.product.calib.ProductQuoteSet { - - /** - * FixedStreamQuoteSet Constructor - * - * @param aLSS Array of Latent State Specification - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public FixedStreamQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - throws java.lang.Exception - { - super (aLSS); - } - - /** - * Set the PV - * - * @param dblPV The PV - * - * @return TRUE - PV successfully set - */ - - public boolean setPV ( - final double dblPV) - { - return set ("PV", dblPV); - } - - /** - * Indicate if the PV Field exists - * - * @return TRUE - PV Field Exists - */ - - public boolean containsPV() - { - return contains ("PV"); - } - - /** - * Retrieve the PV - * - * @return The PV - * - * @throws java.lang.Exception Thrown if the PV Field does not exist - */ - - public double pv() - throws java.lang.Exception - { - return get ("PV"); - } - - /** - * Set the Coupon - * - * @param dblCoupon The Coupon - * - * @return TRUE - The Coupon successfully set - */ - - public boolean setCoupon ( - final double dblCoupon) - { - return set ("Coupon", dblCoupon); - } - - /** - * Indicate if the Coupon Field exists - * - * @return TRUE - Coupon Field Exists - */ - - public boolean containsCoupon() - { - return contains ("Coupon"); - } - - /** - * Retrieve the Coupon - * - * @return The Coupon - * - * @throws java.lang.Exception Thrown if the Coupon Field does not exist - */ - - public double coupon() - throws java.lang.Exception - { - return get ("Coupon"); - } - - /** - * Set the Coupon Basis - * - * @param dblCouponBasis The Coupon Basis - * - * @return TRUE - The Coupon Basis successfully set - */ - - public boolean setCouponBasis ( - final double dblCouponBasis) - { - return set ("CouponBasis", dblCouponBasis); - } - - /** - * Indicate if the Coupon Basis Field exists - * - * @return TRUE - Coupon Basis Field Exists - */ - - public boolean containsCouponBasis() - { - return contains ("CouponBasis"); - } - - /** - * Retrieve the Coupon Basis - * - * @return The Coupon Basis - * - * @throws java.lang.Exception Thrown if the Coupon Basis Field does not exist - */ - - public double couponBasis() - throws java.lang.Exception - { - return get ("CouponBasis"); - } -} diff --git a/org/drip/product/calib/FloatFloatQuoteSet.java b/org/drip/product/calib/FloatFloatQuoteSet.java deleted file mode 100644 index a3eb27e..0000000 --- a/org/drip/product/calib/FloatFloatQuoteSet.java +++ /dev/null @@ -1,193 +0,0 @@ - -package org.drip.product.calib; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FloatFloatQuoteSet extends the ProductQuoteSet by implementing the Calibration Parameters for the - * Float-Float Swap Component. Currently it exposes the PV, the Reference Basis, and the Derived Basis Quote - * Fields. - * - * @author Lakshmi Krishnamurthy - */ - -public class FloatFloatQuoteSet extends org.drip.product.calib.ProductQuoteSet { - - /** - * FloatFloatQuoteSet Constructor - * - * @param aLSS Array of Latent State Specification - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public FloatFloatQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - throws java.lang.Exception - { - super (aLSS); - } - - /** - * Set the PV - * - * @param dblPV The PV - * - * @return TRUE - PV successfully set - */ - - public boolean setPV ( - final double dblPV) - { - return set ("PV", dblPV); - } - - /** - * Indicate if the PV Field exists - * - * @return TRUE - PV Field Exists - */ - - public boolean containsPV() - { - return contains ("PV"); - } - - /** - * Retrieve the PV - * - * @return The PV - * - * @throws java.lang.Exception Thrown if the PV Field does not exist - */ - - public double pv() - throws java.lang.Exception - { - return get ("PV"); - } - - /** - * Set the Derived Par Basis Spread - * - * @param dblDerivedParBasisSpread The Derived Par Basis Spread - * - * @return TRUE - The Derived Par Basis Spread successfully set - */ - - public boolean setDerivedParBasisSpread ( - final double dblDerivedParBasisSpread) - { - return set ("DerivedParBasisSpread", dblDerivedParBasisSpread); - } - - /** - * Indicate if the Derived Par Basis Spread Field exists - * - * @return TRUE - The Derived Par Basis Spread Field Exists - */ - - public boolean containsDerivedParBasisSpread() - { - return contains ("DerivedParBasisSpread"); - } - - /** - * Retrieve the Derived Par Basis Spread - * - * @return The Derived Par Basis Spread - * - * @throws java.lang.Exception Thrown if the Derived Par Basis Spread Field does not exist - */ - - public double derivedParBasisSpread() - throws java.lang.Exception - { - return get ("DerivedParBasisSpread"); - } - - /** - * Set the Reference Par Basis Spread - * - * @param dblReferenceParBasisSpread The Reference Par Basis Spread - * - * @return TRUE - The Reference Par Basis Spread successfully set - */ - - public boolean setReferenceParBasisSpread ( - final double dblReferenceParBasisSpread) - { - return set ("ReferenceParBasisSpread", dblReferenceParBasisSpread); - } - - /** - * Indicate if the Reference Par Basis Spread Field exists - * - * @return TRUE - The Reference Par Basis Spread Field Exists - */ - - public boolean containsReferenceParBasisSpread() - { - return contains ("ReferenceParBasisSpread"); - } - - /** - * Retrieve the Reference Par Basis Spread - * - * @return The Reference Par Basis Spread - * - * @throws java.lang.Exception Thrown if the Reference Par Basis Spread Field does not exist - */ - - public double referenceParBasisSpread() - throws java.lang.Exception - { - return get ("ReferenceParBasisSpread"); - } -} diff --git a/org/drip/product/calib/FloatingStreamQuoteSet.java b/org/drip/product/calib/FloatingStreamQuoteSet.java deleted file mode 100644 index 5c2dc19..0000000 --- a/org/drip/product/calib/FloatingStreamQuoteSet.java +++ /dev/null @@ -1,192 +0,0 @@ - -package org.drip.product.calib; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FloatingStreamQuoteSet extends the ProductQuoteSet by implementing the Calibration Parameters for the - * Floating Stream. Currently it exposes the PV and the Spread Quote Fields. - * - * @author Lakshmi Krishnamurthy - */ - -public class FloatingStreamQuoteSet extends org.drip.product.calib.ProductQuoteSet { - - /** - * FloatingStreamQuoteSet Constructor - * - * @param aLSS Array of Latent State Specification - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public FloatingStreamQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - throws java.lang.Exception - { - super (aLSS); - } - - /** - * Set the PV - * - * @param dblPV The PV - * - * @return TRUE - PV successfully set - */ - - public boolean setPV ( - final double dblPV) - { - return set ("PV", dblPV); - } - - /** - * Indicate if the PV Field exists - * - * @return TRUE - PV Field Exists - */ - - public boolean containsPV() - { - return contains ("PV"); - } - - /** - * Retrieve the PV - * - * @return The PV - * - * @throws java.lang.Exception Thrown if the PV Field does not exist - */ - - public double pv() - throws java.lang.Exception - { - return get ("PV"); - } - - /** - * Set the Forward Rate - * - * @param dblForwardRate The Forward Rate - * - * @return TRUE - The Forward Rate successfully set - */ - - public boolean setForwardRate ( - final double dblForwardRate) - { - return set ("ForwardRate", dblForwardRate); - } - - /** - * Indicate if the Forward Rate Field exists - * - * @return TRUE - Forward Rate Field Exists - */ - - public boolean containsForwardRate() - { - return contains ("ForwardRate"); - } - - /** - * Retrieve the Forward Rate - * - * @return The Forward Rate - * - * @throws java.lang.Exception Thrown if the Forward Rate Field does not exist - */ - - public double forwardRate() - throws java.lang.Exception - { - return get ("ForwardRate"); - } - - /** - * Set the Spread - * - * @param dblSpread The Spread - * - * @return TRUE - The Spread successfully set - */ - - public boolean setSpread ( - final double dblSpread) - { - return set ("Spread", dblSpread); - } - - /** - * Indicate if the Spread Field exists - * - * @return TRUE - Spread Field Exists - */ - - public boolean containsSpread() - { - return contains ("Spread"); - } - - /** - * Retrieve the Spread - * - * @return The Spread - * - * @throws java.lang.Exception Thrown if the Spread Field does not exist - */ - - public double spread() - throws java.lang.Exception - { - return get ("Spread"); - } -} diff --git a/org/drip/product/calib/FuturesComponentQuoteSet.java b/org/drip/product/calib/FuturesComponentQuoteSet.java deleted file mode 100644 index 90d2ee3..0000000 --- a/org/drip/product/calib/FuturesComponentQuoteSet.java +++ /dev/null @@ -1,153 +0,0 @@ - -package org.drip.product.calib; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FuturesComponentQuoteSet extends the ProductQuoteSet by implementing the Calibration Parameters for the - * Short-term Interest Rate Futures Component. Currently it exposes the Price and the Rate Quote Fields. - * - * @author Lakshmi Krishnamurthy - */ - -public class FuturesComponentQuoteSet extends org.drip.product.calib.ProductQuoteSet { - - /** - * FuturesComponentQuoteSet Constructor - * - * @param aLSS Array of Latent State Specification - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public FuturesComponentQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - throws java.lang.Exception - { - super (aLSS); - } - - /** - * Set the Price - * - * @param dblPrice The Price - * - * @return TRUE - Price successfully set - */ - - public boolean setPrice ( - final double dblPrice) - { - return set ("Price", dblPrice); - } - - /** - * Indicate if the Price Field exists - * - * @return TRUE - Price Field Exists - */ - - public boolean containsPrice() - { - return contains ("Price"); - } - - /** - * Retrieve the Price - * - * @return The Price - * - * @throws java.lang.Exception Thrown if the Price Field does not exist - */ - - public double price() - throws java.lang.Exception - { - return get ("Price"); - } - - /** - * Set the Rate - * - * @param dblRate The Rate - * - * @return TRUE - The Rate successfully set - */ - - public boolean setRate ( - final double dblRate) - { - return set ("Rate", dblRate); - } - - /** - * Indicate if the Rate Field exists - * - * @return TRUE - Rate Field Exists - */ - - public boolean containsRate() - { - return contains ("Rate"); - } - - /** - * Retrieve the Rate - * - * @return The Rate - * - * @throws java.lang.Exception Thrown if the Rate Field does not exist - */ - - public double rate() - throws java.lang.Exception - { - return get ("Rate"); - } -} diff --git a/org/drip/product/calib/ProductQuoteSet.java b/org/drip/product/calib/ProductQuoteSet.java deleted file mode 100644 index d827dae..0000000 --- a/org/drip/product/calib/ProductQuoteSet.java +++ /dev/null @@ -1,327 +0,0 @@ - -package org.drip.product.calib; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ProductQuoteSet implements the Calibratable type-free Product Quote Shell. The derived calibration sets - * provide custom accessors. - * - * @author Lakshmi Krishnamurthy - */ - -public class ProductQuoteSet { - private org.drip.state.representation.LatentStateSpecification[] _aLSS = null; - - private org.drip.analytics.support.CaseInsensitiveTreeMap _mapQuote = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - /** - * Product Quote Set Constructor - * - * @param aLSS Array of Latent State Specifications - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ProductQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - throws java.lang.Exception - { - if (null == (_aLSS = aLSS)) throw new java.lang.Exception ("ProductQuoteSet ctr: Invalid Inputs"); - - int iNumLSS = _aLSS.length; - - if (0 == iNumLSS) throw new java.lang.Exception ("ProductQuoteSet ctr: Invalid Inputs"); - - for (int i = 0; i < iNumLSS; ++i) { - if (null == _aLSS[i]) throw new java.lang.Exception ("ProductQuoteSet ctr: Invalid Inputs"); - } - } - - /** - * Retrieve the Array of Latent State Specification - * - * @return The Array of Latent State Specification - */ - - public org.drip.state.representation.LatentStateSpecification[] lss() - { - return _aLSS; - } - - /** - * Indicate if the requested Latent State Type is contained in the Quote Set - * - * @param strLatentStateType The Requested Latent State Type - * - * @return TRUE - The requested Latent State Type is contained in the Quote Set - */ - - public boolean containsLatentStateType ( - final java.lang.String strLatentStateType) - { - if (null == strLatentStateType || strLatentStateType.isEmpty()) return false; - - for (org.drip.state.representation.LatentStateSpecification lss : _aLSS) { - if (lss.latentState().equalsIgnoreCase (strLatentStateType)) return true; - } - - return false; - } - - /** - * Retrieve the Forward Latent State Label, if it exists - * - * @return The Forward Latent State Label - */ - - public org.drip.state.identifier.ForwardLabel forwardLabel() - { - for (org.drip.state.representation.LatentStateSpecification lss : _aLSS) { - if (lss.latentState().equalsIgnoreCase - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_FORWARD)) - return (org.drip.state.identifier.ForwardLabel) lss.label(); - } - - return null; - } - - /** - * Retrieve the Funding Latent State Label, if it exists - * - * @return The Funding Latent State Label - */ - - public org.drip.state.identifier.FundingLabel fundingLabel() - { - for (org.drip.state.representation.LatentStateSpecification lss : _aLSS) { - if (lss.latentState().equalsIgnoreCase - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_FUNDING)) - return (org.drip.state.identifier.FundingLabel) lss.label(); - } - - return null; - } - - /** - * Retrieve the FX Latent State Label, if it exists - * - * @return The FX Latent State Label - */ - - public org.drip.state.identifier.FXLabel fxLabel() - { - for (org.drip.state.representation.LatentStateSpecification lss : _aLSS) { - if (lss.latentState().equalsIgnoreCase - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_FX)) - return (org.drip.state.identifier.FXLabel) lss.label(); - } - - return null; - } - - /** - * Retrieve the Govvie Latent State Label, if it exists - * - * @return The Govvie Latent State Label - */ - - public org.drip.state.identifier.GovvieLabel govvieLabel() - { - for (org.drip.state.representation.LatentStateSpecification lss : _aLSS) { - if (lss.latentState().equalsIgnoreCase - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_GOVVIE)) - return (org.drip.state.identifier.GovvieLabel) lss.label(); - } - - return null; - } - - /** - * Retrieve the Volatility Latent State Label, if it exists - * - * @return The Volatility Latent State Label - */ - - public org.drip.state.identifier.VolatilityLabel volatilityLabel() - { - for (org.drip.state.representation.LatentStateSpecification lss : _aLSS) { - if (lss.latentState().equalsIgnoreCase - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_VOLATILITY)) - return (org.drip.state.identifier.VolatilityLabel) lss.label(); - } - - return null; - } - - /** - * Indicate if the requested Latent State Quantification Metric is contained in the Quote Set - * - * @param strLatentStateQuantificationMetric The Requested Latent State Quantification Metric - * - * @return TRUE - The requested Latent State Quantification Metric is contained in the Quote Set - */ - - public boolean containsLatentStateQuantificationMetric ( - final java.lang.String strLatentStateQuantificationMetric) - { - if (null == strLatentStateQuantificationMetric || strLatentStateQuantificationMetric.isEmpty()) - return false; - - for (org.drip.state.representation.LatentStateSpecification lss : _aLSS) { - if (lss.latentStateQuantificationMetric().equalsIgnoreCase (strLatentStateQuantificationMetric)) - return true; - } - - return false; - } - - /** - * Indicate if the Specified External Latent State Specification is contained in the Array - * - * @param strLatentState The Latent State - * @param strLatentStateQuantificationMetric The Latent State Quantification Metric - * @param label The Specific Latent State Label - * - * @return TRUE - The Specified External Latent State Specification is contained in the Array - */ - - public boolean contains ( - final java.lang.String strLatentState, - final java.lang.String strLatentStateQuantificationMetric, - final org.drip.state.identifier.LatentStateLabel label) - { - org.drip.state.representation.LatentStateSpecification lssExternal = null; - - try { - lssExternal = new org.drip.state.representation.LatentStateSpecification (strLatentState, - strLatentStateQuantificationMetric, label); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - for (org.drip.state.representation.LatentStateSpecification lss : _aLSS) { - if (lss.match (lssExternal)) return true; - } - - return false; - } - - /** - * Set the named Manifest Measure Quote Value - * - * @param strManifestMeasure The Manifest Measure - * @param dblManifestMeasureQuote The Quote Value - * - * @return TRUE - The Manifest Measure Quote Value successfully set - */ - - public boolean set ( - final java.lang.String strManifestMeasure, - final double dblManifestMeasureQuote) - { - if (null == strManifestMeasure || strManifestMeasure.isEmpty() || - !org.drip.quant.common.NumberUtil.IsValid (dblManifestMeasureQuote)) - return false; - - _mapQuote.put (strManifestMeasure, dblManifestMeasureQuote); - - return true; - } - - /** - * Retrieve the Quote corresponding to the Specified Manifest Measure - * - * @param strManifestMeasure The Manifest Measure - * - * @return The Corresponding Quote - * - * @throws java.lang.Exception Thrown if the Quote cannot be extracted - */ - - public double get ( - final java.lang.String strManifestMeasure) - throws java.lang.Exception - { - if (null == strManifestMeasure || strManifestMeasure.isEmpty() || !_mapQuote.containsKey - (strManifestMeasure)) - throw new java.lang.Exception ("ProductQuoteSet::get - Invalid Inputs"); - - return _mapQuote.get (strManifestMeasure); - } - - /** - * Indicate if the Manifest Measure is available - * - * @param strManifestMeasure The Manifest Measure - * - * @return TRUE - The Manifest Measure is Available - */ - - public boolean contains ( - final java.lang.String strManifestMeasure) - { - return null != strManifestMeasure && !strManifestMeasure.isEmpty() && _mapQuote.containsKey - (strManifestMeasure); - } - - /** - * Return the Set of Fields Available - * - * @return The Set of Fields Available - */ - - public java.util.Set fields() - { - return _mapQuote.keySet(); - } -} diff --git a/org/drip/product/calib/StreamQuoteSet.java b/org/drip/product/calib/StreamQuoteSet.java deleted file mode 100644 index 513a779..0000000 --- a/org/drip/product/calib/StreamQuoteSet.java +++ /dev/null @@ -1,207 +0,0 @@ - -package org.drip.product.calib; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * StreamQuoteSet extends the ProductQuoteSet by implementing the Calibration Parameters for the Universal - * Stream. - * - * @author Lakshmi Krishnamurthy - */ - -public class StreamQuoteSet { - private org.drip.analytics.support.CaseInsensitiveTreeMap _mapQuote = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - /** - * Empty StreamQuoteSet Constructor - */ - - public StreamQuoteSet() - { - } - - /** - * Set the PV - * - * @param dblPV The PV - * - * @return TRUE - PV successfully set - */ - - public boolean setPV ( - final double dblPV) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPV)) return false; - - _mapQuote.put ("PV", dblPV); - - return true; - } - - /** - * Indicate if the PV Field exists - * - * @return TRUE - PV Field Exists - */ - - public boolean containsPV() - { - return _mapQuote.containsKey ("PV"); - } - - /** - * Retrieve the PV - * - * @return The PV - * - * @throws java.lang.Exception Thrown if the PV Field does not exist - */ - - public double pv() - throws java.lang.Exception - { - if (!containsPV()) throw new java.lang.Exception ("StreamQuoteSet::pv - Does not contain PV"); - - return _mapQuote.get ("PV"); - } - - /** - * Set the Coupon/Spread - * - * @param dblCouponSpread The Coupon/Spread - * - * @return TRUE - The Coupon/Spread successfully set - */ - - public boolean setCouponSpread ( - final double dblCouponSpread) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCouponSpread)) return false; - - _mapQuote.put ("CouponSpread", dblCouponSpread); - - return true; - } - - /** - * Indicate if the Coupon/Spread Field exists - * - * @return TRUE - Coupon/Spread Field Exists - */ - - public boolean containsCouponSpread() - { - return _mapQuote.containsKey ("CouponSpread"); - } - - /** - * Retrieve the Coupon/Spread - * - * @return The Coupon/Spread - * - * @throws java.lang.Exception Thrown if the Coupon/Spread Field does not exist - */ - - public double couponSpread() - throws java.lang.Exception - { - if (!containsCouponSpread()) - throw new java.lang.Exception ("StreamQuoteSet::couponSpread - Does not contain Coupon/spread"); - - return _mapQuote.get ("CouponSpread"); - } - - /** - * Set the Basis - * - * @param dblBasis The Basis - * - * @return TRUE - The Basis successfully set - */ - - public boolean setBasis ( - final double dblBasis) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBasis)) return false; - - _mapQuote.put ("Basis", dblBasis); - - return true; - } - - /** - * Indicate if the Basis Field exists - * - * @return TRUE - Basis Field Exists - */ - - public boolean containsBasis() - { - return _mapQuote.containsKey ("Basis"); - } - - /** - * Retrieve the Basis - * - * @return The Basis - * - * @throws java.lang.Exception Thrown if the Basis Field does not exist - */ - - public double basis() - throws java.lang.Exception - { - if (!containsBasis()) - throw new java.lang.Exception ("StreamQuoteSet::basis - Does not contain Basis"); - - return _mapQuote.get ("Basis"); - } -} diff --git a/org/drip/product/calib/TreasuryBondQuoteSet.java b/org/drip/product/calib/TreasuryBondQuoteSet.java deleted file mode 100644 index efdbaaa..0000000 --- a/org/drip/product/calib/TreasuryBondQuoteSet.java +++ /dev/null @@ -1,114 +0,0 @@ - -package org.drip.product.calib; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * TreasuryBondQuoteSet extends the ProductQuoteSet by implementing the Calibration Parameters for the - * Treasury Bond Component. Currently it exposes the Yield. - * - * @author Lakshmi Krishnamurthy - */ - -public class TreasuryBondQuoteSet extends org.drip.product.calib.ProductQuoteSet { - - /** - * TreasuryBondQuoteSet Constructor - * - * @param aLSS Array of Latent State Specification - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public TreasuryBondQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - throws java.lang.Exception - { - super (aLSS); - } - - /** - * Set the Yield - * - * @param dblYield The Yield - * - * @return TRUE - The Yield successfully set - */ - - public boolean setYield ( - final double dblYield) - { - return set ("Yield", dblYield); - } - - /** - * Indicate if the Yield Field exists - * - * @return TRUE - Yield Field Exists - */ - - public boolean containsYield() - { - return contains ("Yield"); - } - - /** - * Retrieve the Yield - * - * @return Yield - * - * @throws java.lang.Exception Thrown if the Yield Field does not exist - */ - - public double yield() - throws java.lang.Exception - { - return get ("Yield"); - } -} diff --git a/org/drip/product/calib/VolatilityProductQuoteSet.java b/org/drip/product/calib/VolatilityProductQuoteSet.java deleted file mode 100644 index fcaaef4..0000000 --- a/org/drip/product/calib/VolatilityProductQuoteSet.java +++ /dev/null @@ -1,115 +0,0 @@ - -package org.drip.product.calib; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * VolatilityProductQuoteSet implements the Calibratable Volatility Product Quote Shell. - * - * @author Lakshmi Krishnamurthy - */ - -public class VolatilityProductQuoteSet extends org.drip.product.calib.ProductQuoteSet { - - /** - * Volatility Product Quote Set Constructor - * - * @param aLSS Array of Latent State Specifications - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public VolatilityProductQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - throws java.lang.Exception - { - super (aLSS); - } - - /** - * Set the PV of an Option on the Product - * - * @param dblOptionPV The PV of an Option on the Product - * - * @return TRUE - PV of an Option on the Product successfully set - */ - - public boolean setOptionPV ( - final double dblOptionPV) - { - return set ("OptionPV", dblOptionPV); - } - - /** - * Indicate if the PV of an Option on the Product Field exists - * - * @return TRUE - PV of an Option on the Product Field Exists - */ - - public boolean containsOptionPV() - { - return contains ("OptionPV"); - } - - /** - * Retrieve the PV of an Option on the Product - * - * @return The PV of an Option on the Product - * - * @throws java.lang.Exception Thrown if the PV of an Option on the Product Field does not exist - */ - - public double optionPV() - throws java.lang.Exception - { - if (!containsOptionPV()) - throw new java.lang.Exception ("ProductQuoteSet::optionPV - Does not contain Option PV"); - - return get ("OptionPV"); - } -} diff --git a/org/drip/product/creator/BondBasketBuilder.java b/org/drip/product/creator/BondBasketBuilder.java deleted file mode 100644 index 872a018..0000000 --- a/org/drip/product/creator/BondBasketBuilder.java +++ /dev/null @@ -1,87 +0,0 @@ - -package org.drip.product.creator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * BondBasketBuilder contains the suite of helper functions for creating the bond Basket Product from different - * kinds of inputs and byte streams. - * - * @author Lakshmi Krishnamurthy - */ - -public class BondBasketBuilder { - - /** - * BondBasket constructor - * - * @param strName BondBasket Name - * @param aBond Component bonds - * @param adblWeights Component Bond weights - * - * @return The BasketProduct Instance - */ - - public static final org.drip.product.definition.BasketProduct CreateBondBasket ( - final java.lang.String strName, - final org.drip.product.definition.Bond[] aBond, - final double[] adblWeights) - { - try { - return new org.drip.product.credit.BondBasket (strName, aBond, adblWeights); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/product/creator/BondBuilder.java b/org/drip/product/creator/BondBuilder.java deleted file mode 100644 index ca08281..0000000 --- a/org/drip/product/creator/BondBuilder.java +++ /dev/null @@ -1,433 +0,0 @@ - -package org.drip.product.creator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * BondBuilder contains the suite of helper functions for creating simple fixed/floater bonds, user defined - * bonds, optionally with custom cash flows and embedded option schedules (European or American). It also - * constructs bonds by de-serializing the byte stream. - * - * @author Lakshmi Krishnamurthy - */ - -public class BondBuilder { - - /** - * Custom Bond Type Simple Fixed - */ - - public static final int BOND_TYPE_SIMPLE_FIXED = 0; - - /** - * Custom Bond Type Simple Floater - */ - - public static final int BOND_TYPE_SIMPLE_FLOATER = 1; - - /** - * Custom Bond Type Simple From Cash flows - */ - - public static final int BOND_TYPE_SIMPLE_FROM_CF = 2; - - /** - * Create the full generic bond object from the complete set of parameters - * - * @param tsyParams Bond Treasury Parameters - * @param idParams Bond Identifier Parameters - * @param cpnParams Bond Coupon Parameters - * @param fltParams Bond Floater Parameters - * @param mktConv Bond Market Quote Convention - * @param crValParams Bond Credit Valuation Parameters - * @param cfteParams Bond Cash-flow Termination Event Parameters - * @param periodParams Bond Period Generation Parameters - * @param notlParams Bond Notional Parameters - * - * @return The Bond object - */ - - public static final org.drip.product.credit.BondComponent CreateBondFromParams ( - final org.drip.product.params.TreasuryBenchmarks tsyParams, - final org.drip.product.params.IdentifierSet idParams, - final org.drip.product.params.CouponSetting cpnParams, - final org.drip.product.params.FloaterSetting fltParams, - final org.drip.product.params.QuoteConvention mktConv, - final org.drip.product.params.CreditSetting crValParams, - final org.drip.product.params.TerminationSetting cfteParams, - final org.drip.product.params.BondStream periodParams, - final org.drip.product.params.NotionalSetting notlParams) - { - if (null == idParams || !idParams.validate() || null == cpnParams || !cpnParams.validate() || (null - != fltParams && !fltParams.validate()) || null == mktConv || !mktConv.validate() || null == - crValParams || !crValParams.validate() || null == cfteParams || !cfteParams.validate() || - null == periodParams || null == notlParams || !notlParams.validate()) - return null; - - org.drip.product.credit.BondComponent bond = new org.drip.product.credit.BondComponent(); - - bond.setTreasuryBenchmark (tsyParams); - - bond.setIdentifierSet (idParams); - - bond.setCouponSetting (cpnParams); - - bond.setFloaterSetting (fltParams); - - bond.setMarketConvention (mktConv); - - bond.setCreditSetting (crValParams); - - bond.setTerminationSetting (cfteParams); - - bond.setStream (periodParams); - - bond.setNotionalSetting (notlParams); - - return bond; - } - - /** - * Creates a simple fixed bond from parameters - * - * @param strName Bond Name - * @param strCurrency Bond Currency - * @param strCreditCurveName Credit Curve Name - * @param dblCoupon Bond Fixed Coupon - * @param iFreq Coupon Frequency - * @param strDayCount Bond Coupon Day count convention - * @param dtEffective Effective Date - * @param dtMaturity Maturity Date - * @param fsPrincipalOutstanding Outstanding Principal schedule - * @param fsCoupon Bond Coupon Schedule - * - * @return The Bond Object - */ - - public static final org.drip.product.credit.BondComponent CreateSimpleFixed ( - final java.lang.String strName, - final java.lang.String strCurrency, - final java.lang.String strCreditCurveName, - final double dblCoupon, - final int iFreq, - final java.lang.String strDayCount, - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity, - final org.drip.quant.common.Array2D fsPrincipalOutstanding, - final org.drip.quant.common.Array2D fsCoupon) - { - if (null == strName || strName.isEmpty() || null == strCurrency || strCurrency.isEmpty() || null == - dtEffective || null == dtMaturity || !org.drip.quant.common.NumberUtil.IsValid (dblCoupon)) - return null; - - return CreateBondFromParams (null, new org.drip.product.params.IdentifierSet (strName, strName, - strName, strName), new org.drip.product.params.CouponSetting (fsCoupon, "", dblCoupon, - java.lang.Double.NaN, java.lang.Double.NaN), null, new - org.drip.product.params.QuoteConvention (null, "", dtEffective.julian(), 100., 0, - strCurrency, org.drip.analytics.daycount.Convention.DATE_ROLL_ACTUAL), new - org.drip.product.params.CreditSetting (30, java.lang.Double.NaN, true, - strCreditCurveName, true), new org.drip.product.params.TerminationSetting - (false, false, false), org.drip.product.params.BondStream.Create - (dtMaturity.julian(), dtEffective.julian(), - java.lang.Integer.MIN_VALUE, java.lang.Integer.MIN_VALUE, - dtEffective.julian(), iFreq, dblCoupon, strDayCount, - strDayCount, null, null, null, null, null, null, null, - null, "", false, strCurrency, strCurrency, null, - !org.drip.quant.common.StringUtil.IsEmpty - (strCreditCurveName) ? - org.drip.state.identifier.CreditLabel.Standard - (strCreditCurveName) : null), new org.drip.product.params.NotionalSetting (100., strCurrency, - fsPrincipalOutstanding, org.drip.product.params.NotionalSetting.PERIOD_AMORT_AT_START, - false)); - } - - /** - * Create a simple floating rate bond - * - * @param strName Bond Name - * @param strCurrency Bond Currency - * @param strRateIndex Floating Rate Index - * @param strCreditCurveName Credit Curve Name - * @param dblSpread Bond Floater Spread - * @param iFreq Coupon Frequency - * @param strDayCount Coupon Day Count Convention - * @param dtEffective Effective date - * @param dtMaturity Maturity Date - * @param fsPrincipalOutstanding Outstanding Principal Schedule - * @param fsCoupon Coupon Schedule - * - * @return The Bond object - */ - - public static final org.drip.product.credit.BondComponent CreateSimpleFloater ( - final java.lang.String strName, - final java.lang.String strCurrency, - final java.lang.String strRateIndex, - final java.lang.String strCreditCurveName, - final double dblSpread, - final int iFreq, - final java.lang.String strDayCount, - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity, - final org.drip.quant.common.Array2D fsPrincipalOutstanding, - final org.drip.quant.common.Array2D fsCoupon) - { - if (null == strName || strName.isEmpty() || null == strCurrency || strCurrency.isEmpty() || null == - dtEffective || null == dtMaturity || !org.drip.quant.common.NumberUtil.IsValid (dblSpread)) - return null; - - return CreateBondFromParams (null, new org.drip.product.params.IdentifierSet (strName, strName, - strName, strCurrency), new org.drip.product.params.CouponSetting (fsCoupon, "", dblSpread, - java.lang.Double.NaN, java.lang.Double.NaN), new org.drip.product.params.FloaterSetting - (strRateIndex, "", dblSpread, java.lang.Double.NaN), new - org.drip.product.params.QuoteConvention (null, "", dtEffective.julian(), 100., 0, - strCurrency, org.drip.analytics.daycount.Convention.DATE_ROLL_ACTUAL), new - org.drip.product.params.CreditSetting (30, java.lang.Double.NaN, true, - strCreditCurveName, true), new org.drip.product.params.TerminationSetting - (false, false, false), org.drip.product.params.BondStream.Create - (dtMaturity.julian(), dtEffective.julian(), - java.lang.Integer.MIN_VALUE, java.lang.Integer.MIN_VALUE, - dtEffective.julian(), iFreq, dblSpread, strDayCount, - strDayCount, null, null, null, null, null, null, - null, null, "", false, strCurrency, strCurrency, - org.drip.state.identifier.ForwardLabel.Standard - (strRateIndex), null == strCreditCurveName || strCreditCurveName.isEmpty() ? null : - org.drip.state.identifier.CreditLabel.Standard (strCreditCurveName)), new - org.drip.product.params.NotionalSetting (100., strCurrency, fsPrincipalOutstanding, - org.drip.product.params.NotionalSetting.PERIOD_AMORT_AT_START, false)); - } - - /** - * Create a bond from custom/user-defined cash flows and coupon conventions - * - * @param strName Bond Name - * @param dtEffective Effective Date - * @param strCurrency Bond Currency - * @param strCreditCurveName Credit Curve Name - * @param strDayCount Coupon Day Count Convention - * @param dblInitialNotional The Initial Notional - * @param dblCouponRate The Coupon Rate - * @param iCouponFrequency Coupon Frequency - * @param adtPeriodEnd Array of Period End Dates - * @param adblCouponAmount Matching Array of Coupon Amounts - * @param adblPrincipalAmount Matching Array of Principal Amounts - * @param bIsPrincipalPayDown Flag indicating whether principal is pay down or outstanding - * - * @return The Bond object - */ - - public static final org.drip.product.credit.BondComponent CreateBondFromCF ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtEffective, - final java.lang.String strCurrency, - final java.lang.String strCreditCurveName, - final java.lang.String strDayCount, - final double dblInitialNotional, - final double dblCouponRate, - final int iCouponFrequency, - final org.drip.analytics.date.JulianDate[] adtPeriodEnd, - final double[] adblCouponAmount, - final double[] adblPrincipalAmount, - final boolean bIsPrincipalPayDown) - { - if (null == adtPeriodEnd || null == adblCouponAmount || null == adblPrincipalAmount || null == - dtEffective || !org.drip.quant.common.NumberUtil.IsValid (dblInitialNotional) || - !org.drip.quant.common.NumberUtil.IsValid (dblCouponRate) || 0 == iCouponFrequency) - return null; - - int iEffectiveDate = dtEffective.julian(); - - int iNumPeriod = adtPeriodEnd.length; - int iPeriodStartDate = iEffectiveDate; - int[] aiPeriodEndDate = new int[iNumPeriod]; - int[] aiPrincipalDate = new int[iNumPeriod + 1]; - org.drip.product.params.BondStream stream = null; - double[] adblCouponFactor = new double[iNumPeriod]; - double[] adblPeriodEndPrincipal = new double[iNumPeriod]; - double[] adblPrincipalFactor = new double[iNumPeriod + 1]; - double[] adblPeriodEndPrincipalFactor = new double[iNumPeriod]; - - if (0 == iNumPeriod || iNumPeriod != adblCouponAmount.length || iNumPeriod != - adblPrincipalAmount.length) - return null; - - if (bIsPrincipalPayDown) { - for (int i = 0; i < iNumPeriod; ++i) - adblPeriodEndPrincipal[i] = (0 == i ? dblInitialNotional : adblPeriodEndPrincipal[i - 1]) - - adblPrincipalAmount[i]; - } else - adblPeriodEndPrincipal = adblPrincipalAmount; - - java.util.List lsCouponPeriod = new - java.util.ArrayList(); - - for (int i = 0; i < iNumPeriod; ++i) { - if (null == adtPeriodEnd[i]) return null; - - aiPeriodEndDate[i] = adtPeriodEnd[i].julian(); - - adblPeriodEndPrincipalFactor[i] = adblPeriodEndPrincipal[i] / dblInitialNotional; - - try { - adblCouponFactor[i] = adblCouponAmount[i] / (0 == i ? dblInitialNotional : - adblPeriodEndPrincipal[i - 1]) / org.drip.analytics.daycount.Convention.YearFraction - (iPeriodStartDate, aiPeriodEndDate[i], strDayCount, false, null, "") / dblCouponRate; - - java.util.List lsCUP = new - java.util.ArrayList(); - - lsCUP.add (new org.drip.analytics.cashflow.ComposableUnitFixedPeriod (iPeriodStartDate, - aiPeriodEndDate[i], new org.drip.param.period.UnitCouponAccrualSetting (iCouponFrequency, - strDayCount, false, strDayCount, false, strCurrency, false, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC), - new org.drip.param.period.ComposableFixedUnitSetting ((12 / iCouponFrequency) + "M", - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, null, - dblCouponRate, 0., strCurrency))); - - lsCouponPeriod.add (new org.drip.analytics.cashflow.CompositeFixedPeriod (new - org.drip.param.period.CompositePeriodSetting (iCouponFrequency, (12 / iCouponFrequency) + - "M", strCurrency, null, adblPrincipalAmount[i], null, null, null, null), lsCUP)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - iPeriodStartDate = aiPeriodEndDate[i]; - } - - for (int i = 0; i <= iNumPeriod; ++i) { - aiPrincipalDate[i] = 0 == i ? iEffectiveDate : aiPeriodEndDate[i - 1]; - adblPrincipalFactor[i] = 0 == i ? 1. : adblPeriodEndPrincipalFactor[i - 1]; - } - - try { - stream = new org.drip.product.params.BondStream (lsCouponPeriod, java.lang.Integer.MIN_VALUE, - "MATURITY_TYPE_REGULAR"); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return CreateBondFromParams (null, new org.drip.product.params.IdentifierSet (strName, strName, - strName, strCurrency), new org.drip.product.params.CouponSetting - (org.drip.quant.common.Array2D.FromArray (aiPeriodEndDate, adblCouponFactor), "", - dblCouponRate, java.lang.Double.NaN, java.lang.Double.NaN), null, new - org.drip.product.params.QuoteConvention (null, "", dtEffective.julian(), 1., 0, - strCurrency, org.drip.analytics.daycount.Convention.DATE_ROLL_ACTUAL), new - org.drip.product.params.CreditSetting (30, java.lang.Double.NaN, true, - strCreditCurveName, true), new org.drip.product.params.TerminationSetting - (false, false, false), stream, new - org.drip.product.params.NotionalSetting (1., strCurrency, - org.drip.quant.common.Array2D.FromArray (aiPrincipalDate, - adblPrincipalFactor), - org.drip.product.params.NotionalSetting.PERIOD_AMORT_AT_START, - false)); - } - - /** - * Creates a Treasury Bond from the Parameters - * - * @param strTreasuryCode Treasury Code - * @param strCurrency Bond Currency - * @param dblCoupon Bond Fixed Coupon - * @param iFreq Coupon Frequency - * @param strDayCount Bond Coupon Day count convention - * @param dtEffective Effective Date - * @param dtMaturity Maturity Date - * - * @return The Treasury Bond Instance - */ - - public static final org.drip.product.govvie.TreasuryComponent Treasury ( - final java.lang.String strTreasuryCode, - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity, - final java.lang.String strCurrency, - final double dblCoupon, - final int iFreq, - final java.lang.String strDayCount) - { - if (null == strTreasuryCode || strTreasuryCode.isEmpty()) return null; - - org.drip.product.govvie.TreasuryComponent tsyBond = null; - - try { - tsyBond = new org.drip.product.govvie.TreasuryComponent (strTreasuryCode); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - java.lang.String strName = strTreasuryCode + " " + org.drip.quant.common.FormatUtil.FormatDouble - (dblCoupon, 1, 2, 100.) + " " + dtMaturity; - - tsyBond.setIdentifierSet (new org.drip.product.params.IdentifierSet (strName, strName, strName, - strName)); - - tsyBond.setNotionalSetting (new org.drip.product.params.NotionalSetting (100., strCurrency, - org.drip.quant.common.Array2D.BulletSchedule(), - org.drip.product.params.NotionalSetting.PERIOD_AMORT_AT_START, false)); - - tsyBond.setCouponSetting (new org.drip.product.params.CouponSetting (null, "", dblCoupon, - java.lang.Double.NaN, java.lang.Double.NaN)); - - tsyBond.setStream (org.drip.product.params.BondStream.Create (dtMaturity.julian(), - dtEffective.julian(), java.lang.Integer.MIN_VALUE, java.lang.Integer.MIN_VALUE, - dtEffective.julian(), iFreq, dblCoupon, strDayCount, strDayCount, null, null, null, null, - null, null, null, null, "", false, strCurrency, strCurrency, null, null)); - - return tsyBond; - } -} diff --git a/org/drip/product/creator/BondProductBuilder.java b/org/drip/product/creator/BondProductBuilder.java deleted file mode 100644 index 0494a2f..0000000 --- a/org/drip/product/creator/BondProductBuilder.java +++ /dev/null @@ -1,1604 +0,0 @@ - -package org.drip.product.creator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * BondProductBuilder holds the static parameters of the bond product needed for the full bond valuation. It - * contains the bond identifier parameters (ISIN, CUSIP), the issuer level parameters (Ticker, SPN or - * the credit curve string), coupon parameters (coupon rate, coupon frequency, coupon type, day count), - * maturity parameters (maturity date, maturity type, final maturity, redemption value), date parameters - * (announce, first settle, first coupon, interest accrual start, and issue dates), embedded option - * parameters (callable, putable, has been exercised), currency parameters (trade, coupon, and - * redemption currencies), floater parameters (floater flag, floating coupon convention, current coupon, - * rate index, spread), and whether the bond is perpetual or has defaulted. - * - * @author Lakshmi Krishnamurthy - * - */ - -public class BondProductBuilder { - private static final boolean m_bBlog = false; - private static final boolean m_bDisplayWarnings = true; - - /** - * ISIN - */ - - public java.lang.String _strISIN = ""; - - /** - * CUSIP - */ - - public java.lang.String _strCUSIP = ""; - - /** - * Ticker - */ - - public java.lang.String _strTicker = ""; - - /** - * Coupon - */ - - public double _dblCoupon = java.lang.Double.NaN; - - /** - * Maturity - */ - - public org.drip.analytics.date.JulianDate _dtMaturity = null; - - /** - * Coupon Frequency - */ - - public int _iCouponFreq = 0; - - /** - * Coupon Type - */ - - public java.lang.String _strCouponType = ""; - - /** - * Maturity Type - */ - - public java.lang.String _strMaturityType = ""; - - /** - * Calculation Type - */ - - public java.lang.String _strCalculationType = ""; - - /** - * Day count Code - */ - - public java.lang.String _strDayCountCode = ""; - - /** - * Redemption Value - */ - - public double _dblRedemptionValue = java.lang.Double.NaN; - - /** - * Announce Date - */ - - public org.drip.analytics.date.JulianDate _dtAnnounce = null; - - /** - * First Settle Date - */ - - public org.drip.analytics.date.JulianDate _dtFirstSettle = null; - - /** - * First Coupon Date - */ - - public org.drip.analytics.date.JulianDate _dtFirstCoupon = null; - - /** - * Interest Accrual Start Date - */ - - public org.drip.analytics.date.JulianDate _dtInterestAccrualStart = null; - - /** - * Issue Date - */ - - public org.drip.analytics.date.JulianDate _dtIssue = null; - - /** - * Callable flag - */ - - public boolean _bIsCallable = false; - - /** - * Putable flag - */ - - public boolean _bIsPutable = false; - - /** - * Sinkable flag - */ - - public boolean _bIsSinkable = false; - - /** - * Redemption Currency - */ - - public java.lang.String _strRedemptionCurrency = ""; - - /** - * Coupon Currency - */ - - public java.lang.String _strCouponCurrency = ""; - - /** - * Trade Currency - */ - - public java.lang.String _strTradeCurrency = ""; - - /** - * Has Been Exercised flag - */ - - public boolean _bHasBeenCalled = false; - - /** - * Floater Coupon Day Count Convention - */ - - public java.lang.String _strFloatCouponConvention = ""; - - /** - * Current Coupon - */ - - public double _dblCurrentCoupon = java.lang.Double.NaN; - - /** - * Is Floater flag - */ - - public boolean _bIsFloater = false; - - /** - * Final Maturity Date - */ - - public org.drip.analytics.date.JulianDate _dtFinalMaturity = null; - - /** - * Is Perpetual flag - */ - - public boolean _bIsPerpetual = false; - - /** - * Is Defaulted flag - */ - - public boolean _bIsDefaulted = false; - - /** - * Floater Spread - */ - - public double _dblFloatSpread = java.lang.Double.NaN; - - /** - * Rate Index - */ - - public java.lang.String _strRateIndex = ""; - - /** - * Issuer SPN - */ - - public java.lang.String _strIssuerSPN = ""; - - private static final java.lang.String DES ( - final BondProductBuilder bpb) - { - return bpb._strTicker + " " + bpb._dtMaturity.toString() + "[" + bpb._strISIN + "]"; - } - - private org.drip.analytics.date.JulianDate reconcileStartDate() - { - if (null != _dtInterestAccrualStart) return _dtInterestAccrualStart; - - if (null != _dtIssue) return _dtIssue; - - if (null != _dtFirstSettle) return _dtFirstSettle; - - return _dtAnnounce; - } - - /** - * Create BondProductBuilder from the SQL ResultSet and the input MPC - * - * @param rs SQL ResultSet - * @param mpc org.drip.param.definition.MarketParams to help fill some of the fields in - * - * @return BondProductBuilder object - */ - - public static final BondProductBuilder CreateFromResultSet ( - final java.sql.ResultSet rs, - final org.drip.param.definition.ScenarioMarketParams mpc) - { - try { - BondProductBuilder bpb = new BondProductBuilder(); - - if (null == (bpb._strISIN = rs.getString ("ISIN"))) { - System.out.println ("No ISIN!"); - - return null; - } - - if (m_bBlog) System.out.println ("Loading " + bpb._strISIN + " ..."); - - if (null == (bpb._strCUSIP = rs.getString ("CUSIP"))) { - System.out.println ("No CUSIP!"); - - return null; - } - - bpb._strTicker = rs.getString ("Ticker"); - - if (!org.drip.quant.common.NumberUtil.IsValid (bpb._dblCoupon = 0.01 * rs.getDouble ("Coupon"))) - { - System.out.println ("Invalid coupon for ISIN " + bpb._strISIN); - - return null; - } - - if (null == (bpb._dtMaturity = org.drip.analytics.date.DateUtil.MakeJulianFromRSEntry (rs.getDate - ("Maturity")))) { - System.out.println ("Invalid maturity for ISIN " + bpb._strISIN); - - return null; - } - - bpb._iCouponFreq = rs.getInt ("CouponFreq"); - - bpb._strCouponType = rs.getString ("CouponType"); - - bpb._strMaturityType = rs.getString ("MaturityType"); - - bpb._strCalculationType = rs.getString ("CalculationType"); - - bpb._strDayCountCode = rs.getString ("DayCountConv"); - - bpb._dblRedemptionValue = rs.getDouble ("RedemptionValue"); - - if (null == (bpb._dtAnnounce = org.drip.analytics.date.DateUtil.MakeJulianFromRSEntry (rs.getDate - ("AnnounceDate")))) { - System.out.println ("Invalid announce date for ISIN " + DES (bpb)); - - return null; - } - - if (null == (bpb._dtFirstSettle = org.drip.analytics.date.DateUtil.MakeJulianFromRSEntry - (rs.getDate ("FirstSettleDate")))) { - System.out.println ("Invalid first settle date for ISIN " + DES (bpb)); - - return null; - } - - if (null == (bpb._dtFirstCoupon = org.drip.analytics.date.DateUtil.MakeJulianFromRSEntry - (rs.getDate ("FirstCouponDate")))) { - if (m_bBlog) System.out.println ("Invalid first coupon date for ISIN " + DES (bpb)); - } - - if (null == (bpb._dtInterestAccrualStart = org.drip.analytics.date.DateUtil.MakeJulianFromRSEntry - (rs.getDate ("AccrualStartDate")))) { - System.out.println ("Invalid accrual start date for " + DES (bpb)); - - return null; - } - - if (null == (bpb._dtIssue = org.drip.analytics.date.DateUtil.MakeJulianFromRSEntry (rs.getDate - ("IssueDate")))) { - System.out.println ("Invalid issue date for " + DES (bpb)); - - return null; - } - - bpb._bIsCallable = org.drip.quant.common.StringUtil.ParseFromUnitaryString (rs.getString - ("IsCallable")); - - bpb._bIsPutable = org.drip.quant.common.StringUtil.ParseFromUnitaryString (rs.getString - ("IsPutable")); - - bpb._bIsSinkable = org.drip.quant.common.StringUtil.ParseFromUnitaryString (rs.getString - ("IsSinkable")); - - bpb._strRedemptionCurrency = org.drip.analytics.support.Helper.SwitchIRCurve - (rs.getString ("RedemptionCurrency")); - - if (null == bpb._strRedemptionCurrency || bpb._strRedemptionCurrency.isEmpty()) { - System.out.println ("Invalid redemption currency for " + DES (bpb)); - - return null; - } - - bpb._strCouponCurrency = org.drip.analytics.support.Helper.SwitchIRCurve - (rs.getString ("CouponCurrency")); - - if (null == bpb._strCouponCurrency || bpb._strCouponCurrency.isEmpty()) { - System.out.println ("Invalid coupon currency for " + DES (bpb)); - - return null; - } - - bpb._strTradeCurrency = org.drip.analytics.support.Helper.SwitchIRCurve - (rs.getString ("TradeCurrency")); - - if (null == bpb._strTradeCurrency || bpb._strTradeCurrency.isEmpty()) { - System.out.println ("Invalid trade currency for " + DES (bpb)); - - return null; - } - - bpb._bHasBeenCalled = org.drip.quant.common.StringUtil.ParseFromUnitaryString (rs.getString - ("Called")); - - bpb._strFloatCouponConvention = rs.getString ("FloatCouponConvention"); - - bpb._bIsFloater = org.drip.quant.common.StringUtil.ParseFromUnitaryString (rs.getString - ("Floater")); - - // bpb._dblCurrentCoupon = 0.01 * rs.getDouble ("CurrentCoupon"); - - bpb._dtFinalMaturity = org.drip.analytics.date.DateUtil.MakeJulianFromRSEntry (rs.getDate - ("FinalMaturity")); - - bpb._bIsPerpetual = org.drip.quant.common.StringUtil.ParseFromUnitaryString (rs.getString - ("Perpetual")); - - bpb._bIsDefaulted = org.drip.quant.common.StringUtil.ParseFromUnitaryString (rs.getString - ("Defaulted")); - - bpb._dblFloatSpread = 0.0001 * rs.getDouble ("FloatSpread"); - - bpb._strRateIndex = rs.getString ("RateIndex"); - - if (bpb._bIsFloater && !org.drip.quant.common.NumberUtil.IsValid (bpb._dblFloatSpread) && (null == - bpb._strRateIndex || bpb._strRateIndex.isEmpty())) { - System.out.println ("Invalid float spread for " + DES (bpb)); - - return null; - } - - bpb._strIssuerSPN = rs.getString ("SPN"); - - if (!bpb.validate (mpc)) return null; - - if (m_bBlog) System.out.println ("Loaded " + DES (bpb) + "."); - - return bpb; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create BondProductBuilder from the JSON Map and the input MPC - * - * @param mapJSON The JSON Ref Data Map - * @param mpc org.drip.param.definition.MarketParams to help fill some of the fields in - * - * @return BondProductBuilder object - */ - - public static final BondProductBuilder CreateFromJSONMap ( - final org.drip.analytics.support.CaseInsensitiveTreeMap mapJSON, - final org.drip.param.definition.ScenarioMarketParams mpc) - { - /* if (null == mapJSON || 0 == mapJSON.size() || !mapJSON.containsKey ("isin") || !mapJSON.containsKey - ("cusip") || !mapJSON.containsKey ("ticker") || !mapJSON.containsKey ("coupon") || - !mapJSON.containsKey ("maturity") || !mapJSON.containsKey ("frequency") || - !mapJSON.containsKey ("couponType") || !mapJSON.containsKey ("maturityType") || - !mapJSON.containsKey ("calcType") || !mapJSON.containsKey ("dayCount") || - !mapJSON.containsKey ("redempValue") || !mapJSON.containsKey ("redempCrncy") || - !mapJSON.containsKey ("cpnCrncy") || !mapJSON.containsKey ("tradeCrncy") || - !mapJSON.containsKey ("firstCpnDate") || !mapJSON.containsKey - ("issueDate") || !mapJSON.containsKey ("called") || - !mapJSON.containsKey ("defaulted") || !mapJSON.containsKey - ("quotedMargin")) - return null; */ - - BondProductBuilder bpb = new BondProductBuilder(); - - if (null == (bpb._strISIN = mapJSON.get ("isin"))) return null; - - if (null == (bpb._strCUSIP = mapJSON.get ("cusip"))) return null; - - if (null == (bpb._strTicker = mapJSON.get ("ticker"))) return null; - - if (!org.drip.quant.common.NumberUtil.IsValid (bpb._dblCoupon = 0.01 * java.lang.Double.parseDouble - (mapJSON.get ("coupon")))) - return null; - - if (null == (bpb._dtMaturity = org.drip.analytics.date.DateUtil.MakeJulianFromYYYYMMDD - (mapJSON.get ("maturity"), "-"))) - return null; - - bpb._iCouponFreq = java.lang.Integer.parseInt (mapJSON.get ("frequency")); - - bpb._strCouponType = mapJSON.get ("couponType"); - - bpb._strMaturityType = mapJSON.get ("maturityType"); - - bpb._strCalculationType = mapJSON.get ("calcType"); - - bpb._strDayCountCode = mapJSON.get ("dayCount"); - - bpb._dblRedemptionValue = java.lang.Double.parseDouble (mapJSON.get ("redempValue")); - - if (null == (bpb._strRedemptionCurrency = mapJSON.get ("redempCrncy")) || - bpb._strRedemptionCurrency.isEmpty()) { - System.out.println ("Invalid redemption currency for " + DES (bpb)); - - return null; - } - - if (null == (bpb._strCouponCurrency = mapJSON.get ("cpnCrncy")) || bpb._strCouponCurrency.isEmpty()) - { - System.out.println ("Invalid Coupon currency for " + DES (bpb)); - - return null; - } - - if (null == (bpb._strTradeCurrency = mapJSON.get ("tradeCrncy")) || bpb._strTradeCurrency.isEmpty()) - { - System.out.println ("Invalid Trade currency for " + DES (bpb)); - - return null; - } - - if (null == (bpb._dtFirstCoupon = org.drip.analytics.date.DateUtil.MakeJulianFromYYYYMMDD - (mapJSON.get ("firstCpnDate"), "-"))) - return null; - - if (null == (bpb._dtIssue = org.drip.analytics.date.DateUtil.MakeJulianFromYYYYMMDD - (mapJSON.get ("issueDate"), "-"))) - return null; - - try { - bpb._bIsCallable = java.lang.Boolean.parseBoolean (mapJSON.get ("callable")); - - bpb._bIsPutable = java.lang.Boolean.parseBoolean (mapJSON.get ("putable")); - - bpb._bIsSinkable = java.lang.Boolean.parseBoolean (mapJSON.get ("sinkable")); - - bpb._bHasBeenCalled = java.lang.Boolean.parseBoolean (mapJSON.get ("called")); - - // bpb._strFloatCouponConvention = rs.getString ("FloatCouponConvention"); - - bpb._bIsFloater = java.lang.Boolean.parseBoolean (mapJSON.get ("floater")); - - // bpb._dblCurrentCoupon = 0.01 * rs.getDouble ("CurrentCoupon"); - - if (null == (bpb._dtFinalMaturity = org.drip.analytics.date.DateUtil.MakeJulianFromYYYYMMDD - (mapJSON.get ("finalMaturityDt"), "-"))) - return null; - - bpb._bIsPerpetual = java.lang.Boolean.parseBoolean (mapJSON.get ("perpetual")); - - bpb._bIsDefaulted = java.lang.Boolean.parseBoolean (mapJSON.get ("defaulted")); - - // bpb._dblFloatSpread = java.lang.Double.parseDouble (mapJSON.get ("quotedMargin")); - - bpb._strRateIndex = mapJSON.get ("resetIndex"); - - if (bpb._bIsFloater && !org.drip.quant.common.NumberUtil.IsValid (bpb._dblFloatSpread) && (null == - bpb._strRateIndex || bpb._strRateIndex.isEmpty())) { - System.out.println ("Invalid float spread for " + DES (bpb)); - - return null; - } - - // bpb._strIssuerSPN = rs.getString ("SPN"); - - if (!bpb.validate (mpc)) return null; - - if (m_bBlog) System.out.println ("Loaded " + DES (bpb) + "."); - - return bpb; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Empty BondProductBuilder ctr - uninitialized members - */ - - public BondProductBuilder() - { - } - - /** - * Set the Bond ISIN - * - * @param strISIN ISIN input - * - * @return Success (true), failure (false) - */ - - public boolean setISIN ( - final java.lang.String strISIN) - { - if (null == strISIN || strISIN.trim().isEmpty() || "null".equalsIgnoreCase (strISIN.trim())) - return false; - - _strISIN = strISIN; - return true; - } - - /** - * Set the Bond CUSIP - * - * @param strCUSIP CUSIP input - * - * @return Success (true), failure (false) - */ - - public boolean setCUSIP ( - final java.lang.String strCUSIP) - { - if (null == strCUSIP || strCUSIP.trim().isEmpty() || "null".equalsIgnoreCase (strCUSIP.trim())) - return false; - - _strCUSIP = strCUSIP; - return true; - } - - /** - * Set the Bond Ticker - * - * @param strTicker Ticker input - * - * @return Success (true), failure (false) - */ - - public boolean setTicker ( - final java.lang.String strTicker) - { - if (null == (_strTicker = strTicker.trim())) _strTicker = ""; - - return true; - } - - /** - * Set the Bond Coupon - * - * @param strCoupon Coupon input - * - * @return Success (true), failure (false) - */ - - public boolean setCoupon ( - final java.lang.String strCoupon) - { - if (null == strCoupon || strCoupon.trim().isEmpty() || "null".equalsIgnoreCase (strCoupon.trim())) - _dblCoupon = 0.; - - try { - _dblCoupon = new java.lang.Double (strCoupon.trim()).doubleValue(); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) System.out.println ("Bad coupon " + strCoupon + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set the Bond Maturity - * - * @param strMaturity Maturity input - * - * @return Success (true), failure (false) - */ - - public boolean setMaturity ( - final java.lang.String strMaturity) - { - try { - if (null == (_dtMaturity = org.drip.analytics.date.DateUtil.MakeJulianDateFromBBGDate - (strMaturity.trim()))) - return false; - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) System.out.println ("Bad Maturity " + strMaturity + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set the Bond Coupon Frequency - * - * @param strCouponFreq Coupon Frequency input - * - * @return Success (true), failure (false) - */ - - public boolean setCouponFreq ( - final java.lang.String strCouponFreq) - { - if (null == strCouponFreq || strCouponFreq.isEmpty() || "null".equalsIgnoreCase (strCouponFreq)) - _iCouponFreq = 0; - else { - try { - _iCouponFreq = (int) new java.lang.Double (strCouponFreq.trim()).doubleValue(); - } catch (java.lang.Exception e) { - if (m_bBlog) System.out.println ("Bad Cpn Freq " + strCouponFreq + " for ISIN " + _strISIN); - - return false; - } - } - - return true; - } - - /** - * Set the Bond Coupon Type - * - * @param strCouponType Coupon Type input - * - * @return Success (true), failure (false) - */ - - public boolean setCouponType ( - final java.lang.String strCouponType) - { - if (null == (_strCouponType = strCouponType.trim())) _strCouponType = ""; - - return true; - } - - /** - * Set the Bond Maturity Type - * - * @param strMaturityType Maturity Type input - * - * @return Success (true), failure (false) - */ - - public boolean setMaturityType ( - final java.lang.String strMaturityType) - { - if (null == (_strMaturityType = strMaturityType.trim())) _strMaturityType = ""; - - return true; - } - - /** - * Set the Bond Calculation Type - * - * @param strCalculationType Calculation Type input - * - * @return Success (true), failure (false) - */ - - public boolean setCalculationType ( - final java.lang.String strCalculationType) - { - if (null == (_strCalculationType = strCalculationType.trim())) _strCalculationType = ""; - - return true; - } - - /** - * Set the Bond Day Count Code - * - * @param strDayCountCode Day Count Code input - * - * @return Success (true), failure (false) - */ - - public boolean setDayCountCode ( - final java.lang.String strDayCountCode) - { - _strDayCountCode = "Unknown DC"; - - try { - _strDayCountCode = org.drip.analytics.support.Helper.ParseFromBBGDCCode - (strDayCountCode.trim()); - - return true; - } catch (java.lang.Exception e) { - } - - return false; - } - - /** - * Set the Bond Redemption Value - * - * @param strRedemptionValue Redemption Value input - * - * @return Success (true), failure (false) - */ - - public boolean setRedemptionValue ( - final java.lang.String strRedemptionValue) - { - try { - _dblRedemptionValue = new java.lang.Double (strRedemptionValue.trim()); - - return true; - } catch (java.lang.Exception e) { - System.out.println ("Bad Redemption Value " + strRedemptionValue + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set the Bond Announce - * - * @param strAnnounce Announce Date String - * - * @return Success (true), failure (false) - */ - - public boolean setAnnounce ( - final java.lang.String strAnnounce) - { - try { - _dtAnnounce = org.drip.analytics.date.DateUtil.MakeJulianDateFromBBGDate (strAnnounce.trim()); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) System.out.println ("Bad Announce " + strAnnounce + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set the Bond First Settle - * - * @param strFirstSettle First Settle Date String - * - * @return Success (true), failure (false) - */ - - public boolean setFirstSettle ( - final java.lang.String strFirstSettle) - { - try { - _dtFirstSettle = org.drip.analytics.date.DateUtil.MakeJulianDateFromBBGDate - (strFirstSettle.trim()); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) System.out.println ("Bad First Settle " + strFirstSettle + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set the Bond First Coupon Date - * - * @param strFirstCoupon First Coupon Date String - * - * @return Success (true), failure (false) - */ - - public boolean setFirstCoupon ( - final java.lang.String strFirstCoupon) - { - try { - _dtFirstCoupon = org.drip.analytics.date.DateUtil.MakeJulianDateFromBBGDate - (strFirstCoupon.trim()); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) System.out.println ("Bad First Coupon " + strFirstCoupon + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set the Bond Interest Accrual Start Date - * - * @param strInterestAccrualStart Interest Accrual Start Date String - * - * @return Success (true), failure (false) - */ - - public boolean setInterestAccrualStart ( - final java.lang.String strInterestAccrualStart) - { - try { - _dtInterestAccrualStart = org.drip.analytics.date.DateUtil.MakeJulianDateFromBBGDate - (strInterestAccrualStart.trim()); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) - System.out.println ("Bad Announce " + strInterestAccrualStart + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set the Bond Issue Date - * - * @param strIssue Issue Date String - * - * @return Success (true), failure (false) - */ - - public boolean setIssue ( - final java.lang.String strIssue) - { - try { - _dtIssue = org.drip.analytics.date.DateUtil.MakeJulianDateFromBBGDate (strIssue.trim()); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) System.out.println ("Bad Issue " + strIssue + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set whether the Bond Is Callable - * - * @param strCallable Callable String - * - * @return Success (true), failure (false) - */ - - public boolean setIsCallable ( - final java.lang.String strCallable) - { - if (null == strCallable) _bIsCallable = false; - - if ("1".equalsIgnoreCase (strCallable.trim())) - _bIsCallable = true; - else - _bIsCallable = false; - - return true; - } - - /** - * Set whether the Bond Is Putable - * - * @param strPutable Putable String - * - * @return Success (true), failure (false) - */ - - public boolean setIsPutable ( - final java.lang.String strPutable) - { - if (null == strPutable) _bIsPutable = false; - - if ("1".equalsIgnoreCase (strPutable.trim())) - _bIsPutable = true; - else - _bIsPutable = false; - - return true; - } - - /** - * Set whether the Bond Is Sinkable - * - * @param strSinkable Sinkable String - * - * @return Success (true), failure (false) - */ - - public boolean setIsSinkable ( - final java.lang.String strSinkable) - { - if (null == strSinkable) _bIsSinkable = false; - - if ("1".equalsIgnoreCase (strSinkable.trim())) - _bIsSinkable = true; - else - _bIsSinkable = false; - - return true; - } - - /** - * Set The redemption Currency - * - * @param strRedemptionCurrency Redemption Currency String - * - * @return Success (true), failure (false) - */ - - public boolean setRedemptionCurrency ( - final java.lang.String strRedemptionCurrency) - { - if (null == (_strRedemptionCurrency = strRedemptionCurrency.trim()) || "null".equalsIgnoreCase - (strRedemptionCurrency.trim())) - return false; - - return true; - } - - /** - * Set The Coupon Currency - * - * @param strCouponCurrency Coupon Currency String - * - * @return Success (true), failure (false) - */ - - public boolean setCouponCurrency ( - final java.lang.String strCouponCurrency) - { - if (null == (_strCouponCurrency = strCouponCurrency.trim()) || "null".equalsIgnoreCase - (strCouponCurrency.trim())) - return false; - - return true; - } - - /** - * Set The Trade Currency - * - * @param strTradeCurrency Trade Currency String - * - * @return Success (true), failure (false) - */ - - public boolean setTradeCurrency ( - final java.lang.String strTradeCurrency) - { - if (null == (_strTradeCurrency = strTradeCurrency.trim()) || "null".equalsIgnoreCase - (strTradeCurrency.trim())) - return false; - - return true; - } - - /** - * Set whether the bond Has Been Called - * - * @param strHasBeenCalled Has Been Called String - * - * @return Success (true), failure (false) - */ - - public boolean setHasBeenCalled ( - final java.lang.String strHasBeenCalled) - { - if (null == strHasBeenCalled) _bHasBeenCalled = false; - - if ("1".equalsIgnoreCase (strHasBeenCalled.trim())) - _bHasBeenCalled = true; - else - _bHasBeenCalled = false; - - return true; - } - - /** - * Set the bond's Float Coupon Convention - * - * @param strFloatCouponConvention Float Coupon Convention String - * - * @return Success (true), failure (false) - */ - - public boolean setFloatCouponConvention ( - final java.lang.String strFloatCouponConvention) - { - if (null == (_strFloatCouponConvention = strFloatCouponConvention.trim())) - _strFloatCouponConvention = ""; - - return true; - } - - /** - * Set the bond's Current Coupon - * - * @param strCurrentCoupon Current Coupon String - * - * @return Success (true), failure (false) - */ - - public boolean setCurrentCoupon ( - final java.lang.String strCurrentCoupon) - { - if (null == strCurrentCoupon || strCurrentCoupon.trim().isEmpty() || "null".equalsIgnoreCase - (strCurrentCoupon.trim())) - _dblCurrentCoupon = 0.; - else { - try { - _dblCurrentCoupon = new java.lang.Double (strCurrentCoupon.trim()).doubleValue(); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) - System.out.println ("Bad Curr Cpn " + strCurrentCoupon + " for ISIN " + _strISIN); - } - } - - return false; - } - - /** - * Set whether the bond is a floater or not - * - * @param strIsFloater String indicating whether the bond is a floater - * - * @return Success (true), failure (false) - */ - - public boolean setIsFloater ( - final java.lang.String strIsFloater) - { - if (null == strIsFloater) _bIsFloater = false; - - if ("1".equalsIgnoreCase (strIsFloater.trim())) - _bIsFloater = true; - else - _bIsFloater = false; - - return true; - } - - /** - * Set the final maturity of the bond - * - * @param strFinalMaturity String representing the bond's final maturity - * - * @return Success (true), failure (false) - */ - - public boolean setFinalMaturity ( - final java.lang.String strFinalMaturity) - { - try { - _dtFinalMaturity = org.drip.analytics.date.DateUtil.MakeJulianDateFromBBGDate - (strFinalMaturity.trim()); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) - System.out.println ("Bad Final Maturity " + strFinalMaturity + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set whether the bond is perpetual or not - * - * @param strIsPerpetual String representing whether the bond is perpetual or not - * - * @return Success (true), failure (false) - */ - - public boolean setIsPerpetual ( - final java.lang.String strIsPerpetual) - { - if (null == strIsPerpetual) _bIsPerpetual = false; - - if ("1".equalsIgnoreCase (strIsPerpetual.trim())) - _bIsPerpetual = true; - else - _bIsPerpetual = false; - - return true; - } - - /** - * Set whether the bond is defaulted or not - * - * @param strIsDefaulted String representing whether the bond is defaulted or not - * - * @return Success (true), failure (false) - */ - - public boolean setIsDefaulted ( - final java.lang.String strIsDefaulted) - { - if (null == strIsDefaulted) _bIsDefaulted = false; - - if ("1".equalsIgnoreCase (strIsDefaulted.trim())) - _bIsDefaulted = true; - else - _bIsDefaulted = false; - - return true; - } - - /** - * Set the bond's floating rate spread - * - * @param strFloatSpread String representing the bond's floating spread - * - * @return Success (true), failure (false) - */ - - public boolean setFloatSpread ( - final java.lang.String strFloatSpread) - { - try { - _dblFloatSpread = new java.lang.Double (strFloatSpread.trim()); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) System.out.println ("Bad Float Spread " + strFloatSpread + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set the bond's floating rate spread from the MPC - * - * @param mpc org.drip.param.definition.MarketParams - * - * @return Success (true), failure (false) - */ - - public boolean setFloatSpread ( - final org.drip.param.definition.ScenarioMarketParams mpc) - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblCurrentCoupon)) { - System.out.println ("Curr cpn for ISIN " + _strISIN + " is NaN!"); - - return false; - } - - if (null == mpc || null == mpc.scenarioDiscountCurveMap() || null == mpc.scenarioDiscountCurveMap().get (_strCouponCurrency) || - null == mpc.scenarioDiscountCurveMap().get (_strCouponCurrency).base()) { - if (m_bBlog) System.out.println ("Bad mpc In for ISIN " + _strISIN); - - return false; - } - - try { - if (0. != _dblCurrentCoupon) { - org.drip.state.discount.MergedDiscountForwardCurve dcBase = mpc.scenarioDiscountCurveMap().get (_strCouponCurrency).base(); - - _dblFloatSpread = _dblCurrentCoupon - 100. * dcBase.libor (dcBase.epoch().julian(), - (org.drip.analytics.support.Helper.GetTenorFromFreq (_iCouponFreq))); - } else - _dblFloatSpread = 0.; - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) e.printStackTrace(); - } - - return false; - } - - /** - * Set the bond's Rate Index - * - * @param strRateIndex Rate Index - * - * @return Success (true), failure (false) - */ - - public boolean setRateIndex ( - final java.lang.String strRateIndex) - { - if (null == (_strRateIndex = strRateIndex)) _strRateIndex = ""; - - return true; - } - - /** - * Set the bond's Issuer SPN - * - * @param strIssuerSPN Issuer SPN String - * - * @return Success (true), failure (false) - */ - - public boolean setIssuerSPN ( - final java.lang.String strIssuerSPN) - { - if (null == (_strIssuerSPN = strIssuerSPN)) _strIssuerSPN = ""; - - return true; - } - - /** - * Validate the state - * - * @param mpc org.drip.param.definition.MarketParams - * - * @return Success (true), failure (false) - */ - - public boolean validate ( - final org.drip.param.definition.ScenarioMarketParams mpc) - { - if (null == _strISIN || _strISIN.isEmpty() || null == _strCUSIP || _strCUSIP.isEmpty()) { - if (m_bDisplayWarnings) - System.out.println ("Check ISIN[" + _strISIN + "] or CUSIP[" + _strCUSIP + "]"); - - return false; - } - - if (0 == _iCouponFreq && 0. != _dblCoupon) { - if (m_bDisplayWarnings) - System.out.println ("Coupon Freq and Cpn amt both not sero for ISIN[" + _strISIN + "]"); - - return false; - } - - if (49 == _iCouponFreq || 52 == _iCouponFreq) { - if (m_bDisplayWarnings) - System.out.println ("ISIN[" + _strISIN + "] has cpn freq of " + _iCouponFreq + "!"); - - return false; - } - - if (null == _dtInterestAccrualStart) { - if (null == (_dtInterestAccrualStart = reconcileStartDate())) { - if (m_bDisplayWarnings) - System.out.println ("All possible date init candidates are null for ISIN " + _strISIN); - - return false; - } - } - - if (_bIsFloater && (null == _strRateIndex || _strRateIndex.isEmpty()) && - !org.drip.quant.common.NumberUtil.IsValid (_dblFloatSpread) && java.lang.Double.isNaN - (_dblCurrentCoupon)) { - if (m_bDisplayWarnings) - System.out.println ("Invalid Rate index & float spread & current coupon for " + _strISIN); - - return false; - } - - if (_bIsFloater && (null == _strRateIndex || _strRateIndex.isEmpty())) { - if (null == (_strRateIndex = org.drip.analytics.support.Helper.CalcRateIndex - (_strCouponCurrency, _iCouponFreq))) { - if (m_bDisplayWarnings) - System.out.println ("Warning: Cannot find Rate index for ISIN " + _strISIN); - } - } - - if (_bIsFloater && !org.drip.quant.common.NumberUtil.IsValid (_dblFloatSpread)) { - try { - if (!setFloatSpread (mpc)) { - if (m_bDisplayWarnings) - System.out.println ("Warning: Cannot set float spread for ISIN " + _strISIN + - " and Coupon Currency " + _strCouponCurrency); - } - } catch (java.lang.Exception e) { - if (m_bDisplayWarnings) - System.out.println ("Warning: Cannot set float spread for ISIN " + _strISIN + - " and Coupon Currency " + _strCouponCurrency); - - e.printStackTrace(); - } - } - - if (null == _dtIssue) _dtIssue = reconcileStartDate(); - - if (null == _dtFirstSettle) _dtFirstSettle = reconcileStartDate(); - - if (null == _dtAnnounce) _dtAnnounce = reconcileStartDate(); - - return true; - } - - /** - * Create an SQL Insert statement from the object's state - * - * @return String representing the SQL Insert - */ - - public java.lang.String makeSQLInsert() - { - java.lang.StringBuilder sb = new java.lang.StringBuilder(); - - sb.append ("insert into BondValData values("); - - sb.append ("'").append (_strISIN).append ("', "); - - sb.append ("'").append (_strCUSIP).append ("', "); - - sb.append ("'").append (_strTicker).append ("', "); - - sb.append (_dblCoupon).append (", "); - - sb.append ("'").append (_dtMaturity.toOracleDate()).append ("', "); - - sb.append (_iCouponFreq).append (", "); - - sb.append ("'").append (_strCouponType).append ("', "); - - sb.append ("'").append (_strMaturityType).append ("', "); - - sb.append ("'").append (_strCalculationType).append ("', "); - - sb.append ("'").append (_strDayCountCode).append ("', "); - - sb.append (_dblRedemptionValue).append (", "); - - sb.append ("'").append (_dtAnnounce.toOracleDate()).append ("', "); - - sb.append ("'").append (_dtFirstSettle.toOracleDate()).append ("', "); - - if (null == _dtFirstCoupon) - sb.append ("null, "); - else - sb.append ("'").append (_dtFirstCoupon.toOracleDate()).append ("', "); - - sb.append ("'").append (_dtInterestAccrualStart.toOracleDate()).append ("', "); - - sb.append ("'").append (_dtIssue.toOracleDate()).append ("', "); - - sb.append ("'").append (_bIsCallable ? 1 : 0).append ("', "); - - sb.append ("'").append (_bIsPutable ? 1 : 0).append ("', "); - - sb.append ("'").append (_bIsSinkable ? 1 : 0).append ("', "); - - sb.append ("'").append (_strRedemptionCurrency).append ("', "); - - sb.append ("'").append (_strCouponCurrency).append ("', "); - - sb.append ("'").append (_strTradeCurrency).append ("', "); - - sb.append ("'").append (_bHasBeenCalled ? 1 : 0).append ("', "); - - sb.append ("'").append (_strFloatCouponConvention).append ("', "); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblCurrentCoupon)) - sb.append ("null, "); - else - sb.append (_dblCurrentCoupon).append (", "); - - sb.append ("'").append (_bIsFloater ? 1 : 0).append ("', "); - - if (null == _dtFinalMaturity) - sb.append ("null, "); - else - sb.append ("'").append (_dtFinalMaturity.toOracleDate()).append ("', "); - - sb.append ("'").append (_bIsPerpetual ? 1 : 0).append ("', "); - - sb.append ("'").append (_bIsDefaulted ? 1 : 0).append ("', "); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblFloatSpread)) - sb.append ("null, "); - else - sb.append (_dblFloatSpread).append (", "); - - sb.append ("'").append (_strRateIndex).append ("', "); - - sb.append ("'").append (_strIssuerSPN).append ("')"); - - return sb.toString(); - } - - /** - * Get the Bond's identifier Parameters - * - * @return BondIdentifierParams object - */ - - public org.drip.product.params.IdentifierSet getIdentifierParams() - { - org.drip.product.params.IdentifierSet idParams = new org.drip.product.params.IdentifierSet (_strISIN, - _strCUSIP, _strISIN, _strTicker); - - return idParams.validate() ? idParams : null; - } - - /** - * Get the Bond's Coupon Parameters - * - * @return BondCouponParams object - */ - - public org.drip.product.params.CouponSetting getCouponParams() - { - org.drip.product.params.CouponSetting cpnParams = new org.drip.product.params.CouponSetting - (null, _strCouponType, _dblCoupon, java.lang.Double.NaN, java.lang.Double.NaN); - - return cpnParams.validate() ? cpnParams : null; - } - - /** - * Get the Bond's Floater Parameters - * - * @return BondFloaterParams object - */ - - public org.drip.product.params.FloaterSetting getFloaterParams() - { - if (!_bIsFloater) return null; - - org.drip.product.params.FloaterSetting fltParams = new org.drip.product.params.FloaterSetting - (_strRateIndex, _strFloatCouponConvention, _dblFloatSpread, _dblCurrentCoupon); - - return fltParams.validate() ? fltParams : null; - } - - /** - * Get the Bond's Market Convention - * - * @return MarketConvention object - */ - - public org.drip.product.params.QuoteConvention getMarketConvention() - { - org.drip.product.params.QuoteConvention mktConv = new org.drip.product.params.QuoteConvention (null, - _strCalculationType, _dtFirstSettle.julian(), _dblRedemptionValue, 0, "", - org.drip.analytics.daycount.Convention.DATE_ROLL_ACTUAL); - - return mktConv.validate() ? mktConv : null; - } - - /** - * Get the Bond's Credit Component Parameters - * - * @return CompCRValParams object - */ - - public org.drip.product.params.CreditSetting getCRValuationParams() - { - org.drip.product.params.CreditSetting crValParams = new org.drip.product.params.CreditSetting (30, - java.lang.Double.NaN, true, "", true); - - return crValParams.validate() ? crValParams : null; - } - - /** - * Get the Bond's CF termination event Parameters - * - * @return BondCFTerminationEvent object - */ - - public org.drip.product.params.TerminationSetting getCFTEParams() - { - org.drip.product.params.TerminationSetting cfteParams = new - org.drip.product.params.TerminationSetting (_bIsPerpetual, _bIsDefaulted, _bHasBeenCalled); - - return cfteParams.validate() ? cfteParams : null; - } - - /** - * Get the Bond's Notional Parameters - * - * @return BondNotionalParams object - */ - - public org.drip.product.params.NotionalSetting getNotionalParams() - { - org.drip.product.params.NotionalSetting notlParams = new org.drip.product.params.NotionalSetting - (100., _strRedemptionCurrency, null, - org.drip.product.params.NotionalSetting.PERIOD_AMORT_AT_START, false); - - return notlParams.validate() ? notlParams : null; - } - - /** - * Get the Bond's Period Generation Parameters - * - * @return BondPeriodGenerationParams object - */ - - public org.drip.product.params.BondStream getPeriodGenParams() - { - return org.drip.product.params.BondStream.Create (_dtMaturity.julian(), - _dtInterestAccrualStart.julian(), null == _dtFinalMaturity ? java.lang.Integer.MIN_VALUE : - _dtFinalMaturity.julian(), null == _dtFirstCoupon ? java.lang.Integer.MIN_VALUE : - _dtFirstCoupon.julian(), _dtInterestAccrualStart.julian(), _iCouponFreq, - _dblCurrentCoupon, _strDayCountCode, _strDayCountCode, null, null, null, null, null, - null, null, null, _strMaturityType, false, _strCouponCurrency, - _strCouponCurrency, !org.drip.quant.common.StringUtil.IsEmpty (_strRateIndex) - ? org.drip.state.identifier.ForwardLabel.Standard (_strRateIndex) : null, - !org.drip.quant.common.StringUtil.IsEmpty (_strIssuerSPN) ? - org.drip.state.identifier.CreditLabel.Standard (_strIssuerSPN) : - null); - } - - /** - * Create an SQL Delete statement from the object's state - * - * @return String representing the SQL Delete - */ - - public java.lang.String makeSQLDelete() - { - java.lang.StringBuilder sb = new java.lang.StringBuilder(); - - sb.append ("delete from BondValData where ISIN = '").append (_strISIN).append - ("' or CUSIP = '").append (_strCUSIP).append ("'"); - - return sb.toString(); - } -} diff --git a/org/drip/product/creator/BondRefDataBuilder.java b/org/drip/product/creator/BondRefDataBuilder.java deleted file mode 100644 index 0c0d04b..0000000 --- a/org/drip/product/creator/BondRefDataBuilder.java +++ /dev/null @@ -1,3000 +0,0 @@ - -package org.drip.product.creator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * BondRefDataBuilder holds the entire set of static parameters for the bond product. In particular, it contains - * the bond identifier parameters (ISIN, CUSIP, BBG ID, name short name), the issuer level parameters - * (Ticker, category, industry, issue type, issuer country, issuer country code, collateral type, - * description, security type, unique Bloomberg ID, long company name, issuer name, SPN or the credit - * curve string), issue parameters (issue amount, issue price, outstanding amount, minimum piece, - * minimum increment, par amount, lead manager, exchange code, country of incorporation, country of - * guarantor, country of domicile, industry sector, industry group, industry sub-group, senior/sub), - * coupon parameters (coupon rate, coupon frequency, coupon type, day count), maturity parameters - * (maturity date, maturity type, final maturity, redemption value), date parameters (announce, first - * settle, first coupon, interest accrual start, next coupon, previous coupon, penultimate coupon, and - * issue dates), embedded option parameters (callable, putable, has been exercised), currency parameters - * (trade, coupon, and redemption currencies), floater parameters (floater flag, floating coupon - * convention, current coupon, rate index, spread), trade status, ratings (SnP, Moody, and Fitch), and - * whether the bond is private placement, is registered, is a bearer bond, is reverse convertible, is a - * structured note, can be unit traded, is perpetual or has defaulted. - * - * @author Lakshmi Krishnamurthy - */ - -public class BondRefDataBuilder implements org.drip.product.params.Validatable { - private static final boolean m_bBlog = false; - private static final boolean m_bDisplayWarnings = true; - - /** - * ISIN - */ - - public java.lang.String _strISIN = ""; - - /** - * CUSIP - */ - - public java.lang.String _strCUSIP = ""; - - /** - * Bloomberg ID - */ - - public java.lang.String _strBBGID = ""; - - /** - * Issuer Category - */ - - public java.lang.String _strIssuerCategory = ""; - - /** - * Ticker - */ - - public java.lang.String _strTicker = ""; - - /** - * Series - */ - - public java.lang.String _strSeries = ""; - - /** - * Name - */ - - public java.lang.String _strName = ""; - - /** - * Short Name - */ - - public java.lang.String _strShortName = ""; - - /** - * Issuer Industry - */ - - public java.lang.String _strIssuerIndustry = ""; - - /** - * Coupon Type - */ - - public java.lang.String _strCouponType = ""; - - /** - * Maturity Type - */ - - public java.lang.String _strMaturityType = ""; - - /** - * Calculation Type - */ - - public java.lang.String _strCalculationType = ""; - - /** - * Day Count Code - */ - - public java.lang.String _strDayCountCode = ""; - - /** - * Market Issue Type - */ - - public java.lang.String _strMarketIssueType = ""; - - /** - * Issue Country Code - */ - - public java.lang.String _strIssueCountryCode = ""; - - /** - * Issue Country - */ - - public java.lang.String _strIssueCountry = ""; - - /** - * Collateral Type - */ - - public java.lang.String _strCollateralType = ""; - - /** - * Issue Amount - */ - - public double _dblIssueAmount = java.lang.Double.NaN; - - /** - * Outstanding Amount - */ - - public double _dblOutstandingAmount = java.lang.Double.NaN; - - /** - * Minimum Piece - */ - - public double _dblMinimumPiece = java.lang.Double.NaN; - - /** - * Minimum Increment - */ - - public double _dblMinimumIncrement = java.lang.Double.NaN; - - /** - * Par Amount - */ - - public double _dblParAmount = java.lang.Double.NaN; - - /** - * Lead Manager - */ - - public java.lang.String _strLeadManager = ""; - - /** - * Exchange Code - */ - - public java.lang.String _strExchangeCode = ""; - - /** - * Redemption Value - */ - - public double _dblRedemptionValue = java.lang.Double.NaN; - - /** - * Announce Date - */ - - public org.drip.analytics.date.JulianDate _dtAnnounce = null; - - /** - * First Settle Date - */ - - public org.drip.analytics.date.JulianDate _dtFirstSettle = null; - - /** - * First Coupon Date - */ - - public org.drip.analytics.date.JulianDate _dtFirstCoupon = null; - - /** - * Interest Accrual Start Date - */ - - public org.drip.analytics.date.JulianDate _dtInterestAccrualStart = null; - - /** - * Issue Date - */ - - public org.drip.analytics.date.JulianDate _dtIssue = null; - - /** - * Next Coupon Date - */ - - public org.drip.analytics.date.JulianDate _dtNextCouponDate = null; - - /** - * Callable flag - */ - - public boolean _bIsCallable = false; - - /** - * Putable flag - */ - - public boolean _bIsPutable = false; - - /** - * Sinkable flag - */ - - public boolean _bIsSinkable = false; - - /** - * Bloomberg Parent - */ - - public java.lang.String _strBBGParent = ""; - - /** - * Country of Incorporation - */ - - public java.lang.String _strCountryOfIncorporation = ""; - - /** - * Industry Sector - */ - - public java.lang.String _strIndustrySector = ""; - - /** - * Industry Group - */ - - public java.lang.String _strIndustryGroup = ""; - - /** - * Industry Sub Group - */ - - public java.lang.String _strIndustrySubgroup = ""; - - /** - * Country of Guarantor - */ - - public java.lang.String _strCountryOfGuarantor = ""; - - /** - * Country of Domicile - */ - - public java.lang.String _strCountryOfDomicile = ""; - - /** - * Description - */ - - public java.lang.String _strDescription = ""; - - /** - * Security Type - */ - - public java.lang.String _strSecurityType = ""; - - /** - * Previous Coupon Date - */ - - public org.drip.analytics.date.JulianDate _dtPrevCouponDate = null; - - /** - * Unique Bloomberg ID - */ - - public java.lang.String _strBBGUniqueID = ""; - - /** - * Long Company Name - */ - - public java.lang.String _strLongCompanyName = ""; - - /** - * Flag indicating Structured Note - */ - - public boolean _bIsStructuredNote = false; - - /** - * Flag indicating whether unit traded - */ - - public boolean _bIsUnitTraded = false; - - /** - * Flag indicating is reverse convertible - */ - - public boolean _bIsReversibleConvertible = false; - - /** - * Redemption Currency - */ - - public java.lang.String _strRedemptionCurrency = ""; - - /** - * Coupon Currency - */ - - public java.lang.String _strCouponCurrency = ""; - - /** - * Trade Currency - */ - - public java.lang.String _strTradeCurrency = ""; - - /** - * Is this a Bearer Bond - */ - - public boolean _bIsBearer = false; - - /** - * Is this registered - */ - - public boolean _bIsRegistered = false; - - /** - * Has this been called - */ - - public boolean _bHasBeenCalled = false; - - /** - * Issuer Name - */ - - public java.lang.String _strIssuer = ""; - - /** - * Penultimate Coupon Date - */ - - public org.drip.analytics.date.JulianDate _dtPenultimateCouponDate = null; - - /** - * Float Coupon Convention - */ - - public java.lang.String _strFloatCouponConvention = ""; - - /** - * Current Coupon - */ - - public double _dblCurrentCoupon = java.lang.Double.NaN; - - /** - * Is this bond a floater - */ - - public boolean _bIsFloater = false; - - /** - * Trade Status - */ - - public boolean _bTradeStatus = false; - - /** - * CDR Country Code - */ - - public java.lang.String _strCDRCountryCode = ""; - - /** - * CDR Settle Code - */ - - public java.lang.String _strCDRSettleCode = ""; - - /** - * Final Maturity Date - */ - - public org.drip.analytics.date.JulianDate _dtFinalMaturity = null; - - /** - * Is this a private placement - */ - - public boolean _bIsPrivatePlacement = false; - - /** - * Is this bond perpetual - */ - - public boolean _bIsPerpetual = false; - - /** - * Has this bond defaulted - */ - - public boolean _bIsDefaulted = false; - - /** - * Spread over the floater index for this bond - */ - - public double _dblFloatSpread = java.lang.Double.NaN; - - /** - * Floating rate index - */ - - public java.lang.String _strRateIndex = ""; - - /** - * Moody's Rating - */ - - public java.lang.String _strMoody = ""; - - /** - * SnP rating - */ - - public java.lang.String _strSnP = ""; - - /** - * Fitch Rating - */ - - public java.lang.String _strFitch = ""; - - /** - * Senior or Sub-ordinate - */ - - public java.lang.String _strSnrSub = ""; - - /** - * Issuer SPN - */ - - public java.lang.String _strIssuerSPN = ""; - - /** - * Issue Price - */ - - public double _dblIssuePrice = java.lang.Double.NaN; - - /** - * Coupon - */ - - public double _dblCoupon = java.lang.Double.NaN; - - /** - * Maturity - */ - - public org.drip.analytics.date.JulianDate _dtMaturity = null; - - private org.drip.analytics.date.JulianDate reconcileStartDate() - { - if (null != _dtInterestAccrualStart) return _dtInterestAccrualStart; - - if (null != _dtFirstCoupon) return _dtFirstCoupon; - - if (null != _dtIssue) return _dtIssue; - - if (null != _dtFirstSettle) return _dtFirstSettle; - - return _dtAnnounce; - } - - /** - * Create BondRefDataBuilder object from java ResultSet SQL - * - * @param rs SQL ResultSet - * - * @return BondRefDataBuilder object - */ - - public static final BondRefDataBuilder CreateFromResultSet ( - final java.sql.ResultSet rs) - { - try { - BondRefDataBuilder brdb = new BondRefDataBuilder(); - - if (null == (brdb._strISIN = rs.getString ("ISIN"))) return null; - - if (null == (brdb._strCUSIP = rs.getString ("CUSIP"))) return null; - - brdb._strBBGID = rs.getString ("BBG_ID"); - - brdb._strIssuerCategory = rs.getString ("IssuerCategory"); - - brdb._strTicker = rs.getString ("Ticker"); - - if (!org.drip.quant.common.NumberUtil.IsValid (brdb._dblCoupon = rs.getDouble ("Coupon"))) - return null; - - brdb._dtMaturity = org.drip.analytics.date.DateUtil.MakeJulianFromRSEntry (rs.getDate - ("Maturity")); - - brdb._strSeries = rs.getString ("Series"); - - brdb._strName = rs.getString ("Name"); - - brdb._strShortName = rs.getString ("ShortName"); - - brdb._strIssuerIndustry = rs.getString ("IssuerIndustry"); - - brdb._strCouponType = rs.getString ("CouponType"); - - brdb._strMaturityType = rs.getString ("MaturityType"); - - brdb._strCalculationType = rs.getString ("CalculationType"); - - brdb._strDayCountCode = rs.getString ("DayCountConv"); - - brdb._strMarketIssueType = rs.getString ("MarketIssueType"); - - brdb._strIssueCountryCode = rs.getString ("IssueCountryCode"); - - brdb._strIssueCountry = rs.getString ("IssueCountry"); - - brdb._strCollateralType = rs.getString ("CollateralType"); - - brdb._dblIssueAmount = rs.getDouble ("IssueAmount"); - - brdb._dblOutstandingAmount = rs.getDouble ("OutstandingAmount"); - - brdb._dblMinimumPiece = rs.getDouble ("MinimumPiece"); - - brdb._dblMinimumIncrement = rs.getDouble ("MinimumIncrement"); - - brdb._dblParAmount = rs.getDouble ("ParAmount"); - - brdb._strLeadManager = rs.getString ("LeadManager"); - - brdb._strExchangeCode = rs.getString ("ExchangeCode"); - - brdb._dblRedemptionValue = rs.getDouble ("RedemptionValue"); - - brdb._dtNextCouponDate = org.drip.analytics.date.DateUtil.MakeJulianFromRSEntry (rs.getDate - ("NextCouponDate")); - - if (null == (brdb._dtAnnounce = org.drip.analytics.date.DateUtil.MakeJulianFromRSEntry - (rs.getDate ("AnnounceDate")))) - return null; - - if (null == (brdb._dtFirstSettle = org.drip.analytics.date.DateUtil.MakeJulianFromRSEntry - (rs.getDate ("FirstSettleDate")))) - return null; - - if (null == (brdb._dtFirstCoupon = org.drip.analytics.date.DateUtil.MakeJulianFromRSEntry - (rs.getDate ("FirstCouponDate")))) - return null; - - if (null == (brdb._dtInterestAccrualStart = - org.drip.analytics.date.DateUtil.MakeJulianFromRSEntry (rs.getDate ("AccrualStartDate")))) - return null; - - if (null == (brdb._dtIssue = org.drip.analytics.date.DateUtil.MakeJulianFromRSEntry (rs.getDate - ("IssueDate")))) - return null; - - brdb._bIsCallable = org.drip.quant.common.StringUtil.ParseFromUnitaryString (rs.getString - ("IsCallable")); - - brdb._bIsPutable = org.drip.quant.common.StringUtil.ParseFromUnitaryString (rs.getString - ("IsPutable")); - - brdb._bIsSinkable = org.drip.quant.common.StringUtil.ParseFromUnitaryString (rs.getString - ("IsSinkable")); - - brdb._strBBGParent = rs.getString ("BBGParent"); - - brdb._strCountryOfIncorporation = rs.getString ("CountryOfIncorporation"); - - brdb._strIndustrySector = rs.getString ("IndustrySector"); - - brdb._strIndustryGroup = rs.getString ("IndustryGroup"); - - brdb._strIndustrySubgroup = rs.getString ("IndustrySubgroup"); - - brdb._strCountryOfGuarantor = rs.getString ("CountryOfGuarantor"); - - brdb._strCountryOfDomicile = rs.getString ("CountryOfDomicile"); - - brdb._strDescription = rs.getString ("Description"); - - brdb._strSecurityType = rs.getString ("SecurityType"); - - brdb._dtPrevCouponDate = org.drip.analytics.date.DateUtil.MakeJulianFromRSEntry (rs.getDate - ("PrevCouponDate")); - - brdb._strBBGUniqueID = rs.getString ("BBUniqueID"); - - brdb._strLongCompanyName = rs.getString ("LongCompanyName"); - - brdb._strRedemptionCurrency = rs.getString ("RedemptionCurrency"); - - if (null == brdb._strRedemptionCurrency || brdb._strRedemptionCurrency.isEmpty()) return null; - - brdb._strCouponCurrency = rs.getString ("CouponCurrency"); - - if (null == brdb._strCouponCurrency || brdb._strCouponCurrency.isEmpty()) return null; - - brdb._bIsStructuredNote = org.drip.quant.common.StringUtil.ParseFromUnitaryString (rs.getString - ("StructuredNote")); - - brdb._bIsUnitTraded = org.drip.quant.common.StringUtil.ParseFromUnitaryString (rs.getString - ("UnitTraded")); - - brdb._bIsReversibleConvertible = org.drip.quant.common.StringUtil.ParseFromUnitaryString - (rs.getString ("ReverseConvertible")); - - brdb._strTradeCurrency = rs.getString ("TradeCurrency"); - - if (null == brdb._strTradeCurrency || brdb._strTradeCurrency.isEmpty()) return null; - - brdb._bIsBearer = org.drip.quant.common.StringUtil.ParseFromUnitaryString (rs.getString - ("Bearer")); - - brdb._bIsRegistered = org.drip.quant.common.StringUtil.ParseFromUnitaryString (rs.getString - ("Registered")); - - brdb._bHasBeenCalled = org.drip.quant.common.StringUtil.ParseFromUnitaryString (rs.getString - ("Called")); - - brdb._strIssuer = rs.getString ("Issuer"); - - brdb._dtPenultimateCouponDate = org.drip.analytics.date.DateUtil.MakeJulianFromRSEntry - (rs.getDate ("PenultimateCouponDate")); - - brdb._strFloatCouponConvention = rs.getString ("FloatCouponConvention"); - - brdb._dblCurrentCoupon = rs.getDouble ("CurrentCoupon"); - - brdb._bIsFloater = org.drip.quant.common.StringUtil.ParseFromUnitaryString (rs.getString - ("Floater")); - - brdb._bTradeStatus = org.drip.quant.common.StringUtil.ParseFromUnitaryString (rs.getString - ("TradeStatus")); - - brdb._strCDRCountryCode = rs.getString ("CDRCountryCode"); - - brdb._strCDRSettleCode = rs.getString ("CDRSettleCode"); - - brdb._strFloatCouponConvention = rs.getString ("FloatCouponConvention"); - - brdb._dtFinalMaturity = org.drip.analytics.date.DateUtil.MakeJulianFromRSEntry (rs.getDate - ("FinalMaturity")); - - brdb._bIsPrivatePlacement = org.drip.quant.common.StringUtil.ParseFromUnitaryString (rs.getString - ("PrivatePlacement")); - - brdb._bIsPerpetual = org.drip.quant.common.StringUtil.ParseFromUnitaryString (rs.getString - ("Perpetual")); - - brdb._bIsDefaulted = org.drip.quant.common.StringUtil.ParseFromUnitaryString (rs.getString - ("Defaulted")); - - brdb._dblFloatSpread = rs.getDouble ("FloatSpread"); - - brdb._strRateIndex = rs.getString ("RateIndex"); - - brdb._strMoody = rs.getString ("Moody"); - - brdb._strSnP = rs.getString ("SnP"); - - brdb._strFitch = rs.getString ("Fitch"); - - brdb._strSnrSub = rs.getString ("SnrSub"); - - brdb._strIssuerSPN = rs.getString ("SPN"); - - brdb._dblIssuePrice = rs.getDouble ("IssuePrice"); - - return brdb; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Empty BondRefDataBuilder ctr - uninitialized members - */ - - public BondRefDataBuilder() - { - } - - /** - * BondRefDataBuilder de-serialization from input JSON Map - * - * @param mapJSON Input JSON Map - * - * @throws java.lang.Exception Thrown if BondRefDataBuilder cannot be properly de-serialized - */ - - public BondRefDataBuilder ( - final org.drip.analytics.support.CaseInsensitiveTreeMap mapJSON) - throws java.lang.Exception - { - if (null == mapJSON || 0 == mapJSON.size()) - throw new java.lang.Exception ("BondRefDataBuilder de-serializer: Invalid input JSON Map"); - - // double dblVersion = mapJSON.get ("version"); - - _strISIN = mapJSON.get ("isin"); - - _strCUSIP = mapJSON.get ("cusip"); - - _strBBGID = mapJSON.get ("bbgid"); - - _strIssuerCategory = mapJSON.get ("issuercategory"); - - _strTicker = mapJSON.get ("ticker"); - - _strSeries = mapJSON.get ("series"); - - _strName = mapJSON.get ("name"); - - _strShortName = mapJSON.get ("shortname"); - - _strIssuerIndustry = mapJSON.get ("issuerindustry"); - - _strCouponType = mapJSON.get ("coupontype"); - - _strMaturityType = mapJSON.get ("maturitytype"); - - _strCalculationType = mapJSON.get ("calculationtype"); - - _strDayCountCode = mapJSON.get ("daycountcode"); - - _strMarketIssueType = mapJSON.get ("marketissuetype"); - - _strIssueCountryCode = mapJSON.get ("issuecountrycode"); - - _strIssueCountry = mapJSON.get ("issuecountry"); - - _strCollateralType = mapJSON.get ("collateraltype"); - - _dblIssueAmount = new java.lang.Double (mapJSON.get ("issueamount")); - - _dblOutstandingAmount = new java.lang.Double (mapJSON.get ("outstandingamount")); - - _dblMinimumPiece = new java.lang.Double (mapJSON.get ("minimumpiece")); - - _dblMinimumIncrement = new java.lang.Double (mapJSON.get ("minimumincrement")); - - _dblParAmount = new java.lang.Double (mapJSON.get ("paramount")); - - _strLeadManager = mapJSON.get ("leadmanager"); - - _strExchangeCode = mapJSON.get ("exchangecode"); - - _dblRedemptionValue = new java.lang.Double (mapJSON.get ("redemptionvalue")); - - _dtAnnounce = org.drip.analytics.date.DateUtil.MakeJulianFromYYYYMMDD (mapJSON.get ("announcedate"), - "-"); - - _dtFirstSettle = org.drip.analytics.date.DateUtil.MakeJulianFromYYYYMMDD (mapJSON.get - ("firstsettledate"), "-"); - - _dtFirstCoupon = org.drip.analytics.date.DateUtil.MakeJulianFromYYYYMMDD (mapJSON.get - ("firstcoupondate"), "-"); - - _dtInterestAccrualStart = org.drip.analytics.date.DateUtil.MakeJulianFromYYYYMMDD (mapJSON.get - ("interestaccrualstartdate"), "-"); - - _dtIssue = org.drip.analytics.date.DateUtil.MakeJulianFromYYYYMMDD (mapJSON.get ("issuedate"), "-"); - - _dtNextCouponDate = org.drip.analytics.date.DateUtil.MakeJulianFromYYYYMMDD (mapJSON.get - ("nextcoupondate"), "-"); - - _bIsCallable = new java.lang.Boolean (mapJSON.get ("iscallable")); - - _bIsPutable = new java.lang.Boolean (mapJSON.get ("isputabale")); - - _bIsSinkable = new java.lang.Boolean (mapJSON.get ("issinkable")); - - _strBBGParent = mapJSON.get ("bbgparent"); - - _strCountryOfIncorporation = mapJSON.get ("countryofincorporation"); - - _strIndustrySector = mapJSON.get ("industrysector"); - - _strIndustryGroup = mapJSON.get ("industrygroup"); - - _strIndustrySubgroup = mapJSON.get ("industrysubgroup"); - - _strCountryOfGuarantor = mapJSON.get ("countryofguarantor"); - - _strCountryOfDomicile = mapJSON.get ("countryofdomicile"); - - _strDescription = mapJSON.get ("description"); - - _strSecurityType = mapJSON.get ("securitytype"); - - _dtPrevCouponDate = org.drip.analytics.date.DateUtil.MakeJulianFromYYYYMMDD (mapJSON.get - ("prevcoupondate"), "-"); - - _strBBGUniqueID = mapJSON.get ("bbguniqueid"); - - _strLongCompanyName = mapJSON.get ("longcompanyname"); - - _bIsStructuredNote = new java.lang.Boolean (mapJSON.get ("isstructurednote")); - - _bIsUnitTraded = new java.lang.Boolean (mapJSON.get ("isunittraded")); - - _bIsReversibleConvertible = new java.lang.Boolean (mapJSON.get ("isreversibleconvertible")); - - _strRedemptionCurrency = mapJSON.get ("redemptioncurrency"); - - _strCouponCurrency = mapJSON.get ("couponcurrency"); - - _strTradeCurrency = mapJSON.get ("tradecurrency"); - - _bIsBearer = new java.lang.Boolean (mapJSON.get ("isbearer")); - - _bIsRegistered = new java.lang.Boolean (mapJSON.get ("isregistered")); - - _bHasBeenCalled = new java.lang.Boolean (mapJSON.get ("hasbeencalled")); - - _strIssuer = mapJSON.get ("issuer"); - - _dtPenultimateCouponDate = org.drip.analytics.date.DateUtil.MakeJulianFromYYYYMMDD (mapJSON.get - ("penultimatecoupondate"), "-"); - - _strFloatCouponConvention = mapJSON.get ("floatcouponconvention"); - - _dblCurrentCoupon = new java.lang.Double (mapJSON.get ("currentcoupon")); - - _bIsFloater = new java.lang.Boolean (mapJSON.get ("isfloater")); - - _bTradeStatus = new java.lang.Boolean (mapJSON.get ("tradestatus")); - - _strCDRCountryCode = mapJSON.get ("cdrcountrycode"); - - _strCDRSettleCode = mapJSON.get ("cdrsettlecode"); - - _dtFinalMaturity = org.drip.analytics.date.DateUtil.MakeJulianFromYYYYMMDD (mapJSON.get - ("finalmaturitydate"), "-"); - - _bIsPrivatePlacement = new java.lang.Boolean (mapJSON.get ("isprivateplacement")); - - _bIsPerpetual = new java.lang.Boolean (mapJSON.get ("isperpetual")); - - _bIsDefaulted = new java.lang.Boolean (mapJSON.get ("isdefaulted")); - - _dblFloatSpread = new java.lang.Double (mapJSON.get ("floatspread")); - - _strRateIndex = mapJSON.get ("rateindex"); - - _strMoody = mapJSON.get ("moody"); - - _strSnP = mapJSON.get ("snp"); - - _strFitch = mapJSON.get ("fitch"); - - _strSnrSub = mapJSON.get ("snrsub"); - - _strIssuerSPN = mapJSON.get ("issuerspn"); - - _dblIssuePrice = new java.lang.Double (mapJSON.get ("issueprice")); - - _dblCoupon = new java.lang.Double (mapJSON.get ("coupon")); - - _dtMaturity = org.drip.analytics.date.DateUtil.MakeJulianFromYYYYMMDD (mapJSON.get ("maturitydate"), - "-"); - } - - /** - * Set the ISIN - * - * @param strISIN ISIN - * - * @return True (success), false (failure) - */ - - public boolean setISIN ( - final java.lang.String strISIN) - { - if (null == strISIN || strISIN.isEmpty()) return false; - - _strISIN = strISIN; - return true; - } - - /** - * Set the CUSIP - * - * @param strCUSIP CUSIP - * - * @return True (success), false (failure) - */ - - public boolean setCUSIP ( - final java.lang.String strCUSIP) - { - if (null == strCUSIP || strCUSIP.isEmpty()) return false; - - _strCUSIP = strCUSIP; - return true; - } - - /** - * Set the Bloomberg ID - * - * @param strBBGID Bloomberg ID String - * - * @return True (success), false (failure) - */ - - public boolean setBBGID ( - final java.lang.String strBBGID) - { - if (null == (_strBBGID = strBBGID)) _strBBGID = ""; - - return true; - } - - /** - * Set the Issuer Category - * - * @param strIssuerCategory Issuer Category - * - * @return True (success), false (failure) - */ - - public boolean setIssuerCategory ( - final java.lang.String strIssuerCategory) - { - if (null == (_strIssuerCategory = strIssuerCategory)) _strIssuerCategory = ""; - - return true; - } - - /** - * Set the Issuer Ticker - * - * @param strTicker Ticker - * - * @return True (success), false (failure) - */ - - public boolean setTicker ( - final java.lang.String strTicker) - { - if (null == (_strTicker = strTicker)) _strTicker = ""; - - return true; - } - - /** - * Set the Issuer Series - * - * @param strSeries series - * - * @return True (success), false (failure) - */ - - public boolean setSeries ( - final java.lang.String strSeries) - { - if (null == (_strSeries = strSeries)) _strSeries = ""; - - return true; - } - - /** - * Set the Issuer Name - * - * @param strName Name - * - * @return True (success), false (failure) - */ - - public boolean setName ( - final java.lang.String strName) - { - if (null == (_strName = strName)) _strName = ""; - - return true; - } - - /** - * Set the Issuer Short Name - * - * @param strShortName Short Name - * - * @return True (success), false (failure) - */ - - public boolean setShortName ( - final java.lang.String strShortName) - { - if (null == (_strShortName = strShortName)) _strShortName = ""; - - return true; - } - - /** - * Set the Issuer Industry - * - * @param strIssuerIndustry Issuer Industry - * - * @return True (success), false (failure) - */ - - public boolean setIssuerIndustry ( - final java.lang.String strIssuerIndustry) - { - if (null == (_strIssuerIndustry = strIssuerIndustry)) _strIssuerIndustry = ""; - - return true; - } - - /** - * Set the Coupon Type - * - * @param strCouponType Coupon Type - * - * @return True (success), false (failure) - */ - - public boolean setCouponType ( - final java.lang.String strCouponType) - { - if (null == (_strCouponType = strCouponType)) _strCouponType = ""; - - return true; - } - - /** - * Set the Maturity Type - * - * @param strMaturityType Maturity Type - * - * @return True (success), false (failure) - */ - - public boolean setMaturityType ( - final java.lang.String strMaturityType) - { - if (null == (_strMaturityType = strMaturityType)) _strMaturityType = ""; - - return true; - } - - /** - * Set the Calculation Type - * - * @param strCalculationType Calculation Type - * - * @return True (success), false (failure) - */ - - public boolean setCalculationType ( - final java.lang.String strCalculationType) - { - if (null == (_strCalculationType = strCalculationType)) _strCalculationType = ""; - - return true; - } - - /** - * Set the Day Count Code - * - * @param strDayCountCode Day Count Code - * - * @return True (success), false (failure) - */ - - public boolean setDayCountCode ( - final java.lang.String strDayCountCode) - { - _strDayCountCode = "Unknown DC"; - - try { - _strDayCountCode = org.drip.analytics.support.Helper.ParseFromBBGDCCode - (strDayCountCode); - } catch (java.lang.Exception e) { - if (m_bBlog) - System.out.println ("Bad dayCount " + strDayCountCode + " for ISIN " + - _strISIN); - - return false; - } - - return true; - } - - /** - * Set the Market Issue Type - * - * @param strMarketIssueType Market Issue Type - * - * @return True (success), false (failure) - */ - - public boolean setMarketIssueType ( - final java.lang.String strMarketIssueType) - { - if (null == (_strMarketIssueType = strMarketIssueType)) _strMarketIssueType = ""; - - return true; - } - - /** - * Set the Issue Country Code - * - * @param strIssueCountryCode Issue Country Code - * - * @return True (success), false (failure) - */ - - public boolean setIssueCountryCode ( - final java.lang.String strIssueCountryCode) - { - if (null == (_strIssueCountryCode = strIssueCountryCode)) _strIssueCountryCode = ""; - - return true; - } - - /** - * Set the Issue Country - * - * @param strIssueCountry Issue Country - * - * @return True (success), false (failure) - */ - - public boolean setIssueCountry ( - final java.lang.String strIssueCountry) - { - if (null == (_strIssueCountry = strIssueCountry)) _strIssueCountry = ""; - - return true; - } - - /** - * Set the Collateral Type - * - * @param strCollateralType Collateral Type - * - * @return True (success), false (failure) - */ - - public boolean setCollateralType ( - final java.lang.String strCollateralType) - { - if (null == (_strCollateralType = strCollateralType)) _strCollateralType = ""; - - return true; - } - - /** - * Set the Issue Amount - * - * @param strIssueAmount Issue Amount - * - * @return True (success), false (failure) - */ - - public boolean setIssueAmount ( - final java.lang.String strIssueAmount) - { - try { - _dblIssueAmount = new java.lang.Double (strIssueAmount.trim()); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) System.out.println ("Bad Issue Amount " + strIssueAmount + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set the Outstanding Amount - * - * @param strOutstandingAmount Outstanding Amount - * - * @return True (success), false (failure) - */ - - public boolean setOutstandingAmount ( - final java.lang.String strOutstandingAmount) - { - try { - _dblOutstandingAmount = new java.lang.Double (strOutstandingAmount.trim()); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) - System.out.println ("Bad Outstanding Amount " + strOutstandingAmount + " for ISIN " + - _strISIN); - } - - return false; - } - - /** - * Set the Minimum Piece - * - * @param strMinimumPiece Minimum Piece - * - * @return True (success), false (failure) - */ - - public boolean setMinimumPiece ( - final java.lang.String strMinimumPiece) - { - try { - _dblMinimumPiece = new java.lang.Double (strMinimumPiece.trim()); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) - System.out.println ("Bad Minimum Piece " + strMinimumPiece + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set the Minimum Increment - * - * @param strMinimumIncrement Minimum Increment - * - * @return True (success), false (failure) - */ - - public boolean setMinimumIncrement ( - final java.lang.String strMinimumIncrement) - { - try { - _dblMinimumIncrement = new java.lang.Double (strMinimumIncrement.trim()); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) - System.out.println ("Bad Minimum Increment " + strMinimumIncrement + " for ISIN " + - _strISIN); - } - - return false; - } - - /** - * Set the Par Amount - * - * @param strParAmount Par Amount - * - * @return True (success), false (failure) - */ - - public boolean setParAmount ( - final java.lang.String strParAmount) - { - try { - _dblParAmount = new java.lang.Double (strParAmount.trim()); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) System.out.println ("Bad Par Amount " + strParAmount + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set the Lead Manager - * - * @param strLeadManager Lead Manager - * - * @return True (success), false (failure) - */ - - public boolean setLeadManager ( - final java.lang.String strLeadManager) - { - if (null == (_strLeadManager = strLeadManager)) _strLeadManager = ""; - - return true; - } - - /** - * Set the Exchange Code - * - * @param strExchangeCode Exchange Code - * - * @return True (success), false (failure) - */ - - public boolean setExchangeCode ( - final java.lang.String strExchangeCode) - { - if (null == (_strExchangeCode = strExchangeCode)) _strExchangeCode = ""; - - return true; - } - - /** - * Set the Redemption Value - * - * @param strRedemptionValue Redemption Value - * - * @return True (success), false (failure) - */ - - public boolean setRedemptionValue ( - final java.lang.String strRedemptionValue) - { - try { - _dblRedemptionValue = new java.lang.Double (strRedemptionValue.trim()); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) - System.out.println ("Bad Redemption Value " + strRedemptionValue + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set the Announce Date - * - * @param strAnnounce Announce Date String - * - * @return True (success), false (failure) - */ - - public boolean setAnnounce ( - final java.lang.String strAnnounce) - { - try { - _dtAnnounce = org.drip.analytics.date.DateUtil.MakeJulianDateFromBBGDate (strAnnounce.trim()); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) System.out.println ("Bad Announce " + strAnnounce + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set the First Settle - * - * @param strFirstSettle First Settle - * - * @return True (success), false (failure) - */ - - public boolean setFirstSettle ( - final java.lang.String strFirstSettle) - { - try { - _dtFirstSettle = org.drip.analytics.date.DateUtil.MakeJulianDateFromBBGDate - (strFirstSettle.trim()); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) System.out.println ("Bad First Settle " + strFirstSettle + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set the First Coupon - * - * @param strFirstCoupon First Coupon - * - * @return True (success), false (failure) - */ - - public boolean setFirstCoupon ( - final java.lang.String strFirstCoupon) - { - try { - _dtFirstCoupon = org.drip.analytics.date.DateUtil.MakeJulianDateFromBBGDate - (strFirstCoupon.trim()); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) System.out.println ("Bad First Coupon " + strFirstCoupon + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set the Interest Accrual Start Date - * - * @param strInterestAccrualStart Interest Accrual Start Date - * - * @return True (success), false (failure) - */ - - public boolean setInterestAccrualStart ( - final java.lang.String strInterestAccrualStart) - { - try { - _dtInterestAccrualStart = org.drip.analytics.date.DateUtil.MakeJulianDateFromBBGDate - (strInterestAccrualStart.trim()); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) - System.out.println ("Bad Announce " + strInterestAccrualStart + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set the Issue Date - * - * @param strIssue Issue Date - * - * @return True (success), false (failure) - */ - - public boolean setIssue ( - final java.lang.String strIssue) - { - try { - _dtIssue = org.drip.analytics.date.DateUtil.MakeJulianDateFromBBGDate (strIssue.trim()); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) System.out.println ("Bad Issue " + strIssue + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set the Next Coupon Date - * - * @param strNextCouponDate Next Coupon Date - * - * @return True (success), false (failure) - */ - - public boolean setNextCouponDate ( - final java.lang.String strNextCouponDate) - { - try { - _dtNextCouponDate = org.drip.analytics.date.DateUtil.MakeJulianDateFromBBGDate - (strNextCouponDate.trim()); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) - System.out.println ("Bad Next Coupon Date " + strNextCouponDate + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set whether is Callable - * - * @param strCallable Callable? - * - * @return True (success), false (failure) - */ - - public boolean setIsCallable ( - final java.lang.String strCallable) - { - if (null == strCallable) _bIsCallable = false; - - if ("1".equalsIgnoreCase (strCallable)) - _bIsCallable = true; - else - _bIsCallable = false; - - return true; - } - - /** - * Set whether is Putable - * - * @param strPutable Putable? - * - * @return True (success), false (failure) - */ - - public boolean setIsPutable ( - final java.lang.String strPutable) - { - if (null == strPutable) _bIsPutable = false; - - if ("1".equalsIgnoreCase (strPutable)) - _bIsPutable = true; - else - _bIsPutable = false; - - return true; - } - - /** - * Set whether is Sinkable - * - * @param strSinkable Sinkable? - * - * @return True (success), false (failure) - */ - - public boolean setIsSinkable ( - final java.lang.String strSinkable) - { - if (null == strSinkable) _bIsSinkable = false; - - if ("1".equalsIgnoreCase (strSinkable)) - _bIsSinkable = true; - else - _bIsSinkable = false; - - return true; - } - - /** - * Set the Bloomberg Parent - * - * @param strBBGParent Bloomberg Parent? - * - * @return True (success), false (failure) - */ - - public boolean setBBGParent ( - final java.lang.String strBBGParent) - { - if (null == (_strBBGParent = strBBGParent)) _strBBGParent = ""; - - return true; - } - - /** - * Set the Country Of Incorporation - * - * @param strCountryOfIncorporation Country Of Incorporation - * - * @return True (success), false (failure) - */ - - public boolean setCountryOfIncorporation ( - final java.lang.String strCountryOfIncorporation) - { - if (null == (_strCountryOfIncorporation = strCountryOfIncorporation)) - _strCountryOfIncorporation = ""; - - return true; - } - - /** - * Set the Industry Sector - * - * @param strIndustrySector Industry Sector - * - * @return True (success), false (failure) - */ - - public boolean setIndustrySector ( - final java.lang.String strIndustrySector) - { - if (null == (_strIndustrySector = strIndustrySector)) _strIndustrySector = ""; - - return true; - } - - /** - * Set the Industry Group - * - * @param strIndustryGroup Industry Group - * - * @return True (success), false (failure) - */ - - public boolean setIndustryGroup ( - final java.lang.String strIndustryGroup) - { - if (null == (_strIndustryGroup = strIndustryGroup)) _strIndustryGroup = ""; - - return true; - } - - /** - * Set the Industry Subgroup - * - * @param strIndustrySubgroup Industry Subgroup - * - * @return True (success), false (failure) - */ - - public boolean setIndustrySubgroup ( - final java.lang.String strIndustrySubgroup) - { - if (null == (_strIndustrySubgroup = strIndustrySubgroup)) _strIndustrySubgroup = ""; - - return true; - } - - /** - * Set the Country Of Guarantor - * - * @param strCountryOfGuarantor Country Of Guarantor - * - * @return True (success), false (failure) - */ - - public boolean setCountryOfGuarantor ( - final java.lang.String strCountryOfGuarantor) - { - if (null == (_strCountryOfGuarantor = strCountryOfGuarantor)) _strCountryOfGuarantor = ""; - - return true; - } - - /** - * Set the Country Of Domicile - * - * @param strCountryOfDomicile Country Of Domicile - * - * @return True (success), false (failure) - */ - - public boolean setCountryOfDomicile ( - final java.lang.String strCountryOfDomicile) - { - if (null == (_strCountryOfDomicile = strCountryOfDomicile)) _strCountryOfDomicile = ""; - - return true; - } - - /** - * Set the Description - * - * @param strDescription Description - * - * @return True (success), false (failure) - */ - - public boolean setDescription ( - final java.lang.String strDescription) - { - if (null == (_strDescription = strDescription)) _strDescription = ""; - - return true; - } - - /** - * Set the Security Type - * - * @param strSecurityType Security Type - * - * @return True (success), false (failure) - */ - - public boolean setSecurityType ( - final java.lang.String strSecurityType) - { - if (null == (_strSecurityType = strSecurityType)) _strSecurityType = ""; - - return true; - } - - /** - * Set the Previous Coupon Date - * - * @param strPrevCouponDate Previous Coupon Date - * - * @return True (success), false (failure) - */ - - public boolean setPrevCouponDate ( - final java.lang.String strPrevCouponDate) - { - try { - _dtPrevCouponDate = org.drip.analytics.date.DateUtil.MakeJulianDateFromBBGDate - (strPrevCouponDate.trim()); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) - System.out.println ("Bad Prev Coupon Date " + strPrevCouponDate + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set the Unique Bloomberg ID - * - * @param strBBGUniqueID BBGUniqueID - * - * @return True (success), false (failure) - */ - - public boolean setBBGUniqueID ( - final java.lang.String strBBGUniqueID) - { - if (null == (_strBBGUniqueID = strBBGUniqueID)) _strBBGUniqueID = ""; - - return true; - } - - /** - * Set the Long Company Name - * - * @param strLongCompanyName Long Company Name - * - * @return True (success), false (failure) - */ - - public boolean setLongCompanyName ( - final java.lang.String strLongCompanyName) - { - if (null == (_strLongCompanyName = strLongCompanyName)) _strLongCompanyName = ""; - - return true; - } - - /** - * Set the Flag indicating Structured Note - * - * @param strIsStructuredNote Flag indicating Structured Note - * - * @return True (success), false (failure) - */ - - public boolean setIsStructuredNote ( - final java.lang.String strIsStructuredNote) - { - if (null == strIsStructuredNote) _bIsStructuredNote = false; - - if ("1".equalsIgnoreCase (strIsStructuredNote)) - _bIsStructuredNote = true; - else - _bIsStructuredNote = false; - - return true; - } - - /** - * Set the Flag indicating Unit Traded - * - * @param strIsUnitTraded Flag indicating Unit Traded - * - * @return True (success), false (failure) - */ - - public boolean setIsUnitTraded ( - final java.lang.String strIsUnitTraded) - { - if (null == strIsUnitTraded) _bIsUnitTraded = false; - - if ("1".equalsIgnoreCase (strIsUnitTraded)) - _bIsUnitTraded = true; - else - _bIsUnitTraded = false; - - return true; - } - - /** - * Set the Flag indicating Reverse Convertible - * - * @param strIsReversibleConvertible Flag indicating Reverse Convertible - * - * @return True (success), false (failure) - */ - - public boolean setIsReversibleConvertible ( - final java.lang.String strIsReversibleConvertible) - { - if (null == strIsReversibleConvertible) _bIsReversibleConvertible = false; - - if ("1".equalsIgnoreCase (strIsReversibleConvertible)) - _bIsReversibleConvertible = true; - else - _bIsReversibleConvertible = false; - - return true; - } - - /** - * Set the Redemption Currency - * - * @param strRedemptionCurrency Redemption Currency - * - * @return True (success), false (failure) - */ - - public boolean setRedemptionCurrency ( - final java.lang.String strRedemptionCurrency) - { - if (null == (_strRedemptionCurrency = strRedemptionCurrency)) return false; - - return true; - } - - /** - * Set the Coupon Currency - * - * @param strCouponCurrency Coupon Currency - * - * @return True (success), false (failure) - */ - - public boolean setCouponCurrency ( - final java.lang.String strCouponCurrency) - { - if (null == (_strCouponCurrency = strCouponCurrency)) return false; - - return true; - } - - /** - * Set the Trade Currency - * - * @param strTradeCurrency Trade Currency - * - * @return True (success), false (failure) - */ - - public boolean setTradeCurrency ( - final java.lang.String strTradeCurrency) - { - if (null == (_strTradeCurrency = strTradeCurrency)) return false; - - return true; - } - - /** - * Set the Flag indicating Bearer Bond - * - * @param strIsBearer Flag indicating Bearer Bond - * - * @return True (success), false (failure) - */ - - public boolean setIsBearer ( - final java.lang.String strIsBearer) - { - if (null == strIsBearer) _bIsBearer = false; - - if ("1".equalsIgnoreCase (strIsBearer)) - _bIsBearer = true; - else - _bIsBearer = false; - - return true; - } - - /** - * Set the Flag Registered - * - * @param strIsRegistered Flag indicating Is Registered - * - * @return True (success), false (failure) - */ - - public boolean setIsRegistered ( - final java.lang.String strIsRegistered) - { - if (null == strIsRegistered) _bIsRegistered = false; - - if ("1".equalsIgnoreCase (strIsRegistered)) - _bIsRegistered = true; - else - _bIsRegistered = false; - - return true; - } - - /** - * Set the Flag indicating If bond has been called - * - * @param strHasBeenCalled Flag indicating If bond has been called - * - * @return True (success), false (failure) - */ - - public boolean setHasBeenCalled ( - final java.lang.String strHasBeenCalled) - { - if (null == strHasBeenCalled) _bHasBeenCalled = false; - - if ("1".equalsIgnoreCase (strHasBeenCalled)) - _bHasBeenCalled = true; - else - _bHasBeenCalled = false; - - return true; - } - - /** - * Set the Issuer - * - * @param strIssuer Issuer Name - * - * @return True (success), false (failure) - */ - - public boolean setIssuer ( - final java.lang.String strIssuer) - { - if (null == (_strIssuer = strIssuer)) _strIssuer = ""; - - return true; - } - - /** - * Set the Penultimate Coupon Date - * - * @param strPenultimateCouponDate setPenultimateCouponDate - * - * @return True (success), false (failure) - */ - - public boolean setPenultimateCouponDate ( - final java.lang.String strPenultimateCouponDate) - { - try { - _dtPenultimateCouponDate = org.drip.analytics.date.DateUtil.MakeJulianDateFromBBGDate - (strPenultimateCouponDate.trim()); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) - System.out.println ("Bad Penultimate Coupon Date " + strPenultimateCouponDate + " for ISIN " - + _strISIN); - } - - return false; - } - - /** - * Set the Float Coupon Convention - * - * @param strFloatCouponConvention Float Coupon Convention - * - * @return True (success), false (failure) - */ - - public boolean setFloatCouponConvention ( - final java.lang.String strFloatCouponConvention) - { - if (null == (_strFloatCouponConvention = strFloatCouponConvention)) _strFloatCouponConvention = ""; - - return true; - } - - /** - * Set the Current Coupon - * - * @param strCurrentCoupon Current Coupon - * - * @return True (success), false (failure) - */ - - public boolean setCurrentCoupon ( - final java.lang.String strCurrentCoupon) - { - if (null == strCurrentCoupon || strCurrentCoupon.isEmpty() || "null".equalsIgnoreCase - (strCurrentCoupon)) - _dblCurrentCoupon = 0.; - else { - try { - _dblCurrentCoupon = new java.lang.Double (strCurrentCoupon.trim()).doubleValue(); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) - System.out.println ("Bad Current Coupon " + strCurrentCoupon + " for ISIN " + _strISIN); - } - } - - return false; - } - - /** - * Set the Floater Flag - * - * @param strIsFloater Flag indicating Is Floater - * - * @return True (success), false (failure) - */ - - public boolean setIsFloater ( - final java.lang.String strIsFloater) - { - if (null == strIsFloater) _bIsFloater = false; - - if ("1".equalsIgnoreCase (strIsFloater)) - _bIsFloater = true; - else - _bIsFloater = false; - - return true; - } - - /** - * Set Trade Status - * - * @param strTradeStatus Trade Status - * - * @return True (success), false (failure) - */ - - public boolean setTradeStatus ( - final java.lang.String strTradeStatus) - { - if (null == strTradeStatus) _bTradeStatus = false; - - if ("1".equalsIgnoreCase (strTradeStatus)) - _bTradeStatus = true; - else - _bTradeStatus = false; - - return true; - } - - /** - * Set the CDR Country Code - * - * @param strCDRCountryCode CDR Country Code - * - * @return True (success), false (failure) - */ - - public boolean setCDRCountryCode ( - final java.lang.String strCDRCountryCode) - { - if (null == (_strCDRCountryCode = strCDRCountryCode)) _strCDRCountryCode = ""; - - return true; - } - - /** - * Set the CDR Settle Code - * - * @param strCDRSettleCode CDR Settle Code - * - * @return True (success), false (failure) - */ - - public boolean setCDRSettleCode ( - final java.lang.String strCDRSettleCode) - { - if (null == (_strCDRSettleCode = strCDRSettleCode)) _strCDRSettleCode = ""; - - return true; - } - - /** - * Set the Final Maturity - * - * @param strFinalMaturity Final Maturity - * - * @return True (success), false (failure) - */ - - public boolean setFinalMaturity ( - final java.lang.String strFinalMaturity) - { - try { - _dtFinalMaturity = org.drip.analytics.date.DateUtil.MakeJulianDateFromBBGDate - (strFinalMaturity.trim()); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) - System.out.println ("Bad Final Maturity " + strFinalMaturity + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set the Private Placement Flag - * - * @param strIsPrivatePlacement Flag indicating Is Private Placement - * - * @return True (success), false (failure) - */ - - public boolean setIsPrivatePlacement ( - final java.lang.String strIsPrivatePlacement) - { - if (null == strIsPrivatePlacement) _bIsPrivatePlacement = false; - - if ("1".equalsIgnoreCase (strIsPrivatePlacement)) - _bIsPrivatePlacement = true; - else - _bIsPrivatePlacement = false; - - return true; - } - - /** - * Set the Perpetual Flag - * - * @param strIsPerpetual Flag indicating Is Perpetual - * - * @return True (success), false (failure) - */ - - public boolean setIsPerpetual ( - final java.lang.String strIsPerpetual) - { - if (null == strIsPerpetual) _bIsPerpetual = false; - - if ("1".equalsIgnoreCase (strIsPerpetual)) - _bIsPerpetual = true; - else - _bIsPerpetual = false; - - return true; - } - - /** - * Set the Defaulted Flag - * - * @param strIsDefaulted Flag indicating Is Defaulted - * - * @return True (success), false (failure) - */ - - public boolean setIsDefaulted ( - final java.lang.String strIsDefaulted) - { - if (null == strIsDefaulted) _bIsDefaulted = false; - - if ("1".equalsIgnoreCase (strIsDefaulted)) - _bIsDefaulted = true; - else - _bIsDefaulted = false; - - return true; - } - - /** - * Set the Float Spread - * - * @param strFloatSpread Float Spread - * - * @return True (success), false (failure) - */ - - public boolean setFloatSpread ( - final java.lang.String strFloatSpread) - { - try { - _dblFloatSpread = new java.lang.Double (strFloatSpread.trim()); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) System.out.println ("Bad Float Spread " + strFloatSpread + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set the Rate Index - * - * @param strRateIndex Rate Index - * - * @return True (success), false (failure) - */ - - public boolean setRateIndex ( - final java.lang.String strRateIndex) - { - if (null == (_strRateIndex = strRateIndex)) _strRateIndex = ""; - - return true; - } - - /** - * Set the Moodys Rating - * - * @param strMoody Moodys Rating - * - * @return True (success), false (failure) - */ - - public boolean setMoody ( - final java.lang.String strMoody) - { - if (null == (_strMoody = strMoody)) _strMoody = ""; - - return true; - } - - /** - * Set the SnP Rating - * - * @param strSnP SnP Rating - * - * @return True (success), false (failure) - */ - - public boolean setSnP ( - final java.lang.String strSnP) - { - if (null == (_strSnP = strSnP)) _strSnP = ""; - - return true; - } - - /** - * Set the Fitch Rating - * - * @param strFitch Fitch Rating - * - * @return True (success), false (failure) - */ - - public boolean setFitch ( - final java.lang.String strFitch) - { - if (null == (_strFitch = strFitch)) _strFitch = ""; - - return true; - } - - /** - * Set Senior or Sub-ordinate - * - * @param strSnrSub Senior or Sub-ordinate - * - * @return True (success), false (failure) - */ - - public boolean setSnrSub ( - final java.lang.String strSnrSub) - { - if (null == (_strSnrSub = strSnrSub)) _strSnrSub = ""; - - return true; - } - - /** - * Set Issuer SPN - * - * @param strIssuerSPN Issuer SPN - * - * @return True (success), false (failure) - */ - - public boolean setIssuerSPN ( - final java.lang.String strIssuerSPN) - { - if (null == (_strIssuerSPN = strIssuerSPN)) _strIssuerSPN = ""; - - return true; - } - - /** - * Set Issue Price - * - * @param strIssuePrice Issue Price - * - * @return True (success), false (failure) - */ - - public boolean setIssuePrice ( - final java.lang.String strIssuePrice) - { - try { - _dblIssuePrice = new java.lang.Double (strIssuePrice.trim()).doubleValue(); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) System.out.println ("Bad Issue Price " + strIssuePrice + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set the coupon - * - * @param strCoupon Coupon - * - * @return True (success), false (failure) - */ - - public boolean setCoupon ( - final java.lang.String strCoupon) - { - if (null == strCoupon || strCoupon.isEmpty() || "null".equalsIgnoreCase (strCoupon)) _dblCoupon = 0.; - - try { - _dblCoupon = new java.lang.Double (strCoupon.trim()); - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) System.out.println ("Bad coupon " + strCoupon + " for ISIN " + _strISIN); - } - - return false; - } - - /** - * Set the maturity - * - * @param strMaturity maturity - * - * @return True (success), false (failure) - */ - - public boolean setMaturity ( - final java.lang.String strMaturity) - { - try { - if (null == (_dtMaturity = org.drip.analytics.date.DateUtil.MakeJulianDateFromBBGDate - (strMaturity.trim()))) - return false; - - return true; - } catch (java.lang.Exception e) { - if (m_bBlog) System.out.println ("Bad Maturity " + strMaturity + " for ISIN " + _strISIN); - } - - return false; - } - - @Override public boolean validate() - { - if (null == _strISIN || _strISIN.isEmpty() || null == _strCUSIP || _strCUSIP.isEmpty()) { - if (m_bDisplayWarnings) - System.out.println ("Check ISIN[" + _strISIN + "] or CUSIP[" + _strCUSIP + "]"); - - return false; - } - - if (null == _dtInterestAccrualStart) { - if (null == (_dtInterestAccrualStart = reconcileStartDate())) { - if (m_bDisplayWarnings) - System.out.println ("All possible date init candidates are null for ISIN " + _strISIN); - - return false; - } - } - - if (null == _dtFirstCoupon) _dtFirstCoupon = reconcileStartDate(); - - if (null == _dtIssue) _dtIssue = reconcileStartDate(); - - if (null == _dtFirstSettle) _dtFirstSettle = reconcileStartDate(); - - if (null == _dtAnnounce) _dtAnnounce = reconcileStartDate(); - - return true; - } - - /** - * Create an SQL Insert string for the given object - * - * @return SQL Insert string - */ - - public java.lang.String makeSQLInsert() - { - java.lang.StringBuilder sb = new java.lang.StringBuilder(); - - sb.append ("insert into BondRefData values("); - - sb.append ("'").append (_strISIN).append ("', "); - - sb.append ("'").append (_strCUSIP).append ("', "); - - sb.append ("'").append (_strBBGID).append ("', "); - - sb.append ("'").append (_strIssuerCategory).append ("', "); - - sb.append ("'").append (_strTicker).append ("', "); - - sb.append ("'").append (_strSeries).append ("', "); - - sb.append ("'").append (_strName).append ("', "); - - sb.append ("'").append (_strShortName).append ("', "); - - sb.append ("'").append (_strIssuerIndustry).append ("', "); - - sb.append ("'").append (_strCouponType).append ("', "); - - sb.append ("'").append (_strMaturityType).append ("', "); - - sb.append ("'").append (_strCalculationType).append ("', "); - - sb.append ("'").append (_strDayCountCode).append ("', "); - - sb.append ("'").append (_strMarketIssueType).append ("', "); - - sb.append ("'").append (_strIssueCountryCode).append ("', "); - - sb.append ("'").append (_strIssueCountry).append ("', "); - - sb.append ("'").append (_strCollateralType).append ("', "); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblIssueAmount)) - sb.append ("null, "); - else - sb.append (_dblIssueAmount).append (", "); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblOutstandingAmount)) - sb.append ("null, "); - else - sb.append (_dblOutstandingAmount).append (", "); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblMinimumPiece)) - sb.append ("null, "); - else - sb.append (_dblMinimumPiece).append (", "); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblMinimumIncrement)) - sb.append ("null, "); - else - sb.append (_dblMinimumIncrement).append (", "); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblParAmount)) - sb.append ("null, "); - else - sb.append (_dblParAmount).append (", "); - - sb.append ("'").append (_strLeadManager).append ("', "); - - sb.append ("'").append (_strExchangeCode).append ("', "); - - sb.append (_dblRedemptionValue).append (", "); - - sb.append ("'").append (_dtAnnounce.toOracleDate()).append ("', "); - - sb.append ("'").append (_dtFirstSettle.toOracleDate()).append ("', "); - - sb.append ("'").append (_dtFirstCoupon.toOracleDate()).append ("', "); - - sb.append ("'").append (_dtInterestAccrualStart.toOracleDate()).append ("', "); - - sb.append ("'").append (_dtIssue.toOracleDate()).append ("', "); - - if (null == _dtNextCouponDate) - sb.append ("null, "); - else - sb.append ("'").append (_dtNextCouponDate.toOracleDate()).append ("', "); - - sb.append ("'").append (_bIsCallable ? 1 : 0).append ("', "); - - sb.append ("'").append (_bIsPutable ? 1 : 0).append ("', "); - - sb.append ("'").append (_bIsSinkable ? 1 : 0).append ("', "); - - sb.append ("'").append (_strBBGParent).append ("', "); // Done - - sb.append ("'").append (_strCountryOfIncorporation).append ("', "); - - sb.append ("'").append (_strIndustrySector).append ("', "); - - sb.append ("'").append (_strIndustryGroup).append ("', "); - - sb.append ("'").append (_strIndustrySubgroup).append ("', "); - - sb.append ("'").append (_strCountryOfGuarantor).append ("', "); - - sb.append ("'").append (_strCountryOfDomicile).append ("', "); - - sb.append ("'").append (_strDescription).append ("', "); - - sb.append ("'").append (_strSecurityType).append ("', "); - - if (null == _dtPrevCouponDate) - sb.append ("null, "); - else - sb.append ("'").append (_dtPrevCouponDate.toOracleDate()).append ("', "); - - sb.append ("'").append (_strBBGUniqueID).append ("', "); - - sb.append ("'").append (_strLongCompanyName).append ("', "); - - sb.append ("'").append (_strRedemptionCurrency).append ("', "); - - sb.append ("'").append (_strCouponCurrency).append ("', "); - - sb.append ("'").append (_bIsStructuredNote ? 1 : 0).append ("', "); - - sb.append ("'").append (_bIsUnitTraded ? 1 : 0).append ("', "); - - sb.append ("'").append (_bIsReversibleConvertible ? 1 : 0).append ("', "); - - sb.append ("'").append (_strTradeCurrency).append ("', "); - - sb.append ("'").append (_bIsBearer ? 1 : 0).append ("', "); - - sb.append ("'").append (_bIsRegistered ? 1 : 0).append ("', "); - - sb.append ("'").append (_bHasBeenCalled ? 1 : 0).append ("', "); - - sb.append ("'").append (_strIssuer).append ("', "); - - if (null == _dtPenultimateCouponDate) - sb.append ("null, "); - else - sb.append ("'").append (_dtPenultimateCouponDate.toOracleDate()).append ("', "); - - sb.append ("'").append (_strFloatCouponConvention).append ("', "); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblCurrentCoupon)) - sb.append ("null, "); - else - sb.append (_dblCurrentCoupon).append (", "); - - sb.append ("'").append (_bIsFloater ? 1 : 0).append ("', "); - - sb.append ("'").append (_bTradeStatus ? 1 : 0).append ("', "); - - sb.append ("'").append (_strCDRCountryCode).append ("', "); - - sb.append ("'").append (_strCDRSettleCode).append ("', "); - - if (null == _dtFinalMaturity) - sb.append ("null, "); - else - sb.append ("'").append (_dtFinalMaturity.toOracleDate()).append ("', "); - - sb.append ("'").append (_bIsPrivatePlacement ? 1 : 0).append ("', "); - - sb.append ("'").append (_bIsPerpetual ? 1 : 0).append ("', "); - - sb.append ("'").append (_bIsDefaulted ? 1 : 0).append ("', "); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblFloatSpread)) - sb.append ("null, "); - else - sb.append (_dblFloatSpread).append (", "); - - sb.append ("'").append (_strRateIndex).append ("', "); - - sb.append ("'").append (_strMoody).append ("', "); - - sb.append ("'").append (_strSnP).append ("', "); - - sb.append ("'").append (_strFitch).append ("', "); - - sb.append ("'").append (_strSnrSub).append ("', "); - - sb.append ("'").append (_strIssuerSPN).append ("', "); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblIssuePrice)) - sb.append ("null, "); - else - sb.append (_dblIssuePrice).append (", "); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblCoupon)) - sb.append ("null, "); - else - sb.append (_dblCoupon).append (", "); - - if (null == _dtMaturity) - sb.append ("null"); - else - sb.append ("'").append (_dtMaturity.toOracleDate()).append ("'"); - - return sb.append (")").toString(); - } - - /** - * Create an SQL Delete string for the given object - * - * @return SQL Delete string - */ - - public java.lang.String makeSQLDelete() - { - java.lang.StringBuilder sb = new java.lang.StringBuilder(); - - sb.append ("delete from BondRefData where ISIN = '").append (_strISIN).append - ("' or CUSIP = '").append (_strCUSIP).append ("'"); - - return sb.toString(); - } - - public org.drip.analytics.support.CaseInsensitiveTreeMap toJSON() - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapJSON = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapJSON.put ("version", "" + org.drip.quant.common.StringUtil.VERSION); - - if (null == _strISIN || _strISIN.isEmpty()) - mapJSON.put ("isin", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("isin", _strISIN); - - if (null == _strCUSIP || _strCUSIP.isEmpty()) - mapJSON.put ("cusip", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("cusip", _strCUSIP); - - if (null == _strBBGID || _strBBGID.isEmpty()) - mapJSON.put ("bbgid", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("bbgid", _strBBGID); - - if (null == _strIssuerCategory || _strIssuerCategory.isEmpty()) - mapJSON.put ("issuercategory", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("issuercategory", _strIssuerCategory); - - if (null == _strTicker || _strTicker.isEmpty()) - mapJSON.put ("ticker", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("ticker", _strTicker); - - if (null == _strSeries || _strSeries.isEmpty()) - mapJSON.put ("series", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("series", _strSeries); - - if (null == _strName || _strName.isEmpty()) - mapJSON.put ("name", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("name", _strName); - - if (null == _strShortName || _strShortName.isEmpty()) - mapJSON.put ("shortname", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("shortname", _strShortName); - - if (null == _strIssuerIndustry || _strIssuerIndustry.isEmpty()) - mapJSON.put ("issuerindustry", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("issuerindustry", _strIssuerIndustry); - - if (null == _strCouponType || _strCouponType.isEmpty()) - mapJSON.put ("coupontype", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("coupontype", _strCouponType); - - if (null == _strMaturityType || _strMaturityType.isEmpty()) - mapJSON.put ("maturitytype", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("maturitytype", _strMaturityType); - - if (null == _strCalculationType || _strCalculationType.isEmpty()) - mapJSON.put ("calculationtype", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("calculationtype", _strCalculationType); - - if (null == _strDayCountCode || _strDayCountCode.isEmpty()) - mapJSON.put ("daycountcode", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("daycountcode", _strDayCountCode); - - if (null == _strMarketIssueType || _strMarketIssueType.isEmpty()) - mapJSON.put ("marketissuetype", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("marketissuetype", _strMarketIssueType); - - if (null == _strIssueCountryCode || _strIssueCountryCode.isEmpty()) - mapJSON.put ("issuecountrycode", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("issuecountrycode", _strIssueCountryCode); - - if (null == _strIssueCountry || _strIssueCountry.isEmpty()) - mapJSON.put ("issuecountry", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("issuecountry", _strIssueCountry); - - if (null == _strCollateralType || _strCollateralType.isEmpty()) - mapJSON.put ("collateraltype", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("collateraltype", _strCollateralType); - - mapJSON.put ("issueamount", "" + _dblIssueAmount); - - mapJSON.put ("outstandingamount", "" + _dblOutstandingAmount); - - mapJSON.put ("minimumpiece", "" + _dblMinimumPiece); - - mapJSON.put ("minimumincrement", "" + _dblMinimumIncrement); - - mapJSON.put ("paramount", "" + _dblParAmount); - - if (null == _strLeadManager || _strLeadManager.isEmpty()) - mapJSON.put ("leadmanager", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("leadmanager", _strLeadManager); - - if (null == _strExchangeCode || _strExchangeCode.isEmpty()) - mapJSON.put ("exchangecode", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("exchangecode", _strExchangeCode); - - mapJSON.put ("redemptionvalue", "" + _dblRedemptionValue); - - if (null == _dtAnnounce) - mapJSON.put ("announcedate", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("announcedate", _dtAnnounce.toYYYYMMDD ("-")); - - if (null == _dtFirstSettle) - mapJSON.put ("firstsettledate", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("firstsettledate", _dtFirstSettle.toYYYYMMDD ("-")); - - if (null == _dtFirstCoupon) - mapJSON.put ("firstcoupondate", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("firstcoupondate", _dtFirstCoupon.toYYYYMMDD ("-")); - - if (null == _dtInterestAccrualStart) - mapJSON.put ("interestaccrualstartdate", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("interestaccrualstartdate", _dtInterestAccrualStart.toYYYYMMDD ("-")); - - if (null == _dtIssue) - mapJSON.put ("issuedate", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("issuedate", _dtIssue.toYYYYMMDD ("-")); - - if (null == _dtNextCouponDate) - mapJSON.put ("nextcoupondate", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("nextcoupondate", _dtNextCouponDate.toYYYYMMDD ("-")); - - mapJSON.put ("iscallable", "" + _bIsCallable); - - mapJSON.put ("isputable", "" + _bIsPutable); - - mapJSON.put ("issinkable", "" + _bIsSinkable); - - if (null == _strBBGParent || _strBBGParent.isEmpty()) - mapJSON.put ("bbgparent", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("bbgparent", _strBBGParent); - - if (null == _strCountryOfIncorporation || _strCountryOfIncorporation.isEmpty()) - mapJSON.put ("countryofincorporation", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("countryofincorporation", _strCountryOfIncorporation); - - if (null == _strIndustrySector || _strIndustrySector.isEmpty()) - mapJSON.put ("industrysector", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("industrysector", _strIndustrySector); - - if (null == _strIndustryGroup || _strIndustryGroup.isEmpty()) - mapJSON.put ("industrygroup", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("industrygroup", _strIndustryGroup); - - if (null == _strIndustrySubgroup || _strIndustrySubgroup.isEmpty()) - mapJSON.put ("industrysubgroup", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("industrysubgroup", _strIndustrySubgroup); - - if (null == _strCountryOfGuarantor || _strCountryOfGuarantor.isEmpty()) - mapJSON.put ("countryofguarantor", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("countryofguarantor", _strCountryOfGuarantor); - - if (null == _strCountryOfDomicile || _strCountryOfDomicile.isEmpty()) - mapJSON.put ("countryofdomicile", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("countryofdomicile", _strCountryOfDomicile); - - if (null == _strDescription || _strDescription.isEmpty()) - mapJSON.put ("description", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("description", _strDescription); - - if (null == _strSecurityType || _strSecurityType.isEmpty()) - mapJSON.put ("securitytype", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("securitytype", _strSecurityType); - - if (null == _dtPrevCouponDate) - mapJSON.put ("prevcoupondate", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("prevcoupondate", _dtPrevCouponDate.toYYYYMMDD ("-")); - - if (null == _strBBGUniqueID || _strBBGUniqueID.isEmpty()) - mapJSON.put ("bbguniqueid", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("bbguniqueid", _strBBGUniqueID); - - if (null == _strLongCompanyName || _strLongCompanyName.isEmpty()) - mapJSON.put ("longcompanyname", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("longcompanyname", _strLongCompanyName); - - mapJSON.put ("isstructurednote", "" + _bIsStructuredNote); - - mapJSON.put ("isunittraded", "" + _bIsUnitTraded); - - mapJSON.put ("isreversibleconvertible", "" + _bIsReversibleConvertible); - - if (null == _strRedemptionCurrency || _strRedemptionCurrency.isEmpty()) - mapJSON.put ("redemptioncurrency", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("redemptioncurrency", _strRedemptionCurrency); - - if (null == _strCouponCurrency || _strCouponCurrency.isEmpty()) - mapJSON.put ("couponcurrency", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("couponcurrency", _strCouponCurrency); - - if (null == _strTradeCurrency || _strTradeCurrency.isEmpty()) - mapJSON.put ("tradecurrency", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("tradecurrency", _strTradeCurrency); - - mapJSON.put ("isbearer", "" + _bIsBearer); - - mapJSON.put ("isregistered", "" + _bIsRegistered); - - mapJSON.put ("hasbeencalled", "" + _bHasBeenCalled); - - if (null == _strIssuer || _strIssuer.isEmpty()) - mapJSON.put ("issuer", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("issuer", _strIssuer); - - if (null == _dtPenultimateCouponDate) - mapJSON.put ("penultimatecoupondate", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("penultimatecoupondate", _dtPenultimateCouponDate.toYYYYMMDD ("-")); - - if (null == _strFloatCouponConvention || _strFloatCouponConvention.isEmpty()) - mapJSON.put ("floatcouponconvention", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("floatcouponconvention", _strFloatCouponConvention); - - mapJSON.put ("currentcoupon", "" + _dblCurrentCoupon); - - mapJSON.put ("isfloater", "" + _bIsFloater); - - mapJSON.put ("tradestatus", "" + _bTradeStatus); - - if (null == _strCDRCountryCode || _strCDRCountryCode.isEmpty()) - mapJSON.put ("cdrcountrycode", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("cdrcountrycode", _strCDRCountryCode); - - if (null == _strCDRSettleCode || _strCDRSettleCode.isEmpty()) - mapJSON.put ("cdrsettlecode", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("cdrsettlecode", _strCDRSettleCode); - - if (null == _dtFinalMaturity) - mapJSON.put ("finalmaturitydate", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("finalmaturitydate", _dtFinalMaturity.toYYYYMMDD ("-")); - - mapJSON.put ("isprivateplacement", "" + _bIsPrivatePlacement); - - mapJSON.put ("isperpetual", "" + _bIsPerpetual); - - mapJSON.put ("isdefaulted", "" + _bIsDefaulted); - - mapJSON.put ("floatspread", "" + _dblFloatSpread); - - if (null == _strRateIndex || _strRateIndex.isEmpty()) - mapJSON.put ("rateindex", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("rateindex", _strRateIndex); - - if (null == _strMoody || _strMoody.isEmpty()) - mapJSON.put ("moody", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("moody", _strMoody); - - if (null == _strSnP || _strSnP.isEmpty()) - mapJSON.put ("snp", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("snp", _strSnP); - - if (null == _strFitch || _strFitch.isEmpty()) - mapJSON.put ("fitch", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("fitch", _strFitch); - - if (null == _strSnrSub || _strSnrSub.isEmpty()) - mapJSON.put ("snrsub", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("snrsub", _strSnrSub); - - if (null == _strIssuerSPN || _strIssuerSPN.isEmpty()) - mapJSON.put ("issuerspn", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("issuerspn", _strIssuerSPN); - - mapJSON.put ("issueprice", "" + _dblIssuePrice); - - mapJSON.put ("coupon", "" + _dblCoupon); - - if (null == _dtMaturity) - mapJSON.put ("maturitydate", org.drip.quant.common.StringUtil.NULL_SER_STRING); - else - mapJSON.put ("maturitydate", _dtMaturity.toYYYYMMDD ("-")); - - return mapJSON; - } -} diff --git a/org/drip/product/creator/CDSBasketBuilder.java b/org/drip/product/creator/CDSBasketBuilder.java deleted file mode 100644 index c1040a2..0000000 --- a/org/drip/product/creator/CDSBasketBuilder.java +++ /dev/null @@ -1,195 +0,0 @@ - -package org.drip.product.creator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * CDSBasketBuilder contains the suite of helper functions for creating the CDS Basket Product from different - * kinds of inputs and byte streams. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDSBasketBuilder { - - /** - * Create the named CDX from effective, maturity, coupon, IR curve name, credit curve name set, and their - * weights. - * - * @param dtEffective JulianDate Effective - * @param dtMaturity JulianDate Maturity - * @param dblCoupon Coupon - * @param strIR IR curve name - * @param astrCC credit curve name - * @param adblWeight Credit Component Weights - * @param strName CDX name - * - * @return BasketDefaultSwap - */ - - public static final org.drip.product.definition.BasketProduct MakeCDX ( - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity, - final double dblCoupon, - final java.lang.String strIR, - final java.lang.String[] astrCC, - final double[] adblWeight, - final java.lang.String strName) - { - if (null == dtEffective || null == dtMaturity || !org.drip.quant.common.NumberUtil.IsValid (dblCoupon) - || null == strIR || strIR.isEmpty() || null == strName || strName.isEmpty() || null == astrCC || - 0 == astrCC.length || null == adblWeight || 0 == adblWeight.length || adblWeight.length != - astrCC.length) - return null; - - org.drip.product.definition.CreditDefaultSwap aCDS[] = new - org.drip.product.definition.CreditDefaultSwap[astrCC.length]; - - for (int i = 0; i < astrCC.length; ++i) { - try { - aCDS[i] = org.drip.product.creator.CDSBuilder.CreateCDS (dtEffective, dtMaturity, dblCoupon, - strIR, 0.40, astrCC[i], strIR, true); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - try { - return new org.drip.product.credit.CDSBasket (aCDS, adblWeight, strName); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create the named CDX from effective, maturity, coupon, IR curve name, credit curve name set. - * - * @param dtEffective JulianDate Effective - * @param dtMaturity JulianDate Maturity - * @param dblCoupon Coupon - * @param strIR IR curve name - * @param astrCC credit curve name - * @param strName CDX name - * - * @return BasketDefaultSwap - */ - - public static final org.drip.product.definition.BasketProduct MakeCDX ( - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity, - final double dblCoupon, - final java.lang.String strIR, - final java.lang.String[] astrCC, - final java.lang.String strName) - { - if (null == dtEffective || null == dtMaturity || !org.drip.quant.common.NumberUtil.IsValid (dblCoupon) - || null == strIR || strIR.isEmpty() || null == strName || strName.isEmpty() || null == astrCC || - 0 == astrCC.length) - return null; - - org.drip.product.definition.CreditDefaultSwap aCDS[] = new - org.drip.product.definition.CreditDefaultSwap[astrCC.length]; - - for (int i = 0; i < astrCC.length; ++i) { - try { - aCDS[i] = org.drip.product.creator.CDSBuilder.CreateCDS (dtEffective, dtMaturity, dblCoupon, - strIR, 0.40, astrCC[i], strIR, true); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - try { - double adblWeight[] = new double[aCDS.length]; - - for (int i = 0; i < aCDS.length; ++i) - adblWeight[i] = 1.; - - return new org.drip.product.credit.CDSBasket (aCDS, adblWeight, strName); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create the basket default swap from an array of the credit components. - * - * @param aComp Array of the credit components - * - * @return BasketDefaultSwap object - */ - - public static final org.drip.product.definition.BasketProduct MakeBasketDefaultSwap ( - final org.drip.product.definition.Component[] aComp) - { - try { - double adblWeight[] = new double[aComp.length]; - - for (int i = 0; i < aComp.length; ++i) - adblWeight[i] = 1.; - - return new org.drip.product.credit.CDSBasket (aComp, adblWeight, ""); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/product/creator/CDSBuilder.java b/org/drip/product/creator/CDSBuilder.java deleted file mode 100644 index a617588..0000000 --- a/org/drip/product/creator/CDSBuilder.java +++ /dev/null @@ -1,376 +0,0 @@ - -package org.drip.product.creator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * CDSBuilder contains the suite of helper functions for creating the CreditDefaultSwap product from the - * parameters/byte array streams. It also creates the standard EU, NA, ASIA contracts, CDS with amortization - * schedules, and custom CDS from product codes/tenors. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDSBuilder { - - /** - * Create the credit default swap from the effective/maturity dates, coupon, IR curve name, and - * component credit valuation parameters. - * - * @param dtEffective JulianDate effective - * @param dtMaturity JulianDate maturity - * @param dblCoupon Coupon - * @param strCurrency Currency - * @param cs Credit Setting Parameters - * @param strCalendar Optional Holiday Calendar for Accrual calculation - * @param bAdjustDates Roll using the FWD mode for the period end dates and the pay dates - * - * @return CreditDefaultSwap product - */ - - public static final org.drip.product.definition.CreditDefaultSwap CreateCDS ( - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity, - final double dblCoupon, - final java.lang.String strCurrency, - final org.drip.product.params.CreditSetting cs, - final java.lang.String strCalendar, - final boolean bAdjustDates) - { - if (null == dtEffective || null == dtMaturity || null == strCurrency || strCurrency.isEmpty() || null - == cs || !org.drip.quant.common.NumberUtil.IsValid (dblCoupon)) - return null; - - try { - org.drip.analytics.daycount.DateAdjustParams dap = bAdjustDates ? new - org.drip.analytics.daycount.DateAdjustParams - (org.drip.analytics.daycount.Convention.DATE_ROLL_FOLLOWING, 1, strCalendar) : null; - - org.drip.product.definition.CreditDefaultSwap cds = new org.drip.product.credit.CDSComponent - (dtEffective.julian(), dtMaturity.julian(), dblCoupon, 4, "Act/360", "Act/360", "", false, - null, null, null, dap, dap, dap, dap, null, null, 1., strCurrency, cs, strCalendar); - - cds.setPrimaryCode ("CDS." + dtMaturity.toString() + "." + cs.creditCurveName()); - - return cds; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create the credit default swap from the effective/maturity dates, coupon, IR curve name, and - * credit curve. - * - * @param dtEffective JulianDate effective - * @param dtMaturity JulianDate maturity - * @param dblCoupon Coupon - * @param strCurrency Currency - * @param dblRecovery Recovery Rate - * @param strCredit Credit curve name - * @param strCalendar Optional Holiday Calendar for Accrual calculation - * @param bAdjustDates Roll using the FWD mode for the period end dates and the pay dates - * - * @return CreditDefaultSwap product - */ - - public static final org.drip.product.definition.CreditDefaultSwap CreateCDS ( - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity, - final double dblCoupon, - final java.lang.String strCurrency, - final double dblRecovery, - final java.lang.String strCredit, - final java.lang.String strCalendar, - final boolean bAdjustDates) - { - if (null == dtEffective || null == dtMaturity || null == strCurrency || strCurrency.isEmpty() || null - == strCredit || strCredit.isEmpty() || !org.drip.quant.common.NumberUtil.IsValid (dblCoupon)) - return null; - - org.drip.product.params.CreditSetting cs = new org.drip.product.params.CreditSetting (30, - dblRecovery, true, strCredit, true); - - return cs.validate() ? CreateCDS (dtEffective, dtMaturity, dblCoupon, strCurrency, cs, strCalendar, - bAdjustDates) : null; - } - - /** - * Create the credit default swap from the effective date, tenor, coupon, IR curve name, and component - * credit valuation parameters. - * - * @param dtEffective JulianDate effective - * @param strTenor String tenor - * @param dblCoupon Coupon - * @param strCurrency Currency - * @param cs Credit Setting Parameters - * @param strCalendar Optional Holiday Calendar for Accrual calculation - * - * @return CreditDefaultSwap product - */ - - public static final org.drip.product.definition.CreditDefaultSwap CreateCDS ( - final org.drip.analytics.date.JulianDate dtEffective, - final java.lang.String strTenor, - final double dblCoupon, - final java.lang.String strCurrency, - final org.drip.product.params.CreditSetting cs, - final java.lang.String strCalendar) - { - if (null == dtEffective || null == strTenor || strTenor.isEmpty() || null == strCurrency || - strCurrency.isEmpty() || null == cs || !org.drip.quant.common.NumberUtil.IsValid (dblCoupon)) - return null; - - try { - org.drip.product.definition.CreditDefaultSwap cds = new org.drip.product.credit.CDSComponent - (dtEffective.julian(), dtEffective.addTenor (strTenor).julian(), dblCoupon, 4, "30/360", - "30/360", "", true, null, null, null, null, null, null, null, null, null, 100., - strCurrency, cs, strCalendar); - - cds.setPrimaryCode ("CDS." + strTenor + "." + cs.creditCurveName()); - - return cds; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create the credit default swap from the effective/maturity dates, coupon, IR curve name, and credit - * curve. - * - * @param dtEffective JulianDate effective - * @param strTenor String tenor - * @param dblCoupon Coupon - * @param strCurrency Currency - * @param strCredit Credit curve name - * @param strCalendar Optional Holiday Calendar for accrual calculation - * - * @return CreditDefaultSwap product - */ - - public static final org.drip.product.definition.CreditDefaultSwap CreateCDS ( - final org.drip.analytics.date.JulianDate dtEffective, - final java.lang.String strTenor, - final double dblCoupon, - final java.lang.String strCurrency, - final java.lang.String strCredit, - final java.lang.String strCalendar) - { - if (null == dtEffective || null == strTenor || strTenor.isEmpty() || null == strCurrency || - strCurrency.isEmpty() || null == strCredit || strCredit.isEmpty() || - !org.drip.quant.common.NumberUtil.IsValid (dblCoupon)) - return null; - - org.drip.product.params.CreditSetting cs = new org.drip.product.params.CreditSetting (30, - java.lang.Double.NaN, true, strCredit, true); - - return cs.validate() ? CreateCDS (dtEffective, strTenor, dblCoupon, strCurrency, cs, strCalendar) : - null; - } - - /** - * Create an SNAC style CDS contract with full first stub - * - * @param dtEffective CDS Effective date - * @param strTenor CDS Tenor - * @param dblCoupon SNAC strike coupon - * @param strCurrency Currency - * @param strCredit Credit Curve name - * @param strCalendar Holiday Calendar - * - * @return CDS instance object - */ - - public static final org.drip.product.definition.CreditDefaultSwap CreateSNAC ( - final org.drip.analytics.date.JulianDate dtEffective, - final java.lang.String strTenor, - final double dblCoupon, - final java.lang.String strCurrency, - final java.lang.String strCredit, - final java.lang.String strCalendar) - { - if (null == dtEffective || null == strTenor || strTenor.isEmpty()) return null; - - org.drip.analytics.date.JulianDate dtFirstCoupon = dtEffective.nextCreditIMM (3); - - if (null == dtFirstCoupon) return null; - - org.drip.product.definition.CreditDefaultSwap cds = CreateCDS (dtFirstCoupon.subtractTenor ("3M"), - dtFirstCoupon.addTenor (strTenor), dblCoupon, strCurrency, 0.40, strCredit, strCalendar, true); - - if (null == cds) return null; - - cds.setPrimaryCode ("CDS." + strTenor + "." + strCredit); - - return cds; - } - - /** - * Create an SNAC style CDS contract with full first stub - * - * @param dtEffective CDS Effective date - * @param strTenor CDS Tenor - * @param dblCoupon SNAC strike coupon - * @param strCredit Credit Curve name - * - * @return CDS instance object - */ - - public static final org.drip.product.definition.CreditDefaultSwap CreateSNAC ( - final org.drip.analytics.date.JulianDate dtEffective, - final java.lang.String strTenor, - final double dblCoupon, - final java.lang.String strCredit) - { - return CreateSNAC (dtEffective, strTenor, dblCoupon, "USD", strCredit, "USD"); - } - - /** - * Create an Standard EU CDS contract with full first stub - * - * @param dtEffective CDS Effective date - * @param strTenor CDS Tenor - * @param dblCoupon Strike coupon - * @param strCredit Credit Curve name - * - * @return CDS instance object - */ - - public static final org.drip.product.definition.CreditDefaultSwap CreateSTEU ( - final org.drip.analytics.date.JulianDate dtEffective, - final java.lang.String strTenor, - final double dblCoupon, - final java.lang.String strCredit) - { - if (null == dtEffective || null == strTenor || strTenor.isEmpty()) return null; - - org.drip.analytics.date.JulianDate dtFirstCoupon = dtEffective.nextCreditIMM (3); - - if (null == dtFirstCoupon) return null; - - org.drip.product.definition.CreditDefaultSwap cds = CreateCDS (dtFirstCoupon.subtractTenor ("3M"), - dtFirstCoupon.addTenor (strTenor), dblCoupon, "EUR", 0.40, strCredit, "EUR", true); - - cds.setPrimaryCode ("CDS." + strTenor + "." + strCredit); - - return cds; - } - - /** - * Create an Standard Asia Pacific CDS contract with full first stub - * - * @param dtEffective CDS Effective date - * @param strTenor CDS Tenor - * @param dblCoupon Strike coupon - * @param strCredit Credit Curve name - * - * @return CDS instance object - */ - - public static final org.drip.product.definition.CreditDefaultSwap CreateSAPC ( - final org.drip.analytics.date.JulianDate dtEffective, - final java.lang.String strTenor, - final double dblCoupon, - final java.lang.String strCredit) - { - if (null == dtEffective || null == strTenor || strTenor.isEmpty()) return null; - - org.drip.analytics.date.JulianDate dtFirstCoupon = dtEffective.nextCreditIMM (3); - - if (null == dtFirstCoupon) return null; - - org.drip.product.definition.CreditDefaultSwap cds = CreateCDS (dtFirstCoupon.subtractTenor ("3M"), - dtFirstCoupon.addTenor (strTenor), dblCoupon, "HKD", 0.40, strCredit, "HKD", true); - - cds.setPrimaryCode ("CDS." + strTenor + "." + strCredit); - - return cds; - } - - /** - * Create an Standard Emerging Market CDS contract with full first stub - * - * @param dtEffective CDS Effective date - * @param strTenor CDS Tenor - * @param dblCoupon Strike coupon - * @param strCredit Credit Curve name - * @param strLocation Location - * - * @return CDS instance object - */ - - public static final org.drip.product.definition.CreditDefaultSwap CreateSTEM ( - final org.drip.analytics.date.JulianDate dtEffective, - final java.lang.String strTenor, - final double dblCoupon, - final java.lang.String strCredit, - final java.lang.String strLocation) - { - if (null == dtEffective || null == strTenor || strTenor.isEmpty()) return null; - - org.drip.analytics.date.JulianDate dtFirstCoupon = dtEffective.nextCreditIMM (3); - - if (null == dtFirstCoupon) return null; - - org.drip.product.definition.CreditDefaultSwap cds = CreateCDS (dtFirstCoupon.subtractTenor ("3M"), - dtFirstCoupon.addTenor (strTenor), dblCoupon, strLocation, 0.25, strCredit, strLocation, true); - - cds.setPrimaryCode ("CDS." + strTenor + "." + strCredit); - - return cds; - } -} diff --git a/org/drip/product/creator/CDXRefDataHolder.java b/org/drip/product/creator/CDXRefDataHolder.java deleted file mode 100644 index fdbdbf7..0000000 --- a/org/drip/product/creator/CDXRefDataHolder.java +++ /dev/null @@ -1,29111 +0,0 @@ - -package org.drip.product.creator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/* - * GENERATED on Sat Jul 07 14:30:49 EDT 2012 ---- DO NOT DELETE - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -public class CDXRefDataHolder { - public static org.drip.analytics.support.CaseInsensitiveTreeMap - _mapCDXRefData = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - public static - org.drip.analytics.support.CaseInsensitiveTreeMap> _mmCDXRDBFirstCouponSeries = new - org.drip.analytics.support.CaseInsensitiveTreeMap>(); - - public static org.drip.analytics.support.CaseInsensitiveTreeMap> _mmCDXRDBSeriesFirstCoupon = new - org.drip.analytics.support.CaseInsensitiveTreeMap>(); - - private static final boolean UpdateCDXRefDataMap ( - final java.lang.String strCDXName, - final org.drip.product.params.CDXRefDataParams cdxrd) - { - if (null == cdxrd) { - System.out.println ("No CDX ref data for " + strCDXName); - - return false; - } - - _mapCDXRefData.put (strCDXName, cdxrd); - - java.util.Map mapFirstCouponSeries = - _mmCDXRDBFirstCouponSeries.get (cdxrd._strIndexClass + "." + cdxrd._strIndexGroupName); - - if (null == mapFirstCouponSeries) - mapFirstCouponSeries = new java.util.TreeMap(); - - mapFirstCouponSeries.put (cdxrd._dtMaturity.subtractTenor (cdxrd._iIndexLifeSpan + "Y"), - cdxrd._iIndexSeries); - - _mmCDXRDBFirstCouponSeries.put (cdxrd._strIndexClass + "." + cdxrd._strIndexGroupName, - mapFirstCouponSeries); - - java.util.Map mapSeriesFirstCoupon = - _mmCDXRDBSeriesFirstCoupon.get (cdxrd._strIndexClass + "." + cdxrd._strIndexGroupName); - - if (null == mapSeriesFirstCoupon) - mapSeriesFirstCoupon = new java.util.TreeMap(); - - mapSeriesFirstCoupon.put (cdxrd._iIndexSeries, cdxrd._dtMaturity.subtractTenor (cdxrd._iIndexLifeSpan - + "Y")); - - _mmCDXRDBSeriesFirstCoupon.put (cdxrd._strIndexClass + "." + cdxrd._strIndexGroupName, - mapSeriesFirstCoupon); - - return true; - } - - private static final boolean InitCDXRefDataSet1() - { - UpdateCDXRefDataMap ("DJCDX.NA HY 3TR4DEC2009.5Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("211271", "4664353", - "DJCDX-NAHY3TR4DEC2009 - 0507", "JPMC HYDI BB MAY 07 SWP", - "HYDI_BB_MAY_07_SWP", 2452410, 2454236, 0.026500000000000003, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65EWAB2", "DJCDX", 1, "NA HY 3TR4DEC2009", null, "HY", 1, 5, - null, 0.95652, 44, 0, "NYC", false, false, false, null, "Hydi")); - - UpdateCDXRefDataMap ("TRACXNA.100.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("220733", "5252636", - "TRACXNA-100S2V1 - 0309", "Dow Jones TRAC-X NA SERIES 2 March 2009", - "TRACX_NA_IG_S2_05Y_3/09_SWP", 2452916, 2454911, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65EUAB6", "TRACXNA", 2, "100", null, "IG", 1, 5, - null, 1, 100, 0, "NYC", false, false, true, null, "Trac-X")); - - UpdateCDXRefDataMap ("TRACXNA.HIBE.5Y.2.0", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("220735", "5252962", - "TRACXNA-HIBES2V1 - 0309", "Dow Jones TRAC-X NA SERIES 2 HIGH BETA March 2009", - "TRACX_NA_IG_S2_HB_05Y_3/09_SWP", 2452916, 2454911, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65EWAB2", "TRACXNA", 2, "HIBE", null, "IG", 0, 5, - null, 1, 40, 0, "NYC", false, false, true, null, "Trac-X")); - - UpdateCDXRefDataMap ("TRACXNA.100.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("220828", "5275164", - "TRACXNA-100S2V1 - 0314", "Dow Jones TRAC-X NA SERIES 2 March 2014", - "TRACX_NA_IG_S2_10Y_3/14_SWP", 2452916, 2456737, 0.01, "USD", - "ACT/360", false, 0.3, 4, "2I65EUAB6", "TRACXNA", 2, "100", null, "IG", 1, 10, - null, 1, 99, 0, "NYC", false, false, true, null, "Trac-X")); - - UpdateCDXRefDataMap ("TRACXNA.TMT.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("220941", "5287863", - "TRACXNA-TMTS2V1 - 0309", "Dow Jones TRAC-X NA SERIES 2 TMT March 2009", - "TRAC-X NORTH AMERICA SERIES 2 TMT 03/09 FLOAT", 2452916, 2454913, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65EYAB8", "TRACXNA", 2, "TMT", "TMT", "IG", 1, 5, - null, 1, 27, 0, "NYC", false, false, true, "ITRXET52", "TMT")); - - UpdateCDXRefDataMap ("TRACXNA.TMT.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("220942", "5287871", - "TRACXNA-TMTS2V1 - 0314", "TRAC-X NORTH AMERICA SERIES 2 TMT FLOAT 10 YEAR", - "TRAC-X North America Series 2 TMT 03/14 Float", 2452916, 2456737, 0.01, "USD", - "ACT/360", false, 0.5, 4, "2I65EYAB8", "TRACXNA", 2, "TMT", "TMT", "IG", 1, 10, - null, 1, 27, 0, "NYC", false, false, true, "ITRXET02", "TMT")); - - UpdateCDXRefDataMap ("TRACXNA.FIN.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("221216", "5298237", - "TRACXNA-FINS2V1 - 0309", "Dow Jones TRAC-X NA SERIES 2 FINANCIAL March 2009", - "TRAC-X NA SERIES 2 FINL SECTOR 5 YR", 2452950, 2454913, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65EZAB5", "TRACXNA", 2, "FIN", null, "IG", 1, 5, - null, 0.999999, 9, 0, "NYC", false, false, true, null, "Trac-X")); - - UpdateCDXRefDataMap ("TRACXNA.HIBE.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("221255", "5301777", - "TRACXNA-HIBES2V1 - 0314", "Dow Jones TRAC-X NA SERIES 2 High Beta March 2014", - "TRACX_NA_IG_S2_HB_10Y_3/14_SWP", 2452916, 2456737, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65EWAB2", "TRACXNA", 2, "HIBE", null, "IG", 1, 10, - null, 1, 40, 0, "NYC", false, false, true, null, "Trac-X")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223176", "5455022", - "DJCDX-NAIGS2V1 - 0909", "Dow Jones CDX.NA.IG.2 SEP 2009", - "DJCDX_NA_IG_S2_05Y_9/09", 2453088, 2455095, 0.006, "USD", - "ACT/360", false, 0.3, 4, "2I65BYAA3", "DJCDX", 2, "NA IG", null, "IG", 1, 5, - null, 1, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223177", "5455200", - "DJCDX-NAIGHVOLS2V1 - 0909", "Dow Jones CDX.NA.IG HVOL.2", - "DJCDX_NA_IG_S2_HVOL_05Y_9/09", 2453088, 2455095, 0.0115, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AA1", "DJCDX", 2, "NA IG HVOL", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223178", "5455219", - "DJCDX-NAIGS2V1 - 0914", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_10Y_9/14", 2453088, 2456921, 0.008, "USD", - "ACT/360", false, 0.3, 4, "2I65BYAA3", "DJCDX", 2, "NA IG", null, "IG", 1, 10, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223179", "5455227", - "DJCDX-NAIGHVOLS2V1 - 0914", "Dow Jones CDX.NA.IG HVOL.2", - "DJCDX_NA_IG_S2_HVOL_10Y_9/14", 2453088, 2456921, 0.013000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AA1", "DJCDX", 2, "NA IG HVOL", null, "HV", 1, 10, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJTRAC.XNA HY.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223200", "5458102", - "DJTRAC-XNAHYS2V1 - 0307", "DOW JONES TRAC-X NA HIGH YIELD SERIES 2 MARCH 2007", - "TRACX_NA_HY_S2_100_SWP_6/07", 2452978, 2454180, 0.035, "USD", - "ACT/360", false, 0.3, 4, "2I65EUAB6", "DJTRAC", 2, "XNA HY", null, "HY", 1, 5, - null, 1, 100, 0, "NYC", false, false, false, null, "Trac-X")); - - UpdateCDXRefDataMap ("TRACXNA. HY HB.3Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223203", "5458153", - "TRACXNA-HYHB-S2V1 - 0307", "DOW JONES TRAC-X NA HIGH YIELD SERIES 2 HIGH BETA MARCH 2007", - "TRACX_NA_HY_S2_HB_SWP_6/07", 2452978, 2454180, 0.061500000000000006, "USD", - "ACT/360", false, 0.3, 4, "2I65EWAB2", "TRACXNA", 2, "HY HB", null, "HY", 1, 3, - null, 1, 33, 0, "NYC", false, false, false, null, "Trac-X")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.5Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223403", "5455766", - "DJCDX-NAIGS1V1 - 0309", "Dow Jones CDX.NA.IG Mar 2009", - "DJCDX_NA_IG_S1_05Y_3/09", 2452934, 2454911, 0.006, "USD", - "ACT/360", false, 0.3, 4, "2I65BYAC9", "DJCDX", 1, "NA IG", null, "IG", 1, 5, - null, 0.996, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.5Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223404", "5455758", - "DJCDX-NAIGHVOLS1V1 - 0309", "Dow Jones CDX.NA.IG HVOL.1", - "DJCDX_NA_IG_S1_HIVOL_05Y_3/09", 2452934, 2454911, 0.0125, "USD", - "ACT/360", false, 0.3, 4, "2I65B3AC7", "DJCDX", 1, "NA IG HVOL", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG CONS.5Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223405", "5455723", - "DJCDX-NAIGCONSS1V1 - 0309", "Dow Jones CDX.NA.IG CONS", - "DJCDX_NA_IG_S1_CONS_05Y_3/09", 2452934, 2454911, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65B0AC3", "DJCDX", 1, "NA IG CONS", null, "IG", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG ENRG.5Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223406", "5455707", - "DJCDX-NAIGENRGS1V1 - 0309", "Dow Jones CDX.NA.IG ENRG", - "DJCDX_NA_IG_S1_ENRG_05Y_3/09", 2452934, 2454911, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65B1AC1", "DJCDX", 1, "NA IG ENRG", null, "IG", 1, 5, - null, 1, 15, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG FIN.5Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223407", "5455715", - "DJCDX-NAIGFINS1V1 - 0309", "Dow Jones CDX.NA.IG FIN", - "DJCDX_NA_IG_S1_FIN_05Y_3/09", 2452934, 2454911, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65B2AC9", "DJCDX", 1, "NA IG FIN", null, "IG", 1, 5, - null, 1, 23, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG INDU.5Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223408", "5455685", - "DJCDX-NAIGINDUS1V1 - 0309", "Dow Jones CDX.NA.IG INDU", - "DJCDX_NA_IG_S1_INDU_05Y_3/09", 2452934, 2454911, 0.006, "USD", - "ACT/360", false, 0.3, 4, "2I65B4AC5", "DJCDX", 1, "NA IG INDU", null, "IG", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG TMT.5Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223409", "5455677", - "DJCDX-NAIGTMTS1V1 - 0309", "Dow Jones CDX.NA.IG TMT", - "DJCDX_NA_IG_S1_TMT_05Y_3/09", 2452934, 2454913, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65DJAC0", "DJCDX", 1, "NA IG TMT", null, "IG", 1, 5, - null, 1, 27, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.10Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223410", "5455669", - "DJCDX-NAIGS1V1 - 0314", "Dow Jones CDX.NA.IG", - "DJCDX_NA_IG_S1_10Y_3/14", 2452934, 2456737, 0.007, "USD", - "ACT/360", false, 0.3, 4, "2I65BYAC9", "DJCDX", 1, "NA IG", null, "IG", 1, 10, - null, 0.996, 124, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.NCYC.5Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223614", "5487668", - "ITRAXX-NCYCS1V1 - 0914", "iTraxx Europe Consumer Non-Cyclical Series 1 Version 1", - "DOW JONES ITRAXX EUROPE CONSUMER NON-CYCLICAL SERIES 1 VERSION 1 EUR SEN MMR I03 CDS", 2453179, 2456921, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I666YAA7", "ITRAXX", 1, "NCYC", null, "IG", 1, 5, - null, 1, 16, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.NCYC.5Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223614", "5487668", - "ITRAXX-NCYCS1V1 - 0914", "iTraxx Europe Consumer Non-Cyclical Series 1 Version 1", - "DOW JONES ITRAXX EUROPE CONSUMER NON-CYCLICAL SERIES 1 VERSION 1 EUR SEN MMR I03 CDS", 2453179, 2456921, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I666YAA7", "ITRAXX", 1, "NCYC", null, "IG", 1, 5, - null, 1, 16, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.IND.5Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223615", "5487676", - "ITRAXX-INDS1V1 - 0914", "iTraxx Europe Industrials Series 1 Version 1", - "DOW JONES ITRAXX EUROPE INDUSTRIALS SERIES 1 VERSION 1 EUR SEN MMR I03 CDS", 2453179, 2456921, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I667HAA3", "ITRAXX", 1, "IND", null, "IG", 1, 5, - null, 1, 20, 0, "LON", false, false, true, "ITRXEI51", "i-Traxx-European")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.2Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223835", "5539668", - "DJCDX-NAIGS2V1 - 0906", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_02Y_9/06", 2453088, 2453999, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAA3", "DJCDX", 2, "NA IG", null, "IG", 1, 2, - null, 1, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.3Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223836", "5539676", - "DJCDX-NAIGS2V1 - 0907", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_03Y_9/07", 2453088, 2454364, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAA3", "DJCDX", 2, "NA IG", null, "IG", 1, 3, - null, 1, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.7Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223837", "5539684", - "DJCDX-NAIGS2V1 - 0911", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_07Y_9/11", 2453088, 2455825, 0.006, "USD", - "ACT/360", false, 0.3, 4, "2I65BYAA3", "DJCDX", 2, "NA IG", null, "IG", 1, 7, - null, 1, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY V9TST.5Y.3.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223950", "5581265", - "DJCDX-NAHYS3V9-TST - 1209", "DOW JONES CDX NA HY 3 TRUST 1 DECEMBER 2009", - "DJ CDX.NA.HY.3 T1 Fixed", 2453196, 2455186, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCH1-TST", "DJCDX", 3, "NA HY V9TST", null, "HY", 9, 5, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY BBV2TST.5Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223969", "5581273", - "DJCDX-NAHYBBS3V2-TST - 1209", "DOW JONES CDX NA HY 3 TRUST 2 DECEMBER 2009", - "DJCDX_NA_HY_S3_BB__FXD", 2453196, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.3, 4, "2I65BVAI2 FXD", "DJCDX", 3, "NA HY BBV2TST", null, "HY", 2, 5, - null, 0.9535, 42, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY B.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223976", "5581281", - "DJCDX-NAHYBS3V1 - 1209", "DOW JONES CDX NA HY 3 TRUST 3 DECEMBER 2009", - "DJ CDX.NA.HY.3 T3 Fixed", 2453196, 2455186, 0.04, "USD", - "ACT/360", false, 0.3, 4, "2I65BSAB4", "DJCDX", 3, "NA HY B", null, "HY", 1, 5, - null, 1, 44, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY BV6 TST.5Y.3.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223983", "5581311", - "DJCDX-NAHYBS3V6 TST - 1209", "DOW JONES CDX NA HY 3 TRUST 4 DECEMBER 2009", - "DJ CDX.NA.HY.3 T4 Fixed", 2453196, 2455186, 0.0625, "USD", - "ACT/360", false, 0.3, 4, "2I65BSCJ5-TST", "DJCDX", 3, "NA HY BV6 TST", null, "HY", 6, 5, - null, 0.8863500000000001, 44, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.2Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223996", "5582156", - "DJCDX-NAIGHVOL2 - 0906", "Dow Jones CDX.NA.IG HVOL.2", - "DJCDX_NA_IG_S2_HVOL_02Y_9/06", 2453088, 2453999, 0.0115, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AA1", "DJCDX", 2, "NA IG HVOL", null, "HV", 1, 2, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.3Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("223997", "5582164", - "DJCDX-NAIGHVOL2V1 - 0907", "Dow Jones CDX.NA.IG.HVOL.2", - "DJCDX_NA_IG_S2_HVOL_03Y_9/07", 2453088, 2454364, 0.0115, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AA1", "DJCDX", 2, "NA IG HVOL", null, "HV", 1, 3, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.CORP.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("224356", "5662761", - "ITRAXX-CORPS2V1 - 0310", "iTraxx Europe Corporate Series 2 Version 1", - "DOW JONES ITRAXX EUR CORP SER 2 1 EUR SEN MMR I03 CDS", 2453269, 2455276, 0.0045000000000000005, "EUR", - "ACT/360", false, 0.5, 4, "2I667MAB0", "ITRAXX", 2, "CORP", "COR", "IG", 1, 5, - null, 1, 53, 0, "LON", false, false, true, null, "COR")); - - UpdateCDXRefDataMap ("DJCDX.EM.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("224420", "5673372", - "DJCDX-EMS2V1 - 1209", "Dow Jones CDX.EM.2", - "DJ CDX EM 2 12/09", 2453270, 2455186, 0.026000000000000002, "USD", - "ACT/360", false, 0.25, 4, "2I65BZAB8", "DJCDX", 2, "EM", null, "EM", 1, 5, - null, 1, 14, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("224421", "5673917", - "DJCDX-NAIGS3V1 - 0310", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_05Y_3/10", 2453270, 2455276, 0.005, "USD", - "ACT/360", false, 0.3, 4, "2I65BYAB1", "DJCDX", 3, "NA IG", null, "IG", 1, 5, - null, 1, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.10Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("224422", "5673925", - "DJCDX-NAIGS3V1 - 0315", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_10Y_3/15", 2453270, 2457102, 0.007, "USD", - "ACT/360", false, 0.3, 4, "2I65BYAB1", "DJCDX", 3, "NA IG", null, "IG", 1, 10, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("224423", "5673933", - "DJCDX-NAIGHVOLS3V1 - 0310", "Dow Jones CDX.NA.IG.HVOL.3", - "DJCDX_NA_IG_S3_HVOL_05Y_3/10", 2453270, 2455276, 0.0105, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AB9", "DJCDX", 3, "NA IG HVOL", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.10Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("224424", "5673976", - "DJCDX-NAIGHVOLS3V1 - 0315", "Dow Jones CDX.NA.IG.HVOL.3", - "DJCDX_NA_IG_S3_HVOL_10Y_3/15", 2453270, 2457102, 0.0125, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AB9", "DJCDX", 3, "NA IG HVOL", null, "HV", 1, 10, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.3Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("224441", "5675901", - "DJCDX-NAIGS3V1 - 0308", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_03Y_3/08", 2453270, 2454546, 0.0035, "USD", - "ACT/360", false, 0.3, 4, "2I65BYAB1", "DJCDX", 3, "NA IG", null, "IG", 1, 3, - null, 1, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.2Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("224444", "5675898", - "DJCDX-NAIGS3V1 - 0307", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_02Y_3/07", 2453270, 2454180, 0.0025, "USD", - "ACT/360", false, 0.3, 4, "2I65BYAB1", "DJCDX", 3, "NA IG", null, "IG", 1, 2, - null, 1, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.7Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("224446", "5675936", - "DJCDX-NAIGS3V1 - 0312", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_07Y_3/12", 2453270, 2456007, 0.006, "USD", - "ACT/360", false, 0.3, 4, "2I65BYAB1", "DJCDX", 3, "NA IG", null, "IG", 1, 7, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAREST.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("224456", "5678218", - "ITRAXX-ASIARESTS2V1 - 0310", "iTraxx Rest of Asia Series Number 2 Version 1", - "DJ ITRAXX REST OF ASIA SERIES 2 USD SEN RES I99CMS CDS", 2453269, 2455276, 0.007500000000000001, "USD", - "ACT/360", false, 0.3, 4, "2I668GAB2", "ITRAXX", 2, "ASIAREST", null, "IG", 1, 5, - null, 1, 13, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.7Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("224477", "5681073", - "DJCDX-NAIGHVOLS3V1 - 0312", "Dow Jones CDX.NA.IG.HVOL.3", - "DJCDX_NA_IG_S3_HVOL_07Y_3/12", 2453270, 2456007, 0.0115, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AB9", "DJCDX", 3, "NA IG HVOL", null, "HV", 1, 7, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG V1 ALLPTS.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("225382", "5885531", - "DJCDX-NAIGS3V1 ALLPTS - 0310", "Dow Jones CDX.NA.IG.3.ALLPTS", - "DJCDX_NA_IG_S3_ALLPTS", 2453270, 2455276, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAB1 ALLPTS", "DJCDX", 3, "NA IG V1 ALLPTS", null, "IG", 1, 5, - null, 1, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.2Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("225412", "5890705", - "DJCDX-NAIGS4V1 - 0607", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_02Y_6/07", 2453451, 2454272, 0.0015, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAD7", "DJCDX", 4, "NA IG", null, "IG", 1, 2, - null, 1, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.3Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("225413", "5890721", - "DJCDX-NAIGS4V1 - 0608", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_03Y_6/08", 2453451, 2454638, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAD7", "DJCDX", 4, "NA IG", null, "IG", 1, 3, - null, 1, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("225415", "5890233", - "DJCDX-NAIGS4V1 - 0610", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_05Y_6/10", 2453451, 2455368, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAD7", "DJCDX", 4, "NA IG", null, "IG", 1, 5, - null, 1, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.7Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("225416", "5890764", - "DJCDX-NAIGS4V1 - 0612", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_07Y_6/12", 2453451, 2456099, 0.0055000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAD7", "DJCDX", 4, "NA IG", null, "IG", 1, 7, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.10Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("225417", "5890772", - "DJCDX-NAIGS4V1 - 0615", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_10Y_6/15", 2453451, 2457194, 0.006500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAD7", "DJCDX", 4, "NA IG", null, "IG", 1, 10, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("225422", "5890306", - "DJCDX-NAIGHVOLS4V1 - 0610", "DOW JONES CDX.NA.IG.HVOL.4", - "DJCDX_NA_IG_S4_HVOL_05Y_6/10", 2453451, 2455368, 0.009000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AD5", "DJCDX", 4, "NA IG HVOL", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.10Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("225424", "5890861", - "DJCDX-NAIGHVOLS4V1 - 0615", "Dow Jones CDX.NA.IG.HVOL.4", - "DJCDX_NA_IG_S4_HVOL_10Y_6/15", 2453451, 2457194, 0.0115, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AD5", "DJCDX", 4, "NA IG HVOL", null, "HV", 1, 10, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.EM.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("225427", "5890217", - "DJCDX-EMS3V1 - 0610", "Dow Jones CDX.EM.3", - "DOW JONES CDX EM 3", 2453451, 2455368, 0.021, "USD", - "ACT/360", true, 0.25, 2, "2I65BZAC6", "DJCDX", 3, "EM", null, "EM", 1, 5, - null, 1, 14, 0, "LON", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG CONS.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("225430", "5890268", - "DJCDX-NAIGCONSS4V1 - 0610", "Dow Jones CDX.NA.IG.CONS.4", - "DOW JONES CDX NA IG CONS 4 06/10", 2453451, 2455368, 0.004, "USD", - "ACT/360", false, 0.5, 4, "2I65B0AD1", "DJCDX", 4, "NA IG CONS", null, "IG", 1, 5, - null, 1, 34, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG ENRG.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("225432", "5890276", - "DJCDX-NAIGENRGS4V1 - 0610", "Dow Jones CDX.NA.IG.ENRG.4", - "DJCDX_NA_IG_S4_ENRG_05Y_6/10", 2453451, 2455368, 0.004, "USD", - "ACT/360", false, 0.5, 4, "2I65B1AD9", "DJCDX", 4, "NA IG ENRG", null, "IG", 1, 5, - null, 1, 15, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG FIN.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("225433", "5890292", - "DJCDX-NAIGFINS4V1 - 0610", "Dow Jones CDX.NA.IG.FIN.4", - "DJCDX_NA_IG_S4_FIN_05Y_6/10", 2453451, 2455368, 0.004, "USD", - "ACT/360", false, 0.5, 4, "2I65B2AD7", "DJCDX", 4, "NA IG FIN", null, "IG", 1, 5, - null, 1, 23, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG INDU.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("225434", "5890314", - "DJCDX-NAIGINDUS4V1 - 0610", "Dow Jones CDX.NA.IG.INDU.4", - "DJCDX_NA_IG_S4_INDU_05Y_6/10", 2453451, 2455368, 0.004, "USD", - "ACT/360", false, 0.5, 4, "2I65B4AD3", "DJCDX", 4, "NA IG INDU", null, "IG", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG TMT.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("225435", "5890322", - "DJCDX-NAIGTMTS4V1 - 0610", "Dow Jones CDX.NA.IG.TMT.4", - "DOW JONES CDX NA IG TMT 4 06/10", 2453451, 2455368, 0.004, "USD", - "ACT/360", false, 0.5, 4, "2I65DJAD8", "DJCDX", 4, "NA IG TMT", null, "IG", 1, 5, - null, 1, 24, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.EM.10Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("225453", "5895324", - "DJCDX-EMS3V1 - 0615", "Dow Jones CDX.EM.3", - "DOW JONES CDX EM 3 06 15", 2453451, 2457194, 0.026000000000000002, "USD", - "ACT/360", false, 0.25, 4, "2I65BZAC6", "DJCDX", 3, "EM", null, "EM", 1, 10, - null, 1, 14, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.EMDIV.5Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("225542", "5910471", - "DJCDX-EMDIVS1V1 - 0610", "Dow Jones CDX.EM.DIVERSIFIED.1", - "DOW JONES CDX DIVER INDEX 06/20/10", 2453465, 2455368, 0.016, "USD", - "ACT/360", true, 0.25, 2, "2165EKAA7", "DJCDX", 1, "EMDIV", null, "EM", 1, 5, - null, 1, 40, 0, "LON", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY 4V9TST.5Y.4.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("225586", "5926661", - "DJCDX-NAHY4V9-TST - 0610", "DOW JONES CDX NA HY 4 TST1 100 FIXED 6/10", - "DOW JONES CDX NA HY 4 TST1 100 FIXED 6/10", 2453475, 2455368, 0.036000000000000004, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCI9-TST", "DJCDX", 4, "NA HY 4V9TST", null, "HY", 9, 5, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BBV6 FXD 38/43.5Y.4.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("225588", "5926688", - "CDX-NAHYBBS4V6 FXD 38/43 - 0610", "DOW JONES CDX.NA.HY.BB.4", - "CDX_NA_HY_S04_BB__FXD_38/43", 2453196, 2455368, 0.022500000000000003, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BVBQ3 FXD", "CDX", 4, "NA HY BBV6 FXD 38/43", null, "HY", 6, 5, - null, 0.88371, 43, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDXNAHYBS4V5 FXD 36/40.CDXNA HY BV5 FXD 36/40.5Y.4.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("225589", "5926696", - "CDXNAHYBS4V5 FXD 36/40 - 0610", "DOW JONES CDX NA HY 4 TST3 B FIXED 6/10", - "CDX_NA_HY_S04_B___FXD_36/40", 2453196, 2455368, 0.04, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BSCT3-FXD", "CDXNAHYBS4V5 FXD 36/40", 4, "CDXNA HY BV5 FXD 36/40", null, "HY", 5, 5, - null, 0.9, 40, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDXNA. HY NONBB.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("225590", "5926726", - "CDXNA-HYNONBB-S4V2 - 0610", "DOW JONES CDX NAHY S4 NON-BB S", - "DJCDX_NA_HY_S4 NON-BB SWP", 2453475, 2455368, 0.021, "USD", - "ACT/360", false, 0.3, 4, "2I65BVAC5-NonBB", "CDXNA", 4, "HY NONBB", null, "HY", 2, 5, - null, 0.97675, 42, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("225591", "5920566", - "DJCDX-NAHYS4V1 - 0610", "Dow Jones CDX.NA.HY.4", - "DJCDX_NA_HY_S4_100_SWP", 2453475, 2455368, 0.036000000000000004, "USD", - "ACT/360", false, 0.3, 4, "2I65BRAE0", "DJCDX", 4, "NA HY", null, "HY", 1, 5, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY BB.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("225592", "5920574", - "DJCDX-NAHYBBS4V1 - 0610", "DOW JONES CDX.NA.HY.BB.4", - "DJCDX_NA_HY_S4_BB__SWP", 2453475, 2455368, 0.021, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BVAC5", "DJCDX", 4, "NA HY BB", null, "HY", 1, 5, - null, 1, 43, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY B.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("225594", "5920582", - "DJCDX-NAHYBS4V1 - 0610", "DOW JONES CDX.NA.HY.B.4", - "DJCDX_NA_HY_S4_B___SWP", 2453475, 2455368, 0.034, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BSAE8", "DJCDX", 4, "NA HY B", null, "HY", 1, 5, - null, 1, 40, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY HB.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("225596", "5920590", - "DJCDX-NAHYHBS4V1 - 0610", "DOW JONES CDX.NA.HY.HB.4", - "DJCDX_NA_HY_S4_HB__SWP", 2453475, 2455368, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWAB5", "DJCDX", 4, "NA HY HB", null, "HY", 1, 5, - null, 1, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.5Y.3.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("228883", "5975492", - "DJCDX-NAHYS3V3 - 1209", "Dow Jones CDX.NA.HY.3", - "DJCDX_NA_HY_S3_100_SWP_99/100", 2453196, 2455186, 0.0375, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAG5", "DJCDX", 3, "NA HY", null, "HY", 3, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY HB.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("228884", "5975522", - "DJCDX-NAHYHBS3V2 - 1209", "DOW JONES CDX NAHY S3HB S 29/30", - "DJCDX_NA_HY_S3_HB__SWP_29/30", 2453196, 2455186, 0.0625, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BWAD1", "DJCDX", 3, "NA HY HB", null, "HY", 1, 5, - null, 0.9666, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY B.5Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("228885", "5975573", - "DJCDX-NAHYBS3V2 - 1209", "Dow Jones CDX.NA.HY.B.3", - "DJCDX_NA_HY_S3_B___SWP_43/44", 2453196, 2455186, 0.04, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BSAD0", "DJCDX", 3, "NA HY B", null, "HY", 2, 5, - null, 0.9772700000000001, 44, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("228893", "5975581", - "DJCDX-NAHYS4V2 - 0610", "DOW JONES CDX.NA.HY.4", - "DJCDX_NA_HY_S4_100_SWP_99/100", 2453475, 2455368, 0.036000000000000004, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAF7", "DJCDX", 4, "NA HY", null, "HY", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY HB.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("228895", "5975514", - "DJCDX-NAHYHBS4V2 - 0610", "Dow Jones CDX.NA.HY.HB.4", - "DJCDX_NA_HY_S4_HB__SWP_29/30", 2453475, 2455368, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BWAC3", "DJCDX", 4, "NA HY HB", null, "HY", 2, 5, - null, 0.9666, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V15 FXD 87/100.5Y.3.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("228899", "5978637", - "CDX-NAHYS3V15 FXD 87/100 - 1209", "Dow Jones CDX.NA.HY.3", - "CDX_NA_HY_S03_100_FXD_87/100", 2453196, 2455186, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGT1 FXD", "CDX", 3, "NA HY V15 FXD 87/100", null, "HY", 15, 5, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HBV8 FXD 23/30.5Y.3.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("228900", "5978645", - "CDX-NAHYHBS3V8 FXD 23/30 - 1209", "Dow Jones CDX.NA.HY.HB.3", - "CDX_NA_HY_S03_HB__FXD_23/30", 2453196, 2455186, 0.0625, "USD", - "ACT/360", false, 0.3, 4, "2I65BWEA3 FXD", "CDX", 3, "NA HY HBV8 FXD 23/30", null, "HY", 8, 5, - null, 0.7665000000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDXNAHYBS3V8 FXD 37/44.CDXNA HY BV8 FXD 37/44.5Y.3.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("228901", "5978661", - "CDXNAHYBS3V8 FXD 37/44 - 1209", "Dow Jones CDX.NA.HY.B.3", - "CDX_NA_HY_S03_B___FXD_37/44", 2453196, 2455186, 0.04, "USD", - "ACT/360", false, 0.3, 4, "2I65BSEC8 FXD", "CDXNAHYBS3V8 FXD 37/44", 3, "CDXNA HY BV8 FXD 37/44", null, "HY", 8, 5, - null, 0.8409000000000001, 44, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V16 FXD 86/100.5Y.4.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("228909", "5978998", - "CDX-NAHYS4V16 FXD 86/100 - 0610", "Dow Jones CDX.NA.HY.4", - "CDX_NA_HY_S04_100_FXD_86/100", 2453475, 2455368, 0.036000000000000004, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRGU8 FXD", "CDX", 4, "NA HY V16 FXD 86/100", null, "HY", 16, 5, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.5Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("228994", "6000843", - "DJCDX-NAHYS2V2 - 0909", "Dow Jones CDX.NA.HY.2", - "DJIBOXX_NA_HY_S2_100_SWP_99/100", 2453088, 2455095, 0.043000000000000003, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAL4", "DJCDX", 2, "NA HY", null, "HY", 2, 5, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet2() - { - UpdateCDXRefDataMap ("DJIBOXX.NA HY.5Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229323", "7025890", - "DJIBOXX-NA-HY-S2V2 - 0909", "Dow Jones IBOXX.NA.HY.2", - "DJIBOXX_NA_HY_S2_100_SWP_98/100", 2453088, 2455095, 0.043000000000000003, "USD", - "ACT/360", false, 0.35000000000000003, 4, "DJIBOXX-NA-HY-S2V2", "DJIBOXX", 2, "NA HY", null, "HY", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.EMDIV.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229340", "7034288", - "DJCDX-EMDIVS2V1 - 1210", "Dow Jones CDX.EM.DIVERSIFIED.2", - "DOW JONES CDX EM DIVER 2 5YR", 2453635, 2455551, 0.013000000000000001, "USD", - "ACT/360", true, 0.25, 2, "2165EKAB5", "DJCDX", 2, "EMDIV", null, "EM", 1, 5, - null, 1, 40, 0, "LON", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.EM.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229341", "7034237", - "DJCDX-EMS4V1 - 1210", "Dow Jones CDX.EM.4", - "DOW JONES CDX EM 4 5YR", 2453635, 2455551, 0.018000000000000002, "USD", - "ACT/360", true, 0.25, 2, "2I65BZAD4", "DJCDX", 4, "EM", null, "EM", 1, 5, - null, 1, 15, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.EM.10Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229342", "7034180", - "DJCDX-EMS4V1 - 1215", "Dow Jones CDX.EM.4", - "DOW JONES CDX EM 4 10YR", 2453635, 2457377, 0.0235, "USD", - "ACT/360", false, 0.25, 4, "2I65BZAD4", "DJCDX", 4, "EM", null, "EM", 1, 10, - null, 1, 15, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG CONS.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229343", "7034202", - "DJCDX-NAIGCONSS5V1 - 1210", "Dow Jones CDX.NA.IG.CONS.5", - "DJCDX_NA_IG_S5_CONS_12/10", 2453635, 2455551, 0.0055000000000000005, "USD", - "ACT/360", false, 0.5, 4, "2I65B0AE9", "DJCDX", 5, "NA IG CONS", null, "IG", 1, 5, - null, 1, 37, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG ENRG.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229344", "7034253", - "DJCDX-NAIGENRGS5V1 - 1210", "Dow Jones CDX.NA.IG.ENRG.5", - "DJCDX_NA_IG_S5_ENRG_12/10", 2453635, 2455551, 0.0035, "USD", - "ACT/360", false, 0.5, 4, "2I65B1AE7", "DJCDX", 5, "NA IG ENRG", null, "IG", 1, 5, - null, 1, 14, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG FIN.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229345", "7034296", - "DJCDX-NAIGFINS5V1 - 1210", "Dow Jones CDX.NA.IG.FIN.5", - "DJCDX_NA_IG_S5_FIN_12/10", 2453635, 2455551, 0.0035, "USD", - "ACT/360", false, 0.5, 4, "2I65B2AE5", "DJCDX", 5, "NA IG FIN", null, "IG", 1, 5, - null, 1, 24, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG INDU.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229346", "7034342", - "DJCDX-NAIGINDUS5V1 - 1210", "Dow Jones CDX.NA.IG.INDU.5", - "DJCDX_NA_IG_S5_INDU_12/10", 2453635, 2455551, 0.005, "USD", - "ACT/360", false, 0.5, 4, "2I65B4AE1", "DJCDX", 5, "NA IG INDU", null, "IG", 1, 5, - null, 1, 28, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG TMT.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229347", "7034407", - "DJCDX-NAIGTMTS5V1 - 1210", "Dow Jones CDX.NA.IG.TMT.5", - "DJCDX_NA_IG_S5_TMT_12/10", 2453635, 2455551, 0.0045000000000000005, "USD", - "ACT/360", false, 0.5, 4, "2I65DJAE6", "DJCDX", 5, "NA IG TMT", null, "IG", 1, 5, - null, 1, 24, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.1Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229348", "7034474", - "DJCDX-NAIGS5V1 - 1206", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_01Y_12/06", 2453635, 2454090, 0.001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAE5", "DJCDX", 5, "NA IG", null, "IG", 1, 1, - null, 1, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.3Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229350", "7034156", - "DJCDX-NAIGS5V1 - 1208", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_03Y_12/08", 2453635, 2454821, 0.003, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAE5", "DJCDX", 5, "NA IG", null, "IG", 1, 3, - null, 1, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.4Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229351", "7034482", - "DJCDX-NAIGS5V1 - 1209", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_04Y_12/09", 2453635, 2455186, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAE5", "DJCDX", 5, "NA IG", null, "IG", 1, 4, - null, 1, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229352", "7034490", - "DJCDX-NAIGS5V1 - 1210", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_05Y_12/10", 2453635, 2455551, 0.0045000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAE5", "DJCDX", 5, "NA IG", null, "IG", 1, 5, - null, 1, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.7Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229353", "7034326", - "DJCDX-NAIGS5V1 - 1212", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_07Y_12/12", 2453635, 2456282, 0.0055000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAE5", "DJCDX", 5, "NA IG", null, "IG", 1, 7, - null, 1, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.10Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229354", "7034334", - "DJCDX-NAIGS5V1 - 1215", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_10Y_12/15", 2453635, 2457377, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAE5", "DJCDX", 5, "NA IG", null, "IG", 1, 10, - null, 1, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.1Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229355", "7034369", - "DJCDX-NAIGHVOLS5V1 - 1206", "Dow Jones CDX.NA.IG.HVOL.5", - "DJCDX_NA_IG_S5_HVOL_01Y_12/06", 2453635, 2454090, 0.0025, "USD", - "ACT/360", false, 0.5, 4, "2I65B3AE3", "DJCDX", 5, "NA IG HVOL", null, "HV", 1, 1, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.2Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229356", "7034385", - "DJCDX-NAIGHVOLS5V1 - 1207", "Dow Jones CDX.NA.IG.HVOL.5", - "DJCDX_NA_IG_S5_HVOL_02Y_12/07", 2453635, 2454455, 0.004, "USD", - "ACT/360", false, 0.5, 4, "2I65B3AE3", "DJCDX", 5, "NA IG HVOL", null, "HV", 1, 2, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.3Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229357", "7034059", - "DJCDX-NAIGHVOLS5V1 - 1208", "Dow Jones CDX.NA.IG.HVOL.5", - "DJCDX_NA_IG_S5_HVOL_03Y_12/08", 2453635, 2454821, 0.0055000000000000005, "USD", - "ACT/360", false, 0.5, 4, "2I65B3AE3", "DJCDX", 5, "NA IG HVOL", null, "HV", 1, 3, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.4Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229358", "7034210", - "DJCDX-IGHVS5V1 - 1209", "Dow Jones CDX.NA.IG.HVOL.5", - "DJCDX_NA_IG_S5_HVOL_04Y_12/09", 2453635, 2455186, 0.006, "USD", - "ACT/360", false, 0.5, 4, "2I65B3AE3", "DJCDX", 5, "NA IG HVOL", null, "HV", 1, 4, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229359", "7034512", - "DJCDX-NAIGHVOLS5V1 - 1210", "Dow Jones CDX.NA.IG.HVOL.5", - "DJCDX_NA_IG_S5_HVOL_05Y_12/10", 2453635, 2455551, 0.0085, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AE3", "DJCDX", 5, "NA IG HVOL", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.7Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229360", "7034555", - "DJCDX-NAIGHVOLS5V1 - 1212", "Dow Jones CDX.NA.IG.HVOL.5", - "DJCDX_NA_IG_S5_HVOL_07Y_12/12", 2453635, 2456282, 0.0105, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AE3", "DJCDX", 5, "NA IG HVOL", null, "HV", 1, 7, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.10Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229361", "7034091", - "DJCDX-NAIGHVOLS5V1 - 1215", "Dow Jones CDX.NA.IG.HVOL.5", - "DJCDX_NA_IG_S5_HVOL_10Y_12/15", 2453635, 2457377, 0.012, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AE3", "DJCDX", 5, "NA IG HVOL", null, "HV", 1, 10, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229362", "7033761", - "DJCDX-NAHYS5V1 - 1210", "Dow Jones CDX.NA.HY.5", - "DJCDX_NA_HY_S5_100_SWP", 2453651, 2455551, 0.0395, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAH3", "DJCDX", 5, "NA HY", null, "HY", 1, 5, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V18 FXD 85/100.5Y.5.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229363", "7033788", - "CDX-NAHYS5V18 FXD 85/100 - 1210", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_FXD_85/100", 2453651, 2455566, 0.0395, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRGZ7 FXD", "CDX", 5, "NA HY V18 FXD 85/100", null, "HY", 18, 5, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY BB.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229364", "7033796", - "DJCDX-NAHYBBS5V1 - 1210", "Dow Jones CDX.NA.HY.BB.5", - "DJCDX_NA_HY_S5_BB_SWP", 2453651, 2455551, 0.025, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BVAE1", "DJCDX", 5, "NA HY BB", null, "HY", 1, 5, - null, 1, 41, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BBV6 FXD 36/41.5Y.5.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229365", "7033818", - "CDX-NAHYBBS5V6 FXD 36/41 - 1210", "Dow Jones CDX.NA.HY.BB.5", - "CDX_NA_HY_S05_BB__FXD_36/41", 2453651, 2455566, 0.025, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BVBS9 FXD", "CDX", 5, "NA HY BBV6 FXD 36/41", null, "HY", 6, 5, - null, 0.87804, 41, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY B.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229366", "7033826", - "DJCDX-NAHYBS5V1 - 1210", "Dow Jones CDX.NA.HY.B.5", - "DJCDX_NA_HY_S5_B_SWP", 2453651, 2455551, 0.034, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BSAH1", "DJCDX", 5, "NA HY B", null, "HY", 1, 5, - null, 1, 42, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BV6 FXD 37/42.5Y.5.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229367", "7033834", - "CDX-NAHYBS5V6 FXD 37/42 - 1210", "Dow Jones CDX.NA.HY.5 B", - "CDX_NA_HY_S05_B___FXD_37/42", 2453651, 2455566, 0.034, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BSDT2 FXD", "CDX", 5, "NA HY BV6 FXD 37/42", null, "HY", 6, 5, - null, 0.881, 42, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY HB.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229368", "7033842", - "DJCDX-NAHYHBS5V1 - 1210", "Dow Jones CDX.NA.HY.HB.5", - "DJCDX_NA_HY_S5_HB_SWP", 2453651, 2455551, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BWAE9", "DJCDX", 5, "NA HY HB", null, "HY", 1, 5, - null, 1, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HBV14 FXD 19/30.5Y.5.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229369", "7033850", - "CDX-NAHYHBS5V14 FXD 19/30 - 1210", "Dow Jones CDX.NA.HY.HB.5", - "CDX_NA_HY_S05_HB__FXD_19/30", 2453651, 2455551, 0.0395, "USD", - "ACT/360", false, 0.5, 4, "2I65BWEK1 FXD", "CDX", 5, "NA HY HBV14 FXD 19/30", null, "HY", 14, 5, - null, 0.6332, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG V1 ALLPTS.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229371", "7036663", - "DJCDX-NAIGS5V1 ALLPTS - 1210", "DOW JONES CDX NA IG S5 - ALLPTS", - "DJCDX_NA_IG_S5_ALLPTS", 2453635, 2455551, 0.001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAE5 ALLPTS", "DJCDX", 5, "NA IG V1 ALLPTS", null, "IG", 1, 5, - null, 1, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NAXO.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229372", "7036647", - "DJCDX-NAXOS5V1 - 1210", "Dow Jones CDX.NA.XO.5", - "DJCDX_NA_XO_S5_05Y_12/10", 2453635, 2455551, 0.02, "USD", - "ACT/360", false, 0.4, 4, "1D764IAA5", "DJCDX", 5, "NAXO", null, "XO", 1, 5, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NAXOHVOL.3Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229380", "7038194", - "DJCDX-NAXOHVOLS5V1 - 1208", "Dow Jones CDX.NA.XO.HVOL.5", - "DJCDX_NA_XO_S5_HVOL", 2453635, 2454821, 0.02, "USD", - "ACT/360", false, 0.5, 4, "1D764IAB3-HV", "DJCDX", 5, "NAXOHVOL", null, "XO", 1, 3, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NAXO.3Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229388", "7044402", - "DJCDX-NAXOS5V1 - 1208", "Dow Jones CDX.NA.XO.5", - "DJ_CDX_NA_XO_S5_03YR_12/08", 2453635, 2454821, 0.02, "USD", - "ACT/360", false, 0.5, 4, "1D764IAA5", "DJCDX", 5, "NAXO", null, "XO", 1, 3, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NAXO.7Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229389", "7044429", - "DJCDX-NAXOS5V1 - 1212", "Dow Jones CDX.NA.XO.5", - "DJ_CDX_NA_XO_S5_07YR_12/12", 2453635, 2456282, 0.02, "USD", - "ACT/360", false, 0.5, 4, "1D764IAA5", "DJCDX", 5, "NAXO", null, "XO", 1, 7, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NAXO.10Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229390", "7044445", - "DJCDX-NAXOS5V1 - 1215", "Dow Jones CDX.NA.XO.5", - "DJ_CDX_NA_XO_S5_10YR_12/15", 2453635, 2457377, 0.024, "USD", - "ACT/360", false, 0.5, 4, "1D764IAA5", "DJCDX", 5, "NAXO", null, "XO", 1, 10, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.5Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229412", "7051166", - "DJCDX-NAIGS2V2 - 0909", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_05Y_9/09_124/125", 2453088, 2455095, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAG0", "DJCDX", 2, "NA IG", null, "IG", 2, 5, - null, 0.9920000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.5Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229413", "7050887", - "DJCDX-NAIGHVOLS2V2 - 0909", "Dow Jones CDX.NA.IG HVOL.2", - "DJCDX_NA_IG_S2_HVOL_05Y_9/09_29/30", 2453088, 2455095, 0.0115, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AG8", "DJCDX", 2, "NA IG HVOL", null, "HV", 2, 5, - null, 0.9667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.10Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229414", "7050895", - "DJCDX-NAIGS2V2 - 0914", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_10Y_9/14_124/125", 2453088, 2456921, 0.008, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAG0", "DJCDX", 2, "NA IG", null, "IG", 2, 10, - null, 0.9920000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.10Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229415", "7050917", - "DJCDX-NAIGHVOLS2V2 - 0914", "Dow Jones CDX.NA.IG HVOL.2", - "DJCDX_NA_IG_S2_HVOL_10Y_9/14_29/30", 2453088, 2456921, 0.013000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AG8", "DJCDX", 2, "NA IG HVOL", null, "HV", 2, 10, - null, 0.9667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.10Y.1.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229416", "7050925", - "DJCDX-NAIGS1V2 - 0314", "Dow Jones CDX.NA.IG", - "DJCDX_NA_IG_S1_10Y_3/14_124/125", 2452934, 2456737, 0.007, "USD", - "ACT/360", false, 0.5, 4, "2I65BYAH8", "DJCDX", 1, "NA IG", null, "IG", 2, 10, - null, 0.9920000000000001, 124, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG INDU.5Y.1.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229417", "7050933", - "DJCDX-NAIGINDUS1V2 - 0309", "Dow Jones CDX.NA.IG INDU", - "DJCDX_NA_IG_S1_INDU_05Y_3/09_29/30", 2452934, 2454911, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65B4AH4", "DJCDX", 1, "NA IG INDU", null, "IG", 2, 5, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.2Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229418", "7050992", - "DJCDX-NAIGS2V2 - 0906", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_02Y_9/06_124/125", 2453088, 2453999, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAG0", "DJCDX", 2, "NA IG", null, "IG", 2, 2, - null, 0.9920000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.3Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229419", "7051034", - "DJCDX-NAIGS2V2 - 0907", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_03Y_9/07_124/125", 2453088, 2454364, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAG0", "DJCDX", 2, "NA IG", null, "IG", 2, 3, - null, 0.9920000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.7Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229420", "7051069", - "DJCDX-NAIGS2V2 - 0911", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_07Y_9/11_124/125", 2453088, 2455825, 0.006, "USD", - "ACT/360", false, 0.5, 4, "2I65BYAG0", "DJCDX", 2, "NA IG", null, "IG", 2, 7, - null, 0.9920000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL2.2Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229421", "7051085", - "DJCDX-NAIGHVOL2V2 - 0906", "Dow Jones CDX.NA.IG HVOL.2", - "DJCDX_NA_IG_S2_HVOL_02Y_9/06_29/30", 2453088, 2453999, 0.0115, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AG8", "DJCDX", 2, "NA IG HVOL2", null, "HV", 2, 2, - null, 0.9667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL2.3Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229422", "7051093", - "DJCDX-NAIGHVOL2V2 - 0907", "Dow Jones CDX.NA.IG.HVOL.2", - "DJCDX_NA_IG_S2_HVOL_03Y_9/07_29/30", 2453088, 2454364, 0.0115, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AG8", "DJCDX", 2, "NA IG HVOL2", null, "HV", 2, 3, - null, 0.9667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.7Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229423", "7051107", - "DJCDX-NAIGHVOLS2V2 - 0911", "Dow Jones CDX.NA.IG.HVOL.2", - "DJCDX_NA_IG_S2_HVOL_07Y_9/11_29/30", 2453088, 2455825, 0.0115, "USD", - "ACT/360", false, 0.5, 4, "2I65B3AG8", "DJCDX", 2, "NA IG HVOL", null, "HV", 2, 7, - null, 0.9667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.10Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229425", "7051123", - "DJCDX-NAIGS3V2 - 0315", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_10Y_3/15_124/125", 2453270, 2457102, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAF2", "DJCDX", 3, "NA IG", null, "IG", 2, 10, - null, 0.9920000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.5Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229426", "7051131", - "DJCDX-NAIGHVOLS3V2 - 0310", "Dow Jones CDX.NA.IG.HVOL.3", - "DJCDX_NA_IG_S3_HVOL_05Y_3/10_29/30", 2453270, 2455278, 0.0105, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AF0", "DJCDX", 3, "NA IG HVOL", null, "HV", 2, 5, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.10Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229427", "7052278", - "DJCDX-NAIGHVOLS3V2 - 0315", "Dow Jones CDX.NA.IG.HVOL.3", - "DJCDX_NA_IG_S3_HVOL_10Y_3/15_29/30", 2453270, 2457102, 0.0125, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AF0", "DJCDX", 3, "NA IG HVOL", null, "HV", 2, 10, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.1Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229428", "7052286", - "DJCDX-NAIGS3V2 - 0306", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_01Y_3/06_124/125", 2453270, 2453815, 0.0015, "USD", - "ACT/360", false, 0.5, 4, "2I65BYAF2", "DJCDX", 3, "NA IG", null, "IG", 2, 1, - null, 0.9920000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.2Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229429", "7052294", - "DJCDX-NAIGS3V2 - 0307", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_02Y_3/07_124/125", 2453270, 2454180, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAF2", "DJCDX", 3, "NA IG", null, "IG", 2, 2, - null, 0.9920000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG 3.4Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229430", "7052308", - "DJCDX-NAIG3V2 - 0308", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_03Y_3/08_124/125", 2453270, 2454546, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAF2", "DJCDX", 3, "NA IG 3", null, "IG", 2, 4, - null, 0.9920000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.4Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229431", "7052316", - "DJCDX-NAIGS3V2 - 0309", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_04Y_3/09_124/125", 2453270, 2454911, 0.0045000000000000005, "USD", - "ACT/360", false, 0.5, 4, "2I65BYAF2", "DJCDX", 3, "NA IG", null, "IG", 2, 4, - null, 0.9920000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.7Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229432", "7052324", - "DJCDX-NAIGS3V2 - 0312", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_07Y_3/12_124/125", 2453270, 2456007, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAF2", "DJCDX", 3, "NA IG", null, "IG", 2, 7, - null, 0.9920000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.1Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229433", "7052340", - "DJCDX-NAIGHVOL3V2 - 0307", "Dow Jones CDX.NA.IG.HVOL.3", - "DJCDX_NA_IG_S3_HVOL_01Y_3/06_29/30", 2453270, 2454180, 0.005, "USD", - "ACT/360", false, 0.5, 4, "2I65B3AF0", "DJCDX", 3, "NA IG HVOL", null, "HV", 2, 1, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.5Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229436", "7055080", - "DJCDX-NAIGHVOL3V2 - 0309", "Dow Jones CDX.NA.IG.HVOL.3", - "DJCDX_NA_IG_S3_HVOL_04Y_3/09_29/30", 2453270, 2454911, 0.009000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AF0", "DJCDX", 3, "NA IG HVOL", null, "HV", 2, 5, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.7Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229437", "7055099", - "DJCDX-NAIGHVOLS3V2 - 0312", "Dow Jones CDX.NA.IG.HVOL.3", - "DJCDX_NA_IG_S3_HVOL_07Y_3/12_29/30", 2453270, 2456007, 0.0115, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AF0", "DJCDX", 3, "NA IG HVOL", null, "HV", 2, 7, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOLV1 ALLPTS.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229439", "7055110", - "DJCDX-NAIGHVOLS3V1 ALLPTS - 0310", "Dow Jones CDX.NA.IG.HVOL.3.ALLPTS", - "DJCDX_NA_IG_S3_HVOL_ALLPTS_29/30", 2453270, 2455276, 0.0105, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AB9 ALLPTS", "DJCDX", 3, "NA IG HVOLV1 ALLPTS", null, "HV", 1, 5, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY HB.5Y.4.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229441", "7055153", - "DJCDX-NAHYHBS4V3 - 0610", "Dow Jones CDX.NA.HY.HB.4", - "DJCDX_NA_HY_S4_HB__SWP_28/30", 2453475, 2455368, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BWAG4", "DJCDX", 4, "NA HY HB", null, "HY", 3, 5, - null, 0.9331999999999999, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.5Y.1.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229451", "7050941", - "DJCDX-NAIGHVOLS1V2 - 0309", "Dow Jones CDX.NA.IG HVOL.1", - "DJCDX_NA_IG_S1_HIVOL_05Y_3/09_29/30", 2452934, 2454911, 0.0125, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AH6", "DJCDX", 1, "NA IG HVOL", null, "HV", 2, 5, - null, 0.9413, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.5Y.1.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229452", "7050984", - "DJCDX-NAIGS1V2 - 0309", "Dow Jones CDX.NA.IG", - "DJCDX_NA_IG_S1_5Y_3/09_124/125", 2452934, 2454911, 0.006, "USD", - "ACT/360", false, 0.5, 4, "2I65BYAH8", "DJCDX", 1, "NA IG", null, "IG", 2, 5, - null, 0.9920000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY BB.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229454", "7055145", - "DJCDX-NAHYBBS4V2 - 0610", "DOW JONES CDX.NA.HY.BB.4", - "DJCDX_NA_HY_S4_BB_SWP_42/43", 2453475, 2455368, 0.021, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BVAF8", "DJCDX", 4, "NA HY BB", null, "HY", 2, 5, - null, 0.97674, 43, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.5Y.4.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229455", "7055161", - "DJCDX-NAHYS4V3 - 0610", "DOW JONES CDX.NA.HY.4", - "DJCDX_NA_HY_S4_100_SWP_98/100", 2453475, 2455368, 0.036000000000000004, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAJ9", "DJCDX", 4, "NA HY", null, "HY", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.5Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229462", "7062664", - "DJCDX-NAHYS5V2 - 1210", "Dow Jones CDX.NA.HY.5", - "DJCDX_NA_HY_S5_100_SWP_99/100", 2453651, 2455551, 0.0395, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAI1", "DJCDX", 5, "NA HY", null, "HY", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY HB.5Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229463", "7062672", - "DJCDX-NAHYHBS5V2 - 1210", "Dow Jones CDX.NA.HY.HB.5", - "DJCDX_NA_HY_S5_HB_SWP_29/30", 2453651, 2455551, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BWAF6", "DJCDX", 5, "NA HY HB", null, "HY", 2, 5, - null, 0.9666, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY 100 S.3Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229532", "7175760", - "DJCDX-NAHYS5-100 S-V2 - 1208", "Dow Jones CDX.NA.HY.5 12/08 99/100", - "DJCDX_NA_HY_S5_100_SWP_03Y_12/08_99/100", 2453651, 2454821, 0.0395, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAI1", "DJCDX", 5, "NA HY 100 S", null, "HY", 2, 3, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.5Y.3.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229549", "7191995", - "DJCDX-NAHYS3V4 - 1209", "Dow Jones CDX.NA.HY.3 100 S 98/100", - "DJCDX_NA_HY_S3_100_SWP_98/100", 2453196, 2455186, 0.0375, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAM2", "DJCDX", 3, "NA HY", null, "HY", 4, 5, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY HB.5Y.3.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229550", "7192002", - "DJCDX-NAHYHBS3V3 - 1209", "Dow Jones CDX.NA.HY.3 HB S 28/30", - "DJCDX_NA_HY_S3_HB__SWP_28/30", 2453196, 2455186, 0.0625, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BWAH2", "DJCDX", 3, "NA HY HB", null, "HY", 3, 5, - null, 0.9331999999999999, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.5Y.4.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229552", "7192029", - "DJCDX-NAHYS4V4 - 0610", "Dow Jones CDX.NA.HY.4", - "DJCDX_NA_HY_S4_100_SWP_97/100", 2453475, 2455368, 0.036000000000000004, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAN0", "DJCDX", 4, "NA HY", null, "HY", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY HB.5Y.4.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229553", "7192150", - "DJCDX-NAHYHBS4V4 - 0610", "Dow Jones CDX.NA.HY.HB.4", - "DJCDX_NA_HY_S4_HB__SWP_27/30", 2453475, 2455368, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BWAI0", "DJCDX", 4, "NA HY HB", null, "HY", 4, 5, - null, 0.8998, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY V2 ALLPTS.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229554", "7192169", - "DJCDX-NAHYS4V2 ALLPTS - 0610", "Dow Jones CDX.NA.HY.4.ALLPTS", - "DJCDX_NA_HY_S4-ALL PTS_99/100", 2453475, 2455368, 0, "USD", - "ACT/360", false, 0.5, 4, "2I65BRAF7 ALLPTS", "DJCDX", 4, "NA HY V2 ALLPTS", null, "HY", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY 100 S.3Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229555", "7192177", - "DJCDX-NAHYS5-100 S-V3 - 1208", "Dow Jones CDX.NA.HY.5 100S 12/8 98/100", - "DJCDX_NA_HY_S5_100_SWP_03Y_12/08_98/100", 2453651, 2454821, 0.0395, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAO7", "DJCDX", 5, "NA HY 100 S", null, "HY", 3, 3, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.5Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229556", "7192185", - "DJCDX-NAHYS5V3 - 1210", "Dow Jones CDX.NA.HY.5", - "DJCDX_NA_HY_S5_100_SWP_98/100", 2453651, 2455551, 0.0395, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAO7", "DJCDX", 5, "NA HY", null, "HY", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY V3 ALLPTS.5Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229557", "7192428", - "DJCDX-NAHYS5V3 ALLPTS - 1210", "Dow Jones CDX.NA.HY.5.ALLPTS", - "DJCDX_NA_HY_S5_ALLPTS_98/100", 2453651, 2455551, 0, "USD", - "ACT/360", false, 0.5, 4, "2I65BRAO7 ALLPTS", "DJCDX", 5, "NA HY V3 ALLPTS", null, "HY", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJIBOXX.NA HY.5Y.2.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229558", "7192436", - "DJIBOXX-NA-HY-S2V3 - 0909", "Dow Jones CDX.NA.HY.2", - "DJIBOXX_NA_HY_S2_100_SWP_97/100", 2453088, 2455095, 0.043000000000000003, "USD", - "ACT/360", false, 0.35000000000000003, 4, "DJIBOXX-NA-HY-S2V3", "DJIBOXX", 2, "NA HY", null, "HY", 3, 5, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BBV5 FXD 39/43.5Y.3.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229627", "7203713", - "CDX-NAHYBBS3V5 FXD 39/43 - 1209", "Dow Jones CDX.NA.HY.BB.3", - "CDX_NA_HY_S03_BB__FXD_39/43", 2453196, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBN0 FXD", "CDX", 3, "NA HY BBV5 FXD 39/43", null, "HY", 5, 5, - null, 0.90697, 43, 0, "NYC", false, false, false, null, "DJCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet3() - { - UpdateCDXRefDataMap ("TRACXNA.V2 SWP EUR.5Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229635", "7203780", - "TRACXNA-S2V2 SWP EUR - 0309", "DOW JONES TRACX NAIG S2 3/09 S EUR", - "TRACX_NA_IG_S2_05Y_3/09_SWP_EUR", 2452916, 2454911, 0.01, "USD", - "ACT/360", false, 0, 4, "2I65EUAB6-EUR", "TRACXNA", 2, "V2 SWP EUR", null, "IG", 2, 5, - null, 1, 100, 0, "NYC", false, false, true, null, "Trac-X")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.5Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229672", "7206674", - "DJCDX-NAIGS3V2 - 0310", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_05Y_3/10_124/125", 2453270, 2455276, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAF2", "DJCDX", 3, "NA IG", null, "IG", 2, 5, - null, 0.9920000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG V2 EUR.2Y.3.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229674", "7206690", - "DJCDX-NAIGS3V2 EUR - 0310", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_05Y_3/10_124/125_EUR", 2453270, 2455276, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYAF2 EUR", "DJCDX", 3, "NA IG V2 EUR", null, "IG", 3, 2, - null, 0.9920000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG V1 EUR.1Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229725", "7209738", - "DJCDX-NAIGS3V1 EUR - 0310", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_05Y_3/10_EUR", 2453270, 2455276, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYAB1 EUR", "DJCDX", 3, "NA IG V1 EUR", null, "IG", 2, 1, - null, 1, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG V1 EUR.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("229726", "7209746", - "DJCDX-NAIGS4V1 EUR - 0610", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_05Y_6/10_EUR", 2453451, 2455368, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYAD7 EUR", "DJCDX", 4, "NA IG V1 EUR", null, "IG", 1, 5, - null, 1, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DUMMY.DUMMY.1Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("240558", "8786291", - "DUMMY - 1216", "CH CMBX-NA-AAA 3", - "CH CMBX-NA-AAA 3 MR", 2454216, 2457748, 8.0E-4, "USD", - "ACT/360", false, 0, 4, "DUMMY", "DUMMY", 3, "DUMMY", null, "IG", 1, 1, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DUMMY AJ.DUMMY AJ.1Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("242918", "9049208", - "DUMMY AJ - 1216", "CH.CMBX.NA.AJ.4", - "CH.CMBX.NA.AJ.4 MR", 2454216, 2457748, 8.0E-4, "USD", - "ACT/360", false, 0, 4, "DUMMY AJ", "DUMMY AJ", 4, "DUMMY AJ", null, "IG", 1, 1, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEc.7Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244387", "9349238", - "ITRAXX-EUROPES3cV2 - 0612", "iTraxx Europe Series 3c Version 2", - "ITRAXX-EUROPES3CV2-0612 EUR SEN MMR I03 CDS", 2453451, 2456099, 0.0045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYJ3", "ITRAXX", 3, "EUROPEc", null, "IG", 2, 7, - null, 0.9920000000000001, 124, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEb.7Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244388", "9349222", - "ITRAXX-EUROPES5bV2 - 0613", "iTraxx Europe Series 5b Version 2", - "ITRAXX-EUROPES5BV2-0613 EUR SEN MMR I03 CDS", 2453815, 2456464, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYL2", "ITRAXX", 5, "EUROPEb", null, "IG", 2, 7, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEc.7Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244389", "9349278", - "ITRAXX-EUROPES5cV2 - 0613", "iTraxx Europe Series 5c Version 2", - "ITRAXX-EUROPES5CV2-0613 EUR SEN MMR I03 CDS", 2453815, 2456464, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYL3", "ITRAXX", 5, "EUROPEc", null, "IG", 2, 7, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEc.10Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244390", "9349239", - "ITRAXX-EUROPES3cV2 - 0615", "iTraxx Europe Series 3c Version 2", - "ITRAXX-EUROPES3CV2-0615 EUR SEN MMR I03 CDS", 2453451, 2457194, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYJ3", "ITRAXX", 3, "EUROPEc", null, "IG", 2, 10, - null, 0.9920000000000001, 124, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEb.10Y.1.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244391", "9349052", - "ITRAXX-EUROPES1bV2 - 0914", "iTraxx Europe Series 1b Version 2", - "ITRAXX-EUROPES1BV2-0914 EUR SEN MMR I03 CDS", 2453179, 2456921, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYH2", "ITRAXX", 1, "EUROPEb", null, "IG", 2, 10, - null, 0.9920000000000001, 124, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEc.10Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244392", "9349280", - "ITRAXX-EUROPES5cV2 - 0616", "iTraxx Europe Series 5c Version 2", - "ITRAXX-EUROPES5CV2-0616 EUR SEN MMR I03 CDS", 2453815, 2457560, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYL3", "ITRAXX", 5, "EUROPEc", null, "IG", 2, 10, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEa.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244393", "9349242", - "ITRAXX-EUROPES4aV2 - 1210", "iTraxx Europe Series 4a Version 2", - "ITRAXX-EUROPES4AV2-1210 EUR SEN MMR I03 CDS", 2453634, 2455551, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYK1", "ITRAXX", 4, "EUROPEa", null, "IG", 2, 5, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEa.3Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244394", "9349285", - "ITRAXX-EUROPES6aV2 - 1209", "iTraxx Europe Series 6a Version 2", - "ITRAXX-EUROPES6AV2-1209 EUR SEN MMR I03 CDS", 2453999, 2455186, 0.002, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYM1", "ITRAXX", 6, "EUROPEa", null, "IG", 2, 3, - null, 0.9920000000000001, 122, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEc.10Y.1.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244395", "9349054", - "ITRAXX-EUROPES1cV2 - 0914", "iTraxx Europe Series 1c Version 2", - "ITRAXX-EUROPES1CV2-0914 EUR SEN MMR I03 CDS", 2453179, 2456921, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYH3", "ITRAXX", 1, "EUROPEc", null, "IG", 2, 10, - null, 0.9920000000000001, 124, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEc.3Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244396", "9349313", - "ITRAXX-EUROPES6cV2 - 1209", "iTraxx Europe Series 6c Version 2", - "ITRAXX-EUROPES6CV2-1209 EUR SEN MMR I03 CDS", 2453999, 2455186, 0.002, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYM3", "ITRAXX", 6, "EUROPEc", null, "IG", 2, 3, - null, 0.9920000000000001, 122, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEc.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244397", "9349243", - "ITRAXX-EUROPES4cV2 - 1210", "iTraxx Europe Series 4c Version 2", - "ITRAXX-EUROPES4CV2-1210 EUR SEN MMR I03 CDS", 2453634, 2455551, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYK3", "ITRAXX", 4, "EUROPEc", null, "IG", 2, 5, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEa.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244398", "9349314", - "ITRAXX-EUROPES6aV2 - 1211", "iTraxx Europe Series 6a Version 2", - "ITRAXX-EUROPES6AV2-1211 EUR SEN MMR I03 CDS", 2453999, 2455916, 0.003, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYM1", "ITRAXX", 6, "EUROPEa", null, "IG", 2, 5, - null, 0.9920000000000001, 122, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEc.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244399", "9349262", - "ITRAXX-EUROPES6cV2 - 1211", "iTraxx Europe Series 6c Version 2", - "ITRAXX-EUROPES6CV2-1211 EUR SEN MMR I03 CDS", 2453999, 2455916, 0.003, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYM3", "ITRAXX", 6, "EUROPEc", null, "IG", 2, 5, - null, 0.9920000000000001, 122, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEa.5Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244400", "9349196", - "ITRAXX-EUROPES2aV2 - 0310", "iTraxx Europe Series 2a Version 2", - "ITRAXX-EUROPES2AV2-0310 EUR SEN MMR I03 CDS", 2453269, 2455276, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYI1", "ITRAXX", 2, "EUROPEa", null, "IG", 2, 5, - null, 0.9920000000000001, 125, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEb.7Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244401", "9349263", - "ITRAXX-EUROPES6bV2 - 1213", "iTraxx Europe Series 6b Version 2", - "ITRAXX-EUROPES6BV2-1213 EUR SEN MMR I03 CDS", 2453999, 2456647, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYM2", "ITRAXX", 6, "EUROPEb", null, "IG", 2, 7, - null, 0.9920000000000001, 122, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEc.5Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244402", "9349198", - "ITRAXX-EUROPES2cV2 - 0310", "iTraxx Europe Series 2c Version 2", - "ITRAXX-EUROPES2CV2-0310 EUR SEN MMR I03 CDS", 2453269, 2455276, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYI3", "ITRAXX", 2, "EUROPEc", null, "IG", 2, 5, - null, 0.9920000000000001, 125, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEc.7Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244403", "9349267", - "ITRAXX-EUROPES6cV2 - 1213", "iTraxx Europe Series 6c Version 2", - "ITRAXX-EUROPES6CV2-1213 EUR SEN MMR I03 CDS", 2453999, 2456647, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYM3", "ITRAXX", 6, "EUROPEc", null, "IG", 2, 7, - null, 0.9920000000000001, 122, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEa.7Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244404", "9349200", - "ITRAXX-EUROPES2aV2 - 0312", "iTraxx Europe Series 2a Version 2", - "ITRAXX-EUROPES2AV2-0312 EUR SEN MMR I03 CDS", 2453269, 2456007, 0.0037500000000000003, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYI1", "ITRAXX", 2, "EUROPEa", null, "IG", 2, 7, - null, 0.9920000000000001, 125, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEc.7Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244405", "9349241", - "ITRAXX-EUROPES2cV2 - 0312", "iTraxx Europe Series 2c Version 2", - "ITRAXX-EUROPES2CV2-0312 EUR SEN MMR I03 CDS", 2453269, 2456007, 0.0037500000000000003, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYI3", "ITRAXX", 2, "EUROPEc", null, "IG", 2, 7, - null, 0.9920000000000001, 125, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEc.10Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244406", "9349269", - "ITRAXX-EUROPES6cV2 - 1216", "iTraxx Europe Series 6c Version 2", - "ITRAXX-EUROPES6CV2-1216 EUR SEN MMR I03 CDS", 2453999, 2457743, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYM3", "ITRAXX", 6, "EUROPEc", null, "IG", 2, 10, - null, 0.9920000000000001, 122, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEc.10Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244407", "9349223", - "ITRAXX-EUROPES7cV2 - 0617", "iTraxx Europe Series 7c Version 2", - "ITRAXX-EUROPES7CV2-0617 EUR SEN MMR I03 CDS", 2454180, 2457925, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYN3", "ITRAXX", 7, "EUROPEc", null, "IG", 2, 10, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEc.10Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244408", "9349246", - "ITRAXX-EUROPES2cV2 - 0315", "iTraxx Europe Series 2c Version 2", - "ITRAXX-EUROPES2CV2-0315 EUR SEN MMR I03 CDS", 2453269, 2457102, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYI3", "ITRAXX", 2, "EUROPEc", null, "IG", 2, 10, - null, 0.9920000000000001, 125, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEa.5Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244409", "9349254", - "ITRAXX-EUROPES3aV2 - 0610", "iTraxx Europe Series 3a Version 2", - "ITRAXX-EUROPES3AV2-0610 EUR SEN MMR I03 CDS", 2453451, 2455368, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYJ1", "ITRAXX", 3, "EUROPEa", null, "IG", 2, 5, - null, 0.9920000000000001, 124, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEc.5Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244410", "9349256", - "ITRAXX-EUROPES3cV2 - 0610", "iTraxx Europe Series 3c Version 2", - "ITRAXX-EUROPES3CV2-0610 EUR SEN MMR I03 CDS", 2453451, 2455368, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYJ3", "ITRAXX", 3, "EUROPEc", null, "IG", 2, 5, - null, 0.9920000000000001, 124, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEa.7Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244411", "9349258", - "ITRAXX-EUROPES3aV2 - 0612", "iTraxx Europe Series 3a Version 2", - "ITRAXX-EUROPES3AV2-0612 EUR SEN MMR I03 CDS", 2453451, 2456099, 0.0045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYJ1", "ITRAXX", 3, "EUROPEa", null, "IG", 2, 7, - null, 0.9920000000000001, 124, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEa.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244412", "9349271", - "ITRAXX-EUROPES7aV2 - 0612", "iTraxx Europe Series 7a Version 2", - "ITRAXX-EUROPES7AV2-0612 EUR SEN MMR I03 CDS", 2454180, 2456099, 0.003, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYN1", "ITRAXX", 7, "EUROPEa", null, "IG", 2, 5, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEc.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244413", "9349202", - "ITRAXX-EUROPES7cV2 - 0612", "iTraxx Europe Series 7c Version 2", - "ITRAXX-EUROPES7CV2-0612 EUR SEN MMR I03 CDS", 2454180, 2456099, 0.003, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYN3", "ITRAXX", 7, "EUROPEc", null, "IG", 2, 5, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEb.7Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244414", "9349260", - "ITRAXX-EUROPES7bV2 - 0614", "iTraxx Europe Series 7b Version 2", - "ITRAXX-EUROPES7BV2-0614 EUR SEN MMR I03 CDS", 2454180, 2456829, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYN2", "ITRAXX", 7, "EUROPEb", null, "IG", 2, 7, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEc.7Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244415", "9349248", - "ITRAXX-EUROPES7cV2 - 0614", "iTraxx Europe Series 7c Version 2", - "ITRAXX-EUROPES7CV2-0614 EUR SEN MMR I03 CDS", 2454180, 2456829, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYN3", "ITRAXX", 7, "EUROPEc", null, "IG", 2, 7, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.XOVERb.5Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244416", "9349315", - "ITRAXX-XOVERS8bV3 - 1212", "iTraxx Europe Crossover Series 8b Version 3", - "ITRAXX-XOVERS8BV3-1212 EUR SEN MMR I03 CDS", 2454364, 2456282, 0.0375, "EUR", - "ACT/360", false, 0.4, 4, "2I667KYG2", "ITRAXX", 8, "XOVERb", null, "XO", 3, 5, - null, 0.96, 50, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.XOVERc.5Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244417", "9349272", - "ITRAXX-XOVERS8cV3 - 1212", "iTraxx Europe Crossover Series 8c Version 3", - "ITRAXX-XOVERS8CV3-1212 EUR SEN MMR I03 CDS", 2454364, 2456282, 0.0375, "EUR", - "ACT/360", false, 0.4, 4, "2I667KYG3", "ITRAXX", 8, "XOVERc", null, "XO", 3, 5, - null, 0.96, 50, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.XOVERa.3Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244418", "9349274", - "ITRAXX-XOVERS8aV3 - 1210", "iTraxx Europe Crossover Series 8a Version 3", - "ITRAXX-XOVERS8AV3-1210 EUR SEN MMR I03 CDS", 2454364, 2455551, 0.027, "EUR", - "ACT/360", false, 0.4, 4, "2I667KYG1", "ITRAXX", 8, "XOVERa", null, "XO", 3, 3, - null, 0.96, 50, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEb.7Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244419", "9349247", - "ITRAXX-EUROPES4bV2 - 1212", "iTraxx Europe Series 4b Version 2", - "ITRAXX-EUROPES4BV2-1212 EUR SEN MMR I03 CDS", 2453634, 2456282, 0.0045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYK2", "ITRAXX", 4, "EUROPEb", null, "IG", 2, 7, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.XOVERc.3Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244420", "9349261", - "ITRAXX-XOVERS8cV3 - 1210", "iTraxx Europe Crossover Series 8c Version 3", - "ITRAXX-XOVERS8CV3-1210 EUR SEN MMR I03 CDS", 2454364, 2455551, 0.027, "EUR", - "ACT/360", false, 0.4, 4, "2I667KYG3", "ITRAXX", 8, "XOVERc", null, "XO", 3, 3, - null, 0.96, 50, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEc.7Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244421", "9349210", - "ITRAXX-EUROPES4cV2 - 1212", "iTraxx Europe Series 4c Version 2", - "ITRAXX-EUROPES4CV2-1212 EUR SEN MMR I03 CDS", 2453634, 2456282, 0.0045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYK3", "ITRAXX", 4, "EUROPEc", null, "IG", 2, 7, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEc.10Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244422", "9349211", - "ITRAXX-EUROPES4cV2 - 1215", "iTraxx Europe Series 4c Version 2", - "ITRAXX-EUROPES4CV2-1215 EUR SEN MMR I03 CDS", 2453634, 2457377, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYK3", "ITRAXX", 4, "EUROPEc", null, "IG", 2, 10, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEa.5Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244423", "9349212", - "ITRAXX-EUROPES5aV2 - 0611", "iTraxx Europe Series 5a Version 2", - "ITRAXX-EUROPES5AV2-0611 EUR SEN MMR I03 CDS", 2453815, 2455733, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYL1", "ITRAXX", 5, "EUROPEa", null, "IG", 2, 5, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEc.5Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244424", "9349217", - "ITRAXX-EUROPES5cV2 - 0611", "iTraxx Europe Series 5c Version 2", - "ITRAXX-EUROPES5CV2-0611 EUR SEN MMR I03 CDS", 2453815, 2455733, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I666VYL3", "ITRAXX", 5, "EUROPEc", null, "IG", 2, 5, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.XOVERb.5Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244635", "9371683", - "ITRAXX-XOVERS8bV4 - 1212", "iTraxx Europe Crossover Series 8b Version 4", - "ITRAXX-XOVERS8BV4-1212 EUR SEN MMR I03 CDS", 2454364, 2456282, 0.0375, "EUR", - "ACT/360", false, 0.4, 4, "2I667KYK2", "ITRAXX", 8, "XOVERb", null, "XO", 4, 5, - null, 0.9400000000000001, 50, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.XOVERc.5Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244636", "9371697", - "ITRAXX-XOVERS8cV4 - 1212", "iTraxx Europe Crossover Series 8c Version 4", - "ITRAXX-XOVERS8CV4-1212 EUR SEN MMR I03 CDS", 2454364, 2456282, 0.0375, "EUR", - "ACT/360", false, 0.4, 4, "2I667KYK3", "ITRAXX", 8, "XOVERc", null, "XO", 4, 5, - null, 0.9400000000000001, 50, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.XOVERa.3Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244637", "9371639", - "ITRAXX-XOVERS8aV4 - 1210", "iTraxx Europe Crossover Series 8a Version 4", - "ITRAXX-XOVERS8AV4-1210 EUR SEN MMR I03 CDS", 2454364, 2455551, 0.027, "EUR", - "ACT/360", false, 0.4, 4, "2I667KYK1", "ITRAXX", 8, "XOVERa", null, "XO", 4, 3, - null, 0.9400000000000001, 50, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.XOVERc.3Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244638", "9371699", - "ITRAXX-XOVERS8cV4 - 1210", "iTraxx Europe Crossover Series 8c Version 4", - "ITRAXX-XOVERS8CV4-1210 EUR SEN MMR I03 CDS", 2454364, 2455551, 0.027, "EUR", - "ACT/360", false, 0.4, 4, "2I667KYK3", "ITRAXX", 8, "XOVERc", null, "XO", 4, 3, - null, 0.9400000000000001, 50, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEV2 TB.10Y.1.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244653", "9373130", - "ITRAXX-EUROPES1V2 TB - 0914", "DOW JONES ITRAXX EUROPE SERIES 1 VERSION 2- THOMSON BANKRUPTCY", - "ITRAXX-EUROPES1V2 TB-0914 EUR SEN MMR I03 CDS", 2453179, 2456921, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "TB- 2I666VAL9", "ITRAXX", 1, "EUROPEV2 TB", null, "IG", 2, 10, - null, 0.9920000000000001, 124, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEV2 TB.5Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244660", "9373117", - "ITRAXX-EUROPES5V2 TB - 0611", "ITRAXX EUROPE SERIES 5 VERSION 2- THOMSON BANKRUPTCY", - "ITRAXX-EUROPES5V2 TB-0611 EUR SEN MMR I03 CDS", 2453815, 2455733, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "TB- 2I666VAP0", "ITRAXX", 5, "EUROPEV2 TB", null, "IG", 2, 5, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEV2 TB.10Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244662", "9373126", - "ITRAXX-EUROPES5V2 TB - 0616", "ITRAXX EUROPE SERIES 5 VERSION 2- THOMSON BANKRUPTCY", - "ITRAXX-EUROPES5V2 TB-0616 EUR SEN MMR I03 CDS", 2453815, 2457560, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "TB- 2I666VAP0", "ITRAXX", 5, "EUROPEV2 TB", null, "IG", 2, 10, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEV2 TB.7Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244663", "9373129", - "ITRAXX-EUROPES5V2 TB - 0613", "ITRAXX EUROPE SERIES 5 VERSION 2- THOMSON BANKRUPTCY", - "ITRAXX-EUROPES5V2 TB-0613 EUR SEN MMR I03 CDS", 2453815, 2456464, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "TB- 2I666VAP0", "ITRAXX", 5, "EUROPEV2 TB", null, "IG", 2, 7, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEV2 TB.5Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244664", "9373125", - "ITRAXX-EUROPES2V2 TB - 0310", "DOW JONES ITRAXX EUROPE SERIES 2 VERSION 2- THOMSON BANKRUPTCY", - "ITRAXX-EUROPES2V2 TB-0310 EUR SEN MMR I03 CDS", 2453269, 2455276, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "TB- 2I666VAM7", "ITRAXX", 2, "EUROPEV2 TB", null, "IG", 2, 5, - null, 0.9920000000000001, 125, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEV2 TB.10Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244665", "9373121", - "ITRAXX-EUROPES2V2 TB - 0315", "DOW JONES ITRAXX EUROPE SERIES 2 VERSION 2- THOMSON BANKRUPTCY", - "ITRAXX-EUROPES2V2 TB-0315 EUR SEN MMR I03 CDS", 2453269, 2457102, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "TB- 2I666VAM7", "ITRAXX", 2, "EUROPEV2 TB", null, "IG", 2, 10, - null, 0.9920000000000001, 125, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEV2 TB.10Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244666", "9373104", - "ITRAXX-EUROPES3V2 TB - 0615", "ITRAXX EUROPE SERIES 3 VERSION 2- THOMSON BANKRUPTCY", - "ITRAXX-EUROPES3V2 TB-0615 EUR SEN MMR I03 CDS", 2453451, 2457194, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "TB- 2I666VAN5", "ITRAXX", 3, "EUROPEV2 TB", null, "IG", 2, 10, - null, 0.9920000000000001, 124, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEV2 TB.7Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244669", "9373105", - "ITRAXX-EUROPES3V2 TB - 0612", "ITRAXX EUROPE SERIES 3 VERSION 2- THOMSON BANKRUPTCY", - "ITRAXX-EUROPES3V2 TB-0612 EUR SEN MMR I03 CDS", 2453451, 2456099, 0.0045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "TB- 2I666VAN5", "ITRAXX", 3, "EUROPEV2 TB", null, "IG", 2, 7, - null, 0.9920000000000001, 124, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEV2 TB.5Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244671", "9373116", - "ITRAXX-EUROPES3V2 TB - 0610", "ITRAXX EUROPE SERIES 3 VERSION 2- THOMSON BANKRUPTCY", - "ITRAXX-EUROPES3V2 TB-0610 EUR SEN MMR I03 CDS", 2453451, 2455368, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "TB- 2I666VAN5", "ITRAXX", 3, "EUROPEV2 TB", null, "IG", 2, 5, - null, 0.9920000000000001, 124, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEV2 TB.10Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244672", "9373114", - "ITRAXX-EUROPES6V2 TB - 1216", "ITRAXX EUROPE SERIES 6 VERSION 2- THOMSON BANKRUPTCY", - "ITRAXX-EUROPES6V2 TB-1216 EUR SEN MMR I03 CDS", 2453999, 2457743, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "TB- 2I666VAQ8", "ITRAXX", 6, "EUROPEV2 TB", null, "IG", 2, 10, - null, 0.9920000000000001, 122, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEV2 TB.7Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244674", "9373122", - "ITRAXX-EUROPES2V2 TB - 0312", "DOW JONES ITRAXX EUROPE SERIES 2 VERSION 2- THOMSON BANKRUPTCY", - "ITRAXX-EUROPES2V2 TB-0312 EUR SEN MMR I03 CDS", 2453269, 2456007, 0.0037500000000000003, "EUR", - "ACT/360", false, 0.4, 4, "TB- 2I666VAM7", "ITRAXX", 2, "EUROPEV2 TB", null, "IG", 2, 7, - null, 0.9920000000000001, 125, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEV2 TB.3Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244675", "9373119", - "ITRAXX-EUROPES7V2 TB - 0610", "ITRAXX EUROPE SERIES 7 VERSION 2- THOMSON BANKRUPTCY", - "ITRAXX-EUROPES7V2 TB-0610 EUR SEN MMR I03 CDS", 2454180, 2455368, 0.002, "EUR", - "ACT/360", false, 0.4, 4, "TB- 2I666VAR6", "ITRAXX", 7, "EUROPEV2 TB", null, "IG", 2, 3, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEV2 TB.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244676", "9373106", - "ITRAXX-EUROPES4V2 TB - 1210", "ITRAXX EUROPE SERIES 4 VERSION 2- THOMSON BANKRUPTCY", - "ITRAXX-EUROPES4V2 TB-1210 EUR SEN MMR I03 CDS", 2453634, 2455551, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "TB- 2I666VAO3", "ITRAXX", 4, "EUROPEV2 TB", null, "IG", 2, 5, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEV2 TB.7Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244677", "9373109", - "ITRAXX-EUROPES4V2 TB - 1212", "ITRAXX EUROPE SERIES 4 VERSION 2- THOMSON BANKRUPTCY", - "ITRAXX-EUROPES4V2 TB-1212 EUR SEN MMR I03 CDS", 2453634, 2456282, 0.0045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "TB- 2I666VAO3", "ITRAXX", 4, "EUROPEV2 TB", null, "IG", 2, 7, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEV2 TB.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244678", "9373128", - "ITRAXX-EUROPES7V2 TB - 0612", "ITRAXX EUROPE SERIES 7 VERSION 2- THOMSON BANKRUPTCY", - "ITRAXX-EUROPES7V2 TB-0612 EUR SEN MMR I03 CDS", 2454180, 2456099, 0.003, "EUR", - "ACT/360", false, 0.4, 4, "TB- 2I666VAR6", "ITRAXX", 7, "EUROPEV2 TB", null, "IG", 2, 5, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEV2 TB.10Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244679", "9373111", - "ITRAXX-EUROPES4V2 TB - 1215", "ITRAXX EUROPE SERIES 4 VERSION 2- THOMSON BANKRUPTCY", - "ITRAXX-EUROPES4V2 TB-1215 EUR SEN MMR I03 CDS", 2453634, 2457377, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "TB- 2I666VAO3", "ITRAXX", 4, "EUROPEV2 TB", null, "IG", 2, 10, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEV2 TB.7Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244680", "9373118", - "ITRAXX-EUROPES7V2 TB - 0614", "ITRAXX EUROPE SERIES 7 VERSION 2- THOMSON BANKRUPTCY", - "ITRAXX-EUROPES7V2 TB-0614 EUR SEN MMR I03 CDS", 2454180, 2456829, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "TB- 2I666VAR6", "ITRAXX", 7, "EUROPEV2 TB", null, "IG", 2, 7, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEV2 TB.10Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244682", "9373123", - "ITRAXX-EUROPES7V2 TB - 0617", "ITRAXX EUROPE SERIES 7 VERSION 2- THOMSON BANKRUPTCY", - "ITRAXX-EUROPES7V2 TB-0617 EUR SEN MMR I03 CDS", 2454180, 2457925, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "TB- 2I666VAR6", "ITRAXX", 7, "EUROPEV2 TB", null, "IG", 2, 10, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEV2 TB.3Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244683", "9373159", - "ITRAXX-EUROPES6V2 TB - 1209", "ITRAXX EUROPE SERIES 6 VERSION 2- THOMSON BANKRUPTCY", - "ITRAXX-EUROPES6V2 TB-1209 EUR SEN MMR I03 CDS", 2453999, 2455186, 0.002, "EUR", - "ACT/360", false, 0.4, 4, "TB- 2I666VAQ8", "ITRAXX", 6, "EUROPEV2 TB", null, "IG", 2, 3, - null, 0.9920000000000001, 122, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEV2 TB.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244684", "9373160", - "ITRAXX-EUROPES6V2 TB - 1211", "ITRAXX EUROPE SERIES 6 VERSION 2- THOMSON BANKRUPTCY", - "ITRAXX-EUROPES6V2 TB-1211 EUR SEN MMR I03 CDS", 2453999, 2455916, 0.003, "EUR", - "ACT/360", false, 0.4, 4, "TB- 2I666VAQ8", "ITRAXX", 6, "EUROPEV2 TB", null, "IG", 2, 5, - null, 0.9920000000000001, 122, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEV2 TB.7Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("244686", "9373172", - "ITRAXX-EUROPES6V2 TB - 1213", "ITRAXX EUROPE SERIES 6 VERSION 2- THOMSON BANKRUPTCY", - "ITRAXX-EUROPES6V2 TB-1213 EUR SEN MMR I03 CDS", 2453999, 2456647, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "TB- 2I666VAQ8", "ITRAXX", 6, "EUROPEV2 TB", null, "IG", 2, 7, - null, 0.9920000000000001, 122, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.ENERGY.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900375", "7064772", - "ITRAXX-ENERGYS3V1 - 0610", "iTraxx Europe Energy Series 3 Version 1", - "ITRAXX-ENERGYS3V1 - 0610 EUR SEN MMR I03 CDS", 2453451, 2455368, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I667CAC0", "ITRAXX", 3, "ENERGY", null, "IG", 1, 5, - "225298", 1, 20, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.ENERGY.10Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900376", "7064780", - "ITRAXX-ENERGYS3V1 - 0615", "iTraxx Europe Energy Series 3 Version 1", - "ITRAXX-ENERGYS3V1 - 0615 EUR SEN MMR I03 CDS", 2453451, 2457194, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I667CAC0", "ITRAXX", 3, "ENERGY", null, "IG", 1, 10, - "225298", 1, 20, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.IND.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900388", "7063792", - "ITRAXX-INDS2V1 - 0310", "iTraxx Europe Industrials Series 2 Version 1", - "ITRAXX-INDS2V1-0310 EUR SEN MMR I03 CDS", 2453269, 2455276, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I667HAB1", "ITRAXX", 2, "IND", null, "IG", 1, 5, - "224351", 1, 20, 0, "LON", false, false, true, "ITRXEI52", "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.IND.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900390", "7063814", - "ITRAXX-INDS2V1 - 0315", "iTraxx Europe Industrials Series 2 Version 1", - "ITRAXX-INDS2V1-0315 EUR SEN MMR I03 CDS", 2453269, 2457102, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I667HAB1", "ITRAXX", 2, "IND", null, "IG", 1, 10, - "224351", 1, 20, 0, "LON", false, false, true, "ITRXEI02", "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.CONS.10Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900391", "7063997", - "ITRAXX-CONSS1V1 - 0914", "iTraxx Europe Consumers Series 1 Version 1", - "ITRAXX-CONSS1V1-0914 EUR SEN MMR I03 CDS MATURED", 2453179, 2456921, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I667BAA6", "ITRAXX", 1, "CONS", "CON", "IG", 1, 10, - "223620", 1, 31, 0, "LON", true, true, true, "ITRXEY01", "CON")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.10Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900398", "7064187", - "ITRAXX-FINSENS1V1 - 0914", "iTraxx Europe Senior Financials Series 1 Version 1", - "ITRAXX-FINSENS1V1-0914 EUR SEN MMR I03 CDS", 2453179, 2456921, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAA2", "ITRAXX", 1, "FINSEN", "SEN", "IG", 1, 10, - "223622", 1, 23, 0, "LON", true, true, true, "ITRXES01", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900399", "7064020", - "ITRAXX-XOVERS1V1 - 0914", "Itraxx Europe Crossover Series 1 Version 1", - "ITRAXX-XOVERS1V1-0914 EUR SEN MMR I03 CDS", 2453179, 2456921, 0.0315, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAA6", "ITRAXX", 1, "XOVER", "XVR", "XO", 1, 10, - "223617", 1, 30, 0, "LON", true, true, true, "ITRXEX01", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.ENERGY.10Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900402", "7064071", - "ITRAXX-ENERGYS1V1 - 0914", "iTraxx Europe Energy Series 1 Version 1", - "ITRAXX-ENERGYS1V1-0914 EUR SEN MMR I03 CDS", 2453179, 2456921, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I667CAA4", "ITRAXX", 1, "ENERGY", null, "IG", 1, 10, - "223612", 1, 20, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.10Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900404", "7064101", - "ITRAXX-HIVOLS1V1 - 0914", "Itraxx Europe HiVol Series 1 Version 1", - "ITRAXX-HIVOLS1V1-0914 EUR SEN MMR I03 CDS", 2453179, 2456921, 0.009000000000000001, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAA4", "ITRAXX", 1, "HIVOL", "VOL", "HV", 1, 10, - "223619", 1, 30, 0, "LON", true, true, true, "ITRXEH01", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.TMT.10Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900408", "7064225", - "ITRAXX-TMTS1V1 - 0914", "iTraxx Europe TMT Series 1 Version 1", - "ITRAXX-TMTS1V1-0914 EUR SEN MMR I03 CDS", 2453179, 2456921, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I667IAA1", "ITRAXX", 1, "TMT", "TMT", "IG", 1, 10, - "223611", 1, 20, 0, "LON", false, false, true, "ITRXET01", "TMT")); - - UpdateCDXRefDataMap ("ITRAXX.AUTOS.10Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900411", "7063970", - "ITRAXX-AUTOSS1V1 - 0914", "iTraxx Europe Autos Series 1 Version 1", - "ITRAXX-AUTOSS1V1-0914 EUR SEN MMR I03 CDS", 2453179, 2456921, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I666WAA1", "ITRAXX", 1, "AUTOS", "AUT", "IG", 1, 10, - "223616", 1, 10, 0, "LON", false, false, true, "ITRXEA01", "AUT")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900416", "7063849", - "ITRAXX-FINSENS2V1 - 0310", "iTraxx Europe Senior Financials Series 2 Version 1", - "ITRAXX-FINSENS2V1-0310 EUR SEN MMR I03 CDS", 2453269, 2455276, 0.0015, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAB0", "ITRAXX", 2, "FINSEN", "SEN", "IG", 1, 5, - "224364", 1, 24, 0, "LON", true, true, true, "ITRXES52", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900418", "7063857", - "ITRAXX-FINSENS2V1 - 0315", "iTraxx Europe Senior Financials Series 2 Version 1", - "ITRAXX-FINSENS2V1-0315 EUR SEN MMR I03 CDS", 2453269, 2457102, 0.002, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAB0", "ITRAXX", 2, "FINSEN", "SEN", "IG", 1, 10, - "224364", 1, 24, 0, "LON", true, true, true, "ITRXES02", "SEN")); - - UpdateCDXRefDataMap ("TRACXE.SENFIN.10Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900419", "7064640", - "DJTRAC-XEUROPESENFINS1 - 0913", "Dow Jones TRAC-X Europe Senior Financials Series 1", - "DJTRAC-XEUROPESENFINS1-0913 EUR SEN MMR I03 CDS", 2452811, 2456556, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "DJTRACXEUS1", "TRACXE", 1, "SENFIN", null, "IG", 1, 10, - "218629", 1, 23, 0, "LON", false, false, true, null, "Trac-X")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900432", "7063725", - "ITRAXX-EUROPES2V1 - 0310", "Itraxx Europe Series 2 Version 1", - "ITRAXX-EUROPES2V1-0310 EUR SEN MMR I03 CDS MATURED", 2453269, 2455276, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAB1", "ITRAXX", 2, "EUROPE", "EUR", "IG", 1, 5, - "224353", 1, 125, 0, "LON", true, true, true, "ITRXEB52", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900433", "7063733", - "ITRAXX-EUROPES2V1 - 0315", "Itraxx Europe Series 2 Version 1", - "ITRAXX-EUROPES2V1-0315 EUR SEN MMR I03 CDS MATURED", 2453269, 2457102, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAB1", "ITRAXX", 2, "EUROPE", "EUR", "IG", 1, 10, - "224353", 1, 125, 0, "LON", true, true, true, "ITRXEB02", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900437", "7063776", - "ITRAXX-HIVOLS2V1 - 0310", "Itraxx Europe HiVol Series 2 Version 1", - "ITRAXX-HIVOLS2V1-0310 EUR SEN MMR I03 CDS", 2453269, 2455276, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAB2", "ITRAXX", 2, "HIVOL", "VOL", "HV", 1, 5, - "224354", 1, 30, 0, "LON", true, true, true, "ITRXEH52", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900438", "7063784", - "ITRAXX-HIVOLS2V1 - 0315", "Itraxx Europe HiVol Series 2 Version 1", - "ITRAXX-HIVOLS2V1-0315 EUR SEN MMR I03 CDS", 2453269, 2457102, 0.007500000000000001, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAB2", "ITRAXX", 2, "HIVOL", "VOL", "HV", 1, 10, - "224354", 1, 30, 0, "LON", true, true, true, "ITRXEH02", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900440", "7065388", - "ITRAXX-EUROPES3V1 - 0615", "iTraxx Europe Series 3 Version 1", - "ITRAXX-EUROPES3V1-0615 EUR SEN MMR I03 CDS MATURED", 2453451, 2457194, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAC9", "ITRAXX", 3, "EUROPE", "EUR", "IG", 1, 10, - "225293", 1, 124, 0, "LON", true, true, true, "ITRXEB03", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.7Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900441", "7065396", - "ITRAXX-EUROPES3V1 - 0612", "iTraxx Europe Series 3 Version 1", - "ITRAXX-EUROPES3V1-0612 EUR SEN MMR I03 CDS MATURED", 2453451, 2456099, 0.0045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAC9", "ITRAXX", 3, "EUROPE", "EUR", "IG", 1, 7, - "225293", 1, 124, 0, "LON", true, true, true, "ITRXEB73", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900442", "7064888", - "ITRAXX-EUROPES3V1 - 0610", "iTraxx Europe Series 3 Version 1", - "ITRAXX-EUROPES3V1-0610 EUR SEN MMR I03 CDS MATURED", 2453451, 2455368, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAC9", "ITRAXX", 3, "EUROPE", "EUR", "IG", 1, 5, - "225293", 1, 124, 0, "LON", true, true, true, "ITRXEB53", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900446", "7064985", - "ITRAXX-HIVOLS3V1 - 0610", "iTraxx Europe HiVol Series 3 Version 1", - "ITRAXX-HIVOLS3V1-0610 EUR SEN MMR I03 CDS", 2453451, 2455368, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAC0", "ITRAXX", 3, "HIVOL", "VOL", "HV", 1, 5, - "225291", 1, 30, 0, "LON", true, true, true, "ITRXEH53", "VOL")); - - return true; - } - - private static final boolean InitCDXRefDataSet4() - { - UpdateCDXRefDataMap ("ITRAXX.HIVOL.7Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900448", "7064993", - "ITRAXX-HIVOLS3V1 - 0612", "iTraxx Europe HiVol Series 3 Version 1", - "ITRAXX-HIVOLS3V1-0612 EUR SEN MMR I03 CDS", 2453451, 2456099, 0.007500000000000001, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAC0", "ITRAXX", 3, "HIVOL", "VOL", "HV", 1, 7, - "225291", 1, 30, 0, "LON", true, true, true, "ITRXEH73", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.10Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900449", "7065019", - "ITRAXX-HIVOLS3V1 - 0615", "iTraxx Europe HiVol Series 3 Version 1", - "ITRAXX-HIVOLS3V1-0615 EUR SEN MMR I03 CDS", 2453451, 2457194, 0.0085, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAC0", "ITRAXX", 3, "HIVOL", "VOL", "HV", 1, 10, - "225291", 1, 30, 0, "LON", true, true, true, "ITRXEH03", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900454", "7064853", - "ITRAXX-XOVERS3V2 - 0610", "iTraxx Europe Crossover Series 3 Version 2", - "ITRAXX-XOVERS3V2-0610 EUR SEN MMR I03 CDS", 2453451, 2455368, 0.02, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAD0", "ITRAXX", 3, "XOVER", "XVR", "XO", 2, 5, - "225358", 1, 35, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900455", "7064861", - "ITRAXX-XOVERS3V2 - 0615", "iTraxx Europe Crossover Series 3 Version 2", - "ITRAXX-XOVERS3V2-0615 EUR SEN MMR I03 CDS", 2453451, 2457194, 0.026000000000000002, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAD0", "ITRAXX", 3, "XOVER", "XVR", "XO", 2, 10, - "225358", 1, 35, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900456", "7065043", - "ITRAXX-XOVERS4V1 - 1210", "iTraxx Europe Crossover Series 4 Version 1", - "ITRAXX-XOVERS4V1-1210 EUR SEN MMR I03 CDS MATURED", 2453634, 2455551, 0.029500000000000002, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAE8", "ITRAXX", 4, "XOVER", "XVR", "XO", 1, 5, - "229307", 1, 40, 0, "LON", true, true, true, "ITRXEX54", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900457", "7065248", - "ITRAXX-XOVERS4V1 - 1215", "iTraxx Europe Crossover Series 4 Version 1", - "ITRAXX-XOVERS4V1-1215 EUR SEN MMR I03 CDS MATURED", 2453634, 2457377, 0.0345, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAE8", "ITRAXX", 4, "XOVER", "XVR", "XO", 1, 10, - "229307", 1, 40, 0, "LON", true, true, true, "ITRXEX04", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.10Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900463", "7064209", - "ITRAXX-FINSUBS1V1 - 0914", "iTraxx Europe Sub Financials Series 1 Version 1", - "ITRAXX-FINSUBS1V1-0914 EUR LT2 SUB MMR I03 CDS", 2453179, 2456921, 0.006, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAA0", "ITRAXX", 1, "FINSUB", "SUB", "IG", 1, 10, - "223623", 1, 23, 0, "LON", true, true, true, "ITRXEU01", "SUB")); - - UpdateCDXRefDataMap ("ITRAXX.CONS.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900468", "7063679", - "ITRAXX-CONSS2V1 - 0310", "iTraxx Europe Consumers Series 2 Version 1", - "ITRAXX-CONSS2V1-0310 EUR SEN MMR I03 CDS MATURED", 2453269, 2455276, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I667BAB4", "ITRAXX", 2, "CONS", "CON", "IG", 1, 5, - "224355", 1, 31, 0, "LON", true, true, true, "ITRXEY52", "CON")); - - UpdateCDXRefDataMap ("ITRAXX.IND.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900470", "7064764", - "ITRAXX-INDS3V1 - 0610", "iTraxx Europe Industrials Series 3 Version 1", - "ITRAXX-INDS3V1-0610 EUR SEN MMR I03 CDS", 2453451, 2455368, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I667HAC9", "ITRAXX", 3, "IND", null, "IG", 1, 5, - "225292", 1, 20, 0, "LON", false, false, true, "ITRXEI53", "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.CONS.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900473", "7064926", - "ITRAXX-CONSS3V1 - 0610", "iTraxx Europe Consumers Series 3 Version 1", - "ITRAXX-CONSS3V1-0610 EUR SEN MMR I03 CDS MATURED", 2453451, 2455368, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I667BAC2", "ITRAXX", 3, "CONS", "CON", "IG", 1, 5, - "225295", 1, 31, 0, "LON", true, true, true, "ITRXEY53", "CON")); - - UpdateCDXRefDataMap ("ITRAXX.CONS.10Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900474", "7064934", - "ITRAXX-CONSS3V1 - 0615", "iTraxx Europe Consumers Series 3 Version 1", - "ITRAXX-CONSS3V1-0615 EUR SEN MMR I03 CDS MATURED", 2453451, 2457194, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I667BAC2", "ITRAXX", 3, "CONS", "CON", "IG", 1, 10, - "225295", 1, 31, 0, "LON", true, true, true, "ITRXEY03", "CON")); - - UpdateCDXRefDataMap ("ITRAXX.IND.10Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900475", "7064799", - "ITRAXX-INDS3V1 - 0615", "iTraxx Europe Industrials Series 3 Version 1", - "ITRAXX-INDS3V1-0615 EUR SEN MMR I03 CDS", 2453451, 2457194, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I667HAC9", "ITRAXX", 3, "IND", null, "IG", 1, 10, - "225292", 1, 20, 0, "LON", false, false, true, "ITRXEI03", "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.CONS.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900476", "7063687", - "ITRAXX-CONSS2V1 - 0315", "iTraxx Europe Consumers Series 2 Version 1", - "ITRAXX-CONSS2V1-0315 EUR SEN MMR I03 CDS MATURED", 2453269, 2457102, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I667BAB4", "ITRAXX", 2, "CONS", "CON", "IG", 1, 10, - "224355", 1, 31, 0, "LON", true, true, true, "ITRXEY02", "CON")); - - UpdateCDXRefDataMap ("ITRAXX.TMT.10Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900478", "7064810", - "ITRAXX-TMTS3V1 - 0615", "iTraxx Europe TMT Series 3 Version 1", - "ITRAXX-TMTS3V1-0615 EUR SEN MMR I03 CDS", 2453451, 2457194, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I667IAC7", "ITRAXX", 3, "TMT", "TMT", "IG", 1, 10, - "225299", 1, 20, 0, "LON", false, false, true, "ITRXET03", "TMT")); - - UpdateCDXRefDataMap ("ITRAXX.AUTOS.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900480", "7064829", - "ITRAXX-AUTOSS3V1 - 0610", "iTraxx Europe Autos Series 3 Version 1", - "ITRAXX-AUTOSS3V1-0610 EUR SEN MMR I03 CDS", 2453451, 2455368, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I666WAC7", "ITRAXX", 3, "AUTOS", "AUT", "IG", 1, 5, - "225290", 1, 10, 0, "LON", false, false, true, "ITRXEA53", "AUT")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900481", "7064055", - "ITRAXX-EUROPES1V1 - 0914", "Itraxx Europe Series 1 Version 1", - "ITRAXX-EUROPES1V1-0914 EUR SEN MMR I03 CDS MATURED", 2453179, 2456921, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAA3", "ITRAXX", 1, "EUROPE", "EUR", "IG", 1, 10, - "223618", 1, 124, 0, "LON", true, true, true, "ITRXEB01", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.AUTOS.10Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900482", "7064705", - "ITRAXX-AUTOSS3V1 - 0615", "iTraxx Europe Autos Series 3 Version 1", - "ITRAXX-AUTOSS3V1-0615 EUR SEN MMR I03 CDS", 2453451, 2457194, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I666WAC7", "ITRAXX", 3, "AUTOS", "AUT", "IG", 1, 10, - "225290", 1, 10, 0, "LON", false, false, true, "ITRXEA03", "AUT")); - - UpdateCDXRefDataMap ("ITRAXX.TMT.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900484", "7064756", - "ITRAXX-TMTS3V1 - 0610", "iTraxx Europe TMT Series 3 Version 1", - "ITRAXX-TMTS3V1-0610 EUR SEN MMR I03 CDS", 2453451, 2455368, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I667IAC7", "ITRAXX", 3, "TMT", "TMT", "IG", 1, 5, - "225299", 1, 20, 0, "LON", false, false, true, "ITRXET53", "TMT")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.5Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900506", "7063865", - "ITRAXX-FINSUBS2V2 - 0310", "iTraxx Europe Sub Financials Series 2 Version 2", - "ITRAXX-FINSUBS2V2-0310 EUR LT2 SUB MMR I03 CDS", 2453269, 2455276, 0.0035, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAC6", "ITRAXX", 2, "FINSUB", "SUB", "IG", 2, 5, - "224365", 1, 24, 0, "LON", true, true, true, null, "SUB")); - - UpdateCDXRefDataMap ("TRACXE.CON.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900507", "7064381", - "TRACXE-CONS2V1 - 0614", "DOW JONES TRAC-X EUROPE CONSUMER INDEX - SERIES 2", - "TRACXE-CONS2V1-0614 EUR SEN MMR I03 CDS MATURED", 2453087, 2456829, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I666LAB3", "TRACXE", 2, "CON", null, "IG", 1, 10, - "222844", 1, 26, 0, "LON", false, false, true, null, "Tracxe")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.10Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900508", "7064802", - "ITRAXX-FINSENS3V1 - 0615", "iTraxx Europe Senior Financials Series 3 Version 1", - "ITRAXX-FINSENS3V1-0615 EUR SEN MMR I03 CDS", 2453451, 2457194, 0.002, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAC8", "ITRAXX", 3, "FINSEN", "SEN", "IG", 1, 10, - "225368", 1, 23, 0, "LON", true, true, true, "ITRXES03", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900510", "7064748", - "ITRAXX-FINSENS3V1 - 0610", "iTraxx Europe Senior Financials Series 3 Version 1", - "ITRAXX-FINSENS3V1-0610 EUR SEN MMR I03 CDS", 2453451, 2455368, 0.0015, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAC8", "ITRAXX", 3, "FINSEN", "SEN", "IG", 1, 5, - "225368", 1, 23, 0, "LON", true, true, true, "ITRXES53", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.10Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900511", "7063911", - "ITRAXX-FINSUBS2V2 - 0315", "iTraxx Europe Sub Financials Series 2 Version 2", - "ITRAXX-FINSUBS2V2-0315 EUR LT2 SUB MMR I03 CDS", 2453269, 2457102, 0.005, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAC6", "ITRAXX", 2, "FINSUB", "SUB", "IG", 2, 10, - "224365", 1, 24, 0, "LON", true, true, true, null, "SUB")); - - UpdateCDXRefDataMap ("TRACXE.TMT.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900512", "7064608", - "TRACXE-TMTS2V1 - 0614", "DOW JONES TRAC-X EUROPE TNT INDEX - SERIES 2", - "TRACXE-TMTS2V1-0614 EUR SEN MMR I03 CDS", 2453087, 2456829, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I666JAB8", "TRACXE", 2, "TMT", "TMT", "IG", 1, 10, - "222847", 1, 25, 0, "LON", false, false, true, "ITRXET02", "TMT")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.10Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900514", "7065213", - "ITRAXX-HIVOLS4V1 - 1215", "iTraxx Europe HiVol Series 4 Version 1", - "ITRAXX-HIVOLS4V1-1215 EUR SEN MMR I03 CDS MATURED", 2453634, 2457377, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAD8", "ITRAXX", 4, "HIVOL", "VOL", "HV", 1, 10, - "229309", 1, 30, 0, "LON", true, true, true, "ITRXEH04", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.ENERGY.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900515", "7063741", - "ITRAXX-ENERGYS2V1 - 0310", "iTraxx Europe Energy Series 2 Version 1", - "ITRAXX-ENERGYS2V1-0310 EUR SEN MMR I03 CDS", 2453269, 2455276, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I667CAB2", "ITRAXX", 2, "ENERGY", null, "IG", 1, 5, - "224350", 1, 20, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.ENERGY.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900516", "7063768", - "ITRAXX-ENERGYS2V1 - 0315", "iTraxx Europe Energy Series 2 Version 1", - "ITRAXX-ENERGYS2V1-0315 EUR SEN MMR I03 CDS", 2453269, 2457102, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I667CAB2", "ITRAXX", 2, "ENERGY", null, "IG", 1, 10, - "224350", 1, 20, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("TRACXE.100.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900517", "7064349", - "TRACXE-100S2V1 - 0614", "DOW JONES TRAC-X EUROPE 100 INDEX - SERIES 2", - "TRACXE-100S2V1-0614 EUR SEN MMR I03 CDS MATURED", 2453087, 2456829, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I666GAB4", "TRACXE", 2, "100", null, "IG", 1, 10, - "222843", 1, 98, 0, "LON", false, false, true, null, "Tracxe")); - - UpdateCDXRefDataMap ("TRACXE.CORP.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900520", "7064454", - "TRACXE-CORPS2V1 - 0614", "DOW JONES TRAC-X EUROPE CORPORATE INDEX - SERIES 2", - "TRACXE-CORPS2V1-0614 EUR SEN MMR I03 CDS MATURED", 2453087, 2456829, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I666HAB2", "TRACXE", 2, "CORP", "COR", "IG", 1, 10, - "222845", 1, 76, 0, "LON", false, false, true, null, "COR")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900521", "7065183", - "ITRAXX-HIVOLS4V1 - 1210", "iTraxx Europe HiVol Series 4 Version 1", - "ITRAXX-HIVOLS4V1-1210 EUR SEN MMR I03 CDS MATURED", 2453634, 2455551, 0.007, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAD8", "ITRAXX", 4, "HIVOL", "VOL", "HV", 1, 5, - "229309", 1, 30, 0, "LON", true, true, true, "ITRXEH54", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.7Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900522", "7065205", - "ITRAXX-HIVOLS4V1 - 1212", "iTraxx Europe HiVol Series 4 Version 1", - "ITRAXX-HIVOLS4V1-1212 EUR SEN MMR I03 CDS", 2453634, 2456282, 0.0085, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAD8", "ITRAXX", 4, "HIVOL", "VOL", "HV", 1, 7, - "229309", 1, 30, 0, "LON", true, true, true, "ITRXEH74", "VOL")); - - UpdateCDXRefDataMap ("TRACXE.IND.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900525", "7064497", - "TRACXE-INDS2V1 - 0614", "DOW JONES TRAC-X EUROPE INDUSTRIAL INDEX - SERIES 2", - "TRACXE-INDS2V1-0614 EUR SEN MMR I03 CDS", 2453087, 2456829, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I666KAB5", "TRACXE", 2, "IND", null, "IG", 1, 10, - "222846", 1, 25, 0, "LON", false, false, true, "ITRXEI02", "Tracxe")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.7Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900528", "7065353", - "ITRAXX-EUROPES4V1 - 1212", "iTraxx Europe Series 4 Version 1", - "ITRAXX-EUROPES4V1-1212 EUR SEN MMR I03 CDS MATURED", 2453634, 2456282, 0.0045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAD7", "ITRAXX", 4, "EUROPE", "EUR", "IG", 1, 7, - "229313", 1, 123, 0, "LON", true, true, true, "ITRXEB74", "EUR")); - - UpdateCDXRefDataMap ("TRACXE.SENFIN.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900529", "7064527", - "TRACXE-SENFINS2V1 - 0614", "DOW JONES TRAC-X EUROPE SENIOR FINANCIALS INDEX - SERIES 2", - "TRACXE-SENFINS2V1-0614 EUR SEN MMR I03 CDS", 2453087, 2456829, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "8HB59MAB0", "TRACXE", 2, "SENFIN", null, "IG", 1, 10, - "222850", 1, 22, 0, "LON", false, false, true, null, "Tracxe")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.10Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900532", "7065221", - "ITRAXX-FINSENS4V1 - 1215", "iTraxx Europe Senior Financials Series 4 Version 1", - "ITRAXX-FINSENS4V1-1215 EUR SEN MMR I03 CDS", 2453634, 2457377, 0.003, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAD6", "ITRAXX", 4, "FINSEN", "SEN", "IG", 1, 10, - "229311", 1, 22, 0, "LON", true, true, true, "ITRXES04", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.ENERGY.10Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900533", "7065280", - "ITRAXX-ENERGYS4V1 - 1215", "iTraxx Europe Energy Series 4 Version 1", - "ITRAXX-ENERGYS4V1-1215 EUR SEN MMR I03 CDS", 2453634, 2457377, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I667CAD8", "ITRAXX", 4, "ENERGY", null, "IG", 1, 10, - "229308", 1, 20, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900534", "7065345", - "ITRAXX-EUROPES4V1 - 1210", "iTraxx Europe Series 4 Version 1", - "ITRAXX-EUROPES4V1-1210 EUR SEN MMR I03 CDS MATURED", 2453634, 2455551, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAD7", "ITRAXX", 4, "EUROPE", "EUR", "IG", 1, 5, - "229313", 1, 123, 0, "LON", true, true, true, "ITRXEB54", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.ENERGY.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900535", "7065051", - "ITRAXX-ENERGYS4V1 - 1210", "iTraxx Europe Energy Series 4 Version 1", - "ITRAXX-ENERGYS4V1-1210 EUR SEN MMR I03 CDS", 2453634, 2455551, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I667CAD8", "ITRAXX", 4, "ENERGY", null, "IG", 1, 5, - "229308", 1, 20, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900537", "7065124", - "ITRAXX-FINSENS4V1 - 1210", "iTraxx Europe Senior Financials Series 4 Version 1", - "ITRAXX-FINSENS4V1-1210 EUR SEN MMR I03 CDS", 2453634, 2455551, 0.002, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAD6", "ITRAXX", 4, "FINSEN", "SEN", "IG", 1, 5, - "229311", 1, 22, 0, "LON", true, true, true, "ITRXES54", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900538", "7065361", - "ITRAXX-EUROPES4V1 - 1215", "iTraxx Europe Series 4 Version 1", - "ITRAXX-EUROPES4V1-1215 EUR SEN MMR I03 CDS MATURED", 2453634, 2457377, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAD7", "ITRAXX", 4, "EUROPE", "EUR", "IG", 1, 10, - "229313", 1, 123, 0, "LON", true, true, true, "ITRXEB04", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.AUTOS.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900541", "7063660", - "ITRAXX-AUTOSS2V1 - 0315", "iTraxx Europe Autos Series 2 Version 1", - "ITRAXX-AUTOSS2V1-0315 EUR SEN MMR I03 CDS", 2453269, 2457102, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I666WAB9", "ITRAXX", 2, "AUTOS", "AUT", "IG", 1, 10, - "224367", 1, 10, 0, "LON", false, false, true, "ITRXEA02", "AUT")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.10Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900542", "7064845", - "ITRAXX-FINSUBS3V1 - 0615", "iTraxx Europe Sub Financials Series 3 Version 1", - "ITRAXX-FINSUBS3V1-0615 LT2 SUB MMR I03 CDS", 2453451, 2457194, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAD4", "ITRAXX", 3, "FINSUB", "SUB", "IG", 1, 10, - "225369", 1, 23, 0, "LON", true, true, true, "ITRXEU03", "SUB")); - - UpdateCDXRefDataMap ("ITRAXX.AUTOS.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900543", "7063652", - "ITRAXX-AUTOSS2V1 - 0310", "iTraxx Europe Autos Series 2 Version 1", - "ITRAXX-AUTOSS2V1-0310 EUR SEN MMR I03 CDS", 2453269, 2455276, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I666WAB9", "ITRAXX", 2, "AUTOS", "AUT", "IG", 1, 5, - "224367", 1, 10, 0, "LON", false, false, true, "ITRXEA52", "AUT")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900544", "7064969", - "ITRAXX-FINSUBS3V1 - 0610", "iTraxx Europe Sub Financials Series 3 Version 1", - "ITRAXX-FINSUBS3V1-0610 LT2 SUB MMR I03 CDS", 2453451, 2455368, 0.0035, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAD4", "ITRAXX", 3, "FINSUB", "SUB", "IG", 1, 5, - "225369", 1, 23, 0, "LON", true, true, true, "ITRXEU53", "SUB")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.10Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900545", "7065310", - "ITRAXX-FINSUBS4V1 - 1215", "iTraxx Europe Sub Financials Series 4 Version 1", - "ITRAXX-FINSUBS4V1-1215 LT2 SUB MMR I03 CDS", 2453634, 2457377, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAE2", "ITRAXX", 4, "FINSUB", "SUB", "IG", 1, 10, - "229314", 1, 22, 0, "LON", true, true, true, "ITRXEU04", "SUB")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900546", "7065132", - "ITRAXX-FINSUBS4V1 - 1210", "iTraxx Europe Sub Financials Series 4 Version 1", - "ITRAXX-FINSUBS4V1-1210 LT2 SUB MMR I03 CDS", 2453634, 2455551, 0.0035, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAE2", "ITRAXX", 4, "FINSUB", "SUB", "IG", 1, 5, - "229314", 1, 22, 0, "LON", true, true, true, "ITRXEU54", "SUB")); - - UpdateCDXRefDataMap ("TRACXE.SUBFIN.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900547", "7064551", - "TRACXE-SUBFINS2V1 - 0614", "DOW JONES TRAC-X EUROPE SUB FINANCIALS INDEX - SERIES 2", - "TRACXE-SUBFINS2V1-0614 EUR LT2 SUB MMR I03 CDS", 2453087, 2456829, 0.006, "EUR", - "ACT/360", false, 0.2, 4, "8HB59LAB2", "TRACXE", 2, "SUBFIN", null, "IG", 1, 10, - "222851", 1, 22, 0, "LON", false, false, true, null, "Tracxe")); - - UpdateCDXRefDataMap ("ITRAXX.TMT.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900548", "7063954", - "ITRAXX-TMTS2V1 - 0315", "iTraxx Europe TMT Series 2 Version 1", - "ITRAXX-TMTS2V1-0315 EUR SEN MMR I03 CDS", 2453269, 2457102, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I667IAB9", "ITRAXX", 2, "TMT", "TMT", "IG", 1, 10, - "224349", 1, 20, 0, "LON", false, false, true, "ITRXET02", "TMT")); - - UpdateCDXRefDataMap ("ITRAXX.TMT.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900550", "7063946", - "ITRAXX-TMTS2V1 - 0310", "iTraxx Europe TMT Series 2 Version 1", - "ITRAXX-TMTS2V1-0310 EUR SEN MMR I03 CDS", 2453269, 2455276, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I667IAB9", "ITRAXX", 2, "TMT", "TMT", "IG", 1, 5, - "224349", 1, 20, 0, "LON", false, false, true, "ITRXET52", "TMT")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900555", "7063717", - "ITRAXX-XOVERS2V1 - 0315", "Itraxx Europe Crossover Series 2 Version 1", - "ITRAXX-XOVERS2V1-0315 EUR SEN MMR I03 CDS", 2453269, 2457102, 0.029500000000000002, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAB4", "ITRAXX", 2, "XOVER", "XVR", "XO", 1, 10, - "224352", 1, 30, 0, "LON", true, true, true, "ITRXEX02", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900556", "7063709", - "ITRAXX-XOVERS2V1 - 0310", "Itraxx Europe Crossover Series 2 Version 1", - "ITRAXX-XOVERS2V1-0310 EUR SEN MMR I03 CDS", 2453269, 2455276, 0.0275, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAB4", "ITRAXX", 2, "XOVER", "XVR", "XO", 1, 5, - "224352", 1, 30, 0, "LON", true, true, true, "ITRXEX52", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.AUTOS.10Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900652", "7065256", - "ITRAXX-AUTOSS4V1 - 1215", "iTraxx Europe Autos Series 4 Version 1", - "ITRAXX-AUTOSS4V1-1215 EUR SEN MMR I03 CDS", 2453634, 2457377, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I666WAD5", "ITRAXX", 4, "AUTOS", "AUT", "IG", 1, 10, - "229305", 1, 10, 0, "LON", false, false, true, "ITRXEA04", "AUT")); - - UpdateCDXRefDataMap ("ITRAXX.IND.10Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900656", "7065299", - "ITRAXX-INDS4V1 - 1215", "iTraxx Europe Industrials Series 4 Version 1", - "ITRAXX-INDS4V1-1215 EUR SEN MMR I03 CDS", 2453634, 2457377, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I667HAD7", "ITRAXX", 4, "IND", null, "IG", 1, 10, - "229310", 1, 20, 0, "LON", false, false, true, "ITRXEI04", "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.TMT.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900659", "7065140", - "ITRAXX-TMTS4V1 - 1210", "iTraxx Europe TMT Series 4 Version 1", - "ITRAXX-TMTS4V1-1210 EUR SEN MMR I03 CDS", 2453634, 2455551, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I667IAD5", "ITRAXX", 4, "TMT", "TMT", "IG", 1, 5, - "229315", 1, 20, 0, "LON", false, false, true, "ITRXET54", "TMT")); - - UpdateCDXRefDataMap ("ITRAXX.IND.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900660", "7065086", - "ITRAXX-INDS4V1 - 1210", "iTraxx Europe Industrials Series 4 Version 1", - "ITRAXX-INDS4V1-1210 EUR SEN MMR I03 CDS", 2453634, 2455551, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I667HAD7", "ITRAXX", 4, "IND", null, "IG", 1, 5, - "229310", 1, 20, 0, "LON", false, false, true, "ITRXEI54", "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.AUTOS.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900661", "7065035", - "ITRAXX-AUTOSS4V1 - 1210", "iTraxx Europe Autos Series 4 Version 1", - "ITRAXX-AUTOSS4V1-1210 EUR SEN MMR I03 CDS", 2453634, 2455551, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I666WAD5", "ITRAXX", 4, "AUTOS", "AUT", "IG", 1, 5, - "229305", 1, 10, 0, "LON", false, false, true, "ITRXEA54", "AUT")); - - UpdateCDXRefDataMap ("ITRAXX.CONS.10Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900662", "7065264", - "ITRAXX-CONSS4V1 - 1215", "iTraxx Europe Consumers Series 4 Version 1", - "ITRAXX-CONSS4V1-1215 EUR SEN MMR I03 CDS MATURED", 2453634, 2457377, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I667BAD0", "ITRAXX", 4, "CONS", "CON", "IG", 1, 10, - "229306", 1, 31, 0, "LON", true, true, true, "ITRXEY04", "CON")); - - UpdateCDXRefDataMap ("ITRAXX.TMT.10Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900663", "7065329", - "ITRAXX-TMTS4V1 - 1215", "iTraxx Europe TMT Series 4 Version 1", - "ITRAXX-TMTS4V1-1215 EUR SEN MMR I03 CDS", 2453634, 2457377, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I667IAD5", "ITRAXX", 4, "TMT", "TMT", "IG", 1, 10, - "229315", 1, 20, 0, "LON", false, false, true, "ITRXET04", "TMT")); - - UpdateCDXRefDataMap ("ITRAXX.CONS.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900664", "7065159", - "ITRAXX-CONSS4V1 - 1210", "iTraxx Europe Consumers Series 4 Version 1", - "ITRAXX-CONSS4V1-1210 EUR SEN MMR I03 CDS", 2453634, 2455551, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I667BAD0", "ITRAXX", 4, "CONS", "CON", "IG", 1, 5, - "229306", 1, 31, 0, "LON", true, true, true, "ITRXEY54", "CON")); - - UpdateCDXRefDataMap ("ITRAXX.SDI75.10Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900703", "7221401", - "ITRAXX-SDI75S1V1 - 1215", "iTraxx SDI-75 Series 1 Version 1", - "ITRAXX SDI-75 SERIES 1 VERSION 1 10Y EUR SEN MMR I03 CDS", 2453704, 2457377, 0.0045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAIAA3", "ITRAXX", 1, "SDI75", null, "IG", 1, 10, - "229734", 1, 77, 0, "LON", false, false, true, null, "Itraxx SDI")); - - UpdateCDXRefDataMap ("DJCDX.NA HY HB.5Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900760", "7278446", - "DJCDX-NAHYHBS5V3 - 1210", "Dow Jones CDX.NA.HY.HB.5", - "DJCDX_NA_HY_S5_HB_SWP_28/30", 2453651, 2455551, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BWAJ8", "DJCDX", 5, "NA HY HB", null, "HY", 3, 5, - null, 0.9331999999999999, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.KOREA.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900815", "7275382", - "ITRAXX-KOREAS2V1 - 0310", "iTraxx Korea Series Number 2 Version 1", - "DJ ITRAXX-KOREAS2V1 - 0310 USD SEN RES I03 CDS", 2453269, 2455278, 0.004, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I668EAB7", "ITRAXX", 2, "KOREA", null, "IG", 1, 5, - "0", 1, 8, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900816", "7275188", - "ITRAXX-JAPANS2V1 - 0310", "iTraxx Japan Series Number 2 Version 1", - "DJ ITRAXX-CJS2V1 - 0310 JPY SEN RES I03 CDS", 2453269, 2455276, 0.0025, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAB0", "ITRAXX", 2, "JAPAN", null, "IG", 1, 5, - "231427", 1, 49, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.KOREA.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900817", "7275412", - "ITRAXX-KOREAS3V1 - 0610", "iTraxx Korea Series Number 3 Version 1", - "DJ ITRAXX-KOREAS3V1 - 0610 USD SEN RES I03 CDS", 2453451, 2455368, 0.0035, "USD", - "ACT/360", false, 0.3, 4, "2I668EAC5", "ITRAXX", 3, "KOREA", null, "IG", 1, 5, - "225502", 1, 8, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900820", "7276630", - "ITRAXX-JAPANS2V1 - 0315", "ITRAXX JAPAN SERIES NUMBER 2 VERSION 1", - "DJ ITRAXX-CJS2V1 - 0315 JPY SEN RES I03 CDS", 2453269, 2457102, 0.0035, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAB0", "ITRAXX", 2, "JAPAN", null, "IG", 1, 10, - "231427", 1, 49, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.GRCHINA.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900822", "7275315", - "ITRAXX-GRCHINAS2V1 - 0310", "iTraxx Greater China Series Number 2 Version 1", - "DJ ITRAXX-GRCHINAS2V1 - 0310 USD SEN RES I03 CDS", 2453269, 2455278, 0.004, "USD", - "ACT/360", false, 0.3, 4, "2I668FAB4", "ITRAXX", 2, "GRCHINA", null, "IG", 1, 5, - "0", 1, 9, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.AUSTRALIA.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900823", "7275030", - "ITRAXX-AUSTRALIAS2V1 - 0310", "iTraxx Australia Series Number 2 Version 1", - "ITRAXX-AUSTRALIAS2V1 - 0310 USD SEN MR I03 CDS", 2453269, 2455276, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I668IAB8", "ITRAXX", 2, "AUSTRALIA", null, "IG", 1, 5, - "0", 1, 24, 0, "HKG", false, false, true, null, "Itraxx Australia")); - - UpdateCDXRefDataMap ("ITRAXX.GRCHINA.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900825", "7275331", - "ITRAXX-GRCHINAS3V1 - 0610", "iTraxx Greater China Series Number 3 Version 1", - "DJ ITRAXX-GRCHINAS3V1 - 0610 USD SEN RES I03 CDS", 2453451, 2455368, 0.003, "USD", - "ACT/360", false, 0.3, 4, "2I668FAC2", "ITRAXX", 3, "GRCHINA", null, "IG", 1, 5, - "0", 1, 9, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.AUSTRALIA.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900827", "7275528", - "ITRAXX-AUSTRALIAS4V1 - 1210", "iTraxx Australia Series Number 4 Version 1", - "ITRAXX-AUSTRALIAS4V1 - 1210 USD SEN MR I03 CDS", 2453634, 2455551, 0.003, "USD", - "ACT/360", false, 0.4, 4, "2I668IAD4", "ITRAXX", 4, "AUSTRALIA", null, "IG", 1, 5, - "229379", 1, 24, 0, "HKG", false, false, true, null, "Itraxx Australia")); - - UpdateCDXRefDataMap ("ITRAXX.AUSTRALIA.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900828", "7275056", - "ITRAXX-AUSTRALIAS3V1 - 0610", "iTraxx Australia Series Number 3 Version 1", - "ITRAXX-AUSTRALIAS3V1 - 0610 USD SEN MR I03 CDS", 2453451, 2455368, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I668IAC6", "ITRAXX", 3, "AUSTRALIA", null, "IG", 1, 5, - "225498", 1, 24, 0, "HKG", false, false, true, null, "Itraxx Australia")); - - UpdateCDXRefDataMap ("ITRAXX.KOREA.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900829", "7276532", - "ITRAXX-KOREAS4V1 - 1210", "iTraxx Korea Series Number 4 Version 1", - "DJ ITRAXX-KOREAS4V1 - 1210 USD SEN RES I03 CDS", 2453634, 2455551, 0.004, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I668EAD3", "ITRAXX", 4, "KOREA", null, "IG", 1, 5, - "229375", 1, 10, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.CJAPAN.5Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900830", "7275161", - "ITRAXX-CJAPANS1V1 - 0909", "iTraxx Japan Series Number 1 Version 1", - "DJ ITRAXX-CJS1V1 - 0909 JPY SEN RES I03 CDS", 2453214, 2455096, 0.0025, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAA2", "ITRAXX", 1, "CJAPAN", null, "IG", 1, 5, - "224150", 1, 49, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("DJTRAC.X JAPAN50.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900837", "7276591", - "DJTRAC-X JAPAN50S2 - 0309", "Dow Jones TRAC-X Japan 50 Series 2", - "DJ TRAC-X JAPAN50S2V1 - 0309 JPY SEN RES I03 CDS", 2452907, 2454913, 0.0035, "JPY", - "ACT/360", false, 0.3, 4, "2I666NAB9", "DJTRAC", 2, "X JAPAN50", null, "IG", 1, 5, - "220802", 1, 49, 0, "TOK", false, false, true, null, "Trac-X")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.10Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900842", "7321678", - "DJCDX-NAHYS5V3 - 1215", "Dow Jones CDX.NA.HY.5", - "DJCDX_NA_HY_S5_100_SWP_10Y_12/15_98/100", 2453651, 2457377, 0.0395, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAO7", "DJCDX", 5, "NA HY", null, "HY", 3, 10, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900846", "7274912", - "ITRAXX-ASIAXJS2V1 - 0310", "iTraxx Asia ex-Japan Series Number 2 Version 1", - "DJ ITRAXX-ASIAXJS2V1 - 0310 USD SEN RES I03 CDS", 2453269, 2455278, 0.0055000000000000005, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I668DAB9", "ITRAXX", 2, "ASIAXJ", null, "IG", 1, 5, - "224454", 1, 30, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900847", "7274955", - "ITRAXX-ASIAXJS3V1 - 0610", "iTraxx Asia ex-Japan Series Number 3 Version 1", - "DJ ITRAXX-ASIAXJS3V1 - 0610 USD SEN RES I03 CDS", 2453451, 2455368, 0.005, "USD", - "ACT/360", false, 0.3, 4, "2I668DAC7", "ITRAXX", 3, "ASIAXJ", null, "IG", 1, 5, - "225500", 1, 30, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ.10Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900848", "7276605", - "ITRAXX-ASIAXJS3V1 - 0615", "iTraxx Asia ex-Japan Series Number 3 Version 1", - "DJ ITRAXX-ASIAXJS3V1 - 0615 USD SEN RES I03 CDS", 2453451, 2457194, 0.006500000000000001, "USD", - "ACT/360", false, 0.3, 4, "2I668DAC7", "ITRAXX", 3, "ASIAXJ", null, "IG", 1, 10, - "225500", 1, 30, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANTECH.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900849", "7275250", - "ITRAXX-JAPANTECHS2V1 - 0310", "iTraxx Japan Technology Series Number 2 Version 1", - "DJ ITRAXX-CJTECHS2V1 - 0310 JPY SEN RES I03 CDS", 2453269, 2455278, 0.002, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668NAA9", "ITRAXX", 2, "JAPANTECH", null, "IG", 1, 5, - "224514", 1, 10, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900850", "7276656", - "ITRAXX-JAPANS4V1 - 1215", "iTraxx Japan Series Number 4 Version 1", - "DJ ITRAXX-CJS4V1 - 1215 JPY SEN RES I03 CDS", 2453634, 2457377, 0.003, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAD6", "ITRAXX", 4, "JAPAN", null, "IG", 1, 10, - "231433", 1, 49, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANTECH.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900851", "7276648", - "ITRAXX-JAPANTECHS2V1 - 0315", "iTraxx Japan Technology Series Number 2 Version 1", - "DJ ITRAXX-CJTECHS2V1 - 0315 JPY SEN RES I03 CDS", 2453269, 2457102, 0.003, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668NAA9", "ITRAXX", 2, "JAPANTECH", null, "IG", 1, 10, - null, 1, 10, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANTECH.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900852", "7276508", - "ITRAXX-JAPANTECHS3V1 - 0610", "iTraxx Japan Technology Series Number 3 Version 1", - "DJ ITRAXX-CJTECHS3V1 - 0610 JPY SEN RES I03 CDS", 2453451, 2455368, 0.002, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668NAB7", "ITRAXX", 3, "JAPANTECH", null, "IG", 1, 5, - "0", 1, 10, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANTECH.10Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900854", "7276672", - "ITRAXX-JAPANTECHS3V1 - 0615", "iTraxx Japan Technology Series Number 3 Version 1", - "DJ ITRAXX-CJTECHS3V1 - 0615 JPY SEN RES I03 CDS", 2453451, 2457194, 0.003, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668NAB7", "ITRAXX", 3, "JAPANTECH", null, "IG", 1, 10, - null, 1, 10, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900857", "7275552", - "ITRAXX-JAPANS4V1 - 1210", "iTraxx Japan Series Number 4 Version 1", - "DJ ITRAXX-CJS4V1 - 1210 JPY SEN RES I03 CDS", 2453634, 2455551, 0.002, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAD6", "ITRAXX", 4, "JAPAN", null, "IG", 1, 5, - "231433", 1, 49, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900858", "7275501", - "ITRAXX-ASIAXJS4V1 - 1210", "iTraxx Asia ex-Japan Series Number 4 Version 1", - "DJ ITRAXX-ASIAXJS4V1 - 1210 USD SEN RES I03 CDS", 2453634, 2455551, 0.0055000000000000005, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I668DAD5", "ITRAXX", 4, "ASIAXJ", null, "IG", 1, 5, - "229374", 1, 50, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANFIN.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900859", "7275110", - "ITRAXX-JAPANFINS2V1 - 0310", "iTraxx Japan Financials Series Number 2 Version 1", - "DJ ITRAXX-CJFINS2V1 - 0310 JPY SEN RES I03 CDS", 2453269, 2455276, 0.0035, "JPY", - "ACT/360", false, 0.3, 4, "2I668LAA3", "ITRAXX", 2, "JAPANFIN", null, "IG", 1, 5, - "224710", 1, 9, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANFIN.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900860", "7276613", - "ITRAXX-JAPANFINS2V1 - 0315", "iTraxx Japan Financials Series Number 2 Version 1", - "DJ ITRAXX-CJFINS2V1 - 0315 JPY SEN RES I03 CDS", 2453269, 2457102, 0.005, "JPY", - "ACT/360", false, 0.3, 4, "2I668LAA3", "ITRAXX", 2, "JAPANFIN", null, "IG", 1, 10, - null, 1, 9, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900864", "7275218", - "ITRAXX-JAPANS3V1 - 0610", "iTraxx Japan Series Number 3 Version 1", - "DJ ITRAXX-CJS3V1 - 0610 JPY SEN RES I03 CDS", 2453451, 2455368, 0.002, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAC8", "ITRAXX", 3, "JAPAN", null, "IG", 1, 5, - "231430", 1, 49, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900866", "7275145", - "ITRAXX-JAPANHIVOLS2V1 - 0310", "iTraxx Japan HiVol Series Number 2 Version 1", - "DJ ITRAXX-CJHIVOLS2V1 - 0310 JPY SEN RES I03 CDS", 2453269, 2455276, 0.005, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MAA1", "ITRAXX", 2, "JAPANHIVOL", "VOL", "HV", 1, 5, - "0", 1, 10, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900870", "7276621", - "ITRAXX-JAPANHIVOLS2V1 - 0315", "iTraxx Japan HiVol Series Number 2 Version 1", - "DJ ITRAXX-CJHIVOLS2V1 - 0315 JPY SEN RES I03 CDS", 2453269, 2457102, 0.007, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MAA1", "ITRAXX", 2, "JAPANHIVOL", "VOL", "HV", 1, 10, - null, 1, 10, 0, "TOK", false, false, true, null, "VOL")); - - return true; - } - - private static final boolean InitCDXRefDataSet5() - { - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900877", "7324138", - "ITRAXX-JAPANS3V1 - 0615", "iTraxx Japan Series Number 3 Version 1", - "DJ ITRAXX-CJS3V1 - 0615 JPY SEN RES I03 CDS", 2453451, 2457194, 0.0035, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAC8", "ITRAXX", 3, "JAPAN", null, "IG", 1, 10, - "231430", 1, 49, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.7Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900907", "7345879", - "DJCDX-NAHYS5V3 - 1212", "Dow Jones CDX.NA.HY.5", - "DJCDX_NA_HY_S5_100_SWP_07Y_12/12_98/100", 2453651, 2456282, 0.0395, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAO7", "DJCDX", 5, "NA HY", null, "HY", 3, 7, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NAXO.10Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900937", "7359926", - "DJCDX-NAXOS5V2 - 1215", "Dow Jones CDX.NA.XO.5", - "DJCDX_NA_XO_S5_10YR_12/15_34/35", 2453635, 2457377, 0.024, "USD", - "ACT/360", false, 0.5, 4, "1D764IAB3", "DJCDX", 5, "NAXO", null, "XO", 2, 10, - null, 0.97143, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJIBOXX.NA HY.5Y.2.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900938", "7360045", - "DJIBOXX-NA-HY-S2V4 - 0909", "Dow Jones CDX.NA.HY.2", - "DJIBOXX_NA_HY_S2_100_SWP_96/100", 2453088, 2455095, 0.043000000000000003, "USD", - "ACT/360", false, 0.35000000000000003, 4, "DJIBOXX-NA-HY-S2V4", "DJIBOXX", 2, "NA HY", null, "HY", 4, 5, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.5Y.3.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900945", "7359942", - "DJCDX-NAHYS3V5 - 1209", "Dow Jones CDX.NA.HY.3", - "DJCDX_NA_HY_S3_100_SWP_97/100", 2453196, 2455186, 0.0375, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAS9", "DJCDX", 3, "NA HY", null, "HY", 5, 5, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY BB.5Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900946", "7359969", - "DJCDX-NAHYBBS3V2 - 1209", "Dow Jones CDX.NA.HY.BB.3", - "DJCDX_NA_HY_S3_BB__SWP_42/43", 2453196, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BVAI2", "DJCDX", 3, "NA HY BB", null, "HY", 2, 5, - null, 0.97674, 43, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY V3 AllPts.5Y.3.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900947", "7359977", - "DJCDX-NAHYS3V3 AllPts - 1209", "DOW JONES CDXNAHYS3ALLPTS98/100", - "DJCDX_NA_HY_S3-ALL PTS_98/100", 2453196, 2455186, 0, "USD", - "ACT/360", false, 0.4, 4, "2I65BRAM2-AP", "DJCDX", 3, "NA HY V3 AllPts", null, "HY", 3, 5, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.5Y.4.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900948", "7359993", - "DJCDX-NAHYS4V5 - 0610", "Dow Jones CDX.NA.HY.4", - "DJCDX_NA_HY_S4_100_SWP_96/100", 2453475, 2455368, 0.036000000000000004, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAT7", "DJCDX", 4, "NA HY", null, "HY", 5, 5, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY BB.5Y.4.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900949", "7360240", - "DJCDX-NAHYBBS4V3 - 0610", "DOW JONES CDX.NA.HY.BB.4", - "DJCDX_NA_HY_S4_BB_SWP_41/43", 2453475, 2455368, 0.021, "USD", - "ACT/360", false, 0.3, 4, "2I65BVAJ0", "DJCDX", 4, "NA HY BB", null, "HY", 3, 5, - null, 0.95348, 43, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY V3AllPts.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900950", "7360290", - "DJCDX-NAHYS4V3-AllPts - 0610", "DOW JONES CDX NAHYS4ALLPTS 98/100", - "DJCDX_NA_HY_S4-ALL PTS_98/100", 2453475, 2455368, 0, "USD", - "ACT/360", false, 0.4, 4, "2I65BRAJ9-AP", "DJCDX", 4, "NA HY V3AllPts", null, "HY", 2, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.10Y.5.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900951", "7360312", - "DJCDX-NAHYS5V4 - 1215", "Dow Jones CDX.NA.HY.5", - "DJCDX_NA_HY_S5_100_10Y_12/15_97/100", 2453651, 2457377, 0.0395, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAU4", "DJCDX", 5, "NA HY", null, "HY", 4, 10, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.7Y.5.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900952", "7360347", - "DJCDX-NAHYS5V4 - 1212", "Dow Jones CDX.NA.HY.5", - "DJCDX_NA_HY_S5_100_SWP_07Y_12/12_97/100", 2453651, 2456282, 0.0395, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAU4", "DJCDX", 5, "NA HY", null, "HY", 4, 7, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.5Y.5.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900953", "7360355", - "DJCDX-NAHYS5V4 - 1210", "DOW JONES CDX.NA.HY.5", - "DJCDX_NA_HY_S5_100_SWP_97/100", 2453651, 2455551, 0.0395, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAU4", "DJCDX", 5, "NA HY", null, "HY", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY V4 ALLPTS.5Y.5.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900954", "7360363", - "DJCDX-NAHYS5V4 ALLPTS - 1210", "Dow Jones CDX.NA.HY.5", - "DJCDX_NA_HY_S5_ALLPTS_97/100", 2453651, 2455551, 0, "USD", - "ACT/360", false, 0.5, 4, "2I65BRAU4 ALLPTS", "DJCDX", 5, "NA HY V4 ALLPTS", null, "HY", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY BB.5Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900955", "7360371", - "DJCDX-NAHYBBS5V2 - 1210", "Dow Jones CDX.NA.HY.BB.5", - "DJCDX_NA_HY_S5_BB_SWP_40/41", 2453651, 2455551, 0.025, "USD", - "ACT/360", false, 0.3, 4, "2I65BVAK7", "DJCDX", 5, "NA HY BB", null, "HY", 2, 5, - null, 0.9756100000000001, 41, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY HB.5Y.5.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900956", "7360002", - "DJCDX-NAHYHBS5V4 - 1210", "Dow Jones CDX.NA.HY.HB.5", - "DJCDX_NA_HY_S5_HB_SWP_27/30", 2453651, 2455551, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BWAK5", "DJCDX", 5, "NA HY HB", null, "HY", 4, 5, - null, 0.8998, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NAXO.3Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900957", "7359853", - "DJCDX-NAXOS5V2 - 1208", "Dow Jones CDX.NA.XO Series 5 3YR", - "DJCDX_NA_XO_S5_03YR_12/08_34/35", 2453635, 2454821, 0.02, "USD", - "ACT/360", false, 0.06, 4, "1D764IAB3", "DJCDX", 5, "NAXO", null, "XO", 2, 3, - null, 0.97143, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NAXO.5Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900958", "7360037", - "DJCDX-NAXOS5V2 - 1210", "Dow Jones CDX.NA.XO.5", - "DJCDX_NA_XO_S5_05Y_12/10_34/35", 2453635, 2455551, 0.02, "USD", - "ACT/360", false, 0.4, 4, "1D764IAB3", "DJCDX", 5, "NAXO", null, "XO", 2, 5, - null, 0.97143, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NAXO.7Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900959", "7359918", - "DJCDX-NAXOS5V2 - 1212", "Dow Jones CDX.NA.XO.5", - "DJCDX_NA_XO_S5_07YR_12/12_34/35", 2453635, 2456282, 0.02, "USD", - "ACT/360", false, 0.5, 4, "1D764IAB3", "DJCDX", 5, "NAXO", null, "XO", 2, 7, - null, 0.97143, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.3Y.5.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900960", "7360339", - "DJCDX-NAHYS5V4 - 1208", "DOW JONES CDX NAHYS5 100S 12/8 97/100", - "DJCDX_NA_HY_S5_100_SWP_03Y_12/08_97/100", 2453651, 2454821, 0.0395, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAU4", "DJCDX", 5, "NA HY", null, "HY", 4, 3, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900989", "7351496", - "ITRAXX-EUROPES5V1 - 0611", "iTraxx Europe Series 5 Version 1", - "ITRAXX-EUROPES5V1-0611 EUR SEN MMR I03 CDS MATURED", 2453815, 2455733, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAE5", "ITRAXX", 5, "EUROPE", "EUR", "IG", 1, 5, - "231406", 1, 124, 0, "LON", true, true, true, "ITRXEB55", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.7Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900990", "7351500", - "ITRAXX-EUROPES5V1 - 0613", "iTraxx Europe Series 5 Version 1", - "ITRAXX-EUROPES5V1-0613 EUR SEN MMR I03 CDS MATURED", 2453815, 2456464, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAE5", "ITRAXX", 5, "EUROPE", "EUR", "IG", 1, 7, - "231406", 1, 124, 0, "LON", true, true, true, "ITRXEB75", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900991", "7351518", - "ITRAXX-EUROPES5V1 - 0616", "iTraxx Europe Series 5 Version 1", - "ITRAXX-EUROPES5V1-0616 EUR SEN MMR I03 CDS MATURED", 2453815, 2457560, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAE5", "ITRAXX", 5, "EUROPE", "EUR", "IG", 1, 10, - "231406", 1, 124, 0, "LON", true, true, true, "ITRXEB05", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900993", "7351607", - "ITRAXX-HIVOLS5V1 - 0611", "iTraxx Europe HiVol Series 5 Version 1", - "ITRAXX-HIVOLS5V1-0611 EUR SEN MMR I03 CDS MATURED", 2453815, 2455733, 0.007, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAE6", "ITRAXX", 5, "HIVOL", "VOL", "HV", 1, 5, - "231397", 1, 30, 0, "LON", true, true, true, "ITRXEH55", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.10Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900994", "7351623", - "ITRAXX-HIVOLS5V1 - 0616", "iTraxx Europe HiVol Series 5 Version 1", - "ITRAXX-HIVOLS5V1-0616 EUR SEN MMR I03 CDS MATURED", 2453815, 2457560, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAE6", "ITRAXX", 5, "HIVOL", "VOL", "HV", 1, 10, - "231397", 1, 30, 0, "LON", true, true, true, "ITRXEH05", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900995", "7351550", - "ITRAXX-XOVERS5V1 - 0611", "iTraxx Europe Crossover Series 5 Version 1", - "ITRAXX-XOVERS5V1-0611 EUR SEN MMR I03 CDS MATURED", 2453815, 2455733, 0.029, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAF5", "ITRAXX", 5, "XOVER", "XVR", "XO", 1, 5, - "231396", 1, 44, 0, "LON", true, true, true, "ITRXEX55", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900996", "7351569", - "ITRAXX-XOVERS5V1 - 0616", "iTraxx Europe Crossover Series 5 Version 1", - "ITRAXX-XOVERS5V1-0616 EUR SEN MMR I03 CDS MATURED", 2453815, 2457560, 0.035, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAF5", "ITRAXX", 5, "XOVER", "XVR", "XO", 1, 10, - "231396", 1, 44, 0, "LON", true, true, true, "ITRXEX05", "XVR")); - - UpdateCDXRefDataMap ("DJCDX.EMDIV.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900998", "7377690", - "DJCDX-EMDIVS3V1 - 0611", "Dow Jones CDX.EM.DIVERSIFIED.3", - "DOW JONES CDX EM DIVER 3 5YR", 2453816, 2455733, 0.0085, "USD", - "ACT/360", true, 0.25, 2, "2165EKAC3", "DJCDX", 3, "EMDIV", null, "EM", 1, 5, - null, 1, 40, 0, "LON", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.3Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("900999", "7378130", - "DJCDX-NAIGS6V1 - 0609", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_03Y_6/09", 2453816, 2455003, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAK1", "DJCDX", 6, "NA IG", null, "IG", 1, 3, - null, 1, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901001", "7378173", - "DJCDX-NAIGS6V1 - 0611", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_05Y_6/11", 2453816, 2455733, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAK1", "DJCDX", 6, "NA IG", null, "IG", 1, 5, - null, 1, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.7Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901003", "7378190", - "DJCDX-NAIGS6V1 - 0613", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_07Y_6/13", 2453816, 2456464, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAK1", "DJCDX", 6, "NA IG", null, "IG", 1, 7, - null, 1, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.10Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901004", "7378211", - "DJCDX-NAIGS6V1 - 0616", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_10Y_6/16", 2453816, 2457560, 0.006500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAK1", "DJCDX", 6, "NA IG", null, "IG", 1, 10, - null, 1, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.3Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901006", "7378319", - "DJCDX-NAIGHVOLS6V1 - 0609", "Dow Jones CDX.NA.IG.HVOL.6", - "DJCDX_NA_IG_S6_HVOL_03Y_6/09", 2453816, 2455003, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AK9", "DJCDX", 6, "NA IG HVOL", null, "HV", 1, 3, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG V1 ALLPTS.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901008", "7378416", - "DJCDX-NAIGS6V1 ALLPTS - 0611", "Dow Jones CDX.NA.IG.6.ALLPTS", - "DJCDX_NA_IG_S6_ALLPTS", 2453816, 2455733, 0.004, "USD", - "ACT/360", false, 0.06, 4, "2I65BYAK1 ALLPTS", "DJCDX", 6, "NA IG V1 ALLPTS", null, "IG", 1, 5, - null, 1, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901012", "7378360", - "DJCDX-NAIGHVOLS6V1 - 0611", "Dow Jones CDX.NA.IG.HVOL.6", - "DJCDX_NA_IG_S6_HVOL_05Y_6/11", 2453816, 2455733, 0.007500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AK9", "DJCDX", 6, "NA IG HVOL", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.7Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901013", "7378386", - "DJCDX-NAIGHVOLS6V1 - 0613", "Dow Jones CDX.NA.IG.HVOL.6", - "DJCDX_NA_IG_S6_HVOL_07Y_6/13", 2453816, 2456464, 0.009000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AK9", "DJCDX", 6, "NA IG HVOL", null, "HV", 1, 7, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.10Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901014", "7378408", - "DJCDX-NAIGHVOLS6V1 - 0616", "Dow Jones CDX.NA.IG.HVOL.6", - "DJCDX_NA_IG_S6_HVOL_10Y_6/16", 2453816, 2457560, 0.011000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AK9", "DJCDX", 6, "NA IG HVOL", null, "HV", 1, 10, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NAXO.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901015", "7378424", - "DJCDX-NAXOS6V1 - 0611", "Dow Jones CDX.NA.XO.6", - "DJCDX_NA_XO_S6_05YR_6/11", 2453816, 2455733, 0.019, "USD", - "ACT/360", false, 0.4, 4, "1D764IAC1", "DJCDX", 6, "NAXO", null, "XO", 1, 5, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NAXOV1 ALLPTS.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901016", "7378432", - "DJCDX-NAXOS6V1 ALLPTS - 0611", "Dow Jones CDX.NA.XO.6.ALLPTS", - "DJCDX_NA_XO_S6_ALLPTS", 2453816, 2455733, 0.019, "USD", - "ACT/360", false, 0.4, 4, "1D764IAC1 ALLPTS", "DJCDX", 6, "NAXOV1 ALLPTS", null, "XO", 1, 5, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NAXO.10Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901017", "7378467", - "DJCDX-NAXOS6V1 - 0616", "Dow Jones CDX.NA.XO.6", - "DJCDX_NA_XO_S6_10YR_6/16", 2453816, 2457560, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "1D764IAC1", "DJCDX", 6, "NAXO", null, "XO", 1, 10, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.CONS.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901018", "7351526", - "ITRAXX-CONSS5V1 - 0611", "iTraxx Europe Consumers Series 5 Version 1", - "ITRAXX-CONSS5V1-0611 EUR SEN MMR I03 CDS", 2453815, 2455733, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I667BAE8", "ITRAXX", 5, "CONS", "CON", "IG", 1, 5, - "231395", 1, 31, 0, "LON", true, true, true, "ITRXEY55", "CON")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOLV1 ALLPTS.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901019", "7378475", - "DJCDX-NAIGHVOLS6V1 ALLPTS - 0611", "Dow Jones CDX.NA.IG.HVOL.6.ALLPTS", - "DJCDX_NA_IG_S6_HVOL_ALLPTS", 2453816, 2455733, 0.007500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AK9 ALLPTS", "DJCDX", 6, "NA IG HVOLV1 ALLPTS", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.CONS.10Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901020", "7351534", - "ITRAXX-CONSS5V1 - 0616", "iTraxx Europe Consumers Series 5 Version 1", - "ITRAXX-CONSS5V1-0616 EUR SEN MMR I03 CDS", 2453815, 2457560, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I667BAE8", "ITRAXX", 5, "CONS", "CON", "IG", 1, 10, - "231395", 1, 31, 0, "LON", true, true, true, "ITRXEY05", "CON")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.7Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901022", "7351615", - "ITRAXX-HIVOLS5V1 - 0613", "iTraxx Europe HiVol Series 5 Version 1", - "ITRAXX-HIVOLS5V1-0613 EUR SEN MMR I03 CDS MATURED", 2453815, 2456464, 0.0085, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAE6", "ITRAXX", 5, "HIVOL", "VOL", "HV", 1, 7, - "231397", 1, 30, 0, "LON", true, true, true, "ITRXEH75", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.IND.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901023", "7351631", - "ITRAXX-INDS5V1 - 0611", "iTraxx Europe Industrials Series 5 Version 1", - "ITRAXX-INDS5V1-0611 EUR SEN MMR I03 CDS", 2453815, 2455733, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I667HAE5", "ITRAXX", 5, "IND", null, "IG", 1, 5, - "231408", 1, 20, 0, "LON", false, false, true, "ITRXEI55", "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.AUTOS.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901024", "7351780", - "ITRAXX-AUTOSS5V1 - 0611", "iTraxx Europe Autos Series 5 Version 1", - "ITRAXX-AUTOSS5V1-0611 EUR SEN MMR I03 CDS", 2453815, 2455733, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I666WAE3", "ITRAXX", 5, "AUTOS", "AUT", "IG", 1, 5, - "231410", 1, 10, 0, "LON", false, false, true, "ITRXEA55", "AUT")); - - UpdateCDXRefDataMap ("ITRAXX.IND.10Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901025", "7351640", - "ITRAXX-INDS5V1 - 0616", "iTraxx Europe Industrials Series 5 Version 1", - "ITRAXX-INDS5V1-0616 EUR SEN MMR I03 CDS", 2453815, 2457560, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I667HAE5", "ITRAXX", 5, "IND", null, "IG", 1, 10, - "231408", 1, 20, 0, "LON", false, false, true, "ITRXEI05", "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901026", "7351674", - "ITRAXX-FINSENS5V1 - 0611", "iTraxx Europe Senior Financials Series 5 Version 1", - "ITRAXX-FINSENS5V1-0611 EUR SEN MMR I03 CDS", 2453815, 2455733, 0.0015, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAE4", "ITRAXX", 5, "FINSEN", "SEN", "IG", 1, 5, - "231412", 1, 24, 0, "LON", true, true, true, "ITRXES55", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.AUTOS.10Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901027", "7351798", - "ITRAXX-AUTOSS5V1 - 0616", "iTraxx Europe Autos Series 5 Version 1", - "ITRAXX-AUTOSS5V1-0616 EUR SEN MMR I03 CDS", 2453815, 2457560, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I666WAE3", "ITRAXX", 5, "AUTOS", "AUT", "IG", 1, 10, - "231410", 1, 10, 0, "LON", false, false, true, "ITRXEA05", "AUT")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.10Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901028", "7351682", - "ITRAXX-FINSENS5V1 - 0616", "iTraxx Europe Senior Financials Series 5 Version 1", - "ITRAXX-FINSENS5V1-0616 EUR SEN MMR I03 CDS", 2453815, 2457560, 0.0025, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAE4", "ITRAXX", 5, "FINSEN", "SEN", "IG", 1, 10, - "231412", 1, 24, 0, "LON", true, true, true, "ITRXES05", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901029", "7351690", - "ITRAXX-FINSUBS5V1 - 0611", "iTraxx Europe Sub Financials Series 5 Version 1", - "ITRAXX-FINSUBS5V1-0611 LT2 SUB MMR I03 CDS", 2453815, 2455733, 0.0025, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAF9", "ITRAXX", 5, "FINSUB", "SUB", "IG", 1, 5, - "231413", 1, 24, 0, "LON", true, true, true, "ITRXEU55", "SUB")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.10Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901030", "7351704", - "ITRAXX-FINSUBS5V1 - 0616", "iTraxx Europe Sub Financials Series 5 Version 1", - "ITRAXX-FINSUBS5V1-0616 LT2 SUB MMR I03 CDS", 2453815, 2457560, 0.0045000000000000005, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAF9", "ITRAXX", 5, "FINSUB", "SUB", "IG", 1, 10, - "231413", 1, 24, 0, "LON", true, true, true, "ITRXEU05", "SUB")); - - UpdateCDXRefDataMap ("ITRAXX.TMT.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901033", "7351712", - "ITRAXX-TMTS5V1 - 0611", "iTraxx Europe TMT Series 5 Version 1", - "ITRAXX-TMTS5V1-0611 EUR SEN MMR I03 CDS", 2453815, 2455733, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I667IAE3", "ITRAXX", 5, "TMT", "TMT", "IG", 1, 5, - "231411", 1, 20, 0, "LON", false, false, true, "ITRXET55", "TMT")); - - UpdateCDXRefDataMap ("ITRAXX.ENERGY.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901035", "7351577", - "ITRAXX-ENERGYS5V1 - 0611", "iTraxx Europe Energy Series 5 Version 1", - "ITRAXX-ENERGYS5V1-0611 EUR SEN MMR I03 CDS", 2453815, 2455733, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I667CAE6", "ITRAXX", 5, "ENERGY", null, "IG", 1, 5, - "231414", 1, 19, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.TMT.10Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901036", "7351720", - "ITRAXX-TMTS5V1 - 0616", "iTraxx Europe TMT Series 5 Version 1", - "ITRAXX-TMTS5V1-0616 EUR SEN MMR I03 CDS", 2453815, 2457560, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I667IAE3", "ITRAXX", 5, "TMT", "TMT", "IG", 1, 10, - "231411", 1, 20, 0, "LON", false, false, true, "ITRXET05", "TMT")); - - UpdateCDXRefDataMap ("ITRAXX.ENERGY.10Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901037", "7351585", - "ITRAXX-ENERGYS5V1 - 0616", "iTraxx Europe Energy Series 5 Version 1", - "ITRAXX-ENERGYS5V1-0616 EUR SEN MMR I03 CDS", 2453815, 2457560, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I667CAE6", "ITRAXX", 5, "ENERGY", null, "IG", 1, 10, - "231414", 1, 19, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.XOVERV2349.5Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901039", "7356480", - "ITRAXX-XOVERS3V2-349 - 0610", "iTraxx Europe Crossover Series 3 Version 2", - "ITRAXX-XOVERS3V2-5Y349 EUR SEN MMR I03 CDS", 2453451, 2455368, 0.0349, "EUR", - "ACT/360", false, 0.4, 2, "2I667KAD0349", "ITRAXX", 3, "XOVERV2349", "XVR", "XO", 2, 5, - "225358", 1, 35, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("DJCDX.EM.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901050", "7377703", - "DJCDX-EMS5V1 - 0611", "Dow Jones CDX.EM.5", - "DOW JONES CDX EM 5 5YR", 2453816, 2455733, 0.0135, "USD", - "ACT/360", true, 0.25, 2, "2I65BZAE2", "DJCDX", 5, "EM", null, "EM", 1, 5, - null, 1, 14, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.EM.10Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901051", "7377720", - "DJCDX-EMS5V1 - 0616", "Dow Jones CDX.EM.5", - "DOW JONES CDX EM 5 10YR", 2453816, 2457560, 0.019, "USD", - "ACT/360", false, 0.25, 4, "2I65BZAE2", "DJCDX", 5, "EM", null, "EM", 1, 10, - null, 1, 14, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901052", "7377738", - "DJCDX-NAHYS6V1 - 0611", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP", 2453823, 2455733, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAV2", "DJCDX", 6, "NA HY", null, "HY", 1, 5, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG CONS.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901053", "7378238", - "DJCDX-NAIGCONSS6V1 - 0611", "Dow Jones CDX.NA.IG.CONS.6", - "DJCDX_NA_IG_S6_CONS_6/11", 2453816, 2455733, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65B0AF6", "DJCDX", 6, "NA IG CONS", null, "IG", 1, 5, - null, 1, 36, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG ENRG.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901054", "7378254", - "DJCDX-NAIGENRGS6V1 - 0611", "Dow Jones CDX.NA.IG.ENRG.6", - "DJCDX_NA_IG_S6_ENRG_6/11", 2453816, 2455733, 0.003, "USD", - "ACT/360", false, 0.4, 4, "2I65B1AF4", "DJCDX", 6, "NA IG ENRG", null, "IG", 1, 5, - null, 1, 14, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG INDU.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901056", "7378300", - "DJCDX-NAIGINDUS6V1 - 0611", "Dow Jones CDX.NA.IG.INDU.6", - "DJCDX_NA_IG_S6_INDU_6/11", 2453816, 2455733, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65B4AK7", "DJCDX", 6, "NA IG INDU", null, "IG", 1, 5, - null, 1, 29, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG TMT.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901057", "7378327", - "DJCDX-NAIGTMTS6V1 - 0611", "Dow Jones CDX.NA.IG.TMT.6", - "DJCDX_NA_IG_S6_TMT_6/11", 2453816, 2455733, 0.0045000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65DJAF3", "DJCDX", 6, "NA IG TMT", null, "IG", 1, 5, - null, 1, 24, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.1Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901058", "7378335", - "DJCDX-NAIGS6V1 - 0607", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_01Y_6/07", 2453816, 2454272, 0.001, "USD", - "ACT/360", false, 0.5, 4, "2I65BYAK1", "DJCDX", 6, "NA IG", null, "IG", 1, 1, - null, 1, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.4Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901059", "7378149", - "DJCDX-NAIGS6V1 - 0610", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_04Y_6/10", 2453816, 2455368, 0.003, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAK1", "DJCDX", 6, "NA IG", null, "IG", 1, 4, - null, 1, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.1Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901060", "7378262", - "DJCDX-NAIGHVOLS6V1 - 0607", "Dow Jones CDX.NA.IG.HVOL.6", - "DJCDX_NA_IG_S6_HVOL_01Y_6/07", 2453816, 2454272, 0.002, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AK9", "DJCDX", 6, "NA IG HVOL", null, "HV", 1, 1, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.4Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901061", "7378351", - "DJCDX-NAIGHVOLS6V1 - 0610", "Dow Jones CDX.NA.IG.HVOL.6", - "DJCDX_NA_IG_S6_HVOL_04Y_6/10", 2453816, 2455368, 0.0055000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AK9", "DJCDX", 6, "NA IG HVOL", null, "HV", 1, 4, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V16 FXD 87/100.5Y.6.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901062", "7377754", - "CDX-NAHYS6V16 FXD 87/100 - 0611", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_FXD_87/100", 2453823, 2455733, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRHA1 FXD", "CDX", 6, "NA HY V16 FXD 87/100", null, "HY", 16, 5, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY BB.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901063", "7377894", - "DJCDX-NAHYBBS6V1 - 0611", "Dow Jones CDX.NA.HY.BB.6", - "DJCDX_NA_HY_S6_BB_SWP", 2453823, 2455733, 0.021, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BVAL5", "DJCDX", 6, "NA HY BB", null, "HY", 1, 5, - null, 1, 38, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BBV3 FXD 36/38.5Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901064", "7377932", - "CDX-NAHYBBS6V3 FXD 36/38 - 0611", "Dow Jones CDX.NA.HY.BB.6", - "CDX_NA_HY_S06_BB__FXD_36/38", 2453823, 2455748, 0.021, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BVBT7 FXD", "CDX", 6, "NA HY BBV3 FXD 36/38", null, "HY", 3, 5, - null, 0.9473699999999999, 38, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY B.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901065", "7377983", - "DJCDX-NAHYBS6V1 - 0611", "Dow Jones CDX.NA.HY.B.6", - "DJCDX_NA_HY_S6_B_SWP", 2453823, 2455733, 0.030000000000000002, "USD", - "ACT/360", false, 0.3, 4, "2I65BSAK4", "DJCDX", 6, "NA HY B", null, "HY", 1, 5, - null, 1, 48, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BV9 FXD 41/48.5Y.6.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901066", "7378009", - "CDX-NAHYBS6V9 FXD 41/48 - 0611", "Dow Jones CDX.NA.HY.B.6", - "CDX_NA_HY_S06_B___FXD_41/48", 2453823, 2455733, 0.030000000000000002, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BSEA2 FXD", "CDX", 6, "NA HY BV9 FXD 41/48", null, "HY", 9, 5, - null, 0.85416, 48, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY V1 ALLPTS.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901067", "7378203", - "DJCDX-NAHYS6V1 ALLPTS - 0611", "Dow Jones CDX.NA.HY.6 ALLPTS", - "DJCDX_NA_HY_S6_ALLPTS", 2453823, 2455733, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BRAV2 ALLPTS", "DJCDX", 6, "NA HY V1 ALLPTS", null, "HY", 1, 5, - null, 0.991, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.2Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901068", "7378343", - "DJCDX-NAIGS6V1 - 0608", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_02Y_6/08", 2453816, 2454638, 0.0015, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAK1", "DJCDX", 6, "NA IG", null, "IG", 1, 2, - null, 1, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.2Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901069", "7378289", - "DJCDX-NAIGHVOLS6V1 - 0608", "Dow Jones CDX.NA.IG.HVOL.6", - "DJCDX_NA_IG_S6_HVOL_02Y_6/08", 2453816, 2454638, 0.003, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AK9", "DJCDX", 6, "NA IG HVOL", null, "HV", 1, 2, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NAXO.3Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901070", "7378440", - "DJCDX-NAXOS6V1 - 0609", "Dow Jones CDX.NA.XO.6", - "DJCDX_NA_XO_S6_03YR_6/09", 2453816, 2455003, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "1D764IAC1", "DJCDX", 6, "NAXO", null, "XO", 1, 3, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NAXO.7Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901072", "7378459", - "DJCDX-NAXOS6V1 - 0613", "Dow Jones CDX.NA.XO.6", - "DJCDX_NA_XO_S6_07YR_6/13", 2453816, 2456464, 0.0205, "USD", - "ACT/360", false, 0.4, 4, "1D764IAC1", "DJCDX", 6, "NAXO", null, "XO", 1, 7, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG FIN.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901075", "7378297", - "DJCDX-NAIGFINS6V1 - 0611", "Dow Jones CDX.NA.IG.FIN.6", - "DJCDX_NA_IG_S6_FIN_6/11", 2453816, 2455733, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65B2AF2", "DJCDX", 6, "NA IG FIN", null, "IG", 1, 5, - null, 1, 24, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901076", "7381115", - "ITRAXX-JAPANS5V1 - 0611", "iTraxx Japan Series Number 5 Version 1", - "ITRAXX-CJAPANS5V1-0611 JPY SEN RES I03 CDS", 2453815, 2455733, 0.0025, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAE4", "ITRAXX", 5, "JAPAN", null, "IG", 1, 5, - "231403", 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.AUSTRALIA.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901077", "7381883", - "ITRAXX-AUSTRALIAS5V1 - 0611", "iTraxx Australia Series Number 5 Version 1", - "ITRAXX-AUSTRALIAS5V1 - 0611 USD SEN MR I03 CDS", 2453815, 2455733, 0.003, "USD", - "ACT/360", false, 0.4, 4, "2I668IAE2", "ITRAXX", 5, "AUSTRALIA", null, "IG", 1, 5, - "231400", 1, 24, 0, "HKG", false, false, true, null, "Itraxx Australia")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901078", "7381891", - "ITRAXX-JAPANS5V1 - 0616", "iTraxx Japan Series Number 5 Version 1", - "ITRAXX-CJAPANS5V1-0616 JPY SEN RES I03 CDS", 2453815, 2457560, 0.004, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAE4", "ITRAXX", 5, "JAPAN", null, "IG", 1, 10, - "231403", 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901079", "7381930", - "ITRAXX-ASIAXJS5V1 - 0611", "iTraxx Asia ex-Japan Series Number 5 Version 1", - "ITRAXX-ASIAXJS5V1 - 0611 USD SEN RES I03 CDS", 2453815, 2455733, 0.005, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I668DAE3", "ITRAXX", 5, "ASIAXJ", null, "IG", 1, 5, - "231402", 1, 50, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.SDI75.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901081", "7351747", - "ITRAXX-SDI75S2V1 - 0616", "iTraxx SDI-75 Series 2 Version 1", - "ITRAXX SDI-75 SERIES 2 VERSION 1-0616 EUR SEN MMR I03 CDS", 2453815, 2457560, 0.0045000000000000005, "GBP", - "ACT/360", false, 0.4, 4, "4ABCAIAB1", "ITRAXX", 2, "SDI75", null, "IG", 1, 10, - "231415", 1, 75, 0, "LON", false, false, true, null, "Itraxx SDI")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANCAPGOODS.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901082", "7383584", - "ITRAXX-JAPANCAPGOODSS5V1 - 0611", "iTraxx Japan Capital Goods Series Number 5 Version 1", - "ITRAXX-CJCAPGOODSS5V1-5Y 0611 JPY SEN RES I03 CDS", 2453815, 2455733, 0.0025, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668JAD2", "ITRAXX", 5, "JAPANCAPGOODS", null, "IG", 1, 5, - null, 1, 10, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANFIN.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901083", "7383606", - "ITRAXX-JAPANFINS5V1 - 0611", "iTraxx Japan Financials Series Number 5 Version 1", - "ITRAXX-CJFINS5V1-5Y 0611 JPY SEN RES I03 CDS", 2453815, 2455733, 0.003, "JPY", - "ACT/360", false, 0.3, 4, "2I668LAD7", "ITRAXX", 5, "JAPANFIN", null, "IG", 1, 5, - "0", 1, 10, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - return true; - } - - private static final boolean InitCDXRefDataSet6() - { - UpdateCDXRefDataMap ("ITRAXX.CJAPAN.3Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901084", "7383789", - "ITRAXX-CJAPANS5V1 - 0609", "iTraxx Japan Series Number 5 Version 1", - "ITRAXX-CJAPANS5V1-0609 JPY SEN RES I03 CDS", 2453815, 2455003, 0.0015, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAE4", "ITRAXX", 5, "CJAPAN", null, "IG", 1, 3, - "231403", 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.KOREA.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901085", "7383762", - "ITRAXX-KOREAS5V1 - 0611", "iTraxx Korea Series Number 5 Version 1", - "ITRAXX-KOREAS5V1-5Y 0611 USD SEN RES I03 CDS", 2453815, 2455733, 0.003, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I668EAE1", "ITRAXX", 5, "KOREA", null, "IG", 1, 5, - "0", 1, 10, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901086", "7383665", - "ITRAXX-JAPANHIVOLS5V1 - 0611", "iTraxx Japan HiVol Series Number 5 Version 1", - "ITRAXX-CJHIVOLS5V1-5Y 0611JPY SEN RES I03 CDS", 2453815, 2455733, 0.0045000000000000005, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MAD5", "ITRAXX", 5, "JAPANHIVOL", "VOL", "HV", 1, 5, - "0", 1, 10, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAREST.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901087", "7383746", - "ITRAXX-ASIARESTS5V1 - 0611", "iTraxx Rest of Asia Series Number 5 Version 1", - "ITRAXX-ASIARESTS5V1-5Y - 0611 USD SEN RES I03 CDS", 2453815, 2455733, 0.007, "USD", - "ACT/360", false, 0.3, 4, "2I668GAE6", "ITRAXX", 5, "ASIAREST", null, "IG", 1, 5, - "0", 1, 22, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANTECH.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901088", "7383711", - "ITRAXX-JAPANTECHS5V1 - 0611", "iTraxx Japan Technology Series Number 5 Version 1", - "ITRAXX-CJTECHS5V1-5Y 0611 JPY SEN RES I03 CDS", 2453815, 2455733, 0.004, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668NAD3", "ITRAXX", 5, "JAPANTECH", null, "IG", 1, 5, - null, 1, 10, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.GRCHINA.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901089", "7383649", - "ITRAXX-GRCHINAS5V1 - 0611", "iTraxx Greater China Series Number 5 Version 1", - "ITRAXX-GRCHINAS5V1-5Y 0611 USD SEN RES I03 CDS", 2453815, 2455733, 0.004, "USD", - "ACT/360", false, 0.3, 4, "2I668FAE8", "ITRAXX", 5, "GRCHINA", null, "IG", 1, 5, - "0", 1, 18, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("DJCDX.NA HY HB.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901097", "7378033", - "DJCDX-NAHYHBS6V1 - 0611", "Dow Jones CDX.NA.HY.HB.6", - "DJCDX_NA_HY_S6_HB_SWP", 2453823, 2455733, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BWAL3", "DJCDX", 6, "NA HY HB", null, "HY", 1, 5, - null, 1, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HBV12 FXD 21/30.5Y.6.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901098", "7378165", - "CDX-NAHYHBS6V12 FXD 21/30 - 0611", "Dow Jones CDX.NA.HY.HB.6", - "CDX_NA_HY_S06_HB__FXD_21/30", 2453823, 2455733, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BWEL9 FXD", "CDX", 6, "NA HY HBV12 FXD 21/30", null, "HY", 12, 5, - null, 0.7000000000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.3Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901113", "7401760", - "DJCDX-NAHYS6V1 - 0609", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP_03YR", 2453823, 2455003, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAV2", "DJCDX", 6, "NA HY", null, "HY", 1, 3, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.7Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901114", "7401787", - "DJCDX-NAHYS6V1 - 0613", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP_07YR", 2453823, 2456464, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAV2", "DJCDX", 6, "NA HY", null, "HY", 1, 7, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.10Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901115", "7401795", - "DJCDX-NAHYS6V1 - 0616", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP_10YR", 2453823, 2457560, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAV2", "DJCDX", 6, "NA HY", null, "HY", 1, 10, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG V1 EUR.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901129", "7406363", - "DJCDX-NAIGS6V1 EUR - 0611", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_05Y_6/11_EUR", 2453816, 2455733, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYAK1 EUR", "DJCDX", 6, "NA IG V1 EUR", null, "IG", 1, 5, - null, 1, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.10Y.3.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901141", "7408919", - "DJCDX-NAHYS3V5 - 1214", "Dow Jones CDX.NA.HY.3", - "DJCDX_NA_HY_S3_100_SWP_10Y_12/14_97/100", 2453196, 2457012, 0.0375, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAS9", "DJCDX", 3, "NA HY", null, "HY", 5, 10, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.10Y.3.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901144", "7408935", - "DJCDX-NAHYS3V4 - 1214", "Dow Jones.CDX.NA.HY.3", - "DJCDX_NA_HY_S3_100_SWP_10Y_12/14_98/100", 2453196, 2457012, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRAM2", "DJCDX", 3, "NA HY", null, "HY", 4, 10, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.7Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901169", "5890853", - "DJCDX-NAIGHVOLS4V1 - 0612", "Dow Jones CDX.NA.IG.HVOL.4", - "DJCDX_NA_IG_S4_HVOL_07Y_6/12 - NEW", 2453451, 2456099, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AD5", "DJCDX", 4, "NA IG HVOL", null, "HV", 1, 7, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.1Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901215", "7451385", - "DJCDX-NAHYS6V1 - 0607", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP_01YR", 2453823, 2454272, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAV2", "DJCDX", 6, "NA HY", null, "HY", 1, 1, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.2Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901216", "7451415", - "DJCDX-NAHYS6V1 - 0608", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP_02YR", 2453823, 2454638, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAV2", "DJCDX", 6, "NA HY", null, "HY", 1, 2, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.4Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901217", "7451431", - "DJCDX-NAHYS6V1 - 0610", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP_04YR", 2453823, 2455368, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAV2", "DJCDX", 6, "NA HY", null, "HY", 1, 4, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.6Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901218", "7451440", - "DJCDX-NAHYS6V1 - 0612", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP_06YR", 2453823, 2456099, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAV2", "DJCDX", 6, "NA HY", null, "HY", 1, 6, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("USD ITRAXX.HIVOL.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901421", "7538375", - "USD ITRAXX-HIVOLS5V1 - 0611", "iTraxx Europe HiVol Series 5 Version 1", - "ITRAXX-HIVOLS5V1-0611 USD SEN MMR I03 CDS", 2453815, 2455733, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I667LAE6", "USD ITRAXX", 5, "HIVOL", "VOL", "HV", 1, 5, - "231397", 1, 30, 0, "LON", false, false, true, "ITRXEH55", "VOL")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901422", "7538359", - "USD ITRAXX-EUROPES5V1 - 0611", "iTraxx Europe Series 5 Version 1", - "ITRAXX-EUROPES5V1-0611 USD SEN MMR I03 CDS", 2453815, 2455733, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I666VAE5", "USD ITRAXX", 5, "EUROPE", "EUR", "IG", 1, 5, - "231406", 1, 124, 0, "LON", false, false, true, "ITRXEB55", "EUR")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.6Y.3.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901513", "7608187", - "DJCDX-NAHYS3V6 - 1214", "Dow Jones CDX.NA.HY.3", - "DJCDX_NA_HY_S3_100_SWP_10Y_12/14_96/100", 2453196, 2457012, 0.0375, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAZ3", "DJCDX", 3, "NA HY", null, "HY", 5, 6, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.5Y.3.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901514", "7608225", - "DJCDX-NAHYS3V6 - 1209", "Dow Jones CDX.NA.HY.3", - "DJCDX_NA_HY_S3_100_SWP_96/100", 2453196, 2455186, 0.0375, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAZ3", "DJCDX", 3, "NA HY", null, "HY", 6, 5, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY B.5Y.3.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901515", "7608233", - "DJCDX-NAHYBS3V3 - 1209", "Dow Jones CDX.NA.HY.B.3", - "DJCDX_NA_HY_S3_B___SWP_42/44", 2453196, 2455186, 0.04, "USD", - "ACT/360", false, 0.35000000000000003, 4, "default03", "DJCDX", 3, "NA HY B", null, "HY", 3, 5, - null, 0.9545399999999999, 44, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY HB.5Y.3.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901516", "7608241", - "DJCDX-NAHYHBS3V4 - 1209", "Dow Jones CDX.NA.HY.HB.3", - "DJCDX_NA_HY_S3_HB__SWP_27/30", 2453196, 2455186, 0.0625, "USD", - "ACT/360", false, 0.35000000000000003, 4, "default04", "DJCDX", 3, "NA HY HB", null, "HY", 4, 5, - null, 0.8998, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY V4 AllPts.5Y.3.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901517", "7608268", - "DJCDX-NAHYS3V4 AllPts - 1209", "Dow Jones CDX.NA.HY.3 ALLPTS", - "DJCDX_NA_HY_S3-ALL PTS_96/100", 2453196, 2455186, 0, "USD", - "ACT/360", false, 0.3, 4, "default05", "DJCDX", 3, "NA HY V4 AllPts", null, "HY", 4, 5, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.5Y.4.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901522", "7608160", - "DJCDX-NAHYS4V6 - 0610", "Dow Jones CDX.NA.HY.4", - "DJCDX_NA_HY_S4_100_SWP_95/100", 2453475, 2455368, 0.036000000000000004, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBA7", "DJCDX", 4, "NA HY", null, "HY", 6, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY HB.5Y.4.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901523", "7608055", - "DJCDX-NAHYHBS4V5 - 0610", "Dow Jones CDX.NA.HY.HB.4", - "DJCDX_NA_HY_S4_HB__SWP_26/30", 2453475, 2455368, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BWAO7", "DJCDX", 4, "NA HY HB", null, "HY", 5, 5, - null, 0.8665, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY V6 ALLPTS.5Y.4.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901524", "7609744", - "DJCDX-NAHYS4V6 ALLPTS - 0610", "Dow Jones CDX.NA.HY.4 ALLPTS", - "DJCDX_NA_HY_S4-ALL PTS_95/100", 2453475, 2455368, 0, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBA7 ALLPTS", "DJCDX", 4, "NA HY V6 ALLPTS", null, "HY", 6, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.3Y.5.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901525", "7608063", - "DJCDX-NAHYS5V5 - 1208", "Dow Jones CDX.NA.HY.5", - "DJCDX_NA_HY_S5_100_SWP_03Y_12/08_96/100", 2453651, 2454821, 0.0395, "USD", - "ACT/360", false, 0.35000000000000003, 4, "defaulted10", "DJCDX", 5, "NA HY", null, "HY", 5, 3, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.7Y.5.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901526", "7608080", - "DJCDX-NAHYS5V5 - 1212", "Dow Jones CDX.NA.HY.5", - "DJCDX_NA_HY_S5_100_SWP_07Y_12/12_96/100", 2453651, 2456282, 0.0395, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBB5", "DJCDX", 5, "NA HY", null, "HY", 5, 7, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.10Y.5.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901527", "7610181", - "DJCDX-NAHYS5V5 - 1215", "Dow Jones CDX.NA.HY.5", - "DJCDX_NA_HY_S5_100_SWP_10Y_12/15_96/100", 2453651, 2457377, 0.0395, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBB5", "DJCDX", 5, "NA HY", null, "HY", 5, 10, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.5Y.5.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901528", "7610211", - "DJCDX-NAHYS5V5 - 1210", "Dow Jones CDX.NA.HY.5", - "DJCDX_NA_HY_S5_100_SWP_96/100", 2453651, 2455551, 0.0395, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBB5", "DJCDX", 5, "NA HY", null, "HY", 5, 5, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY HB.5Y.5.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901529", "7611315", - "DJCDX-NAHYHBS5V5 - 1210", "Dow Jones CDX.NA.HY.HB.5", - "DJCDX_NA_HY_S5_HB_SWP_26/30", 2453651, 2455551, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BWAP4", "DJCDX", 5, "NA HY HB", null, "HY", 5, 5, - null, 0.8665, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901530", "7609957", - "DJCDX-NAHYS6V2 - 0611", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP_99/100", 2453823, 2455733, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBC3", "DJCDX", 6, "NA HY", null, "HY", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.1Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901531", "7609981", - "DJCDX-NAHYS6V2 - 0607", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP_01YR_99/100", 2453823, 2454272, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBC3", "DJCDX", 6, "NA HY", null, "HY", 2, 1, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901532", "7609450", - "CDX-NAHYS6V2 - 0612", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP_06YR_99/100", 2453823, 2456099, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBC3", "CDX", 6, "NA HY", null, "HY", 2, 6, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901533", "7609477", - "CDX-NAHYS6V2 - 0613", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP_07YR_99/100", 2453823, 2456464, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBC3", "CDX", 6, "NA HY", null, "HY", 2, 7, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY V5 ALLPTS.5Y.5.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901534", "7610238", - "DJCDX-NAHYS5V5 ALLPTS - 1210", "Dow Jones CDX.NA.HY.5 ALLPTS", - "DJCDX_NA_HY_S5_ALLPTS_96/100", 2453651, 2455551, 0, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBB5 ALLPTS", "DJCDX", 5, "NA HY V5 ALLPTS", null, "HY", 5, 5, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.2Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901535", "7608934", - "DJCDX-NAHYS6V2 - 0608", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP_02YR_99/100", 2453823, 2454638, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBC3", "DJCDX", 6, "NA HY", null, "HY", 2, 2, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901536", "7608942", - "CDX-NAHYS6V2 - 0609", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP_03YR_99/100", 2453823, 2455003, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBC3", "CDX", 6, "NA HY", null, "HY", 2, 3, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901537", "7608950", - "CDX-NAHYS6V2 - 0610", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP_04YR_99/100", 2453823, 2455368, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBC3", "CDX", 6, "NA HY", null, "HY", 2, 4, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901538", "7609493", - "CDX-NAHYS6V2 - 0616", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP_10YR_99/100", 2453823, 2457560, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBC3", "CDX", 6, "NA HY", null, "HY", 2, 10, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY HB.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901539", "7609507", - "DJCDX-NAHYHBS6V2 - 0611", "Dow Jones CDX.NA.HY.HB.6", - "DJCDX_NA_HY_S6_HB_SWP_29/30", 2453823, 2455733, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BWAQ2", "DJCDX", 6, "NA HY HB", null, "HY", 2, 5, - null, 0.96666, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY V2 ALLPTS.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901540", "7608977", - "DJCDX-NAHYS6V2 ALLPTS - 0611", "Dow Jones CDX.NA.HY.6.ALLPTS", - "DJCDX_NA_HY_S6_ALLPTS_99/100", 2453823, 2455733, 0.01, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBC3 ALLPTS", "DJCDX", 6, "NA HY V2 ALLPTS", null, "HY", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJIBOXX.NA HY.5Y.2.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901541", "7609000", - "DJIBOXX-NA-HY-S2V5 - 0909", "Dow Jones CDX.NA.HY.2", - "DJIBOXX_NA_HY_S2_100_SWP_95/100", 2453088, 2455095, 0.043000000000000003, "USD", - "ACT/360", false, 0.35000000000000003, 4, "DJIBOXX-NA-HY-S2V5", "DJIBOXX", 2, "NA HY", null, "HY", 5, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("JPMCHYDI.CORSAIR.5Y.0.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901542", "7609019", - "JPMCHYDI-CORSAIR-V9 - 1107", "JPMC HYDICORSAIR 11/07", - "JPMC HYDICORSAIR 11/07S 92/100", 2452775, 2454420, 0.08750000000000001, "USD", - "ACT/360", false, 0.35000000000000003, 4, "defaulted25", "JPMCHYDI", 0, "CORSAIR", null, "HY", 9, 5, - null, 0.92, 99, 0, "NYC", false, false, false, null, "Hydi")); - - UpdateCDXRefDataMap ("TRACX.NA HY.5Y.1.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901543", "7609892", - "TRACX-NAHYS1V8 - 0608", "Dow Jones TRACX.NA.HY.1", - "TRACX_NA_HY_S1_100_SWP_93/100", 2452775, 2454638, 0.045000000000000005, "USD", - "ACT/360", false, 0.35000000000000003, 4, "defaulted26", "TRACX", 1, "NA HY", null, "HY", 8, 5, - null, 0.93, 101, 0, "NYC", false, false, false, null, "Trac-X")); - - UpdateCDXRefDataMap ("DJTRAC.XNAB S.5Y.1.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901544", "7609906", - "DJTRAC-XNAS1B S V7 - 0608", "Dow Jones TRACX.NA.HY.B.1", - "TRACX_NA_HY_S1_B_SWP_48/54", 2452775, 2454638, 0.045000000000000005, "USD", - "ACT/360", false, 0.35000000000000003, 4, "defaulted27", "DJTRAC", 1, "XNAB S", null, "HY", 7, 5, - null, 0.48, 53, 0, "NYC", false, false, false, null, "Trac-X")); - - UpdateCDXRefDataMap ("DJTRAC.XNAHB S.5Y.1.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901545", "7609914", - "DJTRAC-XNAS1HB S V7 - 0608", "Dow Jones TRACX.NA.HY.HB.1", - "TRACX_NA_HY_S1_HB_SWP_27/33", 2452775, 2454638, 0.045000000000000005, "USD", - "ACT/360", false, 0.35000000000000003, 4, "defaulted28", "DJTRAC", 1, "XNAHB S", null, "HY", 7, 5, - null, 0.27, 32, 0, "NYC", false, false, false, null, "Trac-X")); - - UpdateCDXRefDataMap ("DJTRAC.XNAS2 HB.5Y.1.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901548", "7610343", - "DJTRAC-XNAS2 HB V5 - 0309", "Dow Jones TRACX.NA.HY.HB.2", - "TRACX_NA_HY_S2_HB_SWP_29/33", 2452978, 2454911, 0.045000000000000005, "USD", - "ACT/360", false, 0.35000000000000003, 4, "defaulted31", "DJTRAC", 1, "XNAS2 HB", null, "HY", 5, 5, - null, 0.8787, 33, 0, "NYC", false, false, false, null, "Trac-X")); - - UpdateCDXRefDataMap ("CDX.NA HY V18 FXD 85/100.5Y.7.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901572", "7626886", - "CDX-NAHYS7V18 FXD 85/100 - 1211", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_FXD_85/100", 2454007, 2455916, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIF9 FXD", "CDX", 7, "NA HY V18 FXD 85/100", null, "HY", 18, 5, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.EMDIV.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901573", "7626819", - "DJCDX-EMDIVS4V1 - 1211", "Dow Jones CDX.EM.DIVERSIFIED.4", - "DOW JONES CDX EM DIVER 4 5YR", 2454000, 2455916, 0.0095, "USD", - "ACT/360", true, 0.25, 2, "2165EKAD1", "DJCDX", 4, "EMDIV", null, "EM", 1, 5, - null, 1, 40, 0, "LON", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.EM.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901574", "7626843", - "DJCDX-EMS6V1 - 1211", "Dow Jones CDX.EM.6", - "DOW JONES CDX EM 6 5YR", 2454000, 2455917, 0.014, "USD", - "ACT/360", true, 0.25, 2, "2I65BZAF9", "DJCDX", 6, "EM", null, "EM", 1, 5, - null, 1, 14, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901575", "7626908", - "DJCDX-NAHYS7V1 - 1211", "Dow Jones CDX.NA.HY.7", - "DJCDX_NA_HY_S7_100_SWP", 2454007, 2455916, 0.0325, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAW0", "DJCDX", 7, "NA HY", null, "HY", 1, 5, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.3Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901576", "7626940", - "DJCDX-NAHYS7V1 - 1209", "Dow Jones CDX.NA.HY.7", - "DJCDX_NA_HY_S7_100_SWP_03YR", 2454007, 2455186, 0.0325, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAW0", "DJCDX", 7, "NA HY", null, "HY", 1, 3, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.7Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901577", "7626975", - "DJCDX-NAHYS7V1 - 1213", "Dow Jones CDX.NA.HY.7", - "DJCDX_NA_HY_S7_100_SWP_07YR", 2454007, 2456647, 0.0325, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAW0", "DJCDX", 7, "NA HY", null, "HY", 1, 7, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.10Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901578", "7626991", - "DJCDX-NAHYS7V1 - 1216", "Dow Jones CDX.NA.HY.7", - "DJCDX_NA_HY_S7_100_SWP_10YR", 2454007, 2457743, 0.0325, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAW0", "DJCDX", 7, "NA HY", null, "HY", 1, 10, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BV8 FXD 43/50.5Y.7.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901579", "7627009", - "CDX-NAHYBS7V8 FXD 43/50 - 1211", "Dow Jones CDX.NA.HY.B.7", - "CDX_NA_HY_S07_B___FXD_43/50", 2454007, 2455916, 0.030000000000000002, "USD", - "ACT/360", false, 0.3, 4, "2I65BSBP2 FXD", "CDX", 7, "NA HY BV8 FXD 43/50", null, "HY", 8, 5, - null, 0.86, 50, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY B.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901580", "7627017", - "DJCDX-NAHYBS7V1 - 1211", "Dow Jones CDX.NA.HY.B.7", - "CDX_NA_HY_S07_B___SWP", 2454007, 2455916, 0.030000000000000002, "USD", - "ACT/360", false, 0.3, 4, "2I65BSAL2", "DJCDX", 7, "NA HY B", null, "HY", 1, 5, - null, 1, 50, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BBV3 FXD 36/38.5Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901581", "7627041", - "CDX-NAHYBBS7V3 FXD 36/38 - 1211", "Dow Jones CDX.NA.HY.BB.7", - "DJCDX_NA_HY_S7_BB_FXD_36/38", 2454007, 2455916, 0.0205, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBD2 FXD", "CDX", 7, "NA HY BBV3 FXD 36/38", null, "HY", 3, 5, - null, 0.9473699999999999, 38, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY BB.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901582", "7627050", - "DJCDX-NAHYBBS7V1 - 1211", "Dow Jones CDX.NA.HY.BB.7", - "DJCDX_NA_HY_S7_BB_SWP", 2454007, 2455916, 0.0205, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BVAM3", "DJCDX", 7, "NA HY BB", null, "HY", 1, 5, - null, 1, 38, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HBV13 FXD 20/30.5Y.7.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901583", "7627068", - "CDX-NAHYHBS7V12 FXD 21/30 - 1211", "Dow Jones CDX.NA.HY.HB.7", - "CDX_NA_HY_S07_HB__FXD_21/30", 2454007, 2455916, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BWEY1 FXD", "CDX", 7, "NA HY HBV13 FXD 20/30", null, "HY", 13, 5, - null, 0.66667, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY HB.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901584", "7626797", - "DJCDX-NAHYHBS7V1 - 1211", "Dow Jones CDX.NA.HY.HB.7", - "DJCDX_NA_HY_S7_HB_SWP", 2454007, 2455916, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BWAM1", "DJCDX", 7, "NA HY HB", null, "HY", 1, 5, - null, 1, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.2Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901587", "7626851", - "DJCDX-NAIGS7V1 - 1208", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_02Y_12/08", 2454000, 2454821, 0.0015, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAL9", "DJCDX", 7, "NA IG", null, "IG", 1, 2, - null, 1, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.3Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901588", "7626860", - "DJCDX-NAIGS7V1 - 1209", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_03Y_12/09", 2454000, 2455186, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAL9", "DJCDX", 7, "NA IG", null, "IG", 1, 3, - null, 1, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901589", "7626878", - "DJCDX-NAIGS7V1 - 1211", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_05Y_12/11", 2454000, 2455916, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAL9", "DJCDX", 7, "NA IG", null, "IG", 1, 5, - null, 1, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.7Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901590", "7626894", - "DJCDX-NAIGS7V1 - 1213", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_07Y_12/13", 2454000, 2456647, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAL9", "DJCDX", 7, "NA IG", null, "IG", 1, 7, - null, 1, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.10Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901591", "7626916", - "DJCDX-NAIGS7V1 - 1216", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_10Y_12/16", 2454000, 2457743, 0.006500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAL9", "DJCDX", 7, "NA IG", null, "IG", 1, 10, - null, 1, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901593", "7626932", - "DJCDX-NAIGHVOLS7V1 - 1211", "Dow Jones CDX.NA.IG.HVOL.7", - "DJCDX_NA_IG_S7_HVOL_05Y_12/11", 2454000, 2455917, 0.007500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AL7", "DJCDX", 7, "NA IG HVOL", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.7Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901594", "7626959", - "DJCDX-NAIGHVOLS7V1 - 1213", "Dow Jones CDX.NA.IG.HVOL.7", - "DJCDX_NA_IG_S7_HVOL_07Y_12/13", 2454000, 2456647, 0.0095, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AL7", "DJCDX", 7, "NA IG HVOL", null, "HV", 1, 7, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.10Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901596", "7627025", - "DJCDX-NAIGHVOLS7V1 - 1216", "Dow Jones CDX.NA.IG.HVOL.7", - "DJCDX_NA_IG_S7_HVOL_10Y_12/16", 2454000, 2457743, 0.011000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AL7", "DJCDX", 7, "NA IG HVOL", null, "HV", 1, 10, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NAXO.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901597", "7627033", - "DJCDX-NAXOS7V1 - 1211", "Dow Jones CDX.NA.XO.7", - "DJCDX_NA_XO_S7_05YR_12/11", 2454000, 2455916, 0.0165, "USD", - "ACT/360", false, 0.4, 4, "1D764IAD9", "DJCDX", 7, "NAXO", null, "XO", 1, 5, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.2Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901598", "7629567", - "DJCDX-NAHYS7V1 - 1208", "Dow Jones CDX.NA.HY.7", - "DJCDX_NA_HY_S7_100_SWP_02YR", 2454007, 2454821, 0.0325, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAW0", "DJCDX", 7, "NA HY", null, "HY", 1, 2, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.4Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901599", "7628919", - "DJCDX-NAHYS7V1 - 1210", "Dow Jones CDX.NA.HY.7", - "DJCDX_NA_HY_S7_100_SWP_04YR", 2454007, 2455551, 0.0325, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAW0", "DJCDX", 7, "NA HY", null, "HY", 1, 4, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.6Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901600", "7630174", - "DJCDX-NAHYS7V1 - 1212", "Dow Jones CDX.NA.HY.7", - "DJCDX_NA_HY_S7_100_SWP_06YR", 2454007, 2456282, 0.0325, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAW0", "DJCDX", 7, "NA HY", null, "HY", 1, 6, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY V1 ALLPTS.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901601", "7630204", - "DJCDX-NAHYS7V1 ALLPTS - 1211", "Dow Jones CDX.NA.HY.7.ALLPTS", - "DJCDX_NA_HY_S7_ALLPTS", 2454007, 2455917, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRAW0 ALLPTS", "DJCDX", 7, "NA HY V1 ALLPTS", null, "HY", 1, 5, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.4Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901602", "7630239", - "DJCDX-NAIGS7V1 - 1210", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_04Y_12/10", 2454000, 2455551, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAL9", "DJCDX", 7, "NA IG", null, "IG", 1, 4, - null, 1, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG V1 EUR.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901603", "7629907", - "DJCDX-NAIGS7V1 EUR - 1211", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_05Y_12/11_EUR", 2454000, 2455916, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYAL9", "DJCDX", 7, "NA IG V1 EUR", null, "IG", 1, 5, - null, 1, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG V1 ALLPTS.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901604", "7629885", - "DJCDX-NAIGS7V1 ALLPTS - 1211", "Dow Jones CDX.NA.IG.7 ALLPTS", - "DJCDX_NA_IG_S7_ALLPTS", 2454000, 2455916, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAL9 ALLPTS", "DJCDX", 7, "NA IG V1 ALLPTS", null, "IG", 1, 5, - null, 1, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.3Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901605", "7633467", - "DJCDX-NAIGHVOLS7V1 - 1209", "Dow Jones CDX.NA.IG.HVOL.7", - "DJCDX_NA_IG_S7_HVOL_03Y_12/09", 2454000, 2455186, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AL7", "DJCDX", 7, "NA IG HVOL", null, "HV", 1, 3, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NAXO.10Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901606", "7633513", - "DJCDX-NAXOS7V1 - 1216", "Dow Jones CDX.NA.XO.7", - "DJCDX_NA_XO_S7_10YR_12/16", 2454000, 2457743, 0.021, "USD", - "ACT/360", false, 0.4, 4, "1D764IAD9", "DJCDX", 7, "NAXO", null, "XO", 1, 10, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.EM.10Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901607", "7629672", - "DJCDX-EMS6V1 - 1216", "Dow Jones CDX.EM.6", - "DOW JONES CDX EM 6 10YR", 2454000, 2457743, 0.02, "USD", - "ACT/360", false, 0.4, 4, "2I65BZAF9", "DJCDX", 6, "EM", null, "EM", 1, 10, - null, 1, 14, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.3Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901610", "7623208", - "ITRAXX-EUROPES6V1 - 1209", "iTraxx Europe Series 6 Version 1", - "ITRAXX-EUROPES6V1-1209 EUR SEN MMR I03 CDS", 2453999, 2455186, 0.002, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAF2", "ITRAXX", 6, "EUROPE", "EUR", "IG", 1, 3, - "232307", 1, 123, 0, "LON", true, true, true, "ITRXEB36", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901611", "7622767", - "ITRAXX-EUROPES6V1 - 1211", "iTraxx Europe Series 6 Version 1", - "ITRAXX-EUROPES6V1-1211 EUR SEN MMR I03 CDS MATURED", 2453999, 2455916, 0.003, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAF2", "ITRAXX", 6, "EUROPE", "EUR", "IG", 1, 5, - "232307", 1, 123, 0, "LON", true, true, true, "ITRXEB56", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.7Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901612", "7622775", - "ITRAXX-EUROPES6V1 - 1213", "iTraxx Europe Series 6 Version 1", - "ITRAXX-EUROPES6V1-1213 EUR SEN MMR I03 CDS MATURED", 2453999, 2456647, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAF2", "ITRAXX", 6, "EUROPE", "EUR", "IG", 1, 7, - "232307", 1, 122, 0, "LON", true, true, true, "ITRXEB76", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901613", "7622791", - "ITRAXX-EUROPES6V1 - 1216", "iTraxx Europe Series 6 Version 1", - "ITRAXX-EUROPES6V1-1216 EUR SEN MMR I03 CDS MATURED", 2453999, 2457743, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAF2", "ITRAXX", 6, "EUROPE", "EUR", "IG", 1, 10, - "232307", 1, 122, 0, "LON", true, true, true, "ITRXEB06", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901617", "7622945", - "ITRAXX-XOVERS6V1 - 1211", "iTraxx Europe Crossover series 6 Version 1", - "ITRAXX-XOVERS6V1-1211 EUR SEN MMR I03 CDS MATURED", 2453999, 2455916, 0.028, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAG3", "ITRAXX", 6, "XOVER", "XVR", "XO", 1, 5, - "232312", 1, 44, 0, "LON", true, true, true, "ITRXEX56", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901618", "7622953", - "ITRAXX-XOVERS6V1 - 1216", "iTraxx Europe Crossover series 6 Version 1", - "ITRAXX-XOVERS6V1-1216 EUR SEN MMR I03 CDS MATURED", 2453999, 2457743, 0.0345, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAG3", "ITRAXX", 6, "XOVER", "XVR", "XO", 1, 10, - "232312", 1, 44, 0, "LON", true, true, true, "ITRXEX06", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.3Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901619", "7622902", - "ITRAXX-HIVOLS6V1 - 1209", "iTraxx Europe HiVol Series 6 Version 1", - "ITRAXX-HIVOLS6V1-1209 EUR SEN MMR I03 CDS", 2453999, 2455186, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAF3", "ITRAXX", 6, "HIVOL", "VOL", "HV", 1, 3, - "232310", 1, 30, 0, "LON", true, true, true, "ITRXEH36", "VOL")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.1Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901620", "7629532", - "DJCDX-NAHYS7V1 - 1207", "Dow Jones CDX.NA.HY.7", - "DJCDX_NA_HY_S7_100_SWP_01YR", 2454007, 2454455, 0.0325, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAW0", "DJCDX", 7, "NA HY", null, "HY", 1, 1, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG CONS.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901621", "7629893", - "DJCDX-NAIGCONSS7V1 - 1211", "Dow Jones CDX.NA.IG.CONS.7", - "DJCDX_NA_IG_S7_CONS_12/11", 2454000, 2455916, 0.005, "USD", - "ACT/360", false, 0.5, 4, "2I65B0AI0", "DJCDX", 7, "NA IG CONS", null, "IG", 1, 5, - null, 1, 34, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901622", "7623500", - "ITRAXX-HIVOLS6V1 - 1211", "iTraxx Europe HiVol Series 6 Version 1", - "ITRAXX-HIVOLS6V1-1211 EUR SEN MMR I03 CDS MATURED", 2453999, 2455916, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAF3", "ITRAXX", 6, "HIVOL", "VOL", "HV", 1, 5, - "232310", 1, 30, 0, "LON", true, true, true, "ITRXEH56", "VOL")); - - UpdateCDXRefDataMap ("DJCDX.NA IG ENRG.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901623", "7628889", - "DJCDX-NAIGENRGS7V1 - 1211", "Dow Jones CDX.NA.IG.ENRG.7", - "DJCDX_NA_IG_S7_ENRG_12/11", 2454000, 2455916, 0.003, "USD", - "ACT/360", false, 0.5, 4, "2I65B1AI8", "DJCDX", 7, "NA IG ENRG", null, "IG", 1, 5, - null, 1, 14, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.7Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901624", "7623526", - "ITRAXX-HIVOLS6V1 - 1213", "iTraxx Europe HiVol Series 6 Version 1", - "ITRAXX-HIVOLS6V1-1213 EUR SEN MMR I03 CDS MATURED", 2453999, 2456647, 0.007, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAF3", "ITRAXX", 6, "HIVOL", "VOL", "HV", 1, 7, - "232310", 1, 30, 0, "LON", true, true, true, "ITRXEH76", "VOL")); - - UpdateCDXRefDataMap ("DJCDX.NA IG FIN.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901625", "7628897", - "DJCDX-NAIGFINS7V1 - 1211", "Dow Jones CDX.NA.IG.FIN.7", - "DJCDX_NA_IG_S7_FIN_12/11", 2454000, 2455916, 0.0025, "USD", - "ACT/360", false, 0.5, 4, "2I65B2AI6", "DJCDX", 7, "NA IG FIN", null, "IG", 1, 5, - null, 1, 25, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.10Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901626", "7623224", - "ITRAXX-HIVOLS6V1 - 1216", "iTraxx Europe HiVol Series 6 Version 1", - "ITRAXX-HIVOLS6V1-1216 EUR SEN MMR I03 CDS MATURED", 2453999, 2457743, 0.0085, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAF3", "ITRAXX", 6, "HIVOL", "VOL", "HV", 1, 10, - "232310", 1, 30, 0, "LON", true, true, true, "ITRXEH06", "VOL")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.2Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901627", "7628900", - "DJCDX-NAIGHVOLS7V1 - 1208", "Dow Jones CDX.NA.IG.HVOL.7", - "DJCDX_NA_IG_S7_HVOL_02Y_12/08", 2454000, 2454821, 0.003, "USD", - "ACT/360", false, 0.5, 4, "2I65B3AL7", "DJCDX", 7, "NA IG HVOL", null, "HV", 1, 2, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.4Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901628", "7633475", - "DJCDX-NAIGHVOLS7V1 - 1210", "Dow Jones CDX.NA.IG.HVOL.7", - "DJCDX_NA_IG_S7_HVOL_04Y_12/10", 2454000, 2455551, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AL7", "DJCDX", 7, "NA IG HVOL", null, "HV", 1, 4, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet7() - { - UpdateCDXRefDataMap ("DJCDX.NA IG INDU.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901631", "7628498", - "DJCDX-NAIGINDUS7V1 - 1211", "Dow Jones CDX.NA.IG.INDU.7", - "DJCDX_NA_IG_S7_INDU_12/11", 2454000, 2455916, 0.004, "USD", - "ACT/360", false, 0.5, 4, "2I65B4AL5", "DJCDX", 7, "NA IG INDU", null, "IG", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG TMT.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901633", "7628501", - "DJCDX-NAIGTMTS7V1 - 1211", "Dow Jones CDX.NA.IG.TMT.7", - "DJCDX_NA_IG_S7_TMT_12/11", 2454000, 2455916, 0.005, "USD", - "ACT/360", false, 0.5, 4, "2I65DJAI7", "DJCDX", 7, "NA IG TMT", null, "IG", 1, 5, - null, 1, 23, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NAXO.3Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901634", "7628510", - "DJCDX-NAXOS7V1 - 1209", "Dow Jones CDX.NA.XO.7", - "DJCDX_NA_XO_S7_03YR_12/09", 2454000, 2455186, 0.0125, "USD", - "ACT/360", false, 0.5, 4, "1D764IAD9", "DJCDX", 7, "NAXO", null, "XO", 1, 3, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NAXO.7Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901635", "7633505", - "DJCDX-NAXOS7V1 - 1213", "Dow Jones CDX.NA.XO.7", - "DJCDX_NA_XO_S7_07YR_12/13", 2454000, 2456647, 0.0195, "USD", - "ACT/360", false, 0.5, 4, "1D764IAD9", "DJCDX", 7, "NAXO", null, "XO", 1, 7, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOLV1 ALLPTS.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901638", "7633491", - "DJCDX-NAIGHVOLS7V1 ALLPTS - 1211", "Dow Jones CDX.NA.IG.HVOL.7.ALLPTS", - "DJCDX_NA_IG_S7_HVOL_ALLPTS", 2454000, 2455916, 0.007500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AL7 ALLPTS", "DJCDX", 7, "NA IG HVOLV1 ALLPTS", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA XO.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901639", "7633521", - "DJCDX-NAXOHVOLS7V1 ALLPTS - 1211", "Dow Jones CDX.NA.XO.7.ALLPTS", - "DJCDX_NA_XO_S7_ALLPTS", 2454000, 2455916, 0.0165, "USD", - "ACT/360", false, 0.4, 4, "1D764IAD9 ALLPTS", "DJCDX", 7, "NA XO", null, "XO", 1, 5, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901645", "7627840", - "ITRAXX-FINSENS6V1 - 1211", "iTraxx Europe Senior Financials series 6 Version 1", - "ITRAXX-FINSENS6V1-1211 EUR SEN MMR I03 CDS", 2453999, 2455917, 0.001, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAF1", "ITRAXX", 6, "FINSEN", "SEN", "IG", 1, 5, - "232308", 1, 23, 0, "LON", true, true, true, "ITRXES56", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.10Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901646", "7633092", - "ITRAXX-FINSENS6V1 - 1216", "iTraxx Europe Senior Financials series 6 Version 1", - "ITRAXX-FINSENS6V1-1216 EUR SEN MMR I03 CDS", 2453999, 2457743, 0.002, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAF1", "ITRAXX", 6, "FINSEN", "SEN", "IG", 1, 10, - "232308", 1, 23, 0, "LON", true, true, true, "ITRXES06", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901647", "7633130", - "ITRAXX-FINSUBS6V1 - 1211", "iTraxx Europe Sub Financials series 6 Version 1", - "ITRAXX-FINSUBS6V1-1211 LT2 SUB MMR I03 CDS", 2453999, 2455917, 0.002, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAG7", "ITRAXX", 6, "FINSUB", "SUB", "IG", 1, 5, - "232309", 1, 23, 0, "LON", true, true, true, "ITRXEU56", "SUB")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.10Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901648", "7633149", - "ITRAXX-FINSUBS6V1 - 1216", "iTraxx Europe Sub Financials series 6 Version 1", - "ITRAXX-FINSUBS6V1-1216 LT2 SUB MMR I03 CDS", 2453999, 2457743, 0.003, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAG7", "ITRAXX", 6, "FINSUB", "SUB", "IG", 1, 10, - "232309", 1, 23, 0, "LON", true, true, true, "ITRXEU06", "SUB")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901650", "7630131", - "USD ITRAXX-EUROPES6V1 - 1211", "iTraxx Europe series 6 Version 1", - "ITRAXX-EUROPES6V1-1211 USD SEN MMR I03 CDS MATURED", 2453999, 2455916, 0.003, "USD", - "ACT/360", false, 0.4, 4, "2I666VAF2", "USD ITRAXX", 6, "EUROPE", "EUR", "IG", 1, 5, - "232307", 1, 122, 0, "LON", false, false, true, "ITRXEB56", "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.HIVOL.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901651", "7634846", - "USD ITRAXX-HIVOLS6V1 - 1211", "iTraxx Europe HiVol series 6 Version 1", - "ITRAXX-HIVOLS6V1-1211 USD SEN MMR I03 CDS MATURED", 2453999, 2455916, 0.0055000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I667LAF3", "USD ITRAXX", 6, "HIVOL", "VOL", "HV", 1, 5, - "232310", 1, 30, 0, "LON", false, false, true, "ITRXEH56", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901658", "7628609", - "ITRAXX-ASIAXJS6V1 - 1211", "iTraxx Asia ex-Japan Series Number 6 Version 1", - "ITRAXX-ASIAXJS6V1-1211 USD SEN RES I03 CDS", 2453999, 2455917, 0.0055000000000000005, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I668DAF0", "ITRAXX", 6, "ASIAXJ", null, "IG", 1, 5, - "232383", 1, 50, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901659", "7628625", - "ITRAXX-JAPANS6V1 - 1216", "iTraxx Japan Series Number 6 Version 1", - "ITRAXX-CJAPANS6V1-1216 JPY SEN RES I03 CDS", 2453999, 2457743, 0.004, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAF1", "ITRAXX", 6, "JAPAN", null, "IG", 1, 10, - "232387", 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.AUSTRALIA.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901661", "7628617", - "ITRAXX-AUSTRALIAS6V1 - 1211", "iTraxx Australia Series Number 6 Version 1", - "ITRAXX-AUSTRALIAS6V1-1211 USD SEN MR I03 CDS", 2453999, 2455916, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I668IAF9", "ITRAXX", 6, "AUSTRALIA", null, "IG", 1, 5, - "232386", 1, 25, 0, "HKG", false, false, true, null, "Itraxx Australia")); - - UpdateCDXRefDataMap ("ITRAXX.CJAPAN.3Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901662", "7628633", - "ITRAXX-CJAPANS6V1 - 1209", "iTraxx Japan series 6 Version 1", - "ITRAXX-CJAPANS6V1-1209 JPY SEN RES I03 CDS", 2453999, 2455186, 0.0015, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAF1", "ITRAXX", 6, "CJAPAN", null, "IG", 1, 3, - "232387", 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901664", "7628650", - "ITRAXX-JAPANS6V1 - 1211", "iTraxx Japan Series Number 6 Version 1", - "ITRAXX-CJAPANS6V1-1211 JPY SEN RES I03 CDS", 2453999, 2455916, 0.0025, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAF1", "ITRAXX", 6, "JAPAN", null, "IG", 1, 5, - "232387", 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.KOREA.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901668", "7631030", - "ITRAXX-KOREAS6V1 - 1211", "iTraxx Korea Series Number 6 Version 1", - "ITRAXX-KOREAS6V1-5Y 1211 USD SEN RES I03 CDS", 2453999, 2455917, 0.003, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I668EAF8", "ITRAXX", 6, "KOREA", null, "IG", 1, 5, - "0", 1, 10, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901672", "7630980", - "ITRAXX-JAPANHIVOLS6V1 - 1211", "iTraxx Japan HiVol Series Number 6 Version 1", - "ITRAXX-CJHIVOLS6V1-5Y 1211 JPY SEN RES I03 CDS", 2453999, 2455916, 0.0055000000000000005, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MAE3", "ITRAXX", 6, "JAPANHIVOL", "VOL", "HV", 1, 5, - "0", 1, 24, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAREST.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901674", "7631057", - "ITRAXX-ASIARESTS6V1 - 1211", "iTraxx Rest of Asia Series Number 6 Version 1", - "ITRAXX-ASIARESTS6V1-5Y 1211 USD SEN RES I03 CDS", 2453999, 2455916, 0.006, "USD", - "ACT/360", false, 0.3, 4, "2I668GAF3", "ITRAXX", 6, "ASIAREST", null, "IG", 1, 5, - "0", 1, 23, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.GRCHINA.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("901675", "7631014", - "ITRAXX-GRCHINAS6V1 - 1211", "iTraxx Greater China Series Number 6 Version 1", - "ITRAXX-GRCHINAS6V1-5Y 1211 USD SEN RES I03 CDS", 2453999, 2455916, 0.0055000000000000005, "USD", - "ACT/360", false, 0.3, 4, "2I668FAF5", "ITRAXX", 6, "GRCHINA", null, "IG", 1, 5, - "0", 1, 17, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("DJCDX.NA HY BV2 DFLT.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("909103", "7672705", - "DJCDX-NAHYBS4V2 DFLT - 0610", "Dow Jones CDX.NA.HY.B.4 - DO NOT USE - FOR DFLT", - "DJCDX_NA_HY_S4_B_SWP 39/40", 2453475, 2455368, 0.034, "USD", - "ACT/360", false, 0.4, 4, "defaulted amk1", "DJCDX", 4, "NA HY BV2 DFLT", null, "HY", 2, 5, - null, 0.975, 40, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.5Y.7.0", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("909104", "7672969", - "DJCDX-NAHYS7V0 - 1211", "Dow Jones CDX.NA.HY.7 - DO NOT USE - FOR DFLT", - "DJCDX_NA_HY_S7_100_SWP_99/100 - CURVE TO BE DELETED", 2454007, 2455916, 0.0325, "USD", - "ACT/360", false, 0.35000000000000003, 4, "defaulted amk2", "DJCDX", 7, "NA HY", null, "HY", 0, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.1Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("909105", "7672977", - "DJCDX-NAHYS7V2 - 1207", "Dow Jones CDX.NA.HY.7 - DO NOT USE - FOR DFLT", - "DJCDX_NA_HY_S7_100_SWP_01YR_99/100", 2454007, 2454455, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "defaulted amk3", "DJCDX", 7, "NA HY", null, "HY", 2, 1, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.2Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("909106", "7672985", - "DJCDX-NAHYS7V2 - 1208", "Dow Jones CDX.NA.HY.7 - DO NOT USE - FOR DFLT", - "DJCDX_NA_HY_S7_100_SWP_02YR_99/100", 2454007, 2454821, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "defaulted amk4", "DJCDX", 7, "NA HY", null, "HY", 2, 2, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.4Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("909108", "7672888", - "DJCDX-NAHYS7V2 - 1210", "Dow Jones CDX.NA.HY.7 - DO NOT USE - FOR DFLT", - "DJCDX_NA_HY_S7_100_SWP_04YR_99/100", 2454007, 2455551, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "defaulted amk6", "DJCDX", 7, "NA HY", null, "HY", 2, 4, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.0Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("909109", "7672861", - "DJCDX-NAHYS7V2 - 1212", "Dow Jones CDX.NA.HY.7 - DO NOT USE - FOR DFLT", - "DJCDX_NA_HY_S7_100_SWP_06YR_99/100", 2454007, 2456282, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "defaulted amk7", "DJCDX", 7, "NA HY", null, "HY", 2, 0, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.7Y.7.0", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("909110", "7672810", - "DJCDX-NAHYS7V0 - 1213", "Dow Jones CDX.NA.HY.7 - DO NOT USE - FOR DFLT", - "DJCDX_NA_HY_S7_100_SWP_07YR_99/100 - TO BE DELETED", 2454007, 2456647, 0.0325, "USD", - "ACT/360", false, 0.35000000000000003, 4, "defauted amk8", "DJCDX", 7, "NA HY", null, "HY", 0, 7, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.10Y.7.0", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("909111", "7672799", - "DJCDX-NAHYS7V0 - 1216", "Dow Jones CDX.NA.HY.7 - DO NOT USE - FOR DFLT", - "DJCDX_NA_HY_S7_100_SWP_10YR_99/100", 2454007, 2457743, 0.0325, "USD", - "ACT/360", false, 0.35000000000000003, 4, "defaulted amk9", "DJCDX", 7, "NA HY", null, "HY", 0, 10, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY HB.5Y.7.0", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("909112", "7672772", - "DJCDX-NAHYHBS7V0 - 1211", "Dow Jones CDX.NA.HY.HB.7 - DO NOT USE - FOR DFLT", - "DJCDX_NA_HY_S7_HB_SWP_29/30 - CURVE TO BE DELETED", 2454007, 2455916, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "defaulted amk10", "DJCDX", 7, "NA HY HB", null, "HY", 0, 5, - null, 0.96666, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY V2 ALLPTS.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("909113", "7672764", - "DJCDX-NAHYS7V2 ALLPTS - 1211", "Dow Jones CDX.NA.HY.7 ALLPTS - DO NOT USE - FOR DFLT", - "DJCDX_NA_HY_S7_ALLPTS_99/100", 2454007, 2455916, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "defaulted amk11", "DJCDX", 7, "NA HY V2 ALLPTS", null, "HY", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOLV1 EUR.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("913513", "7717113", - "DJCDX-NAIGHVOLS6V1 EUR - 0611", "Dow Jones CDX.NA.IG.HVOL.6", - "DJCDX_NA_IG_S6_HVOL_05Y_6/11_EUR", 2453816, 2455733, 0.007500000000000001, "EUR", - "ACT/360", false, 0.4, 4, "2I65B3AK9 EUR", "DJCDX", 6, "NA IG HVOLV1 EUR", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.10Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918152", "7630247", - "USD ITRAXX-EUROPES6V1 - 1216", "iTraxx Europe series 6 Version 1", - "ITRAXX-EUROPES6V1-1216 USD SEN MMR I03 CDS MATURED", 2453999, 2457743, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I666VAF2", "USD ITRAXX", 6, "EUROPE", "EUR", "IG", 1, 10, - "232307", 1, 122, 0, "LON", false, false, true, "ITRXEB06", "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918167", "7762305", - "USD ITRAXX-XOVERS5V1 - 0611", "iTraxx Europe Crossover Series 5 Version 1", - "ITRAXX-XOVERS5V1-0611 USD SEN MMR I03 CDS MATURED", 2453815, 2455733, 0.029, "USD", - "ACT/360", false, 0.4, 4, "2I667KAF5", "USD ITRAXX", 5, "XOVER", "XVR", "XO", 1, 5, - "231396", 1, 44, 0, "LON", false, false, true, "ITRXEX55", "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918348", "7813287", - "USD ITRAXX-XOVERS6V1 - 1211", "iTraxx Europe Crossover Series 6 Version 1", - "ITRAXX-XOVERS6V1-1211 USD SEN MMR I03 CDS MATURED", 2453999, 2455916, 0.028, "USD", - "ACT/360", false, 0.4, 4, "2I667KAG3", "USD ITRAXX", 6, "XOVER", "XVR", "XO", 1, 5, - "232312", 1, 44, 0, "LON", false, false, true, "ITRXEX56", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918452", "7875665", - "ITRAXX-ASIAXJS7V1 - 0612", "iTraxx Asia Ex-Japan Series Number 7 Version 1", - "ITRAXX-ASIAXJS7V1-0612 USD SEN RES I03 CDS", 2454180, 2456099, 0.005, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I668DAG8", "ITRAXX", 7, "ASIAXJ", null, "IG", 1, 5, - "233847", 1, 50, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.AUSTRALIA.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918453", "7875673", - "ITRAXX-AUSTRALIAS7V1 - 0612", "iTraxx Australia Series Number 7 Version 1", - "ITRAXX-AUSTRALIAS7V1-0612 USD SEN MR I03 CDS", 2454180, 2456099, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I668IAG7", "ITRAXX", 7, "AUSTRALIA", null, "IG", 1, 5, - "233848", 1, 25, 0, "HKG", false, false, true, null, "Itraxx Australia")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918454", "7875681", - "ITRAXX-JAPANHIVOLS7V1 - 0612", "iTraxx Japan HiVol Series Number 7 version 1", - "ITRAXX-JHIVOLS7V1-5Y 0612 JPY SEN RES I03 CDS", 2454180, 2456099, 0.006, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MAF0", "ITRAXX", 7, "JAPANHIVOL", "VOL", "HV", 1, 5, - "233860", 1, 24, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918457", "7875690", - "ITRAXX-JAPANS7V1 - 0617", "iTraxx Japan Series Number 7 Version 1", - "ITRAXX-JAPANS7V1-0617 JPY SEN RES I03 CDS", 2454180, 2457925, 0.0035, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAG9", "ITRAXX", 7, "JAPAN", null, "IG", 1, 10, - "233861", 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.3Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918459", "7875703", - "ITRAXX-JAPANS7V1 - 0610", "iTraxx Japan Series Number 7 Version 1", - "ITRAXX-JAPANS7V1-0610 JPY SEN RES I03 CDS", 2454180, 2455368, 0.0015, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAG9", "ITRAXX", 7, "JAPAN", null, "IG", 1, 3, - "233861", 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918460", "7875720", - "ITRAXX-JAPANS7V1 - 0612", "iTraxx Japan Series Number 7 Version 1", - "ITRAXX-JAPANS7V1-0612 JPY SEN RES I03 CDS", 2454180, 2456099, 0.0025, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAG9", "ITRAXX", 7, "JAPAN", null, "IG", 1, 5, - "233861", 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.KOREA.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918464", "7875754", - "ITRAXX-KOREAS7V1 - 0612", "iTraxx Korea Series Number 7 Version 1", - "ITRAXX-KOREAS7V1-5Y 0612 USD SEN RES I03 CDS", 2454180, 2456099, 0.002, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I668EAG6", "ITRAXX", 7, "KOREA", null, "IG", 1, 5, - "0", 1, 10, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAREST.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918465", "7875762", - "ITRAXX-ASIARESTS7V1 - 0612", "iTraxx Rest of Asia Series Number 7 Version 1", - "ITRAXX-ASIARESTS7V1-5Y 0612 USD SEN RES I03 CDS", 2454180, 2456099, 0.0055000000000000005, "USD", - "ACT/360", false, 0.3, 4, "2I668GAG1", "ITRAXX", 7, "ASIAREST", null, "IG", 1, 5, - "0", 1, 23, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.GRCHINA.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918474", "7875746", - "ITRAXX-GRCHINAS7V1 - 0612", "iTraxx Greater China Series Number 7 Version 1", - "ITRAXX-GRCHINAS7V1-5Y 0612 USD SEN RES I03 CDS", 2454180, 2456099, 0.006500000000000001, "USD", - "ACT/360", false, 0.3, 4, "2I668FAG3", "ITRAXX", 7, "GRCHINA", null, "IG", 1, 5, - "0", 1, 17, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.3Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918476", "7876696", - "ITRAXX-EUROPES7V1 - 0610", "iTraxx Europe series 7 Version 1", - "ITRAXX-EUROPES7V1-0610 EUR SEN MMR I03 CDS MATURED", 2454180, 2455368, 0.002, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAG0", "ITRAXX", 7, "EUROPE", "EUR", "IG", 1, 3, - "233812", 1, 123, 0, "LON", true, true, true, "ITRXEB37", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918477", "7877293", - "ITRAXX-XOVERS7V1 - 0617", "iTraxx Europe Crossover series 7 Version 1", - "ITRAXX-XOVERS7V1-0617 EUR SEN MMR I03 CDS MATURED", 2454180, 2457925, 0.032, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAH1", "ITRAXX", 7, "XOVER", "XVR", "XO", 1, 10, - "233807", 1, 50, 0, "LON", true, true, true, "ITRXEX07", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918478", "7876882", - "ITRAXX-XOVERS7V1 - 0612", "iTraxx Europe Crossover series 7 Version 1", - "ITRAXX-XOVERS7V1-0612 EUR SEN MMR I03 CDS MATURED", 2454180, 2456099, 0.023, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAH1", "ITRAXX", 7, "XOVER", "XVR", "XO", 1, 5, - "233807", 1, 50, 0, "LON", true, true, true, "ITRXEX57", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918480", "7876718", - "ITRAXX-EUROPES7V1 - 0612", "iTraxx Europe series 7 Version 1", - "ITRAXX-EUROPES7V1-0612 EUR SEN MMR I03 CDS MATURED", 2454180, 2456099, 0.003, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAG0", "ITRAXX", 7, "EUROPE", "EUR", "IG", 1, 5, - "233812", 1, 123, 0, "LON", true, true, true, "ITRXEB57", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.10Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918482", "7877200", - "ITRAXX-HIVOLS7V1 - 0617", "iTraxx Europe HiVol series 7 Version 1", - "ITRAXX-HIVOLS7V1-0617 EUR SEN MMR I03 CDS MATURED", 2454180, 2457925, 0.0085, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAG1", "ITRAXX", 7, "HIVOL", "VOL", "HV", 1, 10, - "233809", 1, 31, 0, "LON", true, true, true, "ITRXEH07", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.7Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918483", "7876750", - "ITRAXX-EUROPES7V1 - 0614", "iTraxx Europe series 7 Version 1", - "ITRAXX-EUROPES7V1-0614 EUR SEN MMR I03 CDS MATURED", 2454180, 2456829, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAG0", "ITRAXX", 7, "EUROPE", "EUR", "IG", 1, 7, - "233812", 1, 123, 0, "LON", true, true, true, "ITRXEB77", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.7Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918484", "7877226", - "ITRAXX-HIVOLS7V1 - 0614", "iTraxx Europe HiVol series 7 Version 1", - "ITRAXX-HIVOLS7V1-0614 EUR SEN MMR I03 CDS MATURED", 2454180, 2456829, 0.007, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAG1", "ITRAXX", 7, "HIVOL", "VOL", "HV", 1, 7, - "233809", 1, 31, 0, "LON", true, true, true, "ITRXEH77", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918485", "7877242", - "ITRAXX-HIVOLS7V1 - 0612", "iTraxx Europe HiVol series 7 Version 1", - "ITRAXX-HIVOLS7V1-0612 EUR SEN MMR I03 CDS MATURED", 2454180, 2456099, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAG1", "ITRAXX", 7, "HIVOL", "VOL", "HV", 1, 5, - "233809", 1, 31, 0, "LON", true, true, true, "ITRXEH57", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918486", "7876785", - "ITRAXX-EUROPES7V1 - 0617", "iTraxx Europe series 7 Version 1", - "ITRAXX-EUROPES7V1-0617 EUR SEN MMR I03 CDS MATURED", 2454180, 2457925, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAG0", "ITRAXX", 7, "EUROPE", "EUR", "IG", 1, 10, - "233812", 1, 123, 0, "LON", true, true, true, "ITRXEB07", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.3Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918487", "7877269", - "ITRAXX-HIVOLS7V1 - 0610", "iTraxx Europe HiVol series 7 Version 1", - "ITRAXX-HIVOLS7V1-0610 EUR SEN MMR I03 CDS MATURED", 2454180, 2455368, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAG1", "ITRAXX", 7, "HIVOL", "VOL", "HV", 1, 3, - "233809", 1, 31, 0, "LON", true, true, true, "ITRXEH37", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.10Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918488", "7876866", - "ITRAXX-FINSUBS7V1 - 0617", "iTraxx Europe Sub Financials series 7 Version 1", - "ITRAXX-FINSUBS7V1-0617 LT2 SUB MMR I03 CDS", 2454180, 2457925, 0.003, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAH5", "ITRAXX", 7, "FINSUB", "SUB", "IG", 1, 10, - "233810", 1, 24, 0, "LON", true, true, true, "ITRXEU07", "SUB")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918489", "7877099", - "ITRAXX-FINSENS7V1 - 0612", "iTraxx Europe Senior Financials series 7 Version 1", - "ITRAXX-FINSENS7V1-0612 EUR SEN MMR I03 CDS", 2454180, 2456099, 0.001, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAG9", "ITRAXX", 7, "FINSEN", "SEN", "IG", 1, 5, - "233811", 1, 24, 0, "LON", true, true, true, "ITRXES57", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918490", "7877013", - "ITRAXX-FINSUBS7V1 - 0612", "iTraxx Europe Sub Financials series 7 Version 1", - "ITRAXX-FINSUBS7V1-0612 LT2 SUB MMR I03 CDS", 2454180, 2456099, 0.002, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAH5", "ITRAXX", 7, "FINSUB", "SUB", "IG", 1, 5, - "233810", 1, 24, 0, "LON", true, true, true, "ITRXEU57", "SUB")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.10Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918491", "7877056", - "ITRAXX-FINSENS7V1 - 0617", "iTraxx Europe Senior Financials series 7 Version 1", - "ITRAXX-FINSENS7V1-0617 EUR SEN MMR I03 CDS", 2454180, 2457925, 0.002, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAG9", "ITRAXX", 7, "FINSEN", "SEN", "IG", 1, 10, - "233811", 1, 24, 0, "LON", true, true, true, "ITRXES07", "SEN")); - - UpdateCDXRefDataMap ("CDX.NAXO.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918501", "7884079", - "CDX-NAXOS8V1 - 0612", "CDX.NA.XO.8", - "CDX_NA_XO_S8_05YR_06/12", 2454181, 2456099, 0.014, "USD", - "ACT/360", false, 0.4, 4, "1D764IAE7", "CDX", 8, "NAXO", null, "XO", 1, 5, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.10Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918503", "7884117", - "CDX-NAXOS8V1 - 0617", "CDX.NA.XO.8", - "CDX_NA_XO_S8_10YR_06/17", 2454181, 2457925, 0.021500000000000002, "USD", - "ACT/360", false, 0.4, 4, "1D764IAE7", "CDX", 8, "NAXO", null, "XO", 1, 10, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918504", "7880324", - "CDX-NAIGS8V1 - 0612", "CDX.NA.IG.8", - "CDX_NA_IG_S8_05Y_06/12", 2454181, 2456099, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAM7", "CDX", 8, "NA IG", null, "IG", 1, 5, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918505", "7880391", - "CDX-NAIGS8V1 - 0617", "CDX.NA.IG.8", - "CDX_NA_IG_S8_10Y_06/17", 2454181, 2457925, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAM7", "CDX", 8, "NA IG", null, "IG", 1, 10, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918506", "7879601", - "CDX-NAIGHVOLS8V1 - 0612", "CDX.NA.IG.HVOL.8", - "CDX_NA_IG_S8_HVOL_05Y_06/12", 2454181, 2456099, 0.007500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AM5", "CDX", 8, "NA IG HVOL", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.10Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918507", "7879970", - "CDX-NAIGHVOLS8V1 - 0617", "CDX.NA.IG.HVOL.8", - "CDX_NA_IG_S8_HVOL_10Y_06/17", 2454181, 2457925, 0.0125, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AM5", "CDX", 8, "NA IG HVOL", null, "HV", 1, 10, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.1Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918510", "7880251", - "CDX-NAIGS8V1 - 0608", "CDX.NA.IG.8", - "CDX_NA_IG_S8_01Y_06/08", 2454181, 2454638, 0.001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAM7", "CDX", 8, "NA IG", null, "IG", 1, 1, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.2Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918511", "7880286", - "CDX-NAIGS8V1 - 0609", "CDX.NA.IG.8", - "CDX_NA_IG_S8_02Y_06/09", 2454181, 2455003, 0.0015, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAM7", "CDX", 8, "NA IG", null, "IG", 1, 2, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918512", "7880294", - "CDX-NAIGS8V1 - 0610", "CDX.NA.IG.8", - "CDX_NA_IG_S8_03Y_06/10", 2454181, 2455368, 0.002, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAM7", "CDX", 8, "NA IG", null, "IG", 1, 3, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.3Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918513", "7879580", - "CDX-NAIGHVOLS8V1 - 0610", "CDX.NA.IG.HVOL.8", - "CDX_NA_IG_S8_HVOL_03Y_06/10", 2454181, 2455368, 0.0045000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AM5", "CDX", 8, "NA IG HVOL", null, "HV", 1, 3, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.4Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918514", "7879598", - "CDX-NAIGHVOLS8V1 - 0611", "CDX.NA.IG.HVOL.8", - "CDX_NA_IG_S8_HVOL_04Y_06/11", 2454181, 2455733, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AM5", "CDX", 8, "NA IG HVOL", null, "HV", 1, 4, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918515", "7880316", - "CDX-NAIGS8V1 - 0611", "CDX.NA.IG.8", - "CDX_NA_IG_S8_04Y_06/11", 2454181, 2455733, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAM7", "CDX", 8, "NA IG", null, "IG", 1, 4, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V1 EUR.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918517", "7880367", - "CDX-NAIGS8V1 EUR - 0612", "CDX.NA.IG.8", - "CDX_NA_IG_S8_05Y_06/12_EUR", 2454181, 2456099, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYAM7 EUR", "CDX", 8, "NA IG V1 EUR", null, "IG", 1, 5, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOLV1 ALLPTS.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918518", "7879989", - "CDX-NAIGHVOLS8V1 ALLPTS - 0612", "CDX.NA.IG.HVOL.8.ALLPTS", - "CDX_NA_IG_S8_HVOL_ALLPTS", 2454181, 2456099, 0.011000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AM5 ALLPTS", "CDX", 8, "NA IG HVOLV1 ALLPTS", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918519", "7880375", - "CDX-NAIGS8V1 - 0614", "CDX.NA.IG.8", - "CDX_NA_IG_S8_07Y_06/14", 2454181, 2456829, 0.0045000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAM7", "CDX", 8, "NA IG", null, "IG", 1, 7, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.2Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918520", "7879571", - "CDX-NAIGHVOLS8V1 - 0609", "CDX.NA.IG.HVOL.8", - "CDX_NA_IG_S8_HVOL_02Y_06/09", 2454181, 2455003, 0.003, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AM5", "CDX", 8, "NA IG HVOL", null, "HV", 1, 2, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V1 ALLPTS.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918522", "7880413", - "CDX-NAIGS8V1 ALLPTS - 0612", "CDX.NA.IG.8.ALLPTS", - "CDX_NA_IG_S8_ALLPTS", 2454181, 2456099, 0.006500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAM7 ALLPTS", "CDX", 8, "NA IG V1 ALLPTS", null, "IG", 1, 5, - null, 0.996, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG CONS.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918523", "7879539", - "CDX-NAIGCONSS8V1 - 0612", "CDX.NA.IG.CONS.8", - "CDX_NA_IG_S8_CONS_06/12", 2454181, 2456099, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65B0AJ8", "CDX", 8, "NA IG CONS", null, "IG", 1, 5, - null, 1, 34, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.1Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918524", "7879563", - "CDX-NAIGHVOLS8V1 - 0608", "CDX.NA.IG.HVOL.8", - "CDX_NA_IG_S8_HVOL_01Y_06/08", 2454181, 2454638, 0.002, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AM5", "CDX", 8, "NA IG HVOL", null, "HV", 1, 1, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918525", "7879555", - "CDX-NAIGFINS8V1 - 0612", "CDX.NA.IG.FIN.8", - "CDX_NA_IG_S8_FIN_06/12", 2454181, 2456099, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65B2AJ4", "CDX", 8, "NA IG FIN", null, "IG", 1, 5, - null, 1, 25, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG ENRG.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918526", "7879547", - "CDX-NAIGENRGS8V1 - 0612", "CDX.NA.IG.ENRG.8", - "CDX_NA_IG_S8_ENRG_06/12", 2454181, 2456099, 0.003, "USD", - "ACT/360", false, 0.4, 4, "2I65B1AJ6", "CDX", 8, "NA IG ENRG", null, "IG", 1, 5, - null, 1, 14, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXOV1 ALLPTS.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918527", "7884133", - "CDX-NAXOS8V1 ALLPTS - 0612", "CDX.NA.XO.8.ALLPTS", - "CDX_NA_XO_S8_ALLPTS", 2454181, 2456099, 0.0165, "USD", - "ACT/360", false, 0.4, 4, "1D764IAE7 ALLPTS", "CDX", 8, "NAXOV1 ALLPTS", null, "XO", 1, 5, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG INDU.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918528", "7880014", - "CDX-NAIGINDUS8V1 - 0612", "CDX.NA.IG.INDU.8", - "CDX_NA_IG_S8_INDU_06/12", 2454181, 2456099, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65B4AM3", "CDX", 8, "NA IG INDU", null, "IG", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.7Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918529", "7884095", - "CDX-NAXOS8V1 - 0614", "CDX.NA.XO.8", - "CDX_NA_XO_S8_07YR_06/14", 2454181, 2456829, 0.018500000000000003, "USD", - "ACT/360", false, 0.4, 4, "1D764IAE7", "CDX", 8, "NAXO", null, "XO", 1, 7, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG TMT.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918530", "7880073", - "CDX-NAIGTMTS8V1 - 0612", "CDX.NA.IG.TMT.8", - "CDX_NA_IG_S8_TMT_06/12", 2454181, 2456099, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65DJAJ5", "CDX", 8, "NA IG TMT", null, "IG", 1, 5, - null, 1, 22, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.3Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918531", "7881851", - "CDX-NAXOS8V1 - 0610", "CDX.NA.XO.8", - "CDX_NA_XO_S8_03YR_06/10", 2454181, 2455368, 0.0085, "USD", - "ACT/360", false, 0.4, 4, "1D764IAE7", "CDX", 8, "NAXO", null, "XO", 1, 3, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.EM.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918532", "7879911", - "CDX-EMS7V1 - 0612", "CDX.EM.7", - "CDX EM 7 5YR", 2454181, 2456099, 0.0125, "USD", - "ACT/360", true, 0.25, 2, "2I65BZAG7", "CDX", 7, "EM", null, "EM", 1, 5, - null, 1, 14, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.EMDIV.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918533", "7879890", - "CDX-EMDIVS5V1 - 0612", "CDX.EM.DIVERSIFIED.5", - "CDX EM DIVER 5 5YR", 2454181, 2456099, 0.008, "USD", - "ACT/360", true, 0.25, 2, "2165EKAE9", "CDX", 5, "EMDIV", null, "EM", 1, 5, - null, 1, 40, 0, "LON", false, false, false, null, "DJCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet8() - { - UpdateCDXRefDataMap ("CDX.EM.10Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918535", "7879903", - "CDX-EMS7V1 - 0617", "CDX.EM.7", - "CDX EM 7 10YR", 2454181, 2457925, 0.0175, "USD", - "ACT/360", false, 0.25, 4, "2I65BZAG7", "CDX", 7, "EM", null, "EM", 1, 10, - null, 1, 14, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.7Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918536", "7879610", - "CDX-NAIGHVOLS8V1 - 0614", "CDX.NA.IG.HVOL.8", - "CDX_NA_IG_S8_HVOL_07Y_06/14", 2454181, 2456829, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AM5", "CDX", 8, "NA IG HVOL", null, "HV", 1, 7, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN80.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918542", "7906137", - "ITRAXX-JAPAN80S7V1 - 0612", "iTraxx Japan 80 Series Number 7 Version 1", - "ITRAXX-JAPAN80S7V1-0612 JPY SEN RES I03 CDS", 2454180, 2456099, 0.0025, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "4ABCAHAA5", "ITRAXX", 7, "JAPAN80", null, "IG", 1, 5, - "233861", 1, 79, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918549", "7899866", - "USD ITRAXX-EUROPES7V1 - 0612", "iTraxx Europe series 7 Version 1", - "ITRAXX-EUROPES7V1-0612 USD SEN MMR I03 CDS MATURED", 2454180, 2456099, 0.003, "USD", - "ACT/360", false, 0.4, 4, "2I666VAG0", "USD ITRAXX", 7, "EUROPE", "EUR", "IG", 1, 5, - "233812", 1, 123, 0, "LON", false, false, true, "ITRXEB57", "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.HIVOL.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918550", "7899882", - "USD ITRAXX-HIVOLS7V1 - 0612", "iTraxx Europe HiVol series 7 Version 1", - "ITRAXX-HIVOLS7V1-0612 USD SEN MMR I03 CDS MATURED", 2454180, 2456099, 0.0055000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I667LAG1", "USD ITRAXX", 7, "HIVOL", "VOL", "HV", 1, 5, - "233809", 1, 31, 0, "LON", false, false, true, "ITRXEH57", "VOL")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918551", "7910215", - "USD ITRAXX-XOVERS7V1 - 0612", "iTraxx Europe Crossover series 7 Version 1", - "ITRAXX-XOVERS7V1-0612 USD SEN MMR I03 CDS MATURED", 2454180, 2456099, 0.023, "USD", - "ACT/360", false, 0.4, 4, "2I667KAH1", "USD ITRAXX", 7, "XOVER", "XVR", "XO", 1, 5, - "233807", 1, 50, 0, "LON", false, false, true, "ITRXEX57", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.AUSTRALIA.10Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918554", "7908970", - "ITRAXX-AUSTRALIAS7V1 - 0617", "iTraxx Australia Series Number 7 Version 1", - "ITRAXX-AUSTRALIAS7V1-0617 USD SEN MR I03 CDS", 2454180, 2457925, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I668IAG7", "ITRAXX", 7, "AUSTRALIA", null, "IG", 1, 10, - "233848", 1, 25, 0, "HKG", false, false, true, null, "Itraxx Australia")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918562", "7879954", - "CDX-NAHYS8V1 - 0612", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP", 2454188, 2456099, 0.0275, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBD1", "CDX", 8, "NA HY", null, "HY", 1, 5, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918564", "7885261", - "CDX-NAHYBS8V1 - 0612", "CDX.NA.HY.B.8", - "CDX_NA_HY_S08_B___SWP", 2454188, 2456099, 0.025, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BSAP3", "CDX", 8, "NA HY B", null, "HY", 1, 5, - null, 1, 49, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918565", "7885342", - "CDX-NAHYBBS8V1 - 0612", "CDX.NA.HY.BB.8", - "CDX_NA_HY_S08_BB__SWP", 2454188, 2456099, 0.0175, "USD", - "ACT/360", false, 0.3, 4, "2I65BVAN1", "CDX", 8, "NA HY BB", null, "HY", 1, 5, - null, 1, 36, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918566", "7880235", - "CDX-NAHYHBS8V1 - 0612", "CDX.NA.HY.HB.8", - "CDX_NA_HY_S08_HB__SWP", 2454188, 2456099, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BWAR0", "CDX", 8, "NA HY HB", null, "HY", 1, 5, - null, 1, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V20 FXD 84/100.5Y.8.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918568", "7879946", - "CDX-NAHYS8V20 FXD 84/100 - 0612", "CDX.NA.HY.8_Fixed", - "CDX_NA_HY_S08_100_FXD_84/100", 2454188, 2456099, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIT9 FXD", "CDX", 8, "NA HY V20 FXD 84/100", null, "HY", 20, 5, - null, 0.84, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918570", "7880243", - "CDX-NAHYS8V1 - 0609", "Dow Jones CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_02YR", 2454188, 2455003, 0.0275, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBD1", "CDX", 8, "NA HY", null, "HY", 1, 2, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918571", "7880308", - "CDX-NAHYS8V1 - 0610", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_03YR", 2454188, 2455368, 0.0275, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBD1", "CDX", 8, "NA HY", null, "HY", 1, 3, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918572", "7880340", - "CDX-NAHYS8V1 - 0611", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_04YR", 2454188, 2455733, 0.0275, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBD1", "CDX", 8, "NA HY", null, "HY", 1, 4, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918573", "7885091", - "CDX-NAHYS8V1 - 0613", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_05YR", 2454188, 2456464, 0.0275, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBD1", "CDX", 8, "NA HY", null, "HY", 1, 6, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918574", "7885130", - "CDX-NAHYS8V1 - 0614", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_06YR", 2454188, 2456829, 0.0275, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBD1", "CDX", 8, "NA HY", null, "HY", 1, 7, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918575", "7885156", - "CDX-NAHYS8V1 - 0617", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_10YR", 2454188, 2457925, 0.0275, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBD1", "CDX", 8, "NA HY", null, "HY", 1, 10, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V1 ALLPTS.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918576", "7885180", - "CDX-NAHYS8V1 ALLPTS - 0612", "CDX.NA.HY.8.ALLPTS", - "CDX_NA_HY_S08_100_ALLPTS", 2454188, 2456099, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBD1 ALLPT", "CDX", 8, "NA HY V1 ALLPTS", null, "HY", 1, 5, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BV10 FXD 40/49.5Y.8.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918577", "7885229", - "CDX-NAHYBS8V10 FXD 40/49 - 0612", "CDX.NA.HY.B.8_Fixed", - "CDX_NA_HY_S08_B___FXD_40/49", 2454188, 2456099, 0.025, "USD", - "ACT/360", false, 0.3, 4, "2I65BSET1 FXD", "CDX", 8, "NA HY BV10 FXD 40/49", null, "HY", 10, 5, - null, 0.81632, 49, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BBV2 FXD 35/36.5Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918578", "7885318", - "CDX-NAHYBBS8V2 FXD 35/36 - 0612", "CDX.NA.HY.BB.8_Fixed", - "CDX_NA_HY_S08_BB__FXD_35/36", 2454188, 2456099, 0.0175, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBA8 FXD", "CDX", 8, "NA HY BBV2 FXD 35/36", null, "HY", 2, 5, - null, 0.97222, 36, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HBV13 FXD 20/30.5Y.8.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918580", "7885369", - "CDX-NAHYHBS8V12 FXD 21/30 - 0612", "CDX.NA.HY.HB.8", - "CDX_NA_HY_S08_HB__FXD_21/30", 2454188, 2456099, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BWEZ8 FXD", "CDX", 8, "NA HY HBV13 FXD 20/30", null, "HY", 13, 5, - null, 0.66666, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LevXSenS1V1.LevXSen.5Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918645", "7914776", - "LevXSenS1V1 - 1211", "Itraxx LevX Senior", - "ITRAXX LEVX SENIOR EUR 1ST SEC MMR I03 CDS", 2454180, 2455916, 0.017, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJAG8", "LevXSenS1V1", 1, "LevXSen", null, "IG", 1, 5, - null, 0.9975, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LevXSubS1V1.LevXSub.5Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918766", "7953127", - "LevXSubS1V1 - 1211", "Itraxx LevX Subordinate Series 1 Version 1", - "ITRAXX LEVX SUBORDINATE SERIES 1 VERSION 1 EUR 2ND SEC MMR I03 CDS", 2454180, 2455916, 0.045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKAK6", "LevXSubS1V1", 1, "LevXSub", null, "IG", 1, 5, - null, 1, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LCDXNAS8V1 FXD.LCDXNAV1 FXD.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918804", "7942672", - "LCDXNAS8V1 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.75, 4, "5F199GAA5 FXD", "LCDXNAS8V1 FXD", 8, "LCDXNAV1 FXD", null, "IG", 1, 5, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918835", "7942745", - "LCDXNAS8V1 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.75, 4, "5F199GAA5", "LCDX", 8, "LCDXNA", null, "IG", 1, 5, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918838", "7942664", - "LCDXNAS8V1 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.75, 4, "5F199GAA5", "LCDX", 8, "LCDXNA", null, "IG", 1, 3, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918839", "7942710", - "LCDXNAS8V1 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.75, 4, "5F199GAA5", "LCDX", 8, "LCDXNA", null, "IG", 1, 4, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918840", "7942729", - "LCDXNAS8V1 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.75, 4, "5F199GAA5", "LCDX", 8, "LCDXNA", null, "IG", 1, 6, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918841", "7942737", - "LCDXNAS8V1 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.75, 4, "5F199GAA5", "LCDX", 8, "LCDXNA", null, "IG", 1, 7, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918842", "7942770", - "LCDXNAS8V1 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.75, 4, "5F199GAA5", "LCDX", 8, "LCDXNA", null, "IG", 1, 10, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NAXOV1 EUR.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918981", "8118000", - "CDX-NAXOS8V1 EUR - 0612", "CDX.NA.XO.8", - "CDX_NA_XO_S8_05YR_06/12 EUR", 2454181, 2456099, 0.014, "EUR", - "ACT/360", false, 0.4, 4, "1D764IAE7 EUR", "CDX", 8, "NAXOV1 EUR", null, "XO", 1, 5, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.10Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918984", "8119406", - "USD ITRAXX-EUROPES7V1 - 0617", "iTraxx Europe series 7 Version 1", - "ITRAXX-EUROPES7V1-0617 USD SEN MMR I03 CDS MATURED", 2454180, 2457925, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I666VAG0", "USD ITRAXX", 7, "EUROPE", "EUR", "IG", 1, 10, - "233812", 1, 123, 0, "LON", false, false, true, "ITRXEB07", "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.HIVOL.10Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("918985", "8118922", - "USD ITRAXX-HIVOLS7V1 - 0617", "iTraxx Europe HiVol series 7 Version 1", - "ITRAXX-HIVOLS7V1-0617 USD SEN MMR I03 CDS MATURED", 2454180, 2457925, 0.0085, "USD", - "ACT/360", false, 0.4, 4, "2I667LAG1", "USD ITRAXX", 7, "HIVOL", "VOL", "HV", 1, 10, - "233809", 1, 31, 0, "LON", false, false, true, "ITRXEH07", "VOL")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSEN.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919131", "8168466", - "USD ITRAXX-FINSENS7V1 - 0612", "iTraxx Europe Senior Financials series 7 Version 1", - "ITRAXX-FINSENS7V1-0612 USD SEN MMR I03 CDS", 2454180, 2456099, 0.001, "USD", - "ACT/360", false, 0.4, 4, "2I667DAG9", "USD ITRAXX", 7, "FINSEN", "SEN", "IG", 1, 5, - "233811", 1, 24, 0, "LON", false, false, true, "ITRXES57", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.AUSTRALIA.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919163", "8187460", - "ITRAXX-AUSTRALIAS8V1 - 1212", "iTraxx Australia Series Number 8 Version 1", - "ITRAXX-AUSTRALIAS8V1-1212 USD SEN MR I03 CDS", 2454364, 2456282, 0.0045000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I668IAH5", "ITRAXX", 8, "AUSTRALIA", null, "IG", 1, 5, - "235057", 1, 25, 0, "HKG", false, false, true, null, "Itraxx Australia")); - - UpdateCDXRefDataMap ("ITRAXX.GRCHINA.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919166", "8187410", - "ITRAXX-GRCHINAS8V1 - 1212", "iTraxx Greater China series 8 Version 1", - "ITRAXX-GRCHINAS8V1-5Y 1212 USD SEN RES I03 CDS", 2454364, 2456282, 0.006500000000000001, "USD", - "ACT/360", false, 0.4, 4, "ITRAXX-GRCHINAS8V1-5Y", "ITRAXX", 8, "GRCHINA", null, "IG", 1, 5, - null, 1, 17, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919167", "8187452", - "ITRAXX-JAPANHIVOLS8V1 - 1212", "iTraxx Japan HiVol Series Number 8 Version 1", - "ITRAXX-JHIVOLS8V1-1212 JPY SEN RES I03 CDS", 2454364, 2456282, 0.007500000000000001, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MAG8", "ITRAXX", 8, "JAPANHIVOL", "VOL", "HV", 1, 5, - "235060", 1, 25, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.KOREA.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919168", "8187436", - "ITRAXX-KOREAS8V1 - 1212", "iTraxx Korea series 8 Version 1", - "ITRAXX-KOREAS8V1-5Y 1212 USD SEN RES I03 CDS", 2454364, 2456282, 0.002, "USD", - "ACT/360", false, 0.35000000000000003, 4, "ITRAXX-KOREAS8V1-5Y", "ITRAXX", 8, "KOREA", null, "IG", 1, 5, - null, 1, 10, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.3Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919173", "8187495", - "ITRAXX-JAPANS8V1 - 1210", "iTraxx Japan Series Number 8 Version 1", - "ITRAXX-JAPANS8V1-1210 JPY SEN RES I03 CDS", 2454364, 2455551, 0.002, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAH7", "ITRAXX", 8, "JAPAN", null, "IG", 1, 3, - "235059", 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919174", "8187517", - "ITRAXX-JAPANS8V1 - 1212", "iTraxx Japan Series Number 8 Version 1", - "ITRAXX-JAPANS8V1-1212 JPY SEN RES I03 CDS", 2454364, 2456282, 0.003, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAH7", "ITRAXX", 8, "JAPAN", null, "IG", 1, 5, - "235059", 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919175", "8187479", - "ITRAXX-JAPANS8V1 - 1217", "iTraxx Japan Series Number 8 Version 1", - "ITRAXX-JAPANS8V1-1217 JPY SEN RES I03 CDS", 2454364, 2458108, 0.0045000000000000005, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAH7", "ITRAXX", 8, "JAPAN", null, "IG", 1, 10, - "235059", 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN80.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919177", "8192499", - "ITRAXX-JAPAN80S8V1 - 1212", "iTraxx Japan 80 Series Number 8 Version 1", - "ITRAXX-JAPAN80S8V1-1212 JPY SEN RES I03 CDS", 2454364, 2456282, 0.003, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "4ABCAHAB3", "ITRAXX", 8, "JAPAN80", null, "IG", 1, 5, - "235059", 1, 80, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919181", "8187401", - "ITRAXX-ASIAXJS8V1 - 1212", "iTraxx Asia ex-Japan Series Number 8 Version 1", - "ITRAXX-ASIAXJS8V1-1212 USD SEN RES I03 CDS", 2454364, 2456282, 0.011000000000000001, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I668DAH6", "ITRAXX", 8, "ASIAXJ", null, "IG", 1, 5, - "235056", 1, 70, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAREST.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919182", "8187444", - "ITRAXX-ASIARESTS8V1 - 1212", "iTraxx Rest of Asia series 8 Version 1", - "ITRAXX-ASIARESTS8V1-5Y 1212 USD SEN RES I03 CDS", 2454364, 2456282, 0.0055000000000000005, "USD", - "ACT/360", false, 0.4, 4, "ITRAXX-ASIARESTS8V1-5Y", "ITRAXX", 8, "ASIAREST", null, "IG", 1, 5, - null, 1, 23, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.AUSTRALIA.10Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919183", "8187428", - "ITRAXX-AUSTRALIAS8V1 - 1217", "iTraxx Australia Series Number 8 Version 1", - "ITRAXX-AUSTRALIAS8V1-1217 USD SEN MR I03 CDS", 2454364, 2458108, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I668IAH5", "ITRAXX", 8, "AUSTRALIA", null, "IG", 1, 10, - "235057", 1, 25, 0, "HKG", false, false, true, null, "Itraxx Australia")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.3Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919185", "8185581", - "ITRAXX-EUROPES8V1 - 1210", "iTraxx Europe series 8 Version 1", - "ITRAXX-EUROPES8V1-1210 EUR SEN MMR I03 CDS", 2454364, 2455551, 0.003, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAH8", "ITRAXX", 8, "EUROPE", "EUR", "IG", 1, 3, - "235046", 1, 123, 0, "LON", true, true, true, "ITRXEB38", "EUR")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919186", "8189463", - "LCDXNAS8V2 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_99/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.75, 4, "5F199GAC1", "LCDX", 8, "LCDXNA", null, "IG", 2, 3, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V2 FXD.LCDXNAV2 FXD.5Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919187", "8189471", - "LCDXNAS8V2 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_99/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.75, 4, "5F199GAC1 FXD", "LCDXNAS8V2 FXD", 8, "LCDXNAV2 FXD", null, "IG", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919189", "8189498", - "LCDXNAS8V2 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_99/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.75, 4, "5F199GAC1", "LCDX", 8, "LCDXNA", null, "IG", 2, 4, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919190", "8189501", - "LCDXNAS8V2 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_99/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.75, 4, "5F199GAC1", "LCDX", 8, "LCDXNA", null, "IG", 2, 6, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919191", "8189510", - "LCDXNAS8V2 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_99/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.75, 4, "5F199GAC1", "LCDX", 8, "LCDXNA", null, "IG", 2, 7, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919192", "8189536", - "LCDXNAS8V2 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_99/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.75, 4, "5F199GAC1", "LCDX", 8, "LCDXNA", null, "IG", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919193", "8189560", - "LCDXNAS8V2 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_99/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.75, 4, "5F199GAC1", "LCDX", 8, "LCDXNA", null, "IG", 2, 10, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919195", "8185590", - "ITRAXX-EUROPES8V1 - 1212", "iTraxx Europe series 8 Version 1", - "ITRAXX-EUROPES8V1-1212 EUR SEN MMR I03 CDS", 2454364, 2456282, 0.0045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAH8", "ITRAXX", 8, "EUROPE", "EUR", "IG", 1, 5, - "235046", 1, 123, 0, "LON", true, true, true, "ITRXEB58", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.7Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919196", "8185603", - "ITRAXX-EUROPES8V1 - 1214", "iTraxx Europe series 8 Version 1", - "ITRAXX-EUROPES8V1-1214 EUR SEN MMR I03 CDS", 2454364, 2457012, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAH8", "ITRAXX", 8, "EUROPE", "EUR", "IG", 1, 7, - "235046", 1, 123, 0, "LON", true, true, true, "ITRXEB78", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919197", "8185611", - "ITRAXX-EUROPES8V1 - 1217", "iTraxx Europe series 8 Version 1", - "ITRAXX-EUROPES8V1-1217 EUR SEN MMR I03 CDS", 2454364, 2458108, 0.007, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAH8", "ITRAXX", 8, "EUROPE", "EUR", "IG", 1, 10, - "235046", 1, 123, 0, "LON", true, true, true, "ITRXEB08", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919198", "8187320", - "ITRAXX-XOVERS8V1 - 1212", "iTraxx Europe Crossover series 8 Version 1", - "ITRAXX-XOVERS8V1-1212 EUR SEN MMR I03 CDS MATURED", 2454364, 2456282, 0.0375, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAI9", "ITRAXX", 8, "XOVER", "XVR", "XO", 1, 5, - "235051", 1, 50, 0, "LON", true, true, true, "ITRXEX58", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.3Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919199", "8187487", - "ITRAXX-HIVOLS8V1 - 1210", "iTraxx Europe HiVol series 8 Version 1", - "ITRAXX-HIVOLS8V1-1210 EUR SEN MMR I03 CDS", 2454364, 2455551, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAH9", "ITRAXX", 8, "HIVOL", "VOL", "HV", 1, 3, - "235052", 1, 31, 0, "LON", true, true, true, "ITRXEH38", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919200", "8187347", - "ITRAXX-XOVERS8V1 - 1217", "iTraxx Europe Crossover series 8 Version 1", - "ITRAXX-XOVERS8V1-1217 EUR SEN MMR I03 CDS MATURED", 2454364, 2458108, 0.046, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAI9", "ITRAXX", 8, "XOVER", "XVR", "XO", 1, 10, - "235051", 1, 50, 0, "LON", true, true, true, "ITRXEX08", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919203", "8187509", - "ITRAXX-HIVOLS8V1 - 1212", "iTraxx Europe HiVol series 8 Version 1", - "ITRAXX-HIVOLS8V1-1212 EUR SEN MMR I03 CDS", 2454364, 2456282, 0.006500000000000001, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAH9", "ITRAXX", 8, "HIVOL", "VOL", "HV", 1, 5, - "235052", 1, 31, 0, "LON", true, true, true, "ITRXEH58", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.7Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919204", "8187380", - "ITRAXX-HIVOLS8V1 - 1214", "iTraxx Europe HiVol series 8 Version 1", - "ITRAXX-HIVOLS8V1-1214 EUR SEN MMR I03 CDS", 2454364, 2457012, 0.008, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAH9", "ITRAXX", 8, "HIVOL", "VOL", "HV", 1, 7, - "235052", 1, 31, 0, "LON", true, true, true, "ITRXEH78", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.10Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919205", "8187398", - "ITRAXX-HIVOLS8V1 - 1217", "iTraxx Europe HiVol series 8 Version 1", - "ITRAXX-HIVOLS8V1-1217 EUR SEN MMR I03 CDS", 2454364, 2458108, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAH9", "ITRAXX", 8, "HIVOL", "VOL", "HV", 1, 10, - "235052", 1, 31, 0, "LON", true, true, true, "ITRXEH08", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919206", "8187606", - "ITRAXX-FINSENS8V1 - 1212", "iTraxx Europe Senior Financials series 8 Version 1", - "ITRAXX-FINSENS8V1-1212 EUR SEN MMR I03 CDS", 2454364, 2456282, 0.0045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAH7", "ITRAXX", 8, "FINSEN", "SEN", "IG", 1, 5, - "235054", 1, 24, 0, "LON", true, true, true, "ITRXES58", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919207", "8183457", - "ITRAXX-FINSUBS8V1 - 1212", "iTraxx Europe Sub Financials series 8 Version 1", - "ITRAXX-FINSUBS8V1-1212 EUR LT2 SUB MMR I03 CDS", 2454364, 2456282, 0.007, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAI3", "ITRAXX", 8, "FINSUB", "SUB", "IG", 1, 5, - "235055", 1, 24, 0, "LON", true, true, true, "ITRXEU58", "SUB")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.10Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919208", "8187622", - "ITRAXX-FINSENS8V1 - 1217", "iTraxx Europe Senior Financials series 8 Version 1", - "ITRAXX-FINSENS8V1-1217 EUR SEN MMR I03 CDS", 2454364, 2458108, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAH7", "ITRAXX", 8, "FINSEN", "SEN", "IG", 1, 10, - "235054", 1, 24, 0, "LON", true, true, true, "ITRXES08", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.10Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919209", "8183473", - "ITRAXX-FINSUBS8V1 - 1217", "iTraxx Europe Sub Financials series 8 Version 1", - "ITRAXX-FINSUBS8V1-1217 EUR LT2 SUB MMR I03 CDS", 2454364, 2458108, 0.009000000000000001, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAI3", "ITRAXX", 8, "FINSUB", "SUB", "IG", 1, 10, - "235055", 1, 24, 0, "LON", true, true, true, "ITRXEU08", "SUB")); - - UpdateCDXRefDataMap ("CDX.NA IG.1Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919217", "8183139", - "CDX-NAIGS9V1 - 1208", "CDX.NA.IG.9", - "CDX_NA_IG_S9_01Y_12/08", 2454365, 2454821, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAN5", "CDX", 9, "NA IG", null, "IG", 1, 1, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.2Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919218", "8183147", - "CDX-NAIGS9V1 - 1209", "CDX.NA.IG.9", - "CDX_NA_IG_S9_02Y_12/09", 2454365, 2455186, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAN5", "CDX", 9, "NA IG", null, "IG", 1, 2, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919219", "8183163", - "CDX-NAIGS9V1 - 1210", "CDX.NA.IG.9", - "CDX_NA_IG_S9_03Y_12/10", 2454365, 2455551, 0.0045000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAN5", "CDX", 9, "NA IG", null, "IG", 1, 3, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919220", "8187231", - "CDX-NAIGS9V1 - 1211", "CDX.NA.IG.9", - "CDX_NA_IG_S9_04Y_12/11", 2454365, 2455916, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAN5", "CDX", 9, "NA IG", null, "IG", 1, 4, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919221", "8183198", - "CDX-NAIGS9V1 - 1212", "CDX.NA.IG.9", - "CDX_NA_IG_S9_05Y_12/12", 2454365, 2456282, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAN5", "CDX", 9, "NA IG", null, "IG", 1, 5, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V1 EUR.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919222", "8186081", - "CDX-NAIGS9V1 EUR - 1212", "CDX.NA.IG.9", - "CDX_NA_IG_S9_05Y_12/12_EUR", 2454365, 2456282, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYAN5 EUR", "CDX", 9, "NA IG V1 EUR", null, "IG", 1, 5, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919223", "8182248", - "CDX-NAIGS9V1 - 1214", "CDX.NA.IG.9", - "CDX_NA_IG_S9_07Y_12/14", 2454365, 2457012, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAN5", "CDX", 9, "NA IG", null, "IG", 1, 7, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919224", "8182272", - "CDX-NAIGS9V1 - 1217", "CDX.NA.IG.9", - "CDX_NA_IG_S9_10Y_12/17", 2454365, 2458108, 0.008, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAN5", "CDX", 9, "NA IG", null, "IG", 1, 10, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V1 ALLPTS.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919225", "8182299", - "CDX-NAIGS9V1 ALLPTS - 1212", "CDX.NA.IG.9.ALLPTS", - "CDX_NA_IG_S9_ALLPTS", 2454365, 2456282, 0.008, "USD", - "ACT/360", false, 0.3, 4, "2I65BYAN5 ALLPTS", "CDX", 9, "NA IG V1 ALLPTS", null, "IG", 1, 5, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V21 FXD 83/100.5Y.9.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919228", "8184119", - "CDX-NAHYS9V21 FXD 83/100 - 1212", "CDX.NA.HY.9_Fixed", - "CDX_NA_HY_S09_100_FXD_83/100", 2454372, 2456282, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIS1 FXD", "CDX", 9, "NA HY V21 FXD 83/100", null, "HY", 21, 5, - null, 0.8300000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG INDU.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919229", "8187878", - "CDX-NAIGINDUS9V1 - 1212", "CDX.NA.IG.INDU.9", - "CDX_NA_IG_S9_INDU_12/12", 2454365, 2456282, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65B4AN1", "CDX", 9, "NA IG INDU", null, "IG", 1, 5, - null, 0.9333400000000001, 28, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG TMT.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919230", "8187886", - "CDX-NAIGTMTS9V1 - 1212", "CDX.NA.IG.TMT.9", - "CDX_NA_IG_S9_TMT_12/12", 2454365, 2456282, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65DJAK2", "CDX", 9, "NA IG TMT", null, "IG", 1, 5, - null, 1, 22, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.3Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919231", "8187894", - "CDX-NAXOS9V1 - 1210", "CDX.NA.XO.9", - "CDX_NA_XO_S9_03YR_12/10", 2454365, 2455551, 0.02, "USD", - "ACT/360", false, 0.4, 4, "1D764IAF4", "CDX", 9, "NAXO", null, "XO", 1, 3, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919232", "8183996", - "CDX-NAXOS9V1 - 1212", "CDX.NA.XO.9", - "CDX_NA_XO_S9_05YR_12/12", 2454365, 2456282, 0.0245, "USD", - "ACT/360", false, 0.4, 4, "1D764IAF4", "CDX", 9, "NAXO", null, "XO", 1, 5, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.7Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919233", "8187924", - "CDX-NAXOS9V1 - 1214", "CDX.NA.XO.9", - "CDX_NA_XO_S9_07YR_12/14", 2454365, 2457012, 0.027, "USD", - "ACT/360", false, 0.4, 4, "1D764IAF4", "CDX", 9, "NAXO", null, "XO", 1, 7, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.10Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919234", "8184038", - "CDX-NAXOS9V1 - 1217", "CDX.NA.XO.9", - "CDX_NA_XO_S9_10YR_12/17", 2454365, 2458108, 0.029, "USD", - "ACT/360", false, 0.4, 4, "1D764IAF4", "CDX", 9, "NAXO", null, "XO", 1, 10, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXOV1 ALLPTS.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919235", "8187932", - "CDX-NAXOS9V1 ALLPTS - 1212", "CDX.NA.XO.9.ALLPTS", - "CDX_NA_XO_S9_ALLPTS", 2454365, 2456282, 0.0245, "USD", - "ACT/360", false, 0.4, 4, "1D764IAF4 ALLPTS", "CDX", 9, "NAXOV1 ALLPTS", null, "XO", 1, 5, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919236", "8184127", - "CDX-NAHYS9V1 - 1212", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP", 2454372, 2456282, 0.0375, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBE9", "CDX", 9, "NA HY", null, "HY", 1, 5, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919237", "8188742", - "CDX-NAHYS9V1 - 1208", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_01YR", 2454372, 2454821, 0.0375, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBE9", "CDX", 9, "NA HY", null, "HY", 1, 1, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919238", "8187088", - "CDX-NAHYS9V1 - 1209", "Dow Jones CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_02YR", 2454372, 2455186, 0.0375, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBE9", "CDX", 9, "NA HY", null, "HY", 1, 2, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919239", "8184151", - "CDX-NAHYS9V1 - 1210", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_03YR", 2454372, 2455551, 0.0375, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBE9", "CDX", 9, "NA HY", null, "HY", 1, 3, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919240", "8187118", - "CDX-NAHYS9V1 - 1211", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_04YR", 2454372, 2455916, 0.0375, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBE9", "CDX", 9, "NA HY", null, "HY", 1, 4, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919241", "8187126", - "CDX-NAHYS9V1 - 1213", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_06YR", 2454372, 2456647, 0.0375, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBE9", "CDX", 9, "NA HY", null, "HY", 1, 6, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919242", "8183775", - "CDX-NAHYS9V1 - 1214", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_07YR", 2454372, 2457012, 0.0375, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBE9", "CDX", 9, "NA HY", null, "HY", 1, 7, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919243", "8183783", - "CDX-NAHYS9V1 - 1217", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_10YR", 2454372, 2458108, 0.0375, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBE9", "CDX", 9, "NA HY", null, "HY", 1, 10, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.EMDIV.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919244", "8184003", - "CDX-EMDIVS6V1 - 1212", "CDX.EM.DIVERSIFIED.6", - "CDX EM DIVER 6 5YR", 2454365, 2456282, 0.012, "USD", - "ACT/360", true, 0.25, 2, "2165EKAF6", "CDX", 6, "EMDIV", null, "EM", 1, 5, - null, 1, 40, 0, "LON", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.EM.10Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919245", "8188726", - "CDX-EMS8V1 - 1217", "CDX.EM.8", - "CDX EM 8 10YR", 2454365, 2458108, 0.022000000000000002, "USD", - "ACT/360", false, 0.25, 4, "2I65BZAH5", "CDX", 8, "EM", null, "EM", 1, 10, - null, 1, 14, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.EM.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919247", "8184062", - "CDX-EMS8V1 - 1212", "CDX.EM.8", - "CDX EM 8 5YR", 2454365, 2456282, 0.0175, "USD", - "ACT/360", true, 0.25, 2, "2I65BZAH5", "CDX", 8, "EM", null, "EM", 1, 5, - null, 1, 14, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V1 ALLPTS.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919249", "8187223", - "CDX-NAHYS9V1 ALLPTS - 1212", "CDX.NA.HY.9.ALLPTS", - "CDX_NA_HY_S09_100_SWP_ALLPTS", 2454372, 2456282, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBE9 ALLPTS", "CDX", 9, "NA HY V1 ALLPTS", null, "HY", 1, 5, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BV12 FXD 35/46.5Y.9.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919250", "8183791", - "CDX-NAHYBS9V1 FXD - 1212", "CDX.NA.HY.B.9", - "CDX_NA_HY_S9_B_FXD", 2454372, 2456282, 0.035, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BSES3 FXD", "CDX", 9, "NA HY BV12 FXD 35/46", null, "HY", 12, 5, - null, 0.76087, 46, 0, "NYC", false, false, false, null, "DJCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet9() - { - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919251", "8183813", - "CDX-NAHYBS9V1 - 1212", "CDX.NA.HY.B.9", - "CDX_NA_HY_S09_B___SWP", 2454372, 2456282, 0.035, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BSAQ1", "CDX", 9, "NA HY B", null, "HY", 1, 5, - null, 1, 46, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BBV2 FXD 36/37.5Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919252", "8183830", - "CDX-NAHYBBS9V2 FXD 36/37 - 1212", "CDX.NA.HY.BB.9", - "CDX_NA_HY_S9_BB_FXD", 2454372, 2456282, 0.0275, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BVBB6 FXD", "CDX", 9, "NA HY BBV2 FXD 36/37", null, "HY", 2, 5, - null, 0.97297, 37, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919254", "8183848", - "CDX-NAHYBBS9V1 - 1212", "CDX.NA.HY.BB.9", - "CDX_NA_HY_S09_BB__SWP", 2454372, 2456282, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BVAO9", "CDX", 9, "NA HY BB", null, "HY", 1, 5, - null, 1, 37, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HBV13 FXD 20/30.5Y.9.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919255", "8183104", - "CDX-NAHYHBS9V1 FXD - 1212", "CDX.NA.HY.HB.9", - "CDX_NA_HY_S9_HB_FXD", 2454372, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BWFA2 FXD", "CDX", 9, "NA HY HBV13 FXD 20/30", null, "HY", 13, 5, - null, 0.66666, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919256", "8183120", - "CDX-NAHYHBS9V1 - 1212", "CDX.NA.HY.HB.9", - "CDX_NA_HY_S09_HB__SWP", 2454372, 2456282, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BWAS8", "CDX", 9, "NA HY HB", null, "HY", 1, 5, - null, 1, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG CONS.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919257", "8186170", - "CDX-NAIGCONSS9V1 - 1212", "CDX.NA.IG.CONS.9", - "CDX_NA_IG_S9_CONS_12/12", 2454365, 2456282, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65B0AK5", "CDX", 9, "NA IG CONS", null, "IG", 1, 5, - null, 1, 36, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG ENRG.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919258", "8186103", - "CDX-NAIGENRGS9V1 - 1212", "CDX.NA.IG.ENRG.9", - "CDX_NA_IG_S9_ENRG_12/12", 2454365, 2456282, 0.003, "USD", - "ACT/360", false, 0.4, 4, "2I65B1AK3", "CDX", 9, "NA IG ENRG", null, "IG", 1, 5, - null, 1, 14, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919259", "8186120", - "CDX-NAIGFINS9V1 - 1212", "CDX.NA.IG.FIN.9", - "CDX_NA_IG_S9_FIN_12/12", 2454365, 2456282, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65B2AK1", "CDX", 9, "NA IG FIN", null, "IG", 1, 5, - null, 1, 25, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.1Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919260", "8186200", - "CDX-NAIGHVOLS9V1 - 1208", "CDX.NA.IG.HVOL.9", - "CDX_NA_IG_S9_HVOL_01Y_12/08", 2454365, 2454821, 0.0105, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AN3", "CDX", 9, "NA IG HVOL", null, "HV", 1, 1, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.2Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919261", "8188025", - "CDX-NAIGHVOLS9V1 - 1209", "CDX.NA.IG.HVOL.9", - "CDX_NA_IG_S9_HVOL_02Y_12/09", 2454365, 2455186, 0.0115, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AN3", "CDX", 9, "NA IG HVOL", null, "HV", 1, 2, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.3Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919262", "8182310", - "CDX-NAIGHVOLS9V1 - 1210", "CDX.NA.IG.HVOL.9", - "CDX_NA_IG_S9_HVOL_03Y_12/10", 2454365, 2455551, 0.0125, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AN3", "CDX", 9, "NA IG HVOL", null, "HV", 1, 3, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.4Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919263", "8188041", - "CDX-NAIGHVOLS9V1 - 1211", "CDX.NA.IG.HVOL.9", - "CDX_NA_IG_S9_HVOL_04Y_12/11", 2454365, 2455916, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AN3", "CDX", 9, "NA IG HVOL", null, "HV", 1, 4, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919264", "8182337", - "CDX-NAIGHVOLS9V1 - 1212", "CDX.NA.IG.HVOL.9", - "CDX_NA_IG_S9_HVOL_05Y_12/12", 2454365, 2456282, 0.014, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AN3", "CDX", 9, "NA IG HVOL", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.7Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919265", "8183880", - "CDX-NAIGHVOLS9V1 - 1214", "CDX.NA.IG.HVOL.9", - "CDX_NA_IG_S9_HVOL_07Y_12/14", 2454365, 2457012, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AN3", "CDX", 9, "NA IG HVOL", null, "HV", 1, 7, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.10Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919266", "8183953", - "CDX-NAIGHVOLS9V1 - 1217", "CDX.NA.IG.HVOL.9", - "CDX_NA_IG_S9_HVOL_10Y_12/17", 2454365, 2458108, 0.016, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AN3", "CDX", 9, "NA IG HVOL", null, "HV", 1, 10, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOLV1 ALLPTS.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919267", "8188394", - "CDX-NAIGHVOLS9V1 ALLPTS - 1212", "CDX.NA.IG.HVOL.9.ALLPTS", - "CDX_NA_IG_S9_HVOL_ALLPTS", 2454365, 2456282, 0.016, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AN3 ALLPTS", "CDX", 9, "NA IG HVOLV1 ALLPTS", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919270", "8187665", - "USD ITRAXX-EUROPES8V1 - 1212", "iTraxx Europe series 8 Version 1", - "ITRAXX-EUROPES8V1-1212 USD SEN MMR I03 CDS", 2454364, 2456282, 0.0045000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I666VAH8", "USD ITRAXX", 8, "EUROPE", "EUR", "IG", 1, 5, - "235046", 1, 123, 0, "LON", false, false, true, "ITRXEB58", "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.10Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919271", "8188661", - "USD ITRAXX-EUROPES8V1 - 1217", "iTraxx Europe series 8 Version 1", - "ITRAXX-EUROPES8V1-1217 USD SEN MMR I03 CDS", 2454364, 2458108, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I666VAH8", "USD ITRAXX", 8, "EUROPE", "EUR", "IG", 1, 10, - "235046", 1, 123, 0, "LON", false, false, true, "ITRXEB08", "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919273", "8229996", - "USD ITRAXX-XOVERS8V1 - 1212", "iTraxx Europe Crossover series 8 Version 1", - "ITRAXX-XOVERS8V1-1212 USD SEN MMR I03 CDS MATURED", 2454364, 2456282, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I667KAI9", "USD ITRAXX", 8, "XOVER", "XVR", "XO", 1, 5, - "235051", 1, 50, 0, "LON", false, false, true, "ITRXEX58", "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919274", "8229937", - "USD ITRAXX-XOVERS8V1 - 1217", "iTraxx Europe Crossover series 8 Version 1", - "ITRAXX-XOVERS8V1-1217 USD SEN MMR I03 CDS", 2454364, 2458108, 0.046, "USD", - "ACT/360", false, 0.4, 4, "2I667KAI9", "USD ITRAXX", 8, "XOVER", "XVR", "XO", 1, 10, - "235051", 1, 50, 0, "LON", false, false, true, "ITRXEX08", "XVR")); - - UpdateCDXRefDataMap ("LCDXNAS8V2 ALLPTS.LCDXNAV2 ALLPTS.5Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919295", "8189609", - "LCDXNAS8V2 ALLPTS - 0612", "LCDX.NA.8.ALLPTS", - "CDX_NA_LN_S09_100_99/100_ALLPTS", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.75, 4, "5F199GAC1 ALLPTS", "LCDXNAS8V2 ALLPTS", 8, "LCDXNAV2 ALLPTS", null, "IG", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ IG.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919296", "8236364", - "ITRAXX-ASIAXJIGS8V1 - 1212", "iTraxx Asia ex-Japan IG Series Number 8 Version 1", - "ITRAXX-ASIA-IGS8-5Y USD SEN RES I03 CDS", 2454364, 2456282, 0.0055000000000000005, "USD", - "ACT/360", false, 0.35000000000000003, 4, "4ABCAMAA4", "ITRAXX", 8, "ASIAXJ IG", null, "IG", 1, 5, - null, 1, 50, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ HY.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919299", "8236372", - "ITRAXX-ASIAXJHYS8V1 - 1212", "iTraxx Asia ex-Japan HY Series Number 8 Version 1", - "ITRAXX-ASIA-HYS8-5Y USD SEN RES I03 CDS", 2454364, 2456282, 0.025, "USD", - "ACT/360", false, 0.35000000000000003, 4, "4ABCAGAA7", "ITRAXX", 8, "ASIAXJ HY", null, "IG", 1, 5, - null, 1, 20, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("CDX.NAXOV1 EUR.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919306", "8277710", - "CDX-NAXOS9V1 EUR - 1212", "CDX.NA.XO.9", - "CDX_NA_XO_S9_05YR_12/12 EUR", 2454365, 2456282, 0.0245, "EUR", - "ACT/360", false, 0.4, 4, "1D764IAF4 EUR", "CDX", 9, "NAXOV1 EUR", null, "XO", 1, 5, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V18 FXD 86/100.3Y.9.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919332", "8289212", - "CDX-NAHYS9V18 FXD 86/100 - 1210", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_FXD_03YR_86/100", 2454372, 2455566, 0.0375, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRHD5 FXD", "CDX", 9, "NA HY V18 FXD 86/100", null, "HY", 18, 3, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919341", "8235406", - "LCDXNAS9V1 - 1210", "LCDX.NA.9", - "CDX_NA_LN_S09_100_03YR", 2454378, 2455551, 0.022500000000000003, "USD", - "ACT/360", false, 0.75, 4, "5F199GAB3", "LCDX", 9, "LCDXNA", null, "IG", 1, 3, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V1 FXD.LCDXNAV1 FXD.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919342", "8235287", - "LCDXNAS9V1 FXD - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_FXD", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.75, 4, "5F199GAB3 FXD", "LCDXNAS9V1 FXD", 9, "LCDXNAV1 FXD", null, "IG", 1, 5, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919343", "8235295", - "LCDXNAS9V1 - 1209", "LCDX.NA.9", - "CDX_NA_LN_S09_100_02YR", 2454378, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.75, 4, "5F199GAB3", "LCDX", 9, "LCDXNA", null, "IG", 1, 2, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919344", "8235317", - "LCDXNAS9V1 - 1211", "LCDX.NA.9", - "CDX_NA_LN_S09_100_04YR", 2454378, 2455916, 0.022500000000000003, "USD", - "ACT/360", false, 0.75, 4, "5F199GAB3", "LCDX", 9, "LCDXNA", null, "IG", 1, 4, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919346", "8235325", - "LCDXNAS9V1 - 1213", "LCDX.NA.9", - "CDX_NA_LN_S09_100_06YR", 2454378, 2456647, 0.022500000000000003, "USD", - "ACT/360", false, 0.75, 4, "5F199GAB3", "LCDX", 9, "LCDXNA", null, "IG", 1, 6, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919347", "8235228", - "LCDXNAS9V1 - 1214", "LCDX.NA.9", - "CDX_NA_LN_S09_100_07YR", 2454378, 2457012, 0.022500000000000003, "USD", - "ACT/360", false, 0.75, 4, "5F199GAB3", "LCDX", 9, "LCDXNA", null, "IG", 1, 7, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919348", "8235279", - "LCDXNAS9V1 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAB3", "LCDX", 9, "LCDXNA", null, "IG", 1, 5, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919349", "8235210", - "LCDXNAS9V1 - 1217", "LCDX.NA.9", - "CDX_NA_LN_S09_100_10YR", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.75, 4, "5F199GAB3", "LCDX", 9, "LCDXNA", null, "IG", 1, 10, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V1 ALLPTS.LCDXNAV1 ALLPTS.10Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919350", "8235309", - "LCDXNAS9V1 ALLPTS - 1217", "LCDX.NA.9.ALLPTS", - "CDX_NA_LN_S09_100_ALLPTS", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.75, 4, "5F199GAB3 ALLPTS", "LCDXNAS9V1 ALLPTS", 9, "LCDXNAV1 ALLPTS", null, "IG", 1, 10, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919371", "8185620", - "ITRAXX-XOVERS8V1 - 1210", "iTraxx Europe Crossover series 8 Version 1", - "ITRAXX-XOVERS8V1-1210 EUR SEN MMR I03 CDS MATURED", 2454364, 2455551, 0.027, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAI9", "ITRAXX", 8, "XOVER", "XVR", "XO", 1, 3, - "235051", 1, 50, 0, "LON", true, true, true, "ITRXEX38", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919372", "8187339", - "ITRAXX-XOVERS8V1 - 1214", "iTraxx Europe Crossover series 8 Version 1", - "ITRAXX-XOVERS8V1-1214 EUR SEN MMR I03 CDS MATURED", 2454364, 2457012, 0.039, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAI9", "ITRAXX", 8, "XOVER", "XVR", "XO", 1, 7, - "235051", 1, 50, 0, "LON", true, true, true, "ITRXEX78", "XVR")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOLV1 EUR.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919396", "8315205", - "CDX-NAIGHVOLS9V1 EUR - 1212", "CDX.NA.IG.HVOL.9", - "CDX_NA_IG_S9_HVOL_05Y_12/12 EUR", 2454365, 2456282, 0.014, "EUR", - "ACT/360", false, 0.4, 4, "2I65B3AN3 EUR", "CDX", 9, "NA IG HVOLV1 EUR", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919401", "8313393", - "LCDXNAS8V3 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_98/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.75, 4, "5F199GAD9", "LCDX", 8, "LCDXNA", null, "IG", 3, 3, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSUB.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919410", "8321639", - "USD ITRAXX-FINSUBS8V1 - 1212", "iTraxx Europe Sub Financials series 8 Version 1", - "ITRAXX-FINSUBS8V1-1212 USD LT2 SUB MMR I03 CDS", 2454364, 2456282, 0.007, "USD", - "ACT/360", false, 0.2, 4, "2I667EAI3", "USD ITRAXX", 8, "FINSUB", "SUB", "IG", 1, 5, - "235055", 1, 24, 0, "LON", false, false, true, "ITRXEU58", "SUB")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSUB.10Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919412", "8321612", - "USD ITRAXX-FINSUBS8V1 - 1217", "iTraxx Europe Sub Financials series 8 Version 1", - "ITRAXX-FINSUBS8V1-1217 USD LT2 SUB MMR I03 CDS", 2454364, 2458108, 0.009000000000000001, "USD", - "ACT/360", false, 0.2, 4, "2I667EAI3", "USD ITRAXX", 8, "FINSUB", "SUB", "IG", 1, 10, - "235055", 1, 24, 0, "LON", false, false, true, "ITRXEU08", "SUB")); - - UpdateCDXRefDataMap ("LCDXNAS8V3 FXD.LCDXNAV3 FXD.5Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919413", "8313415", - "LCDXNAS8V3 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_98/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.75, 4, "5F199GAD9 FXD", "LCDXNAS8V3 FXD", 8, "LCDXNAV3 FXD", null, "IG", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919415", "8313725", - "LCDXNAS8V3 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_98/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.75, 4, "5F199GAD9", "LCDX", 8, "LCDXNA", null, "IG", 3, 4, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919416", "8313601", - "LCDXNAS8V3 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_98/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.75, 4, "5F199GAD9", "LCDX", 8, "LCDXNA", null, "IG", 3, 6, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919417", "8313628", - "LCDXNAS8V3 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_98/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.75, 4, "5F199GAD9", "LCDX", 8, "LCDXNA", null, "IG", 3, 7, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919418", "8313644", - "LCDXNAS8V3 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_98/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAD9", "LCDX", 8, "LCDXNA", null, "IG", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919420", "8313695", - "LCDXNAS8V3 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_98/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.75, 4, "5F199GAD9", "LCDX", 8, "LCDXNA", null, "IG", 3, 10, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V3 ALLPTS.LCDXNAV3 ALLPTS.5Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919421", "8313717", - "LCDXNAS8V3 ALLPTS - 0612", "LCDX.NA.8.ALLPTS", - "CDX_NA_LN_S08_100_98/100_ALLPTS", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.75, 4, "5F199GAD9 ALLPTS", "LCDXNAS8V3 ALLPTS", 8, "LCDXNAV3 ALLPTS", null, "IG", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LevXSenS1V9.LevXSen.5Y.1.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919463", "8338175", - "LevXSenS1V9 - 1211", "ITRAXX LEVX SENIOR INDEX SERIES 1 VERSION 9", - "ITRAXX LEVX SENIOR SERIES 1 VERSION 9 1ST SEC MMR I03 CDS", 2453999, 2455916, 0.017, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJAI4", "LevXSenS1V9", 1, "LevXSen", null, "IG", 9, 5, - null, 0.7713, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LevXSubS1V13.LevXSub.5Y.1.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919464", "8338132", - "LevXSubS1V13 - 1211", "ITRAXX LEVX SUBORDINATE INDEX SERIES 1 VERSION 13", - "ITRAXX LEVX SUBORDINATE SERIES 1 VERSION 13 2ND SEC MMR I03 CDS", 2454180, 2455916, 0.045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKAM2", "LevXSubS1V13", 1, "LevXSub", null, "IG", 13, 5, - null, 0.6570999999999999, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("CDX.NAXO.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919672", "8513279", - "CDX-NAXOS6V2 - 0611", "Dow Jones CDX.NA.XO.6", - "DJCDX_NA_XO_S6_05YR_6/11_34/35", 2453816, 2455733, 0.019, "USD", - "ACT/360", false, 0.4, 4, "1D764IAG2", "CDX", 6, "NAXO", null, "XO", 2, 5, - null, 0.97143, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY V3 99/100.5Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919673", "8513295", - "DJCDX-NAHYS6V2 99/100 - 0611", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_V2_100_SWP", 2453823, 2455733, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "DJCDX-NAHYS6V2 99/100", "DJCDX", 6, "NA HY V3 99/100", null, "HY", 3, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V2 FXD.5Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919674", "8513791", - "CDX-NAHYS8V2 FXD - 0612", "CDX.NA.HY.8", - "CDX_NA_HY_S8_V2_100_FXD", 2454188, 2456099, 0.0275, "USD", - "ACT/360", false, 0.35000000000000003, 4, "1E+12", "CDX", 8, "NA HY V2 FXD", null, "HY", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V2 FXD.3Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919675", "8513783", - "CDX-NAHYS9V2 FXD - 1210", "CDX.NA.HY.9", - "CDX_NA_HY_S9_V2_ 100_FXD_03YR", 2454372, 2455551, 0.0375, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBI0 FXD", "CDX", 9, "NA HY V2 FXD", null, "HY", 2, 3, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919676", "8513805", - "CDX-NAHYS8V2 - 0612", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_99/100", 2454188, 2456099, 0.0275, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBH2", "CDX", 8, "NA HY", null, "HY", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919677", "8513775", - "CDX-NAHYBS9V2 - 1212", "CDX.NA.HY.B.9", - "CDX_NA_HY_S09_B___SWP_45/46", 2454372, 2456282, 0.035, "USD", - "ACT/360", false, 0.3, 4, "2I65BSAS7", "CDX", 9, "NA HY B", null, "HY", 2, 5, - null, 0.9782599999999999, 46, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919678", "8513759", - "CDX-NAHYS9V2 - 1217", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_10YR_99/100", 2454372, 2458108, 0.0375, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBI0", "CDX", 9, "NA HY", null, "HY", 2, 10, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919679", "8513732", - "CDX-NAHYS9V2 - 1214", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_07YR_99/100", 2454372, 2457012, 0.0375, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBI0", "CDX", 9, "NA HY", null, "HY", 2, 7, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919680", "8513953", - "CDX-NAHYS9V2 - 1212", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_99/100", 2454372, 2456282, 0.0375, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBI0", "CDX", 9, "NA HY", null, "HY", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V2 FXD.5Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919681", "8513945", - "CDX-NAHYS9V2 FXD - 1212", "CDX.NA.HY.9", - "CDX_NA_HY_S9_V2_100_FXD", 2454372, 2456282, 0.0375, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBI0 FXD", "CDX", 9, "NA HY V2 FXD", null, "HY", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY V2 FXD.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919682", "8513333", - "DJCDX-NAHYS6V2 FXD - 0611", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_V2_100_FXD_99/100", 2453823, 2455733, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "DJCDX-NAHYS6V2 FXD", "DJCDX", 6, "NA HY V2 FXD", null, "HY", 2, 5, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919683", "8513350", - "CDX-NAHYBBS6V2 - 0611", "Dow Jones CDX.NA.HY.BB.6", - "DJCDX_NA_HY_S6_BB_SWP_37/38", 2453823, 2455733, 0.021, "USD", - "ACT/360", false, 0.3, 4, "2I65BVAP6", "CDX", 6, "NA HY BB", null, "HY", 2, 5, - null, 0.97369, 38, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY BBV2 FXD.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919685", "8513406", - "DJCDX-NAHYBBS6V2 FXD - 0611", "Dow Jones CDX.NA.HY.BB.6", - "DJCDX_NA_HY_S6_V2_BB_FXD", 2453823, 2455733, 0.021, "USD", - "ACT/360", false, 0.35000000000000003, 4, "DJCDX-NAHYBBS6V2 FXD", "DJCDX", 6, "NA HY BBV2 FXD", null, "HY", 1, 5, - null, 0.97369, 38, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919686", "8513449", - "CDX-NAHYS6V3 - 0611", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP_98/100", 2453823, 2455733, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBF6", "CDX", 6, "NA HY", null, "HY", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919687", "8513414", - "CDX-NAHYS7V2 - 1213", "Dow Jones CDX.NA.HY.7", - "DJCDX_NA_HY_S7_100_SWP_07YR_99/100", 2454007, 2456647, 0.0325, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBG4", "CDX", 7, "NA HY", null, "HY", 2, 7, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919688", "8513457", - "CDX-NAHYS6V3 - 0613", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP_07YR_98/100", 2453823, 2456464, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBF6", "CDX", 6, "NA HY", null, "HY", 3, 7, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919689", "8513422", - "CDX-NAXOS7V2 - 1211", "Dow Jones CDX.NA.XO.7", - "DJCDX_NA_XO_S7_05YR_12/11_34/35", 2454000, 2455916, 0.0165, "USD", - "ACT/360", false, 0.4, 4, "1D764IAH0", "CDX", 7, "NAXO", null, "XO", 2, 5, - null, 0.97143, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919690", "8513430", - "CDX-NAHYS7V2 - 1216", "Dow Jones CDX.NA.HY.7", - "DJCDX_NA_HY_S7_100_SWP_10YR_99/100", 2454007, 2457743, 0.0325, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBG4", "CDX", 7, "NA HY", null, "HY", 2, 10, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919693", "8513465", - "CDX-NAHYS6V3 - 0616", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP_10YR_98/100", 2453823, 2457560, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBF6", "CDX", 6, "NA HY", null, "HY", 3, 10, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919694", "8513317", - "CDX-NAHYS6V3 - 0609", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP_03YR_98/100", 2453823, 2455003, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBF6", "CDX", 6, "NA HY", null, "HY", 3, 3, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919695", "8513325", - "CDX-NAHYS7V2 - 1209", "Dow Jones CDX.NA.HY.7", - "DJCDX_NA_HY_S7_100_SWP_03YR_99/100", 2454007, 2455186, 0.0325, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBG4", "CDX", 7, "NA HY", null, "HY", 2, 3, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY BBV2 FXD.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919696", "8513767", - "DJCDX-NAHYBBS7V2 FXD - 1211", "Dow Jones CDX.NA.HY.BB.7", - "DJCDX_NA_HY_S7_V2_BB_FXD", 2454007, 2455916, 0.0205, "USD", - "ACT/360", false, 0.35000000000000003, 4, "DJCDX-NAHYBBS7V2 FXD", "DJCDX", 7, "NA HY BBV2 FXD", null, "HY", 2, 5, - null, 0.97369, 38, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919697", "8513341", - "CDX-NAHYBBS7V2 - 1211", "Dow Jones CDX.NA.HY.BB.7", - "DJCDX_NA_HY_S7_BB_SWP_37/38", 2454007, 2455916, 0.0205, "USD", - "ACT/360", false, 0.3, 4, "2I65BVAQ4", "CDX", 7, "NA HY BB", null, "HY", 2, 5, - null, 0.97369, 38, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919698", "8513864", - "CDX-NAHYS8V2 - 0610", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_03YR_99/100", 2454188, 2455368, 0.0275, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBH2", "CDX", 8, "NA HY", null, "HY", 2, 3, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919700", "8513872", - "CDX-NAHYS8V2 - 0614", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_07YR_99/100", 2454188, 2456829, 0.0275, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBH2", "CDX", 8, "NA HY", null, "HY", 2, 7, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919701", "8513848", - "CDX-NAHYS8V2 - 0617", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_10YR_99/100", 2454188, 2457925, 0.0275, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBH2", "CDX", 8, "NA HY", null, "HY", 2, 10, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BV2 FXD.5Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919702", "8513856", - "CDX-NAHYBS8V2 FXD - 0612", "CDX.NA.HY.B.8", - "CDX_NA_HY_S8_V2_B_FXD", 2454188, 2456099, 0.025, "USD", - "ACT/360", false, 0.35000000000000003, 4, "9999999", "CDX", 8, "NA HY BV2 FXD", null, "HY", 2, 5, - null, 0.9795900000000001, 49, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919703", "8513937", - "CDX-NAHYBS8V2 - 0612", "CDX.NA.HY.B.8", - "CDX_NA_HY_S08_B___SWP_48/49", 2454188, 2456099, 0.025, "USD", - "ACT/360", false, 0.3, 4, "2I65BSAR9", "CDX", 8, "NA HY B", null, "HY", 2, 5, - null, 0.9795900000000001, 49, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919704", "8513368", - "CDX-NAHYHBS7V2 - 1211", "Dow Jones CDX.NA.HY.HB.7", - "DJCDX_NA_HY_S7_HB_SWP_29/30", 2454007, 2455916, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BWAT6", "CDX", 7, "NA HY HB", null, "HY", 2, 5, - null, 0.96667, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919705", "8513392", - "CDX-NAHYS7V2 - 1211", "Dow Jones CDX.NA.HY.7", - "DJCDX_NA_HY_S7_100_SWP_99/100", 2454007, 2455916, 0.0325, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBG4", "CDX", 7, "NA HY", null, "HY", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY V3 99/100.3Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919706", "8515492", - "DJCDX-NAHYS6V3 99/100 - 0609", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_V3_100_SWP_03YR", 2453823, 2455003, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "DJCDX-NAHYS6V3 99/100", "DJCDX", 6, "NA HY V3 99/100", null, "HY", 3, 3, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY V3 99/100.7Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919707", "8515514", - "DJCDX-NAHYS6V3 99/100 - 0613", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_V3_100_SWP_07YR", 2453823, 2456464, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "DJCDX-NAHYS6V3 99/100", "DJCDX", 6, "NA HY V3 99/100", null, "HY", 3, 7, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY V2 FXD.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919709", "8513740", - "DJCDX-NAHYS7V2 FXD - 1211", "Dow Jones CDX.NA.HY.7", - "DJCDX_NA_HY_S7_V2_100_FXD", 2454007, 2455916, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "DJCDX-NAHYS7V2 FXD", "DJCDX", 7, "NA HY V2 FXD", null, "HY", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY V3 99/100.10Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919710", "8515573", - "DJCDX-NAHYS6V3 99/100 - 0616", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_V3_100_SWP_10YR", 2453823, 2457560, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "DJCDX-NAHYS6V3 99/100", "DJCDX", 6, "NA HY V3 99/100", null, "HY", 3, 10, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919711", "8513724", - "CDX-NAHYS9V2 - 1210", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_03YR_99/100", 2454372, 2455551, 0.0375, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBI0", "CDX", 9, "NA HY", null, "HY", 2, 3, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919727", "8519455", - "LCDXNAS8V4 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_97/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAE7", "LCDX", 8, "LCDXNA", null, "IG", 4, 3, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V4 FXD.LCDXNAV4 FXD.5Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919728", "8519358", - "LCDXNAS8V4 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_97/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAE7 FXD", "LCDXNAS8V4 FXD", 8, "LCDXNAV4 FXD", null, "IG", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919730", "8519382", - "LCDXNAS8V4 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_97/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAE7", "LCDX", 8, "LCDXNA", null, "IG", 4, 4, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919731", "8519390", - "LCDXNAS8V4 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_97/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAE7", "LCDX", 8, "LCDXNA", null, "IG", 4, 6, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919732", "8519625", - "LCDXNAS8V4 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_97/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAE7", "LCDX", 8, "LCDXNA", null, "IG", 4, 7, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919733", "8519641", - "LCDXNAS8V4 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_97/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAE7", "LCDX", 8, "LCDXNA", null, "IG", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919734", "8519552", - "LCDXNAS8V4 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_97/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAE7", "LCDX", 8, "LCDXNA", null, "IG", 4, 10, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.3Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919782", "8569444", - "ITRAXX-EUROPES9V1 - 0611", "iTraxx Europe series 9 Version 1", - "ITRAXX-EUROPES9V1-0611 EUR SEN MMR I03 CDS", 2454546, 2455733, 0.014, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAI6", "ITRAXX", 9, "EUROPE", "EUR", "IG", 1, 3, - "236073", 1, 125, 0, "LON", true, true, true, "ITRXEB39", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919784", "8569452", - "ITRAXX-EUROPES9V1 - 0613", "iTraxx Europe series 9 Version 1", - "ITRAXX-EUROPES9V1-0613 EUR SEN MMR I03 CDS", 2454546, 2456464, 0.0165, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAI6", "ITRAXX", 9, "EUROPE", "EUR", "IG", 1, 5, - "236073", 1, 125, 0, "LON", true, true, true, "ITRXEB59", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.7Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919785", "8569479", - "ITRAXX-EUROPES9V1 - 0615", "iTraxx Europe series 9 Version 1", - "ITRAXX-EUROPES9V1-0615 EUR SEN MMR I03 CDS", 2454546, 2457194, 0.017, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAI6", "ITRAXX", 9, "EUROPE", "EUR", "IG", 1, 7, - "236073", 1, 125, 0, "LON", true, true, true, "ITRXEB79", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919786", "8569495", - "ITRAXX-EUROPES9V1 - 0618", "iTraxx Europe series 9 Version 1", - "ITRAXX-EUROPES9V1-0618 EUR SEN MMR I03 CDS", 2454546, 2458290, 0.0175, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAI6", "ITRAXX", 9, "EUROPE", "EUR", "IG", 1, 10, - "236073", 1, 125, 0, "LON", true, true, true, "ITRXEB09", "EUR")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919787", "8563632", - "CDX-NAIGHVOLS10V1 - 0613", "CDX.NA.IG.HVOL.10", - "CDX_NA_IG_S10_HVOL_05Y_06/13", 2454547, 2456464, 0.035, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AO1", "CDX", 10, "NA IG HVOL", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.7Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919790", "8563640", - "CDX-NAIGHVOLS10V1 - 0615", "CDX.NA.IG.HVOL.10", - "CDX_NA_IG_S10_HVOL_07Y_06/15", 2454547, 2457194, 0.035, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AO1", "CDX", 10, "NA IG HVOL", null, "HV", 1, 7, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.3Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919795", "8569924", - "ITRAXX-HIVOLS9V1 - 0611", "iTraxx Europe HiVol series 9 Version 1", - "ITRAXX-HIVOLS9V1-0611 EUR SEN MMR I03 CDS", 2454546, 2455733, 0.022000000000000002, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAI7", "ITRAXX", 9, "HIVOL", "VOL", "HV", 1, 3, - "236075", 1, 31, 0, "LON", true, true, true, "ITRXEH39", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919796", "8569932", - "ITRAXX-HIVOLS9V1 - 0613", "iTraxx Europe HiVol series 9 Version 1", - "ITRAXX-HIVOLS9V1-0613 EUR SEN MMR I03 CDS", 2454546, 2456464, 0.026000000000000002, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAI7", "ITRAXX", 9, "HIVOL", "VOL", "HV", 1, 5, - "236075", 1, 31, 0, "LON", true, true, true, "ITRXEH59", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.7Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919797", "8570728", - "ITRAXX-HIVOLS9V1 - 0615", "iTraxx Europe HiVol series 9 Version 1", - "ITRAXX-HIVOLS9V1-0615 EUR SEN MMR I03 CDS", 2454546, 2457194, 0.026500000000000003, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAI7", "ITRAXX", 9, "HIVOL", "VOL", "HV", 1, 7, - "236075", 1, 31, 0, "LON", true, true, true, "ITRXEH79", "VOL")); - - return true; - } - - private static final boolean InitCDXRefDataSet10() - { - UpdateCDXRefDataMap ("ITRAXX.HIVOL.10Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919798", "8570760", - "ITRAXX-HIVOLS9V1 - 0618", "iTraxx Europe HiVol series 9 Version 1", - "ITRAXX-HIVOLS9V1-0618 EUR SEN MMR I03 CDS", 2454546, 2458290, 0.027, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAI7", "ITRAXX", 9, "HIVOL", "VOL", "HV", 1, 10, - "236075", 1, 31, 0, "LON", true, true, true, "ITRXEH09", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919799", "8569509", - "ITRAXX-XOVERS9V1 - 0611", "iTraxx Europe Crossover series 9 Version 1", - "ITRAXX-XOVERS9V1-0611 EUR SEN MMR I03 CDS MATURED", 2454546, 2455733, 0.0625, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAJ7", "ITRAXX", 9, "XOVER", "XVR", "XO", 1, 3, - "236074", 1, 50, 0, "LON", true, true, true, "ITRXEX39", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919800", "8569533", - "ITRAXX-XOVERS9V1 - 0613", "iTraxx Europe Crossover series 9 Version 1", - "ITRAXX-XOVERS9V1-0613 EUR SEN MMR I03 CDS MATURED", 2454546, 2456464, 0.065, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAJ7", "ITRAXX", 9, "XOVER", "XVR", "XO", 1, 5, - "236074", 1, 50, 0, "LON", true, true, true, "ITRXEX59", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919801", "8569550", - "ITRAXX-XOVERS9V1 - 0615", "iTraxx Europe Crossover series 9 Version 1", - "ITRAXX-XOVERS9V1-0615 EUR SEN MMR I03 CDS", 2454546, 2457194, 0.0645, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAJ7", "ITRAXX", 9, "XOVER", "XVR", "XO", 1, 7, - "236074", 1, 50, 0, "LON", true, true, true, "ITRXEX79", "XVR")); - - UpdateCDXRefDataMap ("CDX.NA IG CONS.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919802", "8564264", - "CDX-NAIGCONSS10V1 - 0613", "CDX.NA.IG.CONS.10", - "CDX_NA_IG_S10_CONS_6/13", 2454547, 2456464, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65B0AL3", "CDX", 10, "NA IG CONS", null, "IG", 1, 5, - null, 1, 40, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919804", "8569614", - "ITRAXX-XOVERS9V1 - 0618", "iTraxx Europe Crossover series 9 Version 1", - "ITRAXX-XOVERS9V1-0618 EUR SEN MMR I03 CDS MATURED", 2454546, 2458290, 0.064, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAJ7", "ITRAXX", 9, "XOVER", "XVR", "XO", 1, 10, - "236074", 1, 50, 0, "LON", true, true, true, "ITRXEX09", "XVR")); - - UpdateCDXRefDataMap ("CDX.EMDIV.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919805", "8564426", - "CDX-EMDIVS7V1 - 0613", "CDX.EM.DIVERSIFIED.7", - "CDX EM DIVER 7 5YR", 2454547, 2456464, 0.0245, "USD", - "ACT/360", true, 0.25, 2, "2165EKAG4", "CDX", 7, "EMDIV", null, "EM", 1, 5, - null, 1, 40, 0, "LON", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG ENRG.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919806", "8568421", - "CDX-NAIGENRGS10V1 - 0613", "CDX.NA.IG.ENRG.10", - "CDX_NA_IG_S10_ENRG_06/13", 2454547, 2456464, 0.003, "USD", - "ACT/360", false, 0.4, 4, "2I65B1AL1", "CDX", 10, "NA IG ENRG", null, "IG", 1, 5, - null, 1, 14, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.EM.10Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919807", "8569002", - "CDX-EMS9V1 - 0618", "CDX.EM.9", - "CDX EM 9 10YR", 2454547, 2458290, 0.030000000000000002, "USD", - "ACT/360", false, 0.25, 4, "2I65BZAI3", "CDX", 9, "EM", null, "EM", 1, 10, - null, 1, 14, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919809", "8568499", - "CDX-NAIGFINS10V1 - 0613", "CDX.NA.IG.FIN.10", - "CDX_NA_IG_S10_FIN_06/13", 2454547, 2456464, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65B2AL9", "CDX", 10, "NA IG FIN", null, "IG", 1, 5, - null, 1, 24, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.EM.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919810", "8569037", - "CDX-EMS9V1 - 0613", "CDX.EM.9", - "CDX EM 9 5YR", 2454547, 2456464, 0.026500000000000003, "USD", - "ACT/360", true, 0.25, 2, "2I65BZAI3", "CDX", 9, "EM", null, "EM", 1, 5, - null, 1, 14, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919811", "8570825", - "ITRAXX-FINSENS9V1 - 0613", "iTraxx Europe Senior Financials series 9 Version 1", - "ITRAXX-FINSENS9V1-0613 EUR SEN MMR I03 CDS", 2454546, 2456464, 0.0165, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAI5", "ITRAXX", 9, "FINSEN", "SEN", "IG", 1, 5, - "236077", 1, 25, 0, "LON", true, true, true, "ITRXES59", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.10Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919812", "8569851", - "ITRAXX-FINSENS9V1 - 0618", "iTraxx Europe Senior Financials series 9 Version 1", - "ITRAXX-FINSENS9V1-0618 EUR SEN MMR I03 CDS", 2454546, 2458290, 0.0175, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAI5", "ITRAXX", 9, "FINSEN", "SEN", "IG", 1, 10, - "236077", 1, 25, 0, "LON", true, true, true, "ITRXES09", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919813", "8569843", - "ITRAXX-FINSUBS9V1 - 0613", "iTraxx Europe Sub Financials series 9 Version 1", - "ITRAXX-FINSUBS9V1-0613 EUR LT2 SUB MMR I03 CDS", 2454546, 2456464, 0.029, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAJ1", "ITRAXX", 9, "FINSUB", "SUB", "IG", 1, 5, - "236078", 1, 25, 0, "LON", true, true, true, "ITRXEU59", "SUB")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.10Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919814", "8569835", - "ITRAXX-FINSUBS9V1 - 0618", "iTraxx Europe Sub Financials series 9 Version 1", - "ITRAXX-FINSUBS9V1-0618 EUR LT2 SUB MMR I03 CDS", 2454546, 2458290, 0.030000000000000002, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAJ1", "ITRAXX", 9, "FINSUB", "SUB", "IG", 1, 10, - "236078", 1, 25, 0, "LON", true, true, true, "ITRXEU09", "SUB")); - - UpdateCDXRefDataMap ("CDX.NA HY V20 FXD 84/100.5Y.10.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919815", "8569800", - "CDX-NAHYS10V20 FXD 84/100 - 0613", "CDX.NA.HY.10_Fixed", - "CDX_NA_HY_S10_100_FXD_84/100", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRJB7 FXD", "CDX", 10, "NA HY V20 FXD 84/100", null, "HY", 20, 5, - null, 0.84, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919816", "8569827", - "CDX-NAHYS10V1 - 0613", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBJ8", "CDX", 10, "NA HY", null, "HY", 1, 5, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919817", "8571600", - "CDX-NAHYS10V1 - 0609", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_01YR", 2454554, 2455003, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBJ8", "CDX", 10, "NA HY", null, "HY", 1, 1, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919818", "8571686", - "CDX-NAHYS10V1 - 0610", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_02YR", 2454554, 2455368, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBJ8", "CDX", 10, "NA HY", null, "HY", 1, 2, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919819", "8570400", - "CDX-NAHYBS10V1 - 0613", "CDX.NA.HY.B.10", - "CDX_NA_HY_S10_B___SWP", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSAT5", "CDX", 10, "NA HY B", null, "HY", 1, 5, - null, 1, 45, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919820", "8570892", - "CDX-NAHYS10V1 - 0611", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_03YR", 2454554, 2455733, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBJ8", "CDX", 10, "NA HY", null, "HY", 1, 3, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919822", "8571783", - "CDX-NAHYS10V1 - 0612", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_04YR", 2454554, 2456099, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBJ8", "CDX", 10, "NA HY", null, "HY", 1, 4, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919824", "8570876", - "CDX-NAHYS10V1 - 0614", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_06YR", 2454554, 2456829, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBJ8", "CDX", 10, "NA HY", null, "HY", 1, 6, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919825", "8570531", - "CDX-NAHYBBS10V1 - 0613", "CDX.NA.HY.BB.10", - "CDX_NA_HY_S10_BB__SWP", 2454554, 2456464, 0.04, "USD", - "ACT/360", false, 0.3, 4, "2I65BVAR2", "CDX", 10, "NA HY BB", null, "HY", 1, 5, - null, 1, 33, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.10Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919826", "8563985", - "CDX-NAIGHVOLS10V1 - 0618", "CDX.NA.IG.HVOL.10", - "CDX_NA_IG_S10_HVOL_10Y_06/18", 2454547, 2458290, 0.035, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AO1", "CDX", 10, "NA IG HVOL", null, "HV", 1, 10, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919827", "8570930", - "CDX-NAHYS10V1 - 0615", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_07YR", 2454554, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBJ8", "CDX", 10, "NA HY", null, "HY", 1, 7, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919828", "8570965", - "CDX-NAHYS10V1 - 0618", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_10YR", 2454554, 2458290, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBJ8", "CDX", 10, "NA HY", null, "HY", 1, 10, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919829", "8571759", - "CDX-NAHYHBS10V1 - 0613", "CDX.NA.HY.HB.10", - "CDX_NA_HY_S10_HB__SWP", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWAW9", "CDX", 10, "NA HY HB", null, "HY", 1, 5, - null, 1, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG INDU.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919830", "8564078", - "CDX-NAIGINDUS10V1 - 0613", "CDX.NA.IG.INDU.10", - "CDX_NA_IG_S10_INDU_06/13", 2454547, 2456464, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65B4AO9", "CDX", 10, "NA IG INDU", null, "IG", 1, 5, - null, 1, 27, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919831", "8568146", - "CDX-NAIGS10V1 - 0613", "CDX.NA.IG.10", - "CDX_NA_IG_S10_05Y_06/13", 2454547, 2456464, 0.0155, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAO3", "CDX", 10, "NA IG", null, "IG", 1, 5, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V1 EUR.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919832", "8568170", - "CDX-NAIGS10V1 EUR - 0613", "CDX.NA.IG.10", - "CDX_NA_IG_S10_05Y_06/13_EUR", 2454547, 2456464, 0.0155, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYAO3 EUR", "CDX", 10, "NA IG V1 EUR", null, "IG", 1, 5, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919833", "8568197", - "CDX-NAIGS10V1 - 0615", "CDX.NA.IG.10", - "CDX_NA_IG_S10_07Y_06/15", 2454547, 2457194, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAO3", "CDX", 10, "NA IG", null, "IG", 1, 7, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG TMT.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919834", "8564108", - "CDX-NAIGTMTS10V1 - 0613", "CDX.NA.IG.TMT.10", - "CDX_NA_IG_S10_TMT_06/13", 2454547, 2456464, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65DJAL0", "CDX", 10, "NA IG TMT", null, "IG", 1, 5, - null, 1, 22, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919835", "8568251", - "CDX-NAIGS10V1 - 0618", "CDX.NA.IG.10", - "CDX_NA_IG_S10_10Y_06/18", 2454547, 2458290, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAO3", "CDX", 10, "NA IG", null, "IG", 1, 10, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOLV1 EUR.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919836", "8564507", - "CDX-NAIGHVOLS10V1 EUR - 0613", "CDX.NA.IG.HVOL.10", - "CDX_NA_IG_S10_HVOL_05Y_06/13 EUR", 2454547, 2456464, 0.035, "EUR", - "ACT/360", false, 0.4, 4, "2I65B3AO1 EUR", "CDX", 10, "NA IG HVOLV1 EUR", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.1Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919837", "8569258", - "CDX-NAIGHVOLS10V1 - 0609", "CDX.NA.IG.HVOL.10", - "CDX_NA_IG_S10_HVOL_01Y_06/09", 2454547, 2455003, 0.035, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AO1", "CDX", 10, "NA IG HVOL", null, "HV", 1, 1, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.3Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919838", "8564140", - "CDX-NAXOS10V1 - 0611", "CDX.NA.XO.10", - "CDX_NA_XO_S10_03YR_06/11", 2454547, 2455733, 0.035, "USD", - "ACT/360", false, 0.4, 4, "1D764IAI8", "CDX", 10, "NAXO", null, "XO", 1, 3, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.2Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919839", "8568545", - "CDX-NAIGHVOLS10V1 - 0610", "CDX.NA.IG.HVOL.10", - "CDX_NA_IG_S10_HVOL_02Y_06/10", 2454547, 2455368, 0.035, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AO1", "CDX", 10, "NA IG HVOL", null, "HV", 1, 2, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919840", "8564191", - "CDX-NAXOS10V1 - 0613", "CDX.NA.XO.10", - "CDX_NA_XO_S10_05YR_06/13", 2454547, 2456464, 0.035, "USD", - "ACT/360", false, 0.4, 4, "1D764IAI8", "CDX", 10, "NAXO", null, "XO", 1, 5, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.3Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919841", "8568618", - "CDX-NAIGHVOLS10V1 - 0611", "CDX.NA.IG.HVOL.10", - "CDX_NA_IG_S10_HVOL_03Y_06/11", 2454547, 2455733, 0.035, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AO1", "CDX", 10, "NA IG HVOL", null, "HV", 1, 3, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.7Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919842", "8564230", - "CDX-NAXOS10V1 - 0615", "CDX.NA.XO.10", - "CDX_NA_XO_S10_07YR_06/15", 2454547, 2457194, 0.035, "USD", - "ACT/360", false, 0.4, 4, "1D764IAI8", "CDX", 10, "NAXO", null, "XO", 1, 7, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.4Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919843", "8563543", - "CDX-NAIGHVOLS10V1 - 0612", "CDX.NA.IG.HVOL.10", - "CDX_NA_IG_S10_HVOL_04Y_06/12", 2454547, 2456099, 0.035, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AO1", "CDX", 10, "NA IG HVOL", null, "HV", 1, 4, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.10Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919844", "8564418", - "CDX-NAXOS10V1 - 0618", "CDX.NA.XO.10", - "CDX_NA_XO_S10_10YR_06/18", 2454547, 2458290, 0.035, "USD", - "ACT/360", false, 0.4, 4, "1D764IAI8", "CDX", 10, "NAXO", null, "XO", 1, 10, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXOV1 EUR.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919845", "8564477", - "CDX-NAXOS10V1 EUR - 0613", "CDX.NA.XO.10", - "CDX_NA_XO_S10_05YR_06/13 EUR", 2454547, 2456464, 0.035, "EUR", - "ACT/360", false, 0.4, 4, "1D764IAI8 EUR", "CDX", 10, "NAXOV1 EUR", null, "XO", 1, 5, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.1Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919846", "8569290", - "CDX-NAIGS10V1 - 0609", "CDX.NA.IG.10", - "CDX_NA_IG_S10_01Y_06/09", 2454547, 2455003, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAO3", "CDX", 10, "NA IG", null, "IG", 1, 1, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.2Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919847", "8567298", - "CDX-NAIGS10V1 - 0610", "CDX.NA.IG.10", - "CDX_NA_IG_S10_02Y_06/10", 2454547, 2455368, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAO3", "CDX", 10, "NA IG", null, "IG", 1, 2, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919848", "8567310", - "CDX-NAIGS10V1 - 0611", "CDX.NA.IG.10", - "CDX_NA_IG_S10_03Y_06/11", 2454547, 2455733, 0.0155, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAO3", "CDX", 10, "NA IG", null, "IG", 1, 3, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919849", "8567409", - "CDX-NAIGS10V1 - 0612", "CDX.NA.IG.10", - "CDX_NA_IG_S10_04Y_06/12", 2454547, 2456099, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAO3", "CDX", 10, "NA IG", null, "IG", 1, 4, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BV10 FXD 36/45.5Y.10.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919860", "8571210", - "CDX-NAHYBS10V8 FXD 38/45 - 0613", "CDX.NA.HY.B.10", - "CDX_NA_HY_S10_B___FXD_38/45", 2454554, 2456464, 0.035, "USD", - "ACT/360", false, 0.4, 4, "2I65BSEV6 FXD", "CDX", 10, "NA HY BV10 FXD 36/45", null, "HY", 10, 5, - null, 0.8000100000000001, 45, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BBV2 FXD 32/33.5Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919861", "8570469", - "CDX-NAHYBBS10V2 FXD 32/33 - 0613", "CDX.NA.HY.BB.10", - "CDX_NA_HY_S10_BB__FXD_32/33", 2454554, 2456464, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BVBE0 FXD", "CDX", 10, "NA HY BBV2 FXD 32/33", null, "HY", 2, 5, - null, 0.9696899999999999, 33, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HBV14 FXD 20/30.5Y.10.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919862", "8571708", - "CDX-NAHYHBS10V13 FXD 21/30 - 0613", "CDX.NA.HY.HB.10", - "CDX_NA_HY_S10_HB__FXD_21/30", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BWFB0 FXD", "CDX", 10, "NA HY HBV14 FXD 20/30", null, "HY", 14, 5, - null, 0.66667, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V17 FXD 87/100.3Y.10.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919863", "8571724", - "CDX-NAHYS10V17 FXD 87/100 - 0611", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_FXD_03YR_87/100", 2454554, 2455733, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRHE3 FXD", "CDX", 10, "NA HY V17 FXD 87/100", null, "HY", 17, 3, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ IG.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919869", "8572216", - "ITRAXX-ASIAXJIGS9V1 - 0613", "iTraxx Asia ex-Japan IG Series Number 9 Version 1", - "ITRAXX-ASIA-IGS9-5Y USD SEN RES I03 CDS", 2454546, 2456464, 0.025, "USD", - "ACT/360", false, 0.35000000000000003, 4, "4ABCAMAB2", "ITRAXX", 9, "ASIAXJ IG", null, "IG", 1, 5, - "236082", 1, 50, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ HY.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919870", "8572232", - "ITRAXX-ASIAXJHYS9V1 - 0613", "iTraxx Asia ex-Japan HY Series Number 9 Version 1", - "ITRAXX-ASIA-HYS9-5Y USD SEN RES I03 CDS", 2454546, 2456464, 0.065, "USD", - "ACT/360", false, 0.35000000000000003, 4, "4ABCAGAB5", "ITRAXX", 9, "ASIAXJ HY", null, "IG", 1, 5, - "236080", 1, 20, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.AUSTRALIA.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919877", "8572275", - "ITRAXX-AUSTRALIAS9V1 - 0613", "iTraxx Australia Series Number 9 Version 1", - "ITRAXX-AUSTRALIAS9V1-0613 USD SEN MR I03 CDS", 2454546, 2456464, 0.022000000000000002, "USD", - "ACT/360", false, 0.4, 4, "2I668IAI3", "ITRAXX", 9, "AUSTRALIA", null, "IG", 1, 5, - "236079", 1, 25, 0, "HKG", false, false, true, null, "Itraxx Australia")); - - UpdateCDXRefDataMap ("ITRAXX.AUSTRALIA.10Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919878", "8572283", - "ITRAXX-AUSTRALIAS9V1 - 0618", "iTraxx Australia Series Number 9 Version 1", - "ITRAXX-AUSTRALIAS9V1-0618 USD SEN MR I03 CDS", 2454546, 2458290, 0.023, "USD", - "ACT/360", false, 0.4, 4, "2I668IAI3", "ITRAXX", 9, "AUSTRALIA", null, "IG", 1, 10, - "236079", 1, 25, 0, "HKG", false, false, true, null, "Itraxx Australia")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.3Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919879", "8572208", - "ITRAXX-JAPANS9V1 - 0611", "iTraxx Japan Series Number 9 Version 1", - "ITRAXX-JAPANS9V1-0611 JPY SEN RES I03 CDS", 2454546, 2455733, 0.02, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAI5", "ITRAXX", 9, "JAPAN", null, "IG", 1, 3, - "236084", 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919881", "8572224", - "ITRAXX-JAPANS9V1 - 0613", "iTraxx Japan Series Number 9 Version 1", - "ITRAXX-JAPANS9V1-0613 JPY SEN RES I03 CDS", 2454546, 2456464, 0.022000000000000002, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAI5", "ITRAXX", 9, "JAPAN", null, "IG", 1, 5, - "236084", 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919882", "8572240", - "ITRAXX-JAPANS9V1 - 0618", "iTraxx Japan Series Number 9 Version 1", - "ITRAXX-JAPANS9V1-0618 JPY SEN RES I03 CDS", 2454546, 2458290, 0.024, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAI5", "ITRAXX", 9, "JAPAN", null, "IG", 1, 10, - "236084", 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN 80.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919883", "8572267", - "ITRAXX-JAPAN 80S9V1 - 0613", "iTraxx Japan 80 series 9 Version 1", - "ITRAXX-JAPAN80S9V1-0613 JPY SEN RES I03 CDS", 2454546, 2456464, 0.003, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "ITRAXX-JAPAN 80S9V1", "ITRAXX", 9, "JAPAN 80", null, "IG", 1, 5, - null, 1, 80, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919884", "8572259", - "ITRAXX-JAPANHIVOLS9V1 - 0613", "iTraxx Japan HiVol Series Number 9 Version 1", - "ITRAXX-JHIVOLS9V1-0613 JPY SEN RES I03 CDS", 2454546, 2456464, 0.035, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MAH6", "ITRAXX", 9, "JAPANHIVOL", "VOL", "HV", 1, 5, - "236083", 1, 25, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919911", "8567913", - "USD ITRAXX-EUROPES9V1 - 0613", "iTraxx Europe series 9 Version 1", - "ITRAXX-EUROPES9V1-0613 USD SEN MMR I03 CDS", 2454546, 2456464, 0.0165, "USD", - "ACT/360", false, 0.4, 4, "2I666VAI6", "USD ITRAXX", 9, "EUROPE", "EUR", "IG", 1, 5, - "236073", 1, 125, 0, "LON", false, false, true, "ITRXEB59", "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.10Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919912", "8566569", - "USD ITRAXX-EUROPES9V1 - 0618", "iTraxx Europe series 9 Version 1", - "ITRAXX-EUROPES9V1-0618 USD SEN MMR I03 CDS", 2454546, 2458290, 0.0175, "USD", - "ACT/360", false, 0.4, 4, "2I666VAI6", "USD ITRAXX", 9, "EUROPE", "EUR", "IG", 1, 10, - "236073", 1, 125, 0, "LON", false, false, true, "ITRXEB09", "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919913", "8566526", - "USD ITRAXX-XOVERS9V1 - 0613", "iTraxx Europe Crossover series 9 Version 1", - "ITRAXX-XOVERS9V1-0613 USD SEN MMR I03 CDS MATURED", 2454546, 2456464, 0.065, "USD", - "ACT/360", false, 0.4, 4, "2I667KAJ7", "USD ITRAXX", 9, "XOVER", "XVR", "XO", 1, 5, - "236074", 1, 50, 0, "LON", false, false, true, "ITRXEX59", "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919914", "8564302", - "USD ITRAXX-XOVERS9V1 - 0618", "iTraxx Europe Crossover series 9 Version 1", - "ITRAXX-XOVERS9V1-0618 USD SEN MMR I03 CDS", 2454546, 2458290, 0.064, "USD", - "ACT/360", false, 0.4, 4, "2I667KAJ7", "USD ITRAXX", 9, "XOVER", "XVR", "XO", 1, 10, - "236074", 1, 50, 0, "LON", false, false, true, "ITRXEX09", "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSEN.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919916", "8611238", - "USD ITRAXX-FINSENS9V1 - 0613", "iTraxx Europe Senior Financials series 9 Version 1", - "ITRAXX-FINSENS9V1-0613 USD SEN MMR I03 CDS", 2454546, 2456464, 0.0165, "USD", - "ACT/360", false, 0.4, 4, "2I667DAI5", "USD ITRAXX", 9, "FINSEN", "SEN", "IG", 1, 5, - "236077", 1, 25, 0, "LON", false, false, true, "ITRXES59", "SEN")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSUB.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919917", "8611181", - "USD ITRAXX-FINSUBS9V1 - 0613", "iTraxx Europe Sub Financials series 9 Version 1", - "ITRAXX-FINSUBS9V1-0613 USD LT2 SUB MMR I03 CDS", 2454546, 2456464, 0.029, "USD", - "ACT/360", false, 0.2, 4, "2I667EAJ1", "USD ITRAXX", 9, "FINSUB", "SUB", "IG", 1, 5, - "236078", 1, 25, 0, "LON", false, false, true, "ITRXEU59", "SUB")); - - UpdateCDXRefDataMap ("USD ITRAXX.HIVOL.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919918", "8611718", - "USD ITRAXX-HIVOLS9V1 - 0613", "iTraxx Europe HiVol series 9 Version 1", - "ITRAXX-HIVOLS9V1-0613 USD SEN MMR I03 CDS", 2454546, 2456464, 0.026000000000000002, "USD", - "ACT/360", false, 0.4, 4, "2I667LAI7", "USD ITRAXX", 9, "HIVOL", "VOL", "HV", 1, 5, - "236075", 1, 31, 0, "LON", false, false, true, "ITRXEH59", "VOL")); - - UpdateCDXRefDataMap ("USD ITRAXX.HIVOL.10Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919919", "8611661", - "USD ITRAXX-HIVOLS9V1 - 0618", "iTraxx Europe HiVol series 9 Version 1", - "ITRAXX-HIVOLS9V1-0618 USD SEN MMR I03 CDS", 2454546, 2458290, 0.027, "USD", - "ACT/360", false, 0.4, 4, "2I667LAI7", "USD ITRAXX", 9, "HIVOL", "VOL", "HV", 1, 10, - "236075", 1, 31, 0, "LON", false, false, true, "ITRXEH09", "VOL")); - - UpdateCDXRefDataMap ("Itraxx.EMCorps.5Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919920", "8587159", - "Itraxx-EMCorpsS1V1 - 0913", "Itraxx CEEMEA Corps", - "ITRAXX CEEMEA CORPS USD SEN RES I03 CDS", 2454538, 2456556, 0, "USD", - "ACT/360", false, 0.4, 4, "Itraxx-EMCorpsS1V1-0913", "Itraxx", 1, "EMCorps", null, "EM", 1, 5, - null, 1, 30, 0, "LON", false, false, false, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919962", "8610100", - "LCDXNAS10V1 - 0609", "LCDX.NA.10", - "CDX_NA_LN_S10_100_01YR", 2454561, 2455003, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAF4", "LCDX", 10, "LCDXNA", null, "IG", 1, 1, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919963", "8610118", - "LCDXNAS10V1 - 0611", "LCDX.NA.10", - "CDX_NA_LN_S10_100_03YR", 2454561, 2455733, 0.0275, "USD", - "ACT/360", false, 0.6, 4, "5F199GAF4", "LCDX", 10, "LCDXNA", null, "IG", 1, 3, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS10V1 FXD.LCDXNAV1 FXD.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919964", "8610126", - "LCDXNAS10V1 FXD - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_FXD", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAF4 FXD", "LCDXNAS10V1 FXD", 10, "LCDXNAV1 FXD", null, "IG", 1, 5, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919971", "8610134", - "LCDXNAS10V1 - 0610", "LCDX.NA.10", - "CDX_NA_LN_S10_100_02YR", 2454561, 2455368, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAF4", "LCDX", 10, "LCDXNA", null, "IG", 1, 2, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919972", "8610150", - "LCDXNAS10V1 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAF4", "LCDX", 10, "LCDXNA", null, "IG", 1, 5, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919978", "8610304", - "LCDXNAS10V1 - 0615", "LCDX.NA.10", - "CDX_NA_LN_S10_100_07YR", 2454561, 2457194, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAF4", "LCDX", 10, "LCDXNA", null, "IG", 1, 7, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919979", "8610312", - "LCDXNAS10V1 - 0618", "LCDX.NA.10", - "CDX_NA_LN_S10_100_10YR", 2454561, 2458290, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAF4", "LCDX", 10, "LCDXNA", null, "IG", 1, 10, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919981", "8610320", - "LCDXNAS10V1 - 0612", "LCDX.NA.10", - "CDX_NA_LN_S10_100_04YR", 2454561, 2456099, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAF4", "LCDX", 10, "LCDXNA", null, "IG", 1, 4, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("919982", "8610347", - "LCDXNAS10V1 - 0614", "LCDX.NA.10", - "CDX_NA_LN_S10_100_06YR", 2454561, 2456829, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAF4", "LCDX", 10, "LCDXNA", null, "IG", 1, 6, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG FIN.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920019", "5675960", - "DJCDX-NAIGFINS3V1 - 0310", "Dow Jones CDX.NA.IG.FIN.3", - "DOW_JONES_CDX_NA_IG_FIN_S3_05Y", 2453270, 2455276, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65B2AB1", "DJCDX", 3, "NA IG FIN", null, "IG", 1, 5, - null, 1, 23, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.10Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920020", "8650934", - "DJCDX-NAIGHVOLS1V1 - 0314", "Dow Jones CDX.NA.IG.HVOL.1", - "DJCDX_NA_IG_S1_HIVOL_10Y", 2452934, 2456737, 0.0135, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AC7", "DJCDX", 1, "NA IG HVOL", null, "HV", 1, 10, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920150", "8644292", - "LCDXNAS8V5 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_96/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAG2", "LCDX", 8, "LCDXNA", null, "IG", 5, 3, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V5 FXD.LCDXNAV5 FXD.5Y.8.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920151", "8644322", - "LCDXNAS8V5 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_96/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAG2 FXD", "LCDXNAS8V5 FXD", 8, "LCDXNAV5 FXD", null, "IG", 5, 5, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920159", "8644446", - "LCDXNAS8V5 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_96/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAG2", "LCDX", 8, "LCDXNA", null, "IG", 5, 4, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920160", "8644489", - "LCDXNAS8V5 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_96/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAG2", "LCDX", 8, "LCDXNA", null, "IG", 5, 6, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920161", "8644500", - "LCDXNAS8V5 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_96/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAG2", "LCDX", 8, "LCDXNA", null, "IG", 5, 7, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920162", "8644519", - "LCDXNAS8V5 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_96/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAG2", "LCDX", 8, "LCDXNA", null, "IG", 5, 5, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920163", "8644470", - "LCDXNAS8V5 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_96/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAG2", "LCDX", 8, "LCDXNA", null, "IG", 5, 10, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.5Y.2.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920326", "8728771", - "DJCDX-NAIGS2V3 - 0909", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_V3_05Y_9/09_124/125", 2453088, 2455095, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAJ4", "DJCDX", 2, "NA IG", null, "IG", 3, 5, - null, 0.9920000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.5Y.2.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920327", "8728976", - "DJCDX-NAIGHVOLS2V3 - 0909", "Dow Jones CDX.NA.IG.HVOL.2", - "DJCDX_NA_IG_S2_V3_HVOL_05Y_9/09_29/30", 2453088, 2455095, 0.0115, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AJ2", "DJCDX", 2, "NA IG HVOL", null, "HV", 3, 5, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.10Y.2.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920328", "8729018", - "DJCDX-NAIGS2V3 - 0914", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_V3_10Y_9/14_124/125", 2453088, 2456921, 0.008, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAJ4", "DJCDX", 2, "NA IG", null, "IG", 3, 10, - null, 0.9920000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.10Y.2.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920329", "8729140", - "DJCDX-NAIGHVOLS2V3 - 0914", "Dow Jones CDX.NA.IG.HVOL.2", - "DJCDX_NA_IG_S2_V3_HVOL_10Y_9/14_29/30", 2453088, 2456921, 0.013000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AJ2", "DJCDX", 2, "NA IG HVOL", null, "HV", 3, 10, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.7Y.2.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920330", "8729239", - "DJCDX-NAIGS2V3 - 0911", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_V3_07Y_9/11_124/125", 2453088, 2455825, 0.006, "USD", - "ACT/360", false, 0.5, 4, "2I65BYAJ4", "DJCDX", 2, "NA IG", null, "IG", 3, 7, - null, 0.9920000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("MCDX SERIES10 3YR.MCDX SERIE 3YR.3Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920444", "8727155", - "MCDX SERIES10 3YR - 0611", "MCDX.NA.10", - "MCDX SERIES10 3Y", 2454594, 2455733, 0.0035, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAA5", "MCDX SERIES10 3YR", 10, "MCDX SERIE 3YR", null, "IG", 1, 3, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("MCDX SERIES10 5YR.MCDX SERIE 5YR.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920445", "8727163", - "MCDX SERIES10 5YR - 0613", "MCDX.NA.10", - "MCDX SERIES10 5Y", 2454594, 2456464, 0.0035, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAA5", "MCDX SERIES10 5YR", 10, "MCDX SERIE 5YR", null, "IG", 1, 5, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("MCDX SERIES10 10YR.MCDX SERIE 10YR.10Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920446", "8727201", - "MCDX SERIES10 10YR - 0618", "MCDX.NA.10", - "MCDX SERIES10 10Y", 2454594, 2458290, 0.004, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAA5", "MCDX SERIES10 10YR", 10, "MCDX SERIE 10YR", null, "IG", 1, 10, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY B.5Y.3.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920752", "8906963", - "DJCDX-NAHYBS3V4 - 1209", "Dow Jones CDX.NA.HY.B.3", - "DJCDX_NA_HY_S3_B_SWP_42/44", 2453196, 2455186, 0.04, "USD", - "ACT/360", false, 0.3, 4, "2I65BSAO6", "DJCDX", 3, "NA HY B", null, "HY", 4, 5, - null, 0.9545399999999999, 44, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.4Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920791", "5890748", - "DJCDX-NAIGS4V1 - 0609", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_04Y_6/09", 2453451, 2455003, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAD7", "DJCDX", 4, "NA IG", null, "IG", 1, 4, - null, 1, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet11() - { - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920794", "8914990", - "ITRAXX-EUROPES6V1 - 0616", "iTraxx Europe Series 6 Version 1", - "ITRAXX-EUROPES6V1-0611 EUR SEN MMR I03 CDS", 2453999, 2457560, 0.003, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAF2", "ITRAXX", 6, "EUROPE", "EUR", "IG", 1, 10, - "232307", 1, 122, 0, "LON", true, true, true, null, "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920888", "8630615", - "ITRAXX-LevXS2V1 - 0613", "ITRAXX LEVX SENIOR SERIES 2 VERSION 1", - "ITRAXX LEVX SENIOR SERIES 2 VERSION 1 EUR 1ST SEC RES I03 CDS", 2454543, 2456464, 0.052500000000000005, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJAK9", "ITRAXX", 2, "LevX", null, "IG", 1, 5, - "236163", 1, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevXSub.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920902", "8939939", - "ITRAXX-LevXSubS2V1 - 0613", "ITRAXX LEVX SUBORDINATE SERIES 2 VERSION 1", - "ITRAXX LEVX SUBORDINATE SERIES 2 VERSION 1 EUR 2ND SEC RES I03 CDS", 2454543, 2456464, 0.0825, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKAO8", "ITRAXX", 2, "LevXSub", null, "IG", 1, 5, - null, 1, 45, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG CONS.5Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920939", "8941543", - "DJCDX-NAIGCONSS2V2 - 0909", "Dow Jones CDX NA IG CONS.2", - "DJCDX_NA_IG_S2_V2_CONS_5Y_09/09_31/31", 2453088, 2455095, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65B0AH2", "DJCDX", 2, "NA IG CONS", null, "IG", 2, 5, - null, 1, 31, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY B.5Y.2.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920947", "8941238", - "DJCDX-NAHYBS2V3 - 0909", "Dow Jones CDX.NA.HY.B.2", - "DJCDX_NA_HY_S2_B_SWP_41/43", 2453088, 2455095, 0.048, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BSAN8", "DJCDX", 2, "NA HY B", null, "HY", 3, 5, - null, 0.95348, 43, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY BB.5Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("920977", "8941241", - "DJCDX-NAHYBBS2V2 - 0909", "Dow Jones CDX.NA.HY.BB.2", - "DJCDX_NA_HY_S2_BB__SWP_41/42", 2453088, 2455095, 0.029, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BVAH4", "DJCDX", 2, "NA HY BB", null, "HY", 2, 5, - null, 0.97619, 42, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.5Y.2.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921028", "8942042", - "DJCDX-NAHYS2V5 - 0909", "Dow Jones CDX.NA.HY.2", - "DJCDX_NA_HY_S2_100_SWP_95/100", 2453088, 2455095, 0.043000000000000003, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAY6", "DJCDX", 2, "NA HY", null, "HY", 5, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG FIN.5Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921037", "8942125", - "DJCDX-NAIGFINS2V2 - 0909", "Dow Jones CDX NA IG FIN.2", - "DOW_JONES_CDX_NA_IG_FIN_S2_05Y", 2453088, 2455095, 0.006, "USD", - "ACT/360", false, 0.12, 4, "2I65B2AH8", "DJCDX", 2, "NA IG FIN", null, "IG", 2, 5, - null, 1, 23, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY.5Y.1.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921052", "8941268", - "DJCDX-NAHYS1V4 - 0309", "Dow Jones CDX.NA.HY.1", - "DJCDX_NA_HY_S1_100_SWP_94/100", 2452934, 2454911, 0.0425, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRAX8", "DJCDX", 1, "NA HY", null, "HY", 4, 5, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY BB.5Y.1.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921056", "8941282", - "DJCDX-NAHYBBS1V2 - 0309", "Dow Jones CDX.NA.HY.BB.1", - "DJCDX_NA_HY_S1_BB_SWP_42/44 BEAR CURVE", 2452934, 2454911, 0.029, "USD", - "ACT/360", false, 0.3, 4, "2I65BVAG6", "DJCDX", 1, "NA HY BB", null, "HY", 2, 5, - null, 0.97726, 44, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG CONS.5Y.1.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921188", "7618271", - "DJCDX-NAIGCONSS1V2 - 0309", "Dow Jones CDX.NA.IG.CONS", - "DJCDX_NA_IG_S1_V2_CONS_5Y_03/09_30/30", 2452934, 2454911, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65B0AG4", "DJCDX", 1, "NA IG CONS", null, "IG", 2, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921238", "8954349", - "LCDXNAS8V6 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_95/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GAH5", "LCDX", 8, "LCDXNA", null, "IG", 6, 3, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V6 FXD.LCDXNAV6 FXD.5Y.8.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921239", "8954350", - "LCDXNAS8V6 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_95/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GAH5 FXD", "LCDXNAS8V6 FXD", 8, "LCDXNAV6 FXD", null, "IG", 6, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921242", "8954369", - "LCDXNAS8V6 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_95/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GAH5", "LCDX", 8, "LCDXNA", null, "IG", 6, 4, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921243", "8954390", - "LCDXNAS8V6 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_95/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GAH5", "LCDX", 8, "LCDXNA", null, "IG", 6, 10, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921244", "8954391", - "LCDXNAS8V6 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_95/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GAH5", "LCDX", 8, "LCDXNA", null, "IG", 6, 6, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921245", "8954402", - "LCDXNAS8V6 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_95/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GAH5", "LCDX", 8, "LCDXNA", null, "IG", 6, 7, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921246", "8954403", - "LCDXNAS8V6 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_95/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAH5", "LCDX", 8, "LCDXNA", null, "IG", 6, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LevXSenS1V10.LevXSen.5Y.1.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921250", "8955669", - "LevXSenS1V10 - 1211", "ITRAXX LEVX SENIOR SERIES 1 VERSION 10", - "ITRAXX LEVX SENIOR SERIES 1 VERSION 10 EUR 1ST SEC MMR I03 CDS", 2453999, 2455916, 0.017, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJAJ2", "LevXSenS1V10", 1, "LevXSen", null, "IG", 10, 5, - null, 0.7427, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921306", "8958807", - "USD ITRAXX-XOVERS10V1 - 1213", "iTraxx Europe Crossover series 10 Version 1", - "ITRAXX-XOVERS10V1-1213 USD SEN MMR I03 CDS MATURED", 2454739, 2456647, 0.056, "USD", - "ACT/360", false, 0.4, 4, "2I667KAK4", "USD ITRAXX", 10, "XOVER", "XVR", "XO", 1, 5, - null, 1, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921307", "8958818", - "USD ITRAXX-XOVERS10V1 - 1218", "iTraxx Europe Crossover series 10 Version 1", - "ITRAXX-XOVERS10V1-1218 USD SEN MMR I03 CDS MATURED", 2454739, 2458473, 0.054, "USD", - "ACT/360", false, 0.4, 4, "2I667KAK4", "USD ITRAXX", 10, "XOVER", "XVR", "XO", 1, 10, - null, 1, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSEN.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921308", "8958823", - "USD ITRAXX-FINSENS10V1 - 1213", "iTraxx Europe Senior Financials series 10 Version 1", - "ITRAXX-FINSENS10V1-1213 USD SEN MMR I03 CDS", 2454739, 2456647, 0.012, "USD", - "ACT/360", false, 0.4, 4, "2I667DAJ3", "USD ITRAXX", 10, "FINSEN", "SEN", "SENF", 1, 5, - null, 1, 25, 0, "LON", false, false, true, null, "SEN")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSEN.10Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921309", "8958829", - "USD ITRAXX-FINSENS10V1 - 1218", "iTraxx Europe Senior Financials series 10 Version 1", - "ITRAXX-FINSENS10V1-1218 USD SEN MMR I03 CDS", 2454739, 2458473, 0.013000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I667DAJ3", "USD ITRAXX", 10, "FINSEN", "SEN", "SENF", 1, 10, - null, 1, 25, 0, "LON", false, false, true, null, "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921310", "8958260", - "ITRAXX-FINSUBS10V1 - 1213", "iTraxx Europe Sub Financials series 10 Version 1", - "ITRAXX-FINSUBS10V1-1213 EUR LT2 SUB MMR I03 CDS", 2454739, 2456647, 0.022000000000000002, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAK8", "ITRAXX", 10, "FINSUB", "SUB", "SUBF", 1, 5, - "241294", 1, 25, 0, "LON", true, true, true, "ITXEU510", "SUB")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921314", "8959395", - "ITRAXX-JAPANS10V1 - 1213", "ITRAXX JAPAN SERIES NUMBER 10 VERSION 1", - "ITRAXX-JAPANS10V1-1213 JPY SEN RES I03 CDS", 2454739, 2456647, 0.015000000000000001, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAJ3", "ITRAXX", 10, "JAPAN", null, "JPHG", 1, 5, - "241291", 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("CDX.EMDIV.5Y.8.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921316", "8957890", - "CDX-EMDIVS8V1 - 1213", "CDX.EM.DIVERSIFIED.8", - "CDX EM DIVER 8 5YR", 2454731, 2456647, 0.028, "USD", - "ACT/360", true, 0.25, 2, "2165EKAH2", "CDX", 8, "EMDIV", null, "EM", 1, 5, - null, 1, 40, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.EM.10Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921317", "8957892", - "CDX-EMS10V1 - 1218", "CDX.EM.10", - "CDX EM 10 10YR", 2454731, 2458473, 0.036000000000000004, "USD", - "ACT/360", false, 0.25, 4, "2I65BZAJ1", "CDX", 10, "EM", null, "EM", 1, 10, - null, 1, 14, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.EM.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921318", "8957893", - "CDX-EMS10V1 - 1213", "CDX.EM.10", - "CDX EM 10 5YR", 2454731, 2456647, 0.0335, "USD", - "ACT/360", true, 0, 2, "2I65BZAJ1", "CDX", 10, "EM", null, "EM", 1, 5, - null, 1, 14, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V20 FXD 84/100.5Y.11.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921319", "8957895", - "CDX-NAHYS11V20 FXD 84/100 - 1213", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_FXD_84/100", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRJA9 FXD", "CDX", 11, "NA HY V20 FXD 84/100", null, "HY", 20, 5, - null, 0.84, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921320", "8957896", - "CDX-NAHYS11V1 - 1213", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBQ2", "CDX", 11, "NA HY", null, "HY", 1, 5, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921321", "8957897", - "CDX-NAHYS11V1 - 1209", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_01YR", 2454738, 2455186, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBQ2", "CDX", 11, "NA HY", null, "HY", 1, 1, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921322", "8957898", - "CDX-NAHYS11V1 - 1210", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_02YR", 2454738, 2455551, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBQ2", "CDX", 11, "NA HY", null, "HY", 1, 2, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921323", "8957899", - "CDX-NAHYS11V1 - 1211", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_03YR", 2454738, 2455916, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBQ2", "CDX", 11, "NA HY", null, "HY", 1, 3, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.3Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921324", "8959302", - "ITRAXX-JAPANS10V1 - 1211", "iTraxx Japan series 10 Version 1", - "ITRAXX-JAPANS10V1-1211 JPY SEN RES I03 CDS", 2454739, 2455916, 0.015000000000000001, "JPY", - "ACT/360", false, 0.4, 4, "2I668HAJ3", "ITRAXX", 10, "JAPAN", null, "IG", 1, 3, - null, 1, 50, 0, "TOK", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ HY.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921325", "8959363", - "ITRAXX-ASIAXJHYS10V1 - 1213", "iTraxx Asia ex-Japan HY Series Number 10 Version 1", - "ITRAXX-ASIA-HYS10-5Y USD SEN RES I03 CDS", 2454739, 2456647, 0.05, "USD", - "ACT/360", false, 0.25, 4, "4ABCAGAC3", "ITRAXX", 10, "ASIAXJ HY", null, "ASHY", 1, 5, - "241296", 1, 20, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921326", "8959399", - "ITRAXX-JAPANS10V1 - 1218", "ITRAXX-JAPANS10V1-10Y", - "ITRAXX-JAPANS10V1-1218 JPY SEN RES I03 CDS", 2454739, 2458473, 0.024, "JPY", - "ACT/360", false, 0.4, 4, "2I668HAJ3", "ITRAXX", 10, "JAPAN", null, "IG", 1, 10, - null, 1, 50, 0, "TOK", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.JHIVOL.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921327", "8959400", - "ITRAXX-JHIVOLS10V1 - 1213", "iTraxx Japan HiVol series 10 Version 1", - "ITRAXX-JHIVOLS10V1-1213 JPY SEN RES I03 CDS", 2454739, 2456647, 0.035, "JPY", - "ACT/360", false, 0.4, 4, "2I668MAI4", "ITRAXX", 10, "JHIVOL", "VOL", "HV", 1, 5, - null, 1, 25, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ IG.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921328", "8959362", - "ITRAXX-ASIAXJIGS10V1 - 1213", "iTraxx Asia ex-Japan IG Series Number 10 Version 1", - "ITRAXX-ASIA-IGS10-5Y USD SEN RES I03 CDS", 2454739, 2456647, 0.02, "USD", - "ACT/360", false, 0.35000000000000003, 4, "4ABCAMAC0", "ITRAXX", 10, "ASIAXJ IG", null, "ASHG", 1, 5, - "241295", 1, 50, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.AUSTRALIA.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921329", "8959401", - "ITRAXX-AUSTRALIAS10V1 - 1213", "iTraxx Australia Series Number 10 Version 1", - "ITRAXX-AUSTRALIAS10V1-1213 USD SEN MR I03 CDS", 2454739, 2456647, 0.02, "USD", - "ACT/360", false, 0.4, 4, "2I668IAJ1", "ITRAXX", 10, "AUSTRALIA", null, "AUHG", 1, 5, - "921329", 1, 25, 0, "HKG", false, false, true, null, "Itraxx Australia")); - - UpdateCDXRefDataMap ("ITRAXX.AUSTRALIA.10Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921330", "8959397", - "ITRAXX-AUSTRALIAS10V1 - 1218", "iTraxx Australia Series Number 10 Version 1", - "ITRAXX-AUSTRALIAS10V1-1218 USD SEN MR I03 CDS", 2454739, 2458473, 0.023, "USD", - "ACT/360", false, 0.4, 4, "2I668IAJ1", "ITRAXX", 10, "AUSTRALIA", null, "IG", 1, 10, - null, 1, 25, 0, "TOK", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921334", "8957900", - "CDX-NAHYS11V1 - 1212", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_04YR", 2454738, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBQ2", "CDX", 11, "NA HY", null, "HY", 1, 4, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921335", "8958726", - "CDX-NAHYS11V1 - 1215", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_07YR", 2454738, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBQ2", "CDX", 11, "NA HY", null, "HY", 1, 7, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921336", "8958727", - "CDX-NAHYS11V1 - 1218", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_10YR", 2454738, 2458473, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBQ2", "CDX", 11, "NA HY", null, "HY", 1, 10, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.3Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921338", "8958917", - "ITRAXX-EUROPES10V1 - 1211", "iTraxx Europe series 10 Version 1", - "ITRAXX-EUROPES10V1-1211 EUR SEN MMR I03 CDS", 2454739, 2455917, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAJ4", "ITRAXX", 10, "EUROPE", "EUR", "IG", 1, 3, - "241301", 1, 125, 0, "LON", true, true, true, "ITXEB310", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921339", "8958924", - "ITRAXX-EUROPES10V1 - 1213", "iTraxx Europe series 10 Version 1", - "ITRAXX-EUROPES10V1-1213 EUR SEN MMR I03 CDS", 2454739, 2456647, 0.012, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAJ4", "ITRAXX", 10, "EUROPE", "EUR", "IG", 1, 5, - "241301", 1, 125, 0, "LON", true, true, true, "ITXEB510", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.7Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921340", "8958959", - "ITRAXX-EUROPES10V1 - 1215", "iTraxx Europe series 10 Version 1", - "ITRAXX-EUROPES10V1-1215 EUR SEN MMR I03 CDS", 2454739, 2457377, 0.0125, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAJ4", "ITRAXX", 10, "EUROPE", "EUR", "IG", 1, 7, - "241301", 1, 125, 0, "LON", true, true, true, "ITXEB710", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921341", "8958984", - "ITRAXX-EUROPES10V1 - 1218", "iTraxx Europe series 10 Version 1", - "ITRAXX-EUROPES10V1-1218 EUR SEN MMR I03 CDS", 2454739, 2458473, 0.013000000000000001, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAJ4", "ITRAXX", 10, "EUROPE", "EUR", "IG", 1, 10, - "241301", 1, 125, 0, "LON", true, true, true, "ITXEB010", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.3Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921342", "8959188", - "ITRAXX-HIVOLS10V1 - 1211", "iTraxx Europe HiVol series 10 Version 1", - "ITRAXX-HIVOLS10V1-1211 EUR SEN MMR I03 CDS", 2454739, 2455916, 0.018500000000000003, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAJ5", "ITRAXX", 10, "HIVOL", "VOL", "HV", 1, 3, - "241307", 1, 30, 0, "LON", true, true, true, "ITXEH310", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921343", "8958096", - "ITRAXX-FINSENS10V1 - 1213", "iTraxx Europe Senior Financials series 10 Version 1", - "ITRAXX-FINSENS10V1-1213 EUR SEN MMR I03 CDS", 2454739, 2456647, 0.012, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAJ3", "ITRAXX", 10, "FINSEN", "SEN", "SENF", 1, 5, - "241293", 1, 25, 0, "LON", true, true, true, "ITXES510", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.10Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921344", "8958117", - "ITRAXX-FINSENS10V1 - 1218", "iTraxx Europe Senior Financials series 10 Version 1", - "ITRAXX-FINSENS10V1-1218 EUR SEN MMR I03 CDS", 2454739, 2458473, 0.013000000000000001, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAJ3", "ITRAXX", 10, "FINSEN", "SEN", "SENF", 1, 10, - "241293", 1, 25, 0, "LON", true, true, true, "ITXES010", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921345", "8960350", - "ITRAXX-HIVOLS10V1 - 1213", "iTraxx Europe HiVol series 10 Version 1", - "ITRAXX-HIVOLS10V1-1213 EUR SEN MMR I03 CDS", 2454739, 2456647, 0.022000000000000002, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAJ5", "ITRAXX", 10, "HIVOL", "VOL", "HV", 1, 5, - "241307", 1, 30, 0, "LON", true, true, true, "ITXEH510", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.7Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921346", "8959193", - "ITRAXX-HIVOLS10V1 - 1215", "iTraxx Europe HiVol series 10 Version 1", - "ITRAXX-HIVOLS10V1-1215 EUR SEN MMR I03 CDS", 2454739, 2457377, 0.022500000000000003, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAJ5", "ITRAXX", 10, "HIVOL", "VOL", "HV", 1, 7, - "241307", 1, 30, 0, "LON", true, true, true, "ITXEH710", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.10Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921347", "8960352", - "ITRAXX-HIVOLS10V1 - 1218", "iTraxx Europe HiVol series 10 Version 1", - "ITRAXX-HIVOLS10V1-1218 EUR SEN MMR I03 CDS", 2454739, 2458473, 0.023, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAJ5", "ITRAXX", 10, "HIVOL", "VOL", "HV", 1, 10, - "241307", 1, 30, 0, "LON", true, true, true, "ITXEH010", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.10Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921350", "8958309", - "ITRAXX-FINSUBS10V1 - 1218", "iTraxx Europe Sub Financials series 10 Version 1", - "ITRAXX-FINSUBS10V1-1218 EUR LT2 SUB MMR I03 CDS", 2454739, 2458473, 0.023, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAK8", "ITRAXX", 10, "FINSUB", "SUB", "SUBF", 1, 10, - "241294", 1, 25, 0, "LON", true, true, true, "ITXEU010", "SUB")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921351", "8959547", - "USD ITRAXX-EUROPES10V1 - 1213", "iTraxx Europe series 10 Version 1", - "ITRAXX-EUROPES10V1-1213 USD SEN MMR I03 CDS", 2454739, 2456647, 0.012, "USD", - "ACT/360", false, 0.4, 4, "2I666VAJ4", "USD ITRAXX", 10, "EUROPE", "EUR", "IG", 1, 5, - null, 1, 125, 0, "LON", false, false, true, null, "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSUB.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921352", "8958876", - "USD ITRAXX-FINSUBS10V1 - 1213", "iTraxx Europe Sub Financials series 10 Version 1", - "ITRAXX-FINSUBS10V1-1213 USD LT2 SUB MMR I03 CDS", 2454739, 2456647, 0.022000000000000002, "USD", - "ACT/360", false, 0.2, 4, "2I667EAK8", "USD ITRAXX", 10, "FINSUB", "SUB", "SUBF", 1, 5, - null, 1, 25, 0, "LON", false, false, true, null, "SUB")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSUB.10Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921353", "8958880", - "USD ITRAXX-FINSUBS10V1 - 1218", "iTraxx Europe Sub Financials series 10 Version 1", - "ITRAXX-FINSUBS10V1-1218 USD LT2 SUB MMR I03 CDS", 2454739, 2458473, 0.023, "USD", - "ACT/360", false, 0.2, 4, "2I667EAK8", "USD ITRAXX", 10, "FINSUB", "SUB", "SUBF", 1, 10, - null, 1, 25, 0, "LON", false, false, true, null, "SUB")); - - UpdateCDXRefDataMap ("USD ITRAXX.HIVOL.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921357", "8958881", - "USD ITRAXX-HIVOLS10V1 - 1213", "iTraxx Europe HiVol series 10 Version 1", - "ITRAXX-HIVOLS10V1-1213 USD SEN MMR I03 CDS", 2454739, 2456647, 0.022000000000000002, "USD", - "ACT/360", false, 0.4, 4, "2I667LAJ5", "USD ITRAXX", 10, "HIVOL", "VOL", "HV", 1, 5, - null, 1, 30, 0, "LON", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("USD ITRAXX.HIVOL.10Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921358", "8958886", - "USD ITRAXX-HIVOLS10V1 - 1218", "iTraxx Europe HiVol series 10 Version 1", - "ITRAXX-HIVOLS10V1-1218 USD SEN MMR I03 CDS", 2454739, 2458473, 0.023, "USD", - "ACT/360", false, 0.4, 4, "2I667LAJ5", "USD ITRAXX", 10, "HIVOL", "VOL", "HV", 1, 10, - null, 1, 30, 0, "LON", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.10Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921360", "8958798", - "USD ITRAXX-EUROPES10V1 - 1218", "iTraxx Europe series 10 Version 1", - "ITRAXX-EUROPES10V1-1218 USD SEN MMR I03 CDS", 2454739, 2458473, 0.013000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I666VAJ4", "USD ITRAXX", 10, "EUROPE", "EUR", "IG", 1, 10, - null, 1, 125, 0, "LON", false, false, true, null, "EUR")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921361", "8958724", - "CDX-NAHYS11V1 - 1214", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_06YR", 2454738, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBQ2", "CDX", 11, "NA HY", null, "HY", 1, 6, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921362", "8959011", - "ITRAXX-XOVERS10V1 - 1211", "iTraxx Europe Crossover series 10 Version 1", - "ITRAXX-XOVERS10V1-1211 EUR SEN MMR I03 CDS MATURED", 2454739, 2455916, 0.053000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAK4", "ITRAXX", 10, "XOVER", "XVR", "XO", 1, 3, - "241303", 1, 50, 0, "LON", true, true, true, "ITXEX310", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921365", "8960347", - "ITRAXX-XOVERS10V1 - 1213", "iTraxx Europe Crossover series 10 Version 1", - "ITRAXX-XOVERS10V1-1213 EUR SEN MMR I03 CDS MATURED", 2454739, 2456647, 0.056, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAK4", "ITRAXX", 10, "XOVER", "XVR", "XO", 1, 5, - "241303", 1, 50, 0, "LON", true, true, true, "ITXEX510", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921366", "8960351", - "ITRAXX-XOVERS10V1 - 1218", "iTraxx Europe Crossover series 10 Version 1", - "ITRAXX-XOVERS10V1-1218 EUR SEN MMR I03 CDS MATURED", 2454739, 2458473, 0.054, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAK4", "ITRAXX", 10, "XOVER", "XVR", "XO", 1, 10, - "241303", 1, 50, 0, "LON", true, true, true, "ITXEX010", "XVR")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921367", "8958854", - "CDX-NAHYBS11V1 - 1213", "CDX.NA.HY.B.11", - "CDX_NA_HY_S11_B___SWP", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSAU2", "CDX", 11, "NA HY B", null, "HY", 1, 5, - null, 1, 36, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V19 FXD 85/100.3Y.11.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921368", "8964195", - "CDX-NAHYS11V17 FXD 87/100 - 1211", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_FXD_03YR_87/100", 2454738, 2455916, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRIJ1 FXD", "CDX", 11, "NA HY V19 FXD 85/100", null, "HY", 19, 3, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921369", "8958866", - "CDX-NAHYBBS11V1 - 1213", "CDX.NA.HY.BB.11", - "CDX_NA_HY_S11_BB__SWP", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BVAV3", "CDX", 11, "NA HY BB", null, "HY", 1, 5, - null, 1, 40, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921371", "8959014", - "ITRAXX-XOVERS10V1 - 1215", "iTraxx Europe Crossover series 10 Version 1", - "ITRAXX-XOVERS10V1-1215 EUR SEN MMR I03 CDS MATURED", 2454739, 2457377, 0.055, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAK4", "ITRAXX", 10, "XOVER", "XVR", "XO", 1, 7, - "241303", 1, 50, 0, "LON", true, true, true, "ITXEX710", "XVR")); - - UpdateCDXRefDataMap ("CDX.NA IG.1Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921377", "8963164", - "CDX-NAIGS10V2 - 0609", "CDX.NA.IG.10", - "CDX_NA_IG_S10_01Y_06/09_123/125", 2454547, 2455003, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAP0", "CDX", 10, "NA IG", null, "IG", 2, 1, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BBV2 FXD 39/40.5Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921378", "8958859", - "CDX-NAHYBBS11V2 FXD 39/40 - 1213", "CDX.NA.HY.BB.11", - "CDX_NA_HY_S11_BB__FXD_39/40", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BVBF7 FXD", "CDX", 11, "NA HY BBV2 FXD 39/40", null, "HY", 2, 5, - null, 0.975, 40, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921379", "8963179", - "CDX-NAIGS10V2 - 0613", "CDX.NA.IG.10", - "CDX_NA_IG_S10_05Y_06/13_123/125", 2454547, 2456464, 0.0155, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAP0", "CDX", 10, "NA IG", null, "IG", 2, 5, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.2Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921380", "8963167", - "CDX-NAIGS10V2 - 0610", "CDX.NA.IG.10", - "CDX_NA_IG_S10_02Y_06/10_123/125", 2454547, 2455368, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAP0", "CDX", 10, "NA IG", null, "IG", 2, 2, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.1Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921381", "8958973", - "CDX-NAIGS11V1 - 1209", "CDX.NA.IG.11", - "CDX_NA_IG_S11_01Y_12/09", 2454731, 2455186, 0.014, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAS4", "CDX", 11, "NA IG", null, "IG", 1, 1, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921382", "8963171", - "CDX-NAIGS10V2 - 0611", "CDX.NA.IG.10", - "CDX_NA_IG_S10_03Y_06/11_123/125", 2454547, 2455733, 0.0155, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAP0", "CDX", 10, "NA IG", null, "IG", 2, 3, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921383", "8963174", - "CDX-NAIGS10V2 - 0612", "CDX.NA.IG.10", - "CDX_NA_IG_S10_04Y_06/12_123/125", 2454547, 2456099, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAP0", "CDX", 10, "NA IG", null, "IG", 2, 4, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921384", "8959038", - "CDX-NAIGS11V1 - 1211", "CDX.NA.IG.11", - "CDX_NA_IG_S11_03Y_12/11", 2454731, 2455916, 0.0145, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAS4", "CDX", 11, "NA IG", null, "IG", 1, 3, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921385", "8963222", - "CDX-NAIGS9V2 - 1211", "CDX.NA.IG.9", - "CDX_NA_IG_S9_04Y_12/11_123/125", 2454365, 2455916, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAR6", "CDX", 9, "NA IG", null, "IG", 2, 4, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V2 EUR.5Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921386", "8963229", - "CDX-NAIGS10V2 EUR - 0613", "CDX.NA.IG.10", - "CDX_NA_IG_S10_05Y_06/13_EUR_123/125", 2454547, 2456464, 0.0155, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYAP0 EUR", "CDX", 10, "NA IG V2 EUR", null, "IG", 2, 5, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921388", "8963217", - "CDX-NAIGS9V2 - 1212", "CDX.NA.IG.9", - "CDX_NA_IG_S9_05Y_12/12_123/125", 2454365, 2456282, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAR6", "CDX", 9, "NA IG", null, "IG", 2, 5, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.2Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921389", "8958991", - "CDX-NAIGS11V1 - 1210", "CDX.NA.IG.11", - "CDX_NA_IG_S11_02Y_12/10", 2454731, 2455551, 0.0145, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAS4", "CDX", 11, "NA IG", null, "IG", 1, 2, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V2 EUR.5Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921390", "8963211", - "CDX-NAIGS9V2 EUR - 1212", "CDX.NA.IG.9", - "CDX_NA_IG_S9_05Y_12/12_EUR_123/125", 2454365, 2456282, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYAR6 EUR", "CDX", 9, "NA IG V2 EUR", null, "IG", 2, 5, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921391", "8959044", - "CDX-NAIGS11V1 - 1212", "CDX.NA.IG.11", - "CDX_NA_IG_S11_04Y_12/12", 2454731, 2456282, 0.014, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAS4", "CDX", 11, "NA IG", null, "IG", 1, 4, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921392", "8959264", - "CDX-NAIGS11V1 - 1213", "CDX.NA.IG.11", - "CDX_NA_IG_S11_05Y_12/13", 2454731, 2456647, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAS4", "CDX", 11, "NA IG", null, "IG", 1, 5, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V1 EUR.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921397", "8959266", - "CDX-NAIGS11V1 EUR - 1213", "CDX.NA.IG.11", - "CDX_NA_IG_S11_05Y_12/13_EUR", 2454731, 2456647, 0.015000000000000001, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYAS4 EUR", "CDX", 11, "NA IG V1 EUR", null, "IG", 1, 5, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921398", "8959267", - "CDX-NAIGS11V1 - 1215", "CDX.NA.IG.11", - "CDX_NA_IG_S11_07Y_12/15", 2454731, 2457377, 0.0145, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAS4", "CDX", 11, "NA IG", null, "IG", 1, 7, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921399", "8963208", - "CDX-NAIGS9V2 - 1214", "CDX.NA.IG.9", - "CDX_NA_IG_S9_07Y_12/14_123/125", 2454365, 2457012, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAR6", "CDX", 9, "NA IG", null, "IG", 2, 7, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921400", "8963206", - "CDX-NAIGS9V2 - 1217", "CDX.NA.IG.9", - "CDX_NA_IG_S9_10Y_12/17_123/125", 2454365, 2458108, 0.008, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAR6", "CDX", 9, "NA IG", null, "IG", 2, 10, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921402", "8963201", - "CDX-NAIGFINS9V2 - 1212", "CDX.NA.IG.FIN.9", - "CDX_NA_IG_S9_FIN_12/12_23/25", 2454365, 2456282, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65B2AU9", "CDX", 9, "NA IG FIN", null, "IG", 2, 5, - null, 0.92, 25, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921403", "8963233", - "CDX-NAIGS10V2 - 0615", "CDX.NA.IG.10", - "CDX_NA_IG_S10_07Y_06/15_123/125", 2454547, 2457194, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAP0", "CDX", 10, "NA IG", null, "IG", 2, 7, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921404", "8963242", - "CDX-NAIGS10V2 - 0618", "CDX.NA.IG.10", - "CDX_NA_IG_S10_10Y_06/18_123/125", 2454547, 2458290, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAP0", "CDX", 10, "NA IG", null, "IG", 2, 10, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V2 ALLPTS.5Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921405", "8963204", - "CDX-NAIGS9V2 ALLPTS - 1212", "Dow Jones CDX.NA.IG.5.ALLPTS", - "CDX_NA_IG_S9_ALLPTS_123/125", 2454365, 2456282, 0.008, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAR6 ALLPTS", "CDX", 9, "NA IG V2 ALLPTS", null, "IG", 2, 5, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921406", "8963248", - "CDX-NAIGFINS10V2 - 0613", "CDX.NA.IG.FIN.10", - "CDX_NA_IG_S10_FIN_06/13_22/24", 2454547, 2456464, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65B2AS4", "CDX", 10, "NA IG FIN", null, "IG", 2, 5, - null, 0.91666, 24, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.1Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921407", "8963260", - "CDX-NAIGS9V2 - 1208", "CDX.NA.IG.9", - "CDX_NA_IG_S9_01Y_12/08_123/125", 2454365, 2454821, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAR6", "CDX", 9, "NA IG", null, "IG", 2, 1, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.2Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921408", "8963266", - "CDX-NAIGS9V2 - 1209", "CDX.NA.IG.9", - "CDX_NA_IG_S9_02Y_12/09_123/125", 2454365, 2455186, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAR6", "CDX", 9, "NA IG", null, "IG", 2, 2, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921409", "8963272", - "CDX-NAIGS9V2 - 1210", "CDX.NA.IG.9", - "CDX_NA_IG_S9_03Y_12/10_123/125", 2454365, 2455551, 0.0045000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAR6", "CDX", 9, "NA IG", null, "IG", 2, 3, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.3.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921413", "8962996", - "CDX-NAHYHBS3V5 - 1209", "Dow Jones CDX.NA.HY.HB.3", - "DJCDX_NA_HY_S3_HB__SWP_26/30", 2453196, 2455186, 0.0625, "USD", - "ACT/360", false, 0.3, 4, "2I65BWBC2", "CDX", 3, "NA HY HB", null, "HY", 5, 5, - null, 0.8665, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.5.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921414", "8962999", - "CDX-NAHYS5V6 - 1215", "Dow Jones CDX.NA.HY.5", - "DJCDX_NA_HY_S5_100_SWP_10Y_12/15_95/100", 2453651, 2457377, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBT6", "CDX", 5, "NA HY", null, "HY", 6, 10, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet12() - { - UpdateCDXRefDataMap ("CDX.NA HY.7Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921415", "8963000", - "CDX-NAHYS7V3 - 1213", "Dow Jones CDX.NA.HY.7", - "DJCDX_NA_HY_S7_100_SWP_07YR_98/100", 2454007, 2456647, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBP4", "CDX", 7, "NA HY", null, "HY", 3, 7, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921418", "8962959", - "CDX-NAHYS8V3 - 0612", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_98/100", 2454188, 2456099, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBK5", "CDX", 8, "NA HY", null, "HY", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921419", "8962994", - "CDX-NAHYS7V3 - 1209", "Dow Jones CDX.NA.HY.7", - "DJCDX_NA_HY_S7_100_SWP_03YR_98/100", 2454007, 2455186, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBP4", "CDX", 7, "NA HY", null, "HY", 3, 3, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921421", "8963021", - "CDX-NAHYHBS7V3 - 1211", "Dow Jones CDX.NA.HY.HB.7", - "DJCDX_NA_HY_S7_HB_SWP_28/30", 2454007, 2455916, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWBB4", "CDX", 7, "NA HY HB", null, "HY", 3, 5, - null, 0.9333400000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921422", "8963020", - "CDX-NAHYHBS6V3 - 1210", "Dow Jones CDX.NA.HY.HB.6", - "DJCDX_NA_HY_S6_HB_SWP_28/30", 2453823, 2455551, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWBA6", "CDX", 6, "NA HY HB", null, "HY", 3, 5, - null, 0.93333, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921423", "8963001", - "CDX-NAHYS9V3 - 1214", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_07YR_98/100", 2454372, 2457012, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBL3", "CDX", 9, "NA HY", null, "HY", 3, 7, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921424", "8962960", - "CDX-NAHYS9V3 - 1212", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_98/100", 2454372, 2456282, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBL3", "CDX", 9, "NA HY", null, "HY", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.5.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921425", "8963017", - "CDX-NAHYHBS5V6 - 1210", "Dow Jones CDX.NA.HY.HB.5", - "DJCDX_NA_HY_S5_HB_SWP_25/30", 2453651, 2455551, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWBD0", "CDX", 5, "NA HY HB", null, "HY", 6, 5, - null, 0.8331999999999999, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.3.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921426", "8962972", - "CDX-NAHYS3V7 - 1209", "Dow Jones CDX.NA.HY.3", - "DJCDX_NA_HY_S3_100_SWP_95/100", 2453196, 2455186, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBN9", "CDX", 3, "NA HY", null, "HY", 7, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.5.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921427", "8963013", - "CDX-NAHYS5V6 - 1212", "Dow Jones CDX.NA.HY.5", - "DJCDX_NA_HY_S5_100_SWP_07Y_12/12_95/100", 2453651, 2456282, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBT6", "CDX", 5, "NA HY", null, "HY", 6, 7, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.4.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921428", "8963005", - "CDX-NAHYHBS4V6 - 0610", "Dow Jones CDX.NA.HY.HB.4", - "DJCDX_NA_HY_S4_HB__SWP_25/30", 2453475, 2455368, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWAY5", "CDX", 4, "NA HY HB", null, "HY", 6, 5, - null, 0.8331999999999999, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.4.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921430", "8962977", - "CDX-NAHYS4V7 - 0610", "Dow Jones CDX.NA.HY.4", - "DJCDX_NA_HY_S4_100_SWP_94/100", 2453475, 2455368, 0.036000000000000004, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBS8", "CDX", 4, "NA HY", null, "HY", 7, 5, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921431", "8962979", - "CDX-NAHYS7V3 - 1211", "Dow Jones CDX.NA.HY.7", - "DJCDX_NA_HY_S7_100_SWP_98/100", 2454007, 2455916, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBP4", "CDX", 7, "NA HY", null, "HY", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921432", "8963007", - "CDX-NAHYS7V3 - 1216", "Dow Jones CDX.NA.HY.7", - "DJCDX_NA_HY_S7_100_SWP_10YR_98/100", 2454007, 2457743, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBP4", "CDX", 7, "NA HY", null, "HY", 3, 10, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.6.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921433", "8963009", - "CDX-NAHYS6V4 - 0613", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP_07YR_97/100", 2453823, 2456464, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBO7", "CDX", 6, "NA HY", null, "HY", 4, 7, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.2.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921434", "8962973", - "CDX-NAHYBBS2V3 - 0909", "Dow Jones CDX.NA.HY.BB.2", - "DJCDX_NA_HY_S2_BB__SWP_40/42", 2453088, 2455095, 0.029, "USD", - "ACT/360", false, 0.3, 4, "2I65BVAT8", "CDX", 2, "NA HY BB", null, "HY", 3, 5, - null, 0.95238, 42, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921436", "8962981", - "CDX-NAHYS9V3 - 1210", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_03YR_98/100", 2454372, 2455551, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBL3", "CDX", 9, "NA HY", null, "HY", 3, 3, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921437", "8962976", - "CDX-NAHYS8V3 - 0617", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_10YR_98/100", 2454188, 2457925, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBK5", "CDX", 8, "NA HY", null, "HY", 3, 10, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.5.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921439", "8962982", - "CDX-NAHYS5V6 - 1210", "Dow Jones CDX.NA.HY.5", - "DJCDX_NA_HY_S5_100_SWP_95/100", 2453651, 2455551, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBT6", "CDX", 5, "NA HY", null, "HY", 6, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921440", "8962984", - "CDX-NAHYS8V3 - 0610", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_03YR_98/100", 2454188, 2455368, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBK5", "CDX", 8, "NA HY", null, "HY", 3, 3, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.6.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921441", "8962990", - "CDX-NAHYS6V4 - 0616", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP_10YR_97/100", 2453823, 2457560, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBO7", "CDX", 6, "NA HY", null, "HY", 4, 10, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.6.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921442", "8962987", - "CDX-NAHYS6V4 - 0611", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP_97/100", 2453823, 2455733, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBO7", "CDX", 6, "NA HY", null, "HY", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921443", "8962993", - "CDX-NAHYS8V3 - 0614", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_07YR_98/100", 2454188, 2456829, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBK5", "CDX", 8, "NA HY", null, "HY", 3, 7, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.3.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921447", "8962963", - "CDX-NAHYBBS3V3 - 1209", "Dow Jones CDX.NA.HY.BB.3", - "DJCDX_NA_HY_S3_BB__SWP_41/43", 2453196, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.3, 4, "2I65BVAU5", "CDX", 3, "NA HY BB", null, "HY", 3, 5, - null, 0.9534900000000001, 43, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921449", "8962989", - "CDX-NAHYS9V3 - 1217", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_10YR_98/100", 2454372, 2458108, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBL3", "CDX", 9, "NA HY", null, "HY", 3, 10, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BV8 FXD 29/36.5Y.11.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921454", "8958850", - "CDX-NAHYBS11V6 FXD 31/36 - 1213", "CDX.NA.HY.B.11", - "CDX_NA_HY_S11_B___FXD_31/36", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BSEU8 FXD", "CDX", 11, "NA HY BV8 FXD 29/36", null, "HY", 8, 5, - null, 0.80557, 36, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HBV16 FXD 18/30.5Y.11.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921455", "8958869", - "CDX-NAHYHBS11V15 FXD 19/30 - 1213", "CDX.NA.HY.HB.11", - "CDX_NA_HY_S11_HB__FXD_19/30", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BWFC8 FXD", "CDX", 11, "NA HY HBV16 FXD 18/30", null, "HY", 16, 5, - null, 0.60001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921456", "8958871", - "CDX-NAHYHBS11V1 - 1213", "CDX.NA.HY.HB.11", - "CDX_NA_HY_S11_HB__SWP", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWBE8", "CDX", 11, "NA HY HB", null, "HY", 1, 5, - null, 1, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921457", "8959404", - "CDX-NAIGS11V1 - 1218", "CDX.NA.IG.11", - "CDX_NA_IG_S11_10Y_12/18", 2454731, 2458473, 0.014, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAS4", "CDX", 11, "NA IG", null, "IG", 1, 10, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG CONS.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921458", "8959406", - "CDX-NAIGCONSS11V1 - 0613", "CDX.NA.IG.CONS.11", - "CDX_NA_IG_S11_CONS_12/13", 2454731, 2456464, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65B0AM1", "CDX", 11, "NA IG CONS", null, "IG", 1, 5, - null, 1, 40, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG ENRG.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921459", "8957925", - "CDX-NAIGENRGS11V1 - 1213", "CDX.NA.IG.ENRG.11", - "CDX_NA_IG_S11_ENRG_12/13", 2454731, 2456647, 0.003, "USD", - "ACT/360", false, 0.4, 4, "2I65B1AM9", "CDX", 11, "NA IG ENRG", null, "IG", 1, 5, - null, 1, 15, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921460", "8960334", - "CDX-NAIGFINS11V1 - 1213", "CDX.NA.IG.FIN.11", - "CDX_NA_IG_S11_FIN_12/13", 2454731, 2456647, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65B2AM7", "CDX", 11, "NA IG FIN", null, "IG", 1, 5, - null, 1, 21, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXOV1 EUR.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921461", "8959538", - "CDX-NAXOS11V1 EUR - 1213", "CDX.NA.XO.11", - "CDX NA XO S11 05YR 12/13 EUR", 2454731, 2456647, 0.034, "EUR", - "ACT/360", false, 0.4, 4, "1D764IAO5 EUR", "CDX", 11, "NAXOV1 EUR", null, "XO", 1, 5, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.1Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921462", "8957931", - "CDX-NAIGHVOLS11V1 - 1209", "CDX.NA.IG.HVOL.11", - "CDX_NA_IG_S11_HVOL_01Y_12/09", 2454731, 2455186, 0.04, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AP8", "CDX", 11, "NA IG HVOL", null, "HV", 1, 1, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.2Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921463", "8957933", - "CDX-NAIGHVOLS11V1 - 1210", "CDX.NA.IG.HVOL.11", - "CDX_NA_IG_S11_HVOL_02Y_12/10", 2454731, 2455551, 0.04, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AP8", "CDX", 11, "NA IG HVOL", null, "HV", 1, 2, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.3Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921464", "8957937", - "CDX-NAIGHVOLS11V1 - 1211", "CDX.NA.IG.HVOL.11", - "CDX_NA_IG_S11_HVOL_03Y_12/11", 2454731, 2455916, 0.04, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AP8", "CDX", 11, "NA IG HVOL", null, "HV", 1, 3, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.10Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921465", "8959528", - "CDX-NAXOS11V1 - 1218", "CDX.NA.XO.11", - "CDX_NA_XO_S11_10YR_12/18", 2454731, 2458473, 0.034, "USD", - "ACT/360", false, 0.4, 4, "1D764IAO5", "CDX", 11, "NAXO", null, "XO", 1, 10, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.4Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921466", "8958071", - "CDX-NAIGHVOLS11V1 - 1212", "CDX.NA.IG.HVOL.11", - "CDX_NA_IG_S11_HVOL_04Y_12/12", 2454731, 2456282, 0.04, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AP8", "CDX", 11, "NA IG HVOL", null, "HV", 1, 4, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921467", "8958081", - "CDX-NAIGHVOLS11V1 - 1213", "CDX.NA.IG.HVOL.11", - "CDX_NA_IG_S11_HVOL_05Y_12/13", 2454731, 2456647, 0.0385, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AP8", "CDX", 11, "NA IG HVOL", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.7Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921468", "8959524", - "CDX-NAXOS11V1 - 1215", "CDX.NA.XO.11", - "CDX_NA_XO_S11_07YR_12/15", 2454731, 2457377, 0.034, "USD", - "ACT/360", false, 0.4, 4, "1D764IAO5", "CDX", 11, "NAXO", null, "XO", 1, 7, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.7Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921469", "8958088", - "CDX-NAIGHVOLS11V1 - 1215", "CDX.NA.IG.HVOL.11", - "CDX_NA_IG_S11_HVOL_07Y_12/15", 2454731, 2457377, 0.036000000000000004, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AP8", "CDX", 11, "NA IG HVOL", null, "HV", 1, 7, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921470", "8959517", - "CDX-NAXOS11V1 - 1213", "CDX.NA.XO.11", - "CDX_NA_XO_S11_05YR_12/13", 2454731, 2456647, 0.034, "USD", - "ACT/360", false, 0.4, 4, "1D764IAO5", "CDX", 11, "NAXO", null, "XO", 1, 5, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.10Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921471", "8958093", - "CDX-NAIGHVOLS11V1 - 1218", "CDX.NA.IG.HVOL.11", - "CDX_NA_IG_S11_HVOL_10Y_12/18", 2454731, 2458473, 0.035, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AP8", "CDX", 11, "NA IG HVOL", null, "HV", 1, 10, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.3Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921472", "8959513", - "CDX-NAXOS11V1 - 1211", "CDX.NA.XO.11", - "CDX_NA_XO_S11_03YR_12/11", 2454731, 2455916, 0.034, "USD", - "ACT/360", false, 0.4, 4, "1D764IAO5", "CDX", 11, "NAXO", null, "XO", 1, 3, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG INDU.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921473", "8959501", - "CDX-NAIGINDUS11V1 - 1213", "CDX.NA.IG.INDU.11", - "CDX_NA_IG_S11_INDU_12/13", 2454731, 2456647, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65B4AP6", "CDX", 11, "NA IG INDU", null, "IG", 1, 5, - null, 1, 26, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOLV1 EUR.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921474", "8959544", - "CDX-NAIGHVOLS11V1 EUR - 1213", "CDX.NA.IG.HVOL.11", - "CDX_NA_IG_S11_HVOL_05Y_12/13 EUR", 2454733, 2456647, 0.0385, "EUR", - "ACT/360", false, 0.4, 4, "2I65B3AP8 EUR", "CDX", 11, "NA IG HVOLV1 EUR", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG TMT.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921476", "8959504", - "CDX-NAIGTMTS11V1 - 1213", "CDX.NA.IG.TMT.11", - "CDX_NA_IG_S11_TMT_12/13", 2454731, 2456647, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65DJAM8", "CDX", 11, "NA IG TMT", null, "IG", 1, 5, - null, 1, 23, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.2.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921479", "8963677", - "CDX-NAHYS2V6 - 0909", "Dow Jones CDX.NA.HY.2", - "DJCDX_NA_HY_S2_100_SWP_94/100", 2453088, 2455095, 0.043000000000000003, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBM1", "CDX", 2, "NA HY", null, "HY", 6, 5, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921481", "8963733", - "CDX-NAHYBS4V2 - 0610", "DOW JONES CDX.NA.HY.B.4", - "DJCDX_NA_HY_S4_B___SWP 39/40", 2453475, 2455368, 0.034, "USD", - "ACT/360", false, 0.3, 4, "2I65BSBF4", "CDX", 4, "NA HY B", null, "HY", 2, 5, - null, 0.975, 40, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.5Y.1.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921484", "8963755", - "DJCDX-NAIGHVOLS1V3 - 0309", "Dow Jones CDX.NA.IG.HVOL.1", - "DJCDX_NA_IG_S1_HIVOL_05Y_29/30", 2452934, 2454913, 0.0125, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AI4", "DJCDX", 1, "NA IG HVOL", null, "HV", 3, 5, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.1Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921489", "8964010", - "CDX-NAIGS8V2 - 0608", "CDX.NA.IG.8", - "CDX_NA_IG_S8_01Y_06/08_123/125", 2454181, 2454638, 0.001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAQ8", "CDX", 8, "NA IG", null, "IG", 2, 1, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.2Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921490", "8964013", - "CDX-NAIGS8V2 - 0609", "CDX.NA.IG.8", - "CDX_NA_IG_S8_02Y_06/09_123/125", 2454181, 2455003, 0.0015, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAQ8", "CDX", 8, "NA IG", null, "IG", 2, 2, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921491", "8964015", - "CDX-NAIGS8V2 - 0610", "CDX.NA.IG.8", - "CDX_NA_IG_S8_03Y_06/10_123/125", 2454181, 2455368, 0.002, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAQ8", "CDX", 8, "NA IG", null, "IG", 2, 3, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921492", "8964018", - "CDX-NAIGS8V2 - 0611", "CDX.NA.IG.8", - "CDX_NA_IG_S8_04Y_06/11_123/125", 2454181, 2455733, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAQ8", "CDX", 8, "NA IG", null, "IG", 2, 4, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921493", "8964020", - "CDX-NAIGS8V2 - 0612", "CDX.NA.IG.8", - "CDX_NA_IG_S8_05Y_06/12_123/125", 2454181, 2456099, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAQ8", "CDX", 8, "NA IG", null, "IG", 2, 5, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V2 EUR.5Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921494", "8964023", - "CDX-NAIGS8V2 EUR - 0612", "CDX.NA.IG.8", - "CDX_NA_IG_S8_05Y_06/12_EUR_123/125", 2454181, 2456099, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYAQ8 EUR", "CDX", 8, "NA IG V2 EUR", null, "IG", 2, 5, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921495", "8964026", - "CDX-NAIGS8V2 - 0614", "CDX.NA.IG.8", - "CDX_NA_IG_S8_07Y_06/14_123/125", 2454181, 2456829, 0.0045000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAQ8", "CDX", 8, "NA IG", null, "IG", 2, 7, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921496", "8964028", - "CDX-NAIGS8V2 - 0617", "CDX.NA.IG.8", - "CDX_NA_IG_S8_10Y_06/17_123/125", 2454181, 2457925, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAQ8", "CDX", 8, "NA IG", null, "IG", 2, 10, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG V25YEUR.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921497", "8963972", - "DJCDX-NAIGS7V2-5YEUR - 1211", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_05Y_12/11_EUR_124/126", 2454000, 2455916, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYBC8 EUR", "DJCDX", 7, "NA IG V25YEUR", null, "IG", 2, 5, - null, 0.9840000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V2 ALLPTS.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921498", "8963981", - "CDX-NAIGS7V2 ALLPTS - 1211", "Dow Jones CDX.NA.IG.7.ALLPTS", - "DJCDX_NA_IG_S7_ALLPTS_124/126", 2454000, 2455916, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBC8 ALLPTS", "CDX", 7, "NA IG V2 ALLPTS", null, "IG", 2, 5, - null, 0.9840000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG FIN.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921499", "8963989", - "DJCDX-NAIGFINS7V2 - 1211", "Dow Jones CDX.NA.IG.FIN.7", - "DJCDX_NA_IG_S7_FIN_12/11_23/25", 2454000, 2455916, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65B2BJ3", "DJCDX", 7, "NA IG FIN", null, "IG", 2, 5, - null, 0.92, 25, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.2Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921500", "8963993", - "DJCDX-NAIGS6V2 - 0608", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_02Y_6/08_125/127", 2453816, 2454638, 0.0015, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBB0", "DJCDX", 6, "NA IG", null, "IG", 2, 2, - null, 0.9840000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.3Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921501", "8964223", - "DJCDX-NAIGS6V2 - 0609", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_03Y_6/09_123/125", 2453816, 2455003, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBB0", "DJCDX", 6, "NA IG", null, "IG", 2, 3, - null, 0.9840000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921502", "8964224", - "CDX-NAIGS6V2 - 0611", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_05Y_6/11_123/125", 2453816, 2455733, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBB0", "CDX", 6, "NA IG", null, "IG", 2, 5, - null, 0.9840000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921503", "8964225", - "CDX-NAIGS6V2 - 0613", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_07Y_6/13_123/125", 2453816, 2456464, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBB0", "CDX", 6, "NA IG", null, "IG", 2, 7, - null, 0.9840000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921504", "8964226", - "CDX-NAIGS6V2 - 0616", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_10Y_6/16_123/125", 2453816, 2457560, 0.006500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBB0", "CDX", 6, "NA IG", null, "IG", 2, 10, - null, 0.9840000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.1.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921506", "8963871", - "CDX-NAIGS1V4 - 0314", "Dow Jones CDX.NA.IG", - "DJCDX_NA_IG_S1_10Y_3/14_122/125", 2452934, 2456737, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAX3", "CDX", 1, "NA IG", null, "IG", 3, 4, - null, 0.976, 124, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.5Y.1.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921507", "8963873", - "DJCDX-NAIGS1V3 - 0309", "Dow Jones CDX.NA.IG Mar 2009", - "DJCDX_NA_IG_S1_5Y_3/09_122/125", 2452934, 2454911, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAX3", "DJCDX", 1, "NA IG", null, "IG", 3, 5, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V2 ALLPTS.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921509", "8963815", - "CDX-NAIGS6V2 ALLPTS - 0611", "Dow Jones CDX.NA.IG.6.ALLPTS", - "DJCDX_NA_IG_S6_ALLPTS_125/127", 2453816, 2455733, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBB0 ALLPTS", "CDX", 6, "NA IG V2 ALLPTS", null, "IG", 2, 5, - null, 0.9840000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V2 ALLPTS.5Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921510", "8963997", - "CDX-NAIGS8V2 ALLPTS - 0612", "CDX.NA.IG.8.ALLPTS", - "CDX_NA_IG_S8_ALLPTS_123/125", 2454181, 2456099, 0.006500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAQ8 ALLPTS", "CDX", 8, "NA IG V2 ALLPTS", null, "IG", 2, 5, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921511", "8964056", - "CDX-NAIGFINS8V2 - 0612", "CDX.NA.IG.FIN.8", - "CDX_NA_IG_S8_FIN_06/12_23/25", 2454181, 2456099, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65B2AT2", "CDX", 8, "NA IG FIN", null, "IG", 2, 5, - null, 0.92, 25, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921512", "8963816", - "CDX-NAIGFINS6V2 - 0611", "Dow Jones CDX.NA.IG.FIN.6", - "DJCDX_NA_IG_S6_FIN_6/11_22/24", 2453816, 2455733, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65B2BI5", "CDX", 6, "NA IG FIN", null, "IG", 2, 5, - null, 0.91666, 24, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.1Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921513", "8963818", - "DJCDX-NAIGS6V2 - 0607", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_01Y_6/07_125/127", 2453816, 2454272, 0.001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBB0", "DJCDX", 6, "NA IG", null, "IG", 2, 1, - null, 0.9840000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.2Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921514", "8964045", - "DJCDX-NAIGS7V2 - 1208", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_02Y_12/08_123/125", 2454000, 2454821, 0.0015, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBC8", "DJCDX", 7, "NA IG", null, "IG", 2, 2, - null, 0.9840000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921515", "8963819", - "CDX-NAIGS6V2 - 0610", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_04Y_6/10_125/127", 2453816, 2455368, 0.003, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBB0", "CDX", 6, "NA IG", null, "IG", 2, 4, - null, 0.9840000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921516", "8964047", - "CDX-NAIGS7V2 - 1213", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_07Y_12/13_123/125", 2454000, 2456647, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBC8", "CDX", 7, "NA IG", null, "IG", 2, 7, - null, 0.9840000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V2 EUR.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921517", "8963820", - "CDX-NAIGS6V2 EUR - 0611", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_05Y_6/11_EUR_123/125", 2453816, 2455733, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYBB0 EUR", "CDX", 6, "NA IG V2 EUR", null, "IG", 2, 5, - null, 0.9840000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921518", "8964049", - "CDX-NAIGS7V2 - 1209", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_03Y_12/09_123/125", 2454000, 2455186, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBC8", "CDX", 7, "NA IG", null, "IG", 2, 3, - null, 0.9840000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921519", "8964050", - "CDX-NAIGS7V2 - 1211", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_05Y_12/11_123/125", 2454000, 2455916, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBC8", "CDX", 7, "NA IG", null, "IG", 2, 5, - null, 0.9840000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921520", "8963821", - "CDX-NAIGFINS5V2 - 1210", "Dow Jones CDX.NA.IG.FIN.5", - "DJCDX_NA_IG_S5_FIN_12/10_22/24", 2453635, 2455551, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65B2BH7", "CDX", 5, "NA IG FIN", null, "IG", 2, 5, - null, 0.91666, 24, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921521", "8964053", - "CDX-NAIGS7V2 - 1216", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_10Y_12/16_123/125", 2454000, 2457743, 0.006500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBC8", "CDX", 7, "NA IG", null, "IG", 2, 10, - null, 0.9840000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.1Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921522", "8963822", - "CDX-NAIGS5V2 - 1206", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_01Y_12/06_125/127", 2453635, 2454090, 0.001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBA2", "CDX", 5, "NA IG", null, "IG", 2, 1, - null, 0.9840000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921523", "8964054", - "CDX-NAIGS7V2 - 1210", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_04Y_12/10_124/126", 2454000, 2455551, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBC8", "CDX", 7, "NA IG", null, "IG", 2, 4, - null, 0.9840000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921524", "8963823", - "CDX-NAIGS5V2 - 1208", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_03Y_12/08_123/125", 2453635, 2454821, 0.003, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBA2", "CDX", 5, "NA IG", null, "IG", 2, 3, - null, 0.9840000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.4Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921525", "8963831", - "DJCDX-NAIGS5V2 - 1209", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_04Y_12/09_125/127", 2453635, 2455186, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBA2", "DJCDX", 5, "NA IG", null, "IG", 2, 4, - null, 0.9840000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921526", "8963825", - "CDX-NAIGS5V2 - 1212", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_07Y_12/12_123/125", 2453635, 2456282, 0.0055000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBA2", "CDX", 5, "NA IG", null, "IG", 2, 7, - null, 0.9840000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V2 ALLPTS.5Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921527", "8963827", - "CDX-NAIGS5V2 ALLPTS - 1210", "Dow Jones CDX.NA.IG.5.ALLPTS", - "DJCDX_NA_IG_S5_ALLPTS_125/127", 2453635, 2455551, 0.001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBA2 ALLPTS", "CDX", 5, "NA IG V2 ALLPTS", null, "IG", 2, 5, - null, 0.9840000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.2Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921528", "8963817", - "DJCDX-NAIGS4V2 - 0607", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_02Y_6/07_125/127", 2453451, 2454272, 0.0015, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAW5", "DJCDX", 4, "NA IG", null, "IG", 2, 2, - null, 0.9840000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921529", "8963830", - "CDX-NAIGS4V2 - 0608", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_03Y_6/08_125/127", 2453451, 2454638, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAW5", "CDX", 4, "NA IG", null, "IG", 2, 3, - null, 0.9840000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.1Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921530", "8963829", - "DJCDX-NAIGS4V2 - 0606", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_01Y_6/06_125/127", 2453451, 2453907, 0.001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAW5", "DJCDX", 4, "NA IG", null, "IG", 2, 1, - null, 0.9840000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.3.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921533", "8963537", - "CDX-NAIGS3V3 - 0315", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_10Y_3/15_122/125", 2453270, 2457102, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAV7", "CDX", 3, "NA IG", null, "IG", 3, 10, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.4Y.3.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921534", "8963540", - "DJCDX-NAIGS3V3 - 0308", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_03Y_3/08_124/127", 2453270, 2454546, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "DJCDX-NAIG3V3", "DJCDX", 3, "NA IG", null, "IG", 3, 4, - null, 0.976, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.4Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921539", "8964580", - "DJCDX-NAIGS4V2 - 0609", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_04Y_6/09_123/125", 2453451, 2455003, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAW5", "DJCDX", 4, "NA IG", null, "IG", 2, 4, - null, 0.9840000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.3Y.2.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921543", "8964602", - "DJCDX-NAIGS2V3 - 0907", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_03Y_9/07_124/127", 2453088, 2454364, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAZ8", "DJCDX", 2, "NA IG", null, "IG", 3, 3, - null, 0.9920000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.2.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921544", "8964605", - "CDX-NAIGS2V4 - 0909", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_V4_05Y_9/09_122/125", 2453088, 2455095, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAZ8", "CDX", 2, "NA IG", null, "IG", 4, 5, - null, 0.976, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.2.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921545", "8964607", - "CDX-NAIGS2V4 - 0914", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_V4_10Y_9/14_124/127", 2453088, 2456921, 0.008, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAZ8", "CDX", 2, "NA IG", null, "IG", 4, 10, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.2.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921546", "8964609", - "CDX-NAIGS2V4 - 0911", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_V4_07Y_9/11_124/127", 2453088, 2455825, 0.006, "USD", - "ACT/360", false, 0.5, 4, "2I65BYAZ8", "CDX", 2, "NA IG", null, "IG", 4, 7, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG FIN.5Y.2.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921547", "8964611", - "DJCDX-NAIGFINS2V3 - 0909", "Dow Jones CDX NA IG FIN.2", - "DOW_JONES_CDX_NA_IG_FIN_S2_05Y_22/24", 2453088, 2455095, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65B2BE4", "DJCDX", 2, "NA IG FIN", null, "IG", 3, 5, - null, 0.91666, 23, 0, "NYC", false, false, true, null, "DJCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet13() - { - UpdateCDXRefDataMap ("CDX.NA IG.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921548", "8964582", - "CDX-NAIGS4V2 - 0610", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_05Y_6/10_123/125", 2453451, 2455368, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAW5", "CDX", 4, "NA IG", null, "IG", 2, 5, - null, 0.9840000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921549", "8964584", - "CDX-NAIGS4V2 - 0612", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_07Y_6/12_123/125", 2453451, 2456099, 0.0055000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAW5", "CDX", 4, "NA IG", null, "IG", 2, 7, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921550", "8964585", - "CDX-NAIGS4V2 - 0615", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_10Y_6/15_123/125", 2453451, 2457194, 0.006500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAW5", "CDX", 4, "NA IG", null, "IG", 2, 10, - null, 0.9840000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921551", "8964589", - "CDX-NAIGFINS4V2 - 0610", "Dow Jones CDX.NA.IG.FIN.4", - "DJCDX_NA_IG_S4_FIN_05Y_6/10_22/24", 2453451, 2455368, 0.004, "USD", - "ACT/360", false, 0.5, 4, "2I65B2BG9", "CDX", 4, "NA IG FIN", null, "IG", 2, 5, - null, 0.91666, 23, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V2 EUR.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921552", "8964591", - "CDX-NAIGS4V2 EUR - 0610", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_05Y_6/10_EUR_123/125", 2453451, 2455368, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYAW5 EUR", "CDX", 4, "NA IG V2 EUR", null, "IG", 2, 5, - null, 0.9840000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921553", "8964593", - "CDX-NAIGFINS3V2 - 0310", "Dow Jones CDX.NA.IG.FIN.3", - "DOW_JONES_CDX_NA_IG_FIN_S3_05Y_22/24", 2453270, 2455276, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65B2BF1", "CDX", 3, "NA IG FIN", null, "IG", 2, 5, - null, 0.91666, 23, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.3.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921554", "8963976", - "CDX-NAIGS3V3 - 0309", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_04Y_3/09_122/125", 2453270, 2454911, 0.0045000000000000005, "USD", - "ACT/360", false, 0.04, 4, "2I65BYAV7", "CDX", 3, "NA IG", null, "IG", 3, 4, - null, 0.976, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG 2.7Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921556", "8963697", - "DJCDX-NAIG2V2 - 0911", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_02Y_9/11_125/127", 2453088, 2455825, 0.006, "USD", - "ACT/360", false, 0.4, 4, "DJCDX-NAIG2V2", "DJCDX", 2, "NA IG 2", null, "IG", 2, 7, - null, 0.9840000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.3.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921558", "8963980", - "CDX-NAIGS3V3 - 0312", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_07Y_3/12_122/125", 2453270, 2456007, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAV7", "CDX", 3, "NA IG", null, "IG", 3, 7, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.3.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921559", "8963986", - "CDX-NAIGS3V3 - 0310", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_05Y_3/10_122/125", 2453270, 2455276, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAV7", "CDX", 3, "NA IG", null, "IG", 3, 5, - null, 0.976, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V3 EUR.5Y.3.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921560", "8963990", - "CDX-NAIGS3V3 EUR - 0310", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_05Y_3/10_122/125_EUR", 2453270, 2455276, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYAV7 EUR", "CDX", 3, "NA IG V3 EUR", null, "IG", 3, 5, - null, 0.976, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V3 ALLPTS.5Y.3.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921564", "8964000", - "CDX-NAIGS3V3 ALLPTS - 0310", "Dow Jones CDX.NA.IG.3.ALLPTS", - "DJCDX_NA_IG_S3_ALLPTS_125/127", 2453270, 2455276, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAV7 ALLPTS", "CDX", 3, "NA IG V3 ALLPTS", null, "IG", 3, 5, - null, 0.976, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921566", "8963824", - "CDX-NAIGS5V2 - 1210", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_05Y_12/10_123/125", 2453635, 2455551, 0.0045000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBA2", "CDX", 5, "NA IG", null, "IG", 2, 5, - null, 0.9840000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921567", "8963826", - "CDX-NAIGS5V2 - 1215", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_10Y_12/15_123/125", 2453635, 2457377, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBA2", "CDX", 5, "NA IG", null, "IG", 2, 10, - null, 0.9840000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921573", "8965001", - "CDX-NAHYBS5V2 - 1210", "Dow Jones CDX.NA.HY.B.5", - "DJCDX_NA_HY_S5_B_SWP 41/42", 2453651, 2455551, 0.034, "USD", - "ACT/360", false, 0.3, 4, "2I65BSBG2", "CDX", 5, "NA HY B", null, "HY", 2, 5, - null, 0.9762000000000001, 42, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("TRACX.NA HY V4HB.5Y.2.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921574", "8964991", - "TRACX-NAHYS2V4-HB - 0309", "Dow Jones TRAC-X NA High Beta Series 2", - "TRACX_NA_HY_S2_V4_HB_SWP_30/33", 2452978, 2454895, 0.061500000000000006, "USD", - "ACT/360", false, 0.4, 4, "TRACX-NAHYS2V4", "TRACX", 2, "NA HY V4HB", null, "HY", 4, 5, - null, 0.9090720000000001, 33, 0, "NYC", false, false, false, null, "Trac-X")); - - UpdateCDXRefDataMap ("TRACXNA. HY V3xCKC.5Y.2.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921575", "8964995", - "TRACXNA-HY-S2V3xCKC - 0309", "Dow Jones Trac-X NA HY S2 March 2009", - "DOW JONES TRAC-X NA HY SER 2 MARCH X CKC NR 99/100", 2452978, 2454911, 0.035, "USD", - "ACT/360", false, 0.4, 4, "TRACXNA-HY-S2V3xCKC", "TRACXNA", 2, "HY V3xCKC", null, "HY", 3, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "Trac-X")); - - UpdateCDXRefDataMap ("TRACXNA. HY TST4.5Y.2.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921576", "8964997", - "TRACXNA-HYTST4-S2V3 - 0309", "Dow Jones Trac-X NA HY S2 HB March 2009", - "TRAC-X NA HIGH YIELD SERIES 2 TRUST 4 FLOAT X CKC NR 32/33", 2452978, 2454911, 0.041, "USD", - "ACT/360", false, 0.4, 4, "TRACXNA-HYTST4-S2V3", "TRACXNA", 2, "HY TST4", null, "IG", 3, 5, - null, 0.969696, 33, 0, "NYC", false, false, true, null, "Trac-X")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.3.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921577", "8964651", - "CDX-NAHYS3V7 - 1214", "Dow Jones CDX.NA.HY.3", - "DJCDX_NA_HY_S3_100_SWP_10Y_12/14_95/100", 2453196, 2457012, 0.0375, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRBN9", "CDX", 3, "NA HY", null, "HY", 7, 10, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA HY V7 AllPts.5Y.3.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921578", "8965008", - "DJCDX-NAHYS3V7 AllPts - 1209", "Dow Jones CDX.NA.HY.3", - "DJCDX_NA_HY_S3-ALL PTS_95/100", 2453196, 2455186, 0, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBN9 ALLPTS", "DJCDX", 3, "NA HY V7 AllPts", null, "HY", 7, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V7 ALLPTS.5Y.4.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921579", "8965009", - "CDX-NAHYS4V7 ALLPTS - 0610", "Dow Jones CDX.NA.HY.4.ALLPTS", - "DJCDX_NA_HY_S4-ALL PTS_94/100", 2453475, 2455368, 0, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBS8 ALLPTS", "CDX", 4, "NA HY V7 ALLPTS", null, "HY", 7, 5, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.6.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921580", "8965014", - "CDX-NAHYS6V4 - 0612", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP_06YR_97/100", 2453823, 2456099, 0.0345, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBO7", "CDX", 6, "NA HY", null, "HY", 4, 6, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V6 ALLPTS.5Y.5.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921581", "8965020", - "CDX-NAHYS5V6 ALLPTS - 1210", "Dow Jones CDX.NA.HY.5.ALLPTS", - "DJCDX_NA_HY_S5_ALLPTS_95/100", 2453651, 2455551, 0, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBT6 ALLPTS", "CDX", 5, "NA HY V6 ALLPTS", null, "HY", 6, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V4 ALLPTS.5Y.6.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921582", "8965021", - "CDX-NAHYS6V4 ALLPTS - 0611", "Dow Jones CDX.NA.HY.6.ALLPTS", - "DJCDX_NA_HY_S6_ALLPTS_97/100", 2453823, 2455733, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBO7 ALLPTS", "CDX", 6, "NA HY V4 ALLPTS", null, "HY", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.6.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921583", "8965006", - "CDX-NAHYS6V4 - 0610", "Dow Jones CDX.NA.HY.6", - "DJCDX_NA_HY_S6_100_SWP_04YR_97/100", 2453823, 2455368, 0.0345, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBO7", "CDX", 6, "NA HY", null, "HY", 4, 4, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921584", "8964685", - "CDX-NAHYHBS8V3 - 0612", "CDX.NA.HY.HB.8", - "CDX_NA_HY_S08_HB__SWP_28/30", 2454188, 2456099, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BWAX7", "CDX", 8, "NA HY HB", null, "HY", 3, 5, - null, 0.9333400000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921585", "8965132", - "CDX-NAHYS8V3 - 0609", "Dow Jones CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_02YR_98/100", 2454188, 2455003, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBK5", "CDX", 8, "NA HY", null, "HY", 3, 2, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921586", "8965319", - "CDX-NAHYS8V3 - 0611", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_04YR_98/100", 2454188, 2455733, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBK5", "CDX", 8, "NA HY", null, "HY", 3, 4, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921587", "8964759", - "CDX-NAHYS9V3 - 1213", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_06YR_98/100", 2454372, 2456647, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBL3", "CDX", 9, "NA HY", null, "HY", 3, 6, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V3 ALLPTS.5Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921588", "8964688", - "CDX-NAHYS8V3 ALLPTS - 0612", "CDX.NA.HY.8.ALLPTS", - "CDX_NA_HY_S08_100_SWP_98/100_ALLPTS", 2454188, 2456099, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBK5 ALLPTS", "CDX", 8, "NA HY V3 ALLPTS", null, "HY", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921589", "8965321", - "CDX-NAHYS9V3 - 1208", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_01YR_98/100", 2454372, 2454821, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBL3", "CDX", 9, "NA HY", null, "HY", 3, 1, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921590", "8965134", - "CDX-NAHYS9V3 - 1209", "Dow Jones CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_02YR_98/100", 2454372, 2455186, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBL3", "CDX", 9, "NA HY", null, "HY", 3, 2, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921591", "8964756", - "CDX-NAHYS9V3 - 1211", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_04YR_98/100", 2454372, 2455916, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBL3", "CDX", 9, "NA HY", null, "HY", 3, 4, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V3 EUR.6Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921592", "8964926", - "CDX-NAIGS8V3 EUR - 0613", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_06YR_98/100", 2454188, 2456464, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAU9 EUR", "CDX", 8, "NA IG V3 EUR", null, "IG", 3, 6, - null, 0.98, 100, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921593", "8965283", - "CDX-NAHYHBS9V3 - 1212", "CDX.NA.HY.HB.9", - "CDX_NA_HY_S09_HB__SWP_28/30", 2454372, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BWAZ2", "CDX", 9, "NA HY HB", null, "HY", 3, 5, - null, 0.9333400000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V3 ALLPTS.5Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921594", "8965039", - "CDX-NAHYS9V3 ALLPTS - 1212", "CDX.NA.HY.9.ALLPTS", - "CDX_NA_HY_S09_100_98/100_ALLPTS", 2454372, 2456282, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBL3 ALLPTS", "CDX", 9, "NA HY V3 ALLPTS", null, "HY", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJTRAC.XNA HB.5Y.2.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921595", "8965010", - "DJTRAC-XNAS2 HBV6 - 0309", "Dow Jones TRACX.NA.HY.HB.2", - "TRACX_NA_HY_S2_HB_SWP_28/33", 2452978, 2454911, 0.045000000000000005, "USD", - "ACT/360", false, 0.3, 4, "DJTRAC-XNAS2 HBV6", "DJTRAC", 2, "XNA HB", null, "HY", 6, 5, - null, 0.8484, 33, 0, "NYC", false, false, false, null, "Trac-X")); - - UpdateCDXRefDataMap ("TRACXNA. HY BB.5Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921600", "8964889", - "TRACXNA-HYBB-S2V2 - 0309", "Dow Jones TRAC-X NA High Yield Series 2 BB March 2009", - "TRACX_NA_HY_S2_BB__SWP 39/40", 2452978, 2454911, 0.022000000000000002, "USD", - "ACT/360", false, 0.4, 4, "TRACXNA-HYBB-S2V2", "TRACXNA", 2, "HY BB", null, "HY", 2, 5, - null, 0.973681, 40, 0, "NYC", false, false, false, null, "Trac-X")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921638", "8971162", - "ITRAXX-LevXS3V1 - 1213", "ITRAXX LEVX SENIOR SERIES 3 VERSION 1", - "ITRAXX LEVX SENIOR SERIES 3 VERSION 1 EUR 1ST SEC RES I03 CDS", 2454739, 2456647, 0.0575, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJBA0", "ITRAXX", 3, "LevX", null, "IG", 1, 5, - null, 1, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevXSub.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921642", "8971163", - "ITRAXX-LevXSubS3V1 - 1213", "ITRAXX LEVX SUBORDINATE SERIES 3 VERSION 1", - "ITRAXX LEVX SUBORDINATE SERIES 3 VERSION 1 EUR 2ND SEC RES I03 CDS", 2454739, 2456647, 0.12000000000000001, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKBA7", "ITRAXX", 3, "LevXSub", null, "IG", 1, 5, - null, 1, 45, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("CDX.NA IG.1Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921643", "8971927", - "CDX-NAIGS10V3 - 0609", "CDX.NA.IG.10", - "CDX_NA_IG_S10_01Y_06/09_122/125", 2454547, 2455003, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAT2", "CDX", 10, "NA IG", null, "IG", 3, 1, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.2Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921644", "8971928", - "CDX-NAIGS10V3 - 0610", "CDX.NA.IG.10", - "CDX_NA_IG_S10_02Y_06/10_122/125", 2454547, 2455368, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAT2", "CDX", 10, "NA IG", null, "IG", 3, 2, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921645", "8971915", - "CDX-NAIGS10V3 - 0611", "CDX.NA.IG.10", - "CDX_NA_IG_S10_03Y_06/11_122/125", 2454547, 2455733, 0.0155, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAT2", "CDX", 10, "NA IG", null, "IG", 3, 3, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921646", "8971924", - "CDX-NAIGS10V3 - 0612", "CDX.NA.IG.10", - "CDX_NA_IG_S10_04Y_06/12_122/125", 2454547, 2456099, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAT2", "CDX", 10, "NA IG", null, "IG", 3, 4, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921647", "8971929", - "CDX-NAIGS10V3 - 0613", "CDX.NA.IG.10", - "CDX_NA_IG_S10_05Y_06/13_122/125", 2454547, 2456464, 0.0155, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAT2", "CDX", 10, "NA IG", null, "IG", 3, 5, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V3 EUR.5Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921648", "8971919", - "CDX-NAIGS10V3 EUR - 0613", "CDX.NA.IG.10", - "CDX_NA_IG_S10_05Y_06/13_EUR_122/125", 2454547, 2456464, 0.0155, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYAT2 EUR", "CDX", 10, "NA IG V3 EUR", null, "IG", 3, 5, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921649", "8971930", - "CDX-NAIGS10V3 - 0615", "CDX.NA.IG.10", - "CDX_NA_IG_S10_07Y_06/15_122/125", 2454547, 2457194, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAT2", "CDX", 10, "NA IG", null, "IG", 3, 7, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921650", "8971920", - "CDX-NAIGS10V3 - 0618", "CDX.NA.IG.10", - "CDX_NA_IG_S10_10Y_06/18_122/125", 2454547, 2458290, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAT2", "CDX", 10, "NA IG", null, "IG", 3, 10, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921651", "8971921", - "CDX-NAIGFINS10V3 - 0613", "CDX.NA.IG.FIN.10", - "CDX_NA_IG_S10_FIN_06/13_21/24", 2454547, 2456464, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65B2BA2", "CDX", 10, "NA IG FIN", null, "IG", 3, 5, - null, 0.875, 24, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.1Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921652", "8972005", - "CDX-NAIGHVOLS10V2 - 0609", "CDX.NA.IG.HVOL.10", - "CDX_NA_IG_S10_HVOL_01Y_06/09_29/30", 2454547, 2455003, 0.035, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BA0", "CDX", 10, "NA IG HVOL", null, "HV", 2, 1, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.3Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921653", "8972009", - "CDX-NAIGHVOLS10V2 - 0611", "CDX.NA.IG.HVOL.10", - "CDX_NA_IG_S10_HVOL_03Y_06/11_29/30", 2454547, 2455733, 0.035, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BA0", "CDX", 10, "NA IG HVOL", null, "HV", 2, 3, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.4Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921654", "8972008", - "CDX-NAIGHVOLS10V2 - 0612", "CDX.NA.IG.HVOL.10", - "CDX_NA_IG_S10_HVOL_04Y_06/12_29/30", 2454547, 2456099, 0.035, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BA0", "CDX", 10, "NA IG HVOL", null, "HV", 2, 4, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921655", "8972007", - "CDX-NAIGHVOLS10V2 - 0613", "CDX.NA.IG.HVOL.10", - "CDX_NA_IG_S10_HVOL_05Y_06/13_29/30", 2454547, 2456464, 0.035, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BA0", "CDX", 10, "NA IG HVOL", null, "HV", 2, 5, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.2Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921656", "8972019", - "CDX-NAIGHVOLS10V2 - 0610", "CDX.NA.IG.HVOL.10", - "CDX_NA_IG_S10_HVOL_02Y_06/10_29/30", 2454547, 2455368, 0.035, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BA0", "CDX", 10, "NA IG HVOL", null, "HV", 2, 2, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.7Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921657", "8972010", - "CDX-NAIGHVOLS10V2 - 0615", "CDX.NA.IG.HVOL.10", - "CDX_NA_IG_S10_HVOL_07Y_06/15_29/30", 2454547, 2457194, 0.035, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BA0", "CDX", 10, "NA IG HVOL", null, "HV", 2, 7, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.10Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921658", "8972011", - "CDX-NAIGHVOLS10V2 - 0618", "CDX.NA.IG.HVOL.10", - "CDX_NA_IG_S10_HVOL_10Y_06/18_29/30", 2454547, 2458290, 0.035, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BA0", "CDX", 10, "NA IG HVOL", null, "HV", 2, 10, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOLV2 EUR.5Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921659", "8972020", - "CDX-NAIGHVOLS10V2 EUR - 0613", "CDX.NA.IG.HVOL.10", - "CDX_NA_IG_S10_HVOL_05Y_06/13 EUR_29/30", 2454547, 2456464, 0.035, "EUR", - "ACT/360", false, 0.4, 4, "2I65B3BA0 EUR", "CDX", 10, "NA IG HVOLV2 EUR", null, "HV", 2, 5, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.4Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921664", "8972742", - "DJCDX-NAIGS5V3 - 1209", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_04Y_12/09_122/125", 2453635, 2455186, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBJ3", "DJCDX", 5, "NA IG", null, "IG", 3, 4, - null, 0.976, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921665", "8972743", - "CDX-NAIGS5V3 - 1210", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_05Y_12/10_122/125", 2453635, 2455551, 0.0045000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBJ3", "CDX", 5, "NA IG", null, "IG", 3, 5, - null, 0.976, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921666", "8972744", - "CDX-NAIGS5V3 - 1212", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_07Y_12/12_122/125", 2453635, 2456282, 0.0055000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBJ3", "CDX", 5, "NA IG", null, "IG", 3, 7, - null, 0.976, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921667", "8972745", - "CDX-NAIGS5V3 - 1215", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_10Y_12/15_122/125", 2453635, 2457377, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBJ3", "CDX", 5, "NA IG", null, "IG", 3, 10, - null, 0.976, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921668", "8972746", - "CDX-NAIGFINS5V3 - 1210", "Dow Jones CDX.NA.IG.FIN.5", - "DJCDX_NA_IG_S5_FIN_12/10_21/24", 2453635, 2455551, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65B2BQ7", "CDX", 5, "NA IG FIN", null, "IG", 3, 5, - null, 0.875, 24, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.1Y.3.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921669", "8972766", - "DJCDX-NAIGS3V4 - 0306", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_01Y_3/06_121/125", 2453270, 2453815, 0.0015, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBH7", "DJCDX", 3, "NA IG", null, "IG", 4, 1, - null, 0.968, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.2Y.3.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921670", "8972767", - "CDX-NAIGS3V4 - 0307", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_02Y_3/07_121/125", 2453270, 2454180, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBH7", "CDX", 3, "NA IG", null, "IG", 4, 2, - null, 0.968, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.3.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921671", "8972769", - "CDX-NAIGS3V4 - 0309", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_04Y_3/09_121/125", 2453270, 2454911, 0.0045000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBH7", "CDX", 3, "NA IG", null, "IG", 4, 4, - null, 0.968, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.2Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921672", "8972748", - "CDX-NAIGS6V3 - 0608", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_02Y_6/08_122/125", 2453816, 2454638, 0.0015, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBK0", "CDX", 6, "NA IG", null, "IG", 3, 2, - null, 0.976, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921673", "8972749", - "CDX-NAIGS6V3 - 0609", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_03Y_6/09_122/125", 2453816, 2455003, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBK0", "CDX", 6, "NA IG", null, "IG", 3, 3, - null, 0.976, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.3.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921674", "8972772", - "CDX-NAIGS3V4 - 0312", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_07Y_3/12_121/125", 2453270, 2456007, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBH7", "CDX", 3, "NA IG", null, "IG", 4, 7, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921675", "8972751", - "CDX-NAIGS6V3 - 0611", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_05Y_6/11_122/125", 2453816, 2455733, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBK0", "CDX", 6, "NA IG", null, "IG", 3, 5, - null, 0.976, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.3.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921676", "8972771", - "CDX-NAIGS3V4 - 0310", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_05Y_3/10_121/125", 2453270, 2455276, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBH7", "CDX", 3, "NA IG", null, "IG", 4, 5, - null, 0.968, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921677", "8972732", - "CDX-NAIGS6V3 - 0613", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_07Y_6/13_122/125", 2453816, 2456464, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBK0", "CDX", 6, "NA IG", null, "IG", 3, 7, - null, 0.976, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921678", "8972752", - "CDX-NAIGS6V3 - 0616", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_10Y_6/16_122/125", 2453816, 2457560, 0.006500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBK0", "CDX", 6, "NA IG", null, "IG", 3, 10, - null, 0.976, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V4 EUR.5Y.3.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921679", "8972770", - "CDX-NAIGS3V4 EUR - 0310", "DOW JONES CDX NAIG S3 3/10 122/125 EUR", - "DJCDX_NA_IG_S3_05Y_3/10_121/125_EUR", 2453270, 2455276, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYBH7 EUR", "CDX", 3, "NA IG V4 EUR", null, "IG", 4, 5, - null, 0.968, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V3 ALLPTS.5Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921680", "8972759", - "CDX-NAIGS6V3 ALLPTS - 0611", "Dow Jones CDX.NA.IG.6.ALLPTS", - "DJCDX_NA_IG_S6_ALLPTS_122/125", 2453816, 2455733, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBK0 ALLPTS", "CDX", 6, "NA IG V3 ALLPTS", null, "IG", 3, 5, - null, 0.976, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V4 ALLPTS.5Y.3.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921681", "8972722", - "CDX-NAIGS3V4 ALLPTS - 0310", "DJ CDX IG 3 ALL POINTS", - "DJCDX_NA_IG_S3_ALLPTS_121/125", 2453270, 2455276, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBH7 ALLPTS", "CDX", 3, "NA IG V4 ALLPTS", null, "IG", 4, 5, - null, 0.968, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.3.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921682", "8972754", - "CDX-NAIGFINS3V3 - 0310", "Dow Jones CDX.NA.IG.FIN.3", - "DOW_JONES_CDX_NA_IG_FIN_S3_05Y_21/24", 2453270, 2455276, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65B2BO2", "CDX", 3, "NA IG FIN", null, "IG", 3, 5, - null, 0.875, 23, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.1Y.4.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921683", "8972733", - "DJCDX-NAIGS4V3 - 0606", "DOW JONES CDX NA IG 4", - "DJCDX_NA_IG_S4_01Y_6/06_122/125", 2453451, 2453907, 0.001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBI5", "DJCDX", 4, "NA IG", null, "IG", 3, 1, - null, 0.976, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.2Y.4.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921684", "8972734", - "CDX-NAIGS4V3 - 0607", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_02Y_6/07_122/125", 2453451, 2454272, 0.0015, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBI5", "CDX", 4, "NA IG", null, "IG", 3, 2, - null, 0.976, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921685", "8972692", - "CDX-NAIGS8V3 - 0617", "CDX.NA.IG.8", - "CDX_NA_IG_S8_10Y_06/17_122/125", 2454181, 2457925, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAU9", "CDX", 8, "NA IG", null, "IG", 3, 10, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V3 ALLPTS.5Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921686", "8972719", - "CDX-NAIGS8V3 ALLPTS - 0612", "CDX.NA.IG.8.ALLPTS", - "CDX_NA_IG_S8_ALLPTS_122/125", 2454181, 2456099, 0.006500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAU9 ALLPTS", "CDX", 8, "NA IG V3 ALLPTS", null, "IG", 3, 5, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921687", "8972700", - "CDX-NAIGFINS8V3 - 0612", "CDX.NA.IG.FIN.8", - "CDX_NA_IG_S8_FIN_06/12_22/25", 2454181, 2456099, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65B2BB0", "CDX", 8, "NA IG FIN", null, "IG", 3, 5, - null, 0.88, 25, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921688", "8972705", - "CDX-NAIGS9V3 - 1211", "CDX.NA.IG.9", - "CDX_NA_IG_S9_04Y_12/11_122/125", 2454365, 2455916, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAY1", "CDX", 9, "NA IG", null, "IG", 3, 4, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921689", "8972706", - "CDX-NAIGS9V3 - 1212", "CDX.NA.IG.9", - "CDX_NA_IG_S9_05Y_12/12_122/125", 2454365, 2456282, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAY1", "CDX", 9, "NA IG", null, "IG", 3, 5, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V3 EUR.5Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921690", "8972707", - "CDX-NAIGS9V3 EUR - 1212", "CDX.NA.IG.9", - "CDX_NA_IG_S9_05Y_12/12_EUR_122/125", 2454365, 2456282, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYAY1 EUR", "CDX", 9, "NA IG V3 EUR", null, "IG", 3, 5, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921691", "8972709", - "CDX-NAIGFINS9V3 - 1212", "CDX.NA.IG.FIN.9", - "CDX_NA_IG_S9_FIN_12/12_22/25", 2454365, 2456282, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65B2BC8", "CDX", 9, "NA IG FIN", null, "IG", 3, 5, - null, 0.88, 25, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V3 ALLPTS.5Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921692", "8972720", - "CDX-NAIGS9V3 ALLPTS - 1212", "CDX NA IG S9 - ALLPTS 122/125", - "CDX_NA_IG_S9_ALLPTS_122/125", 2454365, 2456282, 0.008, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAY1 ALLPTS", "CDX", 9, "NA IG V3 ALLPTS", null, "IG", 3, 5, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921693", "8972701", - "CDX-NAIGS9V3 - 1217", "CDX.NA.IG.9", - "CDX_NA_IG_S9_10Y_12/17_122/125", 2454365, 2458108, 0.008, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAY1", "CDX", 9, "NA IG", null, "IG", 3, 10, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921694", "8972708", - "CDX-NAIGS9V3 - 1214", "CDX.NA.IG.9", - "CDX_NA_IG_S9_07Y_12/14_122/125", 2454365, 2457012, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAY1", "CDX", 9, "NA IG", null, "IG", 3, 7, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.1.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921696", "8972762", - "CDX-NAIGS1V5 - 0314", "Dow Jones CDX.NA.IG", - "DJCDX_NA_IG_S1_10Y_3/14_121/125", 2452934, 2456737, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBF1", "CDX", 1, "NA IG", null, "IG", 5, 10, - null, 0.968, 124, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.1.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921697", "8972761", - "CDX-NAIGS1V5 - 0309", "Dow Jones CDX.NA.IG", - "DJCDX_NA_IG_S1_5Y_3/09_121/125", 2452934, 2454911, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBF1", "CDX", 1, "NA IG", null, "IG", 5, 5, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.1.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921699", "8972755", - "CDX-NAIGFINS1V4 - 0309", "Dow Jones CDX.NA.IG.FIN.1", - "DJCDX_NA_IG_S1_FIN_05Y_3/09_21/24", 2452934, 2454913, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65B2BM6", "CDX", 1, "NA IG FIN", null, "IG", 4, 5, - null, 0.8750100000000001, 23, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.2.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921700", "8972764", - "CDX-NAIGS2V5 - 0911", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_07Y_9/11_121/125", 2453088, 2455825, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBG9", "CDX", 2, "NA IG", null, "IG", 5, 7, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.2.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921701", "8972765", - "CDX-NAIGS2V5 - 0914", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_10Y_9/14_121/125", 2453088, 2456921, 0.008, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBG9", "CDX", 2, "NA IG", null, "IG", 5, 10, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.2.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921702", "8972763", - "CDX-NAIGS2V5 - 0909", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_05Y_9/09_121/125", 2453088, 2455095, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBG9", "CDX", 2, "NA IG", null, "IG", 5, 5, - null, 0.968, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.2.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921703", "8972718", - "CDX-NAIGFINS2V4 - 0909", "Dow Jones CDX NA IG FIN.2", - "DOW_JONES_CDX_NA_IG_FIN_S2_05Y_21/24", 2453088, 2455095, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65B2BN4", "CDX", 2, "NA IG FIN", null, "IG", 4, 5, - null, 0.875, 23, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.1Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921704", "8972702", - "CDX-NAIGS9V3 - 1208", "CDX.NA.IG.9", - "CDX_NA_IG_S9_01Y_12/08_122/125", 2454365, 2454821, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAY1", "CDX", 9, "NA IG", null, "IG", 3, 1, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet14() - { - UpdateCDXRefDataMap ("CDX.NA IG.2Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921705", "8972703", - "CDX-NAIGS9V3 - 1209", "CDX.NA.IG.9", - "CDX_NA_IG_S9_02Y_12/09_122/125", 2454365, 2455186, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAY1", "CDX", 9, "NA IG", null, "IG", 3, 2, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921706", "8972704", - "CDX-NAIGS9V3 - 1210", "CDX.NA.IG.9", - "CDX_NA_IG_S9_03Y_12/10_122/125", 2454365, 2455551, 0.0045000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAY1", "CDX", 9, "NA IG", null, "IG", 3, 3, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.1Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921707", "8972710", - "CDX-NAIGHVOLS9V2 - 1208", "CDX.NA.IG.HVOL.9", - "CDX_NA_IG_S9_HVOL_01Y_12/08_29/30", 2454365, 2454821, 0.0105, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BB8", "CDX", 9, "NA IG HVOL", null, "HV", 2, 1, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.2Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921708", "8972711", - "CDX-NAIGHVOLS9V2 - 1209", "CDX.NA.IG.HVOL.9", - "CDX_NA_IG_S9_HVOL_02Y_12/09_29/30", 2454365, 2455186, 0.0115, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BB8", "CDX", 9, "NA IG HVOL", null, "HV", 2, 2, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.3.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921709", "8972773", - "CDX-NAIGS3V4 - 0315", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_10Y_3/15_121/125", 2453270, 2457102, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBH7", "CDX", 3, "NA IG", null, "IG", 4, 10, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.3Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921710", "8972712", - "CDX-NAIGHVOLS9V2 - 1210", "CDX.NA.IG.HVOL.9", - "CDX_NA_IG_S9_HVOL_03Y_12/10_29/30", 2454365, 2455551, 0.0125, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BB8", "CDX", 9, "NA IG HVOL", null, "HV", 2, 3, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.4Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921711", "8972713", - "CDX-NAIGHVOLS9V2 - 1211", "CDX.NA.IG.HVOL.9", - "CDX_NA_IG_S9_HVOL_04Y_12/11_29/30", 2454365, 2455916, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BB8", "CDX", 9, "NA IG HVOL", null, "HV", 2, 4, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921712", "8972714", - "CDX-NAIGHVOLS9V2 - 1212", "CDX.NA.IG.HVOL.9", - "CDX_NA_IG_S9_HVOL_05Y_12/12_29/30", 2454365, 2456282, 0.014, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BB8", "CDX", 9, "NA IG HVOL", null, "HV", 2, 5, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG.3Y.3.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921713", "8972768", - "DJCDX-NAIGS3V4 - 0308", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_03Y_3/08_121/125", 2453270, 2454546, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBH7", "DJCDX", 3, "NA IG", null, "IG", 4, 3, - null, 0.968, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.7Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921714", "8972715", - "CDX-NAIGHVOLS9V2 - 1214", "CDX.NA.IG.HVOL.9", - "CDX_NA_IG_S9_HVOL_07Y_12/14_29/30", 2454365, 2457012, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BB8", "CDX", 9, "NA IG HVOL", null, "HV", 2, 7, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.10Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921715", "8972716", - "CDX-NAIGHVOLS9V2 - 1217", "CDX.NA.IG.HVOL.9", - "CDX_NA_IG_S9_HVOL_10Y_12/17_29/30", 2454365, 2458108, 0.016, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BB8", "CDX", 9, "NA IG HVOL", null, "HV", 2, 10, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOLV2 ALLPTS.5Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921716", "8972721", - "CDX-NAIGHVOLS9V2 ALLPTS - 1212", "CDX.NA.IG.HVOL.9.ALLPTS", - "CDX_NA_IG_S9_HVOL_ALLPTS_29/30", 2454365, 2456282, 0.016, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BB8 ALLPTS", "CDX", 9, "NA IG HVOLV2 ALLPTS", null, "HV", 2, 5, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOLV2 EUR.5Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921717", "8972717", - "CDX-NAIGHVOLS9V2 EUR - 1212", "CDX.NA.IG.HVOL.9", - "CDX_NA_IG_S9_HVOL_05Y_12/12 EUR_29/30", 2454365, 2456282, 0.014, "EUR", - "ACT/360", false, 0.4, 4, "2I65B3BB8 EUR", "CDX", 9, "NA IG HVOLV2 EUR", null, "HV", 2, 5, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V3 ALLPTS.5Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921718", "8972731", - "CDX-NAIGS7V3 ALLPTS - 1211", "Dow Jones CDX.NA.IG.7.ALLPTS", - "DJCDX_NA_IG_S7_ALLPTS_122/125", 2454000, 2455916, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBL8 ALLPTS", "CDX", 7, "NA IG V3 ALLPTS", null, "IG", 3, 5, - null, 0.976, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.2Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921719", "8972723", - "CDX-NAIGS7V3 - 1208", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_02Y_12/08_122/125", 2454000, 2454821, 0.0015, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBL8", "CDX", 7, "NA IG", null, "IG", 3, 2, - null, 0.976, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921720", "8972728", - "CDX-NAIGS7V3 - 1213", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_07Y_12/13_122/125", 2454000, 2456647, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBL8", "CDX", 7, "NA IG", null, "IG", 3, 7, - null, 0.976, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.1Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921721", "8972693", - "CDX-NAIGS8V3 - 0608", "CDX.NA.IG.8", - "CDX_NA_IG_S8_01Y_06/08_122/125", 2454181, 2454638, 0.001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAU9", "CDX", 8, "NA IG", null, "IG", 3, 1, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.2Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921722", "8972694", - "CDX-NAIGS8V3 - 0609", "CDX.NA.IG.8", - "CDX_NA_IG_S8_02Y_06/09_122/125", 2454181, 2455003, 0.0015, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAU9", "CDX", 8, "NA IG", null, "IG", 3, 2, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921723", "8972695", - "CDX-NAIGS8V3 - 0610", "CDX.NA.IG.8", - "CDX_NA_IG_S8_03Y_06/10_122/125", 2454181, 2455368, 0.002, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAU9", "CDX", 8, "NA IG", null, "IG", 3, 3, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921724", "8972696", - "CDX-NAIGS8V3 - 0611", "CDX.NA.IG.8", - "CDX_NA_IG_S8_04Y_06/11_122/125", 2454181, 2455733, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAU9", "CDX", 8, "NA IG", null, "IG", 3, 4, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921725", "8972697", - "CDX-NAIGS8V3 - 0612", "CDX.NA.IG.8", - "CDX_NA_IG_S8_05Y_06/12_122/125", 2454181, 2456099, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAU9", "CDX", 8, "NA IG", null, "IG", 3, 5, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V3 EUR.5Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921726", "8972698", - "CDX-NAIGS8V3 EUR - 0612", "CDX.NA.IG.8", - "CDX_NA_IG_S8_05Y_06/12_EUR_122/125", 2454181, 2456099, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYAU9", "CDX", 8, "NA IG V3 EUR", null, "IG", 3, 5, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921727", "8972699", - "CDX-NAIGS8V3 - 0614", "CDX.NA.IG.8", - "CDX_NA_IG_S8_07Y_06/14_122/125", 2454181, 2456829, 0.0045000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYAU9", "CDX", 8, "NA IG", null, "IG", 3, 7, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.4.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921728", "8972735", - "CDX-NAIGS4V3 - 0608", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_03Y_6/08_122/125", 2453451, 2454638, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBI5", "CDX", 4, "NA IG", null, "IG", 3, 3, - null, 0.976, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.4.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921729", "8972736", - "CDX-NAIGS4V3 - 0609", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_04Y_6/09_122/125", 2453451, 2455003, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBI5", "CDX", 4, "NA IG", null, "IG", 3, 4, - null, 0.976, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.4.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921730", "8972737", - "CDX-NAIGS4V3 - 0610", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_05Y_6/10_122/125", 2453451, 2455368, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBI5", "CDX", 4, "NA IG", null, "IG", 3, 5, - null, 0.976, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.4.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921731", "8972738", - "CDX-NAIGS4V3 - 0612", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_07Y_6/12_122/125", 2453451, 2456099, 0.0055000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBI5", "CDX", 4, "NA IG", null, "IG", 3, 7, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.4.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921732", "8972739", - "CDX-NAIGS4V3 - 0615", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_10Y_6/15_122/125", 2453451, 2457194, 0.006500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBI5", "CDX", 4, "NA IG", null, "IG", 3, 10, - null, 0.976, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.4.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921733", "8972756", - "CDX-NAIGFINS4V3 - 0610", "DOW JONES CDX NA IG FIN 4 06/10", - "DJCDX_NA_IG_S4_FIN_05Y_6/10_21/24", 2453451, 2455368, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65B2BP9", "CDX", 4, "NA IG FIN", null, "IG", 3, 5, - null, 0.875, 23, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V3 EUR.5Y.4.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921734", "8972757", - "CDX-NAIGS4V3 EUR - 0610", "DOW JONES CDX NA IG S4 06/10 EUR", - "DJCDX_NA_IG_S4_05Y_6/10_EUR_122/125", 2453451, 2455368, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYBI5 EUR", "CDX", 4, "NA IG V3 EUR", null, "IG", 3, 5, - null, 0.976, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.1Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921735", "8972740", - "CDX-NAIGS5V3 - 1206", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_01Y_12/06_122/125", 2453635, 2454090, 0.001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBJ3", "CDX", 5, "NA IG", null, "IG", 3, 1, - null, 0.976, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921736", "8972753", - "CDX-NAIGFINS6V3 - 0611", "Dow Jones CDX.NA.IG.FIN.6", - "DJCDX_NA_IG_S6_FIN_6/11_21/24", 2453816, 2455733, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65B2BR5", "CDX", 6, "NA IG FIN", null, "IG", 3, 5, - null, 0.875, 24, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.1Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921737", "8972747", - "CDX-NAIGS6V3 - 0607", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_01Y_6/07_122/125", 2453816, 2454272, 0.001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBK0", "CDX", 6, "NA IG", null, "IG", 3, 1, - null, 0.976, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V3 ALLPTS.5Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921738", "8972758", - "CDX-NAIGS5V3 ALLPTS - 1210", "Dow Jones CDX.NA.IG.5.ALLPTS", - "DJCDX_NA_IG_S5_ALLPTS_122/125", 2453635, 2455551, 0.001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBJ3 ALLPTS", "CDX", 5, "NA IG V3 ALLPTS", null, "IG", 3, 5, - null, 0.976, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921739", "8972741", - "CDX-NAIGS5V3 - 1208", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_03Y_12/08_122/125", 2453635, 2454821, 0.003, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBJ3", "CDX", 5, "NA IG", null, "IG", 3, 3, - null, 0.976, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921740", "8972750", - "CDX-NAIGS6V3 - 0610", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_04Y_6/10_122/125", 2453816, 2455368, 0.003, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBK0", "CDX", 6, "NA IG", null, "IG", 3, 4, - null, 0.976, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V3 EUR.5Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921741", "8972760", - "CDX-NAIGS6V3 EUR - 0611", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_05Y_6/11_EUR_122/125", 2453816, 2455733, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYBK0 EUR", "CDX", 6, "NA IG V3 EUR", null, "IG", 3, 5, - null, 0.976, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921742", "8972730", - "CDX-NAIGFINS7V3 - 1211", "Dow Jones CDX.NA.IG.FIN.7", - "DJCDX_NA_IG_S7_FIN_12/11_22/25", 2454000, 2455916, 0.0025, "USD", - "ACT/360", false, 0, 4, "2I65B2BS3", "CDX", 7, "NA IG FIN", null, "IG", 3, 5, - null, 0.88, 25, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921743", "8972724", - "CDX-NAIGS7V3 - 1209", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_03Y_12/09_122/125", 2454000, 2455186, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBL8", "CDX", 7, "NA IG", null, "IG", 3, 3, - null, 0.976, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921744", "8972726", - "CDX-NAIGS7V3 - 1211", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_05Y_12/11_122/125", 2454000, 2455916, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBL8", "CDX", 7, "NA IG", null, "IG", 3, 5, - null, 0.976, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921745", "8972729", - "CDX-NAIGS7V3 - 1216", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_10Y_12/16_122/125", 2454000, 2457743, 0.006500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBL8", "CDX", 7, "NA IG", null, "IG", 3, 10, - null, 0.976, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921746", "8972725", - "CDX-NAIGS7V3 - 1210", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_04Y_12/10_122/125", 2454000, 2455551, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBL8", "CDX", 7, "NA IG", null, "IG", 3, 4, - null, 0.976, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V3 EUR.5Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921747", "8972727", - "CDX-NAIGS7V3 EUR - 1211", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_05Y_12/11_EUR_122/125", 2454000, 2455916, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYBL8", "CDX", 7, "NA IG V3 EUR", null, "IG", 3, 5, - null, 0.976, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("MCDX SERIES11 3YR.MCDX SERIE 3YR.3Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921752", "8975526", - "MCDX SERIES11 3YR - 1211", "MCDX.NA.11", - "MCDX SERIES 11 3Y", 2454744, 2455916, 0.0085, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAB3", "MCDX SERIES11 3YR", 11, "MCDX SERIE 3YR", null, "IG", 1, 3, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("MCDX SERIES11 5YR.MCDX SERIE 5YR.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921753", "8975527", - "MCDX SERIES11 5YR - 1213", "MCDX.NA.11", - "MCDX SERIES 11 5Y", 2454744, 2456647, 0.009000000000000001, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAB3", "MCDX SERIES11 5YR", 11, "MCDX SERIE 5YR", null, "IG", 1, 5, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("MCDX SERIES11 10YR.MCDX SERIE 10YR.10Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921754", "8975529", - "MCDX SERIES11 10YR - 1218", "MCDX.NA.11", - "MCDX SERIES 11 10Y", 2454744, 2458473, 0.0095, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAB3", "MCDX SERIES11 10YR", 11, "MCDX SERIE 10YR", null, "IG", 1, 10, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921761", "8965416", - "LCDXNAS12V1 - 0610", "LCDX.NA.12", - "CDX_NA_LN_S12_100_01YR", 2454938, 2455368, 0.05, "USD", - "ACT/360", false, 0.6, 4, "5F199GBG1", "LCDX", 12, "LCDXNA", null, "IG", 1, 1, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921762", "8965417", - "LCDXNAS12V1 - 0612", "LCDX.NA.12", - "CDX_NA_LN_S12_100_03YR", 2454938, 2456099, 0.05, "USD", - "ACT/360", false, 0.55, 4, "5F199GBG1", "LCDX", 12, "LCDXNA", null, "IG", 1, 3, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS12V1 FXD.LCDXNAV1 FXD.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921763", "8965418", - "LCDXNAS12V1 FXD - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_FXD", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.6, 4, "5F199GBG1 FXD", "LCDXNAS12V1 FXD", 12, "LCDXNAV1 FXD", null, "IG", 1, 5, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921764", "8965421", - "LCDXNAS12V1 - 0611", "LCDX.NA.12", - "CDX_NA_LN_S12_100_02YR", 2454938, 2455733, 0.05, "USD", - "ACT/360", false, 0.6, 4, "5F199GBG1", "LCDX", 12, "LCDXNA", null, "IG", 1, 2, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921765", "8965422", - "LCDXNAS12V1 - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.55, 4, "5F199GBG1", "LCDX", 12, "LCDXNA", null, "IG", 1, 5, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921766", "8965427", - "LCDXNAS12V1 - 0616", "LCDX.NA.12", - "CDX_NA_LN_S12_100_07YR", 2454938, 2457560, 0.05, "USD", - "ACT/360", false, 0.6, 4, "5F199GBG1", "LCDX", 12, "LCDXNA", null, "IG", 1, 7, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921767", "8965428", - "LCDXNAS12V1 - 0619", "LCDX.NA.12", - "CDX_NA_LN_S12_100_10YR", 2454938, 2458655, 0.05, "USD", - "ACT/360", false, 0.6, 4, "5F199GBG1", "LCDX", 12, "LCDXNA", null, "IG", 1, 10, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921768", "8965430", - "LCDXNAS12V1 - 0613", "LCDX.NA.12", - "CDX_NA_LN_S12_100_04YR", 2454938, 2456464, 0.05, "USD", - "ACT/360", false, 0.6, 4, "5F199GBG1", "LCDX", 12, "LCDXNA", null, "IG", 1, 4, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921769", "8965433", - "LCDXNAS12V1 - 0615", "LCDX.NA.12", - "CDX_NA_LN_S12_100_06YR", 2454938, 2457194, 0.05, "USD", - "ACT/360", false, 0.6, 4, "5F199GBG1", "LCDX", 12, "LCDXNA", null, "IG", 1, 6, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG FIN.5Y.1.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921775", "7618301", - "DJCDX-NAIGFINS1V2 - 0309", "Dow Jones CDX.NA.IG.FIN.1", - "DJCDX_NA_IG_S1_FIN_05Y_3/09_22/24", 2452934, 2454911, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65B2AG0", "DJCDX", 1, "NA IG FIN", null, "IG", 2, 5, - null, 0.91666, 23, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921801", "9016247", - "ITRAXX-LevXS2V2 - 0613", "ITRAXX LEVX SENIOR SERIES 2 VERSION 2", - "ITRAXX LEVX SENIOR SERIES 2 VERSION 2 EUR 1ST SEC RES I03 CDS", 2454543, 2456464, 0.052500000000000005, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJKL6", "ITRAXX", 2, "LevX", null, "IG", 2, 5, - null, 0.9866, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG TMT.5Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921822", "9014188", - "DJCDX-NAIGTMTS2V2 - 0909", "Dow Jones CDX.NA.IG.TMT.2", - "DJCDX_NA_IG_S2_TMT_05Y_09/09", 2453088, 2455095, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65DJAG1", "DJCDX", 2, "NA IG TMT", null, "IG", 2, 5, - null, 1, 28, 0, "NYC", false, false, true, null, "Trac-X")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921850", "9019166", - "LCDXNAS8V7 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_94/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAI8", "LCDX", 8, "LCDXNA", null, "IG", 7, 5, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921851", "9018747", - "LCDXNAS9V2 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_99/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAJ6", "LCDX", 9, "LCDXNA", null, "IG", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921853", "9018738", - "LCDXNAS10V2 - 0611", "LCDX.NA.10", - "CDX_NA_LN_S10_100_03YR_99/100", 2454561, 2455733, 0.0275, "USD", - "ACT/360", false, 0.6, 4, "5F199GAK3", "LCDX", 10, "LCDXNA", null, "IG", 2, 3, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921854", "9018755", - "LCDXNAS10V2 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_99/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAK3", "LCDX", 10, "LCDXNA", null, "IG", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG ENRG.5Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921855", "9014185", - "DJCDX-NAIGENRGS2V2 - 0909", "Dow Jones CDX.NA.IG.ENRG.2", - "CDX_NA_IG_S2_ENRG_09/09", 2453088, 2455095, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65B1AH0", "DJCDX", 2, "NA IG ENRG", null, "IG", 2, 5, - null, 1, 15, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921856", "9018750", - "LCDXNAS9V2 - 1214", "LCDX.NA.9", - "CDX_NA_LN_S09_100_07YR_99/100", 2454378, 2457012, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAJ6", "LCDX", 9, "LCDXNA", null, "IG", 2, 7, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921857", "9018754", - "LCDXNAS9V2 - 1217", "LCDX.NA.9", - "CDX_NA_LN_S09_100_10YR_99/100", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAJ6", "LCDX", 9, "LCDXNA", null, "IG", 2, 10, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921858", "9018757", - "LCDXNAS9V2 - 1211", "LCDX.NA.9", - "CDX_NA_LN_S09_100_04YR_99/100", 2454378, 2455916, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAJ6", "LCDX", 9, "LCDXNA", null, "IG", 2, 4, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.10Y.1.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921859", "9014175", - "DJCDX-NAIGHVOLS1V3 - 0314", "Dow Jones CDX.NA.IG.HVOL.1", - "DJCDX_NA_IG_S1_HIVOL_10Y_29/30", 2452934, 2456737, 0.0135, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AI4", "DJCDX", 1, "NA IG HVOL", null, "HV", 3, 10, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921860", "9019180", - "LCDXNAS8V7 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_94/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAI8", "LCDX", 8, "LCDXNA", null, "IG", 7, 3, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V7 FXD.LCDXNAV7 FXD.5Y.8.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921861", "9019183", - "LCDXNAS8V7 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_94/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAI8 FXD", "LCDXNAS8V7 FXD", 8, "LCDXNAV7 FXD", null, "IG", 7, 5, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921863", "9019189", - "LCDXNAS8V7 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_94/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAI8", "LCDX", 8, "LCDXNA", null, "IG", 7, 4, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921864", "9019163", - "LCDXNAS8V7 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_94/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAI8", "LCDX", 8, "LCDXNA", null, "IG", 7, 10, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921865", "9019167", - "LCDXNAS8V7 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_94/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAI8", "LCDX", 8, "LCDXNA", null, "IG", 7, 6, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921866", "9019169", - "LCDXNAS8V7 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_94/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAI8", "LCDX", 8, "LCDXNA", null, "IG", 7, 7, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921868", "9019205", - "LCDXNAS9V2 - 1210", "LCDX.NA.9", - "CDX_NA_LN_S09_100_03YR_99/100", 2454378, 2455551, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAJ6", "LCDX", 9, "LCDXNA", null, "IG", 2, 3, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V2 FXD.LCDXNAV2 FXD.5Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921869", "9019207", - "LCDXNAS9V2 FXD - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_FXD_99/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAJ6 FXD", "LCDXNAS9V2 FXD", 9, "LCDXNAV2 FXD", null, "IG", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921870", "9019208", - "LCDXNAS9V2 - 1209", "LCDX.NA.9", - "CDX_NA_LN_S09_100_02YR_99/100", 2454378, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAJ6", "LCDX", 9, "LCDXNA", null, "IG", 2, 2, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921871", "9018758", - "LCDXNAS9V2 - 1213", "LCDX.NA.9", - "CDX_NA_LN_S09_100_06YR_99/100", 2454378, 2456647, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAJ6", "LCDX", 9, "LCDXNA", null, "IG", 2, 6, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921872", "9018734", - "LCDXNAS10V2 - 0609", "LCDX.NA.10", - "CDX_NA_LN_S10_100_01YR_99/100", 2454561, 2455003, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAK3", "LCDX", 10, "LCDXNA", null, "IG", 2, 1, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921875", "9018751", - "LCDXNAS10V2 - 0610", "LCDX.NA.10", - "CDX_NA_LN_S10_100_02YR_99/100", 2454561, 2455368, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAK3", "LCDX", 10, "LCDXNA", null, "IG", 2, 2, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG ENRG.10Y.1.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921877", "9020442", - "DJCDX-NAIGENRGS1V2 - 0314", "Dow Jones CDX.NA.IG.ENRG.1", - "DJCDX_NA_IG_S1_ENRG_10Y_3/14", 2452934, 2456737, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I65B1AG2", "DJCDX", 1, "NA IG ENRG", null, "IG", 2, 10, - null, 1, 15, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921880", "9019173", - "LCDXNAS10V2 - 0615", "LCDX.NA.10", - "CDX_NA_LN_S10_100_07YR_99/100", 2454561, 2457194, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAK3", "LCDX", 10, "LCDXNA", null, "IG", 2, 7, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS10V2 FXD.LCDXNAV2 FXD.5Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921887", "9018744", - "LCDXNAS10V2 FXD - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_FXD_99/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAK3 FXD", "LCDXNAS10V2 FXD", 10, "LCDXNAV2 FXD", null, "IG", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921889", "9019174", - "LCDXNAS10V2 - 0618", "LCDX.NA.10", - "CDX_NA_LN_S10_100_10YR_99/100", 2454561, 2458290, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAK3", "LCDX", 10, "LCDXNA", null, "IG", 2, 10, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921890", "9019175", - "LCDXNAS10V2 - 0612", "LCDX.NA.10", - "CDX_NA_LN_S10_100_04YR_99/100", 2454561, 2456099, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAK3", "LCDX", 10, "LCDXNA", null, "IG", 2, 4, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921891", "9019176", - "LCDXNAS10V2 - 0614", "LCDX.NA.10", - "CDX_NA_LN_S10_100_06YR_99/100", 2454561, 2456829, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAK3", "LCDX", 10, "LCDXNA", null, "IG", 2, 6, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921901", "9021940", - "LCDXNAS8V8 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_93/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAL1", "LCDX", 8, "LCDXNA", null, "IG", 8, 5, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921902", "9021941", - "LCDXNAS9V3 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_98/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAM9", "LCDX", 9, "LCDXNA", null, "IG", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921903", "9021739", - "LCDXNAS10V3 - 0611", "LCDX.NA.10", - "CDX_NA_LN_S10_100_03YR_98/100", 2454561, 2455733, 0.0275, "USD", - "ACT/360", false, 0.6, 4, "5F199GAN7", "LCDX", 10, "LCDXNA", null, "IG", 3, 3, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921904", "9021771", - "LCDXNAS10V3 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_98/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAN7", "LCDX", 10, "LCDXNA", null, "IG", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921912", "9021957", - "LCDXNAS8V8 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_93/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAL1", "LCDX", 8, "LCDXNA", null, "IG", 8, 3, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V8 FXD.LCDXNAV8 FXD.5Y.8.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921913", "9021977", - "LCDXNAS8V8 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_93/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAL1 FXD", "LCDXNAS8V8 FXD", 8, "LCDXNAV8 FXD", null, "IG", 8, 5, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921917", "9022067", - "LCDXNAS8V8 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_93/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAL1", "LCDX", 8, "LCDXNA", null, "IG", 8, 4, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921918", "9022070", - "LCDXNAS8V8 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_93/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAL1", "LCDX", 8, "LCDXNA", null, "IG", 8, 10, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921919", "9021949", - "LCDXNAS8V8 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_93/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAL1", "LCDX", 8, "LCDXNA", null, "IG", 8, 6, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921920", "9021950", - "LCDXNAS8V8 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_93/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAL1", "LCDX", 8, "LCDXNA", null, "IG", 8, 7, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921922", "9021988", - "LCDXNAS9V3 - 1210", "LCDX.NA.9", - "CDX_NA_LN_S09_100_03YR_98/100", 2454378, 2455551, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAM9", "LCDX", 9, "LCDXNA", null, "IG", 3, 3, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V3 FXD.LCDXNAV3 FXD.5Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921923", "9021998", - "LCDXNAS9V3 FXD - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_FXD_98/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAM9 FXD", "LCDXNAS9V3 FXD", 9, "LCDXNAV3 FXD", null, "IG", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921924", "9021997", - "LCDXNAS9V3 - 1209", "LCDX.NA.9", - "CDX_NA_LN_S09_100_02YR_98/100", 2454378, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAM9", "LCDX", 9, "LCDXNA", null, "IG", 3, 2, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921927", "9022071", - "LCDXNAS9V3 - 1214", "LCDX.NA.9", - "CDX_NA_LN_S09_100_07YR_98/100", 2454378, 2457012, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAM9", "LCDX", 9, "LCDXNA", null, "IG", 3, 7, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921928", "9022075", - "LCDXNAS9V3 - 1217", "LCDX.NA.9", - "CDX_NA_LN_S09_100_10YR_98/100", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAM9", "LCDX", 9, "LCDXNA", null, "IG", 3, 10, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet15() - { - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921929", "9022076", - "LCDXNAS9V3 - 1211", "LCDX.NA.9", - "CDX_NA_LN_S09_100_04YR_98/100", 2454378, 2455916, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAM9", "LCDX", 9, "LCDXNA", null, "IG", 3, 4, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.0Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921930", "9021999", - "LCDXNAS9V3 - 1213", "LCDX.NA.9", - "CDX_NA_LN_S09_100_06YR_98/100", 2454378, 2456647, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAM9", "LCDX", 9, "LCDXNA", null, "IG", 3, 0, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921931", "9021811", - "LCDXNAS10V3 - 0609", "LCDX.NA.10", - "CDX_NA_LN_S10_100_01YR_98/100", 2454561, 2455003, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAN7", "LCDX", 10, "LCDXNA", null, "IG", 3, 1, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS10V3 FXD.LCDXNAV3 FXD.5Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921932", "9021755", - "LCDXNAS10V3 FXD - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_FXD_98/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAN7 FXD", "LCDXNAS10V3 FXD", 10, "LCDXNAV3 FXD", null, "IG", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921933", "9021762", - "LCDXNAS10V3 - 0610", "LCDX.NA.10", - "CDX_NA_LN_S10_100_02YR_98/100", 2454561, 2455368, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAN7", "LCDX", 10, "LCDXNA", null, "IG", 3, 2, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921934", "9021795", - "LCDXNAS10V3 - 0615", "LCDX.NA.10", - "CDX_NA_LN_S10_100_07YR_98/100", 2454561, 2457194, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAN7", "LCDX", 10, "LCDXNA", null, "IG", 3, 7, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921935", "9021797", - "LCDXNAS10V3 - 0618", "LCDX.NA.10", - "CDX_NA_LN_S10_100_10YR_98/100", 2454561, 2458290, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAN7", "LCDX", 10, "LCDXNA", null, "IG", 3, 10, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921936", "9021803", - "LCDXNAS10V3 - 0612", "LCDX.NA.10", - "CDX_NA_LN_S10_100_04YR_98/100", 2454561, 2456099, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAN7", "LCDX", 10, "LCDXNA", null, "IG", 3, 4, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921937", "9021807", - "LCDXNAS10V3 - 0614", "LCDX.NA.10", - "CDX_NA_LN_S10_100_06YR_98/100", 2454561, 2456829, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAN7", "LCDX", 10, "LCDXNA", null, "IG", 3, 6, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG INDU.5Y.1.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921939", "9014172", - "DJCDX-NAIGINDUS1V3 - 0309", "Dow Jones CDX.NA.IG.INDU.1", - "DJCDX_NA_IG_S1_INDU_05Y_3/09_29/30.", 2452934, 2454911, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65B4AI2", "DJCDX", 1, "NA IG INDU", null, "IG", 3, 5, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG ENRG.5Y.1.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921940", "7618298", - "DJCDX-NAIGENRGS1V2 - 0309", "Dow Jones CDX.NA.IG.ENRG", - "DJCDX_NA_IG_S1_ENRG_05Y_3/09.", 2452934, 2454911, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65B1AG2", "DJCDX", 1, "NA IG ENRG", null, "IG", 2, 5, - null, 1, 15, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.6.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921962", "9024121", - "CDX-NAIGS6V4 - 0616", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_10Y_6/16_121/125", 2453816, 2457560, 0.006500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBM6", "CDX", 6, "NA IG", null, "IG", 4, 10, - null, 0.968, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.6.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921963", "9024508", - "CDX-NAIGS6V4 - 0613", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_07Y_6/13_121/125", 2453816, 2456464, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBM6", "CDX", 6, "NA IG", null, "IG", 4, 7, - null, 0.968, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.6.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921964", "9024509", - "CDX-NAIGS6V4 - 0611", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_05Y_6/11_121/125", 2453816, 2455733, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBM6", "CDX", 6, "NA IG", null, "IG", 4, 5, - null, 0.968, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.6.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921965", "9024522", - "CDX-NAIGS6V4 - 0609", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_03Y_6/09_121/125", 2453816, 2455003, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBM6", "CDX", 6, "NA IG", null, "IG", 4, 3, - null, 0.968, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.2Y.6.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921966", "9024563", - "CDX-NAIGS6V4 - 0608", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_02Y_6/08_121/125", 2453816, 2454638, 0.0015, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBM6", "CDX", 6, "NA IG", null, "IG", 4, 2, - null, 0.968, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.5Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921967", "9024118", - "CDX-NAXOS7V3 - 1211", "Dow Jones CDX.NA.XO.7", - "DJCDX_NA_XO_S7_05YR_12/11_33/35", 2454000, 2455917, 0.0165, "USD", - "ACT/360", false, 0.4, 4, "1D764IAP2", "CDX", 7, "NA XO", null, "XO", 3, 5, - null, 0.94286, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.3Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921968", "9024525", - "CDX-NAIGHVOLS6V2 - 0609", "Dow Jones CDX.NA.IG.HVOL.6", - "DJCDX_NA_IG_S6_HVOL_03Y_6/09 29/30", 2453816, 2455003, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BC6", "CDX", 6, "NA IG HVOL", null, "HV", 2, 3, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921969", "9024531", - "CDX-NAIGHVOLS6V2 - 0611", "Dow Jones CDX.NA.IG.HVOL.6", - "DJCDX_NA_IG_S6_HVOL_05Y_6/11 29/30", 2453816, 2455733, 0.007500000000000001, "USD", - "ACT/360", false, 0, 4, "2I65B3BC6", "CDX", 6, "NA IG HVOL", null, "HV", 2, 5, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.7Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921972", "9024504", - "CDX-NAIGHVOLS6V2 - 0613", "Dow Jones CDX.NA.IG.HVOL.6", - "DJCDX_NA_IG_S6_HVOL_07Y_6/13 29/30", 2453816, 2456464, 0.009000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BC6", "CDX", 6, "NA IG HVOL", null, "HV", 2, 7, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.10Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921973", "9024511", - "CDX-NAIGHVOLS6V2 - 0616", "Dow Jones CDX.NA.IG.HVOL.6", - "DJCDX_NA_IG_S6_HVOL_10Y_6/16 29/30", 2453816, 2457560, 0.011000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BC6", "CDX", 6, "NA IG HVOL", null, "HV", 2, 10, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.5Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921974", "9024145", - "CDX-NAXOS8V2 - 0612", "CDX.NA.XO.8", - "CDX_NA_XO_S8_05YR_06/12 34/35", 2454181, 2456099, 0.014, "USD", - "ACT/360", false, 0.4, 4, "1D764IAQ0", "CDX", 8, "NAXO", null, "XO", 2, 5, - null, 0.97143, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921975", "9024101", - "CDX-NAHYS9V4 - 1212", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_97/100", 2454372, 2456282, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBU3", "CDX", 9, "NA HY", null, "HY", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921976", "9024527", - "CDX-NAHYS9V4 - 1210", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_03YR_97/100", 2454372, 2455551, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBU3", "CDX", 9, "NA HY", null, "HY", 4, 3, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921977", "9024530", - "CDX-NAHYS9V4 - 1214", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_07YR_97/100", 2454372, 2457012, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBU3", "CDX", 9, "NA HY", null, "HY", 4, 7, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921978", "9024529", - "CDX-NAHYS9V4 - 1217", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_10YR_97/100", 2454372, 2458108, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBU3", "CDX", 9, "NA HY", null, "HY", 4, 10, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921979", "9024671", - "CDX-NAHYBS9V3 - 1212", "CDX.NA.HY.B.9", - "CDX_NA_HY_S09_B___SWP_44/46", 2454372, 2456282, 0.035, "USD", - "ACT/360", false, 0.3, 4, "2I65BSBH0", "CDX", 9, "NA HY B", null, "HY", 3, 5, - null, 0.9565300000000001, 46, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921980", "9024672", - "LCDXNAS9V4 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_97/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAO5", "LCDX", 9, "LCDXNA", null, "IG", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921981", "9024636", - "CDX-NAHYS10V2 - 0613", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_99/100", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBV1", "CDX", 10, "NA HY", null, "HY", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921982", "9024637", - "CDX-NAHYS10V2 - 0611", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_03YR_99/100", 2454554, 2455733, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBV1", "CDX", 10, "NA HY", null, "HY", 2, 3, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921983", "9024638", - "CDX-NAHYS10V2 - 0615", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_07YR_99/100", 2454554, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBV1", "CDX", 10, "NA HY", null, "HY", 2, 7, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921984", "9024640", - "CDX-NAHYS10V2 - 0618", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_10YR_99/100", 2454554, 2458290, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBV1", "CDX", 10, "NA HY", null, "HY", 2, 10, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921985", "9024096", - "LCDXNAS10V4 - 0611", "LCDX.NA.10", - "CDX_NA_LN_S10_100_03YR_97/100", 2454561, 2455733, 0.0275, "USD", - "ACT/360", false, 0.6, 4, "5F199GAP2", "LCDX", 10, "LCDXNA", null, "IG", 4, 3, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921986", "9024099", - "LCDXNAS10V4 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_97/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAP2", "LCDX", 10, "LCDXNA", null, "IG", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921987", "9024153", - "CDX-NAHYS11V2 - 1213", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_99/100", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBW9", "CDX", 11, "NA HY", null, "HY", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921988", "9024660", - "CDX-NAHYS11V2 - 1211", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_03YR_99/100", 2454738, 2455916, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBW9", "CDX", 11, "NA HY", null, "HY", 2, 3, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921989", "9024661", - "CDX-NAHYS11V2 - 1215", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_07YR_99/100", 2454738, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBW9", "CDX", 11, "NA HY", null, "HY", 2, 7, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921990", "9024666", - "CDX-NAHYS11V2 - 1218", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_10YR_99/100", 2454738, 2458473, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBW9", "CDX", 11, "NA HY", null, "HY", 2, 10, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.3Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921991", "9024127", - "CDX-NAXOS7V3 - 1209", "Dow Jones CDX.NA.XO.7", - "DJCDX_NA_XO_S7_03YR_12/09_ 33/35", 2454000, 2455186, 0.0125, "USD", - "ACT/360", false, 0.4, 4, "1D764IAP2", "CDX", 7, "NAXO", null, "XO", 3, 3, - null, 0.94286, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.7Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921992", "9024131", - "CDX-NAXOS7V3 - 1213", "Dow Jones CDX.NA.XO.7", - "DJCDX_NA_XO_S7_07YR_12/13_ 33/35", 2454000, 2456647, 0.0195, "USD", - "ACT/360", false, 0.4, 4, "1D764IAP2", "CDX", 7, "NA XO", null, "XO", 3, 7, - null, 0.94286, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.10Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921993", "9024134", - "CDX-NAXOS7V3 - 1216", "Dow Jones CDX.NA.XO.7", - "DJCDX_NA_XO_S7_10YR_12/16_ 33/35", 2454000, 2457743, 0.021, "USD", - "ACT/360", false, 0.4, 4, "1D764IAP2", "CDX", 7, "NA XO", null, "XO", 3, 10, - null, 0.94286, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V4 EUR.5Y.6.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921994", "9024114", - "CDX-NAIGS6V4 EUR - 0611", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_05Y_6/11_EUR_121/125", 2453816, 2455733, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYBM6 EUR", "CDX", 6, "NA IG V4 EUR", null, "IG", 4, 5, - null, 0.968, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.6.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921995", "9024115", - "CDX-NAIGS6V4 - 0610", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_04Y_6/10_121/125", 2453816, 2455368, 0.003, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBM6", "CDX", 6, "NA IG", null, "IG", 4, 4, - null, 0.968, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.1Y.6.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921996", "9024122", - "CDX-NAIGS6V4 - 0607", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_01Y_6/07_121/125", 2453816, 2454272, 0.001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBM6", "CDX", 6, "NA IG", null, "IG", 4, 1, - null, 0.968, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921997", "9024930", - "CDX-NAHYS11V2 - 1212", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_04YR_99/100", 2454738, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBW9", "CDX", 11, "NA HY", null, "HY", 2, 4, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921998", "9024932", - "CDX-NAHYS11V2 - 1214", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_06YR_99/100", 2454738, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBW9", "CDX", 11, "NA HY", null, "HY", 2, 6, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDXNAS10V4 FXD.LCDXNAV4 FXD.5Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("921999", "9025333", - "LCDXNAS10V4 FXD - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_FXD_97/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GAP2 FXD", "LCDXNAS10V4 FXD", 10, "LCDXNAV4 FXD", null, "IG", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.2Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922000", "9024919", - "CDX-NAIGHVOLS6V2 - 0608", "Dow Jones CDX.NA.IG.HVOL.6", - "DJCDX_NA_IG_S6_HVOL_02Y_6/08 29/30", 2453816, 2454638, 0.003, "USD", - "ACT/360", false, 0.5, 4, "2I65B3BC6", "CDX", 6, "NA IG HVOL", null, "HV", 2, 2, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.1Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922001", "9024537", - "CDX-NAIGHVOLS6V2 - 0607", "Dow Jones CDX.NA.IG.HVOL.6", - "DJCDX_NA_IG_S6_HVOL_01Y_6/07 29/30", 2453816, 2454272, 0.002, "USD", - "ACT/360", false, 0.5, 4, "2I65B3BC6", "CDX", 6, "NA IG HVOL", null, "HV", 2, 1, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.4Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922002", "9024539", - "CDX-NAIGHVOLS6V2 - 0610", "Dow Jones CDX.NA.IG.HVOL.6", - "DJCDX_NA_IG_S6_HVOL_04Y_6/10 29/30", 2453816, 2455368, 0.0055000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BC6", "CDX", 6, "NA IG HVOL", null, "HV", 2, 4, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.3Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922003", "9024141", - "CDX-NAXOS8V2 - 0610", "CDX.NA.XO.8", - "CDX_NA_XO_S8_03YR_06/10 34/35", 2454181, 2455368, 0.0085, "USD", - "ACT/360", false, 0.4, 4, "1D764IAQ0", "CDX", 8, "NAXO", null, "XO", 2, 3, - null, 0.97143, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG TMT.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922004", "9024551", - "CDX-NAIGTMTS6V2 - 0611", "DOW JONES CDX.NA.IG.TMT.6", - "DJCDX_NA_IG_S6_TMT_6/11 23/24", 2453816, 2455733, 0.0045000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65DJAN6", "CDX", 6, "NA IG TMT", null, "IG", 2, 5, - null, 0.95455, 24, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.7Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922005", "9024147", - "CDX-NAXOS8V2 - 0614", "CDX.NA.XO.8", - "CDX_NA_XO_S8_07YR_06/14 34/35", 2454181, 2456829, 0.018500000000000003, "USD", - "ACT/360", false, 0.4, 4, "1D764IAQ0", "CDX", 8, "NAXO", null, "XO", 2, 7, - null, 0.97143, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.10Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922006", "9024150", - "CDX-NAXOS8V2 - 0617", "CDX.NA.XO.8", - "CDX_NA_XO_S8_10YR_06/17 34/35", 2454181, 2457925, 0.021500000000000002, "USD", - "ACT/360", false, 0.4, 4, "1D764IAQ0", "CDX", 8, "NAXO", null, "XO", 2, 10, - null, 0.97143, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V4 FXD.LCDXNAV4 FXD.5Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922007", "9025334", - "LCDXNAS9V4 FXD - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_FXD_97/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GAO5 FXD", "LCDXNAS9V4 FXD", 9, "LCDXNAV4 FXD", null, "IG", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NAXOV2 EUR.5Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922008", "9024449", - "CDX-NAXOS8V2 EUR - 0612", "CDX.NA.XO.8", - "CDX_NA_XO_S8_05YR_06/12 EUR 34/35", 2454181, 2456099, 0.014, "EUR", - "ACT/360", false, 0.4, 4, "1D764IAQ0 EUR", "CDX", 8, "NAXOV2 EUR", null, "XO", 2, 5, - null, 0.97143, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922009", "9024535", - "CDX-NAHYS9V4 - 1208", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_01YR_97/100", 2454372, 2454821, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBU3", "CDX", 9, "NA HY", null, "HY", 4, 1, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922010", "9024095", - "CDX-NAHYHBS10V2 - 0613", "CDX.NA.HY.HB.10", - "CDX_NA_HY_S10_HB__SWP_29/30", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWBG3", "CDX", 10, "NA HY HB", null, "HY", 2, 5, - null, 0.96667, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922011", "9024100", - "LCDXNAS10V4 - 0609", "LCDX.NA.10", - "CDX_NA_LN_S10_100_01YR_97/100", 2454561, 2455003, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAP2", "LCDX", 10, "LCDXNA", null, "IG", 4, 1, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922012", "9024102", - "LCDXNAS10V4 - 0610", "LCDX.NA.10", - "CDX_NA_LN_S10_100_02YR_97/1000", 2454561, 2455368, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAP2", "LCDX", 10, "LCDXNA", null, "IG", 4, 2, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922013", "9024103", - "LCDXNAS10V4 - 0615", "LCDX.NA.10", - "CDX_NA_LN_S10_100_07YR_97/100", 2454561, 2457194, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAP2", "LCDX", 10, "LCDXNA", null, "IG", 4, 7, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922014", "9024110", - "LCDXNAS10V4 - 0618", "LCDX.NA.10", - "CDX_NA_LN_S10_100_10YR_97/100", 2454561, 2458290, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAP2", "LCDX", 10, "LCDXNA", null, "IG", 4, 10, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922018", "9024701", - "LCDXNAS9V4 - 1214", "LCDX.NA.9", - "CDX_NA_LN_S09_100_07YR_97/100", 2454378, 2457012, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAO5", "LCDX", 9, "LCDXNA", null, "IG", 4, 7, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922020", "9024702", - "LCDXNAS9V4 - 1217", "LCDX.NA.9", - "CDX_NA_LN_S09_100_10YR_97/100", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAO5", "LCDX", 9, "LCDXNA", null, "IG", 4, 10, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922021", "9024734", - "LCDXNAS9V4 - 1211", "LCDX.NA.9", - "CDX_NA_LN_S09_100_04YR_97/100", 2454378, 2455916, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAO5", "LCDX", 9, "LCDXNA", null, "IG", 4, 4, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922024", "9024601", - "LCDXNAS9V4 - 1213", "LCDX.NA.9", - "CDX_NA_LN_S09_100_06YR_97/100", 2454378, 2456647, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAO5", "LCDX", 9, "LCDXNA", null, "IG", 4, 6, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922026", "9024604", - "LCDXNAS9V4 - 1209", "LCDX.NA.9", - "CDX_NA_LN_S09_100_02YR_97/100", 2454378, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAO5", "LCDX", 9, "LCDXNA", null, "IG", 4, 2, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922030", "9024111", - "LCDXNAS10V4 - 0612", "LCDX.NA.10", - "CDX_NA_LN_S10_100_04YR_97/100", 2454561, 2456099, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAP2", "LCDX", 10, "LCDXNA", null, "IG", 4, 4, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922031", "9024926", - "LCDXNAS10V4 - 0614", "LCDX.NA.10", - "CDX_NA_LN_S10_100_06YR_97/100", 2454561, 2456829, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAP2", "LCDX", 10, "LCDXNA", null, "IG", 4, 6, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922032", "9024071", - "CDX-NAHYHBS11V2 - 1213", "CDX.NA.HY.HB.11", - "CDX_NA_HY_S11_HB__SWP_29/30", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWBH1", "CDX", 11, "NA HY HB", null, "HY", 2, 5, - null, 0.96667, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922033", "9024154", - "CDX-NAHYS11V2 - 1209", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_01YR_99/100", 2454738, 2455186, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBW9", "CDX", 11, "NA HY", null, "HY", 2, 1, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922034", "9024929", - "CDX-NAHYS11V2 - 1210", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_02YR_99/100", 2454738, 2455551, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBW9", "CDX", 11, "NA HY", null, "HY", 2, 2, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922035", "9024534", - "CDX-NAHYS9V4 - 1211", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_04YR_97/100", 2454372, 2455916, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBU3", "CDX", 9, "NA HY", null, "HY", 4, 4, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922036", "9024689", - "CDX-NAHYS9V4 - 1213", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_06YR_97/100", 2454372, 2456647, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBU3", "CDX", 9, "NA HY", null, "HY", 4, 6, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922037", "9024688", - "CDX-NAHYS9V4 - 1209", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_02YR_97/100", 2454372, 2455186, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBU3", "CDX", 9, "NA HY", null, "HY", 4, 2, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922038", "9024698", - "CDX-NAHYHBS9V4 - 1212", "CDX.NA.HY.HB.9", - "CDX_NA_HY_S09_HB__SWP_27/30", 2454372, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BWBF5", "CDX", 9, "NA HY HB", null, "HY", 4, 5, - null, 0.9000100000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922040", "9024607", - "LCDXNAS9V4 - 1210", "LCDX.NA.9", - "CDX_NA_LN_S09_100_03YR_97/100", 2454378, 2455551, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAO5", "LCDX", 9, "LCDXNA", null, "IG", 4, 3, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922041", "9024642", - "CDX-NAHYS10V2 - 0609", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_01YR_99/100", 2454554, 2455003, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBV1", "CDX", 10, "NA HY", null, "HY", 2, 1, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922042", "9024644", - "CDX-NAHYS10V2 - 0612", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_04YR_99/100", 2454554, 2456099, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBV1", "CDX", 10, "NA HY", null, "HY", 2, 4, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922043", "9024646", - "CDX-NAHYS10V2 - 0614", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_06YR_99/100", 2454554, 2456829, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBV1", "CDX", 10, "NA HY", null, "HY", 2, 6, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922044", "9024088", - "CDX-NAHYS10V2 - 0610", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_02YR_99/100", 2454554, 2455368, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBV1", "CDX", 10, "NA HY", null, "HY", 2, 2, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922047", "9024546", - "CDX-NAIGHVOLS6V2 EUR - 0611", "Dow Jones CDX.NA.IG.HVOL.6", - "DJCDX_NA_IG_S6_HVOL_05Y_6/11_EUR 29/30", 2453816, 2455733, 0.007500000000000001, "EUR", - "ACT/360", false, 0.4, 4, "2I65B3BC6 EUR", "CDX", 6, "NA IG HVOL", null, "HV", 2, 5, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.EMDIV.5Y.1.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922052", "7845294", - "CDX-EMDIVS1V2 - 0610", "Dow Jones CDX.EM.DIVERSIFIED.1", - "DOW JONES CDX DIVER INDEX 06/20/10 39/40", 2453465, 2455368, 0.016, "USD", - "ACT/360", true, 0.25, 2, "2165EKAI0", "CDX", 1, "EMDIV", null, "EM", 2, 5, - null, 0.975, 40, 0, "LON", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.EMDIV.5Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922053", "7845316", - "CDX-EMDIVS2V2 - 1210", "Dow Jones CDX.EM.DIVERSIFIED.2", - "DOW JONES CDX EM DIVER 2 5YR 39/40", 2453635, 2455551, 0.013000000000000001, "USD", - "ACT/360", true, 0.25, 2, "2165EKAJ8", "CDX", 2, "EMDIV", null, "EM", 2, 5, - null, 0.975, 40, 0, "LON", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.EMDIV.5Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922054", "7845324", - "CDX-EMDIVS3V2 - 0611", "Dow Jones CDX.EM.DIVERSIFIED.3", - "DOW JONES CDX EM DIVER 3 5YR 39/40", 2453816, 2455733, 0.0085, "USD", - "ACT/360", true, 0.25, 2, "2165EKAK5", "CDX", 3, "EMDIV", null, "EM", 2, 5, - null, 0.975, 40, 0, "LON", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.EMDIV.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922055", "7845332", - "CDX-EMDIVS4V2 - 1211", "Dow Jones CDX.EM.DIVERSIFIED.4", - "DOW JONES CDX EM DIVER 4 5YR 39/40", 2454000, 2455916, 0.0095, "USD", - "ACT/360", true, 0.25, 2, "2165EKAL3", "CDX", 4, "EMDIV", null, "EM", 2, 5, - null, 0.975, 40, 0, "LON", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LevXSenS1V11.LevXSen.5Y.1.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922201", "9016274", - "LevXSenS1V11 - 1211", "ITRAXX LEVX SENIOR SERIES 1 VERSION 11", - "ITRAXX LEVX SENIOR SERIES 1 VERSION 11 EUR 1ST SEC MMR I03 CDS", 2453999, 2455916, 0.017, "EUR", - "ACT/360", false, 0.71, 4, "4ABCAJAL7", "LevXSenS1V11", 1, "LevXSen", null, "IG", 11, 5, - null, 0.7141, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevXSub.5Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922202", "9029392", - "ITRAXX-LevXSubS2V2 - 0613", "ITRAXX LEVX SUBORDINATE SERIES 2 VERSION 2", - "ITRAXX LEVX SUBORDINATE SERIES 2 VERSION 2 EUR 2ND SEC RES I03 CDS", 2454543, 2456464, 0.0825, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKBF6", "ITRAXX", 2, "LevXSub", null, "IG", 2, 5, - null, 0.9778, 45, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922203", "9029382", - "ITRAXX-LevXS3V2 - 1213", "ITRAXX LEVX SENIOR SERIES 3 VERSION 2", - "ITRAXX LEVX SENIOR SERIES 3 VERSION 2 EUR 1ST SEC RES I03 CDS", 2454739, 2456647, 0.0575, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJBD4", "ITRAXX", 3, "LevX", null, "IG", 2, 5, - null, 0.9866, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevXSub.5Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922204", "9029383", - "ITRAXX-LevXSubS3V2 - 1213", "ITRAXX LEVX SUBORDINATE SERIES 3 VERSION 2", - "ITRAXX LEVX SUBORDINATE SERIES 3 VERSION 2 EUR 2ND SEC RES I03 CDS", 2454739, 2456647, 0.12000000000000001, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKBG4", "ITRAXX", 3, "LevXSub", null, "IG", 2, 5, - null, 0.9778, 45, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.2.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922207", "9029378", - "ITRAXX-LevXS2V3 - 0613", "ITRAXX LEVX SENIOR SERIES 2 VERSION 3", - "ITRAXX LEVX SENIOR SERIES 2 VERSION 3 EUR 1ST SEC RES I03 CDS", 2454543, 2456464, 0.052500000000000005, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJBB8", "ITRAXX", 2, "LevX", null, "IG", 3, 5, - null, 0.9598000000000001, 74, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LevXSubS1V14.LevXSub.5Y.1.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922208", "9029616", - "LevXSubS1V14 - 1211", "ITRAXX LEVX SUBORDINATE SERIES 1 VERSION 14", - "ITRAXX LEVX SUBORDINATE SERIES 1 VERSION 14 EUR 2ND SEC MMR I03 CDS", 2454180, 2455916, 0.045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKAN0", "LevXSubS1V14", 1, "LevXSub", null, "IG", 14, 5, - null, 0.6286, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922214", "9030177", - "CDX-NAHYBBS8V2 - 0612", "CDX.NA.HY.BB.8", - "CDX_NA_HY_S08_BB__SWP_35/36", 2454188, 2456099, 0.0175, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBA8", "CDX", 8, "NA HY BB", null, "HY", 2, 5, - null, 0.97222, 36, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922215", "9030173", - "CDX-NAHYS8V4 - 0612", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_97/100", 2454188, 2456099, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBR0", "CDX", 8, "NA HY", null, "HY", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922216", "9030002", - "CDX-NAHYS8V4 - 0610", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_03YR_97/100", 2454188, 2455368, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBR0", "CDX", 8, "NA HY", null, "HY", 4, 3, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922217", "9030003", - "CDX-NAHYS8V4 - 0614", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_07YR_97/100", 2454188, 2456829, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBR0", "CDX", 8, "NA HY", null, "HY", 4, 7, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922218", "9030007", - "CDX-NAHYS8V4 - 0617", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_10YR_97/100", 2454188, 2457925, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBR0", "CDX", 8, "NA HY", null, "HY", 4, 10, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.7.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922224", "9030161", - "CDX-NAHYS7V4 - 1211", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_97/100", 2454007, 2455916, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCG3", "CDX", 7, "NA HY", null, "HY", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet16() - { - UpdateCDXRefDataMap ("CDX.NA HY.7Y.7.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922225", "9030162", - "CDX-NAHYS7V4 - 1213", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_07YR_97/100", 2454007, 2456647, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCG3", "CDX", 7, "NA HY", null, "HY", 4, 7, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.7.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922227", "9030168", - "CDX-NAHYS7V4 - 1209", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_03YR_97/100", 2454007, 2455186, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCG3", "CDX", 7, "NA HY", null, "HY", 4, 3, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.7.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922228", "9030169", - "CDX-NAHYS7V4 - 1216", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_10YR_97/100", 2454007, 2457743, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCG3", "CDX", 7, "NA HY", null, "HY", 4, 10, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.1.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922229", "9030141", - "CDX-NAHYS1V6 - 0309", "Dow Jones CDX.NA.HY.1", - "CDX_NA_HY_S01_100_SWP_90/100", 2452934, 2454911, 0.0425, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCA6", "CDX", 1, "NA HY", null, "HY", 6, 5, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.2.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922231", "9030487", - "CDX-NAHYS2V7 - 0909", "Dow Jones CDX.NA.HY.2", - "DJCDX_NA_HY_S2_100_SWP_91/100", 2453088, 2455095, 0.043000000000000003, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCB4", "CDX", 2, "NA HY", null, "HY", 7, 5, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.3.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922232", "9030542", - "CDX-NAHYBS3V5 - 1209", "Dow Jones CDX.NA.HY.B.3", - "CDX_NA_HY_S03_B___SWP_40/44", 2453196, 2455186, 0.04, "USD", - "ACT/360", false, 0.3, 4, "2I65BSBK3", "CDX", 3, "NA HY B", null, "HY", 5, 5, - null, 0.90908, 44, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.3.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922233", "9030579", - "CDX-NAHYS3V8 - 1209", "Dow Jones CDX.NA.HY.3", - "CDX_NA_HY_S03_100_SWP_93/100", 2453196, 2455186, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCC2", "CDX", 3, "NA HY", null, "HY", 8, 5, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.5.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922234", "9030438", - "CDX-NAHYS5V7 - 1212", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_07YR_94/100", 2453651, 2456282, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCE8", "CDX", 5, "NA HY", null, "HY", 7, 7, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.5.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922235", "9030439", - "CDX-NAHYS5V7 - 1215", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_10YR_94/100", 2453651, 2457377, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCE8", "CDX", 5, "NA HY", null, "HY", 7, 10, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.5.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922236", "9030496", - "CDX-NAHYS5V7 - 1210", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_94/100", 2453651, 2455551, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCE8", "CDX", 5, "NA HY", null, "HY", 7, 5, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922237", "9030635", - "CDX-NAHYBS6V2 - 0611", "Dow Jones CDX.NA.HY.B.6", - "CDX_NA_HY_S06_B___SWP_47/48", 2453823, 2455733, 0.030000000000000002, "USD", - "ACT/360", false, 0.3, 4, "2I65BSBN7", "CDX", 6, "NA HY B", null, "HY", 2, 5, - null, 0.97917, 48, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922238", "9030408", - "CDX-NAHYBBS9V2 - 1212", "CDX.NA.HY.BB.9", - "CDX_NA_HY_S09_BB__SWP_36/37", 2454372, 2456282, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBB6", "CDX", 9, "NA HY BB", null, "HY", 2, 5, - null, 0.97297, 37, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.9.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922239", "9030412", - "CDX-NAHYS9V5 - 1212", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_96/100", 2454372, 2456282, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBX7", "CDX", 9, "NA HY", null, "HY", 5, 5, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.9.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922240", "9030559", - "CDX-NAHYS9V5 - 1210", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_03YR_96/100", 2454372, 2455551, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBX7", "CDX", 9, "NA HY", null, "HY", 5, 3, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.9.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922241", "9030560", - "CDX-NAHYS9V5 - 1214", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_07YR_96/100", 2454372, 2457012, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBX7", "CDX", 9, "NA HY", null, "HY", 5, 7, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.9.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922242", "9030609", - "CDX-NAHYS9V5 - 1217", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_10YR_96/100", 2454372, 2458108, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBX7", "CDX", 9, "NA HY", null, "HY", 5, 10, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922243", "9030613", - "LCDXNAS9V6 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_96/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAU1", "LCDX", 9, "LCDXNA", null, "IG", 6, 5, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922244", "9030608", - "LCDXNAS10V6 - 0611", "LCDX.NA.10", - "CDX_NA_LN_S10_100_03YR_96/100", 2454561, 2455733, 0.0275, "USD", - "ACT/360", false, 0.6, 4, "5F199GAV9", "LCDX", 10, "LCDXNA", null, "IG", 6, 3, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922245", "9030611", - "LCDXNAS10V6 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_96/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAV9", "LCDX", 10, "LCDXNA", null, "IG", 6, 5, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.4.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922246", "9030238", - "CDX-NAHYS4V8 - 0610", "Dow Jones CDX.NA.HY.4", - "CDX_NA_HY_S04_100_SWP_93/100", 2453475, 2455368, 0.036000000000000004, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCD0", "CDX", 4, "NA HY", null, "HY", 8, 5, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.4.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922247", "9030249", - "CDX-NAHYBS4V3 - 0610", "DOW JONES CDX.NA.HY.B.4", - "CDX_NA_HY_S04_B___SWP_38/40", 2453475, 2455368, 0.034, "USD", - "ACT/360", false, 0.3, 4, "2I65BSBL1", "CDX", 4, "NA HY B", null, "HY", 3, 5, - null, 0.9500000000000001, 40, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922248", "9030157", - "CDX-NAHYBS5V3 - 1210", "Dow Jones CDX.NA.HY.B.5", - "CDX_NA_HY_S05_B___SWP_40/42", 2453651, 2455551, 0.034, "USD", - "ACT/360", false, 0.3, 4, "2I65BSBM9", "CDX", 5, "NA HY B", null, "HY", 3, 5, - null, 0.9523999999999999, 42, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.6.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922249", "9030165", - "CDX-NAHYS6V5 - 0609", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_03YR_96/100", 2453823, 2455003, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCF5", "CDX", 6, "NA HY", null, "HY", 5, 3, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.6.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922250", "9030257", - "CDX-NAHYS6V5 - 0616", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_10YR_96/100", 2453823, 2457560, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCF5", "CDX", 6, "NA HY", null, "HY", 5, 10, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.6.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922251", "9030260", - "CDX-NAHYS6V5 - 0613", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_07YR_96/100", 2453823, 2456464, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCF5", "CDX", 6, "NA HY", null, "HY", 5, 7, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.6.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922252", "9030262", - "CDX-NAHYS6V5 - 0611", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_96/100", 2453823, 2455733, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCF5", "CDX", 6, "NA HY", null, "HY", 5, 5, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922253", "9030154", - "CDX-NAHYBBS7V3 - 1211", "Dow Jones CDX.NA.HY.BB.7", - "CDX_NA_HY_S07_BB__SWP_36/38", 2454007, 2455917, 0.0205, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBD2", "CDX", 7, "NA HY BB", null, "HY", 3, 5, - null, 0.9473699999999999, 38, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922254", "9030073", - "LCDXNAS8V10 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_92/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAT4", "LCDX", 8, "LCDXNA", null, "IG", 10, 5, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("DJTRAC.XNA HB.5Y.2.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922256", "9030490", - "DJTRAC-XNAS2 HBV7 - 0309", "Dow Jones TRACX.NA.HY.HB.2", - "TRACX_NA_HY_S2_HB_SWP_26/33", 2452978, 2454911, 0.045000000000000005, "USD", - "ACT/360", false, 0.4, 4, "DJTRAC-XNAS2 HBV7", "DJTRAC", 2, "XNA HB", null, "HY", 7, 5, - null, 0.7878000000000001, 33, 0, "NYC", false, false, false, null, "Trac-X")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922258", "9030614", - "LCDXNAS10V6 - 0609", "LCDX.NA.10", - "CDX_NA_LN_S10_100_01YR_96/100", 2454561, 2455003, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GAV9", "LCDX", 10, "LCDXNA", null, "IG", 6, 1, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.9.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922259", "9030538", - "CDX-NAHYS9V5 - 1213", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_06YR_96/100", 2454372, 2456647, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBX7", "CDX", 9, "NA HY", null, "HY", 5, 6, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922260", "9030616", - "LCDXNAS10V6 - 0610", "LCDX.NA.10", - "CDX_NA_LN_S10_100_02YR_96/100", 2454561, 2455368, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GAV9", "LCDX", 10, "LCDXNA", null, "IG", 6, 2, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922261", "9030618", - "LCDXNAS10V6 - 0615", "LCDX.NA.10", - "CDX_NA_LN_S10_100_07YR_96/100", 2454561, 2457194, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GAV9", "LCDX", 10, "LCDXNA", null, "IG", 6, 7, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922262", "9030620", - "LCDXNAS10V6 - 0618", "LCDX.NA.10", - "CDX_NA_LN_S10_100_10YR_96/100", 2454561, 2458290, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GAV9", "LCDX", 10, "LCDXNA", null, "IG", 6, 10, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.9.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922263", "9030545", - "CDX-NAHYS9V5 - 1209", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_02YR_96/100", 2454372, 2455186, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBX7", "CDX", 9, "NA HY", null, "HY", 5, 2, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922264", "9030622", - "LCDXNAS10V6 - 0612", "LCDX.NA.10", - "CDX_NA_LN_S10_100_04YR_96/100", 2454561, 2456099, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GAV9", "LCDX", 10, "LCDXNA", null, "IG", 6, 4, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.9.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922265", "9030571", - "LCDXNAS9V6 - 1214", "LCDX.NA.9", - "CDX_NA_LN_S09_100_07YR_96/100", 2454378, 2457012, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GAU1", "LCDX", 9, "LCDXNA", null, "IG", 6, 7, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922266", "9030624", - "LCDXNAS10V6 - 0614", "LCDX.NA.10", - "CDX_NA_LN_S10_100_06YR_96/100", 2454561, 2456829, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GAV9", "LCDX", 10, "LCDXNA", null, "IG", 6, 6, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS10V6 FXD.LCDXNAV6 FXD.5Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922268", "9030626", - "LCDXNAS10V6 FXD - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_FXD_96/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GAV9 FXD", "LCDXNAS10V6 FXD", 10, "LCDXNAV6 FXD", null, "IG", 6, 5, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.9.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922270", "9030573", - "LCDXNAS9V6 - 1217", "LCDX.NA.9", - "CDX_NA_LN_S09_100_10YR_96/100", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GAU1", "LCDX", 9, "LCDXNA", null, "IG", 6, 10, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.9.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922271", "9030537", - "CDX-NAHYS9V5 - 1211", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_04YR_96/100", 2454372, 2455916, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBX7", "CDX", 9, "NA HY", null, "HY", 5, 4, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.9.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922272", "9030574", - "LCDXNAS9V6 - 1211", "LCDX.NA.9", - "CDX_NA_LN_S09_100_04YR_96/100", 2454378, 2455916, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GAU1", "LCDX", 9, "LCDXNA", null, "IG", 6, 4, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.9.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922273", "9030600", - "LCDXNAS9V6 - 1213", "LCDX.NA.9", - "CDX_NA_LN_S09_100_06YR_96/100", 2454378, 2456647, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GAU1", "LCDX", 9, "LCDXNA", null, "IG", 6, 6, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.9.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922274", "9030604", - "LCDXNAS9V6 - 1209", "LCDX.NA.9", - "CDX_NA_LN_S09_100_02YR_96/100", 2454378, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GAU1", "LCDX", 9, "LCDXNA", null, "IG", 6, 2, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.9.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922275", "9030605", - "LCDXNAS9V6 - 1210", "LCDX.NA.9", - "CDX_NA_LN_S09_100_03YR_96/100", 2454378, 2455551, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GAU1", "LCDX", 9, "LCDXNA", null, "IG", 6, 3, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V6 FXD.LCDXNAV6 FXD.5Y.9.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922276", "9030607", - "LCDXNAS9V6 FXD - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_FXD_96/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GAU1-FXD", "LCDXNAS9V6 FXD", 9, "LCDXNAV6 FXD", null, "IG", 6, 5, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V10 FXD.LCDXNAV10 FXD.5Y.8.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922277", "9030393", - "LCDXNAS8V10 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_92/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GAT4 FXD", "LCDXNAS8V10 FXD", 8, "LCDXNAV10 FXD", null, "IG", 10, 5, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922278", "9030395", - "LCDXNAS8V10 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_92/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GAT4", "LCDX", 8, "LCDXNA", null, "IG", 10, 6, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922279", "9030396", - "LCDXNAS8V10 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_92/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GAT4", "LCDX", 8, "LCDXNA", null, "IG", 10, 7, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922281", "9030400", - "LCDXNAS8V10 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_92/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GAT4", "LCDX", 8, "LCDXNA", null, "IG", 10, 4, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922282", "9030407", - "LCDXNAS8V10 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_92/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GAT4", "LCDX", 8, "LCDXNA", null, "IG", 10, 10, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.2.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922286", "9030554", - "CDX-NAHYBS2V4 - 0909", "Dow Jones CDX.NA.HY.B.2", - "DJIBOXX_NA_HY_S02_B___SWP_38/43", 2453088, 2455095, 0.048, "USD", - "ACT/360", false, 0.3, 4, "2I65BSBJ6", "CDX", 2, "NA HY B", null, "HY", 4, 5, - null, 0.8837, 43, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJIBOXX.NA HY.5Y.2.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922289", "9030568", - "DJIBOXX-NA-HY-S2V7 - 0909", "Dow Jones CDX.NA.HY.2", - "DJIBOXX_NA_HY_S02_100_SWP_91/100", 2453088, 2455095, 0.043000000000000003, "USD", - "ACT/360", false, 0.3, 4, "DJIBOXX-NA-HY-S2V7", "DJIBOXX", 2, "NA HY", null, "HY", 7, 5, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJTRAC.XNABS.5Y.2.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922290", "9030494", - "DJTRAC-XNAS2BS V6 - 0309", "Dow Jones TRACX.NA.HY.B.2", - "TRACX_NA_HY_S02_B___SWP_54/59", 2452978, 2454913, 0.041, "USD", - "ACT/360", false, 0.3, 4, "DJTRAC-XNAS2BS V6", "DJTRAC", 2, "XNABS", null, "HY", 6, 5, - null, 0.918, 59, 0, "NYC", false, false, false, null, "Trac-X")); - - UpdateCDXRefDataMap ("DJCDX.NA HY HB.5Y.3.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922291", "9030580", - "DJCDX-NAHYHBS3V6 - 1209", "Dow Jones CDX.NA.HY.HB.3", - "CDX_NA_HY_S03_HB__SWP_25/30", 2453196, 2455186, 0.0625, "USD", - "ACT/360", false, 0.3, 4, "2I65BWBI9", "DJCDX", 3, "NA HY HB", null, "HY", 6, 5, - null, 0.8331999999999999, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.6.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922293", "9030597", - "CDX-NAHYS6V5 - 0610", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_04YR_96/100", 2453823, 2455368, 0.0345, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCF5", "CDX", 6, "NA HY", null, "HY", 5, 4, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.6.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922295", "9030598", - "CDX-NAHYS6V5 - 0612", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_06YR_96/100", 2453823, 2456099, 0.0345, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCF5", "CDX", 6, "NA HY", null, "HY", 5, 6, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922302", "9030008", - "CDX-NAHYS8V4 - 0609", "Dow Jones CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_02YR_97/100", 2454188, 2455003, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBR0", "CDX", 8, "NA HY", null, "HY", 4, 2, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.1.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922303", "9030134", - "CDX-NAHYBS1V4 - 0309", "Dow Jones CDX.NA.HY.B.1", - "CDX_NA_HY_S01_B___SWP_39/43", 2452720, 2454911, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSBI8", "CDX", 1, "NA HY B", null, "HY", 4, 5, - null, 0.90696, 43, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.1.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922304", "9030150", - "CDX-NAHYBBS1V4 - 0309", "Dow Jones CDX.NA.HY.BB.1", - "CDX_NA_HY_S01_BB__SWP_39/44", 2452934, 2454911, 0.029, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBC4", "CDX", 1, "NA HY BB", null, "HY", 4, 5, - null, 0.8863500000000001, 44, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJTRAC.XNABS.5Y.1.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922305", "9030524", - "DJTRAC-XNAS1BS V6 - 0309", "DOW JONES TRACX NAHY S1B S", - "TRACX_NA_HY_S1_B_SWP_54/59", 2452978, 2454911, 0.045000000000000005, "USD", - "ACT/360", false, 0.4, 4, "DJTRAC-XNAS1BS V6", "DJTRAC", 1, "XNABS", null, "HY", 6, 5, - null, 0.918, 59, 0, "NYC", false, false, false, null, "Trac-X")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922306", "9030015", - "CDX-NAHYS8V4 - 0611", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_04YR_97/100", 2454188, 2455733, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBR0", "CDX", 8, "NA HY", null, "HY", 4, 4, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJTRAC.XNA HB.5Y.1.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922308", "9030547", - "DJTRAC-XNAS1 HB V7 - 0309", "Dow Jones TRACX.NA.HY.HB.1", - "TRACX_NA_HY_S02_HB__SWP_26/33", 2452978, 2454911, 0.045000000000000005, "USD", - "ACT/360", false, 0.3, 4, "DJTRAC-XNAS1 HB V7", "DJTRAC", 1, "XNA HB", null, "HY", 7, 5, - null, 0.7878000000000001, 33, 0, "NYC", false, false, false, null, "Trac-X")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922309", "9030020", - "CDX-NAHYS8V4 - 0613", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_06YR_97/100", 2454188, 2456464, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBR0", "CDX", 8, "NA HY", null, "HY", 4, 6, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922310", "9030074", - "LCDXNAS8V10 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_92/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GAT4", "LCDX", 8, "LCDXNA", null, "IG", 10, 3, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.3.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922311", "9030229", - "CDX-NAHYS3V8 - 1214", "Dow Jones CDX.NA.HY.3", - "CDX_NA_HY_S03_100_SWP_10YR_93/100", 2453196, 2457012, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCC2", "CDX", 3, "NA HY", null, "HY", 8, 10, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.3.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922335", "9031281", - "ITRAXX-LevXS3V3 - 1213", "ITRAXX LEVX SENIOR SERIES 3 VERSION 3", - "ITRAXX LEVX SENIOR SERIES 3 VERSION 3 EUR 1ST SEC RES I03 CDS", 2454739, 2456647, 0.0575, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJBF9", "ITRAXX", 3, "LevX", null, "IG", 3, 5, - null, 0.9734, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevXSub.5Y.3.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922336", "9031283", - "ITRAXX-LevXSubS3V3 - 1213", "ITRAXX LEVX SUBORDINATE SERIES 3 VERSION 3", - "ITRAXX LEVX SUBORDINATE SERIES 3 VERSION 3 EUR 2ND SEC RES I03 CDS", 2454739, 2456647, 0.12000000000000001, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKBK5", "ITRAXX", 3, "LevXSub", null, "IG", 3, 5, - null, 0.9556, 45, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.2.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922337", "9031286", - "ITRAXX-LevXS2V4 - 0613", "ITRAXX LEVX SENIOR SERIES 2 VERSION 4", - "ITRAXX LEVX SENIOR SERIES 2 VERSION 4 EUR 1ST SEC RES I03 CDS", 2454543, 2456464, 0.052500000000000005, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJBE2", "ITRAXX", 2, "LevX", null, "IG", 4, 5, - null, 0.9466, 74, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevXSub.5Y.2.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922338", "9031223", - "ITRAXX-LevXSubS2V3 - 0613", "ITRAXX LEVX SUBORDINATE SERIES 2 VERSION 3", - "ITRAXX LEVX SUBORDINATE SERIES 2 VERSION 3 EUR 2ND SEC RES I03 CDS", 2454543, 2456464, 0.0825, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKBJ8", "ITRAXX", 2, "LevXSub", null, "IG", 3, 5, - null, 0.9556, 45, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LevXSenS1V12.LevXSen.5Y.1.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922339", "9029443", - "LevXSenS1V12 - 1211", "ITRAXX LEVX SENIOR SERIES 1 VERSION 12", - "ITRAXX LEVX SENIOR SERIES 1 VERSION 12 EUR 1ST SEC MMR I03 CDS", 2453999, 2455916, 0.017, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJBC6", "LevXSenS1V12", 1, "LevXSen", null, "IG", 12, 5, - null, 0.6855, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LevXSubS1V15.LevXSub.5Y.1.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922340", "9031232", - "LevXSubS1V15 - 1211", "ITRAXX LEVX SUBORDINATE SERIES 1 VERSION 15", - "ITRAXX LEVX SUBORDINATE SERIES 1 VERSION 15 EUR 2ND SEC MMR I03 CDS", 2454180, 2455916, 0.045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKBI0", "LevXSubS1V15", 1, "LevXSub", null, "IG", 15, 5, - null, 0.6001, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("TRACXNA. HY HBV7xCKC.5Y.2.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922345", "9031511", - "TRACXNA-HYHB-S2V7xCKC - 0409", "TRAC-X NA HIGH YIELD SERIES 2 TRUST 4 FLOAT X CKC 27/33", - "TRACX_NA_HY_S2_HB__SWP_27/33", 2452978, 2454925, 0.061500000000000006, "USD", - "ACT/360", false, 0.4, 4, "TRACXNA-HYHB-S2V7xCKC", "TRACXNA", 2, "HY HBV7xCKC", null, "HY", 7, 5, - null, 0.8181820000000001, 33, 0, "NYC", false, false, false, null, "Trac-X")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.3.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922348", "9031256", - "ITRAXX-LevXS3V4 - 1213", "ITRAXX LEVX SENIOR SERIES 3 VERSION 4", - "ITRAXX LEVX SENIOR SERIES 3 VERSION 4 EUR 1ST SEC RES I03 CDS", 2454739, 2456647, 0.0575, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJBH5", "ITRAXX", 3, "LevX", null, "IG", 4, 5, - null, 0.96, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevXSub.5Y.3.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922349", "9031239", - "ITRAXX-LevXSubS3V4 - 1213", "ITRAXX LEVX SUBORDINATE SERIES 3 VERSION 4", - "ITRAXX LEVX SUBORDINATE SERIES 3 VERSION 4 EUR 2ND SEC RES I03 CDS", 2454739, 2456647, 0.12000000000000001, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKBN9", "ITRAXX", 3, "LevXSub", null, "IG", 4, 5, - null, 0.9334, 45, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.2.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922350", "9031244", - "ITRAXX-LevXS2V5 - 0613", "ITRAXX LEVX SENIOR SERIES 2 VERSION 5", - "ITRAXX LEVX SENIOR SERIES 2 VERSION 5 EUR 1ST SEC RES I03 CDS", 2454543, 2456464, 0.052500000000000005, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJBG7", "ITRAXX", 2, "LevX", null, "IG", 5, 5, - null, 0.9464, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevXSub.5Y.2.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922351", "9031254", - "ITRAXX-LevXSubS2V4 - 0613", "ITRAXX LEVX SUBORDINATE SERIES 2 VERSION 4", - "ITRAXX LEVX SUBORDINATE SERIES 2 VERSION 4 EUR 2ND SEC RES I03 CDS", 2454543, 2456464, 0.0825, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKBM1", "ITRAXX", 2, "LevXSub", null, "IG", 4, 5, - null, 0.9334, 45, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LevXSubS1V16.LevXSub.5Y.1.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922352", "9031245", - "LevXSubS1V16 - 1211", "ITRAXX LEVX SUBORDINATE SERIES 1 VERSION 16", - "ITRAXX LEVX SUBORDINATE SERIES 1 VERSION 16 EUR 2ND SEC MMR I03 CDS", 2454180, 2455916, 0.045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKBL3", "LevXSubS1V16", 1, "LevXSub", null, "IG", 16, 5, - null, 0.5715, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.5.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922355", "9031775", - "CDX-NAHYS5V8 - 1215", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_10YR_93/100", 2453651, 2457377, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCJ7", "CDX", 5, "NA HY", null, "HY", 8, 10, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.5.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922356", "9031776", - "CDX-NAHYS5V8 - 1210", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_93/100", 2453651, 2455551, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCJ7", "CDX", 5, "NA HY", null, "HY", 8, 5, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.6.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922357", "9031783", - "CDX-NAHYS6V6 - 0609", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_03YR_95/100", 2453823, 2455003, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCK4", "CDX", 6, "NA HY", null, "HY", 6, 3, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.1.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922360", "9031704", - "CDX-NAHYS1V7 - 0309", "Dow Jones CDX.NA.HY.1", - "CDX_NA_HY_S01_100_SWP_89/100", 2452934, 2454911, 0.0425, "USD", - "ACT/360", false, 0.3, 4, "2I65BRBY5", "CDX", 1, "NA HY", null, "HY", 7, 5, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.3.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922362", "9031784", - "CDX-NAHYS3V9 - 1209", "Dow Jones CDX.NA.HY.3", - "CDX_NA_HY_S03_100_SWP_92/100", 2453196, 2455186, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCH1", "CDX", 3, "NA HY", null, "HY", 9, 5, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.3.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922363", "9031785", - "CDX-NAHYBS3V6 - 1209", "Dow Jones CDX.NA.HY.B.3", - "CDX_NA_HY_S03_B___SWP_39/44", 2453196, 2455186, 0.04, "USD", - "ACT/360", false, 0.3, 4, "2I65BSCJ5", "CDX", 3, "NA HY B", null, "HY", 6, 5, - null, 0.8863500000000001, 44, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.4.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922364", "9031787", - "CDX-NAHYS4V9 - 0610", "Dow Jones CDX.NA.HY.4", - "CDX_NA_HY_S04_100_SWP_92/100", 2453475, 2455368, 0.036000000000000004, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCI9", "CDX", 4, "NA HY", null, "HY", 9, 5, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.4.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922365", "9031685", - "CDX-NAHYBS4V4 - 0610", "DOW JONES CDX.NA.HY.B.4", - "CDX_NA_HY_S04_B___SWP_37/40", 2453475, 2455368, 0.034, "USD", - "ACT/360", false, 0.3, 4, "2I65BSCK2", "CDX", 4, "NA HY B", null, "HY", 4, 5, - null, 0.925, 40, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.5.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922366", "9031688", - "CDX-NAHYS5V8 - 1212", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_07YR_93/100", 2453651, 2456282, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCJ7", "CDX", 5, "NA HY", null, "HY", 8, 7, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.6.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922367", "9031786", - "CDX-NAHYS6V6 - 0616", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_10YR_95/100", 2453823, 2457560, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCK4", "CDX", 6, "NA HY", null, "HY", 6, 10, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.6.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922368", "9031695", - "CDX-NAHYS6V6 - 0613", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_07YR_95/100", 2453823, 2456464, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCK4", "CDX", 6, "NA HY", null, "HY", 6, 7, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.6.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922369", "9031698", - "CDX-NAHYS6V6 - 0611", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_95/100", 2453823, 2455733, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCK4", "CDX", 6, "NA HY", null, "HY", 6, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922370", "9031788", - "CDX-NAHYBS6V3 - 0611", "Dow Jones CDX.NA.HY.B.6", - "CDX_NA_HY_S06_B___SWP_46/48", 2453823, 2455733, 0.030000000000000002, "USD", - "ACT/360", false, 0.3, 4, "2I65BSCM8", "CDX", 6, "NA HY B", null, "HY", 3, 5, - null, 0.9583400000000001, 48, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.7.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922371", "9031789", - "CDX-NAHYS7V5 - 1211", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_96/100", 2454007, 2455916, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCL2", "CDX", 7, "NA HY", null, "HY", 5, 5, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.7.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922372", "9031797", - "CDX-NAHYS7V5 - 1213", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_07YR_96/100", 2454007, 2456647, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCL2", "CDX", 7, "NA HY", null, "HY", 5, 7, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.7.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922373", "9031800", - "CDX-NAHYS7V5 - 1209", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_03YR_96/100", 2454007, 2455186, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCL2", "CDX", 7, "NA HY", null, "HY", 5, 3, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.7.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922374", "9031735", - "CDX-NAHYS7V5 - 1216", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_10YR_96/100", 2454007, 2457743, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCL2", "CDX", 7, "NA HY", null, "HY", 5, 10, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922375", "9031736", - "CDX-NAHYBS7V2 - 1211", "Dow Jones CDX.NA.HY.B.7", - "CDX_NA_HY_S07_B___SWP_49/50", 2454007, 2455916, 0.030000000000000002, "USD", - "ACT/360", false, 0.3, 4, "2I65BSCN6", "CDX", 7, "NA HY B", null, "HY", 2, 5, - null, 0.98, 50, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.8.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922376", "9031737", - "CDX-NAHYS8V5 - 0612", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_96/100", 2454188, 2456099, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCM0", "CDX", 8, "NA HY", null, "HY", 5, 5, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet17() - { - UpdateCDXRefDataMap ("CDX.NA HY.3Y.8.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922377", "9031691", - "CDX-NAHYS8V5 - 0610", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_03YR_96/100", 2454188, 2455368, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCM0", "CDX", 8, "NA HY", null, "HY", 5, 3, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.8.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922378", "9031692", - "CDX-NAHYS8V5 - 0614", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_07YR_96/100", 2454188, 2456829, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCM0", "CDX", 8, "NA HY", null, "HY", 5, 7, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.8.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922379", "9031738", - "CDX-NAHYS8V5 - 0617", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_10YR_96/100", 2454188, 2457925, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCM0", "CDX", 8, "NA HY", null, "HY", 5, 10, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922380", "9031743", - "CDX-NAHYBS8V3 - 0612", "CDX.NA.HY.B.8", - "CDX_NA_HY_S08_B___SWP_47/49", 2454188, 2456099, 0.025, "USD", - "ACT/360", false, 0.3, 4, "2I65BSCO4", "CDX", 8, "NA HY B", null, "HY", 3, 5, - null, 0.95918, 49, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.9.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922381", "9031745", - "CDX-NAHYS9V6 - 1212", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_95/100", 2454372, 2456282, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCN8", "CDX", 9, "NA HY", null, "HY", 6, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.9.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922382", "9031746", - "CDX-NAHYS9V6 - 1210", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_03YR_95/100", 2454372, 2455551, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCN8", "CDX", 9, "NA HY", null, "HY", 6, 3, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.9.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922383", "9031748", - "CDX-NAHYS9V6 - 1214", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_07YR_95/100", 2454372, 2457012, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCN8", "CDX", 9, "NA HY", null, "HY", 6, 7, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.9.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922384", "9031749", - "CDX-NAHYS9V6 - 1217", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_10YR_95/100", 2454372, 2458108, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCN8", "CDX", 9, "NA HY", null, "HY", 6, 10, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922385", "9031810", - "CDX-NAHYBS9V4 - 1212", "CDX.NA.HY.B.9", - "CDX_NA_HY_S09_B___SWP_43/46", 2454372, 2456282, 0.035, "USD", - "ACT/360", false, 0.3, 4, "2I65BSCP1", "CDX", 9, "NA HY B", null, "HY", 4, 5, - null, 0.93479, 46, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922386", "9031816", - "CDX-NAHYS10V3 - 0613", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_98/100", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCO6", "CDX", 10, "NA HY", null, "HY", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922387", "9031817", - "CDX-NAHYS10V3 - 0611", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_03YR_98/100", 2454554, 2455733, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCO6", "CDX", 10, "NA HY", null, "HY", 3, 3, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922388", "9031819", - "CDX-NAHYS10V3 - 0615", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_07YR_98/100", 2454554, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCO6", "CDX", 10, "NA HY", null, "HY", 3, 7, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922389", "9031820", - "CDX-NAHYS10V3 - 0618", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_10YR_98/100", 2454554, 2458290, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCO6", "CDX", 10, "NA HY", null, "HY", 3, 10, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.11.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922390", "9031833", - "CDX-NAHYS11V3 - 1213", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_98/100", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCP3", "CDX", 11, "NA HY", null, "HY", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.11.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922391", "9031798", - "CDX-NAHYS11V3 - 1211", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_03YR_98/100", 2454738, 2455916, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCP3", "CDX", 11, "NA HY", null, "HY", 3, 3, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.11.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922392", "9031799", - "CDX-NAHYS11V3 - 1215", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_07YR_98/100", 2454738, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCP3", "CDX", 11, "NA HY", null, "HY", 3, 7, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.11.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922393", "9031801", - "CDX-NAHYS11V3 - 1218", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_10YR_98/100", 2454738, 2458473, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCP3", "CDX", 11, "NA HY", null, "HY", 3, 10, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.1.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922394", "9031705", - "CDX-NAHYBS1V5 - 0309", "Dow Jones CDX.NA.HY.B.1", - "CDX_NA_HY_S01_B___SWP_38/43", 2452720, 2454911, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSCH9", "CDX", 1, "NA HY B", null, "HY", 5, 5, - null, 0.88371, 43, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.2.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922395", "9031777", - "CDX-NAHYBS2V5 - 0909", "Dow Jones CDX.NA.HY.B.2", - "DJIBOXX_NA_HY_S02_B___SWP_37/43", 2453088, 2455095, 0.048, "USD", - "ACT/360", false, 0.3, 4, "2I65BSCI7", "CDX", 2, "NA HY B", null, "HY", 5, 5, - null, 0.86045, 43, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJIBOXX.NA HY.5Y.2.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922396", "9031781", - "DJIBOXX-NA-HY-S2V8 - 0909", "Dow Jones CDX.NA.HY.2", - "DJIBOXX_NA_HY_S02_100_SWP_90/100", 2453088, 2455095, 0.043000000000000003, "USD", - "ACT/360", false, 0.3, 4, "DJIBOXX-NA-HY-S2V8", "DJIBOXX", 2, "NA HY", null, "HY", 8, 5, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.3.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922397", "9031782", - "CDX-NAHYS3V9 - 1214", "Dow Jones CDX.NA.HY.3", - "CDX_NA_HY_S03_100_SWP_10YR_92/100", 2453196, 2457012, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCH1", "CDX", 3, "NA HY", null, "HY", 9, 10, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.6.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922399", "9031697", - "CDX-NAHYS6V6 - 0610", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_04YR_95/100", 2453823, 2455368, 0.0345, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCK4", "CDX", 6, "NA HY", null, "HY", 6, 4, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.9.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922400", "9031809", - "CDX-NAHYS9V6 - 1211", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_04YR_ 95/100", 2454372, 2455916, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCN8", "CDX", 9, "NA HY", null, "HY", 6, 4, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922401", "9031814", - "CDX-NAHYS10V3 - 0610", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_02YR_98/100", 2454554, 2455368, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCO6", "CDX", 10, "NA HY", null, "HY", 3, 2, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922402", "9031821", - "CDX-NAHYS10V3 - 0609", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_01YR_98/100", 2454554, 2455003, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCO6", "CDX", 10, "NA HY", null, "HY", 3, 1, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922403", "9031831", - "CDX-NAHYS10V3 - 0612", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_04YR_98/100", 2454554, 2456099, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCO6", "CDX", 10, "NA HY", null, "HY", 3, 4, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922404", "9031832", - "CDX-NAHYS10V3 - 0614", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_06YR_98/100", 2454554, 2456829, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCO6", "CDX", 10, "NA HY", null, "HY", 3, 6, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922405", "9032083", - "CDX-NAHYHBS10V3 - 0613", "CDX.NA.HY.HB.10", - "CDX_NA_HY_S10_HB__SWP_28/30", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWBJ7", "CDX", 10, "NA HY HB", null, "HY", 3, 5, - null, 0.9333400000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.11.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922406", "9031834", - "CDX-NAHYS11V3 - 1209", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_01YR_98/100", 2454738, 2455186, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCP3", "CDX", 11, "NA HY", null, "HY", 3, 1, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.11.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922407", "9031802", - "CDX-NAHYS11V3 - 1210", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_02YR_98/100", 2454738, 2455551, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCP3", "CDX", 11, "NA HY", null, "HY", 3, 2, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.11.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922408", "9031803", - "CDX-NAHYS11V3 - 1212", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_04YR_98/100", 2454738, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCP3", "CDX", 11, "NA HY", null, "HY", 3, 4, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.11.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922409", "9031805", - "CDX-NAHYS11V3 - 1214", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_06YR_98/100", 2454738, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCP3", "CDX", 11, "NA HY", null, "HY", 3, 6, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.6.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922410", "9031696", - "CDX-NAHYS6V6 - 0612", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_06YR_95/100", 2453823, 2456099, 0.0345, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCK4", "CDX", 6, "NA HY", null, "HY", 6, 6, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.8.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922411", "9031741", - "CDX-NAHYS8V5 - 0611", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_04YR_96/100", 2454188, 2455733, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCM0", "CDX", 8, "NA HY", null, "HY", 5, 4, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.8.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922412", "9031742", - "CDX-NAHYS8V5 - 0613", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_06YR_96/100", 2454188, 2456464, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCM0", "CDX", 8, "NA HY", null, "HY", 5, 6, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.8.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922413", "9031744", - "CDX-NAHYS8V5 - 0609", "Dow Jones CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_02YR_96/100", 2454188, 2455003, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCM0", "CDX", 8, "NA HY", null, "HY", 5, 2, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.9.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922415", "9031750", - "CDX-NAHYS9V6 - 1213", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_06YR_95/100", 2454372, 2456647, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCN8", "CDX", 9, "NA HY", null, "HY", 6, 6, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.9.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922416", "9031808", - "CDX-NAHYS9V6 - 1209", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_02YR_95/100", 2454372, 2455186, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCN8", "CDX", 9, "NA HY", null, "HY", 6, 2, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.5.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922417", "9031780", - "CDX-NAHYBS5V4 - 1210", "Dow Jones CDX.NA.HY.B.5", - "CDX_NA_HY_S05_B___SWP_39/42", 2453651, 2455551, 0.034, "USD", - "ACT/360", false, 0.3, 4, "2I65BSCL0", "CDX", 5, "NA HY B", null, "HY", 4, 5, - null, 0.9286, 42, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.11.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922418", "9031806", - "CDX-NAHYHBS11V3 - 1213", "CDX.NA.HY.HB.11", - "CDX_NA_HY_S11_HB__SWP_28/30", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWBK4", "CDX", 11, "NA HY HB", null, "HY", 3, 5, - null, 0.9333400000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922443", "9033951", - "LCDXNAS9V7 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_95/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GAX5", "LCDX", 9, "LCDXNA", null, "IG", 7, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922444", "9033934", - "LCDXNAS8V11 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_91/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAW7", "LCDX", 8, "LCDXNA", null, "IG", 11, 5, - null, 0.91, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922445", "9033949", - "LCDXNAS8V11 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_91/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GAW7", "LCDX", 8, "LCDXNA", null, "IG", 11, 3, - null, 0.91, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.9.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922446", "9033958", - "LCDXNAS9V7 - 1214", "LCDX.NA.9", - "CDX_NA_LN_S09_100_07YR_95/100", 2454378, 2457012, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GAX5", "LCDX", 9, "LCDXNA", null, "IG", 7, 7, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.9.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922447", "9033959", - "LCDXNAS9V7 - 1217", "LCDX.NA.9", - "CDX_NA_LN_S09_100_10YR_95/100", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GAX5", "LCDX", 9, "LCDXNA", null, "IG", 7, 10, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V11 FXD.LCDXNAV11 FXD.5Y.8.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922448", "9033937", - "LCDXNAS8V11 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_91/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GAW7 FXD", "LCDXNAS8V11 FXD", 8, "LCDXNAV11 FXD", null, "IG", 11, 5, - null, 0.91, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.9.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922449", "9033952", - "LCDXNAS9V7 - 1211", "LCDX.NA.9", - "CDX_NA_LN_S09_100_04YR_95/100", 2454378, 2455916, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GAX5", "LCDX", 9, "LCDXNA", null, "IG", 7, 4, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.9.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922450", "9033953", - "LCDXNAS9V7 - 1213", "LCDX.NA.9", - "CDX_NA_LN_S09_100_06YR_95/100", 2454378, 2456647, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GAX5", "LCDX", 9, "LCDXNA", null, "IG", 7, 6, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922451", "9033938", - "LCDXNAS8V11 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_91/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GAW7", "LCDX", 8, "LCDXNA", null, "IG", 11, 6, - null, 0.91, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922452", "9033945", - "LCDXNAS8V11 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_91/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GAW7", "LCDX", 8, "LCDXNA", null, "IG", 11, 7, - null, 0.91, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.10.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922453", "9033947", - "LCDXNAS10V7 - 0611", "LCDX.NA.10", - "CDX_NA_LN_S10_100_03YR_95/100", 2454561, 2455733, 0.0275, "USD", - "ACT/360", false, 0.6, 4, "5F199GAY3", "LCDX", 10, "LCDXNA", null, "IG", 7, 3, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922454", "9033954", - "LCDXNAS10V7 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_95/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GAY3", "LCDX", 10, "LCDXNA", null, "IG", 7, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.10.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922456", "9033948", - "LCDXNAS10V7 - 0609", "LCDX.NA.10", - "CDX_NA_LN_S10_100_01YR_95/100", 2454561, 2455003, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GAY3", "LCDX", 10, "LCDXNA", null, "IG", 7, 1, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922457", "9033960", - "LCDXNAS8V11 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_91/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GAW7", "LCDX", 8, "LCDXNA", null, "IG", 11, 4, - null, 0.91, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.10.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922458", "9033956", - "LCDXNAS10V7 - 0610", "LCDX.NA.10", - "CDX_NA_LN_S10_100_02YR_95/100", 2454561, 2455368, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GAY3", "LCDX", 10, "LCDXNA", null, "IG", 7, 2, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922459", "9033961", - "LCDXNAS8V11 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_91/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GAW7", "LCDX", 8, "LCDXNA", null, "IG", 11, 10, - null, 0.91, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.9.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922460", "9033967", - "LCDXNAS9V7 - 1209", "LCDX.NA.9", - "CDX_NA_LN_S09_100_02YR_95/100", 2454378, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GAX5", "LCDX", 9, "LCDXNA", null, "IG", 7, 2, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.9.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922461", "9033968", - "LCDXNAS9V7 - 1210", "LCDX.NA.9", - "CDX_NA_LN_S09_100_03YR_95/100", 2454378, 2455551, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GAX5", "LCDX", 9, "LCDXNA", null, "IG", 7, 3, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V7 FXD.LCDXNAV7 FXD.5Y.9.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922462", "9033940", - "LCDXNAS9V7 FXD - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_FXD_95/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GAX5-FXD", "LCDXNAS9V7 FXD", 9, "LCDXNAV7 FXD", null, "IG", 7, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.10.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922463", "9033962", - "LCDXNAS10V7 - 0615", "LCDX.NA.10", - "CDX_NA_LN_S10_100_07YR_95/100", 2454561, 2457194, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GAY3", "LCDX", 10, "LCDXNA", null, "IG", 7, 7, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.10.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922464", "9033966", - "LCDXNAS10V7 - 0618", "LCDX.NA.10", - "CDX_NA_LN_S10_100_10YR_95/100", 2454561, 2458290, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GAY3", "LCDX", 10, "LCDXNA", null, "IG", 7, 10, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.10.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922465", "9033971", - "LCDXNAS10V7 - 0612", "LCDX.NA.10", - "CDX_NA_LN_S10_100_04YR_95/100", 2454561, 2456099, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GAY3", "LCDX", 10, "LCDXNA", null, "IG", 7, 4, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.10.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922466", "9033975", - "LCDXNAS10V7 - 0614", "LCDX.NA.10", - "CDX_NA_LN_S10_100_06YR_95/100", 2454561, 2456829, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GAY3", "LCDX", 10, "LCDXNA", null, "IG", 7, 6, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS10V7 FXD.LCDXNAV7 FXD.5Y.10.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922467", "9033978", - "LCDXNAS10V7 FXD - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_FXD_95/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GAY3 FXD", "LCDXNAS10V7 FXD", 10, "LCDXNAV7 FXD", null, "IG", 7, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.2.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922480", "9035610", - "CDX-NAHYBS2V6 - 0909", "Dow Jones CDX.NA.HY.B.2", - "DJIBOXX_NA_HY_S02_B___SWP_36/43", 2453088, 2455095, 0.048, "USD", - "ACT/360", false, 0.3, 4, "2I65BSCR7", "CDX", 2, "NA HY B", null, "HY", 6, 5, - null, 0.8372, 43, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.10.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922483", "9035572", - "LCDXNAS10V8 - 0614", "LCDX.NA.10", - "CDX_NA_LN_S10_100_06YR_94/100", 2454561, 2456829, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBB2", "LCDX", 10, "LCDXNA", null, "IG", 8, 6, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS10V8 FXD.LCDXNAV8 FXD.5Y.10.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922484", "9035689", - "LCDXNAS10V8 FXD - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_FXD_94/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBB2 FXD", "LCDXNAS10V8 FXD", 10, "LCDXNAV8 FXD", null, "IG", 8, 5, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922485", "9035954", - "CDX-NAHYBS11V2 - 1213", "CDX.NA.HY.B.11", - "CDX_NA_HY_S11_B___SWP_35/36", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSDA3", "CDX", 11, "NA HY B", null, "HY", 2, 5, - null, 0.97223, 36, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.11.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922486", "9035961", - "CDX-NAHYS11V4 - 1218", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_10YR_97/100", 2454738, 2458473, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDA5", "CDX", 11, "NA HY", null, "HY", 4, 10, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.11.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922487", "9036052", - "CDX-NAHYS11V4 - 1209", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_01YR_97/100", 2454738, 2455186, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDA5", "CDX", 11, "NA HY", null, "HY", 4, 1, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.11.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922488", "9036061", - "CDX-NAHYS11V4 - 1210", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_02YR_97/100", 2454738, 2455551, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDA5", "CDX", 11, "NA HY", null, "HY", 4, 2, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.11.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922489", "9036065", - "CDX-NAHYS11V4 - 1214", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_06YR_97/100", 2454738, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDA5", "CDX", 11, "NA HY", null, "HY", 4, 6, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.11.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922490", "9036090", - "CDX-NAHYS11V4 - 1212", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_04YR_97/100", 2454738, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDA5", "CDX", 11, "NA HY", null, "HY", 4, 4, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.11.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922491", "9036093", - "CDX-NAHYS11V4 - 1213", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_97/100", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDA5", "CDX", 11, "NA HY", null, "HY", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.11.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922492", "9036099", - "CDX-NAHYS11V4 - 1211", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_03YR_97/100", 2454738, 2455916, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDA5", "CDX", 11, "NA HY", null, "HY", 4, 3, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.11.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922494", "9036110", - "CDX-NAHYS11V4 - 1215", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_07YR_97/100", 2454738, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDA5", "CDX", 11, "NA HY", null, "HY", 4, 7, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.2.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922495", "9031778", - "CDX-NAHYS2V8 - 0909", "Dow Jones CDX.NA.HY.2", - "CDX_NA_HY_S02_100_SWP_90/100", 2453088, 2455095, 0.043000000000000003, "USD", - "ACT/360", false, 0.4, 4, "2I65BRBZ2", "CDX", 2, "NA HY", null, "HY", 8, 5, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.8.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922497", "9035785", - "CDX-NAHYS8V6 - 0609", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_02YR_95/100", 2454188, 2455003, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCX6", "CDX", 8, "NA HY", null, "HY", 6, 2, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922498", "9035793", - "CDX-NAHYBS8V4 - 0612", "CDX.NA.HY.B.8", - "CDX_NA_HY_S08_B___SWP_46/49", 2454188, 2456099, 0.025, "USD", - "ACT/360", false, 0.3, 4, "2I65BSCX4", "CDX", 8, "NA HY B", null, "HY", 4, 5, - null, 0.9387800000000001, 49, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922499", "9035853", - "CDX-NAHYHBS8V4 - 0612", "CDX.NA.HY.HB.8", - "CDX_NA_HY_S08_HB__SWP_27/30", 2454188, 2456099, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BWBN8", "CDX", 8, "NA HY HB", null, "HY", 4, 5, - null, 0.9000100000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922500", "9035869", - "LCDXNAS8V12 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_90/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GAZ0", "LCDX", 8, "LCDXNA", null, "IG", 12, 5, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.1.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922501", "9035594", - "CDX-NAHYBS1V6 - 0309", "Dow Jones CDX.NA.HY.B.1", - "CDX_NA_HY_S01_B___SWP_37/43", 2452720, 2454911, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSCQ9", "CDX", 1, "NA HY B", null, "HY", 6, 5, - null, 0.8604600000000001, 43, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.1.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922502", "9035599", - "CDX-NAHYS1V8 - 0309", "Dow Jones CDX.NA.HY.1", - "CDX_NA_HY_S01_100_SWP_88/100", 2452934, 2454911, 0.0425, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCQ1", "CDX", 1, "NA HY", null, "HY", 8, 5, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("TRACXNAHYBS2V7.TRACXNA HY B.5Y.2.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922504", "9035616", - "TRACXNAHYBS2V7 - 0309", "Dow Jones TRACX.NA.HY.B.2", - "TRACX_NA_HY_S02_B___SWP_53/59", 2452978, 2454913, 0.041, "USD", - "ACT/360", false, 0.3, 4, "TRACXNAHYBS2V7", "TRACXNAHYBS2V7", 2, "TRACXNA HY B", null, "HY", 7, 5, - null, 0.9009999999999999, 59, 0, "NYC", false, false, false, null, "Trac-X")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.3.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922505", "9035631", - "CDX-NAHYS3V10 - 1209", "Dow Jones CDX.NA.HY.3", - "CDX_NA_HY_S03_100_SWP_91/100", 2453196, 2455186, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCS7", "CDX", 3, "NA HY", null, "HY", 10, 5, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.3.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922506", "9035682", - "CDX-NAHYS3V10 - 1214", "Dow Jones CDX.NA.HY.3", - "CDX_NA_HY_S03_100_SWP_10YR_91/100", 2453196, 2457012, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCS7", "CDX", 3, "NA HY", null, "HY", 10, 10, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.3.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922507", "9035687", - "CDX-NAHYBS3V7 - 1209", "Dow Jones CDX.NA.HY.B.3", - "CDX_NA_HY_S03_B___SWP_38/44", 2453196, 2455186, 0.04, "USD", - "ACT/360", false, 0.3, 4, "2I65BSCS5", "CDX", 3, "NA HY B", null, "HY", 7, 5, - null, 0.86363, 44, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.9.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922508", "9035732", - "LCDXNAS9V8 - 1217", "LCDX.NA.9", - "CDX_NA_LN_S09_100_10YR_94/100", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBA4", "LCDX", 9, "LCDXNA", null, "IG", 8, 10, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.9.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922509", "9035737", - "LCDXNAS9V8 - 1211", "LCDX.NA.9", - "CDX_NA_LN_S09_100_04YR_94/100", 2454378, 2455916, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBA4", "LCDX", 9, "LCDXNA", null, "IG", 8, 4, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.4.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922510", "9035683", - "CDX-NAHYS4V10 - 0610", "Dow Jones CDX.NA.HY.4", - "CDX_NA_HY_S04_100_SWP_91/100", 2453475, 2455368, 0.036000000000000004, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCT5", "CDX", 4, "NA HY", null, "HY", 10, 5, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.9.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922511", "9035741", - "LCDXNAS9V8 - 1213", "LCDX.NA.9", - "CDX_NA_LN_S09_100_06YR_94/100", 2454378, 2456647, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBA4", "LCDX", 9, "LCDXNA", null, "IG", 8, 6, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.9.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922512", "9035815", - "LCDXNAS9V8 - 1209", "LCDX.NA.9", - "CDX_NA_LN_S09_100_02YR_94/100", 2454378, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBA4", "LCDX", 9, "LCDXNA", null, "IG", 8, 2, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.4.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922513", "9035704", - "CDX-NAHYBS4V5 - 0610", "Dow Jones CDX.NA.HY.B.4", - "CDX_NA_HY_S04_B___SWP_36/40", 2453475, 2455368, 0.034, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BSCT3", "CDX", 4, "NA HY B", null, "HY", 5, 5, - null, 0.9, 40, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.5.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922514", "9035719", - "CDX-NAHYS5V9 - 1215", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_10YR_92/100", 2453651, 2457377, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCU2", "CDX", 5, "NA HY", null, "HY", 9, 10, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.5.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922515", "9035720", - "CDX-NAHYS5V9 - 1212", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_07YR_92/100", 2453651, 2456282, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCU2", "CDX", 5, "NA HY", null, "HY", 9, 7, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.9.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922516", "9035919", - "LCDXNAS9V8 - 1210", "LCDX.NA.9", - "CDX_NA_LN_S09_100_03YR_94/100", 2454378, 2455551, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBA4", "LCDX", 9, "LCDXNA", null, "IG", 8, 3, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V8 FXD.LCDXNAV8 FXD.5Y.9.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922517", "9035920", - "LCDXNAS9V8 FXD - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_FXD_94/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBA4 FXD", "LCDXNAS9V8 FXD", 9, "LCDXNAV8 FXD", null, "IG", 8, 5, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922518", "9035931", - "CDX-NAHYS10V4 - 0610", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_02YR_97/100", 2454554, 2455368, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCZ1", "CDX", 10, "NA HY", null, "HY", 4, 2, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922519", "9035938", - "CDX-NAHYS10V4 - 0609", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_01YR_97/100", 2454554, 2455003, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCZ1", "CDX", 10, "NA HY", null, "HY", 4, 1, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet18() - { - UpdateCDXRefDataMap ("CDX.NA HY.4Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922520", "9035940", - "CDX-NAHYS10V4 - 0612", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_04YR_97/100", 2454554, 2456099, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCZ1", "CDX", 10, "NA HY", null, "HY", 4, 4, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922521", "9035941", - "CDX-NAHYS10V4 - 0614", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_06YR_97/100", 2454554, 2456829, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCZ1", "CDX", 10, "NA HY", null, "HY", 4, 6, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922522", "9035942", - "CDX-NAHYS10V4 - 0613", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_97/100", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCZ1", "CDX", 10, "NA HY", null, "HY", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.7.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922529", "9035768", - "CDX-NAHYS7V6 - 1213", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_07YR_95/100", 2454007, 2456647, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCW8", "CDX", 7, "NA HY", null, "HY", 6, 7, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.5.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922530", "9035730", - "CDX-NAHYS5V9 - 1210", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_92/100", 2453651, 2455551, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCU2", "CDX", 5, "NA HY", null, "HY", 9, 5, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.5.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922531", "9035696", - "CDX-NAHYBS5V5 - 1210", "Dow Jones CDX.NA.HY.B.5", - "CDX_NA_HY_S05_B___SWP_38/42", 2453651, 2455551, 0.034, "USD", - "ACT/360", false, 0.3, 4, "2I65BSCU0", "CDX", 5, "NA HY B", null, "HY", 5, 5, - null, 0.9048, 42, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.6.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922532", "9035634", - "CDX-NAHYS6V7 - 0609", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_03YR_94/100", 2453823, 2455003, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCV0", "CDX", 6, "NA HY", null, "HY", 7, 3, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.6.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922533", "9035674", - "CDX-NAHYS6V7 - 0616", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_10YR_94/100", 2453823, 2457560, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCV0", "CDX", 6, "NA HY", null, "HY", 7, 10, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.6.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922534", "9035675", - "CDX-NAHYS6V7 - 0613", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_07YR_94/100", 2453823, 2456464, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCV0", "CDX", 6, "NA HY", null, "HY", 7, 7, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.6.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922535", "9035713", - "CDX-NAHYS6V7 - 0611", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_94/100", 2453823, 2455733, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCV0", "CDX", 6, "NA HY", null, "HY", 7, 5, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.6.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922536", "9035714", - "CDX-NAHYS6V7 - 0610", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_04YR_94/100", 2453823, 2455368, 0.0345, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCV0", "CDX", 6, "NA HY", null, "HY", 7, 4, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJIBOXX.NA HY.5Y.2.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922537", "9035605", - "DJIBOXX-NA-HY-S2V9 - 0909", "Dow Jones CDX.NA.HY.2", - "DJIBOXX_NA_HY_S02_100_SWP_89/100", 2453088, 2455095, 0.043000000000000003, "USD", - "ACT/360", false, 0.3, 4, "DJIBOXX-NA-HY-S2V9", "DJIBOXX", 2, "NA HY", null, "HY", 9, 5, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.6.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922538", "9035721", - "CDX-NAHYS6V7 - 0612", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_06YR_94/100", 2453823, 2456099, 0.0345, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCV0", "CDX", 6, "NA HY", null, "HY", 7, 6, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.6.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922539", "9035760", - "CDX-NAHYBS6V4 - 0611", "Dow Jones CDX.NA.HY.B.6", - "CDX_NA_HY_S06_B___SWP_45/48", 2453823, 2455733, 0.030000000000000002, "USD", - "ACT/360", false, 0.3, 4, "2I65BSCV8", "CDX", 6, "NA HY B", null, "HY", 4, 5, - null, 0.9375100000000001, 48, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.6.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922540", "9035762", - "CDX-NAHYHBS6V4 - 0611", "Dow Jones CDX.NA.HY.HB.6", - "CDX_NA_HY_S06_HB__SWP_27/30", 2453823, 2455733, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWBL2", "CDX", 6, "NA HY HB", null, "HY", 4, 5, - null, 0.9, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.7.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922541", "9035766", - "CDX-NAHYS7V6 - 1211", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_95/100", 2454007, 2455916, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCW8", "CDX", 7, "NA HY", null, "HY", 6, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922543", "9035870", - "LCDXNAS8V12 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_90/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GAZ0", "LCDX", 8, "LCDXNA", null, "IG", 12, 3, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V12 FXD.LCDXNAV12 FXD.5Y.8.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922544", "9035872", - "LCDXNAS8V12 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_90/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GAZ0 FXD", "LCDXNAS8V12 FXD", 8, "LCDXNAV12 FXD", null, "IG", 12, 5, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922545", "9035873", - "LCDXNAS8V12 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_90/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GAZ0", "LCDX", 8, "LCDXNA", null, "IG", 12, 6, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922546", "9035884", - "LCDXNAS8V12 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_90/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GAZ0", "LCDX", 8, "LCDXNA", null, "IG", 12, 7, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922549", "9035896", - "LCDXNAS8V12 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_90/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GAZ0", "LCDX", 8, "LCDXNA", null, "IG", 12, 4, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922551", "9035897", - "LCDXNAS8V12 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_90/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GAZ0", "LCDX", 8, "LCDXNA", null, "IG", 12, 10, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922552", "9035946", - "CDX-NAHYS10V4 - 0611", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_03YR_97/100", 2454554, 2455733, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCZ1", "CDX", 10, "NA HY", null, "HY", 4, 3, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922553", "9035822", - "CDX-NAHYS10V4 - 0615", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_07YR_97/100", 2454554, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCZ1", "CDX", 10, "NA HY", null, "HY", 4, 7, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922554", "9035600", - "CDX-NAHYS10V4 - 0618", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_10YR_97/100", 2454554, 2458290, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCZ1", "CDX", 10, "NA HY", null, "HY", 4, 10, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922555", "9035602", - "CDX-NAHYBS10V2 - 0613", "CDX.NA.HY.B.10", - "CDX_NA_HY_S10_B___SWP_44/45", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSCZ9", "CDX", 10, "NA HY B", null, "HY", 2, 5, - null, 0.9777800000000001, 45, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.10.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922556", "9035606", - "LCDXNAS10V8 - 0611", "LCDX.NA.10", - "CDX_NA_LN_S10_100_03YR_94/100", 2454561, 2455733, 0.0275, "USD", - "ACT/360", false, 0.6, 4, "5F199GBB2", "LCDX", 10, "LCDXNA", null, "IG", 8, 3, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922557", "9035608", - "LCDXNAS10V8 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_94/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GBB2", "LCDX", 10, "LCDXNA", null, "IG", 8, 5, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.10.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922558", "9035609", - "LCDXNAS10V8 - 0609", "LCDX.NA.10", - "CDX_NA_LN_S10_100_01YR_94/100", 2454561, 2455003, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBB2", "LCDX", 10, "LCDXNA", null, "IG", 8, 1, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.10.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922559", "9035611", - "LCDXNAS10V8 - 0610", "LCDX.NA.10", - "CDX_NA_LN_S10_100_02YR_94/100", 2454561, 2455368, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBB2", "LCDX", 10, "LCDXNA", null, "IG", 8, 2, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.10.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922560", "9035612", - "LCDXNAS10V8 - 0615", "LCDX.NA.10", - "CDX_NA_LN_S10_100_07YR_94/100", 2454561, 2457194, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBB2", "LCDX", 10, "LCDXNA", null, "IG", 8, 7, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.10.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922561", "9035557", - "LCDXNAS10V8 - 0618", "LCDX.NA.10", - "CDX_NA_LN_S10_100_10YR_94/100", 2454561, 2458290, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBB2", "LCDX", 10, "LCDXNA", null, "IG", 8, 10, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.10.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922562", "9035561", - "LCDXNAS10V8 - 0612", "LCDX.NA.10", - "CDX_NA_LN_S10_100_04YR_94/100", 2454561, 2456099, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBB2", "LCDX", 10, "LCDXNA", null, "IG", 8, 4, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.8.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922590", "9035769", - "CDX-NAHYS8V6 - 0610", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_03YR_95/100", 2454188, 2455368, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCX6", "CDX", 8, "NA HY", null, "HY", 6, 3, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.8.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922593", "9035776", - "CDX-NAHYS8V6 - 0617", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_10YR_95/100", 2454188, 2457925, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCX6", "CDX", 8, "NA HY", null, "HY", 6, 10, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.8.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922594", "9035778", - "CDX-NAHYS8V6 - 0611", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_04YR_95/100", 2454188, 2455733, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCX6", "CDX", 8, "NA HY", null, "HY", 6, 4, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.8.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922595", "9035782", - "CDX-NAHYS8V6 - 0613", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_06YR_95/100", 2454188, 2456464, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCX6", "CDX", 8, "NA HY", null, "HY", 6, 6, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.9.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922596", "9035813", - "CDX-NAHYS9V7 - 1212", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_94/100", 2454372, 2456282, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCY4", "CDX", 9, "NA HY", null, "HY", 7, 5, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.9.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922597", "9035581", - "CDX-NAHYS9V7 - 1211", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_04YR_ 94/100", 2454372, 2455916, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCY4", "CDX", 9, "NA HY", null, "HY", 7, 4, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.9.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922598", "9035686", - "CDX-NAHYS9V7 - 1213", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_06YR_ 94/100", 2454372, 2456647, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCY4", "CDX", 9, "NA HY", null, "HY", 7, 6, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.9.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922599", "9035618", - "CDX-NAHYS9V7 - 1210", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_03YR_ 94/100", 2454372, 2455551, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCY4", "CDX", 9, "NA HY", null, "HY", 7, 3, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.9.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922600", "9035681", - "CDX-NAHYS9V7 - 1214", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_07YR_ 94/100", 2454372, 2457012, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCY4", "CDX", 9, "NA HY", null, "HY", 7, 7, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.9.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922601", "9035691", - "CDX-NAHYS9V7 - 1209", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_02YR_ 94/100", 2454372, 2455186, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCY4", "CDX", 9, "NA HY", null, "HY", 7, 2, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.9.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922602", "9035685", - "CDX-NAHYS9V7 - 1217", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_10YR_ 94/100", 2454372, 2458108, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCY4", "CDX", 9, "NA HY", null, "HY", 7, 10, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.9.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922603", "9035698", - "CDX-NAHYBS9V5 - 1212", "CDX.NA.HY.B.9", - "CDX_NA_HY_S09_B___SWP_42/46", 2454372, 2456282, 0.035, "USD", - "ACT/360", false, 0.3, 4, "2I65BSCY2", "CDX", 9, "NA HY B", null, "HY", 5, 5, - null, 0.9130500000000001, 46, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922604", "9035715", - "LCDXNAS9V8 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_94/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GBA4", "LCDX", 9, "LCDXNA", null, "IG", 8, 5, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.9.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922605", "9035717", - "LCDXNAS9V8 - 1214", "LCDX.NA.9", - "CDX_NA_LN_S09_100_07YR_94/100", 2454378, 2457012, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBA4", "LCDX", 9, "LCDXNA", null, "IG", 8, 7, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.7.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922606", "9035635", - "CDX-NAHYS7V6 - 1209", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_03YR_95/100", 2454007, 2455186, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCW8", "CDX", 7, "NA HY", null, "HY", 6, 3, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.7.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922607", "9035789", - "CDX-NAHYS7V6 - 1216", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_10YR_95/100", 2454007, 2457743, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCW8", "CDX", 7, "NA HY", null, "HY", 6, 10, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922608", "9036087", - "CDX-NAHYBS7V3 - 1211", "Dow Jones CDX.NA.HY.B.7", - "CDX_NA_HY_S07_B___SWP_48/50", 2454007, 2455916, 0.030000000000000002, "USD", - "ACT/360", false, 0.3, 4, "2I65BSCW6", "CDX", 7, "NA HY B", null, "HY", 3, 5, - null, 0.96, 50, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.7.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922609", "9035748", - "CDX-NAHYHBS7V4 - 1211", "Dow Jones CDX.NA.HY.HB.7", - "CDX_NA_HY_S07_HB__SWP_27/30", 2454007, 2455916, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWBM0", "CDX", 7, "NA HY HB", null, "HY", 4, 5, - null, 0.9000100000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.8.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922610", "9035750", - "CDX-NAHYS8V6 - 0614", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_07YR_95/100", 2454188, 2456829, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCX6", "CDX", 8, "NA HY", null, "HY", 6, 7, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.8.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922611", "9035753", - "CDX-NAHYS8V6 - 0612", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_95/100", 2454188, 2456099, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRCX6", "CDX", 8, "NA HY", null, "HY", 6, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.2.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922616", "9038837", - "CDX-NAHYS2V9 - 0909", "Dow Jones CDX.NA.HY.2", - "CDX_NA_HY_S02_100_SWP_89/100", 2453088, 2455095, 0.043000000000000003, "USD", - "ACT/360", false, 0.4, 4, "2I65BRCR9", "CDX", 2, "NA HY", null, "HY", 9, 5, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.2.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922628", "9039231", - "ITRAXX-LevXS2V6 - 0613", "ITRAXX LEVX SENIOR SERIES 2 VERSION 6", - "ITRAXX LEVX SENIOR SERIES 2 VERSION 6 EUR 1ST SEC RES I03 CDS", 2454543, 2456464, 0.052500000000000005, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJBI3", "ITRAXX", 2, "LevX", null, "IG", 6, 5, - null, 0.9198000000000001, 74, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevXSub.5Y.2.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922629", "9039236", - "ITRAXX-LevXSubS2V5 - 0613", "ITRAXX LEVX SUBORDINATE SERIES 2 VERSION 5", - "ITRAXX LEVX SUBORDINATE SERIES 2 VERSION 5 EUR 2ND SEC RES I03 CDS", 2454543, 2456464, 0.0825, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKBR0", "ITRAXX", 2, "LevXSub", null, "IG", 5, 5, - null, 0.9112, 45, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.3.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922630", "9039255", - "ITRAXX-LevXS3V5 - 1213", "ITRAXX LEVX SENIOR SERIES 3 VERSION 5", - "ITRAXX LEVX SENIOR SERIES 3 VERSION 5 EUR 1ST SEC RES I03 CDS", 2454739, 2456647, 0.0575, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJBJ1", "ITRAXX", 3, "LevX", null, "IG", 5, 5, - null, 0.9466, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevXSub.5Y.3.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922631", "9039257", - "ITRAXX-LevXSubS3V5 - 1213", "ITRAXX LEVX SUBORDINATE SERIES 3 VERSION 5", - "ITRAXX LEVX SUBORDINATE SERIES 3 VERSION 5 EUR 2ND SEC RES I03 CDS", 2454739, 2456647, 0.12000000000000001, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKBS8", "ITRAXX", 3, "LevXSub", null, "IG", 5, 5, - null, 0.9112, 45, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922652", "9040028", - "LCDXNAS8V13 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_89/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GBD8", "LCDX", 8, "LCDXNA", null, "IG", 13, 5, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922655", "9039970", - "LCDXNAS9V9 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_93/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GBE6", "LCDX", 9, "LCDXNA", null, "IG", 9, 5, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.10.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922656", "9039963", - "LCDXNAS10V9 - 0611", "LCDX.NA.10", - "CDX_NA_LN_S10_100_03YR_93/100", 2454561, 2455733, 0.0275, "USD", - "ACT/360", false, 0.6, 4, "5F199GBC0", "LCDX", 10, "LCDXNA", null, "IG", 9, 3, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922657", "9039964", - "LCDXNAS10V9 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_93/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GBC0", "LCDX", 10, "LCDXNA", null, "IG", 9, 5, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922668", "9040341", - "LCDXNAS8V13 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_89/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBD8", "LCDX", 8, "LCDXNA", null, "IG", 13, 3, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V13 FXD.LCDXNAV13 FXD.5Y.8.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922672", "9040343", - "LCDXNAS8V13 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_89/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBD8 FXD", "LCDXNAS8V13 FXD", 8, "LCDXNAV13 FXD", null, "IG", 13, 5, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922673", "9040347", - "LCDXNAS8V13 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_89/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBD8", "LCDX", 8, "LCDXNA", null, "IG", 13, 6, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922674", "9040278", - "LCDXNAS8V13 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_89/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBD8", "LCDX", 8, "LCDXNA", null, "IG", 13, 7, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922675", "9040279", - "LCDXNAS8V13 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_89/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBD8", "LCDX", 8, "LCDXNA", null, "IG", 13, 4, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922676", "9040280", - "LCDXNAS8V13 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_89/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBD8", "LCDX", 8, "LCDXNA", null, "IG", 13, 10, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.9.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922678", "9040322", - "LCDXNAS9V9 - 1217", "LCDX.NA.9", - "CDX_NA_LN_S09_100_10YR_93/100", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBE6", "LCDX", 9, "LCDXNA", null, "IG", 9, 10, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.9.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922679", "9040325", - "LCDXNAS9V9 - 1211", "LCDX.NA.9", - "CDX_NA_LN_S09_100_04YR_93/100", 2454378, 2455916, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBE6", "LCDX", 9, "LCDXNA", null, "IG", 9, 4, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.9.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922681", "9039960", - "LCDXNAS9V9 - 1209", "LCDX.NA.9", - "CDX_NA_LN_S09_100_02YR_93/100", 2454378, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBE6", "LCDX", 9, "LCDXNA", null, "IG", 9, 2, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.9.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922682", "9039961", - "LCDXNAS9V9 - 1210", "LCDX.NA.9", - "CDX_NA_LN_S09_100_03YR_93/100", 2454378, 2455551, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBE6", "LCDX", 9, "LCDXNA", null, "IG", 9, 3, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V9 FXD.LCDXNAV9 FXD.5Y.9.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922683", "9039967", - "LCDXNAS9V9 FXD - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_FXD_93/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBE6 FXD", "LCDXNAS9V9 FXD", 9, "LCDXNAV9 FXD", null, "IG", 9, 5, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.9.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922684", "9040286", - "LCDXNAS9V9 - 1214", "LCDX.NA.9", - "CDX_NA_LN_S09_100_07YR_93/100", 2454378, 2457012, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBE6", "LCDX", 9, "LCDXNA", null, "IG", 9, 7, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS10V9 FXD.LCDXNAV9 FXD.5Y.10.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922685", "9040289", - "LCDXNAS10V9 FXD - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_FXD_93/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBC0 FXD", "LCDXNAS10V9 FXD", 10, "LCDXNAV9 FXD", null, "IG", 9, 5, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.10.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922686", "9040296", - "LCDXNAS10V9 - 0614", "LCDX.NA.10", - "CDX_NA_LN_S10_100_06YR_93/100", 2454561, 2456829, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBC0", "LCDX", 10, "LCDXNA", null, "IG", 9, 6, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.10.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922687", "9039971", - "LCDXNAS10V9 - 0609", "LCDX.NA.10", - "CDX_NA_LN_S10_100_01YR_93/100", 2454561, 2455003, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBC0", "LCDX", 10, "LCDXNA", null, "IG", 9, 1, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.10.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922688", "9039972", - "LCDXNAS10V9 - 0610", "LCDX.NA.10", - "CDX_NA_LN_S10_100_02YR_93/100", 2454561, 2455368, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBC0", "LCDX", 10, "LCDXNA", null, "IG", 9, 2, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.10.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922689", "9039950", - "LCDXNAS10V9 - 0615", "LCDX.NA.10", - "CDX_NA_LN_S10_100_07YR_93/100", 2454561, 2457194, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBC0", "LCDX", 10, "LCDXNA", null, "IG", 9, 7, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.10.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922690", "9039953", - "LCDXNAS10V9 - 0618", "LCDX.NA.10", - "CDX_NA_LN_S10_100_10YR_93/100", 2454561, 2458290, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBC0", "LCDX", 10, "LCDXNA", null, "IG", 9, 10, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.10.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922691", "9039956", - "LCDXNAS10V9 - 0612", "LCDX.NA.10", - "CDX_NA_LN_S10_100_04YR_93/100", 2454561, 2456099, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBC0", "LCDX", 10, "LCDXNA", null, "IG", 9, 4, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.9.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922693", "9040326", - "LCDXNAS9V9 - 1213", "LCDX.NA.9", - "CDX_NA_LN_S09_100_06YR_93/100", 2454378, 2456647, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBE6", "LCDX", 9, "LCDXNA", null, "IG", 9, 6, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.3Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922699", "9040999", - "ITRAXX-HIVOLS11V1 - 0612", "iTraxx Europe HiVol series 11 Version 1", - "ITRAXX-HIVOLS11V1-0612 EUR SEN MMR I03 CDS", 2454911, 2456099, 0.0425, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAK2", "ITRAXX", 11, "HIVOL", "VOL", "HV", 1, 3, - "242872", 1, 29, 0, "LON", true, true, true, "ITXEH311", "VOL")); - - UpdateCDXRefDataMap ("LCDXNAS10V10 FXD.LCDXNAV10 FXD.5Y.10.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922701", "9042386", - "LCDXNAS10V10 FXD - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_FXD_92/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBF3 FXD", "LCDXNAS10V10 FXD", 10, "LCDXNAV10 FXD", null, "IG", 10, 5, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.10.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922702", "9042391", - "LCDXNAS10V10 - 0614", "LCDX.NA.10", - "CDX_NA_LN_S10_100_06YR_92/100", 2454561, 2456829, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBF3", "LCDX", 10, "LCDXNA", null, "IG", 10, 6, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.3Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922703", "9040924", - "ITRAXX-EUROPES11V1 - 0612", "iTraxx Europe series 11 Version 1", - "ITRAXX-EUROPES11V1-0612 EUR SEN MMR I03 CDS", 2454911, 2456099, 0.02, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAK1", "ITRAXX", 11, "EUROPE", "EUR", "IG", 1, 3, - "242870", 1, 125, 0, "LON", true, true, true, "ITXEB311", "EUR")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.10.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922704", "9042358", - "LCDXNAS10V10 - 0611", "LCDX.NA.10", - "CDX_NA_LN_S10_100_03YR_92/100", 2454561, 2455733, 0.0275, "USD", - "ACT/360", false, 0.6, 4, "5F199GBF3", "LCDX", 10, "LCDXNA", null, "IG", 10, 3, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922705", "9040925", - "ITRAXX-EUROPES11V1 - 0614", "iTraxx Europe series 11 Version 1", - "ITRAXX-EUROPES11V1-0614 EUR SEN MMR I03 CDS", 2454911, 2456829, 0.018500000000000003, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAK1", "ITRAXX", 11, "EUROPE", "EUR", "IG", 1, 5, - "242870", 1, 125, 0, "LON", true, true, true, "ITXEB511", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.7Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922706", "9040926", - "ITRAXX-EUROPES11V1 - 0616", "iTraxx Europe series 11 Version 1", - "ITRAXX-EUROPES11V1-0616 EUR SEN MMR I03 CDS", 2454911, 2457560, 0.017, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAK1", "ITRAXX", 11, "EUROPE", "EUR", "IG", 1, 7, - "242870", 1, 125, 0, "LON", true, true, true, "ITXEB711", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922707", "9040929", - "ITRAXX-EUROPES11V1 - 0619", "iTraxx Europe series 11 Version 1", - "ITRAXX-EUROPES11V1-0619 EUR SEN MMR I03 CDS", 2454911, 2458655, 0.015000000000000001, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAK1", "ITRAXX", 11, "EUROPE", "EUR", "IG", 1, 10, - "242870", 1, 125, 0, "LON", true, true, true, "ITXEB011", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922708", "9040932", - "ITRAXX-XOVERS11V1 - 0612", "iTraxx Europe Crossover series 11 Version 1", - "ITRAXX-XOVERS11V1-0612 EUR SEN MMR I03 CDS MATURED", 2454911, 2456099, 0.11, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAL2", "ITRAXX", 11, "XOVER", "XVR", "XO", 1, 3, - "242871", 1, 45, 0, "LON", true, true, true, "ITXEX311", "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSEN.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922709", "9041329", - "USD ITRAXX-FINSENS11V1 - 0614", "iTraxx Europe Senior Financials series 11 Version 1", - "ITRAXX-FINSENS11V1-0614 USD SEN MMR I03 CDS", 2454911, 2456829, 0.021, "USD", - "ACT/360", false, 0.4, 4, "2I667DAK0", "USD ITRAXX", 11, "FINSEN", "SEN", "SENF", 1, 5, - null, 1, 25, 0, "LON", false, false, true, null, "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922710", "9040936", - "ITRAXX-XOVERS11V1 - 0614", "iTraxx Europe Crossover series 11 Version 1", - "ITRAXX-XOVERS11V1-0614 EUR SEN MMR I03 CDS MATURED", 2454911, 2456829, 0.0975, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAL2", "ITRAXX", 11, "XOVER", "XVR", "XO", 1, 5, - "242871", 1, 45, 0, "LON", true, true, true, "ITXEX511", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922711", "9040939", - "ITRAXX-XOVERS11V1 - 0616", "iTraxx Europe Crossover series 11 Version 1", - "ITRAXX-XOVERS11V1-0616 EUR SEN MMR I03 CDS MATURED", 2454911, 2457560, 0.08800000000000001, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAL2", "ITRAXX", 11, "XOVER", "XVR", "XO", 1, 7, - "242871", 1, 45, 0, "LON", true, true, true, "ITXEX711", "XVR")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922712", "9042363", - "LCDXNAS10V10 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_92/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GBF3", "LCDX", 10, "LCDXNA", null, "IG", 10, 5, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSEN.10Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922713", "9041333", - "USD ITRAXX-FINSENS11V1 - 0619", "iTraxx Europe Senior Financials series 11 Version 1", - "ITRAXX-FINSENS11V1-0619 USD SEN MMR I03 CDS", 2454911, 2458655, 0.019, "USD", - "ACT/360", false, 0.4, 4, "2I667DAK0", "USD ITRAXX", 11, "FINSEN", "SEN", "SENF", 1, 10, - null, 1, 25, 0, "LON", false, false, true, null, "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922714", "9040941", - "ITRAXX-XOVERS11V1 - 0619", "iTraxx Europe Crossover series 11 Version 1", - "ITRAXX-XOVERS11V1-0619 EUR SEN MMR I03 CDS MATURED", 2454911, 2458655, 0.082, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAL2", "ITRAXX", 11, "XOVER", "XVR", "XO", 1, 10, - "242871", 1, 45, 0, "LON", true, true, true, "ITXEX011", "XVR")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.10.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922715", "9042395", - "LCDXNAS10V10 - 0609", "LCDX.NA.10", - "CDX_NA_LN_S10_100_01YR_92/100", 2454561, 2455003, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBF3", "LCDX", 10, "LCDXNA", null, "IG", 10, 1, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSUB.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922716", "9041334", - "USD ITRAXX-FINSUBS11V1 - 0614", "iTraxx Europe Sub Financials series 11 Version 1", - "ITRAXX-FINSUBS11V1-0614 USD LT2 SUB MMR I03 CDS", 2454911, 2456829, 0.0375, "USD", - "ACT/360", false, 0.2, 4, "2I667EAL6", "USD ITRAXX", 11, "FINSUB", "SUB", "SUBF", 1, 5, - null, 1, 25, 0, "LON", false, false, true, null, "SUB")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922717", "9041315", - "ITRAXX-FINSUBS11V1 - 0614", "iTraxx Europe Sub Financials series 11 Version 1", - "ITRAXX-FINSUBS11V1-0614 EUR LT2 SUB MMR I03 CDS", 2454911, 2456829, 0.0375, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAL6", "ITRAXX", 11, "FINSUB", "SUB", "SUBF", 1, 5, - "242875", 1, 25, 0, "LON", true, true, true, "ITXEU511", "SUB")); - - return true; - } - - private static final boolean InitCDXRefDataSet19() - { - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.10.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922718", "9042736", - "LCDXNAS10V10 - 0610", "LCDX.NA.10", - "CDX_NA_LN_S10_100_02YR_92/100", 2454561, 2455368, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBF3", "LCDX", 10, "LCDXNA", null, "IG", 10, 2, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.10Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922719", "9041320", - "ITRAXX-FINSUBS11V1 - 0619", "iTraxx Europe Sub Financials series 11 Version 1", - "ITRAXX-FINSUBS11V1-0619 EUR LT2 SUB MMR I03 CDS", 2454911, 2458655, 0.035, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAL6", "ITRAXX", 11, "FINSUB", "SUB", "SUBF", 1, 10, - "242875", 1, 25, 0, "LON", true, true, true, "ITXEU011", "SUB")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSUB.10Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922720", "9041279", - "USD ITRAXX-FINSUBS11V1 - 0619", "iTraxx Europe Sub Financials series 11 Version 1", - "ITRAXX-FINSUBS11V1-0619 USD LT2 SUB MMR I03 CDS", 2454911, 2458655, 0.035, "USD", - "ACT/360", false, 0.2, 4, "2I667EAL6", "USD ITRAXX", 11, "FINSUB", "SUB", "SUBF", 1, 10, - null, 1, 25, 0, "LON", false, false, true, null, "SUB")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.10.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922721", "9042735", - "LCDXNAS10V10 - 0615", "LCDX.NA.10", - "CDX_NA_LN_S10_100_07YR_92/100", 2454561, 2457194, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBF3", "LCDX", 10, "LCDXNA", null, "IG", 10, 7, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.10.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922722", "9042734", - "LCDXNAS10V10 - 0618", "LCDX.NA.10", - "CDX_NA_LN_S10_100_10YR_92/100", 2454561, 2458290, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBF3", "LCDX", 10, "LCDXNA", null, "IG", 10, 10, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.10.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922723", "9042733", - "LCDXNAS10V10 - 0612", "LCDX.NA.10", - "CDX_NA_LN_S10_100_04YR_92/100", 2454561, 2456099, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBF3", "LCDX", 10, "LCDXNA", null, "IG", 10, 4, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.1Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922725", "9041194", - "CDX-NAIGHVOLS12V1 - 0610", "CDX.NA.IG.HVOL.12", - "CDX_NA_IG_S12_HVOL_01Y_06/10", 2454911, 2455368, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BD4", "CDX", 12, "NA IG HVOL", null, "HV", 1, 1, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.2Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922726", "9041195", - "CDX-NAIGHVOLS12V1 - 0611", "CDX.NA.IG.HVOL.12", - "CDX_NA_IG_S12_HVOL_02Y_06/11", 2454911, 2455733, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BD4", "CDX", 12, "NA IG HVOL", null, "HV", 1, 2, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.3Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922727", "9041198", - "CDX-NAIGHVOLS12V1 - 0612", "CDX.NA.IG.HVOL.12", - "CDX_NA_IG_S12_HVOL_03Y_06/12", 2454911, 2456099, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BD4", "CDX", 12, "NA IG HVOL", null, "HV", 1, 3, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922728", "9041008", - "ITRAXX-HIVOLS11V1 - 0614", "iTraxx Europe HiVol series 11 Version 1", - "ITRAXX-HIVOLS11V1-0614 EUR SEN MMR I03 CDS", 2454911, 2456829, 0.0375, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAK2", "ITRAXX", 11, "HIVOL", "VOL", "HV", 1, 5, - "242872", 1, 29, 0, "LON", true, true, true, "ITXEH511", "VOL")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.4Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922729", "9041199", - "CDX-NAIGHVOLS12V1 - 0613", "CDX.NA.IG.HVOL.12", - "CDX_NA_IG_S12_HVOL_04Y_06/13", 2454911, 2456464, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BD4", "CDX", 12, "NA IG HVOL", null, "HV", 1, 4, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.7Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922730", "9041011", - "ITRAXX-HIVOLS11V1 - 0616", "iTraxx Europe HiVol series 11 Version 1", - "ITRAXX-HIVOLS11V1-0616 EUR SEN MMR I03 CDS", 2454911, 2457560, 0.035, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAK2", "ITRAXX", 11, "HIVOL", "VOL", "HV", 1, 7, - "242872", 1, 29, 0, "LON", true, true, true, "ITXEH711", "VOL")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922731", "9041201", - "CDX-NAIGHVOLS12V1 - 0614", "CDX.NA.IG.HVOL.12", - "CDX_NA_IG_S12_HVOL_05Y_06/14", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BD4", "CDX", 12, "NA IG HVOL", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.10Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922732", "9041016", - "ITRAXX-HIVOLS11V1 - 0619", "iTraxx Europe HiVol series 11 Version 1", - "ITRAXX-HIVOLS11V1-0619 EUR SEN MMR I03 CDS", 2454911, 2458655, 0.0325, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAK2", "ITRAXX", 11, "HIVOL", "VOL", "HV", 1, 10, - "242872", 1, 29, 0, "LON", true, true, true, "ITXEH011", "VOL")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.7Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922733", "9041202", - "CDX-NAIGHVOLS12V1 - 0616", "CDX.NA.IG.HVOL.12", - "CDX_NA_IG_S12_HVOL_07Y_06/16", 2454911, 2457560, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BD4", "CDX", 12, "NA IG HVOL", null, "HV", 1, 7, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.10Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922735", "9041205", - "CDX-NAIGHVOLS12V1 - 0619", "CDX.NA.IG.HVOL.12", - "CDX_NA_IG_S12_HVOL_10Y_06/19", 2454911, 2458655, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BD4", "CDX", 12, "NA IG HVOL", null, "HV", 1, 10, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922737", "9041365", - "ITRAXX-FINSENS11V1 - 0614", "iTraxx Europe Senior Financials series 11 Version 1", - "ITRAXX-FINSENS11V1-0614 EUR SEN MMR I03 CDS", 2454911, 2456829, 0.021, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAK0", "ITRAXX", 11, "FINSEN", "SEN", "SENF", 1, 5, - "242874", 1, 25, 0, "LON", true, true, true, "ITXES511", "SEN")); - - UpdateCDXRefDataMap ("CDX.NA IG ENRG.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922738", "9041209", - "CDX-NAIGENRGS12V1 - 0614", "CDX.NA.IG.ENRG.12", - "CDX_NA_IG_S12_ENRG_06/14", 2454911, 2456829, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B1AN7", "CDX", 12, "NA IG ENRG", null, "IG", 1, 5, - null, 1, 16, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.10Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922739", "9041366", - "ITRAXX-FINSENS11V1 - 0619", "iTraxx Europe Senior Financials series 11 Version 1", - "ITRAXX-FINSENS11V1-0619 EUR SEN MMR I03 CDS", 2454911, 2458655, 0.019, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAK0", "ITRAXX", 11, "FINSEN", "SEN", "SENF", 1, 10, - "242874", 1, 25, 0, "LON", true, true, true, "ITXES011", "SEN")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922740", "9041210", - "CDX-NAIGFINS12V1 - 0614", "CDX.NA.IG.FIN.12", - "CDX_NA_IG_S12_FIN_06/14", 2454911, 2456829, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B2AN5", "CDX", 12, "NA IG FIN", null, "IG", 1, 5, - null, 1, 21, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG INDU.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922743", "9041225", - "CDX-NAIGINDUS12V1 - 0614", "CDX.NA.IG.INDU.12", - "CDX_NA_IG_S12_INDU_06/14", 2454911, 2456829, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B4AQ4", "CDX", 12, "NA IG INDU", null, "IG", 1, 5, - null, 1, 26, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG TMT.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922744", "9041226", - "CDX-NAIGTMTS12V1 - 0614", "CDX.NA.IG.TMT.12", - "CDX_NA_IG_S12_TMT_06/14", 2454911, 2456829, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65DJAO4", "CDX", 12, "NA IG TMT", null, "IG", 1, 5, - null, 1, 23, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOLV1 EUR.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922745", "9041247", - "CDX-NAIGHVOLS12V1 EUR - 0614", "CDX.NA.IG.HVOL.12", - "CDX_NA_IG_S12_HVOL_05Y_06/14 EUR", 2454911, 2456829, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I65B3BD4", "CDX", 12, "NA IG HVOLV1 EUR", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.3Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922746", "9041232", - "CDX-NAXOS12V1 - 0612", "CDX.NA.XO.12", - "CDX_NA_XO_S12_03YR_06/12", 2454911, 2456099, 0.034, "USD", - "ACT/360", false, 0.4, 4, "CDX-NAXOS12V1", "CDX", 12, "NAXO", null, "XO", 1, 3, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922747", "9041234", - "CDX-NAXOS12V1 - 0614", "CDX.NA.XO.12", - "CDX_NA_XO_S12_05YR_06/14", 2454911, 2456829, 0.034, "USD", - "ACT/360", false, 0.4, 4, "CDX-NAXOS12V1", "CDX", 12, "NAXO", null, "XO", 1, 5, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.7Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922748", "9041235", - "CDX-NAXOS12V1 - 0616", "CDX.NA.XO.12", - "CDX_NA_XO_S12_07YR_06/16", 2454911, 2457560, 0.034, "USD", - "ACT/360", false, 0.4, 4, "CDX-NAXOS12V1", "CDX", 12, "NAXO", null, "XO", 1, 7, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.10Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922749", "9041238", - "CDX-NAXOS12V1 - 0619", "CDX.NA.XO.12", - "CDX_NA_XO_S12_10YR_06/19", 2454911, 2458655, 0.034, "USD", - "ACT/360", false, 0.4, 4, "CDX-NAXOS12V1", "CDX", 12, "NAXO", null, "XO", 1, 10, - null, 1, 35, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("CDX.NAXOV1EUR.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922750", "9041245", - "CDX-NAXOS12V1EUR - 0614", "CDX.NA.XO.12", - "CDX NA XO S12 05YR 06/14 EUR", 2454911, 2456829, 0.034, "EUR", - "ACT/360", false, 0.4, 4, "CDX-NAXOS12V1", "CDX", 12, "NAXOV1EUR", null, "XO", 1, 5, - null, 1, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922754", "9041348", - "CDX-NAHYS12V1 - 0615", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_06YR", 2454911, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDF4", "CDX", 12, "NA HY", null, "HY", 1, 6, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922756", "9041349", - "CDX-NAHYS12V1 - 0616", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_07YR", 2454911, 2457560, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDF4", "CDX", 12, "NA HY", null, "HY", 1, 7, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922757", "9041352", - "CDX-NAHYS12V1 - 0619", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_10YR", 2454911, 2458655, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDF4", "CDX", 12, "NA HY", null, "HY", 1, 10, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BV2 FXD 34/35.5Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922758", "9041356", - "CDX-NAHYBS12V1 FXD - 0614", "CDX.NA.HY.B.12", - "CDX_NA_HY_S12_B___FXD", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BSBT4 FXD", "CDX", 12, "NA HY BV2 FXD 34/35", null, "HY", 2, 5, - null, 0.97143, 35, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922759", "9041357", - "CDX-NAHYBS12V1 - 0614", "CDX.NA.HY.B.12", - "CDX_NA_HY_S12_B___SWP", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSDD7", "CDX", 12, "NA HY B", null, "HY", 1, 5, - null, 1, 35, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922760", "9041360", - "CDX-NAHYBBS12V1 - 0614", "CDX.NA.HY.BB.12", - "CDX_NA_HY_S12_BB__SWP", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBG5", "CDX", 12, "NA HY BB", null, "HY", 1, 5, - null, 1, 33, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HBV9 FXD 23/30.5Y.12.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922761", "9041361", - "CDX-NAHYHBS12V8 FXD 24/30 - 0614", "CDX.NA.HY.HB.12", - "CDX_NA_HY_S12_HB__FXD_24/30", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BWFD6 FXD", "CDX", 12, "NA HY HBV9 FXD 23/30", null, "HY", 9, 5, - null, 0.76668, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922762", "9041362", - "CDX-NAHYHBS12V1 - 0614", "CDX.NA.HY.HB.12", - "CDX_NA_HY_S12_HB__SWP", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWBP3", "CDX", 12, "NA HY HB", null, "HY", 1, 5, - null, 1, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BBV1 FXD.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922763", "9041359", - "CDX-NAHYBBS12V1 FXD - 0614", "CDX.NA.HY.BB.12", - "CDX_NA_HY_S12_BB__FXD", 2454919, 2456829, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BVBG5 FXD", "CDX", 12, "NA HY BBV1 FXD", null, "HY", 1, 5, - null, 1, 33, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("USD ITRAXX.HIVOL.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922764", "9041277", - "USD ITRAXX-HIVOLS11V1 - 0614", "iTraxx Europe HiVol series 11 Version 1", - "ITRAXX-HIVOLS11V1-0614 USD SEN MMR I03 CDS", 2454911, 2456829, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I667LAK2", "USD ITRAXX", 11, "HIVOL", "VOL", "HV", 1, 5, - null, 1, 29, 0, "LON", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("USD ITRAXX.HIVOL.10Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922765", "9041278", - "USD ITRAXX-HIVOLS11V1 - 0619", "iTraxx Europe HiVol series 11 Version 1", - "ITRAXX-HIVOLS11V1-0619 USD SEN MMR I03 CDS", 2454911, 2458655, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "2I667LAK2", "USD ITRAXX", 11, "HIVOL", "VOL", "HV", 1, 10, - null, 1, 29, 0, "LON", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922768", "9041321", - "USD ITRAXX-EUROPES11V1 - 0614", "iTraxx Europe series 11 Version 1", - "ITRAXX-EUROPES11V1-0614 USD SEN MMR I03 CDS", 2454911, 2456829, 0.018500000000000003, "USD", - "ACT/360", false, 0.4, 4, "2I666VAK1", "USD ITRAXX", 11, "EUROPE", "EUR", "IG", 1, 5, - null, 1, 125, 0, "LON", false, false, true, null, "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.10Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922769", "9041325", - "USD ITRAXX-EUROPES11V1 - 0619", "iTraxx Europe series 11 Version 1", - "ITRAXX-EUROPES11V1-0619 USD SEN MMR I03 CDS", 2454911, 2458655, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I666VAK1", "USD ITRAXX", 11, "EUROPE", "EUR", "IG", 1, 10, - null, 1, 125, 0, "LON", false, false, true, null, "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922770", "9041326", - "USD ITRAXX-XOVERS11V1 - 0614", "iTraxx Europe Crossover series 11 Version 1", - "ITRAXX-XOVERS11V1-0614 USD SEN MMR I03 CDS MATURED", 2454911, 2456829, 0.0975, "USD", - "ACT/360", false, 0.4, 4, "2I667KAL2", "USD ITRAXX", 11, "XOVER", "XVR", "XO", 1, 5, - null, 1, 45, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922773", "9041328", - "USD ITRAXX-XOVERS11V1 - 0619", "iTraxx Europe Crossover series 11 Version 1", - "ITRAXX-XOVERS11V1-0619 USD SEN MMR I03 CDS MATURED", 2454911, 2458655, 0.082, "USD", - "ACT/360", false, 0.4, 4, "2I667KAL2", "USD ITRAXX", 11, "XOVER", "XVR", "XO", 1, 10, - null, 1, 45, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("CDX.NA IG.1Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922776", "9041262", - "CDX-NAIGS12V1 - 0610", "CDX.NA.IG.12", - "CDX_NA_IG_S12_01Y_06/10", 2454911, 2455368, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBN4", "CDX", 12, "NA IG", null, "IG", 1, 1, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.2Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922777", "9041263", - "CDX-NAIGS12V1 - 0611", "CDX.NA.IG.12", - "CDX_NA_IG_S12_02Y_06/11", 2454911, 2455733, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBN4", "CDX", 12, "NA IG", null, "IG", 1, 2, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922778", "9041265", - "CDX-NAIGS12V1 - 0612", "CDX.NA.IG.12", - "CDX_NA_IG_S12_03Y_06/12", 2454911, 2456099, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBN4", "CDX", 12, "NA IG", null, "IG", 1, 3, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922779", "9041266", - "CDX-NAIGS12V1 - 0613", "CDX.NA.IG.12", - "CDX_NA_IG_S12_04Y_06/13", 2454911, 2456464, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBN4", "CDX", 12, "NA IG", null, "IG", 1, 4, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922780", "9041267", - "CDX-NAIGS12V1 - 0614", "CDX.NA.IG.12", - "CDX_NA_IG_S12_05Y_06/14", 2454911, 2456829, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBN4", "CDX", 12, "NA IG", null, "IG", 1, 5, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V1 EUR.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922781", "9041268", - "CDX-NAIGS12V1 EUR - 0614", "CDX.NA.IG.12", - "CDX_NA_IG_S12_05Y_06/14_EUR", 2454911, 2456829, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYBN4", "CDX", 12, "NA IG V1 EUR", null, "IG", 1, 5, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922782", "9041270", - "CDX-NAIGS12V1 - 0616", "CDX.NA.IG.12", - "CDX_NA_IG_S12_07Y_06/16", 2454911, 2457560, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBN4", "CDX", 12, "NA IG", null, "IG", 1, 7, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922783", "9041271", - "CDX-NAIGS12V1 - 0619", "CDX.NA.IG.12", - "CDX_NA_IG_S12_10Y_06/19", 2454911, 2458655, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBN4", "CDX", 12, "NA IG", null, "IG", 1, 10, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG CONS.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922784", "9041275", - "CDX-NAIGCONSS12V1 - 0614", "CDX.NA.IG.CONS.12", - "CDX_NA_IG_S12_CONS_06/14", 2454911, 2456829, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B0AN9", "CDX", 12, "NA IG CONS", null, "IG", 1, 5, - null, 1, 39, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ IG.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922793", "9041880", - "ITRAXX-ASIAXJIGS11V1 - 0614", "iTraxx Asia ex-Japan IG Series Number 11 Version 1", - "ITRAXX-ASIA-IGS11-5Y USD SEN RES I03 CDS", 2454911, 2456829, 0.035, "USD", - "ACT/360", false, 0.35000000000000003, 4, "4ABCAMAD8", "ITRAXX", 11, "ASIAXJ IG", null, "ASHG", 1, 5, - null, 1, 50, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ HY.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922794", "9041882", - "ITRAXX-ASIAXJHYS11V1 - 0614", "iTraxx Asia ex-Japan HY Series Number 11 Version 1", - "ITRAXX-ASIA-HYS11-5Y USD SEN RES I03 CDS", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.25, 4, "4ABCAGAD1", "ITRAXX", 11, "ASIAXJ HY", null, "ASHY", 1, 5, - null, 1, 20, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.AUSTRALIA.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922795", "9041895", - "ITRAXX-AUSTRALIAS11V1 - 0614", "iTraxx Australia Series Number 11 Version 1", - "ITRAXX-AUSTRALIAS11V1-0614 USD SEN MR I03 CDS", 2454911, 2456829, 0.04, "USD", - "ACT/360", false, 0.4, 4, "2I668IAK8", "ITRAXX", 11, "AUSTRALIA", null, "AUHG", 1, 5, - null, 1, 25, 0, "HKG", false, false, true, null, "Itraxx Australia")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922796", "9041903", - "ITRAXX-JAPANS11V1 - 0614", "iTraxx Japan Series Number 11 Version 1", - "ITRAXX-JAPANS11V1-0614 JPY SEN RES I03 CDS", 2454914, 2456829, 0.05, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAK0", "ITRAXX", 11, "JAPAN", null, "JPHG", 1, 5, - null, 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("CDX.EMDIV.5Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922798", "9040725", - "CDX-EMDIVS9V1 - 0614", "CDX.EM.DIV.9", - "CDX EM DIVER 9 5YR", 2454912, 2456829, 0.05, "USD", - "ACT/360", true, 0.25, 2, "2165EKAM1", "CDX", 9, "EMDIV", null, "EM", 1, 5, - null, 1, 40, 0, "LON", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.EM.10Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922799", "9040731", - "CDX-EMS11V1 - 0619", "CDX.EM.11", - "CDX EM 11 10YR", 2454912, 2458655, 0.05, "USD", - "ACT/360", true, 0.25, 2, "2I65BZAK8", "CDX", 11, "EM", null, "EM", 1, 10, - null, 1, 15, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.EM.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922800", "9040738", - "CDX-EMS11V1 - 0614", "CDX.EM.11", - "CDX EM 11 5YR", 2454912, 2456829, 0.05, "USD", - "ACT/360", true, 0, 2, "2I65BZAK8", "CDX", 11, "EM", null, "EM", 1, 5, - null, 1, 15, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V11 FXD 91/100.5Y.12.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922801", "9041065", - "CDX-NAHYS12V11 FXD 91/100 - 0614", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_FXD_91/100", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIZ5 FXD", "CDX", 12, "NA HY V11 FXD 91/100", null, "HY", 11, 5, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922802", "9041070", - "CDX-NAHYS12V1 - 0614", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDF4", "CDX", 12, "NA HY", null, "HY", 1, 5, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922803", "9041072", - "CDX-NAHYS12V1 - 0610", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_01YR", 2454911, 2455368, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDF4", "CDX", 12, "NA HY", null, "HY", 1, 1, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922804", "9041075", - "CDX-NAHYS12V1 - 0611", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_02YR", 2454911, 2455733, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDF4", "CDX", 12, "NA HY", null, "HY", 1, 2, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922806", "9041078", - "CDX-NAHYS12V1 - 0612", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_03YR", 2454911, 2456099, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDF4", "CDX", 12, "NA HY", null, "HY", 1, 3, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922807", "9041087", - "CDX-NAHYS12V1 - 0613", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_04YR", 2454911, 2456464, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDF4", "CDX", 12, "NA HY", null, "HY", 1, 4, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V11 FXD 91/100.3Y.12.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922808", "9041082", - "CDX-NAHYS12V8 FXD 94/100 - 0612", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_FXD_03YR_94/100", 2454911, 2456099, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRIZ5 FXD", "CDX", 12, "NA HY V11 FXD 91/100", null, "HY", 11, 3, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.10.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922811", "9043520", - "CDX-NAHYS10V5 - 0613", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_96/100", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDB3", "CDX", 10, "NA HY", null, "HY", 5, 5, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.10.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922812", "9043521", - "CDX-NAHYS10V5 - 0615", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_07YR_96/100", 2454554, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDB3", "CDX", 10, "NA HY", null, "HY", 5, 7, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.10.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922813", "9043522", - "CDX-NAHYS10V5 - 0618", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_10YR_96/100", 2454554, 2458290, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDB3", "CDX", 10, "NA HY", null, "HY", 5, 10, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.10.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922814", "9043524", - "CDX-NAHYS10V5 - 0611", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_03YR_96/100", 2454554, 2455733, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDB3", "CDX", 10, "NA HY", null, "HY", 5, 3, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922815", "9043528", - "CDX-NAHYBS10V3 - 0613", "CDX.NA.HY.B.10", - "CDX_NA_HY_S10_B___SWP_43/45", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSDB1", "CDX", 10, "NA HY B", null, "HY", 3, 5, - null, 0.95556, 45, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.11.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922816", "9043532", - "CDX-NAHYS11V5 - 1218", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_10YR_96/100", 2454738, 2458473, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDC1", "CDX", 11, "NA HY", null, "HY", 5, 10, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.11.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922817", "9043544", - "CDX-NAHYS11V5 - 1213", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_96/100", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDC1", "CDX", 11, "NA HY", null, "HY", 5, 5, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.11.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922818", "9043546", - "CDX-NAHYS11V5 - 1211", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_03YR_96/100", 2454738, 2455916, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDC1", "CDX", 11, "NA HY", null, "HY", 5, 3, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.11.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922819", "9043550", - "CDX-NAHYS11V5 - 1215", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_07YR_96/100", 2454738, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDC1", "CDX", 11, "NA HY", null, "HY", 5, 7, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.11.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922820", "9043556", - "CDX-NAHYBS11V3 - 1213", "CDX.NA.HY.B.11", - "CDX_NA_HY_S11_B___SWP_34/36", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSDC9", "CDX", 11, "NA HY B", null, "HY", 3, 5, - null, 0.94446, 36, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.10.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922826", "9043502", - "CDX-NAHYS10V5 - 0610", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_02YR_96/100", 2454554, 2455368, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDB3", "CDX", 10, "NA HY", null, "HY", 5, 2, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.10.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922827", "9043506", - "CDX-NAHYS10V5 - 0609", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_01YR_96/100", 2454554, 2455003, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDB3", "CDX", 10, "NA HY", null, "HY", 5, 1, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.10.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922828", "9043509", - "CDX-NAHYS10V5 - 0612", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_04YR_96/100", 2454554, 2456099, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDB3", "CDX", 10, "NA HY", null, "HY", 5, 4, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.10.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922829", "9043512", - "CDX-NAHYS10V5 - 0614", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_06YR_96/100", 2454554, 2456829, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDB3", "CDX", 10, "NA HY", null, "HY", 5, 6, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.11.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922830", "9043535", - "CDX-NAHYS11V5 - 1209", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_01YR_96/100", 2454738, 2455186, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDC1", "CDX", 11, "NA HY", null, "HY", 5, 1, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.11.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922831", "9043558", - "CDX-NAHYHBS11V4 - 1213", "CDX.NA.HY.HB.11", - "CDX_NA_HY_S11_HB__SWP_27/30", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWBO6", "CDX", 11, "NA HY HB", null, "HY", 4, 5, - null, 0.9000100000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.11.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922832", "9043543", - "CDX-NAHYS11V5 - 1212", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_04YR_96/100", 2454738, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDC1", "CDX", 11, "NA HY", null, "HY", 5, 4, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.11.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922833", "9043539", - "CDX-NAHYS11V5 - 1214", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_06YR_96/100", 2454738, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDC1", "CDX", 11, "NA HY", null, "HY", 5, 6, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.11.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922834", "9043538", - "CDX-NAHYS11V5 - 1210", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_02YR_96/100", 2454738, 2455551, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDC1", "CDX", 11, "NA HY", null, "HY", 5, 2, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922840", "9029450", - "ITRAXX-XOVERS4V2 - 1210", "iTraxx Europe Crossover Series 4 Version 2", - "ITRAXX-XOVERS4V2-1210 EUR SEN MMR I03 CDS", 2453634, 2455551, 0.029500000000000002, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAO6", "ITRAXX", 4, "XOVER", "XVR", "XO", 2, 5, - "242899", 0.975, 40, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922841", "9029451", - "ITRAXX-XOVERS4V2 - 1215", "iTraxx Europe Crossover Series 4 Version 2", - "ITRAXX-XOVERS4V2-1215 EUR SEN MMR I03 CDS", 2453634, 2457377, 0.0345, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAO6", "ITRAXX", 4, "XOVER", "XVR", "XO", 2, 10, - "242899", 0.975, 40, 0, "LON", true, true, true, "ITRXEX04", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVERV25Y296.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922842", "9029394", - "ITRAXX-XOVERS4V2-5Y296 - 1210", "iTraxx Europe Crossover Series 4 Version 2", - "ITRAXX-XOVERS4V2-5Y296 EUR SEN MMR I03 CDS", 2453634, 2455551, 0.0296, "EUR", - "ACT/360", false, 0.4, 2, "2I667KAO6 296", "ITRAXX", 4, "XOVERV25Y296", "XVR", "XO", 2, 5, - "242899", 0.975, 40, 0, "LON", true, true, true, "ITRXEX54", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922843", "9029412", - "ITRAXX-XOVERS5V2 - 0611", "iTraxx Europe Crossover Series 5 Version 2", - "ITRAXX-XOVERS5V2-0611 EUR SEN MMR I03 CDS", 2453815, 2455733, 0.029, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAP3", "ITRAXX", 5, "XOVER", "XVR", "XO", 2, 5, - "242892", 0.9777, 44, 0, "LON", true, true, true, "ITRXEX55", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922844", "9029418", - "ITRAXX-XOVERS5V2 - 0616", "iTraxx Europe Crossover Series 5 Version 2", - "ITRAXX-XOVERS5V2-0616 EUR SEN MMR I03 CDS", 2453815, 2457560, 0.035, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAP3", "ITRAXX", 5, "XOVER", "XVR", "XO", 2, 10, - "242892", 0.9777, 44, 0, "LON", true, true, true, "ITRXEX05", "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922852", "9029419", - "USD ITRAXX-XOVERS5V2 - 0611", "iTraxx Europe Crossover Series 5 Version 2", - "ITRAXX-XOVERS5V2-0611 USD SEN MMR I03 CDS", 2453815, 2455733, 0.029, "USD", - "ACT/360", false, 0.4, 4, "2I667KAP3", "USD ITRAXX", 5, "XOVER", "XVR", "XO", 2, 5, - null, 0.9777, 44, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922853", "9029473", - "ITRAXX-XOVERS6V2 - 1211", "iTraxx Europe Crossover series 6 Version 2", - "ITRAXX-XOVERS6V2-1211 EUR SEN MMR I03 CDS", 2453999, 2455916, 0.028, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAQ1", "ITRAXX", 6, "XOVER", "XVR", "XO", 2, 5, - "242893", 0.9777, 44, 0, "LON", true, true, true, "ITRXEX56", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922854", "9029476", - "ITRAXX-XOVERS6V2 - 1216", "iTraxx Europe Crossover series 6 Version 2", - "ITRAXX-XOVERS6V2-1216 EUR SEN MMR I03 CDS", 2453999, 2457743, 0.0345, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAQ1", "ITRAXX", 6, "XOVER", "XVR", "XO", 2, 10, - "242893", 0.9777, 44, 0, "LON", true, true, true, "ITRXEX06", "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922855", "9029494", - "USD ITRAXX-XOVERS6V2 - 1211", "iTraxx Europe Crossover Series 6 Version 2", - "ITRAXX-XOVERS6V2-1211 USD SEN MMR I03 CDS", 2453999, 2455916, 0.028, "USD", - "ACT/360", false, 0.4, 4, "2I667KAQ1", "USD ITRAXX", 6, "XOVER", "XVR", "XO", 2, 5, - null, 0.9777, 44, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922856", "9029487", - "ITRAXX-XOVERS7V2 - 0612", "iTraxx Europe Crossover series 7 Version 2", - "ITRAXX-XOVERS7V2-0612 EUR SEN MMR I03 CDS MATURED", 2454180, 2456099, 0.023, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAR9", "ITRAXX", 7, "XOVER", "XVR", "XO", 2, 5, - "242894", 0.98, 50, 0, "LON", true, true, true, "ITRXEX57", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922857", "9029495", - "ITRAXX-XOVERS7V2 - 0617", "iTraxx Europe Crossover series 7 Version 2", - "ITRAXX-XOVERS7V2-0617 EUR SEN MMR I03 CDS MATURED", 2454180, 2457925, 0.032, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAR9", "ITRAXX", 7, "XOVER", "XVR", "XO", 2, 10, - "242894", 0.98, 50, 0, "LON", true, true, true, "ITRXEX07", "XVR")); - - return true; - } - - private static final boolean InitCDXRefDataSet20() - { - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922858", "9029496", - "USD ITRAXX-XOVERS7V2 - 0612", "iTraxx Europe Crossover series 7 Version 2", - "ITRAXX-XOVERS7V2-0612 USD SEN MMR I03 CDS MATURED", 2454180, 2456099, 0.023, "USD", - "ACT/360", false, 0.4, 4, "2I667KAR9", "USD ITRAXX", 7, "XOVER", "XVR", "XO", 2, 5, - null, 0.98, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922859", "9029374", - "ITRAXX-XOVERS8V2 - 1210", "iTraxx Europe Crossover series 8 Version 2", - "ITRAXX-XOVERS8V2-1210 EUR SEN MMR I03 CDS MATURED", 2454364, 2455551, 0.027, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAS7", "ITRAXX", 8, "XOVER", "XVR", "XO", 2, 3, - "242895", 0.98, 50, 0, "LON", true, true, true, "ITRXEX38", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922860", "9029379", - "ITRAXX-XOVERS8V2 - 1212", "iTraxx Europe Crossover series 8 Version 2", - "ITRAXX-XOVERS8V2-1212 EUR SEN MMR I03 CDS MATURED", 2454364, 2456282, 0.0375, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAS7", "ITRAXX", 8, "XOVER", "XVR", "XO", 2, 5, - "242895", 0.98, 50, 0, "LON", true, true, true, "ITRXEX58", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922862", "9029381", - "ITRAXX-XOVERS8V2 - 1214", "iTraxx Europe Crossover series 8 Version 2", - "ITRAXX-XOVERS8V2-1214 EUR SEN MMR I03 CDS MATURED", 2454364, 2457012, 0.039, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAS7", "ITRAXX", 8, "XOVER", "XVR", "XO", 2, 7, - "242895", 0.98, 50, 0, "LON", true, true, true, "ITRXEX78", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922863", "9029384", - "ITRAXX-XOVERS8V2 - 1217", "iTraxx Europe Crossover series 8 Version 2", - "ITRAXX-XOVERS8V2-1217 EUR SEN MMR I03 CDS MATURED", 2454364, 2458108, 0.046, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAS7", "ITRAXX", 8, "XOVER", "XVR", "XO", 2, 10, - "242895", 0.98, 50, 0, "LON", true, true, true, "ITRXEX08", "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922864", "9029452", - "USD ITRAXX-XOVERS8V2 - 1212", "iTraxx Europe Crossover series 8 Version 2", - "ITRAXX-XOVERS8V2-1212 USD SEN MMR I03 CDS MATURED", 2454364, 2456282, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I667KAS7", "USD ITRAXX", 8, "XOVER", "XVR", "XO", 2, 5, - null, 0.98, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922865", "9029357", - "ITRAXX-XOVERS9V2 - 0611", "iTraxx Europe Crossover series 9 Version 2", - "ITRAXX-XOVERS9V2-0611 EUR SEN MMR I03 CDS MATURED", 2454546, 2455733, 0.0625, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAM0", "ITRAXX", 9, "XOVER", "XVR", "XO", 2, 3, - "242896", 0.98, 50, 0, "LON", true, true, true, "ITRXEX39", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922866", "9029358", - "ITRAXX-XOVERS9V2 - 0613", "iTraxx Europe Crossover series 9 Version 2", - "ITRAXX-XOVERS9V2-0613 EUR SEN MMR I03 CDS MATURED", 2454546, 2456464, 0.065, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAM0", "ITRAXX", 9, "XOVER", "XVR", "XO", 2, 5, - "242896", 0.98, 50, 0, "LON", true, true, true, "ITRXEX59", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922867", "9029362", - "ITRAXX-XOVERS9V2 - 0618", "iTraxx Europe Crossover series 9 Version 2", - "ITRAXX-XOVERS9V2-0618 EUR SEN MMR I03 CDS MATURED", 2454546, 2458290, 0.064, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAM0", "ITRAXX", 9, "XOVER", "XVR", "XO", 2, 10, - "242896", 0.98, 50, 0, "LON", true, true, true, "ITRXEX09", "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922868", "9029368", - "USD ITRAXX-XOVERS9V2 - 0613", "iTraxx Europe Crossover series 9 Version 2", - "ITRAXX-XOVERS9V2-0613 USD SEN MMR I03 CDS MATURED", 2454546, 2456464, 0.065, "USD", - "ACT/360", false, 0.4, 4, "2I667KAM0", "USD ITRAXX", 9, "XOVER", "XVR", "XO", 2, 5, - null, 0.98, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922869", "9029355", - "ITRAXX-XOVERS10V2 - 1211", "iTraxx Europe Crossover series 10 Version 2", - "ITRAXX-XOVERS10V2-1211 EUR SEN MMR I03 CDS MATURED", 2454739, 2455916, 0.053000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAN8", "ITRAXX", 10, "XOVER", "XVR", "XO", 2, 3, - "242897", 0.98, 50, 0, "LON", true, true, true, "ITXEX310", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922870", "9029359", - "ITRAXX-XOVERS10V2 - 1213", "iTraxx Europe Crossover series 10 Version 2", - "ITRAXX-XOVERS10V2-1213 EUR SEN MMR I03 CDS MATURED", 2454739, 2456647, 0.056, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAN8", "ITRAXX", 10, "XOVER", "XVR", "XO", 2, 5, - "242897", 0.98, 50, 0, "LON", true, true, true, "ITXEX510", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922871", "9029363", - "ITRAXX-XOVERS10V2 - 1215", "iTraxx Europe Crossover series 10 Version 2", - "ITRAXX-XOVERS10V2-1215 EUR SEN MMR I03 CDS MATURED", 2454739, 2457377, 0.055, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAN8", "ITRAXX", 10, "XOVER", "XVR", "XO", 2, 7, - "242897", 0.98, 50, 0, "LON", true, true, true, "ITXEX710", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922872", "9029365", - "ITRAXX-XOVERS10V2 - 1218", "iTraxx Europe Crossover series 10 Version 2", - "ITRAXX-XOVERS10V2-1218 EUR SEN MMR I03 CDS MATURED", 2454739, 2458473, 0.054, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAN8", "ITRAXX", 10, "XOVER", "XVR", "XO", 2, 10, - "242897", 0.98, 50, 0, "LON", true, true, true, "ITXEX010", "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922873", "9029370", - "USD ITRAXX-XOVERS10V2 - 1213", "iTraxx Europe Crossover series 10 Version 2", - "ITRAXX-XOVERS10V2-1213 USD SEN MMR I03 CDS MATURED", 2454739, 2456647, 0.056, "USD", - "ACT/360", false, 0.4, 4, "2I667KAN8", "USD ITRAXX", 10, "XOVER", "XVR", "XO", 2, 5, - null, 0.98, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922874", "9029432", - "USD ITRAXX-XOVERS10V2 - 1218", "iTraxx Europe Crossover series 10 Version 2", - "ITRAXX-XOVERS10V2-1218 USD SEN MMR I03 CDS MATURED", 2454739, 2458473, 0.054, "USD", - "ACT/360", false, 0.4, 4, "2I667KAN8", "USD ITRAXX", 10, "XOVER", "XVR", "XO", 2, 10, - null, 0.98, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922885", "9046456", - "ITRAXX-LevXS4V1 - 0614", "iTraxx LevX Senior Index Series 4 Version 1", - "ITRAXX LEVX SENIOR SERIES 4 VERSION 1 EUR 1ST SEC RES I03 CDS", 2454911, 2456829, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJCA0", "ITRAXX", 4, "LevX", null, "IG", 1, 5, - null, 1, 50, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922978", "9049224", - "CDX-NAHYS10V6 - 0613", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_95/100", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDD9", "CDX", 10, "NA HY", null, "HY", 6, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922980", "9049227", - "CDX-NAHYS10V6 - 0615", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_07YR_95/100", 2454554, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDD9", "CDX", 10, "NA HY", null, "HY", 6, 7, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922982", "9049230", - "CDX-NAHYS10V6 - 0618", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_10YR_95/100", 2454554, 2458290, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDD9", "CDX", 10, "NA HY", null, "HY", 6, 10, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922984", "9049222", - "CDX-NAHYS10V6 - 0611", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_03YR_95/100", 2454554, 2455733, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDD9", "CDX", 10, "NA HY", null, "HY", 6, 3, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922987", "9049231", - "CDX-NAHYBBS10V2 - 0613", "CDX.NA.HY.BB.10", - "CDX_NA_HY_S10_BB__SWP_32/33", 2454554, 2456464, 0.04, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBE0", "CDX", 10, "NA HY BB", null, "HY", 2, 5, - null, 0.9696899999999999, 33, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.11.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922991", "9047247", - "CDX-NAHYS11V6 - 1218", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_10YR_95/100", 2454738, 2458473, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDE7", "CDX", 11, "NA HY", null, "HY", 6, 10, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.11.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("922992", "9047216", - "CDX-NAHYS11V6 - 1213", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_95/100", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDE7", "CDX", 11, "NA HY", null, "HY", 6, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("MCDX SERIES12 3YR.MCDX SERIE 3YR.3Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923027", "9047124", - "MCDX SERIES12 3YR - 0612", "MCDX.NA.12", - "MCDX SERIES 12 3Y", 2454926, 2456099, 0.01, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAC1", "MCDX SERIES12 3YR", 12, "MCDX SERIE 3YR", null, "IG", 1, 3, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("MCDX SERIES12 5YR.MCDX SERIE 5YR.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923028", "9047125", - "MCDX SERIES12 5YR - 0614", "MCDX.NA.12", - "MCDX SERIES 12 5Y", 2454926, 2456829, 0.01, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAC1", "MCDX SERIES12 5YR", 12, "MCDX SERIE 5YR", null, "IG", 1, 5, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("MCDX SERIES12 10YR.MCDX SERIE 10YR.10Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923029", "9047126", - "MCDX SERIES12 10YR - 0619", "MCDX.NA.12", - "MCDX SERIES 12 10Y", 2454926, 2458655, 0.01, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAC1", "MCDX SERIES12 10YR", 12, "MCDX SERIE 10YR", null, "IG", 1, 10, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.11.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923030", "9047243", - "CDX-NAHYS11V6 - 1214", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_06YR_95/100", 2454738, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDE7", "CDX", 11, "NA HY", null, "HY", 6, 6, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.11.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923031", "9047246", - "CDX-NAHYS11V6 - 1210", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_02YR_95/100", 2454738, 2455551, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDE7", "CDX", 11, "NA HY", null, "HY", 6, 2, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.3Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923032", "9047612", - "CDX-NAXOS8V3 - 0610", "CDX.NA.XO.8", - "CDX_NA_XO_S8_03YR_06/10_33/35", 2454181, 2455368, 0.0085, "USD", - "ACT/360", false, 0.4, 4, "1D764IAR8", "CDX", 8, "NAXO", null, "XO", 3, 3, - null, 0.94286, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.5Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923033", "9047665", - "CDX-NAXOS8V3 - 0612", "CDX.NA.XO.8", - "CDX_NA_XO_S8_05YR_06/12_33/35", 2454181, 2456099, 0.014, "USD", - "ACT/360", false, 0.4, 4, "1D764IAR8", "CDX", 8, "NA XO", null, "XO", 3, 5, - null, 0.94286, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.7Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923034", "9047668", - "CDX-NAXOS8V3 - 0614", "CDX.NA.XO.8", - "CDX_NA_XO_S8_07YR_06/14_33/35", 2454181, 2456829, 0.018500000000000003, "USD", - "ACT/360", false, 0.4, 4, "1D764IAR8", "CDX", 8, "NA XO", null, "XO", 3, 7, - null, 0.94286, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.10Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923035", "9047673", - "CDX-NAXOS8V3 - 0617", "CDX.NA.XO.8", - "CDX_NA_XO_S8_10YR_06/17_33/35", 2454181, 2457925, 0.021500000000000002, "USD", - "ACT/360", false, 0.4, 4, "1D764IAR8", "CDX", 8, "NA XO", null, "XO", 3, 10, - null, 0.94286, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.5Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923036", "9047674", - "CDX-NAXOS8V3 EUR - 0612", "CDX.NA.XO.8", - "CDX_NA_XO_S8_05YR_06/12_EUR_33/35", 2454181, 2456099, 0.014, "EUR", - "ACT/360", false, 0.4, 4, "1D764IAR8 EUR", "CDX", 8, "NA XO", null, "XO", 3, 5, - null, 0.94286, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.3Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923037", "9047225", - "CDX-NAXOS11V2 - 1211", "CDX.NA.XO.11", - "CDX_NA_XO_S11_03YR_12/11_34/35", 2454731, 2455916, 0.034, "USD", - "ACT/360", false, 0.4, 4, "1D764IAU1", "CDX", 11, "NA XO", null, "XO", 2, 3, - null, 0.97143, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.3Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923038", "9047282", - "CDX-NAXOS10V2 - 0611", "CDX.NA.XO.10", - "CDX_NA_XO_S10_03YR_06/11_34/35", 2454547, 2455733, 0.035, "USD", - "ACT/360", false, 0.4, 4, "1D764IAT4", "CDX", 10, "NA XO", null, "XO", 2, 3, - null, 0.97143, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.5Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923039", "9047228", - "CDX-NAXOS11V2 - 1213", "CDX.NA.XO.11", - "CDX_NA_XO_S11_05YR_12/13_34/35", 2454731, 2456647, 0.034, "USD", - "ACT/360", false, 0.4, 4, "1D764IAU1", "CDX", 11, "NA XO", null, "XO", 2, 5, - null, 0.97143, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923041", "9049225", - "CDX-NAHYS10V6 - 0609", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_01YR_95/100", 2454554, 2455003, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDD9", "CDX", 10, "NA HY", null, "HY", 6, 1, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923042", "9049226", - "CDX-NAHYS10V6 - 0612", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_04YR_95/100", 2454554, 2456099, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDD9", "CDX", 10, "NA HY", null, "HY", 6, 4, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923044", "9049228", - "CDX-NAHYS10V6 - 0614", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_06YR_95/100", 2454554, 2456829, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDD9", "CDX", 10, "NA HY", null, "HY", 6, 6, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.11.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923045", "9047235", - "CDX-NAHYS11V6 - 1209", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_01YR_95/100", 2454738, 2455186, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDE7", "CDX", 11, "NA HY", null, "HY", 6, 1, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.11.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923046", "9047237", - "CDX-NAHYS11V6 - 1212", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_04YR_95/100", 2454738, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDE7", "CDX", 11, "NA HY", null, "HY", 6, 4, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.5Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923047", "9047284", - "CDX-NAXOS10V2 - 0613", "CDX.NA.XO.10", - "CDX_NA_XO_S10_05YR_06/13_34/35", 2454547, 2456464, 0.035, "USD", - "ACT/360", false, 0.4, 4, "1D764IAT4", "CDX", 10, "NA XO", null, "XO", 2, 5, - null, 0.97143, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.7Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923048", "9049205", - "CDX-NAXOS10V2 - 0615", "CDX.NA.XO.10", - "CDX_NA_XO_S10_07YR_06/15_34/35", 2454547, 2457194, 0.035, "USD", - "ACT/360", false, 0.4, 4, "1D764IAT4", "CDX", 10, "NA XO", null, "XO", 2, 7, - null, 0.97143, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.10Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923050", "9049216", - "CDX-NAXOS10V2 - 0618", "CDX.NA.XO.10", - "CDX_NA_XO_S10_10YR_06/18_34/35", 2454547, 2458290, 0.035, "USD", - "ACT/360", false, 0.4, 4, "1D764IAT4", "CDX", 10, "NA XO", null, "XO", 2, 10, - null, 0.97143, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.5Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923051", "9049219", - "CDX-NAXOS10V2 EUR - 0613", "CDX.NA.XO.10", - "CDX_NA_XO_S10_05YR_06/13_EUR_34/35", 2454547, 2456464, 0.035, "EUR", - "ACT/360", false, 0.4, 4, "1D764IAT4 EUR", "CDX", 10, "NA XO", null, "XO", 2, 5, - null, 0.97143, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.5Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923063", "9047260", - "CDX-NAXOS9V2 - 1212", "CDX.NA.XO.9", - "CDX_NA_XO_S9_05YR_12/12_34/35", 2454365, 2456282, 0.0245, "USD", - "ACT/360", false, 0.4, 4, "1D764IAS6", "CDX", 9, "NA XO", null, "XO", 2, 5, - null, 0.97142, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.3Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923065", "9047677", - "CDX-NAXOS9V2 - 1210", "CDX.NA.XO.9", - "CDX_NA_XO_S9_03YR_12/10_34/35", 2454365, 2455551, 0.02, "USD", - "ACT/360", false, 0.4, 4, "1D764IAS6", "CDX", 9, "NA XO", null, "XO", 2, 3, - null, 0.97142, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.7Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923066", "9047267", - "CDX-NAXOS9V2 - 1214", "CDX.NA.XO.9", - "CDX_NA_XO_S9_07YR_12/14_34/35", 2454365, 2457012, 0.027, "USD", - "ACT/360", false, 0.4, 4, "1D764IAS6", "CDX", 9, "NA XO", null, "XO", 2, 7, - null, 0.97142, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.10Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923069", "9047273", - "CDX-NAXOS9V2 - 1217", "CDX.NA.XO.9", - "CDX_NA_XO_S9_10YR_12/17_34/35", 2454365, 2458108, 0.029, "USD", - "ACT/360", false, 0.4, 4, "1D764IAS6", "CDX", 9, "NA XO", null, "XO", 2, 10, - null, 0.97142, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.11.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923070", "9047227", - "CDX-NAHYS11V6 - 1211", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_03YR_95/100", 2454738, 2455916, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDE7", "CDX", 11, "NA HY", null, "HY", 6, 3, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.11.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923071", "9047232", - "CDX-NAHYS11V6 - 1215", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_07YR_95/100", 2454738, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDE7", "CDX", 11, "NA HY", null, "HY", 6, 7, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.5Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923072", "9047275", - "CDX-NAXOS9V2 EUR - 1212", "CDX.NA.XO.9", - "CDX_NA_XO_S9_05YR_12/12_EUR_34/35", 2454365, 2456282, 0.0245, "EUR", - "ACT/360", false, 0.4, 4, "1D764IAS6 EUR", "CDX", 9, "NA XO", null, "XO", 2, 5, - null, 0.97142, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.7Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923073", "9047231", - "CDX-NAXOS11V2 - 1215", "CDX.NA.XO.11", - "CDX_NA_XO_S11_07YR_12/15_34/35", 2454731, 2457377, 0.034, "USD", - "ACT/360", false, 0.4, 4, "1D764IAU1", "CDX", 11, "NA XO", null, "XO", 2, 7, - null, 0.97143, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.10Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923074", "9047234", - "CDX-NAXOS11V2 - 1218", "CDX.NA.XO.11", - "CDX_NA_XO_S11_10YR_12/18_34/35", 2454731, 2458473, 0.034, "USD", - "ACT/360", false, 0.4, 4, "1D764IAU1", "CDX", 11, "NA XO", null, "XO", 2, 10, - null, 0.97143, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923077", "9047254", - "CDX-NAHYBBS11V2 - 1213", "CDX.NA.HY.BB.11", - "CDX_NA_HY_S11_BB__SWP_39/40", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBF7", "CDX", 11, "NA HY BB", null, "HY", 2, 5, - null, 0.975, 40, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.5Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923115", "9047236", - "CDX-NAXOS11V2 EUR - 1213", "CDX.NA.XO.11", - "CDX NA XO S11 05YR 12/13 EUR 34/35", 2454731, 2456647, 0.034, "EUR", - "ACT/360", false, 0.4, 4, "1D764IAU1 EUR", "CDX", 11, "NA XO", null, "XO", 2, 5, - null, 0.97143, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923127", "9049223", - "CDX-NAHYS10V6 - 0610", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_02YR_95/100", 2454554, 2455368, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDD9", "CDX", 10, "NA HY", null, "HY", 6, 2, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923135", "9054435", - "LCDXNAS8V14 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_88/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.6, 4, "5F199GBH9", "LCDX", 8, "LCDXNA", null, "IG", 14, 5, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923136", "9054429", - "LCDXNAS8V14 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_88/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBH9", "LCDX", 8, "LCDXNA", null, "IG", 14, 3, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V14 FXD.LCDXNAV14 FXD.5Y.8.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923137", "9054421", - "LCDXNAS8V14 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_88/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBH9 FXD", "LCDXNAS8V14 FXD", 8, "LCDXNAV14 FXD", null, "IG", 14, 5, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923138", "9054426", - "LCDXNAS8V14 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_88/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBH9", "LCDX", 8, "LCDXNA", null, "IG", 14, 6, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923139", "9054416", - "LCDXNAS8V14 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_88/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBH9", "LCDX", 8, "LCDXNA", null, "IG", 14, 7, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923140", "9053788", - "LCDXNAS8V14 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_88/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBH9", "LCDX", 8, "LCDXNA", null, "IG", 14, 4, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923141", "9053790", - "LCDXNAS8V14 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_88/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBH9", "LCDX", 8, "LCDXNA", null, "IG", 14, 10, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.2.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923143", "9054073", - "CDX-NAHYBBS2V4 - 0909", "Dow Jones CDX.NA.HY.BB.2", - "CDX_NA_HY_S02_BB__SWP_39/42", 2453088, 2455095, 0.029, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBH3", "CDX", 2, "NA HY BB", null, "HY", 4, 5, - null, 0.92857, 42, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.3.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923145", "9054074", - "CDX-NAHYBBS3V4 - 1209", "Dow Jones CDX.NA.HY.BB.3", - "CDX_NA_HY_S03_BB__SWP_40/43", 2453196, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBI1", "CDX", 3, "NA HY BB", null, "HY", 4, 5, - null, 0.93023, 43, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.4.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923147", "9054083", - "CDX-NAHYBBS4V4 - 0610", "DOW JONES CDX.NA.HY.BB.4", - "CDX_NA_HY_S04_BB__SWP_40/43", 2453475, 2455368, 0.021, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBJ9", "CDX", 4, "NA HY BB", null, "HY", 4, 5, - null, 0.93022, 43, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.7Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923148", "9053822", - "CDX-NAXOS5V3 - 1212", "Dow Jones CDX.NA.XO.5", - "DJCDX_NA_XO_S5_07YR_12/12_33/35", 2453635, 2456282, 0.02, "USD", - "ACT/360", false, 0.4, 4, "1D764IAV9", "CDX", 5, "NAXO", null, "XO", 3, 7, - null, 0.94285, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.10Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923149", "9053824", - "CDX-NAXOS5V3 - 1215", "Dow Jones CDX.NA.XO.5", - "DJCDX_NA_XO_S5_10YR_12/15_33/35", 2453635, 2457377, 0.024, "USD", - "ACT/360", false, 0.4, 4, "1D764IAV9", "CDX", 5, "NAXO", null, "XO", 3, 10, - null, 0.94285, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.5Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923150", "9053825", - "CDX-NAXOS5V3 - 1210", "Dow Jones CDX.NA.XO.5", - "DJCDX_NA_XO_S5_05Y_12/10_33/35", 2453635, 2455551, 0.02, "USD", - "ACT/360", false, 0.4, 4, "1D764IAV9", "CDX", 5, "NAXO", null, "XO", 3, 5, - null, 0.94285, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923151", "9053801", - "LCDXNAS9V10 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_92/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.6, 4, "5F199GBI7", "LCDX", 9, "LCDXNA", null, "IG", 10, 5, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923152", "9054033", - "CDX-NAHYBBS5V3 - 1210", "Dow Jones CDX.NA.HY.BB.5", - "CDX_NA_HY_S05_BB__SWP_39/41", 2453651, 2455551, 0.025, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBK6", "CDX", 5, "NA HY BB", null, "HY", 3, 5, - null, 0.95121, 41, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.9.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923153", "9054043", - "LCDXNAS9V10 - 1217", "LCDX.NA.9", - "CDX_NA_LN_S09_100_10YR_92/100", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBI7", "LCDX", 9, "LCDXNA", null, "IG", 10, 10, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.9.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923154", "9054048", - "LCDXNAS9V10 - 1211", "LCDX.NA.9", - "CDX_NA_LN_S09_100_04YR_92/100", 2454378, 2455916, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBI7", "LCDX", 9, "LCDXNA", null, "IG", 10, 4, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.9.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923155", "9054050", - "LCDXNAS9V10 - 1213", "LCDX.NA.9", - "CDX_NA_LN_S09_100_06YR_92/100", 2454378, 2456647, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBI7", "LCDX", 9, "LCDXNA", null, "IG", 10, 6, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.9.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923156", "9054054", - "LCDXNAS9V10 - 1209", "LCDX.NA.9", - "CDX_NA_LN_S09_100_02YR_92/100", 2454378, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBI7", "LCDX", 9, "LCDXNA", null, "IG", 10, 2, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.6.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923157", "9053785", - "CDX-NAHYBS6V5 - 0611", "Dow Jones CDX.NA.HY.B.6", - "CDX_NA_HY_S06_B___SWP_44/48", 2453823, 2455733, 0.030000000000000002, "USD", - "ACT/360", false, 0.3, 4, "2I65BSDE5", "CDX", 6, "NA HY B", null, "HY", 5, 5, - null, 0.91667, 48, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V10 FXD.LCDXNAV10 FXD.5Y.9.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923158", "9054055", - "LCDXNAS9V10 FXD - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_FXD_92/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBI7 FXD", "LCDXNAS9V10 FXD", 9, "LCDXNAV10 FXD", null, "IG", 10, 5, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.7.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923159", "9054211", - "CDX-NAHYBS7V4 - 1211", "Dow Jones CDX.NA.HY.B.7", - "CDX_NA_HY_S07_B___SWP_47/50", 2454007, 2455916, 0.030000000000000002, "USD", - "ACT/360", false, 0.3, 4, "2I65BSDF2", "CDX", 7, "NA HY B", null, "HY", 4, 5, - null, 0.9400000000000001, 50, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.8.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923160", "9053220", - "CDX-NAHYBS8V5 - 0612", "CDX.NA.HY.B.8", - "CDX_NA_HY_S08_B___SWP_45/49", 2454188, 2456099, 0.025, "USD", - "ACT/360", false, 0.3, 4, "2I65BSDG0", "CDX", 8, "NA HY B", null, "HY", 5, 5, - null, 0.91837, 49, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.9.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923161", "9054220", - "LCDXNAS9V10 - 1214", "LCDX.NA.9", - "CDX_NA_LN_S09_100_07YR_92/100", 2454378, 2457012, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBI7", "LCDX", 9, "LCDXNA", null, "IG", 10, 7, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.9.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923162", "9054221", - "LCDXNAS9V10 - 1210", "LCDX.NA.9", - "CDX_NA_LN_S09_100_03YR_92/100", 2454378, 2455551, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBI7", "LCDX", 9, "LCDXNA", null, "IG", 10, 3, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.9.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923163", "9054452", - "CDX-NAHYBS9V6 - 1212", "CDX.NA.HY.B.9", - "CDX_NA_HY_S09_B___SWP_41/46", 2454372, 2456282, 0.035, "USD", - "ACT/360", false, 0.3, 4, "2I65BSDH8", "CDX", 9, "NA HY B", null, "HY", 6, 5, - null, 0.89131, 46, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923164", "9054446", - "CDX-NAHYBS10V4 - 0613", "CDX.NA.HY.B.10", - "CDX_NA_HY_S10_B___SWP_42/45", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSDI6", "CDX", 10, "NA HY B", null, "HY", 4, 5, - null, 0.93333, 45, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDXNAS10V11 FXD.LCDXNAV11 FXD.5Y.10.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923165", "9054226", - "LCDXNAS10V11 FXD - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_FXD_91/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBJ5 FXD", "LCDXNAS10V11 FXD", 10, "LCDXNAV11 FXD", null, "IG", 11, 5, - null, 0.91, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.10.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923166", "9054227", - "LCDXNAS10V11 - 0614", "LCDX.NA.10", - "CDX_NA_LN_S10_100_06YR_91/100", 2454561, 2456829, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBJ5", "LCDX", 10, "LCDXNA", null, "IG", 11, 6, - null, 0.91, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.10.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923167", "9054437", - "LCDXNAS10V11 - 0611", "LCDX.NA.10", - "CDX_NA_LN_S10_100_03YR_91/100", 2454561, 2455733, 0.0275, "USD", - "ACT/360", false, 0.6, 4, "5F199GBJ5", "LCDX", 10, "LCDXNA", null, "IG", 11, 3, - null, 0.91, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923168", "9054440", - "LCDXNAS10V11 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_91/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.6, 4, "5F199GBJ5", "LCDX", 10, "LCDXNA", null, "IG", 11, 5, - null, 0.91, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.10.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923169", "9054439", - "LCDXNAS10V11 - 0609", "LCDX.NA.10", - "CDX_NA_LN_S10_100_01YR_91/100", 2454561, 2455003, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBJ5", "LCDX", 10, "LCDXNA", null, "IG", 11, 1, - null, 0.91, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.10.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923170", "9054430", - "LCDXNAS10V11 - 0610", "LCDX.NA.10", - "CDX_NA_LN_S10_100_02YR_91/100", 2454561, 2455368, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBJ5", "LCDX", 10, "LCDXNA", null, "IG", 11, 2, - null, 0.91, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.10.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923171", "9054432", - "LCDXNAS10V11 - 0615", "LCDX.NA.10", - "CDX_NA_LN_S10_100_07YR_91/100", 2454561, 2457194, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBJ5", "LCDX", 10, "LCDXNA", null, "IG", 11, 7, - null, 0.91, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.10.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923172", "9054419", - "LCDXNAS10V11 - 0618", "LCDX.NA.10", - "CDX_NA_LN_S10_100_10YR_91/100", 2454561, 2458290, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBJ5", "LCDX", 10, "LCDXNA", null, "IG", 11, 10, - null, 0.91, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.10.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923173", "9054420", - "LCDXNAS10V11 - 0612", "LCDX.NA.10", - "CDX_NA_LN_S10_100_04YR_91/100", 2454561, 2456099, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBJ5", "LCDX", 10, "LCDXNA", null, "IG", 11, 4, - null, 0.91, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.11.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923179", "9054986", - "CDX-NAHYHBS11V7 - 1213", "CDX.NA.HY.HB.11", - "CDX_NA_HY_S11_HB__SWP_26/30", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWCQ0", "CDX", 11, "NA HY HB", null, "HY", 7, 5, - null, 0.86667, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923182", "9054964", - "CDX-NAHYHBS10V6 - 0613", "CDX.NA.HY.HB.10", - "CDX_NA_HY_S10_HB__SWP_27/30", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWCN7", "CDX", 10, "NA HY HB", null, "HY", 6, 5, - null, 0.9, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.11.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923183", "9054963", - "CDX-NAHYS11V9 - 1209", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_01YR_94/100", 2454738, 2455186, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BREV8", "CDX", 11, "NA HY", null, "HY", 9, 1, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.11.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923184", "9054962", - "CDX-NAHYS11V9 - 1212", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_04YR_94/100", 2454738, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BREV8", "CDX", 11, "NA HY", null, "HY", 9, 4, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.11.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923185", "9054958", - "CDX-NAHYS11V9 - 1218", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_10YR_94/100", 2454738, 2458473, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BREV8", "CDX", 11, "NA HY", null, "HY", 9, 10, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.11.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923186", "9054960", - "CDX-NAHYS11V9 - 1213", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_94/100", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BREV8", "CDX", 11, "NA HY", null, "HY", 9, 5, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet21() - { - UpdateCDXRefDataMap ("CDX.NA HY.6Y.11.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923187", "9054981", - "CDX-NAHYS11V9 - 1214", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_06YR_94/100", 2454738, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BREV8", "CDX", 11, "NA HY", null, "HY", 9, 6, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.11.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923188", "9054982", - "CDX-NAHYS11V9 - 1210", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_02YR_94/100", 2454738, 2455551, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BREV8", "CDX", 11, "NA HY", null, "HY", 9, 2, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.3.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923190", "9055088", - "CDX-NAHYS3V12 - 1209", "Dow Jones CDX.NA.HY.3", - "CDX_NA_HY_S03_100_SWP_90/100", 2453196, 2455186, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BREC0", "CDX", 3, "NA HY", null, "HY", 12, 5, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.3.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923191", "9055151", - "CDX-NAHYS3V12 - 1214", "Dow Jones CDX.NA.HY.3", - "CDX_NA_HY_S03_100_SWP_10YR_90/100", 2453196, 2457012, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BREC0", "CDX", 3, "NA HY", null, "HY", 12, 10, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.4.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923192", "9055153", - "CDX-NAHYHBS4V8 - 0610", "Dow Jones CDX.NA.HY.HB.4", - "CDX_NA_HY_S04_HB__SWP_24/30", 2453475, 2455368, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWCT4", "CDX", 4, "NA HY HB", null, "HY", 8, 5, - null, 0.7998000000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.6.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923193", "9054720", - "CDX-NAHYS6V9 - 0613", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_07YR_93/100", 2453823, 2456464, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BREI7", "CDX", 6, "NA HY", null, "HY", 9, 7, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.11.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923194", "9054983", - "CDX-NAHYS11V9 - 1211", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_03YR_94/100", 2454738, 2455916, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BREV8", "CDX", 11, "NA HY", null, "HY", 9, 3, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.4.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923195", "9055089", - "CDX-NAHYS4V12 - 0610", "Dow Jones CDX.NA.HY.4", - "CDX_NA_HY_S04_100_SWP_90/100", 2453475, 2455368, 0.036000000000000004, "USD", - "ACT/360", false, 0.3, 4, "2I65BREE6", "CDX", 4, "NA HY", null, "HY", 12, 5, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.6.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923196", "9054724", - "CDX-NAHYS6V9 - 0611", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_93/100", 2453823, 2455733, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BREI7", "CDX", 6, "NA HY", null, "HY", 9, 5, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.5.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923198", "9055258", - "CDX-NAHYHBS5V8 - 1210", "Dow Jones CDX.NA.HY.HB.5", - "CDX_NA_HY_S05_HB__SWP_24/30", 2453651, 2455551, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWCD9", "CDX", 5, "NA HY HB", null, "HY", 8, 5, - null, 0.7998000000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.5.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923199", "9054706", - "CDX-NAHYS5V11 - 1210", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_91/100", 2453651, 2455551, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BREG1", "CDX", 5, "NA HY", null, "HY", 11, 5, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.11.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923200", "9054984", - "CDX-NAHYS11V9 - 1215", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_07YR_94/100", 2454738, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BREV8", "CDX", 11, "NA HY", null, "HY", 9, 7, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.6.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923201", "9054725", - "CDX-NAHYS6V9 - 0610", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_04YR_93/100", 2453823, 2455368, 0.0345, "USD", - "ACT/360", false, 0.4, 4, "2I65BREI7", "CDX", 6, "NA HY", null, "HY", 9, 4, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.6.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923202", "9054710", - "CDX-NAHYS6V9 - 0609", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_03YR_93/100", 2453823, 2455003, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BREI7", "CDX", 6, "NA HY", null, "HY", 9, 3, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.6.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923203", "9054730", - "CDX-NAHYS6V9 - 0612", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_06YR_93/100", 2453823, 2456099, 0.0345, "USD", - "ACT/360", false, 0.4, 4, "2I65BREI7", "CDX", 6, "NA HY", null, "HY", 9, 6, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.5.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923204", "9055090", - "CDX-NAHYS5V11 - 1215", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_10YR_91/100", 2453651, 2457377, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BREG1", "CDX", 5, "NA HY", null, "HY", 11, 10, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.6.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923205", "9054714", - "CDX-NAHYS6V9 - 0616", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_10YR_93/100", 2453823, 2457560, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BREI7", "CDX", 6, "NA HY", null, "HY", 9, 10, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.10.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923206", "9055363", - "CDX-NAHYS10V9 - 0612", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_04YR_94/100", 2454554, 2456099, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRES5", "CDX", 10, "NA HY", null, "HY", 9, 4, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.7.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923207", "9054733", - "CDX-NAHYHBS7V6 - 1211", "Dow Jones CDX.NA.HY.HB.7", - "CDX_NA_HY_S07_HB__SWP_26/30", 2454007, 2455916, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWCH0", "CDX", 7, "NA HY HB", null, "HY", 6, 5, - null, 0.86667, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.5.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923208", "9054692", - "CDX-NAHYS5V11 - 1212", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_07YR_91/100", 2453651, 2456282, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BREG1", "CDX", 5, "NA HY", null, "HY", 11, 7, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.8.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923209", "9054735", - "CDX-NAHYS8V9 - 0609", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_02YR_94/100", 2454188, 2455003, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BREM8", "CDX", 8, "NA HY", null, "HY", 9, 2, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.8.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923210", "9054737", - "CDX-NAHYS8V9 - 0614", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_07YR_94/100", 2454188, 2456829, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BREM8", "CDX", 8, "NA HY", null, "HY", 9, 7, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.8.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923211", "9054739", - "CDX-NAHYS8V9 - 0612", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_94/100", 2454188, 2456099, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BREM8", "CDX", 8, "NA HY", null, "HY", 9, 5, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.8.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923212", "9055023", - "CDX-NAHYS8V9 - 0610", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_03YR_94/100", 2454188, 2455368, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BREM8", "CDX", 8, "NA HY", null, "HY", 9, 3, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.8.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923213", "9055026", - "CDX-NAHYS8V9 - 0617", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_10YR_94/100", 2454188, 2457925, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BREM8", "CDX", 8, "NA HY", null, "HY", 9, 10, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.8.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923214", "9055259", - "CDX-NAHYS8V9 - 0611", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_04YR_94/100", 2454188, 2455733, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BREM8", "CDX", 8, "NA HY", null, "HY", 9, 4, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.8.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923216", "9055260", - "CDX-NAHYS8V9 - 0613", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_06YR_94/100", 2454188, 2456464, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BREM8", "CDX", 8, "NA HY", null, "HY", 9, 6, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.10.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923217", "9055365", - "CDX-NAHYS10V9 - 0614", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_06YR_94/100", 2454554, 2456829, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRES5", "CDX", 10, "NA HY", null, "HY", 9, 6, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.8.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923219", "9055262", - "CDX-NAHYHBS8V6 - 0612", "CDX.NA.HY.HB.8", - "CDX_NA_HY_S08_HB__SWP_26/30", 2454188, 2456099, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BWCJ6", "CDX", 8, "NA HY HB", null, "HY", 6, 5, - null, 0.86667, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.9.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923220", "9055031", - "CDX-NAHYS9V10 - 1212", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_93/100", 2454372, 2456282, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BREP1", "CDX", 9, "NA HY", null, "HY", 10, 5, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.9.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923227", "9055263", - "CDX-NAHYS9V10 - 1211", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_04YR_ 93/100", 2454372, 2455916, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BREP1", "CDX", 9, "NA HY", null, "HY", 10, 4, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.9.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923232", "9055034", - "CDX-NAHYS9V10 - 1210", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_03YR_ 93/100", 2454372, 2455551, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BREP1", "CDX", 9, "NA HY", null, "HY", 10, 3, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.9.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923234", "9055036", - "CDX-NAHYS9V10 - 1214", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_07YR_ 93/100", 2454372, 2457012, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BREP1", "CDX", 9, "NA HY", null, "HY", 10, 7, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.6.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923235", "9054721", - "CDX-NAHYHBS6V6 - 0611", "Dow Jones CDX.NA.HY.HB.6", - "CDX_NA_HY_S06_HB__SWP_26/30", 2453823, 2455733, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWCF4", "CDX", 6, "NA HY HB", null, "HY", 6, 5, - null, 0.86666, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.9.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923237", "9055053", - "CDX-NAHYS9V10 - 1217", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_10YR_ 93/100", 2454372, 2458108, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BREP1", "CDX", 9, "NA HY", null, "HY", 10, 10, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.7.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923238", "9054722", - "CDX-NAHYS7V8 - 1211", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_94/100", 2454007, 2455916, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BREK2", "CDX", 7, "NA HY", null, "HY", 8, 5, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.7.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923239", "9054726", - "CDX-NAHYS7V8 - 1209", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_03YR_94/100", 2454007, 2455186, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BREK2", "CDX", 7, "NA HY", null, "HY", 8, 3, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.9.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923240", "9055266", - "CDX-NAHYS9V10 - 1213", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_06YR_ 93/100", 2454372, 2456647, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BREP1", "CDX", 9, "NA HY", null, "HY", 10, 6, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.9.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923241", "9055264", - "CDX-NAHYS9V10 - 1209", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_02YR_ 93/100", 2454372, 2455186, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BREP1", "CDX", 9, "NA HY", null, "HY", 10, 2, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.7.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923242", "9054723", - "CDX-NAHYS7V8 - 1213", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_07YR_94/100", 2454007, 2456647, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BREK2", "CDX", 7, "NA HY", null, "HY", 8, 7, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.7.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923243", "9054727", - "CDX-NAHYS7V8 - 1216", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_10YR_94/100", 2454007, 2457743, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BREK2", "CDX", 7, "NA HY", null, "HY", 8, 10, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.9.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923244", "9055267", - "CDX-NAHYHBS9V6 - 1212", "CDX.NA.HY.HB.9", - "CDX_NA_HY_S09_HB__SWP_26/30", 2454372, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BWCL1", "CDX", 9, "NA HY HB", null, "HY", 6, 5, - null, 0.86667, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.10.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923245", "9055095", - "CDX-NAHYS10V9 - 0613", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_94/100", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRES5", "CDX", 10, "NA HY", null, "HY", 9, 5, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.10.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923246", "9055054", - "CDX-NAHYS10V9 - 0615", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_07YR_94/100", 2454554, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRES5", "CDX", 10, "NA HY", null, "HY", 9, 7, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.10.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923247", "9055057", - "CDX-NAHYS10V9 - 0618", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_10YR_94/100", 2454554, 2458290, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRES5", "CDX", 10, "NA HY", null, "HY", 9, 10, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.10.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923248", "9055058", - "CDX-NAHYS10V9 - 0611", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_03YR_94/100", 2454554, 2455733, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRES5", "CDX", 10, "NA HY", null, "HY", 9, 3, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.10.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923249", "9055360", - "CDX-NAHYS10V9 - 0610", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_02YR_94/100", 2454554, 2455368, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRES5", "CDX", 10, "NA HY", null, "HY", 9, 2, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.10.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923250", "9055362", - "CDX-NAHYS10V9 - 0609", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_01YR_94/100", 2454554, 2455003, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRES5", "CDX", 10, "NA HY", null, "HY", 9, 1, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.2.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923252", "9055085", - "CDX-NAHYS2V11 - 0909", "Dow Jones CDX.NA.HY.2", - "DJIBOXX_NA_HY_S02_100_SWP_88/100", 2453088, 2455095, 0.043000000000000003, "USD", - "ACT/360", false, 0.3, 4, "2I65BREA4", "CDX", 2, "NA HY", null, "HY", 11, 5, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.10.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923255", "9054441", - "CDX-NAHYS10V10 - 0613", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_93/100", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRET3", "CDX", 10, "NA HY", null, "HY", 10, 5, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.10.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923256", "9054406", - "CDX-NAHYS10V10 - 0615", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_07YR_93/100", 2454554, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRET3", "CDX", 10, "NA HY", null, "HY", 10, 7, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.10.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923257", "9054410", - "CDX-NAHYS10V10 - 0618", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_10YR_93/100", 2454554, 2458290, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRET3", "CDX", 10, "NA HY", null, "HY", 10, 10, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.10.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923258", "9054413", - "CDX-NAHYS10V10 - 0611", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_03YR_93/100", 2454554, 2455733, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRET3", "CDX", 10, "NA HY", null, "HY", 10, 3, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.10.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923260", "9054418", - "CDX-NAHYS10V10 - 0610", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_02YR_93/100", 2454554, 2455368, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRET3", "CDX", 10, "NA HY", null, "HY", 10, 2, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.10.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923262", "9054427", - "CDX-NAHYS10V10 - 0609", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_01YR_93/100", 2454554, 2455003, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRET3", "CDX", 10, "NA HY", null, "HY", 10, 1, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.10.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923263", "9054428", - "CDX-NAHYS10V10 - 0612", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_04YR_93/100", 2454554, 2456099, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRET3", "CDX", 10, "NA HY", null, "HY", 10, 4, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.10.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923264", "9054433", - "CDX-NAHYS10V10 - 0614", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_06YR_93/100", 2454554, 2456829, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRET3", "CDX", 10, "NA HY", null, "HY", 10, 6, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.10.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923265", "9054465", - "CDX-NAHYHBS10V7 - 0613", "CDX.NA.HY.HB.10", - "CDX_NA_HY_S10_HB__SWP_26/30", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWCO5", "CDX", 10, "NA HY HB", null, "HY", 7, 5, - null, 0.86666, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.11.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923266", "9054099", - "CDX-NAHYS11V10 - 1209", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_01YR_93/100", 2454738, 2455186, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BREX4", "CDX", 11, "NA HY", null, "HY", 10, 1, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.11.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923267", "9054100", - "CDX-NAHYS11V10 - 1212", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_04YR_93/100", 2454738, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BREX4", "CDX", 11, "NA HY", null, "HY", 10, 4, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.11.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923268", "9054101", - "CDX-NAHYS11V10 - 1218", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_10YR_93/100", 2454738, 2458473, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BREX4", "CDX", 11, "NA HY", null, "HY", 10, 10, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.11.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923269", "9054104", - "CDX-NAHYS11V10 - 1213", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_93/100", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BREX4", "CDX", 11, "NA HY", null, "HY", 10, 5, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.11.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923270", "9054105", - "CDX-NAHYS11V10 - 1214", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_06YR_93/100", 2454738, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BREX4", "CDX", 11, "NA HY", null, "HY", 10, 6, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.11.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923271", "9053243", - "CDX-NAHYS11V10 - 1210", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_02YR_93/100", 2454738, 2455551, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BREX4", "CDX", 11, "NA HY", null, "HY", 10, 2, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.11.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923272", "9053246", - "CDX-NAHYS11V10 - 1211", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_03YR_93/100", 2454738, 2455916, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BREX4", "CDX", 11, "NA HY", null, "HY", 10, 3, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.11.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923273", "9053248", - "CDX-NAHYS11V10 - 1215", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_07YR_93/100", 2454738, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BREX4", "CDX", 11, "NA HY", null, "HY", 10, 7, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.11.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923274", "9053253", - "CDX-NAHYHBS11V8 - 1213", "CDX.NA.HY.HB.11", - "CDX_NA_HY_S11_HB__SWP_25/30", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWCR8", "CDX", 11, "NA HY HB", null, "HY", 8, 5, - null, 0.83333, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.6.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923278", "9053774", - "CDX-NAHYS6V10 - 0616", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_10YR_92/100", 2453823, 2457560, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BREJ5", "CDX", 6, "NA HY", null, "HY", 10, 10, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.6.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923279", "9053776", - "CDX-NAHYS6V10 - 0613", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_07YR_92/100", 2453823, 2456464, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BREJ5", "CDX", 6, "NA HY", null, "HY", 10, 7, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.8.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923280", "9053195", - "CDX-NAHYS8V10 - 0612", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_93/100", 2454188, 2456099, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BREN6", "CDX", 8, "NA HY", null, "HY", 10, 5, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.8.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923281", "9053202", - "CDX-NAHYS8V10 - 0610", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_03YR_93/100", 2454188, 2455368, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BREN6", "CDX", 8, "NA HY", null, "HY", 10, 3, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.6.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923282", "9053779", - "CDX-NAHYS6V10 - 0611", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_92/100", 2453823, 2455733, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BREJ5", "CDX", 6, "NA HY", null, "HY", 10, 5, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.8.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923283", "9053205", - "CDX-NAHYS8V10 - 0617", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_10YR_93/100", 2454188, 2457925, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BREN6", "CDX", 8, "NA HY", null, "HY", 10, 10, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.6.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923284", "9053780", - "CDX-NAHYS6V10 - 0610", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_04YR_92/100", 2453823, 2455368, 0.0345, "USD", - "ACT/360", false, 0.4, 4, "2I65BREJ5", "CDX", 6, "NA HY", null, "HY", 10, 4, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.8.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923285", "9053207", - "CDX-NAHYS8V10 - 0611", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_04YR_93/100", 2454188, 2455733, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BREN6", "CDX", 8, "NA HY", null, "HY", 10, 4, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.8.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923286", "9053209", - "CDX-NAHYS8V10 - 0613", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_06YR_93/100", 2454188, 2456464, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BREN6", "CDX", 8, "NA HY", null, "HY", 10, 6, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.6.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923287", "9053782", - "CDX-NAHYS6V10 - 0612", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_06YR_92/100", 2453823, 2456099, 0.0345, "USD", - "ACT/360", false, 0.4, 4, "2I65BREJ5", "CDX", 6, "NA HY", null, "HY", 10, 6, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.6.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923289", "9054193", - "CDX-NAHYHBS6V7 - 0611", "Dow Jones CDX.NA.HY.HB.6", - "CDX_NA_HY_S06_HB__SWP_25/30", 2453823, 2455733, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWCG2", "CDX", 6, "NA HY HB", null, "HY", 7, 5, - null, 0.83332, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.7.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923290", "9054194", - "CDX-NAHYS7V9 - 1211", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_93/100", 2454007, 2455916, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BREL0", "CDX", 7, "NA HY", null, "HY", 9, 5, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.7.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923291", "9054197", - "CDX-NAHYS7V9 - 1213", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_07YR_93/100", 2454007, 2456647, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BREL0", "CDX", 7, "NA HY", null, "HY", 9, 7, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.7.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923292", "9054202", - "CDX-NAHYS7V9 - 1209", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_03YR_93/100", 2454007, 2455186, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BREL0", "CDX", 7, "NA HY", null, "HY", 9, 3, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.8.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923293", "9053230", - "CDX-NAHYHBS8V7 - 0612", "CDX.NA.HY.HB.8", - "CDX_NA_HY_S08_HB__SWP_25/30", 2454188, 2456099, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BWCK3", "CDX", 8, "NA HY HB", null, "HY", 7, 5, - null, 0.83333, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.7.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923294", "9054207", - "CDX-NAHYS7V9 - 1216", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_10YR_93/100", 2454007, 2457743, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BREL0", "CDX", 7, "NA HY", null, "HY", 9, 10, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.7.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923295", "9054212", - "CDX-NAHYHBS7V7 - 1211", "Dow Jones CDX.NA.HY.HB.7", - "CDX_NA_HY_S07_HB__SWP_25/30", 2454007, 2455916, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWCI8", "CDX", 7, "NA HY HB", null, "HY", 7, 5, - null, 0.83333, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.9.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923296", "9053237", - "CDX-NAHYS9V11 - 1212", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_92/100", 2454372, 2456282, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BREQ9", "CDX", 9, "NA HY", null, "HY", 11, 5, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.8.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923297", "9054213", - "CDX-NAHYS8V10 - 0609", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_02YR_93/100", 2454188, 2455003, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BREN6", "CDX", 8, "NA HY", null, "HY", 10, 2, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.9.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923298", "9054434", - "CDX-NAHYS9V11 - 1211", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_04YR_ 92/100", 2454372, 2455916, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BREQ9", "CDX", 9, "NA HY", null, "HY", 11, 4, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.9.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923299", "9054442", - "CDX-NAHYS9V11 - 1210", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_03YR_ 92/100", 2454372, 2455551, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BREQ9", "CDX", 9, "NA HY", null, "HY", 11, 3, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.8.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923300", "9054217", - "CDX-NAHYS8V10 - 0614", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_07YR_93/100", 2454188, 2456829, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BREN6", "CDX", 8, "NA HY", null, "HY", 10, 7, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.9.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923301", "9054443", - "CDX-NAHYS9V11 - 1214", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_07YR_ 92/100", 2454372, 2457012, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BREQ9", "CDX", 9, "NA HY", null, "HY", 11, 7, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.9.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923302", "9054448", - "CDX-NAHYS9V11 - 1217", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_10YR_ 92/100", 2454372, 2458108, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BREQ9", "CDX", 9, "NA HY", null, "HY", 11, 10, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.9.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923303", "9054449", - "CDX-NAHYS9V11 - 1213", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_06YR_ 92/100", 2454372, 2456647, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BREQ9", "CDX", 9, "NA HY", null, "HY", 11, 6, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.9.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923304", "9054450", - "CDX-NAHYS9V11 - 1209", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_02YR_ 92/100", 2454372, 2455186, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BREQ9", "CDX", 9, "NA HY", null, "HY", 11, 2, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.9.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923305", "9054447", - "CDX-NAHYHBS9V7 - 1212", "CDX.NA.HY.HB.9", - "CDX_NA_HY_S09_HB__SWP_25/30", 2454372, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BWCM9", "CDX", 9, "NA HY HB", null, "HY", 7, 5, - null, 0.83333, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.2.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923311", "9054069", - "CDX-NAHYS2V12 - 0909", "Dow Jones CDX.NA.HY.2", - "DJIBOXX_NA_HY_S02_100_SWP_87/100", 2453088, 2455095, 0.043000000000000003, "USD", - "ACT/360", false, 0.3, 4, "2I65BREB2", "CDX", 2, "NA HY", null, "HY", 12, 5, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.3.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923312", "9054075", - "CDX-NAHYHBS3V7 - 1209", "Dow Jones CDX.NA.HY.HB.3", - "CDX_NA_HY_S03_HB__SWP_24/30", 2453196, 2455186, 0.0625, "USD", - "ACT/360", false, 0.3, 4, "2I65BWBQ1", "CDX", 3, "NA HY HB", null, "HY", 7, 5, - null, 0.7998000000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.3.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923316", "9054078", - "CDX-NAHYS3V13 - 1209", "Dow Jones CDX.NA.HY.3", - "CDX_NA_HY_S03_100_SWP_89/100", 2453196, 2455186, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRED8", "CDX", 3, "NA HY", null, "HY", 13, 5, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.3.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923317", "9054082", - "CDX-NAHYS3V13 - 1214", "Dow Jones CDX.NA.HY.3", - "CDX_NA_HY_S03_100_SWP_10YR_89/100", 2453196, 2457012, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRED8", "CDX", 3, "NA HY", null, "HY", 13, 10, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.4.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923318", "9054084", - "CDX-NAHYHBS4V9 - 0610", "Dow Jones CDX.NA.HY.HB.4", - "CDX_NA_HY_S04_HB__SWP_23/30", 2453475, 2455368, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWCC1", "CDX", 4, "NA HY HB", null, "HY", 9, 5, - null, 0.7664, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.4.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923319", "9053814", - "CDX-NAHYS4V13 - 0610", "Dow Jones CDX.NA.HY.4", - "CDX_NA_HY_S04_100_SWP_89/100", 2453475, 2455368, 0.036000000000000004, "USD", - "ACT/360", false, 0.3, 4, "2I65BREF3", "CDX", 4, "NA HY", null, "HY", 13, 5, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet22() - { - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.5.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923320", "9054037", - "CDX-NAHYHBS5V9 - 1210", "Dow Jones CDX.NA.HY.HB.5", - "CDX_NA_HY_S05_HB__SWP_23/30", 2453651, 2455551, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWCE7", "CDX", 5, "NA HY HB", null, "HY", 9, 5, - null, 0.7664, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.5.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923321", "9054039", - "CDX-NAHYS5V12 - 1215", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_10YR_90/100", 2453651, 2457377, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BREH9", "CDX", 5, "NA HY", null, "HY", 12, 10, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.5.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923322", "9054042", - "CDX-NAHYS5V12 - 1212", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_07YR_90/100", 2453651, 2456282, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BREH9", "CDX", 5, "NA HY", null, "HY", 12, 7, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.5.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923323", "9053748", - "CDX-NAHYS5V12 - 1210", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_90/100", 2453651, 2455551, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BREH9", "CDX", 5, "NA HY", null, "HY", 12, 5, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.6.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923324", "9053773", - "CDX-NAHYS6V10 - 0609", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_03YR_92/100", 2453823, 2455003, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BREJ5", "CDX", 6, "NA HY", null, "HY", 10, 3, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.7.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923327", "9060981", - "CDX-NAIGS7V4 - 1211", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_05Y_12/11_122/126", 2454000, 2455916, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBU8", "CDX", 7, "NA IG", null, "IG", 4, 5, - null, 0.9720000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.7.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923328", "9060982", - "CDX-NAIGS7V4 - 1209", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_03Y_12/09_122/126", 2454000, 2455186, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBU8", "CDX", 7, "NA IG", null, "IG", 4, 3, - null, 0.9720000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.8.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923329", "9060985", - "CDX-NAHYS8V11 - 0614", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_07YR_92/100", 2454188, 2456829, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BREO4", "CDX", 8, "NA HY", null, "HY", 11, 7, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.8.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923330", "9060986", - "CDX-NAHYS8V11 - 0612", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_92/100", 2454188, 2456099, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BREO4", "CDX", 8, "NA HY", null, "HY", 11, 5, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.8.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923331", "9060987", - "CDX-NAHYS8V11 - 0610", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_03YR_92/100", 2454188, 2455368, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BREO4", "CDX", 8, "NA HY", null, "HY", 11, 3, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.8.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923332", "9060988", - "CDX-NAHYS8V11 - 0617", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_10YR_92/100", 2454188, 2457925, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BREO4", "CDX", 8, "NA HY", null, "HY", 11, 10, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.8.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923333", "9060992", - "CDX-NAHYBS8V6 - 0612", "CDX.NA.HY.B.8", - "CDX_NA_HY_S08_B___SWP_44/49", 2454188, 2456099, 0.025, "USD", - "ACT/360", false, 0.3, 4, "2I65BSDJ4", "CDX", 8, "NA HY B", null, "HY", 6, 5, - null, 0.8979600000000001, 49, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.9.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923334", "9061002", - "CDX-NAHYS9V12 - 1212", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_91/100", 2454372, 2456282, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRER7", "CDX", 9, "NA HY", null, "HY", 12, 5, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.9.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923335", "9061004", - "CDX-NAHYS9V12 - 1210", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_03YR_ 91/100", 2454372, 2455551, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRER7", "CDX", 9, "NA HY", null, "HY", 12, 3, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.9.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923336", "9061005", - "CDX-NAHYS9V12 - 1214", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_07YR_ 91/100", 2454372, 2457012, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRER7", "CDX", 9, "NA HY", null, "HY", 12, 7, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.4.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923337", "9060959", - "CDX-NAIGS4V4 - 0610", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_05Y_6/10_122/126", 2453451, 2455368, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBR5", "CDX", 4, "NA IG", null, "IG", 4, 5, - null, 0.9720000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.9.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923338", "9061006", - "CDX-NAHYS9V12 - 1217", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_10YR_ 91/100", 2454372, 2458108, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRER7", "CDX", 9, "NA HY", null, "HY", 12, 10, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.4.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923339", "9060960", - "CDX-NAIGS4V4 - 0609", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_04Y_6/09_122/126", 2453451, 2455003, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBR5", "CDX", 4, "NA IG", null, "IG", 4, 4, - null, 0.9720000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.5.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923340", "9060962", - "CDX-NAIGS5V4 - 1215", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_10Y_12/15_123/127", 2453635, 2457377, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBS3", "CDX", 5, "NA IG", null, "IG", 4, 10, - null, 0.9720000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.5.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923341", "9060963", - "CDX-NAIGS5V4 - 1212", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_07Y_12/12_123/127", 2453635, 2456282, 0.0055000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBS3", "CDX", 5, "NA IG", null, "IG", 4, 7, - null, 0.9720000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923342", "9060993", - "LCDXNAS8V15 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_87/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.55, 4, "5F199GBK2", "LCDX", 8, "LCDXNA", null, "IG", 15, 5, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.5.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923343", "9060964", - "CDX-NAIGS5V4 - 1210", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_05Y_12/10_123/127", 2453635, 2455551, 0.0045000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBS3", "CDX", 5, "NA IG", null, "IG", 4, 5, - null, 0.9720000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V5 EUR.5Y.6.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923344", "9060969", - "CDX-NAIGS6V5 EUR - 0611", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_05Y_6/11_EUR_122/127", 2453816, 2455733, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYBT1 EUR", "CDX", 6, "NA IG V5 EUR", null, "IG", 5, 5, - null, 0.9640000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.6.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923345", "9060971", - "CDX-NAIGS6V5 - 0616", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_10Y_6/16_122/127", 2453816, 2457560, 0.006500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBT1", "CDX", 6, "NA IG", null, "IG", 5, 10, - null, 0.9640000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.6.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923346", "9060972", - "CDX-NAIGS6V5 - 0613", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_07Y_6/13_122/127", 2453816, 2456464, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBT1", "CDX", 6, "NA IG", null, "IG", 5, 7, - null, 0.9640000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.6.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923347", "9060973", - "CDX-NAIGS6V5 - 0611", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_05Y_6/11_122/127", 2453816, 2455733, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBT1", "CDX", 6, "NA IG", null, "IG", 5, 5, - null, 0.9640000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.6.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923348", "9060974", - "CDX-NAIGS6V5 - 0609", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_03Y_6/09_122/127", 2453816, 2455003, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBT1", "CDX", 6, "NA IG", null, "IG", 5, 3, - null, 0.9640000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.7.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923349", "9060977", - "CDX-NAIGS7V4 - 1213", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_07Y_12/13_122/126", 2454000, 2456647, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBU8", "CDX", 7, "NA IG", null, "IG", 4, 7, - null, 0.9720000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.9.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923350", "9061010", - "CDX-NAHYBS9V7 - 1212", "CDX.NA.HY.B.9", - "CDX_NA_HY_S09_B___SWP_40/46", 2454372, 2456282, 0.035, "USD", - "ACT/360", false, 0.3, 4, "2I65BSDK1", "CDX", 9, "NA HY B", null, "HY", 7, 5, - null, 0.86957, 46, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.7.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923351", "9060980", - "CDX-NAIGS7V4 - 1216", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_10Y_12/16_122/126", 2454000, 2457743, 0.006500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBU8", "CDX", 7, "NA IG", null, "IG", 4, 10, - null, 0.9720000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923352", "9061012", - "LCDXNAS9V11 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_91/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.55, 4, "5F199GBL0", "LCDX", 9, "LCDXNA", null, "IG", 11, 5, - null, 0.91, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.10.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923353", "9060897", - "CDX-NAHYS10V11 - 0613", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_92/100", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BREU0", "CDX", 10, "NA HY", null, "HY", 11, 5, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.10.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923354", "9060898", - "CDX-NAHYS10V11 - 0615", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_07YR_92/100", 2454554, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BREU0", "CDX", 10, "NA HY", null, "HY", 11, 7, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.10.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923355", "9060900", - "CDX-NAHYS10V11 - 0611", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_03YR_92/100", 2454554, 2455733, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BREU0", "CDX", 10, "NA HY", null, "HY", 11, 3, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.10.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923356", "9060910", - "LCDXNAS10V12 - 0611", "LCDX.NA.10", - "CDX_NA_LN_S10_100_03YR_90/100", 2454561, 2455733, 0.0275, "USD", - "ACT/360", false, 0.55, 4, "5F199GBM8", "LCDX", 10, "LCDXNA", null, "IG", 12, 3, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923357", "9060911", - "LCDXNAS10V12 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_90/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.55, 4, "5F199GBM8", "LCDX", 10, "LCDXNA", null, "IG", 12, 5, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.11.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923358", "9060921", - "CDX-NAHYS11V11 - 1213", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_92/100", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BREY2", "CDX", 11, "NA HY", null, "HY", 11, 5, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.11.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923359", "9060924", - "CDX-NAHYS11V11 - 1211", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_03YR_92/100", 2454738, 2455916, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BREY2", "CDX", 11, "NA HY", null, "HY", 11, 3, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.11.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923361", "9060925", - "CDX-NAHYS11V11 - 1215", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_07YR_92/100", 2454738, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BREY2", "CDX", 11, "NA HY", null, "HY", 11, 7, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923363", "9060932", - "CDX-NAHYS12V2 - 0614", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_99/100", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDV9", "CDX", 12, "NA HY", null, "HY", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.10.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923364", "9060906", - "CDX-NAHYBS10V5 - 0613", "CDX.NA.HY.B.10", - "CDX_NA_HY_S10_B___SWP_41/45", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSDL9", "CDX", 10, "NA HY B", null, "HY", 5, 5, - null, 0.9111100000000001, 45, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.10.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923365", "9060907", - "CDX-NAHYHBS10V8 - 0613", "CDX.NA.HY.HB.10", - "CDX_NA_HY_S10_HB__SWP_25/30", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWCP2", "CDX", 10, "NA HY HB", null, "HY", 8, 5, - null, 0.83333, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDXNAS10V12 FXD.LCDXNAV12 FXD.5Y.10.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923366", "9060908", - "LCDXNAS10V12 FXD - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_FXD_90/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBM8 FXD", "LCDXNAS10V12 FXD", 10, "LCDXNAV12 FXD", null, "IG", 12, 5, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.10.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923367", "9060909", - "LCDXNAS10V12 - 0614", "LCDX.NA.10", - "CDX_NA_LN_S10_100_06YR_90/100", 2454561, 2456829, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBM8", "LCDX", 10, "LCDXNA", null, "IG", 12, 6, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.10.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923368", "9060912", - "LCDXNAS10V12 - 0609", "LCDX.NA.10", - "CDX_NA_LN_S10_100_01YR_90/100", 2454561, 2455003, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBM8", "LCDX", 10, "LCDXNA", null, "IG", 12, 1, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.10.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923369", "9060913", - "LCDXNAS10V12 - 0610", "LCDX.NA.10", - "CDX_NA_LN_S10_100_02YR_90/100", 2454561, 2455368, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBM8", "LCDX", 10, "LCDXNA", null, "IG", 12, 2, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.10.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923370", "9060914", - "LCDXNAS10V12 - 0615", "LCDX.NA.10", - "CDX_NA_LN_S10_100_07YR_90/100", 2454561, 2457194, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBM8", "LCDX", 10, "LCDXNA", null, "IG", 12, 7, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.10.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923372", "9060915", - "LCDXNAS10V12 - 0618", "LCDX.NA.10", - "CDX_NA_LN_S10_100_10YR_90/100", 2454561, 2458290, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBM8", "LCDX", 10, "LCDXNA", null, "IG", 12, 10, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.10.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923373", "9060916", - "LCDXNAS10V12 - 0612", "LCDX.NA.10", - "CDX_NA_LN_S10_100_04YR_90/100", 2454561, 2456099, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBM8", "LCDX", 10, "LCDXNA", null, "IG", 12, 4, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.1.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923374", "9060939", - "CDX-NAIGS1V6 - 0314", "Dow Jones CDX.NA.IG", - "DJCDX_NA_IG_S1_10Y_3/14_120/125", 2452934, 2456737, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBO2", "CDX", 1, "NA IG", null, "IG", 6, 10, - null, 0.9640000000000001, 124, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.9.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923375", "9061014", - "LCDXNAS9V11 - 1211", "LCDX.NA.9", - "CDX_NA_LN_S09_100_04YR_91/100", 2454378, 2455916, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBL0", "LCDX", 9, "LCDXNA", null, "IG", 11, 4, - null, 0.91, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.11.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923376", "9060918", - "CDX-NAHYS11V11 - 1209", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_01YR_92/100", 2454738, 2455186, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BREY2", "CDX", 11, "NA HY", null, "HY", 11, 1, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.9.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923377", "9061015", - "LCDXNAS9V11 - 1213", "LCDX.NA.9", - "CDX_NA_LN_S09_100_06YR_91/100", 2454378, 2456647, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBL0", "LCDX", 9, "LCDXNA", null, "IG", 11, 6, - null, 0.91, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.9.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923378", "9061016", - "LCDXNAS9V11 - 1209", "LCDX.NA.9", - "CDX_NA_LN_S09_100_02YR_91/100", 2454378, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBL0", "LCDX", 9, "LCDXNA", null, "IG", 11, 2, - null, 0.91, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V11 FXD.LCDXNAV11 FXD.5Y.9.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923379", "9060893", - "LCDXNAS9V11 FXD - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_FXD_91/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBL0 FXD", "LCDXNAS9V11 FXD", 9, "LCDXNAV11 FXD", null, "IG", 11, 5, - null, 0.91, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.2.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923380", "9060942", - "CDX-NAIGS2V6 - 0909", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_05Y_9/09_121/126", 2453088, 2455095, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBP9", "CDX", 2, "NA IG", null, "IG", 6, 5, - null, 0.9640000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.9.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923381", "9060894", - "LCDXNAS9V11 - 1214", "LCDX.NA.9", - "CDX_NA_LN_S09_100_07YR_91/100", 2454378, 2457012, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBL0", "LCDX", 9, "LCDXNA", null, "IG", 11, 7, - null, 0.91, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.2.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923382", "9060943", - "CDX-NAIGS2V6 - 0914", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_10Y_9/14_121/126", 2453088, 2456921, 0.008, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBP9", "CDX", 2, "NA IG", null, "IG", 6, 10, - null, 0.9640000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.9.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923383", "9060895", - "LCDXNAS9V11 - 1210", "LCDX.NA.9", - "CDX_NA_LN_S09_100_03YR_91/100", 2454378, 2455551, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBL0", "LCDX", 9, "LCDXNA", null, "IG", 11, 3, - null, 0.91, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.2.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923384", "9060944", - "CDX-NAIGS2V6 - 0911", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_07Y_9/11_121/126", 2453088, 2455825, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBP9", "CDX", 2, "NA IG", null, "IG", 6, 7, - null, 0.9640000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.10.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923385", "9060899", - "CDX-NAHYS10V11 - 0618", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_10YR_92/100", 2454554, 2458290, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BREU0", "CDX", 10, "NA HY", null, "HY", 11, 10, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.10.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923386", "9060901", - "CDX-NAHYS10V11 - 0610", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_02YR_92/100", 2454554, 2455368, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BREU0", "CDX", 10, "NA HY", null, "HY", 11, 2, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.10.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923388", "9060903", - "CDX-NAHYS10V11 - 0612", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_04YR_92/100", 2454554, 2456099, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BREU0", "CDX", 10, "NA HY", null, "HY", 11, 4, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.11.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923389", "9060919", - "CDX-NAHYS11V11 - 1212", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_04YR_92/100", 2454738, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BREY2", "CDX", 11, "NA HY", null, "HY", 11, 4, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.10.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923390", "9060904", - "CDX-NAHYS10V11 - 0614", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_06YR_92/100", 2454554, 2456829, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BREU0", "CDX", 10, "NA HY", null, "HY", 11, 6, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.9.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923391", "9061013", - "LCDXNAS9V11 - 1217", "LCDX.NA.9", - "CDX_NA_LN_S09_100_10YR_91/100", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBL0", "LCDX", 9, "LCDXNA", null, "IG", 11, 10, - null, 0.91, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V5 EUR.5Y.3.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923393", "9060949", - "CDX-NAIGS3V5 EUR - 0310", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_05Y_3/10_121/126_EUR", 2453270, 2455276, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYBQ7 EUR", "CDX", 3, "NA IG V5 EUR", null, "IG", 5, 5, - null, 0.9640000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.11.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923394", "9060920", - "CDX-NAHYS11V11 - 1218", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_10YR_92/100", 2454738, 2458473, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BREY2", "CDX", 11, "NA HY", null, "HY", 11, 10, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.3.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923395", "9060950", - "CDX-NAIGS3V5 - 0310", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_05Y_3/10_121/126", 2453270, 2455276, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBQ7", "CDX", 3, "NA IG", null, "IG", 5, 5, - null, 0.9640000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.3.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923396", "9060951", - "CDX-NAIGS3V5 - 0312", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_07Y_3/12_121/126", 2453270, 2456007, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBQ7", "CDX", 3, "NA IG", null, "IG", 5, 7, - null, 0.9640000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V4 EUR.5Y.4.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923397", "9060956", - "CDX-NAIGS4V4 EUR - 0610", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_05Y_6/10_EUR_122/126", 2453451, 2455368, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYBR5 EUR", "CDX", 4, "NA IG V4 EUR", null, "IG", 4, 5, - null, 0.9720000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.11.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923398", "9060922", - "CDX-NAHYS11V11 - 1214", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_06YR_92/100", 2454738, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BREY2", "CDX", 11, "NA HY", null, "HY", 11, 6, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.3.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923399", "9060952", - "CDX-NAIGS3V5 - 0315", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_10Y_3/15_121/126", 2453270, 2457102, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBQ7", "CDX", 3, "NA IG", null, "IG", 5, 10, - null, 0.9640000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.4.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923400", "9060957", - "CDX-NAIGS4V4 - 0615", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_10Y_6/15_122/126", 2453451, 2457194, 0.006500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBR5", "CDX", 4, "NA IG", null, "IG", 4, 10, - null, 0.9720000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.4.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923401", "9060958", - "CDX-NAIGS4V4 - 0612", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_07Y_6/12_122/126", 2453451, 2456099, 0.0055000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBR5", "CDX", 4, "NA IG", null, "IG", 4, 7, - null, 0.9720000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.11.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923403", "9060927", - "CDX-NAHYBS11V4 - 1213", "CDX.NA.HY.B.11", - "CDX_NA_HY_S11_B___SWP_33/36", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSDM7", "CDX", 11, "NA HY B", null, "HY", 4, 5, - null, 0.91668, 36, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.11.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923404", "9060928", - "CDX-NAHYHBS11V9 - 1213", "CDX.NA.HY.HB.11", - "CDX_NA_HY_S11_HB__SWP_24/30", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWCS6", "CDX", 11, "NA HY HB", null, "HY", 9, 5, - null, 0.8, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923405", "9060933", - "CDX-NAHYS12V2 - 0612", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_03YR_99/100", 2454911, 2456099, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDV9", "CDX", 12, "NA HY", null, "HY", 2, 3, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923406", "9060938", - "CDX-NAHYHBS12V2 - 0614", "CDX.NA.HY.HB.12", - "CDX_NA_HY_S12_HB__SWP_29/30", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWCB3", "CDX", 12, "NA HY HB", null, "HY", 2, 5, - null, 0.96667, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923407", "9060930", - "CDX-NAHYS12V2 - 0616", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_07YR_99/100", 2454911, 2457560, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDV9", "CDX", 12, "NA HY", null, "HY", 2, 7, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923408", "9060931", - "CDX-NAHYS12V2 - 0619", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_10YR_99/100", 2454911, 2458655, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRDV9", "CDX", 12, "NA HY", null, "HY", 2, 10, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.8.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923412", "9060984", - "CDX-NAHYS8V11 - 0609", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_02YR_92/100", 2454188, 2455003, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BREO4", "CDX", 8, "NA HY", null, "HY", 11, 2, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.8.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923413", "9060989", - "CDX-NAHYS8V11 - 0611", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_04YR_92/100", 2454188, 2455733, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BREO4", "CDX", 8, "NA HY", null, "HY", 11, 4, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.8.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923414", "9060990", - "CDX-NAHYS8V11 - 0613", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_06YR_92/100", 2454188, 2456464, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BREO4", "CDX", 8, "NA HY", null, "HY", 11, 6, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923418", "9060994", - "LCDXNAS8V15 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_87/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBK2", "LCDX", 8, "LCDXNA", null, "IG", 15, 3, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG TMT.5Y.2.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923419", "9060946", - "CDX-NAIGTMTS2V3 - 0909", "Dow Jones CDX.NA.IG.TMT.2", - "DJCDX_NA_IG_S2_TMT_09/09_27/28", 2453088, 2455095, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65DJAQ9", "CDX", 2, "NA IG TMT", null, "IG", 3, 5, - null, 0.98077, 28, 0, "NYC", false, false, true, null, "Trac-X")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923420", "9060996", - "LCDXNAS8V15 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_87/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBK2", "LCDX", 8, "LCDXNA", null, "IG", 15, 6, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG TMT.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923421", "9060955", - "CDX-NAIGTMTS4V2 - 0610", "Dow Jones CDX.NA.IG.TMT.4", - "DJCDX_NA_IG_S4_TMT_06/10_23/24", 2453451, 2455368, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65DJAS5", "CDX", 4, "NA IG TMT", null, "IG", 2, 5, - null, 0.9772750000000001, 24, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923422", "9060997", - "LCDXNAS8V15 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_87/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBK2", "LCDX", 8, "LCDXNA", null, "IG", 15, 7, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923423", "9060998", - "LCDXNAS8V15 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_87/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBK2", "LCDX", 8, "LCDXNA", null, "IG", 15, 4, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923424", "9060999", - "LCDXNAS8V15 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_87/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBK2", "LCDX", 8, "LCDXNA", null, "IG", 15, 10, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.9.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923426", "9061003", - "CDX-NAHYS9V12 - 1211", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_04YR_ 91/100", 2454372, 2455916, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRER7", "CDX", 9, "NA HY", null, "HY", 12, 4, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.5.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923427", "9060965", - "CDX-NAIGS5V4 - 1209", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_04Y_12/09_123/127", 2453635, 2455186, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBS3", "CDX", 5, "NA IG", null, "IG", 4, 4, - null, 0.9720000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.9.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923428", "9061007", - "CDX-NAHYS9V12 - 1213", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_06YR_ 91/100", 2454372, 2456647, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRER7", "CDX", 9, "NA HY", null, "HY", 12, 6, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.9.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923429", "9061008", - "CDX-NAHYS9V12 - 1209", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_02YR_ 91/100", 2454372, 2455186, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRER7", "CDX", 9, "NA HY", null, "HY", 12, 2, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG TMT.5Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923430", "9060967", - "CDX-NAIGTMTS5V2 - 1210", "Dow Jones CDX.NA.IG.TMT.5", - "DJCDX_NA_IG_S5_TMT_12/10_23/24", 2453635, 2455551, 0.0045000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65DJAT3", "CDX", 5, "NA IG TMT", null, "IG", 2, 5, - null, 0.9772750000000001, 24, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG TMT.5Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923431", "9060968", - "CDX-NAIGTMTS6V3 - 0611", "DOW JONES CDX.NA.IG.TMT.6", - "DJCDX_NA_IG_S6_TMT_6/11 22/24", 2453816, 2455733, 0.0045000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65DJAU0", "CDX", 6, "NA IG TMT", null, "IG", 3, 5, - null, 0.931825, 24, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V15 FXD.LCDXNAV15 FXD.5Y.8.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923432", "9060995", - "LCDXNAS8V15 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_87/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBK2 FXD", "LCDXNAS8V15 FXD", 8, "LCDXNAV15 FXD", null, "IG", 15, 5, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet23() - { - UpdateCDXRefDataMap ("CDX.NA IG.4Y.6.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923433", "9060970", - "CDX-NAIGS6V5 - 0610", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_04Y_6/10_122/127", 2453816, 2455368, 0.003, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBT1", "CDX", 6, "NA IG", null, "IG", 5, 4, - null, 0.9640000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG TMT.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923434", "9060976", - "CDX-NAIGTMTS7V2 - 1211", "Dow Jones CDX.NA.IG.TMT.7", - "DJCDX_NA_IG_S7_TMT_12/11_22/23", 2454000, 2455916, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65DJAV8", "CDX", 7, "NA IG TMT", null, "IG", 2, 5, - null, 0.9772750000000001, 23, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V4 EUR.5Y.7.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923435", "9060978", - "CDX-NAIGS7V4 EUR - 1211", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_05Y_12/11_EUR_122/126", 2454000, 2455916, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYBU8 EUR", "CDX", 7, "NA IG V4 EUR", null, "IG", 4, 5, - null, 0.9720000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.7.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923436", "9060979", - "CDX-NAIGS7V4 - 1210", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_04Y_12/10_122/126", 2454000, 2455551, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBU8", "CDX", 7, "NA IG", null, "IG", 4, 4, - null, 0.9720000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.11.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923455", "9060923", - "CDX-NAHYS11V11 - 1210", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_02YR_92/100", 2454738, 2455551, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BREY2", "CDX", 11, "NA HY", null, "HY", 11, 2, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923456", "9060929", - "CDX-NAHYS12V2 - 0615", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_06YR_99/100", 2454911, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDV9", "CDX", 12, "NA HY", null, "HY", 2, 6, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923457", "9060934", - "CDX-NAHYS12V2 - 0613", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_04YR_99/100", 2454911, 2456464, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDV9", "CDX", 12, "NA HY", null, "HY", 2, 4, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923458", "9060935", - "CDX-NAHYS12V2 - 0611", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_02YR_99/100", 2454911, 2455733, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDV9", "CDX", 12, "NA HY", null, "HY", 2, 2, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923459", "9060936", - "CDX-NAHYS12V2 - 0610", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_01YR_99/100", 2454911, 2455368, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRDV9", "CDX", 12, "NA HY", null, "HY", 2, 1, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.3.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923472", "9061922", - "CDX-NAHYBBS3V5 - 1209", "Dow Jones CDX.NA.HY.BB.3", - "CDX_NA_HY_S03_BB__SWP_39/43", 2453196, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBN0", "CDX", 3, "NA HY BB", null, "HY", 5, 5, - null, 0.90697, 43, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.4.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923473", "9061926", - "CDX-NAHYBBS4V5 - 0610", "DOW JONES CDX.NA.HY.BB.4", - "CDX_NA_HY_S04_BB__SWP_39/43", 2453475, 2455368, 0.021, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBO8", "CDX", 4, "NA HY BB", null, "HY", 5, 5, - null, 0.90696, 43, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V16 FXD.LCDXNAV16 FXD.5Y.8.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923474", "9062991", - "LCDXNAS8V16 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_86/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBN6 FXD", "LCDXNAS8V16 FXD", 8, "LCDXNAV16 FXD", null, "IG", 16, 5, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.4.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923475", "9061927", - "CDX-NAHYS4V14 - 0610", "Dow Jones CDX.NA.HY.4", - "CDX_NA_HY_S04_100_SWP_88/100", 2453475, 2455368, 0.036000000000000004, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFC9", "CDX", 4, "NA HY", null, "HY", 14, 5, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923476", "9062994", - "LCDXNAS8V16 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_86/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBN6", "LCDX", 8, "LCDXNA", null, "IG", 16, 6, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923478", "9062997", - "LCDXNAS8V16 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_86/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBN6", "LCDX", 8, "LCDXNA", null, "IG", 16, 7, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.6.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923479", "9062086", - "CDX-NAHYS6V11 - 0609", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_03YR_91/100", 2453823, 2455003, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFE5", "CDX", 6, "NA HY", null, "HY", 11, 3, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.6.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923480", "9062089", - "CDX-NAHYS6V11 - 0616", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_10YR_91/100", 2453823, 2457560, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFE5", "CDX", 6, "NA HY", null, "HY", 11, 10, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.6.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923481", "9062098", - "CDX-NAHYS6V11 - 0613", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_07YR_91/100", 2453823, 2456464, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFE5", "CDX", 6, "NA HY", null, "HY", 11, 7, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.6.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923482", "9062104", - "CDX-NAHYS6V11 - 0611", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_91/100", 2453823, 2455733, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFE5", "CDX", 6, "NA HY", null, "HY", 11, 5, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.7.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923483", "9062119", - "CDX-NAHYBS7V5 - 1211", "Dow Jones CDX.NA.HY.B.7", - "CDX_NA_HY_S07_B___SWP_46/50", 2454007, 2455916, 0.030000000000000002, "USD", - "ACT/360", false, 0.3, 4, "2I65BSDO3", "CDX", 7, "NA HY B", null, "HY", 5, 5, - null, 0.91, 50, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.2.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923484", "9061620", - "CDX-NAHYS2V13 - 0909", "Dow Jones CDX.NA.HY.2", - "DJIBOXX_NA_HY_S02_100_SWP_86/100", 2453088, 2455095, 0.043000000000000003, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFA3", "CDX", 2, "NA HY", null, "HY", 13, 5, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.2.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923485", "9061625", - "CDX-NAHYBBS2V5 - 0909", "Dow Jones CDX.NA.HY.BB.2", - "CDX_NA_HY_S02_BB__SWP_38/42", 2453088, 2455095, 0.029, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBM2", "CDX", 2, "NA HY BB", null, "HY", 5, 5, - null, 0.90476, 42, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.3.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923486", "9061915", - "CDX-NAHYS3V14 - 1209", "Dow Jones CDX.NA.HY.3", - "CDX_NA_HY_S03_100_SWP_88/100", 2453196, 2455186, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFB1", "CDX", 3, "NA HY", null, "HY", 14, 5, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.5.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923487", "9062070", - "CDX-NAHYS5V13 - 1212", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_07YR_89/100", 2453651, 2456282, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFD7", "CDX", 5, "NA HY", null, "HY", 13, 7, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.5.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923488", "9062074", - "CDX-NAHYS5V13 - 1210", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_89/100", 2453651, 2455551, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFD7", "CDX", 5, "NA HY", null, "HY", 13, 5, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.6.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923489", "9062082", - "CDX-NAHYBS6V6 - 0611", "Dow Jones CDX.NA.HY.B.6", - "CDX_NA_HY_S06_B___SWP_43/48", 2453823, 2455733, 0.030000000000000002, "USD", - "ACT/360", false, 0.3, 4, "2I65BSDN5", "CDX", 6, "NA HY B", null, "HY", 6, 5, - null, 0.89583, 48, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923490", "9062999", - "LCDXNAS8V16 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_86/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBN6", "LCDX", 8, "LCDXNA", null, "IG", 16, 4, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.10.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923491", "9062388", - "LCDXNAS10V13 - 0611", "LCDX.NA.10", - "CDX_NA_LN_S10_100_03YR_89/100", 2454561, 2455733, 0.0275, "USD", - "ACT/360", false, 0.55, 4, "5F199GBP1", "LCDX", 10, "LCDXNA", null, "IG", 13, 3, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923492", "9062389", - "LCDXNAS10V13 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_89/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.55, 4, "5F199GBP1", "LCDX", 10, "LCDXNA", null, "IG", 13, 5, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923494", "9062278", - "LCDXNAS9V12 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_90/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.55, 4, "5F199GBO4", "LCDX", 9, "LCDXNA", null, "IG", 12, 5, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.9.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923495", "9062294", - "LCDXNAS9V12 - 1217", "LCDX.NA.9", - "CDX_NA_LN_S09_100_10YR_90/100", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBO4", "LCDX", 9, "LCDXNA", null, "IG", 12, 10, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.7.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923498", "9062124", - "CDX-NAHYS7V10 - 1213", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_07YR_92/100", 2454007, 2456647, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFG0", "CDX", 7, "NA HY", null, "HY", 10, 7, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.7.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923499", "9062126", - "CDX-NAHYS7V10 - 1209", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_03YR_92/100", 2454007, 2455186, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFG0", "CDX", 7, "NA HY", null, "HY", 10, 3, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.7.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923500", "9062129", - "CDX-NAHYS7V10 - 1216", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_10YR_92/100", 2454007, 2457743, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFG0", "CDX", 7, "NA HY", null, "HY", 10, 10, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.7.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923501", "9062130", - "CDX-NAHYS7V10 - 1211", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_92/100", 2454007, 2455916, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFG0", "CDX", 7, "NA HY", null, "HY", 10, 5, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923503", "9062983", - "LCDXNAS8V16 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_86/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.55, 4, "5F199GBN6", "LCDX", 8, "LCDXNA", null, "IG", 16, 5, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923504", "9062988", - "LCDXNAS8V16 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_86/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBN6", "LCDX", 8, "LCDXNA", null, "IG", 16, 3, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923506", "9062266", - "LCDXNAS8V16 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_86/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBN6", "LCDX", 8, "LCDXNA", null, "IG", 16, 10, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.5.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923508", "9061960", - "CDX-NAHYBBS5V4 - 1210", "Dow Jones CDX.NA.HY.BB.5", - "CDX_NA_HY_S05_BB__SWP_38/41", 2453651, 2455551, 0.025, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBP5", "CDX", 5, "NA HY BB", null, "HY", 4, 5, - null, 0.9268200000000001, 41, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.5Y.5.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923511", "9061977", - "CDX-NAXOS5V4 - 1210", "Dow Jones CDX.NA.XO.5", - "DJCDX_NA_XO_S5_05Y_12/10_32/35", 2453635, 2455551, 0.02, "USD", - "ACT/360", false, 0.4, 4, "1D764IAW7", "CDX", 5, "NAXO", null, "XO", 4, 5, - null, 0.91428, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.5.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923512", "9061983", - "CDX-NAHYS5V13 - 1215", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_10YR_89/100", 2453651, 2457377, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFD7", "CDX", 5, "NA HY", null, "HY", 13, 10, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.9.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923516", "9062333", - "LCDXNAS9V12 - 1211", "LCDX.NA.9", - "CDX_NA_LN_S09_100_04YR_90/100", 2454378, 2455916, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBO4", "LCDX", 9, "LCDXNA", null, "IG", 12, 4, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.9.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923518", "9062982", - "LCDXNAS9V12 - 1213", "LCDX.NA.9", - "CDX_NA_LN_S09_100_06YR_90/100", 2454378, 2456647, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBO4", "LCDX", 9, "LCDXNA", null, "IG", 12, 6, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.9.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923519", "9062984", - "LCDXNAS9V12 - 1209", "LCDX.NA.9", - "CDX_NA_LN_S09_100_02YR_90/100", 2454378, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBO4", "LCDX", 9, "LCDXNA", null, "IG", 12, 2, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V12 FXD.LCDXNAV12 FXD.5Y.9.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923520", "9062985", - "LCDXNAS9V12 FXD - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_FXD_90/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBO4 FXD", "LCDXNAS9V12 FXD", 9, "LCDXNAV12 FXD", null, "IG", 12, 5, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.3.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923521", "9061916", - "CDX-NAHYS3V14 - 1214", "Dow Jones CDX.NA.HY.3", - "CDX_NA_HY_S03_100_SWP_10YR_88/100", 2453196, 2457012, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFB1", "CDX", 3, "NA HY", null, "HY", 14, 10, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.9.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923522", "9062987", - "LCDXNAS9V12 - 1214", "LCDX.NA.9", - "CDX_NA_LN_S09_100_07YR_90/100", 2454378, 2457012, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBO4", "LCDX", 9, "LCDXNA", null, "IG", 12, 7, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.9.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923523", "9062989", - "LCDXNAS9V12 - 1210", "LCDX.NA.9", - "CDX_NA_LN_S09_100_03YR_90/100", 2454378, 2455551, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBO4", "LCDX", 9, "LCDXNA", null, "IG", 12, 3, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.7Y.5.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923524", "9061966", - "CDX-NAXOS5V4 - 1212", "Dow Jones CDX.NA.XO.5", - "DJCDX_NA_XO_S5_07YR_12/12_32/35", 2453635, 2456282, 0.02, "USD", - "ACT/360", false, 0.4, 4, "1D764IAW7", "CDX", 5, "NAXO", null, "XO", 4, 7, - null, 0.91428, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.10Y.5.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923527", "9061971", - "CDX-NAXOS5V4 - 1215", "Dow Jones CDX.NA.XO.5", - "DJCDX_NA_XO_S5_10YR_12/15_32/35", 2453635, 2457377, 0.024, "USD", - "ACT/360", false, 0.4, 4, "1D764IAW7", "CDX", 5, "NAXO", null, "XO", 4, 10, - null, 0.91428, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.6.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923528", "9062107", - "CDX-NAHYS6V11 - 0610", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_04YR_91/100", 2453823, 2455368, 0.0345, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFE5", "CDX", 6, "NA HY", null, "HY", 11, 4, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.6.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923529", "9062112", - "CDX-NAHYS6V11 - 0612", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_06YR_91/100", 2453823, 2456099, 0.0345, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFE5", "CDX", 6, "NA HY", null, "HY", 11, 6, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDXNAS10V13 FXD.LCDXNAV13 FXD.5Y.10.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923530", "9062393", - "LCDXNAS10V13 FXD - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_FXD_89/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBP1 FXD", "LCDXNAS10V13 FXD", 10, "LCDXNAV13 FXD", null, "IG", 13, 5, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.10.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923531", "9062396", - "LCDXNAS10V13 - 0614", "LCDX.NA.10", - "CDX_NA_LN_S10_100_06YR_89/100", 2454561, 2456829, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBP1", "LCDX", 10, "LCDXNA", null, "IG", 13, 6, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.10.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923535", "9062198", - "LCDXNAS10V13 - 0610", "LCDX.NA.10", - "CDX_NA_LN_S10_100_02YR_89/100", 2454561, 2455368, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBP1", "LCDX", 10, "LCDXNA", null, "IG", 13, 2, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.10.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923536", "9062220", - "LCDXNAS10V13 - 0615", "LCDX.NA.10", - "CDX_NA_LN_S10_100_07YR_89/100", 2454561, 2457194, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBP1", "LCDX", 10, "LCDXNA", null, "IG", 13, 7, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.10.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923537", "9062223", - "LCDXNAS10V13 - 0618", "LCDX.NA.10", - "CDX_NA_LN_S10_100_10YR_89/100", 2454561, 2458290, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBP1", "LCDX", 10, "LCDXNA", null, "IG", 13, 10, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.10.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923538", "9062276", - "LCDXNAS10V13 - 0612", "LCDX.NA.10", - "CDX_NA_LN_S10_100_04YR_89/100", 2454561, 2456099, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBP1", "LCDX", 10, "LCDXNA", null, "IG", 13, 4, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V17 FXD.LCDXNAV17 FXD.5Y.8.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923566", "9070397", - "LCDXNAS8V17 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_85/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBQ9 FXD", "LCDXNAS8V17 FXD", 8, "LCDXNAV17 FXD", null, "IG", 17, 5, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923567", "9070400", - "LCDXNAS8V17 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_85/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBQ9", "LCDX", 8, "LCDXNA", null, "IG", 17, 6, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923568", "9070401", - "LCDXNAS8V17 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_85/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBQ9", "LCDX", 8, "LCDXNA", null, "IG", 17, 7, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923569", "9070403", - "LCDXNAS8V17 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_85/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBQ9", "LCDX", 8, "LCDXNA", null, "IG", 17, 4, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923570", "9070404", - "LCDXNAS8V17 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_85/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.55, 4, "5F199GBQ9", "LCDX", 8, "LCDXNA", null, "IG", 17, 5, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923571", "9070405", - "LCDXNAS8V17 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_85/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBQ9", "LCDX", 8, "LCDXNA", null, "IG", 17, 3, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923572", "9070406", - "LCDXNAS8V17 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_85/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBQ9", "LCDX", 8, "LCDXNA", null, "IG", 17, 10, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.2.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923577", "9070641", - "ITRAXX-LevXS2V7 - 0613", "ITRAXX LEVX SENIOR SERIES 2 VERSION 7", - "ITRAXX LEVX SENIOR SERIES 2 VERSION 7 EUR 1ST SEC RES I03 CDS", 2454543, 2456464, 0.052500000000000005, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJBL6", "ITRAXX", 2, "LevX", null, "IG", 7, 5, - null, 0.92, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923588", "9072706", - "CDX-NAHYBS10V6 - 0613", "CDX.NA.HY.B.10", - "CDX_NA_HY_S10_B___SWP_40/45", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSDR6", "CDX", 10, "NA HY B", null, "HY", 6, 5, - null, 0.88889, 45, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.11.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923589", "9072711", - "CDX-NAHYS11V12 - 1213", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_91/100", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFL9", "CDX", 11, "NA HY", null, "HY", 12, 5, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.11.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923590", "9072572", - "CDX-NAHYS11V12 - 1211", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_03YR_91/100", 2454738, 2455916, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFL9", "CDX", 11, "NA HY", null, "HY", 12, 3, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.11.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923591", "9072574", - "CDX-NAHYS11V12 - 1215", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_07YR_91/100", 2454738, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFL9", "CDX", 11, "NA HY", null, "HY", 12, 7, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.11.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923592", "9072576", - "CDX-NAHYS11V12 - 1218", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_10YR_91/100", 2454738, 2458473, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFL9", "CDX", 11, "NA HY", null, "HY", 12, 10, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.8.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923593", "9072475", - "CDX-NAHYBS8V7 - 0612", "CDX.NA.HY.B.8", - "CDX_NA_HY_S08_B___SWP_43/49", 2454188, 2456099, 0.025, "USD", - "ACT/360", false, 0.3, 4, "2I65BSDP0", "CDX", 8, "NA HY B", null, "HY", 7, 5, - null, 0.8775499999999999, 49, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.9.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923594", "9072476", - "CDX-NAHYS9V13 - 1212", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_90/100", 2454372, 2456282, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFJ4", "CDX", 9, "NA HY", null, "HY", 13, 5, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.9.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923595", "9072477", - "CDX-NAHYS9V13 - 1210", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_03YR_ 90/100", 2454372, 2455551, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFJ4", "CDX", 9, "NA HY", null, "HY", 13, 3, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.9.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923596", "9072478", - "CDX-NAHYS9V13 - 1214", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_07YR_ 90/100", 2454372, 2457012, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFJ4", "CDX", 9, "NA HY", null, "HY", 13, 7, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.9.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923597", "9072554", - "CDX-NAHYS9V13 - 1217", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_10YR_ 90/100", 2454372, 2458108, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFJ4", "CDX", 9, "NA HY", null, "HY", 13, 10, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.9.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923600", "9072556", - "CDX-NAHYBS9V8 - 1212", "CDX.NA.HY.B.9", - "CDX_NA_HY_S09_B___SWP_39/46", 2454372, 2456282, 0.035, "USD", - "ACT/360", false, 0.3, 4, "2I65BSDQ8", "CDX", 9, "NA HY B", null, "HY", 8, 5, - null, 0.8478300000000001, 46, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.11.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923601", "9072586", - "CDX-NAHYBS11V5 - 1213", "CDX.NA.HY.B.11", - "CDX_NA_HY_S11_B___SWP_32/36", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSDS4", "CDX", 11, "NA HY B", null, "HY", 5, 5, - null, 0.8889100000000001, 36, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.12.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923602", "9072767", - "CDX-NAHYS12V3 - 0614", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_98/100", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFM7", "CDX", 12, "NA HY", null, "HY", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.12.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923603", "9072769", - "CDX-NAHYS12V3 - 0616", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_07YR_98/100", 2454911, 2457560, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFM7", "CDX", 12, "NA HY", null, "HY", 3, 7, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.12.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923604", "9072770", - "CDX-NAHYS12V3 - 0619", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_10YR_98/100", 2454911, 2458655, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFM7", "CDX", 12, "NA HY", null, "HY", 3, 10, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.12.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923605", "9072771", - "CDX-NAHYS12V3 - 0612", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_03YR_98/100", 2454911, 2456099, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFM7", "CDX", 12, "NA HY", null, "HY", 3, 3, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.10.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923606", "9072560", - "CDX-NAHYS10V12 - 0613", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_91/100", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFK1", "CDX", 10, "NA HY", null, "HY", 12, 5, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.10.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923607", "9072561", - "CDX-NAHYS10V12 - 0615", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_07YR_91/100", 2454554, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFK1", "CDX", 10, "NA HY", null, "HY", 12, 7, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.10.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923608", "9072693", - "CDX-NAHYS10V12 - 0611", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_03YR_91/100", 2454554, 2455733, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFK1", "CDX", 10, "NA HY", null, "HY", 12, 3, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.10.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923609", "9072695", - "CDX-NAHYS10V12 - 0618", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_10YR_91/100", 2454554, 2458290, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFK1", "CDX", 10, "NA HY", null, "HY", 12, 10, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923610", "9073013", - "LCDXNAS8V18 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_84/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.55, 4, "5F199GBR7", "LCDX", 8, "LCDXNA", null, "IG", 18, 5, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923611", "9073014", - "LCDXNAS9V13 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_89/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.55, 4, "5F199GBS5", "LCDX", 9, "LCDXNA", null, "IG", 13, 5, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.10.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923612", "9073011", - "LCDXNAS10V14 - 0611", "LCDX.NA.10", - "CDX_NA_LN_S10_100_03YR_88/100", 2454561, 2455733, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "5F199GBT3", "LCDX", 10, "LCDXNA", null, "IG", 14, 3, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923613", "9073010", - "LCDXNAS10V14 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_88/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.55, 4, "5F199GBT3", "LCDX", 10, "LCDXNA", null, "IG", 14, 5, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923614", "9073016", - "LCDXNAS12V2 - 0612", "LCDX.NA.12", - "CDX_NA_LN_S12_100_03YR_99/100", 2454938, 2456099, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GBU0", "LCDX", 12, "LCDXNA", null, "IG", 2, 3, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923615", "9073017", - "LCDXNAS12V2 - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_99/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.55, 4, "5F199GBU0", "LCDX", 12, "LCDXNA", null, "IG", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.10.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923616", "9072840", - "CDX-NAHYS10V12 - 0610", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_02YR_91/100", 2454554, 2455368, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFK1", "CDX", 10, "NA HY", null, "HY", 12, 2, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.7.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923618", "9072679", - "CDX-NAHYS7V11 - 1213", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_07YR_91/100", 2454007, 2456647, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFH8", "CDX", 7, "NA HY", null, "HY", 11, 7, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.10.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923619", "9072851", - "CDX-NAHYS10V12 - 0612", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_04YR_91/100", 2454554, 2456099, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFK1", "CDX", 10, "NA HY", null, "HY", 12, 4, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.7.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923620", "9072681", - "CDX-NAHYS7V11 - 1209", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_03YR_91/100", 2454007, 2455186, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFH8", "CDX", 7, "NA HY", null, "HY", 11, 3, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.10.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923621", "9072836", - "CDX-NAHYS10V12 - 0614", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_06YR_91/100", 2454554, 2456829, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFK1", "CDX", 10, "NA HY", null, "HY", 12, 6, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.7.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923622", "9072682", - "CDX-NAHYS7V11 - 1216", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_10YR_91/100", 2454007, 2457743, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFH8", "CDX", 7, "NA HY", null, "HY", 11, 10, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.7.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923624", "9072720", - "CDX-NAHYS7V11 - 1211", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_91/100", 2454007, 2455916, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFH8", "CDX", 7, "NA HY", null, "HY", 11, 5, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.8.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923625", "9072532", - "CDX-NAHYS8V12 - 0614", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_07YR_91/100", 2454188, 2456829, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFI6", "CDX", 8, "NA HY", null, "HY", 12, 7, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet24() - { - UpdateCDXRefDataMap ("CDX.NA HY.5Y.8.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923626", "9072536", - "CDX-NAHYS8V12 - 0612", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_91/100", 2454188, 2456099, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFI6", "CDX", 8, "NA HY", null, "HY", 12, 5, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.8.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923627", "9072538", - "CDX-NAHYS8V12 - 0610", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_03YR_91/100", 2454188, 2455368, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFI6", "CDX", 8, "NA HY", null, "HY", 12, 3, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.8.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923628", "9072542", - "CDX-NAHYS8V12 - 0617", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_10YR_91/100", 2454188, 2457925, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFI6", "CDX", 8, "NA HY", null, "HY", 12, 10, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.8.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923633", "9072944", - "CDX-NAHYS8V12 - 0611", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_04YR_91/100", 2454188, 2455733, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFI6", "CDX", 8, "NA HY", null, "HY", 12, 4, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.8.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923634", "9072952", - "CDX-NAHYS8V12 - 0613", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_06YR_91/100", 2454188, 2456464, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFI6", "CDX", 8, "NA HY", null, "HY", 12, 6, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.8.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923635", "9072945", - "CDX-NAHYS8V12 - 0609", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_02YR_91/100", 2454188, 2455003, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFI6", "CDX", 8, "NA HY", null, "HY", 12, 2, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.11.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923640", "9072976", - "CDX-NAHYS11V12 - 1212", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_04YR_91/100", 2454738, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFL9", "CDX", 11, "NA HY", null, "HY", 12, 4, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.11.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923642", "9072978", - "CDX-NAHYS11V12 - 1214", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_06YR_91/100", 2454738, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFL9", "CDX", 11, "NA HY", null, "HY", 12, 6, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.9.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923643", "9072842", - "CDX-NAHYS9V13 - 1211", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_04YR_ 90/100", 2454372, 2455916, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFJ4", "CDX", 9, "NA HY", null, "HY", 13, 4, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.10.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923645", "9072848", - "CDX-NAHYHBS10V9 - 0613", "CDX.NA.HY.HB.10", - "CDX_NA_HY_S10_HB__SWP_24/30", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWCU1", "CDX", 10, "NA HY HB", null, "HY", 9, 5, - null, 0.8, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.11.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923646", "9072857", - "CDX-NAHYS11V12 - 1209", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_01YR_91/100", 2454738, 2455186, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFL9", "CDX", 11, "NA HY", null, "HY", 12, 1, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.11.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923647", "9072893", - "CDX-NAHYHBS11V10 - 1213", "CDX.NA.HY.HB.11", - "CDX_NA_HY_S11_HB__SWP_23/30", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWCV9", "CDX", 11, "NA HY HB", null, "HY", 10, 5, - null, 0.7666700000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.12.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923648", "9072902", - "CDX-NAHYS12V3 - 0615", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_06YR_98/100", 2454911, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFM7", "CDX", 12, "NA HY", null, "HY", 3, 6, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.12.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923649", "9072906", - "CDX-NAHYS12V3 - 0613", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_04YR_98/100", 2454911, 2456464, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFM7", "CDX", 12, "NA HY", null, "HY", 3, 4, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.12.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923651", "9072953", - "CDX-NAHYHBS12V3 - 0614", "CDX.NA.HY.HB.12", - "CDX_NA_HY_S12_HB__SWP_28/30", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWCW7", "CDX", 12, "NA HY HB", null, "HY", 3, 5, - null, 0.9333400000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.9.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923652", "9072850", - "CDX-NAHYS9V13 - 1213", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_06YR_ 90/100", 2454372, 2456647, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFJ4", "CDX", 9, "NA HY", null, "HY", 13, 6, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.9.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923653", "9072854", - "CDX-NAHYS9V13 - 1209", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_02YR_ 90/100", 2454372, 2455186, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFJ4", "CDX", 9, "NA HY", null, "HY", 13, 2, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.11.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923654", "9072979", - "CDX-NAHYS11V12 - 1210", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_02YR_91/100", 2454738, 2455551, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFL9", "CDX", 11, "NA HY", null, "HY", 12, 2, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.12.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923657", "9072912", - "CDX-NAHYS12V3 - 0611", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_02YR_98/100", 2454911, 2455733, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFM7", "CDX", 12, "NA HY", null, "HY", 3, 2, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.12.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923658", "9073005", - "CDX-NAHYS12V3 - 0610", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_01YR_98/100", 2454911, 2455368, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFM7", "CDX", 12, "NA HY", null, "HY", 3, 1, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V18 FXD.LCDXNAV18 FXD.5Y.8.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923669", "9073084", - "LCDXNAS8V18 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_84/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBR7 FXD", "LCDXNAS8V18 FXD", 8, "LCDXNAV18 FXD", null, "IG", 18, 5, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923670", "9073088", - "LCDXNAS8V18 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_84/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBR7", "LCDX", 8, "LCDXNA", null, "IG", 18, 6, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923671", "9073091", - "LCDXNAS8V18 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_84/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBR7", "LCDX", 8, "LCDXNA", null, "IG", 18, 7, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923672", "9073093", - "LCDXNAS8V18 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_84/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBR7", "LCDX", 8, "LCDXNA", null, "IG", 18, 4, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923673", "9073094", - "LCDXNAS8V18 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_84/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBR7", "LCDX", 8, "LCDXNA", null, "IG", 18, 3, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923674", "9073770", - "LCDXNAS8V18 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_84/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBR7", "LCDX", 8, "LCDXNA", null, "IG", 18, 10, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS10V14 FXD.LCDXNAV14 FXD.5Y.10.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923676", "9073306", - "LCDXNAS10V14 FXD - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_FXD_88/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBT3 FXD", "LCDXNAS10V14 FXD", 10, "LCDXNAV14 FXD", null, "IG", 14, 5, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.10.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923677", "9073308", - "LCDXNAS10V14 - 0614", "LCDX.NA.10", - "CDX_NA_LN_S10_100_06YR_88/100", 2454561, 2456829, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBT3", "LCDX", 10, "LCDXNA", null, "IG", 14, 6, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.10.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923679", "9073313", - "LCDXNAS10V14 - 0610", "LCDX.NA.10", - "CDX_NA_LN_S10_100_02YR_88/100", 2454561, 2455368, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBT3", "LCDX", 10, "LCDXNA", null, "IG", 14, 2, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.10.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923680", "9073762", - "LCDXNAS10V14 - 0615", "LCDX.NA.10", - "CDX_NA_LN_S10_100_07YR_88/100", 2454561, 2457194, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBT3", "LCDX", 10, "LCDXNA", null, "IG", 14, 7, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.10.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923681", "9073764", - "LCDXNAS10V14 - 0618", "LCDX.NA.10", - "CDX_NA_LN_S10_100_10YR_88/100", 2454561, 2458290, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBT3", "LCDX", 10, "LCDXNA", null, "IG", 14, 10, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.9.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923682", "9073777", - "LCDXNAS9V13 - 1217", "LCDX.NA.9", - "CDX_NA_LN_S09_100_10YR_89/100", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBS5", "LCDX", 9, "LCDXNA", null, "IG", 13, 10, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.10.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923683", "9073765", - "LCDXNAS10V14 - 0612", "LCDX.NA.10", - "CDX_NA_LN_S10_100_04YR_88/100", 2454561, 2456099, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBT3", "LCDX", 10, "LCDXNA", null, "IG", 14, 4, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.9.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923684", "9073779", - "LCDXNAS9V13 - 1211", "LCDX.NA.9", - "CDX_NA_LN_S09_100_04YR_89/100", 2454378, 2455916, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBS5", "LCDX", 9, "LCDXNA", null, "IG", 13, 4, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923685", "9073769", - "LCDXNAS12V2 - 0610", "LCDX.NA.12", - "CDX_NA_LN_S12_100_01YR_99/100", 2454938, 2455368, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GBU0", "LCDX", 12, "LCDXNA", null, "IG", 2, 1, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS12V2 FXD.LCDXNAV2 FXD.5Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923686", "9073720", - "LCDXNAS12V2 FXD - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_FXD_99/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GBU0 FXD", "LCDXNAS12V2 FXD", 12, "LCDXNAV2 FXD", null, "IG", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923687", "9073781", - "LCDXNAS12V2 - 0611", "LCDX.NA.12", - "CDX_NA_LN_S12_100_02YR_99/100", 2454938, 2455733, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GBU0", "LCDX", 12, "LCDXNA", null, "IG", 2, 2, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923688", "9073782", - "LCDXNAS12V2 - 0616", "LCDX.NA.12", - "CDX_NA_LN_S12_100_07YR_99/100", 2454938, 2457560, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GBU0", "LCDX", 12, "LCDXNA", null, "IG", 2, 7, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923689", "9073785", - "LCDXNAS12V2 - 0619", "LCDX.NA.12", - "CDX_NA_LN_S12_100_10YR_99/100", 2454938, 2458655, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GBU0", "LCDX", 12, "LCDXNA", null, "IG", 2, 10, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.9.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923690", "9073750", - "LCDXNAS9V13 - 1213", "LCDX.NA.9", - "CDX_NA_LN_S09_100_06YR_89/100", 2454378, 2456647, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBS5", "LCDX", 9, "LCDXNA", null, "IG", 13, 6, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.9.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923692", "9073755", - "LCDXNAS9V13 - 1209", "LCDX.NA.9", - "CDX_NA_LN_S09_100_02YR_89/100", 2454378, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBS5", "LCDX", 9, "LCDXNA", null, "IG", 13, 2, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V13 FXD.LCDXNAV13 FXD.5Y.9.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923693", "9073759", - "LCDXNAS9V13 FXD - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_FXD_89/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBS5 FXD", "LCDXNAS9V13 FXD", 9, "LCDXNAV13 FXD", null, "IG", 13, 5, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.9.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923694", "9073760", - "LCDXNAS9V13 - 1214", "LCDX.NA.9", - "CDX_NA_LN_S09_100_07YR_89/100", 2454378, 2457012, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBS5", "LCDX", 9, "LCDXNA", null, "IG", 13, 7, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.9.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923695", "9073761", - "LCDXNAS9V13 - 1210", "LCDX.NA.9", - "CDX_NA_LN_S09_100_03YR_89/100", 2454378, 2455551, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBS5", "LCDX", 9, "LCDXNA", null, "IG", 13, 3, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923698", "9073808", - "LCDXNAS12V2 - 0613", "LCDX.NA.12", - "CDX_NA_LN_S12_100_04YR_99/100", 2454938, 2456464, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GBU0", "LCDX", 12, "LCDXNA", null, "IG", 2, 4, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923699", "9073809", - "LCDXNAS12V2 - 0615", "LCDX.NA.12", - "CDX_NA_LN_S12_100_06YR_99/100", 2454938, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GBU0", "LCDX", 12, "LCDXNA", null, "IG", 2, 6, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LevXSubS1V17.LevXSub.5Y.1.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923701", "9074123", - "LevXSubS1V17 - 1211", "ITRAXX LEVX SUBORDINATE SERIES 1 VERSION 17", - "ITRAXX LEVX SUBORDINATE SERIES 1 VERSION 17 EUR 2ND SEC MMR I03 CDS", 2454180, 2455916, 0.045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKBO7", "LevXSubS1V17", 1, "LevXSub", null, "IG", 17, 5, - null, 0.5429, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.5.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923717", "9074497", - "CDX-NAHYBBS5V5 - 1210", "Dow Jones CDX.NA.HY.BB.5", - "CDX_NA_HY_S05_BB__SWP_37/41", 2453651, 2455551, 0.025, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBR1", "CDX", 5, "NA HY BB", null, "HY", 5, 5, - null, 0.90243, 41, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.5.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923718", "9074500", - "CDX-NAHYS5V15 - 1215", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_10YR_88/100", 2453651, 2457377, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFW5", "CDX", 5, "NA HY", null, "HY", 15, 10, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.5.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923719", "9074501", - "CDX-NAHYS5V15 - 1212", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_07YR_88/100", 2453651, 2456282, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFW5", "CDX", 5, "NA HY", null, "HY", 15, 7, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.5.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923720", "9074502", - "CDX-NAHYS5V15 - 1210", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_88/100", 2453651, 2455551, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFW5", "CDX", 5, "NA HY", null, "HY", 15, 5, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.6.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923721", "9074503", - "CDX-NAHYBS6V8 - 0611", "Dow Jones CDX.NA.HY.B.6", - "CDX_NA_HY_S06_B___SWP_42/48", 2453823, 2455733, 0.030000000000000002, "USD", - "ACT/360", false, 0.3, 4, "2I65BSDW5", "CDX", 6, "NA HY B", null, "HY", 8, 5, - null, 0.8749899999999999, 48, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923722", "9074623", - "LCDXNAS10V15 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_87/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.55, 4, "5F199GBX4", "LCDX", 10, "LCDXNA", null, "IG", 15, 5, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.11.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923723", "9074624", - "CDX-NAHYS11V14 - 1213", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_90/100", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGC8", "CDX", 11, "NA HY", null, "HY", 14, 5, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.11.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923724", "9074627", - "CDX-NAHYS11V14 - 1211", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_03YR_90/100", 2454738, 2455916, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGC8", "CDX", 11, "NA HY", null, "HY", 14, 3, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.11.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923725", "9074511", - "CDX-NAHYS11V14 - 1215", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_07YR_90/100", 2454738, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGC8", "CDX", 11, "NA HY", null, "HY", 14, 7, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.11.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923726", "9074839", - "CDX-NAHYS11V14 - 1218", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_10YR_90/100", 2454738, 2458473, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGC8", "CDX", 11, "NA HY", null, "HY", 14, 10, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.12.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923727", "9074512", - "CDX-NAHYS12V5 - 0614", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_97/100", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGD6", "CDX", 12, "NA HY", null, "HY", 5, 5, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.12.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923728", "9074846", - "CDX-NAHYS12V5 - 0616", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_07YR_97/100", 2454911, 2457560, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGD6", "CDX", 12, "NA HY", null, "HY", 5, 7, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.12.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923729", "9074847", - "CDX-NAHYS12V5 - 0619", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_10YR_97/100", 2454911, 2458655, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGD6", "CDX", 12, "NA HY", null, "HY", 5, 10, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.12.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923730", "9074515", - "CDX-NAHYS12V5 - 0612", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_03YR_97/100", 2454911, 2456099, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGD6", "CDX", 12, "NA HY", null, "HY", 5, 3, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.12.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923731", "9074853", - "LCDXNAS12V3 - 0612", "LCDX.NA.12", - "CDX_NA_LN_S12_100_03YR_98/100", 2454938, 2456099, 0.05, "USD", - "ACT/360", false, 0.55, 4, "5F199GBY2", "LCDX", 12, "LCDXNA", null, "IG", 3, 3, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.12.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923732", "9074516", - "LCDXNAS12V3 - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_98/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.55, 4, "5F199GBY2", "LCDX", 12, "LCDXNA", null, "IG", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.9.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923733", "9074591", - "CDX-NAHYBS9V9 - 1212", "CDX.NA.HY.B.9", - "CDX_NA_HY_S09_B___SWP_38/46", 2454372, 2456282, 0.035, "USD", - "ACT/360", false, 0.3, 4, "2I65BSDY1", "CDX", 9, "NA HY B", null, "HY", 9, 5, - null, 0.82609, 46, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.9.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923734", "9074986", - "CDX-NAHYS9V15 - 1212", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_89/100", 2454372, 2456282, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGA2", "CDX", 9, "NA HY", null, "HY", 15, 5, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.9.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923735", "9074987", - "CDX-NAHYS9V15 - 1210", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_03YR_ 89/100", 2454372, 2455551, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGA2", "CDX", 9, "NA HY", null, "HY", 15, 3, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.9.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923736", "9074989", - "CDX-NAHYS9V15 - 1214", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_07YR_ 89/100", 2454372, 2457012, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGA2", "CDX", 9, "NA HY", null, "HY", 15, 7, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.9.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923737", "9074990", - "CDX-NAHYS9V15 - 1217", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_10YR_ 89/100", 2454372, 2458108, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGA2", "CDX", 9, "NA HY", null, "HY", 15, 10, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923738", "9074609", - "LCDXNAS9V14 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_88/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.55, 4, "5F199GBW6", "LCDX", 9, "LCDXNA", null, "IG", 14, 5, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.10.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923739", "9074822", - "CDX-NAHYBS10V7 - 0613", "CDX.NA.HY.B.10", - "CDX_NA_HY_S10_B___SWP_39/45", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSDZ8", "CDX", 10, "NA HY B", null, "HY", 7, 5, - null, 0.86667, 45, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.10.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923740", "9074611", - "CDX-NAHYS10V14 - 0613", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_90/100", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGB0", "CDX", 10, "NA HY", null, "HY", 14, 5, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.10.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923741", "9074614", - "CDX-NAHYS10V14 - 0615", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_07YR_90/100", 2454554, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGB0", "CDX", 10, "NA HY", null, "HY", 14, 7, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.10.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923742", "9074617", - "CDX-NAHYS10V14 - 0611", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_03YR_90/100", 2454554, 2455733, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGB0", "CDX", 10, "NA HY", null, "HY", 14, 3, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.10.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923743", "9074824", - "CDX-NAHYS10V14 - 0618", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_10YR_90/100", 2454554, 2458290, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGB0", "CDX", 10, "NA HY", null, "HY", 14, 10, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.10.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923744", "9074622", - "LCDXNAS10V15 - 0611", "LCDX.NA.10", - "CDX_NA_LN_S10_100_03YR_87/100", 2454561, 2455733, 0.0275, "USD", - "ACT/360", false, 0.55, 4, "5F199GBX4", "LCDX", 10, "LCDXNA", null, "IG", 15, 3, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.6.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923745", "9074505", - "CDX-NAHYS6V13 - 0609", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_03YR_90/100", 2453823, 2455003, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFX3", "CDX", 6, "NA HY", null, "HY", 13, 3, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.6.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923746", "9074506", - "CDX-NAHYS6V13 - 0616", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_10YR_90/100", 2453823, 2457560, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFX3", "CDX", 6, "NA HY", null, "HY", 13, 10, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.6.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923747", "9074507", - "CDX-NAHYS6V13 - 0613", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_07YR_90/100", 2453823, 2456464, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFX3", "CDX", 6, "NA HY", null, "HY", 13, 7, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.6.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923748", "9074508", - "CDX-NAHYS6V13 - 0611", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_90/100", 2453823, 2455733, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFX3", "CDX", 6, "NA HY", null, "HY", 13, 5, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.7.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923749", "9074616", - "CDX-NAHYS7V13 - 1213", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_07YR_90/100", 2454007, 2456647, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFY1", "CDX", 7, "NA HY", null, "HY", 13, 7, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.8.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923750", "9074517", - "CDX-NAHYS8V14 - 0614", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_07YR_90/100", 2454188, 2456829, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFZ8", "CDX", 8, "NA HY", null, "HY", 14, 7, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.7.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923751", "9074618", - "CDX-NAHYS7V13 - 1209", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_03YR_90/100", 2454007, 2455186, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFY1", "CDX", 7, "NA HY", null, "HY", 13, 3, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.8.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923752", "9074518", - "CDX-NAHYS8V14 - 0612", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_90/100", 2454188, 2456099, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFZ8", "CDX", 8, "NA HY", null, "HY", 14, 5, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.5.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923753", "9074498", - "CDX-NAHYHBS5V11 - 1210", "Dow Jones CDX.NA.HY.HB.5", - "CDX_NA_HY_S05_HB__SWP_22/30", 2453651, 2455551, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWDG1", "CDX", 5, "NA HY HB", null, "HY", 11, 5, - null, 0.7331000000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.7.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923754", "9074625", - "CDX-NAHYS7V13 - 1216", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_10YR_90/100", 2454007, 2457743, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFY1", "CDX", 7, "NA HY", null, "HY", 13, 10, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.8.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923755", "9074573", - "CDX-NAHYS8V14 - 0610", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_03YR_90/100", 2454188, 2455368, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFZ8", "CDX", 8, "NA HY", null, "HY", 14, 3, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.6.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923756", "9074504", - "CDX-NAHYHBS6V9 - 0611", "Dow Jones CDX.NA.HY.HB.6", - "CDX_NA_HY_S06_HB__SWP_24/30", 2453823, 2455733, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWDH9", "CDX", 6, "NA HY HB", null, "HY", 9, 5, - null, 0.79999, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.7.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923757", "9074513", - "CDX-NAHYS7V13 - 1211", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_90/100", 2454007, 2455916, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFY1", "CDX", 7, "NA HY", null, "HY", 13, 5, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923758", "9074804", - "LCDXNAS8V19 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_83/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBV8", "LCDX", 8, "LCDXNA", null, "IG", 19, 4, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.8.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923759", "9074514", - "CDX-NAHYBS8V8 - 0612", "CDX.NA.HY.B.8", - "CDX_NA_HY_S08_B___SWP_42/49", 2454188, 2456099, 0.025, "USD", - "ACT/360", false, 0.3, 4, "2I65BSDX3", "CDX", 8, "NA HY B", null, "HY", 8, 5, - null, 0.85714, 49, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923760", "9074805", - "LCDXNAS8V19 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_83/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBV8", "LCDX", 8, "LCDXNA", null, "IG", 19, 3, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.8.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923761", "9074587", - "CDX-NAHYS8V14 - 0617", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_10YR_90/100", 2454188, 2457925, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFZ8", "CDX", 8, "NA HY", null, "HY", 14, 10, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923762", "9074590", - "LCDXNAS8V19 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_83/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.55, 4, "5F199GBV8", "LCDX", 8, "LCDXNA", null, "IG", 19, 5, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.6.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923764", "9074792", - "CDX-NAHYS6V13 - 0610", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_04YR_90/100", 2453823, 2455368, 0.0345, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFX3", "CDX", 6, "NA HY", null, "HY", 13, 4, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.6.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923765", "9074793", - "CDX-NAHYS6V13 - 0612", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_06YR_90/100", 2453823, 2456099, 0.0345, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFX3", "CDX", 6, "NA HY", null, "HY", 13, 6, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.8.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923766", "9074796", - "CDX-NAHYHBS8V9 - 0612", "CDX.NA.HY.HB.8", - "CDX_NA_HY_S08_HB__SWP_24/30", 2454188, 2456099, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BWDJ5", "CDX", 8, "NA HY HB", null, "HY", 9, 5, - null, 0.79999, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.8.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923767", "9074797", - "CDX-NAHYS8V14 - 0609", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_02YR_90/100", 2454188, 2455003, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFZ8", "CDX", 8, "NA HY", null, "HY", 14, 2, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.8.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923768", "9074798", - "CDX-NAHYS8V14 - 0611", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_04YR_90/100", 2454188, 2455733, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFZ8", "CDX", 8, "NA HY", null, "HY", 14, 4, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.8.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923769", "9074799", - "CDX-NAHYS8V14 - 0613", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_06YR_90/100", 2454188, 2456464, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRFZ8", "CDX", 8, "NA HY", null, "HY", 14, 6, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V19 FXD.LCDXNAV19 FXD.5Y.8.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923770", "9074801", - "LCDXNAS8V19 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_83/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBV8 FXD", "LCDXNAS8V19 FXD", 8, "LCDXNAV19 FXD", null, "IG", 19, 5, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet25() - { - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923771", "9074802", - "LCDXNAS8V19 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_83/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBV8", "LCDX", 8, "LCDXNA", null, "IG", 19, 6, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923772", "9074803", - "LCDXNAS8V19 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_83/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBV8", "LCDX", 8, "LCDXNA", null, "IG", 19, 7, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.7.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923773", "9074610", - "CDX-NAHYHBS7V9 - 1211", "Dow Jones CDX.NA.HY.HB.7", - "CDX_NA_HY_S07_HB__SWP_24/30", 2454007, 2455916, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWDI7", "CDX", 7, "NA HY HB", null, "HY", 9, 5, - null, 0.8, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.12.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923778", "9074848", - "CDX-NAHYS12V5 - 0611", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_02YR_97/100", 2454911, 2455733, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGD6", "CDX", 12, "NA HY", null, "HY", 5, 2, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.12.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923779", "9074849", - "CDX-NAHYS12V5 - 0610", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_01YR_97/100", 2454911, 2455368, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGD6", "CDX", 12, "NA HY", null, "HY", 5, 1, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.12.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923780", "9074850", - "CDX-NAHYS12V5 - 0615", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_06YR_97/100", 2454911, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGD6", "CDX", 12, "NA HY", null, "HY", 5, 6, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.12.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923781", "9074851", - "CDX-NAHYS12V5 - 0613", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_04YR_97/100", 2454911, 2456464, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGD6", "CDX", 12, "NA HY", null, "HY", 5, 4, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.12.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923784", "9074854", - "LCDXNAS12V3 - 0610", "LCDX.NA.12", - "CDX_NA_LN_S12_100_01YR_98/100", 2454938, 2455368, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GBY2", "LCDX", 12, "LCDXNA", null, "IG", 3, 1, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS12V3 FXD.LCDXNAV3 FXD.5Y.12.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923785", "9074855", - "LCDXNAS12V3 FXD - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_FXD_98/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GBY2 FXD", "LCDXNAS12V3 FXD", 12, "LCDXNAV3 FXD", null, "IG", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.12.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923786", "9074856", - "LCDXNAS12V3 - 0611", "LCDX.NA.12", - "CDX_NA_LN_S12_100_02YR_98/100", 2454938, 2455733, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GBY2", "LCDX", 12, "LCDXNA", null, "IG", 3, 2, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.12.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923787", "9074857", - "LCDXNAS12V3 - 0616", "LCDX.NA.12", - "CDX_NA_LN_S12_100_07YR_98/100", 2454938, 2457560, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GBY2", "LCDX", 12, "LCDXNA", null, "IG", 3, 7, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.12.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923788", "9074858", - "LCDXNAS12V3 - 0619", "LCDX.NA.12", - "CDX_NA_LN_S12_100_10YR_98/100", 2454938, 2458655, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GBY2", "LCDX", 12, "LCDXNA", null, "IG", 3, 10, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.12.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923789", "9074859", - "LCDXNAS12V3 - 0613", "LCDX.NA.12", - "CDX_NA_LN_S12_100_04YR_98/100", 2454938, 2456464, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GBY2", "LCDX", 12, "LCDXNA", null, "IG", 3, 4, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.12.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923790", "9074860", - "LCDXNAS12V3 - 0615", "LCDX.NA.12", - "CDX_NA_LN_S12_100_06YR_98/100", 2454938, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GBY2", "LCDX", 12, "LCDXNA", null, "IG", 3, 6, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.9.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923792", "9074817", - "LCDXNAS9V14 - 1209", "LCDX.NA.9", - "CDX_NA_LN_S09_100_02YR_88/100", 2454378, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBW6", "LCDX", 9, "LCDXNA", null, "IG", 14, 2, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V14 FXD.LCDXNAV14 FXD.5Y.9.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923793", "9074818", - "LCDXNAS9V14 FXD - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_FXD_88/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBW6 FXD", "LCDXNAS9V14 FXD", 9, "LCDXNAV14 FXD", null, "IG", 14, 5, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.9.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923794", "9074819", - "LCDXNAS9V14 - 1214", "LCDX.NA.9", - "CDX_NA_LN_S09_100_07YR_88/100", 2454378, 2457012, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBW6", "LCDX", 9, "LCDXNA", null, "IG", 14, 7, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.9.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923795", "9074820", - "LCDXNAS9V14 - 1210", "LCDX.NA.9", - "CDX_NA_LN_S09_100_03YR_88/100", 2454378, 2455551, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBW6", "LCDX", 9, "LCDXNA", null, "IG", 14, 3, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.10.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923797", "9074823", - "CDX-NAHYHBS10V11 - 0613", "CDX.NA.HY.HB.10", - "CDX_NA_HY_S10_HB__SWP_23/30", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWDL0", "CDX", 10, "NA HY HB", null, "HY", 11, 5, - null, 0.7666700000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.10.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923798", "9074825", - "CDX-NAHYS10V14 - 0610", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_02YR_90/100", 2454554, 2455368, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGB0", "CDX", 10, "NA HY", null, "HY", 14, 2, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.10.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923800", "9074827", - "CDX-NAHYS10V14 - 0612", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_04YR_90/100", 2454554, 2456099, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGB0", "CDX", 10, "NA HY", null, "HY", 14, 4, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.10.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923802", "9074828", - "CDX-NAHYS10V14 - 0614", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_06YR_90/100", 2454554, 2456829, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGB0", "CDX", 10, "NA HY", null, "HY", 14, 6, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923803", "9074806", - "LCDXNAS8V19 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_83/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBV8", "LCDX", 8, "LCDXNA", null, "IG", 19, 10, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS10V15 FXD.LCDXNAV15 FXD.5Y.10.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923806", "9074830", - "LCDXNAS10V15 FXD - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_FXD_87/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBX4 FXD", "LCDXNAS10V15 FXD", 10, "LCDXNAV15 FXD", null, "IG", 15, 5, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.9.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923807", "9074809", - "CDX-NAHYHBS9V9 - 1212", "CDX.NA.HY.HB.9", - "CDX_NA_HY_S09_HB__SWP_24/30", 2454372, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BWDK2", "CDX", 9, "NA HY HB", null, "HY", 9, 5, - null, 0.79999, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.10.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923808", "9074831", - "LCDXNAS10V15 - 0614", "LCDX.NA.10", - "CDX_NA_LN_S10_100_06YR_87/100", 2454561, 2456829, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBX4", "LCDX", 10, "LCDXNA", null, "IG", 15, 6, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.9.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923809", "9074810", - "CDX-NAHYS9V15 - 1211", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_04YR_ 89/100", 2454372, 2455916, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGA2", "CDX", 9, "NA HY", null, "HY", 15, 4, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.9.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923810", "9074811", - "CDX-NAHYS9V15 - 1213", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_06YR_ 89/100", 2454372, 2456647, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGA2", "CDX", 9, "NA HY", null, "HY", 15, 6, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.9.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923811", "9074812", - "CDX-NAHYS9V15 - 1209", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_02YR_ 89/100", 2454372, 2455186, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGA2", "CDX", 9, "NA HY", null, "HY", 15, 2, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.9.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923812", "9074814", - "LCDXNAS9V14 - 1217", "LCDX.NA.9", - "CDX_NA_LN_S09_100_10YR_88/100", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBW6", "LCDX", 9, "LCDXNA", null, "IG", 14, 10, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.9.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923813", "9074815", - "LCDXNAS9V14 - 1211", "LCDX.NA.9", - "CDX_NA_LN_S09_100_04YR_88/100", 2454378, 2455916, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBW6", "LCDX", 9, "LCDXNA", null, "IG", 14, 4, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.9.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923814", "9074816", - "LCDXNAS9V14 - 1213", "LCDX.NA.9", - "CDX_NA_LN_S09_100_06YR_88/100", 2454378, 2456647, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GBW6", "LCDX", 9, "LCDXNA", null, "IG", 14, 6, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.10.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923819", "9074833", - "LCDXNAS10V15 - 0610", "LCDX.NA.10", - "CDX_NA_LN_S10_100_02YR_87/100", 2454561, 2455368, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBX4", "LCDX", 10, "LCDXNA", null, "IG", 15, 2, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.10.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923820", "9074834", - "LCDXNAS10V15 - 0615", "LCDX.NA.10", - "CDX_NA_LN_S10_100_07YR_87/100", 2454561, 2457194, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBX4", "LCDX", 10, "LCDXNA", null, "IG", 15, 7, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.10.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923821", "9074835", - "LCDXNAS10V15 - 0618", "LCDX.NA.10", - "CDX_NA_LN_S10_100_10YR_87/100", 2454561, 2458290, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBX4", "LCDX", 10, "LCDXNA", null, "IG", 15, 10, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.10.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923822", "9074836", - "LCDXNAS10V15 - 0612", "LCDX.NA.10", - "CDX_NA_LN_S10_100_04YR_87/100", 2454561, 2456099, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GBX4", "LCDX", 10, "LCDXNA", null, "IG", 15, 4, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.11.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923823", "9074838", - "CDX-NAHYHBS11V12 - 1213", "CDX.NA.HY.HB.11", - "CDX_NA_HY_S11_HB__SWP_22/30", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWDM8", "CDX", 11, "NA HY HB", null, "HY", 12, 5, - null, 0.73334, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.11.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923824", "9074840", - "CDX-NAHYS11V14 - 1214", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_06YR_90/100", 2454738, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGC8", "CDX", 11, "NA HY", null, "HY", 14, 6, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.11.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923825", "9074841", - "CDX-NAHYS11V14 - 1212", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_04YR_90/100", 2454738, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGC8", "CDX", 11, "NA HY", null, "HY", 14, 4, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.11.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923826", "9074842", - "CDX-NAHYS11V14 - 1210", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_02YR_90/100", 2454738, 2455551, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGC8", "CDX", 11, "NA HY", null, "HY", 14, 2, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.11.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923827", "9074843", - "CDX-NAHYS11V14 - 1209", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_01YR_90/100", 2454738, 2455186, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGC8", "CDX", 11, "NA HY", null, "HY", 14, 1, - null, 0.9, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.12.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923828", "9074845", - "CDX-NAHYHBS12V5 - 0614", "CDX.NA.HY.HB.12", - "CDX_NA_HY_S12_HB__SWP_27/30", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWDN6", "CDX", 12, "NA HY HB", null, "HY", 5, 5, - null, 0.9000100000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.CONS.5Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923833", "9074874", - "ITRAXX-CONSS2V2 - 0310", "iTraxx Europe Consumers Series 2 Version 2", - "ITRAXX-CONSS2V2-0310 EUR SEN MMR I03 CDS", 2453269, 2455276, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I667BAG3", "ITRAXX", 2, "CONS", "CON", "IG", 2, 5, - "244141", 0.9667, 31, 0, "LON", true, true, true, "ITRXEY52", "CON")); - - UpdateCDXRefDataMap ("ITRAXX.CONS.10Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923834", "9074875", - "ITRAXX-CONSS2V2 - 0315", "iTraxx Europe Consumers Series 2 Version 2", - "ITRAXX-CONSS2V2-0315 EUR SEN MMR I03 CDS", 2453269, 2457102, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I667BAG3", "ITRAXX", 2, "CONS", "CON", "IG", 2, 10, - "244141", 0.9667, 31, 0, "LON", true, true, true, "ITRXEY02", "CON")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923835", "9074774", - "USD ITRAXX-XOVERS9V3 - 0613", "iTraxx Europe Crossover series 9 Version 3", - "ITRAXX-XOVERS9V3-0613 USD SEN MMR I03 CDS MATURED", 2454546, 2456464, 0.065, "USD", - "ACT/360", false, 0.4, 4, "2I667KAU2", "USD ITRAXX", 9, "XOVER", "XVR", "XO", 3, 5, - null, 0.96, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923836", "9074777", - "ITRAXX-XOVERS10V3 - 1211", "iTraxx Europe Crossover series 10 Version 3", - "ITRAXX-XOVERS10V3-1211 EUR SEN MMR I03 CDS", 2454739, 2455916, 0.053000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAV0", "ITRAXX", 10, "XOVER", "XVR", "XO", 3, 3, - "244066", 0.96, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.5Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923837", "9074876", - "ITRAXX-EUROPES2V2 - 0310", "Itraxx Europe Series 2 Version 2", - "ITRAXX-EUROPES2V2-0310 EUR SEN MMR I03 CDS", 2453269, 2455276, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAM7", "ITRAXX", 2, "EUROPE", "EUR", "IG", 2, 5, - "244122", 0.9920000000000001, 125, 0, "LON", true, true, true, "ITRXEB52", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923838", "9074778", - "ITRAXX-XOVERS10V3 - 1215", "iTraxx Europe Crossover series 10 Version 3", - "ITRAXX-XOVERS10V3-1215 EUR SEN MMR I03 CDS", 2454739, 2457377, 0.055, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAV0", "ITRAXX", 10, "XOVER", "XVR", "XO", 3, 7, - "244066", 0.96, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923839", "9074779", - "ITRAXX-XOVERS10V3 - 1218", "iTraxx Europe Crossover series 10 Version 3", - "ITRAXX-XOVERS10V3-1218 EUR SEN MMR I03 CDS", 2454739, 2458473, 0.054, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAV0", "ITRAXX", 10, "XOVER", "XVR", "XO", 3, 10, - "244066", 0.96, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923840", "9074780", - "USD ITRAXX-XOVERS10V3 - 1213", "iTraxx Europe Crossover series 10 Version 3", - "ITRAXX-XOVERS10V3-1213 USD SEN MMR I03 CDS", 2454739, 2456647, 0.056, "USD", - "ACT/360", false, 0.4, 4, "2I667KAV0", "USD ITRAXX", 10, "XOVER", "XVR", "XO", 3, 5, - null, 0.96, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923841", "9074781", - "USD ITRAXX-XOVERS10V3 - 1218", "iTraxx Europe Crossover series 10 Version 3", - "ITRAXX-XOVERS10V3-1218 USD SEN MMR I03 CDS", 2454739, 2458473, 0.054, "USD", - "ACT/360", false, 0.4, 4, "2I667KAV0", "USD ITRAXX", 10, "XOVER", "XVR", "XO", 3, 10, - null, 0.96, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923842", "9074877", - "ITRAXX-EUROPES2V2 - 0315", "Itraxx Europe Series 2 Version 2", - "ITRAXX-EUROPES2V2-0315 EUR SEN MMR I03 CDS", 2453269, 2457102, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAM7", "ITRAXX", 2, "EUROPE", "EUR", "IG", 2, 10, - "244122", 0.9920000000000001, 125, 0, "LON", true, true, true, "ITRXEB02", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923843", "9074782", - "ITRAXX-XOVERS10V3 - 1213", "iTraxx Europe Crossover series 10 Version 3", - "ITRAXX-XOVERS10V3-1213 EUR SEN MMR I03 CDS", 2454739, 2456647, 0.056, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAV0", "ITRAXX", 10, "XOVER", "XVR", "XO", 3, 5, - "244066", 0.96, 50, 0, "LON", true, true, true, "ITXEX510", "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923845", "9074784", - "USD ITRAXX-XOVERS11V2 - 0614", "iTraxx Europe Crossover series 11 Version 2", - "ITRAXX-XOVERS11V2-0614 USD SEN MMR I03 CDS", 2454911, 2456829, 0.0975, "USD", - "ACT/360", false, 0.4, 4, "2I667KAW8", "USD ITRAXX", 11, "XOVER", "XVR", "XO", 2, 5, - null, 0.9778, 45, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923846", "9074785", - "USD ITRAXX-XOVERS11V2 - 0619", "iTraxx Europe Crossover series 11 Version 2", - "ITRAXX-XOVERS11V2-0619 USD SEN MMR I03 CDS", 2454911, 2458655, 0.082, "USD", - "ACT/360", false, 0.4, 4, "2I667KAW8", "USD ITRAXX", 11, "XOVER", "XVR", "XO", 2, 10, - null, 0.9778, 45, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923848", "9074786", - "ITRAXX-XOVERS11V2 - 0612", "iTraxx Europe Crossover series 11 Version 2", - "ITRAXX-XOVERS11V2-0612 EUR SEN MMR I03 CDS", 2454911, 2456099, 0.11, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAW8", "ITRAXX", 11, "XOVER", "XVR", "XO", 2, 3, - "244064", 0.9778, 45, 0, "LON", true, true, true, "ITXEX311", "XVR")); - - UpdateCDXRefDataMap ("TRACXE.100.10Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923849", "9074881", - "TRACXE-100S2V2 - 0614", "DOW JONES TRAC-X EUROPE 100 INDEX - SERIES 2 VERSION 2", - "TRACXE-100S2V2-0614 EUR SEN MMR I03 CDS", 2453087, 2456829, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "TRACXE-100S2V2", "TRACXE", 2, "100", null, "IG", 2, 10, - "244120", 0.99, 98, 0, "LON", false, false, true, null, "Tracxe")); - - UpdateCDXRefDataMap ("TRACXE.CON.10Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923851", "9074883", - "TRACXE-CONS2V2 - 0614", "DOW JONES TRAC-X EUROPE CONSUMER INDEX - SERIES 2 VERSION 2", - "TRACXE-CONS2V2-0614 EUR SEN MMR I03 CDS", 2453087, 2456829, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "TRACXE-CONS2V2", "TRACXE", 2, "CON", null, "IG", 2, 10, - "244121", 0.96, 26, 0, "LON", false, false, true, null, "Tracxe")); - - UpdateCDXRefDataMap ("TRACXE.CORP.10Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923853", "9074885", - "TRACXE-CORPS2V2 - 0614", "DOW JONES TRAC-X EUROPE CORPORATE INDEX - SERIES 2 VERSION 2", - "TRACXE-CORPS2V2-0614 EUR SEN MMR I03 CDS", 2453087, 2456829, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "TRACXE-CORPS2V2", "TRACXE", 2, "CORP", "COR", "IG", 2, 10, - "244119", 0.9867, 76, 0, "LON", false, false, true, null, "COR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923854", "9074787", - "ITRAXX-XOVERS11V2 - 0614", "iTraxx Europe Crossover series 11 Version 2", - "ITRAXX-XOVERS11V2-0614 EUR SEN MMR I03 CDS", 2454911, 2456829, 0.0975, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAW8", "ITRAXX", 11, "XOVER", "XVR", "XO", 2, 5, - "244064", 0.9778, 45, 0, "LON", true, true, true, "ITXEX511", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.CONS.5Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923856", "9074888", - "ITRAXX-CONSS3V2 - 0610", "iTraxx Europe Consumers Series 3 Version 2", - "ITRAXX-CONSS3V2-0610 EUR SEN MMR I03 CDS", 2453451, 2455368, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I667BAH1", "ITRAXX", 3, "CONS", "CON", "IG", 2, 5, - "244124", 0.9667, 31, 0, "LON", true, true, true, "ITRXEY53", "CON")); - - UpdateCDXRefDataMap ("ITRAXX.CONS.10Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923857", "9074889", - "ITRAXX-CONSS3V2 - 0615", "iTraxx Europe Consumers Series 3 Version 2", - "ITRAXX-CONSS3V2-0615 EUR SEN MMR I03 CDS", 2453451, 2457194, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I667BAH1", "ITRAXX", 3, "CONS", "CON", "IG", 2, 10, - "244124", 0.9667, 31, 0, "LON", true, true, true, "ITRXEY03", "CON")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923860", "9074892", - "ITRAXX-EUROPES3V2 - 0615", "iTraxx Europe Series 3 Version 2", - "ITRAXX-EUROPES3V2-0615 EUR SEN MMR I03 CDS", 2453451, 2457194, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAN5", "ITRAXX", 3, "EUROPE", "EUR", "IG", 2, 10, - "244125", 0.9920000000000001, 124, 0, "LON", true, true, true, "ITRXEB03", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.7Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923861", "9074893", - "ITRAXX-EUROPES3V2 - 0612", "iTraxx Europe Series 3 Version 2", - "ITRAXX-EUROPES3V2-0612 EUR SEN MMR I03 CDS", 2453451, 2456099, 0.0045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAN5", "ITRAXX", 3, "EUROPE", "EUR", "IG", 2, 7, - "244125", 0.9920000000000001, 124, 0, "LON", true, true, true, "ITRXEB73", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923862", "9074900", - "ITRAXX-HIVOLS4V2 - 1210", "iTraxx Europe HiVol Series 4 Version 2", - "ITRAXX-HIVOLS4V2-1210 EUR SEN MMR I03 CDS", 2453634, 2455551, 0.007, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAL0", "ITRAXX", 4, "HIVOL", "VOL", "HV", 2, 5, - "244128", 0.9667, 30, 0, "LON", true, true, true, "ITRXEH54", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPEV25Y43.5Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923863", "9074894", - "ITRAXX-EUROPES3V2-5Y43 - 0610", "iTraxx Europe Series 3 Version 2", - "ITRAXX-EUROPES3V2-5Y43 EUR SEN MMR I03 CDS", 2453451, 2455368, 0.0043, "EUR", - "ACT/360", false, 0.4, 4, "ITRAXX-EUROPES3V2-5Y43", "ITRAXX", 3, "EUROPEV25Y43", null, "IG", 2, 5, - "225369", 0.9920000000000001, 124, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.5Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923864", "9074895", - "ITRAXX-EUROPES3V2 - 0610", "iTraxx Europe Series 3 Version 2", - "ITRAXX-EUROPES3V2-0610 EUR SEN MMR I03 CDS", 2453451, 2455368, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAN5", "ITRAXX", 3, "EUROPE", "EUR", "IG", 2, 5, - "244125", 0.9920000000000001, 124, 0, "LON", true, true, true, "ITRXEB53", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.10Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923865", "9074902", - "ITRAXX-HIVOLS4V2 - 1215", "iTraxx Europe HiVol Series 4 Version 2", - "ITRAXX-HIVOLS4V2-1215 EUR SEN MMR I03 CDS", 2453634, 2457377, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAL0", "ITRAXX", 4, "HIVOL", "VOL", "HV", 2, 10, - "244128", 0.9667, 30, 0, "LON", true, true, true, "ITRXEH04", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.CONS.10Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923866", "9074897", - "ITRAXX-CONSS4V2 - 1215", "iTraxx Europe Consumers Series 4 Version 2", - "ITRAXX-CONSS4V2-1215 EUR SEN MMR I03 CDS", 2453634, 2457377, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I667BAI9", "ITRAXX", 4, "CONS", "CON", "IG", 2, 10, - "244126", 0.9667, 31, 0, "LON", true, true, true, "ITRXEY04", "CON")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923867", "9074903", - "ITRAXX-EUROPES4V2 - 1210", "iTraxx Europe Series 4 Version 2", - "ITRAXX-EUROPES4V2-1210 EUR SEN MMR I03 CDS", 2453634, 2455551, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAO3", "ITRAXX", 4, "EUROPE", "EUR", "IG", 2, 5, - "244127", 0.9920000000000001, 123, 0, "LON", true, true, true, "ITRXEB54", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.7Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923868", "9074719", - "ITRAXX-EUROPES4V2 - 1212", "iTraxx Europe Series 4 Version 2", - "ITRAXX-EUROPES4V2-1212 EUR SEN MMR I03 CDS", 2453634, 2456282, 0.0045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAO3", "ITRAXX", 4, "EUROPE", "EUR", "IG", 2, 7, - "244127", 0.9920000000000001, 123, 0, "LON", true, true, true, "ITRXEB74", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923869", "9074720", - "ITRAXX-EUROPES4V2 - 1215", "iTraxx Europe Series 4 Version 2", - "ITRAXX-EUROPES4V2-1215 EUR SEN MMR I03 CDS", 2453634, 2457377, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAO3", "ITRAXX", 4, "EUROPE", "EUR", "IG", 2, 10, - "244127", 0.9920000000000001, 123, 0, "LON", true, true, true, "ITRXEB04", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.5Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923870", "9074721", - "ITRAXX-HIVOLS5V2 - 0611", "iTraxx Europe HiVol Series 5 Version 2", - "ITRAXX-HIVOLS5V2-0611 EUR SEN MMR I03 CDS", 2453815, 2455733, 0.007, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAM8", "ITRAXX", 5, "HIVOL", "VOL", "HV", 2, 5, - "244131", 0.9667, 30, 0, "LON", true, true, true, "ITRXEH55", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.10Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923871", "9074722", - "ITRAXX-HIVOLS5V2 - 0616", "iTraxx Europe HiVol Series 5 Version 2", - "ITRAXX-HIVOLS5V2-0616 EUR SEN MMR I03 CDS", 2453815, 2457560, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAM8", "ITRAXX", 5, "HIVOL", "VOL", "HV", 2, 10, - "244131", 0.9667, 30, 0, "LON", true, true, true, "ITRXEH05", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.7Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923873", "9074724", - "ITRAXX-HIVOLS5V2 - 0613", "iTraxx Europe HiVol Series 5 Version 2", - "ITRAXX-HIVOLS5V2-0613 EUR SEN MMR I03 CDS", 2453815, 2456464, 0.0085, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAM8", "ITRAXX", 5, "HIVOL", "VOL", "HV", 2, 7, - "244131", 0.9667, 30, 0, "LON", true, true, true, "ITRXEH75", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923874", "9074788", - "ITRAXX-XOVERS11V2 - 0616", "iTraxx Europe Crossover series 11 Version 2", - "ITRAXX-XOVERS11V2-0616 EUR SEN MMR I03 CDS", 2454911, 2457560, 0.08800000000000001, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAW8", "ITRAXX", 11, "XOVER", "XVR", "XO", 2, 7, - "244064", 0.9778, 45, 0, "LON", true, true, true, "ITXEX711", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.CONS.10Y.1.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923876", "9074863", - "ITRAXX-CONSS1V2 - 0914", "iTraxx Europe Consumers Series 1 Version 2", - "ITRAXX-CONSS1V2-0914 EUR SEN MMR I03 CDS", 2453179, 2456921, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I667BAF5", "ITRAXX", 1, "CONS", "CON", "IG", 2, 10, - "244140", 0.9667, 31, 0, "LON", true, true, true, "ITRXEY01", "CON")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.1.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923878", "9074865", - "ITRAXX-EUROPES1V2 - 0914", "Itraxx Europe Series 1 Version 2", - "ITRAXX-EUROPES1V2-0914 EUR SEN MMR I03 CDS", 2453179, 2456921, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAL9", "ITRAXX", 1, "EUROPE", "EUR", "IG", 2, 10, - "244118", 0.9920000000000001, 124, 0, "LON", true, true, true, "ITRXEB01", "EUR")); - - UpdateCDXRefDataMap ("TRACXE.100.10Y.1.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923881", "9074871", - "DJTRAC-XEUROPE100S1V2 - 0913", "Dow Jones TRAC-X Europe 100 Series 1 Version 2 (EX PARMALAT)", - "DJTRAC-XEUROPE100S1V2-0913 EUR SEN MMR I03 CDS", 2452936, 2456556, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "DJTRAC-XEUROPE100S1V2", "TRACXE", 1, "100", null, "IG", 2, 10, - "221850", 0.9898990000000001, 97, 0, "LON", false, false, true, null, "Trac-X")); - - UpdateCDXRefDataMap ("TRACXE.CON.10Y.1.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923882", "9074872", - "DJTRAC-XEUROPECONS1V2 - 0913", "Dow Jones TRAC-X Europe Consumer Series 1 Version 2 (EX PARMALAT)", - "DJTRAC-XEUROPECONS1V2-0913 EUR SEN MMR I03 CDS", 2452936, 2456556, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "DJTRAC-XEUROPECONS1V2", "TRACXE", 1, "CON", null, "IG", 2, 10, - "221852", 0.92, 26, 0, "LON", false, false, true, null, "Trac-X")); - - UpdateCDXRefDataMap ("TRACXE.CORP.10Y.1.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923884", "9074873", - "DJTRAC-XEUROPECORPS1V2 - 0913", "Dow Jones TRAC-X Europe Corporate Series 1 Version 2 (EX PARMALAT)", - "DJTRAC-XEUROPECORPS1V2-0913 EUR SEN MMR I03 CDS", 2452936, 2456556, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "DJTRAC-XEUROPECORPS1V2", "TRACXE", 1, "CORP", "COR", "IG", 2, 10, - "221851", 0.9865210000000001, 74, 0, "LON", false, false, true, null, "COR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.5Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923886", "9074727", - "ITRAXX-EUROPES5V2 - 0611", "iTraxx Europe Series 5 Version 2", - "ITRAXX-EUROPES5V2-0611 EUR SEN MMR I03 CDS", 2453815, 2455733, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAP0", "ITRAXX", 5, "EUROPE", "EUR", "IG", 2, 5, - "244130", 0.9920000000000001, 123, 0, "LON", true, true, true, "ITRXEB55", "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.5Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923889", "9074763", - "USD ITRAXX-EUROPES8V2 - 1212", "iTraxx Europe series 8 Version 2", - "ITRAXX-EUROPES8V2-1212 USD SEN MMR I03 CDS PENDING", 2454364, 2456282, 0.0045000000000000005, "USD", - "ACT/360", false, 0.39, 4, "2I666VAW5", "USD ITRAXX", 8, "EUROPE", "EUR", "IG", 2, 5, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.3Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923890", "9074749", - "ITRAXX-EUROPES7V2 - 0610", "iTraxx Europe series 7 Version 2", - "ITRAXX-EUROPES7V2-0610 EUR SEN MMR I03 CDS", 2454180, 2455368, 0.002, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAR6", "ITRAXX", 7, "EUROPE", "EUR", "IG", 2, 3, - "244134", 0.9920000000000001, 123, 0, "LON", true, true, true, "ITRXEB37", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923891", "9074750", - "ITRAXX-EUROPES7V2 - 0612", "iTraxx Europe series 7 Version 2", - "ITRAXX-EUROPES7V2-0612 EUR SEN MMR I03 CDS", 2454180, 2456099, 0.003, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAR6", "ITRAXX", 7, "EUROPE", "EUR", "IG", 2, 5, - "244134", 0.9920000000000001, 123, 0, "LON", true, true, true, "ITRXEB57", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923892", "9074728", - "ITRAXX-EUROPES5V2 - 0616", "iTraxx Europe Series 5 Version 2", - "ITRAXX-EUROPES5V2-0616 EUR SEN MMR I03 CDS", 2453815, 2457560, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAP0", "ITRAXX", 5, "EUROPE", "EUR", "IG", 2, 10, - "244130", 0.9920000000000001, 123, 0, "LON", true, true, true, "ITRXEB05", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.3Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923893", "9074737", - "ITRAXX-EUROPES6V2 - 1209", "iTraxx Europe Series 6 Version 2", - "ITRAXX-EUROPES6V2-1209 EUR SEN MMR I03 CDS", 2453999, 2455186, 0.002, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAQ8", "ITRAXX", 6, "EUROPE", "EUR", "IG", 2, 3, - "244133", 0.9920000000000001, 122, 0, "LON", true, true, true, "ITRXEB36", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.7Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923894", "9074729", - "ITRAXX-EUROPES5V2 - 0613", "iTraxx Europe Series 5 Version 2", - "ITRAXX-EUROPES5V2-0613 EUR SEN MMR I03 CDS", 2453815, 2456464, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAP0", "ITRAXX", 5, "EUROPE", "EUR", "IG", 2, 7, - "244130", 0.9920000000000001, 123, 0, "LON", true, true, true, "ITRXEB75", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923895", "9074738", - "ITRAXX-EUROPES6V2 - 1211", "iTraxx Europe Series 6 Version 2", - "ITRAXX-EUROPES6V2-1211 EUR SEN MMR I03 CDS", 2453999, 2455917, 0.003, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAQ8", "ITRAXX", 6, "EUROPE", "EUR", "IG", 2, 5, - "244133", 0.9920000000000001, 122, 0, "LON", true, true, true, "ITRXEB56", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.7Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923896", "9074751", - "ITRAXX-EUROPES7V2 - 0614", "iTraxx Europe series 7 Version 2", - "ITRAXX-EUROPES7V2-0614 EUR SEN MMR I03 CDS", 2454180, 2456829, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAR6", "ITRAXX", 7, "EUROPE", "EUR", "IG", 2, 7, - "244134", 0.9920000000000001, 123, 0, "LON", true, true, true, "ITRXEB77", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923898", "9074752", - "ITRAXX-EUROPES7V2 - 0617", "iTraxx Europe series 7 Version 2", - "ITRAXX-EUROPES7V2-0617 EUR SEN MMR I03 CDS", 2454180, 2457925, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAR6", "ITRAXX", 7, "EUROPE", "EUR", "IG", 2, 10, - "244134", 0.9920000000000001, 123, 0, "LON", true, true, true, "ITRXEB07", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923899", "9074789", - "ITRAXX-XOVERS11V2 - 0619", "iTraxx Europe Crossover series 11 Version 2", - "ITRAXX-XOVERS11V2-0619 EUR SEN MMR I03 CDS", 2454911, 2458655, 0.082, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAW8", "ITRAXX", 11, "XOVER", "XVR", "XO", 2, 10, - "244064", 0.9778, 45, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923900", "9074753", - "USD ITRAXX-EUROPES7V2 - 0612", "iTraxx Europe series 7 Version 2", - "ITRAXX-EUROPES7V2-0612 USD SEN MMR I03 CDS", 2454180, 2456099, 0.003, "USD", - "ACT/360", false, 0.4, 4, "2I666VAR6", "USD ITRAXX", 7, "EUROPE", "EUR", "IG", 2, 5, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "EUR")); - - return true; - } - - private static final boolean InitCDXRefDataSet26() - { - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.10Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923901", "9074754", - "USD ITRAXX-EUROPES7V2 - 0617", "iTraxx Europe series 7 Version 2", - "ITRAXX-EUROPES7V2-0617 USD SEN MMR I03 CDS", 2454180, 2457925, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I666VAR6", "USD ITRAXX", 7, "EUROPE", "EUR", "IG", 2, 10, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.3Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923902", "9074755", - "ITRAXX-HIVOLS7V2 - 0610", "iTraxx Europe HiVol series 7 Version 2", - "ITRAXX-HIVOLS7V2-0610 EUR SEN MMR I03 CDS", 2454180, 2455368, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAO4", "ITRAXX", 7, "HIVOL", "VOL", "HV", 2, 3, - "244135", 0.9667, 31, 0, "LON", true, true, true, "ITRXEH37", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923903", "9074756", - "ITRAXX-HIVOLS7V2 - 0612", "iTraxx Europe HiVol series 7 Version 2", - "ITRAXX-HIVOLS7V2-0612 EUR SEN MMR I03 CDS", 2454180, 2456099, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAO4", "ITRAXX", 7, "HIVOL", "VOL", "HV", 2, 5, - "244135", 0.9667, 31, 0, "LON", true, true, true, "ITRXEH57", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.7Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923904", "9074757", - "ITRAXX-HIVOLS7V2 - 0614", "iTraxx Europe HiVol series 7 Version 2", - "ITRAXX-HIVOLS7V2-0614 EUR SEN MMR I03 CDS", 2454180, 2456829, 0.007, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAO4", "ITRAXX", 7, "HIVOL", "VOL", "HV", 2, 7, - "244135", 0.9667, 31, 0, "LON", true, true, true, "ITRXEH77", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.10Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923905", "9074758", - "ITRAXX-HIVOLS7V2 - 0617", "iTraxx Europe HiVol series 7 Version 2", - "ITRAXX-HIVOLS7V2-0617 EUR SEN MMR I03 CDS", 2454180, 2457925, 0.0085, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAO4", "ITRAXX", 7, "HIVOL", "VOL", "HV", 2, 10, - "244135", 0.9667, 31, 0, "LON", true, true, true, "ITRXEH07", "VOL")); - - UpdateCDXRefDataMap ("USD ITRAXX.HIVOL.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923906", "9074759", - "USD ITRAXX-HIVOLS7V2 - 0612", "iTraxx Europe HiVol series 7 Version 2", - "ITRAXX-HIVOLS7V2-0612 USD SEN MMR I03 CDS", 2454180, 2456099, 0.0055000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I667LAO4", "USD ITRAXX", 7, "HIVOL", "VOL", "HV", 2, 5, - null, 0.9667, 31, 0, "LON", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("USD ITRAXX.HIVOL.10Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923908", "9074760", - "USD ITRAXX-HIVOLS7V2 - 0617", "iTraxx Europe HiVol series 7 Version 2", - "ITRAXX-HIVOLS7V2-0617 USD SEN MMR I03 CDS", 2454180, 2457925, 0.0085, "USD", - "ACT/360", false, 0.4, 4, "2I667LAO4", "USD ITRAXX", 7, "HIVOL", "VOL", "HV", 2, 10, - null, 0.9667, 31, 0, "LON", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.10Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923912", "9074764", - "USD ITRAXX-EUROPES8V2 - 1217", "iTraxx Europe series 8 Version 2", - "ITRAXX-EUROPES8V2-1217 USD SEN MMR I03 CDS PENDING", 2454364, 2458108, 0.007, "USD", - "ACT/360", false, 0.39, 4, "2I666VAW5", "USD ITRAXX", 8, "EUROPE", "EUR", "IG", 2, 10, - null, 0.9920000000000001, 123, 0, "LON", false, false, true, null, "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923913", "9074765", - "ITRAXX-XOVERS8V3 - 1210", "iTraxx Europe Crossover series 8 Version 3", - "ITRAXX-XOVERS8V3-1210 EUR SEN MMR I03 CDS MATURED", 2454364, 2455551, 0.027, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAT5", "ITRAXX", 8, "XOVER", "XVR", "XO", 3, 3, - "244067", 0.96, 50, 0, "LON", true, true, true, "ITRXEX38", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923914", "9074766", - "ITRAXX-XOVERS8V3 - 1212", "iTraxx Europe Crossover series 8 Version 3", - "ITRAXX-XOVERS8V3-1212 EUR SEN MMR I03 CDS MATURED", 2454364, 2456282, 0.0375, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAT5", "ITRAXX", 8, "XOVER", "XVR", "XO", 3, 5, - "244067", 0.96, 50, 0, "LON", true, true, true, "ITRXEX58", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923915", "9074767", - "ITRAXX-XOVERS8V3 - 1214", "iTraxx Europe Crossover series 8 Version 3", - "ITRAXX-XOVERS8V3-1214 EUR SEN MMR I03 CDS MATURED", 2454364, 2457012, 0.039, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAT5", "ITRAXX", 8, "XOVER", "XVR", "XO", 3, 7, - "244067", 0.96, 50, 0, "LON", true, true, true, "ITRXEX78", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923916", "9074768", - "ITRAXX-XOVERS8V3 - 1217", "iTraxx Europe Crossover series 8 Version 3", - "ITRAXX-XOVERS8V3-1217 EUR SEN MMR I03 CDS MATURED", 2454364, 2458108, 0.046, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAT5", "ITRAXX", 8, "XOVER", "XVR", "XO", 3, 10, - "244067", 0.96, 50, 0, "LON", true, true, true, "ITRXEX08", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923917", "9074770", - "ITRAXX-XOVERS9V3 - 0611", "iTraxx Europe Crossover series 9 Version 3", - "ITRAXX-XOVERS9V3-0611 EUR SEN MMR I03 CDS MATURED", 2454546, 2455733, 0.0625, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAU2", "ITRAXX", 9, "XOVER", "XVR", "XO", 3, 3, - "244065", 0.96, 50, 0, "LON", true, true, true, "ITRXEX39", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923918", "9074771", - "ITRAXX-XOVERS9V3 - 0613", "iTraxx Europe Crossover series 9 Version 3", - "ITRAXX-XOVERS9V3-0613 EUR SEN MMR I03 CDS MATURED", 2454546, 2456464, 0.065, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAU2", "ITRAXX", 9, "XOVER", "XVR", "XO", 3, 5, - "244065", 0.96, 50, 0, "LON", true, true, true, "ITRXEX59", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923919", "9074773", - "ITRAXX-XOVERS9V3 - 0618", "iTraxx Europe Crossover series 9 Version 3", - "ITRAXX-XOVERS9V3-0618 EUR SEN MMR I03 CDS MATURED", 2454546, 2458290, 0.064, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAU2", "ITRAXX", 9, "XOVER", "XVR", "XO", 3, 10, - "244065", 0.96, 50, 0, "LON", true, true, true, "ITRXEX09", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.7Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923920", "9074739", - "ITRAXX-EUROPES6V2 - 1213", "iTraxx Europe Series 6 Version 2", - "ITRAXX-EUROPES6V2-1213 EUR SEN MMR I03 CDS", 2453999, 2456647, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAQ8", "ITRAXX", 6, "EUROPE", "EUR", "IG", 2, 7, - "244133", 0.9920000000000001, 122, 0, "LON", true, true, true, "ITRXEB76", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923921", "9074740", - "ITRAXX-EUROPES6V2 - 1216", "iTraxx Europe Series 6 Version 2", - "ITRAXX-EUROPES6V2-1216 EUR SEN MMR I03 CDS", 2453999, 2457743, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAQ8", "ITRAXX", 6, "EUROPE", "EUR", "IG", 2, 10, - "244133", 0.9920000000000001, 122, 0, "LON", true, true, true, "ITRXEB06", "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923922", "9074741", - "USD ITRAXX-EUROPES6V2 - 1211", "iTraxx Europe series 6 Version 2", - "ITRAXX-EUROPES6V2-1211 USD SEN MMR I03 CDS", 2453999, 2455917, 0.003, "USD", - "ACT/360", false, 0.4, 4, "2I666VAQ8", "USD ITRAXX", 6, "EUROPE", "EUR", "IG", 2, 5, - null, 0.9920000000000001, 122, 0, "LON", false, false, true, null, "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.10Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923923", "9074742", - "USD ITRAXX-EUROPES6V2 - 1216", "iTraxx Europe series 6 Version 2", - "ITRAXX-EUROPES6V2-1216 USD SEN MMR I03 CDS", 2453999, 2457743, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I666VAQ8", "USD ITRAXX", 6, "EUROPE", "EUR", "IG", 2, 10, - null, 0.9920000000000001, 122, 0, "LON", false, false, true, null, "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.3Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923924", "9074744", - "ITRAXX-HIVOLS6V2 - 1209", "iTraxx Europe HiVol Series 6 Version 2", - "ITRAXX-HIVOLS6V2-1209 EUR SEN MMR I03 CDS", 2453999, 2455186, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAN6", "ITRAXX", 6, "HIVOL", "VOL", "HV", 2, 3, - "244132", 0.9667, 30, 0, "LON", true, true, true, "ITRXEH36", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923925", "9074745", - "ITRAXX-HIVOLS6V2 - 1211", "iTraxx Europe HiVol Series 6 Version 2", - "ITRAXX-HIVOLS6V2-1211 EUR SEN MMR I03 CDS", 2453999, 2455917, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAN6", "ITRAXX", 6, "HIVOL", "VOL", "HV", 2, 5, - "244132", 0.9667, 30, 0, "LON", true, true, true, "ITRXEH56", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.7Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923926", "9074746", - "ITRAXX-HIVOLS6V2 - 1213", "iTraxx Europe HiVol Series 6 Version 2", - "ITRAXX-HIVOLS6V2-1213 EUR SEN MMR I03 CDS", 2453999, 2456647, 0.007, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAN6", "ITRAXX", 6, "HIVOL", "VOL", "HV", 2, 7, - "244132", 0.9667, 30, 0, "LON", true, true, true, "ITRXEH76", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.10Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923927", "9074747", - "ITRAXX-HIVOLS6V2 - 1216", "iTraxx Europe HiVol Series 6 Version 2", - "ITRAXX-HIVOLS6V2-1216 EUR SEN MMR I03 CDS", 2453999, 2457743, 0.0085, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAN6", "ITRAXX", 6, "HIVOL", "VOL", "HV", 2, 10, - "244132", 0.9667, 30, 0, "LON", true, true, true, "ITRXEH06", "VOL")); - - UpdateCDXRefDataMap ("USD ITRAXX.HIVOL.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923928", "9074748", - "USD ITRAXX-HIVOLS6V2 - 1211", "iTraxx Europe HiVol series 6 Version 2", - "ITRAXX-HIVOLS6V2-1211 USD SEN MMR I03 CDS", 2453999, 2455916, 0.0055000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I667LAN6", "USD ITRAXX", 6, "HIVOL", "VOL", "HV", 2, 5, - null, 0.9667, 30, 0, "LON", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("TRACX.NA IG HB.10Y.2.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923934", "9076945", - "TRACX-NAIGHBS2V3 - 0314", "Dow Jones TRAC-X NA SERIES 2 High Beta March 2014", - "TRACX_NA_IG_S2_HB_10Y_3/14_SWP_38/40", 2452916, 2456737, 0.01, "USD", - "ACT/360", false, 0.4, 4, "TRACX-NAIGHBS2V3", "TRACX", 2, "NA IG HB", null, "IG", 3, 10, - null, 0.9500000000000001, 40, 0, "NYC", false, false, true, null, "Trac-X")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.4.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923935", "9076947", - "CDX-NAHYHBS4V10 - 0610", "Dow Jones CDX.NA.HY.HB.4", - "CDX_NA_HY_S04_HB__SWP_22/30", 2453475, 2455368, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWCX5", "CDX", 4, "NA HY HB", null, "HY", 10, 5, - null, 0.7331000000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.5.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923936", "9076968", - "CDX-NAHYBS5V6 - 1210", "Dow Jones CDX.NA.HY.B.5", - "CDX_NA_HY_S05_B___SWP_37/42", 2453651, 2455551, 0.034, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BSDT2", "CDX", 5, "NA HY B", null, "HY", 6, 5, - null, 0.881, 42, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.5.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923937", "9076973", - "CDX-NAHYHBS5V12 - 1210", "Dow Jones CDX.NA.HY.HB.5", - "CDX_NA_HY_S05_HB__SWP_21/30", 2453651, 2455551, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWDO4", "CDX", 5, "NA HY HB", null, "HY", 12, 5, - null, 0.6998000000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.6.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923938", "9077065", - "CDX-NAHYHBS6V10 - 0611", "Dow Jones CDX.NA.HY.HB.6", - "CDX_NA_HY_S06_HB__SWP_23/30", 2453823, 2455733, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWDP1", "CDX", 6, "NA HY HB", null, "HY", 10, 5, - null, 0.76666, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.8.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923939", "9077025", - "CDX-NAHYS8V15 - 0613", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_06YR_89/100", 2454188, 2456464, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGH7", "CDX", 8, "NA HY", null, "HY", 15, 6, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V20 FXD.LCDXNAV20 FXD.5Y.8.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923940", "9077111", - "LCDXNAS8V20 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_82/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBZ9 FXD", "LCDXNAS8V20 FXD", 8, "LCDXNAV20 FXD", null, "IG", 20, 5, - null, 0.8200000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923941", "9077114", - "LCDXNAS8V20 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_82/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBZ9", "LCDX", 8, "LCDXNA", null, "IG", 20, 6, - null, 0.8200000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923942", "9077118", - "LCDXNAS8V20 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_82/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBZ9", "LCDX", 8, "LCDXNA", null, "IG", 20, 7, - null, 0.8200000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923943", "9077121", - "LCDXNAS8V20 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_82/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBZ9", "LCDX", 8, "LCDXNA", null, "IG", 20, 4, - null, 0.8200000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923944", "9077131", - "LCDXNAS8V20 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_82/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBZ9", "LCDX", 8, "LCDXNA", null, "IG", 20, 3, - null, 0.8200000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923945", "9077155", - "LCDXNAS8V20 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_82/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GBZ9", "LCDX", 8, "LCDXNA", null, "IG", 20, 10, - null, 0.8200000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.9.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923950", "9077147", - "CDX-NAHYHBS9V10 - 1212", "CDX.NA.HY.HB.9", - "CDX_NA_HY_S09_HB__SWP_23/30", 2454372, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BWDS5", "CDX", 9, "NA HY HB", null, "HY", 10, 5, - null, 0.76666, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.10.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923951", "9076971", - "CDX-NAHYS10V15 - 0610", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_02YR_89/100", 2454554, 2455368, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGJ3", "CDX", 10, "NA HY", null, "HY", 15, 2, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.10.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923952", "9076963", - "CDX-NAHYS10V15 - 0615", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_07YR_89/100", 2454554, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGJ3", "CDX", 10, "NA HY", null, "HY", 15, 7, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.10.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923953", "9076964", - "CDX-NAHYS10V15 - 0611", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_03YR_89/100", 2454554, 2455733, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGJ3", "CDX", 10, "NA HY", null, "HY", 15, 3, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.10.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923954", "9076967", - "CDX-NAHYS10V15 - 0618", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_10YR_89/100", 2454554, 2458290, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGJ3", "CDX", 10, "NA HY", null, "HY", 15, 10, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.10.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923955", "9076991", - "LCDXNAS10V16 - 0611", "LCDX.NA.10", - "CDX_NA_LN_S10_100_03YR_86/100", 2454561, 2455733, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "5F199GCB1", "LCDX", 10, "LCDXNA", null, "IG", 16, 3, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923956", "9076992", - "LCDXNAS10V16 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_86/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.55, 4, "5F199GCB1", "LCDX", 10, "LCDXNA", null, "IG", 16, 5, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.11.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923957", "9076956", - "CDX-NAHYS11V15 - 1213", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_89/100", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGK0", "CDX", 11, "NA HY", null, "HY", 15, 5, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.11.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923958", "9076958", - "CDX-NAHYS11V15 - 1211", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_03YR_89/100", 2454738, 2455916, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGK0", "CDX", 11, "NA HY", null, "HY", 15, 3, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.11.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923959", "9076960", - "CDX-NAHYS11V15 - 1215", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_07YR_89/100", 2454738, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGK0", "CDX", 11, "NA HY", null, "HY", 15, 7, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.11.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923960", "9076961", - "CDX-NAHYS11V15 - 1218", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_10YR_89/100", 2454738, 2458473, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGK0", "CDX", 11, "NA HY", null, "HY", 15, 10, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.12.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923961", "9077247", - "CDX-NAHYS12V6 - 0614", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_96/100", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGL8", "CDX", 12, "NA HY", null, "HY", 6, 5, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.12.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923962", "9077248", - "CDX-NAHYS12V6 - 0616", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_07YR_96/100", 2454911, 2457560, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGL8", "CDX", 12, "NA HY", null, "HY", 6, 7, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.12.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923963", "9077123", - "CDX-NAHYS12V6 - 0619", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_10YR_96/100", 2454911, 2458655, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGL8", "CDX", 12, "NA HY", null, "HY", 6, 10, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.12.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923964", "9077127", - "CDX-NAHYS12V6 - 0612", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_03YR_96/100", 2454911, 2456099, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGL8", "CDX", 12, "NA HY", null, "HY", 6, 3, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.12.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923965", "9077148", - "LCDXNAS12V4 - 0612", "LCDX.NA.12", - "CDX_NA_LN_S12_100_03YR_97/100", 2454938, 2456099, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCC9", "LCDX", 12, "LCDXNA", null, "IG", 4, 3, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.12.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923966", "9076965", - "LCDXNAS12V4 - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_97/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.55, 4, "5F199GCC9", "LCDX", 12, "LCDXNA", null, "IG", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.7.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923967", "9076724", - "CDX-NAHYS7V14 - 1213", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_07YR_89/100", 2454007, 2456647, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGG9", "CDX", 7, "NA HY", null, "HY", 14, 7, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.7.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923968", "9076996", - "CDX-NAHYS7V14 - 1209", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_03YR_89/100", 2454007, 2455186, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGG9", "CDX", 7, "NA HY", null, "HY", 14, 3, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.7.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923969", "9076997", - "CDX-NAHYS7V14 - 1216", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_10YR_89/100", 2454007, 2457743, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGG9", "CDX", 7, "NA HY", null, "HY", 14, 10, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.7.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923970", "9077015", - "CDX-NAHYS7V14 - 1211", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_89/100", 2454007, 2455916, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGG9", "CDX", 7, "NA HY", null, "HY", 14, 5, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.8.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923971", "9077091", - "CDX-NAHYS8V15 - 0614", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_07YR_89/100", 2454188, 2456829, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGH7", "CDX", 8, "NA HY", null, "HY", 15, 7, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.8.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923972", "9077096", - "CDX-NAHYS8V15 - 0612", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_89/100", 2454188, 2456099, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGH7", "CDX", 8, "NA HY", null, "HY", 15, 5, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.8.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923973", "9077102", - "CDX-NAHYS8V15 - 0610", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_03YR_89/100", 2454188, 2455368, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGH7", "CDX", 8, "NA HY", null, "HY", 15, 3, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.8.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923974", "9077106", - "CDX-NAHYS8V15 - 0617", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_10YR_89/100", 2454188, 2457925, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGH7", "CDX", 8, "NA HY", null, "HY", 15, 10, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923975", "9077141", - "LCDXNAS8V20 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_82/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.55, 4, "5F199GBZ9", "LCDX", 8, "LCDXNA", null, "IG", 20, 5, - null, 0.8200000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.9.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923976", "9077161", - "CDX-NAHYS9V16 - 1212", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_88/100", 2454372, 2456282, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGI5", "CDX", 9, "NA HY", null, "HY", 16, 5, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.9.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923977", "9077162", - "CDX-NAHYS9V16 - 1210", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_03YR_ 88/100", 2454372, 2455551, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGI5", "CDX", 9, "NA HY", null, "HY", 16, 3, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.9.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923978", "9077170", - "CDX-NAHYS9V16 - 1214", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_07YR_ 88/100", 2454372, 2457012, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGI5", "CDX", 9, "NA HY", null, "HY", 16, 7, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.9.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923979", "9077171", - "CDX-NAHYS9V16 - 1217", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_10YR_ 88/100", 2454372, 2458108, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGI5", "CDX", 9, "NA HY", null, "HY", 16, 10, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923980", "9077051", - "LCDXNAS9V15 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_87/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.55, 4, "5F199GCA3", "LCDX", 9, "LCDXNA", null, "IG", 15, 5, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.10.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923981", "9076959", - "CDX-NAHYS10V15 - 0613", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_89/100", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGJ3", "CDX", 10, "NA HY", null, "HY", 15, 5, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.9.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923983", "9077054", - "LCDXNAS9V15 - 1209", "LCDX.NA.9", - "CDX_NA_LN_S09_100_02YR_87/100", 2454378, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCA3", "LCDX", 9, "LCDXNA", null, "IG", 15, 2, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V15 FXD.LCDXNAV15 FXD.5Y.9.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923984", "9077055", - "LCDXNAS9V15 FXD - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_FXD_87/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCA3 FXD", "LCDXNAS9V15 FXD", 9, "LCDXNAV15 FXD", null, "IG", 15, 5, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.9.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923985", "9077098", - "LCDXNAS9V15 - 1214", "LCDX.NA.9", - "CDX_NA_LN_S09_100_07YR_87/100", 2454378, 2457012, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCA3", "LCDX", 9, "LCDXNA", null, "IG", 15, 7, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.9.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923986", "9077103", - "LCDXNAS9V15 - 1210", "LCDX.NA.9", - "CDX_NA_LN_S09_100_03YR_87/100", 2454378, 2455551, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCA3", "LCDX", 9, "LCDXNA", null, "IG", 15, 3, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.9.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923987", "9077104", - "LCDXNAS9V15 - 1217", "LCDX.NA.9", - "CDX_NA_LN_S09_100_10YR_87/100", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCA3", "LCDX", 9, "LCDXNA", null, "IG", 15, 10, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.9.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923988", "9077105", - "LCDXNAS9V15 - 1211", "LCDX.NA.9", - "CDX_NA_LN_S09_100_04YR_87/100", 2454378, 2455916, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCA3", "LCDX", 9, "LCDXNA", null, "IG", 15, 4, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS10V16 FXD.LCDXNAV16 FXD.5Y.10.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923989", "9076995", - "LCDXNAS10V16 FXD - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_FXD_86/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCB1 FXD", "LCDXNAS10V16 FXD", 10, "LCDXNAV16 FXD", null, "IG", 16, 5, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.9.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923990", "9077107", - "LCDXNAS9V15 - 1213", "LCDX.NA.9", - "CDX_NA_LN_S09_100_06YR_87/100", 2454378, 2456647, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCA3", "LCDX", 9, "LCDXNA", null, "IG", 15, 6, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.10.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923991", "9076998", - "LCDXNAS10V16 - 0614", "LCDX.NA.10", - "CDX_NA_LN_S10_100_06YR_86/100", 2454561, 2456829, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCB1", "LCDX", 10, "LCDXNA", null, "IG", 16, 6, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.10.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923992", "9076952", - "LCDXNAS10V16 - 0612", "LCDX.NA.10", - "CDX_NA_LN_S10_100_04YR_86/100", 2454561, 2456099, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCB1", "LCDX", 10, "LCDXNA", null, "IG", 16, 4, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.10.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923993", "9077001", - "LCDXNAS10V16 - 0609", "LCDX.NA.10", - "CDX_NA_LN_S10_100_01YR_86/100", 2454561, 2455003, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCB1", "LCDX", 10, "LCDXNA", null, "IG", 16, 1, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.10.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923994", "9077002", - "LCDXNAS10V16 - 0610", "LCDX.NA.10", - "CDX_NA_LN_S10_100_02YR_86/100", 2454561, 2455368, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCB1", "LCDX", 10, "LCDXNA", null, "IG", 16, 2, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.10.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923995", "9077007", - "LCDXNAS10V16 - 0615", "LCDX.NA.10", - "CDX_NA_LN_S10_100_07YR_86/100", 2454561, 2457194, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCB1", "LCDX", 10, "LCDXNA", null, "IG", 16, 7, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.10.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("923996", "9076951", - "LCDXNAS10V16 - 0618", "LCDX.NA.10", - "CDX_NA_LN_S10_100_10YR_86/100", 2454561, 2458290, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCB1", "LCDX", 10, "LCDXNA", null, "IG", 16, 10, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.1.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924004", "9076734", - "CDX-NAIGS1V7 - 0314", "Dow Jones CDX.NA.IG", - "DJCDX_NA_IG_S1_10Y_3/14_119/125", 2452934, 2456737, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBV6", "CDX", 1, "NA IG", null, "IG", 7, 10, - null, 0.956, 124, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.10Y.1.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924006", "9076735", - "CDX-NAIGHVOLS1V4 - 0314", "Dow Jones CDX.NA.IG.HVOL.1", - "DJCDX_NA_IG_S1_HIVOL_10Y_28/30", 2452934, 2456737, 0.0135, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BE2", "CDX", 1, "NA IG HVOL", null, "HV", 4, 10, - null, 0.9333400000000001, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.4.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924012", "9076948", - "CDX-NAHYBBS4V6 - 0610", "DOW JONES CDX.NA.HY.BB.4", - "CDX_NA_HY_S04_BB__SWP_38/43", 2453475, 2455368, 0.021, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BVBQ3", "CDX", 4, "NA HY BB", null, "HY", 6, 5, - null, 0.88371, 43, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.4.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924013", "9076955", - "CDX-NAHYS4V15 - 0610", "Dow Jones CDX.NA.HY.4", - "CDX_NA_HY_S04_100_SWP_87/100", 2453475, 2455368, 0.036000000000000004, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFN5", "CDX", 4, "NA HY", null, "HY", 15, 5, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.5.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924014", "9076975", - "CDX-NAHYS5V16 - 1215", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_10YR_87/100", 2453651, 2457377, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGE4", "CDX", 5, "NA HY", null, "HY", 16, 10, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.5.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924016", "9076985", - "CDX-NAHYS5V16 - 1212", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_07YR_87/100", 2453651, 2456282, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGE4", "CDX", 5, "NA HY", null, "HY", 16, 7, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.5.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924018", "9076988", - "CDX-NAHYS5V16 - 1210", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_87/100", 2453651, 2455551, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGE4", "CDX", 5, "NA HY", null, "HY", 16, 5, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.6.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924020", "9077064", - "CDX-NAHYBS6V9 - 0611", "Dow Jones CDX.NA.HY.B.6", - "CDX_NA_HY_S06_B___SWP_41/48", 2453823, 2455733, 0.030000000000000002, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BSEA2", "CDX", 6, "NA HY B", null, "HY", 9, 5, - null, 0.85416, 48, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.6.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924022", "9076710", - "CDX-NAHYS6V14 - 0609", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_03YR_89/100", 2453823, 2455003, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGF1", "CDX", 6, "NA HY", null, "HY", 14, 3, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.6.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924024", "9076714", - "CDX-NAHYS6V14 - 0616", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_10YR_89/100", 2453823, 2457560, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGF1", "CDX", 6, "NA HY", null, "HY", 14, 10, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.6.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924025", "9076715", - "CDX-NAHYS6V14 - 0613", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_07YR_89/100", 2453823, 2456464, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGF1", "CDX", 6, "NA HY", null, "HY", 14, 7, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.6.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924026", "9076718", - "CDX-NAHYS6V14 - 0611", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_89/100", 2453823, 2455733, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGF1", "CDX", 6, "NA HY", null, "HY", 14, 5, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.7.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924027", "9076720", - "CDX-NAHYBS7V6 - 1211", "Dow Jones CDX.NA.HY.B.7", - "CDX_NA_HY_S07_B___SWP_45/50", 2454007, 2455916, 0.030000000000000002, "USD", - "ACT/360", false, 0.3, 4, "2I65BSDV7", "CDX", 7, "NA HY B", null, "HY", 6, 5, - null, 0.9, 50, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.12.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924028", "9076966", - "LCDXNAS12V4 - 0610", "LCDX.NA.12", - "CDX_NA_LN_S12_100_01YR_97/100", 2454938, 2455368, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCC9", "LCDX", 12, "LCDXNA", null, "IG", 4, 1, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS12V4 FXD.LCDXNAV4 FXD.5Y.12.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924029", "9076969", - "LCDXNAS12V4 FXD - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_FXD_97/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCC9 FXD", "LCDXNAS12V4 FXD", 12, "LCDXNAV4 FXD", null, "IG", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.12.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924030", "9076970", - "LCDXNAS12V4 - 0611", "LCDX.NA.12", - "CDX_NA_LN_S12_100_02YR_97/100", 2454938, 2455733, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCC9", "LCDX", 12, "LCDXNA", null, "IG", 4, 2, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet27() - { - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.12.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924031", "9076972", - "LCDXNAS12V4 - 0616", "LCDX.NA.12", - "CDX_NA_LN_S12_100_07YR_97/100", 2454938, 2457560, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCC9", "LCDX", 12, "LCDXNA", null, "IG", 4, 7, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.12.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924032", "9076974", - "LCDXNAS12V4 - 0619", "LCDX.NA.12", - "CDX_NA_LN_S12_100_10YR_97/100", 2454938, 2458655, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCC9", "LCDX", 12, "LCDXNA", null, "IG", 4, 10, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.12.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924033", "9076979", - "LCDXNAS12V4 - 0613", "LCDX.NA.12", - "CDX_NA_LN_S12_100_04YR_97/100", 2454938, 2456464, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCC9", "LCDX", 12, "LCDXNA", null, "IG", 4, 4, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.12.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924034", "9076981", - "LCDXNAS12V4 - 0615", "LCDX.NA.12", - "CDX_NA_LN_S12_100_06YR_97/100", 2454938, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCC9", "LCDX", 12, "LCDXNA", null, "IG", 4, 6, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.9.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924035", "9077179", - "CDX-NAHYS9V16 - 1211", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_04YR_ 88/100", 2454372, 2455916, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGI5", "CDX", 9, "NA HY", null, "HY", 16, 4, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.9.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924036", "9077181", - "CDX-NAHYS9V16 - 1213", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_06YR_ 88/100", 2454372, 2456647, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGI5", "CDX", 9, "NA HY", null, "HY", 16, 6, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.9.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924037", "9077183", - "CDX-NAHYS9V16 - 1209", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_02YR_ 88/100", 2454372, 2455186, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGI5", "CDX", 9, "NA HY", null, "HY", 16, 2, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.10.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924038", "9077112", - "CDX-NAHYHBS10V12 - 0613", "CDX.NA.HY.HB.10", - "CDX_NA_HY_S10_HB__SWP_22/30", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWDT3", "CDX", 10, "NA HY HB", null, "HY", 12, 5, - null, 0.73334, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.11.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924039", "9076954", - "CDX-NAHYHBS11V13 - 1213", "CDX.NA.HY.HB.11", - "CDX_NA_HY_S11_HB__SWP_21/30", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWDU0", "CDX", 11, "NA HY HB", null, "HY", 13, 5, - null, 0.70001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.11.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924040", "9077238", - "CDX-NAHYS11V15 - 1214", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_06YR_89/100", 2454738, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGK0", "CDX", 11, "NA HY", null, "HY", 15, 6, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.11.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924041", "9077239", - "CDX-NAHYS11V15 - 1212", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_04YR_89/100", 2454738, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGK0", "CDX", 11, "NA HY", null, "HY", 15, 4, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.6.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924042", "9077072", - "CDX-NAHYS6V14 - 0610", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_04YR_89/100", 2453823, 2455368, 0.0345, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGF1", "CDX", 6, "NA HY", null, "HY", 14, 4, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.6.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924043", "9076709", - "CDX-NAHYS6V14 - 0612", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_06YR_89/100", 2453823, 2456099, 0.0345, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGF1", "CDX", 6, "NA HY", null, "HY", 14, 6, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.7.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924044", "9076723", - "CDX-NAHYHBS7V10 - 1211", "Dow Jones CDX.NA.HY.HB.7", - "CDX_NA_HY_S07_HB__SWP_23/30", 2454007, 2455916, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWDQ9", "CDX", 7, "NA HY HB", null, "HY", 10, 5, - null, 0.7666700000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.8.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924045", "9077020", - "CDX-NAHYHBS8V10 - 0612", "CDX.NA.HY.HB.8", - "CDX_NA_HY_S08_HB__SWP_23/30", 2454188, 2456099, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BWDR7", "CDX", 8, "NA HY HB", null, "HY", 10, 5, - null, 0.76666, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.8.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924046", "9077021", - "CDX-NAHYS8V15 - 0609", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_02YR_89/100", 2454188, 2455003, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGH7", "CDX", 8, "NA HY", null, "HY", 15, 2, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924050", "9076925", - "LCDXNAS8V21 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_81/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.55, 4, "5F199GCD7", "LCDX", 8, "LCDXNA", null, "IG", 21, 5, - null, 0.81, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924052", "9077177", - "LCDXNAS8V21 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_81/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCD7", "LCDX", 8, "LCDXNA", null, "IG", 21, 10, - null, 0.81, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924054", "9076926", - "LCDXNAS9V16 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_86/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.55, 4, "5F199GCE5", "LCDX", 9, "LCDXNA", null, "IG", 16, 5, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924056", "9076927", - "LCDXNAS10V17 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_85/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.55, 4, "5F199GCF2", "LCDX", 10, "LCDXNA", null, "IG", 17, 5, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.12.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924057", "9076928", - "LCDXNAS12V5 - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_96/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.55, 4, "5F199GCG0", "LCDX", 12, "LCDXNA", null, "IG", 5, 5, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.8.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924060", "9077024", - "CDX-NAHYS8V15 - 0611", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_04YR_89/100", 2454188, 2455733, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGH7", "CDX", 8, "NA HY", null, "HY", 15, 4, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.10.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924062", "9076980", - "CDX-NAHYS10V15 - 0612", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_04YR_89/100", 2454554, 2456099, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGJ3", "CDX", 10, "NA HY", null, "HY", 15, 4, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.10.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924063", "9076982", - "CDX-NAHYS10V15 - 0614", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_06YR_89/100", 2454554, 2456829, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGJ3", "CDX", 10, "NA HY", null, "HY", 15, 6, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.10.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924064", "9077086", - "LCDXNAS10V17 - 0611", "LCDX.NA.10", - "CDX_NA_LN_S10_100_03YR_85/100", 2454561, 2455733, 0.0275, "USD", - "ACT/360", false, 0.55, 4, "5F199GCF2", "LCDX", 10, "LCDXNA", null, "IG", 17, 3, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.12.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924065", "9077041", - "LCDXNAS12V5 - 0612", "LCDX.NA.12", - "CDX_NA_LN_S12_100_03YR_96/100", 2454938, 2456099, 0.05, "USD", - "ACT/360", false, 0.55, 4, "5F199GCG0", "LCDX", 12, "LCDXNA", null, "IG", 5, 3, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.11.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924066", "9077241", - "CDX-NAHYS11V15 - 1210", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_02YR_89/100", 2454738, 2455551, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGK0", "CDX", 11, "NA HY", null, "HY", 15, 2, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.11.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924067", "9077242", - "CDX-NAHYS11V15 - 1209", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_01YR_89/100", 2454738, 2455186, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGK0", "CDX", 11, "NA HY", null, "HY", 15, 1, - null, 0.89, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.12.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924068", "9077245", - "CDX-NAHYHBS12V6 - 0614", "CDX.NA.HY.HB.12", - "CDX_NA_HY_S12_HB__SWP_26/30", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWDV8", "CDX", 12, "NA HY HB", null, "HY", 6, 5, - null, 0.8666800000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.12.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924069", "9077132", - "CDX-NAHYS12V6 - 0611", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_02YR_96/100", 2454911, 2455733, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGL8", "CDX", 12, "NA HY", null, "HY", 6, 2, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.12.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924070", "9077136", - "CDX-NAHYS12V6 - 0610", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_01YR_96/100", 2454911, 2455368, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGL8", "CDX", 12, "NA HY", null, "HY", 6, 1, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.12.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924071", "9077140", - "CDX-NAHYS12V6 - 0615", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_06YR_96/100", 2454911, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGL8", "CDX", 12, "NA HY", null, "HY", 6, 6, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.12.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924072", "9077143", - "CDX-NAHYS12V6 - 0613", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_04YR_96/100", 2454911, 2456464, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGL8", "CDX", 12, "NA HY", null, "HY", 6, 4, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V21 FXD.LCDXNAV21 FXD.5Y.8.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924074", "9077146", - "LCDXNAS8V21 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_81/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCD7 FXD", "LCDXNAS8V21 FXD", 8, "LCDXNAV21 FXD", null, "IG", 21, 5, - null, 0.81, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924075", "9077150", - "LCDXNAS8V21 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_81/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCD7", "LCDX", 8, "LCDXNA", null, "IG", 21, 6, - null, 0.81, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924076", "9077152", - "LCDXNAS8V21 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_81/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCD7", "LCDX", 8, "LCDXNA", null, "IG", 21, 7, - null, 0.81, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924077", "9077158", - "LCDXNAS8V21 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_81/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCD7", "LCDX", 8, "LCDXNA", null, "IG", 21, 4, - null, 0.81, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924078", "9077167", - "LCDXNAS8V21 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_81/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCD7", "LCDX", 8, "LCDXNA", null, "IG", 21, 3, - null, 0.81, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.9.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924079", "9077078", - "LCDXNAS9V16 - 1217", "LCDX.NA.9", - "CDX_NA_LN_S09_100_10YR_86/100", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCE5", "LCDX", 9, "LCDXNA", null, "IG", 16, 10, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.9.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924080", "9077080", - "LCDXNAS9V16 - 1211", "LCDX.NA.9", - "CDX_NA_LN_S09_100_04YR_86/100", 2454378, 2455916, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCE5", "LCDX", 9, "LCDXNA", null, "IG", 16, 4, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.9.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924081", "9077083", - "LCDXNAS9V16 - 1213", "LCDX.NA.9", - "CDX_NA_LN_S09_100_06YR_86/100", 2454378, 2456647, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCE5", "LCDX", 9, "LCDXNA", null, "IG", 16, 6, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS10V17 FXD.LCDXNAV17 FXD.5Y.10.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924082", "9077087", - "LCDXNAS10V17 FXD - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_FXD_85/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCF2 FXD", "LCDXNAS10V17 FXD", 10, "LCDXNAV17 FXD", null, "IG", 17, 5, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.9.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924089", "9076918", - "LCDXNAS9V16 - 1209", "LCDX.NA.9", - "CDX_NA_LN_S09_100_02YR_86/100", 2454378, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCE5", "LCDX", 9, "LCDXNA", null, "IG", 16, 2, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V16 FXD.LCDXNAV16 FXD.5Y.9.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924090", "9076920", - "LCDXNAS9V16 FXD - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_FXD_86/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCE5 FXD", "LCDXNAS9V16 FXD", 9, "LCDXNAV16 FXD", null, "IG", 16, 5, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.9.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924091", "9076921", - "LCDXNAS9V16 - 1214", "LCDX.NA.9", - "CDX_NA_LN_S09_100_07YR_86/100", 2454378, 2457012, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCE5", "LCDX", 9, "LCDXNA", null, "IG", 16, 7, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.9.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924093", "9076922", - "LCDXNAS9V16 - 1210", "LCDX.NA.9", - "CDX_NA_LN_S09_100_03YR_86/100", 2454378, 2455551, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCE5", "LCDX", 9, "LCDXNA", null, "IG", 16, 3, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.10.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924098", "9077543", - "LCDXNAS10V17 - 0614", "LCDX.NA.10", - "CDX_NA_LN_S10_100_06YR_85/100", 2454561, 2456829, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCF2", "LCDX", 10, "LCDXNA", null, "IG", 17, 6, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.12.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924100", "9077100", - "LCDXNAS12V5 - 0616", "LCDX.NA.12", - "CDX_NA_LN_S12_100_07YR_96/100", 2454938, 2457560, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCG0", "LCDX", 12, "LCDXNA", null, "IG", 5, 7, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.12.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924101", "9077426", - "LCDXNAS12V5 - 0619", "LCDX.NA.12", - "CDX_NA_LN_S12_100_10YR_96/100", 2454938, 2458655, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCG0", "LCDX", 12, "LCDXNA", null, "IG", 5, 10, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.12.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924102", "9077427", - "LCDXNAS12V5 - 0613", "LCDX.NA.12", - "CDX_NA_LN_S12_100_04YR_96/100", 2454938, 2456464, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCG0", "LCDX", 12, "LCDXNA", null, "IG", 5, 4, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.12.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924103", "9077431", - "LCDXNAS12V5 - 0615", "LCDX.NA.12", - "CDX_NA_LN_S12_100_06YR_96/100", 2454938, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCG0", "LCDX", 12, "LCDXNA", null, "IG", 5, 6, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.10.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924105", "9077550", - "LCDXNAS10V17 - 0610", "LCDX.NA.10", - "CDX_NA_LN_S10_100_02YR_85/100", 2454561, 2455368, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCF2", "LCDX", 10, "LCDXNA", null, "IG", 17, 2, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.10.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924106", "9077553", - "LCDXNAS10V17 - 0615", "LCDX.NA.10", - "CDX_NA_LN_S10_100_07YR_85/100", 2454561, 2457194, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCF2", "LCDX", 10, "LCDXNA", null, "IG", 17, 7, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.10.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924107", "9077556", - "LCDXNAS10V17 - 0618", "LCDX.NA.10", - "CDX_NA_LN_S10_100_10YR_85/100", 2454561, 2458290, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCF2", "LCDX", 10, "LCDXNA", null, "IG", 17, 10, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.10.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924108", "9077560", - "LCDXNAS10V17 - 0612", "LCDX.NA.10", - "CDX_NA_LN_S10_100_04YR_85/100", 2454561, 2456099, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCF2", "LCDX", 10, "LCDXNA", null, "IG", 17, 4, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.12.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924109", "9077046", - "LCDXNAS12V5 - 0610", "LCDX.NA.12", - "CDX_NA_LN_S12_100_01YR_96/100", 2454938, 2455368, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCG0", "LCDX", 12, "LCDXNA", null, "IG", 5, 1, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS12V5 FXD.LCDXNAV5 FXD.5Y.12.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924110", "9077094", - "LCDXNAS12V5 FXD - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_FXD_96/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCG0 FXD", "LCDXNAS12V5 FXD", 12, "LCDXNAV5 FXD", null, "IG", 5, 5, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.12.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924111", "9077099", - "LCDXNAS12V5 - 0611", "LCDX.NA.12", - "CDX_NA_LN_S12_100_02YR_96/100", 2454938, 2455733, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCG0", "LCDX", 12, "LCDXNA", null, "IG", 5, 2, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.6.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924124", "9087879", - "CDX-NAHYS6V15 - 0611", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_88/100", 2453823, 2455733, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGW4", "CDX", 6, "NA HY", null, "HY", 15, 5, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.7.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924125", "9087953", - "CDX-NAHYS7V15 - 1213", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_07YR_88/100", 2454007, 2456647, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGY0", "CDX", 7, "NA HY", null, "HY", 15, 7, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.7.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924126", "9087958", - "CDX-NAHYS7V15 - 1216", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_10YR_88/100", 2454007, 2457743, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGY0", "CDX", 7, "NA HY", null, "HY", 15, 10, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.7.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924127", "9087959", - "CDX-NAHYS7V15 - 1211", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_88/100", 2454007, 2455916, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGY0", "CDX", 7, "NA HY", null, "HY", 15, 5, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.8.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924128", "9087961", - "CDX-NAHYS8V16 - 0614", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_07YR_88/100", 2454188, 2456829, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGP9", "CDX", 8, "NA HY", null, "HY", 16, 7, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.8.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924129", "9087906", - "CDX-NAHYS8V16 - 0612", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_88/100", 2454188, 2456099, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGP9", "CDX", 8, "NA HY", null, "HY", 16, 5, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.8.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924130", "9087908", - "CDX-NAHYS8V16 - 0610", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_03YR_88/100", 2454188, 2455368, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGP9", "CDX", 8, "NA HY", null, "HY", 16, 3, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.8.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924131", "9087917", - "CDX-NAHYS8V16 - 0617", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_10YR_88/100", 2454188, 2457925, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGP9", "CDX", 8, "NA HY", null, "HY", 16, 10, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.9.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924132", "9087922", - "CDX-NAHYS9V17 - 1210", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_03YR_87/100", 2454372, 2455551, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGQ7", "CDX", 9, "NA HY", null, "HY", 17, 3, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.9.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924133", "9087881", - "CDX-NAHYS9V17 - 1214", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_07YR_87/100", 2454372, 2457012, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGQ7", "CDX", 9, "NA HY", null, "HY", 17, 7, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.9.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924134", "9087919", - "CDX-NAHYS9V17 - 1212", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_87/100", 2454372, 2456282, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGQ7", "CDX", 9, "NA HY", null, "HY", 17, 5, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.9.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924135", "9087882", - "CDX-NAHYS9V17 - 1217", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_10YR_87/100", 2454372, 2458108, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGQ7", "CDX", 9, "NA HY", null, "HY", 17, 10, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.10.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924136", "9087883", - "CDX-NAHYS10V16 - 0615", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_07YR_88/100", 2454554, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGM6", "CDX", 10, "NA HY", null, "HY", 16, 7, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.10.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924138", "9087887", - "CDX-NAHYS10V16 - 0611", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_03YR_88/100", 2454554, 2455733, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGM6", "CDX", 10, "NA HY", null, "HY", 16, 3, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.11.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924139", "9088126", - "CDX-NAHYS11V16 - 1218", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_10YR_88/100", 2454738, 2458473, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGN4", "CDX", 11, "NA HY", null, "HY", 16, 10, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.10.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924140", "9087888", - "CDX-NAHYS10V16 - 0618", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_10YR_88/100", 2454554, 2458290, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGM6", "CDX", 10, "NA HY", null, "HY", 16, 10, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.12.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924141", "9087712", - "CDX-NAHYS12V7 - 0614", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_95/100", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGO2", "CDX", 12, "NA HY", null, "HY", 7, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.12.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924143", "9087713", - "CDX-NAHYS12V7 - 0616", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_07YR_95/100", 2454911, 2457560, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGO2", "CDX", 12, "NA HY", null, "HY", 7, 7, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.11.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924144", "9088123", - "CDX-NAHYS11V16 - 1213", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_88/100", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGN4", "CDX", 11, "NA HY", null, "HY", 16, 5, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.12.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924145", "9087715", - "CDX-NAHYS12V7 - 0619", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_10YR_95/100", 2454911, 2458655, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGO2", "CDX", 12, "NA HY", null, "HY", 7, 10, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.11.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924146", "9088124", - "CDX-NAHYS11V16 - 1211", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_03YR_88/100", 2454738, 2455916, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGN4", "CDX", 11, "NA HY", null, "HY", 16, 3, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.12.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924147", "9087716", - "CDX-NAHYS12V7 - 0612", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_03YR_95/100", 2454911, 2456099, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGO2", "CDX", 12, "NA HY", null, "HY", 7, 3, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.11.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924148", "9088125", - "CDX-NAHYS11V16 - 1215", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_07YR_88/100", 2454738, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGN4", "CDX", 11, "NA HY", null, "HY", 16, 7, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.10.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924149", "9088121", - "CDX-NAHYS10V16 - 0613", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_88/100", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGM6", "CDX", 10, "NA HY", null, "HY", 16, 5, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.7.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924150", "9087956", - "CDX-NAHYS7V15 - 1209", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_03YR_88/100", 2454007, 2455186, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGY0", "CDX", 7, "NA HY", null, "HY", 15, 3, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.22", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924151", "9087719", - "LCDXNAS8V22 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_80/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.55, 4, "5F199GCH8", "LCDX", 8, "LCDXNA", null, "IG", 22, 5, - null, 0.8, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924152", "9087941", - "LCDXNAS9V17 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_85/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.55, 4, "5F199GCI6", "LCDX", 9, "LCDXNA", null, "IG", 17, 5, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924153", "9087947", - "LCDXNAS10V18 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_84/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.55, 4, "5F199GCJ4", "LCDX", 10, "LCDXNA", null, "IG", 18, 5, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.10.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924154", "9087951", - "LCDXNAS10V18 - 0611", "LCDX.NA.10", - "CDX_NA_LN_S10_100_03YR_84/100", 2454561, 2455733, 0.0275, "USD", - "ACT/360", false, 0.55, 4, "5F199GCJ4", "LCDX", 10, "LCDXNA", null, "IG", 18, 3, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.12.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924155", "9087952", - "LCDXNAS12V6 - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_95/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.55, 4, "5F199GCK1", "LCDX", 12, "LCDXNA", null, "IG", 6, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.2.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924156", "9087730", - "CDX-NAHYS2V14 - 0909", "Dow Jones CDX.NA.HY.2", - "DJIBOXX_NA_HY_S02_100_SWP_85/100", 2453088, 2455095, 0.043000000000000003, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGS3", "CDX", 2, "NA HY", null, "HY", 14, 5, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.3.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924157", "9087731", - "CDX-NAHYS3V15 - 1209", "Dow Jones CDX.NA.HY.3", - "CDX_NA_HY_S03_100_SWP_87/100", 2453196, 2455186, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGT1", "CDX", 3, "NA HY", null, "HY", 15, 5, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.3.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924158", "9087732", - "CDX-NAHYBS3V8 - 1209", "Dow Jones CDX.NA.HY.B.3", - "CDX_NA_HY_S03_B___SWP_37/44", 2453196, 2455186, 0.04, "USD", - "ACT/360", false, 0.3, 4, "2I65BSEC8", "CDX", 3, "NA HY B", null, "HY", 8, 5, - null, 0.8409000000000001, 44, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.4.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924160", "9087734", - "CDX-NAHYS4V16 - 0610", "Dow Jones CDX.NA.HY.4", - "CDX_NA_HY_S04_100_SWP_86/100", 2453475, 2455368, 0.036000000000000004, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRGU8", "CDX", 4, "NA HY", null, "HY", 16, 5, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.5.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924161", "9087735", - "CDX-NAHYS5V17 - 1215", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_10YR_86/100", 2453651, 2457377, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGV6", "CDX", 5, "NA HY", null, "HY", 17, 10, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.5.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924162", "9087736", - "CDX-NAHYS5V17 - 1212", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_07YR_86/100", 2453651, 2456282, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGV6", "CDX", 5, "NA HY", null, "HY", 17, 7, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.5.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924163", "9087874", - "CDX-NAHYS5V17 - 1210", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_86/100", 2453651, 2455551, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGV6", "CDX", 5, "NA HY", null, "HY", 17, 5, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.6.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924164", "9087876", - "CDX-NAHYS6V15 - 0616", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_10YR_88/100", 2453823, 2457560, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGW4", "CDX", 6, "NA HY", null, "HY", 15, 10, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.6.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924165", "9087878", - "CDX-NAHYS6V15 - 0613", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_07YR_88/100", 2453823, 2456464, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGW4", "CDX", 6, "NA HY", null, "HY", 15, 7, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.12.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924166", "9087954", - "LCDXNAS12V6 - 0612", "LCDX.NA.12", - "CDX_NA_LN_S12_100_03YR_95/100", 2454938, 2456099, 0.05, "USD", - "ACT/360", false, 0.55, 4, "5F199GCK1", "LCDX", 12, "LCDXNA", null, "IG", 6, 3, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.4.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924176", "9088285", - "CDX-NAHYHBS4V11 - 0610", "Dow Jones CDX.NA.HY.HB.4", - "CDX_NA_HY_S04_HB__SWP_21/30", 2453475, 2455368, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BWEB1", "CDX", 4, "NA HY HB", null, "HY", 11, 5, - null, 0.6998000000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.6.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924177", "9088237", - "CDX-NAHYS6V15 - 0612", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_06YR_88/100", 2453823, 2456099, 0.0345, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGW4", "CDX", 6, "NA HY", null, "HY", 15, 6, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet28() - { - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.12.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924178", "9088135", - "CDX-NAHYHBS12V7 - 0614", "CDX.NA.HY.HB.12", - "CDX_NA_HY_S12_HB__SWP_25/30", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWEH8", "CDX", 12, "NA HY HB", null, "HY", 7, 5, - null, 0.8333499999999999, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.6.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924179", "9088242", - "CDX-NAHYHBS6V11 - 0611", "Dow Jones CDX.NA.HY.HB.6", - "CDX_NA_HY_S06_HB__SWP_22/30", 2453823, 2455733, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWED7", "CDX", 6, "NA HY HB", null, "HY", 11, 5, - null, 0.73333, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.9.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924189", "9088210", - "LCDXNAS9V17 - 1209", "LCDX.NA.9", - "CDX_NA_LN_S09_100_02YR_85/100", 2454378, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCI6", "LCDX", 9, "LCDXNA", null, "IG", 17, 2, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V17 FXD.LCDXNAV17 FXD.5Y.9.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924190", "9088220", - "LCDXNAS9V17 FXD - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_FXD_85/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCI6 FXD", "LCDXNAS9V17 FXD", 9, "LCDXNAV17 FXD", null, "IG", 17, 5, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.9.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924191", "9088222", - "LCDXNAS9V17 - 1214", "LCDX.NA.9", - "CDX_NA_LN_S09_100_07YR_85/100", 2454378, 2457012, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCI6", "LCDX", 9, "LCDXNA", null, "IG", 17, 7, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.9.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924192", "9088223", - "LCDXNAS9V17 - 1210", "LCDX.NA.9", - "CDX_NA_LN_S09_100_03YR_85/100", 2454378, 2455551, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCI6", "LCDX", 9, "LCDXNA", null, "IG", 17, 3, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS10V18 FXD.LCDXNAV18 FXD.5Y.10.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924193", "9087784", - "LCDXNAS10V18 FXD - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_FXD_84/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCJ4 FXD", "LCDXNAS10V18 FXD", 10, "LCDXNAV18 FXD", null, "IG", 18, 5, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.10.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924194", "9087786", - "LCDXNAS10V18 - 0614", "LCDX.NA.10", - "CDX_NA_LN_S10_100_06YR_84/100", 2454561, 2456829, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCJ4", "LCDX", 10, "LCDXNA", null, "IG", 18, 6, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.10.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924195", "9087788", - "LCDXNAS10V18 - 0610", "LCDX.NA.10", - "CDX_NA_LN_S10_100_02YR_84/100", 2454561, 2455368, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCJ4", "LCDX", 10, "LCDXNA", null, "IG", 18, 2, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.10.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924196", "9087861", - "LCDXNAS10V18 - 0615", "LCDX.NA.10", - "CDX_NA_LN_S10_100_07YR_84/100", 2454561, 2457194, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCJ4", "LCDX", 10, "LCDXNA", null, "IG", 18, 7, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.10.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924197", "9087862", - "LCDXNAS10V18 - 0618", "LCDX.NA.10", - "CDX_NA_LN_S10_100_10YR_84/100", 2454561, 2458290, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCJ4", "LCDX", 10, "LCDXNA", null, "IG", 18, 10, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.9.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924198", "9088071", - "CDX-NAHYHBS9V11 - 1212", "CDX.NA.HY.HB.9", - "CDX_NA_HY_S09_HB__SWP_22/30", 2454372, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BWEJ4", "CDX", 9, "NA HY HB", null, "HY", 11, 5, - null, 0.73333, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.10.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924199", "9088072", - "CDX-NAHYS10V16 - 0610", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_02YR_88/100", 2454554, 2455368, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGM6", "CDX", 10, "NA HY", null, "HY", 16, 2, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.10.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924200", "9088137", - "CDX-NAHYS10V16 - 0612", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_04YR_88/100", 2454554, 2456099, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGM6", "CDX", 10, "NA HY", null, "HY", 16, 4, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.22", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924201", "9088069", - "LCDXNAS8V22 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_80/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCH8", "LCDX", 8, "LCDXNA", null, "IG", 22, 10, - null, 0.8, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V22 FXD.LCDXNAV22 FXD.5Y.8.22", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924202", "9088083", - "LCDXNAS8V22 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_80/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCH8 FXD", "LCDXNAS8V22 FXD", 8, "LCDXNAV22 FXD", null, "IG", 22, 5, - null, 0.8, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.10.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924203", "9088138", - "CDX-NAHYS10V16 - 0614", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_06YR_88/100", 2454554, 2456829, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGM6", "CDX", 10, "NA HY", null, "HY", 16, 6, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.10.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924204", "9088262", - "CDX-NAHYHBS10V13 - 0613", "CDX.NA.HY.HB.10", - "CDX_NA_HY_S10_HB__SWP_21/30", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWEF2", "CDX", 10, "NA HY HB", null, "HY", 13, 5, - null, 0.70001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.22", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924205", "9088084", - "LCDXNAS8V22 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_80/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCH8", "LCDX", 8, "LCDXNA", null, "IG", 22, 6, - null, 0.8, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.11.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924206", "9088073", - "CDX-NAHYS11V16 - 1214", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_06YR_88/100", 2454738, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGN4", "CDX", 11, "NA HY", null, "HY", 16, 6, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.22", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924207", "9088085", - "LCDXNAS8V22 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_80/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCH8", "LCDX", 8, "LCDXNA", null, "IG", 22, 7, - null, 0.8, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.22", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924208", "9088100", - "LCDXNAS8V22 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_80/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCH8", "LCDX", 8, "LCDXNA", null, "IG", 22, 4, - null, 0.8, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.22", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924209", "9088102", - "LCDXNAS8V22 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_80/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCH8", "LCDX", 8, "LCDXNA", null, "IG", 22, 3, - null, 0.8, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.9.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924210", "9088205", - "LCDXNAS9V17 - 1217", "LCDX.NA.9", - "CDX_NA_LN_S09_100_10YR_85/100", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCI6", "LCDX", 9, "LCDXNA", null, "IG", 17, 10, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.9.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924211", "9088206", - "LCDXNAS9V17 - 1211", "LCDX.NA.9", - "CDX_NA_LN_S09_100_04YR_85/100", 2454378, 2455916, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCI6", "LCDX", 9, "LCDXNA", null, "IG", 17, 4, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.9.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924213", "9088208", - "LCDXNAS9V17 - 1213", "LCDX.NA.9", - "CDX_NA_LN_S09_100_06YR_85/100", 2454378, 2456647, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCI6", "LCDX", 9, "LCDXNA", null, "IG", 17, 6, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.10.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924216", "9088103", - "LCDXNAS10V18 - 0612", "LCDX.NA.10", - "CDX_NA_LN_S10_100_04YR_84/100", 2454561, 2456099, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCJ4", "LCDX", 10, "LCDXNA", null, "IG", 18, 4, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.8.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924217", "9087790", - "CDX-NAHYS8V16 - 0613", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_06YR_88/100", 2454188, 2456464, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGP9", "CDX", 8, "NA HY", null, "HY", 16, 6, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.8.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924219", "9087793", - "CDX-NAHYS8V16 - 0611", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_04YR_88/100", 2454188, 2455733, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGP9", "CDX", 8, "NA HY", null, "HY", 16, 4, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.8.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924220", "9087863", - "CDX-NAHYHBS8V11 - 0612", "CDX.NA.HY.HB.8", - "CDX_NA_HY_S08_HB__SWP_22/30", 2454188, 2456099, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BWEI6", "CDX", 8, "NA HY HB", null, "HY", 11, 5, - null, 0.73333, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.11.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924221", "9088076", - "CDX-NAHYS11V16 - 1212", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_04YR_88/100", 2454738, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGN4", "CDX", 11, "NA HY", null, "HY", 16, 4, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.9.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924222", "9087864", - "CDX-NAHYS9V17 - 1211", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_04YR_ 87/100", 2454372, 2455916, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGQ7", "CDX", 9, "NA HY", null, "HY", 17, 4, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.11.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924223", "9088077", - "CDX-NAHYS11V16 - 1210", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_02YR_88/100", 2454738, 2455551, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGN4", "CDX", 11, "NA HY", null, "HY", 16, 2, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.11.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924224", "9088078", - "CDX-NAHYS11V16 - 1209", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_01YR_88/100", 2454738, 2455186, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGN4", "CDX", 11, "NA HY", null, "HY", 16, 1, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.9.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924225", "9087865", - "CDX-NAHYS9V17 - 1213", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_06YR_ 87/100", 2454372, 2456647, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGQ7", "CDX", 9, "NA HY", null, "HY", 17, 6, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.9.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924226", "9087866", - "CDX-NAHYS9V17 - 1209", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_02YR_ 87/100", 2454372, 2455186, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGQ7", "CDX", 9, "NA HY", null, "HY", 17, 2, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.11.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924227", "9088067", - "CDX-NAHYHBS11V14 - 1213", "CDX.NA.HY.HB.11", - "CDX_NA_HY_S11_HB__SWP_20/30", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWEG0", "CDX", 11, "NA HY HB", null, "HY", 14, 5, - null, 0.66668, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.12.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924228", "9088130", - "CDX-NAHYS12V7 - 0611", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_02YR_95/100", 2454911, 2455733, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGO2", "CDX", 12, "NA HY", null, "HY", 7, 2, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.12.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924229", "9088131", - "CDX-NAHYS12V7 - 0610", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_01YR_95/100", 2454911, 2455368, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGO2", "CDX", 12, "NA HY", null, "HY", 7, 1, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.12.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924230", "9088132", - "CDX-NAHYS12V7 - 0615", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_06YR_95/100", 2454911, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGO2", "CDX", 12, "NA HY", null, "HY", 7, 6, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.12.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924231", "9088133", - "CDX-NAHYS12V7 - 0613", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_04YR_95/100", 2454911, 2456464, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGO2", "CDX", 12, "NA HY", null, "HY", 7, 4, - null, 0.9500000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.12.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924233", "9088104", - "LCDXNAS12V6 - 0610", "LCDX.NA.12", - "CDX_NA_LN_S12_100_01YR_95/100", 2454938, 2455368, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCK1", "LCDX", 12, "LCDXNA", null, "IG", 6, 1, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS12V6 FXD.LCDXNAV6 FXD.5Y.12.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924234", "9088108", - "LCDXNAS12V6 FXD - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_FXD_95/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCK1 FXD", "LCDXNAS12V6 FXD", 12, "LCDXNAV6 FXD", null, "IG", 6, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.12.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924235", "9088115", - "LCDXNAS12V6 - 0619", "LCDX.NA.12", - "CDX_NA_LN_S12_100_10YR_95/100", 2454938, 2458655, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCK1", "LCDX", 12, "LCDXNA", null, "IG", 6, 10, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.12.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924236", "9088116", - "LCDXNAS12V6 - 0613", "LCDX.NA.12", - "CDX_NA_LN_S12_100_04YR_95/100", 2454938, 2456464, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCK1", "LCDX", 12, "LCDXNA", null, "IG", 6, 4, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.12.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924237", "9088111", - "LCDXNAS12V6 - 0611", "LCDX.NA.12", - "CDX_NA_LN_S12_100_02YR_95/100", 2454938, 2455733, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCK1", "LCDX", 12, "LCDXNA", null, "IG", 6, 2, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.12.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924238", "9088118", - "LCDXNAS12V6 - 0615", "LCDX.NA.12", - "CDX_NA_LN_S12_100_06YR_95/100", 2454938, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCK1", "LCDX", 12, "LCDXNA", null, "IG", 6, 6, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.12.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924239", "9088113", - "LCDXNAS12V6 - 0616", "LCDX.NA.12", - "CDX_NA_LN_S12_100_07YR_95/100", 2454938, 2457560, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCK1", "LCDX", 12, "LCDXNA", null, "IG", 6, 7, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.2.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924240", "9088279", - "CDX-NAHYBS2V7 - 0909", "Dow Jones CDX.NA.HY.B.2", - "DJIBOXX_NA_HY_S02_B___SWP_35/43", 2453088, 2455095, 0.048, "USD", - "ACT/360", false, 0.3, 4, "2I65BSEB0", "CDX", 2, "NA HY B", null, "HY", 7, 5, - null, 0.81395, 43, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.3.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924241", "9088280", - "CDX-NAHYS3V15 - 1214", "Dow Jones CDX.NA.HY.3", - "CDX_NA_HY_S03_100_SWP_10YR_87/100", 2453196, 2457012, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGT1", "CDX", 3, "NA HY", null, "HY", 15, 10, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.3.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924242", "9088068", - "CDX-NAHYHBS3V8 - 1209", "Dow Jones CDX.NA.HY.HB.3", - "CDX_NA_HY_S03_HB__SWP_23/30", 2453196, 2455186, 0.0625, "USD", - "ACT/360", false, 0.3, 4, "2I65BWEA3", "CDX", 3, "NA HY HB", null, "HY", 8, 5, - null, 0.7665000000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.5.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924243", "9088233", - "CDX-NAHYHBS5V13 - 1210", "Dow Jones CDX.NA.HY.HB.5", - "CDX_NA_HY_S05_HB__SWP_20/30", 2453651, 2455551, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWEC9", "CDX", 5, "NA HY HB", null, "HY", 13, 5, - null, 0.6665000000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.6.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924244", "9088236", - "CDX-NAHYS6V15 - 0610", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_04YR_88/100", 2453823, 2455368, 0.0345, "USD", - "ACT/360", false, 0.4, 4, "2I65BRGW4", "CDX", 6, "NA HY", null, "HY", 15, 4, - null, 0.88, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.7.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924245", "9088249", - "CDX-NAHYHBS7V11 - 1211", "Dow Jones CDX.NA.HY.HB.7", - "CDX_NA_HY_S07_HB__SWP_22/30", 2454007, 2455916, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWEE5", "CDX", 7, "NA HY HB", null, "HY", 11, 5, - null, 0.73334, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924258", "9093482", - "CDX-NAIGHVOLS4V2 - 0610", "DOW JONES CDX.NA.IG.HVOL.4", - "DJCDX_NA_IG_S4_HVOL_05Y_6/10_29/30", 2453451, 2455368, 0.009000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BF9", "CDX", 4, "NA IG HVOL", null, "HV", 2, 5, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.10Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924259", "9093484", - "CDX-NAIGHVOLS4V2 - 0615", "Dow Jones CDX.NA.IG.HVOL.4", - "DJCDX_NA_IG_S4_HVOL_10Y_6/15_29/30", 2453451, 2457194, 0.0115, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BF9", "CDX", 4, "NA IG HVOL", null, "HV", 2, 10, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.4.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924260", "9093486", - "CDX-NAIGS4V5 - 0610", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_05Y_6/10_121/126", 2453451, 2455368, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBW4", "CDX", 4, "NA IG", null, "IG", 5, 5, - null, 0.9640000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.4.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924261", "9093488", - "CDX-NAIGS4V5 - 0615", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_10Y_6/15_121/126", 2453451, 2457194, 0.006500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBW4", "CDX", 4, "NA IG", null, "IG", 5, 10, - null, 0.9640000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.11.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924262", "9093451", - "CDX-NAHYS11V17 - 1218", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_10YR_87/100", 2454738, 2458473, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHF0", "CDX", 11, "NA HY", null, "HY", 17, 10, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.4.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924263", "9093489", - "CDX-NAIGS4V5 - 0612", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_07Y_6/12_121/126", 2453451, 2456099, 0.0055000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBW4", "CDX", 4, "NA IG", null, "IG", 5, 7, - null, 0.9640000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.5Y.5.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924264", "9093491", - "CDX-NAXOS5V5 - 1210", "Dow Jones CDX.NA.XO.5", - "DJCDX_NA_XO_S5_05Y_12/10_31/35", 2453635, 2455551, 0.02, "USD", - "ACT/360", false, 0.4, 4, "1D764IAX5", "CDX", 5, "NAXO", null, "XO", 5, 5, - null, 0.88571, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.5.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924265", "9093480", - "CDX-NAHYBBS5V6 - 1210", "Dow Jones CDX.NA.HY.BB.5", - "CDX_NA_HY_S05_BB__SWP_36/41", 2453651, 2455551, 0.025, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BVBS9", "CDX", 5, "NA HY BB", null, "HY", 6, 5, - null, 0.87804, 41, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.12.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924266", "9093458", - "CDX-NAHYS12V8 - 0614", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_94/100", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHG8", "CDX", 12, "NA HY", null, "HY", 8, 5, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.12.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924267", "9093459", - "CDX-NAHYS12V8 - 0616", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_07YR_94/100", 2454911, 2457560, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHG8", "CDX", 12, "NA HY", null, "HY", 8, 7, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.12.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924269", "9093460", - "CDX-NAHYS12V8 - 0619", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_10YR_94/100", 2454911, 2458655, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHG8", "CDX", 12, "NA HY", null, "HY", 8, 10, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.9.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924270", "9093541", - "CDX-NAHYS9V18 - 1217", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_10YR_86/100", 2454372, 2458108, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHD5", "CDX", 9, "NA HY", null, "HY", 18, 10, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.12.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924271", "9093461", - "CDX-NAHYS12V8 - 0612", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_03YR_94/100", 2454911, 2456099, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHG8", "CDX", 12, "NA HY", null, "HY", 8, 3, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.9.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924273", "9093542", - "CDX-NAHYS9V18 - 1212", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_86/100", 2454372, 2456282, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHD5", "CDX", 9, "NA HY", null, "HY", 18, 5, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.6.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924275", "9093508", - "CDX-NAHYS6V16 - 0611", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_87/100", 2453823, 2455733, 0.0345, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRHA1", "CDX", 6, "NA HY", null, "HY", 16, 5, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.6.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924276", "9093509", - "CDX-NAHYS6V16 - 0616", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_10YR_87/100", 2453823, 2457560, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHA1", "CDX", 6, "NA HY", null, "HY", 16, 10, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924277", "9093547", - "LCDXNAS9V18 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_84/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.55, 4, "5F199GCM7", "LCDX", 9, "LCDXNA", null, "IG", 18, 5, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.6.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924278", "9093510", - "CDX-NAHYS6V16 - 0613", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_07YR_87/100", 2453823, 2456464, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHA1", "CDX", 6, "NA HY", null, "HY", 16, 7, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.12.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924279", "9093467", - "LCDXNAS12V7 - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_94/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.55, 4, "5F199GCO3", "LCDX", 12, "LCDXNA", null, "IG", 7, 5, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.7.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924280", "9093515", - "CDX-NAHYBS7V7 - 1211", "Dow Jones CDX.NA.HY.B.7", - "CDX_NA_HY_S07_B___SWP_44/50", 2454007, 2455916, 0.030000000000000002, "USD", - "ACT/360", false, 0.3, 4, "2I65BSEF1", "CDX", 7, "NA HY B", null, "HY", 7, 5, - null, 0.88, 50, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.10.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924281", "9093432", - "CDX-NAHYS10V17 - 0613", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_87/100", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHE3", "CDX", 10, "NA HY", null, "HY", 17, 5, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.10.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924282", "9093556", - "CDX-NAHYBS10V8 - 0613", "CDX.NA.HY.B.10", - "CDX_NA_HY_S10_B___SWP_38/45", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSEI5", "CDX", 10, "NA HY B", null, "HY", 8, 5, - null, 0.8444499999999999, 45, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.7.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924283", "9093516", - "CDX-NAHYS7V16 - 1213", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_07YR_87/100", 2454007, 2456647, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHB9", "CDX", 7, "NA HY", null, "HY", 16, 7, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.10.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924284", "9093557", - "CDX-NAHYS10V17 - 0615", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_07YR_87/100", 2454554, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHE3", "CDX", 10, "NA HY", null, "HY", 17, 7, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.7.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924286", "9093517", - "CDX-NAHYS7V16 - 1209", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_03YR_87/100", 2454007, 2455186, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHB9", "CDX", 7, "NA HY", null, "HY", 16, 3, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924287", "9093437", - "LCDXNAS10V19 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_83/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.55, 4, "5F199GCN5", "LCDX", 10, "LCDXNA", null, "IG", 19, 5, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.10.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924288", "9093558", - "CDX-NAHYS10V17 - 0611", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_03YR_87/100", 2454554, 2455733, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRHE3", "CDX", 10, "NA HY", null, "HY", 17, 3, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.7.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924289", "9093518", - "CDX-NAHYS7V16 - 1216", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_10YR_87/100", 2454007, 2457743, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHB9", "CDX", 7, "NA HY", null, "HY", 16, 10, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.8.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924290", "9093523", - "CDX-NAHYS8V17 - 0612", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_87/100", 2454188, 2456099, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHC7", "CDX", 8, "NA HY", null, "HY", 17, 5, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.10.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924291", "9093431", - "CDX-NAHYS10V17 - 0618", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_10YR_87/100", 2454554, 2458290, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHE3", "CDX", 10, "NA HY", null, "HY", 17, 10, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.5.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924292", "9093495", - "CDX-NAHYS5V18 - 1215", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_10YR_85/100", 2453651, 2457377, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGZ7", "CDX", 5, "NA HY", null, "HY", 18, 10, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.10.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924293", "9093438", - "LCDXNAS10V19 - 0611", "LCDX.NA.10", - "CDX_NA_LN_S10_100_03YR_83/100", 2454561, 2455733, 0.0275, "USD", - "ACT/360", false, 0.55, 4, "5F199GCN5", "LCDX", 10, "LCDXNA", null, "IG", 19, 3, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.5.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924294", "9093496", - "CDX-NAHYS5V18 - 1212", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_07YR_85/100", 2453651, 2456282, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGZ7", "CDX", 5, "NA HY", null, "HY", 18, 7, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.7.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924295", "9093519", - "CDX-NAHYS7V16 - 1211", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_87/100", 2454007, 2455916, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHB9", "CDX", 7, "NA HY", null, "HY", 16, 5, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.11.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924296", "9093447", - "CDX-NAHYBS11V6 - 1213", "CDX.NA.HY.B.11", - "CDX_NA_HY_S11_B___SWP_31/36", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSEJ3", "CDX", 11, "NA HY B", null, "HY", 6, 5, - null, 0.8611300000000001, 36, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.5.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924297", "9093497", - "CDX-NAHYS5V18 - 1210", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_85/100", 2453651, 2455551, 0.0395, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRGZ7", "CDX", 5, "NA HY", null, "HY", 18, 5, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.12.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924298", "9093468", - "LCDXNAS12V7 - 0612", "LCDX.NA.12", - "CDX_NA_LN_S12_100_03YR_94/100", 2454938, 2456099, 0.05, "USD", - "ACT/360", false, 0.55, 4, "5F199GCO3", "LCDX", 12, "LCDXNA", null, "IG", 7, 3, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.5Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924299", "9093502", - "CDX-NAXOS6V3 - 0611", "Dow Jones CDX.NA.XO.6", - "DJCDX_NA_XO_S6_05YR_6/11_33/35", 2453816, 2455733, 0.019, "USD", - "ACT/360", false, 0.4, 4, "1D764IAY3", "CDX", 6, "NA XO", null, "XO", 3, 5, - null, 0.94286, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.11.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924300", "9093448", - "CDX-NAHYS11V17 - 1213", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_87/100", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHF0", "CDX", 11, "NA HY", null, "HY", 17, 5, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924302", "9093507", - "CDX-NAHYBBS6V3 - 0611", "Dow Jones CDX.NA.HY.BB.6", - "CDX_NA_HY_S06_BB__SWP_36/38", 2453823, 2455733, 0.021, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BVBT7", "CDX", 6, "NA HY BB", null, "HY", 3, 5, - null, 0.9473699999999999, 38, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.8.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924303", "9093521", - "CDX-NAHYBS8V9 - 0612", "CDX.NA.HY.B.8", - "CDX_NA_HY_S08_B___SWP_41/49", 2454188, 2456099, 0.025, "USD", - "ACT/360", false, 0.3, 4, "2I65BSEG9", "CDX", 8, "NA HY B", null, "HY", 9, 5, - null, 0.8367300000000001, 49, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.8.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924304", "9093524", - "CDX-NAHYS8V17 - 0610", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_03YR_87/100", 2454188, 2455368, 0.0275, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRHC7", "CDX", 8, "NA HY", null, "HY", 17, 3, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.8.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924305", "9093522", - "CDX-NAHYS8V17 - 0614", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_07YR_87/100", 2454188, 2456829, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHC7", "CDX", 8, "NA HY", null, "HY", 17, 7, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.8.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924306", "9093525", - "CDX-NAHYS8V17 - 0617", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_10YR_87/100", 2454188, 2457925, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHC7", "CDX", 8, "NA HY", null, "HY", 17, 10, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924307", "9093529", - "LCDXNAS8V23 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_79/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.55, 4, "5F199GCL9", "LCDX", 8, "LCDXNA", null, "IG", 23, 5, - null, 0.79, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.9.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924308", "9093538", - "CDX-NAHYBS9V10 - 1212", "CDX.NA.HY.B.9", - "CDX_NA_HY_S09_B___SWP_37/46", 2454372, 2456282, 0.035, "USD", - "ACT/360", false, 0.3, 4, "2I65BSEH7", "CDX", 9, "NA HY B", null, "HY", 10, 5, - null, 0.80435, 46, 0, "NYC", false, false, false, null, "DJCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet29() - { - UpdateCDXRefDataMap ("CDX.NA HY.3Y.11.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924309", "9093449", - "CDX-NAHYS11V17 - 1211", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_03YR_87/100", 2454738, 2455916, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHF0", "CDX", 11, "NA HY", null, "HY", 17, 3, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.9.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924310", "9093539", - "CDX-NAHYS9V18 - 1210", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_03YR_86/100", 2454372, 2455551, 0.0375, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRHD5", "CDX", 9, "NA HY", null, "HY", 18, 3, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.9.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924311", "9093540", - "CDX-NAHYS9V18 - 1214", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_07YR_86/100", 2454372, 2457012, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHD5", "CDX", 9, "NA HY", null, "HY", 18, 7, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.11.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924312", "9093450", - "CDX-NAHYS11V17 - 1215", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_07YR_87/100", 2454738, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHF0", "CDX", 11, "NA HY", null, "HY", 17, 7, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.10.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924324", "9093442", - "LCDXNAS10V19 - 0615", "LCDX.NA.10", - "CDX_NA_LN_S10_100_07YR_83/100", 2454561, 2457194, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCN5", "LCDX", 10, "LCDXNA", null, "IG", 19, 7, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.10.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924331", "9093443", - "LCDXNAS10V19 - 0618", "LCDX.NA.10", - "CDX_NA_LN_S10_100_10YR_83/100", 2454561, 2458290, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCN5", "LCDX", 10, "LCDXNA", null, "IG", 19, 10, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.10.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924332", "9093444", - "LCDXNAS10V19 - 0612", "LCDX.NA.10", - "CDX_NA_LN_S10_100_04YR_83/100", 2454561, 2456099, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCN5", "LCDX", 10, "LCDXNA", null, "IG", 19, 4, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.7.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924334", "9093514", - "CDX-NAHYHBS7V12 - 1211", "Dow Jones CDX.NA.HY.HB.7", - "CDX_NA_HY_S07_HB__SWP_21/30", 2454007, 2455917, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWEM7", "CDX", 7, "NA HY HB", null, "HY", 12, 5, - null, 0.70001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.11.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924335", "9093446", - "CDX-NAHYHBS11V15 - 1213", "CDX.NA.HY.HB.11", - "CDX_NA_HY_S11_HB__SWP_19/30", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWEP0", "CDX", 11, "NA HY HB", null, "HY", 15, 5, - null, 0.63335, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.11.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924338", "9093452", - "CDX-NAHYS11V17 - 1212", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_04YR_87/100", 2454738, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHF0", "CDX", 11, "NA HY", null, "HY", 17, 4, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.11.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924339", "9093453", - "CDX-NAHYS11V17 - 1210", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_02YR_87/100", 2454738, 2455551, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHF0", "CDX", 11, "NA HY", null, "HY", 17, 2, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.11.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924340", "9093454", - "CDX-NAHYS11V17 - 1209", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_01YR_87/100", 2454738, 2455186, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHF0", "CDX", 11, "NA HY", null, "HY", 17, 1, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.11.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924341", "9093455", - "CDX-NAHYS11V17 - 1214", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_06YR_87/100", 2454738, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHF0", "CDX", 11, "NA HY", null, "HY", 17, 6, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.8.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924342", "9093594", - "CDX-NAHYHBS8V12 - 0612", "CDX.NA.HY.HB.8", - "CDX_NA_HY_S08_HB__SWP_21/30", 2454188, 2456099, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BWEN5", "CDX", 8, "NA HY HB", null, "HY", 12, 5, - null, 0.7000000000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.8.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924343", "9093526", - "CDX-NAHYS8V17 - 0613", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_06YR_87/100", 2454188, 2456464, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHC7", "CDX", 8, "NA HY", null, "HY", 17, 6, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.8.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924344", "9093527", - "CDX-NAHYS8V17 - 0611", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_04YR_87/100", 2454188, 2455733, 0.0275, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHC7", "CDX", 8, "NA HY", null, "HY", 17, 4, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924345", "9093530", - "LCDXNAS8V23 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_79/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCL9", "LCDX", 8, "LCDXNA", null, "IG", 23, 10, - null, 0.79, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V23 FXD.LCDXNAV23 FXD.5Y.8.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924346", "9093531", - "LCDXNAS8V23 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_79/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCL9 FXD", "LCDXNAS8V23 FXD", 8, "LCDXNAV23 FXD", null, "IG", 23, 5, - null, 0.79, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924347", "9093532", - "LCDXNAS8V23 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_79/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCL9", "LCDX", 8, "LCDXNA", null, "IG", 23, 6, - null, 0.79, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924348", "9093533", - "LCDXNAS8V23 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_79/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCL9", "LCDX", 8, "LCDXNA", null, "IG", 23, 7, - null, 0.79, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924349", "9093534", - "LCDXNAS8V23 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_79/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCL9", "LCDX", 8, "LCDXNA", null, "IG", 23, 4, - null, 0.79, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924352", "9093535", - "LCDXNAS8V23 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_79/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCL9", "LCDX", 8, "LCDXNA", null, "IG", 23, 3, - null, 0.79, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.9.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924353", "9093537", - "CDX-NAHYHBS9V12 - 1212", "CDX.NA.HY.HB.9", - "CDX_NA_HY_S09_HB__SWP_21/30", 2454372, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BWEO3", "CDX", 9, "NA HY HB", null, "HY", 12, 5, - null, 0.7000000000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.9.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924354", "9093543", - "CDX-NAHYS9V18 - 1211", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_04YR_86/100", 2454372, 2455916, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHD5", "CDX", 9, "NA HY", null, "HY", 18, 4, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.9.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924355", "9093544", - "CDX-NAHYS9V18 - 1213", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_06YR_86/100", 2454372, 2456647, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHD5", "CDX", 9, "NA HY", null, "HY", 18, 6, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.9.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924356", "9093545", - "CDX-NAHYS9V18 - 1209", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_02YR_86/100", 2454372, 2455186, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHD5", "CDX", 9, "NA HY", null, "HY", 18, 2, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.12.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924357", "9093462", - "CDX-NAHYS12V8 - 0611", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_02YR_94/100", 2454911, 2455733, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHG8", "CDX", 12, "NA HY", null, "HY", 8, 2, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.9.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924358", "9093548", - "LCDXNAS9V18 - 1209", "LCDX.NA.9", - "CDX_NA_LN_S09_100_02YR_84/100", 2454378, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCM7", "LCDX", 9, "LCDXNA", null, "IG", 18, 2, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V18 FXD.LCDXNAV18 FXD.5Y.9.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924359", "9093549", - "LCDXNAS9V18 FXD - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_FXD_84/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCM7 FXD", "LCDXNAS9V18 FXD", 9, "LCDXNAV18 FXD", null, "IG", 18, 5, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.9.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924360", "9093550", - "LCDXNAS9V18 - 1214", "LCDX.NA.9", - "CDX_NA_LN_S09_100_07YR_84/100", 2454378, 2457012, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCM7", "LCDX", 9, "LCDXNA", null, "IG", 18, 7, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.9.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924361", "9093551", - "LCDXNAS9V18 - 1210", "LCDX.NA.9", - "CDX_NA_LN_S09_100_03YR_84/100", 2454378, 2455551, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCM7", "LCDX", 9, "LCDXNA", null, "IG", 18, 3, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.12.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924362", "9093463", - "CDX-NAHYS12V8 - 0610", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_01YR_94/100", 2454911, 2455368, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHG8", "CDX", 12, "NA HY", null, "HY", 8, 1, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.12.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924363", "9093457", - "CDX-NAHYHBS12V8 - 0614", "CDX.NA.HY.HB.12", - "CDX_NA_HY_S12_HB__SWP_24/30", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWEQ8", "CDX", 12, "NA HY HB", null, "HY", 8, 5, - null, 0.80002, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.12.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924365", "9093464", - "CDX-NAHYS12V8 - 0615", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_06YR_94/100", 2454911, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHG8", "CDX", 12, "NA HY", null, "HY", 8, 6, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.12.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924366", "9093465", - "CDX-NAHYS12V8 - 0613", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_04YR_94/100", 2454911, 2456464, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHG8", "CDX", 12, "NA HY", null, "HY", 8, 4, - null, 0.9400000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.10Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924367", "9093499", - "CDX-NAXOS6V2 - 0616", "Dow Jones CDX.NA.XO.6", - "DJCDX_NA_XO_S6_10YR_6/16_34/35", 2453816, 2457560, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "1D764IAG2", "CDX", 6, "NAXO", null, "XO", 2, 10, - null, 0.97143, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.12.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924368", "9093469", - "LCDXNAS12V7 - 0610", "LCDX.NA.12", - "CDX_NA_LN_S12_100_01YR_94/100", 2454938, 2455368, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCO3", "LCDX", 12, "LCDXNA", null, "IG", 7, 1, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NAXO.7Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924369", "9093500", - "CDX-NAXOS6V2 - 0613", "Dow Jones CDX.NA.XO.6", - "DJCDX_NA_XO_S6_07YR_6/13_34/35", 2453816, 2456464, 0.0205, "USD", - "ACT/360", false, 0.4, 4, "1D764IAG2", "CDX", 6, "NAXO", null, "XO", 2, 7, - null, 0.97143, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDXNAS12V7 FXD.LCDXNAV7 FXD.5Y.12.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924370", "9093470", - "LCDXNAS12V7 FXD - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_FXD_94/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCO3 FXD", "LCDXNAS12V7 FXD", 12, "LCDXNAV7 FXD", null, "IG", 7, 5, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.12.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924371", "9093471", - "LCDXNAS12V7 - 0611", "LCDX.NA.12", - "CDX_NA_LN_S12_100_02YR_94/100", 2454938, 2455733, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCO3", "LCDX", 12, "LCDXNA", null, "IG", 7, 2, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.9.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924372", "9093552", - "LCDXNAS9V18 - 1217", "LCDX.NA.9", - "CDX_NA_LN_S09_100_10YR_84/100", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCM7", "LCDX", 9, "LCDXNA", null, "IG", 18, 10, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.12.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924373", "9093472", - "LCDXNAS12V7 - 0616", "LCDX.NA.12", - "CDX_NA_LN_S12_100_07YR_94/100", 2454938, 2457560, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCO3", "LCDX", 12, "LCDXNA", null, "IG", 7, 7, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.10Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924374", "9093503", - "CDX-NAXOS6V3 - 0616", "Dow Jones CDX.NA.XO.6", - "DJCDX_NA_XO_S6_10YR_6/16_33/35", 2453816, 2457560, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "1D764IAY3", "CDX", 6, "NA XO", null, "XO", 3, 10, - null, 0.94286, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.12.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924375", "9093473", - "LCDXNAS12V7 - 0619", "LCDX.NA.12", - "CDX_NA_LN_S12_100_10YR_94/100", 2454938, 2458655, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCO3", "LCDX", 12, "LCDXNA", null, "IG", 7, 10, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.9.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924376", "9093553", - "LCDXNAS9V18 - 1211", "LCDX.NA.9", - "CDX_NA_LN_S09_100_04YR_84/100", 2454378, 2455916, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCM7", "LCDX", 9, "LCDXNA", null, "IG", 18, 4, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.9.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924377", "9093554", - "LCDXNAS9V18 - 1213", "LCDX.NA.9", - "CDX_NA_LN_S09_100_06YR_84/100", 2454378, 2456647, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCM7", "LCDX", 9, "LCDXNA", null, "IG", 18, 6, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.7Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924378", "9093504", - "CDX-NAXOS6V3 - 0613", "Dow Jones CDX.NA.XO.6", - "DJCDX_NA_XO_S6_07YR_6/13_33/35", 2453816, 2456464, 0.0205, "USD", - "ACT/360", false, 0.4, 4, "1D764IAY3", "CDX", 6, "NA XO", null, "XO", 3, 7, - null, 0.94286, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.6.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924379", "9093506", - "CDX-NAHYHBS6V12 - 0611", "Dow Jones CDX.NA.HY.HB.6", - "CDX_NA_HY_S06_HB__SWP_21/30", 2453823, 2455733, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BWEL9", "CDX", 6, "NA HY HB", null, "HY", 12, 5, - null, 0.7000000000000001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.6.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924380", "9093511", - "CDX-NAHYS6V16 - 0612", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_06YR_87/100", 2453823, 2456099, 0.0345, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHA1", "CDX", 6, "NA HY", null, "HY", 16, 6, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.10.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924381", "9093433", - "CDX-NAHYS10V17 - 0610", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_02YR_87/100", 2454554, 2455368, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHE3", "CDX", 10, "NA HY", null, "HY", 17, 2, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.10.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924382", "9093434", - "CDX-NAHYS10V17 - 0612", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_04YR_87/100", 2454554, 2456099, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHE3", "CDX", 10, "NA HY", null, "HY", 17, 4, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.10.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924383", "9093435", - "CDX-NAHYS10V17 - 0614", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_06YR_87/100", 2454554, 2456829, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHE3", "CDX", 10, "NA HY", null, "HY", 17, 6, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.6.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924384", "9093512", - "CDX-NAHYS6V16 - 0610", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_04YR_87/100", 2453823, 2455368, 0.0345, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHA1", "CDX", 6, "NA HY", null, "HY", 16, 4, - null, 0.87, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG INDU.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924385", "9093481", - "CDX-NAIGINDUS4V2 - 0610", "Dow Jones CDX.NA.IG.INDU.4", - "DJCDX_NA_IG_S4_INDU_05Y_6/10_29/30", 2453451, 2455368, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65B4AS0", "CDX", 4, "NA IG INDU", null, "IG", 2, 5, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDXNAS10V19 FXD.LCDXNAV19 FXD.5Y.10.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924386", "9093439", - "LCDXNAS10V19 FXD - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_FXD_83/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCN5 FXD", "LCDXNAS10V19 FXD", 10, "LCDXNAV19 FXD", null, "IG", 19, 5, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.7Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924387", "9093483", - "CDX-NAIGHVOLS4V2 - 0612", "Dow Jones CDX.NA.IG.HVOL.4", - "DJCDX_NA_IG_S4_HVOL_07Y_6/12_29/30", 2453451, 2456099, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BF9", "CDX", 4, "NA IG HVOL", null, "HV", 2, 7, - null, 0.96667, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.10.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924388", "9093440", - "LCDXNAS10V19 - 0614", "LCDX.NA.10", - "CDX_NA_LN_S10_100_06YR_83/100", 2454561, 2456829, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCN5", "LCDX", 10, "LCDXNA", null, "IG", 19, 6, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V5 EUR.5Y.4.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924389", "9093487", - "CDX-NAIGS4V5 EUR - 0610", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_05Y_6/10_EUR_121/126", 2453451, 2455368, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYBW4 EUR", "CDX", 4, "NA IG V5 EUR", null, "IG", 5, 5, - null, 0.9640000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.10.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924390", "9093441", - "LCDXNAS10V19 - 0610", "LCDX.NA.10", - "CDX_NA_LN_S10_100_02YR_83/100", 2454561, 2455368, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCN5", "LCDX", 10, "LCDXNA", null, "IG", 19, 2, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.7Y.5.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924391", "9093492", - "CDX-NAXOS5V5 - 1212", "Dow Jones CDX.NA.XO.5", - "DJCDX_NA_XO_S5_07YR_12/12_31/35", 2453635, 2456282, 0.02, "USD", - "ACT/360", false, 0.4, 4, "1D764IAX5", "CDX", 5, "NA XO", null, "XO", 5, 7, - null, 0.88571, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.10Y.5.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924392", "9093493", - "CDX-NAXOS5V5 - 1215", "Dow Jones CDX.NA.XO.5", - "DJCDX_NA_XO_S5_10YR_12/15_31/35", 2453635, 2457377, 0.024, "USD", - "ACT/360", false, 0.4, 4, "1D764IAX5", "CDX", 5, "NA XO", null, "XO", 5, 10, - null, 0.88571, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.5.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924393", "9093479", - "CDX-NAHYHBS5V14 - 1210", "Dow Jones CDX.NA.HY.HB.5", - "CDX_NA_HY_S05_HB__SWP_19/30", 2453651, 2455551, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BWEK1", "CDX", 5, "NA HY HB", null, "HY", 14, 5, - null, 0.6332, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.12.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924394", "9093474", - "LCDXNAS12V7 - 0613", "LCDX.NA.12", - "CDX_NA_LN_S12_100_04YR_94/100", 2454938, 2456464, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCO3", "LCDX", 12, "LCDXNA", null, "IG", 7, 4, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.12.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924395", "9093475", - "LCDXNAS12V7 - 0615", "LCDX.NA.12", - "CDX_NA_LN_S12_100_06YR_94/100", 2454938, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCO3", "LCDX", 12, "LCDXNA", null, "IG", 7, 6, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924396", "9094605", - "USD ITRAXX-XOVERS8V3 - 1212", "iTraxx Europe Crossover series 8 Version 3", - "ITRAXX-XOVERS8V3-1212 USD SEN MMR I03 CDS MATURED", 2454364, 2456282, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I667KAT5", "USD ITRAXX", 8, "XOVER", "XVR", "XO", 3, 5, - null, 0.96, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.12.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924407", "9141416", - "LCDXNAS12V8 - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_93/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.55, 4, "5F199GCP0", "LCDX", 12, "LCDXNA", null, "IG", 8, 5, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.12.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924408", "9141412", - "LCDXNAS12V8 - 0612", "LCDX.NA.12", - "CDX_NA_LN_S12_100_03YR_93/100", 2454938, 2456099, 0.05, "USD", - "ACT/360", false, 0.55, 4, "5F199GCP0", "LCDX", 12, "LCDXNA", null, "IG", 8, 3, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.12.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924410", "9142977", - "LCDXNAS12V8 - 0610", "LCDX.NA.12", - "CDX_NA_LN_S12_100_01YR_93/100", 2454938, 2455368, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCP0", "LCDX", 12, "LCDXNA", null, "IG", 8, 1, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS12V8 FXD.LCDXNAV8 FXD.5Y.12.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924411", "9142978", - "LCDXNAS12V8 FXD - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_FXD_93/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCP0 FXD", "LCDXNAS12V8 FXD", 12, "LCDXNAV8 FXD", null, "IG", 8, 5, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.12.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924412", "9142979", - "LCDXNAS12V8 - 0611", "LCDX.NA.12", - "CDX_NA_LN_S12_100_02YR_93/100", 2454938, 2455733, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCP0", "LCDX", 12, "LCDXNA", null, "IG", 8, 2, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.12.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924413", "9143013", - "LCDXNAS12V8 - 0616", "LCDX.NA.12", - "CDX_NA_LN_S12_100_07YR_93/100", 2454938, 2457560, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCP0", "LCDX", 12, "LCDXNA", null, "IG", 8, 7, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.12.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924414", "9143017", - "LCDXNAS12V8 - 0619", "LCDX.NA.12", - "CDX_NA_LN_S12_100_10YR_93/100", 2454938, 2458655, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCP0", "LCDX", 12, "LCDXNA", null, "IG", 8, 10, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.12.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924415", "9143009", - "LCDXNAS12V8 - 0613", "LCDX.NA.12", - "CDX_NA_LN_S12_100_04YR_93/100", 2454938, 2456464, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCP0", "LCDX", 12, "LCDXNA", null, "IG", 8, 4, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.12.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924417", "9143011", - "LCDXNAS12V8 - 0615", "LCDX.NA.12", - "CDX_NA_LN_S12_100_06YR_93/100", 2454938, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCP0", "LCDX", 12, "LCDXNA", null, "IG", 8, 6, - null, 0.93, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("MCDX SERIES13 3YR.MCDX SERIE 3YR.3Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924473", "9149987", - "MCDX SERIES13 3YR - 1212", "MCDX.NA.13", - "MCDX SERIES 13 3Y", 2455110, 2456282, 0.01, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAD9", "MCDX SERIES13 3YR", 13, "MCDX SERIE 3YR", null, "IG", 1, 3, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("MCDX SERIES13 5YR.MCDX SERIE 5YR.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924474", "9149990", - "MCDX SERIES13 5YR - 1214", "MCDX.NA.13", - "MCDX SERIES 13 5Y", 2455110, 2457012, 0.01, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAD9", "MCDX SERIES13 5YR", 13, "MCDX SERIE 5YR", null, "IG", 1, 5, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("MCDX SERIES13 10YR.MCDX SERIE 10YR.10Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924475", "9149995", - "MCDX SERIES13 10YR - 1219", "MCDX.NA.13", - "MCDX SERIES 13 10Y", 2455110, 2458838, 0.01, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAD9", "MCDX SERIES13 10YR", 13, "MCDX SERIE 10YR", null, "IG", 1, 10, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ IG.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924476", "9149662", - "ITRAXX-ASIAXJIGS12V1 - 1214", "iTraxx Asia ex-Japan IG Series Number 12 Version 1", - "ITRAXX ASIA EX-JAPAN IG SERIES NUMBER 12 VERSION 1 USD SEN RES I03 CDS", 2455096, 2457012, 0.01, "USD", - "ACT/360", false, 0.4, 4, "4ABCAMAE6", "ITRAXX", 12, "ASIAXJ IG", null, "ASHG", 1, 5, - null, 1, 50, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ HY.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924477", "9149663", - "ITRAXX-ASIAXJHYS12V1 - 1214", "iTraxx Asia ex-Japan HY Series Number 12 Version 1", - "ITRAXX ASIA EX-JAPAN HY SERIES NUMBER 12 VERSION 1 USD SEN RES I03 CDS", 2455096, 2457012, 0.05, "USD", - "ACT/360", false, 0.25, 4, "4ABCAGAE9", "ITRAXX", 12, "ASIAXJ HY", null, "ASHY", 1, 5, - null, 1, 20, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.AUSTRALIA.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924478", "9149665", - "ITRAXX-AUSTRALIAS12V1 - 1214", "iTraxx Australia Series Number 12 Version 1", - "ITRAXX AUSTRALIA SERIES NUMBER 12 VERSION 1 USD SEN MR I03 CDS", 2455096, 2457012, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I668IAL6", "ITRAXX", 12, "AUSTRALIA", null, "AUHG", 1, 5, - null, 1, 25, 0, "HKG", false, false, true, null, "Itraxx Australia")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924479", "9149670", - "ITRAXX-JAPANS12V1 - 1214", "iTraxx Japan Series Number 12 Version 1", - "ITRAXX JAPAN SERIES NUMBER 12 VERSION 1 JPY SEN RES I03 CDS", 2455099, 2457012, 0.01, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAL8", "ITRAXX", 12, "JAPAN", null, "JPHG", 1, 5, - null, 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.SOVXWE.5Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924480", "9148044", - "ITRAXX-SOVXWES1V1 - 1214", "Itraxx SovX Western Europe Series 1 Version 1", - "ITRAXX-SOVX WEST EUR S1V1-1214 USD SEN RES I03 CDS", 2455103, 2457012, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAA9", "ITRAXX", 1, "SOVXWE", "SOV", "SOWE", 1, 5, - null, 1, 15, 0, "LON", false, false, true, null, "SOV")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924484", "9149794", - "USD ITRAXX-EUROPES12V1 - 1214", "iTraxx Europe series 12 Version 1", - "ITRAXX-EUROPES12V1-1214 USD SEN MMR I03 CDS", 2455096, 2457012, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I666VAS4", "USD ITRAXX", 12, "EUROPE", "EUR", "IG", 1, 5, - null, 1, 126, 0, "LON", false, false, true, null, "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.10Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924485", "9149795", - "USD ITRAXX-EUROPES12V1 - 1219", "iTraxx Europe series 12 Version 1", - "ITRAXX-EUROPES12V1-1219 USD SEN MMR I03 CDS", 2455096, 2458838, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I666VAS4", "USD ITRAXX", 12, "EUROPE", "EUR", "IG", 1, 10, - null, 1, 126, 0, "LON", false, false, true, null, "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924486", "9149796", - "USD ITRAXX-XOVERS12V1 - 1214", "iTraxx Europe Crossover series 12 Version 1", - "ITRAXX-XOVERS12V1-1214 USD SEN MMR I03 CDS", 2455096, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KAX6", "USD ITRAXX", 12, "XOVER", "XVR", "XO", 1, 5, - null, 1, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924487", "9149713", - "USD ITRAXX-XOVERS12V1 - 1219", "iTraxx Europe Crossover series 12 Version 1", - "ITRAXX-XOVERS12V1-1219 USD SEN MMR I03 CDS", 2455096, 2458838, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KAX6", "USD ITRAXX", 12, "XOVER", "XVR", "XO", 1, 10, - null, 1, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSEN.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924488", "9149714", - "USD ITRAXX-FINSENS12V1 - 1214", "iTraxx Europe Senior Financials series 12 Version 1", - "ITRAXX-FINSENS12V1-1214 USD SEN MMR I03 CDS", 2455096, 2457012, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I667DAL8", "USD ITRAXX", 12, "FINSEN", "SEN", "SENF", 1, 5, - null, 1, 25, 0, "LON", false, false, true, null, "SEN")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSEN.10Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924489", "9149715", - "USD ITRAXX-FINSENS12V1 - 1219", "iTraxx Europe Senior Financials series 12 Version 1", - "ITRAXX-FINSENS12V1-1219 USD SEN MMR I03 CDS", 2455096, 2458838, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I667DAL8", "USD ITRAXX", 12, "FINSEN", "SEN", "SENF", 1, 10, - null, 1, 25, 0, "LON", false, false, true, null, "SEN")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSUB.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924491", "9149716", - "USD ITRAXX-FINSUBS12V1 - 1214", "iTraxx Europe Sub Financials series 12 Version 1", - "ITRAXX-FINSUBS12V1-1214 USD LT2 SUB MMR I03 CDS", 2455096, 2457012, 0.01, "USD", - "ACT/360", false, 0.2, 4, "2I667EAM4", "USD ITRAXX", 12, "FINSUB", "SUB", "SUBF", 1, 5, - null, 1, 25, 0, "LON", false, false, true, null, "SUB")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSUB.10Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924492", "9149717", - "USD ITRAXX-FINSUBS12V1 - 1219", "iTraxx Europe Sub Financials series 12 Version 1", - "ITRAXX-FINSUBS12V1-1219 USD LT2 SUB MMR I03 CDS", 2455096, 2458838, 0.01, "USD", - "ACT/360", false, 0.2, 4, "2I667EAM4", "USD ITRAXX", 12, "FINSUB", "SUB", "SUBF", 1, 10, - null, 1, 25, 0, "LON", false, false, true, null, "SUB")); - - UpdateCDXRefDataMap ("USD ITRAXX.HIVOL.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924493", "9149718", - "USD ITRAXX-HIVOLS12V1 - 1214", "iTraxx Europe HiVol series 12 Version 1", - "ITRAXX-HIVOLS12V1-1214 USD SEN MMR I03 CDS", 2455096, 2457012, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I667LAP1", "USD ITRAXX", 12, "HIVOL", "VOL", "HV", 1, 5, - null, 1, 30, 0, "LON", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.3Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924499", "9149669", - "ITRAXX-JAPANS12V1 - 1212", "iTraxx Japan Series Number 12 Version 1", - "ITRAXX JAPAN SERIES NUMBER 12 VERSION 1 JPY SEN RES I03 CDS 3Y", 2455099, 2456282, 0.01, "JPY", - "ACT/360", false, 0.4, 4, "2I668HAL8", "ITRAXX", 12, "JAPAN", null, "JPHG", 1, 3, - null, 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924500", "9149711", - "ITRAXX-JAPANS12V1 - 1219", "iTraxx Japan Series Number 12 Version 1", - "ITRAXX JAPAN SERIES NUMBER 12 VERSION 1 JPY SEN RES I03 CDS 10Y", 2455099, 2458838, 0.01, "JPY", - "ACT/360", false, 0.4, 4, "2I668HAL8", "ITRAXX", 12, "JAPAN", null, "JPHG", 1, 10, - null, 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JHIVOL.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924502", "9149797", - "ITRAXX-JHIVOLS12V1 - 1214", "iTraxx Japan HiVol Series Number 12 Version 1", - "ITRAXX JAPAN HIVOL SERIES NUMBER 12 VERSION 1 JPY SEN RES I03 CDS", 2455096, 2457005, 0.035, "JPY", - "ACT/360", false, 0.4, 4, "ITRAXX-JHIVOLS12V1", "ITRAXX", 12, "JHIVOL", "VOL", "HV", 1, 5, - null, 1, 25, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.3Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924503", "9149771", - "ITRAXX-EUROPES12V1 - 1212", "iTraxx Europe series 12 Version 1", - "ITRAXX-EUROPES12V1-1212 EUR SEN MMR I03 CDS", 2455096, 2456282, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAS4", "ITRAXX", 12, "EUROPE", "EUR", "IG", 1, 3, - "244296", 1, 126, 0, "LON", true, true, true, "ITXEB312", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924504", "9149772", - "ITRAXX-EUROPES12V1 - 1214", "iTraxx Europe series 12 Version 1", - "ITRAXX-EUROPES12V1-1214 EUR SEN MMR I03 CDS", 2455096, 2457012, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAS4", "ITRAXX", 12, "EUROPE", "EUR", "IG", 1, 5, - "244296", 1, 126, 0, "LON", true, true, true, "ITXEB512", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.7Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924505", "9149773", - "ITRAXX-EUROPES12V1 - 1216", "iTraxx Europe series 12 Version 1", - "ITRAXX-EUROPES12V1-1216 EUR SEN MMR I03 CDS", 2455096, 2457743, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAS4", "ITRAXX", 12, "EUROPE", "EUR", "IG", 1, 7, - "244296", 1, 126, 0, "LON", true, true, true, "ITXEB712", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924506", "9149774", - "ITRAXX-EUROPES12V1 - 1219", "iTraxx Europe series 12 Version 1", - "ITRAXX-EUROPES12V1-1219 EUR SEN MMR I03 CDS", 2455096, 2458838, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAS4", "ITRAXX", 12, "EUROPE", "EUR", "IG", 1, 10, - "244296", 1, 126, 0, "LON", true, true, true, "ITXEB012", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924507", "9149776", - "ITRAXX-XOVERS12V1 - 1212", "iTraxx Europe Crossover series 12 Version 1", - "ITRAXX-XOVERS12V1-1212 EUR SEN MMR I03 CDS", 2455096, 2456282, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAX6", "ITRAXX", 12, "XOVER", "XVR", "XO", 1, 3, - "244297", 1, 50, 0, "LON", true, true, true, "ITXEX312", "XVR")); - - return true; - } - - private static final boolean InitCDXRefDataSet30() - { - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924508", "9149777", - "ITRAXX-XOVERS12V1 - 1214", "iTraxx Europe Crossover series 12 Version 1", - "ITRAXX-XOVERS12V1-1214 EUR SEN MMR I03 CDS", 2455096, 2457012, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAX6", "ITRAXX", 12, "XOVER", "XVR", "XO", 1, 5, - "244297", 1, 50, 0, "LON", true, true, true, "ITXEX512", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924509", "9149778", - "ITRAXX-XOVERS12V1 - 1216", "iTraxx Europe Crossover series 12 Version 1", - "ITRAXX-XOVERS12V1-1216 EUR SEN MMR I03 CDS", 2455096, 2457743, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAX6", "ITRAXX", 12, "XOVER", "XVR", "XO", 1, 7, - "244297", 1, 50, 0, "LON", true, true, true, "ITXEX712", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924510", "9149779", - "ITRAXX-XOVERS12V1 - 1219", "iTraxx Europe Crossover series 12 Version 1", - "ITRAXX-XOVERS12V1-1219 EUR SEN MMR I03 CDS", 2455096, 2458838, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAX6", "ITRAXX", 12, "XOVER", "XVR", "XO", 1, 10, - "244297", 1, 50, 0, "LON", true, true, true, "ITXEX012", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.3Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924513", "9149781", - "ITRAXX-HIVOLS12V1 - 1212", "iTraxx Europe HiVol series 12 Version 1", - "ITRAXX-HIVOLS12V1-1212 EUR SEN MMR I03 CDS", 2455096, 2456282, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAP1", "ITRAXX", 12, "HIVOL", "VOL", "HV", 1, 3, - "244299", 1, 30, 0, "LON", true, true, true, "ITXEH312", "VOL")); - - UpdateCDXRefDataMap ("USD ITRAXX.HIVOL.10Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924514", "9149719", - "USD ITRAXX-HIVOLS12V1 - 1219", "iTraxx Europe HiVol series 12 Version 1", - "ITRAXX-HIVOLS12V1-1219 USD SEN MMR I03 CDS", 2455096, 2458838, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I667LAP1", "USD ITRAXX", 12, "HIVOL", "VOL", "HV", 1, 10, - null, 1, 30, 0, "LON", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924517", "9149782", - "ITRAXX-HIVOLS12V1 - 1214", "iTraxx Europe HiVol series 12 Version 1", - "ITRAXX-HIVOLS12V1-1214 EUR SEN MMR I03 CDS", 2455096, 2457012, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAP1", "ITRAXX", 12, "HIVOL", "VOL", "HV", 1, 5, - "244299", 1, 30, 0, "LON", true, true, true, "ITXEH512", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.7Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924518", "9149783", - "ITRAXX-HIVOLS12V1 - 1216", "iTraxx Europe HiVol series 12 Version 1", - "ITRAXX-HIVOLS12V1-1216 EUR SEN MMR I03 CDS", 2455096, 2457743, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAP1", "ITRAXX", 12, "HIVOL", "VOL", "HV", 1, 7, - "244299", 1, 30, 0, "LON", true, true, true, "ITXEH712", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.10Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924519", "9149784", - "ITRAXX-HIVOLS12V1 - 1219", "iTraxx Europe HiVol series 12 Version 1", - "ITRAXX-HIVOLS12V1-1219 EUR SEN MMR I03 CDS", 2455096, 2458838, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAP1", "ITRAXX", 12, "HIVOL", "VOL", "HV", 1, 10, - "244299", 1, 30, 0, "LON", true, true, true, "ITXEH012", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924520", "9149789", - "ITRAXX-FINSENS12V1 - 1214", "iTraxx Europe Senior Financials series 12 Version 1", - "ITRAXX-FINSENS12V1-1214 EUR SEN MMR I03 CDS", 2455096, 2457012, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAL8", "ITRAXX", 12, "FINSEN", "SEN", "SENF", 1, 5, - "244300", 1, 25, 0, "LON", true, true, true, "ITXES512", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.10Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924521", "9149790", - "ITRAXX-FINSENS12V1 - 1219", "iTraxx Europe Senior Financials series 12 Version 1", - "ITRAXX-FINSENS12V1-1219 EUR SEN MMR I03 CDS", 2455096, 2458838, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAL8", "ITRAXX", 12, "FINSEN", "SEN", "SENF", 1, 10, - "244300", 1, 25, 0, "LON", true, true, true, "ITXES012", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924522", "9149792", - "ITRAXX-FINSUBS12V1 - 1214", "iTraxx Europe Sub Financials series 12 Version 1", - "ITRAXX-FINSUBS12V1-1214 EUR LT2 SUB MMR I03 CDS", 2455096, 2457012, 0.01, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAM4", "ITRAXX", 12, "FINSUB", "SUB", "SUBF", 1, 5, - "244301", 1, 25, 0, "LON", true, true, true, "ITXEU512", "SUB")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.10Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924523", "9149793", - "ITRAXX-FINSUBS12V1 - 1219", "iTraxx Europe Sub Financials series 12 Version 1", - "ITRAXX-FINSUBS12V1-1219 EUR LT2 SUB MMR I03 CDS", 2455096, 2458838, 0.01, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAM4", "ITRAXX", 12, "FINSUB", "SUB", "SUBF", 1, 10, - "244301", 1, 25, 0, "LON", true, true, true, "ITXEU012", "SUB")); - - UpdateCDXRefDataMap ("CDX.NA IG.2Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924524", "9149748", - "CDX-NAIGS13V1 - 1211", "CDX.NA.IG.13", - "CDX_NA_IG_S13_02Y_12/11", 2455096, 2455916, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBX2", "CDX", 13, "NA IG", null, "IG", 1, 2, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924526", "9149749", - "CDX-NAIGS13V1 - 1212", "CDX.NA.IG.13", - "CDX_NA_IG_S13_03Y_12/12", 2455096, 2456282, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBX2", "CDX", 13, "NA IG", null, "IG", 1, 3, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924527", "9149750", - "CDX-NAIGS13V1 - 1213", "CDX.NA.IG.13", - "CDX_NA_IG_S13_04Y_12/13", 2455096, 2456647, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBX2", "CDX", 13, "NA IG", null, "IG", 1, 4, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924528", "9149751", - "CDX-NAIGS13V1 - 1214", "CDX.NA.IG.13", - "CDX_NA_IG_S13_05Y_12/14", 2455096, 2457012, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBX2", "CDX", 13, "NA IG", null, "IG", 1, 5, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924529", "9149752", - "CDX-NAIGS13V1 EUR - 1214", "CDX.NA.IG.13", - "CDX_NA_IG_S13_05Y_12/14_EUR", 2455096, 2457012, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYBX2 EUR", "CDX", 13, "NA IG", null, "IG", 1, 5, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924530", "9149753", - "CDX-NAIGS13V1 - 1216", "CDX.NA.IG.13", - "CDX_NA_IG_S13_07Y_12/16", 2455096, 2457743, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBX2", "CDX", 13, "NA IG", null, "IG", 1, 7, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924531", "9149754", - "CDX-NAIGS13V1 - 1219", "CDX.NA.IG.13", - "CDX_NA_IG_S13_10Y_12/19", 2455096, 2458838, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBX2", "CDX", 13, "NA IG", null, "IG", 1, 10, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG CONS.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924532", "9149756", - "CDX-NAIGCONSS13V1 - 1214", "CDX.NA.IG.CONS.13", - "CDX_NA_IG_S13_CONS_12/14", 2455096, 2457012, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B0AO7", "CDX", 13, "NA IG CONS", null, "IG", 1, 5, - null, 1, 39, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG ENRG.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924533", "9149757", - "CDX-NAIGENRGS13V1 - 1214", "CDX.NA.IG.ENRG.13", - "CDX_NA_IG_S13_ENRG_12/14", 2455096, 2457012, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B1AO5", "CDX", 13, "NA IG ENRG", null, "IG", 1, 5, - null, 1, 17, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924534", "9149758", - "CDX-NAIGFINS13V1 - 1214", "CDX.NA.IG.FIN.13", - "CDX_NA_IG_S13_FIN_12/14", 2455096, 2457012, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B2BT1", "CDX", 13, "NA IG FIN", null, "IG", 1, 5, - null, 1, 21, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.1Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924535", "9149759", - "CDX-NAIGHVOLS13V1 - 1210", "CDX.NA.IG.HVOL.13", - "CDX_NA_IG_S13_HVOL_01Y_12/10", 2455096, 2455551, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BG7", "CDX", 13, "NA IG HVOL", null, "HV", 1, 1, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.2Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924536", "9149760", - "CDX-NAIGHVOLS13V1 - 1211", "CDX.NA.IG.HVOL.13", - "CDX_NA_IG_S13_HVOL_02Y_12/11", 2455096, 2455916, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BG7", "CDX", 13, "NA IG HVOL", null, "HV", 1, 2, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.3Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924537", "9149761", - "CDX-NAIGHVOLS13V1 - 1212", "CDX.NA.IG.HVOL.13", - "CDX_NA_IG_S13_HVOL_03Y_12/12", 2455096, 2456282, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BG7", "CDX", 13, "NA IG HVOL", null, "HV", 1, 3, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.4Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924538", "9149762", - "CDX-NAIGHVOLS13V1 - 1213", "CDX.NA.IG.HVOL.13", - "CDX_NA_IG_S13_HVOL_04Y_12/13", 2455096, 2456647, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BG7", "CDX", 13, "NA IG HVOL", null, "HV", 1, 4, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924539", "9149763", - "CDX-NAIGHVOLS13V1 - 1214", "CDX.NA.IG.HVOL.13", - "CDX_NA_IG_S13_HVOL_05Y_12/14", 2455096, 2457012, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BG7", "CDX", 13, "NA IG HVOL", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.7Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924540", "9149764", - "CDX-NAIGHVOLS13V1 - 1216", "CDX.NA.IG.HVOL.13", - "CDX_NA_IG_S13_HVOL_07Y_12/16", 2455096, 2457743, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BG7", "CDX", 13, "NA IG HVOL", null, "HV", 1, 7, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.10Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924541", "9149765", - "CDX-NAIGHVOLS13V1 - 1219", "CDX.NA.IG.HVOL.13", - "CDX_NA_IG_S13_HVOL_10Y_12/19", 2455096, 2458838, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BG7", "CDX", 13, "NA IG HVOL", null, "HV", 1, 10, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG INDU.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924542", "9149767", - "CDX-NAIGINDUS13V1 - 1214", "CDX.NA.IG.INDU.13", - "CDX_NA_IG_S13_INDU_12/14", 2455096, 2457012, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B4AT8", "CDX", 13, "NA IG INDU", null, "IG", 1, 5, - null, 1, 24, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG TMT.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924543", "9149768", - "CDX-NAIGTMTS13V1 - 1214", "CDX.NA.IG.TMT.13", - "CDX_NA_IG_S13_TMT_12/14", 2455096, 2457012, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65DJAW6", "CDX", 13, "NA IG TMT", null, "IG", 1, 5, - null, 1, 24, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.EMDIV.5Y.10.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924544", "9149726", - "CDX-EMDIVS10V1 - 1214", "CDX.EM.DIVERSIFIED.10", - "CDX EM DIVER 10 5YR", 2455096, 2457012, 0.05, "USD", - "ACT/360", true, 0.25, 2, "2165EKAN9", "CDX", 10, "EMDIV", null, "EM", 1, 5, - null, 1, 40, 0, "LON", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924545", "9149769", - "CDX-NAIGHVOLS13V1 EUR - 1214", "CDX.NA.IG.HVOL.13", - "CDX_NA_IG_S13_HVOL_05Y_12/14 EUR", 2455096, 2457012, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I65B3BG7 EUR", "CDX", 13, "NA IG HVOL", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.EM.10Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924546", "9149727", - "CDX-EMS12V1 - 1219", "CDX.EM.12", - "CDX EM 12 10YR", 2455096, 2458838, 0.05, "USD", - "ACT/360", false, 0.25, 4, "2I65BZAL6", "CDX", 12, "EM", null, "EM", 1, 10, - null, 1, 15, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.EM.5Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924547", "9149728", - "CDX-EMS12V1 - 1214", "CDX.EM.12", - "CDX EM 12 5YR", 2455096, 2457012, 0.05, "USD", - "ACT/360", false, 0, 4, "2I65BZAL6", "CDX", 12, "EM", null, "EM", 1, 5, - null, 1, 15, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V5 FXD 96/100.5Y.13.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924549", "9149729", - "CDX-NAHYS13V5 FXD 96/100 - 1214", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_FXD_96/100", 2455096, 2457012, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIY8 FXD", "CDX", 13, "NA HY V5 FXD 96/100", null, "HY", 5, 5, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924550", "9149730", - "CDX-NAHYS13V1 - 1214", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP", 2455096, 2457012, 0.05, "USD", - "ACT/360", false, 0.35000000000000003, 4, "2I65BRHH6", "CDX", 13, "NA HY", null, "HY", 1, 5, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924551", "9149731", - "CDX-NAHYS13V1 - 1210", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_01YR", 2455096, 2455551, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHH6", "CDX", 13, "NA HY", null, "HY", 1, 1, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924552", "9149732", - "CDX-NAHYS13V1 - 1211", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_02YR", 2455096, 2455916, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHH6", "CDX", 13, "NA HY", null, "HY", 1, 2, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924553", "9149733", - "CDX-NAHYS13V1 - 1212", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_03YR", 2455096, 2456282, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHH6", "CDX", 13, "NA HY", null, "HY", 1, 3, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V5 FXD 96/100.3Y.13.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924554", "9149734", - "CDX-NAHYS13V2 FXD 99/100 - 1212", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_FXD_03YR_99/100", 2455096, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRIY8 FXD", "CDX", 13, "NA HY V5 FXD 96/100", null, "HY", 5, 3, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924555", "9149735", - "CDX-NAHYS13V1 - 1213", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_04YR", 2455096, 2456647, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHH6", "CDX", 13, "NA HY", null, "HY", 1, 4, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924560", "9149736", - "CDX-NAHYS13V1 - 1215", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_06YR", 2455096, 2457377, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHH6", "CDX", 13, "NA HY", null, "HY", 1, 6, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924561", "9149737", - "CDX-NAHYS13V1 - 1216", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_07YR", 2455096, 2457743, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHH6", "CDX", 13, "NA HY", null, "HY", 1, 7, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924562", "9149738", - "CDX-NAHYS13V1 - 1219", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_10YR", 2455096, 2458838, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHH6", "CDX", 13, "NA HY", null, "HY", 1, 10, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BV2 FXD 28/29.5Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924564", "9149741", - "CDX-NAHYBS13V1 FXD - 1214", "CDX.NA.HY.B.13", - "CDX_NA_HY_S13_B___FXD", 2455096, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BSBU1 FXD", "CDX", 13, "NA HY BV2 FXD 28/29", null, "HY", 2, 5, - null, 0.96552, 29, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924565", "9149742", - "CDX-NAHYBS13V1 - 1214", "CDX.NA.HY.B.13", - "CDX_NA_HY_S13_B___SWP", 2455096, 2457012, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSEK0", "CDX", 13, "NA HY B", null, "HY", 1, 5, - null, 1, 29, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BBV1 FXD.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924566", "9149743", - "CDX-NAHYBBS13V1 FXD - 1214", "CDX.NA.HY.BB.13", - "CDX_NA_HY_S13_BB__FXD", 2455096, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BVBU4 FXD", "CDX", 13, "NA HY BBV1 FXD", null, "HY", 1, 5, - null, 1, 32, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924567", "9149744", - "CDX-NAHYBBS13V1 - 1214", "CDX.NA.HY.BB.13", - "CDX_NA_HY_S13_BB__SWP", 2455096, 2457012, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBU4", "CDX", 13, "NA HY BB", null, "HY", 1, 5, - null, 1, 32, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HBV3 FXD 28/30.5Y.13.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924568", "9149745", - "CDX-NAHYHBS13V2 FXD 29/30 - 1214", "CDX.NA.HY.HB.13", - "CDX_NA_HY_S13_HB__FXD_29/30", 2455096, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BWFE4 FXD", "CDX", 13, "NA HY HBV3 FXD 28/30", null, "HY", 3, 5, - null, 0.9333199999999999, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924569", "9149746", - "CDX-NAHYHBS13V1 - 1214", "CDX.NA.HY.HB.13", - "CDX_NA_HY_S13_HB__SWP", 2455096, 2457012, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWER6", "CDX", 13, "NA HY HB", null, "HY", 1, 5, - null, 1, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.1Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924570", "9149747", - "CDX-NAIGS13V1 - 1210", "CDX.NA.IG.13", - "CDX_NA_IG_S13_01Y_12/10", 2455096, 2455551, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBX2", "CDX", 13, "NA IG", null, "IG", 1, 1, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.AUSTRALIA.10Y.12.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924571", "9149668", - "ITRAXX-AUSTRALIAS12V1 - 1219", "iTraxx Australia Series Number 12 Version 1", - "ITRAXX AUSTRALIA SERIES NUMBER 12 VERSION 1 USD SEN MR I03 CDS 10Y", 2455096, 2458838, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I668IAL6", "ITRAXX", 12, "AUSTRALIA", null, "AUHG", 1, 10, - null, 1, 25, 0, "HKG", false, false, true, null, "Itraxx Australia")); - - UpdateCDXRefDataMap ("LevXSenS1V13.LevXSen.5Y.1.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924580", "9151086", - "LevXSenS1V13 - 1211", "ITRAXX LEVX SENIOR SERIES 1 VERSION 13", - "ITRAXX LEVX SENIOR SERIES 1 VERSION 13 EUR 1ST SEC MMR I03 CDS", 2453999, 2455916, 0.017, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJBK8", "LevXSenS1V13", 1, "LevXSen", null, "IG", 13, 5, - null, 0.65711, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LevXSubS1V18.LevXSub.5Y.1.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924582", "9151088", - "LevXSubS1V18 - 1211", "ITRAXX LEVX SUBORDINATE SERIES 1 VERSION 18", - "ITRAXX LEVX SUBORDINATE SERIES 1 VERSION 18 EUR 2ND SEC MMR I03 CDS", 2454180, 2455916, 0.045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKBP4", "LevXSubS1V18", 1, "LevXSub", null, "IG", 18, 5, - null, 0.5143, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevXSub.5Y.2.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924583", "9151090", - "ITRAXX-LevXSubS2V6 - 0613", "ITRAXX LEVX SUBORDINATE SERIES 2 VERSION 6", - "ITRAXX LEVX SUBORDINATE SERIES 2 VERSION 6 EUR 2ND SEC RES I03 CDS", 2454543, 2456464, 0.0825, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKBT6", "ITRAXX", 2, "LevXSub", null, "IG", 6, 5, - null, 0.8890000000000001, 45, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.2.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924584", "9151089", - "ITRAXX-LevXS2V8 - 0613", "ITRAXX LEVX SENIOR SERIES 2 VERSION 8", - "ITRAXX LEVX SENIOR SERIES 2 VERSION 8 EUR 1ST SEC RES I03 CDS", 2454543, 2456464, 0.052500000000000005, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJBN2", "ITRAXX", 2, "LevX", null, "IG", 8, 5, - null, 0.9066, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.3.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924585", "9151091", - "ITRAXX-LevXS3V6 - 1213", "ITRAXX LEVX SENIOR SERIES 3 VERSION 6", - "ITRAXX LEVX SENIOR SERIES 3 VERSION 6 EUR 1ST SEC RES I03 CDS", 2454739, 2456647, 0.0575, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJBM4", "ITRAXX", 3, "LevX", null, "IG", 6, 5, - null, 0.9334, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevXSub.5Y.3.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924586", "9151092", - "ITRAXX-LevXSubS3V6 - 1213", "ITRAXX LEVX SUBORDINATE SERIES 3 VERSION 6", - "ITRAXX LEVX SUBORDINATE SERIES 3 VERSION 6 EUR 2ND SEC RES I03 CDS", 2454739, 2456647, 0.12000000000000001, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKBU3", "ITRAXX", 3, "LevXSub", null, "IG", 6, 5, - null, 0.8890000000000001, 45, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924587", "9152506", - "ITRAXX-LevXS5V1 - 1214", "Itraxx Levx Senior Series 5 Version 1", - "ITRAXX LEVX SENIOR SERIES 5 VERSION 1 EUR 1ST SEC RES I03 CDS", 2455096, 2457012, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDA8", "ITRAXX", 5, "LevX", null, "IG", 1, 5, - null, 1, 40, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.SOVXWE.10Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924593", "9167157", - "ITRAXX-SOVXWES1V1 - 1219", "Itraxx SovX Western Europe Series 1 Version 1", - "ITRAXX-SOVX WEST EUR S1V1-1219 USD SEN RES I03 CDS", 2455103, 2458838, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAA9", "ITRAXX", 1, "SOVXWE", "SOV", "SOWE", 1, 10, - null, 1, 15, 0, "LON", false, false, true, null, "SOV")); - - UpdateCDXRefDataMap ("Itraxx.SovX West Eur.5Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924606", "9175035", - "Itraxx-SovX West Eur S2V1 - 1214", "Itraxx SovX Western Europe Series 2 Version 1", - "ITRAXX-SOVX WEST EUR S2V1-1214 USD SEN RES I03 CDS", 2455103, 2457012, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAB7", "Itraxx", 2, "SovX West Eur", "SOV", "SOWE", 1, 5, - "244322", 1, 15, 0, "LON", true, true, true, null, "SOV")); - - UpdateCDXRefDataMap ("Itraxx.SovX West Eur.10Y.2.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924607", "9175036", - "Itraxx-SovX West Eur S2V1 - 1219", "Itraxx SovX Western Europe Series 2 Version 1", - "ITRAXX-SOVX WEST EUR S2V1-1219 USD SEN RES I03 CDS", 2455103, 2458838, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAB7", "Itraxx", 2, "SovX West Eur", "SOV", "SOWE", 1, 10, - "244322", 1, 15, 0, "LON", true, true, true, null, "SOV")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924609", "9175199", - "LCDXNAS13V1 - 1210", "LCDX.NA.13", - "CDX_NA_LN_S13_100_01YR", 2455110, 2455551, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCQ8", "LCDX", 13, "LCDXNA", null, "IG", 1, 1, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924610", "9174946", - "LCDXNAS13V1 - 1212", "LCDX.NA.13", - "CDX_NA_LN_S13_100_03YR", 2455110, 2456282, 0.05, "USD", - "ACT/360", false, 0.55, 4, "5F199GCQ8", "LCDX", 13, "LCDXNA", null, "IG", 1, 3, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS13V1 FXD.LCDXNAV1 FXD.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924611", "9174965", - "LCDXNAS13V1 FXD - 1214", "LCDX.NA.13", - "CDX_NA_LN_S13_100_FXD", 2455110, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCQ8 FXD", "LCDXNAS13V1 FXD", 13, "LCDXNAV1 FXD", null, "IG", 1, 5, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924612", "9174967", - "LCDXNAS13V1 - 1211", "LCDX.NA.13", - "CDX_NA_LN_S13_100_02YR", 2455110, 2455916, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCQ8", "LCDX", 13, "LCDXNA", null, "IG", 1, 2, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924613", "9174677", - "LCDXNAS13V1 - 1214", "LCDX.NA.13", - "CDX_NA_LN_S13_100", 2455110, 2457012, 0.05, "USD", - "ACT/360", false, 0.55, 4, "5F199GCQ8", "LCDX", 13, "LCDXNA", null, "IG", 1, 5, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924614", "9174973", - "LCDXNAS13V1 - 1216", "LCDX.NA.13", - "CDX_NA_LN_S13_100_07YR", 2455110, 2457743, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCQ8", "LCDX", 13, "LCDXNA", null, "IG", 1, 7, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924615", "9174975", - "LCDXNAS13V1 - 1219", "LCDX.NA.13", - "CDX_NA_LN_S13_100_10YR", 2455110, 2458838, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCQ8", "LCDX", 13, "LCDXNA", null, "IG", 1, 10, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924616", "9174976", - "LCDXNAS13V1 - 1213", "LCDX.NA.13", - "CDX_NA_LN_S13_100_04YR", 2455110, 2456647, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCQ8", "LCDX", 13, "LCDXNA", null, "IG", 1, 4, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924617", "9174979", - "LCDXNAS13V1 - 1215", "LCDX.NA.13", - "CDX_NA_LN_S13_100_06YR", 2455110, 2457377, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCQ8", "LCDX", 13, "LCDXNA", null, "IG", 1, 6, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.24", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924648", "9353856", - "LCDXNAS8V24 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_78/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.55, 4, "5F199GCR6", "LCDX", 8, "LCDXNA", null, "IG", 24, 5, - null, 0.78, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924649", "9353857", - "LCDXNAS9V19 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_83/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.55, 4, "5F199GCS4", "LCDX", 9, "LCDXNA", null, "IG", 19, 5, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924650", "9353760", - "LCDXNAS10V20 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_82/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.55, 4, "5F199GCT2", "LCDX", 10, "LCDXNA", null, "IG", 20, 5, - null, 0.8200000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.24", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924651", "9353886", - "LCDXNAS8V24 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_78/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCR6", "LCDX", 8, "LCDXNA", null, "IG", 24, 10, - null, 0.78, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V24 FXD.LCDXNAV24 FXD.5Y.8.24", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924652", "9353889", - "LCDXNAS8V24 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_78/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCR6 FXD", "LCDXNAS8V24 FXD", 8, "LCDXNAV24 FXD", null, "IG", 24, 5, - null, 0.78, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.24", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924653", "9353891", - "LCDXNAS8V24 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_78/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCR6", "LCDX", 8, "LCDXNA", null, "IG", 24, 6, - null, 0.78, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.24", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924654", "9353894", - "LCDXNAS8V24 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_78/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCR6", "LCDX", 8, "LCDXNA", null, "IG", 24, 7, - null, 0.78, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.24", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924655", "9353897", - "LCDXNAS8V24 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_78/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCR6", "LCDX", 8, "LCDXNA", null, "IG", 24, 4, - null, 0.78, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.24", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924656", "9353901", - "LCDXNAS8V24 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_78/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCR6", "LCDX", 8, "LCDXNA", null, "IG", 24, 3, - null, 0.78, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.10.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924658", "9353866", - "LCDXNAS10V20 - 0611", "LCDX.NA.10", - "CDX_NA_LN_S10_100_03YR_82/100", 2454561, 2455733, 0.0275, "USD", - "ACT/360", false, 0.55, 4, "5F199GCT2", "LCDX", 10, "LCDXNA", null, "IG", 20, 3, - null, 0.8200000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS10V20 FXD.LCDXNAV20 FXD.5Y.10.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924659", "9354383", - "LCDXNAS10V20 FXD - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_FXD_82/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCT2 FXD", "LCDXNAS10V20 FXD", 10, "LCDXNAV20 FXD", null, "IG", 20, 5, - null, 0.8200000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.10.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924660", "9354387", - "LCDXNAS10V20 - 0614", "LCDX.NA.10", - "CDX_NA_LN_S10_100_06YR_82/100", 2454561, 2456829, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCT2", "LCDX", 10, "LCDXNA", null, "IG", 20, 6, - null, 0.8200000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.10.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924661", "9354390", - "LCDXNAS10V20 - 0610", "LCDX.NA.10", - "CDX_NA_LN_S10_100_02YR_82/100", 2454561, 2455368, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCT2", "LCDX", 10, "LCDXNA", null, "IG", 20, 2, - null, 0.8200000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.10.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924662", "9354071", - "LCDXNAS10V20 - 0615", "LCDX.NA.10", - "CDX_NA_LN_S10_100_07YR_82/100", 2454561, 2457194, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCT2", "LCDX", 10, "LCDXNA", null, "IG", 20, 7, - null, 0.8200000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.10.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924663", "9354072", - "LCDXNAS10V20 - 0618", "LCDX.NA.10", - "CDX_NA_LN_S10_100_10YR_82/100", 2454561, 2458290, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCT2", "LCDX", 10, "LCDXNA", null, "IG", 20, 10, - null, 0.8200000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.10.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924664", "9354074", - "LCDXNAS10V20 - 0612", "LCDX.NA.10", - "CDX_NA_LN_S10_100_04YR_82/100", 2454561, 2456099, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCT2", "LCDX", 10, "LCDXNA", null, "IG", 20, 4, - null, 0.8200000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.12.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924665", "9353765", - "LCDXNAS12V9 - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_92/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.55, 4, "5F199GCU9", "LCDX", 12, "LCDXNA", null, "IG", 9, 5, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.12.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924666", "9353766", - "LCDXNAS12V9 - 0612", "LCDX.NA.12", - "CDX_NA_LN_S12_100_03YR_92/100", 2454938, 2456099, 0.05, "USD", - "ACT/360", false, 0.55, 4, "5F199GCU9", "LCDX", 12, "LCDXNA", null, "IG", 9, 3, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.12.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924669", "9354309", - "LCDXNAS12V9 - 0610", "LCDX.NA.12", - "CDX_NA_LN_S12_100_01YR_92/100", 2454938, 2455368, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCU9", "LCDX", 12, "LCDXNA", null, "IG", 9, 1, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS12V9 FXD.LCDXNAV9 FXD.5Y.12.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924670", "9354310", - "LCDXNAS12V9 FXD - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_FXD_92/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCU9 FXD", "LCDXNAS12V9 FXD", 12, "LCDXNAV9 FXD", null, "IG", 9, 5, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.12.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924671", "9354313", - "LCDXNAS12V9 - 0611", "LCDX.NA.12", - "CDX_NA_LN_S12_100_02YR_92/100", 2454938, 2455733, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCU9", "LCDX", 12, "LCDXNA", null, "IG", 9, 2, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.12.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924672", "9354314", - "LCDXNAS12V9 - 0616", "LCDX.NA.12", - "CDX_NA_LN_S12_100_07YR_92/100", 2454938, 2457560, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCU9", "LCDX", 12, "LCDXNA", null, "IG", 9, 7, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.12.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924673", "9354308", - "LCDXNAS12V9 - 0619", "LCDX.NA.12", - "CDX_NA_LN_S12_100_10YR_92/100", 2454938, 2458655, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCU9", "LCDX", 12, "LCDXNA", null, "IG", 9, 10, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.12.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924674", "9354311", - "LCDXNAS12V9 - 0613", "LCDX.NA.12", - "CDX_NA_LN_S12_100_04YR_92/100", 2454938, 2456464, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCU9", "LCDX", 12, "LCDXNA", null, "IG", 9, 4, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.12.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924675", "9354312", - "LCDXNAS12V9 - 0615", "LCDX.NA.12", - "CDX_NA_LN_S12_100_06YR_92/100", 2454938, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCU9", "LCDX", 12, "LCDXNA", null, "IG", 9, 6, - null, 0.92, 100, 0, "NYC", false, false, true, null, "LCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet31() - { - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.9.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924679", "9353862", - "LCDXNAS9V19 - 1209", "LCDX.NA.9", - "CDX_NA_LN_S09_100_02YR_83/100", 2454378, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCS4", "LCDX", 9, "LCDXNA", null, "IG", 19, 2, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V19 FXD.LCDXNAV19 FXD.5Y.9.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924680", "9353863", - "LCDXNAS9V19 FXD - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_FXD_83/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCS4 FXD", "LCDXNAS9V19 FXD", 9, "LCDXNAV19 FXD", null, "IG", 19, 5, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.9.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924681", "9353905", - "LCDXNAS9V19 - 1214", "LCDX.NA.9", - "CDX_NA_LN_S09_100_07YR_83/100", 2454378, 2457012, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCS4", "LCDX", 9, "LCDXNA", null, "IG", 19, 7, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.9.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924682", "9354069", - "LCDXNAS9V19 - 1210", "LCDX.NA.9", - "CDX_NA_LN_S09_100_03YR_83/100", 2454378, 2455551, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCS4", "LCDX", 9, "LCDXNA", null, "IG", 19, 3, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.9.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924683", "9354315", - "LCDXNAS9V19 - 1217", "LCDX.NA.9", - "CDX_NA_LN_S09_100_10YR_83/100", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCS4", "LCDX", 9, "LCDXNA", null, "IG", 19, 10, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.9.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924684", "9354381", - "LCDXNAS9V19 - 1211", "LCDX.NA.9", - "CDX_NA_LN_S09_100_04YR_83/100", 2454378, 2455916, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCS4", "LCDX", 9, "LCDXNA", null, "IG", 19, 4, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.9.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924685", "9353773", - "LCDXNAS9V19 - 1213", "LCDX.NA.9", - "CDX_NA_LN_S09_100_06YR_83/100", 2454378, 2456647, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCS4", "LCDX", 9, "LCDXNA", null, "IG", 19, 6, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.7.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924696", "9365789", - "CDX-NAIGFINS7V4 - 1211", "Dow Jones CDX.NA.IG.FIN.7", - "DJCDX_NA_IG_S7_FIN_12/11_21/25", 2454000, 2455916, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65B2CA1", "CDX", 7, "NA IG FIN", null, "IG", 4, 5, - null, 0.84, 25, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924697", "9365791", - "CDX-NAIGS8V4 - 0617", "CDX.NA.IG.8", - "CDX_NA_IG_S8_10Y_06/17_121/125", 2454181, 2457925, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCF0", "CDX", 8, "NA IG", null, "IG", 4, 10, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924698", "9365792", - "CDX-NAIGS8V4 - 0614", "CDX.NA.IG.8", - "CDX_NA_IG_S8_07Y_06/14_121/125", 2454181, 2456829, 0.0045000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCF0", "CDX", 8, "NA IG", null, "IG", 4, 7, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924703", "9365793", - "CDX-NAIGS8V4 EUR - 0612", "CDX.NA.IG.8", - "CDX_NA_IG_S8_05Y_06/12_EUR_121/125", 2454181, 2456099, 0.0035, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYCF0 EUR", "CDX", 8, "NA IG", null, "IG", 4, 5, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924704", "9365794", - "CDX-NAIGS8V4 - 0612", "CDX.NA.IG.8", - "CDX_NA_IG_S8_05Y_06/12_121/125", 2454181, 2456099, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCF0", "CDX", 8, "NA IG", null, "IG", 4, 5, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.1.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924705", "9365747", - "CDX-NAIGS1V8 - 0314", "Dow Jones CDX.NA.IG.1", - "DJCDX_NA_IG_S1_10Y_3/14_118/125", 2452934, 2456737, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBY0", "CDX", 1, "NA IG", null, "IG", 8, 10, - null, 0.948, 124, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924706", "9365795", - "CDX-NAIGS8V4 - 0611", "CDX.NA.IG.8", - "CDX_NA_IG_S8_04Y_06/11_121/125", 2454181, 2455733, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCF0", "CDX", 8, "NA IG", null, "IG", 4, 4, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924708", "9365796", - "CDX-NAIGS8V4 - 0610", "CDX.NA.IG.8", - "CDX_NA_IG_S8_03Y_06/10_121/125", 2454181, 2455368, 0.002, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCF0", "CDX", 8, "NA IG", null, "IG", 4, 3, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.5.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924709", "9365769", - "CDX-NAIGS5V5 - 1212", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_07Y_12/12_122/127", 2453635, 2456282, 0.0055000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCC7", "CDX", 5, "NA IG", null, "IG", 5, 7, - null, 0.9640000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.2.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924710", "9365750", - "CDX-NAIGS2V7 - 0914", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_10Y_9/14_120/126", 2453088, 2456921, 0.008, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBZ7", "CDX", 2, "NA IG", null, "IG", 7, 10, - null, 0.956, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924711", "9365798", - "CDX-NAIGFINS8V4 - 0612", "CDX.NA.IG.FIN.8", - "CDX_NA_IG_S8_FIN_06/12_21/25", 2454181, 2456099, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65B2CB9", "CDX", 8, "NA IG FIN", null, "IG", 4, 5, - null, 0.84, 25, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.2.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924712", "9365751", - "CDX-NAIGS2V7 - 0911", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_07Y_9/11_120/126", 2453088, 2455825, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYBZ7", "CDX", 2, "NA IG", null, "IG", 7, 7, - null, 0.956, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.5.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924713", "9365770", - "CDX-NAIGS5V5 - 1210", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_05Y_12/10_122/127", 2453635, 2455551, 0.0045000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCC7", "CDX", 5, "NA IG", null, "IG", 5, 5, - null, 0.9640000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924714", "9365799", - "CDX-NAIGS9V4 - 1210", "CDX.NA.IG.9", - "CDX_NA_IG_S9_03Y_12/10_121/125", 2454365, 2455551, 0.0045000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCG8", "CDX", 9, "NA IG", null, "IG", 4, 3, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("TRACX.NA.10Y.2.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924715", "9365755", - "TRACXNA-S2V5 - 0314", "Dow Jones TRAC-X NA SERIES 2 March 2014", - "TRACX_NA_IG_S2_10Y_3/14_SWP_96/100", 2452916, 2456737, 0.01, "USD", - "ACT/360", false, 0.4, 4, "TRACXNA-S2V5", "TRACX", 2, "NA", null, "IG", 5, 10, - null, 0.965, 99, 0, "NYC", false, false, true, null, "Trac-X")); - - UpdateCDXRefDataMap ("CDX.NA IG.2Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924716", "9365800", - "CDX-NAIGS9V4 - 1209", "CDX.NA.IG.9", - "CDX_NA_IG_S9_02Y_12/09_121/125", 2454365, 2455186, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCG8", "CDX", 9, "NA IG", null, "IG", 4, 2, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V6 EUR.5Y.3.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924717", "9365756", - "CDX-NAIGS3V6 EUR - 0310", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_05Y_3/10_120/126_EUR", 2453270, 2455276, 0.005, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYCA1 EUR", "CDX", 3, "NA IG V6 EUR", null, "IG", 6, 5, - null, 0.956, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.3.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924718", "9365757", - "CDX-NAIGS3V6 - 0310", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_05Y_3/10_120/126", 2453270, 2455278, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCA1", "CDX", 3, "NA IG", null, "IG", 6, 5, - null, 0.956, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924719", "9365801", - "CDX-NAIGS9V4 - 1214", "CDX.NA.IG.9", - "CDX_NA_IG_S9_07Y_12/14_121/125", 2454365, 2457012, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCG8", "CDX", 9, "NA IG", null, "IG", 4, 7, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924720", "9365802", - "CDX-NAIGS9V4 - 1217", "CDX.NA.IG.9", - "CDX_NA_IG_S9_10Y_12/17_121/125", 2454365, 2458108, 0.008, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCG8", "CDX", 9, "NA IG", null, "IG", 4, 10, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.3.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924721", "9365758", - "CDX-NAIGS3V6 - 0312", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_07Y_3/12_120/126", 2453270, 2456007, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCA1", "CDX", 3, "NA IG", null, "IG", 6, 7, - null, 0.956, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.5.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924722", "9365771", - "CDX-NAIGS5V5 - 1209", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_04Y_12/09_122/127", 2453635, 2455186, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCC7", "CDX", 5, "NA IG", null, "IG", 5, 4, - null, 0.9640000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924723", "9365803", - "CDX-NAIGS9V4 EUR - 1212", "CDX.NA.IG.9", - "CDX_NA_IG_S9_05Y_12/12_EUR_121/125", 2454365, 2456282, 0.006, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYCG8 EUR", "CDX", 9, "NA IG", null, "IG", 4, 5, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.3.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924724", "9365759", - "CDX-NAIGS3V6 - 0315", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_10Y_3/15_120/126", 2453270, 2457102, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCA1", "CDX", 3, "NA IG", null, "IG", 6, 10, - null, 0.956, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924725", "9365670", - "CDX-NAIGFINS9V4 - 1212", "CDX.NA.IG.FIN.9", - "CDX_NA_IG_S9_FIN_12/12_21/25", 2454365, 2456282, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65B2CC7", "CDX", 9, "NA IG FIN", null, "IG", 4, 5, - null, 0.84, 25, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924726", "9365804", - "CDX-NAIGS9V4 - 1212", "CDX.NA.IG.9", - "CDX_NA_IG_S9_05Y_12/12_121/125", 2454365, 2456282, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCG8", "CDX", 9, "NA IG", null, "IG", 4, 5, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.3.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924727", "9365761", - "CDX-NAIGFINS3V4 - 0310", "Dow Jones CDX.NA.IG.FIN.3", - "DOW_JONES_CDX_NA_IG_FIN_S3_05Y_19/23", 2453270, 2455276, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65B2BW4", "CDX", 3, "NA IG FIN", null, "IG", 4, 5, - null, 0.83333, 23, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924728", "9365805", - "CDX-NAIGS9V4 - 1211", "CDX.NA.IG.9", - "CDX_NA_IG_S9_04Y_12/11_121/125", 2454365, 2455916, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCG8", "CDX", 9, "NA IG", null, "IG", 4, 4, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.4.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924729", "9365762", - "CDX-NAIGS4V6 - 0610", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_05Y_6/10_120/126", 2453451, 2455368, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCB9", "CDX", 4, "NA IG", null, "IG", 6, 5, - null, 0.956, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.2Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924730", "9365671", - "CDX-NAIGHVOLS9V3 - 1209", "CDX.NA.IG.HVOL.9", - "CDX_NA_IG_S9_HVOL_02Y_12/09_28/30", 2454365, 2455186, 0.0115, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BH5", "CDX", 9, "NA IG HVOL", null, "HV", 3, 2, - null, 0.93333, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG V6 EUR.5Y.4.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924731", "9365763", - "CDX-NAIGS4V6 EUR - 0610", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_05Y_6/10_EUR_120/126", 2453451, 2455368, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYCB9 EUR", "CDX", 4, "NA IG V6 EUR", null, "IG", 6, 5, - null, 0.956, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.5.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924732", "9365773", - "CDX-NAIGFINS5V4 - 1210", "Dow Jones CDX.NA.IG.FIN.5", - "DJCDX_NA_IG_S5_FIN_12/10_20/24", 2453635, 2455551, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65B2BY0", "CDX", 5, "NA IG FIN", null, "IG", 4, 5, - null, 0.83333, 24, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.4.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924734", "9365764", - "CDX-NAIGS4V6 - 0615", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_10Y_6/15_120/126", 2453451, 2457194, 0.006500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCB9", "CDX", 4, "NA IG", null, "IG", 6, 10, - null, 0.956, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.3Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924735", "9365672", - "CDX-NAIGHVOLS9V3 - 1210", "CDX.NA.IG.HVOL.9", - "CDX_NA_IG_S9_HVOL_03Y_12/10_28/30", 2454365, 2455551, 0.0125, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BH5", "CDX", 9, "NA IG HVOL", null, "HV", 3, 3, - null, 0.93333, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.4.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924739", "9365765", - "CDX-NAIGS4V6 - 0612", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_07Y_6/12_120/126", 2453451, 2456099, 0.0055000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCB9", "CDX", 4, "NA IG", null, "IG", 6, 7, - null, 0.956, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.4Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924740", "9365673", - "CDX-NAIGHVOLS9V3 - 1211", "CDX.NA.IG.HVOL.9", - "CDX_NA_IG_S9_HVOL_04Y_12/11_28/30", 2454365, 2455916, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BH5", "CDX", 9, "NA IG HVOL", null, "HV", 3, 4, - null, 0.93333, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.4.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924741", "9365767", - "CDX-NAIGFINS4V4 - 0610", "Dow Jones CDX.NA.IG.FIN.4", - "DJCDX_NA_IG_S4_FIN_05Y_6/10_19/23", 2453451, 2455368, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65B2BX2", "CDX", 4, "NA IG FIN", null, "IG", 4, 5, - null, 0.83333, 23, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.5.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924742", "9365768", - "CDX-NAIGS5V5 - 1215", "Dow Jones CDX.NA.IG.5", - "DJCDX_NA_IG_S5_10Y_12/15_122/127", 2453635, 2457377, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCC7", "CDX", 5, "NA IG", null, "IG", 5, 10, - null, 0.9640000000000001, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924745", "9365674", - "CDX-NAIGHVOLS9V3 - 1212", "CDX.NA.IG.HVOL.9", - "CDX_NA_IG_S9_HVOL_05Y_12/12_28/30", 2454365, 2456282, 0.014, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BH5", "CDX", 9, "NA IG HVOL", null, "HV", 3, 5, - null, 0.93333, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.7Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924747", "9365675", - "CDX-NAIGHVOLS9V3 - 1214", "CDX.NA.IG.HVOL.9", - "CDX_NA_IG_S9_HVOL_07Y_12/14_28/30", 2454365, 2457012, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BH5", "CDX", 9, "NA IG HVOL", null, "HV", 3, 7, - null, 0.93333, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.6.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924748", "9365776", - "CDX-NAIGS6V6 - 0616", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_10Y_6/16_121/127", 2453816, 2457560, 0.006500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCD5", "CDX", 6, "NA IG", null, "IG", 6, 10, - null, 0.956, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.6.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924749", "9365777", - "CDX-NAIGS6V6 - 0613", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_07Y_6/13_121/127", 2453816, 2456464, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCD5", "CDX", 6, "NA IG", null, "IG", 6, 7, - null, 0.956, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.7.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924750", "9365782", - "CDX-NAIGS7V5 - 1211", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_05Y_12/11_121/126", 2454000, 2455917, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCE3", "CDX", 7, "NA IG", null, "IG", 5, 5, - null, 0.9640000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.2Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924751", "9365680", - "CDX-NAIGS10V4 - 0610", "CDX.NA.IG.10", - "CDX_NA_IG_S10_02Y_06/10_121/125", 2454547, 2455368, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCH6", "CDX", 10, "NA IG", null, "IG", 4, 2, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.6.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924752", "9365778", - "CDX-NAIGS6V6 - 0611", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_05Y_6/11_121/127", 2453816, 2455733, 0.004, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCD5", "CDX", 6, "NA IG", null, "IG", 6, 5, - null, 0.956, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.10Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924753", "9365734", - "CDX-NAIGHVOLS12V2 - 0619", "CDX.NA.IG.HVOL.12", - "CDX_NA_IG_S12_HVOL_10Y_06/19_29/30", 2454911, 2458655, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BK8", "CDX", 12, "NA IG HVOL", null, "HV", 2, 10, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924754", "9365737", - "CDX-NAHYS13V2 - 1214", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_99/100", 2455096, 2457012, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHI4", "CDX", 13, "NA HY", null, "HY", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924756", "9365738", - "CDX-NAHYS13V2 - 1212", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_03YR_99/100", 2455096, 2456282, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHI4", "CDX", 13, "NA HY", null, "HY", 2, 3, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924757", "9365681", - "CDX-NAIGS10V4 - 0611", "CDX.NA.IG.10", - "CDX_NA_IG_S10_03Y_06/11_121/125", 2454547, 2455733, 0.0155, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCH6", "CDX", 10, "NA IG", null, "IG", 4, 3, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924758", "9365739", - "CDX-NAHYS13V2 - 1216", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_07YR_99/100", 2455096, 2457743, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHI4", "CDX", 13, "NA HY", null, "HY", 2, 7, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924759", "9365740", - "CDX-NAHYS13V2 - 1219", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_10YR_99/100", 2455096, 2458838, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHI4", "CDX", 13, "NA HY", null, "HY", 2, 10, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.3Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924760", "9365713", - "CDX-NAIGHVOLS11V2 - 1211", "CDX.NA.IG.HVOL.11", - "CDX_NA_IG_S11_HVOL_03Y_12/11_29/30", 2454731, 2455916, 0.04, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BJ1", "CDX", 11, "NA IG HVOL", null, "HV", 2, 3, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924761", "9365683", - "CDX-NAIGS10V4 - 0613", "CDX.NA.IG.10", - "CDX_NA_IG_S10_05Y_06/13_121/125", 2454547, 2456464, 0.0155, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCH6", "CDX", 10, "NA IG", null, "IG", 4, 5, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924762", "9365685", - "CDX-NAIGS10V4 - 0615", "CDX.NA.IG.10", - "CDX_NA_IG_S10_07Y_06/15_121/125", 2454547, 2457194, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCH6", "CDX", 10, "NA IG", null, "IG", 4, 7, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924763", "9365687", - "CDX-NAIGS10V4 - 0618", "CDX.NA.IG.10", - "CDX_NA_IG_S10_10Y_06/18_121/125", 2454547, 2458290, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCH6", "CDX", 10, "NA IG", null, "IG", 4, 10, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924764", "9365715", - "CDX-NAIGHVOLS11V2 - 1213", "CDX.NA.IG.HVOL.11", - "CDX_NA_IG_S11_HVOL_05Y_12/13_29/30", 2454731, 2456647, 0.0385, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BJ1", "CDX", 11, "NA IG HVOL", null, "HV", 2, 5, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.10Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924765", "9365676", - "CDX-NAIGHVOLS9V3 - 1217", "CDX.NA.IG.HVOL.9", - "CDX_NA_IG_S9_HVOL_10Y_12/17_28/30", 2454365, 2458108, 0.016, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BH5", "CDX", 9, "NA IG HVOL", null, "HV", 3, 10, - null, 0.93333, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924766", "9365677", - "CDX-NAIGHVOLS9V3 EUR - 1212", "CDX.NA.IG.HVOL.9", - "CDX_NA_IG_S9_HVOL_05Y_12/12 EUR_28/30", 2454365, 2456282, 0.014, "EUR", - "ACT/360", false, 0.4, 4, "2I65B3BH5 EUR", "CDX", 9, "NA IG HVOL", null, "HV", 3, 5, - null, 0.93333, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.7.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924767", "9365783", - "CDX-NAIGS7V5 - 1209", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_03Y_12/09_121/126", 2454000, 2455186, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCE3", "CDX", 7, "NA IG", null, "IG", 5, 3, - null, 0.9640000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.1Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924768", "9365698", - "CDX-NAIGS11V2 - 1209", "CDX.NA.IG.11", - "CDX_NA_IG_S11_01Y_12/09_124/125", 2454731, 2455186, 0.014, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCI4", "CDX", 11, "NA IG", null, "IG", 2, 1, - null, 0.9920000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.7.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924769", "9365784", - "CDX-NAIGS7V5 - 1213", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_07Y_12/13_121/126", 2454000, 2456647, 0.005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCE3", "CDX", 7, "NA IG", null, "IG", 5, 7, - null, 0.9640000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924770", "9365699", - "CDX-NAIGS11V2 - 1215", "CDX.NA.IG.11", - "CDX_NA_IG_S11_07Y_12/15_124/125", 2454731, 2457377, 0.0145, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCI4", "CDX", 11, "NA IG", null, "IG", 2, 7, - null, 0.9920000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.7.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924771", "9365785", - "CDX-NAIGS7V5 - 1216", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_10Y_12/16_121/126", 2454000, 2457743, 0.006500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCE3", "CDX", 7, "NA IG", null, "IG", 5, 10, - null, 0.9640000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924772", "9365682", - "CDX-NAIGS10V4 - 0612", "CDX.NA.IG.10", - "CDX_NA_IG_S10_04Y_06/12_121/125", 2454547, 2456099, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCH6", "CDX", 10, "NA IG", null, "IG", 4, 4, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.2Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924773", "9365700", - "CDX-NAIGS11V2 - 1210", "CDX.NA.IG.11", - "CDX_NA_IG_S11_02Y_12/10_124/125", 2454731, 2455551, 0.0145, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCI4", "CDX", 11, "NA IG", null, "IG", 2, 2, - null, 0.9920000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924774", "9365684", - "CDX-NAIGS10V4 EUR - 0613", "CDX.NA.IG.10", - "CDX_NA_IG_S10_05Y_06/13_EUR_121/125", 2454547, 2456464, 0.0155, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYCH6 EUR", "CDX", 10, "NA IG", null, "IG", 4, 5, - null, 0.968, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924775", "9365689", - "CDX-NAIGFINS10V4 - 0613", "CDX.NA.IG.FIN.10", - "CDX_NA_IG_S10_FIN_06/13_20/24", 2454547, 2456464, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65B2CD5", "CDX", 10, "NA IG FIN", null, "IG", 4, 5, - null, 0.83333, 24, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924776", "9365701", - "CDX-NAIGS11V2 - 1211", "CDX.NA.IG.11", - "CDX_NA_IG_S11_03Y_12/11_124/125", 2454731, 2455916, 0.0145, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCI4", "CDX", 11, "NA IG", null, "IG", 2, 3, - null, 0.9920000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.7Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924778", "9365694", - "CDX-NAIGHVOLS10V3 - 0615", "CDX.NA.IG.HVOL.10", - "CDX_NA_IG_S10_HVOL_07Y_06/15_28/30", 2454547, 2457194, 0.035, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BI3", "CDX", 10, "NA IG HVOL", null, "HV", 3, 7, - null, 0.93333, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.10Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924779", "9365695", - "CDX-NAIGHVOLS10V3 - 0618", "CDX.NA.IG.HVOL.10", - "CDX_NA_IG_S10_HVOL_10Y_06/18_28/30", 2454547, 2458290, 0.035, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BI3", "CDX", 10, "NA IG HVOL", null, "HV", 3, 10, - null, 0.93333, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924781", "9365703", - "CDX-NAIGS11V2 - 1213", "CDX.NA.IG.11", - "CDX_NA_IG_S11_05Y_12/13_124/125", 2454731, 2456647, 0.015000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCI4", "CDX", 11, "NA IG", null, "IG", 2, 5, - null, 0.9920000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.1Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924783", "9365711", - "CDX-NAIGHVOLS11V2 - 1209", "CDX.NA.IG.HVOL.11", - "CDX_NA_IG_S11_HVOL_01Y_12/09_29/30", 2454731, 2455186, 0.04, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BJ1", "CDX", 11, "NA IG HVOL", null, "HV", 2, 1, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.2Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924786", "9365712", - "CDX-NAIGHVOLS11V2 - 1210", "CDX.NA.IG.HVOL.11", - "CDX_NA_IG_S11_HVOL_02Y_12/10_29/30", 2454731, 2455551, 0.04, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BJ1", "CDX", 11, "NA IG HVOL", null, "HV", 2, 2, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924787", "9365705", - "CDX-NAIGS11V2 - 1218", "CDX.NA.IG.11", - "CDX_NA_IG_S11_10Y_12/18_124/125", 2454731, 2458473, 0.014, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCI4", "CDX", 11, "NA IG", null, "IG", 2, 10, - null, 0.9920000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.4Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924788", "9365714", - "CDX-NAIGHVOLS11V2 - 1212", "CDX.NA.IG.HVOL.11", - "CDX_NA_IG_S11_HVOL_04Y_12/12_29/30", 2454731, 2456282, 0.04, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BJ1", "CDX", 11, "NA IG HVOL", null, "HV", 2, 4, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.10Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924790", "9365709", - "CDX-NAIGHVOLS11V2 - 1218", "CDX.NA.IG.HVOL.11", - "CDX_NA_IG_S11_HVOL_10Y_12/18_29/30", 2454731, 2458473, 0.035, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BJ1", "CDX", 11, "NA IG HVOL", null, "HV", 2, 10, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.7Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924792", "9365716", - "CDX-NAIGHVOLS11V2 - 1215", "CDX.NA.IG.HVOL.11", - "CDX_NA_IG_S11_HVOL_07Y_12/15_29/30", 2454731, 2457377, 0.036000000000000004, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BJ1", "CDX", 11, "NA IG HVOL", null, "HV", 2, 7, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924793", "9365721", - "CDX-NAIGS12V2 - 0613", "CDX.NA.IG.12", - "CDX_NA_IG_S12_04Y_06/13_124/125", 2454911, 2456464, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCJ2", "CDX", 12, "NA IG", null, "IG", 2, 4, - null, 0.9920000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.3Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924795", "9365690", - "CDX-NAIGHVOLS10V3 - 0611", "CDX.NA.IG.HVOL.10", - "CDX_NA_IG_S10_HVOL_03Y_06/11_28/30", 2454547, 2455733, 0.035, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BI3", "CDX", 10, "NA IG HVOL", null, "HV", 3, 3, - null, 0.93333, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924796", "9365692", - "CDX-NAIGHVOLS10V3 - 0613", "CDX.NA.IG.HVOL.10", - "CDX_NA_IG_S10_HVOL_05Y_06/13_28/30", 2454547, 2456464, 0.035, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BI3", "CDX", 10, "NA IG HVOL", null, "HV", 3, 5, - null, 0.93333, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.1Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924797", "9365718", - "CDX-NAIGS12V2 - 0610", "CDX.NA.IG.12", - "CDX_NA_IG_S12_01Y_06/10_124/125", 2454911, 2455368, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCJ2", "CDX", 12, "NA IG", null, "IG", 2, 1, - null, 0.9920000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.2Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924798", "9365719", - "CDX-NAIGS12V2 - 0611", "CDX.NA.IG.12", - "CDX_NA_IG_S12_02Y_06/11_124/125", 2454911, 2455733, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCJ2", "CDX", 12, "NA IG", null, "IG", 2, 2, - null, 0.9920000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924799", "9365720", - "CDX-NAIGS12V2 - 0612", "CDX.NA.IG.12", - "CDX_NA_IG_S12_03Y_06/12_124/125", 2454911, 2456099, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCJ2", "CDX", 12, "NA IG", null, "IG", 2, 3, - null, 0.9920000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924800", "9365725", - "CDX-NAIGS12V2 - 0619", "CDX.NA.IG.12", - "CDX_NA_IG_S12_10Y_06/19_124/125", 2454911, 2458655, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCJ2", "CDX", 12, "NA IG", null, "IG", 2, 10, - null, 0.9920000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924801", "9365732", - "CDX-NAIGHVOLS12V2 - 0614", "CDX.NA.IG.HVOL.12", - "CDX_NA_IG_S12_HVOL_05Y_06/14_29/30", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BK8", "CDX", 12, "NA IG HVOL", null, "HV", 2, 5, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924802", "9365722", - "CDX-NAIGS12V2 - 0614", "CDX.NA.IG.12", - "CDX_NA_IG_S12_05Y_06/14_124/125", 2454911, 2456829, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCJ2", "CDX", 12, "NA IG", null, "IG", 2, 5, - null, 0.9920000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.3Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924803", "9365730", - "CDX-NAIGHVOLS12V2 - 0612", "CDX.NA.IG.HVOL.12", - "CDX_NA_IG_S12_HVOL_03Y_06/12_29/30", 2454911, 2456099, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BK8", "CDX", 12, "NA IG HVOL", null, "HV", 2, 3, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924804", "9365724", - "CDX-NAIGS12V2 - 0616", "CDX.NA.IG.12", - "CDX_NA_IG_S12_07Y_06/16_124/125", 2454911, 2457560, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCJ2", "CDX", 12, "NA IG", null, "IG", 2, 7, - null, 0.9920000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.7Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924805", "9365733", - "CDX-NAIGHVOLS12V2 - 0616", "CDX.NA.IG.HVOL.12", - "CDX_NA_IG_S12_HVOL_07Y_06/16_29/30", 2454911, 2457560, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BK8", "CDX", 12, "NA IG HVOL", null, "HV", 2, 7, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924806", "9365723", - "CDX-NAIGS12V2 EUR - 0614", "CDX.NA.IG.12", - "CDX_NA_IG_S12_05Y_06/14_EUR_124/125", 2454911, 2456829, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYCJ2 EUR", "CDX", 12, "NA IG", null, "IG", 2, 5, - null, 0.9920000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924807", "9365727", - "CDX-NAIGFINS12V2 - 0614", "CDX.NA.IG.FIN.12", - "CDX_NA_IG_S12_FIN_06/14_20/21", 2454911, 2456829, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B2CF0", "CDX", 12, "NA IG FIN", null, "IG", 2, 5, - null, 0.95238, 21, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.1Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924808", "9365728", - "CDX-NAIGHVOLS12V2 - 0610", "CDX.NA.IG.HVOL.12", - "CDX_NA_IG_S12_HVOL_01Y_06/10_29/30", 2454911, 2455368, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BK8", "CDX", 12, "NA IG HVOL", null, "HV", 2, 1, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet32() - { - UpdateCDXRefDataMap ("CDX.NA IG HVOL.4Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924811", "9365731", - "CDX-NAIGHVOLS12V2 - 0613", "CDX.NA.IG.HVOL.12", - "CDX_NA_IG_S12_HVOL_04Y_06/13_29/30", 2454911, 2456464, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BK8", "CDX", 12, "NA IG HVOL", null, "HV", 2, 4, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.4Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924812", "9365691", - "CDX-NAIGHVOLS10V3 - 0612", "CDX.NA.IG.HVOL.10", - "CDX_NA_IG_S10_HVOL_04Y_06/12_28/30", 2454547, 2456099, 0.035, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BI3", "CDX", 10, "NA IG HVOL", null, "HV", 3, 4, - null, 0.93333, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.2Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924813", "9365729", - "CDX-NAIGHVOLS12V2 - 0611", "CDX.NA.IG.HVOL.12", - "CDX_NA_IG_S12_HVOL_02Y_06/11_29/30", 2454911, 2455733, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BK8", "CDX", 12, "NA IG HVOL", null, "HV", 2, 2, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924814", "9365735", - "CDX-NAIGHVOLS12V2 EUR - 0614", "CDX.NA.IG.HVOL.12", - "CDX_NA_IG_S12_HVOL_05Y_06/14 EUR_29/30", 2454911, 2456829, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I65B3BK8 EUR", "CDX", 12, "NA IG HVOL", null, "HV", 2, 5, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.2Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924815", "9365693", - "CDX-NAIGHVOLS10V3 - 0610", "CDX.NA.IG.HVOL.10", - "CDX_NA_IG_S10_HVOL_02Y_06/10_28/30", 2454547, 2455368, 0.035, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BI3", "CDX", 10, "NA IG HVOL", null, "HV", 3, 2, - null, 0.93333, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924816", "9365741", - "CDX-NAHYS13V2 - 1210", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_01YR_99/100", 2455096, 2455551, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHI4", "CDX", 13, "NA HY", null, "HY", 2, 1, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924817", "9365696", - "CDX-NAIGHVOLS10V3 EUR - 0613", "CDX.NA.IG.HVOL.10", - "CDX_NA_IG_S10_HVOL_05Y_06/13 EUR_28/30", 2454547, 2456464, 0.035, "EUR", - "ACT/360", false, 0.4, 4, "2I65B3BI3 EUR", "CDX", 10, "NA IG HVOL", null, "HV", 3, 5, - null, 0.93333, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924818", "9365742", - "CDX-NAHYS13V2 - 1211", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_02YR_99/100", 2455096, 2455916, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHI4", "CDX", 13, "NA HY", null, "HY", 2, 2, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924819", "9365702", - "CDX-NAIGS11V2 - 1212", "CDX.NA.IG.11", - "CDX_NA_IG_S11_04Y_12/12_124/125", 2454731, 2456282, 0.014, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCI4", "CDX", 11, "NA IG", null, "IG", 2, 4, - null, 0.9920000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924820", "9365708", - "CDX-NAIGFINS11V2 - 1213", "CDX.NA.IG.FIN.11", - "CDX_NA_IG_S11_FIN_12/13_20/21", 2454731, 2456647, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65B2CE3", "CDX", 11, "NA IG FIN", null, "IG", 2, 5, - null, 0.95238, 21, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924821", "9365704", - "CDX-NAIGS11V2 EUR - 1213", "CDX.NA.IG.11", - "CDX_NA_IG_S11_05Y_12/13_EUR_124/125", 2454731, 2456647, 0.015000000000000001, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYCI4 EUR", "CDX", 11, "NA IG", null, "IG", 2, 5, - null, 0.9920000000000001, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924822", "9365743", - "CDX-NAHYS13V2 - 1213", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_04YR_99/100", 2455096, 2456647, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHI4", "CDX", 13, "NA HY", null, "HY", 2, 4, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924823", "9365710", - "CDX-NAIGHVOLS11V2 EUR - 1213", "CDX.NA.IG.HVOL.11", - "CDX_NA_IG_S11_HVOL_05Y_12/13 EUR_29/30", 2454733, 2456647, 0.0385, "EUR", - "ACT/360", false, 0.4, 4, "2I65B3BJ1 EUR", "CDX", 11, "NA IG HVOL", null, "HV", 2, 5, - null, 0.96666, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924824", "9365744", - "CDX-NAHYS13V2 - 1215", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_06YR_99/100", 2455096, 2457377, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHI4", "CDX", 13, "NA HY", null, "HY", 2, 6, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924825", "9365746", - "CDX-NAHYHBS13V2 - 1214", "CDX.NA.HY.HB.13", - "CDX_NA_HY_S13_HB__SWP_29/30", 2455096, 2457012, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWES4", "CDX", 13, "NA HY HB", null, "HY", 2, 5, - null, 0.96666, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.25", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924826", "9366665", - "LCDXNAS8V25 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_76/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.55, 4, "5F199GCV7", "LCDX", 8, "LCDXNA", null, "IG", 25, 5, - null, 0.76, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924827", "9366608", - "LCDXNAS9V20 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_81/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.55, 4, "5F199GCW5", "LCDX", 9, "LCDXNA", null, "IG", 20, 5, - null, 0.81, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924828", "9366609", - "LCDXNAS10V21 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_80/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.65, 4, "5F199GCX3", "LCDX", 10, "LCDXNA", null, "IG", 21, 5, - null, 0.8, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.10.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924829", "9366678", - "LCDXNAS10V21 - 0611", "LCDX.NA.10", - "CDX_NA_LN_S10_100_03YR_80/100", 2454561, 2455733, 0.0275, "USD", - "ACT/360", false, 0.65, 4, "5F199GCX3", "LCDX", 10, "LCDXNA", null, "IG", 21, 3, - null, 0.8, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.12.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924830", "9366645", - "LCDXNAS12V10 - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_90/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.55, 4, "5F199GCY1", "LCDX", 12, "LCDXNA", null, "IG", 10, 5, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.12.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924831", "9366682", - "LCDXNAS12V10 - 0612", "LCDX.NA.12", - "CDX_NA_LN_S12_100_03YR_90/100", 2454938, 2456099, 0.05, "USD", - "ACT/360", false, 0.55, 4, "5F199GCY1", "LCDX", 12, "LCDXNA", null, "IG", 10, 3, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.6.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924832", "9365775", - "CDX-NAIGS6V6 EUR - 0611", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_05Y_6/11_EUR_121/127", 2453816, 2455733, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYCD5 EUR", "CDX", 6, "NA IG", null, "IG", 6, 5, - null, 0.956, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.6.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924833", "9365779", - "CDX-NAIGS6V6 - 0610", "Dow Jones CDX.NA.IG.6", - "DJCDX_NA_IG_S6_04Y_6/10_121/127", 2453816, 2455368, 0.003, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCD5", "CDX", 6, "NA IG", null, "IG", 6, 4, - null, 0.956, 127, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.7.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924834", "9365786", - "CDX-NAIGS7V5 EUR - 1211", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_05Y_12/11_EUR_121/126", 2454000, 2455916, 0.004, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYCE3 EUR", "CDX", 7, "NA IG", null, "IG", 5, 5, - null, 0.9640000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.7.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924835", "9365787", - "CDX-NAIGS7V5 - 1210", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_04Y_12/10_121/126", 2454000, 2455551, 0.0035, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCE3", "CDX", 7, "NA IG", null, "IG", 5, 4, - null, 0.9640000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.6.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924836", "9365781", - "CDX-NAIGFINS6V4 - 0611", "Dow Jones CDX.NA.IG.FIN.6", - "DJCDX_NA_IG_S6_FIN_6/11_20/24", 2453816, 2455733, 0.0025, "USD", - "ACT/360", false, 0.4, 4, "2I65B2BZ7", "CDX", 6, "NA IG FIN", null, "IG", 4, 5, - null, 0.83333, 24, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.25", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924843", "9366802", - "LCDXNAS8V25 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_76/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCV7", "LCDX", 8, "LCDXNA", null, "IG", 25, 10, - null, 0.76, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V25 FXD.LCDXNAV25 FXD.5Y.8.25", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924844", "9366803", - "LCDXNAS8V25 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_76/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCV7 FXD", "LCDXNAS8V25 FXD", 8, "LCDXNAV25 FXD", null, "IG", 25, 5, - null, 0.76, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.25", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924845", "9366805", - "LCDXNAS8V25 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_76/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCV7", "LCDX", 8, "LCDXNA", null, "IG", 25, 6, - null, 0.76, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.25", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924847", "9366804", - "LCDXNAS8V25 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_76/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCV7", "LCDX", 8, "LCDXNA", null, "IG", 25, 7, - null, 0.76, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.25", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924848", "9366807", - "LCDXNAS8V25 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_76/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCV7", "LCDX", 8, "LCDXNA", null, "IG", 25, 4, - null, 0.76, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.25", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924849", "9367096", - "LCDXNAS8V25 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_76/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCV7", "LCDX", 8, "LCDXNA", null, "IG", 25, 3, - null, 0.76, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.9.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924850", "9367098", - "LCDXNAS9V20 - 1209", "LCDX.NA.9", - "CDX_NA_LN_S09_100_02YR_81/100", 2454378, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCW5", "LCDX", 9, "LCDXNA", null, "IG", 20, 2, - null, 0.81, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V20 FXD.LCDXNAV20 FXD.5Y.9.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924851", "9367099", - "LCDXNAS9V20 FXD - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_FXD_81/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCW5 FXD", "LCDXNAS9V20 FXD", 9, "LCDXNAV20 FXD", null, "IG", 20, 5, - null, 0.81, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.9.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924852", "9367100", - "LCDXNAS9V20 - 1214", "LCDX.NA.9", - "CDX_NA_LN_S09_100_07YR_81/100", 2454378, 2457012, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCW5", "LCDX", 9, "LCDXNA", null, "IG", 20, 7, - null, 0.81, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.9.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924854", "9366753", - "LCDXNAS9V20 - 1210", "LCDX.NA.9", - "CDX_NA_LN_S09_100_03YR_81/100", 2454378, 2455551, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCW5", "LCDX", 9, "LCDXNA", null, "IG", 20, 3, - null, 0.81, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.9.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924855", "9366758", - "LCDXNAS9V20 - 1217", "LCDX.NA.9", - "CDX_NA_LN_S09_100_10YR_81/100", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCW5", "LCDX", 9, "LCDXNA", null, "IG", 20, 10, - null, 0.81, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.9.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924856", "9366759", - "LCDXNAS9V20 - 1211", "LCDX.NA.9", - "CDX_NA_LN_S09_100_04YR_81/100", 2454378, 2455916, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCW5", "LCDX", 9, "LCDXNA", null, "IG", 20, 4, - null, 0.81, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.9.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924857", "9366760", - "LCDXNAS9V20 - 1213", "LCDX.NA.9", - "CDX_NA_LN_S09_100_06YR_81/100", 2454378, 2456647, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GCW5", "LCDX", 9, "LCDXNA", null, "IG", 20, 6, - null, 0.81, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS10V21 FXD.LCDXNAV21 FXD.5Y.10.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924858", "9366809", - "LCDXNAS10V21 FXD - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_FXD_80/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCX3 FXD", "LCDXNAS10V21 FXD", 10, "LCDXNAV21 FXD", null, "IG", 21, 5, - null, 0.8, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.10.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924859", "9366810", - "LCDXNAS10V21 - 0614", "LCDX.NA.10", - "CDX_NA_LN_S10_100_06YR_80/100", 2454561, 2456829, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCX3", "LCDX", 10, "LCDXNA", null, "IG", 21, 6, - null, 0.8, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.10.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924860", "9366700", - "LCDXNAS10V21 - 0610", "LCDX.NA.10", - "CDX_NA_LN_S10_100_02YR_80/100", 2454561, 2455368, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCX3", "LCDX", 10, "LCDXNA", null, "IG", 21, 2, - null, 0.8, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.10.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924861", "9366699", - "LCDXNAS10V21 - 0615", "LCDX.NA.10", - "CDX_NA_LN_S10_100_07YR_80/100", 2454561, 2457194, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCX3", "LCDX", 10, "LCDXNA", null, "IG", 21, 7, - null, 0.8, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.10.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924863", "9366646", - "LCDXNAS10V21 - 0618", "LCDX.NA.10", - "CDX_NA_LN_S10_100_10YR_80/100", 2454561, 2458290, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCX3", "LCDX", 10, "LCDXNA", null, "IG", 21, 10, - null, 0.8, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.10.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924864", "9366962", - "LCDXNAS10V21 - 0612", "LCDX.NA.10", - "CDX_NA_LN_S10_100_04YR_80/100", 2454561, 2456099, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GCX3", "LCDX", 10, "LCDXNA", null, "IG", 21, 4, - null, 0.8, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.12.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924865", "9366980", - "LCDXNAS12V10 - 0610", "LCDX.NA.12", - "CDX_NA_LN_S12_100_01YR_90/100", 2454938, 2455368, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCY1", "LCDX", 12, "LCDXNA", null, "IG", 10, 1, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS12V10 FXD.LCDXNAV10 FXD.5Y.12.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924866", "9366982", - "LCDXNAS12V10 FXD - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_FXD_90/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCY1 FXD", "LCDXNAS12V10 FXD", 12, "LCDXNAV10 FXD", null, "IG", 10, 5, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.12.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924867", "9366984", - "LCDXNAS12V10 - 0611", "LCDX.NA.12", - "CDX_NA_LN_S12_100_02YR_90/100", 2454938, 2455733, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCY1", "LCDX", 12, "LCDXNA", null, "IG", 10, 2, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.12.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924868", "9366610", - "LCDXNAS12V10 - 0616", "LCDX.NA.12", - "CDX_NA_LN_S12_100_07YR_90/100", 2454938, 2457560, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCY1", "LCDX", 12, "LCDXNA", null, "IG", 10, 7, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.12.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924869", "9366625", - "LCDXNAS12V10 - 0619", "LCDX.NA.12", - "CDX_NA_LN_S12_100_10YR_90/100", 2454938, 2458655, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCY1", "LCDX", 12, "LCDXNA", null, "IG", 10, 10, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.12.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924870", "9366628", - "LCDXNAS12V10 - 0613", "LCDX.NA.12", - "CDX_NA_LN_S12_100_04YR_90/100", 2454938, 2456464, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCY1", "LCDX", 12, "LCDXNA", null, "IG", 10, 4, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.12.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924871", "9366630", - "LCDXNAS12V10 - 0615", "LCDX.NA.12", - "CDX_NA_LN_S12_100_06YR_90/100", 2454938, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GCY1", "LCDX", 12, "LCDXNA", null, "IG", 10, 6, - null, 0.9, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924885", "9369008", - "USD ITRAXX-XOVERS9V4 - 0613", "iTraxx Europe Crossover series 9 Version 4", - "ITRAXX-XOVERS9V4-0613 USD SEN MMR I03 CDS", 2454546, 2456464, 0.065, "USD", - "ACT/360", false, 0.4, 4, "2I667KBA5", "USD ITRAXX", 9, "XOVER", "XVR", "XO", 4, 5, - null, 0.9400000000000001, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924886", "9369104", - "ITRAXX-XOVERS9V4 - 0611", "iTraxx Europe Crossover series 9 Version 4", - "ITRAXX-XOVERS9V4-0611 EUR SEN MMR I03 CDS", 2454546, 2455733, 0.0625, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBA5", "ITRAXX", 9, "XOVER", "XVR", "XO", 4, 3, - "244498", 0.9400000000000001, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924887", "9369111", - "ITRAXX-XOVERS9V4 - 0613", "iTraxx Europe Crossover series 9 Version 4", - "ITRAXX-XOVERS9V4-0613 EUR SEN MMR I03 CDS", 2454546, 2456464, 0.065, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBA5", "ITRAXX", 9, "XOVER", "XVR", "XO", 4, 5, - "244498", 0.9400000000000001, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924888", "9369114", - "ITRAXX-XOVERS9V4 - 0618", "iTraxx Europe Crossover series 9 Version 4", - "ITRAXX-XOVERS9V4-0618 EUR SEN MMR I03 CDS", 2454546, 2458290, 0.064, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBA5", "ITRAXX", 9, "XOVER", "XVR", "XO", 4, 10, - "244498", 0.9400000000000001, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924891", "9369163", - "ITRAXX-XOVERS7V3 - 0612", "iTraxx Europe Crossover series 7 Version 3", - "ITRAXX-XOVERS7V3-0612 EUR SEN MMR I03 CDS", 2454180, 2456099, 0.023, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAY4", "ITRAXX", 7, "XOVER", "XVR", "XO", 3, 5, - "244499", 0.96, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924892", "9369164", - "ITRAXX-XOVERS7V3 - 0617", "iTraxx Europe Crossover series 7 Version 3", - "ITRAXX-XOVERS7V3-0617 EUR SEN MMR I03 CDS", 2454180, 2457925, 0.032, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAY4", "ITRAXX", 7, "XOVER", "XVR", "XO", 3, 10, - "244499", 0.96, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924893", "9369165", - "USD ITRAXX-XOVERS7V3 - 0612", "iTraxx Europe Crossover series 7 Version 3", - "ITRAXX-XOVERS7V3-0612 USD SEN MMR I03 CDS", 2454180, 2456099, 0.023, "USD", - "ACT/360", false, 0.4, 4, "2I667KAY4", "USD ITRAXX", 7, "XOVER", "XVR", "XO", 3, 5, - null, 0.96, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924894", "9369167", - "ITRAXX-XOVERS8V4 - 1210", "iTraxx Europe Crossover series 8 Version 4", - "ITRAXX-XOVERS8V4-1210 EUR SEN MMR I03 CDS", 2454364, 2455551, 0.027, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAZ1", "ITRAXX", 8, "XOVER", "XVR", "XO", 4, 3, - "244501", 0.9400000000000001, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924895", "9369169", - "ITRAXX-XOVERS8V4 - 1212", "iTraxx Europe Crossover series 8 Version 4", - "ITRAXX-XOVERS8V4-1212 EUR SEN MMR I03 CDS", 2454364, 2456282, 0.0375, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAZ1", "ITRAXX", 8, "XOVER", "XVR", "XO", 4, 5, - "244501", 0.9400000000000001, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924896", "9369170", - "ITRAXX-XOVERS8V4 - 1214", "iTraxx Europe Crossover series 8 Version 4", - "ITRAXX-XOVERS8V4-1214 EUR SEN MMR I03 CDS", 2454364, 2457012, 0.039, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAZ1", "ITRAXX", 8, "XOVER", "XVR", "XO", 4, 7, - "244501", 0.9400000000000001, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924897", "9369171", - "ITRAXX-XOVERS8V4 - 1217", "iTraxx Europe Crossover series 8 Version 4", - "ITRAXX-XOVERS8V4-1217 EUR SEN MMR I03 CDS", 2454364, 2458108, 0.046, "EUR", - "ACT/360", false, 0.4, 4, "2I667KAZ1", "ITRAXX", 8, "XOVER", "XVR", "XO", 4, 10, - "244501", 0.9400000000000001, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924898", "9369001", - "USD ITRAXX-XOVERS8V4 - 1212", "iTraxx Europe Crossover series 8 Version 4", - "ITRAXX-XOVERS8V4-1212 USD SEN MMR I03 CDS", 2454364, 2456282, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I667KAZ1", "USD ITRAXX", 8, "XOVER", "XVR", "XO", 4, 5, - null, 0.9400000000000001, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("LevXSenS1V14.LevXSen.5Y.1.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924900", "9369918", - "LevXSenS1V14 - 1211", "ITRAXX LEVX SENIOR SERIES 1 VERSION 14", - "ITRAXX LEVX SENIOR SERIES 1 VERSION 14 EUR 1ST SEC MMR I03 CDS", 2453999, 2455916, 0.017, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJBP7", "LevXSenS1V14", 1, "LevXSen", null, "IG", 14, 5, - null, 0.62854, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.CEEMEA.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924920", "9375326", - "ITRAXX-CEEMEAS3V1 - 0615", "iTraxx SovX CEEMEA Series 3 Version 1", - "ITRAXX-SOVX CEEMEA S3V1-0615 USD SEN RES I03 CDS", 2455217, 2457194, 0.01, "USD", - "ACT/360", false, 0.25, 4, "5C769NAC3", "ITRAXX", 3, "CEEMEA", "SOVXCEM", "SOCE", 1, 5, - "244720", 1, 15, 0, "LON", true, true, true, "ITRXEX54", "SOVXCEM")); - - UpdateCDXRefDataMap ("ITRAXX.CEEMEA.10Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924921", "9375329", - "ITRAXX-CEEMEAS3V1 - 0620", "iTraxx SovX CEEMEA Series 3 Version 1", - "ITRAXX-SOVX CEEMEA S3V1-0620 USD SEN RES I03 CDS", 2455217, 2459021, 0.01, "USD", - "ACT/360", false, 0.25, 4, "5C769NAC3", "ITRAXX", 3, "CEEMEA", "SOVXCEM", "SOCE", 1, 10, - "244720", 1, 15, 0, "LON", true, true, true, "ITRXEX54", "SOVXCEM")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.26", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924922", "9376265", - "LCDXNAS8V26 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_75/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.65, 4, "5F199GCZ8", "LCDX", 8, "LCDXNA", null, "IG", 26, 5, - null, 0.75, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924923", "9376267", - "LCDXNAS9V21 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_80/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.65, 4, "5F199GDA2", "LCDX", 9, "LCDXNA", null, "IG", 21, 5, - null, 0.8, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.26", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924926", "9376995", - "LCDXNAS8V26 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_75/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCZ8", "LCDX", 8, "LCDXNA", null, "IG", 26, 10, - null, 0.75, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V26 FXD.LCDXNAV26 FXD.5Y.8.26", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924927", "9376996", - "LCDXNAS8V26 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_75/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCZ8 FXD", "LCDXNAS8V26 FXD", 8, "LCDXNAV26 FXD", null, "IG", 26, 5, - null, 0.75, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.26", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924928", "9376998", - "LCDXNAS8V26 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_75/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCZ8", "LCDX", 8, "LCDXNA", null, "IG", 26, 6, - null, 0.75, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.26", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924929", "9376999", - "LCDXNAS8V26 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_75/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCZ8", "LCDX", 8, "LCDXNA", null, "IG", 26, 7, - null, 0.75, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.26", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924930", "9377000", - "LCDXNAS8V26 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_75/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCZ8", "LCDX", 8, "LCDXNA", null, "IG", 26, 4, - null, 0.75, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.26", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924931", "9377001", - "LCDXNAS8V26 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_75/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GCZ8", "LCDX", 8, "LCDXNA", null, "IG", 26, 3, - null, 0.75, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.9.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924932", "9377393", - "LCDXNAS9V21 - 1209", "LCDX.NA.9", - "CDX_NA_LN_S09_100_02YR_80/100", 2454378, 2455186, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDA2", "LCDX", 9, "LCDXNA", null, "IG", 21, 2, - null, 0.8, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V21 FXD.LCDXNAV21 FXD.5Y.9.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924933", "9377394", - "LCDXNAS9V21 FXD - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_FXD_80/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDA2 FXD", "LCDXNAS9V21 FXD", 9, "LCDXNAV21 FXD", null, "IG", 21, 5, - null, 0.8, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.9.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924934", "9377396", - "LCDXNAS9V21 - 1214", "LCDX.NA.9", - "CDX_NA_LN_S09_100_07YR_80/100", 2454378, 2457012, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDA2", "LCDX", 9, "LCDXNA", null, "IG", 21, 7, - null, 0.8, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.9.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924935", "9377397", - "LCDXNAS9V21 - 1210", "LCDX.NA.9", - "CDX_NA_LN_S09_100_03YR_80/100", 2454378, 2455551, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDA2", "LCDX", 9, "LCDXNA", null, "IG", 21, 3, - null, 0.8, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.9.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924936", "9377002", - "LCDXNAS9V21 - 1217", "LCDX.NA.9", - "CDX_NA_LN_S09_100_10YR_80/100", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDA2", "LCDX", 9, "LCDXNA", null, "IG", 21, 10, - null, 0.8, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.9.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924937", "9377003", - "LCDXNAS9V21 - 1211", "LCDX.NA.9", - "CDX_NA_LN_S09_100_04YR_80/100", 2454378, 2455916, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDA2", "LCDX", 9, "LCDXNA", null, "IG", 21, 4, - null, 0.8, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.9.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924938", "9377004", - "LCDXNAS9V21 - 1213", "LCDX.NA.9", - "CDX_NA_LN_S09_100_06YR_80/100", 2454378, 2456647, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDA2", "LCDX", 9, "LCDXNA", null, "IG", 21, 6, - null, 0.8, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANFIN.5Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924939", "9378186", - "ITRAXX-JAPANFINS2V2 - 0310", "iTraxx Japan Financials Series Number 2 Version 2", - "ITRAXX JAPAN FINANCIALS SERIES NUMBER 02 VERSION 2 JPY SEN RES I03 CDS", 2453269, 2455276, 0.0035, "JPY", - "ACT/360", false, 0.3, 4, "2I668LAE5", "ITRAXX", 2, "JAPANFIN", null, "IG", 2, 5, - null, 0.9, 9, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924940", "9378187", - "ITRAXX-JAPANHIVOLS2V2 - 0310", "iTraxx Japan HiVol Series Number 2 Version 2", - "ITRAXX JAPAN HIVOL SERIES NUMBER 02 VERSION 2 JPY SEN RES I03 CDS", 2453269, 2455276, 0.005, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MAJ2", "ITRAXX", 2, "JAPANHIVOL", "VOL", "HV", 2, 5, - null, 0.9, 10, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924941", "9378097", - "ITRAXX-JAPANHIVOLS7V2 - 0612", "iTraxx Japan HiVol Series Number 7 Version 2", - "ITRAXX JAPAN HIVOL SERIES NUMBER 07 VERSION 2 JPY SEN RES I03 CDS", 2454180, 2456099, 0.006, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MAP8", "ITRAXX", 7, "JAPANHIVOL", "VOL", "HV", 2, 5, - null, 0.96, 24, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924942", "9378191", - "ITRAXX-JAPANS2V2 - 0310", "iTraxx Japan Series Number 2 Version 2", - "ITRAXX JAPAN SERIES NUMBER 02 VERSION 2 JPY SEN RES I03 CDS", 2453269, 2455276, 0.0025, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAN4", "ITRAXX", 2, "JAPAN", null, "IG", 2, 5, - null, 0.98, 49, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924943", "9378098", - "ITRAXX-JAPANS7V2 - 0612", "iTraxx Japan Series Number 7 Version 2", - "ITRAXX JAPAN SERIES NUMBER 07 VERSION 2 JPY SEN RES I03 CDS", 2454180, 2456099, 0.0025, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAT1", "ITRAXX", 7, "JAPAN", null, "IG", 2, 5, - null, 0.98, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924944", "9378192", - "ITRAXX-JAPANS2V2 - 0315", "ITRAXX JAPAN SERIES NUMBER 2 VERSION 2", - "ITRAXX JAPAN SERIES NUMBER 02 VERSION 2 JPY SEN RES I03 CDS 10Y", 2453269, 2457102, 0.0035, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAN4", "ITRAXX", 2, "JAPAN", null, "IG", 2, 10, - null, 0.98, 49, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924945", "9378067", - "ITRAXX-JAPANS3V2 - 0610", "iTraxx Japan Series Number 3 Version 2", - "ITRAXX JAPAN SERIES NUMBER 03 VERSION 2 JPY SEN RES I03 CDS", 2453451, 2455368, 0.002, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAP9", "ITRAXX", 3, "JAPAN", null, "IG", 2, 5, - null, 0.98, 49, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN80.5Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924946", "9378095", - "ITRAXX-JAPAN80S8V2 - 1212", "iTraxx Japan 80 Series Number 8 Version 2", - "ITRAXX JAPAN 80 SERIES NUMBER 08 VERSION 2 JPY SEN RES I03 CDS", 2454364, 2456282, 0.003, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "4ABCAHAD9", "ITRAXX", 8, "JAPAN80", null, "IG", 2, 5, - null, 0.9875, 80, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924947", "9378071", - "ITRAXX-JAPANS4V2 - 1210", "iTraxx Japan Series Number 4 Version 2", - "ITRAXX JAPAN SERIES NUMBER 04 VERSION 2 JPY SEN RES I03 CDS", 2453634, 2455551, 0.002, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAQ7", "ITRAXX", 4, "JAPAN", null, "IG", 2, 5, - null, 0.98, 49, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANFIN.5Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924948", "9378146", - "ITRAXX-JAPANFINS5V2 - 0611", "iTraxx Japan Financials Series Number 5 Version 2", - "ITRAXX JAPAN FINANCIALS SERIES NUMBER 05 VERSION 2 JPY SEN RES I03 CDS", 2453815, 2455733, 0.003, "JPY", - "ACT/360", false, 0.3, 4, "2I668LAH8", "ITRAXX", 5, "JAPANFIN", null, "IG", 2, 5, - null, 0.9, 10, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924949", "9378099", - "ITRAXX-JAPANHIVOLS8V2 - 1212", "iTraxx Japan HiVol Series Number 8 Version 2", - "ITRAXX JAPAN HIVOL SERIES NUMBER 08 VERSION 2 JPY SEN RES I03 CDS", 2454364, 2456282, 0.007500000000000001, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MAQ6", "ITRAXX", 8, "JAPANHIVOL", "VOL", "HV", 2, 5, - null, 0.96, 25, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924950", "9378147", - "ITRAXX-JAPANS5V2 - 0611", "iTraxx Japan Series Number 5 Version 2", - "ITRAXX JAPAN SERIES NUMBER 05 VERSION 2 JPY SEN RES I03 CDS", 2453815, 2455733, 0.0025, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAR5", "ITRAXX", 5, "JAPAN", null, "IG", 2, 5, - null, 0.98, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924951", "9378102", - "ITRAXX-JAPANS8V2 - 1212", "iTraxx Japan Series Number 8 Version 2", - "ITRAXX JAPAN SERIES NUMBER 08 VERSION 2 JPY SEN RES I03 CDS", 2454364, 2456282, 0.003, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAU8", "ITRAXX", 8, "JAPAN", null, "IG", 2, 5, - null, 0.98, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924952", "9378149", - "ITRAXX-JAPANS5V2 - 0616", "iTraxx Japan Series Number 5 Version 2", - "ITRAXX JAPAN SERIES NUMBER 05 VERSION 2 JPY SEN RES I03 CDS 10Y", 2453815, 2457560, 0.004, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAR5", "ITRAXX", 5, "JAPAN", null, "IG", 2, 10, - null, 0.98, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924953", "9378193", - "ITRAXX-JAPANHIVOLS9V2 - 0613", "iTraxx Japan HiVol Series Number 9 Version 2", - "ITRAXX JAPAN HIVOL SERIES NUMBER 09 VERSION 2 JPY SEN RES I03 CDS", 2454546, 2456464, 0.035, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MAR4", "ITRAXX", 9, "JAPANHIVOL", "VOL", "HV", 2, 5, - null, 0.96, 25, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924954", "9378381", - "ITRAXX-JAPANHIVOLS6V2 - 1211", "iTraxx Japan HiVol Series Number 6 Version 2", - "ITRAXX JAPAN HIVOL SERIES NUMBER 06 VERSION 2 JPY SEN RES I03 CDS", 2453999, 2455916, 0.0055000000000000005, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MAN3", "ITRAXX", 6, "JAPANHIVOL", "VOL", "HV", 2, 5, - null, 0.96, 24, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924955", "9378090", - "ITRAXX-JAPANS6V2 - 1211", "iTraxx Japan Series Number 6 Version 2", - "ITRAXX JAPAN SERIES NUMBER 06 VERSION 2 JPY SEN RES I03 CDS", 2453999, 2455916, 0.0025, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAS3", "ITRAXX", 6, "JAPAN", null, "IG", 2, 5, - null, 0.98, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924956", "9378198", - "ITRAXX-JAPANS9V2 - 0613", "iTraxx Japan Series Number 9 Version 2", - "ITRAXX JAPAN SERIES NUMBER 09 VERSION 2 JPY SEN RES I03 CDS", 2454546, 2456464, 0.022000000000000002, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAV6", "ITRAXX", 9, "JAPAN", null, "IG", 2, 5, - null, 0.98, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - return true; - } - - private static final boolean InitCDXRefDataSet33() - { - UpdateCDXRefDataMap ("ITRAXX.JAPAN80.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924957", "9378092", - "ITRAXX-JAPAN80S7V2 - 0612", "iTraxx Japan 80 Series Number 7 Version 2", - "ITRAXX JAPAN 80 SERIES NUMBER 07 VERSION 2 JPY SEN RES I03 CDS", 2454180, 2456099, 0.0025, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "4ABCAHAC1", "ITRAXX", 7, "JAPAN80", null, "IG", 2, 5, - null, 0.9875, 79, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.10.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924958", "9378204", - "ITRAXX-JAPANS10V2 - 1213", "ITRAXX JAPAN SERIES NUMBER 10 VERSION 2", - "ITRAXX JAPAN SERIES NUMBER 10 VERSION 2 JPY SEN RES I03 CDS", 2454739, 2456647, 0.015000000000000001, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAW4", "ITRAXX", 10, "JAPAN", null, "JPHG", 2, 5, - null, 0.98, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924959", "9378212", - "ITRAXX-JAPANS11V2 - 0614", "iTraxx Japan Series Number 11 Version 2", - "ITRAXX JAPAN SERIES NUMBER 11 VERSION 2 JPY SEN RES I03 CDS", 2454914, 2456829, 0.05, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAX2", "ITRAXX", 11, "JAPAN", null, "JPHG", 2, 5, - null, 0.98, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.10Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924962", "9378906", - "ITRAXX-JAPANHIVOLS2V2 - 0315", "iTraxx Japan HiVol Series Number 2 Version 2", - "ITRAXX JAPAN HIVOL SERIES NUMBER 02 VERSION 2 JPY SEN RES I03 CDS 10Y", 2453269, 2457102, 0.007, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MAJ2", "ITRAXX", 2, "JAPANHIVOL", "VOL", "HV", 2, 10, - null, 0.9, 10, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANFIN.10Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924963", "9378910", - "ITRAXX-JAPANFINS2V2 - 0315", "iTraxx Japan Financials Series Number 2 Version 2", - "ITRAXX JAPAN FINANCIALS SERIES NUMBER 02 VERSION 2 JPY SEN RES I03 CDS 10Y", 2453269, 2457102, 0.005, "JPY", - "ACT/360", false, 0.3, 4, "2I668LAE5", "ITRAXX", 2, "JAPANFIN", null, "IG", 2, 10, - null, 0.9, 9, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924964", "9378916", - "ITRAXX-JAPANS3V2 - 0615", "iTraxx Japan Series Number 3 Version 2", - "ITRAXX JAPAN SERIES NUMBER 03 VERSION 2 JPY SEN RES I03 CDS 10Y", 2453451, 2457194, 0.0035, "JPY", - "ACT/360", false, 0, 4, "2I668HAP9", "ITRAXX", 3, "JAPAN", null, "IG", 2, 10, - null, 0.98, 49, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924965", "9378923", - "ITRAXX-JAPANS4V2 - 1215", "iTraxx Japan Series Number 4 Version 2", - "ITRAXX JAPAN SERIES NUMBER 04 VERSION 2 JPY SEN RES I03 CDS 10Y", 2453634, 2457377, 0.003, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAQ7", "ITRAXX", 4, "JAPAN", null, "IG", 2, 10, - null, 0.98, 49, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924966", "9378914", - "ITRAXX-JAPANS6V2 - 1216", "iTraxx Japan Series Number 6 Version 2", - "ITRAXX JAPAN SERIES NUMBER 06 VERSION 2 JPY SEN RES I03 CDS 10Y", 2453999, 2457743, 0.004, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAS3", "ITRAXX", 6, "JAPAN", null, "IG", 2, 10, - null, 0.98, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("EUR ITRAXX.JAPANHIVOL.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924967", "9378918", - "EUR ITRAXX-JAPANHIVOLS6V2 - 1211", "iTraxx Japan HiVol Series Number 6 Version 2", - "ITRAXX JAPAN HIVOL SERIES NUMBER 06 VERSION 2 EUR SEN RES I03 CDS", 2453999, 2455916, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.35000000000000003, 4, "2I668MAN3", "EUR ITRAXX", 6, "JAPANHIVOL", "VOL", "HV", 2, 5, - null, 0.96, 24, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924968", "9378901", - "ITRAXX-JAPANS7V2 - 0617", "iTraxx Japan Series Number 7 Version 2", - "ITRAXX JAPAN SERIES NUMBER 07 VERSION 2 JPY SEN RES I03 CDS 10Y", 2454180, 2457925, 0.0035, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAT1", "ITRAXX", 7, "JAPAN", null, "IG", 2, 10, - null, 0.98, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.3Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924969", "9378905", - "ITRAXX-JAPANS7V2 - 0610", "iTraxx Japan Series Number 7 Version 2", - "ITRAXX JAPAN SERIES NUMBER 07 VERSION 2 JPY SEN RES I03 CDS 3Y", 2454180, 2455368, 0.0015, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAT1", "ITRAXX", 7, "JAPAN", null, "IG", 2, 3, - null, 0.98, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JHIVOL.5Y.7.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924970", "9378902", - "ITRAXX-JHIVOLS7V2 - 1212", "iTraxx Japan HiVol Series Number 7 Version 2", - "ITRAXX JAPAN HIVOL SERIES NUMBER 07 VERSION 2 JPY SEN RES I03 CDS DEC 20 2012", 2454180, 2456282, 0.006, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MAP8", "ITRAXX", 7, "JHIVOL", "VOL", "HV", 2, 5, - null, 0.96, 24, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924971", "9378907", - "ITRAXX-JAPANS8V2 - 1217", "iTraxx Japan Series Number 8 Version 2", - "ITRAXX JAPAN SERIES NUMBER 08 VERSION 2 JPY SEN RES I03 CDS 10Y", 2454364, 2458108, 0.0045000000000000005, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAU8", "ITRAXX", 8, "JAPAN", null, "IG", 2, 10, - null, 0.98, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.3Y.8.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924972", "9378909", - "ITRAXX-JAPANS8V2 - 1210", "iTraxx Japan Series Number 8 Version 2", - "ITRAXX JAPAN SERIES NUMBER 08 VERSION 2 JPY SEN RES I03 CDS 3Y", 2454364, 2455551, 0.002, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAU8", "ITRAXX", 8, "JAPAN", null, "IG", 2, 3, - null, 0.98, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924973", "9378912", - "ITRAXX-JAPANS9V2 - 0618", "iTraxx Japan Series Number 9 Version 2", - "ITRAXX JAPAN SERIES NUMBER 09 VERSION 2 JPY SEN RES I03 CDS 10Y", 2454546, 2458290, 0.024, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAV6", "ITRAXX", 9, "JAPAN", null, "IG", 2, 10, - null, 0.98, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.3Y.9.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924974", "9378924", - "ITRAXX-JAPANS9V2 - 0611", "iTraxx Japan Series Number 9 Version 2", - "ITRAXX JAPAN SERIES NUMBER 09 VERSION 2 JPY SEN RES I03 CDS 3Y", 2454546, 2455733, 0.02, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAV6", "ITRAXX", 9, "JAPAN", null, "IG", 2, 3, - null, 0.98, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924975", "9378928", - "ITRAXX-JAPANS11V2 - 0619", "iTraxx Japan Series Number 11 Version 2", - "ITRAXX JAPAN SERIES NUMBER 11 VERSION 2 JPY SEN RES I03 CDS 10Y", 2454914, 2458655, 0.05, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAX2", "ITRAXX", 11, "JAPAN", null, "JPHG", 2, 10, - null, 0.98, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.3Y.11.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924976", "9378936", - "ITRAXX-JAPANS11V2 - 0612", "iTraxx Japan Series Number 11 Version 2", - "ITRAXX JAPAN SERIES NUMBER 11 VERSION 2 JPY SEN RES I03 CDS 3Y", 2454914, 2456099, 0.015000000000000001, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAX2", "ITRAXX", 11, "JAPAN", null, "JPHG", 2, 3, - null, 0.98, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924980", "9378628", - "ITRAXX-JAPANHIVOLS5V2 - 0611", "iTraxx Japan HiVol Series Number 5 Version 2", - "ITRAXX JAPAN HIVOL SERIES NUMBER 05 VERSION 2 JPY SEN RES I03 CDS", 2453815, 2455733, 0.0045000000000000005, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MAM5", "ITRAXX", 5, "JAPANHIVOL", "VOL", "HV", 2, 5, - null, 1, 10, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.CJAPAN.5Y.1.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("924982", "9378627", - "ITRAXX-CJAPANS1V2 - 0909", "iTraxx Japan Series Number 1 Version 2", - "ITRAXX JAPAN SERIES NUMBER 01 VERSION 2 JPY SEN RES I03 CDS", 2453214, 2455096, 0.0025, "JPY", - "ACT/360", false, 0.4, 4, "2I668HAM6", "ITRAXX", 1, "CJAPAN", null, "IG", 2, 5, - null, 0.98, 49, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.2.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925002", "9384088", - "ITRAXX-JAPANHIVOLS2V3 - 0310", "iTraxx Japan HiVol Series Number 2 Version 3", - "ITRAXX JAPAN HIVOL SERIES NUMBER 02 VERSION 3 JPY SEN RES I03 CDS", 2453269, 2455276, 0.005, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MAS2", "ITRAXX", 2, "JAPANHIVOL", "VOL", "HV", 3, 5, - null, 0.8, 10, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.10Y.2.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925003", "9384092", - "ITRAXX-JAPANHIVOLS2V3 - 0315", "iTraxx Japan HiVol Series Number 2 Version 3", - "ITRAXX JAPAN HIVOL SERIES NUMBER 02 VERSION 3 JPY SEN RES I03 CDS 10Y", 2453269, 2457102, 0.007, "JPY", - "ACT/360", false, 0.4, 4, "2I668MAS2", "ITRAXX", 2, "JAPANHIVOL", "VOL", "HV", 3, 10, - null, 0.8, 10, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925004", "9384097", - "ITRAXX-JAPANHIVOLS6V3 - 1211", "iTraxx Japan HiVol Series Number 6 Version 3", - "ITRAXX JAPAN HIVOL SERIES NUMBER 06 VERSION 3 JPY SEN RES I03 CDS", 2453999, 2455916, 0.0055000000000000005, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MAU7", "ITRAXX", 6, "JAPANHIVOL", "VOL", "HV", 3, 5, - null, 0.92, 24, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("EUR ITRAXX.JAPANHIVOL.5Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925006", "9384100", - "EUR ITRAXX-JAPANHIVOLS6V3 - 1211", "iTraxx Japan HiVol Series Number 6 Version 3", - "ITRAXX JAPAN HIVOL SERIES NUMBER 06 VERSION 3 EUR SEN RES I03 CDS", 2453999, 2455916, 0.0055000000000000005, "EUR", - "ACT/360", false, 0, 4, "2I668MAU7", "EUR ITRAXX", 6, "JAPANHIVOL", "VOL", "HV", 3, 5, - null, 0.92, 24, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925007", "9383852", - "ITRAXX-JAPANHIVOLS7V3 - 0612", "iTraxx Japan HiVol Series Number 7 Version 3", - "ITRAXX JAPAN HIVOL SERIES NUMBER 07 VERSION 3 JPY SEN RES I03 CDS", 2454180, 2456099, 0.006, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MAV5", "ITRAXX", 7, "JAPANHIVOL", "VOL", "HV", 3, 5, - null, 0.92, 24, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JHIVOL.5Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925008", "9384103", - "ITRAXX-JHIVOLS7V3 - 1212", "iTraxx Japan HiVol Series Number 7 Version 3", - "ITRAXX JAPAN HIVOL SERIES NUMBER 07 VERSION 3 JPY SEN RES I03 CDS DEC 20 2012", 2454180, 2456282, 0.006, "JPY", - "ACT/360", false, 0.4, 4, "2I668MAV5", "ITRAXX", 7, "JHIVOL", "VOL", "HV", 3, 5, - null, 0.92, 24, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.2.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925010", "9383849", - "ITRAXX-JAPANS2V3 - 0310", "iTraxx Japan Series Number 2 Version 3", - "ITRAXX JAPAN SERIES NUMBER 02 VERSION 3 JPY SEN RES I03 CDS", 2453269, 2455276, 0.0025, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAZ7", "ITRAXX", 2, "JAPAN", null, "IG", 3, 5, - null, 0.96, 49, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925013", "9383860", - "ITRAXX-JAPANHIVOLS8V3 - 1212", "iTraxx Japan HiVol Series Number 8 Version 3", - "ITRAXX JAPAN HIVOL SERIES NUMBER 08 VERSION 3 JPY SEN RES I03 CDS", 2454364, 2456282, 0.007500000000000001, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MAW3", "ITRAXX", 8, "JAPANHIVOL", "VOL", "HV", 3, 5, - null, 0.92, 25, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925014", "9383858", - "ITRAXX-JAPANHIVOLS9V3 - 0613", "iTraxx Japan HiVol Series Number 9 Version 3", - "ITRAXX JAPAN HIVOL SERIES NUMBER 09 VERSION 3 JPY SEN RES I03 CDS", 2454546, 2456464, 0.035, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MAX1", "ITRAXX", 9, "JAPANHIVOL", "VOL", "HV", 3, 5, - null, 0.92, 25, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.2.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925015", "9383851", - "ITRAXX-JAPANS2V3 - 0315", "ITRAXX JAPAN SERIES NUMBER 2 VERSION 3", - "ITRAXX JAPAN SERIES NUMBER 02 VERSION 3 JPY SEN RES I03 CDS 10Y", 2453269, 2457102, 0.0035, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HAZ7", "ITRAXX", 2, "JAPAN", null, "IG", 3, 10, - null, 0.96, 49, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.3.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925021", "9383853", - "ITRAXX-JAPANS3V3 - 0610", "iTraxx Japan Series Number 3 Version 3", - "ITRAXX JAPAN SERIES NUMBER 03 VERSION 3 JPY SEN RES I03 CDS", 2453451, 2455368, 0.002, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBA1", "ITRAXX", 3, "JAPAN", null, "IG", 3, 5, - null, 0.96, 49, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.3.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925023", "9384095", - "ITRAXX-JAPANS3V3 - 0615", "iTraxx Japan Series Number 3 Version 3", - "ITRAXX JAPAN SERIES NUMBER 03 VERSION 3 JPY SEN RES I03 CDS 10Y", 2453451, 2457194, 0.0035, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBA1", "ITRAXX", 3, "JAPAN", null, "IG", 3, 10, - null, 0.96, 49, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("LevXSubS1V19.LevXSub.5Y.1.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925034", "9438767", - "LevXSubS1V19 - 1211", "ITRAXX LEVX SUBORDINATE SERIES 1 VERSION 19", - "ITRAXX LEVX SUBORDINATE SERIES 1 VERSION 19 EUR 2ND SEC MMR I03 CDS", 2454180, 2455916, 0.045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKBQ2", "LevXSubS1V19", 1, "LevXSub", null, "IG", 19, 5, - null, 0.4857, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925057", "9451158", - "ITRAXX-LevXS5V2 - 1214", "iTraxx LevX Senior Series 5 Version 2", - "ITRAXX LEVX SENIOR SERIES 5 VERSION 2 EUR 1ST SEC RES I03 CDS", 2455096, 2457012, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDB6", "ITRAXX", 5, "LevX", null, "IG", 2, 5, - null, 0.975, 40, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.3.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925058", "9451146", - "ITRAXX-LevXS3V7 - 1213", "ITRAXX LEVX SENIOR SERIES 3 VERSION 7", - "ITRAXX LEVX SENIOR SERIES 3 VERSION 7 EUR 1ST SEC RES I03 CDS", 2454739, 2456647, 0.0575, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJBQ5", "ITRAXX", 3, "LevX", null, "IG", 7, 5, - null, 0.92, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925059", "9451150", - "ITRAXX-LevXS4V2 - 0614", "iTraxx LevX Senior Series 4 Version 2", - "ITRAXX LEVX SENIOR SERIES 4 VERSION 2 EUR 1ST SEC RES I03 CDS", 2454911, 2456829, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJCB7", "ITRAXX", 4, "LevX", null, "IG", 2, 5, - null, 0.98, 50, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925061", "9451024", - "ITRAXX-HIVOLS13V1 - 0615", "iTraxx Europe HiVol series 13 Version 1", - "ITRAXX-HIVOLS13V1-0615 EUR SEN MMR I03 CDS", 2455278, 2457194, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAQ9", "ITRAXX", 13, "HIVOL", "VOL", "HV", 1, 5, - "244921", 1, 30, 0, "LON", true, true, true, "ITXEH513", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.7Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925062", "9451026", - "ITRAXX-HIVOLS13V1 - 0617", "iTraxx Europe HiVol series 13 Version 1", - "ITRAXX-HIVOLS13V1-0617 EUR SEN MMR I03 CDS", 2455278, 2457925, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAQ9", "ITRAXX", 13, "HIVOL", "VOL", "HV", 1, 7, - "244921", 1, 30, 0, "LON", true, true, true, "ITXEH713", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.10Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925063", "9451027", - "ITRAXX-HIVOLS13V1 - 0620", "iTraxx Europe HiVol series 13 Version 1", - "ITRAXX-HIVOLS13V1-0620 EUR SEN MMR I03 CDS", 2455278, 2459021, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAQ9", "ITRAXX", 13, "HIVOL", "VOL", "HV", 1, 10, - "244921", 1, 30, 0, "LON", true, true, true, "ITXEH013", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.10Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925066", "9450860", - "ITRAXX-FINSENS13V1 - 0620", "iTraxx Europe Senior Financials series 13 Version 1", - "ITRAXX-FINSENS13V1-0620 EUR SEN MMR I03 CDS", 2455278, 2459021, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAM6", "ITRAXX", 13, "FINSEN", "SEN", "SENF", 1, 10, - "244926", 1, 25, 0, "LON", true, true, true, "ITXES013", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925067", "9451031", - "ITRAXX-FINSENS13V1 - 0615", "iTraxx Europe Senior Financials series 13 Version 1", - "ITRAXX-FINSENS13V1-0615 EUR SEN MMR I03 CDS", 2455278, 2457194, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAM6", "ITRAXX", 13, "FINSEN", "SEN", "SENF", 1, 5, - "244926", 1, 25, 0, "LON", true, true, true, "ITXES513", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925068", "9450872", - "ITRAXX-FINSUBS13V1 - 0615", "iTraxx Europe Sub Financials series 13 Version 1", - "ITRAXX-FINSUBS13V1-0615 EUR LT2 SUB MMR I03 CDS", 2455278, 2457194, 0.01, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAN2", "ITRAXX", 13, "FINSUB", "SUB", "SUBF", 1, 5, - "244927", 1, 25, 0, "LON", true, true, true, "ITXEU513", "SUB")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.10Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925069", "9450876", - "ITRAXX-FINSUBS13V1 - 0620", "iTraxx Europe Sub Financials series 13 Version 1", - "ITRAXX-FINSUBS13V1-0620 EUR LT2 SUB MMR I03 CDS", 2455278, 2459021, 0.01, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAN2", "ITRAXX", 13, "FINSUB", "SUB", "SUBF", 1, 10, - "244927", 1, 25, 0, "LON", true, true, true, "ITXEU013", "SUB")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.3Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925071", "9450882", - "ITRAXX-EUROPES13V1 - 0613", "iTraxx Europe series 13 Version 1", - "ITRAXX-EUROPES13V1-0613 EUR SEN MMR I03 CDS", 2455278, 2456464, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAT2", "ITRAXX", 13, "EUROPE", "EUR", "IG", 1, 3, - "244919", 1, 126, 0, "LON", true, true, true, "ITXEB313", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925072", "9450887", - "ITRAXX-EUROPES13V1 - 0615", "iTraxx Europe series 13 Version 1", - "ITRAXX-EUROPES13V1-0615 EUR SEN MMR I03 CDS", 2455278, 2457194, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAT2", "ITRAXX", 13, "EUROPE", "EUR", "IG", 1, 5, - "244919", 1, 126, 0, "LON", true, true, true, "ITXEB513", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.7Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925073", "9451060", - "ITRAXX-EUROPES13V1 - 0617", "iTraxx Europe series 13 Version 1", - "ITRAXX-EUROPES13V1-0617 EUR SEN MMR I03 CDS", 2455278, 2457925, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAT2", "ITRAXX", 13, "EUROPE", "EUR", "IG", 1, 7, - "244919", 1, 126, 0, "LON", true, true, true, "ITXEB713", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925074", "9451063", - "ITRAXX-EUROPES13V1 - 0620", "iTraxx Europe series 13 Version 1", - "ITRAXX-EUROPES13V1-0620 EUR SEN MMR I03 CDS", 2455278, 2459021, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAT2", "ITRAXX", 13, "EUROPE", "EUR", "IG", 1, 10, - "244919", 1, 126, 0, "LON", true, true, true, "ITXEB013", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925075", "9451154", - "ITRAXX-XOVERS13V1 - 0613", "iTraxx Europe Crossover series 13 Version 1", - "ITRAXX-XOVERS13V1-0613 EUR SEN MMR I03 CDS", 2455278, 2456464, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBB3", "ITRAXX", 13, "XOVER", "XVR", "XO", 1, 3, - "244920", 1, 50, 0, "LON", true, true, true, "ITXEX313", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925076", "9451159", - "ITRAXX-XOVERS13V1 - 0615", "iTraxx Europe Crossover series 13 Version 1", - "ITRAXX-XOVERS13V1-0615 EUR SEN MMR I03 CDS", 2455278, 2457194, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBB3", "ITRAXX", 13, "XOVER", "XVR", "XO", 1, 5, - "244920", 1, 50, 0, "LON", true, true, true, "ITXEX513", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925077", "9451161", - "ITRAXX-XOVERS13V1 - 0617", "iTraxx Europe Crossover series 13 Version 1", - "ITRAXX-XOVERS13V1-0617 EUR SEN MMR I03 CDS", 2455278, 2457925, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBB3", "ITRAXX", 13, "XOVER", "XVR", "XO", 1, 7, - "244920", 1, 50, 0, "LON", true, true, true, "ITXEX713", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925078", "9451162", - "ITRAXX-XOVERS13V1 - 0620", "iTraxx Europe Crossover series 13 Version 1", - "ITRAXX-XOVERS13V1-0620 EUR SEN MMR I03 CDS", 2455278, 2459021, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBB3", "ITRAXX", 13, "XOVER", "XVR", "XO", 1, 10, - "244920", 1, 50, 0, "LON", true, true, true, "ITXEX013", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.3Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925080", "9451023", - "ITRAXX-HIVOLS13V1 - 0613", "iTraxx Europe HiVol series 13 Version 1", - "ITRAXX-HIVOLS13V1-0613 EUR SEN MMR I03 CDS", 2455278, 2456464, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAQ9", "ITRAXX", 13, "HIVOL", "VOL", "HV", 1, 3, - "244921", 1, 30, 0, "LON", true, true, true, "ITXEH313", "VOL")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925081", "9451148", - "USD ITRAXX-EUROPES13V1 - 0615", "iTraxx Europe series 13 Version 1", - "ITRAXX-EUROPES13V1-0615 USD SEN MMR I03 CDS", 2455278, 2457194, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I666VAT2", "USD ITRAXX", 13, "EUROPE", "EUR", "IG", 1, 5, - null, 1, 126, 0, "LON", false, false, true, "ITXEB513", "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.10Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925082", "9451149", - "USD ITRAXX-EUROPES13V1 - 0620", "iTraxx Europe series 13 Version 1", - "ITRAXX-EUROPES13V1-0620 USD SEN MMR I03 CDS", 2455278, 2459021, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I666VAT2", "USD ITRAXX", 13, "EUROPE", "EUR", "IG", 1, 10, - null, 1, 126, 0, "LON", false, false, true, "ITXEB013", "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925083", "9451153", - "USD ITRAXX-XOVERS13V1 - 0615", "iTraxx Europe Crossover series 13 Version 1", - "ITRAXX-XOVERS13V1-0615 USD SEN MMR I03 CDS", 2455278, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KBB3", "USD ITRAXX", 13, "XOVER", "XVR", "XO", 1, 5, - null, 1, 50, 0, "LON", false, false, true, "ITXEX513", "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925084", "9451172", - "USD ITRAXX-XOVERS13V1 - 0620", "iTraxx Europe Crossover series 13 Version 1", - "ITRAXX-XOVERS13V1-0620 USD SEN MMR I03 CDS", 2455278, 2459021, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KBB3", "USD ITRAXX", 13, "XOVER", "XVR", "XO", 1, 10, - null, 1, 50, 0, "LON", false, false, true, "ITXEX013", "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSEN.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925085", "9451175", - "USD ITRAXX-FINSENS13V1 - 0615", "iTraxx Europe Senior Financials series 13 Version 1", - "ITRAXX-FINSENS13V1-0615 USD SEN MMR I03 CDS", 2455278, 2457194, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I667DAM6", "USD ITRAXX", 13, "FINSEN", "SEN", "SENF", 1, 5, - null, 1, 25, 0, "LON", false, false, true, "ITXES513", "SEN")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSEN.10Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925086", "9451180", - "USD ITRAXX-FINSENS13V1 - 0620", "iTraxx Europe Senior Financials series 13 Version 1", - "ITRAXX-FINSENS13V1-0620 USD SEN MMR I03 CDS", 2455278, 2459021, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I667DAM6", "USD ITRAXX", 13, "FINSEN", "SEN", "SENF", 1, 10, - null, 1, 25, 0, "LON", false, false, true, "ITXES013", "SEN")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSUB.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925087", "9451185", - "USD ITRAXX-FINSUBS13V1 - 0615", "iTraxx Europe Sub Financials series 13 Version 1", - "ITRAXX-FINSUBS13V1-0615 USD LT2 SUB MMR I03 CDS", 2455278, 2457194, 0.01, "USD", - "ACT/360", false, 0.2, 4, "2I667EAN2", "USD ITRAXX", 13, "FINSUB", "SUB", "SUBF", 1, 5, - null, 1, 25, 0, "LON", false, false, true, "ITXEU513", "SUB")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSUB.10Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925088", "9451189", - "USD ITRAXX-FINSUBS13V1 - 0620", "iTraxx Europe Sub Financials series 13 Version 1", - "ITRAXX-FINSUBS13V1-0620 USD LT2 SUB MMR I03 CDS", 2455278, 2459021, 0.01, "USD", - "ACT/360", false, 0.2, 4, "2I667EAN2", "USD ITRAXX", 13, "FINSUB", "SUB", "SUBF", 1, 10, - null, 1, 25, 0, "LON", false, false, true, "ITXEU013", "SUB")); - - UpdateCDXRefDataMap ("USD ITRAXX.HIVOL.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925089", "9451192", - "USD ITRAXX-HIVOLS13V1 - 0615", "iTraxx Europe HiVol series 13 Version 1", - "ITRAXX-HIVOLS13V1-0615 USD SEN MMR I03 CDS", 2455278, 2457194, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I667LAQ9", "USD ITRAXX", 13, "HIVOL", "VOL", "HV", 1, 5, - null, 1, 30, 0, "LON", false, false, true, "ITXEH513", "VOL")); - - UpdateCDXRefDataMap ("USD ITRAXX.HIVOL.10Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925090", "9451194", - "USD ITRAXX-HIVOLS13V1 - 0620", "iTraxx Europe HiVol series 13 Version 1", - "ITRAXX-HIVOLS13V1-0620 USD SEN MMR I03 CDS", 2455278, 2459021, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I667LAQ9", "USD ITRAXX", 13, "HIVOL", "VOL", "HV", 1, 10, - null, 1, 30, 0, "LON", false, false, true, "ITXEH013", "VOL")); - - UpdateCDXRefDataMap ("CDX.EMDIV.5Y.11.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925093", "9450857", - "CDX-EMDIVS11V1 - 0615", "CDX.EM.DIVERSIFIED.11", - "CDX EM DIVER 11 5YR", 2455096, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2165EKKB4", "CDX", 11, "EMDIV", null, "EM", 1, 5, - null, 1, 40, 0, "LON", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.EM.10Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925094", "9451081", - "CDX-EMS13V1 - 0620", "CDX.EM.13", - "CDX EM 13 10YR", 2455096, 2459021, 0.05, "USD", - "ACT/360", false, 0.25, 4, "2I65BZAM4", "CDX", 13, "EM", null, "EM", 1, 10, - null, 1, 15, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.EM.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925095", "9450874", - "CDX-EMS13V1 - 0615", "CDX.EM.13", - "CDX EM 13 5YR", 2455278, 2457194, 0.05, "USD", - "ACT/360", false, 0.25, 4, "2I65BZAM4", "CDX", 13, "EM", null, "EM", 1, 5, - null, 1, 15, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V4 FXD 97/100.5Y.14.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925096", "9451082", - "CDX-NAHYS14V4 FXD 97/100 - 0615", "CDX.NA.HY.14", - "CDX_NA_HY_S14_100_FXD_97/100", 2455278, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIX0 FXD", "CDX", 14, "NA HY V4 FXD 97/100", null, "HY", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925097", "9450877", - "CDX-NAHYS14V1 - 0615", "CDX.NA.HY.14", - "CDX_NA_HY_S14_100_SWP", 2455278, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHJ2", "CDX", 14, "NA HY", null, "HY", 1, 5, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925098", "9451083", - "CDX-NAHYS14V1 - 0611", "CDX.NA.HY.14", - "CDX_NA_HY_S14_100_SWP_01YR", 2455278, 2455733, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHJ2", "CDX", 14, "NA HY", null, "HY", 1, 1, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925099", "9451084", - "CDX-NAHYS14V1 - 0612", "CDX.NA.HY.14", - "CDX_NA_HY_S14_100_SWP_02YR", 2455278, 2456099, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHJ2", "CDX", 14, "NA HY", null, "HY", 1, 2, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925100", "9450880", - "CDX-NAHYS14V1 - 0613", "CDX.NA.HY.14", - "CDX_NA_HY_S14_100_SWP_03YR", 2455278, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHJ2", "CDX", 14, "NA HY", null, "HY", 1, 3, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG CONS.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925103", "9451375", - "CDX-NAIGCONSS14V1 - 0615", "CDX.NA.IG.CONS.14", - "CDX_NA_IG_S14_CONS_06/15", 2455278, 2457194, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B0AP4", "CDX", 14, "NA IG CONS", null, "IG", 1, 5, - null, 1, 39, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG ENRG.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925104", "9451378", - "CDX-NAIGENRGS14V1 - 0615", "CDX.NA.IG.ENRG.14", - "CDX_NA_IG_S14_ENRG_06/15", 2455278, 2457194, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B1AP2", "CDX", 14, "NA IG ENRG", null, "IG", 1, 5, - null, 1, 17, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925106", "9451381", - "CDX-NAIGFINS14V1 - 0615", "CDX.NA.IG.FIN.14", - "CDX_NA_IG_S14_FIN_06/15", 2455278, 2457194, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B2CG8", "CDX", 14, "NA IG FIN", null, "IG", 1, 5, - null, 1, 20, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.1Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925107", "9451114", - "CDX-NAIGHVOLS14V1 - 0611", "CDX.NA.IG.HVOL.14", - "CDX_NA_IG_S14_HVOL_01Y_06/11", 2455278, 2455733, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BL6", "CDX", 14, "NA IG HVOL", null, "HV", 1, 1, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.2Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925108", "9451115", - "CDX-NAIGHVOLS14V1 - 0612", "CDX.NA.IG.HVOL.14", - "CDX_NA_IG_S14_HVOL_02Y_06/12", 2455278, 2456099, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BL6", "CDX", 14, "NA IG HVOL", null, "HV", 1, 2, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V4 FXD 97/100.3Y.14.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925109", "9451085", - "CDX-NAHYS14V1 FXD - 0613", "CDX.NA.HY.14", - "CDX_NA_HY_S14_100_FXD_03YR", 2455278, 2456464, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRIX0 FXD", "CDX", 14, "NA HY V4 FXD 97/100", null, "HY", 4, 3, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.3Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925110", "9450855", - "CDX-NAIGHVOLS14V1 - 0613", "CDX.NA.IG.HVOL.14", - "CDX_NA_IG_S14_HVOL_03Y_06/13", 2455278, 2456464, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BL6", "CDX", 14, "NA IG HVOL", null, "HV", 1, 3, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925111", "9451086", - "CDX-NAHYS14V1 - 0614", "CDX.NA.HY.14", - "CDX_NA_HY_S14_100_SWP_04YR", 2455278, 2456829, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHJ2", "CDX", 14, "NA HY", null, "HY", 1, 4, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.4Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925112", "9450861", - "CDX-NAIGHVOLS14V1 - 0614", "CDX.NA.IG.HVOL.14", - "CDX_NA_IG_S14_HVOL_04Y_06/14", 2455278, 2456829, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BL6", "CDX", 14, "NA IG HVOL", null, "HV", 1, 4, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925113", "9451087", - "CDX-NAHYS14V1 - 0616", "CDX.NA.HY.14", - "CDX_NA_HY_S14_100_SWP_06YR", 2455278, 2457560, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHJ2", "CDX", 14, "NA HY", null, "HY", 1, 6, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925114", "9450888", - "CDX-NAHYS14V1 - 0617", "CDX.NA.HY.14", - "CDX_NA_HY_S14_100_SWP_07YR", 2455278, 2457925, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHJ2", "CDX", 14, "NA HY", null, "HY", 1, 7, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925115", "9450892", - "CDX-NAHYS14V1 - 0620", "CDX.NA.HY.14", - "CDX_NA_HY_S14_100_SWP_10YR", 2455278, 2459021, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHJ2", "CDX", 14, "NA HY", null, "HY", 1, 10, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BV2 FXD 33/34.5Y.14.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925117", "9451089", - "CDX-NAHYBS14V1 FXD - 0615", "CDX.NA.HY.B.14", - "CDX_NA_HY_S14_B___FXD", 2455278, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BSBV9 FXD", "CDX", 14, "NA HY BV2 FXD 33/34", null, "HY", 2, 5, - null, 0.97059, 34, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925118", "9450895", - "CDX-NAHYBS14V1 - 0615", "CDX.NA.HY.B.14", - "CDX_NA_HY_S14_B___SWP", 2455278, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSKL1", "CDX", 14, "NA HY B", null, "HY", 1, 5, - null, 1, 34, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("Itraxx.SovX West Eur.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925119", "9452638", - "Itraxx-SovX West Eur S3V1 - 0615", "Itraxx SovX Western Europe Series 3 Version 1", - "ITRAXX-SOVX WEST EUR S3V1-0615 USD SEN RES I03 CDS", 2455278, 2457194, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAC5", "Itraxx", 3, "SovX West Eur", "SOV", "SOWE", 1, 5, - "244928", 1, 15, 0, "LON", true, true, true, "ITXSW53", "SOV")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925120", "9450859", - "CDX-NAHYBBS14V1 - 0615", "CDX.NA.HY.BB.14", - "CDX_NA_HY_S14_BB__SWP", 2455278, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBV2", "CDX", 14, "NA HY BB", null, "HY", 1, 5, - null, 1, 34, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("Itraxx.SovX West Eur.10Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925122", "9452642", - "Itraxx-SovX West Eur S3V1 - 0620", "Itraxx SovX Western Europe Series 3 Version 1", - "ITRAXX-SOVX WEST EUR S3V1-0620 USD SEN RES I03 CDS", 2455278, 2459021, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAC5", "Itraxx", 3, "SovX West Eur", "SOV", "SOWE", 1, 10, - "244928", 1, 15, 0, "LON", true, true, true, "ITXSW03", "SOV")); - - UpdateCDXRefDataMap ("CDX.NA IG.1Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925123", "9450862", - "CDX-NAIGS14V1 - 0611", "CDX.NA.IG.14", - "CDX_NA_IG_S14_01Y_06/11", 2455278, 2455733, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCK9", "CDX", 14, "NA IG", null, "IG", 1, 1, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.2Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925124", "9450868", - "CDX-NAIGS14V1 - 0612", "CDX.NA.IG.14", - "CDX_NA_IG_S14_02Y_06/12", 2455278, 2456099, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCK9", "CDX", 14, "NA IG", null, "IG", 1, 2, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925126", "9450870", - "CDX-NAIGS14V1 - 0613", "CDX.NA.IG.14", - "CDX_NA_IG_S14_03Y_06/13", 2455278, 2456464, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCK9", "CDX", 14, "NA IG", null, "IG", 1, 3, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925127", "9450900", - "CDX-NAIGS14V1 - 0615", "CDX.NA.IG.14", - "CDX_NA_IG_S14_05Y_06/15", 2455278, 2457194, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCK9", "CDX", 14, "NA IG", null, "IG", 1, 5, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925128", "9450903", - "CDX-NAIGS14V1 - 0617", "CDX.NA.IG.14", - "CDX_NA_IG_S14_07Y_06/17", 2455278, 2457925, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCK9", "CDX", 14, "NA IG", null, "IG", 1, 7, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925129", "9450907", - "CDX-NAIGS14V1 - 0620", "CDX.NA.IG.14", - "CDX_NA_IG_S14_10Y_06/20", 2455278, 2459021, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCK9", "CDX", 14, "NA IG", null, "IG", 1, 10, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925130", "9450863", - "CDX-NAIGHVOLS14V1 - 0615", "CDX.NA.IG.HVOL.14", - "CDX_NA_IG_S14_HVOL_05Y_06/15", 2455278, 2457194, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BL6", "CDX", 14, "NA IG HVOL", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.7Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925131", "9450865", - "CDX-NAIGHVOLS14V1 - 0617", "CDX.NA.IG.HVOL.14", - "CDX_NA_IG_S14_HVOL_07Y_06/17", 2455278, 2457925, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BL6", "CDX", 14, "NA IG HVOL", null, "HV", 1, 7, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.10Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925132", "9450869", - "CDX-NAIGHVOLS14V1 - 0620", "CDX.NA.IG.HVOL.14", - "CDX_NA_IG_S14_HVOL_10Y_06/20", 2455278, 2459021, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BL6", "CDX", 14, "NA IG HVOL", null, "HV", 1, 10, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet34() - { - UpdateCDXRefDataMap ("CDX.NA HY BBV1 FXD.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925133", "9451357", - "CDX-NAHYBBS14V1 FXD - 0615", "CDX.NA.HY.BB.14", - "CDX_NA_HY_S14_BB__FXD", 2455278, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BVBV2 FXD", "CDX", 14, "NA HY BBV1 FXD", null, "HY", 1, 5, - null, 1, 34, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG INDU.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925134", "9450871", - "CDX-NAIGINDUS14V1 - 0615", "CDX.NA.IG.INDU.14", - "CDX_NA_IG_S14_INDU_06/15", 2455278, 2457194, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B4AU5", "CDX", 14, "NA IG INDU", null, "IG", 1, 5, - null, 1, 25, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG TMT.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925135", "9450873", - "CDX-NAIGTMTS14V1 - 0615", "CDX.NA.IG.TMT.14", - "CDX_NA_IG_S14_TMT_06/15", 2455278, 2457194, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65DJAX4", "CDX", 14, "NA IG TMT", null, "IG", 1, 5, - null, 1, 24, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925137", "9450875", - "CDX-NAIGHVOLS14V1 EUR - 0615", "CDX.NA.IG.HVOL.14", - "CDX_NA_IG_S14_HVOL_05Y_06/15 EUR", 2455278, 2457194, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I65B3BL6 EUR", "CDX", 14, "NA IG HVOL", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HBV2 FXD 29/30.5Y.14.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925138", "9451365", - "CDX-NAHYHBS14V1 FXD - 0615", "CDX.NA.HY.HB.14", - "CDX_NA_HY_S14_HB__FXD", 2455278, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BWFF1 FXD", "CDX", 14, "NA HY HBV2 FXD 29/30", null, "HY", 2, 5, - null, 0.96666, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925139", "9451370", - "CDX-NAHYHBS14V1 - 0615", "CDX.NA.HY.HB.14", - "CDX_NA_HY_S14_HB__SWP", 2455278, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWET2", "CDX", 14, "NA HY HB", null, "HY", 1, 5, - null, 1, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925141", "9451371", - "CDX-NAIGS14V1 - 0614", "CDX.NA.IG.14", - "CDX_NA_IG_S14_04Y_06/14", 2455278, 2456829, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCK9", "CDX", 14, "NA IG", null, "IG", 1, 4, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925142", "9451373", - "CDX-NAIGS14V1 EUR - 0615", "CDX.NA.IG.14", - "CDX_NA_IG_S14_05Y_06/15_EUR", 2455278, 2457194, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYCK9 EUR", "CDX", 14, "NA IG", null, "IG", 1, 5, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ IG.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925144", "9451504", - "ITRAXX-ASIAXJIGS13V1 - 0615", "iTraxx Asia ex-Japan IG Series Number 13 Version 1", - "ITRAXX ASIA EX-JAPAN IG SERIES NUMBER 13 VERSION 1 USD SEN RES I03 CDS", 2455278, 2457194, 0.01, "USD", - "ACT/360", false, 0.4, 4, "4ABCAMAF3", "ITRAXX", 13, "ASIAXJ IG", null, "ASHG", 1, 5, - null, 1, 50, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ HY.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925145", "9451502", - "ITRAXX-ASIAXJHYS13V1 - 0615", "iTraxx Asia ex-Japan HY Series Number 13 Version 1", - "ITRAXX ASIA EX-JAPAN HY SERIES NUMBER 13 VERSION 1 USD SEN RES I03 CDS", 2455278, 2457194, 0.05, "USD", - "ACT/360", false, 0.25, 4, "4ABCAGAF6", "ITRAXX", 13, "ASIAXJ HY", null, "ASHY", 1, 5, - null, 1, 20, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.AUSTRALIA.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925146", "9451503", - "ITRAXX-AUSTRALIAS13V1 - 0615", "iTraxx Australia Series Number 13 Version 1", - "ITRAXX AUSTRALIA SERIES NUMBER 13 VERSION 1 USD SEN MR I03 CDS", 2455278, 2457194, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I668IAM4", "ITRAXX", 13, "AUSTRALIA", null, "AUHG", 1, 5, - null, 1, 25, 0, "HKG", false, false, true, null, "Itraxx Australia")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.13.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925147", "9451505", - "ITRAXX-JAPANS13V1 - 0615", "iTraxx Japan Series Number 13 Version 1", - "ITRAXX JAPAN SERIES NUMBER 13 VERSION 1 JPY SEN RES I03 CDS", 2455279, 2457194, 0.01, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBB9", "ITRAXX", 13, "JAPAN", null, "JPHG", 1, 5, - null, 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.SOVXASIAPACIFIC.5Y.3.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925208", "9453842", - "ITRAXX-SOVX-ASIA-PACIFICS3 - 0615", "iTraxx SovX Asia Pacific Series 3 Version 1", - "ITRAXX SOVX ASIA-PACIFIC SERIES NUMBER 3 VERSION 1 USD SEN RES I03 CDS", 2455278, 2457194, 0.01, "USD", - "ACT/360", true, 0.4, 2, "4ABCANAA2", "ITRAXX", 3, "SOVXASIAPACIFIC", null, "ASHG", 1, 5, - null, 1, 10, 0, "HKG", false, false, true, null, "Itraxx SovX")); - - UpdateCDXRefDataMap ("ITRAXX.SOVXASIAPACIFIC.10Y.1.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925209", "9453846", - "ITRAXX-SOVX-ASIA-PACIFICS1 - 0620", "ITraxx Sovx Asia Pacific Series Number 1 Version 1", - "ITRAXX SOVX ASIA-PACIFIC SERIES NUMBER 1 VERSION 1 USD SEN RES I03 CDS 10Y", 2455278, 2459021, 0, "USD", - "ACT/360", true, 0.4, 2, "ITRAXX-SOVX-ASIA-PACIFICS1", "ITRAXX", 1, "SOVXASIAPACIFIC", null, "ASHG", 1, 10, - null, 1, 10, 0, "HKG", false, false, true, null, "Itraxx SovX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925234", "9456779", - "ITRAXX-LevXS6V1 - 0615", "iTraxx LevX Senior Series 6 Version 1", - "ITRAXX LEVX SENIOR SERIES 6 VERSION 1 EUR 1ST SEC RES I03 CDS", 2455278, 2457194, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJEA7", "ITRAXX", 6, "LevX", null, "IG", 1, 5, - null, 1, 40, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.27", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925343", "9458918", - "LCDXNAS8V27 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_74/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.55, 4, "5F199GDB0", "LCDX", 8, "LCDXNA", null, "IG", 27, 5, - null, 0.74, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.22", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925345", "9458927", - "LCDXNAS9V22 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_79/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.55, 4, "5F199GDC8", "LCDX", 9, "LCDXNA", null, "IG", 22, 5, - null, 0.79, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("MCDXNAS14V1.MCDXNA.3Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925356", "9452749", - "MCDXNAS14V1 - 0613", "MCDX.NA.14", - "MCDX SERIES 14 3Y", 2455292, 2456464, 0.01, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAE7", "MCDXNAS14V1", 14, "MCDXNA", null, "IG", 1, 3, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("MCDXNAS14V1.MCDXNA.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925358", "9452754", - "MCDXNAS14V1 - 0615", "MCDX.NA.14", - "MCDX SERIES 14 5Y", 2455292, 2457194, 0.01, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAE7", "MCDXNAS14V1", 14, "MCDXNA", null, "IG", 1, 5, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("MCDXNAS14V1.MCDXNA.10Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925360", "9452856", - "MCDXNAS14V1 - 0620", "MCDX.NA.14", - "MCDX SERIES 14 10Y", 2455292, 2459021, 0.01, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAE7", "MCDXNAS14V1", 14, "MCDXNA", null, "IG", 1, 10, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("LCDXNAS10V22 FXD.LCDXNAV22 FXD.5Y.10.22", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925370", "9459234", - "LCDXNAS10V22 FXD - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_FXD_79/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GDD6 FXD", "LCDXNAS10V22 FXD", 10, "LCDXNAV22 FXD", null, "IG", 22, 5, - null, 0.79, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V22 FXD.LCDXNAV22 FXD.5Y.9.22", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925373", "9459163", - "LCDXNAS9V22 FXD - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_FXD_79/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDC8 FXD", "LCDXNAS9V22 FXD", 9, "LCDXNAV22 FXD", null, "IG", 22, 5, - null, 0.79, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.10.22", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925375", "9459237", - "LCDXNAS10V22 - 0614", "LCDX.NA.10", - "CDX_NA_LN_S10_100_06YR_79/100", 2454561, 2456829, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GDD6", "LCDX", 10, "LCDXNA", null, "IG", 22, 6, - null, 0.79, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.9.22", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925378", "9459165", - "LCDXNAS9V22 - 1214", "LCDX.NA.9", - "CDX_NA_LN_S09_100_07YR_79/100", 2454378, 2457012, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDC8", "LCDX", 9, "LCDXNA", null, "IG", 22, 7, - null, 0.79, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.10.22", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925379", "9459238", - "LCDXNAS10V22 - 0610", "LCDX.NA.10", - "CDX_NA_LN_S10_100_02YR_79/100", 2454561, 2455368, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GDD6", "LCDX", 10, "LCDXNA", null, "IG", 22, 2, - null, 0.79, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.9.22", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925380", "9459166", - "LCDXNAS9V22 - 1210", "LCDX.NA.9", - "CDX_NA_LN_S09_100_03YR_79/100", 2454378, 2455551, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDC8", "LCDX", 9, "LCDXNA", null, "IG", 22, 3, - null, 0.79, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.10.22", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925381", "9459342", - "LCDXNAS10V22 - 0615", "LCDX.NA.10", - "CDX_NA_LN_S10_100_07YR_79/100", 2454561, 2457194, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GDD6", "LCDX", 10, "LCDXNA", null, "IG", 22, 7, - null, 0.79, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.9.22", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925382", "9459168", - "LCDXNAS9V22 - 1217", "LCDX.NA.9", - "CDX_NA_LN_S09_100_10YR_79/100", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDC8", "LCDX", 9, "LCDXNA", null, "IG", 22, 10, - null, 0.79, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.10.22", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925383", "9459344", - "LCDXNAS10V22 - 0618", "LCDX.NA.10", - "CDX_NA_LN_S10_100_10YR_79/100", 2454561, 2458290, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GDD6", "LCDX", 10, "LCDXNA", null, "IG", 22, 10, - null, 0.79, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.10.22", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925384", "9459347", - "LCDXNAS10V22 - 0612", "LCDX.NA.10", - "CDX_NA_LN_S10_100_04YR_79/100", 2454561, 2456099, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GDD6", "LCDX", 10, "LCDXNA", null, "IG", 22, 4, - null, 0.79, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.9.22", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925385", "9459227", - "LCDXNAS9V22 - 1211", "LCDX.NA.9", - "CDX_NA_LN_S09_100_04YR_79/100", 2454378, 2455916, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDC8", "LCDX", 9, "LCDXNA", null, "IG", 22, 4, - null, 0.79, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.12.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925386", "9459256", - "LCDXNAS12V11 - 0610", "LCDX.NA.12", - "CDX_NA_LN_S12_100_01YR_89/100", 2454938, 2455368, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDE4", "LCDX", 12, "LCDXNA", null, "IG", 11, 1, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.9.22", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925387", "9459229", - "LCDXNAS9V22 - 1213", "LCDX.NA.9", - "CDX_NA_LN_S09_100_06YR_79/100", 2454378, 2456647, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDC8", "LCDX", 9, "LCDXNA", null, "IG", 22, 6, - null, 0.79, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS12V11 FXD.LCDXNAV11 FXD.5Y.12.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925388", "9459260", - "LCDXNAS12V11 FXD - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_FXD_89/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDE4 FXD", "LCDXNAS12V11 FXD", 12, "LCDXNAV11 FXD", null, "IG", 11, 5, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.12.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925390", "9459266", - "LCDXNAS12V11 - 0611", "LCDX.NA.12", - "CDX_NA_LN_S12_100_02YR_89/100", 2454938, 2455733, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDE4", "LCDX", 12, "LCDXNA", null, "IG", 11, 2, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.12.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925391", "9459267", - "LCDXNAS12V11 - 0616", "LCDX.NA.12", - "CDX_NA_LN_S12_100_07YR_89/100", 2454938, 2457560, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDE4", "LCDX", 12, "LCDXNA", null, "IG", 11, 7, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.12.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925392", "9459278", - "LCDXNAS12V11 - 0619", "LCDX.NA.12", - "CDX_NA_LN_S12_100_10YR_89/100", 2454938, 2458655, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDE4", "LCDX", 12, "LCDXNA", null, "IG", 11, 10, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.12.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925393", "9459286", - "LCDXNAS12V11 - 0613", "LCDX.NA.12", - "CDX_NA_LN_S12_100_04YR_89/100", 2454938, 2456464, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDE4", "LCDX", 12, "LCDXNA", null, "IG", 11, 4, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.12.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925395", "9459288", - "LCDXNAS12V11 - 0615", "LCDX.NA.12", - "CDX_NA_LN_S12_100_06YR_89/100", 2454938, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDE4", "LCDX", 12, "LCDXNA", null, "IG", 11, 6, - null, 0.89, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.27", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925404", "9459148", - "LCDXNAS8V27 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_74/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GDB0", "LCDX", 8, "LCDXNA", null, "IG", 27, 10, - null, 0.74, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V27 FXD.LCDXNAV27 FXD.5Y.8.27", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925405", "9459150", - "LCDXNAS8V27 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_74/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GDB0 FXD", "LCDXNAS8V27 FXD", 8, "LCDXNAV27 FXD", null, "IG", 27, 5, - null, 0.74, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.27", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925406", "9459153", - "LCDXNAS8V27 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_74/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GDB0", "LCDX", 8, "LCDXNA", null, "IG", 27, 6, - null, 0.74, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.27", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925413", "9459155", - "LCDXNAS8V27 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_74/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GDB0", "LCDX", 8, "LCDXNA", null, "IG", 27, 4, - null, 0.74, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.27", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925414", "9459154", - "LCDXNAS8V27 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_74/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GDB0", "LCDX", 8, "LCDXNA", null, "IG", 27, 7, - null, 0.74, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.8.27", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925415", "9459160", - "LCDXNAS8V27 - 0610", "LCDX.NA.8", - "CDX_NA_LN_S08_100_03YR_74/100", 2454244, 2455368, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GDB0", "LCDX", 8, "LCDXNA", null, "IG", 27, 3, - null, 0.74, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925423", "9458602", - "LCDXNAS14V1 - 0615", "LCDX.NA.14", - "CDX_NA_LN_S14_100", 2455278, 2457194, 0.025, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GDF1", "LCDX", 14, "LCDXNA", null, "IG", 1, 5, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.2.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925446", "9451141", - "ITRAXX-LevXS2V9 - 0613", "ITRAXX LEVX SENIOR SERIES 2 VERSION 9", - "ITRAXX LEVX SENIOR SERIES 2 VERSION 9 EUR 1ST SEC RES I03 CDS", 2454543, 2456464, 0.052500000000000005, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJBR3", "ITRAXX", 2, "LevX", null, "IG", 9, 5, - null, 0.8932, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925452", "9458603", - "LCDXNAS14V1 - 0611", "LCDX.NA.14", - "CDX_NA_LN_S14_100_01YR", 2455278, 2455733, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDF1", "LCDX", 14, "LCDXNA", null, "IG", 1, 1, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925453", "9458604", - "LCDXNAS14V1 - 0613", "LCDX.NA.14", - "CDX_NA_LN_S14_100_03YR", 2455278, 2456464, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDF1", "LCDX", 14, "LCDXNA", null, "IG", 1, 3, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS14V1 FXD.LCDXNAV1 FXD.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925454", "9458605", - "LCDXNAS14V1 FXD - 0615", "LCDX.NA.14", - "CDX_NA_LN_S14_100_FXD", 2455278, 2457194, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDF1 FXD", "LCDXNAS14V1 FXD", 14, "LCDXNAV1 FXD", null, "IG", 1, 5, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925455", "9458606", - "LCDXNAS14V1 - 0612", "LCDX.NA.14", - "CDX_NA_LN_S14_100_02YR", 2455278, 2456099, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDF1", "LCDX", 14, "LCDXNA", null, "IG", 1, 2, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925456", "9458607", - "LCDXNAS14V1 - 0617", "LCDX.NA.14", - "CDX_NA_LN_S14_100_07YR", 2455278, 2457925, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDF1", "LCDX", 14, "LCDXNA", null, "IG", 1, 7, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925458", "9458608", - "LCDXNAS14V1 - 0620", "LCDX.NA.14", - "CDX_NA_LN_S14_100_10YR", 2455278, 2459021, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDF1", "LCDX", 14, "LCDXNA", null, "IG", 1, 10, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925459", "9458609", - "LCDXNAS14V1 - 0614", "LCDX.NA.14", - "CDX_NA_LN_S14_100_04YR", 2455278, 2456829, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDF1", "LCDX", 14, "LCDXNA", null, "IG", 1, 4, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925460", "9458610", - "LCDXNAS14V1 - 0616", "LCDX.NA.14", - "CDX_NA_LN_S14_100_06YR", 2455278, 2457560, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDF1", "LCDX", 14, "LCDXNA", null, "IG", 1, 6, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LevXSenS1V15.LevXSen.5Y.1.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925501", "9468345", - "LevXSenS1V15 - 1211", "ITRAXX LEVX SENIOR SERIES 1 VERSION 15", - "ITRAXX LEVX SENIOR SERIES 1 VERSION 15 EUR 1ST SEC MMR I03 CDS", 2453999, 2455916, 0.017, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJEB5", "LevXSenS1V15", 1, "LevXSen", null, "IG", 15, 5, - null, 0.59997, 0, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925508", "9469827", - "ITRAXX-LevXS5V3 - 1214", "ITRAXX LEVX SENIOR SERIES 5 VERSION 3", - "ITRAXX LEVX SENIOR SERIES 5 VERSION 3 EUR 1ST SEC RES I03 CDS", 2455096, 2457012, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJBW2", "ITRAXX", 5, "LevX", null, "IG", 3, 5, - null, 0.9500000000000001, 40, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.2.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925509", "9469823", - "ITRAXX-LevXS2V10 - 0613", "ITRAXX LEVX SENIOR SERIES 2 VERSION 10", - "ITRAXX LEVX SENIOR SERIES 2 VERSION 10 EUR 1ST SEC RES I03 CDS", 2454543, 2456464, 0.052500000000000005, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJBS1", "ITRAXX", 2, "LevX", null, "IG", 10, 5, - null, 0.8798, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.3.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925510", "9469825", - "ITRAXX-LevXS3V8 - 1213", "ITRAXX LEVX SENIOR SERIES 3 VERSION 8", - "ITRAXX LEVX SENIOR SERIES 3 VERSION 8 EUR 1ST SEC RES I03 CDS", 2454739, 2456647, 0.0575, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJBT9", "ITRAXX", 3, "LevX", null, "IG", 8, 5, - null, 0.9066, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.4.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925511", "9469826", - "ITRAXX-LevXS4V3 - 0614", "ITRAXX LEVX SENIOR SERIES 4 VERSION 3", - "ITRAXX LEVX SENIOR SERIES 4 VERSION 3 EUR 1ST SEC RES I03 CDS", 2454911, 2456829, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJBU6", "ITRAXX", 4, "LevX", null, "IG", 3, 5, - null, 0.96, 50, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925512", "9469831", - "ITRAXX-LevXS6V2 - 0615", "ITRAXX LEVX SENIOR SERIES 6 VERSION 2", - "ITRAXX LEVX SENIOR SERIES 6 VERSION 2 EUR 1ST SEC RES I03 CDS", 2455278, 2457194, 0.05, "EUR", - "ACT/360", false, 0.71, 4, "4ABCAJEH2", "ITRAXX", 6, "LevX", null, "IG", 2, 5, - null, 0.975, 40, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LevXSenS1V16.LevXSen.5Y.1.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925533", "9476239", - "LevXSenS1V16 - 1211", "ITRAXX LEVX SENIOR SERIES 1 VERSION 16", - "ITRAXX LEVX SENIOR SERIES 1 VERSION 16 EUR 1ST SEC MMR I03 CDS", 2453999, 2455916, 0.017, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJEC3", "LevXSenS1V16", 1, "LevXSen", null, "IG", 16, 5, - null, 0.5714, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LevXSubS1V20.LevXSub.5Y.1.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925534", "9476240", - "LevXSubS1V20 - 1211", "ITRAXX LEVX SUBORDINATE SERIES 1 VERSION 20", - "ITRAXX LEVX SUBORDINATE SERIES 1 VERSION 20 EUR 2ND SEC MMR I03 CDS", 2454180, 2455916, 0.045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKBV1", "LevXSubS1V20", 1, "LevXSub", null, "IG", 20, 5, - null, 0.4572, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LevXSubS1V21.LevXSub.5Y.1.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925557", "9484895", - "LevXSubS1V21 - 1211", "ITRAXX LEVX SUBORDINATED SERIES 1 VERSION 21", - "ITRAXX LEVX SUBORDINATED SERIES 1 VERSION 21 EUR 2ND SEC MMR I03 CDS", 2454180, 2455916, 0.045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKBW9", "LevXSubS1V21", 1, "LevXSub", null, "IG", 21, 5, - null, 0.4286, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.1.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925593", "9489686", - "ITRAXX-XOVERS1V2 - 0914", "Itraxx Europe Crossover Series 1 VERSION 2", - "ITRAXX-XOVERS1V2-0914 EUR SEN MMR I03 CDS", 2453179, 2456921, 0.0315, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBC1", "ITRAXX", 1, "XOVER", "XVR", "XO", 2, 10, - "245733", 1, 31, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925595", "9489692", - "ITRAXX-XOVERS2V2 - 0315", "Itraxx Europe Crossover Series 2 VERSION 2", - "ITRAXX-XOVERS2V2-0315 EUR SEN MMR I03 CDS", 2453269, 2457102, 0.029500000000000002, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBD9", "ITRAXX", 2, "XOVER", "XVR", "XO", 2, 10, - "245734", 1, 31, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925598", "9489678", - "ITRAXX-XOVERS5V3 - 0611", "iTraxx Europe Crossover Series 5 Version 3", - "ITRAXX-XOVERS5V3-0611 EUR SEN MMR I03 CDS", 2453815, 2455733, 0.029, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBG2", "ITRAXX", 5, "XOVER", "XVR", "XO", 3, 5, - "245736", 0.9777, 45, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925599", "9489680", - "ITRAXX-XOVERS5V3 - 0616", "iTraxx Europe Crossover Series 5 Version 3", - "ITRAXX-XOVERS5V3-0616 EUR SEN MMR I03 CDS", 2453815, 2457560, 0.035, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBG2", "ITRAXX", 5, "XOVER", "XVR", "XO", 3, 10, - "245736", 0.9777, 45, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.9.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925600", "9489825", - "ITRAXX-XOVERS9V5 - 0611", "iTraxx Europe Crossover series 9 Version 5", - "ITRAXX-XOVERS9V5-0611 EUR SEN MMR I03 CDS", 2454546, 2455733, 0.0625, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBK3", "ITRAXX", 9, "XOVER", "XVR", "XO", 5, 3, - "245740", 0.9400000000000001, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.9.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925602", "9489700", - "ITRAXX-XOVERS9V5 - 0613", "iTraxx Europe Crossover series 9 Version 5", - "ITRAXX-XOVERS9V5-0613 EUR SEN MMR I03 CDS", 2454546, 2456464, 0.065, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBK3", "ITRAXX", 9, "XOVER", "XVR", "XO", 5, 5, - "245740", 0.9400000000000001, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925603", "9489685", - "ITRAXX-XOVERS6V3 - 1211", "iTraxx Europe Crossover series 6 Version 3", - "ITRAXX-XOVERS6V3-1211 EUR SEN MMR I03 CDS", 2453999, 2455916, 0.028, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBH0", "ITRAXX", 6, "XOVER", "XVR", "XO", 3, 5, - "245738", 0.9777, 45, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.9.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925604", "9489710", - "ITRAXX-XOVERS9V5 - 0618", "iTraxx Europe Crossover series 9 Version 5", - "ITRAXX-XOVERS9V5-0618 EUR SEN MMR I03 CDS", 2454546, 2458290, 0.064, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBK3", "ITRAXX", 9, "XOVER", "XVR", "XO", 5, 10, - "245740", 0.9400000000000001, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925605", "9489719", - "ITRAXX-XOVERS10V4 - 1211", "iTraxx Europe Crossover series 10 Version 4", - "ITRAXX-XOVERS10V4-1211 EUR SEN MMR I03 CDS", 2454739, 2455916, 0.053000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBL1", "ITRAXX", 10, "XOVER", "XVR", "XO", 4, 3, - "245741", 0.96, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925606", "9489687", - "ITRAXX-XOVERS6V3 - 1216", "iTraxx Europe Crossover series 6 Version 3", - "ITRAXX-XOVERS6V3-1216 EUR SEN MMR I03 CDS", 2453999, 2457743, 0.0345, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBH0", "ITRAXX", 6, "XOVER", "XVR", "XO", 3, 10, - "245738", 0.9777, 45, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925607", "9489666", - "ITRAXX-XOVERS10V4 - 1213", "iTraxx Europe Crossover series 10 Version 4", - "ITRAXX-XOVERS10V4-1213 EUR SEN MMR I03 CDS", 2454739, 2456647, 0.056, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBL1", "ITRAXX", 10, "XOVER", "XVR", "XO", 4, 5, - "245741", 0.96, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925609", "9489731", - "ITRAXX-XOVERS12V2 - 1212", "iTraxx Europe Crossover series 12 Version 2", - "ITRAXX-XOVERS12V2-1212 EUR SEN MMR I03 CDS", 2455096, 2456282, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBM9", "ITRAXX", 12, "XOVER", "XVR", "XO", 2, 3, - "245739", 1, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.7.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925610", "9489691", - "ITRAXX-XOVERS7V4 - 0612", "iTraxx Europe Crossover series 7 Version 4", - "ITRAXX-XOVERS7V4-0612 EUR SEN MMR I03 CDS", 2454180, 2456099, 0.023, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBI8", "ITRAXX", 7, "XOVER", "XVR", "XO", 4, 5, - "245742", 0.96, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925611", "9489732", - "ITRAXX-XOVERS12V2 - 1214", "iTraxx Europe Crossover series 12 Version 2", - "ITRAXX-XOVERS12V2-1214 EUR SEN MMR I03 CDS", 2455096, 2457012, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBM9", "ITRAXX", 12, "XOVER", "XVR", "XO", 2, 5, - "245739", 1, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.7.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925612", "9489695", - "ITRAXX-XOVERS7V4 - 0617", "iTraxx Europe Crossover series 7 Version 4", - "ITRAXX-XOVERS7V4-0617 EUR SEN MMR I03 CDS", 2454180, 2457925, 0.032, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBI8", "ITRAXX", 7, "XOVER", "XVR", "XO", 4, 10, - "245742", 0.96, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925613", "9489735", - "ITRAXX-XOVERS12V2 - 1216", "iTraxx Europe Crossover series 12 Version 2", - "ITRAXX-XOVERS12V2-1216 EUR SEN MMR I03 CDS", 2455096, 2457743, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBM9", "ITRAXX", 12, "XOVER", "XVR", "XO", 2, 7, - "245739", 1, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.4.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925617", "9489663", - "ITRAXX-XOVERS4V3 - 1210", "iTraxx Europe Crossover Series 4 Version 3", - "ITRAXX-XOVERS4V3-1210 EUR SEN MMR I03 CDS", 2453634, 2455551, 0.029500000000000002, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBF4", "ITRAXX", 4, "XOVER", "XVR", "XO", 3, 5, - "245735", 0.975, 41, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925619", "9489713", - "ITRAXX-XOVERS13V2 - 0613", "iTraxx Europe Crossover series 13 Version 2", - "ITRAXX-XOVERS13V2-0613 EUR SEN MMR I03 CDS", 2455278, 2456464, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBN7", "ITRAXX", 13, "XOVER", "XVR", "XO", 2, 3, - "245737", 1, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925620", "9489718", - "ITRAXX-XOVERS13V2 - 0615", "iTraxx Europe Crossover series 13 Version 2", - "ITRAXX-XOVERS13V2-0615 EUR SEN MMR I03 CDS", 2455278, 2457194, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBN7", "ITRAXX", 13, "XOVER", "XVR", "XO", 2, 5, - "245737", 1, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925621", "9489721", - "ITRAXX-XOVERS13V2 - 0617", "iTraxx Europe Crossover series 13 Version 2", - "ITRAXX-XOVERS13V2-0617 EUR SEN MMR I03 CDS", 2455278, 2457925, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBN7", "ITRAXX", 13, "XOVER", "XVR", "XO", 2, 7, - "245737", 1, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925622", "9489722", - "ITRAXX-XOVERS13V2 - 0620", "iTraxx Europe Crossover series 13 Version 2", - "ITRAXX-XOVERS13V2-0620 EUR SEN MMR I03 CDS", 2455278, 2459021, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBN7", "ITRAXX", 13, "XOVER", "XVR", "XO", 2, 10, - "245737", 1, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925626", "9489656", - "ITRAXX-XOVERS10V4 - 1215", "iTraxx Europe Crossover series 10 Version 4", - "ITRAXX-XOVERS10V4-1215 EUR SEN MMR I03 CDS", 2454739, 2457377, 0.055, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBL1", "ITRAXX", 10, "XOVER", "XVR", "XO", 4, 7, - "245741", 0.96, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.4.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925627", "9489665", - "ITRAXX-XOVERS4V3 - 1215", "iTraxx Europe Crossover Series 4 Version 3", - "ITRAXX-XOVERS4V3-1215 EUR SEN MMR I03 CDS", 2453634, 2457377, 0.0345, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBF4", "ITRAXX", 4, "XOVER", "XVR", "XO", 3, 10, - "245735", 0.975, 41, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.10.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925628", "9489661", - "ITRAXX-XOVERS10V4 - 1218", "iTraxx Europe Crossover series 10 Version 4", - "ITRAXX-XOVERS10V4-1218 EUR SEN MMR I03 CDS", 2454739, 2458473, 0.054, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBL1", "ITRAXX", 10, "XOVER", "XVR", "XO", 4, 10, - "245741", 0.96, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925634", "9489767", - "ITRAXX-XOVERS12V2 - 1219", "iTraxx Europe Crossover series 12 Version 2", - "ITRAXX-XOVERS12V2-1219 EUR SEN MMR I03 CDS", 2455096, 2458838, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBM9", "ITRAXX", 12, "XOVER", "XVR", "XO", 2, 10, - "245739", 1, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925638", "9489879", - "USD ITRAXX-XOVERS12V2 - 1214", "iTraxx Europe Crossover series 12 Version 2", - "ITRAXX-XOVERS12V2-1214 USD SEN MMR I03 CDS", 2455096, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KBM9", "USD ITRAXX", 12, "XOVER", "XVR", "XO", 2, 5, - null, 1, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925639", "9489884", - "USD ITRAXX-XOVERS13V2 - 0615", "iTraxx Europe Crossover series 13 Version 2", - "ITRAXX-XOVERS13V2-0615 USD SEN MMR I03 CDS", 2455278, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KBN7", "USD ITRAXX", 13, "XOVER", "XVR", "XO", 2, 5, - null, 1, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925640", "9489881", - "USD ITRAXX-XOVERS12V2 - 1219", "iTraxx Europe Crossover series 12 Version 2", - "ITRAXX-XOVERS12V2-1219 USD SEN MMR I03 CDS", 2455096, 2458838, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KBM9", "USD ITRAXX", 12, "XOVER", "XVR", "XO", 2, 10, - null, 1, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925641", "9489886", - "USD ITRAXX-XOVERS13V2 - 0620", "iTraxx Europe Crossover series 13 Version 2", - "ITRAXX-XOVERS13V2-0620 USD SEN MMR I03 CDS", 2455278, 2459021, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KBN7", "USD ITRAXX", 13, "XOVER", "XVR", "XO", 2, 10, - null, 1, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.9.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925647", "9489709", - "ITRAXX-XOVERS9V5 - 0615", "iTraxx Europe Crossover series 9 Version 5", - "ITRAXX-XOVERS9V5-0615 EUR SEN MMR I03 CDS", 2454546, 2457194, 0.0645, "EUR", - "ACT/360", false, 0.35000000000000003, 4, "2I667KBK3", "ITRAXX", 9, "XOVER", "XVR", "XO", 5, 7, - "245740", 0.9400000000000001, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.4.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925657", "9492995", - "ITRAXX-XOVERS4V4 - 1210", "iTraxx Europe Crossover Series 4 Version 4", - "ITRAXX-XOVERS4V4-1210 EUR SEN MMR I03 CDS", 2453634, 2455551, 0.029500000000000002, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBP2", "ITRAXX", 4, "XOVER", "XVR", "XO", 4, 5, - "245809", 0.9500000000000001, 41, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.4.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925658", "9492998", - "ITRAXX-XOVERS4V4 - 1215", "iTraxx Europe Crossover Series 4 Version 4", - "ITRAXX-XOVERS4V4-1215 EUR SEN MMR I03 CDS", 2453634, 2457377, 0.0345, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBP2", "ITRAXX", 4, "XOVER", "XVR", "XO", 4, 10, - "245809", 0.9500000000000001, 41, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVERV45Y296.5Y.4.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925659", "9493007", - "ITRAXX-XOVERS4V4-5Y296 - 1210", "iTraxx Europe Crossover Series 4 Version 4", - "ITRAXX-XOVERS4V4-5Y296 EUR SEN MMR I03 CDS", 2453634, 2455551, 0.0296, "EUR", - "ACT/360", false, 0.4, 2, "2I667KBP2 296", "ITRAXX", 4, "XOVERV45Y296", null, "XO", 4, 5, - null, 0.9500000000000001, 41, 0, "LON", false, false, true, null, "i-Traxx-European")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.8.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925661", "9493026", - "ITRAXX-XOVERS8V6 - 1210", "iTraxx Europe Crossover series 8 Version 6", - "ITRAXX-XOVERS8V6 -1210 EUR SEN MMR I03 CDS", 2454364, 2455551, 0.027, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBT4", "ITRAXX", 8, "XOVER", "XVR", "XO", 6, 3, - "245813", 0.92, 51, 0, "LON", true, true, true, null, "XVR")); - - return true; - } - - private static final boolean InitCDXRefDataSet35() - { - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.8.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925662", "9493041", - "ITRAXX-XOVERS8V6 - 1212", "iTraxx Europe Crossover series 8 Version 6", - "ITRAXX-XOVERS8V6-1212 EUR SEN MMR I03 CDS", 2454364, 2456282, 0.0375, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBT4", "ITRAXX", 8, "XOVER", "XVR", "XO", 6, 5, - "245813", 0.92, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.10.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925663", "9493048", - "ITRAXX-XOVERS10V5 - 1215", "iTraxx Europe Crossover series 10 Version 5", - "ITRAXX-XOVERS10V5-1215 EUR SEN MMR I03 CDS", 2454739, 2457377, 0.055, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBV9", "ITRAXX", 10, "XOVER", "XVR", "XO", 5, 7, - "245815", 0.9400000000000001, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.10.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925664", "9493010", - "ITRAXX-XOVERS10V5 - 1218", "iTraxx Europe Crossover series 10 Version 5", - "ITRAXX-XOVERS10V5-1218 EUR SEN MMR I03 CDS", 2454739, 2458473, 0.054, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBV9", "ITRAXX", 10, "XOVER", "XVR", "XO", 5, 10, - "245815", 0.9400000000000001, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.10.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925665", "9493012", - "USD ITRAXX-XOVERS10V5 - 1213", "iTraxx Europe Crossover series 10 Version 5", - "ITRAXX-XOVERS10V5-1213 USD SEN MMR I03 CDS", 2454739, 2456647, 0.056, "USD", - "ACT/360", false, 0.4, 4, "2I667KBV9", "USD ITRAXX", 10, "XOVER", "XVR", "XO", 5, 5, - null, 0.9400000000000001, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.3.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925666", "9493014", - "ITRAXX-XOVERS3V4 - 0615", "iTraxx Europe Crossover Series 3 VERSION 4", - "ITRAXX-XOVERS3V4-0615 EUR SEN MMR I03 CDS", 2453451, 2457194, 0.026000000000000002, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBO5", "ITRAXX", 3, "XOVER", "XVR", "XO", 4, 10, - "245808", 0.9715, 36, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.5.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925667", "9493016", - "ITRAXX-XOVERS5V4 - 0611", "iTraxx Europe Crossover Series 5 Version 4", - "ITRAXX-XOVERS5V4-0611 EUR SEN MMR I03 CDS", 2453815, 2455733, 0.029, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBQ0", "ITRAXX", 5, "XOVER", "XVR", "XO", 4, 5, - "245810", 0.9555, 45, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.5.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925668", "9493020", - "ITRAXX-XOVERS5V4 - 0616", "iTraxx Europe Crossover Series 5 Version 4", - "ITRAXX-XOVERS5V4-0616 EUR SEN MMR I03 CDS", 2453815, 2457560, 0.035, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBQ0", "ITRAXX", 5, "XOVER", "XVR", "XO", 4, 10, - "245810", 0.9555, 45, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.5.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925669", "9493023", - "USD ITRAXX-XOVERS5V4 - 0611", "iTraxx Europe Crossover Series 5 Version 4", - "ITRAXX-XOVERS5V4-0611 USD SEN MMR I03 CDS", 2453815, 2455733, 0.029, "USD", - "ACT/360", false, 0.4, 4, "2I667KBQ0", "USD ITRAXX", 5, "XOVER", "XVR", "XO", 4, 5, - null, 0.9555, 45, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.6.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925670", "9493029", - "ITRAXX-XOVERS6V4 - 1211", "iTraxx Europe Crossover series 6 Version 4", - "ITRAXX-XOVERS6V4-1211 EUR SEN MMR I03 CDS", 2453999, 2455916, 0.028, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBR8", "ITRAXX", 6, "XOVER", "XVR", "XO", 4, 5, - "245811", 0.9555, 45, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.6.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925671", "9493019", - "ITRAXX-XOVERS6V4 - 1216", "iTraxx Europe Crossover series 6 Version 4", - "ITRAXX-XOVERS6V4-1216 EUR SEN MMR I03 CDS", 2453999, 2457743, 0.0345, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBR8", "ITRAXX", 6, "XOVER", "XVR", "XO", 4, 10, - "245811", 0.9555, 45, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.6.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925672", "9493030", - "USD ITRAXX-XOVERS6V4 - 1211", "iTraxx Europe Crossover series 6 Version 4", - "ITRAXX-XOVERS6V4-1211 USD SEN MMR I03 CDS", 2453999, 2455916, 0.028, "USD", - "ACT/360", false, 0.4, 4, "2I667KBR8", "USD ITRAXX", 6, "XOVER", "XVR", "XO", 4, 5, - null, 0.9555, 45, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.7.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925673", "9493035", - "ITRAXX-XOVERS7V5 - 0612", "iTraxx Europe Crossover series 7 Version 5", - "ITRAXX-XOVERS7V5-0612 EUR SEN MMR I03 CDS", 2454180, 2456099, 0.023, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBS6", "ITRAXX", 7, "XOVER", "XVR", "XO", 5, 5, - "245812", 0.9400000000000001, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.7.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925674", "9493040", - "ITRAXX-XOVERS7V5 - 0617", "iTraxx Europe Crossover series 7 Version 5", - "ITRAXX-XOVERS7V5-0617 EUR SEN MMR I03 CDS", 2454180, 2457925, 0.032, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBS6", "ITRAXX", 7, "XOVER", "XVR", "XO", 5, 10, - "245812", 0.9400000000000001, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.7.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925675", "9493045", - "USD ITRAXX-XOVERS7V5 - 0612", "iTraxx Europe Crossover series 7 Version 5", - "ITRAXX-XOVERS7V5-0612 USD SEN MMR I03 CDS", 2454180, 2456099, 0.023, "USD", - "ACT/360", false, 0.4, 4, "2I667KBS6", "USD ITRAXX", 7, "XOVER", "XVR", "XO", 5, 5, - null, 0.9400000000000001, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.9.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925676", "9493049", - "ITRAXX-XOVERS9V6 - 0613", "iTraxx Europe Crossover series 9 Version 6", - "ITRAXX-XOVERS9V6-0613 EUR SEN MMR I03 CDS", 2454546, 2456464, 0.065, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBU1", "ITRAXX", 9, "XOVER", "XVR", "XO", 6, 5, - "245814", 0.92, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.9.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925677", "9493054", - "ITRAXX-XOVERS9V6 - 0615", "iTraxx Europe Crossover series 9 Version 6", - "ITRAXX-XOVERS9V6-0615 EUR SEN MMR I03 CDS", 2454546, 2457194, 0.0645, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBU1", "ITRAXX", 9, "XOVER", "XVR", "XO", 6, 7, - "245814", 0.92, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.9.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925678", "9493058", - "ITRAXX-XOVERS9V6 - 0618", "iTraxx Europe Crossover series 9 Version 6", - "ITRAXX-XOVERS9V6-0618 EUR SEN MMR I03 CDS", 2454546, 2458290, 0.064, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBU1", "ITRAXX", 9, "XOVER", "XVR", "XO", 6, 10, - "245814", 0.92, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.10.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925679", "9492994", - "ITRAXX-XOVERS10V5 - 1211", "iTraxx Europe Crossover series 10 Version 5", - "ITRAXX-XOVERS10V5-1211 EUR SEN MMR I03 CDS", 2454739, 2455916, 0.053000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBV9", "ITRAXX", 10, "XOVER", "XVR", "XO", 5, 3, - "245815", 0.9400000000000001, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.10.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925680", "9493004", - "ITRAXX-XOVERS10V5 - 1213", "iTraxx Europe Crossover series 10 Version 5", - "ITRAXX-XOVERS10V5-1213 EUR SEN MMR I03 CDS", 2454739, 2456647, 0.056, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBV9", "ITRAXX", 10, "XOVER", "XVR", "XO", 5, 5, - "245815", 0.9400000000000001, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.8.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925681", "9493008", - "ITRAXX-XOVERS8V6 - 1217", "iTraxx Europe Crossover series 8 Version 6", - "ITRAXX-XOVERS8V6-1217 EUR SEN MMR I03 CDS", 2454364, 2458108, 0.046, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBT4", "ITRAXX", 8, "XOVER", "XVR", "XO", 6, 10, - "245813", 0.92, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.8.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925682", "9493015", - "USD ITRAXX-XOVERS8V6 - 1212", "iTraxx Europe Crossover series 8 Version 6", - "ITRAXX-XOVERS8V6-1212 USD SEN MMR I03 CDS", 2454364, 2456282, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I667KBT4", "USD ITRAXX", 8, "XOVER", "XVR", "XO", 6, 5, - null, 0.92, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.9.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925683", "9493021", - "USD ITRAXX-XOVERS9V6 - 0613", "iTraxx Europe Crossover series 9 Version 6", - "ITRAXX-XOVERS9V6-0613 USD SEN MMR I03 CDS", 2454546, 2456464, 0.065, "USD", - "ACT/360", false, 0.4, 4, "2I667KBU1", "USD ITRAXX", 9, "XOVER", "XVR", "XO", 6, 5, - null, 0.92, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.9.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925684", "9493024", - "ITRAXX-XOVERS9V6 - 0611", "iTraxx Europe Crossover series 9 Version 6", - "ITRAXX-XOVERS9V6-0611 EUR SEN MMR I03 CDS", 2454546, 2455733, 0.0625, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBU1", "ITRAXX", 9, "XOVER", "XVR", "XO", 6, 3, - "245814", 0.92, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.8.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925685", "9493036", - "ITRAXX-XOVERS8V6 - 1214", "iTraxx Europe Crossover series 8 Version 6", - "ITRAXX-XOVERS8V6-1214 EUR SEN MMR I03 CDS", 2454364, 2457012, 0.039, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBT4", "ITRAXX", 8, "XOVER", "XVR", "XO", 6, 7, - "245813", 0.92, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.10.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925686", "9492996", - "USD ITRAXX-XOVERS10V5 - 1218", "iTraxx Europe Crossover series 10 Version 5", - "ITRAXX-XOVERS10V5-1218 USD SEN MMR I03 CDS", 2454739, 2458473, 0.054, "USD", - "ACT/360", false, 0.4, 4, "2I667KBV9", "USD ITRAXX", 10, "XOVER", "XVR", "XO", 5, 10, - null, 0.9400000000000001, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925692", "9494923", - "LCDXNAS9V23 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_78/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.55, 4, "5F199GDG9", "LCDX", 9, "LCDXNA", null, "IG", 23, 5, - null, 0.78, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925693", "9494926", - "LCDXNAS10V23 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_78/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.55, 4, "5F199GDH7", "LCDX", 10, "LCDXNA", null, "IG", 23, 5, - null, 0.78, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.10.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925694", "9494942", - "LCDXNAS10V23 - 0611", "LCDX.NA.10", - "CDX_NA_LN_S10_100_03YR_78/100", 2454561, 2455733, 0.0275, "USD", - "ACT/360", false, 0.55, 4, "5F199GDH7", "LCDX", 10, "LCDXNA", null, "IG", 23, 3, - null, 0.78, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.12.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925695", "9494944", - "LCDXNAS12V12 - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_88/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.55, 4, "5F199GDI5", "LCDX", 12, "LCDXNA", null, "IG", 12, 5, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.12.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925696", "9494939", - "LCDXNAS12V12 - 0612", "LCDX.NA.12", - "CDX_NA_LN_S12_100_03YR_88/100", 2454938, 2456099, 0.05, "USD", - "ACT/360", false, 0.55, 4, "5F199GDI5", "LCDX", 12, "LCDXNA", null, "IG", 12, 3, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925697", "9494943", - "LCDXNAS13V2 - 1214", "LCDX.NA.13", - "CDX_NA_LN_S13_100_99/100", 2455110, 2457012, 0.05, "USD", - "ACT/360", false, 0.55, 4, "5F199GDJ3", "LCDX", 13, "LCDXNA", null, "IG", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V23 FXD.LCDXNAV23 FXD.5Y.9.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925699", "9495375", - "LCDXNAS9V23 FXD - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_FXD_78/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDG9 FXD", "LCDXNAS9V23 FXD", 9, "LCDXNAV23 FXD", null, "IG", 23, 5, - null, 0.78, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.9.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925700", "9495382", - "LCDXNAS9V23 - 1214", "LCDX.NA.9", - "CDX_NA_LN_S09_100_07YR_78/100", 2454378, 2457012, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDG9", "LCDX", 9, "LCDXNA", null, "IG", 23, 7, - null, 0.78, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.9.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925701", "9495388", - "LCDXNAS9V23 - 1210", "LCDX.NA.9", - "CDX_NA_LN_S09_100_03YR_78/100", 2454378, 2455551, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDG9", "LCDX", 9, "LCDXNA", null, "IG", 23, 3, - null, 0.78, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.9.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925702", "9495395", - "LCDXNAS9V23 - 1217", "LCDX.NA.9", - "CDX_NA_LN_S09_100_10YR_78/100", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDG9", "LCDX", 9, "LCDXNA", null, "IG", 23, 10, - null, 0.78, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.9.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925703", "9495401", - "LCDXNAS9V23 - 1211", "LCDX.NA.9", - "CDX_NA_LN_S09_100_04YR_78/100", 2454378, 2455916, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDG9", "LCDX", 9, "LCDXNA", null, "IG", 23, 4, - null, 0.78, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.9.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925704", "9495404", - "LCDXNAS9V23 - 1213", "LCDX.NA.9", - "CDX_NA_LN_S09_100_06YR_78/100", 2454378, 2456647, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDG9", "LCDX", 9, "LCDXNA", null, "IG", 23, 6, - null, 0.78, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS10V23 FXD.LCDXNAV23 FXD.5Y.10.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925705", "9495399", - "LCDXNAS10V23 FXD - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_FXD_78/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GDH7 FXD", "LCDXNAS10V23 FXD", 10, "LCDXNAV23 FXD", null, "IG", 23, 5, - null, 0.78, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.10.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925706", "9495392", - "LCDXNAS10V23 - 0614", "LCDX.NA.10", - "CDX_NA_LN_S10_100_06YR_78/100", 2454561, 2456829, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GDH7", "LCDX", 10, "LCDXNA", null, "IG", 23, 6, - null, 0.78, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.10.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925707", "9495411", - "LCDXNAS10V23 - 0610", "LCDX.NA.10", - "CDX_NA_LN_S10_100_02YR_78/100", 2454561, 2455368, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GDH7", "LCDX", 10, "LCDXNA", null, "IG", 23, 2, - null, 0.78, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.10.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925708", "9495425", - "LCDXNAS10V23 - 0615", "LCDX.NA.10", - "CDX_NA_LN_S10_100_07YR_78/100", 2454561, 2457194, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GDH7", "LCDX", 10, "LCDXNA", null, "IG", 23, 7, - null, 0.78, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.10.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925709", "9495428", - "LCDXNAS10V23 - 0618", "LCDX.NA.10", - "CDX_NA_LN_S10_100_10YR_78/100", 2454561, 2458290, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GDH7", "LCDX", 10, "LCDXNA", null, "IG", 23, 10, - null, 0.78, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.10.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925710", "9495436", - "LCDXNAS10V23 - 0612", "LCDX.NA.10", - "CDX_NA_LN_S10_100_04YR_78/100", 2454561, 2456099, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GDH7", "LCDX", 10, "LCDXNA", null, "IG", 23, 4, - null, 0.78, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.12.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925711", "9495442", - "LCDXNAS12V12 - 0610", "LCDX.NA.12", - "CDX_NA_LN_S12_100_01YR_88/100", 2454938, 2455368, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDI5", "LCDX", 12, "LCDXNA", null, "IG", 12, 1, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS12V12 FXD.LCDXNAV12 FXD.5Y.12.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925712", "9495374", - "LCDXNAS12V12 FXD - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_FXD_88/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDI5 FXD", "LCDXNAS12V12 FXD", 12, "LCDXNAV12 FXD", null, "IG", 12, 5, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.12.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925713", "9495383", - "LCDXNAS12V12 - 0611", "LCDX.NA.12", - "CDX_NA_LN_S12_100_02YR_88/100", 2454938, 2455733, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDI5", "LCDX", 12, "LCDXNA", null, "IG", 12, 2, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.12.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925714", "9495389", - "LCDXNAS12V12 - 0616", "LCDX.NA.12", - "CDX_NA_LN_S12_100_07YR_88/100", 2454938, 2457560, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDI5", "LCDX", 12, "LCDXNA", null, "IG", 12, 7, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.12.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925715", "9495391", - "LCDXNAS12V12 - 0619", "LCDX.NA.12", - "CDX_NA_LN_S12_100_10YR_88/100", 2454938, 2458655, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDI5", "LCDX", 12, "LCDXNA", null, "IG", 12, 10, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.12.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925716", "9495394", - "LCDXNAS12V12 - 0613", "LCDX.NA.12", - "CDX_NA_LN_S12_100_04YR_88/100", 2454938, 2456464, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDI5", "LCDX", 12, "LCDXNA", null, "IG", 12, 4, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.12.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925717", "9495403", - "LCDXNAS12V12 - 0615", "LCDX.NA.12", - "CDX_NA_LN_S12_100_06YR_88/100", 2454938, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDI5", "LCDX", 12, "LCDXNA", null, "IG", 12, 6, - null, 0.88, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925718", "9495416", - "LCDXNAS13V2 - 1210", "LCDX.NA.13", - "CDX_NA_LN_S13_100_01YR_99/100", 2455110, 2455551, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDJ3", "LCDX", 13, "LCDXNA", null, "IG", 2, 1, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925719", "9495423", - "LCDXNAS13V2 - 1212", "LCDX.NA.13", - "CDX_NA_LN_S13_100_03YR_99/100", 2455110, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDJ3", "LCDX", 13, "LCDXNA", null, "IG", 2, 3, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS13V2 FXD.LCDXNAV2 FXD.5Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925720", "9495426", - "LCDXNAS13V2 FXD - 1214", "LCDX.NA.13", - "CDX_NA_LN_S13_100_FXD_99/100", 2455110, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDJ3 FXD", "LCDXNAS13V2 FXD", 13, "LCDXNAV2 FXD", null, "IG", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925721", "9495385", - "LCDXNAS13V2 - 1211", "LCDX.NA.13", - "CDX_NA_LN_S13_100_02YR_99/100", 2455110, 2455916, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDJ3", "LCDX", 13, "LCDXNA", null, "IG", 2, 2, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925722", "9495400", - "LCDXNAS13V2 - 1216", "LCDX.NA.13", - "CDX_NA_LN_S13_100_07YR_99/100", 2455110, 2457743, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDJ3", "LCDX", 13, "LCDXNA", null, "IG", 2, 7, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925723", "9495405", - "LCDXNAS13V2 - 1219", "LCDX.NA.13", - "CDX_NA_LN_S13_100_10YR_99/100", 2455110, 2458838, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDJ3", "LCDX", 13, "LCDXNA", null, "IG", 2, 10, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925724", "9495412", - "LCDXNAS13V2 - 1213", "LCDX.NA.13", - "CDX_NA_LN_S13_100_04YR_99/100", 2455110, 2456647, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDJ3", "LCDX", 13, "LCDXNA", null, "IG", 2, 4, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925725", "9495415", - "LCDXNAS13V2 - 1215", "LCDX.NA.13", - "CDX_NA_LN_S13_100_06YR_99/100", 2455110, 2457377, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDJ3", "LCDX", 13, "LCDXNA", null, "IG", 2, 6, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.14.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925734", "9494934", - "LCDXNAS14V2 - 0615", "LCDX.NA.14", - "CDX_NA_LN_S14_100_99/100", 2455278, 2457194, 0.025, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GDP9", "LCDX", 14, "LCDXNA", null, "IG", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.2.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925766", "9506657", - "ITRAXX-LevXS2V11 - 0613", "ITRAXX LEVX SENIOR SERIES 2 VERSION 11", - "ITRAXX LEVX SENIOR SERIES 2 VERSION 11 EUR 1ST SEC RES I03 CDS", 2454543, 2456464, 0.052500000000000005, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJED1", "ITRAXX", 2, "LevX", null, "IG", 11, 5, - null, 0.8666, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.3.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925767", "9506658", - "ITRAXX-LevXS3V9 - 1213", "ITRAXX LEVX SENIOR SERIES 3 VERSION 9", - "ITRAXX LEVX SENIOR SERIES 3 VERSION 9 EUR 1ST SEC RES I03 CDS", 2454739, 2456647, 0.0575, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJEE9", "ITRAXX", 3, "LevX", null, "IG", 9, 5, - null, 0.8934000000000001, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.4.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925768", "9506656", - "ITRAXX-LevXS4V4 - 0614", "ITRAXX LEVX SENIOR SERIES 4 VERSION 4", - "ITRAXX LEVX SENIOR SERIES 4 VERSION 4 EUR 1ST SEC RES I03 CDS", 2454911, 2456829, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJEF6", "ITRAXX", 4, "LevX", null, "IG", 4, 5, - null, 0.9400000000000001, 50, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.5.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925769", "9506650", - "ITRAXX-LevXS5V4 - 1214", "ITRAXX LEVX SENIOR SERIES 5 VERSION 4", - "ITRAXX LEVX SENIOR SERIES 5 VERSION 4 EUR 1ST SEC RES I03 CDS", 2455096, 2457012, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJEG4", "ITRAXX", 5, "LevX", null, "IG", 4, 5, - null, 0.925, 40, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.24", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925818", "9508991", - "LCDXNAS10V24 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_77/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GDM6", "LCDX", 10, "LCDXNA", null, "IG", 24, 5, - null, 0.77, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.10.24", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925820", "9508993", - "LCDXNAS10V24 - 0611", "LCDX.NA.10", - "CDX_NA_LN_S10_100_03YR_77/100", 2454561, 2455733, 0.0275, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GDM6", "LCDX", 10, "LCDXNA", null, "IG", 24, 3, - null, 0.77, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.12.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925821", "9509013", - "LCDXNAS12V13 - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_87/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GDN4", "LCDX", 12, "LCDXNA", null, "IG", 13, 5, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.12.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925822", "9509021", - "LCDXNAS12V13 - 0612", "LCDX.NA.12", - "CDX_NA_LN_S12_100_03YR_87/100", 2454938, 2456099, 0.05, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GDN4", "LCDX", 12, "LCDXNA", null, "IG", 13, 3, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.13.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925823", "9509087", - "LCDXNAS13V3 - 1214", "LCDX.NA.13", - "CDX_NA_LN_S13_100_98/100", 2455110, 2457012, 0.05, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GDO2", "LCDX", 13, "LCDXNA", null, "IG", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.28", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925829", "9509009", - "LCDXNAS8V28 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_73/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GDK0", "LCDX", 8, "LCDXNA", null, "IG", 28, 5, - null, 0.73, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.24", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925830", "9509109", - "LCDXNAS9V24 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_77/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GDL8", "LCDX", 9, "LCDXNA", null, "IG", 24, 5, - null, 0.77, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS10V24 FXD.LCDXNAV24 FXD.5Y.10.24", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925837", "9508997", - "LCDXNAS10V24 FXD - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_FXD_77/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GDM6 FXD", "LCDXNAS10V24 FXD", 10, "LCDXNAV24 FXD", null, "IG", 24, 5, - null, 0.77, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.10.24", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925838", "9509000", - "LCDXNAS10V24 - 0614", "LCDX.NA.10", - "CDX_NA_LN_S10_100_06YR_77/100", 2454561, 2456829, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GDM6", "LCDX", 10, "LCDXNA", null, "IG", 24, 6, - null, 0.77, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.10.24", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925839", "9509002", - "LCDXNAS10V24 - 0615", "LCDX.NA.10", - "CDX_NA_LN_S10_100_07YR_77/100", 2454561, 2457194, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GDM6", "LCDX", 10, "LCDXNA", null, "IG", 24, 7, - null, 0.77, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.10.24", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925842", "9508994", - "LCDXNAS10V24 - 0618", "LCDX.NA.10", - "CDX_NA_LN_S10_100_10YR_77/100", 2454561, 2458290, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GDM6", "LCDX", 10, "LCDXNA", null, "IG", 24, 10, - null, 0.77, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.10.24", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925843", "9509004", - "LCDXNAS10V24 - 0612", "LCDX.NA.10", - "CDX_NA_LN_S10_100_04YR_77/100", 2454561, 2456099, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GDM6", "LCDX", 10, "LCDXNA", null, "IG", 24, 4, - null, 0.77, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS12V13 FXD.LCDXNAV13 FXD.5Y.12.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925844", "9509038", - "LCDXNAS12V13 FXD - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_FXD_87/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDN4 FXD", "LCDXNAS12V13 FXD", 12, "LCDXNAV13 FXD", null, "IG", 13, 5, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.12.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925845", "9509045", - "LCDXNAS12V13 - 0611", "LCDX.NA.12", - "CDX_NA_LN_S12_100_02YR_87/100", 2454938, 2455733, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDN4", "LCDX", 12, "LCDXNA", null, "IG", 13, 2, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.12.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925847", "9509050", - "LCDXNAS12V13 - 0616", "LCDX.NA.12", - "CDX_NA_LN_S12_100_07YR_87/100", 2454938, 2457560, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDN4", "LCDX", 12, "LCDXNA", null, "IG", 13, 7, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.12.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925848", "9509057", - "LCDXNAS12V13 - 0619", "LCDX.NA.12", - "CDX_NA_LN_S12_100_10YR_87/100", 2454938, 2458655, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDN4", "LCDX", 12, "LCDXNA", null, "IG", 13, 10, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.12.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925849", "9509060", - "LCDXNAS12V13 - 0613", "LCDX.NA.12", - "CDX_NA_LN_S12_100_04YR_87/100", 2454938, 2456464, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDN4", "LCDX", 12, "LCDXNA", null, "IG", 13, 4, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.14.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925850", "9495402", - "LCDXNAS14V2 - 0620", "LCDX.NA.14", - "CDX_NA_LN_S14_100_10YR_99/100", 2455278, 2459021, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDP9", "LCDX", 14, "LCDXNA", null, "IG", 2, 10, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.14.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925851", "9495406", - "LCDXNAS14V2 - 0614", "LCDX.NA.14", - "CDX_NA_LN_S14_100_04YR_99/100", 2455278, 2456829, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDP9", "LCDX", 14, "LCDXNA", null, "IG", 2, 4, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.14.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925852", "9495414", - "LCDXNAS14V2 - 0616", "LCDX.NA.14", - "CDX_NA_LN_S14_100_06YR_99/100", 2455278, 2457560, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDP9", "LCDX", 14, "LCDXNA", null, "IG", 2, 6, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.28", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925854", "9509016", - "LCDXNAS8V28 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_73/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GDK0", "LCDX", 8, "LCDXNA", null, "IG", 28, 10, - null, 0.73, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V28 FXD.LCDXNAV28 FXD.5Y.8.28", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925855", "9509022", - "LCDXNAS8V28 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_73/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GDK0 FXD", "LCDXNAS8V28 FXD", 8, "LCDXNAV28 FXD", null, "IG", 28, 5, - null, 0.73, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.28", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925856", "9508949", - "LCDXNAS8V28 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_73/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GDK0", "LCDX", 8, "LCDXNA", null, "IG", 28, 6, - null, 0.73, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.28", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925857", "9509025", - "LCDXNAS8V28 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_73/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GDK0", "LCDX", 8, "LCDXNA", null, "IG", 28, 7, - null, 0.73, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.28", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925858", "9509098", - "LCDXNAS8V28 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_73/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GDK0", "LCDX", 8, "LCDXNA", null, "IG", 28, 4, - null, 0.73, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V24 FXD.LCDXNAV24 FXD.5Y.9.24", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925859", "9509026", - "LCDXNAS9V24 FXD - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_FXD_77/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDL8 FXD", "LCDXNAS9V24 FXD", 9, "LCDXNAV24 FXD", null, "IG", 24, 5, - null, 0.77, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.12.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925860", "9509083", - "LCDXNAS12V13 - 0615", "LCDX.NA.12", - "CDX_NA_LN_S12_100_06YR_87/100", 2454938, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDN4", "LCDX", 12, "LCDXNA", null, "IG", 13, 6, - null, 0.87, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.9.24", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925861", "9509071", - "LCDXNAS9V24 - 1214", "LCDX.NA.9", - "CDX_NA_LN_S09_100_07YR_77/100", 2454378, 2457012, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDL8", "LCDX", 9, "LCDXNA", null, "IG", 24, 7, - null, 0.77, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.13.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925862", "9509096", - "LCDXNAS13V3 - 1210", "LCDX.NA.13", - "CDX_NA_LN_S13_100_01YR_98/100", 2455110, 2455551, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDO2", "LCDX", 13, "LCDXNA", null, "IG", 3, 1, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.13.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925863", "9509099", - "LCDXNAS13V3 - 1212", "LCDX.NA.13", - "CDX_NA_LN_S13_100_03YR_98/100", 2455110, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDO2", "LCDX", 13, "LCDXNA", null, "IG", 3, 3, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS13V3 FXD.LCDXNAV3 FXD.5Y.13.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925864", "9509075", - "LCDXNAS13V3 FXD - 1214", "LCDX.NA.13", - "CDX_NA_LN_S13_100_FXD_98/100", 2455110, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDO2 FXD", "LCDXNAS13V3 FXD", 13, "LCDXNAV3 FXD", null, "IG", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.13.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925865", "9509078", - "LCDXNAS13V3 - 1211", "LCDX.NA.13", - "CDX_NA_LN_S13_100_02YR_98/100", 2455110, 2455916, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDO2", "LCDX", 13, "LCDXNA", null, "IG", 3, 2, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.13.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925866", "9509086", - "LCDXNAS13V3 - 1216", "LCDX.NA.13", - "CDX_NA_LN_S13_100_07YR_98/100", 2455110, 2457743, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDO2", "LCDX", 13, "LCDXNA", null, "IG", 3, 7, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.9.24", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925867", "9509072", - "LCDXNAS9V24 - 1210", "LCDX.NA.9", - "CDX_NA_LN_S09_100_03YR_77/100", 2454378, 2455551, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDL8", "LCDX", 9, "LCDXNA", null, "IG", 24, 3, - null, 0.77, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.13.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925868", "9509089", - "LCDXNAS13V3 - 1219", "LCDX.NA.13", - "CDX_NA_LN_S13_100_10YR_98/100", 2455110, 2458838, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDO2", "LCDX", 13, "LCDXNA", null, "IG", 3, 10, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.13.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925869", "9509097", - "LCDXNAS13V3 - 1213", "LCDX.NA.13", - "CDX_NA_LN_S13_100_04YR_98/100", 2455110, 2456647, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDO2", "LCDX", 13, "LCDXNA", null, "IG", 3, 4, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.13.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925870", "9508999", - "LCDXNAS13V3 - 1215", "LCDX.NA.13", - "CDX_NA_LN_S13_100_06YR_98/100", 2455110, 2457377, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDO2", "LCDX", 13, "LCDXNA", null, "IG", 3, 6, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet36() - { - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.9.24", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925871", "9509074", - "LCDXNAS9V24 - 1217", "LCDX.NA.9", - "CDX_NA_LN_S09_100_10YR_77/100", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDL8", "LCDX", 9, "LCDXNA", null, "IG", 24, 10, - null, 0.77, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.14.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925872", "9495256", - "LCDXNAS14V2 - 0611", "LCDX.NA.14", - "CDX_NA_LN_S14_100_01YR_99/100", 2455278, 2455733, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDP9", "LCDX", 14, "LCDXNA", null, "IG", 2, 1, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.9.24", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925873", "9509077", - "LCDXNAS9V24 - 1211", "LCDX.NA.9", - "CDX_NA_LN_S09_100_04YR_77/100", 2454378, 2455916, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDL8", "LCDX", 9, "LCDXNA", null, "IG", 24, 4, - null, 0.77, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.14.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925874", "9495257", - "LCDXNAS14V2 - 0613", "LCDX.NA.14", - "CDX_NA_LN_S14_100_03YR_99/100", 2455278, 2456464, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDP9", "LCDX", 14, "LCDXNA", null, "IG", 2, 3, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS14V2 FXD.LCDXNAV2 FXD.5Y.14.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925875", "9495258", - "LCDXNAS14V2 FXD - 0615", "LCDX.NA.14", - "CDX_NA_LN_S14_100_FXD_99/100", 2455278, 2457194, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDP9 FXD", "LCDXNAS14V2 FXD", 14, "LCDXNAV2 FXD", null, "IG", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.9.24", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925876", "9509079", - "LCDXNAS9V24 - 1213", "LCDX.NA.9", - "CDX_NA_LN_S09_100_06YR_77/100", 2454378, 2456647, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDL8", "LCDX", 9, "LCDXNA", null, "IG", 24, 6, - null, 0.77, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.14.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925877", "9495259", - "LCDXNAS14V2 - 0612", "LCDX.NA.14", - "CDX_NA_LN_S14_100_02YR_99/100", 2455278, 2456099, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDP9", "LCDX", 14, "LCDXNA", null, "IG", 2, 2, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.14.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925878", "9495397", - "LCDXNAS14V2 - 0617", "LCDX.NA.14", - "CDX_NA_LN_S14_100_07YR_99/100", 2455278, 2457925, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDP9", "LCDX", 14, "LCDXNA", null, "IG", 2, 7, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ IG.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925880", "9509218", - "ITRAXX-ASIAXJIGS14V1 - 1215", "iTraxx Asia ex-Japan IG Series Number 14 Version 1", - "ITRAXX ASIA EX-JAPAN IG SERIES NUMBER 14 VERSION 1 USD SEN RES I03 CDS", 2455460, 2457377, 0.01, "USD", - "ACT/360", false, 0.4, 4, "4ABCAMAG1", "ITRAXX", 14, "ASIAXJ IG", null, "ASHG", 1, 5, - null, 1, 50, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.AUSTRALIA.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925881", "9509570", - "ITRAXX-AUSTRALIAS14V1 - 1215", "iTraxx Australia Series Number 14 Version 1", - "ITRAXX AUSTRALIA SERIES NUMBER 14 VERSION 1 USD SEN MR I03 CDS", 2455460, 2457377, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I668IAN2", "ITRAXX", 14, "AUSTRALIA", null, "AUHG", 1, 5, - null, 1, 25, 0, "HKG", false, false, true, null, "Itraxx Australia")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925882", "9509573", - "ITRAXX-JAPANS14V1 - 1215", "iTraxx Japan Series Number 14 Version 1", - "ITRAXX JAPAN SERIES NUMBER 14 VERSION 1 JPY SEN RES I03 CDS", 2455461, 2457377, 0.01, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBC7", "ITRAXX", 14, "JAPAN", null, "JPHG", 1, 5, - null, 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.SOVXASIAPACIFIC.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925883", "9509219", - "ITRAXX-SOVX-ASIA-PACIFICS4 - 1215", "iTraxx SovX Asia Pacific Series 4 Version 1", - "ITRAXX SOVX ASIA-PACIFIC SERIES NUMBER 4 VERSION 1 USD SEN RES I03 CDS", 2455460, 2457377, 0.01, "USD", - "ACT/360", false, 0.4, 4, "4ABCANAB0", "ITRAXX", 4, "SOVXASIAPACIFIC", null, "ASHG", 1, 5, - null, 1, 10, 0, "HKG", false, false, true, null, "Itraxx SovX")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ HY.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925884", "9509574", - "ITRAXX-ASIAXJHYS14V1 - 1215", "iTraxx Asia ex-Japan HY Series Number 14 Version 1", - "ITRAXX ASIA EX-JAPAN HY SERIES NUMBER 14 VERSION 1 USD SEN RES I03 CDS", 2455460, 2457377, 0.05, "USD", - "ACT/360", false, 0.25, 4, "4ABCAGAG4", "ITRAXX", 14, "ASIAXJ HY", null, "ASHY", 1, 5, - null, 1, 20, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("CDX.EM.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925885", "9509451", - "CDX-EMS14V1 - 1215", "CDX.EM.14", - "CDX EM 14 5YR", 2455460, 2457377, 0.05, "USD", - "ACT/360", false, 0.25, 4, "2I65BZAN2", "CDX", 14, "EM", null, "EM", 1, 5, - null, 1, 15, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V4 FXD 97/100.5Y.15.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925886", "9509452", - "CDX-NAHYS15V4 FXD 97/100 - 1215", "CDX.NA.HY.15", - "CDX_NA_HY_S15_100_FXD_97/100", 2455460, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIW2 FXD", "CDX", 15, "NA HY V4 FXD 97/100", null, "HY", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925887", "9509453", - "CDX-NAHYS15V1 - 1215", "CDX.NA.HY.15", - "CDX_NA_HY_S15_100_SWP", 2455460, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHK9", "CDX", 15, "NA HY", null, "HY", 1, 5, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.1Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925888", "9509454", - "CDX-NAHYS15V1 - 1211", "CDX.NA.HY.15", - "CDX_NA_HY_S15_100_SWP_01YR", 2455460, 2455916, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHK9", "CDX", 15, "NA HY", null, "HY", 1, 1, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.2Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925889", "9509455", - "CDX-NAHYS15V1 - 1212", "CDX.NA.HY.15", - "CDX_NA_HY_S15_100_SWP_02YR", 2455460, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHK9", "CDX", 15, "NA HY", null, "HY", 1, 2, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925890", "9509456", - "CDX-NAHYS15V1 - 1213", "CDX.NA.HY.15", - "CDX_NA_HY_S15_100_SWP_03YR", 2455460, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHK9", "CDX", 15, "NA HY", null, "HY", 1, 3, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.4Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925892", "9509458", - "CDX-NAHYS15V1 - 1214", "CDX.NA.HY.15", - "CDX_NA_HY_S15_100_SWP_04YR", 2455460, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHK9", "CDX", 15, "NA HY", null, "HY", 1, 4, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.6Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925893", "9509459", - "CDX-NAHYS15V1 - 1216", "CDX.NA.HY.15", - "CDX_NA_HY_S15_100_SWP_06YR", 2455460, 2457743, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRHK9", "CDX", 15, "NA HY", null, "HY", 1, 6, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925894", "9509460", - "CDX-NAHYS15V1 - 1217", "CDX.NA.HY.15", - "CDX_NA_HY_S15_100_SWP_07YR", 2455460, 2458108, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHK9", "CDX", 15, "NA HY", null, "HY", 1, 7, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925895", "9509461", - "CDX-NAHYS15V1 - 1220", "CDX.NA.HY.15", - "CDX_NA_HY_S15_100_SWP_10YR", 2455460, 2459204, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHK9", "CDX", 15, "NA HY", null, "HY", 1, 10, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925897", "9509464", - "CDX-NAHYBS15V1 - 1215", "CDX.NA.HY.B.15", - "CDX_NA_HY_S15_B___SWP", 2455460, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSEL8", "CDX", 15, "NA HY B", null, "HY", 1, 5, - null, 1, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BBV1 FXD.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925898", "9509465", - "CDX-NAHYBBS15V1 FXD - 1215", "CDX.NA.HY.BB.15", - "CDX_NA_HY_S15_BB__FXD", 2455460, 2457377, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BVBW0 FXD", "CDX", 15, "NA HY BBV1 FXD", null, "HY", 1, 5, - null, 1, 37, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925899", "9509466", - "CDX-NAHYBBS15V1 - 1215", "CDX.NA.HY.BB.15", - "CDX_NA_HY_S15_BB__SWP", 2455460, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBW0", "CDX", 15, "NA HY BB", null, "HY", 1, 5, - null, 1, 37, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HBV2 FXD 29/30.5Y.15.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925900", "9509467", - "CDX-NAHYHBS15V1 FXD - 1215", "CDX.NA.HY.HB.15", - "CDX_NA_HY_S15_HB__FXD", 2455460, 2457377, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BWFG9 FXD", "CDX", 15, "NA HY HBV2 FXD 29/30", null, "HY", 2, 5, - null, 0.96666, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925901", "9509468", - "CDX-NAHYHBS15V1 - 1215", "CDX.NA.HY.HB.15", - "CDX_NA_HY_S15_HB__SWP", 2455460, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWEU9", "CDX", 15, "NA HY HB", null, "HY", 1, 5, - null, 1, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.1Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925902", "9509469", - "CDX-NAIGS15V1 - 1211", "CDX.NA.IG.15", - "CDX_NA_IG_S15_01Y_12/11", 2455460, 2455916, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCL7", "CDX", 15, "NA IG", null, "IG", 1, 1, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.2Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925903", "9509470", - "CDX-NAIGS15V1 - 1212", "CDX.NA.IG.15", - "CDX_NA_IG_S15_02Y_12/12", 2455460, 2456282, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCL7", "CDX", 15, "NA IG", null, "IG", 1, 2, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925904", "9509471", - "CDX-NAIGS15V1 - 1213", "CDX.NA.IG.15", - "CDX_NA_IG_S15_03Y_12/13", 2455460, 2456647, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCL7", "CDX", 15, "NA IG", null, "IG", 1, 3, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925905", "9509472", - "CDX-NAIGS15V1 - 1214", "CDX.NA.IG.15", - "CDX_NA_IG_S15_04Y_12/14", 2455460, 2457012, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCL7", "CDX", 15, "NA IG", null, "IG", 1, 4, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925906", "9509473", - "CDX-NAIGS15V1 - 1215", "CDX.NA.IG.15", - "CDX_NA_IG_S15_05Y_12/15", 2455460, 2457377, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCL7", "CDX", 15, "NA IG", null, "IG", 1, 5, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925907", "9509474", - "CDX-NAIGS15V1 EUR - 1215", "CDX.NA.IG.15", - "CDX_NA_IG_S15_05Y_12/15_EUR", 2455460, 2457377, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYCL7 EUR", "CDX", 15, "NA IG", null, "IG", 1, 5, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925908", "9509475", - "CDX-NAIGS15V1 - 1217", "CDX.NA.IG.15", - "CDX_NA_IG_S15_07Y_12/17", 2455460, 2458108, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCL7", "CDX", 15, "NA IG", null, "IG", 1, 7, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925909", "9509476", - "CDX-NAIGS15V1 - 1220", "CDX.NA.IG.15", - "CDX_NA_IG_S15_10Y_12/20", 2455460, 2459204, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCL7", "CDX", 15, "NA IG", null, "IG", 1, 10, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG CONS.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925910", "9509478", - "CDX-NAIGCONSS15V1 - 1215", "CDX.NA.IG.CONS.15", - "CDX_NA_IG_S15_CONS_12/15", 2455460, 2457377, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B0AQ2", "CDX", 15, "NA IG CONS", null, "IG", 1, 5, - null, 1, 38, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG ENRG.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925911", "9509479", - "CDX-NAIGENRGS15V1 - 1215", "CDX.NA.IG.ENRG.15", - "CDX_NA_IG_S15_ENRG_12/15", 2455460, 2457377, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B1AQ0", "CDX", 15, "NA IG ENRG", null, "IG", 1, 5, - null, 1, 17, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925912", "9509480", - "CDX-NAIGFINS15V1 - 1215", "CDX.NA.IG.FIN.15", - "CDX_NA_IG_S15_FIN_12/15", 2455460, 2457377, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B2CH6", "CDX", 15, "NA IG FIN", null, "IG", 1, 5, - null, 1, 20, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.1Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925913", "9509481", - "CDX-NAIGHVOLS15V1 - 1211", "CDX.NA.IG.HVOL.15", - "CDX_NA_IG_S15_HVOL_01Y_12/11", 2455460, 2455916, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AQ6", "CDX", 15, "NA IG HVOL", null, "HV", 1, 1, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.2Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925914", "9509482", - "CDX-NAIGHVOLS15V1 - 1212", "CDX.NA.IG.HVOL.15", - "CDX_NA_IG_S15_HVOL_02Y_12/12", 2455460, 2456282, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AQ6", "CDX", 15, "NA IG HVOL", null, "HV", 1, 2, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.3Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925915", "9509483", - "CDX-NAIGHVOLS15V1 - 1213", "CDX.NA.IG.HVOL.15", - "CDX_NA_IG_S15_HVOL_03Y_12/13", 2455460, 2456647, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AQ6", "CDX", 15, "NA IG HVOL", null, "HV", 1, 3, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.4Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925916", "9509484", - "CDX-NAIGHVOLS15V1 - 1214", "CDX.NA.IG.HVOL.15", - "CDX_NA_IG_S15_HVOL_04Y_12/14", 2455460, 2457012, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AQ6", "CDX", 15, "NA IG HVOL", null, "HV", 1, 4, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925917", "9509485", - "CDX-NAIGHVOLS15V1 - 1215", "CDX.NA.IG.HVOL.15", - "CDX_NA_IG_S15_HVOL_05Y_12/15", 2455460, 2457377, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AQ6", "CDX", 15, "NA IG HVOL", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.7Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925918", "9509486", - "CDX-NAIGHVOLS15V1 - 1217", "CDX.NA.IG.HVOL.15", - "CDX_NA_IG_S15_HVOL_07Y_12/17", 2455460, 2458108, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AQ6", "CDX", 15, "NA IG HVOL", null, "HV", 1, 7, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.10Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925919", "9509487", - "CDX-NAIGHVOLS15V1 - 1220", "CDX.NA.IG.HVOL.15", - "CDX_NA_IG_S15_HVOL_10Y_12/20", 2455460, 2459204, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AQ6", "CDX", 15, "NA IG HVOL", null, "HV", 1, 10, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG INDU.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925920", "9509489", - "CDX-NAIGINDUS15V1 - 1215", "CDX.NA.IG.INDU.15", - "CDX_NA_IG_S15_INDU_12/15", 2455460, 2457377, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B4AV3", "CDX", 15, "NA IG INDU", null, "IG", 1, 5, - null, 1, 25, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG TMT.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925921", "9509490", - "CDX-NAIGTMTS15V1 - 1215", "CDX.NA.IG.TMT.15", - "CDX_NA_IG_S15_TMT_12/15", 2455460, 2457377, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65DJAY2", "CDX", 15, "NA IG TMT", null, "IG", 1, 5, - null, 1, 25, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOLV1 EUR.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925922", "9509491", - "CDX-NAIGHVOLS15V1 EUR - 1215", "CDX.NA.IG.HVOL.15", - "CDX_NA_IG_S15_HVOL_05Y_12/15 EUR", 2455460, 2457377, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I65B3AQ6 EUR", "CDX", 15, "NA IG HVOLV1 EUR", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.3Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925927", "9509417", - "ITRAXX-EUROPES14V1 - 1213", "iTraxx Europe series 14 Version 1", - "ITRAXX-EUROPES14V1-1213 EUR SEN MMR I03 CDS", 2455460, 2456647, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAU9", "ITRAXX", 14, "EUROPE", "EUR", "IG", 1, 3, - "245923", 1, 126, 0, "LON", true, true, true, "ITXEB312", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925928", "9509418", - "ITRAXX-EUROPES14V1 - 1215", "iTraxx Europe series 14 Version 1", - "ITRAXX-EUROPES14V1-1215 EUR SEN MMR I03 CDS", 2455460, 2457377, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAU9", "ITRAXX", 14, "EUROPE", "EUR", "IG", 1, 5, - "245923", 1, 126, 0, "LON", true, true, true, "ITXEB512", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.7Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925929", "9509419", - "ITRAXX-EUROPES14V1 - 1217", "iTraxx Europe series 14 Version 1", - "ITRAXX-EUROPES14V1-1217 EUR SEN MMR I03 CDS", 2455460, 2458108, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAU9", "ITRAXX", 14, "EUROPE", "EUR", "IG", 1, 7, - "245923", 1, 126, 0, "LON", true, true, true, "ITXEB712", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925930", "9509420", - "ITRAXX-EUROPES14V1 - 1220", "iTraxx Europe series 14 Version 1", - "ITRAXX-EUROPES14V1-1220 EUR SEN MMR I03 CDS", 2455460, 2459204, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAU9", "ITRAXX", 14, "EUROPE", "EUR", "IG", 1, 10, - "245923", 1, 126, 0, "LON", true, true, true, "ITXEB012", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925931", "9509421", - "ITRAXX-XOVERS14V1 - 1213", "iTraxx Europe Crossover series 14 Version 1", - "ITRAXX-XOVERS14V1-1213 EUR SEN MMR I03 CDS", 2455460, 2456647, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBW7", "ITRAXX", 14, "XOVER", "XVR", "XO", 1, 3, - "245924", 1, 50, 0, "LON", true, true, true, "ITXEX312", "XVR")); - - UpdateCDXRefDataMap ("Itraxx.SovX West Eur.10Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925932", "9509448", - "Itraxx-SovX West Eur S4V1 - 1220", "Itraxx SovX Western Europe Series 4 Version 1", - "ITRAXX-SOVX WEST EUR S4V1-1220 USD SEN RES I03 CDS", 2455460, 2459204, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAD3", "Itraxx", 4, "SovX West Eur", "SOV", "SOWE", 1, 10, - "245934", 1, 15, 0, "LON", true, true, true, null, "SOV")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925933", "9509422", - "ITRAXX-XOVERS14V1 - 1215", "iTraxx Europe Crossover series 14 Version 1", - "ITRAXX-XOVERS14V1-1215 EUR SEN MMR I03 CDS", 2455460, 2457377, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBW7", "ITRAXX", 14, "XOVER", "XVR", "XO", 1, 5, - "245924", 1, 50, 0, "LON", true, true, true, "ITXEX512", "XVR")); - - UpdateCDXRefDataMap ("Itraxx.SovX West Eur.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925934", "9509447", - "Itraxx-SovX West Eur S4V1 - 1215", "Itraxx SovX Western Europe Series 4 Version 1", - "ITRAXX-SOVX WEST EUR S4V1-1215 USD SEN RES I03 CDS", 2455460, 2457377, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAD3", "Itraxx", 4, "SovX West Eur", "SOV", "SOWE", 1, 5, - "245934", 1, 15, 0, "LON", true, true, true, null, "SOV")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925935", "9509423", - "ITRAXX-XOVERS14V1 - 1217", "iTraxx Europe Crossover series 14 Version 1", - "ITRAXX-XOVERS14V1-1217 EUR SEN MMR I03 CDS", 2455460, 2458108, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBW7", "ITRAXX", 14, "XOVER", "XVR", "XO", 1, 7, - "245924", 1, 50, 0, "LON", true, true, true, "ITXEX712", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925936", "9509883", - "ITRAXX-LevXS7V1 - 1215", "iTraxx LevX Senior Series 7 Version 1", - "ITRAXX LEVX SENIOR SERIES 7 VERSION 1 EUR 1ST SEC RES I03 CDS", 2455460, 2457377, 0.05, "EUR", - "ACT/360", false, 0.71, 4, "4ABCAJEA7", "ITRAXX", 7, "LevX", null, "IG", 1, 5, - null, 1, 40, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925937", "9509424", - "ITRAXX-XOVERS14V1 - 1220", "iTraxx Europe Crossover series 14 Version 1", - "ITRAXX-XOVERS14V1-1220 EUR SEN MMR I03 CDS", 2455460, 2459204, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBW7", "ITRAXX", 14, "XOVER", "XVR", "XO", 1, 10, - "245924", 1, 50, 0, "LON", true, true, true, "ITXEX012", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.3Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925939", "9509425", - "ITRAXX-HIVOLS14V1 - 1213", "iTraxx Europe HiVol series 14 Version 1", - "ITRAXX-HIVOLS14V1-1213 EUR SEN MMR I03 CDS", 2455460, 2456647, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAR7", "ITRAXX", 14, "HIVOL", "VOL", "HV", 1, 3, - "245925", 1, 30, 0, "LON", true, true, true, "ITXEH312", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925941", "9509426", - "ITRAXX-HIVOLS14V1 - 1215", "iTraxx Europe HiVol series 14 Version 1", - "ITRAXX-HIVOLS14V1-1215 EUR SEN MMR I03 CDS", 2455460, 2457377, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAR7", "ITRAXX", 14, "HIVOL", "VOL", "HV", 1, 5, - "245925", 1, 30, 0, "LON", true, true, true, "ITXEH512", "VOL")); - - UpdateCDXRefDataMap ("USD ITRAXX.HIVOL.10Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925942", "9509444", - "USD ITRAXX-HIVOLS14V1 - 1220", "iTraxx Europe HiVol series 14 Version 1", - "ITRAXX-HIVOLS14V1-1220 USD SEN MMR I03 CDS", 2455460, 2459204, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I667LAR7", "USD ITRAXX", 14, "HIVOL", "VOL", "HV", 1, 10, - null, 1, 30, 0, "LON", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.7Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925943", "9509427", - "ITRAXX-HIVOLS14V1 - 1217", "iTraxx Europe HiVol series 14 Version 1", - "ITRAXX-HIVOLS14V1-1217 EUR SEN MMR I03 CDS", 2455460, 2458108, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAR7", "ITRAXX", 14, "HIVOL", "VOL", "HV", 1, 7, - "245925", 1, 30, 0, "LON", true, true, true, "ITXEH712", "VOL")); - - UpdateCDXRefDataMap ("USD ITRAXX.HIVOL.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925944", "9509443", - "USD ITRAXX-HIVOLS14V1 - 1215", "iTraxx Europe HiVol series 14 Version 1", - "ITRAXX-HIVOLS14V1-1215 USD SEN MMR I03 CDS", 2455460, 2457377, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I667LAR7", "USD ITRAXX", 14, "HIVOL", "VOL", "HV", 1, 5, - null, 1, 30, 0, "LON", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.10Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925945", "9509428", - "ITRAXX-HIVOLS14V1 - 1220", "iTraxx Europe HiVol series 14 Version 1", - "ITRAXX-HIVOLS14V1-1220 EUR SEN MMR I03 CDS", 2455460, 2459204, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAR7", "ITRAXX", 14, "HIVOL", "VOL", "HV", 1, 10, - "245925", 1, 30, 0, "LON", true, true, true, "ITXEH012", "VOL")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSUB.10Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925946", "9509442", - "USD ITRAXX-FINSUBS14V1 - 1220", "iTraxx Europe Sub Financials series 14 Version 1", - "ITRAXX-FINSUBS14V1-1220 USD LT2 SUB MMR I03 CDS", 2455460, 2459204, 0.01, "USD", - "ACT/360", false, 0.2, 4, "2I667EAO0", "USD ITRAXX", 14, "FINSUB", "SUB", "SUBF", 1, 10, - null, 1, 25, 0, "LON", false, false, true, null, "SUB")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSUB.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925947", "9509441", - "USD ITRAXX-FINSUBS14V1 - 1215", "iTraxx Europe Sub Financials series 14 Version 1", - "ITRAXX-FINSUBS14V1-1215 USD LT2 SUB MMR I03 CDS", 2455460, 2457377, 0.01, "USD", - "ACT/360", false, 0.2, 4, "2I667EAO0", "USD ITRAXX", 14, "FINSUB", "SUB", "SUBF", 1, 5, - null, 1, 25, 0, "LON", false, false, true, null, "SUB")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSEN.10Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925949", "9509440", - "USD ITRAXX-FINSENS14V1 - 1220", "iTraxx Europe Senior Financials series 14 Version 1", - "ITRAXX-FINSENS14V1-1220 USD SEN MMR I03 CDS", 2455460, 2459204, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I667DAN4", "USD ITRAXX", 14, "FINSEN", "SEN", "SENF", 1, 10, - null, 1, 25, 0, "LON", false, false, true, null, "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925951", "9509431", - "ITRAXX-FINSENS14V1 - 1215", "iTraxx Europe Senior Financials series 14 Version 1", - "ITRAXX-FINSENS14V1-1215 EUR SEN MMR I03 CDS", 2455460, 2457377, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAN4", "ITRAXX", 14, "FINSEN", "SEN", "SENF", 1, 5, - "245929", 1, 25, 0, "LON", true, true, true, "ITXES512", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.10Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925952", "9509432", - "ITRAXX-FINSENS14V1 - 1220", "iTraxx Europe Senior Financials series 14 Version 1", - "ITRAXX-FINSENS14V1-1220 EUR SEN MMR I03 CDS", 2455460, 2459204, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAN4", "ITRAXX", 14, "FINSEN", "SEN", "SENF", 1, 10, - "245929", 1, 25, 0, "LON", true, true, true, "ITXES012", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925953", "9509433", - "ITRAXX-FINSUBS14V1 - 1215", "iTraxx Europe Sub Financials series 14 Version 1", - "ITRAXX-FINSUBS14V1-1215 EUR LT2 SUB MMR I03 CDS", 2455460, 2457377, 0.01, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAO0", "ITRAXX", 14, "FINSUB", "SUB", "SUBF", 1, 5, - "245930", 1, 25, 0, "LON", true, true, true, "ITXEU512", "SUB")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.10Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925954", "9509434", - "ITRAXX-FINSUBS14V1 - 1220", "iTraxx Europe Sub Financials series 14 Version 1", - "ITRAXX-FINSUBS14V1-1220 EUR LT2 SUB MMR I03 CDS", 2455460, 2459204, 0.01, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAO0", "ITRAXX", 14, "FINSUB", "SUB", "SUBF", 1, 10, - "245930", 1, 25, 0, "LON", true, true, true, "ITXEU012", "SUB")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925955", "9509435", - "USD ITRAXX-EUROPES14V1 - 1215", "iTraxx Europe series 14 Version 1", - "ITRAXX-EUROPES14V1-1215 USD SEN MMR I03 CDS", 2455460, 2457377, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I666VAU9", "USD ITRAXX", 14, "EUROPE", "EUR", "IG", 1, 5, - null, 1, 126, 0, "LON", false, false, true, null, "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.10Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925956", "9509436", - "USD ITRAXX-EUROPES14V1 - 1220", "iTraxx Europe series 14 Version 1", - "ITRAXX-EUROPES14V1-1220 USD SEN MMR I03 CDS", 2455460, 2459204, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I666VAU9", "USD ITRAXX", 14, "EUROPE", "EUR", "IG", 1, 10, - null, 1, 126, 0, "LON", false, false, true, null, "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925957", "9509437", - "USD ITRAXX-XOVERS14V1 - 1215", "iTraxx Europe Crossover series 14 Version 1", - "ITRAXX-XOVERS14V1-1215 USD SEN MMR I03 CDS", 2455460, 2457377, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KBW7", "USD ITRAXX", 14, "XOVER", "XVR", "XO", 1, 5, - null, 1, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925958", "9509438", - "USD ITRAXX-XOVERS14V1 - 1220", "iTraxx Europe Crossover series 14 Version 1", - "ITRAXX-XOVERS14V1-1220 USD SEN MMR I03 CDS", 2455460, 2459204, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KBW7", "USD ITRAXX", 14, "XOVER", "XVR", "XO", 1, 10, - null, 1, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSEN.5Y.14.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925959", "9509439", - "USD ITRAXX-FINSENS14V1 - 1215", "iTraxx Europe Senior Financials series 14 Version 1", - "ITRAXX-FINSENS14V1-1215 USD SEN MMR I03 CDS", 2455460, 2457377, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I667DAN4", "USD ITRAXX", 14, "FINSEN", "SEN", "SENF", 1, 5, - null, 1, 25, 0, "LON", false, false, true, null, "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.CEEMEA.10Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925962", "9511471", - "ITRAXX-CEEMEAS4V1 - 1220", "iTraxx SovX CEEMEA Series 4 Version 1", - "ITRAXX-SOVX CEEMEA S4V1-1220 USD SEN RES I03 CDS", 2455460, 2459204, 0.01, "USD", - "ACT/360", false, 0.25, 4, "5C769NAD1", "ITRAXX", 4, "CEEMEA", "SOVXCEM", "SOCE", 1, 10, - "245937", 1, 15, 0, "LON", true, true, true, "ITRXEX54", "SOVXCEM")); - - UpdateCDXRefDataMap ("ITRAXX.CEEMEA.5Y.4.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925963", "9511467", - "ITRAXX-CEEMEAS4V1 - 1215", "iTraxx SovX CEEMEA Series 4 Version 1", - "ITRAXX-SOVX CEEMEA S4V1-1215 USD SEN RES I03 CDS", 2455460, 2457377, 0.01, "USD", - "ACT/360", false, 0.25, 4, "5C769NAD1", "ITRAXX", 4, "CEEMEA", "SOVXCEM", "SOCE", 1, 5, - "245937", 1, 15, 0, "LON", true, true, true, "ITRXEX54", "SOVXCEM")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925978", "9513716", - "LCDXNAS15V1 - 1215", "LCDX.NA.15", - "CDX_NA_LN_S15_100", 2455460, 2457377, 0.025, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GDQ7", "LCDX", 15, "LCDXNA", null, "IG", 1, 5, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925979", "9513706", - "LCDXNAS15V1 - 1216", "LCDX.NA.15", - "CDX_NA_LN_S15_100_06YR", 2455460, 2457743, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDQ7", "LCDX", 15, "LCDXNA", null, "IG", 1, 6, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925980", "9513851", - "LCDXNAS15V1 - 1211", "LCDX.NA.15", - "CDX_NA_LN_S15_100_01YR", 2455460, 2455916, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDQ7", "LCDX", 15, "LCDXNA", null, "IG", 1, 1, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925981", "9513860", - "LCDXNAS15V1 - 1213", "LCDX.NA.15", - "CDX_NA_LN_S15_100_03YR", 2455460, 2456647, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDQ7", "LCDX", 15, "LCDXNA", null, "IG", 1, 3, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925982", "9513719", - "LCDXNAS15V1 - 1220", "LCDX.NA.15", - "CDX_NA_LN_S15_100_10YR", 2455460, 2459204, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDQ7", "LCDX", 15, "LCDXNA", null, "IG", 1, 10, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS15V1 FXD.LCDXNAV1 FXD.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925983", "9513865", - "LCDXNAS15V1 FXD - 1215", "LCDX.NA.15", - "CDX_NA_LN_S15_100_FXD", 2455460, 2457377, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDQ7 FXD", "LCDXNAS15V1 FXD", 15, "LCDXNAV1 FXD", null, "IG", 1, 5, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925984", "9513701", - "LCDXNAS15V1 - 1214", "LCDX.NA.15", - "CDX_NA_LN_S15_100_04YR", 2455460, 2457012, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDQ7", "LCDX", 15, "LCDXNA", null, "IG", 1, 4, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925985", "9513712", - "LCDXNAS15V1 - 1212", "LCDX.NA.15", - "CDX_NA_LN_S15_100_02YR", 2455460, 2456282, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDQ7", "LCDX", 15, "LCDXNA", null, "IG", 1, 2, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925986", "9513718", - "LCDXNAS15V1 - 1217", "LCDX.NA.15", - "CDX_NA_LN_S15_100_07YR", 2455460, 2458108, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDQ7", "LCDX", 15, "LCDXNA", null, "IG", 1, 7, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("MCDXNAS15V1.MCDXNA.3Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925989", "9514915", - "MCDXNAS15V1 - 1213", "MCDX.NA.15", - "MCDX SERIES 15 3Y", 2455474, 2456647, 0.01, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAF4", "MCDXNAS15V1", 15, "MCDXNA", null, "IG", 1, 3, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("MCDXNAS15V1.MCDXNA.10Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925990", "9514919", - "MCDXNAS15V1 - 1220", "MCDX.NA.15", - "MCDX SERIES 15 10Y", 2455474, 2459204, 0.01, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAF4", "MCDXNAS15V1", 15, "MCDXNA", null, "IG", 1, 10, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("MCDXNAS15V1.MCDXNA.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("925991", "9514916", - "MCDXNAS15V1 - 1215", "MCDX.NA.15", - "MCDX SERIES 15 5Y", 2455474, 2457377, 0.01, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAF4", "MCDXNAS15V1", 15, "MCDXNA", null, "IG", 1, 5, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.7.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926021", "9526358", - "ITRAXX-JAPANHIVOLS7V4 - 0612", "iTraxx Japan HiVol Series Number 7 Version 4", - "ITRAXX JAPAN HIVOL SERIES NUMBER 07 VERSION 4 JPY SEN RES I03 CDS", 2454180, 2456099, 0.006, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MBD4", "ITRAXX", 7, "JAPANHIVOL", "VOL", "HV", 4, 5, - null, 0.88, 24, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926025", "9526224", - "ITRAXX-JAPANHIVOLS8V4 - 1212", "iTraxx Japan HiVol Series Number 8 Version 4", - "ITRAXX JAPAN HIVOL SERIES NUMBER 08 VERSION 4 JPY SEN RES I03 CDS", 2454364, 2456282, 0.007500000000000001, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MBE2", "ITRAXX", 8, "JAPANHIVOL", "VOL", "HV", 4, 5, - null, 0.88, 25, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.9.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926026", "9526375", - "ITRAXX-JAPANHIVOLS9V4 - 0613", "iTraxx Japan HiVol Series Number 9 Version 4", - "ITRAXX JAPAN HIVOL SERIES NUMBER 09 VERSION 4 JPY SEN RES I03 CDS", 2454546, 2456464, 0.035, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MBF9", "ITRAXX", 9, "JAPANHIVOL", "VOL", "HV", 4, 5, - null, 0.88, 25, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.10Y.2.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926027", "9526377", - "ITRAXX-JAPANHIVOLS2V4 - 0315", "iTraxx Japan HiVol Series Number 2 Version 4", - "ITRAXX JAPAN HIVOL SERIES NUMBER 02 VERSION 4 JPY SEN RES I03 CDS 10Y", 2453269, 2457102, 0.007, "JPY", - "ACT/360", false, 0.4, 4, "2I668MAY9", "ITRAXX", 2, "JAPANHIVOL", "VOL", "HV", 4, 10, - null, 0.7000000000000001, 10, 0, "TOK", false, false, true, null, "VOL")); - - return true; - } - - private static final boolean InitCDXRefDataSet37() - { - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.3.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926029", "9526356", - "ITRAXX-JAPANS3V4 - 0615", "iTraxx Japan Series Number 3 Version 4", - "ITRAXX JAPAN SERIES NUMBER 03 VERSION 4 JPY SEN RES I03 CDS 10Y", 2453451, 2457194, 0.0035, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBF0", "ITRAXX", 3, "JAPAN", null, "IG", 4, 10, - null, 0.9400000000000001, 49, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.6.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926030", "9525503", - "ITRAXX-JAPANHIVOLS6V4 - 1211", "iTraxx Japan HiVol Series Number 6 Version 4", - "ITRAXX JAPAN HIVOL SERIES NUMBER 06 VERSION 4 JPY SEN RES I03 CDS", 2453999, 2455916, 0.0055000000000000005, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MBC6", "ITRAXX", 6, "JAPANHIVOL", "VOL", "HV", 4, 5, - null, 0.88, 24, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("EUR ITRAXX.JAPANHIVOL.5Y.6.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926032", "9526357", - "EUR ITRAXX-JAPANHIVOLS6V4 - 1211", "iTraxx Japan HiVol Series Number 6 Version 4", - "ITRAXX JAPAN HIVOL SERIES NUMBER 06 VERSION 4 EUR SEN RES I03 CDS", 2453999, 2455916, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.35000000000000003, 4, "2I668MBC6", "EUR ITRAXX", 6, "JAPANHIVOL", "VOL", "HV", 4, 5, - null, 0.88, 24, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JHIVOL.5Y.7.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926033", "9526654", - "ITRAXX-JHIVOLS7V4 - 1212", "iTraxx Japan HiVol Series Number 7 Version 4", - "ITRAXX JAPAN HIVOL SERIES NUMBER 07 VERSION 4 JPY SEN RES I03 CDS DEC 20 2012", 2454180, 2456282, 0.006, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MBD4", "ITRAXX", 7, "JHIVOL", "VOL", "HV", 4, 5, - null, 0.88, 24, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926038", "9526250", - "ITRAXX-JAPANS7V3 - 0617", "iTraxx Japan Series Number 7 Version 3", - "ITRAXX JAPAN SERIES NUMBER 07 VERSION 3 JPY SEN RES I03 CDS 10Y", 2454180, 2457925, 0.0035, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBJ2", "ITRAXX", 7, "JAPAN", null, "IG", 3, 10, - null, 0.96, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926039", "9526252", - "ITRAXX-JAPANS8V3 - 1217", "iTraxx Japan Series Number 8 Version 3", - "ITRAXX JAPAN SERIES NUMBER 08 VERSION 3 JPY SEN RES I03 CDS 10Y", 2454364, 2458108, 0.0045000000000000005, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBK9", "ITRAXX", 8, "JAPAN", null, "IG", 3, 10, - null, 0.96, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.4.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926040", "9526020", - "ITRAXX-JAPANS4V3 - 1210", "iTraxx Japan Series Number 4 Version 3", - "ITRAXX JAPAN SERIES NUMBER 04 VERSION 3 JPY SEN RES I03 CDS", 2453634, 2455551, 0.002, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBG8", "ITRAXX", 4, "JAPAN", null, "IG", 3, 5, - null, 0.96, 49, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.3Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926041", "9526263", - "ITRAXX-JAPANS8V3 - 1210", "iTraxx Japan Series Number 8 Version 3", - "ITRAXX JAPAN SERIES NUMBER 08 VERSION 3 JPY SEN RES I03 CDS 3Y", 2454364, 2455551, 0.002, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBK9", "ITRAXX", 8, "JAPAN", null, "IG", 3, 3, - null, 0.96, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926042", "9526274", - "ITRAXX-JAPANS9V3 - 0618", "iTraxx Japan Series Number 9 Version 3", - "ITRAXX JAPAN SERIES NUMBER 09 VERSION 3 JPY SEN RES I03 CDS 10Y", 2454546, 2458290, 0.024, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBL7", "ITRAXX", 9, "JAPAN", null, "IG", 3, 10, - null, 0.96, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.3Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926043", "9526376", - "ITRAXX-JAPANS9V3 - 0611", "iTraxx Japan Series Number 9 Version 3", - "ITRAXX JAPAN SERIES NUMBER 09 VERSION 3 JPY SEN RES I03 CDS 3Y", 2454546, 2455733, 0.02, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBL7", "ITRAXX", 9, "JAPAN", null, "IG", 3, 3, - null, 0.96, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.11.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926044", "9526373", - "ITRAXX-JAPANS11V3 - 0619", "iTraxx Japan Series Number 11 Version 3", - "ITRAXX JAPAN SERIES NUMBER 11 VERSION 3 JPY SEN RES I03 CDS 10Y", 2454914, 2458655, 0.05, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBN3", "ITRAXX", 11, "JAPAN", null, "JPHG", 3, 10, - null, 0.96, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.3Y.11.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926045", "9526378", - "ITRAXX-JAPANS11V3 - 0612", "iTraxx Japan Series Number 11 Version 3", - "ITRAXX JAPAN SERIES NUMBER 11 VERSION 3 JPY SEN RES I03 CDS 3Y", 2454914, 2456099, 0.015000000000000001, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBN3", "ITRAXX", 11, "JAPAN", null, "JPHG", 3, 3, - null, 0.96, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.2.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926046", "9526019", - "ITRAXX-JAPANS2V4 - 0315", "ITRAXX JAPAN SERIES NUMBER 2 VERSION 4", - "ITRAXX JAPAN SERIES NUMBER 02 VERSION 4 JPY SEN RES I03 CDS 10Y", 2453269, 2457102, 0.0035, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBE3", "ITRAXX", 2, "JAPAN", null, "IG", 4, 10, - null, 0.9400000000000001, 49, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926047", "9526222", - "ITRAXX-JAPANS8V3 - 1212", "iTraxx Japan Series Number 8 Version 3", - "ITRAXX JAPAN SERIES NUMBER 08 VERSION 3 JPY SEN RES I03 CDS", 2454364, 2456282, 0.003, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBK9", "ITRAXX", 8, "JAPAN", null, "IG", 3, 5, - null, 0.96, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANFIN.5Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926048", "9526656", - "ITRAXX-JAPANFINS5V3 - 0611", "iTraxx Japan Financials Series Number 5 Version 3", - "ITRAXX JAPAN FINANCIALS SERIES NUMBER 05 VERSION 3 JPY SEN RES I03 CDS", 2453815, 2455733, 0.003, "JPY", - "ACT/360", false, 0.4, 4, "2I668LAL9", "ITRAXX", 5, "JAPANFIN", null, "IG", 3, 5, - null, 0.8, 10, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.9.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926050", "9526653", - "ITRAXX-JAPANS9V3 - 0613", "iTraxx Japan Series Number 9 Version 3", - "ITRAXX JAPAN SERIES NUMBER 09 VERSION 3 JPY SEN RES I03 CDS", 2454546, 2456464, 0.022000000000000002, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBL7", "ITRAXX", 9, "JAPAN", null, "IG", 3, 5, - null, 0.96, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.10.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926051", "9526017", - "ITRAXX-JAPANS10V3 - 1213", "ITRAXX JAPAN SERIES NUMBER 10 VERSION 3", - "ITRAXX JAPAN SERIES NUMBER 10 VERSION 3 JPY SEN RES I03 CDS", 2454739, 2456647, 0.015000000000000001, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBM5", "ITRAXX", 10, "JAPAN", null, "JPHG", 3, 5, - null, 0.96, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.11.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926052", "9526018", - "ITRAXX-JAPANS11V3 - 0614", "iTraxx Japan Series Number 11 Version 3", - "ITRAXX JAPAN SERIES NUMBER 11 VERSION 3 JPY SEN RES I03 CDS", 2454914, 2456829, 0.05, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBN3", "ITRAXX", 11, "JAPAN", null, "JPHG", 3, 5, - null, 0.96, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926053", "9526655", - "ITRAXX-JAPANHIVOLS5V3 - 0611", "iTraxx Japan HiVol Series Number 5 Version 3", - "ITRAXX JAPAN HIVOL SERIES NUMBER 05 VERSION 3 JPY SEN RES I03 CDS", 2453815, 2455733, 0.0045000000000000005, "JPY", - "ACT/360", false, 0.4, 4, "2I668MBB8", "ITRAXX", 5, "JAPANHIVOL", "VOL", "HV", 3, 5, - null, 1, 10, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANFIN.10Y.2.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926054", "9526246", - "ITRAXX-JAPANFINS2V3 - 0315", "iTraxx Japan Financials Series Number 2 Version 3", - "ITRAXX JAPAN FINANCIALS SERIES NUMBER 02 VERSION 3 JPY SEN RES I03 CDS 10Y", 2453269, 2457102, 0.005, "JPY", - "ACT/360", false, 0.4, 4, "2I668LAI6", "ITRAXX", 2, "JAPANFIN", null, "IG", 3, 10, - null, 0.8, 9, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926055", "9521460", - "ITRAXX-JAPANS5V3 - 0611", "iTraxx Japan Series Number 5 Version 3", - "ITRAXX JAPAN SERIES NUMBER 05 VERSION 3 JPY SEN RES I03 CDS", 2453815, 2455733, 0.0025, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBH6", "ITRAXX", 5, "JAPAN", null, "IG", 3, 5, - null, 0.96, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.4.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926056", "9526374", - "ITRAXX-JAPANS4V3 - 1215", "iTraxx Japan Series Number 4 Version 3", - "ITRAXX JAPAN SERIES NUMBER 04 VERSION 3 JPY SEN RES I03 CDS 10Y", 2453634, 2457377, 0.003, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBG8", "ITRAXX", 4, "JAPAN", null, "IG", 3, 10, - null, 0.96, 49, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926057", "9526249", - "ITRAXX-JAPANS6V3 - 1216", "iTraxx Japan Series Number 6 Version 3", - "ITRAXX JAPAN SERIES NUMBER 06 VERSION 3 JPY SEN RES I03 CDS 10Y", 2453999, 2457743, 0.004, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBI4", "ITRAXX", 6, "JAPAN", null, "IG", 3, 10, - null, 0.96, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.10Y.5.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926058", "9521513", - "ITRAXX-JAPANS5V3 - 0616", "iTraxx Japan Series Number 5 Version 3", - "ITRAXX JAPAN SERIES NUMBER 05 VERSION 3 JPY SEN RES I03 CDS 10Y", 2453815, 2457560, 0.004, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBH6", "ITRAXX", 5, "JAPAN", null, "IG", 3, 10, - null, 0.96, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926059", "9526652", - "ITRAXX-JAPANS6V3 - 1211", "iTraxx Japan Series Number 6 Version 3", - "ITRAXX JAPAN SERIES NUMBER 06 VERSION 3 JPY SEN RES I03 CDS", 2453999, 2455916, 0.0025, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBI4", "ITRAXX", 6, "JAPAN", null, "IG", 3, 5, - null, 0.96, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN80.5Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926060", "9521454", - "ITRAXX-JAPAN80S7V3 - 0612", "iTraxx Japan 80 Series Number 7 Version 3", - "ITRAXX JAPAN 80 SERIES NUMBER 07 VERSION 3 JPY SEN RES I03 CDS", 2454180, 2456099, 0.0025, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "4ABCAHAE7", "ITRAXX", 7, "JAPAN80", null, "IG", 3, 5, - null, 0.975, 79, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.7.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926061", "9521467", - "ITRAXX-JAPANS7V3 - 0612", "iTraxx Japan Series Number 7 Version 3", - "ITRAXX JAPAN SERIES NUMBER 07 VERSION 3 JPY SEN RES I03 CDS", 2454180, 2456099, 0.0025, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBJ2", "ITRAXX", 7, "JAPAN", null, "IG", 3, 5, - null, 0.96, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN80.5Y.8.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926062", "9526013", - "ITRAXX-JAPAN80S8V3 - 1212", "iTraxx Japan 80 Series Number 8 Version 3", - "ITRAXX JAPAN 80 SERIES NUMBER 08 VERSION 3 JPY SEN RES I03 CDS", 2454364, 2456282, 0.003, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "4ABCAHAF4", "ITRAXX", 8, "JAPAN80", null, "IG", 3, 5, - null, 0.975, 80, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.7.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926072", "9529061", - "CDX-NAIGS7V5-MR - 1216", "Dow Jones CDX.NA.IG.7", - "DJCDX_NA_IG_S7_10Y_12/16_121/126_MR", 2454000, 2457743, 0.006500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCE3-MR", "CDX", 7, "NA IG", null, "IG", 5, 10, - null, 0.9640000000000001, 126, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("LevXSubS1V22.LevXSub.5Y.1.22", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926218", "9539580", - "LevXSubS1V22 - 1211", "iTraxx LevX Subordinated Series 1 Version 22", - "ITRAXX LEVX SUBORDINATED SERIES 1 VERSION 22 EUR 2ND SEC MMR I03 CDS", 2454180, 2455916, 0.045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKCE8", "LevXSubS1V22", 1, "LevXSub", null, "IG", 22, 5, - null, 0.4, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LevXSenS1V17.LevXSen.5Y.1.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926261", "9543780", - "LevXSenS1V17 - 1211", "iTraxx LevX Senior Series 1 Version 17", - "ITRAXX LEVX SENIOR SERIES 1 VERSION 17 EUR 1ST SEC MMR I03 CDS", 2453999, 2455916, 0.017, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJEJ8", "LevXSenS1V17", 1, "LevXSen", null, "IG", 17, 5, - null, 0.54283, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LevXSubS1V23.LevXSub.5Y.1.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926262", "9543776", - "LevXSubS1V23 - 1211", "iTraxx LevX Subordinated Series 1 Version 23", - "ITRAXX LEVX SUBORDINATED SERIES 1 VERSION 23 EUR 2ND SEC MMR I03 CDS", 2454180, 2455916, 0.045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKCF5", "LevXSubS1V23", 1, "LevXSub", null, "IG", 23, 5, - null, 0.3715, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.25", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926334", "9572293", - "LCDXNAS10V25 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_76/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GDT1", "LCDX", 10, "LCDXNA", null, "IG", 25, 5, - null, 0.76, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.10.25", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926335", "9572447", - "LCDXNAS10V25 - 0611", "LCDX.NA.10", - "CDX_NA_LN_S10_100_03YR_76/100", 2454561, 2455733, 0.0275, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GDT1", "LCDX", 10, "LCDXNA", null, "IG", 25, 3, - null, 0.76, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.12.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926336", "9572204", - "LCDXNAS12V14 - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_86/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GDU8", "LCDX", 12, "LCDXNA", null, "IG", 14, 5, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.12.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926337", "9572453", - "LCDXNAS12V14 - 0612", "LCDX.NA.12", - "CDX_NA_LN_S12_100_03YR_86/100", 2454938, 2456099, 0.05, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GDU8", "LCDX", 12, "LCDXNA", null, "IG", 14, 3, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.13.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926338", "9572214", - "LCDXNAS13V4 - 1214", "LCDX.NA.13", - "CDX_NA_LN_S13_100_97/100", 2455110, 2457012, 0.05, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GDV6", "LCDX", 13, "LCDXNA", null, "IG", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.29", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926339", "9572225", - "LCDXNAS8V29 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_72/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GDR5", "LCDX", 8, "LCDXNA", null, "IG", 29, 5, - null, 0.72, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.25", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926340", "9572226", - "LCDXNAS9V25 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_76/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GDS3", "LCDX", 9, "LCDXNA", null, "IG", 25, 5, - null, 0.76, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.13.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926341", "9572538", - "LCDXNAS13V4 - 1216", "LCDX.NA.13", - "CDX_NA_LN_S13_100_07YR_97/100", 2455110, 2457743, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDV6", "LCDX", 13, "LCDXNA", null, "IG", 4, 7, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.13.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926342", "9572539", - "LCDXNAS13V4 - 1219", "LCDX.NA.13", - "CDX_NA_LN_S13_100_10YR_97/100", 2455110, 2458838, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDV6", "LCDX", 13, "LCDXNA", null, "IG", 4, 10, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.10.25", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926343", "9572527", - "LCDXNAS10V25 - 0618", "LCDX.NA.10", - "CDX_NA_LN_S10_100_10YR_76/100", 2454561, 2458290, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GDT1", "LCDX", 10, "LCDXNA", null, "IG", 25, 10, - null, 0.76, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.12.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926344", "9572533", - "LCDXNAS12V14 - 0613", "LCDX.NA.12", - "CDX_NA_LN_S12_100_04YR_86/100", 2454938, 2456464, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDU8", "LCDX", 12, "LCDXNA", null, "IG", 14, 4, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS9V25 FXD.LCDXNAV25 FXD.5Y.9.25", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926345", "9573441", - "LCDXNAS9V25 FXD - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_FXD_76/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDS3 FXD", "LCDXNAS9V25 FXD", 9, "LCDXNAV25 FXD", null, "IG", 25, 5, - null, 0.76, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS10V25 FXD.LCDXNAV25 FXD.5Y.10.25", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926346", "9573392", - "LCDXNAS10V25 FXD - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_FXD_76/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GDT1 FXD", "LCDXNAS10V25 FXD", 10, "LCDXNAV25 FXD", null, "IG", 25, 5, - null, 0.76, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.8.29", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926347", "9572554", - "LCDXNAS8V29 - 0614", "LCDX.NA.8", - "CDX_NA_LN_S08_100_07YR_72/100", 2454244, 2456829, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GDR5", "LCDX", 8, "LCDXNA", null, "IG", 29, 7, - null, 0.72, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.13.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926348", "9572541", - "LCDXNAS13V4 - 1215", "LCDX.NA.13", - "CDX_NA_LN_S13_100_06YR_97/100", 2455110, 2457377, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDV6", "LCDX", 13, "LCDXNA", null, "IG", 4, 6, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.12.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926349", "9572530", - "LCDXNAS12V14 - 0611", "LCDX.NA.12", - "CDX_NA_LN_S12_100_02YR_86/100", 2454938, 2455733, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDU8", "LCDX", 12, "LCDXNA", null, "IG", 14, 2, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.12.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926350", "9572534", - "LCDXNAS12V14 - 0615", "LCDX.NA.12", - "CDX_NA_LN_S12_100_06YR_86/100", 2454938, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDU8", "LCDX", 12, "LCDXNA", null, "IG", 14, 6, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS8V29 FXD.LCDXNAV29 FXD.5Y.8.29", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926351", "9573435", - "LCDXNAS8V29 FXD - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_FXD_72/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GDR5 FXD", "LCDXNAS8V29 FXD", 8, "LCDXNAV29 FXD", null, "IG", 29, 5, - null, 0.72, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.8.29", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926352", "9572553", - "LCDXNAS8V29 - 0613", "LCDX.NA.8", - "CDX_NA_LN_S08_100_06YR_72/100", 2454244, 2456464, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GDR5", "LCDX", 8, "LCDXNA", null, "IG", 29, 6, - null, 0.72, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.9.25", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926353", "9572559", - "LCDXNAS9V25 - 1211", "LCDX.NA.9", - "CDX_NA_LN_S09_100_04YR_76/100", 2454378, 2455916, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDS3", "LCDX", 9, "LCDXNA", null, "IG", 25, 4, - null, 0.76, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.9.25", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926354", "9572558", - "LCDXNAS9V25 - 1217", "LCDX.NA.9", - "CDX_NA_LN_S09_100_10YR_76/100", 2454378, 2458108, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDS3", "LCDX", 9, "LCDXNA", null, "IG", 25, 10, - null, 0.76, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.12.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926355", "9572532", - "LCDXNAS12V14 - 0619", "LCDX.NA.12", - "CDX_NA_LN_S12_100_10YR_86/100", 2454938, 2458655, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDU8", "LCDX", 12, "LCDXNA", null, "IG", 14, 10, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS13V4 FXD.LCDXNAV4 FXD.5Y.13.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926356", "9573404", - "LCDXNAS13V4 FXD - 1214", "LCDX.NA.13", - "CDX_NA_LN_S13_100_FXD_97/100", 2455110, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDV6 FXD", "LCDXNAS13V4 FXD", 13, "LCDXNAV4 FXD", null, "IG", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.13.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926357", "9572537", - "LCDXNAS13V4 - 1211", "LCDX.NA.13", - "CDX_NA_LN_S13_100_02YR_97/100", 2455110, 2455916, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDV6", "LCDX", 13, "LCDXNA", null, "IG", 4, 2, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.9.25", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926358", "9572560", - "LCDXNAS9V25 - 1213", "LCDX.NA.9", - "CDX_NA_LN_S09_100_06YR_76/100", 2454378, 2456647, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDS3", "LCDX", 9, "LCDXNA", null, "IG", 25, 6, - null, 0.76, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.12.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926360", "9572531", - "LCDXNAS12V14 - 0616", "LCDX.NA.12", - "CDX_NA_LN_S12_100_07YR_86/100", 2454938, 2457560, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDU8", "LCDX", 12, "LCDXNA", null, "IG", 14, 7, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.9.25", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926361", "9572557", - "LCDXNAS9V25 - 1214", "LCDX.NA.9", - "CDX_NA_LN_S09_100_07YR_76/100", 2454378, 2457012, 0.022500000000000003, "USD", - "ACT/360", false, 0.4, 4, "5F199GDS3", "LCDX", 9, "LCDXNA", null, "IG", 25, 7, - null, 0.76, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.10.25", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926362", "9572528", - "LCDXNAS10V25 - 0612", "LCDX.NA.10", - "CDX_NA_LN_S10_100_04YR_76/100", 2454561, 2456099, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GDT1", "LCDX", 10, "LCDXNA", null, "IG", 25, 4, - null, 0.76, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS12V14 FXD.LCDXNAV14 FXD.5Y.12.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926363", "9573413", - "LCDXNAS12V14 FXD - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_FXD_86/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDU8 FXD", "LCDXNAS12V14 FXD", 12, "LCDXNAV14 FXD", null, "IG", 14, 5, - null, 0.86, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.10.25", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926364", "9572526", - "LCDXNAS10V25 - 0615", "LCDX.NA.10", - "CDX_NA_LN_S10_100_07YR_76/100", 2454561, 2457194, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GDT1", "LCDX", 10, "LCDXNA", null, "IG", 25, 7, - null, 0.76, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.10.25", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926365", "9572525", - "LCDXNAS10V25 - 0614", "LCDX.NA.10", - "CDX_NA_LN_S10_100_06YR_76/100", 2454561, 2456829, 0.0325, "USD", - "ACT/360", false, 0.4, 4, "5F199GDT1", "LCDX", 10, "LCDXNA", null, "IG", 25, 6, - null, 0.76, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.8.29", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926366", "9572552", - "LCDXNAS8V29 - 0617", "LCDX.NA.8", - "CDX_NA_LN_S08_100_10YR_72/100", 2454244, 2457925, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GDR5", "LCDX", 8, "LCDXNA", null, "IG", 29, 10, - null, 0.72, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.13.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926367", "9572540", - "LCDXNAS13V4 - 1213", "LCDX.NA.13", - "CDX_NA_LN_S13_100_04YR_97/100", 2455110, 2456647, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDV6", "LCDX", 13, "LCDXNA", null, "IG", 4, 4, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.13.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926368", "9572536", - "LCDXNAS13V4 - 1212", "LCDX.NA.13", - "CDX_NA_LN_S13_100_03YR_97/100", 2455110, 2456282, 0.05, "USD", - "ACT/360", false, 0.4, 4, "5F199GDV6", "LCDX", 13, "LCDXNA", null, "IG", 4, 3, - null, 0.97, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.8.29", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926369", "9572555", - "LCDXNAS8V29 - 0611", "LCDX.NA.8", - "CDX_NA_LN_S08_100_04YR_72/100", 2454244, 2455733, 0.012, "USD", - "ACT/360", false, 0.4, 4, "5F199GDR5", "LCDX", 8, "LCDXNA", null, "IG", 29, 4, - null, 0.72, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.3Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926409", "9572606", - "ITRAXX-EUROPES15V1 - 0614", "iTraxx Europe series 15 Version 1", - "ITRAXX-EUROPES15V1-0614 EUR SEN MMR I03 CDS", 2455642, 2456829, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAV7", "ITRAXX", 15, "EUROPE", "EUR", "IG", 1, 3, - "246277", 1, 126, 0, "LON", true, true, true, "ITXEB312", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926410", "9572607", - "ITRAXX-EUROPES15V1 - 0616", "iTraxx Europe series 15 Version 1", - "ITRAXX-EUROPES15V1-0616 EUR SEN MMR I03 CDS", 2455642, 2457560, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAV7", "ITRAXX", 15, "EUROPE", "EUR", "IG", 1, 5, - "246277", 1, 126, 0, "LON", true, true, true, "ITXEB512", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.7Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926411", "9572608", - "ITRAXX-EUROPES15V1 - 0618", "iTraxx Europe series 15 Version 1", - "ITRAXX-EUROPES15V1-0618 EUR SEN MMR I03 CDS", 2455642, 2458290, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAV7", "ITRAXX", 15, "EUROPE", "EUR", "IG", 1, 7, - "246277", 1, 126, 0, "LON", true, true, true, "ITXEB712", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926412", "9572609", - "ITRAXX-EUROPES15V1 - 0621", "iTraxx Europe series 15 Version 1", - "ITRAXX-EUROPES15V1-0621 EUR SEN MMR I03 CDS", 2455642, 2459386, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAV7", "ITRAXX", 15, "EUROPE", "EUR", "IG", 1, 10, - "246277", 1, 126, 0, "LON", true, true, true, "ITXEB012", "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926413", "9572611", - "ITRAXX-XOVERS15V1 - 0614", "iTraxx Europe Crossover series 15 Version 1", - "ITRAXX-XOVERS15V1-0614 EUR SEN MMR I03 CDS", 2455642, 2456829, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBX5", "ITRAXX", 15, "XOVER", "XVR", "XO", 1, 3, - "246278", 1, 40, 0, "LON", true, true, true, "ITXEX312", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926414", "9572612", - "ITRAXX-XOVERS15V1 - 0616", "iTraxx Europe Crossover series 15 Version 1", - "ITRAXX-XOVERS15V1-0616 EUR SEN MMR I03 CDS", 2455642, 2457560, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBX5", "ITRAXX", 15, "XOVER", "XVR", "XO", 1, 5, - "246278", 1, 40, 0, "LON", true, true, true, "ITXEX512", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926415", "9572613", - "ITRAXX-XOVERS15V1 - 0618", "iTraxx Europe Crossover series 15 Version 1", - "ITRAXX-XOVERS15V1-0618 EUR SEN MMR I03 CDS", 2455642, 2458290, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBX5", "ITRAXX", 15, "XOVER", "XVR", "XO", 1, 7, - "246278", 1, 40, 0, "LON", true, true, true, "ITXEX712", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926416", "9572614", - "ITRAXX-XOVERS15V1 - 0621", "iTraxx Europe Crossover series 15 Version 1", - "ITRAXX-XOVERS15V1-0621 EUR SEN MMR I03 CDS", 2455642, 2459386, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBX5", "ITRAXX", 15, "XOVER", "XVR", "XO", 1, 10, - "246278", 1, 40, 0, "LON", true, true, true, "ITXEX012", "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.3Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926417", "9572616", - "ITRAXX-HIVOLS15V1 - 0614", "iTraxx Europe HiVol series 15 Version 1", - "ITRAXX-HIVOLS15V1-0614 EUR SEN MMR I03 CDS", 2455642, 2456829, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAS5", "ITRAXX", 15, "HIVOL", "VOL", "HV", 1, 3, - "246280", 1, 30, 0, "LON", true, true, true, "ITXEH312", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926422", "9572617", - "ITRAXX-HIVOLS15V1 - 0616", "iTraxx Europe HiVol series 15 Version 1", - "ITRAXX-HIVOLS15V1-0616 EUR SEN MMR I03 CDS", 2455642, 2457560, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAS5", "ITRAXX", 15, "HIVOL", "VOL", "HV", 1, 5, - "246280", 1, 30, 0, "LON", true, true, true, "ITXEH512", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.7Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926423", "9572618", - "ITRAXX-HIVOLS15V1 - 0618", "iTraxx Europe HiVol series 15 Version 1", - "ITRAXX-HIVOLS15V1-0618 EUR SEN MMR I03 CDS", 2455642, 2458290, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAS5", "ITRAXX", 15, "HIVOL", "VOL", "HV", 1, 7, - "246280", 1, 30, 0, "LON", true, true, true, "ITXEH712", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.10Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926424", "9572619", - "ITRAXX-HIVOLS15V1 - 0621", "iTraxx Europe HiVol series 15 Version 1", - "ITRAXX-HIVOLS15V1-0621 EUR SEN MMR I03 CDS", 2455642, 2459386, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAS5", "ITRAXX", 15, "HIVOL", "VOL", "HV", 1, 10, - "246280", 1, 30, 0, "LON", true, true, true, "ITXEH012", "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926425", "9572624", - "ITRAXX-FINSENS15V1 - 0616", "iTraxx Europe Senior Financials series 15 Version 1", - "ITRAXX-FINSENS15V1-0616 EUR SEN MMR I03 CDS", 2455642, 2457560, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAO2", "ITRAXX", 15, "FINSEN", "SEN", "SENF", 1, 5, - "246281", 1, 25, 0, "LON", true, true, true, "ITXES512", "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.10Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926426", "9572625", - "ITRAXX-FINSENS15V1 - 0621", "iTraxx Europe Senior Financials series 15 Version 1", - "ITRAXX-FINSENS15V1-0621 EUR SEN MMR I03 CDS", 2455642, 2459386, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAO2", "ITRAXX", 15, "FINSEN", "SEN", "SENF", 1, 10, - "246281", 1, 25, 0, "LON", true, true, true, "ITXES012", "SEN")); - - UpdateCDXRefDataMap ("Itraxx.SovX West Eur.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926427", "9572643", - "Itraxx-SovX West Eur S5V1 - 0616", "Itraxx SovX Western Europe Series 5 Version 1", - "ITRAXX-SOVX WEST EUR S5V1-0616 USD SEN RES I03 CDS", 2455642, 2457560, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAE1", "Itraxx", 5, "SovX West Eur", "SOV", "SOWE", 1, 5, - "246282", 1, 15, 0, "LON", true, true, true, null, "SOV")); - - UpdateCDXRefDataMap ("ITRAXX.CEEMEA.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926428", "9572646", - "ITRAXX-CEEMEAS5V1 - 0616", "iTraxx SovX CEEMEA Series 5 Version 1", - "ITRAXX-SOVX CEEMEA S5V1-0616 USD SEN RES I03 CDS", 2455642, 2457560, 0.01, "USD", - "ACT/360", false, 0.25, 4, "5C769NAE9", "ITRAXX", 5, "CEEMEA", "SOVXCEM", "SOCE", 1, 5, - "246283", 1, 15, 0, "LON", true, true, true, "ITRXEX54", "SOVXCEM")); - - UpdateCDXRefDataMap ("CDX.EM.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926429", "9572564", - "CDX-EMS15V1 - 0616", "CDX.EM.15", - "CDX EM 15 5YR", 2455642, 2457560, 0.05, "USD", - "ACT/360", false, 0.25, 4, "2I65BZAO0", "CDX", 15, "EM", null, "EM", 1, 5, - null, 1, 15, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926430", "9572586", - "CDX-NAIGS16V1 - 0616", "CDX.NA.IG.16", - "CDX_NA_IG_S16_05Y_06/16", 2455642, 2457560, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCM5", "CDX", 16, "NA IG", null, "IG", 1, 5, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926431", "9572588", - "CDX-NAIGS16V1 - 0618", "CDX.NA.IG.16", - "CDX_NA_IG_S16_07Y_06/18", 2455642, 2458290, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCM5", "CDX", 16, "NA IG", null, "IG", 1, 7, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926432", "9572566", - "CDX-NAHYS16V1 - 0616", "CDX.NA.HY.16", - "CDX_NA_HY_S16_100_SWP", 2455642, 2457560, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHL7", "CDX", 16, "NA HY", null, "HY", 1, 5, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926433", "9572569", - "CDX-NAHYS16V1 - 0614", "CDX.NA.HY.16", - "CDX_NA_HY_S16_100_SWP_03YR", 2455642, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHL7", "CDX", 16, "NA HY", null, "HY", 1, 3, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926434", "9572589", - "CDX-NAIGS16V1 - 0621", "CDX.NA.IG.16", - "CDX_NA_IG_S16_10Y_06/21", 2455642, 2459386, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCM5", "CDX", 16, "NA IG", null, "IG", 1, 10, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926435", "9572573", - "CDX-NAHYS16V1 - 0618", "CDX.NA.HY.16", - "CDX_NA_HY_S16_100_SWP_07YR", 2455642, 2458290, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHL7", "CDX", 16, "NA HY", null, "HY", 1, 7, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.3Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926436", "9572596", - "CDX-NAIGHVOLS16V1 - 0614", "CDX.NA.IG.HVOL.16", - "CDX_NA_IG_S16_HVOL_03Y_06/14", 2455642, 2456829, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AR4", "CDX", 16, "NA IG HVOL", null, "HV", 1, 3, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926437", "9572598", - "CDX-NAIGHVOLS16V1 - 0616", "CDX.NA.IG.HVOL.16", - "CDX_NA_IG_S16_HVOL_05Y_06/16", 2455642, 2457560, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AR4", "CDX", 16, "NA IG HVOL", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926438", "9572574", - "CDX-NAHYS16V1 - 0621", "CDX.NA.HY.16", - "CDX_NA_HY_S16_100_SWP_10YR", 2455642, 2459386, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHL7", "CDX", 16, "NA HY", null, "HY", 1, 10, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.7Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926439", "9572599", - "CDX-NAIGHVOLS16V1 - 0618", "CDX.NA.IG.HVOL.16", - "CDX_NA_IG_S16_HVOL_07Y_06/18", 2455642, 2458290, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AR4", "CDX", 16, "NA IG HVOL", null, "HV", 1, 7, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.1Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926440", "9572582", - "CDX-NAIGS16V1 - 0612", "CDX.NA.IG.16", - "CDX_NA_IG_S16_01Y_06/12", 2455642, 2456099, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCM5", "CDX", 16, "NA IG", null, "IG", 1, 1, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.10Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926441", "9572600", - "CDX-NAIGHVOLS16V1 - 0621", "CDX.NA.IG.HVOL.16", - "CDX_NA_IG_S16_HVOL_10Y_06/21", 2455642, 2459386, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AR4", "CDX", 16, "NA IG HVOL", null, "HV", 1, 10, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.2Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926442", "9572583", - "CDX-NAIGS16V1 - 0613", "CDX.NA.IG.16", - "CDX_NA_IG_S16_02Y_06/13", 2455642, 2456464, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCM5", "CDX", 16, "NA IG", null, "IG", 1, 2, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926443", "9572584", - "CDX-NAIGS16V1 - 0614", "CDX.NA.IG.16", - "CDX_NA_IG_S16_03Y_06/14", 2455642, 2456829, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCM5", "CDX", 16, "NA IG", null, "IG", 1, 3, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ IG.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926445", "9574244", - "ITRAXX-ASIAXJIGS15V1 - 0616", "iTraxx Asia ex-Japan IG Series Number 15 Version 1", - "ITRAXX ASIA EX-JAPAN IG SERIES NUMBER 15 VERSION 1 USD SEN RES I03 CDS", 2455642, 2457560, 0.01, "USD", - "ACT/360", false, 0.4, 4, "4ABCAMAH9", "ITRAXX", 15, "ASIAXJ IG", null, "ASHG", 1, 5, - null, 1, 50, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.AUSTRALIA.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926448", "9574240", - "ITRAXX-AUSTRALIAS15V1 - 0616", "iTraxx Australia Series Number 15 Version 1", - "ITRAXX AUSTRALIA SERIES NUMBER 15 VERSION 1 USD SEN MR I03 CDS", 2455642, 2457560, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I668IAO0", "ITRAXX", 15, "AUSTRALIA", null, "AUHG", 1, 5, - null, 1, 25, 0, "HKG", false, false, true, null, "Itraxx Australia")); - - return true; - } - - private static final boolean InitCDXRefDataSet38() - { - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926449", "9574243", - "ITRAXX-JAPANS15V1 - 0616", "iTraxx Japan Series Number 15 Version 1", - "ITRAXX JAPAN SERIES NUMBER 15 VERSION 1 JPY SEN RES I03 CDS", 2455649, 2457560, 0.01, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBO1", "ITRAXX", 15, "JAPAN", null, "JPHG", 1, 5, - null, 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.SOVXASIAPACIFIC.5Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926450", "9574241", - "ITRAXX-SOVX-ASIA-PACIFICS5 - 0616", "iTraxx SovX Asia Pacific Series 5 Version 1", - "ITRAXX SOVX ASIA-PACIFIC SERIES NUMBER 5 VERSION 1 USD SEN RES I03 CDS", 2455642, 2457560, 0.01, "USD", - "ACT/360", false, 0.4, 4, "4ABCANAC8", "ITRAXX", 5, "SOVXASIAPACIFIC", null, "ASHG", 1, 5, - null, 1, 10, 0, "HKG", false, false, true, null, "Itraxx SovX")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ HY.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926451", "9574242", - "ITRAXX-ASIAXJHYS15V1 - 0616", "iTraxx Asia ex-Japan HY Series Number 15 Version 1", - "ITRAXX ASIA EX-JAPAN HY SERIES NUMBER 15 VERSION 1 USD SEN RES I03 CDS", 2455642, 2457560, 0.05, "USD", - "ACT/360", false, 0.25, 4, "4ABCAGAH2", "ITRAXX", 15, "ASIAXJ HY", null, "ASHY", 1, 5, - null, 1, 20, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("CDX.NA IG ENRG.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926458", "9572592", - "CDX-NAIGENRGS16V1 - 0616", "CDX.NA.IG.ENRG.16", - "CDX_NA_IG_S16_ENRG_06/16", 2455642, 2457560, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B1AR8", "CDX", 16, "NA IG ENRG", null, "IG", 1, 5, - null, 1, 16, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("USD ITRAXX.HIVOL.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926460", "9572637", - "USD ITRAXX-HIVOLS15V1 - 0616", "iTraxx Europe HiVol series 15 Version 1", - "ITRAXX-HIVOLS15V1-0616 USD SEN MMR I03 CDS", 2455642, 2457560, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I667LAS5", "USD ITRAXX", 15, "HIVOL", "VOL", "HV", 1, 5, - null, 1, 30, 0, "LON", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("CDX.NA IG FIN.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926461", "9572593", - "CDX-NAIGFINS16V1 - 0616", "CDX.NA.IG.FIN.16", - "CDX_NA_IG_S16_FIN_06/16", 2455641, 2457560, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B2CI4", "CDX", 16, "NA IG FIN", null, "IG", 1, 5, - null, 1, 20, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.1Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926462", "9572594", - "CDX-NAIGHVOLS16V1 - 0612", "CDX.NA.IG.HVOL.16", - "CDX_NA_IG_S16_HVOL_01Y_06/12", 2455642, 2456099, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AR4", "CDX", 16, "NA IG HVOL", null, "HV", 1, 1, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("USD ITRAXX.HIVOL.10Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926463", "9572638", - "USD ITRAXX-HIVOLS15V1 - 0621", "iTraxx Europe HiVol series 15 Version 1", - "ITRAXX-HIVOLS15V1-0621 USD SEN MMR I03 CDS", 2455642, 2459386, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I667LAS5", "USD ITRAXX", 15, "HIVOL", "VOL", "HV", 1, 10, - null, 1, 30, 0, "LON", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.2Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926464", "9572595", - "CDX-NAIGHVOLS16V1 - 0613", "CDX.NA.IG.HVOL.16", - "CDX_NA_IG_S16_HVOL_02Y_06/13", 2455642, 2456464, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AR4", "CDX", 16, "NA IG HVOL", null, "HV", 1, 2, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.4Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926466", "9572597", - "CDX-NAIGHVOLS16V1 - 0615", "CDX.NA.IG.HVOL.16", - "CDX_NA_IG_S16_HVOL_04Y_06/15", 2455642, 2457194, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AR4", "CDX", 16, "NA IG HVOL", null, "HV", 1, 4, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG INDU.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926467", "9572602", - "CDX-NAIGINDUS16V1 - 0616", "CDX.NA.IG.INDU.16", - "CDX_NA_IG_S16_INDU_06/16", 2455642, 2457560, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B4AW1", "CDX", 16, "NA IG INDU", null, "IG", 1, 5, - null, 1, 24, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG TMT.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926468", "9572603", - "CDX-NAIGTMTS16V1 - 0616", "CDX.NA.IG.TMT.16", - "CDX_NA_IG_S16_TMT_06/16", 2455642, 2457560, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65DJAZ9", "CDX", 16, "NA IG TMT", null, "IG", 1, 5, - null, 1, 26, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOLV1 EUR.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926469", "9572604", - "CDX-NAIGHVOLS16V1 EUR - 0616", "CDX.NA.IG.HVOL.16", - "CDX_NA_IG_S16_HVOL_05Y_06/16 EUR", 2455642, 2457560, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I65B3AR4", "CDX", 16, "NA IG HVOLV1 EUR", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("Itraxx.SovX West Eur.10Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926471", "9572644", - "Itraxx-SovX West Eur S5V1 - 0621", "Itraxx SovX Western Europe Series 5 Version 1", - "ITRAXX-SOVX WEST EUR S5V1-0621 USD SEN RES I03 CDS", 2455642, 2459386, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAE1", "Itraxx", 5, "SovX West Eur", "SOV", "SOWE", 1, 10, - "246282", 1, 15, 0, "LON", true, true, true, null, "SOV")); - - UpdateCDXRefDataMap ("ITRAXX.CEEMEA.10Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926472", "9572647", - "ITRAXX-CEEMEAS5V1 - 0621", "iTraxx SovX CEEMEA Series 5 Version 1", - "ITRAXX-SOVX CEEMEA S5V1-0621 USD SEN RES I03 CDS", 2455642, 2459386, 0.01, "USD", - "ACT/360", false, 0.25, 4, "5C769NAE9", "ITRAXX", 5, "CEEMEA", "SOVXCEM", "SOCE", 1, 10, - "246283", 1, 15, 0, "LON", true, true, true, "ITRXEX54", "SOVXCEM")); - - UpdateCDXRefDataMap ("CDX.NA HY V4 FXD 97/100.5Y.16.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926473", "9572565", - "CDX-NAHYS16V4 FXD 97/100 - 0616", "CDX.NA.HY.16", - "CDX_NA_HY_S16_100_FXD_97/100", 2455642, 2457560, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIV4 FXD", "CDX", 16, "NA HY V4 FXD 97/100", null, "HY", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926474", "9572577", - "CDX-NAHYBS16V1 - 0616", "CDX.NA.HY.B.16", - "CDX_NA_HY_S16_B___SWP", 2455642, 2457560, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSEM6", "CDX", 16, "NA HY B", null, "HY", 1, 5, - null, 1, 34, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926475", "9572579", - "CDX-NAHYBBS16V1 - 0616", "CDX.NA.HY.BB.16", - "CDX_NA_HY_S16_BB__SWP", 2455642, 2457560, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBX8", "CDX", 16, "NA HY BB", null, "HY", 1, 5, - null, 1, 39, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926476", "9572581", - "CDX-NAHYHBS16V1 - 0616", "CDX.NA.HY.HB.16", - "CDX_NA_HY_S16_HB__SWP", 2455641, 2457560, 0.05, "USD", - "ACT/360", false, 0.4, 4, "CDX-NAHYHBS16V1", "CDX", 16, "NA HY HB", null, "HY", 1, 5, - null, 1, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.4Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926477", "9572585", - "CDX-NAIGS16V1 - 0615", "CDX.NA.IG.16", - "CDX_NA_IG_S16_04Y_06/15", 2455642, 2457194, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCM5", "CDX", 16, "NA IG", null, "IG", 1, 4, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926478", "9572587", - "CDX-NAIGS16V1 EUR - 0616", "CDX.NA.IG.16", - "CDX_NA_IG_S16_05Y_06/16_EUR", 2455642, 2457560, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYCM5", "CDX", 16, "NA IG", null, "IG", 1, 5, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG CONS.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926479", "9572591", - "CDX-NAIGCONSS16V1 - 0616", "CDX.NA.IG.CONS.16", - "CDX_NA_IG_S16_CONS_06/16", 2455642, 2457560, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B0AR0", "CDX", 16, "NA IG CONS", null, "IG", 1, 5, - null, 1, 39, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926482", "9572627", - "ITRAXX-FINSUBS15V1 - 0616", "iTraxx Europe Sub Financials series 15 Version 1", - "ITRAXX-FINSUBS15V1-0616 EUR LT2 SUB MMR I03 CDS", 2455642, 2457560, 0.01, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAP7", "ITRAXX", 15, "FINSUB", "SUB", "SUBF", 1, 5, - "246287", 1, 25, 0, "LON", true, true, true, "ITXEU512", "SUB")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.10Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926483", "9572628", - "ITRAXX-FINSUBS15V1 - 0621", "iTraxx Europe Sub Financials series 15 Version 1", - "ITRAXX-FINSUBS15V1-0621 EUR LT2 SUB MMR I03 CDS", 2455642, 2459386, 0.01, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAP7", "ITRAXX", 15, "FINSUB", "SUB", "SUBF", 1, 10, - "246287", 1, 25, 0, "LON", true, true, true, "ITXEU012", "SUB")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926484", "9572629", - "USD ITRAXX-EUROPES15V1 - 0616", "iTraxx Europe series 15 Version 1", - "ITRAXX-EUROPES15V1-0616 USD SEN MMR I03 CDS", 2455642, 2457560, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I666VAV7", "USD ITRAXX", 15, "EUROPE", "EUR", "IG", 1, 5, - null, 1, 126, 0, "LON", false, false, true, null, "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.10Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926485", "9572630", - "USD ITRAXX-EUROPES15V1 - 0621", "iTraxx Europe series 15 Version 1", - "ITRAXX-EUROPES15V1-0621 USD SEN MMR I03 CDS", 2455642, 2459386, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I666VAV7", "USD ITRAXX", 15, "EUROPE", "EUR", "IG", 1, 10, - null, 1, 126, 0, "LON", false, false, true, null, "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926486", "9572631", - "USD ITRAXX-XOVERS15V1 - 0616", "iTraxx Europe Crossover series 15 Version 1", - "ITRAXX-XOVERS15V1-0616 USD SEN MMR I03 CDS", 2455642, 2457560, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KBX5", "USD ITRAXX", 15, "XOVER", "XVR", "XO", 1, 5, - null, 1, 40, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926487", "9572632", - "USD ITRAXX-XOVERS15V1 - 0621", "iTraxx Europe Crossover series 15 Version 1", - "ITRAXX-XOVERS15V1-0621 USD SEN MMR I03 CDS", 2455642, 2459386, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KBX5", "USD ITRAXX", 15, "XOVER", "XVR", "XO", 1, 10, - null, 1, 40, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSEN.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926488", "9572633", - "USD ITRAXX-FINSENS15V1 - 0616", "iTraxx Europe Senior Financials series 15 Version 1", - "ITRAXX-FINSENS15V1-0616 USD SEN MMR I03 CDS", 2455642, 2457560, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I667DAO2", "USD ITRAXX", 15, "FINSEN", "SEN", "SENF", 1, 5, - null, 1, 25, 0, "LON", false, false, true, null, "SEN")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSEN.10Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926489", "9572634", - "USD ITRAXX-FINSENS15V1 - 0621", "iTraxx Europe Senior Financials series 15 Version 1", - "ITRAXX-FINSENS15V1-0621 USD SEN MMR I03 CDS", 2455642, 2459386, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I667DAO2", "USD ITRAXX", 15, "FINSEN", "SEN", "SENF", 1, 10, - null, 1, 25, 0, "LON", false, false, true, null, "SEN")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSUB.5Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926490", "9572635", - "USD ITRAXX-FINSUBS15V1 - 0616", "iTraxx Europe Sub Financials series 15 Version 1", - "ITRAXX-FINSUBS15V1-0616 USD LT2 SUB MMR I03 CDS", 2455642, 2457560, 0.01, "USD", - "ACT/360", false, 0.2, 4, "2I667EAP7", "USD ITRAXX", 15, "FINSUB", "SUB", "SUBF", 1, 5, - null, 1, 25, 0, "LON", false, false, true, null, "SUB")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSUB.10Y.15.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926491", "9572636", - "USD ITRAXX-FINSUBS15V1 - 0621", "iTraxx Europe Sub Financials series 15 Version 1", - "ITRAXX-FINSUBS15V1-0621 USD LT2 SUB MMR I03 CDS", 2455642, 2459386, 0.01, "USD", - "ACT/360", false, 0.2, 4, "2I667EAP7", "USD ITRAXX", 15, "FINSUB", "SUB", "SUBF", 1, 10, - null, 1, 25, 0, "LON", false, false, true, null, "SUB")); - - UpdateCDXRefDataMap ("LevXSenS1V18.LevXSen.5Y.1.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926498", "9579065", - "LevXSenS1V18 - 1211", "iTraxx LevX Senior Series 1 Version 18", - "ITRAXX LEVX SENIOR SERIES 1 VERSION 18 EUR 1ST SEC MMR I03 CDS", 2453999, 2455916, 0.017, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJCH4", "LevXSenS1V18", 1, "LevXSen", null, "IG", 18, 5, - null, 0.51426, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926510", "9578919", - "LCDXNAS16V1 - 0612", "LCDX.NA.16", - "CDX_NA_LN_S16_100_01YR", 2455642, 2456099, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDW4", "LCDX", 16, "LCDXNA", null, "IG", 1, 1, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926511", "9578920", - "LCDXNAS16V1 - 0614", "LCDX.NA.16", - "CDX_NA_LN_S16 _100_03YR", 2455642, 2456829, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDW4", "LCDX", 16, "LCDXNA", null, "IG", 1, 3, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS16V1 FXD.LCDXNAV1 FXD.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926512", "9578943", - "LCDXNAS16V1 FXD - 0616", "LCDX.NA.16", - "CDX_NA_LN_S16_100_FXD", 2455642, 2457560, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDW4FXD", "LCDXNAS16V1 FXD", 16, "LCDXNAV1 FXD", null, "IG", 1, 5, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926513", "9578950", - "LCDXNAS16V1 - 0613", "LCDX.NA.16", - "CDX_NA_LN_S16_100_02YR", 2455642, 2456464, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDW4", "LCDX", 16, "LCDXNA", null, "IG", 1, 2, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926514", "9578954", - "LCDXNAS16V1 - 0616", "LCDX.NA.16", - "CDX_NA_LN_S16_100", 2455642, 2457560, 0.025, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GDW4", "LCDX", 16, "LCDXNA", null, "IG", 1, 5, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926515", "9578957", - "LCDXNAS16V1 - 0618", "LCDX.NA.16", - "CDX_NA_LN_S16_100_07YR", 2455642, 2458290, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDW4", "LCDX", 16, "LCDXNA", null, "IG", 1, 7, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926516", "9578963", - "LCDXNAS16V1 - 0621", "LCDX.NA.16", - "CDX_NA_LN_S16_100_10YR", 2455642, 2459386, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDW4", "LCDX", 16, "LCDXNA", null, "IG", 1, 10, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926517", "9578970", - "LCDXNAS16V1 - 0615", "LCDX.NA.16", - "CDX_NA_LN_S16_100_04YR", 2455642, 2457194, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDW4", "LCDX", 16, "LCDXNA", null, "IG", 1, 4, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926518", "9578973", - "LCDXNAS16V1 - 0617", "LCDX.NA.16", - "CDX_NA_LN_S16_100_06YR", 2455642, 2457925, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GDW4", "LCDX", 16, "LCDXNA", null, "IG", 1, 6, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("MCDXNAS16V1.MCDXNA.3Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926519", "9578980", - "MCDXNAS16V1 - 0614", "MCDX.NA.16", - "MCDX SERIES 16 3Y", 2455656, 2456829, 0.01, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAG2", "MCDXNAS16V1", 16, "MCDXNA", null, "IG", 1, 3, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("MCDXNAS16V1.MCDXNA.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926520", "9578989", - "MCDXNAS16V1 - 0616", "MCDX.NA.16", - "MCDX SERIES 16 5Y", 2455656, 2457560, 0.01, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAG2", "MCDXNAS16V1", 16, "MCDXNA", null, "IG", 1, 5, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("MCDXNAS16V1.MCDXNA.10Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926521", "9578982", - "MCDXNAS16V1 - 0621", "MCDX.NA.16", - "MCDX SERIES 16 10Y", 2455656, 2459386, 0.01, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAG2", "MCDXNAS16V1", 16, "MCDXNA", null, "IG", 1, 10, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("LevXSenS1V19.LevXSen.5Y.1.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926535", "9583325", - "LevXSenS1V19 - 1211", "iTraxx LevX Senior Series 1 Version 19", - "ITRAXX LEVX SENIOR SERIES 1 VERSION 19 EUR 1ST SEC MMR I03 CDS", 2453999, 2455916, 0.017, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJCJ0", "LevXSenS1V19", 1, "LevXSen", null, "IG", 19, 5, - null, 0.48569, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LevXSubS1V24.LevXSub.5Y.1.24", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926566", "9586879", - "LevXSubS1V24 - 1211", "iTraxx LevX Subordinated Series 1 Version 24", - "ITRAXX LEVX SUBORDINATED SERIES 1 VERSION 24 EUR 2ND SEC MMR I03 CDS", 2454180, 2455916, 0.045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKCJ7", "LevXSubS1V24", 1, "LevXSub", null, "IG", 24, 5, - null, 0.3429, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.2.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926598", "9598954", - "ITRAXX-LevXS2V12 - 0613", "ITRAXX LEVX SENIOR SERIES 2 VERSION 12", - "ITRAXX LEVX SENIOR SERIES 2 VERSION 12 EUR 1ST SEC RES I03 CDS", 2454543, 2456464, 0.052500000000000005, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJCK7", "ITRAXX", 2, "LevX", null, "IG", 12, 5, - null, 0.8532, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.3.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926599", "9598981", - "ITRAXX-LevXS3V10 - 1213", "ITRAXX LEVX SENIOR SERIES 3 VERSION 10", - "ITRAXX LEVX SENIOR SERIES 3 VERSION 10 EUR 1ST SEC RES I03 CDS", 2454739, 2456647, 0.0575, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJEL3", "ITRAXX", 3, "LevX", null, "IG", 10, 5, - null, 0.88, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.2.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926600", "9599043", - "ITRAXX-LevXS2V13 - 0613", "ITRAXX LEVX SENIOR SERIES 2 VERSION 13", - "ITRAXX LEVX SENIOR SERIES 2 VERSION 13 EUR 1ST SEC RES I03 CDS", 2454543, 2456464, 0.052500000000000005, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJCL5", "ITRAXX", 2, "LevX", null, "IG", 13, 5, - null, 0.8398000000000001, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.4.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926601", "9599035", - "ITRAXX-LevXS4V5 - 0614", "ITRAXX LEVX SENIOR SERIES 4 VERSION 5", - "ITRAXX LEVX SENIOR SERIES 4 VERSION 5 EUR 1ST SEC RES I03 CDS", 2454911, 2456829, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJCN1", "ITRAXX", 4, "LevX", null, "IG", 5, 5, - null, 0.92, 50, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.5.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926602", "9598990", - "ITRAXX-LevXS5V5 - 1214", "ITRAXX LEVX SENIOR SERIES 5 VERSION 5", - "ITRAXX LEVX SENIOR SERIES 5 VERSION 5 EUR 1ST SEC RES I03 CDS", 2455096, 2457012, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJCP6", "ITRAXX", 5, "LevX", null, "IG", 5, 5, - null, 0.9, 40, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.6.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926603", "9599039", - "ITRAXX-LevXS6V3 - 0615", "ITRAXX LEVX SENIOR SERIES 6 VERSION 3", - "ITRAXX LEVX SENIOR SERIES 6 VERSION 3 EUR 1ST SEC RES I03 CDS", 2455278, 2457194, 0.05, "EUR", - "ACT/360", false, 0.71, 4, "4ABCAJCQ4", "ITRAXX", 6, "LevX", null, "IG", 3, 5, - null, 0.9500000000000001, 40, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.3.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926604", "9599008", - "ITRAXX-LevXS3V11 - 1213", "ITRAXX LEVX SENIOR SERIES 3 VERSION 11", - "ITRAXX LEVX SENIOR SERIES 3 VERSION 11 EUR 1ST SEC RES I03 CDS", 2454739, 2456647, 0.0575, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJCM3", "ITRAXX", 3, "LevX", null, "IG", 11, 5, - null, 0.8666, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.30", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926606", "9599372", - "LCDXNAS8V30 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_71/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GDX2", "LCDX", 8, "LCDXNA", null, "IG", 30, 5, - null, 0.71, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.26", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926607", "9599367", - "LCDXNAS9V26 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_75/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GDY0", "LCDX", 9, "LCDXNA", null, "IG", 26, 5, - null, 0.75, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.26", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926608", "9599379", - "LCDXNAS10V26 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_75/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GDZ7", "LCDX", 10, "LCDXNA", null, "IG", 26, 5, - null, 0.75, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.10.26", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926609", "9599388", - "LCDXNAS10V26 - 0611", "LCDX.NA.10", - "CDX_NA_LN_S10_100_03YR_75/100", 2454561, 2455733, 0.0275, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GDZ7", "LCDX", 10, "LCDXNA", null, "IG", 26, 3, - null, 0.75, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.12.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926610", "9599387", - "LCDXNAS12V15 - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_85/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GEA1", "LCDX", 12, "LCDXNA", null, "IG", 15, 5, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.13.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926611", "9599385", - "LCDXNAS13V5 - 1214", "LCDX.NA.13", - "CDX_NA_LN_S13_100_96/100", 2455110, 2457012, 0.05, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GEB9", "LCDX", 13, "LCDXNA", null, "IG", 5, 5, - null, 0.96, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.12.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926614", "9599391", - "LCDXNAS12V15 - 0612", "LCDX.NA.12", - "CDX_NA_LN_S12_100_03YR_85/100", 2454938, 2456099, 0.05, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GEA1", "LCDX", 12, "LCDXNA", null, "IG", 15, 3, - null, 0.85, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LevXSenS1V20.LevXSen.5Y.1.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926616", "9600988", - "LevXSenS1V20 - 1211", "iTraxx LevX Senior Series 1 Version 20", - "ITRAXX LEVX SENIOR SERIES 1 VERSION 20 EUR 1ST SEC MMR I03 CDS", 2453999, 2455916, 0.017, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJCR2", "LevXSenS1V20", 1, "LevXSen", null, "IG", 20, 5, - null, 0.45712, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.31", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926629", "9609092", - "LCDXNAS8V31 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_70/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GEC7", "LCDX", 8, "LCDXNA", null, "IG", 31, 5, - null, 0.7000000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.27", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926630", "9609094", - "LCDXNAS9V27 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_74/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GED5", "LCDX", 9, "LCDXNA", null, "IG", 27, 5, - null, 0.74, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.2.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926640", "9610316", - "ITRAXX-LevXS2V14 - 0613", "ITRAXX LEVX SENIOR SERIES 2 VERSION 14", - "ITRAXX LEVX SENIOR SERIES 2 VERSION 14 EUR 1ST SEC RES I03 CDS", 2454543, 2456464, 0.052500000000000005, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJCW2", "ITRAXX", 2, "LevX", null, "IG", 14, 5, - null, 0.8266, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.3.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926641", "9610317", - "ITRAXX-LevXS3V12 - 1213", "ITRAXX LEVX SENIOR SERIES 3 VERSION 12", - "ITRAXX LEVX SENIOR SERIES 3 VERSION 12 EUR 1ST SEC RES I03 CDS", 2454739, 2456647, 0.0575, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJCS0", "ITRAXX", 3, "LevX", null, "IG", 12, 5, - null, 0.8534, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.6.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926642", "9610335", - "ITRAXX-LevXS6V4 - 0615", "ITRAXX LEVX SENIOR SERIES 6 VERSION 4", - "ITRAXX LEVX SENIOR SERIES 6 VERSION 4 EUR 1ST SEC RES I03 CDS", 2455278, 2457194, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJCV3", "ITRAXX", 6, "LevX", null, "IG", 4, 5, - null, 0.925, 40, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.4.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926643", "9610321", - "ITRAXX-LevXS4V6 - 0614", "ITRAXX LEVX SENIOR SERIES 4 VERSION 6", - "ITRAXX LEVX SENIOR SERIES 4 VERSION 6 EUR 1ST SEC RES I03 CDS", 2454911, 2456829, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJCT8", "ITRAXX", 4, "LevX", null, "IG", 6, 5, - null, 0.9, 50, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.5.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926644", "9610327", - "ITRAXX-LevXS5V6 - 1214", "ITRAXX LEVX SENIOR SERIES 5 VERSION 6", - "ITRAXX LEVX SENIOR SERIES 5 VERSION 6 EUR 1ST SEC RES I03 CDS", 2455096, 2457012, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJCU5", "ITRAXX", 5, "LevX", null, "IG", 6, 5, - null, 0.875, 40, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LevXSenS1V21.LevXSen.5Y.1.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926676", "9611967", - "LevXSenS1V21 - 1211", "iTraxx LevX Senior Series 1 Version 21", - "ITRAXX LEVX SENIOR SERIES 1 VERSION 21 EUR 1ST SEC MMR I03 CDS", 2453999, 2455916, 0.017, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDD2", "LevXSenS1V21", 1, "LevXSen", null, "IG", 21, 5, - null, 0.42855, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LevXSenS1V22.LevXSen.5Y.1.22", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926677", "9611953", - "LevXSenS1V22 - 1211", "iTraxx LevX Senior Series 1 Version 22", - "ITRAXX LEVX SENIOR SERIES 1 VERSION 22 EUR 1ST SEC MMR I03 CDS", 2453999, 2455916, 0.017, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDE0", "LevXSenS1V22", 1, "LevXSen", null, "IG", 22, 5, - null, 0.39998, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LevXSubS1V25.LevXSub.5Y.1.25", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926717", "9624978", - "LevXSubS1V25 - 1211", "iTraxx LevX Subordinated Series 1 Version 25", - "ITRAXX LEVX SUBORDINATED SERIES 1 VERSION 25 EUR 2ND SEC MMR I03 CDS", 2454180, 2455916, 0.045000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "4ABCAKCK4", "LevXSubS1V25", 1, "LevXSub", null, "IG", 25, 5, - null, 0.3143, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LevXSenS1V23.LevXSen.5Y.1.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926718", "9626147", - "LevXSenS1V23 - 1211", "iTraxx LevX Senior Series 1 Version 23", - "ITRAXX LEVX SENIOR SERIES 1 VERSION 23 EUR 1ST SEC MMR I03 CDS", 2453999, 2455917, 0.017, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDF7", "LevXSenS1V23", 1, "LevXSen", null, "IG", 23, 5, - null, 0.37140999999999996, 35, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.32", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926719", "9627180", - "LCDXNAS8V32 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_69/100", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GEF0", "LCDX", 8, "LCDXNA", null, "IG", 32, 5, - null, 0.6900000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.28", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926720", "9627190", - "LCDXNAS9V28 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_73/100", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GEG8", "LCDX", 9, "LCDXNA", null, "IG", 28, 5, - null, 0.73, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.27", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926721", "9627181", - "LCDXNAS10V27 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_74/100", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GEH6", "LCDX", 10, "LCDXNA", null, "IG", 27, 5, - null, 0.74, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.12.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926724", "9627185", - "LCDXNAS12V16 - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_84/100", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GEI4", "LCDX", 12, "LCDXNA", null, "IG", 16, 5, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.12.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926725", "9627192", - "LCDXNAS12V16 - 0612", "LCDX.NA.12", - "CDX_NA_LN_S12_100_03YR_84/100", 2454938, 2456099, 0.05, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GEI4", "LCDX", 12, "LCDXNA", null, "IG", 16, 3, - null, 0.84, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.13.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926726", "9627194", - "LCDXNAS13V6 - 1214", "LCDX.NA.13", - "CDX_NA_LN_S13_100_95/100", 2455110, 2457012, 0.05, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GEJ2", "LCDX", 13, "LCDXNA", null, "IG", 6, 5, - null, 0.9500000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.2.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926727", "9627534", - "ITRAXX-LevXS2V15 - 0613", "ITRAXX LEVX SENIOR SERIES 2 VERSION 15", - "ITRAXX LEVX SENIOR SERIES 2 VERSION 15 EUR 1ST SEC RES I03 CDS", 2454543, 2456464, 0.052500000000000005, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJCX9", "ITRAXX", 2, "LevX", null, "IG", 15, 5, - null, 0.8134, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.3.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926728", "9627536", - "ITRAXX-LevXS3V13 - 1213", "ITRAXX LEVX SENIOR SERIES 3 VERSION 13", - "ITRAXX LEVX SENIOR SERIES 3 VERSION 13 EUR 1ST SEC RES I03 CDS", 2454739, 2456647, 0.0575, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJCY7", "ITRAXX", 3, "LevX", null, "IG", 13, 5, - null, 0.8402, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.4.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926729", "9627529", - "ITRAXX-LevXS4V7 - 0614", "ITRAXX LEVX SENIOR SERIES 4 VERSION 7", - "ITRAXX LEVX SENIOR SERIES 4 VERSION 7 EUR 1ST SEC RES I03 CDS", 2454911, 2456829, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJCZ4", "ITRAXX", 4, "LevX", null, "IG", 7, 5, - null, 0.88, 50, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.5.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926730", "9627533", - "ITRAXX-LevXS5V7 - 1214", "ITRAXX LEVX SENIOR SERIES 5 VERSION 7", - "ITRAXX LEVX SENIOR SERIES 5 VERSION 7 EUR 1ST SEC RES I03 CDS", 2455096, 2457012, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDC4", "ITRAXX", 5, "LevX", null, "IG", 7, 5, - null, 0.85, 40, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.6.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926731", "9627535", - "ITRAXX-LevXS6V5 - 0615", "ITRAXX LEVX SENIOR SERIES 6 VERSION 5", - "ITRAXX LEVX SENIOR SERIES 6 VERSION 5 EUR 1ST SEC RES I03 CDS", 2455278, 2457194, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDG5", "ITRAXX", 6, "LevX", null, "IG", 5, 5, - null, 0.9, 40, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.3.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926746", "9637011", - "ITRAXX-LevXS3V14 - 1213", "iTraxx LevX Senior Series 3 Version 14", - "ITRAXX LEVX SENIOR SERIES 3 VERSION 14 EUR 1ST SEC RES I03 CDS", 2454739, 2456647, 0.0575, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDH3", "ITRAXX", 3, "LevX", null, "IG", 14, 5, - null, 0.8268000000000001, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.AUSTRALIA.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926749", "9636497", - "ITRAXX-AUSTRALIAS16V1 - 1216", "iTraxx Australia Series Number 16 Version 1", - "ITRAXX AUSTRALIA SERIES NUMBER 16 VERSION 1 USD SEN MR I03 CDS", 2455825, 2457743, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I668IAP7", "ITRAXX", 16, "AUSTRALIA", null, "AUHG", 1, 5, - null, 1, 25, 0, "HKG", false, false, true, null, "Itraxx Australia")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926750", "9636288", - "ITRAXX-JAPANS16V1 - 1216", "iTraxx Japan Series Number 16 Version 1", - "ITRAXX JAPAN SERIES NUMBER 16 VERSION 1 JPY SEN RES I03 CDS", 2455825, 2457743, 0.01, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBP8", "ITRAXX", 16, "JAPAN", null, "JPHG", 1, 5, - null, 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ IG.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926751", "9636299", - "ITRAXX-ASIAXJIGS16V1 - 1216", "iTraxx Asia ex-Japan IG Series Number 16 Version 1", - "ITRAXX ASIA EX-JAPAN IG SERIES NUMBER 16 VERSION 1 USD SEN RES I03 CDS", 2455825, 2457743, 0.01, "USD", - "ACT/360", false, 0.4, 4, "4ABCAMAI7", "ITRAXX", 16, "ASIAXJ IG", null, "ASHG", 1, 5, - null, 1, 40, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.SOVXASIAPACIFIC.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926752", "9636296", - "ITRAXX-SOVX-ASIA-PACIFICS6 - 1216", "ITRAXX SOVX ASIA PACIFIC SERIES 6 VERSION 1", - "ITRAXX SOVX ASIA-PACIFIC SERIES NUMBER 6 VERSION 1 USD SEN RES I03 CDS", 2455825, 2457743, 0.01, "USD", - "ACT/360", false, 0.4, 4, "4ABCANAD6", "ITRAXX", 6, "SOVXASIAPACIFIC", null, "ASHG", 1, 5, - null, 1, 10, 0, "HKG", false, false, true, null, "Itraxx SovX")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.3Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926753", "9635818", - "ITRAXX-EUROPES16V1 - 1214", "iTraxx Europe series 16 Version 1", - "ITRAXX-EUROPES16V1-1214 EUR SEN MMR I03 CDS", 2455825, 2457012, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAW5", "ITRAXX", 16, "EUROPE", "EUR", "IG", 1, 3, - "246615", 1, 126, 0, "LON", true, true, true, null, "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926754", "9635819", - "ITRAXX-EUROPES16V1 - 1216", "iTraxx Europe series 16 Version 1", - "ITRAXX-EUROPES16V1-1216 EUR SEN MMR I03 CDS", 2455825, 2457743, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAW5", "ITRAXX", 16, "EUROPE", "EUR", "IG", 1, 5, - "246615", 1, 126, 0, "LON", true, true, true, null, "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.7Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926755", "9635820", - "ITRAXX-EUROPES16V1 - 1218", "iTraxx Europe series 16 Version 1", - "ITRAXX-EUROPES16V1-1218 EUR SEN MMR I03 CDS", 2455825, 2458473, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAW5", "ITRAXX", 16, "EUROPE", "EUR", "IG", 1, 7, - "246615", 1, 126, 0, "LON", true, true, true, null, "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926756", "9635821", - "ITRAXX-EUROPES16V1 - 1221", "iTraxx Europe series 16 Version 1", - "ITRAXX-EUROPES16V1-1221 EUR SEN MMR I03 CDS", 2455825, 2459569, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAW5", "ITRAXX", 16, "EUROPE", "EUR", "IG", 1, 10, - "246615", 1, 126, 0, "LON", true, true, true, null, "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926758", "9635822", - "ITRAXX-XOVERS16V1 - 1214", "iTraxx Europe Crossover series 16 Version 1", - "ITRAXX-XOVERS16V1-1214 EUR SEN MMR I03 CDS", 2455825, 2457012, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBY3", "ITRAXX", 16, "XOVER", "XVR", "XO", 1, 3, - "246616", 1, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926760", "9635836", - "USD ITRAXX-EUROPES16V1 - 1216", "iTraxx Europe series 16 Version 1", - "ITRAXX-EUROPES16V1-1216 USD SEN MMR I03 CDS", 2455825, 2457743, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I666VAW5", "USD ITRAXX", 16, "EUROPE", "EUR", "IG", 1, 5, - null, 1, 126, 0, "LON", false, false, true, null, "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.10Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926761", "9635837", - "USD ITRAXX-EUROPES16V1 - 1221", "iTraxx Europe series 16 Version 1", - "ITRAXX-EUROPES16V1-1221 USD SEN MMR I03 CDS", 2455825, 2459569, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I666VAW5", "USD ITRAXX", 16, "EUROPE", "EUR", "IG", 1, 10, - null, 1, 126, 0, "LON", false, false, true, null, "EUR")); - - return true; - } - - private static final boolean InitCDXRefDataSet39() - { - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926762", "9635838", - "USD ITRAXX-XOVERS16V1 - 1216", "iTraxx Europe Crossover series 16 Version 1", - "ITRAXX-XOVERS16V1-1216 USD SEN MMR I03 CDS", 2455825, 2457743, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KBY3", "USD ITRAXX", 16, "XOVER", "XVR", "XO", 1, 5, - null, 1, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926763", "9635839", - "USD ITRAXX-XOVERS16V1 - 1221", "iTraxx Europe Crossover series 16 Version 1", - "ITRAXX-XOVERS16V1-1221 USD SEN MMR I03 CDS", 2455825, 2459569, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KBY3", "USD ITRAXX", 16, "XOVER", "XVR", "XO", 1, 10, - null, 1, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSEN.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926764", "9635840", - "USD ITRAXX-FINSENS16V1 - 1216", "iTraxx Europe Senior Financials series 16 Version 1", - "ITRAXX-FINSENS16V1-1216 USD SEN MMR I03 CDS", 2455825, 2457743, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I667DAP9", "USD ITRAXX", 16, "FINSEN", "SEN", "SENF", 1, 5, - null, 1, 25, 0, "LON", false, false, true, null, "SEN")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSEN.10Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926765", "9635841", - "USD ITRAXX-FINSENS16V1 - 1221", "iTraxx Europe Senior Financials series 16 Version 1", - "ITRAXX-FINSENS16V1-1221 USD SEN MMR I03 CDS", 2455825, 2459569, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I667DAP9", "USD ITRAXX", 16, "FINSEN", "SEN", "SENF", 1, 10, - null, 1, 25, 0, "LON", false, false, true, null, "SEN")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSUB.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926766", "9635842", - "USD ITRAXX-FINSUBS16V1 - 1216", "iTraxx Europe Sub Financials series 16 Version 1", - "ITRAXX-FINSUBS16V1-1216 USD LT2 SUB MMR I03 CDS", 2455825, 2457743, 0.05, "USD", - "ACT/360", false, 0.2, 4, "2I667EAQ5", "USD ITRAXX", 16, "FINSUB", "SUB", "SUBF", 1, 5, - null, 1, 25, 0, "LON", false, false, true, null, "SUB")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSUB.10Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926767", "9635843", - "USD ITRAXX-FINSUBS16V1 - 1221", "iTraxx Europe Sub Financials series 16 Version 1", - "ITRAXX-FINSUBS16V1-1221 USD LT2 SUB MMR I03 CDS", 2455825, 2459569, 0.05, "USD", - "ACT/360", false, 0.2, 4, "2I667EAQ5", "USD ITRAXX", 16, "FINSUB", "SUB", "SUBF", 1, 10, - null, 1, 25, 0, "LON", false, false, true, null, "SUB")); - - UpdateCDXRefDataMap ("CDX.EM.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926768", "9635858", - "CDX-EMS16V1 - 1216", "CDX.EM.16", - "CDX EM 16 5YR", 2455825, 2457743, 0.05, "USD", - "ACT/360", false, 0.25, 4, "2I65BZAP7", "CDX", 16, "EM", null, "EM", 1, 5, - null, 1, 15, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926769", "9635860", - "CDX-NAHYS17V1 - 1216", "CDX.NA.HY.17", - "CDX_NA_HY_S17_100_SWP", 2455825, 2457743, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHM5", "CDX", 17, "NA HY", null, "HY", 1, 5, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926770", "9635863", - "CDX-NAHYS17V1 - 1214", "CDX.NA.HY.17", - "CDX_NA_HY_S17_100_SWP_03YR", 2455825, 2457012, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHM5", "CDX", 17, "NA HY", null, "HY", 1, 3, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926771", "9635867", - "CDX-NAHYS17V1 - 1218", "CDX.NA.HY.17", - "CDX_NA_HY_S17_100_SWP_07YR", 2455825, 2458473, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHM5", "CDX", 17, "NA HY", null, "HY", 1, 7, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926772", "9635868", - "CDX-NAHYS17V1 - 1221", "CDX.NA.HY.17", - "CDX_NA_HY_S17_100_SWP_10YR", 2455825, 2459569, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHM5", "CDX", 17, "NA HY", null, "HY", 1, 10, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926773", "9635871", - "CDX-NAHYBS17V1 - 1216", "CDX.NA.HY.B.17", - "CDX_NA_HY_S17_B___SWP", 2455825, 2457743, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSEN4", "CDX", 17, "NA HY B", null, "HY", 1, 5, - null, 1, 37, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.2.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926774", "9638567", - "ITRAXX-LevXS2V16 - 0613", "iTraxx LevX Senior Series 2 Version 16", - "ITRAXX LEVX SENIOR SERIES 2 VERSION 16 EUR 1ST SEC RES I03 CDS", 2454543, 2456464, 0.052500000000000005, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDJ9", "ITRAXX", 2, "LevX", null, "IG", 16, 5, - null, 0.8, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926775", "9635873", - "CDX-NAHYBBS17V1 - 1216", "CDX.NA.HY.BB.17", - "CDX_NA_HY_S17_BB__SWP", 2455825, 2457743, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBY6", "CDX", 17, "NA HY BB", null, "HY", 1, 5, - null, 1, 40, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.3.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926776", "9638568", - "ITRAXX-LevXS3V15 - 1213", "iTraxx LevX Senior Series 3 Version 15", - "ITRAXX LEVX SENIOR SERIES 3 VERSION 15 EUR 1ST SEC RES I03 CDS", 2454739, 2456647, 0.0575, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDK6", "ITRAXX", 3, "LevX", null, "IG", 15, 5, - null, 0.8134, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.4.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926777", "9638569", - "ITRAXX-LevXS4V8 - 0614", "iTraxx LevX Senior Series 4 Version 8", - "ITRAXX LEVX SENIOR SERIES 4 VERSION 8 EUR 1ST SEC RES I03 CDS", 2454911, 2456829, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDL4", "ITRAXX", 4, "LevX", null, "IG", 8, 5, - null, 0.86, 50, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.5.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926778", "9638571", - "ITRAXX-LevXS5V8 - 1214", "iTraxx LevX Senior Series 5 Version 8", - "ITRAXX LEVX SENIOR SERIES 5 VERSION 8 EUR 1ST SEC RES I03 CDS", 2455096, 2457012, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDM2", "ITRAXX", 5, "LevX", null, "IG", 8, 5, - null, 0.8250000000000001, 40, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.6.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926779", "9638572", - "ITRAXX-LevXS6V6 - 0615", "iTraxx LevX Senior Series 6 Version 6", - "ITRAXX LEVX SENIOR SERIES 6 VERSION 6 EUR 1ST SEC RES I03 CDS", 2455278, 2457194, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDN0", "ITRAXX", 6, "LevX", null, "IG", 6, 5, - null, 0.875, 40, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926780", "9635876", - "CDX-NAIGS17V1 - 1214", "CDX.NA.IG.17", - "CDX_NA_IG_S17_03Y_12/14", 2455825, 2457012, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCN3", "CDX", 17, "NA IG", null, "IG", 1, 3, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926781", "9635823", - "ITRAXX-XOVERS16V1 - 1216", "iTraxx Europe Crossover series 16 Version 1", - "ITRAXX-XOVERS16V1-1216 EUR SEN MMR I03 CDS", 2455825, 2457743, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBY3", "ITRAXX", 16, "XOVER", "XVR", "XO", 1, 5, - "246616", 1, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926782", "9635824", - "ITRAXX-XOVERS16V1 - 1218", "iTraxx Europe Crossover series 16 Version 1", - "ITRAXX-XOVERS16V1-1218 EUR SEN MMR I03 CDS", 2455825, 2458473, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBY3", "ITRAXX", 16, "XOVER", "XVR", "XO", 1, 7, - "246616", 1, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926783", "9635825", - "ITRAXX-XOVERS16V1 - 1221", "iTraxx Europe Crossover series 16 Version 1", - "ITRAXX-XOVERS16V1-1221 EUR SEN MMR I03 CDS", 2455825, 2459569, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBY3", "ITRAXX", 16, "XOVER", "XVR", "XO", 1, 10, - "246616", 1, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.3Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926784", "9635826", - "ITRAXX-HIVOLS16V1 - 1214", "iTraxx Europe HiVol series 16 Version 1", - "ITRAXX-HIVOLS16V1-1214 EUR SEN MMR I03 CDS", 2455825, 2457012, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAT3", "ITRAXX", 16, "HIVOL", "VOL", "HV", 1, 3, - "246617", 1, 30, 0, "LON", true, true, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926785", "9635827", - "ITRAXX-HIVOLS16V1 - 1216", "iTraxx Europe HiVol series 16 Version 1", - "ITRAXX-HIVOLS16V1-1216 EUR SEN MMR I03 CDS", 2455825, 2457743, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAT3", "ITRAXX", 16, "HIVOL", "VOL", "HV", 1, 5, - "246617", 1, 30, 0, "LON", true, true, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.7Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926786", "9635828", - "ITRAXX-HIVOLS16V1 - 1218", "iTraxx Europe HiVol series 16 Version 1", - "ITRAXX-HIVOLS16V1-1218 EUR SEN MMR I03 CDS", 2455825, 2458473, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAT3", "ITRAXX", 16, "HIVOL", "VOL", "HV", 1, 7, - "246617", 1, 30, 0, "LON", true, true, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.10Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926787", "9635829", - "ITRAXX-HIVOLS16V1 - 1221", "iTraxx Europe HiVol series 16 Version 1", - "ITRAXX-HIVOLS16V1-1221 EUR SEN MMR I03 CDS", 2455825, 2459569, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAT3", "ITRAXX", 16, "HIVOL", "VOL", "HV", 1, 10, - "246617", 1, 30, 0, "LON", true, true, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926788", "9635832", - "ITRAXX-FINSENS16V1 - 1216", "iTraxx Europe Senior Financials series 16 Version 1", - "ITRAXX-FINSENS16V1-1216 EUR SEN MMR I03 CDS", 2455825, 2457743, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAP9", "ITRAXX", 16, "FINSEN", "SEN", "SENF", 1, 5, - "246618", 1, 25, 0, "LON", true, true, true, null, "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.10Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926789", "9635833", - "ITRAXX-FINSENS16V1 - 1221", "iTraxx Europe Senior Financials series 16 Version 1", - "ITRAXX-FINSENS16V1-1221 EUR SEN MMR I03 CDS", 2455825, 2459569, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAP9", "ITRAXX", 16, "FINSEN", "SEN", "SENF", 1, 10, - "246618", 1, 25, 0, "LON", true, true, true, null, "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926790", "9635834", - "ITRAXX-FINSUBS16V1 - 1216", "iTraxx Europe Sub Financials series 16 Version 1", - "ITRAXX-FINSUBS16V1-1216 EUR LT2 SUB MMR I03 CDS", 2455825, 2457743, 0.05, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAQ5", "ITRAXX", 16, "FINSUB", "SUB", "SUBF", 1, 5, - "246619", 1, 25, 0, "LON", true, true, true, null, "SUB")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.10Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926791", "9635835", - "ITRAXX-FINSUBS16V1 - 1221", "iTraxx Europe Sub Financials series 16 Version 1", - "ITRAXX-FINSUBS16V1-1221 EUR LT2 SUB MMR I03 CDS", 2455825, 2459569, 0.05, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAQ5", "ITRAXX", 16, "FINSUB", "SUB", "SUBF", 1, 10, - "246619", 1, 25, 0, "LON", true, true, true, null, "SUB")); - - UpdateCDXRefDataMap ("Itraxx.SovX West Eur.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926792", "9635848", - "Itraxx-SovX West Eur S6V1 - 1216", "Itraxx SovX Western Europe Series 6 Version 1", - "ITRAXX-SOVX WEST EUR S6V1-1216 USD SEN RES I03 CDS", 2455825, 2457743, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAF8", "Itraxx", 6, "SovX West Eur", "SOV", "SOWE", 1, 5, - "246620", 1, 15, 0, "LON", true, true, true, null, "SOV")); - - UpdateCDXRefDataMap ("Itraxx.SovX West Eur.10Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926799", "9635849", - "Itraxx-SovX West Eur S6V1 - 1221", "Itraxx SovX Western Europe Series 6 Version 1", - "ITRAXX-SOVX WEST EUR S6V1-1221 USD SEN RES I03 CDS", 2455825, 2459569, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAF8", "Itraxx", 6, "SovX West Eur", "SOV", "SOWE", 1, 10, - "246620", 1, 15, 0, "LON", true, true, true, null, "SOV")); - - UpdateCDXRefDataMap ("ITRAXX.CEEMEA.5Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926801", "9635850", - "ITRAXX-CEEMEAS6V1 - 1216", "iTraxx SovX CEEMEA Series 6 Version 1", - "ITRAXX-SOVX CEEMEA S6V1-1216 USD SEN RES I03 CDS", 2455825, 2457743, 0.01, "USD", - "ACT/360", false, 0.25, 4, "5C769NAF6", "ITRAXX", 6, "CEEMEA", "SOVXCEM", "SOCE", 1, 5, - null, 1, 15, 0, "LON", false, false, true, null, "SOVXCEM")); - - UpdateCDXRefDataMap ("ITRAXX.CEEMEA.10Y.6.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926803", "9635851", - "ITRAXX-CEEMEAS6V1 - 1221", "iTraxx SovX CEEMEA Series 6 Version 1", - "ITRAXX-SOVX CEEMEA S6V1-1221 USD SEN RES I03 CDS", 2455825, 2459569, 0.01, "USD", - "ACT/360", false, 0.25, 4, "5C769NAF6", "ITRAXX", 6, "CEEMEA", "SOVXCEM", "SOCE", 1, 10, - null, 1, 15, 0, "LON", false, false, true, null, "SOVXCEM")); - - UpdateCDXRefDataMap ("USD ITRAXX.HIVOL.5Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926804", "9635844", - "USD ITRAXX-HIVOLS16V1 - 1216", "iTraxx Europe HiVol series 16 Version 1", - "ITRAXX-HIVOLS16V1-1216 USD SEN MMR I03 CDS", 2455825, 2457743, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I667LAT3", "USD ITRAXX", 16, "HIVOL", "VOL", "HV", 1, 5, - null, 1, 30, 0, "LON", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("USD ITRAXX.HIVOL.10Y.16.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926805", "9635845", - "USD ITRAXX-HIVOLS16V1 - 1221", "iTraxx Europe HiVol series 16 Version 1", - "ITRAXX-HIVOLS16V1-1221 USD SEN MMR I03 CDS", 2455825, 2459569, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I667LAT3", "USD ITRAXX", 16, "HIVOL", "VOL", "HV", 1, 10, - null, 1, 30, 0, "LON", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926808", "9635878", - "CDX-NAIGS17V1 - 1216", "CDX.NA.IG.17", - "CDX_NA_IG_S17_05Y_12/16", 2455825, 2457743, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCN3", "CDX", 17, "NA IG", null, "IG", 1, 5, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926809", "9635880", - "CDX-NAIGS17V1 - 1218", "CDX.NA.IG.17", - "CDX_NA_IG_S17_07Y_12/18", 2455825, 2458473, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCN3", "CDX", 17, "NA IG", null, "IG", 1, 7, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926810", "9635881", - "CDX-NAIGS17V1 - 1221", "CDX.NA.IG.17", - "CDX_NA_IG_S17_10Y_12/21", 2455825, 2459569, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCN3", "CDX", 17, "NA IG", null, "IG", 1, 10, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.3Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926811", "9635888", - "CDX-NAIGHVOLS17V1 - 1214", "CDX.NA.IG.HVOL.17", - "CDX_NA_IG_S17_HVOL_03Y_12/14", 2455825, 2457012, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AS2", "CDX", 17, "NA IG HVOL", null, "HV", 1, 3, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926812", "9635890", - "CDX-NAIGHVOLS17V1 - 1216", "CDX.NA.IG.HVOL.17", - "CDX_NA_IG_S17_HVOL_05Y_12/16", 2455825, 2457743, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AS2", "CDX", 17, "NA IG HVOL", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.7Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926813", "9635891", - "CDX-NAIGHVOLS17V1 - 1218", "CDX.NA.IG.HVOL.17", - "CDX_NA_IG_S17_HVOL_07Y_12/18", 2455825, 2458473, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AS2", "CDX", 17, "NA IG HVOL", null, "HV", 1, 7, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.10Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926814", "9635892", - "CDX-NAIGHVOLS17V1 - 1221", "CDX.NA.IG.HVOL.17", - "CDX_NA_IG_S17_HVOL_10Y_12/21", 2455825, 2459569, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AS2", "CDX", 17, "NA IG HVOL", null, "HV", 1, 10, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926815", "9635879", - "CDX-NAIGS17V1 EUR - 1216", "CDX.NA.IG.17", - "CDX_NA_IG_S17_05Y_12/16_EUR", 2455825, 2457743, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYCN3", "CDX", 17, "NA IG", null, "IG", 1, 5, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY V4 FXD 97/100.5Y.17.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926816", "9635859", - "CDX-NAHYS17V4 FXD 97/100 - 1216", "CDX.NA.HY.17", - "CDX_NA_HY_S17_100_FXD_97/100", 2455825, 2457743, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIU6 FXD", "CDX", 17, "NA HY V4 FXD 97/100", null, "HY", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("MCDXNAS17V1.MCDXNA.3Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926824", "9639736", - "MCDXNAS17V1 - 1214", "MCDX.NA.17", - "MCDX SERIES 17 3Y", 2455838, 2457012, 0.01, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAH0", "MCDXNAS17V1", 17, "MCDXNA", null, "IG", 1, 3, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("MCDXNAS17V1.MCDXNA.5Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926825", "9639682", - "MCDXNAS17V1 - 1216", "MCDX.NA.17", - "MCDX SERIES 17 5Y", 2455838, 2457743, 0.01, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAH0", "MCDXNAS17V1", 17, "MCDXNA", null, "IG", 1, 5, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("MCDXNAS17V1.MCDXNA.10Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926826", "9639702", - "MCDXNAS17V1 - 1221", "MCDX.NA.17", - "MCDX SERIES 17 10Y", 2455838, 2459569, 0.01, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAH0", "MCDXNAS17V1", 17, "MCDXNA", null, "IG", 1, 10, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926842", "9639475", - "LCDXNAS17V1 - 1212", "LCDX.NA.17", - "CDX_NA_LN_S17_100_01YR", 2455838, 2456282, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GEP8", "LCDX", 17, "LCDXNA", null, "IG", 1, 1, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926843", "9639478", - "LCDXNAS17V1 - 1214", "LCDX.NA.17", - "CDX_NA_LN_S17 _100_03YR", 2455838, 2457012, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GEP8", "LCDX", 17, "LCDXNA", null, "IG", 1, 3, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS17V1 FXD.LCDXNAV1 FXD.5Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926844", "9639483", - "LCDXNAS17V1 - 1240", "LCDX.NA.17", - "CDX_NA_LN_S17_100_FXD", 2455838, 2466509, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GEP8 FXD", "LCDXNAS17V1 FXD", 17, "LCDXNAV1 FXD", null, "IG", 1, 5, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926845", "9639531", - "LCDXNAS17V1 - 1213", "LCDX.NA.17", - "CDX_NA_LN_S17_100_02YR", 2455838, 2456647, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GEP8", "LCDX", 17, "LCDXNA", null, "IG", 1, 2, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926855", "9639740", - "LCDXNAS17V1 - 1216", "LCDX.NA.17", - "CDX_NA_LN_S17_100", 2455825, 2457743, 0.025, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GEP8", "LCDX", 17, "LCDXNA", null, "IG", 1, 5, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926856", "9639735", - "LCDXNAS17V1 - 1218", "LCDX.NA.17", - "CDX_NA_LN_S17_100_07YR", 2455838, 2458473, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GEP8", "LCDX", 17, "LCDXNA", null, "IG", 1, 7, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926857", "9639671", - "LCDXNAS17V1 - 1221", "LCDX.NA.17", - "CDX_NA_LN_S17_100_10YR", 2455838, 2459569, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GEP8", "LCDX", 17, "LCDXNA", null, "IG", 1, 10, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926858", "9639685", - "LCDXNAS17V1 - 1215", "LCDX.NA.17", - "CDX_NA_LN_S17_100_04YR", 2455838, 2457377, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GEP8", "LCDX", 17, "LCDXNA", null, "IG", 1, 4, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926859", "9639703", - "LCDXNAS17V1 - 1217", "LCDX.NA.17", - "CDX_NA_LN_S17_100_06YR", 2455838, 2458108, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GEP8", "LCDX", 17, "LCDXNA", null, "IG", 1, 6, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.8.33", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926865", "9640588", - "LCDXNAS8V33 - 0612", "LCDX.NA.8", - "CDX_NA_LN_S08_100_68/100_CH", 2454244, 2456099, 0.012, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GEK9", "LCDX", 8, "LCDXNA", null, "IG", 33, 5, - null, 0.68, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.9.29", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926866", "9640594", - "LCDXNAS9V29 - 1212", "LCDX.NA.9", - "CDX_NA_LN_S09_100_72/100_CH", 2454378, 2456282, 0.022500000000000003, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GEL7", "LCDX", 9, "LCDXNA", null, "IG", 29, 5, - null, 0.72, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.10.28", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926868", "9640601", - "LCDXNAS10V28 - 0613", "LCDX.NA.10", - "CDX_NA_LN_S10_100_73/100_CH", 2454561, 2456464, 0.0325, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GEM5", "LCDX", 10, "LCDXNA", null, "IG", 28, 5, - null, 0.73, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.13.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926871", "9640616", - "LCDXNAS13V7 - 1214", "LCDX.NA.13", - "CDX_NA_LN_S13_100_94/100_CH", 2455110, 2457012, 0.05, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GEO1", "LCDX", 13, "LCDXNA", null, "IG", 7, 5, - null, 0.9400000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.12.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926872", "9640608", - "LCDXNAS12V17 - 0614", "LCDX.NA.12", - "CDX_NA_LN_S12_100_83/100_CH", 2454938, 2456829, 0.05, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GEN3", "LCDX", 12, "LCDXNA", null, "IG", 17, 5, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.12.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926883", "9640609", - "LCDXNAS12V17 - 0612", "LCDX.NA.12", - "CDX_NA_LN_S12_100_03YR_83/100_CH", 2454938, 2456099, 0.05, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GEN3", "LCDX", 12, "LCDXNA", null, "IG", 17, 3, - null, 0.8300000000000001, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN80.5Y.7.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926895", "9646272", - "ITRAXX-JAPAN80S7V4 - 0612", "iTraxx Japan 80 Series Number 7 Version 4", - "ITRAXX JAPAN 80 SERIES NUMBER 07 VERSION 4 JPY SEN RES I03 CDS", 2454180, 2456099, 0.0025, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "4ABCAHAG2", "ITRAXX", 7, "JAPAN80", null, "IG", 4, 5, - null, 0.9625, 79, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN80.5Y.8.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926896", "9646360", - "ITRAXX-JAPAN80S8V4 - 1212", "iTraxx Japan 80 Series Number 8 Version 4", - "ITRAXX JAPAN 80 SERIES NUMBER 08 VERSION 4 JPY SEN RES I03 CDS", 2454364, 2456282, 0.003, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "4ABCAHAH0", "ITRAXX", 8, "JAPAN80", null, "IG", 4, 5, - null, 0.9625, 80, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.6.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926897", "9646362", - "ITRAXX-JAPANHIVOLS6V5 - 1211", "iTraxx Japan HiVol Series Number 6 Version 5", - "ITRAXX JAPAN HIVOL SERIES NUMBER 06 VERSION 5 JPY SEN RES I03 CDS", 2453999, 2455916, 0.0055000000000000005, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MAO1", "ITRAXX", 6, "JAPANHIVOL", "VOL", "HV", 5, 5, - null, 0.84, 24, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("EUR ITRAXX.JAPANHIVOL.5Y.6.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926898", "9646409", - "EUR ITRAXX-JAPANHIVOLS6V5 - 1211", "iTraxx Japan HiVol Series Number 6 Version 5", - "ITRAXX JAPAN HIVOL SERIES NUMBER 06 VERSION 5 EUR SEN RES I03 CDS", 2453999, 2455916, 0.0055000000000000005, "EUR", - "ACT/360", false, 0.35000000000000003, 4, "2I668MAO1", "EUR ITRAXX", 6, "JAPANHIVOL", "VOL", "HV", 5, 5, - null, 0.84, 24, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.7.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926899", "9646338", - "ITRAXX-JAPANHIVOLS7V5 - 0612", "iTraxx Japan HiVol Series Number 7 Version 5", - "ITRAXX JAPAN HIVOL SERIES NUMBER 07 VERSION 5 JPY SEN RES I03 CDS", 2454180, 2456099, 0.006, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MBG7", "ITRAXX", 7, "JAPANHIVOL", "VOL", "HV", 5, 5, - null, 0.84, 24, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JHIVOL.5Y.7.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926900", "9646543", - "ITRAXX-JHIVOLS7V5 - 1212", "iTraxx Japan HiVol Series Number 7 Version 5", - "ITRAXX JAPAN HIVOL SERIES NUMBER 07 VERSION 5 JPY SEN RES I03 CDS DEC 20 2012", 2454180, 2456282, 0.006, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MBG7", "ITRAXX", 7, "JHIVOL", "VOL", "HV", 5, 5, - null, 0.84, 24, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.8.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926901", "9646363", - "ITRAXX-JAPANHIVOLS8V5 - 1212", "iTraxx Japan HiVol Series Number 8 Version 5", - "ITRAXX JAPAN HIVOL SERIES NUMBER 08 VERSION 5 JPY SEN RES I03 CDS", 2454364, 2456282, 0.007500000000000001, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MBH5", "ITRAXX", 8, "JAPANHIVOL", "VOL", "HV", 5, 5, - null, 0.84, 25, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.9.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926902", "9646396", - "ITRAXX-JAPANHIVOLS9V5 - 0613", "iTraxx Japan HiVol Series Number 9 Version 5", - "ITRAXX JAPAN HIVOL SERIES NUMBER 09 VERSION 5 JPY SEN RES I03 CDS", 2454546, 2456464, 0.035, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MBI3", "ITRAXX", 9, "JAPANHIVOL", "VOL", "HV", 5, 5, - null, 0.84, 25, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.2.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926963", "9656620", - "ITRAXX-LevXS2V17 - 0613", "iTraxx LevX Senior Series 2 Version 17", - "ITRAXX LEVX SENIOR SERIES 2 VERSION 17 EUR 1ST SEC RES I03 CDS", 2454543, 2456464, 0.052500000000000005, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDP5", "ITRAXX", 2, "LevX", null, "IG", 17, 5, - null, 0.7866, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.3.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926964", "9656654", - "ITRAXX-LevXS3V16 - 1213", "iTraxx LevX Senior Series 3 Version 16", - "ITRAXX LEVX SENIOR SERIES 3 VERSION 16 EUR 1ST SEC RES I03 CDS", 2454739, 2456647, 0.0575, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDQ3", "ITRAXX", 3, "LevX", null, "IG", 16, 5, - null, 0.8, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.4.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926965", "9656655", - "ITRAXX-LevXS4V9 - 0614", "iTraxx LevX Senior Series 4 Version 9", - "ITRAXX LEVX SENIOR SERIES 4 VERSION 9 EUR 1ST SEC RES I03 CDS", 2454911, 2456829, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDR1", "ITRAXX", 4, "LevX", null, "IG", 9, 5, - null, 0.84, 50, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.5.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926966", "9656665", - "ITRAXX-LevXS5V9 - 1214", "iTraxx LevX Senior Series 5 Version 9", - "ITRAXX LEVX SENIOR SERIES 5 VERSION 9 EUR 1ST SEC RES I03 CDS", 2455096, 2457012, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDS9", "ITRAXX", 5, "LevX", null, "IG", 9, 5, - null, 0.8, 40, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.6.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926967", "9656555", - "ITRAXX-LevXS6V7 - 0615", "iTraxx LevX Senior Series 6 Version 7", - "ITRAXX LEVX SENIOR SERIES 6 VERSION 7 EUR 1ST SEC RES I03 CDS", 2455278, 2457194, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDT7", "ITRAXX", 6, "LevX", null, "IG", 7, 5, - null, 0.85, 40, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.7.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926975", "9493013", - "ITRAXX-XOVERS7V5 - 0614", "iTraxx Europe Crossover series 7 Version 5", - "ITRAXX-XOVERS7V5-0614 EUR SEN MMR I03 CDS", 2454180, 2456829, 0.0275, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBS6", "ITRAXX", 7, "XOVER", "XVR", "XO", 5, 7, - "245812", 0.9400000000000001, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.7Y.9.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926976", "8570728", - "ITRAXX-HIVOLS9V1 - 0615", "iTraxx Europe HiVol series 9 Version 1", - "ITRAXX-HIVOLS9V1-0615 EUR SEN MMR I03 CDS", 2454546, 2457194, 0.026500000000000003, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAI7", "ITRAXX", 9, "HIVOL", "VOL", "HV", 1, 7, - "236075", 1, 31, 0, "LON", true, true, true, null, "VOL")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.14.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926983", "9572543", - "LCDXNAS14V3 - 0615", "LCDX.NA.14", - "CDX_NA_LN_S14_100_98/100_CH", 2455278, 2457194, 0.025, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GES2", "LCDX", 14, "LCDXNA", null, "IG", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.15.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926984", "9599761", - "LCDXNAS15V2 - 1215", "LCDX.NA.15", - "CDX_NA_LN_S15_100_99/100_CH", 2455460, 2457377, 0.025, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GET0", "LCDX", 15, "LCDXNA", null, "IG", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.16.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926985", "9670242", - "LCDXNAS16V2 - 0616", "LCDX.NA.16", - "CDX_NA_LN_S16_100_99/100_CH", 2455642, 2457560, 0.025, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GEU7", "LCDX", 16, "LCDXNA", null, "IG", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.2.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926988", "9669789", - "ITRAXX-LevXS2V18 - 0613", "iTraxx LevX Senior Series 2 Version 18", - "ITRAXX LEVX SENIOR SERIES 2 VERSION 18 EUR 1ST SEC RES I03 CDS", 2454543, 2456464, 0.052500000000000005, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDU4", "ITRAXX", 2, "LevX", null, "IG", 18, 5, - null, 0.7732, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.3.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926989", "9669788", - "ITRAXX-LevXS3V17 - 1213", "iTraxx LevX Senior Series 3 Version 17", - "ITRAXX LEVX SENIOR SERIES 3 VERSION 17 EUR 1ST SEC RES I03 CDS", 2454739, 2456647, 0.0575, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDV2", "ITRAXX", 3, "LevX", null, "IG", 17, 5, - null, 0.7866, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.4.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926990", "9669785", - "ITRAXX-LevXS4V10 - 0614", "iTraxx LevX Senior Series 4 Version 10", - "ITRAXX LEVX SENIOR SERIES 4 VERSION 10 EUR 1ST SEC RES I03 CDS", 2454911, 2456829, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDW0", "ITRAXX", 4, "LevX", null, "IG", 10, 5, - null, 0.8200000000000001, 50, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.5.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926991", "9669841", - "ITRAXX-LevXS5V10 - 1214", "iTraxx LevX Senior Series 5 Version 10", - "ITRAXX LEVX SENIOR SERIES 5 VERSION 10 EUR 1ST SEC RES I03 CDS", 2455096, 2457012, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDX8", "ITRAXX", 5, "LevX", null, "IG", 10, 5, - null, 0.775, 40, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.6.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926992", "9669782", - "ITRAXX-LevXS6V8 - 0615", "iTraxx LevX Senior Series 6 Version 8", - "ITRAXX LEVX SENIOR SERIES 6 VERSION 8 EUR 1ST SEC RES I03 CDS", 2455278, 2457194, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDY6", "ITRAXX", 6, "LevX", null, "IG", 8, 5, - null, 0.8250000000000001, 40, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.2.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926994", "9669802", - "ITRAXX-LevXS2V19 - 0613", "iTraxx LevX Senior Series 2 Version 19", - "ITRAXX LEVX SENIOR SERIES 2 VERSION 19 EUR 1ST SEC RES I03 CDS", 2454543, 2456464, 0.052500000000000005, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDZ3", "ITRAXX", 2, "LevX", null, "IG", 19, 5, - null, 0.7598, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.3.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926996", "9669790", - "ITRAXX-LevXS3V18 - 1213", "iTraxx LevX Senior Series 3 Version 18", - "ITRAXX LEVX SENIOR SERIES 3 VERSION 18 EUR 1ST SEC RES I03 CDS", 2454739, 2456647, 0.0575, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJEM1", "ITRAXX", 3, "LevX", null, "IG", 18, 5, - null, 0.7732, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.4.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926997", "9669793", - "ITRAXX-LevXS4V11 - 0614", "iTraxx LevX Senior Series 4 Version 11", - "ITRAXX LEVX SENIOR SERIES 4 VERSION 11 EUR 1ST SEC RES I03 CDS", 2454911, 2456829, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJEN9", "ITRAXX", 4, "LevX", null, "IG", 11, 5, - null, 0.8, 50, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.5.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926998", "9669791", - "ITRAXX-LevXS5V11 - 1214", "iTraxx LevX Senior Series 5 Version 11", - "ITRAXX LEVX SENIOR SERIES 5 VERSION 11 EUR 1ST SEC RES I03 CDS", 2455096, 2457012, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJEP4", "ITRAXX", 5, "LevX", null, "IG", 11, 5, - null, 0.75, 40, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.6.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("926999", "9669819", - "ITRAXX-LevXS6V9 - 0615", "iTraxx LevX Senior Series 6 Version 9", - "ITRAXX LEVX SENIOR SERIES 6 VERSION 9 EUR 1ST SEC RES I03 CDS", 2455278, 2457194, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJER0", "ITRAXX", 6, "LevX", null, "IG", 9, 5, - null, 0.8, 40, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.1Y.16.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927000", "9671018", - "LCDXNAS16V2 - 0612", "LCDX.NA.16", - "CDX_NA_LN_S16_100_01YR_99/100", 2455642, 2456099, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GEU7", "LCDX", 16, "LCDXNA", null, "IG", 2, 1, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.3Y.16.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927001", "9671019", - "LCDXNAS16V2 - 0614", "LCDX.NA.16", - "CDX_NA_LN_S16 _100_03YR_99/100", 2455642, 2456829, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GEU7", "LCDX", 16, "LCDXNA", null, "IG", 2, 3, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDXNAS16V2 FXD.LCDXNAV2 FXD.5Y.16.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927002", "9671020", - "LCDXNAS16V2 FXD - 0616", "LCDX.NA.16", - "CDX_NA_LN_S16_100_FXD_99/100", 2455642, 2457560, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GEU7 FXD", "LCDXNAS16V2 FXD", 16, "LCDXNAV2 FXD", null, "IG", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.2Y.16.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927003", "9671021", - "LCDXNAS16V2 - 0613", "LCDX.NA.16", - "CDX_NA_LN_S16_100_02YR_99/100", 2455642, 2456464, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GEU7", "LCDX", 16, "LCDXNA", null, "IG", 2, 2, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.7Y.16.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927004", "9671023", - "LCDXNAS16V2 - 0618", "LCDX.NA.16", - "CDX_NA_LN_S16_100_07YR_99/100", 2455642, 2458290, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GEU7", "LCDX", 16, "LCDXNA", null, "IG", 2, 7, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet40() - { - UpdateCDXRefDataMap ("LCDX.LCDXNA.10Y.16.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927005", "9671024", - "LCDXNAS16V2 - 0621", "LCDX.NA.16", - "CDX_NA_LN_S16_100_10YR_99/100", 2455642, 2459386, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GEU7", "LCDX", 16, "LCDXNA", null, "IG", 2, 10, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.4Y.16.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927006", "9671025", - "LCDXNAS16V2 - 0615", "LCDX.NA.16", - "CDX_NA_LN_S16_100_04YR_99/100", 2455642, 2457194, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GEU7", "LCDX", 16, "LCDXNA", null, "IG", 2, 4, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.6Y.16.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927007", "9671026", - "LCDXNAS16V2 - 0617", "LCDX.NA.16", - "CDX_NA_LN_S16_100_06YR_99/100", 2455642, 2457925, 0.025, "USD", - "ACT/360", false, 0.4, 4, "5F199GEU7", "LCDX", 16, "LCDXNA", null, "IG", 2, 6, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.9.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927013", "18", - "CDX-NAHYS9V19 - 1217", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_10YR_85/100", 2454372, 2458108, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHO1", "CDX", 9, "NA HY", null, "HY", 19, 10, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.5.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927015", "4", - "CDX-NAHYS5V19 - 1212", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_07YR_84/100", 2453651, 2456282, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BREW6", "CDX", 5, "NA HY", null, "HY", 19, 7, - null, 0.84, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.6.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927016", "5", - "CDX-NAHYS6V17 - 0616", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_10YR_86/100", 2453823, 2457560, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFF2", "CDX", 6, "NA HY", null, "HY", 17, 10, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.6.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927018", "6", - "CDX-NAHYS6V17 - 0613", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_07YR_86/100", 2453823, 2456464, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRFF2", "CDX", 6, "NA HY", null, "HY", 17, 7, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.7.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927019", "8", - "CDX-NAHYBS7V8 - 1211", "Dow Jones CDX.NA.HY.B.7", - "CDX_NA_HY_S07_B___SWP_43/50", 2454007, 2455917, 0.030000000000000002, "USD", - "ACT/360", false, 0.3, 4, "2I65BSBP2", "CDX", 7, "NA HY B", null, "HY", 8, 5, - null, 0.86, 50, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.7.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927020", "9", - "CDX-NAHYS7V17 - 1213", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_07YR_86/100", 2454007, 2456647, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGX2", "CDX", 7, "NA HY", null, "HY", 17, 7, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.7.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927021", "10", - "CDX-NAHYS7V17 - 1216", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_10YR_86/100", 2454007, 2457743, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGX2", "CDX", 7, "NA HY", null, "HY", 17, 10, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.7.17", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927022", "11", - "CDX-NAHYS7V17 - 1211", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_86/100", 2454007, 2455917, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRGX2", "CDX", 7, "NA HY", null, "HY", 17, 5, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.8.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927023", "12", - "CDX-NAHYS8V18 - 0614", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_07YR_86/100", 2454188, 2456829, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHN3", "CDX", 8, "NA HY", null, "HY", 18, 7, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.8.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927024", "13", - "CDX-NAHYS8V18 - 0612", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_86/100", 2454188, 2456099, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHN3", "CDX", 8, "NA HY", null, "HY", 18, 5, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.8.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927025", "14", - "CDX-NAHYS8V18 - 0617", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_10YR_86/100", 2454188, 2457925, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHN3", "CDX", 8, "NA HY", null, "HY", 18, 10, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.9.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927026", "16", - "CDX-NAHYBS9V11 - 1212", "CDX.NA.HY.B.9", - "CDX_NA_HY_S09_B___SWP_36/46", 2454372, 2456282, 0.035, "USD", - "ACT/360", false, 0.3, 4, "2I65BSBQ0", "CDX", 9, "NA HY B", null, "HY", 11, 5, - null, 0.78261, 46, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.9.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927027", "17", - "CDX-NAHYS9V19 - 1214", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_07YR_85/100", 2454372, 2457012, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHO1", "CDX", 9, "NA HY", null, "HY", 19, 7, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.15.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927029", "65", - "CDX-NAHYS15V2 - 1217", "CDX.NA.HY.15", - "CDX_NA_HY_S15_100_SWP_07YR_99/100", 2455460, 2458108, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHU7", "CDX", 15, "NA HY", null, "HY", 2, 7, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.15.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927030", "66", - "CDX-NAHYS15V2 - 1220", "CDX.NA.HY.15", - "CDX_NA_HY_S15_100_SWP_10YR_99/100", 2455460, 2459204, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHU7", "CDX", 15, "NA HY", null, "HY", 2, 10, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.15.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927031", "68", - "CDX-NAHYS15V2 - 1215", "CDX.NA.HY.15", - "CDX_NA_HY_S15_100_SWP_99/100", 2455460, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHU7", "CDX", 15, "NA HY", null, "HY", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.15.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927033", "71", - "CDX-NAHYS15V2 - 1213", "CDX.NA.HY.15", - "CDX_NA_HY_S15_100_SWP_03YR_99/100", 2455460, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHU7", "CDX", 15, "NA HY", null, "HY", 2, 3, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.16.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927034", "9670017", - "CDX-NAHYS16V2 - 0616", "CDX.NA.HY.16", - "CDX_NA_HY_S16_100_SWP_99/100", 2455642, 2457560, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHV5", "CDX", 16, "NA HY", null, "HY", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.16.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927035", "73", - "CDX-NAHYS16V2 - 0614", "CDX.NA.HY.16", - "CDX_NA_HY_S16_100_SWP_03YR_99/100", 2455642, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHV5", "CDX", 16, "NA HY", null, "HY", 2, 3, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.16.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927036", "74", - "CDX-NAHYS16V2 - 0618", "CDX.NA.HY.16", - "CDX_NA_HY_S16_100_SWP_07YR_99/100", 2455642, 2458290, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHV5", "CDX", 16, "NA HY", null, "HY", 2, 7, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.16.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927037", "75", - "CDX-NAHYS16V2 - 0621", "CDX.NA.HY.16", - "CDX_NA_HY_S16_100_SWP_10YR_99/100", 2455642, 2459386, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHV5", "CDX", 16, "NA HY", null, "HY", 2, 10, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.17.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927038", "9670020", - "CDX-NAHYS17V2 - 1216", "CDX.NA.HY.17", - "CDX_NA_HY_S17_100_SWP_99/100", 2455825, 2457743, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHW3", "CDX", 17, "NA HY", null, "HY", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.9.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927039", "20", - "CDX-NAHYS9V19 - 1212", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_85/100", 2454372, 2456282, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHO1", "CDX", 9, "NA HY", null, "HY", 19, 5, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.17.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927040", "81", - "CDX-NAHYS17V2 - 1214", "CDX.NA.HY.17", - "CDX_NA_HY_S17_100_SWP_03YR_99/100", 2455825, 2457012, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHW3", "CDX", 17, "NA HY", null, "HY", 2, 3, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.10.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927041", "23", - "CDX-NAHYBS10V9 - 0613", "CDX.NA.HY.B.10", - "CDX_NA_HY_S10_B___SWP_37/45", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSBR8", "CDX", 10, "NA HY B", null, "HY", 9, 5, - null, 0.82223, 45, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.10.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927042", "24", - "CDX-NAHYS10V18 - 0615", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_07YR_86/100", 2454554, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHP8", "CDX", 10, "NA HY", null, "HY", 18, 7, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.10.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927043", "25", - "CDX-NAHYS10V18 - 0618", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_10YR_86/100", 2454554, 2458290, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHP8", "CDX", 10, "NA HY", null, "HY", 18, 10, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.10.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927045", "26", - "CDX-NAHYS10V18 - 0613", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_86/100", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHP8", "CDX", 10, "NA HY", null, "HY", 18, 5, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.17.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927046", "82", - "CDX-NAHYS17V2 - 1218", "CDX.NA.HY.17", - "CDX_NA_HY_S17_100_SWP_07YR_99/100", 2455825, 2458473, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHW3", "CDX", 17, "NA HY", null, "HY", 2, 7, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.11.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927047", "30", - "CDX-NAHYBS11V7 - 1213", "CDX.NA.HY.B.11", - "CDX_NA_HY_S11_B___SWP_30/36", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSBS6", "CDX", 11, "NA HY B", null, "HY", 7, 5, - null, 0.8333499999999999, 36, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.17.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927048", "83", - "CDX-NAHYS17V2 - 1221", "CDX.NA.HY.17", - "CDX_NA_HY_S17_100_SWP_10YR_99/100", 2455825, 2459569, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHW3", "CDX", 17, "NA HY", null, "HY", 2, 10, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.11.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927049", "31", - "CDX-NAHYS11V18 - 1213", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_86/100", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHQ6", "CDX", 11, "NA HY", null, "HY", 18, 5, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.11.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927050", "32", - "CDX-NAHYS11V18 - 1211", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_03YR_86/100", 2454738, 2455917, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHQ6", "CDX", 11, "NA HY", null, "HY", 18, 3, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.15.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927051", "67", - "CDX-NAHYBS15V2 - 1215", "CDX.NA.HY.B.15", - "CDX_NA_HY_S15_B___SWP_29/30", 2455460, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSBW7", "CDX", 15, "NA HY B", null, "HY", 2, 5, - null, 0.96667, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.12.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927052", "38", - "CDX-NAHYBS12V2 - 0614", "CDX.NA.HY.B.12", - "CDX_NA_HY_S12_B___SWP_34/35", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSBT4", "CDX", 12, "NA HY B", null, "HY", 2, 5, - null, 0.97143, 35, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.11.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927053", "33", - "CDX-NAHYS11V18 - 1215", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_07YR_86/100", 2454738, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHQ6", "CDX", 11, "NA HY", null, "HY", 18, 7, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.11.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927054", "34", - "CDX-NAHYS11V18 - 1218", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_10YR_86/100", 2454738, 2458473, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHQ6", "CDX", 11, "NA HY", null, "HY", 18, 10, - null, 0.86, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.12.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927055", "39", - "CDX-NAHYS12V9 - 0614", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_93/100", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHR4", "CDX", 12, "NA HY", null, "HY", 9, 5, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.12.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927056", "41", - "CDX-NAHYS12V9 - 0619", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_10YR_93/100", 2454911, 2458655, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHR4", "CDX", 12, "NA HY", null, "HY", 9, 10, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.12.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927057", "40", - "CDX-NAHYS12V9 - 0616", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_07YR_93/100", 2454911, 2457560, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHR4", "CDX", 12, "NA HY", null, "HY", 9, 7, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.12.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927058", "42", - "CDX-NAHYS12V9 - 0612", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_03YR_93/100", 2454911, 2456099, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHR4", "CDX", 12, "NA HY", null, "HY", 9, 3, - null, 0.93, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.13.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927059", "46", - "CDX-NAHYBS13V2 - 1214", "CDX.NA.HY.B.13", - "CDX_NA_HY_S13_B___SWP_28/29", 2455096, 2457012, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSBU1", "CDX", 13, "NA HY B", null, "HY", 2, 5, - null, 0.96552, 29, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.13.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927060", "47", - "CDX-NAHYS13V3 - 1214", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_98/100", 2455096, 2457012, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHS2", "CDX", 13, "NA HY", null, "HY", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.13.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927061", "48", - "CDX-NAHYS13V3 - 1212", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_03YR_98/100", 2455096, 2456282, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHS2", "CDX", 13, "NA HY", null, "HY", 3, 3, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.13.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927062", "49", - "CDX-NAHYS13V3 - 1216", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_07YR_98/100", 2455096, 2457743, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHS2", "CDX", 13, "NA HY", null, "HY", 3, 7, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.13.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927063", "50", - "CDX-NAHYS13V3 - 1219", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_10YR_98/100", 2455096, 2458838, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHS2", "CDX", 13, "NA HY", null, "HY", 3, 10, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.14.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927064", "55", - "CDX-NAHYS14V2 - 0615", "CDX.NA.HY.14", - "CDX_NA_HY_S14_100_SWP_99/100", 2455278, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHT0", "CDX", 14, "NA HY", null, "HY", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.14.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927065", "57", - "CDX-NAHYS14V2 - 0613", "CDX.NA.HY.14", - "CDX_NA_HY_S14_100_SWP_03YR_99/100", 2455278, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHT0", "CDX", 14, "NA HY", null, "HY", 2, 3, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.14.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927066", "59", - "CDX-NAHYBS14V2 - 0615", "CDX.NA.HY.B.14", - "CDX_NA_HY_S14_B___SWP_33/34", 2455278, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSBV9", "CDX", 14, "NA HY B", null, "HY", 2, 5, - null, 0.97059, 34, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.14.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927067", "62", - "CDX-NAHYS14V2 - 0617", "CDX.NA.HY.14", - "CDX_NA_HY_S14_100_SWP_07YR_99/100", 2455278, 2457925, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHT0", "CDX", 14, "NA HY", null, "HY", 2, 7, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.14.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927068", "63", - "CDX-NAHYS14V2 - 0620", "CDX.NA.HY.14", - "CDX_NA_HY_S14_100_SWP_10YR_99/100", 2455278, 2459021, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHT0", "CDX", 14, "NA HY", null, "HY", 2, 10, - null, 0.99, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.5.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927071", "3", - "CDX-NAHYS5V19 - 1215", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_10YR_84/100", 2453651, 2457377, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BREW6", "CDX", 5, "NA HY", null, "HY", 19, 10, - null, 0.84, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.2.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927080", "4477", - "ITRAXX-LevXS2V20 - 0613", "iTraxx LevX Senior Series 2 Version 20", - "ITRAXX LEVX SENIOR SERIES 2 VERSION 20 EUR 1ST SEC RES I03 CDS", 2454543, 2456464, 0.052500000000000005, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJDO8", "ITRAXX", 2, "LevX", null, "IG", 20, 5, - null, 0.7464000000000001, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.3.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927081", "4476", - "ITRAXX-LevXS3V19 - 1213", "iTraxx LevX Senior Series 3 Version 19", - "ITRAXX LEVX SENIOR SERIES 3 VERSION 19 EUR 1ST SEC RES I03 CDS", 2454739, 2456647, 0.0575, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJEI0", "ITRAXX", 3, "LevX", null, "IG", 19, 5, - null, 0.7598, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.4.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927082", "4386", - "ITRAXX-LevXS4V12 - 0614", "iTraxx LevX Senior Series 4 Version 12", - "ITRAXX LEVX SENIOR SERIES 4 VERSION 12 EUR 1ST SEC RES I03 CDS", 2454911, 2456829, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJEK5", "ITRAXX", 4, "LevX", null, "IG", 12, 5, - null, 0.78, 50, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.16.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927085", "6581", - "CDX-NAHYS16V3 - 0616", "CDX.NA.HY.16", - "CDX_NA_HY_S16_100_SWP_98/100", 2455642, 2457560, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHX1", "CDX", 16, "NA HY", null, "HY", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.16.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927086", "6644", - "CDX-NAHYS16V3 - 0614", "CDX.NA.HY.16", - "CDX_NA_HY_S16_100_SWP_03YR_98/100", 2455642, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHX1", "CDX", 16, "NA HY", null, "HY", 3, 3, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.16.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927087", "6669", - "CDX-NAHYS16V3 - 0618", "CDX.NA.HY.16", - "CDX_NA_HY_S16_100_SWP_07YR_98/100", 2455642, 2458290, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHX1", "CDX", 16, "NA HY", null, "HY", 3, 7, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.16.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927088", "6595", - "CDX-NAHYS16V3 - 0621", "CDX.NA.HY.16", - "CDX_NA_HY_S16_100_SWP_10YR_98/100", 2455642, 2459386, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHX1", "CDX", 16, "NA HY", null, "HY", 3, 10, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.17.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927089", "6641", - "CDX-NAHYS17V3 - 1216", "CDX.NA.HY.17", - "CDX_NA_HY_S17_100_SWP_98/100", 2455825, 2457743, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHY9", "CDX", 17, "NA HY", null, "HY", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.17.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927090", "6663", - "CDX-NAHYS17V3 - 1214", "CDX.NA.HY.17", - "CDX_NA_HY_S17_100_SWP_03YR_98/100", 2455825, 2457012, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHY9", "CDX", 17, "NA HY", null, "HY", 3, 3, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.17.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927091", "6668", - "CDX-NAHYS17V3 - 1218", "CDX.NA.HY.17", - "CDX_NA_HY_S17_100_SWP_07YR_98/100", 2455825, 2458473, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHY9", "CDX", 17, "NA HY", null, "HY", 3, 7, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.17.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927092", "7044", - "CDX-NAHYS17V3 - 1221", "CDX.NA.HY.17", - "CDX_NA_HY_S17_100_SWP_10YR_98/100", 2455825, 2459569, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRHY9", "CDX", 17, "NA HY", null, "HY", 3, 10, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.14.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927100", "9977", - "ITRAXX-XOVERS14V2 - 1220", "iTraxx Europe Crossover series 14 Version 2", - "ITRAXX-XOVERS14V2-1220 EUR SEN MMR I03 CDS", 2455460, 2459204, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCM8", "ITRAXX", 14, "XOVER", "XVR", "XO", 2, 10, - "246831", 0.98, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.11.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927101", "9955", - "ITRAXX-XOVERS11V3 - 0612", "iTraxx Europe Crossover series 11 Version 3", - "ITRAXX-XOVERS11V3-0612 EUR SEN MMR I03 CDS", 2454911, 2456099, 0.11, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCJ5", "ITRAXX", 11, "XOVER", "XVR", "XO", 3, 3, - "246827", 0.9556, 45, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.1.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927102", "9919", - "ITRAXX-XOVERS1V3 - 0914", "iTraxx Europe Crossover series 1 Version 3", - "ITRAXX-XOVERS1V3-0914 EUR SEN MMR I03 CDS", 2453179, 2456921, 0.0315, "EUR", - "ACT/360", false, 0.4, 4, "2I667KBZ0", "ITRAXX", 1, "XOVER", "XVR", "XO", 3, 10, - "246835", 0.9667, 31, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.7.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927103", "9930", - "ITRAXX-XOVERS7V6 - 0612", "iTraxx Europe Crossover series 7 Version 6", - "ITRAXX-XOVERS7V6-0612 EUR SEN MMR I03 CDS", 2454180, 2456099, 0.023, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCF3", "ITRAXX", 7, "XOVER", "XVR", "XO", 6, 5, - "246823", 0.92, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.2.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927104", "9921", - "ITRAXX-XOVERS2V3 - 0315", "Itraxx Europe Crossover Series 2 VERSION 3", - "ITRAXX-XOVERS2V3-0315 EUR SEN MMR I03 CDS", 2453269, 2457102, 0.029500000000000002, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCA4", "ITRAXX", 2, "XOVER", "XVR", "XO", 3, 10, - "246834", 0.9667, 31, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.3.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927105", "9922", - "ITRAXX-XOVERS3V5 - 0615", "iTraxx Europe Crossover Series 3 VERSION 5", - "ITRAXX-XOVERS3V5-0615 EUR SEN MMR I03 CDS", 2453451, 2457194, 0.026000000000000002, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCB2", "ITRAXX", 3, "XOVER", "XVR", "XO", 5, 10, - "246833", 0.943, 36, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.11.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927106", "9956", - "ITRAXX-XOVERS11V3 - 0614", "iTraxx Europe Crossover series 11 Version 3", - "ITRAXX-XOVERS11V3-0614 EUR SEN MMR I03 CDS", 2454911, 2456829, 0.0975, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCJ5", "ITRAXX", 11, "XOVER", "XVR", "XO", 3, 5, - "246827", 0.9556, 45, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.7.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927107", "9931", - "ITRAXX-XOVERS7V6 - 0617", "iTraxx Europe Crossover series 7 Version 6", - "ITRAXX-XOVERS7V6-0617 EUR SEN MMR I03 CDS", 2454180, 2457925, 0.032, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCF3", "ITRAXX", 7, "XOVER", "XVR", "XO", 6, 10, - "246823", 0.92, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.4.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927108", "9923", - "ITRAXX-XOVERS4V5 - 1215", "iTraxx Europe Crossover Series 4 Version 5", - "ITRAXX-XOVERS4V5-1215 EUR SEN MMR I03 CDS", 2453634, 2457377, 0.0345, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCC0", "ITRAXX", 4, "XOVER", "XVR", "XO", 5, 10, - "246832", 0.925, 41, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.5.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927109", "9924", - "ITRAXX-XOVERS5V5 - 0616", "iTraxx Europe Crossover Series 5 Version 5", - "ITRAXX-XOVERS5V5-0616 EUR SEN MMR I03 CDS", 2453815, 2457560, 0.035, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCD8", "ITRAXX", 5, "XOVER", "XVR", "XO", 5, 10, - "246830", 0.9333, 45, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.13.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927110", "9966", - "ITRAXX-XOVERS13V3 - 0615", "iTraxx Europe Crossover series 13 Version 3", - "ITRAXX-XOVERS13V3-0615 EUR SEN MMR I03 CDS", 2455278, 2457194, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCL0", "ITRAXX", 13, "XOVER", "XVR", "XO", 3, 5, - "246829", 0.98, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.7.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927111", "9932", - "USD ITRAXX-XOVERS7V6 - 0612", "iTraxx Europe Crossover series 7 Version 6", - "ITRAXX-XOVERS7V6-0612 USD SEN MMR I03 CDS", 2454180, 2456099, 0.023, "USD", - "ACT/360", false, 0.4, 4, "2I667KCF3", "USD ITRAXX", 7, "XOVER", "XVR", "XO", 6, 5, - null, 0.92, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.6.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927112", "9925", - "ITRAXX-XOVERS6V5 - 1211", "iTraxx Europe Crossover series 6 Version 5", - "ITRAXX-XOVERS6V5-1211 EUR SEN MMR I03 CDS", 2453999, 2455917, 0.028, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCE6", "ITRAXX", 6, "XOVER", "XVR", "XO", 5, 5, - "246822", 0.9333, 45, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.8.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927113", "9933", - "ITRAXX-XOVERS8V7 - 1212", "iTraxx Europe Crossover series 8 Version 7", - "ITRAXX-XOVERS8V7-1212 EUR SEN MMR I03 CDS", 2454364, 2456282, 0.0375, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCG1", "ITRAXX", 8, "XOVER", "XVR", "XO", 7, 5, - "246824", 0.9, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.6.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927114", "9926", - "ITRAXX-XOVERS6V5 - 1216", "iTraxx Europe Crossover series 6 Version 5", - "ITRAXX-XOVERS6V5-1216 EUR SEN MMR I03 CDS", 2453999, 2457743, 0.0345, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCE6", "ITRAXX", 6, "XOVER", "XVR", "XO", 5, 10, - "246822", 0.9333, 45, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.8.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927115", "9934", - "ITRAXX-XOVERS8V7 - 1217", "iTraxx Europe Crossover series 8 Version 7", - "ITRAXX-XOVERS8V7-1217 EUR SEN MMR I03 CDS", 2454364, 2458108, 0.046, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCG1", "ITRAXX", 8, "XOVER", "XVR", "XO", 7, 10, - "246824", 0.9, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.13.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927116", "9967", - "ITRAXX-XOVERS13V3 - 0617", "iTraxx Europe Crossover series 13 Version 3", - "ITRAXX-XOVERS13V3-0617 EUR SEN MMR I03 CDS", 2455278, 2457925, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCL0", "ITRAXX", 13, "XOVER", "XVR", "XO", 3, 7, - "246829", 0.98, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.11.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927117", "9957", - "ITRAXX-XOVERS11V3 - 0616", "iTraxx Europe Crossover series 11 Version 3", - "ITRAXX-XOVERS11V3-0616 EUR SEN MMR I03 CDS", 2454911, 2457560, 0.08800000000000001, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCJ5", "ITRAXX", 11, "XOVER", "XVR", "XO", 3, 7, - "246827", 0.9556, 45, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.6.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927118", "9927", - "USD ITRAXX-XOVERS6V5 - 1211", "iTraxx Europe Crossover series 6 Version 5", - "ITRAXX-XOVERS6V5-1211 USD SEN MMR I03 CDS", 2453999, 2455917, 0.028, "USD", - "ACT/360", false, 0.4, 4, "2I667KCE6", "USD ITRAXX", 6, "XOVER", "XVR", "XO", 5, 5, - null, 0.9333, 45, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.8.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927119", "9935", - "USD ITRAXX-XOVERS8V7 - 1212", "iTraxx Europe Crossover series 8 Version 7", - "ITRAXX-XOVERS8V7-1212 USD SEN MMR I03 CDS", 2454364, 2456282, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I667KCG1", "USD ITRAXX", 8, "XOVER", "XVR", "XO", 7, 5, - null, 0.9, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.7.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927120", "9929", - "ITRAXX-XOVERS7V6 - 0614", "iTraxx Europe Crossover series 7 Version 6", - "ITRAXX-XOVERS7V6-0614 EUR SEN MMR I03 CDS", 2454180, 2456829, 0.0275, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCF3", "ITRAXX", 7, "XOVER", "XVR", "XO", 6, 7, - "246823", 0.92, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.12.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927121", "9958", - "ITRAXX-XOVERS12V3 - 1212", "iTraxx Europe Crossover series 12 VERSION 3", - "ITRAXX-XOVERS12V3-1212 EUR SEN MMR I03 CDS", 2455096, 2456282, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCK2", "ITRAXX", 12, "XOVER", "XVR", "XO", 3, 3, - "246828", 0.98, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.8.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927122", "9936", - "ITRAXX-XOVERS8V7 - 1214", "iTraxx Europe Crossover series 8 Version 7", - "ITRAXX-XOVERS8V7-1214 EUR SEN MMR I03 CDS", 2454364, 2457012, 0.039, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCG1", "ITRAXX", 8, "XOVER", "XVR", "XO", 7, 7, - "246824", 0.9, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.12.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927123", "9959", - "ITRAXX-XOVERS12V3 - 1214", "iTraxx Europe Crossover series 12 Version 3", - "ITRAXX-XOVERS12V3-1214 EUR SEN MMR I03 CDS", 2455096, 2457012, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCK2", "ITRAXX", 12, "XOVER", "XVR", "XO", 3, 5, - "246828", 0.98, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.9.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927124", "9939", - "ITRAXX-XOVERS9V7 - 0613", "iTraxx Europe Crossover series 9 Version 7", - "ITRAXX-XOVERS9V7-0613 EUR SEN MMR I03 CDS", 2454546, 2456464, 0.065, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCH9", "ITRAXX", 9, "XOVER", "XVR", "XO", 7, 5, - "246825", 0.9, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.12.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927125", "9960", - "ITRAXX-XOVERS12V3 - 1216", "iTraxx Europe Crossover series 12 Version 3", - "ITRAXX-XOVERS12V3-1216 EUR SEN MMR I03 CDS", 2455096, 2457743, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCK2", "ITRAXX", 12, "XOVER", "XVR", "XO", 3, 7, - "246828", 0.98, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.13.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927126", "9968", - "ITRAXX-XOVERS13V3 - 0620", "iTraxx Europe Crossover series 13 Version 3", - "ITRAXX-XOVERS13V3-0620 EUR SEN MMR I03 CDS", 2455278, 2459021, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCL0", "ITRAXX", 13, "XOVER", "XVR", "XO", 3, 10, - "246829", 0.98, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.9.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927127", "9940", - "ITRAXX-XOVERS9V7 - 0615", "iTraxx Europe Crossover series 9 Version 7", - "ITRAXX-XOVERS9V7-0615 EUR SEN MMR I03 CDS", 2454546, 2457194, 0.0645, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCH9", "ITRAXX", 9, "XOVER", "XVR", "XO", 7, 7, - "246825", 0.9, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.9.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927128", "9942", - "USD ITRAXX-XOVERS9V7 - 0613", "iTraxx Europe Crossover series 9 Version 7", - "ITRAXX-XOVERS9V7-0613 USD SEN MMR I03 CDS", 2454546, 2456464, 0.065, "USD", - "ACT/360", false, 0.4, 4, "2I667KCH9", "USD ITRAXX", 9, "XOVER", "XVR", "XO", 7, 5, - null, 0.9, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.12.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927129", "9961", - "ITRAXX-XOVERS12V3 - 1219", "iTraxx Europe Crossover series 12 Version 3", - "ITRAXX-XOVERS12V3-1219 EUR SEN MMR I03 CDS", 2455096, 2458838, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCK2", "ITRAXX", 12, "XOVER", "XVR", "XO", 3, 10, - "246828", 0.98, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.9.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927130", "9941", - "ITRAXX-XOVERS9V7 - 0618", "iTraxx Europe Crossover series 9 Version 7", - "ITRAXX-XOVERS9V7-0618 EUR SEN MMR I03 CDS", 2454546, 2458290, 0.064, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCH9", "ITRAXX", 9, "XOVER", "XVR", "XO", 7, 10, - "246825", 0.9, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.13.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927131", "9969", - "USD ITRAXX-XOVERS13V3 - 0615", "iTraxx Europe Crossover series 13 Version 3", - "ITRAXX-XOVERS13V3-0615 USD SEN MMR I03 CDS", 2455278, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KCL0", "USD ITRAXX", 13, "XOVER", "XVR", "XO", 3, 5, - null, 0.98, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927132", "9944", - "ITRAXX-XOVERS10V6 - 1215", "iTraxx Europe Crossover series 10 Version 6", - "ITRAXX-XOVERS10V6-1215 EUR SEN MMR I03 CDS", 2454739, 2457377, 0.055, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCI7", "ITRAXX", 10, "XOVER", "XVR", "XO", 6, 7, - "246826", 0.92, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.12.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927133", "9963", - "USD ITRAXX-XOVERS12V3 - 1214", "iTraxx Europe Crossover series 12 Version 3", - "ITRAXX-XOVERS12V3-1214 USD SEN MMR I03 CDS", 2455096, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KCK2", "USD ITRAXX", 12, "XOVER", "XVR", "XO", 3, 5, - null, 0.98, 51, 0, "LON", false, false, true, null, "XVR")); - - return true; - } - - private static final boolean InitCDXRefDataSet41() - { - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.13.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927134", "9971", - "USD ITRAXX-XOVERS13V3 - 0620", "iTraxx Europe Crossover series 13 Version 3", - "ITRAXX-XOVERS13V3-0620 USD SEN MMR I03 CDS", 2455278, 2459021, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KCL0", "USD ITRAXX", 13, "XOVER", "XVR", "XO", 3, 10, - null, 0.98, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927135", "9945", - "ITRAXX-XOVERS10V6 - 1218", "iTraxx Europe Crossover series 10 Version 6", - "ITRAXX-XOVERS10V6-1218 EUR SEN MMR I03 CDS", 2454739, 2458473, 0.054, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCI7", "ITRAXX", 10, "XOVER", "XVR", "XO", 6, 10, - "246826", 0.92, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.12.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927136", "9964", - "USD ITRAXX-XOVERS12V3 - 1219", "iTraxx Europe Crossover series 12 Version 3", - "ITRAXX-XOVERS12V3-1219 USD SEN MMR I03 CDS", 2455096, 2458838, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KCK2", "USD ITRAXX", 12, "XOVER", "XVR", "XO", 3, 10, - null, 0.98, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927137", "9947", - "USD ITRAXX-XOVERS10V6 - 1213", "iTraxx Europe Crossover series 10 Version 6", - "ITRAXX-XOVERS10V6-1213 USD SEN MMR I03 CDS", 2454739, 2456647, 0.056, "USD", - "ACT/360", false, 0.4, 4, "2I667KCI7", "USD ITRAXX", 10, "XOVER", "XVR", "XO", 6, 5, - null, 0.92, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.14.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927138", "9972", - "USD ITRAXX-XOVERS14V2 - 1215", "iTraxx Europe Crossover series 14 Version 2", - "ITRAXX-XOVERS14V2-1215 USD SEN MMR I03 CDS", 2455460, 2457377, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KCM8", "USD ITRAXX", 14, "XOVER", "XVR", "XO", 2, 5, - null, 0.98, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927139", "9948", - "ITRAXX-XOVERS10V6 - 1211", "iTraxx Europe Crossover series 10 Version 6", - "ITRAXX-XOVERS10V6-1211 EUR SEN MMR I03 CDS", 2454739, 2455916, 0.053000000000000005, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCI7", "ITRAXX", 10, "XOVER", "XVR", "XO", 6, 3, - "246826", 0.92, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.13.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927140", "9965", - "ITRAXX-XOVERS13V3 - 0613", "iTraxx Europe Crossover series 13 Version 3", - "ITRAXX-XOVERS13V3-0613 EUR SEN MMR I03 CDS", 2455278, 2456464, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCL0", "ITRAXX", 13, "XOVER", "XVR", "XO", 3, 3, - "246829", 0.98, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.14.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927141", "9973", - "USD ITRAXX-XOVERS14V2 - 1220", "iTraxx Europe Crossover series 14 Version 2", - "ITRAXX-XOVERS14V2-1220 USD SEN MMR I03 CDS", 2455460, 2459204, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KCM8", "USD ITRAXX", 14, "XOVER", "XVR", "XO", 2, 10, - null, 0.98, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927142", "9949", - "ITRAXX-XOVERS10V6 - 1213", "iTraxx Europe Crossover series 10 Version 6", - "ITRAXX-XOVERS10V6-1213 EUR SEN MMR I03 CDS", 2454739, 2456647, 0.056, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCI7", "ITRAXX", 10, "XOVER", "XVR", "XO", 6, 5, - "246826", 0.92, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.14.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927143", "9974", - "ITRAXX-XOVERS14V2 - 1213", "iTraxx Europe Crossover series 14 Version 2", - "ITRAXX-XOVERS14V2-1213 EUR SEN MMR I03 CDS", 2455460, 2456647, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCM8", "ITRAXX", 14, "XOVER", "XVR", "XO", 2, 3, - "246831", 0.98, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.10.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927144", "9950", - "USD ITRAXX-XOVERS10V6 - 1218", "iTraxx Europe Crossover series 10 Version 6", - "ITRAXX-XOVERS10V6-1218 USD SEN MMR I03 CDS", 2454739, 2458473, 0.054, "USD", - "ACT/360", false, 0.4, 4, "2I667KCI7", "USD ITRAXX", 10, "XOVER", "XVR", "XO", 6, 10, - null, 0.92, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.14.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927145", "9975", - "ITRAXX-XOVERS14V2 - 1215", "iTraxx Europe Crossover series 14 Version 2", - "ITRAXX-XOVERS14V2-1215 EUR SEN MMR I03 CDS", 2455460, 2457377, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCM8", "ITRAXX", 14, "XOVER", "XVR", "XO", 2, 5, - "246831", 0.98, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.11.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927146", "9951", - "ITRAXX-XOVERS11V3 - 0619", "iTraxx Europe Crossover series 11 Version 3", - "ITRAXX-XOVERS11V3-0619 EUR SEN MMR I03 CDS", 2454911, 2458655, 0.082, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCJ5", "ITRAXX", 11, "XOVER", "XVR", "XO", 3, 10, - "246827", 0.9556, 45, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.14.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927147", "9976", - "ITRAXX-XOVERS14V2 - 1217", "iTraxx Europe Crossover series 14 Version 2", - "ITRAXX-XOVERS14V2-1217 EUR SEN MMR I03 CDS", 2455460, 2458108, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCM8", "ITRAXX", 14, "XOVER", "XVR", "XO", 2, 7, - "246831", 0.98, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.11.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927148", "9952", - "USD ITRAXX-XOVERS11V3 - 0614", "iTraxx Europe Crossover series 11 Version 3", - "ITRAXX-XOVERS11V3-0614 USD SEN MMR I03 CDS", 2454911, 2456829, 0.0975, "USD", - "ACT/360", false, 0.4, 4, "2I667KCJ5", "USD ITRAXX", 11, "XOVER", "XVR", "XO", 3, 5, - null, 0.9556, 45, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.11.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927149", "9953", - "USD ITRAXX-XOVERS11V3 - 0619", "iTraxx Europe Crossover series 11 Version 3", - "ITRAXX-XOVERS11V3-0619 USD SEN MMR I03 CDS", 2454911, 2458655, 0.082, "USD", - "ACT/360", false, 0.4, 4, "2I667KCJ5", "USD ITRAXX", 11, "XOVER", "XVR", "XO", 3, 10, - null, 0.9556, 45, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.15.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927152", "9880", - "CDX-NAHYS15V3 - 1213", "CDX.NA.HY.15", - "CDX_NA_HY_S15_100_SWP_03YR_98/100", 2455460, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIN2", "CDX", 15, "NA HY", null, "HY", 3, 3, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.15.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927153", "9877", - "CDX-NAHYS15V3 - 1215", "CDX.NA.HY.15", - "CDX_NA_HY_S15_100_SWP_98/100", 2455460, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIN2", "CDX", 15, "NA HY", null, "HY", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.15.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927154", "9876", - "CDX-NAHYS15V3 - 1220", "CDX.NA.HY.15", - "CDX_NA_HY_S15_100_SWP_10YR_98/100", 2455460, 2459204, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIN2", "CDX", 15, "NA HY", null, "HY", 3, 10, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.15.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927155", "9875", - "CDX-NAHYS15V3 - 1217", "CDX.NA.HY.15", - "CDX_NA_HY_S15_100_SWP_07YR_98/100", 2455460, 2458108, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIN2", "CDX", 15, "NA HY", null, "HY", 3, 7, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.14.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927156", "9872", - "CDX-NAHYS14V3 - 0620", "CDX.NA.HY.14", - "CDX_NA_HY_S14_100_SWP_10YR_98/100", 2455278, 2459021, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIM4", "CDX", 14, "NA HY", null, "HY", 3, 10, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.14.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927157", "9871", - "CDX-NAHYS14V3 - 0617", "CDX.NA.HY.14", - "CDX_NA_HY_S14_100_SWP_07YR_98/100", 2455278, 2457925, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIM4", "CDX", 14, "NA HY", null, "HY", 3, 7, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.14.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927158", "9868", - "CDX-NAHYS14V3 - 0613", "CDX.NA.HY.14", - "CDX_NA_HY_S14_100_SWP_03YR_98/100", 2455278, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIM4", "CDX", 14, "NA HY", null, "HY", 3, 3, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.14.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927159", "9866", - "CDX-NAHYS14V3 - 0615", "CDX.NA.HY.14", - "CDX_NA_HY_S14_100_SWP_98/100", 2455278, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIM4", "CDX", 14, "NA HY", null, "HY", 3, 5, - null, 0.98, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.13.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927160", "9861", - "CDX-NAHYS13V4 - 1219", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_10YR_97/100", 2455096, 2458838, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIL6", "CDX", 13, "NA HY", null, "HY", 4, 10, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.13.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927161", "9860", - "CDX-NAHYS13V4 - 1216", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_07YR_97/100", 2455096, 2457743, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIL6", "CDX", 13, "NA HY", null, "HY", 4, 7, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.13.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927162", "9859", - "CDX-NAHYS13V4 - 1212", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_03YR_97/100", 2455096, 2456282, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIL6", "CDX", 13, "NA HY", null, "HY", 4, 3, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.13.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927163", "9858", - "CDX-NAHYS13V4 - 1214", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_97/100", 2455096, 2457012, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIL6", "CDX", 13, "NA HY", null, "HY", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.12.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927164", "9854", - "CDX-NAHYS12V10 - 0612", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_03YR_92/100", 2454911, 2456099, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIK8", "CDX", 12, "NA HY", null, "HY", 10, 3, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.7.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927166", "9809", - "CDX-NAHYHBS7V13 - 1211", "Dow Jones CDX.NA.HY.HB.7", - "CDX_NA_HY_S07_HB__SWP_20/30", 2454007, 2455917, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWEY1", "CDX", 7, "NA HY HB", null, "HY", 13, 5, - null, 0.66667, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.10.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927167", "9812", - "CDX-NAHYHBS10V14 - 0613", "CDX.NA.HY.HB.10", - "CDX_NA_HY_S10_HB__SWP_20/30", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWFB0", "CDX", 10, "NA HY HB", null, "HY", 14, 5, - null, 0.66667, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.11.16", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927168", "9813", - "CDX-NAHYHBS11V16 - 1213", "CDX.NA.HY.HB.11", - "CDX_NA_HY_S11_HB__SWP_18/30", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWFC8", "CDX", 11, "NA HY HB", null, "HY", 16, 5, - null, 0.60001, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.12.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927169", "9815", - "CDX-NAHYHBS12V9 - 0614", "CDX.NA.HY.HB.12", - "CDX_NA_HY_S12_HB__SWP_23/30", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWFD6", "CDX", 12, "NA HY HB", null, "HY", 9, 5, - null, 0.76668, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.13.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927170", "9816", - "CDX-NAHYHBS13V3 - 1214", "CDX.NA.HY.HB.13", - "CDX_NA_HY_S13_HB__SWP_28/30", 2455096, 2457012, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWFE4", "CDX", 13, "NA HY HB", null, "HY", 3, 5, - null, 0.9333199999999999, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.14.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927171", "9817", - "CDX-NAHYHBS14V2 - 0615", "CDX.NA.HY.HB.14", - "CDX_NA_HY_S14_HB__SWP_29/30", 2455278, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWFF1", "CDX", 14, "NA HY HB", null, "HY", 2, 5, - null, 0.96666, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY HB.5Y.15.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927172", "9818", - "CDX-NAHYHBS15V2 - 1215", "CDX.NA.HY.HB.15", - "CDX_NA_HY_S15_HB__SWP_29/30", 2455460, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BWFG9", "CDX", 15, "NA HY HB", null, "HY", 2, 5, - null, 0.96666, 30, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.5.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927173", "9820", - "CDX-NAHYS5V20 - 1215", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_10YR_83/100", 2453651, 2457377, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRID4", "CDX", 5, "NA HY", null, "HY", 20, 10, - null, 0.8300000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.5.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927174", "9821", - "CDX-NAHYS5V20 - 1212", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_07YR_83/100", 2453651, 2456282, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRID4", "CDX", 5, "NA HY", null, "HY", 20, 7, - null, 0.8300000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.6.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927175", "9823", - "CDX-NAHYS6V18 - 0616", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_10YR_85/100", 2453823, 2457560, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIE2", "CDX", 6, "NA HY", null, "HY", 18, 10, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.10.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927176", "9839", - "CDX-NAHYS10V19 - 0615", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_07YR_85/100", 2454554, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRII3", "CDX", 10, "NA HY", null, "HY", 19, 7, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.10.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927177", "9840", - "CDX-NAHYS10V19 - 0618", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_10YR_85/100", 2454554, 2458290, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRII3", "CDX", 10, "NA HY", null, "HY", 19, 10, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.10.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927178", "9841", - "CDX-NAHYS10V19 - 0613", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_85/100", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRII3", "CDX", 10, "NA HY", null, "HY", 19, 5, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.11.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927179", "9844", - "CDX-NAHYS11V19 - 1213", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_85/100", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIJ1", "CDX", 11, "NA HY", null, "HY", 19, 5, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.6.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927180", "9824", - "CDX-NAHYS6V18 - 0613", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_07YR_85/100", 2453823, 2456464, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIE2", "CDX", 6, "NA HY", null, "HY", 18, 7, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.11.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927181", "9845", - "CDX-NAHYS11V19 - 1211", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_03YR_85/100", 2454738, 2455916, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIJ1", "CDX", 11, "NA HY", null, "HY", 19, 3, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.7.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927182", "9826", - "CDX-NAHYS7V18 - 1213", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_07YR_85/100", 2454007, 2456647, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIF9", "CDX", 7, "NA HY", null, "HY", 18, 7, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.7.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927183", "9827", - "CDX-NAHYS7V18 - 1216", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_10YR_85/100", 2454007, 2457743, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIF9", "CDX", 7, "NA HY", null, "HY", 18, 10, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.7.18", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927184", "9828", - "CDX-NAHYS7V18 - 1211", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_85/100", 2454007, 2455916, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIF9", "CDX", 7, "NA HY", null, "HY", 18, 5, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.8.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927185", "9829", - "CDX-NAHYS8V19 - 0614", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_07YR_85/100", 2454188, 2456829, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIG7", "CDX", 8, "NA HY", null, "HY", 19, 7, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.8.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927186", "9831", - "CDX-NAHYS8V19 - 0612", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_85/100", 2454188, 2456099, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIG7", "CDX", 8, "NA HY", null, "HY", 19, 5, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.8.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927187", "9832", - "CDX-NAHYS8V19 - 0617", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_10YR_85/100", 2454188, 2457925, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIG7", "CDX", 8, "NA HY", null, "HY", 19, 10, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.9.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927188", "9834", - "CDX-NAHYS9V20 - 1214", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_07YR_84/100", 2454372, 2457012, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIH5", "CDX", 9, "NA HY", null, "HY", 20, 7, - null, 0.84, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.11.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927189", "9846", - "CDX-NAHYS11V19 - 1215", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_07YR_85/100", 2454738, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIJ1", "CDX", 11, "NA HY", null, "HY", 19, 7, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.9.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927190", "9835", - "CDX-NAHYS9V20 - 1217", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_10YR_84/100", 2454372, 2458108, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIH5", "CDX", 9, "NA HY", null, "HY", 20, 10, - null, 0.84, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.11.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927191", "9847", - "CDX-NAHYS11V19 - 1218", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_10YR_85/100", 2454738, 2458473, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIJ1", "CDX", 11, "NA HY", null, "HY", 19, 10, - null, 0.85, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.9.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927192", "9836", - "CDX-NAHYS9V20 - 1212", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_84/100", 2454372, 2456282, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIH5", "CDX", 9, "NA HY", null, "HY", 20, 5, - null, 0.84, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.12.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927193", "9851", - "CDX-NAHYS12V10 - 0614", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_92/100", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIK8", "CDX", 12, "NA HY", null, "HY", 10, 5, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.12.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927194", "9852", - "CDX-NAHYS12V10 - 0616", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_07YR_92/100", 2454911, 2457560, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIK8", "CDX", 12, "NA HY", null, "HY", 10, 7, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.12.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927195", "9853", - "CDX-NAHYS12V10 - 0619", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_10YR_92/100", 2454911, 2458655, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIK8", "CDX", 12, "NA HY", null, "HY", 10, 10, - null, 0.92, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.7Y.5.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927200", "7034555", - "DJCDX-NAIGHVOLS5V1 - 1212", "Dow Jones CDX.NA.IG.HVOL.5", - "DJCDX_NA_IG_S5_HVOL_07Y_12/12", 2453635, 2456282, 0.0105, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AE3", "DJCDX", 5, "NA IG HVOL", null, "HV", 1, 7, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("TRACX.NA IG.10Y.1.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927201", "9365749", - "TRACXNA-S1V7 - 0913", "TRAC-X North America Series 1", - "TRACX_NA_IG_S1_100_9/13_93/100", 2452731, 2456556, 0.005, "USD", - "ACT/360", false, 0.4, 4, "TRACXNA-S1V7", "TRACX", 1, "NA IG", null, "IG", 7, 10, - null, 0.935, 100, 0, "NYC", false, false, true, null, "Trac-X")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.2.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927209", "9898", - "ITRAXX-LevXS2V21 - 0613", "iTraxx LevX Senior Series 2 Version 21", - "ITRAXX LEVX SENIOR SERIES 2 VERSION 21 EUR 1ST SEC RES I03 CDS", 2454543, 2456464, 0.052500000000000005, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJES8", "ITRAXX", 2, "LevX", null, "IG", 21, 5, - null, 0.7332, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.3.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927210", "9899", - "ITRAXX-LevXS3V20 - 1213", "iTraxx LevX Senior Series 3 Version 20", - "ITRAXX LEVX SENIOR SERIES 3 VERSION 20 EUR 1ST SEC RES I03 CDS", 2454739, 2456647, 0.0575, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJET6", "ITRAXX", 3, "LevX", null, "IG", 20, 5, - null, 0.7465999999999999, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.4.13", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927211", "9900", - "ITRAXX-LevXS4V13 - 0614", "iTraxx LevX Senior Series 4 Version 13", - "ITRAXX LEVX SENIOR SERIES 4 VERSION 13 EUR 1ST SEC RES I03 CDS", 2454911, 2456829, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJEU3", "ITRAXX", 4, "LevX", null, "IG", 13, 5, - null, 0.76, 50, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.5.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927212", "9896", - "ITRAXX-LevXS5V12 - 1214", "iTraxx LevX Senior Series 5 Version 12", - "ITRAXX LEVX SENIOR SERIES 5 VERSION 12 EUR 1ST SEC RES I03 CDS", 2455096, 2457012, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJEV1", "ITRAXX", 5, "LevX", null, "IG", 12, 5, - null, 0.725, 40, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.6.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927213", "9897", - "ITRAXX-LevXS6V10 - 0615", "iTraxx LevX Senior Series 6 Version 10", - "ITRAXX LEVX SENIOR SERIES 6 VERSION 10 EUR 1ST SEC RES I03 CDS", 2455278, 2457194, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJEW9", "ITRAXX", 6, "LevX", null, "IG", 10, 5, - null, 0.775, 40, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.5.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927231", "29937", - "CDX-NAHYS5V21 - 1215", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_10YR_82/100", 2453651, 2457377, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIR3", "CDX", 5, "NA HY", null, "HY", 21, 10, - null, 0.8200000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.5.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927232", "29938", - "CDX-NAHYS5V21 - 1212", "Dow Jones CDX.NA.HY.5", - "CDX_NA_HY_S05_100_SWP_07YR_82/100", 2453651, 2456282, 0.0395, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIR3", "CDX", 5, "NA HY", null, "HY", 21, 7, - null, 0.8200000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.7Y.5.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927233", "29940", - "CDX-NAXOS5V6 - 1212", "Dow Jones CDX.NA.XO.5", - "DJCDX_NA_XO_S5_07YR_12/12_30/35", 2453635, 2456282, 0.02, "USD", - "ACT/360", false, 0.4, 4, "1D764IAZ0", "CDX", 5, "NA XO", null, "XO", 6, 7, - null, 0.85714, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA XO.10Y.5.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927234", "29941", - "CDX-NAXOS5V6 - 1215", "Dow Jones CDX.NA.XO.5", - "DJCDX_NA_XO_S5_10YR_12/15_30/35", 2453635, 2457377, 0.024, "USD", - "ACT/360", false, 0.4, 4, "1D764IAZ0", "CDX", 5, "NA XO", null, "XO", 6, 10, - null, 0.85714, 35, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.6.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927235", "29942", - "CDX-NAHYS6V19 - 0616", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_10YR_84/100", 2453823, 2457560, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIQ5", "CDX", 6, "NA HY", null, "HY", 19, 10, - null, 0.84, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.6.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927236", "29943", - "CDX-NAHYS6V19 - 0613", "Dow Jones CDX.NA.HY.6", - "CDX_NA_HY_S06_100_SWP_07YR_84/100", 2453823, 2456464, 0.0345, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIQ5", "CDX", 6, "NA HY", null, "HY", 19, 7, - null, 0.84, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.7.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927237", "29945", - "CDX-NAHYS7V19 - 1213", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_07YR_84/100", 2454007, 2456647, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIP7", "CDX", 7, "NA HY", null, "HY", 19, 7, - null, 0.84, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.7.19", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927238", "29946", - "CDX-NAHYS7V19 - 1216", "Dow Jones CDX.NA.HY.7", - "CDX_NA_HY_S07_100_SWP_10YR_84/100", 2454007, 2457743, 0.0325, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIP7", "CDX", 7, "NA HY", null, "HY", 19, 10, - null, 0.84, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.8.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927239", "29948", - "CDX-NAHYS8V20 - 0614", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_07YR_84/100", 2454188, 2456829, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIT9", "CDX", 8, "NA HY", null, "HY", 20, 7, - null, 0.84, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.8.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927240", "29949", - "CDX-NAHYS8V20 - 0612", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_84/100", 2454188, 2456099, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIT9", "CDX", 8, "NA HY", null, "HY", 20, 5, - null, 0.84, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.8.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927241", "29950", - "CDX-NAHYS8V20 - 0617", "CDX.NA.HY.8", - "CDX_NA_HY_S08_100_SWP_10YR_84/100", 2454188, 2457925, 0.0275, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIT9", "CDX", 8, "NA HY", null, "HY", 20, 10, - null, 0.84, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.8.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927242", "29952", - "CDX-NAHYBS8V10 - 0612", "CDX.NA.HY.B.8", - "CDX_NA_HY_S08_B___SWP_40/49", 2454188, 2456099, 0.025, "USD", - "ACT/360", false, 0.3, 4, "2I65BSET1", "CDX", 8, "NA HY B", null, "HY", 10, 5, - null, 0.81632, 49, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.9.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927243", "29953", - "CDX-NAHYS9V21 - 1214", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_07YR_83/100", 2454372, 2457012, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIS1", "CDX", 9, "NA HY", null, "HY", 21, 7, - null, 0.8300000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.9.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927244", "29954", - "CDX-NAHYS9V21 - 1217", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_10YR_83/100", 2454372, 2458108, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIS1", "CDX", 9, "NA HY", null, "HY", 21, 10, - null, 0.8300000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.9.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927245", "29956", - "CDX-NAHYS9V21 - 1212", "CDX.NA.HY.9", - "CDX_NA_HY_S09_100_SWP_83/100", 2454372, 2456282, 0.0375, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIS1", "CDX", 9, "NA HY", null, "HY", 21, 5, - null, 0.8300000000000001, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.9.12", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927246", "29958", - "CDX-NAHYBS9V12 - 1212", "CDX.NA.HY.B.9", - "CDX_NA_HY_S09_B___SWP_35/46", 2454372, 2456282, 0.035, "USD", - "ACT/360", false, 0.3, 4, "2I65BSES3", "CDX", 9, "NA HY B", null, "HY", 12, 5, - null, 0.76087, 46, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.10.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927247", "29959", - "CDX-NAHYS10V20 - 0615", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_07YR_84/100", 2454554, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRJB7", "CDX", 10, "NA HY", null, "HY", 20, 7, - null, 0.84, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.10.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927248", "29960", - "CDX-NAHYS10V20 - 0618", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_10YR_84/100", 2454554, 2458290, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRJB7", "CDX", 10, "NA HY", null, "HY", 20, 10, - null, 0.84, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.10.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927249", "29961", - "CDX-NAHYS10V20 - 0613", "CDX.NA.HY.10", - "CDX_NA_HY_S10_100_SWP_84/100", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRJB7", "CDX", 10, "NA HY", null, "HY", 20, 5, - null, 0.84, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.10.10", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927250", "29965", - "CDX-NAHYBS10V10 - 0613", "CDX.NA.HY.B.10", - "CDX_NA_HY_S10_B___SWP_36/45", 2454554, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSEV6", "CDX", 10, "NA HY B", null, "HY", 10, 5, - null, 0.8000100000000001, 45, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.11.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927251", "29966", - "CDX-NAHYS11V20 - 1213", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_84/100", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRJA9", "CDX", 11, "NA HY", null, "HY", 20, 5, - null, 0.84, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.11.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927252", "29967", - "CDX-NAHYS11V20 - 1215", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_07YR_84/100", 2454738, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRJA9", "CDX", 11, "NA HY", null, "HY", 20, 7, - null, 0.84, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.11.20", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927253", "29968", - "CDX-NAHYS11V20 - 1218", "CDX.NA.HY.11", - "CDX_NA_HY_S11_100_SWP_10YR_84/100", 2454738, 2458473, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRJA9", "CDX", 11, "NA HY", null, "HY", 20, 10, - null, 0.84, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.11.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927254", "29972", - "CDX-NAHYBS11V8 - 1213", "CDX.NA.HY.B.11", - "CDX_NA_HY_S11_B___SWP_29/36", 2454738, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSEU8", "CDX", 11, "NA HY B", null, "HY", 8, 5, - null, 0.80557, 36, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.12.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927255", "29973", - "CDX-NAHYS12V11 - 0614", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_91/100", 2454911, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIZ5", "CDX", 12, "NA HY", null, "HY", 11, 5, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.12.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927256", "29974", - "CDX-NAHYS12V11 - 0616", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_07YR_91/100", 2454911, 2457560, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIZ5", "CDX", 12, "NA HY", null, "HY", 11, 7, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.12.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927257", "29975", - "CDX-NAHYS12V11 - 0619", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_10YR_91/100", 2454911, 2458655, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIZ5", "CDX", 12, "NA HY", null, "HY", 11, 10, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.12.11", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927258", "29976", - "CDX-NAHYS12V11 - 0612", "CDX.NA.HY.12", - "CDX_NA_HY_S12_100_SWP_03YR_91/100", 2454911, 2456099, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIZ5", "CDX", 12, "NA HY", null, "HY", 11, 3, - null, 0.91, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.13.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927259", "29979", - "CDX-NAHYS13V5 - 1214", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_96/100", 2455096, 2457012, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIY8", "CDX", 13, "NA HY", null, "HY", 5, 5, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.13.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927260", "29981", - "CDX-NAHYS13V5 - 1212", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_03YR_96/100", 2455096, 2456282, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIY8", "CDX", 13, "NA HY", null, "HY", 5, 3, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.13.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927261", "29982", - "CDX-NAHYS13V5 - 1216", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_07YR_96/100", 2455096, 2457743, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIY8", "CDX", 13, "NA HY", null, "HY", 5, 7, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.17.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927275", "30067", - "LCDXNAS17V2 - 1216", "LCDX.NA.17", - "CDX_NA_LN_S17_100_99/100", 2455825, 2457743, 0.025, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GFK8", "LCDX", 17, "LCDXNA", null, "IG", 2, 5, - null, 0.99, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.13.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927280", "29983", - "CDX-NAHYS13V5 - 1219", "CDX.NA.HY.13", - "CDX_NA_HY_S13_100_SWP_10YR_96/100", 2455096, 2458838, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIY8", "CDX", 13, "NA HY", null, "HY", 5, 10, - null, 0.96, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.14.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927281", "29986", - "CDX-NAHYS14V4 - 0615", "CDX.NA.HY.14", - "CDX_NA_HY_S14_100_SWP_97/100", 2455278, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIX0", "CDX", 14, "NA HY", null, "HY", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - return true; - } - - private static final boolean InitCDXRefDataSet42() - { - UpdateCDXRefDataMap ("CDX.NA HY.3Y.14.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927282", "29988", - "CDX-NAHYS14V4 - 0613", "CDX.NA.HY.14", - "CDX_NA_HY_S14_100_SWP_03YR_97/100", 2455278, 2456464, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIX0", "CDX", 14, "NA HY", null, "HY", 4, 3, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.14.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927283", "29991", - "CDX-NAHYS14V4 - 0617", "CDX.NA.HY.14", - "CDX_NA_HY_S14_100_SWP_07YR_97/100", 2455278, 2457925, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIX0", "CDX", 14, "NA HY", null, "HY", 4, 7, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.14.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927284", "29992", - "CDX-NAHYS14V4 - 0620", "CDX.NA.HY.14", - "CDX_NA_HY_S14_100_SWP_10YR_97/100", 2455278, 2459021, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIX0", "CDX", 14, "NA HY", null, "HY", 4, 10, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.15.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927285", "29994", - "CDX-NAHYS15V4 - 1217", "CDX.NA.HY.15", - "CDX_NA_HY_S15_100_SWP_07YR_97/100", 2455460, 2458108, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIW2", "CDX", 15, "NA HY", null, "HY", 4, 7, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.15.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927286", "29995", - "CDX-NAHYS15V4 - 1220", "CDX.NA.HY.15", - "CDX_NA_HY_S15_100_SWP_10YR_97/100", 2455460, 2459204, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIW2", "CDX", 15, "NA HY", null, "HY", 4, 10, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.15.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927287", "29996", - "CDX-NAHYS15V4 - 1215", "CDX.NA.HY.15", - "CDX_NA_HY_S15_100_SWP_97/100", 2455460, 2457377, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIW2", "CDX", 15, "NA HY", null, "HY", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.15.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927288", "29999", - "CDX-NAHYS15V4 - 1213", "CDX.NA.HY.15", - "CDX_NA_HY_S15_100_SWP_03YR_97/100", 2455460, 2456647, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIW2", "CDX", 15, "NA HY", null, "HY", 4, 3, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.16.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927289", "30001", - "CDX-NAHYS16V4 - 0616", "CDX.NA.HY.16", - "CDX_NA_HY_S16_100_SWP_97/100", 2455642, 2457560, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIV4", "CDX", 16, "NA HY", null, "HY", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.16.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927290", "30002", - "CDX-NAHYS16V4 - 0614", "CDX.NA.HY.16", - "CDX_NA_HY_S16_100_SWP_03YR_97/100", 2455642, 2456829, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIV4", "CDX", 16, "NA HY", null, "HY", 4, 3, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.16.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927291", "30003", - "CDX-NAHYS16V4 - 0618", "CDX.NA.HY.16", - "CDX_NA_HY_S16_100_SWP_07YR_97/100", 2455642, 2458290, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIV4", "CDX", 16, "NA HY", null, "HY", 4, 7, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.16.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927292", "30004", - "CDX-NAHYS16V4 - 0621", "CDX.NA.HY.16", - "CDX_NA_HY_S16_100_SWP_10YR_97/100", 2455642, 2459386, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIV4", "CDX", 16, "NA HY", null, "HY", 4, 10, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.17.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927293", "30010", - "CDX-NAHYS17V4 - 1216", "CDX.NA.HY.17", - "CDX_NA_HY_S17_100_SWP_97/100", 2455825, 2457743, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIU6", "CDX", 17, "NA HY", null, "HY", 4, 5, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.17.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927294", "30011", - "CDX-NAHYS17V4 - 1214", "CDX.NA.HY.17", - "CDX_NA_HY_S17_100_SWP_03YR_97/100", 2455825, 2457012, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIU6", "CDX", 17, "NA HY", null, "HY", 4, 3, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.17.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927295", "30012", - "CDX-NAHYS17V4 - 1218", "CDX.NA.HY.17", - "CDX_NA_HY_S17_100_SWP_07YR_97/100", 2455825, 2458473, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIU6", "CDX", 17, "NA HY", null, "HY", 4, 7, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.17.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927296", "30013", - "CDX-NAHYS17V4 - 1221", "CDX.NA.HY.17", - "CDX_NA_HY_S17_100_SWP_10YR_97/100", 2455825, 2459569, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRIU6", "CDX", 17, "NA HY", null, "HY", 4, 10, - null, 0.97, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.1.9", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927297", "30072", - "CDX-NAIGS1V9 - 0314", "Dow Jones CDX.NA.IG.1", - "DJCDX_NA_IG_S1_10Y_3/14_117/125", 2452934, 2456737, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCS2", "CDX", 1, "NA IG", null, "IG", 9, 10, - null, 0.9400000000000001, 124, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.10Y.1.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927298", "30073", - "CDX-NAIGHVOLS1V5 - 0314", "Dow Jones CDX.NA.IG.HVOL.1", - "DJCDX_NA_IG_S1_HIVOL_10Y_27/30", 2452934, 2456737, 0.0135, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BQ5", "CDX", 1, "NA IG HVOL", null, "HV", 5, 10, - null, 0.9000100000000001, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.10Y.2.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927299", "30075", - "DJCDX-NAIGHVOLS2V4 - 0914", "Dow Jones CDX.NA.IG.HVOL.2", - "DJCDX_NA_IG_S2_V3_HVOL_10Y_9/14_28/30", 2453088, 2456921, 0.013000000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BP7", "DJCDX", 2, "NA IG HVOL", null, "HV", 4, 10, - null, 0.93333, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.2.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927300", "30076", - "CDX-NAIGS2V8 - 0914", "Dow Jones CDX.NA.IG.2", - "DJCDX_NA_IG_S2_10Y_9/14_119/126", 2453088, 2456921, 0.008, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCR4", "CDX", 2, "NA IG", null, "IG", 8, 10, - null, 0.948, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.10Y.3.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927301", "30077", - "DJCDX-NAIGHVOLS3V3 - 0315", "Dow Jones CDX.NA.IG.HVOL.3", - "DJCDX_NA_IG_S3_HVOL_10Y_3/15_28/30", 2453270, 2457102, 0.0125, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BN2", "DJCDX", 3, "NA IG HVOL", null, "HV", 3, 10, - null, 0.93333, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("DJCDX.NA IG HVOL.7Y.3.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927302", "30078", - "DJCDX-NAIGHVOLS3V3 - 0312", "Dow Jones CDX.NA.IG.HVOL.3", - "DJCDX_NA_IG_S3_HVOL_07Y_3/12_28/30", 2453270, 2456007, 0.0115, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BN2", "DJCDX", 3, "NA IG HVOL", null, "HV", 3, 7, - null, 0.93333, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.3.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927303", "30079", - "CDX-NAIGS3V7 - 0312", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_07Y_3/12_119/126", 2453270, 2456008, 0.006, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCQ6", "CDX", 3, "NA IG", null, "IG", 7, 7, - null, 0.948, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.3.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927304", "30080", - "CDX-NAIGS3V7 - 0315", "Dow Jones CDX.NA.IG.3", - "DJCDX_NA_IG_S3_10Y_3/15_119/126", 2453270, 2457102, 0.007, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCQ6", "CDX", 3, "NA IG", null, "IG", 7, 10, - null, 0.948, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.7Y.4.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927305", "30081", - "CDX-NAIGHVOLS4V3 - 0612", "Dow Jones CDX.NA.IG.HVOL.4", - "DJCDX_NA_IG_S4_HVOL_07Y_6/12_28/30", 2453451, 2456099, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BM4", "CDX", 4, "NA IG HVOL", null, "HV", 3, 7, - null, 0.93333, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.10Y.4.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927306", "30083", - "CDX-NAIGHVOLS4V3 - 0615", "Dow Jones CDX.NA.IG.HVOL.4", - "DJCDX_NA_IG_S4_HVOL_10Y_6/15_28/30", 2453451, 2457194, 0.0115, "USD", - "ACT/360", false, 0.4, 4, "2I65B3BM4", "CDX", 4, "NA IG HVOL", null, "HV", 3, 10, - null, 0.93333, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.4.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927307", "30084", - "CDX-NAIGS4V7 - 0615", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_10Y_6/15_119/126", 2453451, 2457194, 0.006500000000000001, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCP8", "CDX", 4, "NA IG", null, "IG", 7, 10, - null, 0.948, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.4.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927308", "30085", - "CDX-NAIGS4V7 - 0612", "Dow Jones CDX.NA.IG.4", - "DJCDX_NA_IG_S4_07Y_6/12_119/126", 2453451, 2456099, 0.0055000000000000005, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCP8", "CDX", 4, "NA IG", null, "IG", 7, 7, - null, 0.948, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("TRACX.NA IG HB.10Y.2.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927309", "30167", - "TRACX-NAIGHBS2V4 - 0314", "Dow Jones TRAC-X NA SERIES 2 High Beta March 2014", - "TRACX_NA_IG_S2_HB_10Y_3/14_SWP_37/40", 2452916, 2456737, 0.01, "USD", - "ACT/360", false, 0.4, 4, "TRACX-NAIGHBS2V4", "TRACX", 2, "NA IG HB", null, "IG", 4, 10, - null, 0.925, 40, 0, "NYC", false, false, true, null, "Trac-X")); - - UpdateCDXRefDataMap ("TRACX.NA IG.10Y.1.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927310", "30207", - "TRACXNA-S1V8 - 0913", "TRAC-X North America Series 1", - "TRACX_NA_IG_S1_100_9/13_92/100", 2452731, 2456556, 0.005, "USD", - "ACT/360", false, 0.4, 4, "TRACXNA-S1V8", "TRACX", 1, "NA IG", null, "IG", 8, 10, - null, 0.925, 100, 0, "NYC", false, false, true, null, "Trac-X")); - - UpdateCDXRefDataMap ("TRACX.NA IG.10Y.2.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927311", "30200", - "TRACXNA-S2V6 - 0314", "Dow Jones TRAC-X NA SERIES 2 March 2014", - "TRACX_NA_IG_S2_10Y_3/14_SWP_95/100", 2452916, 2456737, 0.01, "USD", - "ACT/360", false, 0.4, 4, "TRACXNA-S2V6", "TRACX", 2, "NA IG", null, "IG", 6, 10, - null, 0.9550000000000001, 99, 0, "NYC", false, false, true, null, "Trac-X")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.2.22", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927316", "35404", - "ITRAXX-LevXS2V22 - 0613", "iTraxx LevX Senior Series 2 Version 22", - "ITRAXX LEVX SENIOR SERIES 2 VERSION 22 EUR 1ST SEC RES I03 CDS", 2454543, 2456464, 0.052500000000000005, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJEX7", "ITRAXX", 2, "LevX", null, "IG", 22, 5, - null, 0.72, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.3.21", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927317", "35406", - "ITRAXX-LevXS3V21 - 1213", "iTraxx LevX Senior Series 3 Version 21", - "ITRAXX LEVX SENIOR SERIES 3 VERSION 21 EUR 1ST SEC RES I03 CDS", 2454739, 2456647, 0.0575, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJEY5", "ITRAXX", 3, "LevX", null, "IG", 21, 5, - null, 0.7334, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.4.14", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927318", "35421", - "ITRAXX-LevXS4V14 - 0614", "iTraxx LevX Senior Series 4 Version 14", - "ITRAXX LEVX SENIOR SERIES 4 VERSION 14 EUR 1ST SEC RES I03 CDS", 2454911, 2456829, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJEZ2", "ITRAXX", 4, "LevX", null, "IG", 14, 5, - null, 0.74, 50, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.3Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927331", "42164", - "ITRAXX-EUROPES17V1 - 0615", "iTraxx Europe series 17 Version 1", - "ITRAXX-EUROPES17V1-0615 EUR SEN MMR I03 CDS", 2456007, 2457194, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAX3", "ITRAXX", 17, "EUROPE", "EUR", "IG", 1, 3, - "246985", 1, 125, 0, "LON", true, true, true, null, "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.5Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927332", "42165", - "ITRAXX-EUROPES17V1 - 0617", "iTraxx Europe series 17 Version 1", - "ITRAXX-EUROPES17V1-0617 EUR SEN MMR I03 CDS", 2456007, 2457925, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAX3", "ITRAXX", 17, "EUROPE", "EUR", "IG", 1, 5, - "246985", 1, 125, 0, "LON", true, true, true, null, "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.7Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927333", "42166", - "ITRAXX-EUROPES17V1 - 0619", "iTraxx Europe series 17 Version 1", - "ITRAXX-EUROPES17V1-0619 EUR SEN MMR I03 CDS", 2456007, 2458655, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAX3", "ITRAXX", 17, "EUROPE", "EUR", "IG", 1, 7, - "246985", 1, 125, 0, "LON", true, true, true, null, "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.EUROPE.10Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927334", "42167", - "ITRAXX-EUROPES17V1 - 0622", "iTraxx Europe series 17 Version 1", - "ITRAXX-EUROPES17V1-0622 EUR SEN MMR I03 CDS", 2456007, 2459751, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I666VAX3", "ITRAXX", 17, "EUROPE", "EUR", "IG", 1, 10, - "246985", 1, 125, 0, "LON", true, true, true, null, "EUR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927335", "42168", - "ITRAXX-XOVERS17V1 - 0615", "iTraxx Europe Crossover series 17 Version 1", - "ITRAXX-XOVERS17V1-0615 EUR SEN MMR I03 CDS", 2456007, 2457194, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCN6", "ITRAXX", 17, "XOVER", "XVR", "XO", 1, 3, - "246986", 1, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927336", "42169", - "ITRAXX-XOVERS17V1 - 0617", "iTraxx Europe Crossover series 17 Version 1", - "ITRAXX-XOVERS17V1-0617 EUR SEN MMR I03 CDS", 2456007, 2457925, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCN6", "ITRAXX", 17, "XOVER", "XVR", "XO", 1, 5, - "246986", 1, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927337", "42171", - "ITRAXX-XOVERS17V1 - 0619", "iTraxx Europe Crossover series 17 Version 1", - "ITRAXX-XOVERS17V1-0619 EUR SEN MMR I03 CDS", 2456007, 2458655, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCN6", "ITRAXX", 17, "XOVER", "XVR", "XO", 1, 7, - "246986", 1, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927338", "42172", - "ITRAXX-XOVERS17V1 - 0622", "iTraxx Europe Crossover series 17 Version 1", - "ITRAXX-XOVERS17V1-0622 EUR SEN MMR I03 CDS", 2456007, 2459751, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCN6", "ITRAXX", 17, "XOVER", "XVR", "XO", 1, 10, - "246986", 1, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.3Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927339", "42173", - "ITRAXX-HIVOLS17V1 - 0615", "iTraxx Europe HiVol series 17 Version 1", - "ITRAXX-HIVOLS17V1-0615 EUR SEN MMR I03 CDS", 2456007, 2457194, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAU0", "ITRAXX", 17, "HIVOL", "VOL", "HV", 1, 3, - "246987", 1, 30, 0, "LON", true, true, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.5Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927340", "42174", - "ITRAXX-HIVOLS17V1 - 0617", "iTraxx Europe HiVol series 17 Version 1", - "ITRAXX-HIVOLS17V1-0617 EUR SEN MMR I03 CDS", 2456007, 2457925, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAU0", "ITRAXX", 17, "HIVOL", "VOL", "HV", 1, 5, - "246987", 1, 30, 0, "LON", true, true, true, null, "VOL")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927342", "42186", - "USD ITRAXX-XOVERS17V1 - 0622", "iTraxx Europe Crossover series 17 Version 1", - "ITRAXX-XOVERS17V1-0622 USD SEN MMR I03 CDS", 2456007, 2459751, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KCN6", "USD ITRAXX", 17, "XOVER", "XVR", "XO", 1, 10, - null, 1, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSEN.5Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927343", "42187", - "USD ITRAXX-FINSENS17V1 - 0617", "iTraxx Europe Senior Financials series 17 Version 1", - "ITRAXX-FINSENS17V1-0617 USD SEN MMR I03 CDS", 2456007, 2457925, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I667DAQ7", "USD ITRAXX", 17, "FINSEN", "SEN", "SENF", 1, 5, - null, 1, 25, 0, "LON", false, false, true, null, "SEN")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSEN.10Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927344", "42189", - "USD ITRAXX-FINSENS17V1 - 0622", "iTraxx Europe Senior Financials series 17 Version 1", - "ITRAXX-FINSENS17V1-0622 USD SEN MMR I03 CDS", 2456007, 2459751, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I667DAQ7", "USD ITRAXX", 17, "FINSEN", "SEN", "SENF", 1, 10, - null, 1, 25, 0, "LON", false, false, true, null, "SEN")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSUB.5Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927345", "42190", - "USD ITRAXX-FINSUBS17V1 - 0617", "iTraxx Europe Sub Financials series 17 Version 1", - "ITRAXX-FINSUBS17V1-0617 USD LT2 SUB MMR I03 CDS", 2456007, 2457925, 0.05, "USD", - "ACT/360", false, 0.2, 4, "2I667EAR3", "USD ITRAXX", 17, "FINSUB", "SUB", "SUBF", 1, 5, - null, 1, 25, 0, "LON", false, false, true, null, "SUB")); - - UpdateCDXRefDataMap ("USD ITRAXX.FINSUB.10Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927346", "42191", - "USD ITRAXX-FINSUBS17V1 - 0622", "iTraxx Europe Sub Financials series 17 Version 1", - "ITRAXX-FINSUBS17V1-0622 USD LT2 SUB MMR I03 CDS", 2456007, 2459751, 0.05, "USD", - "ACT/360", false, 0.2, 4, "2I667EAR3", "USD ITRAXX", 17, "FINSUB", "SUB", "SUBF", 1, 10, - null, 1, 25, 0, "LON", false, false, true, null, "SUB")); - - UpdateCDXRefDataMap ("Itraxx.SovX West Eur.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927349", "42197", - "Itraxx-SovX West Eur S7V1 - 0617", "Itraxx SovX Western Europe Series 7 Version 1", - "ITRAXX-SOVX WEST EUR S7V1-0617 USD SEN RES I03 CDS", 2456007, 2457925, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAN1", "Itraxx", 7, "SovX West Eur", "SOV", "SOWE", 1, 5, - "246989", 1, 15, 0, "LON", true, true, true, null, "SOV")); - - UpdateCDXRefDataMap ("Itraxx.SovX West Eur.10Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927350", "42199", - "Itraxx-SovX West Eur S7V1 - 0622", "Itraxx SovX Western Europe Series 7 Version 1", - "ITRAXX-SOVX WEST EUR S7V1-0622 USD SEN RES I03 CDS", 2456007, 2459751, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAN1", "Itraxx", 7, "SovX West Eur", "SOV", "SOWE", 1, 10, - "246989", 1, 15, 0, "LON", true, true, true, null, "SOV")); - - UpdateCDXRefDataMap ("ITRAXX.CEEMEA.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927351", "42201", - "ITRAXX-CEEMEAS7V1 - 0617", "iTraxx SovX CEEMEA Series 7 Version 1", - "ITRAXX-SOVX CEEMEA S7V1-0617 USD SEN RES I03 CDS", 2456007, 2457925, 0.01, "USD", - "ACT/360", false, 0.25, 4, "5C769NAG4", "ITRAXX", 7, "CEEMEA", "SOVXCEM", "SOCE", 1, 5, - null, 1, 15, 0, "LON", false, false, true, null, "SOVXCEM")); - - UpdateCDXRefDataMap ("ITRAXX.CEEMEA.10Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927352", "42203", - "ITRAXX-CEEMEAS7V1 - 0622", "iTraxx SovX CEEMEA Series 7 Version 1", - "ITRAXX-SOVX CEEMEA S7V1-0622 USD SEN RES I03 CDS", 2456007, 2459751, 0.01, "USD", - "ACT/360", false, 0.25, 4, "5C769NAG4", "ITRAXX", 7, "CEEMEA", "SOVXCEM", "SOCE", 1, 10, - null, 1, 15, 0, "LON", false, false, true, null, "SOVXCEM")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.7Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927353", "42175", - "ITRAXX-HIVOLS17V1 - 0619", "iTraxx Europe HiVol series 17 Version 1", - "ITRAXX-HIVOLS17V1-0619 EUR SEN MMR I03 CDS", 2456007, 2458655, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAU0", "ITRAXX", 17, "HIVOL", "VOL", "HV", 1, 7, - "246987", 1, 30, 0, "LON", true, true, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.HIVOL.10Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927354", "42176", - "ITRAXX-HIVOLS17V1 - 0622", "iTraxx Europe HiVol series 17 Version 1", - "ITRAXX-HIVOLS17V1-0622 EUR SEN MMR I03 CDS", 2456007, 2459751, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667LAU0", "ITRAXX", 17, "HIVOL", "VOL", "HV", 1, 10, - "246987", 1, 30, 0, "LON", true, true, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.5Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927357", "42179", - "ITRAXX-FINSENS17V1 - 0617", "iTraxx Europe Senior Financials series 17 Version 1", - "ITRAXX-FINSENS17V1-0617 EUR SEN MMR I03 CDS", 2456007, 2457925, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAQ7", "ITRAXX", 17, "FINSEN", "SEN", "SENF", 1, 5, - "246990", 1, 25, 0, "LON", true, true, true, null, "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSEN.10Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927358", "42180", - "ITRAXX-FINSENS17V1 - 0622", "iTraxx Europe Senior Financials series 17 Version 1", - "ITRAXX-FINSENS17V1-0622 EUR SEN MMR I03 CDS", 2456007, 2459751, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I667DAQ7", "ITRAXX", 17, "FINSEN", "SEN", "SENF", 1, 10, - "246990", 1, 25, 0, "LON", true, true, true, null, "SEN")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.5Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927359", "42181", - "ITRAXX-FINSUBS17V1 - 0617", "iTraxx Europe Sub Financials series 17 Version 1", - "ITRAXX-FINSUBS17V1-0617 EUR LT2 SUB MMR I03 CDS", 2456007, 2457925, 0.05, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAR3", "ITRAXX", 17, "FINSUB", "SUB", "SUBF", 1, 5, - "246991", 1, 25, 0, "LON", true, true, true, null, "SUB")); - - UpdateCDXRefDataMap ("ITRAXX.FINSUB.10Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927360", "42182", - "ITRAXX-FINSUBS17V1 - 0622", "iTraxx Europe Sub Financials series 17 Version 1", - "ITRAXX-FINSUBS17V1-0622 EUR LT2 SUB MMR I03 CDS", 2456007, 2459751, 0.05, "EUR", - "ACT/360", false, 0.2, 4, "2I667EAR3", "ITRAXX", 17, "FINSUB", "SUB", "SUBF", 1, 10, - "246991", 1, 25, 0, "LON", true, true, true, null, "SUB")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.5Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927361", "42183", - "USD ITRAXX-EUROPES17V1 - 0617", "iTraxx Europe series 17 Version 1", - "ITRAXX-EUROPES17V1-0617 USD SEN MMR I03 CDS", 2456007, 2457925, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I666VAX3", "USD ITRAXX", 17, "EUROPE", "EUR", "IG", 1, 5, - null, 1, 125, 0, "LON", false, false, true, null, "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.EUROPE.10Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927362", "42184", - "USD ITRAXX-EUROPES17V1 - 0622", "iTraxx Europe series 17 Version 1", - "ITRAXX-EUROPES17V1-0622 USD SEN MMR I03 CDS", 2456007, 2459751, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I666VAX3", "USD ITRAXX", 17, "EUROPE", "EUR", "IG", 1, 10, - null, 1, 125, 0, "LON", false, false, true, null, "EUR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927363", "42185", - "USD ITRAXX-XOVERS17V1 - 0617", "iTraxx Europe Crossover series 17 Version 1", - "ITRAXX-XOVERS17V1-0617 USD SEN MMR I03 CDS", 2456007, 2457925, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KCN6", "USD ITRAXX", 17, "XOVER", "XVR", "XO", 1, 5, - null, 1, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.AUSTRALIA.5Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927368", "42317", - "ITRAXX-AUSTRALIAS17V1 - 0617", "iTraxx Australia Series Number 17 Version 1", - "ITRAXX AUSTRALIA SERIES NUMBER 17 VERSION 1 USD SEN MR I03 CDS", 2456007, 2457925, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I668IAQ5", "ITRAXX", 17, "AUSTRALIA", null, "AUHG", 1, 5, - null, 1, 25, 0, "HKG", false, false, true, null, "Itraxx Australia")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN.5Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927369", "42888", - "ITRAXX-JAPANS17V1 - 0617", "iTraxx Japan Series Number 17 Version 1", - "ITRAXX JAPAN SERIES NUMBER 17 VERSION 1 JPY SEN RES I03 CDS", 2456008, 2457925, 0.01, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668HBQ6", "ITRAXX", 17, "JAPAN", null, "JPHG", 1, 5, - null, 1, 50, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.ASIAXJ IG.5Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927370", "42875", - "ITRAXX-ASIAXJIGS17V1 - 0617", "iTraxx Asia ex-Japan IG Series Number 17 Version 1", - "ITRAXX ASIA EX-JAPAN IG SERIES NUMBER 17 VERSION 1 USD SEN RES I03 CDS", 2456007, 2457925, 0.01, "USD", - "ACT/360", false, 0.4, 4, "4ABCAMAJ5", "ITRAXX", 17, "ASIAXJ IG", null, "ASHG", 1, 5, - null, 1, 40, 0, "HKG", false, false, true, null, "i-Traxx-Asian")); - - UpdateCDXRefDataMap ("ITRAXX.SOVXASIAPACIFIC.5Y.7.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927371", "42866", - "ITRAXX-SOVX-ASIA-PACIFICS7 - 0617", "ITraxx Sovx Asia-Pacific Series Number 7 Version 1", - "ITRAXX SOVX ASIA-PACIFIC SERIES NUMBER 7 VERSION 1 USD SEN RES I03 CDS", 2456007, 2457925, 0.01, "USD", - "ACT/360", false, 0.4, 4, "4ABCANAE4", "ITRAXX", 7, "SOVXASIAPACIFIC", null, "ASHG", 1, 5, - null, 1, 10, 0, "HKG", false, false, true, null, "Itraxx SovX")); - - UpdateCDXRefDataMap ("CDX.NA HY V1 FXD.5Y.18.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927372", "42206", - "CDX-NAHYS18V1 FXD - 0617", "CDX.NA.HY.18", - "CDX_NA_HY_S18_100_FXD", 2456007, 2457925, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I65BRJC5 FXD", "CDX", 18, "NA HY V1 FXD", null, "HY", 1, 5, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.5Y.18.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927373", "42207", - "CDX-NAHYS18V1 - 0617", "CDX.NA.HY.18", - "CDX_NA_HY_S18_100_SWP", 2456007, 2457925, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRJC5", "CDX", 18, "NA HY", null, "HY", 1, 5, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.3Y.18.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927374", "42212", - "CDX-NAHYS18V1 - 0615", "CDX.NA.HY.18", - "CDX_NA_HY_S18_100_SWP_03YR", 2456007, 2457194, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRJC5", "CDX", 18, "NA HY", null, "HY", 1, 3, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.7Y.18.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927375", "42216", - "CDX-NAHYS18V1 - 0619", "CDX.NA.HY.18", - "CDX_NA_HY_S18_100_SWP_07YR", 2456007, 2458655, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRJC5", "CDX", 18, "NA HY", null, "HY", 1, 7, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY.10Y.18.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927376", "42217", - "CDX-NAHYS18V1 - 0622", "CDX.NA.HY.18", - "CDX_NA_HY_S18_100_SWP_10YR", 2456007, 2459751, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BRJC5", "CDX", 18, "NA HY", null, "HY", 1, 10, - null, 1, 100, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY B.5Y.18.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927377", "42221", - "CDX-NAHYBS18V1 - 0617", "CDX.NA.HY.B.18", - "CDX_NA_HY_S18_B___SWP", 2456007, 2457925, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BSKM9", "CDX", 18, "NA HY B", null, "HY", 1, 5, - null, 1, 44, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA HY BB.5Y.18.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927378", "42224", - "CDX-NAHYBBS18V1 - 0617", "CDX.NA.HY.BB.18", - "CDX_NA_HY_S18_BB__SWP", 2456007, 2457925, 0.05, "USD", - "ACT/360", false, 0.3, 4, "2I65BVBZ3", "CDX", 18, "NA HY BB", null, "HY", 1, 5, - null, 1, 43, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.3Y.18.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927381", "42228", - "CDX-NAIGS18V1 - 0615", "CDX.NA.IG.18", - "CDX_NA_IG_S18_03Y_06/15", 2456007, 2457194, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCO1", "CDX", 18, "NA IG", null, "IG", 1, 3, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.18.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927382", "42230", - "CDX-NAIGS18V1 - 0617", "CDX.NA.IG.18", - "CDX_NA_IG_S18_05Y_06/17", 2456007, 2457925, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCO1", "CDX", 18, "NA IG", null, "IG", 1, 5, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.5Y.18.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927383", "42231", - "CDX-NAIGS18V1 EUR - 0617", "CDX.NA.IG.18", - "CDX_NA_IG_S18_05Y_06/17_EUR", 2456007, 2457925, 0.01, "EUR", - "ACT/360", false, 0.4, 4, "2I65BYCO1", "CDX", 18, "NA IG", null, "IG", 1, 5, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.7Y.18.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927384", "42232", - "CDX-NAIGS18V1 - 0619", "CDX.NA.IG.18", - "CDX_NA_IG_S18_07Y_06/19", 2456007, 2458655, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCO1", "CDX", 18, "NA IG", null, "IG", 1, 7, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG.10Y.18.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927385", "42233", - "CDX-NAIGS18V1 - 0622", "CDX.NA.IG.18", - "CDX_NA_IG_S18_10Y_06/22", 2456007, 2459751, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65BYCO1", "CDX", 18, "NA IG", null, "IG", 1, 10, - null, 1, 125, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.3Y.18.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927386", "42241", - "CDX-NAIGHVOLS18V1 - 0615", "CDX.NA.IG.HVOL.18", - "CDX_NA_IG_S18_HVOL_03Y_06/15", 2456007, 2457194, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AT0", "CDX", 18, "NA IG HVOL", null, "HV", 1, 3, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.5Y.18.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927387", "42244", - "CDX-NAIGHVOLS18V1 - 0617", "CDX.NA.IG.HVOL.18", - "CDX_NA_IG_S18_HVOL_05Y_06/17", 2456007, 2457925, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AT0", "CDX", 18, "NA IG HVOL", null, "HV", 1, 5, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.EM.5Y.17.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927388", "42204", - "CDX-EMS17V1 - 0617", "CDX.EM.17", - "CDX EM 17 5YR", 2456007, 2457925, 0.05, "USD", - "ACT/360", false, 0.25, 4, "2I65BZAQ5", "CDX", 17, "EM", null, "EM", 1, 5, - null, 1, 15, 0, "NYC", false, false, false, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.7Y.18.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927393", "42245", - "CDX-NAIGHVOLS18V1 - 0619", "CDX.NA.IG.HVOL.18", - "CDX_NA_IG_S18_HVOL_07Y_06/19", 2456007, 2458655, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AT0", "CDX", 18, "NA IG HVOL", null, "HV", 1, 7, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("CDX.NA IG HVOL.10Y.18.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927395", "42675", - "CDX-NAIGHVOLS18V1 - 0622", "CDX.NA.IG.HVOL.18", - "CDX_NA_IG_S18_HVOL_10Y_06/22", 2456007, 2459751, 0.01, "USD", - "ACT/360", false, 0.4, 4, "2I65B3AT0", "CDX", 18, "NA IG HVOL", null, "HV", 1, 10, - null, 1, 30, 0, "NYC", false, false, true, null, "DJCDX")); - - UpdateCDXRefDataMap ("LCDX.LCDXNA.5Y.18.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927397", "46731", - "LCDXNAS18V1 - 0617", "LCDX.NA.18", - "CDX_NA_LN_S18_100", 2456007, 2457925, 0.025, "USD", - "ACT/360", false, 0.7000000000000001, 4, "5F199GFR3", "LCDX", 18, "LCDXNA", null, "IG", 1, 5, - null, 1, 100, 0, "NYC", false, false, true, null, "LCDX")); - - UpdateCDXRefDataMap ("Itraxx.SovX West Eur.5Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927398", "49438", - "Itraxx-SovX West Eur S4V2 - 1215", "Itraxx SovX Western Europe Series 4 Version 2", - "ITRAXX-SOVX WEST EUR S4V2-1215 USD SEN RES I03 CDS", 2455460, 2457377, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAK7", "Itraxx", 4, "SovX West Eur", "SOV", "SOWE", 2, 5, - null, 0.9333, 15, 0, "LON", false, false, true, null, "SOV")); - - UpdateCDXRefDataMap ("Itraxx.SovX West Eur.10Y.4.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927399", "49439", - "Itraxx-SovX West Eur S4V2 - 1220", "Itraxx SovX Western Europe Series 4 Version 2", - "ITRAXX-SOVX WEST EUR S4V2-1220 USD SEN RES I03 CDS", 2455460, 2459204, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAK7", "Itraxx", 4, "SovX West Eur", "SOV", "SOWE", 2, 10, - null, 0.9333, 15, 0, "LON", false, false, true, null, "SOV")); - - UpdateCDXRefDataMap ("ITRAXX.SOVXWE.5Y.1.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927400", "49415", - "ITRAXX-SOVXWES1V2 - 1214", "Itraxx SovX Western Europe Series 1 Version 2", - "ITRAXX-SOVX WEST EUR S1V2-1214 USD SEN RES I03 CDS", 2455103, 2457012, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAG6", "ITRAXX", 1, "SOVXWE", "SOV", "SOWE", 2, 5, - null, 0.9333, 15, 0, "LON", false, false, true, null, "SOV")); - - UpdateCDXRefDataMap ("ITRAXX.SOVXWE.10Y.1.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927401", "49430", - "ITRAXX-SOVXWES1V2 - 1219", "Itraxx SovX Western Europe Series 1 Version 2", - "ITRAXX-SOVX WEST EUR S1V2-1219 USD SEN RES I03 CDS", 2455103, 2458838, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAG6", "ITRAXX", 1, "SOVXWE", "SOV", "SOWE", 2, 10, - null, 0.9333, 15, 0, "LON", false, false, true, null, "SOV")); - - UpdateCDXRefDataMap ("Itraxx.SovX West Eur.5Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927402", "49444", - "Itraxx-SovX West Eur S5V2 - 0616", "Itraxx SovX Western Europe Series 5 Version 2", - "ITRAXX-SOVX WEST EUR S5V2-0616 USD SEN RES I03 CDS", 2455642, 2457560, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAL5", "Itraxx", 5, "SovX West Eur", "SOV", "SOWE", 2, 5, - "247006", 0.9333, 15, 0, "LON", true, true, true, null, "SOV")); - - UpdateCDXRefDataMap ("Itraxx.SovX West Eur.10Y.5.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927403", "49435", - "Itraxx-SovX West Eur S5V2 - 0621", "Itraxx SovX Western Europe Series 5 Version 2", - "ITRAXX-SOVX WEST EUR S5V2-0621 USD SEN RES I03 CDS", 2455642, 2459386, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAL5", "Itraxx", 5, "SovX West Eur", "SOV", "SOWE", 2, 10, - "247006", 0.9333, 15, 0, "LON", true, true, true, null, "SOV")); - - UpdateCDXRefDataMap ("Itraxx.SovX West Eur.5Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927404", "49472", - "Itraxx-SovX West Eur S2V2 - 1214", "Itraxx SovX Western Europe Series 2 Version 2", - "ITRAXX-SOVX WEST EUR S2V2-1214 USD SEN RES I03 CDS", 2455103, 2457012, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAH4", "Itraxx", 2, "SovX West Eur", "SOV", "SOWE", 2, 5, - "247008", 0.9333, 15, 0, "LON", true, true, true, null, "SOV")); - - UpdateCDXRefDataMap ("Itraxx.SovX West Eur.5Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927405", "49457", - "Itraxx-SovX West Eur S6V2 - 1216", "Itraxx SovX Western Europe Series 6 Version 2", - "ITRAXX-SOVX WEST EUR S6V2-1216 USD SEN RES I03 CDS", 2455825, 2457743, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAM3", "Itraxx", 6, "SovX West Eur", "SOV", "SOWE", 2, 5, - "247007", 0.9333, 15, 0, "LON", true, true, true, null, "SOV")); - - UpdateCDXRefDataMap ("Itraxx.SovX West Eur.10Y.2.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927406", "49424", - "Itraxx-SovX West Eur S2V2 - 1219", "Itraxx SovX Western Europe Series 2 Version 2", - "ITRAXX-SOVX WEST EUR S2V2-1219 USD SEN RES I03 CDS", 2455103, 2458838, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAH4", "Itraxx", 2, "SovX West Eur", "SOV", "SOWE", 2, 10, - "247008", 0.9333, 15, 0, "LON", true, true, true, null, "SOV")); - - UpdateCDXRefDataMap ("Itraxx.SovX West Eur.10Y.6.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927407", "49458", - "Itraxx-SovX West Eur S6V2 - 1221", "Itraxx SovX Western Europe Series 6 Version 2", - "ITRAXX-SOVX WEST EUR S6V2-1221 USD SEN RES I03 CDS", 2455825, 2459569, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAM3", "Itraxx", 6, "SovX West Eur", "SOV", "SOWE", 2, 10, - "247007", 0.9333, 15, 0, "LON", true, true, true, null, "SOV")); - - UpdateCDXRefDataMap ("Itraxx.SovX West Eur.10Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927409", "49431", - "Itraxx-SovX West Eur S3V2 - 0620", "Itraxx SovX Western Europe Series 3 Version 2", - "ITRAXX-SOVX WEST EUR S3V2-0620 USD SEN RES I03 CDS", 2455278, 2459021, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAJ0", "Itraxx", 3, "SovX West Eur", "SOV", "SOWE", 2, 10, - "247005", 0.9333, 15, 0, "LON", true, true, true, null, "SOV")); - - UpdateCDXRefDataMap ("Itraxx.SovX West Eur.5Y.3.2", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927411", "49489", - "Itraxx-SovX West Eur S3V2 - 0615", "Itraxx SovX Western Europe Series 3 Version 2", - "ITRAXX-SOVX WEST EUR S3V2-0615 USD SEN RES I03 CDS", 2455278, 2457194, 0.01, "USD", - "ACT/360", false, 0.4, 4, "5C769MAJ0", "Itraxx", 3, "SovX West Eur", "SOV", "SOWE", 2, 5, - "247005", 0.9333, 15, 0, "LON", true, true, true, null, "SOV")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.2.23", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927412", "49448", - "ITRAXX-LevXS2V23 - 0613", "iTraxx LevX Senior Series 2 Version 23", - "ITRAXX LEVX SENIOR SERIES 2 VERSION 23 EUR 1ST SEC RES I03 CDS", 2454543, 2456464, 0.052500000000000005, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJFA6", "ITRAXX", 2, "LevX", null, "IG", 23, 5, - null, 0.7066, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - return true; - } - - private static final boolean InitCDXRefDataSet43() - { - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.3.22", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927413", "49452", - "ITRAXX-LevXS3V22 - 1213", "iTraxx LevX Senior Series 3 Version 22", - "ITRAXX LEVX SENIOR SERIES 3 VERSION 22 EUR 1ST SEC RES I03 CDS", 2454739, 2456647, 0.0575, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJFB4", "ITRAXX", 3, "LevX", null, "IG", 22, 5, - null, 0.72, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.4.15", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927414", "49473", - "ITRAXX-LevXS4V15 - 0614", "iTraxx LevX Senior Series 4 Version 15", - "ITRAXX LEVX SENIOR SERIES 4 VERSION 15 EUR 1ST SEC RES I03 CDS", 2454911, 2456829, 0.05, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJFC2", "ITRAXX", 4, "LevX", null, "IG", 15, 5, - null, 0.72, 50, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.JAPAN80.5Y.7.5", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927427", "52959", - "ITRAXX-JAPAN80S7V5 - 0612", "iTraxx Japan 80 Series Number 7 Version 5", - "ITRAXX JAPAN 80 SERIES NUMBER 07 VERSION 5 JPY SEN RES I03 CDS", 2454180, 2456099, 0.0025, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "4ABCAHAI8", "ITRAXX", 7, "JAPAN80", null, "IG", 5, 5, - null, 0.9500000000000001, 79, 0, "TOK", false, false, true, null, "Itraxx Japan")); - - UpdateCDXRefDataMap ("ITRAXX.JHIVOL.5Y.7.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927429", "52961", - "ITRAXX-JAPANHIVOLS7V6 - 0612", "iTraxx Japan HiVol Series Number 7 Version 6", - "ITRAXX JAPAN HIVOL SERIES NUMBER 07 VERSION 6 JPY SEN RES I03 CDS DEC 20 2012", 2454180, 2456099, 0.006, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MBJ1", "ITRAXX", 7, "JHIVOL", "VOL", "HV", 6, 5, - null, 0.8, 24, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.8.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927430", "52972", - "ITRAXX-JAPANHIVOLS8V6 - 1212", "iTraxx Japan HiVol Series Number 8 Version 6", - "ITRAXX JAPAN HIVOL SERIES NUMBER 08 VERSION 6 JPY SEN RES I03 CDS", 2454364, 2456282, 0.007500000000000001, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MBK8", "ITRAXX", 8, "JAPANHIVOL", "VOL", "HV", 6, 5, - null, 0.8, 25, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("ITRAXX.JAPANHIVOL.5Y.9.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927431", "52964", - "ITRAXX-JAPANHIVOLS9V6 - 0613", "iTraxx Japan HiVol Series Number 9 Version 6", - "ITRAXX JAPAN HIVOL SERIES NUMBER 09 VERSION 6 JPY SEN RES I03 CDS", 2454546, 2456464, 0.035, "JPY", - "ACT/360", false, 0.35000000000000003, 4, "2I668MBL6", "ITRAXX", 9, "JAPANHIVOL", "VOL", "HV", 6, 5, - null, 0.8, 25, 0, "TOK", false, false, true, null, "VOL")); - - UpdateCDXRefDataMap ("MCDXNAS18V1.MCDXNA.3Y.18.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927434", "46770", - "MCDXNAS18V1 - 0615", "MCDX.NA.18", - "MCDX SERIES 18 3Y", 2456007, 2457194, 0.01, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAI8", "MCDXNAS18V1", 18, "MCDXNA", null, "IG", 1, 3, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("MCDXNAS18V1.MCDXNA.5Y.18.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927435", "46762", - "MCDXNAS18V1 - 0617", "MCDX.NA.18", - "MCDX SERIES 18 5Y", 2456007, 2457925, 0.01, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAI8", "MCDXNAS18V1", 18, "MCDXNA", null, "IG", 1, 5, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("MCDXNAS18V1.MCDXNA.10Y.18.1", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927436", "46759", - "MCDXNAS18V1 - 0622", "MCDX.NA.18", - "MCDX.NA.18 V1 10Y", 2456007, 2459751, 0.01, "USD", - "ACT/360", false, 0.75, 4, "5A79DPAI8", "MCDXNAS18V1", 18, "MCDXNA", null, "IG", 1, 10, - null, 1, 50, 0, "NYC", false, false, true, null, "CDX")); - - UpdateCDXRefDataMap ("ITRAXX.LevX.5Y.2.24", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927437", "55845", - "ITRAXX-LevXS2V24 - 0613", "iTraxx LevX Senior Series 2 Version 24", - "ITRAXX LEVX SENIOR SERIES 2 VERSION 24 EUR 1ST SEC RES I03 CDS", 2454543, 2456464, 0.052500000000000005, "EUR", - "ACT/360", false, 0.7000000000000001, 4, "4ABCAJKM4", "ITRAXX", 2, "LevX", null, "IG", 24, 5, - null, 0.6931999999999999, 75, 0, "LON", false, false, true, null, "Itraxx LevX")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.9.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927440", "56462", - "ITRAXX-XOVERS9V8 - 0615", "iTraxx Europe Crossover series 9 Version 8", - "ITRAXX-XOVERS9V8-0615 EUR SEN MMR I03 CDS", 2454546, 2457194, 0.0645, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCW6", "ITRAXX", 9, "XOVER", "XVR", "XO", 8, 7, - "247025", 0.88, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.9.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927441", "56466", - "ITRAXX-XOVERS9V8 - 0618", "iTraxx Europe Crossover series 9 Version 8", - "ITRAXX-XOVERS9V8-0618 EUR SEN MMR I03 CDS", 2454546, 2458290, 0.064, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCW6", "ITRAXX", 9, "XOVER", "XVR", "XO", 8, 10, - "247025", 0.88, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.9.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927442", "56491", - "USD ITRAXX-XOVERS9V8 - 0613", "iTraxx Europe Crossover series 9 Version 8", - "ITRAXX-XOVERS9V8-0613 USD SEN MMR I03 CDS", 2454546, 2456464, 0.065, "USD", - "ACT/360", false, 0.4, 4, "2I667KCW6", "USD ITRAXX", 9, "XOVER", "XVR", "XO", 8, 5, - null, 0.88, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.10.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927443", "56468", - "ITRAXX-XOVERS10V7 - 1215", "iTraxx Europe Crossover series 10 Version 7", - "ITRAXX-XOVERS10V7-1215 EUR SEN MMR I03 CDS", 2454739, 2457377, 0.055, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCQ9", "ITRAXX", 10, "XOVER", "XVR", "XO", 7, 7, - "247026", 0.9, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.10.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927444", "56461", - "ITRAXX-XOVERS10V7 - 1218", "iTraxx Europe Crossover series 10 Version 7", - "ITRAXX-XOVERS10V7-1218 EUR SEN MMR I03 CDS", 2454739, 2458473, 0.054, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCQ9", "ITRAXX", 10, "XOVER", "XVR", "XO", 7, 10, - "247026", 0.9, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.10.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927445", "56501", - "USD ITRAXX-XOVERS10V7 - 1213", "iTraxx Europe Crossover series 10 Version 7", - "ITRAXX-XOVERS10V7-1213 USD SEN MMR I03 CDS", 2454739, 2456647, 0.056, "USD", - "ACT/360", false, 0.4, 4, "2I667KCQ9", "USD ITRAXX", 10, "XOVER", "XVR", "XO", 7, 5, - null, 0.9, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.10.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927446", "56465", - "ITRAXX-XOVERS10V7 - 1213", "iTraxx Europe Crossover series 10 Version 7", - "ITRAXX-XOVERS10V7-1213 EUR SEN MMR I03 CDS", 2454739, 2456647, 0.056, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCQ9", "ITRAXX", 10, "XOVER", "XVR", "XO", 7, 5, - "247026", 0.9, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.10.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927447", "56505", - "USD ITRAXX-XOVERS10V7 - 1218", "iTraxx Europe Crossover series 10 Version 7", - "ITRAXX-XOVERS10V7-1218 USD SEN MMR I03 CDS", 2454739, 2458473, 0.054, "USD", - "ACT/360", false, 0.4, 4, "2I667KCQ9", "USD ITRAXX", 10, "XOVER", "XVR", "XO", 7, 10, - null, 0.9, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.11.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927448", "56469", - "ITRAXX-XOVERS11V4 - 0619", "iTraxx Europe Crossover series 11 Version 4", - "ITRAXX-XOVERS11V4-0619 EUR SEN MMR I03 CDS", 2454911, 2458655, 0.082, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCR7", "ITRAXX", 11, "XOVER", "XVR", "XO", 4, 10, - "247032", 0.9333, 45, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.11.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927449", "56511", - "USD ITRAXX-XOVERS11V4 - 0614", "iTraxx Europe Crossover series 11 Version 4", - "ITRAXX-XOVERS11V4-0614 USD SEN MMR I03 CDS", 2454911, 2456829, 0.0975, "USD", - "ACT/360", false, 0.4, 4, "2I667KCR7", "USD ITRAXX", 11, "XOVER", "XVR", "XO", 4, 5, - null, 0.9333, 45, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.6.6", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927450", "56481", - "ITRAXX-XOVERS6V6 - 1216", "iTraxx Europe Crossover series 6 Version 6", - "ITRAXX-XOVERS6V6-1216 EUR SEN MMR I03 CDS", 2453999, 2457743, 0.0345, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCT3", "ITRAXX", 6, "XOVER", "XVR", "XO", 6, 10, - "247027", 0.9109999999999999, 45, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.7.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927451", "56486", - "ITRAXX-XOVERS7V7 - 0614", "iTraxx Europe Crossover series 7 Version 7", - "ITRAXX-XOVERS7V7-0614 EUR SEN MMR I03 CDS", 2454180, 2456829, 0.0275, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCU0", "ITRAXX", 7, "XOVER", "XVR", "XO", 7, 7, - "247028", 0.9, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.7.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927452", "56492", - "ITRAXX-XOVERS7V7 - 0612", "iTraxx Europe Crossover series 7 Version 7", - "ITRAXX-XOVERS7V7-0612 EUR SEN MMR I03 CDS", 2454180, 2456099, 0.023, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCU0", "ITRAXX", 7, "XOVER", "XVR", "XO", 7, 5, - "247028", 0.9, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.7.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927453", "56500", - "ITRAXX-XOVERS7V7 - 0617", "iTraxx Europe Crossover series 7 Version 7", - "ITRAXX-XOVERS7V7-0617 EUR SEN MMR I03 CDS", 2454180, 2457925, 0.032, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCU0", "ITRAXX", 7, "XOVER", "XVR", "XO", 7, 10, - "247028", 0.9, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.7.7", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927454", "56488", - "USD ITRAXX-XOVERS7V7 - 0612", "iTraxx Europe Crossover series 7 Version 7", - "ITRAXX-XOVERS7V7-0612 USD SEN MMR I03 CDS", 2454180, 2456099, 0.023, "USD", - "ACT/360", false, 0.4, 4, "2I667KCU0", "USD ITRAXX", 7, "XOVER", "XVR", "XO", 7, 5, - null, 0.9, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.13.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927455", "56498", - "ITRAXX-XOVERS13V4 - 0615", "iTraxx Europe Crossover series 13 Version 4", - "ITRAXX-XOVERS13V4-0615 EUR SEN MMR I03 CDS", 2455278, 2457194, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCX4", "ITRAXX", 13, "XOVER", "XVR", "XO", 4, 5, - "247030", 0.96, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.8.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927456", "56503", - "ITRAXX-XOVERS8V8 - 1212", "iTraxx Europe Crossover series 8 Version 8", - "ITRAXX-XOVERS8V8-1212 EUR SEN MMR I03 CDS", 2454364, 2456282, 0.0375, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCV8", "ITRAXX", 8, "XOVER", "XVR", "XO", 8, 5, - "247029", 0.88, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.8.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927457", "56457", - "ITRAXX-XOVERS8V8 - 1217", "iTraxx Europe Crossover series 8 Version 8", - "ITRAXX-XOVERS8V8-1217 EUR SEN MMR I03 CDS", 2454364, 2458108, 0.046, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCV8", "ITRAXX", 8, "XOVER", "XVR", "XO", 8, 10, - "247029", 0.88, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.13.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927458", "56504", - "ITRAXX-XOVERS13V4 - 0617", "iTraxx Europe Crossover series 13 Version 4", - "ITRAXX-XOVERS13V4-0617 EUR SEN MMR I03 CDS", 2455278, 2457925, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCX4", "ITRAXX", 13, "XOVER", "XVR", "XO", 4, 7, - "247030", 0.96, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.8.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927459", "56514", - "USD ITRAXX-XOVERS8V8 - 1212", "iTraxx Europe Crossover series 8 Version 8", - "ITRAXX-XOVERS8V8-1212 USD SEN MMR I03 CDS", 2454364, 2456282, 0.0375, "USD", - "ACT/360", false, 0.4, 4, "2I667KCV8", "USD ITRAXX", 8, "XOVER", "XVR", "XO", 8, 5, - null, 0.88, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.8.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927460", "56523", - "ITRAXX-XOVERS8V8 - 1214", "iTraxx Europe Crossover series 8 Version 8", - "ITRAXX-XOVERS8V8-1214 EUR SEN MMR I03 CDS", 2454364, 2457012, 0.039, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCV8", "ITRAXX", 8, "XOVER", "XVR", "XO", 8, 7, - "247029", 0.88, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.9.8", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927461", "56459", - "ITRAXX-XOVERS9V8 - 0613", "iTraxx Europe Crossover series 9 Version 8", - "ITRAXX-XOVERS9V8-0613 EUR SEN MMR I03 CDS", 2454546, 2456464, 0.065, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCW6", "ITRAXX", 9, "XOVER", "XVR", "XO", 8, 5, - "247025", 0.88, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.13.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927462", "56518", - "ITRAXX-XOVERS13V4 - 0620", "iTraxx Europe Crossover series 13 Version 4", - "ITRAXX-XOVERS13V4-0620 EUR SEN MMR I03 CDS", 2455278, 2459021, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCX4", "ITRAXX", 13, "XOVER", "XVR", "XO", 4, 10, - "247030", 0.96, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.13.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927463", "56521", - "USD ITRAXX-XOVERS13V4 - 0615", "iTraxx Europe Crossover series 13 Version 4", - "ITRAXX-XOVERS13V4-0615 USD SEN MMR I03 CDS", 2455278, 2457194, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KCX4", "USD ITRAXX", 13, "XOVER", "XVR", "XO", 4, 5, - null, 0.96, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.13.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927464", "56533", - "USD ITRAXX-XOVERS13V4 - 0620", "iTraxx Europe Crossover series 13 Version 4", - "ITRAXX-XOVERS13V4-0620 USD SEN MMR I03 CDS", 2455278, 2459021, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KCX4", "USD ITRAXX", 13, "XOVER", "XVR", "XO", 4, 10, - null, 0.96, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.14.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927465", "56516", - "USD ITRAXX-XOVERS14V3 - 1215", "iTraxx Europe Crossover series 14 Version 3", - "ITRAXX-XOVERS14V3-1215 USD SEN MMR I03 CDS", 2455460, 2457377, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KCP1", "USD ITRAXX", 14, "XOVER", "XVR", "XO", 3, 5, - null, 0.96, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.14.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927466", "56520", - "USD ITRAXX-XOVERS14V3 - 1220", "iTraxx Europe Crossover series 14 Version 3", - "ITRAXX-XOVERS14V3-1220 USD SEN MMR I03 CDS", 2455460, 2459204, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KCP1", "USD ITRAXX", 14, "XOVER", "XVR", "XO", 3, 10, - null, 0.96, 50, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.14.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927467", "56508", - "ITRAXX-XOVERS14V3 - 1213", "iTraxx Europe Crossover series 14 Version 3", - "ITRAXX-XOVERS14V3-1213 EUR SEN MMR I03 CDS", 2455460, 2456647, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCP1", "ITRAXX", 14, "XOVER", "XVR", "XO", 3, 3, - "247031", 0.96, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.14.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927468", "56512", - "ITRAXX-XOVERS14V3 - 1215", "iTraxx Europe Crossover series 14 Version 3", - "ITRAXX-XOVERS14V3-1215 EUR SEN MMR I03 CDS", 2455460, 2457377, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCP1", "ITRAXX", 14, "XOVER", "XVR", "XO", 3, 5, - "247031", 0.96, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.14.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927469", "56475", - "ITRAXX-XOVERS14V3 - 1217", "iTraxx Europe Crossover series 14 Version 3", - "ITRAXX-XOVERS14V3-1217 EUR SEN MMR I03 CDS", 2455460, 2458108, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCP1", "ITRAXX", 14, "XOVER", "XVR", "XO", 3, 7, - "247031", 0.96, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.14.3", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927470", "56478", - "ITRAXX-XOVERS14V3 - 1220", "iTraxx Europe Crossover series 14 Version 3", - "ITRAXX-XOVERS14V3-1220 EUR SEN MMR I03 CDS", 2455460, 2459204, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCP1", "ITRAXX", 14, "XOVER", "XVR", "XO", 3, 10, - "247031", 0.96, 50, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.11.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927471", "56479", - "USD ITRAXX-XOVERS11V4 - 0619", "iTraxx Europe Crossover series 11 Version 4", - "ITRAXX-XOVERS11V4-0619 USD SEN MMR I03 CDS", 2454911, 2458655, 0.082, "USD", - "ACT/360", false, 0.4, 4, "2I667KCR7", "USD ITRAXX", 11, "XOVER", "XVR", "XO", 4, 10, - null, 0.9333, 45, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.11.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927472", "56476", - "ITRAXX-XOVERS11V4 - 0612", "iTraxx Europe Crossover series 11 Version 4", - "ITRAXX-XOVERS11V4-0612 EUR SEN MMR I03 CDS", 2454911, 2456099, 0.11, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCR7", "ITRAXX", 11, "XOVER", "XVR", "XO", 4, 3, - "247032", 0.9333, 45, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.11.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927473", "56477", - "ITRAXX-XOVERS11V4 - 0614", "iTraxx Europe Crossover series 11 Version 4", - "ITRAXX-XOVERS11V4-0614 EUR SEN MMR I03 CDS", 2454911, 2456829, 0.0975, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCR7", "ITRAXX", 11, "XOVER", "XVR", "XO", 4, 5, - "247032", 0.9333, 45, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.11.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927474", "56458", - "ITRAXX-XOVERS11V4 - 0616", "iTraxx Europe Crossover series 11 Version 4", - "ITRAXX-XOVERS11V4-0616 EUR SEN MMR I03 CDS", 2454911, 2457560, 0.08800000000000001, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCR7", "ITRAXX", 11, "XOVER", "XVR", "XO", 4, 7, - "247032", 0.9333, 45, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.12.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927475", "56463", - "ITRAXX-XOVERS12V4 - 1212", "iTraxx Europe Crossover series 12 VERSION 4", - "ITRAXX-XOVERS12V4-1212 EUR SEN MMR I03 CDS", 2455096, 2456282, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCS5", "ITRAXX", 12, "XOVER", "XVR", "XO", 4, 3, - "247033", 0.96, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.5Y.12.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927476", "56467", - "ITRAXX-XOVERS12V4 - 1214", "iTraxx Europe Crossover series 12 Version 4", - "ITRAXX-XOVERS12V4-1214 EUR SEN MMR I03 CDS", 2455096, 2457012, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCS5", "ITRAXX", 12, "XOVER", "XVR", "XO", 4, 5, - "247033", 0.96, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.7Y.12.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927477", "56470", - "ITRAXX-XOVERS12V4 - 1216", "iTraxx Europe Crossover series 12 Version 4", - "ITRAXX-XOVERS12V4-1216 EUR SEN MMR I03 CDS", 2455096, 2457743, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCS5", "ITRAXX", 12, "XOVER", "XVR", "XO", 4, 7, - "247033", 0.96, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.10Y.12.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927478", "56474", - "ITRAXX-XOVERS12V4 - 1219", "iTraxx Europe Crossover series 12 Version 4", - "ITRAXX-XOVERS12V4-1219 EUR SEN MMR I03 CDS", 2455096, 2458838, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCS5", "ITRAXX", 12, "XOVER", "XVR", "XO", 4, 10, - "247033", 0.96, 51, 0, "LON", true, true, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.5Y.12.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927479", "56485", - "USD ITRAXX-XOVERS12V4 - 1214", "iTraxx Europe Crossover series 12 Version 4", - "ITRAXX-XOVERS12V4-1214 USD SEN MMR I03 CDS", 2455096, 2457012, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KCS5", "USD ITRAXX", 12, "XOVER", "XVR", "XO", 4, 5, - null, 0.96, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("USD ITRAXX.XOVER.10Y.12.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927480", "56490", - "USD ITRAXX-XOVERS12V4 - 1219", "iTraxx Europe Crossover series 12 Version 4", - "ITRAXX-XOVERS12V4-1219 USD SEN MMR I03 CDS", 2455096, 2458838, 0.05, "USD", - "ACT/360", false, 0.4, 4, "2I667KCS5", "USD ITRAXX", 12, "XOVER", "XVR", "XO", 4, 10, - null, 0.96, 51, 0, "LON", false, false, true, null, "XVR")); - - UpdateCDXRefDataMap ("ITRAXX.XOVER.3Y.13.4", - org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder ("927481", "56487", - "ITRAXX-XOVERS13V4 - 0613", "iTraxx Europe Crossover series 13 Version 4", - "ITRAXX-XOVERS13V4-0613 EUR SEN MMR I03 CDS", 2455278, 2456464, 0.05, "EUR", - "ACT/360", false, 0.4, 4, "2I667KCX4", "ITRAXX", 13, "XOVER", "XVR", "XO", 4, 3, - "247030", 0.96, 51, 0, "LON", true, true, true, null, "XVR")); - - return true; - } - - public static final boolean InitFullCDXRefDataSet() - { - if (!InitCDXRefDataSet1()) return false; - - if (!InitCDXRefDataSet2()) return false; - - if (!InitCDXRefDataSet3()) return false; - - if (!InitCDXRefDataSet4()) return false; - - if (!InitCDXRefDataSet5()) return false; - - if (!InitCDXRefDataSet6()) return false; - - if (!InitCDXRefDataSet7()) return false; - - if (!InitCDXRefDataSet8()) return false; - - if (!InitCDXRefDataSet9()) return false; - - if (!InitCDXRefDataSet10()) return false; - - if (!InitCDXRefDataSet11()) return false; - - if (!InitCDXRefDataSet12()) return false; - - if (!InitCDXRefDataSet13()) return false; - - if (!InitCDXRefDataSet14()) return false; - - if (!InitCDXRefDataSet15()) return false; - - if (!InitCDXRefDataSet16()) return false; - - if (!InitCDXRefDataSet17()) return false; - - if (!InitCDXRefDataSet18()) return false; - - if (!InitCDXRefDataSet19()) return false; - - if (!InitCDXRefDataSet20()) return false; - - if (!InitCDXRefDataSet21()) return false; - - if (!InitCDXRefDataSet22()) return false; - - if (!InitCDXRefDataSet23()) return false; - - if (!InitCDXRefDataSet24()) return false; - - if (!InitCDXRefDataSet25()) return false; - - if (!InitCDXRefDataSet26()) return false; - - if (!InitCDXRefDataSet27()) return false; - - if (!InitCDXRefDataSet28()) return false; - - if (!InitCDXRefDataSet29()) return false; - - if (!InitCDXRefDataSet30()) return false; - - if (!InitCDXRefDataSet31()) return false; - - if (!InitCDXRefDataSet32()) return false; - - if (!InitCDXRefDataSet33()) return false; - - if (!InitCDXRefDataSet34()) return false; - - if (!InitCDXRefDataSet35()) return false; - - if (!InitCDXRefDataSet36()) return false; - - if (!InitCDXRefDataSet37()) return false; - - if (!InitCDXRefDataSet38()) return false; - - if (!InitCDXRefDataSet39()) return false; - - if (!InitCDXRefDataSet40()) return false; - - if (!InitCDXRefDataSet41()) return false; - - if (!InitCDXRefDataSet42()) return false; - - if (!InitCDXRefDataSet43()) return false; - - return true; - } -} diff --git a/org/drip/product/creator/ConstantPaymentBondBuilder.java b/org/drip/product/creator/ConstantPaymentBondBuilder.java deleted file mode 100644 index 8ce27e4..0000000 --- a/org/drip/product/creator/ConstantPaymentBondBuilder.java +++ /dev/null @@ -1,291 +0,0 @@ - -package org.drip.product.creator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ConstantPaymentBondBuilder contains the Suite of Helper Functions for creating Constant Payments Based - * Bonds. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConstantPaymentBondBuilder { - - /** - * Construct an Instance of the Constant Payment Bond - * - * @param strName Mortgage Bond Instance Name - * @param dtEffective Effective Date - * @param strCurrency Currency - * @param iNumPayment The (Maximum) Number of Payments - * @param strDayCount Coupon/Accrual Day Count - * @param iPayFrequency Pay Frequency - * @param dblCouponRate The Coupon Rate - * @param dblFeeRate The Fee Rate - * @param dblConstantAmount The Fixed Monthly Amount - * @param dblInitialNotional The Initial Bond Notional - * - * @return Instance of the Fixed Mortgage Product - */ - - public static final org.drip.product.credit.BondComponent Standard ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtEffective, - final java.lang.String strCurrency, - final int iNumPayment, - final java.lang.String strDayCount, - final int iPayFrequency, - final double dblCouponRate, - final double dblFeeRate, - final double dblConstantAmount, - final double dblInitialNotional) - { - if (null == dtEffective || !org.drip.quant.common.NumberUtil.IsValid (dblCouponRate) || - !org.drip.quant.common.NumberUtil.IsValid (dblFeeRate) || dblFeeRate > dblCouponRate || - !org.drip.quant.common.NumberUtil.IsValid (dblConstantAmount) || - !org.drip.quant.common.NumberUtil.IsValid (dblInitialNotional)) - return null; - - double dblOutstandingPrincipal = dblInitialNotional; - - java.util.List lsCouponPayment = new java.util.ArrayList(); - - java.util.List lsOutstandingPrincipal = new - java.util.ArrayList(); - - java.util.List lsPaymentDate = new - java.util.ArrayList(); - - for (int i = 0; i < iNumPayment; ++i) { - double dblCouponPayment = java.lang.Double.NaN; - - org.drip.analytics.date.JulianDate dtPayment = dtEffective.addMonths (i + 1); - - org.drip.analytics.date.JulianDate dtPrev = 0 == i ? dtEffective : lsPaymentDate.get (i - 1); - - try { - dblCouponPayment = dblOutstandingPrincipal * (dblCouponRate - dblFeeRate) * - org.drip.analytics.daycount.Convention.YearFraction (dtPrev.julian(), dtPayment.julian(), - strDayCount, false, null, ""); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - lsPaymentDate.add (dtPayment); - - lsCouponPayment.add (dblCouponPayment); - - double dblPrincipalPayment = dblConstantAmount - dblCouponPayment; - - if (dblPrincipalPayment > dblOutstandingPrincipal) { - lsOutstandingPrincipal.add (0.); - - break; - } - - dblOutstandingPrincipal -= dblPrincipalPayment; - - lsOutstandingPrincipal.add (dblOutstandingPrincipal); - } - - int iNumValidPayment = lsOutstandingPrincipal.size(); - - double[] adblCouponPayment = new double[iNumValidPayment]; - double[] adblOutstandingPrincipal = new double[iNumValidPayment]; - org.drip.analytics.date.JulianDate[] adtPayment = new - org.drip.analytics.date.JulianDate[iNumValidPayment]; - - for (int i = 0; i < iNumValidPayment; ++i) { - adtPayment[i] = lsPaymentDate.get (i); - - adblCouponPayment[i] = lsCouponPayment.get (i); - - adblOutstandingPrincipal[i] = lsOutstandingPrincipal.get (i); - } - - return org.drip.product.creator.BondBuilder.CreateBondFromCF (strName, dtEffective, strCurrency, "", - strDayCount, dblInitialNotional, dblCouponRate - dblFeeRate, iPayFrequency, adtPayment, - adblCouponPayment, adblOutstandingPrincipal, false); - } - - /** - * Construct an Instance of the Constant Payment Bond with a Deterministic Pre-payment Rate - * - * @param strName Mortgage Bond Instance Name - * @param dtEffective Effective Date - * @param strCurrency Currency - * @param iNumPayment The (Maximum) Number of Payments - * @param strDayCount Coupon/Accrual Day Count - * @param iPayFrequency Pay Frequency - * @param dblCouponRate The Coupon Rate - * @param dblFeeRate The Fee Rate - * @param dblCPR the Constant Pre-payment Rate - * @param dblConstantAmount The Fixed Monthly Amount - * @param dblInitialNotional The Initial Bond Notional - * - * @return Instance of the Fixed Mortgage Product - */ - - public static final org.drip.product.credit.BondComponent Prepay ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtEffective, - final java.lang.String strCurrency, - final int iNumPayment, - final java.lang.String strDayCount, - final int iPayFrequency, - final double dblCouponRate, - final double dblFeeRate, - final double dblCPR, - final double dblConstantAmount, - final double dblInitialNotional) - { - if (null == dtEffective || !org.drip.quant.common.NumberUtil.IsValid (dblCouponRate) || - !org.drip.quant.common.NumberUtil.IsValid (dblFeeRate) || dblFeeRate > dblCouponRate || - !org.drip.quant.common.NumberUtil.IsValid (dblCPR) || - !org.drip.quant.common.NumberUtil.IsValid (dblConstantAmount) || - !org.drip.quant.common.NumberUtil.IsValid (dblInitialNotional)) - return null; - - double dblOutstandingPrincipal = dblInitialNotional; - - java.util.List lsCouponPayment = new java.util.ArrayList(); - - java.util.List lsOutstandingPrincipal = new - java.util.ArrayList(); - - java.util.List lsPaymentDate = new - java.util.ArrayList(); - - for (int i = 0; i < iNumPayment; ++i) { - double dblCouponPayment = java.lang.Double.NaN; - - org.drip.analytics.date.JulianDate dtPayment = dtEffective.addMonths (i + 1); - - org.drip.analytics.date.JulianDate dtPrev = 0 == i ? dtEffective : lsPaymentDate.get (i - 1); - - try { - dblCouponPayment = dblOutstandingPrincipal * (dblCouponRate - dblFeeRate) * - org.drip.analytics.daycount.Convention.YearFraction (dtPrev.julian(), dtPayment.julian(), - strDayCount, false, null, ""); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - lsPaymentDate.add (dtPayment); - - lsCouponPayment.add (dblCouponPayment); - - double dblPrincipalPayment = dblConstantAmount - dblCouponPayment + dblCPR * - dblOutstandingPrincipal; - - if (dblPrincipalPayment > dblOutstandingPrincipal) { - lsOutstandingPrincipal.add (0.); - - break; - } - - dblOutstandingPrincipal -= dblPrincipalPayment; - - lsOutstandingPrincipal.add (dblOutstandingPrincipal); - } - - int iNumValidPayment = lsOutstandingPrincipal.size(); - - double[] adblCouponPayment = new double[iNumValidPayment]; - double[] adblOutstandingPrincipal = new double[iNumValidPayment]; - org.drip.analytics.date.JulianDate[] adtPayment = new - org.drip.analytics.date.JulianDate[iNumValidPayment]; - - for (int i = 0; i < iNumValidPayment; ++i) { - adtPayment[i] = lsPaymentDate.get (i); - - adblCouponPayment[i] = lsCouponPayment.get (i); - - adblOutstandingPrincipal[i] = lsOutstandingPrincipal.get (i); - } - - return org.drip.product.creator.BondBuilder.CreateBondFromCF (strName, dtEffective, strCurrency, "", - strDayCount, dblInitialNotional, dblCouponRate - dblFeeRate, iPayFrequency, adtPayment, - adblCouponPayment, adblOutstandingPrincipal, false); - } - - /** - * Compute the Constant Uniform Payment Amount for the Parameters of the Specified Mortgage Bond - * - * @param dblBondNotional The Current Notional - * @param dblCouponRate The Coupon Rate - * @param iTenorInYears Tenor in Years - * - * @return The Constant Uniform Payment Amount - * - * @throws java.lang.Exception Thrown if the Constant Uniform Payment Amount cannot be computed - */ - - public static final double ConstantUniformPaymentAmount ( - final double dblBondNotional, - final double dblCouponRate, - final int iTenorInYears) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBondNotional) || - !org.drip.quant.common.NumberUtil.IsValid (dblCouponRate)) - throw new java.lang.Exception - ("ConstantPaymentBondBuilder::ConstantUniformPaymentAmount => Invalid Inputs"); - - int iNumPeriod = iTenorInYears * 12; - double dblPeriodRate = dblCouponRate / 12.; - - return dblPeriodRate * dblBondNotional * java.lang.Math.pow (1. + dblPeriodRate, iNumPeriod - 1) / - (java.lang.Math.pow (1. + dblPeriodRate, iNumPeriod) - 1.); - } -} diff --git a/org/drip/product/creator/DualStreamComponentBuilder.java b/org/drip/product/creator/DualStreamComponentBuilder.java deleted file mode 100644 index cbc2e33..0000000 --- a/org/drip/product/creator/DualStreamComponentBuilder.java +++ /dev/null @@ -1,111 +0,0 @@ - -package org.drip.product.creator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * DualStreamComponentBuilder contains the suite of helper functions for creating the Stream-based Dual - * Streams from different kinds of inputs. In particular, it exposes the following functionality: - * - Construction of the fix-float swap component. - * - Construction of the float-float swap component. - * - Construction of the generic dual stream component. - * - * @author Lakshmi Krishnamurthy - */ - -public class DualStreamComponentBuilder { - - /** - * Make the FixFloatComponent Instance from the Reference Fixed and the Derived Floating Streams - * - * @param fixReference The Reference Fixed Stream - * @param floatDerived The Derived Floating Stream - * @param csp Cash Settle Parameters - * - * @return The FixFloatComponent Instance - */ - - public static final org.drip.product.rates.FixFloatComponent MakeFixFloat ( - final org.drip.product.rates.Stream fixReference, - final org.drip.product.rates.Stream floatDerived, - final org.drip.param.valuation.CashSettleParams csp) - { - try { - return new org.drip.product.rates.FixFloatComponent (fixReference, floatDerived, csp); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Make the FloatFloatComponent Instance from the Reference and the Derived Floating Streams - * - * @param floatReference The Reference Floating Stream - * @param floatDerived The Derived Floating Stream - * @param csp Cash Settle Parameters - * - * @return The FloatFloatComponent Instance - */ - - public static final org.drip.product.rates.FloatFloatComponent MakeFloatFloat ( - final org.drip.product.rates.Stream floatReference, - final org.drip.product.rates.Stream floatDerived, - final org.drip.param.valuation.CashSettleParams csp) - { - try { - return new org.drip.product.rates.FloatFloatComponent (floatReference, floatDerived, csp); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/product/creator/SingleStreamComponentBuilder.java b/org/drip/product/creator/SingleStreamComponentBuilder.java deleted file mode 100644 index 8c51e0c..0000000 --- a/org/drip/product/creator/SingleStreamComponentBuilder.java +++ /dev/null @@ -1,356 +0,0 @@ - -package org.drip.product.creator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * IRFutureBuilder contains the suite of helper functions for creating the Futures product and product pack - * from the parameters/codes/byte array streams. It also contains function to construct EDF codes and the - * EDF product from code. - * - * @author Lakshmi Krishnamurthy - */ - -public class SingleStreamComponentBuilder { - - /** - * Construct the Forward Rate Futures Code given a Effective Date - * - * @param strPrefix The Forward Rate Futures Code Prefix - * @param iEffectiveDate Double representing the Effective JulianDate - * - * @return The Forward Rate Futures Code - */ - - public static java.lang.String ForwardRateFuturesCode ( - final java.lang.String strPrefix, - final int iEffectiveDate) - { - try { - return strPrefix + org.drip.analytics.date.DateUtil.CodeFromMonth - (org.drip.analytics.date.DateUtil.Month (iEffectiveDate)) + - (org.drip.analytics.date.DateUtil.Year (iEffectiveDate) % 10); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate a Forward Rate Futures Pack corresponding to the Specified Number of Contracts - * - * @param dtSpot Spot Date specifying the Contract Issue - * @param iNumContract Number of Contracts - * @param strCurrency Contract Currency String - * - * @return Array of Forward Rate Futures - */ - - public static org.drip.product.rates.SingleStreamComponent[] ForwardRateFuturesPack ( - final org.drip.analytics.date.JulianDate dtSpot, - final int iNumContract, - final java.lang.String strCurrency) - { - if (null == dtSpot || 0 >= iNumContract || null == strCurrency || strCurrency.isEmpty()) return null; - - org.drip.product.rates.SingleStreamComponent[] aSSC = new - org.drip.product.rates.SingleStreamComponent[iNumContract]; - - try { - org.drip.param.period.ComposableFloatingUnitSetting cfus = new - org.drip.param.period.ComposableFloatingUnitSetting ("3M", - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, null, - org.drip.state.identifier.ForwardLabel.Standard (strCurrency + "-3M"), - org.drip.analytics.support.CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0.); - - org.drip.param.period.CompositePeriodSetting cps = new - org.drip.param.period.CompositePeriodSetting (4, "3M", strCurrency, null, 1., null, null, - null, null); - - org.drip.param.valuation.CashSettleParams csp = new org.drip.param.valuation.CashSettleParams (0, - strCurrency, 0); - - org.drip.analytics.date.JulianDate dtStart = dtSpot.nextRatesFuturesIMM (3); - - for (int i = 0; i < iNumContract; ++i) { - org.drip.analytics.date.JulianDate dtMaturity = dtStart.addMonths (3); - - aSSC[i] = new org.drip.product.rates.SingleStreamComponent ("FUTURE_" + i, new - org.drip.product.rates.Stream - (org.drip.analytics.support.CompositePeriodBuilder.FloatingCompositeUnit - (org.drip.analytics.support.CompositePeriodBuilder.EdgePair (dtStart, - dtMaturity), cps, cfus)), csp); - - aSSC[i].setPrimaryCode (ForwardRateFuturesCode ("USD".equalsIgnoreCase (strCurrency) ? "ED" : - strCurrency, dtStart.julian())); - - dtStart = dtMaturity; - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return aSSC; - } - - /** - * Create a Deposit Product from the Effective and the Maturity Dates, and the Forward Label - * - * @param dtEffective Effective date - * @param dtMaturity Maturity - * @param fri The Floating Rate Index - * - * @return Deposit product - */ - - public static final org.drip.product.rates.SingleStreamComponent Deposit ( - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity, - final org.drip.state.identifier.ForwardLabel fri) - { - java.lang.String strTenor = fri.tenor(); - - java.lang.String strCurrency = fri.currency(); - - boolean bIsON = "ON".equalsIgnoreCase (strTenor); - - java.lang.String strCode = "DEPOSIT::" + fri.fullyQualifiedName() + "::{" + dtEffective + "->" + - dtMaturity + "}"; - - try { - int iFreq = bIsON ? 360 : org.drip.analytics.support.Helper.TenorToFreq (strTenor); - - org.drip.param.period.ComposableFloatingUnitSetting cfus = new - org.drip.param.period.ComposableFloatingUnitSetting (strTenor, bIsON ? - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_OVERNIGHT : - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, null, - fri, - org.drip.analytics.support.CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0.); - - org.drip.param.period.CompositePeriodSetting cps = new - org.drip.param.period.CompositePeriodSetting (iFreq, strTenor, strCurrency, - fri.floaterIndex().spotLagDAPForward(), 1., null, null, null, null); - - org.drip.product.rates.SingleStreamComponent sscDeposit = new - org.drip.product.rates.SingleStreamComponent (strCode, new org.drip.product.rates.Stream - (org.drip.analytics.support.CompositePeriodBuilder.FloatingCompositeUnit - (org.drip.analytics.support.CompositePeriodBuilder.EdgePair (dtEffective, - dtMaturity), cps, cfus)), new org.drip.param.valuation.CashSettleParams (0, - strCurrency, 0)); - - sscDeposit.setPrimaryCode (strCode); - - return sscDeposit; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create a Standard FRA from the Spot Date, the Forward Label, and the Strike - * - * @param dtForwardStart Forward Start Date - * @param forwardLabel The Floating Rate Index - * @param dblStrike Futures Strike - * - * @return The Standard FRA Instance - */ - - public static final org.drip.product.fra.FRAStandardComponent FRAStandard ( - final org.drip.analytics.date.JulianDate dtForwardStart, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final double dblStrike) - { - if (null == dtForwardStart || null == forwardLabel) return null; - - java.lang.String strCurrency = forwardLabel.currency(); - - org.drip.analytics.date.JulianDate dtEffective = null; - - org.drip.analytics.daycount.DateAdjustParams dapEffective = - forwardLabel.floaterIndex().spotLagDAPForward(); - - try { - dtEffective = null == dapEffective ? dtForwardStart : new org.drip.analytics.date.JulianDate - (dapEffective.roll (dtForwardStart.julian())); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - java.lang.String strTenor = forwardLabel.tenor(); - - boolean bIsON = "ON".equalsIgnoreCase (strTenor); - - org.drip.analytics.date.JulianDate dtMaturity = dtEffective.addTenor (strTenor); - - java.lang.String strCode = (0 == dblStrike ? "FUTURES::" : "FRA::") + - forwardLabel.fullyQualifiedName() + "::{" + dtEffective + "->" + dtMaturity + "}"; - - try { - int iFreq = bIsON ? 360 : 12 / org.drip.analytics.support.Helper.TenorToMonths (strTenor); - - org.drip.param.period.ComposableFloatingUnitSetting cfus = new - org.drip.param.period.ComposableFloatingUnitSetting (strTenor, bIsON ? - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_OVERNIGHT : - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, null, - forwardLabel, - org.drip.analytics.support.CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0.); - - org.drip.param.period.CompositePeriodSetting cps = new - org.drip.param.period.CompositePeriodSetting (iFreq, strTenor, strCurrency, null, 1., null, - null, null, null); - - org.drip.product.fra.FRAStandardComponent sscDeposit = new - org.drip.product.fra.FRAStandardComponent (strCode, new org.drip.product.rates.Stream - (org.drip.analytics.support.CompositePeriodBuilder.FloatingCompositeUnit - (org.drip.analytics.support.CompositePeriodBuilder.EdgePair (dtEffective, - dtMaturity), cps, cfus)), dblStrike, new - org.drip.param.valuation.CashSettleParams (0, strCurrency, 0)); - - sscDeposit.setPrimaryCode (strCode); - - return sscDeposit; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create a FRA Market Component Instance from the Spot Date, the Forward Label, and the Strike - * - * @param dtForwardStart Forward Start Date - * @param forwardLabel The Floating Rate Index - * @param dblStrike Futures Strike - * - * @return The Futures Product - */ - - public static final org.drip.product.fra.FRAMarketComponent FRAMarket ( - final org.drip.analytics.date.JulianDate dtForwardStart, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final double dblStrike) - { - if (null == dtForwardStart || null == forwardLabel) return null; - - org.drip.analytics.date.JulianDate dtEffective = dtForwardStart; - - java.lang.String strTenor = forwardLabel.tenor(); - - java.lang.String strCurrency = forwardLabel.currency(); - - boolean bIsON = "ON".equalsIgnoreCase (strTenor); - - org.drip.analytics.date.JulianDate dtMaturity = dtEffective.addTenor (strTenor); - - java.lang.String strCode = "FUTURES::" + forwardLabel.fullyQualifiedName() + "::{" + dtEffective + - "->" + dtMaturity + "}"; - - try { - int iFreq = org.drip.analytics.support.Helper.TenorToFreq (strTenor); - - org.drip.param.period.ComposableFloatingUnitSetting cfus = new - org.drip.param.period.ComposableFloatingUnitSetting (strTenor, bIsON ? - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_OVERNIGHT : - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, null, - forwardLabel, - org.drip.analytics.support.CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0.); - - org.drip.param.period.CompositePeriodSetting cps = new - org.drip.param.period.CompositePeriodSetting (iFreq, strTenor, strCurrency, null, 1., null, - null, null, null); - - org.drip.product.fra.FRAMarketComponent sscDeposit = new org.drip.product.fra.FRAMarketComponent - (strCode, new org.drip.product.rates.Stream - (org.drip.analytics.support.CompositePeriodBuilder.FloatingCompositeUnit - (org.drip.analytics.support.CompositePeriodBuilder.EdgePair (dtEffective, - dtMaturity), cps, cfus)), dblStrike, new - org.drip.param.valuation.CashSettleParams (0, strCurrency, 0)); - - sscDeposit.setPrimaryCode (strCode); - - return sscDeposit; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create a Forward Rate Futures Product Instance from the Spot Date and the Forward Label - * - * @param dtSpot Spot Date - * @param fri The Floating Rate Index - * - * @return The Forward Rate Futures Product Instance - */ - - public static final org.drip.product.fra.FRAStandardComponent ForwardRateFutures ( - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.state.identifier.ForwardLabel fri) - { - return FRAStandard (dtSpot, fri, 0.); - } -} diff --git a/org/drip/product/creator/SingleStreamOptionBuilder.java b/org/drip/product/creator/SingleStreamOptionBuilder.java deleted file mode 100644 index 8426739..0000000 --- a/org/drip/product/creator/SingleStreamOptionBuilder.java +++ /dev/null @@ -1,149 +0,0 @@ - -package org.drip.product.creator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * SingleStreamOptionBuilder contains the suite of helper functions for creating the Options Product Instance - * off of a single stream underlying. - * - * @author Lakshmi Krishnamurthy - */ - -public class SingleStreamOptionBuilder { - - /** - * Create a Standard Futures Option - * - * @param dtEffective Effective date - * @param forwardLabel The Forward Label - * @param dblStrike The Option Strike - * @param strManifestMeasure Measure of the Underlying Component - * @param bIsCaplet Is the Futures Option a Caplet? TRUE - YES - * @param csp Cash Settle Parameters - * - * @return The Standard Futures Option Instance - */ - - public static final org.drip.product.fra.FRAStandardCapFloorlet FuturesOption ( - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final double dblStrike, - final java.lang.String strManifestMeasure, - final boolean bIsCaplet, - final org.drip.param.valuation.CashSettleParams csp) - { - org.drip.product.fra.FRAStandardComponent fraStandard = - org.drip.product.creator.SingleStreamComponentBuilder.ForwardRateFutures (dtEffective, - forwardLabel); - - try { - return null == fraStandard? null : new org.drip.product.fra.FRAStandardCapFloorlet - (fraStandard.name() + "::OPT", fraStandard, strManifestMeasure, bIsCaplet, dblStrike, 1., new - org.drip.product.params.LastTradingDateSetting - (org.drip.product.params.LastTradingDateSetting.MID_CURVE_OPTION_QUARTERLY, "", - java.lang.Integer.MIN_VALUE), new org.drip.pricer.option.BlackScholesAlgorithm(), - csp); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Exchange-traded Standard Futures Option - * - * @param dtEffective Effective date - * @param forwardLabel The Forward Label - * @param dblStrike The Option Strike - * @param strManifestMeasure Measure of the Underlying Component - * @param bIsCaplet Is the Futures Option a Caplet? TRUE - YES - * @param strTradingMode The Trading Mode - * @param strExchange The Exchange - * - * @return The Standard Futures Option Instance - */ - - public static final org.drip.product.fra.FRAStandardCapFloorlet ExchangeTradedFuturesOption ( - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final double dblStrike, - final java.lang.String strManifestMeasure, - final boolean bIsCaplet, - final java.lang.String strTradingMode, - final java.lang.String strExchange) - { - if (null == forwardLabel) return null; - - org.drip.market.exchange.FuturesOptions fo = - org.drip.market.exchange.FuturesOptionsContainer.ExchangeInfo (forwardLabel.fullyQualifiedName(), - strTradingMode); - - if (null == fo) return null; - - java.util.Set setExchanges = fo.exchanges(); - - if (null == setExchanges || !setExchanges.contains (strExchange)) return null; - - org.drip.product.fra.FRAStandardComponent fraStandard = - org.drip.product.creator.SingleStreamComponentBuilder.ForwardRateFutures (dtEffective, - forwardLabel); - - try { - return null == fraStandard ? null : new org.drip.product.fra.FRAStandardCapFloorlet - (fraStandard.name() + "::OPT", fraStandard, strManifestMeasure, bIsCaplet, dblStrike, 1., - fo.ltdsArray (strExchange)[0], new org.drip.pricer.option.BlackScholesAlgorithm(), null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/product/credit/BondBasket.java b/org/drip/product/credit/BondBasket.java deleted file mode 100644 index d181060..0000000 --- a/org/drip/product/credit/BondBasket.java +++ /dev/null @@ -1,681 +0,0 @@ - -package org.drip.product.credit; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * BondBasket implements the bond basket product contract details. Contains the basket name, basket notional, - * component bonds, and their weights. - * - * @author Lakshmi Krishnamurthy - */ - -public class BondBasket extends org.drip.product.definition.BasketProduct { - private java.lang.String _strName = ""; - private double[] _adblNormWeights = null; - private org.drip.product.definition.Bond[] _aBond = null; - - /** - * BondBasket constructor - * - * @param strName BondBasket Name - * @param aBond Component bonds - * @param adblWeights Component Bond weights - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public BondBasket ( - final java.lang.String strName, - final org.drip.product.definition.Bond[] aBond, - final double[] adblWeights) - throws java.lang.Exception - { - if (null == strName || strName.isEmpty() || null == aBond || 0 == aBond.length || null == adblWeights - || 0 == adblWeights.length || aBond.length != adblWeights.length) - throw new java.lang.Exception ("BasketBond ctr: Invalid inputs"); - - _aBond = aBond; - _strName = strName; - double dblCumulativeWeight = 0.; - _adblNormWeights = new double[adblWeights.length]; - - for (int i = 0; i < adblWeights.length; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (adblWeights[i])) - throw new java.lang.Exception ("BasketBond ctr: Invalid weights"); - - dblCumulativeWeight += adblWeights[i]; - } - - if (0. == dblCumulativeWeight) throw new java.lang.Exception ("BasketBond ctr: Invalid weights"); - - for (int i = 0; i < adblWeights.length; ++i) - _adblNormWeights[i] = adblWeights[i] / dblCumulativeWeight; - } - - @Override public java.lang.String name() - { - return _strName; - } - - @Override public org.drip.product.definition.Component[] components() - { - return _aBond; - } - - @Override public int measureAggregationType ( - final java.lang.String strMeasureName) - { - if ("Accrued".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("Accrued01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("AssetSwapSpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("ASW".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("BondBasis".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("CleanCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("CleanDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("CleanIndexCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("CleanPrice".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("CleanPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("Convexity".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("CreditRisklessParPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("CreditRisklessPrincipalPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("CreditRiskyParPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("CreditRiskyPrincipalPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("CreditBasis".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("DiscountMargin".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("DefaultExposure".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("DefaultExposureNoRec".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("DirtyCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("DirtyDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("DirtyIndexCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("DirtyPrice".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("DirtyPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("Duration".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("DV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("ExpectedRecovery".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairAccrued".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairAccrued01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairAssetSwapSpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairASW".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairBondBasis".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairCleanCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairCleanDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairCleanIndexCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairCleanPrice".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairCleanPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairConvexity".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairCreditBasis".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairCreditRisklessParPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairCreditRisklessPrincipalPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairCreditRiskyParPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairCreditRiskyPrincipalPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairDefaultExposure".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairDefaultExposureNoRec".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairDirtyCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairDirtyDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairDirtyIndexCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairDirtyPrice".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairDirtyPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairDiscountMargin".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairDuration".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairExpectedRecovery".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairFirstIndexRate".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("FairGSpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairISpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairLossOnInstantaneousDefault".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairMacaulayDuration".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairModifiedDuration".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairOAS".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairOASpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairOptionAdjustedSpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairParPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairParSpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairPECS".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairPrice".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairPrincipalPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairRecoveryPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairRisklessCleanCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairRisklessCleanDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairRisklessCleanIndexCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairRisklessCleanPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairRisklessDirtyCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairRisklessDirtyDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairRisklessDirtyIndexCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairRisklessDirtyPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairRiskyCleanCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairRiskyCleanDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairRiskyCleanIndexCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairRiskyCleanPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairRiskyDirtyCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairRiskyDirtyDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairRiskyDirtyIndexCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairRiskyDirtyPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairTSYSpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairWorkoutDate".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("FairWorkoutFactor".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("FairWorkoutType".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("FairWorkoutYield".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("FairYield".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairYield01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairYieldBasis".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairYieldSpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairZeroDiscountMargin".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairZSpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FirstCouponRate".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("FirstIndexRate".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("GSpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("ISpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("LossOnInstantaneousDefault".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MacaulayDuration".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("MarketAccrued".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketAccrued01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketCleanCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketCleanDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketCleanIndexCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketCleanPrice".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("MarketCleanPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketCreditRisklessParPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketCreditRisklessPrincipalPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketCreditRiskyParPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketCreditRiskyPrincipalPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketDefaultExposure".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketDefaultExposureNoRec".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketDirtyCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketDirtyDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketDirtyIndexCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketDirtyPrice".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("MarketDirtyPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketExpectedRecovery".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketFirstCouponRate".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("MarketFirstIndexRate".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("MarketInputType=CleanPrice".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("MarketInputType=CreditBasis".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("MarketInputType=DirtyPrice".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("MarketInputType=GSpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("MarketInputType=ISpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("MarketInputType=PECS".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("MarketInputType=QuotedMargin".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("MarketInputType=TSYSpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("MarketInputType=Yield".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("MarketInputType=ZSpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("MarketLossOnInstantaneousDefault".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketParPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketPrincipalPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketRecoveryPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketRisklessDirtyCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketRisklessDirtyDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketRisklessDirtyIndexCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketRisklessDirtyPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketRiskyDirtyCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketRiskyDirtyDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketRiskyDirtyIndexCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketRiskyDirtyPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("ModifiedDuration".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("OAS".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("OASpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("OptionAdjustedSpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("ParEquivalentCDSSpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("ParPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("ParSpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("PECS".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("Price".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("PrincipalPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("PV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("RecoveryPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("RisklessCleanCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("RisklessCleanDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("RisklessCleanIndexCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("RisklessCleanPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("RisklessDirtyCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("RisklessDirtyDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("RisklessDirtyIndexCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("RisklessDirtyPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("RiskyCleanCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("RiskyCleanDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("RiskyCleanIndexCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("RiskyCleanPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("RiskyDirtyCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("RiskyDirtyDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("RiskyDirtyIndexCouponPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("RiskyDirtyPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("TSYSpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("WorkoutDate".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("WorkoutFactor".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("WorkoutType".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("WorkoutYield".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("Yield".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("Yield01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("YieldBasis".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("YieldSpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("ZeroDiscountMargin".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("ZSpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_IGNORE; - } -} diff --git a/org/drip/product/credit/BondComponent.java b/org/drip/product/credit/BondComponent.java deleted file mode 100644 index 2533eda..0000000 --- a/org/drip/product/credit/BondComponent.java +++ /dev/null @@ -1,12062 +0,0 @@ - -package org.drip.product.credit; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * BondComponent is the base class that extends CreditComponent abstract class and implements the - * functionality behind bonds of all kinds. Bond static data is captured in a set of 11 container classes – - * BondTSYParams, BondCouponParams, BondNotionalParams, BondFloaterParams, BondCurrencyParams, - * BondIdentifierParams, CompCRValParams, BondCFTerminationEvent, BondFixedPeriodGenerationParams, and one - * EmbeddedOptionSchedule object instance each for the call and the put objects. Each of these parameter set - * can be set separately. - * - * @author Lakshmi Krishnamurthy - */ - -public class BondComponent extends org.drip.product.definition.Bond implements - org.drip.product.definition.BondProduct { - private static final boolean s_bSuppressErrors = true; - private static final boolean s_bYieldDFOffofCouponAccrualDCF = true; - - /* - * Width for calculating local forward rate width - */ - - private static final int LOCAL_FORWARD_RATE_WIDTH = 1; - - /* - * Recovery Period discretization Mode - */ - - private static final int s_iDiscretizationScheme = - org.drip.param.pricer.CreditPricerParams.PERIOD_DISCRETIZATION_DAY_STEP; - - /* - * Discount Curve to derive the zero curve off of - */ - - private static final int ZERO_OFF_OF_RATES_INSTRUMENTS_DISCOUNT_CURVE = 1; - private static final int ZERO_OFF_OF_TREASURIES_DISCOUNT_CURVE = 2; - - /* - * Discount Curve to derive Bumped Prices - */ - - private static final int PRICE_OFF_OF_FUNDING_CURVE = 1; - private static final int PRICE_OFF_OF_TREASURY_CURVE = 2; - // private static final int PRICE_OFF_OF_OVERNIGHT_CURVE = 3; - - private org.drip.product.params.BondStream _stream = null; - private org.drip.product.params.IdentifierSet _idParams = null; - private org.drip.product.params.CouponSetting _couponSetting = null; - private org.drip.product.params.CreditSetting _creditSetting = null; - private org.drip.product.params.FloaterSetting _floaterSetting = null; - private org.drip.product.params.NotionalSetting _notionalSetting = null; - private org.drip.product.params.QuoteConvention _marketConvention = null; - private org.drip.product.params.TerminationSetting _terminationSetting = null; - private org.drip.product.params.TreasuryBenchmarks _treasuryBenchmarks = null; - - /* - * Bond EOS Params - */ - - protected org.drip.product.params.EmbeddedOptionSchedule _eosPut = null; - protected org.drip.product.params.EmbeddedOptionSchedule _eosCall = null; - - private double treasuryBenchmarkYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final int iWorkoutDate) - throws java.lang.Exception - { - if (null == valParams || null == csqc) - throw new java.lang.Exception ("BondComponent::treasuryBenchmarkYield => Invalid Inputs"); - - java.lang.String strTsyBmk = null; - org.drip.param.definition.ProductQuote pqTsyBmkYield = null; - - if (null != _treasuryBenchmarks) strTsyBmk = _treasuryBenchmarks.primary(); - - int iValDate = valParams.valueDate(); - - if (null == strTsyBmk || strTsyBmk.isEmpty()) - strTsyBmk = org.drip.analytics.support.Helper.BaseTsyBmk (iValDate, iWorkoutDate); - - org.drip.analytics.support.CaseInsensitiveTreeMap pqMap = - csqc.quoteMap(); - - if (null != pqMap && null != strTsyBmk && !strTsyBmk.isEmpty()) - pqTsyBmkYield = pqMap.get (strTsyBmk); - - if (null != pqTsyBmkYield) { - org.drip.param.definition.Quote q = pqTsyBmkYield.quote ("Yield"); - - if (null != q) return q.value ("mid"); - } - - org.drip.state.govvie.GovvieCurve gc = csqc.govvieState (govvieLabel()); - - return null == gc ? java.lang.Double.NaN : gc.yield (iWorkoutDate); - } - - private org.drip.param.valuation.WorkoutInfo exerciseCallYieldFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - { - if (null == valParams || null == csqs || !org.drip.quant.common.NumberUtil.IsValid (dblPrice) || null - == _eosCall) - return null; - - int iValDate = valParams.valueDate(); - - int[] aiEOSDate = _eosCall.dates(); - - double[] adblEOSFactor = _eosCall.factors(); - - int iNoticePeriod = _eosCall.exerciseNoticePeriod(); - - int iMaturityDate = maturityDate().julian(); - - int iExercise = -1; - double dblExerciseYield = java.lang.Double.NaN; - int iNumEOSDate = null == aiEOSDate ? 0 : aiEOSDate.length; - - try { - dblExerciseYield = yieldFromPrice (valParams, csqs, vcp, iMaturityDate, 1., dblPrice); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - - return null; - } - - for (int i = 0; i < iNumEOSDate; ++i) { - if (iValDate > aiEOSDate[i] || aiEOSDate[i] - iValDate < iNoticePeriod) continue; - - try { - double dblYield = yieldFromPrice (valParams, csqs, vcp, aiEOSDate[i], adblEOSFactor[i], - dblPrice); - - if (dblYield < dblExerciseYield) { - iExercise = i; - dblExerciseYield = dblYield; - } - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - } - - try { - return -1 == iExercise ? new org.drip.param.valuation.WorkoutInfo (iMaturityDate, - dblExerciseYield, 1., org.drip.param.valuation.WorkoutInfo.WO_TYPE_MATURITY) : new - org.drip.param.valuation.WorkoutInfo (aiEOSDate[iExercise], dblExerciseYield, - adblEOSFactor[iExercise], org.drip.param.valuation.WorkoutInfo.WO_TYPE_CALL); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - - return null; - } - - private org.drip.param.valuation.WorkoutInfo exercisePutYieldFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - { - if (null == valParams || null == csqs || !org.drip.quant.common.NumberUtil.IsValid (dblPrice) || null - == _eosPut) - return null; - - int iValueDate = valParams.valueDate(); - - int[] aiEOSDate = _eosPut.dates(); - - double[] adblEOSFactor = _eosPut.factors(); - - int iNoticePeriod = _eosPut.exerciseNoticePeriod(); - - int iMaturityDate = maturityDate().julian(); - - int iExercise = -1; - double dblExerciseYield = java.lang.Double.NaN; - int iNumEOSDate = null == aiEOSDate ? 0 : aiEOSDate.length; - - try { - dblExerciseYield = yieldFromPrice (valParams, csqs, vcp, iMaturityDate, 1., dblPrice); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - - return null; - } - - for (int i = 0; i < iNumEOSDate; ++i) { - if (iValueDate > aiEOSDate[i] || aiEOSDate[i] - iValueDate < iNoticePeriod) continue; - - try { - double dblYield = yieldFromPrice (valParams, csqs, vcp, aiEOSDate[i], adblEOSFactor[i], - dblPrice); - - if (dblYield > dblExerciseYield) { - iExercise = i; - dblExerciseYield = dblYield; - } - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - } - - try { - return -1 == iExercise ? new org.drip.param.valuation.WorkoutInfo (iMaturityDate, - dblExerciseYield, 1., org.drip.param.valuation.WorkoutInfo.WO_TYPE_MATURITY) : new - org.drip.param.valuation.WorkoutInfo (aiEOSDate[iExercise], dblExerciseYield, - adblEOSFactor[iExercise], org.drip.param.valuation.WorkoutInfo.WO_TYPE_PUT); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap calibMeasures ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - double dblCleanPrice = java.lang.Double.NaN; - - org.drip.param.definition.CalibrationParams calibParams = null == pricerParams ? null : - pricerParams.calibParams(); - - if (null == calibParams) return null; - - org.drip.param.valuation.WorkoutInfo wi = calibParams.workout(); - - double dblExerciseFactor = null == wi ? 1. : wi.factor(); - - int iExerciseDate = null == wi ? maturityDate().julian() : wi.date(); - - org.drip.state.credit.CreditCurve cc = csqc.creditState (creditLabel()); - - try { - dblCleanPrice = null == cc ? priceFromFundingCurve (valParams, csqc, iExerciseDate, - dblExerciseFactor, 0.) : priceFromCreditCurve (valParams, csqc, iExerciseDate, - dblExerciseFactor, 0., false); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - - return null; - } - - if (!org.drip.quant.common.NumberUtil.IsValid (dblCleanPrice)) return null; - - java.lang.String strCalibMeasure = calibParams.measure(); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapCalibMeasures = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - if (org.drip.quant.common.StringUtil.MatchInStringArray (strCalibMeasure, new java.lang.String[] - {"CleanPrice", "FairCleanPrice", "FairPrice", "Price"}, false)) { - mapCalibMeasures.put (strCalibMeasure, dblCleanPrice); - - return mapCalibMeasures; - } - - if (org.drip.quant.common.StringUtil.MatchInStringArray (strCalibMeasure, new java.lang.String[] - {"DirtyPrice", "FairDirtyPrice"}, false)) { - try { - mapCalibMeasures.put (strCalibMeasure, dblCleanPrice + accrued (valParams.valueDate(), - csqc)); - - return mapCalibMeasures; - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - } - - if (org.drip.quant.common.StringUtil.MatchInStringArray (strCalibMeasure, new java.lang.String[] - {"Yield", "FairYield"}, false)) { - try { - mapCalibMeasures.put (strCalibMeasure, yieldFromPrice (valParams, csqc, vcp, iExerciseDate, - dblExerciseFactor, dblCleanPrice)); - - return mapCalibMeasures; - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - } - - if (org.drip.quant.common.StringUtil.MatchInStringArray (strCalibMeasure, new java.lang.String[] - {"TSYSpread", "FairTSYSpread"}, false)) { - try { - mapCalibMeasures.put (strCalibMeasure, tsySpreadFromPrice (valParams, csqc, vcp, - iExerciseDate, dblExerciseFactor, dblCleanPrice)); - - return mapCalibMeasures; - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - } - - if (org.drip.quant.common.StringUtil.MatchInStringArray (strCalibMeasure, new java.lang.String[] - {"OAS", "OASpread", "OptionAdjustedSpread"}, false)) { - try { - mapCalibMeasures.put (strCalibMeasure, oasFromPrice (valParams, csqc, vcp, iExerciseDate, - dblExerciseFactor, dblCleanPrice)); - - return mapCalibMeasures; - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - } - - if (org.drip.quant.common.StringUtil.MatchInStringArray (strCalibMeasure, new java.lang.String[] - {"BondBasis", "YieldBasis", "YieldSpread"}, false)) { - try { - mapCalibMeasures.put (strCalibMeasure, bondBasisFromPrice (valParams, csqc, vcp, - iExerciseDate, dblExerciseFactor, dblCleanPrice)); - - return mapCalibMeasures; - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - } - - if (org.drip.quant.common.StringUtil.MatchInStringArray (strCalibMeasure, new java.lang.String[] - {"CreditBasis"}, false)) { - if (null == cc) return null; - - try { - mapCalibMeasures.put (strCalibMeasure, creditBasisFromPrice (valParams, csqc, vcp, - iExerciseDate, dblExerciseFactor, dblCleanPrice)); - - return mapCalibMeasures; - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - } - - if (org.drip.quant.common.StringUtil.MatchInStringArray (strCalibMeasure, new java.lang.String[] - {"PECS", "ParEquivalentCDSSpread"}, false)) { - if (null == cc) return null; - - try { - mapCalibMeasures.put (strCalibMeasure, pecsFromPrice (valParams, csqc, vcp, iExerciseDate, - dblExerciseFactor, dblCleanPrice)); - - return mapCalibMeasures; - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - } - - return null; - } - - @Override public org.drip.param.valuation.WorkoutInfo exerciseYieldFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - { - if (null == valParams || null == csqc || !org.drip.quant.common.NumberUtil.IsValid (dblPrice)) - return null; - - int iMaturityDate = maturityDate().julian(); - - try { - if (null == _eosCall && null == _eosPut) - return new org.drip.param.valuation.WorkoutInfo (iMaturityDate, yieldFromPrice (valParams, - csqc, vcp, iMaturityDate, 1., dblPrice), 1., - org.drip.param.valuation.WorkoutInfo.WO_TYPE_MATURITY); - - if (null == _eosCall && null != _eosPut) - return exercisePutYieldFromPrice (valParams, csqc, vcp, dblPrice); - - if (null != _eosCall && null == _eosPut) - return exerciseCallYieldFromPrice (valParams, csqc, vcp, dblPrice); - - org.drip.param.valuation.WorkoutInfo wiPut = exercisePutYieldFromPrice (valParams, csqc, vcp, - dblPrice); - - org.drip.param.valuation.WorkoutInfo wiCall = exerciseCallYieldFromPrice (valParams, csqc, vcp, - dblPrice); - - if (null == wiPut || null == wiCall) return null; - - return wiPut.date() < wiCall.date() ? wiPut : wiCall; - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - - return null; - } - - private double indexRate ( - final int iValueDate, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.analytics.cashflow.CompositeFloatingPeriod cup) - throws java.lang.Exception - { - org.drip.state.discount.MergedDiscountForwardCurve dc = csqc.fundingState (fundingLabel()); - - int iFreq = freq(); - - if (null != cup) { - org.drip.analytics.cashflow.ComposableUnitPeriod cupFirst = cup.periods().get (0); - - if (!(cupFirst instanceof org.drip.analytics.cashflow.ComposableUnitFloatingPeriod)) - throw new java.lang.Exception ("BondComponent::indexRate => Not a floater"); - - int iFixingDate = ((org.drip.analytics.cashflow.ComposableUnitFloatingPeriod) - cupFirst).referenceIndexPeriod().fixingDate(); - - org.drip.state.identifier.ForwardLabel forwardLabel = null == _floaterSetting ? null : - _floaterSetting.fri(); - - if (!csqc.available (iFixingDate, forwardLabel)) { - org.drip.state.forward.ForwardRateEstimator fc = null; - - int iPayDate = cup.payDate(); - - int iStartDate = cup.startDate(); - - if (null == forwardLabel || null == (fc = csqc.forwardState (forwardLabel)) || - !forwardLabel.match (fc.index())) - fc = dc.forwardRateEstimator (iPayDate, forwardLabel); - - if (null != fc) return fc.forward (iPayDate); - - return iStartDate < iValueDate && 0 != iFreq ? dc.libor (iValueDate, (12 / iFreq) + "M") : - dc.libor (iStartDate, cup.endDate()); - } - - return csqc.fixing (iFixingDate, forwardLabel); - } - - return dc.libor (iValueDate, 0 != iFreq ? iValueDate + 365 / iFreq : iValueDate + - LOCAL_FORWARD_RATE_WIDTH); - } - - private org.drip.analytics.output.BondWorkoutMeasures workoutMeasures ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final int iWorkoutDate, - final double dblWorkoutFactor) - { - if (null == valParams || null == csqc) return null; - - int iValueDate = valParams.valueDate(); - - if (iValueDate >= iWorkoutDate) return null; - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqc.fundingState (fundingLabel()); - - if (null == dcFunding) return null; - - int iLossPayLag = null == _creditSetting ? 0 : _creditSetting.lossPayLag(); - - double dblProductRecovery = null == _creditSetting ? java.lang.Double.NaN : - _creditSetting.recovery(); - - boolean bUseCurveRecovery = null == _creditSetting ? false : _creditSetting.useCurveRecovery(); - - boolean bAccrualOnDefault = null == _creditSetting ? false : _creditSetting.accrualOnDefault(); - - org.drip.state.credit.CreditCurve cc = csqc.creditState (creditLabel()); - - double dblAccrued01 = 0.; - double dblRecoveryPV = 0.; - boolean bPeriodZero = true; - double dblExpectedRecovery = 0.; - double dblCreditRiskyDirtyDV01 = 0.; - boolean bTerminateCouponFlow = false; - double dblCreditRiskyPrincipalPV = 0.; - double dblCreditRisklessDirtyDV01 = 0.; - double dblCreditRiskyDirtyCouponPV = 0.; - double dblCreditRisklessPrincipalPV = 0.; - double dblCreditRisklessDirtyCouponPV = 0.; - double dblFirstCoupon = java.lang.Double.NaN; - double dblCreditRiskyDirtyIndexCouponPV = 0.; - double dblFirstIndexRate = java.lang.Double.NaN; - double dblCreditRisklessDirtyIndexCouponPV = 0.; - double dblCreditRiskyParPV = java.lang.Double.NaN; - double dblCreditRisklessParPV = java.lang.Double.NaN; - - try { - for (org.drip.analytics.cashflow.CompositePeriod period : couponPeriods()) { - int iPeriodPayDate = period.payDate(); - - if (iPeriodPayDate < iValueDate) continue; - - int iPeriodEndDate = period.endDate(); - - int iPeriodStartDate = period.startDate(); - - if (iWorkoutDate <= iPeriodEndDate) { - bTerminateCouponFlow = true; - iPeriodEndDate = iWorkoutDate; - } - - org.drip.analytics.output.CompositePeriodCouponMetrics cpcm = couponMetrics (iValueDate, - valParams, csqc); - - if (null == cpcm) return null; - - double dblPeriodCoupon = cpcm.rate(); - - double dblPeriodBaseRate = period.periods().get (0).baseRate (csqc); - - double dblPeriodAnnuity = dcFunding.df (iPeriodPayDate) * cpcm.cumulative(); - - if (bPeriodZero) { - bPeriodZero = false; - dblFirstCoupon = dblPeriodCoupon; - - if (iPeriodStartDate < iValueDate) - dblAccrued01 = 0.0001 * period.accrualDCF (iValueDate) * notional (iPeriodStartDate, - iValueDate); - - if (null != _floaterSetting) dblFirstIndexRate = dblPeriodBaseRate; - } - - double dblPeriodCreditRisklessDirtyDV01 = 0.0001 * period.accrualDCF (iPeriodEndDate) * - dblPeriodAnnuity * notional (iPeriodStartDate, iPeriodEndDate); - - double dblPeriodCreditRiskessPrincipalPV = (notional (iPeriodStartDate) - notional - (iPeriodEndDate)) * dblPeriodAnnuity; - - double dblPeriodCreditRiskyDirtyDV01 = dblPeriodCreditRisklessDirtyDV01; - double dblPeriodCreditRiskyPrincipalPV = dblPeriodCreditRiskessPrincipalPV; - - if (null != cc && null != pricerParams) { - double dblSurvProb = cc.survival (pricerParams.survivalToPayDate() ? iPeriodPayDate : - iPeriodEndDate); - - dblPeriodCreditRiskyDirtyDV01 *= dblSurvProb; - dblPeriodCreditRiskyPrincipalPV *= dblSurvProb; - - for (org.drip.analytics.cashflow.LossQuadratureMetrics lqm : period.lossMetrics (this, - valParams, pricerParams, iWorkoutDate, csqc)) { - if (null == lqm) continue; - - int iSubPeriodEndDate = lqm.endDate(); - - int iSubPeriodStartDate = lqm.startDate(); - - double dblSubPeriodDF = dcFunding.effectiveDF (iSubPeriodStartDate + iLossPayLag, - iSubPeriodEndDate + iLossPayLag); - - double dblSubPeriodNotional = notional (iSubPeriodStartDate, iSubPeriodEndDate); - - double dblSubPeriodSurvival = cc.survival (iSubPeriodStartDate) - cc.survival - (iSubPeriodEndDate); - - if (bAccrualOnDefault) - dblPeriodCreditRiskyDirtyDV01 += 0.0001 * lqm.accrualDCF() * dblSubPeriodSurvival - * dblSubPeriodDF * dblSubPeriodNotional; - - double dblRecovery = bUseCurveRecovery ? cc.effectiveRecovery (iSubPeriodStartDate, - iSubPeriodEndDate) : dblProductRecovery; - - double dblSubPeriodExpRecovery = dblRecovery * dblSubPeriodSurvival * - dblSubPeriodNotional; - dblRecoveryPV += dblSubPeriodExpRecovery * dblSubPeriodDF; - dblExpectedRecovery += dblSubPeriodExpRecovery; - } - } - - dblCreditRiskyDirtyDV01 += dblPeriodCreditRiskyDirtyDV01; - dblCreditRiskyPrincipalPV += dblPeriodCreditRiskyPrincipalPV; - dblCreditRisklessDirtyDV01 += dblPeriodCreditRisklessDirtyDV01; - dblCreditRisklessPrincipalPV += dblPeriodCreditRiskessPrincipalPV; - dblCreditRiskyDirtyCouponPV += 10000. * dblPeriodCoupon * dblPeriodCreditRiskyDirtyDV01; - dblCreditRisklessDirtyCouponPV += 10000. * dblPeriodCoupon * - dblPeriodCreditRisklessDirtyDV01; - dblCreditRiskyDirtyIndexCouponPV += 10000. * dblPeriodBaseRate * - dblPeriodCreditRiskyDirtyDV01; - dblCreditRisklessDirtyIndexCouponPV += 10000. * dblPeriodBaseRate * - dblPeriodCreditRisklessDirtyDV01; - - if (bTerminateCouponFlow) break; - } - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - - return null; - } - - int iCashPayDate = java.lang.Integer.MIN_VALUE; - - try { - iCashPayDate = null != _marketConvention ? _marketConvention.settleDate (valParams) : - valParams.cashPayDate(); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - - iCashPayDate = valParams.cashPayDate(); - } - - try { - double dblCashPayDF = dcFunding.df (iCashPayDate); - - int iMaturityDate = maturityDate().julian(); - - dblCreditRisklessParPV = dcFunding.df (iMaturityDate) * notional (iMaturityDate) * - dblWorkoutFactor; - - if (null != cc && null != pricerParams) - dblCreditRiskyParPV = dblCreditRisklessParPV * cc.survival (iMaturityDate); - - org.drip.analytics.output.BondCouponMeasures bcmCreditRisklessDirty = new - org.drip.analytics.output.BondCouponMeasures (dblCreditRisklessDirtyDV01, - dblCreditRisklessDirtyIndexCouponPV, dblCreditRisklessDirtyCouponPV, - dblCreditRisklessDirtyCouponPV + dblCreditRisklessPrincipalPV + - dblCreditRisklessParPV); - - double dblDefaultExposure = java.lang.Double.NaN; - double dblDefaultExposureNoRec = java.lang.Double.NaN; - double dblLossOnInstantaneousDefault = java.lang.Double.NaN; - org.drip.analytics.output.BondCouponMeasures bcmCreditRiskyDirty = null; - - if (null != cc && null != pricerParams) { - double dblInitialNotional = notional (iValueDate); - - double dblInitialRecovery = cc.recovery (iValueDate); - - bcmCreditRiskyDirty = new org.drip.analytics.output.BondCouponMeasures - (dblCreditRiskyDirtyDV01, dblCreditRiskyDirtyIndexCouponPV, dblCreditRiskyDirtyCouponPV, - dblCreditRiskyDirtyCouponPV + dblCreditRiskyPrincipalPV + dblCreditRiskyParPV); - - dblDefaultExposure = (dblDefaultExposureNoRec = dblInitialNotional) * dblInitialRecovery; - dblLossOnInstantaneousDefault = dblInitialNotional * (1. - dblInitialRecovery); - } - - return new org.drip.analytics.output.BondWorkoutMeasures (bcmCreditRiskyDirty, - bcmCreditRisklessDirty, dblCreditRiskyParPV, dblCreditRisklessParPV, - dblCreditRiskyPrincipalPV, dblCreditRisklessPrincipalPV, dblRecoveryPV, - dblExpectedRecovery, dblDefaultExposure, dblDefaultExposureNoRec, - dblLossOnInstantaneousDefault, dblAccrued01, dblFirstCoupon, dblFirstIndexRate, - dblCashPayDF); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - - return null; - } - - private org.drip.analytics.support.CaseInsensitiveTreeMap rvMeasures ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.param.valuation.WorkoutInfo wi, - final double dblPrice, - final java.lang.String strPrefix) - { - if (null == strPrefix) return null; - - org.drip.analytics.output.BondRVMeasures bmRV = standardMeasures (valParams, pricerParams, csqc, vcp, - wi, dblPrice); - - return null == bmRV ? null : bmRV.toMap (strPrefix); - } - - private org.drip.analytics.support.CaseInsensitiveTreeMap fairMeasures ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - int iMaturityDate = maturityDate().julian(); - - org.drip.analytics.output.BondWorkoutMeasures bwmFair = workoutMeasures (valParams, pricerParams, - csqc, iMaturityDate, 1.); - - if (null == bwmFair) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapMeasures = bwmFair.toMap (""); - - org.drip.analytics.output.BondCouponMeasures bcm = bwmFair.creditRiskyCleanbcm(); - - double dblCreditRiskyPV = null == bcm ? java.lang.Double.NaN : bcm.pv(); - - double dblPrice = !org.drip.quant.common.NumberUtil.IsValid (dblCreditRiskyPV) ? - bwmFair.creditRisklessCleanbcm().pv() : dblCreditRiskyPV; - - try { - org.drip.quant.common.CollectionUtil.MergeWithMain (mapMeasures, rvMeasures (valParams, - pricerParams, csqc, vcp, new org.drip.param.valuation.WorkoutInfo (iMaturityDate, - yieldFromPrice (valParams, csqc, vcp, dblPrice / notional (valParams.valueDate())), 1., - org.drip.param.valuation.WorkoutInfo.WO_TYPE_MATURITY), dblPrice, "")); - - org.drip.quant.common.CollectionUtil.MergeWithMain (mapMeasures, - org.drip.quant.common.CollectionUtil.PrefixKeys (mapMeasures, "Fair")); - - return mapMeasures; - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - - return null; - } - - private org.drip.analytics.support.CaseInsensitiveTreeMap marketMeasures ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.param.valuation.WorkoutInfo wiMarket) - { - try { - org.drip.analytics.support.CaseInsensitiveTreeMap mapMeasures = rvMeasures - (valParams, pricerParams, csqc, vcp, wiMarket, priceFromYield (valParams, csqc, vcp, - wiMarket.date(), wiMarket.factor(), wiMarket.yield()), ""); - - org.drip.quant.common.CollectionUtil.MergeWithMain (mapMeasures, - org.drip.quant.common.CollectionUtil.PrefixKeys (mapMeasures, "Market")); - - return mapMeasures; - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - - return null; - } - - private org.drip.analytics.cashflow.CompositePeriod currentPeriod ( - final int iDate) - { - try { - return _stream.period (_stream.periodIndex (iDate)); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - - return null; - } - - private double priceFromDiscountCurve ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBump, - final int iDiscountCurveType) - throws java.lang.Exception - { - if (null == valParams || null == csqc ||!org.drip.quant.common.NumberUtil.IsValid (dblWorkoutFactor) - || !org.drip.quant.common.NumberUtil.IsValid (dblBump)) - throw new java.lang.Exception ("BondComponent::priceFromDiscountCurve => Invalid Inputs"); - - org.drip.state.discount.DiscountCurve dc = null; - - if (PRICE_OFF_OF_FUNDING_CURVE == iDiscountCurveType) - dc = csqc.fundingState (fundingLabel()); - else if (PRICE_OFF_OF_TREASURY_CURVE == iDiscountCurveType) - dc = csqc.govvieState (govvieLabel()); - /* else if (PRICE_OFF_OF_OVERNIGHT_CURVE == iDiscountCurveType) - dfe = csqc.overnightState (overnightLabel()); */ - - if (null == dc) - throw new java.lang.Exception ("BondComponent::priceFromDiscountCurve => No Discount Curve"); - - int iValueDate = valParams.valueDate(); - - if (iValueDate >= iWorkoutDate) - throw new java.lang.Exception ("BondComponent::priceFromDiscountCurve => Val date " + - org.drip.analytics.date.DateUtil.YYYYMMDD (iValueDate) + " greater than Work-out " + - org.drip.analytics.date.DateUtil.YYYYMMDD (iWorkoutDate)); - - double dblPV = 0.; - boolean bTerminateCouponFlow = false; - int iCashPayDate = java.lang.Integer.MIN_VALUE; - double dblScalingNotional = java.lang.Double.NaN; - - if (null != _notionalSetting && _notionalSetting.priceOffOfOriginalNotional()) - dblScalingNotional = 1.; - - if (0. != dblBump) { - if (PRICE_OFF_OF_FUNDING_CURVE == iDiscountCurveType) - dc = (org.drip.state.discount.MergedDiscountForwardCurve) dc.parallelShiftManifestMeasure - ("SwapRate", dblBump); - else if (PRICE_OFF_OF_TREASURY_CURVE == iDiscountCurveType) - dc = (org.drip.state.govvie.GovvieCurve) dc.parallelShiftManifestMeasure ("Yield", dblBump); - } - - if (null == dc) - throw new java.lang.Exception - ("BondComponent::priceFromDiscountCurve => Cannot shift Discount Curve"); - - for (org.drip.analytics.cashflow.CompositePeriod period : couponPeriods()) { - int iPeriodPayDate = period.payDate(); - - if (iPeriodPayDate < iValueDate) continue; - - int iPeriodStartDate = period.startDate(); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblScalingNotional)) - dblScalingNotional = notional (iPeriodStartDate); - - int iAccrualEndDate = period.endDate(); - - int iNotionalEndDate = period.endDate(); - - if (iAccrualEndDate >= iWorkoutDate) { - bTerminateCouponFlow = true; - iAccrualEndDate = iWorkoutDate; - iNotionalEndDate = iWorkoutDate; - } - - org.drip.analytics.output.CompositePeriodCouponMetrics pcm = couponMetrics (iAccrualEndDate, - valParams, csqc); - - if (null == pcm) - throw new java.lang.Exception ("BondComponent::priceFromDiscountCurve => No PCM"); - - double dblPeriodAnnuity = dc.df (iPeriodPayDate) * pcm.cumulative(); - - double dblPeriodStartNotional = notional (iPeriodStartDate); - - double dblPeriodEndNotional = notional (iNotionalEndDate); - - double dblCouponNotional = dblPeriodStartNotional; - - int iPeriodAmortizationMode = _notionalSetting.periodAmortizationMode(); - - if (org.drip.product.params.NotionalSetting.PERIOD_AMORT_AT_END == iPeriodAmortizationMode) - dblCouponNotional = dblPeriodEndNotional; - else if (org.drip.product.params.NotionalSetting.PERIOD_AMORT_EFFECTIVE == - iPeriodAmortizationMode) - dblCouponNotional = notional (iPeriodStartDate, iNotionalEndDate); - - dblPV += period.accrualDCF (iAccrualEndDate) * dblPeriodAnnuity * pcm.rate() * dblCouponNotional; - - dblPV += (dblPeriodStartNotional - dblPeriodEndNotional) * dblPeriodAnnuity; - - if (bTerminateCouponFlow) break; - } - - try { - iCashPayDate = null != _marketConvention ? _marketConvention.settleDate (valParams) : - valParams.cashPayDate(); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - - iCashPayDate = valParams.cashPayDate(); - } - - return ((dblPV + dblWorkoutFactor * dc.df (iWorkoutDate) * notional (iWorkoutDate)) / dc.df - (iCashPayDate) - accrued (iValueDate, csqc)) / dblScalingNotional; - } - - /** - * Constructor: Construct an empty bond object - */ - - public BondComponent() - { - } - - @Override public double[] secTreasurySpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc) - { - if (null == valParams || null == csqc) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapTSYQuote - = csqc.quoteMap(); - - if (null == mapTSYQuote || 0 == mapTSYQuote.size()) return null; - - java.lang.String[] astrTreasuryBenchmark = null == _treasuryBenchmarks ? null : - _treasuryBenchmarks.secondary(); - - int iNumTreasuryBenchmark = null == astrTreasuryBenchmark ? 0 : astrTreasuryBenchmark.length; - double[] adblSecTSYSpread = new double[iNumTreasuryBenchmark]; - - if (0 == iNumTreasuryBenchmark) return null; - - for (int i = 0; i < iNumTreasuryBenchmark; ++i) { - org.drip.param.definition.ProductQuote pqTSYBenchmark = mapTSYQuote.get - (astrTreasuryBenchmark[i]); - - org.drip.param.definition.Quote q = null == pqTSYBenchmark ? null : pqTSYBenchmark.quote - ("Yield"); - - adblSecTSYSpread[i] = null == q ? java.lang.Double.NaN : q.value ("mid"); - } - - return adblSecTSYSpread; - } - - @Override public double effectiveTreasuryBenchmarkYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - if (null == valParams || null == csqc || !org.drip.quant.common.NumberUtil.IsValid (dblPrice)) - throw new java.lang.Exception - ("BondComponent::effectiveTreasuryBenchmarkYield => Bad val/mkt Params"); - - org.drip.param.valuation.WorkoutInfo wi = exerciseYieldFromPrice (valParams, csqc, vcp, dblPrice); - - if (null == wi) - throw new java.lang.Exception - ("BondComponent::effectiveTreasuryBenchmarkYield => Invalid Work-out!"); - - java.lang.String strTreasuryBenchmark = null != _treasuryBenchmarks ? _treasuryBenchmarks.primary() : - null; - - int iValueDate = valParams.valueDate(); - - int iWorkoutDate = wi.date(); - - if (null == strTreasuryBenchmark || strTreasuryBenchmark.isEmpty()) - strTreasuryBenchmark = org.drip.analytics.support.Helper.BaseTsyBmk (iValueDate, iWorkoutDate); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapTSYQuote - = csqc.quoteMap(); - - org.drip.param.definition.ProductQuote pqTSYBenchmark = null != mapTSYQuote && - mapTSYQuote.containsKey (strTreasuryBenchmark) && !strTreasuryBenchmark.isEmpty() ? - mapTSYQuote.get (strTreasuryBenchmark) : null; - - org.drip.param.definition.Quote q = null != pqTSYBenchmark ? pqTSYBenchmark.quote ("Yield") : null; - - if (null != q) return q.value ("mid"); - - org.drip.state.govvie.GovvieCurve gc = csqc.govvieState (govvieLabel());; - - return null == gc ? java.lang.Double.NaN : gc.yield (iWorkoutDate); - } - - @Override public boolean setTreasuryBenchmark ( - final org.drip.product.params.TreasuryBenchmarks treasuryBenchmarks) - { - return null != (_treasuryBenchmarks = treasuryBenchmarks); - } - - @Override public org.drip.product.params.TreasuryBenchmarks treasuryBenchmark() - { - return _treasuryBenchmarks; - } - - @Override public boolean setIdentifierSet ( - final org.drip.product.params.IdentifierSet idParams) - { - return null != (_idParams = idParams); - } - - @Override public org.drip.product.params.IdentifierSet identifierSet() - { - return _idParams; - } - - @Override public boolean setCouponSetting ( - final org.drip.product.params.CouponSetting couponSetting) - { - return null != (_couponSetting = couponSetting); - } - - @Override public org.drip.product.params.CouponSetting couponSetting() - { - return _couponSetting; - } - - @Override public boolean setFloaterSetting ( - final org.drip.product.params.FloaterSetting fltParams) - { - return null == (_floaterSetting = fltParams); - } - - @Override public org.drip.product.params.FloaterSetting floaterSetting() - { - return _floaterSetting; - } - - @Override public boolean setMarketConvention ( - final org.drip.product.params.QuoteConvention marketConvention) - { - return null == (_marketConvention = marketConvention); - } - - @Override public org.drip.product.params.QuoteConvention marketConvention() - { - return _marketConvention; - } - - @Override public boolean setCreditSetting ( - final org.drip.product.params.CreditSetting creditSetting) - { - return null == (_creditSetting = creditSetting); - } - - @Override public org.drip.product.params.CreditSetting creditSetting() - { - return _creditSetting; - } - - @Override public boolean setTerminationSetting ( - final org.drip.product.params.TerminationSetting terminationSetting) - { - return null == (_terminationSetting = terminationSetting); - } - - @Override public org.drip.product.params.TerminationSetting terminationSetting() - { - return _terminationSetting; - } - - @Override public boolean setStream ( - final org.drip.product.params.BondStream stream) - { - return null != (_stream = stream); - } - - @Override public org.drip.product.params.BondStream stream() - { - return _stream; - } - - @Override public boolean setNotionalSetting ( - final org.drip.product.params.NotionalSetting notionalSetting) - { - return null == (_notionalSetting = notionalSetting); - } - - @Override public org.drip.product.params.NotionalSetting notionalSetting() - { - return _notionalSetting; - } - - @Override public java.lang.String primaryCode() - { - return null == _idParams ? null : "BOND." + _idParams.id(); - } - - @Override public void setPrimaryCode ( - final java.lang.String strCode) - { - // _strCode = strCode; - } - - @Override public java.lang.String[] secondaryCode() - { - return new java.lang.String[] {_idParams.id()}; - } - - @Override public java.lang.String isin() - { - return null == _idParams ? null : _idParams.isin(); - } - - @Override public java.lang.String cusip() - { - return null == _idParams ? null : _idParams.cusip(); - } - - @Override public java.lang.String name() - { - return null == _idParams ? null : _idParams.id(); - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap couponCurrency() - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapCouponCurrency = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapCouponCurrency.put (name(), _stream.couponCurrency()); - - return mapCouponCurrency; - } - - @Override public java.lang.String payCurrency() - { - return _stream.couponCurrency(); - } - - @Override public java.lang.String principalCurrency() - { - return _notionalSetting.denominationCurrency(); - } - - @Override public double notional ( - final int iDate) - throws java.lang.Exception - { - if (null == _notionalSetting || null == _notionalSetting.outstandingFactorSchedule()) - throw new java.lang.Exception ("BondComponent::notional => Bad state/inputs"); - - return _notionalSetting.outstandingFactorSchedule().y (iDate); - } - - @Override public double notional ( - final int iStartDate, - final int iEndDate) - throws java.lang.Exception - { - if (null == _notionalSetting || null == _notionalSetting.outstandingFactorSchedule()) - throw new java.lang.Exception ("BondComponent::notional => Bad state/inputs"); - - return _notionalSetting.outstandingFactorSchedule().y (iStartDate, iEndDate); - } - - @Override public double initialNotional() - throws java.lang.Exception - { - if (null == _notionalSetting) - throw new java.lang.Exception ("BondComponent::initialNotional => Bad state/inputs"); - - return _notionalSetting.notionalAmount(); - } - - @Override public double recovery ( - final int iDate, - final org.drip.state.credit.CreditCurve cc) - throws java.lang.Exception - { - if (null == cc) throw new java.lang.Exception ("BondComponent::recovery: Bad state/inputs"); - - return _creditSetting.useCurveRecovery() ? cc.recovery (iDate) : _creditSetting.recovery(); - } - - @Override public double recovery ( - final int iStartDate, - final int iEndDate, - final org.drip.state.credit.CreditCurve cc) - throws java.lang.Exception - { - if (null == cc) throw new java.lang.Exception ("BondComponent::recovery: Bad state/inputs"); - - return _creditSetting.useCurveRecovery() ? cc.effectiveRecovery (iStartDate, iEndDate) : - _creditSetting.recovery(); - } - - @Override public org.drip.product.params.CreditSetting creditValuationParams() - { - return _creditSetting; - } - - @Override public org.drip.analytics.output.CompositePeriodCouponMetrics couponMetrics ( - final int iAccrualEndDate, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc) - { - org.drip.analytics.cashflow.CompositePeriod cp = currentPeriod (iAccrualEndDate); - - if (null == cp) return null; - - java.util.List lsUPM = new - java.util.ArrayList(); - - try { - lsUPM.add (new org.drip.analytics.output.UnitPeriodMetrics (cp.startDate(), cp.endDate(), - cp.couponDCF(), cp.couponMetrics (valParams.valueDate(), csqc).rate(), new - org.drip.analytics.output.ConvexityAdjustment())); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return org.drip.analytics.output.CompositePeriodCouponMetrics.Create (lsUPM); - } - - @Override public int freq() - { - return couponPeriods().get (0).freq(); - } - - @Override public org.drip.state.identifier.CreditLabel creditLabel() - { - if (null == _creditSetting) return null; - - java.lang.String strCreditCurveName = _creditSetting.creditCurveName(); - - return null == strCreditCurveName || strCreditCurveName.isEmpty() ? null : - org.drip.state.identifier.CreditLabel.Standard (strCreditCurveName); - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - forwardLabel() - { - if (null == _floaterSetting) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapForwardLabel = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapForwardLabel.put (name(), _floaterSetting.fri()); - - return mapForwardLabel; - } - - @Override public org.drip.state.identifier.FundingLabel fundingLabel() - { - return org.drip.state.identifier.FundingLabel.Standard (payCurrency()); - } - - @Override public org.drip.state.identifier.GovvieLabel govvieLabel() - { - return org.drip.state.identifier.GovvieLabel.Standard - (org.drip.market.issue.TreasurySettingContainer.CurrencyBenchmarkCode (payCurrency())); - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap - fxLabel() - { - return null; - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - volatilityLabel() - { - return null; - } - - @Override public org.drip.analytics.date.JulianDate effectiveDate() - { - return _stream.effective(); - } - - @Override public org.drip.analytics.date.JulianDate maturityDate() - { - return _stream.maturity(); - } - - @Override public org.drip.analytics.date.JulianDate firstCouponDate() - { - try { - return new org.drip.analytics.date.JulianDate (couponPeriods().get (0).endDate()); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - - return null; - } - - @Override public java.util.List couponPeriods() - { - return null == _stream ? null : _stream.periods(); - } - - @Override public org.drip.param.valuation.CashSettleParams cashSettleParams() - { - return null == _marketConvention ? null : _marketConvention.cashSettleParams(); - } - - @Override public java.util.List lossFlow ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc) - { - if (null == valParams || null == pricerParams || null == csqc) return null; - - java.util.List sLP = new - java.util.ArrayList(); - - for (org.drip.analytics.cashflow.CompositePeriod period : couponPeriods()) { - if (null == period) continue; - - java.util.List sLPSub = period.lossMetrics - (this, valParams, pricerParams, period.endDate(), csqc); - - if (null != sLPSub) sLP.addAll (sLPSub); - } - - return sLP; - } - - @Override public java.util.List lossFlowFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - { - if (null == valParams || null == pricerParams || null == csqc || - !org.drip.quant.common.NumberUtil.IsValid (dblPrice)) - return null; - - org.drip.param.valuation.WorkoutInfo wi = exerciseYieldFromPrice (valParams, csqc, vcp, dblPrice); - - if (null == wi) return null; - - int iValueDate = valParams.valueDate(); - - int iWorkoutDate = wi.date(); - - java.util.List sLP = new - java.util.ArrayList(); - - for (org.drip.analytics.cashflow.CompositePeriod period : couponPeriods()) { - if (null == period) continue; - - int iPeriodEndDate = period.endDate(); - - if (null == period || iPeriodEndDate < iValueDate) continue; - - if (period.startDate() > iWorkoutDate) break; - - java.util.List sLPSub = period.lossMetrics - (this, valParams, pricerParams, iPeriodEndDate, csqc); - - if (null != sLPSub) sLP.addAll (sLPSub); - } - - return sLP; - } - - @Override public boolean isFloater() - { - return null == _floaterSetting ? false : true; - } - - @Override public java.lang.String rateIndex() - { - return null == _floaterSetting ? "" : _floaterSetting.fri().fullyQualifiedName(); - } - - @Override public double currentCoupon() - { - return null == _floaterSetting ? java.lang.Double.NaN : _floaterSetting.currentFullCoupon(); - } - - @Override public double floatSpread() - { - return null == _floaterSetting ? java.lang.Double.NaN : _floaterSetting.spread(); - } - - @Override public java.lang.String ticker() - { - return null == _idParams ? null : _idParams.ticker(); - } - - @Override public void setEmbeddedCallSchedule ( - final org.drip.product.params.EmbeddedOptionSchedule eos) - { - if (null == eos || eos.isPut()) return; - - _eosCall = new org.drip.product.params.EmbeddedOptionSchedule (eos); - } - - @Override public void setEmbeddedPutSchedule ( - final org.drip.product.params.EmbeddedOptionSchedule eos) - { - if (null == eos || !eos.isPut()) return; - - _eosPut = new org.drip.product.params.EmbeddedOptionSchedule (eos); - } - - @Override public boolean callable() - { - return null != _eosCall; - } - - @Override public boolean putable() - { - return null != _eosPut; - } - - @Override public boolean sinkable() - { - return null == _notionalSetting ? false : true; - } - - @Override public boolean variableCoupon() - { - return null == _couponSetting || null == _couponSetting.couponType() || !"variable".equalsIgnoreCase - (_couponSetting.couponType()) ? false : true; - } - - @Override public boolean exercised() - { - return null == _terminationSetting ? false : _terminationSetting.exercised(); - } - - @Override public boolean defaulted() - { - return null == _terminationSetting ? false : _terminationSetting.defaulted(); - } - - @Override public boolean perpetual() - { - return null == _terminationSetting ? false : _terminationSetting.perpetual(); - } - - @Override public boolean tradeable ( - final org.drip.param.valuation.ValuationParams valParams) - throws java.lang.Exception - { - if (null == valParams) throw new java.lang.Exception ("BondComponent::tradeable => invalid Inputs"); - - return !_terminationSetting.exercised() && !_terminationSetting.defaulted() && valParams.valueDate() - < maturityDate().julian(); - } - - @Override public org.drip.product.params.EmbeddedOptionSchedule callSchedule() - { - return _eosCall; - } - - @Override public org.drip.product.params.EmbeddedOptionSchedule putSchedule() - { - return _eosPut; - } - - @Override public java.lang.String couponType() - { - return null == _couponSetting ? "" : _couponSetting.couponType(); - } - - @Override public java.lang.String couponDC() - { - return null == _stream ? "" : _stream.couponDC(); - } - - @Override public java.lang.String accrualDC() - { - return null == _stream ? "" : _stream.accrualDC(); - } - - @Override public java.lang.String maturityType() - { - return null == _stream ? "" : maturityType(); - } - - @Override public org.drip.analytics.date.JulianDate finalMaturity() - { - return null == _stream ? null : new org.drip.analytics.date.JulianDate (_stream.finalMaturityDate()); - } - - @Override public java.lang.String calculationType() - { - return null == _marketConvention ? "" : _marketConvention.calculationType(); - } - - @Override public double redemptionValue() - { - return null == _marketConvention ? java.lang.Double.NaN : _marketConvention.redemptionValue(); - } - - @Override public java.lang.String currency() - { - return _stream.couponCurrency(); - } - - @Override public java.lang.String redemptionCurrency() - { - return _notionalSetting.denominationCurrency(); - } - - @Override public boolean inFirstCouponPeriod ( - final int iDate) - throws java.lang.Exception - { - return _stream.firstPeriod().contains (iDate); - } - - @Override public boolean inLastCouponPeriod ( - final int iDate) - throws java.lang.Exception - { - return _stream.lastPeriod().contains (iDate); - } - - @Override public java.lang.String floatCouponConvention() - { - return null == _floaterSetting ? null : _floaterSetting.dayCount(); - } - - @Override public org.drip.analytics.date.JulianDate periodFixingDate ( - final int iValueDate) - { - if (null == _floaterSetting || iValueDate >= maturityDate().julian()) return null; - - for (org.drip.analytics.cashflow.CompositePeriod period : couponPeriods()) { - if (period.payDate() < iValueDate) continue; - - org.drip.analytics.cashflow.ComposableUnitPeriod cup = period.periods().get (0); - - if (!(cup instanceof org.drip.analytics.cashflow.ComposableUnitFloatingPeriod)) continue; - - try { - return new org.drip.analytics.date.JulianDate - (((org.drip.analytics.cashflow.ComposableUnitFloatingPeriod) - (cup)).referenceIndexPeriod().fixingDate()); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - } - - return null; - } - - @Override public org.drip.analytics.date.JulianDate previousCouponDate ( - final org.drip.analytics.date.JulianDate dt) - { - if (null == dt || dt.julian() > maturityDate().julian()) return null; - - try { - int iIndex = _stream.periodIndex (dt.julian()); - - if (0 == iIndex) return new org.drip.analytics.date.JulianDate (_stream.period (0).startDate()); - - org.drip.analytics.cashflow.CompositePeriod period = _stream.period (iIndex - 1); - - return null == period ? null : new org.drip.analytics.date.JulianDate (period.payDate()); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - - return null; - } - - @Override public double previousCouponRate ( - final org.drip.analytics.date.JulianDate dt, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc) - throws java.lang.Exception - { - if (null == dt) - throw new java.lang.Exception ("BondComponent::previousCouponRate => Invalid Inputs"); - - org.drip.analytics.cashflow.CompositePeriod period = _stream.period (_stream.periodIndex - (dt.julian()) - 1); - - if (null == period) - throw new java.lang.Exception - ("BondComponent::previousCouponRate => Cannot find previous period!"); - - org.drip.analytics.output.CompositePeriodCouponMetrics cpcm = couponMetrics (period.endDate(), new - org.drip.param.valuation.ValuationParams (dt, dt, ""), csqc); - - if (null == cpcm) - throw new java.lang.Exception - ("BondComponent::previousCouponRate => Invalid previous period metrics!"); - - return cpcm.rate(); - } - - @Override public org.drip.analytics.date.JulianDate currentCouponDate ( - final org.drip.analytics.date.JulianDate dt) - { - if (null == dt || dt.julian() > maturityDate().julian()) return null; - - try { - org.drip.analytics.cashflow.CompositePeriod period = _stream.period (_stream.periodIndex - (dt.julian())); - - return null == period ? null : new org.drip.analytics.date.JulianDate (period.payDate()); - } catch (java.lang.Exception e) { - } - - return null; - } - - @Override public org.drip.analytics.date.JulianDate nextCouponDate ( - final org.drip.analytics.date.JulianDate dt) - { - if (null == dt || dt.julian() > maturityDate().julian()) return null; - - try { - org.drip.analytics.cashflow.CompositePeriod period = _stream.period (_stream.periodIndex - (dt.julian()) + 1); - - return null == period ? null : new org.drip.analytics.date.JulianDate (period.payDate()); - } catch (java.lang.Exception e) { - } - - return null; - } - - @Override public org.drip.analytics.output.ExerciseInfo nextValidExerciseDateOfType ( - final org.drip.analytics.date.JulianDate dt, - final boolean bPut) - { - if (null == dt || (bPut && null == _eosPut) || (!bPut && null == _eosCall)) return null; - - org.drip.product.params.EmbeddedOptionSchedule eos = bPut ? _eosPut : _eosCall; - - int[] aiEOSExerciseDates = eos.dates(); - - if (null == eos || null == aiEOSExerciseDates) return null; - - int iNumExerciseDates = aiEOSExerciseDates.length; - - if (0 == iNumExerciseDates) return null; - - for (int i = 0; i < iNumExerciseDates; ++i) { - if (aiEOSExerciseDates[i] - dt.julian() < eos.exerciseNoticePeriod()) - continue; - - try { - return new org.drip.analytics.output.ExerciseInfo (aiEOSExerciseDates[i], eos.factor (i), - bPut ? org.drip.param.valuation.WorkoutInfo.WO_TYPE_PUT : - org.drip.param.valuation.WorkoutInfo.WO_TYPE_CALL); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - - return null; - } - } - - return null; - } - - @Override public org.drip.analytics.output.ExerciseInfo nextValidExerciseInfo ( - final org.drip.analytics.date.JulianDate dt) - { - if (null == dt) return null; - - org.drip.analytics.output.ExerciseInfo neiNextCall = nextValidExerciseDateOfType (dt, false); - - org.drip.analytics.output.ExerciseInfo neiNextPut = nextValidExerciseDateOfType (dt, true); - - if (null == neiNextCall && null == neiNextPut) { - try { - return new org.drip.analytics.output.ExerciseInfo (maturityDate().julian(), 1., - org.drip.param.valuation.WorkoutInfo.WO_TYPE_MATURITY); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - - return null; - } - } - - if (null != neiNextCall && null == neiNextPut) return neiNextCall; - - if (null == neiNextCall && null != neiNextPut) return neiNextPut; - - return neiNextCall.date() < neiNextPut.date() ? neiNextCall : neiNextPut; - } - - @Override public double currentCouponRate ( - final org.drip.analytics.date.JulianDate dt, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc) - throws java.lang.Exception - { - if (null == dt || null == csqc) - throw new java.lang.Exception ("BondComponent::currentCouponRate => Null val/mkt params!"); - - if (null != _floaterSetting) { - double dblCurrentFullCoupon = _floaterSetting.currentFullCoupon(); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblCurrentFullCoupon)) - return dblCurrentFullCoupon; - } - - org.drip.analytics.output.CompositePeriodCouponMetrics pcm = couponMetrics (dt.julian(), new - org.drip.param.valuation.ValuationParams (dt, dt, ""), csqc); - - if (null == pcm) throw new java.lang.Exception ("BondComponent::currentCouponRate => Null PCM!"); - - return pcm.rate(); - } - - @Override public double nextCouponRate ( - final org.drip.analytics.date.JulianDate dt, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc) - throws java.lang.Exception - { - if (null == dt) - throw new java.lang.Exception ("BondComponent::nextCouponRate => Null val/mkt params!"); - - int iIndex = _stream.periodIndex (dt.julian()); - - org.drip.analytics.cashflow.CompositePeriod period = _stream.period (iIndex + 1); - - if (null == period) - throw new java.lang.Exception ("BondComponent::nextCouponRate => Cannot find next period!"); - - org.drip.analytics.output.CompositePeriodCouponMetrics pcm = couponMetrics (period.endDate(), new - org.drip.param.valuation.ValuationParams (dt, dt, ""), csqc); - - if (null == pcm) throw new java.lang.Exception ("BondComponent::nextCouponRate => Null PCM!"); - - return pcm.rate(); - } - - @Override public double accrued ( - final int iDate, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc) - throws java.lang.Exception - { - org.drip.analytics.date.JulianDate dt = new org.drip.analytics.date.JulianDate (iDate); - - if (iDate >= maturityDate().julian()) - throw new java.lang.Exception ("BondComponent::accrued => Val date " + dt + - " greater than maturity " + maturityDate()); - - org.drip.param.valuation.ValuationParams valParams = new org.drip.param.valuation.ValuationParams - (dt, dt, ""); - - for (org.drip.analytics.cashflow.CompositePeriod period : couponPeriods()) { - int iEndDate = period.endDate(); - - int iStartDate = period.startDate(); - - if (iStartDate < iDate && iEndDate >= iDate) { - org.drip.analytics.output.CompositePeriodCouponMetrics cpcm = couponMetrics (iEndDate, - valParams, csqc); - - if (null == cpcm) throw new java.lang.Exception ("BondComponent::accrued => No PCM"); - - double dblCoupon = cpcm.rate(); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblCoupon)) - throw new java.lang.Exception ("BondComponent::accrued => Invalid Coupon For " + dt); - - return period.accrualDCF (iDate) * dblCoupon * notional (iStartDate); - } - } - - return 0.; - } - - @Override public double priceFromZeroCurve ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iZeroCurveBaseDC, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBump) - throws java.lang.Exception - { - if (null == valParams) - throw new java.lang.Exception ("BondComponent::priceFromZeroCurve => Invalid Inputs"); - - int iValueDate = valParams.valueDate(); - - if (iValueDate >= iWorkoutDate || null == csqc || !org.drip.quant.common.NumberUtil.IsValid - (dblWorkoutFactor) || !org.drip.quant.common.NumberUtil.IsValid (dblBump)) - throw new java.lang.Exception ("BondComponent::priceFromZeroCurve => Invalid Inputs " + dblBump); - - double dblPV = 0.; - boolean bTerminateCouponFlow = false; - org.drip.state.discount.ZeroCurve zc = null; - int iCashPayDate = java.lang.Integer.MIN_VALUE; - double dblScalingNotional = java.lang.Double.NaN; - - org.drip.state.discount.DiscountCurve dcBase = ZERO_OFF_OF_RATES_INSTRUMENTS_DISCOUNT_CURVE == - iZeroCurveBaseDC ? csqc.fundingState (fundingLabel()) : csqc.govvieState (govvieLabel()); - - if (null == dcBase) - throw new java.lang.Exception ("BondComponent::priceFromZeroCurve => Invalid Discount Curve"); - - try { - iCashPayDate = null != _marketConvention ? _marketConvention.settleDate (valParams) : - valParams.cashPayDate(); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - - iCashPayDate = valParams.cashPayDate(); - } - - if (null != _notionalSetting && _notionalSetting.priceOffOfOriginalNotional()) - dblScalingNotional = 1.; - - java.util.List lsCompositePeriod = couponPeriods(); - - try { - zc = org.drip.state.curve.DerivedZeroRate.FromBaseCurve (freq(), couponDC(), currency(), - _stream.couponEOMAdjustment(), lsCompositePeriod, iWorkoutDate, iValueDate, iCashPayDate, - dcBase, dblBump, null == vcp ? (null == _marketConvention ? null : - _marketConvention.valuationCustomizationParams()) : vcp, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new org.drip.spline.basis.PolynomialFunctionSetParams (4), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), - new org.drip.spline.params.ResponseScalingShapeControl (true, new - org.drip.function.r1tor1.QuadraticRationalShapeControl (0.)), - null)); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - - if (null == zc) - throw new java.lang.Exception ("BondComponent::priceFromZeroCurve => Cannot create shifted ZC"); - - for (org.drip.analytics.cashflow.CompositePeriod period : lsCompositePeriod) { - int iPeriodPayDate = period.payDate(); - - if (iPeriodPayDate < iValueDate) continue; - - int iPeriodStartDate = period.startDate(); - - double dblPeriodStartNotional = notional (iPeriodStartDate); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblScalingNotional)) - dblScalingNotional = dblPeriodStartNotional; - - int iAccrualEndDate = period.endDate(); - - int iNotionalEndDate = iAccrualEndDate; - double dblCouponNotional = dblPeriodStartNotional; - - double dblPeriodEndNotional = notional (iNotionalEndDate); - - if (iAccrualEndDate >= iWorkoutDate) { - bTerminateCouponFlow = true; - iAccrualEndDate = iWorkoutDate; - iNotionalEndDate = iWorkoutDate; - } - - if (org.drip.product.params.NotionalSetting.PERIOD_AMORT_AT_END == - _notionalSetting.periodAmortizationMode()) - dblCouponNotional = dblPeriodEndNotional; - else if (org.drip.product.params.NotionalSetting.PERIOD_AMORT_EFFECTIVE == - _notionalSetting.periodAmortizationMode()) - dblCouponNotional = notional (iPeriodStartDate, iNotionalEndDate); - - org.drip.analytics.output.CompositePeriodCouponMetrics cpcm = couponMetrics (iValueDate, - valParams, csqc); - - if (null == cpcm) throw new java.lang.Exception ("BondComponent::priceFromZeroCurve => No PCM"); - - dblPV += (period.accrualDCF (iAccrualEndDate) * cpcm.rate() * dblCouponNotional + - dblPeriodStartNotional - dblPeriodEndNotional) * zc.df (iPeriodPayDate); - - if (bTerminateCouponFlow) break; - } - - return ((dblPV + dblWorkoutFactor * zc.df (iWorkoutDate) * notional (iWorkoutDate)) / - zc.df (iCashPayDate) - accrued (iValueDate, csqc)) / dblScalingNotional; - } - - @Override public double priceFromFundingCurve ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBump) - throws java.lang.Exception - { - return priceFromDiscountCurve (valParams, csqc, iWorkoutDate, dblWorkoutFactor, dblBump, - PRICE_OFF_OF_FUNDING_CURVE); - } - - @Override public double priceFromTreasuryCurve ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBump) - throws java.lang.Exception - { - return priceFromDiscountCurve (valParams, csqc, iWorkoutDate, dblWorkoutFactor, dblBump, - PRICE_OFF_OF_TREASURY_CURVE); - } - - @Override public double priceFromCreditCurve ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis, - final boolean bFlat) - throws java.lang.Exception - { - if (null == valParams || null == csqc || !org.drip.quant.common.NumberUtil.IsValid (dblWorkoutFactor) - || !org.drip.quant.common.NumberUtil.IsValid (dblCreditBasis) || null == _creditSetting) - throw new java.lang.Exception ("BondComponent::priceFromCreditCurve => Invalid inputs"); - - org.drip.state.credit.CreditCurve ccIn = csqc.creditState (creditLabel()); - - if (null == ccIn) - throw new java.lang.Exception ("BondComponent::priceFromCreditCurve => Invalid inputs"); - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqc.fundingState (fundingLabel()); - - if (null == dcFunding) - throw new java.lang.Exception ("BondComponent::priceFromCreditCurve => No funding curve"); - - int iValueDate = valParams.valueDate(); - - if (iValueDate >= iWorkoutDate) - throw new java.lang.Exception ("BondComponent::priceFromCreditCurve => Val date " + - org.drip.analytics.date.DateUtil.YYYYMMDD (iValueDate) + " greater than Work-out " + - org.drip.analytics.date.DateUtil.YYYYMMDD (iWorkoutDate)); - - double dblRecoveryToUse = !_creditSetting.useCurveRecovery() ? _creditSetting.recovery() : - java.lang.Double.NaN; - - org.drip.state.credit.CreditCurve cc = bFlat ? ccIn.flatCurve (dblCreditBasis, true, - dblRecoveryToUse) : (org.drip.state.credit.CreditCurve) ccIn.parallelShiftManifestMeasure - ("SwapRate", dblCreditBasis); - - if (null == cc) - throw new java.lang.Exception - ("BondComponent::priceFromCreditCurve => Cannot create adjusted Curve"); - - double dblPV = 0.; - double dblScalingNotional = 1.; - boolean bTerminateCashFlow = false; - int iCashPayDate = java.lang.Integer.MIN_VALUE; - - org.drip.param.pricer.CreditPricerParams pricerParams = new org.drip.param.pricer.CreditPricerParams - (7, null, false, s_iDiscretizationScheme); - - int iLossPayLag = _creditSetting.lossPayLag(); - - boolean bAccrualOnDefault = _creditSetting.accrualOnDefault(); - - int iPeriodAmortizationMode = _notionalSetting.periodAmortizationMode(); - - for (org.drip.analytics.cashflow.CompositePeriod period : couponPeriods()) { - if (bTerminateCashFlow) continue; - - int iPeriodPayDate = period.payDate(); - - if (iPeriodPayDate < iValueDate) continue; - - int iPeriodEndDate = period.endDate(); - - if (iPeriodEndDate >= iWorkoutDate) { - bTerminateCashFlow = true; - iPeriodEndDate = iWorkoutDate; - } - - int iPeriodStartDate = period.startDate(); - - if (iPeriodStartDate < iValueDate) iPeriodStartDate = iValueDate; - - org.drip.analytics.output.CompositePeriodCouponMetrics cpcm = couponMetrics (iPeriodEndDate, - valParams, csqc); - - if (null == cpcm) - throw new java.lang.Exception ("BondComponent::priceFromCreditCurve => No PCM"); - - double dblPeriodCoupon = cpcm.rate(); - - double dblPeriodStartNotional = notional (iPeriodStartDate); - - double dblPeriodEndNotional = notional (iPeriodEndDate); - - double dblCouponNotional = dblPeriodStartNotional; - - if (org.drip.product.params.NotionalSetting.PERIOD_AMORT_AT_END == iPeriodAmortizationMode) - dblCouponNotional = notional (iPeriodEndDate); - else if (org.drip.product.params.NotionalSetting.PERIOD_AMORT_EFFECTIVE == - iPeriodAmortizationMode) - dblCouponNotional = notional (iPeriodStartDate, iPeriodEndDate); - - dblPV += (period.accrualDCF (iPeriodEndDate) * dblPeriodCoupon * dblCouponNotional + - dblPeriodStartNotional - dblPeriodEndNotional) * dcFunding.df (iPeriodPayDate) * - cpcm.cumulative() * cc.survival (iPeriodEndDate); - - for (org.drip.analytics.cashflow.LossQuadratureMetrics lqm : period.lossMetrics (this, valParams, - pricerParams, iPeriodEndDate, csqc)) { - if (null == lqm) continue; - - int iSubPeriodEndDate = lqm.endDate(); - - int iSubPeriodStartDate = lqm.startDate(); - - double dblSubPeriodDF = dcFunding.effectiveDF (iSubPeriodStartDate + iLossPayLag, - iSubPeriodEndDate + iLossPayLag); - - double dblSubPeriodNotional = notional (iSubPeriodStartDate, iSubPeriodEndDate); - - double dblSubPeriodSurvival = cc.survival (iSubPeriodStartDate) - cc.survival - (iSubPeriodEndDate); - - if (bAccrualOnDefault) - dblPV += 0.0001 * lqm.accrualDCF() * dblSubPeriodSurvival * dblSubPeriodDF * - dblSubPeriodNotional * dblPeriodCoupon; - - dblPV += (_creditSetting.useCurveRecovery() ? cc.effectiveRecovery (iSubPeriodStartDate, - iSubPeriodEndDate) : _creditSetting.recovery()) * dblSubPeriodSurvival * - dblSubPeriodNotional * dblSubPeriodDF; - } - } - - try { - iCashPayDate = null == _marketConvention ? valParams.cashPayDate() : _marketConvention.settleDate - (valParams); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - - iCashPayDate = valParams.cashPayDate(); - } - - if (!_notionalSetting.priceOffOfOriginalNotional()) dblScalingNotional = notional (iWorkoutDate); - - return ((dblPV + dblWorkoutFactor * dcFunding.df (iWorkoutDate) * cc.survival (iWorkoutDate) * - notional (iWorkoutDate)) / dcFunding.df (iCashPayDate) - accrued (iValueDate, csqc)) / - dblScalingNotional; - } - - @Override public double aswFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception - { - return aswFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromBondBasis - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblBondBasis)); - } - - @Override public double aswFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - return aswFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double aswFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::aswFromBondBasisToOptimalExercise => " + - "Cannot calc ASW from Bond Basis to Optimal Exercise for bonds w emb option"); - - return aswFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double aswFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception - { - return aswFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromCreditBasis - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblCreditBasis)); - } - - @Override public double aswFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - return aswFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double aswFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::aswFromCreditBasisToOptimalExercise => " + - "Cannot calc ASW from Credit Basis to Optimal Exercise for bonds w emb option"); - - return aswFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double aswFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception - { - return aswFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromDiscountMargin - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblDiscountMargin)); - } - - @Override public double aswFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - return aswFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., dblDiscountMargin); - } - - @Override public double aswFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::aswFromDiscountMarginToOptimalExercise => " + - "Cannot calc ASW from Discount Margin to optimal exercise for bonds w emb option"); - - return aswFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., dblDiscountMargin); - } - - @Override public double aswFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception - { - return aswFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromGSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblGSpread)); - } - - @Override public double aswFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - return aswFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double aswFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::aswFromGSpreadToOptimalExercise => " + - "Cannot calc ASW from G Spread to optimal exercise for bonds w emb option"); - - return aswFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double aswFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception - { - return aswFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromISpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblISpread)); - } - - @Override public double aswFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - return aswFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double aswFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::aswFromISpreadToOptimalExercise => " + - "Cannot calc ASW from I Spread to optimal exercise for bonds w emb option"); - - return aswFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double aswFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception - { - return aswFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromOAS (valParams, - csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblOAS)); - } - - @Override public double aswFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - return aswFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double aswFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::aswFromOASToOptimalExercise => " + - "Cannot calc ASW from OAS to optimal exercise for bonds w emb option"); - - return aswFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double aswFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception - { - return aswFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromPECS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPECS)); - } - - @Override public double aswFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - return aswFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double aswFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::aswFromPECSToOptimalExercise => " + - "Cannot calc ASW from PECS to optimal exercise for bonds w emb option"); - - return aswFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double aswFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception - { - if (null == valParams || null == csqc || !org.drip.quant.common.NumberUtil.IsValid (dblWorkoutFactor) - || !org.drip.quant.common.NumberUtil.IsValid (dblPrice)) - throw new java.lang.Exception ("BondComponent::aswFromPrice => Invalid Inputs"); - - int iValueDate = valParams.valueDate(); - - if (iValueDate >= iWorkoutDate) - throw new java.lang.Exception ("BondComponent::aswFromPrice => Invalid Inputs"); - - org.drip.analytics.output.CompositePeriodCouponMetrics cpcm = couponMetrics (iValueDate, valParams, - csqc); - - if (null == cpcm) throw new java.lang.Exception ("BondComponent::aswFromPrice => No CPCM"); - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqc.fundingState (fundingLabel()); - - if (null == dcFunding) - throw new java.lang.Exception ("BondComponent::aswFromPrice => Invalid Inputs"); - - return cpcm.rate() - dcFunding.estimateManifestMeasure ("SwapRate", iWorkoutDate) + 0.0001 * - (dblWorkoutFactor - dblPrice) / dcFunding.parSwapDV01 (iWorkoutDate); - } - - @Override public double aswFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - return aswFromPrice (valParams, csqc, vcp, maturityDate().julian(), 1., dblPrice); - } - - @Override public double aswFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - org.drip.param.valuation.WorkoutInfo wi = exerciseYieldFromPrice (valParams, csqc, vcp, dblPrice); - - if (null == wi) - throw new java.lang.Exception - ("BondComponent::aswFromPriceToOptimalExercise => Can't determine Optimal Work-out"); - - return aswFromPrice (valParams, csqc, vcp, wi.date(), wi.factor(), dblPrice); - } - - @Override public double aswFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception - { - return aswFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromTSYSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblTSYSpread)); - } - - @Override public double aswFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - return aswFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double aswFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::aswFromTSYSpreadToOptimalExercise => " + - "Cannot calc ASW from TSY Spread to optimal exercise for bonds w emb option"); - - return aswFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double aswFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception - { - return aswFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromYield (valParams, - csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYield)); - } - - @Override public double aswFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - return aswFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double aswFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::aswFromYieldToOptimalExercise => " + - "Cannot calc ASW from Yield to optimal exercise for bonds w emb option"); - - return aswFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double aswFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception - { - return aswFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromYieldSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYieldSpread)); - } - - @Override public double aswFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - return aswFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double aswFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::aswFromYieldSpreadToOptimalExercise => " + - "Cannot calc ASW from Yield Spread to optimal exercise for bonds w emb option"); - - return aswFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double aswFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception - { - return aswFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromZSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblZSpread)); - } - - @Override public double aswFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - return aswFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double aswFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::aswFromZSpreadToOptimalExercise => " + - "Cannot calc ASW from Yield Spread to optimal exercise for bonds w emb option"); - - return aswFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double bondBasisFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception - { - return bondBasisFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromASW - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblASW)); - } - - @Override public double bondBasisFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - return bondBasisFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double bondBasisFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::bondBasisFromASWToOptimalExercise => " + - "Cannot calc Bond Basis from ASW to optimal exercise for bonds w emb option"); - - return bondBasisFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double bondBasisFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception - { - return bondBasisFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromCreditBasis (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblCreditBasis)); - } - - @Override public double bondBasisFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - return bondBasisFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double bondBasisFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::bondBasisFromCreditBasisToOptimalExercise => " + - "Cannot calc Bond Basis from Credit Basis to optimal exercise for bonds w emb option"); - - return bondBasisFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double bondBasisFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception - { - return bondBasisFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromDiscountMargin (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - dblDiscountMargin)); - } - - @Override public double bondBasisFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - return bondBasisFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double bondBasisFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::bondBasisFromDiscountMarginToOptimalExercise " + - "=> Cant calc Bond Basis from Discount Margin to optimal exercise for bonds w emb option"); - - return bondBasisFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double bondBasisFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception - { - return bondBasisFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromGSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblGSpread)); - } - - @Override public double bondBasisFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - return bondBasisFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double bondBasisFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::bondBasisFromGSpreadToOptimalExercise => " + - "Cant calc Bond Basis from G Spread to optimal exercise for bonds w emb option"); - - return bondBasisFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double bondBasisFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception - { - return bondBasisFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromISpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblISpread)); - } - - @Override public double bondBasisFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - return bondBasisFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double bondBasisFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::bondBasisFromISpreadToOptimalExercise => " + - "Cant calc Bond Basis from I Spread to optimal exercise for bonds w emb option"); - - return bondBasisFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double bondBasisFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception - { - return bondBasisFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromOAS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblOAS)); - } - - @Override public double bondBasisFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - return bondBasisFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double bondBasisFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::bondBasisFromOASToOptimalExercise => " + - "Cant calc Bond Basis from OAS to optimal exercise for bonds w emb option"); - - return bondBasisFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double bondBasisFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception - { - return bondBasisFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromPECS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPECS)); - } - - @Override public double bondBasisFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - return bondBasisFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double bondBasisFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::bondBasisFromPECSToOptimalExercise => " + - "Cant calc Bond Basis from PECS to optimal exercise for bonds w emb option"); - - return bondBasisFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double bondBasisFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception - { - return bondBasisFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromPrice - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPrice)); - } - - @Override public double bondBasisFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - return bondBasisFromPrice (valParams, csqc, vcp, maturityDate().julian(), 1., dblPrice); - } - - @Override public double bondBasisFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - org.drip.param.valuation.WorkoutInfo wi = exerciseYieldFromPrice (valParams, csqc, vcp, dblPrice); - - if (null == wi) - throw new java.lang.Exception - ("BondComponent::bondBasisFromPriceToOptimalExercise => cant calc Work-out info"); - - return bondBasisFromPrice (valParams, csqc, vcp, wi.date(), wi.factor(), dblPrice); - } - - @Override public double bondBasisFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception - { - return bondBasisFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromTSYSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblTSYSpread)); - } - - @Override public double bondBasisFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - return bondBasisFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double bondBasisFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::bondBasisFromTSYSpreadToOptimalExercise => " + - "Cant calc Bond Basis from TSY Spread to optimal exercise for bonds w emb option"); - - return bondBasisFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double bondBasisFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblYield)) - throw new java.lang.Exception ("BondComponent::bondBasisFromYield => Invalid inputs"); - - return dblYield - yieldFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromFundingCurve (valParams, csqc, iWorkoutDate, dblWorkoutFactor, 0.)); - } - - @Override public double bondBasisFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - return bondBasisFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double bondBasisFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::bondBasisFromYieldToOptimalExercise => " + - "Cant calc Bond Basis from Yield to optimal exercise for bonds w emb option"); - - return bondBasisFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double bondBasisFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception - { - return bondBasisFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromYieldSpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYieldSpread)); - } - - @Override public double bondBasisFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - return bondBasisFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double bondBasisFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::bondBasisFromYieldSpreadToOptimalExercise " + - "=> Cant calc Bond Basis from Yield Spread to optimal exercise for bonds w emb option"); - - return bondBasisFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double bondBasisFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception - { - return bondBasisFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromZSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblZSpread)); - } - - @Override public double bondBasisFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - return bondBasisFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double bondBasisFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::bondBasisFromZSpreadToOptimalExercise => " + - "Cant calc Bond Basis from Z Spread to optimal exercise for bonds w emb option"); - - return bondBasisFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double convexityFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception - { - return convexityFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromASW - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblASW)); - } - - @Override public double convexityFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - return convexityFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double convexityFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::convexityFromASWToOptimalExercise => " + - "Cant calc Convexity from ASW to optimal exercise for bonds w emb option"); - - return convexityFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double convexityFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception - { - return convexityFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromBondBasis - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblBondBasis)); - } - - @Override public double convexityFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - return convexityFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double convexityFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::convexityFromBondBasisToOptimalExercise => " + - "Cant calc Convexity from Bond Basis to optimal exercise for bonds w emb option"); - - return convexityFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double convexityFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception - { - return convexityFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromCreditBasis (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblCreditBasis)); - } - - @Override public double convexityFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - return convexityFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double convexityFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::convexityFromCreditBasisToOptimalExercise => " + - "Cant calc Convexity from Credit Basis to optimal exercise for bonds w emb option"); - - return convexityFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double convexityFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception - { - return convexityFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromDiscountMargin (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - dblDiscountMargin)); - } - - @Override public double convexityFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - return convexityFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double convexityFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::convexityFromDiscountMarginToOptimalExercise " + - "=> Cant calc Convexity from Discount Margin to optimal exercise for bonds w emb option"); - - return convexityFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double convexityFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception - { - return convexityFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromGSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblGSpread)); - } - - @Override public double convexityFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - return convexityFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double convexityFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::convexityFromGSpreadToOptimalExercise => " + - "Cant calc Convexity from G Spread to optimal exercise for bonds w emb option"); - - return convexityFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double convexityFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception - { - return convexityFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromISpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblISpread)); - } - - @Override public double convexityFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - return convexityFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double convexityFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::convexityFromISpreadToOptimalExercise => " + - "Cant calc Convexity from I Spread to optimal exercise for bonds w emb option"); - - return convexityFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double convexityFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception - { - return convexityFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromOAS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblOAS)); - } - - @Override public double convexityFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - return convexityFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double convexityFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::convexityFromOASToOptimalExercise => " + - "Cant calc Convexity from OAS to optimal exercise for bonds w emb option"); - - return convexityFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double convexityFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception - { - return convexityFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromPECS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPECS)); - } - - @Override public double convexityFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - return convexityFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double convexityFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::convexityFromPECSToOptimalExercise => " + - "Cant calc Convexity from PECS to optimal exercise for bonds w emb option"); - - return convexityFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double convexityFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception - { - if (null == valParams || !org.drip.quant.common.NumberUtil.IsValid (dblPrice)) - throw new java.lang.Exception ("BondComponent::convexityFromPrice => Input inputs"); - - double dblYield = yieldFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPrice); - - return (priceFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYield - 0.0001) + - priceFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYield + 0.0001) - 2. * - dblPrice) / (dblPrice + accrued (valParams.valueDate(), csqc)); - } - - @Override public double convexityFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - return convexityFromPrice (valParams, csqc, vcp, maturityDate().julian(), 1., dblPrice); - } - - @Override public double convexityFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::calcConvexityFromPriceToOptimalExercise => " + - "Cant calc Convexity from Price to optimal exercise for bonds w emb option"); - - return convexityFromPrice (valParams, csqc, vcp, maturityDate().julian(), 1., dblPrice); - } - - @Override public double convexityFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception - { - return convexityFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromTSYSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblTSYSpread)); - } - - @Override public double convexityFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - return convexityFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double convexityFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::convexityFromTSYSpreadToOptimalExercise => " + - "Cant calc Convexity from TSY Sprd to optimal exercise for bonds w emb option"); - - return convexityFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double convexityFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception - { - return convexityFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromYield - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYield)); - } - - @Override public double convexityFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - return convexityFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double convexityFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::convexityFromYieldToOptimalExercise => " + - "Cant calc Convexity from Yield to optimal exercise for bonds w emb option"); - - return convexityFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double convexityFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception - { - return convexityFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromYieldSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYieldSpread)); - } - - @Override public double convexityFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - return convexityFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double convexityFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::convexityFromYieldSpreadToOptimalExercise => " + - "Cant calc Convexity from Yld Sprd to optimal exercise for bonds w emb option"); - - return convexityFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double convexityFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception - { - return convexityFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromZSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblZSpread)); - } - - @Override public double convexityFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - return convexityFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double convexityFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::convexityFromZSpreadToOptimalExercise => " + - "Cant calc Convexity from Z Spread to optimal exercise for bonds w emb option"); - - return convexityFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double creditBasisFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception - { - return creditBasisFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromASW - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblASW)); - } - - @Override public double creditBasisFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - return creditBasisFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double creditBasisFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::creditBasisFromASWToOptimalExercise => " + - "Cannot calc Credit Basis from ASW to optimal exercise for bonds w emb option"); - - return creditBasisFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double creditBasisFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception - { - return creditBasisFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromBondBasis (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblBondBasis)); - } - - @Override public double creditBasisFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - return creditBasisFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double creditBasisFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::creditBasisFromBondBasisToOptimalExercise " + - "=> Cant calc Credit Basis from Bond Basis to optimal exercise for bonds w emb option"); - - return creditBasisFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double creditBasisFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception - { - return creditBasisFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromDiscountMargin (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - dblDiscountMargin)); - } - - @Override public double creditBasisFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - return creditBasisFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double creditBasisFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::creditBasisFromDiscountMarginToOptimalExercise => " + - "Cant calc Credit Basis from Discnt Margin to optimal exercise for bonds w emb option"); - - return creditBasisFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double creditBasisFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception - { - return creditBasisFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromGSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblGSpread)); - } - - @Override public double creditBasisFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - return creditBasisFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double creditBasisFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::creditBasisFromGSpreadToOptimalExercise => " + - "Cant calc Credit Basis from G Spread to optimal exercise for bonds w emb option"); - - return creditBasisFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double creditBasisFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception - { - return creditBasisFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromISpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblISpread)); - } - - @Override public double creditBasisFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - return creditBasisFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double creditBasisFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::creditBasisFromISpreadToOptimalExercise => " + - "Cant calc Credit Basis from I Spread to optimal exercise for bonds w emb option"); - - return creditBasisFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double creditBasisFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception - { - return creditBasisFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromOAS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblOAS)); - } - - @Override public double creditBasisFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - return creditBasisFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double creditBasisFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::creditBasisFromOASToOptimalExercise => " + - "Cant calc Credit Basis from OAS to optimal exercise for bonds w emb option"); - - return creditBasisFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double creditBasisFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception - { - return creditBasisFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromPECS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPECS)); - } - - @Override public double creditBasisFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - return creditBasisFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double creditBasisFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::creditBasisFromPECSToOptimalExercise => " + - "Cant calc Credit Basis from PECS to optimal exercise for bonds w emb option"); - - return creditBasisFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double creditBasisFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception - { - return new BondCalibrator (this).calibrateCreditBasisFromPrice (valParams, csqc, iWorkoutDate, - dblWorkoutFactor, dblPrice, false); - } - - @Override public double creditBasisFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - return creditBasisFromPrice (valParams, csqc, vcp, maturityDate().julian(), 1., dblPrice); - } - - @Override public double creditBasisFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - org.drip.param.valuation.WorkoutInfo wi = exerciseYieldFromPrice (valParams, csqc, vcp, dblPrice); - - if (null == wi) - throw new java.lang.Exception - ("BondComponent::creditBasisFromPriceToOptimalExercise => cant calc Work-out"); - - return creditBasisFromPrice (valParams, csqc, vcp, wi.date(), wi.factor(), dblPrice); - } - - @Override public double creditBasisFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception - { - return creditBasisFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromTSYSpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblTSYSpread)); - } - - @Override public double creditBasisFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - return creditBasisFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double creditBasisFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::creditBasisFromTSYSpreadToOptimalExercise => " + - "Cant calc Credit Basis from TSY Spread to optimal exercise for bonds w emb option"); - - return creditBasisFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double creditBasisFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception - { - return creditBasisFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromYield - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYield)); - } - - @Override public double creditBasisFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - return creditBasisFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double creditBasisFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::creditBasisFromYieldToOptimalExercise => " + - "Cant calc Credit Basis from Yield to optimal exercise for bonds w emb option"); - - return creditBasisFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double creditBasisFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception - { - return creditBasisFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromYieldSpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYieldSpread)); - } - - @Override public double creditBasisFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - return creditBasisFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., - dblYieldSpread); - } - - @Override public double creditBasisFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::creditBasisFromYieldSpreadToOptimalExercise " + - "=> Cant calc Credit Basis from Yield Spread to optimal exercise for bonds w emb option"); - - return creditBasisFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., - dblYieldSpread); - } - - @Override public double creditBasisFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception - { - return creditBasisFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromZSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblZSpread)); - } - - @Override public double creditBasisFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - return creditBasisFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double creditBasisFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::creditBasisFromZSpreadToOptimalExercise => " + - "Cant calc Credit Basis from Z Spread to optimal exercise for bonds w emb option"); - - return creditBasisFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double discountMarginFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception - { - return discountMarginFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromASW - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblASW)); - } - - @Override public double discountMarginFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - return discountMarginFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double discountMarginFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::discountMarginFromASWToOptimalExercise => " + - "Cant calc Discount Margin from ASW to optimal exercise for bonds w emb option"); - - return discountMarginFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double discountMarginFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception - { - return discountMarginFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromBondBasis (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblBondBasis)); - } - - @Override public double discountMarginFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - return discountMarginFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double discountMarginFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::discountMarginFromBondBasisToOptimalExercise " + - "=> Cant calc Discount Margin from Bond Basis to optimal exercise for bonds w emb option"); - - return discountMarginFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double discountMarginFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception - { - return discountMarginFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromCreditBasis (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblCreditBasis)); - } - - @Override public double discountMarginFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - return discountMarginFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., - dblCreditBasis); - } - - @Override public double discountMarginFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::discountMarginFromCreditBasisToOptimalExercise => " + - "Cant calc Discount Margin from Crdit Basis to optimal exercise for bonds w emb option"); - - return discountMarginFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., - dblCreditBasis); - } - - @Override public double discountMarginFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception - { - return discountMarginFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromGSpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblGSpread)); - } - - @Override public double discountMarginFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - return discountMarginFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double discountMarginFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::discountMarginFromGSpreadToOptimalExercise =>" + - " => Cant calc Discount Margin from G Spread to optimal exercise for bonds w emb option"); - - return discountMarginFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double discountMarginFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception - { - return discountMarginFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromISpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblISpread)); - } - - @Override public double discountMarginFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - return discountMarginFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double discountMarginFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::discountMarginFromISpreadToOptimalExercise " + - "=> Cant calc Discount Margin from I Spread to optimal exercise for bonds w emb option"); - - return discountMarginFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double discountMarginFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception - { - return discountMarginFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromOAS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblOAS)); - } - - @Override public double discountMarginFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - return discountMarginFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double discountMarginFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::calcDiscountMarginFromOASToOptimalExercise => " + - "Cant calc Discount Margin from OAS to optimal exercise for bonds w emb option"); - - return discountMarginFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double discountMarginFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception - { - return discountMarginFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromPECS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPECS)); - } - - @Override public double discountMarginFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - return discountMarginFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double discountMarginFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::discountMarginFromPECSToOptimalExercise => " + - "Cant calc Discount Margin from PECS to optimal exercise for bonds w emb option"); - - return discountMarginFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double discountMarginFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception - { - return discountMarginFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPrice)); - } - - @Override public double discountMarginFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - return discountMarginFromPrice (valParams, csqc, vcp, maturityDate().julian(), 1., dblPrice); - } - - @Override public double discountMarginFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - org.drip.param.valuation.WorkoutInfo wi = exerciseYieldFromPrice (valParams, csqc, vcp, dblPrice); - - if (null == wi) - throw new java.lang.Exception - ("BondComponent::discountMarginFromPriceToOptimalExercise => Can't do Work-out"); - - return discountMarginFromYield (valParams, csqc, vcp, wi.date(), wi.factor(), wi.yield()); - } - - @Override public double discountMarginFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception - { - return discountMarginFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromTSYSpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblTSYSpread)); - } - - @Override public double discountMarginFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - return discountMarginFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double discountMarginFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::discountMarginFromTSYSpreadToOptimalExercise " + - "=> Cant calc Discount Margin from TSY Spread to optimal exercise for bonds w emb option"); - - return discountMarginFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double discountMarginFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception - { - if (null == valParams || null == csqc || !org.drip.quant.common.NumberUtil.IsValid (dblYield)) - throw new java.lang.Exception ("BondComponent::discountMarginFromYield => Invalid inputs"); - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqc.fundingState (fundingLabel()); - - if (null == dcFunding) - throw new java.lang.Exception ("BondComponent::discountMarginFromYield => Invalid inputs"); - - int iValueDate = valParams.valueDate(); - - int iFreq = freq(); - - return null == _floaterSetting ? dblYield - dcFunding.libor (iValueDate, ((int) (12. / (0 == iFreq - ? 2 : iFreq))) + "M") : dblYield - indexRate (iValueDate, csqc, - (org.drip.analytics.cashflow.CompositeFloatingPeriod) currentPeriod (iValueDate)); - } - - @Override public double discountMarginFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - return discountMarginFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double discountMarginFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::discountMarginFromYieldToOptimalExercise =>" + - " Cant calc Discount Margin from Yield to optimal exercise for bonds w emb option"); - - return discountMarginFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double discountMarginFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception - { - return discountMarginFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromYieldSpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYieldSpread)); - } - - @Override public double discountMarginFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - return discountMarginFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., - dblYieldSpread); - } - - @Override public double discountMarginFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::discountMarginFromYieldSpreadToOptimalExercise => " + - "Cant calc Discount Margin from Yield Sprd to optimal exercise for bonds w emb option"); - - return discountMarginFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., - dblYieldSpread); - } - - @Override public double discountMarginFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception - { - return discountMarginFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromZSpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblZSpread)); - } - - @Override public double discountMarginFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - return discountMarginFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double discountMarginFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::discountMarginFromZSpreadToOptimalExercise =>" + - " Cant calc Discount Margin from Z Spread to optimal exercise for bonds w emb option"); - - return discountMarginFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double durationFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception - { - return durationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromASW - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblASW)); - } - - @Override public double durationFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - return durationFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double durationFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::durationFromASWToOptimalExercise => " + - "Cant calc Duration from ASW to optimal exercise for bonds w emb option"); - - return durationFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double durationFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception - { - return durationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromBondBasis - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblBondBasis)); - } - - @Override public double durationFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - return durationFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double durationFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::durationFromBondBasisToOptimalExercise => " + - "Cant calc Duration from Bond Basis to optimal exercise for bonds w emb option"); - - return durationFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double durationFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception - { - return durationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromCreditBasis (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblCreditBasis)); - } - - @Override public double durationFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - return durationFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double durationFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::durationFromCreditBasisToOptimalExercise => " + - "Cant calc Duration from Credit Basis to optimal exercise for bonds w emb option"); - - return durationFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double durationFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception - { - return durationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromDiscountMargin (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - dblDiscountMargin)); - } - - @Override public double durationFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - return durationFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double durationFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::durationFromDiscountMarginToOptimalExercise " + - "=> Cant calc Duration from Discount Margin to optimal exercise for bonds w emb option"); - - return durationFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double durationFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception - { - return durationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromGSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblGSpread)); - } - - @Override public double durationFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - return durationFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double durationFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::durationFromGSpreadToOptimalExercise => " + - "Cant calc Duration from G Spread to optimal exercise for bonds w emb option"); - - return durationFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double durationFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception - { - return durationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromISpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblISpread)); - } - - @Override public double durationFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - return durationFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double durationFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::durationFromISpreadToOptimalExercise => " + - "Cant calc Duration from I Spread to optimal exercise for bonds w emb option"); - - return durationFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double durationFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception - { - return durationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromOAS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblOAS)); - } - - @Override public double durationFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - return durationFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double durationFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::durationFromOASToOptimalExercise => " + - "Cant calc Duration from OAS to optimal exercise for bonds w emb option"); - - return durationFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double durationFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception - { - return durationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromPECS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPECS)); - } - - @Override public double durationFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - return durationFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double durationFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::durationFromPECSToOptimalExercise => " + - "Cant calc Duration from PECS to optimal exercise for bonds w emb option"); - - return durationFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double durationFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception - { - return modifiedDurationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPrice); - } - - @Override public double durationFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - return durationFromPrice (valParams, csqc, vcp, maturityDate().julian(), 1., dblPrice); - } - - @Override public double durationFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::durationFromPriceToOptimalExercise => " + - "Cant calc Duration from Price to optimal exercise for bonds w emb option"); - - return durationFromPrice (valParams, csqc, vcp, maturityDate().julian(), 1., dblPrice); - } - - @Override public double durationFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception - { - return durationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromTSYSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblTSYSpread)); - } - - @Override public double durationFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - return durationFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double durationFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::durationFromTSYSpreadToOptimalExercise => " + - "Cant calc Duration from TSY Sprd to optimal exercise for bonds w emb option"); - - return durationFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double durationFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception - { - return durationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromYield - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYield)); - } - - @Override public double durationFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - return durationFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double durationFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::durationFromYieldToOptimalExercise => " + - "Cant calc Duration from Yield to optimal exercise for bonds w emb option"); - - return durationFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double durationFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception - { - return durationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromYieldSpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYieldSpread)); - } - - @Override public double durationFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - return durationFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double durationFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::durationFromYieldSpreadToOptimalExercise => " + - "Cant calc Duration from Yield Spread to optimal exercise for bonds w emb option"); - - return durationFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double durationFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception - { - return durationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromZSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblZSpread)); - } - - @Override public double durationFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - return durationFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double durationFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::durationFromZSpreadToOptimalExercise => " + - "Cant calc Duration from Z Spread to optimal exercise for bonds w emb option"); - - return durationFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double gSpreadFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception - { - return gSpreadFromYield (valParams, csqs, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromASW - (valParams, csqs, vcp, iWorkoutDate, dblWorkoutFactor, dblASW)); - } - - @Override public double gSpreadFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - return gSpreadFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double gSpreadFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::gSpreadFromASWToOptimalExercise => " + - "Cant calc G Spread from ASW to optimal exercise for bonds w emb option"); - - return gSpreadFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double gSpreadFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception - { - return gSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromBondBasis - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblBondBasis)); - } - - @Override public double gSpreadFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - return gSpreadFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double gSpreadFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::gSpreadFromBondBasisToOptimalExercise => " + - "Cant calc G Spread from Bond Basis to optimal exercise for bonds w emb option"); - - return gSpreadFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double gSpreadFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception - { - return gSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromCreditBasis - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblCreditBasis)); - } - - @Override public double gSpreadFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - return gSpreadFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double gSpreadFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::gSpreadFromCreditBasisToOptimalExercise => " + - "Cant calc G Spread from Credit Basis to optimal exercise for bonds w emb option"); - - return gSpreadFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double gSpreadFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception - { - return gSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromDiscountMargin (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - dblDiscountMargin)); - } - - @Override public double gSpreadFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - return gSpreadFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double gSSpreadFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::gSSpreadFromDiscountMarginToOptimalExercise =>" + - " Cant calc G Spread from Discount Margin to optimal exercise for bonds w emb option"); - - return gSpreadFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double gSpreadFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception - { - return gSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromISpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblISpread)); - } - - @Override public double gSpreadFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - return gSpreadFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double gSpreadFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::gSpreadFromISpreadToOptimalExercise => " + - "Cant calc G Spread from I Spread to optimal exercise for bonds w emb option"); - - return gSpreadFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double gSpreadFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception - { - return gSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromOAS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblOAS)); - } - - @Override public double gSpreadFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - return gSpreadFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double gSpreadFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::gSpreadFromOASToOptimalExercise => " + - "Cant calc G Spread from OAS to optimal exercise for bonds w emb option"); - - return gSpreadFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double gSpreadFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception - { - return gSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromPECS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPECS)); - } - - @Override public double gSpreadFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - return gSpreadFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double gSpreadFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::gSpreadFromPECSToOptimalExercise => " + - "Cant calc G Spread from PECS to optimal exercise for bonds w emb option"); - - return gSpreadFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double gSpreadFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception - { - return gSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromPrice - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPrice)); - } - - @Override public double gSpreadFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - return gSpreadFromPrice (valParams, csqc, vcp, maturityDate().julian(), 1., dblPrice); - } - - @Override public double gSpreadFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - org.drip.param.valuation.WorkoutInfo wi = exerciseYieldFromPrice (valParams, csqc, vcp, dblPrice); - - if (null == wi) - throw new java.lang.Exception - ("BondComponent::gSpreadFromPriceToOptimalExercise => Can't do Work-out"); - - return gSpreadFromPrice (valParams, csqc, vcp, wi.date(), wi.factor(), dblPrice); - } - - @Override public double gSpreadFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception - { - return gSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromTSYSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblTSYSpread)); - } - - @Override public double gSpreadFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - return gSpreadFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double gSpreadFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::gSpreadFromTSYSpreadToOptimalExercise => " + - "Cant calc G Spread from TSY Spread to optimal exercise for bonds w emb option"); - - return gSpreadFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double gSpreadFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception - { - if (null == valParams || null == csqc || !org.drip.quant.common.NumberUtil.IsValid (dblYield) || - valParams.valueDate() >= iWorkoutDate) - throw new java.lang.Exception ("BondComponent::gSpreadFromYield => Invalid inputs"); - - org.drip.state.govvie.GovvieCurve gc = csqc.govvieState (govvieLabel()); - - if (null == gc) throw new java.lang.Exception ("BondComponent::gSpreadFromYield => Invalid inputs"); - - return dblYield - gc.yield (iWorkoutDate); - } - - @Override public double gSpreadFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - return gSpreadFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double gSpreadFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::gSpreadFromYieldToOptimalExercise => " + - "Cant calc G Spread from Yield to optimal exercise for bonds w emb option"); - - return gSpreadFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double gSpreadFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception - { - return gSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromYieldSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYieldSpread)); - } - - @Override public double gSpreadFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - return gSpreadFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double gSpreadFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::gSpreadFromYieldSpreadToOptimalExercise => " + - "Cant calc G Spread from Yield Spread to optimal exercise for bonds w emb option"); - - return gSpreadFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double gSpreadFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception - { - return gSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromZSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblZSpread)); - } - - @Override public double gSpreadFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - return gSpreadFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double gSpreadFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::gSpreadFromZSpreadToOptimalExercise => " + - "Cant calc G Spread from Z Spread to optimal exercise for bonds w emb option"); - - return gSpreadFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double iSpreadFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception - { - return iSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromASW - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblASW)); - } - - @Override public double iSpreadFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - return iSpreadFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double iSpreadFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::iSpreadFromASWToOptimalExercise => " + - "Cant calc I Spread from ASW to optimal exercise for bonds w emb option"); - - return iSpreadFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double iSpreadFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception - { - return iSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromBondBasis - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblBondBasis)); - } - - @Override public double iSpreadFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - return iSpreadFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double iSpreadFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::iSpreadFromBondBasisToOptimalExercise => " + - "Cant calc I Spread from Bond Basis to optimal exercise for bonds w emb option"); - - return iSpreadFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double iSpreadFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception - { - return iSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromCreditBasis - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblCreditBasis)); - } - - @Override public double iSpreadFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - return iSpreadFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double iSpreadFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::iSpreadFromCreditBasisToOptimalExercise => " + - "Cant calc I Spread from Credit Basis to optimal exercise for bonds w emb option"); - - return iSpreadFromCreditBasis (valParams, csqs, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double iSpreadFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception - { - return iSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromDiscountMargin (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - dblDiscountMargin)); - } - - @Override public double iSpreadFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - return iSpreadFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double iSpreadFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::iSpreadFromDiscountMarginToOptimalExercise =>" + - " Cant calc I Spread from Discount Margin to optimal exercise for bonds w emb option"); - - return iSpreadFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double iSpreadFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception - { - return iSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromGSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblGSpread)); - } - - @Override public double iSpreadFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - return iSpreadFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double iSpreadFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::iSpreadFromGSpreadToOptimalExercise => " + - "Cant calc I Spread from G Spread to optimal exercise for bonds w emb option"); - - return iSpreadFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double iSpreadFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception - { - return iSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromOAS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblOAS)); - } - - @Override public double iSpreadFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - return iSpreadFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double iSpreadFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::iSpreadFromOASToOptimalExercise => " + - "Cant calc I Spread from OAS to optimal exercise for bonds w emb option"); - - return iSpreadFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double iSpreadFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception - { - return iSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromPECS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPECS)); - } - - @Override public double iSpreadFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - return iSpreadFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double iSpreadFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::iSpreadFromPECSToOptimalExercise => " + - "Cant calc I Spread from PECS to optimal exercise for bonds w emb option"); - - return iSpreadFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double iSpreadFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception - { - return iSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromPrice - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPrice)); - } - - @Override public double iSpreadFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - return iSpreadFromPrice (valParams, csqc, vcp, maturityDate().julian(), 1., dblPrice); - } - - @Override public double iSpreadFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - org.drip.param.valuation.WorkoutInfo wi = exerciseYieldFromPrice (valParams, csqc, vcp, dblPrice); - - if (null == wi) - throw new java.lang.Exception - ("BondComponent::iSpreadFromPriceToOptimalExercise => Can't do Work-out"); - - return iSpreadFromYield (valParams, csqc, vcp, wi.date(), wi.factor(), wi.yield()); - } - - @Override public double iSpreadFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception - { - return iSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromTSYSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblTSYSpread)); - } - - @Override public double iSpreadFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - return iSpreadFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double iSpreadFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::iSpreadFromTSYSpreadToOptimalExercise => " + - "Cant calc I Spread from TSY Spread to optimal exercise for bonds w emb option"); - - return iSpreadFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double iSpreadFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception - { - if (null == csqc || !org.drip.quant.common.NumberUtil.IsValid (dblYield)) - throw new java.lang.Exception ("BondComponent::iSpreadFromYield => Invalid inputs"); - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqc.fundingState (fundingLabel()); - - if (null == dcFunding) - throw new java.lang.Exception ("BondComponent::iSpreadFromYield => Invalid inputs"); - - return dblYield - dcFunding.estimateManifestMeasure ("SwapRate", iWorkoutDate); - } - - @Override public double iSpreadFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - return iSpreadFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double iSpreadFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::iSpreadFromYieldToOptimalExercise => " + - "Cant calc I Spread from Yield to optimal exercise for bonds w emb option"); - - return iSpreadFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double iSpreadFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception - { - return iSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromYieldSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYieldSpread)); - } - - @Override public double iSpreadFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - return iSpreadFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double iSpreadFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::iSpreadFromYieldSpreadToOptimalExercise => " + - "Cant calc I Spread from Yield Spread to optimal exercise for bonds w emb option"); - - return iSpreadFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double iSpreadFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception - { - return iSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromZSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblZSpread)); - } - - @Override public double iSpreadFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - return iSpreadFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double iSpreadFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::iSpreadFromZSpreadToOptimalExercise => " + - "Cant calc I Spread from Z Spread to optimal exercise for bonds w emb option"); - - return iSpreadFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double macaulayDurationFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception - { - return macaulayDurationFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromASW (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblASW)); - } - - @Override public double macaulayDurationFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - return macaulayDurationFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double macaulayDurationFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::macaulayDurationFromASWToOptimalExercise => " + - "Cant calc Macaulay Duration from ASW to optimal exercise for bonds w emb option"); - - return macaulayDurationFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double macaulayDurationFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception - { - return macaulayDurationFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromBondBasis (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblBondBasis)); - } - - @Override public double macaulayDurationFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - return macaulayDurationFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., - dblBondBasis); - } - - @Override public double macaulayDurationFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::macaulayDurationFromBondBasisToOptimalExercise => " + - "Cant calc Macaulay Duration from Bnd Basis to optimal exercise for bonds w emb option"); - - return macaulayDurationFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., - dblBondBasis); - } - - @Override public double macaulayDurationFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception - { - return macaulayDurationFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromCreditBasis (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblCreditBasis)); - } - - @Override public double macaulayDurationFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - return macaulayDurationFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., - dblCreditBasis); - } - - @Override public double macaulayDurationFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::macaulayDurationFromCreditBasisToOptimalExercise => " + - "Cant calc Macaulay Duration from Crd Basis to optimal exercise for bonds w emb option"); - - return macaulayDurationFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., - dblCreditBasis); - } - - @Override public double macaulayDurationFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception - { - return macaulayDurationFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromDiscountMargin (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - dblDiscountMargin)); - } - - @Override public double macaulayDurationFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - return macaulayDurationFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double macaulayDurationFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::macaulayDurationFromDiscountMarginToOptimalExercise => " + - "Cant calc Macaulay Duration from Disc Marg to optimal exercise for bonds w emb option"); - - return macaulayDurationFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double macaulayDurationFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception - { - return macaulayDurationFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromGSpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblGSpread)); - } - - @Override public double macaulayDurationFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - return macaulayDurationFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double macaulayDurationFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::macaulayDurationFromGSpreadToOptimalExercise => " + - "Cant calc Macaulay Duration from G Spread to optimal exercise for bonds w emb option"); - - return macaulayDurationFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double macaulayDurationFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception - { - return macaulayDurationFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromISpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblISpread)); - } - - @Override public double macaulayDurationFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - return macaulayDurationFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double macaulayDurationFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::macaulayDurationFromISpreadToOptimalExercise => " + - "Cant calc Macaulay Duration from I Spread to optimal exercise for bonds w emb option"); - - return macaulayDurationFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double macaulayDurationFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception - { - return macaulayDurationFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromOAS (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblOAS)); - } - - @Override public double macaulayDurationFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - return macaulayDurationFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double mnacaulayDurationFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::mnacaulayDurationFromOASToOptimalExercise => " + - "Cant calc Macaulay Duration from OAS to optimal exercise for bonds w emb option"); - - return macaulayDurationFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double macaulayDurationFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception - { - return macaulayDurationFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromPECS (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPECS)); - } - - @Override public double macaulayDurationFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - return macaulayDurationFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double macaulayDurationFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::macaulayDurationFromPECSToOptimalExercise => " + - "Cant calc Macaulay Duration from PECS to optimal exercise for bonds w emb option"); - - return macaulayDurationFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double macaulayDurationFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception - { - return macaulayDurationFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPrice)); - } - - @Override public double macaulayDurationFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - return macaulayDurationFromPrice (valParams, csqc, vcp, maturityDate().julian(), 1., dblPrice); - } - - @Override public double macaulayDurationFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - org.drip.param.valuation.WorkoutInfo wi = exerciseYieldFromPrice (valParams, csqc, vcp, dblPrice); - - if (null == wi) - throw new java.lang.Exception - ("BondComponent::macaulayDurationFromPriceToOptimalExercise => Cant determine Work-out"); - - return macaulayDurationFromPrice (valParams, csqc, vcp, wi.date(), wi.factor(), wi.yield()); - } - - @Override public double macaulayDurationFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception - { - return macaulayDurationFromTSYSpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromTSYSpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblTSYSpread)); - } - - @Override public double macaulayDurationFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - return macaulayDurationFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., - dblTSYSpread); - } - - @Override public double macaulayDurationFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::macaulayDurationFromTSYSpreadToOptimalExercise => " + - "Cant calc Macaulay Duration from TSY Sprd to optimal exercise for bonds w emb option"); - - return macaulayDurationFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., - dblTSYSpread); - } - - @Override public double macaulayDurationFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception - { - if (null == valParams || !org.drip.quant.common.NumberUtil.IsValid (dblWorkoutFactor)) - throw new java.lang.Exception ("BondComponent::macaulayDurationFromYield => Invalid inputs"); - - int iValueDate = valParams.valueDate(); - - if (iValueDate >= iWorkoutDate) - throw new java.lang.Exception ("BondComponent::macaulayDurationFromYield => Invalid inputs"); - - boolean bFirstPeriod = true; - double dblPeriodYearFract = 0.; - double dblCumulativePeriodPV = 0.; - boolean bTerminateCouponFlow = false; - double dblCumulativePeriodDuration = 0.; - org.drip.analytics.daycount.ActActDCParams aap = null; - org.drip.analytics.cashflow.CompositePeriod periodRef = null; - - int iFrequency = freq(); - - java.lang.String strDC = couponDC(); - - java.lang.String strCalendar = currency(); - - boolean bApplyCpnEOMAdj = _stream.couponEOMAdjustment(); - - if (null == strCalendar || strCalendar.isEmpty()) strCalendar = redemptionCurrency(); - - org.drip.param.valuation.ValuationCustomizationParams vcpQuote = null == _marketConvention ? null : - _marketConvention.valuationCustomizationParams(); - - if (null != vcp) { - strDC = vcp.yieldDayCount(); - - iFrequency = vcp.yieldFreq(); - - strCalendar = vcp.yieldCalendar(); - - bApplyCpnEOMAdj = vcp.applyYieldEOMAdj(); - } else if (null != vcpQuote) { - strDC = vcpQuote.yieldDayCount(); - - iFrequency = vcpQuote.yieldFreq(); - - strCalendar = vcpQuote.yieldCalendar(); - - bApplyCpnEOMAdj = vcpQuote.applyYieldEOMAdj(); - } - - int iAmortizationMode = _notionalSetting.periodAmortizationMode(); - - for (org.drip.analytics.cashflow.CompositePeriod period : couponPeriods()) { - int iPeriodPayDate = period.payDate(); - - if (iPeriodPayDate < iValueDate) continue; - - if (bFirstPeriod) { - bFirstPeriod = false; - - dblPeriodYearFract = period.couponDCF() - period.accrualDCF (iValueDate); - } else - dblPeriodYearFract += period.couponDCF(); - - periodRef = period; - - int iPeriodEndDate = period.endDate(); - - int iPeriodStartDate = period.startDate(); - - if (iPeriodEndDate >= iWorkoutDate) { - bTerminateCouponFlow = true; - iPeriodEndDate = iWorkoutDate; - } - - org.drip.analytics.output.CompositePeriodCouponMetrics cpcm = couponMetrics (iValueDate, - valParams, csqc); - - if (null == cpcm) - throw new java.lang.Exception ("BondComponent::macaulayDurationFromYield => No CPCM"); - - if (null != vcp) { - if (null == (aap = vcp.yieldAAP())) - aap = new org.drip.analytics.daycount.ActActDCParams (vcp.yieldFreq(), iPeriodEndDate - - iPeriodStartDate); - } else if (null != vcpQuote) { - if (null == (aap = vcpQuote.yieldAAP())) - aap = new org.drip.analytics.daycount.ActActDCParams (vcpQuote.yieldFreq(), - iPeriodEndDate - iPeriodStartDate); - } else - aap = new org.drip.analytics.daycount.ActActDCParams (iFrequency, iPeriodEndDate - - iPeriodStartDate); - - double dblYearFract = org.drip.analytics.daycount.Convention.YearFraction (iValueDate, - iPeriodPayDate, strDC, bApplyCpnEOMAdj, aap, strCalendar); - - double dblYieldAnnuity = org.drip.analytics.support.Helper.Yield2DF (iFrequency, dblYield, - s_bYieldDFOffofCouponAccrualDCF ? dblPeriodYearFract : dblYearFract) * cpcm.cumulative(); - - double dblPeriodStartNotional = notional (iPeriodStartDate); - - double dblPeriodEndNotional = notional (iPeriodEndDate); - - double dblCouponNotional = dblPeriodStartNotional; - - if (org.drip.product.params.NotionalSetting.PERIOD_AMORT_AT_END == iAmortizationMode) - dblCouponNotional = dblPeriodEndNotional; - else if (org.drip.product.params.NotionalSetting.PERIOD_AMORT_EFFECTIVE == iAmortizationMode) - dblCouponNotional = notional (iPeriodStartDate, iPeriodEndDate); - - double dblCouponPV = period.accrualDCF (iPeriodEndDate) * cpcm.rate() * dblYieldAnnuity * - dblCouponNotional; - - double dblPeriodNotionalPV = (dblPeriodStartNotional - dblPeriodEndNotional) * dblYieldAnnuity; - dblCumulativePeriodDuration += dblPeriodYearFract * (dblCouponPV + dblPeriodNotionalPV); - dblCumulativePeriodPV += (dblCouponPV + dblPeriodNotionalPV); - - if (bTerminateCouponFlow) break; - } - - if (null != periodRef) - aap = new org.drip.analytics.daycount.ActActDCParams (iFrequency, periodRef.endDate() - - periodRef.startDate()); - - double dblRedemptionPV = dblWorkoutFactor * org.drip.analytics.support.Helper.Yield2DF (iFrequency, - dblYield, s_bYieldDFOffofCouponAccrualDCF ? dblPeriodYearFract : - org.drip.analytics.daycount.Convention.YearFraction (iValueDate, iWorkoutDate, strDC, - bApplyCpnEOMAdj, aap, strCalendar)) * notional (iWorkoutDate); - - return (dblCumulativePeriodDuration + dblPeriodYearFract * dblRedemptionPV) / (dblCumulativePeriodPV - + dblRedemptionPV); - } - - @Override public double macaulayDurationFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - return macaulayDurationFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double macaulayDurationFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::macaulayDurationFromYieldToOptimalExercise =>" + - " Cant calc Macaulay Duration from Yield to optimal exercise for bonds w emb option"); - - return macaulayDurationFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double macaulayDurationFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception - { - return macaulayDurationFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromYieldSpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYieldSpread)); - } - - @Override public double macaulayDurationFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - return macaulayDurationFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., - dblYieldSpread); - } - - @Override public double macaulayDurationFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::macaulayDurationFromYieldSpreadToOptimalExercise => " + - "Cant calc Macaulay Duration from Yld Sprd to optimal exercise for bonds w emb option"); - - return macaulayDurationFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., - dblYieldSpread); - } - - @Override public double macaulayDurationFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception - { - return macaulayDurationFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromZSpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblZSpread)); - } - - @Override public double macaulayDurationFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - return macaulayDurationFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double macaulayDurationFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::macaulayDurationFromZSpreadToOptimalExercise => " + - "Cant calc Macaulay Duration from Z Spread to optimal exercise for bonds w emb option"); - - return macaulayDurationFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double modifiedDurationFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception - { - return modifiedDurationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromASW (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblASW)); - } - - @Override public double modifiedDurationFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - return modifiedDurationFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double modifiedDurationFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::modifiedDurationFromASWToOptimalExercise => " + - "Cant calc Modified Duration from ASW to optimal exercise for bonds w emb option"); - - return modifiedDurationFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double modifiedDurationFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception - { - return modifiedDurationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromBondBasis (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblBondBasis)); - } - - @Override public double modifiedDurationFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - return modifiedDurationFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., - dblBondBasis); - } - - @Override public double modifiedDurationFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::modifiedDurationFromBondBasisToOptimalExercise => " + - "Cant calc Modified Duration from Bnd Basis to optimal exercise for bonds w emb option"); - - return modifiedDurationFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., - dblBondBasis); - } - - @Override public double modifiedDurationFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception - { - return modifiedDurationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromCreditBasis (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblCreditBasis)); - } - - @Override public double modifiedDurationFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - return modifiedDurationFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., - dblCreditBasis); - } - - @Override public double modifiedDurationFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::modifiedDurationFromCreditBasisToOptimalExercise => " + - "Cant calc Modified Duration from Crd Basis to optimal exercise for bonds w emb option"); - - return modifiedDurationFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., - dblCreditBasis); - } - - @Override public double modifiedDurationFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception - { - return modifiedDurationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromDiscountMargin (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - dblDiscountMargin)); - } - - @Override public double modifiedDurationFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - return modifiedDurationFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double modifiedDurationFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::modifiedDurationFromDiscountMarginToOptimalExercise => " + - "Cant calc Modified Duration from Disc Marg to optimal exercise for bonds w emb option"); - - return modifiedDurationFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double modifiedDurationFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception - { - return modifiedDurationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromGSpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblGSpread)); - } - - @Override public double modifiedDurationFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - return modifiedDurationFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double modifiedDurationFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::modifiedDurationFromGSpreadToOptimalExercise => " + - "Cant calc Modified Duration from G Spread to optimal exercise for bonds w emb option"); - - return modifiedDurationFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double modifiedDurationFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception - { - return modifiedDurationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromISpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblISpread)); - } - - @Override public double modifiedDurationFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - return modifiedDurationFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double modifiedDurationFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::modifiedDurationFromISpreadToOptimalExercise => " + - "Cant calc Modified Duration from I Spread to optimal exercise for bonds w emb option"); - - return modifiedDurationFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double modifiedDurationFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception - { - return modifiedDurationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromOAS (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblOAS)); - } - - @Override public double modifiedDurationFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - return modifiedDurationFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double modifiedDurationFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::modifiedDurationFromOASToOptimalExercise => " + - "Cant calc Modified Duration from OAS to optimal exercise for bonds w emb option"); - - return modifiedDurationFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double modifiedDurationFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception - { - return modifiedDurationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromPECS (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPECS)); - } - - @Override public double modifiedDurationFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - return modifiedDurationFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double modifiedDurationFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::modifiedDurationFromPECSToOptimalExercise => " + - "Cant calc Modified Duration from PECS to optimal exercise for bonds w emb option"); - - return modifiedDurationFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double modifiedDurationFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception - { - if (null == valParams || !org.drip.quant.common.NumberUtil.IsValid (dblPrice)) - throw new java.lang.Exception ("BondComponent::modifiedDurationFromPrice => Input inputs"); - - return (dblPrice - priceFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPrice) + 0.0001)) / - (dblPrice + accrued (valParams.valueDate(), csqc)); - } - - @Override public double modifiedDurationFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - return modifiedDurationFromPrice (valParams, csqc, vcp, maturityDate().julian(), 1., dblPrice); - } - - @Override public double modifiedDurationFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - org.drip.param.valuation.WorkoutInfo wi = exerciseYieldFromPrice (valParams, csqc, vcp, dblPrice); - - if (null == wi) - throw new java.lang.Exception - ("BondComponent::modifiedDurationFromPriceToOptimalExercise => Cant determine Work-out"); - - return modifiedDurationFromYield (valParams, csqc, vcp, wi.date(), wi.factor(), wi.yield()); - } - - @Override public double modifiedDurationFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception - { - return modifiedDurationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromTSYSpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblTSYSpread)); - } - - @Override public double modifiedDurationFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - return modifiedDurationFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., - dblTSYSpread); - } - - @Override public double modifiedDurationFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::modifiedDurationFromTSYSpreadToOptimalExercise => " + - "Cant calc Modified Duration from TSY Sprd to optimal exercise for bonds w emb option"); - - return modifiedDurationFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., - dblTSYSpread); - } - - @Override public double modifiedDurationFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception - { - return modifiedDurationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYield)); - } - - @Override public double modifiedDurationFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - return modifiedDurationFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double modifiedDurationFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::modifiedDurationFromYieldToOptimalExercise =>" + - " Cant calc Modified Duration from Yield to optimal exercise for bonds w emb option"); - - return modifiedDurationFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double modifiedDurationFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception - { - return modifiedDurationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromYieldSpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYieldSpread)); - } - - @Override public double modifiedDurationFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - return modifiedDurationFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., - dblYieldSpread); - } - - @Override public double modifiedDurationFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::modifiedDurationFromYieldSpreadToOptimalExercise => " + - "Cant calc Modified Duration from Yld Sprd to optimal exercise for bonds w emb option"); - - return modifiedDurationFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., - dblYieldSpread); - } - - @Override public double modifiedDurationFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception - { - return modifiedDurationFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromZSpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblZSpread)); - } - - @Override public double modifiedDurationFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - return modifiedDurationFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double modifiedDurationFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::modifiedDurationFromZSpreadToOptimalExercise => " + - "Cant calc Modified Duration from Z Spread to optimal exercise for bonds w emb option"); - - return modifiedDurationFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double oasFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception - { - return oasFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromASW (valParams, - csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblASW)); - } - - @Override public double oasFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - return oasFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double oasFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::oasFromASWToOptimalExercise => " + - "Cant calc OAS from ASW to optimal exercise for bonds w emb option"); - - return oasFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double oasFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception - { - return oasFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromBondBasis - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblBondBasis)); - } - - @Override public double oasFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - return oasFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double oasFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::oasFromBondBasisToOptimalExercise => " + - "Cant calc OAS from Bnd Basis to optimal exercise for bonds w emb option"); - - return oasFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double oasFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception - { - return oasFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromCreditBasis - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblCreditBasis)); - } - - @Override public double oasFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - return oasFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double oasFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::oasFromCreditBasisToOptimalExercise => " + - "Cant calc OAS from Credit Basis to optimal exercise for bonds w emb option"); - - return oasFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double oasFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception - { - return oasFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromDiscountMargin - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblDiscountMargin)); - } - - @Override public double oasFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - return oasFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., dblDiscountMargin); - } - - @Override public double oasFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::oasFromDiscountMarginToOptimalExercise => " + - "Cant calc OAS from Discount Margin to optimal exercise for bonds w emb option"); - - return oasFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., dblDiscountMargin); - } - - @Override public double oasFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception - { - return oasFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromGSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblGSpread)); - } - - @Override public double oasFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - return oasFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double oasFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::oasFromGSpreadToOptimalExercise => " + - "Cant calc OAS from G Spread to optimal exercise for bonds w emb option"); - - return oasFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double oasFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception - { - return oasFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromISpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblISpread)); - } - - @Override public double oasFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - return oasFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double oasFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::oasFromISpreadToOptimalExercise => " + - "Cant calc OAS from I Spread to optimal exercise for bonds w emb option"); - - return oasFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double oasFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception - { - return oasFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromPrice - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPECS)); - } - - @Override public double oasFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - return oasFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double oasFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::oasFromPECSToOptimalExercise => " + - "Cant calc OAS from PECS to optimal exercise for bonds w emb option"); - - return oasFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double oasFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception - { - return new BondCalibrator (this).calibrateOASFromPrice (valParams, csqc, - ZERO_OFF_OF_TREASURIES_DISCOUNT_CURVE, iWorkoutDate, dblWorkoutFactor, dblPrice); - } - - @Override public double oasFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - return oasFromPrice (valParams, csqc, vcp, maturityDate().julian(), 1., dblPrice); - } - - @Override public double oasFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - org.drip.param.valuation.WorkoutInfo wi = exerciseYieldFromPrice (valParams, csqc, vcp, dblPrice); - - if (null == wi) - throw new java.lang.Exception - ("BondComponent::oasFromPriceToOptimalExercise - cant calc Work-out"); - - return oasFromPrice (valParams, csqc, vcp, wi.date(), wi.factor(), dblPrice); - } - - @Override public double oasFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception - { - return oasFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromTSYSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblTSYSpread)); - } - - @Override public double oasFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - return oasFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double oasFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::oasFromTSYSpreadToOptimalExercise => " + - "Cant calc OAS from TSY Sprd to optimal exercise for bonds w emb option"); - - return oasFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double oasFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception - { - return oasFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromYield - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYield)); - } - - @Override public double oasFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - return oasFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double oasFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::oasFromYieldToOptimalExercise => " + - "Cant calc OAS from Yield to optimal exercise for bonds w emb option"); - - return oasFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double oasFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception - { - return oasFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromYieldSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYieldSpread)); - } - - @Override public double oasFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - return oasFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double oasFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::oasFromYieldSpreadToOptimalExercise => " + - "Cant calc OAS from Yield Sprd to optimal exercise for bonds w emb option"); - - return oasFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double oasFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception - { - return oasFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromZSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblZSpread)); - } - - @Override public double oasFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - return oasFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double oasFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::oasFromZSpreadToOptimalExercise => " + - "Cant calc OAS from Z Spread to optimal exercise for bonds w emb option"); - - return oasFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double pecsFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception - { - return pecsFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromASW - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblASW)); - } - - @Override public double pecsFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - return pecsFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double pecsFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::pecsFromASWToOptimalExercise => " + - "Cant calc PECS from ASW to optimal exercise for bonds w emb option"); - - return pecsFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double pecsFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception - { - return pecsFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromBondBasis - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblBondBasis)); - } - - @Override public double pecsFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - return pecsFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double pecsFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::pecsFromBondBasisToOptimalExercise => " + - "Cant calc PECS from Bond Basis to optimal exercise for bonds w emb option"); - - return pecsFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double pecsFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception - { - return pecsFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromCreditBasis - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblCreditBasis)); - } - - @Override public double pecsFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - return pecsFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double pecsFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::pecsFromCreditBasisToOptimalExercise => " + - "Cant calc PECS from Credit Basis to optimal exercise for bonds w emb option"); - - return pecsFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double pecsFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception - { - return pecsFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromDiscountMargin - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblDiscountMargin)); - } - - @Override public double pecsFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - return pecsFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., dblDiscountMargin); - } - - @Override public double pecsFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::pecsFromDiscountMarginToOptimalExercise => " + - "Cant calc PECS from Discount Margin to optimal exercise for bonds w emb option"); - - return pecsFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., dblDiscountMargin); - } - - @Override public double pecsFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception - { - return pecsFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromGSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblGSpread)); - } - - @Override public double pecsFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - return pecsFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double pecsFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::pecsFromGSpreadToOptimalExercise => " + - "Cant calc PECS from G Spread to optimal exercise for bonds w emb option"); - - return pecsFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double pecsFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception - { - return pecsFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromISpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblISpread)); - } - - @Override public double pecsFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - return pecsFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double pecsFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::pecsFromISpreadToOptimalExercise => " + - "Cant calc PECS from I Spread to optimal exercise for bonds w emb option"); - - return pecsFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double pecsFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception - { - return pecsFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromOAS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblOAS)); - } - - @Override public double pecsFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - return pecsFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double pecsFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::pecsFromOASToOptimalExercise => " + - "Cant calc PECS from OAS to optimal exercise for bonds w emb option"); - - return pecsFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double pecsFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception - { - return new BondCalibrator (this).calibrateCreditBasisFromPrice (valParams, csqc, iWorkoutDate, - dblWorkoutFactor, dblPrice, true); - } - - @Override public double pecsFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - return pecsFromPrice (valParams, csqc, vcp, maturityDate().julian(), 1., dblPrice); - } - - @Override public double pecsFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - org.drip.param.valuation.WorkoutInfo wi = exerciseYieldFromPrice (valParams, csqc, vcp, dblPrice); - - if (null == wi) - throw new java.lang.Exception - ("BondComponent::pecsFromPriceToOptimalExercise => Cant determine Work-out"); - - return pecsFromPrice (valParams, csqc, vcp, wi.date(), wi.factor(), dblPrice); - } - - @Override public double pecsFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception - { - return pecsFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromTSYSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblTSYSpread)); - } - - @Override public double pecsFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - return pecsFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double pecsFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::pecsFromTSYSpreadToOptimalExercise => " + - "Cant calc PECS from TSY Spread to optimal exercise for bonds w emb option"); - - return pecsFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double pecsFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception - { - return pecsFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromYield - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYield)); - } - - @Override public double pecsFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - return pecsFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double pecsFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::pecsFromYieldToOptimalExercise => " + - "Cant calc PECS from Yield to optimal exercise for bonds w emb option"); - - return pecsFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double pecsFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception - { - return pecsFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromYieldSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYieldSpread)); - } - - @Override public double pecsFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - return pecsFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double pecsFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::pecsFromYieldSpreadToOptimalExercise => " + - "Cant calc PECS from Yield Spread to optimal exercise for bonds w emb option"); - - return pecsFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double pecsFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception - { - return pecsFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromZSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblZSpread)); - } - - @Override public double pecsFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - return pecsFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double pecsFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::pecsFromZSpreadToOptimalExercise => " + - "Cant calc PECS from Z Spread to optimal exercise for bonds w emb option"); - - return pecsFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double priceFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception - { - if (null == valParams || null == csqc || !org.drip.quant.common.NumberUtil.IsValid (dblWorkoutFactor) - || !org.drip.quant.common.NumberUtil.IsValid (dblASW)) - throw new java.lang.Exception ("BondComponent::priceFromASW => Invalid Inputs"); - - int iValueDate = valParams.valueDate(); - - if (iValueDate >= iWorkoutDate) - throw new java.lang.Exception ("BondComponent::priceFromASW => Invalid Inputs"); - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqc.fundingState (fundingLabel()); - - if (null == dcFunding) - throw new java.lang.Exception ("BondComponent::priceFromASW => Invalid Inputs"); - - org.drip.analytics.output.CompositePeriodCouponMetrics cpcm = couponMetrics (iValueDate, valParams, - csqc); - - if (null == cpcm) throw new java.lang.Exception ("BondComponent::priceFromASW => No CPCM"); - - return dblWorkoutFactor - 100. * dcFunding.parSwapDV01 (iWorkoutDate) * (dblASW + - dcFunding.estimateManifestMeasure ("SwapRate", iWorkoutDate) - cpcm.rate()); - } - - @Override public double priceFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - return priceFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double priceFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::priceFromASWToOptimalExercise => " + - "Cant calc Price from ASW to optimal exercise for bonds w emb option"); - - return priceFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double priceFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception - { - return priceFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromBondBasis - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblBondBasis)); - } - - @Override public double priceFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - return priceFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double priceFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::priceFromBondBasisToOptimalExercise => " + - "Cant calc Price from Bond Basis to optimal exercise for bonds w emb option"); - - return priceFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double priceFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception - { - return priceFromCreditCurve (valParams, csqc, iWorkoutDate, dblWorkoutFactor, dblCreditBasis, - false); - } - - @Override public double priceFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - return priceFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double priceFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::priceFromCreditBasisToOptimalExercise => " + - "Cant calc Price from Credit Basis to optimal exercise for bonds w emb option"); - - return priceFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double priceFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception - { - return priceFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromDiscountMargin (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - dblDiscountMargin)); - } - - @Override public double priceFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - double dblDiscountMargin) - throws java.lang.Exception - { - return priceFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double priceFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::priceFromDiscountMarginToOptimalExercise => " + - "Cant calc Price from Discount Margin to optimal exercise for bonds w emb option"); - - return priceFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double priceFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception - { - return priceFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromGSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblGSpread)); - } - - @Override public double priceFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - return priceFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double priceFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::priceFromGSpreadToOptimalExercise => " + - "Cant calc Price from G Spread to optimal exercise for bonds w emb option"); - - return priceFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double priceFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception - { - return priceFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromISpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblISpread)); - } - - @Override public double priceFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - return priceFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double priceFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::priceFromISpreadToOptimalExercise => " + - "Cant calc Price from I Spread to optimal exercise for bonds w emb option"); - - return priceFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double priceFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception - { - return priceFromZeroCurve (valParams, csqc, vcp, ZERO_OFF_OF_TREASURIES_DISCOUNT_CURVE, - iWorkoutDate, dblWorkoutFactor, dblOAS); - } - - @Override public double priceFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - return priceFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double priceFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::priceFromOASToOptimalExercise => " + - "Cant calc Price from OAS to optimal exercise for bonds w emb option"); - - return priceFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double priceFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception - { - return priceFromCreditCurve (valParams, csqc, iWorkoutDate, dblWorkoutFactor, dblPECS, true); - } - - @Override public double priceFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - return priceFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double priceFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::priceFromPECSToOptimalExercise => " + - "Cant calc Price from PECS to optimal exercise for bonds w emb option"); - - return priceFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double priceFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception - { - return priceFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromTSYSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblTSYSpread)); - } - - @Override public double priceFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - return priceFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double priceFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::priceFromTSYSpreadToOptimalExercise => " + - "Cant calc Price from TSY Spread to optimal exercise for bonds w emb option"); - - return priceFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double priceFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception - { - if (null == valParams || !org.drip.quant.common.NumberUtil.IsValid (dblWorkoutFactor)) - throw new java.lang.Exception ("BondComponent::priceFromYield => Invalid inputs"); - - int iValueDate = valParams.valueDate(); - - if (iValueDate >= iWorkoutDate) - throw new java.lang.Exception ("BondComponent::priceFromYield => Invalid inputs"); - - boolean bFirstPeriod = true; - double dblPeriodYearFract = 0.; - double dblCumulativePeriodPV = 0.; - boolean bTerminateCouponFlow = false; - int iCashPayDate = java.lang.Integer.MIN_VALUE; - double dblScalingNotional = java.lang.Double.NaN; - org.drip.analytics.daycount.ActActDCParams aap = null; - - if (null != _notionalSetting && _notionalSetting.priceOffOfOriginalNotional()) - dblScalingNotional = 1.; - - int iFrequency = freq(); - - java.lang.String strDC = couponDC(); - - java.lang.String strCalendar = currency(); - - boolean bApplyCpnEOMAdj = _stream.couponEOMAdjustment(); - - if (null == strCalendar || strCalendar.isEmpty()) strCalendar = redemptionCurrency(); - - org.drip.param.valuation.ValuationCustomizationParams vcpQuote = null == _marketConvention ? null : - _marketConvention.valuationCustomizationParams(); - - if (null != vcp) { - strDC = vcp.yieldDayCount(); - - iFrequency = vcp.yieldFreq(); - - strCalendar = vcp.yieldCalendar(); - - bApplyCpnEOMAdj = vcp.applyYieldEOMAdj(); - } else if (null != vcpQuote) { - strDC = vcpQuote.yieldDayCount(); - - iFrequency = vcpQuote.yieldFreq(); - - strCalendar = vcpQuote.yieldCalendar(); - - bApplyCpnEOMAdj = vcpQuote.applyYieldEOMAdj(); - } - - int iPeriodAmortizationMode = _notionalSetting.periodAmortizationMode(); - - for (org.drip.analytics.cashflow.CompositePeriod period : couponPeriods()) { - int iPeriodPayDate = period.payDate(); - - if (iPeriodPayDate < iValueDate) continue; - - if (bFirstPeriod) { - bFirstPeriod = false; - - dblPeriodYearFract = period.couponDCF() - period.accrualDCF (iValueDate); - } else - dblPeriodYearFract += period.couponDCF(); - - int iPeriodEndDate = period.endDate(); - - int iPeriodStartDate = period.startDate(); - - if (iPeriodEndDate >= iWorkoutDate) { - iPeriodEndDate = iWorkoutDate; - bTerminateCouponFlow = true; - } - - if (!org.drip.quant.common.NumberUtil.IsValid (dblScalingNotional)) - dblScalingNotional = notional (iPeriodStartDate); - - org.drip.analytics.output.CompositePeriodCouponMetrics cpcm = couponMetrics (iValueDate, - valParams, csqc); - - if (null == cpcm) - throw new java.lang.Exception ("BondComponent::priceFromYield => No PCM for " + new - org.drip.analytics.date.JulianDate (iValueDate) + " | " + effectiveDate()); - - if (null != vcp) { - if (null == (aap = vcp.yieldAAP())) - aap = new org.drip.analytics.daycount.ActActDCParams (vcp.yieldFreq(), iPeriodEndDate - - iPeriodStartDate); - } else if (null != vcpQuote) { - if (null == (aap = vcpQuote.yieldAAP())) - aap = new org.drip.analytics.daycount.ActActDCParams (vcpQuote.yieldFreq(), iPeriodEndDate - - iPeriodStartDate); - } else - aap = new org.drip.analytics.daycount.ActActDCParams (iFrequency, iPeriodEndDate - iPeriodStartDate); - - double dblYieldAnnuity = org.drip.analytics.support.Helper.Yield2DF (iFrequency, dblYield, - s_bYieldDFOffofCouponAccrualDCF ? dblPeriodYearFract : - org.drip.analytics.daycount.Convention.YearFraction (iValueDate, iPeriodPayDate, strDC, - bApplyCpnEOMAdj, aap, strCalendar)) * cpcm.cumulative(); - - double dblPeriodStartNotional = notional (iPeriodStartDate); - - double dblPeriodEndNotional = notional (iPeriodEndDate); - - double dblCouponNotional = dblPeriodStartNotional; - - if (org.drip.product.params.NotionalSetting.PERIOD_AMORT_AT_END == iPeriodAmortizationMode) - dblCouponNotional = dblPeriodEndNotional; - else if (org.drip.product.params.NotionalSetting.PERIOD_AMORT_EFFECTIVE == - iPeriodAmortizationMode) - dblCouponNotional = notional (iPeriodStartDate, iPeriodEndDate); - - dblCumulativePeriodPV += (period.accrualDCF (iPeriodEndDate) * cpcm.rate() * dblCouponNotional + - dblPeriodStartNotional - dblPeriodEndNotional) * dblYieldAnnuity; - - if (bTerminateCouponFlow) break; - } - - try { - iCashPayDate = null != _marketConvention ? _marketConvention.settleDate (valParams) : - valParams.cashPayDate(); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - - iCashPayDate = valParams.cashPayDate(); - } - - return (((dblCumulativePeriodPV + dblWorkoutFactor * org.drip.analytics.support.Helper.Yield2DF - (iFrequency, dblYield, s_bYieldDFOffofCouponAccrualDCF ? dblPeriodYearFract : - org.drip.analytics.daycount.Convention.YearFraction (iValueDate, iWorkoutDate, strDC, - bApplyCpnEOMAdj, aap, strCalendar)) * notional (iWorkoutDate)) / - org.drip.analytics.support.Helper.Yield2DF (iFrequency, dblYield, - org.drip.analytics.daycount.Convention.YearFraction (iValueDate, - iCashPayDate, strDC, bApplyCpnEOMAdj, aap, strCalendar))) - accrued - (iValueDate, csqc)) / dblScalingNotional; - } - - @Override public double priceFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - return priceFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double priceFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::priceFromYieldToOptimalExercise => " + - "Cannot calc exercise px from yld for bonds w emb option"); - - return priceFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double priceFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception - { - return priceFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromYieldSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYieldSpread)); - } - - @Override public double priceFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - return priceFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double priceFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::priceFromYieldSpreadToOptimalExercise => " + - "Cant calc Price from Yield Spread to optimal exercise for bonds w emb option"); - - return priceFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double priceFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception - { - return priceFromZeroCurve (valParams, csqc, vcp, ZERO_OFF_OF_RATES_INSTRUMENTS_DISCOUNT_CURVE, - iWorkoutDate, dblWorkoutFactor, dblZSpread); - } - - @Override public double priceFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - return priceFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double priceFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::priceFromZSpreadToOptimalExercise => " + - "Cant calc Price from Z Spread to optimal exercise for bonds w emb option"); - - return priceFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double tsySpreadFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception - { - return tsySpreadFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromASW - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblASW)); - } - - @Override public double tsySpreadFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - return tsySpreadFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double tsySpreadFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::tsySpreadFromASWToOptimalExercise => " + - "Cant calc TSY Spread from ASW to optimal exercise for bonds w emb option"); - - return tsySpreadFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double tsySpreadFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception - { - return tsySpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromBondBasis - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblBondBasis)); - } - - @Override public double tsySpreadFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - return tsySpreadFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double tsySpreadFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::tsySpreadFromBondBasisToOptimalExercise => " + - "Cant calc TSY Spread from Bond Basis to optimal exercise for bonds w emb option"); - - return tsySpreadFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double tsySpreadFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception - { - return tsySpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromCreditBasis (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblCreditBasis)); - } - - @Override public double tsySpreadFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - return tsySpreadFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double tsySpreadFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::tsySpreadFromCreditBasisToOptimalExercise => " + - "Cant calc TSY Spread from Credit Basis to optimal exercise for bonds w emb option"); - - return tsySpreadFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double tsySpreadFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception - { - return tsySpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromDiscountMargin (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - dblDiscountMargin)); - } - - @Override public double tsySpreadFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - return tsySpreadFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double tsySpreadFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::tsySpreadFromDiscountMarginToOptimalExercise " + - "=> Cant calc TSY Spread from Discount Margin to optimal exercise for bonds w emb option"); - - return tsySpreadFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double tsySpreadFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception - { - return tsySpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromGSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblGSpread)); - } - - @Override public double tsySpreadFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - return tsySpreadFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double tsySpreadFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::tsySpreadFromGSpreadToOptimalExercise => " + - "Cant calc TSY Spread from G Spread to optimal exercise for bonds w emb option"); - - return tsySpreadFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double tsySpreadFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception - { - return tsySpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromISpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblISpread)); - } - - @Override public double tsySpreadFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - return tsySpreadFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double tsySpreadFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::tsySpreadFromISpreadToOptimalExercise => " + - "Cant calc TSY Spread from I Spread to optimal exercise for bonds w emb option"); - - return tsySpreadFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double tsySpreadFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception - { - return tsySpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromOAS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblOAS)); - } - - @Override public double tsySpreadFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - return tsySpreadFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double tsySpreadFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::tsySpreadFromOASToOptimalExercise => " + - "Cant calc TSY Spread from OAS to optimal exercise for bonds w emb option"); - - return tsySpreadFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double tsySpreadFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception - { - return tsySpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromPECS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPECS)); - } - - @Override public double tsySpreadFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - return tsySpreadFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double tsySpreadFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::tsySpreadFromPECSToOptimalExercise => " + - "Cant calc TSY Spread from PECS to optimal exercise for bonds w emb option"); - - return tsySpreadFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double tsySpreadFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception - { - return tsySpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromPrice - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPrice)); - } - - @Override public double tsySpreadFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - return tsySpreadFromPrice (valParams, csqc, vcp, maturityDate().julian(), 1., dblPrice); - } - - @Override public double tsySpreadFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - org.drip.param.valuation.WorkoutInfo wi = exerciseYieldFromPrice (valParams, csqc, vcp, dblPrice); - - if (null == wi) - throw new java.lang.Exception - ("BondComponent::tsySpreadFromPriceToOptimalExercise => Cant determine Work-out"); - - return tsySpreadFromPrice (valParams, csqc, vcp, wi.date(), wi.factor(), dblPrice); - } - - @Override public double tsySpreadFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception - { - return dblYield - treasuryBenchmarkYield (valParams, csqc, iWorkoutDate); - } - - @Override public double tsySpreadFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - return tsySpreadFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double tsySpreadFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::tsySpreadFromYieldToOptimalExercise => " + - "Cant calc TSY Spread from Yield to optimal exercise for bonds w emb option"); - - return tsySpreadFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double tsySpreadFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception - { - return tsySpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromYieldSpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYieldSpread)); - } - - @Override public double tsySpreadFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - return tsySpreadFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double tsySpreadFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::tsySpreadFromYieldSpreadToOptimalExercise => " + - "Cant calc TSY Spread from Yield Spread to optimal exercise for bonds w emb option"); - - return tsySpreadFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double tsySpreadFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception - { - return tsySpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromZSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblZSpread)); - } - - @Override public double tsySpreadFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - return tsySpreadFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double tsySpreadFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::tsySpreadFromZSpreadToOptimalExercise => " + - "Cant calc TSY Spread from Z Spread to optimal exercise for bonds w emb option"); - - return tsySpreadFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double yieldFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception - { - return yieldFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromASW - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblASW)); - } - - @Override public double yieldFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - return yieldFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double yieldFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yieldFromASWToOptimalExercise => " + - "Cant calc Yield from ASW to optimal exercise for bonds w emb option"); - - return yieldFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double yieldFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBondBasis)) - throw new java.lang.Exception ("BondComponent::yieldFromBondBasis => Invalid Inputs"); - - return yieldFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromFundingCurve - (valParams, csqc, iWorkoutDate, dblWorkoutFactor, 0.)) + dblBondBasis; - } - - @Override public double yieldFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - return yieldFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double yieldFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yieldFromBondBasisToOptimalExercise => " + - "Cant calc Yield from Bond Basis to optimal exercise for bonds w emb option"); - - return yieldFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double yieldFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception - { - return yieldFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromCreditBasis - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblCreditBasis)); - } - - @Override public double yieldFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - return yieldFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double yieldFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yieldFromCreditBasisToOptimalExercise => " + - "Cant calc Yield from Credit Basis to optimal exercise for bonds w emb option"); - - return yieldFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double yieldFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception - { - if (null == valParams || null == csqc || !org.drip.quant.common.NumberUtil.IsValid (dblWorkoutFactor) - || !org.drip.quant.common.NumberUtil.IsValid (dblDiscountMargin)) - throw new java.lang.Exception ("BondComponent::yieldFromDiscountMargin => Invalid inputs"); - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqc.fundingState (fundingLabel()); - - if (null == dcFunding) - throw new java.lang.Exception ("BondComponent::yieldFromDiscountMargin => Invalid inputs"); - - int iValueDate = valParams.valueDate(); - - int iFreq = freq(); - - return null == _floaterSetting ? dblDiscountMargin + dcFunding.libor (iValueDate, ((int) (12. / (0 - == iFreq ? 2 : iFreq))) + "M") : dblDiscountMargin - indexRate (iValueDate, csqc, - (org.drip.analytics.cashflow.CompositeFloatingPeriod) currentPeriod (iValueDate)); - } - - @Override public double yieldFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - return yieldFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double yieldFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - return yieldFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double yieldFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblGSpread) || valParams.valueDate() >= iWorkoutDate - || null == csqc) - throw new java.lang.Exception ("BondComponent::yieldFromGSpread => Invalid Inputs"); - - org.drip.state.govvie.GovvieCurve gc = csqc.govvieState (govvieLabel()); - - if (null == gc) throw new java.lang.Exception ("BondComponent::yieldFromGSpread => Invalid Inputs"); - - return gc.yield (iWorkoutDate) + dblGSpread; - } - - @Override public double yieldFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - return yieldFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double yieldFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yieldFromGSpreadToOptimalExercise => " + - "Cant calc Yield from G Spread to optimal exercise for bonds w emb option"); - - return yieldFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double yieldFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception - { - if (null == valParams || valParams.valueDate() >= iWorkoutDate || null == csqc || - !org.drip.quant.common.NumberUtil.IsValid (dblISpread)) - throw new java.lang.Exception ("BondComponent::yieldFromISpread => Invalid Inputs"); - - org.drip.state.discount.MergedDiscountForwardCurve dc = csqc.fundingState - (org.drip.state.identifier.FundingLabel.Standard (payCurrency())); - - if (null == dc) throw new java.lang.Exception ("BondComponent::yieldFromISpread => Invalid Inputs"); - - return dc.estimateManifestMeasure ("SwapRate", iWorkoutDate) + dblISpread; - } - - @Override public double yieldFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - return yieldFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double yieldFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - return yieldFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double yieldFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception - { - return yieldFromOAS (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromOAS (valParams, - csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblOAS)); - } - - @Override public double yieldFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - return yieldFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double yieldFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yieldFromOASToOptimalExercise => " + - "Cant calc Yield from OAS to optimal exercise for bonds w emb option"); - - return yieldFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double yieldFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception - { - return yieldFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromPECS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPECS)); - } - - @Override public double yieldFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - return yieldFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double yieldFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yieldFromPECSToOptimalExercise => " + - "Cant calc Yield from PECS to optimal exercise for bonds w emb option"); - - return yieldFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double yieldFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception - { - return new BondCalibrator (this).calibrateYieldFromPrice (valParams, csqc, iWorkoutDate, - dblWorkoutFactor, dblPrice); - } - - @Override public double yieldFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - return yieldFromPrice (valParams, csqc, vcp, maturityDate().julian(), 1., dblPrice); - } - - @Override public double yieldFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - org.drip.param.valuation.WorkoutInfo wi = exerciseYieldFromPrice (valParams, csqc, vcp, dblPrice); - - if (null == wi) - throw new java.lang.Exception ("BondComponent::yieldFromPriceToOptimalExercise => " + - "Cant calc Workout from Price to optimal exercise for bonds w emb option"); - - return wi.yield(); - } - - @Override public double yieldFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblTSYSpread) || valParams.valueDate() >= - iWorkoutDate) - throw new java.lang.Exception ("BondComponent::calcYieldFromTSYSpread => Invalid Inputs"); - - return treasuryBenchmarkYield (valParams, csqc, iWorkoutDate) + dblTSYSpread; - } - - @Override public double yieldFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - return yieldFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblPrice); - } - - @Override public double yieldFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yieldFromTSYSpreadToOptimalExercise => " + - "Cant calc Yield from TSY Spread to optimal exercise for bonds w emb option"); - - return yieldFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblPrice); - } - - @Override public double yieldFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblYieldSpread) || valParams.valueDate() >= - iWorkoutDate) - throw new java.lang.Exception ("BondComponent::yieldFromYieldSpread => Invalid Inputs"); - - return yieldFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromFundingCurve - (valParams, csqc, iWorkoutDate, dblWorkoutFactor, 0.)) + dblYieldSpread; - } - - @Override public double yieldFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - return yieldFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double yieldFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yieldFromYieldSpreadToOptimalExercise => " + - "Cant calc Yield from Yield Spread to optimal exercise for bonds w emb option"); - - return yieldFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double yieldFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception - { - return yieldFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromZeroCurve - (valParams, csqc, vcp, ZERO_OFF_OF_RATES_INSTRUMENTS_DISCOUNT_CURVE, iWorkoutDate, - dblWorkoutFactor, dblZSpread)); - } - - @Override public double yieldFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - return yieldFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double yieldFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yieldFromZSpreadToOptimalExercise => " + - "Cant calc Yield from Z Spread to optimal exercise for bonds w emb option"); - - return yieldFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double yield01FromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception - { - return yield01FromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromASW - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblASW)); - } - - @Override public double yield01FromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - return yield01FromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double yield01FromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yield01FromASWToOptimalExercise => " + - "Cant calc Yield from ASW to optimal exercise for bonds w emb option"); - - return yield01FromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double yield01FromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception - { - return yield01FromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromBondBasis - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblBondBasis)); - } - - @Override public double yield01FromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - return yieldFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double yield01FromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yield01FromBondBasisToOptimalExercise => " + - "Cant calc Yield01 from Bond Basis to optimal exercise for bonds w emb option"); - - return yield01FromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double yield01FromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception - { - return yield01FromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromCreditBasis - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblCreditBasis)); - } - - @Override public double yield01FromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - return yield01FromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double yield01FromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yield01FromCreditBasisToOptimalExercise => " + - "Cant calc Yield01 from Credit Basis to optimal exercise for bonds w emb option"); - - return yield01FromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double yield01FromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception - { - return yield01FromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromDiscountMargin (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - dblDiscountMargin)); - } - - @Override public double yield01FromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - return yield01FromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double yield01FromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yield01FromDiscountMarginToOptimalExercise =>" + - " Cant calc Yield01 from Discount Margin to optimal exercise for bonds w emb option"); - - return yield01FromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double yield01FromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception - { - return yield01FromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromGSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblGSpread)); - } - - @Override public double yield01FromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - return yield01FromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double yield01FromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yield01FromGSpreadToOptimalExercise => " + - "Cant calc Yield01 from G Spread to optimal exercise for bonds w emb option"); - - return yield01FromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double yield01FromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception - { - return yield01FromISpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromISpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblISpread)); - } - - @Override public double yield01FromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - return yield01FromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double yield01FromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yield01FromISpreadToOptimalExercise => " + - "Cant calc Yield01 from I Spread to optimal exercise for bonds w emb option"); - - return yield01FromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double yield01FromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception - { - return yield01FromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromOAS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblOAS)); - } - - @Override public double yield01FromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - return yield01FromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double yield01FromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yield01FromOASToOptimalExercise => " + - "Cant calc Yield01 from OAS to optimal exercise for bonds w emb option"); - - return yield01FromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double yield01FromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception - { - return yield01FromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromPECS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPECS)); - } - - @Override public double yield01FromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - return yield01FromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double yield01FromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yield01FromPECSToOptimalExercise => " + - "Cant calc Yield01 from PECS to optimal exercise for bonds w emb option"); - - return yield01FromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double yield01FromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception - { - return yield01FromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromPrice - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPrice)); - } - - @Override public double yield01FromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - return yield01FromPrice (valParams, csqc, vcp, maturityDate().julian(), 1., dblPrice); - } - - @Override public double yield01FromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - org.drip.param.valuation.WorkoutInfo wi = exerciseYieldFromPrice (valParams, csqc, vcp, dblPrice); - - if (null == wi) - throw new java.lang.Exception ("BondComponent::yield01FromPriceToOptimalExercise => " + - "Cant calc Workout from Price to optimal exercise for bonds w emb option"); - - return yield01FromPrice (valParams, csqc, vcp, wi.date(), wi.factor(), dblPrice); - } - - @Override public double yield01FromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception - { - return yield01FromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromTSYSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblTSYSpread)); - } - - @Override public double yield01FromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - return yield01FromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblPrice); - } - - @Override public double yield01FromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yield01FromTSYSpreadToOptimalExercise => " + - "Cant calc Yield01 from TSY Spread to optimal exercise for bonds w emb option"); - - return yield01FromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblPrice); - } - - @Override public double yield01FromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblYield)) - throw new java.lang.Exception ("BondComponent::yield01FromYield => Invalid Inputs"); - - return priceFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYield) - - priceFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYield + 0.0001); - } - - @Override public double yield01FromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - return yield01FromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double yield01FromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yield01FromYieldToOptimalExercise => " + - "Cant calc Yield01 from Yield to optimal exercise for bonds w emb option"); - - return yield01FromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double yield01FromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception - { - return yield01FromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromYieldSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYieldSpread)); - } - - @Override public double yield01FromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - return yield01FromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double yield01FromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yield01FromYieldSpreadToOptimalExercise => " + - "Cant calc Yield01 from Yield Spread to optimal exercise for bonds w emb option"); - - return yield01FromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double yield01FromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception - { - return yield01FromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromZSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblZSpread)); - } - - @Override public double yield01FromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - return yield01FromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double yield01FromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yield01FromZSpreadToOptimalExercise => " + - "Cant calc Yield01 from Z Spread to optimal exercise for bonds w emb option"); - - return yield01FromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double yieldSpreadFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception - { - return yieldSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromASW - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblASW)); - } - - @Override public double yieldSpreadFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - return yieldSpreadFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double yieldSpreadFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yieldSpreadFromASWToOptimalExercise => " + - "Cant calc Yield Spread from ASW to optimal exercise for bonds w emb option"); - - return yieldSpreadFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double yieldSpreadFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception - { - return yieldSpreadFromBondBasis (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromBondBasis (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblBondBasis)); - } - - @Override public double yieldSpreadFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - return yieldSpreadFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double yieldSpreadFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yieldSpreadFromBondBasisToOptimalExercise => " - + "Cant calc Yield Spread from Bond Basis to optimal exercise for bonds w emb option"); - - return yieldSpreadFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double yieldSpreadFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception - { - return yieldSpreadFromCreditBasis (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromCreditBasis (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblCreditBasis)); - } - - @Override public double yieldSpreadFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - return yieldSpreadFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., - dblCreditBasis); - } - - @Override public double yieldSpreadFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yieldSpreadFromCreditBasisToOptimalExercise " + - "=> Cant calc Yield Spread from Credit Basis to optimal exercise for bonds w emb option"); - - return yieldSpreadFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., - dblCreditBasis); - } - - @Override public double yieldSpreadFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception - { - return yieldSpreadFromDiscountMargin (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromDiscountMargin (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - dblDiscountMargin)); - } - - @Override public double yieldSpreadFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - return yieldSpreadFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double yieldSpreadFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::yieldSpreadFromDiscountMarginToOptimalExercise => " + - "Cant calc Yield Spread from Disc Margin to optimal exercise for bonds w emb option"); - - return yieldSpreadFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double yieldSpreadFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception - { - return yieldSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromGSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblGSpread)); - } - - @Override public double yieldSpreadFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - return yieldSpreadFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double yieldSpreadFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yieldSpreadFromGSpreadToOptimalExercise => " + - "Cant calc Yield Spread from G Spread to optimal exercise for bonds w emb option"); - - return yieldSpreadFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double yieldSpreadFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception - { - return yieldSpreadFromISpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromISpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblISpread)); - } - - @Override public double yieldSpreadFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - return yieldSpreadFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double yieldSpreadFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yieldSpreadFromISpreadToOptimalExercise => " + - "Cant calc Yield Spread from I Spread to optimal exercise for bonds w emb option"); - - return yieldSpreadFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double yieldSpreadFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception - { - return yieldSpreadFromOAS (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromOAS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblOAS)); - } - - @Override public double yieldSpreadFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - return yieldSpreadFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double yieldSpreadFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yieldSpreadFromOASToOptimalExercise => " + - "Cant calc Yield Spread from OAS to optimal exercise for bonds w emb option"); - - return yieldSpreadFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double yieldSpreadFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception - { - return yieldSpreadFromPECS (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromPECS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPECS)); - } - - @Override public double yieldSpreadFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - return yieldSpreadFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double yieldSpreadFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yieldSpreadFromPECSToOptimalExercise => " + - "Cant calc Yield Spread from PECS to optimal exercise for bonds w emb option"); - - return yieldSpreadFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double yieldSpreadFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception - { - return yieldSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromPrice - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPrice)); - } - - @Override public double yieldSpreadFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - return yieldSpreadFromPrice (valParams, csqc, vcp, maturityDate().julian(), 1., dblPrice); - } - - @Override public double yieldSpreadFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - org.drip.param.valuation.WorkoutInfo wi = exerciseYieldFromPrice (valParams, csqc, vcp, dblPrice); - - if (null == wi) - throw new java.lang.Exception ("BondComponent::yieldSpreadFromPriceToOptimalExercise => " + - "Cant calc Workout from Price to optimal exercise for bonds w emb option"); - - return yieldSpreadFromPrice (valParams, csqc, vcp, wi.date(), wi.factor(), dblPrice); - } - - @Override public double yieldSpreadFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception - { - return yieldSpreadFromTSYSpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - yieldFromTSYSpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblTSYSpread)); - } - - @Override public double yieldSpreadFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - return yieldSpreadFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double yieldSpreadFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yieldSpreadFromTSYSpreadToOptimalExercise => " + - "Cant calc Yield Spread from TSY Spread to optimal exercise for bonds w emb option"); - - return yieldSpreadFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double yieldSpreadFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblYield)) - throw new java.lang.Exception ("BondComponent::yieldSpreadFromYield => Invalid Inputs"); - - return dblYield - yieldFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromFundingCurve (valParams, csqc, iWorkoutDate, dblWorkoutFactor, 0.)); - } - - @Override public double yieldSpreadFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - return yieldSpreadFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double yieldSpreadFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yieldSpreadFromYieldToOptimalExercise => " + - "Cant calc Yield Spread from Yield to optimal exercise for bonds w emb option"); - - return yieldSpreadFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double yieldSpreadFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception - { - return yieldSpreadFromYield (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, yieldFromZSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblZSpread)); - } - - @Override public double yieldSpreadFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - return yieldSpreadFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double yieldSpreadFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::yieldSpreadFromZSpreadToOptimalExercise => " + - "Cant calc Yield Spread from Z Spread to optimal exercise for bonds w emb option"); - - return yieldSpreadFromZSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblZSpread); - } - - @Override public double zspreadFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception - { - return zspreadFromASW (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromASW - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblASW)); - } - - @Override public double zspreadFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - return zspreadFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double zspreadFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::zspreadFromASWToOptimalExercise => " + - "Cant calc Z Spread from ASW to optimal exercise for bonds w emb option"); - - return zspreadFromASW (valParams, csqc, vcp, maturityDate().julian(), 1., dblASW); - } - - @Override public double zspreadFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception - { - return zspreadFromBondBasis (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromBondBasis (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblBondBasis)); - } - - @Override public double zspreadFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - return zspreadFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double zspreadFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::zspreadFromBondBasisToOptimalExercise => " + - "Cant calc Z Spread from Bond Basis to optimal exercise for bonds w emb option"); - - return zspreadFromBondBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblBondBasis); - } - - @Override public double zspreadFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception - { - return zspreadFromCreditBasis (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromCreditBasis (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblCreditBasis)); - } - - @Override public double zspreadFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - return zspreadFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double zspreadFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::zspreadFromCreditBasisToOptimalExercise => " + - "Cant calc Z Spread from Credit Basis to optimal exercise for bonds w emb option"); - - return zspreadFromCreditBasis (valParams, csqc, vcp, maturityDate().julian(), 1., dblCreditBasis); - } - - @Override public double zspreadFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception - { - return zspreadFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - priceFromDiscountMargin (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, - dblDiscountMargin)); - } - - @Override public double zspreadFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - return zspreadFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double zspreadFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception - ("BondComponent::zspreadFromDiscountMarginToOptimalExercise => " + - "Cant calc Z Spread from Discount Margin to optimal exercise for bonds w emb option"); - - return zspreadFromDiscountMargin (valParams, csqc, vcp, maturityDate().julian(), 1., - dblDiscountMargin); - } - - @Override public double zspreadFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception - { - return zspreadFromGSpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromGSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblGSpread)); - } - - @Override public double zspreadFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - return zspreadFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double zspreadFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::zspreadFromGSpreadToOptimalExercise => " + - "Cant calc Z Spread from G Spread to optimal exercise for bonds w emb option"); - - return zspreadFromGSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblGSpread); - } - - @Override public double zspreadFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception - { - return zspreadFromISpread (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromISpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblISpread)); - } - - @Override public double zspreadFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - return zspreadFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double zspreadFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::zspreadFromISpreadToOptimalExercise => " + - "Cant calc Z Spread from I Spread to optimal exercise for bonds w emb option"); - - return zspreadFromISpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblISpread); - } - - @Override public double zspreadFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception - { - return zspreadFromOAS (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromOAS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblOAS)); - } - - @Override public double zspreadFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - return zspreadFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double zspreadFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::zspreadFromOASToOptimalExercise => " + - "Cant calc Z Spread from OAS to optimal exercise for bonds w emb option"); - - return zspreadFromOAS (valParams, csqc, vcp, maturityDate().julian(), 1., dblOAS); - } - - @Override public double zspreadFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception - { - return zspreadFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromPECS - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblPECS)); - } - - @Override public double zspreadFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - return zspreadFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double zspreadFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::zspreadFromPECSToOptimalExercise => " + - "Cant calc Z Spread from PECS to optimal exercise for bonds w emb option"); - - return zspreadFromPECS (valParams, csqc, vcp, maturityDate().julian(), 1., dblPECS); - } - - @Override public double zspreadFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception - { - return new BondCalibrator (this).calibrateZSpreadFromPrice (valParams, csqc, - ZERO_OFF_OF_RATES_INSTRUMENTS_DISCOUNT_CURVE, iWorkoutDate, dblWorkoutFactor, dblPrice); - } - - @Override public double zspreadFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - return zspreadFromPrice (valParams, csqc, vcp, maturityDate().julian(), 1., dblPrice); - } - - @Override public double zspreadFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception - { - org.drip.param.valuation.WorkoutInfo wi = exerciseYieldFromPrice (valParams, csqc, vcp, dblPrice); - - if (null == wi) - throw new java.lang.Exception ("BondComponent::zspreadFromPriceToOptimalExercise => " + - "Cant calc Workout from Price to optimal exercise for bonds w emb option"); - - return zspreadFromPrice (valParams, csqc, vcp, wi.date(), wi.factor(), dblPrice); - } - - @Override public double zspreadFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception - { - return zspreadFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromTSYSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblTSYSpread)); - } - - @Override public double zspreadFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - return zspreadFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double zspreadFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::zspreadFromTSYSpreadToOptimalExercise => " + - "Cant calc Z Spread from TSY Spread to optimal exercise for bonds w emb option"); - - return zspreadFromTSYSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblTSYSpread); - } - - @Override public double zspreadFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception - { - return zspreadFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromYield - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYield)); - } - - @Override public double zspreadFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - return zspreadFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double zspreadFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::zspreadFromYieldToOptimalExercise => " + - "Cant calc Z Spread from Yield to optimal exercise for bonds w emb option"); - - return zspreadFromYield (valParams, csqc, vcp, maturityDate().julian(), 1., dblYield); - } - - @Override public double zspreadFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception - { - return zspreadFromPrice (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, priceFromYieldSpread - (valParams, csqc, vcp, iWorkoutDate, dblWorkoutFactor, dblYieldSpread)); - } - - @Override public double zspreadFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - return zspreadFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public double zspreadFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception - { - if (null != _eosCall || null != _eosPut) - throw new java.lang.Exception ("BondComponent::zspreadFromYieldSpreadToOptimalExercise => " + - "Cant calc Z Spread from Yield Spread to optimal exercise for bonds w emb option"); - - return zspreadFromYieldSpread (valParams, csqc, vcp, maturityDate().julian(), 1., dblYieldSpread); - } - - @Override public org.drip.analytics.output.BondRVMeasures standardMeasures ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.param.valuation.WorkoutInfo wi, - final double dblPrice) - { - if (null == valParams || null == csqs || null == wi || !org.drip.quant.common.NumberUtil.IsValid - (dblPrice)) - return null; - - int iWorkoutDate = wi.date(); - - double dblWorkoutYield = wi.yield(); - - double dblWorkoutFactor = wi.factor(); - - if (valParams.valueDate() >= iWorkoutDate) return null; - - double dblASW = java.lang.Double.NaN; - double dblPECS = java.lang.Double.NaN; - double dblGSpread = java.lang.Double.NaN; - double dblISpread = java.lang.Double.NaN; - double dblYield01 = java.lang.Double.NaN; - double dblZSpread = java.lang.Double.NaN; - double dblOASpread = java.lang.Double.NaN; - double dblBondBasis = java.lang.Double.NaN; - double dblConvexity = java.lang.Double.NaN; - double dblTSYSpread = java.lang.Double.NaN; - double dblCreditBasis = java.lang.Double.NaN; - double dblDiscountMargin = java.lang.Double.NaN; - double dblMacaulayDuration = java.lang.Double.NaN; - double dblModifiedDuration = java.lang.Double.NaN; - - try { - dblDiscountMargin = discountMarginFromYield (valParams, csqs, vcp, iWorkoutDate, - dblWorkoutFactor, dblWorkoutYield); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - - if (null == _floaterSetting) { - try { - dblZSpread = zspreadFromPrice (valParams, csqs, vcp, iWorkoutDate, dblWorkoutFactor, - dblPrice); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - } - - try { - dblOASpread = oasFromPrice (valParams, csqs, vcp, iWorkoutDate, dblWorkoutFactor, dblPrice); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - - try { - dblISpread = iSpreadFromYield (valParams, csqs, vcp, iWorkoutDate, dblWorkoutFactor, - dblWorkoutYield); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - - try { - dblGSpread = gSpreadFromYield (valParams, csqs, vcp, iWorkoutDate, dblWorkoutFactor, - dblWorkoutYield); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - - try { - dblTSYSpread = tsySpreadFromYield (valParams, csqs, vcp, iWorkoutDate, dblWorkoutFactor, - dblWorkoutYield); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - - try { - dblMacaulayDuration = macaulayDurationFromPrice (valParams, csqs, vcp, iWorkoutDate, - dblWorkoutFactor, dblPrice); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - - try { - dblModifiedDuration = modifiedDurationFromPrice (valParams, csqs, vcp, iWorkoutDate, - dblWorkoutFactor, dblPrice); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - - try { - dblASW = aswFromPrice (valParams, csqs, vcp, iWorkoutDate, dblWorkoutFactor, dblPrice); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - - try { - dblConvexity = convexityFromPrice (valParams, csqs, vcp, iWorkoutDate, dblWorkoutFactor, - dblPrice); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - - try { - dblCreditBasis = creditBasisFromPrice (valParams, csqs, vcp, iWorkoutDate, dblWorkoutFactor, - dblPrice); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - - try { - // dblPECS = pecsFromPrice (valParams, csqs, vcp, iWorkoutDate, dblWorkoutFactor, dblPrice); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - - try { - dblBondBasis = bondBasisFromYield (valParams, csqs, vcp, iWorkoutDate, dblWorkoutFactor, - dblWorkoutYield); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - - try { - dblYield01 = yield01FromYield (valParams, csqs, vcp, iWorkoutDate, dblWorkoutFactor, - dblWorkoutYield); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - - try { - return new org.drip.analytics.output.BondRVMeasures (dblPrice, dblBondBasis, dblZSpread, - dblGSpread, dblISpread, dblOASpread, dblTSYSpread, dblDiscountMargin, dblASW, dblCreditBasis, - dblPECS, dblYield01, dblModifiedDuration, dblMacaulayDuration, dblConvexity, wi); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap value ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == valParams || null == csqs) return null; - - if (null != pricerParams) { - org.drip.param.definition.CalibrationParams calibParams = pricerParams.calibParams(); - - if (null != calibParams) { - org.drip.analytics.support.CaseInsensitiveTreeMap mapCalibMeasures = - calibMeasures (valParams, pricerParams, csqs, vcp); - - if (null != mapCalibMeasures && mapCalibMeasures.containsKey (calibParams.measure())) - return mapCalibMeasures; - } - } - - org.drip.analytics.support.CaseInsensitiveTreeMap mapMeasures = fairMeasures - (valParams, pricerParams, csqs, vcp); - - if (null == mapMeasures) return null; - - java.lang.String strName = name(); - - org.drip.param.definition.ProductQuote pq = csqs.productQuote (strName); - - if (null == pq) return mapMeasures; - - int iMaturityDate = maturityDate().julian(); - - if (null == _floaterSetting) { - double dblParSpread = (mapMeasures.get ("FairDirtyPV") - mapMeasures.get ("FairParPV") - - mapMeasures.get ("FairPrincipalPV")) / mapMeasures.get ("FairDirtyDV01"); - - mapMeasures.put ("ParSpread", dblParSpread); - - mapMeasures.put ("FairParSpread", dblParSpread); - } else { - double dblCleanIndexCouponPV = mapMeasures.containsKey ("FairRiskyCleanIndexCouponPV") ? - mapMeasures.get ("FairRiskyCleanIndexCouponPV") : mapMeasures.get - ("FairRisklessCleanIndexCouponPV"); - - double dblZeroDiscountMargin = (mapMeasures.get ("FairCleanPV") - mapMeasures.get ("FairParPV") - - dblCleanIndexCouponPV - mapMeasures.get ("FairPrincipalPV")) / mapMeasures.get - ("FairCleanDV01"); - - mapMeasures.put ("ZeroDiscountMargin", dblZeroDiscountMargin); - - mapMeasures.put ("FairZeroDiscountMargin", dblZeroDiscountMargin); - } - - org.drip.param.valuation.WorkoutInfo wiMarket = null; - - if (pq.containsQuote ("Price")) { - double dblMarketPrice = pq.quote ("Price").value ("mid"); - - mapMeasures.put ("MarketInputType=CleanPrice", dblMarketPrice); - - wiMarket = exerciseYieldFromPrice (valParams, csqs, vcp, dblMarketPrice); - } else if (pq.containsQuote ("CleanPrice")) { - double dblCleanMarketPrice = pq.quote ("CleanPrice").value ("mid"); - - mapMeasures.put ("MarketInputType=CleanPrice", dblCleanMarketPrice); - - wiMarket = exerciseYieldFromPrice (valParams, csqs, vcp, dblCleanMarketPrice); - } else if (pq.containsQuote ("QuotedMargin")) { - double dblQuotedMargin = pq.quote ("QuotedMargin").value ("mid"); - - mapMeasures.put ("MarketInputType=QuotedMargin", dblQuotedMargin); - - try { - wiMarket = exerciseYieldFromPrice (valParams, csqs, vcp, priceFromDiscountMargin (valParams, - csqs, vcp, dblQuotedMargin)); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - } - } else if (pq.containsQuote ("DirtyPrice")) { - try { - double dblDirtyMarketPrice = pq.quote ("DirtyPrice").value ("mid"); - - mapMeasures.put ("MarketInputType=DirtyPrice", dblDirtyMarketPrice); - - wiMarket = exerciseYieldFromPrice (valParams, csqs, vcp, dblDirtyMarketPrice - accrued - (valParams.valueDate(), csqs)); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - - wiMarket = null; - } - } else if (pq.containsQuote ("TSYSpread")) { - try { - double dblTSYSpread = pq.quote ("TSYSpread").value ("mid"); - - mapMeasures.put ("MarketInputType=TSYSpread", dblTSYSpread); - - wiMarket = new org.drip.param.valuation.WorkoutInfo (iMaturityDate, treasuryBenchmarkYield - (valParams, csqs, iMaturityDate) + dblTSYSpread, 1., - org.drip.param.valuation.WorkoutInfo.WO_TYPE_MATURITY); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - - wiMarket = null; - } - } else if (pq.containsQuote ("Yield")) { - try { - double dblYield = pq.quote ("Yield").value ("mid"); - - mapMeasures.put ("MarketInputType=Yield", dblYield); - - wiMarket = new org.drip.param.valuation.WorkoutInfo (iMaturityDate, dblYield, 1., - org.drip.param.valuation.WorkoutInfo.WO_TYPE_MATURITY); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - - wiMarket = null; - } - } else if (pq.containsQuote ("ZSpread")) { - try { - double dblZSpread = pq.quote ("ZSpread").value ("mid"); - - mapMeasures.put ("MarketInputType=ZSpread", dblZSpread); - - wiMarket = new org.drip.param.valuation.WorkoutInfo (iMaturityDate, yieldFromZSpread - (valParams, csqs, vcp, dblZSpread), 1., - org.drip.param.valuation.WorkoutInfo.WO_TYPE_MATURITY); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - - wiMarket = null; - } - } else if (pq.containsQuote ("ISpread")) { - try { - double dblISpread = pq.quote ("ISpread").value ("mid"); - - mapMeasures.put ("MarketInputType=ISpread", dblISpread); - - wiMarket = new org.drip.param.valuation.WorkoutInfo (iMaturityDate, yieldFromISpread - (valParams, csqs, vcp, dblISpread), 1., - org.drip.param.valuation.WorkoutInfo.WO_TYPE_MATURITY); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - - wiMarket = null; - } - } else if (pq.containsQuote ("CreditBasis")) { - try { - double dblCreditBasis = pq.quote ("CreditBasis").value ("mid"); - - mapMeasures.put ("MarketInputType=CreditBasis", dblCreditBasis); - - wiMarket = new org.drip.param.valuation.WorkoutInfo (iMaturityDate, yieldFromCreditBasis - (valParams, csqs, vcp, dblCreditBasis), 1., - org.drip.param.valuation.WorkoutInfo.WO_TYPE_MATURITY); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - - wiMarket = null; - } - } else if (pq.containsQuote ("PECS")) { - try { - double dblCreditBasis = pq.quote ("PECS").value ("mid"); - - mapMeasures.put ("MarketInputType=PECS", dblCreditBasis); - - wiMarket = new org.drip.param.valuation.WorkoutInfo (iMaturityDate, yieldFromPECS (valParams, - csqs, vcp, dblCreditBasis), 1., org.drip.param.valuation.WorkoutInfo.WO_TYPE_MATURITY); - } catch (java.lang.Exception e) { - if (!s_bSuppressErrors) e.printStackTrace(); - - wiMarket = null; - } - } - - if (null != wiMarket) { - org.drip.analytics.support.CaseInsensitiveTreeMap mapWorkoutMeasures = - marketMeasures (valParams, pricerParams, csqs, vcp, wiMarket); - - if (null == _floaterSetting) { - double dblParSpread = (mapWorkoutMeasures.get ("Price") - mapMeasures.get ("FairParPV") - - mapMeasures.get ("FairPrincipalPV")) / mapMeasures.get ("FairCleanDV01"); - - mapMeasures.put ("ParSpread", dblParSpread); - - mapMeasures.put ("MarketParSpread", dblParSpread); - } else { - double dblCleanIndexCouponPV = mapMeasures.containsKey ("FairRiskyCleanIndexCouponPV") ? - mapMeasures.get ("FairRiskyCleanIndexCouponPV") : mapMeasures.get - ("FairRisklessCleanIndexCouponPV"); - - double dblZeroDiscountMargin = (mapMeasures.get ("Price") - mapMeasures.get ("FairParPV") - - dblCleanIndexCouponPV - mapMeasures.get ("FairPrincipalPV")) / mapMeasures.get - ("FairCleanDV01"); - - mapMeasures.put ("ZeroDiscountMargin", dblZeroDiscountMargin); - - mapMeasures.put ("MarketZeroDiscountMargin", dblZeroDiscountMargin); - } - - org.drip.quant.common.CollectionUtil.MergeWithMain (mapMeasures, mapWorkoutMeasures); - - org.drip.state.credit.CreditCurve cc = csqs.creditState (creditLabel()); - - if (null != mapMeasures.get ("FairYield")) { - org.drip.param.market.CurveSurfaceQuoteContainer csqsMarket = - org.drip.param.creator.MarketParamsBuilder.Create - ((org.drip.state.discount.MergedDiscountForwardCurve) csqs.fundingState - (fundingLabel()).parallelShiftQuantificationMetric (wiMarket.yield() - - mapMeasures.get ("FairYield")), csqs.govvieState (govvieLabel()), cc, - strName, csqs.productQuote (strName), csqs.quoteMap(), csqs.fixings()); - - if (null != csqsMarket) { - org.drip.analytics.output.BondWorkoutMeasures bwmMarket = workoutMeasures (valParams, - pricerParams, csqsMarket, wiMarket.date(), wiMarket.factor()); - - if (null != bwmMarket) { - org.drip.analytics.support.CaseInsensitiveTreeMap mapMarketMeasures - = bwmMarket.toMap (""); - - org.drip.quant.common.CollectionUtil.MergeWithMain (mapMarketMeasures, - org.drip.quant.common.CollectionUtil.PrefixKeys (mapMarketMeasures, "Market")); - - org.drip.quant.common.CollectionUtil.MergeWithMain (mapMeasures, mapMarketMeasures); - } - } - } - } - - return mapMeasures; - } - - @Override public java.util.Set measureNames() - { - java.util.Set setstrMeasureNames = new java.util.TreeSet(); - - setstrMeasureNames.add ("Accrued"); - - setstrMeasureNames.add ("Accrued01"); - - setstrMeasureNames.add ("AssetSwapSpread"); - - setstrMeasureNames.add ("ASW"); - - setstrMeasureNames.add ("BondBasis"); - - setstrMeasureNames.add ("CleanCouponPV"); - - setstrMeasureNames.add ("CleanDV01"); - - setstrMeasureNames.add ("CleanIndexCouponPV"); - - setstrMeasureNames.add ("CleanPrice"); - - setstrMeasureNames.add ("CleanPV"); - - setstrMeasureNames.add ("Convexity"); - - setstrMeasureNames.add ("CreditRisklessParPV"); - - setstrMeasureNames.add ("CreditRisklessPrincipalPV"); - - setstrMeasureNames.add ("CreditRiskyParPV"); - - setstrMeasureNames.add ("CreditRiskyPrincipalPV"); - - setstrMeasureNames.add ("CreditBasis"); - - setstrMeasureNames.add ("DiscountMargin"); - - setstrMeasureNames.add ("DefaultExposure"); - - setstrMeasureNames.add ("DefaultExposureNoRec"); - - setstrMeasureNames.add ("DirtyCouponPV"); - - setstrMeasureNames.add ("DirtyDV01"); - - setstrMeasureNames.add ("DirtyIndexCouponPV"); - - setstrMeasureNames.add ("DirtyPrice"); - - setstrMeasureNames.add ("DirtyPV"); - - setstrMeasureNames.add ("Duration"); - - setstrMeasureNames.add ("DV01"); - - setstrMeasureNames.add ("ExpectedRecovery"); - - setstrMeasureNames.add ("FairAccrued"); - - setstrMeasureNames.add ("FairAccrued01"); - - setstrMeasureNames.add ("FairAssetSwapSpread"); - - setstrMeasureNames.add ("FairASW"); - - setstrMeasureNames.add ("FairBondBasis"); - - setstrMeasureNames.add ("FairCleanCouponPV"); - - setstrMeasureNames.add ("FairCleanDV01"); - - setstrMeasureNames.add ("FairCleanIndexCouponPV"); - - setstrMeasureNames.add ("FairCleanPrice"); - - setstrMeasureNames.add ("FairCleanPV"); - - setstrMeasureNames.add ("FairConvexity"); - - setstrMeasureNames.add ("FairCreditBasis"); - - setstrMeasureNames.add ("FairCreditRisklessParPV"); - - setstrMeasureNames.add ("FairCreditRisklessPrincipalPV"); - - setstrMeasureNames.add ("FairCreditRiskyParPV"); - - setstrMeasureNames.add ("FairCreditRiskyPrincipalPV"); - - setstrMeasureNames.add ("FairDefaultExposure"); - - setstrMeasureNames.add ("FairDefaultExposureNoRec"); - - setstrMeasureNames.add ("FairDirtyCouponPV"); - - setstrMeasureNames.add ("FairDirtyDV01"); - - setstrMeasureNames.add ("FairDirtyIndexCouponPV"); - - setstrMeasureNames.add ("FairDirtyPrice"); - - setstrMeasureNames.add ("FairDirtyPV"); - - setstrMeasureNames.add ("FairDiscountMargin"); - - setstrMeasureNames.add ("FairDuration"); - - setstrMeasureNames.add ("FairDV01"); - - setstrMeasureNames.add ("FairExpectedRecovery"); - - setstrMeasureNames.add ("FairFirstIndexRate"); - - setstrMeasureNames.add ("FairGSpread"); - - setstrMeasureNames.add ("FairISpread"); - - setstrMeasureNames.add ("FairLossOnInstantaneousDefault"); - - setstrMeasureNames.add ("FairMacaulayDuration"); - - setstrMeasureNames.add ("FairModifiedDuration"); - - setstrMeasureNames.add ("FairOAS"); - - setstrMeasureNames.add ("FairOASpread"); - - setstrMeasureNames.add ("FairOptionAdjustedSpread"); - - setstrMeasureNames.add ("FairParPV"); - - setstrMeasureNames.add ("FairParSpread"); - - setstrMeasureNames.add ("FairPECS"); - - setstrMeasureNames.add ("FairPrice"); - - setstrMeasureNames.add ("FairPrincipalPV"); - - setstrMeasureNames.add ("FairPV"); - - setstrMeasureNames.add ("FairRecoveryPV"); - - setstrMeasureNames.add ("FairRisklessCleanCouponPV"); - - setstrMeasureNames.add ("FairRisklessCleanDV01"); - - setstrMeasureNames.add ("FairRisklessCleanIndexCouponPV"); - - setstrMeasureNames.add ("FairRisklessCleanPV"); - - setstrMeasureNames.add ("FairRisklessDirtyCouponPV"); - - setstrMeasureNames.add ("FairRisklessDirtyDV01"); - - setstrMeasureNames.add ("FairRisklessDirtyIndexCouponPV"); - - setstrMeasureNames.add ("FairRisklessDirtyPV"); - - setstrMeasureNames.add ("FairRiskyCleanCouponPV"); - - setstrMeasureNames.add ("FairRiskyCleanDV01"); - - setstrMeasureNames.add ("FairRiskyCleanIndexCouponPV"); - - setstrMeasureNames.add ("FairRiskyCleanPV"); - - setstrMeasureNames.add ("FairRiskyDirtyCouponPV"); - - setstrMeasureNames.add ("FairRiskyDirtyDV01"); - - setstrMeasureNames.add ("FairRiskyDirtyIndexCouponPV"); - - setstrMeasureNames.add ("FairRiskyDirtyPV"); - - setstrMeasureNames.add ("FairTSYSpread"); - - setstrMeasureNames.add ("FairWorkoutDate"); - - setstrMeasureNames.add ("FairWorkoutFactor"); - - setstrMeasureNames.add ("FairWorkoutType"); - - setstrMeasureNames.add ("FairWorkoutYield"); - - setstrMeasureNames.add ("FairYield"); - - setstrMeasureNames.add ("FairYield01"); - - setstrMeasureNames.add ("FairYieldBasis"); - - setstrMeasureNames.add ("FairYieldSpread"); - - setstrMeasureNames.add ("FairZeroDiscountMargin"); - - setstrMeasureNames.add ("FairZSpread"); - - setstrMeasureNames.add ("FirstCouponRate"); - - setstrMeasureNames.add ("FirstIndexRate"); - - setstrMeasureNames.add ("GSpread"); - - setstrMeasureNames.add ("ISpread"); - - setstrMeasureNames.add ("LossOnInstantaneousDefault"); - - setstrMeasureNames.add ("MacaulayDuration"); - - setstrMeasureNames.add ("MarketAccrued"); - - setstrMeasureNames.add ("MarketAccrued01"); - - setstrMeasureNames.add ("MarketCleanCouponPV"); - - setstrMeasureNames.add ("MarketCleanDV01"); - - setstrMeasureNames.add ("MarketCleanIndexCouponPV"); - - setstrMeasureNames.add ("MarketCleanPrice"); - - setstrMeasureNames.add ("MarketCleanPV"); - - setstrMeasureNames.add ("MarketCreditRisklessParPV"); - - setstrMeasureNames.add ("MarketCreditRisklessPrincipalPV"); - - setstrMeasureNames.add ("MarketCreditRiskyParPV"); - - setstrMeasureNames.add ("MarketCreditRiskyPrincipalPV"); - - setstrMeasureNames.add ("MarketDefaultExposure"); - - setstrMeasureNames.add ("MarketDefaultExposureNoRec"); - - setstrMeasureNames.add ("MarketDirtyCouponPV"); - - setstrMeasureNames.add ("MarketDirtyDV01"); - - setstrMeasureNames.add ("MarketDirtyIndexCouponPV"); - - setstrMeasureNames.add ("MarketDirtyPrice"); - - setstrMeasureNames.add ("MarketDirtyPV"); - - setstrMeasureNames.add ("MarketDV01"); - - setstrMeasureNames.add ("MarketExpectedRecovery"); - - setstrMeasureNames.add ("MarketFirstCouponRate"); - - setstrMeasureNames.add ("MarketFirstIndexRate"); - - setstrMeasureNames.add ("MarketInputType=CleanPrice"); - - setstrMeasureNames.add ("MarketInputType=CreditBasis"); - - setstrMeasureNames.add ("MarketInputType=DirtyPrice"); - - setstrMeasureNames.add ("MarketInputType=GSpread"); - - setstrMeasureNames.add ("MarketInputType=ISpread"); - - setstrMeasureNames.add ("MarketInputType=PECS"); - - setstrMeasureNames.add ("MarketInputType=QuotedMargin"); - - setstrMeasureNames.add ("MarketInputType=TSYSpread"); - - setstrMeasureNames.add ("MarketInputType=Yield"); - - setstrMeasureNames.add ("MarketInputType=ZSpread"); - - setstrMeasureNames.add ("MarketLossOnInstantaneousDefault"); - - setstrMeasureNames.add ("MarketParPV"); - - setstrMeasureNames.add ("MarketPrincipalPV"); - - setstrMeasureNames.add ("MarketPV"); - - setstrMeasureNames.add ("MarketRecoveryPV"); - - setstrMeasureNames.add ("MarketRisklessDirtyCouponPV"); - - setstrMeasureNames.add ("MarketRisklessDirtyDV01"); - - setstrMeasureNames.add ("MarketRisklessDirtyIndexCouponPV"); - - setstrMeasureNames.add ("MarketRisklessDirtyPV"); - - setstrMeasureNames.add ("MarketRiskyDirtyCouponPV"); - - setstrMeasureNames.add ("MarketRiskyDirtyDV01"); - - setstrMeasureNames.add ("MarketRiskyDirtyIndexCouponPV"); - - setstrMeasureNames.add ("MarketRiskyDirtyPV"); - - setstrMeasureNames.add ("ModifiedDuration"); - - setstrMeasureNames.add ("OAS"); - - setstrMeasureNames.add ("OASpread"); - - setstrMeasureNames.add ("OptionAdjustedSpread"); - - setstrMeasureNames.add ("ParEquivalentCDSSpread"); - - setstrMeasureNames.add ("ParPV"); - - setstrMeasureNames.add ("ParSpread"); - - setstrMeasureNames.add ("PECS"); - - setstrMeasureNames.add ("Price"); - - setstrMeasureNames.add ("PrincipalPV"); - - setstrMeasureNames.add ("PV"); - - setstrMeasureNames.add ("RecoveryPV"); - - setstrMeasureNames.add ("RisklessCleanCouponPV"); - - setstrMeasureNames.add ("RisklessCleanDV01"); - - setstrMeasureNames.add ("RisklessCleanIndexCouponPV"); - - setstrMeasureNames.add ("RisklessCleanPV"); - - setstrMeasureNames.add ("RisklessDirtyCouponPV"); - - setstrMeasureNames.add ("RisklessDirtyDV01"); - - setstrMeasureNames.add ("RisklessDirtyIndexCouponPV"); - - setstrMeasureNames.add ("RisklessDirtyPV"); - - setstrMeasureNames.add ("RiskyCleanCouponPV"); - - setstrMeasureNames.add ("RiskyCleanDV01"); - - setstrMeasureNames.add ("RiskyCleanIndexCouponPV"); - - setstrMeasureNames.add ("RiskyCleanPV"); - - setstrMeasureNames.add ("RiskyDirtyCouponPV"); - - setstrMeasureNames.add ("RiskyDirtyDV01"); - - setstrMeasureNames.add ("RiskyDirtyIndexCouponPV"); - - setstrMeasureNames.add ("RiskyDirtyPV"); - - setstrMeasureNames.add ("TSYSpread"); - - setstrMeasureNames.add ("WorkoutDate"); - - setstrMeasureNames.add ("WorkoutFactor"); - - setstrMeasureNames.add ("WorkoutType"); - - setstrMeasureNames.add ("WorkoutYield"); - - setstrMeasureNames.add ("Yield"); - - setstrMeasureNames.add ("Yield01"); - - setstrMeasureNames.add ("YieldBasis"); - - setstrMeasureNames.add ("YieldSpread"); - - setstrMeasureNames.add ("ZeroDiscountMargin"); - - setstrMeasureNames.add ("ZSpread"); - - return setstrMeasureNames; - } - - @Override public double pv ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParamsIn, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - throws java.lang.Exception - { - if (null == valParams || null == csqc) - throw new java.lang.Exception ("BondComponent::pv => Invalid Inputs!"); - - int iValueDate = valParams.valueDate(); - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqc.fundingState (fundingLabel()); - - if (null == dcFunding) throw new java.lang.Exception ("BondComponent::pv => Invalid Inputs!"); - - int iLossPayLag = null == _creditSetting ? 0 : _creditSetting.lossPayLag(); - - double dblProductRecovery = null == _creditSetting ? java.lang.Double.NaN : - _creditSetting.recovery(); - - boolean bUseCurveRecovery = null == _creditSetting ? false : _creditSetting.useCurveRecovery(); - - boolean bAccrualOnDefault = null == _creditSetting ? false : _creditSetting.accrualOnDefault(); - - org.drip.state.credit.CreditCurve cc = csqc.creditState (creditLabel()); - - double dblRecoveryPV = 0.; - double dblPrincipalPV = 0.; - double dblDirtyCouponPV = 0.; - - int iMaturityDate = maturityDate().julian(); - - org.drip.param.pricer.CreditPricerParams pricerParams = null != pricerParamsIn ? pricerParamsIn : new - org.drip.param.pricer.CreditPricerParams (7, null, false, - org.drip.param.pricer.CreditPricerParams.PERIOD_DISCRETIZATION_FULL_COUPON); - - for (org.drip.analytics.cashflow.CompositePeriod period : couponPeriods()) { - int iPeriodPayDate = period.payDate(); - - if (iPeriodPayDate < iValueDate) continue; - - int iPeriodEndDate = period.endDate(); - - int iPeriodStartDate = period.startDate(); - - org.drip.analytics.output.CompositePeriodCouponMetrics cpcm = couponMetrics (iValueDate, - valParams, csqc); - - if (null == cpcm) throw new java.lang.Exception ("BondComponent::pv => Invalid Inputs!"); - - double dblPeriodCoupon = cpcm.rate(); - - double dblPeriodAnnuity = dcFunding.df (iPeriodPayDate) * cpcm.cumulative(); - - double dblPeriodDirtyDV01 = 0.0001 * period.accrualDCF (iPeriodEndDate) * dblPeriodAnnuity * - notional (iPeriodStartDate, iPeriodEndDate); - - double dblPeriodPrincipalPV = (notional (iPeriodStartDate) - notional (iPeriodEndDate)) * - dblPeriodAnnuity; - - if (null != cc && null != pricerParams) { - double dblSurvProb = cc.survival (pricerParams.survivalToPayDate() ? iPeriodPayDate : - iPeriodEndDate); - - dblPeriodDirtyDV01 *= dblSurvProb; - dblPeriodPrincipalPV *= dblSurvProb; - - for (org.drip.analytics.cashflow.LossQuadratureMetrics lqm : period.lossMetrics (this, - valParams, pricerParams, iMaturityDate, csqc)) { - if (null == lqm) continue; - - int iSubPeriodEndDate = lqm.endDate(); - - int iSubPeriodStartDate = lqm.startDate(); - - double dblSubPeriodDF = dcFunding.effectiveDF (iSubPeriodStartDate + iLossPayLag, - iSubPeriodEndDate + iLossPayLag); - - double dblSubPeriodNotional = notional (iSubPeriodStartDate, iSubPeriodEndDate); - - double dblSubPeriodSurvival = cc.survival (iSubPeriodStartDate) - cc.survival - (iSubPeriodEndDate); - - if (bAccrualOnDefault) - dblPeriodDirtyDV01 += 0.0001 * lqm.accrualDCF() * dblSubPeriodSurvival * - dblSubPeriodDF * dblSubPeriodNotional; - - dblRecoveryPV += (bUseCurveRecovery ? cc.effectiveRecovery (iSubPeriodStartDate, - iSubPeriodEndDate) : dblProductRecovery) * dblSubPeriodSurvival * dblSubPeriodNotional - * dblSubPeriodDF; - } - } - - dblPrincipalPV += dblPeriodPrincipalPV; - dblDirtyCouponPV += 10000. * dblPeriodCoupon * dblPeriodDirtyDV01; - } - - double dblParPV = dcFunding.df (iMaturityDate) * notional (iMaturityDate); - - if (null != cc && null != pricerParams) dblParPV *= cc.survival (iMaturityDate); - - return (dblDirtyCouponPV + dblPrincipalPV + dblParPV + dblRecoveryPV) / dcFunding.df (null != - _marketConvention ? _marketConvention.settleDate (valParams) : valParams.cashPayDate()); - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDDirtyPVDManifestMeasure ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - return null; - } - - @Override public org.drip.product.calib.ProductQuoteSet calibQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fundingPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint forwardPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fundingForwardPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fxPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint govviePRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint volatilityPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.quant.calculus.WengertJacobian manifestMeasureDFMicroJack ( - final java.lang.String strManifestMeasure, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - return null; - } - - /** - * The BondCalibrator implements a calibrator that calibrates the yield, the credit basis, or the Z - * Spread for the bond given the price input. Calibration happens via either Newton-Raphson method, - * or via bracketing/root searching. - * - * @author Lakshmi Krishnamurthy - * - */ - - public class BondCalibrator { - private BondComponent _bond = null; - - /** - * Constructor: Construct the calibrator from the parent bond. - * - * @param bond Parent - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public BondCalibrator ( - final BondComponent bond) - throws java.lang.Exception - { - if (null == (_bond = bond)) - throw new java.lang.Exception ("BondComponent::BondCalibrator ctr => Invalid Inputs"); - } - - /** - * Calibrate the bond yield from the market price using the root bracketing technique. - * - * @param valParams Valuation Parameters - * @param csqs Bond Market Parameters - * @param iWorkoutDate JulianDate Work-out - * @param dblWorkoutFactor Work-out factor - * @param dblPrice Price to be calibrated to - * - * @return The calibrated Yield - * - * @throws java.lang.Exception Thrown if the yield cannot be calibrated - */ - - public double calibrateYieldFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPrice)) - throw new java.lang.Exception - ("BondComponent::BondCalibrator::calibrateYieldFromPrice => Invalid Inputs!"); - - org.drip.function.definition.R1ToR1 ofYieldToPrice = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblYield) - throws java.lang.Exception - { - return _bond.priceFromYield (valParams, csqs, null, iWorkoutDate, dblWorkoutFactor, - dblYield) - dblPrice; - } - }; - - org.drip.function.r1tor1solver.FixedPointFinderOutput rfop = new - org.drip.function.r1tor1solver.FixedPointFinderNewton (0., ofYieldToPrice, true).findRoot(); - - if (null == rfop || !rfop.containsRoot()) - rfop = new org.drip.function.r1tor1solver.FixedPointFinderZheng (0., ofYieldToPrice, - true).findRoot(); - - if (null == rfop || !rfop.containsRoot()) - rfop = new org.drip.function.r1tor1solver.FixedPointFinderBracketing (0., ofYieldToPrice, - null, org.drip.function.r1tor1solver.VariateIteratorPrimitive.FALSE_POSITION, - true).findRoot(); - - if (null == rfop || !rfop.containsRoot()) - throw new java.lang.Exception - ("BondComponent::BondCalibrator::calibrateYieldFromPrice => Cannot get root!"); - - return rfop.getRoot(); - } - - /** - * Calibrate the bond Z Spread from the market price using the root bracketing technique. - * - * @param valParams Valuation Parameters - * @param csqs Bond Market Parameters - * @param iZeroCurveBaseDC The Discount Curve to derive the zero curve off of - * @param iWorkoutDate JulianDate Work-out - * @param dblWorkoutFactor Work-out factor - * @param dblPrice Price to be calibrated to - * - * @return The calibrated Z Spread - * - * @throws java.lang.Exception Thrown if the Z Spread cannot be calibrated - */ - - public double calibrateZSpreadFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final int iZeroCurveBaseDC, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPrice)) - throw new java.lang.Exception - ("BondComponent::BondCalibrator::calibrateZSpreadFromPrice => Invalid Inputs!"); - - if (null != _floaterSetting) - throw new java.lang.Exception - ("BondComponent::BondCalibrator::calibrateZSpreadFromPrice => Z Spread Calculation turned off for floaters!"); - - org.drip.function.definition.R1ToR1 ofZSpreadToPrice = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblZSpread) - throws java.lang.Exception - { - return _bond.priceFromZeroCurve (valParams, csqs, null, iZeroCurveBaseDC, iWorkoutDate, - dblWorkoutFactor, dblZSpread) - dblPrice; - } - }; - - org.drip.function.r1tor1solver.FixedPointFinderOutput rfop = new - org.drip.function.r1tor1solver.FixedPointFinderNewton (0., ofZSpreadToPrice, - true).findRoot(); - - if (null == rfop || !rfop.containsRoot()) - rfop = new org.drip.function.r1tor1solver.FixedPointFinderZheng (0., ofZSpreadToPrice, - true).findRoot(); - - if (null == rfop || !rfop.containsRoot()) - rfop = new org.drip.function.r1tor1solver.FixedPointFinderBracketing (0., ofZSpreadToPrice, - null, org.drip.function.r1tor1solver.VariateIteratorPrimitive.FALSE_POSITION, - true).findRoot(); - - if (null == rfop || !rfop.containsRoot()) - throw new java.lang.Exception - ("BondComponent::BondCalibrator::calibrateZSpreadFromPrice => Cannot get root!"); - - return rfop.getRoot(); - } - - /** - * Calibrate the Bond OAS from the Market Price using the Root Bracketing Technique. - * - * @param valParams Valuation Parameters - * @param csqs Bond Market Parameters - * @param iZeroCurveBaseDC The Discount Curve to derive the zero curve off of - * @param iWorkoutDate JulianDate Work-out - * @param dblWorkoutFactor Work-out factor - * @param dblPrice Price to be calibrated to - * - * @return The Calibrated OAS - * - * @throws java.lang.Exception Thrown if the OAS cannot be calibrated - */ - - public double calibrateOASFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final int iZeroCurveBaseDC, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPrice)) - throw new java.lang.Exception - ("BondComponent::BondCalibrator::calibrateOASFromPrice => Invalid Inputs!"); - - org.drip.function.definition.R1ToR1 r1ToR1OASToPrice = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblZSpread) - throws java.lang.Exception - { - return _bond.priceFromZeroCurve (valParams, csqs, null, iZeroCurveBaseDC, iWorkoutDate, - dblWorkoutFactor, dblZSpread) - dblPrice; - } - }; - - org.drip.function.r1tor1solver.FixedPointFinderOutput rfop = new - org.drip.function.r1tor1solver.FixedPointFinderNewton (0., r1ToR1OASToPrice, - true).findRoot(); - - if (null == rfop || !rfop.containsRoot()) - rfop = new org.drip.function.r1tor1solver.FixedPointFinderZheng (0., r1ToR1OASToPrice, - true).findRoot(); - - if (null == rfop || !rfop.containsRoot()) - rfop = new org.drip.function.r1tor1solver.FixedPointFinderBracketing (0., r1ToR1OASToPrice, - null, org.drip.function.r1tor1solver.VariateIteratorPrimitive.FALSE_POSITION, - true).findRoot(); - - if (null == rfop || !rfop.containsRoot()) - throw new java.lang.Exception - ("BondComponent::BondCalibrator::calibrateOASFromPrice => Cannot get root!"); - - return rfop.getRoot(); - } - - /** - * Calibrate the bond Z Spread from the market price. Calibration is done by bumping the discount - * curve. - * - * @param valParams Valuation Parameters - * @param csqs Bond Market Parameters - * @param iWorkoutDate JulianDate Work-out - * @param dblWorkoutFactor Work-out factor - * @param dblPrice Price to be calibrated to - * - * @return The calibrated Z Spread - * - * @throws java.lang.Exception Thrown if the yield cannot be calibrated - */ - - public double calibDiscCurveSpreadFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPrice)) - throw new java.lang.Exception - ("BondComponent::BondCalibrator::calibrateDiscCurveSpreadFromPrice => Invalid Inputs!"); - - org.drip.function.definition.R1ToR1 ofDiscCurveSpreadToPrice = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblZSpread) - throws java.lang.Exception - { - return _bond.priceFromFundingCurve (valParams, csqs, iWorkoutDate, dblWorkoutFactor, - dblZSpread) - dblPrice; - } - }; - - org.drip.function.r1tor1solver.FixedPointFinderOutput rfop = new - org.drip.function.r1tor1solver.FixedPointFinderNewton (0., ofDiscCurveSpreadToPrice, - true).findRoot(); - - if (null == rfop || !rfop.containsRoot()) - rfop = new org.drip.function.r1tor1solver.FixedPointFinderZheng (0., - ofDiscCurveSpreadToPrice, true).findRoot(); - - if (null == rfop || !rfop.containsRoot()) - rfop = new org.drip.function.r1tor1solver.FixedPointFinderBracketing (0., - ofDiscCurveSpreadToPrice, null, - org.drip.function.r1tor1solver.VariateIteratorPrimitive.FALSE_POSITION, - true).findRoot(); - - if (null == rfop || !rfop.containsRoot()) - throw new java.lang.Exception - ("BondComponent::BondCalibrator::calibDiscCurveSpreadFromPrice => Cannot get root!"); - - return rfop.getRoot(); - } - - /** - * Calibrate the bond Z Spread from the market price. Calibration is done by bumping the Zero Curve. - * - * @param valParams Valuation Parameters - * @param csqs Bond Market Parameters - * @param vcp Quoting Parameters - * @param iWorkoutDate JulianDate Work-out - * @param dblWorkoutFactor Work-out factor - * @param dblPrice Price to be calibrated to - * - * @return The calibrated Z Spread - * - * @throws java.lang.Exception Thrown if the yield cannot be calibrated - */ - - public double calibZeroCurveSpreadFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPrice)) - throw new java.lang.Exception - ("BondComponent::BondCalibrator::calibrateZeroCurveSpreadFromPrice => Invalid Inputs!"); - - if (null != _floaterSetting) - throw new java.lang.Exception - ("BondComponent::BondCalibrator::calibZeroCurveSpreadFromPrice => Z Spread Calculation turned off for floaters!"); - - org.drip.function.definition.R1ToR1 ofZSpreadToPrice = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblZSpread) - throws java.lang.Exception - { - return _bond.priceFromFundingCurve (valParams, csqs, iWorkoutDate, dblWorkoutFactor, - dblZSpread) - dblPrice; - } - }; - - org.drip.function.r1tor1solver.FixedPointFinderOutput rfop = new - org.drip.function.r1tor1solver.FixedPointFinderNewton (0., ofZSpreadToPrice, - true).findRoot(); - - if (null == rfop || !rfop.containsRoot()) - rfop = new org.drip.function.r1tor1solver.FixedPointFinderZheng (0., ofZSpreadToPrice, - true).findRoot(); - - if (null == rfop || !rfop.containsRoot()) - rfop = new org.drip.function.r1tor1solver.FixedPointFinderBracketing (0., ofZSpreadToPrice, - null, org.drip.function.r1tor1solver.VariateIteratorPrimitive.FALSE_POSITION, - true).findRoot(); - - if (null == rfop || !rfop.containsRoot()) - throw new java.lang.Exception - ("BondComponent.calibZeroCurveSpreadFromPrice => Cannot get root!"); - - return rfop.getRoot(); - } - - /** - * Calibrate the bond Credit Basis from the market price - * - * @param valParams Valuation Parameters - * @param csqs Bond Market Parameters - * @param iWorkoutDate JulianDate Work-out - * @param dblWorkoutFactor Work-out factor - * @param dblPrice Price to be calibrated to - * @param bFlat TRUE - Calibrate to Flat Curve - * - * @return The calibrated Credit Basis - * - * @throws java.lang.Exception Thrown if the Credit Basis cannot be calibrated - */ - - public double calibrateCreditBasisFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice, - final boolean bFlat) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPrice)) - throw new java.lang.Exception - ("BondComponent::BondCalibrator::calibrateCreditBasisFromPrice => Invalid Inputs!"); - - org.drip.function.definition.R1ToR1 ofCreditBasisToPrice = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblCreditBasis) - throws java.lang.Exception - { - return _bond.priceFromCreditCurve (valParams, csqs, iWorkoutDate, dblWorkoutFactor, - dblCreditBasis, bFlat) - dblPrice; - } - }; - - org.drip.function.r1tor1solver.FixedPointFinderOutput rfop = new - org.drip.function.r1tor1solver.FixedPointFinderNewton (0., ofCreditBasisToPrice, - true).findRoot(); - - if (null == rfop || !rfop.containsRoot()) - rfop = new org.drip.function.r1tor1solver.FixedPointFinderZheng (0., ofCreditBasisToPrice, - true).findRoot(); - - if (null == rfop || !rfop.containsRoot()) - rfop = new org.drip.function.r1tor1solver.FixedPointFinderBracketing (0., ofCreditBasisToPrice, - null, org.drip.function.r1tor1solver.VariateIteratorPrimitive.FALSE_POSITION, - true).findRoot(); - - if (null == rfop || !rfop.containsRoot()) - throw new java.lang.Exception - ("BondComponent.calibrateCreditBasisFromPrice => Cannot get root!"); - - return rfop.getRoot(); - } - } - - @Override public void showPeriods() - throws java.lang.Exception - { - for (org.drip.analytics.cashflow.CompositePeriod period : couponPeriods()) - System.out.println ("\t" + org.drip.analytics.date.DateUtil.YYYYMMDD (period.startDate()) + - "->" + org.drip.analytics.date.DateUtil.YYYYMMDD (period.endDate()) + " " + - period.accrualDCF (period.endDate())); - } -} diff --git a/org/drip/product/credit/CDSBasket.java b/org/drip/product/credit/CDSBasket.java deleted file mode 100644 index a032e74..0000000 --- a/org/drip/product/credit/CDSBasket.java +++ /dev/null @@ -1,273 +0,0 @@ - -package org.drip.product.credit; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * CDSBasket implements the basket default swap product contract details. It contains effective date, - * maturity date, coupon, coupon day count, coupon frequency, basket components, basket notional, loss pay - * lag, and optionally the outstanding notional schedule and the flat basket recovery. It also contains - * methods to serialize out of and de-serialize into byte arrays. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDSBasket extends org.drip.product.definition.BasketProduct { - private double[] _adblWeight = null; - private java.lang.String _strName = ""; - private org.drip.product.definition.Component[] _aComp = null; - - /** - * Construct a CDS Basket from the components and their weights - * - * @param aComp Array of components - * @param adblWeight Weights of the components - * @param strName Name of the basket - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public CDSBasket ( - final org.drip.product.definition.Component[] aComp, - final double[] adblWeight, - final java.lang.String strName) - throws java.lang.Exception - { - if (null == aComp || 0 == aComp.length || null == adblWeight || 0 == adblWeight.length || - aComp.length != adblWeight.length || null == strName || strName.isEmpty()) - throw new java.lang.Exception ("CDSBasket ctr: Invalid inputs!"); - - _strName = strName; - double dblCumulativeWeight = 0.; - _adblWeight = new double[adblWeight.length]; - _aComp = new org.drip.product.definition.Component[aComp.length]; - - for (int i = 0; i < aComp.length; ++i) - dblCumulativeWeight += _adblWeight[i]; - - for (int i = 0; i < aComp.length; ++i) { - if (null == (_aComp[i] = aComp[i])) - throw new java.lang.Exception ("CDSBasket ctr: Invalid Inputs!"); - - _adblWeight[i] = adblWeight[i] / dblCumulativeWeight; - } - } - - @Override public java.lang.String name() - { - return _strName; - } - - @Override public org.drip.product.definition.Component[] components() - { - return _aComp; - } - - @Override public int measureAggregationType ( - final java.lang.String strMeasureName) - { - if ("AccrualDays".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("Accrued".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("Accrued01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("CleanDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("CleanPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("DirtyDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("DirtyPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("DV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("ExpLoss".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("ExpLossNoRec".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairAccrualDays".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("FairAccrued".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairAccrued01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairCleanDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairCleanPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairDirtyDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairDirtyPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairExpLoss".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairExpLossNoRec".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairFairPremium".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairLossNoRecPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairLossPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairParSpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairPremium".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("FairPremiumPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("FairUpfront".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("LossNoRecPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("LossPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketAccrualDays".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - - if ("MarketAccrued".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketAccrued01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketCleanDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketCleanPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketDirtyDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketDirtyPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketDV01".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketExpLoss".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketExpLossNoRec".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketFairPremium".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("MarketLossNoRecPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketLossPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketParSpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("MarketPremiumPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("MarketUpfront".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("ParSpread".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - if ("PremiumPV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("PV".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_CUMULATIVE; - - if ("Upfront".equalsIgnoreCase (strMeasureName)) - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE; - - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_IGNORE; - } -} diff --git a/org/drip/product/credit/CDSComponent.java b/org/drip/product/credit/CDSComponent.java deleted file mode 100644 index a384602..0000000 --- a/org/drip/product/credit/CDSComponent.java +++ /dev/null @@ -1,1482 +0,0 @@ - -package org.drip.product.credit; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * CDSComponent implements the credit default swap product contract details. It exposes the following - * functionality: - * - Methods to extract effective date, maturity date, coupon, coupon day count, coupon frequency, - * contingent credit, currency, basket notional, credit valuation parameters, and optionally the - * outstanding notional schedule. - * - Methods to compute the Jacobians to/from quote-to-latent state/manifest measures - * - Serialization into and de-serialization out of byte arrays - * - CDS specific methods such as such loss metric/Jacobian estimation, quote flat spread calibration etc: - * - * @author Lakshmi Krishnamurthy - * - */ - -public class CDSComponent extends org.drip.product.definition.CreditDefaultSwap { - private double _dblNotional = 100.; - private java.lang.String _strCode = ""; - private java.lang.String _strName = ""; - private boolean _bApplyAccEOMAdj = false; - private boolean _bApplyCpnEOMAdj = false; - private java.lang.String _strCouponCurrency = ""; - private double _dblCoupon = java.lang.Double.NaN; - private int _iMaturityDate = java.lang.Integer.MIN_VALUE; - private int _iEffectiveDate = java.lang.Integer.MIN_VALUE; - private org.drip.quant.common.Array2D _notlSchedule = null; - private org.drip.product.params.CreditSetting _crValParams = null; - private org.drip.param.valuation.CashSettleParams _settleParams = null; - private java.util.List _lsCouponPeriod = null; - - private org.drip.analytics.support.CaseInsensitiveTreeMap measures ( - final java.lang.String strMeasureSetPrefix, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParamsIn, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == valParams || null == csqs) return null; - - org.drip.state.credit.CreditCurve cc = csqs.creditState (creditLabel()); - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqs.fundingState (fundingLabel()); - - if (null == cc || null == dcFunding) return null; - - org.drip.param.pricer.CreditPricerParams pricerParams = null != pricerParamsIn ? pricerParamsIn : - org.drip.param.pricer.CreditPricerParams.Standard(); - - long lStart = System.nanoTime(); - - int iAccrualDays = 0; - double dblLossPV = 0.; - double dblExpLoss = 0.; - double dblAccrued01 = 0.; - double dblDirtyDV01 = 0.; - double dblLossNoRecPV = 0.; - double dblExpLossNoRec = 0.; - boolean bFirstPeriod = true; - double dblCashPayDF = java.lang.Double.NaN; - - int iValueDate = valParams.valueDate(); - - int iLossPayLag = _crValParams.lossPayLag(); - - try { - for (org.drip.analytics.cashflow.CompositePeriod period : _lsCouponPeriod) { - int iPayDate = period.payDate(); - - if (iPayDate < iValueDate) continue; - - int iEndDate = period.endDate(); - - int iStartDate = period.startDate(); - - double dblPeriodNotional = notional (iStartDate, iValueDate); - - if (bFirstPeriod) { - bFirstPeriod = false; - - if (iStartDate < iValueDate) { - iAccrualDays = iValueDate - iStartDate; - - dblAccrued01 = period.accrualDCF (iValueDate) * 0.01 * dblPeriodNotional; - } - } - - double dblSurvProb = pricerParams.survivalToPayDate() ? cc.survival (iPayDate) : - cc.survival (iEndDate); - - dblDirtyDV01 += 0.01 * period.couponDCF() * dcFunding.df (iPayDate) * dblSurvProb * - dblPeriodNotional; - - for (org.drip.analytics.cashflow.LossQuadratureMetrics lp : period.lossMetrics (this, - valParams, pricerParams, iEndDate, csqs)) { - if (null == lp) continue; - - int iSubPeriodEndDate = lp.endDate(); - - int iSubPeriodStartDate = lp.startDate(); - - double dblSubPeriodDF = dcFunding.effectiveDF (iSubPeriodStartDate + iLossPayLag, - iSubPeriodEndDate + iLossPayLag); - - double dblSubPeriodNotional = notional (iSubPeriodStartDate, iSubPeriodEndDate); - - double dblSubPeriodSurvival = cc.survival (iSubPeriodStartDate) - cc.survival - (iSubPeriodEndDate); - - double dblRecovery = _crValParams.useCurveRecovery() ? cc.effectiveRecovery - (iSubPeriodStartDate, iSubPeriodEndDate) : _crValParams.recovery(); - - double dblSubPeriodExpLoss = (1. - dblRecovery) * 100. * dblSubPeriodSurvival * - dblSubPeriodNotional; - double dblSubPeriodExpLossNoRec = 100. * dblSubPeriodSurvival * dblSubPeriodNotional; - dblLossPV += dblSubPeriodExpLoss * dblSubPeriodDF; - dblLossNoRecPV += dblSubPeriodExpLossNoRec * dblSubPeriodDF; - dblExpLoss += dblSubPeriodExpLoss; - dblExpLossNoRec += dblSubPeriodExpLossNoRec; - - dblDirtyDV01 += 0.01 * lp.accrualDCF() * dblSubPeriodSurvival * dblSubPeriodDF * - dblSubPeriodNotional; - } - } - - dblCashPayDF = dcFunding.df (null == _settleParams ? valParams.cashPayDate() : - _settleParams.cashSettleDate (iValueDate)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - dblLossPV /= dblCashPayDF; - dblDirtyDV01 /= dblCashPayDF; - dblLossNoRecPV /= dblCashPayDF; - double dblNotlFactor = _dblNotional * 0.01; - double dblCleanDV01 = dblDirtyDV01 - dblAccrued01; - double dblCleanPV = dblCleanDV01 * 10000. * _dblCoupon - dblLossPV; - double dblDirtyPV = dblDirtyDV01 * 10000. * _dblCoupon - dblLossPV; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapResult = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapResult.put (strMeasureSetPrefix + "AccrualDays", 1. * iAccrualDays); - - mapResult.put (strMeasureSetPrefix + "Accrued", dblAccrued01 * _dblCoupon * dblNotlFactor); - - mapResult.put (strMeasureSetPrefix + "Accrued01", dblAccrued01 * dblNotlFactor); - - mapResult.put (strMeasureSetPrefix + "CleanDV01", dblCleanDV01 * dblNotlFactor); - - mapResult.put (strMeasureSetPrefix + "CleanPV", dblCleanPV * dblNotlFactor); - - mapResult.put (strMeasureSetPrefix + "CleanCouponPV", dblCleanDV01 * _dblCoupon * dblNotlFactor); - - mapResult.put (strMeasureSetPrefix + "DirtyCouponPV", dblDirtyDV01 * _dblCoupon * dblNotlFactor); - - mapResult.put (strMeasureSetPrefix + "DirtyDV01", dblDirtyDV01 * dblNotlFactor); - - mapResult.put (strMeasureSetPrefix + "DirtyPV", dblDirtyPV * dblNotlFactor); - - mapResult.put (strMeasureSetPrefix + "DV01", dblDirtyDV01 * dblNotlFactor); - - mapResult.put (strMeasureSetPrefix + "ExpLoss", dblExpLoss * dblNotlFactor); - - mapResult.put (strMeasureSetPrefix + "ExpLossNoRec", dblExpLossNoRec * dblNotlFactor); - - mapResult.put (strMeasureSetPrefix + "FairPremium", dblLossPV / dblCleanDV01); - - mapResult.put (strMeasureSetPrefix + "LossNoRecPV", dblLossNoRecPV * dblNotlFactor); - - mapResult.put (strMeasureSetPrefix + "LossPV", dblLossPV * dblNotlFactor); - - mapResult.put (strMeasureSetPrefix + "ParSpread", dblLossPV / dblCleanDV01); - - mapResult.put (strMeasureSetPrefix + "PV", dblDirtyPV * dblNotlFactor); - - mapResult.put (strMeasureSetPrefix + "Upfront", dblCleanPV * dblNotlFactor); - - try { - double dblValueNotional = notional (iValueDate); - - mapResult.put (strMeasureSetPrefix + "CleanPrice", 100. * (1. + (dblCleanPV / _dblNotional / - dblValueNotional))); - - mapResult.put (strMeasureSetPrefix + "DirtyPrice", 100. * (1. + (dblDirtyPV / _dblNotional / - dblValueNotional))); - - mapResult.put (strMeasureSetPrefix + "LossOnInstantaneousDefault", _dblNotional * (1. - - cc.recovery (iValueDate))); - - mapResult.put (strMeasureSetPrefix + "Price", 100. * (1. + (dblCleanPV / _dblNotional / - dblValueNotional))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - mapResult.put (strMeasureSetPrefix + "CalcTime", (System.nanoTime() - lStart) * 1.e-09); - - return mapResult; - } - - private org.drip.quant.calculus.WengertJacobian calcPeriodOnDefaultPVDFMicroJack ( - final double dblFairPremium, - final org.drip.analytics.cashflow.CompositePeriod period, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqs.fundingState (fundingLabel()); - - int iNumParameters = 0; - org.drip.quant.calculus.WengertJacobian wjPeriodOnDefaultPVDF = null; - - for (org.drip.analytics.cashflow.LossQuadratureMetrics lpcf : period.lossMetrics (this, valParams, - pricerParams, period.endDate(), csqs)) { - org.drip.quant.calculus.WengertJacobian wjPeriodPayDFDF = dcFunding.jackDDFDManifestMeasure - ((lpcf.startDate() + lpcf.endDate()) / 2 + _crValParams.lossPayLag(), "Rate"); - - try { - if (null == wjPeriodOnDefaultPVDF) - wjPeriodOnDefaultPVDF = new org.drip.quant.calculus.WengertJacobian (1, iNumParameters = - wjPeriodPayDFDF.numParameters()); - - double dblPeriodIncrementalCashFlow = notional (lpcf.startDate(), lpcf.endDate()) * - (dblFairPremium * lpcf.accrualDCF() - 1. + lpcf.effectiveRecovery()) * - (lpcf.startSurvival() - lpcf.endSurvival()); - - for (int k = 0; k < iNumParameters; ++k) { - if (!wjPeriodOnDefaultPVDF.accumulatePartialFirstDerivative (0, k, - wjPeriodPayDFDF.firstDerivative (0, k) * dblPeriodIncrementalCashFlow)) - return null; - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return wjPeriodOnDefaultPVDF; - } - - private PeriodLossMicroJack calcPeriodLossMicroJack ( - final org.drip.analytics.cashflow.CompositePeriod period, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqs.fundingState (fundingLabel()); - - PeriodLossMicroJack plmj = null; - - for (org.drip.analytics.cashflow.LossQuadratureMetrics lpcf : period.lossMetrics (this, valParams, - pricerParams, period.endDate(), csqs)) { - double dblPeriodNotional = java.lang.Double.NaN; - double dblPeriodIncrementalLoss = java.lang.Double.NaN; - double dblPeriodIncrementalAccrual = java.lang.Double.NaN; - double dblPeriodIncrementalSurvival = java.lang.Double.NaN; - - int iPeriodEffectiveDate = (lpcf.startDate() + lpcf.endDate()) / 2; - - org.drip.quant.calculus.WengertJacobian wjPeriodPayDFDF = dcFunding.jackDDFDManifestMeasure - (iPeriodEffectiveDate + _crValParams.lossPayLag(), "Rate"); - - try { - dblPeriodNotional = notional (lpcf.startDate(), lpcf.endDate()); - - dblPeriodIncrementalSurvival = lpcf.startSurvival() - lpcf.endSurvival(); - - dblPeriodIncrementalLoss = dblPeriodNotional * (1. - lpcf.effectiveRecovery()) * - dblPeriodIncrementalSurvival; - - dblPeriodIncrementalAccrual = dblPeriodNotional * lpcf.accrualDCF() * - dblPeriodIncrementalSurvival; - - if (null == plmj) plmj = new PeriodLossMicroJack (wjPeriodPayDFDF.numParameters()); - - plmj._dblAccrOnDef01 += dblPeriodIncrementalAccrual * dcFunding.df (iPeriodEffectiveDate + - _crValParams.lossPayLag()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int k = 0; k < wjPeriodPayDFDF.numParameters(); ++k) { - if (!plmj._wjLossPVMicroJack.accumulatePartialFirstDerivative (0, k, dblPeriodIncrementalLoss - * wjPeriodPayDFDF.firstDerivative (0, k))) - return null; - - if (!plmj._wjAccrOnDef01MicroJack.accumulatePartialFirstDerivative (0, k, - dblPeriodIncrementalAccrual * wjPeriodPayDFDF.firstDerivative (0, k))) - return null; - } - } - - return plmj; - } - - private org.drip.analytics.cashflow.CompositePeriod calcCurrentPeriod ( - final int iDate) - { - org.drip.analytics.cashflow.CompositePeriod cpFirst = _lsCouponPeriod.get (0); - - if (iDate <= cpFirst.startDate()) return cpFirst; - - for (org.drip.analytics.cashflow.CompositePeriod period : _lsCouponPeriod) { - try { - if (period.contains (iDate)) return period; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return null; - } - - /** - * CDSComponent constructor: Most generic CDS creation functionality - * - * @param iEffectiveDate Effective Date - * @param iMaturityDate Maturity Date - * @param dblCoupon Coupon - * @param iFreq Frequency - * @param strCouponDC Coupon DC - * @param strAccrualDC Accrual DC - * @param strFloatingRateIndex Floating Rate Index - * @param bConvCDS Is CDS Conventional - * @param dapEffective Effective DAP - * @param dapMaturity Maturity DAP - * @param dapPeriodStart Period Start DAP - * @param dapPeriodEnd Period End DAP - * @param dapAccrualStart Accrual Start DAP - * @param dapAccrualEnd Accrual End DAP - * @param dapPay Pay DAP - * @param dapReset Reset DAP - * @param notlSchedule Notional Schedule - * @param dblNotional Notional Amount - * @param strCouponCurrency Coupon Currency - * @param crValParams Credit Valuation Parameters - * @param strCalendar Calendar - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public CDSComponent ( - final int iEffectiveDate, - final int iMaturityDate, - final double dblCoupon, - final int iFreq, - final java.lang.String strCouponDC, - final java.lang.String strAccrualDC, - final java.lang.String strFloatingRateIndex, - final boolean bConvCDS, - final org.drip.analytics.daycount.DateAdjustParams dapEffective, - final org.drip.analytics.daycount.DateAdjustParams dapMaturity, - final org.drip.analytics.daycount.DateAdjustParams dapPeriodStart, - final org.drip.analytics.daycount.DateAdjustParams dapPeriodEnd, - final org.drip.analytics.daycount.DateAdjustParams dapAccrualStart, - final org.drip.analytics.daycount.DateAdjustParams dapAccrualEnd, - final org.drip.analytics.daycount.DateAdjustParams dapPay, - final org.drip.analytics.daycount.DateAdjustParams dapReset, - final org.drip.quant.common.Array2D notlSchedule, - final double dblNotional, - final java.lang.String strCouponCurrency, - final org.drip.product.params.CreditSetting crValParams, - final java.lang.String strCalendar) - throws java.lang.Exception - { - if (null == strCouponCurrency || (_strCouponCurrency = strCouponCurrency).isEmpty() || null == - crValParams || !org.drip.quant.common.NumberUtil.IsValid (dblCoupon)) - throw new java.lang.Exception ("CDSComponent ctr: Invalid params!"); - - _dblCoupon = dblCoupon; - _crValParams = crValParams; - java.lang.String strTenor = (12 / iFreq) + "M"; - - if (null == (_notlSchedule = notlSchedule)) - _notlSchedule = org.drip.quant.common.Array2D.BulletSchedule(); - - org.drip.param.period.UnitCouponAccrualSetting ucas = new - org.drip.param.period.UnitCouponAccrualSetting (iFreq, strCouponDC, _bApplyCpnEOMAdj, - strAccrualDC, _bApplyAccEOMAdj, _strCouponCurrency, true, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - org.drip.param.period.ComposableFixedUnitSetting cfus = new - org.drip.param.period.ComposableFixedUnitSetting (strTenor, - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, null, 0., 0., - _strCouponCurrency); - - org.drip.param.period.CompositePeriodSetting cps = new org.drip.param.period.CompositePeriodSetting - (iFreq, strTenor, _strCouponCurrency, null, _dblNotional = dblNotional, null, _notlSchedule, - null, null == _crValParams ? null : org.drip.state.identifier.CreditLabel.Standard - (_crValParams.creditCurveName())); - - java.util.List lsStreamEdgeDate = - org.drip.analytics.support.CompositePeriodBuilder.BackwardEdgeDates (new - org.drip.analytics.date.JulianDate (_iEffectiveDate = iEffectiveDate), new - org.drip.analytics.date.JulianDate (_iMaturityDate = iMaturityDate), strTenor, - dapAccrualEnd, org.drip.analytics.support.CompositePeriodBuilder.SHORT_STUB); - - if (null == (_lsCouponPeriod = org.drip.analytics.support.CompositePeriodBuilder.FixedCompositeUnit - (lsStreamEdgeDate, cps, ucas, cfus)) || 0 == _lsCouponPeriod.size()) - throw new java.lang.Exception ("CDSComponent ctr: Cannot make Coupon Period List!"); - } - - @Override public java.lang.String primaryCode() - { - return _strCode; - } - - @Override public void setPrimaryCode ( - final java.lang.String strCode) - { - _strCode = strCode; - } - - public boolean setName ( - final java.lang.String strName) - { - _strName = strName; - return true; - } - - @Override public java.lang.String name() - { - if (null != _strName && !_strName.isEmpty()) return _strName; - - return "CDS=" + org.drip.analytics.date.DateUtil.YYYYMMDD (_iMaturityDate); - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap couponCurrency() - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapCouponCurrency = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapCouponCurrency.put (name(), _strCouponCurrency); - - return mapCouponCurrency; - } - - @Override public java.lang.String payCurrency() - { - return _strCouponCurrency; - } - - @Override public java.lang.String principalCurrency() - { - return null; - } - - @Override public double initialNotional() - { - return _dblNotional; - } - - @Override public double notional ( - final int iDate) - throws java.lang.Exception - { - if (null == _notlSchedule) throw new java.lang.Exception ("CDSComponent::notional => Bad date"); - - return _notlSchedule.y (iDate); - } - - @Override public double notional ( - final int iDate1, - final int iDate2) - throws java.lang.Exception - { - if (null == _notlSchedule) throw new java.lang.Exception ("CDSComponent::notional => Bad date"); - - return _notlSchedule.y (iDate1, iDate2); - } - - @Override public double recovery ( - final int iDate, - final org.drip.state.credit.CreditCurve cc) - throws java.lang.Exception - { - if (null == cc) throw new java.lang.Exception ("CDSComponent::recovery => Bad inputs"); - - return _crValParams.useCurveRecovery() ? cc.recovery (iDate) : _crValParams.recovery(); - } - - @Override public double recovery ( - final int iDateStart, - final int iDateEnd, - final org.drip.state.credit.CreditCurve cc) - throws java.lang.Exception - { - if (null == cc) throw new java.lang.Exception ("CDSComponent::recovery: Bad inputs"); - - double dblRecovery = _crValParams.useCurveRecovery() ? cc.effectiveRecovery (iDateStart, iDateEnd) : - _crValParams.recovery(); - - return dblRecovery; - } - - @Override public org.drip.product.params.CreditSetting creditValuationParams() - { - return _crValParams; - } - - @Override public org.drip.analytics.output.CompositePeriodCouponMetrics couponMetrics ( - final int iAccrualEndDate, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - try { - org.drip.analytics.cashflow.CompositePeriod period = calcCurrentPeriod (iAccrualEndDate); - - return null == period ? null : period.couponMetrics (iAccrualEndDate, csqs); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public int freq() - { - return couponPeriods().get (0).freq(); - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap calibMeasures ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - return null; - } - - @Override public org.drip.state.identifier.CreditLabel creditLabel() - { - return null == _crValParams || null == _crValParams.creditCurveName() || - _crValParams.creditCurveName().isEmpty() ? null : org.drip.state.identifier.CreditLabel.Standard - (_crValParams.creditCurveName()); - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - forwardLabel() - { - return null; - } - - @Override public org.drip.state.identifier.FundingLabel fundingLabel() - { - return org.drip.state.identifier.FundingLabel.Standard (_strCouponCurrency); - } - - @Override public org.drip.state.identifier.GovvieLabel govvieLabel() - { - return org.drip.state.identifier.GovvieLabel.Standard (payCurrency()); - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap - fxLabel() - { - return null; - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - volatilityLabel() - { - return null; - } - - @Override public org.drip.analytics.date.JulianDate effectiveDate() - { - try { - return new org.drip.analytics.date.JulianDate (_iEffectiveDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.analytics.date.JulianDate maturityDate() - { - try { - return new org.drip.analytics.date.JulianDate (_iMaturityDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.analytics.date.JulianDate firstCouponDate() - { - try { - return new org.drip.analytics.date.JulianDate (_lsCouponPeriod.get (0).endDate()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public java.util.List couponPeriods() - { - return _lsCouponPeriod; - } - - @Override public org.drip.param.valuation.CashSettleParams cashSettleParams() - { - return _settleParams; - } - - @Override public java.util.List lossFlow ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - if (null == valParams || null == pricerParams) return null; - - java.util.List sLP = new - java.util.ArrayList(); - - int iValueDate = valParams.valueDate(); - - for (org.drip.analytics.cashflow.CompositePeriod period : _lsCouponPeriod) { - int iPeriodEndDate = period.endDate(); - - if (null == period || iPeriodEndDate < iValueDate) continue; - - java.util.List sLPSub = period.lossMetrics - (this, valParams, pricerParams, iPeriodEndDate, csqs); - - if (null != sLPSub) sLP.addAll (sLPSub); - } - - return sLP; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap value ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapFairMeasures = measures ("", - valParams, pricerParams, csqs, vcp); - - if (null == mapFairMeasures) return null; - - org.drip.quant.common.CollectionUtil.MergeWithMain (mapFairMeasures, - org.drip.quant.common.CollectionUtil.PrefixKeys (mapFairMeasures, "Fair")); - - org.drip.analytics.cashflow.ComposableUnitPeriod cupFirst = _lsCouponPeriod.get (0).periods().get - (0); - - try { - mapFairMeasures.put ("CumulativeCouponAmount", _dblNotional * _dblCoupon * - org.drip.analytics.daycount.Convention.YearFraction (_iEffectiveDate, valParams.valueDate(), - cupFirst.couponDC(), _bApplyAccEOMAdj, null, cupFirst.calendar())); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - java.lang.String strName = name(); - - org.drip.param.definition.ProductQuote cq = csqs.productQuote (strName); - - if ((null != pricerParams && null != pricerParams.calibParams()) || null == mapFairMeasures || null - == cq) - return mapFairMeasures; - - double dblCreditBasis = java.lang.Double.NaN; - double dblMarketMeasure = java.lang.Double.NaN; - org.drip.state.credit.CreditCurve ccMarket = null; - - if (cq.containsQuote ("Price")) - mapFairMeasures.put ("MarketInputType=Price", dblMarketMeasure = cq.quote ("Price").value - ("mid")); - else if (cq.containsQuote ("CleanPrice")) - mapFairMeasures.put ("MarketInputType=CleanPrice", dblMarketMeasure = cq.quote - ("CleanPrice").value ("mid")); - else if (cq.containsQuote ("Upfront")) - mapFairMeasures.put ("MarketInputType=Upfront", dblMarketMeasure = cq.quote ("Upfront").value - ("mid")); - else if (cq.containsQuote ("FairPremium")) - mapFairMeasures.put ("MarketInputType=FairPremium", dblMarketMeasure = cq.quote - ("FairPremium").value ("mid")); - else if (cq.containsQuote ("PV")) - mapFairMeasures.put ("MarketInputType=PV", dblMarketMeasure = cq.quote ("PV").value ("mid")); - else if (cq.containsQuote ("CleanPV")) - mapFairMeasures.put ("MarketInputType=CleanPV", dblMarketMeasure = cq.quote ("CleanPV").value - ("mid")); - - try { - SpreadCalibOP scop = new SpreadCalibrator (this, - SpreadCalibrator.CALIBRATION_TYPE_NODE_PARALLEL_BUMP).calibrateHazardFromPrice (valParams, - new org.drip.param.pricer.CreditPricerParams (7, - org.drip.param.definition.CalibrationParams.Standard(), false, - org.drip.param.pricer.CreditPricerParams.PERIOD_DISCRETIZATION_DAY_STEP), csqs, - vcp, dblMarketMeasure); - - if (null != scop) { - ccMarket = scop._ccCalib; - dblCreditBasis = scop._dblCalibResult; - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - if (org.drip.quant.common.NumberUtil.IsValid (dblCreditBasis)) { - mapFairMeasures.put ("MarketCreditBasis", dblCreditBasis); - - org.drip.state.credit.CreditCurve cc = csqs.creditState (creditLabel()); - - try { - ccMarket = (org.drip.state.credit.CreditCurve) cc.customTweakManifestMeasure - ("FairPremium", new org.drip.param.definition.ManifestMeasureTweak - (org.drip.param.definition.ManifestMeasureTweak.FLAT, false, dblCreditBasis)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - } - - org.drip.analytics.support.CaseInsensitiveTreeMap mapMeasures = mapFairMeasures; - - if (null != ccMarket) { - org.drip.param.market.CurveSurfaceQuoteContainer csqsMarket = - org.drip.param.creator.MarketParamsBuilder.Create (csqs.fundingState (fundingLabel()), - csqs.govvieState (org.drip.state.identifier.GovvieLabel.Standard (payCurrency())), - ccMarket, strName, csqs.productQuote (strName), csqs.quoteMap(), csqs.fixings()); - - if (null != csqsMarket) { - org.drip.analytics.support.CaseInsensitiveTreeMap mapMarketMeasures = - measures ("", valParams, pricerParams, csqsMarket, vcp); - - if (null != mapMarketMeasures) { - org.drip.quant.common.CollectionUtil.MergeWithMain (mapMarketMeasures, - org.drip.quant.common.CollectionUtil.PrefixKeys (mapMarketMeasures, "Market")); - - org.drip.quant.common.CollectionUtil.MergeWithMain (mapMeasures, mapMarketMeasures); - } - } - } - - return mapMeasures; - } - - @Override public java.util.Set measureNames() - { - java.util.Set setstrMeasureNames = new java.util.TreeSet(); - - setstrMeasureNames.add ("AccrualDays"); - - setstrMeasureNames.add ("Accrued"); - - setstrMeasureNames.add ("Accrued01"); - - setstrMeasureNames.add ("CleanCouponPV"); - - setstrMeasureNames.add ("CleanDV01"); - - setstrMeasureNames.add ("CleanPV"); - - setstrMeasureNames.add ("DirtyCouponPV"); - - setstrMeasureNames.add ("DirtyDV01"); - - setstrMeasureNames.add ("DirtyPV"); - - setstrMeasureNames.add ("DV01"); - - setstrMeasureNames.add ("ExpLoss"); - - setstrMeasureNames.add ("ExpLossNoRec"); - - setstrMeasureNames.add ("FairAccrualDays"); - - setstrMeasureNames.add ("FairAccrued"); - - setstrMeasureNames.add ("FairAccrued01"); - - setstrMeasureNames.add ("FairCleanDV01"); - - setstrMeasureNames.add ("FairCleanPV"); - - setstrMeasureNames.add ("FairDirtyDV01"); - - setstrMeasureNames.add ("FairDirtyPV"); - - setstrMeasureNames.add ("FairDV01"); - - setstrMeasureNames.add ("FairExpLoss"); - - setstrMeasureNames.add ("FairExpLossNoRec"); - - setstrMeasureNames.add ("FairFairPremium"); - - setstrMeasureNames.add ("FairLossNoRecPV"); - - setstrMeasureNames.add ("FairLossPV"); - - setstrMeasureNames.add ("FairParSpread"); - - setstrMeasureNames.add ("FairPremium"); - - setstrMeasureNames.add ("FairPremiumPV"); - - setstrMeasureNames.add ("FairPV"); - - setstrMeasureNames.add ("FairUpfront"); - - setstrMeasureNames.add ("LossNoRecPV"); - - setstrMeasureNames.add ("LossPV"); - - setstrMeasureNames.add ("MarketAccrualDays"); - - setstrMeasureNames.add ("MarketAccrued"); - - setstrMeasureNames.add ("MarketAccrued01"); - - setstrMeasureNames.add ("MarketCleanDV01"); - - setstrMeasureNames.add ("MarketCleanPV"); - - setstrMeasureNames.add ("MarketDirtyDV01"); - - setstrMeasureNames.add ("MarketDirtyPV"); - - setstrMeasureNames.add ("MarketDV01"); - - setstrMeasureNames.add ("MarketExpLoss"); - - setstrMeasureNames.add ("MarketExpLossNoRec"); - - setstrMeasureNames.add ("MarketFairPremium"); - - setstrMeasureNames.add ("MarketLossNoRecPV"); - - setstrMeasureNames.add ("MarketLossPV"); - - setstrMeasureNames.add ("MarketParSpread"); - - setstrMeasureNames.add ("MarketPremiumPV"); - - setstrMeasureNames.add ("MarketPV"); - - setstrMeasureNames.add ("MarketUpfront"); - - setstrMeasureNames.add ("ParSpread"); - - setstrMeasureNames.add ("PV"); - - setstrMeasureNames.add ("Upfront"); - - return setstrMeasureNames; - } - - @Override public double pv ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParamsIn, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - throws java.lang.Exception - { - if (null == valParams || null == csqc) - throw new java.lang.Exception ("CDSComponent::pv => Invalid Inputs"); - - org.drip.state.credit.CreditCurve cc = csqc.creditState (creditLabel()); - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqc.fundingState (fundingLabel()); - - if (null == cc || null == dcFunding) - throw new java.lang.Exception ("CDSComponent::pv => Invalid Inputs"); - - org.drip.param.pricer.CreditPricerParams pricerParams = null != pricerParamsIn ? pricerParamsIn : - org.drip.param.pricer.CreditPricerParams.Standard(); - - double dblLossPV = 0.; - double dblDirtyDV01 = 0.; - - int iValueDate = valParams.valueDate(); - - for (org.drip.analytics.cashflow.CompositePeriod period : _lsCouponPeriod) { - int iPayDate = period.payDate(); - - if (iPayDate < iValueDate) continue; - - int iEndDate = period.endDate(); - - int iStartDate = period.startDate(); - - int iLossPayLag = _crValParams.lossPayLag(); - - double dblPeriodNotional = notional (iStartDate, iValueDate); - - dblDirtyDV01 += 0.01 * period.couponDCF() * dcFunding.df (iPayDate) * - (pricerParams.survivalToPayDate() ? cc.survival (iPayDate) : cc.survival (iEndDate)) * - dblPeriodNotional; - - for (org.drip.analytics.cashflow.LossQuadratureMetrics lp : period.lossMetrics (this, valParams, - pricerParams, iEndDate, csqc)) { - if (null == lp) continue; - - int iSubPeriodEndDate = lp.endDate(); - - int iSubPeriodStartDate = lp.startDate(); - - double dblSubPeriodDF = dcFunding.effectiveDF (iSubPeriodStartDate + iLossPayLag, - iSubPeriodEndDate + iLossPayLag); - - double dblSubPeriodNotional = notional (iSubPeriodStartDate, iSubPeriodEndDate); - - double dblSubPeriodSurvival = cc.survival (iSubPeriodStartDate) - cc.survival - (iSubPeriodEndDate); - - double dblSubPeriodExpLoss = (1. - (_crValParams.useCurveRecovery() ? cc.effectiveRecovery - (iSubPeriodStartDate, iSubPeriodEndDate) : _crValParams.recovery())) * 100. * - dblSubPeriodSurvival * dblSubPeriodNotional; - - dblLossPV += dblSubPeriodExpLoss * dblSubPeriodDF; - - dblDirtyDV01 += 0.01 * lp.accrualDCF() * dblSubPeriodSurvival * dblSubPeriodDF * - dblSubPeriodNotional; - } - } - - return (dblDirtyDV01 * 10000. * _dblCoupon - dblLossPV) * _dblNotional * 0.01 / dcFunding.df (null == - _settleParams ? valParams.cashPayDate() : _settleParams.cashSettleDate (iValueDate)); - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap - valueFromQuotedSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblFixCoupon, - final double dblQuotedSpread) - { - if (null == valParams || !org.drip.quant.common.NumberUtil.IsValid (dblFixCoupon) || - !org.drip.quant.common.NumberUtil.IsValid (dblQuotedSpread)) - return null; - - org.drip.product.definition.CalibratableComponent[] aComp = new - org.drip.product.definition.CalibratableComponent[] {this}; - org.drip.state.credit.CreditCurve cc = null; - double[] adblRestorableCDSCoupon = new double[1]; - adblRestorableCDSCoupon[0] = _dblCoupon; - _dblCoupon = dblFixCoupon; - - if (null != csqs) { - org.drip.product.definition.CalibratableComponent[] aMktComp = null; - - cc = csqs.creditState (creditLabel()); - - if (null != cc && null != (aMktComp = cc.calibComp())) { - int iNumComp = aMktComp.length; - - if (0 != iNumComp) { - aComp = aMktComp; - adblRestorableCDSCoupon = new double[iNumComp]; - - for (int i = 0; i < iNumComp; ++i) { - if (null != aComp[i] && aComp[i] instanceof - org.drip.product.definition.CreditDefaultSwap) { - try { - org.drip.analytics.output.CompositePeriodCouponMetrics cpcm = couponMetrics - (valParams.valueDate(), valParams, csqs); - - if (null == cpcm) return null; - - adblRestorableCDSCoupon[i] = cpcm.rate(); - - ((org.drip.product.definition.CreditDefaultSwap) aComp[i]).resetCoupon - (dblFixCoupon); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - } - } - } - } - - int iNumCalibComp = aComp.length; - double[] adblQS = new double[iNumCalibComp]; - org.drip.state.credit.CreditCurve ccQS = null; - java.lang.String[] astrCalibMeasure = new java.lang.String[iNumCalibComp]; - - for (int i = 0; i < iNumCalibComp; ++i) { - adblQS[i] = dblQuotedSpread; - astrCalibMeasure[i] = "FairPremium"; - } - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqs.fundingState (fundingLabel()); - - try { - if (null == (ccQS = org.drip.state.creator.ScenarioCreditCurveBuilder.Custom - (creditLabel().fullyQualifiedName(), new org.drip.analytics.date.JulianDate - (valParams.valueDate()), aComp, dcFunding, adblQS, astrCalibMeasure, null != cc ? - cc.recovery (valParams.valueDate()) : 0.4, false))) - return null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.analytics.support.CaseInsensitiveTreeMap mapPV = value (valParams, - pricerParams, org.drip.param.creator.MarketParamsBuilder.Credit (dcFunding, ccQS), vcp); - - for (int i = 0; i < iNumCalibComp; ++i) { - try { - ((org.drip.product.definition.CreditDefaultSwap) aComp[i]).resetCoupon - (adblRestorableCDSCoupon[i]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return mapPV; - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDDirtyPVDManifestMeasure ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == valParams || null == csqs) return null; - - int iValueDate = valParams.valueDate(); - - if (iValueDate >= _iMaturityDate) return null; - - org.drip.state.credit.CreditCurve cc = csqs.creditState (creditLabel()); - - org.drip.state.discount.MergedDiscountForwardCurve dc = csqs.fundingState (fundingLabel()); - - if (null == cc || null == dc) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapMeasures = value (valParams, - pricerParams, csqs, vcp); - - if (null == mapMeasures) return null; - - double dblPV = mapMeasures.get ("PV"); - - double dblFairPremium = mapMeasures.get ("FairPremium"); - - try { - org.drip.quant.calculus.WengertJacobian wjPVDFMicroJack = null; - - for (org.drip.analytics.cashflow.CompositePeriod p : _lsCouponPeriod) { - int iPeriodPayDate = p.payDate(); - - if (iPeriodPayDate < iValueDate) continue; - - org.drip.quant.calculus.WengertJacobian wjPeriodPayDFDF = dc.jackDDFDManifestMeasure - (iPeriodPayDate, "Rate"); - - org.drip.quant.calculus.WengertJacobian wjPeriodOnDefaultPVMicroJack = - calcPeriodOnDefaultPVDFMicroJack (dblFairPremium, p, valParams, pricerParams, csqs); - - if (null == wjPeriodPayDFDF | null == wjPeriodOnDefaultPVMicroJack) continue; - - if (null == wjPVDFMicroJack) - wjPVDFMicroJack = new org.drip.quant.calculus.WengertJacobian (1, - wjPeriodPayDFDF.numParameters()); - - double dblPeriodCashFlow = dblFairPremium * notional (p.startDate(), p.endDate()) * - p.couponDCF() * cc.survival (iPeriodPayDate); - - for (int k = 0; k < wjPeriodPayDFDF.numParameters(); ++k) { - if (!wjPVDFMicroJack.accumulatePartialFirstDerivative (0, k, dblPeriodCashFlow * - wjPeriodPayDFDF.firstDerivative (0, k) + wjPeriodOnDefaultPVMicroJack.firstDerivative - (0, k))) - return null; - } - } - - return adjustForCashSettle (valParams.cashPayDate(), dblPV, dc, wjPVDFMicroJack) ? - wjPVDFMicroJack : null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.quant.calculus.WengertJacobian manifestMeasureDFMicroJack ( - final java.lang.String strManifestMeasure, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == valParams || null == strManifestMeasure || null == csqs) return null; - - int iValueDate = valParams.valueDate(); - - if (iValueDate >= _iMaturityDate) return null; - - org.drip.state.credit.CreditCurve cc = csqs.creditState (creditLabel()); - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqs.fundingState (fundingLabel()); - - if (null == cc || null == dcFunding) return null; - - if ("Rate".equalsIgnoreCase (strManifestMeasure) || "FairPremium".equalsIgnoreCase - (strManifestMeasure) || "ParSpread".equalsIgnoreCase (strManifestMeasure)) { - org.drip.analytics.support.CaseInsensitiveTreeMap mapMeasures = value - (valParams, pricerParams, csqs, vcp); - - if (null == mapMeasures) return null; - - double dblFairPremium = mapMeasures.get ("FairPremium"); - - try { - double dblDV01 = 0.; - org.drip.quant.calculus.WengertJacobian wjFairPremiumDFMicroJack = null; - - for (org.drip.analytics.cashflow.CompositePeriod p : _lsCouponPeriod) { - int iPeriodPayDate = p.payDate(); - - if (iPeriodPayDate < iValueDate) continue; - - int iPeriodEndDate = p.endDate(); - - org.drip.quant.calculus.WengertJacobian wjPeriodPayDFDF = - dcFunding.jackDDFDManifestMeasure (iPeriodEndDate, "Rate"); - - PeriodLossMicroJack plmj = calcPeriodLossMicroJack (p, valParams, pricerParams, csqs); - - if (null == wjPeriodPayDFDF | null == plmj) continue; - - if (null == wjFairPremiumDFMicroJack) - wjFairPremiumDFMicroJack = new org.drip.quant.calculus.WengertJacobian (1, - wjPeriodPayDFDF.numParameters()); - - double dblPeriodCoupon01 = notional (p.startDate(), iPeriodEndDate) * p.couponDCF() * - cc.survival (iPeriodEndDate); - - dblDV01 += dblPeriodCoupon01 * dcFunding.df (iPeriodPayDate) + plmj._dblAccrOnDef01; - - for (int k = 0; k < wjPeriodPayDFDF.numParameters(); ++k) { - double dblPeriodNetLossJack = plmj._wjLossPVMicroJack.firstDerivative (0, k) - - dblFairPremium * (plmj._wjAccrOnDef01MicroJack.firstDerivative (0, k) + - dblPeriodCoupon01 * wjPeriodPayDFDF.firstDerivative (0, k)); - - if (!wjFairPremiumDFMicroJack.accumulatePartialFirstDerivative (0, k, - dblPeriodNetLossJack)) - return null; - } - } - - return wjFairPremiumDFMicroJack.scale (dblDV01) ? wjFairPremiumDFMicroJack : null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - } - - return null; - } - - @Override public org.drip.product.calib.ProductQuoteSet calibQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fundingPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint forwardPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fundingForwardPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fxPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint govviePRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint volatilityPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - /** - * Reset the CDS's coupon - * - * @param dblCoupon The new Coupon - * - * @return The old Coupon - * - * @throws java.lang.Exception Thrown if the coupon cannot be reset - */ - - public double resetCoupon ( - final double dblCoupon) - throws java.lang.Exception - { - double dblOldCoupon = _dblCoupon; - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblCoupon = dblCoupon)) - throw new java.lang.Exception ("CDSComponent::resetCoupon => Bad coupon Input!"); - - return dblOldCoupon; - } - - /** - * Calibrate the CDS's flat spread from the calculated up-front points - * - * @param valParams ValuationParams - * @param pricerParams PricerParams - * @param csqs ComponentMarketParams - * - * @return Calibrated flat spread - * - * @throws java.lang.Exception Thrown if cannot calibrate - */ - - public double calibFlatSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - throws java.lang.Exception - { - SpreadCalibOP scop = new SpreadCalibrator (this, - SpreadCalibrator.CALIBRATION_TYPE_FLAT_CURVE_NODES).calibrateHazardFromPrice (valParams, - pricerParams, csqs, vcp, measureValue (valParams, pricerParams, csqs, vcp, "Upfront")); - - if (null == scop) - throw new java.lang.Exception ("CDSComponent::calibFlatSpread => Cannot calibrate flat spread!"); - - return scop._dblCalibResult; - } - - /** - * CDS spread calibration output - * - * @author Lakshmi Krishnamurthy - */ - - public class SpreadCalibOP { - public double _dblCalibResult = java.lang.Double.NaN; - public org.drip.state.credit.CreditCurve _ccCalib = null; - - public SpreadCalibOP ( - final double dblCalibResult, - final org.drip.state.credit.CreditCurve ccCalib) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblCalibResult = dblCalibResult) || null == - (_ccCalib = ccCalib)) - throw new java.lang.Exception ("CDSComponent::SpreadCalibOP ctr => Invalid inputs!"); - } - } - - /** - * Implementation of the CDS spread calibrator - * - * @author Lakshmi Krishnamurthy - */ - - public class SpreadCalibrator { - private org.drip.product.definition.CreditDefaultSwap _cds = null; - - /* - * Calibration Type - */ - - public static final int CALIBRATION_TYPE_FLAT_INSTRUMENT_NODE = 1; - public static final int CALIBRATION_TYPE_FLAT_CURVE_NODES = 2; - public static final int CALIBRATION_TYPE_NODE_PARALLEL_BUMP = 4; - - private int _iCalibType = CALIBRATION_TYPE_FLAT_CURVE_NODES; - - /** - * Constructor: Construct the SpreadCalibrator from the CDS parent, and whether the calibration is - * off of a single node - * - * @param cds CDS parent - * @param iCalibType Calibration type indicating whether the calibration is PARALLEL, FLAT SINGLE - * NODE, or FLAT TERM - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public SpreadCalibrator ( - final org.drip.product.definition.CreditDefaultSwap cds, - final int iCalibType) - throws java.lang.Exception - { - if (null == (_cds = cds) || (CALIBRATION_TYPE_FLAT_INSTRUMENT_NODE != (_iCalibType = iCalibType) - && CALIBRATION_TYPE_FLAT_CURVE_NODES != iCalibType && CALIBRATION_TYPE_NODE_PARALLEL_BUMP != - iCalibType)) - throw new java.lang.Exception ("CDSComponent::SpreadCalibrator ctr => Invalid inputs!"); - } - - /** - * Calibrate the hazard rate from calibration price - * - * @param valParams ValuationParams - * @param pricerParams PricerParams - * @param csqs ComponentMarketParams - * @param vcp Valuation Customization Parameters - * @param dblPriceCalib Market price to be calibrated - * - * @return Calibrated hazard - */ - - public SpreadCalibOP calibrateHazardFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPriceCalib) - { - if (null == valParams || null == pricerParams || null == csqs || - !org.drip.quant.common.NumberUtil.IsValid (dblPriceCalib)) - return null; - - final org.drip.state.credit.CreditCurve ccOld = csqs.creditState (creditLabel()); - - org.drip.function.definition.R1ToR1 ofCDSPriceFromFlatSpread = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblFlatSpread) - throws java.lang.Exception - { - if (CALIBRATION_TYPE_NODE_PARALLEL_BUMP != _iCalibType) - csqs.setCreditState (ccOld.flatCurve (dblFlatSpread, - CALIBRATION_TYPE_FLAT_CURVE_NODES == _iCalibType, java.lang.Double.NaN)); - else - csqs.setCreditState ((org.drip.state.credit.CreditCurve) - ccOld.customTweakManifestMeasure ("FairPremium", new - org.drip.param.definition.ManifestMeasureTweak - (org.drip.param.definition.ManifestMeasureTweak.FLAT, false, - dblFlatSpread))); - - return _cds.measureValue (valParams, pricerParams, csqs, vcp, "Upfront") - dblPriceCalib; - } - }; - - try { - org.drip.function.r1tor1solver.FixedPointFinderOutput rfop = new - org.drip.function.r1tor1solver.FixedPointFinderBrent (0., ofCDSPriceFromFlatSpread, - true).findRoot(); - - if (null == rfop || !rfop.containsRoot() && !csqs.setCreditState (ccOld)) - return new SpreadCalibOP (rfop.getRoot(), ccOld); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - } - - class PeriodLossMicroJack { - double _dblAccrOnDef01 = 0.; - org.drip.quant.calculus.WengertJacobian _wjLossPVMicroJack = null; - org.drip.quant.calculus.WengertJacobian _wjAccrOnDef01MicroJack = null; - - PeriodLossMicroJack ( - final int iNumParameters) - throws java.lang.Exception - { - _wjLossPVMicroJack = new org.drip.quant.calculus.WengertJacobian (1, iNumParameters); - - _wjAccrOnDef01MicroJack = new org.drip.quant.calculus.WengertJacobian (1, iNumParameters); - } - } -} diff --git a/org/drip/product/definition/BasketMarketParamRef.java b/org/drip/product/definition/BasketMarketParamRef.java deleted file mode 100644 index f88b9c9..0000000 --- a/org/drip/product/definition/BasketMarketParamRef.java +++ /dev/null @@ -1,127 +0,0 @@ - -package org.drip.product.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * BasketMarketParamRef interface provides stubs for basket name, IR curve, forward curve, credit curve, TSY - * curve, and needed to value the component. - * - * @author Lakshmi Krishnamurthy - */ - -public interface BasketMarketParamRef { - - /** - * Get the component name - * - * @return The component name - */ - - public abstract java.lang.String name(); - - /** - * Get the Coupon Currency - * - * @return The Coupon Currency - */ - - public abstract java.lang.String[] couponCurrency(); - - /** - * Get the Pay Currency - * - * @return The Pay Currency - */ - - public abstract java.lang.String[] payCurrency(); - - /** - * Get the Principal Currency - * - * @return The Principal Currency - */ - - public abstract java.lang.String[] principalCurrency(); - - /** - * Get the Array of Credit Curve Latent State Identifier Labels - * - * @return The Array of Credit Curve Latent State Identifier Labels - */ - - public abstract org.drip.state.identifier.CreditLabel[] creditLabel(); - - /** - * Get the Array of Forward Curve Latent State Labels - * - * @return Array of the Forward Curve Latent State Labels - */ - - public abstract org.drip.state.identifier.ForwardLabel[] forwardLabel(); - - /** - * Get the Array of Funding Curve Latent State Labels - * - * @return Array of the Funding Curve Latent State Labels - */ - - public abstract org.drip.state.identifier.FundingLabel[] fundingLabel(); - - /** - * Get the Array of the FX Latent State Identifier Labels - * - * @return The Array of the FX Latent State Identifier Labels - */ - - public abstract org.drip.state.identifier.FXLabel[] fxLabel(); -} diff --git a/org/drip/product/definition/BasketProduct.java b/org/drip/product/definition/BasketProduct.java deleted file mode 100644 index 79cc08e..0000000 --- a/org/drip/product/definition/BasketProduct.java +++ /dev/null @@ -1,1156 +0,0 @@ - -package org.drip.product.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * BasketProduct abstract class extends MarketParamRef. It provides methods for getting the basket’s - * components, notional, coupon, effective date, maturity date, coupon amount, and list of coupon periods. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class BasketProduct implements org.drip.product.definition.BasketMarketParamRef { - protected static final int MEASURE_AGGREGATION_TYPE_CUMULATIVE = 1; - protected static final int MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE = 2; - protected static final int MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE = 4; - protected static final int MEASURE_AGGREGATION_TYPE_IGNORE = 4; - - class ComponentCurve { - java.lang.String _strName = null; - org.drip.state.credit.CreditCurve _cc = null; - - ComponentCurve ( - final java.lang.String strName, - final org.drip.state.credit.CreditCurve cc) - { - _cc = cc; - _strName = strName; - } - } - - class FlatDeltaGammaMeasureMap { - org.drip.analytics.support.CaseInsensitiveTreeMap _mapDelta = null; - org.drip.analytics.support.CaseInsensitiveTreeMap _mapGamma = null; - - FlatDeltaGammaMeasureMap ( - final org.drip.analytics.support.CaseInsensitiveTreeMap mapDelta, - final org.drip.analytics.support.CaseInsensitiveTreeMap mapGamma) - { - _mapDelta = mapDelta; - _mapGamma = mapGamma; - } - } - - class TenorDeltaGammaMeasureMap { - org.drip.analytics.support.CaseInsensitiveTreeMap> - _mmDelta = null; - org.drip.analytics.support.CaseInsensitiveTreeMap> - _mmGamma = null; - - TenorDeltaGammaMeasureMap ( - final - org.drip.analytics.support.CaseInsensitiveTreeMap> - mmDelta, - final - org.drip.analytics.support.CaseInsensitiveTreeMap> - mmGamma) - { - _mmDelta = mmDelta; - _mmGamma = mmGamma; - } - } - - class ComponentFactorTenorDeltaGammaMeasureMap { - org.drip.analytics.support.CaseInsensitiveTreeMap>> - _mmmDelta = null; - org.drip.analytics.support.CaseInsensitiveTreeMap>> - _mmmGamma = null; - - ComponentFactorTenorDeltaGammaMeasureMap ( - final - org.drip.analytics.support.CaseInsensitiveTreeMap>> - mmmDelta, - final - org.drip.analytics.support.CaseInsensitiveTreeMap>> - mmmGamma) - { - _mmmDelta = mmmDelta; - _mmmGamma = mmmGamma; - } - } - - private FlatDeltaGammaMeasureMap accumulateDeltaGammaMeasures ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqsUp, - final org.drip.param.market.CurveSurfaceQuoteContainer csqsDown, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.analytics.support.CaseInsensitiveTreeMap mapBaseMeasures) - { - if (null == csqsUp) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapUpMeasures = value (valParams, - pricerParams, csqsUp, vcp); - - if (null == mapUpMeasures || 0 == mapUpMeasures.size()) return null; - - java.util.Set> mapUpMeasuresES = - mapUpMeasures.entrySet(); - - if (null == mapUpMeasuresES) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapDeltaMeasures = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry meUp : mapUpMeasuresES) { - if (null == meUp) continue; - - java.lang.String strKey = meUp.getKey(); - - if (null == strKey || strKey.isEmpty()) continue; - - java.lang.Double dblBase = mapBaseMeasures.get (strKey); - - java.lang.Double dblUp = meUp.getValue(); - - mapDeltaMeasures.put (strKey, (null == dblUp ? 0. : dblUp) - (null == dblBase ? 0. : dblBase)); - } - - if (null == csqsDown) return new FlatDeltaGammaMeasureMap (mapDeltaMeasures, null); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapDownMeasures = value - (valParams, pricerParams, csqsDown, vcp); - - if (null == mapDownMeasures || 0 == mapDownMeasures.size()) - return new FlatDeltaGammaMeasureMap (mapDeltaMeasures, null); - - java.util.Set> mapDownMeasuresES = - mapDownMeasures.entrySet(); - - if (null == mapDownMeasuresES) return new FlatDeltaGammaMeasureMap (mapDeltaMeasures, null); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapGammaMeasures = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry meDown : mapDownMeasuresES) { - if (null == meDown) continue; - - java.lang.String strKey = meDown.getKey(); - - if (null == strKey || strKey.isEmpty()) continue; - - java.lang.Double dblBase = mapBaseMeasures.get (strKey); - - java.lang.Double dblUp = mapUpMeasures.get (strKey); - - java.lang.Double dblDown = meDown.getValue(); - - mapGammaMeasures.put (strKey, (null == dblUp ? 0. : dblUp) + (null == dblDown ? 0. : dblDown) - - (null == dblBase ? 0. : 2. * dblBase)); - } - - return new FlatDeltaGammaMeasureMap (mapDeltaMeasures, mapGammaMeasures); - } - - private TenorDeltaGammaMeasureMap accumulateTenorDeltaGammaMeasures ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.analytics.support.CaseInsensitiveTreeMap - mapTenorUpCSQS, - final org.drip.analytics.support.CaseInsensitiveTreeMap - mapTenorDownCSQS, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.analytics.support.CaseInsensitiveTreeMap mapBaseMeasures, - final ComponentCurve compCurve) - { - if (null == mapTenorUpCSQS || 0 == mapTenorUpCSQS.size()) return null; - - java.util.Set> - mapESTenorUpCSQS = mapTenorUpCSQS.entrySet(); - - if (null == mapESTenorUpCSQS || 0 == mapESTenorUpCSQS.size()) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapTenorDGMM = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry meTenorUpCSQS - : mapESTenorUpCSQS) { - if (null == meTenorUpCSQS) continue; - - java.lang.String strTenorKey = meTenorUpCSQS.getKey(); - - if (null == strTenorKey || strTenorKey.isEmpty()) continue; - - org.drip.param.market.CurveSurfaceQuoteContainer csqsTenorUp = meTenorUpCSQS.getValue(); - - org.drip.param.market.CurveSurfaceQuoteContainer csqsTenorDown = mapTenorDownCSQS.get (strTenorKey); - - org.drip.state.credit.CreditCurve ccVirginUp = null; - org.drip.state.credit.CreditCurve ccVirginDown = null; - - if (null != csqsTenorUp && null != compCurve && null != compCurve._cc && null != - compCurve._strName && !compCurve._strName.isEmpty()) { - ccVirginUp = csqsTenorUp.creditState (org.drip.state.identifier.CreditLabel.Standard - (compCurve._strName)); - - csqsTenorUp.setCreditState (compCurve._cc); - - if (null != csqsTenorDown) { - ccVirginDown = csqsTenorDown.creditState (org.drip.state.identifier.CreditLabel.Standard - (compCurve._strName)); - - csqsTenorDown.setCreditState (compCurve._cc); - } - } - - mapTenorDGMM.put (strTenorKey, accumulateDeltaGammaMeasures (valParams, pricerParams, - csqsTenorUp, csqsTenorDown, vcp, mapBaseMeasures)); - - if (null != csqsTenorUp && null != compCurve && null != compCurve._strName && - !compCurve._strName.isEmpty() && null != ccVirginUp) - csqsTenorUp.setCreditState (ccVirginUp); - - if (null != csqsTenorDown && null != compCurve && null != compCurve._strName && - !compCurve._strName.isEmpty() && null != ccVirginDown) - csqsTenorDown.setCreditState (ccVirginDown); - } - - if (0 == mapTenorDGMM.size()) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap> - mmDelta = new - org.drip.analytics.support.CaseInsensitiveTreeMap>(); - - org.drip.analytics.support.CaseInsensitiveTreeMap> - mmGamma = new - org.drip.analytics.support.CaseInsensitiveTreeMap>(); - - for (java.util.Map.Entry meTenorDGMM : - mapTenorDGMM.entrySet()) { - if (null == meTenorDGMM) continue; - - FlatDeltaGammaMeasureMap dgmmTenorDelta = meTenorDGMM.getValue(); - - if (null != dgmmTenorDelta) { - java.lang.String strKey = meTenorDGMM.getKey(); - - mmDelta.put (strKey, dgmmTenorDelta._mapDelta); - - mmGamma.put (strKey, dgmmTenorDelta._mapGamma); - } - } - - return new TenorDeltaGammaMeasureMap (mmDelta, mmGamma); - } - - private ComponentFactorTenorDeltaGammaMeasureMap accumulateComponentWiseTenorDeltaGammaMeasures ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.analytics.support.CaseInsensitiveTreeMap - mapCSQS, - final org.drip.analytics.support.CaseInsensitiveTreeMap - mapTenorUpCSQS, - final org.drip.analytics.support.CaseInsensitiveTreeMap - mapTenorDownCSQS, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.analytics.support.CaseInsensitiveTreeMap mapBaseMeasures) - { - if (null == mapCSQS || 0 == mapCSQS.size()) return null; - - java.util.Set> - mapESCSQS = mapCSQS.entrySet(); - - if (null == mapESCSQS || 0 == mapESCSQS.size()) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapComponentTenorDGMM = - new org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry meCSQS : - mapESCSQS) { - if (null == meCSQS) continue; - - java.lang.String strComponentName = meCSQS.getKey(); - - if (null == strComponentName || strComponentName.isEmpty()) continue; - - org.drip.param.market.CurveSurfaceQuoteContainer csqs = meCSQS.getValue(); - - if (null != csqs) - mapComponentTenorDGMM.put (strComponentName, accumulateTenorDeltaGammaMeasures (valParams, - pricerParams, mapTenorUpCSQS, mapTenorDownCSQS, vcp, mapBaseMeasures, new ComponentCurve - (strComponentName, csqs.creditState (org.drip.state.identifier.CreditLabel.Standard - (strComponentName))))); - } - - if (0 == mapComponentTenorDGMM.size()) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap>> - mmmCompRatesDelta = new - org.drip.analytics.support.CaseInsensitiveTreeMap>>(); - - org.drip.analytics.support.CaseInsensitiveTreeMap>> - mmmCompRatesGamma = new - org.drip.analytics.support.CaseInsensitiveTreeMap>>(); - - for (java.util.Map.Entry meCompTenorDGMM : - mapComponentTenorDGMM.entrySet()) { - if (null == meCompTenorDGMM) continue; - - TenorDeltaGammaMeasureMap dgmmCompTenorDeltaGamma = meCompTenorDGMM.getValue(); - - if (null != dgmmCompTenorDeltaGamma) { - java.lang.String strKey = meCompTenorDGMM.getKey(); - - mmmCompRatesDelta.put (strKey, dgmmCompTenorDeltaGamma._mmDelta); - - mmmCompRatesGamma.put (strKey, dgmmCompTenorDeltaGamma._mmGamma); - } - } - - return new ComponentFactorTenorDeltaGammaMeasureMap (mmmCompRatesDelta, mmmCompRatesGamma); - } - - protected double measureValue ( - final java.lang.String strMeasure, - final org.drip.analytics.support.CaseInsensitiveTreeMap mapCalc) - throws java.lang.Exception - { - if (null == strMeasure || strMeasure.isEmpty() || null == mapCalc || null == mapCalc.entrySet()) - throw new java.lang.Exception ("BasketProduct::measureValue => Invalid Params"); - - for (java.util.Map.Entry me : mapCalc.entrySet()) { - if (null != me && null != me.getKey() && me.getKey().equalsIgnoreCase (strMeasure)) - return me.getValue(); - } - - throw new java.lang.Exception ("BasketProduct::getMeasure => " + strMeasure + - " is an invalid measure!"); - } - - /** - * Return the basket name - * - * @return Name of the basket product - */ - - public abstract java.lang.String name(); - - /** - * Return the Components in the Basket - * - * @return Components in the Basket - */ - - public abstract org.drip.product.definition.Component[] components(); - - /** - * Retrieve the Aggregation Type for the specified Measure - * - * @param strMeasureName The Specified Measure Name - * - * @return The Aggregation Type - */ - - public abstract int measureAggregationType ( - final java.lang.String strMeasureName); - - /** - * Retrieve the component Weights - * - * @return Array Containing the Component Weights - */ - - public double[] weights() - { - org.drip.product.definition.Component[] aComp = components(); - - double dblTotalWeight = 0.; - int iNumComp = aComp.length; - double[] adblWeight = new double[iNumComp]; - - for (int i = 0; i < iNumComp; ++i) { - try { - dblTotalWeight += (adblWeight[i] = aComp[i].initialNotional()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - if (0. == dblTotalWeight) return null; - - for (int i = 0; i < iNumComp; ++i) - adblWeight[i] /= dblTotalWeight; - - return adblWeight; - } - - @Override public java.lang.String[] couponCurrency() - { - org.drip.product.definition.Component[] aComp = components(); - - if (null == aComp) return null; - - int iNumComp = aComp.length; - - if (0 == iNumComp) return null; - - java.util.Set setCouponCurrency = new java.util.HashSet(); - - for (int i = 0; i < iNumComp; ++i) { - if (null == aComp[i]) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapComponentCouponCurrency = - aComp[i].couponCurrency(); - - if (null != mapComponentCouponCurrency && 0 != mapComponentCouponCurrency.size()) { - for (java.util.Map.Entry meCouponCurrency : - mapComponentCouponCurrency.entrySet()) - setCouponCurrency.add (meCouponCurrency.getValue()); - } - } - - int iNumCouponCurrency = setCouponCurrency.size(); - - if (0 == iNumCouponCurrency) return null; - - int i = 0; - java.lang.String[] astrCouponCurrency = new java.lang.String[iNumCouponCurrency]; - - for (java.lang.String strCouponCurrency : astrCouponCurrency) - astrCouponCurrency[i++] = strCouponCurrency; - - return astrCouponCurrency; - } - - @Override public java.lang.String[] payCurrency() - { - org.drip.product.definition.Component[] aComp = components(); - - if (null == aComp) return null; - - int iNumComp = aComp.length; - - if (0 == iNumComp) return null; - - java.util.Set setPayCurrency = new java.util.HashSet(); - - for (int i = 0; i < iNumComp; ++i) { - if (null == aComp[i]) return null; - - setPayCurrency.add (aComp[i].payCurrency()); - } - - int iNumPayCurrency = setPayCurrency.size(); - - if (0 == iNumPayCurrency) return null; - - int i = 0; - java.lang.String[] astrPayCurrency = new java.lang.String[iNumPayCurrency]; - - for (java.lang.String strPayCurrency : astrPayCurrency) - astrPayCurrency[i++] = strPayCurrency; - - return astrPayCurrency; - } - - @Override public java.lang.String[] principalCurrency() - { - org.drip.product.definition.Component[] aComp = components(); - - if (null == aComp) return null; - - int iNumComp = aComp.length; - - if (0 == iNumComp) return null; - - java.util.Set setPrincipalCurrency = new java.util.HashSet(); - - for (int i = 0; i < iNumComp; ++i) { - if (null == aComp[i]) return null; - - setPrincipalCurrency.add (aComp[i].principalCurrency()); - } - - int iNumPrincipalCurrency = setPrincipalCurrency.size(); - - if (0 == iNumPrincipalCurrency) return null; - - int i = 0; - java.lang.String[] astrPrincipalCurrency = new java.lang.String[iNumPrincipalCurrency]; - - for (java.lang.String strPrincipalCurrency : astrPrincipalCurrency) - astrPrincipalCurrency[i++] = strPrincipalCurrency; - - return astrPrincipalCurrency; - } - - @Override public org.drip.state.identifier.CreditLabel[] creditLabel() - { - org.drip.product.definition.Component[] aComp = components(); - - if (null == aComp) return null; - - int iNumComp = aComp.length; - - if (0 == iNumComp) return null; - - java.util.Set sLSLCredit = new - java.util.HashSet(); - - for (int i = 0; i < iNumComp; ++i) { - if (null == aComp[i]) return null; - - org.drip.state.identifier.CreditLabel lslCredit = aComp[i].creditLabel(); - - if (null != lslCredit) sLSLCredit.add (lslCredit); - } - - int iNumCreditCurve = sLSLCredit.size(); - - if (0 == iNumCreditCurve) return null; - - int i = 0; - org.drip.state.identifier.CreditLabel[] aLSLCredit = new - org.drip.state.identifier.CreditLabel[iNumCreditCurve]; - - for (org.drip.state.identifier.CreditLabel lslCredit : sLSLCredit) - aLSLCredit[i++] = lslCredit; - - return aLSLCredit; - } - - @Override public org.drip.state.identifier.ForwardLabel[] forwardLabel() - { - org.drip.product.definition.Component[] aComp = components(); - - if (null == aComp) return null; - - int iNumComp = aComp.length; - - if (0 == iNumComp) return null; - - java.util.Set setLSLForward = new - java.util.HashSet(); - - for (int i = 0; i < iNumComp; ++i) { - if (null == aComp[i]) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap - aLSLForward = aComp[i].forwardLabel(); - - if (null == aLSLForward) continue; - - int iNumForwardCurve = aLSLForward.size(); - - if (0 == iNumForwardCurve) continue; - - for (int j = 0; j < iNumForwardCurve; ++j) { - org.drip.state.identifier.ForwardLabel lslForward = aLSLForward.get (j); - - if (null != lslForward) setLSLForward.add (lslForward); - } - } - - int iNumForward = setLSLForward.size(); - - if (0 == iNumForward) return null; - - int i = 0; - org.drip.state.identifier.ForwardLabel[] aLSLForward = new - org.drip.state.identifier.ForwardLabel[iNumForward]; - - for (org.drip.state.identifier.ForwardLabel lslForward : setLSLForward) - aLSLForward[i++] = lslForward; - - return aLSLForward; - } - - @Override public org.drip.state.identifier.FundingLabel[] fundingLabel() - { - org.drip.product.definition.Component[] aComp = components(); - - if (null == aComp) return null; - - int iNumComp = aComp.length; - - if (0 == iNumComp) return null; - - java.util.Set sLSLFunding = new - java.util.HashSet(); - - for (int i = 0; i < iNumComp; ++i) { - if (null == aComp[i]) return null; - - org.drip.state.identifier.FundingLabel lslFunding = aComp[i].fundingLabel(); - - if (null == lslFunding) continue; - - sLSLFunding.add (lslFunding); - } - - int iNumFundingCurve = sLSLFunding.size(); - - if (0 == iNumFundingCurve) return null; - - int i = 0; - org.drip.state.identifier.FundingLabel[] aLSLFunding = new - org.drip.state.identifier.FundingLabel[iNumFundingCurve]; - - for (org.drip.state.identifier.FundingLabel lslFunding : sLSLFunding) - aLSLFunding[i++] = lslFunding; - - return aLSLFunding; - } - - @Override public org.drip.state.identifier.FXLabel[] fxLabel() - { - org.drip.product.definition.Component[] aComp = components(); - - if (null == aComp) return null; - - int iNumComp = aComp.length; - - if (0 == iNumComp) return null; - - java.util.Set setLabel = new - java.util.HashSet(); - - for (int i = 0; i < iNumComp; ++i) { - if (null == aComp[i]) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap aLabel = - aComp[i].fxLabel(); - - if (null == aLabel) continue; - - int iNumLabel = aLabel.size(); - - if (0 == iNumLabel) continue; - - for (int j = 0; j < iNumLabel; ++j) { - org.drip.state.identifier.FXLabel label = aLabel.get (j); - - if (null != label) setLabel.add (label); - } - } - - int iNumLabel = setLabel.size(); - - if (0 == iNumLabel) return null; - - int i = 0; - org.drip.state.identifier.FXLabel[] aLabel = new org.drip.state.identifier.FXLabel[iNumLabel]; - - for (org.drip.state.identifier.FXLabel label : setLabel) - aLabel[i++] = label; - - return aLabel; - } - - /** - * Return the initial notional of the basket product - * - * @return Initial notional of the basket product - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public double initialNotional() - throws java.lang.Exception - { - org.drip.product.definition.Component[] aComp = components(); - - int iNumComp = aComp.length; - double dblInitialNotional = 0.; - - for (int i = 0; i < iNumComp; ++i) - dblInitialNotional += aComp[i].initialNotional(); - - return dblInitialNotional; - } - - /** - * Retrieve the notional at the given date - * - * @param iDate JulianDate - * - * @return Notional - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public double notional ( - final int iDate) - throws java.lang.Exception - { - org.drip.product.definition.Component[] aComp = components(); - - double dblNotional = 0.; - int iNumComp = aComp.length; - - for (int i = 0; i < iNumComp; ++i) - dblNotional += aComp[i].notional (iDate); - - return dblNotional; - } - - /** - * Retrieve the time-weighted notional between 2 given dates - * - * @param iDate1 JulianDate first - * @param iDate2 JulianDate second - * - * @return Notional - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public double notional ( - final int iDate1, - final int iDate2) - throws java.lang.Exception - { - org.drip.product.definition.Component[] aComp = components(); - - double dblNotional = 0.; - int iNumComp = aComp.length; - - for (int i = 0; i < iNumComp; ++i) - dblNotional += aComp[i].notional (iDate1, iDate2); - - return dblNotional; - } - - /** - * Retrieve the basket product's coupon amount at the given date - * - * @param iDate JulianDate - * @param csqs Market Parameters - * - * @return Coupon Amount - * - * @throws java.lang.Exception Thrown if coupon cannot be calculated - */ - - public double coupon ( - final int iDate, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - throws java.lang.Exception - { - double dblNotional = notional (iDate); - - if (null == csqs || 0. == dblNotional || !org.drip.quant.common.NumberUtil.IsValid (dblNotional)) - throw new java.lang.Exception ("BasketProduct::coupon => Cannot extract basket notional"); - - org.drip.product.definition.Component[] aComp = components(); - - double dblCoupon = 0.; - int iNumComp = aComp.length; - - for (int i = 0; i < iNumComp; ++i) - dblCoupon += aComp[i].couponMetrics (iDate, null, csqs).rate(); - - return dblCoupon / dblNotional; - } - - /** - * Returns the effective date of the basket product - * - * @return Effective date of the basket product - */ - - public org.drip.analytics.date.JulianDate effective() - { - org.drip.product.definition.Component[] aComp = components(); - - int iNumComp = aComp.length; - - org.drip.analytics.date.JulianDate dtEffective = aComp[0].effectiveDate(); - - for (int i = 1; i < iNumComp; ++i) { - org.drip.analytics.date.JulianDate dtCompEffective = aComp[i].effectiveDate(); - - if (dtCompEffective.julian() < dtEffective.julian()) dtEffective = dtCompEffective; - } - - return dtEffective; - } - - /** - * Return the maturity date of the basket product - * - * @return Maturity date of the basket product - */ - - public org.drip.analytics.date.JulianDate maturity() - { - org.drip.product.definition.Component[] aComp = components(); - - int iNumComp = aComp.length; - - org.drip.analytics.date.JulianDate dtMaturity = aComp[0].maturityDate(); - - for (int i = 1; i < iNumComp; ++i) { - org.drip.analytics.date.JulianDate dtCompMaturity = aComp[i].maturityDate(); - - if (dtCompMaturity.julian() < dtMaturity.julian()) dtMaturity = dtCompMaturity; - } - - return dtMaturity; - } - - /** - * Get the basket product's coupon periods - * - * @return List of CouponPeriods - */ - - public java.util.List couponPeriod() - { - java.util.Set setPeriod = - org.drip.analytics.support.Helper.AggregateComponentPeriods (components()); - - if (null == setPeriod || 0 == setPeriod.size()) return null; - - java.util.List lsCouponPeriod = new - java.util.ArrayList(); - - for (org.drip.analytics.cashflow.CompositePeriod p : setPeriod) { - if (null != p) lsCouponPeriod.add (p); - } - - return lsCouponPeriod; - } - - /** - * Get the first coupon date - * - * @return First Coupon Date - */ - - public org.drip.analytics.date.JulianDate firstCouponDate() - { - org.drip.product.definition.Component[] aComp = components(); - - int iNumComp = aComp.length; - - org.drip.analytics.date.JulianDate dtFirstCoupon = aComp[0].firstCouponDate(); - - for (int i = 1; i < iNumComp; ++i) { - if (dtFirstCoupon.julian() > aComp[i].firstCouponDate().julian()) - dtFirstCoupon = aComp[i].firstCouponDate(); - } - - return dtFirstCoupon; - } - - /** - * Generate a full list of the basket product measures for the full input set of market parameters - * - * @param valParams ValuationParams - * @param pricerParams PricerParams - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * - * @return Map of measure name and value - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap value ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - long lStart = System.nanoTime(); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapBasketOP = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - org.drip.product.definition.Component[] aComp = components(); - - double[] adblWeight = weights(); - - int iNumComp = aComp.length; - - for (int i = 0; i < iNumComp; ++i) { - org.drip.analytics.support.CaseInsensitiveTreeMap mapCompOP = aComp[i].value - (valParams, pricerParams, csqs, vcp); - - if (null == mapCompOP || 0 == mapCompOP.size()) continue; - - java.util.Set> mapCompOPES = - mapCompOP.entrySet(); - - if (null == mapCompOPES) continue; - - for (java.util.Map.Entry meCompOP : mapCompOPES) { - if (null == meCompOP) continue; - - java.lang.String strKey = meCompOP.getKey(); - - if (null == strKey || strKey.isEmpty()) continue; - - java.lang.Double dblCompValue = mapCompOP.get (strKey); - - java.lang.Double dblBasketValue = mapBasketOP.get (strKey); - - if (MEASURE_AGGREGATION_TYPE_CUMULATIVE == measureAggregationType (strKey)) - mapBasketOP.put (strKey, (null == dblCompValue ? 0. : dblCompValue) + (null == - dblBasketValue ? 0. : dblBasketValue)); - else if (MEASURE_AGGREGATION_TYPE_WEIGHTED_CUMULATIVE == measureAggregationType (strKey) && - null != adblWeight) - mapBasketOP.put (strKey, (null == dblCompValue ? 0. : adblWeight[i] * dblCompValue) + - (null == dblBasketValue ? 0. : dblBasketValue)); - else if (MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE == measureAggregationType (strKey)) - mapBasketOP.put (aComp[i].name() + "[" + strKey + "]", (null == dblCompValue ? 0. : - dblCompValue)); - } - } - - mapBasketOP.put ("CalcTime", (System.nanoTime() - lStart) * 1.e-09); - - return mapBasketOP; - } - - /** - * Calculate the value of the given basket product measure - * - * @param valParams ValuationParams - * @param pricerParams PricerParams - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param strMeasure Measure String - * - * @return Double measure value - * - * @throws java.lang.Exception Thrown if the measure cannot be calculated - */ - - public double measureValue ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final java.lang.String strMeasure) - throws java.lang.Exception - { - return measureValue (strMeasure, value (valParams, pricerParams, csqs, vcp)); - } - - /** - * Generate a full list of the basket product measures for the set of scenario market parameters present - * in the org.drip.param.definition.MarketParams - * - * @param valParams ValuationParams - * @param pricerParams PricerParams - * @param mpc org.drip.param.definition.MarketParams - * @param vcp Valuation Customization Parameters - * - * @return BasketOutput object - */ - - public org.drip.analytics.output.BasketMeasures measures ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.definition.ScenarioMarketParams mpc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == valParams || null == mpc) return null; - - long lStart = System.nanoTime(); - - org.drip.analytics.output.BasketMeasures bkop = new org.drip.analytics.output.BasketMeasures(); - - if (!bkop.setBaseMeasures (value (valParams, pricerParams, mpc.scenarioMarketParams (this, "Base"), - vcp))) - return null; - - FlatDeltaGammaMeasureMap dgmmCredit = accumulateDeltaGammaMeasures (valParams, pricerParams, - mpc.scenarioMarketParams (this, "FlatCreditBumpUp"), mpc.scenarioMarketParams (this, "FlatCreditBumpDn"), - vcp, bkop.baseMeasures()); - - if (null != dgmmCredit && !bkop.setFlatCreditDeltaMeasures (dgmmCredit._mapDelta)) - bkop.setFlatCreditGammaMeasures (dgmmCredit._mapGamma); - - FlatDeltaGammaMeasureMap dgmmRates = accumulateDeltaGammaMeasures (valParams, pricerParams, - mpc.scenarioMarketParams (this, "FlatIRBumpUp"), mpc.scenarioMarketParams (this, "FlatIRBumpDn"), vcp, - bkop.baseMeasures()); - - if (null != dgmmRates && bkop.setFlatIRDeltaMeasures (dgmmRates._mapDelta)) - bkop.setFlatIRGammaMeasures (dgmmRates._mapGamma); - - FlatDeltaGammaMeasureMap dgmmRecovery = accumulateDeltaGammaMeasures (valParams, pricerParams, - mpc.scenarioMarketParams (this, "FlatRRBumpUp"), mpc.scenarioMarketParams (this, "FlatRRBumpDn"), vcp, - bkop.baseMeasures()); - - if (null != dgmmRecovery && bkop.setFlatRRDeltaMeasures (dgmmRates._mapDelta)) - bkop.setFlatRRGammaMeasures (dgmmRates._mapGamma); - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapCSQSIRTenorUp = mpc.fundingFlatBump (this, true); - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapCSQSIRTenorDown = mpc.fundingFlatBump (this, false); - - TenorDeltaGammaMeasureMap mapDGMMRatesTenor = accumulateTenorDeltaGammaMeasures (valParams, - pricerParams, mapCSQSIRTenorUp, mapCSQSIRTenorDown, vcp, bkop.baseMeasures(), null); - - if (null != mapDGMMRatesTenor) { - bkop.setComponentIRDeltaMeasures (mapDGMMRatesTenor._mmDelta); - - bkop.setComponentIRGammaMeasures (mapDGMMRatesTenor._mmGamma); - } - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapCSQSCreditTenorUp = mpc.creditFlatBump (this, true); - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapCSQSCreditTenorDown = mpc.creditFlatBump (this, false); - - TenorDeltaGammaMeasureMap mapDGMMCreditComp = accumulateTenorDeltaGammaMeasures (valParams, - pricerParams, mapCSQSCreditTenorUp, mapCSQSCreditTenorDown, vcp, bkop.baseMeasures(), null); - - if (null != mapDGMMCreditComp) { - bkop.setComponentCreditDeltaMeasures (mapDGMMCreditComp._mmDelta); - - bkop.setComponentCreditGammaMeasures (mapDGMMCreditComp._mmGamma); - } - - TenorDeltaGammaMeasureMap mapDGMMRecoveryTenor = accumulateTenorDeltaGammaMeasures (valParams, - pricerParams, mpc.recoveryFlatBump (this, true), mpc.recoveryFlatBump (this, false), vcp, - bkop.baseMeasures(), null); - - if (null != mapDGMMRecoveryTenor) { - bkop.setComponentRRDeltaMeasures (mapDGMMRecoveryTenor._mmDelta); - - bkop.setComponentRRGammaMeasures (mapDGMMRecoveryTenor._mmGamma); - } - - ComponentFactorTenorDeltaGammaMeasureMap mapCompRatesTenorDGMM = - accumulateComponentWiseTenorDeltaGammaMeasures (valParams, pricerParams, mapCSQSCreditTenorUp, - mapCSQSIRTenorUp, mapCSQSIRTenorDown, vcp, bkop.baseMeasures()); - - if (null != mapCompRatesTenorDGMM) { - bkop.setComponentTenorIRDeltaMeasures (mapCompRatesTenorDGMM._mmmDelta); - - bkop.setComponentTenorIRGammaMeasures (mapCompRatesTenorDGMM._mmmGamma); - } - - ComponentFactorTenorDeltaGammaMeasureMap mapCompCreditTenorDGMM = - accumulateComponentWiseTenorDeltaGammaMeasures (valParams, pricerParams, mapCSQSCreditTenorUp, - mapCSQSCreditTenorUp, mapCSQSCreditTenorDown, vcp, bkop.baseMeasures()); - - if (null != mapCompCreditTenorDGMM) { - bkop.setComponentTenorCreditDeltaMeasures (mapCompCreditTenorDGMM._mmmDelta); - - bkop.setComponentTenorCreditGammaMeasures (mapCompCreditTenorDGMM._mmmGamma); - } - - bkop.setCalcTime ((System.nanoTime() - lStart) * 1.e-09); - - return bkop; - } - - /** - * Compute Basket's Custom Scenario Measures - * - * @param valParams Valuation Parameters - * @param pricerParams Pricer Parameters - * @param mpc Market Parameters Container - * @param strCustomScenName Custom Scenario Name - * @param vcp Valuation Customization Parameters - * @param mapBase Map of Base Measures - * - * @return Basket's Custom Scenario Measures - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap customScenarioMeasures ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.definition.ScenarioMarketParams mpc, - final java.lang.String strCustomScenName, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - org.drip.analytics.support.CaseInsensitiveTreeMap mapBase) - { - if (null == valParams || null == mpc) return null; - - if (null == mapBase) { - org.drip.param.market.CurveSurfaceQuoteContainer csqsBase = mpc.scenarioMarketParams (this, "Base"); - - if (null == csqsBase || null == (mapBase = value (valParams, pricerParams, csqsBase, vcp))) - return null; - } - - org.drip.param.market.CurveSurfaceQuoteContainer csqsScen = mpc.scenarioMarketParams (this, strCustomScenName); - - if (null == csqsScen) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapScenMeasures = value - (valParams, pricerParams, csqsScen, vcp); - - if (null == mapScenMeasures || null != mapScenMeasures.entrySet()) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapOP = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry me : mapScenMeasures.entrySet()) { - if (null == me || null == me.getKey()) continue; - - mapOP.put (me.getKey(), me.getValue() - mapBase.get (me.getKey())); - } - - return mapOP; - } -} diff --git a/org/drip/product/definition/Bond.java b/org/drip/product/definition/Bond.java deleted file mode 100644 index 87baca0..0000000 --- a/org/drip/product/definition/Bond.java +++ /dev/null @@ -1,14791 +0,0 @@ - -package org.drip.product.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * Bond abstract class implements the pricing, the valuation, and the RV analytics functionality for the bond - * product. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class Bond extends CreditComponent { - - /** - * Retrieve the work-out information from price - * - * @param valParams Valuation Parameters - * @param csqs Bond Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price - * - * @return The Optimal Work-out Information - */ - - public abstract org.drip.param.valuation.WorkoutInfo exerciseYieldFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice); - - /** - * Retrieve the array of double for the bond's secondary treasury spreads from the Valuation - * Parameters and the component market parameters - * - * @param valParams ValuationParams - * @param csqs ComponentMarketParams - * - * @return Array of double for the bond's secondary treasury spreads - */ - - public abstract double[] secTreasurySpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs); - - /** - * Retrieve the effective treasury benchmark yield from the valuation, the component market parameters, - * and the market price - * - * @param valParams ValuationParams - * @param csqs ComponentMarketParams - * @param vcp Valuation Customization Parameters - * @param dblPrice Market price - * - * @return Effective treasury benchmark yield - * - * @throws java.lang.Exception Thrown if the effective benchmark cannot be calculated - */ - - public abstract double effectiveTreasuryBenchmarkYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Get the ISIN - * - * @return ISIN string - */ - - public abstract java.lang.String isin(); - - /** - * Get the CUSIP - * - * @return CUSIP string - */ - - public abstract java.lang.String cusip(); - - /** - * Get the bond's loss flow from price - * - * @param valParams ValuationParams - * @param pricerParams PricerParams - * @param csqs ComponentMarketParams - * @param vcp Valuation Customization Parameters - * @param dblPrice Input price - * - * @return List of LossQuadratureMetrics - */ - - public abstract java.util.List lossFlowFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice); - - /** - * Return whether the bond is a floater - * - * @return True if the bond is a floater - */ - - public abstract boolean isFloater(); - - /** - * Return the rate index of the bond - * - * @return Rate index - */ - - public abstract java.lang.String rateIndex(); - - /** - * Return the current bond coupon - * - * @return Current coupon - */ - - public abstract double currentCoupon(); - - /** - * Return the floating spread of the bond - * - * @return Floating spread - */ - - public abstract double floatSpread(); - - /** - * Return the bond ticker - * - * @return Bond Ticker - */ - - public abstract java.lang.String ticker(); - - /** - * Indicate if the bond is callable - * - * @return True - callable - */ - - public abstract boolean callable(); - - /** - * Indicate if the bond is putable - * - * @return True - putable - */ - - public abstract boolean putable(); - - /** - * Indicate if the bond is sinkable - * - * @return True - sinkable - */ - - public abstract boolean sinkable(); - - /** - * Indicate if the bond has variable coupon - * - * @return True - has variable coupon - */ - - public abstract boolean variableCoupon(); - - /** - * Indicate if the bond has been exercised - * - * @return True - Has been exercised - */ - - public abstract boolean exercised(); - - /** - * Indicate if the bond has defaulted - * - * @return True - Bond has defaulted - */ - - public abstract boolean defaulted(); - - /** - * Indicate if the bond is perpetual - * - * @return True - Bond is Perpetual - */ - - public abstract boolean perpetual(); - - /** - * Calculate if the bond is tradeable on the given date - * - * @param valParams Valuation Parameters - * - * @return True indicates the bond is tradeable - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public abstract boolean tradeable ( - final org.drip.param.valuation.ValuationParams valParams) - throws java.lang.Exception; - - /** - * Return the bond's embedded call schedule - * - * @return EOS Call - */ - - public abstract org.drip.product.params.EmbeddedOptionSchedule callSchedule(); - - /** - * Return the bond's embedded put schedule - * - * @return EOS Put - */ - - public abstract org.drip.product.params.EmbeddedOptionSchedule putSchedule(); - - /** - * Return the bond's coupon type - * - * @return Bond's coupon Type - */ - - public abstract java.lang.String couponType(); - - /** - * Return the bond's coupon day count - * - * @return Coupon day count string - */ - - public abstract java.lang.String couponDC(); - - /** - * Return the bond's accrual day count - * - * @return Accrual day count string - */ - - public abstract java.lang.String accrualDC(); - - /** - * Return the bond's maturity type - * - * @return Bond's maturity type - */ - - public abstract java.lang.String maturityType(); - - /** - * Return the bond's coupon frequency - * - * @return Bond's coupon frequency - */ - - public abstract int freq(); - - /** - * Return the bond's final maturity - * - * @return Bond's final maturity - */ - - public abstract org.drip.analytics.date.JulianDate finalMaturity(); - - /** - * Return the bond's calculation type - * - * @return Bond's calculation type - */ - - public abstract java.lang.String calculationType(); - - /** - * Return the bond's redemption value - * - * @return Bond's redemption value - */ - - public abstract double redemptionValue(); - - /** - * Return the bond's coupon currency - * - * @return Bond's coupon currency - */ - - public abstract java.lang.String currency(); - - /** - * Return the bond's redemption currency - * - * @return Bond's redemption currency - */ - - public abstract java.lang.String redemptionCurrency(); - - /** - * Indicate whether the given date is in the first coupon period - * - * @param iDate Valuation Date - * - * @return True - The given date is in the first coupon period - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public abstract boolean inFirstCouponPeriod ( - final int iDate) - throws java.lang.Exception; - - /** - * Indicate whether the given date is in the final coupon period - * - * @param iDate Valuation Date - * - * @return True - The given date is in the last coupon period - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public abstract boolean inLastCouponPeriod ( - final int iDate) - throws java.lang.Exception; - - /** - * Return the bond's floating coupon convention - * - * @return Bond's floating coupon convention - */ - - public abstract java.lang.String floatCouponConvention(); - - /** - * Get the bond's reset date for the period identified by the valuation date - * - * @param iValueDate Valuation Date - * - * @return Reset JulianDate - */ - - public abstract org.drip.analytics.date.JulianDate periodFixingDate ( - final int iValueDate); - - /** - * Return the coupon date for the period prior to the specified date - * - * @param dt Valuation Date - * - * @return Previous Coupon Date - */ - - public abstract org.drip.analytics.date.JulianDate previousCouponDate ( - final org.drip.analytics.date.JulianDate dt); - - /** - * Return the coupon rate for the period prior to the specified date - * - * @param dt Valuation Date - * @param csqs Component Market Params - * - * @return Previous Coupon Rate - * - * @throws java.lang.Exception Thrown if the previous coupon rate cannot be calculated - */ - - public abstract double previousCouponRate ( - final org.drip.analytics.date.JulianDate dt, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - throws java.lang.Exception; - - /** - * Return the coupon date for the period containing the specified date - * - * @param dt Valuation Date - * - * @return Current Coupon Date - */ - - public abstract org.drip.analytics.date.JulianDate currentCouponDate ( - final org.drip.analytics.date.JulianDate dt); - - /** - * Return the coupon date for the period subsequent to the specified date - * - * @param dt Valuation Date - * - * @return Next Coupon Date - */ - - public abstract org.drip.analytics.date.JulianDate nextCouponDate ( - final org.drip.analytics.date.JulianDate dt); - - /** - * Return the next exercise info of the given exercise type (call/put) subsequent to the specified date - * - * @param dt Valuation Date - * @param bGetPut TRUE - Gets the next put date - * - * @return Next Exercise Information - */ - - public abstract org.drip.analytics.output.ExerciseInfo nextValidExerciseDateOfType ( - final org.drip.analytics.date.JulianDate dt, - final boolean bGetPut); - - /** - * Return the next exercise info subsequent to the specified date - * - * @param dt Valuation Date - * - * @return Next Exercise Info - */ - - public abstract org.drip.analytics.output.ExerciseInfo nextValidExerciseInfo ( - final org.drip.analytics.date.JulianDate dt); - - /** - * Return the coupon rate for the period corresponding to the specified date - * - * @param dt Valuation Date - * @param csqs Component Market Params - * - * @return Next Coupon Rate - * - * @throws java.lang.Exception Thrown if the current period coupon rate cannot be calculated - */ - - public abstract double currentCouponRate ( - final org.drip.analytics.date.JulianDate dt, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - throws java.lang.Exception; - - /** - * Return the coupon rate for the period subsequent to the specified date - * - * @param dt Valuation Date - * @param csqs Component Market Params - * - * @return Next Coupon Rate - * - * @throws java.lang.Exception Thrown if the subsequent coupon rate cannot be calculated - */ - - public abstract double nextCouponRate ( - final org.drip.analytics.date.JulianDate dt, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - throws java.lang.Exception; - - /** - * Calculate the bond's accrued for the period identified by the valuation date - * - * @param iDate Valuation Date - * @param csqs Bond market parameters - * - * @return The coupon accrued in the current period - * - * @throws java.lang.Exception Thrown if accrual cannot be calculated - */ - - public abstract double accrued ( - final int iDate, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - throws java.lang.Exception; - - /** - * Calculate the bond's non-credit risky theoretical price from the Bumped Zero Curve - * - * @param valParams ValuationParams - * @param csqs ComponentMarketParams - * @param vcp Valuation Customization Parameters - * @param iZeroCurveBaseDC The Discount Curve to derive the zero curve off of - * @param iWorkoutDate Work-out date - * @param dblWorkoutFactor Double Work-out factor - * @param dblZCBump Bump to be applied to the zero curve - * - * @return Bond's non-credit risky theoretical price - * - * @throws java.lang.Exception Thrown if the price cannot be calculated - */ - - public abstract double priceFromZeroCurve ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iZeroCurveBaseDC, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZCBump) - throws java.lang.Exception; - - /** - * Calculate the bond's non-credit risky theoretical price from the Bumped Funding curve - * - * @param valParams ValuationParams - * @param csqs ComponentMarketParams - * @param iWorkoutDate Work-out date - * @param dblWorkoutFactor Double Work-out factor - * @param dblDCBump Bump to be applied to the DC - * - * @return Bond's non-credit risky theoretical price from the Bumped Funding curve - * - * @throws java.lang.Exception Thrown if the price cannot be calculated - */ - - public abstract double priceFromFundingCurve ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDCBump) - throws java.lang.Exception; - - /** - * Calculate the bond's non-credit risky theoretical price from the Bumped Funding curve - * - * @param valParams ValuationParams - * @param csqs ComponentMarketParams - * @param iWorkoutDate Work-out date - * @param dblWorkoutFactor Double Work-out factor - * @param dblDCBump Bump to be applied to the DC - * - * @return Bond's non-credit risky theoretical price from the Bumped Treasury curve - * - * @throws java.lang.Exception Thrown if the price cannot be calculated - */ - - public abstract double priceFromTreasuryCurve ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDCBump) - throws java.lang.Exception; - - /** - * Calculate the bond's credit risky theoretical price from the bumped credit curve - * - * @param valParams ValuationParams - * @param csqs ComponentMarketParams - * @param iWorkoutDate Work-out date - * @param dblWorkoutFactor Double Work-out factor - * @param dblCreditBasis Bump to be applied to the credit curve - * @param bFlat Is the CDS Curve flat (for PECS) - * - * @return Bond's credit risky theoretical price - * - * @throws java.lang.Exception Thrown if the bond's credit risky theoretical price cannot be calculated - */ - - public abstract double priceFromCreditCurve ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis, - final boolean bFlat) - throws java.lang.Exception; - - /** - * Calculate ASW from Bond Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out date - * @param dblWorkoutFactor Work-out Factor - * @param dblBondBasis Bond Basis to Work-out - * - * @return ASW from Bond Basis to Work-out - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate ASW from Bond Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Maturity - * - * @return ASW from Bond Basis to Maturity - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate ASW from Bond Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Optimal Exercise - * - * @return ASW from Bond Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate ASW from Credit Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out date - * @param dblWorkoutFactor Work-out Factor - * @param dblCreditBasis Credit Basis to Work-out - * - * @return ASW from Credit Basis to Work-out - * - * @throws java.lang.Exception Thrown if the ASW cannot be calculated - */ - - public abstract double aswFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate ASW from Credit Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Maturity - * - * @return ASW from Credit Basis to Maturity - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate ASW from Credit Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Optimal Exercise - * - * @return ASW from Credit Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate ASW from Discount Margin to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblDiscountMargin Discount Margin to Work-out - * - * @return ASW from Discount Margin to Work-out - * - * @throws java.lang.Exception Thrown if the ASW cannot be calculated - */ - - public abstract double aswFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate ASW from Discount Margin to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Maturity - * - * @return ASW from Discount Margin to Maturity - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate ASW from Discount Margin to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Optimal Exercise - * - * @return ASW from Discount Margin to Optimal Exercise - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate ASW from G Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblGSpread G Spread to Work-out - * - * @return ASW from G Spread to Work-out - * - * @throws java.lang.Exception Thrown if the ASW cannot be calculated - */ - - public abstract double aswFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate ASW from G Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Maturity - * - * @return ASW from G Spread to Maturity - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate ASW from G Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Optimal Exercise - * - * @return ASW from G Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate ASW from I Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblISpread I Spread to Work-out - * - * @return ASW from I Spread to Work-out - * - * @throws java.lang.Exception Thrown if the ASW cannot be calculated - */ - - public abstract double aswFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate ASW from I Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Maturity - * - * @return ASW from I Spread to Maturity - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate ASW from I Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Optimal Exercise - * - * @return ASW from I Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate ASW from OAS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblOAS OAS to Work-out - * - * @return ASW from OAS to Work-out - * - * @throws java.lang.Exception Thrown if the ASW cannot be calculated - */ - - public abstract double aswFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate ASW from OAS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Maturity - * - * @return ASW from OAS to Maturity - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate ASW from OAS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Optimal Exercise - * - * @return ASW from OAS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate ASW from PECS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPECS PECS to Work-out - * - * @return ASW from PECS to Work-out - * - * @throws java.lang.Exception Thrown if the ASW cannot be calculated - */ - - public abstract double aswFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate ASW from PECS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Maturity - * - * @return ASW from PECS to Maturity - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate ASW from PECS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Optimal Exercise - * - * @return ASW from PECS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate ASW from Price to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPrice Price to Work-out - * - * @return ASW from Price to Work-out - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate ASW from Price to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Maturity - * - * @return ASW from Price to Maturity - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate ASW from Price to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Optimal Exercise - * - * @return ASW from Price to Optimal Exercise - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate ASW from TSY Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblTSYSpread TSY Spread to Work-out - * - * @return ASW from TSY Spread to Work-out - * - * @throws java.lang.Exception Thrown if the ASW cannot be calculated - */ - - public abstract double aswFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate ASW from TSY Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Maturity - * - * @return ASW from TSY Spread to Maturity - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate ASW from TSY Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Optimal Exercise - * - * @return ASW from TSY Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate ASW from Yield to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYield Yield to Work-out - * - * @return ASW from Yield to Work-out - * - * @throws java.lang.Exception Thrown if the ASW cannot be calculated - */ - - public abstract double aswFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate ASW from Yield to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Maturity - * - * @return ASW from Yield to Maturity - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate ASW from Yield to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Optimal Exercise - * - * @return ASW from Yield to Optimal Exercise - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate ASW from Yield Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYieldSpread Yield Spread to Work-out - * - * @return ASW from Yield Spread to Work-out - * - * @throws java.lang.Exception Thrown if the ASW cannot be calculated - */ - - public abstract double aswFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate ASW from Yield Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Maturity - * - * @return ASW from Yield Spread to Maturity - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate ASW from Yield Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Optimal Exercise - * - * @return ASW from Yield Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate ASW from Z Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblZSpread Z Spread to Work-out - * - * @return ASW from Z Spread to Work-out - * - * @throws java.lang.Exception Thrown if the ASW cannot be calculated - */ - - public abstract double aswFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate ASW from Z Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Maturity - * - * @return ASW from Z Spread to Maturity - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate ASW from Z Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Optimal Exercise - * - * @return ASW from Z Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if ASW cannot be calculated - */ - - public abstract double aswFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from ASW to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblASW ASW to Work-out - * - * @return Bond Basis from ASW to Work-out - * - * @throws java.lang.Exception Thrown if the Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from ASW to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Maturity - * - * @return Bond Basis from ASW to Maturity - * - * @throws java.lang.Exception Thrown if Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from ASW to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Optimal Exercise - * - * @return Bond Basis from ASW to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from Credit Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblCreditBasis Credit Basis to Work-out - * - * @return Bond Basis from Credit Basis to Work-out - * - * @throws java.lang.Exception Thrown if the Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from Credit Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Maturity - * - * @return Bond Basis from Credit Basis to Maturity - * - * @throws java.lang.Exception Thrown if Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from Credit Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Optimal Exercise - * - * @return Bond Basis from Credit Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from Discount Margin to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblDiscountMargin Discount Margin to Work-out - * - * @return Bond Basis from Discount Margin to Work-out - * - * @throws java.lang.Exception Thrown if the Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from Discount Margin to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Maturity - * - * @return Bond Basis from Discount Margin to Maturity - * - * @throws java.lang.Exception Thrown if Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from Discount Margin to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Optimal Exercise - * - * @return Bond Basis from Discount Margin to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from G Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblGSpread G Spread to Work-out - * - * @return Bond Basis from G Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from G Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Maturity - * - * @return Bond Basis from G Spread to Maturity - * - * @throws java.lang.Exception Thrown if Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from G Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Optimal Exercise - * - * @return Bond Basis from G Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from I Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblISpread I Spread to Work-out - * - * @return Bond Basis from I Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from I Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Maturity - * - * @return Bond Basis from I Spread to Maturity - * - * @throws java.lang.Exception Thrown if Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from I Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Optimal Exercise - * - * @return Bond Basis from I Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from OAS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblOAS OAS to Work-out - * - * @return Bond Basis from OAS to Work-out - * - * @throws java.lang.Exception Thrown if the Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from OAS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Maturity - * - * @return Bond Basis from OAS to Maturity - * - * @throws java.lang.Exception Thrown if Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from OAS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Optimal Exercise - * - * @return Bond Basis from OAS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from PECS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPECS PECS to Work-out - * - * @return Bond Basis from PECS to Work-out - * - * @throws java.lang.Exception Thrown if the Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from PECS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Maturity - * - * @return Bond Basis from PECS to Maturity - * - * @throws java.lang.Exception Thrown if Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from PECS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Optimal Exercise - * - * @return Bond Basis from PECS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from Price to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPrice Price to Work-out - * - * @return Bond Basis from Price to Work-out - * - * @throws java.lang.Exception Thrown if the Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from Price to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Maturity - * - * @return Bond Basis from Price to Maturity - * - * @throws java.lang.Exception Thrown if Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from Price to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Optimal Exercise - * - * @return Bond Basis from Price to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from TSY Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblTSYSpread TSY Spread to Work-out - * - * @return Bond Basis from TSY Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from TSY Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Maturity - * - * @return Bond Basis from TSY Spread to Maturity - * - * @throws java.lang.Exception Thrown if Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from TSY Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Optimal Exercise - * - * @return Bond Basis from TSY Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from Yield to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYield Yield to Work-out - * - * @return Bond Basis from Yield to Work-out - * - * @throws java.lang.Exception Thrown if the Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from Yield to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Maturity - * - * @return Bond Basis from Yield to Maturity - * - * @throws java.lang.Exception Thrown if Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from Yield to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Optimal Exercise - * - * @return Bond Basis from Yield to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from Yield Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYieldSpread Yield Spread to Work-out - * - * @return Bond Basis from Yield Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from Yield Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Maturity - * - * @return Bond Basis from Yield Spread to Maturity - * - * @throws java.lang.Exception Thrown if Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from Yield Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Optimal Exercise - * - * @return Bond Basis from Yield Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from Z Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblZSpread Z Spread to Work-out - * - * @return Bond Basis from Z Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from Z Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Maturity - * - * @return Bond Basis from Z Spread to Maturity - * - * @throws java.lang.Exception Thrown if Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Bond Basis from Z Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Optimal Exercise - * - * @return Bond Basis from Z Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Bond Basis cannot be calculated - */ - - public abstract double bondBasisFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Convexity from ASW to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblASW ASW to Work-out - * - * @return Convexity from ASW to Work-out - * - * @throws java.lang.Exception Thrown if the Convexity cannot be calculated - */ - - public abstract double convexityFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Convexity from ASW to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Maturity - * - * @return Convexity from ASW to Maturity - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Convexity from ASW to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Optimal Exercise - * - * @return Convexity from ASW to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Convexity from Bond Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblBondBasis Bond Basis to Work-out - * - * @return Convexity from Bond Basis to Work-out - * - * @throws java.lang.Exception Thrown if the Convexity cannot be calculated - */ - - public abstract double convexityFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Convexity from Bond Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Maturity - * - * @return Convexity from Bond Basis to Maturity - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Convexity from Bond Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Optimal Exercise - * - * @return Convexity from Bond Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Convexity from Credit Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblCreditBasis Credit Basis to Work-out - * - * @return Convexity from Credit Basis to Work-out - * - * @throws java.lang.Exception Thrown if the Convexity cannot be calculated - */ - - public abstract double convexityFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Convexity from Credit Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Maturity - * - * @return Convexity from Credit Basis to Maturity - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Convexity from Credit Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Optimal Exercise - * - * @return Convexity from Credit Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Convexity from Discount Margin to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblDiscountMargin Discount Margin to Work-out - * - * @return Convexity from Discount Margin to Work-out - * - * @throws java.lang.Exception Thrown if the Convexity cannot be calculated - */ - - public abstract double convexityFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Convexity from Discount Margin to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Maturity - * - * @return Convexity from Discount Margin to Maturity - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Convexity from Discount Margin to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Optimal Exercise - * - * @return Convexity from Discount Margin to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Convexity from G Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblGSpread G Spread to Work-out - * - * @return Convexity from G Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Convexity cannot be calculated - */ - - public abstract double convexityFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Convexity from G Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Maturity - * - * @return Convexity from G Spread to Maturity - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Convexity from G Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Optimal Exercise - * - * @return Convexity from G Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Convexity from I Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblISpread I Spread to Work-out - * - * @return Convexity from I Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Convexity cannot be calculated - */ - - public abstract double convexityFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Convexity from I Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Maturity - * - * @return Convexity from I Spread to Maturity - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Convexity from I Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Optimal Exercise - * - * @return Convexity from I Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Convexity from OAS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblOAS OAS to Work-out - * - * @return Convexity from OAS to Work-out - * - * @throws java.lang.Exception Thrown if the Convexity cannot be calculated - */ - - public abstract double convexityFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Convexity from OAS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Maturity - * - * @return Convexity from OAS to Maturity - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Convexity from OAS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Optimal Exercise - * - * @return Convexity from OAS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Convexity from PECS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPECS PECS to Work-out - * - * @return Convexity from PECS to Work-out - * - * @throws java.lang.Exception Thrown if the Convexity cannot be calculated - */ - - public abstract double convexityFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Convexity from PECS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Maturity - * - * @return Convexity from PECS to Maturity - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Convexity from PECS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Optimal Exercise - * - * @return Convexity from PECS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Convexity from Price to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPrice Price to Work-out - * - * @return Convexity from Price to Work-out - * - * @throws java.lang.Exception Thrown if the Convexity cannot be calculated - */ - - public abstract double convexityFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Convexity from Price to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Maturity - * - * @return Convexity from Price to Maturity - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Convexity from Price to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Optimal Exercise - * - * @return Convexity from Price to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Convexity from TSY Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblTSYSpread TSY Spread to Work-out - * - * @return Convexity from TSY Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Convexity cannot be calculated - */ - - public abstract double convexityFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Convexity from TSY Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Maturity - * - * @return Convexity from TSY Spread to Maturity - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Convexity from TSY Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Optimal Exercise - * - * @return Convexity from TSY Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Convexity from Yield to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYield Yield to Work-out - * - * @return Convexity from Yield to Work-out - * - * @throws java.lang.Exception Thrown if the Convexity cannot be calculated - */ - - public abstract double convexityFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Convexity from Yield to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Maturity - * - * @return Convexity from Yield to Maturity - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Convexity from Yield to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Optimal Exercise - * - * @return Convexity from Yield to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Convexity from Yield Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYieldSpread Yield Spread to Work-out - * - * @return Convexity from Yield Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Convexity cannot be calculated - */ - - public abstract double convexityFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Convexity from Yield Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Maturity - * - * @return Convexity from Yield Spread to Maturity - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Convexity from Yield Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Optimal Exercise - * - * @return Convexity from Yield Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Convexity from Z Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblZSpread Z Spread to Work-out - * - * @return Convexity from Z Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Convexity cannot be calculated - */ - - public abstract double convexityFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Convexity from Z Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Maturity - * - * @return Convexity from Z Spread to Maturity - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Convexity from Z Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Optimal Exercise - * - * @return Convexity from Z to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Convexity cannot be calculated - */ - - public abstract double convexityFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from ASW to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblASW ASW to Work-out - * - * @return Credit Basis from ASW to Work-out - * - * @throws java.lang.Exception Thrown if the Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from ASW to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Maturity - * - * @return Credit Basis from ASW to Maturity - * - * @throws java.lang.Exception Thrown if Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from ASW to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Optimal Exercise - * - * @return Credit Basis from ASW to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from Bond Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblBondBasis Bond Basis to Work-out - * - * @return Credit Basis from Bond Basis to Work-out - * - * @throws java.lang.Exception Thrown if the Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from Bond Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Maturity - * - * @return Credit Basis from Bond Basis to Maturity - * - * @throws java.lang.Exception Thrown if Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from Bond Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Optimal Exercise - * - * @return Credit Basis from Bond Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from Discount Margin to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblDiscountMargin Discount Margin to Work-out - * - * @return Credit Basis from Discount Margin to Work-out - * - * @throws java.lang.Exception Thrown if the Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from Discount Margin to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Maturity - * - * @return Credit Basis from Discount Margin to Maturity - * - * @throws java.lang.Exception Thrown if Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from Discount Margin to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Optimal Exercise - * - * @return Credit Basis from Discount Margin to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double creditBasisFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from G Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblGSpread G Spread to Work-out - * - * @return Credit Basis from G Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from G Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Maturity - * - * @return Credit Basis from G Spread to Maturity - * - * @throws java.lang.Exception Thrown if Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from G Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Optimal Exercise - * - * @return Credit Basis from G Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from I Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblISpread I Spread to Work-out - * - * @return Credit Basis from I Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from I Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Maturity - * - * @return Credit Basis from I Spread to Maturity - * - * @throws java.lang.Exception Thrown if Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from I Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Optimal Exercise - * - * @return Credit Basis from I Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from OAS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblOAS OAS to Work-out - * - * @return Credit Basis from OAS to Work-out - * - * @throws java.lang.Exception Thrown if the Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from OAS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Maturity - * - * @return Credit Basis from OAS to Maturity - * - * @throws java.lang.Exception Thrown if Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from OAS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Optimal Exercise - * - * @return Credit Basis from OAS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from PECS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPECS PECS to Work-out - * - * @return Credit Basis from PECS to Work-out - * - * @throws java.lang.Exception Thrown if the Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from PECS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Maturity - * - * @return Credit Basis from PECS to Maturity - * - * @throws java.lang.Exception Thrown if Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from PECS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Optimal Exercise - * - * @return Credit Basis from PECS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from Price to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPrice Price to Work-out - * - * @return Credit Basis from Price to Work-out - * - * @throws java.lang.Exception Thrown if the Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from Price to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Maturity - * - * @return Credit Basis from Price to Maturity - * - * @throws java.lang.Exception Thrown if Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from Price to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Optimal Exercise - * - * @return Credit Basis from Price to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from TSY Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblTSYSpread TSY Spread to Work-out - * - * @return Credit Basis from TSY Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from TSY Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Maturity - * - * @return Credit Basis from TSY Spread to Maturity - * - * @throws java.lang.Exception Thrown if Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from TSY Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Optimal Exercise - * - * @return Credit Basis from TSY Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from Yield to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYield Yield to Work-out - * - * @return Credit Basis from Yield to Work-out - * - * @throws java.lang.Exception Thrown if the Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from Yield to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Maturity - * - * @return Credit Basis from Yield to Maturity - * - * @throws java.lang.Exception Thrown if Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from Yield to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Optimal Exercise - * - * @return Credit Basis from Yield to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from Yield Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYieldSpread Yield Spread to Work-out - * - * @return Credit Basis from Yield Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from Yield Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Maturity - * - * @return Credit Basis from Yield Spread to Maturity - * - * @throws java.lang.Exception Thrown if Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from Yield Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Optimal Exercise - * - * @return Credit Basis from Yield Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from Z Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblZSpread Z Spread to Work-out - * - * @return Credit Basis from Z Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from Z Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Maturity - * - * @return Credit Basis from Z Spread to Maturity - * - * @throws java.lang.Exception Thrown if Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Credit Basis from Z Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Optimal Exercise - * - * @return Credit Basis from Z Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Credit Basis cannot be calculated - */ - - public abstract double creditBasisFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from ASW to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblASW ASW to Work-out - * - * @return Discount Margin from ASW to Work-out - * - * @throws java.lang.Exception Thrown if the Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from ASW to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Maturity - * - * @return Discount Margin from ASW to Maturity - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from ASW to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Optimal Exercise - * - * @return Discount Margin from ASW to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from Bond Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblBondBasis Bond Basis to Work-out - * - * @return Discount Margin from Bond Basis to Work-out - * - * @throws java.lang.Exception Thrown if the Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from Bond Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Maturity - * - * @return Discount Margin from Bond Basis to Maturity - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from Bond Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Optimal Exercise - * - * @return Discount Margin from Bond Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from Credit Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblCreditBasis Credit Basis to Work-out - * - * @return Discount Margin from Credit Basis to Work-out - * - * @throws java.lang.Exception Thrown if the Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from Credit Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Maturity - * - * @return Discount Margin from Credit Basis to Maturity - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from Credit Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Optimal Exercise - * - * @return Discount Margin from Credit Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from G Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblGSpread G Spread to Work-out - * - * @return Discount Margin from G Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from G Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Maturity - * - * @return Discount Margin from G Spread to Maturity - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from G Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Optimal Exercise - * - * @return Discount Margin from G Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from I Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblISpread I Spread to Work-out - * - * @return Discount Margin from I Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from I Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Maturity - * - * @return Discount Margin from I Spread to Maturity - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from I Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Optimal Exercise - * - * @return Discount Margin from I Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from OAS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblOAS OAS to Work-out - * - * @return Discount Margin from OAS to Work-out - * - * @throws java.lang.Exception Thrown if the Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from OAS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Maturity - * - * @return Discount Margin from OAS to Maturity - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from OAS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Optimal Exercise - * - * @return Discount Margin from OAS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from PECS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPECS PECS to Work-out - * - * @return Discount Margin from PECS to Work-out - * - * @throws java.lang.Exception Thrown if the Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from PECS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Maturity - * - * @return Discount Margin from PECS to Maturity - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from PECS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Optimal Exercise - * - * @return Discount Margin from PECS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from Price to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPrice Price to Work-out - * - * @return Discount Margin from Price to Work-out - * - * @throws java.lang.Exception Thrown if the Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from Price to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Maturity - * - * @return Discount Margin from Price to Maturity - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from Price to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Optimal Exercise - * - * @return Discount Margin from Price to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from TSY Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblTSYSpread TSY Spread to Work-out - * - * @return Discount Margin from TSY Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from TSY Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Maturity - * - * @return Discount Margin from TSY Spread to Maturity - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from TSY Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Optimal Exercise - * - * @return Discount Margin from TSY Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from Yield to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYield Yield to Work-out - * - * @return Discount Margin from Yield to Work-out - * - * @throws java.lang.Exception Thrown if the Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from Yield to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Maturity - * - * @return Discount Margin from Yield to Maturity - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from Yield to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Optimal Exercise - * - * @return Discount Margin from Yield to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from Yield Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYieldSpread Yield Spread to Work-out - * - * @return Discount Margin from Yield Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from Yield Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Maturity - * - * @return Discount Margin from Yield Spread to Maturity - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from Yield Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Optimal Exercise - * - * @return Discount Margin from Yield Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from Z Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblZSpread Z Spread to Work-out - * - * @return Discount Margin from Z Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from Z Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Maturity - * - * @return Discount Margin from Z Spread to Maturity - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Discount Margin from Z Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Optimal Exercise - * - * @return Discount Margin from Z Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Discount Margin cannot be calculated - */ - - public abstract double discountMarginFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Duration from ASW to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblASW ASW to Work-out - * - * @return Duration from ASW to Work-out - * - * @throws java.lang.Exception Thrown if the Duration cannot be calculated - */ - - public abstract double durationFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Duration from ASW to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Maturity - * - * @return Duration from ASW to Maturity - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Duration from ASW to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Optimal Exercise - * - * @return Duration from ASW to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Duration from Bond Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblBondBasis Bond Basis to Work-out - * - * @return Duration from Bond Basis to Work-out - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Duration from Bond Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Maturity - * - * @return Duration from Bond Basis to Maturity - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Duration from Bond Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Optimal Exercise - * - * @return Duration from Bond Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Duration from Credit Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblCreditBasis Credit Basis to Work-out - * - * @return Duration from Credit Basis to Work-out - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Duration from Credit Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Maturity - * - * @return Duration from Credit Basis to Maturity - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Duration from Credit Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Optimal Exercise - * - * @return Duration from Credit Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Duration from Discount Margin to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblDiscountMargin Discount Margin to Work-out - * - * @return Duration from Discount Margin to Work-out - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Duration from Discount Margin to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Maturity - * - * @return Duration from Discount Margin to Maturity - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Duration from Discount Margin to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Optimal Exercise - * - * @return Duration from Discount Margin to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Duration from G Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblGSpread G Spread to Work-out - * - * @return Duration from G Spread to Work-out - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Duration from G Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Maturity - * - * @return Duration from G Spread to Maturity - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Duration from G Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Optimal Exercise - * - * @return Duration from G Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Duration from I Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblISpread I Spread to Work-out - * - * @return Duration from I Spread to Work-out - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Duration from I Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Maturity - * - * @return Duration from I Spread to Maturity - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Duration from I Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Optimal Exercise - * - * @return Duration from I Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Duration from OAS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblOAS OAS to Work-out - * - * @return Duration from OAS to Work-out - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Duration from OAS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Maturity - * - * @return Duration from OAS to Maturity - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Duration from OAS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Optimal Exercise - * - * @return Duration from OAS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Duration from PECS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPECS PECS to Work-out - * - * @return Duration from PECS to Work-out - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Duration from PECS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Maturity - * - * @return Duration from PECS to Maturity - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Duration from PECS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Optimal Exercise - * - * @return Duration from PECS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Duration from Price to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPrice Price to Work-out - * - * @return Duration from Price to Work-out - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Duration from Price to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Maturity - * - * @return Duration from Price to Maturity - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Duration from Price to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Optimal Exercise - * - * @return Duration from Price to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Duration from TSY Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblTSYSpread TSY Spread to Work-out - * - * @return Duration from TSY Spread to Work-out - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Duration from TSY Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Maturity - * - * @return Duration from TSY Spread to Maturity - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Duration from TSY Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Optimal Exercise - * - * @return Duration from TSY Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Duration from Yield to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYield Yield to Work-out - * - * @return Duration from Yield to Work-out - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Duration from Yield to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Maturity - * - * @return Duration from Yield to Maturity - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Duration from Yield to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Optimal Exercise - * - * @return Duration from Yield to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Duration from Yield Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYieldSpread Yield Spread to Work-out - * - * @return Duration from Yield Spread to Work-out - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Duration from Yield Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Maturity - * - * @return Duration from Yield Spread to Maturity - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Duration from Yield Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Optimal Exercise - * - * @return Duration from Yield Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Duration from Z Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblZSpread Z Spread to Work-out - * - * @return Duration from Z Spread to Work-out - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Duration from Z Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Maturity - * - * @return Duration from Z Spread to Maturity - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Duration from Z Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Optimal Exercise - * - * @return Duration from Z Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Duration cannot be calculated - */ - - public abstract double durationFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate G Spread from ASW to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblASW ASW to Work-out - * - * @return G Spread from ASW to Work-out - * - * @throws java.lang.Exception Thrown if the G Spread cannot be calculated - */ - - public abstract double gSpreadFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate G Spread from ASW to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Maturity - * - * @return G Spread from ASW to Maturity - * - * @throws java.lang.Exception Thrown if G Spread cannot be calculated - */ - - public abstract double gSpreadFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate G Spread from ASW to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Optimal Exercise - * - * @return G Spread from ASW to Optimal Exercise - * - * @throws java.lang.Exception Thrown if G Spread cannot be calculated - */ - - public abstract double gSpreadFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate G Spread from Bond Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblBondBasis Bond Basis to Work-out - * - * @return G Spread from Bond Basis to Work-out - * - * @throws java.lang.Exception Thrown if the G Spread cannot be calculated - */ - - public abstract double gSpreadFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate G Spread from Bond Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Maturity - * - * @return G Spread from Bond Basis to Maturity - * - * @throws java.lang.Exception Thrown if G Spread cannot be calculated - */ - - public abstract double gSpreadFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate G Spread from Bond Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Optimal Exercise - * - * @return G Spread from Bond Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if G Spread cannot be calculated - */ - - public abstract double gSpreadFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate G Spread from Credit Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblCreditBasis Credit Basis to Work-out - * - * @return G Spread from Credit Basis to Work-out - * - * @throws java.lang.Exception Thrown if the G Spread cannot be calculated - */ - - public abstract double gSpreadFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate G Spread from Credit Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Maturity - * - * @return G Spread from Credit Basis to Maturity - * - * @throws java.lang.Exception Thrown if G Spread cannot be calculated - */ - - public abstract double gSpreadFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate G Spread from Credit Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Optimal Exercise - * - * @return G Spread from Credit Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if G Spread cannot be calculated - */ - - public abstract double gSpreadFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate G Spread from Discount Margin to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblDiscountMargin Discount Margin to Work-out - * - * @return G Spread from Discount Margin to Work-out - * - * @throws java.lang.Exception Thrown if the G Spread cannot be calculated - */ - - public abstract double gSpreadFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate G Spread from Discount Margin to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Maturity - * - * @return G Spread from Discount Margin to Maturity - * - * @throws java.lang.Exception Thrown if G Spread cannot be calculated - */ - - public abstract double gSpreadFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate G Spread from Discount Margin to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Optimal Exercise - * - * @return G Spread from Discount Margin to Optimal Exercise - * - * @throws java.lang.Exception Thrown if G Spread cannot be calculated - */ - - public abstract double gSSpreadFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate G Spread from I Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblISpread I Spread to Work-out - * - * @return G Spread from I Spread to Work-out - * - * @throws java.lang.Exception Thrown if the G Spread cannot be calculated - */ - - public abstract double gSpreadFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate G Spread from I Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Maturity - * - * @return G Spread from I Spread to Maturity - * - * @throws java.lang.Exception Thrown if G Spread cannot be calculated - */ - - public abstract double gSpreadFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate G Spread from I Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Optimal Exercise - * - * @return G Spread from I Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if G Spread cannot be calculated - */ - - public abstract double gSpreadFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate G Spread from OAS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblOAS OAS to Work-out - * - * @return G Spread from OAS to Work-out - * - * @throws java.lang.Exception Thrown if the G Spread cannot be calculated - */ - - public abstract double gSpreadFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate G Spread from OAS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Maturity - * - * @return G Spread from OAS to Maturity - * - * @throws java.lang.Exception Thrown if G Spread cannot be calculated - */ - - public abstract double gSpreadFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate G Spread from OAS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Optimal Exercise - * - * @return G Spread from OAS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if G Spread cannot be calculated - */ - - public abstract double gSpreadFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate G Spread from PECS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPECS PECS to Work-out - * - * @return G Spread from PECS to Work-out - * - * @throws java.lang.Exception Thrown if the G Spread cannot be calculated - */ - - public abstract double gSpreadFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate G Spread from PECS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Maturity - * - * @return G Spread from PECS to Maturity - * - * @throws java.lang.Exception Thrown if G Spread cannot be calculated - */ - - public abstract double gSpreadFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate G Spread from PECS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Optimal Exercise - * - * @return G Spread from PECS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if G Spread cannot be calculated - */ - - public abstract double gSpreadFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate G Spread from Price to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPrice Price to Work-out - * - * @return G Spread from Price to Work-out - * - * @throws java.lang.Exception Thrown if the G Spread cannot be calculated - */ - - public abstract double gSpreadFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate G Spread from Price to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Maturity - * - * @return G Spread from Price to Maturity - * - * @throws java.lang.Exception Thrown if G Spread cannot be calculated - */ - - public abstract double gSpreadFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate G Spread from Price to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Optimal Exercise - * - * @return G Spread from Price to Optimal Exercise - * - * @throws java.lang.Exception Thrown if G Spread cannot be calculated - */ - - public abstract double gSpreadFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate G Spread from TSY Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblTSYSpread TSY Spread to Work-out - * - * @return G Spread from TSY Spread to Work-out - * - * @throws java.lang.Exception Thrown if the G Spread cannot be calculated - */ - - public abstract double gSpreadFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate G Spread from TSY Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Maturity - * - * @return G Spread from TSY Spread to Maturity - * - * @throws java.lang.Exception Thrown if G Spread cannot be calculated - */ - - public abstract double gSpreadFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate G Spread from TSY Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Optimal Exercise - * - * @return G Spread from TSY Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if G Spread cannot be calculated - */ - - public abstract double gSpreadFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate G Spread from Yield to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYield Yield to Work-out - * - * @return G Spread from Yield to Work-out - * - * @throws java.lang.Exception Thrown if the G Spread cannot be calculated - */ - - public abstract double gSpreadFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate G Spread from Yield to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Maturity - * - * @return G Spread from Yield to Maturity - * - * @throws java.lang.Exception Thrown if G Spread cannot be calculated - */ - - public abstract double gSpreadFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate G Spread from Yield to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Optimal Exercise - * - * @return G Spread from Yield to Optimal Exercise - * - * @throws java.lang.Exception Thrown if G Spread cannot be calculated - */ - - public abstract double gSpreadFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate G Spread from Yield Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYieldSpread Yield Spread to Work-out - * - * @return G Spread from Yield Spread to Work-out - * - * @throws java.lang.Exception Thrown if the G Spread cannot be calculated - */ - - public abstract double gSpreadFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate G Spread from Yield Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Maturity - * - * @return G Spread from Yield Spread to Maturity - * - * @throws java.lang.Exception Thrown if G Spread cannot be calculated - */ - - public abstract double gSpreadFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate G Spread from Yield Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Optimal Exercise - * - * @return G Spread from Yield Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if G Spread cannot be calculated - */ - - public abstract double gSpreadFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate G Spread from Z Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblZSpread Z Spread to Work-out - * - * @return G Spread from Z Spread to Work-out - * - * @throws java.lang.Exception Thrown if the G Spread cannot be calculated - */ - - public abstract double gSpreadFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate G Spread from Z Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Maturity - * - * @return G Spread from Z Spread to Maturity - * - * @throws java.lang.Exception Thrown if G Spread cannot be calculated - */ - - public abstract double gSpreadFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate G Spread from Z Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Optimal Exercise - * - * @return G Spread from Z Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if G Spread cannot be calculated - */ - - public abstract double gSpreadFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate I Spread from ASW to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblASW ASW to Work-out - * - * @return I Spread from ASW to Work-out - * - * @throws java.lang.Exception Thrown if the I Spread cannot be calculated - */ - - public abstract double iSpreadFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate I Spread from ASW to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Maturity - * - * @return I Spread from ASW to Maturity - * - * @throws java.lang.Exception Thrown if I Spread cannot be calculated - */ - - public abstract double iSpreadFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate I Spread from ASW to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Optimal Exercise - * - * @return I Spread from ASW to Optimal Exercise - * - * @throws java.lang.Exception Thrown if I Spread cannot be calculated - */ - - public abstract double iSpreadFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate I Spread from Bond Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblBondBasis Bond Basis to Work-out - * - * @return I Spread from Bond Basis to Work-out - * - * @throws java.lang.Exception Thrown if the I Spread cannot be calculated - */ - - public abstract double iSpreadFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate I Spread from Bond Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Maturity - * - * @return I Spread from Bond Basis to Maturity - * - * @throws java.lang.Exception Thrown if I Spread cannot be calculated - */ - - public abstract double iSpreadFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate I Spread from Bond Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Optimal Exercise - * - * @return I Spread from Bond Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if I Spread cannot be calculated - */ - - public abstract double iSpreadFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate I Spread from Credit Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblCreditBasis Credit Basis to Work-out - * - * @return I Spread from Credit Basis to Work-out - * - * @throws java.lang.Exception Thrown if the I Spread cannot be calculated - */ - - public abstract double iSpreadFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate I Spread from Credit Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Maturity - * - * @return I Spread from Credit Basis to Maturity - * - * @throws java.lang.Exception Thrown if I Spread cannot be calculated - */ - - public abstract double iSpreadFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate I Spread from Credit Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Optimal Exercise - * - * @return I Spread from Credit Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if I Spread cannot be calculated - */ - - public abstract double iSpreadFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate I Spread from Discount Margin to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblDiscountMargin Discount Margin to Work-out - * - * @return I Spread from Discount Margin to Work-out - * - * @throws java.lang.Exception Thrown if the I Spread cannot be calculated - */ - - public abstract double iSpreadFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate I Spread from Discount Margin to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Maturity - * - * @return I Spread from Discount Margin to Maturity - * - * @throws java.lang.Exception Thrown if I Spread cannot be calculated - */ - - public abstract double iSpreadFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate I Spread from Discount Margin to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Optimal Exercise - * - * @return I Spread from Discount Margin to Optimal Exercise - * - * @throws java.lang.Exception Thrown if I Spread cannot be calculated - */ - - public abstract double iSpreadFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate I Spread from G Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblGSpread G Spread to Work-out - * - * @return I Spread from G Spread to Work-out - * - * @throws java.lang.Exception Thrown if the I Spread cannot be calculated - */ - - public abstract double iSpreadFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate I Spread from G Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Maturity - * - * @return I Spread from G Spread to Maturity - * - * @throws java.lang.Exception Thrown if I Spread cannot be calculated - */ - - public abstract double iSpreadFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate I Spread from G Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Optimal Exercise - * - * @return I Spread from G Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if I Spread cannot be calculated - */ - - public abstract double iSpreadFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate I Spread from OAS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblOAS OAS to Work-out - * - * @return I Spread from OAS to Work-out - * - * @throws java.lang.Exception Thrown if the I Spread cannot be calculated - */ - - public abstract double iSpreadFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate I Spread from OAS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Maturity - * - * @return I Spread from OAS to Maturity - * - * @throws java.lang.Exception Thrown if I Spread cannot be calculated - */ - - public abstract double iSpreadFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate I Spread from OAS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Optimal Exercise - * - * @return I Spread from OAS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if I Spread cannot be calculated - */ - - public abstract double iSpreadFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate I Spread from PECS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPECS PECS to Work-out - * - * @return I Spread from PECS to Work-out - * - * @throws java.lang.Exception Thrown if the I Spread cannot be calculated - */ - - public abstract double iSpreadFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate I Spread from PECS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Maturity - * - * @return I Spread from PECS to Maturity - * - * @throws java.lang.Exception Thrown if I Spread cannot be calculated - */ - - public abstract double iSpreadFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate I Spread from PECS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Optimal Exercise - * - * @return I Spread from PECS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if I Spread cannot be calculated - */ - - public abstract double iSpreadFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate I Spread from Price to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPrice Price to Work-out - * - * @return I Spread from Price to Work-out - * - * @throws java.lang.Exception Thrown if the I Spread cannot be calculated - */ - - public abstract double iSpreadFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate I Spread from Price to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Maturity - * - * @return I Spread from Price to Maturity - * - * @throws java.lang.Exception Thrown if I Spread cannot be calculated - */ - - public abstract double iSpreadFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate I Spread from Price to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Optimal Exercise - * - * @return I Spread from Price to Optimal Exercise - * - * @throws java.lang.Exception Thrown if I Spread cannot be calculated - */ - - public abstract double iSpreadFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate I Spread from TSY Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblTSYSpread TSY Spread to Work-out - * - * @return I Spread from TSY Spread to Work-out - * - * @throws java.lang.Exception Thrown if the I Spread cannot be calculated - */ - - public abstract double iSpreadFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate I Spread from TSY Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Maturity - * - * @return I Spread from TSY Spread to Maturity - * - * @throws java.lang.Exception Thrown if I Spread cannot be calculated - */ - - public abstract double iSpreadFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate I Spread from TSY Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Optimal Exercise - * - * @return I Spread from TSY Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if I Spread cannot be calculated - */ - - public abstract double iSpreadFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate I Spread from Yield to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYield Yield to Work-out - * - * @return I Spread from Yield to Work-out - * - * @throws java.lang.Exception Thrown if the I Spread cannot be calculated - */ - - public abstract double iSpreadFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate I Spread from Yield to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Maturity - * - * @return I Spread from Yield to Maturity - * - * @throws java.lang.Exception Thrown if I Spread cannot be calculated - */ - - public abstract double iSpreadFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate I Spread from Yield to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Optimal Exercise - * - * @return I Spread from Yield to Optimal Exercise - * - * @throws java.lang.Exception Thrown if I Spread cannot be calculated - */ - - public abstract double iSpreadFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate I Spread from Yield Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYieldSpread Yield Spread to Work-out - * - * @return I Spread from Yield Spread to Work-out - * - * @throws java.lang.Exception Thrown if the I Spread cannot be calculated - */ - - public abstract double iSpreadFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate I Spread from Yield Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Maturity - * - * @return I Spread from Yield Spread to Maturity - * - * @throws java.lang.Exception Thrown if I Spread cannot be calculated - */ - - public abstract double iSpreadFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate I Spread from Yield Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Optimal Exercise - * - * @return I Spread from Yield Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if I Spread cannot be calculated - */ - - public abstract double iSpreadFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate I Spread from Z Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblZSpread Z Spread to Work-out - * - * @return I Spread from Z Spread to Work-out - * - * @throws java.lang.Exception Thrown if the I Spread cannot be calculated - */ - - public abstract double iSpreadFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate I Spread from Z Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Maturity - * - * @return I Spread from Z Spread to Maturity - * - * @throws java.lang.Exception Thrown if I Spread cannot be calculated - */ - - public abstract double iSpreadFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate I Spread from Z Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Optimal Exercise - * - * @return I Spread from Z Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if I Spread cannot be calculated - */ - - public abstract double iSpreadFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from ASW to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblASW ASW to Work-out - * - * @return Macaulay Duration from ASW to Work-out - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from ASW to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Maturity - * - * @return Macaulay Duration from ASW to Maturity - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from ASW to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Optimal Exercise - * - * @return Macaulay Duration from ASW to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from Bond Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblBondBasis Bond Basis to Work-out - * - * @return Macaulay Duration from Bond Basis to Work-out - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from Bond Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Maturity - * - * @return Macaulay Duration from Bond Basis to Maturity - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from Bond Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Optimal Exercise - * - * @return Macaulay Duration from Bond Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from Credit Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblCreditBasis Credit Basis to Work-out - * - * @return Macaulay Duration from Credit Basis to Work-out - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from Credit Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Maturity - * - * @return Macaulay Duration from Credit Basis to Maturity - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from Credit Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Optimal Exercise - * - * @return Macaulay Duration from Credit Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from Discount Margin to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblDiscountMargin Discount Margin to Work-out - * - * @return Macaulay Duration from Discount Margin to Work-out - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from Discount Margin to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Maturity - * - * @return Macaulay Duration from Discount Margin to Maturity - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from Discount Margin to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Optimal Exercise - * - * @return Macaulay Duration from Discount Margin to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from G Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblGSpread G Spread to Work-out - * - * @return Macaulay Duration from G Spread to Work-out - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from G Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Maturity - * - * @return Macaulay Duration from G Spread to Maturity - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from G Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Optimal Exercise - * - * @return Macaulay Duration from G Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from I Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblISpread I Spread to Work-out - * - * @return Macaulay Duration from I Spread to Work-out - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from I Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Maturity - * - * @return Macaulay Duration from I Spread to Maturity - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from I Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Optimal Exercise - * - * @return Macaulay Duration from I Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from OAS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblOAS OAS to Work-out - * - * @return Macaulay Duration from OAS to Work-out - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from OAS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Maturity - * - * @return Macaulay Duration from OAS to Maturity - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from OAS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Optimal Exercise - * - * @return Macaulay Duration from OAS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double mnacaulayDurationFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from PECS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPECS PECS to Work-out - * - * @return Macaulay Duration from PECS to Work-out - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from PECS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Maturity - * - * @return Macaulay Duration from PECS to Maturity - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from PECS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Optimal Exercise - * - * @return Macaulay Duration from PECS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from Price to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPrice Price to Work-out - * - * @return Macaulay Duration from Price to Work-out - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from Price to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Maturity - * - * @return Macaulay Duration from Price to Maturity - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from Price to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Optimal Exercise - * - * @return Macaulay Duration from Price to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from TSY Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblTSYSpread TSY Spread to Work-out - * - * @return Macaulay Duration from TSY Spread to Work-out - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from TSY Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Maturity - * - * @return Macaulay Duration from TSY Spread to Maturity - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from TSY Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Optimal Exercise - * - * @return Macaulay Duration from TSY Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from Yield to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYield Yield to Work-out - * - * @return Macaulay Duration from Yield to Work-out - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from Yield to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Maturity - * - * @return Macaulay Duration from Yield to Maturity - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from Yield to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Optimal Exercise - * - * @return Macaulay Duration from Yield to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from Yield Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYieldSpread Yield Spread to Work-out - * - * @return Macaulay Duration from Yield Spread to Work-out - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from Yield Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Maturity - * - * @return Macaulay Duration from Yield Spread to Maturity - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from Yield Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Optimal Exercise - * - * @return Macaulay Duration from Yield Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from Z Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblZSpread Z Spread to Work-out - * - * @return Macaulay Duration from Z Spread to Work-out - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from Z Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Maturity - * - * @return Macaulay Duration from Z Spread to Maturity - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Macaulay Duration from Z Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Optimal Exercise - * - * @return Macaulay Duration from Z Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Macaulay Duration cannot be calculated - */ - - public abstract double macaulayDurationFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from ASW to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblASW ASW to Work-out - * - * @return Modified Duration from ASW to Work-out - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from ASW to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Maturity - * - * @return Modified Duration from ASW to Maturity - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from ASW to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Optimal Exercise - * - * @return Modified Duration from ASW to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from Bond Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblBondBasis Bond Basis to Work-out - * - * @return Modified Duration from Bond Basis to Work-out - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from Bond Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Maturity - * - * @return Modified Duration from Bond Basis to Maturity - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from Bond Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Optimal Exercise - * - * @return Modified Duration from Bond Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from Credit Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblCreditBasis Credit Basis to Work-out - * - * @return Modified Duration from Credit Basis to Work-out - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from Credit Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Maturity - * - * @return Modified Duration from Credit Basis to Maturity - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from Credit Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Optimal Exercise - * - * @return Modified Duration from Credit Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from Discount Margin to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblDiscountMargin Discount Margin to Work-out - * - * @return Modified Duration from Discount Margin to Work-out - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from Discount Margin to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Maturity - * - * @return Modified Duration from Discount Margin to Maturity - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from Discount Margin to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Optimal Exercise - * - * @return Modified Duration from Discount Margin to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from G Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblGSpread G Spread to Work-out - * - * @return Modified Duration from G Spread to Work-out - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from G Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Maturity - * - * @return Modified Duration from G Spread to Maturity - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from G Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Optimal Exercise - * - * @return Modified Duration from G Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from I Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblISpread I Spread to Work-out - * - * @return Modified Duration from I Spread to Work-out - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from I Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Maturity - * - * @return Modified Duration from I Spread to Maturity - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from I Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Optimal Exercise - * - * @return Modified Duration from I Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from OAS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblOAS OAS to Work-out - * - * @return Modified Duration from OAS to Work-out - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from OAS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Maturity - * - * @return Modified Duration from OAS to Maturity - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from OAS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Optimal Exercise - * - * @return Modified Duration from OAS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from PECS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPECS PECS to Work-out - * - * @return Modified Duration from PECS to Work-out - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from PECS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Maturity - * - * @return Modified Duration from PECS to Maturity - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from PECS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Optimal Exercise - * - * @return Modified Duration from PECS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from Price to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPrice Price to Work-out - * - * @return Modified Duration from Price to Work-out - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from Price to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Maturity - * - * @return Modified Duration from Price to Maturity - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from Price to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Optimal Exercise - * - * @return Modified Duration from Price to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from TSY Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblTSYSpread TSY Spread to Work-out - * - * @return Modified Duration from TSY Spread to Work-out - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from TSY Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Maturity - * - * @return Modified Duration from TSY Spread to Maturity - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from TSY Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Optimal Exercise - * - * @return Modified Duration from TSY Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from Yield to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYield Yield to Work-out - * - * @return Modified Duration from Yield to Work-out - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from Yield to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Maturity - * - * @return Modified Duration from Yield to Maturity - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from Yield to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Optimal Exercise - * - * @return Modified Duration from Yield to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from Yield Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYieldSpread Yield Spread to Work-out - * - * @return Modified Duration from Yield Spread to Work-out - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from Yield Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Maturity - * - * @return Modified Duration from Yield Spread to Maturity - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from Yield Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Optimal Exercise - * - * @return Modified Duration from Yield Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from Z Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblZSpread Z Spread to Work-out - * - * @return Modified Duration from Z Spread to Work-out - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from Z Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Maturity - * - * @return Modified Duration from Z Spread to Maturity - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Modified Duration from Z Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Optimal Exercise - * - * @return Modified Duration from Z Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Modified Duration cannot be calculated - */ - - public abstract double modifiedDurationFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate OAS from ASW to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblASW ASW to Work-out - * - * @return OAS from ASW to Work-out - * - * @throws java.lang.Exception Thrown if the OAS cannot be calculated - */ - - public abstract double oasFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate OAS from ASW to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Maturity - * - * @return OAS from ASW to Maturity - * - * @throws java.lang.Exception Thrown if OAS cannot be calculated - */ - - public abstract double oasFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate OAS from ASW to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Optimal Exercise - * - * @return OAS from ASW to Optimal Exercise - * - * @throws java.lang.Exception Thrown if OAS cannot be calculated - */ - - public abstract double oasFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate OAS from Bond Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblBondBasis Bond Basis to Work-out - * - * @return OAS from Bond Basis to Work-out - * - * @throws java.lang.Exception Thrown if the OAS cannot be calculated - */ - - public abstract double oasFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate OAS from Bond Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Maturity - * - * @return OAS from Bond Basis to Maturity - * - * @throws java.lang.Exception Thrown if OAS cannot be calculated - */ - - public abstract double oasFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate OAS from Bond Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Optimal Exercise - * - * @return OAS from Bond Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if OAS cannot be calculated - */ - - public abstract double oasFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate OAS from Credit Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblCreditBasis Credit Basis to Work-out - * - * @return OAS from Credit Basis to Work-out - * - * @throws java.lang.Exception Thrown if the OAS cannot be calculated - */ - - public abstract double oasFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate OAS from Credit Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Maturity - * - * @return OAS from Credit Basis to Maturity - * - * @throws java.lang.Exception Thrown if OAS cannot be calculated - */ - - public abstract double oasFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate OAS from Credit Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Optimal Exercise - * - * @return OAS from Credit Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if OAS cannot be calculated - */ - - public abstract double oasFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate OAS from Discount Margin to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblDiscountMargin Discount Margin to Work-out - * - * @return OAS from Discount Margin to Work-out - * - * @throws java.lang.Exception Thrown if the OAS cannot be calculated - */ - - public abstract double oasFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate OAS from Discount Margin to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Maturity - * - * @return OAS from Discount Margin to Maturity - * - * @throws java.lang.Exception Thrown if OAS cannot be calculated - */ - - public abstract double oasFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate OAS from Discount Margin to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Optimal Exercise - * - * @return OAS from Discount Margin to Optimal Exercise - * - * @throws java.lang.Exception Thrown if OAS cannot be calculated - */ - - public abstract double oasFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate OAS from G Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblGSpread G Spread to Work-out - * - * @return OAS from G Spread to Work-out - * - * @throws java.lang.Exception Thrown if the OAS cannot be calculated - */ - - public abstract double oasFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate OAS from G Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Maturity - * - * @return OAS from G Spread to Maturity - * - * @throws java.lang.Exception Thrown if OAS cannot be calculated - */ - - public abstract double oasFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate OAS from G Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Optimal Exercise - * - * @return OAS from G Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if OAS cannot be calculated - */ - - public abstract double oasFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate OAS from I Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblISpread I Spread to Work-out - * - * @return OAS from I Spread to Work-out - * - * @throws java.lang.Exception Thrown if the OAS cannot be calculated - */ - - public abstract double oasFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate OAS from I Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Maturity - * - * @return OAS from I Spread to Maturity - * - * @throws java.lang.Exception Thrown if OAS cannot be calculated - */ - - public abstract double oasFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate OAS from I Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread ISpread to Optimal Exercise - * - * @return OAS from I Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if OAS cannot be calculated - */ - - public abstract double oasFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate OAS from PECS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPECS PECS to Work-out - * - * @return OAS from PECS to Work-out - * - * @throws java.lang.Exception Thrown if the OAS cannot be calculated - */ - - public abstract double oasFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate OAS from PECS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Maturity - * - * @return OAS from PECS to Maturity - * - * @throws java.lang.Exception Thrown if OAS cannot be calculated - */ - - public abstract double oasFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate OAS from PECS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Optimal Exercise - * - * @return OAS from PECS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if OAS cannot be calculated - */ - - public abstract double oasFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate OAS from Price to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPrice Price to Work-out - * - * @return OAS from Price to Work-out - * - * @throws java.lang.Exception Thrown if the OAS cannot be calculated - */ - - public abstract double oasFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate OAS from Price to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Maturity - * - * @return OAS from Price to Maturity - * - * @throws java.lang.Exception Thrown if OAS cannot be calculated - */ - - public abstract double oasFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate OAS from Price to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Optimal Exercise - * - * @return OAS from Price to Optimal Exercise - * - * @throws java.lang.Exception Thrown if OAS cannot be calculated - */ - - public abstract double oasFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate OAS from TSY Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblTSYSpread TSY Spread to Work-out - * - * @return OAS from TSY Spread to Work-out - * - * @throws java.lang.Exception Thrown if the OAS cannot be calculated - */ - - public abstract double oasFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate OAS from TSY Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Maturity - * - * @return OAS from TSY Spread to Maturity - * - * @throws java.lang.Exception Thrown if OAS cannot be calculated - */ - - public abstract double oasFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate OAS from TSY Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Optimal Exercise - * - * @return OAS from TSY Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if OAS cannot be calculated - */ - - public abstract double oasFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate OAS from Yield to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYield Yield to Work-out - * - * @return OAS from Yield to Work-out - * - * @throws java.lang.Exception Thrown if the OAS cannot be calculated - */ - - public abstract double oasFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate OAS from Yield to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Maturity - * - * @return OAS from Yield to Maturity - * - * @throws java.lang.Exception Thrown if OAS cannot be calculated - */ - - public abstract double oasFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate OAS from Yield to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Optimal Exercise - * - * @return OAS from Yield to Optimal Exercise - * - * @throws java.lang.Exception Thrown if OAS cannot be calculated - */ - - public abstract double oasFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate OAS from Yield Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYieldSpread Yield Spread to Work-out - * - * @return OAS from Yield Spread to Work-out - * - * @throws java.lang.Exception Thrown if the OAS cannot be calculated - */ - - public abstract double oasFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate OAS from Yield Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Maturity - * - * @return OAS from Yield Spread to Maturity - * - * @throws java.lang.Exception Thrown if OAS cannot be calculated - */ - - public abstract double oasFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate OAS from Yield Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Optimal Exercise - * - * @return OAS from Yield Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if OAS cannot be calculated - */ - - public abstract double oasFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate OAS from Z Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblZSpread Z Spread to Work-out - * - * @return OAS from Z Spread to Work-out - * - * @throws java.lang.Exception Thrown if the OAS cannot be calculated - */ - - public abstract double oasFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate OAS from Z Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Maturity - * - * @return OAS from Z Spread to Maturity - * - * @throws java.lang.Exception Thrown if OAS cannot be calculated - */ - - public abstract double oasFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate OAS from Z Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Optimal Exercise - * - * @return OAS from Z Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if OAS cannot be calculated - */ - - public abstract double oasFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate PECS from ASW to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblASW ASW to Work-out - * - * @return PECS from ASW to Work-out - * - * @throws java.lang.Exception Thrown if the PECS cannot be calculated - */ - - public abstract double pecsFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate PECS from ASW to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Maturity - * - * @return PECS from ASW to Maturity - * - * @throws java.lang.Exception Thrown if PECS cannot be calculated - */ - - public abstract double pecsFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate PECS from ASW to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Optimal Exercise - * - * @return PECS from ASW to Optimal Exercise - * - * @throws java.lang.Exception Thrown if PECS cannot be calculated - */ - - public abstract double pecsFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate PECS from Bond Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblBondBasis Bond Basis to Work-out - * - * @return PECS from Bond Basis to Work-out - * - * @throws java.lang.Exception Thrown if the PECS cannot be calculated - */ - - public abstract double pecsFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate PECS from Bond Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Maturity - * - * @return PECS from Bond Basis to Maturity - * - * @throws java.lang.Exception Thrown if PECS cannot be calculated - */ - - public abstract double pecsFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate PECS from Bond Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Optimal Exercise - * - * @return PECS from Bond Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if PECS cannot be calculated - */ - - public abstract double pecsFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate PECS from Credit Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblCreditBasis Credit Basis to Work-out - * - * @return PECS from Credit Basis to Work-out - * - * @throws java.lang.Exception Thrown if the PECS cannot be calculated - */ - - public abstract double pecsFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate PECS from Credit Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Maturity - * - * @return PECS from Credit Basis to Maturity - * - * @throws java.lang.Exception Thrown if PECS cannot be calculated - */ - - public abstract double pecsFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate PECS from Credit Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Optimal Exercise - * - * @return PECS from Credit Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if PECS cannot be calculated - */ - - public abstract double pecsFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate PECS from Discount Margin to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblDiscountMargin Discount Margin to Work-out - * - * @return PECS from Discount Margin to Work-out - * - * @throws java.lang.Exception Thrown if the PECS cannot be calculated - */ - - public abstract double pecsFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate PECS from Discount Margin to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Maturity - * - * @return PECS from Discount Margin to Maturity - * - * @throws java.lang.Exception Thrown if PECS cannot be calculated - */ - - public abstract double pecsFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate PECS from Discount Margin to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Optimal Exercise - * - * @return PECS from Discount Margin to Optimal Exercise - * - * @throws java.lang.Exception Thrown if PECS cannot be calculated - */ - - public abstract double pecsFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate PECS from G Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblGSpread G Spread to Work-out - * - * @return PECS from G Spread to Work-out - * - * @throws java.lang.Exception Thrown if the PECS cannot be calculated - */ - - public abstract double pecsFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate PECS from G Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Maturity - * - * @return PECS from G Spread to Maturity - * - * @throws java.lang.Exception Thrown if PECS cannot be calculated - */ - - public abstract double pecsFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate PECS from G Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Optimal Exercise - * - * @return PECS from G Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if PECS cannot be calculated - */ - - public abstract double pecsFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate PECS from I Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblISpread I Spread to Work-out - * - * @return PECS from I Spread to Work-out - * - * @throws java.lang.Exception Thrown if the PECS cannot be calculated - */ - - public abstract double pecsFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate PECS from I Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Maturity - * - * @return PECS from I Spread to Maturity - * - * @throws java.lang.Exception Thrown if PECS cannot be calculated - */ - - public abstract double pecsFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate PECS from I Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread ISpread to Optimal Exercise - * - * @return PECS from I Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if PECS cannot be calculated - */ - - public abstract double pecsFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate PECS from OAS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblOAS OAS to Work-out - * - * @return PECS from OAS to Work-out - * - * @throws java.lang.Exception Thrown if the PECS cannot be calculated - */ - - public abstract double pecsFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate PECS from OAS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Maturity - * - * @return PECS from OAS to Maturity - * - * @throws java.lang.Exception Thrown if PECS cannot be calculated - */ - - public abstract double pecsFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate PECS from OAS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Optimal Exercise - * - * @return PECS from OAS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if PECS cannot be calculated - */ - - public abstract double pecsFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate PECS from Price to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPrice Price to Work-out - * - * @return PECS from Price to Work-out - * - * @throws java.lang.Exception Thrown if the Price cannot be calculated - */ - - public abstract double pecsFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate PECS from Price to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Maturity - * - * @return PECS from Price to Maturity - * - * @throws java.lang.Exception Thrown if PECS cannot be calculated - */ - - public abstract double pecsFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate PECS from Price to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Optimal Exercise - * - * @return PECS from Price to Optimal Exercise - * - * @throws java.lang.Exception Thrown if PECS cannot be calculated - */ - - public abstract double pecsFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate PECS from TSY Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblTSYSpread TSY Spread to Work-out - * - * @return PECS from TSY Spread to Work-out - * - * @throws java.lang.Exception Thrown if the PECS cannot be calculated - */ - - public abstract double pecsFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate PECS from TSY Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Maturity - * - * @return PECS from TSY Spread to Maturity - * - * @throws java.lang.Exception Thrown if PECS cannot be calculated - */ - - public abstract double pecsFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate PECS from TSY Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Optimal Exercise - * - * @return PECS from TSY Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if PECS cannot be calculated - */ - - public abstract double pecsFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate PECS from Yield to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYield Yield to Work-out - * - * @return PECS from Yield to Work-out - * - * @throws java.lang.Exception Thrown if the PECS cannot be calculated - */ - - public abstract double pecsFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate PECS from Yield to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Maturity - * - * @return PECS from Yield to Maturity - * - * @throws java.lang.Exception Thrown if PECS cannot be calculated - */ - - public abstract double pecsFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate PECS from Yield to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Optimal Exercise - * - * @return PECS from Yield to Optimal Exercise - * - * @throws java.lang.Exception Thrown if PECS cannot be calculated - */ - - public abstract double pecsFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate PECS from Yield Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYieldSpread Yield Spread to Work-out - * - * @return PECS from Yield Spread to Work-out - * - * @throws java.lang.Exception Thrown if the PECS cannot be calculated - */ - - public abstract double pecsFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate PECS from Yield Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Maturity - * - * @return PECS from Yield Spread to Maturity - * - * @throws java.lang.Exception Thrown if PECS cannot be calculated - */ - - public abstract double pecsFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate PECS from Yield Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Optimal Exercise - * - * @return PECS from Yield Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if PECS cannot be calculated - */ - - public abstract double pecsFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate PECS from Z Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblZSpread Z Spread to Work-out - * - * @return PECS from Z Spread to Work-out - * - * @throws java.lang.Exception Thrown if the PECS cannot be calculated - */ - - public abstract double pecsFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate PECS from Z Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Maturity - * - * @return PECS from Z Spread to Maturity - * - * @throws java.lang.Exception Thrown if PECS cannot be calculated - */ - - public abstract double pecsFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate PECS from Z Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Optimal Exercise - * - * @return PECS from Z Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if PECS cannot be calculated - */ - - public abstract double pecsFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Price from ASW to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblASW ASW to Work-out - * - * @return Price from ASW to Work-out - * - * @throws java.lang.Exception Thrown if the Price cannot be calculated - */ - - public abstract double priceFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Price from ASW to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Maturity - * - * @return Price from ASW to Maturity - * - * @throws java.lang.Exception Thrown if Price cannot be calculated - */ - - public abstract double priceFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Price from ASW to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Optimal Exercise - * - * @return Price from ASW to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Price cannot be calculated - */ - - public abstract double priceFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Price from Bond Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblBondBasis Bond Basis to Work-out - * - * @return Price from Bond Basis to Work-out - * - * @throws java.lang.Exception Thrown if the Price cannot be calculated - */ - - public abstract double priceFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Price from Bond Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Maturity - * - * @return Price from Bond Basis to Maturity - * - * @throws java.lang.Exception Thrown if Price cannot be calculated - */ - - public abstract double priceFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Price from Bond Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Optimal Exercise - * - * @return Price from Bond Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Price cannot be calculated - */ - - public abstract double priceFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Price from Credit Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblCreditBasis Credit Basis to Work-out - * - * @return Price from Credit Basis to Work-out - * - * @throws java.lang.Exception Thrown if the Price cannot be calculated - */ - - public abstract double priceFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Price from Credit Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Maturity - * - * @return Price from Credit Basis to Maturity - * - * @throws java.lang.Exception Thrown if Price cannot be calculated - */ - - public abstract double priceFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Price from Credit Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Optimal Exercise - * - * @return Price from Credit Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Price cannot be calculated - */ - - public abstract double priceFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Price from Discount Margin to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblDiscountMargin Discount Margin to Work-out - * - * @return Price from Discount Margin to Work-out - * - * @throws java.lang.Exception Thrown if the Price cannot be calculated - */ - - public abstract double priceFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Price from Discount Margin to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Maturity - * - * @return Price from Discount Margin to Maturity - * - * @throws java.lang.Exception Thrown if Price cannot be calculated - */ - - public abstract double priceFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Price from Discount Margin to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Optimal Exercise - * - * @return Price from Discount Margin to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Price cannot be calculated - */ - - public abstract double priceFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Price from G Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblGSpread G Spread to Work-out - * - * @return Price from G Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Price cannot be calculated - */ - - public abstract double priceFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Price from G Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Maturity - * - * @return Price from G Spread to Maturity - * - * @throws java.lang.Exception Thrown if Price cannot be calculated - */ - - public abstract double priceFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Price from G Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Optimal Exercise - * - * @return Price from G Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Price cannot be calculated - */ - - public abstract double priceFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Price from I Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblISpread I Spread to Work-out - * - * @return Price from I Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Price cannot be calculated - */ - - public abstract double priceFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Price from I Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Maturity - * - * @return Price from I Spread to Maturity - * - * @throws java.lang.Exception Thrown if Price cannot be calculated - */ - - public abstract double priceFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Price from I Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread ISpread to Optimal Exercise - * - * @return Price from I Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Price cannot be calculated - */ - - public abstract double priceFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Price from OAS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblOAS OAS to Work-out - * - * @return Price from OAS to Work-out - * - * @throws java.lang.Exception Thrown if the Price cannot be calculated - */ - - public abstract double priceFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Price from OAS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Maturity - * - * @return Price from OAS to Maturity - * - * @throws java.lang.Exception Thrown if Price cannot be calculated - */ - - public abstract double priceFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Price from OAS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Optimal Exercise - * - * @return Price from OAS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Price cannot be calculated - */ - - public abstract double priceFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Price from PECS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPECS PECS to Work-out - * - * @return Price from PECS to Work-out - * - * @throws java.lang.Exception Thrown if the PECS cannot be calculated - */ - - public abstract double priceFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Price from PECS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Maturity - * - * @return Price from PECS to Maturity - * - * @throws java.lang.Exception Thrown if Price cannot be calculated - */ - - public abstract double priceFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Price from PECS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Optimal Exercise - * - * @return Price from PECS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Price cannot be calculated - */ - - public abstract double priceFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Price from TSY Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblTSYSpread TSY Spread to Work-out - * - * @return Price from TSY Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Price cannot be calculated - */ - - public abstract double priceFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Price from TSY Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Maturity - * - * @return Price from TSY Spread to Maturity - * - * @throws java.lang.Exception Thrown if Price cannot be calculated - */ - - public abstract double priceFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Price from TSY Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Optimal Exercise - * - * @return Price from TSY Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Price cannot be calculated - */ - - public abstract double priceFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Price from Yield to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYield Yield to Work-out - * - * @return Price from Yield to Work-out - * - * @throws java.lang.Exception Thrown if the Price cannot be calculated - */ - - public abstract double priceFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Price from Yield to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Maturity - * - * @return Price from Yield to Maturity - * - * @throws java.lang.Exception Thrown if Price cannot be calculated - */ - - public abstract double priceFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Price from Yield to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Optimal Exercise - * - * @return Price from Yield to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Price cannot be calculated - */ - - public abstract double priceFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Price from Yield Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYieldSpread Yield Spread to Work-out - * - * @return Price from Yield Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Price cannot be calculated - */ - - public abstract double priceFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Price from Yield Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Maturity - * - * @return Price from Yield Spread to Maturity - * - * @throws java.lang.Exception Thrown if Price cannot be calculated - */ - - public abstract double priceFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Price from Yield Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Optimal Exercise - * - * @return Price from Yield Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Price cannot be calculated - */ - - public abstract double priceFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Price from Z Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblZSpread Z Spread to Work-out - * - * @return Price from Z Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Price cannot be calculated - */ - - public abstract double priceFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Price from Z Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Maturity - * - * @return Price from Z Spread to Maturity - * - * @throws java.lang.Exception Thrown if Price cannot be calculated - */ - - public abstract double priceFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Price from Z Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Optimal Exercise - * - * @return Price from Z Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Price cannot be calculated - */ - - public abstract double priceFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from ASW to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblASW ASW to Work-out - * - * @return TSY Spread from ASW to Work-out - * - * @throws java.lang.Exception Thrown if the TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from ASW to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Maturity - * - * @return TSY Spread from ASW to Maturity - * - * @throws java.lang.Exception Thrown if TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from ASW to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Optimal Exercise - * - * @return TSY Spread from ASW to Optimal Exercise - * - * @throws java.lang.Exception Thrown if TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from Bond Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblBondBasis Bond Basis to Work-out - * - * @return TSY Spread from Bond Basis to Work-out - * - * @throws java.lang.Exception Thrown if the TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from Bond Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Maturity - * - * @return TSY Spread from Bond Basis to Maturity - * - * @throws java.lang.Exception Thrown if TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from Bond Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Optimal Exercise - * - * @return TSY Spread from Bond Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from Credit Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblCreditBasis Credit Basis to Work-out - * - * @return TSY Spread from Credit Basis to Work-out - * - * @throws java.lang.Exception Thrown if the TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from Credit Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Maturity - * - * @return TSY Spread from Credit Basis to Maturity - * - * @throws java.lang.Exception Thrown if TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from Credit Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Optimal Exercise - * - * @return TSY Spread from Credit Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from Discount Margin to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblDiscountMargin Discount Margin to Work-out - * - * @return TSY Spread from Discount Margin to Work-out - * - * @throws java.lang.Exception Thrown if the TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from Discount Margin to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Maturity - * - * @return TSY Spread from Discount Margin to Maturity - * - * @throws java.lang.Exception Thrown if TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from Discount Margin to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Optimal Exercise - * - * @return TSY Spread from Discount Margin to Optimal Exercise - * - * @throws java.lang.Exception Thrown if TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from I Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblISpread I Spread to Work-out - * - * @return TSY Spread from I Spread to Work-out - * - * @throws java.lang.Exception Thrown if the TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from I Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Maturity - * - * @return TSY Spread from I Spread to Maturity - * - * @throws java.lang.Exception Thrown if TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from I Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Optimal Exercise - * - * @return TSY Spread from I Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from G Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblGSpread G Spread to Work-out - * - * @return TSY Spread from G Spread to Work-out - * - * @throws java.lang.Exception Thrown if the TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from G Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Maturity - * - * @return TSY Spread from G Spread to Maturity - * - * @throws java.lang.Exception Thrown if TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from G Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Optimal Exercise - * - * @return TSY Spread from G Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from OAS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblOAS OAS to Work-out - * - * @return TSY Spread from OAS to Work-out - * - * @throws java.lang.Exception Thrown if the TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from OAS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Maturity - * - * @return TSY Spread from OAS to Maturity - * - * @throws java.lang.Exception Thrown if TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from OAS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Optimal Exercise - * - * @return TSY Spread from OAS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from PECS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPECS PECS to Work-out - * - * @return TSY Spread from PECS to Work-out - * - * @throws java.lang.Exception Thrown if the TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from PECS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Maturity - * - * @return TSY Spread from PECS to Maturity - * - * @throws java.lang.Exception Thrown if TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from PECS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Optimal Exercise - * - * @return TSY Spread from PECS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from Price to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPrice Price to Work-out - * - * @return TSY Spread from Price to Work-out - * - * @throws java.lang.Exception Thrown if the TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from Price to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Maturity - * - * @return TSY Spread from Price to Maturity - * - * @throws java.lang.Exception Thrown if TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from Price to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Optimal Exercise - * - * @return TSY Spread from Price to Optimal Exercise - * - * @throws java.lang.Exception Thrown if TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from Yield to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYield Yield to Work-out - * - * @return TSY Spread from Yield to Work-out - * - * @throws java.lang.Exception Thrown if the TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from Yield to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Maturity - * - * @return TSY Spread from Yield to Maturity - * - * @throws java.lang.Exception Thrown if TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from Yield to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Optimal Exercise - * - * @return TSY Spread from Yield to Optimal Exercise - * - * @throws java.lang.Exception Thrown if TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from Yield Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYieldSpread Yield Spread to Work-out - * - * @return TSY Spread from Yield Spread to Work-out - * - * @throws java.lang.Exception Thrown if the TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from Yield Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Maturity - * - * @return TSY Spread from Yield Spread to Maturity - * - * @throws java.lang.Exception Thrown if TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from Yield Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Optimal Exercise - * - * @return TSY Spread from Yield Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from Z Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblZSpread Z Spread to Work-out - * - * @return TSY Spread from Z Spread to Work-out - * - * @throws java.lang.Exception Thrown if the TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from Z Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Maturity - * - * @return TSY Spread from Z Spread to Maturity - * - * @throws java.lang.Exception Thrown if TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate TSY Spread from Z Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Optimal Exercise - * - * @return TSY Spread from Z Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if TSY Spread cannot be calculated - */ - - public abstract double tsySpreadFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Yield from ASW to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblASW ASW to Work-out - * - * @return Yield from ASW to Work-out - * - * @throws java.lang.Exception Thrown if the Yield cannot be calculated - */ - - public abstract double yieldFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Yield from ASW to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Maturity - * - * @return Yield from ASW to Maturity - * - * @throws java.lang.Exception Thrown if Yield cannot be calculated - */ - - public abstract double yieldFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Yield from ASW to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Optimal Exercise - * - * @return Yield from ASW to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield cannot be calculated - */ - - public abstract double yieldFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Yield from Bond Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblBondBasis Bond Basis to Work-out - * - * @return Yield from Bond Basis to Work-out - * - * @throws java.lang.Exception Thrown if the Yield cannot be calculated - */ - - public abstract double yieldFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Yield from Bond Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Maturity - * - * @return Yield from Bond Basis to Maturity - * - * @throws java.lang.Exception Thrown if Yield cannot be calculated - */ - - public abstract double yieldFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Yield from Bond Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Optimal Exercise - * - * @return Yield from Bond Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield cannot be calculated - */ - - public abstract double yieldFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Yield from Credit Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblCreditBasis Credit Basis to Work-out - * - * @return Yield from Credit Basis to Work-out - * - * @throws java.lang.Exception Thrown if the Yield cannot be calculated - */ - - public abstract double yieldFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Yield from Credit Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Maturity - * - * @return Yield from Credit Basis to Maturity - * - * @throws java.lang.Exception Thrown if Yield cannot be calculated - */ - - public abstract double yieldFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Yield from Credit Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Optimal Exercise - * - * @return Yield from Credit Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield cannot be calculated - */ - - public abstract double yieldFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Yield from Discount Margin to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblDiscountMargin Discount Margin to Work-out - * - * @return Yield from Discount Margin to Work-out - * - * @throws java.lang.Exception Thrown if the Yield cannot be calculated - */ - - public abstract double yieldFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Yield from Discount Margin to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Maturity - * - * @return Yield from Discount Margin to Maturity - * - * @throws java.lang.Exception Thrown if Yield cannot be calculated - */ - - public abstract double yieldFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Yield from Discount Margin to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Optimal Exercise - * - * @return Yield from Discount Margin to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield cannot be calculated - */ - - public abstract double yieldFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Yield from G Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblGSpread G Spread to Work-out - * - * @return Yield from G Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Yield cannot be calculated - */ - - public abstract double yieldFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Yield from G Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Maturity - * - * @return Yield from G Spread to Maturity - * - * @throws java.lang.Exception Thrown if Yield cannot be calculated - */ - - public abstract double yieldFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Yield from G Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Optimal Exercise - * - * @return Yield from G Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield cannot be calculated - */ - - public abstract double yieldFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Yield from I Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblISpread I Spread to Work-out - * - * @return Yield from I Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Yield cannot be calculated - */ - - public abstract double yieldFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Yield from I Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Maturity - * - * @return Yield from I Spread to Maturity - * - * @throws java.lang.Exception Thrown if Yield cannot be calculated - */ - - public abstract double yieldFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Yield from I Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread ISpread to Optimal Exercise - * - * @return Yield from I Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield cannot be calculated - */ - - public abstract double yieldFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Yield from OAS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblOAS OAS to Work-out - * - * @return Yield from OAS to Work-out - * - * @throws java.lang.Exception Thrown if the Yield cannot be calculated - */ - - public abstract double yieldFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Yield from OAS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Maturity - * - * @return Yield from OAS to Maturity - * - * @throws java.lang.Exception Thrown if Yield cannot be calculated - */ - - public abstract double yieldFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Yield from OAS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Optimal Exercise - * - * @return Yield from OAS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield cannot be calculated - */ - - public abstract double yieldFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Yield from PECS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPECS PECS to Work-out - * - * @return Yield from PECS to Work-out - * - * @throws java.lang.Exception Thrown if the Yield cannot be calculated - */ - - public abstract double yieldFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Yield from PECS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Maturity - * - * @return Yield from PECS to Maturity - * - * @throws java.lang.Exception Thrown if Yield cannot be calculated - */ - - public abstract double yieldFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Yield from PECS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Optimal Exercise - * - * @return Yield from PECS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield cannot be calculated - */ - - public abstract double yieldFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Yield from Price to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPrice Price to Work-out - * - * @return Yield from Price to Work-out - * - * @throws java.lang.Exception Thrown if the Yield cannot be calculated - */ - - public abstract double yieldFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Yield from Price to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Maturity - * - * @return Yield from Price to Maturity - * - * @throws java.lang.Exception Thrown if Yield cannot be calculated - */ - - public abstract double yieldFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Yield from Price to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Optimal Exercise - * - * @return Yield from Price to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield cannot be calculated - */ - - public abstract double yieldFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Yield from TSY Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblTSYSpread TSY Spread to Work-out - * - * @return Yield from TSY Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Yield cannot be calculated - */ - - public abstract double yieldFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Yield from TSY Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Maturity - * - * @return Yield from TSY Spread to Maturity - * - * @throws java.lang.Exception Thrown if Yield cannot be calculated - */ - - public abstract double yieldFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Yield from TSY Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Optimal Exercise - * - * @return Yield from TSY Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield cannot be calculated - */ - - public abstract double yieldFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Yield from Yield Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYieldSpread Yield Spread to Work-out - * - * @return Yield from Yield Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Yield cannot be calculated - */ - - public abstract double yieldFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Yield from Yield Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Maturity - * - * @return Yield from Yield Spread to Maturity - * - * @throws java.lang.Exception Thrown if Yield cannot be calculated - */ - - public abstract double yieldFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Yield from Yield Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Optimal Exercise - * - * @return Yield from Yield Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield cannot be calculated - */ - - public abstract double yieldFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Yield from Z Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblZSpread Z Spread to Work-out - * - * @return Yield from Z Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Yield cannot be calculated - */ - - public abstract double yieldFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Yield from Z Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Maturity - * - * @return Yield from Z Spread to Maturity - * - * @throws java.lang.Exception Thrown if Yield cannot be calculated - */ - - public abstract double yieldFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Yield from Z Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Optimal Exercise - * - * @return Yield from Z Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield cannot be calculated - */ - - public abstract double yieldFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Yield01 from ASW to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblASW ASW to Work-out - * - * @return Yield01 from ASW to Work-out - * - * @throws java.lang.Exception Thrown if the Yield01 cannot be calculated - */ - - public abstract double yield01FromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Yield01 from ASW to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Maturity - * - * @return Yield01 from ASW to Maturity - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Yield01 from ASW to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Optimal Exercise - * - * @return Yield01 from ASW to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Yield01 from Bond Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblBondBasis Bond Basis to Work-out - * - * @return Yield01 from Bond Basis to Work-out - * - * @throws java.lang.Exception Thrown if the Yield01 cannot be calculated - */ - - public abstract double yield01FromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Yield01 from Bond Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Maturity - * - * @return Yield01 from Bond Basis to Maturity - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Yield01 from Bond Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Optimal Exercise - * - * @return Yield01 from Bond Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Yield01 from Credit Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblCreditBasis Credit Basis to Work-out - * - * @return Yield01 from Credit Basis to Work-out - * - * @throws java.lang.Exception Thrown if the Yield01 cannot be calculated - */ - - public abstract double yield01FromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Yield01 from Credit Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Maturity - * - * @return Yield01 from Credit Basis to Maturity - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Yield01 from Credit Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Optimal Exercise - * - * @return Yield01 from Credit Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Yield01 from Discount Margin to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblDiscountMargin Discount Margin to Work-out - * - * @return Yield01 from Discount Margin to Work-out - * - * @throws java.lang.Exception Thrown if the Yield01 cannot be calculated - */ - - public abstract double yield01FromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Yield01 from Discount Margin to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Maturity - * - * @return Yield01 from Discount Margin to Maturity - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Yield01 from Discount Margin to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Optimal Exercise - * - * @return Yield01 from Discount Margin to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Yield01 from G Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblGSpread G Spread to Work-out - * - * @return Yield01 from G Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Yield01 cannot be calculated - */ - - public abstract double yield01FromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Yield01 from G Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Maturity - * - * @return Yield01 from G Spread to Maturity - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Yield01 from G Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Optimal Exercise - * - * @return Yield01 from G Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Yield01 from I Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblISpread I Spread to Work-out - * - * @return Yield01 from I Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Yield01 cannot be calculated - */ - - public abstract double yield01FromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Yield01 from I Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Maturity - * - * @return Yield01 from I Spread to Maturity - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Yield01 from I Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread ISpread to Optimal Exercise - * - * @return Yield01 from I Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Yield01 from OAS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblOAS OAS to Work-out - * - * @return Yield01 from OAS to Work-out - * - * @throws java.lang.Exception Thrown if the Yield01 cannot be calculated - */ - - public abstract double yield01FromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Yield01 from OAS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Maturity - * - * @return Yield01 from OAS to Maturity - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Yield01 from OAS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Optimal Exercise - * - * @return Yield01 from OAS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Yield01 from PECS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPECS PECS to Work-out - * - * @return Yield01 from PECS to Work-out - * - * @throws java.lang.Exception Thrown if the Yield01 cannot be calculated - */ - - public abstract double yield01FromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Yield01 from PECS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Maturity - * - * @return Yield01 from PECS to Maturity - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Yield01 from PECS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Optimal Exercise - * - * @return Yield01 from PECS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Yield01 from Price to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPrice Price to Work-out - * - * @return Yield01 from Price to Work-out - * - * @throws java.lang.Exception Thrown if the Yield01 cannot be calculated - */ - - public abstract double yield01FromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Yield01 from Price to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Maturity - * - * @return Yield01 from Price to Maturity - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Yield01 from Price to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Optimal Exercise - * - * @return Yield01 from Price to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Yield01 from TSY Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblTSYSpread TSY Spread to Work-out - * - * @return Yield01 from TSY Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Yield01 cannot be calculated - */ - - public abstract double yield01FromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Yield01 from TSY Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Maturity - * - * @return Yield01 from TSY Spread to Maturity - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Yield01 from TSY Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Optimal Exercise - * - * @return Yield01 from TSY Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Yield01 from Yield to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYield Yield to Work-out - * - * @return Yield01 from Yield to Work-out - * - * @throws java.lang.Exception Thrown if the Yield01 cannot be calculated - */ - - public abstract double yield01FromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Yield01 from Yield to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Maturity - * - * @return Yield01 from Yield to Maturity - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Yield01 from Yield to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Optimal Exercise - * - * @return Yield01 from Yield to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Yield01 from Yield Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYieldSpread Yield Spread to Work-out - * - * @return Yield01 from Yield Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Yield01 cannot be calculated - */ - - public abstract double yield01FromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Yield01 from Yield Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Maturity - * - * @return Yield01 from Yield Spread to Maturity - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Yield01 from Yield Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Optimal Exercise - * - * @return Yield01 from Yield Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Yield01 from Z Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblZSpread Z Spread to Work-out - * - * @return Yield01 from Z Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Yield01 cannot be calculated - */ - - public abstract double yield01FromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Yield01 from Z Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Maturity - * - * @return Yield01 from Z Spread to Maturity - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Yield01 from Z Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Optimal Exercise - * - * @return Yield01 from Z Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield01 cannot be calculated - */ - - public abstract double yield01FromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from ASW to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblASW ASW to Work-out - * - * @return Yield Spread from ASW to Work-out - * - * @throws java.lang.Exception Thrown if the Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from ASW to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Maturity - * - * @return Yield Spread from ASW to Maturity - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from ASW to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Optimal Exercise - * - * @return Yield Spread from ASW to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from Bond Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblBondBasis Bond Basis to Work-out - * - * @return Yield Spread from Bond Basis to Work-out - * - * @throws java.lang.Exception Thrown if the Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from Bond Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Maturity - * - * @return Yield Spread from Bond Basis to Maturity - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from Bond Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Optimal Exercise - * - * @return Yield Spread from Bond Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from Credit Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblCreditBasis Credit Basis to Work-out - * - * @return Yield Spread from Credit Basis to Work-out - * - * @throws java.lang.Exception Thrown if the Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from Credit Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Maturity - * - * @return Yield Spread from Credit Basis to Maturity - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from Credit Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Optimal Exercise - * - * @return Yield Spread from Credit Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from Discount Margin to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblDiscountMargin Discount Margin to Work-out - * - * @return Yield Spread from Discount Margin to Work-out - * - * @throws java.lang.Exception Thrown if the Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from Discount Margin to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Maturity - * - * @return Yield Spread from Discount Margin to Maturity - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from Discount Margin to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Optimal Exercise - * - * @return Yield Spread from Discount Margin to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from G Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblGSpread G Spread to Work-out - * - * @return Yield Spread from G Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from G Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Maturity - * - * @return Yield Spread from G Spread to Maturity - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from G Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Optimal Exercise - * - * @return Yield Spread from G Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from I Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblISpread I Spread to Work-out - * - * @return Yield Spread from I Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from I Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Maturity - * - * @return Yield Spread from I Spread to Maturity - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from I Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread ISpread to Optimal Exercise - * - * @return Yield Spread from I Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from OAS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblOAS OAS to Work-out - * - * @return Yield Spread from OAS to Work-out - * - * @throws java.lang.Exception Thrown if the Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from OAS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Maturity - * - * @return Yield Spread from OAS to Maturity - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from OAS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Optimal Exercise - * - * @return Yield Spread from OAS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from Price to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPrice Price to Work-out - * - * @return Yield Spread from Price to Work-out - * - * @throws java.lang.Exception Thrown if the Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from Price to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Maturity - * - * @return Yield Spread from Price to Maturity - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from Price to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Optimal Exercise - * - * @return Yield Spread from Price to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from PECS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPECS PECS to Work-out - * - * @return Yield Spread from PECS to Work-out - * - * @throws java.lang.Exception Thrown if the Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from PECS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Maturity - * - * @return Yield Spread from PECS to Maturity - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from PECS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Optimal Exercise - * - * @return Yield Spread from PECS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from TSY Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblTSYSpread TSY Spread to Work-out - * - * @return Yield Spread from TSY Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from TSY Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Maturity - * - * @return Yield Spread from TSY Spread to Maturity - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from TSY Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Optimal Exercise - * - * @return Yield Spread from TSY Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from Yield to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYield Yield to Work-out - * - * @return Yield Spread from Yield to Work-out - * - * @throws java.lang.Exception Thrown if the Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from Yield to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Maturity - * - * @return Yield Spread from Yield to Maturity - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from Yield to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Optimal Exercise - * - * @return Yield Spread from Yield to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from Z Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblZSpread Z Spread to Work-out - * - * @return Yield Spread from Z Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from Z Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Maturity - * - * @return Yield Spread from Z Spread to Maturity - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromZSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Yield Spread from Z Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblZSpread Z Spread to Optimal Exercise - * - * @return Yield Spread from Z Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double yieldSpreadFromZSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblZSpread) - throws java.lang.Exception; - - /** - * Calculate Z Spread from ASW to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblASW ASW to Work-out - * - * @return Z Spread from ASW to Work-out - * - * @throws java.lang.Exception Thrown if the Z Spread cannot be calculated - */ - - public abstract double zspreadFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Z Spread from ASW to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Maturity - * - * @return Z Spread from ASW to Maturity - * - * @throws java.lang.Exception Thrown if Z Spread cannot be calculated - */ - - public abstract double zspreadFromASW ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Z Spread from ASW to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblASW ASW to Optimal Exercise - * - * @return Z Spread from ASW to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Z Spread cannot be calculated - */ - - public abstract double zspreadFromASWToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblASW) - throws java.lang.Exception; - - /** - * Calculate Z Spread from Bond Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblBondBasis Bond Basis to Work-out - * - * @return Z Spread from Bond Basis to Work-out - * - * @throws java.lang.Exception Thrown if the Z Spread cannot be calculated - */ - - public abstract double zspreadFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Z Spread from Bond Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Maturity - * - * @return Z Spread from Bond Basis to Maturity - * - * @throws java.lang.Exception Thrown if Z Spread cannot be calculated - */ - - public abstract double zspreadFromBondBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Z Spread from Bond Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblBondBasis Bond Basis to Optimal Exercise - * - * @return Z Spread from Bond Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Z Spread cannot be calculated - */ - - public abstract double zspreadFromBondBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblBondBasis) - throws java.lang.Exception; - - /** - * Calculate Z Spread from Credit Basis to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblCreditBasis Credit Basis to Work-out - * - * @return Z Spread from Credit Basis to Work-out - * - * @throws java.lang.Exception Thrown if the Z Spread cannot be calculated - */ - - public abstract double zspreadFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Z Spread from Credit Basis to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Maturity - * - * @return Z Spread from Credit Basis to Maturity - * - * @throws java.lang.Exception Thrown if Z Spread cannot be calculated - */ - - public abstract double zspreadFromCreditBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Z Spread from Credit Basis to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblCreditBasis Credit Basis to Optimal Exercise - * - * @return Z Spread from Credit Basis to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Z Spread cannot be calculated - */ - - public abstract double zspreadFromCreditBasisToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCreditBasis) - throws java.lang.Exception; - - /** - * Calculate Z Spread from Discount Margin to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblDiscountMargin Discount Margin to Work-out - * - * @return Z Spread from Discount Margin to Work-out - * - * @throws java.lang.Exception Thrown if the Z Spread cannot be calculated - */ - - public abstract double zspreadFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Z Spread from Discount Margin to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Maturity - * - * @return Z Spread from Discount Margin to Maturity - * - * @throws java.lang.Exception Thrown if Z Spread cannot be calculated - */ - - public abstract double zspreadFromDiscountMargin ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Z Spread from Discount Margin to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblDiscountMargin Discount Margin to Optimal Exercise - * - * @return Z Spread from Discount Margin to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Z Spread cannot be calculated - */ - - public abstract double zspreadFromDiscountMarginToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblDiscountMargin) - throws java.lang.Exception; - - /** - * Calculate Z Spread from G Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblGSpread G Spread to Work-out - * - * @return Z Spread from G Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Z Spread cannot be calculated - */ - - public abstract double zspreadFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Z Spread from G Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Maturity - * - * @return Z Spread from G Spread to Maturity - * - * @throws java.lang.Exception Thrown if Z Spread cannot be calculated - */ - - public abstract double zspreadFromGSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Z Spread from G Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblGSpread G Spread to Optimal Exercise - * - * @return Z Spread from G Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Z Spread cannot be calculated - */ - - public abstract double zspreadFromGSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblGSpread) - throws java.lang.Exception; - - /** - * Calculate Z Spread from I Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblISpread I Spread to Work-out - * - * @return Z Spread from I Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Z Spread cannot be calculated - */ - - public abstract double zspreadFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Z Spread from I Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread I Spread to Maturity - * - * @return Z Spread from I Spread to Maturity - * - * @throws java.lang.Exception Thrown if Z Spread cannot be calculated - */ - - public abstract double zspreadFromISpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Z Spread from I Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblISpread ISpread to Optimal Exercise - * - * @return Z Spread from I Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Z Spread cannot be calculated - */ - - public abstract double zspreadFromISpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblISpread) - throws java.lang.Exception; - - /** - * Calculate Z Spread from OAS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblOAS OAS to Work-out - * - * @return Z Spread from OAS to Work-out - * - * @throws java.lang.Exception Thrown if the Z Spread cannot be calculated - */ - - public abstract double zspreadFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Z Spread from OAS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Maturity - * - * @return Z Spread from OAS to Maturity - * - * @throws java.lang.Exception Thrown if Z Spread cannot be calculated - */ - - public abstract double zspreadFromOAS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Z Spread from OAS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblOAS OAS to Optimal Exercise - * - * @return Z Spread from OAS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Z Spread cannot be calculated - */ - - public abstract double zspreadFromOASToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblOAS) - throws java.lang.Exception; - - /** - * Calculate Z Spread from Price to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPrice Price to Work-out - * - * @return Z Spread from Price to Work-out - * - * @throws java.lang.Exception Thrown if the Z Spread cannot be calculated - */ - - public abstract double zspreadFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Z Spread from Price to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Maturity - * - * @return Z Spread from Price to Maturity - * - * @throws java.lang.Exception Thrown if Z Spread cannot be calculated - */ - - public abstract double zspreadFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Z Spread from Price to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPrice Price to Optimal Exercise - * - * @return Z Spread from Price to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Z Spread cannot be calculated - */ - - public abstract double zspreadFromPriceToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPrice) - throws java.lang.Exception; - - /** - * Calculate Z Spread from PECS to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblPECS PECS to Work-out - * - * @return Z Spread from PECS to Work-out - * - * @throws java.lang.Exception Thrown if the Z Spread cannot be calculated - */ - - public abstract double zspreadFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Z Spread from PECS to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Maturity - * - * @return Z Spread from PECS to Maturity - * - * @throws java.lang.Exception Thrown if Z Spread cannot be calculated - */ - - public abstract double zspreadFromPECS ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Z Spread from PECS to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblPECS PECS to Optimal Exercise - * - * @return Z Spread from PECS to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Z Spread cannot be calculated - */ - - public abstract double zspreadFromPECSToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblPECS) - throws java.lang.Exception; - - /** - * Calculate Z Spread from TSY Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblTSYSpread TSY Spread to Work-out - * - * @return Z Spread from TSY Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Z Spread cannot be calculated - */ - - public abstract double zspreadFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Z Spread from TSY Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Maturity - * - * @return Z Spread from TSY Spread to Maturity - * - * @throws java.lang.Exception Thrown if Z Spread cannot be calculated - */ - - public abstract double zspreadFromTSYSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Z Spread from TSY Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblTSYSpread TSY Spread to Optimal Exercise - * - * @return Z Spread from TSY Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Z Spread cannot be calculated - */ - - public abstract double zspreadFromTSYSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblTSYSpread) - throws java.lang.Exception; - - /** - * Calculate Z Spread from Yield to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYield Yield to Work-out - * - * @return Z Spread from Yield to Work-out - * - * @throws java.lang.Exception Thrown if the Z Spread cannot be calculated - */ - - public abstract double zspreadFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Z Spread from Yield to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Maturity - * - * @return Z Spread from Yield to Maturity - * - * @throws java.lang.Exception Thrown if Z Spread cannot be calculated - */ - - public abstract double zspreadFromYield ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Z Spread from Yield to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYield Yield to Optimal Exercise - * - * @return Z Spread from Yield to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Z Spread cannot be calculated - */ - - public abstract double zspreadFromYieldToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYield) - throws java.lang.Exception; - - /** - * Calculate Z Spread from Yield Spread to Work-out - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param iWorkoutDate Work-out Date - * @param dblWorkoutFactor Work-out Factor - * @param dblYieldSpread Yield Spread to Work-out - * - * @return Z Spread from Yield Spread to Work-out - * - * @throws java.lang.Exception Thrown if the Z Spread cannot be calculated - */ - - public abstract double zspreadFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final int iWorkoutDate, - final double dblWorkoutFactor, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Z Spread from Yield Spread to Maturity - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Maturity - * - * @return Z Spread from Yield Spread to Maturity - * - * @throws java.lang.Exception Thrown if Z Spread cannot be calculated - */ - - public abstract double zspreadFromYieldSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate Z Spread from Yield Spread to Optimal Exercise - * - * @param valParams Valuation Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblYieldSpread Yield Spread to Optimal Exercise - * - * @return Z Spread from Yield Spread to Optimal Exercise - * - * @throws java.lang.Exception Thrown if Yield Spread cannot be calculated - */ - - public abstract double zspreadFromYieldSpreadToOptimalExercise ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblYieldSpread) - throws java.lang.Exception; - - /** - * Calculate the full set of Bond RV Measures from the Price Input - * - * @param valParams ValuationParams - * @param pricerParams Pricing Parameters - * @param csqs Bond market parameters - * @param vcp Valuation Customization Parameters - * @param wi Work out Information - * @param dblPrice Input Price - * - * @return Bond RV Measure Set - */ - - public abstract org.drip.analytics.output.BondRVMeasures standardMeasures ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.param.valuation.WorkoutInfo wi, - final double dblPrice); - - /** - * Display all the coupon periods onto stdout - * - * @throws java.lang.Exception Thrown if the coupon periods cannot be displayed onto stdout - */ - - public abstract void showPeriods() - throws java.lang.Exception; -} diff --git a/org/drip/product/definition/BondProduct.java b/org/drip/product/definition/BondProduct.java deleted file mode 100644 index be34bcf..0000000 --- a/org/drip/product/definition/BondProduct.java +++ /dev/null @@ -1,266 +0,0 @@ - -package org.drip.product.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * BondProduct interface implements the product static data behind bonds of all kinds. Bond static data is - * captured in a set of 11 container classes – BondTSYParams, BondCouponParams, BondNotionalParams, - * BondFloaterParams, BondCurrencyParams, BondIdentifierParams, ComponentValuationParams, - * ComponentRatesValuationParams, ComponentCreditValuationParams, ComponentTerminationEvent, - * BondFixedPeriodParams, and one EmbeddedOptionSchedule object instance each for the call and the put - * objects. Each of these parameter sets can be set separately. - * - * @author Lakshmi Krishnamurthy - */ - -public interface BondProduct { - - /** - * Set the bond treasury benchmark Set - * - * @param tsyBmkSet Bond treasury benchmark Set - * - * @return TRUE if succeeded - */ - - public abstract boolean setTreasuryBenchmark ( - final org.drip.product.params.TreasuryBenchmarks tsyBmkSet - ); - - /** - * Retrieve the bond treasury benchmark Set - * - * @return Bond treasury benchmark Set - */ - - public abstract org.drip.product.params.TreasuryBenchmarks treasuryBenchmark(); - - /** - * Set the bond identifier set - * - * @param idSet Bond identifier set - * - * @return True if succeeded - */ - - public abstract boolean setIdentifierSet ( - final org.drip.product.params.IdentifierSet idSet - ); - - /** - * Retrieve the bond identifier set - * - * @return Bond identifier set - */ - - public abstract org.drip.product.params.IdentifierSet identifierSet(); - - /** - * Set the bond coupon setting - * - * @param cpnSetting Bond coupon setting - * - * @return True if succeeded - */ - - public abstract boolean setCouponSetting ( - final org.drip.product.params.CouponSetting cpnSetting - ); - - /** - * Retrieve the bond coupon setting - * - * @return Bond Coupon setting - */ - - public abstract org.drip.product.params.CouponSetting couponSetting(); - - /** - * Set the bond floater setting - * - * @param fltSetting Bond floater setting - * - * @return True if succeeded - */ - - public abstract boolean setFloaterSetting ( - final org.drip.product.params.FloaterSetting fltSetting - ); - - /** - * Retrieve the bond floater setting - * - * @return Bond Floater setting - */ - - public abstract org.drip.product.params.FloaterSetting floaterSetting(); - - /** - * Set the Bond's Market Convention - * - * @param mktConv Bond's Market Convention - * - * @return True if succeeded - */ - - public abstract boolean setMarketConvention ( - final org.drip.product.params.QuoteConvention mktConv - ); - - /** - * Retrieve the Bond's Market Convention - * - * @return Bond's Market Convention - */ - - public abstract org.drip.product.params.QuoteConvention marketConvention(); - - /** - * Set the bond Credit Setting - * - * @param creditSetting Bond credit Setting - * - * @return True if succeeded - */ - - public abstract boolean setCreditSetting ( - final org.drip.product.params.CreditSetting creditSetting - ); - - /** - * Retrieve the bond credit Setting - * - * @return Bond credit Setting - */ - - public abstract org.drip.product.params.CreditSetting creditSetting(); - - /** - * Set the bond termination setting - * - * @param termSetting Bond termination setting - * - * @return True if succeeded - */ - - public abstract boolean setTerminationSetting ( - final org.drip.product.params.TerminationSetting termSetting - ); - - /** - * Retrieve the bond termination setting - * - * @return Bond termination setting - */ - - public abstract org.drip.product.params.TerminationSetting terminationSetting(); - - /** - * Set the bond Stream - * - * @param stream Bond Stream - * - * @return True if succeeded - */ - - public abstract boolean setStream ( - final org.drip.product.params.BondStream stream - ); - - /** - * Retrieve the Bond Stream - * - * @return Bond Stream - */ - - public abstract org.drip.product.params.BondStream stream(); - - /** - * Set the bond notional Setting - * - * @param notlSetting Bond Notional Setting - * - * @return True if succeeded - */ - - public abstract boolean setNotionalSetting ( - final org.drip.product.params.NotionalSetting notlSetting - ); - - /** - * Retrieve the bond notional Setting - * - * @return Bond notional Setting - */ - - public abstract org.drip.product.params.NotionalSetting notionalSetting(); - - /** - * Set the bond's embedded call schedule - * - * @param eos Bond's embedded call schedule - */ - - public abstract void setEmbeddedCallSchedule ( - final org.drip.product.params.EmbeddedOptionSchedule eos - ); - - /** - * Set the bond's embedded put schedule - * - * @param eos Bond's embedded put schedule - */ - - public abstract void setEmbeddedPutSchedule ( - final org.drip.product.params.EmbeddedOptionSchedule eos - ); -} diff --git a/org/drip/product/definition/CalibratableComponent.java b/org/drip/product/definition/CalibratableComponent.java deleted file mode 100644 index 04e1666..0000000 --- a/org/drip/product/definition/CalibratableComponent.java +++ /dev/null @@ -1,353 +0,0 @@ - -package org.drip.product.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * CalibratableComponent abstract class provides implementation of Component's calibration interface. It - * exposes stubs for getting/setting the component’s calibration code, generate calibrated measure values - * from the market inputs, and compute micro-Jacobians (QuoteDF and PVDF micro-Jacks). - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class CalibratableComponent extends org.drip.product.definition.Component { - - /** - * Return the primary code - * - * @return Primary Code - */ - - public abstract java.lang.String primaryCode(); - - /** - * Set the component's primary code - * - * @param strCode Primary Code - */ - - public abstract void setPrimaryCode ( - final java.lang.String strCode); - - /** - * Get the component's secondary codes - * - * @return Array of strings containing the secondary codes - */ - - public java.lang.String[] secondaryCode() - { - return new java.lang.String[] {primaryCode()}; - } - - /** - * Generate the Product Specific Calibration Quote Set - * - * @param aLSS Array of Latent State Specification - * - * @return The Product Specific Calibration Quote Set - */ - - public abstract org.drip.product.calib.ProductQuoteSet calibQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS); - - /** - * Generate a Map of the Calibration Measures - * - * @param valParams Valuation Parameters - * @param pricerParams Pricer Parameters - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * - * @return Map of the Calibration Measures - */ - - public abstract org.drip.analytics.support.CaseInsensitiveTreeMap calibMeasures ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp); - - /** - * Generate the Calibratable Linearized Predictor/Response Constraint Weights for the Non-merged Funding - * Curve Discount Factor Latent State from the Component's Cash Flows. The Constraints here typically - * correspond to Date/Cash Flow pairs and the corresponding leading PV. - * - * @param valParams Valuation Parameters - * @param pricerParams Pricer Parameters - * @param csqs Component Market Parameters - * @param vcp Valuation Customization Parameters - * @param pqs Product Quote Set - * - * @return The Calibratable Linearized Predictor/Response Constraints (Date/Cash Flow pairs and the - * corresponding PV) - */ - - public abstract org.drip.state.estimator.PredictorResponseWeightConstraint fundingPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs); - - /** - * Generate the Calibratable Linearized Predictor/Response Constraint Weights for the Non-merged Forward - * Factor Latent State from the Component's Cash Flows. The Constraints here typically correspond to - * Date/Cash Flow pairs and the corresponding leading PV. - * - * @param valParams Valuation Parameters - * @param pricerParams Pricer Parameters - * @param csqs Component Market Parameters - * @param vcp Valuation Customization Parameters - * @param pqs Product Quote Set - * - * @return The Calibratable Linearized Predictor/Response Constraints (Date/Cash Flow pairs and the - * corresponding PV) - */ - - public abstract org.drip.state.estimator.PredictorResponseWeightConstraint forwardPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs); - - /** - * Generate the Calibratable Linearized Predictor/Response Constraint Weights for the merged Funding and - * Forward Latent States from the Component's Cash Flows. The Constraints here typically correspond to - * Date/Cash Flow pairs and the corresponding leading PV. - * - * @param valParams Valuation Parameters - * @param pricerParams Pricer Parameters - * @param csqs Component Market Parameters - * @param vcp Valuation Customization Parameters - * @param pqs Product Quote Set - * - * @return The Calibratable Linearized Predictor/Response Constraints (Date/Cash Flow pairs and the - * corresponding PV) - */ - - public abstract org.drip.state.estimator.PredictorResponseWeightConstraint fundingForwardPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs); - - /** - * Generate the Calibratable Linearized Predictor/Response Constraint Weights for the Non-merged FX Curve - * FX Forward Latent State from the Component's Cash Flows. The Constraints here typically correspond to - * Date/Cash Flow pairs and the corresponding leading PV. - * - * @param valParams Valuation Parameters - * @param pricerParams Pricer Parameters - * @param csqs Component Market Parameters - * @param vcp Valuation Customization Parameters - * @param pqs Product Quote Set - * - * @return The Calibratable Linearized Predictor/Response Constraints (Date/Cash Flow pairs and the - * corresponding FX Forward) - */ - - public abstract org.drip.state.estimator.PredictorResponseWeightConstraint fxPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs); - - /** - * Generate the Calibratable Linearized Predictor/Response Constraint Weights for the Non-merged Govvie - * Curve FX Forward Latent State from the Component's Cash Flows. The Constraints here typically - * correspond to Date/Cash Flow pairs and the corresponding leading PV. - * - * @param valParams Valuation Parameters - * @param pricerParams Pricer Parameters - * @param csqs Component Market Parameters - * @param vcp Valuation Customization Parameters - * @param pqs Product Quote Set - * - * @return The Calibratable Linearized Predictor/Response Constraints (Date/Cash Flow pairs and the - * corresponding Govvie Forward) - */ - - public abstract org.drip.state.estimator.PredictorResponseWeightConstraint govviePRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs); - - /** - * Generate the Calibratable Linearized Predictor/Response Constraint Weights for the Non-merged - * Volatility Latent State from the Component's Cash Flows. The Constraints here typically correspond to - * Date/Cash Flow pairs and the corresponding leading PV. - * - * @param valParams Valuation Parameters - * @param pricerParams Pricer Parameters - * @param csqs Component Market Parameters - * @param vcp Valuation Customization Parameters - * @param pqs Product Quote Set - * - * @return The Calibratable Linearized Predictor/Response Constraints (Date/Cash Flow pairs and the - * corresponding PV) - */ - - public abstract org.drip.state.estimator.PredictorResponseWeightConstraint volatilityPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs); - - /** - * Compute the Jacobian of the Dirty PV to the Calibrated Input Manifest Measures - * - * @param valParams Valuation Parameters - * @param pricerParams Pricer Parameters - * @param csqs Component Market Parameters - * @param vcp Valuation Customization Parameters - * - * @return The micro-Jacobian - */ - - public abstract org.drip.quant.calculus.WengertJacobian jackDDirtyPVDManifestMeasure ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp); - - /** - * Compute the micro-Jacobian of the given measure to the DF - * - * @param strMainfestMeasure Manifest Measure Name - * @param valParams Valuation Parameters - * @param pricerParams Pricer Parameters - * @param csqs Component Market Parameters - * @param vcp Valuation Customization Parameters - * - * @return The micro-Jacobian - */ - - public abstract org.drip.quant.calculus.WengertJacobian manifestMeasureDFMicroJack ( - final java.lang.String strMainfestMeasure, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp); - - /** - * Generate the Calibratable Linearized Predictor/Response Constraint Weights for the Component from the - * Market Inputs. The Constraints here typically correspond to Date/Cash Flow pairs and the - * corresponding leading PV. - * - * @param valParams Valuation Parameters - * @param pricerParams Pricer Parameters - * @param csqs Component Market Parameters - * @param vcp Valuation Customization Parameters - * @param pqs The Product Calibration Quote Set - * - * @return The Calibratable Linearized Predictor/Response Constraints (Date/Cash Flow pairs and the - * corresponding PV) - */ - - public org.drip.state.estimator.PredictorResponseWeightConstraint calibPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - if (null == valParams || null == pqs) return null; - - if (pqs.containsLatentStateType - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_FUNDING) && - pqs.containsLatentStateQuantificationMetric - (org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR) && - pqs.containsLatentStateType - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_FORWARD) && - pqs.containsLatentStateQuantificationMetric - (org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_FORWARD_RATE)) - return fundingForwardPRWC (valParams, pricerParams, csqs, vcp, pqs); - - if (pqs.containsLatentStateType - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_FUNDING) && - pqs.containsLatentStateQuantificationMetric - (org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR)) - return fundingPRWC (valParams, pricerParams, csqs, vcp, pqs); - - if (pqs.containsLatentStateType - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_FORWARD) && - pqs.containsLatentStateQuantificationMetric - (org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_FORWARD_RATE)) - return forwardPRWC (valParams, pricerParams, csqs, vcp, pqs); - - if (pqs.containsLatentStateType - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_FX) && - pqs.containsLatentStateQuantificationMetric - (org.drip.analytics.definition.LatentStateStatic.FX_QM_FORWARD_OUTRIGHT)) - return fxPRWC (valParams, pricerParams, csqs, vcp, pqs); - - if (pqs.containsLatentStateType - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_GOVVIE) && - pqs.containsLatentStateQuantificationMetric - (org.drip.analytics.definition.LatentStateStatic.GOVVIE_QM_YIELD)) - return govviePRWC (valParams, pricerParams, csqs, vcp, pqs); - - if (pqs.containsLatentStateType - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_VOLATILITY)) - return volatilityPRWC (valParams, pricerParams, csqs, vcp, pqs); - - return null; - } -} diff --git a/org/drip/product/definition/Component.java b/org/drip/product/definition/Component.java deleted file mode 100644 index 45d42ee..0000000 --- a/org/drip/product/definition/Component.java +++ /dev/null @@ -1,696 +0,0 @@ - -package org.drip.product.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * Component abstract class extends the ComponentMarketParamRef and provides the following methods: - * - Get the product's initial notional, notional, and coupon. - * - Get the Effective date, Maturity date, First Coupon Date. - * - List the coupon periods. - * - Set the market curves - discount, TSY, forward, and Credit curves. - * - Retrieve the product's settlement parameters. - * - Value the product's using standard/custom market parameters. - * - Retrieve the product's named measures and named measure values. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class Component implements org.drip.product.definition.ComponentMarketParamRef { - - protected double measureValue ( - final java.lang.String strMeasure, - final org.drip.analytics.support.CaseInsensitiveTreeMap mapCalc) - throws java.lang.Exception - { - if (null == strMeasure || strMeasure.isEmpty() || null == mapCalc) - throw new java.lang.Exception ("Component::measureValue => Invalid Inputs"); - - java.util.Set> mapES = mapCalc.entrySet(); - - if (null == mapES || 0 == mapES.size()) - throw new java.lang.Exception ("Component::measureValue => Invalid Inputs"); - - for (java.util.Map.Entry me : mapES) { - if (me.getKey().equalsIgnoreCase (strMeasure)) return me.getValue(); - } - - throw new java.lang.Exception ("Component::measureValue => Invalid Measure: " + strMeasure); - } - - protected boolean adjustForCashSettle ( - final int iSettleDate, - final double dblPV, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.quant.calculus.WengertJacobian wjPVDFMicroJack) - { - org.drip.quant.calculus.WengertJacobian wjCashSettleDFDF = dc.jackDDFDManifestMeasure (iSettleDate, - "Rate"); - - if (null == wjCashSettleDFDF) return false; - - double dblDFCashSettle = java.lang.Double.NaN; - - int iNumParameters = wjCashSettleDFDF.numParameters(); - - try { - dblDFCashSettle = dc.df (iSettleDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - if (!wjPVDFMicroJack.scale (1. / dblDFCashSettle)) return false; - - double dblSettleJackAdjust = -1. * dblPV / dblDFCashSettle / dblDFCashSettle; - - for (int k = 0; k < iNumParameters; ++k) { - if (!wjPVDFMicroJack.accumulatePartialFirstDerivative (0, k, dblSettleJackAdjust * - wjCashSettleDFDF.firstDerivative (0, k))) - return false; - } - - return true; - } - - /** - * Get the Initial Notional for the Product - * - * @return Initial Notional - * - * @throws java.lang.Exception Thrown if Initial Notional cannot be computed - */ - - public abstract double initialNotional() - throws java.lang.Exception; - - /** - * Get the Notional for the Product at the given date - * - * @param iDate Date - * - * @return Product Notional - * - * @throws java.lang.Exception Thrown if Notional cannot be computed - */ - - public abstract double notional ( - final int iDate) - throws java.lang.Exception; - - /** - * Get the time-weighted Notional for the Product between 2 dates - * - * @param iDate1 Date #1 - * @param iDate2 Date #2 - * - * @return The Product Notional - * - * @throws java.lang.Exception Thrown if Notional cannot be computed - */ - - public abstract double notional ( - final int iDate1, - final int iDate2) - throws java.lang.Exception; - - /** - * Get the Effective Date - * - * @return Effective Date - */ - - public abstract org.drip.analytics.date.JulianDate effectiveDate(); - - /** - * Get the Maturity Date - * - * @return Maturity Date - */ - - public abstract org.drip.analytics.date.JulianDate maturityDate(); - - /** - * Get the First Coupon Date - * - * @return First Coupon Date - */ - - public abstract org.drip.analytics.date.JulianDate firstCouponDate(); - - /** - * Retrieve the Coupon Frequency - * - * @return The Coupon Frequency - */ - - public abstract int freq(); - - /** - * Get the Product's Cash Flow Periods - * - * @return List of the Product's Cash Flow Periods - */ - - public abstract java.util.List couponPeriods(); - - /** - * Get the Product's coupon Metrics at the specified accrual date - * - * @param iAccrualEndDate Accrual End Date - * @param valParams The Valuation Parameters - * @param csqs Component Market Parameters - * - * @return The Product's coupon Nominal/Adjusted Coupon Measures - */ - - public abstract org.drip.analytics.output.CompositePeriodCouponMetrics couponMetrics ( - final int iAccrualEndDate, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs); - - /** - * Get the Product's cash settlement parameters - * - * @return Cash settlement Parameters - */ - - public abstract org.drip.param.valuation.CashSettleParams cashSettleParams(); - - /** - * Generate a full list of the Product measures for the full input set of market parameters - * - * @param valParams ValuationParams - * @param pricerParams PricerParams - * @param csqs Market Parameters - * @param vcp Valuation Customization Parameters - * - * @return Map of measure name and value - */ - - public abstract org.drip.analytics.support.CaseInsensitiveTreeMap value ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp); - - /** - * Retrieve the ordered set of the measure names whose values will be calculated - * - * @return Set of Measure Names - */ - - public abstract java.util.Set measureNames(); - - /** - * Compute the PV for the specified Market Parameters - * - * @param valParams ValuationParams - * @param pricerParams PricerParams - * @param csqc Market Parameters - * @param vcp Valuation Customization Parameters - * - * @return The PV - * - * @throws java.lang.Exception Thrown if the PV cannot be computed - */ - - public abstract double pv ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - throws java.lang.Exception; - - /** - * Calculate the value of the given Product's measure - * - * @param valParams ValuationParams - * @param pricerParams PricerParams - * @param csqs ComponentMarketParams - * @param strMeasure Measure String - * @param vcp Valuation Customization Parameters - * - * @return Double measure value - * - * @throws java.lang.Exception Thrown if the measure cannot be calculated - */ - - public double measureValue ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final java.lang.String strMeasure) - throws java.lang.Exception - { - return measureValue (strMeasure, value (valParams, pricerParams, csqs, vcp)); - } - - /** - * Retrieve the Instrument's Imputed Tenor - * - * @return The Instrument's Imputed Tenor - */ - - public java.lang.String tenor() - { - int iNumDays = maturityDate().julian() - effectiveDate().julian(); - - if (365 > iNumDays) { - int iNumMonth = (int) (0.5 + (iNumDays / 30.)); - - return 12 == iNumMonth ? "1Y" : iNumMonth + "M"; - } - - return ((int) (0.5 + (iNumDays / 365.))) + "Y"; - } - - /** - * Generate a full list of the Product's measures for the set of scenario market parameters present in - * the org.drip.param.definition.MarketParams - * - * @param valParams ValuationParams - * @param pricerParams PricerParams - * @param mpc org.drip.param.definition.MarketParams - * @param vcp Valuation Customization Parameters - * - * @return ComponentOutput object - */ - - public org.drip.analytics.output.ComponentMeasures measures ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.definition.ScenarioMarketParams mpc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == valParams || null == mpc) return null; - - org.drip.param.market.CurveSurfaceQuoteContainer csqsBase = mpc.scenarioMarketParams (this, "Base"); - - if (null == csqsBase) return null; - - org.drip.analytics.output.ComponentMeasures compOp = new - org.drip.analytics.output.ComponentMeasures(); - - long lStart = System.nanoTime(); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapBaseMeasures = value - (valParams, pricerParams, csqsBase, vcp); - - if (!compOp.setBaseMeasures (mapBaseMeasures)) return null; - - org.drip.param.market.CurveSurfaceQuoteContainer csqsFlatCreditBumpUp = mpc.scenarioMarketParams (this, - "FlatCreditBumpUp"); - - if (null != csqsFlatCreditBumpUp) { - org.drip.analytics.support.CaseInsensitiveTreeMap mapFlatCreditBumpUpMeasures = - value (valParams, pricerParams, csqsFlatCreditBumpUp, vcp); - - java.util.Set> mapFlatCreditBumpUpES = - null == mapFlatCreditBumpUpMeasures ? null : mapFlatCreditBumpUpMeasures.entrySet(); - - if (null != mapFlatCreditBumpUpES && 0 != mapFlatCreditBumpUpES.size()) { - org.drip.analytics.support.CaseInsensitiveTreeMap - mapFlatCreditDeltaMeasures = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry me : mapFlatCreditBumpUpES) { - java.lang.String strKey = me.getKey(); - - mapFlatCreditDeltaMeasures.put (strKey, me.getValue() - mapBaseMeasures.get (strKey)); - } - - org.drip.param.market.CurveSurfaceQuoteContainer csqsFlatCreditBumpDown = mpc.scenarioMarketParams - (this, "FlatCreditBumpDn"); - - if (compOp.setFlatCreditDeltaMeasures (mapFlatCreditDeltaMeasures) && null != - csqsFlatCreditBumpDown) { - org.drip.analytics.support.CaseInsensitiveTreeMap - mapFlatCreditBumpDownMeasures = value (valParams, pricerParams, - csqsFlatCreditBumpDown, vcp); - - java.util.Set> - mapFlatCreditBumpDownES = null == mapFlatCreditBumpDownMeasures ? null : - mapFlatCreditBumpDownMeasures.entrySet(); - - if (null != mapFlatCreditBumpDownES && 0 != mapFlatCreditBumpDownES.size()) { - org.drip.analytics.support.CaseInsensitiveTreeMap - mapFlatCreditGammaMeasures = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry me : - mapFlatCreditBumpDownES) { - java.lang.String strKey = me.getKey(); - - mapFlatCreditGammaMeasures.put (strKey, me.getValue() + - mapFlatCreditBumpUpMeasures.get (strKey) - 2. * mapBaseMeasures.get - (strKey)); - } - - compOp.setFlatCreditGammaMeasures (mapFlatCreditGammaMeasures); - } - } - } - } - - org.drip.param.market.CurveSurfaceQuoteContainer csqsRRBumpUp = mpc.scenarioMarketParams (this, "RRBumpUp"); - - if (null != csqsRRBumpUp) { - org.drip.analytics.support.CaseInsensitiveTreeMap mapRRBumpUpMeasures = value - (valParams, pricerParams, csqsRRBumpUp, vcp); - - java.util.Set> mapRRBumpUpES = null == - mapRRBumpUpMeasures ? null : mapRRBumpUpMeasures.entrySet(); - - if (null != mapRRBumpUpES && 0 != mapRRBumpUpES.size()) { - org.drip.analytics.support.CaseInsensitiveTreeMap mapFlatRRDeltaMeasures = - new org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry me : mapRRBumpUpES) { - java.lang.String strKey = me.getKey(); - - mapFlatRRDeltaMeasures.put (strKey, me.getValue() - mapBaseMeasures.get (strKey)); - } - - org.drip.param.market.CurveSurfaceQuoteContainer csqsRRBumpDown = mpc.scenarioMarketParams (this, - "RRBumpDn"); - - if (compOp.setFlatRRDeltaMeasures (mapFlatRRDeltaMeasures) && null != csqsRRBumpDown) { - org.drip.analytics.support.CaseInsensitiveTreeMap mapRRBumpDownMeasures - = value (valParams, pricerParams, csqsRRBumpDown, vcp); - - java.util.Set> mapRRBumpDownES = - null == mapRRBumpDownMeasures ? null : mapRRBumpDownMeasures.entrySet(); - - if (null != mapRRBumpDownES && 0 != mapRRBumpDownES.size()) { - org.drip.analytics.support.CaseInsensitiveTreeMap - mapFlatRRGammaMeasures = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry me : mapRRBumpDownES) { - java.lang.String strKey = me.getKey(); - - mapFlatRRGammaMeasures.put (strKey, me.getValue() + mapRRBumpUpMeasures.get - (strKey) - 2. * mapBaseMeasures.get (strKey)); - } - - compOp.setFlatRRGammaMeasures (mapFlatRRGammaMeasures); - } - } - } - } - - org.drip.param.market.CurveSurfaceQuoteContainer csqsIRCreditBumpUp = mpc.scenarioMarketParams (this, - "IRCreditBumpUp"); - - if (null != csqsIRCreditBumpUp) { - org.drip.analytics.support.CaseInsensitiveTreeMap mapIRCreditBumpUpMeasures = - value (valParams, pricerParams, csqsIRCreditBumpUp, vcp); - - java.util.Set> mapIRCreditBumpUpES = null - == mapIRCreditBumpUpMeasures ? null : mapIRCreditBumpUpMeasures.entrySet(); - - if (null != mapIRCreditBumpUpES && 0 != mapIRCreditBumpUpES.size()) { - org.drip.analytics.support.CaseInsensitiveTreeMap mapFlatIRDeltaMeasures = - new org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry me : mapIRCreditBumpUpES) { - java.lang.String strKey = me.getKey(); - - mapFlatIRDeltaMeasures.put (strKey, me.getValue() - mapBaseMeasures.get (strKey)); - } - - org.drip.param.market.CurveSurfaceQuoteContainer csqsIRCreditBumpDown = mpc.scenarioMarketParams (this, - "IRCreditBumpDn"); - - if (compOp.setFlatIRDeltaMeasures (mapFlatIRDeltaMeasures) && null != csqsIRCreditBumpDown) { - org.drip.analytics.support.CaseInsensitiveTreeMap - mapIRCreditBumpDownMeasures = value (valParams, pricerParams, csqsIRCreditBumpDown, - vcp); - - java.util.Set> - mapIRCreditBumpDownES = null == mapIRCreditBumpDownMeasures ? null : - mapIRCreditBumpDownMeasures.entrySet(); - - if (null != mapIRCreditBumpDownES && 0 != mapIRCreditBumpDownES.size()) { - org.drip.analytics.support.CaseInsensitiveTreeMap - mapFlatIRGammaMeasures = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry me : - mapIRCreditBumpDownES) { - java.lang.String strKey = me.getKey(); - - mapFlatIRGammaMeasures.put (strKey, me.getValue() + - mapIRCreditBumpUpMeasures.get (strKey) - 2. * mapBaseMeasures.get (strKey)); - } - - compOp.setFlatIRGammaMeasures (mapFlatIRGammaMeasures); - } - } - } - } - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapCCTenorUpCSQS = mpc.creditTenorMarketParams (this, true); - - if (null != mapCCTenorUpCSQS) { - compOp.setTenorCreditDeltaMeasures (new - org.drip.analytics.support.CaseInsensitiveTreeMap>()); - - if (null != mapCCTenorUpCSQS && null != mapCCTenorUpCSQS.entrySet()) { - for (java.util.Map.Entry - meTenorUpMP : mapCCTenorUpCSQS.entrySet()) { - if (null == meTenorUpMP || null == meTenorUpMP.getValue()) continue; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapCCTenorUp = value - (valParams, pricerParams, meTenorUpMP.getValue(), vcp); - - if (null == mapCCTenorUp || null == mapCCTenorUp.entrySet()) continue; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapCalcUp = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry me : - mapCCTenorUp.entrySet()) { - java.lang.String strKey = me.getKey(); - - mapCalcUp.put (strKey, me.getValue() - mapBaseMeasures.get (strKey)); - } - - compOp.tenorCreditDeltaMeasures().put (meTenorUpMP.getKey(), mapCalcUp); - } - - if (null != mpc.creditTenorMarketParams (this, false)) { - compOp.setTenorCreditGammaMeasures (new - org.drip.analytics.support.CaseInsensitiveTreeMap>()); - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapCCTenorDnCSQS = mpc.creditTenorMarketParams (this, false); - - if (null != mapCCTenorDnCSQS && null != mapCCTenorDnCSQS.entrySet()) { - for (java.util.Map.Entry meTenorDnMP : - mapCCTenorDnCSQS.entrySet()) { - if (null == meTenorDnMP || null == meTenorDnMP.getValue()) continue; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapCCTenorDn - = value (valParams, pricerParams, meTenorDnMP.getValue(), vcp); - - if (null == mapCCTenorDn || null == mapCCTenorDn.entrySet()) continue; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapCalcDn = - new org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry me : - mapCCTenorDn.entrySet()) { - java.lang.String strKey = me.getKey(); - - mapCalcDn.put (strKey, me.getValue() - mapBaseMeasures.get (strKey) + - compOp.tenorCreditDeltaMeasures().get (meTenorDnMP.getKey()).get - (strKey)); - } - - compOp.tenorCreditGammaMeasures().put (meTenorDnMP.getKey(), mapCalcDn); - } - } - } - } - } - - if (null != mpc.fundingTenorMarketParams (this, true)) { - compOp.setTenorIRDeltaMeasures (new - org.drip.analytics.support.CaseInsensitiveTreeMap>()); - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapIRTenorUpCSQS = mpc.fundingTenorMarketParams (this, true); - - if (null != mapIRTenorUpCSQS && null != mapIRTenorUpCSQS.entrySet()) { - for (java.util.Map.Entry - meTenorUpMP : mapIRTenorUpCSQS.entrySet()) { - org.drip.analytics.support.CaseInsensitiveTreeMap mapCCTenorUp = value - (valParams, pricerParams, meTenorUpMP.getValue(), vcp); - - if (null == mapCCTenorUp || null == mapCCTenorUp.entrySet()) continue; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapCalcUp = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry me : - mapCCTenorUp.entrySet()) { - java.lang.String strKey = me.getKey(); - - mapCalcUp.put (strKey, me.getValue() - mapBaseMeasures.get (strKey)); - } - - compOp.tenorIRDeltaMeasures().put (meTenorUpMP.getKey(), mapCalcUp); - } - } - - if (null != mpc.fundingTenorMarketParams (this, false)) { - compOp.setTenorIRGammaMeasures (new - org.drip.analytics.support.CaseInsensitiveTreeMap>()); - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapIRTenorDnCSQS = mpc.fundingTenorMarketParams (this, false); - - if (null != mapIRTenorDnCSQS & null != mapIRTenorDnCSQS.entrySet()) { - for (java.util.Map.Entry - meTenorDnMP : mapIRTenorDnCSQS.entrySet()) { - org.drip.analytics.support.CaseInsensitiveTreeMap mapCCTenorDn = value - (valParams, pricerParams, meTenorDnMP.getValue(), vcp); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapCalcDn = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - if (null == mapCalcDn || null == mapCalcDn.entrySet()) continue; - - for (java.util.Map.Entry me : - mapCCTenorDn.entrySet()) { - java.lang.String strKey = me.getKey(); - - mapCalcDn.put (strKey, me.getValue() - mapBaseMeasures.get (strKey) + - compOp.tenorIRDeltaMeasures().get (meTenorDnMP.getKey()).get (strKey)); - } - - compOp.tenorIRGammaMeasures().put (meTenorDnMP.getKey(), mapCalcDn); - } - } - } - } - - compOp.setCalcTime ((System.nanoTime() - lStart) * 1.e-09); - - return compOp; - } - - /** - * Generate a full list of custom measures for the set of scenario market parameters present in - * the org.drip.param.definition.MarketParams - * - * @param valParams ValuationParams - * @param pricerParams PricerParams - * @param mpc org.drip.param.definition.MarketParams - * @param strCustomScenName Custom Scenario Name - * @param vcp Valuation Customization Parameters - * @param mapBaseMeasures Base Measures from used to calculate the desired delta measure. If null, the - * base measures will be generated. - * - * @return Custom Scenarios Measures output set - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap customScenarioMeasures ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.definition.ScenarioMarketParams mpc, - final java.lang.String strCustomScenName, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - org.drip.analytics.support.CaseInsensitiveTreeMap mapBaseMeasures) - { - if (null == strCustomScenName || strCustomScenName.isEmpty() || null == valParams || null == mpc) - return null; - - org.drip.param.market.CurveSurfaceQuoteContainer csqsCustom = mpc.scenarioMarketParams (this, - strCustomScenName); - - if (null == csqsCustom) return null; - - if (null == mapBaseMeasures) { - org.drip.param.market.CurveSurfaceQuoteContainer csqsBase = mpc.scenarioMarketParams (this, "Base"); - - if (null == csqsBase || null == (mapBaseMeasures = value (valParams, pricerParams, csqsBase, - vcp))) - return null; - } - - org.drip.analytics.support.CaseInsensitiveTreeMap mapCustomMeasures = value - (valParams, pricerParams, csqsCustom, vcp); - - java.util.Set> mapCustomMeasuresES = null == - mapCustomMeasures ? null : mapCustomMeasures.entrySet(); - - if (null == mapCustomMeasuresES || 0 == mapCustomMeasuresES.size()) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapCustomDeltaMeasures = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry me : mapCustomMeasuresES) { - java.lang.String strKey = me.getKey(); - - mapCustomDeltaMeasures.put (strKey, me.getValue() - mapBaseMeasures.get (strKey)); - } - - return mapCustomDeltaMeasures; - } -} diff --git a/org/drip/product/definition/ComponentMarketParamRef.java b/org/drip/product/definition/ComponentMarketParamRef.java deleted file mode 100644 index 8117e2b..0000000 --- a/org/drip/product/definition/ComponentMarketParamRef.java +++ /dev/null @@ -1,147 +0,0 @@ - -package org.drip.product.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * ComponentMarketParamRef interface provides stubs for name, IR curve, forward curve, credit curve, TSY - * curve, and needed to value the component. - * - * @author Lakshmi Krishnamurthy - */ - -public interface ComponentMarketParamRef { - - /** - * Get the component name - * - * @return The component name - */ - - public abstract java.lang.String name(); - - /** - * Get the Map of Coupon Currencies - * - * @return The Map of Coupon Currencies - */ - - public abstract org.drip.analytics.support.CaseInsensitiveTreeMap couponCurrency(); - - /** - * Get the Pay Currency - * - * @return The Pay Currency - */ - - public abstract java.lang.String payCurrency(); - - /** - * Get the Principal Currency - * - * @return The Principal Currency - */ - - public abstract java.lang.String principalCurrency(); - - /** - * Get the Credit Curve Latent State Identifier Label - * - * @return The Credit Curve Latent State Identifier Label - */ - - public abstract org.drip.state.identifier.CreditLabel creditLabel(); - - /** - * Get the Map of Forward Curve Latent State Labels - * - * @return The Map of the Forward Curve Latent State Labels - */ - - public abstract org.drip.analytics.support.CaseInsensitiveTreeMap - forwardLabel(); - - /** - * Get the Funding Curve Latent State Label - * - * @return Funding Curve Latent State Label - */ - - public abstract org.drip.state.identifier.FundingLabel fundingLabel(); - - /** - * Get the Govvie Curve Latent State Label - * - * @return Govvie Curve Latent State Label - */ - - public abstract org.drip.state.identifier.GovvieLabel govvieLabel(); - - /** - * Get the Map of FX Latent State Identifier Labels - * - * @return The Map of FX Latent State Identifier Labels - */ - - public abstract org.drip.analytics.support.CaseInsensitiveTreeMap - fxLabel(); - - /** - * Get the Map of Volatility Latent State Identifier Labels - * - * @return The Map of Volatility Latent State Identifier Labels - */ - - public abstract - org.drip.analytics.support.CaseInsensitiveTreeMap - volatilityLabel(); -} diff --git a/org/drip/product/definition/CreditComponent.java b/org/drip/product/definition/CreditComponent.java deleted file mode 100644 index 05f258b..0000000 --- a/org/drip/product/definition/CreditComponent.java +++ /dev/null @@ -1,137 +0,0 @@ - -package org.drip.product.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * CreditComponent is the base abstract class on top of which all credit components are implemented. Its - * methods expose Credit Valuation Parameters, product specific recovery, and coupon/loss cash flows. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class CreditComponent extends org.drip.product.definition.CalibratableComponent { - - /** - * Generate the loss flow for the credit component based on the pricer parameters - * - * @param valParams ValuationParams - * @param pricerParams PricerParams - * @param csqc ComponentMarketParams - * - * @return List of ProductLossPeriodCurveMeasures - */ - - public abstract java.util.List lossFlow ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc); - - /** - * Get the recovery of the credit component for the given date - * - * @param iDate JulianDate - * @param cc Credit Curve - * - * @return Recovery - * - * @throws java.lang.Exception Thrown if recovery cannot be calculated - */ - - public abstract double recovery ( - final int iDate, - final org.drip.state.credit.CreditCurve cc) - throws java.lang.Exception; - - /** - * Get the time-weighted recovery of the credit component between the given dates - * - * @param iDate1 JulianDate #1 - * @param iDate2 JulianDate #2 - * @param cc Credit Curve - * - * @return Recovery - * - * @throws java.lang.Exception Thrown if recovery cannot be calculated - */ - - public abstract double recovery ( - final int iDate1, - final int iDate2, - final org.drip.state.credit.CreditCurve cc) - throws java.lang.Exception; - - /** - * Get the credit component's Credit Valuation Parameters - * - * @return CompCRValParams - */ - - public abstract org.drip.product.params.CreditSetting creditValuationParams(); - - /** - * Generate the loss flow for the credit component based on the pricer parameters - * - * @param dtSpot The Spot Date - * @param csqc The Component Market Parameters - * - * @return List of ProductLossPeriodCurveMeasures - */ - - public java.util.List lossFlow ( - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc) - { - return null == dtSpot ? null : lossFlow (org.drip.param.valuation.ValuationParams.Spot - (dtSpot.julian()), org.drip.param.pricer.CreditPricerParams.Standard(), csqc); - } -} diff --git a/org/drip/product/definition/CreditDefaultSwap.java b/org/drip/product/definition/CreditDefaultSwap.java deleted file mode 100644 index 3f0afe6..0000000 --- a/org/drip/product/definition/CreditDefaultSwap.java +++ /dev/null @@ -1,118 +0,0 @@ - -package org.drip.product.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * CreditDefaultSwap is the base abstract class implements the pricing, the valuation, and the RV analytics - * functionality for the CDS product. Targeted functions calibrate the flat spread and reset coupon (for - * calibration purposes). - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class CreditDefaultSwap extends org.drip.product.definition.CreditComponent { - - /** - * Reset the CDS's coupon - * - * @param dblCoupon The new Coupon - * - * @return The old Coupon - * - * @throws java.lang.Exception Thrown if the coupon cannot be reset - */ - - public abstract double resetCoupon ( - final double dblCoupon) - throws java.lang.Exception; - - /** - * Calibrate the CDS's flat spread from the calculated up-front points - * - * @param valParams ValuationParams - * @param pricerParams PricerParams - * @param csqs ComponentMarketParams - * @param vcp Valuation Customization Parameters - * - * @return Calibrated flat spread - * - * @throws java.lang.Exception Thrown if cannot calibrate - */ - - public abstract double calibFlatSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - throws java.lang.Exception; - - /** - * Value the CDS from the Quoted Spread - * - * @param valParams ValuationParams - * @param pricerParams PricerParams - * @param csqs ComponentMarketParams - * @param vcp Valuation Customization Parameters - * @param dblFixCoupon Fix Coupon - * @param dblQuotedSpread Quoted Spread - * - * @return The Value Map - */ - - public abstract org.drip.analytics.support.CaseInsensitiveTreeMap valueFromQuotedSpread ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblFixCoupon, - final double dblQuotedSpread); -} diff --git a/org/drip/product/fra/FRAMarketComponent.java b/org/drip/product/fra/FRAMarketComponent.java deleted file mode 100644 index 0ec139b..0000000 --- a/org/drip/product/fra/FRAMarketComponent.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.product.fra; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FRAMarketComponent contains the implementation of the Standard Multi-Curve FRA product whose payoff is - * dictated off of Market FRA Conventions. - * - * @author Lakshmi Krishnamurthy - */ - -public class FRAMarketComponent extends org.drip.product.fra.FRAStandardComponent { - - /** - * FRAMarketComponent constructor - * - * @param strName Futures Component Name - * @param stream Futures Stream - * @param dblStrike Futures Strike - * @param csp Cash Settle Parameters Instance - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public FRAMarketComponent ( - final java.lang.String strName, - final org.drip.product.rates.Stream stream, - final double dblStrike, - final org.drip.param.valuation.CashSettleParams csp) - throws java.lang.Exception - { - super (strName, stream, dblStrike, csp); - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap value ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == valParams || null == csqs) return null; - - long lStart = System.nanoTime(); - - int iValueDate = valParams.valueDate(); - - int iEffectiveDate = effectiveDate().julian(); - - if (iValueDate > iEffectiveDate) return null; - - org.drip.state.identifier.FundingLabel fundingLabel = org.drip.state.identifier.FundingLabel.Standard - (payCurrency()); - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqs.fundingState (fundingLabel); - - if (null == dcFunding) return null; - - org.drip.analytics.date.JulianDate dtMaturity = maturityDate(); - - int iMaturityDate = dtMaturity.julian(); - - org.drip.state.identifier.ForwardLabel forwardLabel = forwardLabel().get ("DERIVED"); - - org.drip.state.forward.ForwardRateEstimator fc = csqs.forwardState (forwardLabel); - - if (null == fc || !forwardLabel.match (fc.index())) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapResult = super.value - (valParams, pricerParams, csqs, vcp); - - if (null == mapResult || 0 == mapResult.size()) return null; - - try { - double dblParStandardFRA = csqs.available (dtMaturity, forwardLabel) ? csqs.fixing (dtMaturity, - forwardLabel) : fc.forward (iMaturityDate); - - double dblForwardDCF = org.drip.analytics.daycount.Convention.YearFraction (iMaturityDate, new - org.drip.analytics.date.JulianDate (iMaturityDate).addTenor (forwardLabel.tenor()).julian(), - stream().couponDC(), false, null, stream().calendar()); - - double dblParDCForward = dcFunding.libor (iEffectiveDate, iMaturityDate); - - double dblShiftedLogNormalScaler = dblForwardDCF * dblParStandardFRA; - dblShiftedLogNormalScaler = dblShiftedLogNormalScaler / (1. + dblShiftedLogNormalScaler); - - double dblForwardPrice = dblForwardDCF * (dblParStandardFRA - strike()) / (1. + dblForwardDCF * - dblParStandardFRA); - - double dblShiftedLogNormalConvexityAdjustmentExponent = - org.drip.analytics.support.OptionHelper.IntegratedFRACrossVolConvexityExponent - (csqs.forwardVolatility (forwardLabel), csqs.fundingVolatility (fundingLabel), - csqs.forwardFundingCorrelation (forwardLabel, fundingLabel), - dblShiftedLogNormalScaler, dblShiftedLogNormalScaler, iValueDate, - iEffectiveDate); - - double dblShiftedLogNormalParMarketFRA = ((dblForwardDCF * dblParStandardFRA + 1.) * - java.lang.Math.exp (dblShiftedLogNormalConvexityAdjustmentExponent) - 1.) / dblForwardDCF; - - mapResult.put ("discountcurveparforward", dblParDCForward); - - mapResult.put ("forwardprice", dblForwardPrice); - - mapResult.put ("parstandardfra", dblParStandardFRA); - - mapResult.put ("parstandardfradc", dblParDCForward); - - mapResult.put ("shiftedlognormalconvexityadjustment", - dblShiftedLogNormalConvexityAdjustmentExponent); - - mapResult.put ("shiftedlognormalconvexitycorrection", dblShiftedLogNormalParMarketFRA - - dblParStandardFRA); - - mapResult.put ("shiftedlognormalparmarketfra", dblShiftedLogNormalParMarketFRA); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - mapResult.put ("calctime", (System.nanoTime() - lStart) * 1.e-09); - - return mapResult; - } -} diff --git a/org/drip/product/fra/FRAStandardCapFloor.java b/org/drip/product/fra/FRAStandardCapFloor.java deleted file mode 100644 index ff0e593..0000000 --- a/org/drip/product/fra/FRAStandardCapFloor.java +++ /dev/null @@ -1,642 +0,0 @@ - -package org.drip.product.fra; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. -- */ - -/** - * FRAStandardCapFloor implements the Caps and Floors on the Standard FRA. - * - * @author Lakshmi Krishnamurthy - */ - -public class FRAStandardCapFloor extends org.drip.product.option.OptionComponent { - private boolean _bIsCap = false; - private double _dblStrike = java.lang.Double.NaN; - private org.drip.product.rates.Stream _stream = null; - - private java.util.List _lsFRACapFloorlet = new - java.util.ArrayList(); - - /** - * FRAStandardCapFloor constructor - * - * @param strName Name of the Cap/Floor Instance - * @param stream The Underlying Stream - * @param strManifestMeasure Measure of the Underlying Component - * @param bIsCap Is the FRA Option a Cap? TRUE - YES - * @param dblStrike Strike of the Underlying Component's Measure - * @param ltds Last Trading Date Setting - * @param csp Cash Settle Parameters - * @param fpg The Fokker Planck Pricer Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public FRAStandardCapFloor ( - final java.lang.String strName, - final org.drip.product.rates.Stream stream, - final java.lang.String strManifestMeasure, - final boolean bIsCap, - final double dblStrike, - final org.drip.product.params.LastTradingDateSetting ltds, - final org.drip.param.valuation.CashSettleParams csp, - final org.drip.pricer.option.FokkerPlanckGenerator fpg) - throws java.lang.Exception - { - super (strName, org.drip.product.creator.SingleStreamComponentBuilder.FRAStandard - (stream.effective(), stream.forwardLabel(), dblStrike), strManifestMeasure, dblStrike, - stream.initialNotional(), ltds, csp); - - if (null == (_stream = stream) || !org.drip.quant.common.NumberUtil.IsValid (_dblStrike = dblStrike)) - throw new java.lang.Exception ("FRAStandardCapFloor Constructor => Invalid Inputs"); - - _bIsCap = bIsCap; - - org.drip.state.identifier.ForwardLabel fri = _stream.forwardLabel(); - - if (null == fri) - throw new java.lang.Exception ("FRAStandardCapFloor Constructor => Invalid Floater Index"); - - for (org.drip.analytics.cashflow.CompositePeriod period : _stream.periods()) { - org.drip.product.fra.FRAStandardComponent fra = - org.drip.product.creator.SingleStreamComponentBuilder.FRAStandard (new - org.drip.analytics.date.JulianDate (period.startDate()), fri, _dblStrike); - - _lsFRACapFloorlet.add (new org.drip.product.fra.FRAStandardCapFloorlet (fra.name() + "::LET", - fra, strManifestMeasure, _bIsCap, _dblStrike, _stream.notional (period.startDate()), ltds, - fpg, csp)); - } - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap value ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - double dblPV = 0.; - double dblPrice = 0.; - double dblUpfront = 0.; - org.drip.function.r1tor1solver.FixedPointFinderOutput fpfo = null; - - long lStart = System.nanoTime(); - - final int iValueDate = valParams.valueDate(); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapStreamResult = _stream.value - (valParams, pricerParams, csqs, vcp); - - for (org.drip.product.fra.FRAStandardCapFloorlet fracfl : _lsFRACapFloorlet) { - org.drip.analytics.support.CaseInsensitiveTreeMap mapFRAResult = fracfl.value - (valParams, pricerParams, csqs, vcp); - - if (null == mapFRAResult) continue; - - if (mapFRAResult.containsKey ("Price")) dblPrice += mapFRAResult.get ("Price"); - - if (mapFRAResult.containsKey ("PV")) dblPV += mapFRAResult.get ("PV"); - - if (mapFRAResult.containsKey ("Upfront")) dblUpfront += mapFRAResult.get ("Upfront"); - } - - org.drip.analytics.support.CaseInsensitiveTreeMap mapResult = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapResult.put ("ATMFairPremium", mapStreamResult.get ("FairPremium")); - - mapResult.put ("Price", dblPrice); - - mapResult.put ("PV", dblPV); - - mapResult.put ("Upfront", dblUpfront); - - org.drip.function.definition.R1ToR1 funcVolPricer = new org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblVolatility) - throws java.lang.Exception - { - double dblCapFloorletPrice = 0.; - - for (org.drip.product.fra.FRAStandardCapFloorlet fracfl : _lsFRACapFloorlet) { - int iExerciseDate = fracfl.exerciseDate().julian(); - - if (iExerciseDate <= iValueDate) continue; - - dblCapFloorletPrice += fracfl.price (valParams, pricerParams, csqs, vcp, dblVolatility); - } - - return dblCapFloorletPrice; - } - }; - - try { - fpfo = (new org.drip.function.r1tor1solver.FixedPointFinderBracketing (dblPrice, funcVolPricer, - null, org.drip.function.r1tor1solver.VariateIteratorPrimitive.BISECTION, false)).findRoot - (org.drip.function.r1tor1solver.InitializationHeuristics.FromHardSearchEdges (0.0001, - 5.)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return mapResult; - } - - mapResult.put ("CalcTime", (System.nanoTime() - lStart) * 1.e-09); - - if (null != fpfo && fpfo.containsRoot()) - mapResult.put ("FlatVolatility", fpfo.getRoot()); - else - mapResult.put ("FlatVolatility", java.lang.Double.NaN); - - return mapResult; - } - - @Override public java.util.Set measureNames() - { - java.util.Set setstrMeasureNames = new java.util.TreeSet(); - - setstrMeasureNames.add ("ATMFairPremium"); - - setstrMeasureNames.add ("CalcTime"); - - setstrMeasureNames.add ("FlatVolatility"); - - setstrMeasureNames.add ("Price"); - - setstrMeasureNames.add ("PV"); - - setstrMeasureNames.add ("Upfront"); - - return setstrMeasureNames; - } - - @Override public double pv ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - throws java.lang.Exception - { - double dblPV = 0.; - - for (org.drip.product.fra.FRAStandardCapFloorlet fracfl : _lsFRACapFloorlet) - dblPV += fracfl.pv (valParams, pricerParams, csqc, vcp); - - return dblPV; - } - - /** - * Retrieve the Stream Instance Underlying the Cap - * - * @return The Stream Instance Underlying the Cap - */ - - public org.drip.product.rates.Stream stream() - { - return _stream; - } - - /** - * Indicate if this is a Cap or Floor - * - * @return TRUE - The Product is a Cap - */ - - public boolean isCap() - { - return _bIsCap; - } - - /** - * Retrieve the List of the Underlying Caplets/Floorlets - * - * @return The List of the Underlying Caplets/Floorlets - */ - - public java.util.List capFloorlets() - { - return _lsFRACapFloorlet; - } - - /** - * Compute the ATM Cap/Floor Price from the Flat Volatility - * - * @param valParams The Valuation Parameters - * @param pricerParams The Pricer Parameters - * @param csqs The Market Parameters - * @param vcp The Valuation Customization Parameters - * @param dblFlatVolatility The Flat Volatility - * - * @return The Cap/Floor ATM Price - * - * @throws java.lang.Exception Thrown if the ATM Price cannot be calculated - */ - - public double atmPriceFromVolatility ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblFlatVolatility) - throws java.lang.Exception - { - if (null == valParams || !org.drip.quant.common.NumberUtil.IsValid (dblFlatVolatility)) - throw new java.lang.Exception ("FRAStandardCapFloor::atmPriceFromVolatility => Invalid Inputs"); - - int iValueDate = valParams.valueDate(); - - double dblPrice = 0.; - - org.drip.product.fra.FRAStandardCapFloorlet fraLeading = _lsFRACapFloorlet.get (0); - - java.lang.String strManifestMeasure = fraLeading.manifestMeasure(); - - org.drip.pricer.option.FokkerPlanckGenerator fpg = fraLeading.pricer(); - - org.drip.product.params.LastTradingDateSetting ltds = fraLeading.lastTradingDateSetting(); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapStreamResult = _stream.value - (valParams, pricerParams, csqs, vcp); - - if (null == mapStreamResult || !mapStreamResult.containsKey ("FairPremium")) - throw new java.lang.Exception - ("FRAStandardCapFloor::atmPriceFromVolatility => Cannot calculate Fair Premium"); - - double dblCapATMFairPremium = mapStreamResult.get ("FairPremium"); - - org.drip.state.identifier.ForwardLabel forwardLabel = _stream.forwardLabel(); - - java.util.List lsATMFRACapFloorlet = new - java.util.ArrayList(); - - for (org.drip.analytics.cashflow.CompositePeriod period : _stream.periods()) { - org.drip.product.fra.FRAStandardComponent fra = - org.drip.product.creator.SingleStreamComponentBuilder.FRAStandard (new - org.drip.analytics.date.JulianDate (period.startDate()), forwardLabel, - dblCapATMFairPremium); - - lsATMFRACapFloorlet.add (new org.drip.product.fra.FRAStandardCapFloorlet (fra.name() + "::LET", - fra, strManifestMeasure, _bIsCap, dblCapATMFairPremium, _stream.notional - (period.startDate()), ltds, fpg, cashSettleParams())); - } - - for (org.drip.product.fra.FRAStandardCapFloorlet fracfl : lsATMFRACapFloorlet) { - org.drip.analytics.date.JulianDate dtExercise = fracfl.exerciseDate(); - - int iExerciseDate = dtExercise.julian(); - - if (iExerciseDate <= iValueDate) continue; - - dblPrice += fracfl.price (valParams, pricerParams, csqs, vcp, dblFlatVolatility); - } - - return dblPrice; - } - - /** - * Imply the Flat Cap/Floor Volatility from the Calibration ATM Price - * - * @param valParams The Valuation Parameters - * @param pricerParams The Pricer Parameters - * @param csqs The Market Parameters - * @param vcp The Valuation Customization Parameters - * @param dblCalibPrice The Calibration Price - * - * @return The Cap/Floor Flat Volatility - * - * @throws java.lang.Exception Thrown if the Flat Volatility cannot be calculated - */ - - public double volatilityFromATMPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCalibPrice) - throws java.lang.Exception - { - if (null == valParams || !org.drip.quant.common.NumberUtil.IsValid (dblCalibPrice)) - throw new java.lang.Exception ("FRAStandardCapFloor::volatilityFromATMPrice => Invalid Inputs"); - - org.drip.function.definition.R1ToR1 funcVolPricer = new org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblVolatility) - throws java.lang.Exception - { - return atmPriceFromVolatility (valParams, pricerParams, csqs, vcp, dblVolatility); - } - }; - - org.drip.function.r1tor1solver.FixedPointFinderOutput fpfo = (new - org.drip.function.r1tor1solver.FixedPointFinderBracketing (dblCalibPrice, funcVolPricer, null, - org.drip.function.r1tor1solver.VariateIteratorPrimitive.BISECTION, false)).findRoot - (org.drip.function.r1tor1solver.InitializationHeuristics.FromHardSearchEdges (0.0001, - 5.)); - - if (null == fpfo || !fpfo.containsRoot()) - throw new java.lang.Exception - ("FRAStandardCapFloor::volatilityFromATMPrice => Cannot imply Flat Vol"); - - return fpfo.getRoot(); - } - - /** - * Compute the Cap/Floor Price from the Flat Volatility - * - * @param valParams The Valuation Parameters - * @param pricerParams The Pricer Parameters - * @param csqs The Market Parameters - * @param vcp The Valuation Customization Parameters - * @param dblFlatVolatility The Flat Volatility - * - * @return The Cap/Floor Price - * - * @throws java.lang.Exception Thrown if the Price cannot be calculated - */ - - public double priceFromFlatVolatility ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblFlatVolatility) - throws java.lang.Exception - { - if (null == valParams || !org.drip.quant.common.NumberUtil.IsValid (dblFlatVolatility)) - throw new java.lang.Exception ("FRAStandardCapFloor::priceFromFlatVolatility => Invalid Inputs"); - - int iValueDate = valParams.valueDate(); - - double dblPrice = 0.; - - for (org.drip.product.fra.FRAStandardCapFloorlet fracfl : _lsFRACapFloorlet) { - org.drip.analytics.date.JulianDate dtExercise = fracfl.exerciseDate(); - - int iExerciseDate = dtExercise.julian(); - - if (iExerciseDate <= iValueDate) continue; - - dblPrice += fracfl.price (valParams, pricerParams, csqs, vcp, dblFlatVolatility); - } - - return dblPrice; - } - - /** - * Imply the Flat Cap/Floor Volatility from the Calibration Price - * - * @param valParams The Valuation Parameters - * @param pricerParams The Pricer Parameters - * @param csqs The Market Parameters - * @param vcp The Valuation Customization Parameters - * @param dblCalibPrice The Calibration Price - * - * @return The Cap/Floor Flat Volatility - * - * @throws java.lang.Exception Thrown if the Price cannot be calculated - */ - - public double flatVolatilityFromPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCalibPrice) - throws java.lang.Exception - { - if (null == valParams || !org.drip.quant.common.NumberUtil.IsValid (dblCalibPrice)) - throw new java.lang.Exception ("FRAStandardCapFloor::flatVolatilityFromPrice => Invalid Inputs"); - - org.drip.function.definition.R1ToR1 funcVolPricer = new org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblVolatility) - throws java.lang.Exception - { - return priceFromFlatVolatility (valParams, pricerParams, csqs, vcp, dblVolatility); - } - }; - - org.drip.function.r1tor1solver.FixedPointFinderOutput fpfo = (new - org.drip.function.r1tor1solver.FixedPointFinderBracketing (dblCalibPrice, funcVolPricer, null, - org.drip.function.r1tor1solver.VariateIteratorPrimitive.BISECTION, false)).findRoot - (org.drip.function.r1tor1solver.InitializationHeuristics.FromHardSearchEdges (0.0001, - 5.)); - - if (null == fpfo || !fpfo.containsRoot()) - throw new java.lang.Exception - ("FRAStandardCapFloor::flatVolatilityFromPrice => Cannot imply Flat Vol"); - - return fpfo.getRoot(); - } - - /** - * Strip the Piece-wise Constant Forward Rate Volatility of the Unmarked Segment of the Volatility Term - * Structure - * - * @param valParams The Valuation Parameters - * @param pricerParams The pricer Parameters - * @param csqs The Market Parameters - * @param vcp The Valuation Customization Parameters - * @param dblCapVolatility The Flat Cap Volatility - * @param mapDateVol The Date/Volatility Map - * - * @return TRUE - The Forward Rate Volatility of the Unmarked Segment of the Volatility Term Structure - * successfully implied - */ - - public boolean stripPiecewiseForwardVolatility ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblCapVolatility, - final java.util.Map mapDateVol) - { - if (null == valParams || null == mapDateVol) return false; - - int iIndex = 0; - double dblPreceedingCapFloorletPV = 0.; - double dblCapPrice = java.lang.Double.NaN; - org.drip.function.r1tor1solver.FixedPointFinderOutput fpfo = null; - - try { - dblCapPrice = priceFromFlatVolatility (valParams, pricerParams, csqs, vcp, dblCapVolatility); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - final int iValueDate = valParams.valueDate(); - - final java.util.List lsCalibCapFloorletIndex = new - java.util.ArrayList(); - - for (org.drip.product.fra.FRAStandardCapFloorlet fracfl : _lsFRACapFloorlet) { - org.drip.analytics.date.JulianDate dtExercise = fracfl.exerciseDate(); - - int iExerciseDate = dtExercise.julian(); - - if (iExerciseDate <= iValueDate) continue; - - if (mapDateVol.containsKey (dtExercise)) { - double dblExerciseVolatility = mapDateVol.get (dtExercise); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapCapFloorlet = - fracfl.valueFromSurfaceVariance (valParams, pricerParams, csqs, vcp, - dblExerciseVolatility * dblExerciseVolatility * (iExerciseDate - iValueDate) / - 365.25); - - if (null == mapCapFloorlet || !mapCapFloorlet.containsKey ("Price")) return false; - - dblPreceedingCapFloorletPV += mapCapFloorlet.get ("Price"); - } else - lsCalibCapFloorletIndex.add (iIndex); - - ++iIndex; - } - - org.drip.function.definition.R1ToR1 funcVolPricer = new org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblVolatility) - throws java.lang.Exception - { - int iIndex = 0; - double dblSucceedingCapFloorletPV = 0.; - - for (org.drip.product.fra.FRAStandardCapFloorlet fracfl : _lsFRACapFloorlet) { - int iExerciseDate = fracfl.exerciseDate().julian(); - - if (iExerciseDate <= iValueDate) continue; - - if (lsCalibCapFloorletIndex.contains (iIndex)) { - java.util.Map mapOutput = - fracfl.valueFromSurfaceVariance (valParams, pricerParams, csqs, vcp, - dblVolatility * dblVolatility * (iExerciseDate - iValueDate) / 365.25); - - if (null == mapOutput || !mapOutput.containsKey ("Price")) - throw new java.lang.Exception - ("FRAStandardCapFloor::implyVolatility => Cannot generate Calibration Measure"); - - dblSucceedingCapFloorletPV += mapOutput.get ("Price"); - } - - ++iIndex; - } - - return dblSucceedingCapFloorletPV; - } - }; - - try { - fpfo = (new org.drip.function.r1tor1solver.FixedPointFinderBracketing (dblCapPrice - - dblPreceedingCapFloorletPV, funcVolPricer, null, - org.drip.function.r1tor1solver.VariateIteratorPrimitive.BISECTION, false)).findRoot - (org.drip.function.r1tor1solver.InitializationHeuristics.FromHardSearchEdges (0.0001, - 5.)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - if (null == fpfo || !fpfo.containsRoot()) return false; - - double dblVolatility = fpfo.getRoot(); - - iIndex = 0; - - for (org.drip.product.fra.FRAStandardCapFloorlet fracfl : _lsFRACapFloorlet) { - if (lsCalibCapFloorletIndex.contains (iIndex)) - mapDateVol.put (fracfl.exerciseDate(), dblVolatility); - - ++iIndex; - } - - return true; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint volatilityPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - if (null == pqs || null == valParams || !(pqs instanceof - org.drip.product.calib.VolatilityProductQuoteSet)) - return null; - - if (valParams.valueDate() > maturityDate().julian()) return null; - - double dblOptionPV = 0.; - org.drip.product.calib.VolatilityProductQuoteSet vpqs = - (org.drip.product.calib.VolatilityProductQuoteSet) pqs; - - if (!vpqs.containsOptionPV()) return null; - - try { - dblOptionPV = vpqs.optionPV(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.state.estimator.PredictorResponseWeightConstraint prwc = new - org.drip.state.estimator.PredictorResponseWeightConstraint(); - - for (org.drip.product.fra.FRAStandardCapFloorlet frascf : _lsFRACapFloorlet) { - org.drip.state.estimator.PredictorResponseWeightConstraint prwcFRASCF = frascf.volatilityPRWC - (valParams, pricerParams, csqs, vcp, pqs); - - if (null == prwcFRASCF || !prwc.absorb (prwcFRASCF)) return null; - } - - return !prwc.updateValue (dblOptionPV) || !prwc.updateDValueDManifestMeasure ("OptionPV", 1.) ? null - : prwc; - } -} diff --git a/org/drip/product/fra/FRAStandardCapFloorlet.java b/org/drip/product/fra/FRAStandardCapFloorlet.java deleted file mode 100644 index e9b30ea..0000000 --- a/org/drip/product/fra/FRAStandardCapFloorlet.java +++ /dev/null @@ -1,609 +0,0 @@ - -package org.drip.product.fra; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FRAStandardCapFloorlet implements the Standard FRA Caplet and Floorlet. - * - * @author Lakshmi Krishnamurthy - */ - -public class FRAStandardCapFloorlet extends org.drip.product.option.OptionComponent { - private boolean _bIsCaplet = false; - private org.drip.product.fra.FRAStandardComponent _fra = null; - private org.drip.pricer.option.FokkerPlanckGenerator _fpg = null; - - /** - * FRAStandardCapFloorlet constructor - * - * @param strName Name - * @param fra The Underlying FRA Standard Component - * @param strManifestMeasure Measure of the Underlying Component - * @param bIsCaplet Is the FRA Option a Caplet? TRUE - YES - * @param dblStrike Strike of the Underlying Component's Measure - * @param dblNotional Option Notional - * @param ltds Last Trading Date Setting - * @param fpg The Fokker Planck Pricer Instance - * @param csp Cash Settle Parameters - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public FRAStandardCapFloorlet ( - final java.lang.String strName, - final org.drip.product.fra.FRAStandardComponent fra, - final java.lang.String strManifestMeasure, - final boolean bIsCaplet, - final double dblStrike, - final double dblNotional, - final org.drip.product.params.LastTradingDateSetting ltds, - final org.drip.pricer.option.FokkerPlanckGenerator fpg, - final org.drip.param.valuation.CashSettleParams csp) - throws java.lang.Exception - { - super (strName, fra, strManifestMeasure, dblStrike, dblNotional, ltds, csp); - - if (null == (_fpg = fpg)) - throw new java.lang.Exception ("FRAStandardCapFloorlet ctr: Invalid Option Pricer"); - - _fra = fra; - _bIsCaplet = bIsCaplet; - } - - /** - * Retrieve the Underlying FRA Instance - * - * @return The FRA Instance - */ - - public org.drip.product.fra.FRAStandardComponent fra() - { - return _fra; - } - - /** - * Indicate whether this a Caplet/Floorlet - * - * @return TRUE - This is a Caplet - */ - - public boolean isCaplet() - { - return _bIsCaplet; - } - - /** - * Retrieve the Underlying Pricer Instance - * - * @return The Pricer Instance - */ - - public org.drip.pricer.option.FokkerPlanckGenerator pricer() - { - return _fpg; - } - - /** - * Generate the Standard FRA Caplet/Floorlet Measures from the Integrated Surface Variance - * - * @param valParams The Valuation Parameters - * @param pricerParams The Pricer Parameters - * @param csqs The Market Parameters - * @param vcp The Valuation Customization Parameters - * @param dblIntegratedSurfaceVariance The Integrated Surface Variance - * - * @return The Standard FRA Caplet/Floorlet Measures - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap valueFromSurfaceVariance ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblIntegratedSurfaceVariance) - { - if (null == valParams || null == csqs || !org.drip.quant.common.NumberUtil.IsValid - (dblIntegratedSurfaceVariance)) - return null; - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqs.fundingState - (org.drip.state.identifier.FundingLabel.Standard (_fra.payCurrency())); - - if (null == dcFunding) return null; - - int iValueDate = valParams.valueDate(); - - org.drip.product.params.LastTradingDateSetting ltds = lastTradingDateSetting(); - - try { - if (null != ltds && iValueDate >= ltds.lastTradingDate (_fra.effectiveDate().julian(), - _fra.stream().calendar())) - return null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - long lStart = System.nanoTime(); - - int iExerciseDate = exerciseDate().julian(); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapFRAOutput = _fra.value - (valParams, pricerParams, csqs, vcp); - - java.lang.String strManifestMeasure = manifestMeasure(); - - if (null == mapFRAOutput || !mapFRAOutput.containsKey (strManifestMeasure)) return null; - - double dblFRADV01 = mapFRAOutput.get ("DV01"); - - double dblATMManifestMeasure = mapFRAOutput.get (strManifestMeasure); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblATMManifestMeasure) || - !org.drip.quant.common.NumberUtil.IsValid (dblFRADV01)) - return null; - - try { - double dblStrike = strike(); - - double dblNotional = notional(); - - double dblMoneynessFactor = dblATMManifestMeasure / dblStrike; - double dblManifestMeasurePriceTransformer = java.lang.Double.NaN; - double dblManifestMeasureIntrinsic = _bIsCaplet ? dblATMManifestMeasure - dblStrike : dblStrike - - dblATMManifestMeasure; - - if (strManifestMeasure.equalsIgnoreCase ("Price") || strManifestMeasure.equalsIgnoreCase ("PV")) - dblManifestMeasurePriceTransformer = dcFunding.df (iExerciseDate); - else if (strManifestMeasure.equalsIgnoreCase ("ForwardRate") || - strManifestMeasure.equalsIgnoreCase ("ParForward") || strManifestMeasure.equalsIgnoreCase - ("ParForwardRate") || strManifestMeasure.equalsIgnoreCase ("QuantoAdjustedParForward") || - strManifestMeasure.equalsIgnoreCase ("Rate")) - dblManifestMeasurePriceTransformer = 10000. * dblFRADV01; - - if (!org.drip.quant.common.NumberUtil.IsValid (dblManifestMeasurePriceTransformer)) return null; - - org.drip.pricer.option.Greeks optGreek = _fpg.greeks (iValueDate, iExerciseDate, dblStrike, - dcFunding, dblATMManifestMeasure, !_bIsCaplet, true, dblIntegratedSurfaceVariance); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapResult = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - double dblForwardIntrinsic = optGreek.expectedPayoff(); - - double dblForwardATMIntrinsic = optGreek.expectedATMPayoff(); - - double dblSpotPrice = dblForwardIntrinsic * dblManifestMeasurePriceTransformer; - - mapResult.put ("ATMFRA", dblATMManifestMeasure); - - mapResult.put ("ATMPrice", dblForwardATMIntrinsic * dblManifestMeasurePriceTransformer); - - mapResult.put ("CalcTime", (System.nanoTime() - lStart) * 1.e-09); - - mapResult.put ("Charm", optGreek.charm() * dblManifestMeasurePriceTransformer); - - mapResult.put ("Color", optGreek.color() * dblManifestMeasurePriceTransformer); - - mapResult.put ("Delta", optGreek.delta() * dblManifestMeasurePriceTransformer); - - mapResult.put ("EffectiveVolatility", optGreek.effectiveVolatility()); - - mapResult.put ("ExpectedATMPayoff", optGreek.expectedATMPayoff()); - - mapResult.put ("ExpectedPayoff", optGreek.expectedPayoff()); - - mapResult.put ("ForwardATMIntrinsic", dblForwardATMIntrinsic); - - mapResult.put ("ForwardIntrinsic", dblForwardIntrinsic); - - mapResult.put ("Gamma", optGreek.gamma() * dblManifestMeasurePriceTransformer); - - mapResult.put ("IntegratedSurfaceVariance", dblIntegratedSurfaceVariance); - - mapResult.put ("ManifestMeasureIntrinsic", dblManifestMeasureIntrinsic); - - mapResult.put ("ManifestMeasureIntrinsicValue", dblManifestMeasureIntrinsic * - dblManifestMeasurePriceTransformer); - - mapResult.put ("ManifestMeasureTransformer", dblManifestMeasurePriceTransformer); - - mapResult.put ("MoneynessFactor", dblMoneynessFactor); - - mapResult.put ("Price", dblSpotPrice); - - mapResult.put ("Prob1", optGreek.prob1()); - - mapResult.put ("Prob2", optGreek.prob2()); - - mapResult.put ("PV", dblSpotPrice * dblNotional); - - mapResult.put ("Rho", optGreek.rho() * dblManifestMeasurePriceTransformer); - - mapResult.put ("Speed", optGreek.speed() * dblManifestMeasurePriceTransformer); - - mapResult.put ("SpotPrice", dblSpotPrice); - - mapResult.put ("Theta", optGreek.theta() * dblManifestMeasurePriceTransformer); - - mapResult.put ("Ultima", optGreek.ultima() * dblManifestMeasurePriceTransformer); - - mapResult.put ("Upfront", dblSpotPrice); - - mapResult.put ("Vanna", optGreek.vanna() * dblManifestMeasurePriceTransformer); - - mapResult.put ("Vega", optGreek.vega() * dblManifestMeasurePriceTransformer); - - mapResult.put ("Veta", optGreek.veta() * dblManifestMeasurePriceTransformer); - - mapResult.put ("Vomma", optGreek.vomma() * dblManifestMeasurePriceTransformer); - - return mapResult; - } catch (java.lang.Exception e) { - // e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Caplet/Floorlet Price from the Inputs - * - * @param valParams The Valuation Parameters - * @param pricerParams Pricer Parameters - * @param csqs The Market Parameters - * @param vcp The Valuation Customization Parameters - * @param dblVolatility The FRA Volatility - * - * @return The Caplet/Floorlet Price - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double price ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblVolatility) - throws java.lang.Exception - { - if (null == valParams || null == csqs || !org.drip.quant.common.NumberUtil.IsValid (dblVolatility)) - throw new java.lang.Exception ("FRAStandardCapFloorlet::price => Invalid Inputs"); - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqs.fundingState - (org.drip.state.identifier.FundingLabel.Standard (_fra.payCurrency())); - - if (null == dcFunding) - throw new java.lang.Exception ("FRAStandardCapFloorlet::price => Invalid Inputs"); - - int iExerciseDate = exerciseDate().julian(); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapFRAOutput = _fra.value - (valParams, pricerParams, csqs, vcp); - - java.lang.String strManifestMeasure = manifestMeasure(); - - if (null == mapFRAOutput || !mapFRAOutput.containsKey (strManifestMeasure)) - throw new java.lang.Exception ("FRAStandardCapFloorlet::price => No ATM Metric"); - - double dblManifestMeasurePriceTransformer = java.lang.Double.NaN; - - if (strManifestMeasure.equalsIgnoreCase ("Price") || strManifestMeasure.equalsIgnoreCase ("PV")) - dblManifestMeasurePriceTransformer = dcFunding.df (iExerciseDate); - else if (strManifestMeasure.equalsIgnoreCase ("ForwardRate") || - strManifestMeasure.equalsIgnoreCase ("ParForward") || strManifestMeasure.equalsIgnoreCase - ("ParForwardRate") || strManifestMeasure.equalsIgnoreCase ("QuantoAdjustedParForward") || - strManifestMeasure.equalsIgnoreCase ("Rate")) { - if (!mapFRAOutput.containsKey ("DV01")) - throw new java.lang.Exception ("FRAStandardCapFloorlet::price => No FRA DV01"); - - dblManifestMeasurePriceTransformer = 10000. * mapFRAOutput.get ("DV01"); - } - - if (!org.drip.quant.common.NumberUtil.IsValid (dblManifestMeasurePriceTransformer)) - throw new java.lang.Exception - ("FRAStandardCapFloorlet::price => No Manifest Measure Price Transformer"); - - return dblManifestMeasurePriceTransformer * _fpg.payoff (valParams.valueDate(), iExerciseDate, - strike(), dcFunding, mapFRAOutput.get (strManifestMeasure), !_bIsCaplet, true, dblVolatility, - false); - } - - /** - * Imply the Flat Caplet/Floorlet Volatility from the Market Manifest Measure - * - * @param valParams The Valuation Parameters - * @param pricerParams Pricer Parameters - * @param csqs The Market Parameters - * @param vcp The Valuation Customization Parameters - * @param strCalibMeasure The Calibration Measure - * @param dblCalibValue The Calibration Value - * - * @return The Implied Caplet/Floorlet Volatility - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double implyVolatility ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final java.lang.String strCalibMeasure, - final double dblCalibValue) - throws java.lang.Exception - { - if (null == valParams || null == strCalibMeasure || strCalibMeasure.isEmpty() || null == csqs || - !org.drip.quant.common.NumberUtil.IsValid (dblCalibValue)) - throw new java.lang.Exception ("FRAStandardCapFloorlet::implyVolatility => Invalid Inputs"); - - final double dblStrike = strike(); - - final int iValueDate = valParams.valueDate(); - - final int iExerciseDate = exerciseDate().julian(); - - final org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqs.fundingState - (org.drip.state.identifier.FundingLabel.Standard (_fra.payCurrency())); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapFRAOutput = _fra.value - (valParams, pricerParams, csqs, vcp); - - java.lang.String strManifestMeasure = manifestMeasure(); - - if (null == mapFRAOutput || !mapFRAOutput.containsKey (strManifestMeasure)) - throw new java.lang.Exception ("FRAStandardCapFloorlet::implyVolatility => No ATM Metric"); - - final double dblATMManifestMeasure = mapFRAOutput.get (strManifestMeasure); - - double dblManifestMeasurePriceTransformer = java.lang.Double.NaN; - - if (strManifestMeasure.equalsIgnoreCase ("Price") || strManifestMeasure.equalsIgnoreCase ("PV")) - dblManifestMeasurePriceTransformer = dcFunding.df (iExerciseDate); - else if (strManifestMeasure.equalsIgnoreCase ("ForwardRate") || - strManifestMeasure.equalsIgnoreCase ("ParForward") || strManifestMeasure.equalsIgnoreCase - ("ParForwardRate") || strManifestMeasure.equalsIgnoreCase ("QuantoAdjustedParForward") || - strManifestMeasure.equalsIgnoreCase ("Rate")) { - if (!mapFRAOutput.containsKey ("DV01")) - throw new java.lang.Exception ("FRAStandardCapFloorlet::implyVolatility => No DV01"); - - dblManifestMeasurePriceTransformer = 10000. * mapFRAOutput.get ("DV01"); - } - - final double dblManifestMeasurePriceTransformerCalib = dblManifestMeasurePriceTransformer; - - if (!org.drip.quant.common.NumberUtil.IsValid (dblManifestMeasurePriceTransformer)) - throw new java.lang.Exception ("FRAStandardCapFloorlet::implyVolatility => No Transformer"); - - org.drip.function.definition.R1ToR1 funcVolPricer = new org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblVolatility) - throws java.lang.Exception - { - if ("Price".equals (strCalibMeasure)) - return dblManifestMeasurePriceTransformerCalib * _fpg.payoff (iValueDate, iExerciseDate, - dblStrike, dcFunding, dblATMManifestMeasure, !_bIsCaplet, true, dblVolatility, - false); - - if ("ATMPrice".equals (strCalibMeasure)) - return dblManifestMeasurePriceTransformerCalib * _fpg.payoff (iValueDate, iExerciseDate, - dblStrike, dcFunding, dblStrike, !_bIsCaplet, true, dblVolatility, false); - - java.util.Map mapOutput = valueFromSurfaceVariance - (valParams, pricerParams, csqs, vcp, dblVolatility * dblVolatility * (iExerciseDate - - iValueDate) / 365.25); - - if (null == mapOutput || !mapOutput.containsKey (strCalibMeasure)) - throw new java.lang.Exception - ("FRAStandardCapFloorlet::implyVolatility => Cannot generate Calibration Measure"); - - return mapOutput.get (strCalibMeasure); - - } - }; - - org.drip.function.r1tor1solver.FixedPointFinderOutput fpfo = (new - org.drip.function.r1tor1solver.FixedPointFinderBrent (dblCalibValue, funcVolPricer, - false)).findRoot(); - - if (null == fpfo || !fpfo.containsRoot()) - throw new java.lang.Exception - ("FRAStandardCapFloorlet::implyVolatility => Cannot calibrate the Vol"); - - return fpfo.getRoot(); - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap value ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == valParams || null == csqs) return null; - - try { - return valueFromSurfaceVariance (valParams, pricerParams, csqs, vcp, - org.drip.analytics.support.OptionHelper.IntegratedSurfaceVariance (csqs.forwardVolatility - (_fra.forwardLabel().get ("DERIVED")), valParams.valueDate(), exerciseDate().julian())); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public java.util.Set measureNames() - { - java.util.Set setstrMeasureNames = new java.util.TreeSet(); - - setstrMeasureNames.add ("ATMFRA"); - - setstrMeasureNames.add ("ATMPrice"); - - setstrMeasureNames.add ("CalcTime"); - - setstrMeasureNames.add ("Charm"); - - setstrMeasureNames.add ("Color"); - - setstrMeasureNames.add ("Delta"); - - setstrMeasureNames.add ("EffectiveVolatility"); - - setstrMeasureNames.add ("ExpectedATMPayoff"); - - setstrMeasureNames.add ("ExpectedPayoff"); - - setstrMeasureNames.add ("ForwardATMIntrinsic"); - - setstrMeasureNames.add ("ForwardIntrinsic"); - - setstrMeasureNames.add ("Gamma"); - - setstrMeasureNames.add ("IntegratedSurfaceVariance"); - - setstrMeasureNames.add ("ManifestMeasureIntrinsic"); - - setstrMeasureNames.add ("ManifestMeasureIntrinsicValue"); - - setstrMeasureNames.add ("MoneynessFactor"); - - setstrMeasureNames.add ("Price"); - - setstrMeasureNames.add ("Prob1"); - - setstrMeasureNames.add ("Prob2"); - - setstrMeasureNames.add ("PV"); - - setstrMeasureNames.add ("Rho"); - - setstrMeasureNames.add ("Speed"); - - setstrMeasureNames.add ("SpotPrice"); - - setstrMeasureNames.add ("Theta"); - - setstrMeasureNames.add ("Ultima"); - - setstrMeasureNames.add ("Upfront"); - - setstrMeasureNames.add ("Vanna"); - - setstrMeasureNames.add ("Vega"); - - setstrMeasureNames.add ("Veta"); - - setstrMeasureNames.add ("Vomma"); - - return setstrMeasureNames; - } - - @Override public double pv ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - throws java.lang.Exception - { - if (null == csqc) throw new java.lang.Exception ("FRAStandardCapFloorlet::pv => Invalid Inputs"); - - org.drip.state.volatility.VolatilityCurve vc = csqc.forwardVolatility (_fra.forwardLabel().get - ("DERIVED")); - - if (null == vc) throw new java.lang.Exception ("FRAStandardCapFloorlet::pv => Invalid Inputs"); - - return price (valParams, pricerParams, csqc, vcp, vc.impliedVol (exerciseDate().julian())); - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint volatilityPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - if (null == pqs || null == valParams || !(pqs instanceof - org.drip.product.calib.VolatilityProductQuoteSet)) - return null; - - double dblEndDate = maturityDate().julian(); - - if (valParams.valueDate() > dblEndDate) return null; - - double dblOptionPV = 0.; - org.drip.product.calib.VolatilityProductQuoteSet vpqs = - (org.drip.product.calib.VolatilityProductQuoteSet) pqs; - - if (!vpqs.containsOptionPV()) return null; - - try { - dblOptionPV = vpqs.optionPV(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.state.estimator.PredictorResponseWeightConstraint prwc = _fra.stream().volatilityPRWC - (valParams, pricerParams, csqs, vcp, pqs); - - if (null == prwc) return null; - - if (!prwc.addPredictorResponseWeight (dblEndDate, 1.)) return null; - - if (!prwc.addDResponseWeightDManifestMeasure ("OptionPV", dblEndDate, 1.)) return null; - - return !prwc.updateValue (dblOptionPV) || !prwc.updateDValueDManifestMeasure ("OptionPV", 1.) ? null - : prwc; - } -} diff --git a/org/drip/product/fra/FRAStandardComponent.java b/org/drip/product/fra/FRAStandardComponent.java deleted file mode 100644 index bf07c5e..0000000 --- a/org/drip/product/fra/FRAStandardComponent.java +++ /dev/null @@ -1,338 +0,0 @@ - -package org.drip.product.fra; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FRAStandardComponent contains the implementation of the Standard Multi-Curve FRA Component. - * - * @author Lakshmi Krishnamurthy - */ - -public class FRAStandardComponent extends org.drip.product.rates.SingleStreamComponent { - private double _dblStrike = java.lang.Double.NaN; - - /** - * FRAStandardComponent constructor - * - * @param strName Futures Component Name - * @param stream Futures Stream - * @param dblStrike Futures Strike - * @param csp Cash Settle Parameters Instance - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public FRAStandardComponent ( - final java.lang.String strName, - final org.drip.product.rates.Stream stream, - final double dblStrike, - final org.drip.param.valuation.CashSettleParams csp) - throws java.lang.Exception - { - super (strName, stream, csp); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblStrike = dblStrike)) - throw new java.lang.Exception ("FRAStandardComponent ctr => Invalid Inputs!"); - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap value ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == valParams || null == csqs) return null; - - org.drip.state.identifier.FundingLabel fundingLabel = - org.drip.state.identifier.FundingLabel.Standard (payCurrency()); - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqs.fundingState (fundingLabel); - - if (null == dcFunding) return null; - - long lStart = System.nanoTime(); - - double dblParForward = java.lang.Double.NaN; - - int iValueDate = valParams.valueDate(); - - int iEffectiveDate = effectiveDate().julian(); - - if (iValueDate > iEffectiveDate) return null; - - org.drip.analytics.date.JulianDate dtMaturity = maturityDate(); - - int iMaturityDate = dtMaturity.julian(); - - org.drip.state.identifier.ForwardLabel forwardLabel = forwardLabel().get ("DERIVED"); - - org.drip.state.forward.ForwardRateEstimator fc = csqs.forwardState (forwardLabel); - - if (null == fc || !forwardLabel.match (fc.index())) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapResult = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - org.drip.param.valuation.CashSettleParams settleParams = cashSettleParams(); - - try { - int dblCashSettle = null == settleParams ? valParams.cashPayDate() : settleParams.cashSettleDate - (iValueDate); - - dblParForward = csqs.available (dtMaturity, forwardLabel) ? csqs.fixing (dtMaturity, - forwardLabel) : fc.forward (dtMaturity); - - double dblMultiplicativeQuantoAdjustment = java.lang.Math.exp - (org.drip.analytics.support.OptionHelper.IntegratedCrossVolQuanto (csqs.forwardVolatility - (forwardLabel), csqs.fundingVolatility (fundingLabel), csqs.forwardFundingCorrelation - (forwardLabel, fundingLabel), iValueDate, iEffectiveDate)); - - double dblDCF = org.drip.analytics.daycount.Convention.YearFraction (iEffectiveDate, - iMaturityDate, stream().couponDC(), false, null, stream().calendar()); - - double dblQuantoAdjustedParForward = dblParForward * dblMultiplicativeQuantoAdjustment; - - double dblDV01 = 0.0001 * dblDCF * dcFunding.df (iMaturityDate) / dcFunding.df (dblCashSettle) - * notional (iValueDate); - - double dblLevelLift = dblQuantoAdjustedParForward - _dblStrike; - double dblPV = dblDV01 * dblLevelLift; - double dblLevelCapLift = dblLevelLift < 0. ? -1. * dblLevelLift : 0.; - double dblLevelFloorLift = dblLevelLift > 0. ? dblLevelLift : 0.; - - double dblDCParForward = dcFunding.libor (iEffectiveDate, iMaturityDate); - - mapResult.put ("additivequantoadjustment", dblQuantoAdjustedParForward - dblParForward); - - mapResult.put ("caplift", dblLevelCapLift); - - mapResult.put ("discountcurveadditivebasis", dblQuantoAdjustedParForward - dblDCParForward); - - mapResult.put ("discountcurvemultiplicativebasis", dblQuantoAdjustedParForward / - dblDCParForward); - - mapResult.put ("discountcurveparforward", dblDCParForward); - - mapResult.put ("dv01", dblDV01); - - mapResult.put ("floorlift", dblLevelFloorLift); - - mapResult.put ("forward", dblParForward); - - mapResult.put ("forwardrate", dblParForward); - - mapResult.put ("mercuriorfactor", (dblDCF * dblDCParForward + 1.) / (dblDCF * - dblQuantoAdjustedParForward + 1.)); - - mapResult.put ("multiplicativequantoadjustment", dblMultiplicativeQuantoAdjustment); - - mapResult.put ("parforward", dblParForward); - - mapResult.put ("parforwardrate", dblParForward); - - mapResult.put ("price", dblPV); - - mapResult.put ("pv", dblPV); - - mapResult.put ("quantoadjustedparforward", dblQuantoAdjustedParForward); - - mapResult.put ("upfront", dblPV); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - mapResult.put ("calctime", (System.nanoTime() - lStart) * 1.e-09); - - return mapResult; - } - - @Override public java.util.Set measureNames() - { - java.util.Set setstrMeasureNames = new java.util.TreeSet(); - - setstrMeasureNames.add ("AdditiveQuantoAdjustment"); - - setstrMeasureNames.add ("CalcTime"); - - setstrMeasureNames.add ("CapLift"); - - setstrMeasureNames.add ("DiscountCurveAdditiveBasis"); - - setstrMeasureNames.add ("DiscountCurveMultiplicativeBasis"); - - setstrMeasureNames.add ("DiscountCurveParForward"); - - setstrMeasureNames.add ("DV01"); - - setstrMeasureNames.add ("FloorLift"); - - setstrMeasureNames.add ("Forward"); - - setstrMeasureNames.add ("ForwardRate"); - - setstrMeasureNames.add ("MercurioRFactor"); - - setstrMeasureNames.add ("MultiplicativeQuantoAdjustment"); - - setstrMeasureNames.add ("ParForward"); - - setstrMeasureNames.add ("ParForwardRate"); - - setstrMeasureNames.add ("Price"); - - setstrMeasureNames.add ("PV"); - - setstrMeasureNames.add ("QuantoAdjustedParForward"); - - setstrMeasureNames.add ("Upfront"); - - return setstrMeasureNames; - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDDirtyPVDManifestMeasure ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - return null; - } - - @Override public org.drip.quant.calculus.WengertJacobian manifestMeasureDFMicroJack ( - final java.lang.String strManifestMeasure, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - return null; - } - - @Override public org.drip.product.calib.ProductQuoteSet calibQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - { - try { - return new org.drip.product.calib.FRAComponentQuoteSet (aLSS); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fundingPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint forwardPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - if (null == valParams || null == pqs || !(pqs instanceof - org.drip.product.calib.FRAComponentQuoteSet)) - return null; - - if (valParams.valueDate() > effectiveDate().julian()) return null; - - org.drip.product.calib.FRAComponentQuoteSet fcqs = (org.drip.product.calib.FRAComponentQuoteSet) pqs; - - if (!fcqs.containsFRARate() && !fcqs.containsParForwardRate()) return null; - - double dblForwardRate = java.lang.Double.NaN; - - try { - if (fcqs.containsParForwardRate()) - dblForwardRate = fcqs.parForwardRate(); - else if (fcqs.containsFRARate()) - dblForwardRate = fcqs.fraRate(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.state.estimator.PredictorResponseWeightConstraint prwc = new - org.drip.state.estimator.PredictorResponseWeightConstraint(); - - double dblMaturity = maturityDate().julian(); - - if (!prwc.addPredictorResponseWeight (dblMaturity, 1.)) return null; - - if (!prwc.addDResponseWeightDManifestMeasure ("Rate", dblMaturity, 1.)) return null; - - if (!prwc.updateValue (dblForwardRate)) return null; - - if (!prwc.updateDValueDManifestMeasure ("Rate", 1.)) return null; - - return prwc; - } - - /** - * Retrieve the FRA Strike - * - * @return The FRA Strike - */ - - public double strike() - { - return _dblStrike; - } -} diff --git a/org/drip/product/fx/ComponentPair.java b/org/drip/product/fx/ComponentPair.java deleted file mode 100644 index daa2182..0000000 --- a/org/drip/product/fx/ComponentPair.java +++ /dev/null @@ -1,467 +0,0 @@ - -package org.drip.product.fx; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ComponentPair contains the implementation of the dual cross currency components. It is composed of two - * different Rates Components - one each for each currency. - * - * @author Lakshmi Krishnamurthy - */ - -public class ComponentPair extends org.drip.product.definition.BasketProduct { - private java.lang.String _strName = ""; - private org.drip.param.period.FixingSetting _fxFixingSetting = null; - private org.drip.product.definition.CalibratableComponent _rcDerived = null; - private org.drip.product.definition.CalibratableComponent _rcReference = null; - - /** - * ComponentPair constructor - * - * @param strName The ComponentPair Instance Name - * @param rcReference The Reference Component - * @param rcDerived The Derived Component - * @param fxFixingSetting FX Fixing Setting - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ComponentPair ( - final java.lang.String strName, - final org.drip.product.definition.CalibratableComponent rcReference, - final org.drip.product.definition.CalibratableComponent rcDerived, - final org.drip.param.period.FixingSetting fxFixingSetting) - throws java.lang.Exception - { - if (null == (_strName = strName) || _strName.isEmpty() || null == (_rcDerived = rcDerived) || null == - (_rcReference = rcReference)) - throw new java.lang.Exception ("ComponentPair ctr: Invalid Inputs!"); - - _fxFixingSetting = fxFixingSetting; - } - - /** - * Retrieve the Reference Component - * - * @return The Reference Component - */ - - public org.drip.product.definition.CalibratableComponent referenceComponent() - { - return _rcReference; - } - - /** - * Retrieve the Derived Component - * - * @return The Derived Component - */ - - public org.drip.product.definition.CalibratableComponent derivedComponent() - { - return _rcDerived; - } - - /** - * Retrieve the FX Fixing Setting - * - * @return The FX Fixing Setting - */ - - public org.drip.param.period.FixingSetting fxFixingSetting() - { - return _fxFixingSetting; - } - - /** - * Retrieve the FX Code - * - * @return The FX Code - */ - - public java.lang.String fxCode() - { - java.lang.String strDerivedComponentCouponCurrency = _rcDerived.payCurrency(); - - java.lang.String strReferenceComponentCouponCurrency = _rcReference.payCurrency(); - - return strDerivedComponentCouponCurrency.equalsIgnoreCase (strReferenceComponentCouponCurrency) ? - null : strReferenceComponentCouponCurrency + "/" + strDerivedComponentCouponCurrency; - } - - /** - * Generate the Derived Forward Latent State Segment Specification - * - * @param valParams Valuation Parameters - * @param mktParams Market Parameters - * @param dblBasis The Basis on either the Reference Component or the Derived Component - * @param bBasisOnDerivedComponent TRUE - Apply the Basis on the Derived Component - * @param bBasisOnDerivedStream TRUE - Apply the Basis on the Derived Stream (FALSE - Reference Stream) - * - * @return The Derived Forward Latent State Segment Specification - */ - - public org.drip.state.inference.LatentStateSegmentSpec derivedForwardSpec ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer mktParams, - final double dblBasis, - final boolean bBasisOnDerivedComponent, - final boolean bBasisOnDerivedStream) - { - org.drip.product.calib.ProductQuoteSet pqs = null; - org.drip.state.identifier.ForwardLabel forwardLabel = null; - - org.drip.product.definition.CalibratableComponent comp = derivedComponent(); - - if (comp instanceof org.drip.product.rates.DualStreamComponent) - forwardLabel = ((org.drip.product.rates.DualStreamComponent) - comp).derivedStream().forwardLabel(); - else { - org.drip.analytics.support.CaseInsensitiveTreeMap - mapForwardLabel = comp.forwardLabel(); - - if (null != mapForwardLabel && 0 != mapForwardLabel.size()) - forwardLabel = mapForwardLabel.get (0); - } - - try { - pqs = comp.calibQuoteSet (new org.drip.state.representation.LatentStateSpecification[] {new - org.drip.state.representation.LatentStateSpecification - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_FORWARD, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_FORWARD_RATE, - forwardLabel)}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.analytics.support.CaseInsensitiveTreeMap mapOP = value (valParams, null, - mktParams, null); - - org.drip.product.definition.CalibratableComponent rcReference = referenceComponent(); - - java.lang.String strReferenceComponentName = rcReference.name(); - - org.drip.product.definition.CalibratableComponent rcDerived = derivedComponent(); - - java.lang.String strDerivedComponentName = rcDerived.name(); - - java.lang.String strReferenceComponentPV = strReferenceComponentName + "[PV]"; - - if (!bBasisOnDerivedComponent) { - java.lang.String strReferenceComponentDerivedStreamCleanDV01 = strReferenceComponentName + - "[DerivedCleanDV01]"; - java.lang.String strReferenceComponentReferenceStreamCleanDV01 = strReferenceComponentName + - "[ReferenceCleanDV01]"; - - if (null == mapOP || !mapOP.containsKey (strReferenceComponentPV) || !mapOP.containsKey - (strReferenceComponentReferenceStreamCleanDV01) || !mapOP.containsKey - (strReferenceComponentDerivedStreamCleanDV01)) - return null; - - if (!pqs.set ("PV", -1. * (mapOP.get (strReferenceComponentPV) + 10000. * (bBasisOnDerivedStream - ? mapOP.get (strReferenceComponentDerivedStreamCleanDV01) : mapOP.get - (strReferenceComponentReferenceStreamCleanDV01)) * dblBasis))) - return null; - } else { - java.lang.String strDerivedComponentReferenceStreamCleanDV01 = strDerivedComponentName + - "[ReferenceCleanDV01]"; - java.lang.String strDerivedComponentDerivedStreamCleanDV01 = strDerivedComponentName + - "[DerivedCleanDV01]"; - - if (null == mapOP || !mapOP.containsKey (strReferenceComponentPV) || !mapOP.containsKey - (strDerivedComponentReferenceStreamCleanDV01) || !mapOP.containsKey - (strDerivedComponentDerivedStreamCleanDV01)) - return null; - - if (!pqs.set ("PV", -1. * (mapOP.get (strReferenceComponentPV) + 10000. * (bBasisOnDerivedStream - ? mapOP.get (strDerivedComponentDerivedStreamCleanDV01) : mapOP.get - (strDerivedComponentReferenceStreamCleanDV01)) * dblBasis))) - return null; - } - - try { - return new org.drip.state.inference.LatentStateSegmentSpec (comp, pqs); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Derived Funding/Forward Merged Latent State Segment Specification - * - * @param valParams Valuation Parameters - * @param mktParams Market Parameters - * @param dblReferenceComponentBasis The Reference Component Basis - * @param bBasisOnDerivedLeg TRUE - Apply basis on the Derived Leg - * @param dblSwapRate The Swap Rate - * - * @return The Derived Forward/Funding Latent State Segment Specification - */ - - public org.drip.state.inference.LatentStateSegmentSpec derivedFundingForwardSpec ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer mktParams, - final double dblReferenceComponentBasis, - final boolean bBasisOnDerivedLeg, - final double dblSwapRate) - { - double dblFX = 1.; - org.drip.product.calib.ProductQuoteSet pqs = null; - org.drip.state.identifier.ForwardLabel forwardLabel = null; - org.drip.state.identifier.FundingLabel fundingLabel = null; - - org.drip.product.definition.CalibratableComponent compDerived = derivedComponent(); - - org.drip.product.definition.CalibratableComponent compReference = referenceComponent(); - - if (compDerived instanceof org.drip.product.rates.DualStreamComponent) { - org.drip.product.rates.Stream streamDerived = ((org.drip.product.rates.DualStreamComponent) - compDerived).derivedStream(); - - forwardLabel = streamDerived.forwardLabel(); - - fundingLabel = streamDerived.fundingLabel(); - } else { - org.drip.analytics.support.CaseInsensitiveTreeMap - mapForwardLabel = compDerived.forwardLabel(); - - org.drip.state.identifier.FundingLabel fundingLabelDerived = compDerived.fundingLabel(); - - if (null != mapForwardLabel && 0 != mapForwardLabel.size()) - forwardLabel = mapForwardLabel.get ("DERIVED"); - - if (null != fundingLabelDerived) fundingLabel = fundingLabelDerived; - } - - try { - pqs = compDerived.calibQuoteSet (new org.drip.state.representation.LatentStateSpecification[] - {new org.drip.state.representation.LatentStateSpecification - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_FUNDING, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR, - fundingLabel), new org.drip.state.representation.LatentStateSpecification - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_FORWARD, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_FORWARD_RATE, - forwardLabel)}); - - if (null != _fxFixingSetting && org.drip.param.period.FixingSetting.FIXING_PRESET_STATIC == - _fxFixingSetting.type()) { - org.drip.state.fx.FXCurve fxfc = mktParams.fxState (fxLabel()[0]); - - if (null == fxfc) return null; - - dblFX = fxfc.fx (_fxFixingSetting.staticDate()); - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.analytics.support.CaseInsensitiveTreeMap mapOP = compReference.value - (valParams, null, mktParams, null); - - if (null == mapOP || !mapOP.containsKey ("PV") || !pqs.set ("SwapRate", dblSwapRate)) return null; - - if (bBasisOnDerivedLeg) { - if (!mapOP.containsKey ("DerivedCleanDV01") || !pqs.set ("PV", dblFX * (mapOP.get ("PV") + 10000. - * mapOP.get ("DerivedCleanDV01") * dblReferenceComponentBasis))) - return null; - } else { - if (!mapOP.containsKey ("ReferenceCleanDV01") || !pqs.set ("PV", -1. * dblFX * (mapOP.get ("PV") - + 10000. * mapOP.get ("ReferenceCleanDV01") * dblReferenceComponentBasis))) - return null; - } - - try { - return new org.drip.state.inference.LatentStateSegmentSpec (compDerived, pqs); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public java.lang.String name() - { - return _strName; - } - - @Override public org.drip.state.identifier.FXLabel[] fxLabel() - { - java.lang.String strReferenceCurrency = _rcReference.payCurrency(); - - java.lang.String strDerivedCurrency = _rcDerived.payCurrency(); - - return new org.drip.state.identifier.FXLabel[] {org.drip.state.identifier.FXLabel.Standard - (strReferenceCurrency + "/" + strDerivedCurrency), org.drip.state.identifier.FXLabel.Standard - (strDerivedCurrency + "/" + strReferenceCurrency)}; - } - - @Override public org.drip.product.definition.Component[] components() - { - return new org.drip.product.definition.Component[] {_rcReference, _rcDerived}; - } - - @Override public int measureAggregationType ( - final java.lang.String strMeasureName) - { - return org.drip.product.definition.BasketProduct.MEASURE_AGGREGATION_TYPE_UNIT_ACCUMULATE; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap value ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - long lStart = System.nanoTime(); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapOutput = super.value - (valParams, pricerParams, csqs, vcp); - - if (null == mapOutput) return null; - - org.drip.product.definition.CalibratableComponent rcReference = referenceComponent(); - - org.drip.product.definition.CalibratableComponent rcDerived = derivedComponent(); - - java.lang.String strReferenceCompName = rcReference.name(); - - java.lang.String strDerivedCompName = rcDerived.name(); - - java.lang.String strDerivedCompPV = strDerivedCompName + "[PV]"; - java.lang.String strReferenceCompPV = strReferenceCompName + "[PV]"; - java.lang.String strDerivedCompDerivedDV01 = strDerivedCompName + "[DerivedCleanDV01]"; - java.lang.String strReferenceCompDerivedDV01 = strReferenceCompName + "[DerivedCleanDV01]"; - java.lang.String strDerivedCompReferenceDV01 = strDerivedCompName + "[ReferenceCleanDV01]"; - java.lang.String strReferenceCompReferenceDV01 = strReferenceCompName + "[ReferenceCleanDV01]"; - java.lang.String strDerivedCompCumulativeConvexityPremium = strDerivedCompName + - "[CumulativeConvexityAdjustmentPremium]"; - java.lang.String strDerivedCompCumulativeConvexityAdjustment = strDerivedCompName + - "[CumulativeConvexityAdjustmentFactor]"; - java.lang.String strReferenceCompCumulativeConvexityPremium = strReferenceCompName + - "[CumulativeConvexityAdjustmentPremium]"; - java.lang.String strReferenceCompCumulativeConvexityAdjustment = strReferenceCompName + - "[QuantoAdjustmentFactor]"; - - if (!mapOutput.containsKey (strDerivedCompPV) || !mapOutput.containsKey (strReferenceCompPV) || - !mapOutput.containsKey (strReferenceCompReferenceDV01) || !mapOutput.containsKey - (strReferenceCompDerivedDV01) || !mapOutput.containsKey (strDerivedCompReferenceDV01) || - !mapOutput.containsKey (strDerivedCompDerivedDV01) || !mapOutput.containsKey - (strDerivedCompCumulativeConvexityPremium) || !mapOutput.containsKey - (strReferenceCompCumulativeConvexityPremium)) { - mapOutput.put ("CalcTime", (System.nanoTime() - lStart) * 1.e-09); - - return mapOutput; - } - - double dblDerivedCompPV = mapOutput.get (strDerivedCompPV); - - double dblReferenceCompPV = mapOutput.get (strReferenceCompPV); - - double dblDerivedCompDerivedDV01 = mapOutput.get (strDerivedCompDerivedDV01); - - double dblDerivedCompReferenceDV01 = mapOutput.get (strDerivedCompReferenceDV01); - - double dblReferenceCompDerivedDV01 = mapOutput.get (strReferenceCompDerivedDV01); - - double dblReferenceCompReferenceDV01 = mapOutput.get (strReferenceCompReferenceDV01); - - mapOutput.put ("ReferenceCompReferenceBasis", -1. * (dblDerivedCompPV + dblReferenceCompPV) / - dblReferenceCompReferenceDV01); - - mapOutput.put ("ReferenceCompDerivedBasis", -1. * (dblDerivedCompPV + dblReferenceCompPV) / - dblReferenceCompDerivedDV01); - - mapOutput.put ("DerivedCompReferenceBasis", -1. * (dblDerivedCompPV + dblReferenceCompPV) / - dblDerivedCompReferenceDV01); - - mapOutput.put ("DerivedCompDerivedBasis", -1. * (dblDerivedCompPV + dblReferenceCompPV) / - dblDerivedCompDerivedDV01); - - if (mapOutput.containsKey (strReferenceCompCumulativeConvexityAdjustment)) - mapOutput.put ("ReferenceCumulativeConvexityAdjustmentFactor", mapOutput.get - (strReferenceCompCumulativeConvexityAdjustment)); - - double dblReferenceCumulativeConvexityAdjustmentPremium = mapOutput.get - (strReferenceCompCumulativeConvexityPremium); - - mapOutput.put ("ReferenceCumulativeConvexityAdjustmentPremium", - dblReferenceCumulativeConvexityAdjustmentPremium); - - if (mapOutput.containsKey (strDerivedCompCumulativeConvexityAdjustment)) - mapOutput.put ("DerivedCumulativeConvexityAdjustmentFactor", mapOutput.get - (strDerivedCompCumulativeConvexityAdjustment)); - - double dblDerivedCumulativeConvexityAdjustmentPremium = mapOutput.get - (strDerivedCompCumulativeConvexityPremium); - - mapOutput.put ("DerivedCumulativeConvexityAdjustmentPremium", - dblDerivedCumulativeConvexityAdjustmentPremium); - - try { - mapOutput.put ("CumulativeConvexityAdjustmentPremium", _rcReference.initialNotional() * - dblReferenceCumulativeConvexityAdjustmentPremium + _rcDerived.initialNotional() * - dblDerivedCumulativeConvexityAdjustmentPremium); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - mapOutput.put ("CalcTime", (System.nanoTime() - lStart) * 1.e-09); - - return mapOutput; - } -} diff --git a/org/drip/product/fx/DomesticCollateralizedForeignForward.java b/org/drip/product/fx/DomesticCollateralizedForeignForward.java deleted file mode 100644 index 0601d88..0000000 --- a/org/drip/product/fx/DomesticCollateralizedForeignForward.java +++ /dev/null @@ -1,217 +0,0 @@ - -package org.drip.product.fx; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * DomesticCollateralizedForeignForward contains the Domestic Currency Collateralized Foreign Payout FX - * forward product contract details. - * - * @author Lakshmi Krishnamurthy - */ - -public class DomesticCollateralizedForeignForward { - private java.lang.String _strCode = ""; - private org.drip.product.params.CurrencyPair _cp = null; - private int _iMaturityDate = java.lang.Integer.MIN_VALUE; - private double _dblForexForwardStrike = java.lang.Double.NaN; - - /** - * Create an DomesticCollateralizedForeignForward from the currency pair, the strike, and the maturity - * dates - * - * @param cp Currency Pair - * @param dblForexForwardStrike Forex Forward Strike - * @param dtMaturity Maturity Date - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public DomesticCollateralizedForeignForward ( - final org.drip.product.params.CurrencyPair cp, - final double dblForexForwardStrike, - final org.drip.analytics.date.JulianDate dtMaturity) - throws java.lang.Exception - { - if (null == (_cp = cp) || !org.drip.quant.common.NumberUtil.IsValid (_dblForexForwardStrike = - dblForexForwardStrike) || null == dtMaturity) - throw new java.lang.Exception ("DomesticCollateralizedForeignForward ctr: Invalid Inputs"); - - _iMaturityDate = dtMaturity.julian(); - } - - public java.lang.String getPrimaryCode() - { - return _strCode; - } - - public void setPrimaryCode ( - final java.lang.String strCode) - { - _strCode = strCode; - } - - public java.lang.String[] getSecondaryCode() - { - java.lang.String strPrimaryCode = getPrimaryCode(); - - int iNumTokens = 0; - java.lang.String astrCodeTokens[] = new java.lang.String[2]; - - java.util.StringTokenizer stCodeTokens = new java.util.StringTokenizer (strPrimaryCode, "."); - - while (stCodeTokens.hasMoreTokens()) - astrCodeTokens[iNumTokens++] = stCodeTokens.nextToken(); - - return new java.lang.String[] {astrCodeTokens[0]}; - } - - public org.drip.analytics.date.JulianDate getMaturityDate() - { - try { - return new org.drip.analytics.date.JulianDate (_iMaturityDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - public org.drip.product.params.CurrencyPair getCcyPair() - { - return _cp; - } - - public org.drip.analytics.support.CaseInsensitiveTreeMap value ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - { - if (null == valParams || null == csqs) return null; - - long lStart = System.nanoTime(); - - int iValueDate = valParams.valueDate(); - - if (iValueDate > _iMaturityDate) return null; - - org.drip.state.fx.FXCurve fxfc = csqs.fxState (org.drip.state.identifier.FXLabel.Standard (_cp)); - - if (null == fxfc) return null; - - java.lang.String strDomesticCurrency = _cp.denomCcy(); - - org.drip.state.discount.MergedDiscountForwardCurve dcDomesticCollateral = - csqs.payCurrencyCollateralCurrencyCurve (strDomesticCurrency, strDomesticCurrency); - - if (null == dcDomesticCollateral) return null; - - java.lang.String strForeignCurrency = _cp.numCcy(); - - org.drip.state.discount.MergedDiscountForwardCurve dcForeignCurrencyDomesticCollateral = - csqs.payCurrencyCollateralCurrencyCurve (strForeignCurrency, strDomesticCurrency); - - if (null == dcForeignCurrencyDomesticCollateral) return null; - - double dblPrice = java.lang.Double.NaN; - double dblSpotFX = java.lang.Double.NaN; - double dblParForward = java.lang.Double.NaN; - double dblDomesticCollateralDF = java.lang.Double.NaN; - double dblForeignCurrencyDomesticCollateralDF = java.lang.Double.NaN; - - try { - dblPrice = (dblForeignCurrencyDomesticCollateralDF = dcForeignCurrencyDomesticCollateral.df - (_iMaturityDate)) - (_dblForexForwardStrike * (dblDomesticCollateralDF = - dcDomesticCollateral.df (_iMaturityDate)) / (dblSpotFX = fxfc.fx (iValueDate))); - - dblParForward = dblSpotFX * dblForeignCurrencyDomesticCollateralDF / dblDomesticCollateralDF; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.analytics.support.CaseInsensitiveTreeMap mapResult = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapResult.put ("CalcTime", (System.nanoTime() - lStart) * 1.e-09); - - mapResult.put ("DomesticCollateralDF", dblDomesticCollateralDF); - - mapResult.put ("ForeignCurrencyDomesticCollateralDF", dblForeignCurrencyDomesticCollateralDF); - - mapResult.put ("ParForward", dblParForward); - - mapResult.put ("Price", dblPrice); - - mapResult.put ("SpotFX", dblSpotFX); - - return mapResult; - } - - public java.util.Set getMeasureNames() - { - java.util.Set setstrMeasureNames = new java.util.TreeSet(); - - setstrMeasureNames.add ("CalcTime"); - - setstrMeasureNames.add ("DomesticCurrencyForeignCollateralDF"); - - setstrMeasureNames.add ("ForeignCollateralDF"); - - setstrMeasureNames.add ("ParForward"); - - setstrMeasureNames.add ("Price"); - - setstrMeasureNames.add ("SpotFX"); - - return setstrMeasureNames; - } -} diff --git a/org/drip/product/fx/FXForwardComponent.java b/org/drip/product/fx/FXForwardComponent.java deleted file mode 100644 index 2f145d8..0000000 --- a/org/drip/product/fx/FXForwardComponent.java +++ /dev/null @@ -1,703 +0,0 @@ - -package org.drip.product.fx; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FXForwardComponent contains the Standard FX forward Component contract details - the effective date, the - * maturity date, the currency pair and the product code. It also exports a calibrator that computes the - * forward points from the discount curve. - * - * @author Lakshmi Krishnamurthy - */ - -public class FXForwardComponent extends org.drip.product.definition.CalibratableComponent { - - /** - * @author Lakshmi Krishnamurthy - * - * Calibrator for FXBasis - either bootstrapped or cumulative - */ - - public class FXBasisCalibrator { - private FXForwardComponent _fxfwd = null; - - // DC Basis Calibration Stochastic Control - - private int _iNumIterations = 100; - private double _dblBasisIncr = 0.0001; - private double _dblBasisDiffTol = 0.0001; - - private final double calcFXFwd ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.discount.MergedDiscountForwardCurve dcNum, - final org.drip.state.discount.MergedDiscountForwardCurve dcDenom, - final double dblFXSpot, - final double dblBump, - final boolean bBasisOnDenom) - throws java.lang.Exception { - if (bBasisOnDenom) - return _fxfwd.fxForward (valParams, dcNum, (org.drip.state.discount.MergedDiscountForwardCurve) - dcDenom.parallelShiftQuantificationMetric (dblBump), dblFXSpot, false); - - return _fxfwd.fxForward (valParams, (org.drip.state.discount.MergedDiscountForwardCurve) - dcNum.parallelShiftQuantificationMetric (dblBump), dcDenom, dblFXSpot, false); - } - - /** - * Constructor: Construct the basis calibrator from the FXForward parent - * - * @param fxfwd FXForward parent - * - * @throws java.lang.Exception Thrown if parent is invalid - */ - - public FXBasisCalibrator ( - final FXForwardComponent fxfwd) - throws java.lang.Exception - { - if (null == (_fxfwd = fxfwd)) - throw new java.lang.Exception ("FXForwardComponent::FXBasisCalibrator ctr: Invalid Inputs"); - } - - /** - * Calibrate the discount curve basis from FXForward using Newton-Raphson methodology - * - * @param valParams ValuationParams - * @param dcNum Discount Curve for the Numerator - * @param dcDenom Discount Curve for the Denominator - * @param dblFXSpot FXSpot value - * @param dblMarketFXFwdPrice FXForward market value - * @param bBasisOnDenom True - Basis is set on the denominator - * - * @return Calibrated DC basis - * - * @throws java.lang.Exception Thrown if cannot calibrate - */ - - public double calibrateDCBasisFromFwdPriceNR ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.discount.MergedDiscountForwardCurve dcNum, - final org.drip.state.discount.MergedDiscountForwardCurve dcDenom, - final double dblFXSpot, - final double dblMarketFXFwdPrice, - final boolean bBasisOnDenom) - throws java.lang.Exception - { - if (null == valParams || null == dcNum || null == dcDenom || - !org.drip.quant.common.NumberUtil.IsValid (dblMarketFXFwdPrice) || - !org.drip.quant.common.NumberUtil.IsValid (dblFXSpot)) - throw new java.lang.Exception - ("FXForwardComponent::calibrateDCBasisFromFwdPriceNR => bad inputs"); - - double dblFXFwdBase = _fxfwd.fxForward (valParams, dcNum, dcDenom, dblFXSpot, false); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblFXFwdBase)) - throw new java.lang.Exception - ("FXForwardComponent::calibrateDCBasisFromFwdPriceNR => Cannot imply FX Fwd Base!"); - - double dblFXFwdBumped = calcFXFwd (valParams, dcNum, dcDenom, dblFXSpot, _dblBasisIncr, - bBasisOnDenom); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblFXFwdBumped)) - throw new java.lang.Exception - ("FXForwardComponent::calibrateDCBasisFromFwdPriceNR => Cannot imply FX Fwd for " + - _dblBasisIncr + " shift!"); - - double dblDBasisDFXFwd = _dblBasisIncr / (dblFXFwdBumped - dblFXFwdBase); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblDBasisDFXFwd)) - throw new java.lang.Exception - ("FXForwardComponent::calibrateDCBasisFromFwdPriceNR => Cannot calculate Fwd/Basis Slope for 0 basis!"); - - double dblBasisPrev = 0.; - double dblBasis = dblDBasisDFXFwd * (dblMarketFXFwdPrice - dblFXFwdBase); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblBasis)) - throw new java.lang.Exception ("FXForwardComponent::calibrateDCBasisFromFwdPriceNR => Got " + - dblBasis + " for FlatSpread for " + _fxfwd.primaryCode() + " and price " + dblFXFwdBase); - - while (_dblBasisDiffTol < java.lang.Math.abs (dblBasis - dblBasisPrev)) { - if (0 == --_iNumIterations) - throw new java.lang.Exception - ("FXForwardComponent::calibrateDCBasisFromFwdPriceNR => Cannot calib Basis for " + - _fxfwd.primaryCode() + " and price " + dblMarketFXFwdPrice + " within limit!"); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblFXFwdBase = calcFXFwd (valParams, dcNum, - dcDenom, dblFXSpot, dblBasisPrev = dblBasis, bBasisOnDenom))) - throw new java.lang.Exception - ("FXForwardComponent::calibrateDCBasisFromFwdPriceNR => Cannot imply FX Fwd for " + - dblBasis + " shift!"); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblFXFwdBumped = calcFXFwd (valParams, dcNum, - dcDenom, dblFXSpot, dblBasis + _dblBasisIncr, bBasisOnDenom))) - throw new java.lang.Exception - ("FXForwardComponent::calibrateDCBasisFromFwdPriceNR => Cannot imply FX Fwd for " + - (dblBasis + _dblBasisIncr) + " shift!"); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblDBasisDFXFwd = _dblBasisIncr / - (dblFXFwdBumped - dblFXFwdBase))) - throw new java.lang.Exception - ("FXForwardComponent::calibrateDCBasisFromFwdPriceNR => Cannot calculate Fwd/Basis Slope for " - + (dblBasis + _dblBasisIncr) + " basis!"); - - dblBasis = dblBasisPrev + dblDBasisDFXFwd * (dblMarketFXFwdPrice - dblFXFwdBase); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblBasis)) - throw new java.lang.Exception - ("FXForwardComponent::calibrateDCBasisFromFwdPriceNR => Got " + dblBasis + - " for FlatSpread for " + _fxfwd.primaryCode() + " and price " + dblFXFwdBase); - } - - return dblBasis; - } - } - - private java.lang.String _strCode = ""; - private java.lang.String _strName = ""; - private double _dblNotional = java.lang.Double.NaN; - private int _iMaturityDate = java.lang.Integer.MIN_VALUE; - private int _iEffectiveDate = java.lang.Integer.MIN_VALUE; - private org.drip.product.params.CurrencyPair _ccyPair = null; - private org.drip.param.valuation.CashSettleParams _csp = null; - - /** - * Create an FXForwardComponent from the currency pair, the effective and the maturity dates - * - * @param strName Name - * @param ccyPair Currency Pair - * @param iEffectiveDate Effective Date - * @param iMaturityDate Maturity Date - * @param dblNotional Notional - * @param csp Cash Settle Parameters - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public FXForwardComponent ( - final java.lang.String strName, - final org.drip.product.params.CurrencyPair ccyPair, - final int iEffectiveDate, - final int iMaturityDate, - final double dblNotional, - final org.drip.param.valuation.CashSettleParams csp) - throws java.lang.Exception - { - if (null == (_strName = strName) || _strName.isEmpty() || null == (_ccyPair = ccyPair) || - (_iEffectiveDate = iEffectiveDate) >= (_iMaturityDate = iMaturityDate) || - !org.drip.quant.common.NumberUtil.IsValid (_dblNotional = dblNotional)) - throw new java.lang.Exception ("FXForwardComponent ctr: Invalid Inputs"); - - _csp = csp; - } - - /** - * Get the Currency Pair - * - * @return CurrencyPair - */ - - public org.drip.product.params.CurrencyPair currencyPair() - { - return _ccyPair; - } - - /** - * Imply the FX Forward - * - * @param valParams Valuation Parameters - * @param dcNum Discount Curve for the numerator - * @param dcDenom Discount Curve for the denominator - * @param dblFXSpot FXSpot - * @param bFwdAsPIP Calculate FXFwd as a PIP - * - * @return Implied FXForward - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public double fxForward ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.discount.MergedDiscountForwardCurve dcNum, - final org.drip.state.discount.MergedDiscountForwardCurve dcDenom, - final double dblFXSpot, - final boolean bFwdAsPIP) - throws java.lang.Exception - { - if (null == valParams || null == dcNum || null == dcDenom || - !org.drip.quant.common.NumberUtil.IsValid (dblFXSpot)) - throw new java.lang.Exception ("FXForwardComponent::fxForward => Invalid Inputs"); - - int iCashPayDate = valParams.cashPayDate(); - - double dblFXFwd = dblFXSpot * dcDenom.df (_iMaturityDate) * dcNum.df (iCashPayDate) / dcNum.df - (_iMaturityDate) / dcDenom.df (iCashPayDate); - - return bFwdAsPIP ? (dblFXFwd - dblFXSpot) * _ccyPair.pipFactor() : dblFXFwd; - } - - /** - * Calculate the basis to either the numerator or the denominator discount curve - * - * @param valParams ValuationParams - * @param dcNum Discount Curve for the numerator - * @param dcDenom Discount Curve for the denominator - * @param dblFXSpot FXSpot - * @param dblMarketFXFwdPrice FXForward Market Value - * @param bBasisOnDenom Boolean indicating whether the basis is applied on the denominator (true) or - * denominator - * - * @return Basis - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public double discountCurveBasis ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.discount.MergedDiscountForwardCurve dcNum, - final org.drip.state.discount.MergedDiscountForwardCurve dcDenom, - final double dblFXSpot, - final double dblMarketFXFwdPrice, - final boolean bBasisOnDenom) - throws java.lang.Exception - { - return new FXBasisCalibrator (this).calibrateDCBasisFromFwdPriceNR (valParams, dcNum, dcDenom, - dblFXSpot, dblMarketFXFwdPrice, bBasisOnDenom); - } - - @Override public java.lang.String name() - { - return _strName; - } - - @Override public java.lang.String primaryCode() - { - return _strCode; - } - - @Override public void setPrimaryCode ( - final java.lang.String strCode) - { - _strCode = strCode; - } - - @Override public org.drip.analytics.date.JulianDate effectiveDate() - { - try { - return new org.drip.analytics.date.JulianDate (_iEffectiveDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.analytics.date.JulianDate maturityDate() - { - try { - return new org.drip.analytics.date.JulianDate (_iMaturityDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.analytics.date.JulianDate firstCouponDate() - { - return maturityDate(); - } - - @Override public int freq() - { - return 1; - } - - @Override public java.util.List couponPeriods() - { - return null; - } - - @Override public org.drip.analytics.output.CompositePeriodCouponMetrics couponMetrics ( - final int iAccrualEndDate, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - return null; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap couponCurrency() - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapCouponCurrency = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapCouponCurrency.put (_strName, _ccyPair.denomCcy()); - - return mapCouponCurrency; - } - - @Override public java.lang.String payCurrency() - { - return _ccyPair.denomCcy(); - } - - @Override public java.lang.String principalCurrency() - { - return _ccyPair.denomCcy(); - } - - @Override public org.drip.state.identifier.CreditLabel creditLabel() - { - return null; - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - forwardLabel() - { - return null; - } - - @Override public org.drip.state.identifier.FundingLabel fundingLabel() - { - return org.drip.state.identifier.FundingLabel.Standard (payCurrency()); - } - - @Override public org.drip.state.identifier.GovvieLabel govvieLabel() - { - return org.drip.state.identifier.GovvieLabel.Standard (payCurrency()); - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap - fxLabel() - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapFXLabel = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapFXLabel.put ("DERIVED", org.drip.state.identifier.FXLabel.Standard (_ccyPair)); - - return mapFXLabel; - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - volatilityLabel() - { - return null; - } - - @Override public double initialNotional() - throws java.lang.Exception - { - return _dblNotional; - } - - @Override public double notional ( - final int iDate) - throws java.lang.Exception - { - return _dblNotional; - } - - @Override public double notional ( - final int iDate1, - final int iDate2) - throws java.lang.Exception - { - return _dblNotional; - } - - @Override public org.drip.param.valuation.CashSettleParams cashSettleParams() - { - return _csp; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap value ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == valParams || valParams.valueDate() > _iMaturityDate || null == csqs) return null; - - org.drip.state.identifier.FXLabel fxLabel = org.drip.state.identifier.FXLabel.Standard (_ccyPair); - - org.drip.state.fx.FXCurve fxCurve = csqs.fxState (fxLabel); - - if (null == fxCurve) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapRes = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - double dblFXSpot = java.lang.Double.NaN; - double dblFXForward = java.lang.Double.NaN; - - try { - dblFXSpot = fxCurve.fx (_iEffectiveDate); - - dblFXForward = fxCurve.fx (_iMaturityDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - double dblPIP = (dblFXForward - dblFXSpot) * _ccyPair.pipFactor(); - - mapRes.put ("FXForward", dblFXForward); - - mapRes.put ("FXForwardOutright", dblFXForward); - - mapRes.put ("FXForwardPIP", dblPIP); - - mapRes.put ("FXSpot", dblFXSpot); - - mapRes.put ("Outright", dblFXForward); - - mapRes.put ("PIP", dblPIP); - - mapRes.put ("PV", dblFXForward); - - org.drip.state.discount.MergedDiscountForwardCurve dcNum = csqs.fundingState - (org.drip.state.identifier.FundingLabel.Standard (_ccyPair.numCcy())); - - org.drip.state.discount.MergedDiscountForwardCurve dcDenom = csqs.fundingState - (org.drip.state.identifier.FundingLabel.Standard (_ccyPair.denomCcy())); - - if (null != dcNum && null != dcDenom) { - try { - double dblFXForwardOutright = fxForward (valParams, dcNum, dcDenom, dblFXSpot, false); - - double dblFXForwardPIP = fxForward (valParams, dcNum, dcDenom, dblFXSpot, true); - - mapRes.put ("DiscountCurveFXForward", dblFXForwardOutright); - - mapRes.put ("DiscountCurveFXForwardOutright", dblFXForwardOutright); - - mapRes.put ("DiscountCurveFXForwardPIP", dblFXForwardPIP); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - } - - return mapRes; - } - - @Override public java.util.Set measureNames() - { - java.util.Set setstrMeasures = new java.util.TreeSet(); - - setstrMeasures.add ("DiscountCurveFXForward"); - - setstrMeasures.add ("DiscountCurveFXForwardOutright"); - - setstrMeasures.add ("DiscountCurveFXForwardPIP"); - - setstrMeasures.add ("FXForward"); - - setstrMeasures.add ("FXForwardOutright"); - - setstrMeasures.add ("FXForwardPIP"); - - setstrMeasures.add ("FXSpot"); - - setstrMeasures.add ("Outright"); - - setstrMeasures.add ("PIP"); - - setstrMeasures.add ("PV"); - - return setstrMeasures; - } - - @Override public double pv ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - throws java.lang.Exception - { - org.drip.state.fx.FXCurve fxCurve = csqs.fxState (org.drip.state.identifier.FXLabel.Standard - (_ccyPair)); - - if (null == fxCurve) throw new java.lang.Exception ("FXForwardComponent::pv => Invalid Inputs"); - - return fxCurve.fx (_iMaturityDate); - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap calibMeasures ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - return null; - } - - @Override public org.drip.product.calib.ProductQuoteSet calibQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - { - try { - return new org.drip.product.calib.FXForwardQuoteSet (aLSS); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint forwardPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fundingPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fundingForwardPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fxPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - if (null == valParams || null == pqs || !(pqs instanceof org.drip.product.calib.FXForwardQuoteSet)) - return null; - - int iMaturityDate = maturityDate().julian(); - - if (valParams.valueDate() > iMaturityDate) return null; - - double dblOutright = java.lang.Double.NaN; - org.drip.product.calib.FXForwardQuoteSet fxqs = (org.drip.product.calib.FXForwardQuoteSet) pqs; - - if (!fxqs.containsOutright()) return null; - - try { - dblOutright = fxqs.outright(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.state.estimator.PredictorResponseWeightConstraint prwc = new - org.drip.state.estimator.PredictorResponseWeightConstraint(); - - if (!prwc.addPredictorResponseWeight (iMaturityDate, 1.)) return null; - - if (!prwc.addDResponseWeightDManifestMeasure ("Outright", iMaturityDate, 1.)) return null; - - if (!prwc.updateValue (dblOutright)) return null; - - if (!prwc.updateDValueDManifestMeasure ("Outright", 1.)) return null; - - return prwc; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint govviePRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint volatilityPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDDirtyPVDManifestMeasure ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - { - return null; - } - - @Override public org.drip.quant.calculus.WengertJacobian manifestMeasureDFMicroJack ( - final java.lang.String strManifestMeasure, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - { - return null; - } -} diff --git a/org/drip/product/fx/ForeignCollateralizedDomesticForward.java b/org/drip/product/fx/ForeignCollateralizedDomesticForward.java deleted file mode 100644 index 4826cb9..0000000 --- a/org/drip/product/fx/ForeignCollateralizedDomesticForward.java +++ /dev/null @@ -1,217 +0,0 @@ - -package org.drip.product.fx; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ForeignCollateralizedDomesticForward contains the Foreign Currency Collateralized Domestic Payout FX - * forward product contract details. - * - * @author Lakshmi Krishnamurthy - */ - -public class ForeignCollateralizedDomesticForward { - private java.lang.String _strCode = ""; - private org.drip.product.params.CurrencyPair _cp = null; - private int _iMaturityDate = java.lang.Integer.MIN_VALUE; - private double _dblForexForwardStrike = java.lang.Double.NaN; - - /** - * Create an ForeignCollateralizedDomesticForward from the currency pair, the strike, and the maturity - * dates - * - * @param cp Currency Pair - * @param dblForexForwardStrike Forex Forward Strike - * @param dtMaturity Maturity Date - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public ForeignCollateralizedDomesticForward ( - final org.drip.product.params.CurrencyPair cp, - final double dblForexForwardStrike, - final org.drip.analytics.date.JulianDate dtMaturity) - throws java.lang.Exception - { - if (null == (_cp = cp) || !org.drip.quant.common.NumberUtil.IsValid (_dblForexForwardStrike = - dblForexForwardStrike) || null == dtMaturity) - throw new java.lang.Exception ("ForeignCollateralizedDomesticForward ctr: Invalid Inputs"); - - _iMaturityDate = dtMaturity.julian(); - } - - public java.lang.String getPrimaryCode() - { - return _strCode; - } - - public void setPrimaryCode ( - final java.lang.String strCode) - { - _strCode = strCode; - } - - public java.lang.String[] getSecondaryCode() - { - java.lang.String strPrimaryCode = getPrimaryCode(); - - int iNumTokens = 0; - java.lang.String astrCodeTokens[] = new java.lang.String[2]; - - java.util.StringTokenizer stCodeTokens = new java.util.StringTokenizer (strPrimaryCode, "."); - - while (stCodeTokens.hasMoreTokens()) - astrCodeTokens[iNumTokens++] = stCodeTokens.nextToken(); - - System.out.println (astrCodeTokens[0]); - - return new java.lang.String[] {astrCodeTokens[0]}; - } - - public org.drip.analytics.date.JulianDate getMaturityDate() - { - try { - return new org.drip.analytics.date.JulianDate (_iMaturityDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - public org.drip.product.params.CurrencyPair getCcyPair() - { - return _cp; - } - - public org.drip.analytics.support.CaseInsensitiveTreeMap value ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - { - if (null == valParams || null == csqs) return null; - - long lStart = System.nanoTime(); - - int iValueDate = valParams.valueDate(); - - if (iValueDate > _iMaturityDate) return null; - - org.drip.state.fx.FXCurve fxfc = csqs.fxState (org.drip.state.identifier.FXLabel.Standard (_cp)); - - if (null == fxfc) return null; - - java.lang.String strForeignCurrency = _cp.numCcy(); - - org.drip.state.discount.MergedDiscountForwardCurve dcForeignCollateral = - csqs.payCurrencyCollateralCurrencyCurve (strForeignCurrency, strForeignCurrency); - - if (null == dcForeignCollateral) return null; - - org.drip.state.discount.MergedDiscountForwardCurve dcDomesticCurrencyForeignCollateral = - csqs.payCurrencyCollateralCurrencyCurve (_cp.denomCcy(), strForeignCurrency); - - if (null == dcDomesticCurrencyForeignCollateral) return null; - - double dblPrice = java.lang.Double.NaN; - double dblSpotFX = java.lang.Double.NaN; - double dblParForward = java.lang.Double.NaN; - double dblForeignCollateralDF = java.lang.Double.NaN; - double dblDomesticCurrencyForeignCollateralDF = java.lang.Double.NaN; - - try { - dblPrice = (dblSpotFX = fxfc.fx (iValueDate)) * (dblForeignCollateralDF = - dcForeignCollateral.df (_iMaturityDate)) - ((dblDomesticCurrencyForeignCollateralDF = - dcDomesticCurrencyForeignCollateral.df (_iMaturityDate)) * _dblForexForwardStrike); - - dblParForward = dblSpotFX * dblForeignCollateralDF / dblDomesticCurrencyForeignCollateralDF; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.analytics.support.CaseInsensitiveTreeMap mapResult = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapResult.put ("CalcTime", (System.nanoTime() - lStart) * 1.e-09); - - mapResult.put ("DomesticCurrencyForeignCollateralDF", dblDomesticCurrencyForeignCollateralDF); - - mapResult.put ("ForeignCollateralDF", dblForeignCollateralDF); - - mapResult.put ("ParForward", dblParForward); - - mapResult.put ("Price", dblPrice); - - mapResult.put ("SpotFX", dblSpotFX); - - return mapResult; - } - - public java.util.Set getMeasureNames() - { - java.util.Set setstrMeasureNames = new java.util.TreeSet(); - - setstrMeasureNames.add ("CalcTime"); - - setstrMeasureNames.add ("DomesticCurrencyForeignCollateralDF"); - - setstrMeasureNames.add ("ForeignCollateralDF"); - - setstrMeasureNames.add ("ParForward"); - - setstrMeasureNames.add ("Price"); - - setstrMeasureNames.add ("SpotFX"); - - return setstrMeasureNames; - } -} diff --git a/org/drip/product/govvie/TreasuryComponent.java b/org/drip/product/govvie/TreasuryComponent.java deleted file mode 100644 index 3ccacc8..0000000 --- a/org/drip/product/govvie/TreasuryComponent.java +++ /dev/null @@ -1,141 +0,0 @@ - -package org.drip.product.govvie; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TreasuryComponent implements the Functionality behind a Sovereign/Treasury Bond/Bill/Note. - * - * @author Lakshmi Krishnamurthy - */ - -public class TreasuryComponent extends org.drip.product.credit.BondComponent { - private java.lang.String _strTreasuryCode = ""; - - /** - * TreasuryComponent Constructor - * - * @param strTreasuryCode Treasury Code - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public TreasuryComponent ( - final java.lang.String strTreasuryCode) - throws java.lang.Exception - { - super(); - - if (null == (_strTreasuryCode = strTreasuryCode) || _strTreasuryCode.isEmpty()) - throw new java.lang.Exception ("TreasuryComponent ctr => Invalid Inputs"); - } - - /** - * Retrieve the Treasury Code - * - * @return The Treasury Code - */ - - public java.lang.String code() - { - return _strTreasuryCode; - } - - @Override public org.drip.product.calib.ProductQuoteSet calibQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - { - try { - return new org.drip.product.calib.TreasuryBondQuoteSet (aLSS); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint govviePRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - if (null == valParams || null == pqs || !(pqs instanceof - org.drip.product.calib.TreasuryBondQuoteSet)) - return null; - - int iMaturityDate = maturityDate().julian(); - - if (valParams.valueDate() > iMaturityDate) return null; - - double dblYield = java.lang.Double.NaN; - org.drip.product.calib.TreasuryBondQuoteSet tbqs = (org.drip.product.calib.TreasuryBondQuoteSet) pqs; - - if (!tbqs.containsYield()) return null; - - try { - dblYield = tbqs.yield(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.state.estimator.PredictorResponseWeightConstraint prwc = new - org.drip.state.estimator.PredictorResponseWeightConstraint(); - - if (!prwc.addPredictorResponseWeight (iMaturityDate, 1.)) return null; - - if (!prwc.addDResponseWeightDManifestMeasure ("Yield", iMaturityDate, 1.)) return null; - - if (!prwc.updateValue (dblYield)) return null; - - if (!prwc.updateDValueDManifestMeasure ("Yield", 1.)) return null; - - return prwc; - } -} diff --git a/org/drip/product/govvie/TreasuryFutures.java b/org/drip/product/govvie/TreasuryFutures.java deleted file mode 100644 index a083a3f..0000000 --- a/org/drip/product/govvie/TreasuryFutures.java +++ /dev/null @@ -1,879 +0,0 @@ - -package org.drip.product.govvie; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BondFutures implements the Bond Futures Product Contract Details. - * - * @author Lakshmi Krishnamurthy - */ - -public class TreasuryFutures extends org.drip.product.definition.Component { - - /* - * Bond Futures Valuation Settings - */ - - public static final int FORWARD_PRICE_OAS = 0; - public static final int FORWARD_PRICE_YIELD = 1; - public static final int FORWARD_PRICE_ZSPREAD = 2; - public static final int FORWARD_PRICE_CREDIT_BASIS = 3; - - private double[] _adblConversionFactor = null; - private org.drip.product.definition.Bond[] _aBond = null; - private org.drip.analytics.date.JulianDate _dtExpiry = null; - private org.drip.param.valuation.CashSettleParams _csp = null; - - /* - * Bond Futures Contract Details - */ - - private int[] _aiDeliveryMonth = null; - private java.lang.String _strType = ""; - private double _dblTickValue = java.lang.Double.NaN; - private double _dblNotionalValue = java.lang.Double.NaN; - private double _dblReferenceCoupon = java.lang.Double.NaN; - private int _iLastTradingDayLag = java.lang.Integer.MIN_VALUE; - private double _dblMinimumPriceMovement = java.lang.Double.NaN; - private java.lang.String _strDeliverableGradeMaximumMaturity = ""; - private java.lang.String _strDeliverableGradeMinimumMaturity = ""; - - /** - * BondFutures Constructor - * - * @param aBond Array of the Bonds on the Basket - * @param adblConversionFactor The Bond Conversion Factor - * @param csp Cash Settlement Parameters - * - * @throws java.lang.Exception thrown if the Inputs are Invalid - */ - - public TreasuryFutures ( - final org.drip.product.definition.Bond[] aBond, - final double[] adblConversionFactor, - final org.drip.param.valuation.CashSettleParams csp) - throws java.lang.Exception - { - if (null == (_aBond = aBond) || null == (_adblConversionFactor = adblConversionFactor)) - throw new java.lang.Exception ("BondFutures ctr: Invalid Inputs"); - - _csp = csp; - int iNumBond = _aBond.length; - - if (0 == iNumBond || iNumBond != _adblConversionFactor.length) - throw new java.lang.Exception ("BondFutures ctr: Invalid Inputs"); - - for (int i = 0; i < iNumBond; ++i) { - if (null == _aBond[i] || !org.drip.quant.common.NumberUtil.IsValid (_adblConversionFactor[i])) - throw new java.lang.Exception ("BondFutures ctr: Invalid Inputs"); - } - } - - /** - * Set the Futures Type - * - * @param strType The Futures Type - * - * @return TRUE - Futures Type Successfully Set - */ - - public boolean setType ( - final java.lang.String strType) - { - return null == (_strType = strType) || _strType.isEmpty() ? false : true; - } - - /** - * Retrieve the Futures Type - * - * @return The Futures Type - */ - - public java.lang.String type() - { - return _strType; - } - - /** - * Retrieve the Notional Value - * - * @param dblNotionalValue The Notional Value - * - * @return TRUE - The Notional Value successfully retrieved - */ - - public boolean setNotionalValue ( - final double dblNotionalValue) - { - return org.drip.quant.common.NumberUtil.IsValid (_dblNotionalValue = dblNotionalValue); - } - - /** - * Retrieve the Notional Value - * - * @return The Notional Value - */ - - public double notionalValue() - { - return _dblNotionalValue; - } - - /** - * Set the Reference Coupon Rate - * - * @param dblReferenceCoupon The Reference Coupon Rate - * - * @return TRUE - The Reference Coupon Rate successfully set - */ - - public boolean setReferenceCoupon ( - final double dblReferenceCoupon) - { - return org.drip.quant.common.NumberUtil.IsValid (_dblReferenceCoupon = dblReferenceCoupon); - } - - /** - * Retrieve the Reference Coupon Rate - * - * @return The Reference Coupon Rate - */ - - public double referenceCoupon() - { - return _dblReferenceCoupon; - } - - /** - * Retrieve the Deliverable Grade Minimum Maturity - * - * @param strDeliverableGradeMinimumMaturity Minimum Maturity of the Deliverable Grade - * - * @return TRUE - Minimum Maturity Successfully set - */ - - public boolean setMinimumMaturity ( - final java.lang.String strDeliverableGradeMinimumMaturity) - { - return null == (_strDeliverableGradeMinimumMaturity = strDeliverableGradeMinimumMaturity) || - _strDeliverableGradeMinimumMaturity.isEmpty() ? false : true; - } - - /** - * Retrieve the Minimum Maturity of the Contract - * - * @return The Minimum Maturity of the Contract - */ - - public java.lang.String minimumMaturity() - { - return _strDeliverableGradeMinimumMaturity; - } - - /** - * Retrieve the Deliverable Grade Maximum Maturity - * - * @param strDeliverableGradeMaximumMaturity Maximum Maturity of the Deliverable Grade - * - * @return TRUE - Maximum Maturity Successfully set - */ - - public boolean setMaximumMaturity ( - final java.lang.String strDeliverableGradeMaximumMaturity) - { - return null == (_strDeliverableGradeMaximumMaturity = strDeliverableGradeMaximumMaturity) || - _strDeliverableGradeMaximumMaturity.isEmpty() ? false : true; - } - - /** - * Retrieve the Maximum Maturity of the Contract - * - * @return The Maximum Maturity of the Contract - */ - - public java.lang.String maximumMaturity() - { - return _strDeliverableGradeMaximumMaturity; - } - - /** - * Set the Delivery Months - * - * @param aiDeliveryMonth Array of Delivery Months - * - * @return TRUE - Delivery Months successfully set - */ - - public boolean setDeliveryMonths ( - final int[] aiDeliveryMonth) - { - return null == (_aiDeliveryMonth = aiDeliveryMonth) || 0 == _aiDeliveryMonth.length ? false : true; - } - - /** - * Retrieve the Array of Delivery Months - * - * @return Array of Delivery Months - */ - - public int[] deliveryMonths() - { - return _aiDeliveryMonth; - } - - /** - * Set the Last Trading Day Lag - * - * @param iLastTradingDayLag The Last Trading Day Lag - * - * @return TRUE - Last Trading Day Lag Successfully Set - */ - - public boolean setLastTradingDayLag ( - final int iLastTradingDayLag) - { - return 0 > (_iLastTradingDayLag = iLastTradingDayLag) ? false : true; - } - - /** - * Retrieve the Last Trading Day Lag - * - * @return Last Trading Day Lag - */ - - public int lastTradingDayLag() - { - return _iLastTradingDayLag; - } - - /** - * Retrieve the Minimum Price Movement - * - * @param dblMinimumPriceMovement The Minimum Price Movement - * - * @return TRUE - The Minimum Price Movement Successfully Set - */ - - public boolean setMinimumPriceMovement ( - final double dblMinimumPriceMovement) - { - return org.drip.quant.common.NumberUtil.IsValid (_dblMinimumPriceMovement = dblMinimumPriceMovement); - } - - /** - * Retrieve the Minimum Price Movement - * - * @return The Minimum Price Movement - */ - - public double minimumPriceMovement() - { - return _dblMinimumPriceMovement; - } - - /** - * Retrieve the Tick Value - * - * @param dblTickValue The Tick Value - * - * @return TRUE - The Tick Value Successfully Set - */ - - public boolean setTickValue ( - final double dblTickValue) - { - return org.drip.quant.common.NumberUtil.IsValid (_dblTickValue = dblTickValue); - } - - /** - * Retrieve the Tick Value - * - * @return The Tick Value - */ - - public double tickValue() - { - return _dblTickValue; - } - - /** - * Retrieve the Bond Basket Array - * - * @return The Bond Basket Array - */ - - public org.drip.product.definition.Bond[] basket() - { - return _aBond; - } - - /** - * Retrieve the Conversion Factor Array - * - * @return The Conversion Factor Array - */ - - public double[] conversionFactor() - { - return _adblConversionFactor; - } - - /** - * Set the Futures Expiration Date - * - * @param dtExpiry The Futures Expiration Date - * - * @return TRUE - The Futures Expiration Date Successfully Set - */ - - public boolean setExpiry ( - final org.drip.analytics.date.JulianDate dtExpiry) - { - if (null == dtExpiry) return false; - - _dtExpiry = dtExpiry; - return true; - } - - /** - * Retrieve the Futures Expiration Date - * - * @return The Futures Expiration Date - */ - - public org.drip.analytics.date.JulianDate expiry() - { - return _dtExpiry; - } - - /** - * Extract the Cheapest-to-deliver Entry in the Basket Using the Current Market Parameters - * - * @param iValueDate The Valuation Date - * @param csqc The Market Parameters - * @param vcp Valuation Customization Parameters - * @param adblCleanPrice Array of the Bond Clean Prices - * @param iForwardPriceMethod Forward Price Calculation Method - * - * @return The Cheapest-to-deliver Entry in the Basket Using the Current Market Parameters - */ - - public org.drip.product.params.CTDEntry cheapestToDeliver ( - final int iValueDate, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double[] adblCleanPrice, - final int iForwardPriceMethod) - { - if (null == adblCleanPrice) return null; - - int iStartIndex = 0; - int iBasketSize = adblCleanPrice.length; - - if (iBasketSize != _aBond.length) return null; - - for (int i = 0; i < iBasketSize; ++i) { - if (org.drip.quant.common.NumberUtil.IsValid (adblCleanPrice[i])) { - iStartIndex = i; - break; - } - } - - if (iBasketSize <= iStartIndex) return null; - - int iCTDIndex = iStartIndex; - double dblMinimumScaledPrice = adblCleanPrice[iStartIndex] / _adblConversionFactor[iStartIndex]; - - int iExpiryDate = _dtExpiry.julian(); - - if (iExpiryDate <= iValueDate) return null; - - org.drip.param.valuation.ValuationParams valParamsSpot = - org.drip.param.valuation.ValuationParams.Spot (iValueDate); - - org.drip.param.valuation.ValuationParams valParamsExpiry = - org.drip.param.valuation.ValuationParams.Spot (iExpiryDate); - - for (int i = iStartIndex; i < iBasketSize; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (adblCleanPrice[i])) continue; - - double dblForwardPrice = java.lang.Double.NaN; - - try { - if (FORWARD_PRICE_YIELD == iForwardPriceMethod) - dblForwardPrice = org.drip.analytics.support.FuturesHelper.ForwardBondYieldPrice - (_aBond[i], valParamsSpot, valParamsExpiry, csqc, vcp, adblCleanPrice[i]); - else if (FORWARD_PRICE_OAS == iForwardPriceMethod) - dblForwardPrice = org.drip.analytics.support.FuturesHelper.ForwardBondOASPrice - (_aBond[i], valParamsSpot, valParamsExpiry, csqc, vcp, adblCleanPrice[i]); - else if (FORWARD_PRICE_ZSPREAD == iForwardPriceMethod) - dblForwardPrice = org.drip.analytics.support.FuturesHelper.ForwardBondZSpreadPrice - (_aBond[i], valParamsSpot, valParamsExpiry, csqc, vcp, adblCleanPrice[i]); - else if (FORWARD_PRICE_CREDIT_BASIS == iForwardPriceMethod) - dblForwardPrice = org.drip.analytics.support.FuturesHelper.ForwardBondCreditPrice - (_aBond[i], valParamsSpot, valParamsExpiry, csqc, vcp, adblCleanPrice[i]); - else - return null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - double dblScaledPrice = dblForwardPrice / _adblConversionFactor[i]; - - if (dblScaledPrice < dblMinimumScaledPrice) { - iCTDIndex = i; - dblMinimumScaledPrice = dblScaledPrice; - } - } - - try { - return new org.drip.product.params.CTDEntry (_aBond[iCTDIndex], _adblConversionFactor[iCTDIndex], - dblMinimumScaledPrice * _adblConversionFactor[iCTDIndex]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Extract the Cheapest-to-deliver Entry in the Basket Using the Current Market Prices Alone - * - * @param iValueDate The Valuation Date - * @param adblCleanPrice Array of the Bond Clean Prices - * - * @return The Cheapest-to-deliver Entry in the Basket Using the Current Market Prices Alone - */ - - public org.drip.product.params.CTDEntry cheapestToDeliverYield ( - final int iValueDate, - final double[] adblCleanPrice) - { - return cheapestToDeliver (iValueDate, null, null, adblCleanPrice, FORWARD_PRICE_YIELD); - } - - /** - * Extract the Cheapest-to-deliver Entry in the Basket Using Bond OAS Metric - * - * @param iValueDate The Valuation Date - * @param csqc The Market Parameters - * @param adblCleanPrice Array of the Bond Clean Prices - * - * @return The Cheapest-to-deliver Entry in the Basket Using Bond OAS Metric - */ - - public org.drip.product.params.CTDEntry cheapestToDeliverOAS ( - final int iValueDate, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final double[] adblCleanPrice) - { - return cheapestToDeliver (iValueDate, csqc, null, adblCleanPrice, FORWARD_PRICE_OAS); - } - - /** - * Extract the Cheapest-to-deliver Entry in the Basket Using Bond Z Spread Metric - * - * @param iValueDate The Valuation Date - * @param csqc The Market Parameters - * @param adblCleanPrice Array of the Bond Clean Prices - * - * @return The Cheapest-to-deliver Entry in the Basket Using Bond Z Spread Metric - */ - - public org.drip.product.params.CTDEntry cheapestToDeliverZSpread ( - final int iValueDate, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final double[] adblCleanPrice) - { - return cheapestToDeliver (iValueDate, csqc, null, adblCleanPrice, FORWARD_PRICE_ZSPREAD); - } - - /** - * Extract the Cheapest-to-deliver Entry in the Basket Using Bond Credit Basis Metric - * - * @param iValueDate The Valuation Date - * @param csqc The Market Parameters - * @param adblCleanPrice Array of the Bond Clean Prices - * - * @return The Cheapest-to-deliver Entry in the Basket Using Bond Credit Basis Metric - */ - - public org.drip.product.params.CTDEntry cheapestToDeliverCreditBasis ( - final int iValueDate, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final double[] adblCleanPrice) - { - return cheapestToDeliver (iValueDate, csqc, null, adblCleanPrice, FORWARD_PRICE_CREDIT_BASIS); - } - - @Override public java.lang.String name() - { - return (null == _strType || _strType.isEmpty() ? _aBond[0].currency() : _strType) + - (null == _strDeliverableGradeMaximumMaturity || _strDeliverableGradeMaximumMaturity.isEmpty() ? - _aBond[0].tenor() : _strDeliverableGradeMaximumMaturity); - } - - @Override public org.drip.param.valuation.CashSettleParams cashSettleParams() - { - return _csp; - } - - @Override public org.drip.analytics.output.CompositePeriodCouponMetrics couponMetrics ( - final int iAccrualEndDate, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - return null; - } - - @Override public java.util.List couponPeriods() - { - return null; - } - - @Override public org.drip.analytics.date.JulianDate effectiveDate() - { - return _dtExpiry.subtractTenor ("3M"); - } - - @Override public org.drip.analytics.date.JulianDate firstCouponDate() - { - return null; - } - - @Override public int freq() - { - return _aBond[0].freq(); - } - - @Override public double initialNotional() - { - return _dblNotionalValue; - } - - @Override public double notional ( - final int iDate) - throws java.lang.Exception - { - return _dblNotionalValue; - } - - @Override public double notional ( - final int iDate1, - final int iDate2) - throws java.lang.Exception - { - return _dblNotionalValue; - } - - @Override public org.drip.analytics.date.JulianDate maturityDate() - { - return _dtExpiry; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap couponCurrency() - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapCouponCurrency = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (org.drip.product.definition.Bond bond : _aBond) - mapCouponCurrency.putAll (bond.couponCurrency()); - - return 0 == mapCouponCurrency.size() ? null : mapCouponCurrency; - } - - @Override public java.lang.String principalCurrency() - { - return _aBond[0].principalCurrency(); - } - - @Override public java.lang.String payCurrency() - { - return _aBond[0].payCurrency(); - } - - @Override public org.drip.state.identifier.CreditLabel creditLabel() - { - return _aBond[0].creditLabel(); - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - forwardLabel() - { - org.drip.analytics.support.CaseInsensitiveTreeMap - mapForwardLabel = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (org.drip.product.definition.Bond bond : _aBond) - mapForwardLabel.putAll (bond.forwardLabel()); - - return 0 == mapForwardLabel.size() ? null : mapForwardLabel; - } - - @Override public org.drip.state.identifier.FundingLabel fundingLabel() - { - return _aBond[0].fundingLabel(); - } - - @Override public org.drip.state.identifier.GovvieLabel govvieLabel() - { - return _aBond[0].govvieLabel(); - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap - fxLabel() - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapFXLabel = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (org.drip.product.definition.Bond bond : _aBond) - mapFXLabel.putAll (bond.fxLabel()); - - return 0 == mapFXLabel.size() ? null : mapFXLabel; - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - volatilityLabel() - { - return null; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap value ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - int iNumBond = _aBond.length; - double dblCTDRepoRate = java.lang.Double.NaN; - double[] adblCleanPrice = new double[iNumBond]; - double dblCTDTreasuryYield = java.lang.Double.NaN; - - int iValueDate = valParams.valueDate(); - - for (int i = 0; i < iNumBond; ++i) { - org.drip.param.definition.ProductQuote pqBond = csqc.productQuote (_aBond[i].name()); - - if (null == pqBond || !pqBond.containsQuote ("Price") || - !org.drip.quant.common.NumberUtil.IsValid (adblCleanPrice[i] = pqBond.quote ("Price").value - ("mid"))) - return null; - } - - org.drip.product.params.CTDEntry ctdEntry = cheapestToDeliverYield (iValueDate, adblCleanPrice); - - if (null == ctdEntry || null == csqc) return null; - - org.drip.product.definition.Bond bondCTD = ctdEntry.bond(); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapBondFuturesMeasure = - bondCTD.value (valParams, pricerParams, csqc, vcp); - - if (null == mapBondFuturesMeasure || null == (mapBondFuturesMeasure = - org.drip.quant.common.CollectionUtil.PrefixKeys (bondCTD.value (valParams, pricerParams, csqc, - vcp), "CTD::"))) - return null; - - double dblCTDForwardPrice = ctdEntry.forwardPrice(); - - double dblCTDConversionFactor = ctdEntry.conversionFactor(); - - mapBondFuturesMeasure.put ("CTDConversionFactor", dblCTDConversionFactor); - - mapBondFuturesMeasure.put ("CTDForwardPrice", dblCTDForwardPrice); - - org.drip.state.repo.RepoCurve repoState = csqc.repoState - (org.drip.state.identifier.RepoLabel.Standard (bondCTD.name())); - - org.drip.state.govvie.GovvieCurve gc = csqc.govvieState (govvieLabel()); - - int iExpiryDate = _dtExpiry.julian(); - - try { - if (null != repoState) - mapBondFuturesMeasure.put ("CTDRepoRate", dblCTDRepoRate = repoState.repo (iExpiryDate)); - - if (null != gc) - mapBondFuturesMeasure.put ("CTDTreasuryYield", dblCTDTreasuryYield = gc.yield (iExpiryDate)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - double dblCTDSpotPrice = csqc.productQuote (bondCTD.name()).quote ("Price").value ("mid"); - - mapBondFuturesMeasure.put ("CTDSpotPrice", dblCTDSpotPrice); - - if (org.drip.quant.common.NumberUtil.IsValid (dblCTDRepoRate) && - org.drip.quant.common.NumberUtil.IsValid (dblCTDTreasuryYield)) - mapBondFuturesMeasure.put ("CostOfCarry", dblCTDRepoRate - dblCTDTreasuryYield); - - org.drip.param.definition.ProductQuote pqFutures = csqc.productQuote (name()); - - if (null != pqFutures && pqFutures.containsQuote ("Price")) { - double dblFuturesQuote = pqFutures.quote ("Price").value ("mid"); - - if (org.drip.quant.common.NumberUtil.IsValid (dblFuturesQuote)) { - if (iExpiryDate > iValueDate) { - double dblImpliedRepoRate = 365.25 * (((dblFuturesQuote - dblCTDSpotPrice) / - dblCTDSpotPrice) - 1.) / (iExpiryDate - iValueDate); - - mapBondFuturesMeasure.put ("ImpliedRepo", dblImpliedRepoRate); - - mapBondFuturesMeasure.put ("ImpliedRepoRate", dblImpliedRepoRate); - - if (org.drip.quant.common.NumberUtil.IsValid (dblCTDRepoRate)) - mapBondFuturesMeasure.put ("NetBasis", dblImpliedRepoRate - dblCTDRepoRate); - } - - double dblSettlementAmount = dblFuturesQuote * dblCTDConversionFactor - dblCTDForwardPrice; - - mapBondFuturesMeasure.put ("PV", dblSettlementAmount); - - mapBondFuturesMeasure.put ("SettlementAmount", dblSettlementAmount); - - mapBondFuturesMeasure.put ("SettlePV", dblSettlementAmount); - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqc.fundingState (fundingLabel()); - - if (null != dcFunding) { - try { - mapBondFuturesMeasure.put ("SpotPV", dblSettlementAmount * dcFunding.df - (iExpiryDate)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - } - } - } - - return mapBondFuturesMeasure; - } - - @Override public java.util.Set measureNames() - { - java.util.Set setMeasure = _aBond[0].measureNames(); - - setMeasure.add ("CostOfCarry"); - - setMeasure.add ("CTDConversionFactor"); - - setMeasure.add ("CTDForwardPrice"); - - setMeasure.add ("CTDRepoRate"); - - setMeasure.add ("CTDSpotPrice"); - - setMeasure.add ("CTDTreasuryYield"); - - setMeasure.add ("ImpliedRepo"); - - setMeasure.add ("ImpliedRepoRate"); - - setMeasure.add ("NetBasis"); - - setMeasure.add ("PV"); - - setMeasure.add ("SettlementAmount"); - - setMeasure.add ("SettlePV"); - - setMeasure.add ("SpotPV"); - - return setMeasure; - } - - @Override public double pv ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - throws java.lang.Exception - { - int iNumBond = _aBond.length; - double[] adblCleanPrice = new double[iNumBond]; - - int iValueDate = valParams.valueDate(); - - for (int i = 0; i < iNumBond; ++i) { - org.drip.param.definition.ProductQuote pqBond = csqc.productQuote (_aBond[i].name()); - - if (null == pqBond || !pqBond.containsQuote ("Price") || - !org.drip.quant.common.NumberUtil.IsValid (adblCleanPrice[i] = pqBond.quote ("Price").value - ("mid"))) - throw new java.lang.Exception ("BondFutures::pv - Invalid Inputs"); - } - - org.drip.product.params.CTDEntry ctdEntry = cheapestToDeliverYield (iValueDate, adblCleanPrice); - - if (null == ctdEntry || null == csqc) - throw new java.lang.Exception ("BondFutures::pv - Invalid Inputs"); - - double dblFuturesQuote = java.lang.Double.NaN; - - double dblCTDForwardPrice = ctdEntry.forwardPrice(); - - double dblCTDConversionFactor = ctdEntry.conversionFactor(); - - org.drip.param.definition.ProductQuote pqFutures = csqc.productQuote (name()); - - if (null != pqFutures && pqFutures.containsQuote ("Price")) - dblFuturesQuote = pqFutures.quote ("Price").value ("mid"); - - double dblAccrued = ctdEntry.bond().accrued (iValueDate, csqc); - - return org.drip.quant.common.NumberUtil.IsValid (dblFuturesQuote) ? dblFuturesQuote * - dblCTDConversionFactor + dblAccrued : dblCTDForwardPrice + dblAccrued; - } -} diff --git a/org/drip/product/option/CDSEuropeanOption.java b/org/drip/product/option/CDSEuropeanOption.java deleted file mode 100644 index 18e6f70..0000000 --- a/org/drip/product/option/CDSEuropeanOption.java +++ /dev/null @@ -1,544 +0,0 @@ - -package org.drip.product.option; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDSEuropeanOption implements the Payer/Receiver European Option on a CDS. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDSEuropeanOption extends org.drip.product.option.OptionComponent { - private boolean _bIsReceiver = false; - private org.drip.pricer.option.FokkerPlanckGenerator _fpg = null; - private org.drip.product.definition.CreditDefaultSwap _cds = null; - - /** - * CDSEuropeanOption constructor - * - * @param strName Name - * @param cds The Underlying CDS Component - * @param strManifestMeasure Measure of the Underlying Component - * @param bIsReceiver Is the Option a Receiver/Payer? TRUE - Receiver - * @param dblStrike Strike of the Underlying Component's Measure - * @param ltds Last Trading Date Setting - * @param fpg The Fokker Planck Pricer Instance - * @param csp Cash Settle Parameters - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CDSEuropeanOption ( - final java.lang.String strName, - final org.drip.product.definition.CreditDefaultSwap cds, - final java.lang.String strManifestMeasure, - final boolean bIsReceiver, - final double dblStrike, - final org.drip.product.params.LastTradingDateSetting ltds, - final org.drip.pricer.option.FokkerPlanckGenerator fpg, - final org.drip.param.valuation.CashSettleParams csp) - throws java.lang.Exception - { - super (strName, cds, strManifestMeasure, dblStrike, cds.initialNotional(), ltds, csp); - - if (null == (_fpg = fpg)) - throw new java.lang.Exception ("CDSEuropeanOption ctr: Invalid Option Pricer"); - - _cds = cds; - _bIsReceiver = bIsReceiver; - } - - /** - * Generate the Standard CDS European Option Measures from the Integrated Surface Variance - * - * @param valParams The Valuation Parameters - * @param pricerParams The Pricer Parameters - * @param csqc The Market Parameters - * @param vcp The Valuation Customization Parameters - * @param dblIntegratedSurfaceVariance The Integrated Surface Variance - * - * @return The Standard CDS European Option Measures - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap valueFromSurfaceVariance ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblIntegratedSurfaceVariance) - { - if (null == valParams) return null; - - int iValueDate = valParams.valueDate(); - - org.drip.product.params.LastTradingDateSetting ltds = lastTradingDateSetting(); - - try { - if (null != ltds && iValueDate >= ltds.lastTradingDate (_cds.effectiveDate().julian(), - _cds.payCurrency())) - return null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - long lStart = System.nanoTime(); - - int iExerciseDate = exerciseDate().julian(); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapCDSOutput = _cds.value - (valParams, pricerParams, csqc, vcp); - - java.lang.String strManifestMeasure = manifestMeasure(); - - if (null == mapCDSOutput || !mapCDSOutput.containsKey ("DV01") || !mapCDSOutput.containsKey - (strManifestMeasure)) - return null; - - double dblCDSDV01 = mapCDSOutput.get ("DV01"); - - double dblATMManifestMeasure = mapCDSOutput.get (strManifestMeasure); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblATMManifestMeasure) || - !org.drip.quant.common.NumberUtil.IsValid (dblCDSDV01)) - return null; - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqc.fundingState - (_cds.fundingLabel()); - - try { - double dblStrike = strike(); - - double dblNotional = notional(); - - double dblMoneynessFactor = dblATMManifestMeasure / dblStrike; - double dblManifestMeasurePriceTransformer = java.lang.Double.NaN; - double dblManifestMeasureIntrinsic = _bIsReceiver ? dblATMManifestMeasure - dblStrike : dblStrike - - dblATMManifestMeasure; - - if (strManifestMeasure.equalsIgnoreCase ("Price") || strManifestMeasure.equalsIgnoreCase ("PV")) - dblManifestMeasurePriceTransformer = dcFunding.df (iExerciseDate); - else if (strManifestMeasure.equalsIgnoreCase ("FairPremium") || - strManifestMeasure.equalsIgnoreCase ("ParSpread") || strManifestMeasure.equalsIgnoreCase - ("QuantoAdjustedParSpread")) - dblManifestMeasurePriceTransformer = dblCDSDV01; - - if (!org.drip.quant.common.NumberUtil.IsValid (dblManifestMeasurePriceTransformer)) return null; - - double dblTTE = (iExerciseDate - iValueDate) / 365.25; - - org.drip.pricer.option.Greeks optGreek = _fpg.greeks (dblStrike, dblTTE, -(java.lang.Math.log - (dcFunding.df (iExerciseDate))) / dblTTE, dblATMManifestMeasure, _bIsReceiver, true, - java.lang.Math.sqrt (dblIntegratedSurfaceVariance / dblTTE)); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapResult = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - double dblForwardIntrinsic = optGreek.expectedPayoff(); - - double dblForwardATMIntrinsic = optGreek.expectedATMPayoff(); - - double dblSpotPrice = dblForwardIntrinsic * dblManifestMeasurePriceTransformer; - - double dblFPGCharm = optGreek.charm(); - - double dblFPGColor = optGreek.color(); - - double dblFPGDelta = optGreek.delta(); - - double dblFPGGamma = optGreek.gamma(); - - double dblFPGRho = optGreek.rho(); - - double dblFPGSpeed = optGreek.speed(); - - double dblFPGTheta = optGreek.theta(); - - double dblFPGUltima = optGreek.ultima(); - - double dblFPGVanna = optGreek.vanna(); - - double dblFPGVega = optGreek.vega(); - - double dblFPGVeta = optGreek.veta(); - - double dblFPGVomma = optGreek.vomma(); - - mapResult.put ("ATMManifestMeasure", dblATMManifestMeasure); - - mapResult.put ("ATMPrice", dblForwardATMIntrinsic * dblManifestMeasurePriceTransformer); - - mapResult.put ("CalcTime", (System.nanoTime() - lStart) * 1.e-09); - - mapResult.put ("Charm", dblFPGCharm * dblManifestMeasurePriceTransformer); - - mapResult.put ("Color", dblFPGColor * dblManifestMeasurePriceTransformer); - - mapResult.put ("Delta", dblFPGDelta * dblManifestMeasurePriceTransformer); - - mapResult.put ("EffectiveVolatility", optGreek.effectiveVolatility()); - - mapResult.put ("ExpectedATMPayoff", optGreek.expectedATMPayoff()); - - mapResult.put ("ExpectedPayoff", optGreek.expectedPayoff()); - - mapResult.put ("ForwardATMIntrinsic", dblForwardATMIntrinsic); - - mapResult.put ("ForwardIntrinsic", dblForwardIntrinsic); - - mapResult.put ("FPGCharm", dblFPGCharm); - - mapResult.put ("FPGColor", dblFPGColor); - - mapResult.put ("FPGDelta", dblFPGDelta); - - mapResult.put ("FPGGamma", dblFPGGamma); - - mapResult.put ("FPGRho", dblFPGRho); - - mapResult.put ("FPGSpeed", dblFPGSpeed); - - mapResult.put ("FPGTheta", dblFPGTheta); - - mapResult.put ("FPGUltima", dblFPGUltima); - - mapResult.put ("FPGVanna", dblFPGVanna); - - mapResult.put ("FPGVega", dblFPGVega); - - mapResult.put ("FPGVeta", dblFPGVeta); - - mapResult.put ("FPGVomma", dblFPGVomma); - - mapResult.put ("Gamma", dblFPGGamma * dblManifestMeasurePriceTransformer); - - mapResult.put ("IntegratedSurfaceVariance", dblIntegratedSurfaceVariance); - - mapResult.put ("ManifestMeasureIntrinsic", dblManifestMeasureIntrinsic); - - mapResult.put ("ManifestMeasureIntrinsicValue", dblManifestMeasureIntrinsic * - dblManifestMeasurePriceTransformer); - - mapResult.put ("ManifestMeasurePriceTransformer", dblManifestMeasurePriceTransformer); - - mapResult.put ("MoneynessFactor", dblMoneynessFactor); - - mapResult.put ("Price", dblSpotPrice); - - mapResult.put ("Prob1", optGreek.prob1()); - - mapResult.put ("Prob2", optGreek.prob2()); - - mapResult.put ("PV", dblSpotPrice * dblNotional); - - mapResult.put ("Rho", dblFPGRho * dblManifestMeasurePriceTransformer); - - mapResult.put ("Speed", dblFPGSpeed * dblManifestMeasurePriceTransformer); - - mapResult.put ("SpotPrice", dblSpotPrice); - - mapResult.put ("Theta", dblFPGTheta * dblManifestMeasurePriceTransformer); - - mapResult.put ("Ultima", optGreek.ultima() * dblManifestMeasurePriceTransformer); - - mapResult.put ("Upfront", dblSpotPrice); - - mapResult.put ("Vanna", optGreek.vanna() * dblManifestMeasurePriceTransformer); - - mapResult.put ("Vega", dblFPGVega * dblManifestMeasurePriceTransformer); - - mapResult.put ("Veta", optGreek.veta() * dblManifestMeasurePriceTransformer); - - mapResult.put ("Vomma", optGreek.vomma() * dblManifestMeasurePriceTransformer); - - return mapResult; - } catch (java.lang.Exception e) { - // e.printStackTrace(); - } - - return null; - } - - @Override public java.util.Set measureNames() - { - java.util.Set setstrMeasureNames = new java.util.TreeSet(); - - setstrMeasureNames.add ("ATMManifestMeasure"); - - setstrMeasureNames.add ("ATMPrice"); - - setstrMeasureNames.add ("CalcTime"); - - setstrMeasureNames.add ("Charm"); - - setstrMeasureNames.add ("Color"); - - setstrMeasureNames.add ("Delta"); - - setstrMeasureNames.add ("EffectiveVolatility"); - - setstrMeasureNames.add ("ExpectedATMPayoff"); - - setstrMeasureNames.add ("ExpectedPayoff"); - - setstrMeasureNames.add ("ForwardATMIntrinsic"); - - setstrMeasureNames.add ("ForwardIntrinsic"); - - setstrMeasureNames.add ("FPGCharm"); - - setstrMeasureNames.add ("FPGColor"); - - setstrMeasureNames.add ("FPGDelta"); - - setstrMeasureNames.add ("FPGGamma"); - - setstrMeasureNames.add ("FPGRho"); - - setstrMeasureNames.add ("FPGSpeed"); - - setstrMeasureNames.add ("FPGTheta"); - - setstrMeasureNames.add ("FPGUltima"); - - setstrMeasureNames.add ("FPGVanna"); - - setstrMeasureNames.add ("FPGVega"); - - setstrMeasureNames.add ("FPGVeta"); - - setstrMeasureNames.add ("FPGVomma"); - - setstrMeasureNames.add ("Gamma"); - - setstrMeasureNames.add ("IntegratedSurfaceVariance"); - - setstrMeasureNames.add ("ManifestMeasureIntrinsic"); - - setstrMeasureNames.add ("ManifestMeasureIntrinsicValue"); - - setstrMeasureNames.add ("ManifestMeasurePriceTransformer"); - - setstrMeasureNames.add ("MoneynessFactor"); - - setstrMeasureNames.add ("Price"); - - setstrMeasureNames.add ("Prob1"); - - setstrMeasureNames.add ("Prob2"); - - setstrMeasureNames.add ("PV"); - - setstrMeasureNames.add ("Rho"); - - setstrMeasureNames.add ("Speed"); - - setstrMeasureNames.add ("SpotPrice"); - - setstrMeasureNames.add ("Theta"); - - setstrMeasureNames.add ("Ultima"); - - setstrMeasureNames.add ("Upfront"); - - setstrMeasureNames.add ("Vanna"); - - setstrMeasureNames.add ("Vega"); - - setstrMeasureNames.add ("Veta"); - - setstrMeasureNames.add ("Vomma"); - - return setstrMeasureNames; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap couponCurrency() - { - return _cds.couponCurrency(); - } - - @Override public java.lang.String payCurrency() - { - return _cds.payCurrency(); - } - - @Override public java.lang.String principalCurrency() - { - return _cds.principalCurrency(); - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap value ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == valParams || null == csqs) return null; - - try { - return valueFromSurfaceVariance (valParams, pricerParams, csqs, vcp, - org.drip.analytics.support.OptionHelper.IntegratedSurfaceVariance (csqs.customVolatility - (org.drip.state.identifier.CustomLabel.Standard (_cds.name() + "_" + manifestMeasure())), - valParams.valueDate(), exerciseDate().julian())); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public double pv ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - throws java.lang.Exception - { - if (null == valParams) throw new java.lang.Exception ("CDSEuropeanOption::pv => Invalid Inputs"); - - int iValueDate = valParams.valueDate(); - - int iExerciseDate = exerciseDate().julian(); - - org.drip.product.params.LastTradingDateSetting ltds = lastTradingDateSetting(); - - java.lang.String strPayCurrency = payCurrency(); - - if (null != ltds && iValueDate >= ltds.lastTradingDate (_cds.effectiveDate().julian(), - strPayCurrency)) - throw new java.lang.Exception ("CDSEuropeanOption::pv => Invalid Inputs");; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapCDSOutput = _cds.value - (valParams, pricerParams, csqs, quotingParams); - - java.lang.String strManifestMeasure = manifestMeasure(); - - if (null == mapCDSOutput || !mapCDSOutput.containsKey (strManifestMeasure)) - throw new java.lang.Exception ("CDSEuropeanOption::pv => Invalid Inputs"); - - double dblFixedCleanDV01 = mapCDSOutput.get ("CleanDV01"); - - double dblATMManifestMeasure = mapCDSOutput.get (strManifestMeasure); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblATMManifestMeasure)) - throw new java.lang.Exception ("CDSEuropeanOption::pv => Invalid Inputs"); - - double dblIntegratedSurfaceVariance = - org.drip.analytics.support.OptionHelper.IntegratedSurfaceVariance (csqs.customVolatility - (org.drip.state.identifier.CustomLabel.Standard (_cds.name() + "_" + strManifestMeasure)), - iValueDate, iExerciseDate); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblIntegratedSurfaceVariance)) - throw new java.lang.Exception ("CDSEuropeanOption::pv => Invalid Inputs"); - - double dblIntegratedSurfaceVolatility = java.lang.Math.sqrt (dblIntegratedSurfaceVariance); - - double dblStrike = strike(); - - double dblMoneynessFactor = dblATMManifestMeasure / dblStrike; - - double dblLogMoneynessFactor = java.lang.Math.log (dblMoneynessFactor); - - double dblForwardIntrinsic = java.lang.Double.NaN; - double dblManifestMeasurePriceTransformer = java.lang.Double.NaN; - double dblDPlus = (dblLogMoneynessFactor + 0.5 * dblIntegratedSurfaceVariance) / - dblIntegratedSurfaceVolatility; - double dblDMinus = (dblLogMoneynessFactor - 0.5 * dblIntegratedSurfaceVariance) / - dblIntegratedSurfaceVolatility; - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqs.fundingState - (org.drip.state.identifier.FundingLabel.Standard (strPayCurrency)); - - if (null == dcFunding) throw new java.lang.Exception ("CDSEuropeanOption::pv => Invalid Inputs"); - - org.drip.state.credit.CreditCurve cc = csqs.creditState (_cds.creditLabel()); - - if (null == cc) throw new java.lang.Exception ("CDSEuropeanOption::pv => Invalid Inputs"); - - if (strManifestMeasure.equalsIgnoreCase ("Price") || strManifestMeasure.equalsIgnoreCase ("PV")) - dblManifestMeasurePriceTransformer = dcFunding.df (iExerciseDate) * cc.survival (iExerciseDate); - else if (strManifestMeasure.equalsIgnoreCase ("FairPremium") || strManifestMeasure.equalsIgnoreCase - ("ParSpread") || strManifestMeasure.equalsIgnoreCase ("Rate")) - dblManifestMeasurePriceTransformer = dblFixedCleanDV01; - - if (!org.drip.quant.common.NumberUtil.IsValid (dblManifestMeasurePriceTransformer)) - throw new java.lang.Exception ("CDSEuropeanOption::pv => Invalid Inputs"); - - if (_bIsReceiver) - dblForwardIntrinsic = dblATMManifestMeasure * org.drip.measure.gaussian.NormalQuadrature.CDF (dblDPlus) - - dblStrike * org.drip.measure.gaussian.NormalQuadrature.CDF (dblDMinus); - else - dblForwardIntrinsic = dblStrike * org.drip.measure.gaussian.NormalQuadrature.CDF (-dblDMinus) - - dblATMManifestMeasure * org.drip.measure.gaussian.NormalQuadrature.CDF (-dblDPlus); - - return dblForwardIntrinsic * dblManifestMeasurePriceTransformer; - } - - @Override public org.drip.product.calib.ProductQuoteSet calibQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - { - try { - return new org.drip.product.calib.ProductQuoteSet (aLSS); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint volatilityPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } -} diff --git a/org/drip/product/option/EuropeanCallPut.java b/org/drip/product/option/EuropeanCallPut.java deleted file mode 100644 index 844186d..0000000 --- a/org/drip/product/option/EuropeanCallPut.java +++ /dev/null @@ -1,433 +0,0 @@ - -package org.drip.product.option; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * EuropeanCallPut implements a simple European Call/Put Option, and its Black Scholes Price. - * - * @author Lakshmi Krishnamurthy - */ - -public class EuropeanCallPut { - private double _dblStrike = java.lang.Double.NaN; - private org.drip.analytics.date.JulianDate _dtMaturity = null; - - /** - * EuropeanCallPut constructor - * - * @param dtMaturity Option Maturity - * @param dblStrike Option Strike - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public EuropeanCallPut ( - final org.drip.analytics.date.JulianDate dtMaturity, - final double dblStrike) - throws java.lang.Exception - { - if (null == (_dtMaturity = dtMaturity) || !org.drip.quant.common.NumberUtil.IsValid (_dblStrike = - dblStrike) || 0. >= _dblStrike) - throw new java.lang.Exception ("EuropeanCallPut ctr: Invalid Inputs"); - } - - /** - * Retrieve the Option Maturity - * - * @return The Option Maturity - */ - - public org.drip.analytics.date.JulianDate maturity() - { - return _dtMaturity; - } - - /** - * Retrieve the Option Strike - * - * @return The Option Strike - */ - - public double strike() - { - return _dblStrike; - } - - /** - * Generate the Measure Set for the Option - * - * @param valParams The Valuation Parameters - * @param dblUnderlier The Underlier - * @param bIsForward TRUE - The Underlier represents the Forward, FALSE - it represents Spot - * @param dc Discount Curve - * @param auVolatility The Option Volatility Function - * @param fpg The Fokker Planck-based Option Pricer - * - * @return The Map of the Measures - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap value ( - final org.drip.param.valuation.ValuationParams valParams, - final double dblUnderlier, - final boolean bIsForward, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.function.definition.R1ToR1 auVolatility, - final org.drip.pricer.option.FokkerPlanckGenerator fpg) - { - if (null == valParams || null == dc || null == auVolatility || null == fpg) return null; - - int iValueDate = valParams.valueDate(); - - int iMaturityDate = _dtMaturity.julian(); - - if (iValueDate >= iMaturityDate) return null; - - long lStartTime = System.nanoTime(); - - double dblRiskFreeRate = java.lang.Double.NaN; - double dblTTE = (iMaturityDate - iValueDate) / 365.25; - double dblImpliedPutVolatility = java.lang.Double.NaN; - double dblImpliedCallVolatility = java.lang.Double.NaN; - double dblTimeAveragedVolatility = java.lang.Double.NaN; - double dblBlackScholesPutVolatility = java.lang.Double.NaN; - double dblBlackScholesCallVolatility = java.lang.Double.NaN; - - try { - dblRiskFreeRate = dc.zero (iMaturityDate); - - dblTimeAveragedVolatility = auVolatility.integrate (iValueDate, iMaturityDate) / (iMaturityDate - - iValueDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.pricer.option.Greeks callGreeks = fpg.greeks (_dblStrike, dblTTE, dblRiskFreeRate, - dblUnderlier, false, bIsForward, dblTimeAveragedVolatility); - - org.drip.pricer.option.PutGreeks putGreeks = (org.drip.pricer.option.PutGreeks) fpg.greeks - (_dblStrike, dblTTE, dblRiskFreeRate, dblUnderlier, true, bIsForward, dblTimeAveragedVolatility); - - if (null == callGreeks || null == putGreeks) return null; - - double dblCallPrice = callGreeks.price(); - - double dblPutPrice = putGreeks.price(); - - try { - dblBlackScholesCallVolatility = fpg.impliedBlackScholesVolatility (_dblStrike, dblTTE, - dblRiskFreeRate, dblUnderlier, false, bIsForward, dblCallPrice); - - dblBlackScholesPutVolatility = fpg.impliedBlackScholesVolatility (_dblStrike, dblTTE, - dblRiskFreeRate, dblUnderlier, true, bIsForward, dblPutPrice); - - dblImpliedCallVolatility = fpg.impliedVolatilityFromPrice (_dblStrike, dblTTE, dblRiskFreeRate, - dblUnderlier, false, bIsForward, dblCallPrice); - - dblImpliedPutVolatility = fpg.impliedVolatilityFromPrice (_dblStrike, dblTTE, dblRiskFreeRate, - dblUnderlier, true, bIsForward, dblPutPrice); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.analytics.support.CaseInsensitiveTreeMap mapMeasure = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapMeasure.put ("BlackScholesCallVolatility", dblBlackScholesCallVolatility); - - mapMeasure.put ("BlackScholesPutVolatility", dblBlackScholesPutVolatility); - - mapMeasure.put ("CalcTime", (System.nanoTime() - lStartTime) * 1.e-09); - - mapMeasure.put ("CallCharm", callGreeks.charm()); - - mapMeasure.put ("CallColor", callGreeks.color()); - - mapMeasure.put ("CallDelta", callGreeks.delta()); - - mapMeasure.put ("CallGamma", callGreeks.gamma()); - - mapMeasure.put ("CallPrice", callGreeks.price()); - - mapMeasure.put ("CallProb1", callGreeks.prob1()); - - mapMeasure.put ("CallProb2", callGreeks.prob2()); - - mapMeasure.put ("CallRho", callGreeks.rho()); - - mapMeasure.put ("CallSpeed", callGreeks.speed()); - - mapMeasure.put ("CallTheta", callGreeks.theta()); - - mapMeasure.put ("CallUltima", callGreeks.ultima()); - - mapMeasure.put ("CallVanna", callGreeks.vanna()); - - mapMeasure.put ("CallVega", callGreeks.vega()); - - mapMeasure.put ("CallVeta", callGreeks.veta()); - - mapMeasure.put ("CallVomma", callGreeks.vomma()); - - mapMeasure.put ("DF", callGreeks.df()); - - mapMeasure.put ("EffectiveVolatility", callGreeks.effectiveVolatility()); - - mapMeasure.put ("ImpliedCallVolatility", dblImpliedCallVolatility); - - mapMeasure.put ("ImpliedPutVolatility", dblImpliedPutVolatility); - - mapMeasure.put ("PutCharm", putGreeks.charm()); - - mapMeasure.put ("PutColor", putGreeks.color()); - - mapMeasure.put ("PutDelta", putGreeks.delta()); - - mapMeasure.put ("PutGamma", putGreeks.gamma()); - - mapMeasure.put ("PutPrice", putGreeks.price()); - - mapMeasure.put ("PutPriceFromParity", putGreeks.putPriceFromParity()); - - mapMeasure.put ("PutProb1", putGreeks.prob1()); - - mapMeasure.put ("PutProb2", putGreeks.prob2()); - - mapMeasure.put ("PutRho", putGreeks.rho()); - - mapMeasure.put ("PutSpeed", putGreeks.speed()); - - mapMeasure.put ("PutTheta", putGreeks.theta()); - - mapMeasure.put ("PutUltima", putGreeks.ultima()); - - mapMeasure.put ("PutVanna", putGreeks.vanna()); - - mapMeasure.put ("PutVega", putGreeks.vega()); - - mapMeasure.put ("PutVeta", putGreeks.veta()); - - mapMeasure.put ("PutVomma", putGreeks.vomma()); - - mapMeasure.put ("TTE", dblTTE); - - return mapMeasure; - } - - /** - * Imply the Option Volatility given the Call Price - * - * @param valParams The Valuation Parameters - * @param dblUnderlier The Underlier - * @param bIsForward TRUE - The Underlier represents the Forward, FALSE - it represents Spot - * @param dc Discount Curve - * @param dblCallPrice The Option Call Price - * - * @return The Option's Implied Volatility - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public double implyVolatilityFromCallPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final double dblUnderlier, - final boolean bIsForward, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final double dblCallPrice) - throws java.lang.Exception - { - if (null == valParams || null == dc) - throw new java.lang.Exception ("EuropeanCallPut::implyVolatilityFromCallPrice => Invalid Inputs"); - - int iValueDate = valParams.valueDate(); - - int iMaturityDate = _dtMaturity.julian(); - - if (iValueDate >= iMaturityDate) - throw new java.lang.Exception ("EuropeanCallPut::implyVolatilityFromCallPrice => Invalid Inputs"); - - double dblTTE = 1. * (iMaturityDate - iValueDate) / 365.25; - - return new org.drip.pricer.option.BlackScholesAlgorithm().impliedVolatilityFromPrice (_dblStrike, - dblTTE, dc.zero (iMaturityDate), dblUnderlier, false, bIsForward, dblCallPrice); - } - - /** - * Imply the Option Volatility given the Put Price - * - * @param valParams The Valuation Parameters - * @param dblUnderlier The Underlier - * @param bIsForward TRUE - The Underlier represents the Forward, FALSE - it represents Spot - * @param dc Discount Curve - * @param dblPutPrice The Option Put Price - * - * @return The Option's Implied Volatility - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public double implyVolatilityFromPutPrice ( - final org.drip.param.valuation.ValuationParams valParams, - final double dblUnderlier, - final boolean bIsForward, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final double dblPutPrice) - throws java.lang.Exception - { - if (null == valParams || null == dc) - throw new java.lang.Exception ("EuropeanCallPut::implyVolatilityFromPutPrice => Invalid Inputs"); - - int iValueDate = valParams.valueDate(); - - int iMaturityDate = _dtMaturity.julian(); - - if (iValueDate >= iMaturityDate) - throw new java.lang.Exception ("EuropeanCallPut::implyVolatilityFromPutPrice => Invalid Inputs"); - - double dblTTE = 1. * (iMaturityDate - iValueDate) / 365.25; - - return new org.drip.pricer.option.BlackScholesAlgorithm().impliedVolatilityFromPrice (_dblStrike, - dblTTE, dc.zero (iMaturityDate), dblUnderlier, true, bIsForward, dblPutPrice); - } - - /** - * Retrieve the Set of the Measure Names - * - * @return The Set of the Measure Names - */ - - public java.util.Set getMeasureNames() - { - java.util.Set setstrMeasureNames = new java.util.TreeSet(); - - setstrMeasureNames.add ("BlackScholesCallVolatility"); - - setstrMeasureNames.add ("BlackScholesPutVolatility"); - - setstrMeasureNames.add ("CalcTime"); - - setstrMeasureNames.add ("CallCharm"); - - setstrMeasureNames.add ("CallColor"); - - setstrMeasureNames.add ("CallDelta"); - - setstrMeasureNames.add ("CallGamma"); - - setstrMeasureNames.add ("CallPrice"); - - setstrMeasureNames.add ("CallProb1"); - - setstrMeasureNames.add ("CallProb2"); - - setstrMeasureNames.add ("CallRho"); - - setstrMeasureNames.add ("CallSpeed"); - - setstrMeasureNames.add ("CallTheta"); - - setstrMeasureNames.add ("CallUltima"); - - setstrMeasureNames.add ("CallVanna"); - - setstrMeasureNames.add ("CallVega"); - - setstrMeasureNames.add ("CallVeta"); - - setstrMeasureNames.add ("CallVomma"); - - setstrMeasureNames.add ("DF"); - - setstrMeasureNames.add ("EffectiveVolatility"); - - setstrMeasureNames.add ("ImpliedCallVolatility"); - - setstrMeasureNames.add ("ImpliedPutVolatility"); - - setstrMeasureNames.add ("PutCharm"); - - setstrMeasureNames.add ("PutColor"); - - setstrMeasureNames.add ("PutDelta"); - - setstrMeasureNames.add ("PutGamma"); - - setstrMeasureNames.add ("PutPrice"); - - setstrMeasureNames.add ("PutPriceFromParity"); - - setstrMeasureNames.add ("PutProb1"); - - setstrMeasureNames.add ("PutProb2"); - - setstrMeasureNames.add ("PutRho"); - - setstrMeasureNames.add ("PutSpeed"); - - setstrMeasureNames.add ("PutTheta"); - - setstrMeasureNames.add ("PutUltima"); - - setstrMeasureNames.add ("PutVanna"); - - setstrMeasureNames.add ("PutVega"); - - setstrMeasureNames.add ("PutVeta"); - - setstrMeasureNames.add ("PutVomma"); - - setstrMeasureNames.add ("TTE"); - - return setstrMeasureNames; - } -} diff --git a/org/drip/product/option/FixFloatEuropeanOption.java b/org/drip/product/option/FixFloatEuropeanOption.java deleted file mode 100644 index b6e5e73..0000000 --- a/org/drip/product/option/FixFloatEuropeanOption.java +++ /dev/null @@ -1,428 +0,0 @@ - -package org.drip.product.option; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FixFloatEuropeanOption implements the Payer/Receiver European Option on the Fix-Float Swap. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixFloatEuropeanOption extends org.drip.product.option.OptionComponent { - private boolean _bIsReceiver = false; - private org.drip.product.rates.FixFloatComponent _stir = null; - - /** - * FixFloatEuropeanOption constructor - * - * @param strName Name - * @param stir The Underlying STIR Future Component - * @param strManifestMeasure Measure of the Underlying Component - * @param bIsReceiver Is the STIR Option a Receiver/Payer? TRUE - Receiver - * @param dblStrike Strike of the Underlying Component's Measure - * @param dblNotional Option Notional - * @param ltds Last Trading Date Setting - * @param csp Cash Settle Parameters - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public FixFloatEuropeanOption ( - final java.lang.String strName, - final org.drip.product.rates.FixFloatComponent stir, - final java.lang.String strManifestMeasure, - final boolean bIsReceiver, - final double dblStrike, - final double dblNotional, - final org.drip.product.params.LastTradingDateSetting ltds, - final org.drip.param.valuation.CashSettleParams csp) - throws java.lang.Exception - { - super (strName, stir, strManifestMeasure, dblStrike, dblNotional, ltds, csp); - - _stir = stir; - _bIsReceiver = bIsReceiver; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap couponCurrency() - { - return _stir.couponCurrency(); - } - - @Override public java.lang.String payCurrency() - { - return _stir.payCurrency(); - } - - @Override public java.lang.String principalCurrency() - { - return _stir.principalCurrency(); - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap value ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - { - if (null == valParams) return null; - - int iValueDate = valParams.valueDate(); - - int iExerciseDate = exerciseDate().julian(); - - org.drip.analytics.date.JulianDate dtEffective = _stir.effectiveDate(); - - org.drip.product.params.LastTradingDateSetting ltds = lastTradingDateSetting(); - - try { - if (null != ltds && iValueDate >= ltds.lastTradingDate (dtEffective.julian(), - _stir.referenceStream().calendar())) - return null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - java.lang.String strPayCurrency = _stir.payCurrency(); - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqs.fundingState - (org.drip.state.identifier.FundingLabel.Standard (strPayCurrency)); - - if (null == dcFunding) return null; - - long lStart = System.nanoTime(); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapSTIROutput = _stir.value - (valParams, pricerParams, csqs, quotingParams); - - java.lang.String strManifestMeasure = manifestMeasure(); - - if (null == mapSTIROutput || !mapSTIROutput.containsKey (strManifestMeasure)) return null; - - double dblFixedCleanDV01 = mapSTIROutput.get ("CleanFixedDV01"); - - double dblATMManifestMeasure = mapSTIROutput.get (strManifestMeasure); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblATMManifestMeasure)) return null; - - try { - double dblSTIRIntegratedSurfaceVariance = - org.drip.analytics.support.OptionHelper.IntegratedSurfaceVariance (csqs.customVolatility - (org.drip.state.identifier.CustomLabel.Standard (_stir.name() + "_" + - strManifestMeasure)), iValueDate, iExerciseDate); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblSTIRIntegratedSurfaceVariance)) return null; - - double dblSTIRIntegratedSurfaceVolatility = java.lang.Math.sqrt - (dblSTIRIntegratedSurfaceVariance); - - double dblStrike = strike(); - - double dblMoneynessFactor = dblATMManifestMeasure / dblStrike; - - double dblLogMoneynessFactor = java.lang.Math.log (dblMoneynessFactor); - - double dblForwardIntrinsic = java.lang.Double.NaN; - double dblForwardATMIntrinsic = java.lang.Double.NaN; - double dblManifestMeasurePriceTransformer = java.lang.Double.NaN; - double dblManifestMeasureIntrinsic = _bIsReceiver ? dblATMManifestMeasure - dblStrike : dblStrike - - dblATMManifestMeasure; - double dblATMDPlus = 0.5 * dblSTIRIntegratedSurfaceVariance / dblSTIRIntegratedSurfaceVolatility; - double dblATMDMinus = -1. * dblATMDPlus; - double dblDPlus = (dblLogMoneynessFactor + 0.5 * dblSTIRIntegratedSurfaceVariance) / - dblSTIRIntegratedSurfaceVolatility; - double dblDMinus = (dblLogMoneynessFactor - 0.5 * dblSTIRIntegratedSurfaceVariance) / - dblSTIRIntegratedSurfaceVolatility; - - if (strManifestMeasure.equalsIgnoreCase ("Price") || strManifestMeasure.equalsIgnoreCase ("PV")) - dblManifestMeasurePriceTransformer = dcFunding.df (iExerciseDate); - else if (strManifestMeasure.equalsIgnoreCase ("FairPremium") || - strManifestMeasure.equalsIgnoreCase ("SwapRate") || strManifestMeasure.equalsIgnoreCase - ("Rate")) - dblManifestMeasurePriceTransformer = 10000. * dblFixedCleanDV01; - - if (!org.drip.quant.common.NumberUtil.IsValid (dblManifestMeasurePriceTransformer)) return null; - - if (_bIsReceiver) { - dblForwardIntrinsic = dblATMManifestMeasure * org.drip.measure.gaussian.NormalQuadrature.CDF - (dblDPlus) - dblStrike * org.drip.measure.gaussian.NormalQuadrature.CDF (dblDMinus); - - dblForwardATMIntrinsic = dblATMManifestMeasure * org.drip.measure.gaussian.NormalQuadrature.CDF - (dblATMDPlus) - dblStrike * org.drip.measure.gaussian.NormalQuadrature.CDF (dblATMDMinus); - } else { - dblForwardIntrinsic = dblStrike * org.drip.measure.gaussian.NormalQuadrature.CDF (-dblDMinus) - - dblATMManifestMeasure * org.drip.measure.gaussian.NormalQuadrature.CDF (-dblDPlus); - - dblForwardATMIntrinsic = dblStrike * org.drip.measure.gaussian.NormalQuadrature.CDF (-dblATMDMinus) - - dblATMManifestMeasure * org.drip.measure.gaussian.NormalQuadrature.CDF (-dblATMDPlus); - } - - org.drip.analytics.support.CaseInsensitiveTreeMap mapResult = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - double dblSpotPrice = dblForwardIntrinsic * dblManifestMeasurePriceTransformer; - - mapResult.put ("ATMSwapRate", dblATMManifestMeasure); - - mapResult.put ("CalcTime", (System.nanoTime() - lStart) * 1.e-09); - - mapResult.put ("ForwardATMIntrinsic", dblForwardATMIntrinsic); - - mapResult.put ("ForwardIntrinsic", dblForwardIntrinsic); - - mapResult.put ("IntegratedSurfaceVariance", dblSTIRIntegratedSurfaceVariance); - - mapResult.put ("ManifestMeasureIntrinsic", dblManifestMeasureIntrinsic); - - mapResult.put ("ManifestMeasureIntrinsicValue", dblManifestMeasureIntrinsic * - dblManifestMeasurePriceTransformer); - - mapResult.put ("MoneynessFactor", dblMoneynessFactor); - - mapResult.put ("Price", dblSpotPrice); - - mapResult.put ("PV", dblSpotPrice); - - org.drip.market.otc.SwapOptionSettlement sos = - org.drip.market.otc.SwapOptionSettlementContainer.ConventionFromJurisdiction - (strPayCurrency); - - if (null != sos) { - int iSettlementType = sos.settlementType(); - - int iSettlementQuote = sos.settlementQuote(); - - mapResult.put ("SettleType", (double) iSettlementType); - - mapResult.put ("SettleQuote", (double) iSettlementQuote); - - if (org.drip.market.otc.SwapOptionSettlement.SETTLEMENT_TYPE_CASH_SETTLED == iSettlementType) - { - if (org.drip.market.otc.SwapOptionSettlement.SETTLEMENT_QUOTE_EXACT_CURVE == - iSettlementQuote) - mapResult.put ("SettleAmount", dblSpotPrice); - else if (org.drip.market.otc.SwapOptionSettlement.SETTLEMENT_QUOTE_IRR == - iSettlementQuote && (strManifestMeasure.equalsIgnoreCase ("FairPremium") || - strManifestMeasure.equalsIgnoreCase ("SwapRate") || - strManifestMeasure.equalsIgnoreCase ("Rate"))) { - org.drip.product.rates.Stream streamDerived = _stir.derivedStream(); - - if (csqs.setFundingState - (org.drip.state.creator.ScenarioDiscountCurveBuilder.CreateFromFlatYield - (dtEffective, strPayCurrency, dblATMManifestMeasure, - streamDerived.couponDC(), streamDerived.freq())) && null != - (mapSTIROutput = _stir.value (valParams, pricerParams, csqs, - quotingParams))) - mapResult.put ("SettleAmount", dblForwardIntrinsic * 10000. * - mapSTIROutput.get ("CleanFixedDV01")); - } - } - } else - mapResult.put ("SettleAmount", dblSpotPrice); - - mapResult.put ("SpotPrice", dblSpotPrice); - - mapResult.put ("Upfront", dblSpotPrice); - - return mapResult; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public java.util.Set measureNames() - { - java.util.Set setstrMeasureNames = new java.util.TreeSet(); - - setstrMeasureNames.add ("ATMSwapRate"); - - setstrMeasureNames.add ("CalcTime"); - - setstrMeasureNames.add ("ForwardATMIntrinsic"); - - setstrMeasureNames.add ("ForwardIntrinsic"); - - setstrMeasureNames.add ("IntegratedSurfaceVariance"); - - setstrMeasureNames.add ("ManifestMeasureIntrinsic"); - - setstrMeasureNames.add ("ManifestMeasureIntrinsicValue"); - - setstrMeasureNames.add ("MoneynessFactor"); - - setstrMeasureNames.add ("Price"); - - setstrMeasureNames.add ("PV"); - - setstrMeasureNames.add ("SettleAmount"); - - setstrMeasureNames.add ("SettleQuote"); - - setstrMeasureNames.add ("SettleType"); - - setstrMeasureNames.add ("SpotPrice"); - - setstrMeasureNames.add ("Upfront"); - - return setstrMeasureNames; - } - - @Override public double pv ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - throws java.lang.Exception - { - if (null == valParams) - throw new java.lang.Exception ("FixFloatEuropeanOption::pv => Invalid Inputs"); - - int iValueDate = valParams.valueDate(); - - int iExerciseDate = exerciseDate().julian(); - - org.drip.product.params.LastTradingDateSetting ltds = lastTradingDateSetting(); - - if (null != ltds && iValueDate >= ltds.lastTradingDate (_stir.effectiveDate().julian(), - _stir.referenceStream().calendar())) - throw new java.lang.Exception ("FixFloatEuropeanOption::pv => Invalid Inputs");; - - java.lang.String strPayCurrency = _stir.payCurrency(); - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqs.fundingState - (org.drip.state.identifier.FundingLabel.Standard (strPayCurrency)); - - if (null == dcFunding) - throw new java.lang.Exception ("FixFloatEuropeanOption::pv => Invalid Inputs"); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapSTIROutput = _stir.value - (valParams, pricerParams, csqs, quotingParams); - - java.lang.String strManifestMeasure = manifestMeasure(); - - if (null == mapSTIROutput || !mapSTIROutput.containsKey (strManifestMeasure)) - throw new java.lang.Exception ("FixFloatEuropeanOption::pv => Invalid Inputs"); - - double dblFixedCleanDV01 = mapSTIROutput.get ("CleanFixedDV01"); - - double dblATMManifestMeasure = mapSTIROutput.get (strManifestMeasure); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblATMManifestMeasure)) - throw new java.lang.Exception ("FixFloatEuropeanOption::pv => Invalid Inputs"); - - double dblSTIRIntegratedSurfaceVariance = - org.drip.analytics.support.OptionHelper.IntegratedSurfaceVariance (csqs.customVolatility - (org.drip.state.identifier.CustomLabel.Standard (_stir.name() + "_" + strManifestMeasure)), - iValueDate, iExerciseDate); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblSTIRIntegratedSurfaceVariance)) - throw new java.lang.Exception ("FixFloatEuropeanOption::pv => Invalid Inputs"); - - double dblSTIRIntegratedSurfaceVolatility = java.lang.Math.sqrt (dblSTIRIntegratedSurfaceVariance); - - double dblStrike = strike(); - - double dblMoneynessFactor = dblATMManifestMeasure / dblStrike; - - double dblLogMoneynessFactor = java.lang.Math.log (dblMoneynessFactor); - - double dblForwardIntrinsic = java.lang.Double.NaN; - double dblManifestMeasurePriceTransformer = java.lang.Double.NaN; - double dblDPlus = (dblLogMoneynessFactor + 0.5 * dblSTIRIntegratedSurfaceVariance) / - dblSTIRIntegratedSurfaceVolatility; - double dblDMinus = (dblLogMoneynessFactor - 0.5 * dblSTIRIntegratedSurfaceVariance) / - dblSTIRIntegratedSurfaceVolatility; - - if (strManifestMeasure.equalsIgnoreCase ("Price") || strManifestMeasure.equalsIgnoreCase ("PV")) - dblManifestMeasurePriceTransformer = dcFunding.df (iExerciseDate); - else if (strManifestMeasure.equalsIgnoreCase ("FairPremium") || - strManifestMeasure.equalsIgnoreCase ("SwapRate") || strManifestMeasure.equalsIgnoreCase - ("Rate")) - dblManifestMeasurePriceTransformer = 10000. * dblFixedCleanDV01; - - if (!org.drip.quant.common.NumberUtil.IsValid (dblManifestMeasurePriceTransformer)) - throw new java.lang.Exception ("FixFloatEuropeanOption::pv => Invalid Inputs"); - - if (_bIsReceiver) - dblForwardIntrinsic = dblATMManifestMeasure * org.drip.measure.gaussian.NormalQuadrature.CDF - (dblDPlus) - dblStrike * org.drip.measure.gaussian.NormalQuadrature.CDF (dblDMinus); - else - dblForwardIntrinsic = dblStrike * org.drip.measure.gaussian.NormalQuadrature.CDF (-dblDMinus) - - dblATMManifestMeasure * org.drip.measure.gaussian.NormalQuadrature.CDF (-dblDPlus); - - return dblForwardIntrinsic * dblManifestMeasurePriceTransformer; - } - - @Override public org.drip.product.calib.ProductQuoteSet calibQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - { - try { - return new org.drip.product.calib.ProductQuoteSet (aLSS); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint volatilityPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } -} diff --git a/org/drip/product/option/OptionComponent.java b/org/drip/product/option/OptionComponent.java deleted file mode 100644 index 5c4fb3a..0000000 --- a/org/drip/product/option/OptionComponent.java +++ /dev/null @@ -1,386 +0,0 @@ - -package org.drip.product.option; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * OptionComponent extends ComponentMarketParamRef and provides the following methods: - * - Get the component's initial notional, notional, and coupon. - * - Get the Effective date, Maturity date, First Coupon Date. - * - Set the market curves - discount, TSY, forward, and Credit curves. - * - Retrieve the component's settlement parameters. - * - Value the component using standard/custom market parameters. - * - Retrieve the component's named measures and named measure values. - * - Retrieve the Underlying Fixed Income Product, Day Count, Strike, Calendar, and Manifest Measure. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class OptionComponent extends org.drip.product.definition.CalibratableComponent { - private java.lang.String _strCode = ""; - private java.lang.String _strName = ""; - private double _dblStrike = java.lang.Double.NaN; - private java.lang.String _strManifestMeasure = ""; - private double _dblNotional = java.lang.Double.NaN; - private org.drip.product.definition.Component _comp = null; - private org.drip.param.valuation.CashSettleParams _csp = null; - private org.drip.product.params.LastTradingDateSetting _ltds = null; - - protected OptionComponent ( - final java.lang.String strName, - final org.drip.product.definition.Component comp, - final java.lang.String strManifestMeasure, - final double dblStrike, - final double dblNotional, - final org.drip.product.params.LastTradingDateSetting ltds, - final org.drip.param.valuation.CashSettleParams csp) - throws java.lang.Exception - { - if (null == (_strName = strName) || _strName.isEmpty() || null == (_comp = comp) || null == - (_strManifestMeasure = strManifestMeasure) || _strManifestMeasure.isEmpty() || - !org.drip.quant.common.NumberUtil.IsValid (_dblStrike = dblStrike) || - !org.drip.quant.common.NumberUtil.IsValid (_dblNotional = dblNotional)) - throw new java.lang.Exception ("OptionComponent ctr: Invalid Inputs"); - - _csp = csp; - _ltds = ltds; - } - - /** - * Retrieve the Underlying Component - * - * @return The Underlying Component - */ - - public org.drip.product.definition.Component underlying() - { - return _comp; - } - - /** - * Retrieve the Manifest Measure on which the Option's Strike is quoted - * - * @return The Manifest Measure on which the Option's Strike is quoted - */ - - public java.lang.String manifestMeasure() - { - return _strManifestMeasure; - } - - /** - * Retrieve the Strike - * - * @return The Strike - */ - - public double strike() - { - return _dblStrike; - } - - /** - * Retrieve the Notional - * - * @return The Notional - */ - - public double notional() - { - return _dblNotional; - } - - /** - * Retrieve the Option Exercise Date - * - * @return The Option Exercise Date - */ - - public org.drip.analytics.date.JulianDate exerciseDate() - { - return _comp.effectiveDate(); - } - - /** - * Retrieve the Option Last Trading Date Setting - * - * @return The Option Last Trading Date Setting - */ - - public org.drip.product.params.LastTradingDateSetting lastTradingDateSetting() - { - return _ltds; - } - - @Override public void setPrimaryCode ( - final java.lang.String strCode) - { - _strCode = strCode; - } - - @Override public java.lang.String primaryCode() - { - return _strCode; - } - - @Override public java.lang.String name() - { - return _strName; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap couponCurrency() - { - return _comp.couponCurrency(); - } - - @Override public java.lang.String payCurrency() - { - return _comp.payCurrency(); - } - - @Override public java.lang.String principalCurrency() - { - return _comp.payCurrency(); - } - - @Override public org.drip.analytics.date.JulianDate effectiveDate() - { - return null; - } - - @Override public org.drip.analytics.date.JulianDate maturityDate() - { - return exerciseDate(); - } - - @Override public org.drip.analytics.date.JulianDate firstCouponDate() - { - return _comp.effectiveDate(); - } - - @Override public double initialNotional() - { - return _dblNotional; - } - - @Override public double notional ( - final int dblDate1) - { - return _dblNotional; - } - - @Override public double notional ( - final int dblDate1, - final int dblDate2) - { - return _dblNotional; - } - - @Override public int freq() - { - return _comp.freq(); - } - - @Override public org.drip.state.identifier.CreditLabel creditLabel() - { - return _comp.creditLabel(); - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - forwardLabel() - { - return _comp.forwardLabel(); - } - - @Override public org.drip.state.identifier.FundingLabel fundingLabel() - { - return _comp.fundingLabel(); - } - - @Override public org.drip.state.identifier.GovvieLabel govvieLabel() - { - return _comp.govvieLabel(); - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap - fxLabel() - { - return _comp.fxLabel(); - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - volatilityLabel() - { - org.drip.analytics.support.CaseInsensitiveTreeMap - mapForwardLabel = forwardLabel(); - - if (null == mapForwardLabel || 0 == mapForwardLabel.size()) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapVolatilityLabel = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry forwardLabelEntry - : mapForwardLabel.entrySet()) - mapVolatilityLabel.put (forwardLabelEntry.getKey(), - org.drip.state.identifier.VolatilityLabel.Standard (forwardLabelEntry.getValue())); - - return mapVolatilityLabel; - } - - @Override public org.drip.analytics.output.CompositePeriodCouponMetrics couponMetrics ( - final int iAccrualEndDate, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - return null; - } - - @Override public java.util.List couponPeriods() - { - return null; - } - - @Override public org.drip.param.valuation.CashSettleParams cashSettleParams() - { - return _csp; - } - - @Override public org.drip.product.calib.ProductQuoteSet calibQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - { - try { - return new org.drip.product.calib.VolatilityProductQuoteSet (aLSS); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap calibMeasures ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint forwardPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fundingPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fundingForwardPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fxPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint govviePRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDDirtyPVDManifestMeasure ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - return null; - } - - @Override public org.drip.quant.calculus.WengertJacobian manifestMeasureDFMicroJack ( - final java.lang.String strMainfestMeasure, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - return null; - } -} diff --git a/org/drip/product/params/BondStream.java b/org/drip/product/params/BondStream.java deleted file mode 100644 index da78a58..0000000 --- a/org/drip/product/params/BondStream.java +++ /dev/null @@ -1,302 +0,0 @@ - -package org.drip.product.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * BondStream is the place-holder for the bond's period generation parameters. Contains the bond's - * date adjustment parameters for period start/end, period accrual start/end, effective, maturity, pay and - * reset, first coupon date, and interest accrual start date. It exports serialization into and - * de-serialization out of byte arrays. - * - * @author Lakshmi Krishnamurthy - */ - -public class BondStream extends org.drip.product.rates.Stream { - private java.lang.String _strMaturityType = ""; - private int _iFinalMaturityDate = java.lang.Integer.MIN_VALUE; - - /** - * Construct and Instance of PeriodSet from the specified Parameters - * - * @param iMaturityDate Maturity Date - * @param iEffectiveDate Effective Date - * @param iFinalMaturityDate Final Maturity Date - * @param iFirstCouponDate First Coupon Date - * @param iInterestAccrualStartDate Interest Accrual Start Date - * @param iFreq Coupon Frequency - * @param dblCoupon Coupon Rate - * @param strCouponDC Coupon day count convention - * @param strAccrualDC Accrual day count convention - * @param dapPay Pay Date Adjustment Parameters - * @param dapReset Reset Date Adjustment Parameters - * @param dapMaturity Maturity Date Adjustment Parameters - * @param dapEffective Effective Date Adjustment Parameters - * @param dapPeriodEnd Period End Date Adjustment Parameters - * @param dapAccrualEnd Accrual Date Adjustment Parameters - * @param dapPeriodStart Period Start Date Adjustment Parameters - * @param dapAccrualStart Accrual Start Date Adjustment Parameters - * @param strMaturityType Maturity Type - * @param bPeriodsFromForward Generate Periods forward (True) or Backward (False) - * @param strCalendar Optional Holiday Calendar for accrual calculations - * @param strCurrency Coupon Currency - * @param forwardLabel The Forward Label - * @param creditLabel The Credit Label - * - * @return PeriodSet Instance - */ - - public static final BondStream Create ( - final int iMaturityDate, - final int iEffectiveDate, - final int iFinalMaturityDate, - final int iFirstCouponDate, - final int iInterestAccrualStartDate, - final int iFreq, - final double dblCoupon, - final java.lang.String strCouponDC, - final java.lang.String strAccrualDC, - final org.drip.analytics.daycount.DateAdjustParams dapPay, - final org.drip.analytics.daycount.DateAdjustParams dapReset, - final org.drip.analytics.daycount.DateAdjustParams dapMaturity, - final org.drip.analytics.daycount.DateAdjustParams dapEffective, - final org.drip.analytics.daycount.DateAdjustParams dapPeriodEnd, - final org.drip.analytics.daycount.DateAdjustParams dapAccrualEnd, - final org.drip.analytics.daycount.DateAdjustParams dapPeriodStart, - final org.drip.analytics.daycount.DateAdjustParams dapAccrualStart, - final java.lang.String strMaturityType, - final boolean bPeriodsFromForward, - final java.lang.String strCalendar, - final java.lang.String strCurrency, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final org.drip.state.identifier.CreditLabel creditLabel) - { - boolean bCouponEOMAdj = null == strCouponDC ? false : strCouponDC.toUpperCase().contains ("EOM"); - - int iCouponDCIndex = null == strCouponDC ? -1 : strCouponDC.indexOf (" NON"); - - java.lang.String strCouponDCAdj = -1 != iCouponDCIndex ? strCouponDC.substring (0, iCouponDCIndex) : - strCouponDC; - - boolean bAccrualEOMAdj = null == strAccrualDC ? false : strAccrualDC.toUpperCase().contains ("EOM"); - - int iAccrualDCIndex = null == strAccrualDC ? -1 : strAccrualDC.indexOf (" NON"); - - java.lang.String strAccrualDCAdj = -1 != iAccrualDCIndex ? strAccrualDC.substring (0, - iAccrualDCIndex) : strAccrualDC; - - org.drip.analytics.date.JulianDate dtEffective = new org.drip.analytics.date.JulianDate - (iEffectiveDate); - - org.drip.analytics.date.JulianDate dtMaturity = new org.drip.analytics.date.JulianDate - (iMaturityDate); - - java.lang.String strTenor = (12 / iFreq) + "M"; - java.util.List lsCouponPeriod = null; - - try { - org.drip.param.period.UnitCouponAccrualSetting ucas = new - org.drip.param.period.UnitCouponAccrualSetting (iFreq, strCouponDCAdj, bCouponEOMAdj, - strAccrualDCAdj, bAccrualEOMAdj, strCurrency, true, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - org.drip.param.period.CompositePeriodSetting cps = new - org.drip.param.period.CompositePeriodSetting (iFreq, strTenor, strCurrency, null, 1., null, - null, null, null); - - java.util.List lsStreamEdgeDate = bPeriodsFromForward ? - org.drip.analytics.support.CompositePeriodBuilder.ForwardEdgeDates (dtEffective, dtMaturity, - strTenor, dapAccrualEnd, org.drip.analytics.support.CompositePeriodBuilder.LONG_STUB) : - org.drip.analytics.support.CompositePeriodBuilder.BackwardEdgeDates (dtEffective, - dtMaturity, strTenor, dapAccrualEnd, - org.drip.analytics.support.CompositePeriodBuilder.LONG_STUB); - - if (null == forwardLabel) { - org.drip.param.period.ComposableFixedUnitSetting cfus = new - org.drip.param.period.ComposableFixedUnitSetting (strTenor, - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, null, - dblCoupon, 0., strCurrency); - - lsCouponPeriod = org.drip.analytics.support.CompositePeriodBuilder.FixedCompositeUnit - (lsStreamEdgeDate, cps, ucas, cfus); - } else { - org.drip.param.period.ComposableFloatingUnitSetting cfus = new - org.drip.param.period.ComposableFloatingUnitSetting (strTenor, - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, null, - forwardLabel, - org.drip.analytics.support.CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - dblCoupon); - - lsCouponPeriod = org.drip.analytics.support.CompositePeriodBuilder.FloatingCompositeUnit - (lsStreamEdgeDate, cps, cfus); - } - - return new BondStream (lsCouponPeriod, iFinalMaturityDate, strMaturityType); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct the BondStream instance from the list of coupon periods - * - * @param lsCouponPeriod List of Coupon Period - * @param iFinalMaturityDate Final Maturity Date - * @param strMaturityType Maturity Type - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public BondStream ( - final java.util.List lsCouponPeriod, - final int iFinalMaturityDate, - final java.lang.String strMaturityType) - throws java.lang.Exception - { - super (lsCouponPeriod); - - _strMaturityType = strMaturityType; - _iFinalMaturityDate = iFinalMaturityDate; - } - - /** - * Return the first Coupon period - * - * @return The first Coupon period - */ - - public org.drip.analytics.cashflow.CompositePeriod firstPeriod() - { - return periods().get (0); - } - - /** - * Returns the final Coupon period - * - * @return The final Coupon period - */ - - public org.drip.analytics.cashflow.CompositePeriod lastPeriod() - { - java.util.List lsCouponPeriod = periods(); - - return lsCouponPeriod.get (lsCouponPeriod.size() - 1); - } - - /** - * Return the period index containing the specified date - * - * @param iDate Date input - * - * @return Period index containing the date - * - * @throws java.lang.Exception Thrown if the input date not in the period set range - */ - - public int periodIndex ( - final int iDate) - throws java.lang.Exception - { - int i = 0; - - for (org.drip.analytics.cashflow.CompositePeriod period : periods()) { - if (period.contains (iDate)) return i; - - ++i; - } - - throw new java.lang.Exception ("BondStream::periodIndex => Input date not in the period set range!"); - } - - /** - * Retrieve the period corresponding to the given index - * - * @param iIndex Period index - * - * @return Period object corresponding to the input index - */ - - public org.drip.analytics.cashflow.CompositePeriod period ( - final int iIndex) - { - try { - return periods().get (iIndex); - } catch (java.lang.Exception e) { - } - - return null; - } - - /** - * Retrieve the Maturity Type - * - * @return The Maturity Type - */ - - public java.lang.String maturityType() - { - return _strMaturityType; - } - - /** - * Retrieve the Final Maturity Date - * - * @return The Final Maturity Date - */ - - public int finalMaturityDate() - { - return _iFinalMaturityDate; - } -} diff --git a/org/drip/product/params/CDXIdentifier.java b/org/drip/product/params/CDXIdentifier.java deleted file mode 100644 index 88af059..0000000 --- a/org/drip/product/params/CDXIdentifier.java +++ /dev/null @@ -1,132 +0,0 @@ - -package org.drip.product.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * CDXIdentifier implements the creation and the static details of the all the NA, EU, SovX, EMEA, and ASIA - * standardized CDS indexes. It contains the index, the tenor, the series, and the version of a given CDX. - * It exports serialization into and de-serialization out of byte arrays. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXIdentifier { - public int _iSeries = 0; - public int _iVersion = 0; - public java.lang.String _strIndex = ""; - public java.lang.String _strTenor = ""; - - /** - * Create the CDX Identifier from the CDX Code - * - * @param strCode The CDX Code - * - * @return CDXIdentifier output - */ - - public static final CDXIdentifier CreateCDXIdentifierFromCode ( - final java.lang.String strCode) - { - if (null == strCode || strCode.isEmpty()) return null; - - java.lang.String[] astrFields = strCode.split ("."); - - if (null == astrFields || 4 > astrFields.length) return null; - - try { - return new CDXIdentifier (new java.lang.Integer (astrFields[astrFields.length - 2]), new - java.lang.Integer (astrFields[astrFields.length - 1]), astrFields[astrFields.length - 3], - astrFields[astrFields.length - 4]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create the CDX identifier from the CDX index, series, tenor, and the version - * - * @param iSeries CDX Series - * @param iVersion CDX Version - * @param strIndex CDX Index - * @param strTenor CDX Tenor - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public CDXIdentifier ( - final int iSeries, - final int iVersion, - final java.lang.String strIndex, - final java.lang.String strTenor) - throws java.lang.Exception - { - if (null == (_strIndex = strIndex) || _strIndex.isEmpty() || null == (_strTenor = strTenor) || - _strTenor.isEmpty()) - throw new java.lang.Exception ("CDXIdentifier ctr => Invalid Inputs"); - - _iSeries = iSeries; - _iVersion = iVersion; - } - - /** - * Return the CDX code string composed off of the index, tenor, series, and the version - * - * @return The CDX Code string - */ - - public java.lang.String getCode() - { - return _strIndex + "." + _strTenor + "." + _iSeries + "." + _iVersion; - } -} diff --git a/org/drip/product/params/CDXRefDataParams.java b/org/drip/product/params/CDXRefDataParams.java deleted file mode 100644 index 2dbdca7..0000000 --- a/org/drip/product/params/CDXRefDataParams.java +++ /dev/null @@ -1,994 +0,0 @@ - -package org.drip.product.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * CDXRefDataParams contains the complete set of reference data that corresponds to the contract of a - * standard CDX. It consists of the following category and fields: - * - Descriptive - Index Label, Index Name, Curve Name, Index Class, Index Group Name, Index Short Group - * Name, Index Short Name, Short Name - * - Issuer ID - Curve ID, Red ID, Series, Version, Curvy Curve ID, Location, Bloomberg Ticker - * - Quote Details - Quote As CDS - * - Date - Issue Date, Maturity Date - * - Coupon Parameters - Coupon Rate, Currency, Day Count, Full First Stub, Frequency - * - Component Details - Original Count, Defaulted Count - * - Payoff Details - Knock-out on Default, Pay Accrued Amount, Recovery on Default - * - Other - Index Life Span, Index Factor - * - * It also exports serialization into and de-serialization out of byte arrays. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXRefDataParams { - - /** - * Index Curve ID - */ - - public java.lang.String _strCurveID = ""; - - /** - * Index Curve SPN - */ - - public java.lang.String _strSPN = ""; - - /** - * Index Label - */ - - public java.lang.String _strIndexLabel = ""; - - /** - * Index Name - */ - - public java.lang.String _strIndexName = ""; - - /** - * Index Curve Name - */ - - public java.lang.String _strCurveName = ""; - - /** - * Index Issue Date - */ - - public org.drip.analytics.date.JulianDate _dtIssue = null; - - /** - * Index Maturity Date - */ - - public org.drip.analytics.date.JulianDate _dtMaturity = null; - - /** - * Index Coupon (bp) - */ - - public double _dblCoupon = java.lang.Double.NaN; - - /** - * Index Currency - */ - - public java.lang.String _strCurrency = ""; - - /** - * Index DayCount - */ - - public java.lang.String _strDayCount = ""; - - /** - * Index Full First Stub - */ - - public boolean _bFullFirstStub = false; - - /** - * Index Recovery - */ - - public double _dblRecovery = java.lang.Double.NaN; - - /** - * Index Frequency - */ - - public int _iFrequency = 0; - - /** - * Index Red ID - */ - - public java.lang.String _strRedID = ""; - - /** - * Index Class - */ - - public java.lang.String _strIndexClass = ""; - - /** - * Index Series - */ - - public int _iIndexSeries = 0; - - /** - * Index Group Name - */ - - public java.lang.String _strIndexGroupName = ""; - - /** - * Index Short Name - */ - - public java.lang.String _strIndexShortName = ""; - - /** - * Index Short Group Name - */ - - public java.lang.String _strIndexShortGroupName = ""; - - /** - * Index Version - */ - - public int _iIndexVersion = 0; - - /** - * Index Life Span - */ - - public int _iIndexLifeSpan = 0; - - /** - * Index Curvy Curve ID - */ - - public java.lang.String _strCurvyCurveID = ""; - - /** - * Index Factor - */ - - public double _dblIndexFactor = java.lang.Double.NaN; - - /** - * Index Original Component Count - */ - - public int _iOriginalComponentCount = 0; - - /** - * Index Defaulted Component Count - */ - - public int _iDefaultedComponentCount = 0; - - /** - * Index Location - */ - - public java.lang.String _strLocation = ""; - - /** - * Index Pay Accrued - */ - - public boolean _bPayAccrued = false; - - /** - * Index Knock-out On Default - */ - - public boolean _bKnockOutOnDefault = false; - - /** - * Index Quote As CDS - */ - - public boolean _bQuoteAsCDS = false; - - /** - * Index Bloomberg Ticker - */ - - public java.lang.String _strBBGTicker = ""; - - /** - * Index Short Name - */ - - public java.lang.String _strShortName = ""; - - /** - * Create a CDXRefData instance from valid individual parameters (so no additional validation is - * performed). - * - * @param strCurveID Index Curve ID - * @param strSPN Index SPN - * @param strIndexLabel Index Label - * @param strIndexName Index Name - * @param strCurveName Index Curve Name - * @param iIssueDate Index Issue Date - * @param iMaturityDate Index Maturity Date - * @param dblCoupon Index Coupon - * @param strCurrency Index Currency - * @param strDayCount Index Day Count Convention - * @param bFullFirstStub Index Flag indicating whether it is a full front stub - * @param dblRecovery Index Recovery Rate - * @param iFrequency Index Frequency - * @param strRedID Index Reference Entity Database ID - * @param strIndexClass Index Class - * @param iIndexSeries Index Series - * @param strIndexGroupName Index Group Name - * @param strIndexShortName Index Short Name - * @param strIndexShortGroupName Index SHort Group Name - * @param iIndexVersion Index Version - * @param iIndexLifeSpan Index Life Span - * @param strCurvyCurveID Full Index Curve ID - * @param dblIndexFactor Index Factor - * @param iOriginalComponentCount Original Index Component Count - * @param iDefaultedComponentCount Defaulted Component Count in the Index - * @param strLocation Index Domicile Location - * @param bPayAccrued Does Index Pay Accrued - * @param bKnockOutOnDefault Does the Index Knock Out On Default - * @param bQuoteAsCDS Is the Index Quoted as a CDS (i.e., spread/up-front) - * @param strBBGTicker Index Bloomberg Ticker - * @param strShortName Index Short Name - * - * @return The CDXRefData instance - */ - - public static final CDXRefDataParams CreateCDXRefDataBuilder ( - final java.lang.String strCurveID, - final java.lang.String strSPN, - final java.lang.String strIndexLabel, - final java.lang.String strIndexName, - final java.lang.String strCurveName, - final int iIssueDate, - final int iMaturityDate, - final double dblCoupon, - final java.lang.String strCurrency, - final java.lang.String strDayCount, - final boolean bFullFirstStub, - final double dblRecovery, - final int iFrequency, - final java.lang.String strRedID, - final java.lang.String strIndexClass, - final int iIndexSeries, - final java.lang.String strIndexGroupName, - final java.lang.String strIndexShortName, - final java.lang.String strIndexShortGroupName, - final int iIndexVersion, - final int iIndexLifeSpan, - final java.lang.String strCurvyCurveID, - final double dblIndexFactor, - final int iOriginalComponentCount, - final int iDefaultedComponentCount, - final java.lang.String strLocation, - final boolean bPayAccrued, - final boolean bKnockOutOnDefault, - final boolean bQuoteAsCDS, - final java.lang.String strBBGTicker, - final java.lang.String strShortName) - { - CDXRefDataParams cdxrd = new CDXRefDataParams(); - - cdxrd.setCurveID (strCurveID); - - cdxrd.setSPN (strSPN); - - cdxrd.setIndexLabel (strIndexLabel); - - cdxrd.setIndexName (strIndexName); - - cdxrd.setCurveName (strCurveName); - - cdxrd.setIssueDate (new org.drip.analytics.date.JulianDate (iIssueDate)); - - cdxrd.setMaturityDate (new org.drip.analytics.date.JulianDate (iMaturityDate)); - - cdxrd.setCoupon (dblCoupon); - - cdxrd.setCurrency (strCurrency); - - cdxrd.setDayCount (strDayCount); - - cdxrd.setFullFirstStub (bFullFirstStub); - - cdxrd.setRecovery (dblRecovery); - - cdxrd.setFrequency (iFrequency); - - cdxrd.setRedID (strRedID); - - cdxrd.setIndexClass (strIndexClass); - - cdxrd.setIndexSeries (iIndexSeries); - - cdxrd.setIndexGroupName (strIndexGroupName); - - cdxrd.setIndexShortName (strIndexShortName); - - cdxrd.setIndexShortGroupName (strIndexShortGroupName); - - cdxrd.setIndexVersion (iIndexVersion); - - cdxrd.setIndexLifeSpan (iIndexLifeSpan); - - cdxrd.setCurvyCurveID (strCurvyCurveID); - - cdxrd.setIndexFactor (dblIndexFactor); - - cdxrd.setOriginalComponentCount (iOriginalComponentCount); - - cdxrd.setDefaultedComponentCount (iDefaultedComponentCount); - - cdxrd.setLocation (strLocation); - - cdxrd.setPayAccrued (bPayAccrued); - - cdxrd.setKnockOutOnDefault (bKnockOutOnDefault); - - cdxrd.setQuoteAsCDS (bQuoteAsCDS); - - cdxrd.setBBGTicker (strBBGTicker); - - cdxrd.setShortName (strShortName); - - if (!cdxrd.validate()) return null; - - return cdxrd; - } - - /** - * Empty Default constructor - */ - - public CDXRefDataParams() - { - } - - /** - * Set the Index Curve ID - * - * @param strCurveID Index Curve ID - * - * @return TRUE if successful - */ - - public boolean setCurveID ( - final java.lang.String strCurveID) - { - if (null == (_strCurveID = strCurveID) || _strCurveID.isEmpty()) return false; - - return true; - } - - /** - * Set the Index SPN - * - * @param strSPN Index SPN - * - * @return TRUE if successful - */ - - public boolean setSPN ( - final java.lang.String strSPN) - { - if (null == (_strSPN = strSPN) || _strSPN.isEmpty()) return false; - - return true; - } - - /** - * Set the Index Label - * - * @param strIndexLabel Index Label - * - * @return TRUE if successful - */ - - public boolean setIndexLabel ( - final java.lang.String strIndexLabel) - { - if (null == (_strIndexLabel = strIndexLabel) || _strIndexLabel.isEmpty()) return false; - - return true; - } - - /** - * Set the Index Name - * - * @param strIndexName Index Name - * - * @return TRUE if successful - */ - - public boolean setIndexName ( - final java.lang.String strIndexName) - { - if (null == (_strIndexName = strIndexName) || _strIndexName.isEmpty()) return false; - - return true; - } - - /** - * Set the Index Curve Name - * - * @param strCurveName Index Curve Name - * - * @return TRUE if successful - */ - - public boolean setCurveName ( - final java.lang.String strCurveName) - { - if (null == (_strCurveName = strCurveName) || _strCurveName.isEmpty()) return false; - - return true; - } - - /** - * Set the Index Issue Date - * - * @param dtIssue Index Issue Date - * - * @return TRUE if successful - */ - - public boolean setIssueDate ( - final org.drip.analytics.date.JulianDate dtIssue) - { - if (null == (_dtIssue = dtIssue)) return false; - - return true; - } - - /** - * Set the Index Maturity Date - * - * @param dtMaturity Index Maturity Date - * - * @return TRUE if successful - */ - - public boolean setMaturityDate ( - final org.drip.analytics.date.JulianDate dtMaturity) - { - if (null == (_dtMaturity = dtMaturity)) return false; - - return true; - } - - /** - * Set the Index Coupon - * - * @param dblCoupon Index Coupon - * - * @return TRUE if successful - */ - - public boolean setCoupon ( - final double dblCoupon) - { - return org.drip.quant.common.NumberUtil.IsValid (_dblCoupon = dblCoupon); - } - - /** - * Set the Index Currency - * - * @param strCurrency Index Currency - * - * @return TRUE if successful - */ - - public boolean setCurrency ( - final java.lang.String strCurrency) - { - if (null == (_strCurrency = strCurrency) || _strCurrency.isEmpty()) return false; - - return true; - } - - /** - * Set the Index Day Count - * - * @param strDayCount Index Day Count - * - * @return TRUE if successful - */ - - public boolean setDayCount ( - final java.lang.String strDayCount) - { - if (null == (_strDayCount = strDayCount) || _strDayCount.isEmpty()) return false; - - return true; - } - - /** - * Set the flag indicating whether the Index has a Full First Stub - * - * @param bFullFirstStub Flag indicating whether the Index has a Full First Stub - * - * @return TRUE if successful - */ - - public boolean setFullFirstStub ( - final boolean bFullFirstStub) - { - _bFullFirstStub = bFullFirstStub; - return true; - } - - /** - * Set the Index Recovery - * - * @param dblRecovery Index Recovery - * - * @return TRUE if successful - */ - - public boolean setRecovery ( - final double dblRecovery) - { - return org.drip.quant.common.NumberUtil.IsValid (_dblRecovery = dblRecovery); - } - - /** - * Set the Index Coupon Frequency - * - * @param iFrequency Index Coupon Frequency - * - * @return TRUE if successful - */ - - public boolean setFrequency ( - final int iFrequency) - { - _iFrequency = iFrequency; - return true; - } - - /** - * Set the Index Red ID - * - * @param strRedID Index Red ID - * - * @return TRUE if successful - */ - - public boolean setRedID ( - final java.lang.String strRedID) - { - if (null == (_strRedID = strRedID) || _strRedID.isEmpty()) return false; - - return true; - } - - /** - * Set the Index Class - * - * @param strIndexClass Index Class - * - * @return TRUE if successful - */ - - public boolean setIndexClass ( - final java.lang.String strIndexClass) - { - if (null == (_strIndexClass = strIndexClass) || _strIndexClass.isEmpty()) return false; - - return true; - } - - /** - * Set the Index Series - * - * @param iIndexSeries Index Series - * - * @return TRUE if successful - */ - - public boolean setIndexSeries ( - final int iIndexSeries) - { - _iIndexSeries = iIndexSeries; - return true; - } - - /** - * Set the Index Group Name - * - * @param strIndexGroupName Index Group Name - * - * @return TRUE if successful - */ - - public boolean setIndexGroupName ( - final java.lang.String strIndexGroupName) - { - if (null == (_strIndexGroupName = strIndexGroupName) || _strIndexGroupName.isEmpty()) return false; - - return true; - } - - /** - * Set the Index Short Name - * - * @param strIndexShortName Index Short Name - * - * @return TRUE if successful - */ - - public boolean setIndexShortName ( - final java.lang.String strIndexShortName) - { - if (null == (_strIndexShortName = strIndexShortName) || _strIndexShortName.isEmpty()) return false; - - return true; - } - - /** - * Set the Index Short Group Name - * - * @param strIndexShortGroupName Index Short Group Name - * - * @return TRUE if successful - */ - - public boolean setIndexShortGroupName ( - final java.lang.String strIndexShortGroupName) - { - if (null == (_strIndexShortGroupName = strIndexShortGroupName) || _strIndexShortGroupName.isEmpty()) - return false; - - return true; - } - - /** - * Set the Index Version - * - * @param iIndexVersion Index Version - * - * @return TRUE if successful - */ - - public boolean setIndexVersion ( - final int iIndexVersion) - { - _iIndexVersion = iIndexVersion; - return true; - } - - /** - * Set the Index Life Span - * - * @param iIndexLifeSpan Index Life Span - * - * @return TRUE if successful - */ - - public boolean setIndexLifeSpan ( - final int iIndexLifeSpan) - { - _iIndexLifeSpan = iIndexLifeSpan; - return true; - } - - /** - * Set the Index Composite Curve ID - * - * @param strCurvyCurveID Index Composite Curve ID - * - * @return TRUE if successful - */ - - public boolean setCurvyCurveID ( - final java.lang.String strCurvyCurveID) - { - if (null == (_strCurvyCurveID = strCurvyCurveID) || _strCurvyCurveID.isEmpty()) return false; - - return true; - } - - /** - * Set the Index Factor - * - * @param dblIndexFactor Index Factor - * - * @return TRUE if successful - */ - - public boolean setIndexFactor ( - final double dblIndexFactor) - { - return org.drip.quant.common.NumberUtil.IsValid (_dblIndexFactor = dblIndexFactor); - } - - /** - * Set the Number of Original Components in the Index - * - * @param iOriginalComponentCount Number of Original Components in the Index - * - * @return TRUE if successful - */ - - public boolean setOriginalComponentCount ( - final int iOriginalComponentCount) - { - _iOriginalComponentCount = iOriginalComponentCount; - return true; - } - - /** - * Set the Number of Defaulted Components in the Index - * - * @param iDefaultedComponentCount Number of Defaulted Components in the Index - * - * @return TRUE if successful - */ - - public boolean setDefaultedComponentCount ( - final int iDefaultedComponentCount) - { - _iDefaultedComponentCount = iDefaultedComponentCount; - return true; - } - - /** - * Set the Index Location - * - * @param strLocation Index Location - * - * @return TRUE if successful - */ - - public boolean setLocation ( - final java.lang.String strLocation) - { - if (null == (_strLocation = strLocation) || _strLocation.isEmpty()) return false; - - return true; - } - - /** - * Set if the Index pays accrued on termination - * - * @param bPayAccrued Flag indicating if the Index pays accrued on termination - * - * @return TRUE if successful - */ - - public boolean setPayAccrued ( - final boolean bPayAccrued) - { - _bPayAccrued = bPayAccrued; - return true; - } - - /** - * Set if the Index knocks out on Default - * - * @param bKnockOutOnDefault Flag indicating if the Index knocks out on Default - * - * @return TRUE if successful - */ - - public boolean setKnockOutOnDefault ( - final boolean bKnockOutOnDefault) - { - _bKnockOutOnDefault = bKnockOutOnDefault; - return true; - } - - /** - * Set whether the quote is marked as a CDS - * - * @param bQuoteAsCDS Flag indicating whether the quote is marked as a CDS - * - * @return TRUE if successful - */ - - public boolean setQuoteAsCDS ( - final boolean bQuoteAsCDS) - { - _bQuoteAsCDS = bQuoteAsCDS; - return true; - } - - /** - * Set the Index BBG Ticker - * - * @param strBBGTicker Index BBG Ticker - * - * @return TRUE if successful - */ - - public boolean setBBGTicker ( - final java.lang.String strBBGTicker) - { - if (null == (_strBBGTicker = strBBGTicker) || strBBGTicker.isEmpty()) return false; - - return true; - } - - /** - * Set the index short name - * - * @param strShortName Index Short Name - * - * @return TRUE if successful - */ - - public boolean setShortName ( - final java.lang.String strShortName) - { - if (null == (_strShortName = strShortName) || _strShortName.isEmpty()) return false; - - return true; - } - - /** - * Validate the CDXRefData instance - * - * @return TRUE if successful - */ - - public boolean validate() - { - if (null == _strCurveID || _strCurveID.isEmpty() || null == _strSPN || _strSPN.isEmpty() || null == - _strIndexLabel || _strIndexLabel.isEmpty() || null == _strIndexName || _strIndexName.isEmpty() || - null == _strCurveName || _strCurveName.isEmpty() || null == _dtIssue || null == _dtMaturity - || _dtIssue.julian() >= _dtMaturity.julian() || !org.drip.quant.common.NumberUtil.IsValid - (_dblCoupon) || null == _strCurrency || _strCurrency.isEmpty() || null == - _strDayCount || _strDayCount.isEmpty() || - !org.drip.quant.common.NumberUtil.IsValid (_dblRecovery) || null == _strRedID - || _strRedID.isEmpty() || null == _strIndexClass || - _strIndexClass.isEmpty() || null == _strIndexGroupName || - _strIndexGroupName.isEmpty()) - return false; - - return true; - } - - /** - * Return the stringified set of parameters in a java call that can be statically used to re-construct - * the index. - * - * @return Set of Stringified parameters as a java call. - */ - - public java.lang.String setConstructionString() - { - java.lang.StringBuffer sb = new java.lang.StringBuffer(); - - java.lang.String strCDXCode = _strIndexClass + "." + _strIndexGroupName + "." + _iIndexLifeSpan + - "Y." + _iIndexSeries + "." + _iIndexVersion; - - sb.append ("\t\tUpdateCDXRefDataMap (" + org.drip.quant.common.StringUtil.MakeStringArg (strCDXCode) + - ",\n\t\t\torg.drip.product.creator.CDXRefDataBuilder.CreateCDXRefDataBuilder ("); - - sb.append (org.drip.quant.common.StringUtil.MakeStringArg (_strCurveID) + ", "); - - sb.append (org.drip.quant.common.StringUtil.MakeStringArg (_strSPN) + ",\n\t\t\t\t"); - - sb.append (org.drip.quant.common.StringUtil.MakeStringArg (_strIndexLabel) + ", "); - - sb.append (org.drip.quant.common.StringUtil.MakeStringArg (_strIndexName) + ",\n\t\t\t\t\t"); - - sb.append (org.drip.quant.common.StringUtil.MakeStringArg (_strCurveName) + ", "); - - sb.append (_dtIssue.julian() + ", "); - - sb.append (_dtMaturity.julian() + ", "); - - sb.append (_dblCoupon + ", "); - - sb.append (org.drip.quant.common.StringUtil.MakeStringArg (_strCurrency) + ",\n\t\t\t\t\t\t"); - - sb.append (org.drip.quant.common.StringUtil.MakeStringArg (_strDayCount) + ", "); - - sb.append (_bFullFirstStub + ", "); - - sb.append (_dblRecovery + ", "); - - sb.append (_iFrequency + ", "); - - sb.append (org.drip.quant.common.StringUtil.MakeStringArg (_strRedID) + ", "); - - sb.append (org.drip.quant.common.StringUtil.MakeStringArg (_strIndexClass) + ", "); - - sb.append (_iIndexSeries + ", "); - - sb.append (org.drip.quant.common.StringUtil.MakeStringArg (_strIndexGroupName) + ", "); - - sb.append (org.drip.quant.common.StringUtil.MakeStringArg (_strIndexShortName) + ", "); - - sb.append (org.drip.quant.common.StringUtil.MakeStringArg (_strIndexShortGroupName) + ", "); - - sb.append (_iIndexVersion + ", "); - - sb.append (_iIndexLifeSpan + ",\n\t\t\t\t\t\t\t"); - - sb.append (org.drip.quant.common.StringUtil.MakeStringArg (_strCurvyCurveID) + ", "); - - sb.append (_dblIndexFactor + ", "); - - sb.append (_iOriginalComponentCount + ", "); - - sb.append (_iDefaultedComponentCount + ", "); - - sb.append (org.drip.quant.common.StringUtil.MakeStringArg (_strLocation) + ", "); - - sb.append (_bPayAccrued + ", "); - - sb.append (_bKnockOutOnDefault + ", "); - - sb.append (_bQuoteAsCDS + ", "); - - sb.append (org.drip.quant.common.StringUtil.MakeStringArg (_strBBGTicker) + ", "); - - sb.append (org.drip.quant.common.StringUtil.MakeStringArg (_strShortName) + "));\n\n"); - - return sb.toString(); - } -} diff --git a/org/drip/product/params/CTDEntry.java b/org/drip/product/params/CTDEntry.java deleted file mode 100644 index 5f3be4e..0000000 --- a/org/drip/product/params/CTDEntry.java +++ /dev/null @@ -1,117 +0,0 @@ - -package org.drip.product.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CTDEntry implements the Bond Futures CTD Entry Details. - * - * @author Lakshmi Krishnamurthy - */ - -public class CTDEntry { - private org.drip.product.definition.Bond _bond = null; - private double _dblForwardPrice = java.lang.Double.NaN; - private double _dblConversionFactor = java.lang.Double.NaN; - - /** - * CTDEntry Constructor - * - * @param bond The Futures CTD Bond - * @param dblConversionFactor The CTD Conversion Factor - * @param dblForwardPrice The CTD Forward Price - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CTDEntry ( - final org.drip.product.definition.Bond bond, - final double dblConversionFactor, - final double dblForwardPrice) - throws java.lang.Exception - { - if (null == (_bond = bond) || !org.drip.quant.common.NumberUtil.IsValid (_dblConversionFactor = - dblConversionFactor) || !org.drip.quant.common.NumberUtil.IsValid (_dblForwardPrice = - dblForwardPrice)) - throw new java.lang.Exception ("CTDEntry Constructor => Invalid Inputs"); - } - - /** - * - * Retrieve the CTD Bond Instance - * - * @return The CTD Bond Instance - */ - - public org.drip.product.definition.Bond bond() - { - return _bond; - } - - /** - * Retrieve the CTD Conversion Factor - * - * @return The CTD Conversion Factor - */ - - public double conversionFactor() - { - return _dblConversionFactor; - } - - /** - * Retrieve the CTD Forward Price - * - * @return The CTD Forward Price - */ - - public double forwardPrice() - { - return _dblForwardPrice; - } -} diff --git a/org/drip/product/params/CouponSetting.java b/org/drip/product/params/CouponSetting.java deleted file mode 100644 index cd5ea30..0000000 --- a/org/drip/product/params/CouponSetting.java +++ /dev/null @@ -1,198 +0,0 @@ - -package org.drip.product.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * CouponSetting contains the coupon type, schedule, and the coupon amount for the component. If available - * floor and/or ceiling may also be applied to the coupon, in a pre-determined order of precedence. It - * exports serialization into and de-serialization out of byte arrays. - * - * @author Lakshmi Krishnamurthy - */ - -public class CouponSetting implements org.drip.product.params.Validatable { - private java.lang.String _strCouponType = ""; - private double _dblCouponRate = java.lang.Double.NaN; - private org.drip.quant.common.Array2D _fs = null; - private double _dblCouponFloorRate = java.lang.Double.NaN; - private double _dblCouponCeilingRate = java.lang.Double.NaN; - - /** - * Construct the CouponSetting from the coupon schedule, coupon type, and the coupon amount - * - * @param fs Coupon schedule - * @param strCouponType Coupon Type - * @param dblCouponRate Coupon Rate - * @param dblCouponCeilingRate Coupon Ceiling Rate - * @param dblCouponFloorRate Coupon Floor Rate - */ - - public CouponSetting ( - final org.drip.quant.common.Array2D fs, - final java.lang.String strCouponType, - final double dblCouponRate, - final double dblCouponCeilingRate, - final double dblCouponFloorRate) - { - _fs = fs; - _dblCouponRate = dblCouponRate; - _strCouponType = strCouponType; - _dblCouponFloorRate = dblCouponFloorRate; - _dblCouponCeilingRate = dblCouponCeilingRate; - } - - /** - * Trim the component coupon if it falls outside the (optionally) specified coupon window. Note that - * trimming the coupon ceiling takes precedence over hiking the coupon floor. - * - * @param dblCouponRate Input Coupon Rate - * @param dblDate Input Date representing the period that the coupon belongs to - * - * @return The "trimmed" coupon Rate - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public double processCouponWindow ( - final double dblCouponRate, - final double dblDate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCouponRate) || - !org.drip.quant.common.NumberUtil.IsValid (dblDate)) - throw new java.lang.Exception ("CouponSetting::processCouponWindow => Invalid Inputs"); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblCouponCeilingRate) && - !org.drip.quant.common.NumberUtil.IsValid (_dblCouponFloorRate)) - return dblCouponRate; - - if (!!org.drip.quant.common.NumberUtil.IsValid (_dblCouponCeilingRate) && dblCouponRate > - _dblCouponCeilingRate) - return _dblCouponCeilingRate; - - if (!!org.drip.quant.common.NumberUtil.IsValid (_dblCouponFloorRate) && dblCouponRate < - _dblCouponFloorRate) - return _dblCouponFloorRate; - - return dblCouponRate; - } - - @Override public boolean validate() - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblCouponRate)) return false; - - if (null == _fs) _fs = org.drip.quant.common.Array2D.BulletSchedule(); - - if (org.drip.quant.common.NumberUtil.IsValid (_dblCouponCeilingRate) && - org.drip.quant.common.NumberUtil.IsValid (_dblCouponFloorRate) && _dblCouponCeilingRate < - _dblCouponFloorRate) - return false; - - return true; - } - - /** - * Retrieve the Factor Schedule - * - * @return The Factor Schedule - */ - - public org.drip.quant.common.Array2D factorSchedule() - { - return _fs; - } - - /** - * Retrieve the Coupon Type - * - * @return The Coupon Type - */ - - public java.lang.String couponType() - { - return _strCouponType; - } - - /** - * Retrieve the Coupon Rate - * - * @return The Coupon Rate - */ - - public double couponRate() - { - return _dblCouponRate; - } - - /** - * Retrieve the Coupon Ceiling Rate - * - * @return The Coupon Ceiling Rate - */ - - public double couponCeilingRate() - { - return _dblCouponCeilingRate; - } - - /** - * Retrieve the Coupon Floor Rate - * - * @return The Coupon Floor Rate - */ - - public double couponFloorRate() - { - return _dblCouponFloorRate; - } -} diff --git a/org/drip/product/params/CreditSetting.java b/org/drip/product/params/CreditSetting.java deleted file mode 100644 index 0d7c7c7..0000000 --- a/org/drip/product/params/CreditSetting.java +++ /dev/null @@ -1,158 +0,0 @@ - -package org.drip.product.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * CreditSetting contains the credit related valuation parameters - use default pay lag, use curve or the - * component recovery, component recovery, credit curve name, and whether there is accrual on default. It - * exports serialization into and de-serialization out of byte arrays. - * - * @author Lakshmi Krishnamurthy - */ - -public class CreditSetting implements org.drip.product.params.Validatable { - private int _iLossPayLag = -1; - private boolean _bUseCurveRecovery = true; - private boolean _bAccrualOnDefault = false; - private java.lang.String _strCreditCurveName = ""; - private double _dblRecovery = java.lang.Double.NaN; - - /** - * Construct the CreditSetting from the default pay lag, use curve or the component recovery flag, - * component recovery, credit curve name, and whether there is accrual on default - * - * @param iLossPayLag Loss Pay Lag - * @param dblRecovery Component Recovery - * @param bUseCurveRecovery Use the Curve Recovery (True) or Component Recovery (False) - * @param strCreditCurveName Credit curve name - * @param bAccrualOnDefault Accrual paid on default (True) - */ - - public CreditSetting ( - final int iLossPayLag, - final double dblRecovery, - final boolean bUseCurveRecovery, - final java.lang.String strCreditCurveName, - final boolean bAccrualOnDefault) - { - _iLossPayLag = iLossPayLag; - _dblRecovery = dblRecovery; - _bAccrualOnDefault = bAccrualOnDefault; - _bUseCurveRecovery = bUseCurveRecovery; - _strCreditCurveName = strCreditCurveName; - } - - @Override public boolean validate() - { - if (null == _strCreditCurveName || _strCreditCurveName.isEmpty()) return true; - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblRecovery) && !_bUseCurveRecovery) return false; - - return true; - } - - /** - * Retrieve the Loss Pay-out Lag - * - * @return The Loss Pay-out Lag - */ - - public int lossPayLag() - { - return _iLossPayLag; - } - - /** - * Flag indicating whether or nor to use the Curve Recovery - * - * @return TRUE - Use the Recovery From the Credit Curve - */ - - public boolean useCurveRecovery() - { - return _bUseCurveRecovery; - } - - /** - * Retrieve the Credit Curve Name - * - * @return The Credit Curve Name - */ - - public java.lang.String creditCurveName() - { - return _strCreditCurveName; - } - - /** - * Retrieve the Accrual On Default Flag - * - * @return TRUE - Accrual On Default - */ - - public boolean accrualOnDefault() - { - return _bAccrualOnDefault; - } - - /** - * Retrieve the Recovery Amount - * - * @return The Recovery Amount - */ - - public double recovery() - { - return _dblRecovery; - } -} diff --git a/org/drip/product/params/CurrencyPair.java b/org/drip/product/params/CurrencyPair.java deleted file mode 100644 index b85315a..0000000 --- a/org/drip/product/params/CurrencyPair.java +++ /dev/null @@ -1,197 +0,0 @@ - -package org.drip.product.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * CurrencyPair class contains the numerator currency, the denominator currency, the quote currency, and the - * PIP Factor. It exports serialization into and de-serialization out of byte arrays. - * - * @author Lakshmi Krishnamurthy - */ - -public class CurrencyPair { - private java.lang.String _strNumCcy = ""; - private java.lang.String _strDenomCcy = ""; - private java.lang.String _strQuoteCcy = ""; - private double _dblPIPFactor = java.lang.Double.NaN; - - /** - * Construct the Currency Pair from the Code - * - * @param strCode Currency Pair Code - * - * @return The Currency Pair - */ - - public static final CurrencyPair FromCode ( - final java.lang.String strCode) - { - if (null == strCode || strCode.isEmpty()) return null; - - java.lang.String[] astrCcy = strCode.split ("/"); - - if (null == astrCcy || 2 != astrCcy.length || null == astrCcy[0] || astrCcy[0].isEmpty() || null == - astrCcy[1] || astrCcy[1].isEmpty()) - return null; - - try { - return new CurrencyPair (astrCcy[0], astrCcy[1], astrCcy[0], 1.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct the currency pair from the numerator currency, the denominator currency, the quote - * currency, and the PIP Factor - * - * @param strNumCcy Numerator currency - * @param strDenomCcy Denominator currency - * @param strQuoteCcy Quote Currency - * @param dblPIPFactor PIP Factor - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public CurrencyPair ( - final java.lang.String strNumCcy, - final java.lang.String strDenomCcy, - final java.lang.String strQuoteCcy, - final double dblPIPFactor) - throws java.lang.Exception - { - if (null == strNumCcy || strNumCcy.isEmpty() || null == strDenomCcy || strDenomCcy.isEmpty() || null - == strQuoteCcy || strNumCcy.equalsIgnoreCase (strDenomCcy) || (!strQuoteCcy.equalsIgnoreCase - (strNumCcy) && !strQuoteCcy.equalsIgnoreCase (strDenomCcy)) || - !org.drip.quant.common.NumberUtil.IsValid (dblPIPFactor)) - throw new java.lang.Exception ("CurrencyPair ctr: Invalid parameters"); - - _strNumCcy = strNumCcy; - _strDenomCcy = strDenomCcy; - _strQuoteCcy = strQuoteCcy; - _dblPIPFactor = dblPIPFactor; - } - - /** - * Get the numerator currency - * - * @return Numerator currency - */ - - public java.lang.String numCcy() - { - return _strNumCcy; - } - - /** - * Get the denominator currency - * - * @return Denominator currency - */ - - public java.lang.String denomCcy() - { - return _strDenomCcy; - } - - /** - * Get the quote currency - * - * @return Quote currency - */ - - public java.lang.String quoteCcy() - { - return _strQuoteCcy; - } - - /** - * Get the currency pair code - * - * @return Currency pair code - */ - - public java.lang.String code() - { - return _strNumCcy + "/" + _strDenomCcy; - } - - /** - * Get the inverse currency pair code - * - * @return The Inverse Currency pair code - */ - - public java.lang.String inverseCode() - { - return _strDenomCcy + "/" + _strNumCcy; - } - - /** - * Get the PIP Factor - * - * @return PIP Factor - */ - - public double pipFactor() - { - return _dblPIPFactor; - } - - @Override public java.lang.String toString() - { - return _strNumCcy + " | " + _strDenomCcy + " | " + _strQuoteCcy + " | " + _dblPIPFactor; - } -} diff --git a/org/drip/product/params/EmbeddedOptionSchedule.java b/org/drip/product/params/EmbeddedOptionSchedule.java deleted file mode 100644 index 59fe6f7..0000000 --- a/org/drip/product/params/EmbeddedOptionSchedule.java +++ /dev/null @@ -1,354 +0,0 @@ - -package org.drip.product.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * EmbeddedOptionSchedule is a place holder for the embedded option schedule for the component. It contains - * the schedule of exercise dates and factors, the exercise notice period, and the option is to call or put. - * Further, if the option is of the type fix-to-float on exercise, contains the post-exercise floater index - * and floating spread. If the exercise is not discrete (American option), the exercise dates/factors are - * discretized according to a pre-specified discretization grid. It exports serialization into and - * de-serialization out of byte arrays. - * - * @author Lakshmi Krishnamurthy - */ - -public class EmbeddedOptionSchedule { - public static final int CALL_NOTICE_PERIOD_DEFAULT = 30; - - private int _aiDate[] = null; - private boolean _bIsPut = false; - private double _adblFactor[] = null; - private java.lang.String _strFloatIndex = ""; - private boolean _bFixToFloatOnExercise = false; - private int _iNoticePeriod = CALL_NOTICE_PERIOD_DEFAULT; - private double _dblFixToFloatSpread = java.lang.Double.NaN; - private double _dblFixToFloatExerciseDate = java.lang.Double.NaN; - - /** - * Create the EOS from the dates/factors string arrays - * - * @param strDates String representing the date array - * @param strFactors String representing the factor array - * @param iNoticePeriod Exercise Notice Period - * @param bIsPut True (Put), False (Call) - * @param bIsDiscrete True (Discrete), False (Continuous) - * @param iScheduleStart Schedule start Date - * @param bFixToFloatOnExercise True - component becomes a floater on call - * @param dblFixToFloatExerciseDate Date at which the fix to float conversion happens - * @param strFloatIndex Floater Rate Index - * @param dblFixToFloatSpread Floater Spread - * - * @return EOS object - */ - - public static final EmbeddedOptionSchedule CreateFromDateFactorSet ( - final java.lang.String strDates, - final java.lang.String strFactors, - final int iNoticePeriod, - final boolean bIsPut, - final boolean bIsDiscrete, - final int iScheduleStart, - final boolean bFixToFloatOnExercise, - final double dblFixToFloatExerciseDate, - final java.lang.String strFloatIndex, - final double dblFixToFloatSpread) - { - if (null == strDates || strDates.isEmpty() || null == strFactors || strFactors.isEmpty()) - return null; - - if (bIsDiscrete) { - try { - return new EmbeddedOptionSchedule - (org.drip.quant.common.StringUtil.MakeIntegerArrayFromStringTokenizer (new - java.util.StringTokenizer (strDates, ";")), - org.drip.quant.common.StringUtil.MakeDoubleArrayFromStringTokenizer (new - java.util.StringTokenizer (strFactors, ";")), bIsPut, iNoticePeriod, - bFixToFloatOnExercise, dblFixToFloatExerciseDate, strFloatIndex, - dblFixToFloatSpread); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - return FromAmerican (iScheduleStart, - org.drip.quant.common.StringUtil.MakeIntegerArrayFromStringTokenizer (new - java.util.StringTokenizer (strDates, ";")), - org.drip.quant.common.StringUtil.MakeDoubleArrayFromStringTokenizer (new - java.util.StringTokenizer (strFactors, ";")), bIsPut, iNoticePeriod, - bFixToFloatOnExercise, dblFixToFloatExerciseDate, strFloatIndex, - dblFixToFloatSpread); - } - - /** - * Create the discretized American EOS schedule from the array of dates and factors - * - * @param iValDate Valuation Date - date to which the component is assumed to not have been exercised - * @param aiDate Array of dates - * @param adblFactor Matched Array of Factors - * @param bIsPut True (Put), False (Call) - * @param iNoticePeriod Exercise Notice Period - * @param bFixToFloatOnExercise True - component becomes a floater on call - * @param dblFixToFloatExerciseDate Date at which the fix to float conversion happens - * @param strFloatIndex Floater Rate Index - * @param dblFixToFloatSpread Floater Spread - * - * @return Discretized EOS - */ - - public static final EmbeddedOptionSchedule FromAmerican ( - final int iValDate, - final int aiDate[], - final double adblFactor[], - final boolean bIsPut, - final int iNoticePeriod, - final boolean bFixToFloatOnExercise, - final double dblFixToFloatExerciseDate, - final java.lang.String strFloatIndex, - final double dblFixToFloatSpread) - { - if (null == aiDate || aiDate.length == 0 || null == adblFactor || adblFactor.length == 0 || - aiDate.length != adblFactor.length) - return null; - - int i = 0; - int iCallDiscretization = 30; - int iScheduleStart = iValDate; - - if (iValDate < aiDate[0]) iScheduleStart = aiDate[0]; - - java.util.ArrayList liCallDates = new java.util.ArrayList(); - - java.util.ArrayList ldblCallFactors = new java.util.ArrayList(); - - for (; i < aiDate.length; ++i) { - int iCallDate = iScheduleStart; - - if (0 != i) iCallDate = aiDate[i - 1]; - - while (iCallDate <= aiDate[i]) { - liCallDates.add (iCallDate); - - ldblCallFactors.add (adblFactor[i]); - - iCallDate += iCallDiscretization; - } - } - - int[] aiEOSDate = new int[liCallDates.size()]; - - i = 0; - - for (int iCallDate : liCallDates) - aiEOSDate[i++] = iCallDate; - - double[] adblEOSFactor = new double[ldblCallFactors.size()]; - - i = 0; - - for (double dblCallFactor : ldblCallFactors) - adblEOSFactor[i++] = dblCallFactor; - - try { - return new EmbeddedOptionSchedule (aiEOSDate, adblEOSFactor, bIsPut, iNoticePeriod, - bFixToFloatOnExercise, dblFixToFloatExerciseDate, strFloatIndex, dblFixToFloatSpread); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - /** - * Construct the EOS from the array of dates and factors - * - * @param aiDate Array of dates - * @param adblFactor Matched Array of Factors - * @param bIsPut True (Put), False (Call) - * @param iNoticePeriod Exercise Notice Period - * @param bFixToFloatOnExercise True - component becomes a floater on call - * @param dblFixToFloatExerciseDate Date at which the fix to float conversion happens - * @param strFloatIndex Floater Rate Index - * @param dblFixToFloatSpread Floater Spread - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public EmbeddedOptionSchedule ( - final int[] aiDate, - final double[] adblFactor, - final boolean bIsPut, - final int iNoticePeriod, - final boolean bFixToFloatOnExercise, - final double dblFixToFloatExerciseDate, - final java.lang.String strFloatIndex, - final double dblFixToFloatSpread) - throws java.lang.Exception - { - if (null == aiDate || null == adblFactor || aiDate.length != adblFactor.length) - throw new java.lang.Exception ("EmbeddedOptionSchedule ctr => Invalid params"); - - _aiDate = new int[aiDate.length]; - _adblFactor = new double[adblFactor.length]; - - for (int i = 0; i < _aiDate.length; ++i) - _aiDate[i] = aiDate[i]; - - for (int i = 0; i < _adblFactor.length; ++i) - _adblFactor[i] = adblFactor[i]; - - _bIsPut = bIsPut; - _iNoticePeriod = iNoticePeriod; - _strFloatIndex = strFloatIndex; - _dblFixToFloatSpread = dblFixToFloatSpread; - _bFixToFloatOnExercise = bFixToFloatOnExercise; - _dblFixToFloatExerciseDate = dblFixToFloatExerciseDate; - } - - /** - * Construct a Deep Copy EOS from another EOS - * - * @param eosOther The Other EOS - */ - - public EmbeddedOptionSchedule ( - final EmbeddedOptionSchedule eosOther) - { - _aiDate = new int[eosOther._aiDate.length]; - _adblFactor = new double[eosOther._adblFactor.length]; - - for (int i = 0; i < _aiDate.length; ++i) - _aiDate[i] = eosOther._aiDate[i]; - - for (int i = 0; i < _adblFactor.length; ++i) - _adblFactor[i] = eosOther._adblFactor[i]; - - _bIsPut = eosOther._bIsPut; - _iNoticePeriod = eosOther._iNoticePeriod; - _strFloatIndex = eosOther._strFloatIndex; - _dblFixToFloatSpread = eosOther._dblFixToFloatSpread; - _bFixToFloatOnExercise = eosOther._bFixToFloatOnExercise; - _dblFixToFloatExerciseDate = eosOther._dblFixToFloatExerciseDate; - } - - /** - * Whether the component is putable or callable - * - * @return True (Put), False (Call) - */ - - public boolean isPut() - { - return _bIsPut; - } - - /** - * Get the array of dates - * - * @return The array of dates - */ - - public int[] dates() - { - return _aiDate; - } - - /** - * Get the array of factors - * - * @return The array of factors - */ - - public double[] factors() - { - return _adblFactor; - } - - /** - * Get the specific indexed factor - * - * @param iIndex Factor index - * - * @return Factor corresponding to the index - */ - - public double factor ( - final int iIndex) - { - return _adblFactor[iIndex]; - } - - /** - * Retrieve the exercise notice period - * - * @return Minimum Exercise Notice Period in Days - */ - - public int exerciseNoticePeriod() - { - return _iNoticePeriod; - } - - /** - * Return whether the component is fix to float on exercise - * - * @return True (component becomes a floater on call), False (component does not change) - */ - - public boolean isFixToFloatOnExercise() - { - return _bFixToFloatOnExercise; - } -} diff --git a/org/drip/product/params/FloaterSetting.java b/org/drip/product/params/FloaterSetting.java deleted file mode 100644 index d18da50..0000000 --- a/org/drip/product/params/FloaterSetting.java +++ /dev/null @@ -1,141 +0,0 @@ - -package org.drip.product.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * FloaterSetting contains the component's floating rate parameters. It holds the rate index, floater day - * count, and one of either the coupon spread or the full current coupon. It also provides for serialization - * into and de-serialization out of byte arrays. - * - * @author Lakshmi Krishnamurthy - */ - -public class FloaterSetting implements org.drip.product.params.Validatable { - private java.lang.String _strDayCount = ""; - private double _dblSpread = java.lang.Double.NaN; - private org.drip.state.identifier.ForwardLabel _fri = null; - private double _dblCurrentFullCoupon = java.lang.Double.NaN; - - /** - * Construct the FloaterSetting from rate index, floating day count, float spread, and current Full - * coupon - * - * @param strRateIndex Fully Qualified Floating Rate Index - * @param strDayCount Floating Day Count - * @param dblSpread Floating Spread - * @param dblCurrentFullCoupon Current Full Coupon - */ - - public FloaterSetting ( - final java.lang.String strRateIndex, - final java.lang.String strDayCount, - final double dblSpread, - final double dblCurrentFullCoupon) - { - _dblSpread = dblSpread; - _strDayCount = strDayCount; - _dblCurrentFullCoupon = dblCurrentFullCoupon; - - _fri = org.drip.state.identifier.ForwardLabel.Standard (strRateIndex); - } - - @Override public boolean validate() - { - return (org.drip.quant.common.NumberUtil.IsValid (_dblSpread) || - org.drip.quant.common.NumberUtil.IsValid (_dblCurrentFullCoupon)) && null != _fri; - } - - /** - * Retrieve the Floating Rate Index - * - * @return Tyhe Floating Rate Index - */ - - public org.drip.state.identifier.ForwardLabel fri() - { - return _fri; - } - - /** - * Retrieve the Floating Day Count - * - * @return The Floating Day Count - */ - - public java.lang.String dayCount() - { - return _strDayCount; - } - - /** - * Retrieve the Floating Spread - * - * @return The Floating Spread - */ - - public double spread() - { - return _dblSpread; - } - - /** - * Retrieve the Full Current Coupon - * - * @return The Full Current Coupon - */ - - public double currentFullCoupon() - { - return _dblCurrentFullCoupon; - } -} diff --git a/org/drip/product/params/IdentifierSet.java b/org/drip/product/params/IdentifierSet.java deleted file mode 100644 index 8d7f346..0000000 --- a/org/drip/product/params/IdentifierSet.java +++ /dev/null @@ -1,144 +0,0 @@ - -package org.drip.product.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * IdentifierSet contains the component's identifier parameters - ISIN, CUSIP, ID, and ticker. It exports - * serialization into and de-serialization out of byte arrays. - * - * @author Lakshmi Krishnamurthy - */ - -public class IdentifierSet implements org.drip.product.params.Validatable { - private java.lang.String _strID = ""; - private java.lang.String _strISIN = ""; - private java.lang.String _strCUSIP = ""; - private java.lang.String _strTicker = ""; - - /** - * Construct the IdentifierSet from ISIN, CUSIP, ID, and ticker. - * - * @param strISIN ISIN - * @param strCUSIP CUSIP - * @param strID component ID - * @param strTicker Ticker - */ - - public IdentifierSet ( - final java.lang.String strISIN, - final java.lang.String strCUSIP, - final java.lang.String strID, - final java.lang.String strTicker) - { - _strISIN = strISIN; - _strCUSIP = strCUSIP; - _strID = strID; - _strTicker = strTicker; - } - - @Override public boolean validate() - { - if ((null == _strISIN || _strISIN.isEmpty()) && (null == _strCUSIP || _strCUSIP.isEmpty())) - return false; - - if (null == _strID || _strID.isEmpty()) { - if (null == (_strID = _strISIN) || _strID.isEmpty()) _strID = _strCUSIP; - } - - return true; - } - - /** - * Retrieve the ID - * - * @return The ID - */ - - public java.lang.String id() - { - return _strID; - } - - /** - * Retrieve the ISIN - * - * @return The ISIN - */ - - public java.lang.String isin() - { - return _strISIN; - } - - /** - * Retrieve the CUSIP - * - * @return The CUSIP - */ - - public java.lang.String cusip() - { - return _strCUSIP; - } - - /** - * Retrieve the Ticker - * - * @return The Ticker - */ - - public java.lang.String ticker() - { - return _strTicker; - } -} diff --git a/org/drip/product/params/LastTradingDateSetting.java b/org/drip/product/params/LastTradingDateSetting.java deleted file mode 100644 index 4e5f79d..0000000 --- a/org/drip/product/params/LastTradingDateSetting.java +++ /dev/null @@ -1,197 +0,0 @@ - -package org.drip.product.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * LastTradingDateSeting contains the Last Trading Date Generation Scheme for the given Option. - * - * @author Lakshmi Krishnamurthy - */ - -public class LastTradingDateSetting { - - /** - * Quarterly Mid-Curve Option - */ - - public static final int MID_CURVE_OPTION_QUARTERLY = 0; - - /** - * Serial Mid-Curve Option - */ - - public static final int MID_CURVE_OPTION_SERIAL = 1; - - /** - * Generic Mid-Curve Option - */ - - public static final int MID_CURVE_OPTION = 2; - - private int _iMidCurveOptionType = -1; - private java.lang.String _strLastTradeExerciseLag = ""; - private int _iLastTradingDate = java.lang.Integer.MIN_VALUE; - - /** - * Retrieve the String Version of the Mid Curve Option Setting - * - * @param iMidCurveOptionType The Mid Curve Option Type - * - * @return String Version of the Mid Curve Option Setting - */ - - public static final java.lang.String MidCurveOptionString ( - final int iMidCurveOptionType) - { - if (MID_CURVE_OPTION_QUARTERLY == iMidCurveOptionType) return "QUARTERLY"; - - if (MID_CURVE_OPTION_SERIAL == iMidCurveOptionType) return "SERIAL"; - - if (MID_CURVE_OPTION == iMidCurveOptionType) return "REGULAR"; - - return null; - } - - /** - * LastTradingDateSetting Constructor - * - * @param iMidCurveOptionType Mid Curve Option Type - * @param strLastTradeExerciseLag Lag between the Exercise Date and the Last Option Trading Date - * @param iLastTradingDate The Last Trading Date - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public LastTradingDateSetting ( - final int iMidCurveOptionType, - final java.lang.String strLastTradeExerciseLag, - final int iLastTradingDate) - throws java.lang.Exception - { - if (MID_CURVE_OPTION_QUARTERLY != (_iMidCurveOptionType = iMidCurveOptionType) && - MID_CURVE_OPTION_SERIAL != _iMidCurveOptionType && MID_CURVE_OPTION != _iMidCurveOptionType) - throw new java.lang.Exception ("LastTradingDateSetting ctr => Invalid Inputs"); - - _iLastTradingDate = iLastTradingDate; - _strLastTradeExerciseLag = strLastTradeExerciseLag; - - if ((MID_CURVE_OPTION == _iMidCurveOptionType && (null == _strLastTradeExerciseLag || - _strLastTradeExerciseLag.isEmpty())) || (MID_CURVE_OPTION_SERIAL == _iMidCurveOptionType && - !org.drip.quant.common.NumberUtil.IsValid (_iLastTradingDate))) - throw new java.lang.Exception ("LastTradingDateSetting ctr => Invalid Inputs"); - } - - /** - * Retrieve the Mid-Curve Option Type - * - * @return The Mid-Curve Option Type - */ - - public int midCurveOptionType() - { - return _iMidCurveOptionType; - } - - /** - * Retrieve the Lag between the Last Trading and Exercise Date - * - * @return The Lag between the Last Trading and Exercise Date - */ - - public java.lang.String lastTradeExerciseLag() - { - return _strLastTradeExerciseLag; - } - - /** - * Retrieve the Last Trading Date - * - * @return The Last Trading Date - */ - - public double lastTradingDate() - { - return _iLastTradingDate; - } - - /** - * Compute the Last Trading Date - * - * @param iUnderlyingLastTradingDate The Last Trading Date for the Underlying - * @param strCalendar The Calendar - * - * @return The Last Trading Date - */ - - public int lastTradingDate ( - final int iUnderlyingLastTradingDate, - final java.lang.String strCalendar) - { - if (MID_CURVE_OPTION_SERIAL == _iMidCurveOptionType) return _iLastTradingDate; - - if (MID_CURVE_OPTION_QUARTERLY == _iMidCurveOptionType) return iUnderlyingLastTradingDate; - - return new org.drip.analytics.date.JulianDate (iUnderlyingLastTradingDate).subtractTenorAndAdjust - (_strLastTradeExerciseLag, strCalendar).julian(); - } - - @Override public java.lang.String toString() - { - java.lang.String str = "MID CURVE OPTION::" + MidCurveOptionString (_iMidCurveOptionType); - - if (MID_CURVE_OPTION_QUARTERLY == _iMidCurveOptionType) return str; - - if (MID_CURVE_OPTION == _iMidCurveOptionType) return str + "@" + _strLastTradeExerciseLag; - - if (MID_CURVE_OPTION_SERIAL == _iMidCurveOptionType) return str + "@" + _iLastTradingDate; - - return null; - } -} diff --git a/org/drip/product/params/NotionalSetting.java b/org/drip/product/params/NotionalSetting.java deleted file mode 100644 index c24c289..0000000 --- a/org/drip/product/params/NotionalSetting.java +++ /dev/null @@ -1,179 +0,0 @@ - -package org.drip.product.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * NotionalSetting contains the product's notional schedule and the amount. It also incorporates hints on how - * the notional factors are to be interpreted - off of the original or the current notional. Further flags - * tell whether the notional factor is to be applied at the start/end/average of the coupon period. It - * exports serialization into and de-serialization out of byte arrays. - * - * @author Lakshmi Krishnamurthy - */ - -public class NotionalSetting implements org.drip.product.params.Validatable { - - /** - * Period amortization proxies to the period start factor - */ - - public static final int PERIOD_AMORT_AT_START = 1; - - /** - * Period amortization proxies to the period end factor - */ - - public static final int PERIOD_AMORT_AT_END = 2; - - /** - * Period amortization proxies to the period effective factor - */ - - public static final int PERIOD_AMORT_EFFECTIVE = 3; - - private boolean _bPriceOffOriginalNotional = false; - private java.lang.String _strDenominationCurrency = ""; - private double _dblNotionalAmount = java.lang.Double.NaN; - private int _iPeriodAmortizationMode = PERIOD_AMORT_AT_START; - private org.drip.quant.common.Array2D _fsOutstanding = null; - - /** - * Construct the NotionalSetting from the notional schedule and the amount. - * - * @param fsOutstanding Outstanding Factor Schedule - * @param dblNotionalAmount Notional Amount - * @param strDenominationCurrency The Currency of Denomination - * @param iPeriodAmortizationMode Period Amortization Proxy Mode - * @param bPriceOffOriginalNotional Indicates whether the price is based off of the original notional - */ - - public NotionalSetting ( - final double dblNotionalAmount, - final java.lang.String strDenominationCurrency, - final org.drip.quant.common.Array2D fsOutstanding, - final int iPeriodAmortizationMode, - final boolean bPriceOffOriginalNotional) - { - _fsOutstanding = fsOutstanding; - _dblNotionalAmount = dblNotionalAmount; - _iPeriodAmortizationMode = iPeriodAmortizationMode; - _strDenominationCurrency = strDenominationCurrency; - _bPriceOffOriginalNotional = bPriceOffOriginalNotional; - } - - @Override public boolean validate() - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblNotionalAmount) || null == - _strDenominationCurrency || _strDenominationCurrency.isEmpty()) - return false; - - if (null == _fsOutstanding) _fsOutstanding = org.drip.quant.common.Array2D.BulletSchedule(); - - return true; - } - - /** - * Retrieve the Notional Amount - * - * @return The Notional Amount - */ - - public double notionalAmount() - { - return _dblNotionalAmount; - } - - /** - * Retrieve "Price Off Of Original Notional" Flag - * - * @return TRUE - Price Quote is based off of the original notional - */ - - public boolean priceOffOfOriginalNotional() - { - return _bPriceOffOriginalNotional; - } - - /** - * Retrieve the Period Amortization Mode - * - * @return The Period Amortization Mode - */ - - public int periodAmortizationMode() - { - return _iPeriodAmortizationMode; - } - - /** - * Retrieve the Outstanding Factor Schedule - * - * @return The Outstanding Factor Schedule - */ - - public org.drip.quant.common.Array2D outstandingFactorSchedule() - { - return _fsOutstanding; - } - - /** - * Currency in which the Notional is specified - * - * @return The Currency of Denomination - */ - - public java.lang.String denominationCurrency() - { - return _strDenominationCurrency; - } -} diff --git a/org/drip/product/params/QuoteConvention.java b/org/drip/product/params/QuoteConvention.java deleted file mode 100644 index 9c2147b..0000000 --- a/org/drip/product/params/QuoteConvention.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.product.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * QuoteConvention contains the Component Market Convention Parameters - the quote convention, the - * calculation type, the first settle date, and the redemption amount. It exports serialization into and - * de-serialization out of byte arrays. - * - * @author Lakshmi Krishnamurthy - */ - -public class QuoteConvention implements org.drip.product.params.Validatable { - private java.lang.String _strCalculationType = ""; - private double _dblRedemptionValue = java.lang.Double.NaN; - private int _iFirstSettleDate = java.lang.Integer.MIN_VALUE; - private org.drip.param.valuation.CashSettleParams _cashSettleParams = null; - private org.drip.param.valuation.ValuationCustomizationParams _valuationCustomizationParams = null; - - /** - * Construct the QuoteConvention object from the valuation Customization Parameters, the calculation - * type, the first settle date, and the redemption value. - * - * @param valuationCustomizationParams Valuation Customization Parameters - * @param strCalculationType Calculation Type - * @param iFirstSettleDate First Settle Date - * @param dblRedemptionValue Redemption Value - * @param iSettleLag Settle Lag - * @param strSettleCalendar Settlement Calendar - * @param iSettleAdjustMode Is Settle date business adjusted - */ - - public QuoteConvention ( - final org.drip.param.valuation.ValuationCustomizationParams valuationCustomizationParams, - final java.lang.String strCalculationType, - final int iFirstSettleDate, - final double dblRedemptionValue, - final int iSettleLag, - final java.lang.String strSettleCalendar, - final int iSettleAdjustMode) - { - _iFirstSettleDate = iFirstSettleDate; - _dblRedemptionValue = dblRedemptionValue; - _strCalculationType = strCalculationType; - _valuationCustomizationParams = valuationCustomizationParams; - - _cashSettleParams = new org.drip.param.valuation.CashSettleParams (iSettleLag, strSettleCalendar, - iSettleAdjustMode); - } - - public int settleDate ( - final org.drip.param.valuation.ValuationParams valParams) - throws java.lang.Exception - { - if (null == valParams) - throw new java.lang.Exception ("QuoteConvention::settleDate => Invalid inputs"); - - return _cashSettleParams.cashSettleDate (valParams.valueDate()); - } - - @Override public boolean validate() - { - return org.drip.quant.common.NumberUtil.IsValid (_iFirstSettleDate) && - org.drip.quant.common.NumberUtil.IsValid (_dblRedemptionValue); - } - - /** - * Retrieve the Calculation Type - * - * @return The Calculation Type - */ - - public java.lang.String calculationType() - { - return _strCalculationType; - } - - /** - * Retrieve the First Settle Date - * - * @return The First Settle Date - */ - - public int firstSettleDate() - { - return _iFirstSettleDate; - } - - /** - * Retrieve the Redemption Value - * - * @return The Redemption Value - */ - - public double redemptionValue() - { - return _dblRedemptionValue; - } - - /** - * Retrieve the Cash Settle Parameters - * - * @return The Cash Settle Parameters - */ - - public org.drip.param.valuation.CashSettleParams cashSettleParams() - { - return _cashSettleParams; - } - - /** - * Retrieve the Valuation Customization Parameters - * - * @return The Valuation Customization Parameters - */ - - public org.drip.param.valuation.ValuationCustomizationParams valuationCustomizationParams() - { - return _valuationCustomizationParams; - } -} diff --git a/org/drip/product/params/StandardCDXParams.java b/org/drip/product/params/StandardCDXParams.java deleted file mode 100644 index 00bcb5d..0000000 --- a/org/drip/product/params/StandardCDXParams.java +++ /dev/null @@ -1,103 +0,0 @@ - -package org.drip.product.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * StandardCDXParams implements the parameters used to create the standard CDX - the coupon, the number of - * components, and the currency. - * - * @author Lakshmi Krishnamurthy - */ - -public class StandardCDXParams { - - /** - * Number of CDX Components - */ - - public int _iNumComponents = 0; - - /** - * Currency - */ - - public java.lang.String _strCurrency = ""; - - /** - * CDX Coupon - */ - - public double _dblCoupon = java.lang.Double.NaN; - - /** - * Create the Standard CDX Parameters object using the components, the currency, and the coupon - * - * @param iNumComponents CDX Components - * @param strCurrency CDX Currency - * @param dblCoupon CDX Coupon - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public StandardCDXParams ( - final int iNumComponents, - final java.lang.String strCurrency, - final double dblCoupon) - throws java.lang.Exception - { - if (null == (_strCurrency = strCurrency) || _strCurrency.isEmpty() || - !org.drip.quant.common.NumberUtil.IsValid (_dblCoupon = dblCoupon)) - throw new java.lang.Exception ("StandardCDXParams ctr => Invalid inputs"); - - _iNumComponents = iNumComponents; - } -} diff --git a/org/drip/product/params/TerminationSetting.java b/org/drip/product/params/TerminationSetting.java deleted file mode 100644 index 0d7b1b0..0000000 --- a/org/drip/product/params/TerminationSetting.java +++ /dev/null @@ -1,123 +0,0 @@ - -package org.drip.product.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * TerminationSetting class contains the current "liveness" state of the component, and, if inactive, how it - * entered that state. It exports serialization into and de-serialization out of byte arrays. - * - * @author Lakshmi Krishnamurthy - */ - -public class TerminationSetting implements org.drip.product.params.Validatable { - private boolean _bIsDefaulted = false; - private boolean _bIsPerpetual = false; - private boolean _bHasBeenExercised = false; - - /** - * Construct the TerminationSetting object from the perpetual flag, defaulted flag, and the has - * been exercised flag. - * - * @param bIsPerpetual True (component is perpetual) - * @param bIsDefaulted True (component has defaulted) - * @param bHasBeenExercised True (component has been exercised) - */ - - public TerminationSetting ( - final boolean bIsPerpetual, - final boolean bIsDefaulted, - final boolean bHasBeenExercised) - { - _bIsPerpetual = bIsPerpetual; - _bIsDefaulted = bIsDefaulted; - _bHasBeenExercised = bHasBeenExercised; - } - - @Override public boolean validate() - { - return true; - } - - /** - * Indicate if the contract has defaulted - * - * @return TRUE - The Contract has defaulted - */ - - public boolean defaulted() - { - return _bIsDefaulted; - } - - /** - * Indicate if the contract is perpetual - * - * @return TRUE - The Contract is Perpetual - */ - - public boolean perpetual() - { - return _bIsPerpetual; - } - - /** - * Indicate if the contract has been exercised - * - * @return TRUE - The Contract has been exercised - */ - - public boolean exercised() - { - return _bHasBeenExercised; - } -} diff --git a/org/drip/product/params/TreasuryBenchmarks.java b/org/drip/product/params/TreasuryBenchmarks.java deleted file mode 100644 index 670cf12..0000000 --- a/org/drip/product/params/TreasuryBenchmarks.java +++ /dev/null @@ -1,103 +0,0 @@ - -package org.drip.product.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * TsyBmkSet contains the treasury benchmark set - the primary treasury benchmark, and an array of secondary - * treasury benchmarks. It exports serialization into and de-serialization out of byte arrays. - * - * @author Lakshmi Krishnamurthy - */ - -public class TreasuryBenchmarks { - private java.lang.String _strPrimary = ""; - private java.lang.String[] _astrSecondary = null; - - /** - * Construct the treasury benchmark set from the primary treasury benchmark, and an array of secondary - * treasury benchmarks - * - * @param strPrimary Primary Treasury Benchmark - * @param astrSecondary Array of Secondary Treasury Benchmarks - */ - - public TreasuryBenchmarks ( - final java.lang.String strPrimary, - final java.lang.String[] astrSecondary) - { - _strPrimary = strPrimary; - _astrSecondary = astrSecondary; - } - - /** - * Return the Primary Treasury Benchmark - * - * @return Primary Treasury Benchmark - */ - - public java.lang.String primary() - { - return _strPrimary; - } - - /** - * Return an Array of Secondary Treasury Benchmarks - * - * @return Array of Secondary Treasury Benchmarks - */ - - public java.lang.String[] secondary() - { - return _astrSecondary; - } -} diff --git a/org/drip/product/params/Validatable.java b/org/drip/product/params/Validatable.java deleted file mode 100644 index 21c76dc..0000000 --- a/org/drip/product/params/Validatable.java +++ /dev/null @@ -1,70 +0,0 @@ - -package org.drip.product.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * Validatable interface defines the validate function, which validates the current object state. - * - * @author Lakshmi Krishnamurthy - */ - -public interface Validatable { - - /** - * Validate the current object state - * - * @return Validation successful (true) or failed (false) - */ - - public boolean validate(); -} diff --git a/org/drip/product/rates/DualStreamComponent.java b/org/drip/product/rates/DualStreamComponent.java deleted file mode 100644 index 64a198b..0000000 --- a/org/drip/product/rates/DualStreamComponent.java +++ /dev/null @@ -1,77 +0,0 @@ - -package org.drip.product.rates; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * DualStreamComponent is the abstract class that extends the CalibratableFixedIncomeComponent on top of - * which all the dual stream rates components (fix-float, float-float, IRS etc.) are implemented. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class DualStreamComponent extends - org.drip.product.definition.CalibratableComponent { - - /** - * Retrieve the Reference Stream - * - * @return The Reference Stream - */ - - public abstract org.drip.product.rates.Stream referenceStream(); - - /** - * Retrieve the Derived Stream - * - * @return The Derived Stream - */ - - public abstract org.drip.product.rates.Stream derivedStream(); -} diff --git a/org/drip/product/rates/FixFloatComponent.java b/org/drip/product/rates/FixFloatComponent.java deleted file mode 100644 index 968f8c4..0000000 --- a/org/drip/product/rates/FixFloatComponent.java +++ /dev/null @@ -1,1049 +0,0 @@ - -package org.drip.product.rates; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FixFloatComponent contains the implementation of the Fix-Float Index Basis Swap product - * contract/valuation details. It is made off one Reference Fixed stream and one Derived floating stream. - * It exports the following functionality: - * - Standard/Custom Constructor for the FixFloatComponent - * - Dates: Effective, Maturity, Coupon dates and Product settlement Parameters - * - Coupon/Notional Outstanding as well as schedules - * - Retrieve the constituent floating streams - * - Market Parameters: Discount, Forward, Credit, Treasury Curves - * - Cash Flow Periods: Coupon flows and (Optionally) Loss Flows - * - Valuation: Named Measure Generation - * - Calibration: The codes and constraints generation - * - Jacobians: Quote/DF and PV/DF micro-Jacobian generation - * - Serialization into and de-serialization out of byte arrays - * - * @author Lakshmi Krishnamurthy - */ - -public class FixFloatComponent extends org.drip.product.rates.DualStreamComponent { - private java.lang.String _strCode = ""; - private org.drip.product.rates.Stream _fixReference = null; - private org.drip.product.rates.Stream _floatDerived = null; - private org.drip.param.valuation.CashSettleParams _csp = null; - - /** - * Construct the FixFloatComponent from the Reference Fixed and the Derived Floating Streams. - * - * @param fixReference The Reference Fixed Stream - * @param floatDerived The Derived Floating Stream - * @param csp Cash Settle Parameters Instance - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public FixFloatComponent ( - final org.drip.product.rates.Stream fixReference, - final org.drip.product.rates.Stream floatDerived, - final org.drip.param.valuation.CashSettleParams csp) - throws java.lang.Exception - { - if (null == (_fixReference = fixReference) || null == (_floatDerived = floatDerived)) - throw new java.lang.Exception ("FixFloatComponent ctr: Invalid Inputs"); - - _csp = csp; - } - - @Override public void setPrimaryCode ( - final java.lang.String strCode) - { - _strCode = strCode; - } - - @Override public java.lang.String primaryCode() - { - return _strCode; - } - - @Override public java.lang.String name() - { - return _strCode; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap couponCurrency() - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapCouponCurrency = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapCouponCurrency.put ("DERIVED", _floatDerived.couponCurrency()); - - mapCouponCurrency.put ("REFERENCE", _fixReference.couponCurrency()); - - return mapCouponCurrency; - } - - @Override public java.lang.String payCurrency() - { - return _fixReference.payCurrency(); - } - - @Override public java.lang.String principalCurrency() - { - return null; - } - - @Override public double initialNotional() - throws java.lang.Exception - { - return _fixReference.initialNotional(); - } - - @Override public double notional ( - final int iDate) - throws java.lang.Exception - { - return _fixReference.notional (iDate); - } - - @Override public double notional ( - final int iDate1, - final int iDate2) - throws java.lang.Exception - { - return _fixReference.notional (iDate1, iDate2); - } - - @Override public org.drip.analytics.output.CompositePeriodCouponMetrics couponMetrics ( - final int iAccrualEndDate, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - return null; - } - - @Override public int freq() - { - return _fixReference.freq(); - } - - @Override public org.drip.state.identifier.CreditLabel creditLabel() - { - return _fixReference.creditLabel(); - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - forwardLabel() - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapFRI = - new org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapFRI.put ("DERIVED", _floatDerived.forwardLabel()); - - return mapFRI; - } - - @Override public org.drip.state.identifier.FundingLabel fundingLabel() - { - return _fixReference.fundingLabel(); - } - - @Override public org.drip.state.identifier.GovvieLabel govvieLabel() - { - return org.drip.state.identifier.GovvieLabel.Standard (payCurrency()); - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap - fxLabel() - { - org.drip.state.identifier.FXLabel fxLabelReference = _fixReference.fxLabel(); - - org.drip.state.identifier.FXLabel fxLabelDerived = _floatDerived.fxLabel(); - - if (null != fxLabelReference && null != fxLabelDerived) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapFXLabel = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - if (null != fxLabelReference) mapFXLabel.put ("REFERENCE", fxLabelReference); - - if (null != fxLabelDerived) mapFXLabel.put ("DERIVED", fxLabelDerived); - - return mapFXLabel; - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - volatilityLabel() - { - return null; - } - - @Override public org.drip.product.rates.Stream referenceStream() - { - return _fixReference; - } - - @Override public org.drip.product.rates.Stream derivedStream() - { - return _floatDerived; - } - - @Override public org.drip.analytics.date.JulianDate effectiveDate() - { - org.drip.analytics.date.JulianDate dtFloatReferenceEffective = _fixReference.effective(); - - org.drip.analytics.date.JulianDate dtFloatDerivedEffective = _floatDerived.effective(); - - return dtFloatReferenceEffective.julian() < dtFloatDerivedEffective.julian() ? - dtFloatReferenceEffective : dtFloatDerivedEffective; - } - - @Override public org.drip.analytics.date.JulianDate maturityDate() - { - org.drip.analytics.date.JulianDate dtFixReferenceMaturity = _fixReference.maturity(); - - org.drip.analytics.date.JulianDate dtFloatDerivedMaturity = _floatDerived.maturity(); - - return dtFixReferenceMaturity.julian() > dtFloatDerivedMaturity.julian() ? - dtFixReferenceMaturity : dtFloatDerivedMaturity; - } - - @Override public org.drip.analytics.date.JulianDate firstCouponDate() - { - org.drip.analytics.date.JulianDate dtFloatReferenceFirstCoupon = _fixReference.firstCouponDate(); - - org.drip.analytics.date.JulianDate dtFloatDerivedFirstCoupon = _floatDerived.firstCouponDate(); - - return dtFloatReferenceFirstCoupon.julian() < dtFloatDerivedFirstCoupon.julian() ? - dtFloatReferenceFirstCoupon : dtFloatDerivedFirstCoupon; - } - - @Override public java.util.List couponPeriods() - { - java.util.List lsCP = new - java.util.ArrayList(); - - lsCP.addAll (_fixReference.cashFlowPeriod()); - - lsCP.addAll (_floatDerived.cashFlowPeriod()); - - return lsCP; - } - - @Override public org.drip.param.valuation.CashSettleParams cashSettleParams() - { - return _csp; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap value ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - { - long lStart = System.nanoTime(); - - int iValueDate = valParams.valueDate(); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapFixedReferenceStreamResult = - _fixReference.value (valParams, pricerParams, csqs, quotingParams); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapFloatDerivedStreamResult = - _floatDerived.value (valParams, pricerParams, csqs, quotingParams); - - if (null == mapFixedReferenceStreamResult || 0 == mapFixedReferenceStreamResult.size() || null == - mapFloatDerivedStreamResult || 0 == mapFloatDerivedStreamResult.size()) - return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapResult = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - if (!org.drip.analytics.support.Helper.AccumulateMeasures (mapResult, _fixReference.name(), - mapFixedReferenceStreamResult)) - return null; - - if (!org.drip.analytics.support.Helper.AccumulateMeasures (mapResult, _floatDerived.name(), - mapFloatDerivedStreamResult)) - return null; - - double dblDerivedAccrued = mapFloatDerivedStreamResult.get ("Accrued"); - - double dblDerivedAccrued01 = mapFloatDerivedStreamResult.get ("Accrued01"); - - double dblDerivedCleanDV01 = mapFloatDerivedStreamResult.get ("CleanDV01"); - - double dblDerivedCleanPV = mapFloatDerivedStreamResult.get ("CleanPV"); - - double dblDerivedDirtyDV01 = mapFloatDerivedStreamResult.get ("DirtyDV01"); - - double dblDerivedDirtyPV = mapFloatDerivedStreamResult.get ("DirtyPV"); - - double dblDerivedPV = mapFloatDerivedStreamResult.get ("PV"); - - double dblDerivedCumulativeConvexityAdjustmentPremium = mapFloatDerivedStreamResult.get - ("CumulativeConvexityAdjustmentPremiumUpfront"); - - double dblDerivedCumulativeCouponAmount = mapFloatDerivedStreamResult.get ("CumulativeCouponAmount"); - - double dblDerivedCumulativeCouponDCF = mapFloatDerivedStreamResult.get ("CumulativeCouponDCF"); - - double dblFixing01 = mapFloatDerivedStreamResult.get ("Fixing01"); - - double dblReferenceAccrued = mapFixedReferenceStreamResult.get ("Accrued"); - - double dblReferenceAccrued01 = mapFixedReferenceStreamResult.get ("Accrued01"); - - double dblReferenceCleanDV01 = mapFixedReferenceStreamResult.get ("CleanDV01"); - - double dblReferenceCleanPV = mapFixedReferenceStreamResult.get ("CleanPV"); - - double dblReferenceDirtyPV = mapFixedReferenceStreamResult.get ("DirtyPV"); - - double dblReferenceCumulativeConvexityAdjustmentPremium = mapFixedReferenceStreamResult.get - ("CumulativeConvexityAdjustmentPremium"); - - double dblReferenceCumulativeCouponAmount = mapFixedReferenceStreamResult.get - ("CumulativeCouponAmount"); - - double dblReferenceCumulativeCouponDCF = mapFixedReferenceStreamResult.get ("CumulativeCouponDCF"); - - double dblValueNotional = java.lang.Double.NaN; - double dblAccrued = dblDerivedAccrued + dblReferenceAccrued; - double dblCleanPV = dblReferenceCleanPV + dblDerivedCleanPV; - double dblParFixedCoupon = -0.0001 * dblDerivedCleanPV / dblReferenceCleanDV01; - - mapResult.put ("Accrued", dblAccrued); - - mapResult.put ("CleanFixedDV01", dblReferenceCleanDV01); - - mapResult.put ("CleanFloatingDV01", dblDerivedCleanDV01); - - mapResult.put ("CleanFloatingPV", dblDerivedCleanPV); - - mapResult.put ("CleanPV", dblCleanPV); - - mapResult.put ("CumulativeConvexityAdjustmentPremium", _fixReference.initialNotional() * - dblReferenceCumulativeConvexityAdjustmentPremium + _floatDerived.initialNotional() * - dblDerivedCumulativeConvexityAdjustmentPremium); - - mapResult.put ("CumulativeCouponAmount", dblDerivedCumulativeCouponAmount + - dblReferenceCumulativeCouponAmount); - - mapResult.put ("CumulativeCouponDCF", dblDerivedCumulativeCouponDCF + - dblReferenceCumulativeCouponDCF); - - mapResult.put ("DerivedAccrued", dblDerivedAccrued); - - mapResult.put ("DerivedAccrued01", dblDerivedAccrued01); - - mapResult.put ("DerivedCleanDV01", dblDerivedCleanDV01); - - mapResult.put ("DerivedCleanPV", dblDerivedCleanPV); - - mapResult.put ("DerivedDirtyDV01", dblDerivedDirtyDV01); - - mapResult.put ("DerivedDirtyPV", dblDerivedDirtyPV); - - mapResult.put ("DerivedDV01", dblDerivedCleanDV01); - - mapResult.put ("DerivedFixing01", dblFixing01); - - mapResult.put ("DerivedParBasisSpread", -1. * dblCleanPV / dblDerivedCleanDV01); - - mapResult.put ("DerivedPV", dblDerivedPV); - - mapResult.put ("DerivedCumulativeConvexityAdjustmentFactor", mapFloatDerivedStreamResult.get - ("CumulativeConvexityAdjustmentFactor")); - - mapResult.put ("DerivedCumulativeConvexityAdjustmentPremium", - dblDerivedCumulativeConvexityAdjustmentPremium); - - mapResult.put ("DerivedCumulativeCouponAmount", dblDerivedCumulativeCouponAmount); - - mapResult.put ("DerivedCumulativeCouponDCF", dblDerivedCumulativeCouponDCF); - - mapResult.put ("DerivedResetDate", mapFloatDerivedStreamResult.get ("ResetDate")); - - mapResult.put ("DerivedResetRate", mapFloatDerivedStreamResult.get ("ResetRate")); - - mapResult.put ("DirtyFixedDV01", mapFixedReferenceStreamResult.get ("DirtyDV01")); - - mapResult.put ("DirtyFixedPV", dblReferenceDirtyPV); - - mapResult.put ("DirtyFloatingDV01", dblDerivedDirtyDV01); - - mapResult.put ("DirtyFloatingPV", dblDerivedDirtyPV); - - mapResult.put ("DirtyPV", dblDerivedDirtyPV + dblReferenceDirtyPV); - - mapResult.put ("FairPremium", dblParFixedCoupon); - - mapResult.put ("FixedAccrued", dblReferenceAccrued); - - mapResult.put ("FixedAccrued01", dblReferenceAccrued01); - - mapResult.put ("FixedDV01", dblReferenceCleanDV01); - - mapResult.put ("FloatAccrued", dblDerivedAccrued); - - mapResult.put ("FloatAccrued01", dblDerivedAccrued01); - - mapResult.put ("FloatDV01", dblDerivedCleanDV01); - - mapResult.put ("Fixing01", dblFixing01); - - mapResult.put ("ParFixedCoupon", dblParFixedCoupon); - - mapResult.put ("ParRate", dblParFixedCoupon); - - mapResult.put ("ParSwapRate", dblParFixedCoupon); - - mapResult.put ("PV", dblCleanPV); - - mapResult.put ("Rate", dblParFixedCoupon); - - mapResult.put ("ReferenceAccrued", dblReferenceAccrued); - - mapResult.put ("ReferenceAccrued01", dblReferenceAccrued01); - - mapResult.put ("ReferenceCleanDV01", dblReferenceCleanDV01); - - mapResult.put ("ReferenceCleanPV", dblReferenceCleanPV); - - mapResult.put ("ReferenceCumulativeCouponAmount", dblReferenceCumulativeCouponAmount); - - mapResult.put ("ReferenceCumulativeCouponDCF", dblReferenceCumulativeCouponDCF); - - mapResult.put ("ReferenceDirtyDV01", mapFixedReferenceStreamResult.get ("DirtyDV01")); - - mapResult.put ("ReferenceDirtyPV", dblReferenceDirtyPV); - - mapResult.put ("ReferenceDV01", dblReferenceCleanDV01); - - mapResult.put ("ReferenceParBasisSpread", -1. * dblCleanPV / dblReferenceCleanDV01); - - mapResult.put ("ReferencePV", dblReferenceCleanPV); - - mapResult.put ("ReferenceCumulativeConvexityAdjustmentFactor", mapFixedReferenceStreamResult.get - ("CumulativeConvexityAdjustmentFactor")); - - mapResult.put ("ReferenceCumulativeConvexityAdjustmentPremium", - dblReferenceCumulativeConvexityAdjustmentPremium); - - mapResult.put ("ResetDate", mapFloatDerivedStreamResult.get ("ResetDate")); - - mapResult.put ("ResetRate", mapFloatDerivedStreamResult.get ("ResetRate")); - - mapResult.put ("SwapRate", dblParFixedCoupon); - - mapResult.put ("Upfront", mapFixedReferenceStreamResult.get ("Upfront") + - mapFloatDerivedStreamResult.get ("Upfront")); - - try { - dblValueNotional = notional (iValueDate); - - mapResult.put ("InitialNotional", initialNotional()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - try { - if (org.drip.quant.common.NumberUtil.IsValid (dblValueNotional)) { - double dblCleanPrice = 100. * (1. + (dblCleanPV / initialNotional() / dblValueNotional)); - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqs.fundingState (fundingLabel()); - - if (null == dcFunding) return null; - - int iStartDate = effectiveDate().julian(); - - double dblTelescopedFloatingPV = dcFunding.df (iStartDate > iValueDate ? iStartDate : - iValueDate) - dcFunding.df (maturityDate()); - - mapResult.put ("CalibFloatingPV", dblTelescopedFloatingPV); - - mapResult.put ("CalibSwapRate", java.lang.Math.abs (0.0001 * dblTelescopedFloatingPV / - dblReferenceCleanDV01 * notional (iValueDate))); - - mapResult.put ("CleanPrice", dblCleanPrice); - - mapResult.put ("DirtyPrice", dblCleanPrice + dblAccrued); - - mapResult.put ("Price", dblCleanPrice); - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - mapResult.put ("CalcTime", (System.nanoTime() - lStart) * 1.e-09); - - return mapResult; - } - - @Override public java.util.Set measureNames() - { - java.util.Set setstrMeasureNames = new java.util.TreeSet(); - - setstrMeasureNames.add ("Accrued"); - - setstrMeasureNames.add ("CalcTime"); - - setstrMeasureNames.add ("CalibFloatingPV"); - - setstrMeasureNames.add ("CalibSwapRate"); - - setstrMeasureNames.add ("CleanFixedDV01"); - - setstrMeasureNames.add ("CleanFloatingDV01"); - - setstrMeasureNames.add ("CleanFloatingPV"); - - setstrMeasureNames.add ("CleanPrice"); - - setstrMeasureNames.add ("CleanPV"); - - setstrMeasureNames.add ("CumulativeCouponAmount"); - - setstrMeasureNames.add ("CumulativeCouponDCF"); - - setstrMeasureNames.add ("DerivedAccrued01"); - - setstrMeasureNames.add ("DerivedAccrued"); - - setstrMeasureNames.add ("DerivedCleanDV01"); - - setstrMeasureNames.add ("DerivedCleanPV"); - - setstrMeasureNames.add ("DerivedCumulativeCouponAmount"); - - setstrMeasureNames.add ("DerivedCumulativeCouponDCF"); - - setstrMeasureNames.add ("DerivedDirtyDV01"); - - setstrMeasureNames.add ("DerivedDirtyPV"); - - setstrMeasureNames.add ("DerivedDV01"); - - setstrMeasureNames.add ("DerivedFixing01"); - - setstrMeasureNames.add ("DerivedParBasisSpread"); - - setstrMeasureNames.add ("DerivedPV"); - - setstrMeasureNames.add ("DerivedCumulativeConvexityAdjustmentFactor"); - - setstrMeasureNames.add ("DerivedCumulativeConvexityAdjustmentPremium"); - - setstrMeasureNames.add ("DerivedResetDate"); - - setstrMeasureNames.add ("DerivedResetRate"); - - setstrMeasureNames.add ("DirtyFixedDV01"); - - setstrMeasureNames.add ("DirtyFixedPV"); - - setstrMeasureNames.add ("DirtyFloatingDV01"); - - setstrMeasureNames.add ("DirtyFloatingPV"); - - setstrMeasureNames.add ("DirtyPrice"); - - setstrMeasureNames.add ("DirtyPV"); - - setstrMeasureNames.add ("FairPremium"); - - setstrMeasureNames.add ("FixedAccrued"); - - setstrMeasureNames.add ("FixedAccrued01"); - - setstrMeasureNames.add ("FixedDV01"); - - setstrMeasureNames.add ("FloatAccrued"); - - setstrMeasureNames.add ("FloatAccrued01"); - - setstrMeasureNames.add ("FloatDV01"); - - setstrMeasureNames.add ("Fixing01"); - - setstrMeasureNames.add ("InitialNotional"); - - setstrMeasureNames.add ("ParFixedCoupon"); - - setstrMeasureNames.add ("ParRate"); - - setstrMeasureNames.add ("ParSwapRate"); - - setstrMeasureNames.add ("Price"); - - setstrMeasureNames.add ("PV"); - - setstrMeasureNames.add ("CumulativeConvexityAdjustmentPremium"); - - setstrMeasureNames.add ("Rate"); - - setstrMeasureNames.add ("ReferenceAccrued"); - - setstrMeasureNames.add ("ReferenceAccrued01"); - - setstrMeasureNames.add ("ReferenceCleanDV01"); - - setstrMeasureNames.add ("ReferenceCleanPV"); - - setstrMeasureNames.add ("ReferenceCumulativeCouponAmount"); - - setstrMeasureNames.add ("ReferenceCumulativeCouponDCF"); - - setstrMeasureNames.add ("ReferenceDirtyDV01"); - - setstrMeasureNames.add ("ReferenceDirtyPV"); - - setstrMeasureNames.add ("ReferenceDV01"); - - setstrMeasureNames.add ("ReferenceParBasisSpread"); - - setstrMeasureNames.add ("ReferencePV"); - - setstrMeasureNames.add ("ReferenceCumulativeConvexityAdjustmentFactor"); - - setstrMeasureNames.add ("ReferenceCumulativeConvexityAdjustmentPremium"); - - setstrMeasureNames.add ("ResetDate"); - - setstrMeasureNames.add ("ResetRate"); - - setstrMeasureNames.add ("SwapRate"); - - setstrMeasureNames.add ("Upfront"); - - return setstrMeasureNames; - } - - @Override public double pv ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - throws java.lang.Exception - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapFixedReferenceStreamResult = - _fixReference.value (valParams, pricerParams, csqs, quotingParams); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapFloatDerivedStreamResult = - _floatDerived.value (valParams, pricerParams, csqs, quotingParams); - - if (null == mapFixedReferenceStreamResult || !mapFixedReferenceStreamResult.containsKey ("DirtyPV") - || null == mapFloatDerivedStreamResult || !mapFloatDerivedStreamResult.containsKey ("DirtyPV")) - throw new java.lang.Exception - ("FixFloatComponent::pv => Cannot Compute Constituent Stream Value Metrics"); - - return mapFixedReferenceStreamResult.get ("DirtyPV") + mapFloatDerivedStreamResult.get ("DirtyPV"); - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDDirtyPVDManifestMeasure ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapMeasures = value (valParams, - pricerParams, csqs, quotingParams); - - if (null == mapMeasures || !mapMeasures.containsKey ("SwapRate")) return null; - - double dblParSwapRate = mapMeasures.get ("SwapRate"); - - org.drip.quant.calculus.WengertJacobian jackDDirtyPVDManifestMeasureFloating = - _floatDerived.jackDDirtyPVDManifestMeasure (valParams, pricerParams, csqs, quotingParams); - - if (null == jackDDirtyPVDManifestMeasureFloating) return null; - - int iNumQuote = jackDDirtyPVDManifestMeasureFloating.numParameters(); - - if (0 == iNumQuote) return null; - - org.drip.quant.calculus.WengertJacobian jackDDirtyPVDManifestMeasureFixed = - _fixReference.jackDDirtyPVDManifestMeasure (valParams, pricerParams, csqs, quotingParams); - - if (null == jackDDirtyPVDManifestMeasureFixed || iNumQuote != - jackDDirtyPVDManifestMeasureFixed.numParameters()) - return null; - - double dblNotionalScaleDown = java.lang.Double.NaN; - org.drip.quant.calculus.WengertJacobian jackDDirtyPVDManifestMeasureIRS = null; - - if (null == jackDDirtyPVDManifestMeasureIRS) { - try { - dblNotionalScaleDown = 1. / initialNotional(); - - jackDDirtyPVDManifestMeasureIRS = new org.drip.quant.calculus.WengertJacobian (1, iNumQuote); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - for (int i = 0; i < iNumQuote; ++i) { - if (!jackDDirtyPVDManifestMeasureIRS.accumulatePartialFirstDerivative (0, i, dblNotionalScaleDown - * (dblParSwapRate * jackDDirtyPVDManifestMeasureFixed.firstDerivative (0, i) + - jackDDirtyPVDManifestMeasureFloating.firstDerivative (0, i)))) - return null; - } - - return jackDDirtyPVDManifestMeasureIRS; - } - - @Override public org.drip.quant.calculus.WengertJacobian manifestMeasureDFMicroJack ( - final java.lang.String strManifestMeasure, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - { - if (null == valParams || valParams.valueDate() >= maturityDate().julian() || null == - strManifestMeasure || null == csqs) - return null; - - if ("Rate".equalsIgnoreCase (strManifestMeasure) || "SwapRate".equalsIgnoreCase (strManifestMeasure)) - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapMeasures = value - (valParams, pricerParams, csqs, quotingParams); - - if (null == mapMeasures) return null; - - double dblDirtyDV01 = mapMeasures.get ("DirtyDV01"); - - double dblParSwapRate = mapMeasures.get ("SwapRate"); - - try { - org.drip.quant.calculus.WengertJacobian wjSwapRateDFMicroJack = null; - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqs.fundingState (fundingLabel()); - - if (null == dcFunding) return null; - - for (org.drip.analytics.cashflow.CompositePeriod p : couponPeriods()) { - int iPeriodPayDate = p.payDate(); - - if (iPeriodPayDate < valParams.valueDate()) continue; - - org.drip.quant.calculus.WengertJacobian wjPeriodFwdRateDF = - dcFunding.jackDForwardDManifestMeasure (p.startDate(), p.endDate(), "Rate", - p.couponDCF()); - - org.drip.quant.calculus.WengertJacobian wjPeriodPayDFDF = - dcFunding.jackDDFDManifestMeasure (iPeriodPayDate, "Rate"); - - if (null == wjPeriodFwdRateDF || null == wjPeriodPayDFDF) continue; - - double dblForwardRate = dcFunding.libor (p.startDate(), p.endDate()); - - double dblPeriodPayDF = dcFunding.df (iPeriodPayDate); - - if (null == wjSwapRateDFMicroJack) - wjSwapRateDFMicroJack = new org.drip.quant.calculus.WengertJacobian (1, - wjPeriodFwdRateDF.numParameters()); - - double dblPeriodNotional = notional (p.startDate(), p.endDate()); - - double dblPeriodDCF = p.couponDCF(); - - for (int k = 0; k < wjPeriodFwdRateDF.numParameters(); ++k) { - double dblPeriodMicroJack = (dblForwardRate - dblParSwapRate) * - wjPeriodPayDFDF.firstDerivative (0, k) + dblPeriodPayDF * - wjPeriodFwdRateDF.firstDerivative (0, k); - - if (!wjSwapRateDFMicroJack.accumulatePartialFirstDerivative (0, k, dblPeriodNotional - * dblPeriodDCF * dblPeriodMicroJack / dblDirtyDV01)) - return null; - } - } - - return wjSwapRateDFMicroJack; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - } - - return null; - } - - @Override public org.drip.product.calib.ProductQuoteSet calibQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - { - try { - return new org.drip.product.calib.FixFloatQuoteSet (aLSS); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fundingPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams, - final org.drip.product.calib.ProductQuoteSet pqs) - { - if (null == valParams || valParams.valueDate() >= maturityDate().julian() || null == pqs || !(pqs - instanceof org.drip.product.calib.FixFloatQuoteSet)) - return null; - - double dblPV = 0.; - org.drip.product.calib.FixedStreamQuoteSet fsqsReference = null; - org.drip.product.calib.FloatingStreamQuoteSet fsqsDerived = null; - org.drip.product.calib.FixFloatQuoteSet ffqs = (org.drip.product.calib.FixFloatQuoteSet) pqs; - - if (!ffqs.containsPV() && !ffqs.containsSwapRate() && !ffqs.containsDerivedParBasisSpread() && - !ffqs.containsReferenceParBasisSpread()) - return null; - - org.drip.state.representation.LatentStateSpecification[] aLSS = pqs.lss(); - - try { - fsqsDerived = new org.drip.product.calib.FloatingStreamQuoteSet (aLSS); - - fsqsReference = new org.drip.product.calib.FixedStreamQuoteSet (aLSS); - - if (ffqs.containsPV()) dblPV = ffqs.pv(); - - if (ffqs.containsSwapRate()) - fsqsReference.setCoupon (ffqs.swapRate()); - else if (ffqs.containsRate()) - fsqsReference.setCoupon (ffqs.rate()); - - if (ffqs.containsDerivedParBasisSpread()) fsqsDerived.setSpread (ffqs.derivedParBasisSpread()); - - if (ffqs.containsReferenceParBasisSpread()) - fsqsReference.setCouponBasis (ffqs.referenceParBasisSpread()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.state.estimator.PredictorResponseWeightConstraint prwcDerived = _floatDerived.fundingPRWC - (valParams, pricerParams, csqs, quotingParams, fsqsDerived); - - org.drip.state.estimator.PredictorResponseWeightConstraint prwcReference = _fixReference.fundingPRWC - (valParams, pricerParams, csqs, quotingParams, fsqsReference); - - if (null == prwcDerived && null == prwcReference) return null; - - org.drip.state.estimator.PredictorResponseWeightConstraint prwc = new - org.drip.state.estimator.PredictorResponseWeightConstraint(); - - if (!prwc.absorb (prwcDerived)) return null; - - if (!prwc.absorb (prwcReference)) return null; - - return !prwc.updateValue (dblPV) ? null : prwc; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint forwardPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams, - final org.drip.product.calib.ProductQuoteSet pqs) - { - if (null == valParams || valParams.valueDate() >= maturityDate().julian() || null == pqs || !(pqs - instanceof org.drip.product.calib.FixFloatQuoteSet)) - return null; - - double dblPV = 0.; - org.drip.product.calib.FixedStreamQuoteSet fsqsReference = null; - org.drip.product.calib.FloatingStreamQuoteSet fsqsDerived = null; - org.drip.product.calib.FixFloatQuoteSet ffqs = (org.drip.product.calib.FixFloatQuoteSet) pqs; - - if (!ffqs.containsPV() && !ffqs.containsSwapRate() && !ffqs.containsDerivedParBasisSpread() && - !ffqs.containsReferenceParBasisSpread()) - return null; - - org.drip.state.representation.LatentStateSpecification[] aLSS = pqs.lss(); - - try { - fsqsDerived = new org.drip.product.calib.FloatingStreamQuoteSet (aLSS); - - fsqsReference = new org.drip.product.calib.FixedStreamQuoteSet (aLSS); - - if (ffqs.containsPV()) dblPV = ffqs.pv(); - - if (ffqs.containsSwapRate()) fsqsReference.setCoupon (ffqs.swapRate()); - - if (ffqs.containsDerivedParBasisSpread()) fsqsDerived.setSpread (ffqs.derivedParBasisSpread()); - - if (ffqs.containsReferenceParBasisSpread()) - fsqsReference.setCouponBasis (ffqs.referenceParBasisSpread()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.state.estimator.PredictorResponseWeightConstraint prwcDerived = _floatDerived.forwardPRWC - (valParams, pricerParams, csqs, quotingParams, fsqsDerived); - - org.drip.state.estimator.PredictorResponseWeightConstraint prwcReference = _fixReference.forwardPRWC - (valParams, pricerParams, csqs, quotingParams, fsqsReference); - - if (null == prwcDerived && null == prwcReference) return null; - - org.drip.state.estimator.PredictorResponseWeightConstraint prwc = new - org.drip.state.estimator.PredictorResponseWeightConstraint(); - - if (!prwc.absorb (prwcDerived)) return null; - - if (!prwc.absorb (prwcReference)) return null; - - return !prwc.updateValue (dblPV) ? null : prwc; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fundingForwardPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams, - final org.drip.product.calib.ProductQuoteSet pqs) - { - if (null == valParams || valParams.valueDate() >= maturityDate().julian() || null == pqs || !(pqs - instanceof org.drip.product.calib.FixFloatQuoteSet)) - return null; - - double dblPV = 0.; - org.drip.product.calib.FixedStreamQuoteSet fsqsReference = null; - org.drip.product.calib.FloatingStreamQuoteSet fsqsDerived = null; - org.drip.product.calib.FixFloatQuoteSet ffqs = (org.drip.product.calib.FixFloatQuoteSet) pqs; - - if (!ffqs.containsPV() && !ffqs.containsSwapRate() && !ffqs.containsDerivedParBasisSpread() && - !ffqs.containsReferenceParBasisSpread()) - return null; - - org.drip.state.representation.LatentStateSpecification[] aLSS = pqs.lss(); - - try { - fsqsDerived = new org.drip.product.calib.FloatingStreamQuoteSet (aLSS); - - fsqsReference = new org.drip.product.calib.FixedStreamQuoteSet (aLSS); - - if (ffqs.containsPV()) dblPV = ffqs.pv(); - - if (ffqs.containsSwapRate()) - fsqsReference.setCoupon (ffqs.swapRate()); - else if (ffqs.containsRate()) - fsqsReference.setCoupon (ffqs.rate()); - - if (ffqs.containsDerivedParBasisSpread()) fsqsDerived.setSpread (ffqs.derivedParBasisSpread()); - - if (ffqs.containsReferenceParBasisSpread()) - fsqsReference.setCouponBasis (ffqs.referenceParBasisSpread()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.state.estimator.PredictorResponseWeightConstraint prwcDerived = - _floatDerived.fundingForwardPRWC (valParams, pricerParams, csqs, quotingParams, fsqsDerived); - - org.drip.state.estimator.PredictorResponseWeightConstraint prwcReference = - _fixReference.fundingForwardPRWC (valParams, pricerParams, csqs, quotingParams, fsqsReference); - - if (null == prwcDerived && null == prwcReference) return null; - - org.drip.state.estimator.PredictorResponseWeightConstraint prwc = new - org.drip.state.estimator.PredictorResponseWeightConstraint(); - - if (!prwc.absorb (prwcDerived)) return null; - - if (!prwc.absorb (prwcReference)) return null; - - return !prwc.updateValue (dblPV) ? null : prwc; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fxPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint govviePRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint volatilityPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap calibMeasures ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - { - return null; - } -} diff --git a/org/drip/product/rates/FloatFloatComponent.java b/org/drip/product/rates/FloatFloatComponent.java deleted file mode 100644 index 8b4c81a..0000000 --- a/org/drip/product/rates/FloatFloatComponent.java +++ /dev/null @@ -1,797 +0,0 @@ - -package org.drip.product.rates; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * FloatFloatComponent contains the implementation of the Float-Float Index Basis Swap product - * contract/valuation details. It is made off one Reference Floating stream and one Derived floating stream. - * It exports the following functionality: - * - Standard/Custom Constructor for the FloatFloatComponent - * - Dates: Effective, Maturity, Coupon dates and Product settlement Parameters - * - Coupon/Notional Outstanding as well as schedules - * - Retrieve the constituent floating streams - * - Market Parameters: Discount, Forward, Credit, Treasury Curves - * - Cash Flow Periods: Coupon flows and (Optionally) Loss Flows - * - Valuation: Named Measure Generation - * - Calibration: The codes and constraints generation - * - Jacobians: Quote/DF and PV/DF micro-Jacobian generation - * - Serialization into and de-serialization out of byte arrays - * - * @author Lakshmi Krishnamurthy - */ - -public class FloatFloatComponent extends org.drip.product.rates.DualStreamComponent { - private java.lang.String _strCode = ""; - private org.drip.product.rates.Stream _floatDerived = null; - private org.drip.product.rates.Stream _floatReference = null; - private org.drip.param.valuation.CashSettleParams _csp = null; - - /** - * Construct the FloatFloatComponent from the Reference and the Derived Floating Streams. - * - * @param floatReference The Reference Floating Stream (e.g., 6M LIBOR/EURIBOR Leg) - * @param floatDerived The Derived Floating Stream (e.g., 3M LIBOR/EURIBOR Leg) - * @param csp Cash Settle Parameters Instance - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public FloatFloatComponent ( - final org.drip.product.rates.Stream floatReference, - final org.drip.product.rates.Stream floatDerived, - final org.drip.param.valuation.CashSettleParams csp) - throws java.lang.Exception - { - if (null == (_floatReference = floatReference) || null == (_floatDerived = floatDerived)) - throw new java.lang.Exception ("FloatFloatComponent ctr: Invalid Inputs"); - - _csp = csp; - } - - @Override public void setPrimaryCode ( - final java.lang.String strCode) - { - _strCode = strCode; - } - - @Override public java.lang.String primaryCode() - { - return _strCode; - } - - @Override public java.lang.String name() - { - return _strCode; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap couponCurrency() - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapCouponCurrency = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapCouponCurrency.put ("DERIVED", _floatDerived.couponCurrency()); - - mapCouponCurrency.put ("REFERENCE", _floatReference.couponCurrency()); - - return mapCouponCurrency; - } - - @Override public java.lang.String payCurrency() - { - return _floatReference.payCurrency(); - } - - @Override public java.lang.String principalCurrency() - { - return null; - } - - @Override public double initialNotional() - throws java.lang.Exception - { - return _floatReference.initialNotional(); - } - - @Override public double notional ( - final int iDate) - throws java.lang.Exception - { - return _floatReference.notional (iDate); - } - - @Override public double notional ( - final int iDate1, - final int iDate2) - throws java.lang.Exception - { - return _floatReference.notional (iDate1, iDate2); - } - - @Override public org.drip.analytics.output.CompositePeriodCouponMetrics couponMetrics ( - final int iAccrualEndDate, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - return _floatReference.coupon (iAccrualEndDate, valParams, csqs); - } - - @Override public int freq() - { - return _floatReference.freq(); - } - - @Override public org.drip.state.identifier.CreditLabel creditLabel() - { - return null; - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - forwardLabel() - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapFRI = - new org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapFRI.put ("REFERENCE", _floatReference.forwardLabel()); - - mapFRI.put ("DERIVED", _floatDerived.forwardLabel()); - - return mapFRI; - } - - @Override public org.drip.state.identifier.FundingLabel fundingLabel() - { - return _floatReference.fundingLabel(); - } - - @Override public org.drip.state.identifier.GovvieLabel govvieLabel() - { - return org.drip.state.identifier.GovvieLabel.Standard (payCurrency()); - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap - fxLabel() - { - org.drip.state.identifier.FXLabel fxLabelReference = _floatReference.fxLabel(); - - org.drip.state.identifier.FXLabel fxLabelDerived = _floatDerived.fxLabel(); - - if (null != fxLabelReference && null != fxLabelDerived) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapFXLabel = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - if (null != fxLabelReference) mapFXLabel.put ("REFERENCE", fxLabelReference); - - if (null != fxLabelDerived) mapFXLabel.put ("DERIVED", fxLabelDerived); - - return mapFXLabel; - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - volatilityLabel() - { - return null; - } - - @Override public org.drip.product.rates.Stream referenceStream() - { - return _floatReference; - } - - @Override public org.drip.product.rates.Stream derivedStream() - { - return _floatDerived; - } - - @Override public org.drip.analytics.date.JulianDate effectiveDate() - { - org.drip.analytics.date.JulianDate dtFloatReferenceEffective = _floatReference.effective(); - - org.drip.analytics.date.JulianDate dtFloatDerivedEffective = _floatDerived.effective(); - - if (null == dtFloatReferenceEffective || null == dtFloatDerivedEffective) return null; - - return dtFloatReferenceEffective.julian() < dtFloatDerivedEffective.julian() ? - dtFloatReferenceEffective : dtFloatDerivedEffective; - } - - @Override public org.drip.analytics.date.JulianDate maturityDate() - { - org.drip.analytics.date.JulianDate dtFloatReferenceMaturity = _floatReference.maturity(); - - org.drip.analytics.date.JulianDate dtFloatDerivedMaturity = _floatDerived.maturity(); - - if (null == dtFloatReferenceMaturity || null == dtFloatDerivedMaturity) return null; - - return dtFloatReferenceMaturity.julian() > dtFloatDerivedMaturity.julian() ? - dtFloatReferenceMaturity : dtFloatDerivedMaturity; - } - - @Override public org.drip.analytics.date.JulianDate firstCouponDate() - { - org.drip.analytics.date.JulianDate dtFloatReferenceFirstCoupon = _floatReference.firstCouponDate(); - - org.drip.analytics.date.JulianDate dtFloatDerivedFirstCoupon = _floatDerived.firstCouponDate(); - - if (null == dtFloatReferenceFirstCoupon || null == dtFloatDerivedFirstCoupon) return null; - - return dtFloatReferenceFirstCoupon.julian() < dtFloatDerivedFirstCoupon.julian() ? - dtFloatReferenceFirstCoupon : dtFloatDerivedFirstCoupon; - } - - @Override public java.util.List couponPeriods() - { - java.util.List lsCP = new - java.util.ArrayList(); - - lsCP.addAll (_floatReference.cashFlowPeriod()); - - lsCP.addAll (_floatDerived.cashFlowPeriod()); - - return lsCP; - } - - @Override public org.drip.param.valuation.CashSettleParams cashSettleParams() - { - return _csp; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap value ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - long lStart = System.nanoTime(); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapFloatReferenceStreamResult = - _floatReference.value (valParams, pricerParams, csqs, vcp); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapFloatDerivedStreamResult = - _floatDerived.value (valParams, pricerParams, csqs, vcp); - - if (null == mapFloatReferenceStreamResult || 0 == mapFloatReferenceStreamResult.size() || null == - mapFloatDerivedStreamResult || 0 == mapFloatDerivedStreamResult.size()) - return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapResult = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - if (!org.drip.analytics.support.Helper.AccumulateMeasures (mapResult, - _floatReference.name(), mapFloatReferenceStreamResult)) - return null; - - if (!org.drip.analytics.support.Helper.AccumulateMeasures (mapResult, _floatDerived.name(), - mapFloatDerivedStreamResult)) - return null; - - mapResult.put ("ReferenceAccrued01", mapFloatReferenceStreamResult.get ("Accrued01")); - - mapResult.put ("ReferenceAccrued", mapFloatReferenceStreamResult.get ("FloatAccrued")); - - double dblReferenceCleanDV01 = mapFloatReferenceStreamResult.get ("CleanDV01"); - - mapResult.put ("ReferenceCleanDV01", dblReferenceCleanDV01); - - double dblReferenceCleanPV = mapFloatReferenceStreamResult.get ("CleanPV"); - - mapResult.put ("ReferenceCleanPV", dblReferenceCleanPV); - - mapResult.put ("ReferenceDirtyDV01", mapFloatReferenceStreamResult.get ("DirtyDV01")); - - double dblReferenceDirtyPV = mapFloatReferenceStreamResult.get ("DirtyPV"); - - mapResult.put ("ReferenceDirtyPV", dblReferenceDirtyPV); - - mapResult.put ("ReferenceDV01", mapFloatReferenceStreamResult.get ("DV01")); - - mapResult.put ("ReferenceFixing01", mapFloatReferenceStreamResult.get ("Fixing01")); - - double dblReferencePV = mapFloatReferenceStreamResult.get ("PV"); - - mapResult.put ("ReferencePV", dblReferencePV); - - mapResult.put ("ReferenceCumulativeConvexityAdjustmentFactor", mapFloatReferenceStreamResult.get - ("CumulativeConvexityAdjustmentFactor")); - - double dblReferenceCumulativeConvexityAdjustmentPremium = mapFloatReferenceStreamResult.get - ("CumulativeConvexityAdjustmentPremiumUpfront"); - - mapResult.put ("ReferenceCumulativeConvexityAdjustmentPremium", - dblReferenceCumulativeConvexityAdjustmentPremium); - - mapResult.put ("ReferenceResetDate", mapFloatReferenceStreamResult.get ("ResetDate")); - - mapResult.put ("ReferenceResetRate", mapFloatReferenceStreamResult.get ("ResetRate")); - - mapResult.put ("DerivedAccrued01", mapFloatDerivedStreamResult.get ("Accrued01")); - - mapResult.put ("DerivedAccrued", mapFloatDerivedStreamResult.get ("FloatAccrued")); - - double dblDerivedCleanDV01 = mapFloatDerivedStreamResult.get ("CleanDV01"); - - mapResult.put ("DerivedCleanDV01", dblDerivedCleanDV01); - - double dblDerivedCleanPV = mapFloatDerivedStreamResult.get ("CleanPV"); - - mapResult.put ("DerivedCleanPV", dblDerivedCleanPV); - - mapResult.put ("DerivedDirtyDV01", mapFloatDerivedStreamResult.get ("DirtyDV01")); - - double dblDerivedDirtyPV = mapFloatDerivedStreamResult.get ("DirtyPV"); - - mapResult.put ("DerivedDirtyPV", dblDerivedDirtyPV); - - mapResult.put ("DerivedDV01", mapFloatDerivedStreamResult.get ("DV01")); - - mapResult.put ("DerivedFixing01", mapFloatDerivedStreamResult.get ("Fixing01")); - - double dblDerivedPV = mapFloatDerivedStreamResult.get ("PV"); - - mapResult.put ("DerivedPV", dblDerivedPV); - - mapResult.put ("DerivedCumulativeConvexityAdjustmentFactor", mapFloatDerivedStreamResult.get - ("CumulativeConvexityAdjustmentFactor")); - - double dblDerivedCumulativeConvexityAdjustmentPremium = mapFloatDerivedStreamResult.get - ("CumulativeConvexityAdjustmentPremiumUpfront"); - - mapResult.put ("DerivedCumulativeConvexityAdjustmentPremium", - dblDerivedCumulativeConvexityAdjustmentPremium); - - mapResult.put ("DerivedResetDate", mapFloatDerivedStreamResult.get ("ResetDate")); - - mapResult.put ("DerivedResetRate", mapFloatDerivedStreamResult.get ("ResetRate")); - - double dblCleanPV = dblReferenceCleanPV + dblDerivedCleanPV; - - mapResult.put ("CleanPV", dblCleanPV); - - mapResult.put ("DirtyPV", dblDerivedCleanPV + dblDerivedDirtyPV); - - mapResult.put ("PV", dblReferencePV + dblDerivedPV); - - mapResult.put ("CumulativeConvexityAdjustmentPremium", _floatReference.initialNotional() * - dblReferenceCumulativeConvexityAdjustmentPremium + _floatDerived.initialNotional() * - dblDerivedCumulativeConvexityAdjustmentPremium); - - mapResult.put ("Upfront", mapFloatReferenceStreamResult.get ("Upfront") + - mapFloatDerivedStreamResult.get ("Upfront")); - - mapResult.put ("ReferenceParBasisSpread", -1. * (dblReferenceCleanPV + dblDerivedCleanPV) / - dblReferenceCleanDV01); - - mapResult.put ("DerivedParBasisSpread", -1. * (dblReferenceCleanPV + dblDerivedCleanPV) / - dblDerivedCleanDV01); - - double dblValueNotional = java.lang.Double.NaN; - - try { - dblValueNotional = notional (valParams.valueDate()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - try { - if (org.drip.quant.common.NumberUtil.IsValid (dblValueNotional)) { - double dblCleanPrice = 100. * (1. + (dblCleanPV / initialNotional() / dblValueNotional)); - - mapResult.put ("CleanPrice", dblCleanPrice); - - mapResult.put ("Price", dblCleanPrice); - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - mapResult.put ("CalcTime", (System.nanoTime() - lStart) * 1.e-09); - - return mapResult; - } - - @Override public java.util.Set measureNames() - { - java.util.Set setstrMeasureNames = new java.util.TreeSet(); - - setstrMeasureNames.add ("CalcTime"); - - setstrMeasureNames.add ("CleanPrice"); - - setstrMeasureNames.add ("CleanPV"); - - setstrMeasureNames.add ("DerivedAccrued01"); - - setstrMeasureNames.add ("DerivedAccrued"); - - setstrMeasureNames.add ("DerivedCleanDV01"); - - setstrMeasureNames.add ("DerivedCleanPV"); - - setstrMeasureNames.add ("DerivedDirtyDV01"); - - setstrMeasureNames.add ("DerivedDirtyPV"); - - setstrMeasureNames.add ("DerivedDV01"); - - setstrMeasureNames.add ("DerivedFixing01"); - - setstrMeasureNames.add ("DerivedParBasisSpread"); - - setstrMeasureNames.add ("DerivedPV"); - - setstrMeasureNames.add ("DerivedCumulativeConvexityAdjustmentFactor"); - - setstrMeasureNames.add ("DerivedCumulativeConvexityAdjustmentPremium"); - - setstrMeasureNames.add ("DerivedResetDate"); - - setstrMeasureNames.add ("DerivedResetRate"); - - setstrMeasureNames.add ("DirtyPV"); - - setstrMeasureNames.add ("Price"); - - setstrMeasureNames.add ("PV"); - - setstrMeasureNames.add ("CumulativeConvexityAdjustmentPremium"); - - setstrMeasureNames.add ("ReferenceAccrued01"); - - setstrMeasureNames.add ("ReferenceAccrued"); - - setstrMeasureNames.add ("ReferenceCleanDV01"); - - setstrMeasureNames.add ("ReferenceCleanPV"); - - setstrMeasureNames.add ("ReferenceDirtyDV01"); - - setstrMeasureNames.add ("ReferenceDirtyPV"); - - setstrMeasureNames.add ("ReferenceDV01"); - - setstrMeasureNames.add ("ReferenceFixing01"); - - setstrMeasureNames.add ("ReferenceParBasisSpread"); - - setstrMeasureNames.add ("ReferenceCumulativeConvexityAdjustmentFactor"); - - setstrMeasureNames.add ("ReferenceCumulativeConvexityAdjustmentPremium"); - - setstrMeasureNames.add ("ReferencePV"); - - setstrMeasureNames.add ("ReferenceResetDate"); - - setstrMeasureNames.add ("ReferenceResetRate"); - - setstrMeasureNames.add ("Upfront"); - - return setstrMeasureNames; - } - - @Override public double pv ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - throws java.lang.Exception - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapFloatReferenceStreamResult = - _floatReference.value (valParams, pricerParams, csqs, quotingParams); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapFloatDerivedStreamResult = - _floatDerived.value (valParams, pricerParams, csqs, quotingParams); - - if (null == mapFloatReferenceStreamResult || !mapFloatReferenceStreamResult.containsKey ("DirtyPV") - || null == mapFloatDerivedStreamResult || !mapFloatDerivedStreamResult.containsKey ("DirtyPV")) - throw new java.lang.Exception - ("FloatFloatComponent::pv => Cannot Compute Constituent Stream Value Metrics"); - - return mapFloatReferenceStreamResult.get ("DirtyPV") + mapFloatDerivedStreamResult.get ("DirtyPV"); - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDDirtyPVDManifestMeasure ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - { - return null; - } - - @Override public org.drip.quant.calculus.WengertJacobian manifestMeasureDFMicroJack ( - final java.lang.String strManifestMeasure, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - { - return null; - } - - @Override public org.drip.product.calib.ProductQuoteSet calibQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - { - try { - return new org.drip.product.calib.FloatFloatQuoteSet (aLSS); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fundingPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams, - final org.drip.product.calib.ProductQuoteSet pqs) - { - if (null == valParams || null == pqs || !(pqs instanceof org.drip.product.calib.FloatFloatQuoteSet)) - return null; - - if (valParams.valueDate() >= maturityDate().julian()) return null; - - double dblPV = 0.; - org.drip.product.calib.FloatingStreamQuoteSet fsqsDerived = null; - org.drip.product.calib.FloatingStreamQuoteSet fsqsReference = null; - org.drip.product.calib.FloatFloatQuoteSet ffqs = (org.drip.product.calib.FloatFloatQuoteSet) pqs; - - if (!ffqs.containsPV() && !ffqs.containsDerivedParBasisSpread() && - !ffqs.containsReferenceParBasisSpread()) - return null; - - org.drip.state.representation.LatentStateSpecification[] aLSS = pqs.lss(); - - try { - fsqsDerived = new org.drip.product.calib.FloatingStreamQuoteSet (aLSS); - - fsqsReference = new org.drip.product.calib.FloatingStreamQuoteSet (aLSS); - - if (ffqs.containsPV()) dblPV = ffqs.pv(); - - if (ffqs.containsDerivedParBasisSpread() && !fsqsDerived.setSpread - (ffqs.derivedParBasisSpread())) - return null; - - if (ffqs.containsReferenceParBasisSpread() && !fsqsReference.setSpread - (ffqs.referenceParBasisSpread())) - return null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.state.estimator.PredictorResponseWeightConstraint prwcDerived = _floatDerived.fundingPRWC - (valParams, pricerParams, csqs, quotingParams, fsqsDerived); - - org.drip.state.estimator.PredictorResponseWeightConstraint prwcReference = - _floatReference.fundingPRWC (valParams, pricerParams, csqs, quotingParams, fsqsReference); - - if (null == prwcDerived && null == prwcReference) return null; - - org.drip.state.estimator.PredictorResponseWeightConstraint prwc = new - org.drip.state.estimator.PredictorResponseWeightConstraint(); - - if (!prwc.absorb (prwcDerived)) return null; - - if (!prwc.absorb (prwcReference)) return null; - - return !prwc.updateValue (dblPV) ? null : prwc; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint forwardPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams, - final org.drip.product.calib.ProductQuoteSet pqs) - { - if (null == valParams || null == pqs || !(pqs instanceof org.drip.product.calib.FloatFloatQuoteSet)) - return null; - - if (valParams.valueDate() >= maturityDate().julian()) return null; - - double dblPV = 0.; - org.drip.product.calib.FloatingStreamQuoteSet fsqsDerived = null; - org.drip.product.calib.FloatingStreamQuoteSet fsqsReference = null; - org.drip.product.calib.FloatFloatQuoteSet ffqs = (org.drip.product.calib.FloatFloatQuoteSet) pqs; - - if (!ffqs.containsPV() && !ffqs.containsDerivedParBasisSpread() && - !ffqs.containsReferenceParBasisSpread()) - return null; - - org.drip.state.representation.LatentStateSpecification[] aLSS = pqs.lss(); - - try { - fsqsDerived = new org.drip.product.calib.FloatingStreamQuoteSet (aLSS); - - fsqsReference = new org.drip.product.calib.FloatingStreamQuoteSet (aLSS); - - if (ffqs.containsPV()) dblPV = ffqs.pv(); - - if (ffqs.containsDerivedParBasisSpread()) fsqsDerived.setSpread (ffqs.derivedParBasisSpread()); - - if (ffqs.containsReferenceParBasisSpread()) - fsqsReference.setSpread (ffqs.referenceParBasisSpread()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.state.estimator.PredictorResponseWeightConstraint prwcDerived = _floatDerived.forwardPRWC - (valParams, pricerParams, csqs, quotingParams, fsqsDerived); - - org.drip.state.estimator.PredictorResponseWeightConstraint prwcReference = - _floatReference.forwardPRWC (valParams, pricerParams, csqs, quotingParams, fsqsReference); - - if (null == prwcDerived && null == prwcReference) return null; - - org.drip.state.estimator.PredictorResponseWeightConstraint prwc = new - org.drip.state.estimator.PredictorResponseWeightConstraint(); - - if (!prwc.absorb (prwcDerived)) return null; - - if (!prwc.absorb (prwcReference)) return null; - - if (!prwc.updateValue (dblPV)) return null; - - return prwc; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fundingForwardPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams, - final org.drip.product.calib.ProductQuoteSet pqs) - { - if (null == valParams || null == pqs || !(pqs instanceof org.drip.product.calib.FloatFloatQuoteSet)) - return null; - - if (valParams.valueDate() >= maturityDate().julian()) return null; - - double dblPV = 0.; - org.drip.product.calib.FloatingStreamQuoteSet fsqsDerived = null; - org.drip.product.calib.FloatingStreamQuoteSet fsqsReference = null; - org.drip.product.calib.FloatFloatQuoteSet ffqs = (org.drip.product.calib.FloatFloatQuoteSet) pqs; - - if (!ffqs.containsPV() && !ffqs.containsDerivedParBasisSpread() && - !ffqs.containsReferenceParBasisSpread()) - return null; - - org.drip.state.representation.LatentStateSpecification[] aLSS = pqs.lss(); - - try { - fsqsDerived = new org.drip.product.calib.FloatingStreamQuoteSet (aLSS); - - fsqsReference = new org.drip.product.calib.FloatingStreamQuoteSet (aLSS); - - if (ffqs.containsPV()) dblPV = ffqs.pv(); - - if (ffqs.containsDerivedParBasisSpread() && !fsqsDerived.setSpread - (ffqs.derivedParBasisSpread())) - return null; - - if (ffqs.containsReferenceParBasisSpread() && !fsqsReference.setSpread - (ffqs.referenceParBasisSpread())) - return null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.state.estimator.PredictorResponseWeightConstraint prwcDerived = - _floatDerived.fundingForwardPRWC (valParams, pricerParams, csqs, quotingParams, fsqsDerived); - - org.drip.state.estimator.PredictorResponseWeightConstraint prwcReference = - _floatReference.fundingForwardPRWC (valParams, pricerParams, csqs, quotingParams, fsqsReference); - - if (null == prwcDerived && null == prwcReference) return null; - - org.drip.state.estimator.PredictorResponseWeightConstraint prwc = new - org.drip.state.estimator.PredictorResponseWeightConstraint(); - - if (!prwc.absorb (prwcDerived)) return null; - - if (!prwc.absorb (prwcReference)) return null; - - if (!prwc.updateValue (dblPV)) return null; - - return prwc; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fxPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint govviePRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint volatilityPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap calibMeasures ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - { - return null; - } -} diff --git a/org/drip/product/rates/RatesBasket.java b/org/drip/product/rates/RatesBasket.java deleted file mode 100644 index c9f0929..0000000 --- a/org/drip/product/rates/RatesBasket.java +++ /dev/null @@ -1,489 +0,0 @@ - -package org.drip.product.rates; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * RatesBasket contains the implementation of the Basket of Rates Component legs. RatesBasket is made from - * zero/more fixed and floating streams. It exports the following functionality: - * - Standard/Custom Constructor for the RatesBasket - * - Dates: Effective, Maturity, Coupon dates and Product settlement Parameters - * - Coupon/Notional Outstanding as well as schedules - * - Retrieve the constituent fixed and floating streams - * - Market Parameters: Discount, Forward, Credit, Treasury Curves - * - Cash Flow Periods: Coupon flows and (Optionally) Loss Flows - * - Valuation: Named Measure Generation - * - Calibration: The codes and constraints generation - * - Jacobians: Quote/DF and PV/DF micro-Jacobian generation - * - Serialization into and de-serialization out of byte arrays - * - * @author Lakshmi Krishnamurthy - */ - -public class RatesBasket extends org.drip.product.definition.CalibratableComponent { - private java.lang.String _strName = ""; - private org.drip.product.rates.Stream[] _aCompFixedStream = null; - private org.drip.product.rates.Stream[] _aCompFloatStream = null; - - /** - * RatesBasket constructor - * - * @param strName Basket Name - * @param aCompFixedStream Array of Fixed Stream Components - * @param aCompFloatStream Array of Float Stream Components - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public RatesBasket ( - final java.lang.String strName, - final org.drip.product.rates.Stream[] aCompFixedStream, - final org.drip.product.rates.Stream[] aCompFloatStream) - throws java.lang.Exception - { - if (null == (_strName = strName) || _strName.isEmpty() || null == (_aCompFixedStream = - aCompFixedStream) || 0 == _aCompFixedStream.length || null == (_aCompFloatStream = - aCompFloatStream) || 0 == _aCompFloatStream.length) - throw new java.lang.Exception ("RatesBasket ctr => Invalid Inputs"); - } - - @Override public java.lang.String name() - { - return _strName; - } - - @Override public java.lang.String primaryCode() - { - return _strName; - } - - - /** - * Retrieve the array of the fixed stream components - * - * @return The array of the fixed stream components - */ - - public org.drip.product.rates.Stream[] getFixedStreamComponents() - { - return _aCompFixedStream; - } - - /** - * Retrieve the array of the float stream components - * - * @return The array of the float stream components - */ - - public org.drip.product.rates.Stream[] getFloatStreamComponents() - { - return _aCompFloatStream; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap couponCurrency() - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapCouponCurrency = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - if (null != _aCompFixedStream) { - int iFixedStreamLength = _aCompFixedStream.length; - - if (0 != iFixedStreamLength) { - for (int i = 0; i < iFixedStreamLength; ++i) - mapCouponCurrency.put ("FIXED" + i, _aCompFixedStream[i].couponCurrency()); - } - } - - if (null != _aCompFloatStream) { - int iFloatStreamLength = _aCompFloatStream.length; - - if (0 != iFloatStreamLength) { - for (int i = 0; i < iFloatStreamLength; ++i) - mapCouponCurrency.put ("FLOAT" + i, _aCompFloatStream[i].couponCurrency()); - } - } - - return mapCouponCurrency; - } - - @Override public java.lang.String payCurrency() - { - if (null != _aCompFixedStream && 0 != _aCompFixedStream.length) - return _aCompFixedStream[0].payCurrency(); - - if (null != _aCompFloatStream && 0 != _aCompFloatStream.length) - return _aCompFloatStream[0].payCurrency(); - - return null; - } - - @Override public java.lang.String principalCurrency() - { - return null; - } - - @Override public org.drip.state.identifier.CreditLabel creditLabel() - { - if (null != _aCompFixedStream && 0 != _aCompFixedStream.length) { - for (org.drip.product.rates.Stream fixedStream : _aCompFixedStream) { - org.drip.state.identifier.CreditLabel creditLabel = fixedStream.creditLabel(); - - if (null != creditLabel) return creditLabel; - } - } - - if (null != _aCompFloatStream && 0 != _aCompFloatStream.length) { - for (org.drip.product.rates.Stream floatStream : _aCompFloatStream) { - org.drip.state.identifier.CreditLabel creditLabel = floatStream.creditLabel(); - - if (null != creditLabel) return creditLabel; - } - } - - return null; - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - forwardLabel() - { - int iNumFloatStream = null == _aCompFloatStream ? 0 : _aCompFloatStream.length; - - if (0 == iNumFloatStream) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapForwardLabel = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (int i = 0; i < iNumFloatStream; ++i) - mapForwardLabel.put ("FLOAT" + i, _aCompFloatStream[i].forwardLabel()); - - return mapForwardLabel; - } - - @Override public org.drip.state.identifier.FundingLabel fundingLabel() - { - return org.drip.state.identifier.FundingLabel.Standard (payCurrency()); - } - - @Override public org.drip.state.identifier.GovvieLabel govvieLabel() - { - return org.drip.state.identifier.GovvieLabel.Standard (payCurrency()); - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap - fxLabel() - { - int iNumFixedStream = null == _aCompFixedStream ? 0 : _aCompFixedStream.length; - int iNumFloatStream = null == _aCompFloatStream ? 0 : _aCompFloatStream.length; - - if (0 == iNumFixedStream && 0 == iNumFloatStream) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapFXLabel = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (int i = 0; i < iNumFixedStream; ++i) { - org.drip.state.identifier.FXLabel fxLabel = _aCompFixedStream[i].fxLabel(); - - if (null != fxLabel) mapFXLabel.put ("FIXED" + i, fxLabel); - } - - for (int i = 0; i < iNumFloatStream; ++i) { - org.drip.state.identifier.FXLabel fxLabel = _aCompFloatStream[i].fxLabel(); - - if (null != fxLabel) mapFXLabel.put ("FLOAT" + i, fxLabel); - } - - return mapFXLabel; - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - volatilityLabel() - { - return null; - } - - @Override public void setPrimaryCode ( - final java.lang.String strCode) - { - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDDirtyPVDManifestMeasure ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - { - return null; - } - - @Override public org.drip.quant.calculus.WengertJacobian manifestMeasureDFMicroJack ( - final java.lang.String strMainfestMeasure, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - { - return null; - } - - @Override public org.drip.product.calib.ProductQuoteSet calibQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fundingPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint forwardPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fundingForwardPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fxPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint govviePRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint volatilityPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public double initialNotional() - throws java.lang.Exception - { - return 0; - } - - @Override public double notional ( - final int iDate) - throws java.lang.Exception - { - return 0; - } - - @Override public double notional ( - final int iDate1, - final int iDate2) - throws java.lang.Exception - { - return 0; - } - - @Override public org.drip.analytics.output.CompositePeriodCouponMetrics couponMetrics ( - final int iAccrualEndDate, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - return null; - } - - @Override public int freq() - { - return 0; - } - - @Override public org.drip.analytics.date.JulianDate effectiveDate() - { - return null; - } - - @Override public org.drip.analytics.date.JulianDate maturityDate() - { - return null; - } - - @Override public org.drip.analytics.date.JulianDate firstCouponDate() - { - return null; - } - - @Override public java.util.List couponPeriods() - { - java.util.List lsCP = new - java.util.ArrayList(); - - if (null != _aCompFixedStream && 0 != _aCompFixedStream.length) { - for (org.drip.product.rates.Stream fixedStream : _aCompFixedStream) - lsCP.addAll (fixedStream.cashFlowPeriod()); - } - - if (null != _aCompFloatStream && 0 != _aCompFloatStream.length) { - for (org.drip.product.rates.Stream floatStream : _aCompFloatStream) - lsCP.addAll (floatStream.cashFlowPeriod()); - } - - return lsCP; - } - - @Override public org.drip.param.valuation.CashSettleParams cashSettleParams() - { - return null; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap value ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - { - long lStart = System.nanoTime(); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapResult = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - if (null != _aCompFixedStream && 0 != _aCompFixedStream.length) { - for (org.drip.product.rates.Stream fixedStream : _aCompFixedStream) { - org.drip.analytics.support.CaseInsensitiveTreeMap - mapFixedStreamResult = fixedStream.value (valParams, pricerParams, csqs, quotingParams); - - if (!org.drip.analytics.support.Helper.AccumulateMeasures (mapResult, - fixedStream.name(), mapFixedStreamResult)) - return null; - } - } - - if (null != _aCompFloatStream && 0 != _aCompFloatStream.length) { - for (org.drip.product.rates.Stream floatStream : _aCompFloatStream) { - org.drip.analytics.support.CaseInsensitiveTreeMap - mapFixedStreamResult = floatStream.value (valParams, pricerParams, csqs, quotingParams); - - if (!org.drip.analytics.support.Helper.AccumulateMeasures (mapResult, - floatStream.name(), mapFixedStreamResult)) - return null; - } - } - - mapResult.put ("CalcTime", (System.nanoTime() - lStart) * 1.e-09); - - return mapResult; - } - - @Override public java.util.Set measureNames() - { - return null; - } - - @Override public double pv ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - throws java.lang.Exception - { - double dblDirtyPV = 0.; - - if (null != _aCompFixedStream && 0 != _aCompFixedStream.length) { - for (org.drip.product.rates.Stream fixedStream : _aCompFixedStream) - dblDirtyPV += fixedStream.pv (valParams, pricerParams, csqc, vcp); - } - - if (null != _aCompFloatStream && 0 != _aCompFloatStream.length) { - for (org.drip.product.rates.Stream floatStream : _aCompFloatStream) - dblDirtyPV += floatStream.pv (valParams, pricerParams, csqc, vcp); - } - - return dblDirtyPV; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap calibMeasures ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - { - return null; - } -} diff --git a/org/drip/product/rates/SingleStreamComponent.java b/org/drip/product/rates/SingleStreamComponent.java deleted file mode 100644 index bb1c04d..0000000 --- a/org/drip/product/rates/SingleStreamComponent.java +++ /dev/null @@ -1,466 +0,0 @@ - -package org.drip.product.rates; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * SingleStreamComponent implements fixed income component that is based off of a single stream. - * - * @author Lakshmi Krishnamurthy - */ - -public class SingleStreamComponent extends org.drip.product.definition.CalibratableComponent { - private java.lang.String _strCode = ""; - private java.lang.String _strName = ""; - private org.drip.product.rates.Stream _stream = null; - private org.drip.param.valuation.CashSettleParams _csp = null; - - /** - * SingleStreamComponent constructor - * - * @param strName The Component Name - * @param stream The Single Stream Instance - * @param csp Cash Settle Parameters Instance - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public SingleStreamComponent ( - final java.lang.String strName, - final org.drip.product.rates.Stream stream, - final org.drip.param.valuation.CashSettleParams csp) - throws java.lang.Exception - { - if (null == (_strName = strName) || _strName.isEmpty() || null == (_stream = stream)) - throw new java.lang.Exception ("SingleStreamComponent ctr: Invalid Inputs"); - - _csp = csp; - } - - /** - * Retrieve the Stream Instance - * - * @return The Stream Instance - */ - - public org.drip.product.rates.Stream stream() - { - return _stream; - } - - @Override public java.lang.String name() - { - return _strName; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap couponCurrency() - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapCouponCurrency = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapCouponCurrency.put (name(), _stream.couponCurrency()); - - return mapCouponCurrency; - } - - @Override public java.lang.String payCurrency() - { - return _stream.payCurrency(); - } - - @Override public java.lang.String principalCurrency() - { - return null; - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - forwardLabel() - { - org.drip.state.identifier.ForwardLabel forwardLabel = _stream.forwardLabel(); - - if (null == forwardLabel) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapFRI = - new org.drip.analytics.support.CaseInsensitiveTreeMap (); - - mapFRI.put ("DERIVED", forwardLabel); - - return mapFRI; - } - - @Override public org.drip.state.identifier.FundingLabel fundingLabel() - { - return _stream.fundingLabel(); - } - - @Override public org.drip.state.identifier.GovvieLabel govvieLabel() - { - return org.drip.state.identifier.GovvieLabel.Standard (payCurrency()); - } - - @Override public org.drip.state.identifier.CreditLabel creditLabel() - { - return _stream.creditLabel(); - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap - fxLabel() - { - org.drip.state.identifier.FXLabel fxLabel = _stream.fxLabel(); - - if (null == fxLabel) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapFXLabel = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapFXLabel.put (name(), fxLabel); - - return mapFXLabel; - } - - @Override public - org.drip.analytics.support.CaseInsensitiveTreeMap - volatilityLabel() - { - return null; - } - - @Override public double initialNotional() - throws java.lang.Exception - { - return _stream.initialNotional(); - } - - @Override public double notional ( - final int iDate) - throws java.lang.Exception - { - return _stream.notional (iDate); - } - - @Override public double notional ( - final int iDate1, - final int iDate2) - throws java.lang.Exception - { - return _stream.notional (iDate1, iDate2); - } - - @Override public org.drip.analytics.output.CompositePeriodCouponMetrics couponMetrics ( - final int iAccrualEndDate, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - return _stream.coupon (iAccrualEndDate, valParams, csqs); - } - - @Override public int freq() - { - return _stream.freq(); - } - - @Override public org.drip.analytics.date.JulianDate effectiveDate() - { - return _stream.effective(); - } - - @Override public org.drip.analytics.date.JulianDate maturityDate() - { - return _stream.maturity(); - } - - @Override public org.drip.analytics.date.JulianDate firstCouponDate() - { - return _stream.firstCouponDate(); - } - - @Override public java.util.List couponPeriods() - { - return _stream.cashFlowPeriod(); - } - - @Override public org.drip.param.valuation.CashSettleParams cashSettleParams() - { - return _csp; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap value ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapResult = _stream.value - (valParams, pricerParams, csqs, quotingParams); - - mapResult.put ("ForwardRate", mapResult.get ("Rate")); - - return mapResult; - } - - @Override public java.util.Set measureNames() - { - java.util.Set setMeasureNames = _stream.availableMeasures(); - - setMeasureNames.add ("ForwardRate"); - - return setMeasureNames; - } - - @Override public double pv ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - throws java.lang.Exception - { - return _stream.pv (valParams, pricerParams, csqc, vcp); - } - - @Override public void setPrimaryCode ( - final java.lang.String strCode) - { - _strCode = strCode; - } - - @Override public java.lang.String primaryCode() - { - return _strCode; - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDDirtyPVDManifestMeasure ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - { - if (null == valParams || valParams.valueDate() >= maturityDate().julian() || null == csqs) - return null; - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqs.fundingState (fundingLabel()); - - if (null == dcFunding) return null; - - try { - org.drip.analytics.support.CaseInsensitiveTreeMap mapMeasures = value - (valParams, pricerParams, csqs, quotingParams); - - if (null == mapMeasures) return null; - - int iEffectiveDate = effectiveDate().julian(); - - double dblDFEffective = dcFunding.df (iEffectiveDate); - - double dblDFMaturity = dcFunding.df (maturityDate().julian()); - - org.drip.quant.calculus.WengertJacobian wjDFEffective = dcFunding.jackDDFDManifestMeasure - (iEffectiveDate, "Rate"); - - org.drip.quant.calculus.WengertJacobian wjDFMaturity = dcFunding.jackDDFDManifestMeasure - (maturityDate().julian(), "Rate"); - - if (null == wjDFEffective || null == wjDFMaturity) return null; - - org.drip.quant.calculus.WengertJacobian wjPVDFMicroJack = new - org.drip.quant.calculus.WengertJacobian (1, wjDFMaturity.numParameters()); - - for (int i = 0; i < wjDFMaturity.numParameters(); ++i) { - if (!wjPVDFMicroJack.accumulatePartialFirstDerivative (0, i, wjDFMaturity.firstDerivative (0, - i) / dblDFEffective)) - return null; - - if (!wjPVDFMicroJack.accumulatePartialFirstDerivative (0, i, -wjDFEffective.firstDerivative - (0, i) * dblDFMaturity / dblDFEffective / dblDFEffective)) - return null; - } - - return wjPVDFMicroJack; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.quant.calculus.WengertJacobian manifestMeasureDFMicroJack ( - final java.lang.String strManifestMeasure, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - { - if (null == valParams || valParams.valueDate() >= maturityDate().julian() || null == - strManifestMeasure || strManifestMeasure.isEmpty() || null == csqs) - return null; - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqs.fundingState (fundingLabel()); - - if (null == dcFunding) return null; - - if ("Rate".equalsIgnoreCase (strManifestMeasure)) { - int iEffectiveDate = effectiveDate().julian(); - - try { - double dblDFEffective = dcFunding.df (iEffectiveDate); - - double dblDFMaturity = dcFunding.df (maturityDate().julian()); - - org.drip.quant.calculus.WengertJacobian wjDFEffective = dcFunding.jackDDFDManifestMeasure - (iEffectiveDate, "Rate"); - - org.drip.quant.calculus.WengertJacobian wjDFMaturity = dcFunding.jackDDFDManifestMeasure - (maturityDate().julian(), "Rate"); - - if (null == wjDFEffective || null == wjDFMaturity) return null; - - org.drip.quant.calculus.WengertJacobian wjDFMicroJack = new - org.drip.quant.calculus.WengertJacobian (1, wjDFMaturity.numParameters()); - - for (int i = 0; i < wjDFMaturity.numParameters(); ++i) { - if (!wjDFMicroJack.accumulatePartialFirstDerivative (0, i, - wjDFMaturity.firstDerivative (0, i) / dblDFEffective)) - return null; - - if (!wjDFMicroJack.accumulatePartialFirstDerivative (0, i, -1. * - wjDFEffective.firstDerivative (0, i) * dblDFMaturity / dblDFEffective / - dblDFEffective)) - return null; - } - - return wjDFMicroJack; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - } - - return null; - } - - @Override public org.drip.product.calib.ProductQuoteSet calibQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - { - try { - return new org.drip.product.calib.FloatingStreamQuoteSet (aLSS); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint forwardPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return _stream.forwardPRWC (valParams, pricerParams, csqs, vcp, pqs); - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fundingPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return _stream.fundingPRWC (valParams, pricerParams, csqs, vcp, pqs); - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fundingForwardPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return _stream.fundingForwardPRWC (valParams, pricerParams, csqs, vcp, pqs); - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint fxPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return _stream.fxPRWC (valParams, pricerParams, csqs, vcp, pqs); - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint govviePRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.state.estimator.PredictorResponseWeightConstraint volatilityPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap calibMeasures ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - { - return null; - } -} diff --git a/org/drip/product/rates/Stream.java b/org/drip/product/rates/Stream.java deleted file mode 100644 index bdeba0a..0000000 --- a/org/drip/product/rates/Stream.java +++ /dev/null @@ -1,1934 +0,0 @@ - -package org.drip.product.rates; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * Stream implements the fixed and the floating streams. - * - * @author Lakshmi Krishnamurthy - */ - -public class Stream { - private java.util.List _lsPeriod = null; - - private double fxAdjustedNotional ( - final int iDate, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - throws java.lang.Exception - { - org.drip.analytics.cashflow.CompositePeriod cpLeft = _lsPeriod.get (0); - - int iLeftStartDate = cpLeft.startDate(); - - if (iDate <= iLeftStartDate) - return cpLeft.notional (iLeftStartDate) * cpLeft.couponFactor (iLeftStartDate) * cpLeft.fx - (csqs); - - for (org.drip.analytics.cashflow.CompositePeriod cp : _lsPeriod) { - if (cp.contains (iDate)) - return cp.notional (iDate) * cp.couponFactor (iDate) * cp.fx (csqs); - } - - org.drip.analytics.cashflow.CompositePeriod cpRight = _lsPeriod.get (_lsPeriod.size() - 1); - - int iRightEndDate = cpRight.endDate(); - - return cpRight.notional (iRightEndDate) * cpRight.couponFactor (iRightEndDate) * cpRight.fx (csqs); - } - - /** - * Stream constructor - * - * @param lsPeriod List of the Coupon Periods - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public Stream ( - final java.util.List lsPeriod) - throws java.lang.Exception - { - if (null == (_lsPeriod = lsPeriod) || 0 == _lsPeriod.size()) - throw new java.lang.Exception ("Stream ctr => Invalid Input params!"); - } - - /** - * Retrieve a list of the component's coupon periods - * - * @return List of Coupon Period - */ - - public java.util.List periods() - { - return _lsPeriod; - } - - /** - * Retrieve the Stream Frequency - * - * @return The Stream Frequency - */ - - public int freq() - { - return _lsPeriod.get (0).freq(); - } - - /** - * Retrieve the Coupon Day Count - * - * @return The Coupon Day Count - */ - - public java.lang.String couponDC() - { - return _lsPeriod.get (0).periods().get (0).couponDC(); - } - - /** - * Retrieve the Coupon EOM Adjustment - * - * @return The Coupon EOM Adjustment - */ - - public boolean couponEOMAdjustment() - { - return _lsPeriod.get (0).periods().get (0).couponEOMAdjustment(); - } - - /** - * Retrieve the Calendar - * - * @return The Calendar - */ - - public java.lang.String calendar() - { - return _lsPeriod.get (0).periods().get (0).calendar(); - } - - /** - * Retrieve the Accrual Day Count - * - * @return The Accrual Day Count - */ - - public java.lang.String accrualDC() - { - return _lsPeriod.get (0).periods().get (0).accrualDC(); - } - - /** - * Retrieve the Accrual EOM Adjustment - * - * @return The Accrual EOM Adjustment - */ - - public boolean accrualEOMAdjustment() - { - return _lsPeriod.get (0).periods().get (0).accrualEOMAdjustment(); - } - - /** - * Retrieve the Credit Label - * - * @return The Credit Label - */ - - public org.drip.state.identifier.CreditLabel creditLabel() - { - return _lsPeriod.get (0).creditLabel(); - } - - /** - * Retrieve the Forward Label - * - * @return The Forward Label - */ - - public org.drip.state.identifier.ForwardLabel forwardLabel() - { - return _lsPeriod.get (0).forwardLabel(); - } - - /** - * Retrieve the Funding Label - * - * @return The Funding Label - */ - - public org.drip.state.identifier.FundingLabel fundingLabel() - { - return _lsPeriod.get (0).fundingLabel(); - } - - /** - * Retrieve the FX Label - * - * @return The FX Label - */ - - public org.drip.state.identifier.FXLabel fxLabel() - { - return _lsPeriod.get (0).fxLabel(); - } - - /** - * Retrieve the Coupon Period List - * - * @return The Coupon Period List - */ - - public java.util.List cashFlowPeriod() - { - return _lsPeriod; - } - - /** - * Retrieve the Period Instance enveloping the specified Date - * - * @param iDate The Date - * - * @return The Period Instance enveloping the specified Date - */ - - public org.drip.analytics.cashflow.CompositePeriod containingPeriod ( - final int iDate) - { - try { - for (org.drip.analytics.cashflow.CompositePeriod cp : _lsPeriod) { - if (cp.contains (iDate)) return cp; - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Initial Notional - * - * @return The Initial Notional - */ - - public double initialNotional() - { - return _lsPeriod.get (0).baseNotional(); - } - - /** - * Retrieve the Notional corresponding to the specified Date - * - * @param iDate The Date - * - * @return The Notional corresponding to the specified Date - * - * @throws java.lang.Exception Thrown if the Notional cannot be computed - */ - - public double notional ( - final int iDate) - throws java.lang.Exception - { - int iEffectiveDate = effective().julian(); - - int iAdjustedDate = iEffectiveDate > iDate ? iEffectiveDate : iDate; - - org.drip.analytics.cashflow.CompositePeriod cp = containingPeriod (iAdjustedDate); - - if (null == cp) throw new java.lang.Exception ("Stream::notional => Invalid Input"); - - return cp.notional (iAdjustedDate); - } - - /** - * Retrieve the Notional aggregated over the Date Pairs - * - * @param iDate1 The Date #1 - * @param iDate2 The Date #2 - * - * @return The Notional aggregated over the Date Pairs - * - * @throws java.lang.Exception Thrown if the Notional cannot be computed - */ - - public double notional ( - final int iDate1, - final int iDate2) - throws java.lang.Exception - { - org.drip.analytics.cashflow.CompositePeriod cp = containingPeriod (iDate1); - - if (null == cp || !cp.contains (iDate2)) - throw new java.lang.Exception ("Stream::notional => Invalid Inputs"); - - org.drip.quant.common.Array2D notlSchedule = cp.notionalSchedule(); - - return initialNotional() * (null == notlSchedule ? 1. : notlSchedule.y (iDate1, iDate2)); - } - - /** - * Retrieve the Effective Date - * - * @return The Effective Date - */ - - public org.drip.analytics.date.JulianDate effective() - { - try { - return new org.drip.analytics.date.JulianDate (_lsPeriod.get (0).startDate()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Maturity Date - * - * @return The Maturity Date - */ - - public org.drip.analytics.date.JulianDate maturity() - { - try { - return new org.drip.analytics.date.JulianDate (_lsPeriod.get (_lsPeriod.size() - 1).endDate()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the First Coupon Pay Date - * - * @return The First Coupon Pay Date - */ - - public org.drip.analytics.date.JulianDate firstCouponDate() - { - try { - return new org.drip.analytics.date.JulianDate (_lsPeriod.get (0).endDate()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Coupon Currency - * - * @return The Coupon Currency - */ - - public java.lang.String couponCurrency() - { - return _lsPeriod.get (_lsPeriod.size() - 1).couponCurrency(); - } - - /** - * Retrieve the Pay Currency - * - * @return The Pay Currency - */ - - public java.lang.String payCurrency() - { - return _lsPeriod.get (_lsPeriod.size() - 1).payCurrency(); - } - - /** - * Retrieve the Cash Flow Currency Set - * - * @return The Cash Flow Currency Set - */ - - public java.util.Set cashflowCurrencySet() - { - java.util.Set setCcy = new java.util.HashSet(); - - setCcy.add (payCurrency()); - - setCcy.add (couponCurrency()); - - return setCcy; - } - - /** - * Retrieve the Stream Name - * - * @return The Stream Name - */ - - public java.lang.String name() - { - org.drip.state.identifier.ForwardLabel forwardLabel = forwardLabel(); - - java.lang.String strTrailer = "::{" + effective() + "->" + maturity() + "}"; - - if (null != forwardLabel) - return "FLOATSTREAM::" + payCurrency() + "::" + forwardLabel.fullyQualifiedName() + strTrailer; - - return "FIXEDSTREAM::" + payCurrency() + "/" + couponCurrency() + "::" + (12 / freq()) + strTrailer; - } - - /** - * Get the Coupon Metrics for the period corresponding to the specified accrual end date - * - * @param iAccrualEndDate The Accrual End Date - * @param valParams Valuation parameters - * @param csqs Market Parameters - * - * @return The Coupon Metrics for the period corresponding to the specified accrual end date - */ - - public org.drip.analytics.output.CompositePeriodCouponMetrics coupon ( - final int iAccrualEndDate, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - if (null == valParams) return null; - - org.drip.analytics.cashflow.CompositePeriod cp = containingPeriod (iAccrualEndDate); - - return null == cp ? null : cp.couponMetrics (valParams.valueDate(), csqs); - } - - /** - * Generate the Calibration Quote Set corresponding to the specified Latent State Array - * - * @param aLSS The Latent State Array - * - * @return The Calibration Quote Set corresponding to the specified Latent State Array - */ - - public org.drip.product.calib.ProductQuoteSet calibQuoteSet ( - final org.drip.state.representation.LatentStateSpecification[] aLSS) - { - try { - return null == forwardLabel() ? new org.drip.product.calib.FixedStreamQuoteSet (aLSS) : new - org.drip.product.calib.FloatingStreamQuoteSet (aLSS); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Stream Coupon Basis - * - * @return The Stream Coupon Basis - */ - - public double basis() - { - return _lsPeriod.get (0).basis(); - } - - /** - * Generate a Value Map for the Stream - * - * @param valParams The Valuation Parameters - * @param pricerParams The Pricer parameters - * @param csqs The Market Parameters - * @param vcp Valuation Customization Parameters - * - * @return The Value Map for the Stream - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap value ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == valParams || null == csqs) return null; - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqs.fundingState (fundingLabel()); - - if (null == dcFunding) return null; - - long lStart = System.nanoTime(); - - int iValueDate = valParams.valueDate(); - - double dblAccrued01 = 0.; - double dblTotalCoupon = 0.; - double dblCumulativeCouponDCF = 0.; - double dblCumulativeCouponAmount = 0.; - double dblAccrualCoupon = java.lang.Double.NaN; - double dblUnadjustedDirtyPV = 0.; - double dblUnadjustedDirtyDV01 = 0.; - double dblCompoundingAdjustedDirtyPV = 0.; - double dblCompoundingAdjustedDirtyDV01 = 0.; - double dblCashPayDF = java.lang.Double.NaN; - int iResetDate = java.lang.Integer.MIN_VALUE; - double dblFXAdjustedValueNotional = java.lang.Double.NaN; - double dblCreditForwardConvexityAdjustedDirtyPV = 0.; - double dblCreditForwardConvexityAdjustedDirtyDV01 = 0.; - double dblCreditFundingConvexityAdjustedDirtyPV = 0.; - double dblCreditFundingConvexityAdjustedDirtyDV01 = 0.; - double dblCreditFXConvexityAdjustedDirtyPV = 0.; - double dblCreditFXConvexityAdjustedDirtyDV01 = 0.; - double dblCumulativeConvexityAdjustedDirtyPV = 0.; - double dblCumulativeConvexityAdjustedDirtyDV01 = 0.; - double dblForwardFundingConvexityAdjustedDirtyPV = 0.; - double dblForwardFundingConvexityAdjustedDirtyDV01 = 0.; - double dblForwardFXConvexityAdjustedDirtyPV = 0.; - double dblForwardFXConvexityAdjustedDirtyDV01 = 0.; - double dblFundingFXConvexityAdjustedDirtyPV = 0.; - double dblFundingFXConvexityAdjustedDirtyDV01 = 0.; - - for (org.drip.analytics.cashflow.CompositePeriod period : _lsPeriod) { - double dblPeriodFX = java.lang.Double.NaN; - double dblPeriodNotional = java.lang.Double.NaN; - double dblUnadjustedDirtyPeriodDV01 = java.lang.Double.NaN; - - int iPeriodPayDate = period.payDate(); - - int iPeriodEndDate = period.endDate(); - - try { - dblPeriodNotional = period.notional (iPeriodEndDate) * period.couponFactor (iPeriodEndDate); - - dblPeriodFX = period.fx (csqs); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (iPeriodPayDate < iValueDate) { - org.drip.analytics.output.CompositePeriodCouponMetrics cpcm = period.couponMetrics - (iPeriodEndDate, csqs); - - if (null == cpcm) return null; - - double dblPeriodDCF = cpcm.dcf(); - - dblCumulativeCouponDCF += dblPeriodDCF; - - dblCumulativeCouponAmount += dblPeriodNotional * dblPeriodFX * cpcm.rate() * dblPeriodDCF; - - continue; - } - - org.drip.analytics.output.CompositePeriodCouponMetrics cpcm = period.couponMetrics (iValueDate, - csqs); - - if (null == cpcm) return null; - - double dblPeriodDCF = cpcm.dcf(); - - double dblPeriodFullRate = cpcm.rate(); - - org.drip.analytics.output.CompositePeriodAccrualMetrics cpam = period.accrualMetrics (iValueDate, - csqs); - - try { - if (null != cpam) { - dblAccrualCoupon = cpam.rate(); - - iResetDate = cpam.resetDate(); - - double dblPeriodAccrualDCF = cpam.dcf(); - - dblCumulativeCouponDCF += dblPeriodAccrualDCF; - dblAccrued01 = 0.0001 * dblPeriodAccrualDCF * dblPeriodNotional * dblPeriodFX; - - dblCumulativeCouponAmount += dblPeriodNotional * dblPeriodFX * dblAccrualCoupon * - dblPeriodAccrualDCF; - } - - dblUnadjustedDirtyPeriodDV01 = 0.0001 * dblPeriodDCF * dblPeriodNotional * dblPeriodFX * - period.survival (csqs) * period.df (csqs); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - double dblCompoundingAdjustedDirtyPeriodDV01 = dblUnadjustedDirtyPeriodDV01 * cpcm.compounding(); - - double dblCreditForwardConvexityAdjustedDirtyPeriodDV01 = dblUnadjustedDirtyPeriodDV01 * - cpcm.creditForward(); - - double dblCreditFundingConvexityAdjustedDirtyPeriodDV01 = dblUnadjustedDirtyPeriodDV01 * - cpcm.creditFunding(); - - double dblCreditFXConvexityAdjustedDirtyPeriodDV01 = dblUnadjustedDirtyPeriodDV01 * - cpcm.creditFX(); - - double dblCumulativeConvexityAdjustedDirtyPeriodDV01 = dblUnadjustedDirtyPeriodDV01 * - cpcm.cumulative(); - - double dblForwardFundingConvexityAdjustedDirtyPeriodDV01 = dblUnadjustedDirtyPeriodDV01 * - cpcm.forwardFunding(); - - double dblForwardFXConvexityAdjustedDirtyPeriodDV01 = dblUnadjustedDirtyPeriodDV01 * - cpcm.forwardFX(); - - double dblFundingFXConvexityAdjustedDirtyPeriodDV01 = dblUnadjustedDirtyPeriodDV01 * - cpcm.fundingFX(); - - dblTotalCoupon += dblPeriodFullRate; - dblUnadjustedDirtyDV01 += dblUnadjustedDirtyPeriodDV01; - dblUnadjustedDirtyPV += dblUnadjustedDirtyPeriodDV01 * 10000. * dblPeriodFullRate; - dblCompoundingAdjustedDirtyDV01 += dblCompoundingAdjustedDirtyPeriodDV01; - dblCompoundingAdjustedDirtyPV += dblCompoundingAdjustedDirtyPeriodDV01 * 10000. * - dblPeriodFullRate; - dblCreditForwardConvexityAdjustedDirtyDV01 += dblCreditForwardConvexityAdjustedDirtyPeriodDV01; - dblCreditForwardConvexityAdjustedDirtyPV += dblCreditForwardConvexityAdjustedDirtyPeriodDV01 * - 10000. * dblPeriodFullRate; - dblCreditFundingConvexityAdjustedDirtyDV01 += dblCreditFundingConvexityAdjustedDirtyPeriodDV01; - dblCreditFundingConvexityAdjustedDirtyPV += dblCreditFundingConvexityAdjustedDirtyPeriodDV01 * - 10000. * dblPeriodFullRate; - dblCreditFXConvexityAdjustedDirtyDV01 += dblCreditFXConvexityAdjustedDirtyPeriodDV01; - dblCreditFXConvexityAdjustedDirtyPV += dblCreditFXConvexityAdjustedDirtyPeriodDV01 * 10000. * - dblPeriodFullRate; - dblCumulativeConvexityAdjustedDirtyDV01 += dblCumulativeConvexityAdjustedDirtyPeriodDV01; - dblCumulativeConvexityAdjustedDirtyPV += dblCumulativeConvexityAdjustedDirtyPeriodDV01 * 10000. * - dblPeriodFullRate; - dblForwardFundingConvexityAdjustedDirtyDV01 += dblForwardFundingConvexityAdjustedDirtyPeriodDV01; - dblForwardFundingConvexityAdjustedDirtyPV += dblForwardFundingConvexityAdjustedDirtyPeriodDV01 * - 10000. * dblPeriodFullRate; - dblForwardFXConvexityAdjustedDirtyDV01 += dblForwardFXConvexityAdjustedDirtyPeriodDV01; - dblForwardFXConvexityAdjustedDirtyPV += dblForwardFXConvexityAdjustedDirtyPeriodDV01 * 10000. * - dblPeriodFullRate; - dblFundingFXConvexityAdjustedDirtyDV01 += dblFundingFXConvexityAdjustedDirtyPeriodDV01; - dblFundingFXConvexityAdjustedDirtyPV += dblFundingFXConvexityAdjustedDirtyPeriodDV01 * 10000. * - dblPeriodFullRate; - } - - try { - dblCashPayDF = dcFunding.df (iValueDate); - - dblFXAdjustedValueNotional = fxAdjustedNotional (iValueDate, csqs); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - dblUnadjustedDirtyPV /= dblCashPayDF; - dblUnadjustedDirtyDV01 /= dblCashPayDF; - dblCompoundingAdjustedDirtyPV /= dblCashPayDF; - dblCompoundingAdjustedDirtyDV01 /= dblCashPayDF; - dblCreditForwardConvexityAdjustedDirtyPV /= dblCashPayDF; - dblCreditForwardConvexityAdjustedDirtyDV01 /= dblCashPayDF; - dblCreditFundingConvexityAdjustedDirtyPV /= dblCashPayDF; - dblCreditFundingConvexityAdjustedDirtyDV01 /= dblCashPayDF; - dblCreditFXConvexityAdjustedDirtyPV /= dblCashPayDF; - dblCreditFXConvexityAdjustedDirtyDV01 /= dblCashPayDF; - dblCumulativeConvexityAdjustedDirtyPV /= dblCashPayDF; - dblCumulativeConvexityAdjustedDirtyDV01 /= dblCashPayDF; - dblForwardFundingConvexityAdjustedDirtyPV /= dblCashPayDF; - dblForwardFundingConvexityAdjustedDirtyDV01 /= dblCashPayDF; - dblForwardFXConvexityAdjustedDirtyPV /= dblCashPayDF; - dblForwardFXConvexityAdjustedDirtyDV01 /= dblCashPayDF; - dblFundingFXConvexityAdjustedDirtyPV /= dblCashPayDF; - dblFundingFXConvexityAdjustedDirtyDV01 /= dblCashPayDF; - double dblAccrued = 0. == dblAccrued01 ? 0. : dblAccrued01 * 10000. * dblAccrualCoupon; - double dblUnadjustedCleanPV = dblUnadjustedDirtyPV - dblAccrued; - double dblUnadjustedCleanDV01 = dblUnadjustedDirtyDV01 - dblAccrued01; - double dblUnadjustedFairPremium = 0.0001 * dblUnadjustedCleanPV / dblUnadjustedCleanDV01; - double dblCompoundingAdjustedCleanPV = dblCompoundingAdjustedDirtyPV - dblAccrued; - double dblCompoundingAdjustedCleanDV01 = dblCompoundingAdjustedDirtyDV01 - dblAccrued01; - double dblCompoundingAdjustedFairPremium = 0.0001 * dblCompoundingAdjustedCleanPV / - dblCompoundingAdjustedCleanDV01; - double dblCreditForwardConvexityAdjustedCleanPV = dblCreditForwardConvexityAdjustedDirtyPV - - dblAccrued; - double dblCreditForwardConvexityAdjustedCleanDV01 = dblCreditForwardConvexityAdjustedDirtyDV01 - - dblAccrued01; - double dblCreditForwardConvexityAdjustedFairPremium = 0.0001 * - dblCreditForwardConvexityAdjustedCleanPV / dblCreditForwardConvexityAdjustedCleanDV01; - double dblCreditFundingConvexityAdjustedCleanPV = dblCreditFundingConvexityAdjustedDirtyPV - - dblAccrued; - double dblCreditFundingConvexityAdjustedCleanDV01 = dblCreditFundingConvexityAdjustedDirtyDV01 - - dblAccrued01; - double dblCreditFundingConvexityAdjustedFairPremium = 0.0001 * - dblCreditFundingConvexityAdjustedCleanPV / dblCreditFundingConvexityAdjustedCleanDV01; - double dblCreditFXConvexityAdjustedCleanPV = dblCreditFXConvexityAdjustedDirtyPV - dblAccrued; - double dblCreditFXConvexityAdjustedCleanDV01 = dblCreditFXConvexityAdjustedDirtyDV01 - dblAccrued01; - double dblCreditFXConvexityAdjustedFairPremium = 0.0001 * dblCreditFXConvexityAdjustedCleanPV / - dblCreditFXConvexityAdjustedCleanDV01; - double dblCumulativeConvexityAdjustedCleanPV = dblCumulativeConvexityAdjustedDirtyPV - dblAccrued; - double dblCumulativeConvexityAdjustedCleanDV01 = dblCumulativeConvexityAdjustedDirtyDV01 - - dblAccrued01; - double dblCumulativeConvexityAdjustedFairPremium = 0.0001 * dblCumulativeConvexityAdjustedCleanPV / - dblCumulativeConvexityAdjustedCleanDV01; - double dblForwardFundingConvexityAdjustedCleanPV = dblForwardFundingConvexityAdjustedDirtyPV - - dblAccrued; - double dblForwardFundingConvexityAdjustedCleanDV01 = dblForwardFundingConvexityAdjustedDirtyDV01 - - dblAccrued01; - double dblForwardFundingConvexityAdjustedFairPremium = 0.0001 * - dblForwardFundingConvexityAdjustedCleanPV / dblForwardFundingConvexityAdjustedCleanDV01; - double dblForwardFXConvexityAdjustedCleanPV = dblForwardFXConvexityAdjustedDirtyPV - dblAccrued; - double dblForwardFXConvexityAdjustedCleanDV01 = dblForwardFXConvexityAdjustedDirtyDV01 - - dblAccrued01; - double dblForwardFXConvexityAdjustedFairPremium = 0.0001 * dblForwardFXConvexityAdjustedCleanPV / - dblForwardFXConvexityAdjustedCleanDV01; - double dblFundingFXConvexityAdjustedCleanPV = dblFundingFXConvexityAdjustedDirtyPV - dblAccrued; - double dblFundingFXConvexityAdjustedCleanDV01 = dblFundingFXConvexityAdjustedDirtyDV01 - - dblAccrued01; - double dblFundingFXConvexityAdjustedFairPremium = 0.0001 * dblFundingFXConvexityAdjustedCleanPV / - dblFundingFXConvexityAdjustedCleanDV01; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapResult = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapResult.put ("AccrualCoupon", dblAccrualCoupon); - - mapResult.put ("Accrued", dblAccrued); - - mapResult.put ("Accrued01", dblAccrued01); - - mapResult.put ("CleanDV01", dblCumulativeConvexityAdjustedCleanDV01); - - mapResult.put ("CleanPV", dblCumulativeConvexityAdjustedCleanPV); - - mapResult.put ("CompoundingAdjustedCleanDV01", dblCompoundingAdjustedCleanDV01); - - mapResult.put ("CompoundingAdjustedCleanPV", dblCompoundingAdjustedCleanPV); - - mapResult.put ("CompoundingAdjustedDirtyPV", dblCompoundingAdjustedDirtyPV); - - mapResult.put ("CompoundingAdjustedDirtyDV01", dblCompoundingAdjustedDirtyDV01); - - mapResult.put ("CompoundingAdjustedDirtyPV", dblCompoundingAdjustedDirtyPV); - - mapResult.put ("CompoundingAdjustedFairPremium", dblCompoundingAdjustedFairPremium); - - mapResult.put ("CompoundingAdjustedParRate", dblCompoundingAdjustedFairPremium); - - mapResult.put ("CompoundingAdjustedPV", dblCompoundingAdjustedCleanPV); - - mapResult.put ("CompoundingAdjustedRate", dblCompoundingAdjustedFairPremium); - - mapResult.put ("CompoundingAdjustedUpfront", dblCompoundingAdjustedCleanPV); - - mapResult.put ("CompoundingAdjustmentFactor", dblCompoundingAdjustedDirtyDV01 / - dblUnadjustedDirtyDV01); - - mapResult.put ("CompoundingAdjustmentPremium", dblCompoundingAdjustedCleanPV - dblUnadjustedCleanPV); - - mapResult.put ("CompoundingAdjustmentPremiumUpfront", (dblCompoundingAdjustedCleanPV - - dblUnadjustedCleanPV) / dblFXAdjustedValueNotional); - - mapResult.put ("CreditForwardConvexityAdjustedCleanDV01", - dblCreditForwardConvexityAdjustedCleanDV01); - - mapResult.put ("CreditForwardConvexityAdjustedCleanPV", dblCreditForwardConvexityAdjustedCleanPV); - - mapResult.put ("CreditForwardConvexityAdjustedDirtyDV01", - dblCreditForwardConvexityAdjustedDirtyDV01); - - mapResult.put ("CreditForwardConvexityAdjustedDirtyPV", dblCreditForwardConvexityAdjustedDirtyPV); - - mapResult.put ("CreditForwardConvexityAdjustedDV01", dblCreditForwardConvexityAdjustedDirtyDV01); - - mapResult.put ("CreditForwardConvexityAdjustedFairPremium", - dblCreditForwardConvexityAdjustedFairPremium); - - mapResult.put ("CreditForwardConvexityAdjustedParRate", - dblCreditForwardConvexityAdjustedFairPremium); - - mapResult.put ("CreditForwardConvexityAdjustedPV", dblCreditForwardConvexityAdjustedCleanPV); - - mapResult.put ("CreditForwardConvexityAdjustedRate", dblCreditForwardConvexityAdjustedFairPremium); - - mapResult.put ("CreditForwardConvexityAdjustedUpfront", dblCreditForwardConvexityAdjustedCleanPV); - - mapResult.put ("CreditForwardConvexityAdjustmentFactor", dblCreditForwardConvexityAdjustedDirtyDV01 - / dblUnadjustedDirtyDV01); - - mapResult.put ("CreditForwardConvexityAdjustmentPremium", dblCreditForwardConvexityAdjustedCleanPV - - dblUnadjustedCleanPV); - - mapResult.put ("CreditForwardConvexityAdjustmentPremiumUpfront", - (dblCreditForwardConvexityAdjustedCleanPV - dblUnadjustedCleanPV) / dblFXAdjustedValueNotional); - - mapResult.put ("CreditFundingConvexityAdjustedCleanDV01", - dblCreditFundingConvexityAdjustedCleanDV01); - - mapResult.put ("CreditFundingConvexityAdjustedCleanPV", dblCreditFundingConvexityAdjustedCleanPV); - - mapResult.put ("CreditFundingConvexityAdjustedDirtyDV01", - dblCreditFundingConvexityAdjustedDirtyDV01); - - mapResult.put ("CreditFundingConvexityAdjustedDirtyPV", dblCreditFundingConvexityAdjustedDirtyPV); - - mapResult.put ("CreditFundingConvexityAdjustedDV01", dblCreditFundingConvexityAdjustedDirtyDV01); - - mapResult.put ("CreditFundingConvexityAdjustedFairPremium", - dblCreditFundingConvexityAdjustedFairPremium); - - mapResult.put ("CreditFundingConvexityAdjustedParRate", - dblCreditFundingConvexityAdjustedFairPremium); - - mapResult.put ("CreditFundingConvexityAdjustedPV", dblCreditFundingConvexityAdjustedCleanPV); - - mapResult.put ("CreditFundingConvexityAdjustedRate", dblCreditFundingConvexityAdjustedFairPremium); - - mapResult.put ("CreditFundingConvexityAdjustedUpfront", dblCreditFundingConvexityAdjustedCleanPV); - - mapResult.put ("CreditFundingConvexityAdjustmentFactor", dblCreditFundingConvexityAdjustedDirtyDV01 - / dblUnadjustedDirtyDV01); - - mapResult.put ("CreditFundingConvexityAdjustmentPremium", dblCreditFundingConvexityAdjustedCleanPV - - dblUnadjustedCleanPV); - - mapResult.put ("CreditFundingConvexityAdjustmentPremiumUpfront", - (dblCreditFundingConvexityAdjustedCleanPV - dblUnadjustedCleanPV) / dblFXAdjustedValueNotional); - - mapResult.put ("CreditFXConvexityAdjustedCleanDV01", dblCreditFXConvexityAdjustedCleanDV01); - - mapResult.put ("CreditFXConvexityAdjustedCleanPV", dblCreditFXConvexityAdjustedCleanPV); - - mapResult.put ("CreditFXConvexityAdjustedDirtyDV01", dblCreditFXConvexityAdjustedDirtyDV01); - - mapResult.put ("CreditFXConvexityAdjustedDirtyPV", dblCreditFXConvexityAdjustedDirtyPV); - - mapResult.put ("CreditFXConvexityAdjustedDV01", dblCreditFXConvexityAdjustedDirtyDV01); - - mapResult.put ("CreditFXConvexityAdjustedFairPremium", dblCreditFXConvexityAdjustedFairPremium); - - mapResult.put ("CreditFXConvexityAdjustedParRate", dblCreditFXConvexityAdjustedFairPremium); - - mapResult.put ("CreditFXConvexityAdjustedPV", dblCreditFXConvexityAdjustedCleanPV); - - mapResult.put ("CreditFXConvexityAdjustedRate", dblCreditFXConvexityAdjustedFairPremium); - - mapResult.put ("CreditFXConvexityAdjustedUpfront", dblCreditFXConvexityAdjustedCleanPV); - - mapResult.put ("CreditFXConvexityAdjustmentFactor", dblCreditFXConvexityAdjustedDirtyDV01 / - dblUnadjustedDirtyDV01); - - mapResult.put ("CreditFXConvexityAdjustmentPremium", dblCreditFXConvexityAdjustedCleanPV - - dblUnadjustedCleanPV); - - mapResult.put ("CreditFXConvexityAdjustmentPremiumUpfront", (dblCreditFXConvexityAdjustedCleanPV - - dblUnadjustedCleanPV) / dblFXAdjustedValueNotional); - - mapResult.put ("CumulativeConvexityAdjustedCleanDV01", dblCumulativeConvexityAdjustedCleanDV01); - - mapResult.put ("CumulativeConvexityAdjustedCleanPV", dblCumulativeConvexityAdjustedCleanPV); - - mapResult.put ("CumulativeConvexityAdjustedDirtyDV01", dblCumulativeConvexityAdjustedDirtyDV01); - - mapResult.put ("CumulativeConvexityAdjustedDirtyPV", dblCumulativeConvexityAdjustedDirtyPV); - - mapResult.put ("CumulativeConvexityAdjustedDV01", dblCumulativeConvexityAdjustedDirtyDV01); - - mapResult.put ("CumulativeConvexityAdjustedFairPremium", dblCumulativeConvexityAdjustedFairPremium); - - mapResult.put ("CumulativeConvexityAdjustedParRate", dblCumulativeConvexityAdjustedFairPremium); - - mapResult.put ("CumulativeConvexityAdjustedPV", dblCumulativeConvexityAdjustedCleanPV); - - mapResult.put ("CumulativeConvexityAdjustedRate", dblCumulativeConvexityAdjustedFairPremium); - - mapResult.put ("CumulativeConvexityAdjustedUpfront", dblCumulativeConvexityAdjustedCleanPV); - - mapResult.put ("CumulativeConvexityAdjustmentFactor", dblCumulativeConvexityAdjustedDirtyDV01 / - dblUnadjustedDirtyDV01); - - mapResult.put ("CumulativeConvexityAdjustmentPremium", dblCumulativeConvexityAdjustedCleanPV - - dblUnadjustedCleanPV); - - mapResult.put ("CumulativeConvexityAdjustmentPremiumUpfront", (dblCumulativeConvexityAdjustedCleanPV - - dblUnadjustedCleanPV) / dblFXAdjustedValueNotional); - - mapResult.put ("CumulativeCouponAmount", dblCumulativeCouponAmount); - - mapResult.put ("CumulativeCouponDCF", dblCumulativeCouponDCF); - - mapResult.put ("CV01", dblCumulativeConvexityAdjustedCleanDV01); - - mapResult.put ("DirtyDV01", dblCumulativeConvexityAdjustedDirtyDV01); - - mapResult.put ("DirtyPV", dblCumulativeConvexityAdjustedDirtyPV); - - mapResult.put ("DV01", dblCumulativeConvexityAdjustedCleanDV01); - - mapResult.put ("FairPremium", dblCumulativeConvexityAdjustedFairPremium); - - mapResult.put ("Fixing01", dblAccrued01); - - mapResult.put ("ForwardFundingConvexityAdjustedCleanDV01", - dblForwardFundingConvexityAdjustedCleanDV01); - - mapResult.put ("ForwardFundingConvexityAdjustedCleanPV", dblForwardFundingConvexityAdjustedCleanPV); - - mapResult.put ("ForwardFundingConvexityAdjustedDirtyDV01", - dblForwardFundingConvexityAdjustedDirtyDV01); - - mapResult.put ("ForwardFundingConvexityAdjustedDirtyPV", dblForwardFundingConvexityAdjustedDirtyPV); - - mapResult.put ("ForwardFundingConvexityAdjustedDV01", dblForwardFundingConvexityAdjustedDirtyDV01); - - mapResult.put ("ForwardFundingConvexityAdjustedFairPremium", - dblForwardFundingConvexityAdjustedFairPremium); - - mapResult.put ("ForwardFundingConvexityAdjustedParRate", - dblForwardFundingConvexityAdjustedFairPremium); - - mapResult.put ("ForwardFundingConvexityAdjustedPV", dblForwardFundingConvexityAdjustedCleanPV); - - mapResult.put ("ForwardFundingConvexityAdjustedRate", dblForwardFundingConvexityAdjustedFairPremium); - - mapResult.put ("ForwardFundingConvexityAdjustedUpfront", dblForwardFundingConvexityAdjustedCleanPV); - - mapResult.put ("ForwardFundingConvexityAdjustmentFactor", dblForwardFundingConvexityAdjustedDirtyDV01 - / dblUnadjustedDirtyDV01); - - mapResult.put ("ForwardFundingConvexityAdjustmentPremium", dblForwardFundingConvexityAdjustedCleanPV - - dblUnadjustedCleanPV); - - mapResult.put ("ForwardFundingConvexityAdjustmentPremiumUpfront", - (dblForwardFundingConvexityAdjustedCleanPV - dblUnadjustedCleanPV) / dblFXAdjustedValueNotional); - - mapResult.put ("ForwardFXConvexityAdjustedCleanDV01", dblForwardFXConvexityAdjustedCleanDV01); - - mapResult.put ("ForwardFXConvexityAdjustedCleanPV", dblForwardFXConvexityAdjustedCleanPV); - - mapResult.put ("ForwardFXConvexityAdjustedDirtyDV01", dblForwardFXConvexityAdjustedDirtyDV01); - - mapResult.put ("ForwardFXConvexityAdjustedDirtyPV", dblForwardFXConvexityAdjustedDirtyPV); - - mapResult.put ("ForwardFXConvexityAdjustedDV01", dblForwardFXConvexityAdjustedDirtyDV01); - - mapResult.put ("ForwardFXConvexityAdjustedFairPremium", dblForwardFXConvexityAdjustedFairPremium); - - mapResult.put ("ForwardFXConvexityAdjustedParRate", dblForwardFXConvexityAdjustedFairPremium); - - mapResult.put ("ForwardFXConvexityAdjustedPV", dblForwardFXConvexityAdjustedCleanPV); - - mapResult.put ("ForwardFXConvexityAdjustedRate", dblForwardFXConvexityAdjustedFairPremium); - - mapResult.put ("ForwardFXConvexityAdjustedUpfront", dblForwardFXConvexityAdjustedCleanPV); - - mapResult.put ("ForwardFXConvexityAdjustmentFactor", dblForwardFXConvexityAdjustedDirtyDV01 / - dblUnadjustedDirtyDV01); - - mapResult.put ("ForwardFXConvexityAdjustmentPremium", dblForwardFXConvexityAdjustedCleanPV - - dblUnadjustedCleanPV); - - mapResult.put ("ForwardFXConvexityAdjustmentPremiumUpfront", (dblForwardFXConvexityAdjustedCleanPV - - dblUnadjustedCleanPV) / dblFXAdjustedValueNotional); - - mapResult.put ("FundingFXConvexityAdjustedCleanDV01", dblFundingFXConvexityAdjustedCleanDV01); - - mapResult.put ("FundingFXConvexityAdjustedCleanPV", dblFundingFXConvexityAdjustedCleanPV); - - mapResult.put ("FundingFXConvexityAdjustedDirtyDV01", dblFundingFXConvexityAdjustedDirtyDV01); - - mapResult.put ("FundingFXConvexityAdjustedDirtyPV", dblFundingFXConvexityAdjustedDirtyPV); - - mapResult.put ("FundingFXConvexityAdjustedDV01", dblFundingFXConvexityAdjustedDirtyDV01); - - mapResult.put ("FundingFXConvexityAdjustedFairPremium", dblFundingFXConvexityAdjustedFairPremium); - - mapResult.put ("FundingFXConvexityAdjustedParRate", dblFundingFXConvexityAdjustedFairPremium); - - mapResult.put ("FundingFXConvexityAdjustedPV", dblFundingFXConvexityAdjustedCleanPV); - - mapResult.put ("FundingFXConvexityAdjustedRate", dblFundingFXConvexityAdjustedFairPremium); - - mapResult.put ("FundingFXConvexityAdjustedUpfront", dblFundingFXConvexityAdjustedCleanPV); - - mapResult.put ("FundingFXConvexityAdjustmentFactor", dblFundingFXConvexityAdjustedDirtyDV01 / - dblUnadjustedDirtyDV01); - - mapResult.put ("FundingFXConvexityAdjustmentPremium", dblFundingFXConvexityAdjustedCleanPV - - dblUnadjustedCleanPV); - - mapResult.put ("FundingFXConvexityAdjustmentPremiumUpfront", (dblFundingFXConvexityAdjustedCleanPV - - dblUnadjustedCleanPV) / dblFXAdjustedValueNotional); - - mapResult.put ("ParRate", dblCumulativeConvexityAdjustedFairPremium); - - mapResult.put ("PV", dblCumulativeConvexityAdjustedCleanPV); - - mapResult.put ("Rate", dblCumulativeConvexityAdjustedFairPremium); - - mapResult.put ("ResetDate", (double) iResetDate); - - mapResult.put ("ResetRate", dblAccrualCoupon - basis()); - - mapResult.put ("TotalCoupon", dblTotalCoupon); - - mapResult.put ("UnadjustedCleanDV01", dblUnadjustedCleanDV01); - - mapResult.put ("UnadjustedCleanPV", dblUnadjustedCleanPV); - - mapResult.put ("UnadjustedDirtyDV01", dblUnadjustedDirtyDV01); - - mapResult.put ("UnadjustedDirtyPV", dblUnadjustedDirtyPV); - - mapResult.put ("UnadjustedFairPremium", dblUnadjustedFairPremium); - - mapResult.put ("UnadjustedParRate", dblUnadjustedFairPremium); - - mapResult.put ("UnadjustedPV", dblUnadjustedCleanPV); - - mapResult.put ("UnadjustedRate", dblUnadjustedFairPremium); - - mapResult.put ("UnadjustedUpfront", dblUnadjustedCleanPV); - - mapResult.put ("Upfront", dblCumulativeConvexityAdjustedCleanPV); - - double dblCompoundingAdjustedCleanPrice = 100. * (1. + (dblCompoundingAdjustedCleanPV / - dblFXAdjustedValueNotional)); - double dblCreditForwardConvexityAdjustedCleanPrice = 100. * (1. + - (dblCreditForwardConvexityAdjustedCleanPV / dblFXAdjustedValueNotional)); - double dblCreditFundingConvexityAdjustedCleanPrice = 100. * (1. + - (dblCreditFundingConvexityAdjustedCleanPV / dblFXAdjustedValueNotional)); - double dblCreditFXConvexityAdjustedCleanPrice = 100. * (1. + (dblCreditFXConvexityAdjustedCleanPV - / dblFXAdjustedValueNotional)); - double dblCumulativeConvexityAdjustedCleanPrice = 100. * (1. + (dblCumulativeConvexityAdjustedCleanPV - / dblFXAdjustedValueNotional)); - double dblForwardFundingConvexityAdjustedCleanPrice = 100. * (1. + - (dblForwardFundingConvexityAdjustedCleanPV / dblFXAdjustedValueNotional)); - double dblForwardFXConvexityAdjustedCleanPrice = 100. * (1. + (dblForwardFXConvexityAdjustedCleanPV / - dblFXAdjustedValueNotional)); - double dblFundingFXConvexityAdjustedCleanPrice = 100. * (1. + (dblFundingFXConvexityAdjustedCleanPV / - dblFXAdjustedValueNotional)); - double dblUnadjustedCleanPrice = 100. * (1. + (dblUnadjustedCleanPV / dblFXAdjustedValueNotional)); - - mapResult.put ("CleanPrice", dblCumulativeConvexityAdjustedCleanPrice); - - mapResult.put ("CompoundingAdjustedCleanPrice", dblCompoundingAdjustedCleanPrice); - - mapResult.put ("CompoundingAdjustedDirtyPrice", 100. * (1. + (dblCompoundingAdjustedDirtyPV / - dblFXAdjustedValueNotional))); - - mapResult.put ("CompoundingAdjustedPrice", dblCompoundingAdjustedCleanPrice); - - mapResult.put ("CreditForwardConvexityAdjustedCleanPrice", - dblCreditForwardConvexityAdjustedCleanPrice); - - mapResult.put ("CreditForwardConvexityAdjustedDirtyPrice", 100. * (1. + - (dblCreditForwardConvexityAdjustedDirtyPV / dblFXAdjustedValueNotional))); - - mapResult.put ("CreditForwardConvexityAdjustedPrice", dblCreditForwardConvexityAdjustedCleanPrice); - - mapResult.put ("CreditFundingConvexityAdjustedCleanPrice", - dblCreditFundingConvexityAdjustedCleanPrice); - - mapResult.put ("CreditFundingConvexityAdjustedDirtyPrice", 100. * (1. + - (dblCreditFundingConvexityAdjustedDirtyPV / dblFXAdjustedValueNotional))); - - mapResult.put ("CreditFundingConvexityAdjustedPrice", dblCreditFundingConvexityAdjustedCleanPrice); - - mapResult.put ("CreditFXConvexityAdjustedCleanPrice", dblCreditFXConvexityAdjustedCleanPrice); - - mapResult.put ("CreditFXConvexityAdjustedDirtyPrice", 100. * (1. + - (dblCreditFXConvexityAdjustedDirtyPV / dblFXAdjustedValueNotional))); - - mapResult.put ("CreditFXConvexityAdjustedPrice", dblCreditFXConvexityAdjustedCleanPrice); - - mapResult.put ("CumulativeConvexityAdjustedCleanPrice", dblCumulativeConvexityAdjustedCleanPrice); - - mapResult.put ("CumulativeConvexityAdjustedDirtyPrice", 100. * (1. + - (dblCumulativeConvexityAdjustedDirtyPV / dblFXAdjustedValueNotional))); - - mapResult.put ("CumulativeConvexityAdjustedPrice", dblCumulativeConvexityAdjustedCleanPrice); - - mapResult.put ("DirtyPrice", 100. * (1. + (dblCumulativeConvexityAdjustedDirtyPV / - dblFXAdjustedValueNotional))); - - mapResult.put ("ForwardFundingConvexityAdjustedCleanPrice", - dblForwardFundingConvexityAdjustedCleanPrice); - - mapResult.put ("ForwardFundingConvexityAdjustedDirtyPrice", 100. * (1. + - (dblForwardFundingConvexityAdjustedDirtyPV / dblFXAdjustedValueNotional))); - - mapResult.put ("ForwardFundingConvexityAdjustedPrice", dblForwardFundingConvexityAdjustedCleanPrice); - - mapResult.put ("ForwardFXConvexityAdjustedCleanPrice", dblForwardFXConvexityAdjustedCleanPrice); - - mapResult.put ("ForwardFXConvexityAdjustedDirtyPrice", 100. * (1. + - (dblForwardFXConvexityAdjustedDirtyPV / dblFXAdjustedValueNotional))); - - mapResult.put ("ForwardFXConvexityAdjustedPrice", dblForwardFXConvexityAdjustedCleanPrice); - - mapResult.put ("FundingFXConvexityAdjustedCleanPrice", dblFundingFXConvexityAdjustedCleanPrice); - - mapResult.put ("FundingFXConvexityAdjustedDirtyPrice", 100. * (1. + - (dblFundingFXConvexityAdjustedDirtyPV / dblFXAdjustedValueNotional))); - - mapResult.put ("FundingFXConvexityAdjustedPrice", dblFundingFXConvexityAdjustedCleanPrice); - - mapResult.put ("Price", dblCumulativeConvexityAdjustedCleanPrice); - - mapResult.put ("UnadjustedCleanPrice", dblUnadjustedCleanPrice); - - mapResult.put ("UnadjustedDirtyPrice", 100. * (1. + (dblUnadjustedDirtyPV / - dblFXAdjustedValueNotional))); - - mapResult.put ("UnadjustedPrice", dblUnadjustedCleanPrice); - - mapResult.put ("CalcTime", (System.nanoTime() - lStart) * 1.e-09); - - return mapResult; - } - - /** - * Retrieve the set of the implemented measures - * - * @return The set of the implemented measures - */ - - public java.util.Set availableMeasures() - { - java.util.Set setstrMeasures = new java.util.TreeSet(); - - setstrMeasures.add ("AccrualCoupon"); - - setstrMeasures.add ("Accrued"); - - setstrMeasures.add ("Accrued01"); - - setstrMeasures.add ("CleanDV01"); - - setstrMeasures.add ("CleanPV"); - - setstrMeasures.add ("CompoundingAdjustedCleanDV01"); - - setstrMeasures.add ("CompoundingAdjustedCleanPV"); - - setstrMeasures.add ("CompoundingAdjustedDirtyPV"); - - setstrMeasures.add ("CompoundingAdjustedDirtyDV01"); - - setstrMeasures.add ("CompoundingAdjustedDirtyPV"); - - setstrMeasures.add ("CompoundingAdjustedFairPremium"); - - setstrMeasures.add ("CompoundingAdjustedParRate"); - - setstrMeasures.add ("CompoundingAdjustedPV"); - - setstrMeasures.add ("CompoundingAdjustedRate"); - - setstrMeasures.add ("CompoundingAdjustedUpfront"); - - setstrMeasures.add ("CompoundingAdjustmentFactor"); - - setstrMeasures.add ("CompoundingAdjustmentPremium"); - - setstrMeasures.add ("CompoundingAdjustmentPremiumUpfront"); - - setstrMeasures.add ("CreditForwardConvexityAdjustedCleanDV01"); - - setstrMeasures.add ("CreditForwardConvexityAdjustedCleanPV"); - - setstrMeasures.add ("CreditForwardConvexityAdjustedDirtyDV01"); - - setstrMeasures.add ("CreditForwardConvexityAdjustedDirtyPV"); - - setstrMeasures.add ("CreditForwardConvexityAdjustedDV01"); - - setstrMeasures.add ("CreditForwardConvexityAdjustedFairPremium"); - - setstrMeasures.add ("CreditForwardConvexityAdjustedParRate"); - - setstrMeasures.add ("CreditForwardConvexityAdjustedPV"); - - setstrMeasures.add ("CreditForwardConvexityAdjustedRate"); - - setstrMeasures.add ("CreditForwardConvexityAdjustedUpfront"); - - setstrMeasures.add ("CreditForwardConvexityAdjustmentFactor"); - - setstrMeasures.add ("CreditForwardConvexityAdjustmentPremium"); - - setstrMeasures.add ("CreditForwardConvexityAdjustmentPremiumUpfront"); - - setstrMeasures.add ("CreditFundingConvexityAdjustedCleanDV01"); - - setstrMeasures.add ("CreditFundingConvexityAdjustedCleanPV"); - - setstrMeasures.add ("CreditFundingConvexityAdjustedDirtyDV01"); - - setstrMeasures.add ("CreditFundingConvexityAdjustedDirtyPV"); - - setstrMeasures.add ("CreditFundingConvexityAdjustedDV01"); - - setstrMeasures.add ("CreditFundingConvexityAdjustedFairPremium"); - - setstrMeasures.add ("CreditFundingConvexityAdjustedParRate"); - - setstrMeasures.add ("CreditFundingConvexityAdjustedPV"); - - setstrMeasures.add ("CreditFundingConvexityAdjustedRate"); - - setstrMeasures.add ("CreditFundingConvexityAdjustedUpfront"); - - setstrMeasures.add ("CreditFundingConvexityAdjustmentFactor"); - - setstrMeasures.add ("CreditFundingConvexityAdjustmentPremium"); - - setstrMeasures.add ("CreditFundingConvexityAdjustmentPremiumUpfront"); - - setstrMeasures.add ("CreditFXConvexityAdjustedCleanDV01"); - - setstrMeasures.add ("CreditFXConvexityAdjustedCleanPV"); - - setstrMeasures.add ("CreditFXConvexityAdjustedDirtyDV01"); - - setstrMeasures.add ("CreditFXConvexityAdjustedDirtyPV"); - - setstrMeasures.add ("CreditFXConvexityAdjustedDV01"); - - setstrMeasures.add ("CreditFXConvexityAdjustedFairPremium"); - - setstrMeasures.add ("CreditFXConvexityAdjustedParRate"); - - setstrMeasures.add ("CreditFXConvexityAdjustedPV"); - - setstrMeasures.add ("CreditFXConvexityAdjustedRate"); - - setstrMeasures.add ("CreditFXConvexityAdjustedUpfront"); - - setstrMeasures.add ("CreditFXConvexityAdjustmentFactor"); - - setstrMeasures.add ("CreditFXConvexityAdjustmentPremium"); - - setstrMeasures.add ("CreditFXConvexityAdjustmentPremiumUpfront"); - - setstrMeasures.add ("CumulativeConvexityAdjustedCleanDV01"); - - setstrMeasures.add ("CumulativeConvexityAdjustedCleanPV"); - - setstrMeasures.add ("CumulativeConvexityAdjustedDirtyDV01"); - - setstrMeasures.add ("CumulativeConvexityAdjustedDirtyPV"); - - setstrMeasures.add ("CumulativeConvexityAdjustedDV01"); - - setstrMeasures.add ("CumulativeConvexityAdjustedFairPremium"); - - setstrMeasures.add ("CumulativeConvexityAdjustedParRate"); - - setstrMeasures.add ("CumulativeConvexityAdjustedPV"); - - setstrMeasures.add ("CumulativeConvexityAdjustedRate"); - - setstrMeasures.add ("CumulativeConvexityAdjustedUpfront"); - - setstrMeasures.add ("CumulativeConvexityAdjustmentFactor"); - - setstrMeasures.add ("CumulativeConvexityAdjustmentPremium"); - - setstrMeasures.add ("CumulativeConvexityAdjustmentPremiumUpfront"); - - setstrMeasures.add ("CumulativeCouponAmount"); - - setstrMeasures.add ("CV01"); - - setstrMeasures.add ("DirtyDV01"); - - setstrMeasures.add ("DirtyPV"); - - setstrMeasures.add ("DV01"); - - setstrMeasures.add ("FairPremium"); - - setstrMeasures.add ("Fixing01"); - - setstrMeasures.add ("ForwardFundingConvexityAdjustedCleanDV01"); - - setstrMeasures.add ("ForwardFundingConvexityAdjustedCleanPV"); - - setstrMeasures.add ("ForwardFundingConvexityAdjustedDirtyDV01"); - - setstrMeasures.add ("ForwardFundingConvexityAdjustedDirtyPV"); - - setstrMeasures.add ("ForwardFundingConvexityAdjustedDV01"); - - setstrMeasures.add ("ForwardFundingConvexityAdjustedFairPremium"); - - setstrMeasures.add ("ForwardFundingConvexityAdjustedParRate"); - - setstrMeasures.add ("ForwardFundingConvexityAdjustedPV"); - - setstrMeasures.add ("ForwardFundingConvexityAdjustedRate"); - - setstrMeasures.add ("ForwardFundingConvexityAdjustedUpfront"); - - setstrMeasures.add ("ForwardFundingConvexityAdjustmentFactor"); - - setstrMeasures.add ("ForwardFundingConvexityAdjustmentPremium"); - - setstrMeasures.add ("ForwardFundingConvexityAdjustmentPremiumUpfront"); - - setstrMeasures.add ("ForwardFXConvexityAdjustedCleanDV01"); - - setstrMeasures.add ("ForwardFXConvexityAdjustedCleanPV"); - - setstrMeasures.add ("ForwardFXConvexityAdjustedDirtyDV01"); - - setstrMeasures.add ("ForwardFXConvexityAdjustedDirtyPV"); - - setstrMeasures.add ("ForwardFXConvexityAdjustedDV01"); - - setstrMeasures.add ("ForwardFXConvexityAdjustedFairPremium"); - - setstrMeasures.add ("ForwardFXConvexityAdjustedParRate"); - - setstrMeasures.add ("ForwardFXConvexityAdjustedPV"); - - setstrMeasures.add ("ForwardFXConvexityAdjustedRate"); - - setstrMeasures.add ("ForwardFXConvexityAdjustedUpfront"); - - setstrMeasures.add ("ForwardFXConvexityAdjustmentFactor"); - - setstrMeasures.add ("ForwardFXConvexityAdjustmentPremium"); - - setstrMeasures.add ("ForwardFXConvexityAdjustmentPremiumUpfront"); - - setstrMeasures.add ("FundingFXConvexityAdjustedCleanDV01"); - - setstrMeasures.add ("FundingFXConvexityAdjustedCleanPV"); - - setstrMeasures.add ("FundingFXConvexityAdjustedDirtyDV01"); - - setstrMeasures.add ("FundingFXConvexityAdjustedDirtyPV"); - - setstrMeasures.add ("FundingFXConvexityAdjustedDV01"); - - setstrMeasures.add ("FundingFXConvexityAdjustedFairPremium"); - - setstrMeasures.add ("FundingFXConvexityAdjustedParRate"); - - setstrMeasures.add ("FundingFXConvexityAdjustedPV"); - - setstrMeasures.add ("FundingFXConvexityAdjustedRate"); - - setstrMeasures.add ("FundingFXConvexityAdjustedUpfront"); - - setstrMeasures.add ("FundingFXConvexityAdjustmentFactor"); - - setstrMeasures.add ("FundingFXConvexityAdjustmentPremium"); - - setstrMeasures.add ("FundingFXConvexityAdjustmentPremiumUpfront"); - - setstrMeasures.add ("ParRate"); - - setstrMeasures.add ("PV"); - - setstrMeasures.add ("Rate"); - - setstrMeasures.add ("ResetDate"); - - setstrMeasures.add ("ResetRate"); - - setstrMeasures.add ("TotalCoupon"); - - setstrMeasures.add ("UnadjustedCleanDV01"); - - setstrMeasures.add ("UnadjustedCleanPV"); - - setstrMeasures.add ("UnadjustedDirtyDV01"); - - setstrMeasures.add ("UnadjustedDirtyPV"); - - setstrMeasures.add ("UnadjustedFairPremium"); - - setstrMeasures.add ("UnadjustedParRate"); - - setstrMeasures.add ("UnadjustedPV"); - - setstrMeasures.add ("UnadjustedRate"); - - setstrMeasures.add ("UnadjustedUpfront"); - - setstrMeasures.add ("Upfront"); - - return setstrMeasures; - } - - /** - * Compute the PV for the specified Market Parameters - * - * @param valParams ValuationParams - * @param pricerParams PricerParams - * @param csqc Market Parameters - * @param vcp Valuation Customization Parameters - * - * @return The PV - * - * @throws java.lang.Exception Thrown if the PV cannot be computed - */ - - public double pv ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - throws java.lang.Exception - { - if (null == valParams || null == csqc) - throw new java.lang.Exception ("Stream::pv => Invalid Inputs"); - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqc.fundingState (fundingLabel()); - - if (null == dcFunding) throw new java.lang.Exception ("Stream::pv => Invalid Inputs"); - - int iValueDate = valParams.valueDate(); - - double dblCumulativeConvexityAdjustedDirtyPV = 0.; - - for (org.drip.analytics.cashflow.CompositePeriod period : _lsPeriod) { - int iPeriodPayDate = period.payDate(); - - if (iPeriodPayDate < iValueDate) continue; - - org.drip.analytics.output.CompositePeriodCouponMetrics cpcm = period.couponMetrics (iValueDate, - csqc); - - if (null == cpcm) throw new java.lang.Exception ("Stream::pv => Invalid Inputs"); - - int iPeriodEndDate = period.endDate(); - - dblCumulativeConvexityAdjustedDirtyPV += cpcm.dcf() * period.notional (iPeriodEndDate) * - period.couponFactor (iPeriodEndDate) * period.fx (csqc) * period.survival (csqc) * - period.df (csqc) * cpcm.cumulative() * cpcm.rate(); - } - - return dblCumulativeConvexityAdjustedDirtyPV / dcFunding.df (iValueDate); - } - - /** - * Generate the State Loading Constraints for the Forward Latent State - * - * @param valParams The Valuation Parameters - * @param pricerParams The Pricer parameters - * @param csqs The Market Parameters - * @param vcp Valuation Customization Parameters - * @param pqs The Product Calibration Quote Set - * - * @return The State Loading Constraints for the Forward Latent State - */ - - public org.drip.state.estimator.PredictorResponseWeightConstraint forwardPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - if (null == valParams || null == pqs) return null; - - org.drip.state.identifier.ForwardLabel forwardLabel = forwardLabel(); - - if ((null != forwardLabel && !(pqs instanceof org.drip.product.calib.FloatingStreamQuoteSet)) || - (null == forwardLabel && !(pqs instanceof org.drip.product.calib.FixedStreamQuoteSet))) - return null; - - int iValueDate = valParams.valueDate(); - - if (iValueDate >= maturity().julian()) return null; - - double dblCleanPV = 0.; - - try { - if (pqs instanceof org.drip.product.calib.FloatingStreamQuoteSet) { - org.drip.product.calib.FloatingStreamQuoteSet fsqs = - (org.drip.product.calib.FloatingStreamQuoteSet) pqs; - - if (fsqs.containsPV()) dblCleanPV = fsqs.pv(); - } else if (pqs instanceof org.drip.product.calib.FixedStreamQuoteSet) { - org.drip.product.calib.FixedStreamQuoteSet fsqs = - (org.drip.product.calib.FixedStreamQuoteSet) pqs; - - if (fsqs.containsPV()) dblCleanPV = fsqs.pv(); - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.state.estimator.PredictorResponseWeightConstraint prwc = new - org.drip.state.estimator.PredictorResponseWeightConstraint(); - - for (org.drip.analytics.cashflow.CompositePeriod period : _lsPeriod) { - int iPeriodEndDate = period.endDate(); - - if (iPeriodEndDate < iValueDate) continue; - - org.drip.state.estimator.PredictorResponseWeightConstraint prwcPeriod = period.forwardPRWC - (iValueDate, csqs, pqs); - - if (null == prwcPeriod || !prwc.absorb (prwcPeriod)) return null; - } - - if (!prwc.updateValue (dblCleanPV)) return null; - - if (!prwc.updateDValueDManifestMeasure ("PV", 1.)) return null; - - return prwc; - } - - /** - * Generate the State Loading Constraints for the Funding Latent State - * - * @param valParams The Valuation Parameters - * @param pricerParams The Pricer parameters - * @param csqs The Market Parameters - * @param vcp Valuation Customization Parameters - * @param pqs The Product Calibration Quote Set - * - * @return The State Loading Constraints for the Funding Latent State - */ - - public org.drip.state.estimator.PredictorResponseWeightConstraint fundingPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - if (null == valParams || null == pqs) return null; - - org.drip.state.identifier.ForwardLabel forwardLabel = forwardLabel(); - - if ((null != forwardLabel && !(pqs instanceof org.drip.product.calib.FloatingStreamQuoteSet)) || - (null == forwardLabel && !(pqs instanceof org.drip.product.calib.FixedStreamQuoteSet))) - return null; - - int iValueDate = valParams.valueDate(); - - if (iValueDate >= maturity().julian()) return null; - - double dblCleanPV = 0.; - - try { - if (pqs instanceof org.drip.product.calib.FloatingStreamQuoteSet) { - org.drip.product.calib.FloatingStreamQuoteSet fsqs = - (org.drip.product.calib.FloatingStreamQuoteSet) pqs; - - if (fsqs.containsPV()) dblCleanPV = fsqs.pv(); - } else if (pqs instanceof org.drip.product.calib.FixedStreamQuoteSet) { - org.drip.product.calib.FixedStreamQuoteSet fsqs = - (org.drip.product.calib.FixedStreamQuoteSet) pqs; - - if (fsqs.containsPV()) dblCleanPV = fsqs.pv(); - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.state.estimator.PredictorResponseWeightConstraint prwc = new - org.drip.state.estimator.PredictorResponseWeightConstraint(); - - for (org.drip.analytics.cashflow.CompositePeriod period : _lsPeriod) { - int iPeriodEndDate = period.endDate(); - - if (iPeriodEndDate < iValueDate) continue; - - org.drip.state.estimator.PredictorResponseWeightConstraint prwcPeriod = period.fundingPRWC - (iValueDate, csqs, pqs); - - if (null == prwcPeriod || !prwc.absorb (prwcPeriod)) return null; - } - - if (!prwc.updateValue (dblCleanPV)) return null; - - if (!prwc.updateDValueDManifestMeasure ("PV", 1.)) return null; - - return prwc; - } - - /** - * Generate the State Loading Constraints for the Merged Forward/Funding Latent State - * - * @param valParams The Valuation Parameters - * @param pricerParams The Pricer parameters - * @param csqs The Market Parameters - * @param vcp Valuation Customization Parameters - * @param pqs The Product Calibration Quote Set - * - * @return The State Loading Constraints for the Merged Forward/Funding Latent State - */ - - public org.drip.state.estimator.PredictorResponseWeightConstraint fundingForwardPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - if (null == valParams || null == pqs) return null; - - org.drip.state.identifier.ForwardLabel forwardLabel = forwardLabel(); - - if ((null != forwardLabel && !(pqs instanceof org.drip.product.calib.FloatingStreamQuoteSet)) || - (null == forwardLabel && !(pqs instanceof org.drip.product.calib.FixedStreamQuoteSet))) - return null; - - int iValueDate = valParams.valueDate(); - - if (iValueDate >= maturity().julian()) return null; - - double dblCleanPV = 0.; - - try { - if (pqs instanceof org.drip.product.calib.FloatingStreamQuoteSet) { - org.drip.product.calib.FloatingStreamQuoteSet fsqs = - (org.drip.product.calib.FloatingStreamQuoteSet) pqs; - - if (fsqs.containsPV()) dblCleanPV = fsqs.pv(); - } else if (pqs instanceof org.drip.product.calib.FixedStreamQuoteSet) { - org.drip.product.calib.FixedStreamQuoteSet fsqs = - (org.drip.product.calib.FixedStreamQuoteSet) pqs; - - if (fsqs.containsPV()) dblCleanPV = fsqs.pv(); - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.state.estimator.PredictorResponseWeightConstraint prwc = new - org.drip.state.estimator.PredictorResponseWeightConstraint(); - - for (org.drip.analytics.cashflow.CompositePeriod period : _lsPeriod) { - int iPeriodEndDate = period.endDate(); - - if (iPeriodEndDate < iValueDate) continue; - - org.drip.state.estimator.PredictorResponseWeightConstraint prwcPeriod = period.forwardFundingPRWC - (iValueDate, csqs, pqs); - - if (null == prwcPeriod || !prwc.absorb (prwcPeriod)) return null; - } - - if (!prwc.updateValue (dblCleanPV)) return null; - - if (!prwc.updateDValueDManifestMeasure ("PV", 1.)) return null; - - return prwc; - } - - /** - * Generate the Calibratable Linearized Predictor/Response Constraint Weights for the Non-merged FX Curve - * FX Forward Latent State from the Component's Cash Flows. The Constraints here typically correspond to - * Date/Cash Flow pairs and the corresponding leading PV. - * - * @param valParams Valuation Parameters - * @param pricerParams Pricer Parameters - * @param csqs Component Market Parameters - * @param vcp Valuation Customization Parameters - * @param pqs Product Quote Set - * - * @return The Calibratable Linearized Predictor/Response Constraints (Date/Cash Flow pairs and the - * corresponding FX Forward) - */ - - public org.drip.state.estimator.PredictorResponseWeightConstraint fxPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - if (null == valParams) return null; - - int iValueDate = valParams.valueDate(); - - org.drip.state.estimator.PredictorResponseWeightConstraint prwc = new - org.drip.state.estimator.PredictorResponseWeightConstraint(); - - for (org.drip.analytics.cashflow.CompositePeriod period : _lsPeriod) { - int iPeriodEndDate = period.endDate(); - - if (iPeriodEndDate < iValueDate) continue; - - org.drip.state.estimator.PredictorResponseWeightConstraint prwcPeriod = period.fxPRWC - (iValueDate, csqs, pqs); - - if (null == prwcPeriod || !prwc.absorb (prwcPeriod)) return null; - } - - return prwc; - } - - /** - * Generate the Calibratable Linearized Predictor/Response Constraint Weights for the Non-merged Govvie - * Curve Yield Latent State from the Component's Cash Flows. The Constraints here typically correspond - * to Date/Cash Flow pairs and the corresponding leading PV. - * - * @param valParams Valuation Parameters - * @param pricerParams Pricer Parameters - * @param csqs Component Market Parameters - * @param vcp Valuation Customization Parameters - * @param pqs Product Quote Set - * - * @return The Calibratable Linearized Predictor/Response Constraints (Date/Cash Flow pairs and the - * corresponding Yield) - */ - - public org.drip.state.estimator.PredictorResponseWeightConstraint govviePRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - return null; - } - - /** - * Generate the Calibratable Linearized Predictor/Response Constraint Weights for the Non-merged - * Volatility Curve Volatility Latent State from the Component's Cash Flows. The Constraints here - * typically correspond tovDate/Cash Flow pairs and the corresponding leading PV. - * - * @param valParams Valuation Parameters - * @param pricerParams Pricer Parameters - * @param csqs Component Market Parameters - * @param vcp Valuation Customization Parameters - * @param pqs Product Quote Set - * - * @return The Calibratable Linearized Predictor/Response Constraints (Date/Cash Flow pairs and the - * corresponding Volatility) - */ - - public org.drip.state.estimator.PredictorResponseWeightConstraint volatilityPRWC ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.calib.ProductQuoteSet pqs) - { - if (null == valParams) return null; - - int iValueDate = valParams.valueDate(); - - org.drip.state.estimator.PredictorResponseWeightConstraint prwc = new - org.drip.state.estimator.PredictorResponseWeightConstraint(); - - for (org.drip.analytics.cashflow.CompositePeriod period : _lsPeriod) { - int iPeriodEndDate = period.endDate(); - - if (iPeriodEndDate < iValueDate) continue; - - org.drip.state.estimator.PredictorResponseWeightConstraint prwcPeriod = period.volatilityPRWC - (iValueDate, csqs, pqs); - - if (null == prwcPeriod || !prwc.absorb (prwcPeriod)) return null; - } - - return prwc; - } - - /** - * Generate the Jacobian of the Dirty PV to the Manifest Measure - * - * @param valParams The Valuation Parameters - * @param pricerParams The Pricer parameters - * @param csqs The Market Parameters - * @param vcp Valuation Customization Parameters - * - * @return The Jacobian of the Dirty PV to the Manifest Measure - */ - - public org.drip.quant.calculus.WengertJacobian jackDDirtyPVDManifestMeasure ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == valParams || valParams.valueDate() >= maturity().julian() || null == csqs) return null; - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqs.fundingState (fundingLabel()); - - if (null == dcFunding) return null; - - try { - org.drip.quant.calculus.WengertJacobian jackDDirtyPVDManifestMeasure = null; - - for (org.drip.analytics.cashflow.CompositePeriod p : _lsPeriod) { - int iPeriodPayDate = p.payDate(); - - if (p.startDate() < valParams.valueDate()) continue; - - org.drip.quant.calculus.WengertJacobian jackDDFDManifestMeasure = - dcFunding.jackDDFDManifestMeasure (iPeriodPayDate, "PV"); - - if (null == jackDDFDManifestMeasure) continue; - - int iNumQuote = jackDDFDManifestMeasure.numParameters(); - - if (0 == iNumQuote) continue; - - if (null == jackDDirtyPVDManifestMeasure) - jackDDirtyPVDManifestMeasure = new org.drip.quant.calculus.WengertJacobian (1, - iNumQuote); - - double dblPeriodNotional = p.notional (p.startDate(), p.endDate()) * p.fx (csqs); - - double dblPeriodDCF = p.couponMetrics (valParams.valueDate(), csqs).dcf(); - - for (int k = 0; k < iNumQuote; ++k) { - if (!jackDDirtyPVDManifestMeasure.accumulatePartialFirstDerivative (0, k, - dblPeriodNotional * dblPeriodDCF * jackDDFDManifestMeasure.firstDerivative (0, k))) - return null; - } - } - - return jackDDirtyPVDManifestMeasure; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the micro-Jacobian of the Manifest Measure to the Discount Factor - * - * @param strManifestMeasure The Manifest Measure - * @param valParams The Valuation Parameters - * @param pricerParams The Pricer parameters - * @param csqs The Market Parameters - * @param vcp Valuation Customization Parameters - * - * @return The micro-Jacobian of the Manifest Measure to the Discount Factor - */ - - public org.drip.quant.calculus.WengertJacobian manifestMeasureDFMicroJack ( - final java.lang.String strManifestMeasure, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == valParams || valParams.valueDate() >= _lsPeriod.get (_lsPeriod.size() - 1).endDate() || - null == strManifestMeasure) - return null; - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = csqs.fundingState - (org.drip.state.identifier.FundingLabel.Standard (payCurrency())); - - if (null == dcFunding) return null; - - if ("Rate".equalsIgnoreCase (strManifestMeasure) || "SwapRate".equalsIgnoreCase (strManifestMeasure)) - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapMeasures = value - (valParams, pricerParams, csqs, vcp); - - if (null == mapMeasures) return null; - - double dblDirtyDV01 = mapMeasures.get ("DirtyDV01"); - - double dblParSwapRate = mapMeasures.get ("SwapRate"); - - try { - org.drip.quant.calculus.WengertJacobian wjSwapRateDFMicroJack = null; - - for (org.drip.analytics.cashflow.CompositePeriod p : _lsPeriod) { - int iPeriodPayDate = p.payDate(); - - if (iPeriodPayDate < valParams.valueDate()) continue; - - double dblPeriodDCF = p.couponMetrics (valParams.valueDate(), csqs).dcf(); - - org.drip.quant.calculus.WengertJacobian wjPeriodFwdRateDF = - dcFunding.jackDForwardDManifestMeasure (p.startDate(), p.endDate(), "Rate", - dblPeriodDCF); - - org.drip.quant.calculus.WengertJacobian wjPeriodPayDFDF = - dcFunding.jackDDFDManifestMeasure (iPeriodPayDate, "Rate"); - - if (null == wjPeriodFwdRateDF || null == wjPeriodPayDFDF) continue; - - double dblForwardRate = dcFunding.libor (p.startDate(), p.endDate()); - - double dblPeriodPayDF = dcFunding.df (iPeriodPayDate); - - if (null == wjSwapRateDFMicroJack) - wjSwapRateDFMicroJack = new org.drip.quant.calculus.WengertJacobian (1, - wjPeriodFwdRateDF.numParameters()); - - double dblPeriodNotional = notional (p.startDate(), p.endDate()); - - for (int k = 0; k < wjPeriodFwdRateDF.numParameters(); ++k) { - double dblPeriodMicroJack = (dblForwardRate - dblParSwapRate) * - wjPeriodPayDFDF.firstDerivative (0, k) + dblPeriodPayDF * - wjPeriodFwdRateDF.firstDerivative (0, k); - - if (!wjSwapRateDFMicroJack.accumulatePartialFirstDerivative (0, k, dblPeriodNotional - * dblPeriodDCF * dblPeriodMicroJack / dblDirtyDV01)) - return null; - } - } - - return wjSwapRateDFMicroJack; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - } - - return null; - } -} diff --git a/org/drip/quant/calculus/DerivativeControl.java b/org/drip/quant/calculus/DerivativeControl.java deleted file mode 100644 index b5cf0fb..0000000 --- a/org/drip/quant/calculus/DerivativeControl.java +++ /dev/null @@ -1,125 +0,0 @@ - -package org.drip.quant.calculus; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * DerivativeControl provides bumps needed for numerically approximating derivatives. Bumps can be absolute - * or relative, and they default to a floor. - * - * @author Lakshmi Krishnamurthy - */ - -public class DerivativeControl { - private static final double ABSOLUTE_INCREMENT = 1.e-05; - private static final double RELATIVE_INCREMENT = 1.e-06; - - private double _dblBumpFactor = RELATIVE_INCREMENT; - - /** - * Empty DerivativeControl constructor - */ - - public DerivativeControl() - { - } - - /** - * DerivativeControl constructor - * - * @param dblBumpFactor Bump Factor - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public DerivativeControl ( - final double dblBumpFactor) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblBumpFactor)) - throw new java.lang.Exception ("DerivativeControl constructor: Invalid inputs!"); - } - - /** - * Retrieve the bump factor - * - * @return The Bump Factor - */ - - public double getBumpFactor() - { - return _dblBumpFactor; - } - - /** - * Calculate and return the variate infinitesimal - * - * @param dblVariate Variate Input - * - * @return Variate Infinitesimal - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double getVariateInfinitesimal ( - final double dblVariate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate)) - throw new java.lang.Exception ("DerivativeControl::getVariateInfinitesimal => Invalid input"); - - double dblVariateInfinitesimal = dblVariate * getBumpFactor(); - - if (java.lang.Math.abs (dblVariateInfinitesimal) < ABSOLUTE_INCREMENT) return ABSOLUTE_INCREMENT; - - return dblVariateInfinitesimal; - } -} diff --git a/org/drip/quant/calculus/Differential.java b/org/drip/quant/calculus/Differential.java deleted file mode 100644 index 01912f4..0000000 --- a/org/drip/quant/calculus/Differential.java +++ /dev/null @@ -1,120 +0,0 @@ - -package org.drip.quant.calculus; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * Differential holds the incremental differentials for the variate and the objective function. - * - * @author Lakshmi Krishnamurthy - */ - -public class Differential { - private double _dblDeltaOF = java.lang.Double.NaN; - private double _dblDeltaVariate = java.lang.Double.NaN; - - /** - * Differential constructor - * - * @param dblDeltaVariate Delta Variate - * @param dblDeltaOF Delta OF - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public Differential ( - final double dblDeltaVariate, - final double dblDeltaOF) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblDeltaVariate = dblDeltaVariate) || - !org.drip.quant.common.NumberUtil.IsValid (_dblDeltaOF = dblDeltaOF)) - throw new java.lang.Exception ("Differential constructor: Invalid Inputs!"); - } - - /** - * Retrieve the Delta for the OF - * - * @return Delta OF - */ - - public double getDeltaOF() - { - return _dblDeltaOF; - } - - /** - * Retrieve the Delta for the variate - * - * @return Delta Variate - */ - - public double getDeltaVariate() - { - return _dblDeltaVariate; - } - - /** - * Retrieve the Delta for the variate - * - * @param bOFNumerator TRUE - Calculate DOF/DVariate; FALSE - Calculate DVariate/DOF - * - * @return Delta Variate - */ - - public double calcSlope ( - final boolean bOFNumerator) - { - if (bOFNumerator) return _dblDeltaOF / _dblDeltaVariate; - - return _dblDeltaVariate / _dblDeltaOF; - } -} diff --git a/org/drip/quant/calculus/R1ToR1Integrator.java b/org/drip/quant/calculus/R1ToR1Integrator.java deleted file mode 100644 index 2eaf04a..0000000 --- a/org/drip/quant/calculus/R1ToR1Integrator.java +++ /dev/null @@ -1,446 +0,0 @@ - -package org.drip.quant.calculus; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * R1ToR1Integrator implements the following routines for integrating the R^1 To R^1 objective Function: - * - Linear Quadrature - * - Mid-Point Scheme - * - Trapezoidal Scheme - * - Simpson/Simpson38 schemes - * - Boole Scheme - * - * @author Lakshmi Krishnamurthy - */ - -public class R1ToR1Integrator { - private final static int NUM_QUAD = 10000; - - /** - * Compute the function's integral within the specified limits using the LinearQuadrature technique. - * - * @param funcR1ToR1 R1ToR1 Function - * @param dblLeft Left Variate - * @param dblRight Right Variate - * - * @return The Integral - * - * @throws java.lang.Exception Thrown if the error cannot be computed - */ - - public static final double LinearQuadrature ( - final org.drip.function.definition.R1ToR1 funcR1ToR1, - final double dblLeft, - final double dblRight) - throws java.lang.Exception - { - if (null == funcR1ToR1 || !org.drip.quant.common.NumberUtil.IsValid (dblLeft) || - !org.drip.quant.common.NumberUtil.IsValid (dblRight) || dblLeft > dblRight) - throw new java.lang.Exception ("R1ToR1Integrator::LinearQuadrature => Invalid Inputs"); - - if (dblLeft == dblRight) return 0.; - - double dblWidth = (dblRight - dblLeft) / NUM_QUAD; - double dblX = dblLeft + dblWidth; - double dblAUArea = 0.; - - while (dblX <= dblRight) { - double dblY = funcR1ToR1.evaluate (dblX - 0.5 * dblWidth); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblLeft)) - throw new java.lang.Exception - ("R1ToR1Integrator::LinearQuadrature => Cannot calculate an intermediate Y"); - - dblAUArea += dblY * dblWidth; - dblX += dblWidth; - } - - return dblAUArea; - } - - /** - * Compute the function's integral within the specified limits using the Mid-point rule. - * - * @param funcR1ToR1 R1ToR1 Function - * @param dblLeft Left Variate - * @param dblRight Right Variate - * - * @return The Integral - * - * @throws java.lang.Exception Thrown if the error cannot be computed - */ - - public static final double MidPoint ( - final org.drip.function.definition.R1ToR1 funcR1ToR1, - final double dblLeft, - final double dblRight) - throws java.lang.Exception - { - if (null == funcR1ToR1 || !org.drip.quant.common.NumberUtil.IsValid (dblLeft) || - !org.drip.quant.common.NumberUtil.IsValid (dblRight) || dblLeft > dblRight) - throw new java.lang.Exception ("R1ToR1Integrator::MidPoint => Invalid Inputs"); - - if (dblLeft == dblRight) return 0.; - - double dblYMid = funcR1ToR1.evaluate (0.5 * (dblLeft + dblRight)); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblYMid)) - throw new java.lang.Exception ("R1ToR1Integrator::MidPoint => Cannot calculate Y at " + 0.5 * - (dblLeft + dblRight)); - - return (dblRight - dblLeft) * dblYMid; - } - - /** - * Compute the function's integral within the specified limits using the Trapezoidal rule. - * - * @param funcR1ToR1 R1ToR1 Function - * @param dblLeft Left Variate - * @param dblRight Right Variate - * - * @return The Integral - * - * @throws java.lang.Exception Thrown if the error cannot be computed - */ - - public static final double Trapezoidal ( - final org.drip.function.definition.R1ToR1 funcR1ToR1, - final double dblLeft, - final double dblRight) - throws java.lang.Exception - { - if (null == funcR1ToR1 || !org.drip.quant.common.NumberUtil.IsValid (dblLeft) || - !org.drip.quant.common.NumberUtil.IsValid (dblRight) || dblLeft > dblRight) - throw new java.lang.Exception ("R1ToR1Integrator::Trapezoidal => Invalid Inputs"); - - if (dblLeft == dblRight) return 0.; - - double dblYLeft = funcR1ToR1.evaluate (dblLeft); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblYLeft)) - throw new java.lang.Exception ("R1ToR1Integrator::Trapezoidal => Cannot calculate Y at " + - dblLeft); - - double dblYRight = funcR1ToR1.evaluate (dblRight); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblYLeft)) - throw new java.lang.Exception ("R1ToR1Integrator::Trapezoidal => Cannot calculate Y at " + - dblRight); - - return 0.5 * (dblRight - dblLeft) * (dblYLeft + dblYRight); - } - - /** - * Compute the function's integral within the specified limits using the Simpson rule. - * - * @param funcR1ToR1 R1ToR1 Function - * @param dblLeft Left Variate - * @param dblRight Right Variate - * - * @return The Integral - * - * @throws java.lang.Exception Thrown if the error cannot be computed - */ - - public static final double Simpson ( - final org.drip.function.definition.R1ToR1 funcR1ToR1, - final double dblLeft, - final double dblRight) - throws java.lang.Exception - { - if (null == funcR1ToR1 || !org.drip.quant.common.NumberUtil.IsValid (dblLeft) || - !org.drip.quant.common.NumberUtil.IsValid (dblRight) || dblLeft > dblRight) - throw new java.lang.Exception ("R1ToR1Integrator::Simpson => Invalid Inputs"); - - if (dblLeft == dblRight) return 0.; - - double dblYLeft = funcR1ToR1.evaluate (dblLeft); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblYLeft)) - throw new java.lang.Exception ("R1ToR1Integrator::Simpson => Cannot calculate Y at " + dblLeft); - - double dblXMid = 0.5 * (dblLeft + dblRight); - - double dblYMid = funcR1ToR1.evaluate (dblXMid); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblYMid)) - throw new java.lang.Exception ("R1ToR1Integrator::Simpson => Cannot calculate Y at " + dblXMid); - - double dblYRight = funcR1ToR1.evaluate (dblRight); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblYRight)) - throw new java.lang.Exception ("R1ToR1Integrator::Simpson => Cannot calculate Y at " + dblRight); - - return (dblRight - dblLeft) / 6. * (dblYLeft + 4. * dblYMid + dblYRight); - } - - /** - * Compute the function's integral within the specified limits using the Simpson 3/8 rule. - * - * @param funcR1ToR1 R1ToR1 Function - * @param dblLeft Left Variate - * @param dblRight Right Variate - * - * @return The Integral - * - * @throws java.lang.Exception Thrown if the error cannot be computed - */ - - public static final double Simpson38 ( - final org.drip.function.definition.R1ToR1 funcR1ToR1, - final double dblLeft, - final double dblRight) - throws java.lang.Exception - { - if (null == funcR1ToR1 || !org.drip.quant.common.NumberUtil.IsValid (dblLeft) || - !org.drip.quant.common.NumberUtil.IsValid (dblRight) || dblLeft > dblRight) - throw new java.lang.Exception ("R1ToR1Integrator::Simpson38 => Invalid Inputs"); - - if (dblLeft == dblRight) return 0.; - - double dblY0 = funcR1ToR1.evaluate (dblLeft); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblY0)) - throw new java.lang.Exception ("R1ToR1Integrator::Simpson38 => Cannot calculate Y at " + - dblLeft); - - double dblX1 = (2. * dblLeft + dblRight) / 3.; - - double dblY1 = funcR1ToR1.evaluate (dblX1); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblY1)) - throw new java.lang.Exception ("R1ToR1Integrator::Simpson38 => Cannot calculate Y at " + dblX1); - - double dblX2 = (dblLeft + 2. * dblRight) / 3.; - - double dblY2 = funcR1ToR1.evaluate (dblX2); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblY2)) - throw new java.lang.Exception ("R1ToR1Integrator::Simpson38 => Cannot calculate Y at " + dblX2); - - double dblY3 = funcR1ToR1.evaluate (dblRight); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblY3)) - throw new java.lang.Exception ("R1ToR1Integrator::Simpson38 => Cannot calculate Y at " + - dblRight); - - return (dblRight - dblLeft) * (0.125 * dblY0 + 0.375 * dblY1 + 0.375 * dblY2 + 0.125 * dblY3); - } - - /** - * Compute the function's integral within the specified limits using the Boole rule. - * - * @param funcR1ToR1 R1ToR1 Function - * @param dblLeft Left Variate - * @param dblRight Right Variate - * - * @return The Integral - * - * @throws java.lang.Exception Thrown if the error cannot be computed - */ - - public static final double Boole ( - final org.drip.function.definition.R1ToR1 funcR1ToR1, - final double dblLeft, - final double dblRight) - throws java.lang.Exception - { - if (null == funcR1ToR1 || !org.drip.quant.common.NumberUtil.IsValid (dblLeft) || - !org.drip.quant.common.NumberUtil.IsValid (dblRight) || dblLeft > dblRight) - throw new java.lang.Exception ("R1ToR1Integrator::Boole => Invalid Inputs"); - - if (dblLeft == dblRight) return 0.; - - double dblY0 = funcR1ToR1.evaluate (dblLeft); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblY0)) - throw new java.lang.Exception ("R1ToR1Integrator::Boole => Cannot calculate Y at " + dblLeft); - - double dblX1 = 0.25 * dblLeft + 0.75 * dblRight; - - double dblY1 = funcR1ToR1.evaluate (dblX1); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblY1)) - throw new java.lang.Exception ("R1ToR1Integrator::Boole => Cannot calculate Y at " + dblX1); - - double dblX2 = 0.5 * (dblLeft + dblRight); - - double dblY2 = funcR1ToR1.evaluate (dblX2); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblY2)) - throw new java.lang.Exception ("R1ToR1Integrator::Boole => Cannot calculate Y at " + dblX2); - - double dblX3 = 0.75 * dblLeft + 0.25 * dblRight; - - double dblY3 = funcR1ToR1.evaluate (dblX3); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblY3)) - throw new java.lang.Exception ("R1ToR1Integrator::Boole => Cannot calculate Y at " + dblX3); - - double dblY4 = funcR1ToR1.evaluate (dblRight); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblY4)) - throw new java.lang.Exception ("R1ToR1Integrator::Boole => Cannot calculate Y at " + dblRight); - - return (dblRight - dblLeft) / 90 * (7 * dblY0 + 32 * dblY1 + 12 * dblY2 + 32 * dblY3 + 7 * dblY4); - } - - /** - * Integrate Numerically over [-infinity, +infinity] using a Change of Variables - * - * @param funcR1ToR1 The R1ToR1 Function - * - * @return The Numerical Integrand - * - * @throws java.lang.Exception Thrown if the Integral cannot be computed - */ - - public static final double LeftInfiniteRightInfinite ( - final org.drip.function.definition.R1ToR1 funcR1ToR1) - throws java.lang.Exception - { - if (null == funcR1ToR1) - throw new java.lang.Exception ("IntegratorR1ToR1::LeftInfiniteRightInfinite => Invalid Inputs"); - - org.drip.function.definition.R1ToR1 auTransformed = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception - ("IntegratorR1ToR1::LeftInfiniteRightInfinite => Invalid Inputs"); - - double dblX2 = dblX * dblX; - double dblXTransform = 1. / (1. - dblX2); - - return (1. + dblX2) / (dblXTransform * dblXTransform) * funcR1ToR1.evaluate (dblX / - dblXTransform); - } - }; - - return auTransformed.integrate (-1., +1.); - } - - /** - * Integrate the specified Function Numerically from -infinity to the specified Right Limit - * - * @param funcR1ToR1 The Input R1ToR1 Function - * @param dblRight The Right Integration Limit - * - * @return The Results of the Integration - * - * @throws java.lang.Exception Thrown if the Integrand cannot be evaluated - */ - - public static final double LeftInfinite ( - final org.drip.function.definition.R1ToR1 funcR1ToR1, - final double dblRight) - throws java.lang.Exception - { - if (null == funcR1ToR1 || !org.drip.quant.common.NumberUtil.IsValid (dblRight)) - throw new java.lang.Exception ("IntegratorR1ToR1::LeftInfinite => Invalid Inputs"); - - org.drip.function.definition.R1ToR1 auTransformed = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception ("IntegratorR1ToR1::LeftInfinite => Invalid Inputs"); - - return (funcR1ToR1.evaluate (dblRight - ((1. - dblX) / dblX))) / (dblX * dblX); - } - }; - - return auTransformed.integrate (0., +1.); - } - - /** - * Integrate the specified Function Numerically from the specified Left Limit to +infinity - * - * @param funcR1ToR1 The Input R1ToR1 Function - * @param dblLeft The Left Integration Limit - * - * @return The Results of the Integration - * - * @throws java.lang.Exception Thrown if the Integrand cannot be evaluated - */ - - public static final double RightInfinite ( - final org.drip.function.definition.R1ToR1 funcR1ToR1, - final double dblLeft) - throws java.lang.Exception - { - if (null == funcR1ToR1 || !org.drip.quant.common.NumberUtil.IsValid (dblLeft)) - throw new java.lang.Exception ("IntegratorR1ToR1::RightInfinite => Invalid Inputs"); - - org.drip.function.definition.R1ToR1 auTransformed = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception ("IntegratorR1ToR1::RightInfinite => Invalid Inputs"); - - double dblXInversion = 1. - dblX; - - return (funcR1ToR1.evaluate (dblLeft + (dblX / dblXInversion))) / (dblXInversion * - dblXInversion); - } - }; - - return auTransformed.integrate (0., +1.); - } -} diff --git a/org/drip/quant/calculus/WengertJacobian.java b/org/drip/quant/calculus/WengertJacobian.java deleted file mode 100644 index 22caf4b..0000000 --- a/org/drip/quant/calculus/WengertJacobian.java +++ /dev/null @@ -1,300 +0,0 @@ - -package org.drip.quant.calculus; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * WengertJacobian contains the Jacobian of the given set of Wengert variables to the set of parameters. It - * exposes the following functionality: - * - Set/Retrieve the Wengert variables - * - Accumulate the Partials - * - Scale the partial entries - * - Merge the Jacobian with another - * - Retrieve the WengertJacobian elements - * - Display the contents of the WengertJacobian - * - * @author Lakshmi Krishnamurthy - */ - -public class WengertJacobian { - private double[] _adblWengert = null; - private double[][] _aadblDWengertDParameter = null; - - /** - * WengertJacobian constructor - * - * @param iNumWengerts Number of Wengert variables - * @param iNumParameters Number of Parameters - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public WengertJacobian ( - final int iNumWengerts, - final int iNumParameters) - throws java.lang.Exception - { - if (0 >= iNumWengerts || 0 >= iNumParameters) - throw new java.lang.Exception ("WengertJacobian constructor: Invalid inputs"); - - _adblWengert = new double[iNumWengerts]; - _aadblDWengertDParameter = new double[iNumWengerts][iNumParameters]; - - for (int iWengertIndex = 0; iWengertIndex < _aadblDWengertDParameter.length; ++iWengertIndex) { - for (int iParameterIndex = 0; iParameterIndex < _aadblDWengertDParameter[0].length; - ++iParameterIndex) - _aadblDWengertDParameter[iWengertIndex][iParameterIndex] = 0.; - } - } - - /** - * Retrieve the number of Wengert Variables - * - * @return Number of Wengert Variables - */ - - public int numWengerts() - { - return null == _adblWengert ? 0 : _adblWengert.length; - } - - /** - * Retrieve the number of Parameters - * - * @return Number of Parameters - */ - - public int numParameters() - { - return (null == _aadblDWengertDParameter || null == _aadblDWengertDParameter[0]) ? 0 : - _aadblDWengertDParameter[0].length; - } - - /** - * Set the Value for the Wengert variable - * - * @param iWengertIndex Wengert Variable Index - * @param dblWengert The Value for the Wengert Variable - * - * @return TRUE - Successfully set - */ - - public boolean setWengert ( - final int iWengertIndex, - final double dblWengert) - { - if (0 > iWengertIndex || iWengertIndex >= _adblWengert.length || - !org.drip.quant.common.NumberUtil.IsValid (dblWengert)) - return false; - - _adblWengert[iWengertIndex] = dblWengert; - return true; - } - - /** - * Get the Value for the Wengert Variable - * - * @param iIndex Wengert Variable Index - * - * @return The Value for the Wengert variable - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public double wengert ( - final int iIndex) - throws java.lang.Exception - { - if (0 > iIndex || iIndex >= _adblWengert.length) - throw new java.lang.Exception ("WengertJacobian::wengert => Invalid Wengert Variable Index!"); - - return _adblWengert[iIndex]; - } - - /** - * Accumulate {D(Wengert)}/{D(Parameter)} - * - * @param iWengertIndex Wengert Variable Index - * @param iParameterIndex Parameter Index - * @param dblDWengertDParameter The incremental {D(Wengert)}/{D(Parameter)} - * - * @return TRUE - Successfully set - */ - - public boolean accumulatePartialFirstDerivative ( - final int iWengertIndex, - final int iParameterIndex, - final double dblDWengertDParameter) - { - if (0 > iParameterIndex || iParameterIndex >= _aadblDWengertDParameter[0].length || 0 > iWengertIndex - || iWengertIndex >= _adblWengert.length || !org.drip.quant.common.NumberUtil.IsValid - (dblDWengertDParameter)) - return false; - - _aadblDWengertDParameter[iWengertIndex][iParameterIndex] += dblDWengertDParameter; - return true; - } - - /** - * Retrieve {D(Wengert)}/{D(Parameter)} for the Wengert and the parameter identified by their indices - * - * @param iWengertIndex Wengert Variable Index - * @param iParameterIndex Parameter Index - * - * @return {D(Wengert)}/{D(Parameter)} - */ - - public double firstDerivative ( - final int iWengertIndex, - final int iParameterIndex) - { - return _aadblDWengertDParameter[iWengertIndex][iParameterIndex]; - } - - /** - * Accumulate and merge partial entries from the other CurveWengertJacobian - * - * @param wjOther CurveWengertJacobian to be accumulated and merged - * - * @return TRUE - Successfully accumulated and merged - */ - - public boolean cumulativeMerge ( - final org.drip.quant.calculus.WengertJacobian wjOther) - { - if (null == wjOther) return false; - - for (int iWengertIndex = 0; iWengertIndex < _aadblDWengertDParameter.length; ++iWengertIndex) { - for (int iParameterIndex = 0; iParameterIndex < _aadblDWengertDParameter[0].length; - ++iParameterIndex) - _aadblDWengertDParameter[iWengertIndex][iParameterIndex] += wjOther.firstDerivative - (iWengertIndex, iParameterIndex); - } - - return true; - } - - /** - * Accumulate and merge the weighted partial entries from the other CurveWengertJacobian - * - * @param wjOther CurveWengertJacobian to be accumulated and merged - * @param dblWeight The Weight - * - * @return TRUE - Successfully accumulated and merged - */ - - public boolean cumulativeMerge ( - final org.drip.quant.calculus.WengertJacobian wjOther, - final double dblWeight) - { - if (null == wjOther || !org.drip.quant.common.NumberUtil.IsValid (dblWeight)) return false; - - for (int iWengertIndex = 0; iWengertIndex < _aadblDWengertDParameter.length; ++iWengertIndex) { - for (int iParameterIndex = 0; iParameterIndex < _aadblDWengertDParameter[0].length; - ++iParameterIndex) - _aadblDWengertDParameter[iWengertIndex][iParameterIndex] += wjOther.firstDerivative - (iWengertIndex, iParameterIndex) * dblWeight; - } - - return true; - } - - /** - * Scale the partial entries - * - * @param dblScale Factor by which the partials are to be scaled by - * - * @return TRUE - Scaling down successful - */ - - public boolean scale ( - final double dblScale) - { - if (0 >= dblScale) return false; - - for (int iWengertIndex = 0; iWengertIndex < _aadblDWengertDParameter.length; ++iWengertIndex) { - for (int iParameterIndex = 0; iParameterIndex < _aadblDWengertDParameter[0].length; - ++iParameterIndex) - _aadblDWengertDParameter[iWengertIndex][iParameterIndex] *= dblScale; - } - - return true; - } - - /** - * Stringifies the contents of WengertJacobian - * - * @return Stringified WengertJacobian - */ - - public java.lang.String displayString() - { - java.lang.StringBuffer sb = new java.lang.StringBuffer(); - - for (int iWengertIndex = 0; iWengertIndex < _aadblDWengertDParameter.length; ++iWengertIndex) { - java.lang.StringBuffer sbDWengertDParameter = new java.lang.StringBuffer(); - - sbDWengertDParameter.append ("Wengert{" + iWengertIndex + "} => ["); - - for (int iParameterIndex = 0; iParameterIndex < _aadblDWengertDParameter[0].length; - ++iParameterIndex) { - if (0 != iParameterIndex) sbDWengertDParameter.append (", "); - - sbDWengertDParameter.append (org.drip.quant.common.FormatUtil.FormatDouble - (_aadblDWengertDParameter[iWengertIndex][iParameterIndex], 1, 3, 1.)); - } - - sb.append (sbDWengertDParameter).append ("]\n"); - } - - return sb.toString(); - } -} diff --git a/org/drip/quant/common/Array2D.java b/org/drip/quant/common/Array2D.java deleted file mode 100644 index 61988c9..0000000 --- a/org/drip/quant/common/Array2D.java +++ /dev/null @@ -1,367 +0,0 @@ - -package org.drip.quant.common; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * Array2D the contains array of x and y. It provides methods to create/access different varieties of x/y - * schedule creation. - * - * @author Lakshmi Krishnamurthy - */ - -public class Array2D { - private double _adblX[] = null; - private double _adblY[] = null; - - /** - * Create the Array2D Instance from a Matched String Array of X and Y - * - * @param strX String Array of X - * @param strY String Array of Y - * - * @return The Array2D Instance - */ - - public static final Array2D FromStringSet ( - final java.lang.String strX, - final java.lang.String strY) - { - if (null == strX || strX.isEmpty() || null == strY || strY.isEmpty()) return null; - - try { - return new Array2D (org.drip.quant.common.StringUtil.MakeDoubleArrayFromStringTokenizer (new - java.util.StringTokenizer (strX, ";")), - org.drip.quant.common.StringUtil.MakeDoubleArrayFromStringTokenizer (new - java.util.StringTokenizer (strY, ";"))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create the Array2D Instance from a Matched Array of X and Y - * - * @param adblX Array of X - * @param adblY Array of Y - * - * @return The Array2D Instance - */ - - public static final Array2D FromArray ( - final double[] adblX, - final double[] adblY) - { - try { - return new Array2D (adblX, adblY); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create the Array2D Instance from a Matched Array of X and Y - * - * @param aiX Array of X - * @param adblY Array of Y - * - * @return The Array2D Instance - */ - - public static final Array2D FromArray ( - final int[] aiX, - final double[] adblY) - { - if (null == aiX) return null; - - int iSize = aiX.length; - double[] adblX = new double[iSize]; - - if (0 == iSize) return null; - - for (int i = 0; i < iSize; ++i) - adblX[i] = aiX[i]; - - return FromArray (adblX, adblY); - } - - /** - * Create the Array2D Instance from a Matched Array of X and Y Deltas - * - * @param adblX Array of X - * @param adblYDelta Array of Y Deltas - * @param dblYInitial The Initial Value of Y - * - * @return The Array2D Instance - */ - - public static final Array2D FromXYDeltaArray ( - final double[] adblX, - final double[] adblYDelta, - final double dblYInitial) - { - if (null == adblX || null == adblYDelta || !org.drip.quant.common.NumberUtil.IsValid (dblYInitial)) - return null; - - int i = 0; - int iLength = adblX.length; - double[] adblY = new double[iLength]; - adblY[0] = dblYInitial; - - if (0 == iLength || iLength != adblYDelta.length) return null; - - for (double dblYDelta : adblYDelta) { - if (i < iLength - 1) adblY[i + 1] = adblY[i] - dblYDelta; - - ++i; - } - - try { - return new Array2D (adblX, adblY); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Array2D Instance from the Flat Unit Y - * - * @return The Array2D Instance - */ - - public static final Array2D BulletSchedule() - { - double[] adblFactor = new double[1]; - double[] adblDate = new double[1]; - adblFactor[0] = 1.; - - adblDate[0] = org.drip.analytics.date.DateUtil.CreateFromYMD (1900, 1, 1).julian(); - - try { - return new Array2D (adblDate, adblFactor); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private Array2D ( - final double[] adblX, - final double[] adblY) - throws java.lang.Exception - { - if (null == adblX || null == adblY) throw new java.lang.Exception ("Array2D ctr => Invalid params"); - - int iLength = adblX.length; - _adblX = new double[iLength]; - _adblY = new double[iLength]; - - if (0 == iLength || iLength != adblY.length) - throw new java.lang.Exception ("Array2D ctr => Invalid params"); - - for (int i = 0; i < iLength; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (_adblX[i] = adblX[i]) || - !org.drip.quant.common.NumberUtil.IsValid (_adblY[i] = adblY[i])) - throw new java.lang.Exception ("Array2D ctr => Invalid params"); - } - } - - /** - * Retrieve the Y given X - * - * @param dblX X - * - * @return Y - * - * @throws java.lang.Exception Thrown if the Y cannot be computed - */ - - public double y ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception ("Array2D::y => Invalid Input"); - - if (dblX <= _adblX[0]) return _adblY[0]; - - int iLength = _adblX.length; - - for (int i = 1; i < iLength; ++i) { - if (dblX > _adblX[i - 1] && dblX <= _adblX[i]) return _adblY[i]; - } - - return _adblY[iLength - 1]; - } - - /** - * Retrieve the Index that corresponds to the given X - * - * @param dblX X - * - * @return Index - * - * @throws java.lang.Exception Thrown if the Index cannot be computed - */ - - public int index ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception ("Array2D::index => Invalid Input/State"); - - if (dblX <= _adblX[0]) return 0; - - int iLength = _adblX.length; - - for (int i = 1; i < iLength; ++i) { - if (dblX <= _adblX[i]) return i; - } - - return iLength - 1; - } - - /** - * Retrieve the X-Weighted Y - * - * @param dblStartX Start X - * @param dblEndX End X - * - * @return The X-Weighted Y - * - * @throws java.lang.Exception Thrown if the Y cannot be computed - */ - - public double y ( - final double dblStartX, - final double dblEndX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblStartX) || - !org.drip.quant.common.NumberUtil.IsValid (dblEndX)) - throw new java.lang.Exception ("Array2D::y => Invalid Inputs"); - - int iEndIndex = index (dblEndX); - - int iStartIndex = index (dblStartX); - - if (iStartIndex == iEndIndex) return _adblY[iStartIndex]; - - double dblWeightedY = _adblY[iStartIndex] * (_adblX[iStartIndex] - dblStartX); - - for (int i = iStartIndex + 1; i <= iEndIndex; ++i) - dblWeightedY += _adblY[i] * (_adblX[i] - _adblX[i - 1]); - - return (dblWeightedY + _adblY[iEndIndex] * (dblEndX - _adblX[iEndIndex])) / (dblEndX - dblStartX); - } - - /** - * Retrieve the Array of X - * - * @return Array of X - */ - - public double[] x() - { - return _adblX; - } - - /** - * Retrieve the Array of Y - * - * @return Array of Y - */ - - public double[] y() - { - return _adblY; - } - - /** - * Indicate if this Array2D Instance matches the "other" Entry-by-Entry - * - * @param a2DOther The "Other" Array2D Instance - * - * @return TRUE - The Array2D Instances match Entry-by-Entry - */ - - public boolean match ( - final Array2D a2DOther) - { - if (null == a2DOther) return false; - - double[] adblOtherX = a2DOther._adblX; - double[] adblOtherY = a2DOther._adblY; - int iNumOtherX = adblOtherX.length; - int iNumOtherY = adblOtherY.length; - - if (iNumOtherX != _adblX.length || iNumOtherY != _adblY.length) return false; - - for (int i = 0; i < iNumOtherX; ++i) { - if (adblOtherX[i] != _adblX[i]) return false; - } - - for (int i = 0; i < iNumOtherY; ++i) { - if (adblOtherY[i] != _adblY[i]) return false; - } - - return true; - } -} diff --git a/org/drip/quant/common/CollectionUtil.java b/org/drip/quant/common/CollectionUtil.java deleted file mode 100644 index 3b4f7f2..0000000 --- a/org/drip/quant/common/CollectionUtil.java +++ /dev/null @@ -1,578 +0,0 @@ - -package org.drip.quant.common; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * The CollectionUtil class implements generic utility functions used in DRIP modules. Some of the functions - * it exposes are: - * - Map Merging Functionality - * - Map Key Functionality - key-value flatteners, key prefixers - * - Decompose/transform List/Set/Array Contents - * - Multi-Dimensional Map Manipulator Routines - * - Construct n-derivatives array from Slope - * - Collate Wengerts to a bigger Wengert - * - * @author Lakshmi Krishnamurthy - */ - -public class CollectionUtil { - - /** - * Prefix the keys in the input map, and return them in a new map - * - * @param mapIn Input map - * @param strPrefix The prefix - * - * @return Map containing the prefixed entries - */ - - public static final org.drip.analytics.support.CaseInsensitiveTreeMap PrefixKeys ( - final org.drip.analytics.support.CaseInsensitiveTreeMap mapIn, - final java.lang.String strPrefix) - { - if (null == mapIn || null == mapIn.entrySet() || null == strPrefix || strPrefix.isEmpty()) - return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapOut = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry me : mapIn.entrySet()) { - if (null != me.getKey() && !me.getKey().isEmpty()) - mapOut.put (strPrefix + me.getKey(), me.getValue()); - } - - return mapOut; - } - - /** - * Merge two maps - * - * @param map1 Map 1 - * @param map2 Map 2 - * - * @return The merged map - */ - - public static final org.drip.analytics.support.CaseInsensitiveTreeMap MergeMaps ( - final org.drip.analytics.support.CaseInsensitiveTreeMap map1, - final org.drip.analytics.support.CaseInsensitiveTreeMap map2) - { - if (null == map1 && null == map2) return null; - - if (null == map1 && null != map2) return map2; - - if (null != map1 && null == map2) return map1; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapOut = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry me : map1.entrySet()) - mapOut.put (me.getKey(), me.getValue()); - - for (java.util.Map.Entry me : map2.entrySet()) - mapOut.put (me.getKey(), me.getValue()); - - return mapOut; - } - - /** - * Merge the secondary map onto the main map - * - * @param mapMain Main Map - * @param mapToAdd Secondary Map to Add - * - * @return True - If successfully merged with main - */ - - public static final boolean MergeWithMain ( - final org.drip.analytics.support.CaseInsensitiveTreeMap mapMain, - final org.drip.analytics.support.CaseInsensitiveTreeMap mapToAdd) - { - if (null == mapMain || null == mapMain.entrySet() || null == mapToAdd || null == - mapToAdd.entrySet()) - return false; - - for (java.util.Map.Entry me : mapToAdd.entrySet()) - mapMain.put (me.getKey(), me.getValue()); - - return true; - } - - /** - * Flatten an input 2D string/double map into a delimited string array - * - * @param map2DSD 2D String/Double map - * @param strKVDelimiter Element delimiter - * @param strRecordDelimiter Record delimiter - * - * @return Flattened map string - */ - - public static final java.lang.String TwoDSDMapToFlatString ( - final org.drip.analytics.support.CaseInsensitiveTreeMap map2DSD, - final java.lang.String strKVDelimiter, - final java.lang.String strRecordDelimiter) - { - if (null == map2DSD || 0 == map2DSD.size() || null == map2DSD.entrySet() || null == strKVDelimiter || - strKVDelimiter.isEmpty() || null == strRecordDelimiter || strRecordDelimiter.isEmpty()) - return ""; - - boolean bFirstEntry = true; - - java.lang.StringBuffer sb = new java.lang.StringBuffer(); - - for (java.util.Map.Entry me : map2DSD.entrySet()) { - if (null == me || null == me.getKey() || me.getKey().isEmpty()) continue; - - if (bFirstEntry) - bFirstEntry = false; - else - sb.append (strRecordDelimiter); - - sb.append (me.getKey() + strKVDelimiter + me.getValue()); - } - - return sb.toString(); - } - - /** - * Flatten a 3D SSD map structure onto a string array - * - * @param map3DSD 3D SSD map - * @param strMultiLevelKeyDelimiter Multi Level KeyDelimiter - * @param strKVDelimiter Key-Value Delimiter - * @param strRecordDelimiter Record Delimiter - * - * @return Flattened String - */ - - public static final java.lang.String ThreeDSDMapToFlatString ( - final - org.drip.analytics.support.CaseInsensitiveTreeMap> - map3DSD, - final java.lang.String strMultiLevelKeyDelimiter, - final java.lang.String strKVDelimiter, - final java.lang.String strRecordDelimiter) - { - if (null == map3DSD || 0 == map3DSD.size() || null == map3DSD.entrySet() || null == - strMultiLevelKeyDelimiter || strMultiLevelKeyDelimiter.isEmpty() || null == strKVDelimiter || - strKVDelimiter.isEmpty() || null == strRecordDelimiter || strRecordDelimiter.isEmpty()) - return null; - - boolean bFirstEntry = true; - - java.lang.StringBuffer sb = new java.lang.StringBuffer(); - - for (java.util.Map.Entry> meOut : map3DSD.entrySet()) { - if (null == meOut || null == meOut.getValue() || null == meOut.getValue().entrySet()) continue; - - for (java.util.Map.Entry meIn : meOut.getValue().entrySet()) - { - if (null == meIn || null == meIn.getKey() || meIn.getKey().isEmpty()) continue; - - if (bFirstEntry) - bFirstEntry = false; - else - sb.append (strRecordDelimiter); - - sb.append (meOut.getKey() + strMultiLevelKeyDelimiter + meIn.getKey() + strKVDelimiter + - meIn.getValue()); - } - } - - return sb.toString(); - } - - /** - * Flatten a 4D SSSD map structure onto a string array - * - * @param map4DSD 4D SSSD map - * @param strMultiLevelKeyDelimiter Multi Level KeyDelimiter - * @param strKVDelimiter Key-Value Delimiter - * @param strRecordDelimiter Record Delimiter - * - * @return Flattened String - */ - - public static final java.lang.String FourDSDMapToFlatString ( - final - org.drip.analytics.support.CaseInsensitiveTreeMap>> - map4DSD, - final java.lang.String strMultiLevelKeyDelimiter, - final java.lang.String strKVDelimiter, - final java.lang.String strRecordDelimiter) - { - if (null == map4DSD || 0 == map4DSD.size() || null == map4DSD.entrySet() || null == - strMultiLevelKeyDelimiter || strMultiLevelKeyDelimiter.isEmpty() || null == strKVDelimiter || - strKVDelimiter.isEmpty() || null == strRecordDelimiter || strRecordDelimiter.isEmpty()) - return null; - - boolean bFirstEntry = true; - - java.lang.StringBuffer sb = new java.lang.StringBuffer(); - - for (java.util.Map.Entry>> - meOut : map4DSD.entrySet()) { - if (null == meOut || null == meOut.getValue() || null == meOut.getValue().entrySet() || null == - meOut.getKey() || meOut.getKey().isEmpty()) - continue; - - for (java.util.Map.Entry> meIn : - meOut.getValue().entrySet()) { - if (null == meIn || null == meIn.getValue() || null == meIn.getValue().entrySet() || null == - meIn.getKey() || meIn.getKey().isEmpty()) - continue; - - for (java.util.Map.Entry me : meIn.getValue().entrySet()) - { - if (null == me || null == me.getKey() || me.getKey().isEmpty()) continue; - - if (bFirstEntry) - bFirstEntry = false; - else - sb.append (strRecordDelimiter); - - sb.append (meOut.getKey() + strMultiLevelKeyDelimiter + meIn.getKey() + - strMultiLevelKeyDelimiter + me.getKey() + strKVDelimiter + me.getValue()); - } - } - } - - return sb.toString(); - } - - /** - * Turn a flattened 2D (string, double) string sequence into its corresponding map - * - * @param str2DMap Flattened 2D array input - * @param strKVDelimiter Key-Value delimiter string - * @param strRecordDelimiter Record delimiter string - * @param bSkipNullValue Indicates whether NULL Values are to be skipped - * @param strNULLString NULL string - * - * @return [String, double] map - */ - - public static final org.drip.analytics.support.CaseInsensitiveTreeMap - FlatStringTo2DSDMap ( - final java.lang.String str2DMap, - final java.lang.String strKVDelimiter, - final java.lang.String strRecordDelimiter, - final boolean bSkipNullValue, - final java.lang.String strNULLString) - { - if (null == str2DMap || str2DMap.isEmpty() || null == strNULLString || strNULLString.isEmpty() || - strNULLString.equalsIgnoreCase (str2DMap) || null == strKVDelimiter || strKVDelimiter.isEmpty() - || null == strRecordDelimiter || strRecordDelimiter.isEmpty()) - return null; - - java.lang.String[] astrRecord = org.drip.quant.common.StringUtil.Split (str2DMap, - strRecordDelimiter); - - if (null == astrRecord || 0 == astrRecord.length) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap map2D = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (int i = 0; i < astrRecord.length; ++i) { - if (null == astrRecord[i] || astrRecord[i].isEmpty() || strNULLString.equalsIgnoreCase - (astrRecord[i])) - continue; - - java.lang.String[] astrKVPair = org.drip.quant.common.StringUtil.Split (astrRecord[i], - strKVDelimiter); - - if (null == astrKVPair || 2 != astrKVPair.length || null == astrKVPair[0] || - astrKVPair[0].isEmpty() || strNULLString.equalsIgnoreCase (astrKVPair[0]) || (bSkipNullValue - && (null == astrKVPair[1] || astrKVPair[1].isEmpty() || strNULLString.equalsIgnoreCase - (astrKVPair[1])))) - continue; - - map2D.put (astrKVPair[0], new java.lang.Double (astrKVPair[1])); - } - - if (0 == map2D.size()) return null; - - return map2D; - } - - /** - * Turn a flattened 3D (string, string, double) string sequence into its corresponding map - * - * @param str3DMap Flattened 3D array input - * @param strMultiLevelKeyDelimiter Multi-level key delimiter string - * @param strKVDelimiter Key-Value delimiter string - * @param strRecordDelimiter Record delimiter string - * @param bSkipNullValue Indicates whether NULL Values are to be skipped - * @param strNULLString NULL string - * - * @return [String, [String, double]] map - */ - - public static final - org.drip.analytics.support.CaseInsensitiveTreeMap> - FlatStringTo3DSDMap ( - final java.lang.String str3DMap, - final java.lang.String strMultiLevelKeyDelimiter, - final java.lang.String strKVDelimiter, - final java.lang.String strRecordDelimiter, - final boolean bSkipNullValue, - final java.lang.String strNULLString) - { - if (null == str3DMap || str3DMap.isEmpty() || null == strNULLString || strNULLString.isEmpty() || - strNULLString.equalsIgnoreCase (str3DMap) || null == strKVDelimiter || strKVDelimiter.isEmpty() - || null == strRecordDelimiter || strRecordDelimiter.isEmpty()) - return null; - - java.lang.String[] astrRecord = org.drip.quant.common.StringUtil.Split (str3DMap, strRecordDelimiter); - - if (null == astrRecord || 0 == astrRecord.length) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap> - map3D = new - org.drip.analytics.support.CaseInsensitiveTreeMap>(); - - for (int i = 0; i < astrRecord.length; ++i) { - if (null == astrRecord[i] || astrRecord[i].isEmpty()) continue; - - java.lang.String[] astrKVPair = org.drip.quant.common.StringUtil.Split (astrRecord[i], strKVDelimiter); - - if (null == astrKVPair || 2 != astrKVPair.length || null == astrKVPair[0] || - astrKVPair[0].isEmpty() || strNULLString.equalsIgnoreCase (astrKVPair[0]) || (bSkipNullValue - && (null == astrKVPair[1] || astrKVPair[1].isEmpty() || strNULLString.equalsIgnoreCase - (astrKVPair[1])))) - continue; - - java.lang.String[] astrKeySet = org.drip.quant.common.StringUtil.Split (astrKVPair[0], - strMultiLevelKeyDelimiter); - - if (null == astrKeySet || 2 != astrKeySet.length || null == astrKeySet[0] || - astrKeySet[0].isEmpty() || strNULLString.equalsIgnoreCase (astrKeySet[0]) || null == - astrKeySet[1] || astrKeySet[1].isEmpty() || strNULLString.equalsIgnoreCase - (astrKeySet[1])) - continue; - - org.drip.analytics.support.CaseInsensitiveTreeMap map2D = map3D.get - (astrKeySet[0]); - - if (null == map2D) - map2D = new org.drip.analytics.support.CaseInsensitiveTreeMap(); - - map2D.put (astrKeySet[1], new java.lang.Double (astrKVPair[1])); - - map3D.put (astrKeySet[0], map2D); - } - - if (0 == map3D.size()) return null; - - return map3D; - } - - /** - * Turn a flattened 4D (string, string, string, double) string sequence into its corresponding map - * - * @param str4DMap Flattened 4D array input - * @param strMultiLevelKeyDelimiter Multi-level key delimiter string - * @param strKVDelimiter Key-Value delimiter string - * @param strRecordDelimiter Record delimiter string - * @param bSkipNullValue Indicates whether NULL Values are to be skipped - * @param strNULLString NULL string - * - * @return [String, [String, [String, double]]] map - */ - - public static final - org.drip.analytics.support.CaseInsensitiveTreeMap>> - FlatStringTo4DSDMap ( - final java.lang.String str4DMap, - final java.lang.String strMultiLevelKeyDelimiter, - final java.lang.String strKVDelimiter, - final java.lang.String strRecordDelimiter, - final boolean bSkipNullValue, - final java.lang.String strNULLString) - { - if (null == str4DMap || str4DMap.isEmpty() || null == strNULLString || strNULLString.isEmpty() || - strNULLString.equalsIgnoreCase (str4DMap) || null == strKVDelimiter || strKVDelimiter.isEmpty() - || null == strRecordDelimiter || strRecordDelimiter.isEmpty()) - return null; - - java.lang.String[] astrRecord = org.drip.quant.common.StringUtil.Split (str4DMap, strRecordDelimiter); - - if (null == astrRecord || 0 == astrRecord.length) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap>> - map4D = new - org.drip.analytics.support.CaseInsensitiveTreeMap>>(); - - for (int i = 0; i < astrRecord.length; ++i) { - if (null == astrRecord[i] || astrRecord[i].isEmpty() || strNULLString.equalsIgnoreCase - (astrRecord[i])) - continue; - - java.lang.String[] astrKVPairOut = org.drip.quant.common.StringUtil.Split (astrRecord[i], - strKVDelimiter); - - if (null == astrKVPairOut || 2 != astrKVPairOut.length || null == astrKVPairOut[0] || - astrKVPairOut[0].isEmpty() || strNULLString.equalsIgnoreCase (astrKVPairOut[0]) || - (bSkipNullValue && (null == astrKVPairOut[1] || astrKVPairOut[1].isEmpty() || - strNULLString.equalsIgnoreCase (astrKVPairOut[1])))) - continue; - - java.lang.String[] astrKeySet = org.drip.quant.common.StringUtil.Split (astrKVPairOut[0], - strMultiLevelKeyDelimiter); - - if (null == astrKeySet || 3 != astrKeySet.length || null == astrKeySet[0] || - astrKeySet[0].isEmpty() || strNULLString.equalsIgnoreCase (astrKeySet[0]) || null == - astrKeySet[1] || astrKeySet[1].isEmpty() || strNULLString.equalsIgnoreCase - (astrKeySet[1]) || null == astrKeySet[2] || astrKeySet[2].isEmpty() || - strNULLString.equalsIgnoreCase (astrKeySet[2])) - continue; - - org.drip.analytics.support.CaseInsensitiveTreeMap> - map3D = map4D.get (astrKeySet[0]); - - if (null == map3D) - map3D = new - org.drip.analytics.support.CaseInsensitiveTreeMap>(); - - org.drip.analytics.support.CaseInsensitiveTreeMap map2D = map3D.get - (astrKeySet[1]); - - if (null == map2D) - map2D = new org.drip.analytics.support.CaseInsensitiveTreeMap(); - - map2D.put (astrKeySet[2], new java.lang.Double (astrKVPairOut[1])); - - map3D.put (astrKeySet[1], map2D); - - map4D.put (astrKeySet[0], map3D); - } - - if (0 == map4D.size()) return null; - - return map4D; - } - - /** - * Populate an array of derivatives using the input slope (and setting the other to zero) - * - * @param iNumDerivs Number of Derivatives to be populated - * @param dblSlope Slope - * - * @return Array of derivatives - */ - - public static final double[] DerivArrayFromSlope ( - final int iNumDerivs, - final double dblSlope) - { - if (0 >= iNumDerivs || !org.drip.quant.common.NumberUtil.IsValid (dblSlope)) return null; - - double[] adblDeriv = new double[iNumDerivs]; - - for (int i = 0; i < iNumDerivs; ++i) - adblDeriv[i] = (0 == i) ? dblSlope : 0.; - - return adblDeriv; - } - - /** - * Append the Wengert Jacobians inside the list onto one single composite - * - * @param lsWJ List of Wengert Jacobians - * - * @return The Composite Wengert Jacobian - */ - - public static final org.drip.quant.calculus.WengertJacobian AppendWengert ( - final java.util.List lsWJ) - { - if (null == lsWJ || 0 == lsWJ.size()) return null; - - int iNumQuote = 0; - int iQuoteCursor = 0; - org.drip.quant.calculus.WengertJacobian wjCombined = null; - - for (org.drip.quant.calculus.WengertJacobian wj : lsWJ) - if (null != wj) iNumQuote += wj.numParameters(); - - try { - wjCombined = new org.drip.quant.calculus.WengertJacobian (1, iNumQuote); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (org.drip.quant.calculus.WengertJacobian wj : lsWJ) { - if (null == wj) continue; - - int iNumParams = wj.numParameters(); - - for (int i = 0; i < iNumParams; ++i) { - try { - if (!wjCombined.accumulatePartialFirstDerivative (0, iQuoteCursor++, wj.firstDerivative - (0, i))) - return null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - } - - return wjCombined; - } -} diff --git a/org/drip/quant/common/FormatUtil.java b/org/drip/quant/common/FormatUtil.java deleted file mode 100644 index 26a8ad0..0000000 --- a/org/drip/quant/common/FormatUtil.java +++ /dev/null @@ -1,136 +0,0 @@ - -package org.drip.quant.common; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * FormatUtil implements formatting utility functions. Currently it just exports functions to pad and format. - * - * @author Lakshmi Krishnamurthy - */ - -public class FormatUtil { - - /** - * Pre-pad a single digit integer with zeros - * - * @param i Integer representing the input - * - * @return String representing the padded output - */ - - public static final java.lang.String PrePad ( - final int i) - { - if (i > 9) return "" + i; - - return "0" + i; - } - - /** - * Format the double input by multiplying, and then adding left and right adjustments - * - * @param dblValue Double representing the input - * @param iNumLeft Integer representing the number of left justifying zeros - * @param iNumRight Integer representing the number of right justifying zeros - * @param dblMultiplier Double representing the multiplier - * @param bLeadingSpaceForPositive TRUE - A Leading Space will be emitted for Adjusted Positive Numbers. - * For Adjusted Negatives this will be the '-' sign. - * - * @return String representing the formatted input - */ - - public static final java.lang.String FormatDouble ( - final double dblValue, - final int iNumLeft, - final int iNumRight, - final double dblMultiplier, - final boolean bLeadingSpaceForPositive) - { - java.lang.String strFormat = "#"; - java.lang.String strLeading = ""; - double dblAdjustedValue = dblMultiplier * dblValue; - - if (0 <= dblAdjustedValue && bLeadingSpaceForPositive) strLeading = " "; - - for (int i = 0; i < iNumLeft; ++i) - strFormat += "0"; - - if (0 != iNumRight) { - strFormat += "."; - - for (int i = 0; i < iNumRight; ++i) - strFormat += "0"; - } - - return strLeading + new java.text.DecimalFormat (strFormat).format (dblAdjustedValue); - } - - /** - * Format the double input by multiplying, and then adding left and right adjustments - * - * @param dblValue Double representing the input - * @param iNumLeft Integer representing the number of left justifying zeros - * @param iNumRight Integer representing the number of right justifying zeros - * @param dblMultiplier Double representing the multiplier - * - * @return String representing the formatted input - */ - - public static final java.lang.String FormatDouble ( - final double dblValue, - final int iNumLeft, - final int iNumRight, - final double dblMultiplier) - { - return FormatDouble (dblValue, iNumLeft, iNumRight, dblMultiplier, true); - } -} diff --git a/org/drip/quant/common/NumberUtil.java b/org/drip/quant/common/NumberUtil.java deleted file mode 100644 index a0c9ddf..0000000 --- a/org/drip/quant/common/NumberUtil.java +++ /dev/null @@ -1,546 +0,0 @@ - -package org.drip.quant.common; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * NumberUtil implements number utility functions. It exposes the following functions: - * - Verify number/number array validity, and closeness/sign match - * - Factorial Permutation/Combination functionality - * - Dump multi-dimensional array contents - * - Min/Max/Bound the array entries within limits - * - * @author Lakshmi Krishnamurthy - */ - -public class NumberUtil { - private static final double DEFAULT_ABSOLUTE_TOLERANCE = 1.0e-03; - private static final double DEFAULT_RELATIVE_TOLERANCE = 1.0e-03; - - /** - * Check if the Input Long is MIN_VALUE or MAX_VALUE - * - * @param l Input Long - * - * @return TRUE - Input Long is MIN_VALUE or MAX_VALUE - */ - - public static final boolean IsValid ( - final long l) - { - return java.lang.Long.MIN_VALUE != l && java.lang.Long.MAX_VALUE != l; - } - - /** - * Check if the Input Long Array contains a MIN_VALUE or MAX_VALUE - * - * @param al Input Long Array - * - * @return TRUE - Input Long Array contains a MIN_VALUE or MAX_VALUE - */ - - public static final boolean IsValid ( - final long[] al) - { - if (null == al) return true; - - for (int i = 0; i < al.length; ++i) { - if (!IsValid (al[i])) return false; - } - - return true; - } - - /** - * Checks if the input double is Infinite or NaN - * - * @param dbl Input double - * - * @return TRUE - Input double is Infinite or NaN - */ - - public static final boolean IsValid ( - final double dbl) - { - return !java.lang.Double.isNaN (dbl) && !java.lang.Double.isInfinite (dbl); - } - - /** - * Checks if the input double array contains an Infinite or an NaN - * - * @param adbl Input double array - * - * @return TRUE - Input double contains an Infinite or an NaN - */ - - public static final boolean IsValid ( - final double[] adbl) - { - if (null == adbl) return true; - - for (int i = 0; i < adbl.length; ++i) { - if (!IsValid (adbl[i])) return false; - } - - return true; - } - - /** - * Compare and checks if the two input numbers fall within a specified tolerance - * - * @param dbl1 Number #1 - * @param dbl2 Number #2 - * @param dblAbsoluteTolerance Absolute Tolerance - * @param dblRelativeTolerance Relative Tolerance - * - * @return TRUE if they fall within the tolerance - */ - - public static final boolean WithinTolerance ( - final double dbl1, - final double dbl2, - final double dblAbsoluteTolerance, - final double dblRelativeTolerance) - { - if (!IsValid (dbl1) || !IsValid (dbl2)) return false; - - if (dblAbsoluteTolerance >= java.lang.Math.abs (dbl1)) { - if (dblAbsoluteTolerance >= java.lang.Math.abs (dbl2)) return true; - - return false; - } - - if (dblRelativeTolerance >= java.lang.Math.abs ((dbl2 - dbl1) / dbl1)) return true; - - return false; - } - - /** - * Compare and checks if the two input numbers fall within a specified tolerance - * - * @param dbl1 Number #1 - * @param dbl2 Number #2 - * - * @return TRUE if they fall within the tolerance - */ - - public static final boolean WithinTolerance ( - final double dbl1, - final double dbl2) - { - return WithinTolerance (dbl1, dbl2, DEFAULT_ABSOLUTE_TOLERANCE, DEFAULT_RELATIVE_TOLERANCE); - } - - /** - * This function implements Factorial N. - * - * @param n N - * - * @return Factorial N - */ - - public static final int Factorial ( - final int n) - { - int iNFact = 1; - - for (int i = 1; i <= n; ++i) - iNFact *= i; - - return iNFact; - } - - /** - * This function implements N Permute K. - * - * @param n N - * @param k K - * - * @return N Permute K - */ - - public static final int NPK ( - final int n, - final int k) - { - int iK = n < k ? n : k; - int iN = n > k ? n : k; - - return Factorial (iN) / Factorial (iK); - } - - /** - * This function implements N choose K. - * - * @param n N - * @param k K - * - * @return N choose K - */ - - public static final int NCK ( - final int n, - final int k) - { - int iK = n < k ? n : k; - int iN = n > k ? n : k; - - return Factorial (iN) / Factorial (iK) / Factorial (iN - iK); - } - - /** - * Bound the input to within (floor, Ceiling), i.e., compute Min (Max (floor, X), Ceiling) - * - * @param dblX Input Number - * @param dblFloor Floor - * @param dblCeiling Ceiling - * - * @return Min (Max (floor, X), Ceiling) - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public static final double Bound ( - final double dblX, - final double dblFloor, - final double dblCeiling) - throws java.lang.Exception - { - if (!IsValid (dblX) || !IsValid (dblFloor)|| !IsValid (dblCeiling) || dblFloor > dblCeiling) - throw new java.lang.Exception ("NumberUtil::Bound => Invalid Inputs"); - - double dblBound = dblX < dblFloor ? dblFloor : dblX; - return dblBound > dblCeiling ? dblCeiling : dblBound; - } - - /** - * Retrieve the Minimum Element in the specified Array - * - * @param adbl Array of elements - * - * @return The Minimum Element - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public static final double Minimum ( - final double[] adbl) - throws java.lang.Exception - { - if (!IsValid (adbl)) throw new java.lang.Exception ("NumberUtil::Minimum => Invalid Inputs"); - - double dblMinimum = adbl[0]; - int iNumElement = adbl.length; - - for (int i = 1; i < iNumElement; ++i) - dblMinimum = dblMinimum < adbl[i] ? dblMinimum : adbl[i]; - - return dblMinimum; - } - - /** - * Retrieve the Maximum Element in the specified Array - * - * @param adbl Array of elements - * - * @return The Maximum Element - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public static final double Maximum ( - final double[] adbl) - throws java.lang.Exception - { - if (!IsValid (adbl)) throw new java.lang.Exception ("NumberUtil::Maximum => Invalid Inputs"); - - double dblMaximum = adbl[0]; - int iNumElement = adbl.length; - - for (int i = 1; i < iNumElement; ++i) - dblMaximum = dblMaximum > adbl[i] ? dblMaximum : adbl[i]; - - return dblMaximum; - } - - /** - * Check if the specified array contains elements all of the same sign - * - * @param adbl Array of elements - * - * @return TRUE - Same Sign - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public static final boolean SameSign ( - final double[] adbl) - throws java.lang.Exception - { - if (!IsValid (adbl)) throw new java.lang.Exception ("NumberUtil::SameSign => Invalid Inputs"); - - if (adbl[0] <= 0.) return false; - - int iNumElement = adbl.length; - - for (int i = 1; i < iNumElement; ++i) { - if (adbl[0] * adbl[i] <= 0.) return false; - } - - return true; - } - - /** - * Print the contents of the 1D array - * - * @param strName Label Name - * @param adblA The 1D array - * @param bBailOnNaN Bail on encountering an NaN - * - * @return TRUE - Print Successful - */ - - public static final boolean Print1DArray ( - final java.lang.String strName, - final double[] adblA, - final boolean bBailOnNaN) - { - if (null == adblA || 0 == adblA.length) return false; - - int iSize = adblA.length; - - for (int i = 0; i < iSize; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (adblA[i]) && bBailOnNaN) return false; - - System.out.println (strName + "[" + i + "] = " + adblA[i]); - } - - return true; - } - - /** - * Print the contents of the 1D array to the Specified Decimal Location - * - * @param strName Label Name - * @param adblA The 1D array - * @param iNumDecimal Number of Decimal Places to Display - * @param bBailOnNaN Bail on encountering an NaN - * - * @return TRUE - Print Successful - */ - - public static final boolean Print1DArray ( - final java.lang.String strName, - final double[] adblA, - final int iNumDecimal, - final boolean bBailOnNaN) - { - if (null == adblA || 0 == adblA.length) return false; - - int iSize = adblA.length; - - for (int i = 0; i < iSize; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (adblA[i]) && bBailOnNaN) return false; - - System.out.println (strName + "[" + i + "] = " + org.drip.quant.common.FormatUtil.FormatDouble - (adblA[i], 1, iNumDecimal, 1.)); - } - - return true; - } - - /** - * Print the contents of the 2D array - * - * @param strName Label Name - * @param aadblA The 2D array - * @param bBailOnNaN Bail on encountering an NaN - * - * @return TRUE - Print Successful - */ - - public static final boolean Print2DArray ( - final java.lang.String strName, - final double[][] aadblA, - final boolean bBailOnNaN) - { - if (null == aadblA) return false; - - int iRowSize = aadblA.length; - - if (0 == iRowSize || null == aadblA[0]) return false; - - int iColSize = aadblA[0].length; - - if (0 == iColSize) return false; - - for (int i = 0; i < iRowSize; ++i) { - for (int j = 0; j < iColSize; ++j) { - if (!org.drip.quant.common.NumberUtil.IsValid (aadblA[i][j]) && bBailOnNaN) return false; - - System.out.println (strName + "[" + i + "][" + j + "] = " + - org.drip.quant.common.FormatUtil.FormatDouble (aadblA[i][j], 1, 6, 1.)); - } - } - - return true; - } - - /** - * Print the Contents of the 2D Array Pair - * - * @param strLeftLabel Left Label - * @param strRightLabel Right Label - * @param aadblLeft The Left 2D array - * @param aadblRight The Right 2D array - * @param bBailOnNaN Bail on encountering an NaN - * - * @return TRUE - Print Successful - */ - - public static final boolean Print2DArrayPair ( - final java.lang.String strLeftLabel, - final java.lang.String strRightLabel, - final double[][] aadblLeft, - final double[][] aadblRight, - final boolean bBailOnNaN) - { - if (null == aadblLeft || null == aadblRight) return false; - - int iSize = aadblLeft.length; - - if (0 == iSize || iSize != aadblRight.length) return false; - - for (int i = 0; i < iSize; ++i) { - for (int j = 0; j < iSize; ++j) { - if (!org.drip.quant.common.NumberUtil.IsValid (aadblLeft[i][j]) && - !org.drip.quant.common.NumberUtil.IsValid (aadblRight[i][j]) && bBailOnNaN) - return false; - - System.out.println (strLeftLabel + "[" + i + "][" + j + "] = " + - org.drip.quant.common.FormatUtil.FormatDouble (aadblLeft[i][j], 1, 6, 1.) + " | " + - strRightLabel + "[" + i + "][" + j + "] = " + - org.drip.quant.common.FormatUtil.FormatDouble (aadblRight[i][j], 1, 6, 1.)); - } - } - - return true; - } - - /** - * Print the Contents of the 2D Array Triplet - * - * @param strLeftLabel Left Label - * @param strMiddleLabel Middle Label - * @param strRightLabel Right Label - * @param aadblLeft The Left 2D array - * @param aadblMiddle The Middle 2D array - * @param aadblRight The Right 2D array - * @param bBailOnNaN Bail on encountering an NaN - * - * @return TRUE - Print Successful - */ - - public static final boolean Print2DArrayTriplet ( - final java.lang.String strLeftLabel, - final java.lang.String strMiddleLabel, - final java.lang.String strRightLabel, - final double[][] aadblLeft, - final double[][] aadblMiddle, - final double[][] aadblRight, - final boolean bBailOnNaN) - { - if (null == aadblLeft || null == aadblMiddle || null == aadblRight) return false; - - int iSize = aadblLeft.length; - - if (0 == iSize || iSize != aadblMiddle.length || iSize != aadblRight.length) return false; - - for (int i = 0; i < iSize; ++i) { - for (int j = 0; j < iSize; ++j) { - if (!org.drip.quant.common.NumberUtil.IsValid (aadblLeft[i][j]) && - !org.drip.quant.common.NumberUtil.IsValid (aadblLeft[i][j]) && - !org.drip.quant.common.NumberUtil.IsValid (aadblRight[i][j]) && bBailOnNaN) - return false; - - System.out.println (strLeftLabel + "[" + i + "][" + j + "] = " + - org.drip.quant.common.FormatUtil.FormatDouble (aadblLeft[i][j], 1, 6, 1.) + " | " + - strMiddleLabel + "[" + i + "][" + j + "] = " + - org.drip.quant.common.FormatUtil.FormatDouble (aadblMiddle[i][j], 1, 6, 1.) + - " | " + strRightLabel + "[" + i + "][" + j + "] = " + - org.drip.quant.common.FormatUtil.FormatDouble (aadblRight[i][j], 1, 6, - 1.)); - } - } - - return true; - } - - public static final boolean PrintMatrix ( - final java.lang.String strName, - final double[][] aadblA) - { - if (null == aadblA || 0 == aadblA.length) return false; - - int iSize = aadblA.length; - - for (int i = 0; i < iSize; ++i) { - java.lang.String strDump = strName + " => "; - - for (int j = 0; j < iSize; ++j) - strDump += org.drip.quant.common.FormatUtil.FormatDouble (aadblA[i][j], 1, 6, 1.) + " |"; - - System.out.println (strDump); - } - - return true; - } -} diff --git a/org/drip/quant/common/StringUtil.java b/org/drip/quant/common/StringUtil.java deleted file mode 100644 index 50abeed..0000000 --- a/org/drip/quant/common/StringUtil.java +++ /dev/null @@ -1,485 +0,0 @@ - -package org.drip.quant.common; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * StringUtil implements string utility functions. It exports the following functions: - * - Decompose + Transform string arrays into appropriate target type set/array/list, and vice versa - * - General-purpose String processor functions, such as GUID generator, splitter, type converter and input - * checker - * - * @author Lakshmi Krishnamurthy - */ - -public class StringUtil { - - /** - * Null serialized string - */ - - public static final java.lang.String NULL_SER_STRING = "<>"; - - /** - * Serialization Version - ALWAYS prepend this on all derived classes - */ - - public static final double VERSION = 2.4; - - /** - * Look for a match of the field in the input array - * - * @param strFieldToMatch Field To Match - * @param astrMatchSet Array of fields to compare with - * @param bCaseMatch TRUE - Match case - * - * @return TRUE - Match found according to the criteria specified - */ - - public static final boolean MatchInStringArray ( - final java.lang.String strFieldToMatch, - final java.lang.String[] astrMatchSet, - final boolean bCaseMatch) - { - if (null == strFieldToMatch || strFieldToMatch.isEmpty() || null == astrMatchSet || 0 == - astrMatchSet.length) - return false; - - for (java.lang.String strMatchSetEntry : astrMatchSet) { - if (null == strMatchSetEntry || strMatchSetEntry.isEmpty()) continue; - - if (strMatchSetEntry.equals (strFieldToMatch)) return true; - - if (!bCaseMatch && strMatchSetEntry.equalsIgnoreCase (strFieldToMatch)) return true; - } - - return false; - } - - /** - * Look for a match of the field in the field set to an entry in the input array - * - * @param astrFieldToMatch Field Array To Match - * @param astrMatchSet Array of fields to compare with - * @param bCaseMatch TRUE - Match case - * - * @return TRUE - Match found according to the criteria specified - */ - - public static final boolean MatchInStringArray ( - final java.lang.String[] astrFieldToMatch, - final java.lang.String[] astrMatchSet, - final boolean bCaseMatch) - { - if (null == astrFieldToMatch || 0 == astrFieldToMatch.length || null == astrMatchSet || 0 == - astrMatchSet.length) - return false; - - for (java.lang.String strFieldToMatch : astrFieldToMatch) { - if (MatchInStringArray (strFieldToMatch, astrMatchSet, bCaseMatch)) return true; - } - - return false; - } - - /** - * Format the given string parameter into an argument - * - * @param strArg String Argument - * - * @return Parameter from the Argument - */ - - public static final java.lang.String MakeStringArg ( - final java.lang.String strArg) - { - if (null == strArg) return "null"; - - if (strArg.isEmpty()) return "\"\""; - - return "\"" + strArg.trim() + "\""; - } - - /** - * Check the Input String to Check for NULL - and return it - * - * @param strIn Input String - * @param bEmptyToNULL TRUE if Empty String needs to be converted to NULL - * - * @return The Processed String - */ - - public static final java.lang.String ProcessInputForNULL ( - final java.lang.String strIn, - final boolean bEmptyToNULL) - { - if (null == strIn) return null; - - if (strIn.isEmpty()) return bEmptyToNULL ? null : ""; - - if ("null".equalsIgnoreCase (strIn.trim())) return null; - - if (strIn.trim().toUpperCase().startsWith ("NO")) return null; - - return strIn; - } - - /** - * Parse and Split the Input Phrase into a String Array using the specified Delimiter - * - * @param strPhrase Input Phrase - * @param strDelim Delimiter - * - * @return Array of Sub-Strings - */ - - public static final java.lang.String[] Split ( - final java.lang.String strPhrase, - final java.lang.String strDelim) - { - if (null == strPhrase || strPhrase.isEmpty() || null == strDelim || strDelim.isEmpty()) return null; - - java.util.List lsDelimIndex = new java.util.ArrayList(); - - int iDelimIndex = -1; - - while (-1 != (iDelimIndex = strPhrase.indexOf (strDelim, iDelimIndex + 1))) - lsDelimIndex.add (iDelimIndex); - - int iNumField = lsDelimIndex.size(); - - if (0 == iNumField) return null; - - int iBeginIndex = 0; - java.lang.String[] astr = new java.lang.String[iNumField + 1]; - - for (int i = 0; i < iNumField; ++i) { - int iFinishIndex = lsDelimIndex.get (i); - - astr[i] = iBeginIndex >= iFinishIndex ? "" : strPhrase.substring (iBeginIndex, iFinishIndex); - - iBeginIndex = lsDelimIndex.get (i) + 1; - } - - astr[iNumField] = strPhrase.substring (iBeginIndex); - - return astr; - } - - /** - * Check if the string represents an unitary boolean - * - * @param strUnitaryBoolean String input - * - * @return TRUE - Unitary Boolean - */ - - public static final boolean ParseFromUnitaryString ( - final java.lang.String strUnitaryBoolean) - { - if (null == strUnitaryBoolean || strUnitaryBoolean.isEmpty() || !"1".equalsIgnoreCase - (strUnitaryBoolean.trim())) - return false; - - return true; - } - - /** - * Make an array of Integers from a string tokenizer - * - * @param st Tokenizer containing delimited doubles - * - * @return Double array - */ - - public static final int[] MakeIntegerArrayFromStringTokenizer ( - final java.util.StringTokenizer st) - { - if (null == st) return null; - - java.util.List li = new java.util.ArrayList(); - - while (st.hasMoreTokens()) - li.add (new java.lang.Integer (st.nextToken())); - - if (0 == li.size()) return null; - - int[] ai = new int[li.size()]; - - int i = 0; - - for (int iValue : li) - ai[i++] = iValue; - - return ai; - } - - /** - * Make an array of double from a string tokenizer - * - * @param stdbl Tokenizer containing delimited doubles - * - * @return Double array - */ - - public static final double[] MakeDoubleArrayFromStringTokenizer ( - final java.util.StringTokenizer stdbl) - { - if (null == stdbl) return null; - - java.util.List lsdbl = new java.util.ArrayList(); - - while (stdbl.hasMoreTokens()) - lsdbl.add (new java.lang.Double (stdbl.nextToken())); - - if (0 == lsdbl.size()) return null; - - double[] adbl = new double[lsdbl.size()]; - - int i = 0; - - for (double dbl : lsdbl) - adbl[i++] = dbl; - - return adbl; - } - - /** - * Generate a GUID string - * - * @return String representing the GUID - */ - - public static final java.lang.String GUID() - { - return java.util.UUID.randomUUID().toString(); - } - - /** - * Split the string array into pairs of key-value doubles and returns them - * - * @param lsdblKey [out] List of Keys - * @param lsdblValue [out] List of Values - * @param strArray [in] String containing KV records - * @param strRecordDelim [in] Record Delimiter - * @param strKVDelim [in] Key-Value Delimiter - * - * @return True if parsing is successful - */ - - public static final boolean KeyValueListFromStringArray ( - final java.util.List lsdblKey, - final java.util.List lsdblValue, - final java.lang.String strArray, - final java.lang.String strRecordDelim, - final java.lang.String strKVDelim) - { - if (null == strArray || strArray.isEmpty() || null == strRecordDelim || strRecordDelim.isEmpty() || - null == strKVDelim || strKVDelim.isEmpty() || null == lsdblKey || null == lsdblValue) - return false; - - java.lang.String[] astr = Split (strArray, strRecordDelim); - - if (null == astr || 0 == astr.length) return false; - - for (int i = 0; i < astr.length; ++i) { - if (null == astr[i] || astr[i].isEmpty()) return false; - - java.lang.String[] astrRecord = Split (astr[i], strKVDelim); - - if (null == astrRecord || 2 != astrRecord.length || null == astrRecord[0] || - astrRecord[0].isEmpty() || null == astrRecord[1] || astrRecord[1].isEmpty()) - return false; - - lsdblKey.add (new java.lang.Double (astrRecord[0]).doubleValue()); - - lsdblValue.add (new java.lang.Double (astrRecord[1]).doubleValue()); - } - - return true; - } - - /** - * Create a list of integers from a delimited string - * - * @param lsi [Output] List of Integers - * @param strList Delimited String input - * @param strDelim Delimiter - * - * @return True if successful - */ - - public static final boolean IntegerListFromString ( - final java.util.List lsi, - final java.lang.String strList, - final java.lang.String strDelim) - { - if (null == lsi || null == strList || strList.isEmpty() || null == strDelim || strDelim.isEmpty()) - return false; - - java.lang.String[] astr = Split (strList, strDelim); - - if (null == astr || 0 == astr.length) return false; - - for (int i = 0; i < astr.length; ++i) { - if (null == astr[i] || astr[i].isEmpty()) continue; - - lsi.add (new java.lang.Integer (astr[i]).intValue()); - } - - return true; - } - - /** - * Create a list of booleans from a delimited string - * - * @param lsb [Output] List of Booleans - * @param strList Delimited String input - * @param strDelim Delimiter - * - * @return True if successful - */ - - public static final boolean BooleanListFromString ( - final java.util.List lsb, - final java.lang.String strList, - final java.lang.String strDelim) - { - if (null == lsb || null == strList || strList.isEmpty() || null == strDelim || strDelim.isEmpty()) - return false; - - java.lang.String[] astr = Split (strList, strDelim); - - if (null == astr || 0 == astr.length) return false; - - for (int i = 0; i < astr.length; ++i) { - if (null == astr[i] || astr[i].isEmpty()) continue; - - lsb.add (new java.lang.Boolean (astr[i]).booleanValue()); - } - - return true; - } - - /** - * Convert the String Array to a Record Delimited String - * - * @param astr Input String Array - * @param strRecordDelimiter The String Record Delimiter - * @param strNULL NULL String Indicator - * - * @return The Record Delimited String Array - */ - - public static final java.lang.String StringArrayToString ( - final java.lang.String[] astr, - final java.lang.String strRecordDelimiter, - final java.lang.String strNULL) - { - if (null == astr || null == strRecordDelimiter || strRecordDelimiter.isEmpty() || null == strNULL || - strNULL.isEmpty()) - return null; - - int iNumStr = astr.length; - - if (0 == iNumStr) return null; - - java.lang.StringBuffer sb = new java.lang.StringBuffer(); - - for (int i = 0; i < iNumStr; ++i) { - java.lang.String str = astr[i]; - - if (0 != i) sb.append (strRecordDelimiter); - - sb.append (null == str || str.isEmpty() ? strNULL : str); - } - - return sb.toString(); - } - - /** - * Indicate if the Input String is Empty - * - * @param str The Input String - * - * @return TRUE - The Input String is Empty - */ - - public static final boolean IsEmpty ( - final java.lang.String str) - { - return null == str || str.isEmpty(); - } - - /** - * Indicate it the pair of Strings Match each other in Value - * - * @param strLeft The Left String - * @param strRight The Right String - * - * @return TRUE - The Strings Match - */ - - public static final boolean StringMatch ( - final java.lang.String strLeft, - final java.lang.String strRight) - { - boolean bIsLeftEmpty = IsEmpty (strLeft); - - boolean bIsRightEmpty = IsEmpty (strRight); - - if (bIsLeftEmpty && bIsRightEmpty) return true; - - if ((bIsLeftEmpty && !bIsRightEmpty) || (!bIsLeftEmpty && bIsRightEmpty)) return false; - - return strLeft.equalsIgnoreCase (strRight); - } -} diff --git a/org/drip/quant/eigen/ComponentExtractor.java b/org/drip/quant/eigen/ComponentExtractor.java deleted file mode 100644 index 8024c03..0000000 --- a/org/drip/quant/eigen/ComponentExtractor.java +++ /dev/null @@ -1,81 +0,0 @@ - -package org.drip.quant.eigen; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ComponentExtractor Interface exposes the Methods that extract the Linear System Components using the Power - * Iteration Method. - * - * @author Lakshmi Krishnamurthy - */ - -public interface ComponentExtractor { - - /** - * Compute the Principal Component of the Specified Matrix - * - * @param aadblA The Input Matrix - * - * @return The Principal EigenComponent Instance - */ - - public abstract org.drip.quant.eigen.EigenComponent principalComponent ( - final double[][] aadblA); - - /** - * Eigenize and Extract the Components of the Specified Matrix - * - * @param aadblA The Input Matrix - * - * @return The EigenComponents - */ - - public abstract org.drip.quant.eigen.EigenOutput eigenize ( - final double[][] aadblA); -} diff --git a/org/drip/quant/eigen/EigenComponent.java b/org/drip/quant/eigen/EigenComponent.java deleted file mode 100644 index 6cfd375..0000000 --- a/org/drip/quant/eigen/EigenComponent.java +++ /dev/null @@ -1,110 +0,0 @@ - -package org.drip.quant.eigen; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * EigenComponent holds the Component's Eigenvector and the corresponding Eigenvalue. - * - * @author Lakshmi Krishnamurthy - */ - -public class EigenComponent { - private double[] _adblEigenvector = null; - private double _dblEigenvalue = java.lang.Double.NaN; - - /** - * EigenComponent Constructor - * - * @param adblEigenvector The Eigenvector - * @param dblEigenvalue The Eigenvalue - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public EigenComponent ( - final double[] adblEigenvector, - final double dblEigenvalue) - throws java.lang.Exception - { - if (null == (_adblEigenvector = adblEigenvector) || !org.drip.quant.common.NumberUtil.IsValid - (_dblEigenvalue = dblEigenvalue)) - throw new java.lang.Exception ("EigenComponent ctr: Invalid Inputs"); - - int iNumOrdinate = _adblEigenvector.length; - - if (0 == iNumOrdinate) throw new java.lang.Exception ("EigenComponent ctr: Invalid Inputs"); - - for (int i = 0; i < iNumOrdinate; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (_adblEigenvector[i])) - throw new java.lang.Exception ("EigenComponent ctr: Invalid Inputs"); - } - } - - /** - * Retrieve the Eigenvalue - * - * @return The Eigenvalue - */ - - public double eigenvalue() - { - return _dblEigenvalue; - } - - /** - * Retrieve the Eigenvector - * - * @return The Eigenvector - */ - - public double[] eigenvector() - { - return _adblEigenvector; - } -} diff --git a/org/drip/quant/eigen/EigenOutput.java b/org/drip/quant/eigen/EigenOutput.java deleted file mode 100644 index 6f43ef5..0000000 --- a/org/drip/quant/eigen/EigenOutput.java +++ /dev/null @@ -1,106 +0,0 @@ - -package org.drip.quant.eigen; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * EigenOutput holds the results of the Eigenization Operation - the Eigenvectors and the Eigenvalues. - * - * @author Lakshmi Krishnamurthy - */ - -public class EigenOutput { - private double[] _adblEigenvalue = null; - private double[][] _aadblEigenvector = null; - - /** - * EigenOutput Constructor - * - * @param aadblEigenvector Array of Eigenvectors - * @param adblEigenvalue Array of Eigenvalues - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public EigenOutput ( - final double[][] aadblEigenvector, - final double[] adblEigenvalue) - throws java.lang.Exception - { - if (null == (_aadblEigenvector = aadblEigenvector) || null == (_adblEigenvalue = adblEigenvalue)) - throw new java.lang.Exception ("EigenOutput ctr: Invalid Inputs"); - - int iNumVector = _adblEigenvalue.length; - - if (0 == iNumVector || iNumVector != _aadblEigenvector.length || null == _aadblEigenvector[0] || - iNumVector != _aadblEigenvector[0].length) - throw new java.lang.Exception ("EigenOutput ctr: Invalid Inputs"); - } - - /** - * Retrieve the Array of Eigenvectors - * - * @return The Array of Eigenvectors - */ - - public double[][] eigenvector() - { - return _aadblEigenvector; - } - - /** - * Retrieve the Array of Eigenvalues - * - * @return The Array of Eigenvalues - */ - - public double[] eigenvalue() - { - return _adblEigenvalue; - } -} diff --git a/org/drip/quant/eigen/PowerIterationComponentExtractor.java b/org/drip/quant/eigen/PowerIterationComponentExtractor.java deleted file mode 100644 index 9ca6afc..0000000 --- a/org/drip/quant/eigen/PowerIterationComponentExtractor.java +++ /dev/null @@ -1,186 +0,0 @@ - -package org.drip.quant.eigen; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * PowerIterationComponentExtractor extracts the Linear System Components using the Power Iteration Method. - * - * @author Lakshmi Krishnamurthy - */ - -public class PowerIterationComponentExtractor implements org.drip.quant.eigen.ComponentExtractor { - private int _iMaxIteration = -1; - private boolean _bToleranceAbsolute = false; - private double _dblTolerance = java.lang.Double.NaN; - - /** - * PowerIterationComponentExtractor Constructor - * - * @param iMaxIteration Maximum Number of Iterations - * @param dblTolerance Tolerance - * @param bToleranceAbsolute Is Tolerance Absolute - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public PowerIterationComponentExtractor ( - final int iMaxIteration, - final double dblTolerance, - final boolean bToleranceAbsolute) - throws java.lang.Exception - { - if (0 >= (_iMaxIteration = iMaxIteration) || !org.drip.quant.common.NumberUtil.IsValid (_dblTolerance - = dblTolerance) || 0. == _dblTolerance) - throw new java.lang.Exception ("PowerIterationComponentExtractor ctr: Invalid Inputs!"); - - _bToleranceAbsolute = bToleranceAbsolute; - } - - /** - * Retrieve the Maximum Number of Iterations - * - * @return The Maximum Number of Iterations - */ - - public int maxIterations() - { - return _iMaxIteration; - } - - /** - * Retrieve the Tolerance Level - * - * @return The Tolerance Level - */ - - public double tolerance() - { - return _dblTolerance; - } - - /** - * Indicate if the specified Tolerance is Absolute - * - * @return TRUE - The specified Tolerance is Absolute - */ - - public boolean isToleranceAbsolute() - { - return _bToleranceAbsolute; - } - - @Override public org.drip.quant.eigen.EigenComponent principalComponent ( - final double[][] aadblA) - { - if (null == aadblA) return null; - - int iIter = 0; - double dblEigenvalue = 0.; - int iSize = aadblA.length; - double[] adblEigenvector = new double[iSize]; - double[] adblUpdatedEigenvector = new double[iSize]; - - if (0 == iSize || null == aadblA[0] || iSize != aadblA[0].length) return null; - - for (int i = 0; i < iSize; ++i) { - adblEigenvector[i] = java.lang.Math.random(); - - dblEigenvalue += adblEigenvector[i] * adblEigenvector[i]; - } - - double dblEigenvalueOld = (dblEigenvalue = java.lang.Math.sqrt (dblEigenvalue)); - - for (int i = 0; i < iSize; ++i) - adblEigenvector[i] /= dblEigenvalue; - - double dblAbsoluteTolerance = _bToleranceAbsolute ? _dblTolerance : dblEigenvalue * _dblTolerance; - dblAbsoluteTolerance = dblAbsoluteTolerance > _dblTolerance ? dblAbsoluteTolerance : _dblTolerance; - - while (iIter < _iMaxIteration) { - for (int i = 0; i < iSize; ++i) { - adblUpdatedEigenvector[i] = 0.; - - for (int j = 0; j < iSize; ++j) - adblUpdatedEigenvector[i] += aadblA[i][j] * adblEigenvector[j]; - } - - dblEigenvalue = 0.; - - for (int i = 0; i < iSize; ++i) - dblEigenvalue += adblUpdatedEigenvector[i] * adblUpdatedEigenvector[i]; - - dblEigenvalue = java.lang.Math.sqrt (dblEigenvalue); - - for (int i = 0; i < iSize; ++i) - adblUpdatedEigenvector[i] /= dblEigenvalue; - - if (dblAbsoluteTolerance > java.lang.Math.abs (dblEigenvalue - dblEigenvalueOld)) break; - - adblEigenvector = adblUpdatedEigenvector; - dblEigenvalueOld = dblEigenvalue; - ++iIter; - } - - if (iIter >= _iMaxIteration) return null; - - try { - return new org.drip.quant.eigen.EigenComponent (adblEigenvector, dblEigenvalue); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.quant.eigen.EigenOutput eigenize ( - final double[][] aadblA) - { - return null; - } -} diff --git a/org/drip/quant/eigen/QREigenComponentExtractor.java b/org/drip/quant/eigen/QREigenComponentExtractor.java deleted file mode 100644 index ce059a8..0000000 --- a/org/drip/quant/eigen/QREigenComponentExtractor.java +++ /dev/null @@ -1,252 +0,0 @@ - -package org.drip.quant.eigen; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * QREigenComponentExtractor extracts the Eigenvalues and Eigenvectors using QR Decomposition. - * - * @author Lakshmi Krishnamurthy - */ - -public class QREigenComponentExtractor implements org.drip.quant.eigen.ComponentExtractor { - private int _iMaxIteration = -1; - private double _dblTolerance = java.lang.Double.NaN; - - /** - * QREigenComponentExtractor Constructor - * - * @param iMaxIteration Maximum Number of Iterations - * @param dblTolerance Tolerance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public QREigenComponentExtractor ( - final int iMaxIteration, - final double dblTolerance) - throws java.lang.Exception - { - if (0 >= (_iMaxIteration = iMaxIteration) || !org.drip.quant.common.NumberUtil.IsValid (_dblTolerance - = dblTolerance) || 0. == _dblTolerance) - throw new java.lang.Exception ("QREigenComponentExtractor ctr: Invalid Inputs!"); - } - - /** - * Retrieve the Maximum Number of Iterations - * - * @return The Maximum Number of Iterations - */ - - public int maxIterations() - { - return _iMaxIteration; - } - - /** - * Retrieve the Tolerance Level - * - * @return The Tolerance Level - */ - - public double tolerance() - { - return _dblTolerance; - } - - @Override public org.drip.quant.eigen.EigenOutput eigenize ( - final double[][] aadblA) - { - org.drip.quant.linearalgebra.QR qr = org.drip.quant.linearalgebra.Matrix.QRDecomposition (aadblA); - - if (null == qr) return null; - - double[][] aadblQ = qr.q(); - - double[][] aadblQT = org.drip.quant.linearalgebra.Matrix.Transpose (aadblQ); - - if (null == aadblQT) return null; - - int iIter = 0; - int iSize = aadblA.length; - double[] adblEigenvalue = new double[iSize]; - double[][] aadblB = new double[iSize][iSize]; - double[][] aadblV = new double[iSize][iSize]; - - if (0 == iSize || null == aadblQT[0] || iSize != aadblQT[0].length) return null; - - for (int i = 0; i < iSize; ++i) { - for (int j = 0; j < iSize; ++j) { - aadblB[i][j] = aadblQ[i][j]; - aadblV[i][j] = aadblA[i][j]; - } - } - - while (iIter++ < _iMaxIteration && org.drip.quant.linearalgebra.Matrix.NON_TRIANGULAR == - org.drip.quant.linearalgebra.Matrix.TriangularType (aadblV, _dblTolerance)) { - if (null == (qr = org.drip.quant.linearalgebra.Matrix.QRDecomposition (aadblV = - org.drip.quant.linearalgebra.Matrix.Product (aadblQT, - org.drip.quant.linearalgebra.Matrix.Product (aadblV, aadblQ))))) - return null; - - aadblQT = org.drip.quant.linearalgebra.Matrix.Transpose (aadblQ = qr.q()); - - aadblB = org.drip.quant.linearalgebra.Matrix.Product (aadblB, aadblQ); - } - - if (iIter >= _iMaxIteration) return null; - - for (int i = 0; i < iSize; ++i) - adblEigenvalue[i] = aadblV[i][i]; - - try { - return new org.drip.quant.eigen.EigenOutput (org.drip.quant.linearalgebra.Matrix.Transpose - (aadblB), adblEigenvalue); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Order List of Eigenvalues for the specified Eigen-output - * - * @param eo The Eigen Output - * - * @return The Order List - */ - - public java.util.List orderedEigenList ( - final org.drip.quant.eigen.EigenOutput eo) - { - if (null == eo) return null; - - double[] adblEigenvalue = eo.eigenvalue(); - - int iSize = adblEigenvalue.length; - - java.util.List lsEigenValue = new java.util.ArrayList(); - - java.util.List lsEigenOrder = new java.util.ArrayList(); - - for (int i = 0; i < iSize; ++i) { - int iNumOrder = lsEigenOrder.size(); - - if (0 == iNumOrder) { - lsEigenOrder.add (i); - - lsEigenValue.add (adblEigenvalue[i]); - } else { - int iInsertIndex = 0; - - for (int j = 0; j < iNumOrder; ++j) { - if (adblEigenvalue[i] <= lsEigenValue.get (j)) { - iInsertIndex = j; - break; - } - } - - lsEigenOrder.add (iInsertIndex, i); - - lsEigenValue.add (iInsertIndex, adblEigenvalue[i]); - } - } - - return lsEigenOrder; - } - - /** - * Generate the Ordered List of Eigen Components arranged by Ascending Eigenvalue - * - * @param aadblA Input Matrix - * - * @return The Ordered List of Eigen Components arranged by Ascending Eigenvalue - */ - - public org.drip.quant.eigen.EigenComponent[] orderedComponents ( - final double[][] aadblA) - { - org.drip.quant.eigen.EigenOutput eo = eigenize (aadblA); - - java.util.List lsEigenOrder = orderedEigenList (eo); - - if (null == lsEigenOrder) return null; - - int iNumComponent = lsEigenOrder.size(); - - double[] adblEigenvalue = eo.eigenvalue(); - - double[][] aadblEigenvector = eo.eigenvector(); - - org.drip.quant.eigen.EigenComponent[] aEC = new org.drip.quant.eigen.EigenComponent[iNumComponent]; - - for (int i = 0; i < iNumComponent; ++i) { - int iIndex = lsEigenOrder.get (i); - - try { - aEC[i] = new org.drip.quant.eigen.EigenComponent (aadblEigenvector[iIndex], - adblEigenvalue[iIndex]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return aEC; - } - - @Override public org.drip.quant.eigen.EigenComponent principalComponent ( - final double[][] aadblA) - { - org.drip.quant.eigen.EigenComponent[] aEC = orderedComponents (aadblA); - - return null == aEC ? null : aEC[0]; - } -} diff --git a/org/drip/quant/fourier/ComplexNumber.java b/org/drip/quant/fourier/ComplexNumber.java deleted file mode 100644 index fd86620..0000000 --- a/org/drip/quant/fourier/ComplexNumber.java +++ /dev/null @@ -1,407 +0,0 @@ - -package org.drip.quant.fourier; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ComplexNumber implements the functionality for dealing with Complex Numbers. - * - * @author Lakshmi Krishnamurthy - */ - -public class ComplexNumber { - private double _dblReal = java.lang.Double.NaN; - private double _dblImaginary = java.lang.Double.NaN; - - /** - * Add the 2 Complex Numbers - * - * @param cn1 The First Complex Number - * @param cn2 The Second Complex Number - * - * @return The Complex Number instance that is a sum of the two - */ - - public static final ComplexNumber Add ( - final ComplexNumber cn1, - final ComplexNumber cn2) - { - if (null == cn1 || null == cn2) return null; - - try { - return new ComplexNumber (cn1.real() + cn2.real(), cn1.imaginary() + cn2.imaginary()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Scale the Complex Number with the factor - * - * @param cn The Complex Number - * @param dblScale The Scaling Factor - * - * @return The Scaled Complex Number - */ - - public static final ComplexNumber Scale ( - final ComplexNumber cn, - final double dblScale) - { - if (null == cn || !org.drip.quant.common.NumberUtil.IsValid (dblScale)) return null; - - try { - return new ComplexNumber (dblScale * cn.real(), dblScale * cn.imaginary()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Subtract the Second Complex Number from the First - * - * @param cn1 The First Complex Number - * @param cn2 The Second Complex Number - * - * @return The "Difference" Complex Number - */ - - public static final ComplexNumber Subtract ( - final ComplexNumber cn1, - final ComplexNumber cn2) - { - if (null == cn1 || null == cn2) return null; - - try { - return new ComplexNumber (cn1.real() - cn2.real(), cn1.imaginary() - cn2.imaginary()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Multiply the 2 Complex Numbers - * - * @param cn1 The First Complex Number - * @param cn2 The Second Complex Number - * - * @return The Complex Number instance that is a product of the two - */ - - public static final ComplexNumber Multiply ( - final ComplexNumber cn1, - final ComplexNumber cn2) - { - if (null == cn1 || null == cn2) return null; - - double dblReal1 = cn1.real(); - - double dblReal2 = cn2.real(); - - double dblImaginary1 = cn1.imaginary(); - - double dblImaginary2 = cn2.imaginary(); - - try { - return new ComplexNumber (dblReal1 * dblReal2 - dblImaginary1 * dblImaginary2, dblReal1 * - dblImaginary2 + dblReal2 * dblImaginary1); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Divide the Numerator Complex Number by the Denominator - * - * @param cnNumerator The Numerator Complex Number - * @param cnDenominator The Denominator Complex Number - * - * @return The "Divided" Complex Number - */ - - public static final ComplexNumber Divide ( - final ComplexNumber cnNumerator, - final ComplexNumber cnDenominator) - { - if (null == cnNumerator || null == cnDenominator) return null; - - double dblRealNumerator = cnNumerator.real(); - - double dblRealDenominator = cnDenominator.real(); - - double dblImaginaryNumerator = cnNumerator.imaginary(); - - double dblImaginaryDenominator = cnDenominator.imaginary(); - - if (0. == dblRealDenominator && 0. == dblImaginaryDenominator) return null; - - double dblInverseDenominatorModulus = 1. / cnDenominator.modulus(); - - try { - return new ComplexNumber ((dblRealNumerator * dblRealDenominator + dblImaginaryNumerator * - dblImaginaryDenominator) * dblInverseDenominatorModulus, (dblRealDenominator * - dblImaginaryNumerator - dblRealNumerator * dblImaginaryDenominator) * - dblInverseDenominatorModulus); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Square the Complex Number - * - * @param cn The Complex Number - * - * @return The Squared Complex Number Instance - */ - - public static final ComplexNumber Square ( - final ComplexNumber cn) - { - if (null == cn) return null; - - double dblRealOther = cn.real(); - - double dblImaginaryOther = cn.imaginary(); - - try { - return new ComplexNumber (dblRealOther * dblRealOther - dblImaginaryOther * dblImaginaryOther, 2. - * dblRealOther * dblImaginaryOther); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Square Root of the Complex Number - * - * @param cn The Complex Number - * - * @return The Square Root Complex Number Instance - */ - - public static final ComplexNumber SquareRoot ( - final ComplexNumber cn) - { - if (null == cn) return null; - - double dblModulus = cn.modulus(); - - if (0. == dblModulus) { - try { - return new ComplexNumber (0., 0.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - double dblReal = java.lang.Math.sqrt (0.5 * (cn.real() + java.lang.Math.sqrt (dblModulus))); - - try { - return new ComplexNumber (dblReal, 0.5 * cn.imaginary() / dblReal); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Exponentiate the Complex Number - * - * @param cn The Complex Number - * - * @return The Exponentiated Complex Number Instance - */ - - public static final ComplexNumber Exponentiate ( - final ComplexNumber cn) - { - if (null == cn) return null; - - double dblImaginary = cn.imaginary(); - - double dblCoefficient = java.lang.Math.exp (cn.real()); - - try { - return new ComplexNumber (dblCoefficient * java.lang.Math.cos (dblImaginary), dblCoefficient * - java.lang.Math.sin (dblImaginary)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute Logarithm of the Complex Number - * - * @param cn The Complex Number - * - * @return The Complex Number Logarithm Instance - */ - - public static final ComplexNumber Logarithm ( - final ComplexNumber cn) - { - if (null == cn) return null; - - double dblModulus = cn.modulus(); - - if (0. == dblModulus) return null; - - try { - return new ComplexNumber (0.5 * java.lang.Math.log (dblModulus), java.lang.Math.atan - (cn.imaginary() / cn.real())); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * ComplexNumber constructor - * - * @param dblReal Real Part - * @param dblImaginary Imaginary Part - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public ComplexNumber ( - final double dblReal, - final double dblImaginary) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblReal = dblReal) || - !org.drip.quant.common.NumberUtil.IsValid (_dblImaginary = dblImaginary)) - throw new java.lang.Exception ("ComplexNumber ctr: Invalid Inputs"); - } - - /** - * Retrieve the Real Part - * - * @return The Real Part - */ - - public double real() - { - return _dblReal; - } - - /** - * Retrieve the Imaginary Part - * - * @return The Imaginary Part - */ - - public double imaginary() - { - return _dblImaginary; - } - - /** - * Retrieve the Modulus - * - * @return The Modulus - */ - - public double modulus() - { - return _dblReal * _dblReal + _dblImaginary * _dblImaginary; - } - - /** - * Retrieve the Absolute Value - * - * @return The Absolute Value - */ - - public double abs() - { - return java.lang.Math.sqrt (modulus()); - } - - /** - * Retrieve the Argument - * - * @return The Argument - */ - - public double argument() - { - return java.lang.Math.atan (_dblImaginary / _dblReal); - } - - /** - * Display the Real/Imaginary Contents - * - * @return The Real/Imaginary Contents - */ - - public java.lang.String display() - { - return "\t[" + _dblReal + ", " + _dblImaginary + "]"; - } -} diff --git a/org/drip/quant/fourier/PhaseAdjuster.java b/org/drip/quant/fourier/PhaseAdjuster.java deleted file mode 100644 index a7bbdd4..0000000 --- a/org/drip/quant/fourier/PhaseAdjuster.java +++ /dev/null @@ -1,113 +0,0 @@ - -package org.drip.quant.fourier; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * PhaseAdjuster implements the functionality specifically meant for enhancing stability of the Fourier - * numerical Routines. - * - * @author Lakshmi Krishnamurthy - */ - -public class PhaseAdjuster { - - /** - * No Multi-Valued Principal Branch Tracking - */ - - public static final int MULTI_VALUE_BRANCH_PHASE_TRACKER_NONE = 0; - - /** - * Multi-Valued Logarithm Principal Branch Tracking Using Rotating Counting - */ - - public static final int MULTI_VALUE_BRANCH_PHASE_TRACKER_ROTATION_COUNT = 1; - - /** - * Multi-Valued Logarithm PLUS Power Principal Branch Tracking Using the Kahl-Jackel Algorithm - */ - - public static final int MULTI_VALUE_BRANCH_POWER_PHASE_TRACKER_KAHL_JACKEL = 2; - - /** - * Handling the Branch Switching of the Complex Power Function according Kahl-Jackel algorithm: - * - http://www.pjaeckel.webspace.virginmedia.com/NotSoComplexLogarithmsInTheHestonModel.pdf - * - * @param cnGNumerator The Log G Numerator - * @param cnGDenominator The Log G Denominator - * @param iN Number of Numerator Counted rotations - * @param iM Number of Numerator Counted rotations - * - * @return The Branch Switching Log Adjustment - */ - - public static final org.drip.quant.fourier.ComplexNumber PowerLogPhaseTracker ( - final org.drip.quant.fourier.ComplexNumber cnGNumerator, - final org.drip.quant.fourier.ComplexNumber cnGDenominator, - final int iN, - final int iM) - { - if (null == cnGNumerator || null == cnGNumerator || iN < 0 || iM < 0) return null; - - double dblAbsDenominator = cnGDenominator.abs(); - - if (0. == dblAbsDenominator) return null; - - try { - return new org.drip.quant.fourier.ComplexNumber (java.lang.Math.log (cnGNumerator.abs() / - dblAbsDenominator), cnGNumerator.argument() - cnGDenominator.argument() + 2. * - java.lang.Math.PI * (iN - iM)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/quant/fourier/RotationCountPhaseTracker.java b/org/drip/quant/fourier/RotationCountPhaseTracker.java deleted file mode 100644 index 9b4a88a..0000000 --- a/org/drip/quant/fourier/RotationCountPhaseTracker.java +++ /dev/null @@ -1,180 +0,0 @@ - -package org.drip.quant.fourier; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * RotationCountPhaseTracker implements the standard technique to preserve the trajectory along the principal - * branch in multi-valued complex operations. This is most common in Fourier inversion quadrature runs. - * - * @author Lakshmi Krishnamurthy - */ - -public class RotationCountPhaseTracker { - - /** - * APPLY_NONE - Do not Apply Rotation Count - */ - - public static final int APPLY_NONE = 0; - - /** - * APPLY_BACKWARD - Decrement Rotation Count - */ - - public static final int APPLY_BACKWARD = 1; - - /** - * APPLY_FORWARD - Increment Rotation Count - */ - - public static final int APPLY_FORWARD = 2; - - private int _iRotationDirection = APPLY_NONE; - private double _dblPreviousPhase = java.lang.Double.NaN; - - /** - * Empty RotationCountPhaseTracker constructor - Initialize to "NO ROTATION COUNT" - */ - - public RotationCountPhaseTracker() - { - _iRotationDirection = APPLY_NONE; - } - - /** - * Set the Direction on which the rotation count is to be applied - * - * @param iRotationDirection The Rotation Direction - * - * @return TRUE - Successfully set - */ - - public boolean setDirection ( - final int iRotationDirection) - { - _iRotationDirection = iRotationDirection; - return true; - } - - /** - * Get the Direction on which the rotation count is to be applied - * - * @return The Rotation Direction - */ - - public int getDirection() - { - return _iRotationDirection; - } - - /** - * Set the Previous Phase - * - * @param dblPreviousPhase The Previous Phase - * - * @return TRUE - Previous Phase Successfully set - */ - - public boolean setPreviousPhase ( - final double dblPreviousPhase) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPreviousPhase)) return false; - - _dblPreviousPhase = dblPreviousPhase; - return true; - } - - /** - * Get the Previous Phase - * - * @return The Previous Phase - */ - - public double getPreviousPhase() - { - return _dblPreviousPhase; - } - - /** - * Apply the Rotation Count Adjustment in accordance with the direction, (optionally) record the previous - * phase. - * - * @param dblCurrentPhase The Phase to be Updated - * @param bApply TRUE - Record the Previous Phase - * - * @return The Updated Phase - * - * @throws java.lang.Exception Thrown if the Operation cannot be performed - */ - - public double updateAndApply ( - final double dblCurrentPhase, - final boolean bApply) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCurrentPhase)) - throw new java.lang.Exception ("RotationCountPhaseTracker::updateAndApply => Invalid Inputs"); - - double dblUpdatedPhase = dblCurrentPhase; - - if (APPLY_FORWARD == _iRotationDirection) { - while (dblUpdatedPhase < _dblPreviousPhase) - dblUpdatedPhase += 2. * java.lang.Math.PI; - } else if (APPLY_BACKWARD == _iRotationDirection) { - while (dblUpdatedPhase > _dblPreviousPhase) - dblUpdatedPhase -= 2. * java.lang.Math.PI; - } else if (APPLY_NONE != _iRotationDirection) - throw new java.lang.Exception ("RotationCountPhaseTracker::updateAndApply => Invalid State"); - - if (bApply) _dblPreviousPhase = dblUpdatedPhase; - - return dblUpdatedPhase; - } -} diff --git a/org/drip/quant/linearalgebra/LinearSystemSolver.java b/org/drip/quant/linearalgebra/LinearSystemSolver.java deleted file mode 100644 index df67faf..0000000 --- a/org/drip/quant/linearalgebra/LinearSystemSolver.java +++ /dev/null @@ -1,334 +0,0 @@ - -package org.drip.quant.linearalgebra; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * LinearSystemSolver implements the solver for a system of linear equations given by A * x = B, where A is - * the matrix, x the set of variables, and B is the result to be solved for. It exports the following - * functions: - * - Row Regularization and Diagonal Pivoting - * - Check for Diagonal Dominance - * - Solving the linear system using any one of the following: Gaussian Elimination, Gauss Seidel reduction, - * or matrix inversion. - * - * @author Lakshmi Krishnamurthy - */ - -public class LinearSystemSolver { - - /** - * Regularize (i.e., convert the diagonal entries of the given cell to non-zero using suitable linear - * transformations) - * - * @param aadblA In/Out Matrix to be regularized - * @param adblSolution In/out RHS - * @param iInnerRow Matrix Cell Row that needs to be regularized - * @param iOuter Matrix Cell Column that needs to be regularized - * - * @return TRUE - Matrix has been successfully regularized - */ - - public static final boolean RegulariseRow ( - final double[][] aadblA, - final double[] adblSolution, - final int iInnerRow, - final int iOuter) - { - double dblInnerScaler = aadblA[iInnerRow][iOuter]; - - if (0. != dblInnerScaler) return true; - - int iSize = aadblA.length; - int iProxyRow = iSize - 1; - - while (0. == aadblA[iProxyRow][iOuter] && iProxyRow >= 0) --iProxyRow; - - if (iProxyRow < 0) return false; - - adblSolution[iInnerRow] += adblSolution[iProxyRow]; - - for (int i = 0; i < iSize; ++i) - aadblA[iInnerRow][i] += aadblA[iProxyRow][i]; - - return 0. != aadblA[iInnerRow][iOuter]; - } - - /** - * Check to see if the matrix is diagonally dominant. - * - * @param aadblA Input Matrix - * @param bCheckForStrongDominance TRUE - Fail if the matrix is not strongly diagonally dominant. - * - * @return TRUE - Strongly or weakly Diagonally Dominant - */ - - public static final boolean IsDiagonallyDominant ( - final double[][] aadblA, - final boolean bCheckForStrongDominance) - { - if (null == aadblA) return false; - - int iSize = aadblA.length; - - if (0 == iSize || null == aadblA[0] || iSize != aadblA[0].length) return false; - - for (int i = 0; i < iSize; ++i) { - double dblAbsoluteDiagonalEntry = java.lang.Math.abs (aadblA[i][i]); - - for (int j = 0; j < iSize; ++j) { - if (i != j) { - if ((bCheckForStrongDominance && dblAbsoluteDiagonalEntry <= java.lang.Math.abs - (aadblA[i][j])) || (!bCheckForStrongDominance && dblAbsoluteDiagonalEntry < - java.lang.Math.abs (aadblA[i][j]))) - return false; - } - } - } - - return true; - } - - /** - * Pivots the matrix A (Refer to wikipedia to find out what "pivot a matrix" means ;)) - * - * @param aadblA Input Matrix - * @param adblB Input RHS - * - * @return The pivoted input matrix and the re-jigged input RHS - */ - - public static final double[] Pivot ( - final double[][] aadblA, - final double[] adblB) - { - if (null == aadblA || null == adblB) return null; - - int iSize = aadblA.length; - double[] adblSolution = new double[iSize]; - - if (0 == iSize || null == aadblA[0] || iSize != aadblA[0].length || iSize != adblB.length) - return null; - - for (int i = 0; i < iSize; ++i) - adblSolution[i] = adblB[i]; - - for (int iDiagonal = 0; iDiagonal < iSize; ++iDiagonal) { - if (!RegulariseRow (aadblA, adblSolution, iDiagonal, iDiagonal)) return null; - } - - return adblSolution; - } - - /** - * Solve the Linear System using Matrix Inversion from the Set of Values in the Array - * - * @param aadblAIn Input Matrix - * @param adblB The Array of Values to be calibrated to - * - * @return The Linear System Solution for the Coefficients - */ - - public static final org.drip.quant.linearalgebra.LinearizationOutput SolveUsingMatrixInversion ( - final double[][] aadblAIn, - final double[] adblB) - { - if (null == aadblAIn || null == adblB) return null; - - int iSize = aadblAIn.length; - double[] adblSolution = new double[iSize]; - - if (0 == iSize || null == aadblAIn[0] || iSize != aadblAIn[0].length) return null; - - if (adblB.length != iSize) return null; - - double[][] aadblInv = org.drip.quant.linearalgebra.Matrix.InvertUsingGaussianElimination (aadblAIn); - - if (null == aadblInv) return null; - - double[] adblProduct = org.drip.quant.linearalgebra.Matrix.Product (aadblInv, adblB); - - if (null == adblProduct || iSize != adblProduct.length) return null; - - for (int i = 0; i < iSize; ++i) - adblSolution[i] = adblProduct[i]; - - try { - return new LinearizationOutput (adblSolution, aadblInv, "GaussianElimination"); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Solve the Linear System using Gaussian Elimination from the Set of Values in the Array - * - * @param aadblAIn Input Matrix - * @param adblB The Array of Values to be calibrated to - * - * @return The Linear System Solution for the Coefficients - */ - - public static final org.drip.quant.linearalgebra.LinearizationOutput SolveUsingGaussianElimination ( - final double[][] aadblAIn, - final double[] adblB) - { - if (null == aadblAIn || null == adblB) return null; - - int iSize = aadblAIn.length; - double[][] aadblA = new double[iSize][iSize]; - - if (0 == iSize || null == aadblAIn[0] || iSize != aadblAIn[0].length) return null; - - if (adblB.length != iSize) return null; - - for (int i = 0; i < iSize; ++i) { - for (int j = 0; j < iSize; ++j) - aadblA[i][j] = aadblAIn[i][j]; - } - - double[] adblSolution = Pivot (aadblA, adblB); - - if (null == adblSolution || adblSolution.length != iSize) return null; - - for (int iEliminationDiagonalPivot = iSize - 1; iEliminationDiagonalPivot >= 0; - --iEliminationDiagonalPivot) { - for (int iRow = 0; iRow < iSize; ++iRow) { - if (iRow == iEliminationDiagonalPivot) continue; - - if (0. == aadblA[iRow][iEliminationDiagonalPivot]) continue; - - double dblEliminationRatio = aadblA[iEliminationDiagonalPivot][iEliminationDiagonalPivot] / - aadblA[iRow][iEliminationDiagonalPivot]; - adblSolution[iRow] = adblSolution[iRow] * dblEliminationRatio - - adblSolution[iEliminationDiagonalPivot]; - - for (int iCol = 0; iCol < iSize; ++iCol) - aadblA[iRow][iCol] = aadblA[iRow][iCol] * dblEliminationRatio - - aadblA[iEliminationDiagonalPivot][iCol]; - } - } - - for (int i = iSize - 1; i >= 0; --i) { - for (int j = iSize - 1; j > i; --j) - adblSolution[i] -= adblSolution[j] * aadblA[i][j]; - - adblSolution[i] /= aadblA[i][i]; - } - - try { - return new LinearizationOutput (adblSolution, aadblA, "GaussianElimination"); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Solve the Linear System using the Gauss-Seidel algorithm from the Set of Values in the Array - * - * @param aadblAIn Input Matrix - * @param adblB The Array of Values to be calibrated to - * - * @return The Linear System Solution for the Coefficients - */ - - public static final org.drip.quant.linearalgebra.LinearizationOutput SolveUsingGaussSeidel ( - final double[][] aadblAIn, - final double[] adblB) - { - if (null == aadblAIn || null == adblB) return null; - - int NUM_SIM = 5; - int iSize = aadblAIn.length; - double[] adblSolution = new double[iSize]; - double[][] aadblA = new double[iSize][iSize]; - - if (0 == iSize || null == aadblAIn[0] || iSize != aadblAIn[0].length || iSize != adblB.length) - return null; - - for (int i = 0; i < iSize; ++i) { - for (int j = 0; j < iSize; ++j) - aadblA[i][j] = aadblAIn[i][j]; - } - - double[] adblRHS = Pivot (aadblA, adblB); - - if (null == adblRHS || iSize != adblRHS.length || - !org.drip.quant.linearalgebra.LinearSystemSolver.IsDiagonallyDominant (aadblA, true)) - return null; - - for (int i = 0; i < iSize; ++i) - adblSolution[i] = 0.; - - for (int k = 0; k < NUM_SIM; ++k) { - for (int i = 0; i < iSize; ++i) { - adblSolution[i] = adblRHS[i]; - - for (int j = 0; j < iSize; ++j) { - if (j != i) adblSolution[i] -= aadblA[i][j] * adblSolution[j]; - } - - adblSolution[i] /= aadblA[i][i]; - } - } - - try { - return new LinearizationOutput (adblSolution, aadblA, "GaussianSeidel"); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/quant/linearalgebra/LinearizationOutput.java b/org/drip/quant/linearalgebra/LinearizationOutput.java deleted file mode 100644 index 0b20905..0000000 --- a/org/drip/quant/linearalgebra/LinearizationOutput.java +++ /dev/null @@ -1,125 +0,0 @@ - -package org.drip.quant.linearalgebra; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * LinearizationOutput holds the output of a sequence of linearization operations. It contains the - * transformed original matrix, the transformed RHS, and the method used for the linearization operation. - * - * @author Lakshmi Krishnamurthy - */ - -public class LinearizationOutput { - private double[] _adblTransformedRHS = null; - private double[][] _aadblTransformedMatrix = null; - private java.lang.String _strLinearizationMethod = ""; - - /** - * LinearizationOutput constructor - * - * @param adblTransformedRHS The Transformed RHS - * @param aadblTransformedMatrix The Transformed Matrix - * @param strLinearizationMethod Method used for the Linearization - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public LinearizationOutput ( - final double[] adblTransformedRHS, - final double[][] aadblTransformedMatrix, - final java.lang.String strLinearizationMethod) - throws java.lang.Exception - { - if (null == (_adblTransformedRHS = adblTransformedRHS) || null == (_aadblTransformedMatrix = - aadblTransformedMatrix) || null == (_strLinearizationMethod = strLinearizationMethod) || - _strLinearizationMethod.isEmpty()) - throw new java.lang.Exception ("LinearizationOutput ctr: Invalid Inputs"); - - int iSize = _adblTransformedRHS.length; - - if (0 == iSize || iSize != _aadblTransformedMatrix.length || null == _aadblTransformedMatrix[0] || - iSize != _aadblTransformedMatrix[0].length) - throw new java.lang.Exception ("LinearizationOutput ctr: Invalid Inputs"); - } - - /** - * The RHS - * - * @return The RHS - */ - - public double[] getTransformedRHS() - { - return _adblTransformedRHS; - } - - /** - * The Transformed Matrix - * - * @return The Transformed Matrix - */ - - public double[][] getTransformedMatrix() - { - return _aadblTransformedMatrix; - } - - /** - * The Linearization Method - * - * @return The Linearization Method - */ - - public java.lang.String getLinearizationMethod() - { - return _strLinearizationMethod; - } -} diff --git a/org/drip/quant/linearalgebra/Matrix.java b/org/drip/quant/linearalgebra/Matrix.java deleted file mode 100644 index eada493..0000000 --- a/org/drip/quant/linearalgebra/Matrix.java +++ /dev/null @@ -1,983 +0,0 @@ - -package org.drip.quant.linearalgebra; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * Matrix implements Matrix manipulation routines. It exports the following functionality: - * - Matrix Inversion using Closed form solutions (for low-dimension matrices), or using Gaussian - * elimination - * - Matrix Product - * - Matrix Diagonalization and Diagonal Pivoting - * - Matrix Regularization through Row Addition/Row Swap - * - * @author Lakshmi Krishnamurthy - */ - -public class Matrix { - - /** - * Lower Triangular Matrix - */ - - public static int LOWER_TRIANGULAR = 1; - - /** - * Upper Triangular Matrix - */ - - public static int UPPER_TRIANGULAR = 2; - - /** - * Lower+Upper Triangular Matrix - */ - - public static int LOWER_AND_UPPER_TRIANGULAR = 3; - - /** - * Non Triangular Matrix - */ - - public static int NON_TRIANGULAR = 0; - - /** - * Diagonalize the specified row in the source matrix, and apply comparable operations to the target - * - * @param iQ Row in the Source Matrix - * @param aadblZ2XJack Source Matrix - * @param aadblZ2YJack Target Matrix - * - * @return TRUE - Diagonalization was successful - */ - - public static final boolean DiagonalizeRow ( - final int iQ, - final double[][] aadblZ2XJack, - final double[][] aadblZ2YJack) - { - if (0. != aadblZ2XJack[iQ][iQ]) return true; - - int iSize = aadblZ2XJack.length; - int iP = iSize - 1; - - while (0. == aadblZ2XJack[iP][iQ] && iP >= 0) --iP; - - if (0 > iP) return false; - - for (int j = 0; j < iSize; ++j) - aadblZ2XJack[iQ][j] += aadblZ2XJack[iP][j]; - - aadblZ2YJack[iQ][iP] += 1.; - return true; - } - - /** - * Compute the Product of an Input Matrix and a Column - * - * @param aadblA Matrix A - * @param adblB Array B - * - * @return The Product - */ - - public static final double[] Product ( - final double[][] aadblA, - final double[] adblB) - { - if (null == aadblA || null == adblB) return null; - - int iNumACol = aadblA[0].length; - int iNumProductCol = adblB.length; - int iNumProductRow = aadblA.length; - double[] adblProduct = new double[iNumProductRow]; - - if (0 == iNumACol || iNumACol != adblB.length || 0 == iNumProductRow || 0 == iNumProductCol) - return null; - - for (int iRow = 0; iRow < iNumProductRow; ++iRow) { - adblProduct[iRow] = 0.; - - for (int i = 0; i < iNumACol; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (aadblA[iRow][i]) || - !org.drip.quant.common.NumberUtil.IsValid (adblB[i])) - return null; - - adblProduct[iRow] += aadblA[iRow][i] * adblB[i]; - } - } - - return adblProduct; - } - - /** - * Compute the Product of an input column and a matrix - * - * @param adblA Column A - * @param aadblB Matrix B - * - * @return The Product - */ - - public static final double[][] Product ( - final double[] adblA, - final double[][] aadblB) - { - if (null == adblA || null == aadblB) return null; - - int iNumACol = adblA.length; - int iNumProductCol = aadblB.length; - double[][] aadblProduct = new double[iNumACol][iNumProductCol]; - - if (0 == iNumACol || iNumACol != aadblB.length || 0 == iNumProductCol) return null; - - for (int iRow = 0; iRow < iNumACol; ++iRow) { - for (int iCol = 0; iCol < iNumProductCol; ++iCol) { - aadblProduct[iRow][iCol] = 0.; - - for (int i = 0; i < iNumACol; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (adblA[iRow]) || - !org.drip.quant.common.NumberUtil.IsValid (aadblB[i][iCol])) - return null; - - aadblProduct[iRow][iCol] += adblA[iRow] * aadblB[i][iCol]; - } - } - } - - return aadblProduct; - } - - /** - * Compute the Product of the input matrices - * - * @param aadblA Matrix A - * @param aadblB Matrix B - * - * @return The Product - */ - - public static final double[][] Product ( - final double[][] aadblA, - final double[][] aadblB) - { - if (null == aadblA || null == aadblB) return null; - - int iNumACol = aadblA[0].length; - int iNumProductRow = aadblA.length; - int iNumProductCol = aadblB[0].length; - double[][] aadblProduct = new double[iNumProductRow][iNumProductCol]; - - if (0 == iNumACol || iNumACol != aadblB.length || 0 == iNumProductRow || 0 == iNumProductCol) - return null; - - for (int iRow = 0; iRow < iNumProductRow; ++iRow) { - for (int iCol = 0; iCol < iNumProductCol; ++iCol) { - aadblProduct[iRow][iCol] = 0.; - - for (int i = 0; i < iNumACol; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (aadblA[iRow][i]) || - !org.drip.quant.common.NumberUtil.IsValid (aadblB[i][iCol])) - return null; - - aadblProduct[iRow][iCol] += aadblA[iRow][i] * aadblB[i][iCol]; - } - } - } - - return aadblProduct; - } - - /** - * Make a Square Diagonal Matrix from a Row - * - * @param adblA The Row Array - * - * @return The corresponding Square Diagonal Matrix - */ - - public static final double[][] MakeSquareDiagonal ( - final double[] adblA) - { - if (null == adblA) return null; - - int iNumElement = adblA.length; - double[][] aadblDiagonal = 0 == iNumElement ? null : new double[iNumElement][iNumElement]; - - if (0 == iNumElement) return null; - - for (int i = 0; i < iNumElement; ++i) { - for (int j = 0; j < iNumElement; ++j) - aadblDiagonal[i][j] = i == j ? adblA[i] : 0.; - } - - return aadblDiagonal; - } - - /** - * Invert a 2D Matrix using Cramer's Rule - * - * @param aadblA Input 2D Matrix - * - * @return The Inverted Matrix - */ - - public static final double[][] Invert2DMatrixUsingCramerRule ( - final double[][] aadblA) - { - if (null == aadblA || 2 != aadblA.length || 2 != aadblA[0].length) return null; - - for (int i = 0; i < 2; ++i) { - for (int j = 0; j < 2; ++j) { - if (!org.drip.quant.common.NumberUtil.IsValid (aadblA[i][j])) return null; - } - } - - double dblScale = aadblA[0][0] * aadblA[1][1] - aadblA[0][1] * aadblA[1][0]; - - if (0. == dblScale) return null; - - return new double[][] {{aadblA[1][1] / dblScale, -1. * aadblA[0][1] / dblScale}, {-1. * aadblA[1][0] - / dblScale, aadblA[0][0] / dblScale}}; - } - - /** - * Regularize the specified diagonal entry of the input matrix using Row Swapping - * - * @param mct The Input Matrix Complement Transform - * - * @return The Regularization was successful - */ - - public static final boolean RegularizeUsingRowSwap ( - final org.drip.quant.linearalgebra.MatrixComplementTransform mct) - { - if (null == mct) return false; - - int iSize = mct.size(); - - double[][] aadblSource = mct.getSource(); - - double[][] aadblComplement = mct.getComplement(); - - for (int iDiagonal = 0; iDiagonal < iSize; ++iDiagonal) { - if (0. == aadblSource[iDiagonal][iDiagonal]) { - int iSwapRow = iSize - 1; - - while (iSwapRow >= 0 && (0. == aadblSource[iSwapRow][iDiagonal] || 0. == - aadblSource[iDiagonal][iSwapRow])) - --iSwapRow; - - if (0 > iSwapRow) { - iSwapRow = 0; - - while (iSwapRow < iSize && 0. == aadblSource[iSwapRow][iDiagonal]) - ++iSwapRow; - - if (iSwapRow >= iSize) return false; - } - - for (int iCol = 0; iCol < iSize; ++iCol) { - double dblComplementDiagonalEntry = aadblComplement[iDiagonal][iCol]; - aadblComplement[iDiagonal][iCol] = aadblComplement[iSwapRow][iCol]; - aadblComplement[iSwapRow][iCol] = dblComplementDiagonalEntry; - double dblSourceDiagonalEntry = aadblSource[iDiagonal][iCol]; - aadblSource[iDiagonal][iCol] = aadblSource[iSwapRow][iCol]; - aadblSource[iSwapRow][iCol] = dblSourceDiagonalEntry; - } - } - } - - /* for (int iDiagonal = 0; iDiagonal < iSize; ++iDiagonal) { - if (0. == aadblSource[iDiagonal][iDiagonal]) { - org.drip.quant.common.NumberUtil.Print2DArray ("ZERO DIAG!", aadblSource, false); - - return false; - } - } */ - - return true; - } - - /** - * Regularize the specified diagonal entry of the input matrix using Row Addition - * - * @param mct The Input Matrix Complement Transform - * - * @return The Regularization was successful - */ - - public static final boolean RegularizeUsingRowAddition ( - final org.drip.quant.linearalgebra.MatrixComplementTransform mct) - { - if (null == mct) return false; - - int iSize = mct.size(); - - double[][] aadblSource = mct.getSource(); - - double[][] aadblComplement = mct.getComplement(); - - for (int iDiagonal = 0; iDiagonal < iSize; ++iDiagonal) { - if (0. == aadblSource[iDiagonal][iDiagonal]) { - int iPivotRow = iSize - 1; - - while (0. == aadblSource[iPivotRow][iDiagonal] && iPivotRow >= 0) --iPivotRow; - - if (0 > iPivotRow) return false; - - for (int iCol = 0; iCol < iSize; ++iCol) { - aadblSource[iDiagonal][iCol] += aadblSource[iPivotRow][iCol]; - aadblComplement[iDiagonal][iCol] += aadblComplement[iPivotRow][iCol]; - } - } - } - - return true; - } - - /** - * Pivot the Diagonal of the Input Matrix - * - * @param aadblA The Input Matrix - * - * @return The Matrix Complement Transform Instance - */ - - public static final org.drip.quant.linearalgebra.MatrixComplementTransform PivotDiagonal ( - final double[][] aadblA) - { - if (null == aadblA) return null; - - int iSize = aadblA.length; - double[][] aadblSource = new double[iSize][iSize]; - double[][] aadblComplement = new double[iSize][iSize]; - org.drip.quant.linearalgebra.MatrixComplementTransform mctOut = null; - - if (0 == iSize || null == aadblA[0] || iSize != aadblA[0].length) return null; - - for (int i = 0; i < iSize; ++i) { - for (int j = 0; j < iSize; ++j) { - aadblSource[i][j] = aadblA[i][j]; - aadblComplement[i][j] = i == j ? 1. : 0.; - } - } - - try { - mctOut = new org.drip.quant.linearalgebra.MatrixComplementTransform (aadblSource, - aadblComplement); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return RegularizeUsingRowSwap (mctOut) ? mctOut : null; - } - - /** - * Invert the Source Matrix using Gaussian Elimination - * - * @param aadblSource Source Matrix - * - * @return The Inverted Matrix - */ - - public static final double[][] InvertUsingGaussianElimination ( - final double[][] aadblSource) - { - org.drip.quant.linearalgebra.MatrixComplementTransform mctRegularized = - org.drip.quant.linearalgebra.Matrix.PivotDiagonal (aadblSource); - - if (null == mctRegularized) return null; - - double[][] aadblRegularizedSource = mctRegularized.getSource(); - - double[][] aadblRegularizedInverse = mctRegularized.getComplement(); - - int iSize = aadblRegularizedSource.length; - - for (int iDiagonal = 0; iDiagonal < iSize; ++iDiagonal) { - if (0. == aadblRegularizedSource[iDiagonal][iDiagonal]) return null; - - for (int iRow = 0; iRow < iSize; ++iRow) { - if (iRow == iDiagonal || 0. == aadblRegularizedSource[iRow][iDiagonal]) continue; - - double dblColEntryEliminatorRatio = aadblRegularizedSource[iDiagonal][iDiagonal] / - aadblRegularizedSource[iRow][iDiagonal]; - - for (int iCol = 0; iCol < iSize; ++iCol) { - aadblRegularizedSource[iRow][iCol] = aadblRegularizedSource[iRow][iCol] * - dblColEntryEliminatorRatio - aadblRegularizedSource[iDiagonal][iCol]; - aadblRegularizedInverse[iRow][iCol] = aadblRegularizedInverse[iRow][iCol] * - dblColEntryEliminatorRatio - aadblRegularizedInverse[iDiagonal][iCol]; - } - } - } - - for (int iDiagonal = 0; iDiagonal < iSize; ++iDiagonal) { - double dblDiagScaleDown = aadblRegularizedSource[iDiagonal][iDiagonal]; - - if (0. == dblDiagScaleDown) return null; - - for (int iCol = 0; iCol < iSize; ++iCol) { - aadblRegularizedSource[iDiagonal][iCol] /= dblDiagScaleDown; - aadblRegularizedInverse[iDiagonal][iCol] /= dblDiagScaleDown; - } - } - - return aadblRegularizedInverse; - } - - /** - * Invert the input matrix using the specified Method - * - * @param aadblA Input Matrix - * @param strMethod The Inversion Method - * - * @return The Inverted Matrix - */ - - public static final double[][] Invert ( - final double[][] aadblA, - final java.lang.String strMethod) - { - if (null == aadblA) return null; - - int iSize = aadblA.length; - double[][] aadblAInv = null; - double[][] aadblASource = new double[iSize][iSize]; - double[][] aadblZ2YJack = new double[iSize][iSize]; - - if (0 == iSize || iSize != aadblA[0].length) return null; - - for (int i = 0; i < iSize; ++i) { - for (int j = 0; j < iSize; ++j) { - if (!org.drip.quant.common.NumberUtil.IsValid (aadblASource[i][j] = aadblA[i][j])) - return null; - - aadblZ2YJack[i][j] = i == j ? 1. : 0.; - } - } - - for (int i = 0; i < iSize; ++i) { - if (0. == aadblASource[i][i] && !DiagonalizeRow (i, aadblASource, aadblZ2YJack)) return null; - } - - if (null == strMethod || strMethod.isEmpty() || strMethod.equalsIgnoreCase ("GaussianElimination")) - aadblAInv = InvertUsingGaussianElimination (aadblASource); - - if (null == aadblAInv || iSize != aadblAInv.length || iSize != aadblAInv[0].length) return null; - - return Product (aadblAInv, aadblZ2YJack); - } - - /** - * Compute the Rank of the Matrix - * - * @param aadblSource Source Matrix - * - * @return The Rank of the Matrix - * - * @throws java.lang.Exception Thrown if the Rank Cannot be computed - */ - - public static final int Rank ( - final double[][] aadblSource) - throws java.lang.Exception - { - if (null == aadblSource) return 0; - - int iNumRow = aadblSource.length; - - if (iNumRow == 0) return 0; - - int iNumCol = aadblSource[0].length; - - for (int iScanRow = 0; iScanRow < iNumRow; ++iScanRow) { - if (!org.drip.quant.common.NumberUtil.IsValid (aadblSource[iScanRow])) - throw new java.lang.Exception ("Matrix::Rank => Invalid Inputs"); - } - - double[][] aadblRegularizedSource = iNumRow < iNumCol ? - org.drip.quant.linearalgebra.Matrix.Transpose (aadblSource) : aadblSource; - - int iNumDependentRow = 0; - int iProcessedRow = aadblRegularizedSource.length; - int iProcessedCol = aadblRegularizedSource[0].length; - - if (1 == iNumRow || 1 == iNumCol) return iProcessedRow; - - for (int iScanRow = 0; iScanRow < iProcessedCol; ++iScanRow) { - for (int iRow = 0; iRow < iProcessedCol; ++iRow) { - if (iRow == iScanRow || 0. == aadblRegularizedSource[iRow][iScanRow]) continue; - - double dblColEntryEliminatorRatio = aadblRegularizedSource[iScanRow][iScanRow] / - aadblRegularizedSource[iRow][iScanRow]; - - for (int iCol = 0; iCol < iProcessedCol; ++iCol) - aadblRegularizedSource[iRow][iCol] = aadblRegularizedSource[iRow][iCol] * - dblColEntryEliminatorRatio - aadblRegularizedSource[iScanRow][iCol]; - } - } - - for (int iScanRow = 0; iScanRow < iProcessedCol; ++iScanRow) { - if (0. == org.drip.quant.linearalgebra.Matrix.Modulus (aadblRegularizedSource[iScanRow])) - ++iNumDependentRow; - } - - return iProcessedRow - iNumDependentRow; - } - - /** - * Transpose the specified Square Matrix - * - * @param aadblA The Input Square Matrix - * - * @return The Transpose of the Square Matrix - */ - - public static final double[][] Transpose ( - final double[][] aadblA) - { - if (null == aadblA) return null; - - int iRowSize = aadblA.length; - - if (0 == iRowSize || null == aadblA[0]) return null; - - int iColSize = aadblA[0].length; - double[][] aadblATranspose = new double[iColSize][iRowSize]; - - if (0 == iColSize) return null; - - for (int i = 0; i < iColSize; ++i) { - for (int j = 0; j < iRowSize; ++j) - aadblATranspose[i][j] = aadblA[j][i]; - } - - return aadblATranspose; - } - - /** - * Compute the Cholesky-Banachiewicz Factorization of the specified Matrix. - * - * @param aadblA The Input Matrix - * - * @return The Factorized Matrix - */ - - public static final double[][] CholeskyBanachiewiczFactorization ( - final double[][] aadblA) - { - if (null == aadblA) return null; - - int iSize = aadblA.length; - double[][] aadblL = new double[iSize][iSize]; - - if (0 == iSize || null == aadblA[0] || iSize != aadblA[0].length) return null; - - for (int i = 0; i < iSize; ++i) { - for (int j = 0; j < iSize; ++j) { - aadblL[i][j] = 0.; - - if (i == j) { - for (int k = 0; k < j; ++k) - aadblL[j][j] -= aadblL[j][k] * aadblL[j][k]; - - aadblL[j][j] = java.lang.Math.sqrt (aadblL[j][j] + aadblA[j][j]); - } else if (i > j) { - for (int k = 0; k < j; ++k) - aadblL[i][j] -= aadblL[i][k] * aadblL[j][k]; - - aadblL[i][j] = (aadblA[i][j] + aadblL[i][j]) / aadblL[j][j]; - } - } - } - - return aadblL; - } - - /** - * Dot Product of Vectors A and E - * - * @param adblA Vector A - * @param adblE Vector E - * - * @return The Dot Product - * - * @throws java.lang.Exception Thrown if the Dot-Product cannot be computed - */ - - public static final double DotProduct ( - final double[] adblA, - final double[] adblE) - throws java.lang.Exception - { - if (null == adblA || null == adblE) - throw new java.lang.Exception ("Matrix::DotProduct => Invalid Inputs!"); - - int iSize = adblA.length; - double dblDotProduct = 0.; - - if (0 == iSize || iSize != adblE.length) - throw new java.lang.Exception ("Matrix::DotProduct => Invalid Inputs!"); - - for (int i = 0; i < iSize; ++i) - dblDotProduct += adblE[i] * adblA[i]; - - return dblDotProduct; - } - - /** - * Project the Vector A along the Vector E - * - * @param adblA Vector A - * @param adblE Vector E - * - * @return The Vector of Projection of A along E - */ - - public static final double[] Project ( - final double[] adblA, - final double[] adblE) - { - if (null == adblA || null == adblE) return null; - - int iSize = adblA.length; - double dblProjection = java.lang.Double.NaN; - double[] adblProjectAOnE = new double[iSize]; - - if (0 == iSize || iSize != adblE.length) return null; - - try { - dblProjection = DotProduct (adblA, adblE) / DotProduct (adblE, adblE); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int i = 0; i < iSize; ++i) - adblProjectAOnE[i] = adblE[i] * dblProjection; - - return adblProjectAOnE; - } - - /** - * Compute the Modulus of the Input Vector - * - * @param adbl The Input Vector - * - * @return TRUE - The Modulus of the Input Vector - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final double Modulus ( - final double[] adbl) - throws java.lang.Exception - { - if (null == adbl || !org.drip.quant.common.NumberUtil.IsValid (adbl)) - throw new java.lang.Exception ("Matrix::Modulus => Invalid Inputs"); - - double dblModulus = 0.; - int iSize = adbl.length; - - if (0 == iSize) throw new java.lang.Exception ("Matrix::Modulus => Invalid Inputs"); - - for (int i = 0; i < iSize; ++i) - dblModulus += adbl[i] * adbl[i]; - - return java.lang.Math.sqrt (dblModulus); - } - - /** - * Indicate if the Array Entries are Positive or Zero - * - * @param adbl The Array - * - * @return TRUE - The Array Entries are Positive or Zero - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final boolean PositiveOrZero ( - final double[] adbl) - throws java.lang.Exception - { - if (null == adbl || !org.drip.quant.common.NumberUtil.IsValid (adbl)) - throw new java.lang.Exception ("Matrix::PositiveOrZero => Invalid Inputs"); - - int iSize = adbl.length; - - if (0 == iSize) throw new java.lang.Exception ("Matrix::PositiveOrZero => Invalid Inputs"); - - for (int i = 0; i < iSize; ++i) { - if (0. > adbl[i]) return false; - } - - return true; - } - - /** - * Indicate if the Array Entries are Negative or Zero - * - * @param adbl The Array - * - * @return The Array Entries are Negative or Zero - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final boolean NegativeOrZero ( - final double[] adbl) - throws java.lang.Exception - { - if (null == adbl || !org.drip.quant.common.NumberUtil.IsValid (adbl)) - throw new java.lang.Exception ("Matrix::NegativeOrZero => Invalid Inputs"); - - int iSize = adbl.length; - - if (0 == iSize) throw new java.lang.Exception ("Matrix::NegativeOrZero => Invalid Inputs"); - - for (int i = 0; i < iSize; ++i) { - if (0. < adbl[i]) return false; - } - - return true; - } - - /** - * Indicate if the Array Entries are Positive Linearly Independent - * - * @param adbl The Array - * - * @return TRUE - The Array Entries are Positive Linearly Independent - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final boolean PositiveLinearlyIndependent ( - final double[] adbl) - throws java.lang.Exception - { - return !PositiveOrZero (adbl) && !NegativeOrZero (adbl); - } - - /** - * Normalize the Input Vector - * - * @param adbl The Input Vector - * - * @return The Normalized Vector - */ - - public static final double[] Normalize ( - final double[] adbl) - { - if (null == adbl) return null; - - double dblNorm = 0.; - int iSize = adbl.length; - double[] adblNormalized = new double[iSize]; - - if (0 == iSize) return null; - - for (int i = 0; i < iSize; ++i) - dblNorm += adbl[i] * adbl[i]; - - dblNorm = java.lang.Math.sqrt (dblNorm); - - for (int i = 0; i < iSize; ++i) - adblNormalized[i] = adbl[i] / dblNorm; - - return adblNormalized; - } - - /** - * Orthogonalize the Specified Matrix Using the Graham-Schmidt Method - * - * @param aadblV The Input Matrix - * - * @return The Orthogonalized Matrix - */ - - public static final double[][] GrahamSchmidtOrthogonalization ( - final double[][] aadblV) - { - if (null == aadblV) return null; - - int iSize = aadblV.length; - double[][] aadblU = new double[iSize][iSize]; - - if (0 == iSize || null == aadblV[0] || iSize != aadblV[0].length) return null; - - for (int i = 0; i < iSize; ++i) { - for (int j = 0; j < iSize; ++j) - aadblU[i][j] = aadblV[i][j]; - - for (int j = 0; j < i; ++j) { - double dblProjectionAmplitude = java.lang.Double.NaN; - - try { - dblProjectionAmplitude = DotProduct (aadblV[i], aadblU[j]) / DotProduct (aadblU[j], - aadblU[j]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int k = 0; k < iSize; ++k) - aadblU[i][k] -= dblProjectionAmplitude * aadblU[j][k]; - } - } - - return aadblU; - } - - /** - * Orthonormalize the Specified Matrix Using the Graham-Schmidt Method - * - * @param aadblV The Input Matrix - * - * @return The Orthonormalized Matrix - */ - - public static final double[][] GrahamSchmidtOrthonormalization ( - final double[][] aadblV) - { - double[][] aadblVOrthogonal = GrahamSchmidtOrthogonalization (aadblV); - - if (null == aadblVOrthogonal) return null; - - int iSize = aadblVOrthogonal.length; - - double[][] aadblVOrthonormal = new double[iSize][]; - - for (int i = 0; i < iSize; ++i) - aadblVOrthonormal[i] = Normalize (aadblVOrthogonal[i]); - - return aadblVOrthonormal; - } - - /** - * Perform a QR Decomposition on the Input Matrix - * - * @param aadblA The Input Matrix - * - * @return The Output of QR Decomposition - */ - - public static final org.drip.quant.linearalgebra.QR QRDecomposition ( - final double[][] aadblA) - { - double[][] aadblQ = GrahamSchmidtOrthonormalization (aadblA); - - if (null == aadblQ) return null; - - int iSize = aadblQ.length; - double[][] aadblR = new double[iSize][iSize]; - - try { - for (int i = 0; i < iSize; ++i) { - for (int j = 0; j < iSize; ++j) - aadblR[i][j] = i > j ? DotProduct (aadblQ[i], aadblA[j]) : 0.; - } - - return new org.drip.quant.linearalgebra.QR (aadblQ, aadblR); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Triangular Type of the Matrix - * - * @param aadblA The Input Matrix - * @param dblFloor The Floor Level that means "Zero" - * - * @return The Triangular Type - */ - - public static final int TriangularType ( - final double[][] aadblA, - final double dblFloor) - { - if (null == aadblA || !org.drip.quant.common.NumberUtil.IsValid (dblFloor) || dblFloor < 0.) - return NON_TRIANGULAR; - - int iSize = aadblA.length; - boolean bLowerTriangular = true; - boolean bUpperTriangular = true; - - if (1 >= iSize || null == aadblA[0] || iSize != aadblA[0].length) return NON_TRIANGULAR; - - for (int i = 0; i < iSize; ++i) { - for (int j = 0; j < iSize; ++j) { - if (i > j) { - if (java.lang.Math.abs (aadblA[i][j]) > dblFloor) bLowerTriangular = false; - } else if (i < j) { - if (java.lang.Math.abs (aadblA[i][j]) > dblFloor) bUpperTriangular = false; - } - } - } - - if (bLowerTriangular && bUpperTriangular) return LOWER_AND_UPPER_TRIANGULAR; - - if (bLowerTriangular && !bUpperTriangular) return LOWER_TRIANGULAR; - - if (!bLowerTriangular && bUpperTriangular) return UPPER_TRIANGULAR; - - return NON_TRIANGULAR; - } -} diff --git a/org/drip/quant/linearalgebra/MatrixComplementTransform.java b/org/drip/quant/linearalgebra/MatrixComplementTransform.java deleted file mode 100644 index 4e776a7..0000000 --- a/org/drip/quant/linearalgebra/MatrixComplementTransform.java +++ /dev/null @@ -1,120 +0,0 @@ - -package org.drip.quant.linearalgebra; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * This class holds the results of Matrix transforms on the source and the complement, e.g., during a Matrix - * Inversion Operation. - * - * @author Lakshmi Krishnamurthy - */ - -public class MatrixComplementTransform { - private double[][] _aadblSource = null; - private double[][] _aadblComplement = null; - - /** - * MatrixComplementTransform constructor - * - * @param aadblSource Transformed Source Matrix - * @param aadblComplement Transformed Complement Matrix - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public MatrixComplementTransform ( - final double[][] aadblSource, - final double[][] aadblComplement) - throws java.lang.Exception - { - if (null == (_aadblSource = aadblSource) || null == (_aadblComplement = aadblComplement)) - throw new java.lang.Exception ("MatrixComplementTransform ctr: Invalid Inputs"); - - int iSize = _aadblSource.length; - - if (0 == iSize || iSize != _aadblSource.length || iSize != _aadblSource[0].length || iSize != - _aadblComplement.length || iSize != _aadblComplement[0].length) - throw new java.lang.Exception ("MatrixComplementTransform ctr: Invalid Inputs"); - } - - /** - * Retrieve the Transformed Source - * - * @return The Transformed Source - */ - - public double[][] getSource() - { - return _aadblSource; - } - - /** - * Retrieve the Transformed Complement - * - * @return The Transformed Complement - */ - - public double[][] getComplement() - { - return _aadblComplement; - } - - /** - * Retrieve the Dimension Length - * - * @return The Dimension Length - */ - - public int size() - { - return _aadblComplement.length; - } -} diff --git a/org/drip/quant/linearalgebra/QR.java b/org/drip/quant/linearalgebra/QR.java deleted file mode 100644 index 38d4b53..0000000 --- a/org/drip/quant/linearalgebra/QR.java +++ /dev/null @@ -1,106 +0,0 @@ - -package org.drip.quant.linearalgebra; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * QR hlds the Results of QR Decomposition - viz., the Q and the R Matrices. - * - * @author Lakshmi Krishnamurthy - */ - -public class QR { - private double[][] _aadblQ = null; - private double[][] _aadblR = null; - - /** - * QR Constructor - * - * @param aadblQ Q - * @param aadblR R - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public QR ( - final double[][] aadblQ, - final double[][] aadblR) - throws java.lang.Exception - { - if (null == (_aadblQ = aadblQ) || null == (_aadblR = aadblR)) - throw new java.lang.Exception ("QR ctr: Invalid Inputs!"); - - int iSize = _aadblQ.length; - - if (0 == iSize || null == _aadblQ[0] || iSize != _aadblQ[0].length || iSize != _aadblR.length || null - == _aadblR[0] || iSize != _aadblR[0].length) - throw new java.lang.Exception ("QR ctr: Invalid Inputs!"); - } - - /** - * Retrieve Q - * - * @return Q - */ - - public double[][] q() - { - return _aadblQ; - } - - /** - * Retrieve R - * - * @return R - */ - - public double[][] r() - { - return _aadblR; - } -} diff --git a/org/drip/regression/core/RegressionEngine.java b/org/drip/regression/core/RegressionEngine.java deleted file mode 100644 index 28f56b8..0000000 --- a/org/drip/regression/core/RegressionEngine.java +++ /dev/null @@ -1,232 +0,0 @@ - -package org.drip.regression.core; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * RegressionEngine provides the control and frame-work functionality for the General Purpose Regression - * Suite. It invokes the following steps as part of the execution: - * - Initialize the regression environment. This step sets up the regression sets, and adds individual - * regressors to the set. - * - Invoke the regressors in each set one by one. - * - Collect the results and details of the regression runs. - * - Compile the regression statistics. - * - Optionally display the regression statistics. - * - * @author Lakshmi Krishnamurthy - */ - -public class RegressionEngine { - - /** - * Regression outputs decomposed at individual Module Units - */ - - public static final int REGRESSION_DETAIL_MODULE_UNIT_DECOMPOSED = 1; - - /** - * Regression outputs rolled up to Module Units - */ - - public static final int REGRESSION_DETAIL_MODULE_UNIT_AGGREGATED = 2; - - /** - * Regression outputs rolled up to Modules - */ - - public static final int REGRESSION_DETAIL_MODULE_AGGREGATED = 4; - - /** - * Regression Output: Statistics - */ - - public static final int REGRESSION_DETAIL_STATS = 8; - - private int _iNumRuns = 0; - private int _iRegressionDetail = REGRESSION_DETAIL_MODULE_UNIT_DECOMPOSED; - - protected java.util.Set _setRS = new - java.util.HashSet(); - - org.drip.analytics.support.CaseInsensitiveTreeMap _mapURS = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private boolean executeRegressionSet ( - final org.drip.regression.core.RegressorSet rs) - { - if (null == rs || null == rs.getSetName() || rs.getSetName().isEmpty()) return false; - - java.util.List lsRegressor = rs.getRegressorSet(); - - if (null == lsRegressor || 0 == lsRegressor.size()) { - System.out.println ("Cannot get the " + rs.getSetName() + " scenarios!"); - - return false; - } - - long lModuleTime = 0; - int iNumRegressionsSucceeded = 0; - boolean bRegressionDetail = 0 != (REGRESSION_DETAIL_MODULE_UNIT_DECOMPOSED & _iRegressionDetail) ? - true : false; - - System.out.println ("\t" + rs.getSetName() + " starts at " + new java.util.Date()); - - for (org.drip.regression.core.UnitRegressor r : lsRegressor) { - if (null == r) continue; - - org.drip.regression.core.RegressionRunOutput ro = r.regress(); - - if (null != ro && ro._bStatus) { - ++iNumRegressionsSucceeded; - lModuleTime += ro._lExecTime; - - java.lang.String strScenarioQualifiedRegressor = rs.getSetName() + "." + r.getName(); - - org.drip.regression.core.UnitRegressionStat urs = _mapURS.get - (strScenarioQualifiedRegressor); - - if (null == urs) urs = new org.drip.regression.core.UnitRegressionStat(); - - urs.addExecTime (ro._lExecTime); - - _mapURS.put (strScenarioQualifiedRegressor, urs); - - if (0 != (REGRESSION_DETAIL_MODULE_UNIT_DECOMPOSED & _iRegressionDetail) || - 0 != (REGRESSION_DETAIL_MODULE_UNIT_AGGREGATED & _iRegressionDetail)) - System.out.println (ro.displayString (bRegressionDetail)); - } - } - - System.out.println ("\t" + rs.getSetName() + "=> " + lModuleTime+ " (mu-s): " + - iNumRegressionsSucceeded + " / " + lsRegressor.size() + " succeeded."); - - System.out.println ("\t" + rs.getSetName() + " ends at " + new java.util.Date() + "\n"); - - return true; - } - - protected RegressionEngine ( - final int iNumRuns, - final int iRegressionDetail) - throws java.lang.Exception - { - if (0 >= (_iNumRuns = iNumRuns)) - throw new java.lang.Exception ("RegressionEngine ctr: Invalid inputs"); - - _iRegressionDetail = iRegressionDetail; - } - - /** - * Add the regressor set to the framework - * - * @param rs Regressor Set - * - * @return TRUE => Regressor Set successfully added - */ - - protected final boolean addRegressorSet ( - final org.drip.regression.core.RegressorSet rs) - { - if (null == rs || !rs.setupRegressors()) return false; - - _setRS.add (rs); - - return true; - } - - /** - * One-time initialization of the regression engine environment - * - * @return TRUE - Regression Environment initialized successfully - */ - - public boolean initRegressionEnv() - { - return true; - } - - /** - * Launch the Regression Engine and execute the regression sets - * - * @return TRUE - Launch Successful - */ - - protected final boolean launch() - { - if (0 == _setRS.size() || !initRegressionEnv()) return false; - - boolean bLaunchSuccessful = true; - - for (int i = 0; i < _iNumRuns; ++i) { - for (org.drip.regression.core.RegressorSet rs : _setRS) - bLaunchSuccessful = executeRegressionSet (rs); - } - - if (0 != _mapURS.size() && null != _mapURS.entrySet()) { - for (java.util.Map.Entry - meURS : _mapURS.entrySet()) { - if (null == meURS || null == meURS.getKey() || meURS.getKey().isEmpty()) continue; - - org.drip.regression.core.UnitRegressionStat urs = meURS.getValue(); - - if (null == urs || !urs.generateStat()) continue; - - if (0 != (REGRESSION_DETAIL_STATS & _iRegressionDetail)) { - System.out.println ("\n--------\nStats for " + meURS.getKey() + "\n--------"); - - System.out.println (urs.displayString (meURS.getKey())); - } - } - } - - return bLaunchSuccessful; - } -} diff --git a/org/drip/regression/core/RegressionRunDetail.java b/org/drip/regression/core/RegressionRunDetail.java deleted file mode 100644 index 6ab2cfe..0000000 --- a/org/drip/regression/core/RegressionRunDetail.java +++ /dev/null @@ -1,102 +0,0 @@ - -package org.drip.regression.core; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * RegressionRunDetail contains named field level detailed output of the regression activity. - * - * @author Lakshmi Krishnamurthy - */ - -public class RegressionRunDetail { - private org.drip.analytics.support.CaseInsensitiveTreeMap _mapNVDetails = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - /** - * Empty constructor: Regression detail fields will be initialized - */ - - public RegressionRunDetail() - { - } - - /** - * Set the Key Value Map Entry - * - * @param strKey Name of the regression detail field - * @param strValue Value of the regression detail field - * - * @return TRUE - "set" succeeded - */ - - public boolean set ( - final java.lang.String strKey, - final java.lang.String strValue) - { - if (null == strKey || strKey.isEmpty() || null == strValue || strValue.isEmpty()) return false; - - _mapNVDetails.put (strKey, strValue); - - return true; - } - - /** - * Retrieve the field map - * - * @return The Field Map - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap getFieldMap() - { - return _mapNVDetails; - } -} diff --git a/org/drip/regression/core/RegressionRunOutput.java b/org/drip/regression/core/RegressionRunOutput.java deleted file mode 100644 index a3d780b..0000000 --- a/org/drip/regression/core/RegressionRunOutput.java +++ /dev/null @@ -1,176 +0,0 @@ - -package org.drip.regression.core; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * RegressionRunOutput contains the output of a single regression activity. It holds the following: - * - The execution time - * - The Success/failure status of the run - * - The regression scenario that was executed - * - The Completion time for the regression module - * - The Regression Run Detail for the regression run - * - * Another function displays the contents of this RegressionRunOutput instance. - * - * @author Lakshmi Krishnamurthy - */ - -public class RegressionRunOutput { - - /** - * Execution time for the Regression Module - */ - - public long _lExecTime = 0L; - - /** - * Completion Status for the Regression Module - */ - - public boolean _bStatus = false; - - /** - * Completion Status for the Regression Module - */ - - public java.lang.String _strRegressionScenarioName = ""; - - /** - * Completion Time for the Regression Module - */ - - public java.util.Date _dtCompletion = null; - - private org.drip.regression.core.RegressionRunDetail _rnvd = new - org.drip.regression.core.RegressionRunDetail(); - - /** - * Regression Run Output Constructor - * - * @param strRegressionScenarioName Regression Scenario Name - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public RegressionRunOutput ( - final java.lang.String strRegressionScenarioName) - throws java.lang.Exception - { - if (null == (_strRegressionScenarioName = strRegressionScenarioName) || - _strRegressionScenarioName.isEmpty()) - throw new java.lang.Exception ("RegressionRunOutput ctr: Invalid Regression Scenario Name!"); - } - - /** - * Set the termination status for the regression output - * - * @param bSuccess TRUE - Regression Run succeeded - * - * @return TRUE - Termination status successfully set - */ - - public boolean setTerminationStatus ( - final boolean bSuccess) - { - _dtCompletion = new java.util.Date(); - - _bStatus = bSuccess; - return true; - } - - /** - * Retrieve the regression details object - * - * @return The regression details object - */ - - public org.drip.regression.core.RegressionRunDetail getRegressionDetail() - { - return _rnvd; - } - - /** - * Print the contents of the regression output - * - * @param bDetailed Display detailed output - * - * @return String representing the Regression output - */ - - public java.lang.String displayString ( - final boolean bDetailed) - { - java.lang.StringBuffer sb = new java.lang.StringBuffer(); - - sb.append ("\n"); - - sb.append ("\t\t" + _strRegressionScenarioName + ".Success=").append (_bStatus).append ("\n"); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapDetails = _rnvd.getFieldMap(); - - if (null != mapDetails && 0 != mapDetails.size() && null != mapDetails.entrySet()) { - for (java.util.Map.Entry me : mapDetails.entrySet()) { - if (null != me && null != me.getKey() && !me.getKey().isEmpty() && null != me.getValue() && - !me.getValue().isEmpty()) - sb.append ("\t\t" + _strRegressionScenarioName + "." + me.getKey() + "=").append - (me.getValue()).append ("\n"); - } - } - - sb.append ("\t\t" + _strRegressionScenarioName + ".FinishTime=").append (_dtCompletion).append - ("\n"); - - sb.append ("\t\t" + _strRegressionScenarioName + ".ExecTime=").append (_lExecTime); - - return sb.toString(); - } -} diff --git a/org/drip/regression/core/RegressorSet.java b/org/drip/regression/core/RegressorSet.java deleted file mode 100644 index 53c9123..0000000 --- a/org/drip/regression/core/RegressorSet.java +++ /dev/null @@ -1,86 +0,0 @@ - -package org.drip.regression.core; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * RegressorSet interface provides the Regression set stubs. It contains a set regressors and is associated - * with a unique name. It provides functionality to set up the contained regressors. - * - * @author Lakshmi Krishnamurthy - */ - -public interface RegressorSet { - - /** - * Set up the list of Regressors in the set - * - * @return TRUE if set up is successful - */ - - public abstract boolean setupRegressors(); - - /** - * Retrieve the list of regressors - * - * @return List of regressors - */ - - public abstract java.util.List getRegressorSet(); - - /** - * Retrieve the Regression Set Name - * - * @return Regression Set Name - */ - - public abstract java.lang.String getSetName(); -} diff --git a/org/drip/regression/core/UnitRegressionExecutor.java b/org/drip/regression/core/UnitRegressionExecutor.java deleted file mode 100644 index 8ccbfb5..0000000 --- a/org/drip/regression/core/UnitRegressionExecutor.java +++ /dev/null @@ -1,173 +0,0 @@ - -package org.drip.regression.core; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * UnitRegressionExecutor implements the UnitRegressor, and splits the regression execution into pre-, - * execute, and post-regression. It provides default implementations for pre-regression and post-regression. - * Most typical regressors only need to over-ride the execRegression method. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class UnitRegressionExecutor implements org.drip.regression.core.UnitRegressor { - private static final boolean _bDisplayStatus = false; - - private java.lang.String _strRegressorSet = ""; - private java.lang.String _strRegressorName = ""; - - /** - * Constructor for the unit regression executor - * - * @param strRegressorName Name of the unit regressor - * @param strRegressorSet Name of the regressor set - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - protected UnitRegressionExecutor ( - final java.lang.String strRegressorName, - final java.lang.String strRegressorSet) - throws java.lang.Exception - { - if (null == (_strRegressorName = strRegressorName) || strRegressorName.isEmpty() || null == - (_strRegressorSet = strRegressorSet) || _strRegressorSet.isEmpty()) - throw new java.lang.Exception ("UnitRegressionExecutor ctr: Invalid inputs"); - } - - /** - * One-time initialization to set up the objects needed for the regression - * - * @return TRUE - Initialization successful - */ - - public boolean preRegression() - { - return true; - } - - /** - * Execute the regression call within this function - * - * @return The result of the regression - */ - - public abstract boolean execRegression(); - - /** - * Clean-up of the objects set-up for the regression - * - * @param rnvd Regression Run Detail object to capture the regression details - * - * @return TRUE - Clean-up successful - */ - - public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - return true; - } - - @Override public org.drip.regression.core.RegressionRunOutput regress() - { - org.drip.regression.core.RegressionRunOutput ro = null; - - try { - ro = new org.drip.regression.core.RegressionRunOutput (_strRegressorSet + "." + - _strRegressorName); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (!preRegression()) { - if (_bDisplayStatus) - System.out.println (_strRegressorSet + "." + _strRegressorName + - ": Cannot set-up the regressor!"); - - return null; - } - - long lStartTime = System.nanoTime(); - - if (!execRegression()) { - if (_bDisplayStatus) - System.out.println (_strRegressorSet + "." + _strRegressorName + ": failed"); - - ro.setTerminationStatus (false); - - return ro; - } - - ro._lExecTime = (long) (1.e-03 * (System.nanoTime() - lStartTime)); - - if (!postRegression (ro.getRegressionDetail())) { - if (_bDisplayStatus) - System.out.println (_strRegressorSet + "." + _strRegressorName + - ": Regressor clean-up unsuccessful!"); - - return null; - } - - if (_bDisplayStatus) System.out.println (_strRegressorSet + "." + _strRegressorName + ": succeeded"); - - ro.setTerminationStatus (true); - - return ro; - } - - @Override public java.lang.String getName() - { - return _strRegressorName; - } -} diff --git a/org/drip/regression/core/UnitRegressionStat.java b/org/drip/regression/core/UnitRegressionStat.java deleted file mode 100644 index 24a3102..0000000 --- a/org/drip/regression/core/UnitRegressionStat.java +++ /dev/null @@ -1,239 +0,0 @@ - -package org.drip.regression.core; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * UnitRegressionStat creates the statistical details for the Unit Regressor. It holds the following: - * - Execution Initialization Delay - * - Execution time mean, variance, maximum, and minimum - * - The full list of individual execution times - * - * @author Lakshmi Krishnamurthy - */ - -public class UnitRegressionStat { - private long _lExecTimeMean = 0L; - private long _lExecTimeMaximum = 0L; - private long _lExecTimeMinimum = 0L; - private long _lExecTimeVariance = 0L; - private long _lInitializationDelay = 0L; - private java.util.List _llExecTime = null; - - /** - * Empty Constructor - */ - - public UnitRegressionStat() - { - _llExecTime = new java.util.ArrayList(); - } - - /** - * Add another run execution time - * - * @param lExecTime Execution Time - * - * @return TRUE - Executed time run successfully added - */ - - public boolean addExecTime ( - final long lExecTime) - { - _llExecTime.add (lExecTime); - - return true; - } - - /** - * Generate the statistics across all the execution times generated - * - * @return TRUE - Statistics successfully generated - */ - - public boolean generateStat() - { - boolean bFirstRun = true; - - int iNumRuns = _llExecTime.size(); - - if (0 == iNumRuns) return false; - - for (long lExecTime : _llExecTime) { - if (bFirstRun) { - _lExecTimeMaximum = lExecTime; - _lExecTimeMinimum = lExecTime; - _lInitializationDelay = lExecTime; - } else { - _lExecTimeMean += lExecTime; - - if (_lExecTimeMaximum < lExecTime) _lExecTimeMaximum = lExecTime; - - if (_lExecTimeMinimum > lExecTime) _lExecTimeMinimum = lExecTime; - } - - bFirstRun = false; - } - - _lExecTimeMean /= (iNumRuns - 1); - bFirstRun = true; - - for (long lExecTime : _llExecTime) { - if (!bFirstRun) - _lExecTimeVariance += (lExecTime - _lExecTimeMean) * (lExecTime - _lExecTimeMean); - - bFirstRun = false; - } - - _lExecTimeVariance = (long) java.lang.Math.sqrt (_lExecTimeVariance / (iNumRuns - 1)); - - _lInitializationDelay -= _lExecTimeMean; - return true; - } - - /** - * Get the number of runs for the statistics - * - * @return Number of runs - */ - - public int getRuns() - { - return _llExecTime.size(); - } - - /** - * Get the Mean in the execution time - * - * @return Execution Time Mean - */ - - public long getMean() - { - return _lExecTimeMean; - } - - /** - * Get the Minimum in the execution time - * - * @return Execution Time Minimum - */ - - public long getMin() - { - return _lExecTimeMinimum; - } - - /** - * Get the Maximum in the execution time - * - * @return Execution Time Maximum - */ - - public long getMax() - { - return _lExecTimeMaximum; - } - - /** - * Get the variance in the execution time - * - * @return Execution Time Variance - */ - - public long getVariance() - { - return _lExecTimeVariance; - } - - /** - * Get the delay when the regressor is invoked for the first time - * - * @return Initialization Delay - */ - - public long getInitializationDelay() - { - return _lInitializationDelay; - } - - /** - * Return the string version of the statistics - * - * @param strRegressionUnit Name the unit for which the regression run was done - * - * @return String holding the content of the unit regression statistics - */ - - public java.lang.String displayString ( - final java.lang.String strRegressionUnit) - { - if (null == strRegressionUnit || strRegressionUnit.isEmpty()) return null; - - java.lang.StringBuffer sb = new java.lang.StringBuffer(); - - sb.append ("\t" + strRegressionUnit + ".Stat.NumRuns=" + _llExecTime.size() + "\n"); - - sb.append ("\t" + strRegressionUnit + ".Stat.ExecTimeMean=" + _lExecTimeMean + "\n"); - - sb.append ("\t" + strRegressionUnit + ".Stat.ExecTimeMaximum=" + _lExecTimeMaximum + "\n"); - - sb.append ("\t" + strRegressionUnit + ".Stat.ExecTimeMinimum=" + _lExecTimeMinimum + "\n"); - - sb.append ("\t" + strRegressionUnit + ".Stat.ExecTimeVariance=" + _lExecTimeVariance + "\n"); - - sb.append ("\t" + strRegressionUnit + ".Stat.InitializationDelay=" + _lInitializationDelay + "\n"); - - sb.append ("\t" + strRegressionUnit + ".Stat.ExecTimeList=" + _llExecTime.toString() + "\n"); - - return sb.toString(); - } -} diff --git a/org/drip/regression/core/UnitRegressor.java b/org/drip/regression/core/UnitRegressor.java deleted file mode 100644 index 8b745a3..0000000 --- a/org/drip/regression/core/UnitRegressor.java +++ /dev/null @@ -1,78 +0,0 @@ - -package org.drip.regression.core; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * UnitRegressor provides the stub functionality for the Individual Regressors. Its derived classes implement - * the actual regression run. Individual regressors are named. - * - * @author Lakshmi Krishnamurthy - */ - -public interface UnitRegressor { - - /** - * This method performs the feature by feature regression for the given object. - * - * @return The calculated Regression Output Object. - */ - - public abstract org.drip.regression.core.RegressionRunOutput regress(); - - /** - * Regressor Name - * - * @return Name of the regressor - */ - - public abstract java.lang.String getName(); -} diff --git a/org/drip/regression/curve/CreditAnalyticsRegressionEngine.java b/org/drip/regression/curve/CreditAnalyticsRegressionEngine.java deleted file mode 100644 index 03c0fba..0000000 --- a/org/drip/regression/curve/CreditAnalyticsRegressionEngine.java +++ /dev/null @@ -1,110 +0,0 @@ - -package org.drip.regression.curve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * CreditAnalyticsRegressionEngine implements the RegressionEngine for the curve regression. It adds the - * CreditCurveRegressor, DiscountCurveRegressor, and ZeroCurveRegressor, and launches the regression engine. - * - * @author Lakshmi Krishnamurthy - */ - -public class CreditAnalyticsRegressionEngine extends org.drip.regression.core.RegressionEngine { - - /** - * Initialize the Credit Analytics Regression Engine - * - * @param iNumRuns Number of runs to be initialized with - * @param iRegressionDetail Detail of the regression run - * - * @throws Exception Thrown from the super - */ - - public CreditAnalyticsRegressionEngine ( - final int iNumRuns, - final int iRegressionDetail) - throws java.lang.Exception - { - super (iNumRuns, iRegressionDetail); - } - - @Override public boolean initRegressionEnv() - { - org.drip.service.env.EnvManager.InitEnv (""); - - return super.initRegressionEnv(); - } - - public static void main ( - final java.lang.String[] astrArgs) - throws java.lang.Exception - { - CreditAnalyticsRegressionEngine care = new CreditAnalyticsRegressionEngine (10, - org.drip.regression.core.RegressionEngine.REGRESSION_DETAIL_MODULE_UNIT_DECOMPOSED); - - /* - * Add the regressor sets: Refer to the implementation of the corresponding regressors - */ - - care.addRegressorSet (new CreditCurveRegressor()); - - care.addRegressorSet (new DiscountCurveRegressor()); - - care.addRegressorSet (new ZeroCurveRegressor()); - - /* - * Launch regression - and that's it! - */ - - care.launch(); - } -} diff --git a/org/drip/regression/curve/CreditCurveRegressor.java b/org/drip/regression/curve/CreditCurveRegressor.java deleted file mode 100644 index b8eeeae..0000000 --- a/org/drip/regression/curve/CreditCurveRegressor.java +++ /dev/null @@ -1,786 +0,0 @@ - -package org.drip.regression.curve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * CreditCurveRegressor implements the regression set analysis for the Credit Curve. CreditCurveRegressor - * regresses 12 scenarios: - * - #1: Create an SNAC CDS. - * - #2: Create the credit curve from a set of CDS instruments. - * - #3: Create the credit curve from a flat hazard rate. - * - #4: Create the credit curve from a set of survival probabilities. - * - #5: Create the credit curve from an array of hazard rates. - * - #6: Extract the credit curve instruments and quotes. - * - #7: Create a parallel hazard shifted credit curve. - * - #8: Create a parallel quote shifted credit curve. - * - #9: Create a node tweaked credit curve. - * - #10: Set a specific default date on the credit curve. - * - #11: Compute the effective survival probability between 2 dates. - * - #12: Compute the effective hazard rate between 2 dates. - * - * @author Lakshmi Krishnamurthy - */ - -public class CreditCurveRegressor implements org.drip.regression.core.RegressorSet { - private java.lang.String _strCurrency = ""; - private org.drip.state.credit.CreditCurve _cc = null; - private org.drip.state.discount.MergedDiscountForwardCurve _dc = null; - private org.drip.analytics.date.JulianDate _dtStart = null; - private java.lang.String _strRegressionScenario = "org.drip.analytics.curve.CreditCurve"; - - private java.util.List _setRegressors = new - java.util.ArrayList(); - - /** - * Do Nothing CreditCurveRegressor constructor. - */ - - public CreditCurveRegressor() - { - } - - /* - * Set up the unit functional regressors for the credit curve regression set - */ - - @Override public boolean setupRegressors() - { - try { - /* - * Testing creation of the Credit Curve from SNAC instruments - implements the pre-regression, the - * post-regression, and the actual regression functionality of the UnitRegressorExecutor class. - */ - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("CreateSNAC", - _strRegressionScenario) - { - private double[] _adblQuotes = new double[5]; - private java.lang.String[] _astrCalibMeasure = new java.lang.String[5]; - private org.drip.product.definition.CreditDefaultSwap[] _aCDS = new - org.drip.product.definition.CreditDefaultSwap[5]; - - @Override public boolean preRegression() - { - _strCurrency = "USD"; - - if (null == (_dtStart = org.drip.analytics.date.DateUtil.CreateFromYMD (2010, - org.drip.analytics.date.DateUtil.MAY, 12))) - return false; - - if (null == (_dc = - org.drip.state.creator.ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate - (_dtStart, _strCurrency, 0.04))) - return false; - - for (int i = 0; i < 5; ++i) { - _adblQuotes[i] = 50. * (i + 1); - _astrCalibMeasure[i] = "FairPremium"; - - if (null == (_aCDS[i] = org.drip.product.creator.CDSBuilder.CreateSNAC (_dtStart, (i - + 1) + "Y", 0.01, "CORP"))) - return false; - } - - return true; - } - - @Override public boolean execRegression() - { - return null != (_cc = org.drip.state.creator.ScenarioCreditCurveBuilder.Custom ("CORP", - _dtStart, _aCDS, _dc, _adblQuotes, _astrCalibMeasure, 0.4, false)); - } - }); - - /* - * Testing creation of the Credit Curve from flat hazard - implements the pre-regression, the - * post-regression, and the actual regression functionality of the UnitRegressorExecutor class. - */ - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("FromFlatHazard", - _strRegressionScenario) - { - private org.drip.state.credit.CreditCurve _ccFromFlatHazard = null; - - @Override public boolean execRegression() - { - return null != (_ccFromFlatHazard = - org.drip.state.creator.ScenarioCreditCurveBuilder.FlatHazard (_dtStart.julian(), - "CORP", "USD", 0.02, 0.4)); - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - final int NUM_DC_INSTRUMENTS = 5; - double adblHazard[] = new double[NUM_DC_INSTRUMENTS]; - org.drip.analytics.date.JulianDate adt[] = new - org.drip.analytics.date.JulianDate[NUM_DC_INSTRUMENTS]; - - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) { - try { - if (!org.drip.quant.common.NumberUtil.IsValid (adblHazard[i] = - _ccFromFlatHazard.hazard (_dtStart, (adt[i] = _dtStart.addYears (i + 1))))) - return false; - - rnvd.set ("HazardRateFromHazardCurve[" + adt[i] + "]", - org.drip.quant.common.FormatUtil.FormatDouble (adblHazard[i], 1, 4, 1)); - - if (!org.drip.quant.common.NumberUtil.WithinTolerance (adblHazard[i], 0.02)) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } - }); - - /* - * Testing creation of the Credit Curve from flat survival - implements the pre-regression, the - * post-regression, and the actual regression functionality of the UnitRegressorExecutor class. - */ - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("FromSurvival", - _strRegressionScenario) - { - private static final int NUM_DC_INSTRUMENTS = 5; - - private int _aiDate[] = new int[NUM_DC_INSTRUMENTS]; - private double _adblSurvival[] = new double[NUM_DC_INSTRUMENTS]; - private org.drip.state.credit.CreditCurve _ccFromSurvival = null; - - @Override public boolean preRegression() - { - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) { - _aiDate[i] = _dtStart.addYears (i + 1).julian(); - - _adblSurvival[i] = 1. - (i + 1) * 0.1; - } - - return true; - } - - @Override public boolean execRegression() - { - return null != (_ccFromSurvival = - org.drip.state.creator.ScenarioCreditCurveBuilder.Survival (_dtStart.julian(), - "CORP", "USD", _aiDate, _adblSurvival, 0.4)); - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - double adblSurvivalCalc[] = new double[NUM_DC_INSTRUMENTS]; - - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) { - try { - if (!org.drip.quant.common.NumberUtil.IsValid (adblSurvivalCalc[i] = - _ccFromSurvival.survival (_aiDate[i]))) - return false; - - org.drip.analytics.date.JulianDate dt = new org.drip.analytics.date.JulianDate - (_aiDate[i]); - - rnvd.set ("SurvivalFromOriginal[" + dt + "]", - org.drip.quant.common.FormatUtil.FormatDouble (_adblSurvival[i], 1, 4, 1)); - - rnvd.set ("SurvivalFromSurvival[" + dt + "]", - org.drip.quant.common.FormatUtil.FormatDouble (adblSurvivalCalc[i], 1, 4, 1)); - - if (!org.drip.quant.common.NumberUtil.WithinTolerance (adblSurvivalCalc[i], - _adblSurvival[i])) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } - }); - - /* - * Testing creation of the Credit Curve from hazard nodes - implements the pre-regression, the - * post-regression, and the actual regression functionality of the UnitRegressorExecutor class. - */ - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("FromHazard", - _strRegressionScenario) - { - private static final int NUM_DC_INSTRUMENTS = 5; - - private int _aiDate[] = new int[NUM_DC_INSTRUMENTS]; - private double _adblHazard[] = new double[NUM_DC_INSTRUMENTS]; - private org.drip.state.credit.CreditCurve _ccFromHazard = null; - - @Override public boolean preRegression() - { - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) { - _aiDate[i] = _dtStart.addYears (i + 1).julian(); - - _adblHazard[i] = 0.01 * (1. - (i + 1) * 0.1); - } - - return true; - } - - @Override public boolean execRegression() - { - return null != (_ccFromHazard = org.drip.state.creator.ScenarioCreditCurveBuilder.Hazard - (_dtStart, "CORP", "USD", _aiDate, _adblHazard, 0.4)); - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - org.drip.analytics.date.JulianDate dt1 = _dtStart; - double adblHazardCalc[] = new double[NUM_DC_INSTRUMENTS]; - - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) { - try { - if (!org.drip.quant.common.NumberUtil.IsValid (adblHazardCalc[i] = - _ccFromHazard.hazard (dt1, dt1.addYears (1)))) - return false; - - org.drip.analytics.date.JulianDate dt2 = dt1.addYears (1); - - rnvd.set ("HazardFromOriginal[" + dt1 + "-" + dt2 + "]", - org.drip.quant.common.FormatUtil.FormatDouble (_adblHazard[i], 1, 4, 1)); - - rnvd.set ("HazardFromHazard[" + dt1 + "-" + dt2 + "]", - org.drip.quant.common.FormatUtil.FormatDouble (adblHazardCalc[i], 1, 4, 1)); - - if (!org.drip.quant.common.NumberUtil.WithinTolerance (adblHazardCalc[i], - _adblHazard[i])) - return false; - - dt1 = dt1.addYears (1); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } - }); - - /* - * Testing extraction of the credit curve components and quotes - implements the pre-regression, the - * post-regression, and the actual regression functionality of the UnitRegressorExecutor class. - */ - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("CompAndQuotes", - _strRegressionScenario) - { - private org.drip.product.definition.CalibratableComponent[] _aCalibComp = null; - - @Override public boolean execRegression() - { - return null != (_aCalibComp = _cc.calibComp()) && 0 != _aCalibComp.length; - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - for (int i = 0; i < _aCalibComp.length; ++i) { - org.drip.analytics.date.JulianDate dt = _aCalibComp[i].maturityDate(); - - java.lang.String strCode = _aCalibComp[i].primaryCode(); - - if (null == dt || null == strCode || strCode.isEmpty()) return false; - - try { - rnvd.set ("CompQuote" + "_" + strCode + "[" + dt + "]", - org.drip.quant.common.FormatUtil.FormatDouble (_cc.manifestMeasure - (strCode).get ("FairPremium"), 1, 4, 1)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } - }); - - /* - * Testing creation of a parallel hazard shifted Credit Curve - implements the pre-regression, the - * post-regression, and the actual regression functionality of the UnitRegressorExecutor class. - */ - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor - ("ParallelHazardShiftedCurve", _strRegressionScenario) - { - private org.drip.state.credit.CreditCurve _ccParallelShifted = null; - - @Override public boolean execRegression() - { - if (null == (_ccParallelShifted = (org.drip.state.credit.CreditCurve) - _cc.parallelShiftQuantificationMetric (0.0005))) - return false; - - return true; - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - org.drip.product.definition.CalibratableComponent[] aCalibComp = - _cc.calibComp(); - - org.drip.analytics.date.JulianDate dt1 = _dtStart; - - for (int i = 0; i < aCalibComp.length; ++i) { - org.drip.analytics.date.JulianDate dt = aCalibComp[i].maturityDate(); - - double dblBaseHazard = java.lang.Double.NaN; - double dblShiftedHazard = java.lang.Double.NaN; - - try { - if (!org.drip.quant.common.NumberUtil.IsValid (dblShiftedHazard = - _ccParallelShifted.hazard (dt1, dt)) || - !org.drip.quant.common.NumberUtil.IsValid (dblBaseHazard = _cc.hazard - (dt1, dt))) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - rnvd.set ("BaseCurveHazard[" + dt1 + "-" + dt + "]", - org.drip.quant.common.FormatUtil.FormatDouble (dblBaseHazard, 1, 4, 1)); - - rnvd.set ("ParallelShiftedCurveHazard[" + dt1 + "-" + dt + "]", - org.drip.quant.common.FormatUtil.FormatDouble (dblShiftedHazard, 1, 4, 1)); - - dt = dt1; - - if (!org.drip.quant.common.NumberUtil.WithinTolerance (dblBaseHazard + 0.0005, - dblShiftedHazard)) - return false; - } - - return true; - } - }); - - /* - * Testing creation of the parallel quote shifted credit curve - implements the pre-regression, the - * post-regression, and the actual regression functionality of the UnitRegressorExecutor class. - */ - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor - ("ParallelQuoteShiftedCurve", _strRegressionScenario) - { - private org.drip.state.credit.CreditCurve _ccParallelShifted = null; - - @Override public boolean execRegression() - { - return null != (_ccParallelShifted = (org.drip.state.credit.CreditCurve) - _cc.parallelShiftManifestMeasure ("FairPremium", 5.)); - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - org.drip.product.definition.CalibratableComponent[] aCalibComp = - _cc.calibComp(); - - org.drip.analytics.date.JulianDate dt1 = _dtStart; - - for (int i = 0; i < aCalibComp.length; ++i) { - org.drip.analytics.date.JulianDate dt = aCalibComp[i].maturityDate(); - - try { - rnvd.set ("BaseCurveQuote[" + dt + "]", - org.drip.quant.common.FormatUtil.FormatDouble (_cc.manifestMeasure - (aCalibComp[i].primaryCode()).get ("FairPremium"), 1, 5, 1)); - - rnvd.set ("ParallelShiftedCurveQuote[" + dt + "]", - org.drip.quant.common.FormatUtil.FormatDouble - (_ccParallelShifted.manifestMeasure (aCalibComp[i].primaryCode()).get - ("FairPremium"), 1, 5, 1)); - - dt = dt1; - - if (!org.drip.quant.common.NumberUtil.WithinTolerance (_cc.manifestMeasure - (aCalibComp[i].primaryCode()).get ("FairPremium") + 5., - _ccParallelShifted.manifestMeasure (aCalibComp[i].primaryCode()).get - ("FairPremium"))) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } - }); - - /* - * Testing creation of the node tweaked Credit Curve - implements the pre-regression, the - * post-regression, and the actual regression functionality of the UnitRegressorExecutor class. - */ - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("NodeTweakedCurve", - _strRegressionScenario) - { - private static final int TWEAKED_NODE = 0; - - private org.drip.param.definition.CreditManifestMeasureTweak _cntp = null; - private org.drip.state.credit.CreditCurve _ccTweakedCurve = null; - - @Override public boolean preRegression() - { - try { - _cntp = new org.drip.param.definition.CreditManifestMeasureTweak - (org.drip.param.definition.CreditManifestMeasureTweak.CREDIT_TWEAK_NODE_PARAM_QUOTE, - org.drip.param.definition.CreditManifestMeasureTweak.CREDIT_TWEAK_NODE_MEASURE_QUOTE, - TWEAKED_NODE, true, 0.1, false); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - return true; - } - - @Override public boolean execRegression() - { - return null != (_ccTweakedCurve = (org.drip.state.credit.CreditCurve) - _cc.customTweakManifestMeasure ("FairPremium", _cntp)); - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - org.drip.product.definition.CalibratableComponent[] aCalibComp = - _cc.calibComp(); - - org.drip.analytics.date.JulianDate dt1 = _dtStart; - - for (int i = 0; i < aCalibComp.length; ++i) { - org.drip.analytics.date.JulianDate dt = aCalibComp[i].maturityDate(); - - double dblBaseHazard = java.lang.Double.NaN; - double dblShiftedHazard = java.lang.Double.NaN; - - try { - if (!org.drip.quant.common.NumberUtil.IsValid (dblShiftedHazard = - _ccTweakedCurve.hazard (dt1, dt)) || - !org.drip.quant.common.NumberUtil.IsValid (dblBaseHazard = _cc.hazard - (dt1, dt))) - return false; - } catch (Exception e) { - e.printStackTrace(); - - return false; - } - - rnvd.set ("UntweakedHazard[" + dt + "]", - org.drip.quant.common.FormatUtil.FormatDouble (dblBaseHazard, 1, 5, 1)); - - rnvd.set ("TweakedHazard[" + dt + "]", org.drip.quant.common.FormatUtil.FormatDouble - (dblShiftedHazard, 1, 5, 1)); - - dt = dt1; - } - - return true; - } - }); - - /* - * Testing creation of the Credit Curve from flat/quoted spread - implements the pre-regression, the - * post-regression, and the actual regression functionality of the UnitRegressorExecutor class. - */ - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("FlatCurve", - _strRegressionScenario) - { - private org.drip.state.credit.CreditCurve _ccFlatCurve = null; - - @Override public boolean execRegression() - { - if (null == (_ccFlatCurve = _cc.flatCurve (90., false, 0.35))) return false; - - return true; - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - final int NUM_DC_INSTRUMENTS = 5; - - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) { - org.drip.analytics.date.JulianDate dt = _dtStart.addYears (i + 1); - - double dblHazard = java.lang.Double.NaN; - - try { - if (!org.drip.quant.common.NumberUtil.IsValid (dblHazard = _ccFlatCurve.hazard - (dt))) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - rnvd.set ("FlatHazard[" + dt + "]", org.drip.quant.common.FormatUtil.FormatDouble - (dblHazard, 1, 5, 1)); - } - - return true; - } - }); - - /* - * Testing setting/removing specific default dates - implements the pre-regression, the - * post-regression, and the actual regression functionality of the UnitRegressorExecutor class. - */ - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("SpecificDefault", - _strRegressionScenario) - { - private int _iSpecificDefaultDate = java.lang.Integer.MIN_VALUE; - - @Override public boolean preRegression() - { - return !org.drip.quant.common.NumberUtil.IsValid (_iSpecificDefaultDate = _dtStart.addYears - (2).julian()); - } - - @Override public boolean execRegression() - { - return _cc.setSpecificDefault (_iSpecificDefaultDate); - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - double dblSurvivalProb = java.lang.Double.NaN; - - org.drip.analytics.date.JulianDate dtSurvival = _dtStart.addYears (3); - - int iSurvivalDate = dtSurvival.julian(); - - try { - if (!org.drip.quant.common.NumberUtil.IsValid (dblSurvivalProb = _cc.survival - (iSurvivalDate))) - return false; - } catch (Exception e) { - e.printStackTrace(); - - return false; - } - - rnvd.set ("SpecificDefaultSetSurvival[" + dtSurvival + "]", "" + dblSurvivalProb); - - if (!_cc.unsetSpecificDefault()) return false; - - try { - if (!org.drip.quant.common.NumberUtil.IsValid (dblSurvivalProb = _cc.survival - (iSurvivalDate))) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - rnvd.set ("SpecificDefaultUnsetSurvival[" + dtSurvival + "]", "" + dblSurvivalProb); - - return true; - } - }); - - /* - * Testing calculation of effective survival between2 dates - implements the pre-regression, the - * post-regression, and the actual regression functionality of the UnitRegressorExecutor class. - */ - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("EffectiveSurvival", - _strRegressionScenario) - { - private static final int NUM_DC_INSTRUMENTS = 5; - - private int _aiDate[] = new int[NUM_DC_INSTRUMENTS]; - private double _adblSurvival[] = new double[NUM_DC_INSTRUMENTS]; - - @Override public boolean preRegression() - { - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) - _aiDate[i] = _dtStart.addYears (i + 1).julian(); - - return true; - } - - @Override public boolean execRegression() - { - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) { - try { - if (!org.drip.quant.common.NumberUtil.IsValid (_adblSurvival[i] = - _cc.effectiveSurvival ((i + 1) + "Y", (i + 2) + "Y"))) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) { - try { - rnvd.set ("EffectiveSurvival[" + new org.drip.analytics.date.JulianDate - (_aiDate[i]) + "]", org.drip.quant.common.FormatUtil.FormatDouble - (_adblSurvival[i], 1, 4, 1)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } - }); - - /* - * Testing calculation of effective recovery between2 dates - implements the pre-regression, the - * post-regression, and the actual regression functionality of the UnitRegressorExecutor class. - */ - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("EffectiveRecovery", - _strRegressionScenario) - { - private static final int NUM_DC_INSTRUMENTS = 5; - - private double _adblEffectiveRecovery[] = new double[NUM_DC_INSTRUMENTS]; - - @Override public boolean execRegression() - { - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) { - try { - if (!org.drip.quant.common.NumberUtil.IsValid (_adblEffectiveRecovery[i] = - _cc.effectiveRecovery ((i + 1) + "Y", (i + 2) + "Y"))) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) { - try { - rnvd.set ("EffectiveRecovery[" + (i + 1) + "Y-" + (i + 2) + "Y]", - org.drip.quant.common.FormatUtil.FormatDouble (_adblEffectiveRecovery[i], 1, - 4, 1)); - - rnvd.set ("CurveRecovery[" + (i + 1) + "Y-" + (i + 2) + "Y]", - org.drip.quant.common.FormatUtil.FormatDouble (_cc.recovery ((i + 1) + "Y"), - 1, 4, 1) + "-" + org.drip.quant.common.FormatUtil.FormatDouble - (_cc.recovery ((i + 2) + "Y"), 1, 4, 1)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } - }); - } catch (Exception e) { - e.printStackTrace(); - - return false; - } - - return true; - } - - @Override public java.util.List getRegressorSet() - { - return _setRegressors; - } - - @Override public java.lang.String getSetName() - { - return _strRegressionScenario; - } -} diff --git a/org/drip/regression/curve/DiscountCurveRegressor.java b/org/drip/regression/curve/DiscountCurveRegressor.java deleted file mode 100644 index aca59c2..0000000 --- a/org/drip/regression/curve/DiscountCurveRegressor.java +++ /dev/null @@ -1,904 +0,0 @@ - -package org.drip.regression.curve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * DiscountCurveRegressor implements the regression set analysis for the Discount Curve. - * DiscountCurveRegressor regresses 11 scenarios: - * - #1: Create the discount curve from a set 30 instruments (cash/future/swap). - * - #2: Create the discount curve from a flat discount rate. - * - #3: Create the discount curve from a set of discount factors. - * - #4: Create the discount curve from the implied discount rates. - * - #5: Extract the discount curve instruments and quotes. - * - #6: Create a parallel shifted discount curve. - * - #7: Create a rate shifted discount curve. - * - #8: Create a basis rate shifted discount curve. - * - #9: Create a node tweaked discount curve. - * - #10: Compute the effective discount factor between 2 dates. - * - #11: Compute the effective implied rate between 2 dates. - * - * @author Lakshmi Krishnamurthy - */ - -public class DiscountCurveRegressor implements org.drip.regression.core.RegressorSet { - private java.lang.String _strCurrency = ""; - private org.drip.state.discount.MergedDiscountForwardCurve _dc = null; - private org.drip.analytics.date.JulianDate _dtStart = null; - private org.drip.state.discount.ExplicitBootDiscountCurve _dcFromFlatRate = null; - private java.lang.String _strRegressionScenario = "org.drip.analytics.curve.DiscountCurve"; - - private java.util.List _setRegressors = new - java.util.ArrayList(); - - /** - * Do Nothing DiscountCurveRegressor constructor - */ - - public DiscountCurveRegressor() - { - } - - /* - * Discount Curve Regressor set setup - */ - - @Override public boolean setupRegressors() - { - /* - * Testing creation of the Discount Curve from rates instruments - implements the pre-regression, the - * post-regression, and the actual regression functionality of the UnitRegressorExecutor class. - */ - - try { - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor - ("CreateFromRatesInstruments", _strRegressionScenario) - { - private static final int NUM_DC_INSTR = 30; - - private double _adblCompCalibValue[] = new double[NUM_DC_INSTR]; - private java.lang.String _astrCalibMeasure[] = new java.lang.String[NUM_DC_INSTR]; - private org.drip.product.definition.CalibratableComponent _aCompCalib[] = new - org.drip.product.definition.CalibratableComponent[NUM_DC_INSTR]; - - private org.drip.param.market.LatentStateFixingsContainer _lsfc = new - org.drip.param.market.LatentStateFixingsContainer(); - - @Override public boolean preRegression() - { - _strCurrency = "CHF"; - int aiDate[] = new int[NUM_DC_INSTR]; - double adblRate[] = new double[NUM_DC_INSTR]; - - if (null == (_dtStart = org.drip.analytics.date.DateUtil.CreateFromYMD (2010, - org.drip.analytics.date.DateUtil.MAY, 12))) - return false; - - aiDate[0] = _dtStart.addDays (3).julian(); // ON - - aiDate[1] = _dtStart.addDays (4).julian(); // 1D (TN) - - aiDate[2] = _dtStart.addDays (9).julian(); // 1W - - aiDate[3] = _dtStart.addDays (16).julian(); // 2W - - aiDate[4] = _dtStart.addDays (32).julian(); // 1M - - aiDate[5] = _dtStart.addDays (62).julian(); // 2M - - aiDate[6] = _dtStart.addDays (92).julian(); // 3M - - _adblCompCalibValue[0] = .0013; - _adblCompCalibValue[1] = .0017; - _adblCompCalibValue[2] = .0017; - _adblCompCalibValue[3] = .0018; - _adblCompCalibValue[4] = .0020; - _adblCompCalibValue[5] = .0023; - _adblCompCalibValue[6] = .0026; - - for (int i = 0; i < 7; ++i) { - _astrCalibMeasure[i] = "Rate"; - adblRate[i] = java.lang.Double.NaN; - - try { - _aCompCalib[i] = org.drip.product.creator.SingleStreamComponentBuilder.Deposit - (_dtStart.addDays (2), new org.drip.analytics.date.JulianDate (aiDate[i]), - org.drip.state.identifier.ForwardLabel.Create (_strCurrency, "3M")); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - _adblCompCalibValue[7] = .0027; - _adblCompCalibValue[8] = .0032; - _adblCompCalibValue[9] = .0041; - _adblCompCalibValue[10] = .0054; - _adblCompCalibValue[11] = .0077; - _adblCompCalibValue[12] = .0104; - _adblCompCalibValue[13] = .0134; - _adblCompCalibValue[14] = .0160; - org.drip.analytics.date.JulianDate dtEDFStart = _dtStart; - - org.drip.product.definition.CalibratableComponent[] aEDF = - org.drip.product.creator.SingleStreamComponentBuilder.ForwardRateFuturesPack - (_dtStart, 8, _strCurrency); - - for (int i = 0; i < 8; ++i) { - _aCompCalib[i + 7] = aEDF[i]; - _astrCalibMeasure[i + 7] = "Rate"; - adblRate[i + 7] = java.lang.Double.NaN; - - aiDate[i + 7] = dtEDFStart.addDays ((i + 1) * 91).julian(); - } - - aiDate[15] = _dtStart.addDays ((int)(365.25 * 4 + 2)).julian(); // 4Y - - aiDate[16] = _dtStart.addDays ((int)(365.25 * 5 + 2)).julian(); // 5Y - - aiDate[17] = _dtStart.addDays ((int)(365.25 * 6 + 2)).julian(); // 6Y - - aiDate[18] = _dtStart.addDays ((int)(365.25 * 7 + 2)).julian(); // 7Y - - aiDate[19] = _dtStart.addDays ((int)(365.25 * 8 + 2)).julian(); // 8Y - - aiDate[20] = _dtStart.addDays ((int)(365.25 * 9 + 2)).julian(); // 9Y - - aiDate[21] = _dtStart.addDays ((int)(365.25 * 10 + 2)).julian(); // 10Y - - aiDate[22] = _dtStart.addDays ((int)(365.25 * 11 + 2)).julian(); // 11Y - - aiDate[23] = _dtStart.addDays ((int)(365.25 * 12 + 2)).julian(); // 12Y - - aiDate[24] = _dtStart.addDays ((int)(365.25 * 15 + 2)).julian(); // 15Y - - aiDate[25] = _dtStart.addDays ((int)(365.25 * 20 + 2)).julian(); // 20Y - - aiDate[26] = _dtStart.addDays ((int)(365.25 * 25 + 2)).julian(); // 25Y - - aiDate[27] = _dtStart.addDays ((int)(365.25 * 30 + 2)).julian(); // 30Y - - aiDate[28] = _dtStart.addDays ((int)(365.25 * 40 + 2)).julian(); // 40Y - - aiDate[29] = _dtStart.addDays ((int)(365.25 * 50 + 2)).julian(); // 50Y - - _adblCompCalibValue[15] = .0166; - _adblCompCalibValue[16] = .0206; - _adblCompCalibValue[17] = .0241; - _adblCompCalibValue[18] = .0269; - _adblCompCalibValue[19] = .0292; - _adblCompCalibValue[20] = .0311; - _adblCompCalibValue[21] = .0326; - _adblCompCalibValue[22] = .0340; - _adblCompCalibValue[23] = .0351; - _adblCompCalibValue[24] = .0375; - _adblCompCalibValue[25] = .0393; - _adblCompCalibValue[26] = .0402; - _adblCompCalibValue[27] = .0407; - _adblCompCalibValue[28] = .0409; - _adblCompCalibValue[29] = .0409; - org.drip.param.period.CompositePeriodSetting cpsFixed = null; - org.drip.param.period.CompositePeriodSetting cpsFloating = null; - org.drip.param.period.UnitCouponAccrualSetting ucasFixed = null; - org.drip.param.period.ComposableFixedUnitSetting cfusFixed = null; - org.drip.param.period.ComposableFloatingUnitSetting cfusFloating = null; - - try { - ucasFixed = new org.drip.param.period.UnitCouponAccrualSetting (2, "Act/360", false, - "Act/360", false, _strCurrency, true, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - cfusFloating = new org.drip.param.period.ComposableFloatingUnitSetting ("3M", - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, org.drip.state.identifier.ForwardLabel.Standard (_strCurrency + "-3M"), - org.drip.analytics.support.CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0.); - - cfusFixed = new org.drip.param.period.ComposableFixedUnitSetting ("6M", - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, 0., 0., _strCurrency); - - cpsFloating = new org.drip.param.period.CompositePeriodSetting (4, "3M", - _strCurrency, null, -1., null, null, null, null); - - cpsFixed = new org.drip.param.period.CompositePeriodSetting (2, "6M", _strCurrency, - null, 1., null, null, null, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - for (int i = 0; i < 15; ++i) { - _astrCalibMeasure[i + 15] = "Rate"; - adblRate[i + 15] = java.lang.Double.NaN; - - try { - org.drip.analytics.date.JulianDate dtMaturity = new - org.drip.analytics.date.JulianDate (aiDate[i + 15]); - - java.util.List lsFixedStreamEdgeDate = - org.drip.analytics.support.CompositePeriodBuilder.BackwardEdgeDates - (_dtStart, dtMaturity, "6M", null, - org.drip.analytics.support.CompositePeriodBuilder.SHORT_STUB); - - java.util.List lsFloatingStreamEdgeDate = - org.drip.analytics.support.CompositePeriodBuilder.BackwardEdgeDates - (_dtStart, dtMaturity, "3M", null, - org.drip.analytics.support.CompositePeriodBuilder.SHORT_STUB); - - org.drip.product.rates.Stream floatingStream = new org.drip.product.rates.Stream - (org.drip.analytics.support.CompositePeriodBuilder.FloatingCompositeUnit - (lsFloatingStreamEdgeDate, cpsFloating, cfusFloating)); - - org.drip.product.rates.Stream fixedStream = new org.drip.product.rates.Stream - (org.drip.analytics.support.CompositePeriodBuilder.FixedCompositeUnit - (lsFixedStreamEdgeDate, cpsFixed, ucasFixed, cfusFixed)); - - _aCompCalib[i + 15] = new org.drip.product.rates.FixFloatComponent (fixedStream, - floatingStream, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - _lsfc.add (_dtStart.addDays (2), org.drip.state.identifier.ForwardLabel.Standard - (_strCurrency + "-6M"), 0.0042); - - return true; - } - - @Override public boolean execRegression() - { - return null != (_dc = org.drip.state.creator.ScenarioDiscountCurveBuilder.NonlinearBuild - (_dtStart, _strCurrency, _aCompCalib, _adblCompCalibValue, _astrCalibMeasure, - _lsfc)); - } - }); - - /* - * Testing creation of the Discount Curve from a flat rate - implements the pre-regression, the - * post-regression, and the actual regression functionality of the UnitRegressorExecutor class. - */ - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("CreateFromFlatRate", - _strRegressionScenario) - { - @Override public boolean execRegression() - { - return null != (_dcFromFlatRate = - org.drip.state.creator.ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate - (_dtStart, _strCurrency, 0.04)); - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - final int NUM_DC_INSTRUMENTS = 5; - int aiDate[] = new int[NUM_DC_INSTRUMENTS]; - double adblDiscountFactorFlatRate[] = new double[NUM_DC_INSTRUMENTS]; - - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) { - try { - if (!org.drip.quant.common.NumberUtil.IsValid (adblDiscountFactorFlatRate[i] = - _dcFromFlatRate.df (aiDate[i] = _dtStart.addYears (i + 1).julian()))) - return false; - - rnvd.set ("DiscountFactor[" + new org.drip.analytics.date.JulianDate - (aiDate[i]) + "]", "" + adblDiscountFactorFlatRate[i]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } - }); - - /* - * Testing creation of the Discount Curve from discount factors - implements the pre-regression, - * the post-regression, and the actual regression functionality of the UnitRegressorExecutor - * class. - */ - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("BuildFromDF", - _strRegressionScenario) - { - private static final int NUM_DC_INSTRUMENTS = 5; - - private int _aiDate[] = new int[NUM_DC_INSTRUMENTS]; - private org.drip.state.discount.MergedDiscountForwardCurve _dcFromDF = null; - private double _adblDiscountFactorFlatRate[] = new double[NUM_DC_INSTRUMENTS]; - - @Override public boolean preRegression() - { - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) { - try { - if (!org.drip.quant.common.NumberUtil.IsValid (_adblDiscountFactorFlatRate[i] = - _dc.df (_aiDate[i] = _dtStart.addYears (i + 1).julian()))) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } - - @Override public boolean execRegression() - { - return null != (_dcFromDF = - org.drip.state.creator.ScenarioDiscountCurveBuilder.BuildFromDF (_dtStart, - _strCurrency, _aiDate, _adblDiscountFactorFlatRate)); - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) { - try { - double dblDiscountFactorDFCurve = _dcFromDF.df (_aiDate[i]); - - rnvd.set ("DiscountFactorFlatRate[" + new org.drip.analytics.date.JulianDate - (_aiDate[i]) + "]", org.drip.quant.common.FormatUtil.FormatDouble - (_adblDiscountFactorFlatRate[i], 1, 3, 1)); - - rnvd.set ("DiscountFactorDFCurve[" + new org.drip.analytics.date.JulianDate - (_aiDate[i]) + "]", org.drip.quant.common.FormatUtil.FormatDouble - (dblDiscountFactorDFCurve, 1, 3, 1)); - - if (!org.drip.quant.common.NumberUtil.WithinTolerance (dblDiscountFactorDFCurve, - _adblDiscountFactorFlatRate[i])) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } - }); - - /* - * Testing creation of the Discount Curve from rates nodes - implements the pre-regression, the - * post-regression, and the actual regression functionality of the UnitRegressorExecutor class. - */ - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("CreateDC", - _strRegressionScenario) - { - private static final int NUM_DC_INSTRUMENTS = 5; - - private int _aiDate[] = new int[NUM_DC_INSTRUMENTS]; - private double _adblRate[] = new double[NUM_DC_INSTRUMENTS]; - private org.drip.state.discount.MergedDiscountForwardCurve _dcFromRates = null; - - @Override public boolean preRegression() - { - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) { - try { - if (!org.drip.quant.common.NumberUtil.IsValid (_adblRate[i] = _dc.zero - (_aiDate[i] = _dtStart.addYears (i + 1).julian()))) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } - - @Override public boolean execRegression() - { - return null != (_dcFromRates = - org.drip.state.creator.ScenarioDiscountCurveBuilder.PiecewiseForward (_dtStart, - _strCurrency, _aiDate, _adblRate)); - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) { - try { - int iStartDate = _dtStart.julian(); - - if (0 != i) iStartDate = _aiDate[i - 1]; - - double dblRate = _dcFromRates.forward (iStartDate, _aiDate[i]); - - rnvd.set ("DiscountFactorOriginalDC[" + new org.drip.analytics.date.JulianDate - (_aiDate[i]) + "]", org.drip.quant.common.FormatUtil.FormatDouble - (_adblRate[i], 1, 3, 1)); - - rnvd.set ("DiscountFactoRateImplied[" + new org.drip.analytics.date.JulianDate - (_aiDate[i]) + "]", org.drip.quant.common.FormatUtil.FormatDouble (dblRate, - 1, 3, 1)); - - if (!org.drip.quant.common.NumberUtil.WithinTolerance (dblRate, _adblRate[i])) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } - }); - - /* - * Testing the extraction of the components and quotes - implements the pre-regression, the - * post-regression, and the actual regression functionality of the UnitRegressorExecutor class. - */ - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("CompAndQuotes", - _strRegressionScenario) - { - private org.drip.product.definition.CalibratableComponent[] _aCalibComp = null; - - @Override public boolean execRegression() - { - return null != (_aCalibComp = _dc.calibComp()) && 0 != _aCalibComp.length; - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - for (int i = 0; i < _aCalibComp.length; ++i) { - java.lang.String strCalibCompCode = _aCalibComp[i].primaryCode(); - - try { - double dblQuote = _dc.manifestMeasure (strCalibCompCode).get ("Rate"); - - org.drip.analytics.date.JulianDate dt = _aCalibComp[i].maturityDate(); - - rnvd.set ("CompQuote" + "_" + strCalibCompCode + "{" + dt + "}", - org.drip.quant.common.FormatUtil.FormatDouble (dblQuote, 1, 4, 1)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } - }); - - /* - * Testing creation of the Parallel-shifted Discount Curve - implements the pre-regression, the - * post-regression, and the actual regression functionality of the UnitRegressorExecutor class. - */ - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("ParallelShiftedCurve", - _strRegressionScenario) - { - private org.drip.state.discount.MergedDiscountForwardCurve _dcShifted = null; - - @Override public boolean execRegression() - { - return null != (_dcShifted = (org.drip.state.discount.MergedDiscountForwardCurve) - _dc.parallelShiftManifestMeasure ("Rate", 0.0004)); - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - org.drip.product.definition.CalibratableComponent[] aCalibComp = - _dc.calibComp(); - - for (int i = 0; i < aCalibComp.length; ++i) { - java.lang.String strCalibCompCode = aCalibComp[i].primaryCode(); - - try { - double dblQuote = _dc.manifestMeasure (strCalibCompCode).get ("Rate"); - - double dblQuoteShifted = _dcShifted.manifestMeasure (strCalibCompCode).get - ("Rate"); - - rnvd.set ("BaseCurve" + "_" + strCalibCompCode, - org.drip.quant.common.FormatUtil.FormatDouble (dblQuote, 1, 4, 1)); - - rnvd.set ("ParallelShiftedCurve" + "_" + strCalibCompCode, - org.drip.quant.common.FormatUtil.FormatDouble (dblQuoteShifted, 1, 4, 1)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } - }); - - /* - * Testing creation of the Rate-shifted Discount Curve - implements the pre-regression, the - * post-regression, and the actual regression functionality of the UnitRegressorExecutor class. - */ - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("RateShiftedCurve", - _strRegressionScenario) - { - private org.drip.state.discount.MergedDiscountForwardCurve _dcShifted = null; - - @Override public boolean execRegression() - { - return null != (_dcShifted = (org.drip.state.discount.MergedDiscountForwardCurve) - _dcFromFlatRate.parallelShiftManifestMeasure ("Rate", 0.0004)); - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - final int NUM_DC_INSTRUMENTS = 5; - int aiDate[] = new int[NUM_DC_INSTRUMENTS]; - double adblRate[] = new double[NUM_DC_INSTRUMENTS]; - double adblRateShifted[] = new double[NUM_DC_INSTRUMENTS]; - - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) { - try { - if (!org.drip.quant.common.NumberUtil.IsValid (adblRate[i] = _dcFromFlatRate.zero - (aiDate[i] = _dtStart.addYears (i + 1).julian()))) - return false; - - if (!org.drip.quant.common.NumberUtil.IsValid (adblRateShifted[i] = - _dcShifted.zero (aiDate[i] = _dtStart.addYears (i + 1).julian()))) - return false; - - org.drip.analytics.date.JulianDate dt = new org.drip.analytics.date.JulianDate - (aiDate[i]); - - rnvd.set ("RateBase[" + dt + "]", org.drip.quant.common.FormatUtil.FormatDouble - (adblRate[i], 1, 4, 1)); - - rnvd.set ("RateShifted[" + dt + "]", - org.drip.quant.common.FormatUtil.FormatDouble (adblRateShifted[i], 1, 4, 1)); - - if (!org.drip.quant.common.NumberUtil.WithinTolerance (adblRate[i] + 0.0004, - adblRateShifted[i])) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } - }); - - /* - * Testing creation of the basis rate-shifted Discount Curve - implements the pre-regression, the - * post-regression, and the actual regression functionality of the UnitRegressorExecutor class. - */ - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("BasisRateShiftedCurve", - _strRegressionScenario) - { - private static final int NUM_DC_INSTRUMENTS = 5; - - private int _aiDate[] = new int[NUM_DC_INSTRUMENTS]; - private double _adblBasis[] = new double[NUM_DC_INSTRUMENTS]; - private org.drip.state.discount.MergedDiscountForwardCurve _dcBasisShifted = null; - - @Override public boolean preRegression() - { - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) { - _adblBasis[i] = (i + 1) * 0.0001; - - _aiDate[i] = _dtStart.addYears (i + 1).julian(); - } - - return true; - } - - @Override public boolean execRegression() - { - return null != (_dcBasisShifted = _dcFromFlatRate.createBasisRateShiftedCurve (_aiDate, - _adblBasis)); - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - double adblRate[] = new double[NUM_DC_INSTRUMENTS]; - double adblRateShifted[] = new double[NUM_DC_INSTRUMENTS]; - - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) { - try { - if (!org.drip.quant.common.NumberUtil.IsValid (adblRate[i] = _dcFromFlatRate.zero - (_aiDate[i]))) - return false; - - if (!org.drip.quant.common.NumberUtil.IsValid (adblRateShifted[i] = - _dcBasisShifted.zero (_aiDate[i]))) - return false; - - org.drip.analytics.date.JulianDate dt = new org.drip.analytics.date.JulianDate - (_aiDate[i]); - - rnvd.set ("RateBasisEmpty[" + dt + "]", - org.drip.quant.common.FormatUtil.FormatDouble (adblRate[i], 1, 4, 1)); - - rnvd.set ("RateBasisShifted[" + dt + "]", - org.drip.quant.common.FormatUtil.FormatDouble (adblRateShifted[i], 1, 4, 1)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } - }); - - /* - * Testing creation of the Tweaked Discount Curve - implements the pre-regression, the - * post-regression, and the actual regression functionality of the UnitRegressorExecutor class. - */ - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("CreateTweakedCurve", - _strRegressionScenario) - { - private static final int NUM_DC_INSTRUMENTS = 5; - - private int _aiDate[] = new int[NUM_DC_INSTRUMENTS]; - private org.drip.state.discount.MergedDiscountForwardCurve _dcNTP = null; - private org.drip.param.definition.ManifestMeasureTweak _ntp = null; - - @Override public boolean preRegression() - { - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) - _aiDate[i] = _dtStart.addYears (i + 1).julian(); - - try { - _ntp = new org.drip.param.definition.ManifestMeasureTweak (0, false, 0.0005); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - return true; - } - - @Override public boolean execRegression() - { - return null != (_dcNTP = (org.drip.state.discount.MergedDiscountForwardCurve) - _dcFromFlatRate.customTweakManifestMeasure ("Rate", _ntp)); - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - double adblRate[] = new double[NUM_DC_INSTRUMENTS]; - double adblRateNTP[] = new double[NUM_DC_INSTRUMENTS]; - - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) { - try { - if (!org.drip.quant.common.NumberUtil.IsValid (adblRate[i] = _dcFromFlatRate.zero - (_aiDate[i]))) - return false; - - if (!org.drip.quant.common.NumberUtil.IsValid (adblRateNTP[i] = _dcNTP.zero - (_aiDate[i]))) - return false; - - org.drip.analytics.date.JulianDate dt = new org.drip.analytics.date.JulianDate - (_aiDate[i]); - - rnvd.set ("RateUnTweaked[" + dt + "]", - org.drip.quant.common.FormatUtil.FormatDouble (adblRate[i], 1, 4, 1)); - - rnvd.set ("RateTweaked[" + dt + "]", - org.drip.quant.common.FormatUtil.FormatDouble (adblRateNTP[i], 1, 4, 1)); - - if (!org.drip.quant.common.NumberUtil.WithinTolerance (adblRate[i] + 0.0005, - adblRateNTP[i])) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } - }); - - /* - * Testing calc of Effective DF for the Discount Curve - implements the pre-regression, the - * post-regression, and the actual regression functionality of the UnitRegressorExecutor class. - */ - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("EffectiveDF", - _strRegressionScenario) - { - private static final int NUM_DC_INSTRUMENTS = 5; - - private int _aiDate[] = new int[NUM_DC_INSTRUMENTS]; - private double _adblDiscountFactor[] = new double[NUM_DC_INSTRUMENTS]; - - @Override public boolean preRegression() - { - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) - _aiDate[i] = _dtStart.addYears (i + 1).julian(); - - return true; - } - - @Override public boolean execRegression() - { - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) { - try { - if (!org.drip.quant.common.NumberUtil.IsValid (_adblDiscountFactor[i] = - _dc.effectiveDF ((i + 1) + "Y", (i + 2) + "Y"))) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) { - try { - rnvd.set ("Effective[" + new org.drip.analytics.date.JulianDate (_aiDate[i]) + - "]", org.drip.quant.common.FormatUtil.FormatDouble (_adblDiscountFactor[i], - 1, 4, 1)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } - }); - - /* - * Testing calc of Effective Rate for the Discount Curve - implements the pre-regression, the - * post-regression, and the actual regression functionality of the UnitRegressorExecutor class. - */ - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("CalcImpliedRate", - _strRegressionScenario) - { - private static final int NUM_DC_INSTRUMENTS = 5; - - private int _aiDate[] = new int[NUM_DC_INSTRUMENTS]; - private double _adblImpliedRate[] = new double[NUM_DC_INSTRUMENTS]; - - @Override public boolean preRegression() - { - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) - _aiDate[i] = _dtStart.addYears (i + 1).julian(); - - return true; - } - - @Override public boolean execRegression() - { - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) { - try { - if (!org.drip.quant.common.NumberUtil.IsValid (_adblImpliedRate[i] = _dc.forward - ((i + 1) + "Y", (i + 2) + "Y"))) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - for (int i = 0; i < NUM_DC_INSTRUMENTS; ++i) { - try { - rnvd.set ("ImpliedRate[" + new org.drip.analytics.date.JulianDate (_aiDate[i]) - + "]", org.drip.quant.common.FormatUtil.FormatDouble (_adblImpliedRate[i], 1, - 4, 1)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } - }); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - return true; - } - - @Override public java.util.List getRegressorSet() - { - return _setRegressors; - } - - @Override public java.lang.String getSetName() - { - return _strRegressionScenario; - } -} diff --git a/org/drip/regression/curve/ZeroCurveRegressor.java b/org/drip/regression/curve/ZeroCurveRegressor.java deleted file mode 100644 index b52ed79..0000000 --- a/org/drip/regression/curve/ZeroCurveRegressor.java +++ /dev/null @@ -1,308 +0,0 @@ - -package org.drip.regression.curve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * ZeroCurveRegressor implements the regression analysis set for the Zero Curve. The regression tests do the - * consists of the following: - * - Build a discount curve, followed by the zero curve - * - Regressor #1: Compute zero curve discount factors - * - Regressor #2: Compute zero curve zero rates - * - * @author Lakshmi Krishnamurthy - */ - -public class ZeroCurveRegressor implements org.drip.regression.core.RegressorSet { - private org.drip.state.discount.ZeroCurve _zc = null; - private java.lang.String _strRegressionScenario = "org.drip.analytics.curve.ZeroCurve"; - - private java.util.List _setRegressors = new - java.util.ArrayList(); - - /** - * ZeroCurveRegressor constructor - Creates the base zero curve and initializes the regression objects - */ - - public ZeroCurveRegressor() - { - } - - /* - * Setting up of the zero curve regressor set - */ - - @Override public boolean setupRegressors() - { - /* - * Zero Curve Creation unit regressor - implements the pre-regression, the post-regression, and the - * actual regression functionality of the UnitRegressorExecutor class. - */ - - try { - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor - ("CreateZeroCurveFromPeriods", _strRegressionScenario) - { - private static final double s_dblZSpread = 0.01; - - private org.drip.analytics.date.JulianDate _dtStart = null; - private org.drip.state.discount.ExplicitBootDiscountCurve _dc = null; - - private java.util.List _lsCouponPeriod = new - java.util.ArrayList(); - - @Override public boolean preRegression() - { - if (null == (_dtStart = org.drip.analytics.date.DateUtil.CreateFromYMD (2010, - org.drip.analytics.date.DateUtil.MAY, 12))) - return false; - - final int NUM_DC_NODES = 5; - final int NUM_PERIOD_NODES = 40; - int aiDate[] = new int[NUM_DC_NODES]; - double adblRate[] = new double[NUM_DC_NODES]; - - for (int i = 0; i < NUM_DC_NODES; ++i) { - aiDate[i] = _dtStart.addYears (2 * i + 1).julian(); - - adblRate[i] = 0.05 + 0.001 * (NUM_DC_NODES - i); - } - - if (null == (_dc = org.drip.state.creator.ScenarioDiscountCurveBuilder.PiecewiseForward - (_dtStart, "CHF", aiDate, adblRate))) - return false; - - try { - org.drip.param.period.UnitCouponAccrualSetting ucas = new - org.drip.param.period.UnitCouponAccrualSetting (2, "30/360", false, "30/360", - false, "ZAR", false, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - org.drip.param.period.ComposableFixedUnitSetting cfus = new - org.drip.param.period.ComposableFixedUnitSetting ("6M", - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, s_dblZSpread, 0., "ZAR"); - - org.drip.param.period.CompositePeriodSetting cps = new - org.drip.param.period.CompositePeriodSetting (2, "6M", "ZAR", null, 1., null, - null, null, null); - - java.util.List lsStreamEdgeDate = - org.drip.analytics.support.CompositePeriodBuilder.RegularEdgeDates (_dtStart, - "6M", (NUM_PERIOD_NODES * 6) + "M", null); - - _lsCouponPeriod = - org.drip.analytics.support.CompositePeriodBuilder.FixedCompositeUnit ( - lsStreamEdgeDate, cps, ucas, cfus); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - return true; - } - - @Override public boolean execRegression() - { - try { - if (null == (_zc = org.drip.state.curve.DerivedZeroRate.FromBaseCurve (2, "30/360", - _dc.currency(), true, _lsCouponPeriod, _lsCouponPeriod.get - (_lsCouponPeriod.size() - 1).endDate(), _dtStart.julian(), _dtStart.addDays - (2).julian(), _dc, s_dblZSpread, null, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new org.drip.spline.basis.PolynomialFunctionSetParams (4), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), new - org.drip.spline.params.ResponseScalingShapeControl (true, new - org.drip.function.r1tor1.QuadraticRationalShapeControl (0.)), - null)))) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - return true; - } - }); - - /* - * Get Zero Discount Factor unit regressor - implements the pre-regression, the post-regression, - * and the actual regression functionality of the UnitRegressorExecutor class. - */ - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("getZeroDF", - _strRegressionScenario) - { - private static final int NUM_DF_NODES = 30; - - private int _aiDate[] = new int[NUM_DF_NODES]; - private double _adblDiscFactor[] = new double[NUM_DF_NODES]; - - @Override public boolean preRegression() - { - org.drip.analytics.date.JulianDate dtStart = - org.drip.analytics.date.DateUtil.CreateFromYMD (2008, - org.drip.analytics.date.DateUtil.SEPTEMBER, 25); - - for (int i = 0; i < NUM_DF_NODES; ++i) - _aiDate[i] = dtStart.addMonths (6 * i + 6).julian(); - - return true; - } - - @Override public boolean execRegression() - { - try { - for (int i = 0; i < NUM_DF_NODES; ++i) - _adblDiscFactor[i] = _zc.df (_aiDate[i]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - return true; - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - try { - for (int i = 0; i < NUM_DF_NODES; ++i) - rnvd.set ("ZeroDF[" + new org.drip.analytics.date.JulianDate (_aiDate[i]) + - "]", "" + _adblDiscFactor[i]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - return true; - } - }); - - /* - * Get Zero Rate unit regressor - implements the pre-regression, the post-regression, and the - * actual regression functionality of the UnitRegressorExecutor class. - */ - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("getZeroRate", - _strRegressionScenario) - { - private static final int NUM_DF_NODES = 30; - - private int _aiDate[] = new int[NUM_DF_NODES]; - private double _adblRate[] = new double[NUM_DF_NODES]; - - @Override public boolean preRegression() - { - org.drip.analytics.date.JulianDate dtStart = - org.drip.analytics.date.DateUtil.CreateFromYMD (2008, - org.drip.analytics.date.DateUtil.SEPTEMBER, 25); - - for (int i = 0; i < NUM_DF_NODES; ++i) - _aiDate[i] = dtStart.addMonths (6 * i + 6).julian(); - - return true; - } - - @Override public boolean execRegression() - { - try { - for (int i = 0; i < NUM_DF_NODES; ++i) - _adblRate[i] = _zc.zeroRate (_aiDate[i]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - return true; - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - try { - for (int i = 0; i < NUM_DF_NODES; ++i) - rnvd.set ("ZeroRate[" + new org.drip.analytics.date.JulianDate (_aiDate[i]) + - "]", "" + _adblRate[i]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - return true; - } - }); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - return true; - } - - @Override public java.util.List getRegressorSet() - { - return _setRegressors; - } - - @Override public java.lang.String getSetName() - { - return _strRegressionScenario; - } -} diff --git a/org/drip/regression/curvejacobian/CashJacobianRegressorSet.java b/org/drip/regression/curvejacobian/CashJacobianRegressorSet.java deleted file mode 100644 index e4dc0ae..0000000 --- a/org/drip/regression/curvejacobian/CashJacobianRegressorSet.java +++ /dev/null @@ -1,179 +0,0 @@ - -package org.drip.regression.curvejacobian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * CashJacobianRegressorSet implements the regression analysis set for the Cash product related Sensitivity - * Jacobians. Specifically, it computes the PVDF micro-Jack. - * - * @author Lakshmi Krishnamurthy - */ - -public class CashJacobianRegressorSet implements org.drip.regression.core.RegressorSet { - private java.lang.String _strRegressionScenario = - "org.drip.analytics.definition.CashDiscountCurve.CompPVDFJacobian"; - - private java.util.List _setRegressors = new - java.util.ArrayList(); - - @Override public java.util.List getRegressorSet() - { - return _setRegressors; - } - - @Override public boolean setupRegressors() - { - try { - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("CashJacobian", - _strRegressionScenario) { - org.drip.analytics.date.JulianDate dtStart = null; - org.drip.state.discount.MergedDiscountForwardCurve dcCash = null; - org.drip.quant.calculus.WengertJacobian wjPVDF = null; - org.drip.quant.calculus.WengertJacobian aWJComp[] = null; - org.drip.product.definition.CalibratableComponent aCompCalib[] = null; - - @Override public boolean preRegression() { - int NUM_CASH_INSTR = 7; - int aiDate[] = new int[NUM_CASH_INSTR]; - double adblRate[] = new double[NUM_CASH_INSTR]; - double adblCompCalibValue[] = new double[NUM_CASH_INSTR]; - aWJComp = new org.drip.quant.calculus.WengertJacobian[NUM_CASH_INSTR]; - java.lang.String astrCalibMeasure[] = new java.lang.String[NUM_CASH_INSTR]; - aCompCalib = new - org.drip.product.definition.CalibratableComponent[NUM_CASH_INSTR]; - - if (null == (dtStart = org.drip.analytics.date.DateUtil.CreateFromYMD (2011, 4, 6))) - return false; - - aiDate[0] = dtStart.addDays (3).julian(); // ON - - aiDate[1] = dtStart.addDays (4).julian(); // 1D (TN) - - aiDate[2] = dtStart.addDays (9).julian(); // 1W - - aiDate[3] = dtStart.addDays (16).julian(); // 2W - - aiDate[4] = dtStart.addDays (32).julian(); // 1M - - aiDate[5] = dtStart.addDays (62).julian(); // 2M - - aiDate[6] = dtStart.addDays (92).julian(); // 3M - - adblCompCalibValue[0] = .0013; - adblCompCalibValue[1] = .0017; - adblCompCalibValue[2] = .0017; - adblCompCalibValue[3] = .0018; - adblCompCalibValue[4] = .0020; - adblCompCalibValue[5] = .0023; - adblCompCalibValue[6] = .0026; - - for (int i = 0; i < NUM_CASH_INSTR; ++i) { - adblRate[i] = 0.01; - astrCalibMeasure[i] = "Rate"; - - try { - aCompCalib[i] = org.drip.product.creator.SingleStreamComponentBuilder.Deposit - (dtStart.addDays (2), new org.drip.analytics.date.JulianDate (aiDate[i]), - org.drip.state.identifier.ForwardLabel.Create ("USD", "3M")); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return null != (dcCash = - org.drip.state.creator.ScenarioDiscountCurveBuilder.NonlinearBuild (dtStart, "USD", - aCompCalib, adblCompCalibValue, astrCalibMeasure, null)); - } - - @Override public boolean execRegression() - { - for (int i = 0; i < aCompCalib.length; ++i) { - try { - if (null == (aWJComp[i] = aCompCalib[i].jackDDirtyPVDManifestMeasure (new - org.drip.param.valuation.ValuationParams (dtStart, dtStart, "USD"), null, - org.drip.param.creator.MarketParamsBuilder.Create (dcCash, null, - null, null, null, null, null), null))) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return null != (wjPVDF = dcCash.compJackDPVDManifestMeasure (dtStart)); - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - for (int i = 0; i < aCompCalib.length; ++i) { - if (!rnvd.set ("PVDFMicroJack_" + aCompCalib[i].name(), aWJComp[i].displayString())) - return false; - } - - return rnvd.set ("CompPVDFJacobian", wjPVDF.displayString()); - } - }); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return true; - } - - @Override public java.lang.String getSetName() - { - return _strRegressionScenario; - } -} diff --git a/org/drip/regression/curvejacobian/CurveJacobianRegressionEngine.java b/org/drip/regression/curvejacobian/CurveJacobianRegressionEngine.java deleted file mode 100644 index 58e1c50..0000000 --- a/org/drip/regression/curvejacobian/CurveJacobianRegressionEngine.java +++ /dev/null @@ -1,105 +0,0 @@ - -package org.drip.regression.curvejacobian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * CurveJacobianRegressionEngine implements the RegressionEngine for the curve Jacobian regression. It adds - * the CashJacobianRegressorSet, the EDFJacobianRegressorSet, the IRSJacobianRegressorSet, and the - * DiscountCurveJacobianRegressorSet, and launches the regression engine. - * - * @author Lakshmi Krishnamurthy - */ - -public class CurveJacobianRegressionEngine extends org.drip.regression.core.RegressionEngine { - - /** - * CurveJacobianRegressionEngine constructor - * - * @param iNumRuns Number of regression runs - * @param iRegressionDetail Detailed desired of the regression run - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public CurveJacobianRegressionEngine ( - final int iNumRuns, - final int iRegressionDetail) - throws java.lang.Exception - { - super (iNumRuns, iRegressionDetail); - } - - @Override public boolean initRegressionEnv() - { - org.drip.service.env.EnvManager.InitEnv (""); - - return super.initRegressionEnv(); - } - - public static void main ( - final java.lang.String[] astrArgs) - throws java.lang.Exception - { - CurveJacobianRegressionEngine cjre = new CurveJacobianRegressionEngine (10, - org.drip.regression.core.RegressionEngine.REGRESSION_DETAIL_MODULE_UNIT_DECOMPOSED | - org.drip.regression.core.RegressionEngine.REGRESSION_DETAIL_STATS); - - cjre.addRegressorSet (new org.drip.regression.curvejacobian.CashJacobianRegressorSet()); - - cjre.addRegressorSet (new org.drip.regression.curvejacobian.EDFJacobianRegressorSet()); - - cjre.addRegressorSet (new org.drip.regression.curvejacobian.IRSJacobianRegressorSet()); - - cjre.addRegressorSet (new org.drip.regression.curvejacobian.DiscountCurveJacobianRegressorSet()); - - cjre.launch(); - } -} diff --git a/org/drip/regression/curvejacobian/DiscountCurveJacobianRegressorSet.java b/org/drip/regression/curvejacobian/DiscountCurveJacobianRegressorSet.java deleted file mode 100644 index 8da3aab..0000000 --- a/org/drip/regression/curvejacobian/DiscountCurveJacobianRegressorSet.java +++ /dev/null @@ -1,259 +0,0 @@ - -package org.drip.regression.curvejacobian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * DiscountCurveJacobianRegressorSet implements the regression analysis for the full discount curve (built - * from cash/future/swap) Sensitivity Jacobians. Specifically, it computes the PVDF micro-Jack. - * - * @author Lakshmi Krishnamurthy - */ - -public class DiscountCurveJacobianRegressorSet implements org.drip.regression.core.RegressorSet { - private java.lang.String _strRegressionScenario = - "org.drip.analytics.definition.IRSDiscountCurve.CompPVDFJacobian"; - - private java.util.List _setRegressors = new - java.util.ArrayList(); - - @Override public java.util.List getRegressorSet() - { - return _setRegressors; - } - - @Override public boolean setupRegressors() - { - try { - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("DiscountCurveJacobian", - _strRegressionScenario) - { - org.drip.analytics.date.JulianDate dtStart = null; - org.drip.state.discount.MergedDiscountForwardCurve dcIRS = null; - org.drip.quant.calculus.WengertJacobian wjPVDF = null; - org.drip.quant.calculus.WengertJacobian aWJComp[] = null; - org.drip.product.definition.CalibratableComponent aCompCalib[] = null; - - org.drip.param.market.LatentStateFixingsContainer lsfc = new - org.drip.param.market.LatentStateFixingsContainer(); - - @Override public boolean preRegression() - { - int NUM_DC_INSTR = 15; - int aiDate[] = new int[NUM_DC_INSTR]; - double adblRate[] = new double[NUM_DC_INSTR]; - double adblCompCalibValue[] = new double[NUM_DC_INSTR]; - aWJComp = new org.drip.quant.calculus.WengertJacobian[NUM_DC_INSTR]; - java.lang.String astrCalibMeasure[] = new java.lang.String[NUM_DC_INSTR]; - aCompCalib = new org.drip.product.definition.CalibratableComponent[NUM_DC_INSTR]; - - if (null == (dtStart = org.drip.analytics.date.DateUtil.CreateFromYMD (2011, 4, 6))) - return false; - - aiDate[0] = dtStart.addDays ((int)(365.25 * 1 + 2)).julian(); // 4Y - - aiDate[1] = dtStart.addDays ((int)(365.25 * 2 + 2)).julian(); // 5Y - - aiDate[2] = dtStart.addDays ((int)(365.25 * 3 + 2)).julian(); // 6Y - - aiDate[3] = dtStart.addDays ((int)(365.25 * 7 + 2)).julian(); // 7Y - - aiDate[4] = dtStart.addDays ((int)(365.25 * 8 + 2)).julian(); // 8Y - - aiDate[5] = dtStart.addDays ((int)(365.25 * 9 + 2)).julian(); // 9Y - - aiDate[6] = dtStart.addDays ((int)(365.25 * 10 + 2)).julian(); // 10Y - - aiDate[7] = dtStart.addDays ((int)(365.25 * 11 + 2)).julian(); // 11Y - - aiDate[8] = dtStart.addDays ((int)(365.25 * 12 + 2)).julian(); // 12Y - - aiDate[9] = dtStart.addDays ((int)(365.25 * 15 + 2)).julian(); // 15Y - - aiDate[10] = dtStart.addDays ((int)(365.25 * 20 + 2)).julian(); // 20Y - - aiDate[11] = dtStart.addDays ((int)(365.25 * 25 + 2)).julian(); // 25Y - - aiDate[12] = dtStart.addDays ((int)(365.25 * 30 + 2)).julian(); // 30Y - - aiDate[13] = dtStart.addDays ((int)(365.25 * 40 + 2)).julian(); // 40Y - - aiDate[14] = dtStart.addDays ((int)(365.25 * 50 + 2)).julian(); // 50Y - - adblCompCalibValue[0] = .0166; - adblCompCalibValue[1] = .0206; - adblCompCalibValue[2] = .0241; - adblCompCalibValue[3] = .0269; - adblCompCalibValue[4] = .0292; - adblCompCalibValue[5] = .0311; - adblCompCalibValue[6] = .0326; - adblCompCalibValue[7] = .0340; - adblCompCalibValue[8] = .0351; - adblCompCalibValue[9] = .0375; - adblCompCalibValue[10] = .0393; - adblCompCalibValue[11] = .0402; - adblCompCalibValue[12] = .0407; - adblCompCalibValue[13] = .0409; - adblCompCalibValue[14] = .0409; - org.drip.param.period.CompositePeriodSetting cpsFixed = null; - org.drip.param.period.CompositePeriodSetting cpsFloating = null; - org.drip.param.period.UnitCouponAccrualSetting ucasFixed = null; - org.drip.param.period.ComposableFixedUnitSetting cfusFixed = null; - org.drip.param.period.ComposableFloatingUnitSetting cfusFloating = null; - - try { - ucasFixed = new org.drip.param.period.UnitCouponAccrualSetting (2, "Act/360", false, - "Act/360", false, "USD", true, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - cfusFloating = new org.drip.param.period.ComposableFloatingUnitSetting ("3M", - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, org.drip.state.identifier.ForwardLabel.Standard ("USD-3M"), - org.drip.analytics.support.CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0.); - - cfusFixed = new org.drip.param.period.ComposableFixedUnitSetting ("6M", - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, 0., 0., "USD"); - - cpsFloating = new org.drip.param.period.CompositePeriodSetting (4, "3M", "USD", null, - -1., null, null, null, null); - - cpsFixed = new org.drip.param.period.CompositePeriodSetting (2, "6M", "USD", null, - 1., null, null, null, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - for (int i = 0; i < NUM_DC_INSTR; ++i) { - adblRate[i] = 0.01; - astrCalibMeasure[i] = "Rate"; - - try { - java.util.List lsFixedStreamEdgeDate = - org.drip.analytics.support.CompositePeriodBuilder.BackwardEdgeDates (dtStart, - new org.drip.analytics.date.JulianDate (aiDate[i]), "6M", null, - org.drip.analytics.support.CompositePeriodBuilder.SHORT_STUB); - - java.util.List lsFloatingStreamEdgeDate = - org.drip.analytics.support.CompositePeriodBuilder.BackwardEdgeDates (dtStart, - new org.drip.analytics.date.JulianDate (aiDate[i]), "3M", null, - org.drip.analytics.support.CompositePeriodBuilder.SHORT_STUB); - - org.drip.product.rates.Stream floatingStream = new org.drip.product.rates.Stream - (org.drip.analytics.support.CompositePeriodBuilder.FloatingCompositeUnit - (lsFloatingStreamEdgeDate, cpsFloating, cfusFloating)); - - org.drip.product.rates.Stream fixedStream = new org.drip.product.rates.Stream - (org.drip.analytics.support.CompositePeriodBuilder.FixedCompositeUnit - (lsFixedStreamEdgeDate, cpsFixed, ucasFixed, cfusFixed)); - - - aCompCalib[i] = new org.drip.product.rates.FixFloatComponent (fixedStream, - floatingStream, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - lsfc.add (dtStart.addDays (2), org.drip.state.identifier.ForwardLabel.Standard - ("USD-6M"), 0.0042); - - return null != (dcIRS = - org.drip.state.creator.ScenarioDiscountCurveBuilder.NonlinearBuild (dtStart, "USD", - aCompCalib, adblCompCalibValue, astrCalibMeasure, lsfc)); - } - - @Override public boolean execRegression() - { - for (int i = 0; i < aCompCalib.length; ++i) { - try { - if (null == (aWJComp[i] = aCompCalib[i].jackDDirtyPVDManifestMeasure (new - org.drip.param.valuation.ValuationParams (dtStart, dtStart, "USD"), null, - org.drip.param.creator.MarketParamsBuilder.Create (dcIRS, null, null, - null, null, null, lsfc), null))) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return null != (wjPVDF = dcIRS.compJackDPVDManifestMeasure (dtStart)); - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - for (int i = 0; i < aCompCalib.length; ++i) { - if (!rnvd.set ("PVDFMicroJack_" + aCompCalib[i].name(), aWJComp[i].displayString())) - return false; - } - - return rnvd.set ("CompPVDFJacobian", wjPVDF.displayString()); - } - }); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return true; - } - - @Override public java.lang.String getSetName() - { - return _strRegressionScenario; - } -} diff --git a/org/drip/regression/curvejacobian/EDFJacobianRegressorSet.java b/org/drip/regression/curvejacobian/EDFJacobianRegressorSet.java deleted file mode 100644 index 4c29ba7..0000000 --- a/org/drip/regression/curvejacobian/EDFJacobianRegressorSet.java +++ /dev/null @@ -1,164 +0,0 @@ - -package org.drip.regression.curvejacobian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * EDFJacobianRegressorSet implements the regression analysis set for the EDF product related Sensitivity - * Jacobians. Specifically, it computes the PVDF micro-Jack. - * - * @author Lakshmi Krishnamurthy - */ - -public class EDFJacobianRegressorSet implements org.drip.regression.core.RegressorSet { - private java.lang.String _strRegressionScenario = - "org.drip.analytics.definition.EDFDiscountCurve.CompPVDFJacobian"; - - private java.util.List _setRegressors = new - java.util.ArrayList(); - - @Override public java.util.List getRegressorSet() - { - return _setRegressors; - } - - @Override public boolean setupRegressors() - { - try { - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("EDFJacobian", - _strRegressionScenario) { - org.drip.analytics.date.JulianDate dtStart = null; - org.drip.state.discount.MergedDiscountForwardCurve dcEDF = null; - org.drip.quant.calculus.WengertJacobian wjPVDF = null; - org.drip.quant.calculus.WengertJacobian aWJComp[] = null; - org.drip.product.definition.CalibratableComponent aCompCalib[] = null; - - @Override public boolean preRegression() - { - int NUM_DC_INSTR = 8; - int aiDate[] = new int[NUM_DC_INSTR]; - double adblRate[] = new double[NUM_DC_INSTR]; - double adblCompCalibValue[] = new double[NUM_DC_INSTR]; - aWJComp = new org.drip.quant.calculus.WengertJacobian[NUM_DC_INSTR]; - java.lang.String astrCalibMeasure[] = new java.lang.String[NUM_DC_INSTR]; - aCompCalib = new - org.drip.product.definition.CalibratableComponent[NUM_DC_INSTR]; - - dtStart = org.drip.analytics.date.DateUtil.CreateFromYMD (2011, 4, 6); - - adblCompCalibValue[0] = .0027; - adblCompCalibValue[1] = .0032; - adblCompCalibValue[2] = .0041; - adblCompCalibValue[3] = .0054; - adblCompCalibValue[4] = .0077; - adblCompCalibValue[5] = .0104; - adblCompCalibValue[6] = .0134; - adblCompCalibValue[7] = .0160; - org.drip.analytics.date.JulianDate dtEDFStart = dtStart; - - org.drip.product.definition.CalibratableComponent[] aEDF = - org.drip.product.creator.SingleStreamComponentBuilder.ForwardRateFuturesPack - (dtStart, 8, "USD"); - - for (int i = 0; i < NUM_DC_INSTR; ++i) { - adblRate[i] = 0.01; - aCompCalib[i] = aEDF[i]; - astrCalibMeasure[i] = "Rate"; - - aiDate[i] = dtEDFStart.addDays ((i + 1) * 91).julian(); - } - - return null != (dcEDF = - org.drip.state.creator.ScenarioDiscountCurveBuilder.NonlinearBuild (dtStart, "USD", - aCompCalib, adblCompCalibValue, astrCalibMeasure, null)); - } - - @Override public boolean execRegression() - { - for (int i = 0; i < aCompCalib.length; ++i) { - try { - if (null == (aWJComp[i] = aCompCalib[i].jackDDirtyPVDManifestMeasure (new - org.drip.param.valuation.ValuationParams (dtStart, dtStart, "USD"), null, - org.drip.param.creator.MarketParamsBuilder.Create (dcEDF, null, - null, null, null, null, null), null))) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return null != (wjPVDF = dcEDF.compJackDPVDManifestMeasure (dtStart)); - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - for (int i = 0; i < aCompCalib.length; ++i) { - if (!rnvd.set ("PVDFMicroJack_" + aCompCalib[i].name(), aWJComp[i].displayString())) - return false; - } - - return rnvd.set ("CompPVDFJacobian", "" + wjPVDF.displayString()); - } - }); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return true; - } - - @Override public java.lang.String getSetName() - { - return _strRegressionScenario; - } -} diff --git a/org/drip/regression/curvejacobian/IRSJacobianRegressorSet.java b/org/drip/regression/curvejacobian/IRSJacobianRegressorSet.java deleted file mode 100644 index 37441f5..0000000 --- a/org/drip/regression/curvejacobian/IRSJacobianRegressorSet.java +++ /dev/null @@ -1,256 +0,0 @@ - -package org.drip.regression.curvejacobian; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * IRSJacobianRegressorSet implements the regression analysis set for the IRS product related Sensitivity - * Jacobians. Specifically, it computes the PVDF micro-Jack. - * - * @author Lakshmi Krishnamurthy - */ - -public class IRSJacobianRegressorSet implements org.drip.regression.core.RegressorSet { - private java.lang.String _strRegressionScenario = - "org.drip.analytics.definition.IRSDiscountCurve.CompPVDFJacobian"; - - private java.util.List _setRegressors = new - java.util.ArrayList(); - - @Override public java.util.List getRegressorSet() - { - return _setRegressors; - } - - @Override public boolean setupRegressors() - { - try { - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("IRSJacobian", - _strRegressionScenario) { - org.drip.analytics.date.JulianDate dtStart = null; - org.drip.state.discount.MergedDiscountForwardCurve dcIRS = null; - org.drip.quant.calculus.WengertJacobian wjPVDF = null; - org.drip.quant.calculus.WengertJacobian aWJComp[] = null; - org.drip.product.definition.CalibratableComponent aCompCalib[] = null; - - org.drip.param.market.LatentStateFixingsContainer lsfc = new - org.drip.param.market.LatentStateFixingsContainer(); - - @Override public boolean preRegression() - { - int NUM_DC_INSTR = 15; - int aiDate[] = new int[NUM_DC_INSTR]; - double adblRate[] = new double[NUM_DC_INSTR]; - double adblCompCalibValue[] = new double[NUM_DC_INSTR]; - aWJComp = new org.drip.quant.calculus.WengertJacobian[NUM_DC_INSTR]; - java.lang.String astrCalibMeasure[] = new java.lang.String[NUM_DC_INSTR]; - aCompCalib = new org.drip.product.definition.CalibratableComponent[NUM_DC_INSTR]; - - if (null == (dtStart = org.drip.analytics.date.DateUtil.CreateFromYMD (2011, 4, 6))) - return false; - - aiDate[0] = dtStart.addDays ((int)(365.25 * 1 + 2)).julian(); // 4Y - - aiDate[1] = dtStart.addDays ((int)(365.25 * 2 + 2)).julian(); // 5Y - - aiDate[2] = dtStart.addDays ((int)(365.25 * 3 + 2)).julian(); // 6Y - - aiDate[3] = dtStart.addDays ((int)(365.25 * 7 + 2)).julian(); // 7Y - - aiDate[4] = dtStart.addDays ((int)(365.25 * 8 + 2)).julian(); // 8Y - - aiDate[5] = dtStart.addDays ((int)(365.25 * 9 + 2)).julian(); // 9Y - - aiDate[6] = dtStart.addDays ((int)(365.25 * 10 + 2)).julian(); // 10Y - - aiDate[7] = dtStart.addDays ((int)(365.25 * 11 + 2)).julian(); // 11Y - - aiDate[8] = dtStart.addDays ((int)(365.25 * 12 + 2)).julian(); // 12Y - - aiDate[9] = dtStart.addDays ((int)(365.25 * 15 + 2)).julian(); // 15Y - - aiDate[10] = dtStart.addDays ((int)(365.25 * 20 + 2)).julian(); // 20Y - - aiDate[11] = dtStart.addDays ((int)(365.25 * 25 + 2)).julian(); // 25Y - - aiDate[12] = dtStart.addDays ((int)(365.25 * 30 + 2)).julian(); // 30Y - - aiDate[13] = dtStart.addDays ((int)(365.25 * 40 + 2)).julian(); // 40Y - - aiDate[14] = dtStart.addDays ((int)(365.25 * 50 + 2)).julian(); // 50Y - - adblCompCalibValue[0] = .0166; - adblCompCalibValue[1] = .0206; - adblCompCalibValue[2] = .0241; - adblCompCalibValue[3] = .0269; - adblCompCalibValue[4] = .0292; - adblCompCalibValue[5] = .0311; - adblCompCalibValue[6] = .0326; - adblCompCalibValue[7] = .0340; - adblCompCalibValue[8] = .0351; - adblCompCalibValue[9] = .0375; - adblCompCalibValue[10] = .0393; - adblCompCalibValue[11] = .0402; - adblCompCalibValue[12] = .0407; - adblCompCalibValue[13] = .0409; - adblCompCalibValue[14] = .0409; - org.drip.param.period.CompositePeriodSetting cpsFixed = null; - org.drip.param.period.CompositePeriodSetting cpsFloating = null; - org.drip.param.period.UnitCouponAccrualSetting ucasFixed = null; - org.drip.param.period.ComposableFixedUnitSetting cfusFixed = null; - org.drip.param.period.ComposableFloatingUnitSetting cfusFloating = null; - - try { - ucasFixed = new org.drip.param.period.UnitCouponAccrualSetting (2, "Act/360", false, - "Act/360", false, "USD", true, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - cfusFloating = new org.drip.param.period.ComposableFloatingUnitSetting ("3M", - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, org.drip.state.identifier.ForwardLabel.Standard ("USD-3M"), - org.drip.analytics.support.CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0.); - - cfusFixed = new org.drip.param.period.ComposableFixedUnitSetting ("6M", - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, 0., 0., "USD"); - - cpsFloating = new org.drip.param.period.CompositePeriodSetting (4, "3M", "USD", null, - -1., null, null, null, null); - - cpsFixed = new org.drip.param.period.CompositePeriodSetting (2, "6M", "USD", null, - 1., null, null, null, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - for (int i = 0; i < NUM_DC_INSTR; ++i) { - adblRate[i] = 0.01; - astrCalibMeasure[i] = "Rate"; - - try { - java.util.List lsFixedStreamEdgeDate = - org.drip.analytics.support.CompositePeriodBuilder.BackwardEdgeDates (dtStart, - new org.drip.analytics.date.JulianDate (aiDate[i]), "6M", null, - org.drip.analytics.support.CompositePeriodBuilder.SHORT_STUB); - - java.util.List lsFloatingStreamEdgeDate = - org.drip.analytics.support.CompositePeriodBuilder.BackwardEdgeDates (dtStart, - new org.drip.analytics.date.JulianDate (aiDate[i]), "3M", null, - org.drip.analytics.support.CompositePeriodBuilder.SHORT_STUB); - - org.drip.product.rates.Stream floatingStream = new org.drip.product.rates.Stream - (org.drip.analytics.support.CompositePeriodBuilder.FloatingCompositeUnit - (lsFloatingStreamEdgeDate, cpsFloating, cfusFloating)); - - org.drip.product.rates.Stream fixedStream = new org.drip.product.rates.Stream - (org.drip.analytics.support.CompositePeriodBuilder.FixedCompositeUnit - (lsFixedStreamEdgeDate, cpsFixed, ucasFixed, cfusFixed)); - - aCompCalib[i] = new org.drip.product.rates.FixFloatComponent (fixedStream, - floatingStream, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - lsfc.add (dtStart.addDays (2), org.drip.state.identifier.ForwardLabel.Standard - ("USD-6M"), 0.0042); - - return null != (dcIRS = - org.drip.state.creator.ScenarioDiscountCurveBuilder.NonlinearBuild (dtStart, "USD", - aCompCalib, adblCompCalibValue, astrCalibMeasure, lsfc)); - } - - @Override public boolean execRegression() - { - for (int i = 0; i < aCompCalib.length; ++i) { - try { - if (null == (aWJComp[i] = aCompCalib[i].jackDDirtyPVDManifestMeasure (new - org.drip.param.valuation.ValuationParams (dtStart, dtStart, "USD"), null, - org.drip.param.creator.MarketParamsBuilder.Create (dcIRS, null, null, - null, null, null, lsfc), null))) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return null != (wjPVDF = dcIRS.compJackDPVDManifestMeasure (dtStart)); - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) { - for (int i = 0; i < aCompCalib.length; ++i) { - if (!rnvd.set ("PVDFMicroJack_" + aCompCalib[i].name(), aWJComp[i].displayString())) - return false; - } - - return rnvd.set ("CompPVDFJacobian", wjPVDF.displayString()); - } - }); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return true; - } - - @Override public java.lang.String getSetName() - { - return _strRegressionScenario; - } -} diff --git a/org/drip/regression/fixedpointfinder/BracketingRegressorSet.java b/org/drip/regression/fixedpointfinder/BracketingRegressorSet.java deleted file mode 100644 index 186035a..0000000 --- a/org/drip/regression/fixedpointfinder/BracketingRegressorSet.java +++ /dev/null @@ -1,304 +0,0 @@ - -package org.drip.regression.fixedpointfinder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * BracketingRegressorSet implements regression run for the Primitive Bracketing Fixed Point Search Method. - * It implements the following 4 primitive bracketing schemes: Bisection, False Position, Quadratic, and - * Inverse Quadratic. - * - * @author Lakshmi Krishnamurthy - */ - -public class BracketingRegressorSet implements org.drip.regression.core.RegressorSet { - private org.drip.function.definition.R1ToR1 _of = null; - private java.lang.String _strRegressionScenario = "org.drip.math.solver1D.FixedPointFinderPrimitive"; - - private java.util.List _setRegressors = new - java.util.ArrayList(); - - public BracketingRegressorSet() - { - _of = new org.drip.function.definition.R1ToR1 (null) - { - public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - if (java.lang.Double.isNaN (dblVariate)) - throw new java.lang.Exception - ("FixedPointFinderRegressorOF.evalTarget => Invalid variate!"); - - /* return java.lang.Math.cos (dblVariate) - dblVariate * dblVariate * dblVariate; - - return dblVariate * dblVariate * dblVariate - 3. * dblVariate * dblVariate + 2. * - dblVariate; - - return dblVariate * dblVariate * dblVariate + 4. * dblVariate + 4.; - - return 32. * dblVariate * dblVariate * dblVariate * dblVariate * dblVariate * dblVariate - - 48. * dblVariate * dblVariate * dblVariate * dblVariate + 18. * dblVariate * - dblVariate - 1.; */ - - return 1. + 3. * dblVariate - 2. * java.lang.Math.sin (dblVariate); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - return org.drip.quant.calculus.R1ToR1Integrator.Boole (this, dblBegin, dblEnd); - } - }; - } - - @Override public boolean setupRegressors() - { - try { - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor - ("BisectionFixedPointFinder", _strRegressionScenario) - { - org.drip.function.r1tor1solver.FixedPointFinderOutput fpfopBisect = null; - org.drip.function.r1tor1solver.FixedPointFinderBracketing fpfbBisect = null; - - @Override public boolean preRegression() - { - try { - fpfbBisect = new org.drip.function.r1tor1solver.FixedPointFinderBracketing (0., _of, null, - org.drip.function.r1tor1solver.VariateIteratorPrimitive.BISECTION, true); - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - @Override public boolean execRegression() - { - if (null == (fpfopBisect = fpfbBisect.findRoot())) return false; - - return true; - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - rnvd.set ("FixedPoint", "" + fpfopBisect.getRoot()); - - return true; - } - }); - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor - ("FalsePositionFixedPointFinder", _strRegressionScenario) - { - org.drip.function.r1tor1solver.FixedPointFinderOutput fpfopFalsePosition = null; - org.drip.function.r1tor1solver.FixedPointFinderBracketing fpfbFalsePosition = null; - - @Override public boolean preRegression() - { - try { - fpfbFalsePosition = new org.drip.function.r1tor1solver.FixedPointFinderBracketing (0., _of, - null, org.drip.function.r1tor1solver.VariateIteratorPrimitive.FALSE_POSITION, true); - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - @Override public boolean execRegression() - { - if (null == (fpfopFalsePosition = fpfbFalsePosition.findRoot())) return false; - - return true; - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - rnvd.set ("FixedPoint", "" + fpfopFalsePosition.getRoot()); - - return true; - } - }); - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor - ("QuadraticFixedPointFinder", _strRegressionScenario) { - org.drip.function.r1tor1solver.FixedPointFinderOutput fpfopQuadratic = null; - org.drip.function.r1tor1solver.FixedPointFinderBracketing fpfbQuadratic = null; - - @Override public boolean preRegression() - { - try { - fpfbQuadratic = new org.drip.function.r1tor1solver.FixedPointFinderBracketing (0., _of, - null, org.drip.function.r1tor1solver.VariateIteratorPrimitive.QUADRATIC_INTERPOLATION, - true); - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - @Override public boolean execRegression() - { - if (null == (fpfopQuadratic = fpfbQuadratic.findRoot())) return false; - - return true; - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - rnvd.set ("FixedPoint", "" + fpfopQuadratic.getRoot()); - - return true; - } - }); - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor - ("InverseQuadraticFixedPointFinder", _strRegressionScenario) - { - org.drip.function.r1tor1solver.FixedPointFinderOutput fpfopInverseQuadratic = null; - org.drip.function.r1tor1solver.FixedPointFinderBracketing fpfbInverseQuadratic = null; - - @Override public boolean preRegression() - { - try { - fpfbInverseQuadratic = new org.drip.function.r1tor1solver.FixedPointFinderBracketing (0., - _of, null, - org.drip.function.r1tor1solver.VariateIteratorPrimitive.INVERSE_QUADRATIC_INTERPOLATION, - true); - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - @Override public boolean execRegression() - { - if (null == (fpfopInverseQuadratic = fpfbInverseQuadratic.findRoot())) return false; - - return true; - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - rnvd.set ("FixedPoint", "" + fpfopInverseQuadratic.getRoot()); - - return true; - } - }); - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor - ("RidderFixedPointFinder", _strRegressionScenario) - { - org.drip.function.r1tor1solver.FixedPointFinderOutput fpfopRidder = null; - org.drip.function.r1tor1solver.FixedPointFinderBracketing fpfbRidder = null; - - @Override public boolean preRegression() - { - try { - fpfbRidder = new org.drip.function.r1tor1solver.FixedPointFinderBracketing (0., _of, null, - org.drip.function.r1tor1solver.VariateIteratorPrimitive.RIDDER, true); - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - @Override public boolean execRegression() - { - if (null == (fpfopRidder = fpfbRidder.findRoot())) return false; - - return true; - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) { - rnvd.set ("FixedPoint", "" + fpfopRidder.getRoot()); - - return true; - } - }); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return true; - } - - @Override public java.util.List getRegressorSet() - { - return _setRegressors; - } - - @Override public java.lang.String getSetName() - { - return _strRegressionScenario; - } -} diff --git a/org/drip/regression/fixedpointfinder/CompoundBracketingRegressorSet.java b/org/drip/regression/fixedpointfinder/CompoundBracketingRegressorSet.java deleted file mode 100644 index 90153e6..0000000 --- a/org/drip/regression/fixedpointfinder/CompoundBracketingRegressorSet.java +++ /dev/null @@ -1,192 +0,0 @@ - -package org.drip.regression.fixedpointfinder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * CompoundBracketingRegressorSet implements regression run for the Compound Bracketing Fixed Point Search - * Method. It implements the following 2 compound bracketing schemes: Brent and Zheng. - * - * @author Lakshmi Krishnamurthy - */ - -public class CompoundBracketingRegressorSet implements org.drip.regression.core.RegressorSet { - private org.drip.function.definition.R1ToR1 _of = null; - private java.lang.String _strRegressionScenario = "org.drip.math.solver1D.FixedPointFinderCompound"; - - private java.util.List _setRegressors = new - java.util.ArrayList(); - - public CompoundBracketingRegressorSet() - { - _of = new org.drip.function.definition.R1ToR1 (null) - { - public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - if (java.lang.Double.isNaN (dblVariate)) - throw new java.lang.Exception - ("FixedPointFinderRegressorOF.evalTarget => Invalid variate!"); - - /* return java.lang.Math.cos (dblVariate) - dblVariate * dblVariate * dblVariate; - - return dblVariate * dblVariate * dblVariate - 3. * dblVariate * dblVariate + 2. * - dblVariate; - - return dblVariate * dblVariate * dblVariate + 4. * dblVariate + 4.; - - return 32. * dblVariate * dblVariate * dblVariate * dblVariate * dblVariate * dblVariate - - 48. * dblVariate * dblVariate * dblVariate * dblVariate + 18. * dblVariate * - dblVariate - 1.; */ - - return 1. + 3. * dblVariate - 2. * java.lang.Math.sin (dblVariate); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - return org.drip.quant.calculus.R1ToR1Integrator.Boole (this, dblBegin, dblEnd); - } - }; - } - - @Override public boolean setupRegressors() - { - try { - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("BrentFixedPointFinder", - _strRegressionScenario) - { - org.drip.function.r1tor1solver.FixedPointFinderBrent fpfbBrent = null; - org.drip.function.r1tor1solver.FixedPointFinderOutput fpfopBrent = null; - - @Override public boolean preRegression() - { - try { - fpfbBrent = new org.drip.function.r1tor1solver.FixedPointFinderBrent (0., _of, true); - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - @Override public boolean execRegression() - { - if (null == (fpfopBrent = fpfbBrent.findRoot())) return false; - - return true; - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - rnvd.set ("FixedPoint", "" + fpfopBrent.getRoot()); - - return true; - } - }); - - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor ("ZhengFixedPointFinder", - _strRegressionScenario) - { - org.drip.function.r1tor1solver.FixedPointFinderZheng fpfbZheng = null; - org.drip.function.r1tor1solver.FixedPointFinderOutput fpfopZheng = null; - - @Override public boolean preRegression() - { - try { - fpfbZheng = new org.drip.function.r1tor1solver.FixedPointFinderZheng (0., _of, true); - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - @Override public boolean execRegression() - { - if (null == (fpfopZheng = fpfbZheng.findRoot())) return false; - - return true; - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - rnvd.set ("FixedPoint", "" + fpfopZheng.getRoot()); - - return true; - } - }); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return true; - } - - @Override public java.util.List getRegressorSet() - { - return _setRegressors; - } - - @Override public java.lang.String getSetName() - { - return _strRegressionScenario; - } -} diff --git a/org/drip/regression/fixedpointfinder/FixedPointFinderRegressionEngine.java b/org/drip/regression/fixedpointfinder/FixedPointFinderRegressionEngine.java deleted file mode 100644 index 1f8f1f1..0000000 --- a/org/drip/regression/fixedpointfinder/FixedPointFinderRegressionEngine.java +++ /dev/null @@ -1,86 +0,0 @@ - -package org.drip.regression.fixedpointfinder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * FixedPointFinderRegressionEngine implements the RegressionEngine for the Fixed Point Finder regression. - * It adds the OpenRegressorSet, the BracketingRegressorSet, and the CompoundBracketingRegressorSet, and - * launches the regression engine. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixedPointFinderRegressionEngine extends org.drip.regression.core.RegressionEngine { - public FixedPointFinderRegressionEngine ( - final int iNumRuns, - final int iRegressionDetail) - throws java.lang.Exception - { - super (iNumRuns, iRegressionDetail); - } - - public static void main ( - final java.lang.String[] astrArgs) - throws java.lang.Exception - { - FixedPointFinderRegressionEngine fpfre = new FixedPointFinderRegressionEngine (10, - org.drip.regression.core.RegressionEngine.REGRESSION_DETAIL_STATS); - - fpfre.addRegressorSet (new org.drip.regression.fixedpointfinder.OpenRegressorSet()); - - fpfre.addRegressorSet (new org.drip.regression.fixedpointfinder.BracketingRegressorSet()); - - fpfre.addRegressorSet (new org.drip.regression.fixedpointfinder.CompoundBracketingRegressorSet()); - - fpfre.launch(); - } -} diff --git a/org/drip/regression/fixedpointfinder/OpenRegressorSet.java b/org/drip/regression/fixedpointfinder/OpenRegressorSet.java deleted file mode 100644 index 4083d7b..0000000 --- a/org/drip/regression/fixedpointfinder/OpenRegressorSet.java +++ /dev/null @@ -1,156 +0,0 @@ - -package org.drip.regression.fixedpointfinder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * OpenRegressorSet implements the regression run for the Open (i.e., Newton) Fixed Point Search Method. - * - * @author Lakshmi Krishnamurthy - */ - -public class OpenRegressorSet implements org.drip.regression.core.RegressorSet { - private org.drip.function.definition.R1ToR1 _of = null; - private java.lang.String _strRegressionScenario = "org.drip.math.solver1D.FixedPointFinderNewton"; - - private java.util.List _setRegressors = new - java.util.ArrayList(); - - public OpenRegressorSet() - { - _of = new org.drip.function.definition.R1ToR1 (null) - { - public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - if (java.lang.Double.isNaN (dblVariate)) - throw new java.lang.Exception - ("FixedPointFinderRegressorOF.evalTarget => Invalid variate!"); - - /* return java.lang.Math.cos (dblVariate) - dblVariate * dblVariate * dblVariate; - - return dblVariate * dblVariate * dblVariate - 3. * dblVariate * dblVariate + 2. * - dblVariate; - - return dblVariate * dblVariate * dblVariate + 4. * dblVariate + 4.; - - return 32. * dblVariate * dblVariate * dblVariate * dblVariate * dblVariate * dblVariate - - 48. * dblVariate * dblVariate * dblVariate * dblVariate + 18. * dblVariate * - dblVariate - 1.; */ - - return 1. + 3. * dblVariate - 2. * java.lang.Math.sin (dblVariate); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - return org.drip.quant.calculus.R1ToR1Integrator.Boole (this, dblBegin, dblEnd); - } - }; - } - - @Override public boolean setupRegressors() - { - try { - _setRegressors.add (new org.drip.regression.core.UnitRegressionExecutor - ("NewtonFixedPointFinder", _strRegressionScenario) - { - org.drip.function.r1tor1solver.FixedPointFinderNewton fpfbNewton = null; - org.drip.function.r1tor1solver.FixedPointFinderOutput fpfopNewton = null; - - @Override public boolean preRegression() - { - try { - fpfbNewton = new org.drip.function.r1tor1solver.FixedPointFinderNewton (0., _of, true); - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - @Override public boolean execRegression() - { - if (null == (fpfopNewton = fpfbNewton.findRoot())) return false; - - return true; - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - rnvd.set ("FixedPoint", "" + fpfopNewton.getRoot()); - - return true; - } - }); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return true; - } - - @Override public java.util.List getRegressorSet() - { - return _setRegressors; - } - - @Override public java.lang.String getSetName() - { - return _strRegressionScenario; - } -} diff --git a/org/drip/regression/spline/BasisSplineRegressionEngine.java b/org/drip/regression/spline/BasisSplineRegressionEngine.java deleted file mode 100644 index 8d7358a..0000000 --- a/org/drip/regression/spline/BasisSplineRegressionEngine.java +++ /dev/null @@ -1,80 +0,0 @@ - -package org.drip.regression.spline; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * BasisSplineRegressionEngine implements the RegressionEngine class for the basis spline functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class BasisSplineRegressionEngine extends org.drip.regression.core.RegressionEngine { - public BasisSplineRegressionEngine ( - final int iNumRuns, - final int iRegressionDetail) - throws java.lang.Exception - { - super (iNumRuns, iRegressionDetail); - } - - public static void main ( - final java.lang.String[] astrArgs) - throws java.lang.Exception - { - BasisSplineRegressionEngine bsre = new BasisSplineRegressionEngine (12, - org.drip.regression.core.RegressionEngine.REGRESSION_DETAIL_MODULE_UNIT_DECOMPOSED | - org.drip.regression.core.RegressionEngine.REGRESSION_DETAIL_STATS); - - bsre.addRegressorSet (new org.drip.regression.spline.BasisSplineRegressorSet()); - - bsre.launch(); - } -} diff --git a/org/drip/regression/spline/BasisSplineRegressor.java b/org/drip/regression/spline/BasisSplineRegressor.java deleted file mode 100644 index 1bdf351..0000000 --- a/org/drip/regression/spline/BasisSplineRegressor.java +++ /dev/null @@ -1,288 +0,0 @@ - -package org.drip.regression.spline; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * BasisSplineRegressor implements the custom basis spline regressor for the given basis spline. As part of - * the regression run, it executes the following: - * - Calibrate and compute the left and the right Jacobian. - * - Reset right node and re-run calibration. - * - Compute an intermediate value Jacobian. - * - * @author Lakshmi Krishnamurthy - */ - -public class BasisSplineRegressor extends org.drip.regression.core.UnitRegressionExecutor { - private java.lang.String _strName = ""; - private org.drip.spline.segment.LatentStateResponseModel _seg1 = null; - private org.drip.spline.segment.LatentStateResponseModel _seg2 = null; - private org.drip.quant.calculus.WengertJacobian _wjLeft = null; - private org.drip.quant.calculus.WengertJacobian _wjRight = null; - private org.drip.quant.calculus.WengertJacobian _wjValue = null; - - /** - * Create an instance of Polynomial BasisSplineRegressor - * - * @param strName Regressor Name - * @param strScenarioName Regressor Scenario Name - * @param iNumBasis Number of Basis Functions - * @param iCk Ck - * - * @return The BasisSplineRegressor Instance - */ - - public static final BasisSplineRegressor CreatePolynomialSplineRegressor ( - final java.lang.String strName, - final java.lang.String strScenarioName, - final int iNumBasis, - final int iCk) - { - try { - org.drip.spline.basis.FunctionSet fs = - org.drip.spline.basis.FunctionSetBuilder.PolynomialBasisSet (new - org.drip.spline.basis.PolynomialFunctionSetParams (iNumBasis)); - - return null == fs ? null : new BasisSplineRegressor (strName, strScenarioName, fs, iCk); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an instance of Bernstein Polynomial BasisSplineRegressor - * - * @param strName Regressor Name - * @param strScenarioName Regressor Scenario Name - * @param iNumBasis Number of Basis Functions - * @param iCk Ck - * - * @return The BasisSplineRegressor Instance - */ - - public static final BasisSplineRegressor CreateBernsteinPolynomialSplineRegressor ( - final java.lang.String strName, - final java.lang.String strScenarioName, - final int iNumBasis, - final int iCk) - { - try { - org.drip.spline.basis.FunctionSet fs = - org.drip.spline.basis.FunctionSetBuilder.BernsteinPolynomialBasisSet (new - org.drip.spline.basis.PolynomialFunctionSetParams (iNumBasis)); - - return null == fs ? null : new BasisSplineRegressor (strName, strScenarioName, fs, iCk); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an instance of Exponential BasisSplineRegressor - * - * @param strName Regressor Name - * @param strScenarioName Regressor Scenario Name - * @param dblTension Tension Parameter - * - * @return The BasisSplineRegressor Instance - */ - - public static final BasisSplineRegressor CreateExponentialTensionSplineRegressor ( - final java.lang.String strName, - final java.lang.String strScenarioName, - final double dblTension) - { - try { - org.drip.spline.basis.FunctionSet fs = - org.drip.spline.basis.FunctionSetBuilder.ExponentialTensionBasisSet (new - org.drip.spline.basis.ExponentialTensionSetParams (dblTension)); - - return null == fs ? null : new BasisSplineRegressor (strName, strScenarioName, fs, 2); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an instance of Hyperbolic BasisSplineRegressor - * - * @param strName Regressor Name - * @param strScenarioName Regressor Scenario Name - * @param dblTension Tension Parameter - * - * @return The BasisSplineRegressor Instance - */ - - public static final BasisSplineRegressor CreateHyperbolicTensionSplineRegressor ( - final java.lang.String strName, - final java.lang.String strScenarioName, - final double dblTension) - { - try { - org.drip.spline.basis.FunctionSet fs = - org.drip.spline.basis.FunctionSetBuilder.HyperbolicTensionBasisSet (new - org.drip.spline.basis.ExponentialTensionSetParams (dblTension)); - - return null == fs ? null : new BasisSplineRegressor (strName, strScenarioName, fs, 2); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an instance of the Kaklis-Pandelis BasisSplineRegressor - * - * @param strName Regressor Name - * @param strScenarioName Regressor Scenario Name - * @param iKPPolynomialTension KP Polynomial Tension Parameter - * - * @return The BasisSplineRegressor Instance - */ - - public static final BasisSplineRegressor CreateKaklisPandelisSplineRegressor ( - final java.lang.String strName, - final java.lang.String strScenarioName, - final int iKPPolynomialTension) - { - try { - org.drip.spline.basis.FunctionSet fs = - org.drip.spline.basis.FunctionSetBuilder.KaklisPandelisBasisSet (new - org.drip.spline.basis.KaklisPandelisSetParams (iKPPolynomialTension)); - - return null == fs ? null : new BasisSplineRegressor (strName, strScenarioName, fs, 2); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - protected BasisSplineRegressor ( - final java.lang.String strName, - final java.lang.String strScenarioName, - final org.drip.spline.basis.FunctionSet fs, - final int iCk) - throws java.lang.Exception - { - super (strName, strScenarioName); - - org.drip.spline.params.SegmentInelasticDesignControl segParams = - org.drip.spline.params.SegmentInelasticDesignControl.Create (iCk, 2); - - org.drip.spline.params.ResponseScalingShapeControl rssc = new - org.drip.spline.params.ResponseScalingShapeControl (true, new - org.drip.function.r1tor1.QuadraticRationalShapeControl (1.)); - - if (null == (_seg1 = org.drip.spline.segment.LatentStateResponseModel.Create (1.0, 3.0, fs, rssc, - segParams)) || null == (_seg2 = org.drip.spline.segment.LatentStateResponseModel.Create (3.0, - 6.0, fs, rssc, segParams))) - throw new java.lang.Exception ("BasisSplineRegressor ctr: Cant create the segments"); - } - - @Override public boolean preRegression() - { - return true; - } - - @Override public boolean execRegression() - { - try { - return null != (_wjLeft = _seg1.jackDCoeffDEdgeParams (25., 0., 20.25, null)) && null != - (_wjRight = _seg2.jackDCoeffDEdgeParams (_seg1, "Default", 16., null, java.lang.Double.NaN, - null)) && _seg2.calibrate (_seg1, 14., null) && null != (_wjValue = - _seg2.jackDResponseDEdgeInput (5., 1)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - try { - if (!rnvd.set (_strName + "_Seg1_1_0", "" + _seg1.responseValue (1.))) return false; - - if (!rnvd.set (_strName + "_Seg1_3_0", "" + _seg1.responseValue (3.))) return false; - - if (!rnvd.set (_strName + "_Seg1_Jack", _wjLeft.displayString())); - - if (!rnvd.set (_strName + "_Seg1_Head_Jack", _seg1.jackDCoeffDEdgeInputs().displayString())); - - if (!rnvd.set (_strName + "_Seg1_Monotone", _seg1.monotoneType().toString())); - - if (!rnvd.set (_strName + "_Seg2_3_0", "" + _seg2.responseValue (3.))) return false; - - if (!rnvd.set (_strName + "_Seg2_6_0", "" + _seg2.responseValue (6.))) return false; - - if (!rnvd.set (_strName + "_Seg2_Jack", _wjRight.displayString())); - - if (!rnvd.set (_strName + "_Seg2_Head_Jack", _seg2.jackDCoeffDEdgeInputs().displayString())); - - if (!rnvd.set (_strName + "_Seg2_Monotone", _seg2.monotoneType().toString())); - - return rnvd.set (_strName + "_Seg2_Value_Jack", _wjValue.displayString()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } -} diff --git a/org/drip/regression/spline/BasisSplineRegressorSet.java b/org/drip/regression/spline/BasisSplineRegressorSet.java deleted file mode 100644 index 167c81a..0000000 --- a/org/drip/regression/spline/BasisSplineRegressorSet.java +++ /dev/null @@ -1,229 +0,0 @@ - -package org.drip.regression.spline; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * BasisSplineRegressorSet carries out regression testing for the following series of basis splines: - * - #1: Polynomial Basis Spline, n = 2 basis functions, and Ck = 0. - * - #2: Polynomial Basis Spline, n = 3 basis functions, and Ck = 1. - * - #3: Polynomial Basis Spline, n = 4 basis functions, and Ck = 1. - * - #4: Polynomial Basis Spline, n = 4 basis functions, and Ck = 2. - * - #5: Polynomial Basis Spline, n = 5 basis functions, and Ck = 1. - * - #6: Polynomial Basis Spline, n = 5 basis functions, and Ck = 2. - * - #7: Polynomial Basis Spline, n = 5 basis functions, and Ck = 3. - * - #8: Polynomial Basis Spline, n = 6 basis functions, and Ck = 1. - * - #9: Polynomial Basis Spline, n = 6 basis functions, and Ck = 2. - * - #10: Polynomial Basis Spline, n = 6 basis functions, and Ck = 3. - * - #11: Polynomial Basis Spline, n = 6 basis functions, and Ck = 4. - * - #12: Polynomial Basis Spline, n = 7 basis functions, and Ck = 1. - * - #13: Polynomial Basis Spline, n = 7 basis functions, and Ck = 2. - * - #14: Polynomial Basis Spline, n = 7 basis functions, and Ck = 3. - * - #15: Polynomial Basis Spline, n = 7 basis functions, and Ck = 4. - * - #16: Polynomial Basis Spline, n = 7 basis functions, and Ck = 5. - * - #17: Bernstein Polynomial Basis Spline, n = 4 basis functions, and Ck = 2. - * - #18: Exponential Tension Spline, n = 4 basis functions, Tension = 1., and Ck = 2. - * - #19: Hyperbolic Tension Spline, n = 4 basis functions, Tension = 1., and Ck = 2. - * - #20: Kaklis-Pandelis Tension Spline, n = 4 basis functions, KP = 2, and Ck = 2. - * - #21: C1 Hermite Local Spline, n = 4 basis functions, and Ck = 1. - * - #21: Hermite Local Spline with Local, Catmull-Rom, and Cardinal Knots, n = 4 basis functions, and Ck = 1. - * - * @author Lakshmi Krishnamurthy - */ - -public class BasisSplineRegressorSet implements org.drip.regression.core.RegressorSet { - private java.lang.String _strRegressionScenario = "PolynomialSplineRegressor"; - - private java.util.List _setRegressors = new - java.util.ArrayList(); - - /** - * BasisSplineRegressorSet constructor - Creates the base spline parameter and initializes the - * regression objects - */ - - public BasisSplineRegressorSet() - { - } - - @Override public boolean setupRegressors() - { - try { - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreatePolynomialSplineRegressor ("N2Ck0", - _strRegressionScenario, 2, 0)); - - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreatePolynomialSplineRegressor ("N3Ck0", - _strRegressionScenario, 3, 0)); - - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreatePolynomialSplineRegressor ("N3Ck1", - _strRegressionScenario, 3, 1)); - - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreatePolynomialSplineRegressor ("N4Ck0", - _strRegressionScenario, 4, 0)); - - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreatePolynomialSplineRegressor ("N4Ck1", - _strRegressionScenario, 4, 1)); - - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreatePolynomialSplineRegressor ("N4Ck2", - _strRegressionScenario, 4, 2)); - - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreatePolynomialSplineRegressor ("N5Ck0", - _strRegressionScenario, 5, 0)); - - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreatePolynomialSplineRegressor ("N5Ck1", - _strRegressionScenario, 5, 1)); - - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreatePolynomialSplineRegressor ("N5Ck2", - _strRegressionScenario, 5, 2)); - - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreatePolynomialSplineRegressor ("N5Ck3", - _strRegressionScenario, 5, 3)); - - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreatePolynomialSplineRegressor ("N6Ck0", - _strRegressionScenario, 6, 0)); - - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreatePolynomialSplineRegressor ("N6Ck1", - _strRegressionScenario, 6, 1)); - - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreatePolynomialSplineRegressor ("N6Ck2", - _strRegressionScenario, 6, 2)); - - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreatePolynomialSplineRegressor ("N6Ck3", - _strRegressionScenario, 6, 3)); - - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreatePolynomialSplineRegressor ("N6Ck4", - _strRegressionScenario, 6, 4)); - - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreatePolynomialSplineRegressor ("N7Ck0", - _strRegressionScenario, 7, 0)); - - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreatePolynomialSplineRegressor ("N7Ck1", - _strRegressionScenario, 7, 1)); - - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreatePolynomialSplineRegressor ("N7Ck2", - _strRegressionScenario, 7, 2)); - - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreatePolynomialSplineRegressor ("N7Ck3", - _strRegressionScenario, 7, 3)); - - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreatePolynomialSplineRegressor ("N7Ck4", - _strRegressionScenario, 7, 4)); - - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreatePolynomialSplineRegressor ("N7Ck5", - _strRegressionScenario, 7, 5)); - - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreateExponentialTensionSplineRegressor - ("ExpTension", _strRegressionScenario, 1.)); - - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreateHyperbolicTensionSplineRegressor - ("HyperTension", _strRegressionScenario, 1.)); - - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreateKaklisPandelisSplineRegressor ("KP", - _strRegressionScenario, 2)); - - _setRegressors.add - (org.drip.regression.spline.BasisSplineRegressor.CreateBernsteinPolynomialSplineRegressor - ("Bern_N4Ck2", _strRegressionScenario, 4, 2)); - - _setRegressors.add - (org.drip.regression.spline.HermiteBasisSplineRegressor.CreateHermiteSplineRegressor - ("Hermite_N4Ck1", _strRegressionScenario, 4, 1)); - - _setRegressors.add (new org.drip.regression.spline.LocalControlBasisSplineRegressor - ("Hermite_Bessel_CatmullRom_Cardinal_N4Ck1", _strRegressionScenario, - org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (4), 1)); - - _setRegressors.add (new org.drip.regression.spline.LagrangePolynomialStretchRegressor - ("Lagrange_Polynomial_Stretch", _strRegressionScenario)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - return true; - } - - @Override public java.util.List getRegressorSet() - { - return _setRegressors; - } - - @Override public java.lang.String getSetName() - { - return _strRegressionScenario; - } -} diff --git a/org/drip/regression/spline/HermiteBasisSplineRegressor.java b/org/drip/regression/spline/HermiteBasisSplineRegressor.java deleted file mode 100644 index dd625c7..0000000 --- a/org/drip/regression/spline/HermiteBasisSplineRegressor.java +++ /dev/null @@ -1,170 +0,0 @@ - -package org.drip.regression.spline; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * HermiteBasisSplineRegressor implements the Hermite basis spline regressor for the given basis spline. As - * part of the regression run, it executes the following: - * - Calibrate and compute the left and the right Jacobian. - * - Reset right node and re-run calibration. - * - Compute an intermediate value Jacobian. - * - * @author Lakshmi Krishnamurthy - */ - -public class HermiteBasisSplineRegressor extends org.drip.regression.spline.BasisSplineRegressor { - private java.lang.String _strName = ""; - private org.drip.spline.segment.LatentStateResponseModel _seg1 = null; - private org.drip.spline.segment.LatentStateResponseModel _seg2 = null; - private org.drip.quant.calculus.WengertJacobian _wjLeft = null; - private org.drip.quant.calculus.WengertJacobian _wjRight = null; - private org.drip.quant.calculus.WengertJacobian _wjValue = null; - - /** - * Create an instance of Hermite BasisSplineRegressor - * - * @param strName Regressor Name - * @param strScenarioName Regressor Scenario Name - * @param iNumBasis Number of Basis Functions - * @param iCk Ck - * - * @return The BasisSplineRegressor Instance - */ - - public static final org.drip.regression.spline.BasisSplineRegressor CreateHermiteSplineRegressor ( - final java.lang.String strName, - final java.lang.String strScenarioName, - final int iNumBasis, - final int iCk) - { - try { - org.drip.spline.basis.FunctionSet fs = - org.drip.spline.basis.FunctionSetBuilder.PolynomialBasisSet (new - org.drip.spline.basis.PolynomialFunctionSetParams (iNumBasis)); - - return null == fs ? null : new HermiteBasisSplineRegressor (strName, strScenarioName, fs, iCk); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private HermiteBasisSplineRegressor ( - final java.lang.String strName, - final java.lang.String strScenarioName, - final org.drip.spline.basis.FunctionSet fs, - final int iCk) - throws java.lang.Exception - { - super (strName, strScenarioName, fs, iCk); - - org.drip.spline.params.SegmentInelasticDesignControl segParams = - org.drip.spline.params.SegmentInelasticDesignControl.Create (iCk, 1); - - org.drip.spline.params.ResponseScalingShapeControl rssc = new - org.drip.spline.params.ResponseScalingShapeControl (true, new - org.drip.function.r1tor1.QuadraticRationalShapeControl (1.)); - - if (null == (_seg1 = org.drip.spline.segment.LatentStateResponseModel.Create (0.0, 1.0, fs, rssc, - segParams)) || null == (_seg2 = org.drip.spline.segment.LatentStateResponseModel.Create (1.0, - 2.0, fs, rssc, segParams))) - throw new java.lang.Exception ("HermiteBasisSplineRegressor ctr: Cant create the segments"); - } - - @Override public boolean execRegression() - { - try { - return null != (_wjLeft = _seg1.jackDCoeffDEdgeParams (new double[] {0., 1.}, new double[] {1., - 4.}, new double[] {1.}, new double[] {6.}, null, null)) && null != (_wjRight = - _seg2.jackDCoeffDEdgeParams (new double[] {1., 2.}, new double[] {4., 15.}, new double[] - {6.}, new double[] {17.}, null, null)) && _seg2.calibrate (_seg1, 14., null) && null - != (_wjValue = _seg2.jackDResponseDEdgeInput (1.5, 1)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - try { - if (!rnvd.set (_strName + "_Seg1_0_0", "" + _seg1.responseValue (0.))) return false; - - if (!rnvd.set (_strName + "_Seg1_1_0", "" + _seg1.responseValue (1.))) return false; - - if (!rnvd.set (_strName + "_Seg1_Jack", _wjLeft.displayString())); - - if (!rnvd.set (_strName + "_Seg1_Head_Jack", _seg1.jackDCoeffDEdgeInputs().displayString())); - - if (!rnvd.set (_strName + "_Seg1_Monotone", _seg1.monotoneType().toString())); - - if (!rnvd.set (_strName + "_Seg2_1_0", "" + _seg2.responseValue (1.))) return false; - - if (!rnvd.set (_strName + "_Seg2_2_0", "" + _seg2.responseValue (2.))) return false; - - if (!rnvd.set (_strName + "_Seg2_Jack", _wjRight.displayString())); - - if (!rnvd.set (_strName + "_Seg2_Head_Jack", _seg2.jackDCoeffDEdgeInputs().displayString())); - - if (!rnvd.set (_strName + "_Seg2_Monotone", _seg2.monotoneType().toString())); - - return rnvd.set (_strName + "_Seg2_Value_Jack", _wjValue.displayString()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } -} diff --git a/org/drip/regression/spline/LagrangePolynomialStretchRegressor.java b/org/drip/regression/spline/LagrangePolynomialStretchRegressor.java deleted file mode 100644 index eebf5d1..0000000 --- a/org/drip/regression/spline/LagrangePolynomialStretchRegressor.java +++ /dev/null @@ -1,123 +0,0 @@ - -package org.drip.regression.spline; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * LagrangePolynomialStretchRegressor implements the local control basis spline regressor for the given basis - * spline. As part of the regression run, it executes the following: - * - Calibrate and compute the left and the right Jacobian. - * - Insert the Local Control Hermite, Cardinal, and Catmull-Rom knots. - * - Compute an intermediate value Jacobian. - * - * @author Lakshmi Krishnamurthy - */ - -public class LagrangePolynomialStretchRegressor extends org.drip.regression.core.UnitRegressionExecutor { - private boolean _bLocallyMonotone = false; - private double _dblValue = java.lang.Double.NaN; - private org.drip.spline.segment.Monotonocity _sm = null; - private org.drip.quant.calculus.WengertJacobian _wj = null; - private org.drip.spline.stretch.SingleSegmentSequence _sss = null; - - public LagrangePolynomialStretchRegressor ( - final java.lang.String strName, - final java.lang.String strScenarioName) - throws java.lang.Exception - { - super (strName, strScenarioName); - - _sss = new org.drip.spline.stretch.SingleSegmentLagrangePolynomial (new double[] {1., 2., 3., 4.}); - } - - @Override public boolean preRegression() - { - try { - return _sss.setup (1., new double[] {1., 2., 3., 4.}, null, - org.drip.spline.stretch.BoundarySettings.NaturalStandard(), - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - @Override public boolean execRegression() - { - try { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblValue = _sss.responseValue (2.16))) - return false; - - _bLocallyMonotone = _sss.isLocallyMonotone(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - if (null == (_wj = _sss.jackDResponseDCalibrationInput (2.16, 1))) return false; - - return null != (_sm = _sss.monotoneType (2.16)); - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rnvd) - { - if (!rnvd.set ("LPSR_Value", "" + _dblValue)) return false; - - if (!rnvd.set ("LPSR_WJ", _wj.displayString())) return false; - - if (!rnvd.set ("LPSR_SM", _sm.toString())) return false; - - return rnvd.set ("LPSR_LocallyMonotone", "" + _bLocallyMonotone); - } -} diff --git a/org/drip/regression/spline/LocalControlBasisSplineRegressor.java b/org/drip/regression/spline/LocalControlBasisSplineRegressor.java deleted file mode 100644 index 33ffd26..0000000 --- a/org/drip/regression/spline/LocalControlBasisSplineRegressor.java +++ /dev/null @@ -1,226 +0,0 @@ - -package org.drip.regression.spline; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * LocalControlBasisSplineRegressor implements the local control basis spline regressor for the given basis - * spline. As part of the regression run, it executes the following: - * - Calibrate and compute the left and the right Jacobian. - * - Insert the Local Control Hermite, Cardinal, and Catmull-Rom knots. - * - Run Regressor for the C1 Local Control C1 Slope Insertion Bessel/Hermite Spline. - * - Compute an intermediate value Jacobian. - * - * @author Lakshmi Krishnamurthy - */ - -public class LocalControlBasisSplineRegressor extends org.drip.regression.core.UnitRegressionExecutor { - private org.drip.spline.stretch.MultiSegmentSequence _mss = null; - private org.drip.spline.stretch.MultiSegmentSequence _mssBesselHermite = null; - private org.drip.spline.stretch.MultiSegmentSequence _mssHermiteInsert = null; - private org.drip.spline.stretch.MultiSegmentSequence _mssCardinalInsert = null; - private org.drip.spline.stretch.MultiSegmentSequence _mssCatmullRomInsert = null; - - private final boolean DumpRNVD ( - final java.lang.String strStretchName, - final org.drip.spline.stretch.MultiSegmentSequence mss, - final org.drip.regression.core.RegressionRunDetail rrd) - { - double dblX = 0.; - double dblXMax = 4.; - - while (dblX <= dblXMax) { - try { - if (!rrd.set (getName() + "_" + strStretchName + "_" + dblX, - org.drip.quant.common.FormatUtil.FormatDouble (mss.responseValue (dblX), 1, 2, 1.) + - " | " + mss.monotoneType (dblX))) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - if (!rrd.set (getName() + "_" + strStretchName + "_" + dblX + "_Jack", - mss.jackDResponseDCalibrationInput (dblX, 1).displayString())) - return false; - - dblX += 0.5; - } - - return true; - } - - /** - * LocalControlBasisSplineRegressor constructor - * - * @param strName Regressor Name - * @param strScenarioName Regression Scenario Name - * @param strBasisSpline Basis Spline - * @param fsbp Basis Set Builder Parameters - * @param iCk Continuity Ck - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public LocalControlBasisSplineRegressor ( - final java.lang.String strName, - final java.lang.String strScenarioName, - final java.lang.String strBasisSpline, - final org.drip.spline.basis.FunctionSetBuilderParams fsbp, - final int iCk) - throws java.lang.Exception - { - super (strName, strScenarioName); - - double[] adblX = new double[] {0.00, 1.00, 2.00, 3.00, 4.00}; - int iNumSegment = adblX.length - 1; - org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC = new - org.drip.spline.params.SegmentCustomBuilderControl[iNumSegment]; - - for (int i = 0; i < iNumSegment; ++i) - aSCBC[i] = new org.drip.spline.params.SegmentCustomBuilderControl (strBasisSpline, fsbp, - org.drip.spline.params.SegmentInelasticDesignControl.Create (iCk, 1), new - org.drip.spline.params.ResponseScalingShapeControl (true, new - org.drip.function.r1tor1.QuadraticRationalShapeControl (1.)), null); - - if (null == (_mss = - org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateUncalibratedStretchEstimator - ("SPLINE_STRETCH", adblX, aSCBC))) - throw new java.lang.Exception - ("LocalControlBasisSplineRegressor ctr: Cannot Construct Stretch!"); - } - - @Override public boolean preRegression() - { - double[] adblY = new double[] {1.00, 4.00, 15.00, 40.00, 85.00}; - double[] adblDYDX = new double[] {1.00, 6.00, 17.00, 34.00, 57.00}; - - org.drip.spline.params.SegmentCustomBuilderControl scbc = null; - org.drip.spline.params.SegmentPredictorResponseDerivative[] aSPRDLeft = new - org.drip.spline.params.SegmentPredictorResponseDerivative[adblY.length - 1]; - org.drip.spline.params.SegmentPredictorResponseDerivative[] aSPRDRight = new - org.drip.spline.params.SegmentPredictorResponseDerivative[adblY.length - 1]; - - for (int i = 0; i < adblY.length - 1; ++i) { - try { - aSPRDLeft[i] = new org.drip.spline.params.SegmentPredictorResponseDerivative (adblY[i], new - double[] {adblDYDX[i]}); - - aSPRDRight[i] = new org.drip.spline.params.SegmentPredictorResponseDerivative (adblY[i + 1], - new double[] {adblDYDX[i + 1]}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - try { - scbc = new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (4), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), new - org.drip.spline.params.ResponseScalingShapeControl (true, new - org.drip.function.r1tor1.QuadraticRationalShapeControl (1.)), null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC = new - org.drip.spline.params.SegmentCustomBuilderControl[adblY.length - 1]; - - for (int i = 0; i < adblY.length - 1; ++i) - aSCBC[i] = scbc; - - if (null == (_mssBesselHermite = - org.drip.spline.pchip.LocalControlStretchBuilder.CreateBesselCubicSplineStretch - ("BESSEL_STRETCH", new double[] {0.00, 1.00, 2.00, 3.00, 4.00}, adblY, aSCBC, null, - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE, true, true))) - return false; - - return _mss.setupHermite (aSPRDLeft, aSPRDRight, null, null, - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE_JACOBIAN); - } - - @Override public boolean execRegression() - { - try { - if (null == (_mssHermiteInsert = org.drip.spline.stretch.MultiSegmentSequenceModifier.InsertKnot - (_mss, 2.5, new org.drip.spline.params.SegmentPredictorResponseDerivative (27.5, new double[] - {25.5}), new org.drip.spline.params.SegmentPredictorResponseDerivative (27.5, new - double[] {25.5})))) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - if (null == (_mssCardinalInsert = - org.drip.spline.stretch.MultiSegmentSequenceModifier.InsertCardinalKnot (_mss, 2.5, 0.))) - return false; - - return null != (_mssCatmullRomInsert = - org.drip.spline.stretch.MultiSegmentSequenceModifier.InsertCatmullRomKnot (_mss, 2.5)); - } - - @Override public boolean postRegression ( - final org.drip.regression.core.RegressionRunDetail rrd) - { - return DumpRNVD ("LOCAL_NO_KNOT", _mss, rrd) && DumpRNVD ("LOCAL_HERMITE_KNOT", _mssHermiteInsert, - rrd) && DumpRNVD ("LOCAL_CARDINAL_KNOT", _mssCardinalInsert, rrd) && DumpRNVD - ("LOCAL_CATMULL_ROM_KNOT", _mssCatmullRomInsert, rrd) && DumpRNVD ("LOCAL_C1_BESSEL_HERMITE", - _mssBesselHermite, rrd); - } -} diff --git a/org/drip/sample/algo/C1ArrayTranslateShuffle.java b/org/drip/sample/algo/C1ArrayTranslateShuffle.java deleted file mode 100644 index e47793d..0000000 --- a/org/drip/sample/algo/C1ArrayTranslateShuffle.java +++ /dev/null @@ -1,90 +0,0 @@ - -package org.drip.sample.algo; - -import org.drip.service.env.EnvManager; -import org.drip.spaces.big.BigC1Array; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * C1ArrayTranslateShuffle demonstrates the Functionality that conducts an in-place Translation and Shuffling - * of a Big String Instance. - * - * @author Lakshmi Krishnamurthy - */ - -public class C1ArrayTranslateShuffle { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strBigString = "abcdefghijklmnopqrstuvwxyzABCDEFGIHJKLMNOPQRSTUVWXYZ0123456789!~@#$%^&*(){}[]<>,.?/"; - int iBigStringPivot = 35; - int iBigStringBlock = 17; - - BigC1Array bs = new BigC1Array (strBigString.toCharArray()); - - System.out.println(); - - while (iBigStringPivot > 0) { - if (iBigStringPivot < iBigStringBlock) iBigStringBlock = iBigStringPivot; - - bs.translateAtPivot ( - iBigStringPivot, - iBigStringBlock - ); - - System.out.println ("\t" + strBigString + " => " + new java.lang.String (bs.charArray())); - - iBigStringPivot -= iBigStringBlock; - } - } -} diff --git a/org/drip/sample/algo/R1ArrayInSituSort.java b/org/drip/sample/algo/R1ArrayInSituSort.java deleted file mode 100644 index f8aa19b..0000000 --- a/org/drip/sample/algo/R1ArrayInSituSort.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.sample.algo; - -import org.drip.quant.common.*; -import org.drip.spaces.big.BigR1Array; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * R1ArrayInSituSort demonstrates the Functionality that conducts an in-place Sorting of an Instance of - * BigDoubleArray using a variety of Sorting Algorithms. - * - * @author Lakshmi Krishnamurthy - */ - -public class R1ArrayInSituSort { - - private static void QuickSort ( - final int iNumRandom, - final String strPrefix) - throws Exception - { - double[] adblA = new double[iNumRandom]; - double[] adblAOrig = new double[iNumRandom]; - - for (int i = 0; i < iNumRandom; ++i) { - adblA[i] = Math.random(); - - adblAOrig[i] = adblA[i]; - } - - BigR1Array ba = new BigR1Array (adblA); - - ba.quickSort(); - - System.out.println ("\n\t---------------------------------------------"); - - for (int i = 0; i < iNumRandom; ++i) - System.out.println ( - "\t|| " + strPrefix + " " + - FormatUtil.FormatDouble (adblAOrig[i], 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (adblA[i], 1, 4, 1.) + " ||" - ); - - System.out.println ("\t---------------------------------------------"); - } - - private static void MergeSort ( - final int iNumRandom, - final String strPrefix) - throws Exception - { - double[] adblA = new double[iNumRandom]; - double[] adblAOrig = new double[iNumRandom]; - - for (int i = 0; i < iNumRandom; ++i) { - adblA[i] = Math.random(); - - adblAOrig[i] = adblA[i]; - } - - BigR1Array ba = new BigR1Array (adblA); - - ba.mergeSort(); - - System.out.println ("\n\t---------------------------------------------"); - - for (int i = 0; i < iNumRandom; ++i) - System.out.println ( - "\t|| " + strPrefix + " " + - FormatUtil.FormatDouble (adblAOrig[i], 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (adblA[i], 1, 4, 1.) + " ||" - ); - - System.out.println ("\t---------------------------------------------"); - } - - private static void HeapSort ( - final int iNumRandom, - final String strPrefix) - throws Exception - { - double[] adblA = new double[iNumRandom]; - double[] adblAOrig = new double[iNumRandom]; - - for (int i = 0; i < iNumRandom; ++i) { - adblA[i] = Math.random(); - - adblAOrig[i] = adblA[i]; - } - - BigR1Array ba = new BigR1Array (adblA); - - ba.heapSort(); - - System.out.println ("\n\t---------------------------------------------"); - - for (int i = 0; i < iNumRandom; ++i) - System.out.println ( - "\t|| " + strPrefix + " " + - FormatUtil.FormatDouble (adblAOrig[i], 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (adblA[i], 1, 4, 1.) + " ||" - ); - - System.out.println ("\t---------------------------------------------"); - } - - private static void InsertionSort ( - final int iNumRandom, - final String strPrefix) - throws Exception - { - double[] adblA = new double[iNumRandom]; - double[] adblAOrig = new double[iNumRandom]; - - for (int i = 0; i < iNumRandom; ++i) { - adblA[i] = Math.random(); - - adblAOrig[i] = adblA[i]; - } - - System.out.println ("\n\t---------------------------------------------"); - - NumberUtil.Print1DArray ( - "\t| ORIGINAL ", - adblA, - 6, - false - ); - - System.out.println ("\t---------------------------------------------"); - - BigR1Array ba = new BigR1Array (adblA); - - ba.insertionSort(); - - System.out.println ("\n\t---------------------------------------------"); - - for (int i = 0; i < iNumRandom; ++i) - System.out.println ( - "\t|| " + strPrefix + " " + - FormatUtil.FormatDouble (adblAOrig[i], 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (adblA[i], 1, 4, 1.) + " ||" - ); - - System.out.println ("\t---------------------------------------------"); - } - - public static void main ( - final String[] astrArgs) - throws Exception - { - int iNumRandom = 50; - - QuickSort ( - iNumRandom, - "QUICKSORT" - ); - - MergeSort ( - iNumRandom, - "MERGESORT" - ); - - InsertionSort ( - iNumRandom, - "INSERTIONSORT" - ); - - HeapSort ( - iNumRandom, - "HEAPSORT" - ); - } -} diff --git a/org/drip/sample/algo/R2ArrayPathwiseProcessing.java b/org/drip/sample/algo/R2ArrayPathwiseProcessing.java deleted file mode 100644 index fc48cad..0000000 --- a/org/drip/sample/algo/R2ArrayPathwiseProcessing.java +++ /dev/null @@ -1,175 +0,0 @@ - -package org.drip.sample.algo; - -import org.drip.quant.common.FormatUtil; -import org.drip.spaces.big.BigR2Array; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * R2ArrayPathwiseProcessing demonstrates the Functionality that conducts an in-place Path-wise Processing of - * an Instance of Big R^2 Array. - * - * @author Lakshmi Krishnamurthy - */ - -public class R2ArrayPathwiseProcessing { - - private static final void MaxPathwiseProduct ( - final int iSize, - final int iNumSim) - throws Exception - { - double dblExpectedMaxPathResponse = 0.; - final double[][] aadblA = new double[iSize][iSize]; - - for (int iRun = 0; iRun < iNumSim; ++iRun) { - for (int i = 0; i < iSize; ++i) { - for (int j = 0; j < iSize; ++j) - aadblA[i][j] = Math.random(); - } - - dblExpectedMaxPathResponse += new BigR2Array (aadblA) { - @Override public double pathResponse ( - final int iX, - final int iY, - final double dblPriorPathResponse) - throws Exception - { - return dblPriorPathResponse * aadblA[iX][iY]; - } - - @Override public double maxPathResponse() - throws Exception - { - return maxPathResponse ( - 0, - 0, - 1. - ); - } - }.maxPathResponse(); - } - - System.out.println ( - "\t|| EXPECTED MAX PATH PRODUCT => " + - FormatUtil.FormatDouble (dblExpectedMaxPathResponse / iNumSim, 1, 4, 1.) + " ||" - ); - } - - private static final void MaxPathwiseSum ( - final int iSize, - final int iNumSim) - throws Exception - { - double dblExpectedMaxPathResponse = 0.; - final double[][] aadblA = new double[iSize][iSize]; - - for (int iRun = 0; iRun < iNumSim; ++iRun) { - for (int i = 0; i < iSize; ++i) { - for (int j = 0; j < iSize; ++j) - aadblA[i][j] = Math.random(); - } - - dblExpectedMaxPathResponse += new BigR2Array (aadblA) { - @Override public double pathResponse ( - final int iX, - final int iY, - final double dblPriorPathResponse) - throws Exception - { - return dblPriorPathResponse + aadblA[iX][iY]; - } - - @Override public double maxPathResponse() - throws Exception - { - return maxPathResponse ( - 0, - 0, - 0. - ); - } - }.maxPathResponse(); - } - - System.out.println ( - "\t|| EXPECTED MAX PATH SUM => " + - FormatUtil.FormatDouble (dblExpectedMaxPathResponse / iNumSim, 1, 4, 1.) + " ||" - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - int iSize = 5; - int iNumSim = 1000000; - int iNumRunSet = 5; - - System.out.println (); - - for (int i = 0; i < iNumRunSet; ++i) { - System.out.println ("\t||--------------------------------------||"); - - MaxPathwiseProduct ( - iSize, - iNumSim - ); - - MaxPathwiseSum ( - iSize, - iNumSim - ); - - System.out.println ("\t||--------------------------------------||"); - } - - System.out.println (); - } -} diff --git a/org/drip/sample/algo/SubMatrixSetExtraction.java b/org/drip/sample/algo/SubMatrixSetExtraction.java deleted file mode 100644 index dd9bb4a..0000000 --- a/org/drip/sample/algo/SubMatrixSetExtraction.java +++ /dev/null @@ -1,118 +0,0 @@ - -package org.drip.sample.algo; - -import java.util.List; - -import org.drip.quant.common.FormatUtil; -import org.drip.spaces.big.SubMatrixSetExtractor; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * SubMatrixSetStringExtraction demonstrates the Extraction and Usage of the Inner Sub-matrices of a given - * Master Matrix. - * - * @author Lakshmi Krishnamurthy - */ - -public class SubMatrixSetExtraction { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - int iSize = 4; - double[][] aadbl = new double[iSize][iSize]; - - for (int i = 0; i < iSize; ++i) { - for (int j = 0; j < iSize; ++j) - aadbl[i][j] = Math.random() - 0.5; - } - - System.out.println (); - - for (int iStartRow = 0; iStartRow < iSize; ++iStartRow) { - for (int iStartColumn = 0; iStartColumn < iSize; ++iStartColumn) { - double dblMaxCompositeSum = -1. * iSize * iSize; - - List lsSubMatrix = SubMatrixSetExtractor.SquareSubMatrixList ( - aadbl, - iStartRow, - iStartColumn - ); - - for (double[][] aadblSubMatrix : lsSubMatrix) { - double dblCompositeSum = SubMatrixSetExtractor.CompositeValue (aadblSubMatrix); - - if (dblCompositeSum > dblMaxCompositeSum) dblMaxCompositeSum = dblCompositeSum; - } - - double dblMaxCompositeSumCombined = SubMatrixSetExtractor.MaxCompositeSubMatrix ( - aadbl, - iStartRow, - iStartColumn - ); - - double dblMaxCompositeSumLean = SubMatrixSetExtractor.LeanMaxCompositeSubMatrix ( - aadbl, - iStartRow, - iStartColumn - ); - - System.out.println ( - "\tMax[" + iStartRow + "][" + iStartColumn + "] => " + - FormatUtil.FormatDouble (dblMaxCompositeSum, 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (dblMaxCompositeSumCombined, 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (dblMaxCompositeSumLean, 1, 4, 1.) - ); - } - } - - System.out.println (); - } -} diff --git a/org/drip/sample/algo/SubStringSetExtraction.java b/org/drip/sample/algo/SubStringSetExtraction.java deleted file mode 100644 index 9c2d0c7..0000000 --- a/org/drip/sample/algo/SubStringSetExtraction.java +++ /dev/null @@ -1,86 +0,0 @@ - -package org.drip.sample.algo; - -import java.util.*; - -import org.drip.service.env.EnvManager; -import org.drip.spaces.big.SubStringSetExtractor; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * SubStringSetExtraction demonstrates the Extraction of Permuted and Contiguous Sub-string Sets. - * - * @author Lakshmi Krishnamurthy - */ - -public class SubStringSetExtraction { - - public static void main ( - final String[] astrArgs) - { - EnvManager.InitEnv (""); - - String strMaster = "abc"; - - List lsTarget = new ArrayList(); - - for (int i = 1; i <= strMaster.length(); ++i) - lsTarget.addAll (SubStringSetExtractor.ExhaustivePermutationScan (strMaster, i)); - - System.out.println (); - - System.out.println ("Permuted Set: " + lsTarget); - - System.out.println ("Permuted String Set Size: " + lsTarget.size()); - - System.out.println ("Contiguous Set: " + SubStringSetExtractor.Contiguous (strMaster)); - - System.out.println (); - } -} diff --git a/org/drip/sample/alm/NetLiabilityCliffDependence.java b/org/drip/sample/alm/NetLiabilityCliffDependence.java deleted file mode 100644 index d40b926..0000000 --- a/org/drip/sample/alm/NetLiabilityCliffDependence.java +++ /dev/null @@ -1,190 +0,0 @@ - -package org.drip.sample.alm; - -import org.drip.portfolioconstruction.alm.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NetLiabilityAgeDependence demonstrates the Dependence of the Outstanding Value on Investor Cliff/Horizon - * Settings. - * - * @author Lakshmi Krishnamurthy - */ - -public class NetLiabilityCliffDependence { - - private static void LiabilityRun ( - final ExpectedNonFinancialIncome enfi, - final ExpectedBasicConsumption ebc, - final double dblAfterTaxIncome, - final double dblEndAge, - final DiscountRate dr, - final double dblStartAge, - final double dblRetirementAge, - final double dblMaximumAge) - throws Exception - { - NetLiabilityStream nls = new NetLiabilityStream ( - new InvestorCliffSettings ( - dblRetirementAge, - dblMaximumAge - ), - enfi, - ebc, - dblAfterTaxIncome - ); - - NetLiabilityMetrics nlm = nls.metrics ( - dblStartAge, - dblEndAge, - dr - ); - - System.out.println ( - "\t|| [" + - FormatUtil.FormatDouble (dblStartAge, 2, 0, 1.) + " |" + - FormatUtil.FormatDouble (dblRetirementAge, 2, 0, 1.) + " |" + - FormatUtil.FormatDouble (dblMaximumAge, 2, 0, 1.) + "] => " + - FormatUtil.FormatDouble (nlm.workingAgeIncomePV(), 5, 0, 1.) + " |" + - FormatUtil.FormatDouble (nlm.pensionBenefitsIncomePV(), 5, 0, 1.) + " |" + - FormatUtil.FormatDouble (nlm.basicConsumptionPV(), 5, 0, 1.) + " ||" - ); - } - - public static void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - double dblAfterTaxIncome = 800.; - double dblIncomeReplacementRate = 0.35; - double dblWorkingAgeConsumptionRate = 0.80; - double dblRetirementAgeConsumptionRate = 0.60; - double dblEndAge = 105.; - - double dblYield = -0.0020; - double dblBasicConsumptionSpread = 0.0100; - double dblWorkingAgeIncomeSpread = 0.0100; - double dblPensionBenefitsIncomeSpread = 0.0100; - - double[] adblStartAge = new double[] { - 40., - 45., - 50. - }; - double[] adblRetirementAge = new double[] { - 58., - 65., - 72. - }; - double[] adblMaximumAge = new double[] { - 77., - 85., - 93. - }; - - ExpectedNonFinancialIncome enfi = new ExpectedNonFinancialIncome (dblIncomeReplacementRate); - - ExpectedBasicConsumption ebc = new ExpectedBasicConsumption ( - dblWorkingAgeConsumptionRate, - dblRetirementAgeConsumptionRate - ); - - DiscountRate dr = new DiscountRate ( - dblYield, - dblWorkingAgeIncomeSpread, - dblPensionBenefitsIncomeSpread, - dblBasicConsumptionSpread - ); - - System.out.println(); - - System.out.println ("\t||-------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Start Age ||"); - - System.out.println ("\t|| - Retirement Age ||"); - - System.out.println ("\t|| - Maximum Age ||"); - - System.out.println ("\t||-------------------------------------------||"); - - System.out.println ("\t|| - Working Age Income PV ||"); - - System.out.println ("\t|| - Pension Benefits Income PV ||"); - - System.out.println ("\t|| - Basic Consumption PV ||"); - - System.out.println ("\t||-------------------------------------------||"); - - for (double dblStartAge : adblStartAge) { - for (double dblRetirementAge : adblRetirementAge) { - for (double dblMaximumAge : adblMaximumAge) - LiabilityRun ( - enfi, - ebc, - dblAfterTaxIncome, - dblEndAge, - dr, - dblStartAge, - dblRetirementAge, - dblMaximumAge - ); - } - } - - System.out.println ("\t||-------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/alm/NetLiabilityConsumptionDependence.java b/org/drip/sample/alm/NetLiabilityConsumptionDependence.java deleted file mode 100644 index 707e603..0000000 --- a/org/drip/sample/alm/NetLiabilityConsumptionDependence.java +++ /dev/null @@ -1,188 +0,0 @@ - -package org.drip.sample.alm; - -import org.drip.portfolioconstruction.alm.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NetLiabilityConsumptionDependence demonstrates the Dependence of the Outstanding Values on the Investor - * Consumption Settings. - * - * @author Lakshmi Krishnamurthy - */ - -public class NetLiabilityConsumptionDependence { - - private static final void LiabilityRun ( - final InvestorCliffSettings ics, - final double dblAfterTaxIncome, - final double dblStartAge, - final double dblEndAge, - final DiscountRate dr, - final double dblIncomeReplacementRate, - final double dblWorkingAgeConsumptionRate, - final double dblRetirementAgeConsumptionRate) - throws Exception - { - NetLiabilityStream nls = new NetLiabilityStream ( - ics, - new ExpectedNonFinancialIncome (dblIncomeReplacementRate), - new ExpectedBasicConsumption ( - dblWorkingAgeConsumptionRate, - dblRetirementAgeConsumptionRate - ), - dblAfterTaxIncome - ); - - NetLiabilityMetrics nlm = nls.metrics ( - dblStartAge, - dblEndAge, - dr - ); - - System.out.println ( - "\t|| [" + - FormatUtil.FormatDouble (dblIncomeReplacementRate, 2, 0, 100.) + "% |" + - FormatUtil.FormatDouble (dblWorkingAgeConsumptionRate, 2, 0, 100.) + "% |" + - FormatUtil.FormatDouble (dblRetirementAgeConsumptionRate, 2, 0, 100.) + "%] => " + - FormatUtil.FormatDouble (nlm.workingAgeIncomePV(), 5, 0, 1.) + " |" + - FormatUtil.FormatDouble (nlm.pensionBenefitsIncomePV(), 5, 0, 1.) + " |" + - FormatUtil.FormatDouble (nlm.basicConsumptionPV(), 5, 0, 1.) + " ||" - ); - } - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblAfterTaxIncome = 800.; - double dblRetirementAge = 65.; - double dblMaximumAge = 85.; - double dblStartAge = 45.; - double dblEndAge = 105.; - - double dblYield = -0.0020; - double dblBasicConsumptionSpread = 0.0100; - double dblWorkingAgeIncomeSpread = 0.0100; - double dblPensionBenefitsIncomeSpread = 0.0100; - - double[] adblIncomeReplacementRate = new double[] { - 0.25, - 0.35, - 0.45 - }; - double[] adblWorkingAgeConsumptionRate = new double[] { - 0.70, - 0.80, - 0.90 - }; - double[] adblRetirementAgeConsumptionRate = new double[] { - 0.50, - 0.60, - 0.70 - }; - - InvestorCliffSettings ics = new InvestorCliffSettings ( - dblRetirementAge, - dblMaximumAge - ); - - DiscountRate dr = new DiscountRate ( - dblYield, - dblWorkingAgeIncomeSpread, - dblPensionBenefitsIncomeSpread, - dblBasicConsumptionSpread - ); - - System.out.println(); - - System.out.println ("\t||----------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Income Replacement Rate ||"); - - System.out.println ("\t|| - Working Age Consumption Rate ||"); - - System.out.println ("\t|| - Retirement Age Consumption Rate ||"); - - System.out.println ("\t||----------------------------------------------||"); - - System.out.println ("\t|| - Working Age Income PV ||"); - - System.out.println ("\t|| - Pension Benefits Income PV ||"); - - System.out.println ("\t|| - Basic Consumption PV ||"); - - System.out.println ("\t||----------------------------------------------||"); - - for (double dblIncomeReplacementRate : adblIncomeReplacementRate) { - for (double dblWorkingAgeConsumptionRate : adblWorkingAgeConsumptionRate) { - for (double dblRetirementAgeConsumptionRate : adblRetirementAgeConsumptionRate) - LiabilityRun ( - ics, - dblAfterTaxIncome, - dblStartAge, - dblEndAge, - dr, - dblIncomeReplacementRate, - dblWorkingAgeConsumptionRate, - dblRetirementAgeConsumptionRate - ); - } - } - - System.out.println ("\t||----------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/alm/NetLiabilityDiscountDependence.java b/org/drip/sample/alm/NetLiabilityDiscountDependence.java deleted file mode 100644 index 84b54a4..0000000 --- a/org/drip/sample/alm/NetLiabilityDiscountDependence.java +++ /dev/null @@ -1,182 +0,0 @@ - -package org.drip.sample.alm; - -import org.drip.portfolioconstruction.alm.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NetLiabilityDiscountDependence demonstrates the Dependence of the Outstanding Values on the Discounting - * Spread Settings. - * - * @author Lakshmi Krishnamurthy - */ - -public class NetLiabilityDiscountDependence { - - private static void LiabilityRun ( - final NetLiabilityStream nls, - final double dblStartAge, - final double dblEndAge, - final double dblYield, - final double dblWorkingAgeIncomeSpread, - final double dblPensionBenefitsIncomeSpread, - final double dblBasicConsumptionSpread) - throws Exception - { - NetLiabilityMetrics nlm = nls.metrics ( - dblStartAge, - dblEndAge, - new DiscountRate ( - dblYield, - dblWorkingAgeIncomeSpread, - dblPensionBenefitsIncomeSpread, - dblBasicConsumptionSpread - ) - ); - - System.out.println ( - "\t|| [" + - FormatUtil.FormatDouble (dblWorkingAgeIncomeSpread, 1, 1, 100.) + "% |" + - FormatUtil.FormatDouble (dblPensionBenefitsIncomeSpread, 1, 1, 100.) + "% |" + - FormatUtil.FormatDouble (dblBasicConsumptionSpread, 1, 1, 100.) + "%] => " + - FormatUtil.FormatDouble (nlm.workingAgeIncomePV(), 5, 0, 1.) + " |" + - FormatUtil.FormatDouble (nlm.pensionBenefitsIncomePV(), 5, 0, 1.) + " |" + - FormatUtil.FormatDouble (nlm.basicConsumptionPV(), 5, 0, 1.) + " ||" - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblAfterTaxIncome = 800.; - double dblRetirementAge = 65.; - double dblMaximumAge = 85.; - double dblIncomeReplacementRate = 0.35; - double dblWorkingAgeConsumptionRate = 0.80; - double dblRetirementAgeConsumptionRate = 0.60; - double dblStartAge = 45.; - double dblEndAge = 105.; - - double dblYield = -0.0020; - double[] adblBasicConsumptionSpread = new double[] { - 0.0050, - 0.0100, - 0.0150 - }; - double[] adblWorkingAgeIncomeSpread = new double[] { - 0.0050, - 0.0100, - 0.0150 - }; - double[] adblPensionBenefitsIncomeSpread = new double[] { - 0.0050, - 0.0100, - 0.0150 - }; - - NetLiabilityStream nls = new NetLiabilityStream ( - new InvestorCliffSettings ( - dblRetirementAge, - dblMaximumAge - ), - new ExpectedNonFinancialIncome (dblIncomeReplacementRate), - new ExpectedBasicConsumption ( - dblWorkingAgeConsumptionRate, - dblRetirementAgeConsumptionRate - ), - dblAfterTaxIncome - ); - - System.out.println(); - - System.out.println ("\t||-------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Basic Consumption Spread ||"); - - System.out.println ("\t|| - Working Age Income Spread ||"); - - System.out.println ("\t|| - Pension Benefits Income Spread ||"); - - System.out.println ("\t||-------------------------------------------------||"); - - System.out.println ("\t|| - Working Age Income PV ||"); - - System.out.println ("\t|| - Pension Benefits Income PV ||"); - - System.out.println ("\t|| - Basic Consumption PV ||"); - - System.out.println ("\t||-------------------------------------------------||"); - - for (double dblBasicConsumptionSpread : adblBasicConsumptionSpread) { - for (double dblWorkingAgeIncomeSpread : adblWorkingAgeIncomeSpread) { - for (double dblPensionBenefitsIncomeSpread : adblPensionBenefitsIncomeSpread) { - LiabilityRun ( - nls, - dblStartAge, - dblEndAge, - dblYield, - dblWorkingAgeIncomeSpread, - dblPensionBenefitsIncomeSpread, - dblBasicConsumptionSpread - ); - } - } - } - - System.out.println ("\t||-------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/alm/NetLiabilityStreamEstimator.java b/org/drip/sample/alm/NetLiabilityStreamEstimator.java deleted file mode 100644 index 47e43e5..0000000 --- a/org/drip/sample/alm/NetLiabilityStreamEstimator.java +++ /dev/null @@ -1,175 +0,0 @@ - -package org.drip.sample.alm; - -import org.drip.portfolioconstruction.alm.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NetLiabilityStreamEstimator demonstrates the Generation of an ALM Net Liability Cash Flow. - * - * @author Lakshmi Krishnamurthy - */ - -public class NetLiabilityStreamEstimator { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblAfterTaxIncome = 800.; - double dblRetirementAge = 65.; - double dblMaximumAge = 85.; - double dblIncomeReplacementRate = 0.35; - double dblWorkingAgeConsumptionRate = 0.80; - double dblRetirementAgeConsumptionRate = 0.60; - double dblStartAge = 45.; - double dblEndAge = 105.; - - double dblYield = -0.0020; - double dblBasicConsumptionSpread = 0.0100; - double dblWorkingAgeIncomeSpread = 0.0100; - double dblPensionBenefitsIncomeSpread = 0.0100; - - double dblWorkingAgeIncomePVReconciler = 14726.60; - double dblPensionBenefitsIncomePVReconciler = 4392.20; - double dblBasicConsumptionPVReconciler = 19310.70; - - NetLiabilityStream nls = new NetLiabilityStream ( - new InvestorCliffSettings ( - dblRetirementAge, - dblMaximumAge - ), - new ExpectedNonFinancialIncome (dblIncomeReplacementRate), - new ExpectedBasicConsumption ( - dblWorkingAgeConsumptionRate, - dblRetirementAgeConsumptionRate - ), - dblAfterTaxIncome - ); - - NetLiabilityMetrics nlm = nls.metrics ( - dblStartAge, - dblEndAge, - new DiscountRate ( - dblYield, - dblWorkingAgeIncomeSpread, - dblPensionBenefitsIncomeSpread, - dblBasicConsumptionSpread - ) - ); - - System.out.println ("\n\t||---------------------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| Age (Years) ||"); - - System.out.println ("\t|| Retired? ||"); - - System.out.println ("\t|| Alive? ||"); - - System.out.println ("\t|| Horizon (Years) ||"); - - System.out.println ("\t|| Working Age Income DF ||"); - - System.out.println ("\t|| Pension Benefits Income DF ||"); - - System.out.println ("\t|| Basic Consumption DF ||"); - - System.out.println ("\t|| Working Age Income ||"); - - System.out.println ("\t|| Pension Benefits Income ||"); - - System.out.println ("\t|| Basic Consumption ||"); - - System.out.println ("\t||---------------------------------------------------------------||"); - - for (NetLiabilityCashFlow nlcf : nlm.cashFlowList()) - System.out.println ( - "\t||" + - FormatUtil.FormatDouble (nlcf.age(), 3, 0, 1.) + " | " + - (nlcf.isRetired() ? "N" : "Y") + " | " + - (nlcf.isAlive() ? "Y" : "N") + " |" + - FormatUtil.FormatDouble (nlcf.horizon(), 2, 0, 1.) + " |" + - FormatUtil.FormatDouble (nlcf.workingAgeIncomeDF(), 1, 4, 1.) + " |" + - FormatUtil.FormatDouble (nlcf.pensionBenefitsDF(), 1, 4, 1.) + " |" + - FormatUtil.FormatDouble (nlcf.basicConsumptionDF(), 1, 4, 1.) + " |" + - FormatUtil.FormatDouble (nlcf.workingAgeIncome(), 3, 0, 1.) + " |" + - FormatUtil.FormatDouble (nlcf.pensionBenefits(), 3, 0, 1.) + " |" + - FormatUtil.FormatDouble (nlcf.basicConsumption(), 3, 0, 1.) + " ||" - ); - - System.out.println ("\t||---------------------------------------------------------------||\n"); - - System.out.println ("\t||-------------------------------------------------||"); - - System.out.println ( - "\t|| Working Age Income PV : " + - FormatUtil.FormatDouble (nlm.workingAgeIncomePV(), 5, 1, 1) + " |" + - FormatUtil.FormatDouble (dblWorkingAgeIncomePVReconciler, 5, 1, 1) + " ||" - ); - - System.out.println ( - "\t|| Pension Benefits Income PV : " + - FormatUtil.FormatDouble (nlm.pensionBenefitsIncomePV(), 5, 1, 1) + " |" + - FormatUtil.FormatDouble (dblPensionBenefitsIncomePVReconciler, 5, 1, 1) + " ||" - ); - - System.out.println ( - "\t|| Basic Consumption PV : " + - FormatUtil.FormatDouble (nlm.basicConsumptionPV(), 5, 1, 1) + " |" + - FormatUtil.FormatDouble (dblBasicConsumptionPVReconciler, 5, 1, 1) + " ||" - ); - - System.out.println ("\t||-------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/alm/NetLiabilityTaxYieldDependence.java b/org/drip/sample/alm/NetLiabilityTaxYieldDependence.java deleted file mode 100644 index 7fc1d02..0000000 --- a/org/drip/sample/alm/NetLiabilityTaxYieldDependence.java +++ /dev/null @@ -1,190 +0,0 @@ - -package org.drip.sample.alm; - -import org.drip.portfolioconstruction.alm.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NetLiabilityTaxYieldDependence demonstrates the Dependence of the Outstanding Value on the Tax and the - * Discount Yield Settings. - * - * @author Lakshmi Krishnamurthy - */ - -public class NetLiabilityTaxYieldDependence { - - private static final void LiabilityRun ( - final InvestorCliffSettings ics, - final ExpectedNonFinancialIncome enfi, - final ExpectedBasicConsumption ebc, - final double dblStartAge, - final double dblEndAge, - final double dblWorkingAgeIncomeSpread, - final double dblPensionBenefitsIncomeSpread, - final double dblBasicConsumptionSpread, - final double dblYield, - final double dblAfterTaxIncome) - throws Exception - { - NetLiabilityStream nls = new NetLiabilityStream ( - ics, - enfi, - ebc, - dblAfterTaxIncome - ); - - NetLiabilityMetrics nlm = nls.metrics ( - dblStartAge, - dblEndAge, - new DiscountRate ( - dblYield, - dblWorkingAgeIncomeSpread, - dblPensionBenefitsIncomeSpread, - dblBasicConsumptionSpread - ) - ); - - System.out.println ( - "\t|| [" + - FormatUtil.FormatDouble (dblYield, 1, 1, 100.) + "% |" + - FormatUtil.FormatDouble (dblAfterTaxIncome, 3, 0, 1.) + "] => " + - FormatUtil.FormatDouble (nlm.workingAgeIncomePV(), 5, 0, 1.) + " |" + - FormatUtil.FormatDouble (nlm.pensionBenefitsIncomePV(), 5, 0, 1.) + " |" + - FormatUtil.FormatDouble (nlm.basicConsumptionPV(), 5, 0, 1.) + " ||" - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblRetirementAge = 65.; - double dblMaximumAge = 85.; - double dblIncomeReplacementRate = 0.35; - double dblWorkingAgeConsumptionRate = 0.80; - double dblRetirementAgeConsumptionRate = 0.60; - double dblStartAge = 45.; - double dblEndAge = 105.; - - double dblBasicConsumptionSpread = 0.0100; - double dblWorkingAgeIncomeSpread = 0.0100; - double dblPensionBenefitsIncomeSpread = 0.0100; - - double[] adblYield = new double[] { - -0.004, - -0.002, - 0.000, - 0.002, - 0.004, - 0.006 - }; - double[] adblAfterTaxIncome = new double[] { - 600., - 700., - 800., - 900., - 999. - }; - - InvestorCliffSettings ics = new InvestorCliffSettings ( - dblRetirementAge, - dblMaximumAge - ); - - ExpectedNonFinancialIncome enfi = new ExpectedNonFinancialIncome (dblIncomeReplacementRate); - - ExpectedBasicConsumption ebc = new ExpectedBasicConsumption ( - dblWorkingAgeConsumptionRate, - dblRetirementAgeConsumptionRate - ); - - System.out.println(); - - System.out.println ("\t||-----------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Base Discounting Yield ||"); - - System.out.println ("\t|| - After Tax Income ||"); - - System.out.println ("\t||-----------------------------------------||"); - - System.out.println ("\t|| - Working Age Income PV ||"); - - System.out.println ("\t|| - Pension Benefits Income PV ||"); - - System.out.println ("\t|| - Basic Consumption PV ||"); - - System.out.println ("\t||-----------------------------------------||"); - - for (double dblYield : adblYield) { - for (double dblAfterTaxIncome : adblAfterTaxIncome) - LiabilityRun ( - ics, - enfi, - ebc, - dblStartAge, - dblEndAge, - dblWorkingAgeIncomeSpread, - dblPensionBenefitsIncomeSpread, - dblBasicConsumptionSpread, - dblYield, - dblAfterTaxIncome - ); - } - - System.out.println ("\t||-----------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/almgren2003/ConstantLiquidityVolatility.java b/org/drip/sample/almgren2003/ConstantLiquidityVolatility.java deleted file mode 100644 index 6e71940..0000000 --- a/org/drip/sample/almgren2003/ConstantLiquidityVolatility.java +++ /dev/null @@ -1,210 +0,0 @@ - -package org.drip.sample.almgren2003; - -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.ParticipationRateLinear; -import org.drip.execution.nonadaptive.ContinuousConstantTradingEnhanced; -import org.drip.execution.optimum.EfficientTradingTrajectoryContinuous; -import org.drip.execution.profiletime.UniformParticipationRateLinear; -import org.drip.function.definition.R1ToR1; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ConstantLiquidityVolatility demonstrates the Dependence of the Optimal Trading Trajectory as a Function of - * Constant Trading Enhanced Volatilities. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConstantLiquidityVolatility { - - private static final void AlphaRun ( - final double dblAlpha, - final double dblT, - final int iNumInterval) - throws Exception - { - double dblEta = 5.e-06; - double dblSigma = 1.; - double dblLambda = 1.e-05; - double dblX = 100000.; - - ArithmeticPriceEvolutionParameters apep = ArithmeticPriceEvolutionParametersBuilder.TradingEnhancedVolatility ( - dblSigma, - new UniformParticipationRateLinear (ParticipationRateLinear.SlopeOnly (dblEta)), - new UniformParticipationRateLinear ( - new ParticipationRateLinear ( - dblAlpha, - 0. - ) - ) - ); - - ContinuousConstantTradingEnhanced ccte = ContinuousConstantTradingEnhanced.Standard ( - dblX, - dblT, - apep, - dblLambda - ); - - EfficientTradingTrajectoryContinuous ettc = (EfficientTradingTrajectoryContinuous) ccte.generate(); - - R1ToR1 r1ToR1Holdings = ettc.holdings(); - - double[] adblHoldings = new double[iNumInterval]; - double[] adblExecutionTime = new double[iNumInterval]; - - for (int i = 1; i <= iNumInterval; ++i) { - adblExecutionTime[i - 1] = dblT * i / iNumInterval; - - adblHoldings[i - 1] = r1ToR1Holdings.evaluate (adblExecutionTime[i - 1]); - } - - String strDump = "\t|" + FormatUtil.FormatDouble (dblAlpha, 1, 1, 1.) + " =>"; - - for (int i = 0; i < adblExecutionTime.length; ++i) - strDump = strDump + FormatUtil.FormatDouble (adblHoldings[i] / dblX, 2, 1, 100.) + "% "; - - strDump = strDump + FormatUtil.FormatDouble (ettc.transactionCostExpectation(), 5, 0, 1.) + " | "; - - strDump = strDump + FormatUtil.FormatDouble (ettc.transactionCostVariance(), 5, 0, 1.e-06) + " | "; - - strDump = strDump + FormatUtil.FormatDouble (ettc.characteristicTime(), 1, 3, 1.) + " ||"; - - System.out.println (strDump); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblT = 5.; - int iNumInterval = 10; - - double[] adblAlpha = new double[] { - 0.0, - 0.1, - 0.2, - 0.3, - 0.4, - 0.5, - 0.6, - 0.7, - 0.8, - 0.9, - 1.0, - 1.1, - 1.2, - 1.3, - 1.4, - 1.5, - 1.6, - 1.7, - 1.8, - 1.9, - 2.0 - }; - - System.out.println(); - - System.out.println ("\t|--------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| ALMGREN (2003) CONSTANT TEMPORARY IMPACT VOLATILITY - OFFSET DEPENDENCE ||"); - - System.out.println ("\t|--------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| Alpha Level ||"); - - System.out.println ("\t| Outstanding Trajectory (%) ||"); - - System.out.println ("\t| Transaction Cost Expectation ||"); - - System.out.println ("\t| Transaction Cost Variance (X 10^-06) ||"); - - System.out.println ("\t| Characteristic Time (Days) ||"); - - System.out.println ("\t|--------------------------------------------------------------------------------------------------------------||"); - - String strTimeNode = "\t| "; - - for (int i = 0; i <= iNumInterval; ++i) - strTimeNode = strTimeNode + FormatUtil.FormatDouble (dblT * i / iNumInterval, 1, 2, 1.) + " "; - - System.out.println (strTimeNode); - - System.out.println ("\t|--------------------------------------------------------------------------------------------------------------||"); - - for (double dblAlpha : adblAlpha) - AlphaRun ( - dblAlpha, - dblT, - iNumInterval - ); - - System.out.println ("\t|--------------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/almgren2003/ConstantTradingEnhancedVolatility.java b/org/drip/sample/almgren2003/ConstantTradingEnhancedVolatility.java deleted file mode 100644 index fa36e57..0000000 --- a/org/drip/sample/almgren2003/ConstantTradingEnhancedVolatility.java +++ /dev/null @@ -1,170 +0,0 @@ - -package org.drip.sample.almgren2003; - -import org.drip.execution.capture.*; -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.ParticipationRateLinear; -import org.drip.execution.nonadaptive.ContinuousConstantTradingEnhanced; -import org.drip.execution.optimum.EfficientTradingTrajectoryContinuous; -import org.drip.execution.profiletime.UniformParticipationRateLinear; -import org.drip.execution.strategy.DiscreteTradingTrajectory; -import org.drip.function.definition.R1ToR1; -import org.drip.measure.gaussian.R1UnivariateNormal; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ConstantTradingEnhancedVolatility demonstrates the Generation of the Optimal Trading Trajectory under the - * Condition of Constant Trading Enhanced Volatility. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConstantTradingEnhancedVolatility { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblEta = 5.e-06; - double dblAlpha = 1.; - double dblSigma = 1.; - double dblLambda = 1.e-05; - double dblX = 100000.; - double dblT = 5.; - int iNumInterval = 50000; - - ArithmeticPriceEvolutionParameters apep = ArithmeticPriceEvolutionParametersBuilder.TradingEnhancedVolatility ( - dblSigma, - new UniformParticipationRateLinear (ParticipationRateLinear.SlopeOnly (dblEta)), - new UniformParticipationRateLinear ( - new ParticipationRateLinear ( - dblAlpha, - 0. - ) - ) - ); - - ContinuousConstantTradingEnhanced ccte = ContinuousConstantTradingEnhanced.Standard ( - dblX, - dblT, - apep, - dblLambda - ); - - EfficientTradingTrajectoryContinuous ettc = (EfficientTradingTrajectoryContinuous) ccte.generate(); - - R1ToR1 r1ToR1Holdings = ettc.holdings(); - - double[] adblHoldings = new double[iNumInterval]; - double[] adblExecutionTime = new double[iNumInterval]; - - for (int i = 1; i <= iNumInterval; ++i) { - adblExecutionTime[i - 1] = dblT * i / iNumInterval; - - adblHoldings[i - 1] = r1ToR1Holdings.evaluate (adblExecutionTime[i - 1]); - } - - DiscreteTradingTrajectory dtt = DiscreteTradingTrajectory.Standard ( - adblExecutionTime, - adblHoldings - ); - - TrajectoryShortfallEstimator tse = new TrajectoryShortfallEstimator (dtt); - - R1UnivariateNormal r1un = tse.totalCostDistributionSynopsis (apep); - - double[] adblTradeList = dtt.tradeList(); - - for (int i = 1; i < adblExecutionTime.length; ++i) { - System.out.println ("\t| " + - FormatUtil.FormatDouble (adblExecutionTime[i], 1, 4, 1.) + " => " + - FormatUtil.FormatDouble (adblHoldings[i] / dblX, 2, 4, 100.) + "% | " + - FormatUtil.FormatDouble (adblTradeList[i - 1] / dblX, 1, 4, 100.) + "% ||" - ); - } - - System.out.println ("\t|---------------------------------||"); - - System.out.println ("\n\t|--------------------------------------------------------------||"); - - System.out.println ("\t| TRANSACTION COST RECONCILIATION: EXPLICIT vs. ALMGREN 2003 ||"); - - System.out.println ("\t|--------------------------------------------------------------||"); - - System.out.println ( - "\t| Transaction Cost Expectation : " + - FormatUtil.FormatDouble (r1un.mean(), 6, 1, 1.) + " | " + - FormatUtil.FormatDouble (ettc.transactionCostExpectation(), 6, 1, 1.) + " ||" - ); - - System.out.println ( - "\t| Transaction Cost Variance (X 10^-06) : " + - FormatUtil.FormatDouble (r1un.variance(), 6, 1, 1.e-06) + " | " + - FormatUtil.FormatDouble (ettc.transactionCostVariance(), 6, 1, 1.e-06) + " ||" - ); - - System.out.println ("\t|--------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/almgren2003/ContinuousTrajectoryConcaveImpact.java b/org/drip/sample/almgren2003/ContinuousTrajectoryConcaveImpact.java deleted file mode 100644 index 9fec55c..0000000 --- a/org/drip/sample/almgren2003/ContinuousTrajectoryConcaveImpact.java +++ /dev/null @@ -1,196 +0,0 @@ - -package org.drip.sample.almgren2003; - -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.*; -import org.drip.execution.nonadaptive.ContinuousPowerImpact; -import org.drip.execution.optimum.PowerImpactContinuous; -import org.drip.execution.parameters.*; -import org.drip.execution.profiletime.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ContinuousTrajectoryConcaveImpact reconciles the Characteristic Times of the Optimal Continuous Trading - * Trajectory resulting from the Application of the Almgren (2003) Scheme to a Concave Power Law Temporary - * Market Impact Function. The Power Exponent Considered here is k=0.5. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * @author Lakshmi Krishnamurthy - */ - -public class ContinuousTrajectoryConcaveImpact { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblS0 = 50.; - double dblDailyVolume = 1000000.; - double dblBidAskSpread = 0.; - double dblPermanentImpactFactor = 0.; - double dblTemporaryImpactFactor = 0.01; - double dblK = 0.5; - double dblGamma = 0.; - double dblDailyVolumeExecutionFactor = 0.1; - double dblDrift = 0.; - double dblVolatility = 1.; - double dblSerialCorrelation = 0.; - double dblX = 100000.; - double dblFinishTime = 1.; - - double[] adblLambda = new double[] { - 1.e-03, - 1.e-04, - 1.e-05, - 1.e-06, - 1.e-07 - }; - - double[][] aadblAlmgren2003Reconciler = new double[][] { - {0.02, 221., 11.}, - {0.09, 103., 23.}, - {0.40, 48., 49.}, - {1.84, 22., 105.}, - {8.55, 10., 226.} - }; - - PriceMarketImpactPower pmip = new PriceMarketImpactPower ( - new AssetTransactionSettings ( - dblS0, - dblDailyVolume, - dblBidAskSpread - ), - dblPermanentImpactFactor, - dblTemporaryImpactFactor, - dblDailyVolumeExecutionFactor, - dblK - ); - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.Almgren2003 ( - new ArithmeticPriceDynamicsSettings ( - dblDrift, - new FlatUnivariate (dblVolatility), - dblSerialCorrelation - ), - new UniformParticipationRateLinear ( - new ParticipationRateLinear ( - 0., - dblGamma - ) - ), - new UniformParticipationRate ((ParticipationRatePower) pmip.temporaryTransactionFunction()) - ); - - System.out.println ("\n\t|-------------------------------------------||"); - - System.out.println ("\t| COMPUTED ||"); - - System.out.println ("\t|-------------------------------------------||"); - - System.out.println ("\t| LAMBDAINV || T_STAR | COST_EXP | COST_STD ||"); - - System.out.println ("\t|-------------------------------------------||"); - - for (int i = 0; i < adblLambda.length; ++i) { - ContinuousPowerImpact cpi = ContinuousPowerImpact.Standard ( - dblX, - dblFinishTime, - lpep, - adblLambda[i] - ); - - PowerImpactContinuous pic = (PowerImpactContinuous) cpi.generate(); - - System.out.println ("\t| " + - FormatUtil.FormatDouble (1. / adblLambda[i], 5, 0, 1.e-03) + " || " + - FormatUtil.FormatDouble (pic.characteristicTime(), 1, 2, 1.) + " " + - FormatUtil.FormatDouble (pic.transactionCostExpectation(), 3, 0, 1.e-03) + " " + - FormatUtil.FormatDouble (Math.sqrt (pic.transactionCostVariance()), 3, 0, 1.e-03) + " ||" - ); - } - - System.out.println ("\t|-------------------------------------------||"); - - System.out.println ("\n\t|-------------------------------------------||"); - - System.out.println ("\t| ALMGREN (2003) ||"); - - System.out.println ("\t|-------------------------------------------||"); - - System.out.println ("\t| LAMBDAINV || T_STAR | COST_EXP | COST_STD ||"); - - System.out.println ("\t|-------------------------------------------||"); - - for (int i = 0; i < adblLambda.length; ++i) - System.out.println ("\t| " + - FormatUtil.FormatDouble (1. / adblLambda[i], 5, 0, 1.e-03) + " || " + - FormatUtil.FormatDouble (aadblAlmgren2003Reconciler[i][0], 1, 2, 1.) + " " + - FormatUtil.FormatDouble (aadblAlmgren2003Reconciler[i][1], 3, 0, 1.) + " " + - FormatUtil.FormatDouble (aadblAlmgren2003Reconciler[i][2], 3, 0, 1.) + " ||" - ); - - System.out.println ("\t|-------------------------------------------||"); - } -} diff --git a/org/drip/sample/almgren2003/ContinuousTrajectoryConvexImpact.java b/org/drip/sample/almgren2003/ContinuousTrajectoryConvexImpact.java deleted file mode 100644 index 7a060e4..0000000 --- a/org/drip/sample/almgren2003/ContinuousTrajectoryConvexImpact.java +++ /dev/null @@ -1,196 +0,0 @@ - -package org.drip.sample.almgren2003; - -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.*; -import org.drip.execution.nonadaptive.ContinuousPowerImpact; -import org.drip.execution.optimum.PowerImpactContinuous; -import org.drip.execution.parameters.*; -import org.drip.execution.profiletime.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ContinuousTrajectoryConvexImpact reconciles the Characteristic Times of the Optimal Continuous Trading - * Trajectory resulting from the Application of the Almgren (2003) Scheme to a Convex Power Law Temporary - * Market Impact Function. The Power Exponent Considered here is k=2.0. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * @author Lakshmi Krishnamurthy - */ - -public class ContinuousTrajectoryConvexImpact { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblS0 = 50.; - double dblDailyVolume = 1000000.; - double dblBidAskSpread = 0.; - double dblPermanentImpactFactor = 0.; - double dblTemporaryImpactFactor = 0.01; - double dblK = 2.0; - double dblGamma = 0.; - double dblDailyVolumeExecutionFactor = 0.1; - double dblDrift = 0.; - double dblVolatility = 1.; - double dblSerialCorrelation = 0.; - double dblX = 100000.; - double dblFinishTime = 1.; - - double[] adblLambda = new double[] { - 1.e-03, - 1.e-04, - 1.e-05, - 1.e-06, - 1.e-07 - }; - - double[][] aadblAlmgren2003Reconciler = new double[][] { - {0.22, 462., 30.}, - {0.46, 99., 45.}, - {1.00, 21., 65.}, - {2.15, 5., 96.}, - {4.64, 1., 141.} - }; - - PriceMarketImpactPower pmip = new PriceMarketImpactPower ( - new AssetTransactionSettings ( - dblS0, - dblDailyVolume, - dblBidAskSpread - ), - dblPermanentImpactFactor, - dblTemporaryImpactFactor, - dblDailyVolumeExecutionFactor, - dblK - ); - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.Almgren2003 ( - new ArithmeticPriceDynamicsSettings ( - dblDrift, - new FlatUnivariate (dblVolatility), - dblSerialCorrelation - ), - new UniformParticipationRateLinear ( - new ParticipationRateLinear ( - 0., - dblGamma - ) - ), - new UniformParticipationRate ((ParticipationRatePower) pmip.temporaryTransactionFunction()) - ); - - System.out.println ("\n\t|-------------------------------------------||"); - - System.out.println ("\t| COMPUTED ||"); - - System.out.println ("\t|-------------------------------------------||"); - - System.out.println ("\t| LAMBDAINV || T_STAR | COST_EXP | COST_STD ||"); - - System.out.println ("\t|-------------------------------------------||"); - - for (int i = 0; i < adblLambda.length; ++i) { - ContinuousPowerImpact cpi = ContinuousPowerImpact.Standard ( - dblX, - dblFinishTime, - lpep, - adblLambda[i] - ); - - PowerImpactContinuous pic = (PowerImpactContinuous) cpi.generate(); - - System.out.println ("\t| " + - FormatUtil.FormatDouble (1. / adblLambda[i], 5, 0, 1.e-03) + " || " + - FormatUtil.FormatDouble (pic.characteristicTime(), 1, 2, 1.) + " " + - FormatUtil.FormatDouble (pic.transactionCostExpectation(), 3, 0, 1.e-03) + " " + - FormatUtil.FormatDouble (Math.sqrt (pic.transactionCostVariance()), 3, 0, 1.e-03) + " ||" - ); - } - - System.out.println ("\t|-------------------------------------------||"); - - System.out.println ("\n\t|-------------------------------------------||"); - - System.out.println ("\t| ALMGREN (2003) ||"); - - System.out.println ("\t|-------------------------------------------||"); - - System.out.println ("\t| LAMBDAINV || T_STAR | COST_EXP | COST_STD ||"); - - System.out.println ("\t|-------------------------------------------||"); - - for (int i = 0; i < adblLambda.length; ++i) - System.out.println ("\t| " + - FormatUtil.FormatDouble (1. / adblLambda[i], 5, 0, 1.e-03) + " || " + - FormatUtil.FormatDouble (aadblAlmgren2003Reconciler[i][0], 1, 2, 1.) + " " + - FormatUtil.FormatDouble (aadblAlmgren2003Reconciler[i][1], 3, 0, 1.) + " " + - FormatUtil.FormatDouble (aadblAlmgren2003Reconciler[i][2], 3, 0, 1.) + " ||" - ); - - System.out.println ("\t|-------------------------------------------||"); - } -} diff --git a/org/drip/sample/almgren2003/ContinuousTrajectoryLinearImpact.java b/org/drip/sample/almgren2003/ContinuousTrajectoryLinearImpact.java deleted file mode 100644 index 9a87686..0000000 --- a/org/drip/sample/almgren2003/ContinuousTrajectoryLinearImpact.java +++ /dev/null @@ -1,196 +0,0 @@ - -package org.drip.sample.almgren2003; - -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.*; -import org.drip.execution.nonadaptive.ContinuousPowerImpact; -import org.drip.execution.optimum.PowerImpactContinuous; -import org.drip.execution.parameters.*; -import org.drip.execution.profiletime.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ContinuousTrajectoryLinearImpact reconciles the Characteristic Times of the Optimal Continuous Trading - * Trajectory resulting from the Application of the Almgren (2003) Scheme to a Linear Power Law Temporary - * Market Impact Function. The Power Exponent Considered here is k=1.0. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * @author Lakshmi Krishnamurthy - */ - -public class ContinuousTrajectoryLinearImpact { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblS0 = 50.; - double dblDailyVolume = 1000000.; - double dblBidAskSpread = 0.; - double dblPermanentImpactFactor = 0.; - double dblTemporaryImpactFactor = 0.01; - double dblK = 1.0; - double dblGamma = 0.; - double dblDailyVolumeExecutionFactor = 0.1; - double dblDrift = 0.; - double dblVolatility = 1.; - double dblSerialCorrelation = 0.; - double dblX = 100000.; - double dblFinishTime = 1.; - - double[] adblLambda = new double[] { - 1.e-03, - 1.e-04, - 1.e-05, - 1.e-06, - 1.e-07 - }; - - double[][] aadblAlmgren2003Reconciler = new double[][] { - {0.07, 354., 19.}, - {0.22, 112., 33.}, - {0.71, 35., 59.}, - {2.24, 11., 106.}, - {7.07, 4., 188.} - }; - - PriceMarketImpactPower pmip = new PriceMarketImpactPower ( - new AssetTransactionSettings ( - dblS0, - dblDailyVolume, - dblBidAskSpread - ), - dblPermanentImpactFactor, - dblTemporaryImpactFactor, - dblDailyVolumeExecutionFactor, - dblK - ); - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.Almgren2003 ( - new ArithmeticPriceDynamicsSettings ( - dblDrift, - new FlatUnivariate (dblVolatility), - dblSerialCorrelation - ), - new UniformParticipationRateLinear ( - new ParticipationRateLinear ( - 0., - dblGamma - ) - ), - new UniformParticipationRate ((ParticipationRatePower) pmip.temporaryTransactionFunction()) - ); - - System.out.println ("\n\t|-------------------------------------------||"); - - System.out.println ("\t| COMPUTED ||"); - - System.out.println ("\t|-------------------------------------------||"); - - System.out.println ("\t| LAMBDAINV || T_STAR | COST_EXP | COST_STD ||"); - - System.out.println ("\t|-------------------------------------------||"); - - for (int i = 0; i < adblLambda.length; ++i) { - ContinuousPowerImpact cpi = ContinuousPowerImpact.Standard ( - dblX, - dblFinishTime, - lpep, - adblLambda[i] - ); - - PowerImpactContinuous pic = (PowerImpactContinuous) cpi.generate(); - - System.out.println ("\t| " + - FormatUtil.FormatDouble (1. / adblLambda[i], 5, 0, 1.e-03) + " || " + - FormatUtil.FormatDouble (pic.characteristicTime(), 1, 2, 1.) + " " + - FormatUtil.FormatDouble (pic.transactionCostExpectation(), 3, 0, 1.e-03) + " " + - FormatUtil.FormatDouble (Math.sqrt (pic.transactionCostVariance()), 3, 0, 1.e-03) + " ||" - ); - } - - System.out.println ("\t|-------------------------------------------||"); - - System.out.println ("\n\t|-------------------------------------------||"); - - System.out.println ("\t| ALMGREN (2003) ||"); - - System.out.println ("\t|-------------------------------------------||"); - - System.out.println ("\t| LAMBDAINV || T_STAR | COST_EXP | COST_STD ||"); - - System.out.println ("\t|-------------------------------------------||"); - - for (int i = 0; i < adblLambda.length; ++i) - System.out.println ("\t| " + - FormatUtil.FormatDouble (1. / adblLambda[i], 5, 0, 1.e-03) + " || " + - FormatUtil.FormatDouble (aadblAlmgren2003Reconciler[i][0], 1, 2, 1.) + " " + - FormatUtil.FormatDouble (aadblAlmgren2003Reconciler[i][1], 3, 0, 1.) + " " + - FormatUtil.FormatDouble (aadblAlmgren2003Reconciler[i][2], 3, 0, 1.) + " ||" - ); - - System.out.println ("\t|-------------------------------------------||"); - } -} diff --git a/org/drip/sample/almgren2003/LinearLiquidityVolatility.java b/org/drip/sample/almgren2003/LinearLiquidityVolatility.java deleted file mode 100644 index 4ee484d..0000000 --- a/org/drip/sample/almgren2003/LinearLiquidityVolatility.java +++ /dev/null @@ -1,206 +0,0 @@ - -package org.drip.sample.almgren2003; - -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.ParticipationRateLinear; -import org.drip.execution.nonadaptive.DiscreteLinearTradingEnhanced; -import org.drip.execution.optimum.TradingEnhancedDiscrete; -import org.drip.execution.profiletime.UniformParticipationRateLinear; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * LinearLiquidityVolatility demonstrates the Dependence of the Optimal Trading Trajectory as a Function of - * Linear Trading Enhanced Volatilities. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * @author Lakshmi Krishnamurthy - */ - -public class LinearLiquidityVolatility { - - private static final void BetaRun ( - final double dblBeta, - final double dblT, - final int iNumInterval) - throws Exception - { - double dblEta = 5.e-06; - double dblSigma = 1.; - double dblLambda = 1.e-05; - double dblX = 100000.; - - ArithmeticPriceEvolutionParameters apep = ArithmeticPriceEvolutionParametersBuilder.TradingEnhancedVolatility ( - dblSigma, - new UniformParticipationRateLinear (ParticipationRateLinear.SlopeOnly (dblEta)), - new UniformParticipationRateLinear ( - new ParticipationRateLinear ( - 0., - dblBeta - ) - ) - ); - - DiscreteLinearTradingEnhanced dlte = DiscreteLinearTradingEnhanced.Standard ( - dblX, - dblT, - iNumInterval, - apep, - dblLambda - ); - - TradingEnhancedDiscrete ted = (TradingEnhancedDiscrete) dlte.generate(); - - double[] adblExecutionTimeNode = ted.executionTimeNode(); - - double[] adblHoldings = ted.holdings(); - - String strDump = "\t|" + FormatUtil.FormatDouble (dblBeta, 1, 1, 1.e+06) + " =>"; - - for (int i = 0; i < adblExecutionTimeNode.length; ++i) - strDump = strDump + FormatUtil.FormatDouble (adblHoldings[i] / dblX, 2, 1, 100.) + "% "; - - strDump = strDump + FormatUtil.FormatDouble (ted.transactionCostExpectation(), 5, 0, 1.) + " | "; - - strDump = strDump + FormatUtil.FormatDouble (ted.transactionCostVariance(), 5, 0, 1.e-06) + " | "; - - strDump = strDump + FormatUtil.FormatDouble (ted.characteristicTime(), 1, 3, 1.) + " | "; - - strDump = strDump + FormatUtil.FormatDouble (ted.characteristicSize(), 6, 0, 1.) + " ||"; - - System.out.println (strDump); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblT = 5.; - int iNumInterval = 10; - - double[] adblBeta = new double[] { - 0.1, - 0.2, - 0.3, - 0.4, - 0.5, - 0.6, - 0.7, - 0.8, - 0.9, - 1.0, - 1.1, - 1.2, - 1.3, - 1.4, - 1.5, - 1.6, - 1.7, - 1.8, - 1.9, - 2.0 - }; - - System.out.println(); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| ALMGREN (2003) LINEAR TEMPORARY IMPACT VOLATILITY - OFFSET DEPENDENCE ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| Beta Level (X 10^06) ||"); - - System.out.println ("\t| Outstanding Trajectory (%) ||"); - - System.out.println ("\t| Transaction Cost Expectation ||"); - - System.out.println ("\t| Transaction Cost Variance (X 10^-06) ||"); - - System.out.println ("\t| Characteristic Time (Days) ||"); - - System.out.println ("\t| Characteristic Size ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------||"); - - String strTimeNode = "\t| "; - - for (int i = 0; i <= iNumInterval; ++i) - strTimeNode = strTimeNode + FormatUtil.FormatDouble (dblT * i / iNumInterval, 1, 2, 1.) + " "; - - System.out.println (strTimeNode); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------||"); - - for (double dblBeta : adblBeta) - BetaRun ( - dblBeta * 1.e-06, - dblT, - iNumInterval - ); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/almgren2003/PowerLawOptimalTrajectory.java b/org/drip/sample/almgren2003/PowerLawOptimalTrajectory.java deleted file mode 100644 index 18f39b5..0000000 --- a/org/drip/sample/almgren2003/PowerLawOptimalTrajectory.java +++ /dev/null @@ -1,218 +0,0 @@ - -package org.drip.sample.almgren2003; - -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.*; -import org.drip.execution.nonadaptive.ContinuousPowerImpact; -import org.drip.execution.optimum.PowerImpactContinuous; -import org.drip.execution.parameters.ArithmeticPriceDynamicsSettings; -import org.drip.execution.profiletime.*; -import org.drip.function.definition.R1ToR1; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PowerLawOptimalTrajectory sketches out the Optimal Trajectories for 3 different values of k - representing - * Concave, Linear, and Convex Power's respectively. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * @author Lakshmi Krishnamurthy - */ - -public class PowerLawOptimalTrajectory { - - private static final void RiskAversionRun ( - final double dblLambda) - throws Exception - { - double dblGamma = 0.; - double dblHRef = 0.50; - double dblVRef = 100000.; - double dblDrift = 0.; - double dblVolatility = 1.; - double dblSerialCorrelation = 0.; - double dblX = 100000.; - double dblFinishTime = 10.; - int iNumInterval = 10; - - double[] adblK = new double[] { - 0.25, - 0.50, - 0.75, - 1.00, - 1.25, - 1.50, - 1.75, - 2.00, - 2.25, - 2.50, - 2.75, - 3.00 - }; - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|\tPOWER LAW OPTIMAL TRAJECTORY; RISK TOLERANCE (thousands) => " + FormatUtil.FormatDouble (1. / dblLambda, 1, 0, 1.e-03)); - - System.out.println ("\t|"); - - System.out.println ("\t|\t\tL -> R:"); - - System.out.println ("\t|\t\t\tTime Node Trajectory Realization (Percent)"); - - System.out.println ("\t|\t\t\tCharacteristic Time (Days)"); - - System.out.println ("\t|\t\t\tMaximum Execution Time (Days)"); - - System.out.println ("\t|\t\t\tTransaction Cost Expectation (Thousands)"); - - System.out.println ("\t|\t\t\tTransaction Cost Variance (Thousands)"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------||"); - - ArithmeticPriceDynamicsSettings apds = new ArithmeticPriceDynamicsSettings ( - dblDrift, - new FlatUnivariate (dblVolatility), - dblSerialCorrelation - ); - - ParticipationRateLinear prlPermanent = new ParticipationRateLinear ( - 0., - dblGamma - ); - - double[] adblExecutionTime = new double[iNumInterval]; - - for (int i = 1; i <= iNumInterval; ++i) - adblExecutionTime[i - 1] = ((double) i) / ((double) iNumInterval); - - for (int i = 0; i < adblK.length; ++i) { - double dblEta = dblHRef / java.lang.Math.pow (dblVRef, adblK[i]); - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.Almgren2003 ( - apds, - new UniformParticipationRateLinear (prlPermanent), - new UniformParticipationRate ( - new ParticipationRatePower ( - dblEta, - adblK[i] - ) - ) - ); - - ContinuousPowerImpact cpi = ContinuousPowerImpact.Standard ( - dblX, - dblFinishTime, - lpep, - dblLambda - ); - - PowerImpactContinuous pic = (PowerImpactContinuous) cpi.generate(); - - if (0 == i) { - String strExecutionTime = "\t| | "; - - for (int j = 0; j < adblExecutionTime.length; ++j) - strExecutionTime = strExecutionTime + " " + FormatUtil.FormatDouble (adblExecutionTime[j], 1, 2, 1.); - - System.out.println (strExecutionTime); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------||"); - } - - R1ToR1 r1ToR1Holdings = pic.holdings(); - - String strHoldings = "\t| k =" + FormatUtil.FormatDouble (adblK[i], 1, 2, 1.) + " | "; - - for (int j = 0; j < iNumInterval; ++j) - strHoldings = strHoldings + " " + FormatUtil.FormatDouble (r1ToR1Holdings.evaluate (adblExecutionTime[j]) / dblX, 2, 2, 100.); - - double dblExecutionTimeUpperBound = pic.executionTimeUpperBound(); - - System.out.println ( - strHoldings + " | " + - FormatUtil.FormatDouble (pic.characteristicTime(), 2, 1, 1.) + " | " + - FormatUtil.FormatDouble (Double.isNaN (dblExecutionTimeUpperBound) ? 0. : dblExecutionTimeUpperBound, 2, 1, 1.) + " | " + - FormatUtil.FormatDouble (pic.transactionCostExpectation(), 3, 0, 1.e-03) + " | " + - FormatUtil.FormatDouble (Math.sqrt (pic.transactionCostVariance()), 3, 0, 1.e-03) + " ||" - ); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------||"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double[] adblLambda = new double[] { - 1.e-04, - 5.e-06, - 5.e-07 - }; - - for (double dblLambda : adblLambda) - RiskAversionRun (dblLambda); - } -} diff --git a/org/drip/sample/almgren2009/AdaptiveOptimalCostTrajectory.java b/org/drip/sample/almgren2009/AdaptiveOptimalCostTrajectory.java deleted file mode 100644 index 44e6809..0000000 --- a/org/drip/sample/almgren2009/AdaptiveOptimalCostTrajectory.java +++ /dev/null @@ -1,189 +0,0 @@ - -package org.drip.sample.almgren2009; - -import org.drip.execution.hjb.*; -import org.drip.execution.latent.MarketStateSystemic; -import org.drip.measure.dynamics.DiffusionEvaluatorOrnsteinUhlenbeck; -import org.drip.measure.process.DiffusionEvolver; -import org.drip.measure.realization.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AdaptiveOptimalCostTrajectory traces a Sample Realization of the Adaptive Cost Strategy using the Market - * State Trajectory the follows the Zero Mean Ornstein-Uhlenbeck Evolution Dynamics. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Walia, N. (2006): Optimal Trading: Dynamic Stock Liquidation Strategies, Senior Thesis, Princeton - * University. - * - * @author Lakshmi Krishnamurthy - */ - -public class AdaptiveOptimalCostTrajectory { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblTime = 0.; - double dblBurstiness = 1.; - double dblDimensionlessRiskAversion = 0.1; - double dblRelaxationTime = 1.; - double dblSimulationTime = 10.; - double dblTimeInterval = 0.25; - double dblInitialMarketState = -0.5; - - double dblNonDimensionalHoldings = 1.; - int iNumTimeNode = (int) (dblSimulationTime / dblTimeInterval); - MarketStateSystemic[] aMSS = new MarketStateSystemic[iNumTimeNode + 1]; - - aMSS[0] = new MarketStateSystemic (dblInitialMarketState); - - DiffusionEvaluatorOrnsteinUhlenbeck deou = DiffusionEvaluatorOrnsteinUhlenbeck.ZeroMean ( - dblBurstiness, - dblRelaxationTime - ); - - DiffusionEvolver oup1D = new DiffusionEvolver (deou); - - for (int i = 0; i < iNumTimeNode; ++i) { - JumpDiffusionEdge gi = oup1D.weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - aMSS[i].common(), - 0., - false - ), - dblTimeInterval - ); - - dblTime += dblTimeInterval; - - aMSS[i + 1] = new MarketStateSystemic (aMSS[i].common() + gi.deterministic() + gi.diffusionStochastic()); - } - - NonDimensionalCostEvolverSystemic ndces = NonDimensionalCostEvolverSystemic.Standard (deou); - - NonDimensionalCostSystemic ndcs = NonDimensionalCostSystemic.Zero(); - - System.out.println(); - - System.out.println ("\t||-------------------------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Non Dimensional Time ||"); - - System.out.println ("\t|| - Realized Market State ||"); - - System.out.println ("\t|| - Non Dimensional Cost ||"); - - System.out.println ("\t|| - Non Dimensional Cost Gradient ||"); - - System.out.println ("\t|| - Non Dimensional Cost Jacobian ||"); - - System.out.println ("\t|| - Non Dimensional Cost Trade Velocity ||"); - - System.out.println ("\t|| - Non Dimensional Outstanding Holdings ||"); - - System.out.println ("\t||-------------------------------------------------------------------||"); - - System.out.println ("\t||" + - FormatUtil.FormatDouble (0., 1, 2, 1.) + " => " + - FormatUtil.FormatDouble (aMSS[0].common(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (ndcs.realization(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (ndcs.gradient(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (ndcs.jacobian(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (ndcs.nonDimensionalTradeRate(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (dblNonDimensionalHoldings, 1, 4, 1.) + " ||" - ); - - for (int i = 1; i < iNumTimeNode; ++i) { - ndcs = (NonDimensionalCostSystemic) ndces.evolve ( - ndcs, - aMSS[i], - dblDimensionlessRiskAversion, - (iNumTimeNode - i) * dblTimeInterval, - dblTimeInterval - ); - - double dblNonDimensionalTradeRate = dblNonDimensionalHoldings * ndcs.nonDimensionalTradeRate(); - - dblNonDimensionalHoldings = dblNonDimensionalHoldings - dblNonDimensionalTradeRate * dblTimeInterval; - - System.out.println ("\t||" + - FormatUtil.FormatDouble (dblTimeInterval * i, 1, 2, 1.) + " => " + - FormatUtil.FormatDouble (aMSS[i].common(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (ndcs.realization(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (ndcs.gradient(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (ndcs.jacobian(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (dblNonDimensionalTradeRate, 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (dblNonDimensionalHoldings, 1, 4, 1.) + " ||" - ); - } - - System.out.println ("\t||-------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/almgren2009/AdaptiveOptimalHJBTrajectory.java b/org/drip/sample/almgren2009/AdaptiveOptimalHJBTrajectory.java deleted file mode 100644 index 916f087..0000000 --- a/org/drip/sample/almgren2009/AdaptiveOptimalHJBTrajectory.java +++ /dev/null @@ -1,268 +0,0 @@ - -package org.drip.sample.almgren2009; - -import org.drip.execution.adaptive.*; -import org.drip.execution.hjb.*; -import org.drip.execution.latent.*; -import org.drip.execution.risk.MeanVarianceObjectiveUtility; -import org.drip.execution.strategy.OrderSpecification; -import org.drip.execution.tradingtime.CoordinatedVariation; -import org.drip.measure.dynamics.DiffusionEvaluatorOrnsteinUhlenbeck; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AdaptiveOptimalHJBTrajectory simulates the Outstanding Holdings and the Trade Rate from the Sample - * Realization of the HJB Based Adaptive Cost Strategy using the Market State Trajectory the follows the - * Zero Mean Ornstein-Uhlenbeck Evolution Dynamics. The Initial Dynamics is derived from the "Mean Market - * State" Initial Static Trajectory. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Walia, N. (2006): Optimal Trading: Dynamic Stock Liquidation Strategies, Senior Thesis, Princeton - * University. - * - * @author Lakshmi Krishnamurthy - */ - -public class AdaptiveOptimalHJBTrajectory { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblSize = 1.; - int iNumTimeNode = 41; - double dblBurstiness = 1.; - double dblExecutionTime = 10.; - double dblRelaxationTime = 1.; - double dblReferenceLiquidity = 1.; - double dblReferenceVolatility = 1.; - double dblInitialMarketState = -0.5; - double dblRiskAversion = 0.5; - - System.out.println(); - - System.out.println ("\t||--------------------------------------------------------||"); - - System.out.println ("\t|| ADAPTIVE OPTIMAL TRAJECTORY GENERATION INPUTS ||"); - - System.out.println ("\t||--------------------------------------------------------||"); - - System.out.println ( - "\t|| Order Size => " + - FormatUtil.FormatDouble (dblSize, 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Order Execution Time => " + - FormatUtil.FormatDouble (dblExecutionTime, 2, 0, 1.) + " ||" - ); - - System.out.println ( - "\t|| Ornstein Uhlenbeck Burstiness => " + - FormatUtil.FormatDouble (dblBurstiness, 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Ornstein Uhlenbeck Relaxation Time => " + - FormatUtil.FormatDouble (dblRelaxationTime, 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Coordinated Variation Reference Liquidity => " + - FormatUtil.FormatDouble (dblReferenceLiquidity, 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Coordinated Variation Reference Volatility => " + - FormatUtil.FormatDouble (dblReferenceVolatility, 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Mean Variance Risk Aversion => " + - FormatUtil.FormatDouble (dblReferenceVolatility, 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Number of Evolution Nodes => " + - FormatUtil.FormatDouble (iNumTimeNode - 1, 2, 0, 1.) + " ||" - ); - - System.out.println ("\t||--------------------------------------------------------||"); - - System.out.println(); - - double dblNonDimensionalTimeInterval = dblExecutionTime / (iNumTimeNode - 1) / dblRelaxationTime; - - OrderSpecification os = new OrderSpecification ( - dblSize, - dblExecutionTime - ); - - CoordinatedVariation cv = new CoordinatedVariation ( - dblReferenceVolatility, - dblReferenceLiquidity - ); - - DiffusionEvaluatorOrnsteinUhlenbeck deou = DiffusionEvaluatorOrnsteinUhlenbeck.ZeroMean ( - dblBurstiness, - dblRelaxationTime - ); - - MarketState[] aMS = OrnsteinUhlenbeckSequence.Systemic ( - deou, - dblNonDimensionalTimeInterval * dblRelaxationTime, - dblInitialMarketState, - iNumTimeNode - ).realizedMarketState(); - - CoordinatedVariationDynamic cvd = new CoordinatedVariationTrajectoryGenerator ( - os, - cv, - new MeanVarianceObjectiveUtility (dblRiskAversion), - NonDimensionalCostEvolverSystemic.Standard (deou), - CoordinatedVariationTrajectoryGenerator.TRADE_RATE_STATIC_INITIALIZATION - ).adaptive (aMS); - - double[] adblNonDimensionalHoldings = cvd.nonDimensionalHoldings(); - - double[] adblNonDimensionalTradeRate = cvd.scaledNonDimensionalTradeRate(); - - NonDimensionalCost[] aNDC = cvd.nonDimensionalCost(); - - System.out.println ("\t||-------------------------------------||"); - - System.out.println ("\t|| ADAPTIVE OPTIMAL TRAJECTORY ||"); - - System.out.println ("\t||-------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Time ||"); - - System.out.println ("\t|| - Holdings ||"); - - System.out.println ("\t|| - Trade Rate ||"); - - System.out.println ("\t|| - Realized Cost ||"); - - System.out.println ("\t||-------------------------------------||"); - - for (int i = 0; i < iNumTimeNode - 1; ++i) { - String strDump = "\t|| " + FormatUtil.FormatDouble (i * dblNonDimensionalTimeInterval * dblRelaxationTime, 1, 2, 1.); - - strDump = strDump + " | " + FormatUtil.FormatDouble (adblNonDimensionalHoldings[i], 1, 4, 1.); - - strDump = strDump + " | " + FormatUtil.FormatDouble (adblNonDimensionalTradeRate[i], 1, 4, 1.); - - strDump = strDump + " | " + FormatUtil.FormatDouble (aNDC[i].realization(), 1, 4, 1.); - - System.out.println (strDump + " ||"); - } - - System.out.println ("\t||-------------------------------------||"); - - System.out.println(); - - CoordinatedVariationTrajectoryDeterminant cvtd = cvd.trajectoryDeterminant(); - - System.out.println ("\t||---------------------------------||"); - - System.out.println ("\t|| OPTIMAL TRAJECTORY OUTPUTS ||"); - - System.out.println ("\t||---------------------------------||"); - - System.out.println ( - "\t|| Time Scale => " + - FormatUtil.FormatDouble (cvtd.timeScale(), 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Trade Rate Scale => " + - FormatUtil.FormatDouble (cvtd.tradeRateScale(), 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Cost Scale => " + - FormatUtil.FormatDouble (cvtd.costScale(), 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Mean Market Urgency => " + - FormatUtil.FormatDouble (cvtd.meanMarketUrgency(), 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Market Power => " + - FormatUtil.FormatDouble (cvtd.marketPower(), 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Risk Aversion Scale => " + - FormatUtil.FormatDouble (cvtd.nonDimensionalRiskAversion(), 1, 4, 1.) + " ||" - ); - - System.out.println ("\t||---------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/almgren2009/AdaptiveOptimalRollingHorizonTrajectory.java b/org/drip/sample/almgren2009/AdaptiveOptimalRollingHorizonTrajectory.java deleted file mode 100644 index ae8d789..0000000 --- a/org/drip/sample/almgren2009/AdaptiveOptimalRollingHorizonTrajectory.java +++ /dev/null @@ -1,268 +0,0 @@ - -package org.drip.sample.almgren2009; - -import org.drip.execution.adaptive.*; -import org.drip.execution.hjb.NonDimensionalCostEvolverSystemic; -import org.drip.execution.latent.*; -import org.drip.execution.risk.MeanVarianceObjectiveUtility; -import org.drip.execution.strategy.OrderSpecification; -import org.drip.execution.tradingtime.CoordinatedVariation; -import org.drip.measure.dynamics.DiffusionEvaluatorOrnsteinUhlenbeck; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AdaptiveOptimalRollingHorizonTrajectory simulates the Outstanding Holdings and the Trade Rate from the - * Sample Realization of the Rolling Horizon Approximation of the HJB Based Adaptive Cost Strategy using the - * Market State Trajectory the follows the Zero Mean Ornstein-Uhlenbeck Evolution Dynamics. The References - * are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Walia, N. (2006): Optimal Trading: Dynamic Stock Liquidation Strategies, Senior Thesis, Princeton - * University. - * - * @author Lakshmi Krishnamurthy - */ - -public class AdaptiveOptimalRollingHorizonTrajectory { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblSize = 1.; - int iNumTimeNode = 41; - double dblBurstiness = 1.; - double dblExecutionTime = 10.; - double dblRelaxationTime = 1.; - double dblReferenceLiquidity = 1.; - double dblReferenceVolatility = 1.; - double dblInitialMarketState = -0.5; - double dblRiskAversion = 0.5; - - System.out.println(); - - System.out.println ("\t||--------------------------------------------------------||"); - - System.out.println ("\t|| ADAPTIVE OPTIMAL TRAJECTORY GENERATION INPUTS ||"); - - System.out.println ("\t||--------------------------------------------------------||"); - - System.out.println ( - "\t|| Order Size => " + - FormatUtil.FormatDouble (dblSize, 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Order Execution Time => " + - FormatUtil.FormatDouble (dblExecutionTime, 2, 0, 1.) + " ||" - ); - - System.out.println ( - "\t|| Ornstein Uhlenbeck Burstiness => " + - FormatUtil.FormatDouble (dblBurstiness, 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Ornstein Uhlenbeck Relaxation Time => " + - FormatUtil.FormatDouble (dblRelaxationTime, 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Coordinated Variation Reference Liquidity => " + - FormatUtil.FormatDouble (dblReferenceLiquidity, 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Coordinated Variation Reference Volatility => " + - FormatUtil.FormatDouble (dblReferenceVolatility, 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Mean Variance Risk Aversion => " + - FormatUtil.FormatDouble (dblReferenceVolatility, 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Number of Evolution Nodes => " + - FormatUtil.FormatDouble (iNumTimeNode - 1, 2, 0, 1.) + " ||" - ); - - System.out.println ("\t||--------------------------------------------------------||"); - - System.out.println(); - - double dblNonDimensionalTimeInterval = dblExecutionTime / (iNumTimeNode - 1) / dblRelaxationTime; - - OrderSpecification os = new OrderSpecification ( - dblSize, - dblExecutionTime - ); - - CoordinatedVariation cv = new CoordinatedVariation ( - dblReferenceVolatility, - dblReferenceLiquidity - ); - - DiffusionEvaluatorOrnsteinUhlenbeck deou = DiffusionEvaluatorOrnsteinUhlenbeck.ZeroMean ( - dblBurstiness, - dblRelaxationTime - ); - - MarketState[] aMS = OrnsteinUhlenbeckSequence.Systemic ( - deou, - dblNonDimensionalTimeInterval * dblRelaxationTime, - dblInitialMarketState, - iNumTimeNode - ).realizedMarketState(); - - CoordinatedVariationRollingHorizon cvrh = new CoordinatedVariationTrajectoryGenerator ( - os, - cv, - new MeanVarianceObjectiveUtility (dblRiskAversion), - NonDimensionalCostEvolverSystemic.Standard (deou), - CoordinatedVariationTrajectoryGenerator.TRADE_RATE_STATIC_INITIALIZATION - ).rollingHorizon (aMS); - - double[] adblNonDimensionalHoldings = cvrh.nonDimensionalHoldings(); - - double[] adblNonDimensionalTradeRate = cvrh.nonDimensionalTradeRate(); - - double[] adblNonDimensionalCost = cvrh.nonDimensionalCost(); - - System.out.println ("\t||-------------------------------------||"); - - System.out.println ("\t|| ADAPTIVE OPTIMAL TRAJECTORY ||"); - - System.out.println ("\t||-------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Time ||"); - - System.out.println ("\t|| - Holdings ||"); - - System.out.println ("\t|| - Trade Rate ||"); - - System.out.println ("\t|| - Realized Cost ||"); - - System.out.println ("\t||-------------------------------------||"); - - for (int i = 0; i < iNumTimeNode - 1; ++i) { - String strDump = "\t|| " + FormatUtil.FormatDouble (i * dblNonDimensionalTimeInterval * dblRelaxationTime, 1, 2, 1.); - - strDump = strDump + " | " + FormatUtil.FormatDouble (adblNonDimensionalHoldings[i], 1, 4, 1.); - - strDump = strDump + " | " + FormatUtil.FormatDouble (adblNonDimensionalTradeRate[i], 1, 4, 1.); - - strDump = strDump + " | " + FormatUtil.FormatDouble (adblNonDimensionalCost[i], 1, 4, 1.); - - System.out.println (strDump + " ||"); - } - - System.out.println ("\t||-------------------------------------||"); - - System.out.println(); - - CoordinatedVariationTrajectoryDeterminant cvtd = cvrh.trajectoryDeterminant(); - - System.out.println ("\t||---------------------------------||"); - - System.out.println ("\t|| OPTIMAL TRAJECTORY OUTPUTS ||"); - - System.out.println ("\t||---------------------------------||"); - - System.out.println ( - "\t|| Time Scale => " + - FormatUtil.FormatDouble (cvtd.timeScale(), 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Trade Rate Scale => " + - FormatUtil.FormatDouble (cvtd.tradeRateScale(), 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Cost Scale => " + - FormatUtil.FormatDouble (cvtd.costScale(), 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Mean Market Urgency => " + - FormatUtil.FormatDouble (cvtd.meanMarketUrgency(), 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Market Power => " + - FormatUtil.FormatDouble (cvtd.marketPower(), 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Risk Aversion Scale => " + - FormatUtil.FormatDouble (cvtd.nonDimensionalRiskAversion(), 1, 4, 1.) + " ||" - ); - - System.out.println ("\t||---------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/almgren2009/AdaptiveOptimalStaticTrajectory.java b/org/drip/sample/almgren2009/AdaptiveOptimalStaticTrajectory.java deleted file mode 100644 index 05343e9..0000000 --- a/org/drip/sample/almgren2009/AdaptiveOptimalStaticTrajectory.java +++ /dev/null @@ -1,264 +0,0 @@ - -package org.drip.sample.almgren2009; - -import org.drip.execution.adaptive.*; -import org.drip.execution.hjb.NonDimensionalCostEvolverSystemic; -import org.drip.execution.optimum.EfficientTradingTrajectoryContinuous; -import org.drip.execution.risk.MeanVarianceObjectiveUtility; -import org.drip.execution.strategy.OrderSpecification; -import org.drip.execution.tradingtime.CoordinatedVariation; -import org.drip.function.definition.R1ToR1; -import org.drip.measure.dynamics.DiffusionEvaluatorOrnsteinUhlenbeck; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AdaptiveOptimalStaticTrajectory determines the Outstanding Holdings and the Trade Rate from the "Mean - * Market State" Static Trajectory using the Market State Trajectory the follows the Zero Mean - * Ornstein-Uhlenbeck Evolution Dynamics. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Walia, N. (2006): Optimal Trading: Dynamic Stock Liquidation Strategies, Senior Thesis, Princeton - * University. - * - * @author Lakshmi Krishnamurthy - */ - -public class AdaptiveOptimalStaticTrajectory { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblSize = 1.; - int iNumTimeNode = 41; - double dblBurstiness = 1.; - double dblExecutionTime = 10.; - double dblRelaxationTime = 1.; - double dblReferenceLiquidity = 1.; - double dblReferenceVolatility = 1.; - double dblRiskAversion = 0.5; - - System.out.println(); - - System.out.println ("\t||--------------------------------------------------------||"); - - System.out.println ("\t|| ADAPTIVE OPTIMAL TRAJECTORY GENERATION INPUTS ||"); - - System.out.println ("\t||--------------------------------------------------------||"); - - System.out.println ( - "\t|| Order Size => " + - FormatUtil.FormatDouble (dblSize, 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Order Execution Time => " + - FormatUtil.FormatDouble (dblExecutionTime, 2, 0, 1.) + " ||" - ); - - System.out.println ( - "\t|| Ornstein Uhlenbeck Burstiness => " + - FormatUtil.FormatDouble (dblBurstiness, 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Ornstein Uhlenbeck Relaxation Time => " + - FormatUtil.FormatDouble (dblRelaxationTime, 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Coordinated Variation Reference Liquidity => " + - FormatUtil.FormatDouble (dblReferenceLiquidity, 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Coordinated Variation Reference Volatility => " + - FormatUtil.FormatDouble (dblReferenceVolatility, 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Mean Variance Risk Aversion => " + - FormatUtil.FormatDouble (dblReferenceVolatility, 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Number of Evolution Nodes => " + - FormatUtil.FormatDouble (iNumTimeNode - 1, 2, 0, 1.) + " ||" - ); - - System.out.println ("\t||--------------------------------------------------------||"); - - System.out.println(); - - double dblNonDimensionalTimeInterval = dblExecutionTime / (iNumTimeNode - 1) / dblRelaxationTime; - - OrderSpecification os = new OrderSpecification ( - dblSize, - dblExecutionTime - ); - - CoordinatedVariation cv = new CoordinatedVariation ( - dblReferenceVolatility, - dblReferenceLiquidity - ); - - DiffusionEvaluatorOrnsteinUhlenbeck oup1D = DiffusionEvaluatorOrnsteinUhlenbeck.ZeroMean ( - dblBurstiness, - dblRelaxationTime - ); - - CoordinatedVariationStatic cvs = new CoordinatedVariationTrajectoryGenerator ( - os, - cv, - new MeanVarianceObjectiveUtility (dblRiskAversion), - NonDimensionalCostEvolverSystemic.Standard (oup1D), - CoordinatedVariationTrajectoryGenerator.TRADE_RATE_STATIC_INITIALIZATION - ).nonAdaptive(); - - EfficientTradingTrajectoryContinuous ettc = cvs.trajectory(); - - R1ToR1 r1ToR1Holdings = ettc.holdings(); - - R1ToR1 r1ToR1TradeRate = ettc.tradeRate(); - - R1ToR1 r1ToR1TransactionCostExpectation = ettc.transactionCostExpectationFunction(); - - System.out.println ("\t||-------------------------------------||"); - - System.out.println ("\t|| ADAPTIVE OPTIMAL TRAJECTORY ||"); - - System.out.println ("\t||-------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Time ||"); - - System.out.println ("\t|| - Holdings ||"); - - System.out.println ("\t|| - Trade Rate ||"); - - System.out.println ("\t|| - Realized Cost ||"); - - System.out.println ("\t||-------------------------------------||"); - - double dblInitialNonDimensionalCost = r1ToR1TransactionCostExpectation.evaluate (0.); - - for (int i = 0; i < iNumTimeNode - 1; ++i) { - String strDump = "\t|| " + FormatUtil.FormatDouble (i * dblNonDimensionalTimeInterval * dblRelaxationTime, 1, 2, 1.); - - strDump = strDump + " | " + FormatUtil.FormatDouble (r1ToR1Holdings.evaluate (i * dblNonDimensionalTimeInterval), 1, 4, 1.); - - strDump = strDump + " | " + FormatUtil.FormatDouble (r1ToR1TradeRate.evaluate (i * dblNonDimensionalTimeInterval), 1, 4, 1.); - - strDump = strDump + " | " + FormatUtil.FormatDouble (dblInitialNonDimensionalCost - r1ToR1TransactionCostExpectation.evaluate (i * dblNonDimensionalTimeInterval), 1, 4, 1.); - - System.out.println (strDump + " ||"); - } - - System.out.println ("\t||-------------------------------------||"); - - System.out.println(); - - CoordinatedVariationTrajectoryDeterminant cvtd = cvs.trajectoryDeterminant(); - - System.out.println ("\t||---------------------------------||"); - - System.out.println ("\t|| OPTIMAL TRAJECTORY OUTPUTS ||"); - - System.out.println ("\t||---------------------------------||"); - - System.out.println ( - "\t|| Time Scale => " + - FormatUtil.FormatDouble (cvtd.timeScale(), 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Trade Rate Scale => " + - FormatUtil.FormatDouble (cvtd.tradeRateScale(), 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Cost Scale => " + - FormatUtil.FormatDouble (cvtd.costScale(), 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Mean Market Urgency => " + - FormatUtil.FormatDouble (cvtd.meanMarketUrgency(), 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Market Power => " + - FormatUtil.FormatDouble (cvtd.marketPower(), 1, 4, 1.) + " ||" - ); - - System.out.println ( - "\t|| Risk Aversion Scale => " + - FormatUtil.FormatDouble (cvtd.nonDimensionalRiskAversion(), 1, 4, 1.) + " ||" - ); - - System.out.println ("\t||---------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/almgren2009/CoordinatedMarketStateTrajectory.java b/org/drip/sample/almgren2009/CoordinatedMarketStateTrajectory.java deleted file mode 100644 index fd6c6d0..0000000 --- a/org/drip/sample/almgren2009/CoordinatedMarketStateTrajectory.java +++ /dev/null @@ -1,179 +0,0 @@ - -package org.drip.sample.almgren2009; - -import org.drip.execution.tradingtime.*; -import org.drip.measure.dynamics.DiffusionEvaluatorOrnsteinUhlenbeck; -import org.drip.measure.process.DiffusionEvolver; -import org.drip.measure.realization.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CoordinatedMarketStateTrajectory traces a Sample Realization of the Market State Trajectory the follows - * the Zero Mean Ornstein-Uhlenbeck Evolution Dynamics. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Walia, N. (2006): Optimal Trading: Dynamic Stock Liquidation Strategies, Senior Thesis, Princeton - * University. - * - * @author Lakshmi Krishnamurthy - */ - -public class CoordinatedMarketStateTrajectory { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblBurstiness = 1.; - double dblRelaxationTime = 1.; - double dblSimulationTime = 9.75; - int iNumSimulation = 39; - double dblReferenceLiquidity = 1.0; - double dblReferenceVolatility = 1.0; - double dblInitialMarketState = -0.5; - - double dblTime = 0.; - double dblMarketState = dblInitialMarketState; - double dblTimeInterval = dblSimulationTime / iNumSimulation; - - DiffusionEvaluatorOrnsteinUhlenbeck oup1D = DiffusionEvaluatorOrnsteinUhlenbeck.ZeroMean ( - dblBurstiness, - dblRelaxationTime - ); - - DiffusionEvolver de = new DiffusionEvolver (oup1D); - - CoordinatedMarketState cms = new CoordinatedMarketState ( - new CoordinatedVariation ( - dblReferenceVolatility, - dblReferenceLiquidity - ) - ); - - double dblLiquidity = cms.liquidity (dblMarketState); - - System.out.println(); - - System.out.println ("\t||------------------------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Realized Market State ||"); - - System.out.println ("\t|| - Realized Volatility ||"); - - System.out.println ("\t|| - Realized Liquidity ||"); - - System.out.println ("\t|| - Liquidity/Volatility Status ||"); - - System.out.println ("\t||------------------------------------------------------------------||"); - - System.out.println ("\t|| [" + - FormatUtil.FormatDouble (0., 1, 2, 1.) + "] => " + - FormatUtil.FormatDouble (dblMarketState, 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cms.volatility (dblMarketState), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cms.liquidity (dblMarketState), 1, 4, 1.) + " | " + - ( - dblLiquidity < dblReferenceLiquidity ? - " LIQUID, VOLATILE " : - "ILLIQUID, NON-VOLATILE " - ) + - " ||" - ); - - for (int i = 0; i < iNumSimulation; ++i) { - JumpDiffusionEdge gi = de.weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - dblMarketState, - 0., - false - ), - dblTimeInterval - ); - - dblTime += dblTimeInterval; - - dblMarketState += gi.deterministic() + gi.diffusionStochastic(); - - dblLiquidity = cms.liquidity (dblMarketState); - - System.out.println ("\t|| [" + - FormatUtil.FormatDouble (dblTimeInterval * (i + 1), 1, 2, 1.) + "] => " + - FormatUtil.FormatDouble (dblMarketState, 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cms.volatility (dblMarketState), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (dblLiquidity, 1, 4, 1.) + " | " + - ( - dblLiquidity < dblReferenceLiquidity ? - " LIQUID, VOLATILE " : - "ILLIQUID, NON-VOLATILE " - ) + - " ||" - ); - } - - System.out.println ("\t||------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/almgren2009/EnhancedEulerScheme.java b/org/drip/sample/almgren2009/EnhancedEulerScheme.java deleted file mode 100644 index 81971c3..0000000 --- a/org/drip/sample/almgren2009/EnhancedEulerScheme.java +++ /dev/null @@ -1,152 +0,0 @@ - -package org.drip.sample.almgren2009; - -import org.drip.function.r1tor1.AlmgrenEnhancedEulerUpdate; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * EnhancedEulerScheme demonstrates the Enhancement used by Almgren (2009, 2012) to deal with Time Evolution - * under Singular Initial Conditions. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Walia, N. (2006): Optimal Trading: Dynamic Stock Liquidation Strategies, Senior Thesis, Princeton - * University. - * - * @author Lakshmi Krishnamurthy - */ - -public class EnhancedEulerScheme { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblA = 2.; - double dblB = 1.; - double dblTimeIncrement = 0.1; - double dblSimulationTime = 1.0; - int iK = 2; - - int iNumSimulationSteps = (int) (dblSimulationTime / dblTimeIncrement); - double dblInitialOrder0 = 1. / (iK * dblTimeIncrement); - double dblInitialOrder1 = dblInitialOrder0 + 0.5 * (dblA + dblB); - double dblOrder0Euler = dblInitialOrder0; - double dblOrder1Euler = dblInitialOrder1; - double dblOrder0EnhancedEuler = dblInitialOrder0; - double dblOrder1EnhancedEuler = dblInitialOrder1; - - AlmgrenEnhancedEulerUpdate aeeu = new AlmgrenEnhancedEulerUpdate ( - dblA, - dblB - ); - - System.out.println(); - - System.out.println ("\t||----------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Time ||"); - - System.out.println ("\t|| - Exact Solution ||"); - - System.out.println ("\t|| - Order 1 Initial + Enhanced Euler ||"); - - System.out.println ("\t|| - Order 0 Initial + Enhanced Euler ||"); - - System.out.println ("\t|| - Order 1 Initial + Regular Euler ||"); - - System.out.println ("\t|| - Order 0 Initial + Regular Euler ||"); - - System.out.println ("\t||----------------------------------------------------||"); - - for (int i = iK; i <= iNumSimulationSteps; ++i) { - double dblTime = i * dblTimeIncrement; - - System.out.println ( - "\t|| " + - FormatUtil.FormatDouble (dblTime, 1, 1, 1.) + " => " + - FormatUtil.FormatDouble (aeeu.evaluate (dblTime), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblOrder1EnhancedEuler, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblOrder0EnhancedEuler, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblOrder1Euler, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblOrder0Euler, 1, 3, 1.) + " ||" - ); - - double dblOrder0EulerIncrement = -1. * (dblOrder0Euler - dblA) * (dblOrder0Euler - dblB) * dblTimeIncrement; - double dblOrder1EulerIncrement = -1. * (dblOrder1Euler - dblA) * (dblOrder1Euler - dblB) * dblTimeIncrement; - dblOrder0Euler = dblOrder0Euler + dblOrder0EulerIncrement; - dblOrder1Euler = dblOrder1Euler + dblOrder1EulerIncrement; - double dblOrder0EnhancedEulerIncrement = -1. * (dblOrder0EnhancedEuler - dblA) * (dblOrder0EnhancedEuler - dblB) - * dblTimeIncrement * iK / (iK + 1); - dblOrder0EnhancedEuler = dblOrder0EnhancedEuler + dblOrder0EnhancedEulerIncrement; - double dblOrder1EnhancedEulerIncrement = -1. * (dblOrder1EnhancedEuler - dblA) * (dblOrder1EnhancedEuler - dblB) - * dblTimeIncrement * iK / (iK + 1); - dblOrder1EnhancedEuler = dblOrder1EnhancedEuler + dblOrder1EnhancedEulerIncrement; - } - - System.out.println ("\t||----------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/almgren2009/HighUrgencyTrajectoryComparison.java b/org/drip/sample/almgren2009/HighUrgencyTrajectoryComparison.java deleted file mode 100644 index 30f14c3..0000000 --- a/org/drip/sample/almgren2009/HighUrgencyTrajectoryComparison.java +++ /dev/null @@ -1,213 +0,0 @@ - -package org.drip.sample.almgren2009; - -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.ParticipationRateLinear; -import org.drip.execution.nonadaptive.*; -import org.drip.execution.optimum.EfficientTradingTrajectoryContinuous; -import org.drip.execution.parameters.*; -import org.drip.execution.profiletime.UniformParticipationRateLinear; -import org.drip.function.definition.R1ToR1; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * HighUrgencyTrajectoryComparison compares the Static Continuous Trading Trajectory generated by the Almgren - * and Chriss (2012) Scheme against the High Urgency Asymptote Version. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Walia, N. (2006): Optimal Trading: Dynamic Stock Liquidation Strategies, Senior Thesis, Princeton - * University. - * - * @author Lakshmi Krishnamurthy - */ - -public class HighUrgencyTrajectoryComparison { - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblS0 = 50.; - double dblX = 1000000.; - double dblT = 5.; - double dblAnnualVolatility = 1.00; - double dblAnnualReturns = 0.10; - double dblBidAsk = 0.125; - double dblDailyVolume = 5.e06; - double dblDailyVolumePermanentImpact = 0.1; - double dblDailyVolumeTemporaryImpact = 0.01; - double dblLambdaU = 1.5e-06; - - int iN = 20; - - double dblTime = 0.; - double dblTimeWidth = dblT / iN; - - ArithmeticPriceDynamicsSettings apds = ArithmeticPriceDynamicsSettings.FromAnnualReturnsSettings ( - dblAnnualReturns, - dblAnnualVolatility, - 0., - dblS0 - ); - - double dblSigma = apds.epochVolatility(); - - PriceMarketImpactLinear pmil = new PriceMarketImpactLinear ( - new AssetTransactionSettings ( - dblS0, - dblDailyVolume, - dblBidAsk - ), - dblDailyVolumePermanentImpact, - dblDailyVolumeTemporaryImpact - ); - - ParticipationRateLinear prlPermanent = (ParticipationRateLinear) pmil.permanentTransactionFunction(); - - ParticipationRateLinear prlTemporary = (ParticipationRateLinear) pmil.temporaryTransactionFunction(); - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.LinearExpectation ( - new ArithmeticPriceDynamicsSettings ( - 0., - new FlatUnivariate (dblSigma), - 0. - ), - new UniformParticipationRateLinear (prlPermanent), - new UniformParticipationRateLinear (prlTemporary) - ); - - ContinuousAlmgrenChriss cac = ContinuousAlmgrenChriss.Standard ( - dblX, - dblT, - lpep, - dblLambdaU - ); - - EfficientTradingTrajectoryContinuous ettcA2012S = (EfficientTradingTrajectoryContinuous) cac.generate(); - - R1ToR1 r1ToR1HoldingsA2012S = ettcA2012S.holdings(); - - R1ToR1 r1ToR1TradeRateA2012S = ettcA2012S.tradeRate(); - - R1ToR1 r1ToR1TransactionCostA2012S = ettcA2012S.transactionCostExpectationFunction(); - - ContinuousHighUrgencyAsymptote huas = ContinuousHighUrgencyAsymptote.Standard ( - dblX, - dblT, - lpep, - dblLambdaU - ); - - EfficientTradingTrajectoryContinuous ettcHUAS = (EfficientTradingTrajectoryContinuous) huas.generate(); - - R1ToR1 r1ToR1HoldingsHUAS = ettcHUAS.holdings(); - - R1ToR1 r1ToR1TradeRateHUAS = ettcHUAS.tradeRate(); - - R1ToR1 r1ToR1TransactionCostHUAS = ettcHUAS.transactionCostExpectationFunction(); - - System.out.println (); - - System.out.println ("\t|-------------------------------------------------------------||"); - - System.out.println ("\t| HIGH URGENCY vs. ALMGREN 2012 STATIC TRAJECTORY COMPARISON ||"); - - System.out.println ("\t|-------------------------------------------------------------||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| - Time ||"); - - System.out.println ("\t| - Almgren 2012 Holdings ||"); - - System.out.println ("\t| - Almgren 2012 Trade Rate ||"); - - System.out.println ("\t| - Almgren 2012 Transaction Cost ||"); - - System.out.println ("\t| - High Urgency Asymptote Holdings ||"); - - System.out.println ("\t| - High Urgency Asymptote Trade Rate ||"); - - System.out.println ("\t| - High Urgency Asymptote Transaction Cost ||"); - - System.out.println ("\t|-------------------------------------------------------------||"); - - for (int i = 1; i <= iN; ++i) { - dblTime = dblTime + dblTimeWidth; - - System.out.println ( - "\t|" + - FormatUtil.FormatDouble (dblTime, 1, 2, 1.) + " => " + - FormatUtil.FormatDouble (r1ToR1HoldingsA2012S.evaluate (dblTime) / dblX, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (r1ToR1TradeRateA2012S.evaluate (dblTime) * dblTimeWidth / dblX, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (r1ToR1TransactionCostA2012S.evaluate (dblTime) / dblX, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (r1ToR1HoldingsHUAS.evaluate (dblTime) / dblX, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (r1ToR1TradeRateHUAS.evaluate (dblTime) * dblTimeWidth / dblX, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (r1ToR1TransactionCostHUAS.evaluate (dblTime) / dblX, 1, 3, 1.) + " ||" - ); - } - - System.out.println ("\t|-------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/almgren2009/LowUrgencyTrajectoryComparison.java b/org/drip/sample/almgren2009/LowUrgencyTrajectoryComparison.java deleted file mode 100644 index bc0504a..0000000 --- a/org/drip/sample/almgren2009/LowUrgencyTrajectoryComparison.java +++ /dev/null @@ -1,213 +0,0 @@ - -package org.drip.sample.almgren2009; - -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.ParticipationRateLinear; -import org.drip.execution.nonadaptive.*; -import org.drip.execution.optimum.EfficientTradingTrajectoryContinuous; -import org.drip.execution.parameters.*; -import org.drip.execution.profiletime.UniformParticipationRateLinear; -import org.drip.function.definition.R1ToR1; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * LowUrgencyTrajectoryComparison compares the Static Continuous Trading Trajectory generated by the Almgren - * and Chriss (2012) Scheme against the Low Urgency Asymptote Version. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Walia, N. (2006): Optimal Trading: Dynamic Stock Liquidation Strategies, Senior Thesis, Princeton - * University. - * - * @author Lakshmi Krishnamurthy - */ - -public class LowUrgencyTrajectoryComparison { - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblS0 = 50.; - double dblX = 1000000.; - double dblT = 5.; - double dblAnnualVolatility = 0.03; - double dblAnnualReturns = 0.10; - double dblBidAsk = 0.125; - double dblDailyVolume = 5.e06; - double dblDailyVolumePermanentImpact = 0.1; - double dblDailyVolumeTemporaryImpact = 0.01; - double dblLambdaU = 1.e-06; - - int iN = 20; - - double dblTime = 0.; - double dblTimeWidth = dblT / iN; - - ArithmeticPriceDynamicsSettings apds = ArithmeticPriceDynamicsSettings.FromAnnualReturnsSettings ( - dblAnnualReturns, - dblAnnualVolatility, - 0., - dblS0 - ); - - double dblSigma = apds.epochVolatility(); - - PriceMarketImpactLinear pmil = new PriceMarketImpactLinear ( - new AssetTransactionSettings ( - dblS0, - dblDailyVolume, - dblBidAsk - ), - dblDailyVolumePermanentImpact, - dblDailyVolumeTemporaryImpact - ); - - ParticipationRateLinear prlPermanent = (ParticipationRateLinear) pmil.permanentTransactionFunction(); - - ParticipationRateLinear prlTemporary = (ParticipationRateLinear) pmil.temporaryTransactionFunction(); - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.LinearExpectation ( - new ArithmeticPriceDynamicsSettings ( - 0., - new FlatUnivariate (dblSigma), - 0. - ), - new UniformParticipationRateLinear (prlPermanent), - new UniformParticipationRateLinear (prlTemporary) - ); - - ContinuousAlmgrenChriss cac = ContinuousAlmgrenChriss.Standard ( - dblX, - dblT, - lpep, - dblLambdaU - ); - - EfficientTradingTrajectoryContinuous ettcA2012S = (EfficientTradingTrajectoryContinuous) cac.generate(); - - R1ToR1 r1ToR1HoldingsA2012S = ettcA2012S.holdings(); - - R1ToR1 r1ToR1TradeRateA2012S = ettcA2012S.tradeRate(); - - R1ToR1 r1ToR1TransactionCostA2012S = ettcA2012S.transactionCostExpectationFunction(); - - ContinuousLowUrgencyAsymptote luas = ContinuousLowUrgencyAsymptote.Standard ( - dblX, - dblT, - lpep, - dblLambdaU - ); - - EfficientTradingTrajectoryContinuous ettcLUAS = (EfficientTradingTrajectoryContinuous) luas.generate(); - - R1ToR1 r1ToR1HoldingsLUAS = ettcLUAS.holdings(); - - R1ToR1 r1ToR1TradeRateLUAS = ettcLUAS.tradeRate(); - - R1ToR1 r1ToR1TransactionCostLUAS = ettcLUAS.transactionCostExpectationFunction(); - - System.out.println (); - - System.out.println ("\t|-------------------------------------------------------------||"); - - System.out.println ("\t| LOW URGENCY vs. ALMGREN 2012 STATIC TRAJECTORY COMPARISON ||"); - - System.out.println ("\t|-------------------------------------------------------------||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| - Time ||"); - - System.out.println ("\t| - Almgren 2012 Holdings ||"); - - System.out.println ("\t| - Almgren 2012 Trade Rate ||"); - - System.out.println ("\t| - Almgren 2012 Transaction Cost ||"); - - System.out.println ("\t| - Low Urgency Asymptote Holdings ||"); - - System.out.println ("\t| - Low Urgency Asymptote Trade Rate ||"); - - System.out.println ("\t| - Low Urgency Asymptote Transaction Cost ||"); - - System.out.println ("\t|-------------------------------------------------------------||"); - - for (int i = 1; i <= iN; ++i) { - dblTime = dblTime + dblTimeWidth; - - System.out.println ( - "\t|" + - FormatUtil.FormatDouble (dblTime, 1, 2, 1.) + " => " + - FormatUtil.FormatDouble (r1ToR1HoldingsA2012S.evaluate (dblTime) / dblX, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (r1ToR1TradeRateA2012S.evaluate (dblTime) * dblTimeWidth / dblX, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (r1ToR1TransactionCostA2012S.evaluate (dblTime) / dblX, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (r1ToR1HoldingsLUAS.evaluate (dblTime) / dblX, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (r1ToR1TradeRateLUAS.evaluate (dblTime) * dblTimeWidth / dblX, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (r1ToR1TransactionCostLUAS.evaluate (dblTime) / dblX, 1, 3, 1.) + " ||" - ); - } - - System.out.println ("\t|-------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/almgren2009/StaticContinuousOptimalTrajectory.java b/org/drip/sample/almgren2009/StaticContinuousOptimalTrajectory.java deleted file mode 100644 index 07cfe09..0000000 --- a/org/drip/sample/almgren2009/StaticContinuousOptimalTrajectory.java +++ /dev/null @@ -1,195 +0,0 @@ - -package org.drip.sample.almgren2009; - -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.ParticipationRateLinear; -import org.drip.execution.nonadaptive.ContinuousAlmgrenChriss; -import org.drip.execution.optimum.EfficientTradingTrajectoryContinuous; -import org.drip.execution.parameters.*; -import org.drip.execution.profiletime.UniformParticipationRateLinear; -import org.drip.function.definition.R1ToR1; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * StaticContinuousOptimalTrajectory demonstrates the Generation and Usage of Continuous Version of the - * Discrete Trading Trajectory generated by the Almgren and Chriss (2000) Scheme under the Criterion of - * No-Drift. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Walia, N. (2006): Optimal Trading: Dynamic Stock Liquidation Strategies, Senior Thesis, Princeton - * University. - * - * @author Lakshmi Krishnamurthy - */ - -public class StaticContinuousOptimalTrajectory { - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblS0 = 50.; - double dblX = 1000000.; - double dblT = 5.; - double dblAnnualVolatility = 0.30; - double dblAnnualReturns = 0.10; - double dblBidAsk = 0.125; - double dblDailyVolume = 5.e06; - double dblDailyVolumePermanentImpact = 0.1; - double dblDailyVolumeTemporaryImpact = 0.01; - double dblLambdaU = 1.e-06; - - int iN = 20; - - double dblTime = 0.; - double dblTimeWidth = dblT / iN; - - ArithmeticPriceDynamicsSettings apds = ArithmeticPriceDynamicsSettings.FromAnnualReturnsSettings ( - dblAnnualReturns, - dblAnnualVolatility, - 0., - dblS0 - ); - - double dblSigma = apds.epochVolatility(); - - PriceMarketImpactLinear pmil = new PriceMarketImpactLinear ( - new AssetTransactionSettings ( - dblS0, - dblDailyVolume, - dblBidAsk - ), - dblDailyVolumePermanentImpact, - dblDailyVolumeTemporaryImpact - ); - - ParticipationRateLinear prlPermanent = (ParticipationRateLinear) pmil.permanentTransactionFunction(); - - ParticipationRateLinear prlTemporary = (ParticipationRateLinear) pmil.temporaryTransactionFunction(); - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.LinearExpectation ( - new ArithmeticPriceDynamicsSettings ( - 0., - new FlatUnivariate (dblSigma), - 0. - ), - new UniformParticipationRateLinear (prlPermanent), - new UniformParticipationRateLinear (prlTemporary) - ); - - ContinuousAlmgrenChriss cac = ContinuousAlmgrenChriss.Standard ( - dblX, - dblT, - lpep, - dblLambdaU - ); - - EfficientTradingTrajectoryContinuous ettc = (EfficientTradingTrajectoryContinuous) cac.generate(); - - R1ToR1 r1ToR1Holdings = ettc.holdings(); - - R1ToR1 r1ToR1TradeRate = ettc.tradeRate(); - - R1ToR1 r1ToR1TransactionCostVariance = ettc.transactionCostVarianceFunction(); - - R1ToR1 r1ToR1TransactionCostExpectation = ettc.transactionCostExpectationFunction(); - - System.out.println (); - - System.out.println ("\t|-------------------------------------------||"); - - System.out.println ("\t| STATIC CONTINUOUS OPTIMAL TRAJECTORY ||"); - - System.out.println ("\t|-------------------------------------------||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| - Time ||"); - - System.out.println ("\t| - Holdings ||"); - - System.out.println ("\t| - Trade Rate ||"); - - System.out.println ("\t| - Transaction Cost Expectation ||"); - - System.out.println ("\t| - Transaction Cost Volatility ||"); - - System.out.println ("\t|-------------------------------------------||"); - - for (int i = 1; i <= iN; ++i) { - dblTime = dblTime + dblTimeWidth; - - System.out.println ( - "\t|" + - FormatUtil.FormatDouble (dblTime, 1, 2, 1.) + " => " + - FormatUtil.FormatDouble (r1ToR1Holdings.evaluate (dblTime) / dblX, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (r1ToR1TradeRate.evaluate (dblTime) * dblTimeWidth / dblX, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (r1ToR1TransactionCostExpectation.evaluate (dblTime) / dblX, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (Math.sqrt (r1ToR1TransactionCostVariance.evaluate (dblTime)) / dblX, 1, 3, 1.) + " ||" - ); - } - - System.out.println ("\t|-------------------------------------------||"); - } -} diff --git a/org/drip/sample/almgren2012/AdaptiveStaticInitialHoldings.java b/org/drip/sample/almgren2012/AdaptiveStaticInitialHoldings.java deleted file mode 100644 index 398ccdd..0000000 --- a/org/drip/sample/almgren2012/AdaptiveStaticInitialHoldings.java +++ /dev/null @@ -1,178 +0,0 @@ - -package org.drip.sample.almgren2012; - -import org.drip.execution.adaptive.*; -import org.drip.execution.hjb.NonDimensionalCostEvolverSystemic; -import org.drip.execution.latent.*; -import org.drip.execution.risk.MeanVarianceObjectiveUtility; -import org.drip.execution.strategy.OrderSpecification; -import org.drip.execution.tradingtime.CoordinatedVariation; -import org.drip.measure.dynamics.DiffusionEvaluatorOrnsteinUhlenbeck; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AdaptiveStaticInitialHoldings simulates the Outstanding Holdings from the Sample Realization of the - * Adaptive Cost Strategy using the Market State Trajectory the follows the Zero Mean Ornstein-Uhlenbeck - * Evolution Dynamics. The Initial Dynamics is derived from the "Mean Market State" Initial Static - * Trajectory. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Walia, N. (2006): Optimal Trading: Dynamic Stock Liquidation Strategies, Senior Thesis, Princeton - * University. - * - * @author Lakshmi Krishnamurthy - */ - -public class AdaptiveStaticInitialHoldings { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblSize = 1.; - int iNumTimeNode = 51; - double dblBurstiness = 1.; - double dblExecutionTime = 10.; - double dblRelaxationTime = 1.; - double dblReferenceLiquidity = 1.; - double dblReferenceVolatility = 1.; - double dblInitialMarketState = -0.5; - double[] adblRiskAversion = new double[] { - 0.01, - 0.04, - 0.09, - 0.16, - 0.36, - 0.64, - 1.00 - }; - - double dblNonDimensionalTimeInterval = dblExecutionTime / (iNumTimeNode - 1) / dblRelaxationTime; - double[][] aadblNonDimensionalHoldings = new double[adblRiskAversion.length][]; - - OrderSpecification os = new OrderSpecification ( - dblSize, - dblExecutionTime - ); - - CoordinatedVariation cv = new CoordinatedVariation ( - dblReferenceVolatility, - dblReferenceLiquidity - ); - - DiffusionEvaluatorOrnsteinUhlenbeck oup1D = DiffusionEvaluatorOrnsteinUhlenbeck.ZeroMean ( - dblBurstiness, - dblRelaxationTime - ); - - MarketState[] aMS = OrnsteinUhlenbeckSequence.Systemic ( - oup1D, - dblNonDimensionalTimeInterval * dblRelaxationTime, - dblInitialMarketState, - iNumTimeNode - ).realizedMarketState(); - - for (int i = 0; i < adblRiskAversion.length; ++i) - aadblNonDimensionalHoldings[i] = new CoordinatedVariationTrajectoryGenerator ( - os, - cv, - new MeanVarianceObjectiveUtility (adblRiskAversion[i]), - NonDimensionalCostEvolverSystemic.Standard (oup1D), - CoordinatedVariationTrajectoryGenerator.TRADE_RATE_STATIC_INITIALIZATION - ).adaptive (aMS).nonDimensionalHoldings(); - - System.out.println(); - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - System.out.println ("\t|| ADAPTIVE OPTIMAL TRAJECTORY HOLDINGS ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Time ||"); - - for (int j = 0; j < adblRiskAversion.length; ++j) - System.out.println ( - "\t|| - Non Dimensional Risk Aversion =>" + - FormatUtil.FormatDouble (dblRelaxationTime * dblReferenceVolatility * Math.sqrt (adblRiskAversion[j] / dblReferenceLiquidity), 1, 2, 1.) + - " ||" - ); - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - for (int i = 0; i < iNumTimeNode - 1; ++i) { - String strDump = "\t|| " + FormatUtil.FormatDouble (i * dblNonDimensionalTimeInterval * dblRelaxationTime, 1, 2, 1.); - - for (int j = 0; j < adblRiskAversion.length; ++j) - strDump = strDump + " | " + FormatUtil.FormatDouble (aadblNonDimensionalHoldings[j][i], 1, 4, 1.); - - System.out.println (strDump + " ||"); - } - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/almgren2012/AdaptiveStaticInitialTradeRate.java b/org/drip/sample/almgren2012/AdaptiveStaticInitialTradeRate.java deleted file mode 100644 index 68c6559..0000000 --- a/org/drip/sample/almgren2012/AdaptiveStaticInitialTradeRate.java +++ /dev/null @@ -1,178 +0,0 @@ - -package org.drip.sample.almgren2012; - -import org.drip.execution.adaptive.*; -import org.drip.execution.hjb.NonDimensionalCostEvolverSystemic; -import org.drip.execution.latent.*; -import org.drip.execution.risk.MeanVarianceObjectiveUtility; -import org.drip.execution.strategy.OrderSpecification; -import org.drip.execution.tradingtime.CoordinatedVariation; -import org.drip.measure.dynamics.DiffusionEvaluatorOrnsteinUhlenbeck; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AdaptiveStaticInitialTradeRate simulates the Trade Rate from the Sample Realization of the Adaptive Cost - * Strategy using the Market State Trajectory the follows the Zero Mean Ornstein-Uhlenbeck Evolution - * Dynamics. The Initial Dynamics is derived from the "Mean Market State" Initial Static Trajectory. The - * References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Walia, N. (2006): Optimal Trading: Dynamic Stock Liquidation Strategies, Senior Thesis, Princeton - * University. - * - * @author Lakshmi Krishnamurthy - */ - -public class AdaptiveStaticInitialTradeRate { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblSize = 1.; - int iNumTimeNode = 51; - double dblBurstiness = 1.; - double dblExecutionTime = 10.; - double dblRelaxationTime = 1.; - double dblReferenceLiquidity = 1.; - double dblReferenceVolatility = 1.; - double dblInitialMarketState = -0.5; - double[] adblRiskAversion = new double[] { - 0.01, - 0.04, - 0.09, - 0.16, - 0.36, - 0.64, - 1.00 - }; - - double dblNonDimensionalTimeInterval = dblExecutionTime / (iNumTimeNode - 1) / dblRelaxationTime; - double[][] aadblAdjustedNonDimensionalTradeRate = new double[adblRiskAversion.length][]; - - OrderSpecification os = new OrderSpecification ( - dblSize, - dblExecutionTime - ); - - CoordinatedVariation cv = new CoordinatedVariation ( - dblReferenceVolatility, - dblReferenceLiquidity - ); - - DiffusionEvaluatorOrnsteinUhlenbeck oup1D = DiffusionEvaluatorOrnsteinUhlenbeck.ZeroMean ( - dblBurstiness, - dblRelaxationTime - ); - - MarketState[] aMS = OrnsteinUhlenbeckSequence.Systemic ( - oup1D, - dblNonDimensionalTimeInterval * dblRelaxationTime, - dblInitialMarketState, - iNumTimeNode - ).realizedMarketState(); - - for (int i = 0; i < adblRiskAversion.length; ++i) - aadblAdjustedNonDimensionalTradeRate[i] = new CoordinatedVariationTrajectoryGenerator ( - os, - cv, - new MeanVarianceObjectiveUtility (adblRiskAversion[i]), - NonDimensionalCostEvolverSystemic.Standard (oup1D), - CoordinatedVariationTrajectoryGenerator.TRADE_RATE_STATIC_INITIALIZATION - ).adaptive (aMS).scaledNonDimensionalTradeRate(); - - System.out.println(); - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - System.out.println ("\t|| ADAPTIVE OPTIMAL TRAJECTORY TRADE RATE ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Time ||"); - - for (int j = 0; j < adblRiskAversion.length; ++j) - System.out.println ( - "\t|| - Non Dimensional Risk Aversion =>" + - FormatUtil.FormatDouble (dblRelaxationTime * dblReferenceVolatility * Math.sqrt (adblRiskAversion[j] / dblReferenceLiquidity), 1, 2, 1.) + - " ||" - ); - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - for (int i = 0; i < iNumTimeNode - 1; ++i) { - String strDump = "\t|| " + FormatUtil.FormatDouble (i * dblNonDimensionalTimeInterval * dblRelaxationTime, 1, 2, 1.); - - for (int j = 0; j < adblRiskAversion.length; ++j) - strDump = strDump + " | " + FormatUtil.FormatDouble (aadblAdjustedNonDimensionalTradeRate[j][i], 1, 4, 1.); - - System.out.println (strDump + " ||"); - } - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/almgren2012/AdaptiveZeroInitialHoldings.java b/org/drip/sample/almgren2012/AdaptiveZeroInitialHoldings.java deleted file mode 100644 index 99209ff..0000000 --- a/org/drip/sample/almgren2012/AdaptiveZeroInitialHoldings.java +++ /dev/null @@ -1,179 +0,0 @@ - -package org.drip.sample.almgren2012; - -import org.drip.execution.adaptive.*; -import org.drip.execution.hjb.NonDimensionalCostEvolverSystemic; -import org.drip.execution.latent.*; -import org.drip.execution.risk.MeanVarianceObjectiveUtility; -import org.drip.execution.strategy.OrderSpecification; -import org.drip.execution.tradingtime.CoordinatedVariation; -import org.drip.measure.dynamics.DiffusionEvaluatorOrnsteinUhlenbeck; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AdaptiveZeroInitialHoldings simulates the Outstanding Holdings from the Sample Realization of the Adaptive - * Cost Strategy using the Market State Trajectory the follows the Zero Mean Ornstein-Uhlenbeck Evolution - * Dynamics. The Initial Dynamics is derived from the "Mean Market State" Initial Static Trajectory. The - * Initial Dynamics corresponds to the Zero Cost, Zero Cost Sensitivities, and Zero Trade Rate. The - * References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Walia, N. (2006): Optimal Trading: Dynamic Stock Liquidation Strategies, Senior Thesis, Princeton - * University. - * - * @author Lakshmi Krishnamurthy - */ - -public class AdaptiveZeroInitialHoldings { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblSize = 1.; - int iNumTimeNode = 51; - double dblBurstiness = 1.; - double dblExecutionTime = 10.; - double dblRelaxationTime = 1.; - double dblReferenceLiquidity = 1.; - double dblReferenceVolatility = 1.; - double dblInitialMarketState = -0.5; - double[] adblRiskAversion = new double[] { - 0.01, - 0.04, - 0.09, - 0.16, - 0.36, - 0.64, - 1.00 - }; - - double dblNonDimensionalTimeInterval = dblExecutionTime / (iNumTimeNode - 1) / dblRelaxationTime; - double[][] aadblNonDimensionalHoldings = new double[adblRiskAversion.length][]; - - OrderSpecification os = new OrderSpecification ( - dblSize, - dblExecutionTime - ); - - CoordinatedVariation cv = new CoordinatedVariation ( - dblReferenceVolatility, - dblReferenceLiquidity - ); - - DiffusionEvaluatorOrnsteinUhlenbeck oup1D = DiffusionEvaluatorOrnsteinUhlenbeck.ZeroMean ( - dblBurstiness, - dblRelaxationTime - ); - - MarketState[] aMS = OrnsteinUhlenbeckSequence.Systemic ( - oup1D, - dblNonDimensionalTimeInterval * dblRelaxationTime, - dblInitialMarketState, - iNumTimeNode - ).realizedMarketState(); - - for (int i = 0; i < adblRiskAversion.length; ++i) - aadblNonDimensionalHoldings[i] = new CoordinatedVariationTrajectoryGenerator ( - os, - cv, - new MeanVarianceObjectiveUtility (adblRiskAversion[i]), - NonDimensionalCostEvolverSystemic.Standard (oup1D), - CoordinatedVariationTrajectoryGenerator.TRADE_RATE_ZERO_INITIALIZATION - ).adaptive (aMS).nonDimensionalHoldings(); - - System.out.println(); - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - System.out.println ("\t|| ADAPTIVE OPTIMAL TRAJECTORY HOLDINGS ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Time ||"); - - for (int j = 0; j < adblRiskAversion.length; ++j) - System.out.println ( - "\t|| - Non Dimensional Risk Aversion =>" + - FormatUtil.FormatDouble (dblRelaxationTime * dblReferenceVolatility * Math.sqrt (adblRiskAversion[j] / dblReferenceLiquidity), 1, 2, 1.) + - " ||" - ); - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - for (int i = 0; i < iNumTimeNode - 1; ++i) { - String strDump = "\t|| " + FormatUtil.FormatDouble (i * dblNonDimensionalTimeInterval * dblRelaxationTime, 1, 2, 1.); - - for (int j = 0; j < adblRiskAversion.length; ++j) - strDump = strDump + " | " + FormatUtil.FormatDouble (aadblNonDimensionalHoldings[j][i], 1, 4, 1.); - - System.out.println (strDump + " ||"); - } - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/almgren2012/AdaptiveZeroInitialTradeRate.java b/org/drip/sample/almgren2012/AdaptiveZeroInitialTradeRate.java deleted file mode 100644 index 646c97a..0000000 --- a/org/drip/sample/almgren2012/AdaptiveZeroInitialTradeRate.java +++ /dev/null @@ -1,178 +0,0 @@ - -package org.drip.sample.almgren2012; - -import org.drip.execution.adaptive.*; -import org.drip.execution.hjb.NonDimensionalCostEvolverSystemic; -import org.drip.execution.latent.*; -import org.drip.execution.risk.MeanVarianceObjectiveUtility; -import org.drip.execution.strategy.OrderSpecification; -import org.drip.execution.tradingtime.CoordinatedVariation; -import org.drip.measure.dynamics.DiffusionEvaluatorOrnsteinUhlenbeck; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AdaptiveZeroInitialTradeRate simulates the Trade Rate from the Sample Realization of the Adaptive Cost - * Strategy using the Market State Trajectory the follows the Zero Mean Ornstein-Uhlenbeck Evolution - * Dynamics. The Initial Dynamics corresponds to the Zero Cost, Zero Cost Sensitivities, and Zero Trade - * Rate. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Walia, N. (2006): Optimal Trading: Dynamic Stock Liquidation Strategies, Senior Thesis, Princeton - * University. - * - * @author Lakshmi Krishnamurthy - */ - -public class AdaptiveZeroInitialTradeRate { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblSize = 1.; - int iNumTimeNode = 51; - double dblBurstiness = 1.; - double dblExecutionTime = 10.; - double dblRelaxationTime = 1.; - double dblReferenceLiquidity = 1.; - double dblReferenceVolatility = 1.; - double dblInitialMarketState = -0.5; - double[] adblRiskAversion = new double[] { - 0.01, - 0.04, - 0.09, - 0.16, - 0.36, - 0.64, - 1.00 - }; - - double dblNonDimensionalTimeInterval = dblExecutionTime / (iNumTimeNode - 1) / dblRelaxationTime; - double[][] aadblAdjustedNonDimensionalTradeRate = new double[adblRiskAversion.length][]; - - OrderSpecification os = new OrderSpecification ( - dblSize, - dblExecutionTime - ); - - CoordinatedVariation cv = new CoordinatedVariation ( - dblReferenceVolatility, - dblReferenceLiquidity - ); - - DiffusionEvaluatorOrnsteinUhlenbeck oup1D = DiffusionEvaluatorOrnsteinUhlenbeck.ZeroMean ( - dblBurstiness, - dblRelaxationTime - ); - - MarketState[] aMS = OrnsteinUhlenbeckSequence.Systemic ( - oup1D, - dblNonDimensionalTimeInterval * dblRelaxationTime, - dblInitialMarketState, - iNumTimeNode - ).realizedMarketState(); - - for (int i = 0; i < adblRiskAversion.length; ++i) - aadblAdjustedNonDimensionalTradeRate[i] = new CoordinatedVariationTrajectoryGenerator ( - os, - cv, - new MeanVarianceObjectiveUtility (adblRiskAversion[i]), - NonDimensionalCostEvolverSystemic.Standard (oup1D), - CoordinatedVariationTrajectoryGenerator.TRADE_RATE_ZERO_INITIALIZATION - ).adaptive (aMS).scaledNonDimensionalTradeRate(); - - System.out.println(); - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - System.out.println ("\t|| ADAPTIVE OPTIMAL TRAJECTORY TRADE RATE ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Time ||"); - - for (int j = 0; j < adblRiskAversion.length; ++j) - System.out.println ( - "\t|| - Non Dimensional Risk Aversion =>" + - FormatUtil.FormatDouble (dblRelaxationTime * dblReferenceVolatility * Math.sqrt (adblRiskAversion[j] / dblReferenceLiquidity), 1, 2, 1.) + - " ||" - ); - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - for (int i = 0; i < iNumTimeNode - 1; ++i) { - String strDump = "\t|| " + FormatUtil.FormatDouble (i * dblNonDimensionalTimeInterval * dblRelaxationTime, 1, 2, 1.); - - for (int j = 0; j < adblRiskAversion.length; ++j) - strDump = strDump + " | " + FormatUtil.FormatDouble (aadblAdjustedNonDimensionalTradeRate[j][i], 1, 4, 1.); - - System.out.println (strDump + " ||"); - } - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/almgren2012/RollingHorizonOptimalHoldings.java b/org/drip/sample/almgren2012/RollingHorizonOptimalHoldings.java deleted file mode 100644 index 42db2b0..0000000 --- a/org/drip/sample/almgren2012/RollingHorizonOptimalHoldings.java +++ /dev/null @@ -1,178 +0,0 @@ - -package org.drip.sample.almgren2012; - -import org.drip.execution.adaptive.*; -import org.drip.execution.hjb.NonDimensionalCostEvolverSystemic; -import org.drip.execution.latent.*; -import org.drip.execution.risk.MeanVarianceObjectiveUtility; -import org.drip.execution.strategy.OrderSpecification; -import org.drip.execution.tradingtime.CoordinatedVariation; -import org.drip.measure.dynamics.DiffusionEvaluatorOrnsteinUhlenbeck; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * RollingHorizonOptimalHoldings simulates the Holdings from the Sample Realization of the Adaptive Cost - * Strategy using the Market State Trajectory the follows the Zero Mean Ornstein-Uhlenbeck Evolution - * Dynamics. Instead of a HJB Based Truly Adaptive Strategy, a Rolling Horizon Approximation is used. The - * References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Walia, N. (2006): Optimal Trading: Dynamic Stock Liquidation Strategies, Senior Thesis, Princeton - * University. - * - * @author Lakshmi Krishnamurthy - */ - -public class RollingHorizonOptimalHoldings { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblSize = 1.; - int iNumTimeNode = 51; - double dblBurstiness = 1.; - double dblExecutionTime = 10.; - double dblRelaxationTime = 1.; - double dblReferenceLiquidity = 1.; - double dblReferenceVolatility = 1.; - double dblInitialMarketState = -0.5; - double[] adblRiskAversion = new double[] { - 0.01, - 0.04, - 0.09, - 0.16, - 0.36, - 0.64, - 1.00 - }; - - double dblNonDimensionalTimeInterval = dblExecutionTime / (iNumTimeNode - 1) / dblRelaxationTime; - double[][] aadblAdjustedNonDimensionalHoldings = new double[adblRiskAversion.length][]; - - OrderSpecification os = new OrderSpecification ( - dblSize, - dblExecutionTime - ); - - CoordinatedVariation cv = new CoordinatedVariation ( - dblReferenceVolatility, - dblReferenceLiquidity - ); - - DiffusionEvaluatorOrnsteinUhlenbeck oup1D = DiffusionEvaluatorOrnsteinUhlenbeck.ZeroMean ( - dblBurstiness, - dblRelaxationTime - ); - - MarketState[] aMS = OrnsteinUhlenbeckSequence.Systemic ( - oup1D, - dblNonDimensionalTimeInterval * dblRelaxationTime, - dblInitialMarketState, - iNumTimeNode - ).realizedMarketState(); - - for (int i = 0; i < adblRiskAversion.length; ++i) - aadblAdjustedNonDimensionalHoldings[i] = new CoordinatedVariationTrajectoryGenerator ( - os, - cv, - new MeanVarianceObjectiveUtility (adblRiskAversion[i]), - NonDimensionalCostEvolverSystemic.Standard (oup1D), - CoordinatedVariationTrajectoryGenerator.TRADE_RATE_ZERO_INITIALIZATION - ).rollingHorizon (aMS).nonDimensionalHoldings(); - - System.out.println(); - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - System.out.println ("\t|| ROLLING HORIZON OPTIMAL TRAJECTORY HOLDINGS ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Time ||"); - - for (int j = 0; j < adblRiskAversion.length; ++j) - System.out.println ( - "\t|| - Non Dimensional Risk Aversion =>" + - FormatUtil.FormatDouble (dblRelaxationTime * dblReferenceVolatility * Math.sqrt (adblRiskAversion[j] / dblReferenceLiquidity), 1, 2, 1.) + - " ||" - ); - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - for (int i = 0; i < iNumTimeNode - 1; ++i) { - String strDump = "\t|| " + FormatUtil.FormatDouble (i * dblNonDimensionalTimeInterval * dblRelaxationTime, 1, 2, 1.); - - for (int j = 0; j < adblRiskAversion.length; ++j) - strDump = strDump + " | " + FormatUtil.FormatDouble (aadblAdjustedNonDimensionalHoldings[j][i], 1, 4, 1.); - - System.out.println (strDump + " ||"); - } - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/almgren2012/RollingHorizonOptimalTradeRate.java b/org/drip/sample/almgren2012/RollingHorizonOptimalTradeRate.java deleted file mode 100644 index 4c50c3f..0000000 --- a/org/drip/sample/almgren2012/RollingHorizonOptimalTradeRate.java +++ /dev/null @@ -1,178 +0,0 @@ - -package org.drip.sample.almgren2012; - -import org.drip.execution.adaptive.*; -import org.drip.execution.hjb.NonDimensionalCostEvolverSystemic; -import org.drip.execution.latent.*; -import org.drip.execution.risk.MeanVarianceObjectiveUtility; -import org.drip.execution.strategy.OrderSpecification; -import org.drip.execution.tradingtime.CoordinatedVariation; -import org.drip.measure.dynamics.DiffusionEvaluatorOrnsteinUhlenbeck; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * RollingHorizonOptimalTradeRate simulates the Trade Rate from the Sample Realization of the Adaptive Cost - * Strategy using the Market State Trajectory the follows the Zero Mean Ornstein-Uhlenbeck Evolution - * Dynamics. Instead of a HJB Based Truly Adaptive Strategy, a Rolling Horizon Approximation is used. The - * References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Walia, N. (2006): Optimal Trading: Dynamic Stock Liquidation Strategies, Senior Thesis, Princeton - * University. - * - * @author Lakshmi Krishnamurthy - */ - -public class RollingHorizonOptimalTradeRate { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblSize = 1.; - int iNumTimeNode = 51; - double dblBurstiness = 1.; - double dblExecutionTime = 10.; - double dblRelaxationTime = 1.; - double dblReferenceLiquidity = 1.; - double dblReferenceVolatility = 1.; - double dblInitialMarketState = -0.5; - double[] adblRiskAversion = new double[] { - 0.01, - 0.04, - 0.09, - 0.16, - 0.36, - 0.64, - 1.00 - }; - - double dblNonDimensionalTimeInterval = dblExecutionTime / (iNumTimeNode - 1) / dblRelaxationTime; - double[][] aadblAdjustedNonDimensionalTradeRate = new double[adblRiskAversion.length][]; - - OrderSpecification os = new OrderSpecification ( - dblSize, - dblExecutionTime - ); - - CoordinatedVariation cv = new CoordinatedVariation ( - dblReferenceVolatility, - dblReferenceLiquidity - ); - - DiffusionEvaluatorOrnsteinUhlenbeck oup1D = DiffusionEvaluatorOrnsteinUhlenbeck.ZeroMean ( - dblBurstiness, - dblRelaxationTime - ); - - MarketState[] aMS = OrnsteinUhlenbeckSequence.Systemic ( - oup1D, - dblNonDimensionalTimeInterval * dblRelaxationTime, - dblInitialMarketState, - iNumTimeNode - ).realizedMarketState(); - - for (int i = 0; i < adblRiskAversion.length; ++i) - aadblAdjustedNonDimensionalTradeRate[i] = new CoordinatedVariationTrajectoryGenerator ( - os, - cv, - new MeanVarianceObjectiveUtility (adblRiskAversion[i]), - NonDimensionalCostEvolverSystemic.Standard (oup1D), - CoordinatedVariationTrajectoryGenerator.TRADE_RATE_ZERO_INITIALIZATION - ).rollingHorizon (aMS).nonDimensionalTradeRate(); - - System.out.println(); - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - System.out.println ("\t|| ROLLING HORIZON OPTIMAL TRAJECTORY TRADE RATE ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Time ||"); - - for (int j = 0; j < adblRiskAversion.length; ++j) - System.out.println ( - "\t|| - Non Dimensional Risk Aversion =>" + - FormatUtil.FormatDouble (dblRelaxationTime * dblReferenceVolatility * Math.sqrt (adblRiskAversion[j] / dblReferenceLiquidity), 1, 2, 1.) + - " ||" - ); - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - for (int i = 0; i < iNumTimeNode - 1; ++i) { - String strDump = "\t|| " + FormatUtil.FormatDouble (i * dblNonDimensionalTimeInterval * dblRelaxationTime, 1, 2, 1.); - - for (int j = 0; j < adblRiskAversion.length; ++j) - strDump = strDump + " | " + FormatUtil.FormatDouble (aadblAdjustedNonDimensionalTradeRate[j][i], 1, 4, 1.); - - System.out.println (strDump + " ||"); - } - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/almgren2012/StaticOptimalTrajectoryHoldings.java b/org/drip/sample/almgren2012/StaticOptimalTrajectoryHoldings.java deleted file mode 100644 index 2dd1961..0000000 --- a/org/drip/sample/almgren2012/StaticOptimalTrajectoryHoldings.java +++ /dev/null @@ -1,169 +0,0 @@ - -package org.drip.sample.almgren2012; - -import org.drip.execution.adaptive.*; -import org.drip.execution.hjb.NonDimensionalCostEvolverSystemic; -import org.drip.execution.optimum.EfficientTradingTrajectoryContinuous; -import org.drip.execution.risk.MeanVarianceObjectiveUtility; -import org.drip.execution.strategy.OrderSpecification; -import org.drip.execution.tradingtime.CoordinatedVariation; -import org.drip.measure.dynamics.DiffusionEvaluatorOrnsteinUhlenbeck; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * StaticOptimalTrajectoryHoldings simulates the Outstanding Holdings from the Sample Realization of the - * Static Cost Strategy extracted using the Mean Market State that follows the Zero Mean Ornstein-Uhlenbeck - * Evolution Dynamics. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Walia, N. (2006): Optimal Trading: Dynamic Stock Liquidation Strategies, Senior Thesis, Princeton - * University. - * - * @author Lakshmi Krishnamurthy - */ - -public class StaticOptimalTrajectoryHoldings { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblSize = 1.; - int iNumTimeNode = 51; - double dblBurstiness = 1.; - double dblExecutionTime = 10.; - double dblRelaxationTime = 1.; - double dblReferenceLiquidity = 1.; - double dblReferenceVolatility = 1.; - double[] adblRiskAversion = new double[] { - 0.01, - 0.04, - 0.09, - 0.16, - 0.36, - 0.64, - 1.00 - }; - - EfficientTradingTrajectoryContinuous[] aETTCHoldings = new EfficientTradingTrajectoryContinuous[adblRiskAversion.length]; - double dblTimeInterval = dblExecutionTime / (iNumTimeNode - 1); - - OrderSpecification os = new OrderSpecification ( - dblSize, - dblExecutionTime - ); - - CoordinatedVariation cv = new CoordinatedVariation ( - dblReferenceVolatility, - dblReferenceLiquidity - ); - - DiffusionEvaluatorOrnsteinUhlenbeck oup1D = DiffusionEvaluatorOrnsteinUhlenbeck.ZeroMean ( - dblBurstiness, - dblRelaxationTime - ); - - for (int i = 0; i < adblRiskAversion.length; ++i) - aETTCHoldings[i] = new CoordinatedVariationTrajectoryGenerator ( - os, - cv, - new MeanVarianceObjectiveUtility (adblRiskAversion[i]), - NonDimensionalCostEvolverSystemic.Standard (oup1D), - CoordinatedVariationTrajectoryGenerator.TRADE_RATE_ZERO_INITIALIZATION - ).nonAdaptive().trajectory(); - - System.out.println(); - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - System.out.println ("\t|| STATIC OPTIMAL TRAJECTORY HOLDINGS ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Time ||"); - - for (int j = 0; j < adblRiskAversion.length; ++j) - System.out.println ( - "\t|| - Non Dimensional Risk Aversion =>" + - FormatUtil.FormatDouble (dblRelaxationTime * dblReferenceVolatility * Math.sqrt (adblRiskAversion[j] / dblReferenceLiquidity), 1, 2, 1.) + - " ||" - ); - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - for (int i = 0; i < iNumTimeNode - 1; ++i) { - String strDump = "\t|| " + FormatUtil.FormatDouble (i * dblTimeInterval, 1, 2, 1.); - - for (int j = 0; j < adblRiskAversion.length; ++j) - strDump = strDump + " | " + FormatUtil.FormatDouble (aETTCHoldings[j].holdings().evaluate (dblTimeInterval * i), 1, 4, 1.); - - System.out.println (strDump + " ||"); - } - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/almgren2012/StaticOptimalTrajectoryTradeRate.java b/org/drip/sample/almgren2012/StaticOptimalTrajectoryTradeRate.java deleted file mode 100644 index c7bcae7..0000000 --- a/org/drip/sample/almgren2012/StaticOptimalTrajectoryTradeRate.java +++ /dev/null @@ -1,169 +0,0 @@ - -package org.drip.sample.almgren2012; - -import org.drip.execution.adaptive.*; -import org.drip.execution.hjb.NonDimensionalCostEvolverSystemic; -import org.drip.execution.optimum.EfficientTradingTrajectoryContinuous; -import org.drip.execution.risk.MeanVarianceObjectiveUtility; -import org.drip.execution.strategy.OrderSpecification; -import org.drip.execution.tradingtime.CoordinatedVariation; -import org.drip.measure.dynamics.DiffusionEvaluatorOrnsteinUhlenbeck; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * StaticOptimalTrajectoryTradeRate simulates the Trade Rate from the Sample Realization of the Static Cost - * Strategy extracted using the Mean Market State that follows the Zero Mean Ornstein-Uhlenbeck Evolution - * Dynamics. The References are: - * - * - Almgren, R. F., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 - * (2) 5-39. - * - * - Almgren, R. F. (2009): Optimal Trading in a Dynamic Market - * https://www.math.nyu.edu/financial_mathematics/content/02_financial/2009-2.pdf. - * - * - Almgren, R. F. (2012): Optimal Trading with Stochastic Liquidity and Volatility, SIAM Journal of - * Financial Mathematics 3 (1) 163-181. - * - * - Geman, H., D. B. Madan, and M. Yor (2001): Time Changes for Levy Processes, Mathematical Finance 11 (1) - * 79-96. - * - * - Walia, N. (2006): Optimal Trading: Dynamic Stock Liquidation Strategies, Senior Thesis, Princeton - * University. - * - * @author Lakshmi Krishnamurthy - */ - -public class StaticOptimalTrajectoryTradeRate { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblSize = 1.; - int iNumTimeNode = 51; - double dblBurstiness = 1.; - double dblExecutionTime = 10.; - double dblRelaxationTime = 1.; - double dblReferenceLiquidity = 1.; - double dblReferenceVolatility = 1.; - double[] adblRiskAversion = new double[] { - 0.01, - 0.04, - 0.09, - 0.16, - 0.36, - 0.64, - 1.00 - }; - - EfficientTradingTrajectoryContinuous[] aETTCHoldings = new EfficientTradingTrajectoryContinuous[adblRiskAversion.length]; - double dblTimeInterval = dblExecutionTime / (iNumTimeNode - 1); - - OrderSpecification os = new OrderSpecification ( - dblSize, - dblExecutionTime - ); - - CoordinatedVariation cv = new CoordinatedVariation ( - dblReferenceVolatility, - dblReferenceLiquidity - ); - - DiffusionEvaluatorOrnsteinUhlenbeck oup1D = DiffusionEvaluatorOrnsteinUhlenbeck.ZeroMean ( - dblBurstiness, - dblRelaxationTime - ); - - for (int i = 0; i < adblRiskAversion.length; ++i) - aETTCHoldings[i] = new CoordinatedVariationTrajectoryGenerator ( - os, - cv, - new MeanVarianceObjectiveUtility (adblRiskAversion[i]), - NonDimensionalCostEvolverSystemic.Standard (oup1D), - CoordinatedVariationTrajectoryGenerator.TRADE_RATE_ZERO_INITIALIZATION - ).nonAdaptive().trajectory(); - - System.out.println(); - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - System.out.println ("\t|| STATIC OPTIMAL TRAJECTORY TRADE RATE ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Time ||"); - - for (int j = 0; j < adblRiskAversion.length; ++j) - System.out.println ( - "\t|| - Non Dimensional Risk Aversion =>" + - FormatUtil.FormatDouble (dblRelaxationTime * dblReferenceVolatility * Math.sqrt (adblRiskAversion[j] / dblReferenceLiquidity), 1, 2, 1.) + - " ||" - ); - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - for (int i = 0; i < iNumTimeNode - 1; ++i) { - String strDump = "\t|| " + FormatUtil.FormatDouble (i * dblTimeInterval, 1, 2, 1.); - - for (int j = 0; j < adblRiskAversion.length; ++j) - strDump = strDump + " | " + FormatUtil.FormatDouble (dblTimeInterval * aETTCHoldings[j].tradeRate().evaluate (dblTimeInterval * i), 1, 4, 1.); - - System.out.println (strDump + " ||"); - } - - System.out.println ("\t||-----------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/almgrenchriss/EfficientFrontierNoDrift.java b/org/drip/sample/almgrenchriss/EfficientFrontierNoDrift.java deleted file mode 100644 index 165a3e3..0000000 --- a/org/drip/sample/almgrenchriss/EfficientFrontierNoDrift.java +++ /dev/null @@ -1,256 +0,0 @@ - -package org.drip.sample.almgrenchriss; - -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.*; -import org.drip.execution.nonadaptive.DiscreteAlmgrenChriss; -import org.drip.execution.optimum.AlmgrenChrissDiscrete; -import org.drip.execution.parameters.ArithmeticPriceDynamicsSettings; -import org.drip.execution.profiletime.UniformParticipationRateLinear; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * EfficientFrontierNoDrift constructs the Efficient Frontier over a Sequence of Risk Aversion Parameters for - * Optimal Trading Trajectories computed in accordance with the Specification of Almgren and Chriss (2000), - * and calculates the corresponding Execution Half Life and the Trajectory Penalty without regard to the - * Drift. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class EfficientFrontierNoDrift { - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblS0 = 50.; - double dblX = 1000000.; - double dblT = 5.; - int iN = 5; - double dblSigma = 0.95; - double dblAlpha = 0.02; - double dblEpsilon = 0.0625; - double dblGamma = 2.5e-07; - double dblEta = 2.5e-06; - double[] adblLambdaShortEndU = { - 0.001e-06, - 0.002e-06, - 0.003e-06, - 0.004e-06, - 0.005e-06, - 0.006e-06, - 0.007e-06, - 0.008e-06, - 0.009e-06 - }; - double[] adblLambdaLongEndU = { - 0.250e-06, - 0.500e-06, - 0.750e-06, - 1.000e-06, - 1.250e-06, - 1.500e-06, - 1.750e-06, - 2.000e-06, - 2.250e-06, - 2.500e-06, - 2.750e-06, - 3.000e-06, - 3.250e-06, - 3.500e-06, - 3.750e-06, - 4.000e-06 - }; - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.LinearExpectation ( - new ArithmeticPriceDynamicsSettings ( - dblAlpha, - new FlatUnivariate (dblSigma), - 0. - ), - new UniformParticipationRateLinear ( - new ParticipationRateLinear ( - 0., - dblGamma - ) - ), - new UniformParticipationRateLinear ( - new ParticipationRateLinear ( - dblEpsilon, - dblEta - ) - ) - ); - - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| ALMGREN-CHRISS TRAJECTORY GENERATOR INPUTS ||"); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\t| Initial Stock Price : " + dblS0); - - System.out.println ("\t| Initial Holdings : " + dblX); - - System.out.println ("\t| Liquidation Time : " + dblT); - - System.out.println ("\t| Number of Time Periods : " + iN); - - System.out.println ("\t| 30% Annual Volatility : " + dblSigma); - - System.out.println ("\t| 10% Annual Growth : " + dblAlpha); - - System.out.println ("\t| Bid-Ask Spread = 1/8 : " + dblEpsilon); - - System.out.println ("\t| Daily Volume 5 million Shares : " + dblGamma); - - System.out.println ("\t| Impact at 1% of Market : " + dblEta); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------||"); - - System.out.println ("\t| SHORT END COST DISTRIBUTION, PENALTY, AND DECAY ||"); - - System.out.println ("\t|------------------------------------------------------------||"); - - System.out.println ("\t| LAMBDA | MEAN | SIGMA^2 | PENALTY | HALFLIFE ||"); - - System.out.println ("\t|------------------------------------------------------------||"); - - for (double dblLambda : adblLambdaShortEndU) { - AlmgrenChrissDiscrete acd = (AlmgrenChrissDiscrete) DiscreteAlmgrenChriss.Standard ( - dblX, - dblT, - iN, - lpep, - dblLambda - ).generate(); - - String strHoldings = "\t| [LAMBDA = " + FormatUtil.FormatDouble (dblLambda, 1, 3, dblX) + "]"; - - double dblTransactionCostExpectation = acd.transactionCostExpectation(); - - double dblTransactionCostVariance = acd.transactionCostVariance(); - - double dblTransactionCostPenalty = dblTransactionCostExpectation + dblLambda * dblTransactionCostVariance; - - strHoldings = strHoldings + " | " + FormatUtil.FormatDouble (dblTransactionCostExpectation / dblX, 1, 4, 1.); - - strHoldings = strHoldings + " | " + FormatUtil.FormatDouble (dblTransactionCostVariance / dblX / dblX, 1, 4, 1.); - - strHoldings = strHoldings + " | " + FormatUtil.FormatDouble (dblTransactionCostPenalty / dblX, 1, 4, 1.); - - strHoldings = strHoldings + " | " + FormatUtil.FormatDouble (acd.halfLife(), 2, 2, 1.); - - System.out.println (strHoldings + " ||"); - } - - System.out.println ("\t|------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------||"); - - System.out.println ("\t| LONG END COST DISTRIBUTION, PENALTY, AND DECAY ||"); - - System.out.println ("\t|------------------------------------------------------------||"); - - System.out.println ("\t| LAMBDA | MEAN | SIGMA^2 | PENALTY | HALFLIFE ||"); - - System.out.println ("\t|------------------------------------------------------------||"); - - for (double dblLambda : adblLambdaLongEndU) { - AlmgrenChrissDiscrete acd = (AlmgrenChrissDiscrete) DiscreteAlmgrenChriss.Standard ( - dblX, - dblT, - iN, - lpep, - dblLambda - ).generate(); - - String strHoldings = "\t| [LAMBDA = " + FormatUtil.FormatDouble (dblLambda, 1, 3, dblX) + "]"; - - double dblTransactionCostExpectation = acd.transactionCostExpectation(); - - double dblTransactionCostVariance = acd.transactionCostVariance(); - - double dblTransactionCostPenalty = dblTransactionCostExpectation + dblLambda * dblTransactionCostVariance; - - strHoldings = strHoldings + " | " + FormatUtil.FormatDouble (dblTransactionCostExpectation / dblX, 1, 4, 1.); - - strHoldings = strHoldings + " | " + FormatUtil.FormatDouble (dblTransactionCostVariance / dblX / dblX, 1, 4, 1.); - - strHoldings = strHoldings + " | " + FormatUtil.FormatDouble (dblTransactionCostPenalty / dblX, 1, 4, 1.); - - strHoldings = strHoldings + " | " + FormatUtil.FormatDouble (acd.halfLife(), 1, 2, 1.); - - System.out.println (strHoldings + " ||"); - } - - System.out.println ("\t|------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/almgrenchriss/EfficientFrontierWithDrift.java b/org/drip/sample/almgrenchriss/EfficientFrontierWithDrift.java deleted file mode 100644 index d460b0b..0000000 --- a/org/drip/sample/almgrenchriss/EfficientFrontierWithDrift.java +++ /dev/null @@ -1,256 +0,0 @@ - -package org.drip.sample.almgrenchriss; - -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.*; -import org.drip.execution.nonadaptive.DiscreteAlmgrenChrissDrift; -import org.drip.execution.optimum.AlmgrenChrissDriftDiscrete; -import org.drip.execution.parameters.ArithmeticPriceDynamicsSettings; -import org.drip.execution.profiletime.UniformParticipationRateLinear; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * EfficientFrontierWithDrift constructs the Efficient Frontier over a Sequence of Risk Aversion Parameters - * for Optimal Trading Trajectories computed in accordance with the Specification of Almgren and Chriss - * (2000), and calculates the corresponding Execution Half Life and the Trajectory Penalty incorporating the - * Impact of Drift. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class EfficientFrontierWithDrift { - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblS0 = 50.; - double dblX = 1000000.; - double dblT = 5.; - int iN = 5; - double dblSigma = 0.95; - double dblAlpha = 0.02; - double dblEpsilon = 0.0625; - double dblGamma = 2.5e-07; - double dblEta = 2.5e-06; - double[] adblLambdaShortEndU = { - 0.001e-06, - 0.002e-06, - 0.003e-06, - 0.004e-06, - 0.005e-06, - 0.006e-06, - 0.007e-06, - 0.008e-06, - 0.009e-06 - }; - double[] adblLambdaLongEndU = { - 0.250e-06, - 0.500e-06, - 0.750e-06, - 1.000e-06, - 1.250e-06, - 1.500e-06, - 1.750e-06, - 2.000e-06, - 2.250e-06, - 2.500e-06, - 2.750e-06, - 3.000e-06, - 3.250e-06, - 3.500e-06, - 3.750e-06, - 4.000e-06 - }; - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.LinearExpectation ( - new ArithmeticPriceDynamicsSettings ( - dblAlpha, - new FlatUnivariate (dblSigma), - 0. - ), - new UniformParticipationRateLinear ( - new ParticipationRateLinear ( - 0., - dblGamma - ) - ), - new UniformParticipationRateLinear ( - new ParticipationRateLinear ( - dblEpsilon, - dblEta - ) - ) - ); - - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| ALMGREN-CHRISS TRAJECTORY GENERATOR INPUTS ||"); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\t| Initial Stock Price : " + dblS0); - - System.out.println ("\t| Initial Holdings : " + dblX); - - System.out.println ("\t| Liquidation Time : " + dblT); - - System.out.println ("\t| Number of Time Periods : " + iN); - - System.out.println ("\t| 30% Annual Volatility : " + dblSigma); - - System.out.println ("\t| 10% Annual Growth : " + dblAlpha); - - System.out.println ("\t| Bid-Ask Spread = 1/8 : " + dblEpsilon); - - System.out.println ("\t| Daily Volume 5 million Shares : " + dblGamma); - - System.out.println ("\t| Impact at 1% of Market : " + dblEta); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------||"); - - System.out.println ("\t| SHORT END COST DISTRIBUTION, PENALTY, AND DECAY ||"); - - System.out.println ("\t|------------------------------------------------------------||"); - - System.out.println ("\t| LAMBDA | MEAN | SIGMA^2 | PENALTY | HALFLIFE ||"); - - System.out.println ("\t|------------------------------------------------------------||"); - - for (double dblLambda : adblLambdaShortEndU) { - AlmgrenChrissDriftDiscrete acdd = (AlmgrenChrissDriftDiscrete) DiscreteAlmgrenChrissDrift.Standard ( - dblX, - dblT, - iN, - lpep, - dblLambda - ).generate(); - - String strHoldings = "\t| [LAMBDA = " + FormatUtil.FormatDouble (dblLambda, 1, 3, dblX) + "]"; - - double dblTransactionCostExpectation = acdd.transactionCostExpectation(); - - double dblTransactionCostVariance = acdd.transactionCostVariance(); - - double dblTransactionCostPenalty = dblTransactionCostExpectation + dblLambda * dblTransactionCostVariance; - - strHoldings = strHoldings + " | " + FormatUtil.FormatDouble (dblTransactionCostExpectation / dblX, 1, 4, 1.); - - strHoldings = strHoldings + " | " + FormatUtil.FormatDouble (dblTransactionCostVariance / dblX / dblX, 1, 4, 1.); - - strHoldings = strHoldings + " | " + FormatUtil.FormatDouble (dblTransactionCostPenalty / dblX, 1, 4, 1.); - - strHoldings = strHoldings + " | " + FormatUtil.FormatDouble (acdd.halfLife(), 2, 2, 1.); - - System.out.println (strHoldings + " ||"); - } - - System.out.println ("\t|------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------||"); - - System.out.println ("\t| LONG END COST DISTRIBUTION, PENALTY, AND DECAY ||"); - - System.out.println ("\t|------------------------------------------------------------||"); - - System.out.println ("\t| LAMBDA | MEAN | SIGMA^2 | PENALTY | HALFLIFE ||"); - - System.out.println ("\t|------------------------------------------------------------||"); - - for (double dblLambda : adblLambdaLongEndU) { - AlmgrenChrissDriftDiscrete acdd = (AlmgrenChrissDriftDiscrete) DiscreteAlmgrenChrissDrift.Standard ( - dblX, - dblT, - iN, - lpep, - dblLambda - ).generate(); - - String strHoldings = "\t| [LAMBDA = " + FormatUtil.FormatDouble (dblLambda, 1, 3, dblX) + "]"; - - double dblTransactionCostExpectation = acdd.transactionCostExpectation(); - - double dblTransactionCostVariance = acdd.transactionCostVariance(); - - double dblTransactionCostPenalty = dblTransactionCostExpectation + dblLambda * dblTransactionCostVariance; - - strHoldings = strHoldings + " | " + FormatUtil.FormatDouble (dblTransactionCostExpectation / dblX, 1, 4, 1.); - - strHoldings = strHoldings + " | " + FormatUtil.FormatDouble (dblTransactionCostVariance / dblX / dblX, 1, 4, 1.); - - strHoldings = strHoldings + " | " + FormatUtil.FormatDouble (dblTransactionCostPenalty / dblX, 1, 4, 1.); - - strHoldings = strHoldings + " | " + FormatUtil.FormatDouble (acdd.halfLife(), 1, 2, 1.); - - System.out.println (strHoldings + " ||"); - } - - System.out.println ("\t|------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/almgrenchriss/OptimalSerialCorrelationImpact.java b/org/drip/sample/almgrenchriss/OptimalSerialCorrelationImpact.java deleted file mode 100644 index 819153b..0000000 --- a/org/drip/sample/almgrenchriss/OptimalSerialCorrelationImpact.java +++ /dev/null @@ -1,251 +0,0 @@ - -package org.drip.sample.almgrenchriss; - -import org.drip.execution.capture.TrajectoryShortfallEstimator; -import org.drip.execution.discrete.OptimalSerialCorrelationAdjustment; -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.*; -import org.drip.execution.nonadaptive.DiscreteAlmgrenChriss; -import org.drip.execution.optimum.AlmgrenChrissDiscrete; -import org.drip.execution.parameters.*; -import org.drip.execution.profiletime.UniformParticipationRateLinear; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OptimalSerialCorrelationImpact estimates the Optimal Adjustment to the Optimal Trading Trajectory - * attributable to Serial Correlation in accordance with the Specification of Almgren and Chriss (2000) for - * the given Risk Aversion Parameter without the Asset Drift. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class OptimalSerialCorrelationImpact { - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblS0 = 50.; - double dblX = 1000000.; - double dblT = 5.; - int iN = 5; - double dblAnnualVolatility = 0.30; - double dblAnnualReturns = 0.10; - double dblBidAsk = 0.125; - double dblDailyVolume = 5.e06; - double dblDailyVolumePermanentImpact = 0.1; - double dblDailyVolumeTemporaryImpact = 0.01; - double dblLambdaU = 1.e-06; - double dblSerialCorrelation = 0.1; - - ArithmeticPriceDynamicsSettings apds = ArithmeticPriceDynamicsSettings.FromAnnualReturnsSettings ( - dblAnnualReturns, - dblAnnualVolatility, - 0., - dblS0 - ); - - double dblAlpha = apds.drift(); - - double dblSigma = apds.epochVolatility(); - - PriceMarketImpactLinear pmil = new PriceMarketImpactLinear ( - new AssetTransactionSettings ( - dblS0, - dblDailyVolume, - dblBidAsk - ), - dblDailyVolumePermanentImpact, - dblDailyVolumeTemporaryImpact - ); - - ParticipationRateLinear prlPermanent = (ParticipationRateLinear) pmil.permanentTransactionFunction(); - - ParticipationRateLinear prlTemporary = (ParticipationRateLinear) pmil.temporaryTransactionFunction(); - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.LinearExpectation ( - new ArithmeticPriceDynamicsSettings ( - 0., - new FlatUnivariate (dblSigma), - dblSerialCorrelation - ), - new UniformParticipationRateLinear (prlPermanent), - new UniformParticipationRateLinear (prlTemporary) - ); - - DiscreteAlmgrenChriss dac = DiscreteAlmgrenChriss.Standard ( - dblX, - dblT, - iN, - lpep, - dblLambdaU - ); - - AlmgrenChrissDiscrete acd = (AlmgrenChrissDiscrete) dac.generate(); - - double[] adblExecutionTimeNode = acd.executionTimeNode(); - - double[] adblTradeList = acd.tradeList(); - - double[] adblHoldings = acd.holdings(); - - TrajectoryShortfallEstimator tse = new TrajectoryShortfallEstimator (acd); - - OptimalSerialCorrelationAdjustment[] aOSCA = tse.serialCorrelationAdjustment (lpep); - - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| ALMGREN-CHRISS TRAJECTORY GENERATOR INPUTS ||"); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\t| Initial Stock Price : " + dblS0); - - System.out.println ("\t| Initial Holdings : " + dblX); - - System.out.println ("\t| Liquidation Time : " + dblT); - - System.out.println ("\t| Number of Time Periods : " + iN); - - System.out.println ("\t| Annual Volatility :" + FormatUtil.FormatDouble (dblAnnualVolatility, 1, 0, 100.) + "%"); - - System.out.println ("\t| Annual Growth :" + FormatUtil.FormatDouble (dblAnnualReturns, 1, 0, 100.) + "%"); - - System.out.println ("\t| Bid-Ask Spread : " + dblBidAsk); - - System.out.println ("\t| Daily Volume : " + dblDailyVolume); - - System.out.println ("\t| Daily Volume Temporary Impact : " + dblDailyVolumeTemporaryImpact); - - System.out.println ("\t| Daily Volume Permanent Impact : " + dblDailyVolumePermanentImpact); - - System.out.println ("\t| Daily Volume 5 million Shares : " + prlPermanent.slope()); - - System.out.println ("\t| Static Holdings 11,000 Shares : " + dblLambdaU); - - System.out.println ("\t|"); - - System.out.println ( - "\t| Daily Volatility : " + - FormatUtil.FormatDouble (dblSigma, 1, 4, 1.) - ); - - System.out.println ( - "\t| Daily Returns : " + - FormatUtil.FormatDouble (dblAlpha, 1, 4, 1.) - ); - - System.out.println ("\t| Temporary Impact Fixed Offset : " + prlTemporary.offset()); - - System.out.println ("\t| Eta : " + prlTemporary.slope()); - - System.out.println ("\t| Gamma : " + prlPermanent.slope()); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\n\t|-------------------------------------------------||"); - - System.out.println ("\t| AC2000 Optimal Trajectory ||"); - - System.out.println ("\t| ------ ------- ---------- ||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| Time Node ||"); - - System.out.println ("\t| Holdings ||"); - - System.out.println ("\t| Trade Amount ||"); - - System.out.println ("\t| Holdings Serial Correlation Adjustment ||"); - - System.out.println ("\t| Trade Amount Serial Correlation Adjustment ||"); - - System.out.println ("\t|-------------------------------------------------||"); - - for (int i = 0; i <= iN; ++i) { - if (i == 0) - System.out.println ( - "\t|" + FormatUtil.FormatDouble (adblExecutionTimeNode[i], 1, 0, 1.) + " => " + - FormatUtil.FormatDouble (adblHoldings[i], 7, 1, 1.) + " | " + - FormatUtil.FormatDouble (0., 6, 1, 1.) + " | " + - FormatUtil.FormatDouble (aOSCA[i].holdingsShift(), 5, 1, 1.) + " | " + - FormatUtil.FormatDouble (aOSCA[i].gain(), 3, 1, 1.) + " ||" - ); - else - System.out.println ( - "\t|" + FormatUtil.FormatDouble (adblExecutionTimeNode[i], 1, 0, 1.) + " => " + - FormatUtil.FormatDouble (adblHoldings[i], 7, 1, 1.) + " | " + - FormatUtil.FormatDouble (adblTradeList[i - 1], 6, 1, 1.) + " | " + - FormatUtil.FormatDouble (aOSCA[i].holdingsShift(), 5, 1, 1.) + " | " + - FormatUtil.FormatDouble (aOSCA[i].gain(), 3, 1, 1.) + " ||" - ); - } - - System.out.println ("\t|-------------------------------------------------||"); - } -} diff --git a/org/drip/sample/almgrenchriss/OptimalTrajectoryNoDrift.java b/org/drip/sample/almgrenchriss/OptimalTrajectoryNoDrift.java deleted file mode 100644 index 72a06c0..0000000 --- a/org/drip/sample/almgrenchriss/OptimalTrajectoryNoDrift.java +++ /dev/null @@ -1,346 +0,0 @@ - -package org.drip.sample.almgrenchriss; - -import org.drip.execution.capture.*; -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.*; -import org.drip.execution.nonadaptive.DiscreteAlmgrenChriss; -import org.drip.execution.optimum.AlmgrenChrissDiscrete; -import org.drip.execution.parameters.*; -import org.drip.execution.profiletime.UniformParticipationRateLinear; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.measure.gaussian.R1UnivariateNormal; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OptimalTrajectoryNoDrift demonstrates the Generation of the Optimal Trading Trajectory in accordance with - * the Specification of Almgren and Chriss (2000) for the given Risk Aversion Parameter without the Asset - * Drift. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class OptimalTrajectoryNoDrift { - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblS0 = 50.; - double dblX = 1000000.; - double dblT = 5.; - int iN = 5; - double dblAnnualVolatility = 0.30; - double dblAnnualReturns = 0.10; - double dblBidAsk = 0.125; - double dblDailyVolume = 5.e06; - double dblDailyVolumePermanentImpact = 0.1; - double dblDailyVolumeTemporaryImpact = 0.01; - double dblLambdaU = 1.e-06; - - ArithmeticPriceDynamicsSettings apds = ArithmeticPriceDynamicsSettings.FromAnnualReturnsSettings ( - dblAnnualReturns, - dblAnnualVolatility, - 0., - dblS0 - ); - - double dblAlpha = apds.drift(); - - double dblSigma = apds.epochVolatility(); - - PriceMarketImpactLinear pmil = new PriceMarketImpactLinear ( - new AssetTransactionSettings ( - dblS0, - dblDailyVolume, - dblBidAsk - ), - dblDailyVolumePermanentImpact, - dblDailyVolumeTemporaryImpact - ); - - ParticipationRateLinear prlPermanent = (ParticipationRateLinear) pmil.permanentTransactionFunction(); - - ParticipationRateLinear prlTemporary = (ParticipationRateLinear) pmil.temporaryTransactionFunction(); - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.LinearExpectation ( - new ArithmeticPriceDynamicsSettings ( - 0., - new FlatUnivariate (dblSigma), - 0. - ), - new UniformParticipationRateLinear (prlPermanent), - new UniformParticipationRateLinear (prlTemporary) - ); - - DiscreteAlmgrenChriss dac = DiscreteAlmgrenChriss.Standard ( - dblX, - dblT, - iN, - lpep, - dblLambdaU - ); - - AlmgrenChrissDiscrete acd = (AlmgrenChrissDiscrete) dac.generate(); - - double[] adblExecutionTimeNode = acd.executionTimeNode(); - - double[] adblTradeList = acd.tradeList(); - - double[] adblHoldings = acd.holdings(); - - LinearImpactTrajectoryEstimator lite = new LinearImpactTrajectoryEstimator (acd); - - TrajectoryShortfallAggregate tsa = lite.totalCostDistributionDetail (lpep); - - double[] adblIncrementalPermanentImpact = tsa.incrementalPermanentImpactExpectation(); - - double[] adblIncrementalTemporaryImpact = tsa.incrementalTemporaryImpactExpectation(); - - double[] adblCumulativePermanentImpact = tsa.cumulativePermanentImpactExpectation(); - - double[] adblCumulativeTemporaryImpact = tsa.cumulativeTemporaryImpactExpectation(); - - double[] adblIncrementalShortfallVariance = tsa.incrementalVariance(); - - double[] adblCumulativeShortfallVariance = tsa.cumulativeVariance(); - - double[] adblIncrementalShortfallMean = tsa.incrementalExpectation(); - - double[] adblCumulativeShortfallMean = tsa.cumulativeExpectation(); - - R1UnivariateNormal r1un = lite.totalCostDistributionSynopsis (lpep); - - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| ALMGREN-CHRISS TRAJECTORY GENERATOR INPUTS ||"); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\t| Initial Stock Price : " + dblS0); - - System.out.println ("\t| Initial Holdings : " + dblX); - - System.out.println ("\t| Liquidation Time : " + dblT); - - System.out.println ("\t| Number of Time Periods : " + iN); - - System.out.println ("\t| Annual Volatility :" + FormatUtil.FormatDouble (dblAnnualVolatility, 1, 0, 100.) + "%"); - - System.out.println ("\t| Annual Growth :" + FormatUtil.FormatDouble (dblAnnualReturns, 1, 0, 100.) + "%"); - - System.out.println ("\t| Bid-Ask Spread : " + dblBidAsk); - - System.out.println ("\t| Daily Volume : " + dblDailyVolume); - - System.out.println ("\t| Daily Volume Temporary Impact : " + dblDailyVolumeTemporaryImpact); - - System.out.println ("\t| Daily Volume Permanent Impact : " + dblDailyVolumePermanentImpact); - - System.out.println ("\t| Daily Volume 5 million Shares : " + prlPermanent.slope()); - - System.out.println ("\t| Static Holdings 11,000 Shares : " + dblLambdaU); - - System.out.println ("\t|"); - - System.out.println ( - "\t| Daily Volatility : " + - FormatUtil.FormatDouble (dblSigma, 1, 4, 1.) - ); - - System.out.println ( - "\t| Daily Returns : " + - FormatUtil.FormatDouble (dblAlpha, 1, 4, 1.) - ); - - System.out.println ("\t| Temporary Impact Fixed Offset : " + prlTemporary.offset()); - - System.out.println ("\t| Eta : " + prlTemporary.slope()); - - System.out.println ("\t| Gamma : " + prlPermanent.slope()); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\n\t|-----------------------------||"); - - System.out.println ("\t| AC2000 Optimal Trajectory ||"); - - System.out.println ("\t| ------ ------- ---------- ||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| Time Node ||"); - - System.out.println ("\t| Holdings ||"); - - System.out.println ("\t| Trade Amount ||"); - - System.out.println ("\t|-----------------------------||"); - - for (int i = 0; i <= iN; ++i) { - if (i == 0) - System.out.println ( - "\t|" + FormatUtil.FormatDouble (adblExecutionTimeNode[i], 1, 0, 1.) + " => " + - FormatUtil.FormatDouble (adblHoldings[i], 7, 1, 1.) + " | " + - FormatUtil.FormatDouble (0., 6, 1, 1.) + " ||" - ); - else - System.out.println ( - "\t|" + FormatUtil.FormatDouble (adblExecutionTimeNode[i], 1, 0, 1.) + " => " + - FormatUtil.FormatDouble (adblHoldings[i], 7, 1, 1.) + " | " + - FormatUtil.FormatDouble (adblTradeList[i - 1], 6, 1, 1.) + " ||" - ); - } - - System.out.println ("\t|-----------------------------||"); - - System.out.println ("\n\t|-----------------------------------------------------------||"); - - System.out.println ("\t| PERIOD LEVEL COST DISTRIBUTION ||"); - - System.out.println ("\t|-----------------------------------------------------------||"); - - System.out.println ("\t| PERIOD | MEAN | VARIANCE ||"); - - System.out.println ("\t|-----------------------------------------------------------||"); - - System.out.println ("\t| PERIOD | INCR | CUML | INCR | CUML ||"); - - System.out.println ("\t|-----------------------------------------------------------||"); - - for (int i = 0; i < adblIncrementalShortfallMean.length; ++i) - System.out.println ( - "\t| PERIOD #" + (i + 1) + " | " + - FormatUtil.FormatDouble (adblIncrementalShortfallMean[i], 6, 1, 1.) + " | " + - FormatUtil.FormatDouble (adblCumulativeShortfallMean[i], 6, 1, 1.) + " | " + - FormatUtil.FormatDouble (adblIncrementalShortfallVariance[i], 6, 1, 1.e-06) + " | " + - FormatUtil.FormatDouble (adblCumulativeShortfallVariance[i], 6, 1, 1.e-06) + " ||" - ); - - System.out.println ("\t|-----------------------------------------------------------||"); - - System.out.println ("\n\t|-----------------------------------------------------------||"); - - System.out.println ("\t| PERIOD LEVEL COST IMPACT CONTRIBUTION ||"); - - System.out.println ("\t|-----------------------------------------------------------||"); - - System.out.println ("\t| PERIOD | PERMANENT | TEMPORARY ||"); - - System.out.println ("\t|-----------------------------------------------------------||"); - - System.out.println ("\t| PERIOD | INCR | CUML | INCR | CUML ||"); - - System.out.println ("\t|-----------------------------------------------------------||"); - - for (int i = 0; i < adblIncrementalPermanentImpact.length; ++i) - System.out.println ( - "\t| PERIOD #" + (i + 1) + " | " + - FormatUtil.FormatDouble (adblIncrementalPermanentImpact[i], 6, 1, 1.) + " | " + - FormatUtil.FormatDouble (adblCumulativePermanentImpact[i], 6, 1, 1.) + " | " + - FormatUtil.FormatDouble (adblIncrementalTemporaryImpact[i], 6, 1, 1.) + " | " + - FormatUtil.FormatDouble (adblCumulativeTemporaryImpact[i], 6, 1, 1.) + " ||" - ); - - System.out.println ("\t|-----------------------------------------------------------||"); - - System.out.println ("\n\t|--------------------------------------------------------------||"); - - System.out.println ("\t| TRANSACTION COST RECONCILIATION: AC2000 vs. EXPLICIT LINEAR ||"); - - System.out.println ("\t|--------------------------------------------------------------||"); - - System.out.println ( - "\t| Transaction Cost Expectation : " + - FormatUtil.FormatDouble (r1un.mean(), 6, 1, 1.) + " | " + - FormatUtil.FormatDouble (acd.transactionCostExpectation(), 6, 1, 1.) + " ||" - ); - - System.out.println ( - "\t| Transaction Cost Variance (X 10^-06) : " + - FormatUtil.FormatDouble (r1un.variance(), 6, 1, 1.e-06) + " | " + - FormatUtil.FormatDouble (acd.transactionCostVariance(), 6, 1, 1.e-06) + " ||" - ); - - System.out.println ("\t|--------------------------------------------------------------||"); - - System.out.println ("\n\t|-----------------------||"); - - System.out.println ("\t| AC2000 METRICS DUMP ||"); - - System.out.println ("\t|-----------------------||"); - - System.out.println ("\t| Kappa : " + FormatUtil.FormatDouble (acd.kappa(), 1, 4, 1.) + " ||"); - - System.out.println ("\t| Kappa Tilda : " + FormatUtil.FormatDouble (acd.kappaTilda(), 1, 4, 1.) + " ||"); - - System.out.println ("\t| Half Life : " + FormatUtil.FormatDouble (acd.halfLife(), 1, 4, 1.) + " ||"); - - // System.out.println ("\t| Market Power: " + FormatUtil.FormatDouble (acd.marketPower(), 1, 4, 1.) + " ||"); - - System.out.println ("\t|-----------------------||"); - } -} diff --git a/org/drip/sample/almgrenchriss/OptimalTrajectoryWithDrift.java b/org/drip/sample/almgrenchriss/OptimalTrajectoryWithDrift.java deleted file mode 100644 index 653e219..0000000 --- a/org/drip/sample/almgrenchriss/OptimalTrajectoryWithDrift.java +++ /dev/null @@ -1,362 +0,0 @@ - -package org.drip.sample.almgrenchriss; - -import org.drip.execution.capture.*; -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.*; -import org.drip.execution.nonadaptive.DiscreteAlmgrenChrissDrift; -import org.drip.execution.optimum.AlmgrenChrissDriftDiscrete; -import org.drip.execution.parameters.*; -import org.drip.execution.profiletime.UniformParticipationRateLinear; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.measure.gaussian.R1UnivariateNormal; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OptimalTrajectoryWithDrift demonstrates the Generation of the Optimal Trading Trajectory in accordance with - * the Specification of Almgren and Chriss (2000) for the given Risk Aversion Parameter inclusive of the - * Asset Drift. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class OptimalTrajectoryWithDrift { - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblS0 = 50.; - double dblX = 1000000.; - double dblT = 5.; - int iN = 5; - double dblAnnualVolatility = 0.30; - double dblAnnualReturns = 0.10; - double dblBidAsk = 0.125; - double dblDailyVolume = 5.e06; - double dblDailyVolumePermanentImpact = 0.1; - double dblDailyVolumeTemporaryImpact = 0.01; - double dblLambdaU = 1.e-06; - - ArithmeticPriceDynamicsSettings apds = ArithmeticPriceDynamicsSettings.FromAnnualReturnsSettings ( - dblAnnualReturns, - dblAnnualVolatility, - 0., - dblS0 - ); - - double dblAlpha = apds.drift(); - - double dblSigma = apds.epochVolatility(); - - PriceMarketImpactLinear pmil = new PriceMarketImpactLinear ( - new AssetTransactionSettings ( - dblS0, - dblDailyVolume, - dblBidAsk - ), - dblDailyVolumePermanentImpact, - dblDailyVolumeTemporaryImpact - ); - - ParticipationRateLinear prlPermanent = (ParticipationRateLinear) pmil.permanentTransactionFunction(); - - ParticipationRateLinear prlTemporary = (ParticipationRateLinear) pmil.temporaryTransactionFunction(); - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.LinearExpectation ( - new ArithmeticPriceDynamicsSettings ( - dblAlpha, - new FlatUnivariate (dblSigma), - 0. - ), - new UniformParticipationRateLinear (prlPermanent), - new UniformParticipationRateLinear (prlTemporary) - ); - - DiscreteAlmgrenChrissDrift dacd = DiscreteAlmgrenChrissDrift.Standard ( - dblX, - dblT, - iN, - lpep, - dblLambdaU - ); - - AlmgrenChrissDriftDiscrete acdd = (AlmgrenChrissDriftDiscrete) dacd.generate(); - - double[] adblTradeListDriftAdjustment = acdd.tradeListDriftAdjustment(); - - double[] adblHoldingsDriftAdjustment = acdd.holdingsDriftAdjustment(); - - double[] adblExecutionTimeNode = acdd.executionTimeNode(); - - double[] adblTradeList = acdd.tradeList(); - - double[] adblHoldings = acdd.holdings(); - - LinearImpactTrajectoryEstimator lite = new LinearImpactTrajectoryEstimator (acdd); - - TrajectoryShortfallAggregate tsa = lite.totalCostDistributionDetail (lpep); - - double[] adblIncrementalPermanentImpact = tsa.incrementalPermanentImpactExpectation(); - - double[] adblIncrementalTemporaryImpact = tsa.incrementalTemporaryImpactExpectation(); - - double[] adblCumulativePermanentImpact = tsa.cumulativePermanentImpactExpectation(); - - double[] adblCumulativeTemporaryImpact = tsa.cumulativeTemporaryImpactExpectation(); - - double[] adblIncrementalShortfallVariance = tsa.incrementalVariance(); - - double[] adblCumulativeShortfallVariance = tsa.cumulativeVariance(); - - double[] adblIncrementalShortfallMean = tsa.incrementalExpectation(); - - double[] adblCumulativeShortfallMean = tsa.cumulativeExpectation(); - - R1UnivariateNormal r1un = lite.totalCostDistributionSynopsis (lpep); - - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| ALMGREN-CHRISS TRAJECTORY GENERATOR INPUTS ||"); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\t| Initial Stock Price : " + dblS0); - - System.out.println ("\t| Initial Holdings : " + dblX); - - System.out.println ("\t| Liquidation Time : " + dblT); - - System.out.println ("\t| Number of Time Periods : " + iN); - - System.out.println ("\t| Annual Volatility :" + FormatUtil.FormatDouble (dblAnnualVolatility, 1, 0, 100.) + "%"); - - System.out.println ("\t| Annual Growth :" + FormatUtil.FormatDouble (dblAnnualReturns, 1, 0, 100.) + "%"); - - System.out.println ("\t| Bid-Ask Spread : " + dblBidAsk); - - System.out.println ("\t| Daily Volume : " + dblDailyVolume); - - System.out.println ("\t| Daily Volume Temporary Impact : " + dblDailyVolumeTemporaryImpact); - - System.out.println ("\t| Daily Volume Permanent Impact : " + dblDailyVolumePermanentImpact); - - System.out.println ("\t| Daily Volume 5 million Shares : " + prlPermanent.slope()); - - System.out.println ("\t| Static Holdings 11,000 Shares : " + dblLambdaU); - - System.out.println ("\t|"); - - System.out.println ( - "\t| Daily Volatility : " + - FormatUtil.FormatDouble (dblSigma, 1, 4, 1.) - ); - - System.out.println ( - "\t| Daily Returns : " + - FormatUtil.FormatDouble (dblAlpha, 1, 4, 1.) - ); - - System.out.println ("\t| Temporary Impact Fixed Offset : " + prlTemporary.offset()); - - System.out.println ("\t| Eta : " + prlTemporary.slope()); - - System.out.println ("\t| Gamma : " + prlPermanent.slope()); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\n\t|-------------------------------------------------||"); - - System.out.println ("\t| AC2000 Optimal Trajectory ||"); - - System.out.println ("\t| ------ ------- ---------- ||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| Time Node ||"); - - System.out.println ("\t| Holdings ||"); - - System.out.println ("\t| Trade Amount ||"); - - System.out.println ("\t| Holdings Drift Adjustment ||"); - - System.out.println ("\t| Trade Amount Drift Adjustment ||"); - - System.out.println ("\t|-------------------------------------------------||"); - - for (int i = 0; i <= iN; ++i) { - if (i == 0) - System.out.println ( - "\t|" + FormatUtil.FormatDouble (adblExecutionTimeNode[i], 1, 0, 1.) + " => " + - FormatUtil.FormatDouble (adblHoldings[i], 7, 1, 1.) + " | " + - FormatUtil.FormatDouble (0., 6, 1, 1.) + " | " + - FormatUtil.FormatDouble (adblHoldingsDriftAdjustment[i], 4, 1, 1.) + " | " + - FormatUtil.FormatDouble (0., 4, 1, 1.) + " ||" - ); - else - System.out.println ( - "\t|" + FormatUtil.FormatDouble (adblExecutionTimeNode[i], 1, 0, 1.) + " => " + - FormatUtil.FormatDouble (adblHoldings[i], 7, 1, 1.) + " | " + - FormatUtil.FormatDouble (adblTradeList[i - 1], 6, 1, 1.) + " | " + - FormatUtil.FormatDouble (adblHoldingsDriftAdjustment[i], 4, 1, 1.) + " | " + - FormatUtil.FormatDouble (adblTradeListDriftAdjustment[i - 1], 4, 1, 1.) + " ||" - ); - } - - System.out.println ("\t|-------------------------------------------------||"); - - System.out.println ("\n\t|-----------------------------------------------------------||"); - - System.out.println ("\t| PERIOD LEVEL COST DISTRIBUTION ||"); - - System.out.println ("\t|-----------------------------------------------------------||"); - - System.out.println ("\t| PERIOD | MEAN | VARIANCE ||"); - - System.out.println ("\t|-----------------------------------------------------------||"); - - System.out.println ("\t| PERIOD | INCR | CUML | INCR | CUML ||"); - - System.out.println ("\t|-----------------------------------------------------------||"); - - for (int i = 0; i < adblIncrementalShortfallMean.length; ++i) - System.out.println ( - "\t| PERIOD #" + (i + 1) + " | " + - FormatUtil.FormatDouble (adblIncrementalShortfallMean[i], 6, 1, 1.) + " | " + - FormatUtil.FormatDouble (adblCumulativeShortfallMean[i], 6, 1, 1.) + " | " + - FormatUtil.FormatDouble (adblIncrementalShortfallVariance[i], 6, 1, 1.e-06) + " | " + - FormatUtil.FormatDouble (adblCumulativeShortfallVariance[i], 6, 1, 1.e-06) + " ||" - ); - - System.out.println ("\t|-----------------------------------------------------------||"); - - System.out.println ("\n\t|-----------------------------------------------------------||"); - - System.out.println ("\t| PERIOD LEVEL COST IMPACT CONTRIBUTION ||"); - - System.out.println ("\t|-----------------------------------------------------------||"); - - System.out.println ("\t| PERIOD | PERMANENT | TEMPORARY ||"); - - System.out.println ("\t|-----------------------------------------------------------||"); - - System.out.println ("\t| PERIOD | INCR | CUML | INCR | CUML ||"); - - System.out.println ("\t|-----------------------------------------------------------||"); - - for (int i = 0; i < adblIncrementalPermanentImpact.length; ++i) - System.out.println ( - "\t| PERIOD #" + (i + 1) + " | " + - FormatUtil.FormatDouble (adblIncrementalPermanentImpact[i], 6, 1, 1.) + " | " + - FormatUtil.FormatDouble (adblCumulativePermanentImpact[i], 6, 1, 1.) + " | " + - FormatUtil.FormatDouble (adblIncrementalTemporaryImpact[i], 6, 1, 1.) + " | " + - FormatUtil.FormatDouble (adblCumulativeTemporaryImpact[i], 6, 1, 1.) + " ||" - ); - - System.out.println ("\t|-----------------------------------------------------------||"); - - System.out.println ("\n\t|--------------------------------------------------------------||"); - - System.out.println ("\t| TRANSACTION COST RECONCILIATION: AC2000 vs. EXPLICIT LINEAR ||"); - - System.out.println ("\t|--------------------------------------------------------------||"); - - System.out.println ( - "\t| Transaction Cost Expectation : " + - FormatUtil.FormatDouble (r1un.mean(), 6, 1, 1.) + " | " + - FormatUtil.FormatDouble (acdd.transactionCostExpectation(), 6, 1, 1.) + " ||" - ); - - System.out.println ( - "\t| Transaction Cost Variance (X 10^-06) : " + - FormatUtil.FormatDouble (r1un.variance(), 6, 1, 1.e-06) + " | " + - FormatUtil.FormatDouble (acdd.transactionCostVariance(), 6, 1, 1.e-06) + " ||" - ); - - System.out.println ("\t|--------------------------------------------------------------||"); - - System.out.println ("\n\t|---------------------------------||"); - - System.out.println ("\t| AC2000 METRICS DUMP ||"); - - System.out.println ("\t|---------------------------------||"); - - System.out.println ("\t| Kappa : " + FormatUtil.FormatDouble (acdd.kappa(), 1, 3, 1.) + " ||"); - - System.out.println ("\t| Kappa Tilda : " + FormatUtil.FormatDouble (acdd.kappaTilda(), 1, 3, 1.) + " ||"); - - System.out.println ("\t| Half Life : " + FormatUtil.FormatDouble (acdd.halfLife(), 1, 3, 1.) + " ||"); - - // System.out.println ("\t| Market Power: " + FormatUtil.FormatDouble (acdd.marketPower(), 1, 4, 1.) + " ||"); - - System.out.println ("\t| Residual Holdings : " + FormatUtil.FormatDouble (acdd.residualHolding(), 5, 0, 1.) + " ||"); - - System.out.println ("\t| Drift Gain Upper Bound : " + FormatUtil.FormatDouble (acdd.driftGainUpperBound(), 2, 1, 1.) + " ||"); - - System.out.println ("\t|---------------------------------||"); - } -} diff --git a/org/drip/sample/almgrenchriss/TrajectoryComparisonNoDrift.java b/org/drip/sample/almgrenchriss/TrajectoryComparisonNoDrift.java deleted file mode 100644 index e92202c..0000000 --- a/org/drip/sample/almgrenchriss/TrajectoryComparisonNoDrift.java +++ /dev/null @@ -1,240 +0,0 @@ - -package org.drip.sample.almgrenchriss; - -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.*; -import org.drip.execution.nonadaptive.DiscreteAlmgrenChriss; -import org.drip.execution.optimum.AlmgrenChrissDiscrete; -import org.drip.execution.parameters.*; -import org.drip.execution.profiletime.UniformParticipationRateLinear; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TrajectoryComparisonNoDrift compares different Optimal Trading Trajectories computed in accordance with - * the Specification of Almgren and Chriss (2000) for a Set of Risk Aversion Parameters, excluding the Asset - * Drift. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class TrajectoryComparisonNoDrift { - - private static final void DisplayTrajectory ( - final AlmgrenChrissDiscrete acd, - final double dblLambda, - final double dblX) - throws Exception - { - double[] adblHoldings = acd.holdings(); - - String strHoldings = "\t| [LAMBDA = " + FormatUtil.FormatDouble (dblLambda, 1, 3, dblX) + "]"; - - for (int i = 0; i < adblHoldings.length; ++i) - strHoldings = strHoldings + " | " + FormatUtil.FormatDouble (adblHoldings[i] / dblX, 2, 3, 100.); - - System.out.println (strHoldings + " ||"); - } - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblS0 = 50.; - double dblX = 1000000.; - double dblT = 5.; - int iN = 5; - double dblAnnualVolatility = 0.30; - double dblAnnualReturns = 0.10; - double dblBidAsk = 0.125; - double dblDailyVolume = 5.e06; - double dblDailyVolumePermanentImpact = 0.1; - double dblDailyVolumeTemporaryImpact = 0.01; - double[] adblLambdaU = { - 0.001e-06, - 0.250e-06, - 0.500e-06, - 0.750e-06, - 1.000e-06, - 1.250e-06, - 1.500e-06, - 1.750e-06, - 2.000e-06, - 2.250e-06, - 2.500e-06, - 2.750e-06, - 3.000e-06, - 3.250e-06, - 3.500e-06, - 3.750e-06, - 4.000e-06 - }; - - ArithmeticPriceDynamicsSettings apds = ArithmeticPriceDynamicsSettings.FromAnnualReturnsSettings ( - dblAnnualReturns, - dblAnnualVolatility, - 0., - dblS0 - ); - - double dblAlpha = apds.drift(); - - double dblSigma = apds.epochVolatility(); - - PriceMarketImpactLinear pmil = new PriceMarketImpactLinear ( - new AssetTransactionSettings ( - dblS0, - dblDailyVolume, - dblBidAsk - ), - dblDailyVolumePermanentImpact, - dblDailyVolumeTemporaryImpact - ); - - ParticipationRateLinear prlPermanent = (ParticipationRateLinear) pmil.permanentTransactionFunction(); - - ParticipationRateLinear prlTemporary = (ParticipationRateLinear) pmil.temporaryTransactionFunction(); - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.LinearExpectation ( - new ArithmeticPriceDynamicsSettings ( - dblAlpha, - new FlatUnivariate (dblSigma), - 0. - ), - new UniformParticipationRateLinear (prlPermanent), - new UniformParticipationRateLinear (prlTemporary) - ); - - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| ALMGREN-CHRISS TRAJECTORY GENERATOR INPUTS ||"); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\t| Initial Stock Price : " + dblS0); - - System.out.println ("\t| Initial Holdings : " + dblX); - - System.out.println ("\t| Liquidation Time : " + dblT); - - System.out.println ("\t| Number of Time Periods : " + iN); - - System.out.println ("\t| Annual Volatility :" + FormatUtil.FormatDouble (dblAnnualVolatility, 1, 0, 100.) + "%"); - - System.out.println ("\t| Annual Growth :" + FormatUtil.FormatDouble (dblAnnualReturns, 1, 0, 100.) + "%"); - - System.out.println ("\t| Bid-Ask Spread : " + dblBidAsk); - - System.out.println ("\t| Daily Volume : " + dblDailyVolume); - - System.out.println ("\t| Daily Volume Temporary Impact : " + dblDailyVolumeTemporaryImpact); - - System.out.println ("\t| Daily Volume Permanent Impact : " + dblDailyVolumePermanentImpact); - - System.out.println ("\t| Daily Volume 5 million Shares : " + prlPermanent.slope()); - - System.out.println ("\t|"); - - System.out.println ( - "\t| Daily Volatility : " + - FormatUtil.FormatDouble (dblSigma, 1, 4, 1.) - ); - - System.out.println ( - "\t| Daily Returns : " + - FormatUtil.FormatDouble (dblAlpha, 1, 4, 1.) - ); - - System.out.println ("\t| Temporary Impact Fixed Offset : " + prlTemporary.offset()); - - System.out.println ("\t| Eta : " + prlTemporary.slope()); - - System.out.println ("\t| Gamma : " + prlPermanent.slope()); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\n\t|--------------------------------------------------------------------------------||"); - - System.out.println ("\t| OPTIMAL TRADING TRAJECTORY FOR DIFFERENT RISK AVERSION ||"); - - System.out.println ("\t|--------------------------------------------------------------------------------||"); - - for (double dblLambdaU : adblLambdaU) - DisplayTrajectory ( - (AlmgrenChrissDiscrete) DiscreteAlmgrenChriss.Standard ( - dblX, - dblT, - iN, - lpep, - dblLambdaU - ).generate(), - dblLambdaU, - dblX - ); - - System.out.println ("\t|--------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/almgrenchriss/TrajectoryComparisonWithDrift.java b/org/drip/sample/almgrenchriss/TrajectoryComparisonWithDrift.java deleted file mode 100644 index 389218b..0000000 --- a/org/drip/sample/almgrenchriss/TrajectoryComparisonWithDrift.java +++ /dev/null @@ -1,240 +0,0 @@ - -package org.drip.sample.almgrenchriss; - -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.*; -import org.drip.execution.nonadaptive.DiscreteAlmgrenChrissDrift; -import org.drip.execution.optimum.AlmgrenChrissDriftDiscrete; -import org.drip.execution.parameters.*; -import org.drip.execution.profiletime.UniformParticipationRateLinear; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TrajectoryComparisonWithDrift compares different Optimal Trading Trajectories computed in accordance with - * the Specification of Almgren and Chriss (2000) for a Set of Risk Aversion Parameters, inclusive of the - * Asset Drift. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class TrajectoryComparisonWithDrift { - - private static final void DisplayTrajectory ( - final AlmgrenChrissDriftDiscrete acdd, - final double dblLambda, - final double dblX) - throws Exception - { - double[] adblHoldings = acdd.holdings(); - - String strHoldings = "\t| [LAMBDA = " + FormatUtil.FormatDouble (dblLambda, 1, 3, dblX) + "]"; - - for (int i = 0; i < adblHoldings.length; ++i) - strHoldings = strHoldings + " | " + FormatUtil.FormatDouble (adblHoldings[i] / dblX, 2, 3, 100.); - - System.out.println (strHoldings + " ||"); - } - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblS0 = 50.; - double dblX = 1000000.; - double dblT = 5.; - int iN = 5; - double dblAnnualVolatility = 0.30; - double dblAnnualReturns = 0.10; - double dblBidAsk = 0.125; - double dblDailyVolume = 5.e06; - double dblDailyVolumePermanentImpact = 0.1; - double dblDailyVolumeTemporaryImpact = 0.01; - double[] adblLambdaU = { - 0.001e-06, - 0.250e-06, - 0.500e-06, - 0.750e-06, - 1.000e-06, - 1.250e-06, - 1.500e-06, - 1.750e-06, - 2.000e-06, - 2.250e-06, - 2.500e-06, - 2.750e-06, - 3.000e-06, - 3.250e-06, - 3.500e-06, - 3.750e-06, - 4.000e-06 - }; - - ArithmeticPriceDynamicsSettings apds = ArithmeticPriceDynamicsSettings.FromAnnualReturnsSettings ( - dblAnnualReturns, - dblAnnualVolatility, - 0., - dblS0 - ); - - double dblAlpha = apds.drift(); - - double dblSigma = apds.epochVolatility(); - - PriceMarketImpactLinear pmil = new PriceMarketImpactLinear ( - new AssetTransactionSettings ( - dblS0, - dblDailyVolume, - dblBidAsk - ), - dblDailyVolumePermanentImpact, - dblDailyVolumeTemporaryImpact - ); - - ParticipationRateLinear prlPermanent = (ParticipationRateLinear) pmil.permanentTransactionFunction(); - - ParticipationRateLinear prlTemporary = (ParticipationRateLinear) pmil.temporaryTransactionFunction(); - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.LinearExpectation ( - new ArithmeticPriceDynamicsSettings ( - dblAlpha, - new FlatUnivariate (dblSigma), - 0. - ), - new UniformParticipationRateLinear (prlPermanent), - new UniformParticipationRateLinear (prlTemporary) - ); - - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| ALMGREN-CHRISS TRAJECTORY GENERATOR INPUTS ||"); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\t| Initial Stock Price : " + dblS0); - - System.out.println ("\t| Initial Holdings : " + dblX); - - System.out.println ("\t| Liquidation Time : " + dblT); - - System.out.println ("\t| Number of Time Periods : " + iN); - - System.out.println ("\t| Annual Volatility :" + FormatUtil.FormatDouble (dblAnnualVolatility, 1, 0, 100.) + "%"); - - System.out.println ("\t| Annual Growth :" + FormatUtil.FormatDouble (dblAnnualReturns, 1, 0, 100.) + "%"); - - System.out.println ("\t| Bid-Ask Spread : " + dblBidAsk); - - System.out.println ("\t| Daily Volume : " + dblDailyVolume); - - System.out.println ("\t| Daily Volume Temporary Impact : " + dblDailyVolumeTemporaryImpact); - - System.out.println ("\t| Daily Volume Permanent Impact : " + dblDailyVolumePermanentImpact); - - System.out.println ("\t| Daily Volume 5 million Shares : " + prlPermanent.slope()); - - System.out.println ("\t|"); - - System.out.println ( - "\t| Daily Volatility : " + - FormatUtil.FormatDouble (dblSigma, 1, 4, 1.) - ); - - System.out.println ( - "\t| Daily Returns : " + - FormatUtil.FormatDouble (dblAlpha, 1, 4, 1.) - ); - - System.out.println ("\t| Temporary Impact Fixed Offset : " + prlTemporary.offset()); - - System.out.println ("\t| Eta : " + prlTemporary.slope()); - - System.out.println ("\t| Gamma : " + prlPermanent.slope()); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\n\t|--------------------------------------------------------------------------------||"); - - System.out.println ("\t| OPTIMAL TRADING TRAJECTORY FOR DIFFERENT RISK AVERSION ||"); - - System.out.println ("\t|--------------------------------------------------------------------------------||"); - - for (double dblLambdaU : adblLambdaU) - DisplayTrajectory ( - (AlmgrenChrissDriftDiscrete) DiscreteAlmgrenChrissDrift.Standard ( - dblX, - dblT, - iN, - lpep, - dblLambdaU - ).generate(), - dblLambdaU, - dblX - ); - - System.out.println ("\t|--------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/assetallocation/BudgetConstrainedVarianceMinimizer.java b/org/drip/sample/assetallocation/BudgetConstrainedVarianceMinimizer.java deleted file mode 100644 index 4a66330..0000000 --- a/org/drip/sample/assetallocation/BudgetConstrainedVarianceMinimizer.java +++ /dev/null @@ -1,209 +0,0 @@ - -package org.drip.sample.assetallocation; - -import org.drip.feed.loader.*; -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.InteriorPointBarrierControl; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * BudgetConstrainedVarianceMinimizer demonstrates the Construction of an Optimal Portfolio using the - * Variance Minimizing Allocator with Budget/Weight Constraints. - * - * @author Lakshmi Krishnamurthy - */ - -public class BudgetConstrainedVarianceMinimizer { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strSeriesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\MeanVarianceOptimizer\\FormattedSeries1.csv"; - - CSVGrid csvGrid = CSVParser.NamedStringGrid (strSeriesLocation); - - String[] astrVariateHeader = csvGrid.headers(); - - double dblAssetLowerBound = 0.05; - double dblAssetUpperBound = 0.65; - String[] astrAsset = new String[astrVariateHeader.length - 1]; - double[][] aadblVariateSample = new double[astrVariateHeader.length - 1][]; - - for (int i = 0; i < astrAsset.length; ++i) { - astrAsset[i] = astrVariateHeader[i + 1]; - - aadblVariateSample[i] = csvGrid.doubleArrayAtColumn (i + 1); - } - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAsset, - aadblVariateSample - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAsset); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAsset.length; ++i) - strHeader += " " + astrAsset[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAsset.length; ++i) { - String strDump = "\t| " + astrAsset[i] + " "; - - for (int j = 0; j < astrAsset.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|------------------||"); - - for (int i = 0; i < astrAsset.length; ++i) - System.out.println ( - "\t| " + astrAsset[i] + " | " + - FormatUtil.FormatDouble (dblAssetLowerBound, 1, 0, 100.) + "% | " + - FormatUtil.FormatDouble (dblAssetUpperBound, 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAsset, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT, - Double.NaN - ) - ); - - for (int i = 0; i < astrAsset.length; ++i) - pdp.addBound ( - astrAsset[i], - dblAssetLowerBound, - dblAssetUpperBound - ); - - OptimizationOutput pf = cmva.allocate ( - pdp, - ausp - ); - - AssetComponent[] aAC = pf.optimalPortfolio().assets(); - - System.out.println ("\t|---------------||"); - - System.out.println ("\t| ASSET WEIGHTS ||"); - - System.out.println ("\t|---------------||"); - - for (AssetComponent ac : aAC) - System.out.println ("\t| " + ac.id() + " | " + FormatUtil.FormatDouble (ac.amount(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|---------------||\n\n"); - - System.out.println ("\t|-----------------------------------------||"); - - System.out.println ("\t| Portfolio Notional : " + FormatUtil.FormatDouble (pf.optimalPortfolio().notional(), 1, 4, 1.) + " ||"); - - System.out.println ("\t| Portfolio Expected Return : " + FormatUtil.FormatDouble (pf.optimalMetrics().excessReturnsMean(), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Portfolio Standard Deviation : " + FormatUtil.FormatDouble (pf.optimalMetrics().excessReturnsStandardDeviation(), 1, 4, 100.) + "% ||"); - - System.out.println ("\t|-----------------------------------------||\n"); - } -} diff --git a/org/drip/sample/assetallocation/DualConstrainedVariateConvergence.java b/org/drip/sample/assetallocation/DualConstrainedVariateConvergence.java deleted file mode 100644 index 1b57d58..0000000 --- a/org/drip/sample/assetallocation/DualConstrainedVariateConvergence.java +++ /dev/null @@ -1,223 +0,0 @@ - -package org.drip.sample.assetallocation; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.*; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DualConstrainedVariateConvergence demonstrates the Sequential Convergence of the Constrained Optimal R^d - * Space. - * - * @author Lakshmi Krishnamurthy - */ - -public class DualConstrainedVariateConvergence { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - VariateInequalityConstraintMultiplier.s_bPreBoundBlog = true; - VariateInequalityConstraintMultiplier.s_bPostBoundBlog = true; - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.05, - 0.04, - 0.06, - 0.03, - 0.03, - 0.03, - 0.13 - }; - - double[] adblAssetUpperBound = new double[] { - 0.43, - 0.27, - 0.44, - 0.32, - 0.66, - 0.32, - 0.88 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.1300, - 0.0700, - 0.0400, - 0.0300, - 0.0800, - 0.1000, - 0.0100 - }; - - double dblPortfolioDesignReturn = 0.06000; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733 * 12, 0.002083 * 12, 0.001593 * 12, 0.000488 * 12, 0.001172 * 12, 0.002312 * 12, 0.000710 * 12}, - {0.002083 * 12, 0.002768 * 12, 0.001302 * 12, 0.000457 * 12, 0.001105 * 12, 0.001647 * 12, 0.000563 * 12}, - {0.001593 * 12, 0.001302 * 12, 0.001463 * 12, 0.000639 * 12, 0.001050 * 12, 0.001110 * 12, 0.000519 * 12}, - {0.000488 * 12, 0.000457 * 12, 0.000639 * 12, 0.000608 * 12, 0.000663 * 12, 0.000042 * 12, 0.000370 * 12}, - {0.001172 * 12, 0.001105 * 12, 0.001050 * 12, 0.000663 * 12, 0.001389 * 12, 0.000825 * 12, 0.000661 * 12}, - {0.002312 * 12, 0.001647 * 12, 0.001110 * 12, 0.000042 * 12, 0.000825 * 12, 0.005211 * 12, 0.000749 * 12}, - {0.000710 * 12, 0.000563 * 12, 0.000519 * 12, 0.000370 * 12, 0.000661 * 12, 0.000749 * 12, 0.000703 * 12} - }; - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - pdp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - cmva.allocate ( - pdp, - ausp - ); - } -} diff --git a/org/drip/sample/assetallocation/ReturnsConstrainedVarianceMinimizer.java b/org/drip/sample/assetallocation/ReturnsConstrainedVarianceMinimizer.java deleted file mode 100644 index 1957c99..0000000 --- a/org/drip/sample/assetallocation/ReturnsConstrainedVarianceMinimizer.java +++ /dev/null @@ -1,212 +0,0 @@ - -package org.drip.sample.assetallocation; - -import org.drip.feed.loader.*; -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.InteriorPointBarrierControl; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ReturnsConstrainedVarianceMinimizer demonstrates the Construction of an Optimal Portfolio using the - * Variance Minimizing Allocator with Weight Normalization Constraints and Design Returns Constraints. - * - * @author Lakshmi Krishnamurthy - */ - -public class ReturnsConstrainedVarianceMinimizer { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strSeriesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\MeanVarianceOptimizer\\FormattedSeries1.csv"; - - CSVGrid csvGrid = CSVParser.NamedStringGrid (strSeriesLocation); - - String[] astrVariateHeader = csvGrid.headers(); - - double dblDesignReturn = 0.0026; - double dblAssetLowerBound = 0.05; - double dblAssetUpperBound = 0.65; - String[] astrAsset = new String[astrVariateHeader.length - 1]; - double[][] aadblVariateSample = new double[astrVariateHeader.length - 1][]; - - for (int i = 0; i < astrAsset.length; ++i) { - astrAsset[i] = astrVariateHeader[i + 1]; - - aadblVariateSample[i] = csvGrid.doubleArrayAtColumn (i + 1); - } - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAsset, - aadblVariateSample - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAsset); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAsset.length; ++i) - strHeader += " " + astrAsset[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAsset.length; ++i) { - String strDump = "\t| " + astrAsset[i] + " "; - - for (int j = 0; j < astrAsset.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|------------------||"); - - for (int i = 0; i < astrAsset.length; ++i) - System.out.println ( - "\t| " + astrAsset[i] + " | " + - FormatUtil.FormatDouble (dblAssetLowerBound, 1, 0, 100.) + "% | " + - FormatUtil.FormatDouble (dblAssetUpperBound, 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAsset, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblDesignReturn - ) - ); - - for (int i = 0; i < astrAsset.length; ++i) - pdp.addBound ( - astrAsset[i], - dblAssetLowerBound, - dblAssetUpperBound - ); - - OptimizationOutput pf = cmva.allocate ( - pdp, - ausp - ); - - AssetComponent[] aAC = pf.optimalPortfolio().assets(); - - System.out.println ("\t|---------------||"); - - System.out.println ("\t| ASSET WEIGHTS ||"); - - System.out.println ("\t|---------------||"); - - for (AssetComponent ac : aAC) - System.out.println ("\t| " + ac.id() + " | " + FormatUtil.FormatDouble (ac.amount(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|---------------||\n\n"); - - System.out.println ("\t|-----------------------------------------||"); - - System.out.println ("\t| Portfolio Notional : " + FormatUtil.FormatDouble (pf.optimalPortfolio().notional(), 1, 4, 1.) + " ||"); - - System.out.println ("\t| Portfolio Design Return : " + FormatUtil.FormatDouble (dblDesignReturn, 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Portfolio Expected Return : " + FormatUtil.FormatDouble (pf.optimalMetrics().excessReturnsMean(), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Portfolio Standard Deviation : " + FormatUtil.FormatDouble (pf.optimalMetrics().excessReturnsStandardDeviation(), 1, 4, 100.) + "% ||"); - - System.out.println ("\t|-----------------------------------------||\n"); - } -} diff --git a/org/drip/sample/assetallocation/RiskTolerantVarianceMinimizer.java b/org/drip/sample/assetallocation/RiskTolerantVarianceMinimizer.java deleted file mode 100644 index 8aebb8d..0000000 --- a/org/drip/sample/assetallocation/RiskTolerantVarianceMinimizer.java +++ /dev/null @@ -1,155 +0,0 @@ - -package org.drip.sample.assetallocation; - -import org.drip.feed.loader.*; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * RiskTolerantVarianceMinimizer demonstrates the Construction of an Optimal Portfolio using the Variance - * Minimization with a Fully Invested Constraint on a Risk Tolerance Objective Function. - * - * @author Lakshmi Krishnamurthy - */ - -public class RiskTolerantVarianceMinimizer { - - static final void RiskTolerancePortfolio ( - final String[] astrAsset, - final AssetUniverseStatisticalProperties ausp, - final double dblRiskTolerance) - throws Exception - { - OptimizationOutput opf = new QuadraticMeanVarianceOptimizer().allocate ( - new PortfolioConstructionParameters ( - astrAsset, - CustomRiskUtilitySettings.RiskTolerant (dblRiskTolerance), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT, - Double.NaN - ) - ), - ausp - ); - - AssetComponent[] aAC = opf.optimalPortfolio().assets(); - - System.out.println ("\t|----------------||"); - - for (AssetComponent ac : aAC) - System.out.println ("\t| " + ac.id() + " | " + FormatUtil.FormatDouble (ac.amount(), 3, 2, 100.) + "% ||"); - - System.out.println ("\t|----------------||"); - - System.out.println ("\t|---------------------------------------||"); - - System.out.println ("\t| Portfolio Notional : " + FormatUtil.FormatDouble (opf.optimalPortfolio().notional(), 1, 3, 1.) + " ||"); - - System.out.println ("\t| Portfolio Expected Return : " + FormatUtil.FormatDouble (opf.optimalMetrics().excessReturnsMean(), 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Portfolio Standard Deviation : " + FormatUtil.FormatDouble (opf.optimalMetrics().excessReturnsStandardDeviation(), 1, 2, 100.) + "% ||"); - - System.out.println ("\t|---------------------------------------||\n"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strSeriesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\MeanVarianceOptimizer\\FormattedSeries1.csv"; - - CSVGrid csvGrid = CSVParser.NamedStringGrid (strSeriesLocation); - - String[] astrVariateHeader = csvGrid.headers(); - - String[] astrAsset = new String[astrVariateHeader.length - 1]; - double[][] aadblVariateSample = new double[astrVariateHeader.length - 1][]; - - for (int i = 0; i < astrAsset.length; ++i) { - astrAsset[i] = astrVariateHeader[i + 1]; - - aadblVariateSample[i] = csvGrid.doubleArrayAtColumn (i + 1); - } - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAsset, - aadblVariateSample - ) - ); - - double[] adblRiskTolerance = new double[] { - 0.1, - 0.2, - 0.3, - 0.5, - 1.0 - }; - - for (double dblRiskTolerance : adblRiskTolerance) { - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| Running Optimization For Risk Tolerance " + dblRiskTolerance + " ||"); - - System.out.println ("\t|---------------------------------------------||"); - - RiskTolerancePortfolio ( - astrAsset, - ausp, - dblRiskTolerance - ); - } - } -} diff --git a/org/drip/sample/assetallocation/VanillaVarianceMinimizer.java b/org/drip/sample/assetallocation/VanillaVarianceMinimizer.java deleted file mode 100644 index 92ab0e5..0000000 --- a/org/drip/sample/assetallocation/VanillaVarianceMinimizer.java +++ /dev/null @@ -1,139 +0,0 @@ - -package org.drip.sample.assetallocation; - -import org.drip.feed.loader.*; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * VanillaVarianceMinimizer demonstrates the Construction of an Optimal Portfolio using the Variance - * Minimizing Allocator with only the Fully Invested Constraint. - * - * @author Lakshmi Krishnamurthy - */ - -public class VanillaVarianceMinimizer { - - static final void RiskTolerancePortfolio ( - final String[] astrAsset, - final AssetUniverseStatisticalProperties ausp, - final double dblRiskTolerance) - throws Exception - { - OptimizationOutput opf = new QuadraticMeanVarianceOptimizer().allocate ( - new PortfolioConstructionParameters ( - astrAsset, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT, - Double.NaN - ) - ), - ausp - ); - - AssetComponent[] aAC = opf.optimalPortfolio().assets(); - - System.out.println ("\n\n\t|---------------||"); - - for (AssetComponent ac : aAC) - System.out.println ("\t| " + ac.id() + " | " + FormatUtil.FormatDouble (ac.amount(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|---------------||"); - - System.out.println ("\t|---------------------------------------||"); - - System.out.println ("\t| Portfolio Notional : " + FormatUtil.FormatDouble (opf.optimalPortfolio().notional(), 1, 3, 1.) + " ||"); - - System.out.println ("\t| Portfolio Expected Return : " + FormatUtil.FormatDouble (opf.optimalMetrics().excessReturnsMean(), 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Portfolio Standard Deviation : " + FormatUtil.FormatDouble (opf.optimalMetrics().excessReturnsStandardDeviation(), 1, 2, 100.) + "% ||"); - - System.out.println ("\t|---------------------------------------||\n"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strSeriesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\MeanVarianceOptimizer\\FormattedSeries1.csv"; - - CSVGrid csvGrid = CSVParser.NamedStringGrid (strSeriesLocation); - - String[] astrVariateHeader = csvGrid.headers(); - - String[] astrAsset = new String[astrVariateHeader.length - 1]; - double[][] aadblVariateSample = new double[astrVariateHeader.length - 1][]; - - for (int i = 0; i < astrAsset.length; ++i) { - astrAsset[i] = astrVariateHeader[i + 1]; - - aadblVariateSample[i] = csvGrid.doubleArrayAtColumn (i + 1); - } - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAsset, - aadblVariateSample - ) - ); - - RiskTolerancePortfolio ( - astrAsset, - ausp, - 0. - ); - } -} diff --git a/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler01.java b/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler01.java deleted file mode 100644 index aa65239..0000000 --- a/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler01.java +++ /dev/null @@ -1,279 +0,0 @@ - -package org.drip.sample.assetallocationexcel; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.InteriorPointBarrierControl; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CMV Monthly Reconciler demonstrates the Execution and Reconciliation of the Dual Constrained Mean Variance - * against an XL-based Monthly Series Implementation for Portfolio Design Returns #1. - * - * @author Lakshmi Krishnamurthy - */ - -public class CMVMonthlyReconciler01 { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.05, - 0.05, - 0.05, - 0.10, - 0.05, - 0.05, - 0.03 - }; - - double[] adblAssetUpperBound = new double[] { - 0.40, - 0.40, - 0.30, - 0.60, - 0.35, - 0.15, - 0.50 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.008430, - 0.007230, - 0.006450, - 0.002560, - 0.004480, - 0.006840, - 0.001670 - }; - - double dblPortfolioDesignReturn = 0.005000; - double dblPortfolioRiskExcel = 0.029698; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733, 0.002083, 0.001593, 0.000488, 0.001172, 0.002312, 0.000710}, - {0.002083, 0.002768, 0.001302, 0.000457, 0.001105, 0.001647, 0.000563}, - {0.001593, 0.001302, 0.001463, 0.000639, 0.001050, 0.001110, 0.000519}, - {0.000488, 0.000457, 0.000639, 0.000608, 0.000663, 0.000042, 0.000370}, - {0.001172, 0.001105, 0.001050, 0.000663, 0.001389, 0.000825, 0.000661}, - {0.002312, 0.001647, 0.001110, 0.000042, 0.000825, 0.005211, 0.000749}, - {0.000710, 0.000563, 0.000519, 0.000370, 0.000661, 0.000749, 0.000703} - }; - - double[] adblReconcilerVariate = new double[] { - 0.119291, - 0.081994, - 0.258774, - 0.394306, - 0.050000, - 0.065636, - 0.030000 - }; - - AssetComponent[] aACReconciler = new AssetComponent[adblReconcilerVariate.length]; - - for (int i = 0; i < adblReconcilerVariate.length; ++i) - aACReconciler[i] = new AssetComponent ( - astrAssetName[i], - adblReconcilerVariate[i] - ); - - Portfolio pfReconciler = new Portfolio (aACReconciler); - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - pdp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - OptimizationOutput pfOptimal = cmva.allocate ( - pdp, - ausp - ); - - AssetComponent[] aACOptimal = pfOptimal.optimalPortfolio().assets(); - - System.out.println ("\t|------------------------------||"); - - System.out.println ("\t| OPTIMAL ASSET WEIGHTS ||"); - - System.out.println ("\t|------------------------------||"); - - System.out.println ("\t| ASSET | DRIP | EXCEL ||"); - - System.out.println ("\t|------------------------------||"); - - for (int i = 0; i < aACOptimal.length; ++i) - System.out.println ( - "\t| " + aACOptimal[i].id() + " |" + - FormatUtil.FormatDouble (aACOptimal[i].amount(), 2, 4, 100.) + "% | " + - FormatUtil.FormatDouble (aACReconciler[i].amount(), 2, 4, 100.) + "% ||" - ); - - System.out.println ("\t|------------------------------||\n\n"); - - System.out.println ("\t|-------------------------------------------------------------||"); - - System.out.println ("\t| Optimal Portfolio Normalize : " + FormatUtil.FormatDouble (pfOptimal.optimalPortfolio().notional(), 1, 4, 1.) + " ||"); - - System.out.println ("\t| Optimal Portfolio Input Return : " + FormatUtil.FormatDouble (dblPortfolioDesignReturn, 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Expected Return : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsMean(), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Standard Deviation : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsStandardDeviation(), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation (Calculated) : " + FormatUtil.FormatDouble (Math.sqrt (pfReconciler.variance (ausp)), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation (Input) : " + FormatUtil.FormatDouble (dblPortfolioRiskExcel, 1, 4, 100.) + "% ||"); - - System.out.println ("\t|-------------------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler02.java b/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler02.java deleted file mode 100644 index 3b4c860..0000000 --- a/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler02.java +++ /dev/null @@ -1,279 +0,0 @@ - -package org.drip.sample.assetallocationexcel; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.InteriorPointBarrierControl; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CMV Monthly Reconciler demonstrates the Execution and Reconciliation of the Dual Constrained Mean Variance - * against an XL-based Monthly Series Implementation for Portfolio Design Returns #2. - * - * @author Lakshmi Krishnamurthy - */ - -public class CMVMonthlyReconciler02 { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.05, - 0.05, - 0.05, - 0.10, - 0.05, - 0.05, - 0.03 - }; - - double[] adblAssetUpperBound = new double[] { - 0.40, - 0.40, - 0.30, - 0.60, - 0.35, - 0.15, - 0.50 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.008430, - 0.007230, - 0.006450, - 0.002560, - 0.004480, - 0.006840, - 0.001670 - }; - - double dblPortfolioDesignReturn = 0.005500; - double dblPortfolioRiskExcel = 0.032085; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733, 0.002083, 0.001593, 0.000488, 0.001172, 0.002312, 0.000710}, - {0.002083, 0.002768, 0.001302, 0.000457, 0.001105, 0.001647, 0.000563}, - {0.001593, 0.001302, 0.001463, 0.000639, 0.001050, 0.001110, 0.000519}, - {0.000488, 0.000457, 0.000639, 0.000608, 0.000663, 0.000042, 0.000370}, - {0.001172, 0.001105, 0.001050, 0.000663, 0.001389, 0.000825, 0.000661}, - {0.002312, 0.001647, 0.001110, 0.000042, 0.000825, 0.005211, 0.000749}, - {0.000710, 0.000563, 0.000519, 0.000370, 0.000661, 0.000749, 0.000703} - }; - - double[] adblReconcilerVariate = new double[] { - 0.181258, - 0.089530, - 0.300000, - 0.297434, - 0.050000, - 0.051778, - 0.030000 - }; - - AssetComponent[] aACReconciler = new AssetComponent[adblReconcilerVariate.length]; - - for (int i = 0; i < adblReconcilerVariate.length; ++i) - aACReconciler[i] = new AssetComponent ( - astrAssetName[i], - adblReconcilerVariate[i] - ); - - Portfolio pfReconciler = new Portfolio (aACReconciler); - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - pdp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - OptimizationOutput pfOptimal = cmva.allocate ( - pdp, - ausp - ); - - AssetComponent[] aACOptimal = pfOptimal.optimalPortfolio().assets(); - - System.out.println ("\t|------------------------------||"); - - System.out.println ("\t| OPTIMAL ASSET WEIGHTS ||"); - - System.out.println ("\t|------------------------------||"); - - System.out.println ("\t| ASSET | DRIP | EXCEL ||"); - - System.out.println ("\t|------------------------------||"); - - for (int i = 0; i < aACOptimal.length; ++i) - System.out.println ( - "\t| " + aACOptimal[i].id() + " |" + - FormatUtil.FormatDouble (aACOptimal[i].amount(), 2, 4, 100.) + "% | " + - FormatUtil.FormatDouble (aACReconciler[i].amount(), 2, 4, 100.) + "% ||" - ); - - System.out.println ("\t|------------------------------||\n\n"); - - System.out.println ("\t|-------------------------------------------------------------||"); - - System.out.println ("\t| Optimal Portfolio Normalize : " + FormatUtil.FormatDouble (pfOptimal.optimalPortfolio().notional(), 1, 4, 1.) + " ||"); - - System.out.println ("\t| Optimal Portfolio Input Return : " + FormatUtil.FormatDouble (dblPortfolioDesignReturn, 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Expected Return : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsMean(), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Standard Deviation : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsStandardDeviation(), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation (Calculated) : " + FormatUtil.FormatDouble (Math.sqrt (pfReconciler.variance (ausp)), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation (Input) : " + FormatUtil.FormatDouble (dblPortfolioRiskExcel, 1, 4, 100.) + "% ||"); - - System.out.println ("\t|-------------------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler03.java b/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler03.java deleted file mode 100644 index b2bae4e..0000000 --- a/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler03.java +++ /dev/null @@ -1,279 +0,0 @@ - -package org.drip.sample.assetallocationexcel; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.InteriorPointBarrierControl; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CMV Monthly Reconciler demonstrates the Execution and Reconciliation of the Dual Constrained Mean Variance - * against an XL-based Monthly Series Implementation for Portfolio Design Returns #3. - * - * @author Lakshmi Krishnamurthy - */ - -public class CMVMonthlyReconciler03 { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.05, - 0.05, - -0.10, - 0.10, - -0.10, - -0.10, - -0.10 - }; - - double[] adblAssetUpperBound = new double[] { - 0.40, - 0.40, - 0.30, - 0.60, - 0.35, - 0.15, - 0.50 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.008930, - 0.007730, - 0.005450, - 0.003660, - 0.005980, - 0.007140, - 0.003870 - }; - - double dblPortfolioDesignReturn = 0.006540; - double dblPortfolioRiskExcel = 0.033370; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733, 0.002083, 0.001593, 0.000488, 0.001172, 0.002312, 0.000710}, - {0.002083, 0.002768, 0.001302, 0.000457, 0.001105, 0.001647, 0.000563}, - {0.001593, 0.001302, 0.001463, 0.000639, 0.001050, 0.001110, 0.000519}, - {0.000488, 0.000457, 0.000639, 0.000608, 0.000663, 0.000042, 0.000370}, - {0.001172, 0.001105, 0.001050, 0.000663, 0.001389, 0.000825, 0.000661}, - {0.002312, 0.001647, 0.001110, 0.000042, 0.000825, 0.005211, 0.000749}, - {0.000710, 0.000563, 0.000519, 0.000370, 0.000661, 0.000749, 0.000703} - }; - - double[] adblReconcilerVariate = new double[] { - 0.400000, - 0.090368, - -0.100000, - 0.356280, - 0.219465, - 0.020467, - 0.013420 - }; - - AssetComponent[] aACReconciler = new AssetComponent[adblReconcilerVariate.length]; - - for (int i = 0; i < adblReconcilerVariate.length; ++i) - aACReconciler[i] = new AssetComponent ( - astrAssetName[i], - adblReconcilerVariate[i] - ); - - Portfolio pfReconciler = new Portfolio (aACReconciler); - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - pdp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - OptimizationOutput pfOptimal = cmva.allocate ( - pdp, - ausp - ); - - AssetComponent[] aACOptimal = pfOptimal.optimalPortfolio().assets(); - - System.out.println ("\t|------------------------------||"); - - System.out.println ("\t| OPTIMAL ASSET WEIGHTS ||"); - - System.out.println ("\t|------------------------------||"); - - System.out.println ("\t| ASSET | DRIP | EXCEL ||"); - - System.out.println ("\t|------------------------------||"); - - for (int i = 0; i < aACOptimal.length; ++i) - System.out.println ( - "\t| " + aACOptimal[i].id() + " |" + - FormatUtil.FormatDouble (aACOptimal[i].amount(), 2, 4, 100.) + "% | " + - FormatUtil.FormatDouble (aACReconciler[i].amount(), 2, 4, 100.) + "% ||" - ); - - System.out.println ("\t|------------------------------||\n\n"); - - System.out.println ("\t|-------------------------------------------------------------||"); - - System.out.println ("\t| Optimal Portfolio Normalize : " + FormatUtil.FormatDouble (pfOptimal.optimalPortfolio().notional(), 1, 4, 1.) + " ||"); - - System.out.println ("\t| Optimal Portfolio Input Return : " + FormatUtil.FormatDouble (dblPortfolioDesignReturn, 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Expected Return : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsMean(), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Standard Deviation : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsStandardDeviation(), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation (Calculated) : " + FormatUtil.FormatDouble (Math.sqrt (pfReconciler.variance (ausp)), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation (Input) : " + FormatUtil.FormatDouble (dblPortfolioRiskExcel, 1, 4, 100.) + "% ||"); - - System.out.println ("\t|-------------------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler04.java b/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler04.java deleted file mode 100644 index 5acc3f5..0000000 --- a/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler04.java +++ /dev/null @@ -1,279 +0,0 @@ - -package org.drip.sample.assetallocationexcel; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.InteriorPointBarrierControl; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CMV Monthly Reconciler demonstrates the Execution and Reconciliation of the Dual Constrained Mean Variance - * against an XL-based Monthly Series Implementation for Portfolio Design Returns #4. - * - * @author Lakshmi Krishnamurthy - */ - -public class CMVMonthlyReconciler04 { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.00, - 0.00, - 0.00, - 0.00, - 0.00, - 0.00, - 0.00 - }; - - double[] adblAssetUpperBound = new double[] { - 0.30, - 0.30, - 0.30, - 0.50, - 0.30, - 0.30, - 0.50 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.008930, - 0.007730, - 0.006450, - 0.003660, - 0.006980, - 0.007140, - 0.003870 - }; - - double dblPortfolioDesignReturn = 0.005124; - double dblPortfolioRiskExcel = 0.025817; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733, 0.002083, 0.001593, 0.000488, 0.001172, 0.002312, 0.000710}, - {0.002083, 0.002768, 0.001302, 0.000457, 0.001105, 0.001647, 0.000563}, - {0.001593, 0.001302, 0.001463, 0.000639, 0.001050, 0.001110, 0.000519}, - {0.000488, 0.000457, 0.000639, 0.000608, 0.000663, 0.000042, 0.000370}, - {0.001172, 0.001105, 0.001050, 0.000663, 0.001389, 0.000825, 0.000661}, - {0.002312, 0.001647, 0.001110, 0.000042, 0.000825, 0.005211, 0.000749}, - {0.000710, 0.000563, 0.000519, 0.000370, 0.000661, 0.000749, 0.000703} - }; - - double[] adblReconcilerVariate = new double[] { - 0.110713, - 0.052794, - 0.000000, - 0.453221, - 0.139349, - 0.046425, - 0.197498 - }; - - AssetComponent[] aACReconciler = new AssetComponent[adblReconcilerVariate.length]; - - for (int i = 0; i < adblReconcilerVariate.length; ++i) - aACReconciler[i] = new AssetComponent ( - astrAssetName[i], - adblReconcilerVariate[i] - ); - - Portfolio pfReconciler = new Portfolio (aACReconciler); - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - pdp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - OptimizationOutput pfOptimal = cmva.allocate ( - pdp, - ausp - ); - - AssetComponent[] aACOptimal = pfOptimal.optimalPortfolio().assets(); - - System.out.println ("\t|------------------------------||"); - - System.out.println ("\t| OPTIMAL ASSET WEIGHTS ||"); - - System.out.println ("\t|------------------------------||"); - - System.out.println ("\t| ASSET | DRIP | EXCEL ||"); - - System.out.println ("\t|------------------------------||"); - - for (int i = 0; i < aACOptimal.length; ++i) - System.out.println ( - "\t| " + aACOptimal[i].id() + " |" + - FormatUtil.FormatDouble (aACOptimal[i].amount(), 2, 4, 100.) + "% | " + - FormatUtil.FormatDouble (aACReconciler[i].amount(), 2, 4, 100.) + "% ||" - ); - - System.out.println ("\t|------------------------------||\n\n"); - - System.out.println ("\t|-------------------------------------------------------------||"); - - System.out.println ("\t| Optimal Portfolio Normalize : " + FormatUtil.FormatDouble (pfOptimal.optimalPortfolio().notional(), 1, 4, 1.) + " ||"); - - System.out.println ("\t| Optimal Portfolio Input Return : " + FormatUtil.FormatDouble (dblPortfolioDesignReturn, 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Expected Return : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsMean(), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Standard Deviation : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsStandardDeviation(), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation (Calculated) : " + FormatUtil.FormatDouble (Math.sqrt (pfReconciler.variance (ausp)), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation (Input) : " + FormatUtil.FormatDouble (dblPortfolioRiskExcel, 1, 4, 100.) + "% ||"); - - System.out.println ("\t|-------------------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler05.java b/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler05.java deleted file mode 100644 index 00f57b7..0000000 --- a/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler05.java +++ /dev/null @@ -1,279 +0,0 @@ - -package org.drip.sample.assetallocationexcel; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.InteriorPointBarrierControl; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CMV Monthly Reconciler demonstrates the Execution and Reconciliation of the Dual Constrained Mean Variance - * against an XL-based Monthly Series Implementation for Portfolio Design Returns #5. - * - * @author Lakshmi Krishnamurthy - */ - -public class CMVMonthlyReconciler05 { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.00, - 0.00, - 0.00, - 0.00, - 0.00, - 0.00, - 0.00 - }; - - double[] adblAssetUpperBound = new double[] { - 0.30, - 0.30, - 0.30, - 0.50, - 0.30, - 0.30, - 0.50 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.008930, - 0.007730, - 0.006950, - 0.003660, - 0.006980, - 0.007140, - 0.003870 - }; - - double dblPortfolioDesignReturn = 0.005319; - double dblPortfolioRiskExcel = 0.026572; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733, 0.002083, 0.001593, 0.000488, 0.001172, 0.002312, 0.000710}, - {0.002083, 0.002768, 0.001302, 0.000457, 0.001105, 0.001647, 0.000563}, - {0.001593, 0.001302, 0.001463, 0.000639, 0.001050, 0.001110, 0.000519}, - {0.000488, 0.000457, 0.000639, 0.000608, 0.000663, 0.000042, 0.000370}, - {0.001172, 0.001105, 0.001050, 0.000663, 0.001389, 0.000825, 0.000661}, - {0.002312, 0.001647, 0.001110, 0.000042, 0.000825, 0.005211, 0.000749}, - {0.000710, 0.000563, 0.000519, 0.000370, 0.000661, 0.000749, 0.000703} - }; - - double[] adblReconcilerVariate = new double[] { - 0.101541, - 0.050369, - 0.057521, - 0.391489, - 0.162554, - 0.042900, - 0.193626 - }; - - AssetComponent[] aACReconciler = new AssetComponent[adblReconcilerVariate.length]; - - for (int i = 0; i < adblReconcilerVariate.length; ++i) - aACReconciler[i] = new AssetComponent ( - astrAssetName[i], - adblReconcilerVariate[i] - ); - - Portfolio pfReconciler = new Portfolio (aACReconciler); - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - pdp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - OptimizationOutput pfOptimal = cmva.allocate ( - pdp, - ausp - ); - - AssetComponent[] aACOptimal = pfOptimal.optimalPortfolio().assets(); - - System.out.println ("\t|------------------------------||"); - - System.out.println ("\t| OPTIMAL ASSET WEIGHTS ||"); - - System.out.println ("\t|------------------------------||"); - - System.out.println ("\t| ASSET | DRIP | EXCEL ||"); - - System.out.println ("\t|------------------------------||"); - - for (int i = 0; i < aACOptimal.length; ++i) - System.out.println ( - "\t| " + aACOptimal[i].id() + " |" + - FormatUtil.FormatDouble (aACOptimal[i].amount(), 2, 4, 100.) + "% | " + - FormatUtil.FormatDouble (aACReconciler[i].amount(), 2, 4, 100.) + "% ||" - ); - - System.out.println ("\t|------------------------------||\n\n"); - - System.out.println ("\t|-------------------------------------------------------------||"); - - System.out.println ("\t| Optimal Portfolio Normalize : " + FormatUtil.FormatDouble (pfOptimal.optimalPortfolio().notional(), 1, 4, 1.) + " ||"); - - System.out.println ("\t| Optimal Portfolio Input Return : " + FormatUtil.FormatDouble (dblPortfolioDesignReturn, 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Expected Return : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsMean(), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Standard Deviation : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsStandardDeviation(), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation (Calculated) : " + FormatUtil.FormatDouble (Math.sqrt (pfReconciler.variance (ausp)), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation (Input) : " + FormatUtil.FormatDouble (dblPortfolioRiskExcel, 1, 4, 100.) + "% ||"); - - System.out.println ("\t|-------------------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler06.java b/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler06.java deleted file mode 100644 index c937b1a..0000000 --- a/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler06.java +++ /dev/null @@ -1,279 +0,0 @@ - -package org.drip.sample.assetallocationexcel; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.InteriorPointBarrierControl; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CMV Monthly Reconciler demonstrates the Execution and Reconciliation of the Dual Constrained Mean Variance - * against an XL-based Monthly Series Implementation for Portfolio Design Returns #6. - * - * @author Lakshmi Krishnamurthy - */ - -public class CMVMonthlyReconciler06 { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.00, - 0.00, - 0.00, - 0.00, - 0.00, - 0.00, - 0.00 - }; - - double[] adblAssetUpperBound = new double[] { - 0.30, - 0.30, - 0.30, - 0.50, - 0.30, - 0.30, - 0.50 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.009190, - 0.007930, - 0.007050, - 0.003134, - 0.006840, - 0.007980, - 0.003727 - }; - - double dblPortfolioDesignReturn = 0.005682; - double dblPortfolioRiskExcel = 0.028550; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733, 0.002083, 0.001593, 0.000488, 0.001172, 0.002312, 0.000710}, - {0.002083, 0.002768, 0.001302, 0.000457, 0.001105, 0.001647, 0.000563}, - {0.001593, 0.001302, 0.001463, 0.000639, 0.001050, 0.001110, 0.000519}, - {0.000488, 0.000457, 0.000639, 0.000608, 0.000663, 0.000042, 0.000370}, - {0.001172, 0.001105, 0.001050, 0.000663, 0.001389, 0.000825, 0.000661}, - {0.002312, 0.001647, 0.001110, 0.000042, 0.000825, 0.005211, 0.000749}, - {0.000710, 0.000563, 0.000519, 0.000370, 0.000661, 0.000749, 0.000703} - }; - - double[] adblReconcilerVariate = new double[] { - 0.062488, - 0.059355, - 0.189894, - 0.193201, - 0.201137, - 0.052097, - 0.241828 - }; - - AssetComponent[] aACReconciler = new AssetComponent[adblReconcilerVariate.length]; - - for (int i = 0; i < adblReconcilerVariate.length; ++i) - aACReconciler[i] = new AssetComponent ( - astrAssetName[i], - adblReconcilerVariate[i] - ); - - Portfolio pfReconciler = new Portfolio (aACReconciler); - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - pdp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - OptimizationOutput pfOptimal = cmva.allocate ( - pdp, - ausp - ); - - AssetComponent[] aACOptimal = pfOptimal.optimalPortfolio().assets(); - - System.out.println ("\t|------------------------------||"); - - System.out.println ("\t| OPTIMAL ASSET WEIGHTS ||"); - - System.out.println ("\t|------------------------------||"); - - System.out.println ("\t| ASSET | DRIP | EXCEL ||"); - - System.out.println ("\t|------------------------------||"); - - for (int i = 0; i < aACOptimal.length; ++i) - System.out.println ( - "\t| " + aACOptimal[i].id() + " |" + - FormatUtil.FormatDouble (aACOptimal[i].amount(), 2, 4, 100.) + "% | " + - FormatUtil.FormatDouble (aACReconciler[i].amount(), 2, 4, 100.) + "% ||" - ); - - System.out.println ("\t|------------------------------||\n\n"); - - System.out.println ("\t|-------------------------------------------------------------||"); - - System.out.println ("\t| Optimal Portfolio Normalize : " + FormatUtil.FormatDouble (pfOptimal.optimalPortfolio().notional(), 1, 4, 1.) + " ||"); - - System.out.println ("\t| Optimal Portfolio Input Return : " + FormatUtil.FormatDouble (dblPortfolioDesignReturn, 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Expected Return : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsMean(), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Standard Deviation : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsStandardDeviation(), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation (Calculated) : " + FormatUtil.FormatDouble (Math.sqrt (pfReconciler.variance (ausp)), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation (Input) : " + FormatUtil.FormatDouble (dblPortfolioRiskExcel, 1, 4, 100.) + "% ||"); - - System.out.println ("\t|-------------------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler07.java b/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler07.java deleted file mode 100644 index 4b42174..0000000 --- a/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler07.java +++ /dev/null @@ -1,279 +0,0 @@ - -package org.drip.sample.assetallocationexcel; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.InteriorPointBarrierControl; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CMV Monthly Reconciler demonstrates the Execution and Reconciliation of the Dual Constrained Mean Variance - * against an XL-based Monthly Series Implementation for Portfolio Design Returns #7. - * - * @author Lakshmi Krishnamurthy - */ - -public class CMVMonthlyReconciler07 { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.00, - 0.00, - 0.00, - 0.00, - 0.00, - 0.00, - 0.00 - }; - - double[] adblAssetUpperBound = new double[] { - 0.30, - 0.30, - 0.30, - 0.50, - 0.30, - 0.30, - 0.50 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.009190, - 0.007930, - 0.007050, - 0.003134, - 0.006840, - 0.007980, - 0.003727 - }; - - double dblPortfolioDesignReturn = 0.005586; - double dblPortfolioRiskExcel = 0.028166; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733, 0.002083, 0.001593, 0.000488, 0.001172, 0.002312, 0.000710}, - {0.002083, 0.002768, 0.001302, 0.000457, 0.001105, 0.001647, 0.000563}, - {0.001593, 0.001302, 0.001463, 0.000639, 0.001050, 0.001110, 0.000519}, - {0.000488, 0.000457, 0.000639, 0.000608, 0.000663, 0.000042, 0.000370}, - {0.001172, 0.001105, 0.001050, 0.000663, 0.001389, 0.000825, 0.000661}, - {0.002312, 0.001647, 0.001110, 0.000042, 0.000825, 0.005211, 0.000749}, - {0.000710, 0.000563, 0.000519, 0.000370, 0.000661, 0.000749, 0.000703} - }; - - double[] adblReconcilerVariate = new double[] { - 0.059817, - 0.059468, - 0.181286, - 0.213394, - 0.186720, - 0.052937, - 0.246378 - }; - - AssetComponent[] aACReconciler = new AssetComponent[adblReconcilerVariate.length]; - - for (int i = 0; i < adblReconcilerVariate.length; ++i) - aACReconciler[i] = new AssetComponent ( - astrAssetName[i], - adblReconcilerVariate[i] - ); - - Portfolio pfReconciler = new Portfolio (aACReconciler); - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - pdp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - OptimizationOutput pfOptimal = cmva.allocate ( - pdp, - ausp - ); - - AssetComponent[] aACOptimal = pfOptimal.optimalPortfolio().assets(); - - System.out.println ("\t|------------------------------||"); - - System.out.println ("\t| OPTIMAL ASSET WEIGHTS ||"); - - System.out.println ("\t|------------------------------||"); - - System.out.println ("\t| ASSET | DRIP | EXCEL ||"); - - System.out.println ("\t|------------------------------||"); - - for (int i = 0; i < aACOptimal.length; ++i) - System.out.println ( - "\t| " + aACOptimal[i].id() + " |" + - FormatUtil.FormatDouble (aACOptimal[i].amount(), 2, 4, 100.) + "% | " + - FormatUtil.FormatDouble (aACReconciler[i].amount(), 2, 4, 100.) + "% ||" - ); - - System.out.println ("\t|------------------------------||\n\n"); - - System.out.println ("\t|-------------------------------------------------------------||"); - - System.out.println ("\t| Optimal Portfolio Normalize : " + FormatUtil.FormatDouble (pfOptimal.optimalPortfolio().notional(), 1, 4, 1.) + " ||"); - - System.out.println ("\t| Optimal Portfolio Input Return : " + FormatUtil.FormatDouble (dblPortfolioDesignReturn, 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Expected Return : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsMean(), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Standard Deviation : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsStandardDeviation(), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation (Calculated) : " + FormatUtil.FormatDouble (Math.sqrt (pfReconciler.variance (ausp)), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation (Input) : " + FormatUtil.FormatDouble (dblPortfolioRiskExcel, 1, 4, 100.) + "% ||"); - - System.out.println ("\t|-------------------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler08.java b/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler08.java deleted file mode 100644 index 84e21e0..0000000 --- a/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler08.java +++ /dev/null @@ -1,279 +0,0 @@ - -package org.drip.sample.assetallocationexcel; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.InteriorPointBarrierControl; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CMV Monthly Reconciler demonstrates the Execution and Reconciliation of the Dual Constrained Mean Variance - * against an XL-based Monthly Series Implementation for Portfolio Design Returns #8. - * - * @author Lakshmi Krishnamurthy - */ - -public class CMVMonthlyReconciler08 { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.00, - 0.00, - 0.00, - 0.00, - 0.00, - 0.00, - 0.00 - }; - - double[] adblAssetUpperBound = new double[] { - 0.30, - 0.30, - 0.30, - 0.50, - 0.30, - 0.30, - 0.50 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.009190, - 0.007930, - 0.007050, - 0.003134, - 0.006840, - 0.007980, - 0.003727 - }; - - double dblPortfolioDesignReturn = 0.005751; - double dblPortfolioRiskExcel = 0.028830; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733, 0.002083, 0.001593, 0.000488, 0.001172, 0.002312, 0.000710}, - {0.002083, 0.002768, 0.001302, 0.000457, 0.001105, 0.001647, 0.000563}, - {0.001593, 0.001302, 0.001463, 0.000639, 0.001050, 0.001110, 0.000519}, - {0.000488, 0.000457, 0.000639, 0.000608, 0.000663, 0.000042, 0.000370}, - {0.001172, 0.001105, 0.001050, 0.000663, 0.001389, 0.000825, 0.000661}, - {0.002312, 0.001647, 0.001110, 0.000042, 0.000825, 0.005211, 0.000749}, - {0.000710, 0.000563, 0.000519, 0.000370, 0.000661, 0.000749, 0.000703} - }; - - double[] adblReconcilerVariate = new double[] { - 0.063846, - 0.059524, - 0.196390, - 0.178838, - 0.211827, - 0.051509, - 0.238067 - }; - - AssetComponent[] aACReconciler = new AssetComponent[adblReconcilerVariate.length]; - - for (int i = 0; i < adblReconcilerVariate.length; ++i) - aACReconciler[i] = new AssetComponent ( - astrAssetName[i], - adblReconcilerVariate[i] - ); - - Portfolio pfReconciler = new Portfolio (aACReconciler); - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - pdp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - OptimizationOutput pfOptimal = cmva.allocate ( - pdp, - ausp - ); - - AssetComponent[] aACOptimal = pfOptimal.optimalPortfolio().assets(); - - System.out.println ("\t|------------------------------||"); - - System.out.println ("\t| OPTIMAL ASSET WEIGHTS ||"); - - System.out.println ("\t|------------------------------||"); - - System.out.println ("\t| ASSET | DRIP | EXCEL ||"); - - System.out.println ("\t|------------------------------||"); - - for (int i = 0; i < aACOptimal.length; ++i) - System.out.println ( - "\t| " + aACOptimal[i].id() + " |" + - FormatUtil.FormatDouble (aACOptimal[i].amount(), 2, 4, 100.) + "% | " + - FormatUtil.FormatDouble (aACReconciler[i].amount(), 2, 4, 100.) + "% ||" - ); - - System.out.println ("\t|------------------------------||\n\n"); - - System.out.println ("\t|-------------------------------------------------------------||"); - - System.out.println ("\t| Optimal Portfolio Normalize : " + FormatUtil.FormatDouble (pfOptimal.optimalPortfolio().notional(), 1, 4, 1.) + " ||"); - - System.out.println ("\t| Optimal Portfolio Input Return : " + FormatUtil.FormatDouble (dblPortfolioDesignReturn, 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Expected Return : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsMean(), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Standard Deviation : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsStandardDeviation(), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation (Calculated) : " + FormatUtil.FormatDouble (Math.sqrt (pfReconciler.variance (ausp)), 1, 4, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation (Input) : " + FormatUtil.FormatDouble (dblPortfolioRiskExcel, 1, 4, 100.) + "% ||"); - - System.out.println ("\t|-------------------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler09.java b/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler09.java deleted file mode 100644 index e35211e..0000000 --- a/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler09.java +++ /dev/null @@ -1,279 +0,0 @@ - -package org.drip.sample.assetallocationexcel; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.InteriorPointBarrierControl; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CMV Monthly Reconciler demonstrates the Execution and Reconciliation of the Dual Constrained Mean Variance - * against an XL-based Monthly Series Implementation for Portfolio Design Returns #9. - * - * @author Lakshmi Krishnamurthy - */ - -public class CMVMonthlyReconciler09 { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.05, - 0.05, - 0.05, - 0.10, - 0.05, - 0.05, - 0.03 - }; - - double[] adblAssetUpperBound = new double[] { - 0.40, - 0.40, - 0.30, - 0.60, - 0.35, - 0.15, - 0.50 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.008355, - 0.007207, - 0.006279, - 0.002466, - 0.004472, - 0.006821, - 0.001570 - }; - - double dblPortfolioDesignReturn = 0.005262; - double dblPortfolioRiskExcel = 0.031391; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733, 0.002083, 0.001593, 0.000488, 0.001172, 0.002312, 0.000710}, - {0.002083, 0.002768, 0.001302, 0.000457, 0.001105, 0.001647, 0.000563}, - {0.001593, 0.001302, 0.001463, 0.000639, 0.001050, 0.001110, 0.000519}, - {0.000488, 0.000457, 0.000639, 0.000608, 0.000663, 0.000042, 0.000370}, - {0.001172, 0.001105, 0.001050, 0.000663, 0.001389, 0.000825, 0.000661}, - {0.002312, 0.001647, 0.001110, 0.000042, 0.000825, 0.005211, 0.000749}, - {0.000710, 0.000563, 0.000519, 0.000370, 0.000661, 0.000749, 0.000703} - }; - - double[] adblReconcilerVariate = new double[] { - 0.1519, - 0.0954, - 0.2939, - 0.3203, - 0.0500, - 0.0586, - 0.0300 - }; - - AssetComponent[] aACReconciler = new AssetComponent[adblReconcilerVariate.length]; - - for (int i = 0; i < adblReconcilerVariate.length; ++i) - aACReconciler[i] = new AssetComponent ( - astrAssetName[i], - adblReconcilerVariate[i] - ); - - Portfolio pfReconciler = new Portfolio (aACReconciler); - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - pdp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - OptimizationOutput pfOptimal = cmva.allocate ( - pdp, - ausp - ); - - AssetComponent[] aACOptimal = pfOptimal.optimalPortfolio().assets(); - - System.out.println ("\t|--------------------------||"); - - System.out.println ("\t| OPTIMAL ASSET WEIGHTS ||"); - - System.out.println ("\t|--------------------------||"); - - System.out.println ("\t| ASSET | DRIP | EXCEL ||"); - - System.out.println ("\t|--------------------------||"); - - for (int i = 0; i < aACOptimal.length; ++i) - System.out.println ( - "\t| " + aACOptimal[i].id() + " |" + - FormatUtil.FormatDouble (aACOptimal[i].amount(), 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (aACReconciler[i].amount(), 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t|--------------------------||\n\n"); - - System.out.println ("\t|-----------------------------------------------------------||"); - - System.out.println ("\t| Optimal Portfolio Normalize : " + FormatUtil.FormatDouble (pfOptimal.optimalPortfolio().notional(), 1, 2, 1.) + " ||"); - - System.out.println ("\t| Optimal Portfolio Input Return : " + FormatUtil.FormatDouble (dblPortfolioDesignReturn, 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Expected Return : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsMean(), 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Standard Deviation : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsStandardDeviation(), 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation (Calculated) : " + FormatUtil.FormatDouble (Math.sqrt (pfReconciler.variance (ausp)), 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation (Input) : " + FormatUtil.FormatDouble (dblPortfolioRiskExcel, 1, 2, 100.) + "% ||"); - - System.out.println ("\t|-----------------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler10.java b/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler10.java deleted file mode 100644 index 3390341..0000000 --- a/org/drip/sample/assetallocationexcel/CMVMonthlyReconciler10.java +++ /dev/null @@ -1,279 +0,0 @@ - -package org.drip.sample.assetallocationexcel; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.InteriorPointBarrierControl; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CMV Monthly Reconciler demonstrates the Execution and Reconciliation of the Dual Constrained Mean Variance - * against an XL-based Monthly Series Implementation for Portfolio Design Returns #10. - * - * @author Lakshmi Krishnamurthy - */ - -public class CMVMonthlyReconciler10 { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.05, - 0.05, - 0.05, - 0.10, - 0.05, - 0.05, - 0.03 - }; - - double[] adblAssetUpperBound = new double[] { - 0.40, - 0.40, - 0.30, - 0.60, - 0.35, - 0.15, - 0.50 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.008355, - 0.007207, - 0.006279, - 0.002466, - 0.004472, - 0.006821, - 0.001570 - }; - - double dblPortfolioDesignReturn = 0.005497; - double dblPortfolioRiskExcel = 0.032578; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733, 0.002083, 0.001593, 0.000488, 0.001172, 0.002312, 0.000710}, - {0.002083, 0.002768, 0.001302, 0.000457, 0.001105, 0.001647, 0.000563}, - {0.001593, 0.001302, 0.001463, 0.000639, 0.001050, 0.001110, 0.000519}, - {0.000488, 0.000457, 0.000639, 0.000608, 0.000663, 0.000042, 0.000370}, - {0.001172, 0.001105, 0.001050, 0.000663, 0.001389, 0.000825, 0.000661}, - {0.002312, 0.001647, 0.001110, 0.000042, 0.000825, 0.005211, 0.000749}, - {0.000710, 0.000563, 0.000519, 0.000370, 0.000661, 0.000749, 0.000703} - }; - - double[] adblReconcilerVariate = new double[] { - 0.1897, - 0.0994, - 0.3000, - 0.2791, - 0.0500, - 0.0518, - 0.0300 - }; - - AssetComponent[] aACReconciler = new AssetComponent[adblReconcilerVariate.length]; - - for (int i = 0; i < adblReconcilerVariate.length; ++i) - aACReconciler[i] = new AssetComponent ( - astrAssetName[i], - adblReconcilerVariate[i] - ); - - Portfolio pfReconciler = new Portfolio (aACReconciler); - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - pdp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - OptimizationOutput pfOptimal = cmva.allocate ( - pdp, - ausp - ); - - AssetComponent[] aACOptimal = pfOptimal.optimalPortfolio().assets(); - - System.out.println ("\t|--------------------------||"); - - System.out.println ("\t| OPTIMAL ASSET WEIGHTS ||"); - - System.out.println ("\t|--------------------------||"); - - System.out.println ("\t| ASSET | DRIP | EXCEL ||"); - - System.out.println ("\t|--------------------------||"); - - for (int i = 0; i < aACOptimal.length; ++i) - System.out.println ( - "\t| " + aACOptimal[i].id() + " |" + - FormatUtil.FormatDouble (aACOptimal[i].amount(), 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (aACReconciler[i].amount(), 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t|--------------------------||\n\n"); - - System.out.println ("\t|-----------------------------------------------------------||"); - - System.out.println ("\t| Optimal Portfolio Normalize : " + FormatUtil.FormatDouble (pfOptimal.optimalPortfolio().notional(), 1, 2, 1.) + " ||"); - - System.out.println ("\t| Optimal Portfolio Input Return : " + FormatUtil.FormatDouble (dblPortfolioDesignReturn, 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Expected Return : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsMean(), 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Standard Deviation : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsStandardDeviation(), 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation (Calculated) : " + FormatUtil.FormatDouble (Math.sqrt (pfReconciler.variance (ausp)), 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation (Input) : " + FormatUtil.FormatDouble (dblPortfolioRiskExcel, 1, 2, 100.) + "% ||"); - - System.out.println ("\t|-----------------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/assetallocationexcel/CMVReconciler1.java b/org/drip/sample/assetallocationexcel/CMVReconciler1.java deleted file mode 100644 index e55f0f6..0000000 --- a/org/drip/sample/assetallocationexcel/CMVReconciler1.java +++ /dev/null @@ -1,276 +0,0 @@ - -package org.drip.sample.assetallocationexcel; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.InteriorPointBarrierControl; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CMV Reconciler demonstrates the Execution and Reconciliation of the Dual Constrained Mean Variance against - * an XL-based Implementation for Portfolio Design Returns #1. - * - * @author Lakshmi Krishnamurthy - */ - -public class CMVReconciler1 { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.03, - 0.07, - 0.02, - 0.09, - 0.06, - 0.01, - 0.24 - }; - - double[] adblAssetUpperBound = new double[] { - 0.30, - 0.35, - 0.28, - 0.38, - 0.28, - 0.16, - 0.43 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.0800, - 0.0700, - 0.0600, - 0.0400, - 0.0500, - 0.0900, - 0.0100 - }; - - double dblPortfolioDesignReturn = 0.05000; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733 * 12, 0.002083 * 12, 0.001593 * 12, 0.000488 * 12, 0.001172 * 12, 0.002312 * 12, 0.000710 * 12}, - {0.002083 * 12, 0.002768 * 12, 0.001302 * 12, 0.000457 * 12, 0.001105 * 12, 0.001647 * 12, 0.000563 * 12}, - {0.001593 * 12, 0.001302 * 12, 0.001463 * 12, 0.000639 * 12, 0.001050 * 12, 0.001110 * 12, 0.000519 * 12}, - {0.000488 * 12, 0.000457 * 12, 0.000639 * 12, 0.000608 * 12, 0.000663 * 12, 0.000042 * 12, 0.000370 * 12}, - {0.001172 * 12, 0.001105 * 12, 0.001050 * 12, 0.000663 * 12, 0.001389 * 12, 0.000825 * 12, 0.000661 * 12}, - {0.002312 * 12, 0.001647 * 12, 0.001110 * 12, 0.000042 * 12, 0.000825 * 12, 0.005211 * 12, 0.000749 * 12}, - {0.000710 * 12, 0.000563 * 12, 0.000519 * 12, 0.000370 * 12, 0.000661 * 12, 0.000749 * 12, 0.000703 * 12} - }; - - double[] adblReconcilerVariate = new double[] { - 0.1617, - 0.0700, - 0.0200, - 0.2883, - 0.0600, - 0.1600, - 0.2400 - }; - - AssetComponent[] aACReconciler = new AssetComponent[adblReconcilerVariate.length]; - - for (int i = 0; i < adblReconcilerVariate.length; ++i) - aACReconciler[i] = new AssetComponent ( - astrAssetName[i], - adblReconcilerVariate[i] - ); - - Portfolio pfReconciler = new Portfolio (aACReconciler); - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - pdp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - OptimizationOutput pfOptimal = cmva.allocate ( - pdp, - ausp - ); - - AssetComponent[] aACOptimal = pfOptimal.optimalPortfolio().assets(); - - System.out.println ("\t|--------------------------||"); - - System.out.println ("\t| OPTIMAL ASSET WEIGHTS ||"); - - System.out.println ("\t|--------------------------||"); - - System.out.println ("\t| ASSET | DRIP | EXCEL ||"); - - System.out.println ("\t|--------------------------||"); - - for (int i = 0; i < aACOptimal.length; ++i) - System.out.println ( - "\t| " + aACOptimal[i].id() + " |" + - FormatUtil.FormatDouble (aACOptimal[i].amount(), 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (aACReconciler[i].amount(), 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t|--------------------------||\n\n"); - - System.out.println ("\t|------------------------------------------------||"); - - System.out.println ("\t| Optimal Portfolio Normalize : " + FormatUtil.FormatDouble (pfOptimal.optimalPortfolio().notional(), 1, 2, 1.) + " ||"); - - System.out.println ("\t| Optimal Portfolio Input Return : " + FormatUtil.FormatDouble (dblPortfolioDesignReturn, 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Expected Return : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsMean(), 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Standard Deviation : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsStandardDeviation(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation : " + FormatUtil.FormatDouble (Math.sqrt (pfReconciler.variance (ausp)), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/assetallocationexcel/CMVReconciler2.java b/org/drip/sample/assetallocationexcel/CMVReconciler2.java deleted file mode 100644 index 7b55116..0000000 --- a/org/drip/sample/assetallocationexcel/CMVReconciler2.java +++ /dev/null @@ -1,291 +0,0 @@ - -package org.drip.sample.assetallocationexcel; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.InteriorPointBarrierControl; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CMVReconciler2 demonstrates the Execution and Reconciliation of the Dual Constrained Mean Variance against - * an XL-based Implementation for Portfolio Design Returns #2. - * - * @author Lakshmi Krishnamurthy - */ - -public class CMVReconciler2 { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.03, - 0.07, - 0.02, - 0.09, - 0.06, - 0.01, - 0.24 - }; - - double[] adblAssetUpperBound = new double[] { - 0.30, - 0.35, - 0.28, - 0.38, - 0.28, - 0.16, - 0.43 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.0800, - 0.0700, - 0.0600, - 0.0400, - 0.0500, - 0.0900, - 0.0100 - }; - - double dblPortfolioDesignReturn = 0.06000; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733 * 12, 0.002083 * 12, 0.001593 * 12, 0.000488 * 12, 0.001172 * 12, 0.002312 * 12, 0.000710 * 12}, - {0.002083 * 12, 0.002768 * 12, 0.001302 * 12, 0.000457 * 12, 0.001105 * 12, 0.001647 * 12, 0.000563 * 12}, - {0.001593 * 12, 0.001302 * 12, 0.001463 * 12, 0.000639 * 12, 0.001050 * 12, 0.001110 * 12, 0.000519 * 12}, - {0.000488 * 12, 0.000457 * 12, 0.000639 * 12, 0.000608 * 12, 0.000663 * 12, 0.000042 * 12, 0.000370 * 12}, - {0.001172 * 12, 0.001105 * 12, 0.001050 * 12, 0.000663 * 12, 0.001389 * 12, 0.000825 * 12, 0.000661 * 12}, - {0.002312 * 12, 0.001647 * 12, 0.001110 * 12, 0.000042 * 12, 0.000825 * 12, 0.005211 * 12, 0.000749 * 12}, - {0.000710 * 12, 0.000563 * 12, 0.000519 * 12, 0.000370 * 12, 0.000661 * 12, 0.000749 * 12, 0.000703 * 12} - }; - - double[] adblReconcilerVariate = new double[] { - 0.3000, - 0.1300, - 0.0200, - 0.0900, - 0.0600, - 0.1600, - 0.2400 - }; - - AssetComponent[] aACReconciler = new AssetComponent[adblReconcilerVariate.length]; - - for (int i = 0; i < adblReconcilerVariate.length; ++i) - aACReconciler[i] = new AssetComponent ( - astrAssetName[i], - adblReconcilerVariate[i] - ); - - Portfolio pfReconciler = new Portfolio (aACReconciler); - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - pdp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - OptimizationOutput pfOptimal = cmva.allocate ( - pdp, - ausp - ); - - AssetComponent[] aACOptimal = pfOptimal.optimalPortfolio().assets(); - - System.out.println ("\t|--------------------------||"); - - System.out.println ("\t| OPTIMAL ASSET WEIGHTS ||"); - - System.out.println ("\t|--------------------------||"); - - System.out.println ("\t| ASSET | DRIP | EXCEL ||"); - - System.out.println ("\t|--------------------------||"); - - for (int i = 0; i < aACOptimal.length; ++i) - System.out.println ( - "\t| " + aACOptimal[i].id() + " |" + - FormatUtil.FormatDouble (aACOptimal[i].amount(), 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (aACReconciler[i].amount(), 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t|--------------------------||\n\n"); - - System.out.println ("\t|------------------------------------------------||"); - - System.out.println ( - "\t| Optimal Portfolio Normalize : " + - FormatUtil.FormatDouble (pfOptimal.optimalPortfolio().notional(), 1, 2, 1.) + " ||" - ); - - System.out.println ( - "\t| Optimal Portfolio Input Return : " + - FormatUtil.FormatDouble (dblPortfolioDesignReturn, 1, 2, 100.) + "% ||" - ); - - System.out.println ( - "\t| Optimal Portfolio Expected Return : " + - FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsMean(), 1, 2, 100.) + "% ||" - ); - - System.out.println ( - "\t| Optimal Portfolio Standard Deviation : " + - FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsStandardDeviation(), 2, 2, 100.) + "% ||" - ); - - System.out.println ( - "\t| Excel Portfolio Standard Deviation : " + - FormatUtil.FormatDouble (Math.sqrt (pfReconciler.variance (ausp)), 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t|------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/assetallocationexcel/CMVReconciler3.java b/org/drip/sample/assetallocationexcel/CMVReconciler3.java deleted file mode 100644 index c64171f..0000000 --- a/org/drip/sample/assetallocationexcel/CMVReconciler3.java +++ /dev/null @@ -1,276 +0,0 @@ - -package org.drip.sample.assetallocationexcel; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.InteriorPointBarrierControl; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CMV Reconciler demonstrates the Execution and Reconciliation of the Dual Constrained Mean Variance against - * an XL-based Implementation for Portfolio Design Returns #3. - * - * @author Lakshmi Krishnamurthy - */ - -public class CMVReconciler3 { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.05, - 0.05, - 0.05, - 0.10, - 0.05, - 0.05, - 0.15 - }; - - double[] adblAssetUpperBound = new double[] { - 0.40, - 0.40, - 0.30, - 0.30, - 0.35, - 0.15, - 0.50 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.1100, - 0.1000, - 0.0800, - 0.0500, - 0.0600, - 0.0700, - 0.0200 - }; - - double dblPortfolioDesignReturn = 0.07000; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733 * 12, 0.002083 * 12, 0.001593 * 12, 0.000488 * 12, 0.001172 * 12, 0.002312 * 12, 0.000710 * 12}, - {0.002083 * 12, 0.002768 * 12, 0.001302 * 12, 0.000457 * 12, 0.001105 * 12, 0.001647 * 12, 0.000563 * 12}, - {0.001593 * 12, 0.001302 * 12, 0.001463 * 12, 0.000639 * 12, 0.001050 * 12, 0.001110 * 12, 0.000519 * 12}, - {0.000488 * 12, 0.000457 * 12, 0.000639 * 12, 0.000608 * 12, 0.000663 * 12, 0.000042 * 12, 0.000370 * 12}, - {0.001172 * 12, 0.001105 * 12, 0.001050 * 12, 0.000663 * 12, 0.001389 * 12, 0.000825 * 12, 0.000661 * 12}, - {0.002312 * 12, 0.001647 * 12, 0.001110 * 12, 0.000042 * 12, 0.000825 * 12, 0.005211 * 12, 0.000749 * 12}, - {0.000710 * 12, 0.000563 * 12, 0.000519 * 12, 0.000370 * 12, 0.000661 * 12, 0.000749 * 12, 0.000703 * 12} - }; - - double[] adblReconcilerVariate = new double[] { - 0.2364, - 0.1421, - 0.0715, - 0.3000, - 0.0500, - 0.0500, - 0.1500 - }; - - AssetComponent[] aACReconciler = new AssetComponent[adblReconcilerVariate.length]; - - for (int i = 0; i < adblReconcilerVariate.length; ++i) - aACReconciler[i] = new AssetComponent ( - astrAssetName[i], - adblReconcilerVariate[i] - ); - - Portfolio pfReconciler = new Portfolio (aACReconciler); - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - pdp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - OptimizationOutput pfOptimal = cmva.allocate ( - pdp, - ausp - ); - - AssetComponent[] aACOptimal = pfOptimal.optimalPortfolio().assets(); - - System.out.println ("\t|--------------------------||"); - - System.out.println ("\t| OPTIMAL ASSET WEIGHTS ||"); - - System.out.println ("\t|--------------------------||"); - - System.out.println ("\t| ASSET | DRIP | EXCEL ||"); - - System.out.println ("\t|--------------------------||"); - - for (int i = 0; i < aACOptimal.length; ++i) - System.out.println ( - "\t| " + aACOptimal[i].id() + " |" + - FormatUtil.FormatDouble (aACOptimal[i].amount(), 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (aACReconciler[i].amount(), 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t|--------------------------||\n\n"); - - System.out.println ("\t|------------------------------------------------||"); - - System.out.println ("\t| Optimal Portfolio Normalize : " + FormatUtil.FormatDouble (pfOptimal.optimalPortfolio().notional(), 1, 2, 1.) + " ||"); - - System.out.println ("\t| Optimal Portfolio Input Return : " + FormatUtil.FormatDouble (dblPortfolioDesignReturn, 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Expected Return : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsMean(), 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Standard Deviation : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsStandardDeviation(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation : " + FormatUtil.FormatDouble (Math.sqrt (pfReconciler.variance (ausp)), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/assetallocationexcel/CMVReconciler4.java b/org/drip/sample/assetallocationexcel/CMVReconciler4.java deleted file mode 100644 index 8f1a83f..0000000 --- a/org/drip/sample/assetallocationexcel/CMVReconciler4.java +++ /dev/null @@ -1,276 +0,0 @@ - -package org.drip.sample.assetallocationexcel; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.InteriorPointBarrierControl; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CMV Reconciler demonstrates the Execution and Reconciliation of the Dual Constrained Mean Variance against - * an XL-based Implementation for Portfolio Design Returns #4. - * - * @author Lakshmi Krishnamurthy - */ - -public class CMVReconciler4 { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.05, - 0.05, - 0.05, - 0.10, - 0.05, - 0.05, - 0.15 - }; - - double[] adblAssetUpperBound = new double[] { - 0.40, - 0.40, - 0.30, - 0.30, - 0.35, - 0.15, - 0.50 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.1100, - 0.1000, - 0.0800, - 0.0500, - 0.0600, - 0.0700, - 0.0200 - }; - - double dblPortfolioDesignReturn = 0.08000; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733 * 12, 0.002083 * 12, 0.001593 * 12, 0.000488 * 12, 0.001172 * 12, 0.002312 * 12, 0.000710 * 12}, - {0.002083 * 12, 0.002768 * 12, 0.001302 * 12, 0.000457 * 12, 0.001105 * 12, 0.001647 * 12, 0.000563 * 12}, - {0.001593 * 12, 0.001302 * 12, 0.001463 * 12, 0.000639 * 12, 0.001050 * 12, 0.001110 * 12, 0.000519 * 12}, - {0.000488 * 12, 0.000457 * 12, 0.000639 * 12, 0.000608 * 12, 0.000663 * 12, 0.000042 * 12, 0.000370 * 12}, - {0.001172 * 12, 0.001105 * 12, 0.001050 * 12, 0.000663 * 12, 0.001389 * 12, 0.000825 * 12, 0.000661 * 12}, - {0.002312 * 12, 0.001647 * 12, 0.001110 * 12, 0.000042 * 12, 0.000825 * 12, 0.005211 * 12, 0.000749 * 12}, - {0.000710 * 12, 0.000563 * 12, 0.000519 * 12, 0.000370 * 12, 0.000661 * 12, 0.000749 * 12, 0.000703 * 12} - }; - - double[] adblReconcilerVariate = new double[] { - 0.3976, - 0.1625, - 0.0500, - 0.1399, - 0.0500, - 0.0500, - 0.1500 - }; - - AssetComponent[] aACReconciler = new AssetComponent[adblReconcilerVariate.length]; - - for (int i = 0; i < adblReconcilerVariate.length; ++i) - aACReconciler[i] = new AssetComponent ( - astrAssetName[i], - adblReconcilerVariate[i] - ); - - Portfolio pfReconciler = new Portfolio (aACReconciler); - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - pdp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - OptimizationOutput pfOptimal = cmva.allocate ( - pdp, - ausp - ); - - AssetComponent[] aACOptimal = pfOptimal.optimalPortfolio().assets(); - - System.out.println ("\t|--------------------------||"); - - System.out.println ("\t| OPTIMAL ASSET WEIGHTS ||"); - - System.out.println ("\t|--------------------------||"); - - System.out.println ("\t| ASSET | DRIP | EXCEL ||"); - - System.out.println ("\t|--------------------------||"); - - for (int i = 0; i < aACOptimal.length; ++i) - System.out.println ( - "\t| " + aACOptimal[i].id() + " |" + - FormatUtil.FormatDouble (aACOptimal[i].amount(), 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (aACReconciler[i].amount(), 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t|--------------------------||\n\n"); - - System.out.println ("\t|------------------------------------------------||"); - - System.out.println ("\t| Optimal Portfolio Normalize : " + FormatUtil.FormatDouble (pfOptimal.optimalPortfolio().notional(), 1, 2, 1.) + " ||"); - - System.out.println ("\t| Optimal Portfolio Input Return : " + FormatUtil.FormatDouble (dblPortfolioDesignReturn, 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Expected Return : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsMean(), 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Standard Deviation : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsStandardDeviation(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation : " + FormatUtil.FormatDouble (Math.sqrt (pfReconciler.variance (ausp)), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/assetallocationexcel/CMVReconciler5.java b/org/drip/sample/assetallocationexcel/CMVReconciler5.java deleted file mode 100644 index 2fe24d6..0000000 --- a/org/drip/sample/assetallocationexcel/CMVReconciler5.java +++ /dev/null @@ -1,276 +0,0 @@ - -package org.drip.sample.assetallocationexcel; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.InteriorPointBarrierControl; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CMV Reconciler demonstrates the Execution and Reconciliation of the Dual Constrained Mean Variance against - * an XL-based Implementation for Portfolio Design Returns #5. - * - * @author Lakshmi Krishnamurthy - */ - -public class CMVReconciler5 { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.05, - 0.05, - 0.05, - 0.05, - 0.00, - 0.00, - 0.00 - }; - - double[] adblAssetUpperBound = new double[] { - 0.50, - 0.40, - 0.30, - 0.30, - 0.35, - 0.15, - 0.50 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.1100, - 0.1000, - 0.0800, - 0.0500, - 0.0600, - 0.0700, - 0.0200 - }; - - double dblPortfolioDesignReturn = 0.08200; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733 * 12, 0.002083 * 12, 0.001593 * 12, 0.000488 * 12, 0.001172 * 12, 0.002312 * 12, 0.000710 * 12}, - {0.002083 * 12, 0.002768 * 12, 0.001302 * 12, 0.000457 * 12, 0.001105 * 12, 0.001647 * 12, 0.000563 * 12}, - {0.001593 * 12, 0.001302 * 12, 0.001463 * 12, 0.000639 * 12, 0.001050 * 12, 0.001110 * 12, 0.000519 * 12}, - {0.000488 * 12, 0.000457 * 12, 0.000639 * 12, 0.000608 * 12, 0.000663 * 12, 0.000042 * 12, 0.000370 * 12}, - {0.001172 * 12, 0.001105 * 12, 0.001050 * 12, 0.000663 * 12, 0.001389 * 12, 0.000825 * 12, 0.000661 * 12}, - {0.002312 * 12, 0.001647 * 12, 0.001110 * 12, 0.000042 * 12, 0.000825 * 12, 0.005211 * 12, 0.000749 * 12}, - {0.000710 * 12, 0.000563 * 12, 0.000519 * 12, 0.000370 * 12, 0.000661 * 12, 0.000749 * 12, 0.000703 * 12} - }; - - double[] adblReconcilerVariate = new double[] { - 0.2602, - 0.1718, - 0.2680, - 0.3000, - 0.0000, - 0.0000, - 0.0000 - }; - - AssetComponent[] aACReconciler = new AssetComponent[adblReconcilerVariate.length]; - - for (int i = 0; i < adblReconcilerVariate.length; ++i) - aACReconciler[i] = new AssetComponent ( - astrAssetName[i], - adblReconcilerVariate[i] - ); - - Portfolio pfReconciler = new Portfolio (aACReconciler); - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - pdp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - OptimizationOutput pfOptimal = cmva.allocate ( - pdp, - ausp - ); - - AssetComponent[] aACOptimal = pfOptimal.optimalPortfolio().assets(); - - System.out.println ("\t|--------------------------||"); - - System.out.println ("\t| OPTIMAL ASSET WEIGHTS ||"); - - System.out.println ("\t|--------------------------||"); - - System.out.println ("\t| ASSET | DRIP | EXCEL ||"); - - System.out.println ("\t|--------------------------||"); - - for (int i = 0; i < aACOptimal.length; ++i) - System.out.println ( - "\t| " + aACOptimal[i].id() + " |" + - FormatUtil.FormatDouble (aACOptimal[i].amount(), 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (aACReconciler[i].amount(), 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t|--------------------------||\n\n"); - - System.out.println ("\t|------------------------------------------------||"); - - System.out.println ("\t| Optimal Portfolio Normalize : " + FormatUtil.FormatDouble (pfOptimal.optimalPortfolio().notional(), 1, 2, 1.) + " ||"); - - System.out.println ("\t| Optimal Portfolio Input Return : " + FormatUtil.FormatDouble (dblPortfolioDesignReturn, 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Expected Return : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsMean(), 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Standard Deviation : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsStandardDeviation(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation : " + FormatUtil.FormatDouble (Math.sqrt (pfReconciler.variance (ausp)), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/assetallocationexcel/CMVReconciler6.java b/org/drip/sample/assetallocationexcel/CMVReconciler6.java deleted file mode 100644 index 2ef04b2..0000000 --- a/org/drip/sample/assetallocationexcel/CMVReconciler6.java +++ /dev/null @@ -1,276 +0,0 @@ - -package org.drip.sample.assetallocationexcel; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.InteriorPointBarrierControl; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CMV Reconciler demonstrates the Execution and Reconciliation of the Dual Constrained Mean Variance against - * an XL-based Implementation for Portfolio Design Returns #6. - * - * @author Lakshmi Krishnamurthy - */ - -public class CMVReconciler6 { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.05, - 0.04, - 0.06, - 0.03, - 0.03, - 0.03, - 0.13 - }; - - double[] adblAssetUpperBound = new double[] { - 0.43, - 0.27, - 0.44, - 0.32, - 0.66, - 0.32, - 0.88 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.1300, - 0.0700, - 0.0400, - 0.0300, - 0.0800, - 0.1000, - 0.0100 - }; - - double dblPortfolioDesignReturn = 0.07000; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733 * 12, 0.002083 * 12, 0.001593 * 12, 0.000488 * 12, 0.001172 * 12, 0.002312 * 12, 0.000710 * 12}, - {0.002083 * 12, 0.002768 * 12, 0.001302 * 12, 0.000457 * 12, 0.001105 * 12, 0.001647 * 12, 0.000563 * 12}, - {0.001593 * 12, 0.001302 * 12, 0.001463 * 12, 0.000639 * 12, 0.001050 * 12, 0.001110 * 12, 0.000519 * 12}, - {0.000488 * 12, 0.000457 * 12, 0.000639 * 12, 0.000608 * 12, 0.000663 * 12, 0.000042 * 12, 0.000370 * 12}, - {0.001172 * 12, 0.001105 * 12, 0.001050 * 12, 0.000663 * 12, 0.001389 * 12, 0.000825 * 12, 0.000661 * 12}, - {0.002312 * 12, 0.001647 * 12, 0.001110 * 12, 0.000042 * 12, 0.000825 * 12, 0.005211 * 12, 0.000749 * 12}, - {0.000710 * 12, 0.000563 * 12, 0.000519 * 12, 0.000370 * 12, 0.000661 * 12, 0.000749 * 12, 0.000703 * 12} - }; - - double[] adblReconcilerVariate = new double[] { - 0.2752, - 0.0400, - 0.0600, - 0.2327, - 0.2322, - 0.0300, - 0.1300 - }; - - AssetComponent[] aACReconciler = new AssetComponent[adblReconcilerVariate.length]; - - for (int i = 0; i < adblReconcilerVariate.length; ++i) - aACReconciler[i] = new AssetComponent ( - astrAssetName[i], - adblReconcilerVariate[i] - ); - - Portfolio pfReconciler = new Portfolio (aACReconciler); - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - pdp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - OptimizationOutput pfOptimal = cmva.allocate ( - pdp, - ausp - ); - - AssetComponent[] aACOptimal = pfOptimal.optimalPortfolio().assets(); - - System.out.println ("\t|--------------------------||"); - - System.out.println ("\t| OPTIMAL ASSET WEIGHTS ||"); - - System.out.println ("\t|--------------------------||"); - - System.out.println ("\t| ASSET | DRIP | EXCEL ||"); - - System.out.println ("\t|--------------------------||"); - - for (int i = 0; i < aACOptimal.length; ++i) - System.out.println ( - "\t| " + aACOptimal[i].id() + " |" + - FormatUtil.FormatDouble (aACOptimal[i].amount(), 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (aACReconciler[i].amount(), 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t|--------------------------||\n\n"); - - System.out.println ("\t|------------------------------------------------||"); - - System.out.println ("\t| Optimal Portfolio Normalize : " + FormatUtil.FormatDouble (pfOptimal.optimalPortfolio().notional(), 1, 2, 1.) + " ||"); - - System.out.println ("\t| Optimal Portfolio Input Return : " + FormatUtil.FormatDouble (dblPortfolioDesignReturn, 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Expected Return : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsMean(), 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Standard Deviation : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsStandardDeviation(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation : " + FormatUtil.FormatDouble (Math.sqrt (pfReconciler.variance (ausp)), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/assetallocationexcel/CMVReconciler7.java b/org/drip/sample/assetallocationexcel/CMVReconciler7.java deleted file mode 100644 index dc91d5d..0000000 --- a/org/drip/sample/assetallocationexcel/CMVReconciler7.java +++ /dev/null @@ -1,276 +0,0 @@ - -package org.drip.sample.assetallocationexcel; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.InteriorPointBarrierControl; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CMV Reconciler demonstrates the Execution and Reconciliation of the Dual Constrained Mean Variance against - * an XL-based Implementation for Portfolio Design Returns #7. - * - * @author Lakshmi Krishnamurthy - */ - -public class CMVReconciler7 { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.05, - 0.04, - 0.06, - 0.03, - 0.03, - 0.03, - 0.13 - }; - - double[] adblAssetUpperBound = new double[] { - 0.43, - 0.27, - 0.44, - 0.32, - 0.66, - 0.32, - 0.88 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.1300, - 0.0700, - 0.0400, - 0.0300, - 0.0800, - 0.1000, - 0.0100 - }; - - double dblPortfolioDesignReturn = 0.06000; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733 * 12, 0.002083 * 12, 0.001593 * 12, 0.000488 * 12, 0.001172 * 12, 0.002312 * 12, 0.000710 * 12}, - {0.002083 * 12, 0.002768 * 12, 0.001302 * 12, 0.000457 * 12, 0.001105 * 12, 0.001647 * 12, 0.000563 * 12}, - {0.001593 * 12, 0.001302 * 12, 0.001463 * 12, 0.000639 * 12, 0.001050 * 12, 0.001110 * 12, 0.000519 * 12}, - {0.000488 * 12, 0.000457 * 12, 0.000639 * 12, 0.000608 * 12, 0.000663 * 12, 0.000042 * 12, 0.000370 * 12}, - {0.001172 * 12, 0.001105 * 12, 0.001050 * 12, 0.000663 * 12, 0.001389 * 12, 0.000825 * 12, 0.000661 * 12}, - {0.002312 * 12, 0.001647 * 12, 0.001110 * 12, 0.000042 * 12, 0.000825 * 12, 0.005211 * 12, 0.000749 * 12}, - {0.000710 * 12, 0.000563 * 12, 0.000519 * 12, 0.000370 * 12, 0.000661 * 12, 0.000749 * 12, 0.000703 * 12} - }; - - double[] adblReconcilerVariate = new double[] { - 0.1489, - 0.0400, - 0.0600, - 0.3200, - 0.2451, - 0.0560, - 0.1300 - }; - - AssetComponent[] aACReconciler = new AssetComponent[adblReconcilerVariate.length]; - - for (int i = 0; i < adblReconcilerVariate.length; ++i) - aACReconciler[i] = new AssetComponent ( - astrAssetName[i], - adblReconcilerVariate[i] - ); - - Portfolio pfReconciler = new Portfolio (aACReconciler); - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - pdp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - OptimizationOutput pfOptimal = cmva.allocate ( - pdp, - ausp - ); - - AssetComponent[] aACOptimal = pfOptimal.optimalPortfolio().assets(); - - System.out.println ("\t|--------------------------||"); - - System.out.println ("\t| OPTIMAL ASSET WEIGHTS ||"); - - System.out.println ("\t|--------------------------||"); - - System.out.println ("\t| ASSET | DRIP | EXCEL ||"); - - System.out.println ("\t|--------------------------||"); - - for (int i = 0; i < aACOptimal.length; ++i) - System.out.println ( - "\t| " + aACOptimal[i].id() + " |" + - FormatUtil.FormatDouble (aACOptimal[i].amount(), 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (aACReconciler[i].amount(), 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t|--------------------------||\n\n"); - - System.out.println ("\t|------------------------------------------------||"); - - System.out.println ("\t| Optimal Portfolio Normalize : " + FormatUtil.FormatDouble (pfOptimal.optimalPortfolio().notional(), 1, 2, 1.) + " ||"); - - System.out.println ("\t| Optimal Portfolio Input Return : " + FormatUtil.FormatDouble (dblPortfolioDesignReturn, 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Expected Return : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsMean(), 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Standard Deviation : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsStandardDeviation(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation : " + FormatUtil.FormatDouble (Math.sqrt (pfReconciler.variance (ausp)), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/assetallocationexcel/CMVReconciler8.java b/org/drip/sample/assetallocationexcel/CMVReconciler8.java deleted file mode 100644 index a28f910..0000000 --- a/org/drip/sample/assetallocationexcel/CMVReconciler8.java +++ /dev/null @@ -1,276 +0,0 @@ - -package org.drip.sample.assetallocationexcel; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.InteriorPointBarrierControl; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CMV Reconciler demonstrates the Execution and Reconciliation of the Dual Constrained Mean Variance against - * an XL-based Implementation for Portfolio Design Returns #8. - * - * @author Lakshmi Krishnamurthy - */ - -public class CMVReconciler8 { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.00, - 0.00, - 0.00, - 0.00, - 0.00, - 0.00, - 0.00 - }; - - double[] adblAssetUpperBound = new double[] { - 0.66, - 0.66, - 0.66, - 0.66, - 0.66, - 0.66, - 0.66 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.1300, - 0.0700, - 0.0700, - 0.0600, - 0.0800, - 0.1000, - 0.0300 - }; - - double dblPortfolioDesignReturn = 0.07500; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733 * 12, 0.002083 * 12, 0.001593 * 12, 0.000488 * 12, 0.001172 * 12, 0.002312 * 12, 0.000710 * 12}, - {0.002083 * 12, 0.002768 * 12, 0.001302 * 12, 0.000457 * 12, 0.001105 * 12, 0.001647 * 12, 0.000563 * 12}, - {0.001593 * 12, 0.001302 * 12, 0.001463 * 12, 0.000639 * 12, 0.001050 * 12, 0.001110 * 12, 0.000519 * 12}, - {0.000488 * 12, 0.000457 * 12, 0.000639 * 12, 0.000608 * 12, 0.000663 * 12, 0.000042 * 12, 0.000370 * 12}, - {0.001172 * 12, 0.001105 * 12, 0.001050 * 12, 0.000663 * 12, 0.001389 * 12, 0.000825 * 12, 0.000661 * 12}, - {0.002312 * 12, 0.001647 * 12, 0.001110 * 12, 0.000042 * 12, 0.000825 * 12, 0.005211 * 12, 0.000749 * 12}, - {0.000710 * 12, 0.000563 * 12, 0.000519 * 12, 0.000370 * 12, 0.000661 * 12, 0.000749 * 12, 0.000703 * 12} - }; - - double[] adblReconcilerVariate = new double[] { - 0.1931, - 0.0000, - 0.0000, - 0.6600, - 0.0241, - 0.0722, - 0.0506 - }; - - AssetComponent[] aACReconciler = new AssetComponent[adblReconcilerVariate.length]; - - for (int i = 0; i < adblReconcilerVariate.length; ++i) - aACReconciler[i] = new AssetComponent ( - astrAssetName[i], - adblReconcilerVariate[i] - ); - - Portfolio pfReconciler = new Portfolio (aACReconciler); - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - pdp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - OptimizationOutput pfOptimal = cmva.allocate ( - pdp, - ausp - ); - - AssetComponent[] aACOptimal = pfOptimal.optimalPortfolio().assets(); - - System.out.println ("\t|--------------------------||"); - - System.out.println ("\t| OPTIMAL ASSET WEIGHTS ||"); - - System.out.println ("\t|--------------------------||"); - - System.out.println ("\t| ASSET | DRIP | EXCEL ||"); - - System.out.println ("\t|--------------------------||"); - - for (int i = 0; i < aACOptimal.length; ++i) - System.out.println ( - "\t| " + aACOptimal[i].id() + " |" + - FormatUtil.FormatDouble (aACOptimal[i].amount(), 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (aACReconciler[i].amount(), 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t|--------------------------||\n\n"); - - System.out.println ("\t|------------------------------------------------||"); - - System.out.println ("\t| Optimal Portfolio Normalize : " + FormatUtil.FormatDouble (pfOptimal.optimalPortfolio().notional(), 1, 2, 1.) + " ||"); - - System.out.println ("\t| Optimal Portfolio Input Return : " + FormatUtil.FormatDouble (dblPortfolioDesignReturn, 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Expected Return : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsMean(), 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Optimal Portfolio Expected Return : " + FormatUtil.FormatDouble (pfOptimal.optimalMetrics().excessReturnsStandardDeviation(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t| Excel Portfolio Standard Deviation : " + FormatUtil.FormatDouble (Math.sqrt (pfReconciler.variance (ausp)), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/assetbacked/ConstantPaymentBond.java b/org/drip/sample/assetbacked/ConstantPaymentBond.java deleted file mode 100644 index 5a08512..0000000 --- a/org/drip/sample/assetbacked/ConstantPaymentBond.java +++ /dev/null @@ -1,355 +0,0 @@ - -package org.drip.sample.assetbacked; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.analytics.daycount.Convention; -import org.drip.analytics.support.Helper; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.creator.ConstantPaymentBondBuilder; -import org.drip.product.definition.Bond; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ConstantPaymentBond demonstrates the Construction and Valuation of a Custom Constant Payment Mortgage - * Bond. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConstantPaymentBond { - - private static final void BondMetrics ( - final Bond bond, - final double dblInitialNotional, - final JulianDate dtSettle, - final CurveSurfaceQuoteContainer mktParams, - final double dblCleanPrice) - throws Exception - { - double dblAccrued = bond.accrued ( - dtSettle.julian(), - null - ); - - ValuationParams valParams = ValuationParams.Spot (dtSettle.julian()); - - double dblYield = bond.yieldFromPrice ( - valParams, - mktParams, - null, - dblCleanPrice - ); - - double dblModifiedDuration = bond.modifiedDurationFromPrice ( - valParams, - mktParams, - null, - dblCleanPrice - ); - - double dblRisk = bond.yield01FromPrice ( - valParams, - mktParams, - null, - dblCleanPrice - ); - - double dblConvexity = bond.convexityFromPrice ( - valParams, - mktParams, - null, - dblCleanPrice - ); - - JulianDate dtPreviousCouponDate = bond.previousCouponDate (dtSettle); - - double dblCurrentPrincipal = bond.notional (dtPreviousCouponDate.julian()) * dblInitialNotional; - - double dblAccruedAmount = dblAccrued * dblInitialNotional; - - System.out.println ("\t-------------------------------------"); - - System.out.println ("\tAnalytics Metrics for " + bond.name()); - - System.out.println ("\t-------------------------------------"); - - System.out.println ("\tPrice : " + FormatUtil.FormatDouble (dblCleanPrice, 1, 4, 100.)); - - System.out.println ("\tYield : " + FormatUtil.FormatDouble (dblYield, 1, 2, 100.) + "%"); - - System.out.println ("\tSettle : " + dtSettle); - - System.out.println(); - - System.out.println ("\tModified Duration : " + FormatUtil.FormatDouble (dblModifiedDuration, 1, 4, 10000.)); - - System.out.println ("\tRisk : " + FormatUtil.FormatDouble (dblRisk, 1, 4, 10000.)); - - System.out.println ("\tConvexity : " + FormatUtil.FormatDouble (dblConvexity * dblInitialNotional, 1, 4, 1.)); - - System.out.println ("\tDV01 : " + FormatUtil.FormatDouble (dblRisk * dblInitialNotional, 1, 2, 1.)); - - System.out.println(); - - System.out.println ("\tPrevious Coupon Date : " + dtPreviousCouponDate); - - System.out.println ("\tFace : " + FormatUtil.FormatDouble (dblInitialNotional, 1, 2, 1.)); - - System.out.println ("\tNotional : " + FormatUtil.FormatDouble (dblInitialNotional, 1, 2, 1.)); - - System.out.println ("\tCurrent Principal : " + FormatUtil.FormatDouble (dblCurrentPrincipal, 1, 2, 1.)); - - System.out.println ("\tAccrued : " + FormatUtil.FormatDouble (dblAccruedAmount, 1, 6, 1.)); - - System.out.println ("\tTotal : " + FormatUtil.FormatDouble (dblCleanPrice * dblCurrentPrincipal + dblAccruedAmount, 1, 2, 1.)); - - System.out.println ("\tNPV : " + FormatUtil.FormatDouble (dblCleanPrice * dblCurrentPrincipal + dblAccruedAmount, 1, 2, 1.)); - - System.out.println ("\tAccrual Days : " + FormatUtil.FormatDouble (dtSettle.julian() - dtPreviousCouponDate.julian(), 1, 0, 1.)); - } - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblBeginPrincipalFactor = 1.; - double dblCouponRate = 0.1189; - double dblServiceFeeRate = 0.00; - double dblBondNotional = 147544.28; - String strDayCount = "Act/365"; - String strCurrency = "USD"; - int iNumPayment = 48; - int iPayFrequency = 12; - double dblConstantPaymentAmount = 3941.98; - - double dblFixedPaymentAmount = ConstantPaymentBondBuilder.ConstantUniformPaymentAmount ( - dblBondNotional, - dblCouponRate, - iNumPayment / iPayFrequency - ); - - JulianDate dtEffective = DateUtil.CreateFromYMD ( - 2015, - DateUtil.OCTOBER, - 22 - ); - - Bond bond = ConstantPaymentBondBuilder.Standard ( - "FPMA 11.89 2019", - dtEffective, - strCurrency, - iNumPayment, - strDayCount, - iPayFrequency, - dblCouponRate, - 0., - dblConstantPaymentAmount, - dblBondNotional - ); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| FIXED CASH-FLOW MORTGAGE BOND ANALYTICS ||"); - - System.out.println ("\t| ----- --------- -------- ---- --------- ||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| - Start Date ||"); - - System.out.println ("\t| - End Date ||"); - - System.out.println ("\t| - Pay Date ||"); - - System.out.println ("\t| - Discount Factor ||"); - - System.out.println ("\t| - Survival Factor ||"); - - System.out.println ("\t| - Principal Factor ||"); - - System.out.println ("\t| - Accrual Days ||"); - - System.out.println ("\t| - Accrual Fraction ||"); - - System.out.println ("\t| - Coupon Rate (%) ||"); - - System.out.println ("\t| - Coupon Amount ||"); - - System.out.println ("\t| - Fee Rate (%) ||"); - - System.out.println ("\t| - Fee Amount ||"); - - System.out.println ("\t| - Principal Amount ||"); - - System.out.println ("\t| - Total Amount ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod p : bond.couponPeriods()) { - double dblPeriodCouponRate = p.couponMetrics ( - dtEffective.julian(), - null - ).rate(); - - double dblCouponDCF = p.couponDCF(); - - double dblEndPrincipalFactor = bond.notional (p.endDate()); - - double dblPrincipalAmount = (dblBeginPrincipalFactor - dblEndPrincipalFactor) * dblBondNotional; - - double dblCouponAmount = dblBeginPrincipalFactor * dblPeriodCouponRate * dblCouponDCF * dblBondNotional; - - double dblYieldDF = Helper.Yield2DF ( - iPayFrequency, - dblCouponRate, - Convention.YearFraction ( - dtEffective.julian(), - p.endDate(), - "30/360", - false, - null, - strCurrency - ) - ); - - System.out.println ("\t| [" + - DateUtil.YYYYMMDD (p.startDate()) + " -> " + - DateUtil.YYYYMMDD (p.endDate()) + "] => " + - DateUtil.YYYYMMDD (p.payDate()) + " | " + - FormatUtil.FormatDouble (dblYieldDF, 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (1., 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (dblBeginPrincipalFactor, 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (dblCouponDCF * 365, 1, 0, 1.) + " | " + - FormatUtil.FormatDouble (dblCouponDCF, 1, 10, 1.) + " | " + - FormatUtil.FormatDouble (dblPeriodCouponRate, 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblCouponAmount, 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (dblServiceFeeRate, 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblCouponAmount * dblServiceFeeRate / dblPeriodCouponRate, 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (dblPrincipalAmount, 3, 2, 1.) + " | " + - FormatUtil.FormatDouble (dblPrincipalAmount + dblCouponAmount, 3, 2, 1.) + " ||" - ); - - dblBeginPrincipalFactor = dblEndPrincipalFactor; - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------||\n"); - - JulianDate dtSettle = DateUtil.CreateFromYMD ( - 2015, - DateUtil.DECEMBER, - 1 - ); - - double dblCleanPrice = 1.00; // PAR - - CurveSurfaceQuoteContainer mktParams = new CurveSurfaceQuoteContainer(); - - BondMetrics ( - bond, - dblBondNotional, - dtSettle, - mktParams, - dblCleanPrice - ); - - Bond bondFeeAdjusted = ConstantPaymentBondBuilder.Standard ( - "FPMA 9.24 2016", - dtEffective, - strCurrency, - iNumPayment, - strDayCount, - iPayFrequency, - dblCouponRate, - dblServiceFeeRate, - dblConstantPaymentAmount, - dblBondNotional - ); - - ValuationParams valParams = ValuationParams.Spot (dtSettle.julian()); - - double dblYieldFeeAdjusted = bondFeeAdjusted.yieldFromPrice ( - valParams, - mktParams, - null, - dblCleanPrice - ); - - System.out.println ("\tFee Adjusted Yield : " + FormatUtil.FormatDouble (dblYieldFeeAdjusted, 1, 2, 100.) + "%"); - - System.out.println ("\n\tUniform Constant Mortgage Amount => " + FormatUtil.FormatDouble (dblFixedPaymentAmount, 1, 2, 1.)); - - System.out.println ( - "\tFee Unadjusted Price From Coupon Yield => " + FormatUtil.FormatDouble ( - bond.priceFromYield ( - valParams, - mktParams, - null, - dblCouponRate - ), - 1, 2, 100.) - ); - - System.out.println ( - "\tFee Adjusted Price From Coupon Yield => " + FormatUtil.FormatDouble ( - bondFeeAdjusted.priceFromYield ( - valParams, - mktParams, - null, - dblCouponRate - ), - 1, 2, 100.) - ); - } -} diff --git a/org/drip/sample/assetbacked/PrepayableConstantPaymentBond.java b/org/drip/sample/assetbacked/PrepayableConstantPaymentBond.java deleted file mode 100644 index 04e57b0..0000000 --- a/org/drip/sample/assetbacked/PrepayableConstantPaymentBond.java +++ /dev/null @@ -1,358 +0,0 @@ - -package org.drip.sample.assetbacked; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.analytics.daycount.Convention; -import org.drip.analytics.support.Helper; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.creator.ConstantPaymentBondBuilder; -import org.drip.product.definition.Bond; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * PrepayableConstantPaymentBond demonstrates the Construction and Valuation of a Custom Constant Payment - * Mortgage Bond. - * - * @author Lakshmi Krishnamurthy - */ - -public class PrepayableConstantPaymentBond { - - private static final void BondMetrics ( - final Bond bond, - final double dblInitialNotional, - final JulianDate dtSettle, - final CurveSurfaceQuoteContainer mktParams, - final double dblCleanPrice) - throws Exception - { - double dblAccrued = bond.accrued ( - dtSettle.julian(), - null - ); - - ValuationParams valParams = ValuationParams.Spot (dtSettle.julian()); - - double dblYield = bond.yieldFromPrice ( - valParams, - mktParams, - null, - dblCleanPrice - ); - - double dblModifiedDuration = bond.modifiedDurationFromPrice ( - valParams, - mktParams, - null, - dblCleanPrice - ); - - double dblRisk = bond.yield01FromPrice ( - valParams, - mktParams, - null, - dblCleanPrice - ); - - double dblConvexity = bond.convexityFromPrice ( - valParams, - mktParams, - null, - dblCleanPrice - ); - - JulianDate dtPreviousCouponDate = bond.previousCouponDate (dtSettle); - - double dblCurrentPrincipal = bond.notional (dtPreviousCouponDate.julian()) * dblInitialNotional; - - double dblAccruedAmount = dblAccrued * dblInitialNotional; - - System.out.println ("\t-------------------------------------"); - - System.out.println ("\tAnalytics Metrics for " + bond.name()); - - System.out.println ("\t-------------------------------------"); - - System.out.println ("\tPrice : " + FormatUtil.FormatDouble (dblCleanPrice, 1, 4, 100.)); - - System.out.println ("\tYield : " + FormatUtil.FormatDouble (dblYield, 1, 2, 100.) + "%"); - - System.out.println ("\tSettle : " + dtSettle); - - System.out.println(); - - System.out.println ("\tModified Duration : " + FormatUtil.FormatDouble (dblModifiedDuration, 1, 4, 10000.)); - - System.out.println ("\tRisk : " + FormatUtil.FormatDouble (dblRisk, 1, 4, 10000.)); - - System.out.println ("\tConvexity : " + FormatUtil.FormatDouble (dblConvexity * dblInitialNotional, 1, 4, 1.)); - - System.out.println ("\tDV01 : " + FormatUtil.FormatDouble (dblRisk * dblInitialNotional, 1, 2, 1.)); - - System.out.println(); - - System.out.println ("\tPrevious Coupon Date : " + dtPreviousCouponDate); - - System.out.println ("\tFace : " + FormatUtil.FormatDouble (dblInitialNotional, 1, 2, 1.)); - - System.out.println ("\tNotional : " + FormatUtil.FormatDouble (dblInitialNotional, 1, 2, 1.)); - - System.out.println ("\tCurrent Principal : " + FormatUtil.FormatDouble (dblCurrentPrincipal, 1, 2, 1.)); - - System.out.println ("\tAccrued : " + FormatUtil.FormatDouble (dblAccruedAmount, 1, 6, 1.)); - - System.out.println ("\tTotal : " + FormatUtil.FormatDouble (dblCleanPrice * dblCurrentPrincipal + dblAccruedAmount, 1, 2, 1.)); - - System.out.println ("\tNPV : " + FormatUtil.FormatDouble (dblCleanPrice * dblCurrentPrincipal + dblAccruedAmount, 1, 2, 1.)); - - System.out.println ("\tAccrual Days : " + FormatUtil.FormatDouble (dtSettle.julian() - dtPreviousCouponDate.julian(), 1, 0, 1.)); - } - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblBeginPrincipalFactor = 1.; - double dblCouponRate = 0.1189; - double dblServiceFeeRate = 0.00; - double dblCPR = 0.01; - double dblBondNotional = 147544.28; - String strDayCount = "Act/365"; - String strCurrency = "USD"; - int iNumPayment = 48; - int iPayFrequency = 12; - double dblConstantPaymentAmount = 3941.98; - - double dblFixedPaymentAmount = ConstantPaymentBondBuilder.ConstantUniformPaymentAmount ( - dblBondNotional, - dblCouponRate, - iNumPayment / iPayFrequency - ); - - JulianDate dtEffective = DateUtil.CreateFromYMD ( - 2015, - DateUtil.OCTOBER, - 22 - ); - - Bond bond = ConstantPaymentBondBuilder.Prepay ( - "FPMA 11.89 2019", - dtEffective, - strCurrency, - iNumPayment, - strDayCount, - iPayFrequency, - dblCouponRate, - 0., - dblCPR, - dblConstantPaymentAmount, - dblBondNotional - ); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| FIXED CASH-FLOW MORTGAGE BOND ANALYTICS ||"); - - System.out.println ("\t| ----- --------- -------- ---- --------- ||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| - Start Date ||"); - - System.out.println ("\t| - End Date ||"); - - System.out.println ("\t| - Pay Date ||"); - - System.out.println ("\t| - Discount Factor ||"); - - System.out.println ("\t| - Survival Factor ||"); - - System.out.println ("\t| - Principal Factor ||"); - - System.out.println ("\t| - Accrual Days ||"); - - System.out.println ("\t| - Accrual Fraction ||"); - - System.out.println ("\t| - Coupon Rate (%) ||"); - - System.out.println ("\t| - Coupon Amount ||"); - - System.out.println ("\t| - Fee Rate (%) ||"); - - System.out.println ("\t| - Fee Amount ||"); - - System.out.println ("\t| - Principal Amount ||"); - - System.out.println ("\t| - Total Amount ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod p : bond.couponPeriods()) { - double dblPeriodCouponRate = p.couponMetrics ( - dtEffective.julian(), - null - ).rate(); - - double dblCouponDCF = p.couponDCF(); - - double dblEndPrincipalFactor = bond.notional (p.endDate()); - - double dblPrincipalAmount = (dblBeginPrincipalFactor - dblEndPrincipalFactor) * dblBondNotional; - - double dblCouponAmount = dblBeginPrincipalFactor * dblPeriodCouponRate * dblCouponDCF * dblBondNotional; - - double dblYieldDF = Helper.Yield2DF ( - iPayFrequency, - dblCouponRate, - Convention.YearFraction ( - dtEffective.julian(), - p.endDate(), - "30/360", - false, - null, - strCurrency - ) - ); - - System.out.println ("\t| [" + - DateUtil.YYYYMMDD (p.startDate()) + " -> " + - DateUtil.YYYYMMDD (p.endDate()) + "] => " + - DateUtil.YYYYMMDD (p.payDate()) + " | " + - FormatUtil.FormatDouble (1., 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (dblYieldDF, 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (dblBeginPrincipalFactor, 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (dblCouponDCF * 365, 1, 0, 1.) + " | " + - FormatUtil.FormatDouble (dblCouponDCF, 1, 10, 1.) + " | " + - FormatUtil.FormatDouble (dblPeriodCouponRate, 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblCouponAmount, 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (dblServiceFeeRate, 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblCouponAmount * dblServiceFeeRate / dblPeriodCouponRate, 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (dblPrincipalAmount, 3, 2, 1.) + " | " + - FormatUtil.FormatDouble (dblPrincipalAmount + dblCouponAmount, 3, 2, 1.) + " ||" - ); - - dblBeginPrincipalFactor = dblEndPrincipalFactor; - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------||\n"); - - JulianDate dtSettle = DateUtil.CreateFromYMD ( - 2015, - DateUtil.DECEMBER, - 1 - ); - - double dblCleanPrice = 1.00; // PAR - - CurveSurfaceQuoteContainer mktParams = new CurveSurfaceQuoteContainer(); - - BondMetrics ( - bond, - dblBondNotional, - dtSettle, - mktParams, - dblCleanPrice - ); - - Bond bondFeeAdjusted = ConstantPaymentBondBuilder.Prepay ( - "SERVICEABLE FPMA 11.89 2019", - dtEffective, - strCurrency, - iNumPayment, - strDayCount, - iPayFrequency, - dblCouponRate, - dblServiceFeeRate, - dblCPR, - dblConstantPaymentAmount, - dblBondNotional - ); - - ValuationParams valParams = ValuationParams.Spot (dtSettle.julian()); - - double dblYieldFeeAdjusted = bondFeeAdjusted.yieldFromPrice ( - valParams, - mktParams, - null, - dblCleanPrice - ); - - System.out.println ("\tFee Adjusted Yield : " + FormatUtil.FormatDouble (dblYieldFeeAdjusted, 1, 2, 100.) + "%"); - - System.out.println ("\n\tUniform Constant Mortgage Amount => " + FormatUtil.FormatDouble (dblFixedPaymentAmount, 1, 2, 1.)); - - System.out.println ( - "\tFee Unadjusted Price From Coupon Yield => " + FormatUtil.FormatDouble ( - bond.priceFromYield ( - valParams, - mktParams, - null, - dblCouponRate - ), - 1, 2, 100.) - ); - - System.out.println ( - "\tFee Adjusted Price From Coupon Yield => " + FormatUtil.FormatDouble ( - bondFeeAdjusted.priceFromYield ( - valParams, - mktParams, - null, - dblCouponRate - ), - 1, 2, 100.) - ); - } -} diff --git a/org/drip/sample/athl/EquityMarketImpactDRI.java b/org/drip/sample/athl/EquityMarketImpactDRI.java deleted file mode 100644 index 248c7a8..0000000 --- a/org/drip/sample/athl/EquityMarketImpactDRI.java +++ /dev/null @@ -1,255 +0,0 @@ - -package org.drip.sample.athl; - -import org.drip.execution.athl.*; -import org.drip.execution.parameters.AssetFlowSettings; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * EquityMarketImpactDRI demonstrates the Reconciliation of the Equity Market Impact with that determined - * empirically by Almgren, Thum, Hauptmann, and Li (2005), using the Parameterization of Almgren (2003) for - * DRI. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class EquityMarketImpactDRI { - - private static final void TemporaryImpactReconciler ( - final TemporaryImpact ti, - final double dblTradeSize, - final double dblTime, - final double dblNormalizedTemporaryImpactReconciler, - final double dblDenormalizedTemporaryImpactReconciler, - final double dblDenormalizedPermanentImpact, - final double dblRealizedImpactReconciler) - throws Exception - { - double dblNormalizedTemporaryImpact = ti.evaluate ( - dblTradeSize / (ti.assetFlowParameters().averageDailyVolume() * dblTime) - ); - - double dblDenormalizedTemporaryImpact = ti.evaluate ( - dblTradeSize, - dblTime - ); - - System.out.println ( - "\t| " + - FormatUtil.FormatDouble (dblTime, 1, 1, 1.) + " | " + - FormatUtil.FormatDouble (dblNormalizedTemporaryImpact, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblNormalizedTemporaryImpactReconciler, 1, 3, 1.) + " || " + - FormatUtil.FormatDouble (dblDenormalizedTemporaryImpact, 2, 0, 100.) + " | " + - FormatUtil.FormatDouble (dblDenormalizedTemporaryImpactReconciler, 2, 0, 1.) + " ||" + - FormatUtil.FormatDouble (dblDenormalizedPermanentImpact + dblDenormalizedTemporaryImpact, 2, 0, 100.) + " | " + - FormatUtil.FormatDouble (dblRealizedImpactReconciler, 2, 0, 1.) + " ||" - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strAssetName = "DRI"; - double dblAverageDailyVolume = 1929000.; - double dblSharesOutstanding = 168000000.; - double dblDailyVolatility = 2.26; - double dblTradeSize = 192900.; - double dblTradeTime = 1.; - - double dblInverseTurnoverReconciler = 87.092; - double dblNormalizedTradeSizeReconciler = 0.1; - double dblNormalizedPermanentImpactReconciler = 0.096; - double dblDenormalizedPermanentImpactReconciler = 21.679; - - double[] adblTime = new double[] { - 0.1, - 0.2, - 0.5 - }; - - double[] adblNormalizedTemporaryImpactReconciler = new double[] { - 0.142, - 0.094, - 0.054 - }; - - double[] adblDenormalizedTemporaryImpactReconciler = new double[] { - 32, - 21, - 12 - }; - - double[] adblRealizedImpactReconciler = new double[] { - 43, - 32, - 23 - }; - - AssetFlowSettings afs = new AssetFlowSettings ( - strAssetName, - dblAverageDailyVolume, - dblSharesOutstanding, - dblDailyVolatility - ); - - TemporaryImpact ti = new TemporaryImpact (afs); - - PermanentImpactNoArbitrage pina = new PermanentImpactNoArbitrage (afs); - - double dblDenormalizedPermanentImpact = pina.evaluate ( - dblTradeSize, - dblTradeTime - ); - - double dblNormalizedPermanentImpact = pina.evaluate ( - dblTradeSize / (afs.averageDailyVolume() * dblTradeTime) - ); - - System.out.println(); - - System.out.println ("\t|-------------------------------------------||"); - - System.out.println ("\t| Asset => " + strAssetName); - - System.out.println ("\t| Average Daily Volume => " + FormatUtil.FormatDouble (dblAverageDailyVolume, 1, 0, 1.)); - - System.out.println ("\t| Shares Outstanding => " + FormatUtil.FormatDouble (dblSharesOutstanding, 1, 0, 1.)); - - System.out.println ("\t| Daily Volatility => " + FormatUtil.FormatDouble (dblDailyVolatility, 1, 2, 1.) + "%"); - - System.out.println ("\t| Trade Size => " + FormatUtil.FormatDouble (dblTradeSize, 1, 0, 1.)); - - System.out.println ("\t|-------------------------------------------||\n"); - - System.out.println ("\t|------------------------------------------------------||"); - - System.out.println ("\t| ALMGREN, THUM, HAUPTMANN, and LI (2005) PERM. RECON ||"); - - System.out.println ("\t|------------------------------------------------------||"); - - System.out.println ( - "\t| Inverse Turn-over => " + - FormatUtil.FormatDouble (afs.inverseTurnover(), 2, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblInverseTurnoverReconciler, 2, 3, 1.) + " ||" - ); - - System.out.println ( - "\t| Normalized Trade Size => " + - FormatUtil.FormatDouble (afs.normalizeTradeSize (dblTradeSize, dblTradeTime), 2, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblNormalizedTradeSizeReconciler, 2, 3, 1.) + " ||" - ); - - System.out.println ( - "\t| Normalized Permanent Impact => " + - FormatUtil.FormatDouble (2. * dblNormalizedPermanentImpact, 2, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblNormalizedPermanentImpactReconciler, 2, 3, 1.) + " ||" - ); - - System.out.println ( - "\t| De-normalized Permanent Impact => " + - FormatUtil.FormatDouble (2. * dblDenormalizedPermanentImpact, 2, 3, 100.) + " | " + - FormatUtil.FormatDouble (dblDenormalizedPermanentImpactReconciler, 2, 3, 1.) + " ||" - ); - - System.out.println ("\t|------------------------------------------------------||\n"); - - System.out.println ("\t|-------------------------------------------------||"); - - System.out.println ("\t| TEMPORARY IMPACT PARAMETERS RECONCILIATION ||"); - - System.out.println ("\t|-------------------------------------------------||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| - Time ||"); - - System.out.println ("\t| - Normalized K (Computed) ||"); - - System.out.println ("\t| - Normalized K (Reconciler) ||"); - - System.out.println ("\t| - De-normalized K (Computed) ||"); - - System.out.println ("\t| - De-normalized K (Reconciler) ||"); - - System.out.println ("\t| - De-normalized J (Computed) ||"); - - System.out.println ("\t| - De-normalized J (Reconciler) ||"); - - System.out.println ("\t|-------------------------------------------------||"); - - for (int i = 0; i < adblTime.length; ++i) - TemporaryImpactReconciler ( - ti, - dblTradeSize, - adblTime[i], - adblNormalizedTemporaryImpactReconciler[i], - adblDenormalizedTemporaryImpactReconciler[i], - dblDenormalizedPermanentImpact, - adblRealizedImpactReconciler[i] - ); - - System.out.println ("\t|-------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/athl/EquityMarketImpactIBM.java b/org/drip/sample/athl/EquityMarketImpactIBM.java deleted file mode 100644 index f01d835..0000000 --- a/org/drip/sample/athl/EquityMarketImpactIBM.java +++ /dev/null @@ -1,253 +0,0 @@ - -package org.drip.sample.athl; - -import org.drip.execution.athl.*; -import org.drip.execution.parameters.AssetFlowSettings; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * EquityMarketImpactIBM demonstrates the Reconciliation of the Equity Market Impact with that determined - * empirically by Almgren, Thum, Hauptmann, and Li (2005), using the Parameterization of Almgren (2003) for - * IBM. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class EquityMarketImpactIBM { - - private static final void TemporaryImpactReconciler ( - final TemporaryImpact ti, - final double dblTradeSize, - final double dblTime, - final double dblNormalizedTemporaryImpactReconciler, - final double dblDenormalizedTemporaryImpactReconciler, - final double dblDenormalizedPermanentImpact, - final double dblRealizedImpactReconciler) - throws Exception - { - double dblNormalizedTemporaryImpact = ti.evaluate ( - dblTradeSize / (ti.assetFlowParameters().averageDailyVolume() * dblTime) - ); - - double dblDenormalizedTemporaryImpact = ti.evaluate ( - dblTradeSize, - dblTime - ); - - System.out.println ( - "\t| " + - FormatUtil.FormatDouble (dblTime, 1, 1, 1.) + " | " + - FormatUtil.FormatDouble (dblNormalizedTemporaryImpact, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblNormalizedTemporaryImpactReconciler, 1, 3, 1.) + " || " + - FormatUtil.FormatDouble (dblDenormalizedTemporaryImpact, 2, 0, 100.) + " | " + - FormatUtil.FormatDouble (dblDenormalizedTemporaryImpactReconciler, 2, 0, 1.) + " ||" + - FormatUtil.FormatDouble (dblDenormalizedPermanentImpact + dblDenormalizedTemporaryImpact, 2, 0, 100.) + " | " + - FormatUtil.FormatDouble (dblRealizedImpactReconciler, 2, 0, 1.) + " ||" - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strAssetName = "IBM"; - double dblAverageDailyVolume = 6561000.; - double dblSharesOutstanding = 1728000000.; - double dblDailyVolatility = 1.57; - double dblTradeSize = 656100.; - double dblTradeTime = 1.; - - double dblInverseTurnoverReconciler = 263.374; - double dblNormalizedTradeSizeReconciler = 0.1; - double dblNormalizedPermanentImpactReconciler = 0.126; - double dblDenormalizedPermanentImpactReconciler = 19.86; - - double[] adblTime = new double[] { - 0.1, - 0.2, - 0.5 - }; - - double[] adblNormalizedTemporaryImpactReconciler = new double[] { - 0.142, - 0.094, - 0.054 - }; - - double[] adblDenormalizedTemporaryImpactReconciler = new double[] { - 22, - 15, - 8 - }; - - double[] adblRealizedImpactReconciler = new double[] { - 32, - 25, - 18 - }; - - AssetFlowSettings afs = new AssetFlowSettings ( - strAssetName, - dblAverageDailyVolume, - dblSharesOutstanding, - dblDailyVolatility - ); - - TemporaryImpact ti = new TemporaryImpact (afs); - - PermanentImpactNoArbitrage pina = new PermanentImpactNoArbitrage (afs); - - double dblDenormalizedPermanentImpact = pina.evaluate ( - dblTradeSize, - dblTradeTime - ); - - double dblNormalizedPermanentImpact = pina.evaluate (dblTradeSize / (afs.averageDailyVolume() * dblTradeTime)); - - System.out.println(); - - System.out.println ("\t|-------------------------------------------||"); - - System.out.println ("\t| Asset => " + strAssetName); - - System.out.println ("\t| Average Daily Volume => " + FormatUtil.FormatDouble (dblAverageDailyVolume, 1, 0, 1.)); - - System.out.println ("\t| Shares Outstanding => " + FormatUtil.FormatDouble (dblSharesOutstanding, 1, 0, 1.)); - - System.out.println ("\t| Daily Volatility => " + FormatUtil.FormatDouble (dblDailyVolatility, 1, 2, 1.) + "%"); - - System.out.println ("\t| Trade Size => " + FormatUtil.FormatDouble (dblTradeSize, 1, 0, 1.)); - - System.out.println ("\t|-------------------------------------------||\n"); - - System.out.println ("\t|--------------------------------------------------------||"); - - System.out.println ("\t| ALMGREN, THUM, HAUPTMANN, and LI (2005) PERM. RECON ||"); - - System.out.println ("\t|--------------------------------------------------------||"); - - System.out.println ( - "\t| Inverse Turn-over => " + - FormatUtil.FormatDouble (afs.inverseTurnover(), 3, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblInverseTurnoverReconciler, 3, 3, 1.) + " ||" - ); - - System.out.println ( - "\t| Normalized Trade Size => " + - FormatUtil.FormatDouble (afs.normalizeTradeSize (dblTradeSize, dblTradeTime), 3, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblNormalizedTradeSizeReconciler, 3, 3, 1.) + " ||" - ); - - System.out.println ( - "\t| Normalized Permanent Impact => " + - FormatUtil.FormatDouble (2. * dblNormalizedPermanentImpact, 3, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblNormalizedPermanentImpactReconciler, 3, 3, 1.) + " ||" - ); - - System.out.println ( - "\t| De-normalized Permanent Impact => " + - FormatUtil.FormatDouble (2. * dblDenormalizedPermanentImpact, 3, 3, 100.) + " | " + - FormatUtil.FormatDouble (dblDenormalizedPermanentImpactReconciler, 3, 3, 1.) + " ||" - ); - - System.out.println ("\t|--------------------------------------------------------||\n"); - - System.out.println ("\t|-------------------------------------------------||"); - - System.out.println ("\t| TEMPORARY IMPACT PARAMETERS RECONCILIATION ||"); - - System.out.println ("\t|-------------------------------------------------||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| - Time ||"); - - System.out.println ("\t| - Normalized K (Computed) ||"); - - System.out.println ("\t| - Normalized K (Reconciler) ||"); - - System.out.println ("\t| - De-normalized K (Computed) ||"); - - System.out.println ("\t| - De-normalized K (Reconciler) ||"); - - System.out.println ("\t| - De-normalized J (Computed) ||"); - - System.out.println ("\t| - De-normalized J (Reconciler) ||"); - - System.out.println ("\t|-------------------------------------------------||"); - - for (int i = 0; i < adblTime.length; ++i) - TemporaryImpactReconciler ( - ti, - dblTradeSize, - adblTime[i], - adblNormalizedTemporaryImpactReconciler[i], - adblDenormalizedTemporaryImpactReconciler[i], - dblDenormalizedPermanentImpact, - adblRealizedImpactReconciler[i] - ); - - System.out.println ("\t|-------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/athl/OptimalTrajectoryDRI.java b/org/drip/sample/athl/OptimalTrajectoryDRI.java deleted file mode 100644 index 5fdd4d8..0000000 --- a/org/drip/sample/athl/OptimalTrajectoryDRI.java +++ /dev/null @@ -1,196 +0,0 @@ - -package org.drip.sample.athl; - -import org.drip.execution.athl.DynamicsParameters; -import org.drip.execution.dynamics.LinearPermanentExpectationParameters; -import org.drip.execution.nonadaptive.ContinuousPowerImpact; -import org.drip.execution.optimum.PowerImpactContinuous; -import org.drip.execution.parameters.AssetFlowSettings; -import org.drip.execution.strategy.DiscreteTradingTrajectory; -import org.drip.function.definition.R1ToR1; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OptimalTrajectoryDRI demonstrates the Trade Scheduling using the Equity Market Impact Functions determined - * empirically by Almgren, Thum, Hauptmann, and Li (2005), using the Parameterization of Almgren (2003) for - * DRI. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class OptimalTrajectoryDRI { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strAssetName = "DRI"; - double dblAverageDailyVolume = 1929000.; - double dblSharesOutstanding = 168000000.; - double dblDailyVolatility = 2.26; - - double dblTradeSize = 192900.; - double dblTradeTime = 1.; - int iNumInterval = 20; - - double dblRiskAversion = 1.e-02; - - AssetFlowSettings afs = new AssetFlowSettings ( - strAssetName, - dblAverageDailyVolume, - dblSharesOutstanding, - dblDailyVolatility - ); - - LinearPermanentExpectationParameters lpep = new DynamicsParameters (afs).almgren2003(); - - ContinuousPowerImpact cpi = ContinuousPowerImpact.Standard ( - dblTradeSize, - dblTradeTime, - lpep, - dblRiskAversion - ); - - PowerImpactContinuous pic = (PowerImpactContinuous) cpi.generate(); - - R1ToR1 r1ToR1Holdings = pic.holdings(); - - double[] adblHoldings = new double[iNumInterval]; - double[] adblExecutionTime = new double[iNumInterval]; - - for (int i = 1; i <= iNumInterval; ++i) { - adblExecutionTime[i - 1] = dblTradeTime * i / iNumInterval; - - adblHoldings[i - 1] = r1ToR1Holdings.evaluate (adblExecutionTime[i - 1]); - } - - DiscreteTradingTrajectory dtt = DiscreteTradingTrajectory.Standard ( - adblExecutionTime, - adblHoldings - ); - - double[] adblTradeList = dtt.tradeList(); - - System.out.println(); - - System.out.println ("\t|-----------------------------------||"); - - System.out.println ("\t| DRI ATHL 2005 Optimal Trajectory ||"); - - System.out.println ("\t|-----------------------------------||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| - Execution Time Node ||"); - - System.out.println ("\t| - Holdings Remaining ||"); - - System.out.println ("\t| - Trade List Amount ||"); - - System.out.println ("\t| - Holdings (%) ||"); - - System.out.println ("\t|-----------------------------------||"); - - for (int i = 1; i < adblExecutionTime.length; ++i) - System.out.println ( - "\t| " + - FormatUtil.FormatDouble (adblExecutionTime[i], 1, 2, 1.) + " | " + - FormatUtil.FormatDouble (adblHoldings[i], 6, 0, 1.) + " | " + - FormatUtil.FormatDouble (adblTradeList[i - 1], 5, 0, 1.) + " | " + - FormatUtil.FormatDouble (adblHoldings[i] / dblTradeSize, 2, 1, 100.) + "% ||" - ); - - System.out.println ("\t|-----------------------------------||"); - - System.out.println(); - - System.out.println ("\t|---------------------------------------------------------------------||"); - - System.out.println ("\t| DRI ATHL 2005 Optimal Trajectory Transaction Cost Measures ||"); - - System.out.println ("\t|---------------------------------------------------------------------||"); - - System.out.println ( - "\t| Transaction Cost Expectation ( X 10^-06) : " + - FormatUtil.FormatDouble (pic.transactionCostExpectation(), 3, 2, 1.e-06) + " ||" - ); - - System.out.println ( - "\t| Transaction Cost Variance ( X 10^-09) : " + - FormatUtil.FormatDouble (pic.transactionCostVariance(), 3, 2, 1.e-09) + " ||" - ); - - System.out.println ( - "\t| Characteristic Time : " + - FormatUtil.FormatDouble (pic.characteristicTime(), 3, 2, 1.) + " ||" - ); - - System.out.println ( - "\t| Efficient Frontier Hyperboloid Boundary Value ( X 10^-12) : " + - FormatUtil.FormatDouble (pic.hyperboloidBoundaryValue(), 3, 2, 1.e-12) + " ||" - ); - - System.out.println ("\t|---------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/athl/OptimalTrajectoryIBM.java b/org/drip/sample/athl/OptimalTrajectoryIBM.java deleted file mode 100644 index 356c409..0000000 --- a/org/drip/sample/athl/OptimalTrajectoryIBM.java +++ /dev/null @@ -1,193 +0,0 @@ - -package org.drip.sample.athl; - -import org.drip.execution.athl.DynamicsParameters; -import org.drip.execution.nonadaptive.ContinuousPowerImpact; -import org.drip.execution.optimum.PowerImpactContinuous; -import org.drip.execution.parameters.AssetFlowSettings; -import org.drip.execution.strategy.DiscreteTradingTrajectory; -import org.drip.function.definition.R1ToR1; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OptimalTrajectoryIBM demonstrates the Trade Scheduling using the Equity Market Impact Functions determined - * empirically by Almgren, Thum, Hauptmann, and Li (2005), using the Parameterization of Almgren (2003) for - * IBM. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class OptimalTrajectoryIBM { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strAssetName = "IBM"; - double dblAverageDailyVolume = 6561000.; - double dblSharesOutstanding = 1728000000.; - double dblDailyVolatility = 1.57; - - double dblTradeSize = 656100.; - double dblTradeTime = 1.; - int iNumInterval = 20; - - double dblRiskAversion = 1.e-02; - - ContinuousPowerImpact cpi = ContinuousPowerImpact.Standard ( - dblTradeSize, - dblTradeTime, - new DynamicsParameters ( - new AssetFlowSettings ( - strAssetName, - dblAverageDailyVolume, - dblSharesOutstanding, - dblDailyVolatility - ) - ).almgren2003(), - dblRiskAversion - ); - - PowerImpactContinuous pic = (PowerImpactContinuous) cpi.generate(); - - R1ToR1 r1ToR1Holdings = pic.holdings(); - - double[] adblHoldings = new double[iNumInterval]; - double[] adblExecutionTime = new double[iNumInterval]; - - for (int i = 1; i <= iNumInterval; ++i) { - adblExecutionTime[i - 1] = dblTradeTime * i / iNumInterval; - - adblHoldings[i - 1] = r1ToR1Holdings.evaluate (adblExecutionTime[i - 1]); - } - - DiscreteTradingTrajectory dtt = DiscreteTradingTrajectory.Standard ( - adblExecutionTime, - adblHoldings - ); - - double[] adblTradeList = dtt.tradeList(); - - System.out.println(); - - System.out.println ("\t|------------------------------------||"); - - System.out.println ("\t| IBM ATHL 2005 Optimal Trajectory ||"); - - System.out.println ("\t|------------------------------------||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| - Execution Time Node ||"); - - System.out.println ("\t| - Holdings Remaining ||"); - - System.out.println ("\t| - Trade List Amount ||"); - - System.out.println ("\t| - Holdings (%) ||"); - - System.out.println ("\t|------------------------------------||"); - - for (int i = 1; i < adblExecutionTime.length; ++i) - System.out.println ( - "\t| " + - FormatUtil.FormatDouble (adblExecutionTime[i], 1, 2, 1.) + " | " + - FormatUtil.FormatDouble (adblHoldings[i], 6, 0, 1.) + " | " + - FormatUtil.FormatDouble (adblTradeList[i - 1], 6, 0, 1.) + " | " + - FormatUtil.FormatDouble (adblHoldings[i] / dblTradeSize, 2, 1, 100.) + "% ||" - ); - - System.out.println ("\t|------------------------------------||"); - - System.out.println(); - - System.out.println ("\t|----------------------------------------------------------------------||"); - - System.out.println ("\t| IBM ATHL 2005 Optimal Trajectory Transaction Cost Measures ||"); - - System.out.println ("\t|----------------------------------------------------------------------||"); - - System.out.println ( - "\t| Transaction Cost Expectation ( X 10^-09) : " + - FormatUtil.FormatDouble (pic.transactionCostExpectation(), 4, 2, 1.e-09) + " ||" - ); - - System.out.println ( - "\t| Transaction Cost Variance ( X 10^-09) : " + - FormatUtil.FormatDouble (pic.transactionCostVariance(), 4, 2, 1.e-09) + " ||" - ); - - System.out.println ( - "\t| Characteristic Time : " + - FormatUtil.FormatDouble (pic.characteristicTime(), 4, 2, 1.) + " ||" - ); - - System.out.println ( - "\t| Efficient Frontier Hyperboloid Boundary Value ( X 10^-12) : " + - FormatUtil.FormatDouble (pic.hyperboloidBoundaryValue(), 4, 2, 1.e-12) + " ||" - ); - - System.out.println ("\t|----------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/athl/OptimalTrajectoryTradeAnalysis.java b/org/drip/sample/athl/OptimalTrajectoryTradeAnalysis.java deleted file mode 100644 index 3574e27..0000000 --- a/org/drip/sample/athl/OptimalTrajectoryTradeAnalysis.java +++ /dev/null @@ -1,185 +0,0 @@ - -package org.drip.sample.athl; - -import org.drip.execution.athl.DynamicsParameters; -import org.drip.execution.dynamics.LinearPermanentExpectationParameters; -import org.drip.execution.nonadaptive.ContinuousPowerImpact; -import org.drip.execution.optimum.PowerImpactContinuous; -import org.drip.execution.parameters.AssetFlowSettings; -import org.drip.function.definition.R1ToR1; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OptimalTrajectoryTradeAnalysis analyzes the Impact of Input Parameters on the Trade Scheduling using the - * Equity Market Impact Functions determined empirically by Almgren, Thum, Hauptmann, and Li (2005), using - * the Parameterization of Almgren (2003) for IBM. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class OptimalTrajectoryTradeAnalysis { - - private static final void TradeSizeSensitivity ( - final double dblADVRatio, - final double dblTradeSize, - final LinearPermanentExpectationParameters lpep) - throws Exception - { - double dblTradeTime = 0.5; - int iNumInterval = 10; - - double dblRiskAversion = 1.e-02; - - ContinuousPowerImpact cpi = ContinuousPowerImpact.Standard ( - dblTradeSize, - dblTradeTime, - lpep, - dblRiskAversion - ); - - PowerImpactContinuous pic = (PowerImpactContinuous) cpi.generate(); - - R1ToR1 r1ToR1Holdings = pic.holdings(); - - double[] adblHoldings = new double[iNumInterval]; - double[] adblExecutionTime = new double[iNumInterval]; - - for (int i = 1; i <= iNumInterval; ++i) { - adblExecutionTime[i - 1] = dblTradeTime * i / iNumInterval; - - adblHoldings[i - 1] = r1ToR1Holdings.evaluate (adblExecutionTime[i - 1]); - } - - String strDump = ""; - - for (int i = 0; i < adblHoldings.length; ++i) - strDump = strDump + FormatUtil.FormatDouble (adblHoldings[i] / dblTradeSize, 2, 2, 100.) + "% | "; - - System.out.println ( - "\t| " + - FormatUtil.FormatDouble (dblADVRatio, 2, 0, 100.) + "% | " + strDump + - FormatUtil.FormatDouble (pic.characteristicTime(), 1, 3, 1.) + " ||" - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strAssetName = "IBM"; - double dblAverageDailyVolume = 6561000.; - double dblSharesOutstanding = 1728000000.; - double dblBaseDailyVolatility = 1.57; - - double[] adblADVRatio = new double[] { - 0.01, - 0.02, - 0.03, - 0.04, - 0.06, - 0.08, - 0.10, - 0.15, - 0.20, - 0.25, - 0.30 - }; - - LinearPermanentExpectationParameters lpep = new DynamicsParameters ( - new AssetFlowSettings ( - strAssetName, - dblAverageDailyVolume, - dblSharesOutstanding, - dblBaseDailyVolatility - ) - ).almgren2003(); - - System.out.println(); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| Trade Size Dependence on the Execution Schedule ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| L -> R : ||"); - - System.out.println ("\t| Trade Size as a Fraction of ADV ||"); - - System.out.println ("\t| Execution Time Nodes ||"); - - System.out.println ("\t| Characteristic Time ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------||"); - - for (double dblADVRatio : adblADVRatio) - TradeSizeSensitivity ( - dblADVRatio, - dblADVRatio * dblAverageDailyVolume, - lpep - ); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/athl/OptimalTrajectoryVolatilityAnalysis.java b/org/drip/sample/athl/OptimalTrajectoryVolatilityAnalysis.java deleted file mode 100644 index 6a4aff5..0000000 --- a/org/drip/sample/athl/OptimalTrajectoryVolatilityAnalysis.java +++ /dev/null @@ -1,188 +0,0 @@ - -package org.drip.sample.athl; - -import org.drip.execution.athl.DynamicsParameters; -import org.drip.execution.dynamics.LinearPermanentExpectationParameters; -import org.drip.execution.nonadaptive.ContinuousPowerImpact; -import org.drip.execution.optimum.PowerImpactContinuous; -import org.drip.execution.parameters.AssetFlowSettings; -import org.drip.function.definition.R1ToR1; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OptimalTrajectoryVolatilityAnalysis analyzes the Impact of Input Parameters on the Trade Scheduling using - * the Equity Market Impact Functions determined empirically by Almgren, Thum, Hauptmann, and Li (2005), - * using the Parameterization of Almgren (2003) for IBM. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class OptimalTrajectoryVolatilityAnalysis { - - private static final void VolatilitySensitivity ( - final String strAssetName, - final double dblAverageDailyVolume, - final double dblDailyVolatility, - final double dblSharesOutstanding, - final double dblTradeSize) - throws Exception - { - double dblTradeTime = 0.5; - int iNumInterval = 10; - - double dblRiskAversion = 1.e-02; - - LinearPermanentExpectationParameters lpep = new DynamicsParameters ( - new AssetFlowSettings ( - strAssetName, - dblAverageDailyVolume, - dblSharesOutstanding, - dblDailyVolatility - ) - ).almgren2003(); - - ContinuousPowerImpact cpi = ContinuousPowerImpact.Standard ( - dblTradeSize, - dblTradeTime, - lpep, - dblRiskAversion - ); - - PowerImpactContinuous pic = (PowerImpactContinuous) cpi.generate(); - - R1ToR1 r1ToR1Holdings = pic.holdings(); - - double[] adblHoldings = new double[iNumInterval]; - double[] adblExecutionTime = new double[iNumInterval]; - - for (int i = 1; i <= iNumInterval; ++i) { - adblExecutionTime[i - 1] = dblTradeTime * i / iNumInterval; - - adblHoldings[i - 1] = r1ToR1Holdings.evaluate (adblExecutionTime[i - 1]); - } - - String strDump = ""; - - for (int i = 0; i < adblHoldings.length; ++i) - strDump = strDump + FormatUtil.FormatDouble (adblHoldings[i] / dblTradeSize, 2, 2, 100.) + "% | "; - - System.out.println ( - "\t| " + - FormatUtil.FormatDouble (dblDailyVolatility, 1, 2, 1.) + "% | " + strDump + - FormatUtil.FormatDouble (pic.characteristicTime(), 1, 3, 1.) + " ||" - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strAssetName = "IBM"; - double dblAverageDailyVolume = 6561000.; - double dblSharesOutstanding = 1728000000.; - double dblTradeSize = 656100.; - - double[] adblDailyVolatility = new double[] { - 0.75, - 1.00, - 1.25, - 1.50, - 1.75, - 2.00, - 2.25, - 2.50, - 2.75, - 3.00 - }; - - System.out.println(); - - System.out.println ("\t|--------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| Trade Size Dependence on the Execution Schedule ||"); - - System.out.println ("\t|--------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| L -> R : ||"); - - System.out.println ("\t| Daily Volatility ||"); - - System.out.println ("\t| Execution Time Nodes ||"); - - System.out.println ("\t| Characteristic Time ||"); - - System.out.println ("\t|--------------------------------------------------------------------------------------------------------------------------------||"); - - for (double dblDailyVolatility : adblDailyVolatility) - VolatilitySensitivity ( - strAssetName, - dblAverageDailyVolume, - dblDailyVolatility, - dblSharesOutstanding, - dblTradeSize - ); - - System.out.println ("\t|--------------------------------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/blacklitterman/DaJagannathan2005a.java b/org/drip/sample/blacklitterman/DaJagannathan2005a.java deleted file mode 100644 index 42c29c2..0000000 --- a/org/drip/sample/blacklitterman/DaJagannathan2005a.java +++ /dev/null @@ -1,301 +0,0 @@ - -package org.drip.sample.blacklitterman; - -import org.drip.measure.bayesian.*; -import org.drip.measure.continuousjoint.MultivariateMeta; -import org.drip.measure.gaussian.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DaJagannathan2005a reconciles the Outputs of the Black-Litterman Model Process. The References are: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * - Da, Z., and R. Jagannathan (2005): https://www3.nd.edu/~zda/TeachingNote_Black-Litterman.pdf - * - * @author Lakshmi Krishnamurthy - */ - -public class DaJagannathan2005a { - - public static final void main ( - final String[] astArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetID = new String[] { - "A", - "B", - "C" - }; - - double[] adblAssetExcessReturns = new double[] { - 0.01, - 0.01, - 0.01 - }; - - double[][] aadblAssetExcessReturnsCovariance = new double[][] { - {0.00091, 0.00030, 0.00060}, - {0.00030, 0.00011, 0.00020}, - {0.00060, 0.00020, 0.00041} - }; - - double[][] aadblAssetSpaceViewProjection = new double[][] { - {1.000, -1.000, 0.000} - }; - - double dblTau = 1.00; - double dblDelta = 1.00; - - double[] adblProjectionExpectedExcessReturns = new double[] { - 0.02 - }; - - double[][] aadblProjectionExcessReturnsCovariance = new double[][] { - {0.0001} - }; - - double[] adblAssetSpaceJointReturnsReconciler = new double[] { - 0.0335, - 0.0173, - 0.0254 - }; - - R1MultivariateNormal viewDistribution = R1MultivariateNormal.Standard ( - new MultivariateMeta (new String[] {"DJVIEW"}), - adblProjectionExpectedExcessReturns, - aadblProjectionExcessReturnsCovariance - ); - - R1MultivariateNormal r1mnScoping = R1MultivariateNormal.Standard ( - new MultivariateMeta (astrAssetID), - adblAssetExcessReturns, - aadblAssetExcessReturnsCovariance - ); - - ScopingProjectionVariateDistribution spvd = new ScopingProjectionVariateDistribution (r1mnScoping); - - spvd.addProjectionDistributionLoading ( - "VIEW", - new ProjectionDistributionLoading ( - viewDistribution, - aadblAssetSpaceViewProjection - ) - ); - - JointPosteriorMetrics jpm = TheilMixedEstimationModel.GenerateComposite ( - spvd, - "VIEW", - r1mnScoping - ); - - R1MultivariateNormal jointDistribution = (R1MultivariateNormal) jpm.joint(); - - R1MultivariateNormal posteriorDistribution = (R1MultivariateNormal) jpm.posterior(); - - double[] adblAssetSpaceJointReturns = jointDistribution.mean(); - - double[][] aadblAssetSpaceJointCovariance = jointDistribution.covariance().covarianceMatrix(); - - double[][] aadblAssetSpacePosteriorCovariance = posteriorDistribution.covariance().covarianceMatrix(); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| TAU => " + FormatUtil.FormatDouble (dblTau, 1, 8, 1.) + " ||"); - - System.out.println ("\t| DELTA => " + FormatUtil.FormatDouble (dblDelta, 1, 8, 1.) + " ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| PRIOR CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetExcessReturnsCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| VIEW SCOPING ASSET PROJECTION LOADING ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < aadblAssetSpaceViewProjection.length; ++i) { - String strDump = "\t| #" + i + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpaceViewProjection[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < aadblAssetSpaceViewProjection.length; ++i) { - String strDump = "\t| #" + i + " "; - - for (int j = 0; j < aadblAssetSpaceViewProjection.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblProjectionExcessReturnsCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "|" + FormatUtil.FormatDouble (adblProjectionExpectedExcessReturns[i], 1, 2, 100.) + "%"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| JOINT CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpaceJointCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| POSTERIOR CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpacePosteriorCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| JOINT/POSTERIOR RETURN ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => RIOC | DJ05 ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < adblAssetSpaceJointReturnsReconciler.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] => " + - FormatUtil.FormatDouble (adblAssetSpaceJointReturns[i], 1, 2, 100.) + "% |" + - FormatUtil.FormatDouble (adblAssetSpaceJointReturnsReconciler[i], 1, 2, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||"); - } -} diff --git a/org/drip/sample/blacklitterman/DaJagannathan2005b.java b/org/drip/sample/blacklitterman/DaJagannathan2005b.java deleted file mode 100644 index 89ef051..0000000 --- a/org/drip/sample/blacklitterman/DaJagannathan2005b.java +++ /dev/null @@ -1,301 +0,0 @@ - -package org.drip.sample.blacklitterman; - -import org.drip.measure.bayesian.*; -import org.drip.measure.continuousjoint.MultivariateMeta; -import org.drip.measure.gaussian.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DaJagannathan2005b reconciles the Outputs of the Black-Litterman Model Process. The References are: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * - Da, Z., and R. Jagannathan (2005): https://www3.nd.edu/~zda/TeachingNote_Black-Litterman.pdf - * - * @author Lakshmi Krishnamurthy - */ - -public class DaJagannathan2005b { - - public static final void main ( - final String[] astArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetID = new String[] { - "A", - "B", - "C" - }; - - double[] adblAssetExcessReturns = new double[] { - 0.01, - 0.01, - 0.01 - }; - - double[][] aadblAssetExcessReturnsCovariance = new double[][] { - {0.00091, 0.00030, 0.00060}, - {0.00030, 0.00011, 0.00020}, - {0.00060, 0.00020, 0.00041} - }; - - double[][] aadblAssetSpaceViewProjection = new double[][] { - {1.000, -1.000, 0.000} - }; - - double dblTau = 1.00; - double dblDelta = 1.00; - - double[] adblProjectionExpectedExcessReturns = new double[] { - 0.02 - }; - - double[][] aadblProjectionExcessReturnsCovariance = new double[][] { - {0.00000001} - }; - - double[] adblAssetSpaceJointReturnsReconciler = new double[] { - 0.0390, - 0.0190, - 0.0290 - }; - - R1MultivariateNormal viewDistribution = R1MultivariateNormal.Standard ( - new MultivariateMeta (new String[] {"DJVIEW"}), - adblProjectionExpectedExcessReturns, - aadblProjectionExcessReturnsCovariance - ); - - R1MultivariateNormal r1mnScoping = R1MultivariateNormal.Standard ( - new MultivariateMeta (astrAssetID), - adblAssetExcessReturns, - aadblAssetExcessReturnsCovariance - ); - - ScopingProjectionVariateDistribution spvd = new ScopingProjectionVariateDistribution (r1mnScoping); - - spvd.addProjectionDistributionLoading ( - "VIEW", - new ProjectionDistributionLoading ( - viewDistribution, - aadblAssetSpaceViewProjection - ) - ); - - JointPosteriorMetrics jpm = TheilMixedEstimationModel.GenerateComposite ( - spvd, - "VIEW", - r1mnScoping - ); - - R1MultivariateNormal jointDistribution = (R1MultivariateNormal) jpm.joint(); - - R1MultivariateNormal posteriorDistribution = (R1MultivariateNormal) jpm.posterior(); - - double[] adblAssetSpaceJointReturns = jointDistribution.mean(); - - double[][] aadblAssetSpaceJointCovariance = jointDistribution.covariance().covarianceMatrix(); - - double[][] aadblAssetSpacePosteriorCovariance = posteriorDistribution.covariance().covarianceMatrix(); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| TAU => " + FormatUtil.FormatDouble (dblTau, 1, 8, 1.) + " ||"); - - System.out.println ("\t| DELTA => " + FormatUtil.FormatDouble (dblDelta, 1, 8, 1.) + " ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| PRIOR CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetExcessReturnsCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| VIEW SCOPING ASSET PROJECTION LOADING ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < aadblAssetSpaceViewProjection.length; ++i) { - String strDump = "\t| #" + i + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpaceViewProjection[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < aadblAssetSpaceViewProjection.length; ++i) { - String strDump = "\t| #" + i + " "; - - for (int j = 0; j < aadblAssetSpaceViewProjection.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblProjectionExcessReturnsCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "|" + FormatUtil.FormatDouble (adblProjectionExpectedExcessReturns[i], 1, 2, 100.) + "%"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| JOINT CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpaceJointCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| POSTERIOR CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpacePosteriorCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| JOINT/POSTERIOR RETURN ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => RIOC | DJ05 ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < adblAssetSpaceJointReturnsReconciler.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] => " + - FormatUtil.FormatDouble (adblAssetSpaceJointReturns[i], 1, 2, 100.) + "% |" + - FormatUtil.FormatDouble (adblAssetSpaceJointReturnsReconciler[i], 1, 2, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||"); - } -} diff --git a/org/drip/sample/blacklitterman/DaJagannathan2005c.java b/org/drip/sample/blacklitterman/DaJagannathan2005c.java deleted file mode 100644 index 161a5e5..0000000 --- a/org/drip/sample/blacklitterman/DaJagannathan2005c.java +++ /dev/null @@ -1,301 +0,0 @@ - -package org.drip.sample.blacklitterman; - -import org.drip.measure.bayesian.*; -import org.drip.measure.continuousjoint.MultivariateMeta; -import org.drip.measure.gaussian.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DaJagannathan2005c reconciles the Outputs of the Black-Litterman Model Process. The References are: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * - Da, Z., and R. Jagannathan (2005): https://www3.nd.edu/~zda/TeachingNote_Black-Litterman.pdf - * - * @author Lakshmi Krishnamurthy - */ - -public class DaJagannathan2005c { - - public static final void main ( - final String[] astArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetID = new String[] { - "A", - "B", - "C" - }; - - double[] adblAssetExcessReturns = new double[] { - 0.01, - 0.01, - 0.01 - }; - - double[][] aadblAssetExcessReturnsCovariance = new double[][] { - {0.00091, 0.00030, 0.00060}, - {0.00030, 0.00011, 0.00020}, - {0.00060, 0.00020, 0.00041} - }; - - double[][] aadblAssetSpaceViewProjection = new double[][] { - {1.000, -1.000, 0.000} - }; - - double dblTau = 1.00; - double dblDelta = 1.00; - - double[] adblProjectionExpectedExcessReturns = new double[] { - 0.02 - }; - - double[][] aadblProjectionExcessReturnsCovariance = new double[][] { - {0.00001} - }; - - double[] adblAssetSpaceJointReturnsReconciler = new double[] { - 0.0384, - 0.0188, - 0.0286 - }; - - R1MultivariateNormal viewDistribution = R1MultivariateNormal.Standard ( - new MultivariateMeta (new String[] {"DJVIEW"}), - adblProjectionExpectedExcessReturns, - aadblProjectionExcessReturnsCovariance - ); - - R1MultivariateNormal r1mnScoping = R1MultivariateNormal.Standard ( - new MultivariateMeta (astrAssetID), - adblAssetExcessReturns, - aadblAssetExcessReturnsCovariance - ); - - ScopingProjectionVariateDistribution spvd = new ScopingProjectionVariateDistribution (r1mnScoping); - - spvd.addProjectionDistributionLoading ( - "VIEW", - new ProjectionDistributionLoading ( - viewDistribution, - aadblAssetSpaceViewProjection - ) - ); - - JointPosteriorMetrics jpm = TheilMixedEstimationModel.GenerateComposite ( - spvd, - "VIEW", - r1mnScoping - ); - - R1MultivariateNormal jointDistribution = (R1MultivariateNormal) jpm.joint(); - - R1MultivariateNormal posteriorDistribution = (R1MultivariateNormal) jpm.posterior(); - - double[] adblAssetSpaceJointReturns = jointDistribution.mean(); - - double[][] aadblAssetSpaceJointCovariance = jointDistribution.covariance().covarianceMatrix(); - - double[][] aadblAssetSpacePosteriorCovariance = posteriorDistribution.covariance().covarianceMatrix(); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| TAU => " + FormatUtil.FormatDouble (dblTau, 1, 8, 1.) + " ||"); - - System.out.println ("\t| DELTA => " + FormatUtil.FormatDouble (dblDelta, 1, 8, 1.) + " ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| PRIOR CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetExcessReturnsCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| VIEW SCOPING ASSET PROJECTION LOADING ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < aadblAssetSpaceViewProjection.length; ++i) { - String strDump = "\t| #" + i + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpaceViewProjection[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < aadblAssetSpaceViewProjection.length; ++i) { - String strDump = "\t| #" + i + " "; - - for (int j = 0; j < aadblAssetSpaceViewProjection.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblProjectionExcessReturnsCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "|" + FormatUtil.FormatDouble (adblProjectionExpectedExcessReturns[i], 1, 2, 100.) + "%"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| JOINT CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpaceJointCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| POSTERIOR CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpacePosteriorCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| JOINT/POSTERIOR RETURN ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => RIOC | DJ05 ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < adblAssetSpaceJointReturnsReconciler.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] => " + - FormatUtil.FormatDouble (adblAssetSpaceJointReturns[i], 1, 2, 100.) + "% |" + - FormatUtil.FormatDouble (adblAssetSpaceJointReturnsReconciler[i], 1, 2, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||"); - } -} diff --git a/org/drip/sample/blacklitterman/DaJagannathan2005d.java b/org/drip/sample/blacklitterman/DaJagannathan2005d.java deleted file mode 100644 index d42ade9..0000000 --- a/org/drip/sample/blacklitterman/DaJagannathan2005d.java +++ /dev/null @@ -1,254 +0,0 @@ - -package org.drip.sample.blacklitterman; - -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.AssetComponent; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.quant.linearalgebra.Matrix; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DaJagannathan2005d reconciles the Outputs of the Black-Litterman Model Process. The References are: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * - Da, Z., and R. Jagannathan (2005): https://www3.nd.edu/~zda/TeachingNote_Black-Litterman.pdf - * - * @author Lakshmi Krishnamurthy - */ - -public class DaJagannathan2005d { - - public static final void main ( - final String[] astArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrID = new String[] { - "CORPORATE BOND ", - "LONG TERM GOVVIE ", - "MEDIUM TERM GOVVIE ", - "STRONG BUY EQUITY ", - "BUY EQUITY ", - "NEUTRAL EQUITY ", - "SELL EQUITY ", - "STRONG SELL EQUITY " - }; - - double[][] aadblHistoricalCovariance = new double[][] { - {0.0050, 0.0047, 0.0024, 0.0036, 0.0023, 0.0031, 0.0032, 0.0030}, - {0.0047, 0.0062, 0.0030, 0.0033, 0.0016, 0.0024, 0.0026, 0.0020}, - {0.0024, 0.0030, 0.0020, 0.0015, 0.0006, 0.0009, 0.0012, 0.0008}, - {0.0036, 0.0033, 0.0015, 0.0468, 0.0354, 0.0371, 0.0379, 0.0414}, - {0.0023, 0.0016, 0.0006, 0.0354, 0.0354, 0.0323, 0.0317, 0.0371}, - {0.0031, 0.0024, 0.0009, 0.0371, 0.0323, 0.0349, 0.0342, 0.0364}, - {0.0032, 0.0026, 0.0012, 0.0379, 0.0317, 0.0342, 0.0432, 0.0384}, - {0.0030, 0.0020, 0.0008, 0.0414, 0.0371, 0.0364, 0.0384, 0.0498} - }; - - double[] adblHistoricalReturn = new double[] { - 0.0595, - 0.0553, - 0.0545, - 0.1302, - 0.1114, - 0.1116, - 0.1217, - 0.1220 - }; - - double[] adblHistoricalOptimalWeight = new double[] { - 0.2154, - -0.5434, - 1.1976, - 0.0624, - 0.0808, - -0.0450, - 0.0472, - -0.0149 - }; - - double[] adblMarketWeight = new double[] { - 0.1667, - 0.0833, - 0.0833, - 0.2206, - 0.1184, - 0.1065, - 0.0591, - 0.1622 - }; - - double[] adblMarketImpliedReturnReconciler = new double[] { - 0.0335, - 0.0332, - 0.0315, - 0.0584, - 0.0539, - 0.0544, - 0.0554, - 0.0585 - }; - - double dblRiskFreeRate = 0.03; - double[] adblAdjustedHistoricalReturn = new double[adblHistoricalReturn.length]; - - for (int i = 0; i < adblHistoricalReturn.length; ++i) - adblAdjustedHistoricalReturn[i] = adblHistoricalReturn[i] - dblRiskFreeRate; - - OptimizationOutput op = new QuadraticMeanVarianceOptimizer().allocate ( - new PortfolioConstructionParameters ( - astrID, - CustomRiskUtilitySettings.RiskTolerant (0.078), - PortfolioEqualityConstraintSettings.FullyInvested() - ), - AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrID, - adblAdjustedHistoricalReturn, - aadblHistoricalCovariance - ) - ) - ); - - AssetComponent[] aAC = op.optimalPortfolio().assets(); - - double[] adblMarketImpliedReturn = Matrix.Product ( - aadblHistoricalCovariance, - adblMarketWeight - ); - - System.out.println ("\n\t|---------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| HISTORICAL COVARIANCE MATRIX ||"); - - System.out.println ("\t|---------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrID.length; ++i) { - String strDump = "\t| " + astrID[i] + " "; - - for (int j = 0; j < astrID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblHistoricalCovariance[i][j], 1, 4, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|---------------------------------------------------------------------------------------------||\n"); - - System.out.println ("\t||---------------------------------||"); - - System.out.println ("\t|| MARKET WEIGHT ||"); - - System.out.println ("\t||---------------------------------||"); - - for (int i = 0; i < adblMarketWeight.length; ++i) - System.out.println ( - "\t|| " + astrID[i] + " => " + - FormatUtil.FormatDouble (adblMarketWeight[i], 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t||---------------------------------||\n"); - - System.out.println ("\t||---------------------------------||"); - - System.out.println ("\t|| HISTORICAL RETURNS ||"); - - System.out.println ("\t||---------------------------------||"); - - for (int i = 0; i < adblHistoricalReturn.length; ++i) - System.out.println ( - "\t|| " + astrID[i] + " => " + - FormatUtil.FormatDouble (adblHistoricalReturn[i], 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t||---------------------------------||"); - - System.out.println ("\n\t||---------------------------------------------||"); - - System.out.println ("\t|| HISTORICAL PARAM OPTIMAL WEIGHTS ||"); - - System.out.println ("\t||---------------------------------------------||"); - - System.out.println ("\t|| ASSET => CALC | PAPER ||"); - - System.out.println ("\t||---------------------------------------------||"); - - for (int i = 0; i < aAC.length; ++i) - System.out.println ( - "\t|| " + astrID[i] + " => " + - FormatUtil.FormatDouble (adblHistoricalOptimalWeight[i], 3, 2, 100.) + "% | " + - FormatUtil.FormatDouble (aAC[i].amount(), 3, 2, 100.) + "% ||" - ); - - System.out.println ("\t||---------------------------------------------||"); - - System.out.println ("\n\t||----------------------------------------||"); - - System.out.println ("\t|| MARKET IMPLIED RETURNS ||"); - - System.out.println ("\t||----------------------------------------||"); - - System.out.println ("\t|| ASSET => CALC | PAPER ||"); - - System.out.println ("\t||----------------------------------------||"); - - for (int i = 0; i < aAC.length; ++i) - System.out.println ( - "\t|| " + astrID[i] + " => " + - FormatUtil.FormatDouble (adblMarketImpliedReturn[i] + dblRiskFreeRate, 1, 2, 100.) + "% |" + - FormatUtil.FormatDouble (adblMarketImpliedReturnReconciler[i], 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t||----------------------------------------||\n"); - } -} diff --git a/org/drip/sample/blacklitterman/DaJagannathan2005e.java b/org/drip/sample/blacklitterman/DaJagannathan2005e.java deleted file mode 100644 index 643431d..0000000 --- a/org/drip/sample/blacklitterman/DaJagannathan2005e.java +++ /dev/null @@ -1,349 +0,0 @@ - -package org.drip.sample.blacklitterman; - -import org.drip.measure.bayesian.JointPosteriorMetrics; -import org.drip.measure.continuousjoint.MultivariateMeta; -import org.drip.measure.gaussian.*; -import org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput; -import org.drip.portfolioconstruction.asset.Portfolio; -import org.drip.portfolioconstruction.bayesian.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DaJagannathan2005e reconciles the Outputs of the Black-Litterman Model Process. The References are: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * - Da, Z., and R. Jagannathan (2005): https://www3.nd.edu/~zda/TeachingNote_Black-Litterman.pdf - * - * @author Lakshmi Krishnamurthy - */ - -public class DaJagannathan2005e { - - public static final void main ( - final String[] astArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblTau = 0.0025; - double dblRiskAversion = 1.0; - double dblRiskFreeRate = 0.03; - - String[] astrAssetID = new String[] { - "CORPORATE BOND ", - "LONG TERM GOVVIE ", - "MEDIUM TERM GOVVIE ", - "STRONG BUY EQUITY ", - "BUY EQUITY ", - "NEUTRAL EQUITY ", - "SELL EQUITY ", - "STRONG SELL EQUITY " - }; - - double[] adblAssetEquilibriumWeight = new double[] { - 0.1667, - 0.0833, - 0.0833, - 0.2206, - 0.1184, - 0.1065, - 0.0591, - 0.1622 - }; - - double[][] aadblAssetExcessReturnsCovariance = new double[][] { - {0.0050, 0.0047, 0.0024, 0.0036, 0.0023, 0.0031, 0.0032, 0.0030}, - {0.0047, 0.0062, 0.0030, 0.0033, 0.0016, 0.0024, 0.0026, 0.0020}, - {0.0024, 0.0030, 0.0020, 0.0015, 0.0006, 0.0009, 0.0012, 0.0008}, - {0.0036, 0.0033, 0.0015, 0.0468, 0.0354, 0.0371, 0.0379, 0.0414}, - {0.0023, 0.0016, 0.0006, 0.0354, 0.0354, 0.0323, 0.0317, 0.0371}, - {0.0031, 0.0024, 0.0009, 0.0371, 0.0323, 0.0349, 0.0342, 0.0364}, - {0.0032, 0.0026, 0.0012, 0.0379, 0.0317, 0.0342, 0.0432, 0.0384}, - {0.0030, 0.0020, 0.0008, 0.0414, 0.0371, 0.0364, 0.0384, 0.0498} - }; - - double[][] aadblAssetSpaceViewProjection = new double[][] { - { 0.00, 0.00, 0.00, 0.33, 0.18, 0.16, 0.09, 0.24}, - { -0.50, -0.25, -0.25, 0.33, 0.18, 0.16, 0.09, 0.24}, - { 0.00, 0.00, 0.00, 1.00, 0.00, 0.00, 0.00, 0.00}, - { 0.00, 0.00, 0.00, 0.00, 1.00, 0.00, 0.00, 0.00}, - { 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 1.00, 0.00}, - { 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 1.00} - }; - - double[] adblProjectionExpectedExcessReturns = new double[] { - 0.0634, - 0.0400, - 0.0834, - 0.0784, - 0.0484, - 0.0434 - }; - - double[][] aadblProjectionExcessReturnsCovariance = new double[][] { - {0.0012, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000}, - {0.0000, 0.0009, 0.0000, 0.0000, 0.0000, 0.0000}, - {0.0000, 0.0000, 0.0009, 0.0000, 0.0000, 0.0000}, - {0.0000, 0.0000, 0.0000, 0.0036, 0.0000, 0.0000}, - {0.0000, 0.0000, 0.0000, 0.0000, 0.0036, 0.0000}, - {0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0009} - }; - - R1MultivariateNormal viewDistribution = R1MultivariateNormal.Standard ( - new MultivariateMeta ( - new String[] { - "PROJECTION #1", - "PROJECTION #2", - "PROJECTION #3", - "PROJECTION #4", - "PROJECTION #5", - "PROJECTION #6" - } - ), - adblProjectionExpectedExcessReturns, - aadblProjectionExcessReturnsCovariance - ); - - double[] adblAssetSpaceJointReturnsReconciler = new double[] { - 0.0336, - 0.0333, - 0.0315, - 0.0614, - 0.0562, - 0.0568, - 0.0577, - 0.0608 - }; - - BlackLittermanCombinationEngine blce = new BlackLittermanCombinationEngine ( - ForwardReverseOptimizationOutput.Reverse ( - Portfolio.Standard ( - astrAssetID, - adblAssetEquilibriumWeight - ), - aadblAssetExcessReturnsCovariance, - dblRiskAversion - ), - new PriorControlSpecification ( - false, - dblRiskFreeRate, - dblTau - ), - new ProjectionSpecification ( - viewDistribution, - aadblAssetSpaceViewProjection - ) - ); - - JointPosteriorMetrics jpm = blce.customConfidenceRun().combinationMetrics(); - - R1MultivariateNormal jointDistribution = (R1MultivariateNormal) jpm.joint(); - - R1MultivariateNormal posteriorDistribution = (R1MultivariateNormal) jpm.posterior(); - - double[] adblAssetSpaceJointReturns = jointDistribution.mean(); - - double[][] aadblAssetSpaceJointCovariance = jointDistribution.covariance().covarianceMatrix(); - - double[][] aadblAssetSpacePosteriorCovariance = posteriorDistribution.covariance().covarianceMatrix(); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| TAU => " + FormatUtil.FormatDouble (dblTau, 1, 8, 1.) + " ||"); - - System.out.println ("\t| DELTA => " + FormatUtil.FormatDouble (dblRiskAversion, 1, 8, 1.) + " ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| PRIOR CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetExcessReturnsCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| VIEW SCOPING ASSET PROJECTION LOADING ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < aadblAssetSpaceViewProjection.length; ++i) { - String strDump = "\t| #" + i + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpaceViewProjection[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < aadblAssetSpaceViewProjection.length; ++i) { - String strDump = "\t| #" + i + " "; - - for (int j = 0; j < aadblAssetSpaceViewProjection.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblProjectionExcessReturnsCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "|" + FormatUtil.FormatDouble (adblProjectionExpectedExcessReturns[i], 1, 2, 100.) + "%"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| JOINT CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpaceJointCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| POSTERIOR CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpacePosteriorCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| JOINT/POSTERIOR RETURN ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => RIOC | HL99 ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < adblAssetSpaceJointReturnsReconciler.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (adblAssetSpaceJointReturns[i], 2, 2, 100.) + "% |" + - FormatUtil.FormatDouble (adblAssetSpaceJointReturnsReconciler[i], 2, 2, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||"); - } -} diff --git a/org/drip/sample/blacklitterman/IdzorekAndrogue2003.java b/org/drip/sample/blacklitterman/IdzorekAndrogue2003.java deleted file mode 100644 index 21f6f73..0000000 --- a/org/drip/sample/blacklitterman/IdzorekAndrogue2003.java +++ /dev/null @@ -1,201 +0,0 @@ - -package org.drip.sample.blacklitterman; - -import org.drip.quant.common.FormatUtil; -import org.drip.quant.linearalgebra.Matrix; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * IdzorekAndrogue2003 reconciles the Outputs of the Black-Litterman Model Process. The References are: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * - Idzorek, T., and J. Androgue (2003): - * https://faculty.fuqua.duke.edu/~charvey/Teaching/BA453_2005/Black%20Litterman.pdf - * - * @author Lakshmi Krishnamurthy - */ - -public class IdzorekAndrogue2003 { - - public static final void main ( - final String[] astArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetClass = new String[] { - "US Bonds ", - "Global Bonds xUSD ", - "World Equity xUS ", - "Emerging Equity ", - "US Large Cap Growth ", - "US Large Cap Value ", - "US Small Cap Growth ", - "US Small Cap Value " - }; - - double[] adblMarketCapitalizationEstimate = new double[] { - 8360741000000., - 11583275710000., - 9212460000000., - 964647000000., - 5217844438500., - 5217844438500., - 459897061500., - 459897061500. - }; - - double dblDelta = 3.37; - - double[][] aadblAssetExcessReturnsCorrelation = new double[][] { - { 0.0014, 0.0015, -0.0008, -0.0017, -0.0010, -0.0007, -0.0015, -0.0006}, - { 0.0015, 0.0076, 0.0026, -0.0006, -0.0013, -0.0003, -0.0002, 0.0005}, - {-0.0008, 0.0026, 0.0251, 0.0292, 0.0208, 0.0147, 0.0248, 0.0134}, - {-0.0017, -0.0006, 0.0292, 0.0663, 0.0359, 0.0244, 0.0490, 0.0268}, - {-0.0010, -0.0013, 0.0208, 0.0359, 0.0468, 0.0283, 0.0520, 0.0260}, - {-0.0007, -0.0003, 0.0147, 0.0244, 0.0283, 0.0252, 0.0314, 0.0215}, - {-0.0015, -0.0002, 0.0248, 0.0490, 0.0520, 0.0314, 0.0809, 0.0411}, - {-0.0006, 0.0005, 0.0134, 0.0268, 0.0260, 0.0215, 0.0411, 0.0276} - }; - - double[] adblMarketCapitalizationWeightReconciler = new double[] { - 0.2016, - 0.2793, - 0.2221, - 0.0233, - 0.1258, - 0.1258, - 0.0111, - 0.0111 - }; - - double[] adblImpliedReturnsReconciler = new double[] { - 0.0008, - 0.0094, - 0.0395, - 0.0537, - 0.0513, - 0.0368, - 0.0612, - 0.0349 - }; - - double dblTotalMarketCapitalization = 0.; - double[] adblMarketCapitalizationWeight = new double[adblMarketCapitalizationEstimate.length]; - - for (int i = 0; i < adblMarketCapitalizationEstimate.length; ++i) - dblTotalMarketCapitalization += adblMarketCapitalizationEstimate[i]; - - for (int i = 0; i < adblMarketCapitalizationEstimate.length; ++i) - adblMarketCapitalizationWeight[i] = adblMarketCapitalizationEstimate[i] / dblTotalMarketCapitalization; - - double[] adblImpliedReturns = Matrix.Product ( - aadblAssetExcessReturnsCorrelation, - adblMarketCapitalizationWeight - ); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CO-VARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetClass.length; ++i) { - String strDump = "\t| " + astrAssetClass[i] + " "; - - for (int j = 0; j < astrAssetClass.length; ++j) - strDump += "| " + FormatUtil.FormatDouble (aadblAssetExcessReturnsCorrelation[i][j], 1, 4, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t||-------------------------------------------------------------||"); - - System.out.println ("\t|| MARKET CAPITALIZATION AND EQUILIBRIUM WEIGHTS ||"); - - System.out.println ("\t||-------------------------------------------------------------||"); - - System.out.println ("\t|| ASSET CLASS => CAPITALIZATION | OUTPUT | PAPER ||"); - - System.out.println ("\t||-------------------------------------------------------------||"); - - for (int i = 0; i < adblMarketCapitalizationEstimate.length; ++i) - System.out.println ( - "\t|| " + astrAssetClass[i] + " => " + - FormatUtil.FormatDouble (adblMarketCapitalizationEstimate[i], 14, 0, 1.) + " | " + - FormatUtil.FormatDouble (adblMarketCapitalizationWeight[i], 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (adblMarketCapitalizationWeightReconciler[i], 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t||-------------------------------------------------------------||\n"); - - System.out.println ("\t||-------------------------------------------||"); - - System.out.println ("\t|| RISK PREMIUM IMPLIED RETURNS ||"); - - System.out.println ("\t||-------------------------------------------||"); - - System.out.println ("\t|| ASSET CLASS => OUTPUT | PAPER ||"); - - System.out.println ("\t||-------------------------------------------||"); - - for (int i = 0; i < adblImpliedReturns.length; ++i) - System.out.println ( - "\t|| " + astrAssetClass[i] + " => " + - FormatUtil.FormatDouble (dblDelta * adblImpliedReturns[i], 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (adblImpliedReturnsReconciler[i], 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t||-------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/blacklitterman/OToole2013.java b/org/drip/sample/blacklitterman/OToole2013.java deleted file mode 100644 index 395678d..0000000 --- a/org/drip/sample/blacklitterman/OToole2013.java +++ /dev/null @@ -1,210 +0,0 @@ - -package org.drip.sample.blacklitterman; - -import org.drip.quant.common.FormatUtil; -import org.drip.quant.linearalgebra.Matrix; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OToole2013 reconciles the Outputs of the Black-Litterman Model Process. The References are: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * - O'Toole, R. (2003): The Black-Litterman Model: The Risk Budgeting Perspective, Journal of Asset - * Management 14 (1) 2-13. - * - * @author Lakshmi Krishnamurthy - */ - -public class OToole2013 { - - - public static final void main ( - final String[] astArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrG7 = new String[] { - "Australia ", - "Canada ", - "France ", - "Germany ", - "Japan ", - "United Kingdom ", - "United States of America " - }; - - double[][] aadblG7ExcessReturnsCorrelation = new double[][] { - {1.000, 0.488, 0.478, 0.515, 0.439, 0.512, 0.491}, - {0.488, 1.000, 0.664, 0.655, 0.310, 0.608, 0.779}, - {0.478, 0.664, 1.000, 0.861, 0.355, 0.783, 0.668}, - {0.515, 0.655, 0.861, 1.000, 0.354, 0.777, 0.653}, - {0.439, 0.310, 0.355, 0.354, 1.000, 0.405, 0.306}, - {0.512, 0.608, 0.783, 0.777, 0.405, 1.000, 0.652}, - {0.491, 0.779, 0.668, 0.653, 0.306, 0.652, 1.000} - }; - - double[] adblG7ExcessReturnsVolatility = new double[] { - 0.160, - 0.203, - 0.248, - 0.271, - 0.210, - 0.200, - 0.187 - }; - - double[] adblG7BenchmarkWeight = new double[] { - 0.016, - 0.022, - 0.052, - 0.055, - 0.116, - 0.124, - 0.615 - }; - - double[] adblG7ImpliedReturnsReconciler = new double[] { - 0.0394, - 0.0692, - 0.0836, - 0.0903, - 0.0430, - 0.0677, - 0.0756 - }; - - double dblDelta = 2.5; - double[][] aadblG7Covariance = new double[astrG7.length][astrG7.length]; - - for (int i = 0; i < astrG7.length; ++i) { - for (int j = 0; j < astrG7.length; ++j) - aadblG7Covariance[i][j] = aadblG7ExcessReturnsCorrelation[i][j] * adblG7ExcessReturnsVolatility[i] * adblG7ExcessReturnsVolatility[j]; - } - - double[] adblG7ImpliedReturns = Matrix.Product ( - aadblG7Covariance, - adblG7BenchmarkWeight - ); - - System.out.println ("\n\t|-----------------------------------------------------------------------------------||"); - - System.out.println ("\t| G7 CORRELATION MATRIX INPUT ||"); - - System.out.println ("\t|-----------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrG7.length; ++i) { - String strDump = "\t| " + astrG7[i] + " "; - - for (int j = 0; j < astrG7.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblG7ExcessReturnsCorrelation[i][j], 1, 3, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|-----------------------------------------------------------------------------------||\n"); - - System.out.println ("\t|-----------------------------------------------------------------------------------||"); - - System.out.println ("\t| G7 COVARIANCE MATRIX INPUT ||"); - - System.out.println ("\t|-----------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrG7.length; ++i) { - String strDump = "\t| " + astrG7[i] + " "; - - for (int j = 0; j < astrG7.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblG7Covariance[i][j], 1, 3, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|-----------------------------------------------------------------------------------||\n"); - - System.out.println ("\t||----------------------------------------------||"); - - System.out.println ("\t|| BENCHMARK WEIGHT AND RETURNS VOLATILITY ||"); - - System.out.println ("\t||----------------------------------------------||"); - - System.out.println ("\t|| ASSET CLASS => WEIGHT | VOL ||"); - - System.out.println ("\t||----------------------------------------------||"); - - for (int i = 0; i < astrG7.length; ++i) - System.out.println ( - "\t|| " + astrG7[i] + " => " + - FormatUtil.FormatDouble (adblG7BenchmarkWeight[i], 2, 1, 100.) + "% | " + - FormatUtil.FormatDouble (adblG7ExcessReturnsVolatility[i], 2, 1, 100.) + "% ||" - ); - - System.out.println ("\t||----------------------------------------------||\n"); - - System.out.println ("\t||----------------------------------------------||"); - - System.out.println ("\t|| RISK PREMIUM IMPLIED RETURNS ||"); - - System.out.println ("\t||----------------------------------------------||"); - - System.out.println ("\t|| ASSET CLASS => OUTPUT | PAPER ||"); - - System.out.println ("\t||----------------------------------------------||"); - - for (int i = 0; i < adblG7ImpliedReturns.length; ++i) - System.out.println ( - "\t|| " + astrG7[i] + " => " + - FormatUtil.FormatDouble (dblDelta * adblG7ImpliedReturns[i], 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (adblG7ImpliedReturnsReconciler[i], 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t||----------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/blacklitterman/Soontornkit2010.java b/org/drip/sample/blacklitterman/Soontornkit2010.java deleted file mode 100644 index 199304e..0000000 --- a/org/drip/sample/blacklitterman/Soontornkit2010.java +++ /dev/null @@ -1,493 +0,0 @@ - -package org.drip.sample.blacklitterman; - -import org.drip.measure.bayesian.JointPosteriorMetrics; -import org.drip.measure.continuousjoint.MultivariateMeta; -import org.drip.measure.gaussian.*; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.Portfolio; -import org.drip.portfolioconstruction.bayesian.*; -import org.drip.quant.common.FormatUtil; -import org.drip.quant.linearalgebra.Matrix; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * Soontornkit2010 reconciles the Outputs of the Black-Litterman Model Process. The References are: - * - * - Soontornkit, S. (2010): The Black-Litterman Approach to Asset Allocation - * http://www.bus.tu.ac.th/uploadPR/%E0%B9%80%E0%B8%AD%E0%B8%81%E0%B8%AA%E0%B8%B2%E0%B8%A3%209%20%E0%B8%A1%E0%B8%B4.%E0%B8%A2.%2053/Black-Litterman_Supakorn.pdf - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * - Da, Z., and R. Jagannathan (2005): https://www3.nd.edu/~zda/TeachingNote_Black-Litterman.pdf - * - * @author Lakshmi Krishnamurthy - */ - -public class Soontornkit2010 { - - public static final void main ( - final String[] astArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblTau = 0.3; - double dblRiskFreeRate = 0.03; - double adblHistoricalBenchmarkReturn = 0.049; - double dblHistoricalLongTermVariance = 0.0152; - - String[] astrID1 = new String[] { - "AGRO & FOOD INDUSTRY ", - "CONSUMER PRODUCTS ", - "FINANCIALS ", - "INDUSTRIALS ", - "PROPERTY & CONSTRUCTION ", - "RESOURCES ", - "SERVICES ", - "TECHNOLOGY " - }; - - String[] astrID2 = new String[] { - "ZRR3Y ", - "AGRO & FOOD INDUSTRY ", - "CONSUMER PRODUCTS ", - "FINANCIALS ", - "INDUSTRIALS ", - "PROPERTY & CONSTRUCTION ", - "RESOURCES ", - "SERVICES ", - "TECHNOLOGY " - }; - - double[] adblMarketCapitalizationEstimate = new double[] { - 1118732., - 143798., - 3136108., - 1727804., - 2096000., - 4497231., - 816320., - 1808058. - }; - - double[][] aadblAssetExcessReturnsCovariance = new double[][] { - { 0.0013, -0.0010, -0.0005, -0.0009, -0.0019, -0.0004, -0.0014, -0.0008, -0.0006}, - {-0.0010, 0.0391, 0.0158, 0.0398, 0.0496, 0.0462, 0.0454, 0.0370, 0.0265}, - {-0.0005, 0.0158, 0.0118, 0.0150, 0.0203, 0.0204, 0.0191, 0.0161, 0.0111}, - {-0.0009, 0.0398, 0.0150, 0.0683, 0.0696, 0.0667, 0.0623, 0.0489, 0.0403}, - {-0.0019, 0.0496, 0.0203, 0.0696, 0.1029, 0.0809, 0.0829, 0.0629, 0.0471}, - {-0.0004, 0.0462, 0.0204, 0.0667, 0.0809, 0.0791, 0.0699, 0.0566, 0.0453}, - {-0.0014, 0.0454, 0.0191, 0.0623, 0.0829, 0.0699, 0.0943, 0.0557, 0.0481}, - {-0.0008, 0.0370, 0.0161, 0.0489, 0.0629, 0.0566, 0.0557, 0.0500, 0.0384}, - {-0.0006, 0.0265, 0.0111, 0.0403, 0.0471, 0.0453, 0.0481, 0.0384, 0.0473} - }; - - double[][] aadblAssetSpaceViewProjection = new double[][] { - { 1.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00}, - { 0.00, 0.00, -1.00, 0.00, 0.00, 0.00, 1.00, 0.00, 0.00}, - { 0.00, 0.00, 0.00, -0.41, 0.49, 0.00, -0.59, 0.00, 0.51} - }; - - double[] adblProjectionExpectedExcessReturns = new double[] { - 0.000, - 0.020, - 0.001 - }; - - double[][] aadblProjectionExcessReturnsCovariance = new double[][] { - {0.0013, 0.0000, 0.0000}, - {0.0000, 0.0679, 0.0000}, - {0.0000, 0.0000, 0.0132} - }; - - double[] adblMarketCapitalizationWeight1Reconciler = new double[] { - 0.07, - 0.01, - 0.20, - 0.11, - 0.14, - 0.29, - 0.05, - 0.12 - }; - - double[] adblMarketCapitalizationWeight2Reconciler = new double[] { - 0.500, - 0.036, - 0.005, - 0.102, - 0.056, - 0.068, - 0.147, - 0.027, - 0.059 - }; - - double[] adblExpectedExcessReturnReconciler = new double[] { - 0.0001, - 0.0221, - 0.0096, - 0.0312, - 0.0397, - 0.0361, - 0.0350, - 0.0280, - 0.0244 - }; - - double[] adblAssetSpaceJointReturnsReconciler = new double[] { - 0.0336, - 0.0333, - 0.0315, - 0.0614, - 0.0562, - 0.0568, - 0.0577, - 0.0608 - }; - - R1MultivariateNormal viewDistribution = R1MultivariateNormal.Standard ( - new MultivariateMeta ( - new String[] { - "PROJECTION #1", - "PROJECTION #2", - "PROJECTION #3" - } - ), - adblProjectionExpectedExcessReturns, - aadblProjectionExcessReturnsCovariance - ); - - double dblRiskAversion = RiskUtilitySettingsEstimator.EquilibriumRiskAversion ( - adblHistoricalBenchmarkReturn, - dblRiskFreeRate, - dblHistoricalLongTermVariance - ); - - double[] adblMarketCapitalizationWeight2 = new double[adblMarketCapitalizationEstimate.length + 1]; - double[] adblMarketCapitalizationWeight1 = new double[adblMarketCapitalizationEstimate.length]; - adblMarketCapitalizationWeight2[0] = 0.50; - double dblTotalMarketCapitalization = 0.; - - for (int i = 0; i < adblMarketCapitalizationEstimate.length; ++i) - dblTotalMarketCapitalization += adblMarketCapitalizationEstimate[i]; - - for (int i = 0; i < adblMarketCapitalizationEstimate.length; ++i) { - adblMarketCapitalizationWeight1[i] = adblMarketCapitalizationEstimate[i] / dblTotalMarketCapitalization; - adblMarketCapitalizationWeight2[i + 1] = 0.5 * adblMarketCapitalizationWeight1[i]; - } - - double[] adblExpectedExcessReturn = Matrix.Product ( - aadblAssetExcessReturnsCovariance, - adblMarketCapitalizationWeight2 - ); - - for (int i = 0; i < adblExpectedExcessReturn.length; ++i) - adblExpectedExcessReturn[i] *= dblRiskAversion; - - BlackLittermanCombinationEngine blce = new BlackLittermanCombinationEngine ( - ForwardReverseOptimizationOutput.Reverse ( - Portfolio.Standard ( - astrID2, - adblMarketCapitalizationWeight2 - ), - aadblAssetExcessReturnsCovariance, - dblRiskAversion - ), - new PriorControlSpecification ( - false, - dblRiskFreeRate, - dblTau - ), - new ProjectionSpecification ( - viewDistribution, - aadblAssetSpaceViewProjection - ) - ); - - JointPosteriorMetrics jpm = blce.customConfidenceRun().combinationMetrics(); - - R1MultivariateNormal jointDistribution = (R1MultivariateNormal) jpm.joint(); - - R1MultivariateNormal posteriorDistribution = (R1MultivariateNormal) jpm.posterior(); - - double[] adblAssetSpaceJointReturns = jointDistribution.mean(); - - double[][] aadblAssetSpaceJointCovariance = jointDistribution.covariance().covarianceMatrix(); - - double[][] aadblAssetSpacePosteriorCovariance = posteriorDistribution.covariance().covarianceMatrix(); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| TAU => " + FormatUtil.FormatDouble (dblTau, 1, 8, 1.) + " ||"); - - System.out.println ("\t| DELTA => " + FormatUtil.FormatDouble (dblRiskAversion, 1, 8, 1.) + " ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t||-------------------------------------------||"); - - System.out.println ("\t|| MARKET CAPITALIZATION RECONCILER #1 ||"); - - System.out.println ("\t||-------------------------------------------||"); - - System.out.println ("\t|| SECTOR => WT. | PAPER ||"); - - System.out.println ("\t||-------------------------------------------||"); - - for (int i = 0; i < adblMarketCapitalizationEstimate.length; ++i) - System.out.println ( - "\t|| " + astrID1[i] + " => " + - FormatUtil.FormatDouble (adblMarketCapitalizationWeight1[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblMarketCapitalizationWeight1Reconciler[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t||-------------------------------------------||\n"); - - System.out.println ("\t||----------------------------------------------||"); - - System.out.println ("\t|| MARKET CAPITALIZATION RECONCILER #2 ||"); - - System.out.println ("\t||----------------------------------------------||"); - - System.out.println ("\t|| SECTOR => WEIGHT | PAPER ||"); - - System.out.println ("\t||----------------------------------------------||"); - - for (int i = 0; i <= adblMarketCapitalizationEstimate.length; ++i) - System.out.println ( - "\t|| " + astrID2[i] + " => " + - FormatUtil.FormatDouble (adblMarketCapitalizationWeight2[i], 2, 1, 100.) + "% | " + - FormatUtil.FormatDouble (adblMarketCapitalizationWeight2Reconciler[i], 2, 1, 100.) + "% ||" - ); - - System.out.println ("\t||----------------------------------------------||\n"); - - System.out.println ("\t||----------------------------------------------||"); - - System.out.println ("\t|| IMPLIED EXCESS RETURN ||"); - - System.out.println ("\t||----------------------------------------------||"); - - System.out.println ("\t|| SECTOR => RETURN | PAPER ||"); - - System.out.println ("\t||----------------------------------------------||"); - - for (int i = 0; i < adblExpectedExcessReturn.length; ++i) - System.out.println ( - "\t|| " + astrID2[i] + " => " + - FormatUtil.FormatDouble (adblExpectedExcessReturn[i], 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (adblExpectedExcessReturnReconciler[i], 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t||----------------------------------------------||\n"); - - System.out.println ("\t||----------------------------------------------||"); - - System.out.println ("\t|| IMPLIED MARKET RETURN ||"); - - System.out.println ("\t||----------------------------------------------||"); - - System.out.println ("\t|| SECTOR => RETURN | PAPER ||"); - - System.out.println ("\t||----------------------------------------------||"); - - for (int i = 0; i < adblExpectedExcessReturn.length; ++i) - System.out.println ( - "\t|| " + astrID2[i] + " => " + - FormatUtil.FormatDouble (adblExpectedExcessReturn[i] + dblRiskFreeRate, 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (adblExpectedExcessReturnReconciler[i] + dblRiskFreeRate, 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t||----------------------------------------------||\n"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| PRIOR CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrID2.length; ++i) - strHeader += " " + astrID2[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrID2.length; ++i) { - String strDump = "\t| " + astrID2[i] + " "; - - for (int j = 0; j < astrID2.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetExcessReturnsCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| VIEW SCOPING ASSET PROJECTION LOADING ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrID2.length; ++i) - strHeader += " " + astrID2[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < aadblAssetSpaceViewProjection.length; ++i) { - String strDump = "\t| #" + i + " "; - - for (int j = 0; j < astrID2.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpaceViewProjection[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < aadblAssetSpaceViewProjection.length; ++i) { - String strDump = "\t| #" + i + " "; - - for (int j = 0; j < aadblAssetSpaceViewProjection.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblProjectionExcessReturnsCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "|" + FormatUtil.FormatDouble (adblProjectionExpectedExcessReturns[i], 1, 2, 100.) + "%"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| JOINT CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrID2.length; ++i) - strHeader += " " + astrID2[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrID2.length; ++i) { - String strDump = "\t| " + astrID2[i] + " "; - - for (int j = 0; j < astrID2.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpaceJointCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| POSTERIOR CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrID2.length; ++i) - strHeader += " " + astrID2[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrID2.length; ++i) { - String strDump = "\t| " + astrID2[i] + " "; - - for (int j = 0; j < astrID2.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpacePosteriorCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| JOINT/POSTERIOR RETURN ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => RIOC | HL99 ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < adblAssetSpaceJointReturnsReconciler.length; ++i) { - System.out.println ( - "\t| [" + astrID2[i] + "] =>" + - FormatUtil.FormatDouble (adblAssetSpaceJointReturns[i], 2, 2, 100.) + "% |" + - FormatUtil.FormatDouble (adblAssetSpaceJointReturnsReconciler[i], 2, 2, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||"); - } -} diff --git a/org/drip/sample/blacklitterman/Yamabe2016.java b/org/drip/sample/blacklitterman/Yamabe2016.java deleted file mode 100644 index 2e70d0e..0000000 --- a/org/drip/sample/blacklitterman/Yamabe2016.java +++ /dev/null @@ -1,388 +0,0 @@ - -package org.drip.sample.blacklitterman; - -import org.drip.measure.bayesian.JointPosteriorMetrics; -import org.drip.measure.continuousjoint.MultivariateMeta; -import org.drip.measure.gaussian.*; -import org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput; -import org.drip.portfolioconstruction.asset.Portfolio; -import org.drip.portfolioconstruction.bayesian.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * Yamabe2016 reconciles the Outputs of the Black-Litterman Model Process. The Reference is: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * @author Lakshmi Krishnamurthy - */ - -public class Yamabe2016 { - - public static final void main ( - final String[] astArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblTau = 1.0000; - double dblRiskAversion = 2.6; - double dblRiskFreeRate = 0.00; - - String[] astrAssetID = new String[] { - "ASSET A ", - "ASSET B ", - "ASSET C ", - "ASSET D ", - "ASSET E ", - "ASSET F " - }; - - double[] adblAssetEquilibriumWeight = new double[] { - 0.2535, - 0.1343, - 0.1265, - 0.1375, - 0.0733, - 0.2749 - }; - - double[][] aadblAssetExcessReturnsCovariance = new double[][] { - {0.00273, 0.00208, 0.00159, 0.00049, 0.00117, 0.00071}, - {0.00208, 0.00277, 0.00130, 0.00046, 0.00111, 0.00056}, - {0.00159, 0.00130, 0.00146, 0.00064, 0.00105, 0.00052}, - {0.00049, 0.00046, 0.00064, 0.00061, 0.00066, 0.00037}, - {0.00117, 0.00111, 0.00105, 0.00066, 0.00139, 0.00066}, - {0.00071, 0.00056, 0.00052, 0.00037, 0.00066, 0.00070} - }; - - double[][] aadblAssetSpaceViewProjection = new double[][] { - { 0.00, 0.00, -1.00, 0.00, 1.00, 0.00}, - { 0.00, 1.00, 0.00, 0.00, -1.00, 0.00}, - { -1.00, 1.00, 1.00, 0.00, 0.00, -1.00} - }; - - double[] adblProjectionExpectedExcessReturns = new double[] { - 0.0002, - 0.0003, - 0.0001 - }; - - double[][] aadblProjectionExcessReturnsCovariance = new double[][] { - { 0.00075, -0.00053, -0.00033}, - {-0.00053, 0.00195, 0.00110}, - {-0.00033, 0.00110, 0.00217} - }; - - R1MultivariateNormal viewDistribution = R1MultivariateNormal.Standard ( - new MultivariateMeta ( - new String[] { - "PROJECTION #1", - "PROJECTION #2", - "PROJECTION #3" - } - ), - adblProjectionExpectedExcessReturns, - aadblProjectionExcessReturnsCovariance - ); - - double[] adblAssetSpacePriorReturnsReconciler = new double[] { - 0.003954, - 0.003540, - 0.002782, - 0.001299, - 0.002476, - 0.001594 - }; - - double[] adblAssetSpaceJointReturnsReconciler = new double[] { - 0.003755, - 0.003241, - 0.002612, - 0.001305, - 0.002559, - 0.001662 - }; - - double[] adblExpectedHistoricalReturns = new double[] { - 0.003559, - 0.000469, - 0.004053, - 0.004527, - 0.000904, - 0.001581 - }; - - BlackLittermanCombinationEngine blce = new BlackLittermanCombinationEngine ( - ForwardReverseOptimizationOutput.Reverse ( - Portfolio.Standard ( - astrAssetID, - adblAssetEquilibriumWeight - ), - aadblAssetExcessReturnsCovariance, - dblRiskAversion - ), - new PriorControlSpecification ( - false, - dblRiskFreeRate, - dblTau - ), - new ProjectionSpecification ( - viewDistribution, - aadblAssetSpaceViewProjection - ) - ); - - JointPosteriorMetrics jpm = blce.customConfidenceRun().combinationMetrics(); - - R1MultivariateNormal priorDistribution = (R1MultivariateNormal) jpm.prior(); - - R1MultivariateNormal jointDistribution = (R1MultivariateNormal) jpm.joint(); - - R1MultivariateNormal posteriorDistribution = (R1MultivariateNormal) jpm.posterior(); - - double[] adblAssetSpacePriorReturns = priorDistribution.mean(); - - double[] adblAssetSpaceJointReturns = jointDistribution.mean(); - - double[][] aadblAssetSpaceJointCovariance = jointDistribution.covariance().covarianceMatrix(); - - double[][] aadblAssetSpacePosteriorCovariance = posteriorDistribution.covariance().covarianceMatrix(); - - System.out.println ("\n\t|-------------------------||"); - - System.out.println ("\t| TAU =>" + FormatUtil.FormatDouble (dblTau, 1, 2, 1.) + " ||"); - - System.out.println ("\t| RISK AVERSION =>" + FormatUtil.FormatDouble (dblRiskAversion, 1, 2, 1.) + " ||"); - - System.out.println ("\t| RISK FREE RATE =>" + FormatUtil.FormatDouble (dblRiskFreeRate, 1, 2, 1.) + "% ||"); - - System.out.println ("\t|-------------------------||"); - - System.out.println ("\n\t|----------------------------------------------------------------------------------------||"); - - System.out.println ("\t| PRIOR CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|----------------------------------------------------------------------------------------||"); - - String strHeader = "\t| ID |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|----------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetExcessReturnsCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|----------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|-----------------------------------------------------------------------------------||"); - - System.out.println ("\t| VIEW SCOPING ASSET PROJECTION LOADING ||"); - - System.out.println ("\t|-----------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|-----------------------------------------------------------------------------------||"); - - for (int i = 0; i < aadblAssetSpaceViewProjection.length; ++i) { - String strDump = "\t| #" + i + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpaceViewProjection[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|-----------------------------------------------------------------------------------||\n"); - - System.out.println ("\t|----------------------------------------------------||"); - - for (int i = 0; i < aadblAssetSpaceViewProjection.length; ++i) { - String strDump = "\t| #" + i + " "; - - for (int j = 0; j < aadblAssetSpaceViewProjection.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblProjectionExcessReturnsCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "|" + FormatUtil.FormatDouble (adblProjectionExpectedExcessReturns[i], 1, 2, 100.) + "% ||"); - } - - System.out.println ("\t|----------------------------------------------------||"); - - System.out.println ("\n\t|----------------------------------------------------------------------------------------||"); - - System.out.println ("\t| JOINT CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|----------------------------------------------------------------------------------------||"); - - strHeader = "\t| ID |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|----------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpaceJointCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|----------------------------------------------------------------------------------------||\n"); - - System.out.println ("\t|----------------------------------------------------------------------------------------||"); - - System.out.println ("\t| POSTERIOR CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|----------------------------------------------------------------------------------------||"); - - strHeader = "\t| ID |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|----------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpacePosteriorCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|----------------------------------------------------------------------------------------||\n"); - - System.out.println ("\t|---------------------------------||"); - - System.out.println ("\t| IMPLIED/PRIOR RETURN ||"); - - System.out.println ("\t|---------------------------------||"); - - System.out.println ("\t| ID => RIOCEE | YAMABE ||"); - - System.out.println ("\t|---------------------------------||"); - - for (int i = 0; i < adblAssetSpacePriorReturns.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (adblAssetSpacePriorReturns[i], 1, 4, 100.) + "% |" + - FormatUtil.FormatDouble (adblAssetSpacePriorReturnsReconciler[i], 1, 4, 100.) + "% ||" - ); - } - - System.out.println ("\t|---------------------------------||\n"); - - System.out.println ("\t|---------------------------------||"); - - System.out.println ("\t| JOINT/POSTERIOR RETURN ||"); - - System.out.println ("\t|---------------------------------||"); - - System.out.println ("\t| ID => RIOCEE | YAMABE ||"); - - System.out.println ("\t|---------------------------------||"); - - for (int i = 0; i < adblAssetSpaceJointReturnsReconciler.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (adblAssetSpaceJointReturns[i], 1, 4, 100.) + "% |" + - FormatUtil.FormatDouble (adblAssetSpaceJointReturnsReconciler[i], 1, 4, 100.) + "% ||" - ); - } - - System.out.println ("\t|---------------------------------||\n"); - - System.out.println ("\t|-------------------------------------------||"); - - System.out.println ("\t| PRIOR/POSTERIOR/HISTORICAL RETURN ||"); - - System.out.println ("\t|-------------------------------------------||"); - - System.out.println ("\t| ID => PRIOR | POST | HIST ||"); - - System.out.println ("\t|-------------------------------------------||"); - - for (int i = 0; i < adblAssetSpaceJointReturnsReconciler.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (adblAssetSpacePriorReturns[i], 1, 4, 100.) + "% |" + - FormatUtil.FormatDouble (adblAssetSpaceJointReturns[i], 1, 4, 100.) + "% |" + - FormatUtil.FormatDouble (adblExpectedHistoricalReturns[i], 1, 4, 100.) + "% ||" - ); - } - - System.out.println ("\t|-------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/bloomberg/CDSO.java b/org/drip/sample/bloomberg/CDSO.java deleted file mode 100644 index b1437a9..0000000 --- a/org/drip/sample/bloomberg/CDSO.java +++ /dev/null @@ -1,491 +0,0 @@ - -package org.drip.sample.bloomberg; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.pricer.CreditPricerParams; -import org.drip.param.valuation.ValuationParams; -import org.drip.pricer.option.BlackScholesAlgorithm; -import org.drip.product.creator.CDSBuilder; -import org.drip.product.definition.CreditDefaultSwap; -import org.drip.product.option.CDSEuropeanOption; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.LatentMarketStateBuilder; -import org.drip.state.creator.ScenarioDeterministicVolatilityBuilder; -import org.drip.state.credit.CreditCurve; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDSO contains the sample demonstrating the replication of Bloomberg's CDSO functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDSO { - - private static final MergedDiscountForwardCurve MarketFundingCurve ( - final JulianDate dtSpot, - final String strCurrency, - final double dblBump) - { - return LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "02D", - "07D", - "14D", - "30D", - "60D" - }, - new double[] { - 0.0017 + dblBump, // 2D - 0.0017 + dblBump, // 7D - 0.0018 + dblBump, // 14D - 0.0020 + dblBump, // 30D - 0.0023 + dblBump // 60D - }, - "ForwardRate", - new double[] { - 0.0027 + dblBump, - 0.0032 + dblBump, - 0.0041 + dblBump, - 0.0054 + dblBump, - 0.0077 + dblBump, - 0.0104 + dblBump, - 0.0134 + dblBump, - 0.0160 + dblBump - }, - "ForwardRate", - new String[] { - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }, - new double[] { - 0.0166 + dblBump, // 4Y - 0.0206 + dblBump, // 5Y - 0.0241 + dblBump, // 6Y - 0.0269 + dblBump, // 7Y - 0.0292 + dblBump, // 8Y - 0.0311 + dblBump, // 9Y - 0.0326 + dblBump, // 10Y - 0.0340 + dblBump, // 11Y - 0.0351 + dblBump, // 12Y - 0.0375 + dblBump, // 15Y - 0.0393 + dblBump, // 20Y - 0.0402 + dblBump, // 25Y - 0.0407 + dblBump, // 30Y - 0.0409 + dblBump, // 40Y - 0.0409 + dblBump // 50Y - }, - "SwapRate" - ); - } - - private static final CreditCurve MarketCreditCurve ( - final JulianDate dtSpot, - final String strCreditCurve, - final String strManifestMeasure, - final MergedDiscountForwardCurve dcFunding, - final double dblBump, - final boolean bDisplay) - throws Exception - { - String[] astrCDSMaturityTenor = new String[] { - "06M", - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "07Y", - "10Y" - }; - - double[] adblCDSParSpread = new double[] { - 100. + dblBump, // 6M - 100. + dblBump, // 1Y - 100. + dblBump, // 2Y - 100. + dblBump, // 3Y - 100. + dblBump, // 4Y - 100. + dblBump, // 5Y - 100. + dblBump, // 7Y - 100. + dblBump // 10Y - }; - - CreditCurve cc = LatentMarketStateBuilder.CreditCurve ( - dtSpot, - strCreditCurve, - astrCDSMaturityTenor, - adblCDSParSpread, - adblCDSParSpread, - strManifestMeasure, - dcFunding - ); - - if (!bDisplay) return cc; - - CreditPricerParams pricerParams = CreditPricerParams.Standard(); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState (dcFunding); - - csqc.setCreditState (cc); - - System.out.println ("\n\t|---------------||"); - - System.out.println ("\t| CREDIT SPREAD ||"); - - System.out.println ("\t|---------------||"); - - for (int i = 0; i < adblCDSParSpread.length; ++i) - System.out.println ( - "\t| " + astrCDSMaturityTenor[i] + " |" + - FormatUtil.FormatDouble ( - CDSBuilder.CreateSNAC ( - dtSpot, - astrCDSMaturityTenor[i], - 0.1, - strCreditCurve - ).measureValue ( - ValuationParams.Spot (dtSpot.julian()), - pricerParams, - csqc, - null, - strManifestMeasure - ), - 3, 3, 1.) + " ||" - ); - - System.out.println ("\t|---------------||"); - - return cc; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2016, - DateUtil.FEBRUARY, - 2 - ); - - JulianDate dtCashPay = DateUtil.CreateFromYMD ( - 2016, - DateUtil.FEBRUARY, - 5 - ); - - String strCurrency = "USD"; - String strCreditCurve = "DB"; - String strCDSForwardTenor = "5Y"; - double dblCDSForwardCoupon = 0.1; - double dblFairPremiumVolatility = 0.3; - String strManifestMeasure = "FairPremium"; - double dblNotional = 10000000.; - double dblCreditBump = 10.; - double dblFundingBump = .0001; - - MergedDiscountForwardCurve dcFunding = MarketFundingCurve ( - dtSpot, - strCurrency, - 0. - ); - - CreditCurve cc = MarketCreditCurve ( - dtSpot, - strCreditCurve, - strManifestMeasure, - dcFunding, - 0., - true - ); - - CreditPricerParams pricerParams = CreditPricerParams.Standard(); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState (dcFunding); - - csqc.setCreditState (cc); - - JulianDate dtEffective = DateUtil.CreateFromYMD ( - 2016, - DateUtil.MARCH, - 20 - ); - - CreditDefaultSwap cdsForward = CDSBuilder.CreateSNAC ( - dtEffective, - strCDSForwardTenor, - dblCDSForwardCoupon, - strCreditCurve - ); - - System.out.println ("\n\t|-------------------------------------|"); - - System.out.println ("\t| UNDERLYING CDS FORWARD |"); - - System.out.println ("\t|-------------------------------------|"); - - System.out.println ("\t| Effective Date : " + cdsForward.effectiveDate()); - - System.out.println ("\t| Maturity Date : " + cdsForward.maturityDate()); - - System.out.println ("\t| Notional : " + FormatUtil.FormatDouble (dblNotional, 1, 0, 1.)); - - System.out.println ("\t| Payment Frequency : " + cdsForward.freq()); - - System.out.println ("\t| Currency : " + cdsForward.payCurrency()); - - System.out.println ("\t|-------------------------------------|\n"); - - csqc.setCustomVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtSpot.julian(), - VolatilityLabel.Standard (CustomLabel.Standard (cdsForward.name() + "_" + strManifestMeasure)), - strCurrency, - dblFairPremiumVolatility - ) - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtCashPay, - strCurrency - ); - - Map mapCDSForwardOutput = cdsForward.value ( - valParams, - pricerParams, - csqc, - null - ); - - double dblStrike = mapCDSForwardOutput.get (strManifestMeasure); - - CDSEuropeanOption cdsOptionPayer = new CDSEuropeanOption ( - cdsForward.name() + "::PAYER_OPT", - cdsForward, - strManifestMeasure, - false, - dblStrike, - null, - new BlackScholesAlgorithm(), - null - ); - - System.out.println ("\n\t|-------------------------------------|"); - - System.out.println ("\t| OPTION PARAMETERS |"); - - System.out.println ("\t|-------------------------------------|"); - - System.out.println ("\t| Payer Swaption? " + true); - - System.out.println ("\t| Exercise Type : " + "European"); - - System.out.println ("\t| Knock Out? " + true); - - System.out.println ("\t| Strike : " + FormatUtil.FormatDouble (dblStrike, 1, 0, 1.)); - - System.out.println ("\t| Start Date : " + dtSpot); - - System.out.println ("\t| Cash Pay Date : " + dtCashPay); - - System.out.println ("\t| Exercise Date : " + cdsOptionPayer.exerciseDate()); - - System.out.println ("\t|-------------------------------------|\n"); - - Map mapPayerOptionOutput = cdsOptionPayer.value ( - valParams, - null, - csqc, - null - ); - - double dblOptionPriceBase = mapPayerOptionOutput.get ("Price") / cdsForward.initialNotional(); - - CreditCurve ccBumpUp = MarketCreditCurve ( - dtSpot, - strCreditCurve, - strManifestMeasure, - dcFunding, - dblCreditBump, - false - ); - - CreditCurve ccBumpDown = MarketCreditCurve ( - dtSpot, - strCreditCurve, - strManifestMeasure, - dcFunding, - -dblCreditBump, - false - ); - - csqc.setCreditState (ccBumpUp); - - Map mapPayerOptionOutputCreditBumpUp = cdsOptionPayer.value ( - valParams, - null, - csqc, - null - ); - - double dblOptionPriceCreditBumpUp = mapPayerOptionOutputCreditBumpUp.get ("Price") / cdsForward.initialNotional(); - - csqc.setCreditState (ccBumpDown); - - Map mapPayerOptionOutputCreditBumpDown = cdsOptionPayer.value ( - valParams, - null, - csqc, - null - ); - - double dblOptionPriceCreditBumpDown = mapPayerOptionOutputCreditBumpDown.get ("Price") / cdsForward.initialNotional(); - - MergedDiscountForwardCurve dcFundingBumpUp = MarketFundingCurve ( - dtSpot, - strCurrency, - dblFundingBump - ); - - csqc.setFundingState (dcFundingBumpUp); - - csqc.setCreditState (cc); - - Map mapPayerOptionOutputFundingBumpUp = cdsOptionPayer.value ( - valParams, - null, - csqc, - null - ); - - double dblOptionPriceFundingBumpUp = mapPayerOptionOutputFundingBumpUp.get ("Price") / cdsForward.initialNotional(); - - MergedDiscountForwardCurve dcFundingBumpDown = MarketFundingCurve ( - dtSpot, - strCurrency, - -dblFundingBump - ); - - csqc.setFundingState (dcFundingBumpDown); - - Map mapPayerOptionOutputFundingBumpDown = cdsOptionPayer.value ( - valParams, - null, - csqc, - null - ); - - double dblOptionPriceFundingBumpDown = mapPayerOptionOutputFundingBumpDown.get ("Price") / cdsForward.initialNotional(); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| OPTION INPUTS AND PRICING |"); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\t| Valuation Date : " + dtSpot); - - System.out.println ("\t| Fair Premium Volatility : " + FormatUtil.FormatDouble (dblFairPremiumVolatility, 1, 3, 100.) + "%"); - - System.out.println ("\t| Option Premium : " + FormatUtil.FormatDouble (dblOptionPriceBase, 1, 5, 100.) + "%"); - - System.out.println ("\t| Option MTM : " + FormatUtil.FormatDouble (dblOptionPriceBase * dblNotional, 1, 2, 1.)); - - System.out.println ("\t| Credit Spread Delta 01 : " + FormatUtil.FormatDouble (0.5 * (dblOptionPriceCreditBumpUp - dblOptionPriceCreditBumpDown) * dblNotional / dblCreditBump, 1, 2, 1.)); - - System.out.println ("\t| Credit Spread Gamma 01 : " + FormatUtil.FormatDouble (0.5 * (dblOptionPriceCreditBumpUp + dblOptionPriceCreditBumpDown - 2. * dblOptionPriceBase) * dblNotional / (dblCreditBump * dblCreditBump), 1, 2, 1.)); - - System.out.println ("\t| Funding Spread Delta 01 : " + FormatUtil.FormatDouble (0.5 * (dblOptionPriceFundingBumpUp - dblOptionPriceFundingBumpDown) * dblNotional / (10000. * dblFundingBump), 1, 2, 1.)); - - System.out.println ("\t| Funding Spread Gamma 01 : " + FormatUtil.FormatDouble (0.5 * (dblOptionPriceFundingBumpUp + dblOptionPriceFundingBumpDown - 2. * dblOptionPriceBase) * dblNotional / (10000. * 10000. * dblFundingBump * dblFundingBump), 1, 2, 1.)); - - System.out.println ("\t| ATM Forward : " + FormatUtil.FormatDouble (mapPayerOptionOutput.get ("ATMManifestMeasure"), 1, 0, 1.)); - - System.out.println ("\t| FPG Delta : " + FormatUtil.FormatDouble (mapPayerOptionOutput.get ("FPGDelta"), 1, 4, 1.)); - - System.out.println ("\t| FPG Gamma : " + FormatUtil.FormatDouble (mapPayerOptionOutput.get ("FPGGamma"), 1, 4, 1.)); - - System.out.println ("\t| FPG Vega : " + FormatUtil.FormatDouble (mapPayerOptionOutput.get ("FPGVega"), 1, 2, 1.)); - - System.out.println ("\t| FPG Theta : " + FormatUtil.FormatDouble (mapPayerOptionOutput.get ("FPGTheta"), 1, 2, 1.)); - - System.out.println ("\t| Vega (1%) : " + FormatUtil.FormatDouble (mapPayerOptionOutput.get ("Vega") / cdsForward.initialNotional() * dblNotional * 0.01, 1, 2, 1.)); - - System.out.println ("\t| Theta : " + FormatUtil.FormatDouble (mapPayerOptionOutput.get ("Theta") / cdsForward.initialNotional() * dblNotional / 365.25, 1, 2, 1.)); - - System.out.println ("\t|-----------------------------------------------|\n"); - } -} diff --git a/org/drip/sample/bloomberg/CDSW.java b/org/drip/sample/bloomberg/CDSW.java deleted file mode 100644 index 956a6cc..0000000 --- a/org/drip/sample/bloomberg/CDSW.java +++ /dev/null @@ -1,518 +0,0 @@ - -package org.drip.sample.bloomberg; - -/* - * Credit Products imports - */ - -import org.drip.analytics.cashflow.*; -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.pricer.CreditPricerParams; -import org.drip.param.valuation.*; -import org.drip.product.definition.*; -import org.drip.product.rates.*; -import org.drip.product.creator.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.credit.CreditCurve; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * CDSW contains the sample demonstrating the replication of Bloomberg's CDSW functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDSW { - private static final java.lang.String FIELD_SEPARATOR = " "; - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Sample demonstrating building of rates curve from cash/future/swaps - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static MergedDiscountForwardCurve BuildRatesCurveFromInstruments ( - final JulianDate dtStart, - final String[] astrCashTenor, - final double[] adblCashRate, - final String[] astrIRSTenor, - final double[] adblIRSRate, - final double dblBump, - final String strCurrency) - throws Exception - { - int iNumDCInstruments = astrCashTenor.length + adblIRSRate.length; - int aiDate[] = new int[iNumDCInstruments]; - double adblRate[] = new double[iNumDCInstruments]; - String astrCalibMeasure[] = new String[iNumDCInstruments]; - double adblCompCalibValue[] = new double[iNumDCInstruments]; - CalibratableComponent aCompCalib[] = new CalibratableComponent[iNumDCInstruments]; - - // Cash Calibration - - JulianDate dtCashEffective = dtStart.addBusDays ( - 1, - strCurrency - ); - - for (int i = 0; i < astrCashTenor.length; ++i) { - astrCalibMeasure[i] = "Rate"; - adblRate[i] = java.lang.Double.NaN; - adblCompCalibValue[i] = adblCashRate[i] + dblBump; - - aCompCalib[i] = SingleStreamComponentBuilder.Deposit ( - dtCashEffective, - new JulianDate (aiDate[i] = dtCashEffective.addTenor (astrCashTenor[i]).julian()), - ForwardLabel.Create ( - strCurrency, - astrCashTenor[i] - ) - ); - } - - // IRS Calibration - - JulianDate dtIRSEffective = dtStart.addBusDays (2, strCurrency); - - for (int i = 0; i < astrIRSTenor.length; ++i) { - astrCalibMeasure[i + astrCashTenor.length] = "Rate"; - adblRate[i + astrCashTenor.length] = java.lang.Double.NaN; - adblCompCalibValue[i + astrCashTenor.length] = adblIRSRate[i] + dblBump; - - aiDate[i + astrCashTenor.length] = dtIRSEffective.addTenor (astrIRSTenor[i]).julian(); - - aCompCalib[i + astrCashTenor.length] = OTCIRS ( - dtIRSEffective, - strCurrency, - astrIRSTenor[i], - 0. - ); - } - - /* - * Build the IR curve from the components, their calibration measures, and their calibration quotes. - */ - - return ScenarioDiscountCurveBuilder.NonlinearBuild ( - dtStart, - strCurrency, - aCompCalib, - adblCompCalibValue, - astrCalibMeasure, - null - ); - } - - /* - * Sample demonstrating creation of credit curve from CDS instruments - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static CreditCurve CreateCreditCurveFromCDS ( - final JulianDate dtStart, - final double[] adblQuote, - final String[] astrTenor, - final String strMeasure, - final MergedDiscountForwardCurve dc, - final double dblRecovery, - final String strCCName, - final double dblStrike, - final double dblBump) - throws Exception - { - String[] astrCalibMeasure = new String[adblQuote.length]; - CreditDefaultSwap[] aCDS = new CreditDefaultSwap[adblQuote.length]; - - for (int i = 0; i < astrTenor.length; ++i) { - aCDS[i] = CDSBuilder.CreateSNAC ( - dtStart, - astrTenor[i], - dblStrike, - strCCName - ); - - astrCalibMeasure[i] = strMeasure; - adblQuote[i] += dblBump; - } - - /* - * Build the credit curve from the CDS instruments and the fair premium - */ - - return ScenarioCreditCurveBuilder.Custom ( - strCCName, - dtStart, - aCDS, - dc, - adblQuote, - astrCalibMeasure, - dblRecovery, - "QuotedSpread".equals (strMeasure) - ); - } - - /* - * Sample demonstrating display of survival probability at the calibration instrument maturities - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void DisplayInstrumentMaturitySurvival ( - final CreditCurve cc) - throws java.lang.Exception - { - CalibratableComponent[] aCDS = cc.calibComp(); - - for (int i = 0; i < aCDS.length; ++i) - System.out.println ( - aCDS[i].maturityDate() + " | " + - cc.manifestMeasure (aCDS[i].primaryCode()) + " | " + - FormatUtil.FormatDouble (1. - cc.survival (aCDS[i].maturityDate()), 1, 3, 1.)); - } - - /* - * Sample demonstrating the creation of a CDS - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static CreditDefaultSwap CreateCDS ( - final JulianDate dtStart, - final String strTenor, - final double dblCoupon, - final String strCCName) - { - return CDSBuilder.CreateSNAC (dtStart, strTenor, dblCoupon, strCCName); - } - - /* - * Sample demonstrating the generation of the full set of CDSW measure - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtCurve = DateUtil.Today(); - - JulianDate dtValue = dtCurve.addDays (1); - - JulianDate dtSettle = dtValue.addBusDays ( - 3, - "USD" - ); - - /* - * Model the USD ISDA Standard Curve - */ - - double dblRecovery = 0.4; - double dblNotional = -10.e+06; - String[] astrCashTenor = new String[] { "1M", "2M", "3M", "6M", "12M"}; - double[] adblCashRate = new double[] {0.001864, 0.002289, 0.002638, 0.003965, 0.006759}; - String[] astrIRSTenor = new String[] { "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", - "8Y", "9Y", "10Y", "12Y", "15Y", "20Y", "25Y", "30Y"}; - double[] adblIRSRate = new double[] {0.004750, 0.007700, 0.011600, 0.015425, 0.018900, 0.021760, - 0.024105, 0.026095, 0.027750, 0.030400, 0.032890, 0.034855, 0.035805, 0.036345}; - - /* - * Build the USD ISDA Standard Curve - */ - - MergedDiscountForwardCurve dc = BuildRatesCurveFromInstruments ( - dtCurve, - astrCashTenor, - adblCashRate, - astrIRSTenor, - adblIRSRate, - 0., - "USD" - ); - - /* - * Build the CDS Instrument Quotes - */ - - String[] astrCDSTenor = new String[] { - "6M", "1Y", "2Y", "3Y", "4Y", "5Y", "7Y", "10Y" - }; - double[] adblCDSParSpread = new double[] { - 60., 68., 88., 102., 121., 138., 168., 188. - }; - - /* - * Build the Base Credit Curve - */ - - CreditCurve cc = CreateCreditCurveFromCDS ( - dtValue, - adblCDSParSpread, - astrCDSTenor, - "FairPremium", - dc, - dblRecovery, - "MS", - 0.01, - 0. - ); - - /* - * Display Survival Probability to the instrument maturities - */ - - DisplayInstrumentMaturitySurvival (cc); - - /* - * Create the CDS to price. Contract Maturity is 6Y. Traded Spread Input is 0.05 (500 bp). - */ - - CreditDefaultSwap cds = CreateCDS ( - dtValue, - "6Y", - 0.05, - "MS" - ); - - ValuationParams valParams = new ValuationParams ( - dtValue, - dtSettle, - "USD" - ); - - CreditPricerParams pricerParams = CreditPricerParams.Standard(); - - System.out.println ("\n---- Valuation Details ----"); - - System.out.println ("Trade Date : " + dtCurve); - - System.out.println ("Cash Settle : " + dtSettle); - - System.out.println ("\n---- CDS Details ----"); - - System.out.println ("Effective : " + cds.effectiveDate()); - - System.out.println ("Maturity : " + cds.maturityDate()); - - /* - * Generate the base CDS Measures - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Credit ( - dc, - cc - ); - - CaseInsensitiveTreeMap mapBaseMeasures = cds.value ( - valParams, - pricerParams, - mktParams, - null - ); - - double dblAccrued = mapBaseMeasures.get ("Accrued") * 100. * dblNotional; - - double dblBaseDirtyPV = mapBaseMeasures.get ("DirtyPV"); - - double dblPrincipal = mapBaseMeasures.get ("Upfront") * 0.01 * dblNotional; - - System.out.println ("\n---- Base CDS Measures ----"); - - System.out.println ("Price : " + FormatUtil.FormatDouble (mapBaseMeasures.get ("Price"), 1, 2, 1.)); - - System.out.println ("Principal : " + FormatUtil.FormatDouble (dblPrincipal, 1, 0, 1.)); - - System.out.println ("Accrued : " + FormatUtil.FormatDouble (dblAccrued, 1, 0, 1.)); - - System.out.println ("Accrual Days : " + FormatUtil.FormatDouble (mapBaseMeasures.get ("AccrualDays"), 1, 0, 1.)); - - System.out.println ("Cash Amount : " + FormatUtil.FormatDouble (dblAccrued + dblPrincipal, 1, 0, 1.)); - - System.out.println ("Repl Spread : " + FormatUtil.FormatDouble (mapBaseMeasures.get ("FairPremium"), 1, 4, 1.)); - - /* - * Build the Bumped 01 Credit Curve - */ - - CreditCurve cc01Bump = CreateCreditCurveFromCDS ( - dtValue, - adblCDSParSpread, - astrCDSTenor, - "FairPremium", - dc, - dblRecovery, - "MS", - 0.01, - 1. - ); - - /* - * Generate the 1 bp flat Credit Curve bumped Measures - */ - - CaseInsensitiveTreeMap mapCreditFlat01Measures = cds.value ( - valParams, - pricerParams, - MarketParamsBuilder.Credit ( - dc, - cc01Bump - ), - null - ); - - double dblCreditFlat01DirtyPV = mapCreditFlat01Measures.get ("DirtyPV"); - - System.out.println ("CS01 : " + FormatUtil.FormatDouble (dblCreditFlat01DirtyPV - dblBaseDirtyPV, 1, 0, 0.01 * dblNotional)); - - /* - * Build the Bumped 01 Rates Curve - */ - - MergedDiscountForwardCurve dc01Bump = BuildRatesCurveFromInstruments ( - dtCurve, - astrCashTenor, - adblCashRate, - astrIRSTenor, - adblIRSRate, - 0.0001, - "USD" - ); - - /* - * Generate the 1 bp flat Rates Curve bumped Measures - */ - - CaseInsensitiveTreeMap mapRatesFlat01Measures = cds.value ( - valParams, - pricerParams, - MarketParamsBuilder.Credit ( - dc01Bump, - cc - ), - null - ); - - double dblRatesFlat01DirtyPV = mapRatesFlat01Measures.get ("DirtyPV"); - - System.out.println ("IR01 : " + FormatUtil.FormatDouble (dblRatesFlat01DirtyPV - dblBaseDirtyPV, 1, 0, 0.01 * dblNotional)); - - /* - * Generates and displays the coupon period details for the bonds - */ - - System.out.println ("\n---- CDS Coupon Flows ----"); - - for (CompositePeriod p : cds.couponPeriods()) - System.out.println ( - DateUtil.YYYYMMDD (p.startDate()) + FIELD_SEPARATOR + - DateUtil.YYYYMMDD (p.endDate()) + FIELD_SEPARATOR + - DateUtil.YYYYMMDD (p.payDate()) + FIELD_SEPARATOR + - FormatUtil.FormatDouble (p.couponDCF(), 1, 3, 1.) + FIELD_SEPARATOR + - FormatUtil.FormatDouble (p.couponDCF(), 1, 2, 0.01 * dblNotional) + FIELD_SEPARATOR + - FormatUtil.FormatDouble (dc.df (p.payDate()), 1, 4, 1.) + FIELD_SEPARATOR + - FormatUtil.FormatDouble (cc.survival (p.payDate()), 1, 4, 1.) - ); - - /* - * Generate the Quoted Spread Based CDS Measures - */ - - CaseInsensitiveTreeMap mapQSMeasures = cds.valueFromQuotedSpread ( - valParams, - pricerParams, - mktParams, - null, - 0.05, - 208. - ); - - System.out.println ("\n---- Quoted Spread CDS Measures ----"); - - System.out.println ("QS Price : " + FormatUtil.FormatDouble (mapQSMeasures.get ("Price"), 1, 2, 1.)); - - System.out.println ("QS Repl Spd : " + FormatUtil.FormatDouble (mapQSMeasures.get ("FairPremium"), 1, 4, 1.)); - } -} diff --git a/org/drip/sample/bloomberg/SWPM.java b/org/drip/sample/bloomberg/SWPM.java deleted file mode 100644 index bad61cb..0000000 --- a/org/drip/sample/bloomberg/SWPM.java +++ /dev/null @@ -1,477 +0,0 @@ - -package org.drip.sample.bloomberg; - -import org.drip.analytics.cashflow.*; -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.*; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * SWPM contains the sample demonstrating the replication of Bloomberg's SWPM functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class SWPM { - private static final String FIELD_SEPARATOR = " "; - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFuture, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFuture]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - aiDay[i] + "D" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFuture, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFuture; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtEffective, - final String strCurrency, - final String[] astrTenor, - final double[] adblCoupon) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[astrTenor.length]; - - for (int i = 0; i < astrTenor.length; ++i) - aCalibComp[i] = OTCIRS ( - dtEffective, - strCurrency, - astrTenor[i], - adblCoupon[i] - ); - - return aCalibComp; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency, - final double dblBump) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] {}, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] {}; // Futures - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.0009875 + dblBump, // 9M - 0.00122 + dblBump, // 1Y - 0.00223 + dblBump, // 18M - 0.00383 + dblBump, // 2Y - 0.00827 + dblBump, // 3Y - 0.01245 + dblBump, // 4Y - 0.01605 + dblBump, // 5Y - 0.02597 + dblBump // 10Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 9M - "SwapRate", // 1Y - "SwapRate", // 18M - "SwapRate", // 2Y - "SwapRate", // 3Y - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate" // 10Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "9M", "1Y", "18M", "2Y", "3Y", "4Y", "5Y", "10Y" - }, - new double[] { - 0.0009875, 0.00122, 0.00223, 0.00383, 0.00827, 0.01245, 0.01605, 0.02597 - } - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - "USD" - ), - aDepositComp, - adblDepositQuote, - null, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - true - ); - } - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtValue = DateUtil.Today(); - - JulianDate dtSettle = dtValue.addBusDays ( - 2, - "USD" - ); - - System.out.println ("\n---- Valuation Details ----\n"); - - System.out.println ("Trade Date : " + dtValue); - - System.out.println ("Settle Date : " + dtSettle); - - double dblCoupon = 0.0187; - double dblFixing = 0.00087; - double dblNotional = 10.e+06; - - /* - * Model the discount curve instrument quotes. Best pulled from Curves #42 in the BBG SWPM "Curves" tab - */ - - /* - * Build the Discount Curve - */ - - MergedDiscountForwardCurve dc = MakeDC ( - dtValue, - "USD", - 0. - ); - - JulianDate dtEffective = dtValue.addBusDays ( - 2, - "USD" - ); - - JulianDate dtMaturity = dtEffective.addTenor ("5Y"); - - /* - * Build the Fixed Receive Stream - */ - - FixFloatComponent swap = OTCIRS ( - dtEffective, - "USD", - "5Y", - 0. - ); - - System.out.println ("\n---- Swap Details ----\n"); - - System.out.println ("Effective: " + dtEffective); - - System.out.println ("Maturity: " + dtMaturity); - - /* - * Set up the base market parameters, including base discount curves and the base fixings - */ - - LatentStateFixingsContainer lsfc = new LatentStateFixingsContainer(); - - ComposableUnitFloatingPeriod cufs = ((ComposableUnitFloatingPeriod) (swap.derivedStream().periods().get (0).periods().get (0))); - - lsfc.add ( - cufs.referenceIndexPeriod().fixingDate(), - swap.derivedStream().forwardLabel(), - dblFixing - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - lsfc - ); - - /* - * Set up the valuation parameters - */ - - ValuationParams valParams = new ValuationParams ( - dtValue, - dtSettle, - "USD" - ); - - /* - * Generate the base scenario measures for the swap - */ - - CaseInsensitiveTreeMap mapSwapCalc = swap.value ( - valParams, - null, - mktParams, - null - ); - - double dblBasePV = mapSwapCalc.get ("PV"); - - double dblBaseFixedDV01 = mapSwapCalc.get ("FixedDV01"); - - System.out.println ("\n---- Swap Output Measures ----\n"); - - System.out.println ("Mkt Val : " + FormatUtil.FormatDouble (dblBasePV, 0, 0, dblNotional)); - - System.out.println ("Par Cpn : " + FormatUtil.FormatDouble (mapSwapCalc.get ("FairPremium"), 1, 5, 100.)); - - System.out.println ("Fixed DV01 : " + FormatUtil.FormatDouble (dblBaseFixedDV01, 0, 0, dblNotional)); - - /* - * Set up the fixings bumped market parameters - these use base discount curve and the bumped fixing - */ - - lsfc.add ( - cufs.referenceIndexPeriod().fixingDate(), - swap.derivedStream().forwardLabel(), - dblFixing + 0.0001 - ); - - CurveSurfaceQuoteContainer mktParamsFixingsBumped = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - lsfc - ); - - /* - * Generate the fixing bumped scenario measures for the swap - */ - - CaseInsensitiveTreeMap mapSwapFixingsBumpedCalc = swap.value ( - valParams, - null, - mktParamsFixingsBumped, - null - ); - - double dblFixingsDV01 = mapSwapFixingsBumpedCalc.get ("PV") - dblBasePV; - - System.out.println ("Fixings DV01 : " + FormatUtil.FormatDouble (dblFixingsDV01, 0, 0, dblNotional)); - - System.out.println ("Total DV01 : " + FormatUtil.FormatDouble (dblBaseFixedDV01 + dblFixingsDV01, 0, 0, dblNotional)); - - /* - * Set up the rate flat bumped market parameters - these use the bumped base discount curve and the base fixing - */ - - MergedDiscountForwardCurve dcBumped = MakeDC ( - dtValue, - "USD", - -0.0001 - ); - - lsfc.add ( - dtEffective, - swap.derivedStream().forwardLabel(), - dblFixing - 0.0001 - ); - - CurveSurfaceQuoteContainer mktParamsRateBumped = MarketParamsBuilder.Create ( - dcBumped, - null, - null, - null, - null, - null, - lsfc - ); - - /* - * Generate the rate flat bumped scenario measures for the swap - */ - - CaseInsensitiveTreeMap mapSwapRateBumpedCalc = swap.value ( - valParams, - null, - mktParamsRateBumped, - null - ); - - System.out.println ("PV01 : " + FormatUtil.FormatDouble (mapSwapRateBumpedCalc.get ("PV") - dblBasePV, 0, 0, dblNotional)); - - /* - * Generate the Swap's fixed cash flows - */ - - System.out.println ("\n---- Fixed Cashflow ----\n"); - - for (CompositePeriod p : swap.referenceStream().cashFlowPeriod()) - System.out.println ( - DateUtil.YYYYMMDD (p.payDate()) + FIELD_SEPARATOR + - DateUtil.YYYYMMDD (p.startDate()) + FIELD_SEPARATOR + - DateUtil.YYYYMMDD (p.endDate()) + FIELD_SEPARATOR + - FormatUtil.FormatDouble (p.couponDCF() * 360, 0, 0, 1.) + FIELD_SEPARATOR + - FormatUtil.FormatDouble (p.couponDCF(), 0, 2, dblCoupon * dblNotional) + FIELD_SEPARATOR + - FormatUtil.FormatDouble (dc.df (p.payDate()), 1, 4, 1.) - ); - - /* - * Generate the Swap's floating cash flows - */ - - System.out.println ("\n---- Floating Cashflow ----\n"); - - for (CompositePeriod p : swap.derivedStream().cashFlowPeriod()) - System.out.println ( - DateUtil.YYYYMMDD (p.payDate()) + FIELD_SEPARATOR + - DateUtil.YYYYMMDD (p.startDate()) + FIELD_SEPARATOR + - DateUtil.YYYYMMDD (p.endDate()) + FIELD_SEPARATOR + - FormatUtil.FormatDouble (p.couponDCF() * 360, 0, 0, 1.) + FIELD_SEPARATOR + - FormatUtil.FormatDouble (dc.df (p.payDate()), 1, 4, 1.) - ); - } -} diff --git a/org/drip/sample/bloomberg/SWPMOIS.java b/org/drip/sample/bloomberg/SWPMOIS.java deleted file mode 100644 index f9e812b..0000000 --- a/org/drip/sample/bloomberg/SWPMOIS.java +++ /dev/null @@ -1,477 +0,0 @@ - -package org.drip.sample.bloomberg; - -import org.drip.analytics.cashflow.*; -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.*; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * SWPM contains the sample demonstrating the replication of Bloomberg's SWPM OIS functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class SWPMOIS { - private static final String FIELD_SEPARATOR = " "; - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFuture, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFuture]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - aiDay[i] + "D" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFuture, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFuture; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtEffective, - final String strCurrency, - final String[] astrTenor, - final double[] adblCoupon) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[astrTenor.length]; - - for (int i = 0; i < astrTenor.length; ++i) - aCalibComp[i] = OTCIRS ( - dtEffective, - strCurrency, - astrTenor[i], - adblCoupon[i] - ); - - return aCalibComp; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency, - final double dblBump) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] {}, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] {}; // Futures - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.0009875 + dblBump, // 9M - 0.00122 + dblBump, // 1Y - 0.00223 + dblBump, // 18M - 0.00383 + dblBump, // 2Y - 0.00827 + dblBump, // 3Y - 0.01245 + dblBump, // 4Y - 0.01605 + dblBump, // 5Y - 0.02597 + dblBump // 10Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 9M - "SwapRate", // 1Y - "SwapRate", // 18M - "SwapRate", // 2Y - "SwapRate", // 3Y - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate" // 10Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "9M", "1Y", "18M", "2Y", "3Y", "4Y", "5Y", "10Y" - }, - new double[] { - 0.0009875, 0.00122, 0.00223, 0.00383, 0.00827, 0.01245, 0.01605, 0.02597 - } - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - "USD" - ), - aDepositComp, - adblDepositQuote, - null, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - true - ); - } - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtValue = DateUtil.Today(); - - JulianDate dtSettle = dtValue.addBusDays ( - 2, - "USD" - ); - - System.out.println ("\n---- Valuation Details ----\n"); - - System.out.println ("Trade Date : " + dtValue); - - System.out.println ("Settle Date : " + dtSettle); - - double dblCoupon = 0.0187; - double dblFixing = 0.00087; - double dblNotional = 10.e+06; - - /* - * Model the discount curve instrument quotes. Best pulled from Curves #42 in the BBG SWPM "Curves" tab - */ - - /* - * Build the Discount Curve - */ - - MergedDiscountForwardCurve dc = MakeDC ( - dtValue, - "USD", - 0. - ); - - JulianDate dtEffective = dtValue.addBusDays ( - 2, - "USD" - ); - - JulianDate dtMaturity = dtEffective.addTenor ("5Y"); - - /* - * Build the Fixed Receive Stream - */ - - FixFloatComponent swap = OTCIRS ( - dtEffective, - "USD", - "5Y", - 0. - ); - - System.out.println ("\n---- Swap Details ----\n"); - - System.out.println ("Effective: " + dtEffective); - - System.out.println ("Maturity: " + dtMaturity); - - /* - * Set up the base market parameters, including base discount curves and the base fixings - */ - - LatentStateFixingsContainer lsfc = new LatentStateFixingsContainer(); - - ComposableUnitFloatingPeriod cufs = ((ComposableUnitFloatingPeriod) (swap.derivedStream().periods().get (0).periods().get (0))); - - lsfc.add ( - cufs.referenceIndexPeriod().fixingDate(), - swap.derivedStream().forwardLabel(), - dblFixing - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - lsfc - ); - - /* - * Set up the valuation parameters - */ - - ValuationParams valParams = new ValuationParams ( - dtValue, - dtSettle, - "USD" - ); - - /* - * Generate the base scenario measures for the swap - */ - - CaseInsensitiveTreeMap mapSwapCalc = swap.value ( - valParams, - null, - mktParams, - null - ); - - double dblBasePV = mapSwapCalc.get ("PV"); - - double dblBaseFixedDV01 = mapSwapCalc.get ("FixedDV01"); - - System.out.println ("\n---- Swap Output Measures ----\n"); - - System.out.println ("Mkt Val : " + FormatUtil.FormatDouble (dblBasePV, 0, 0, dblNotional)); - - System.out.println ("Par Cpn : " + FormatUtil.FormatDouble (mapSwapCalc.get ("FairPremium"), 1, 5, 100.)); - - System.out.println ("Fixed DV01 : " + FormatUtil.FormatDouble (dblBaseFixedDV01, 0, 0, dblNotional)); - - /* - * Set up the fixings bumped market parameters - these use base discount curve and the bumped fixing - */ - - lsfc.add ( - cufs.referenceIndexPeriod().fixingDate(), - swap.derivedStream().forwardLabel(), - dblFixing + 0.0001 - ); - - CurveSurfaceQuoteContainer mktParamsFixingsBumped = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - lsfc - ); - - /* - * Generate the fixing bumped scenario measures for the swap - */ - - CaseInsensitiveTreeMap mapSwapFixingsBumpedCalc = swap.value ( - valParams, - null, - mktParamsFixingsBumped, - null - ); - - double dblFixingsDV01 = mapSwapFixingsBumpedCalc.get ("PV") - dblBasePV; - - System.out.println ("Fixings DV01 : " + FormatUtil.FormatDouble (dblFixingsDV01, 0, 0, dblNotional)); - - System.out.println ("Total DV01 : " + FormatUtil.FormatDouble (dblBaseFixedDV01 + dblFixingsDV01, 0, 0, dblNotional)); - - /* - * Set up the rate flat bumped market parameters - these use the bumped base discount curve and the base fixing - */ - - MergedDiscountForwardCurve dcBumped = MakeDC ( - dtValue, - "USD", - -0.0001 - ); - - lsfc.add ( - dtEffective, - swap.derivedStream().forwardLabel(), - dblFixing - 0.0001 - ); - - CurveSurfaceQuoteContainer mktParamsRateBumped = MarketParamsBuilder.Create ( - dcBumped, - null, - null, - null, - null, - null, - lsfc - ); - - /* - * Generate the rate flat bumped scenario measures for the swap - */ - - CaseInsensitiveTreeMap mapSwapRateBumpedCalc = swap.value ( - valParams, - null, - mktParamsRateBumped, - null - ); - - System.out.println ("PV01 : " + FormatUtil.FormatDouble (mapSwapRateBumpedCalc.get ("PV") - dblBasePV, 0, 0, dblNotional)); - - /* - * Generate the Swap's fixed cash flows - */ - - System.out.println ("\n---- Fixed Cashflow ----\n"); - - for (CompositePeriod p : swap.referenceStream().cashFlowPeriod()) - System.out.println ( - DateUtil.YYYYMMDD (p.payDate()) + FIELD_SEPARATOR + - DateUtil.YYYYMMDD (p.startDate()) + FIELD_SEPARATOR + - DateUtil.YYYYMMDD (p.endDate()) + FIELD_SEPARATOR + - FormatUtil.FormatDouble (p.couponDCF() * 360, 0, 0, 1.) + FIELD_SEPARATOR + - FormatUtil.FormatDouble (p.couponDCF(), 0, 2, dblCoupon * dblNotional) + FIELD_SEPARATOR + - FormatUtil.FormatDouble (dc.df (p.payDate()), 1, 4, 1.) - ); - - /* - * Generate the Swap's floating cash flows - */ - - System.out.println ("\n---- Floating Cashflow ----\n"); - - for (CompositePeriod p : swap.derivedStream().cashFlowPeriod()) - System.out.println ( - DateUtil.YYYYMMDD (p.payDate()) + FIELD_SEPARATOR + - DateUtil.YYYYMMDD (p.startDate()) + FIELD_SEPARATOR + - DateUtil.YYYYMMDD (p.endDate()) + FIELD_SEPARATOR + - FormatUtil.FormatDouble (p.couponDCF() * 360, 0, 0, 1.) + FIELD_SEPARATOR + - FormatUtil.FormatDouble (dc.df (p.payDate()), 1, 4, 1.) - ); - } -} diff --git a/org/drip/sample/bloomberg/SWPM_NEW.java b/org/drip/sample/bloomberg/SWPM_NEW.java deleted file mode 100644 index b7e43e3..0000000 --- a/org/drip/sample/bloomberg/SWPM_NEW.java +++ /dev/null @@ -1,827 +0,0 @@ - -package org.drip.sample.bloomberg; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.CompositePeriodBuilder; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.sample.forward.IBORCurve; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * SWPM_NEW contains the sample demonstrating the replication of Bloomberg's Latest SWPM Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class SWPM_NEW { - - private static final FixFloatComponent OTCOISFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = OvernightFixedFloatContainer.FundConventionFromJurisdiction ( - strCurrency - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - for (int i = 0; i < aiDay.length; ++i) - aDeposit[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - OvernightLabel.Create ( - strCurrency - ) - ); - - return aDeposit; - } - - /* - * Construct the Array of Overnight Index Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OISFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aOIS[i] = OTCOISFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aOIS; - } - - private static final FixFloatComponent[] OISFuturesFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrStartTenor, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOISFutures = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aOISFutures[i] = OTCOISFixFloat ( - dtSpot.addTenor (astrStartTenor[i]), - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aOISFutures; - } - - /* - * Construct the Array of Overnight Index Future Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve OvernightCurve ( - final JulianDate dtSpot, - final String strCurrency, - final String strHeaderComment) - throws Exception - { - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t " + strHeaderComment); - - System.out.println ("\t----------------------------------------------------------------"); - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 3 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0004, 0.0004, 0.0004 // Deposit - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of Short End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - CalibratableComponent[] aShortEndOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "1W", "2W", "3W", "1M" - }, - adblShortEndOISQuote - ); - - /* - * Construct the Short End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisShortEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "OIS_SHORT_END", - aShortEndOISComp, - "SwapRate", - adblShortEndOISQuote - ); - - /* - * Construct the Array of OIS Futures Instruments and their Quotes from the given set of parameters - */ - - double[] adblOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - CalibratableComponent[] aOISFutureComp = OISFuturesFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "1M", "2M", "3M", "4M", "5M" - }, - new java.lang.String[] { - "1M", "1M", "1M", "1M", "1M" - }, - adblOISFutureQuote - ); - - /* - * Construct the OIS Future Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisFutureStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "OIS_FUTURE", - aOISFutureComp, - "SwapRate", - adblOISFutureQuote - ); - - /* - * Construct the Array of Long End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - CalibratableComponent[] aLongEndOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "15M", "18M", "21M", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - adblLongEndOISQuote - ); - - /* - * Construct the Long End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisLongEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "OIS_LONG_END", - aLongEndOISComp, - "SwapRate", - adblLongEndOISQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - oisShortEndStretch, - oisFutureStretch, - oisLongEndStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit and Swap Stretches. - */ - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - MergedDiscountForwardCurve dcOvernight = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - /* - * Cross-Comparison of the Deposit Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t[" + aDepositComp[i].effectiveDate() + " => " + aDepositComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aDepositComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dcOvernight, null, null, null, null, null, null), - null, "Rate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the Short End OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS SHORT END INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aShortEndOISComp.length; ++i) - System.out.println ("\t[" + aShortEndOISComp[i].effectiveDate() + " => " + aShortEndOISComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aShortEndOISComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dcOvernight, null, null, null, null, null, null), - null, "CalibSwapRate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblShortEndOISQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aShortEndOISComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dcOvernight, null, null, null, null, null, null), - null, "FairPremium"), 1, 6, 1.)); - - /* - * Cross-Comparison of the OIS Future Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS FUTURE INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aOISFutureComp.length; ++i) - System.out.println ("\t[" + aOISFutureComp[i].effectiveDate() + " => " + aOISFutureComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aOISFutureComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dcOvernight, null, null, null, null, null, null), - null, "SwapRate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblOISFutureQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aOISFutureComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dcOvernight, null, null, null, null, null, null), - null, "FairPremium"), 1, 6, 1.)); - - /* - * Cross-Comparison of the Long End OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS LONG END INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aLongEndOISComp.length; ++i) - System.out.println ("\t[" + aLongEndOISComp[i].effectiveDate() + " => " + aLongEndOISComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aLongEndOISComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dcOvernight, null, null, null, null, null, null), - null, "CalibSwapRate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblLongEndOISQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aLongEndOISComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dcOvernight, null, null, null, null, null, null), - null, "FairPremium"), 1, 6, 1.)); - - return dcOvernight; - } - - public static final ForwardCurve MakeForwardCurve ( - final JulianDate dtValue, - final MergedDiscountForwardCurve dcOvernight, - final String strForwardTenor) - throws Exception - { - String strCurrency = dcOvernight.currency(); - - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strForwardTenor - ); - - SegmentCustomBuilderControl scbcCubic = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - double[] adblDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - }; - - String[] astrDepositTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - }; - - /* - * Construct the Array of FRAs and their Quotes from the given set of parameters - */ - - double[] adblFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - String[] astrFRATenor = new String[] { - "0D", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - /* - * Construct the Array of Fix-Float Component and their Quotes from the given set of parameters - */ - - double[] adblFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - String[] astrFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - return IBORCurve.CustomIBORBuilderSample ( - dcOvernight, - null, - fri, - scbcCubic, - astrDepositTenor, - adblDepositQuote, - "ForwardRate", - astrFRATenor, - adblFRAQuote, - "ParForwardRate", - astrFixFloatTenor, - adblFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - "---- " + strCurrency + "-LIBOR-" + strForwardTenor + " VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - true - ); - } - - /* - * Construct an array of fix-float swaps from the fixed reference and the xM floater derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent FixFloatSwap ( - final JulianDate dtEffective, - final ForwardLabel fri, - final String strFixedTenor, - final String strMaturityTenor, - final double dblCoupon) - throws Exception - { - String strCurrency = fri.currency(); - - int iTenorInMonths = new Integer (fri.tenor().split ("M")[0]); - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - false, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - fri.tenor(), - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - fri, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 12 / iTenorInMonths, - fri.tenor(), - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - strFixedTenor, - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - dblCoupon, - 0., - strCurrency - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - strFixedTenor, - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.BackwardEdgeDates ( - dtEffective, - dtEffective.addTenor (strMaturityTenor), - strFixedTenor, - null, - CompositePeriodBuilder.SHORT_STUB - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - fri.tenor(), - strMaturityTenor, - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent ffc = new FixFloatComponent ( - fixedStream, - floatingStream, - null - ); - - ffc.setPrimaryCode ("FixFloat: " + strMaturityTenor); - - return ffc; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2015, - DateUtil.MAY, - 15 - ); - - String strCurrency = "USD"; - String strForwardTenor = "3M"; - - MergedDiscountForwardCurve dcOvernight = OvernightCurve ( - dtSpot, - strCurrency, - "OVERNIGHT INDEX RUN RECONCILIATION" - ); - - ForwardCurve fc3M = MakeForwardCurve ( - dtSpot, - dcOvernight, - strForwardTenor - ); - - JulianDate dtEffective = DateUtil.CreateFromYMD ( - 2017, - DateUtil.SEPTEMBER, - 11 - ); - - double dblCoupon = 0.026825; - String strFixedTenor = "6M"; - String strMaturityTenor = "10Y"; - - FixFloatComponent ffcSwap = FixFloatSwap ( - dtEffective, - fc3M.index(), - strFixedTenor, - strMaturityTenor, - dblCoupon - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dcOvernight, - fc3M, - null, - null, - null, - null, - null, - null - ); - - Map mapSwap = ffcSwap.value ( - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - null, - mktParams, - null - ); - - for (Map.Entry me : mapSwap.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + FormatUtil.FormatDouble (me.getValue(), 1, 8, 1.) + " |"); - } -} diff --git a/org/drip/sample/bloomberg/YAS.java b/org/drip/sample/bloomberg/YAS.java deleted file mode 100644 index d0901ef..0000000 --- a/org/drip/sample/bloomberg/YAS.java +++ /dev/null @@ -1,523 +0,0 @@ - -package org.drip.sample.bloomberg; - -/* - * Credit Product imports - */ - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.analytics.daycount.Convention; -import org.drip.analytics.support.*; -import org.drip.market.otc.*; -import org.drip.param.definition.*; -import org.drip.param.valuation.*; -import org.drip.product.definition.*; -import org.drip.product.govvie.TreasuryComponent; -import org.drip.product.params.EmbeddedOptionSchedule; - -/* - * Credit Analytics API imports - */ - -import org.drip.product.rates.*; -import org.drip.param.creator.*; -import org.drip.param.market.*; -import org.drip.param.quote.*; -import org.drip.product.creator.*; -import org.drip.product.credit.BondComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.TreasuryBuilder; -import org.drip.state.creator.*; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.govvie.GovvieCurve; -import org.drip.state.identifier.ForwardLabel; - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * YAS contains the sample demonstrating the replication of Bloomberg's YAS functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class YAS { - private static final String FIELD_SEPARATOR = " "; - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Sample demonstrating building of rates curve from cash/future/swaps - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static MergedDiscountForwardCurve BuildRatesCurveFromInstruments ( - final JulianDate dtStart, - final String[] astrCashTenor, - final double[] adblCashRate, - final String[] astrIRSTenor, - final double[] adblIRSRate, - final double dblBump, - final String strCurrency) - throws Exception - { - int iNumDCInstruments = astrCashTenor.length + adblIRSRate.length; - int aiDate[] = new int[iNumDCInstruments]; - double adblRate[] = new double[iNumDCInstruments]; - String astrCalibMeasure[] = new String[iNumDCInstruments]; - double adblCompCalibValue[] = new double[iNumDCInstruments]; - CalibratableComponent aCompCalib[] = new CalibratableComponent[iNumDCInstruments]; - - // Cash Calibration - - JulianDate dtCashEffective = dtStart.addBusDays ( - 1, - strCurrency - ); - - for (int i = 0; i < astrCashTenor.length; ++i) { - astrCalibMeasure[i] = "Rate"; - adblRate[i] = java.lang.Double.NaN; - adblCompCalibValue[i] = adblCashRate[i] + dblBump; - - aCompCalib[i] = SingleStreamComponentBuilder.Deposit ( - dtCashEffective, - new JulianDate (aiDate[i] = dtCashEffective.addTenor (astrCashTenor[i]).julian()), - ForwardLabel.Create ( - strCurrency, - astrCashTenor[i] - ) - ); - } - - // IRS Calibration - - JulianDate dtIRSEffective = dtStart.addBusDays (2, strCurrency); - - for (int i = 0; i < astrIRSTenor.length; ++i) { - astrCalibMeasure[i + astrCashTenor.length] = "SwapRate"; - adblRate[i + astrCashTenor.length] = java.lang.Double.NaN; - adblCompCalibValue[i + astrCashTenor.length] = adblIRSRate[i] + dblBump; - - aiDate[i + astrCashTenor.length] = dtIRSEffective.addTenor (astrIRSTenor[i]).julian(); - - aCompCalib[i + astrCashTenor.length] = OTCIRS ( - dtIRSEffective, - strCurrency, - astrIRSTenor[i], - 0. - ); - } - - /* - * Build the IR curve from the components, their calibration measures, and their calibration quotes. - */ - - return ScenarioDiscountCurveBuilder.NonlinearBuild ( - dtStart, - strCurrency, - aCompCalib, - adblCompCalibValue, - astrCalibMeasure, - null - ); - } - - /* - * Sample demonstrating creation of simple fixed coupon treasury bond - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final TreasuryComponent Treasury ( - final String strName, - final double dblCoupon, - final JulianDate dt, - final String strTenor) - throws Exception - { - return TreasuryBuilder.FromCode ( - "UST", - dt, - dt.addTenor (strTenor), - dblCoupon - ); - } - - /* - * Sample demonstrating creation of a set of the on-the-run treasury bonds - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final TreasuryComponent[] OTRTreasurySet ( - final JulianDate dt, - final String[] astrTenor, - final double[] adblCoupon) - throws Exception - { - TreasuryComponent aTreasury[] = new TreasuryComponent[astrTenor.length]; - - for (int i = 0; i < astrTenor.length; ++i) - aTreasury[i] = Treasury ( - "TSY" + astrTenor[i] + "ON", - adblCoupon[i], - dt, - astrTenor[i] - ); - - return aTreasury; - } - - /* - * Sample demonstrating building of the treasury discount curve based off the on-the run instruments and their yields - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final GovvieCurve BuildOnTheRunGovvieCurve ( - final JulianDate dt, - final TreasuryComponent[] aTreasury, - final double[] adblYield) - throws Exception - { - return ScenarioGovvieCurveBuilder.CubicPolyShapePreserver ( - "UST", - "UST", - aTreasury[0].currency(), - dt.julian(), - aTreasury, - adblYield, - "Yield" - ); - } - - /* - * Sample demonstrating creation of treasury quotes map - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CaseInsensitiveTreeMap MakeTSYQuotes ( - final String[] astrTSYTenor, - final double[] adblTSYYield) - throws Exception - { - CaseInsensitiveTreeMap mTSYQuotes = new CaseInsensitiveTreeMap(); - - for (int i = 0; i < astrTSYTenor.length; ++i) { - ProductMultiMeasure cmmq = new ProductMultiMeasure(); - - cmmq.addQuote ( - "Yield", - new MultiSided ( - "mid", - adblTSYYield[i], - Double.NaN - ), - true - ); - - mTSYQuotes.put ( - astrTSYTenor[i] + "ON", - cmmq - ); - } - - return mTSYQuotes; - } - - /* - * Sample demonstrating generation of all the YAS measures - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void BondPricerSample() - throws Exception - { - JulianDate dtCurve = DateUtil.Today(); - - JulianDate dtSettle = dtCurve.addBusDays ( - 3, - "USD" - ); - - double dblNotional = 1000000.; - String[] astrCashTenor = new String[] {"3M"}; - double[] adblCashRate = new double[] {0.00276}; - String[] astrIRSTenor = new String[] { "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", - "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y"}; - double[] adblIRSRate = new double[] {0.00367, 0.00533, 0.00843, 0.01238, 0.01609, 0.01926, 0.02191, - 0.02406, 0.02588, 0.02741, 0.02870, 0.02982, 0.03208, 0.03372, 0.03445, 0.03484, 0.03501, 0.03484}; - String[] astrTSYTenor = new String[] { - "1Y", "2Y", "3Y", "5Y", "7Y", "10Y", "30Y" - }; - final double[] adblTSYCoupon = new double[] { - 0.0000, 0.00375, 0.00500, 0.0100, 0.01375, 0.01375, 0.02875 - }; - double[] adblTSYYield = new double[] { - 0.00160, 0.00397, 0.00696, 0.01421, 0.01955, 0.02529, 0.03568 - }; - - MergedDiscountForwardCurve dc = BuildRatesCurveFromInstruments ( - dtCurve, - astrCashTenor, - adblCashRate, - astrIRSTenor, - adblIRSRate, - 0., - "USD" - ); - - TreasuryComponent[] aTSYBond = OTRTreasurySet ( - dtCurve, - astrTSYTenor, - adblTSYCoupon - ); - - /* - * Create the on-the-run treasury discount curve - */ - - GovvieCurve gc = BuildOnTheRunGovvieCurve ( - dtCurve, - aTSYBond, - adblTSYYield - ); - - BondComponent bond = BondBuilder.CreateSimpleFixed ( // Simple Fixed Rate Bond - "TEST", // Name - "USD", // Currency - "", // Empty Credit Curve - 0.054, // Bond Coupon - 2, // Frequency - "30/360", // Day Count - DateUtil.CreateFromYMD ( - 2011, - 4, - 21 - ), // Effective - DateUtil.CreateFromYMD ( - 2021, - 4, - 15 - ), // Maturity - null, // Principal Schedule - null - ); - - int[] aiDate = new int[] { - DateUtil.CreateFromYMD (2016, 3, 1).julian(), - DateUtil.CreateFromYMD (2017, 3, 1).julian(), - DateUtil.CreateFromYMD (2018, 3, 1).julian(), - DateUtil.CreateFromYMD (2019, 3, 1).julian(), - DateUtil.CreateFromYMD (2020, 3, 1).julian() - }; - - double[] adblFactor = new double[] { - 1.045, 1.03, 1.015, 1., 1. - }; - - EmbeddedOptionSchedule eos = new EmbeddedOptionSchedule ( - aiDate, - adblFactor, - false, - 30, - false, - Double.NaN, - "", - Double.NaN - ); - - bond.setEmbeddedCallSchedule (eos); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - gc, - null, - null, - null, - MakeTSYQuotes ( - astrTSYTenor, - adblTSYYield - ), - null - ); - - System.out.println ("\n---- Valuation Details ----"); - - System.out.println ("Trade Date : " + dtCurve); - - System.out.println ("Cash Settle : " + dtSettle); - - System.out.println ("\n--------"); - - ValuationParams valParams = ValuationParams.Spot ( - dtSettle, - 0, - "", - Convention.DATE_ROLL_ACTUAL - ); - - double dblPrice = 0.97828; - - double dblAccrued = bond.accrued ( - valParams.valueDate(), - mktParams - ); - - WorkoutInfo wi = bond.exerciseYieldFromPrice (valParams, mktParams, null, dblPrice); - - double dblTSYSpread = bond.tsySpreadFromPrice (valParams, mktParams, null, wi.date(), wi.factor(), dblPrice); - - double dblGSpread = bond.gSpreadFromPrice (valParams, mktParams, null, wi.date(), wi.factor(), dblPrice); - - double dblISpread = bond.iSpreadFromPrice (valParams, mktParams, null, wi.date(), wi.factor(), dblPrice); - - double dblZSpread = bond.zspreadFromPrice (valParams, mktParams, null, wi.date(), wi.factor(), dblPrice); - - double dblASW = bond.aswFromPrice (valParams, mktParams, null, wi.date(), wi.factor(), dblPrice); - - double dblOAS = bond.oasFromPrice (valParams, mktParams, null, wi.date(), wi.factor(), dblPrice); - - double dblModDur = bond.modifiedDurationFromPrice (valParams, mktParams, null, wi.date(), wi.factor(), dblPrice); - - double dblMacDur = bond.macaulayDurationFromPrice (valParams, mktParams, null, wi.date(), wi.factor(), dblPrice); - - double dblYield01 = bond.yield01FromPrice (valParams, mktParams, null, wi.date(), wi.factor(), dblPrice); - - double dblConvexity = bond.convexityFromPrice (valParams, mktParams, null, wi.date(), wi.factor(), dblPrice); - - System.out.println ("Price : " + FormatUtil.FormatDouble (dblPrice, 1, 3, 100.)); - - System.out.println ("Yield : " + FormatUtil.FormatDouble (wi.yield(), 1, 3, 100.)); - - System.out.println ("Workout Date : " + new JulianDate (wi.date())); - - System.out.println ("Workout Factor : " + FormatUtil.FormatDouble (wi.factor(), 1, 2, 100.)); - - System.out.println ("\n--SPREAD AND YIELD CALCULATIONS--\n"); - - System.out.println ("TSY Spread : " + FormatUtil.FormatDouble (dblTSYSpread, 1, 0, 10000.)); - - System.out.println ("G Spread : " + FormatUtil.FormatDouble (dblGSpread, 1, 0, 10000.)); - - System.out.println ("I Spread : " + FormatUtil.FormatDouble (dblISpread, 1, 0, 10000.)); - - System.out.println ("Z Spread : " + FormatUtil.FormatDouble (dblZSpread, 1, 0, 10000.)); - - System.out.println ("ASW : " + FormatUtil.FormatDouble (dblASW, 1, 0, 10000.)); - - System.out.println ("OAS : " + FormatUtil.FormatDouble (dblOAS, 1, 0, 10000.)); - - System.out.println ("\n--RISK--\n"); - - System.out.println ("Modified Duration : " + FormatUtil.FormatDouble (dblModDur, 1, 2, 10000.)); - - System.out.println ("Macaulay Duration : " + FormatUtil.FormatDouble (dblMacDur, 1, 2, 1.)); - - System.out.println ("Risk : " + FormatUtil.FormatDouble (dblYield01 * 10000., 1, 2, 1.)); - - System.out.println ("Convexity : " + FormatUtil.FormatDouble (dblConvexity, 1, 2, 1000000.)); - - System.out.println ("DV01 : " + FormatUtil.FormatDouble (dblYield01 * dblNotional, 1, 0, 1.)); - - System.out.println ("\n--INVOICE--\n"); - - System.out.println ("Face : " + FormatUtil.FormatDouble (dblNotional, 1, 0, 1.)); - - System.out.println ("Principal : " + FormatUtil.FormatDouble (dblPrice * dblNotional, 1, 2, 1.)); - - System.out.println ("Accrued : " + FormatUtil.FormatDouble (dblAccrued * dblNotional, 1, 2, 1.)); - - System.out.println ("Total : " + FormatUtil.FormatDouble ((dblPrice + dblAccrued) * dblNotional, 1, 2, 1.)); - - System.out.println ("\nCashflow\n--------"); - - for (CompositePeriod p : bond.couponPeriods()) - System.out.println ( - DateUtil.YYYYMMDD (p.startDate()) + FIELD_SEPARATOR + - DateUtil.YYYYMMDD (p.endDate()) + FIELD_SEPARATOR + - DateUtil.YYYYMMDD (p.payDate()) + FIELD_SEPARATOR + - FormatUtil.FormatDouble (p.couponDCF(), 1, 4, 1.) + FIELD_SEPARATOR + - FormatUtil.FormatDouble (dc.df (p.payDate()), 1, 4, 1.) + FIELD_SEPARATOR - ); - } - - public static final void main ( - final String astrArgs[]) - throws Exception - { - // String strConfig = "c:\\Lakshmi\\BondAnal\\Config.xml"; - - EnvManager.InitEnv (""); - - BondPricerSample(); - } -} diff --git a/org/drip/sample/bond/BasketAggregateMeasuresGeneration.java b/org/drip/sample/bond/BasketAggregateMeasuresGeneration.java deleted file mode 100644 index 9eaa564..0000000 --- a/org/drip/sample/bond/BasketAggregateMeasuresGeneration.java +++ /dev/null @@ -1,640 +0,0 @@ - -package org.drip.sample.bond; - -/* - * Credit Product Imports - */ - -import java.util.List; - -import org.drip.analytics.date.*; -import org.drip.analytics.daycount.Convention; -import org.drip.analytics.support.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.pricer.CreditPricerParams; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.credit.*; -import org.drip.product.definition.*; -import org.drip.product.rates.*; -import org.drip.quant.common.*; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * BasketAggregateMeasuresGeneration contains a demo of the bond basket Measure generation Sample. It shows - * the following: - * - * - Build the IR Curve from the Rates' instruments. - * - Build the Component Credit Curve from the CDS instruments. - * - Create the basket market parameters and add the named discount curve and the credit curves to it. - * - Create the bond basket from the component bonds and their weights. - * - Construct the Valuation and the Pricing Parameters. - * - Generate the bond basket measures from the valuation, the pricer, and the market parameters. - * - * @author Lakshmi Krishnamurthy - */ - -public class BasketAggregateMeasuresGeneration { - - private static final FixFloatComponent IRS ( - final JulianDate dtEffective, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - throws Exception - { - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - true, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - dblCoupon, - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - "6M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - strMaturityTenor, - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - strMaturityTenor, - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent irs = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - irs.setPrimaryCode ("IRS." + strMaturityTenor + "." + strCurrency); - - return irs; - } - - /* - * Sample demonstrating creation of a rates curve from instruments - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static MergedDiscountForwardCurve BuildRatesCurveFromInstruments ( - final JulianDate dtStart, - final String[] astrCashTenor, - final double[] adblCashRate, - final String[] astrIRSTenor, - final double[] adblIRSRate, - final double dblBump, - final String strCurrency) - throws Exception - { - int iNumDCInstruments = astrCashTenor.length + adblIRSRate.length; - int aiDate[] = new int[iNumDCInstruments]; - double adblRate[] = new double[iNumDCInstruments]; - String astrCalibMeasure[] = new String[iNumDCInstruments]; - double adblCompCalibValue[] = new double[iNumDCInstruments]; - CalibratableComponent aCompCalib[] = new CalibratableComponent[iNumDCInstruments]; - - // Cash Calibration - - JulianDate dtCashEffective = dtStart.addBusDays (1, strCurrency); - - for (int i = 0; i < astrCashTenor.length; ++i) { - astrCalibMeasure[i] = "Rate"; - adblRate[i] = java.lang.Double.NaN; - adblCompCalibValue[i] = adblCashRate[i] + dblBump; - - aCompCalib[i] = SingleStreamComponentBuilder.Deposit ( - dtCashEffective, - new JulianDate (aiDate[i] = dtCashEffective.addTenor (astrCashTenor[i]).julian()), - ForwardLabel.Create ( - strCurrency, - astrCashTenor[i] - ) - ); - } - - // IRS Calibration - - JulianDate dtIRSEffective = dtStart.addBusDays ( - 2, - strCurrency - ); - - for (int i = 0; i < astrIRSTenor.length; ++i) { - astrCalibMeasure[i + astrCashTenor.length] = "Rate"; - adblRate[i + astrCashTenor.length] = java.lang.Double.NaN; - adblCompCalibValue[i + astrCashTenor.length] = adblIRSRate[i] + dblBump; - - aiDate[i + astrCashTenor.length] = dtIRSEffective.addTenor (astrIRSTenor[i]).julian(); - - aCompCalib[i + astrCashTenor.length] = IRS ( - dtIRSEffective, - strCurrency, - astrIRSTenor[i], - 0. - ); - } - - /* - * Build the IR curve from the components, their calibration measures, and their calibration quotes. - */ - - return ScenarioDiscountCurveBuilder.NonlinearBuild ( - dtStart, - strCurrency, - aCompCalib, - adblCompCalibValue, - astrCalibMeasure, - null - ); - } - - /* - * Sample demonstrating creation of simple fixed coupon treasury bond - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final Bond CreateTSYBond ( - final String strName, - final double dblCoupon, - final JulianDate dt, - final String strTenor) - throws Exception - { - return BondBuilder.CreateSimpleFixed ( // Simple Fixed Rate Bond - strName, // Name - "USD", // Fictitious Treasury Curve Name - "", // Credit Curve - Empty for now - dblCoupon, // Bond Coupon - 2, // Frequency - "Act/Act", // Day Count - dt, // Effective - dt.addTenor (strTenor), // Maturity - null, // Principal Schedule - null - ); - } - - /* - * Sample demonstrating creation of a set of the on-the-run treasury bonds - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final Bond[] CreateOnTheRunTSYBondSet ( - final JulianDate dt, - final String[] astrTenor, - final double[] adblCoupon) - throws Exception - { - Bond aTSYBond[] = new Bond[astrTenor.length]; - - for (int i = 0; i < astrTenor.length; ++i) - aTSYBond[i] = CreateTSYBond ( - "TSY" + astrTenor[i] + "ON", - adblCoupon[i], - dt, - astrTenor[i] - ); - - return aTSYBond; - } - - /* - * Sample demonstrating building of the treasury discount curve based off the on-the run instruments and their yields - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve BuildOnTheRunTSYDiscountCurve ( - final JulianDate dt, - final Bond[] aTSYBond, - final double[] adblTSYYield) - throws Exception - { - String astrCalibMeasure[] = new String[aTSYBond.length]; - - for (int i = 0; i < aTSYBond.length; ++i) - astrCalibMeasure[i] = "Yield"; - - return ScenarioDiscountCurveBuilder.NonlinearBuild ( - dt, - "USD", // Fake curve name to indicate it is a USD TSY curve, not the usual USD curve - aTSYBond, - adblTSYYield, - astrCalibMeasure, - null - ); - } - - /* - * Sample demonstrating creation of the principal factor schedule from date and factor array - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final Array2D MakeFSPrincipal() - throws Exception - { - double[] aiDate = new double[5]; - double[] adblFactor = new double[] {1., 1.0, 1.0, 1.0, 1.0}; - // double[] adblFactor = new double[] {1., 0.9, 0.8, 0.7, 0.6}; - - JulianDate dtEOSStart = DateUtil.Today().addDays (2); - - for (int i = 0; i < 5; ++i) - aiDate[i] = dtEOSStart.addYears (i + 2).julian(); - - return Array2D.FromArray ( - aiDate, - adblFactor - ); - } - - /* - * Sample demonstrating creation of the coupon factor schedule from date and factor array - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final Array2D MakeFSCoupon() - throws Exception - { - double[] aiDate = new double[5]; - double[] adblFactor = new double[] {1., 1.0, 1.0, 1.0, 1.0}; - // double[] adblFactor = new double[] {1., 0.9, 0.8, 0.7, 0.6}; - - JulianDate dtEOSStart = DateUtil.Today().addDays (2); - - for (int i = 0; i < 5; ++i) - aiDate[i] = dtEOSStart.addYears (i + 2).julian(); - - return Array2D.FromArray ( - aiDate, - adblFactor - ); - } - - /* - * Sample demonstrating the creation/usage of the bond basket API - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void BasketBondAPISample() - throws Exception - { - JulianDate dtCurve = DateUtil.CreateFromYMD ( - 2013, - 6, - 27 - ); - - JulianDate dtSettle = DateUtil.CreateFromYMD ( - 2013, - 7, - 1 - ); - - /* - * Build the IR Curve from the Rates' instruments - */ - - String[] astrCashTenor = new String[] {"3M"}; - double[] adblCashRate = new double[] {0.00276}; - String[] astrIRSTenor = new String[] { "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", - "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y"}; - double[] adblIRSRate = new double[] {0.00367, 0.00533, 0.00843, 0.01238, 0.01609, 0.01926, 0.02191, - 0.02406, 0.02588, 0.02741, 0.02870, 0.02982, 0.03208, 0.03372, 0.03445, 0.03484, 0.03501, 0.03484}; - - MergedDiscountForwardCurve dc = BuildRatesCurveFromInstruments (dtCurve, astrCashTenor, adblCashRate, astrIRSTenor, adblIRSRate, 0., "USD"); - - /* - * Construct the set of Treasury instruments (in the case on-the-run set) - */ - - String[] astrTSYTenor = new String[] { - "1Y", "2Y", "3Y", "5Y", "7Y", "10Y", "30Y" - }; - final double[] adblTSYCoupon = new double[] { - 0.0000, 0.00375, 0.00500, 0.0100, 0.01375, 0.01375, 0.02875 - }; - - Bond[] aTSYBond = CreateOnTheRunTSYBondSet ( - dtCurve, - astrTSYTenor, - adblTSYCoupon - ); - - /* - * Build the Treasury Curve from the Treasury instruments and their yields - */ - - double[] adblTSYYield = new double[] { - 0.00160, 0.00397, 0.00696, 0.01421, 0.01955, 0.02529, 0.03568 - }; - - MergedDiscountForwardCurve dcTSY = BuildOnTheRunTSYDiscountCurve ( - dtCurve, - aTSYBond, - adblTSYYield - ); - - /* - * Construct the set of bonds and load them onto the basket - */ - - BondComponent bond1 = BondBuilder.CreateSimpleFixed ( - "TEST1", // Name - "USD", // Currency - "", // Credit Curve - Empty for now - 0.09, // Bond Coupon - 2, // Frequency - "30/360", // Day Count - DateUtil.CreateFromYMD ( - 2011, - 2, - 23 - ), // Effective - DateUtil.CreateFromYMD ( - 2021, - 3, - 1 - ), // Maturity - null, // Principal Schedule - null - ); - - BondComponent bond2 = BondBuilder.CreateSimpleFixed ( // Simple Fixed Rate Bond - "TEST2", // Name - "USD", // Currency - "", // Credit Curve - Empty for now - 0.09, // Bond Coupon - 2, // Frequency - "30/360", // Day Count - DateUtil.CreateFromYMD ( - 2011, - 2, - 23 - ), // Effective - DateUtil.CreateFromYMD ( - 2021, - 3, - 1 - ), // Maturity - null, // Principal Schedule - null - ); - - BondComponent bond3 = BondBuilder.CreateSimpleFixed ( // Simple Fixed Rate Bond - "TEST3", // Name - "USD", // Currency - "", // Credit Curve - Empty for now - 0.09, // Bond Coupon - 2, // Frequency - "30/360", // Day Count - DateUtil.CreateFromYMD ( - 2011, - 2, - 23 - ), // Effective - DateUtil.CreateFromYMD ( - 2021, - 3, - 1 - ), // Maturity - null, // Principal Schedule - null - ); - - BondComponent bond4 = BondBuilder.CreateSimpleFloater ( // Simple Floating Rate Bond - "FLOATER1", // Name - "USD", // Currency - "USD-6M", // Rate Index - "", // Credit Curve - Empty for now - 0.01, // Floating Spread - 2, // Coupon Frequency - "30/360", // Day Count - DateUtil.CreateFromYMD ( - 2008, - 9, - 21 - ), // Effective - DateUtil.CreateFromYMD ( - 2023, - 9, - 20 - ), // Maturity - MakeFSPrincipal(), // Principal Schedule - MakeFSCoupon() // Coupon Schedule - ); - - BasketProduct bb = new BondBasket ( - "TurtlePower", - new Bond[] { - bond1, bond2, bond3, bond4 - }, - new double[] { - 0.1, 0.2, 0.3, 0.4 - } - ); - - /* - * Create the basket market parameters and add the named discount curve and the treasury curves to it. - */ - - CurveSurfaceQuoteContainer mktParams = new CurveSurfaceQuoteContainer(); - - mktParams.setFundingState (dc); - - mktParams.setFundingState (dcTSY); - - /* - * Construct the Valuation and the Pricing Parameters - */ - - ValuationParams valParams = ValuationParams.Spot ( - dtSettle, - 0, - "USD", - Convention.DATE_ROLL_ACTUAL - ); - - CreditPricerParams pricerParams = new CreditPricerParams ( - 7, - null, - false, - CreditPricerParams.PERIOD_DISCRETIZATION_FULL_COUPON - ); - - /* - * Generate the bond basket measures from the valuation, the pricer, and the market parameters - */ - - CaseInsensitiveTreeMap mapResult = bb.value ( - valParams, - pricerParams, - mktParams, - null - ); - - System.out.println ("Clean Price: " + FormatUtil.FormatDouble (mapResult.get ("CleanPrice"), 0, 2, 100.)); - - System.out.println ("Fair Clean Price: " + FormatUtil.FormatDouble (mapResult.get ("FairCleanPrice"), 0, 2, 100.)); - - System.out.println ("Fair Yield: " + FormatUtil.FormatDouble (mapResult.get ("FairYield"), 0, 2, 100.)); - - System.out.println ("Fair GSpread: " + FormatUtil.FormatDouble (mapResult.get ("FairGSpread"), 0, 0, 10000.)); - - System.out.println ("Fair ZSpread: " + FormatUtil.FormatDouble (mapResult.get ("FairZSpread"), 0, 0, 10000.)); - - System.out.println ("Fair ISpread: " + FormatUtil.FormatDouble (mapResult.get ("FairISpread"), 0, 0, 10000.)); - - System.out.println ("Fair Duration: " + FormatUtil.FormatDouble (mapResult.get ("FairDuration"), 0, 2, 10000.)); - - System.out.println ("Accrued: " + FormatUtil.FormatDouble (mapResult.get ("Accrued"), 1, 2, 100.)); - } - - public static final void main ( - final String astrArgs[]) - throws Exception - { - // String strConfig = "c:\\Lakshmi\\BondAnal\\Config.xml"; - - String strConfig = ""; - - EnvManager.InitEnv (strConfig); - - BasketBondAPISample(); - } -} diff --git a/org/drip/sample/bond/CoreCashFlowMeasures.java b/org/drip/sample/bond/CoreCashFlowMeasures.java deleted file mode 100644 index e707ac9..0000000 --- a/org/drip/sample/bond/CoreCashFlowMeasures.java +++ /dev/null @@ -1,1136 +0,0 @@ - -package org.drip.sample.bond; - -/* - * Credit Product imports - */ - -import org.drip.analytics.cashflow.*; -import org.drip.analytics.date.*; -import org.drip.analytics.daycount.Convention; -import org.drip.analytics.support.*; -import org.drip.market.otc.*; -import org.drip.param.definition.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.pricer.CreditPricerParams; -import org.drip.param.quote.MultiSided; -import org.drip.param.quote.ProductMultiMeasure; -import org.drip.param.valuation.*; -import org.drip.product.params.*; -import org.drip.product.rates.*; -import org.drip.product.definition.*; -import org.drip.product.govvie.TreasuryComponent; -import org.drip.param.creator.*; -import org.drip.product.creator.*; -import org.drip.quant.common.*; -import org.drip.service.env.EnvManager; -import org.drip.service.template.TreasuryBuilder; -import org.drip.state.creator.*; -import org.drip.state.credit.CreditCurve; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.govvie.GovvieCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * CoreCashFlowMeasures contains a demo of the Bond Core Measures and the Cash Flow Sample. It generates the - * Core and the RV measures for essentially the same bond (with identical cash flows) constructed in three - * different ways: - * - * - As a fixed rate bond. - * - As a floater. - * - As a bond constructed from a set of custom coupon and principal flows. - * - * It shows these measures reconcile where they should. - * - * @author Lakshmi Krishnamurthy - */ - -public class CoreCashFlowMeasures { - private static final String FIELD_SEPARATOR = " "; - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Sample demonstrating building of rates curve from cash/future/swaps - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static MergedDiscountForwardCurve BuildRatesCurveFromInstruments ( - final JulianDate dtStart, - final String[] astrCashTenor, - final double[] adblCashRate, - final String[] astrIRSTenor, - final double[] adblIRSRate, - final double dblBump, - final String strCurrency) - throws Exception - { - int iNumDCInstruments = astrCashTenor.length + adblIRSRate.length; - int aiDate[] = new int[iNumDCInstruments]; - double adblRate[] = new double[iNumDCInstruments]; - String astrCalibMeasure[] = new String[iNumDCInstruments]; - double adblCompCalibValue[] = new double[iNumDCInstruments]; - CalibratableComponent aCompCalib[] = new CalibratableComponent[iNumDCInstruments]; - - // Cash Calibration - - JulianDate dtCashEffective = dtStart.addBusDays (1, strCurrency); - - for (int i = 0; i < astrCashTenor.length; ++i) { - astrCalibMeasure[i] = "Rate"; - adblRate[i] = java.lang.Double.NaN; - adblCompCalibValue[i] = adblCashRate[i] + dblBump; - - aCompCalib[i] = SingleStreamComponentBuilder.Deposit ( - dtCashEffective, - new JulianDate (aiDate[i] = dtCashEffective.addTenor (astrCashTenor[i]).julian()), - ForwardLabel.Create ( - strCurrency, - astrCashTenor[i] - ) - ); - } - - // IRS Calibration - - JulianDate dtIRSEffective = dtStart.addBusDays ( - 2, - strCurrency - ); - - for (int i = 0; i < astrIRSTenor.length; ++i) { - astrCalibMeasure[i + astrCashTenor.length] = "SwapRate"; - adblRate[i + astrCashTenor.length] = java.lang.Double.NaN; - adblCompCalibValue[i + astrCashTenor.length] = adblIRSRate[i] + dblBump; - - aiDate[i + astrCashTenor.length] = dtIRSEffective.addTenor (astrIRSTenor[i]).julian(); - - aCompCalib[i + astrCashTenor.length] = OTCIRS ( - dtIRSEffective, - strCurrency, - astrIRSTenor[i], - 0. - ); - } - - /* - * Build the IR curve from the components, their calibration measures, and their calibration quotes. - */ - - return ScenarioDiscountCurveBuilder.NonlinearBuild ( - dtStart, - strCurrency, - aCompCalib, - adblCompCalibValue, - astrCalibMeasure, - null - ); - } - - /* - * Sample demonstrating creation of simple fixed coupon treasury bond - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final TreasuryComponent Treasury ( - final String strName, - final double dblCoupon, - final JulianDate dt, - final String strTenor) - throws Exception - { - return TreasuryBuilder.FromCode ( - "UST", - dt, - dt.addTenor (strTenor), - dblCoupon - ); - } - - /* - * Sample demonstrating creation of a set of the on-the-run treasury bonds - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final TreasuryComponent[] OTRTreasurySet ( - final JulianDate dt, - final String[] astrTenor, - final double[] adblCoupon) - throws Exception - { - TreasuryComponent aTreasury[] = new TreasuryComponent[astrTenor.length]; - - for (int i = 0; i < astrTenor.length; ++i) - aTreasury[i] = Treasury ( - "TSY" + astrTenor[i] + "ON", - adblCoupon[i], - dt, - astrTenor[i] - ); - - return aTreasury; - } - - private static final void AccumulateBondMarketQuote ( - final CurveSurfaceQuoteContainer csqc, - final String[] astrOnTheRunCode, - final double[] adblYield) - throws Exception - { - for (int i = 0; i < astrOnTheRunCode.length; ++i) { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Yield", - new MultiSided ( - "mid", - adblYield[i] - ), - true - ); - - csqc.setProductQuote ( - astrOnTheRunCode[i], - pmmq - ); - } - } - - /* - * Sample demonstrating building of the treasury discount curve based off the on-the run instruments and their yields - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final GovvieCurve BuildOnTheRunGovvieCurve ( - final JulianDate dt, - final TreasuryComponent[] aTreasury, - final double[] adblYield) - throws Exception - { - return ScenarioGovvieCurveBuilder.CubicPolyShapePreserver ( - "UST", - "UST", - aTreasury[0].currency(), - dt.julian(), - aTreasury, - adblYield, - "Yield" - ); - } - - /* - * Sample demonstrating creation of discount curve - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDiscountCurve ( - final JulianDate dtCurve) - throws Exception - { - String[] astrCashTenor = new String[] {}; - double[] adblCashRate = new double[] {}; - String[] astrIRSTenor = new String[] { "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", - "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y"}; - double[] adblIRSRate = new double[] {0.00367, 0.00533, 0.00843, 0.01238, 0.01609, 0.01926, 0.02191, - 0.02406, 0.02588, 0.02741, 0.02870, 0.02982, 0.03208, 0.03372, 0.03445, 0.03484, 0.03501, 0.03484}; - - return BuildRatesCurveFromInstruments ( - dtCurve, - astrCashTenor, - adblCashRate, - astrIRSTenor, - adblIRSRate, - 0., - "USD" - ); - } - - /* - * Sample demonstrating creation of the principal factor schedule from date and factor array - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final Array2D MakeFSPrincipal() - throws Exception - { - double[] aiDate = new double[5]; - double[] adblFactor = new double[] {1., 1.0, 1.0, 1.0, 1.0}; - // double[] adblFactor = new double[] {1., 0.9, 0.8, 0.7, 0.6}; - - JulianDate dtEOSStart = DateUtil.Today().addDays (2); - - for (int i = 0; i < 5; ++i) - aiDate[i] = dtEOSStart.addYears (i + 2).julian(); - - return Array2D.FromArray ( - aiDate, - adblFactor - ); - } - - /* - * Sample demonstrating creation of the coupon factor schedule from date and factor array - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final Array2D MakeFSCoupon() - throws Exception - { - double[] aiDate = new double[5]; - double[] adblFactor = new double[] {1., 1.0, 1.0, 1.0, 1.0}; - // double[] adblFactor = new double[] {1., 0.9, 0.8, 0.7, 0.6}; - - JulianDate dtEOSStart = DateUtil.Today().addDays (2); - - for (int i = 0; i < 5; ++i) - aiDate[i] = dtEOSStart.addYears (i + 2).julian(); - - return Array2D.FromArray ( - aiDate, - adblFactor - ); - } - - /* - * Sample creates a custom named bond from the bond type and parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final Bond CreateCustomBond ( - final String strName, - final String strCreditCurve, - final int iBondType) - throws Exception - { - BondProduct bond = null; - boolean bEOSOn = false; - boolean bEOSAmerican = false; - - if (BondBuilder.BOND_TYPE_SIMPLE_FLOATER == iBondType) - bond = BondBuilder.CreateSimpleFloater ( // Simple Floating Rate Bond - strName, // Name - "USD", // Currency - "USD-6M", // Rate Index - strCreditCurve, // Credit Curve - 0.01, // Floating Spread - 2, // Coupon Frequency - "30/360", // Day Count - DateUtil.CreateFromYMD ( - 2008, - 9, - 21 - ), // Effective - DateUtil.CreateFromYMD ( - 2023, - 9, - 20 - ), // Maturity - MakeFSPrincipal(), // Principal Schedule - MakeFSCoupon() // Coupon Schedule - ); - else if (BondBuilder.BOND_TYPE_SIMPLE_FIXED == iBondType) - bond = BondBuilder.CreateSimpleFixed ( // Simple Fixed Rate Bond - strName, // Name - "USD", // Currency - strCreditCurve, // Credit Curve - 0.05, // Bond Coupon - 2, // Coupon Frequency - "30/360", // Day Count - DateUtil.CreateFromYMD ( - 2008, - 9, - 21 - ), // Effective - DateUtil.CreateFromYMD ( - 2023, - 9, - 20 - ), // Maturity - MakeFSPrincipal(), // Principal Schedule - MakeFSCoupon() // Coupon Schedule - ); - else if (BondBuilder.BOND_TYPE_SIMPLE_FROM_CF == iBondType) { // Bond from custom coupon and principal flows - final int NUM_CF_ENTRIES = 30; - double[] adblCouponAmount = new double[NUM_CF_ENTRIES]; - double[] adblPrincipalAmount = new double[NUM_CF_ENTRIES]; - JulianDate[] adt = new JulianDate[NUM_CF_ENTRIES]; - - JulianDate dtEffective = DateUtil.CreateFromYMD ( - 2008, - 9, - 20 - ); - - for (int i = 0; i < NUM_CF_ENTRIES; ++i) { - adt[i] = dtEffective.addMonths (6 * (i + 1)); - - adblCouponAmount[i] = 0.05; - adblPrincipalAmount[i] = 1.0; - } - - bond = BondBuilder.CreateBondFromCF ( - strName, // Name - dtEffective, // Effective - "USD", // Currency - strCreditCurve, // Credit Curve - "30/360", // Day Count - 1., // Initial Notional - 0.05, // Coupon Rate - 2, // Frequency - adt, // Array of dates - adblCouponAmount, // Array of coupon amount - adblPrincipalAmount, // Array of principal amount - false // Principal is an outstanding notional - ); - } - - /* - * Bonds with options embedded - */ - - if (bEOSOn) { - int[] aiDate = new int[5]; - double[] adblPutFactor = new double[5]; - double[] adblCallFactor = new double[5]; - EmbeddedOptionSchedule eosPut = null; - EmbeddedOptionSchedule eosCall = null; - - JulianDate dtEOSStart = DateUtil.Today().addDays (2); - - for (int i = 0; i < 5; ++i) { - adblPutFactor[i] = 0.9; - adblCallFactor[i] = 1.0; - - aiDate[i] = dtEOSStart.addYears (i + 2).julian(); - } - - if (bEOSAmerican) { // Creation of the American call and put schedule - eosCall = EmbeddedOptionSchedule.FromAmerican ( - DateUtil.Today().julian() + 1, - aiDate, - adblCallFactor, - false, - 30, - false, - Double.NaN, - "", - Double.NaN - ); - - eosPut = EmbeddedOptionSchedule.FromAmerican ( - DateUtil.Today().julian(), - aiDate, - adblPutFactor, - true, - 30, - false, - Double.NaN, - "", - Double.NaN - ); - } else { // Creation of the European call and put schedule - eosCall = new EmbeddedOptionSchedule ( - aiDate, - adblCallFactor, - false, - 30, - false, - Double.NaN, - "", - Double.NaN - ); - - eosPut = new EmbeddedOptionSchedule ( - aiDate, - adblPutFactor, - true, - 30, - false, - Double.NaN, - "", - Double.NaN - ); - } - - bond.setEmbeddedCallSchedule (eosCall); - - bond.setEmbeddedPutSchedule (eosPut); - } - - return (Bond) bond; - } - - /* - * Sample demonstrating the creation/usage of the custom bond API - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void CustomBondAPISample() - throws Exception - { - Bond[] aBond = new Bond[3]; - String strCreditCurve = "CC"; - - /* - * Creates a simple fixed coupon bond and adds it to the FI cache as a named object - */ - - aBond[0] = CreateCustomBond ( - "CustomFixed", - strCreditCurve, - BondBuilder.BOND_TYPE_SIMPLE_FIXED - ); - - /* - * Creates a simple floater and adds it to the FI cache as a named object - */ - - aBond[1] = CreateCustomBond ( - "CustomFRN", - strCreditCurve, - BondBuilder.BOND_TYPE_SIMPLE_FLOATER - ); - - /* - * Creates a custom bond from arbitrary cash flows and adds it to the FI cache as a named object - */ - - aBond[2] = CreateCustomBond ( - "CustomBondFromCF", - strCreditCurve, - BondBuilder.BOND_TYPE_SIMPLE_FROM_CF - ); - - /* - * Base Discount Curve - */ - - MergedDiscountForwardCurve dc = MakeDiscountCurve (DateUtil.Today()); - - String[] astrTSYTenor = new String[] { - "1Y", "2Y", "3Y", "5Y", "7Y", "10Y", "30Y" - }; - final double[] adblTSYCoupon = new double[] { - 0.0000, 0.00375, 0.00500, 0.0100, 0.01375, 0.01375, 0.02875 - }; - double[] adblTSYYield = new double[] { - 0.00160, 0.00397, 0.00696, 0.01421, 0.01955, 0.02529, 0.03568 - }; - - TreasuryComponent[] aTSYBond = OTRTreasurySet ( - DateUtil.Today(), - astrTSYTenor, - adblTSYCoupon - ); - - /* - * Create the on-the-run treasury discount curve - */ - - GovvieCurve gc = BuildOnTheRunGovvieCurve ( - DateUtil.Today(), - aTSYBond, - adblTSYYield - ); - - /* - * Credit Curve - */ - - CreditCurve cc = ScenarioCreditCurveBuilder.FlatHazard ( - DateUtil.Today().julian(), - strCreditCurve, - "USD", - 0.01, - 0.4 - ); - - for (int i = 0; i < aBond.length; ++i) { - System.out.println ("\nBOND #" + i + "; " + aBond[i].name()); - - System.out.println ("--------------------------"); - - System.out.println ("--------------------------"); - - System.out.println ("\n\tAcc Start Acc End Pay Date Cpn DCF Pay01 Surv01"); - - System.out.println ("\t--------- --------- --------- --------- --------- --------"); - - /* - * Generates and displays the coupon period details for the bonds - */ - - for (CompositePeriod p : aBond[i].couponPeriods()) - System.out.println ( - DateUtil.YYYYMMDD (p.startDate()) + FIELD_SEPARATOR + - DateUtil.YYYYMMDD (p.endDate()) + FIELD_SEPARATOR + - DateUtil.YYYYMMDD (p.payDate()) + FIELD_SEPARATOR + - FormatUtil.FormatDouble (p.couponDCF(), 1, 4, 1.) + FIELD_SEPARATOR + - FormatUtil.FormatDouble (dc.df (p.payDate()), 1, 4, 1.) + FIELD_SEPARATOR + - FormatUtil.FormatDouble (cc.survival (p.payDate()), 1, 4, 1.) - ); - - /* - * Create the bond's component market parameters from the market inputs - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, // Discount curve - gc, // TSY Discount Curve (Includes Optional EDSF if available, or BILLS etc) - cc, // Credit Curve - null, // TSY quotes - null, // BOND ID - null, // Bond market quote - Helper.CreateFixingsObject ( - aBond[i], - DateUtil.Today(), - 0.04 // Fixings - ) - ); - - AccumulateBondMarketQuote ( - mktParams, - new String[] { - "01YON", - "02YON", - "03YON", - "05YON", - "07YON", - "10YON", - "30YON" - }, - adblTSYYield - ); - - /* - * Construct Valuation Parameters - */ - - ValuationParams valParams = ValuationParams.Spot ( - DateUtil.Today(), - 0, - "", - Convention.DATE_ROLL_ACTUAL - ); - - ProductQuote cquote = QuoteBuilder.CreateProductQuote(); - - Quote q = QuoteBuilder.CreateQuote ( - "mid", - 0.05, - Double.NaN - ); - - cquote.addQuote ( - "Yield", - q, - true - ); - - mktParams.setProductQuote ( - aBond[i].name(), - cquote - ); - - System.out.println ("\n\tPrice From Yield: " + - FormatUtil.FormatDouble ( - aBond[i].priceFromYield ( - valParams, - mktParams, - null, - 0.03 - ), 1, 3, 100.)); - - double dblPrice = aBond[i].priceFromYield ( - valParams, - mktParams, - null, - 0.03 - ); - - WorkoutInfo wi = aBond[i].exerciseYieldFromPrice ( - valParams, - mktParams, - null, - dblPrice - ); - - System.out.println ("\tWorkout Date: " + DateUtil.YYYYMMDD (wi.date())); - - System.out.println ("\tWorkout Factor: " + wi.factor()); - - System.out.println ("\tWorkout Yield: " + FormatUtil.FormatDouble (wi.yield(), 1, 2, 100.)); - - System.out.println ( - "\tWorkout Yield From Price: " + - FormatUtil.FormatDouble ( - aBond[i].yieldFromPrice ( - valParams, - mktParams, - null, - wi.date(), - wi.factor(), - 1. - ), 1, 2, 100.)); - - if (!aBond[i].isFloater()) { - System.out.println ( - "\tZ Spread From Price: " + - FormatUtil.FormatDouble ( - aBond[i].zspreadFromPrice ( - valParams, - mktParams, - null, - wi.date(), - wi.factor(), - 1. - ), 1, 0, 10000.)); - - System.out.println ( - "\tOAS From Price: " + - FormatUtil.FormatDouble ( - aBond[i].oasFromPrice ( - valParams, - mktParams, - null, - wi.date(), - wi.factor(), - 1. - ), 1, 0, 10000.)); - } else; - System.out.println ( - "\tDiscount Margin From Price: " + - FormatUtil.FormatDouble ( - aBond[i].discountMarginFromPrice ( - valParams, - mktParams, - null, - wi.date(), - wi.factor(), - 1. - ), 1, 0, 10000.)); - - System.out.println ( - "\tI Spread From Price: " + - FormatUtil.FormatDouble ( - aBond[i].iSpreadFromPrice ( - valParams, - mktParams, - null, - wi.date(), - wi.factor(), - 1. - ), 1, 0, 10000.)); - - double dblTreasurySpread = Double.NaN; - - System.out.println ( - "\tTSY Spread From Price: " + - FormatUtil.FormatDouble ( - dblTreasurySpread = aBond[i].tsySpreadFromPrice ( - valParams, - mktParams, - null, - wi.date(), - wi.factor(), - 1. - ), 1, 0, 10000.)); - - System.out.println ( - "\tASW From Price: " + - FormatUtil.FormatDouble ( - aBond[i].aswFromPrice ( - valParams, - mktParams, - null, - wi.date(), - wi.factor(), - 1. - ), 1, 0, 10000.)); - - System.out.println ( - "\tCredit Basis From Price: " + - FormatUtil.FormatDouble ( - aBond[i].creditBasisFromPrice ( - valParams, - mktParams, - null, - wi.date(), - wi.factor(), - 1. - ), 1, 0, 10000.)); - - System.out.println ( - "\tPrice From TSY Spread: " + - FormatUtil.FormatDouble ( - aBond[i].priceFromTSYSpread ( - valParams, - mktParams, - null, - wi.date(), - wi.factor(), - dblTreasurySpread - ), 1, 0, 100.)); - - System.out.println ( - "\tYield From TSY Spread: " + - FormatUtil.FormatDouble ( - aBond[i].yieldFromTSYSpread ( - valParams, - mktParams, - null, - wi.date(), - wi.factor(), - dblTreasurySpread - ), 1, 0, 100.)); - - System.out.println ( - "\tASW From TSY Spread: " + - FormatUtil.FormatDouble ( - aBond[i].aswFromTSYSpread ( - valParams, - mktParams, - null, - wi.date(), - wi.factor(), - dblTreasurySpread - ), 1, 0, 10000.)); - - System.out.println ( - "\tCredit Basis From TSY Spread: " + - FormatUtil.FormatDouble ( - aBond[i].creditBasisFromTSYSpread ( - valParams, - mktParams, - null, - wi.date(), - wi.factor(), - dblTreasurySpread - ), 1, 0, 10000.)); - - /* System.out.println ("\tPECS From TSY Spread: " + FormatUtil.FormatDouble - (aBond[i].pecsFromTSYSpread (valParams, mktParams, null, 0.0188), 1, 0, 10000.)); */ - - System.out.println ( - "\tTheoretical Price: " + - FormatUtil.FormatDouble ( - aBond[i].priceFromCreditBasis ( - valParams, - mktParams, - null, - wi.date(), - wi.factor(), - 0. - ), 1, 2, 100.)); - } - } - - /* - * API demonstrating how to calibrate a CDS curve from CDS and bond quotes - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static void BondCDSCurveCalibration() - throws Exception - { - /* - * Bond calibration instrument - */ - - Bond bond = BondBuilder.CreateSimpleFixed ( - "CCCalibBond", - "DKK", - "CC", - 0.05, - 2, - "30/360", - DateUtil.CreateFromYMD ( - 2008, - 9, - 21 - ), - DateUtil.CreateFromYMD ( - 2023, - 9, - 20 - ), - null, - null - ); - - /* - * Discount Curve - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - DateUtil.Today(), - "DKK", - 0.04 - ); - - /* - * Credit Curve - */ - - CreditCurve cc = ScenarioCreditCurveBuilder.FlatHazard ( - DateUtil.Today().julian(), - "CC", - "USD", - 0.01, - 0.4 - ); - - /* - * Component Market Parameters Container - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - cc, - null, - null, - null, - null - ); - - /* - * Valuation Parameters - */ - - ValuationParams valParams = ValuationParams.Spot ( - DateUtil.Today(), - 0, - "USD", - Convention.DATE_ROLL_ACTUAL - ); - - /* - * Theoretical Price - */ - - double dblTheoreticalPrice = bond.priceFromCreditBasis ( - valParams, - mktParams, - null, - bond.maturityDate().julian(), - 1., - 0.01 - ); - - - System.out.println ("Credit Price From DC and CC: " + dblTheoreticalPrice); - - /* - * CDS calibration instrument - */ - - CreditDefaultSwap cds = CDSBuilder.CreateCDS ( - DateUtil.Today(), - DateUtil.Today().addTenor ("5Y"), - 0.1, - "DKK", - 0.40, - "CC", - "DKK", - true - ); - - /* - * Set up the calibration instruments - */ - - CalibratableComponent[] aCalibInst = new CalibratableComponent[] { - cds, - bond - }; - - /* - * Set up the calibration measures - */ - - String[] astrCalibMeasure = new String[] { - "FairPremium", - "FairPrice" - }; - - /* - * Set up the calibration quotes - */ - - double[] adblQuotes = new double[] { - 100., - dblTheoreticalPrice - }; - - /* - * Setup the curve scenario calibrator/generator and build the credit curve - */ - - CreditCurve ccCalib = ScenarioCreditCurveBuilder.Custom ( - "CC", // Name - DateUtil.Today(), // Date - aCalibInst, // Calibration instruments - dc, // Discount Curve - adblQuotes, // Component Quotes - astrCalibMeasure, // Calibration Measures - 0.40, // Recovery - false // Calibration is not flat - ); - - /* - * Calculate the survival probability, and recover the input quotes - */ - - System.out.println ( - "Surv (2021, 1, 14): " + - ccCalib.survival ( - DateUtil.CreateFromYMD ( - 2021, - 1, - 14 - ) - ) - ); - - /* - * Calibrated Component Market Parameters Container - */ - - CurveSurfaceQuoteContainer mktParamsCalib = MarketParamsBuilder.Create ( - dc, - null, - null, - ccCalib, - null, - null, - null, - null - ); - - /* - * Verify the CDS fair premium using the calibrated credit curve - */ - - System.out.println ( - cds.primaryCode() + " => " + cds.measureValue ( - valParams, - CreditPricerParams.Standard(), - mktParamsCalib, - null, - "FairPremium" - ) - ); - - /* - * Verify the Bond fair price using the calibrated credit curve - */ - - System.out.println ( - bond.primaryCode() + " => " + bond.priceFromCreditBasis ( - valParams, - mktParamsCalib, - null, - bond.maturityDate().julian(), - 1., - 0. - ) - ); - } - - public static final void main ( - final String astrArgs[]) - throws Exception - { - // String strConfig = "c:\\Lakshmi\\BondAnal\\Config.xml"; - - String strConfig = ""; - - EnvManager.InitEnv (strConfig); - - CustomBondAPISample(); - - BondCDSCurveCalibration(); - } -} diff --git a/org/drip/sample/bond/CorporateIssueMetrics.java b/org/drip/sample/bond/CorporateIssueMetrics.java deleted file mode 100644 index 71bbe33..0000000 --- a/org/drip/sample/bond/CorporateIssueMetrics.java +++ /dev/null @@ -1,663 +0,0 @@ - -package org.drip.sample.bond; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.analytics.output.BondRVMeasures; -import org.drip.analytics.support.Helper; -import org.drip.param.creator.MarketParamsBuilder; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.quote.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.BondBuilder; -import org.drip.product.credit.BondComponent; -import org.drip.product.definition.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.govvie.GovvieCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CorporateIssueMetrics demonstrates the Corporate Bond Pricing and Relative Value Measure Generation - * Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class CorporateIssueMetrics { - - private static final MergedDiscountForwardCurve FundingCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrDepositMaturityTenor = new String[] { - "2D", - "1W", - "1M", - "2M", - "3M" - }; - - double[] adblDepositQuote = new double[] { - 0.00195, // 2D - 0.00176, // 1W - 0.00301, // 1M - 0.00401, // 2M - 0.00492 // 3M - }; - - double[] adblFuturesQuote = new double[] { - 0.00609, - 0.00687 - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.00762, // 1Y - 0.01055, // 2Y - 0.01300, // 3Y - 0.01495, // 4Y - 0.01651, // 5Y - 0.01787, // 6Y - 0.01904, // 7Y - 0.02005, // 8Y - 0.02090, // 9Y - 0.02166, // 10Y - 0.02231, // 11Y - 0.02289, // 12Y - 0.02414, // 15Y - 0.02570, // 20Y - 0.02594, // 25Y - 0.02627, // 30Y - 0.02648, // 40Y - 0.02632 // 50Y - }; - - MergedDiscountForwardCurve dcFunding = LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - adblFuturesQuote, - "ForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate" - ); - - Component[] aDepositComp = OTCInstrumentBuilder.FundingDeposit ( - dtSpot, - strCurrency, - astrDepositMaturityTenor - ); - - Component[] aFuturesComp = ExchangeInstrumentBuilder.ForwardRateFuturesPack ( - dtSpot, - adblFuturesQuote.length, - strCurrency - ); - - Component[] aFixFloatComp = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - astrFixFloatMaturityTenor, - "MAIN", - 0. - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - System.out.println ("\n\n\t|------------------------------------||"); - - System.out.println ("\t| DEPOSIT INPUT vs. CALC ||"); - - System.out.println ("\t|------------------------------------||"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t| [" + aDepositComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aDepositComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|------------------------------------||"); - - System.out.println ("\n\t|------------------------------------||"); - - System.out.println ("\t| FUTURES INPUT vs. CALC ||"); - - System.out.println ("\t|------------------------------------||"); - - for (int i = 0; i < aFuturesComp.length; ++i) - System.out.println ("\t| [" + aFuturesComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFuturesComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFuturesQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|------------------------------------||"); - - System.out.println ("\n\t|-----------------------------------------------|| "); - - System.out.println ("\t| FIX-FLOAT INPUTS vs CALIB ||"); - - System.out.println ("\t|-----------------------------------------------|| "); - - for (int i = 0; i < aFixFloatComp.length; ++i) - System.out.println ("\t| [" + aFixFloatComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "CalibSwapRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFixFloatQuote[i], 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "FairPremium" - ), 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-----------------------------------------------|| \n"); - - return dcFunding; - } - - private static final void AccumulateBondMarketQuote ( - final CurveSurfaceQuoteContainer csqc, - final String[] astrOnTheRunCode, - final double[] adblYield) - throws Exception - { - for (int i = 0; i < astrOnTheRunCode.length; ++i) { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Yield", - new MultiSided ( - "mid", - adblYield[i] - ), - true - ); - - csqc.setProductQuote ( - astrOnTheRunCode[i], - pmmq - ); - } - } - - private static final Map GovvieCurve ( - final JulianDate dtSpot, - final String strCode, - final double[] adblCoupon, - final double[] adblYield) - throws Exception - { - JulianDate[] adtEffective = new JulianDate[] { - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot - }; - - JulianDate[] adtMaturity = new JulianDate[] { - dtSpot.addTenor ("1Y"), - dtSpot.addTenor ("2Y"), - dtSpot.addTenor ("3Y"), - dtSpot.addTenor ("5Y"), - dtSpot.addTenor ("7Y"), - dtSpot.addTenor ("10Y"), - dtSpot.addTenor ("30Y") - }; - - Map mapGovvieCurve = LatentMarketStateBuilder.BumpedGovvieCurve ( - strCode, - dtSpot, - adtEffective, - adtMaturity, - adblCoupon, - adblYield, - "Yield", - LatentMarketStateBuilder.SHAPE_PRESERVING, - 0.0001, - false - ); - - BondComponent[] aComp = TreasuryBuilder.FromCode ( - strCode, - adtEffective, - adtMaturity, - adblCoupon - ); - - ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setGovvieState (mapGovvieCurve.get ("BASE")); - - System.out.println ("\n\t|------------------------------------------||"); - - System.out.println ("\t| TREASURY INPUT vs CALIB YIELD ||"); - - System.out.println ("\t|------------------------------------------||"); - - for (int i = 0; i < aComp.length; ++i) - System.out.println ("\t| " + aComp[i].name() + " | " + - FormatUtil.FormatDouble (adblYield[i], 1, 3, 100.) + "% | " + - FormatUtil.FormatDouble (aComp[i].yieldFromPrice ( - valParams, - null, - null, - aComp[i].maturityDate().julian(), - 1., - aComp[i].priceFromYield ( - valParams, - null, - null, - mapGovvieCurve.get ("BASE").yield (aComp[i].maturityDate().julian()) - ) - ), 1, 3, 100.) + "% ||" - ); - - System.out.println ("\t|------------------------------------------||"); - - return mapGovvieCurve; - } - - private static final Bond USDCorporate ( - final JulianDate dtEffective, - final JulianDate dtMaturity, - final double dblCoupon) - throws Exception - { - return BondBuilder.CreateSimpleFixed ( - "JPM " + FormatUtil.FormatDouble (dblCoupon, 1, 4, 100.) + " " + dtMaturity, - "USD", - "", - dblCoupon, - 2, - "30/360", - dtEffective, - dtMaturity, - null, - null - ); - } - - private static final double[] RVMeasures ( - final Bond[] aBond, - final JulianDate dtValue, - final CurveSurfaceQuoteContainer csqc, - final double[] adblCleanPrice) - throws Exception - { - JulianDate dtSettle = dtValue.addBusDays ( - 3, - aBond[0].currency() - ); - - ValuationParams valParams = new ValuationParams ( - dtValue, - dtSettle, - aBond[0].currency() - ); - - System.out.println ("\n\t|-------------------------------||"); - - System.out.println ("\t| Trade Date : " + dtValue + " ||"); - - System.out.println ("\t| Cash Settle Date : " + dtSettle + " ||"); - - System.out.println ("\t|-------------------------------||\n"); - - String strCurveMetrics = ""; - String strSecularMetrics = ""; - double[] adblOAS = new double[aBond.length]; - - for (int i = 0; i < aBond.length; ++i) { - WorkoutInfo wi = aBond[i].exerciseYieldFromPrice ( - valParams, - csqc, - null, - adblCleanPrice[i] - ); - - BondRVMeasures rvm = aBond[i].standardMeasures ( - valParams, - null, - csqc, - null, - wi, - adblCleanPrice[i] - ); - - strSecularMetrics += "\t| " + - aBond[i].name() + " | " + - aBond[i].effectiveDate() + " | " + - aBond[i].maturityDate() + " | " + - aBond[i].firstCouponDate() + " |" + - FormatUtil.FormatDouble (adblCleanPrice[i], 3, 3, 100.) + " |" + - FormatUtil.FormatDouble (wi.yield(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (rvm.macaulayDuration(), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (rvm.modifiedDuration(), 2, 2, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.yield01(), 2, 2, 10000.) + " |" + - FormatUtil.FormatDouble (rvm.yield01(), 4, 0, 1000000.) + " |" + - FormatUtil.FormatDouble (rvm.convexity(), 1, 2, 1000000.) + " | " + - FormatUtil.FormatDouble (rvm.bondBasis(), 3, 0, 10000.) + " ||" + "\n"; - - adblOAS[i] = rvm.oas(); - - double dblCleanPriceOASUp = aBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] + 0.0001 - ); - - double dblCleanPriceOASDown = aBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] - 0.0001 - ); - - strCurveMetrics += "\t| " + - aBond[i].name() + " |" + - FormatUtil.FormatDouble (adblCleanPrice[i], 3, 3, 100.) + " |" + - FormatUtil.FormatDouble (wi.yield(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (rvm.zSpread(), 3, 0, 10000.) + " |" + - FormatUtil.FormatDouble (adblOAS[i], 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (0.5 * (dblCleanPriceOASDown - dblCleanPriceOASUp) / adblCleanPrice[i], 2, 2, 10000.) + " | " + - FormatUtil.FormatDouble ((dblCleanPriceOASDown + dblCleanPriceOASUp - 2. * adblCleanPrice[i]) / adblCleanPrice[i], 2, 2, 1000000.) + " |" + - FormatUtil.FormatDouble (rvm.asw(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.gSpread(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.iSpread(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.tsySpread(), 3, 0, 10000.) + " | " + - Helper.BaseTsyBmk ( - dtValue.julian(), - aBond[i].maturityDate().julian() - ) + " ||" + "\n"; - } - - System.out.println ("\t|---------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| BOND | EFFECTIVE | MATURITY | FIRST COUPON | PRICE | YIELD | MAC DUR | MOD DUR | YIELD 01 | DV01 | CONV | BOND BASIS ||"); - - System.out.println ("\t|---------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print (strSecularMetrics); - - System.out.println ("\t|---------------------------------------------------------------------------------------------------------------------------------------------||\n"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| BOND | PRICE | YIELD | Z SPREAD | OAS | OAS DUR | OAS CONV | ASW | G SPREAD | I SPREAD | TSY SPREAD | TSY BMK ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print (strCurveMetrics); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------||"); - - return adblOAS; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2015, - DateUtil.DECEMBER, - 8 - ); - - String strCurrency = "USD"; - String strTreasuryCode = "UST"; - - MergedDiscountForwardCurve dcFunding = FundingCurve ( - dtSpot, - strCurrency - ); - - double[] adblTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - Map mapGovvieCurve = GovvieCurve ( - dtSpot, - strTreasuryCode, - adblTreasuryCoupon, - adblTreasuryYield - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - csqc.setGovvieState (mapGovvieCurve.get ("BASE")); - - AccumulateBondMarketQuote ( - csqc, - new String[] { - "01YON", - "02YON", - "03YON", - "05YON", - "07YON", - "10YON", - "30YON" - }, - adblTreasuryYield - ); - - Bond[] aCorporateBond = new Bond[] { - USDCorporate (DateUtil.CreateFromYMD (2007, 12, 20), DateUtil.CreateFromYMD (2018, 1, 15), 0.06000), - USDCorporate (DateUtil.CreateFromYMD (1996, 7, 25), DateUtil.CreateFromYMD (2025, 7, 15), 0.07750), - USDCorporate (DateUtil.CreateFromYMD (1996, 10, 29), DateUtil.CreateFromYMD (2026, 10, 15), 0.07625), - USDCorporate (DateUtil.CreateFromYMD (2014, 12, 9), DateUtil.CreateFromYMD (2026, 12, 15), 0.04125), - USDCorporate (DateUtil.CreateFromYMD (1997, 4, 29), DateUtil.CreateFromYMD (2027, 4, 29), 0.08000), - USDCorporate (DateUtil.CreateFromYMD (2014, 9, 25), DateUtil.CreateFromYMD (2027, 10, 1), 0.04250), - USDCorporate (DateUtil.CreateFromYMD (2008, 5, 22), DateUtil.CreateFromYMD (2038, 5, 15), 0.06400), - // USDCorporate (DateUtil.CreateFromYMD (2011, 7, 21), DateUtil.CreateFromYMD (2041, 7, 15), 0.05600) - }; - - double[] adblCleanPrice = new double[] { - 1.08529, - 1.27021, - 1.27274, - 1.01235, - 1.31537, - 1.02263, - 1.27570, - // 1.17460 - }; - - double[] adblOAS = RVMeasures ( - aCorporateBond, - dtSpot, - csqc, - adblCleanPrice - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot.addBusDays ( - 3, - dcFunding.currency() - ), - dcFunding.currency() - ); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print ("\t| BOND "); - - for (Map.Entry meGovvieCurve : mapGovvieCurve.entrySet()) { - if ("BASE".equalsIgnoreCase (meGovvieCurve.getKey()) || "BUMP".equalsIgnoreCase (meGovvieCurve.getKey())) - continue; - - System.out.print (" | " + meGovvieCurve.getKey()); - } - - System.out.println (" ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < adblOAS.length; ++i) { - System.out.print ("\t| " + aCorporateBond[i].name()); - - for (Map.Entry meGovvieCurve : mapGovvieCurve.entrySet()) { - if ("BASE".equalsIgnoreCase (meGovvieCurve.getKey()) || "BUMP".equalsIgnoreCase (meGovvieCurve.getKey())) - continue; - - csqc.setGovvieState (meGovvieCurve.getValue()); - - System.out.print (" | " + - FormatUtil.FormatDouble ( - (adblCleanPrice[i] - aCorporateBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] - )) / adblCleanPrice[i], - 2, 2, 10000.) + " " - ); - } - - System.out.println (" ||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/bond/RegressionSplineBondCurve.java b/org/drip/sample/bond/RegressionSplineBondCurve.java deleted file mode 100644 index 3dc40fd..0000000 --- a/org/drip/sample/bond/RegressionSplineBondCurve.java +++ /dev/null @@ -1,833 +0,0 @@ - -package org.drip.sample.bond; - -import java.util.*; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.analytics.daycount.Convention; -import org.drip.analytics.support.Helper; -import org.drip.param.creator.MarketParamsBuilder; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.creator.BondBuilder; -import org.drip.product.definition.Bond; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.grid.OverlappingStretchSpan; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.curve.DiscountFactorDiscountCurve; -import org.drip.state.discount.MergedDiscountForwardCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RegressionSplineBondCurve demonstrates the Functionality behind the Regression Spline based OLS best-fit - * Construction of a Bond Discount Curve Based on Input Price/Yield. - * - * @author Lakshmi Krishnamurthy - */ - -public class RegressionSplineBondCurve { - - static class CashFlowYieldDF { - double _dblCumulativeCashFlow = java.lang.Double.NaN; - double _dblDiscountedCumulativeCashFlow = java.lang.Double.NaN; - - CashFlowYieldDF ( - final double dblCashFlow, - final double dblYieldDF) - { - _dblDiscountedCumulativeCashFlow = (_dblCumulativeCashFlow = dblCashFlow) * dblYieldDF; - } - - void accumulate ( - final double dblCashFlow, - final double dblYieldDF) - { - _dblCumulativeCashFlow += dblCashFlow; - _dblDiscountedCumulativeCashFlow += dblCashFlow * dblYieldDF; - } - - double cumulativeCashFlow() - { - return _dblCumulativeCashFlow; - } - - double discountedCumulativeCashFlow() - { - return _dblDiscountedCumulativeCashFlow; - } - - double weightedDF() - { - return _dblDiscountedCumulativeCashFlow / _dblCumulativeCashFlow; - } - } - - private static final SegmentCustomBuilderControl PolynomialSplineSegmentBuilder() - throws Exception - { - int iCk = 2; - int iNumPolyBasis = 4; - - SegmentInelasticDesignControl sdic = new SegmentInelasticDesignControl ( - iCk, - null, // SegmentFlexurePenaltyControl (iLengthPenaltyDerivativeOrder, dblLengthPenaltyAmplitude) - null // SegmentFlexurePenaltyControl (iCurvaturePenaltyDerivativeOrder, dblCurvaturePenaltyAmplitude) - ); - - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (iNumPolyBasis), - sdic, - null, - null - ); - } - - private static final Bond FixedCouponBond ( - final String strName, - final JulianDate dtEffective, - final JulianDate dtMaturity, - final double dblCoupon, - final String strCurrency, - final String strDayCount, - final int iFreq) - throws Exception - { - return BondBuilder.CreateSimpleFixed ( - strName, - strCurrency, - "", - dblCoupon, - iFreq, - strDayCount, - dtEffective, - dtMaturity, - null, - null - ); - } - - private static final Bond[] CalibBondSet ( - final String strCurrency, - final String strDayCount) - throws Exception - { - Bond bond1 = FixedCouponBond ( - "MBONO 8.00 12/17/2015", - DateUtil.CreateFromYMD ( - 2006, - DateUtil.JANUARY, - 5 - ), - DateUtil.CreateFromYMD ( - 2015, - DateUtil.DECEMBER, - 17 - ), - 0.08, - strCurrency, - strDayCount, - 2 - ); - - Bond bond2 = FixedCouponBond ( - "MBONO 6.25 06/16/2016", - DateUtil.CreateFromYMD ( - 2011, - DateUtil.JULY, - 22 - ), - DateUtil.CreateFromYMD ( - 2016, - DateUtil.JUNE, - 16 - ), - 0.08, - strCurrency, - strDayCount, - 2 - ); - - Bond bond3 = FixedCouponBond ( - "MBONO 7.25 12/15/2016", - DateUtil.CreateFromYMD ( - 2007, - DateUtil.FEBRUARY, - 1 - ), - DateUtil.CreateFromYMD ( - 2016, - DateUtil.DECEMBER, - 15 - ), - 0.0725, - strCurrency, - strDayCount, - 2 - ); - - Bond bond4 = FixedCouponBond ( - "MBONO 5.00 06/15/2017", - DateUtil.CreateFromYMD ( - 2012, - DateUtil.JULY, - 19 - ), - DateUtil.CreateFromYMD ( - 2017, - DateUtil.JUNE, - 15 - ), - 0.0500, - strCurrency, - strDayCount, - 2 - ); - - Bond bond5 = FixedCouponBond ( - "MBONO 7.75 12/14/2017", - DateUtil.CreateFromYMD ( - 2008, - DateUtil.JANUARY, - 31 - ), - DateUtil.CreateFromYMD ( - 2017, - DateUtil.DECEMBER, - 14 - ), - 0.0775, - strCurrency, - strDayCount, - 2 - ); - - Bond bond6 = FixedCouponBond ( - "MBONO 4.75 06/14/2018", - DateUtil.CreateFromYMD ( - 2013, - DateUtil.AUGUST, - 30 - ), - DateUtil.CreateFromYMD ( - 2018, - DateUtil.JUNE, - 14 - ), - 0.0475, - strCurrency, - strDayCount, - 2 - ); - - Bond bond7 = FixedCouponBond ( - "MBONO 8.50 12/13/2018", - DateUtil.CreateFromYMD ( - 2009, - DateUtil.FEBRUARY, - 12 - ), - DateUtil.CreateFromYMD ( - 2018, - DateUtil.DECEMBER, - 13 - ), - 0.085, - strCurrency, - strDayCount, - 2 - ); - - Bond bond8 = FixedCouponBond ( - "MBONO 5.00 12/11/2019", - DateUtil.CreateFromYMD ( - 2014, - DateUtil.NOVEMBER, - 7 - ), - DateUtil.CreateFromYMD ( - 2019, - DateUtil.DECEMBER, - 11 - ), - 0.05, - strCurrency, - strDayCount, - 2 - ); - - Bond bond9 = FixedCouponBond ( - "MBONO 8.00 06/11/2020", - DateUtil.CreateFromYMD ( - 2010, - DateUtil.FEBRUARY, - 25 - ), - DateUtil.CreateFromYMD ( - 2020, - DateUtil.JUNE, - 11 - ), - 0.08, - strCurrency, - strDayCount, - 2 - ); - - Bond bond10 = FixedCouponBond ( - "MBONO 6.50 06/10/2021", - DateUtil.CreateFromYMD ( - 2011, - DateUtil.FEBRUARY, - 3 - ), - DateUtil.CreateFromYMD ( - 2021, - DateUtil.JUNE, - 10 - ), - 0.065, - strCurrency, - strDayCount, - 2 - ); - - Bond bond11 = FixedCouponBond ( - "MBONO 6.50 06/09/2022", - DateUtil.CreateFromYMD ( - 2012, - DateUtil.FEBRUARY, - 15 - ), - DateUtil.CreateFromYMD ( - 2022, - DateUtil.JUNE, - 9 - ), - 0.065, - strCurrency, - strDayCount, - 2 - ); - - Bond bond12 = FixedCouponBond ( - "MBONO 8.00 12/07/2023", - DateUtil.CreateFromYMD ( - 2003, - DateUtil.OCTOBER, - 30 - ), - DateUtil.CreateFromYMD ( - 2023, - DateUtil.DECEMBER, - 7 - ), - 0.065, - strCurrency, - strDayCount, - 2 - ); - - Bond bond13 = FixedCouponBond ( - "MBONO 10.00 12/05/2024", - DateUtil.CreateFromYMD ( - 2005, - DateUtil.JANUARY, - 20 - ), - DateUtil.CreateFromYMD ( - 2024, - DateUtil.DECEMBER, - 5 - ), - 0.1, - strCurrency, - strDayCount, - 2 - ); - - Bond bond14 = FixedCouponBond ( - "MBONO 7.50 06/03/2027", - DateUtil.CreateFromYMD ( - 2007, - DateUtil.JANUARY, - 18 - ), - DateUtil.CreateFromYMD ( - 2027, - DateUtil.JUNE, - 3 - ), - 0.075, - strCurrency, - strDayCount, - 2 - ); - - Bond bond15 = FixedCouponBond ( - "MBONO 8.50 05/31/2029", - DateUtil.CreateFromYMD ( - 2009, - DateUtil.JANUARY, - 15 - ), - DateUtil.CreateFromYMD ( - 2029, - DateUtil.MAY, - 31 - ), - 0.085, - strCurrency, - strDayCount, - 2 - ); - - Bond bond16 = FixedCouponBond ( - "MBONO 7.75 05/29/2031", - DateUtil.CreateFromYMD ( - 2009, - DateUtil.SEPTEMBER, - 11 - ), - DateUtil.CreateFromYMD ( - 2031, - DateUtil.MAY, - 29 - ), - 0.0775, - strCurrency, - strDayCount, - 2 - ); - - Bond bond17 = FixedCouponBond ( - "MBONO 7.75 11/23/2034", - DateUtil.CreateFromYMD ( - 2014, - DateUtil.APRIL, - 11 - ), - DateUtil.CreateFromYMD ( - 2034, - DateUtil.NOVEMBER, - 23 - ), - 0.0775, - strCurrency, - strDayCount, - 2 - ); - - Bond bond18 = FixedCouponBond ( - "MBONO 10.00 11/20/2036", - DateUtil.CreateFromYMD ( - 2006, - DateUtil.OCTOBER, - 26 - ), - DateUtil.CreateFromYMD ( - 2036, - DateUtil.NOVEMBER, - 20 - ), - 0.1, - strCurrency, - strDayCount, - 2 - ); - - Bond bond19 = FixedCouponBond ( - "MBONO 8.50 11/18/2038", - DateUtil.CreateFromYMD ( - 2009, - DateUtil.JANUARY, - 29 - ), - DateUtil.CreateFromYMD ( - 2038, - DateUtil.NOVEMBER, - 18 - ), - 0.085, - strCurrency, - strDayCount, - 2 - ); - - Bond bond20 = FixedCouponBond ( - "MBONO 7.75 11/13/2042", - DateUtil.CreateFromYMD ( - 2012, - DateUtil.APRIL, - 20 - ), - DateUtil.CreateFromYMD ( - 2042, - DateUtil.NOVEMBER, - 13 - ), - 0.0775, - strCurrency, - strDayCount, - 2 - ); - - return new Bond[] { - bond1, - bond2, - bond3, - bond4, - bond5, - bond6, - bond7, - bond8, - bond9, - bond10, - bond11, - bond12, - bond13, - bond14, - bond15, - bond16, - bond17, - bond18, - bond19, - bond20 - }; - } - - private static final Map BondYieldFlows ( - final Bond[] aBond, - final double[] adblYield, - final int iValueDate) - throws Exception - { - Map mapDateYieldDF = new TreeMap(); - - ValuationParams valParams = new ValuationParams ( - new JulianDate (iValueDate), - new JulianDate (iValueDate), - "" - ); - - for (int i = 0; i < aBond.length; ++i) { - for (CompositePeriod cp : aBond[i].couponPeriods()) { - if (cp.payDate() <= iValueDate) continue; - - double dblCashFlow = aBond[i].couponMetrics ( - cp.endDate(), - valParams, - null - ).rate() / aBond[i].freq(); - - double dblYieldDF = Helper.Yield2DF ( - aBond[i].freq(), - adblYield[i], - Convention.YearFraction ( - iValueDate, - cp.payDate(), - aBond[i].couponDC(), - false, - null, - aBond[i].currency() - ) - ); - - JulianDate dtPay = new JulianDate (cp.payDate()); - - if (mapDateYieldDF.containsKey (dtPay)) - mapDateYieldDF.get (dtPay).accumulate ( - dblCashFlow, - dblYieldDF - ); - else - mapDateYieldDF.put ( - dtPay, - new CashFlowYieldDF ( - dblCashFlow, - dblYieldDF - ) - ); - } - - JulianDate dtMaturity = aBond[i].maturityDate(); - - double dblYieldDF = Helper.Yield2DF ( - aBond[i].freq(), - adblYield[i], - Convention.YearFraction ( - iValueDate, - dtMaturity.julian(), - aBond[i].couponDC(), - false, - null, - aBond[i].currency() - ) - ); - - if (mapDateYieldDF.containsKey (dtMaturity)) - mapDateYieldDF.get (dtMaturity).accumulate ( - 1., - dblYieldDF - ); - else - mapDateYieldDF.put ( - dtMaturity, - new CashFlowYieldDF ( - 1., - dblYieldDF - ) - ); - } - - return mapDateYieldDF; - } - - private static final StretchBestFitResponse SBFR ( - final Map mapDateYieldDF) - throws Exception - { - int iMapSize = mapDateYieldDF.size(); - - int i = 0; - int[] aiDate = new int[iMapSize]; - double[] adblYieldDF = new double[iMapSize]; - double[] adblWeight = new double[iMapSize]; - - for (Map.Entry me : mapDateYieldDF.entrySet()) { - aiDate[i] = me.getKey().julian(); - - adblYieldDF[i] = me.getValue().weightedDF(); - - adblWeight[i] = me.getValue().cumulativeCashFlow(); - - ++i; - } - - return StretchBestFitResponse.Create ( - aiDate, - adblYieldDF, - adblWeight - ); - } - - private static final MultiSegmentSequence BondRegressionSplineStretch ( - final JulianDate dtSpot, - final Bond[] aBondSet, - final int iNumKnots, - final Map mapDateDF) - throws Exception - { - SegmentCustomBuilderControl scbc = PolynomialSplineSegmentBuilder(); - - double dblXStart = dtSpot.julian(); - - double dblXFinish = aBondSet[aBondSet.length - 1].maturityDate().julian(); - - double adblX[] = new double[iNumKnots + 2]; - adblX[0] = dblXStart; - - for (int i = 1; i < adblX.length; ++i) - adblX[i] = adblX[i - 1] + (dblXFinish - dblXStart) / (iNumKnots + 1); - - SegmentCustomBuilderControl[] aSCBC = new SegmentCustomBuilderControl[adblX.length - 1]; - - for (int i = 0; i < adblX.length - 1; ++i) - aSCBC[i] = scbc; - - return MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator ( - "SPLINE_STRETCH", - adblX, - 1., - null, - aSCBC, - SBFR (mapDateDF), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iNumKnots = 10; - String strCurrency = "MXN"; - String strDayCount = "30/360"; - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2015, - DateUtil.JUNE, - 13 - ); - - double[] aCalibYield = new double[] { - 0.0315960, - 0.0354184, - 0.0389543, - 0.0412860, - 0.0435245, - 0.0464521, - 0.0486307, - 0.0524561, - 0.0532168, - 0.0562230, - 0.0585227, - 0.0606205, - 0.0611038, - 0.0637935, - 0.0648727, - 0.0661705, - 0.0673744, - 0.0675774, - 0.0683684, - 0.0684978 - }; - - Bond[] aBondSet = CalibBondSet ( - strCurrency, - strDayCount - ); - - Map mapDateDF = BondYieldFlows ( - aBondSet, - aCalibYield, - dtSpot.julian() - ); - - MultiSegmentSequence mss = BondRegressionSplineStretch ( - dtSpot, - aBondSet, - iNumKnots, - mapDateDF - ); - - MergedDiscountForwardCurve dfdc = new DiscountFactorDiscountCurve ( - strCurrency, - new OverlappingStretchSpan (mss) - ); - - System.out.println ("\n\n\t|--------------------------------------------|"); - - System.out.println ("\t| Curve Stretch [" + - new JulianDate ((int) mss.getLeftPredictorOrdinateEdge()) + " -> " + - new JulianDate ((int) mss.getRightPredictorOrdinateEdge()) + "] |" - ); - - System.out.println ("\t|--------------------------------------------|"); - - for (Map.Entry me : mapDateDF.entrySet()) { - System.out.println ( - "\t|\t " + me.getKey() + " => " + - FormatUtil.FormatDouble (me.getValue().weightedDF(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (dfdc.df (me.getKey().julian()), 1, 4, 1.) + " |" - ); - } - - System.out.println ("\t|--------------------------------------------|\n\n"); - - System.out.println ("\t|---------------------------------------------------------------||"); - - System.out.println ("\t| Market Yield vs. Regression Curve ||"); - - System.out.println ("\t|---------------------------------------------------------------||"); - - System.out.println ("\t| L -> R ||"); - - System.out.println ("\t| Bond Name ||"); - - System.out.println ("\t| Market Yield ||"); - - System.out.println ("\t| Regressed Yield (Bond Basis) ||"); - - System.out.println ("\t| Regressed Yield (Yield Spread) ||"); - - System.out.println ("\t| Continuous Zero To Maturity ||"); - - System.out.println ("\t|---------------------------------------------------------------||"); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - "" - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Discount (dfdc); - - for (int i = 0; i < aBondSet.length; ++i) { - System.out.println ( - "\t| " + aBondSet[i].name() + " ==> " + - FormatUtil.FormatDouble (aCalibYield[i], 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (aBondSet[i].yieldFromBondBasis ( - valParams, - mktParams, - null, - 0. - ), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (aBondSet[i].yieldFromYieldSpread ( - valParams, - mktParams, - null, - 0. - ), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dfdc.zero ( - aBondSet[i].maturityDate().julian() - ), 1, 2, 100.) + "% || " - ); - } - - System.out.println ("\t|---------------------------------------------------------------||\n\n"); - } -} diff --git a/org/drip/sample/bond/RelativeValueMeasuresGeneration.java b/org/drip/sample/bond/RelativeValueMeasuresGeneration.java deleted file mode 100644 index 5eb2f0e..0000000 --- a/org/drip/sample/bond/RelativeValueMeasuresGeneration.java +++ /dev/null @@ -1,510 +0,0 @@ - -package org.drip.sample.bond; - -/* - * Credit Product imports - */ - -import org.drip.analytics.date.*; -import org.drip.analytics.daycount.Convention; -import org.drip.analytics.support.*; -import org.drip.market.otc.*; -import org.drip.param.definition.*; -import org.drip.param.market.*; -import org.drip.param.quote.*; -import org.drip.param.valuation.*; -import org.drip.product.definition.*; -import org.drip.product.govvie.TreasuryComponent; -import org.drip.product.rates.*; -import org.drip.analytics.output.BondRVMeasures; -import org.drip.param.creator.*; -import org.drip.product.creator.*; -import org.drip.product.credit.BondComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.TreasuryBuilder; -import org.drip.state.creator.*; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.govvie.GovvieCurve; -import org.drip.state.identifier.ForwardLabel; - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * RelativeValueMeasuresGeneration is a Bond RV Measures Generation Sample demonstrating the invocation and - * usage of Bond RV Measures functionality. It shows the following: - * - * - Create the discount/treasury curve from rates/treasury instruments. - * - Compute the work-out date given the price. - * - Compute and display the base RV measures to the work-out date. - * - Compute and display the bumped RV measures to the work-out date. - * - * @author Lakshmi Krishnamurthy - */ - -public class RelativeValueMeasuresGeneration { - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Sample demonstrating creation of a rates curve from instruments - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static MergedDiscountForwardCurve BuildRatesCurveFromInstruments ( - final JulianDate dtStart, - final String[] astrCashTenor, - final double[] adblCashRate, - final String[] astrIRSTenor, - final double[] adblIRSRate, - final double dblBump, - final String strCurrency) - throws Exception - { - int iNumDCInstruments = astrCashTenor.length + adblIRSRate.length; - int aiDate[] = new int[iNumDCInstruments]; - double adblRate[] = new double[iNumDCInstruments]; - String astrCalibMeasure[] = new String[iNumDCInstruments]; - double adblCompCalibValue[] = new double[iNumDCInstruments]; - CalibratableComponent aCompCalib[] = new CalibratableComponent[iNumDCInstruments]; - - // Cash Calibration - - JulianDate dtCashEffective = dtStart.addBusDays ( - 1, - strCurrency - ); - - for (int i = 0; i < astrCashTenor.length; ++i) { - astrCalibMeasure[i] = "Rate"; - adblRate[i] = java.lang.Double.NaN; - adblCompCalibValue[i] = adblCashRate[i] + dblBump; - - aCompCalib[i] = SingleStreamComponentBuilder.Deposit ( - dtCashEffective, - new JulianDate (aiDate[i] = dtCashEffective.addTenor (astrCashTenor[i]).julian()), - ForwardLabel.Create ( - strCurrency, - astrCashTenor[i] - ) - ); - } - - // IRS Calibration - - JulianDate dtIRSEffective = dtStart.addBusDays (2, strCurrency); - - for (int i = 0; i < astrIRSTenor.length; ++i) { - astrCalibMeasure[i + astrCashTenor.length] = "SwapRate"; - adblRate[i + astrCashTenor.length] = java.lang.Double.NaN; - adblCompCalibValue[i + astrCashTenor.length] = adblIRSRate[i] + dblBump; - - aiDate[i + astrCashTenor.length] = dtIRSEffective.addTenor (astrIRSTenor[i]).julian(); - - aCompCalib[i + astrCashTenor.length] = OTCIRS ( - dtIRSEffective, - strCurrency, - astrIRSTenor[i], - 0. - ); - } - - /* - * Build the IR curve from the components, their calibration measures, and their calibration quotes. - */ - - return ScenarioDiscountCurveBuilder.NonlinearBuild ( - dtStart, - strCurrency, - aCompCalib, - adblCompCalibValue, - astrCalibMeasure, - null - ); - } - - /* - * Sample demonstrating creation of a set of the on-the-run treasury bonds - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final TreasuryComponent[] OTRTreasurySet ( - final JulianDate dt, - final String[] astrTenor, - final double[] adblCoupon) - throws Exception - { - TreasuryComponent aTreasury[] = new TreasuryComponent[astrTenor.length]; - - for (int i = 0; i < astrTenor.length; ++i) - aTreasury[i] = TreasuryBuilder.FromCode ( - "UST", - dt, - dt.addTenor (astrTenor[i]), - adblCoupon[i] - ); - - return aTreasury; - } - - /* - * Sample demonstrating building of the treasury discount curve based off the on-the run instruments and their yields - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final GovvieCurve BuildOnTheRunGovvieCurve ( - final JulianDate dt, - final Bond[] aTreasury, - final double[] adblYield) - throws Exception - { - return ScenarioGovvieCurveBuilder.CubicPolyShapePreserver ( - "UST", - "UST", - aTreasury[0].currency(), - dt.julian(), - aTreasury, - adblYield, - "Yield" - ); - } - - /* - * Put together a named map of treasury quotes - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CaseInsensitiveTreeMap MakeTSYQuotes ( - final String[] astrTSYTenor, - final double[] adblTSYYield) - throws Exception - { - CaseInsensitiveTreeMap mTSYQuotes = new CaseInsensitiveTreeMap(); - - for (int i = 0; i < astrTSYTenor.length; ++i) { - ProductMultiMeasure cmmq = new ProductMultiMeasure(); - - cmmq.addQuote ( - "Yield", - new MultiSided ( - "mid", - adblTSYYield[i], - Double.NaN - ), - true - ); - - mTSYQuotes.put ( - astrTSYTenor[i] + "ON", - cmmq - ); - } - - return mTSYQuotes; - } - - /* - * Print the Bond RV Measures - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final boolean PrintRVMeasures ( - final String strPrefix, - final BondRVMeasures rv) - { - if (null == rv) return false; - - System.out.println (strPrefix + "ASW: " + FormatUtil.FormatDouble (rv.asw(), 0, 0, 10000.)); - - System.out.println (strPrefix + "Bond Basis: " + FormatUtil.FormatDouble (rv.bondBasis(), 0, 0, 10000.)); - - System.out.println (strPrefix + "Convexity: " + FormatUtil.FormatDouble (rv.convexity(), 0, 2, 1000000.)); - - System.out.println (strPrefix + "Credit Basis: " + FormatUtil.FormatDouble (rv.creditBasis(), 0, 0, 10000.)); - - System.out.println (strPrefix + "Discount Margin: " + FormatUtil.FormatDouble (rv.discountMargin(), 0, 0, 10000.)); - - System.out.println (strPrefix + "G Spread: " + FormatUtil.FormatDouble (rv.gSpread(), 0, 0, 10000.)); - - System.out.println (strPrefix + "I Spread: " + FormatUtil.FormatDouble (rv.iSpread(), 0, 0, 10000.)); - - System.out.println (strPrefix + "Macaulay Duration: " + FormatUtil.FormatDouble (rv.macaulayDuration(), 0, 2, 1.)); - - System.out.println (strPrefix + "Modified Duration: " + FormatUtil.FormatDouble (rv.modifiedDuration(), 0, 2, 10000.)); - - System.out.println (strPrefix + "OAS: " + FormatUtil.FormatDouble (rv.oas(), 0, 0, 10000.)); - - System.out.println (strPrefix + "PECS: " + FormatUtil.FormatDouble (rv.pecs(), 0, 0, 10000.)); - - System.out.println (strPrefix + "Price: " + FormatUtil.FormatDouble (rv.price(), 0, 3, 100.)); - - System.out.println (strPrefix + "TSY Spread: " + FormatUtil.FormatDouble (rv.tsySpread(), 0, 0, 10000.)); - - try { - System.out.println (strPrefix + "Workout Date: " + new JulianDate (rv.wi().date())); - } catch (Exception e) { - e.printStackTrace(); - } - - System.out.println (strPrefix + "Workout Factor: " + rv.wi().factor()); - - System.out.println (strPrefix + "Workout Type: " + rv.wi().type()); - - System.out.println (strPrefix + "Workout Yield: " + FormatUtil.FormatDouble (rv.wi().yield(), 0, 3, 100.)); - - System.out.println (strPrefix + "Yield01: " + FormatUtil.FormatDouble (rv.yield01(), 0, 2, 10000.)); - - System.out.println (strPrefix + "Yield Basis: " + FormatUtil.FormatDouble (rv.bondBasis(), 0, 0, 10000.)); - - System.out.println (strPrefix + "Yield Spread: " + FormatUtil.FormatDouble (rv.bondBasis(), 0, 0, 10000.)); - - System.out.println (strPrefix + "Z Spread: " + FormatUtil.FormatDouble (rv.zSpread(), 0, 0, 10000.)); - - return true; - } - - /* - * Sample demonstrating invocation and extraction of RV Measures from a bond - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void BondRVMeasuresSample() - throws Exception - { - JulianDate dtCurve = DateUtil.CreateFromYMD ( - 2013, - 6, - 27 - ); - - JulianDate dtSettle = DateUtil.CreateFromYMD ( - 2013, - 7, - 1 - ); - - /* - * Create the discount curve from rates instruments. - */ - - String[] astrCashTenor = new String[] {"3M"}; - double[] adblCashRate = new double[] {0.00276}; - String[] astrIRSTenor = new String[] { "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", - "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y"}; - double[] adblIRSRate = new double[] {0.00367, 0.00533, 0.00843, 0.01238, 0.01609, 0.01926, 0.02191, - 0.02406, 0.02588, 0.02741, 0.02870, 0.02982, 0.03208, 0.03372, 0.03445, 0.03484, 0.03501, 0.03484}; - String[] astrTSYTenor = new String[] { - "1Y", "2Y", "3Y", "5Y", "7Y", "10Y", "30Y" - }; - final double[] adblTSYCoupon = new double[] { - 0.0000, 0.00375, 0.00500, 0.0100, 0.01375, 0.01375, 0.02875 - }; - double[] adblTSYYield = new double[] { - 0.00160, 0.00397, 0.00696, 0.01421, 0.01955, 0.02529, 0.03568 - }; - - MergedDiscountForwardCurve dc = BuildRatesCurveFromInstruments ( - dtCurve, - astrCashTenor, - adblCashRate, - astrIRSTenor, - adblIRSRate, - 0., - "USD" - ); - - TreasuryComponent[] aTSYBond = OTRTreasurySet ( - dtCurve, - astrTSYTenor, - adblTSYCoupon - ); - - /* - * Create the on-the-run treasury discount curve. - */ - - GovvieCurve gc = BuildOnTheRunGovvieCurve ( - dtCurve, - aTSYBond, - adblTSYYield - ); - - BondComponent bond = BondBuilder.CreateSimpleFixed ( // Simple Fixed Rate Bond - "TEST", // Name - "USD", // Currency - "", // Credit Curve - Empty for now - 0.0875, // Bond Coupon - 2, // Frequency - "30/360", // Day Count - DateUtil.CreateFromYMD ( - 2010, - 3, - 17 - ), // Effective - DateUtil.CreateFromYMD ( - 2015, - 4, - 1 - ), // Maturity - null, // Principal Schedule - null - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - gc, - null, - null, - null, - MakeTSYQuotes ( - astrTSYTenor, - adblTSYYield - ), - null - ); - - ValuationParams valParams = ValuationParams.Spot ( - dtSettle, - 0, - "", - Convention.DATE_ROLL_ACTUAL - ); - - double dblPrice = 1.1025; - - /* - * Compute the work-out date given the price. - */ - - WorkoutInfo wi = bond.exerciseYieldFromPrice ( - valParams, - mktParams, - null, - dblPrice - ); - - /* - * Compute the base RV measures to the work-out date. - */ - - BondRVMeasures rvm = bond.standardMeasures ( - valParams, - null, - mktParams, - null, - wi, - dblPrice - ); - - PrintRVMeasures ("\tBase: ", rvm); - - MergedDiscountForwardCurve dcBumped = BuildRatesCurveFromInstruments ( - dtCurve, - astrCashTenor, - adblCashRate, - astrIRSTenor, - adblIRSRate, - 0.0001, - "USD" - ); - - mktParams.setFundingState (dcBumped); - - /* - * Compute the bumped RV measures to the work-out date. - */ - - org.drip.analytics.output.BondRVMeasures rvmBumped = bond.standardMeasures ( - valParams, - null, - mktParams, - null, - wi, - dblPrice - ); - - PrintRVMeasures ("\tBumped: ", rvmBumped); - } - - public static final void main ( - final String astrArgs[]) - throws Exception - { - // String strConfig = "c:\\Lakshmi\\BondAnal\\Config.xml"; - - String strConfig = ""; - - EnvManager.InitEnv (strConfig); - - BondRVMeasuresSample(); - } -} diff --git a/org/drip/sample/bondapi/FixedCouponBond.java b/org/drip/sample/bondapi/FixedCouponBond.java deleted file mode 100644 index 81d3973..0000000 --- a/org/drip/sample/bondapi/FixedCouponBond.java +++ /dev/null @@ -1,265 +0,0 @@ - -package org.drip.sample.bondapi; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.service.env.EnvManager; -import org.drip.service.product.FixedBondAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FixedCouponBond demonstrates the Invocation and Examination of the Metrics for the Fixed Coupon Bond. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixedCouponBond { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDate = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ).julian(); - - String[] astrFundingCurveDepositTenor = new String[] { - "2D", - "1W", - "1M", - "2M", - "3M" - }; - - double[] adblFundingCurveDepositQuote = new double[] { - 0.00195, // 2D - 0.00176, // 1W - 0.00301, // 1M - 0.00401, // 2M - 0.00492 // 3M - }; - - String strFundingCurveDepositMeasure = "ForwardRate"; - - double[] adblFundingCurveFuturesQuote = new double[] { - 0.00609, - 0.00687 - }; - - String strFundingCurveFuturesMeasure = "ForwardRate"; - - String[] astrFundingCurveFixFloatTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFundingCurveFixFloatQuote = new double[] { - 0.00762, // 1Y - 0.01055, // 2Y - 0.01300, // 3Y - 0.01495, // 4Y - 0.01651, // 5Y - 0.01787, // 6Y - 0.01904, // 7Y - 0.02005, // 8Y - 0.02090, // 9Y - 0.02166, // 10Y - 0.02231, // 11Y - 0.02289, // 12Y - 0.02414, // 15Y - 0.02570, // 20Y - 0.02594, // 25Y - 0.02627, // 30Y - 0.02648, // 40Y - 0.02632 // 50Y - }; - - String strFundingFixFloatMeasure = "SwapRate"; - - int[] aiGovvieCurveTreasuryEffectiveDate = new int[] { - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate - }; - - int[] aiGovvieCurveTreasuryMaturityDate = new int[] { - new JulianDate (iSpotDate).addTenor ("1Y").julian(), - new JulianDate (iSpotDate).addTenor ("2Y").julian(), - new JulianDate (iSpotDate).addTenor ("3Y").julian(), - new JulianDate (iSpotDate).addTenor ("5Y").julian(), - new JulianDate (iSpotDate).addTenor ("7Y").julian(), - new JulianDate (iSpotDate).addTenor ("10Y").julian(), - new JulianDate (iSpotDate).addTenor ("30Y").julian() - }; - - double[] adblGovvieCurveTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblGovvieCurveTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - String strGovvieCurveTreasuryMeasure = "Yield"; - - String[] astrCreditCurveCDSTenor = new String[] { - "06M", - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "07Y", - "10Y" - }; - - double[] adblCreditCurveCDSCoupon = new double[] { - 60., // 6M - 68., // 1Y - 88., // 2Y - 102., // 3Y - 121., // 4Y - 138., // 5Y - 168., // 7Y - 188. // 10Y - }; - - String strIssuerName = "AEG"; - double dblBondCoupon = 0.0560; - int iBondCouponFrequency = 2; - String strBondCouponDayCount = "30/360"; - String strBondCouponCurrency = "USD"; - String strBondMarketQuoteName = "Price"; - double dblBondMarketQuote = 1.17460; - String strGovvieCode = "UST"; - - int iBondEffectiveDate = DateUtil.CreateFromYMD ( - 2011, - DateUtil.JULY, - 21 - ).julian(); - - int iBondMaturityDate = DateUtil.CreateFromYMD ( - 2041, - DateUtil.JULY, - 15 - ).julian(); - - Map mapBondMetrics = FixedBondAPI.ValuationMetrics ( - strIssuerName, - iBondEffectiveDate, - iBondMaturityDate, - dblBondCoupon, - iBondCouponFrequency, - strBondCouponDayCount, - strBondCouponCurrency, - iSpotDate, - astrFundingCurveDepositTenor, - adblFundingCurveDepositQuote, - strFundingCurveDepositMeasure, - adblFundingCurveFuturesQuote, - strFundingCurveFuturesMeasure, - astrFundingCurveFixFloatTenor, - adblFundingCurveFixFloatQuote, - strFundingFixFloatMeasure, - strGovvieCode, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - strIssuerName, - astrCreditCurveCDSTenor, - adblCreditCurveCDSCoupon, - adblCreditCurveCDSCoupon, - "FairPremium", - strBondMarketQuoteName, - dblBondMarketQuote - ); - - for (Map.Entry me : mapBondMetrics.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/bondapi/FixedCouponKeyRateDuration.java b/org/drip/sample/bondapi/FixedCouponKeyRateDuration.java deleted file mode 100644 index 78e6f4e..0000000 --- a/org/drip/sample/bondapi/FixedCouponKeyRateDuration.java +++ /dev/null @@ -1,350 +0,0 @@ - -package org.drip.sample.bondapi; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.FixedBondAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FixedCouponKeyRateDuration demonstrates the Invocation and Examination of the Key Rate Duration - * Computation for the Specified Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixedCouponKeyRateDuration { - - private static void ComputeKeyRateDuration ( - final java.lang.String strIssuerName, - final JulianDate dtBondEffective, - final JulianDate dtBondMaturity, - final double dblBondCoupon, - final int iBondCouponFrequency, - final java.lang.String strBondCouponDayCount, - final java.lang.String strBondCouponCurrency, - final int iSpotDate, - final java.lang.String strGovvieCode, - final int[] aiGovvieCurveTreasuryEffectiveDate, - final int[] aiGovvieCurveTreasuryMaturityDate, - final double[] adblGovvieCurveTreasuryCoupon, - final double[] adblGovvieCurveTreasuryYield, - final java.lang.String strGovvieCurveTreasuryMeasure, - final double dblBondMarketCleanPrice, - final boolean bHeader, - final boolean bTrailer) - throws Exception - { - Map mapKeyRateDuration = FixedBondAPI.KeyRateDuration ( - strIssuerName, - dtBondEffective.julian(), - dtBondMaturity.julian(), - dblBondCoupon, - iBondCouponFrequency, - strBondCouponDayCount, - strBondCouponCurrency, - iSpotDate, - strGovvieCode, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - dblBondMarketCleanPrice - ); - - if (bHeader) { - System.out.println ("\n\t|------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print ("\t| ISSUE |"); - - Set setstrKey = mapKeyRateDuration.keySet(); - - for (String strKey : setstrKey) - System.out.print (" " + strKey + " |"); - - System.out.println ("|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------||"); - } - - System.out.print ("\t| " + strIssuerName + FormatUtil.FormatDouble (dblBondCoupon, 1, 4, 100.) + " " + dtBondMaturity + " |"); - - for (Map.Entry me : mapKeyRateDuration.entrySet()) - System.out.print (" " + FormatUtil.FormatDouble (-1. * me.getValue(), 1, 5, 1.) + " |"); - - System.out.println ("|"); - - if (bTrailer) - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------||"); - } - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDate = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ).julian(); - - int[] aiGovvieCurveTreasuryEffectiveDate = new int[] { - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate - }; - - int[] aiGovvieCurveTreasuryMaturityDate = new int[] { - new JulianDate (iSpotDate).addTenor ("1Y").julian(), - new JulianDate (iSpotDate).addTenor ("2Y").julian(), - new JulianDate (iSpotDate).addTenor ("3Y").julian(), - new JulianDate (iSpotDate).addTenor ("5Y").julian(), - new JulianDate (iSpotDate).addTenor ("7Y").julian(), - new JulianDate (iSpotDate).addTenor ("10Y").julian(), - new JulianDate (iSpotDate).addTenor ("30Y").julian() - }; - - double[] adblGovvieCurveTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblGovvieCurveTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - String strGovvieCurveTreasuryMeasure = "Yield"; - - String strIssuerName = "AEG"; - int iBondCouponFrequency = 2; - String strBondCouponDayCount = "30/360"; - String strBondCouponCurrency = "USD"; - String strGovvieCode = "UST"; - - ComputeKeyRateDuration ( - strIssuerName, - DateUtil.CreateFromYMD (2007, 12, 20), - DateUtil.CreateFromYMD (2018, 1, 15), - 0.06000, - iBondCouponFrequency, - strBondCouponDayCount, - strBondCouponCurrency, - iSpotDate, - strGovvieCode, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - 1.08529, - true, - false - ); - - ComputeKeyRateDuration ( - strIssuerName, - DateUtil.CreateFromYMD (1996, 7, 25), - DateUtil.CreateFromYMD (2025, 7, 15), - 0.07750, - iBondCouponFrequency, - strBondCouponDayCount, - strBondCouponCurrency, - iSpotDate, - strGovvieCode, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - 1.27021, - false, - false - ); - - ComputeKeyRateDuration ( - strIssuerName, - DateUtil.CreateFromYMD (1996, 10, 29), - DateUtil.CreateFromYMD (2026, 10, 15), - 0.07625, - iBondCouponFrequency, - strBondCouponDayCount, - strBondCouponCurrency, - iSpotDate, - strGovvieCode, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - 1.27274, - false, - false - ); - - ComputeKeyRateDuration ( - strIssuerName, - DateUtil.CreateFromYMD (2014, 12, 9), - DateUtil.CreateFromYMD (2026, 12, 15), - 0.04125, - iBondCouponFrequency, - strBondCouponDayCount, - strBondCouponCurrency, - iSpotDate, - strGovvieCode, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - 1.01235, - false, - false - ); - - ComputeKeyRateDuration ( - strIssuerName, - DateUtil.CreateFromYMD (1997, 4, 29), - DateUtil.CreateFromYMD (2027, 4, 29), - 0.08000, - iBondCouponFrequency, - strBondCouponDayCount, - strBondCouponCurrency, - iSpotDate, - strGovvieCode, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - 1.31527, - false, - false - ); - - ComputeKeyRateDuration ( - strIssuerName, - DateUtil.CreateFromYMD (2014, 9, 25), - DateUtil.CreateFromYMD (2027, 10, 1), - 0.04250, - iBondCouponFrequency, - strBondCouponDayCount, - strBondCouponCurrency, - iSpotDate, - strGovvieCode, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - 1.02263, - false, - false - ); - - ComputeKeyRateDuration ( - strIssuerName, - DateUtil.CreateFromYMD (2008, 5, 22), - DateUtil.CreateFromYMD (2038, 5, 15), - 0.06400, - iBondCouponFrequency, - strBondCouponDayCount, - strBondCouponCurrency, - iSpotDate, - strGovvieCode, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - 1.27570, - false, - false - ); - - ComputeKeyRateDuration ( - strIssuerName, - DateUtil.CreateFromYMD (2011, 7, 21), - DateUtil.CreateFromYMD (2041, 7, 15), - 0.05600, - iBondCouponFrequency, - strBondCouponDayCount, - strBondCouponCurrency, - iSpotDate, - strGovvieCode, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - 1.17460, - false, - true - ); - } -} diff --git a/org/drip/sample/bondapi/FixedCouponRVMeasures.java b/org/drip/sample/bondapi/FixedCouponRVMeasures.java deleted file mode 100644 index c31d25f..0000000 --- a/org/drip/sample/bondapi/FixedCouponRVMeasures.java +++ /dev/null @@ -1,356 +0,0 @@ - -package org.drip.sample.bondapi; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.analytics.output.BondRVMeasures; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.FixedBondAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FixedCouponRVMeasures demonstrates the Invocation and Examination of the Relative Value Metrics for the - * Fixed Coupon Bond. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixedCouponRVMeasures { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDate = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ).julian(); - - String[] astrFundingCurveDepositTenor = new String[] { - "2D", - "1W", - "1M", - "2M", - "3M" - }; - - double[] adblFundingCurveDepositQuote = new double[] { - 0.00195, // 2D - 0.00176, // 1W - 0.00301, // 1M - 0.00401, // 2M - 0.00492 // 3M - }; - - String strFundingCurveDepositMeasure = "ForwardRate"; - - double[] adblFundingCurveFuturesQuote = new double[] { - 0.00609, - 0.00687 - }; - - String strFundingCurveFuturesMeasure = "ForwardRate"; - - String[] astrFundingCurveFixFloatTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFundingCurveFixFloatQuote = new double[] { - 0.00762, // 1Y - 0.01055, // 2Y - 0.01300, // 3Y - 0.01495, // 4Y - 0.01651, // 5Y - 0.01787, // 6Y - 0.01904, // 7Y - 0.02005, // 8Y - 0.02090, // 9Y - 0.02166, // 10Y - 0.02231, // 11Y - 0.02289, // 12Y - 0.02414, // 15Y - 0.02570, // 20Y - 0.02594, // 25Y - 0.02627, // 30Y - 0.02648, // 40Y - 0.02632 // 50Y - }; - - String strFundingFixFloatMeasure = "SwapRate"; - - int[] aiGovvieCurveTreasuryEffective = new int[] { - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate - }; - - int[] aiGovvieCurveTreasuryMaturity = new int[] { - new JulianDate (iSpotDate).addTenor ("1Y").julian(), - new JulianDate (iSpotDate).addTenor ("2Y").julian(), - new JulianDate (iSpotDate).addTenor ("3Y").julian(), - new JulianDate (iSpotDate).addTenor ("5Y").julian(), - new JulianDate (iSpotDate).addTenor ("7Y").julian(), - new JulianDate (iSpotDate).addTenor ("10Y").julian(), - new JulianDate (iSpotDate).addTenor ("30Y").julian() - }; - - double[] adblGovvieCurveTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblGovvieCurveTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - String strGovvieCurveTreasuryMeasure = "Yield"; - - String[] astrCreditCurveCDSTenor = new String[] { - "06M", - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "07Y", - "10Y" - }; - - double[] adblCreditCurveCDSCoupon = new double[] { - 60., // 6M - 68., // 1Y - 88., // 2Y - 102., // 3Y - 121., // 4Y - 138., // 5Y - 168., // 7Y - 188. // 10Y - }; - - String strIssuerName = "AEG"; - int iBondCouponFrequency = 2; - String strBondCouponDayCount = "30/360"; - String strBondCouponCurrency = "USD"; - String strGovvieCode = "UST"; - - JulianDate[] adtBondEffective = new JulianDate[] { - DateUtil.CreateFromYMD (2007, 12, 20), - DateUtil.CreateFromYMD (1996, 7, 25), - DateUtil.CreateFromYMD (1996, 10, 29), - DateUtil.CreateFromYMD (2014, 12, 9), - DateUtil.CreateFromYMD (1997, 4, 29), - DateUtil.CreateFromYMD (2014, 9, 25), - DateUtil.CreateFromYMD (2008, 5, 22), - DateUtil.CreateFromYMD (2011, 7, 21) - }; - - JulianDate[] adtBondMaturity = new JulianDate[] { - DateUtil.CreateFromYMD (2018, 1, 15), - DateUtil.CreateFromYMD (2025, 7, 15), - DateUtil.CreateFromYMD (2026, 10, 15), - DateUtil.CreateFromYMD (2026, 12, 15), - DateUtil.CreateFromYMD (2027, 4, 29), - DateUtil.CreateFromYMD (2027, 10, 1), - DateUtil.CreateFromYMD (2038, 5, 15), - DateUtil.CreateFromYMD (2041, 7, 15) - }; - - double[] adblBondCoupon = new double[] { - 0.06000, - 0.07750, - 0.07625, - 0.04125, - 0.08000, - 0.04250, - 0.06400, - 0.05600 - }; - - double[] adblCleanPrice = new double[] { - 1.08529, - 1.27021, - 1.27274, - 1.01235, - 1.31537, - 1.02263, - 1.27570, - 1.17460 - }; - - BondRVMeasures[] aBMRV = new BondRVMeasures[adblCleanPrice.length]; - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| Issuer Bond Relative Value Metrics ||"); - - System.out.println ("\t| ------ ---- -------- ----- ------- ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| L -> R ||"); - - System.out.println ("\t| Bond Issue Name ||"); - - System.out.println ("\t| Asset Swap Spread ||"); - - System.out.println ("\t| Bond Basis ||"); - - System.out.println ("\t| Credit Basis ||"); - - System.out.println ("\t| Discount Margin ||"); - - System.out.println ("\t| G Spread ||"); - - System.out.println ("\t| I Spread ||"); - - System.out.println ("\t| Option Adjusted Spread ||"); - - System.out.println ("\t| Par Equivalent CDS Spread (PECS) ||"); - - System.out.println ("\t| Treasury Spread ||"); - - System.out.println ("\t| Yield Spread ||"); - - System.out.println ("\t| Z Spread ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < adblCleanPrice.length; ++i) { - aBMRV[i] = FixedBondAPI.RelativeValueMetrics ( - strIssuerName, - adtBondEffective[i].julian(), - adtBondMaturity[i].julian(), - adblBondCoupon[i], - iBondCouponFrequency, - strBondCouponDayCount, - strBondCouponCurrency, - iSpotDate, - astrFundingCurveDepositTenor, - adblFundingCurveDepositQuote, - strFundingCurveDepositMeasure, - adblFundingCurveFuturesQuote, - strFundingCurveFuturesMeasure, - astrFundingCurveFixFloatTenor, - adblFundingCurveFixFloatQuote, - strFundingFixFloatMeasure, - strGovvieCode, - aiGovvieCurveTreasuryEffective, - aiGovvieCurveTreasuryMaturity, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - strIssuerName, - astrCreditCurveCDSTenor, - adblCreditCurveCDSCoupon, - adblCreditCurveCDSCoupon, - "FairPremium", - adblCleanPrice[i] - ); - - Map mapRV = aBMRV[i].toMap (""); - - System.out.println ( - "\t| " + strIssuerName + " " + FormatUtil.FormatDouble (adblBondCoupon[i], 1, 4, 100.) + " " + adtBondMaturity[i] + " " + - " | " + FormatUtil.FormatDouble (mapRV.get ("AssetSwapSpread"), 3, 0, 10000.) + - " | " + FormatUtil.FormatDouble (mapRV.get ("BondBasis"), 3, 0, 10000.) + - " | " + FormatUtil.FormatDouble (mapRV.get ("CreditBasis"), 3, 0, 1.) + - " | " + FormatUtil.FormatDouble (mapRV.get ("DiscountMargin"), 3, 0, 1.) + - " | " + FormatUtil.FormatDouble (mapRV.get ("GSpread"), 3, 0, 10000.) + - " | " + FormatUtil.FormatDouble (mapRV.get ("ISpread"), 3, 0, 10000.) + - " | " + FormatUtil.FormatDouble (mapRV.get ("OAS"), 3, 0, 10000.) + - " | " + FormatUtil.FormatDouble (mapRV.get ("PECS"), 3, 0, 1.) + - " | " + FormatUtil.FormatDouble (mapRV.get ("TSYSpread"), 3, 0, 10000.) + - " | " + FormatUtil.FormatDouble (mapRV.get ("YieldSpread"), 3, 0, 10000.) + - " | " + FormatUtil.FormatDouble (mapRV.get ("ZSpread"), 3, 0, 10000.) + " ||" - ); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/bondfixed/BulletAgency.java b/org/drip/sample/bondfixed/BulletAgency.java deleted file mode 100644 index 2ccfa6c..0000000 --- a/org/drip/sample/bondfixed/BulletAgency.java +++ /dev/null @@ -1,788 +0,0 @@ - -package org.drip.sample.bondfixed; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.analytics.output.BondRVMeasures; -import org.drip.analytics.support.Helper; -import org.drip.param.creator.MarketParamsBuilder; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.quote.MultiSided; -import org.drip.param.quote.ProductMultiMeasure; -import org.drip.param.valuation.ValuationParams; -import org.drip.param.valuation.WorkoutInfo; -import org.drip.product.creator.BondBuilder; -import org.drip.product.credit.BondComponent; -import org.drip.product.definition.Bond; -import org.drip.product.definition.Component; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.govvie.GovvieCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * BulletAgency demonstrates Non-EOS Fixed Coupon Agency Bond Pricing and Relative Value Measure Generation - * Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class BulletAgency { - - private static final MergedDiscountForwardCurve FundingCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrDepositMaturityTenor = new String[] { - "2D" - }; - - double[] adblDepositQuote = new double[] { - 0.0103456 // 2D - }; - - double[] adblFuturesQuote = new double[] { - 0.01070, - 0.01235, - 0.01360 - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.012484, // 1Y - 0.014987, // 2Y - 0.017036, // 3Y - 0.018624, // 4Y - 0.019868, // 5Y - 0.020921, // 6Y - 0.021788, // 7Y - 0.022530, // 8Y - 0.023145, // 9Y - 0.023685, // 10Y - 0.024153, // 11Y - 0.024562, // 12Y - 0.025389, // 15Y - 0.026118, // 20Y - 0.026368, // 25Y - 0.026432, // 30Y - 0.026339, // 40Y - 0.026122 // 50Y - }; - - MergedDiscountForwardCurve dcFunding = LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - adblFuturesQuote, - "ForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate" - ); - - Component[] aDepositComp = OTCInstrumentBuilder.FundingDeposit ( - dtSpot, - strCurrency, - astrDepositMaturityTenor - ); - - Component[] aFuturesComp = ExchangeInstrumentBuilder.ForwardRateFuturesPack ( - dtSpot, - adblFuturesQuote.length, - strCurrency - ); - - Component[] aFixFloatComp = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - astrFixFloatMaturityTenor, - "MAIN", - 0. - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - System.out.println(); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println ("\t| DEPOSIT INPUT vs. CALC ||"); - - System.out.println ("\t|-------------------------------------||"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t| [" + aDepositComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aDepositComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println(); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println ("\t| FUTURES INPUT vs. CALC ||"); - - System.out.println ("\t|-------------------------------------||"); - - for (int i = 0; i < aFuturesComp.length; ++i) - System.out.println ("\t| [" + aFuturesComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFuturesComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFuturesQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println(); - - System.out.println ("\t|------------------------------------------------|| "); - - System.out.println ("\t| FIX-FLOAT INPUTS vs CALIB ||"); - - System.out.println ("\t|------------------------------------------------|| "); - - for (int i = 0; i < aFixFloatComp.length; ++i) - System.out.println ("\t| [" + aFixFloatComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "CalibSwapRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFixFloatQuote[i], 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "FairPremium" - ), 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|------------------------------------------------||"); - - System.out.println(); - - return dcFunding; - } - - private static final Map GovvieCurve ( - final JulianDate dtSpot, - final String strCode, - final double[] adblCoupon, - final double[] adblYield) - throws Exception - { - JulianDate[] adtEffective = new JulianDate[] { - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot - }; - - JulianDate[] adtMaturity = new JulianDate[] { - dtSpot.addTenor ("1Y"), - dtSpot.addTenor ("2Y"), - dtSpot.addTenor ("3Y"), - dtSpot.addTenor ("5Y"), - dtSpot.addTenor ("7Y"), - dtSpot.addTenor ("10Y"), - dtSpot.addTenor ("20Y"), - dtSpot.addTenor ("30Y") - }; - - Map mapGovvieCurve = LatentMarketStateBuilder.BumpedGovvieCurve ( - strCode, - dtSpot, - adtEffective, - adtMaturity, - adblCoupon, - adblYield, - "Yield", - LatentMarketStateBuilder.SHAPE_PRESERVING, - 0.0001, - false - ); - - BondComponent[] aComp = TreasuryBuilder.FromCode ( - strCode, - adtEffective, - adtMaturity, - adblCoupon - ); - - ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setGovvieState (mapGovvieCurve.get ("BASE")); - - System.out.println(); - - System.out.println ("\t|-------------------------------------------||"); - - System.out.println ("\t| TREASURY INPUT vs CALIB YIELD ||"); - - System.out.println ("\t|-------------------------------------------||"); - - for (int i = 0; i < aComp.length; ++i) - System.out.println ("\t| " + aComp[i].name() + " | " + - FormatUtil.FormatDouble (adblYield[i], 1, 3, 100.) + "% | " + - FormatUtil.FormatDouble (aComp[i].yieldFromPrice ( - valParams, - null, - null, - aComp[i].maturityDate().julian(), - 1., - aComp[i].priceFromYield ( - valParams, - null, - null, - mapGovvieCurve.get ("BASE").yield (aComp[i].maturityDate().julian()) - ) - ), 1, 3, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------------------------------||"); - - return mapGovvieCurve; - } - - private static final void AccumulateBondMarketQuote ( - final CurveSurfaceQuoteContainer csqc, - final String[] astrOnTheRunCode, - final double[] adblYield) - throws Exception - { - for (int i = 0; i < astrOnTheRunCode.length; ++i) { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Yield", - new MultiSided ( - "mid", - adblYield[i] - ), - true - ); - - csqc.setProductQuote ( - astrOnTheRunCode[i], - pmmq - ); - } - } - - private static final Bond Agency ( - final JulianDate dtEffective, - final JulianDate dtMaturity, - final double dblCoupon) - throws Exception - { - return BondBuilder.CreateSimpleFixed ( - "AGENCY " + FormatUtil.FormatDouble (dblCoupon, 1, 4, 100.) + " " + dtMaturity, - "USD", - "", - dblCoupon, - 2, - "30/360", - dtEffective, - dtMaturity, - null, - null - ); - } - - private static final double[] RVMeasures ( - final Bond[] aBond, - final JulianDate dtValue, - final CurveSurfaceQuoteContainer csqc, - final double[] adblCleanPrice) - throws Exception - { - JulianDate dtSettle = dtValue.addBusDays ( - 3, - aBond[0].currency() - ); - - ValuationParams valParams = new ValuationParams ( - dtValue, - dtSettle, - aBond[0].currency() - ); - - System.out.println(); - - System.out.println ("\t|--------------------------------||"); - - System.out.println ("\t| Trade Date : " + dtValue + " ||"); - - System.out.println ("\t| Cash Settle Date : " + dtSettle + " ||"); - - System.out.println ("\t|--------------------------------||"); - - System.out.println(); - - String strCurveMetrics = ""; - String strSecularMetrics = ""; - double[] adblOAS = new double[aBond.length]; - - for (int i = 0; i < aBond.length; ++i) { - System.out.println ("Doing " + aBond[i].name()); - - WorkoutInfo wi = aBond[i].exerciseYieldFromPrice ( - valParams, - csqc, - null, - adblCleanPrice[i] - ); - - BondRVMeasures rvm = aBond[i].standardMeasures ( - valParams, - null, - csqc, - null, - wi, - adblCleanPrice[i] - ); - - strSecularMetrics += "\t| " + - aBond[i].name() + " | " + - aBond[i].effectiveDate() + " | " + - aBond[i].maturityDate() + " | " + - aBond[i].firstCouponDate() + " |" + - FormatUtil.FormatDouble (adblCleanPrice[i], 3, 3, 100.) + " |" + - FormatUtil.FormatDouble (wi.yield(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (rvm.macaulayDuration(), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (rvm.modifiedDuration(), 2, 2, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.yield01(), 2, 2, 10000.) + " |" + - FormatUtil.FormatDouble (rvm.yield01(), 4, 0, 1000000.) + " |" + - FormatUtil.FormatDouble (rvm.convexity(), 1, 2, 1000000.) + " | " + - FormatUtil.FormatDouble (rvm.bondBasis(), 3, 0, 10000.) + " ||" + "\n"; - - adblOAS[i] = rvm.oas(); - - double dblCleanPriceOASUp = aBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] + 0.0001 - ); - - double dblCleanPriceOASDown = aBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] - 0.0001 - ); - - strCurveMetrics += "\t| " + - aBond[i].name() + " |" + - FormatUtil.FormatDouble (adblCleanPrice[i], 3, 3, 100.) + " |" + - FormatUtil.FormatDouble (wi.yield(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (rvm.zSpread(), 3, 0, 10000.) + " |" + - FormatUtil.FormatDouble (adblOAS[i], 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (0.5 * (dblCleanPriceOASDown - dblCleanPriceOASUp) / adblCleanPrice[i], 2, 2, 10000.) + " | " + - FormatUtil.FormatDouble ((dblCleanPriceOASDown + dblCleanPriceOASUp - 2. * adblCleanPrice[i]) / adblCleanPrice[i], 2, 2, 1000000.) + " |" + - FormatUtil.FormatDouble (rvm.asw(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.gSpread(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.iSpread(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.tsySpread(), 3, 0, 10000.) + " | " + - Helper.BaseTsyBmk ( - dtValue.julian(), - aBond[i].maturityDate().julian() - ) + " ||" + "\n"; - } - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| BOND | EFFECTIVE | MATURITY | FIRST COUPON | PRICE | YIELD | MAC DUR | MOD DUR | YIELD 01 | DV01 | CONV | BOND BASIS ||"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print (strSecularMetrics); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||\n"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| BOND | PRICE | YIELD | Z SPREAD | OAS | OAS DUR | OAS CONV | ASW | G SPREAD | I SPREAD | TSY SPREAD | TSY BMK ||"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print (strCurveMetrics); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------||"); - - return adblOAS; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2017, - DateUtil.FEBRUARY, - 2 - ); - - String strCurrency = "USD"; - String strTreasuryCode = "UST"; - - MergedDiscountForwardCurve dcFunding = FundingCurve ( - dtSpot, - strCurrency - ); - - double[] adblTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0250, - 0.0300 - }; - - double[] adblTreasuryYield = new double[] { - 0.0083, // 1Y - 0.0122, // 2Y - 0.0149, // 3Y - 0.0193, // 5Y - 0.0227, // 7Y - 0.0248, // 10Y - 0.0280, // 20Y - 0.0308 // 30Y - }; - - Map mapGovvieCurve = GovvieCurve ( - dtSpot, - strTreasuryCode, - adblTreasuryCoupon, - adblTreasuryYield - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - csqc.setGovvieState (mapGovvieCurve.get ("BASE")); - - AccumulateBondMarketQuote ( - csqc, - new String[] { - "01YON", - "02YON", - "03YON", - "05YON", - "07YON", - "10YON", - "20YON", - "30YON" - }, - adblTreasuryYield - ); - - Bond[] aAgencyBond = new Bond[] { - Agency (DateUtil.CreateFromYMD (2016, 8, 30), DateUtil.CreateFromYMD (2028, 8, 28), 0.01000), - Agency (DateUtil.CreateFromYMD (2012, 10, 30), DateUtil.CreateFromYMD (2020, 4, 30), 0.01500), - Agency (DateUtil.CreateFromYMD (2016, 1, 12), DateUtil.CreateFromYMD (2026, 1, 12), 0.03020), - Agency (DateUtil.CreateFromYMD (2016, 7, 12), DateUtil.CreateFromYMD (2027, 7, 12), 0.02500), - Agency (DateUtil.CreateFromYMD (2013, 4, 10), DateUtil.CreateFromYMD (2028, 4, 10), 0.04000), - Agency (DateUtil.CreateFromYMD (2013, 10, 4), DateUtil.CreateFromYMD (2028, 9, 1), 0.04000), - Agency (DateUtil.CreateFromYMD (2013, 12, 8), DateUtil.CreateFromYMD (2028, 12, 8), 0.04000), - Agency (DateUtil.CreateFromYMD (2014, 4, 11), DateUtil.CreateFromYMD (2029, 4, 11), 0.04000), - Agency (DateUtil.CreateFromYMD (2014, 6, 4), DateUtil.CreateFromYMD (2029, 6, 8), 0.03375), - Agency (DateUtil.CreateFromYMD (2015, 5, 28), DateUtil.CreateFromYMD (2029, 8, 1), 0.03350), - Agency (DateUtil.CreateFromYMD (2013, 4, 24), DateUtil.CreateFromYMD (2029, 10, 24), 0.04000), - Agency (DateUtil.CreateFromYMD (2016, 2, 8), DateUtil.CreateFromYMD (2030, 2, 8), 0.03280), - Agency (DateUtil.CreateFromYMD (2016, 9, 29), DateUtil.CreateFromYMD (2030, 3, 29), 0.02990), - Agency (DateUtil.CreateFromYMD (2015, 8, 1), DateUtil.CreateFromYMD (2030, 8, 1), 0.03500), - Agency (DateUtil.CreateFromYMD (2012, 10, 24), DateUtil.CreateFromYMD (2030, 10, 24), 0.03050), - Agency (DateUtil.CreateFromYMD (2015, 11, 27), DateUtil.CreateFromYMD (2030, 11, 27), 0.03300), - Agency (DateUtil.CreateFromYMD (2015, 12, 23), DateUtil.CreateFromYMD (2030, 12, 23), 0.03530), - Agency (DateUtil.CreateFromYMD (2016, 1, 14), DateUtil.CreateFromYMD (2031, 1, 14), 0.03340), - Agency (DateUtil.CreateFromYMD (2016, 1, 27), DateUtil.CreateFromYMD (2031, 1, 27), 0.03390), - Agency (DateUtil.CreateFromYMD (2016, 2, 11), DateUtil.CreateFromYMD (2031, 2, 11), 0.03040), - Agency (DateUtil.CreateFromYMD (2016, 3, 10), DateUtil.CreateFromYMD (2031, 3, 10), 0.03100), - Agency (DateUtil.CreateFromYMD (2016, 7, 11), DateUtil.CreateFromYMD (2031, 7, 11), 0.02750), - Agency (DateUtil.CreateFromYMD (2015, 5, 8), DateUtil.CreateFromYMD (2031, 8, 1), 0.03550), - Agency (DateUtil.CreateFromYMD (2016, 8, 8), DateUtil.CreateFromYMD (2031, 8, 8), 0.02700), - Agency (DateUtil.CreateFromYMD (2015, 6, 28), DateUtil.CreateFromYMD (2032, 6, 28), 0.02900), - Agency (DateUtil.CreateFromYMD (2015, 7, 20), DateUtil.CreateFromYMD (2032, 7, 20), 0.03500), - Agency (DateUtil.CreateFromYMD (2016, 2, 1), DateUtil.CreateFromYMD (2033, 2, 1), 0.03330), - Agency (DateUtil.CreateFromYMD (2016, 4, 21), DateUtil.CreateFromYMD (2033, 4, 21), 0.03000), - Agency (DateUtil.CreateFromYMD (2013, 10, 11), DateUtil.CreateFromYMD (2033, 10, 11), 0.04125), - Agency (DateUtil.CreateFromYMD (2014, 7, 24), DateUtil.CreateFromYMD (2034, 7, 24), 0.03990), - Agency (DateUtil.CreateFromYMD (2014, 9, 5), DateUtil.CreateFromYMD (2034, 9, 5), 0.03940), - Agency (DateUtil.CreateFromYMD (2016, 2, 2), DateUtil.CreateFromYMD (2035, 2, 2), 0.03300), - Agency (DateUtil.CreateFromYMD (2015, 6, 1), DateUtil.CreateFromYMD (2035, 6, 1), 0.03400), - Agency (DateUtil.CreateFromYMD (2015, 10, 22), DateUtil.CreateFromYMD (2035, 10, 22), 0.03625), - Agency (DateUtil.CreateFromYMD (2015, 11, 12), DateUtil.CreateFromYMD (2035, 11, 13), 0.03315), - Agency (DateUtil.CreateFromYMD (2015, 12, 28), DateUtil.CreateFromYMD (2035, 12, 28), 0.03670), - Agency (DateUtil.CreateFromYMD (2016, 2, 1), DateUtil.CreateFromYMD (2036, 2, 1), 0.03560), - Agency (DateUtil.CreateFromYMD (2016, 2, 6), DateUtil.CreateFromYMD (2036, 2, 6), 0.03130), - Agency (DateUtil.CreateFromYMD (2016, 2, 8), DateUtil.CreateFromYMD (2036, 2, 8), 0.03500), - Agency (DateUtil.CreateFromYMD (2016, 2, 22), DateUtil.CreateFromYMD (2036, 2, 22), 0.03440), - Agency (DateUtil.CreateFromYMD (2016, 4, 18), DateUtil.CreateFromYMD (2036, 4, 18), 0.03140), - Agency (DateUtil.CreateFromYMD (2016, 4, 29), DateUtil.CreateFromYMD (2036, 4, 29), 0.03000), - Agency (DateUtil.CreateFromYMD (2016, 5, 16), DateUtil.CreateFromYMD (2036, 5, 16), 0.03000), - Agency (DateUtil.CreateFromYMD (2016, 6, 9), DateUtil.CreateFromYMD (2036, 5, 20), 0.03040), - Agency (DateUtil.CreateFromYMD (2016, 5, 23), DateUtil.CreateFromYMD (2036, 5, 23), 0.03030), - Agency (DateUtil.CreateFromYMD (2006, 6, 16), DateUtil.CreateFromYMD (2036, 6, 16), 0.03000), - Agency (DateUtil.CreateFromYMD (2006, 7, 17), DateUtil.CreateFromYMD (2036, 7, 15), 0.05500), - Agency (DateUtil.CreateFromYMD (2016, 8, 22), DateUtil.CreateFromYMD (2036, 8, 22), 0.02700), - Agency (DateUtil.CreateFromYMD (2016, 9, 8), DateUtil.CreateFromYMD (2036, 9, 8), 0.02750), - Agency (DateUtil.CreateFromYMD (2016, 9, 8), DateUtil.CreateFromYMD (2036, 9, 8), 0.02700), - Agency (DateUtil.CreateFromYMD (2007, 7, 18), DateUtil.CreateFromYMD (2037, 7, 15), 0.05625), - Agency (DateUtil.CreateFromYMD (2015, 7, 6), DateUtil.CreateFromYMD (2037, 8, 6), 0.03950), - Agency (DateUtil.CreateFromYMD (2016, 11, 2), DateUtil.CreateFromYMD (2037, 11, 2), 0.02780), - Agency (DateUtil.CreateFromYMD (1998, 8, 6), DateUtil.CreateFromYMD (2038, 8, 6), 0.06210), - Agency (DateUtil.CreateFromYMD (2016, 7, 26), DateUtil.CreateFromYMD (2038, 8, 26), 0.02710), - Agency (DateUtil.CreateFromYMD (2016, 2, 2), DateUtil.CreateFromYMD (2039, 2, 2), 0.03500), - Agency (DateUtil.CreateFromYMD (2009, 9, 22), DateUtil.CreateFromYMD (2039, 9, 15), 0.05250), - Agency (DateUtil.CreateFromYMD (2016, 2, 2), DateUtil.CreateFromYMD (2041, 2, 2), 0.03650), - // Agency (DateUtil.CreateFromYMD (2015, 4, 6), DateUtil.CreateFromYMD (2045, 4, 6), 0.03430), - // Agency (DateUtil.CreateFromYMD (2006, 4, 3), DateUtil.CreateFromYMD (2056, 4, 1), 0.05375), - // Agency (DateUtil.CreateFromYMD (2015, 9, 24), DateUtil.CreateFromYMD (2065, 9, 24), 0.04250), - }; - - double[] adblCleanPrice = new double[] { - 0.9931592, // (2018, 8, 28) - 0.9934814, // (2020, 4, 30) - 0.9904951, // (2026, 1, 12) - 0.9479743, // (2027, 7, 12) - 1.0966930, // (2028, 4, 10) - 1.0935950, // (2028, 9, 1) - 1.0967200, // (2028, 12, 8) - 1.0065050, // (2029, 4, 11) - 1.0304410, // (2029, 6, 8) - 1.0110210, // (2029, 8, 1) - 1.0958790, // (2029, 10, 24) - 0.9880349, // (2030, 2, 8) - 0.9667400, // (2030, 3, 29) - 1.0189310, // (2030, 8, 1) - 0.9860338, // (2030, 10, 24) - 0.9759851, // (2030, 11, 27) - 0.9871626, // (2030, 12, 23) - 0.9770129, // (2031, 1, 14) - 0.9942566, // (2031, 1, 27) - 0.9536498, // (2031, 2, 11) - 0.9730267, // (2031, 3, 10) - 0.9399774, // (2031, 7, 11) - 1.0172150, // (2031, 8, 1) - 0.9329716, // (2031, 8, 8) - 0.9317174, // (2032, 6, 28) - 1.0240540, // (2032, 7, 20) - 0.9658405, // (2033, 2, 1) - 0.9424355, // (2033, 4, 21) - 1.0197810, // (2033, 10, 11) - 0.9988397, // (2034, 7, 24) - 0.9970544, // (2034, 9, 5) - 0.9770791, // (2035, 2, 2) - 1.0207810, // (2035, 6, 1) - 0.9765588, // (2035, 10, 22) - 0.9995269, // (2035, 11, 13) - 0.9889580, // (2035, 12, 28) - 0.9820512, // (2036, 2, 1) - 0.9267384, // (2036, 2, 6) - 0.9785613, // (2036, 2, 8) - 0.9731897, // (2036, 2, 22) - 0.9285945, // (2036, 4, 18) - 0.9132757, // (2036, 4, 29) - 0.9125336, // (2036, 5, 16) - 0.9385671, // (2036, 5, 20) - 0.9347221, // (2036, 5, 23) - 0.9343378, // (2036, 6, 16) - 1.3270050, // (2036, 7, 15) - 0.8896572, // (2036, 8, 22) - 0.8947115, // (2036, 9, 8) - 0.8985469, // (2036, 9, 8) - 1.3428920, // (2037, 7, 15) - 1.0576060, // (2037, 8, 6) - 0.8892567, // (2037, 11, 2) - 1.4447600, // (2038, 8, 6) - 0.8611548, // (2038, 8, 26) - 0.9764945, // (2039, 2, 2) - 1.2595240, // (2039, 9, 15) - 0.9811483, // (2041, 2, 2) - // 0.9423921, // (2045, 4, 6) - // 1.2715880, // (2056, 4, 1) - // 0.1051380, // (2065, 9, 15) - }; - - double[] adblOAS = RVMeasures ( - aAgencyBond, - dtSpot, - csqc, - adblCleanPrice - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot.addBusDays ( - 3, - dcFunding.currency() - ), - dcFunding.currency() - ); - - System.out.println(); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print ("\t| BOND "); - - for (Map.Entry meGovvieCurve : mapGovvieCurve.entrySet()) { - if ("BASE".equalsIgnoreCase (meGovvieCurve.getKey()) || "BUMP".equalsIgnoreCase (meGovvieCurve.getKey())) - continue; - - System.out.print (" | " + meGovvieCurve.getKey()); - } - - System.out.println (" ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < adblOAS.length; ++i) { - System.out.print ("\t| " + aAgencyBond[i].name()); - - for (Map.Entry meGovvieCurve : mapGovvieCurve.entrySet()) { - if ("BASE".equalsIgnoreCase (meGovvieCurve.getKey()) || "BUMP".equalsIgnoreCase (meGovvieCurve.getKey())) - continue; - - csqc.setGovvieState (meGovvieCurve.getValue()); - - System.out.print (" | " + - FormatUtil.FormatDouble ( - (adblCleanPrice[i] - aAgencyBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] - )) / adblCleanPrice[i], - 2, 2, 10000.) + " " - ); - } - - System.out.println (" ||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/bondfixed/BulletCorporate1.java b/org/drip/sample/bondfixed/BulletCorporate1.java deleted file mode 100644 index cc6ffe3..0000000 --- a/org/drip/sample/bondfixed/BulletCorporate1.java +++ /dev/null @@ -1,784 +0,0 @@ - -package org.drip.sample.bondfixed; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.analytics.output.BondRVMeasures; -import org.drip.analytics.support.Helper; -import org.drip.param.creator.MarketParamsBuilder; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.quote.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.BondBuilder; -import org.drip.product.credit.BondComponent; -import org.drip.product.definition.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.govvie.GovvieCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * BulletCorporate1 demonstrates Non-EOS Fixed Coupon Corporate Bond Pricing and Relative Value Measure - * Generation Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class BulletCorporate1 { - - private static final MergedDiscountForwardCurve FundingCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrDepositMaturityTenor = new String[] { - "2D" - }; - - double[] adblDepositQuote = new double[] { - 0.0103456 // 2D - }; - - double[] adblFuturesQuote = new double[] { - 0.01070, - 0.01235, - 0.01360 - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.012484, // 1Y - 0.014987, // 2Y - 0.017036, // 3Y - 0.018624, // 4Y - 0.019868, // 5Y - 0.020921, // 6Y - 0.021788, // 7Y - 0.022530, // 8Y - 0.023145, // 9Y - 0.023685, // 10Y - 0.024153, // 11Y - 0.024562, // 12Y - 0.025389, // 15Y - 0.026118, // 20Y - 0.026368, // 25Y - 0.026432, // 30Y - 0.026339, // 40Y - 0.026122 // 50Y - }; - - MergedDiscountForwardCurve dcFunding = LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - adblFuturesQuote, - "ForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate" - ); - - Component[] aDepositComp = OTCInstrumentBuilder.FundingDeposit ( - dtSpot, - strCurrency, - astrDepositMaturityTenor - ); - - Component[] aFuturesComp = ExchangeInstrumentBuilder.ForwardRateFuturesPack ( - dtSpot, - adblFuturesQuote.length, - strCurrency - ); - - Component[] aFixFloatComp = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - astrFixFloatMaturityTenor, - "MAIN", - 0. - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - System.out.println(); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println ("\t| DEPOSIT INPUT vs. CALC ||"); - - System.out.println ("\t|-------------------------------------||"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t| [" + aDepositComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aDepositComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println(); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println ("\t| FUTURES INPUT vs. CALC ||"); - - System.out.println ("\t|-------------------------------------||"); - - for (int i = 0; i < aFuturesComp.length; ++i) - System.out.println ("\t| [" + aFuturesComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFuturesComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFuturesQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println(); - - System.out.println ("\t|------------------------------------------------|| "); - - System.out.println ("\t| FIX-FLOAT INPUTS vs CALIB ||"); - - System.out.println ("\t|------------------------------------------------|| "); - - for (int i = 0; i < aFixFloatComp.length; ++i) - System.out.println ("\t| [" + aFixFloatComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "CalibSwapRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFixFloatQuote[i], 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "FairPremium" - ), 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|------------------------------------------------||"); - - System.out.println(); - - return dcFunding; - } - - private static final Map GovvieCurve ( - final JulianDate dtSpot, - final String strCode, - final double[] adblCoupon, - final double[] adblYield) - throws Exception - { - JulianDate[] adtEffective = new JulianDate[] { - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot - }; - - JulianDate[] adtMaturity = new JulianDate[] { - dtSpot.addTenor ("1Y"), - dtSpot.addTenor ("2Y"), - dtSpot.addTenor ("3Y"), - dtSpot.addTenor ("5Y"), - dtSpot.addTenor ("7Y"), - dtSpot.addTenor ("10Y"), - dtSpot.addTenor ("20Y"), - dtSpot.addTenor ("30Y") - }; - - Map mapGovvieCurve = LatentMarketStateBuilder.BumpedGovvieCurve ( - strCode, - dtSpot, - adtEffective, - adtMaturity, - adblCoupon, - adblYield, - "Yield", - LatentMarketStateBuilder.SHAPE_PRESERVING, - 0.0001, - false - ); - - BondComponent[] aComp = TreasuryBuilder.FromCode ( - strCode, - adtEffective, - adtMaturity, - adblCoupon - ); - - ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setGovvieState (mapGovvieCurve.get ("BASE")); - - System.out.println(); - - System.out.println ("\t|-------------------------------------------||"); - - System.out.println ("\t| TREASURY INPUT vs CALIB YIELD ||"); - - System.out.println ("\t|-------------------------------------------||"); - - for (int i = 0; i < aComp.length; ++i) - System.out.println ("\t| " + aComp[i].name() + " | " + - FormatUtil.FormatDouble (adblYield[i], 1, 3, 100.) + "% | " + - FormatUtil.FormatDouble (aComp[i].yieldFromPrice ( - valParams, - null, - null, - aComp[i].maturityDate().julian(), - 1., - aComp[i].priceFromYield ( - valParams, - null, - null, - mapGovvieCurve.get ("BASE").yield (aComp[i].maturityDate().julian()) - ) - ), 1, 3, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------------------------------||"); - - return mapGovvieCurve; - } - - private static final void AccumulateBondMarketQuote ( - final CurveSurfaceQuoteContainer csqc, - final String[] astrOnTheRunCode, - final double[] adblYield) - throws Exception - { - for (int i = 0; i < astrOnTheRunCode.length; ++i) { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Yield", - new MultiSided ( - "mid", - adblYield[i] - ), - true - ); - - csqc.setProductQuote ( - astrOnTheRunCode[i], - pmmq - ); - } - } - - private static final Bond Corporate ( - final String strName, - final JulianDate dtEffective, - final JulianDate dtMaturity, - final double dblCoupon, - final int iFreq, - final String strDayCount) - throws Exception - { - return BondBuilder.CreateSimpleFixed ( - strName + FormatUtil.FormatDouble (dblCoupon, 1, 4, 100.) + " " + dtMaturity, - "USD", - "", - dblCoupon, - iFreq, - strDayCount, - dtEffective, - dtMaturity, - null, - null - ); - } - - private static final double[] RVMeasures ( - final Bond[] aBond, - final JulianDate dtValue, - final CurveSurfaceQuoteContainer csqc, - final double[] adblCleanPrice) - throws Exception - { - JulianDate dtSettle = dtValue.addBusDays ( - 3, - aBond[0].currency() - ); - - ValuationParams valParams = new ValuationParams ( - dtValue, - dtSettle, - aBond[0].currency() - ); - - System.out.println(); - - System.out.println ("\t|--------------------------------||"); - - System.out.println ("\t| Trade Date : " + dtValue + " ||"); - - System.out.println ("\t| Cash Settle Date : " + dtSettle + " ||"); - - System.out.println ("\t|--------------------------------||"); - - System.out.println(); - - String strCurveMetrics = ""; - String strSecularMetrics = ""; - double[] adblOAS = new double[aBond.length]; - - for (int i = 0; i < aBond.length; ++i) { - System.out.println ("Doing " + aBond[i].name()); - - WorkoutInfo wi = aBond[i].exerciseYieldFromPrice ( - valParams, - csqc, - null, - adblCleanPrice[i] - ); - - BondRVMeasures rvm = aBond[i].standardMeasures ( - valParams, - null, - csqc, - null, - wi, - adblCleanPrice[i] - ); - - strSecularMetrics += "\t| " + - aBond[i].name() + " | " + - aBond[i].effectiveDate() + " | " + - aBond[i].maturityDate() + " | " + - aBond[i].firstCouponDate() + " |" + - FormatUtil.FormatDouble (adblCleanPrice[i], 3, 3, 100.) + " |" + - FormatUtil.FormatDouble (wi.yield(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (rvm.macaulayDuration(), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (rvm.modifiedDuration(), 2, 2, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.yield01(), 2, 2, 10000.) + " |" + - FormatUtil.FormatDouble (rvm.yield01(), 4, 0, 1000000.) + " |" + - FormatUtil.FormatDouble (rvm.convexity(), 1, 2, 1000000.) + " | " + - FormatUtil.FormatDouble (rvm.bondBasis(), 3, 0, 10000.) + " ||" + "\n"; - - adblOAS[i] = rvm.oas(); - - double dblCleanPriceOASUp = aBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] + 0.0001 - ); - - double dblCleanPriceOASDown = aBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] - 0.0001 - ); - - strCurveMetrics += "\t| " + - aBond[i].name() + " |" + - FormatUtil.FormatDouble (adblCleanPrice[i], 3, 3, 100.) + " |" + - FormatUtil.FormatDouble (wi.yield(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (rvm.zSpread(), 3, 0, 10000.) + " |" + - FormatUtil.FormatDouble (adblOAS[i], 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (0.5 * (dblCleanPriceOASDown - dblCleanPriceOASUp) / adblCleanPrice[i], 2, 2, 10000.) + " | " + - FormatUtil.FormatDouble ((dblCleanPriceOASDown + dblCleanPriceOASUp - 2. * adblCleanPrice[i]) / adblCleanPrice[i], 2, 2, 1000000.) + " |" + - FormatUtil.FormatDouble (rvm.asw(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.gSpread(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.iSpread(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.tsySpread(), 3, 0, 10000.) + " | " + - Helper.BaseTsyBmk ( - dtValue.julian(), - aBond[i].maturityDate().julian() - ) + " ||" + "\n"; - } - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| BOND | EFFECTIVE | MATURITY | FIRST COUPON | PRICE | YIELD | MAC DUR | MOD DUR | YIELD 01 | DV01 | CONV | BOND BASIS ||"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print (strSecularMetrics); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||\n"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| BOND | PRICE | YIELD | Z SPREAD | OAS | OAS DUR | OAS CONV | ASW | G SPREAD | I SPREAD | TSY SPREAD | TSY BMK ||"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print (strCurveMetrics); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------||"); - - return adblOAS; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2017, - DateUtil.FEBRUARY, - 2 - ); - - String strCurrency = "USD"; - String strTreasuryCode = "UST"; - - MergedDiscountForwardCurve dcFunding = FundingCurve ( - dtSpot, - strCurrency - ); - - double[] adblTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0250, - 0.0300 - }; - - double[] adblTreasuryYield = new double[] { - 0.0083, // 1Y - 0.0122, // 2Y - 0.0149, // 3Y - 0.0193, // 5Y - 0.0227, // 7Y - 0.0248, // 10Y - 0.0280, // 20Y - 0.0308 // 30Y - }; - - Map mapGovvieCurve = GovvieCurve ( - dtSpot, - strTreasuryCode, - adblTreasuryCoupon, - adblTreasuryYield - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - csqc.setGovvieState (mapGovvieCurve.get ("BASE")); - - AccumulateBondMarketQuote ( - csqc, - new String[] { - "01YON", - "02YON", - "03YON", - "05YON", - "07YON", - "10YON", - "20YON", - "30YON" - }, - adblTreasuryYield - ); - - Bond[] aCorporateBond = new Bond[] { - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 3, 10), DateUtil.CreateFromYMD (2017, 3, 10), 0.01350, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 5, 11), DateUtil.CreateFromYMD (2017, 5, 11), 0.03750, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 6, 11), DateUtil.CreateFromYMD (2017, 6, 9), 0.01350, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 10, 1), DateUtil.CreateFromYMD (2017, 10, 2), 0.02125, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 11, 13), DateUtil.CreateFromYMD (2018, 7, 16), 0.03875, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2008, 12, 11), DateUtil.CreateFromYMD (2019, 1, 15), 0.08250, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 2, 3), DateUtil.CreateFromYMD (2019, 2, 15), 0.08125, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2007, 5, 4), DateUtil.CreateFromYMD (2019, 3, 15), 0.05490, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 3, 17), DateUtil.CreateFromYMD (2019, 3, 15), 0.09375, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 2, 6), DateUtil.CreateFromYMD (2019, 8, 16), 0.09250, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 10, 9), DateUtil.CreateFromYMD (2019, 10, 15), 0.07375, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 1, 15), DateUtil.CreateFromYMD (2020, 1, 31), 0.07875, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 12, 11), DateUtil.CreateFromYMD (2020, 2, 15), 0.06250, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 4, 26), DateUtil.CreateFromYMD (2020, 4, 30), 0.06375, 2, "30/360 NON-EOM"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 5, 10), DateUtil.CreateFromYMD (2020, 5, 15), 0.08500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 9, 17), DateUtil.CreateFromYMD (2020, 9, 15), 0.05875, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 9, 29), DateUtil.CreateFromYMD (2020, 9, 29), 0.06375, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 11, 15), DateUtil.CreateFromYMD (2020, 11, 15), 0.05500, 2, "ISMA-30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 3, 17), DateUtil.CreateFromYMD (2021, 3, 1), 0.05000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 5, 23), DateUtil.CreateFromYMD (2021, 11, 1), 0.05375, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2011, 11, 15), DateUtil.CreateFromYMD (2021, 11, 15), 0.04450, 2, "ISMA-30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 4, 15), DateUtil.CreateFromYMD (2022, 4, 15), 0.05125, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2007, 4, 10), DateUtil.CreateFromYMD (2022, 4, 19), 0.05983, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2008, 4, 14), DateUtil.CreateFromYMD (2022, 10, 8), 0.06821, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2007, 12, 13), DateUtil.CreateFromYMD (2023, 1, 15), 0.06251, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 8, 23), DateUtil.CreateFromYMD (2023, 3, 15), 0.04375, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 5, 22), DateUtil.CreateFromYMD (2023, 6, 1), 0.03750, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 8, 15), DateUtil.CreateFromYMD (2023, 8, 15), 0.06125, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 10, 2), DateUtil.CreateFromYMD (2023, 10, 2), 0.05000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 11, 9), DateUtil.CreateFromYMD (2023, 11, 15), 0.06125, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 12, 11), DateUtil.CreateFromYMD (2024, 1, 15), 0.04150, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 2, 11), DateUtil.CreateFromYMD (2024, 2, 15), 0.04350, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 3, 3), DateUtil.CreateFromYMD (2024, 3, 3), 0.04000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 3, 14), DateUtil.CreateFromYMD (2024, 4, 1), 0.04600, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 3, 9), DateUtil.CreateFromYMD (2024, 4, 1), 0.04400, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 4, 8), DateUtil.CreateFromYMD (2024, 4, 8), 0.03800, 2, "ISMA-30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 6, 20), DateUtil.CreateFromYMD (2024, 7, 1), 0.05000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 1, 26), DateUtil.CreateFromYMD (2025, 2, 1), 0.04000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 2, 24), DateUtil.CreateFromYMD (2025, 2, 15), 0.04350, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 12, 4), DateUtil.CreateFromYMD (2025, 2, 15), 0.04450, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 11, 24), DateUtil.CreateFromYMD (2025, 11, 24), 0.04750, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 12, 16), DateUtil.CreateFromYMD (2025, 12, 16), 0.04500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 11, 9), DateUtil.CreateFromYMD (2027, 11, 9), 0.04375, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2001, 3, 2), DateUtil.CreateFromYMD (2031, 3, 3), 0.07125, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 10, 1), DateUtil.CreateFromYMD (2035, 7, 29), 0.04950, 2, "ISMA-30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 5, 9), DateUtil.CreateFromYMD (2035, 11, 1), 0.06250, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2006, 11, 9), DateUtil.CreateFromYMD (2036, 10, 1), 0.05558, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 8, 1), DateUtil.CreateFromYMD (2043, 8, 15), 0.06503, 12, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2003, 10, 1), DateUtil.CreateFromYMD (2043, 10, 1), 0.05937, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2005, 2, 24), DateUtil.CreateFromYMD (2047, 12, 15), 0.05270, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2005, 3, 1), DateUtil.CreateFromYMD (2049, 5, 15), 0.05690, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2005, 4, 26), DateUtil.CreateFromYMD (2050, 6, 15), 0.05524, 2, "ISMA-30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 6, 2), DateUtil.CreateFromYMD (2050, 6, 15), 0.05912, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2006, 7, 1), DateUtil.CreateFromYMD (2051, 1, 1), 0.05521, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2006, 11, 1), DateUtil.CreateFromYMD (2051, 10, 1), 0.05658, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2007, 12, 4), DateUtil.CreateFromYMD (2053, 6, 15), 0.06171, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2007, 12, 4), DateUtil.CreateFromYMD (2053, 6, 15), 0.08421, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 8, 1), DateUtil.CreateFromYMD (2053, 8, 15), 0.06803, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2008, 11, 4), DateUtil.CreateFromYMD (2053, 9, 15), 0.07500, 2, "30/360"), - }; - - double[] adblCleanPrice = new double[] { - 1.0004420, // (2017, 3, 10) - 1.0070520, // (2017, 5, 11) - 1.0030200, // (2017, 6, 9) - 1.0027010, // (2017, 10, 2) - 1.0210990, // (2018, 7, 16) - 1.1229040, // (2018, 12, 11) - 1.1101630, // (2019, 2, 15) - 1.0622680, // (2019, 3, 15) - 1.1503290, // (2019, 3, 15) - 1.1771910, // (2019, 8, 16) - 1.1299690, // (2019, 10, 15) - 1.1391860, // (2020, 1, 31) - 1.1063470, // (2020, 2, 15) - 1.1061200, // (2020, 4, 30) - 1.1154030, // (2020, 5, 15) - 1.0756280, // (2020, 9, 15) - 1.1310700, // (2020, 9, 29) - 1.0886500, // (2020, 11, 15) - 1.0783280, // (2021, 3, 1) - 1.0248690, // (2021, 11, 1) - 1.0366210, // (2021, 11, 15) - 1.1100210, // (2022, 4, 15) - 1.1030640, // (2022, 4, 19) - 1.1515940, // (2022, 10, 8) - 1.1458440, // (2023, 1, 15) - 1.0075000, // (2023, 3, 15) - 1.0077190, // (2023, 6, 1) - 1.0452330, // (2023, 8, 15) - 1.0545460, // (2023, 10, 2) - 1.0748650, // (2023, 11, 15) - 1.0500690, // (2024, 1, 15) - 0.9578745, // (2024, 2, 15) - 1.0283760, // (2024, 3, 3) - 1.0263960, // (2024, 4, 1) - 0.9989979, // (2024, 4, 1) - 0.9891589, // (2024, 4, 8) - 1.0542700, // (2024, 7, 1) - 0.9759940, // (2025, 2, 1) - 0.9980053, // (2025, 2, 15) - 0.9772800, // (2025, 2, 15) - 1.0065140, // (2025, 11, 24) - 1.0318190, // (2025, 12, 16) - 1.0575060, // (2027, 11, 9) - 1.3593050, // (2031, 3, 3) - 1.0600360, // (2035, 7, 29) - 1.0899400, // (2035, 11, 1) - 1.1337930, // (2036, 10, 1) - // 1.1776690, // (2043, 8, 1) - // 1.1227270, // (2043, 10, 1) - // 1.0392280, // (2047, 12, 15) - // 1.1496480, // (2049, 5, 15) - // 1.0961770, // (2050, 6, 15) - // 1.2025960, // (2050, 6, 15) - // 0.9276792, // (2051, 1, 1) - // 1.0181790, // (2051, 10, 1) - // 0.9694037, // (2053, 6, 15) - // 1.0446570, // (2053, 6, 15) - // 1.3776140, // (2053, 8, 15) - // 1.3822020, // (2053, 9, 15) - }; - - double[] adblOAS = RVMeasures ( - aCorporateBond, - dtSpot, - csqc, - adblCleanPrice - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot.addBusDays ( - 3, - dcFunding.currency() - ), - dcFunding.currency() - ); - - System.out.println(); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print ("\t| BOND "); - - for (Map.Entry meGovvieCurve : mapGovvieCurve.entrySet()) { - if ("BASE".equalsIgnoreCase (meGovvieCurve.getKey()) || "BUMP".equalsIgnoreCase (meGovvieCurve.getKey())) - continue; - - System.out.print (" | " + meGovvieCurve.getKey()); - } - - System.out.println (" ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < adblOAS.length; ++i) { - System.out.print ("\t| " + aCorporateBond[i].name()); - - for (Map.Entry meGovvieCurve : mapGovvieCurve.entrySet()) { - if ("BASE".equalsIgnoreCase (meGovvieCurve.getKey()) || "BUMP".equalsIgnoreCase (meGovvieCurve.getKey())) - continue; - - csqc.setGovvieState (meGovvieCurve.getValue()); - - System.out.print (" | " + - FormatUtil.FormatDouble ( - (adblCleanPrice[i] - aCorporateBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] - )) / adblCleanPrice[i], - 2, 2, 10000.) + " " - ); - } - - System.out.println (" ||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/bondfixed/BulletCorporate2.java b/org/drip/sample/bondfixed/BulletCorporate2.java deleted file mode 100644 index bf15c43..0000000 --- a/org/drip/sample/bondfixed/BulletCorporate2.java +++ /dev/null @@ -1,782 +0,0 @@ - -package org.drip.sample.bondfixed; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.analytics.output.BondRVMeasures; -import org.drip.analytics.support.Helper; -import org.drip.param.creator.MarketParamsBuilder; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.quote.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.BondBuilder; -import org.drip.product.credit.BondComponent; -import org.drip.product.definition.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.govvie.GovvieCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * BulletCorporate2 demonstrates Non-EOS Fixed Coupon Corporate Bond Pricing and Relative Value Measure - * Generation Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class BulletCorporate2 { - - private static final MergedDiscountForwardCurve FundingCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrDepositMaturityTenor = new String[] { - "2D" - }; - - double[] adblDepositQuote = new double[] { - 0.0103456 // 2D - }; - - double[] adblFuturesQuote = new double[] { - 0.01070, - 0.01235, - 0.01360 - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.012484, // 1Y - 0.014987, // 2Y - 0.017036, // 3Y - 0.018624, // 4Y - 0.019868, // 5Y - 0.020921, // 6Y - 0.021788, // 7Y - 0.022530, // 8Y - 0.023145, // 9Y - 0.023685, // 10Y - 0.024153, // 11Y - 0.024562, // 12Y - 0.025389, // 15Y - 0.026118, // 20Y - 0.026368, // 25Y - 0.026432, // 30Y - 0.026339, // 40Y - 0.026122 // 50Y - }; - - MergedDiscountForwardCurve dcFunding = LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - adblFuturesQuote, - "ForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate" - ); - - Component[] aDepositComp = OTCInstrumentBuilder.FundingDeposit ( - dtSpot, - strCurrency, - astrDepositMaturityTenor - ); - - Component[] aFuturesComp = ExchangeInstrumentBuilder.ForwardRateFuturesPack ( - dtSpot, - adblFuturesQuote.length, - strCurrency - ); - - Component[] aFixFloatComp = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - astrFixFloatMaturityTenor, - "MAIN", - 0. - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - System.out.println(); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println ("\t| DEPOSIT INPUT vs. CALC ||"); - - System.out.println ("\t|-------------------------------------||"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t| [" + aDepositComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aDepositComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println(); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println ("\t| FUTURES INPUT vs. CALC ||"); - - System.out.println ("\t|-------------------------------------||"); - - for (int i = 0; i < aFuturesComp.length; ++i) - System.out.println ("\t| [" + aFuturesComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFuturesComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFuturesQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println(); - - System.out.println ("\t|------------------------------------------------|| "); - - System.out.println ("\t| FIX-FLOAT INPUTS vs CALIB ||"); - - System.out.println ("\t|------------------------------------------------|| "); - - for (int i = 0; i < aFixFloatComp.length; ++i) - System.out.println ("\t| [" + aFixFloatComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "CalibSwapRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFixFloatQuote[i], 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "FairPremium" - ), 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|------------------------------------------------||"); - - System.out.println(); - - return dcFunding; - } - - private static final Map GovvieCurve ( - final JulianDate dtSpot, - final String strCode, - final double[] adblCoupon, - final double[] adblYield) - throws Exception - { - JulianDate[] adtEffective = new JulianDate[] { - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot - }; - - JulianDate[] adtMaturity = new JulianDate[] { - dtSpot.addTenor ("1Y"), - dtSpot.addTenor ("2Y"), - dtSpot.addTenor ("3Y"), - dtSpot.addTenor ("5Y"), - dtSpot.addTenor ("7Y"), - dtSpot.addTenor ("10Y"), - dtSpot.addTenor ("20Y"), - dtSpot.addTenor ("30Y") - }; - - Map mapGovvieCurve = LatentMarketStateBuilder.BumpedGovvieCurve ( - strCode, - dtSpot, - adtEffective, - adtMaturity, - adblCoupon, - adblYield, - "Yield", - LatentMarketStateBuilder.SHAPE_PRESERVING, - 0.0001, - false - ); - - BondComponent[] aComp = TreasuryBuilder.FromCode ( - strCode, - adtEffective, - adtMaturity, - adblCoupon - ); - - ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setGovvieState (mapGovvieCurve.get ("BASE")); - - System.out.println(); - - System.out.println ("\t|-------------------------------------------||"); - - System.out.println ("\t| TREASURY INPUT vs CALIB YIELD ||"); - - System.out.println ("\t|-------------------------------------------||"); - - for (int i = 0; i < aComp.length; ++i) - System.out.println ("\t| " + aComp[i].name() + " | " + - FormatUtil.FormatDouble (adblYield[i], 1, 3, 100.) + "% | " + - FormatUtil.FormatDouble (aComp[i].yieldFromPrice ( - valParams, - null, - null, - aComp[i].maturityDate().julian(), - 1., - aComp[i].priceFromYield ( - valParams, - null, - null, - mapGovvieCurve.get ("BASE").yield (aComp[i].maturityDate().julian()) - ) - ), 1, 3, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------------------------------||"); - - return mapGovvieCurve; - } - - private static final void AccumulateBondMarketQuote ( - final CurveSurfaceQuoteContainer csqc, - final String[] astrOnTheRunCode, - final double[] adblYield) - throws Exception - { - for (int i = 0; i < astrOnTheRunCode.length; ++i) { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Yield", - new MultiSided ( - "mid", - adblYield[i] - ), - true - ); - - csqc.setProductQuote ( - astrOnTheRunCode[i], - pmmq - ); - } - } - - private static final Bond Corporate ( - final String strName, - final JulianDate dtEffective, - final JulianDate dtMaturity, - final double dblCoupon, - final int iFreq, - final String strDayCount) - throws Exception - { - return BondBuilder.CreateSimpleFixed ( - strName + FormatUtil.FormatDouble (dblCoupon, 1, 4, 100.) + " " + dtMaturity, - "USD", - "", - dblCoupon, - iFreq, - strDayCount, - dtEffective, - dtMaturity, - null, - null - ); - } - - private static final double[] RVMeasures ( - final Bond[] aBond, - final JulianDate dtValue, - final CurveSurfaceQuoteContainer csqc, - final double[] adblCleanPrice) - throws Exception - { - JulianDate dtSettle = dtValue.addBusDays ( - 3, - aBond[0].currency() - ); - - ValuationParams valParams = new ValuationParams ( - dtValue, - dtSettle, - aBond[0].currency() - ); - - System.out.println(); - - System.out.println ("\t|--------------------------------||"); - - System.out.println ("\t| Trade Date : " + dtValue + " ||"); - - System.out.println ("\t| Cash Settle Date : " + dtSettle + " ||"); - - System.out.println ("\t|--------------------------------||"); - - System.out.println(); - - String strCurveMetrics = ""; - String strSecularMetrics = ""; - double[] adblOAS = new double[aBond.length]; - - for (int i = 0; i < aBond.length; ++i) { - System.out.println ("Doing " + aBond[i].name()); - - WorkoutInfo wi = aBond[i].exerciseYieldFromPrice ( - valParams, - csqc, - null, - adblCleanPrice[i] - ); - - BondRVMeasures rvm = aBond[i].standardMeasures ( - valParams, - null, - csqc, - null, - wi, - adblCleanPrice[i] - ); - - strSecularMetrics += "\t| " + - aBond[i].name() + " | " + - aBond[i].effectiveDate() + " | " + - aBond[i].maturityDate() + " | " + - aBond[i].firstCouponDate() + " |" + - FormatUtil.FormatDouble (adblCleanPrice[i], 3, 3, 100.) + " |" + - FormatUtil.FormatDouble (wi.yield(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (rvm.macaulayDuration(), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (rvm.modifiedDuration(), 2, 2, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.yield01(), 2, 2, 10000.) + " |" + - FormatUtil.FormatDouble (rvm.yield01(), 4, 0, 1000000.) + " |" + - FormatUtil.FormatDouble (rvm.convexity(), 1, 2, 1000000.) + " | " + - FormatUtil.FormatDouble (rvm.bondBasis(), 3, 0, 10000.) + " ||" + "\n"; - - adblOAS[i] = rvm.oas(); - - double dblCleanPriceOASUp = aBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] + 0.0001 - ); - - double dblCleanPriceOASDown = aBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] - 0.0001 - ); - - strCurveMetrics += "\t| " + - aBond[i].name() + " |" + - FormatUtil.FormatDouble (adblCleanPrice[i], 3, 3, 100.) + " |" + - FormatUtil.FormatDouble (wi.yield(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (rvm.zSpread(), 3, 0, 10000.) + " |" + - FormatUtil.FormatDouble (adblOAS[i], 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (0.5 * (dblCleanPriceOASDown - dblCleanPriceOASUp) / adblCleanPrice[i], 2, 2, 10000.) + " | " + - FormatUtil.FormatDouble ((dblCleanPriceOASDown + dblCleanPriceOASUp - 2. * adblCleanPrice[i]) / adblCleanPrice[i], 2, 2, 1000000.) + " |" + - FormatUtil.FormatDouble (rvm.asw(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.gSpread(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.iSpread(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.tsySpread(), 3, 0, 10000.) + " | " + - Helper.BaseTsyBmk ( - dtValue.julian(), - aBond[i].maturityDate().julian() - ) + " ||" + "\n"; - } - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| BOND | EFFECTIVE | MATURITY | FIRST COUPON | PRICE | YIELD | MAC DUR | MOD DUR | YIELD 01 | DV01 | CONV | BOND BASIS ||"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print (strSecularMetrics); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||\n"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| BOND | PRICE | YIELD | Z SPREAD | OAS | OAS DUR | OAS CONV | ASW | G SPREAD | I SPREAD | TSY SPREAD | TSY BMK ||"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print (strCurveMetrics); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------||"); - - return adblOAS; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2017, - DateUtil.FEBRUARY, - 2 - ); - - String strCurrency = "USD"; - String strTreasuryCode = "UST"; - - MergedDiscountForwardCurve dcFunding = FundingCurve ( - dtSpot, - strCurrency - ); - - double[] adblTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0250, - 0.0300 - }; - - double[] adblTreasuryYield = new double[] { - 0.0083, // 1Y - 0.0122, // 2Y - 0.0149, // 3Y - 0.0193, // 5Y - 0.0227, // 7Y - 0.0248, // 10Y - 0.0280, // 20Y - 0.0308 // 30Y - }; - - Map mapGovvieCurve = GovvieCurve ( - dtSpot, - strTreasuryCode, - adblTreasuryCoupon, - adblTreasuryYield - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - csqc.setGovvieState (mapGovvieCurve.get ("BASE")); - - AccumulateBondMarketQuote ( - csqc, - new String[] { - "01YON", - "02YON", - "03YON", - "05YON", - "07YON", - "10YON", - "20YON", - "30YON" - }, - adblTreasuryYield - ); - - Bond[] aCorporateBond = new Bond[] { - Corporate ("CORPORA", DateUtil.CreateFromYMD (2005, 4, 27), DateUtil.CreateFromYMD (2017, 5, 1), 0.05625, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 5, 22), DateUtil.CreateFromYMD (2017, 5, 15), 0.01150, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 3, 12), DateUtil.CreateFromYMD (2018, 3, 12), 0.02350, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 8, 20), DateUtil.CreateFromYMD (2019, 8, 15), 0.06625, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 8, 14), DateUtil.CreateFromYMD (2019, 8, 15), 0.06875, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 10, 17), DateUtil.CreateFromYMD (2019, 10, 15), 0.04250, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 5, 11), DateUtil.CreateFromYMD (2019, 12, 15), 0.07250, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 1, 15), DateUtil.CreateFromYMD (2020, 1, 15), 0.06113, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 4, 1), DateUtil.CreateFromYMD (2020, 3, 15), 0.06750, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 6, 29), DateUtil.CreateFromYMD (2020, 6, 30), 0.10250, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 7, 19), DateUtil.CreateFromYMD (2020, 7, 15), 0.05450, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 9, 13), DateUtil.CreateFromYMD (2020, 9, 15), 0.05250, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 9, 20), DateUtil.CreateFromYMD (2020, 9, 15), 0.05375, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 9, 10), DateUtil.CreateFromYMD (2020, 9, 30), 0.05000, 2, "30/360 NON-EOM"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 10, 12), DateUtil.CreateFromYMD (2020, 10, 1), 0.06535, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 9, 30), DateUtil.CreateFromYMD (2021, 1, 21), 0.05500, 2, "ISMA-30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2011, 7, 11), DateUtil.CreateFromYMD (2021, 7, 11), 0.06125, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 6, 8), DateUtil.CreateFromYMD (2021, 9, 11), 0.05125, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 5, 5), DateUtil.CreateFromYMD (2021, 10, 15), 0.06250, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 2, 29), DateUtil.CreateFromYMD (2022, 4, 1), 0.04600, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 3, 13), DateUtil.CreateFromYMD (2022, 4, 1), 0.04950, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 3, 22), DateUtil.CreateFromYMD (2022, 4, 15), 0.03950, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 3, 15), DateUtil.CreateFromYMD (2022, 5, 15), 0.06500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 7, 16), DateUtil.CreateFromYMD (2022, 7, 15), 0.04750, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 7, 25), DateUtil.CreateFromYMD (2023, 1, 15), 0.04950, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 1, 27), DateUtil.CreateFromYMD (2023, 2, 1), 0.09500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 6, 6), DateUtil.CreateFromYMD (2023, 6, 15), 0.04500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 8, 8), DateUtil.CreateFromYMD (2023, 8, 8), 0.06500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 9, 24), DateUtil.CreateFromYMD (2023, 9, 15), 0.04700, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 3, 3), DateUtil.CreateFromYMD (2024, 3, 3), 0.04000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 6, 30), DateUtil.CreateFromYMD (2024, 4, 1), 0.04850, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 4, 10), DateUtil.CreateFromYMD (2024, 4, 10), 0.04375, 2, "ISMA-30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 3, 17), DateUtil.CreateFromYMD (2024, 4, 15), 0.04000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 9, 16), DateUtil.CreateFromYMD (2024, 9, 30), 0.04250, 2, "30/360 NON-EOM"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 3, 22), DateUtil.CreateFromYMD (2025, 1, 15), 0.04250, 2, "ISMA-30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 6, 27), DateUtil.CreateFromYMD (2025, 1, 15), 0.03900, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 4, 7), DateUtil.CreateFromYMD (2025, 4, 15), 0.03900, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (1995, 6, 9), DateUtil.CreateFromYMD (2025, 6, 1), 0.06500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 7, 31), DateUtil.CreateFromYMD (2025, 8, 1), 0.04875, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 6, 10), DateUtil.CreateFromYMD (2025, 6, 10), 0.04875, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 10, 20), DateUtil.CreateFromYMD (2025, 10, 15), 0.05000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 2, 3), DateUtil.CreateFromYMD (2026, 2, 15), 0.05250, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 4, 18), DateUtil.CreateFromYMD (2026, 4, 18), 0.04800, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 9, 28), DateUtil.CreateFromYMD (2027, 4, 1), 0.04300, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 12, 14), DateUtil.CreateFromYMD (2027, 12, 15), 0.04125, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 12, 20), DateUtil.CreateFromYMD (2027, 12, 20), 0.05500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2001, 8, 27), DateUtil.CreateFromYMD (2031, 5, 1), 0.07500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 5, 27), DateUtil.CreateFromYMD (2035, 8, 15), 0.04400, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 7, 15), DateUtil.CreateFromYMD (2036, 7, 15), 0.03850, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (1997, 9, 26), DateUtil.CreateFromYMD (2037, 7, 15), 0.07750, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 8, 13), DateUtil.CreateFromYMD (2038, 1, 1), 0.07000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 7, 20), DateUtil.CreateFromYMD (2038, 3, 31), 0.04125, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2005, 8, 11), DateUtil.CreateFromYMD (2048, 2, 15), 0.05383, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2005, 4, 26), DateUtil.CreateFromYMD (2050, 6, 15), 0.05624, 2, "ISMA-30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2005, 8, 1), DateUtil.CreateFromYMD (2050, 8, 1), 0.05240, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2005, 10, 3), DateUtil.CreateFromYMD (2050, 12, 1), 0.05433, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2006, 2, 1), DateUtil.CreateFromYMD (2051, 1, 1), 0.05581, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2008, 10, 30), DateUtil.CreateFromYMD (2055, 11, 15), 0.07050, 2, "30/360"), - }; - - double[] adblCleanPrice = new double[] { - 1.0113840, // (2017, 5, 1) - 0.9993076, // (2017, 5, 15) - 1.0067930, // (2018, 3, 12) - 1.1078490, // (2019, 8, 15) - 1.1112680, // (2019, 8, 15) - 1.0381250, // (2019, 10, 15) - 1.1373470, // (2019, 12, 15) - 1.0797090, // (2020, 1, 15) - 1.1183630, // (2020, 3, 15) - 0.9725000, // (2020, 6, 30) - 1.0785830, // (2020, 7, 15) - 1.0954580, // (2020, 9, 15) - 1.0852840, // (2020, 9, 15) - 1.0777550, // (2020, 9, 30) - 1.0099750, // (2020, 10, 1) - 1.0354710, // (2021, 1, 21) - 1.1336520, // (2021, 7, 11) - 1.0442470, // (2021, 9, 11) - 1.0970000, // (2021, 10, 15) - 1.0584550, // (2022, 4, 1) - 1.0238990, // (2022, 4, 1) - 1.0406760, // (2022, 4, 15) - 1.0292000, // (2022, 5, 15) - 1.0713740, // (2022, 7, 15) - 1.0600000, // (2023, 1, 15) - 1.1425000, // (2023, 2, 1) - 1.0191830, // (2023, 6, 15) - 1.0720350, // (2023, 8, 8) - 1.0707080, // (2023, 9, 15) - 1.0346820, // (2024, 3, 3) - 1.0079400, // (2024, 4, 1) - 0.9978986, // (2024, 4, 10) - 1.0220860, // (2024, 4, 15) - 1.0494240, // (2024, 9, 30) - 0.9090727, // (2025, 1, 15) - 0.9961395, // (2025, 1, 15) - 0.9958941, // (2025, 4, 15) - 1.1920290, // (2025, 6, 1) - 1.0174550, // (2025, 6, 10) - 1.0447330, // (2025, 8, 15) - 1.0910300, // (2025, 10, 15) - 1.0274640, // (2026, 2, 15) - 1.0239890, // (2026, 4, 18) - 0.9950930, // (2027, 4, 1) - 1.0191590, // (2027, 12, 15) - 1.0496860, // (2027, 12, 20) - 1.2709190, // (2031, 5, 1) - 1.0362270, // (2035, 8, 15) - 0.9790604, // (2036, 7, 15) - 1.1324350, // (2037, 7, 15) - 1.2309690, // (2038, 1, 1) - 0.9835252, // (2038, 3, 31) - // 0.9723881, // (2048, 2, 15) - // 1.0940080, // (2050, 6, 15) - // 1.0242040, // (2050, 8, 1) - // 0.9588270, // (2050, 12, 1) - // 0.8015440, // (2051, 1, 1) - // 1.1538110, // (2055, 11, 15) - }; - - double[] adblOAS = RVMeasures ( - aCorporateBond, - dtSpot, - csqc, - adblCleanPrice - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot.addBusDays ( - 3, - dcFunding.currency() - ), - dcFunding.currency() - ); - - System.out.println(); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print ("\t| BOND "); - - for (Map.Entry meGovvieCurve : mapGovvieCurve.entrySet()) { - if ("BASE".equalsIgnoreCase (meGovvieCurve.getKey()) || "BUMP".equalsIgnoreCase (meGovvieCurve.getKey())) - continue; - - System.out.print (" | " + meGovvieCurve.getKey()); - } - - System.out.println (" ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < adblOAS.length; ++i) { - System.out.print ("\t| " + aCorporateBond[i].name()); - - for (Map.Entry meGovvieCurve : mapGovvieCurve.entrySet()) { - if ("BASE".equalsIgnoreCase (meGovvieCurve.getKey()) || "BUMP".equalsIgnoreCase (meGovvieCurve.getKey())) - continue; - - csqc.setGovvieState (meGovvieCurve.getValue()); - - System.out.print (" | " + - FormatUtil.FormatDouble ( - (adblCleanPrice[i] - aCorporateBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] - )) / adblCleanPrice[i], - 2, 2, 10000.) + " " - ); - } - - System.out.println (" ||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/bondfixed/BulletCorporate3.java b/org/drip/sample/bondfixed/BulletCorporate3.java deleted file mode 100644 index e9404f2..0000000 --- a/org/drip/sample/bondfixed/BulletCorporate3.java +++ /dev/null @@ -1,782 +0,0 @@ - -package org.drip.sample.bondfixed; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.analytics.output.BondRVMeasures; -import org.drip.analytics.support.Helper; -import org.drip.param.creator.MarketParamsBuilder; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.quote.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.BondBuilder; -import org.drip.product.credit.BondComponent; -import org.drip.product.definition.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.govvie.GovvieCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * BulletCorporate3 demonstrates Non-EOS Fixed Coupon Corporate Bond Pricing and Relative Value Measure - * Generation Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class BulletCorporate3 { - - private static final MergedDiscountForwardCurve FundingCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrDepositMaturityTenor = new String[] { - "2D" - }; - - double[] adblDepositQuote = new double[] { - 0.0103456 // 2D - }; - - double[] adblFuturesQuote = new double[] { - 0.01070, - 0.01235, - 0.01360 - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.012484, // 1Y - 0.014987, // 2Y - 0.017036, // 3Y - 0.018624, // 4Y - 0.019868, // 5Y - 0.020921, // 6Y - 0.021788, // 7Y - 0.022530, // 8Y - 0.023145, // 9Y - 0.023685, // 10Y - 0.024153, // 11Y - 0.024562, // 12Y - 0.025389, // 15Y - 0.026118, // 20Y - 0.026368, // 25Y - 0.026432, // 30Y - 0.026339, // 40Y - 0.026122 // 50Y - }; - - MergedDiscountForwardCurve dcFunding = LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - adblFuturesQuote, - "ForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate" - ); - - Component[] aDepositComp = OTCInstrumentBuilder.FundingDeposit ( - dtSpot, - strCurrency, - astrDepositMaturityTenor - ); - - Component[] aFuturesComp = ExchangeInstrumentBuilder.ForwardRateFuturesPack ( - dtSpot, - adblFuturesQuote.length, - strCurrency - ); - - Component[] aFixFloatComp = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - astrFixFloatMaturityTenor, - "MAIN", - 0. - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - System.out.println(); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println ("\t| DEPOSIT INPUT vs. CALC ||"); - - System.out.println ("\t|-------------------------------------||"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t| [" + aDepositComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aDepositComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println(); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println ("\t| FUTURES INPUT vs. CALC ||"); - - System.out.println ("\t|-------------------------------------||"); - - for (int i = 0; i < aFuturesComp.length; ++i) - System.out.println ("\t| [" + aFuturesComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFuturesComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFuturesQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println(); - - System.out.println ("\t|------------------------------------------------|| "); - - System.out.println ("\t| FIX-FLOAT INPUTS vs CALIB ||"); - - System.out.println ("\t|------------------------------------------------|| "); - - for (int i = 0; i < aFixFloatComp.length; ++i) - System.out.println ("\t| [" + aFixFloatComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "CalibSwapRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFixFloatQuote[i], 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "FairPremium" - ), 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|------------------------------------------------||"); - - System.out.println(); - - return dcFunding; - } - - private static final Map GovvieCurve ( - final JulianDate dtSpot, - final String strCode, - final double[] adblCoupon, - final double[] adblYield) - throws Exception - { - JulianDate[] adtEffective = new JulianDate[] { - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot - }; - - JulianDate[] adtMaturity = new JulianDate[] { - dtSpot.addTenor ("1Y"), - dtSpot.addTenor ("2Y"), - dtSpot.addTenor ("3Y"), - dtSpot.addTenor ("5Y"), - dtSpot.addTenor ("7Y"), - dtSpot.addTenor ("10Y"), - dtSpot.addTenor ("20Y"), - dtSpot.addTenor ("30Y") - }; - - Map mapGovvieCurve = LatentMarketStateBuilder.BumpedGovvieCurve ( - strCode, - dtSpot, - adtEffective, - adtMaturity, - adblCoupon, - adblYield, - "Yield", - LatentMarketStateBuilder.SHAPE_PRESERVING, - 0.0001, - false - ); - - BondComponent[] aComp = TreasuryBuilder.FromCode ( - strCode, - adtEffective, - adtMaturity, - adblCoupon - ); - - ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setGovvieState (mapGovvieCurve.get ("BASE")); - - System.out.println(); - - System.out.println ("\t|-------------------------------------------||"); - - System.out.println ("\t| TREASURY INPUT vs CALIB YIELD ||"); - - System.out.println ("\t|-------------------------------------------||"); - - for (int i = 0; i < aComp.length; ++i) - System.out.println ("\t| " + aComp[i].name() + " | " + - FormatUtil.FormatDouble (adblYield[i], 1, 3, 100.) + "% | " + - FormatUtil.FormatDouble (aComp[i].yieldFromPrice ( - valParams, - null, - null, - aComp[i].maturityDate().julian(), - 1., - aComp[i].priceFromYield ( - valParams, - null, - null, - mapGovvieCurve.get ("BASE").yield (aComp[i].maturityDate().julian()) - ) - ), 1, 3, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------------------------------||"); - - return mapGovvieCurve; - } - - private static final void AccumulateBondMarketQuote ( - final CurveSurfaceQuoteContainer csqc, - final String[] astrOnTheRunCode, - final double[] adblYield) - throws Exception - { - for (int i = 0; i < astrOnTheRunCode.length; ++i) { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Yield", - new MultiSided ( - "mid", - adblYield[i] - ), - true - ); - - csqc.setProductQuote ( - astrOnTheRunCode[i], - pmmq - ); - } - } - - private static final Bond Corporate ( - final String strName, - final JulianDate dtEffective, - final JulianDate dtMaturity, - final double dblCoupon, - final int iFreq, - final String strDayCount) - throws Exception - { - return BondBuilder.CreateSimpleFixed ( - strName + FormatUtil.FormatDouble (dblCoupon, 1, 4, 100.) + " " + dtMaturity, - "USD", - "", - dblCoupon, - iFreq, - strDayCount, - dtEffective, - dtMaturity, - null, - null - ); - } - - private static final double[] RVMeasures ( - final Bond[] aBond, - final JulianDate dtValue, - final CurveSurfaceQuoteContainer csqc, - final double[] adblCleanPrice) - throws Exception - { - JulianDate dtSettle = dtValue.addBusDays ( - 3, - aBond[0].currency() - ); - - ValuationParams valParams = new ValuationParams ( - dtValue, - dtSettle, - aBond[0].currency() - ); - - System.out.println(); - - System.out.println ("\t|--------------------------------||"); - - System.out.println ("\t| Trade Date : " + dtValue + " ||"); - - System.out.println ("\t| Cash Settle Date : " + dtSettle + " ||"); - - System.out.println ("\t|--------------------------------||"); - - System.out.println(); - - String strCurveMetrics = ""; - String strSecularMetrics = ""; - double[] adblOAS = new double[aBond.length]; - - for (int i = 0; i < aBond.length; ++i) { - System.out.println ("Doing " + aBond[i].name()); - - WorkoutInfo wi = aBond[i].exerciseYieldFromPrice ( - valParams, - csqc, - null, - adblCleanPrice[i] - ); - - BondRVMeasures rvm = aBond[i].standardMeasures ( - valParams, - null, - csqc, - null, - wi, - adblCleanPrice[i] - ); - - strSecularMetrics += "\t| " + - aBond[i].name() + " | " + - aBond[i].effectiveDate() + " | " + - aBond[i].maturityDate() + " | " + - aBond[i].firstCouponDate() + " |" + - FormatUtil.FormatDouble (adblCleanPrice[i], 3, 3, 100.) + " |" + - FormatUtil.FormatDouble (wi.yield(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (rvm.macaulayDuration(), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (rvm.modifiedDuration(), 2, 2, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.yield01(), 2, 2, 10000.) + " |" + - FormatUtil.FormatDouble (rvm.yield01(), 4, 0, 1000000.) + " |" + - FormatUtil.FormatDouble (rvm.convexity(), 1, 2, 1000000.) + " | " + - FormatUtil.FormatDouble (rvm.bondBasis(), 3, 0, 10000.) + " ||" + "\n"; - - adblOAS[i] = rvm.oas(); - - double dblCleanPriceOASUp = aBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] + 0.0001 - ); - - double dblCleanPriceOASDown = aBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] - 0.0001 - ); - - strCurveMetrics += "\t| " + - aBond[i].name() + " |" + - FormatUtil.FormatDouble (adblCleanPrice[i], 3, 3, 100.) + " |" + - FormatUtil.FormatDouble (wi.yield(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (rvm.zSpread(), 3, 0, 10000.) + " |" + - FormatUtil.FormatDouble (adblOAS[i], 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (0.5 * (dblCleanPriceOASDown - dblCleanPriceOASUp) / adblCleanPrice[i], 2, 2, 10000.) + " | " + - FormatUtil.FormatDouble ((dblCleanPriceOASDown + dblCleanPriceOASUp - 2. * adblCleanPrice[i]) / adblCleanPrice[i], 2, 2, 1000000.) + " |" + - FormatUtil.FormatDouble (rvm.asw(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.gSpread(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.iSpread(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.tsySpread(), 3, 0, 10000.) + " | " + - Helper.BaseTsyBmk ( - dtValue.julian(), - aBond[i].maturityDate().julian() - ) + " ||" + "\n"; - } - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| BOND | EFFECTIVE | MATURITY | FIRST COUPON | PRICE | YIELD | MAC DUR | MOD DUR | YIELD 01 | DV01 | CONV | BOND BASIS ||"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print (strSecularMetrics); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||\n"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| BOND | PRICE | YIELD | Z SPREAD | OAS | OAS DUR | OAS CONV | ASW | G SPREAD | I SPREAD | TSY SPREAD | TSY BMK ||"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print (strCurveMetrics); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------||"); - - return adblOAS; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2017, - DateUtil.FEBRUARY, - 2 - ); - - String strCurrency = "USD"; - String strTreasuryCode = "UST"; - - MergedDiscountForwardCurve dcFunding = FundingCurve ( - dtSpot, - strCurrency - ); - - double[] adblTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0250, - 0.0300 - }; - - double[] adblTreasuryYield = new double[] { - 0.0083, // 1Y - 0.0122, // 2Y - 0.0149, // 3Y - 0.0193, // 5Y - 0.0227, // 7Y - 0.0248, // 10Y - 0.0280, // 20Y - 0.0308 // 30Y - }; - - Map mapGovvieCurve = GovvieCurve ( - dtSpot, - strTreasuryCode, - adblTreasuryCoupon, - adblTreasuryYield - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - csqc.setGovvieState (mapGovvieCurve.get ("BASE")); - - AccumulateBondMarketQuote ( - csqc, - new String[] { - "01YON", - "02YON", - "03YON", - "05YON", - "07YON", - "10YON", - "20YON", - "30YON" - }, - adblTreasuryYield - ); - - Bond[] aCorporateBond = new Bond[] { - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 8, 11), DateUtil.CreateFromYMD (2017, 8, 15), 0.01875, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2007, 12, 11), DateUtil.CreateFromYMD (2018, 1, 15), 0.06400, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2003, 11, 14), DateUtil.CreateFromYMD (2018, 3, 1), 0.05150, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2011, 4, 7), DateUtil.CreateFromYMD (2018, 4, 7), 0.05000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 12, 30), DateUtil.CreateFromYMD (2019, 6, 15), 0.02000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 8, 12), DateUtil.CreateFromYMD (2019, 8, 12), 0.09000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 11, 24), DateUtil.CreateFromYMD (2019, 12, 2), 0.06750, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 11, 1), DateUtil.CreateFromYMD (2020, 2, 1), 0.05875, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 7, 21), DateUtil.CreateFromYMD (2020, 7, 21), 0.05000, 2, "ISMA-30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2011, 1, 14), DateUtil.CreateFromYMD (2021, 1, 14), 0.06250, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 3, 19), DateUtil.CreateFromYMD (2021, 3, 1), 0.07000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2002, 3, 21), DateUtil.CreateFromYMD (2021, 4, 2), 0.07100, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 8, 6), DateUtil.CreateFromYMD (2021, 8, 15), 0.07625, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 5, 8), DateUtil.CreateFromYMD (2022, 5, 15), 0.06000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2007, 6, 26), DateUtil.CreateFromYMD (2022, 7, 2), 0.06360, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 8, 8), DateUtil.CreateFromYMD (2022, 7, 15), 0.05500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 6, 26), DateUtil.CreateFromYMD (2022, 7, 15), 0.05500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 8, 10), DateUtil.CreateFromYMD (2022, 8, 15), 0.05000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 9, 17), DateUtil.CreateFromYMD (2022, 9, 19), 0.05000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 11, 13), DateUtil.CreateFromYMD (2023, 5, 13), 0.05125, 2, "ISMA-30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 6, 18), DateUtil.CreateFromYMD (2023, 7, 15), 0.05250, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 9, 24), DateUtil.CreateFromYMD (2023, 9, 22), 0.04400, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 10, 4), DateUtil.CreateFromYMD (2023, 10, 15), 0.05750, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 11, 15), DateUtil.CreateFromYMD (2023, 11, 15), 0.04500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 3, 4), DateUtil.CreateFromYMD (2024, 3, 4), 0.04300, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2005, 2, 23), DateUtil.CreateFromYMD (2024, 3, 10), 0.05608, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 3, 12), DateUtil.CreateFromYMD (2024, 3, 15), 0.04650, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 4, 1), DateUtil.CreateFromYMD (2024, 4, 15), 0.06000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 3, 23), DateUtil.CreateFromYMD (2024, 5, 1), 0.06500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 5, 18), DateUtil.CreateFromYMD (2024, 6, 30), 0.07000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 11, 20), DateUtil.CreateFromYMD (2024, 7, 15), 0.04950, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 8, 9), DateUtil.CreateFromYMD (2024, 9, 1), 0.04000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 9, 9), DateUtil.CreateFromYMD (2024, 9, 9), 0.03625, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 10, 8), DateUtil.CreateFromYMD (2024, 10, 8), 0.04000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 9, 25), DateUtil.CreateFromYMD (2024, 10, 15), 0.05875, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 9, 12), DateUtil.CreateFromYMD (2025, 3, 15), 0.04500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 8, 15), DateUtil.CreateFromYMD (2025, 8, 15), 0.04300, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 8, 13), DateUtil.CreateFromYMD (2026, 3, 1), 0.04875, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 5, 12), DateUtil.CreateFromYMD (2026, 5, 12), 0.05200, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 5, 25), DateUtil.CreateFromYMD (2026, 5, 25), 0.03900, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 7, 22), DateUtil.CreateFromYMD (2026, 8, 1), 0.05250, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (1996, 8, 20), DateUtil.CreateFromYMD (2026, 8, 20), 0.07500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 9, 27), DateUtil.CreateFromYMD (2026, 9, 30), 0.07000, 2, "ISMA-30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (1997, 3, 18), DateUtil.CreateFromYMD (2027, 3, 15), 0.08150, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 5, 18), DateUtil.CreateFromYMD (2028, 5, 10), 0.04875, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 9, 24), DateUtil.CreateFromYMD (2035, 10, 1), 0.05100, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 12, 19), DateUtil.CreateFromYMD (2036, 1, 20), 0.04704, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2006, 12, 20), DateUtil.CreateFromYMD (2036, 7, 15), 0.05508, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2007, 12, 12), DateUtil.CreateFromYMD (2037, 12, 15), 0.07875, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2008, 1, 14), DateUtil.CreateFromYMD (2038, 1, 14), 0.05875, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2008, 3, 4), DateUtil.CreateFromYMD (2038, 3, 1), 0.08500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 1, 26), DateUtil.CreateFromYMD (2039, 1, 26), 0.06950, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 9, 3), DateUtil.CreateFromYMD (2039, 9, 15), 0.10500, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2011, 6, 30), DateUtil.CreateFromYMD (2041, 1, 15), 0.06615, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2007, 7, 26), DateUtil.CreateFromYMD (2049, 10, 15), 0.06298, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 5, 12), DateUtil.CreateFromYMD (2050, 6, 15), 0.05750, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2006, 11, 9), DateUtil.CreateFromYMD (2051, 10, 1), 0.05880, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2007, 11, 29), DateUtil.CreateFromYMD (2054, 12, 15), 0.06225, 2, "30/360"), - }; - - double[] adblCleanPrice = new double[] { - 0.9998484, // (2017, 8, 15) - 1.0425350, // (2018, 1, 15) - 1.0316920, // (2018, 3, 1) - 1.0284800, // (2018, 4, 7) - 0.9945010, // (2019, 6, 15) - 1.1604340, // (2019, 8, 12) - 1.1116650, // (2019, 12, 2) - 1.0830680, // (2020, 2, 1) - 1.0805160, // (2020, 7, 21) - 1.1102950, // (2021, 1, 14) - 0.8625000, // (2021, 3, 1) - 1.0908000, // (2021, 4, 2) - 1.0012500, // (2021, 8, 15) - 1.0032500, // (2022, 5, 15) - 1.0770440, // (2022, 7, 2) - 1.1058380, // (2022, 7, 15) - 1.0056010, // (2022, 7, 15) - 1.0430000, // (2022, 8, 15) - 1.0341470, // (2022, 9, 19) - 1.0089250, // (2023, 5, 13) - 1.0532590, // (2023, 7, 15) - 1.0048190, // (2023, 9, 22) - 1.0649420, // (2023, 10, 15) - 1.0491060, // (2023, 11, 15) - 1.0256420, // (2024, 3, 4) - 0.9970046, // (2024, 3, 10) - 1.0047450, // (2024, 3, 15) - 1.0644970, // (2024, 4, 15) - 0.8707988, // (2024, 5, 1) - 1.1162500, // (2024, 6, 30) - 0.9987730, // (2024, 7, 15) - 1.0036200, // (2024, 9, 1) - 1.0040380, // (2024, 9, 9) - 0.9301917, // (2024, 10, 8) - 1.0100000, // (2024, 10, 15) - 0.9798427, // (2025, 3, 15) - 1.0373370, // (2025, 8, 15) - 1.0153130, // (2026, 3, 1) - 1.0157040, // (2026, 5, 12) - 0.9979078, // (2026, 5, 25) - 0.9893078, // (2026, 8, 1) - 1.2637800, // (2026, 8, 20) - 1.0883410, // (2026, 9, 30) - 1.2581270, // (2027, 3, 15) - 0.9834310, // (2028, 5, 10) - 1.1197450, // (2035, 10, 1) - 1.0519960, // (2036, 1, 20) - 1.0638120, // (2036, 7, 15) - 1.2468240, // (2037, 12, 15) - 1.2615530, // (2038, 1, 14) - 1.4061740, // (2038, 3, 1) - 1.2640440, // (2039, 1, 26) - 1.5083180, // (2039, 9, 15) - // 1.1469740, // (2042, 1, 15) - // 0.9201830, // (2049, 10, 15) - // 0.9374883, // (2050, 6, 15) - // 1.0349240, // (2051, 10, 1) - // 0.9502689, // (2054, 12, 15) - }; - - double[] adblOAS = RVMeasures ( - aCorporateBond, - dtSpot, - csqc, - adblCleanPrice - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot.addBusDays ( - 3, - dcFunding.currency() - ), - dcFunding.currency() - ); - - System.out.println(); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print ("\t| BOND "); - - for (Map.Entry meGovvieCurve : mapGovvieCurve.entrySet()) { - if ("BASE".equalsIgnoreCase (meGovvieCurve.getKey()) || "BUMP".equalsIgnoreCase (meGovvieCurve.getKey())) - continue; - - System.out.print (" | " + meGovvieCurve.getKey()); - } - - System.out.println (" ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < adblOAS.length; ++i) { - System.out.print ("\t| " + aCorporateBond[i].name()); - - for (Map.Entry meGovvieCurve : mapGovvieCurve.entrySet()) { - if ("BASE".equalsIgnoreCase (meGovvieCurve.getKey()) || "BUMP".equalsIgnoreCase (meGovvieCurve.getKey())) - continue; - - csqc.setGovvieState (meGovvieCurve.getValue()); - - System.out.print (" | " + - FormatUtil.FormatDouble ( - (adblCleanPrice[i] - aCorporateBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] - )) / adblCleanPrice[i], - 2, 2, 10000.) + " " - ); - } - - System.out.println (" ||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/bondfixed/BulletCorporate4.java b/org/drip/sample/bondfixed/BulletCorporate4.java deleted file mode 100644 index 80cd927..0000000 --- a/org/drip/sample/bondfixed/BulletCorporate4.java +++ /dev/null @@ -1,782 +0,0 @@ - -package org.drip.sample.bondfixed; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.analytics.output.BondRVMeasures; -import org.drip.analytics.support.Helper; -import org.drip.param.creator.MarketParamsBuilder; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.quote.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.BondBuilder; -import org.drip.product.credit.BondComponent; -import org.drip.product.definition.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.govvie.GovvieCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * BulletCorporate4 demonstrates Non-EOS Fixed Coupon Corporate Bond Pricing and Relative Value Measure - * Generation Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class BulletCorporate4 { - - private static final MergedDiscountForwardCurve FundingCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrDepositMaturityTenor = new String[] { - "2D" - }; - - double[] adblDepositQuote = new double[] { - 0.0103456 // 2D - }; - - double[] adblFuturesQuote = new double[] { - 0.01070, - 0.01235, - 0.01360 - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.012484, // 1Y - 0.014987, // 2Y - 0.017036, // 3Y - 0.018624, // 4Y - 0.019868, // 5Y - 0.020921, // 6Y - 0.021788, // 7Y - 0.022530, // 8Y - 0.023145, // 9Y - 0.023685, // 10Y - 0.024153, // 11Y - 0.024562, // 12Y - 0.025389, // 15Y - 0.026118, // 20Y - 0.026368, // 25Y - 0.026432, // 30Y - 0.026339, // 40Y - 0.026122 // 50Y - }; - - MergedDiscountForwardCurve dcFunding = LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - adblFuturesQuote, - "ForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate" - ); - - Component[] aDepositComp = OTCInstrumentBuilder.FundingDeposit ( - dtSpot, - strCurrency, - astrDepositMaturityTenor - ); - - Component[] aFuturesComp = ExchangeInstrumentBuilder.ForwardRateFuturesPack ( - dtSpot, - adblFuturesQuote.length, - strCurrency - ); - - Component[] aFixFloatComp = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - astrFixFloatMaturityTenor, - "MAIN", - 0. - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - System.out.println(); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println ("\t| DEPOSIT INPUT vs. CALC ||"); - - System.out.println ("\t|-------------------------------------||"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t| [" + aDepositComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aDepositComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println(); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println ("\t| FUTURES INPUT vs. CALC ||"); - - System.out.println ("\t|-------------------------------------||"); - - for (int i = 0; i < aFuturesComp.length; ++i) - System.out.println ("\t| [" + aFuturesComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFuturesComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFuturesQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println(); - - System.out.println ("\t|------------------------------------------------|| "); - - System.out.println ("\t| FIX-FLOAT INPUTS vs CALIB ||"); - - System.out.println ("\t|------------------------------------------------|| "); - - for (int i = 0; i < aFixFloatComp.length; ++i) - System.out.println ("\t| [" + aFixFloatComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "CalibSwapRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFixFloatQuote[i], 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "FairPremium" - ), 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|------------------------------------------------||"); - - System.out.println(); - - return dcFunding; - } - - private static final Map GovvieCurve ( - final JulianDate dtSpot, - final String strCode, - final double[] adblCoupon, - final double[] adblYield) - throws Exception - { - JulianDate[] adtEffective = new JulianDate[] { - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot - }; - - JulianDate[] adtMaturity = new JulianDate[] { - dtSpot.addTenor ("1Y"), - dtSpot.addTenor ("2Y"), - dtSpot.addTenor ("3Y"), - dtSpot.addTenor ("5Y"), - dtSpot.addTenor ("7Y"), - dtSpot.addTenor ("10Y"), - dtSpot.addTenor ("20Y"), - dtSpot.addTenor ("30Y") - }; - - Map mapGovvieCurve = LatentMarketStateBuilder.BumpedGovvieCurve ( - strCode, - dtSpot, - adtEffective, - adtMaturity, - adblCoupon, - adblYield, - "Yield", - LatentMarketStateBuilder.SHAPE_PRESERVING, - 0.0001, - false - ); - - BondComponent[] aComp = TreasuryBuilder.FromCode ( - strCode, - adtEffective, - adtMaturity, - adblCoupon - ); - - ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setGovvieState (mapGovvieCurve.get ("BASE")); - - System.out.println(); - - System.out.println ("\t|-------------------------------------------||"); - - System.out.println ("\t| TREASURY INPUT vs CALIB YIELD ||"); - - System.out.println ("\t|-------------------------------------------||"); - - for (int i = 0; i < aComp.length; ++i) - System.out.println ("\t| " + aComp[i].name() + " | " + - FormatUtil.FormatDouble (adblYield[i], 1, 3, 100.) + "% | " + - FormatUtil.FormatDouble (aComp[i].yieldFromPrice ( - valParams, - null, - null, - aComp[i].maturityDate().julian(), - 1., - aComp[i].priceFromYield ( - valParams, - null, - null, - mapGovvieCurve.get ("BASE").yield (aComp[i].maturityDate().julian()) - ) - ), 1, 3, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------------------------------||"); - - return mapGovvieCurve; - } - - private static final void AccumulateBondMarketQuote ( - final CurveSurfaceQuoteContainer csqc, - final String[] astrOnTheRunCode, - final double[] adblYield) - throws Exception - { - for (int i = 0; i < astrOnTheRunCode.length; ++i) { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Yield", - new MultiSided ( - "mid", - adblYield[i] - ), - true - ); - - csqc.setProductQuote ( - astrOnTheRunCode[i], - pmmq - ); - } - } - - private static final Bond Corporate ( - final String strName, - final JulianDate dtEffective, - final JulianDate dtMaturity, - final double dblCoupon, - final int iFreq, - final String strDayCount) - throws Exception - { - return BondBuilder.CreateSimpleFixed ( - strName + FormatUtil.FormatDouble (dblCoupon, 1, 4, 100.) + " " + dtMaturity, - "USD", - "", - dblCoupon, - iFreq, - strDayCount, - dtEffective, - dtMaturity, - null, - null - ); - } - - private static final double[] RVMeasures ( - final Bond[] aBond, - final JulianDate dtValue, - final CurveSurfaceQuoteContainer csqc, - final double[] adblCleanPrice) - throws Exception - { - JulianDate dtSettle = dtValue.addBusDays ( - 3, - aBond[0].currency() - ); - - ValuationParams valParams = new ValuationParams ( - dtValue, - dtSettle, - aBond[0].currency() - ); - - System.out.println(); - - System.out.println ("\t|--------------------------------||"); - - System.out.println ("\t| Trade Date : " + dtValue + " ||"); - - System.out.println ("\t| Cash Settle Date : " + dtSettle + " ||"); - - System.out.println ("\t|--------------------------------||"); - - System.out.println(); - - String strCurveMetrics = ""; - String strSecularMetrics = ""; - double[] adblOAS = new double[aBond.length]; - - for (int i = 0; i < aBond.length; ++i) { - System.out.println ("Doing " + aBond[i].name()); - - WorkoutInfo wi = aBond[i].exerciseYieldFromPrice ( - valParams, - csqc, - null, - adblCleanPrice[i] - ); - - BondRVMeasures rvm = aBond[i].standardMeasures ( - valParams, - null, - csqc, - null, - wi, - adblCleanPrice[i] - ); - - strSecularMetrics += "\t| " + - aBond[i].name() + " | " + - aBond[i].effectiveDate() + " | " + - aBond[i].maturityDate() + " | " + - aBond[i].firstCouponDate() + " |" + - FormatUtil.FormatDouble (adblCleanPrice[i], 3, 3, 100.) + " |" + - FormatUtil.FormatDouble (wi.yield(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (rvm.macaulayDuration(), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (rvm.modifiedDuration(), 2, 2, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.yield01(), 2, 2, 10000.) + " |" + - FormatUtil.FormatDouble (rvm.yield01(), 4, 0, 1000000.) + " |" + - FormatUtil.FormatDouble (rvm.convexity(), 1, 2, 1000000.) + " | " + - FormatUtil.FormatDouble (rvm.bondBasis(), 3, 0, 10000.) + " ||" + "\n"; - - adblOAS[i] = rvm.oas(); - - double dblCleanPriceOASUp = aBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] + 0.0001 - ); - - double dblCleanPriceOASDown = aBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] - 0.0001 - ); - - strCurveMetrics += "\t| " + - aBond[i].name() + " |" + - FormatUtil.FormatDouble (adblCleanPrice[i], 3, 3, 100.) + " |" + - FormatUtil.FormatDouble (wi.yield(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (rvm.zSpread(), 3, 0, 10000.) + " |" + - FormatUtil.FormatDouble (adblOAS[i], 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (0.5 * (dblCleanPriceOASDown - dblCleanPriceOASUp) / adblCleanPrice[i], 2, 2, 10000.) + " | " + - FormatUtil.FormatDouble ((dblCleanPriceOASDown + dblCleanPriceOASUp - 2. * adblCleanPrice[i]) / adblCleanPrice[i], 2, 2, 1000000.) + " |" + - FormatUtil.FormatDouble (rvm.asw(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.gSpread(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.iSpread(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.tsySpread(), 3, 0, 10000.) + " | " + - Helper.BaseTsyBmk ( - dtValue.julian(), - aBond[i].maturityDate().julian() - ) + " ||" + "\n"; - } - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| BOND | EFFECTIVE | MATURITY | FIRST COUPON | PRICE | YIELD | MAC DUR | MOD DUR | YIELD 01 | DV01 | CONV | BOND BASIS ||"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print (strSecularMetrics); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||\n"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| BOND | PRICE | YIELD | Z SPREAD | OAS | OAS DUR | OAS CONV | ASW | G SPREAD | I SPREAD | TSY SPREAD | TSY BMK ||"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print (strCurveMetrics); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------||"); - - return adblOAS; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2017, - DateUtil.FEBRUARY, - 2 - ); - - String strCurrency = "USD"; - String strTreasuryCode = "UST"; - - MergedDiscountForwardCurve dcFunding = FundingCurve ( - dtSpot, - strCurrency - ); - - double[] adblTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0250, - 0.0300 - }; - - double[] adblTreasuryYield = new double[] { - 0.0083, // 1Y - 0.0122, // 2Y - 0.0149, // 3Y - 0.0193, // 5Y - 0.0227, // 7Y - 0.0248, // 10Y - 0.0280, // 20Y - 0.0308 // 30Y - }; - - Map mapGovvieCurve = GovvieCurve ( - dtSpot, - strTreasuryCode, - adblTreasuryCoupon, - adblTreasuryYield - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - csqc.setGovvieState (mapGovvieCurve.get ("BASE")); - - AccumulateBondMarketQuote ( - csqc, - new String[] { - "01YON", - "02YON", - "03YON", - "05YON", - "07YON", - "10YON", - "20YON", - "30YON" - }, - adblTreasuryYield - ); - - Bond[] aCorporateBond = new Bond[] { - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 3, 17), DateUtil.CreateFromYMD (2017, 3, 15), 0.02400, 2, "ISMA-30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 7, 23), DateUtil.CreateFromYMD (2017, 7, 1), 0.01450, 2, "ISMA-30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 9, 20), DateUtil.CreateFromYMD (2017, 9, 25), 0.01800, 2, "ISMA-30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (1999, 6, 25), DateUtil.CreateFromYMD (2019, 3, 1), 0.07575, 2, "ISMA-30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 4, 7), DateUtil.CreateFromYMD (2019, 4, 15), 0.09000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 6, 30), DateUtil.CreateFromYMD (2019, 7, 15), 0.08500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2007, 11, 13), DateUtil.CreateFromYMD (2019, 11, 1), 0.06040, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 3, 1), DateUtil.CreateFromYMD (2020, 3, 1), 0.07000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2011, 3, 11), DateUtil.CreateFromYMD (2020, 3, 15), 0.05350, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 3, 26), DateUtil.CreateFromYMD (2020, 4, 1), 0.07375, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 9, 27), DateUtil.CreateFromYMD (2020, 9, 30), 0.06250, 2, "30/360 NON/EOM"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 11, 16), DateUtil.CreateFromYMD (2020, 11, 16), 0.05750, 2, "ISMA-30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2011, 1, 25), DateUtil.CreateFromYMD (2021, 1, 30), 0.05250, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2011, 8, 9), DateUtil.CreateFromYMD (2021, 8, 15), 0.05375, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2011, 11, 14), DateUtil.CreateFromYMD (2021, 9, 15), 0.07250, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 6, 14), DateUtil.CreateFromYMD (2022, 6, 15), 0.03950, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 8, 13), DateUtil.CreateFromYMD (2022, 8, 15), 0.05375, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 9, 12), DateUtil.CreateFromYMD (2023, 9, 12), 0.03875, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 9, 18), DateUtil.CreateFromYMD (2022, 9, 15), 0.04450, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 6, 20), DateUtil.CreateFromYMD (2023, 9, 15), 0.05100, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 9, 12), DateUtil.CreateFromYMD (2023, 9, 15), 0.05000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 11, 26), DateUtil.CreateFromYMD (2023, 11, 26), 0.03875, 2, "ISMA-30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 4, 3), DateUtil.CreateFromYMD (2024, 4, 1), 0.04250, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 3, 22), DateUtil.CreateFromYMD (2024, 4, 11), 0.04150, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 11, 4), DateUtil.CreateFromYMD (2024, 4, 11), 0.04500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 5, 23), DateUtil.CreateFromYMD (2024, 6, 1), 0.05250, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 11, 10), DateUtil.CreateFromYMD (2024, 11, 15), 0.04600, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 1, 29), DateUtil.CreateFromYMD (2024, 11, 15), 0.05875, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 11, 17), DateUtil.CreateFromYMD (2024, 11, 15), 0.04500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 9, 27), DateUtil.CreateFromYMD (2024, 12, 1), 0.04875, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2005, 3, 31), DateUtil.CreateFromYMD (2025, 3, 18), 0.06625, 2, "ISMA-30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 5, 15), DateUtil.CreateFromYMD (2025, 5, 15), 0.03663, 12, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 8, 3), DateUtil.CreateFromYMD (2025, 8, 15), 0.04700, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 9, 24), DateUtil.CreateFromYMD (2025, 9, 15), 0.04600, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 12, 9), DateUtil.CreateFromYMD (2025, 9, 15), 0.04500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 10, 14), DateUtil.CreateFromYMD (2025, 10, 14), 0.04375, 2, "ISMA-30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 11, 23), DateUtil.CreateFromYMD (2025, 12, 1), 0.04500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 11, 23), DateUtil.CreateFromYMD (2025, 12, 1), 0.04500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 9, 16), DateUtil.CreateFromYMD (2027, 1, 16), 0.03107, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 1, 19), DateUtil.CreateFromYMD (2028, 1, 15), 0.04100, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 9, 27), DateUtil.CreateFromYMD (2028, 10, 7), 0.03100, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2011, 4, 25), DateUtil.CreateFromYMD (2031, 1, 5), 0.06625, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 12, 22), DateUtil.CreateFromYMD (2032, 1, 10), 0.07507, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 5, 14), DateUtil.CreateFromYMD (2035, 5, 15), 0.04500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2006, 1, 31), DateUtil.CreateFromYMD (2036, 1, 15), 0.05560, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2007, 5, 10), DateUtil.CreateFromYMD (2037, 5, 10), 0.05951, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2008, 4, 4), DateUtil.CreateFromYMD (2038, 4, 1), 0.06750, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2008, 5, 8), DateUtil.CreateFromYMD (2038, 5, 15), 0.05900, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 2, 3), DateUtil.CreateFromYMD (2039, 2, 1), 0.06500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 8, 10), DateUtil.CreateFromYMD (2039, 8, 15), 0.09375, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 10, 15), DateUtil.CreateFromYMD (2040, 10, 15), 0.06950, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2007, 12, 4), DateUtil.CreateFromYMD (2041, 12, 15), 0.06071, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 9, 18), DateUtil.CreateFromYMD (2044, 9, 15), 0.04900, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 7, 11), DateUtil.CreateFromYMD (2046, 3, 15), 0.08125, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2004, 5, 27), DateUtil.CreateFromYMD (2049, 2, 1), 0.06193, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 5, 12), DateUtil.CreateFromYMD (2050, 6, 15), 0.05750, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2006, 9, 29), DateUtil.CreateFromYMD (2051, 9, 15), 0.05611, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2008, 11, 4), DateUtil.CreateFromYMD (2053, 9, 15), 0.06160, 2, "30/360"), - }; - - double[] adblCleanPrice = new double[] { - // 1.0018170, // (2017, 3, 15) - 1.0013230, // (2017, 7, 1) - 1.0011760, // (2017, 9, 25) - 1.0455000, // (2019, 3, 1) - 1.1366680, // (2019, 4, 15) - 1.1376600, // (2019, 7, 15) - 1.0530710, // (2019, 11, 1) - 1.0807080, // (2020, 3, 1) - 1.0493140, // (2020, 3, 15) - 1.0025000, // (2020, 4, 1) - 1.1120710, // (2020, 9, 30) - 1.0956540, // (2020, 11, 16) - 1.0712130, // (2021, 1, 30) - 1.0986090, // (2021, 8, 15) - 1.0740510, // (2021, 9, 15) - 0.9936411, // (2022, 6, 15) - 1.1100570, // (2022, 8, 15) - 1.0419520, // (2022, 9, 15) - 0.9646333, // (2023, 9, 12) - 1.0170750, // (2023, 9, 15) - 1.0842850, // (2023, 9, 15) - 1.0184740, // (2023, 11, 15) - 1.0133860, // (2024, 4, 1) - 1.0317130, // (2024, 4, 11) - 1.0168940, // (2024, 4, 11) - 0.9895703, // (2024, 6, 1) - 0.9994200, // (2024, 11, 15) - 1.0124990, // (2024, 11, 15) - 0.9855716, // (2024, 11, 15) - 1.0431030, // (2024, 12, 1) - 1.1375300, // (2025, 3, 18) - // 1.0096890, // (2025, 5, 15) - 1.0327190, // (2025, 8, 15) - 1.0455430, // (2025, 9, 15) - 0.9841400, // (2025, 10, 14) - 0.9922074, // (2025, 12, 1) - 1.0320300, // (2025, 12, 9) - 0.9789541, // (2025, 12, 15) - 0.9501763, // (2027, 1, 16) - 1.0181940, // (2028, 1, 15) - 0.9576301, // (2028, 10, 7) - 1.1426420, // (2031, 5, 1) - 1.2375490, // (2032, 1, 10) - 0.9592908, // (2035, 5, 15) - 1.1073040, // (2036, 1, 15) - 1.2147760, // (2037, 5, 10) - 1.3483540, // (2038, 4, 1) - 1.1883150, // (2038, 5, 15) - 1.2622890, // (2039, 2, 1) - 1.5450800, // (2039, 8, 15) - // 1.2270620, // (2040, 10, 15) - // 0.9457504, // (2041, 12, 15) - // 1.0821480, // (2044, 9, 15) - // 1.2320100, // (2046, 3, 15) - // 1.1807840, // (2049, 4, 1) - // 0.9854683, // (2050, 6, 15) - // 1.0373120, // (2051, 9, 15) - // 0.9749159, // (2053, 9, 15) - }; - - double[] adblOAS = RVMeasures ( - aCorporateBond, - dtSpot, - csqc, - adblCleanPrice - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot.addBusDays ( - 3, - dcFunding.currency() - ), - dcFunding.currency() - ); - - System.out.println(); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print ("\t| BOND "); - - for (Map.Entry meGovvieCurve : mapGovvieCurve.entrySet()) { - if ("BASE".equalsIgnoreCase (meGovvieCurve.getKey()) || "BUMP".equalsIgnoreCase (meGovvieCurve.getKey())) - continue; - - System.out.print (" | " + meGovvieCurve.getKey()); - } - - System.out.println (" ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < adblOAS.length; ++i) { - System.out.print ("\t| " + aCorporateBond[i].name()); - - for (Map.Entry meGovvieCurve : mapGovvieCurve.entrySet()) { - if ("BASE".equalsIgnoreCase (meGovvieCurve.getKey()) || "BUMP".equalsIgnoreCase (meGovvieCurve.getKey())) - continue; - - csqc.setGovvieState (meGovvieCurve.getValue()); - - System.out.print (" | " + - FormatUtil.FormatDouble ( - (adblCleanPrice[i] - aCorporateBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] - )) / adblCleanPrice[i], - 2, 2, 10000.) + " " - ); - } - - System.out.println (" ||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/bondfixed/BulletCorporate5.java b/org/drip/sample/bondfixed/BulletCorporate5.java deleted file mode 100644 index 01579df..0000000 --- a/org/drip/sample/bondfixed/BulletCorporate5.java +++ /dev/null @@ -1,782 +0,0 @@ - -package org.drip.sample.bondfixed; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.analytics.output.BondRVMeasures; -import org.drip.analytics.support.Helper; -import org.drip.param.creator.MarketParamsBuilder; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.quote.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.BondBuilder; -import org.drip.product.credit.BondComponent; -import org.drip.product.definition.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.govvie.GovvieCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * BulletCorporate5 demonstrates Non-EOS Fixed Coupon Corporate Bond Pricing and Relative Value Measure - * Generation Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class BulletCorporate5 { - - private static final MergedDiscountForwardCurve FundingCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrDepositMaturityTenor = new String[] { - "2D" - }; - - double[] adblDepositQuote = new double[] { - 0.0103456 // 2D - }; - - double[] adblFuturesQuote = new double[] { - 0.01070, - 0.01235, - 0.01360 - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.012484, // 1Y - 0.014987, // 2Y - 0.017036, // 3Y - 0.018624, // 4Y - 0.019868, // 5Y - 0.020921, // 6Y - 0.021788, // 7Y - 0.022530, // 8Y - 0.023145, // 9Y - 0.023685, // 10Y - 0.024153, // 11Y - 0.024562, // 12Y - 0.025389, // 15Y - 0.026118, // 20Y - 0.026368, // 25Y - 0.026432, // 30Y - 0.026339, // 40Y - 0.026122 // 50Y - }; - - MergedDiscountForwardCurve dcFunding = LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - adblFuturesQuote, - "ForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate" - ); - - Component[] aDepositComp = OTCInstrumentBuilder.FundingDeposit ( - dtSpot, - strCurrency, - astrDepositMaturityTenor - ); - - Component[] aFuturesComp = ExchangeInstrumentBuilder.ForwardRateFuturesPack ( - dtSpot, - adblFuturesQuote.length, - strCurrency - ); - - Component[] aFixFloatComp = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - astrFixFloatMaturityTenor, - "MAIN", - 0. - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - System.out.println(); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println ("\t| DEPOSIT INPUT vs. CALC ||"); - - System.out.println ("\t|-------------------------------------||"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t| [" + aDepositComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aDepositComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println(); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println ("\t| FUTURES INPUT vs. CALC ||"); - - System.out.println ("\t|-------------------------------------||"); - - for (int i = 0; i < aFuturesComp.length; ++i) - System.out.println ("\t| [" + aFuturesComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFuturesComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFuturesQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println(); - - System.out.println ("\t|------------------------------------------------|| "); - - System.out.println ("\t| FIX-FLOAT INPUTS vs CALIB ||"); - - System.out.println ("\t|------------------------------------------------|| "); - - for (int i = 0; i < aFixFloatComp.length; ++i) - System.out.println ("\t| [" + aFixFloatComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "CalibSwapRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFixFloatQuote[i], 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "FairPremium" - ), 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|------------------------------------------------||"); - - System.out.println(); - - return dcFunding; - } - - private static final Map GovvieCurve ( - final JulianDate dtSpot, - final String strCode, - final double[] adblCoupon, - final double[] adblYield) - throws Exception - { - JulianDate[] adtEffective = new JulianDate[] { - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot - }; - - JulianDate[] adtMaturity = new JulianDate[] { - dtSpot.addTenor ("1Y"), - dtSpot.addTenor ("2Y"), - dtSpot.addTenor ("3Y"), - dtSpot.addTenor ("5Y"), - dtSpot.addTenor ("7Y"), - dtSpot.addTenor ("10Y"), - dtSpot.addTenor ("20Y"), - dtSpot.addTenor ("30Y") - }; - - Map mapGovvieCurve = LatentMarketStateBuilder.BumpedGovvieCurve ( - strCode, - dtSpot, - adtEffective, - adtMaturity, - adblCoupon, - adblYield, - "Yield", - LatentMarketStateBuilder.SHAPE_PRESERVING, - 0.0001, - false - ); - - BondComponent[] aComp = TreasuryBuilder.FromCode ( - strCode, - adtEffective, - adtMaturity, - adblCoupon - ); - - ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setGovvieState (mapGovvieCurve.get ("BASE")); - - System.out.println(); - - System.out.println ("\t|-------------------------------------------||"); - - System.out.println ("\t| TREASURY INPUT vs CALIB YIELD ||"); - - System.out.println ("\t|-------------------------------------------||"); - - for (int i = 0; i < aComp.length; ++i) - System.out.println ("\t| " + aComp[i].name() + " | " + - FormatUtil.FormatDouble (adblYield[i], 1, 3, 100.) + "% | " + - FormatUtil.FormatDouble (aComp[i].yieldFromPrice ( - valParams, - null, - null, - aComp[i].maturityDate().julian(), - 1., - aComp[i].priceFromYield ( - valParams, - null, - null, - mapGovvieCurve.get ("BASE").yield (aComp[i].maturityDate().julian()) - ) - ), 1, 3, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------------------------------||"); - - return mapGovvieCurve; - } - - private static final void AccumulateBondMarketQuote ( - final CurveSurfaceQuoteContainer csqc, - final String[] astrOnTheRunCode, - final double[] adblYield) - throws Exception - { - for (int i = 0; i < astrOnTheRunCode.length; ++i) { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Yield", - new MultiSided ( - "mid", - adblYield[i] - ), - true - ); - - csqc.setProductQuote ( - astrOnTheRunCode[i], - pmmq - ); - } - } - - private static final Bond Corporate ( - final String strName, - final JulianDate dtEffective, - final JulianDate dtMaturity, - final double dblCoupon, - final int iFreq, - final String strDayCount) - throws Exception - { - return BondBuilder.CreateSimpleFixed ( - strName + FormatUtil.FormatDouble (dblCoupon, 1, 4, 100.) + " " + dtMaturity, - "USD", - "", - dblCoupon, - iFreq, - strDayCount, - dtEffective, - dtMaturity, - null, - null - ); - } - - private static final double[] RVMeasures ( - final Bond[] aBond, - final JulianDate dtValue, - final CurveSurfaceQuoteContainer csqc, - final double[] adblCleanPrice) - throws Exception - { - JulianDate dtSettle = dtValue.addBusDays ( - 3, - aBond[0].currency() - ); - - ValuationParams valParams = new ValuationParams ( - dtValue, - dtSettle, - aBond[0].currency() - ); - - System.out.println(); - - System.out.println ("\t|--------------------------------||"); - - System.out.println ("\t| Trade Date : " + dtValue + " ||"); - - System.out.println ("\t| Cash Settle Date : " + dtSettle + " ||"); - - System.out.println ("\t|--------------------------------||"); - - System.out.println(); - - String strCurveMetrics = ""; - String strSecularMetrics = ""; - double[] adblOAS = new double[aBond.length]; - - for (int i = 0; i < aBond.length; ++i) { - System.out.println ("Doing " + aBond[i].name()); - - WorkoutInfo wi = aBond[i].exerciseYieldFromPrice ( - valParams, - csqc, - null, - adblCleanPrice[i] - ); - - BondRVMeasures rvm = aBond[i].standardMeasures ( - valParams, - null, - csqc, - null, - wi, - adblCleanPrice[i] - ); - - strSecularMetrics += "\t| " + - aBond[i].name() + " | " + - aBond[i].effectiveDate() + " | " + - aBond[i].maturityDate() + " | " + - aBond[i].firstCouponDate() + " |" + - FormatUtil.FormatDouble (adblCleanPrice[i], 3, 3, 100.) + " |" + - FormatUtil.FormatDouble (wi.yield(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (rvm.macaulayDuration(), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (rvm.modifiedDuration(), 2, 2, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.yield01(), 2, 2, 10000.) + " |" + - FormatUtil.FormatDouble (rvm.yield01(), 4, 0, 1000000.) + " |" + - FormatUtil.FormatDouble (rvm.convexity(), 1, 2, 1000000.) + " | " + - FormatUtil.FormatDouble (rvm.bondBasis(), 3, 0, 10000.) + " ||" + "\n"; - - adblOAS[i] = rvm.oas(); - - double dblCleanPriceOASUp = aBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] + 0.0001 - ); - - double dblCleanPriceOASDown = aBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] - 0.0001 - ); - - strCurveMetrics += "\t| " + - aBond[i].name() + " |" + - FormatUtil.FormatDouble (adblCleanPrice[i], 3, 3, 100.) + " |" + - FormatUtil.FormatDouble (wi.yield(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (rvm.zSpread(), 3, 0, 10000.) + " |" + - FormatUtil.FormatDouble (adblOAS[i], 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (0.5 * (dblCleanPriceOASDown - dblCleanPriceOASUp) / adblCleanPrice[i], 2, 2, 10000.) + " | " + - FormatUtil.FormatDouble ((dblCleanPriceOASDown + dblCleanPriceOASUp - 2. * adblCleanPrice[i]) / adblCleanPrice[i], 2, 2, 1000000.) + " |" + - FormatUtil.FormatDouble (rvm.asw(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.gSpread(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.iSpread(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.tsySpread(), 3, 0, 10000.) + " | " + - Helper.BaseTsyBmk ( - dtValue.julian(), - aBond[i].maturityDate().julian() - ) + " ||" + "\n"; - } - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| BOND | EFFECTIVE | MATURITY | FIRST COUPON | PRICE | YIELD | MAC DUR | MOD DUR | YIELD 01 | DV01 | CONV | BOND BASIS ||"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print (strSecularMetrics); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||\n"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| BOND | PRICE | YIELD | Z SPREAD | OAS | OAS DUR | OAS CONV | ASW | G SPREAD | I SPREAD | TSY SPREAD | TSY BMK ||"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print (strCurveMetrics); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------||"); - - return adblOAS; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2017, - DateUtil.FEBRUARY, - 2 - ); - - String strCurrency = "USD"; - String strTreasuryCode = "UST"; - - MergedDiscountForwardCurve dcFunding = FundingCurve ( - dtSpot, - strCurrency - ); - - double[] adblTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0250, - 0.0300 - }; - - double[] adblTreasuryYield = new double[] { - 0.0083, // 1Y - 0.0122, // 2Y - 0.0149, // 3Y - 0.0193, // 5Y - 0.0227, // 7Y - 0.0248, // 10Y - 0.0280, // 20Y - 0.0308 // 30Y - }; - - Map mapGovvieCurve = GovvieCurve ( - dtSpot, - strTreasuryCode, - adblTreasuryCoupon, - adblTreasuryYield - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - csqc.setGovvieState (mapGovvieCurve.get ("BASE")); - - AccumulateBondMarketQuote ( - csqc, - new String[] { - "01YON", - "02YON", - "03YON", - "05YON", - "07YON", - "10YON", - "20YON", - "30YON" - }, - adblTreasuryYield - ); - - Bond[] aCorporateBond = new Bond[] { - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 2, 25), DateUtil.CreateFromYMD (2017, 2, 25), 0.00900, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 1, 14), DateUtil.CreateFromYMD (2017, 6, 5), 0.02250, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (1997, 7, 14), DateUtil.CreateFromYMD (2017, 7, 15), 0.07450, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 3, 5), DateUtil.CreateFromYMD (2017, 9, 5), 0.05125, 2, "ISMA-30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 7, 15), DateUtil.CreateFromYMD (2018, 4, 15), 0.03625, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2011, 11, 21), DateUtil.CreateFromYMD (2018, 11, 1), 0.06250, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2008, 11, 14), DateUtil.CreateFromYMD (2018, 11, 15), 0.07750, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2011, 11, 9), DateUtil.CreateFromYMD (2018, 11, 15), 0.09000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 1, 30), DateUtil.CreateFromYMD (2019, 2, 1), 0.07125, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 5, 15), DateUtil.CreateFromYMD (2019, 6, 1), 0.08125, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 6, 17), DateUtil.CreateFromYMD (2019, 6, 15), 0.09875, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 6, 30), DateUtil.CreateFromYMD (2019, 6, 15), 0.09500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 8, 13), DateUtil.CreateFromYMD (2019, 8, 13), 0.07625, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 9, 14), DateUtil.CreateFromYMD (2019, 9, 15), 0.07375, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 9, 15), DateUtil.CreateFromYMD (2019, 10, 30), 0.06250, 4, "30/360 NON-EOM"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 5, 14), DateUtil.CreateFromYMD (2020, 2, 15), 0.06850, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 3, 4), DateUtil.CreateFromYMD (2020, 3, 4), 0.06700, 2, "ISMA-30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 3, 19), DateUtil.CreateFromYMD (2020, 3, 19), 0.06775, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 3, 23), DateUtil.CreateFromYMD (2020, 6, 1), 0.05875, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 9, 15), DateUtil.CreateFromYMD (2020, 9, 15), 0.05625, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 9, 16), DateUtil.CreateFromYMD (2020, 9, 15), 0.05375, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 6, 28), DateUtil.CreateFromYMD (2021, 4, 15), 0.06875, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2011, 4, 6), DateUtil.CreateFromYMD (2021, 5, 1), 0.05800, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 4, 16), DateUtil.CreateFromYMD (2021, 10, 17), 0.04890, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2011, 11, 7), DateUtil.CreateFromYMD (2021, 11, 15), 0.04875, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 3, 12), DateUtil.CreateFromYMD (2022, 3, 15), 0.04700, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 10, 5), DateUtil.CreateFromYMD (2022, 10, 15), 0.04700, 2, "ISMA-30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2002, 4, 30), DateUtil.CreateFromYMD (2023, 1, 2), 0.06718, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 11, 19), DateUtil.CreateFromYMD (2023, 11, 20), 0.03700, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 11, 29), DateUtil.CreateFromYMD (2023, 12, 1), 0.04625, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 3, 12), DateUtil.CreateFromYMD (2024, 3, 14), 0.04250, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (1994, 5, 11), DateUtil.CreateFromYMD (2024, 5, 1), 0.08625, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 8, 29), DateUtil.CreateFromYMD (2024, 9, 3), 0.05750, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 9, 15), DateUtil.CreateFromYMD (2025, 9, 15), 0.04750, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 1, 27), DateUtil.CreateFromYMD (2026, 1, 27), 0.04650, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 8, 11), DateUtil.CreateFromYMD (2026, 9, 3), 0.03750, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 9, 16), DateUtil.CreateFromYMD (2026, 10, 1), 0.03700, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 11, 25), DateUtil.CreateFromYMD (2026, 11, 25), 0.04270, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 12, 14), DateUtil.CreateFromYMD (2027, 12, 15), 0.03750, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (1998, 7, 10), DateUtil.CreateFromYMD (2028, 7, 15), 0.07050, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 10, 3), DateUtil.CreateFromYMD (2028, 10, 15), 0.03250, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2000, 3, 6), DateUtil.CreateFromYMD (2029, 3, 1), 0.06927, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (1999, 3, 1), DateUtil.CreateFromYMD (2029, 3, 1), 0.06625, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2005, 3, 1), DateUtil.CreateFromYMD (2030, 12, 15), 0.05380, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2000, 12, 15), DateUtil.CreateFromYMD (2030, 12, 15), 0.08600, 2, "ISMA-30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2001, 8, 15), DateUtil.CreateFromYMD (2031, 8, 15), 0.07300, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2003, 3, 4), DateUtil.CreateFromYMD (2032, 10, 15), 0.05900, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2003, 9, 25), DateUtil.CreateFromYMD (2033, 3, 15), 0.06550, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2003, 10, 1), DateUtil.CreateFromYMD (2033, 10, 1), 0.07450, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2008, 12, 11), DateUtil.CreateFromYMD (2038, 12, 15), 0.06375, 2, "ISMA-30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 6, 1), DateUtil.CreateFromYMD (2039, 6, 1), 0.08875, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 12, 16), DateUtil.CreateFromYMD (2039, 12, 16), 0.06850, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 7, 1), DateUtil.CreateFromYMD (2040, 6, 15), 0.07625, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2008, 11, 4), DateUtil.CreateFromYMD (2046, 3, 15), 0.05780, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2005, 8, 1), DateUtil.CreateFromYMD (2050, 8, 1), 0.05300, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2006, 11, 13), DateUtil.CreateFromYMD (2051, 12, 1), 0.05595, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2007, 2, 1), DateUtil.CreateFromYMD (2052, 2, 15), 0.05815, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 3, 18), DateUtil.CreateFromYMD (2057, 3, 15), 0.06750, 2, "30/360"), - }; - - double[] adblCleanPrice = new double[] { - 0.9997787, // (2017, 2, 25) - 1.0033310, // (2017, 6, 5) - 1.0278170, // (2017, 7, 15) - 1.0172200, // (2017, 9, 5) - 1.0135930, // (2018, 4, 15) - 1.0562500, // (2018, 11, 1) - 1.0975070, // (2018, 11, 15) - 1.0973010, // (2018, 11, 15) - 1.0976260, // (2019, 2, 1) - 1.1243420, // (2019, 6, 1) - 1.1716120, // (2019, 6, 15) - 1.1584940, // (2019, 6, 15) - 1.1199700, // (2019, 8, 13) - 1.1160530, // (2019, 9, 15) - 0.9841736, // (2019, 10, 30) - 1.1216150, // (2020, 2, 15) - 1.1174650, // (2020, 3, 4) - 1.1262290, // (2020, 3, 19) - 1.1012410, // (2020, 6, 1) - 1.0949670, // (2020, 9, 15) - 1.0831400, // (2020, 9, 15) - 1.1349120, // (2021, 4, 15) - 1.1107220, // (2021, 5, 1) - 1.0216740, // (2021, 10, 17) - 1.0693220, // (2021, 11, 15) - 1.0685770, // (2022, 3, 15) - 1.0456960, // (2022, 10, 15) - 1.1312500, // (2023, 1, 2) - 1.0453750, // (2023, 11, 20) - 1.0542780, // (2023, 12, 1) - 1.0100730, // (2024, 3, 14) - 1.2260200, // (2024, 5, 1) - 0.9529315, // (2024, 9, 3) - 0.9868410, // (2025, 9, 15) - 1.0594940, // (2026, 1, 27) - 1.0098560, // (2026, 9, 3) - 1.0025000, // (2026, 10, 1) - 1.0202100, // (2026, 11, 25) - 1.0093360, // (2027, 12, 25) - 1.1575970, // (2028, 7, 15) - 0.9596740, // (2028, 10, 15) - 1.3272900, // (2029, 3, 1) - 1.2673600, // (2029, 3, 1) - 1.0724490, // (2030, 12, 15) - 1.3656760, // (2030, 12, 15) - 1.1686390, // (2031, 8, 15) - 1.1678330, // (2032, 10, 15) - 1.2210150, // (2033, 3, 15) - 1.2038020, // (2033, 10, 1) - 1.2909820, // (2038, 12, 15) - 1.5222220, // (2039, 6, 1) - 1.3022560, // (2039, 12, 16) - 1.2955540, // (2040, 6, 15) - // 1.1743430, // (2046, 3, 15) - // 0.9253630, // (2050, 8, 1) - // 1.0570930, // (2051, 12, 1) - // 0.9831220, // (2052, 2, 15) - // 1.3153640, // (2057, 3, 15) - }; - - double[] adblOAS = RVMeasures ( - aCorporateBond, - dtSpot, - csqc, - adblCleanPrice - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot.addBusDays ( - 3, - dcFunding.currency() - ), - dcFunding.currency() - ); - - System.out.println(); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print ("\t| BOND "); - - for (Map.Entry meGovvieCurve : mapGovvieCurve.entrySet()) { - if ("BASE".equalsIgnoreCase (meGovvieCurve.getKey()) || "BUMP".equalsIgnoreCase (meGovvieCurve.getKey())) - continue; - - System.out.print (" | " + meGovvieCurve.getKey()); - } - - System.out.println (" ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < adblOAS.length; ++i) { - System.out.print ("\t| " + aCorporateBond[i].name()); - - for (Map.Entry meGovvieCurve : mapGovvieCurve.entrySet()) { - if ("BASE".equalsIgnoreCase (meGovvieCurve.getKey()) || "BUMP".equalsIgnoreCase (meGovvieCurve.getKey())) - continue; - - csqc.setGovvieState (meGovvieCurve.getValue()); - - System.out.print (" | " + - FormatUtil.FormatDouble ( - (adblCleanPrice[i] - aCorporateBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] - )) / adblCleanPrice[i], - 2, 2, 10000.) + " " - ); - } - - System.out.println (" ||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/bondfixed/BulletCorporate6.java b/org/drip/sample/bondfixed/BulletCorporate6.java deleted file mode 100644 index 5ed63f5..0000000 --- a/org/drip/sample/bondfixed/BulletCorporate6.java +++ /dev/null @@ -1,696 +0,0 @@ - -package org.drip.sample.bondfixed; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.analytics.output.BondRVMeasures; -import org.drip.analytics.support.Helper; -import org.drip.param.creator.MarketParamsBuilder; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.quote.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.BondBuilder; -import org.drip.product.credit.BondComponent; -import org.drip.product.definition.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.govvie.GovvieCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * BulletCorporate6 demonstrates Non-EOS Fixed Coupon Corporate Bond Pricing and Relative Value Measure - * Generation Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class BulletCorporate6 { - - private static final MergedDiscountForwardCurve FundingCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrDepositMaturityTenor = new String[] { - "2D" - }; - - double[] adblDepositQuote = new double[] { - 0.0103456 // 2D - }; - - double[] adblFuturesQuote = new double[] { - 0.01070, - 0.01235, - 0.01360 - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.012484, // 1Y - 0.014987, // 2Y - 0.017036, // 3Y - 0.018624, // 4Y - 0.019868, // 5Y - 0.020921, // 6Y - 0.021788, // 7Y - 0.022530, // 8Y - 0.023145, // 9Y - 0.023685, // 10Y - 0.024153, // 11Y - 0.024562, // 12Y - 0.025389, // 15Y - 0.026118, // 20Y - 0.026368, // 25Y - 0.026432, // 30Y - 0.026339, // 40Y - 0.026122 // 50Y - }; - - MergedDiscountForwardCurve dcFunding = LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - adblFuturesQuote, - "ForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate" - ); - - Component[] aDepositComp = OTCInstrumentBuilder.FundingDeposit ( - dtSpot, - strCurrency, - astrDepositMaturityTenor - ); - - Component[] aFuturesComp = ExchangeInstrumentBuilder.ForwardRateFuturesPack ( - dtSpot, - adblFuturesQuote.length, - strCurrency - ); - - Component[] aFixFloatComp = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - astrFixFloatMaturityTenor, - "MAIN", - 0. - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - System.out.println(); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println ("\t| DEPOSIT INPUT vs. CALC ||"); - - System.out.println ("\t|-------------------------------------||"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t| [" + aDepositComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aDepositComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println(); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println ("\t| FUTURES INPUT vs. CALC ||"); - - System.out.println ("\t|-------------------------------------||"); - - for (int i = 0; i < aFuturesComp.length; ++i) - System.out.println ("\t| [" + aFuturesComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFuturesComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFuturesQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println(); - - System.out.println ("\t|------------------------------------------------|| "); - - System.out.println ("\t| FIX-FLOAT INPUTS vs CALIB ||"); - - System.out.println ("\t|------------------------------------------------|| "); - - for (int i = 0; i < aFixFloatComp.length; ++i) - System.out.println ("\t| [" + aFixFloatComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "CalibSwapRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFixFloatQuote[i], 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "FairPremium" - ), 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|------------------------------------------------||"); - - System.out.println(); - - return dcFunding; - } - - private static final Map GovvieCurve ( - final JulianDate dtSpot, - final String strCode, - final double[] adblCoupon, - final double[] adblYield) - throws Exception - { - JulianDate[] adtEffective = new JulianDate[] { - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot - }; - - JulianDate[] adtMaturity = new JulianDate[] { - dtSpot.addTenor ("1Y"), - dtSpot.addTenor ("2Y"), - dtSpot.addTenor ("3Y"), - dtSpot.addTenor ("5Y"), - dtSpot.addTenor ("7Y"), - dtSpot.addTenor ("10Y"), - dtSpot.addTenor ("20Y"), - dtSpot.addTenor ("30Y") - }; - - Map mapGovvieCurve = LatentMarketStateBuilder.BumpedGovvieCurve ( - strCode, - dtSpot, - adtEffective, - adtMaturity, - adblCoupon, - adblYield, - "Yield", - LatentMarketStateBuilder.SHAPE_PRESERVING, - 0.0001, - false - ); - - BondComponent[] aComp = TreasuryBuilder.FromCode ( - strCode, - adtEffective, - adtMaturity, - adblCoupon - ); - - ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setGovvieState (mapGovvieCurve.get ("BASE")); - - System.out.println(); - - System.out.println ("\t|-------------------------------------------||"); - - System.out.println ("\t| TREASURY INPUT vs CALIB YIELD ||"); - - System.out.println ("\t|-------------------------------------------||"); - - for (int i = 0; i < aComp.length; ++i) - System.out.println ("\t| " + aComp[i].name() + " | " + - FormatUtil.FormatDouble (adblYield[i], 1, 3, 100.) + "% | " + - FormatUtil.FormatDouble (aComp[i].yieldFromPrice ( - valParams, - null, - null, - aComp[i].maturityDate().julian(), - 1., - aComp[i].priceFromYield ( - valParams, - null, - null, - mapGovvieCurve.get ("BASE").yield (aComp[i].maturityDate().julian()) - ) - ), 1, 3, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------------------------------||"); - - return mapGovvieCurve; - } - - private static final void AccumulateBondMarketQuote ( - final CurveSurfaceQuoteContainer csqc, - final String[] astrOnTheRunCode, - final double[] adblYield) - throws Exception - { - for (int i = 0; i < astrOnTheRunCode.length; ++i) { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Yield", - new MultiSided ( - "mid", - adblYield[i] - ), - true - ); - - csqc.setProductQuote ( - astrOnTheRunCode[i], - pmmq - ); - } - } - - private static final Bond Corporate ( - final String strName, - final JulianDate dtEffective, - final JulianDate dtMaturity, - final double dblCoupon, - final int iFreq, - final String strDayCount) - throws Exception - { - return BondBuilder.CreateSimpleFixed ( - strName + FormatUtil.FormatDouble (dblCoupon, 1, 4, 100.) + " " + dtMaturity, - "USD", - "", - dblCoupon, - iFreq, - strDayCount, - dtEffective, - dtMaturity, - null, - null - ); - } - - private static final double[] RVMeasures ( - final Bond[] aBond, - final JulianDate dtValue, - final CurveSurfaceQuoteContainer csqc, - final double[] adblCleanPrice) - throws Exception - { - JulianDate dtSettle = dtValue.addBusDays ( - 3, - aBond[0].currency() - ); - - ValuationParams valParams = new ValuationParams ( - dtValue, - dtSettle, - aBond[0].currency() - ); - - System.out.println(); - - System.out.println ("\t|--------------------------------||"); - - System.out.println ("\t| Trade Date : " + dtValue + " ||"); - - System.out.println ("\t| Cash Settle Date : " + dtSettle + " ||"); - - System.out.println ("\t|--------------------------------||"); - - System.out.println(); - - String strCurveMetrics = ""; - String strSecularMetrics = ""; - double[] adblOAS = new double[aBond.length]; - - for (int i = 0; i < aBond.length; ++i) { - System.out.println ("Doing " + aBond[i].name()); - - WorkoutInfo wi = aBond[i].exerciseYieldFromPrice ( - valParams, - csqc, - null, - adblCleanPrice[i] - ); - - BondRVMeasures rvm = aBond[i].standardMeasures ( - valParams, - null, - csqc, - null, - wi, - adblCleanPrice[i] - ); - - strSecularMetrics += "\t| " + - aBond[i].name() + " | " + - aBond[i].effectiveDate() + " | " + - aBond[i].maturityDate() + " | " + - aBond[i].firstCouponDate() + " |" + - FormatUtil.FormatDouble (adblCleanPrice[i], 3, 3, 100.) + " |" + - FormatUtil.FormatDouble (wi.yield(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (rvm.macaulayDuration(), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (rvm.modifiedDuration(), 2, 2, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.yield01(), 2, 2, 10000.) + " |" + - FormatUtil.FormatDouble (rvm.yield01(), 4, 0, 1000000.) + " |" + - FormatUtil.FormatDouble (rvm.convexity(), 1, 2, 1000000.) + " | " + - FormatUtil.FormatDouble (rvm.bondBasis(), 3, 0, 10000.) + " ||" + "\n"; - - adblOAS[i] = rvm.oas(); - - double dblCleanPriceOASUp = aBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] + 0.0001 - ); - - double dblCleanPriceOASDown = aBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] - 0.0001 - ); - - strCurveMetrics += "\t| " + - aBond[i].name() + " |" + - FormatUtil.FormatDouble (adblCleanPrice[i], 3, 3, 100.) + " |" + - FormatUtil.FormatDouble (wi.yield(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (rvm.zSpread(), 3, 0, 10000.) + " |" + - FormatUtil.FormatDouble (adblOAS[i], 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (0.5 * (dblCleanPriceOASDown - dblCleanPriceOASUp) / adblCleanPrice[i], 2, 2, 10000.) + " | " + - FormatUtil.FormatDouble ((dblCleanPriceOASDown + dblCleanPriceOASUp - 2. * adblCleanPrice[i]) / adblCleanPrice[i], 2, 2, 1000000.) + " |" + - FormatUtil.FormatDouble (rvm.asw(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.gSpread(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.iSpread(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.tsySpread(), 3, 0, 10000.) + " | " + - Helper.BaseTsyBmk ( - dtValue.julian(), - aBond[i].maturityDate().julian() - ) + " ||" + "\n"; - } - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| BOND | EFFECTIVE | MATURITY | FIRST COUPON | PRICE | YIELD | MAC DUR | MOD DUR | YIELD 01 | DV01 | CONV | BOND BASIS ||"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print (strSecularMetrics); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||\n"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| BOND | PRICE | YIELD | Z SPREAD | OAS | OAS DUR | OAS CONV | ASW | G SPREAD | I SPREAD | TSY SPREAD | TSY BMK ||"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print (strCurveMetrics); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------||"); - - return adblOAS; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2017, - DateUtil.FEBRUARY, - 2 - ); - - String strCurrency = "USD"; - String strTreasuryCode = "UST"; - - MergedDiscountForwardCurve dcFunding = FundingCurve ( - dtSpot, - strCurrency - ); - - double[] adblTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0250, - 0.0300 - }; - - double[] adblTreasuryYield = new double[] { - 0.0083, // 1Y - 0.0122, // 2Y - 0.0149, // 3Y - 0.0193, // 5Y - 0.0227, // 7Y - 0.0248, // 10Y - 0.0280, // 20Y - 0.0308 // 30Y - }; - - Map mapGovvieCurve = GovvieCurve ( - dtSpot, - strTreasuryCode, - adblTreasuryCoupon, - adblTreasuryYield - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - csqc.setGovvieState (mapGovvieCurve.get ("BASE")); - - AccumulateBondMarketQuote ( - csqc, - new String[] { - "01YON", - "02YON", - "03YON", - "05YON", - "07YON", - "10YON", - "20YON", - "30YON" - }, - adblTreasuryYield - ); - - Bond[] aCorporateBond = new Bond[] { - Corporate ("CORPORA", DateUtil.CreateFromYMD (2014, 6, 5), DateUtil.CreateFromYMD (2017, 6, 2), 0.01250, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 3, 9), DateUtil.CreateFromYMD (2018, 3, 9), 0.02500, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2013, 8, 8), DateUtil.CreateFromYMD (2018, 12, 15), 0.02900, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2009, 1, 16), DateUtil.CreateFromYMD (2019, 1, 15), 0.08625, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2010, 12, 15), DateUtil.CreateFromYMD (2020, 12, 15), 0.06000, 2, "ISMA-30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2011, 2, 16), DateUtil.CreateFromYMD (2021, 2, 16), 0.05462, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 10, 27), DateUtil.CreateFromYMD (2021, 9, 20), 0.03360, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2012, 7, 13), DateUtil.CreateFromYMD (2022, 7, 11), 0.04875, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2004, 5, 4), DateUtil.CreateFromYMD (2024, 3, 30), 0.06119, 2, "30/360 NON-EOM"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 7, 29), DateUtil.CreateFromYMD (2025, 7, 29), 0.04000, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2016, 3, 4), DateUtil.CreateFromYMD (2026, 3, 4), 0.04150, 2, "30/360"), - Corporate ("CORPORA", DateUtil.CreateFromYMD (2011, 6, 30), DateUtil.CreateFromYMD (2034, 7, 15), 0.05820, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2004, 10, 15), DateUtil.CreateFromYMD (2049, 10, 1), 0.05586, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2006, 5, 1), DateUtil.CreateFromYMD (2051, 5, 15), 0.06124, 2, "30/360"), - // Corporate ("CORPORA", DateUtil.CreateFromYMD (2015, 9, 30), DateUtil.CreateFromYMD (2051, 10, 15), 0.05334, 2, "30/360"), - }; - - double[] adblCleanPrice = new double[] { - 0.9989031, // (2017, 6, 2) - 1.0092960, // (2018, 3, 9) - 1.0115980, // (2018, 12, 15) - 1.1223650, // (2019, 1, 15) - 1.0954840, // (2020, 12, 15) - 1.0905480, // (2021, 2, 16) - 1.0005000, // (2021, 9, 20) - 1.0762390, // (2022, 7, 11) - 1.1097420, // (2024, 3, 30) - 1.0285550, // (2026, 7, 29) - 1.0456260, // (2026, 3, 4) - 1.0824400, // (2034, 7, 15) - // 1.0980730, // (2049, 10, 1) - // 1.0919230, // (2051, 5, 15) - // 1.0331340, // (2051, 10, 15) - }; - - double[] adblOAS = RVMeasures ( - aCorporateBond, - dtSpot, - csqc, - adblCleanPrice - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot.addBusDays ( - 3, - dcFunding.currency() - ), - dcFunding.currency() - ); - - System.out.println(); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print ("\t| BOND "); - - for (Map.Entry meGovvieCurve : mapGovvieCurve.entrySet()) { - if ("BASE".equalsIgnoreCase (meGovvieCurve.getKey()) || "BUMP".equalsIgnoreCase (meGovvieCurve.getKey())) - continue; - - System.out.print (" | " + meGovvieCurve.getKey()); - } - - System.out.println (" ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < adblOAS.length; ++i) { - System.out.print ("\t| " + aCorporateBond[i].name()); - - for (Map.Entry meGovvieCurve : mapGovvieCurve.entrySet()) { - if ("BASE".equalsIgnoreCase (meGovvieCurve.getKey()) || "BUMP".equalsIgnoreCase (meGovvieCurve.getKey())) - continue; - - csqc.setGovvieState (meGovvieCurve.getValue()); - - System.out.print (" | " + - FormatUtil.FormatDouble ( - (adblCleanPrice[i] - aCorporateBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] - )) / adblCleanPrice[i], - 2, 2, 10000.) + " " - ); - } - - System.out.println (" ||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/bondfloat/BulletCorporate.java b/org/drip/sample/bondfloat/BulletCorporate.java deleted file mode 100644 index 1007426..0000000 --- a/org/drip/sample/bondfloat/BulletCorporate.java +++ /dev/null @@ -1,707 +0,0 @@ - -package org.drip.sample.bondfloat; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.analytics.output.BondRVMeasures; -import org.drip.analytics.support.Helper; -import org.drip.param.creator.MarketParamsBuilder; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.quote.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.BondBuilder; -import org.drip.product.credit.BondComponent; -import org.drip.product.definition.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.govvie.GovvieCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * BulletCorporate demonstrates Non-EOS Floating Coupon Corporate Bond Pricing and Relative Value Measure - * Generation Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class BulletCorporate { - - private static final MergedDiscountForwardCurve FundingCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrDepositMaturityTenor = new String[] { - "2D" - }; - - double[] adblDepositQuote = new double[] { - 0.0103456 // 2D - }; - - double[] adblFuturesQuote = new double[] { - 0.01070, - 0.01235, - 0.01360 - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.012484, // 1Y - 0.014987, // 2Y - 0.017036, // 3Y - 0.018624, // 4Y - 0.019868, // 5Y - 0.020921, // 6Y - 0.021788, // 7Y - 0.022530, // 8Y - 0.023145, // 9Y - 0.023685, // 10Y - 0.024153, // 11Y - 0.024562, // 12Y - 0.025389, // 15Y - 0.026118, // 20Y - 0.026368, // 25Y - 0.026432, // 30Y - 0.026339, // 40Y - 0.026122 // 50Y - }; - - MergedDiscountForwardCurve dcFunding = LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - adblFuturesQuote, - "ForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate" - ); - - Component[] aDepositComp = OTCInstrumentBuilder.FundingDeposit ( - dtSpot, - strCurrency, - astrDepositMaturityTenor - ); - - Component[] aFuturesComp = ExchangeInstrumentBuilder.ForwardRateFuturesPack ( - dtSpot, - adblFuturesQuote.length, - strCurrency - ); - - Component[] aFixFloatComp = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - astrFixFloatMaturityTenor, - "MAIN", - 0. - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - System.out.println(); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println ("\t| DEPOSIT INPUT vs. CALC ||"); - - System.out.println ("\t|-------------------------------------||"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t| [" + aDepositComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aDepositComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println(); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println ("\t| FUTURES INPUT vs. CALC ||"); - - System.out.println ("\t|-------------------------------------||"); - - for (int i = 0; i < aFuturesComp.length; ++i) - System.out.println ("\t| [" + aFuturesComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFuturesComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFuturesQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println(); - - System.out.println ("\t|------------------------------------------------|| "); - - System.out.println ("\t| FIX-FLOAT INPUTS vs CALIB ||"); - - System.out.println ("\t|------------------------------------------------|| "); - - for (int i = 0; i < aFixFloatComp.length; ++i) - System.out.println ("\t| [" + aFixFloatComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "CalibSwapRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFixFloatQuote[i], 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "FairPremium" - ), 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|------------------------------------------------||"); - - System.out.println(); - - return dcFunding; - } - - private static final Map GovvieCurve ( - final JulianDate dtSpot, - final String strCode, - final double[] adblCoupon, - final double[] adblYield) - throws Exception - { - JulianDate[] adtEffective = new JulianDate[] { - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot - }; - - JulianDate[] adtMaturity = new JulianDate[] { - dtSpot.addTenor ("1Y"), - dtSpot.addTenor ("2Y"), - dtSpot.addTenor ("3Y"), - dtSpot.addTenor ("5Y"), - dtSpot.addTenor ("7Y"), - dtSpot.addTenor ("10Y"), - dtSpot.addTenor ("20Y"), - dtSpot.addTenor ("30Y") - }; - - Map mapGovvieCurve = LatentMarketStateBuilder.BumpedGovvieCurve ( - strCode, - dtSpot, - adtEffective, - adtMaturity, - adblCoupon, - adblYield, - "Yield", - LatentMarketStateBuilder.SHAPE_PRESERVING, - 0.0001, - false - ); - - BondComponent[] aComp = TreasuryBuilder.FromCode ( - strCode, - adtEffective, - adtMaturity, - adblCoupon - ); - - ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setGovvieState (mapGovvieCurve.get ("BASE")); - - System.out.println(); - - System.out.println ("\t|-------------------------------------------||"); - - System.out.println ("\t| TREASURY INPUT vs CALIB YIELD ||"); - - System.out.println ("\t|-------------------------------------------||"); - - for (int i = 0; i < aComp.length; ++i) - System.out.println ("\t| " + aComp[i].name() + " | " + - FormatUtil.FormatDouble (adblYield[i], 1, 3, 100.) + "% | " + - FormatUtil.FormatDouble (aComp[i].yieldFromPrice ( - valParams, - null, - null, - aComp[i].maturityDate().julian(), - 1., - aComp[i].priceFromYield ( - valParams, - null, - null, - mapGovvieCurve.get ("BASE").yield (aComp[i].maturityDate().julian()) - ) - ), 1, 3, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------------------------------||"); - - return mapGovvieCurve; - } - - private static final void AccumulateBondMarketQuote ( - final CurveSurfaceQuoteContainer csqc, - final String[] astrOnTheRunCode, - final double[] adblYield) - throws Exception - { - for (int i = 0; i < astrOnTheRunCode.length; ++i) { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Yield", - new MultiSided ( - "mid", - adblYield[i] - ), - true - ); - - csqc.setProductQuote ( - astrOnTheRunCode[i], - pmmq - ); - } - } - - private static final Bond Corporate ( - final String strRateIndex, - final JulianDate dtEffective, - final JulianDate dtMaturity, - final double dblSpread) - throws Exception - { - return BondBuilder.CreateSimpleFloater ( - strRateIndex + " +" + FormatUtil.FormatDouble (dblSpread, 3, 0, 10000.) + " bp " + dtMaturity, - "USD", - strRateIndex, - "", - dblSpread, - 2, - "30/360", - dtEffective, - dtMaturity, - null, - null - ); - } - - private static final double[] RVMeasures ( - final Bond[] aBond, - final JulianDate dtValue, - final CurveSurfaceQuoteContainer csqc, - final double[] adblCleanPrice) - throws Exception - { - JulianDate dtSettle = dtValue.addBusDays ( - 3, - aBond[0].currency() - ); - - ValuationParams valParams = new ValuationParams ( - dtValue, - dtSettle, - aBond[0].currency() - ); - - System.out.println(); - - System.out.println ("\t|--------------------------------||"); - - System.out.println ("\t| Trade Date : " + dtValue + " ||"); - - System.out.println ("\t| Cash Settle Date : " + dtSettle + " ||"); - - System.out.println ("\t|--------------------------------||"); - - System.out.println(); - - String strCurveMetrics = ""; - String strSecularMetrics = ""; - double[] adblOAS = new double[aBond.length]; - - for (int i = 0; i < aBond.length; ++i) { - // System.out.println ("Doing " + aBond[i].name()); - - WorkoutInfo wi = aBond[i].exerciseYieldFromPrice ( - valParams, - csqc, - null, - adblCleanPrice[i] - ); - - BondRVMeasures rvm = aBond[i].standardMeasures ( - valParams, - null, - csqc, - null, - wi, - adblCleanPrice[i] - ); - - strSecularMetrics += "\t| " + - aBond[i].name() + " | " + - aBond[i].effectiveDate() + " | " + - aBond[i].maturityDate() + " | " + - aBond[i].firstCouponDate() + " |" + - FormatUtil.FormatDouble (adblCleanPrice[i], 3, 3, 100.) + " |" + - FormatUtil.FormatDouble (wi.yield(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (rvm.macaulayDuration(), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (rvm.modifiedDuration(), 2, 2, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.yield01(), 2, 2, 10000.) + " |" + - FormatUtil.FormatDouble (rvm.yield01(), 4, 0, 1000000.) + " |" + - FormatUtil.FormatDouble (rvm.convexity(), 1, 2, 1000000.) + " | " + - FormatUtil.FormatDouble (rvm.bondBasis(), 3, 0, 10000.) + " ||" + "\n"; - - adblOAS[i] = rvm.oas(); - - double dblCleanPriceOASUp = aBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] + 0.0001 - ); - - double dblCleanPriceOASDown = aBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] - 0.0001 - ); - - strCurveMetrics += "\t| " + - aBond[i].name() + " |" + - FormatUtil.FormatDouble (adblCleanPrice[i], 3, 3, 100.) + " |" + - FormatUtil.FormatDouble (wi.yield(), 1, 2, 100.) + "% |" + - FormatUtil.FormatDouble (adblOAS[i], 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (0.5 * (dblCleanPriceOASDown - dblCleanPriceOASUp) / adblCleanPrice[i], 2, 2, 10000.) + " | " + - FormatUtil.FormatDouble ((dblCleanPriceOASDown + dblCleanPriceOASUp - 2. * adblCleanPrice[i]) / adblCleanPrice[i], 2, 2, 1000000.) + " |" + - FormatUtil.FormatDouble (rvm.asw(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.gSpread(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.iSpread(), 3, 0, 10000.) + " | " + - FormatUtil.FormatDouble (rvm.tsySpread(), 3, 0, 10000.) + " | " + - Helper.BaseTsyBmk ( - dtValue.julian(), - aBond[i].maturityDate().julian() - ) + " ||" + "\n"; - } - - System.out.println ("\t|-----------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| BOND | EFFECTIVE | MATURITY | FIRST COUPON | PRICE | YIELD | MAC DUR | MOD DUR | YIELD 01 | DV01 | CONV | BOND BASIS ||"); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print (strSecularMetrics); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------------------------------------------------------------||\n"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| BOND | PRICE | YIELD | OAS | OAS DUR | OAS CONV | ASW | G SPREAD | I SPREAD | TSY SPREAD | TSY BMK ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print (strCurveMetrics); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------||"); - - return adblOAS; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2017, - DateUtil.FEBRUARY, - 2 - ); - - String strCurrency = "USD"; - String strTreasuryCode = "UST"; - - MergedDiscountForwardCurve dcFunding = FundingCurve ( - dtSpot, - strCurrency - ); - - double[] adblTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0250, - 0.0300 - }; - - double[] adblTreasuryYield = new double[] { - 0.0083, // 1Y - 0.0122, // 2Y - 0.0149, // 3Y - 0.0193, // 5Y - 0.0227, // 7Y - 0.0248, // 10Y - 0.0280, // 20Y - 0.0308 // 30Y - }; - - Map mapGovvieCurve = GovvieCurve ( - dtSpot, - strTreasuryCode, - adblTreasuryCoupon, - adblTreasuryYield - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - csqc.setGovvieState (mapGovvieCurve.get ("BASE")); - - AccumulateBondMarketQuote ( - csqc, - new String[] { - "01YON", - "02YON", - "03YON", - "05YON", - "07YON", - "10YON", - "20YON", - "30YON" - }, - adblTreasuryYield - ); - - double dblUSD3MLIBOR = dcFunding.libor ( - dtSpot, - "3M" - ); - - Bond[] aAgencyBond = new Bond[] { - Corporate ("USD-3M", DateUtil.CreateFromYMD (2014, 3, 24), DateUtil.CreateFromYMD (2017, 3, 24), 0.0178706 - dblUSD3MLIBOR), - Corporate ("USD-3M", DateUtil.CreateFromYMD (2015, 8, 3), DateUtil.CreateFromYMD (2017, 8, 3), 0.0150904 - dblUSD3MLIBOR), - Corporate ("USD-3M", DateUtil.CreateFromYMD (2016, 6, 9), DateUtil.CreateFromYMD (2017, 12, 8), 0.0160083 - dblUSD3MLIBOR), - Corporate ("USD-3M", DateUtil.CreateFromYMD (2013, 4, 30), DateUtil.CreateFromYMD (2018, 4, 30), 0.0208733 - dblUSD3MLIBOR), - Corporate ("USD-3M", DateUtil.CreateFromYMD (2016, 10, 19), DateUtil.CreateFromYMD (2018, 10, 19), 0.0169483 - dblUSD3MLIBOR), - Corporate ("USD-3M", DateUtil.CreateFromYMD (2015, 12, 14), DateUtil.CreateFromYMD (2018, 12, 14), 0.0179872 - dblUSD3MLIBOR), - Corporate ("USD-3M", DateUtil.CreateFromYMD (2016, 1, 14), DateUtil.CreateFromYMD (2019, 1, 14), 0.0180317 - dblUSD3MLIBOR), - Corporate ("USD-3M", DateUtil.CreateFromYMD (2016, 1, 15), DateUtil.CreateFromYMD (2019, 1, 15), 0.0220317 - dblUSD3MLIBOR), - Corporate ("USD-3M", DateUtil.CreateFromYMD (2016, 1, 22), DateUtil.CreateFromYMD (2019, 1, 22), 0.0204122 - dblUSD3MLIBOR), - Corporate ("USD-3M", DateUtil.CreateFromYMD (2016, 1, 27), DateUtil.CreateFromYMD (2019, 2, 1), 0.0226094 - dblUSD3MLIBOR), - Corporate ("USD-3M", DateUtil.CreateFromYMD (2016, 2, 23), DateUtil.CreateFromYMD (2019, 2, 22), 0.0173983 - dblUSD3MLIBOR), - Corporate ("USD-3M", DateUtil.CreateFromYMD (2016, 3, 4), DateUtil.CreateFromYMD (2019, 3, 14), 0.0243872 - dblUSD3MLIBOR), - Corporate ("USD-3M", DateUtil.CreateFromYMD (2016, 3, 15), DateUtil.CreateFromYMD (2019, 3, 15), 0.0165344 - dblUSD3MLIBOR), - Corporate ("USD-3M", DateUtil.CreateFromYMD (2016, 5, 13), DateUtil.CreateFromYMD (2019, 5, 13), 0.0161206 - dblUSD3MLIBOR), - Corporate ("USD-3M", DateUtil.CreateFromYMD (2016, 6, 2), DateUtil.CreateFromYMD (2019, 5, 24), 0.0153011 - dblUSD3MLIBOR), - Corporate ("USD-3M", DateUtil.CreateFromYMD (2016, 6, 14), DateUtil.CreateFromYMD (2019, 6, 14), 0.0161872 - dblUSD3MLIBOR), - Corporate ("USD-3M", DateUtil.CreateFromYMD (2016, 9, 8), DateUtil.CreateFromYMD (2019, 9, 6), 0.0152639 - dblUSD3MLIBOR), - Corporate ("USD-3M", DateUtil.CreateFromYMD (2016, 9, 30), DateUtil.CreateFromYMD (2019, 9, 30), 0.0161817 - dblUSD3MLIBOR), - Corporate ("USD-3M", DateUtil.CreateFromYMD (2016, 10, 18), DateUtil.CreateFromYMD (2019, 10, 18), 0.0193372 - dblUSD3MLIBOR), - }; - - double[] adblCleanPrice = new double[] { - 1.0006750, // (2017, 3, 24) - 1.0027220, // (2017, 8, 3) - 1.0050000, // (2017, 12, 8) - 1.0091000, // (2018, 4, 30) - 1.0016000, // (2018, 10, 19) - 1.0053430, // (2018, 12, 14) - 1.0051600, // (2019, 1, 14) - 1.0075900, // (2019, 1, 15) - 1.0085700, // (2019, 1, 22) - 1.0174100, // (2019, 2, 1) - 1.0144650, // (2019, 2, 22) - 1.0152950, // (2019, 3, 14) - 1.0106700, // (2019, 3, 15) - 1.0045400, // (2019, 5, 13) - 1.0025140, // (2019, 5, 24) - 1.0027120, // (2019, 6, 14) - 1.0012000, // (2019, 9, 6) - 1.0022590, // (2019, 9, 30) - 1.0003480, // (2019, 10, 18) - }; - - double[] adblOAS = RVMeasures ( - aAgencyBond, - dtSpot, - csqc, - adblCleanPrice - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot.addBusDays ( - 3, - dcFunding.currency() - ), - dcFunding.currency() - ); - - System.out.println(); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print ("\t| BOND "); - - for (Map.Entry meGovvieCurve : mapGovvieCurve.entrySet()) { - if ("BASE".equalsIgnoreCase (meGovvieCurve.getKey()) || "BUMP".equalsIgnoreCase (meGovvieCurve.getKey())) - continue; - - System.out.print (" | " + meGovvieCurve.getKey()); - } - - System.out.println (" ||"); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < adblOAS.length; ++i) { - System.out.print ("\t| " + aAgencyBond[i].name()); - - for (Map.Entry meGovvieCurve : mapGovvieCurve.entrySet()) { - if ("BASE".equalsIgnoreCase (meGovvieCurve.getKey()) || "BUMP".equalsIgnoreCase (meGovvieCurve.getKey())) - continue; - - csqc.setGovvieState (meGovvieCurve.getValue()); - - System.out.print (" | " + - FormatUtil.FormatDouble ( - (adblCleanPrice[i] - aAgencyBond[i].priceFromOAS ( - valParams, - csqc, - null, - adblOAS[i] - )) / adblCleanPrice[i], - 2, 2, 10000.) + " " - ); - } - - System.out.println (" ||"); - } - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/burgard2011/CorrelatedNumeraireXVAAttribution.java b/org/drip/sample/burgard2011/CorrelatedNumeraireXVAAttribution.java deleted file mode 100644 index e42d11d..0000000 --- a/org/drip/sample/burgard2011/CorrelatedNumeraireXVAAttribution.java +++ /dev/null @@ -1,508 +0,0 @@ - -package org.drip.sample.burgard2011; - -import org.drip.measure.discretemarginal.SequenceGenerator; -import org.drip.measure.dynamics.*; -import org.drip.measure.process.*; -import org.drip.measure.realization.*; -import org.drip.quant.common.FormatUtil; -import org.drip.quant.linearalgebra.Matrix; -import org.drip.service.env.EnvManager; -import org.drip.xva.definition.*; -import org.drip.xva.derivative.*; -import org.drip.xva.pde.*; -import org.drip.xva.settings.PDEEvolutionControl; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CorrelatedNumeraireXVAAttribution constructs the XVA PnL Attribution arising out of the Joint Evolution of - * Numeraires - the Continuous Asset, the Collateral, the Bank, and the Counter-Party Numeraires involved in - * the Dynamic XVA Replication Portfolio of the Burgard and Kjaer (2011) Methodology. 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CorrelatedNumeraireXVAAttribution { - - private static final EdgeEvolutionTrajectory RunStep ( - final TrajectoryEvolutionScheme tes, - final SpreadIntensity si, - final BurgardKjaerOperator bko, - final EdgeEvolutionTrajectory eetStart, - final UniverseSnapshot us) - throws Exception - { - EdgeAssetGreek eagStart = eetStart.edgeAssetGreek(); - - EdgeReplicationPortfolio erpStart = eetStart.replicationPortfolio(); - - double dblDerivativeXVAValueStart = eagStart.derivativeXVAValue(); - - double dblTimeWidth = tes.timeIncrement(); - - double dblTimeStart = eetStart.time(); - - double dblTime = dblTimeStart - 0.5 * dblTimeWidth; - - UniverseSnapshot usStart = eetStart.tradeableAssetSnapshot(); - - TwoWayRiskyUniverse twru = tes.universe(); - - double dblCollateralBondNumeraire = usStart.zeroCouponCollateralBondNumeraire().finish(); - - MasterAgreementCloseOut maco = tes.boundaryCondition(); - - LevelBurgardKjaerAttribution lbka = bko.timeIncrementRunAttribution ( - si, - eetStart - ); - - double dblTheta = lbka.theta(); - - double dblAssetNumeraireBump = lbka.assetNumeraireBump(); - - double dblThetaAssetNumeraireUp = lbka.thetaAssetNumeraireUp(); - - double dblThetaAssetNumeraireDown = lbka.thetaAssetNumeraireDown(); - - double dblDerivativeXVAValueDeltaFinish = eagStart.derivativeXVAValueDelta() + - 0.5 * (dblThetaAssetNumeraireUp - dblThetaAssetNumeraireDown) * dblTimeWidth / dblAssetNumeraireBump; - - double dblDerivativeXVAValueGammaFinish = eagStart.derivativeXVAValueGamma() + - (dblThetaAssetNumeraireUp + dblThetaAssetNumeraireDown - 2. * dblTheta) * dblTimeWidth / - (dblAssetNumeraireBump * dblAssetNumeraireBump); - - double dblDerivativeXVAValueFinish = dblDerivativeXVAValueStart - dblTheta * dblTimeWidth; - - double dblGainOnBankDefaultFinish = -1. * (dblDerivativeXVAValueFinish - maco.bankDefault - (dblDerivativeXVAValueFinish)); - - double dblGainOnCounterPartyDefaultFinish = -1. * (dblDerivativeXVAValueFinish - maco.counterPartyDefault - (dblDerivativeXVAValueFinish)); - - org.drip.xva.derivative.LevelCashAccount lca = tes.rebalanceCash ( - eetStart, - us - ).cashAccount(); - - double dblCashAccountAccumulationFinish = lca.accumulation(); - - double dblAssetPriceFinish = us.assetNumeraire().finish(); - - double dblZeroCouponBankPriceFinish = us.zeroCouponBankBondNumeraire().finish(); - - double dblZeroCouponCounterPartyPriceFinish = us.zeroCouponCounterPartyBondNumeraire().finish(); - - EdgeReplicationPortfolio erpFinish = new EdgeReplicationPortfolio ( - -1. * dblDerivativeXVAValueDeltaFinish, - dblGainOnBankDefaultFinish / dblZeroCouponBankPriceFinish, - dblGainOnCounterPartyDefaultFinish / dblZeroCouponCounterPartyPriceFinish, - erpStart.cashAccount() + dblCashAccountAccumulationFinish - ); - - System.out.println ("\t||" + - FormatUtil.FormatDouble (dblTime, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblDerivativeXVAValueFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblAssetPriceFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblZeroCouponBankPriceFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblZeroCouponCounterPartyPriceFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (us.zeroCouponCollateralBondNumeraire().finish(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpFinish.assetUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpFinish.bankBondUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpFinish.counterPartyBondUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpFinish.cashAccount(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lbka.derivativeXVAFundingGrowth(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lbka.derivativeXVABankDefaultGrowth(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lbka.derivativeXVACounterPartyDefaultGrowth(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lbka.derivativeXVAEarlyTerminationGrowth(), 1, 6, 1.) + " ||" - ); - - return new EdgeEvolutionTrajectory ( - dblTimeStart - dblTimeWidth, - us, - erpFinish, - new EdgeAssetGreek ( - dblDerivativeXVAValueFinish, - dblDerivativeXVAValueDeltaFinish, - dblDerivativeXVAValueGammaFinish, - eagStart.derivativeValue() * Math.exp ( - -1. * dblTimeWidth * twru.zeroCouponCollateralBond().priceNumeraire().evaluator().drift().value ( - new JumpDiffusionVertex ( - dblTime, - dblCollateralBondNumeraire, - 0., - false - ) - ) - ) - ), - dblGainOnBankDefaultFinish, - dblGainOnCounterPartyDefaultFinish - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblTimeWidth = 1. / 24.; - double dblTime = 1.; - double[][] aadblCorrelation = new double[][] { - {1.00, 0.20, 0.15, 0.05}, // #0 ASSET - {0.20, 1.00, 0.13, 0.25}, // #1 COLLATERAL - {0.15, 0.13, 1.00, 0.00}, // #2 BANK - {0.05, 0.25, 0.00, 1.00} // #3 COUNTER PARTY - }; - double dblAssetDrift = 0.06; - double dblAssetVolatility = 0.15; - double dblAssetRepo = 0.03; - double dblAssetDividend = 0.02; - double dblInitialAssetNumeraire = 1.; - - double dblZeroCouponCollateralBondDrift = 0.01; - double dblZeroCouponCollateralBondVolatility = 0.05; - double dblZeroCouponCollateralBondRepo = 0.005; - double dblInitialCollateralNumeraire = 1.; - - double dblZeroCouponBankBondDrift = 0.03; - double dblZeroCouponBankBondVolatility = 0.10; - double dblZeroCouponBankBondRepo = 0.028; - double dblBankHazardRate = 0.03; - double dblBankRecoveryRate = 0.45; - double dblInitialBankNumeraire = 1.; - - double dblZeroCouponCounterPartyBondDrift = 0.03; - double dblZeroCouponCounterPartyBondVolatility = 0.10; - double dblZeroCouponCounterPartyBondRepo = 0.028; - double dblCounterPartyHazardRate = 0.05; - double dblCounterPartyRecoveryRate = 0.30; - double dblInitialCounterPartyNumeraire = 1.; - - double dblTerminalXVADerivativeValue = 1.; - - double dblSensitivityShiftFactor = 0.001; - - int iNumTimeStep = (int) (1. / dblTimeWidth); - double dblDerivativeValue = dblTerminalXVADerivativeValue; - double dblDerivativeXVAValue = dblTerminalXVADerivativeValue; - - PDEEvolutionControl settings = new PDEEvolutionControl ( - PDEEvolutionControl.CLOSEOUT_GREGORY_LI_TANG, - dblSensitivityShiftFactor - ); - - MasterAgreementCloseOut maco = new MasterAgreementCloseOut ( - dblBankRecoveryRate, - dblCounterPartyRecoveryRate - ); - - DiffusionEvolver deAsset = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblAssetDrift, - dblAssetVolatility - ) - ); - - DiffusionEvolver deZeroCouponCollateralBond = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponCollateralBondDrift, - dblZeroCouponCollateralBondVolatility - ) - ); - - DiffusionEvolver deZeroCouponBankBond = new JumpDiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponBankBondDrift, - dblZeroCouponBankBondVolatility - ), - HazardJumpEvaluator.Standard ( - dblBankHazardRate, - dblBankRecoveryRate - ) - ); - - DiffusionEvolver deZeroCouponCounterPartyBond = new JumpDiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponCounterPartyBondDrift, - dblZeroCouponCounterPartyBondVolatility - ), - HazardJumpEvaluator.Standard ( - dblCounterPartyHazardRate, - dblCounterPartyRecoveryRate - ) - ); - - TwoWayRiskyUniverse twru = new TwoWayRiskyUniverse ( - new Equity ( - deAsset, - dblAssetRepo, - dblAssetDividend - ), - new Tradeable ( - deZeroCouponCollateralBond, - dblZeroCouponCollateralBondRepo - ), - new Tradeable ( - deZeroCouponBankBond, - dblZeroCouponBankBondRepo - ), - new Tradeable ( - deZeroCouponCounterPartyBond, - dblZeroCouponCounterPartyBondRepo - ) - ); - - TrajectoryEvolutionScheme tes = new TrajectoryEvolutionScheme ( - twru, - maco, - settings, - dblTimeWidth - ); - - BurgardKjaerOperator bko = new BurgardKjaerOperator ( - twru, - maco, - settings - ); - - SpreadIntensity si = new SpreadIntensity ( - dblZeroCouponBankBondDrift - dblZeroCouponCollateralBondDrift, - (dblZeroCouponBankBondDrift - dblZeroCouponCollateralBondDrift) / dblBankRecoveryRate, - (dblZeroCouponCounterPartyBondDrift - dblZeroCouponCollateralBondDrift) / dblCounterPartyRecoveryRate - ); - - double[][] aadblNumeraireTimeSeries = Matrix.Transpose ( - SequenceGenerator.GaussianJoint ( - iNumTimeStep, - aadblCorrelation - ) - ); - - double[] adblBankDefaultIndicator = SequenceGenerator.Uniform (iNumTimeStep); - - double[] adblCounterPartyDefaultIndicator = SequenceGenerator.Uniform (iNumTimeStep); - - JumpDiffusionEdge[] aJDEAsset = deAsset.incrementSequence ( - new JumpDiffusionVertex ( - 0., - dblInitialAssetNumeraire, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraireTimeSeries[0]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDECollateral = deZeroCouponCollateralBond.incrementSequence ( - new JumpDiffusionVertex ( - 0., - dblInitialCollateralNumeraire, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraireTimeSeries[1]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDEBank = deZeroCouponBankBond.incrementSequence ( - new JumpDiffusionVertex ( - 0., - dblInitialBankNumeraire, - 0., - false - ), - UnitRandom.JumpDiffusion ( - aadblNumeraireTimeSeries[2], - adblBankDefaultIndicator - ), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDECounterParty = deZeroCouponCounterPartyBond.incrementSequence ( - new JumpDiffusionVertex ( - 0., - dblInitialCounterPartyNumeraire, - 0., - false - ), - UnitRandom.JumpDiffusion ( - aadblNumeraireTimeSeries[3], - adblCounterPartyDefaultIndicator - ), - dblTimeWidth - ); - - EdgeAssetGreek eagInitial = new EdgeAssetGreek ( - dblDerivativeXVAValue, - -1., - 0., - dblDerivativeValue - ); - - double dblGainOnBankDefaultInitial = -1. * (dblDerivativeXVAValue - maco.bankDefault (dblDerivativeXVAValue)); - - double dblGainOnCounterPartyDefaultInitial = -1. * (dblDerivativeXVAValue - maco.counterPartyDefault (dblDerivativeXVAValue)); - - EdgeReplicationPortfolio erpInitial = new EdgeReplicationPortfolio ( - 1., - dblGainOnBankDefaultInitial, - dblGainOnCounterPartyDefaultInitial, - 0. - ); - - System.out.println(); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| BILATERAL XVA EVOLVER - BURGARD & KJAER (2011) REPLICATION PORTFOLIO EVOLUTION ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Time ||"); - - System.out.println ("\t|| - Derivative XVA Value ||"); - - System.out.println ("\t|| - Asset Price Realization ||"); - - System.out.println ("\t|| - Realization of the Zero Coupon Bank Bond Price ||"); - - System.out.println ("\t|| - Realization of the Zero Coupon Counter Party Bond Price ||"); - - System.out.println ("\t|| - Realization of the Zero Coupon Collateral Bond Price ||"); - - System.out.println ("\t|| - Derivative XVA Asset Replication Units ||"); - - System.out.println ("\t|| - Derivative XVA Value Bank Bond Replication Units ||"); - - System.out.println ("\t|| - Derivative XVA Value Counter Party Bond Replication Units ||"); - - System.out.println ("\t|| - Derivative XVA Value Cash Account Replication Units ||"); - - System.out.println ("\t|| - Derivative XVA Funding Growth ||"); - - System.out.println ("\t|| - Derivative XVA Bank Default Growth ||"); - - System.out.println ("\t|| - Derivative XVA Counter Party Default Growth ||"); - - System.out.println ("\t|| - Derivative XVA Early Termination Growth ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t||" + - FormatUtil.FormatDouble (dblTime, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (eagInitial.derivativeXVAValue(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aJDEAsset[iNumTimeStep - 1].finish(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aJDEBank[iNumTimeStep - 1].finish(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aJDECounterParty[iNumTimeStep - 1].finish(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aJDECollateral[iNumTimeStep - 1].finish(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpInitial.assetUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpInitial.bankBondUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpInitial.counterPartyBondUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpInitial.cashAccount(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " ||" - ); - - EdgeEvolutionTrajectory eet = new EdgeEvolutionTrajectory ( - dblTime, - new UniverseSnapshot ( - aJDEAsset[iNumTimeStep - 1], - aJDECollateral[iNumTimeStep - 1], - aJDEBank[iNumTimeStep - 1], - aJDECounterParty[iNumTimeStep - 1] - ), - new EdgeReplicationPortfolio ( - 1., - 0., - 0., - 0. - ), - eagInitial, - dblGainOnBankDefaultInitial, - dblGainOnCounterPartyDefaultInitial - ); - - for (int i = iNumTimeStep - 2; i >= 0; --i) - eet = RunStep ( - tes, - si, - bko, - eet, - new UniverseSnapshot ( - aJDEAsset[i], - aJDECollateral[i], - aJDEBank[i], - aJDECounterParty[i] - ) - ); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/burgard2011/CorrelatedNumeraireXVAExplain.java b/org/drip/sample/burgard2011/CorrelatedNumeraireXVAExplain.java deleted file mode 100644 index bccb1c0..0000000 --- a/org/drip/sample/burgard2011/CorrelatedNumeraireXVAExplain.java +++ /dev/null @@ -1,508 +0,0 @@ - -package org.drip.sample.burgard2011; - -import org.drip.measure.discretemarginal.SequenceGenerator; -import org.drip.measure.dynamics.*; -import org.drip.measure.process.*; -import org.drip.measure.realization.*; -import org.drip.quant.common.FormatUtil; -import org.drip.quant.linearalgebra.Matrix; -import org.drip.service.env.EnvManager; -import org.drip.xva.definition.*; -import org.drip.xva.derivative.*; -import org.drip.xva.pde.*; -import org.drip.xva.settings.PDEEvolutionControl; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CorrelatedNumeraireXVAExplain constructs the XVA PnL Explain arising out of the Joint Evolution of - * Numeraires - the Continuous Asset, the Collateral, the Bank, and the Counter-Party Numeraires involved in - * the Dynamic XVA Replication Portfolio of the Burgard and Kjaer (2011) Methodology. 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CorrelatedNumeraireXVAExplain { - - private static final EdgeEvolutionTrajectory RunStep ( - final TrajectoryEvolutionScheme tes, - final SpreadIntensity si, - final BurgardKjaerOperator bko, - final EdgeEvolutionTrajectory eetStart, - final UniverseSnapshot us) - throws Exception - { - EdgeAssetGreek eagStart = eetStart.edgeAssetGreek(); - - EdgeReplicationPortfolio erpStart = eetStart.replicationPortfolio(); - - double dblDerivativeXVAValueStart = eagStart.derivativeXVAValue(); - - double dblTimeWidth = tes.timeIncrement(); - - double dblTimeStart = eetStart.time(); - - double dblTime = dblTimeStart - 0.5 * dblTimeWidth; - - UniverseSnapshot usStart = eetStart.tradeableAssetSnapshot(); - - TwoWayRiskyUniverse twru = tes.universe(); - - double dblCollateralBondNumeraire = usStart.zeroCouponCollateralBondNumeraire().finish(); - - MasterAgreementCloseOut maco = tes.boundaryCondition(); - - LevelBurgardKjaerRun lbkr = bko.timeIncrementRun ( - si, - eetStart - ); - - double dblTheta = lbkr.theta(); - - double dblAssetNumeraireBump = lbkr.assetNumeraireBump(); - - double dblThetaAssetNumeraireUp = lbkr.thetaAssetNumeraireUp(); - - double dblThetaAssetNumeraireDown = lbkr.thetaAssetNumeraireDown(); - - double dblDerivativeXVAValueDeltaFinish = eagStart.derivativeXVAValueDelta() + - 0.5 * (dblThetaAssetNumeraireUp - dblThetaAssetNumeraireDown) * dblTimeWidth / dblAssetNumeraireBump; - - double dblDerivativeXVAValueGammaFinish = eagStart.derivativeXVAValueGamma() + - (dblThetaAssetNumeraireUp + dblThetaAssetNumeraireDown - 2. * dblTheta) * dblTimeWidth / - (dblAssetNumeraireBump * dblAssetNumeraireBump); - - double dblDerivativeXVAValueFinish = dblDerivativeXVAValueStart - dblTheta * dblTimeWidth; - - double dblGainOnBankDefaultFinish = -1. * (dblDerivativeXVAValueFinish - maco.bankDefault - (dblDerivativeXVAValueFinish)); - - double dblGainOnCounterPartyDefaultFinish = -1. * (dblDerivativeXVAValueFinish - maco.counterPartyDefault - (dblDerivativeXVAValueFinish)); - - org.drip.xva.derivative.LevelCashAccount lca = tes.rebalanceCash ( - eetStart, - us - ).cashAccount(); - - double dblCashAccountAccumulationFinish = lca.accumulation(); - - double dblAssetPriceFinish = us.assetNumeraire().finish(); - - double dblZeroCouponBankPriceFinish = us.zeroCouponBankBondNumeraire().finish(); - - double dblZeroCouponCounterPartyPriceFinish = us.zeroCouponCounterPartyBondNumeraire().finish(); - - EdgeReplicationPortfolio erpFinish = new EdgeReplicationPortfolio ( - -1. * dblDerivativeXVAValueDeltaFinish, - dblGainOnBankDefaultFinish / dblZeroCouponBankPriceFinish, - dblGainOnCounterPartyDefaultFinish / dblZeroCouponCounterPartyPriceFinish, - erpStart.cashAccount() + dblCashAccountAccumulationFinish - ); - - System.out.println ("\t||" + - FormatUtil.FormatDouble (dblTime, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblDerivativeXVAValueFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblAssetPriceFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblZeroCouponBankPriceFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblZeroCouponCounterPartyPriceFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (us.zeroCouponCollateralBondNumeraire().finish(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpFinish.assetUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpFinish.bankBondUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpFinish.counterPartyBondUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpFinish.cashAccount(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblCashAccountAccumulationFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lca.assetAccumulation(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lca.bankAccumulation(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lca.counterPartyAccumulation(), 1, 6, 1.) + " ||" - ); - - return new EdgeEvolutionTrajectory ( - dblTimeStart - dblTimeWidth, - us, - erpFinish, - new EdgeAssetGreek ( - dblDerivativeXVAValueFinish, - dblDerivativeXVAValueDeltaFinish, - dblDerivativeXVAValueGammaFinish, - eagStart.derivativeValue() * Math.exp ( - -1. * dblTimeWidth * twru.zeroCouponCollateralBond().priceNumeraire().evaluator().drift().value ( - new JumpDiffusionVertex ( - dblTime, - dblCollateralBondNumeraire, - 0., - false - ) - ) - ) - ), - dblGainOnBankDefaultFinish, - dblGainOnCounterPartyDefaultFinish - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblTimeWidth = 1. / 24.; - double dblTime = 1.; - double[][] aadblCorrelation = new double[][] { - {1.00, 0.20, 0.15, 0.05}, // #0 ASSET - {0.20, 1.00, 0.13, 0.25}, // #1 COLLATERAL - {0.15, 0.13, 1.00, 0.00}, // #2 BANK - {0.05, 0.25, 0.00, 1.00} // #3 COUNTER PARTY - }; - double dblAssetDrift = 0.06; - double dblAssetVolatility = 0.15; - double dblAssetRepo = 0.03; - double dblAssetDividend = 0.02; - double dblInitialAssetNumeraire = 1.; - - double dblZeroCouponCollateralBondDrift = 0.01; - double dblZeroCouponCollateralBondVolatility = 0.05; - double dblZeroCouponCollateralBondRepo = 0.005; - double dblInitialCollateralNumeraire = 1.; - - double dblZeroCouponBankBondDrift = 0.03; - double dblZeroCouponBankBondVolatility = 0.10; - double dblZeroCouponBankBondRepo = 0.028; - double dblBankHazardRate = 0.03; - double dblBankRecoveryRate = 0.45; - double dblInitialBankNumeraire = 1.; - - double dblZeroCouponCounterPartyBondDrift = 0.03; - double dblZeroCouponCounterPartyBondVolatility = 0.10; - double dblZeroCouponCounterPartyBondRepo = 0.028; - double dblCounterPartyHazardRate = 0.05; - double dblCounterPartyRecoveryRate = 0.30; - double dblInitialCounterPartyNumeraire = 1.; - - double dblTerminalXVADerivativeValue = 1.; - - double dblSensitivityShiftFactor = 0.001; - - int iNumTimeStep = (int) (1. / dblTimeWidth); - double dblDerivativeValue = dblTerminalXVADerivativeValue; - double dblDerivativeXVAValue = dblTerminalXVADerivativeValue; - - PDEEvolutionControl settings = new PDEEvolutionControl ( - PDEEvolutionControl.CLOSEOUT_GREGORY_LI_TANG, - dblSensitivityShiftFactor - ); - - MasterAgreementCloseOut maco = new MasterAgreementCloseOut ( - dblBankRecoveryRate, - dblCounterPartyRecoveryRate - ); - - DiffusionEvolver deAsset = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblAssetDrift, - dblAssetVolatility - ) - ); - - DiffusionEvolver deZeroCouponCollateralBond = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponCollateralBondDrift, - dblZeroCouponCollateralBondVolatility - ) - ); - - DiffusionEvolver deZeroCouponBankBond = new JumpDiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponBankBondDrift, - dblZeroCouponBankBondVolatility - ), - HazardJumpEvaluator.Standard ( - dblBankHazardRate, - dblBankRecoveryRate - ) - ); - - DiffusionEvolver deZeroCouponCounterPartyBond = new JumpDiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponCounterPartyBondDrift, - dblZeroCouponCounterPartyBondVolatility - ), - HazardJumpEvaluator.Standard ( - dblCounterPartyHazardRate, - dblCounterPartyRecoveryRate - ) - ); - - TwoWayRiskyUniverse twru = new TwoWayRiskyUniverse ( - new Equity ( - deAsset, - dblAssetRepo, - dblAssetDividend - ), - new Tradeable ( - deZeroCouponCollateralBond, - dblZeroCouponCollateralBondRepo - ), - new Tradeable ( - deZeroCouponBankBond, - dblZeroCouponBankBondRepo - ), - new Tradeable ( - deZeroCouponCounterPartyBond, - dblZeroCouponCounterPartyBondRepo - ) - ); - - TrajectoryEvolutionScheme tes = new TrajectoryEvolutionScheme ( - twru, - maco, - settings, - dblTimeWidth - ); - - BurgardKjaerOperator bko = new BurgardKjaerOperator ( - twru, - maco, - settings - ); - - SpreadIntensity si = new SpreadIntensity ( - dblZeroCouponBankBondDrift - dblZeroCouponCollateralBondDrift, - (dblZeroCouponBankBondDrift - dblZeroCouponCollateralBondDrift) / dblBankRecoveryRate, - (dblZeroCouponCounterPartyBondDrift - dblZeroCouponCollateralBondDrift) / dblCounterPartyRecoveryRate - ); - - double[][] aadblNumeraireTimeSeries = Matrix.Transpose ( - SequenceGenerator.GaussianJoint ( - iNumTimeStep, - aadblCorrelation - ) - ); - - double[] adblBankDefaultIndicator = SequenceGenerator.Uniform (iNumTimeStep); - - double[] adblCounterPartyDefaultIndicator = SequenceGenerator.Uniform (iNumTimeStep); - - JumpDiffusionEdge[] aJDEAsset = deAsset.incrementSequence ( - new JumpDiffusionVertex ( - 0., - dblInitialAssetNumeraire, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraireTimeSeries[0]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDECollateral = deZeroCouponCollateralBond.incrementSequence ( - new JumpDiffusionVertex ( - 0., - dblInitialCollateralNumeraire, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraireTimeSeries[1]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDEBank = deZeroCouponBankBond.incrementSequence ( - new JumpDiffusionVertex ( - 0., - dblInitialBankNumeraire, - 0., - false - ), - UnitRandom.JumpDiffusion ( - aadblNumeraireTimeSeries[2], - adblBankDefaultIndicator - ), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDECounterParty = deZeroCouponCounterPartyBond.incrementSequence ( - new JumpDiffusionVertex ( - 0., - dblInitialCounterPartyNumeraire, - 0., - false - ), - UnitRandom.JumpDiffusion ( - aadblNumeraireTimeSeries[3], - adblCounterPartyDefaultIndicator - ), - dblTimeWidth - ); - - EdgeAssetGreek eagInitial = new EdgeAssetGreek ( - dblDerivativeXVAValue, - -1., - 0., - dblDerivativeValue - ); - - double dblGainOnBankDefaultInitial = -1. * (dblDerivativeXVAValue - maco.bankDefault (dblDerivativeXVAValue)); - - double dblGainOnCounterPartyDefaultInitial = -1. * (dblDerivativeXVAValue - maco.counterPartyDefault (dblDerivativeXVAValue)); - - EdgeReplicationPortfolio erpInitial = new EdgeReplicationPortfolio ( - 1., - dblGainOnBankDefaultInitial, - dblGainOnCounterPartyDefaultInitial, - 0. - ); - - System.out.println(); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| BILATERAL XVA EVOLVER - BURGARD & KJAER (2011) REPLICATION PORTFOLIO EVOLUTION ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Time ||"); - - System.out.println ("\t|| - Derivative XVA Value ||"); - - System.out.println ("\t|| - Asset Price Realization ||"); - - System.out.println ("\t|| - Realization of the Zero Coupon Bank Bond Price ||"); - - System.out.println ("\t|| - Realization of the Zero Coupon Counter Party Bond Price ||"); - - System.out.println ("\t|| - Realization of the Zero Coupon Collateral Bond Price ||"); - - System.out.println ("\t|| - Derivative XVA Asset Replication Units ||"); - - System.out.println ("\t|| - Derivative XVA Value Bank Bond Replication Units ||"); - - System.out.println ("\t|| - Derivative XVA Value Counter Party Bond Replication Units ||"); - - System.out.println ("\t|| - Derivative XVA Value Cash Account Replication Units ||"); - - System.out.println ("\t|| - Derivative Cash Account Accumulation Component ||"); - - System.out.println ("\t|| - Asset Cash Account Accumulation Component ||"); - - System.out.println ("\t|| - Bank Cash Account Accumulation Component ||"); - - System.out.println ("\t|| - Counter Party Cash Account Accumulation Component ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t||" + - FormatUtil.FormatDouble (dblTime, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (eagInitial.derivativeXVAValue(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aJDEAsset[iNumTimeStep - 1].finish(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aJDEBank[iNumTimeStep - 1].finish(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aJDECounterParty[iNumTimeStep - 1].finish(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aJDECollateral[iNumTimeStep - 1].finish(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpInitial.assetUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpInitial.bankBondUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpInitial.counterPartyBondUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpInitial.cashAccount(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " ||" - ); - - EdgeEvolutionTrajectory eet = new EdgeEvolutionTrajectory ( - dblTime, - new UniverseSnapshot ( - aJDEAsset[iNumTimeStep - 1], - aJDECollateral[iNumTimeStep - 1], - aJDEBank[iNumTimeStep - 1], - aJDECounterParty[iNumTimeStep - 1] - ), - new EdgeReplicationPortfolio ( - 1., - 0., - 0., - 0. - ), - eagInitial, - dblGainOnBankDefaultInitial, - dblGainOnCounterPartyDefaultInitial - ); - - for (int i = iNumTimeStep - 2; i >= 0; --i) - eet = RunStep ( - tes, - si, - bko, - eet, - new UniverseSnapshot ( - aJDEAsset[i], - aJDECollateral[i], - aJDEBank[i], - aJDECounterParty[i] - ) - ); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/burgard2011/CorrelatedNumeraireXVAGreeks.java b/org/drip/sample/burgard2011/CorrelatedNumeraireXVAGreeks.java deleted file mode 100644 index a227311..0000000 --- a/org/drip/sample/burgard2011/CorrelatedNumeraireXVAGreeks.java +++ /dev/null @@ -1,507 +0,0 @@ - -package org.drip.sample.burgard2011; - -import org.drip.measure.discretemarginal.SequenceGenerator; -import org.drip.measure.dynamics.*; -import org.drip.measure.process.*; -import org.drip.measure.realization.*; -import org.drip.quant.common.FormatUtil; -import org.drip.quant.linearalgebra.Matrix; -import org.drip.service.env.EnvManager; -import org.drip.xva.definition.*; -import org.drip.xva.derivative.*; -import org.drip.xva.pde.*; -import org.drip.xva.settings.PDEEvolutionControl; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CorrelatedNumeraireXVAGreeks constructs the XVA Greeks arising out of the Joint Evolution of Numeraires - - * the Continuous Asset, the Collateral, the Bank, and the Counter-Party Numeraires involved in the Dynamic - * XVA Replication Portfolio of the Burgard and Kjaer (2011) Methodology. 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CorrelatedNumeraireXVAGreeks { - - private static final EdgeEvolutionTrajectory RunStep ( - final TrajectoryEvolutionScheme tes, - final SpreadIntensity si, - final BurgardKjaerOperator bko, - final EdgeEvolutionTrajectory eetStart, - final JumpDiffusionEdge jdeAsset, - final JumpDiffusionEdge jdeCollateral, - final JumpDiffusionEdge jdeBank, - final JumpDiffusionEdge jdeCounterParty) - throws Exception - { - EdgeAssetGreek eagStart = eetStart.edgeAssetGreek(); - - EdgeReplicationPortfolio erpStart = eetStart.replicationPortfolio(); - - double dblDerivativeXVAValueStart = eagStart.derivativeXVAValue(); - - double dblTimeWidth = tes.timeIncrement(); - - double dblTimeStart = eetStart.time(); - - double dblTime = dblTimeStart - 0.5 * dblTimeWidth; - - UniverseSnapshot usStart = eetStart.tradeableAssetSnapshot(); - - TwoWayRiskyUniverse twru = tes.universe(); - - double dblCollateralBondNumeraire = usStart.zeroCouponCollateralBondNumeraire().finish(); - - UniverseSnapshot usFinish = new UniverseSnapshot ( - jdeAsset, - jdeCollateral, - jdeBank, - jdeCounterParty - ); - - MasterAgreementCloseOut maco = tes.boundaryCondition(); - - LevelBurgardKjaerRun lbkr = bko.timeIncrementRun ( - si, - eetStart - ); - - double dblTheta = lbkr.theta(); - - double dblAssetNumeraireBump = lbkr.assetNumeraireBump(); - - double dblThetaAssetNumeraireUp = lbkr.thetaAssetNumeraireUp(); - - double dblThetaAssetNumeraireDown = lbkr.thetaAssetNumeraireDown(); - - double dblDerivativeXVAValueDeltaFinish = eagStart.derivativeXVAValueDelta() + - 0.5 * (dblThetaAssetNumeraireUp - dblThetaAssetNumeraireDown) * dblTimeWidth / dblAssetNumeraireBump; - - double dblDerivativeXVAValueGammaFinish = eagStart.derivativeXVAValueGamma() + - (dblThetaAssetNumeraireUp + dblThetaAssetNumeraireDown - 2. * dblTheta) * dblTimeWidth / - (dblAssetNumeraireBump * dblAssetNumeraireBump); - - double dblDerivativeXVAValueFinish = dblDerivativeXVAValueStart - dblTheta * dblTimeWidth; - - double dblGainOnBankDefaultFinish = -1. * (dblDerivativeXVAValueFinish - maco.bankDefault - (dblDerivativeXVAValueFinish)); - - double dblGainOnCounterPartyDefaultFinish = -1. * (dblDerivativeXVAValueFinish - maco.counterPartyDefault - (dblDerivativeXVAValueFinish)); - - System.out.println ("\t||" + - FormatUtil.FormatDouble (dblTime, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblDerivativeXVAValueFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblDerivativeXVAValueDeltaFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblDerivativeXVAValueGammaFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblGainOnBankDefaultFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblGainOnCounterPartyDefaultFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lbkr.derivativeXVAStochasticGrowth(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lbkr.derivativeXVACollateralGrowth(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lbkr.derivativeXVAFundingGrowth(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lbkr.derivativeXVABankDefaultGrowth(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lbkr.derivativeXVACounterPartyDefaultGrowth(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblThetaAssetNumeraireDown, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblTheta, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblThetaAssetNumeraireUp, 1, 6, 1.) + " ||" - ); - - org.drip.xva.derivative.LevelCashAccount lca = tes.rebalanceCash ( - eetStart, - usFinish - ).cashAccount(); - - double dblCashAccountAccumulationFinish = lca.accumulation(); - - double dblZeroCouponBankPriceFinish = jdeBank.finish(); - - double dblZeroCouponCounterPartyPriceFinish = jdeCounterParty.finish(); - - EdgeReplicationPortfolio erpFinish = new EdgeReplicationPortfolio ( - -1. * dblDerivativeXVAValueDeltaFinish, - dblGainOnBankDefaultFinish / dblZeroCouponBankPriceFinish, - dblGainOnCounterPartyDefaultFinish / dblZeroCouponCounterPartyPriceFinish, - erpStart.cashAccount() + dblCashAccountAccumulationFinish - ); - - return new EdgeEvolutionTrajectory ( - dblTimeStart - dblTimeWidth, - usFinish, - erpFinish, - new EdgeAssetGreek ( - dblDerivativeXVAValueFinish, - dblDerivativeXVAValueDeltaFinish, - dblDerivativeXVAValueGammaFinish, - eagStart.derivativeValue() * Math.exp ( - -1. * dblTimeWidth * twru.zeroCouponCollateralBond().priceNumeraire().evaluator().drift().value ( - new JumpDiffusionVertex ( - dblTime, - dblCollateralBondNumeraire, - 0., - false - ) - ) - ) - ), - dblGainOnBankDefaultFinish, - dblGainOnCounterPartyDefaultFinish - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblTimeWidth = 1. / 24.; - double dblTime = 1.; - double[][] aadblCorrelation = new double[][] { - {1.00, 0.20, 0.15, 0.05}, // #0 ASSET - {0.20, 1.00, 0.13, 0.25}, // #1 COLLATERAL - {0.15, 0.13, 1.00, 0.00}, // #2 BANK - {0.05, 0.25, 0.00, 1.00} // #3 COUNTER PARTY - }; - double dblAssetDrift = 0.06; - double dblAssetVolatility = 0.15; - double dblAssetRepo = 0.03; - double dblAssetDividend = 0.02; - double dblInitialAssetNumeraire = 1.; - - double dblZeroCouponCollateralBondDrift = 0.01; - double dblZeroCouponCollateralBondVolatility = 0.05; - double dblZeroCouponCollateralBondRepo = 0.005; - double dblInitialCollateralNumeraire = 1.; - - double dblZeroCouponBankBondDrift = 0.03; - double dblZeroCouponBankBondVolatility = 0.10; - double dblZeroCouponBankBondRepo = 0.028; - double dblBankHazardRate = 0.03; - double dblBankRecoveryRate = 0.45; - double dblTerminalBankNumeraire = 1.; - - double dblZeroCouponCounterPartyBondDrift = 0.03; - double dblZeroCouponCounterPartyBondVolatility = 0.10; - double dblZeroCouponCounterPartyBondRepo = 0.028; - double dblCounterPartyHazardRate = 0.05; - double dblCounterPartyRecoveryRate = 0.30; - double dblTerminalCounterPartyNumeraire = 1.; - - double dblTerminalXVADerivativeValue = 1.; - - double dblSensitivityShiftFactor = 0.001; - - int iNumTimeStep = (int) (1. / dblTimeWidth); - double dblDerivativeValue = dblTerminalXVADerivativeValue; - double dblDerivativeXVAValue = dblTerminalXVADerivativeValue; - - PDEEvolutionControl settings = new PDEEvolutionControl ( - PDEEvolutionControl.CLOSEOUT_GREGORY_LI_TANG, - dblSensitivityShiftFactor - ); - - MasterAgreementCloseOut maco = new MasterAgreementCloseOut ( - dblBankRecoveryRate, - dblCounterPartyRecoveryRate - ); - - DiffusionEvolver deAsset = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblAssetDrift, - dblAssetVolatility - ) - ); - - DiffusionEvolver deZeroCouponCollateralBond = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponCollateralBondDrift, - dblZeroCouponCollateralBondVolatility - ) - ); - - DiffusionEvolver deZeroCouponBankBond = new JumpDiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponBankBondDrift, - dblZeroCouponBankBondVolatility - ), - HazardJumpEvaluator.Standard ( - dblBankHazardRate, - dblBankRecoveryRate - ) - ); - - DiffusionEvolver deZeroCouponCounterPartyBond = new JumpDiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponCounterPartyBondDrift, - dblZeroCouponCounterPartyBondVolatility - ), - HazardJumpEvaluator.Standard ( - dblCounterPartyHazardRate, - dblCounterPartyRecoveryRate - ) - ); - - TwoWayRiskyUniverse twru = new TwoWayRiskyUniverse ( - new Equity ( - deAsset, - dblAssetRepo, - dblAssetDividend - ), - new Tradeable ( - deZeroCouponCollateralBond, - dblZeroCouponCollateralBondRepo - ), - new Tradeable ( - deZeroCouponBankBond, - dblZeroCouponBankBondRepo - ), - new Tradeable ( - deZeroCouponCounterPartyBond, - dblZeroCouponCounterPartyBondRepo - ) - ); - - TrajectoryEvolutionScheme tes = new TrajectoryEvolutionScheme ( - twru, - maco, - settings, - dblTimeWidth - ); - - BurgardKjaerOperator bko = new BurgardKjaerOperator ( - twru, - maco, - settings - ); - - SpreadIntensity si = new SpreadIntensity ( - dblZeroCouponBankBondDrift - dblZeroCouponCollateralBondDrift, - (dblZeroCouponBankBondDrift - dblZeroCouponCollateralBondDrift) / dblBankRecoveryRate, - (dblZeroCouponCounterPartyBondDrift - dblZeroCouponCollateralBondDrift) / dblCounterPartyRecoveryRate - ); - - double[][] aadblNumeraireTimeSeries = Matrix.Transpose ( - SequenceGenerator.GaussianJoint ( - iNumTimeStep, - aadblCorrelation - ) - ); - - double[] adblBankDefaultIndicator = SequenceGenerator.Uniform (iNumTimeStep); - - double[] adblCounterPartyDefaultIndicator = SequenceGenerator.Uniform (iNumTimeStep); - - JumpDiffusionEdge[] aJDEAsset = deAsset.incrementSequence ( - new JumpDiffusionVertex ( - 0., - dblInitialAssetNumeraire, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraireTimeSeries[0]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDECollateral = deZeroCouponCollateralBond.incrementSequence ( - new JumpDiffusionVertex ( - 0., - dblInitialCollateralNumeraire, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraireTimeSeries[1]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDEBank = deZeroCouponBankBond.incrementSequence ( - new JumpDiffusionVertex ( - 0., - dblTerminalBankNumeraire, - 0., - false - ), - UnitRandom.JumpDiffusion ( - aadblNumeraireTimeSeries[2], - adblBankDefaultIndicator - ), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDECounterParty = deZeroCouponCounterPartyBond.incrementSequence ( - new JumpDiffusionVertex ( - 0., - dblTerminalCounterPartyNumeraire, - 0., - false - ), - UnitRandom.JumpDiffusion ( - aadblNumeraireTimeSeries[3], - adblCounterPartyDefaultIndicator - ), - dblTimeWidth - ); - - EdgeAssetGreek eagInitial = new EdgeAssetGreek ( - dblDerivativeXVAValue, - -1., - 0., - dblDerivativeValue - ); - - double dblGainOnBankDefaultInitial = -1. * (dblDerivativeXVAValue - maco.bankDefault (dblDerivativeXVAValue)); - - double dblGainOnCounterPartyDefaultInitial = -1. * (dblDerivativeXVAValue - maco.counterPartyDefault (dblDerivativeXVAValue)); - - System.out.println(); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| BILATERAL XVA EVOLVER - BURGARD & KJAER (2011) GREEKS EVOLUTION ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Time ||"); - - System.out.println ("\t|| - Derivative XVA Value ||"); - - System.out.println ("\t|| - Derivative XVA Value Delta ||"); - - System.out.println ("\t|| - Derivative XVA Value Gamma ||"); - - System.out.println ("\t|| - Gain at Bank Default ||"); - - System.out.println ("\t|| - Gain at Counter Party Default ||"); - - System.out.println ("\t|| - Derivative XVA Asset Growth Theta ||"); - - System.out.println ("\t|| - Derivative XVA Collateral Numeraire Growth Theta ||"); - - System.out.println ("\t|| - Derivative XVA Bank Funding Growth Theta ||"); - - System.out.println ("\t|| - Derivative XVA Bank Default Growth Theta ||"); - - System.out.println ("\t|| - Derivative XVA Counter Party Default Growth Theta ||"); - - System.out.println ("\t|| - Derivative XVA Theta Based on Asset Numeraire Down ||"); - - System.out.println ("\t|| - Derivative XVA Theta ||"); - - System.out.println ("\t|| - Derivative XVA Theta Based on Asset Numeraire Up ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t||" + - FormatUtil.FormatDouble (dblTime, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (eagInitial.derivativeXVAValue(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (eagInitial.derivativeXVAValueDelta(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (eagInitial.derivativeXVAValueGamma(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblGainOnBankDefaultInitial, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblGainOnCounterPartyDefaultInitial, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " ||" - ); - - EdgeEvolutionTrajectory eet = new EdgeEvolutionTrajectory ( - dblTime, - new UniverseSnapshot ( - aJDEAsset[iNumTimeStep - 1], - aJDECollateral[iNumTimeStep - 1], - aJDEBank[iNumTimeStep - 1], - aJDECounterParty[iNumTimeStep - 1] - ), - new EdgeReplicationPortfolio ( - 1., - 0., - 0., - 0. - ), - eagInitial, - dblGainOnBankDefaultInitial, - dblGainOnCounterPartyDefaultInitial - ); - - for (int i = iNumTimeStep - 2; i >= 0; --i) - eet = RunStep ( - tes, - si, - bko, - eet, - aJDEAsset[i], - aJDECollateral[i], - aJDEBank[i], - aJDECounterParty[i] - ); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/burgard2011/CorrelatedNumeraireXVAReplicationPortfolio.java b/org/drip/sample/burgard2011/CorrelatedNumeraireXVAReplicationPortfolio.java deleted file mode 100644 index ecfe9b2..0000000 --- a/org/drip/sample/burgard2011/CorrelatedNumeraireXVAReplicationPortfolio.java +++ /dev/null @@ -1,515 +0,0 @@ - -package org.drip.sample.burgard2011; - -import org.drip.measure.discretemarginal.SequenceGenerator; -import org.drip.measure.dynamics.*; -import org.drip.measure.process.*; -import org.drip.measure.realization.*; -import org.drip.quant.common.FormatUtil; -import org.drip.quant.linearalgebra.Matrix; -import org.drip.service.env.EnvManager; -import org.drip.xva.definition.*; -import org.drip.xva.derivative.*; -import org.drip.xva.pde.*; -import org.drip.xva.settings.PDEEvolutionControl; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CorrelatedNumeraireXVAReplicationPortfolio calculates the XVA Replication Portfolio arising out of the - * Joint Evolution of Numeraires - the Continuous Asset, the Collateral, the Bank, and the Counter-Party - * Numeraires involved in the Dynamic XVA Replication Portfolio of the Burgard and Kjaer (2011) Methodology. - * 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CorrelatedNumeraireXVAReplicationPortfolio { - - private static final EdgeEvolutionTrajectory RunStep ( - final TrajectoryEvolutionScheme tes, - final SpreadIntensity si, - final BurgardKjaerOperator bko, - final EdgeEvolutionTrajectory eetStart, - final JumpDiffusionEdge jdeAsset, - final JumpDiffusionEdge jdeCollateral, - final JumpDiffusionEdge jdeBank, - final JumpDiffusionEdge jdeCounterParty) - throws Exception - { - EdgeAssetGreek eagStart = eetStart.edgeAssetGreek(); - - EdgeReplicationPortfolio erpStart = eetStart.replicationPortfolio(); - - double dblDerivativeXVAValueStart = eagStart.derivativeXVAValue(); - - double dblTimeWidth = tes.timeIncrement(); - - double dblTimeStart = eetStart.time(); - - double dblTime = dblTimeStart - 0.5 * dblTimeWidth; - - UniverseSnapshot usStart = eetStart.tradeableAssetSnapshot(); - - TwoWayRiskyUniverse twru = tes.universe(); - - double dblCollateralBondNumeraire = usStart.zeroCouponCollateralBondNumeraire().finish(); - - UniverseSnapshot usFinish = new UniverseSnapshot ( - jdeAsset, - jdeCollateral, - jdeBank, - jdeCounterParty - ); - - MasterAgreementCloseOut maco = tes.boundaryCondition(); - - LevelBurgardKjaerRun lbkr = bko.timeIncrementRun ( - si, - eetStart - ); - - double dblTheta = lbkr.theta(); - - double dblAssetNumeraireBump = lbkr.assetNumeraireBump(); - - double dblThetaAssetNumeraireUp = lbkr.thetaAssetNumeraireUp(); - - double dblThetaAssetNumeraireDown = lbkr.thetaAssetNumeraireDown(); - - double dblDerivativeXVAValueDeltaFinish = eagStart.derivativeXVAValueDelta() + - 0.5 * (dblThetaAssetNumeraireUp - dblThetaAssetNumeraireDown) * dblTimeWidth / dblAssetNumeraireBump; - - double dblDerivativeXVAValueGammaFinish = eagStart.derivativeXVAValueGamma() + - (dblThetaAssetNumeraireUp + dblThetaAssetNumeraireDown - 2. * dblTheta) * dblTimeWidth / - (dblAssetNumeraireBump * dblAssetNumeraireBump); - - double dblDerivativeXVAValueFinish = dblDerivativeXVAValueStart - dblTheta * dblTimeWidth; - - double dblGainOnBankDefaultFinish = -1. * (dblDerivativeXVAValueFinish - maco.bankDefault - (dblDerivativeXVAValueFinish)); - - double dblGainOnCounterPartyDefaultFinish = -1. * (dblDerivativeXVAValueFinish - maco.counterPartyDefault - (dblDerivativeXVAValueFinish)); - - org.drip.xva.derivative.LevelCashAccount lca = tes.rebalanceCash ( - eetStart, - usFinish - ).cashAccount(); - - double dblCashAccountAccumulationFinish = lca.accumulation(); - - double dblZeroCouponBankPriceFinish = jdeBank.finish(); - - double dblZeroCouponCounterPartyPriceFinish = jdeCounterParty.finish(); - - EdgeReplicationPortfolio erpFinish = new EdgeReplicationPortfolio ( - -1. * dblDerivativeXVAValueDeltaFinish, - dblGainOnBankDefaultFinish / dblZeroCouponBankPriceFinish, - dblGainOnCounterPartyDefaultFinish / dblZeroCouponCounterPartyPriceFinish, - erpStart.cashAccount() + dblCashAccountAccumulationFinish - ); - - System.out.println ("\t||" + - FormatUtil.FormatDouble (dblTime, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblDerivativeXVAValueFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (jdeAsset.finish(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblZeroCouponBankPriceFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblZeroCouponCounterPartyPriceFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (usFinish.zeroCouponCollateralBondNumeraire().finish(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpFinish.assetUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpFinish.bankBondUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpFinish.counterPartyBondUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpFinish.cashAccount(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblCashAccountAccumulationFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lca.assetAccumulation(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lca.bankAccumulation(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lca.counterPartyAccumulation(), 1, 6, 1.) + " ||" - ); - - return new EdgeEvolutionTrajectory ( - dblTimeStart - dblTimeWidth, - usFinish, - erpFinish, - new EdgeAssetGreek ( - dblDerivativeXVAValueFinish, - dblDerivativeXVAValueDeltaFinish, - dblDerivativeXVAValueGammaFinish, - eagStart.derivativeValue() * Math.exp ( - -1. * dblTimeWidth * twru.zeroCouponCollateralBond().priceNumeraire().evaluator().drift().value ( - new JumpDiffusionVertex ( - dblTime, - dblCollateralBondNumeraire, - 0., - false - ) - ) - ) - ), - dblGainOnBankDefaultFinish, - dblGainOnCounterPartyDefaultFinish - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblTimeWidth = 1. / 24.; - double dblTime = 1.; - double[][] aadblCorrelation = new double[][] { - {1.00, 0.20, 0.15, 0.05}, // #0 ASSET - {0.20, 1.00, 0.13, 0.25}, // #1 COLLATERAL - {0.15, 0.13, 1.00, 0.00}, // #2 BANK - {0.05, 0.25, 0.00, 1.00} // #3 COUNTER PARTY - }; - double dblAssetDrift = 0.06; - double dblAssetVolatility = 0.15; - double dblAssetRepo = 0.03; - double dblAssetDividend = 0.02; - double dblInitialAssetNumeraire = 1.; - - double dblZeroCouponCollateralBondDrift = 0.01; - double dblZeroCouponCollateralBondVolatility = 0.05; - double dblZeroCouponCollateralBondRepo = 0.005; - double dblInitialCollateralNumeraire = 1.; - - double dblZeroCouponBankBondDrift = 0.03; - double dblZeroCouponBankBondVolatility = 0.10; - double dblZeroCouponBankBondRepo = 0.028; - double dblBankHazardRate = 0.03; - double dblBankRecoveryRate = 0.45; - double dblTerminalBankNumeraire = 1.; - - double dblZeroCouponCounterPartyBondDrift = 0.03; - double dblZeroCouponCounterPartyBondVolatility = 0.10; - double dblZeroCouponCounterPartyBondRepo = 0.028; - double dblCounterPartyHazardRate = 0.05; - double dblCounterPartyRecoveryRate = 0.30; - double dblTerminalCounterPartyNumeraire = 1.; - - double dblTerminalXVADerivativeValue = 1.; - - double dblSensitivityShiftFactor = 0.001; - - int iNumTimeStep = (int) (1. / dblTimeWidth); - double dblDerivativeValue = dblTerminalXVADerivativeValue; - double dblDerivativeXVAValue = dblTerminalXVADerivativeValue; - - PDEEvolutionControl settings = new PDEEvolutionControl ( - PDEEvolutionControl.CLOSEOUT_GREGORY_LI_TANG, - dblSensitivityShiftFactor - ); - - MasterAgreementCloseOut maco = new MasterAgreementCloseOut ( - dblBankRecoveryRate, - dblCounterPartyRecoveryRate - ); - - DiffusionEvolver deAsset = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblAssetDrift, - dblAssetVolatility - ) - ); - - DiffusionEvolver deZeroCouponCollateralBond = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponCollateralBondDrift, - dblZeroCouponCollateralBondVolatility - ) - ); - - DiffusionEvolver deZeroCouponBankBond = new JumpDiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponBankBondDrift, - dblZeroCouponBankBondVolatility - ), - HazardJumpEvaluator.Standard ( - dblBankHazardRate, - dblBankRecoveryRate - ) - ); - - DiffusionEvolver deZeroCouponCounterPartyBond = new JumpDiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponCounterPartyBondDrift, - dblZeroCouponCounterPartyBondVolatility - ), - HazardJumpEvaluator.Standard ( - dblCounterPartyHazardRate, - dblCounterPartyRecoveryRate - ) - ); - - TwoWayRiskyUniverse twru = new TwoWayRiskyUniverse ( - new Equity ( - deAsset, - dblAssetRepo, - dblAssetDividend - ), - new Tradeable ( - deZeroCouponCollateralBond, - dblZeroCouponCollateralBondRepo - ), - new Tradeable ( - deZeroCouponBankBond, - dblZeroCouponBankBondRepo - ), - new Tradeable ( - deZeroCouponCounterPartyBond, - dblZeroCouponCounterPartyBondRepo - ) - ); - - TrajectoryEvolutionScheme tes = new TrajectoryEvolutionScheme ( - twru, - maco, - settings, - dblTimeWidth - ); - - BurgardKjaerOperator bko = new BurgardKjaerOperator ( - twru, - maco, - settings - ); - - SpreadIntensity si = new SpreadIntensity ( - dblZeroCouponBankBondDrift - dblZeroCouponCollateralBondDrift, - (dblZeroCouponBankBondDrift - dblZeroCouponCollateralBondDrift) / dblBankRecoveryRate, - (dblZeroCouponCounterPartyBondDrift - dblZeroCouponCollateralBondDrift) / dblCounterPartyRecoveryRate - ); - - double[][] aadblNumeraireTimeSeries = Matrix.Transpose ( - SequenceGenerator.GaussianJoint ( - iNumTimeStep, - aadblCorrelation - ) - ); - - double[] adblBankDefaultIndicator = SequenceGenerator.Uniform (iNumTimeStep); - - double[] adblCounterPartyDefaultIndicator = SequenceGenerator.Uniform (iNumTimeStep); - - JumpDiffusionEdge[] aJDEAsset = deAsset.incrementSequence ( - new JumpDiffusionVertex ( - 0., - dblInitialAssetNumeraire, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraireTimeSeries[0]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDECollateral = deZeroCouponCollateralBond.incrementSequence ( - new JumpDiffusionVertex ( - 0., - dblInitialCollateralNumeraire, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraireTimeSeries[1]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDEBank = deZeroCouponBankBond.incrementSequence ( - new JumpDiffusionVertex ( - 0., - dblTerminalBankNumeraire, - 0., - false - ), - UnitRandom.JumpDiffusion ( - aadblNumeraireTimeSeries[2], - adblBankDefaultIndicator - ), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDECounterParty = deZeroCouponCounterPartyBond.incrementSequence ( - new JumpDiffusionVertex ( - 0., - dblTerminalCounterPartyNumeraire, - 0., - false - ), - UnitRandom.JumpDiffusion ( - aadblNumeraireTimeSeries[3], - adblCounterPartyDefaultIndicator - ), - dblTimeWidth - ); - - EdgeAssetGreek eagInitial = new EdgeAssetGreek ( - dblDerivativeXVAValue, - -1., - 0., - dblDerivativeValue - ); - - double dblGainOnBankDefaultInitial = -1. * (dblDerivativeXVAValue - maco.bankDefault (dblDerivativeXVAValue)); - - double dblGainOnCounterPartyDefaultInitial = -1. * (dblDerivativeXVAValue - maco.counterPartyDefault (dblDerivativeXVAValue)); - - EdgeReplicationPortfolio erpInitial = new EdgeReplicationPortfolio ( - 1., - dblGainOnBankDefaultInitial, - dblGainOnCounterPartyDefaultInitial, - 0. - ); - - System.out.println(); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| BILATERAL XVA EVOLVER - BURGARD & KJAER (2011) REPLICATION PORTFOLIO EVOLUTION ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Time ||"); - - System.out.println ("\t|| - Derivative XVA Value ||"); - - System.out.println ("\t|| - Asset Price Realization ||"); - - System.out.println ("\t|| - Realization of the Zero Coupon Bank Bond Price ||"); - - System.out.println ("\t|| - Realization of the Zero Coupon Counter Party Bond Price ||"); - - System.out.println ("\t|| - Realization of the Zero Coupon Collateral Bond Price ||"); - - System.out.println ("\t|| - Derivative XVA Asset Replication Units ||"); - - System.out.println ("\t|| - Derivative XVA Value Bank Bond Replication Units ||"); - - System.out.println ("\t|| - Derivative XVA Value Counter Party Bond Replication Units ||"); - - System.out.println ("\t|| - Derivative XVA Value Cash Account Replication Units ||"); - - System.out.println ("\t|| - Derivative Cash Account Accumulation Component ||"); - - System.out.println ("\t|| - Asset Cash Account Accumulation Component ||"); - - System.out.println ("\t|| - Bank Cash Account Accumulation Component ||"); - - System.out.println ("\t|| - Counter Party Cash Account Accumulation Component ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t||" + - FormatUtil.FormatDouble (dblTime, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (eagInitial.derivativeXVAValue(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (1., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aJDEBank[iNumTimeStep - 1].finish(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aJDECounterParty[iNumTimeStep - 1].finish(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (1., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpInitial.assetUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpInitial.bankBondUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpInitial.counterPartyBondUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpInitial.cashAccount(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " ||" - ); - - EdgeEvolutionTrajectory eet = new EdgeEvolutionTrajectory ( - dblTime, - new UniverseSnapshot ( - aJDEAsset[iNumTimeStep - 1], - aJDECollateral[iNumTimeStep - 1], - aJDEBank[iNumTimeStep - 1], - aJDECounterParty[iNumTimeStep - 1] - ), - new EdgeReplicationPortfolio ( - 1., - 0., - 0., - 0. - ), - eagInitial, - dblGainOnBankDefaultInitial, - dblGainOnCounterPartyDefaultInitial - ); - - for (int i = iNumTimeStep - 2; i >= 0; --i) - eet = RunStep ( - tes, - si, - bko, - eet, - aJDEAsset[i], - aJDECollateral[i], - aJDEBank[i], - aJDECounterParty[i] - ); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/burgard2011/XVAExplain.java b/org/drip/sample/burgard2011/XVAExplain.java deleted file mode 100644 index 5911302..0000000 --- a/org/drip/sample/burgard2011/XVAExplain.java +++ /dev/null @@ -1,482 +0,0 @@ - -package org.drip.sample.burgard2011; - -import org.drip.measure.dynamics.DiffusionEvaluatorLogarithmic; -import org.drip.measure.process.DiffusionEvolver; -import org.drip.measure.realization.JumpDiffusionVertex; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.xva.definition.*; -import org.drip.xva.derivative.*; -import org.drip.xva.pde.*; -import org.drip.xva.settings.PDEEvolutionControl; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * XVAExplain demonstrates the Trajectory Attribtuion of the Bank and Counter-Party Default Based Derivative - * Evolution of the Dynamic XVA Replication Porfolio. 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class XVAExplain { - - private static final EdgeEvolutionTrajectory RunStep ( - final TrajectoryEvolutionScheme tes, - final SpreadIntensity si, - final BurgardKjaerOperator bko, - final EdgeEvolutionTrajectory eetStart) - throws Exception - { - EdgeAssetGreek eagStart = eetStart.edgeAssetGreek(); - - EdgeReplicationPortfolio erpStart = eetStart.replicationPortfolio(); - - double dblDerivativeXVAValueStart = eagStart.derivativeXVAValue(); - - double dblTimeWidth = tes.timeIncrement(); - - double dblTimeStart = eetStart.time(); - - double dblTime = dblTimeStart - 0.5 * dblTimeWidth; - - UniverseSnapshot usStart = eetStart.tradeableAssetSnapshot(); - - TwoWayRiskyUniverse twru = tes.universe(); - - double dblCollateralBondNumeraire = usStart.zeroCouponCollateralBondNumeraire().finish(); - - UniverseSnapshot usFinish = new UniverseSnapshot ( - twru.asset().priceNumeraire().weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - usStart.assetNumeraire().finish(), - 0., - false - ), - dblTimeWidth - ), - twru.zeroCouponCollateralBond().priceNumeraire().weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - dblCollateralBondNumeraire, - 0., - false - ), - dblTimeWidth - ), - twru.zeroCouponBankBond().priceNumeraire().weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - usStart.zeroCouponBankBondNumeraire().finish(), - 0., - false - ), - dblTimeWidth - ), - twru.zeroCouponCounterPartyBond().priceNumeraire().weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - usStart.zeroCouponCounterPartyBondNumeraire().finish(), - 0., - false - ), - dblTimeWidth - ) - ); - - MasterAgreementCloseOut maco = tes.boundaryCondition(); - - LevelBurgardKjaerRun lbkr = bko.timeIncrementRun ( - si, - eetStart - ); - - double dblTheta = lbkr.theta(); - - double dblAssetNumeraireBump = lbkr.assetNumeraireBump(); - - double dblThetaAssetNumeraireUp = lbkr.thetaAssetNumeraireUp(); - - double dblThetaAssetNumeraireDown = lbkr.thetaAssetNumeraireDown(); - - double dblDerivativeXVAValueDeltaFinish = eagStart.derivativeXVAValueDelta() + - 0.5 * (dblThetaAssetNumeraireUp - dblThetaAssetNumeraireDown) * dblTimeWidth / dblAssetNumeraireBump; - - double dblDerivativeXVAValueGammaFinish = eagStart.derivativeXVAValueGamma() + - (dblThetaAssetNumeraireUp + dblThetaAssetNumeraireDown - 2. * dblTheta) * dblTimeWidth / - (dblAssetNumeraireBump * dblAssetNumeraireBump); - - double dblDerivativeXVAValueFinish = dblDerivativeXVAValueStart - dblTheta * dblTimeWidth; - - double dblGainOnBankDefaultFinish = -1. * (dblDerivativeXVAValueFinish - maco.bankDefault - (dblDerivativeXVAValueFinish)); - - double dblGainOnCounterPartyDefaultFinish = -1. * (dblDerivativeXVAValueFinish - maco.counterPartyDefault - (dblDerivativeXVAValueFinish)); - - org.drip.xva.derivative.LevelCashAccount lca = tes.rebalanceCash ( - eetStart, - usFinish - ).cashAccount(); - - double dblCashAccountAccumulationFinish = lca.accumulation(); - - double dblAssetPriceFinish = usFinish.assetNumeraire().finish(); - - double dblZeroCouponBankPriceFinish = usFinish.zeroCouponBankBondNumeraire().finish(); - - double dblZeroCouponCounterPartyPriceFinish = usFinish.zeroCouponCounterPartyBondNumeraire().finish(); - - EdgeReplicationPortfolio erpFinish = new EdgeReplicationPortfolio ( - -1. * dblDerivativeXVAValueDeltaFinish, - dblGainOnBankDefaultFinish / dblZeroCouponBankPriceFinish, - dblGainOnCounterPartyDefaultFinish / dblZeroCouponCounterPartyPriceFinish, - erpStart.cashAccount() + dblCashAccountAccumulationFinish - ); - - System.out.println ("\t||" + - FormatUtil.FormatDouble (dblTime, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblDerivativeXVAValueFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblAssetPriceFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblZeroCouponBankPriceFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblZeroCouponCounterPartyPriceFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (usFinish.zeroCouponCollateralBondNumeraire().finish(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpFinish.assetUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpFinish.bankBondUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpFinish.counterPartyBondUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpFinish.cashAccount(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblCashAccountAccumulationFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lca.assetAccumulation(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lca.bankAccumulation(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lca.counterPartyAccumulation(), 1, 6, 1.) + " ||" - ); - - return new EdgeEvolutionTrajectory ( - dblTimeStart - dblTimeWidth, - usFinish, - erpFinish, - new EdgeAssetGreek ( - dblDerivativeXVAValueFinish, - dblDerivativeXVAValueDeltaFinish, - dblDerivativeXVAValueGammaFinish, - eagStart.derivativeValue() * Math.exp ( - -1. * dblTimeWidth * twru.zeroCouponCollateralBond().priceNumeraire().evaluator().drift().value ( - new JumpDiffusionVertex ( - dblTime, - dblCollateralBondNumeraire, - 0., - false - ) - ) - ) - ), - dblGainOnBankDefaultFinish, - dblGainOnCounterPartyDefaultFinish - ); - } - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblSensitivityShiftFactor = 0.001; - double dblBankRecovery = 0.4; - double dblCounterPartyRecovery = 0.4; - double dblAssetDrift = 0.06; - double dblAssetVolatility = 0.15; - double dblAssetRepo = 0.03; - double dblAssetDividend = 0.02; - double dblZeroCouponCollateralBondDrift = 0.01; - double dblZeroCouponCollateralBondVolatility = 0.05; - double dblZeroCouponCollateralBondRepo = 0.005; - double dblZeroCouponBankBondDrift = 0.03; - double dblZeroCouponBankBondVolatility = 0.10; - double dblZeroCouponBankBondRepo = 0.028; - double dblZeroCouponCounterPartyBondDrift = 0.03; - double dblZeroCouponCounterPartyBondVolatility = 0.10; - double dblZeroCouponCounterPartyBondRepo = 0.028; - double dblTimeWidth = 1. / 24.; - double dblTime = 1.; - double dblTerminalXVADerivativeValue = 1.; - - PDEEvolutionControl settings = new PDEEvolutionControl ( - PDEEvolutionControl.CLOSEOUT_GREGORY_LI_TANG, - dblSensitivityShiftFactor - ); - - MasterAgreementCloseOut maco = new MasterAgreementCloseOut ( - dblBankRecovery, - dblCounterPartyRecovery - ); - - DiffusionEvolver meAsset = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblAssetDrift, - dblAssetVolatility - ) - ); - - DiffusionEvolver meZeroCouponCollateralBond = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponCollateralBondDrift, - dblZeroCouponCollateralBondVolatility - ) - ); - - DiffusionEvolver meZeroCouponBankBond = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponBankBondDrift, - dblZeroCouponBankBondVolatility - ) - ); - - DiffusionEvolver meZeroCouponCounterPartyBond = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponCounterPartyBondDrift, - dblZeroCouponCounterPartyBondVolatility - ) - ); - - TwoWayRiskyUniverse twru = new TwoWayRiskyUniverse ( - new Equity ( - meAsset, - dblAssetRepo, - dblAssetDividend - ), - new Tradeable ( - meZeroCouponCollateralBond, - dblZeroCouponCollateralBondRepo - ), - new Tradeable ( - meZeroCouponBankBond, - dblZeroCouponBankBondRepo - ), - new Tradeable ( - meZeroCouponCounterPartyBond, - dblZeroCouponCounterPartyBondRepo - ) - ); - - TrajectoryEvolutionScheme tes = new TrajectoryEvolutionScheme ( - twru, - maco, - settings, - dblTimeWidth - ); - - BurgardKjaerOperator bko = new BurgardKjaerOperator ( - twru, - maco, - settings - ); - - SpreadIntensity si = new SpreadIntensity ( - dblZeroCouponBankBondDrift - dblZeroCouponCollateralBondDrift, - (dblZeroCouponBankBondDrift - dblZeroCouponCollateralBondDrift) / dblBankRecovery, - (dblZeroCouponCounterPartyBondDrift - dblZeroCouponCollateralBondDrift) / dblCounterPartyRecovery - ); - - double dblDerivativeValue = dblTerminalXVADerivativeValue; - double dblDerivativeXVAValue = dblTerminalXVADerivativeValue; - - EdgeAssetGreek erugInitial = new EdgeAssetGreek ( - dblDerivativeXVAValue, - -1., - 0., - dblDerivativeValue - ); - - double dblGainOnBankDefaultInitial = -1. * (dblDerivativeXVAValue - maco.bankDefault (dblDerivativeXVAValue)); - - double dblGainOnCounterPartyDefaultInitial = -1. * (dblDerivativeXVAValue - maco.counterPartyDefault (dblDerivativeXVAValue)); - - EdgeReplicationPortfolio erpInitial = new EdgeReplicationPortfolio ( - 1., - dblGainOnBankDefaultInitial, - dblGainOnCounterPartyDefaultInitial, - 0. - ); - - System.out.println(); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| BILATERAL XVA EVOLVER - BURGARD & KJAER (2011) REPLICATION PORTFOLIO EVOLUTION ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Time ||"); - - System.out.println ("\t|| - Derivative XVA Value ||"); - - System.out.println ("\t|| - Asset Price Realization ||"); - - System.out.println ("\t|| - Realization of the Zero Coupon Bank Bond Price ||"); - - System.out.println ("\t|| - Realization of the Zero Coupon Counter Party Bond Price ||"); - - System.out.println ("\t|| - Realization of the Zero Coupon Collateral Bond Price ||"); - - System.out.println ("\t|| - Derivative XVA Asset Replication Units ||"); - - System.out.println ("\t|| - Derivative XVA Value Bank Bond Replication Units ||"); - - System.out.println ("\t|| - Derivative XVA Value Counter Party Bond Replication Units ||"); - - System.out.println ("\t|| - Derivative XVA Value Cash Account Replication Units ||"); - - System.out.println ("\t|| - Derivative Cash Account Accumulation Component ||"); - - System.out.println ("\t|| - Asset Cash Account Accumulation Component ||"); - - System.out.println ("\t|| - Bank Cash Account Accumulation Component ||"); - - System.out.println ("\t|| - Counter Party Cash Account Accumulation Component ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t||" + - FormatUtil.FormatDouble (dblTime, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erugInitial.derivativeXVAValue(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (1., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (1., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (1., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (1., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpInitial.assetUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpInitial.bankBondUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpInitial.counterPartyBondUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpInitial.cashAccount(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " ||" - ); - - EdgeEvolutionTrajectory eet = new EdgeEvolutionTrajectory ( - dblTime, - new UniverseSnapshot ( - meAsset.weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - dblDerivativeValue, - 0., - false - ), - dblTimeWidth - ), - meZeroCouponCollateralBond.weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - 1., - 0., - false - ), - dblTimeWidth - ), - meZeroCouponBankBond.weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - 1., - 0., - false - ), - dblTimeWidth - ), - meZeroCouponCounterPartyBond.weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - 1., - 0., - false - ), - dblTimeWidth - ) - ), - new EdgeReplicationPortfolio ( - 1., - 0., - 0., - 0. - ), - erugInitial, - dblGainOnBankDefaultInitial, - dblGainOnCounterPartyDefaultInitial - ); - - for (dblTime -= dblTimeWidth; dblTime >= 0.; dblTime -= dblTimeWidth) - eet = RunStep ( - tes, - si, - bko, - eet - ); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/burgard2011/XVAGreeks.java b/org/drip/sample/burgard2011/XVAGreeks.java deleted file mode 100644 index 36585a6..0000000 --- a/org/drip/sample/burgard2011/XVAGreeks.java +++ /dev/null @@ -1,465 +0,0 @@ - -package org.drip.sample.burgard2011; - -import org.drip.measure.dynamics.DiffusionEvaluatorLogarithmic; -import org.drip.measure.process.DiffusionEvolver; -import org.drip.measure.realization.JumpDiffusionVertex; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.xva.definition.*; -import org.drip.xva.derivative.*; -import org.drip.xva.pde.*; -import org.drip.xva.settings.PDEEvolutionControl; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * XVAGreeks demonstrates the Bank and Counter-Party Default Based Derivative Evolution of the XVA Greeks and - * their Components. 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class XVAGreeks { - - private static final EdgeEvolutionTrajectory RunStep ( - final TrajectoryEvolutionScheme tes, - final SpreadIntensity si, - final BurgardKjaerOperator bko, - final EdgeEvolutionTrajectory eetStart) - throws Exception - { - EdgeAssetGreek eagStart = eetStart.edgeAssetGreek(); - - EdgeReplicationPortfolio erpStart = eetStart.replicationPortfolio(); - - double dblDerivativeXVAValueStart = eagStart.derivativeXVAValue(); - - double dblTimeWidth = tes.timeIncrement(); - - double dblTimeStart = eetStart.time(); - - double dblTime = dblTimeStart - 0.5 * dblTimeWidth; - - UniverseSnapshot usStart = eetStart.tradeableAssetSnapshot(); - - TwoWayRiskyUniverse twru = tes.universe(); - - double dblCollateralBondNumeraire = usStart.zeroCouponCollateralBondNumeraire().finish(); - - UniverseSnapshot usFinish = new UniverseSnapshot ( - twru.asset().priceNumeraire().weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - usStart.assetNumeraire().finish(), - 0., - false - ), - dblTimeWidth - ), - twru.zeroCouponCollateralBond().priceNumeraire().weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - dblCollateralBondNumeraire, - 0., - false - ), - dblTimeWidth - ), - twru.zeroCouponBankBond().priceNumeraire().weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - usStart.zeroCouponBankBondNumeraire().finish(), - 0., - false - ), - dblTimeWidth - ), - twru.zeroCouponCounterPartyBond().priceNumeraire().weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - usStart.zeroCouponCounterPartyBondNumeraire().finish(), - 0., - false - ), - dblTimeWidth - ) - ); - - MasterAgreementCloseOut maco = tes.boundaryCondition(); - - LevelBurgardKjaerRun lbkr = bko.timeIncrementRun ( - si, - eetStart - ); - - double dblTheta = lbkr.theta(); - - double dblAssetNumeraireBump = lbkr.assetNumeraireBump(); - - double dblThetaAssetNumeraireUp = lbkr.thetaAssetNumeraireUp(); - - double dblThetaAssetNumeraireDown = lbkr.thetaAssetNumeraireDown(); - - double dblDerivativeXVAValueDeltaFinish = eagStart.derivativeXVAValueDelta() + - 0.5 * (dblThetaAssetNumeraireUp - dblThetaAssetNumeraireDown) * dblTimeWidth / dblAssetNumeraireBump; - - double dblDerivativeXVAValueGammaFinish = eagStart.derivativeXVAValueGamma() + - (dblThetaAssetNumeraireUp + dblThetaAssetNumeraireDown - 2. * dblTheta) * dblTimeWidth / - (dblAssetNumeraireBump * dblAssetNumeraireBump); - - double dblDerivativeXVAValueFinish = dblDerivativeXVAValueStart - dblTheta * dblTimeWidth; - - double dblGainOnBankDefaultFinish = -1. * (dblDerivativeXVAValueFinish - maco.bankDefault - (dblDerivativeXVAValueFinish)); - - double dblGainOnCounterPartyDefaultFinish = -1. * (dblDerivativeXVAValueFinish - maco.counterPartyDefault - (dblDerivativeXVAValueFinish)); - - System.out.println ("\t||" + - FormatUtil.FormatDouble (dblTime, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblDerivativeXVAValueFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblDerivativeXVAValueDeltaFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblDerivativeXVAValueGammaFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblGainOnBankDefaultFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblGainOnCounterPartyDefaultFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lbkr.derivativeXVAStochasticGrowth(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lbkr.derivativeXVACollateralGrowth(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lbkr.derivativeXVAFundingGrowth(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lbkr.derivativeXVABankDefaultGrowth(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lbkr.derivativeXVACounterPartyDefaultGrowth(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblThetaAssetNumeraireDown, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblTheta, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblThetaAssetNumeraireUp, 1, 6, 1.) + " ||" - ); - - org.drip.xva.derivative.LevelCashAccount lca = tes.rebalanceCash ( - eetStart, - usFinish - ).cashAccount(); - - return new EdgeEvolutionTrajectory ( - dblTimeStart - dblTimeWidth, - usFinish, - new EdgeReplicationPortfolio ( - -1. * dblDerivativeXVAValueDeltaFinish, - dblGainOnBankDefaultFinish / usFinish.zeroCouponBankBondNumeraire().finish(), - dblGainOnCounterPartyDefaultFinish / usFinish.zeroCouponCounterPartyBondNumeraire().finish(), - erpStart.cashAccount() + lca.accumulation() - ), - new EdgeAssetGreek ( - dblDerivativeXVAValueFinish, - dblDerivativeXVAValueDeltaFinish, - dblDerivativeXVAValueGammaFinish, - eagStart.derivativeValue() * Math.exp ( - -1. * dblTimeWidth * twru.zeroCouponCollateralBond().priceNumeraire().evaluator().drift().value ( - new JumpDiffusionVertex ( - dblTime, - dblCollateralBondNumeraire, - 0., - false - ) - ) - ) - ), - dblGainOnBankDefaultFinish, - dblGainOnCounterPartyDefaultFinish - ); - } - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblSensitivityShiftFactor = 0.001; - double dblBankRecovery = 0.4; - double dblCounterPartyRecovery = 0.4; - double dblAssetDrift = 0.06; - double dblAssetVolatility = 0.15; - double dblAssetRepo = 0.03; - double dblAssetDividend = 0.02; - double dblZeroCouponCollateralBondDrift = 0.01; - double dblZeroCouponCollateralBondVolatility = 0.05; - double dblZeroCouponCollateralBondRepo = 0.005; - double dblZeroCouponBankBondDrift = 0.03; - double dblZeroCouponBankBondVolatility = 0.10; - double dblZeroCouponBankBondRepo = 0.028; - double dblZeroCouponCounterPartyBondDrift = 0.03; - double dblZeroCouponCounterPartyBondVolatility = 0.10; - double dblZeroCouponCounterPartyBondRepo = 0.028; - double dblTimeWidth = 1. / 24.; - double dblTime = 1.; - double dblTerminalXVADerivativeValue = 1.; - - PDEEvolutionControl settings = new PDEEvolutionControl ( - PDEEvolutionControl.CLOSEOUT_GREGORY_LI_TANG, - dblSensitivityShiftFactor - ); - - MasterAgreementCloseOut maco = new MasterAgreementCloseOut ( - dblBankRecovery, - dblCounterPartyRecovery - ); - - DiffusionEvolver meAsset = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblAssetDrift, - dblAssetVolatility - ) - ); - - DiffusionEvolver meZeroCouponCollateralBond = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponCollateralBondDrift, - dblZeroCouponCollateralBondVolatility - ) - ); - - DiffusionEvolver meZeroCouponBankBond = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponBankBondDrift, - dblZeroCouponBankBondVolatility - ) - ); - - DiffusionEvolver meZeroCouponCounterPartyBond = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponCounterPartyBondDrift, - dblZeroCouponCounterPartyBondVolatility - ) - ); - - TwoWayRiskyUniverse twru = new TwoWayRiskyUniverse ( - new Equity ( - meAsset, - dblAssetRepo, - dblAssetDividend - ), - new Tradeable ( - meZeroCouponCollateralBond, - dblZeroCouponCollateralBondRepo - ), - new Tradeable ( - meZeroCouponBankBond, - dblZeroCouponBankBondRepo - ), - new Tradeable ( - meZeroCouponCounterPartyBond, - dblZeroCouponCounterPartyBondRepo - ) - ); - - TrajectoryEvolutionScheme tes = new TrajectoryEvolutionScheme ( - twru, - maco, - settings, - dblTimeWidth - ); - - BurgardKjaerOperator bko = new BurgardKjaerOperator ( - twru, - maco, - settings - ); - - SpreadIntensity si = new SpreadIntensity ( - dblZeroCouponBankBondDrift - dblZeroCouponCollateralBondDrift, - (dblZeroCouponBankBondDrift - dblZeroCouponCollateralBondDrift) / dblBankRecovery, - (dblZeroCouponCounterPartyBondDrift - dblZeroCouponCollateralBondDrift) / dblCounterPartyRecovery - ); - - double dblDerivativeValue = dblTerminalXVADerivativeValue; - double dblDerivativeXVAValue = dblTerminalXVADerivativeValue; - - EdgeAssetGreek erug = new EdgeAssetGreek ( - dblDerivativeXVAValue, - -1., - 0., - dblDerivativeValue - ); - - double dblGainOnBankDefault = -1. * (dblDerivativeXVAValue - maco.bankDefault (dblDerivativeXVAValue)); - - double dblGainOnCounterPartyDefault = -1. * (dblDerivativeXVAValue - maco.counterPartyDefault (dblDerivativeXVAValue)); - - System.out.println(); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| BILATERAL XVA EVOLVER - BURGARD & KJAER (2011) GREEKS EVOLUTION ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Time ||"); - - System.out.println ("\t|| - Derivative XVA Value ||"); - - System.out.println ("\t|| - Derivative XVA Value Delta ||"); - - System.out.println ("\t|| - Derivative XVA Value Gamma ||"); - - System.out.println ("\t|| - Gain at Bank Default ||"); - - System.out.println ("\t|| - Gain at Counter Party Default ||"); - - System.out.println ("\t|| - Derivative XVA Asset Growth Theta ||"); - - System.out.println ("\t|| - Derivative XVA Collateral Numeraire Growth Theta ||"); - - System.out.println ("\t|| - Derivative XVA Bank Funding Growth Theta ||"); - - System.out.println ("\t|| - Derivative XVA Bank Default Growth Theta ||"); - - System.out.println ("\t|| - Derivative XVA Counter Party Default Growth Theta ||"); - - System.out.println ("\t|| - Derivative XVA Theta Based on Asset Numeraire Down ||"); - - System.out.println ("\t|| - Derivative XVA Theta ||"); - - System.out.println ("\t|| - Derivative XVA Theta Based on Asset Numeraire Up ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t||" + - FormatUtil.FormatDouble (dblTime, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erug.derivativeXVAValue(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erug.derivativeXVAValueDelta(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erug.derivativeXVAValueGamma(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblGainOnBankDefault, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblGainOnCounterPartyDefault, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " ||" - ); - - EdgeEvolutionTrajectory eet = new EdgeEvolutionTrajectory ( - dblTime, - new UniverseSnapshot ( - meAsset.weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - dblDerivativeValue, - 0., - false - ), - dblTimeWidth - ), - meZeroCouponCollateralBond.weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - 1., - 0., - false - ), - dblTimeWidth - ), - meZeroCouponBankBond.weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - 1., - 0., - false - ), - dblTimeWidth - ), - meZeroCouponCounterPartyBond.weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - 1., - 0., - false - ), - dblTimeWidth - ) - ), - new EdgeReplicationPortfolio ( - 1., - 0., - 0., - 0. - ), - erug, - dblGainOnBankDefault, - dblGainOnCounterPartyDefault - ); - - for (dblTime -= dblTimeWidth; dblTime >= 0.; dblTime -= dblTimeWidth) - eet = RunStep ( - tes, - si, - bko, - eet - ); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/burgard2011/XVAReplicationPortfolio.java b/org/drip/sample/burgard2011/XVAReplicationPortfolio.java deleted file mode 100644 index c1a7f07..0000000 --- a/org/drip/sample/burgard2011/XVAReplicationPortfolio.java +++ /dev/null @@ -1,482 +0,0 @@ - -package org.drip.sample.burgard2011; - -import org.drip.measure.dynamics.DiffusionEvaluatorLogarithmic; -import org.drip.measure.process.DiffusionEvolver; -import org.drip.measure.realization.JumpDiffusionVertex; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.xva.definition.*; -import org.drip.xva.derivative.*; -import org.drip.xva.pde.*; -import org.drip.xva.settings.PDEEvolutionControl; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * BilateralXVAReplicationPortfolio demonstrates the Bank and Counter-Party Default Based Derivative - * Evolution of the Dynamic XVA Replication Porfolio. 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class XVAReplicationPortfolio { - - private static final EdgeEvolutionTrajectory RunStep ( - final TrajectoryEvolutionScheme tes, - final SpreadIntensity si, - final BurgardKjaerOperator bko, - final EdgeEvolutionTrajectory eetStart) - throws Exception - { - EdgeAssetGreek eagStart = eetStart.edgeAssetGreek(); - - EdgeReplicationPortfolio erpStart = eetStart.replicationPortfolio(); - - double dblDerivativeXVAValueStart = eagStart.derivativeXVAValue(); - - double dblTimeWidth = tes.timeIncrement(); - - double dblTimeStart = eetStart.time(); - - double dblTime = dblTimeStart - 0.5 * dblTimeWidth; - - UniverseSnapshot usStart = eetStart.tradeableAssetSnapshot(); - - TwoWayRiskyUniverse twru = tes.universe(); - - double dblCollateralBondNumeraire = usStart.zeroCouponCollateralBondNumeraire().finish(); - - UniverseSnapshot usFinish = new UniverseSnapshot ( - twru.asset().priceNumeraire().weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - usStart.assetNumeraire().finish(), - 0., - false - ), - dblTimeWidth - ), - twru.zeroCouponCollateralBond().priceNumeraire().weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - dblCollateralBondNumeraire, - 0., - false - ), - dblTimeWidth - ), - twru.zeroCouponBankBond().priceNumeraire().weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - usStart.zeroCouponBankBondNumeraire().finish(), - 0., - false - ), - dblTimeWidth - ), - twru.zeroCouponCounterPartyBond().priceNumeraire().weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - usStart.zeroCouponCounterPartyBondNumeraire().finish(), - 0., - false - ), - dblTimeWidth - ) - ); - - MasterAgreementCloseOut maco = tes.boundaryCondition(); - - LevelBurgardKjaerRun lbkr = bko.timeIncrementRun ( - si, - eetStart - ); - - double dblTheta = lbkr.theta(); - - double dblAssetNumeraireBump = lbkr.assetNumeraireBump(); - - double dblThetaAssetNumeraireUp = lbkr.thetaAssetNumeraireUp(); - - double dblThetaAssetNumeraireDown = lbkr.thetaAssetNumeraireDown(); - - double dblDerivativeXVAValueDeltaFinish = eagStart.derivativeXVAValueDelta() + - 0.5 * (dblThetaAssetNumeraireUp - dblThetaAssetNumeraireDown) * dblTimeWidth / dblAssetNumeraireBump; - - double dblDerivativeXVAValueGammaFinish = eagStart.derivativeXVAValueGamma() + - (dblThetaAssetNumeraireUp + dblThetaAssetNumeraireDown - 2. * dblTheta) * dblTimeWidth / - (dblAssetNumeraireBump * dblAssetNumeraireBump); - - double dblDerivativeXVAValueFinish = dblDerivativeXVAValueStart - dblTheta * dblTimeWidth; - - double dblGainOnBankDefaultFinish = -1. * (dblDerivativeXVAValueFinish - maco.bankDefault - (dblDerivativeXVAValueFinish)); - - double dblGainOnCounterPartyDefaultFinish = -1. * (dblDerivativeXVAValueFinish - maco.counterPartyDefault - (dblDerivativeXVAValueFinish)); - - org.drip.xva.derivative.LevelCashAccount lca = tes.rebalanceCash ( - eetStart, - usFinish - ).cashAccount(); - - double dblCashAccountAccumulationFinish = lca.accumulation(); - - double dblAssetPriceFinish = usFinish.assetNumeraire().finish(); - - double dblZeroCouponBankPriceFinish = usFinish.zeroCouponBankBondNumeraire().finish(); - - double dblZeroCouponCounterPartyPriceFinish = usFinish.zeroCouponCounterPartyBondNumeraire().finish(); - - EdgeReplicationPortfolio erpFinish = new EdgeReplicationPortfolio ( - -1. * dblDerivativeXVAValueDeltaFinish, - dblGainOnBankDefaultFinish / dblZeroCouponBankPriceFinish, - dblGainOnCounterPartyDefaultFinish / dblZeroCouponCounterPartyPriceFinish, - erpStart.cashAccount() + dblCashAccountAccumulationFinish - ); - - System.out.println ("\t||" + - FormatUtil.FormatDouble (dblTime, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblDerivativeXVAValueFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblAssetPriceFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblZeroCouponBankPriceFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblZeroCouponCounterPartyPriceFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (usFinish.zeroCouponCollateralBondNumeraire().finish(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpFinish.assetUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpFinish.bankBondUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpFinish.counterPartyBondUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpFinish.cashAccount(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblCashAccountAccumulationFinish, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lca.assetAccumulation(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lca.bankAccumulation(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lca.counterPartyAccumulation(), 1, 6, 1.) + " ||" - ); - - return new EdgeEvolutionTrajectory ( - dblTimeStart - dblTimeWidth, - usFinish, - erpFinish, - new EdgeAssetGreek ( - dblDerivativeXVAValueFinish, - dblDerivativeXVAValueDeltaFinish, - dblDerivativeXVAValueGammaFinish, - eagStart.derivativeValue() * Math.exp ( - -1. * dblTimeWidth * twru.zeroCouponCollateralBond().priceNumeraire().evaluator().drift().value ( - new JumpDiffusionVertex ( - dblTime, - dblCollateralBondNumeraire, - 0., - false - ) - ) - ) - ), - dblGainOnBankDefaultFinish, - dblGainOnCounterPartyDefaultFinish - ); - } - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblSensitivityShiftFactor = 0.001; - double dblBankRecovery = 0.4; - double dblCounterPartyRecovery = 0.4; - double dblAssetDrift = 0.06; - double dblAssetVolatility = 0.15; - double dblAssetRepo = 0.03; - double dblAssetDividend = 0.02; - double dblZeroCouponCollateralBondDrift = 0.01; - double dblZeroCouponCollateralBondVolatility = 0.05; - double dblZeroCouponCollateralBondRepo = 0.005; - double dblZeroCouponBankBondDrift = 0.03; - double dblZeroCouponBankBondVolatility = 0.10; - double dblZeroCouponBankBondRepo = 0.028; - double dblZeroCouponCounterPartyBondDrift = 0.03; - double dblZeroCouponCounterPartyBondVolatility = 0.10; - double dblZeroCouponCounterPartyBondRepo = 0.028; - double dblTimeWidth = 1. / 24.; - double dblTime = 1.; - double dblTerminalXVADerivativeValue = 1.; - - PDEEvolutionControl settings = new PDEEvolutionControl ( - PDEEvolutionControl.CLOSEOUT_GREGORY_LI_TANG, - dblSensitivityShiftFactor - ); - - MasterAgreementCloseOut maco = new MasterAgreementCloseOut ( - dblBankRecovery, - dblCounterPartyRecovery - ); - - DiffusionEvolver meAsset = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblAssetDrift, - dblAssetVolatility - ) - ); - - DiffusionEvolver meZeroCouponCollateralBond = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponCollateralBondDrift, - dblZeroCouponCollateralBondVolatility - ) - ); - - DiffusionEvolver meZeroCouponBankBond = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponBankBondDrift, - dblZeroCouponBankBondVolatility - ) - ); - - DiffusionEvolver meZeroCouponCounterPartyBond = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponCounterPartyBondDrift, - dblZeroCouponCounterPartyBondVolatility - ) - ); - - TwoWayRiskyUniverse twru = new TwoWayRiskyUniverse ( - new Equity ( - meAsset, - dblAssetRepo, - dblAssetDividend - ), - new Tradeable ( - meZeroCouponCollateralBond, - dblZeroCouponCollateralBondRepo - ), - new Tradeable ( - meZeroCouponBankBond, - dblZeroCouponBankBondRepo - ), - new Tradeable ( - meZeroCouponCounterPartyBond, - dblZeroCouponCounterPartyBondRepo - ) - ); - - TrajectoryEvolutionScheme tes = new TrajectoryEvolutionScheme ( - twru, - maco, - settings, - dblTimeWidth - ); - - BurgardKjaerOperator bko = new BurgardKjaerOperator ( - twru, - maco, - settings - ); - - SpreadIntensity si = new SpreadIntensity ( - dblZeroCouponBankBondDrift - dblZeroCouponCollateralBondDrift, - (dblZeroCouponBankBondDrift - dblZeroCouponCollateralBondDrift) / dblBankRecovery, - (dblZeroCouponCounterPartyBondDrift - dblZeroCouponCollateralBondDrift) / dblCounterPartyRecovery - ); - - double dblDerivativeValue = dblTerminalXVADerivativeValue; - double dblDerivativeXVAValue = dblTerminalXVADerivativeValue; - - EdgeAssetGreek erugInitial = new EdgeAssetGreek ( - dblDerivativeXVAValue, - -1., - 0., - dblDerivativeValue - ); - - double dblGainOnBankDefaultInitial = -1. * (dblDerivativeXVAValue - maco.bankDefault (dblDerivativeXVAValue)); - - double dblGainOnCounterPartyDefaultInitial = -1. * (dblDerivativeXVAValue - maco.counterPartyDefault (dblDerivativeXVAValue)); - - EdgeReplicationPortfolio erpInitial = new EdgeReplicationPortfolio ( - 1., - dblGainOnBankDefaultInitial, - dblGainOnCounterPartyDefaultInitial, - 0. - ); - - System.out.println(); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| BILATERAL XVA EVOLVER - BURGARD & KJAER (2011) REPLICATION PORTFOLIO EVOLUTION ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Time ||"); - - System.out.println ("\t|| - Derivative XVA Value ||"); - - System.out.println ("\t|| - Asset Price Realization ||"); - - System.out.println ("\t|| - Realization of the Zero Coupon Bank Bond Price ||"); - - System.out.println ("\t|| - Realization of the Zero Coupon Counter Party Bond Price ||"); - - System.out.println ("\t|| - Realization of the Zero Coupon Collateral Bond Price ||"); - - System.out.println ("\t|| - Derivative XVA Asset Replication Units ||"); - - System.out.println ("\t|| - Derivative XVA Value Bank Bond Replication Units ||"); - - System.out.println ("\t|| - Derivative XVA Value Counter Party Bond Replication Units ||"); - - System.out.println ("\t|| - Derivative XVA Value Cash Account Replication Units ||"); - - System.out.println ("\t|| - Derivative Cash Account Accumulation Component ||"); - - System.out.println ("\t|| - Asset Cash Account Accumulation Component ||"); - - System.out.println ("\t|| - Bank Cash Account Accumulation Component ||"); - - System.out.println ("\t|| - Counter Party Cash Account Accumulation Component ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t||" + - FormatUtil.FormatDouble (dblTime, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erugInitial.derivativeXVAValue(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (1., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (1., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (1., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (1., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpInitial.assetUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpInitial.bankBondUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpInitial.counterPartyBondUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpInitial.cashAccount(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " ||" - ); - - EdgeEvolutionTrajectory eet = new EdgeEvolutionTrajectory ( - dblTime, - new UniverseSnapshot ( - meAsset.weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - dblDerivativeValue, - 0., - false - ), - dblTimeWidth - ), - meZeroCouponCollateralBond.weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - 1., - 0., - false - ), - dblTimeWidth - ), - meZeroCouponBankBond.weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - 1., - 0., - false - ), - dblTimeWidth - ), - meZeroCouponCounterPartyBond.weinerIncrement ( - new JumpDiffusionVertex ( - dblTime, - 1., - 0., - false - ), - dblTimeWidth - ) - ), - new EdgeReplicationPortfolio ( - 1., - 0., - 0., - 0. - ), - erugInitial, - dblGainOnBankDefaultInitial, - dblGainOnCounterPartyDefaultInitial - ); - - for (dblTime -= dblTimeWidth; dblTime >= 0.; dblTime -= dblTimeWidth) - eet = RunStep ( - tes, - si, - bko, - eet - ); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/burgard2012/CounterPartyHazardHigh.java b/org/drip/sample/burgard2012/CounterPartyHazardHigh.java deleted file mode 100644 index 7aa77f0..0000000 --- a/org/drip/sample/burgard2012/CounterPartyHazardHigh.java +++ /dev/null @@ -1,165 +0,0 @@ - -package org.drip.sample.burgard2012; - -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CounterPartyHazardHigh estimates the CVA Relative to V for a Call Option bought by the Bank for different - * Close Outs and Funding Spreads using the Burgard and Kjaer (2011) Methodology for the Case where the - * Counter Party Hazard is High (5%). 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CounterPartyHazardHigh { - - private static final void CVA ( - final double dblT, - final double dblRB, - final double dblRC, - final double dblLambdaB, - final double dblLambdaC) - throws Exception - { - double dblMTM_XVA___Funding_0 = -1. * (1. - Math.exp (-1. * (1. - dblRC) * dblLambdaC * dblT)); - - double dblMTM_XVA___Funding_Bank = -1. * (1. - Math.exp (-1. * ((1. - dblRB) * dblLambdaB + (1. - dblRC) * dblLambdaC) * dblT)); - - double dblMTM_Fair__Funding_0 = -1. * (1. - dblRC) * dblLambdaC * - (1. - Math.exp (-1. * (dblLambdaB + dblLambdaC) * dblT)) / - (dblLambdaB + dblLambdaC); - - double dblMTM_Fair__Funding_Bank = -1. * ((1. - dblRB) * dblLambdaB + (1. - dblRC) * dblLambdaC) * - (1. - Math.exp (-1. * (dblLambdaB + dblLambdaC) * dblT)) / - (dblLambdaB + dblLambdaC); - - System.out.println ("\t|| " + - FormatUtil.FormatDouble (dblLambdaB , 1, 1, 100.) + "% => " + - FormatUtil.FormatDouble (dblMTM_XVA___Funding_0 , 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblMTM_XVA___Funding_Bank, 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblMTM_Fair__Funding_0 , 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblMTM_Fair__Funding_Bank, 2, 2, 100.) + "% ||" - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblLambdaC = 0.05; - - double dblRB = 0.4; - double dblRC = 0.4; - double dblT = 5.; - - double[] adblLambdaB = new double[] { - 0.00001, - 0.005, - 0.01, - 0.015, - 0.02, - 0.025, - 0.03, - 0.035, - 0.04, - 0.045, - 0.05 - }; - - System.out.println(); - - System.out.println ("\t||------------------------------------------------||"); - - System.out.println ("\t|| CVA UNDER HIGH COUNTER PARTY HAZARD ||"); - - System.out.println ("\t||------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Close Out => MTM XVA ||"); - - System.out.println ("\t|| - Funding Spread => None ||"); - - System.out.println ("\t|| - Close Out => MTM Fair Value ||"); - - System.out.println ("\t|| - Funding Spread => Bank ||"); - - System.out.println ("\t||------------------------------------------------||"); - - for (double dblLambdaB : adblLambdaB) - CVA ( - dblT, - dblRB, - dblRC, - dblLambdaB, - dblLambdaC - ); - - System.out.println ("\t||------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/burgard2012/CounterPartyHazardLow.java b/org/drip/sample/burgard2012/CounterPartyHazardLow.java deleted file mode 100644 index cdd3b92..0000000 --- a/org/drip/sample/burgard2012/CounterPartyHazardLow.java +++ /dev/null @@ -1,165 +0,0 @@ - -package org.drip.sample.burgard2012; - -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CounterPartyHazardLow estimates the CVA Relative to V for a Call Option bought by the Bank for different - * Close Outs and Funding Spreads using the Burgard and Kjaer (2011) Methodology for the Case where the - * Counter Party Hazard is Low (Zero). 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CounterPartyHazardLow { - - private static final void CVA ( - final double dblT, - final double dblRB, - final double dblRC, - final double dblLambdaB, - final double dblLambdaC) - throws Exception - { - double dblMTM_XVA___Funding_0 = -1. * (1. - Math.exp (-1. * (1. - dblRC) * dblLambdaC * dblT)); - - double dblMTM_XVA___Funding_Bank = -1. * (1. - Math.exp (-1. * ((1. - dblRB) * dblLambdaB + (1. - dblRC) * dblLambdaC) * dblT)); - - double dblMTM_Fair__Funding_0 = -1. * (1. - dblRC) * dblLambdaC * - (1. - Math.exp (-1. * (dblLambdaB + dblLambdaC) * dblT)) / - (dblLambdaB + dblLambdaC); - - double dblMTM_Fair__Funding_Bank = -1. * ((1. - dblRB) * dblLambdaB + (1. - dblRC) * dblLambdaC) * - (1. - Math.exp (-1. * (dblLambdaB + dblLambdaC) * dblT)) / - (dblLambdaB + dblLambdaC); - - System.out.println ("\t|| " + - FormatUtil.FormatDouble (dblLambdaB , 1, 1, 100.) + "% => " + - FormatUtil.FormatDouble (dblMTM_XVA___Funding_0 , 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblMTM_XVA___Funding_Bank, 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblMTM_Fair__Funding_0 , 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblMTM_Fair__Funding_Bank, 2, 2, 100.) + "% ||" - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblLambdaC = 0.00; - - double dblRB = 0.4; - double dblRC = 0.4; - double dblT = 5.; - - double[] adblLambdaB = new double[] { - 0.00001, - 0.005, - 0.01, - 0.015, - 0.02, - 0.025, - 0.03, - 0.035, - 0.04, - 0.045, - 0.05 - }; - - System.out.println(); - - System.out.println ("\t||--------------------------------------------------||"); - - System.out.println ("\t|| CVA UNDER LOW COUNTER PARTY HAZARD ||"); - - System.out.println ("\t||--------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Close Out => MTM XVA ||"); - - System.out.println ("\t|| - Funding Spread => None ||"); - - System.out.println ("\t|| - Close Out => MTM Fair Value ||"); - - System.out.println ("\t|| - Funding Spread => Bank ||"); - - System.out.println ("\t||--------------------------------------------------||"); - - for (double dblLambdaB : adblLambdaB) - CVA ( - dblT, - dblRB, - dblRC, - dblLambdaB, - dblLambdaC - ); - - System.out.println ("\t||--------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/burgard2012/CounterPartyHazardMedium.java b/org/drip/sample/burgard2012/CounterPartyHazardMedium.java deleted file mode 100644 index e147213..0000000 --- a/org/drip/sample/burgard2012/CounterPartyHazardMedium.java +++ /dev/null @@ -1,165 +0,0 @@ - -package org.drip.sample.burgard2012; - -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CounterPartyHazardMedium estimates the CVA Relative to V for a Call Option bought by the Bank for - * different Close Outs and Funding Spreads using the Burgard and Kjaer (2011) Methodology for the Case - * where the Counter Party Hazard is Medium (2.5%). 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CounterPartyHazardMedium { - - private static final void CVA ( - final double dblT, - final double dblRB, - final double dblRC, - final double dblLambdaB, - final double dblLambdaC) - throws Exception - { - double dblMTM_XVA___Funding_0 = -1. * (1. - Math.exp (-1. * (1. - dblRC) * dblLambdaC * dblT)); - - double dblMTM_XVA___Funding_Bank = -1. * (1. - Math.exp (-1. * ((1. - dblRB) * dblLambdaB + (1. - dblRC) * dblLambdaC) * dblT)); - - double dblMTM_Fair__Funding_0 = -1. * (1. - dblRC) * dblLambdaC * - (1. - Math.exp (-1. * (dblLambdaB + dblLambdaC) * dblT)) / - (dblLambdaB + dblLambdaC); - - double dblMTM_Fair__Funding_Bank = -1. * ((1. - dblRB) * dblLambdaB + (1. - dblRC) * dblLambdaC) * - (1. - Math.exp (-1. * (dblLambdaB + dblLambdaC) * dblT)) / - (dblLambdaB + dblLambdaC); - - System.out.println ("\t|| " + - FormatUtil.FormatDouble (dblLambdaB , 1, 1, 100.) + "% => " + - FormatUtil.FormatDouble (dblMTM_XVA___Funding_0 , 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblMTM_XVA___Funding_Bank, 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblMTM_Fair__Funding_0 , 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblMTM_Fair__Funding_Bank, 2, 2, 100.) + "% ||" - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblLambdaC = 0.025; - - double dblRB = 0.4; - double dblRC = 0.4; - double dblT = 5.; - - double[] adblLambdaB = new double[] { - 0.00001, - 0.005, - 0.01, - 0.015, - 0.02, - 0.025, - 0.03, - 0.035, - 0.04, - 0.045, - 0.05 - }; - - System.out.println(); - - System.out.println ("\t||------------------------------------------------||"); - - System.out.println ("\t|| CVA UNDER MEDIUM COUNTER PARTY HAZARD ||"); - - System.out.println ("\t||------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Close Out => MTM XVA ||"); - - System.out.println ("\t|| - Funding Spread => None ||"); - - System.out.println ("\t|| - Close Out => MTM Fair Value ||"); - - System.out.println ("\t|| - Funding Spread => Bank ||"); - - System.out.println ("\t||------------------------------------------------||"); - - for (double dblLambdaB : adblLambdaB) - CVA ( - dblT, - dblRB, - dblRC, - dblLambdaB, - dblLambdaC - ); - - System.out.println ("\t||------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/burgard2012/EulerTrajectoryEvolutionScheme.java b/org/drip/sample/burgard2012/EulerTrajectoryEvolutionScheme.java deleted file mode 100644 index 0139d18..0000000 --- a/org/drip/sample/burgard2012/EulerTrajectoryEvolutionScheme.java +++ /dev/null @@ -1,418 +0,0 @@ - -package org.drip.sample.burgard2012; - -import org.drip.measure.discretemarginal.SequenceGenerator; -import org.drip.measure.dynamics.*; -import org.drip.measure.process.*; -import org.drip.measure.realization.*; -import org.drip.quant.common.FormatUtil; -import org.drip.quant.linearalgebra.Matrix; -import org.drip.service.env.EnvManager; -import org.drip.xva.definition.*; -import org.drip.xva.derivative.*; -import org.drip.xva.pde.*; -import org.drip.xva.settings.PDEEvolutionControl; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * EulerTrajectoryEvolutionScheme computes the Sequence of XVA Paths arising out of the Joint Evolution of - * Numeraires - the Continuous Asset, the Collateral, the Bank, and the Counter-Party Numeraires involved in - * the Dynamic XVA Replication Portfolio of the Burgard and Kjaer (2011) Methodology. 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class EulerTrajectoryEvolutionScheme { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblTimeWidth = 1. / 24.; - double dblTime = 1.; - double[][] aadblCorrelation = new double[][] { - {1.00, 0.20, 0.15, 0.05}, // #0 ASSET - {0.20, 1.00, 0.13, 0.25}, // #1 COLLATERAL - {0.15, 0.13, 1.00, 0.00}, // #2 BANK - {0.05, 0.25, 0.00, 1.00} // #3 COUNTER PARTY - }; - double dblAssetDrift = 0.06; - double dblAssetVolatility = 0.15; - double dblAssetRepo = 0.03; - double dblAssetDividend = 0.02; - double dblInitialAssetNumeraire = 1.; - - double dblZeroCouponCollateralBondDrift = 0.01; - double dblZeroCouponCollateralBondVolatility = 0.05; - double dblZeroCouponCollateralBondRepo = 0.005; - double dblInitialCollateralNumeraire = 1.; - - double dblZeroCouponBankBondDrift = 0.03; - double dblZeroCouponBankBondVolatility = 0.10; - double dblZeroCouponBankBondRepo = 0.028; - double dblBankHazardRate = 0.03; - double dblBankRecoveryRate = 0.45; - double dblInitialBankNumeraire = 1.; - - double dblZeroCouponCounterPartyBondDrift = 0.03; - double dblZeroCouponCounterPartyBondVolatility = 0.10; - double dblZeroCouponCounterPartyBondRepo = 0.028; - double dblCounterPartyHazardRate = 0.05; - double dblCounterPartyRecoveryRate = 0.30; - double dblInitialCounterPartyNumeraire = 1.; - - double dblTerminalXVADerivativeValue = 1.; - - double dblSensitivityShiftFactor = 0.001; - - int iNumTimeStep = (int) (1. / dblTimeWidth); - double dblDerivativeValue = dblTerminalXVADerivativeValue; - double dblDerivativeXVAValue = dblTerminalXVADerivativeValue; - UniverseSnapshot[] aUS = new UniverseSnapshot[iNumTimeStep]; - - PDEEvolutionControl settings = new PDEEvolutionControl ( - PDEEvolutionControl.CLOSEOUT_GREGORY_LI_TANG, - dblSensitivityShiftFactor - ); - - MasterAgreementCloseOut maco = new MasterAgreementCloseOut ( - dblBankRecoveryRate, - dblCounterPartyRecoveryRate - ); - - DiffusionEvolver deAsset = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblAssetDrift, - dblAssetVolatility - ) - ); - - DiffusionEvolver deZeroCouponCollateralBond = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponCollateralBondDrift, - dblZeroCouponCollateralBondVolatility - ) - ); - - DiffusionEvolver deZeroCouponBankBond = new JumpDiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponBankBondDrift, - dblZeroCouponBankBondVolatility - ), - HazardJumpEvaluator.Standard ( - dblBankHazardRate, - dblBankRecoveryRate - ) - ); - - DiffusionEvolver deZeroCouponCounterPartyBond = new JumpDiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponCounterPartyBondDrift, - dblZeroCouponCounterPartyBondVolatility - ), - HazardJumpEvaluator.Standard ( - dblCounterPartyHazardRate, - dblCounterPartyRecoveryRate - ) - ); - - TwoWayRiskyUniverse twru = new TwoWayRiskyUniverse ( - new Equity ( - deAsset, - dblAssetRepo, - dblAssetDividend - ), - new Tradeable ( - deZeroCouponCollateralBond, - dblZeroCouponCollateralBondRepo - ), - new Tradeable ( - deZeroCouponBankBond, - dblZeroCouponBankBondRepo - ), - new Tradeable ( - deZeroCouponCounterPartyBond, - dblZeroCouponCounterPartyBondRepo - ) - ); - - TrajectoryEvolutionScheme tes = new TrajectoryEvolutionScheme ( - twru, - maco, - settings, - dblTimeWidth - ); - - BurgardKjaerOperator bko = new BurgardKjaerOperator ( - twru, - maco, - settings - ); - - SpreadIntensity si = new SpreadIntensity ( - dblZeroCouponBankBondDrift - dblZeroCouponCollateralBondDrift, - (dblZeroCouponBankBondDrift - dblZeroCouponCollateralBondDrift) / dblBankRecoveryRate, - (dblZeroCouponCounterPartyBondDrift - dblZeroCouponCollateralBondDrift) / dblCounterPartyRecoveryRate - ); - - double[][] aadblNumeraireTimeSeries = Matrix.Transpose ( - SequenceGenerator.GaussianJoint ( - iNumTimeStep, - aadblCorrelation - ) - ); - - double[] adblBankDefaultIndicator = SequenceGenerator.Uniform (iNumTimeStep); - - double[] adblCounterPartyDefaultIndicator = SequenceGenerator.Uniform (iNumTimeStep); - - JumpDiffusionEdge[] aJDEAsset = deAsset.incrementSequence ( - new JumpDiffusionVertex ( - 0., - dblInitialAssetNumeraire, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraireTimeSeries[0]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDECollateral = deZeroCouponCollateralBond.incrementSequence ( - new JumpDiffusionVertex ( - 0., - dblInitialCollateralNumeraire, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraireTimeSeries[1]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDEBank = deZeroCouponBankBond.incrementSequence ( - new JumpDiffusionVertex ( - 0., - dblInitialBankNumeraire, - 0., - false - ), - UnitRandom.JumpDiffusion ( - aadblNumeraireTimeSeries[2], - adblBankDefaultIndicator - ), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDECounterParty = deZeroCouponCounterPartyBond.incrementSequence ( - new JumpDiffusionVertex ( - 0., - dblInitialCounterPartyNumeraire, - 0., - false - ), - UnitRandom.JumpDiffusion ( - aadblNumeraireTimeSeries[3], - adblCounterPartyDefaultIndicator - ), - dblTimeWidth - ); - - EdgeAssetGreek eagInitial = new EdgeAssetGreek ( - dblDerivativeXVAValue, - -1., - 0., - dblDerivativeValue - ); - - double dblGainOnBankDefaultInitial = -1. * (dblDerivativeXVAValue - maco.bankDefault (dblDerivativeXVAValue)); - - double dblGainOnCounterPartyDefaultInitial = -1. * (dblDerivativeXVAValue - maco.counterPartyDefault (dblDerivativeXVAValue)); - - EdgeReplicationPortfolio erpInitial = new EdgeReplicationPortfolio ( - 1., - dblGainOnBankDefaultInitial, - dblGainOnCounterPartyDefaultInitial, - 0. - ); - - System.out.println(); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| BILATERAL XVA EVOLVER - BURGARD & KJAER (2011) REPLICATION PORTFOLIO EVOLUTION ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Time ||"); - - System.out.println ("\t|| - Derivative XVA Value ||"); - - System.out.println ("\t|| - Asset Price Realization ||"); - - System.out.println ("\t|| - Realization of the Zero Coupon Bank Bond Price ||"); - - System.out.println ("\t|| - Realization of the Zero Coupon Counter Party Bond Price ||"); - - System.out.println ("\t|| - Realization of the Zero Coupon Collateral Bond Price ||"); - - System.out.println ("\t|| - Derivative XVA Asset Replication Units ||"); - - System.out.println ("\t|| - Derivative XVA Value Bank Bond Replication Units ||"); - - System.out.println ("\t|| - Derivative XVA Value Counter Party Bond Replication Units ||"); - - System.out.println ("\t|| - Derivative XVA Value Cash Account Replication Units ||"); - - System.out.println ("\t|| - Derivative Cash Account Accumulation Component ||"); - - System.out.println ("\t|| - Asset Cash Account Accumulation Component ||"); - - System.out.println ("\t|| - Bank Cash Account Accumulation Component ||"); - - System.out.println ("\t|| - Counter Party Cash Account Accumulation Component ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t||" + - FormatUtil.FormatDouble (dblTime, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (eagInitial.derivativeXVAValue(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aJDEAsset[iNumTimeStep - 1].finish(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aJDEBank[iNumTimeStep - 1].finish(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aJDECounterParty[iNumTimeStep - 1].finish(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aJDECollateral[iNumTimeStep - 1].finish(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpInitial.assetUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpInitial.bankBondUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpInitial.counterPartyBondUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (erpInitial.cashAccount(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (0., 1, 6, 1.) + " ||" - ); - - EdgeEvolutionTrajectory eet = new EdgeEvolutionTrajectory ( - dblTime, - new UniverseSnapshot ( - aJDEAsset[iNumTimeStep - 1], - aJDECollateral[iNumTimeStep - 1], - aJDEBank[iNumTimeStep - 1], - aJDECounterParty[iNumTimeStep - 1] - ), - new EdgeReplicationPortfolio ( - 1., - 0., - 0., - 0. - ), - eagInitial, - dblGainOnBankDefaultInitial, - dblGainOnCounterPartyDefaultInitial - ); - - for (int i = 0; i < iNumTimeStep; ++i) - aUS[i] = new UniverseSnapshot ( - aJDEAsset[i], - aJDECollateral[i], - aJDEBank[i], - aJDECounterParty[i] - ); - - LevelEvolutionTrajectory[] aLET = tes.eulerWalk ( - si, - aUS, - bko, - eet - ); - - for (int i = iNumTimeStep - 2; i >= 0; --i) { - eet = aLET[i].edgeFinish(); - - LevelCashAccount lca = aLET[i].cashAccount(); - - System.out.println ("\t||" + - FormatUtil.FormatDouble (eet.time(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (eet.edgeAssetGreek().derivativeXVAValue(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aUS[i].assetNumeraire().finish(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aUS[i].zeroCouponBankBondNumeraire().finish(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aUS[i].zeroCouponCounterPartyBondNumeraire().finish(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aUS[i].zeroCouponCollateralBondNumeraire().finish(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (eet.replicationPortfolio().assetUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (eet.replicationPortfolio().bankBondUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (eet.replicationPortfolio().counterPartyBondUnits(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (eet.replicationPortfolio().cashAccount(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lca.accumulation(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lca.assetAccumulation(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lca.bankAccumulation(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (lca.counterPartyAccumulation(), 1, 6, 1.) + " ||" - ); - } - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - - System.out.println (aLET); - } -} diff --git a/org/drip/sample/burgard2012/FixFloatVABank.java b/org/drip/sample/burgard2012/FixFloatVABank.java deleted file mode 100644 index 8192b89..0000000 --- a/org/drip/sample/burgard2012/FixFloatVABank.java +++ /dev/null @@ -1,247 +0,0 @@ - -package org.drip.sample.burgard2012; - -import org.drip.analytics.date.*; -import org.drip.measure.discretemarginal.SequenceGenerator; -import org.drip.measure.dynamics.DiffusionEvaluatorLinear; -import org.drip.measure.process.DiffusionEvolver; -import org.drip.measure.realization.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.xva.trajectory.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * FixFloatVABank illustrates the Fix-Float Swap Valuation Adjustment Metrics Dependence on the Bank Spread - * using the Set of Netting Group Exposure Simulations. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixFloatVABank { - - private static final JumpDiffusionEdge[][] ATMSwapRateOffsetRealization ( - final DiffusionEvolver deATMSwapRateOffset, - final double dblATMSwapRateOffsetInitial, - final double dblTime, - final double dblTimeWidth, - final int iNumStep, - final int iNumSimulation) - throws Exception - { - JumpDiffusionEdge[][] aaJDEATMSwapRateOffset = new JumpDiffusionEdge[iNumSimulation][]; - - for (int i = 0; i < iNumSimulation; ++i) - aaJDEATMSwapRateOffset[i] = deATMSwapRateOffset.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblATMSwapRateOffsetInitial, - 0., - false - ), - UnitRandom.Diffusion (SequenceGenerator.Gaussian (iNumStep)), - dblTimeWidth - ); - - return aaJDEATMSwapRateOffset; - } - - public static final void VA ( - final double dblBankHazardRate) - throws Exception - { - int iNumStep = 10; - double dblTime = 5.; - int iNumSimulation = 10000; - double dblATMSwapRateOffsetDrift = 0.0; - double dblATMSwapRateOffsetVolatility = 0.15; - double dblATMSwapRateOffsetInitial = 0.; - double dblCollateralDrift = 0.01; - double dblBankRecoveryRate = 0.40; - double dblCounterPartyHazardRate = 0.015; - double dblCounterPartyRecoveryRate = 0.30; - - double dblTimeWidth = dblTime / iNumStep; - double[] adblCollateral = new double[iNumStep]; - double[] adblBankSurvival = new double[iNumStep]; - double[] adblBankRecovery = new double[iNumStep]; - JulianDate[] adtVertex = new JulianDate[iNumStep]; - double[] adblBankFundingSpread = new double[iNumStep]; - double[] adblCounterPartySurvival = new double[iNumStep]; - double[] adblCounterPartyRecovery = new double[iNumStep]; - CollateralGroupPath[] aCGP = new CollateralGroupPath[iNumSimulation]; - double dblBankFundingSpread = dblBankHazardRate / (1. - dblBankRecoveryRate); - CollateralGroupVertex[][] aaCGV = new CollateralGroupVertex[iNumSimulation][iNumStep]; - - JulianDate dtSpot = DateUtil.Today(); - - JumpDiffusionEdge[][] aaJDEATMSwapRateOffset = ATMSwapRateOffsetRealization ( - new DiffusionEvolver ( - DiffusionEvaluatorLinear.Standard ( - dblATMSwapRateOffsetDrift, - dblATMSwapRateOffsetVolatility - ) - ), - dblATMSwapRateOffsetInitial, - dblTime, - dblTimeWidth, - iNumStep, - iNumSimulation - ); - - for (int i = 0; i < iNumStep; ++i) { - adblBankRecovery[i] = dblBankRecoveryRate; - adblBankFundingSpread[i] = dblBankFundingSpread; - adblCounterPartyRecovery[i] = dblCounterPartyRecoveryRate; - - adtVertex[i] = dtSpot.addMonths (6 * i + 6); - - adblCollateral[i] = Math.exp (0.5 * dblCollateralDrift * (i + 1)); - - adblBankSurvival[i] = Math.exp (-0.5 * dblBankHazardRate * (i + 1)); - - adblCounterPartySurvival[i] = Math.exp (-0.5 * dblCounterPartyHazardRate * (i + 1)); - } - - for (int i = 0; i < iNumStep; ++i) { - for (int j = 0; j < iNumSimulation; ++j) - aaCGV[j][i] = new CollateralGroupVertex ( - adtVertex[i], - new CollateralGroupVertexExposure ( - aaJDEATMSwapRateOffset[j][i].finish() * dblTimeWidth * (iNumStep - i), - 0., - 0. - ), - new CollateralGroupVertexNumeraire ( - adblCollateral[i], - adblBankSurvival[i], - adblBankRecovery[i], - adblBankFundingSpread[i], - adblCounterPartySurvival[i], - adblCounterPartyRecovery[i] - ) - ); - } - - for (int j = 0; j < iNumSimulation; ++j) { - CollateralGroupEdge[] aCGE = new CollateralGroupEdge[iNumStep - 1]; - - for (int i = 1; i < iNumStep; ++i) - aCGE[i - 1] = new CollateralGroupEdge ( - aaCGV[j][i - 1], - aaCGV[j][i] - ); - - aCGP[j] = new CollateralGroupPath (aCGE); - } - - NettingGroupPathAggregator ngpa = NettingGroupPathAggregator.Standard (aCGP); - - System.out.println ("\t|| " + - FormatUtil.FormatDouble (dblBankHazardRate, 3, 0, 10000.) + " bp => " + - FormatUtil.FormatDouble (ngpa.cva(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (ngpa.dva(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (ngpa.fca(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (ngpa.total(), 1, 2, 100.) + "% ||" - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double[] adblBankHazardRate = new double[] { - 0.0025, - 0.0050, - 0.0075, - 0.0100, - 0.0125, - 0.0150, - 0.0175, - 0.0200, - 0.0225, - 0.0250, - 0.0275, - 0.0300 - }; - - System.out.println(); - - System.out.println ("\t||----------------------------------------------||"); - - System.out.println ("\t|| VA DEPENDENCE ON BANK HAZARD RATE ||"); - - System.out.println ("\t||----------------------------------------------||"); - - System.out.println ("\t|| Hazard => CVA | DVA | FCA | Total ||"); - - System.out.println ("\t||----------------------------------------------||"); - - for (double dblBankHazardRate : adblBankHazardRate) - VA (dblBankHazardRate); - - System.out.println ("\t||----------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/burgard2012/FixFloatVACounterParty.java b/org/drip/sample/burgard2012/FixFloatVACounterParty.java deleted file mode 100644 index a0523ad..0000000 --- a/org/drip/sample/burgard2012/FixFloatVACounterParty.java +++ /dev/null @@ -1,247 +0,0 @@ - -package org.drip.sample.burgard2012; - -import org.drip.analytics.date.*; -import org.drip.measure.discretemarginal.SequenceGenerator; -import org.drip.measure.dynamics.DiffusionEvaluatorLinear; -import org.drip.measure.process.DiffusionEvolver; -import org.drip.measure.realization.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.xva.trajectory.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * FixFloatVACounterParty illustrates the Fix-Float Swap Valuation Adjustment Metrics Dependence on the - * Counter Party Spread using the Set of Netting Group Exposure Simulations. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixFloatVACounterParty { - - private static final JumpDiffusionEdge[][] ATMSwapRateOffsetRealization ( - final DiffusionEvolver deATMSwapRateOffset, - final double dblATMSwapRateOffsetInitial, - final double dblTime, - final double dblTimeWidth, - final int iNumStep, - final int iNumSimulation) - throws Exception - { - JumpDiffusionEdge[][] aaJDEATMSwapRateOffset = new JumpDiffusionEdge[iNumSimulation][]; - - for (int i = 0; i < iNumSimulation; ++i) - aaJDEATMSwapRateOffset[i] = deATMSwapRateOffset.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblATMSwapRateOffsetInitial, - 0., - false - ), - UnitRandom.Diffusion (SequenceGenerator.Gaussian (iNumStep)), - dblTimeWidth - ); - - return aaJDEATMSwapRateOffset; - } - - public static final void VA ( - final double dblCounterPartyHazardRate) - throws Exception - { - int iNumStep = 10; - double dblTime = 5.; - int iNumSimulation = 10000; - double dblATMSwapRateOffsetDrift = 0.0; - double dblATMSwapRateOffsetVolatility = 0.15; - double dblATMSwapRateOffsetInitial = 0.; - double dblCollateralDrift = 0.01; - double dblBankHazardRate = 0.015; - double dblBankRecoveryRate = 0.40; - double dblCounterPartyRecoveryRate = 0.30; - - double dblTimeWidth = dblTime / iNumStep; - double[] adblCollateral = new double[iNumStep]; - double[] adblBankSurvival = new double[iNumStep]; - double[] adblBankRecovery = new double[iNumStep]; - JulianDate[] adtVertex = new JulianDate[iNumStep]; - double[] adblBankFundingSpread = new double[iNumStep]; - double[] adblCounterPartySurvival = new double[iNumStep]; - double[] adblCounterPartyRecovery = new double[iNumStep]; - CollateralGroupPath[] aCGP = new CollateralGroupPath[iNumSimulation]; - double dblBankFundingSpread = dblBankHazardRate / (1. - dblBankRecoveryRate); - CollateralGroupVertex[][] aaCGV = new CollateralGroupVertex[iNumSimulation][iNumStep]; - - JulianDate dtSpot = DateUtil.Today(); - - JumpDiffusionEdge[][] aaJDEATMSwapRateOffset = ATMSwapRateOffsetRealization ( - new DiffusionEvolver ( - DiffusionEvaluatorLinear.Standard ( - dblATMSwapRateOffsetDrift, - dblATMSwapRateOffsetVolatility - ) - ), - dblATMSwapRateOffsetInitial, - dblTime, - dblTimeWidth, - iNumStep, - iNumSimulation - ); - - for (int i = 0; i < iNumStep; ++i) { - adblBankRecovery[i] = dblBankRecoveryRate; - adblBankFundingSpread[i] = dblBankFundingSpread; - adblCounterPartyRecovery[i] = dblCounterPartyRecoveryRate; - - adtVertex[i] = dtSpot.addMonths (6 * i + 6); - - adblCollateral[i] = Math.exp (0.5 * dblCollateralDrift * (i + 1)); - - adblBankSurvival[i] = Math.exp (-0.5 * dblBankHazardRate * (i + 1)); - - adblCounterPartySurvival[i] = Math.exp (-0.5 * dblCounterPartyHazardRate * (i + 1)); - } - - for (int i = 0; i < iNumStep; ++i) { - for (int j = 0; j < iNumSimulation; ++j) - aaCGV[j][i] = new CollateralGroupVertex ( - adtVertex[i], - new CollateralGroupVertexExposure ( - aaJDEATMSwapRateOffset[j][i].finish(), - 0., - 0. - ), - new CollateralGroupVertexNumeraire ( - adblCollateral[i], - adblBankSurvival[i], - adblBankRecovery[i], - adblBankFundingSpread[i], - adblCounterPartySurvival[i], - adblCounterPartyRecovery[i] - ) - ); - } - - for (int j = 0; j < iNumSimulation; ++j) { - CollateralGroupEdge[] aCGE = new CollateralGroupEdge[iNumStep - 1]; - - for (int i = 1; i < iNumStep; ++i) - aCGE[i - 1] = new CollateralGroupEdge ( - aaCGV[j][i - 1], - aaCGV[j][i] - ); - - aCGP[j] = new CollateralGroupPath (aCGE); - } - - NettingGroupPathAggregator ngpa = NettingGroupPathAggregator.Standard (aCGP); - - System.out.println ("\t|| " + - FormatUtil.FormatDouble (dblCounterPartyHazardRate, 3, 0, 10000.) + " bp => " + - FormatUtil.FormatDouble (ngpa.cva(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (ngpa.dva(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (ngpa.fca(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (ngpa.total(), 1, 2, 100.) + "% ||" - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double[] adblCounterPartyHazardRate = new double[] { - 0.0025, - 0.0050, - 0.0075, - 0.0100, - 0.0125, - 0.0150, - 0.0175, - 0.0200, - 0.0225, - 0.0250, - 0.0275, - 0.0300 - }; - - System.out.println(); - - System.out.println ("\t||----------------------------------------------||"); - - System.out.println ("\t|| VA DEPENDENCE ON COUNTER PARTY HAZARD ||"); - - System.out.println ("\t||----------------------------------------------||"); - - System.out.println ("\t|| Hazard => CVA | DVA | FCA | Total ||"); - - System.out.println ("\t||----------------------------------------------||"); - - for (double dblCounterPartyHazardRate : adblCounterPartyHazardRate) - VA (dblCounterPartyHazardRate); - - System.out.println ("\t||----------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/capfloor/FRAStdCapFloor.java b/org/drip/sample/capfloor/FRAStdCapFloor.java deleted file mode 100644 index 1b1e3a1..0000000 --- a/org/drip/sample/capfloor/FRAStdCapFloor.java +++ /dev/null @@ -1,804 +0,0 @@ - -package org.drip.sample.capfloor; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.pricer.option.BlackScholesAlgorithm; -import org.drip.product.creator.*; -import org.drip.product.definition.*; -import org.drip.product.fra.FRAStandardCapFloor; -import org.drip.product.params.LastTradingDateSetting; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FRAStdCapFloor demonstrates the creation, invocation, usage, and valuation of the FRA Cap/Floor. - * - * @author Lakshmi Krishnamurthy - */ - -public class FRAStdCapFloor { - - private static final FixFloatComponent OTCFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final FloatFloatComponent OTCFloatFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strDerivedTenor, - final String strMaturityTenor, - final double dblBasis) - { - FloatFloatSwapConvention ffConv = IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - return ffConv.createFloatFloatComponent ( - dtSpot, - strDerivedTenor, - strMaturityTenor, - dblBasis, - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFuture, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFuture]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFuture, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFuture; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate" - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate", // 30Y - "SwapRate", // 40Y - "SwapRate" // 50Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - } - - /* - * Construct an array of float-float swaps from the corresponding reference (6M) and the derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FloatFloatComponent[] MakexM6MBasisSwap ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final int iTenorInMonths) - throws Exception - { - FloatFloatComponent[] aFFC = new FloatFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aFFC[i] = OTCFloatFloat ( - dtSpot, - strCurrency, - iTenorInMonths + "M", - astrMaturityTenor[i], - 0. - ); - - return aFFC; - } - - private static final ForwardCurve MakeFC ( - final JulianDate dtSpot, - final String strCurrency, - final MergedDiscountForwardCurve dc, - final int iTenorInMonths, - final String[] astrxM6MFwdTenor, - final double[] adblxM6MBasisSwapQuote) - throws Exception - { - /* - * Construct the 6M-xM float-float basis swap. - */ - - FloatFloatComponent[] aFFC = MakexM6MBasisSwap ( - dtSpot, - strCurrency, - astrxM6MFwdTenor, - iTenorInMonths - ); - - String strBasisTenor = iTenorInMonths + "M"; - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Calculate the starting forward rate off of the discount curve. - */ - - double dblStartingFwd = dc.forward ( - dtSpot.julian(), - dtSpot.addTenor (strBasisTenor).julian() - ); - - /* - * Set the discount curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Construct the shape preserving forward curve off of Quartic Polynomial Basis Spline. - */ - - return ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - "QUARTIC_FWD" + strBasisTenor, - ForwardLabel.Create ( - strCurrency, - strBasisTenor - ), - valParams, - null, - mktParams, - null, - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (5), - aFFC, - "DerivedParBasisSpread", - adblxM6MBasisSwapQuote, - dblStartingFwd - ); - } - - private static final Map MakeFC ( - final JulianDate dt, - final String strCurrency, - final MergedDiscountForwardCurve dc) - throws Exception - { - Map mapFC = new HashMap(); - - /* - * Build and run the sampling for the 1M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc1M = MakeFC ( - dt, - strCurrency, - dc, - 1, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00551, // 1Y - 0.00387, // 2Y - 0.00298, // 3Y - 0.00247, // 4Y - 0.00211, // 5Y - 0.00185, // 6Y - 0.00165, // 7Y - 0.00150, // 8Y - 0.00137, // 9Y - 0.00127, // 10Y - 0.00119, // 11Y - 0.00112, // 12Y - 0.00096, // 15Y - 0.00079, // 20Y - 0.00069, // 25Y - 0.00062 // 30Y - } - ); - - mapFC.put ( - "1M", - fc1M - ); - - /* - * Build and run the sampling for the 3M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc3M = MakeFC ( - dt, - strCurrency, - dc, - 3, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00186, // 1Y - 0.00127, // 2Y - 0.00097, // 3Y - 0.00080, // 4Y - 0.00067, // 5Y - 0.00058, // 6Y - 0.00051, // 7Y - 0.00046, // 8Y - 0.00042, // 9Y - 0.00038, // 10Y - 0.00035, // 11Y - 0.00033, // 12Y - 0.00028, // 15Y - 0.00022, // 20Y - 0.00020, // 25Y - 0.00018 // 30Y - } - ); - - mapFC.put ( - "3M", - fc3M - ); - - /* - * Build and run the sampling for the 12M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc12M = MakeFC ( - dt, - strCurrency, - dc, - 12, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", - "35Y", "40Y" // Extrapolated - }, - new double[] { - -0.00212, // 1Y - -0.00152, // 2Y - -0.00117, // 3Y - -0.00097, // 4Y - -0.00082, // 5Y - -0.00072, // 6Y - -0.00063, // 7Y - -0.00057, // 8Y - -0.00051, // 9Y - -0.00047, // 10Y - -0.00044, // 11Y - -0.00041, // 12Y - -0.00035, // 15Y - -0.00028, // 20Y - -0.00025, // 25Y - -0.00022, // 30Y - -0.00022, // 35Y Extrapolated - -0.00022, // 40Y Extrapolated - } - ); - - mapFC.put ( - "12M", - fc12M - ); - - return mapFC; - } - - private static final void SetVolCorrelation ( - final int iValueDate, - final CurveSurfaceQuoteContainer mktParams, - final ForwardLabel fri, - final double dblForwardVol, - final double dblFundingVol, - final double dblForwardFundingCorr) - throws Exception - { - FundingLabel fundingLabel = FundingLabel.Standard (fri.currency()); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (fri), - fri.currency(), - dblForwardVol - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (fundingLabel), - fri.currency(), - dblFundingVol - ) - ); - - mktParams.setForwardFundingCorrelation ( - fri, - fundingLabel, - new FlatUnivariate (dblForwardFundingCorr) - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - double dblStrike = 0.02; - String strFRATenor = "3M"; - String strCurrency = "USD"; - String strMaturityTenor = "4Y"; - String strManifestMeasure = "ParForward"; - - JulianDate dtToday = DateUtil.Today().addTenorAndAdjust ( - "0D", - strCurrency - ); - - /* - * Construct the Discount Curve using its instruments and quotes - */ - - MergedDiscountForwardCurve dc = MakeDC ( - dtToday, - strCurrency - ); - - Map mapFC = MakeFC ( - dtToday, - strCurrency, - dc - ); - - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strFRATenor - ); - - JulianDate dtEffective = dtToday.addTenor (strFRATenor); - - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - strFRATenor, - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - fri, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - strFRATenor, - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - Stream floatStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.RegularEdgeDates ( - dtEffective.julian(), - strFRATenor, - strMaturityTenor, - null - ), - cps, - cfus - ) - ); - - FRAStandardCapFloor fraCap = new FRAStandardCapFloor ( - "FRA_CAP", - floatStream, - strManifestMeasure, - true, - dblStrike, - new LastTradingDateSetting ( - LastTradingDateSetting.MID_CURVE_OPTION_QUARTERLY, - "", - Integer.MIN_VALUE - ), - null, - new BlackScholesAlgorithm() - ); - - FRAStandardCapFloor fraFloor = new FRAStandardCapFloor ( - "FRA_FLOOR", - floatStream, - strManifestMeasure, - false, - dblStrike, - new LastTradingDateSetting ( - LastTradingDateSetting.MID_CURVE_OPTION_QUARTERLY, - "", - Integer.MIN_VALUE - ), - null, - new BlackScholesAlgorithm() - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - mapFC.get (strFRATenor), - null, - null, - null, - null, - null, - null - ); - - double dblForwardVol = 0.50; - double dblFundingVol = 0.50; - double dblForwardFundingCorr = 0.50; - - SetVolCorrelation ( - dtToday.julian(), - mktParams, - fri, - dblForwardVol, - dblFundingVol, - dblForwardFundingCorr - ); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - strCurrency - ); - - System.out.println ("\n\n\t-------------------------------------------------------------"); - - double dblCapATMPrice = fraCap.atmPriceFromVolatility ( - valParams, - null, - mktParams, - null, - dblForwardVol - ); - - System.out.println ( - "\tCap ATM Price : " + - FormatUtil.FormatDouble (dblCapATMPrice, 1, 2, 100.) + "%" - ); - - double dblFloorATMPrice = fraFloor.atmPriceFromVolatility ( - valParams, - null, - mktParams, - null, - dblForwardVol - ); - - System.out.println ( - "\tFloor ATM Price : " + - FormatUtil.FormatDouble (dblFloorATMPrice, 1, 2, 100.) + "%" - ); - - System.out.println ("\t-------------------------------------------------------------"); - - Map mapFRACapOutput = fraCap.value ( - valParams, - null, - mktParams, - null - ); - - for (Map.Entry me : mapFRACapOutput.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - - System.out.println ("\t-------------------------------------------------------------"); - - System.out.println ("\t-------------------------------------------------------------"); - - Map mapFRAFloorOutput = fraFloor.value ( - valParams, - null, - mktParams, - null - ); - - for (Map.Entry me : mapFRAFloorOutput.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - - System.out.println ("\t-------------------------------------------------------------"); - - System.out.println ("\t-------------------------------------------------------------"); - - System.out.println ( - "\tPrice Implied Cap Volatility : " + - FormatUtil.FormatDouble (fraCap.flatVolatilityFromPrice ( - valParams, - null, - mktParams, - null, - mapFRACapOutput.get ("Price") - ), 1, 2, 100.) + "%" - ); - - System.out.println ( - "\tPrice Implied ATM Cap Volatility : " + - FormatUtil.FormatDouble (fraCap.volatilityFromATMPrice ( - valParams, - null, - mktParams, - null, - dblCapATMPrice - ), 1, 2, 100.) + "%" - ); - - System.out.println ( - "\tPrice Implied FRA Floor Volatility : " + - FormatUtil.FormatDouble (fraFloor.flatVolatilityFromPrice ( - valParams, - null, - mktParams, - null, - mapFRAFloorOutput.get ("Price") - ), 1, 2, 100.) + "%" - ); - - System.out.println ( - "\tPrice Implied ATM Floor Volatility : " + - FormatUtil.FormatDouble (fraFloor.volatilityFromATMPrice ( - valParams, - null, - mktParams, - null, - dblFloorATMPrice - ), 1, 2, 100.) + "%" - ); - } -} diff --git a/org/drip/sample/capfloor/FRAStdCapFloorAnalysis.java b/org/drip/sample/capfloor/FRAStdCapFloorAnalysis.java deleted file mode 100644 index 6df8c82..0000000 --- a/org/drip/sample/capfloor/FRAStdCapFloorAnalysis.java +++ /dev/null @@ -1,747 +0,0 @@ - -package org.drip.sample.capfloor; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.pricer.option.BlackScholesAlgorithm; -import org.drip.product.creator.*; -import org.drip.product.definition.*; -import org.drip.product.fra.FRAStandardCapFloor; -import org.drip.product.params.LastTradingDateSetting; -import org.drip.product.rates.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FRAStdCapFloorAnalysis contains an analysis if the correlation and volatility impact on a Cap/Floor of - * the standard FRA. - * - * @author Lakshmi Krishnamurthy - */ - -public class FRAStdCapFloorAnalysis { - - private static final FixFloatComponent OTCFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final FloatFloatComponent OTCFloatFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strDerivedTenor, - final String strMaturityTenor, - final double dblBasis) - { - FloatFloatSwapConvention ffConv = IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - return ffConv.createFloatFloatComponent ( - dtSpot, - strDerivedTenor, - strMaturityTenor, - dblBasis, - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFuture, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFuture]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFuture, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFuture; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate" - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate", // 30Y - "SwapRate", // 40Y - "SwapRate" // 50Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - "USD" - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - } - - /* - * Construct an array of float-float swaps from the corresponding reference (6M) and the derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FloatFloatComponent[] MakexM6MBasisSwap ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final int iTenorInMonths) - throws Exception - { - FloatFloatComponent[] aFFC = new FloatFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aFFC[i] = OTCFloatFloat ( - dtSpot, - strCurrency, - iTenorInMonths + "M", - astrMaturityTenor[i], - 0. - ); - - return aFFC; - } - - private static final ForwardCurve MakeFC ( - final JulianDate dtSpot, - final String strCurrency, - final MergedDiscountForwardCurve dc, - final int iTenorInMonths, - final String[] astrxM6MFwdTenor, - final double[] adblxM6MBasisSwapQuote) - throws Exception - { - /* - * Construct the 6M-xM float-float basis swap. - */ - - FloatFloatComponent[] aFFC = MakexM6MBasisSwap ( - dtSpot, - strCurrency, - astrxM6MFwdTenor, - iTenorInMonths - ); - - String strBasisTenor = iTenorInMonths + "M"; - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Calculate the starting forward rate off of the discount curve. - */ - - double dblStartingFwd = dc.forward ( - dtSpot.julian(), - dtSpot.addTenor (strBasisTenor).julian() - ); - - /* - * Set the discount curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Construct the shape preserving forward curve off of Quartic Polynomial Basis Spline. - */ - - return ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - "QUARTIC_FWD" + strBasisTenor, - ForwardLabel.Create ( - strCurrency, - strBasisTenor - ), - valParams, - null, - mktParams, - null, - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (5), - aFFC, - "DerivedParBasisSpread", - adblxM6MBasisSwapQuote, - dblStartingFwd - ); - } - - private static final Map MakeFC ( - final JulianDate dt, - final String strCurrency, - final MergedDiscountForwardCurve dc) - throws Exception - { - Map mapFC = new HashMap(); - - /* - * Build and run the sampling for the 1M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc1M = MakeFC ( - dt, - strCurrency, - dc, - 1, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00551, // 1Y - 0.00387, // 2Y - 0.00298, // 3Y - 0.00247, // 4Y - 0.00211, // 5Y - 0.00185, // 6Y - 0.00165, // 7Y - 0.00150, // 8Y - 0.00137, // 9Y - 0.00127, // 10Y - 0.00119, // 11Y - 0.00112, // 12Y - 0.00096, // 15Y - 0.00079, // 20Y - 0.00069, // 25Y - 0.00062 // 30Y - } - ); - - mapFC.put ( - "1M", - fc1M - ); - - /* - * Build and run the sampling for the 3M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc3M = MakeFC ( - dt, - strCurrency, - dc, - 3, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00186, // 1Y - 0.00127, // 2Y - 0.00097, // 3Y - 0.00080, // 4Y - 0.00067, // 5Y - 0.00058, // 6Y - 0.00051, // 7Y - 0.00046, // 8Y - 0.00042, // 9Y - 0.00038, // 10Y - 0.00035, // 11Y - 0.00033, // 12Y - 0.00028, // 15Y - 0.00022, // 20Y - 0.00020, // 25Y - 0.00018 // 30Y - } - ); - - mapFC.put ( - "3M", - fc3M - ); - - /* - * Build and run the sampling for the 12M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc12M = MakeFC ( - dt, - strCurrency, - dc, - 12, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", - "35Y", "40Y" // Extrapolated - }, - new double[] { - -0.00212, // 1Y - -0.00152, // 2Y - -0.00117, // 3Y - -0.00097, // 4Y - -0.00082, // 5Y - -0.00072, // 6Y - -0.00063, // 7Y - -0.00057, // 8Y - -0.00051, // 9Y - -0.00047, // 10Y - -0.00044, // 11Y - -0.00041, // 12Y - -0.00035, // 15Y - -0.00028, // 20Y - -0.00025, // 25Y - -0.00022, // 30Y - -0.00022, // 35Y Extrapolated - -0.00022, // 40Y Extrapolated - } - ); - - mapFC.put ( - "12M", - fc12M - ); - - return mapFC; - } - - private static final void SetVolCorrelation ( - final int iValueDate, - final CurveSurfaceQuoteContainer mktParams, - final ForwardLabel fri, - final double dblForwardVol, - final double dblFundingVol, - final double dblForwardFundingCorr) - throws Exception - { - FundingLabel fundingLabel = FundingLabel.Standard (fri.currency()); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (fri), - fri.currency(), - dblForwardVol - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (fundingLabel), - fri.currency(), - dblFundingVol - ) - ); - - mktParams.setForwardFundingCorrelation ( - fri, - fundingLabel, - new FlatUnivariate (dblForwardFundingCorr) - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - double dblStrike = 0.02; - String strFRATenor = "3M"; - String strCurrency = "USD"; - String strMaturityTenor = "4Y"; - String strManifestMeasure = "QuantoAdjustedParForward"; - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - /* - * Construct the Discount Curve using its instruments and quotes - */ - - MergedDiscountForwardCurve dc = MakeDC ( - dtToday, - strCurrency - ); - - Map mapFC = MakeFC ( - dtToday, - strCurrency, - dc - ); - - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strFRATenor - ); - - JulianDate dtEffective = dtToday.addTenor (strFRATenor); - - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - strFRATenor, - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - fri, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - strFRATenor, - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - Stream floatStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.RegularEdgeDates ( - dtEffective.julian(), - strFRATenor, - strMaturityTenor, - null - ), - cps, - cfus - ) - ); - - FRAStandardCapFloor fraCap = new FRAStandardCapFloor ( - "FRA_CAP", - floatStream, - strManifestMeasure, - true, - dblStrike, - new LastTradingDateSetting ( - LastTradingDateSetting.MID_CURVE_OPTION_QUARTERLY, - "", - Integer.MIN_VALUE - ), - null, - new BlackScholesAlgorithm() - ); - - FRAStandardCapFloor fraFloor = new FRAStandardCapFloor ( - "FRA_FLOOR", - floatStream, - strManifestMeasure, - false, - dblStrike, - new LastTradingDateSetting ( - LastTradingDateSetting.MID_CURVE_OPTION_QUARTERLY, - "", - Integer.MIN_VALUE - ), - null, - new BlackScholesAlgorithm() - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - mapFC.get (strFRATenor), - null, - null, - null, - null, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - strCurrency - ); - - double[] adblSigmaFwd = new double[] {0.1, 0.2, 0.3, 0.4, 0.5}; - double[] adblSigmaFwd2DomX = new double[] {0.10, 0.15, 0.20, 0.25, 0.30}; - double[] adblCorrFwdFwd2DomX = new double[] {-0.99, -0.50, 0.00, 0.50, 0.99}; - - System.out.println ("\tPrinting the Cap/Floor Output in Order (Left -> Right):"); - - System.out.println ("\t\tCap Price"); - - System.out.println ("\t\tCap Flat Price Vol (%)"); - - System.out.println ("\t\tFloor Price"); - - System.out.println ("\t\tFloor Flat Price Vol (%)"); - - System.out.println ("\t-------------------------------------------------------------"); - - System.out.println ("\t-------------------------------------------------------------"); - - for (double dblSigmaFwd : adblSigmaFwd) { - for (double dblSigmaFwd2DomX : adblSigmaFwd2DomX) { - for (double dblCorrFwdFwd2DomX : adblCorrFwdFwd2DomX) { - SetVolCorrelation ( - dtToday.julian(), - mktParams, - fri, - dblSigmaFwd, - dblSigmaFwd2DomX, - dblCorrFwdFwd2DomX - ); - - Map mapFRACapOutput = fraCap.value ( - valParams, - null, - mktParams, - null - ); - - Map mapFRAFloorOutput = fraFloor.value ( - valParams, - null, - mktParams, - null - ); - - System.out.println ("\t[" + - org.drip.quant.common.FormatUtil.FormatDouble (dblSigmaFwd, 2, 0, 100.) + "%," + - org.drip.quant.common.FormatUtil.FormatDouble (dblSigmaFwd2DomX, 2, 0, 100.) + "%," + - org.drip.quant.common.FormatUtil.FormatDouble (dblCorrFwdFwd2DomX, 2, 0, 100.) + "%] =" + - org.drip.quant.common.FormatUtil.FormatDouble (mapFRACapOutput.get ("Price"), 1, 4, 1.) + " | " + - org.drip.quant.common.FormatUtil.FormatDouble (mapFRACapOutput.get ("FlatVolatility"), 1, 1, 100.) + "% | " + - org.drip.quant.common.FormatUtil.FormatDouble (mapFRAFloorOutput.get ("Price"), 1, 4, 1.) + " | " + - org.drip.quant.common.FormatUtil.FormatDouble (mapFRAFloorOutput.get ("FlatVolatility"), 1, 1, 100.) + "% || " - ); - } - } - } - - System.out.println ("\t-------------------------------------------------------------"); - - System.out.println ("\t-------------------------------------------------------------"); - } -} diff --git a/org/drip/sample/capfloor/FRAStdCapModels.java b/org/drip/sample/capfloor/FRAStdCapModels.java deleted file mode 100644 index 7ad36ff..0000000 --- a/org/drip/sample/capfloor/FRAStdCapModels.java +++ /dev/null @@ -1,515 +0,0 @@ - -package org.drip.sample.capfloor; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.CompositePeriodBuilder; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.ValuationParams; -import org.drip.pricer.option.*; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.fra.FRAStandardCapFloor; -import org.drip.product.params.LastTradingDateSetting; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FRAStdCapModels runs a side-by-side comparison of the FRA Cap sequence using different models. - * - * - Brace, A., D. Gatarek, and M. Musiela (1997): The Market Model of Interest Rate Dynamics, Mathematical - * Finance 7 (2), 127-155. - * - * @author Lakshmi Krishnamurthy - */ - -public class FRAStdCapModels { - - private static final FixFloatComponent OTCFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFuture, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFuture]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFuture, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFuture; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aIRS; - } - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 30, - 60, - 91, - 182, - 273 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.0668750, // 30D - 0.0675000, // 60D - 0.0678125, // 91D - 0.0712500, // 182D - 0.0750000 // 273D - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", // 30D - "ForwardRate", // 60D - "ForwardRate", // 91D - "ForwardRate", // 182D - "ForwardRate" // 273D - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.08265, // 2Y - 0.08550, // 3Y - 0.08655, // 4Y - 0.08770, // 5Y - 0.08910, // 7Y - 0.08920 // 10Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 2Y - "SwapRate", // 3Y - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 7Y - "SwapRate" // 10Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - } - - private static final FRAStandardCapFloor MakeCap ( - final JulianDate dtEffective, - final ForwardLabel fri, - final String strMaturityTenor, - final String strManifestMeasure, - final double dblStrike, - final FokkerPlanckGenerator fpg) - throws Exception - { - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - fri.tenor(), - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - fri, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - fri.tenor(), - fri.currency(), - null, - 1., - null, - null, - null, - null - ); - - Stream floatStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.RegularEdgeDates ( - dtEffective.julian(), - fri.tenor(), - strMaturityTenor, - null - ), - cps, - cfus - ) - ); - - return new FRAStandardCapFloor ( - "FRA_CAP", - floatStream, - strManifestMeasure, - true, - dblStrike, - new LastTradingDateSetting ( - LastTradingDateSetting.MID_CURVE_OPTION_QUARTERLY, - "", - Integer.MIN_VALUE - ), - null, - fpg - ); - } - - private static final Map ValueCap ( - final ForwardLabel fri, - final String strManifestMeasure, - final ValuationParams valParams, - final CurveSurfaceQuoteContainer mktParams, - final String[] astrMaturityTenor, - final double[] adblATMStrike, - final double[] adblATMVol, - final FokkerPlanckGenerator fpg) - throws Exception - { - Map mapDateVol = new TreeMap(); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - FRAStandardCapFloor cap = MakeCap ( - new JulianDate (valParams.valueDate()), - fri, - astrMaturityTenor[i], - strManifestMeasure, - adblATMStrike[i], - fpg - ); - - Map mapCapStreamOutput = cap.stream().value ( - valParams, - null, - mktParams, - null - ); - - double dblCapStreamFairPremium = mapCapStreamOutput.get ("FairPremium"); - - FixFloatComponent swap = OTCFixFloat ( - new JulianDate (valParams.valueDate()), - fri.currency(), - astrMaturityTenor[i], - 0. - ); - - Map mapSwapOutput = swap.value ( - valParams, - null, - mktParams, - null - ); - - double dblSwapRate = mapSwapOutput.get ("FairPremium"); - - double dblCapPrice = cap.priceFromFlatVolatility ( - valParams, - null, - mktParams, - null, - adblATMVol[i] - ); - - cap.stripPiecewiseForwardVolatility ( - valParams, - null, - mktParams, - null, - adblATMVol[i], - mapDateVol - ); - - System.out.println ( - "\tCap " + cap.maturityDate() + " | " + - FormatUtil.FormatDouble (dblCapStreamFairPremium, 1, 2, 100.) + "% |" + - FormatUtil.FormatDouble (dblSwapRate, 1, 2, 100.) + "% |" + - FormatUtil.FormatDouble (cap.strike(), 1, 2, 100.) + "% |" + - FormatUtil.FormatDouble (adblATMVol[i], 2, 2, 100.) + "% |" + - FormatUtil.FormatDouble (dblCapPrice, 1, 0, 10000.) + " ||" - ); - } - - return mapDateVol; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 1995, - DateUtil.FEBRUARY, - 3 - ); - - String strFRATenor = "3M"; - String strCurrency = "GBP"; - String strManifestMeasure = "ParForward"; - - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strFRATenor - ); - - MergedDiscountForwardCurve dc = MakeDC ( - dtSpot, - strCurrency - ); - - ForwardCurve fcNative = dc.nativeForwardCurve (strFRATenor); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - fcNative, - null, - null, - null, - null, - null, - null - ); - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y" - }; - - double[] adblATMStrike = new double[] { - 0.0788, // "1Y", - 0.0839, // "2Y", - 0.0864, // "3Y", - 0.0869, // "4Y", - 0.0879, // "5Y", - 0.0890, // "7Y", - 0.0889 // "10Y" - }; - - double[] adblATMVol = new double[] { - 0.1550, // "1Y", - 0.1775, // "2Y", - 0.1800, // "3Y", - 0.1775, // "4Y", - 0.1775, // "5Y", - 0.1650, // "7Y", - 0.1550 // "10Y" - }; - - System.out.println ("\t---------------------------------------------------"); - - System.out.println ("\t---------------------------------------------------"); - - Map mapLognormalDateVol = ValueCap ( - fri, - strManifestMeasure, - valParams, - mktParams, - astrMaturityTenor, - adblATMStrike, - adblATMVol, - new BlackScholesAlgorithm() - ); - - System.out.println ("\t---------------------------------------------------"); - - System.out.println ("\t---------------------------------------------------"); - - Map mapNormalDateVol = ValueCap ( - fri, - strManifestMeasure, - valParams, - mktParams, - astrMaturityTenor, - adblATMStrike, - adblATMVol, - new BlackNormalAlgorithm() - ); - - System.out.println ("\n\n\t---------------------------------------------------"); - - System.out.println ("\t----- CALIBRATED FORWARD VOLATILITY NODES --------"); - - System.out.println ("\t---------------------------------------------------\n"); - - for (Map.Entry me : mapLognormalDateVol.entrySet()) - System.out.println ( - "\t" + - me.getKey() + " => " + - FormatUtil.FormatDouble (me.getValue(), 2, 2, 100.) + "% |" + - FormatUtil.FormatDouble (mapNormalDateVol.get (me.getKey()), 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t---------------------------------------------------"); - - System.out.println ("\t---------------------------------------------------"); - } -} diff --git a/org/drip/sample/capfloor/FRAStdCapMonteCarlo.java b/org/drip/sample/capfloor/FRAStdCapMonteCarlo.java deleted file mode 100644 index 39be80b..0000000 --- a/org/drip/sample/capfloor/FRAStdCapMonteCarlo.java +++ /dev/null @@ -1,900 +0,0 @@ - -package org.drip.sample.capfloor; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.analytics.definition.MarketSurface; -import org.drip.analytics.support.CompositePeriodBuilder; -import org.drip.dynamics.lmm.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.pricer.option.BlackScholesAlgorithm; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.fra.*; -import org.drip.product.params.LastTradingDateSetting; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.grid.OverlappingStretchSpan; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.*; -import org.drip.state.curve.BasisSplineForwardRate; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FRAStdCapMonteCarlo demonstrates the steps associated with a LMM-Based Monte-Carlo pricing of a FRA Cap. - * The References are: - * - * 1) Goldys, B., M. Musiela, and D. Sondermann (1994): Log-normality of Rates and Term Structure Models, - * The University of New South Wales. - * - * 2) Musiela, M. (1994): Nominal Annual Rates and Log-normal Volatility Structure, The University of New - * South Wales. - * - * 3) Brace, A., D. Gatarek, and M. Musiela (1997): The Market Model of Interest Rate Dynamics, Mathematical - * Finance 7 (2), 127-155. - * - * @author Lakshmi Krishnamurthy - */ - -public class FRAStdCapMonteCarlo { - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < aiDay.length; ++i) { - aDeposit[i] = new SingleStreamComponent ( - "DEPOSIT_" + aiDay[i], - new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.EdgePair ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ) - ), - cps, - cfus - ) - ), - csp - ); - - aDeposit[i].setPrimaryCode (aiDay[i] + "D"); - } - - return aDeposit; - } - - /* - * Construct the Swap Instrument from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent SwapInstrumentFromMaturityTenor ( - final JulianDate dtEffective, - final String strCurrency, - final double dblFixedCoupon, - final String strMaturityTenor) - throws Exception - { - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 4, - "Act/360", - false, - "Act/360", - false, - strCurrency, - true, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - dblFixedCoupon, - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - strMaturityTenor, - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - strMaturityTenor, - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent irs = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - irs.setPrimaryCode ("IRS." + strMaturityTenor + "." + strCurrency); - - return irs; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtEffective, - final String strCurrency, - final String[] astrMaturityTenor) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = SwapInstrumentFromMaturityTenor ( - dtEffective, - strCurrency, - 0., - astrMaturityTenor[i] - ); - - return aIRS; - } - - /* - * This sample demonstrates discount curve calibration and input instrument calibration quote recovery. - * It shows the following: - * - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve OTCInstrumentCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 7, 14, 30, 60 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0013, 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of EDF Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aEDFComp = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtSpot, - 8, - strCurrency - ); - - double[] adblEDFQuote = new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }; - - /* - * Construct the EDF Instrument Set Stretch Builder - */ - - LatentStateStretchSpec edfStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "EDF", - aEDFComp, - "ForwardRate", - adblEDFQuote - ); - - /* - * Construct the Array of Swap Instruments and their Quotes from the given set of parameters - */ - - FixFloatComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - } - ); - - double[] adblSwapQuote = new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }; - - /* - * Construct the Swap Instrument Set Stretch Builder - */ - - LatentStateStretchSpec swapStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SWAP", - aSwapComp, - "SwapRate", - adblSwapQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - edfStretch, - swapStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit, Futures, and Swap Stretches. - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - CurveSurfaceQuoteContainer csqs = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Cross-Comparison of the Deposit Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t[" + aDepositComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aDepositComp[i].measureValue (valParams, null, csqs, - null, "Rate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the EDF Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t EDF INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aEDFComp.length; ++i) - System.out.println ("\t[" + aEDFComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aEDFComp[i].measureValue (valParams, null, csqs, null, "Rate"), 1, 6, 1.) - + " | " + FormatUtil.FormatDouble (adblEDFQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t SWAP INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aSwapComp.length; ++i) - System.out.println ("\t[" + aSwapComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aSwapComp[i].measureValue (valParams, null, csqs, null, "CalibSwapRate"), 1, 6, 1.) - + " | " + FormatUtil.FormatDouble (adblSwapQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aSwapComp[i].measureValue (valParams, null, csqs, null, "FairPremium"), 1, 6, 1.)); - - return dc; - } - - private static final ForwardCurve LIBORSpan ( - final MergedDiscountForwardCurve dc, - final ForwardLabel forwardLabel, - final SegmentCustomBuilderControl scbc, - final JulianDate dtView, - final int iNumForwardTenor) - throws Exception - { - double[] adblDate = new double[iNumForwardTenor + 1]; - double[] adblLIBOR = new double[iNumForwardTenor + 1]; - SegmentCustomBuilderControl[] aSCBC = new SegmentCustomBuilderControl[iNumForwardTenor]; - - JulianDate dtForward = dtView.subtractTenor (forwardLabel.tenor()); - - for (int i = 0; i <= iNumForwardTenor; ++i) { - if (iNumForwardTenor != i) aSCBC[i] = scbc; - - adblDate[i] = dtForward.julian(); - - adblLIBOR[i] = dc.libor (dtForward, forwardLabel.tenor()); - - dtForward = dtForward.addTenor (forwardLabel.tenor()); - } - - return new BasisSplineForwardRate ( - forwardLabel, - new OverlappingStretchSpan ( - MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator ( - "SPOT_QM_LIBOR", - adblDate, - adblLIBOR, - aSCBC, - null, - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE - ) - ) - ); - } - - private static final MarketSurface FlatVolatilitySurface ( - final JulianDate dtStart, - final String strCurrency, - final double dblFlatVol) - throws Exception - { - return ScenarioMarketSurfaceBuilder.CustomSplineWireSurface ( - "VIEW_TARGET_VOLATILITY_SURFACE", - dtStart, - strCurrency, - new double[] { - dtStart.julian(), - dtStart.addYears (2).julian(), - dtStart.addYears (4).julian(), - dtStart.addYears (6).julian(), - dtStart.addYears (8).julian(), - dtStart.addYears (10).julian() - }, - new double[] { - dtStart.julian(), - dtStart.addYears (2).julian(), - dtStart.addYears (4).julian(), - dtStart.addYears (6).julian(), - dtStart.addYears (8).julian(), - dtStart.addYears (10).julian() - }, - new double[][] { - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - }, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ), - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ) - ); - } - - private static final LognormalLIBORVolatility LLVInstance ( - final int iSpotDate, - final ForwardLabel forwardLabel, - final MarketSurface[] aMS, - final double[][] aadblCorrelation, - final int iNumFactor) - throws Exception - { - UnivariateSequenceGenerator[] aUSG = new UnivariateSequenceGenerator[aMS.length]; - - for (int i = 0; i < aUSG.length; ++i) - aUSG[i] = new BoxMullerGaussian ( - 0., - 1. - ); - - return new LognormalLIBORVolatility ( - iSpotDate, - forwardLabel, - aMS, - new PrincipalFactorSequenceGenerator ( - aUSG, - aadblCorrelation, - iNumFactor - ) - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strForwardTenor = "3M"; - String strViewTenor = "6M"; - String strSimulationTenor = "6M"; - String strMaturityTenor = "5Y"; - String strCurrency = "USD"; - double dblFlatVol1 = 0.35; - double dblFlatVol2 = 0.42; - double dblFlatVol3 = 0.27; - int iNumForwardTenor = 30; - int iNumFactor = 2; - int iNumRun = 100; - double dblStrike = 0.02; - String strManifestMeasure = "ParForward"; - - double[][] aadblCorrelation = new double[][] { - {1.0, 0.1, 0.2}, - {0.1, 1.0, 0.2}, - {0.2, 0.1, 1.0} - }; - - SegmentCustomBuilderControl scbc = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (1.) - ), - null - ); - - JulianDate dtSpot = org.drip.analytics.date.DateUtil.Today(); - - MarketSurface[] aMS = new MarketSurface[] { - FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol1 - ), - FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol2 - ), - FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol3 - ) - }; - - FundingLabel fundingLabel = FundingLabel.Standard ( - strCurrency - ); - - ForwardLabel forwardLabel = ForwardLabel.Create ( - strCurrency, - strForwardTenor - ); - - JulianDate dtView = dtSpot.addTenor ( - strViewTenor - ); - - JulianDate dtSimulationEnd = dtSpot.addTenor ( - strSimulationTenor - ); - - MergedDiscountForwardCurve dc = OTCInstrumentCurve ( - dtSpot, - strCurrency - ); - - ForwardCurve fc = LIBORSpan ( - dc, - forwardLabel, - scbc, - dtView, - iNumForwardTenor - ); - - LognormalLIBORCurveEvolver llce = LognormalLIBORCurveEvolver.Create ( - fundingLabel, - forwardLabel, - iNumForwardTenor, - scbc - ); - - BGMCurveUpdate bgmInitial = BGMCurveUpdate.Create ( - fundingLabel, - forwardLabel, - dtSpot.julian(), - dtSpot.julian(), - fc, - null, - dc, - null, - null, - null, - null, - null, - LLVInstance ( - dtSpot.julian(), - forwardLabel, - aMS, - aadblCorrelation, - iNumFactor - ) - ); - - ForwardCurve[] aFCLIBOR = llce.simulateTerminalLatentState ( - dtSpot.julian(), - dtSimulationEnd.julian(), - 1, - dtView.julian(), - bgmInitial, - iNumRun - ); - - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - strForwardTenor, - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - forwardLabel, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - strForwardTenor, - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - Stream floatStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.RegularEdgeDates ( - dtView.julian(), - strForwardTenor, - strMaturityTenor, - null - ), - cps, - cfus - ) - ); - - FRAStandardCapFloor fraCap = new FRAStandardCapFloor ( - "FRA_CAP", - floatStream, - strManifestMeasure, - true, - dblStrike, - new LastTradingDateSetting ( - LastTradingDateSetting.MID_CURVE_OPTION_QUARTERLY, - "", - Integer.MIN_VALUE - ), - null, - new BlackScholesAlgorithm() - ); - - List lsCapFloorlet = fraCap.capFloorlets(); - - System.out.println ("\n\t||--------------------------------------------------||"); - - System.out.println ("\t|| DATES => CAP LEEFT | FLR LFT ||"); - - System.out.println ("\t||--------------------------------------------------||"); - - ValuationParams valParamsEnd = new ValuationParams ( - dtSimulationEnd, - dtSimulationEnd, - strCurrency - ); - - double dblCapLift = 0.; - double dblFloorLift = 0.; - - for (int i = 0; i < iNumRun; ++i) { - CurveSurfaceQuoteContainer csqsScen = MarketParamsBuilder.DiscountForward ( - dc, - aFCLIBOR[i] - ); - - for (FRAStandardCapFloorlet fraCaplet : lsCapFloorlet) { - FRAStandardComponent fra = fraCaplet.fra(); - - Map mapScenFRAOutput = fra.value ( - valParamsEnd, - null, - csqsScen, - null - ); - - double dblScenarioCapLift = mapScenFRAOutput.get ("CapLift"); - - double dblScenarioFloorLift = mapScenFRAOutput.get ("FloorLift"); - - dblCapLift += dblScenarioCapLift; - dblFloorLift += dblScenarioFloorLift; - - System.out.println ("\t|| [" + - fra.effectiveDate() + " - " + fra.maturityDate() + "] => " + - FormatUtil.FormatDouble (dblScenarioCapLift, 1, 5, 1.) + " | " + - FormatUtil.FormatDouble (dblScenarioFloorLift, 1, 5, 1.) + " ||" - ); - } - } - - dblCapLift = dblCapLift / iNumRun; - dblFloorLift = dblFloorLift / iNumRun; - - double dblTermnalDF = dc.df (dtSimulationEnd); - - System.out.println ("\t||--------------------------------------------------||"); - - System.out.println ("\n\n\t\t||-------------------------||"); - - System.out.println ("\t\t|| Cap Lift : " + FormatUtil.FormatDouble (dblCapLift, 1, 5, 1.) + " ||"); - - System.out.println ("\t\t|| Floor Lift : " + FormatUtil.FormatDouble (dblFloorLift, 1, 5, 1.) + " ||"); - - System.out.println ("\t\t|| Cap PV : " + FormatUtil.FormatDouble (dblCapLift * dblTermnalDF, 1, 5, 1.) + " ||"); - - System.out.println ("\t\t|| Floor PV : " + FormatUtil.FormatDouble (dblFloorLift * dblTermnalDF, 1, 5, 1.) + " ||"); - - System.out.println ("\t\t||-------------------------||"); - } -} diff --git a/org/drip/sample/capfloor/FRAStdCapSequence.java b/org/drip/sample/capfloor/FRAStdCapSequence.java deleted file mode 100644 index 42a0745..0000000 --- a/org/drip/sample/capfloor/FRAStdCapSequence.java +++ /dev/null @@ -1,517 +0,0 @@ - -package org.drip.sample.capfloor; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.CompositePeriodBuilder; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.ValuationParams; -import org.drip.pricer.option.BlackScholesAlgorithm; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.fra.FRAStandardCapFloor; -import org.drip.product.params.LastTradingDateSetting; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FRAStdCapSequence demonstrates the Product Creation, Market Parameters Construction, and Valuation of a - * Sequence of Standard FRA Caps. The Marks and the Valuation References are sourced from: - * - * - Brace, A., D. Gatarek, and M. Musiela (1997): The Market Model of Interest Rate Dynamics, Mathematical - * Finance 7 (2), 127-155. - * - * @author Lakshmi Krishnamurthy - */ - -public class FRAStdCapSequence { - - private static final FixFloatComponent OTCFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFuture, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFuture]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFuture, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFuture; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aIRS; - } - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 30, - 60, - 91, - 182, - 273 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.0668750, // 30D - 0.0675000, // 60D - 0.0678125, // 91D - 0.0712500, // 182D - 0.0750000 // 273D - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", // 30D - "ForwardRate", // 60D - "ForwardRate", // 91D - "ForwardRate", // 182D - "ForwardRate" // 273D - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.08265, // 2Y - 0.08550, // 3Y - 0.08655, // 4Y - 0.08770, // 5Y - 0.08910, // 7Y - 0.08920 // 10Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 2Y - "SwapRate", // 3Y - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 7Y - "SwapRate" // 10Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - } - - private static final FRAStandardCapFloor MakeCap ( - final JulianDate dtEffective, - final ForwardLabel fri, - final String strMaturityTenor, - final String strManifestMeasure, - final double dblStrike) - throws Exception - { - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - fri.tenor(), - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - fri, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - fri.tenor(), - fri.currency(), - null, - 1., - null, - null, - null, - null - ); - - Stream floatStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.RegularEdgeDates ( - dtEffective.julian(), - fri.tenor(), - strMaturityTenor, - null - ), - cps, - cfus - ) - ); - - return new FRAStandardCapFloor ( - "FRA_CAP", - floatStream, - strManifestMeasure, - true, - dblStrike, - new LastTradingDateSetting ( - LastTradingDateSetting.MID_CURVE_OPTION_QUARTERLY, - "", - Integer.MIN_VALUE - ), - null, - new BlackScholesAlgorithm() - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 1995, - DateUtil.FEBRUARY, - 3 - ); - - String strFRATenor = "3M"; - String strCurrency = "GBP"; - String strManifestMeasure = "ParForward"; - - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strFRATenor - ); - - MergedDiscountForwardCurve dc = MakeDC ( - dtSpot, - strCurrency - ); - - ForwardCurve fcNative = dc.nativeForwardCurve (strFRATenor); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - fcNative, - null, - null, - null, - null, - null, - null - ); - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y" - }; - - double[] adblATMStrike = new double[] { - 0.0788, // "1Y", - 0.0839, // "2Y", - 0.0864, // "3Y", - 0.0869, // "4Y", - 0.0879, // "5Y", - 0.0890, // "7Y", - 0.0889 // "10Y" - }; - - double[] adblATMVol = new double[] { - 0.1550, // "1Y", - 0.1775, // "2Y", - 0.1800, // "3Y", - 0.1775, // "4Y", - 0.1775, // "5Y", - 0.1650, // "7Y", - 0.1550 // "10Y" - }; - - Map mapDateVol = new TreeMap(); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - FRAStandardCapFloor cap = MakeCap ( - dtSpot, - fri, - astrMaturityTenor[i], - strManifestMeasure, - adblATMStrike[i] - ); - - Map mapCapStreamOutput = cap.stream().value ( - valParams, - null, - mktParams, - null - ); - - double dblCapStreamFairPremium = mapCapStreamOutput.get ("FairPremium"); - - FixFloatComponent swap = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - 0. - ); - - Map mapSwapOutput = swap.value ( - valParams, - null, - mktParams, - null - ); - - double dblSwapRate = mapSwapOutput.get ("FairPremium"); - - double dblCapPrice = cap.priceFromFlatVolatility ( - valParams, - null, - mktParams, - null, - adblATMVol[i] - ); - - cap.stripPiecewiseForwardVolatility ( - valParams, - null, - mktParams, - null, - adblATMVol[i], - mapDateVol - ); - - System.out.println ( - "\tCap " + cap.maturityDate() + " | " + - FormatUtil.FormatDouble (dblCapStreamFairPremium, 1, 2, 100.) + "% |" + - FormatUtil.FormatDouble (dblSwapRate, 1, 2, 100.) + "% |" + - FormatUtil.FormatDouble (cap.strike(), 1, 2, 100.) + "% |" + - FormatUtil.FormatDouble (adblATMVol[i], 2, 2, 100.) + "% |" + - FormatUtil.FormatDouble (dblCapPrice, 1, 0, 10000.) + " ||" - ); - } - - System.out.println ("\n\n\t---------------------------------------------------"); - - System.out.println ("\t----- CALIBRATED FORWARD VOLATILITY NODES --------"); - - System.out.println ("\t---------------------------------------------------\n"); - - for (Map.Entry me : mapDateVol.entrySet()) - System.out.println ( - "\t" + - me.getKey() + " => " + - FormatUtil.FormatDouble (me.getValue(), 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t---------------------------------------------------"); - - System.out.println ("\t---------------------------------------------------------------"); - - double[] adblATMPrice = new double[] { - 0.0027, // "1Y", - 0.0100, // "2Y", - 0.0185, // "3Y", - 0.0267, // "4Y", - 0.0360, // "5Y", - 0.0511, // "7Y", - 0.0703 // "10Y" - }; - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - FRAStandardCapFloor cap = MakeCap ( - dtSpot, - fri, - astrMaturityTenor[i], - strManifestMeasure, - adblATMStrike[i] - ); - - double dblATMVolatility = cap.volatilityFromATMPrice ( - valParams, - null, - mktParams, - null, - adblATMPrice[i] - ); - - Map mapCapStreamOutput = cap.stream().value ( - valParams, - null, - mktParams, - null - ); - - double dblCapStreamFairPremium = mapCapStreamOutput.get ("FairPremium"); - - System.out.println ( - "\tCap ATM Volatility " + cap.maturityDate() + " | " + - FormatUtil.FormatDouble (adblATMPrice[i], 2, 2, 100.) + "% |" + - FormatUtil.FormatDouble (dblCapStreamFairPremium, 2, 2, 100.) + "% |" + - FormatUtil.FormatDouble (dblATMVolatility, 2, 2, 100.) + "% ||" - ); - } - - System.out.println ("\t---------------------------------------------------------------"); - - System.out.println ("\t---------------------------------------------------------------"); - } -} diff --git a/org/drip/sample/classifier/BinaryClassifierSupremumBound.java b/org/drip/sample/classifier/BinaryClassifierSupremumBound.java deleted file mode 100644 index c1b334c..0000000 --- a/org/drip/sample/classifier/BinaryClassifierSupremumBound.java +++ /dev/null @@ -1,369 +0,0 @@ - -package org.drip.sample.classifier; - -import org.drip.learning.rxtor1.*; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.functional.FlatMultivariateRandom; -import org.drip.sequence.metrics.SingleSequenceAgnosticMetrics; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BinaryClassifierSupremumBound demonstrates the Computation of the Probabilistic Bounds for the Supremum - * among the Class of Binary Classifier Functions for an Empirical Sample from its Population Mean using - * Variants of the Efron-Stein Methodology. - * - * @author Lakshmi Krishnamurthy - */ - -public class BinaryClassifierSupremumBound { - - private static final double[] EmpiricalOutcome ( - final int iNumOutcome) - throws Exception - { - double[] adblEmpiricalOutcome = new double[iNumOutcome]; - - for (int i = 0; i < iNumOutcome; ++i) - adblEmpiricalOutcome[i] = Math.random() + 0.5; - - return adblEmpiricalOutcome; - } - - private static final SingleSequenceAgnosticMetrics[] IIDDraw ( - final UnivariateSequenceGenerator rsg, - final int iNumSample) - throws Exception - { - SingleSequenceAgnosticMetrics[] aSSAM = new SingleSequenceAgnosticMetrics[iNumSample]; - - for (int i = 0; i < iNumSample; ++i) - aSSAM[i] = rsg.sequence (iNumSample, null); - - return aSSAM; - } - - private static final EmpiricalPenaltySupremumEstimator EmpiricalLossSupremumFunction ( - final double[] asEmpiricalOutcome) - throws Exception - { - // AbstractBinaryClassifier[] aClassifier = null; - - return null; - - /* return new EmpiricalLossSupremum ( - new GeneralizedClassifierFunctionClass ( - aClassifier, - new ExpectedSupremumLossAsymptote ( - 0.01, - -1.5 - ) - ), - asEmpiricalOutcome - ); */ - } - - private static final void MartingaleDifferencesRun ( - final Binary bsg, - final double[] adblEmpiricalOutcome, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (adblEmpiricalOutcome.length, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - bsg, - adblEmpiricalOutcome.length - ); - - EmpiricalPenaltySupremumMetrics eslm = new EmpiricalPenaltySupremumMetrics ( - EmpiricalLossSupremumFunction ( - adblEmpiricalOutcome - ), - aSSAM, - null - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (eslm.martingaleVarianceUpperBound(), 1, 3, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void GhostVariateVarianceRun ( - final Binary bsg, - final double[] adblEmpiricalOutcome, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (adblEmpiricalOutcome.length, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - bsg, - adblEmpiricalOutcome.length - ); - - EmpiricalPenaltySupremumMetrics eslm = new EmpiricalPenaltySupremumMetrics ( - EmpiricalLossSupremumFunction ( - adblEmpiricalOutcome - ), - aSSAM, - null - ); - - SingleSequenceAgnosticMetrics[] aSSAMGhost = IIDDraw ( - bsg, - adblEmpiricalOutcome.length - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (eslm.ghostVarianceUpperBound (aSSAMGhost), 1, 3, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void EfronSteinSteeleRun ( - final Binary bsg, - final double[] adblEmpiricalOutcome, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (adblEmpiricalOutcome.length, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - bsg, - adblEmpiricalOutcome.length - ); - - EmpiricalPenaltySupremumMetrics eslm = new EmpiricalPenaltySupremumMetrics ( - EmpiricalLossSupremumFunction ( - adblEmpiricalOutcome - ), - aSSAM, - null - ); - - SingleSequenceAgnosticMetrics[] aSSAMGhost = IIDDraw ( - bsg, - adblEmpiricalOutcome.length - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (eslm.efronSteinSteeleBound (aSSAMGhost), 1, 3, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void PivotDifferencesRun ( - final Binary bsg, - final double[] adblEmpiricalOutcome, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (adblEmpiricalOutcome.length, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - bsg, - adblEmpiricalOutcome.length - ); - - EmpiricalPenaltySupremumMetrics eslm = new EmpiricalPenaltySupremumMetrics ( - EmpiricalLossSupremumFunction ( - adblEmpiricalOutcome - ), - aSSAM, - null - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (eslm.pivotVarianceUpperBound (new FlatMultivariateRandom (0.)), 1, 3, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void LugosiVarianceRun ( - final Binary bsg, - final double[] adblEmpiricalOutcome, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (adblEmpiricalOutcome.length, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - bsg, - adblEmpiricalOutcome.length - ); - - EmpiricalPenaltySupremumMetrics eslm = new EmpiricalPenaltySupremumMetrics ( - EmpiricalLossSupremumFunction ( - adblEmpiricalOutcome - ), - aSSAM, - null - ); - - SingleSequenceAgnosticMetrics[] aSSAMGhost = IIDDraw ( - bsg, - 1 - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (eslm.lugosiVarianceBound (aSSAMGhost[0].sequence()), 1, 3, 1.); - } - - System.out.println (strDump + " |"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iNumSet = 5; - - int[] aiSampleSize = new int[] { - 3, 10, 25, 50 - }; - - Binary bin = new Binary (0.7); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Martingale Differences Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - MartingaleDifferencesRun ( - bin, - EmpiricalOutcome (iSampleSize), - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Symmetrized Variate Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - GhostVariateVarianceRun ( - bin, - EmpiricalOutcome (iSampleSize), - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - aiSampleSize = new int[] { - 3, 10, 25, 50, 75, 99 - }; - - System.out.println ("\t| Efron-Stein-Steele Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - EfronSteinSteeleRun ( - bin, - EmpiricalOutcome (iSampleSize), - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Pivoted Differences Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - PivotDifferencesRun ( - bin, - EmpiricalOutcome (iSampleSize), - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Lugosi Bounded Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - LugosiVarianceRun ( - bin, - EmpiricalOutcome (iSampleSize), - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - } -} diff --git a/org/drip/sample/cms/FixFloatMetricComparison.java b/org/drip/sample/cms/FixFloatMetricComparison.java deleted file mode 100644 index 5cdd904..0000000 --- a/org/drip/sample/cms/FixFloatMetricComparison.java +++ /dev/null @@ -1,475 +0,0 @@ - -package org.drip.sample.cms; - -import java.util.List; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.market.otc.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FixFloatMetricComparison demonstrates the Construction and Valuation of an In-Advance and In-Arrears - * Variants of the CMS Fix-Float Swap. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixFloatMetricComparison { - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFutures, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFutures]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFutures, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFutures; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - FixFloatComponent irs = OTCIRS ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate" - }; - - double[] adblSwapQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate", // 30Y - "SwapRate", // 40Y - "SwapRate" // 50Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - adblSwapQuote - ); - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - true - ); - } - - private static final FixFloatComponent MakeFixFloatSwap ( - final JulianDate dtEffective, - final String strCurrency, - final String strFloaterTenor, - final String strMaturityTenor, - final boolean bInArrears) - throws Exception - { - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 4, - "Act/360", - false, - "Act/360", - false, - strCurrency, - false, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - 0.02, - 0., - strCurrency - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCurrency, - strFloaterTenor - ), - bInArrears ? CompositePeriodBuilder.REFERENCE_PERIOD_IN_ARREARS : CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - strMaturityTenor, - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - strMaturityTenor, - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent fixFloat = new FixFloatComponent ( - fixedStream, - floatingStream, - new CashSettleParams ( - 0, - strCurrency, - 0 - ) - ); - - return fixFloat; - } - - private static final double CMSFairPremium ( - final String strCurrency, - final String strCMSFloaterTenor, - final String strCMSMaturityTenor, - final boolean bInArrears, - final JulianDate dtSpot, - final CurveSurfaceQuoteContainer mktParams) - throws Exception - { - FixFloatComponent cms = MakeFixFloatSwap ( - dtSpot, - strCurrency, - strCMSFloaterTenor, - strCMSMaturityTenor, - bInArrears - ); - - CaseInsensitiveTreeMap mapCMSOutput = cms.value ( - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - null, - mktParams, - null - ); - - return mapCMSOutput.get ("FairPremium"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - MergedDiscountForwardCurve dc = MakeDC ( - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer mktParams = new CurveSurfaceQuoteContainer(); - - mktParams.setFundingState (dc); - - String[] astrCMSFloaterTenor = new String[] { - "3M", "6M", "12M" - }; - - String[] astrCMSMaturityTenor = new String[] { - "24M", "60M", "10Y", "20Y", "30Y" - }; - - System.out.println ("\n\t|----------------------------------------|"); - - System.out.println ("\t| FIX-FLOAT CMS FAIR PREMIUM: 3M ADVANCE |"); - - System.out.println ("\t|----------------------------------------|"); - - System.out.println ("\t| MATURITY | 3M | 6M | 12M |"); - - System.out.println ("\t|----------------------------------------|"); - - for (String strCMSMaturityTenor : astrCMSMaturityTenor) { - String strDump = "\t| " + strCMSMaturityTenor + " | "; - - for (String strCMSFloaterTenor : astrCMSFloaterTenor) { - double dblFairPremium = CMSFairPremium ( - strCurrency, - strCMSFloaterTenor, - strCMSMaturityTenor, - false, - dtSpot, - mktParams - ); - - strDump += FormatUtil.FormatDouble (dblFairPremium, 1, 2, 100) + "% | "; - } - - System.out.println (strDump); - } - - System.out.println ("\t|----------------------------------------|"); - - System.out.println ("\n\t|----------------------------------------|"); - - System.out.println ("\t| FIX-FLOAT CMS FAIR PREMIUM: 3M ARREARS |"); - - System.out.println ("\t|----------------------------------------|"); - - System.out.println ("\t| MATURITY | 3M | 6M | 12M |"); - - System.out.println ("\t|----------------------------------------|"); - - for (String strCMSMaturityTenor : astrCMSMaturityTenor) { - String strDump = "\t| " + strCMSMaturityTenor + " | "; - - for (String strCMSFloaterTenor : astrCMSFloaterTenor) { - double dblFairPremium = CMSFairPremium ( - strCurrency, - strCMSFloaterTenor, - strCMSMaturityTenor, - true, - dtSpot, - mktParams - ); - - strDump += FormatUtil.FormatDouble (dblFairPremium, 1, 2, 100) + "% | "; - } - - System.out.println (strDump); - } - - System.out.println ("\t|----------------------------------------|"); - } -} diff --git a/org/drip/sample/cms/FixFloatVarianceAnalysis.java b/org/drip/sample/cms/FixFloatVarianceAnalysis.java deleted file mode 100644 index e1a992c..0000000 --- a/org/drip/sample/cms/FixFloatVarianceAnalysis.java +++ /dev/null @@ -1,557 +0,0 @@ - -package org.drip.sample.cms; - -import java.util.List; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.market.otc.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FixFloatVarianceAnalysis demonstrates the Construction and Valuation Impact of Volatility and Correlation - * on the CMS Fix-Float Swap. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixFloatVarianceAnalysis { - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFutures, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFutures]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFutures, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFutures; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - FixFloatComponent irs = OTCIRS ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate" - }; - - double[] adblSwapQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate", // 30Y - "SwapRate", // 40Y - "SwapRate" // 50Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - adblSwapQuote - ); - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - true - ); - } - - private static final FixFloatComponent MakeFixFloatSwap ( - final JulianDate dtEffective, - final String strCurrency, - final ForwardLabel forwardLabel, - final String strMaturityTenor, - final boolean bInArrears) - throws Exception - { - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 4, - "Act/360", - false, - "Act/360", - false, - strCurrency, - false, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - 0.02, - 0., - strCurrency - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - forwardLabel, - bInArrears ? CompositePeriodBuilder.REFERENCE_PERIOD_IN_ARREARS : CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - strMaturityTenor, - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - strMaturityTenor, - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent fixFloat = new FixFloatComponent ( - fixedStream, - floatingStream, - new CashSettleParams ( - 0, - strCurrency, - 0 - ) - ); - - return fixFloat; - } - - private static final void SetMarketParams ( - final int iValueDate, - final CurveSurfaceQuoteContainer mktParams, - final ForwardLabel forwardLabel, - final FundingLabel fundingLabel, - final double dblFundingVol, - final double dblForwardVol, - final double dblForwardFundingCorr) - throws Exception - { - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (forwardLabel), - forwardLabel.currency(), - dblForwardVol - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (fundingLabel), - forwardLabel.currency(), - dblFundingVol - ) - ); - - mktParams.setForwardFundingCorrelation ( - forwardLabel, - fundingLabel, - new FlatUnivariate (dblForwardFundingCorr) - ); - } - - private static final void VolCorrScenario ( - final FixFloatComponent[] aCMSFixFloat, - final ValuationParams valParams, - final CurveSurfaceQuoteContainer mktParams, - final ForwardLabel forwardLabel, - final FundingLabel fundingLabel, - final double dblForwardVol, - final double dblFundingVol, - final double dblForwardFundingCorr, - final double dblBaseFairPremium) - throws Exception - { - SetMarketParams ( - valParams.valueDate(), - mktParams, - forwardLabel, - fundingLabel, - dblForwardVol, - dblFundingVol, - dblForwardFundingCorr - ); - - String strDump = "\t[" + - FormatUtil.FormatDouble (dblForwardVol, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblFundingVol, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblForwardFundingCorr, 2, 0, 100.) + "%] = "; - - for (int i = 0; i < aCMSFixFloat.length; ++i) { - CaseInsensitiveTreeMap mapOutput = aCMSFixFloat[i].value ( - valParams, - null, - mktParams, - null - ); - - if (0 != i) strDump += " || "; - - double dblFairPremium = mapOutput.get ("FairPremium"); - - strDump += - FormatUtil.FormatDouble (dblFairPremium, 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblFairPremium - dblBaseFairPremium, 2, 0, 10000.); - } - - System.out.println (strDump + " |"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strTenor = "6M"; - String strCurrency = "USD"; - String strMaturityTenor = "5Y"; - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - MergedDiscountForwardCurve dc = MakeDC ( - dtSpot, - strCurrency - ); - - ForwardLabel forwardLabel = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - CurveSurfaceQuoteContainer mktParams = new CurveSurfaceQuoteContainer(); - - mktParams.setFundingState (dc); - - FixFloatComponent cmsInAdvance = MakeFixFloatSwap ( - dtSpot, - strCurrency, - forwardLabel, - strMaturityTenor, - false - ); - - FixFloatComponent cmsInArrears = MakeFixFloatSwap ( - dtSpot, - strCurrency, - forwardLabel, - strMaturityTenor, - true - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - double dblBaseFairPremium = cmsInAdvance.value ( - valParams, - null, - mktParams, - null - ).get ("FairPremium"); - - double[] adblForwardVol = new double[] {0.10, 0.30, 0.50}; - - double[] adblFundingVol = new double[] {0.10, 0.30, 0.50}; - - double[] adblForwardFundingCorr = new double[] { - -0.10, 0.25 - }; - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| CMS FIX-FLOAT IN-ADVANCE & IN-ARREARS ANALYSIS|"); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\t| INPUTS: L -> R |"); - - System.out.println ("\t| |"); - - System.out.println ("\t| Forward State Volatility |"); - - System.out.println ("\t| Funding State Volatility |"); - - System.out.println ("\t| Forward-Funding Correlation |"); - - System.out.println ("\t| |"); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\t| OUTPUTS: L -> R |"); - - System.out.println ("\t| |"); - - System.out.println ("\t| In Advance Fair Premium (%) |"); - - System.out.println ("\t| In Advance Fair Premium Basis (bp) |"); - - System.out.println ("\t| In Arrears Fair Premium (%) |"); - - System.out.println ("\t| In Arrears Fair Premium Basis (bp) |"); - - System.out.println ("\t| |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (double dblForwardVol : adblForwardVol) { - for (double dblFundingVol : adblFundingVol) { - for (double dblForwardFundingCorr : adblForwardFundingCorr) { - VolCorrScenario ( - new FixFloatComponent[] { - cmsInAdvance, - cmsInArrears - }, - valParams, - mktParams, - forwardLabel, - FundingLabel.Standard (strCurrency), - dblForwardVol, - dblFundingVol, - dblForwardFundingCorr, - dblBaseFairPremium - ); - } - } - } - - System.out.println ("\t|-----------------------------------------------|"); - } -} diff --git a/org/drip/sample/cms/FloatFloatMetricComparison.java b/org/drip/sample/cms/FloatFloatMetricComparison.java deleted file mode 100644 index af1102c..0000000 --- a/org/drip/sample/cms/FloatFloatMetricComparison.java +++ /dev/null @@ -1,462 +0,0 @@ - -package org.drip.sample.cms; - -import java.util.List; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.market.otc.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FloatFloatMetricComparison demonstrates the Construction and Valuation of an In-Advance and In-Arrears - * Variants of the CMS Float-Float Swap. - * - * @author Lakshmi Krishnamurthy - */ - -public class FloatFloatMetricComparison { - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFutures, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFutures]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFutures, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFutures; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - FixFloatComponent irs = OTCIRS ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate" - }; - - double[] adblSwapQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate", // 30Y - "SwapRate", // 40Y - "SwapRate" // 50Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - adblSwapQuote - ); - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - true - ); - } - - private static final FloatFloatComponent MakeFloatFloatSwap ( - final JulianDate dtEffective, - final String strCurrency, - final String strFloaterTenor, - final String strMaturityTenor, - final boolean bInArrears) - throws Exception - { - ComposableFloatingUnitSetting cfusReference = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFloatingUnitSetting cfusDerived = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCurrency, - strFloaterTenor - ), - bInArrears ? CompositePeriodBuilder.REFERENCE_PERIOD_IN_ARREARS : CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cpsReference = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsDerived = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - List lsReferenceStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - strMaturityTenor, - null - ); - - List lsDerivedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - strMaturityTenor, - null - ); - - Stream referenceStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsReferenceStreamEdgeDate, - cpsReference, - cfusReference - ) - ); - - Stream derivedStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsDerivedStreamEdgeDate, - cpsDerived, - cfusDerived - ) - ); - - FloatFloatComponent floatFloat = new FloatFloatComponent ( - referenceStream, - derivedStream, - new CashSettleParams (0, strCurrency, 0) - ); - - return floatFloat; - } - - private static final double FloatFloatCMSParSpread ( - final String strCurrency, - final String strCMSFloaterTenor, - final String strCMSMaturityTenor, - final boolean bInArrears, - final JulianDate dtSpot, - final CurveSurfaceQuoteContainer mktParams) - throws Exception - { - FloatFloatComponent cms = MakeFloatFloatSwap ( - dtSpot, - strCurrency, - strCMSFloaterTenor, - strCMSMaturityTenor, - bInArrears - ); - - CaseInsensitiveTreeMap mapCMSOutput = cms.value ( - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - null, - mktParams, - null - ); - - return mapCMSOutput.get ("ReferenceParBasisSpread"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - MergedDiscountForwardCurve dc = MakeDC ( - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer mktParams = new CurveSurfaceQuoteContainer(); - - mktParams.setFundingState (dc); - - String[] astrCMSFloaterTenor = new String[] { - "3M", "6M", "12M" - }; - - String[] astrCMSMaturityTenor = new String[] { - "24M", "60M", "10Y", "20Y", "30Y" - }; - - System.out.println ("\n\t|----------------------------------------|"); - - System.out.println ("\t| FLOAT-FLOAT CMS PAR SPREAD: 3M ADVANCE |"); - - System.out.println ("\t|----------------------------------------|"); - - System.out.println ("\t| MATURITY | 3M | 6M | 12M |"); - - System.out.println ("\t|----------------------------------------|"); - - for (String strCMSMaturityTenor : astrCMSMaturityTenor) { - String strDump = "\t| " + strCMSMaturityTenor + " | "; - - for (String strCMSFloaterTenor : astrCMSFloaterTenor) { - double dblParSpread = FloatFloatCMSParSpread ( - strCurrency, - strCMSFloaterTenor, - strCMSMaturityTenor, - false, - dtSpot, - mktParams - ); - - strDump += FormatUtil.FormatDouble (dblParSpread, 2, 1, 1.) + " | "; - } - - System.out.println (strDump); - } - - System.out.println ("\t|----------------------------------------|"); - - System.out.println ("\n\t|----------------------------------------|"); - - System.out.println ("\t| FLOAT-FLOAT CMS PAR SPREAD: 3M ARREARS |"); - - System.out.println ("\t|----------------------------------------|"); - - System.out.println ("\t| MATURITY | 3M | 6M | 12M |"); - - System.out.println ("\t|----------------------------------------|"); - - for (String strCMSMaturityTenor : astrCMSMaturityTenor) { - String strDump = "\t| " + strCMSMaturityTenor + " | "; - - for (String strCMSFloaterTenor : astrCMSFloaterTenor) { - double dblParSpread = FloatFloatCMSParSpread ( - strCurrency, - strCMSFloaterTenor, - strCMSMaturityTenor, - true, - dtSpot, - mktParams - ); - - strDump += FormatUtil.FormatDouble (dblParSpread, 2, 1, 1.) + " | "; - } - - System.out.println (strDump); - } - - System.out.println ("\t|----------------------------------------|"); - } -} diff --git a/org/drip/sample/cms/FloatFloatVarianceAnalysis.java b/org/drip/sample/cms/FloatFloatVarianceAnalysis.java deleted file mode 100644 index 32fe2e5..0000000 --- a/org/drip/sample/cms/FloatFloatVarianceAnalysis.java +++ /dev/null @@ -1,548 +0,0 @@ - -package org.drip.sample.cms; - -import java.util.List; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.market.otc.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FloatFloatVarianceAnalysis demonstrates the Construction and Valuation Impact of Volatility and - * Correlation on the CMS Float-Float Swap. - * - * @author Lakshmi Krishnamurthy - */ - -public class FloatFloatVarianceAnalysis { - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFutures, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFutures]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFutures, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFutures; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - FixFloatComponent irs = OTCIRS ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate" - }; - - double[] adblSwapQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate", // 30Y - "SwapRate", // 40Y - "SwapRate" // 50Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - adblSwapQuote - ); - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - true - ); - } - - private static final FloatFloatComponent MakeFloatFloatSwap ( - final JulianDate dtEffective, - final String strCurrency, - final ForwardLabel forwardLabel, - final String strMaturityTenor, - final boolean bInArrears) - throws Exception - { - ComposableFloatingUnitSetting cfusReference = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFloatingUnitSetting cfusDerived = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - forwardLabel, - bInArrears ? CompositePeriodBuilder.REFERENCE_PERIOD_IN_ARREARS : CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cpsReference = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsDerived = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - List lsReferenceStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - strMaturityTenor, - null - ); - - List lsDerivedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - strMaturityTenor, - null - ); - - Stream referenceStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsReferenceStreamEdgeDate, - cpsReference, - cfusReference - ) - ); - - Stream derivedStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsDerivedStreamEdgeDate, - cpsDerived, - cfusDerived - ) - ); - - FloatFloatComponent floatFloat = new FloatFloatComponent ( - referenceStream, - derivedStream, - new CashSettleParams (0, strCurrency, 0) - ); - - return floatFloat; - } - - private static final void SetMarketParams ( - final int iValueDate, - final CurveSurfaceQuoteContainer mktParams, - final ForwardLabel forwardLabel, - final FundingLabel fundingLabel, - final double dblFundingVol, - final double dblForwardVol, - final double dblForwardFundingCorr) - throws Exception - { - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (forwardLabel), - forwardLabel.currency(), - dblForwardVol - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (fundingLabel), - forwardLabel.currency(), - dblFundingVol - ) - ); - - mktParams.setForwardFundingCorrelation ( - forwardLabel, - fundingLabel, - new FlatUnivariate (dblForwardFundingCorr) - ); - } - - private static final void VolCorrScenario ( - final FloatFloatComponent[] aCMSFloatFloat, - final ValuationParams valParams, - final CurveSurfaceQuoteContainer mktParams, - final ForwardLabel forwardLabel, - final FundingLabel fundingLabel, - final double dblForwardVol, - final double dblFundingVol, - final double dblForwardFundingCorr, - final double dblBaseReferenceParBasisSpread) - throws Exception - { - SetMarketParams ( - valParams.valueDate(), - mktParams, - forwardLabel, - fundingLabel, - dblForwardVol, - dblFundingVol, - dblForwardFundingCorr - ); - - String strDump = "\t[" + - FormatUtil.FormatDouble (dblForwardVol, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblFundingVol, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblForwardFundingCorr, 2, 0, 100.) + "%] = "; - - for (int i = 0; i < aCMSFloatFloat.length; ++i) { - CaseInsensitiveTreeMap mapOutput = aCMSFloatFloat[i].value ( - valParams, - null, - mktParams, - null - ); - - if (0 != i) strDump += " || "; - - double dblReferenceParBasisSpread = mapOutput.get ("ReferenceParBasisSpread"); - - strDump += - FormatUtil.FormatDouble (dblReferenceParBasisSpread, 2, 1, 1.) + " | " + - FormatUtil.FormatDouble (dblReferenceParBasisSpread - dblBaseReferenceParBasisSpread, 2, 1, 1.); - } - - System.out.println (strDump + " |"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strTenor = "6M"; - String strCurrency = "USD"; - String strMaturityTenor = "5Y"; - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - MergedDiscountForwardCurve dc = MakeDC ( - dtSpot, - strCurrency - ); - - ForwardLabel forwardLabel = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - CurveSurfaceQuoteContainer mktParams = new CurveSurfaceQuoteContainer(); - - mktParams.setFundingState (dc); - - FloatFloatComponent cmsInAdvance = MakeFloatFloatSwap ( - dtSpot, - strCurrency, - forwardLabel, - strMaturityTenor, - false - ); - - FloatFloatComponent cmsInArrears = MakeFloatFloatSwap ( - dtSpot, - strCurrency, - forwardLabel, - strMaturityTenor, - true - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - double dblBaseReferenceParBasisSpread = cmsInAdvance.value ( - valParams, - null, - mktParams, - null - ).get ("ReferenceParBasisSpread"); - - double[] adblForwardVol = new double[] { - 0.10, 0.30, 0.50 - }; - - double[] adblFundingVol = new double[] { - 0.10, 0.30, 0.50 - }; - - double[] adblForwardFundingCorr = new double[] { - -0.10, 0.25 - }; - - System.out.println ("\n\n\t|--------------------------------------------------|"); - - System.out.println ("\t| CMS FLOAT-FLOAT IN-ADVANCE & IN-ARREARS ANALYSIS |"); - - System.out.println ("\t|--------------------------------------------------|"); - - System.out.println ("\t| INPUTS: L -> R |"); - - System.out.println ("\t| |"); - - System.out.println ("\t| Forward State Volatility |"); - - System.out.println ("\t| Funding State Volatility |"); - - System.out.println ("\t| Forward-Funding Correlation |"); - - System.out.println ("\t| |"); - - System.out.println ("\t|--------------------------------------------------|"); - - System.out.println ("\t| OUTPUTS: L -> R |"); - - System.out.println ("\t| |"); - - System.out.println ("\t| In Advance Reference Par Basis Spread |"); - - System.out.println ("\t| In Advance Reference Par Basis Spread Change |"); - - System.out.println ("\t| In Arrears Reference Par Basis Spread |"); - - System.out.println ("\t| In Arrears Reference Par Basis Spread Change |"); - - System.out.println ("\t| |"); - - System.out.println ("\t|--------------------------------------------------|"); - - for (double dblForwardVol : adblForwardVol) { - for (double dblFundingVol : adblFundingVol) { - for (double dblForwardFundingCorr : adblForwardFundingCorr) { - VolCorrScenario ( - new FloatFloatComponent[] { - cmsInAdvance, - cmsInArrears - }, - valParams, - mktParams, - forwardLabel, - FundingLabel.Standard (strCurrency), - dblForwardVol, - dblFundingVol, - dblForwardFundingCorr, - dblBaseReferenceParBasisSpread - ); - } - } - } - - System.out.println ("\t|--------------------------------------------------|"); - } -} diff --git a/org/drip/sample/coveringnumber/BoundedFunction.java b/org/drip/sample/coveringnumber/BoundedFunction.java deleted file mode 100644 index e1daad9..0000000 --- a/org/drip/sample/coveringnumber/BoundedFunction.java +++ /dev/null @@ -1,114 +0,0 @@ - -package org.drip.sample.coveringnumber; - -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spaces.cover.L1R1CoveringBounds; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BoundedFunction demonstrates Computation of the Lower and the Upper Bounds for Functions that are - * absolutely Bounded. - * - * @author Lakshmi Krishnamurthy - */ - -public class BoundedFunction { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - L1R1CoveringBounds bfcnVariation = new L1R1CoveringBounds ( - 1., - 1., - Double.NaN - ); - - L1R1CoveringBounds bfcnBounded = new L1R1CoveringBounds ( - 1., - 1., - 1. - ); - - double[] adblCover = new double[] { - 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08 - }; - - System.out.println ("\n\t||------------------------------------------||"); - - System.out.println ("\t|| Bounded Function Covering Number ||"); - - System.out.println ("\t|| ------- -------- -------- ------ ||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| Variation Bound Covering Number Lower ||"); - - System.out.println ("\t|| Variation Bound Covering Number Upper ||"); - - System.out.println ("\t|| Absolute Bound Covering Number Lower ||"); - - System.out.println ("\t|| Absolute Bound Covering Number Upper ||"); - - System.out.println ("\t||------------------------------------------||"); - - for (double dblCover : adblCover) - System.out.println ("\t|| [" + FormatUtil.FormatDouble (dblCover, 1, 2, 1.) + "] => " + - FormatUtil.FormatDouble (Math.log (bfcnVariation.logLowerBound (dblCover)), 1, 2, 1.) + " ->" + - FormatUtil.FormatDouble (Math.log (bfcnVariation.logUpperBound (dblCover)), 1, 2, 1.) + " | " + - FormatUtil.FormatDouble (Math.log (bfcnBounded.logLowerBound (dblCover)), 1, 2, 1.) + " ->" + - FormatUtil.FormatDouble (Math.log (bfcnBounded.logUpperBound (dblCover)), 1, 2, 1.) + " ||" - ); - - System.out.println ("\t||------------------------------------------||"); - } -} diff --git a/org/drip/sample/coveringnumber/ScaleSensitiveFunction.java b/org/drip/sample/coveringnumber/ScaleSensitiveFunction.java deleted file mode 100644 index c4faa5c..0000000 --- a/org/drip/sample/coveringnumber/ScaleSensitiveFunction.java +++ /dev/null @@ -1,122 +0,0 @@ - -package org.drip.sample.coveringnumber; - -import org.drip.function.definition.R1ToR1; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spaces.cover.ScaleSensitiveCoveringBounds; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ScaleSensitiveFunction demonstrates Computation of the Restricted Covers, Restricted Probability Bounds, - * the Lower Bounds, and the Upper Bounds for Functions that are absolutely Bounded. - * - * @author Lakshmi Krishnamurthy - */ - -public class ScaleSensitiveFunction { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - final int iSampleSize = 10; - - R1ToR1 auFatShatter = new R1ToR1 (null) { - @Override public double evaluate ( - final double dblX) - throws Exception - { - return iSampleSize; - } - }; - - ScaleSensitiveCoveringBounds sscn = new ScaleSensitiveCoveringBounds ( - auFatShatter, - iSampleSize - ); - - double[] adblCover = new double[] { - 500., 600., 700., 800., 900., 960. - }; - - System.out.println ("\n\t||------------------------------------------------||"); - - System.out.println ("\t|| Scale Sensitive Covering Numbers ||"); - - System.out.println ("\t|| ----- --------- -------- ------- ||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| Sample Size Lower Bound ||"); - - System.out.println ("\t|| Restricted Subset Cardinality ||"); - - System.out.println ("\t|| Probability of the Cover Weight Upper Bound ||"); - - System.out.println ("\t|| Log Log Covering Number Lower Bound ||"); - - System.out.println ("\t|| Log Log Covering Number Upper Bound ||"); - - System.out.println ("\t||------------------------------------------------||"); - - for (double dblCover : adblCover) - System.out.println ("\t|| [" + FormatUtil.FormatDouble (dblCover, 3, 0, 1.) + "] => " + - FormatUtil.FormatDouble (sscn.sampleSizeLowerBound (dblCover), 1, 1, 1.) + " |" + - FormatUtil.FormatDouble (sscn.restrictedSubsetCardinality (dblCover), 3, 0, 1.) + " | " + - FormatUtil.FormatDouble (sscn.upperProbabilityBoundWeight (dblCover), 5, 0, 1.) + " | " + - FormatUtil.FormatDouble (Math.log (sscn.logLowerBound (dblCover)), 1, 2, 1.) + " -> " + - FormatUtil.FormatDouble (Math.log (sscn.logUpperBound (dblCover)), 1, 2, 1.) + " ||" - ); - - System.out.println ("\t||------------------------------------------------||"); - } -} diff --git a/org/drip/sample/credit/BuiltInCDSPortfolioDefinitions.java b/org/drip/sample/credit/BuiltInCDSPortfolioDefinitions.java deleted file mode 100644 index e15a90a..0000000 --- a/org/drip/sample/credit/BuiltInCDSPortfolioDefinitions.java +++ /dev/null @@ -1,185 +0,0 @@ - -package org.drip.sample.credit; - -/* - * Generic imports - */ - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.CaseInsensitiveTreeMap; -import org.drip.product.definition.*; -import org.drip.service.env.EnvManager; -import org.drip.service.env.StandardCDXManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * BuiltInCDSPortfolioDefinitions displays the Built-in CDS Portfolios. It shows the following: - * - * - Construct the CDX.NA.IG 5Y Series 17 index by name and series. - * - Construct the on-the-run CDX.NA.IG 5Y Series index. - * - List all the built-in CDX's - their names and descriptions. - * - Construct the on-the run CDX.EM 5Y corresponding to T - 1Y. - * - Construct the on-the run ITRAXX.ENERGY 5Y corresponding to T - 7Y. - * - Retrieve the full set of date/index series set for ITRAXX.ENERGY. - * - * @author Lakshmi Krishnamurthy - */ - -public class BuiltInCDSPortfolioDefinitions { - - /* - * Sample demonstrating the creation/usage of the CDX API - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void BasketCDSAPISample() - { - JulianDate dtToday = DateUtil.CreateFromYMD ( - 2013, - DateUtil.MAY, - 10 - ); - - /* - * Construct the CDX.NA.IG 5Y Series 17 index by name and series - */ - - /* BasketProduct bpCDX = CreditAnalytics.MakeCDX ( - "CDX.NA.IG", - 17, - "5Y" - ); */ - - /* - * Construct the on-the-run CDX.NA.IG 5Y Series index - */ - - /* BasketProduct bpCDXOTR = CreditAnalytics.MakeCDX ( - "CDX.NA.IG", - dtToday, - "5Y" - ); */ - - /* - * List of all the built-in CDX names - */ - - Set setstrCDXNames = StandardCDXManager.GetCDXNames(); - - /* - * Descriptions of all the built-in CDX names - */ - - CaseInsensitiveTreeMap mapCDXDescr = StandardCDXManager.GetCDXDescriptions(); - - /* - * Construct the on-the run CDX.EM 5Y corresponding to T - 1Y - */ - - BasketProduct bpPresetOTR = StandardCDXManager.GetOnTheRun ( - "CDX.EM", - dtToday.subtractTenor ("1Y"), - "5Y" - ); - - /* - * Construct the on-the run ITRAXX.ENERGY 5Y corresponding to T - 7Y - */ - - BasketProduct bpPreLoadedOTR = StandardCDXManager.GetOnTheRun ( - "ITRAXX.ENERGY", - dtToday.subtractTenor ("7Y"), - "5Y" - ); - - /* - * Retrieve the full set of date/index series set for ITRAXX.ENERGY - */ - - Map mapCDXSeries = StandardCDXManager.GetCDXSeriesMap ("ITRAXX.ENERGY"); - - // System.out.println (bpCDX.name() + ": " + bpCDX.effective() + "=>" + bpCDX.maturity()); - - // System.out.println (bpCDXOTR.name() + ": " + bpCDXOTR.effective() + "=>" + bpCDXOTR.maturity()); - - int i = 0; - - for (String strCDX : setstrCDXNames) - System.out.println ("CDX[" + i++ + "]: " + strCDX); - - for (Map.Entry meCDXDescr : mapCDXDescr.entrySet()) - System.out.println ("[" + meCDXDescr.getKey() + "]: " + meCDXDescr.getValue()); - - System.out.println (bpPresetOTR.name() + ": " + bpPresetOTR.effective() + "=>" + bpPresetOTR.maturity()); - - System.out.println (bpPreLoadedOTR.name() + ": " + bpPreLoadedOTR.effective() + "=>" + bpPreLoadedOTR.maturity()); - - for (Map.Entry me : mapCDXSeries.entrySet()) - System.out.println ("ITRAXX.ENERGY[" + me.getValue() + "]: " + me.getKey()); - } - - public static final void main ( - final String astrArgs[]) - throws Exception - { - // String strConfig = "c:\\Lakshmi\\BondAnal\\Config.xml"; - - String strConfig = ""; - - EnvManager.InitEnv (strConfig); - - BasketCDSAPISample(); - } -} diff --git a/org/drip/sample/credit/CDSBasketMeasures.java b/org/drip/sample/credit/CDSBasketMeasures.java deleted file mode 100644 index 9ca0315..0000000 --- a/org/drip/sample/credit/CDSBasketMeasures.java +++ /dev/null @@ -1,399 +0,0 @@ - -package org.drip.sample.credit; - -/* - * Credit Product Imports - */ - -import org.drip.analytics.date.*; -import org.drip.analytics.daycount.Convention; -import org.drip.analytics.support.*; -import org.drip.market.otc.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.pricer.CreditPricerParams; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.credit.*; -import org.drip.product.definition.*; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.credit.CreditCurve; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * CDSBasketMeasures contains a demo of the CDS Basket Measures Generation Sample. It shows the following: - * - * - Build the IR Curve from the Rates' instruments. - * - Build the Component Credit Curve from the CDS instruments. - * - Create the basket market parameters and add the named discount curve and the credit curves to it. - * - Create the CDS basket from the component CDS and their weights. - * - Construct the Valuation and the Pricing Parameters. - * - Generate the CDS basket measures from the valuation, the pricer, and the market parameters. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDSBasketMeasures { - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Sample demonstrating creation of a rates curve from instruments - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static MergedDiscountForwardCurve BuildRatesCurveFromInstruments ( - final JulianDate dtStart, - final String[] astrCashTenor, - final double[] adblCashRate, - final String[] astrIRSTenor, - final double[] adblIRSRate, - final double dblBump, - final String strCurrency) - throws Exception - { - int iNumDCInstruments = astrCashTenor.length + adblIRSRate.length; - int aiDate[] = new int[iNumDCInstruments]; - double adblRate[] = new double[iNumDCInstruments]; - String astrCalibMeasure[] = new String[iNumDCInstruments]; - double adblCompCalibValue[] = new double[iNumDCInstruments]; - CalibratableComponent aCompCalib[] = new CalibratableComponent[iNumDCInstruments]; - - // Cash Calibration - - JulianDate dtCashEffective = dtStart.addBusDays (1, strCurrency); - - for (int i = 0; i < astrCashTenor.length; ++i) { - astrCalibMeasure[i] = "Rate"; - adblRate[i] = java.lang.Double.NaN; - adblCompCalibValue[i] = adblCashRate[i] + dblBump; - - aCompCalib[i] = SingleStreamComponentBuilder.Deposit ( - dtCashEffective, - new JulianDate (aiDate[i] = dtCashEffective.addTenor (astrCashTenor[i]).julian()), - ForwardLabel.Create ( - strCurrency, - astrCashTenor[i] - ) - ); - } - - // IRS Calibration - - JulianDate dtIRSEffective = dtStart.addBusDays ( - 2, - strCurrency - ); - - for (int i = 0; i < astrIRSTenor.length; ++i) { - astrCalibMeasure[i + astrCashTenor.length] = "Rate"; - adblRate[i + astrCashTenor.length] = java.lang.Double.NaN; - adblCompCalibValue[i + astrCashTenor.length] = adblIRSRate[i] + dblBump; - - aiDate[i + astrCashTenor.length] = dtIRSEffective.addTenor (astrIRSTenor[i]).julian(); - - aCompCalib[i + astrCashTenor.length] = OTCIRS ( - dtIRSEffective, - strCurrency, - astrIRSTenor[i], - 0. - ); - } - - /* - * Build the IR curve from the components, their calibration measures, and their calibration quotes. - */ - - return ScenarioDiscountCurveBuilder.NonlinearBuild ( - dtStart, - strCurrency, - aCompCalib, - adblCompCalibValue, - astrCalibMeasure, - null - ); - } - - /* - * Sample demonstrating the creation/usage of the Credit Curve from CDS Instruments - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static CreditCurve CreateCreditCurveFromCDS ( - final JulianDate dtStart, - final double[] adblQuote, - final String[] astrTenor, - final MergedDiscountForwardCurve dc, - final double dblRecovery, - final String strCCName) - throws Exception - { - String[] astrCalibMeasure = new String[adblQuote.length]; - CreditDefaultSwap[] aCDS = new CreditDefaultSwap[adblQuote.length]; - - for (int i = 0; i < astrTenor.length; ++i) { - aCDS[i] = CDSBuilder.CreateSNAC ( - dtStart, - astrTenor[i], - 0.01, - strCCName - ); - - astrCalibMeasure[i] = "FairPremium"; - } - - /* - * Build the credit curve from the CDS instruments and the fair premium - */ - - return ScenarioCreditCurveBuilder.Custom ( - strCCName, - dtStart, - aCDS, - dc, - adblQuote, - astrCalibMeasure, - dblRecovery, - false - ); - } - - /* - * Sample demonstrating the creation/usage of the bond basket API - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - public static final void BasketBondAPISample() - throws Exception - { - JulianDate dtCurve = DateUtil.CreateFromYMD ( - 2013, - 6, - 27 - ); - - JulianDate dtSettle = DateUtil.CreateFromYMD ( - 2013, - 7, - 1 - ); - - /* - * Build the IR Curve from the Rates' instruments - */ - - String[] astrCashTenor = new String[] { - "3M" - }; - double[] adblCashRate = new double[] { - 0.00276 - }; - String[] astrIRSTenor = new String[] { "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", - "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y"}; - double[] adblIRSRate = new double[] {0.00367, 0.00533, 0.00843, 0.01238, 0.01609, 0.01926, 0.02191, - 0.02406, 0.02588, 0.02741, 0.02870, 0.02982, 0.03208, 0.03372, 0.03445, 0.03484, 0.03501, 0.03484}; - - MergedDiscountForwardCurve dc = BuildRatesCurveFromInstruments ( - dtCurve, - astrCashTenor, - adblCashRate, - astrIRSTenor, - adblIRSRate, - 0., - "USD" - ); - - /* - * Build the Component Credit Curve from the CDS instruments - */ - - CreditCurve ccCHN = CreateCreditCurveFromCDS (dtCurve, - new double[] {100., 100., 100., 100., 100., 100., 100., 100.}, - new String[] {"6M", "1Y", "2Y", "3Y", "4Y", "5Y", "7Y", "10Y"}, dc, 0.4, "CHN"); - - CreditCurve ccIND = CreateCreditCurveFromCDS (dtCurve, - new double[] {100., 100., 100., 100., 100., 100., 100., 100.}, - new String[] {"6M", "1Y", "2Y", "3Y", "4Y", "5Y", "7Y", "10Y"}, dc, 0.4, "IND"); - - CreditCurve ccBRA = CreateCreditCurveFromCDS (dtCurve, - new double[] {100., 100., 100., 100., 100., 100., 100., 100.}, - new String[] {"6M", "1Y", "2Y", "3Y", "4Y", "5Y", "7Y", "10Y"}, dc, 0.4, "BRA"); - - CreditCurve ccRUS = CreateCreditCurveFromCDS (dtCurve, - new double[] {100., 100., 100., 100., 100., 100., 100., 100.}, - new String[] {"6M", "1Y", "2Y", "3Y", "4Y", "5Y", "7Y", "10Y"}, dc, 0.4, "RUS"); - - CreditCurve ccKOR = CreateCreditCurveFromCDS (dtCurve, - new double[] {100., 100., 100., 100., 100., 100., 100., 100.}, - new String[] {"6M", "1Y", "2Y", "3Y", "4Y", "5Y", "7Y", "10Y"}, dc, 0.4, "KOR"); - - CreditCurve ccTUR = CreateCreditCurveFromCDS (dtCurve, - new double[] {100., 100., 100., 100., 100., 100., 100., 100.}, - new String[] {"6M", "1Y", "2Y", "3Y", "4Y", "5Y", "7Y", "10Y"}, dc, 0.4, "TUR"); - - /* - * Create the basket market parameters and add the named discount curve and the credit curves to it. - */ - - CurveSurfaceQuoteContainer mktParams = new CurveSurfaceQuoteContainer(); - - mktParams.setFundingState (dc); - - mktParams.setCreditState (ccCHN); - - mktParams.setCreditState (ccIND); - - mktParams.setCreditState (ccBRA); - - mktParams.setCreditState (ccRUS); - - mktParams.setCreditState (ccKOR); - - mktParams.setCreditState (ccTUR); - - /* - * Create the CDS basket from the component CDS and their weights - */ - - CreditDefaultSwap aCDS[] = new CreditDefaultSwap[6]; - - aCDS[0] = CDSBuilder.CreateSNAC (dtCurve, "5Y", 0.01, "CHN"); - - aCDS[1] = CDSBuilder.CreateSNAC (dtCurve, "5Y", 0.01, "IND"); - - aCDS[2] = CDSBuilder.CreateSNAC (dtCurve, "5Y", 0.01, "BRA"); - - aCDS[3] = CDSBuilder.CreateSNAC (dtCurve, "5Y", 0.01, "RUS"); - - aCDS[4] = CDSBuilder.CreateSNAC (dtCurve, "5Y", 0.01, "KOR"); - - aCDS[5] = CDSBuilder.CreateSNAC (dtCurve, "5Y", 0.01, "TUR"); - - BasketProduct bds = new CDSBasket (aCDS, new double[] {1., 2., 3., 4., 5., 6.}, "BRIC"); - - /* - * Construct the Valuation and the Pricing Parameters - */ - - ValuationParams valParams = ValuationParams.Spot ( - dtSettle, - 0, - "USD", - Convention.DATE_ROLL_ACTUAL - ); - - CreditPricerParams pricerParams = new CreditPricerParams ( - 7, - null, - false, - CreditPricerParams.PERIOD_DISCRETIZATION_FULL_COUPON - ); - - /* - * Generate the CDS basket measures from the valuation, the pricer, and the market parameters - */ - - CaseInsensitiveTreeMap mapResult = bds.value ( - valParams, - pricerParams, - mktParams, - null - ); - - System.out.println ("Accrued: " + FormatUtil.FormatDouble (mapResult.get ("Accrued"), 0, 2, 100.)); - - System.out.println ("Clean PV: " + FormatUtil.FormatDouble (mapResult.get ("CleanPV"), 0, 2, 1.)); - - System.out.println ("Fair Premium: " + FormatUtil.FormatDouble (mapResult.get ("FairPremium"), 0, 2, 1.)); - - System.out.println ("Fair Upfront: " + FormatUtil.FormatDouble (mapResult.get ("FairUpfront"), 0, 2, 1.)); - } - - public static final void main ( - final String astrArgs[]) - throws Exception - { - // String strConfig = "c:\\Lakshmi\\BondAnal\\Config.xml"; - - String strConfig = ""; - - EnvManager.InitEnv (strConfig); - - BasketBondAPISample(); - } -} diff --git a/org/drip/sample/credit/CDSCashFlowMeasures.java b/org/drip/sample/credit/CDSCashFlowMeasures.java deleted file mode 100644 index 6a60497..0000000 --- a/org/drip/sample/credit/CDSCashFlowMeasures.java +++ /dev/null @@ -1,356 +0,0 @@ - -package org.drip.sample.credit; - -/* - * Credit Product import - */ - -import org.drip.analytics.cashflow.*; -import org.drip.analytics.date.*; -import org.drip.analytics.daycount.Convention; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.pricer.CreditPricerParams; -import org.drip.param.valuation.*; -import org.drip.product.definition.*; -import org.drip.param.creator.*; -import org.drip.product.creator.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.credit.CreditCurve; -import org.drip.state.discount.MergedDiscountForwardCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * CDSCashFlowMeasures contains a demo of the CDS Measures and Cash flow Generation Sample. It illustrates - * the following: - * - * - Credit Curve Creation: From flat Hazard Rate, and from an array of dates and their corresponding - * survival probabilities. - * - Create Credit Curve from CDS instruments, and recover the input measure quotes. - * - Create an SNAC CDS, price it, and display the coupon/loss cash flow. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDSCashFlowMeasures { - private static final java.lang.String FIELD_SEPARATOR = " "; - - /* - * Sample API demonstrating the creation/usage of the credit curve from survival and hazard rates - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void CreditCurveAPISample() - throws Exception - { - JulianDate dtStart = DateUtil.Today(); - - JulianDate dt10Y = dtStart.addYears (10); - - /* - * Create Credit Curve from flat Hazard Rate - */ - - CreditCurve ccFlatHazard = ScenarioCreditCurveBuilder.FlatHazard ( - dtStart.julian(), - "CC", - "USD", - 0.02, - 0.4 - ); - - System.out.println ("CCFromFlatHazard[" + dt10Y.toString() + "]; Survival=" + - ccFlatHazard.survival ("10Y") + "; Hazard=" + ccFlatHazard.hazard ("10Y")); - - int[] aiDate = new int[5]; - double[] adblSurvival = new double[5]; - - for (int i = 0; i < 5; ++i) { - aiDate[i] = dtStart.addYears (2 * i + 2).julian(); - - adblSurvival[i] = 1. - 0.1 * (i + 1); - } - - /* - * Create Credit Curve from an array of dates and their corresponding survival probabilities - */ - - CreditCurve ccFromSurvival = ScenarioCreditCurveBuilder.Survival ( - dtStart.julian(), - "CC", - "USD", - aiDate, - adblSurvival, - 0.4 - ); - - System.out.println ("CCFromSurvival[" + dt10Y.toString() + "]; Survival=" + - ccFromSurvival.survival ("10Y") + "; Hazard=" + ccFromSurvival.hazard ("10Y")); - } - - /* - * Sample API demonstrating the creation of the Credit Curve from the CDS instruments - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static void CreateCreditCurveFromCDSInstruments() - throws Exception - { - JulianDate dtStart = DateUtil.Today(); - - /* - * Populate the instruments, the calibration measures, and the calibration quotes - */ - - double[] adblQuotes = new double[5]; - String[] astrCalibMeasure = new String[5]; - CreditDefaultSwap[] aCDS = new CreditDefaultSwap[5]; - - for (int i = 0; i < 5; ++i) { - /* - * The Calibration CDS - */ - - aCDS[i] = CDSBuilder.CreateSNAC ( - dtStart, - (i + 1) + "Y", - 0.01, - "CORP" - ); - - /* - * Calibration Quote - */ - - adblQuotes[i] = 100.; - - /* - * Calibration Measure - */ - - astrCalibMeasure[i] = "FairPremium"; - } - - /* - * Flat Discount Curve - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - dtStart, - "USD", - 0.05 - ); - - /* - * Create the Credit Curve from the give CDS instruments - */ - - CreditCurve cc = ScenarioCreditCurveBuilder.Custom ( - "CORP", - dtStart, - aCDS, - dc, - adblQuotes, - astrCalibMeasure, - 0.4, - false - ); - - /* - * Valuation Parameters - */ - - ValuationParams valParams = ValuationParams.Spot ( - dtStart, - 0, - "", - Convention.DATE_ROLL_ACTUAL - ); - - /* - * Standard Credit Pricer Parameters (check javadoc for details) - */ - - CreditPricerParams pricerParams = CreditPricerParams.Standard(); - - /* - * Re-calculate the input calibration measures for the input CDSes - */ - - for (int i = 0; i < aCDS.length; ++i) - System.out.println ( - "\t" + astrCalibMeasure[i] + "[" + i + "] = " + - aCDS[i].measureValue ( - valParams, pricerParams, MarketParamsBuilder.Create ( - dc, - null, - null, - cc, - null, - null, - null, - null - ), - null, - astrCalibMeasure[i] - ) - ); - } - - /* - * Sample API demonstrating the display of the CDS coupon and loss cash flow - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void CDSAPISample() - throws Exception - { - JulianDate dtStart = DateUtil.Today(); - - /* - * Flat Discount Curve - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - dtStart, - "USD", - 0.05 - ); - - /* - * Flat Credit Curve - */ - - CreditCurve cc = ScenarioCreditCurveBuilder.FlatHazard ( - dtStart.julian(), - "CC", - "USD", - 0.02, - 0.4 - ); - - /* - * Component Market Parameters built from the Discount and the Credit Curves - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Credit ( - dc, - cc - ); - - /* - * Create an SNAC CDS - */ - - CreditDefaultSwap cds = CDSBuilder.CreateSNAC ( - dtStart, - "5Y", - 0.1, - "CC" - ); - - /* - * Valuation Parameters - */ - - ValuationParams valParams = ValuationParams.Spot ( - dtStart, - 0, - "", - Convention.DATE_ROLL_ACTUAL - ); - - /* - * Standard Credit Pricer Parameters (check javadoc for details) - */ - - CreditPricerParams pricerParams = CreditPricerParams.Standard(); - - System.out.println ("Loss Start Loss End Notl Rec EffDF StartSurv EndSurv"); - - System.out.println ("---------- -------- ---- --- ----- --------- -------"); - - /* - * CDS Loss Cash Flow - */ - - for (LossQuadratureMetrics dp : cds.lossFlow (valParams, pricerParams, mktParams)) - System.out.println ( - DateUtil.YYYYMMDD (dp.startDate()) + FIELD_SEPARATOR + - DateUtil.YYYYMMDD (dp.endDate()) + FIELD_SEPARATOR + - FormatUtil.FormatDouble (dp.effectiveNotional(), 1, 0, 1.) + FIELD_SEPARATOR + - FormatUtil.FormatDouble (dp.effectiveRecovery(), 1, 2, 1.) + FIELD_SEPARATOR + - FormatUtil.FormatDouble (dp.effectiveDF(), 1, 4, 1.) + FIELD_SEPARATOR + - FormatUtil.FormatDouble (dp.startSurvival(), 1, 4, 1.) + FIELD_SEPARATOR + - FormatUtil.FormatDouble (dp.endSurvival(), 1, 4, 1.) - ); - } - - public static final void main ( - final String astrArgs[]) - throws Exception - { - // String strConfig = "c:\\Lakshmi\\BondAnal\\Config.xml"; - - EnvManager.InitEnv (""); - - CreditCurveAPISample(); - - CreateCreditCurveFromCDSInstruments(); - - CDSAPISample(); - } -} diff --git a/org/drip/sample/credit/CDSValuationMetrics.java b/org/drip/sample/credit/CDSValuationMetrics.java deleted file mode 100644 index 8912c95..0000000 --- a/org/drip/sample/credit/CDSValuationMetrics.java +++ /dev/null @@ -1,432 +0,0 @@ - -package org.drip.sample.credit; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.market.otc.*; -import org.drip.param.creator.MarketParamsBuilder; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.pricer.CreditPricerParams; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.creator.*; -import org.drip.product.definition.*; -import org.drip.product.rates.FixFloatComponent; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.credit.CreditCurve; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDSValuationMetrics contains the Demonstration of Valuing a Payer/Receiver CDS European Option - * Sample. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDSValuationMetrics { - - private static final FixFloatComponent OTCFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFutures, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFutures]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFutures, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFutures; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate" - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate", // 30Y - "SwapRate", // 40Y - "SwapRate" // 50Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - "USD" - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - } - - /* - * Sample API demonstrating the creation of the Credit Curve from the CDS instruments - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static CreditCurve MakeCC ( - final JulianDate dtSpot, - final String strCreditCurve, - final MergedDiscountForwardCurve dcFunding) - throws Exception - { - /* - * Populate the instruments, the calibration measures, and the calibration quotes - */ - - double[] adblQuotes = new double[5]; - String[] astrCalibMeasure = new String[5]; - CreditDefaultSwap[] aCDS = new CreditDefaultSwap[5]; - - for (int i = 0; i < 5; ++i) { - - /* - * The Calibration CDS - */ - - aCDS[i] = CDSBuilder.CreateSNAC ( - dtSpot, - (i + 1) + "Y", - 0.01, - strCreditCurve - ); - - /* - * Calibration Quote - */ - - adblQuotes[i] = 100.; - - /* - * Calibration Measure - */ - - astrCalibMeasure[i] = "FairPremium"; - } - - /* - * Create the Credit Curve from the give CDS instruments - */ - - CreditCurve cc = ScenarioCreditCurveBuilder.Custom ( - strCreditCurve, - dtSpot, - aCDS, - dcFunding, - adblQuotes, - astrCalibMeasure, - 0.4, - false - ); - - /* - * Valuation Parameters - */ - - ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); - - /* - * Standard Credit Pricer Parameters (check javadoc for details) - */ - - CreditPricerParams pricerParams = CreditPricerParams.Standard(); - - /* - * Re-calculate the input calibration measures for the input CDSes - */ - - for (int i = 0; i < aCDS.length; ++i) - System.out.println ( - "\t" + astrCalibMeasure[i] + "[" + i + "] = " + - aCDS[i].measureValue ( - valParams, pricerParams, MarketParamsBuilder.Create ( - dcFunding, - null, - null, - cc, - null, - null, - null, - null - ), - null, - astrCalibMeasure[i] - ) - ); - - return cc; - } - - /* - * Sample API demonstrating the display of the CDS coupon and loss cash flow - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "USD"; - String strCreditCurve = "DB"; - String strCDSForwardStartTenor = "3M"; - String strCDSMaturityTenor = "5Y"; - double dblCDSCoupon = 0.1; - - MergedDiscountForwardCurve dcFunding = MakeDC ( - dtSpot, - strCurrency - ); - - CreditCurve cc = MakeCC ( - dtSpot, - strCreditCurve, - dcFunding - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Credit ( - dcFunding, - cc - ); - - CreditDefaultSwap cdsForward = CDSBuilder.CreateSNAC ( - dtSpot.addTenor (strCDSForwardStartTenor), - strCDSMaturityTenor, - dblCDSCoupon, - strCreditCurve - ); - - ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); - - CreditPricerParams pricerParams = CreditPricerParams.Standard(); - - Map mapCDSForward = cdsForward.value ( - valParams, - pricerParams, - csqc, - null - ); - - for (Map.Entry me : mapCDSForward.entrySet()) - System.out.println (me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/credit/CreditIndexDefinitions.java b/org/drip/sample/credit/CreditIndexDefinitions.java deleted file mode 100644 index e47c798..0000000 --- a/org/drip/sample/credit/CreditIndexDefinitions.java +++ /dev/null @@ -1,158 +0,0 @@ - -package org.drip.sample.credit; - -import org.drip.market.otc.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CreditIndexDefinitions displays the Definitions of the CDX NA IG OTC Index CDS Contracts. - * - * @author Lakshmi Krishnamurthy - */ - -public class CreditIndexDefinitions { - - private static final void DisplayIndexConvention ( - final String strFullIndexName) - throws Exception - { - CreditIndexConvention cic = CreditIndexConventionContainer.ConventionFromFullName (strFullIndexName); - - System.out.println ( - "\t| " + cic.fullName() + - " | " + cic.indexType() + - " | " + cic.indexSubType() + - " | " + cic.seriesName() + - " | " + cic.currency() + - " | " + cic.effectiveDate() + - " | " + cic.maturityDate() + - " | " + cic.frequency() + - " | " + cic.dayCount() + - " | " + FormatUtil.FormatDouble (cic.fixedCoupon(), 3, 0, 10000.) + - " | " + FormatUtil.FormatDouble (cic.recoveryRate(), 2, 0, 100.) + - "% | " + cic.numberOfConstituents() + " ||" - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrFullIndexName = new String[] { - "CDX.NA.IG.S15.5Y", - "CDX.NA.IG.S16.5Y", - "CDX.NA.IG.S17.5Y", - "CDX.NA.IG.S18.5Y", - "CDX.NA.IG.S19.5Y", - "CDX.NA.IG.S20.5Y", - "CDX.NA.IG.S21.5Y", - "CDX.NA.IG.S22.5Y", - "CDX.NA.IG.S23.5Y", - "CDX.NA.IG.S24.5Y", - "CDX.NA.IG.S25.5Y", - "CDX.NA.IG.S26.5Y" - }; - - System.out.println ("\n"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| CDX NA IG OTC INDEX DEFINITIONS ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| - Full Name ||"); - - System.out.println ("\t| - Index Type ||"); - - System.out.println ("\t| - Index Sub-Type ||"); - - System.out.println ("\t| - Series Name ||"); - - System.out.println ("\t| - Currency ||"); - - System.out.println ("\t| - Effective Date ||"); - - System.out.println ("\t| - Maturity Date ||"); - - System.out.println ("\t| - Coupon/Pay Frequency ||"); - - System.out.println ("\t| - Coupon/Pay Day Count ||"); - - System.out.println ("\t| - Fixed Coupon Strike (bp) ||"); - - System.out.println ("\t| - Fixed Recovery Rate ||"); - - System.out.println ("\t| - Number of Constituents ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------||"); - - for (String strFullIndexName : astrFullIndexName) - DisplayIndexConvention (strFullIndexName); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n"); - } -} diff --git a/org/drip/sample/creditfeed/CDXNAIGS155YReconstitutor.java b/org/drip/sample/creditfeed/CDXNAIGS155YReconstitutor.java deleted file mode 100644 index 3bf0c83..0000000 --- a/org/drip/sample/creditfeed/CDXNAIGS155YReconstitutor.java +++ /dev/null @@ -1,83 +0,0 @@ - -package org.drip.sample.creditfeed; - -import org.drip.feed.transformer.CreditCDSIndexMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS155YReconstitutor Cleanses the Input CDX.NA.IG S15 5Y CDS Price Marks and saves them into a usable - * and Process-able Format. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS155YReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iQuotedSpreadIndex = 1; - String strCurrency = "USD"; - String strFullCreditIndexName = "CDX.NA.IG.S15.5Y"; - String strCreditIndexMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\CreditMarks\\" + strFullCreditIndexName + ".Formatted.csv"; - String strFundingFixingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "CreditFixingReconstitutor.csv"; - - CreditCDSIndexMarksReconstitutor.RegularizeCloses ( - strFundingFixingMarksLocation, - strCreditIndexMarksLocation, - strFullCreditIndexName, - iSpotDateIndex, - iQuotedSpreadIndex - ); - } -} diff --git a/org/drip/sample/creditfeed/CDXNAIGS165YReconstitutor.java b/org/drip/sample/creditfeed/CDXNAIGS165YReconstitutor.java deleted file mode 100644 index ac5310a..0000000 --- a/org/drip/sample/creditfeed/CDXNAIGS165YReconstitutor.java +++ /dev/null @@ -1,83 +0,0 @@ - -package org.drip.sample.creditfeed; - -import org.drip.feed.transformer.CreditCDSIndexMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS165YReconstitutor Cleanses the Input CDX.NA.IG S16 5Y CDS Price Marks and saves them into a usable - * and Process-able Format. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS165YReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iQuotedSpreadIndex = 1; - String strCurrency = "USD"; - String strFullCreditIndexName = "CDX.NA.IG.S16.5Y"; - String strCreditIndexMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\CreditMarks\\" + strFullCreditIndexName + ".Formatted.csv"; - String strFundingFixingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "CreditFixingReconstitutor.csv"; - - CreditCDSIndexMarksReconstitutor.RegularizeCloses ( - strFundingFixingMarksLocation, - strCreditIndexMarksLocation, - strFullCreditIndexName, - iSpotDateIndex, - iQuotedSpreadIndex - ); - } -} diff --git a/org/drip/sample/creditfeed/CDXNAIGS175YReconstitutor.java b/org/drip/sample/creditfeed/CDXNAIGS175YReconstitutor.java deleted file mode 100644 index 19e6909..0000000 --- a/org/drip/sample/creditfeed/CDXNAIGS175YReconstitutor.java +++ /dev/null @@ -1,83 +0,0 @@ - -package org.drip.sample.creditfeed; - -import org.drip.feed.transformer.CreditCDSIndexMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS175YReconstitutor Cleanses the Input CDX.NA.IG S17 5Y CDS Price Marks and saves them into a usable - * and Process-able Format. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS175YReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iQuotedSpreadIndex = 1; - String strCurrency = "USD"; - String strFullCreditIndexName = "CDX.NA.IG.S17.5Y"; - String strCreditIndexMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\CreditMarks\\" + strFullCreditIndexName + ".Formatted.csv"; - String strFundingFixingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "CreditFixingReconstitutor.csv"; - - CreditCDSIndexMarksReconstitutor.RegularizeCloses ( - strFundingFixingMarksLocation, - strCreditIndexMarksLocation, - strFullCreditIndexName, - iSpotDateIndex, - iQuotedSpreadIndex - ); - } -} diff --git a/org/drip/sample/creditfeed/CDXNAIGS185YReconstitutor.java b/org/drip/sample/creditfeed/CDXNAIGS185YReconstitutor.java deleted file mode 100644 index 87ee129..0000000 --- a/org/drip/sample/creditfeed/CDXNAIGS185YReconstitutor.java +++ /dev/null @@ -1,83 +0,0 @@ - -package org.drip.sample.creditfeed; - -import org.drip.feed.transformer.CreditCDSIndexMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS185YReconstitutor Cleanses the Input CDX.NA.IG S18 5Y CDS Price Marks and saves them into a usable - * and Process-able Format. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS185YReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iQuotedSpreadIndex = 1; - String strCurrency = "USD"; - String strFullCreditIndexName = "CDX.NA.IG.S18.5Y"; - String strCreditIndexMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\CreditMarks\\" + strFullCreditIndexName + ".Formatted.csv"; - String strFundingFixingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "CreditFixingReconstitutor.csv"; - - CreditCDSIndexMarksReconstitutor.RegularizeCloses ( - strFundingFixingMarksLocation, - strCreditIndexMarksLocation, - strFullCreditIndexName, - iSpotDateIndex, - iQuotedSpreadIndex - ); - } -} diff --git a/org/drip/sample/creditfeed/CDXNAIGS195YReconstitutor.java b/org/drip/sample/creditfeed/CDXNAIGS195YReconstitutor.java deleted file mode 100644 index f1ee316..0000000 --- a/org/drip/sample/creditfeed/CDXNAIGS195YReconstitutor.java +++ /dev/null @@ -1,83 +0,0 @@ - -package org.drip.sample.creditfeed; - -import org.drip.feed.transformer.CreditCDSIndexMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS195YReconstitutor Cleanses the Input CDX.NA.IG S19 5Y CDS Price Marks and saves them into a usable - * and Process-able Format. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS195YReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iQuotedSpreadIndex = 1; - String strCurrency = "USD"; - String strFullCreditIndexName = "CDX.NA.IG.S19.5Y"; - String strCreditIndexMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\CreditMarks\\" + strFullCreditIndexName + ".Formatted.csv"; - String strFundingFixingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "CreditFixingReconstitutor.csv"; - - CreditCDSIndexMarksReconstitutor.RegularizeCloses ( - strFundingFixingMarksLocation, - strCreditIndexMarksLocation, - strFullCreditIndexName, - iSpotDateIndex, - iQuotedSpreadIndex - ); - } -} diff --git a/org/drip/sample/creditfeed/CDXNAIGS205YReconstitutor.java b/org/drip/sample/creditfeed/CDXNAIGS205YReconstitutor.java deleted file mode 100644 index 1535898..0000000 --- a/org/drip/sample/creditfeed/CDXNAIGS205YReconstitutor.java +++ /dev/null @@ -1,83 +0,0 @@ - -package org.drip.sample.creditfeed; - -import org.drip.feed.transformer.CreditCDSIndexMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS205YReconstitutor Cleanses the Input CDX.NA.IG S20 5Y CDS Price Marks and saves them into a usable - * and Process-able Format. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS205YReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iQuotedSpreadIndex = 1; - String strCurrency = "USD"; - String strFullCreditIndexName = "CDX.NA.IG.S20.5Y"; - String strCreditIndexMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\CreditMarks\\" + strFullCreditIndexName + ".Formatted.csv"; - String strFundingFixingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "CreditFixingReconstitutor.csv"; - - CreditCDSIndexMarksReconstitutor.RegularizeCloses ( - strFundingFixingMarksLocation, - strCreditIndexMarksLocation, - strFullCreditIndexName, - iSpotDateIndex, - iQuotedSpreadIndex - ); - } -} diff --git a/org/drip/sample/creditfeed/CDXNAIGS215YReconstitutor.java b/org/drip/sample/creditfeed/CDXNAIGS215YReconstitutor.java deleted file mode 100644 index 0479fc8..0000000 --- a/org/drip/sample/creditfeed/CDXNAIGS215YReconstitutor.java +++ /dev/null @@ -1,83 +0,0 @@ - -package org.drip.sample.creditfeed; - -import org.drip.feed.transformer.CreditCDSIndexMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS215YReconstitutor Cleanses the Input CDX.NA.IG S21 5Y CDS Price Marks and saves them into a usable - * and Process-able Format. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS215YReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iQuotedSpreadIndex = 1; - String strCurrency = "USD"; - String strFullCreditIndexName = "CDX.NA.IG.S21.5Y"; - String strCreditIndexMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\CreditMarks\\" + strFullCreditIndexName + ".Formatted.csv"; - String strFundingFixingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "CreditFixingReconstitutor.csv"; - - CreditCDSIndexMarksReconstitutor.RegularizeCloses ( - strFundingFixingMarksLocation, - strCreditIndexMarksLocation, - strFullCreditIndexName, - iSpotDateIndex, - iQuotedSpreadIndex - ); - } -} diff --git a/org/drip/sample/creditfeed/CDXNAIGS225YReconstitutor.java b/org/drip/sample/creditfeed/CDXNAIGS225YReconstitutor.java deleted file mode 100644 index 66b9de6..0000000 --- a/org/drip/sample/creditfeed/CDXNAIGS225YReconstitutor.java +++ /dev/null @@ -1,83 +0,0 @@ - -package org.drip.sample.creditfeed; - -import org.drip.feed.transformer.CreditCDSIndexMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS225YReconstitutor Cleanses the Input CDX.NA.IG S22 5Y CDS Price Marks and saves them into a usable - * and Process-able Format. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS225YReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iQuotedSpreadIndex = 1; - String strCurrency = "USD"; - String strFullCreditIndexName = "CDX.NA.IG.S22.5Y"; - String strCreditIndexMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\CreditMarks\\" + strFullCreditIndexName + ".Formatted.csv"; - String strFundingFixingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "CreditFixingReconstitutor.csv"; - - CreditCDSIndexMarksReconstitutor.RegularizeCloses ( - strFundingFixingMarksLocation, - strCreditIndexMarksLocation, - strFullCreditIndexName, - iSpotDateIndex, - iQuotedSpreadIndex - ); - } -} diff --git a/org/drip/sample/creditfeed/CDXNAIGS235YReconstitutor.java b/org/drip/sample/creditfeed/CDXNAIGS235YReconstitutor.java deleted file mode 100644 index c6a8931..0000000 --- a/org/drip/sample/creditfeed/CDXNAIGS235YReconstitutor.java +++ /dev/null @@ -1,83 +0,0 @@ - -package org.drip.sample.creditfeed; - -import org.drip.feed.transformer.CreditCDSIndexMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS235YReconstitutor Cleanses the Input CDX.NA.IG S23 5Y CDS Price Marks and saves them into a usable - * and Process-able Format. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS235YReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iQuotedSpreadIndex = 1; - String strCurrency = "USD"; - String strFullCreditIndexName = "CDX.NA.IG.S23.5Y"; - String strCreditIndexMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\CreditMarks\\" + strFullCreditIndexName + ".Formatted.csv"; - String strFundingFixingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "CreditFixingReconstitutor.csv"; - - CreditCDSIndexMarksReconstitutor.RegularizeCloses ( - strFundingFixingMarksLocation, - strCreditIndexMarksLocation, - strFullCreditIndexName, - iSpotDateIndex, - iQuotedSpreadIndex - ); - } -} diff --git a/org/drip/sample/creditfeed/CDXNAIGS245YReconstitutor.java b/org/drip/sample/creditfeed/CDXNAIGS245YReconstitutor.java deleted file mode 100644 index 6f6f11d..0000000 --- a/org/drip/sample/creditfeed/CDXNAIGS245YReconstitutor.java +++ /dev/null @@ -1,83 +0,0 @@ - -package org.drip.sample.creditfeed; - -import org.drip.feed.transformer.CreditCDSIndexMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS245YReconstitutor Cleanses the Input CDX.NA.IG S24 5Y CDS Price Marks and saves them into a usable - * and Process-able Format. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS245YReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iQuotedSpreadIndex = 1; - String strCurrency = "USD"; - String strFullCreditIndexName = "CDX.NA.IG.S24.5Y"; - String strCreditIndexMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\CreditMarks\\" + strFullCreditIndexName + ".Formatted.csv"; - String strFundingFixingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "CreditFixingReconstitutor.csv"; - - CreditCDSIndexMarksReconstitutor.RegularizeCloses ( - strFundingFixingMarksLocation, - strCreditIndexMarksLocation, - strFullCreditIndexName, - iSpotDateIndex, - iQuotedSpreadIndex - ); - } -} diff --git a/org/drip/sample/creditfeed/CDXNAIGS255YReconstitutor.java b/org/drip/sample/creditfeed/CDXNAIGS255YReconstitutor.java deleted file mode 100644 index 17356a8..0000000 --- a/org/drip/sample/creditfeed/CDXNAIGS255YReconstitutor.java +++ /dev/null @@ -1,83 +0,0 @@ - -package org.drip.sample.creditfeed; - -import org.drip.feed.transformer.CreditCDSIndexMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS255YReconstitutor Cleanses the Input CDX.NA.IG S25 5Y CDS Price Marks and saves them into a usable - * and Process-able Format. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS255YReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iQuotedSpreadIndex = 1; - String strCurrency = "USD"; - String strFullCreditIndexName = "CDX.NA.IG.S25.5Y"; - String strCreditIndexMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\CreditMarks\\" + strFullCreditIndexName + ".Formatted.csv"; - String strFundingFixingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "CreditFixingReconstitutor.csv"; - - CreditCDSIndexMarksReconstitutor.RegularizeCloses ( - strFundingFixingMarksLocation, - strCreditIndexMarksLocation, - strFullCreditIndexName, - iSpotDateIndex, - iQuotedSpreadIndex - ); - } -} diff --git a/org/drip/sample/creditfeed/CDXNAIGS265YReconstitutor.java b/org/drip/sample/creditfeed/CDXNAIGS265YReconstitutor.java deleted file mode 100644 index cb130b7..0000000 --- a/org/drip/sample/creditfeed/CDXNAIGS265YReconstitutor.java +++ /dev/null @@ -1,83 +0,0 @@ - -package org.drip.sample.creditfeed; - -import org.drip.feed.transformer.CreditCDSIndexMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS265YReconstitutor Cleanses the Input CDX.NA.IG S26 5Y CDS Price Marks and saves them into a usable - * and Process-able Format. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS265YReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iQuotedSpreadIndex = 1; - String strCurrency = "USD"; - String strFullCreditIndexName = "CDX.NA.IG.S26.5Y"; - String strCreditIndexMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\CreditMarks\\" + strFullCreditIndexName + ".Formatted.csv"; - String strFundingFixingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "CreditFixingReconstitutor.csv"; - - CreditCDSIndexMarksReconstitutor.RegularizeCloses ( - strFundingFixingMarksLocation, - strCreditIndexMarksLocation, - strFullCreditIndexName, - iSpotDateIndex, - iQuotedSpreadIndex - ); - } -} diff --git a/org/drip/sample/creditfeed/USDCreditFixingReconstitutor.java b/org/drip/sample/creditfeed/USDCreditFixingReconstitutor.java deleted file mode 100644 index 374110e..0000000 --- a/org/drip/sample/creditfeed/USDCreditFixingReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.creditfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * USDCreditFixingReconstitutor Demonstrates the Cleansing and the Shape Preserving Re-constitution of the - * USD Credit Fixing Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class USDCreditFixingReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\CreditMarks\\" + strCurrency + "_Fixing_Formatted.csv"; - - FundingFixFloatMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/credithistorical/CDXNAIGS155YMetrics.java b/org/drip/sample/credithistorical/CDXNAIGS155YMetrics.java deleted file mode 100644 index 495e31c..0000000 --- a/org/drip/sample/credithistorical/CDXNAIGS155YMetrics.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.sample.credithistorical; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.CreditCurveMetrics; -import org.drip.service.env.EnvManager; -import org.drip.service.state.CreditCurveAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS155YMetrics generates the Historical Credit Survival/Recovery Metrics for the Index Contract CDX - * NA IG S15 5Y. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS155YMetrics { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSeries = 15; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\CreditCDXMarks\\CDXNAIGS" + iSeries + "5YReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFundingFixingMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFundingFixingQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFundingFixingQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFundingFixingQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFundingFixingQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFundingFixingQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFundingFixingQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFundingFixingQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFundingFixingQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFundingFixingQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFundingFixingQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFundingFixingQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFundingFixingQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFundingFixingQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFundingFixingQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFundingFixingQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFundingFixingQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFundingFixingQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFundingFixingQuote50Y = csvGrid.doubleArrayAtColumn (18); - - String[] astrFullCreditIndexName = csvGrid.stringArrayAtColumn (19); - - double[] adblCreditIndexQuotedSpread = csvGrid.doubleArrayAtColumn (20); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFundingFixingQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFundingFixingQuote[i][0] = adblFundingFixingQuote1Y[i]; - aadblFundingFixingQuote[i][1] = adblFundingFixingQuote2Y[i]; - aadblFundingFixingQuote[i][2] = adblFundingFixingQuote3Y[i]; - aadblFundingFixingQuote[i][3] = adblFundingFixingQuote4Y[i]; - aadblFundingFixingQuote[i][4] = adblFundingFixingQuote5Y[i]; - aadblFundingFixingQuote[i][5] = adblFundingFixingQuote6Y[i]; - aadblFundingFixingQuote[i][6] = adblFundingFixingQuote7Y[i]; - aadblFundingFixingQuote[i][7] = adblFundingFixingQuote8Y[i]; - aadblFundingFixingQuote[i][8] = adblFundingFixingQuote9Y[i]; - aadblFundingFixingQuote[i][9] = adblFundingFixingQuote10Y[i]; - aadblFundingFixingQuote[i][10] = adblFundingFixingQuote11Y[i]; - aadblFundingFixingQuote[i][11] = adblFundingFixingQuote12Y[i]; - aadblFundingFixingQuote[i][12] = adblFundingFixingQuote15Y[i]; - aadblFundingFixingQuote[i][13] = adblFundingFixingQuote20Y[i]; - aadblFundingFixingQuote[i][14] = adblFundingFixingQuote25Y[i]; - aadblFundingFixingQuote[i][15] = adblFundingFixingQuote30Y[i]; - aadblFundingFixingQuote[i][16] = adblFundingFixingQuote40Y[i]; - aadblFundingFixingQuote[i][17] = adblFundingFixingQuote50Y[i]; - adblCreditIndexQuotedSpread[i] *= 10000.; - } - - int i = 0; - String strDump = "Date,QuotedSpread"; - - for (String strForTenor : astrForTenor) - strDump += ",SURVIVAL::" + strForTenor + ",RECOVERY::" + strForTenor; - - System.out.println (strDump); - - TreeMap mapCCM = CreditCurveAPI.HorizonMetrics ( - adtSpot, - astrFundingFixingMaturityTenor, - aadblFundingFixingQuote, - astrFullCreditIndexName, - adblCreditIndexQuotedSpread, - astrForTenor - ); - - Set setSpotDate = mapCCM.keySet(); - - for (JulianDate dtSpot : setSpotDate) { - strDump = dtSpot.toString() + "," + adblCreditIndexQuotedSpread[i++]; - - CreditCurveMetrics ccmSpot = mapCCM.get (dtSpot); - - for (String strForTenor : astrForTenor) { - JulianDate dtFor = dtSpot.addTenor (strForTenor); - - strDump += "," + ccmSpot.survivalProbability (dtFor) + "," + ccmSpot.recoveryRate (dtFor); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/credithistorical/CDXNAIGS165YMetrics.java b/org/drip/sample/credithistorical/CDXNAIGS165YMetrics.java deleted file mode 100644 index 0931e8c..0000000 --- a/org/drip/sample/credithistorical/CDXNAIGS165YMetrics.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.sample.credithistorical; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.CreditCurveMetrics; -import org.drip.service.env.EnvManager; -import org.drip.service.state.CreditCurveAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS165YMetrics generates the Historical Credit Survival/Recovery Metrics for the Index Contract CDX - * NA IG S16 5Y. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS165YMetrics { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSeries = 16; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\CreditCDXMarks\\CDXNAIGS" + iSeries + "5YReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFundingFixingMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFundingFixingQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFundingFixingQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFundingFixingQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFundingFixingQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFundingFixingQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFundingFixingQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFundingFixingQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFundingFixingQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFundingFixingQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFundingFixingQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFundingFixingQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFundingFixingQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFundingFixingQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFundingFixingQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFundingFixingQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFundingFixingQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFundingFixingQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFundingFixingQuote50Y = csvGrid.doubleArrayAtColumn (18); - - String[] astrFullCreditIndexName = csvGrid.stringArrayAtColumn (19); - - double[] adblCreditIndexQuotedSpread = csvGrid.doubleArrayAtColumn (20); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFundingFixingQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFundingFixingQuote[i][0] = adblFundingFixingQuote1Y[i]; - aadblFundingFixingQuote[i][1] = adblFundingFixingQuote2Y[i]; - aadblFundingFixingQuote[i][2] = adblFundingFixingQuote3Y[i]; - aadblFundingFixingQuote[i][3] = adblFundingFixingQuote4Y[i]; - aadblFundingFixingQuote[i][4] = adblFundingFixingQuote5Y[i]; - aadblFundingFixingQuote[i][5] = adblFundingFixingQuote6Y[i]; - aadblFundingFixingQuote[i][6] = adblFundingFixingQuote7Y[i]; - aadblFundingFixingQuote[i][7] = adblFundingFixingQuote8Y[i]; - aadblFundingFixingQuote[i][8] = adblFundingFixingQuote9Y[i]; - aadblFundingFixingQuote[i][9] = adblFundingFixingQuote10Y[i]; - aadblFundingFixingQuote[i][10] = adblFundingFixingQuote11Y[i]; - aadblFundingFixingQuote[i][11] = adblFundingFixingQuote12Y[i]; - aadblFundingFixingQuote[i][12] = adblFundingFixingQuote15Y[i]; - aadblFundingFixingQuote[i][13] = adblFundingFixingQuote20Y[i]; - aadblFundingFixingQuote[i][14] = adblFundingFixingQuote25Y[i]; - aadblFundingFixingQuote[i][15] = adblFundingFixingQuote30Y[i]; - aadblFundingFixingQuote[i][16] = adblFundingFixingQuote40Y[i]; - aadblFundingFixingQuote[i][17] = adblFundingFixingQuote50Y[i]; - adblCreditIndexQuotedSpread[i] *= 10000.; - } - - int i = 0; - String strDump = "Date,QuotedSpread"; - - for (String strForTenor : astrForTenor) - strDump += ",SURVIVAL::" + strForTenor + ",RECOVERY::" + strForTenor; - - System.out.println (strDump); - - TreeMap mapCCM = CreditCurveAPI.HorizonMetrics ( - adtSpot, - astrFundingFixingMaturityTenor, - aadblFundingFixingQuote, - astrFullCreditIndexName, - adblCreditIndexQuotedSpread, - astrForTenor - ); - - Set setSpotDate = mapCCM.keySet(); - - for (JulianDate dtSpot : setSpotDate) { - strDump = dtSpot.toString() + "," + adblCreditIndexQuotedSpread[i++]; - - CreditCurveMetrics ccmSpot = mapCCM.get (dtSpot); - - for (String strForTenor : astrForTenor) { - JulianDate dtFor = dtSpot.addTenor (strForTenor); - - strDump += "," + ccmSpot.survivalProbability (dtFor) + "," + ccmSpot.recoveryRate (dtFor); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/credithistorical/CDXNAIGS175YMetrics.java b/org/drip/sample/credithistorical/CDXNAIGS175YMetrics.java deleted file mode 100644 index 56b32dc..0000000 --- a/org/drip/sample/credithistorical/CDXNAIGS175YMetrics.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.sample.credithistorical; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.CreditCurveMetrics; -import org.drip.service.env.EnvManager; -import org.drip.service.state.CreditCurveAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS175YMetrics generates the Historical Credit Survival/Recovery Metrics for the Index Contract CDX - * NA IG S17 5Y. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS175YMetrics { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSeries = 17; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\CreditCDXMarks\\CDXNAIGS" + iSeries + "5YReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFundingFixingMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFundingFixingQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFundingFixingQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFundingFixingQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFundingFixingQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFundingFixingQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFundingFixingQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFundingFixingQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFundingFixingQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFundingFixingQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFundingFixingQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFundingFixingQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFundingFixingQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFundingFixingQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFundingFixingQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFundingFixingQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFundingFixingQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFundingFixingQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFundingFixingQuote50Y = csvGrid.doubleArrayAtColumn (18); - - String[] astrFullCreditIndexName = csvGrid.stringArrayAtColumn (19); - - double[] adblCreditIndexQuotedSpread = csvGrid.doubleArrayAtColumn (20); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFundingFixingQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFundingFixingQuote[i][0] = adblFundingFixingQuote1Y[i]; - aadblFundingFixingQuote[i][1] = adblFundingFixingQuote2Y[i]; - aadblFundingFixingQuote[i][2] = adblFundingFixingQuote3Y[i]; - aadblFundingFixingQuote[i][3] = adblFundingFixingQuote4Y[i]; - aadblFundingFixingQuote[i][4] = adblFundingFixingQuote5Y[i]; - aadblFundingFixingQuote[i][5] = adblFundingFixingQuote6Y[i]; - aadblFundingFixingQuote[i][6] = adblFundingFixingQuote7Y[i]; - aadblFundingFixingQuote[i][7] = adblFundingFixingQuote8Y[i]; - aadblFundingFixingQuote[i][8] = adblFundingFixingQuote9Y[i]; - aadblFundingFixingQuote[i][9] = adblFundingFixingQuote10Y[i]; - aadblFundingFixingQuote[i][10] = adblFundingFixingQuote11Y[i]; - aadblFundingFixingQuote[i][11] = adblFundingFixingQuote12Y[i]; - aadblFundingFixingQuote[i][12] = adblFundingFixingQuote15Y[i]; - aadblFundingFixingQuote[i][13] = adblFundingFixingQuote20Y[i]; - aadblFundingFixingQuote[i][14] = adblFundingFixingQuote25Y[i]; - aadblFundingFixingQuote[i][15] = adblFundingFixingQuote30Y[i]; - aadblFundingFixingQuote[i][16] = adblFundingFixingQuote40Y[i]; - aadblFundingFixingQuote[i][17] = adblFundingFixingQuote50Y[i]; - adblCreditIndexQuotedSpread[i] *= 10000.; - } - - int i = 0; - String strDump = "Date,QuotedSpread"; - - for (String strForTenor : astrForTenor) - strDump += ",SURVIVAL::" + strForTenor + ",RECOVERY::" + strForTenor; - - System.out.println (strDump); - - TreeMap mapCCM = CreditCurveAPI.HorizonMetrics ( - adtSpot, - astrFundingFixingMaturityTenor, - aadblFundingFixingQuote, - astrFullCreditIndexName, - adblCreditIndexQuotedSpread, - astrForTenor - ); - - Set setSpotDate = mapCCM.keySet(); - - for (JulianDate dtSpot : setSpotDate) { - strDump = dtSpot.toString() + "," + adblCreditIndexQuotedSpread[i++]; - - CreditCurveMetrics ccmSpot = mapCCM.get (dtSpot); - - for (String strForTenor : astrForTenor) { - JulianDate dtFor = dtSpot.addTenor (strForTenor); - - strDump += "," + ccmSpot.survivalProbability (dtFor) + "," + ccmSpot.recoveryRate (dtFor); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/credithistorical/CDXNAIGS185YMetrics.java b/org/drip/sample/credithistorical/CDXNAIGS185YMetrics.java deleted file mode 100644 index a39555d..0000000 --- a/org/drip/sample/credithistorical/CDXNAIGS185YMetrics.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.sample.credithistorical; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.CreditCurveMetrics; -import org.drip.service.env.EnvManager; -import org.drip.service.state.CreditCurveAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS185YMetrics generates the Historical Credit Survival/Recovery Metrics for the Index Contract CDX - * NA IG S18 5Y. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS185YMetrics { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSeries = 18; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\CreditCDXMarks\\CDXNAIGS" + iSeries + "5YReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFundingFixingMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFundingFixingQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFundingFixingQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFundingFixingQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFundingFixingQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFundingFixingQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFundingFixingQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFundingFixingQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFundingFixingQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFundingFixingQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFundingFixingQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFundingFixingQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFundingFixingQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFundingFixingQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFundingFixingQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFundingFixingQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFundingFixingQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFundingFixingQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFundingFixingQuote50Y = csvGrid.doubleArrayAtColumn (18); - - String[] astrFullCreditIndexName = csvGrid.stringArrayAtColumn (19); - - double[] adblCreditIndexQuotedSpread = csvGrid.doubleArrayAtColumn (20); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFundingFixingQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFundingFixingQuote[i][0] = adblFundingFixingQuote1Y[i]; - aadblFundingFixingQuote[i][1] = adblFundingFixingQuote2Y[i]; - aadblFundingFixingQuote[i][2] = adblFundingFixingQuote3Y[i]; - aadblFundingFixingQuote[i][3] = adblFundingFixingQuote4Y[i]; - aadblFundingFixingQuote[i][4] = adblFundingFixingQuote5Y[i]; - aadblFundingFixingQuote[i][5] = adblFundingFixingQuote6Y[i]; - aadblFundingFixingQuote[i][6] = adblFundingFixingQuote7Y[i]; - aadblFundingFixingQuote[i][7] = adblFundingFixingQuote8Y[i]; - aadblFundingFixingQuote[i][8] = adblFundingFixingQuote9Y[i]; - aadblFundingFixingQuote[i][9] = adblFundingFixingQuote10Y[i]; - aadblFundingFixingQuote[i][10] = adblFundingFixingQuote11Y[i]; - aadblFundingFixingQuote[i][11] = adblFundingFixingQuote12Y[i]; - aadblFundingFixingQuote[i][12] = adblFundingFixingQuote15Y[i]; - aadblFundingFixingQuote[i][13] = adblFundingFixingQuote20Y[i]; - aadblFundingFixingQuote[i][14] = adblFundingFixingQuote25Y[i]; - aadblFundingFixingQuote[i][15] = adblFundingFixingQuote30Y[i]; - aadblFundingFixingQuote[i][16] = adblFundingFixingQuote40Y[i]; - aadblFundingFixingQuote[i][17] = adblFundingFixingQuote50Y[i]; - adblCreditIndexQuotedSpread[i] *= 10000.; - } - - int i = 0; - String strDump = "Date,QuotedSpread"; - - for (String strForTenor : astrForTenor) - strDump += ",SURVIVAL::" + strForTenor + ",RECOVERY::" + strForTenor; - - System.out.println (strDump); - - TreeMap mapCCM = CreditCurveAPI.HorizonMetrics ( - adtSpot, - astrFundingFixingMaturityTenor, - aadblFundingFixingQuote, - astrFullCreditIndexName, - adblCreditIndexQuotedSpread, - astrForTenor - ); - - Set setSpotDate = mapCCM.keySet(); - - for (JulianDate dtSpot : setSpotDate) { - strDump = dtSpot.toString() + "," + adblCreditIndexQuotedSpread[i++]; - - CreditCurveMetrics ccmSpot = mapCCM.get (dtSpot); - - for (String strForTenor : astrForTenor) { - JulianDate dtFor = dtSpot.addTenor (strForTenor); - - strDump += "," + ccmSpot.survivalProbability (dtFor) + "," + ccmSpot.recoveryRate (dtFor); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/credithistorical/CDXNAIGS195YMetrics.java b/org/drip/sample/credithistorical/CDXNAIGS195YMetrics.java deleted file mode 100644 index 6a5dc97..0000000 --- a/org/drip/sample/credithistorical/CDXNAIGS195YMetrics.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.sample.credithistorical; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.CreditCurveMetrics; -import org.drip.service.env.EnvManager; -import org.drip.service.state.CreditCurveAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS195YMetrics generates the Historical Credit Survival/Recovery Metrics for the Index Contract CDX - * NA IG S19 5Y. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS195YMetrics { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSeries = 19; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\CreditCDXMarks\\CDXNAIGS" + iSeries + "5YReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFundingFixingMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFundingFixingQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFundingFixingQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFundingFixingQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFundingFixingQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFundingFixingQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFundingFixingQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFundingFixingQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFundingFixingQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFundingFixingQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFundingFixingQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFundingFixingQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFundingFixingQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFundingFixingQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFundingFixingQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFundingFixingQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFundingFixingQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFundingFixingQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFundingFixingQuote50Y = csvGrid.doubleArrayAtColumn (18); - - String[] astrFullCreditIndexName = csvGrid.stringArrayAtColumn (19); - - double[] adblCreditIndexQuotedSpread = csvGrid.doubleArrayAtColumn (20); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFundingFixingQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFundingFixingQuote[i][0] = adblFundingFixingQuote1Y[i]; - aadblFundingFixingQuote[i][1] = adblFundingFixingQuote2Y[i]; - aadblFundingFixingQuote[i][2] = adblFundingFixingQuote3Y[i]; - aadblFundingFixingQuote[i][3] = adblFundingFixingQuote4Y[i]; - aadblFundingFixingQuote[i][4] = adblFundingFixingQuote5Y[i]; - aadblFundingFixingQuote[i][5] = adblFundingFixingQuote6Y[i]; - aadblFundingFixingQuote[i][6] = adblFundingFixingQuote7Y[i]; - aadblFundingFixingQuote[i][7] = adblFundingFixingQuote8Y[i]; - aadblFundingFixingQuote[i][8] = adblFundingFixingQuote9Y[i]; - aadblFundingFixingQuote[i][9] = adblFundingFixingQuote10Y[i]; - aadblFundingFixingQuote[i][10] = adblFundingFixingQuote11Y[i]; - aadblFundingFixingQuote[i][11] = adblFundingFixingQuote12Y[i]; - aadblFundingFixingQuote[i][12] = adblFundingFixingQuote15Y[i]; - aadblFundingFixingQuote[i][13] = adblFundingFixingQuote20Y[i]; - aadblFundingFixingQuote[i][14] = adblFundingFixingQuote25Y[i]; - aadblFundingFixingQuote[i][15] = adblFundingFixingQuote30Y[i]; - aadblFundingFixingQuote[i][16] = adblFundingFixingQuote40Y[i]; - aadblFundingFixingQuote[i][17] = adblFundingFixingQuote50Y[i]; - adblCreditIndexQuotedSpread[i] *= 10000.; - } - - int i = 0; - String strDump = "Date,QuotedSpread"; - - for (String strForTenor : astrForTenor) - strDump += ",SURVIVAL::" + strForTenor + ",RECOVERY::" + strForTenor; - - System.out.println (strDump); - - TreeMap mapCCM = CreditCurveAPI.HorizonMetrics ( - adtSpot, - astrFundingFixingMaturityTenor, - aadblFundingFixingQuote, - astrFullCreditIndexName, - adblCreditIndexQuotedSpread, - astrForTenor - ); - - Set setSpotDate = mapCCM.keySet(); - - for (JulianDate dtSpot : setSpotDate) { - strDump = dtSpot.toString() + "," + adblCreditIndexQuotedSpread[i++]; - - CreditCurveMetrics ccmSpot = mapCCM.get (dtSpot); - - for (String strForTenor : astrForTenor) { - JulianDate dtFor = dtSpot.addTenor (strForTenor); - - strDump += "," + ccmSpot.survivalProbability (dtFor) + "," + ccmSpot.recoveryRate (dtFor); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/credithistorical/CDXNAIGS205YMetrics.java b/org/drip/sample/credithistorical/CDXNAIGS205YMetrics.java deleted file mode 100644 index 47c9ffb..0000000 --- a/org/drip/sample/credithistorical/CDXNAIGS205YMetrics.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.sample.credithistorical; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.CreditCurveMetrics; -import org.drip.service.env.EnvManager; -import org.drip.service.state.CreditCurveAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS205YMetrics generates the Historical Credit Survival/Recovery Metrics for the Index Contract CDX - * NA IG S20 5Y. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS205YMetrics { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSeries = 20; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\CreditCDXMarks\\CDXNAIGS" + iSeries + "5YReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFundingFixingMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFundingFixingQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFundingFixingQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFundingFixingQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFundingFixingQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFundingFixingQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFundingFixingQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFundingFixingQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFundingFixingQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFundingFixingQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFundingFixingQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFundingFixingQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFundingFixingQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFundingFixingQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFundingFixingQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFundingFixingQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFundingFixingQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFundingFixingQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFundingFixingQuote50Y = csvGrid.doubleArrayAtColumn (18); - - String[] astrFullCreditIndexName = csvGrid.stringArrayAtColumn (19); - - double[] adblCreditIndexQuotedSpread = csvGrid.doubleArrayAtColumn (20); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFundingFixingQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFundingFixingQuote[i][0] = adblFundingFixingQuote1Y[i]; - aadblFundingFixingQuote[i][1] = adblFundingFixingQuote2Y[i]; - aadblFundingFixingQuote[i][2] = adblFundingFixingQuote3Y[i]; - aadblFundingFixingQuote[i][3] = adblFundingFixingQuote4Y[i]; - aadblFundingFixingQuote[i][4] = adblFundingFixingQuote5Y[i]; - aadblFundingFixingQuote[i][5] = adblFundingFixingQuote6Y[i]; - aadblFundingFixingQuote[i][6] = adblFundingFixingQuote7Y[i]; - aadblFundingFixingQuote[i][7] = adblFundingFixingQuote8Y[i]; - aadblFundingFixingQuote[i][8] = adblFundingFixingQuote9Y[i]; - aadblFundingFixingQuote[i][9] = adblFundingFixingQuote10Y[i]; - aadblFundingFixingQuote[i][10] = adblFundingFixingQuote11Y[i]; - aadblFundingFixingQuote[i][11] = adblFundingFixingQuote12Y[i]; - aadblFundingFixingQuote[i][12] = adblFundingFixingQuote15Y[i]; - aadblFundingFixingQuote[i][13] = adblFundingFixingQuote20Y[i]; - aadblFundingFixingQuote[i][14] = adblFundingFixingQuote25Y[i]; - aadblFundingFixingQuote[i][15] = adblFundingFixingQuote30Y[i]; - aadblFundingFixingQuote[i][16] = adblFundingFixingQuote40Y[i]; - aadblFundingFixingQuote[i][17] = adblFundingFixingQuote50Y[i]; - adblCreditIndexQuotedSpread[i] *= 10000.; - } - - int i = 0; - String strDump = "Date,QuotedSpread"; - - for (String strForTenor : astrForTenor) - strDump += ",SURVIVAL::" + strForTenor + ",RECOVERY::" + strForTenor; - - System.out.println (strDump); - - TreeMap mapCCM = CreditCurveAPI.HorizonMetrics ( - adtSpot, - astrFundingFixingMaturityTenor, - aadblFundingFixingQuote, - astrFullCreditIndexName, - adblCreditIndexQuotedSpread, - astrForTenor - ); - - Set setSpotDate = mapCCM.keySet(); - - for (JulianDate dtSpot : setSpotDate) { - strDump = dtSpot.toString() + "," + adblCreditIndexQuotedSpread[i++]; - - CreditCurveMetrics ccmSpot = mapCCM.get (dtSpot); - - for (String strForTenor : astrForTenor) { - JulianDate dtFor = dtSpot.addTenor (strForTenor); - - strDump += "," + ccmSpot.survivalProbability (dtFor) + "," + ccmSpot.recoveryRate (dtFor); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/credithistorical/CDXNAIGS215YMetrics.java b/org/drip/sample/credithistorical/CDXNAIGS215YMetrics.java deleted file mode 100644 index 9024b70..0000000 --- a/org/drip/sample/credithistorical/CDXNAIGS215YMetrics.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.sample.credithistorical; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.CreditCurveMetrics; -import org.drip.service.env.EnvManager; -import org.drip.service.state.CreditCurveAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS215YMetrics generates the Historical Credit Survival/Recovery Metrics for the Index Contract CDX - * NA IG S21 5Y. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS215YMetrics { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSeries = 21; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\CreditCDXMarks\\CDXNAIGS" + iSeries + "5YReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFundingFixingMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFundingFixingQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFundingFixingQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFundingFixingQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFundingFixingQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFundingFixingQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFundingFixingQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFundingFixingQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFundingFixingQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFundingFixingQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFundingFixingQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFundingFixingQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFundingFixingQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFundingFixingQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFundingFixingQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFundingFixingQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFundingFixingQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFundingFixingQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFundingFixingQuote50Y = csvGrid.doubleArrayAtColumn (18); - - String[] astrFullCreditIndexName = csvGrid.stringArrayAtColumn (19); - - double[] adblCreditIndexQuotedSpread = csvGrid.doubleArrayAtColumn (20); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFundingFixingQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFundingFixingQuote[i][0] = adblFundingFixingQuote1Y[i]; - aadblFundingFixingQuote[i][1] = adblFundingFixingQuote2Y[i]; - aadblFundingFixingQuote[i][2] = adblFundingFixingQuote3Y[i]; - aadblFundingFixingQuote[i][3] = adblFundingFixingQuote4Y[i]; - aadblFundingFixingQuote[i][4] = adblFundingFixingQuote5Y[i]; - aadblFundingFixingQuote[i][5] = adblFundingFixingQuote6Y[i]; - aadblFundingFixingQuote[i][6] = adblFundingFixingQuote7Y[i]; - aadblFundingFixingQuote[i][7] = adblFundingFixingQuote8Y[i]; - aadblFundingFixingQuote[i][8] = adblFundingFixingQuote9Y[i]; - aadblFundingFixingQuote[i][9] = adblFundingFixingQuote10Y[i]; - aadblFundingFixingQuote[i][10] = adblFundingFixingQuote11Y[i]; - aadblFundingFixingQuote[i][11] = adblFundingFixingQuote12Y[i]; - aadblFundingFixingQuote[i][12] = adblFundingFixingQuote15Y[i]; - aadblFundingFixingQuote[i][13] = adblFundingFixingQuote20Y[i]; - aadblFundingFixingQuote[i][14] = adblFundingFixingQuote25Y[i]; - aadblFundingFixingQuote[i][15] = adblFundingFixingQuote30Y[i]; - aadblFundingFixingQuote[i][16] = adblFundingFixingQuote40Y[i]; - aadblFundingFixingQuote[i][17] = adblFundingFixingQuote50Y[i]; - adblCreditIndexQuotedSpread[i] *= 10000.; - } - - int i = 0; - String strDump = "Date,QuotedSpread"; - - for (String strForTenor : astrForTenor) - strDump += ",SURVIVAL::" + strForTenor + ",RECOVERY::" + strForTenor; - - System.out.println (strDump); - - TreeMap mapCCM = CreditCurveAPI.HorizonMetrics ( - adtSpot, - astrFundingFixingMaturityTenor, - aadblFundingFixingQuote, - astrFullCreditIndexName, - adblCreditIndexQuotedSpread, - astrForTenor - ); - - Set setSpotDate = mapCCM.keySet(); - - for (JulianDate dtSpot : setSpotDate) { - strDump = dtSpot.toString() + "," + adblCreditIndexQuotedSpread[i++]; - - CreditCurveMetrics ccmSpot = mapCCM.get (dtSpot); - - for (String strForTenor : astrForTenor) { - JulianDate dtFor = dtSpot.addTenor (strForTenor); - - strDump += "," + ccmSpot.survivalProbability (dtFor) + "," + ccmSpot.recoveryRate (dtFor); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/credithistorical/CDXNAIGS225YMetrics.java b/org/drip/sample/credithistorical/CDXNAIGS225YMetrics.java deleted file mode 100644 index 6ade2be..0000000 --- a/org/drip/sample/credithistorical/CDXNAIGS225YMetrics.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.sample.credithistorical; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.CreditCurveMetrics; -import org.drip.service.env.EnvManager; -import org.drip.service.state.CreditCurveAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS225YMetrics generates the Historical Credit Survival/Recovery Metrics for the Index Contract CDX - * NA IG S22 5Y. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS225YMetrics { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSeries = 22; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\CreditCDXMarks\\CDXNAIGS" + iSeries + "5YReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFundingFixingMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFundingFixingQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFundingFixingQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFundingFixingQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFundingFixingQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFundingFixingQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFundingFixingQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFundingFixingQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFundingFixingQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFundingFixingQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFundingFixingQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFundingFixingQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFundingFixingQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFundingFixingQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFundingFixingQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFundingFixingQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFundingFixingQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFundingFixingQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFundingFixingQuote50Y = csvGrid.doubleArrayAtColumn (18); - - String[] astrFullCreditIndexName = csvGrid.stringArrayAtColumn (19); - - double[] adblCreditIndexQuotedSpread = csvGrid.doubleArrayAtColumn (20); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFundingFixingQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFundingFixingQuote[i][0] = adblFundingFixingQuote1Y[i]; - aadblFundingFixingQuote[i][1] = adblFundingFixingQuote2Y[i]; - aadblFundingFixingQuote[i][2] = adblFundingFixingQuote3Y[i]; - aadblFundingFixingQuote[i][3] = adblFundingFixingQuote4Y[i]; - aadblFundingFixingQuote[i][4] = adblFundingFixingQuote5Y[i]; - aadblFundingFixingQuote[i][5] = adblFundingFixingQuote6Y[i]; - aadblFundingFixingQuote[i][6] = adblFundingFixingQuote7Y[i]; - aadblFundingFixingQuote[i][7] = adblFundingFixingQuote8Y[i]; - aadblFundingFixingQuote[i][8] = adblFundingFixingQuote9Y[i]; - aadblFundingFixingQuote[i][9] = adblFundingFixingQuote10Y[i]; - aadblFundingFixingQuote[i][10] = adblFundingFixingQuote11Y[i]; - aadblFundingFixingQuote[i][11] = adblFundingFixingQuote12Y[i]; - aadblFundingFixingQuote[i][12] = adblFundingFixingQuote15Y[i]; - aadblFundingFixingQuote[i][13] = adblFundingFixingQuote20Y[i]; - aadblFundingFixingQuote[i][14] = adblFundingFixingQuote25Y[i]; - aadblFundingFixingQuote[i][15] = adblFundingFixingQuote30Y[i]; - aadblFundingFixingQuote[i][16] = adblFundingFixingQuote40Y[i]; - aadblFundingFixingQuote[i][17] = adblFundingFixingQuote50Y[i]; - adblCreditIndexQuotedSpread[i] *= 10000.; - } - - int i = 0; - String strDump = "Date,QuotedSpread"; - - for (String strForTenor : astrForTenor) - strDump += ",SURVIVAL::" + strForTenor + ",RECOVERY::" + strForTenor; - - System.out.println (strDump); - - TreeMap mapCCM = CreditCurveAPI.HorizonMetrics ( - adtSpot, - astrFundingFixingMaturityTenor, - aadblFundingFixingQuote, - astrFullCreditIndexName, - adblCreditIndexQuotedSpread, - astrForTenor - ); - - Set setSpotDate = mapCCM.keySet(); - - for (JulianDate dtSpot : setSpotDate) { - strDump = dtSpot.toString() + "," + adblCreditIndexQuotedSpread[i++]; - - CreditCurveMetrics ccmSpot = mapCCM.get (dtSpot); - - for (String strForTenor : astrForTenor) { - JulianDate dtFor = dtSpot.addTenor (strForTenor); - - strDump += "," + ccmSpot.survivalProbability (dtFor) + "," + ccmSpot.recoveryRate (dtFor); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/credithistorical/CDXNAIGS235YMetrics.java b/org/drip/sample/credithistorical/CDXNAIGS235YMetrics.java deleted file mode 100644 index a9ba9aa..0000000 --- a/org/drip/sample/credithistorical/CDXNAIGS235YMetrics.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.sample.credithistorical; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.CreditCurveMetrics; -import org.drip.service.env.EnvManager; -import org.drip.service.state.CreditCurveAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS235YMetrics generates the Historical Credit Survival/Recovery Metrics for the Index Contract CDX - * NA IG S23 5Y. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS235YMetrics { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSeries = 23; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\CreditCDXMarks\\CDXNAIGS" + iSeries + "5YReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFundingFixingMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFundingFixingQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFundingFixingQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFundingFixingQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFundingFixingQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFundingFixingQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFundingFixingQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFundingFixingQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFundingFixingQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFundingFixingQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFundingFixingQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFundingFixingQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFundingFixingQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFundingFixingQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFundingFixingQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFundingFixingQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFundingFixingQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFundingFixingQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFundingFixingQuote50Y = csvGrid.doubleArrayAtColumn (18); - - String[] astrFullCreditIndexName = csvGrid.stringArrayAtColumn (19); - - double[] adblCreditIndexQuotedSpread = csvGrid.doubleArrayAtColumn (20); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFundingFixingQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFundingFixingQuote[i][0] = adblFundingFixingQuote1Y[i]; - aadblFundingFixingQuote[i][1] = adblFundingFixingQuote2Y[i]; - aadblFundingFixingQuote[i][2] = adblFundingFixingQuote3Y[i]; - aadblFundingFixingQuote[i][3] = adblFundingFixingQuote4Y[i]; - aadblFundingFixingQuote[i][4] = adblFundingFixingQuote5Y[i]; - aadblFundingFixingQuote[i][5] = adblFundingFixingQuote6Y[i]; - aadblFundingFixingQuote[i][6] = adblFundingFixingQuote7Y[i]; - aadblFundingFixingQuote[i][7] = adblFundingFixingQuote8Y[i]; - aadblFundingFixingQuote[i][8] = adblFundingFixingQuote9Y[i]; - aadblFundingFixingQuote[i][9] = adblFundingFixingQuote10Y[i]; - aadblFundingFixingQuote[i][10] = adblFundingFixingQuote11Y[i]; - aadblFundingFixingQuote[i][11] = adblFundingFixingQuote12Y[i]; - aadblFundingFixingQuote[i][12] = adblFundingFixingQuote15Y[i]; - aadblFundingFixingQuote[i][13] = adblFundingFixingQuote20Y[i]; - aadblFundingFixingQuote[i][14] = adblFundingFixingQuote25Y[i]; - aadblFundingFixingQuote[i][15] = adblFundingFixingQuote30Y[i]; - aadblFundingFixingQuote[i][16] = adblFundingFixingQuote40Y[i]; - aadblFundingFixingQuote[i][17] = adblFundingFixingQuote50Y[i]; - adblCreditIndexQuotedSpread[i] *= 10000.; - } - - int i = 0; - String strDump = "Date,QuotedSpread"; - - for (String strForTenor : astrForTenor) - strDump += ",SURVIVAL::" + strForTenor + ",RECOVERY::" + strForTenor; - - System.out.println (strDump); - - TreeMap mapCCM = CreditCurveAPI.HorizonMetrics ( - adtSpot, - astrFundingFixingMaturityTenor, - aadblFundingFixingQuote, - astrFullCreditIndexName, - adblCreditIndexQuotedSpread, - astrForTenor - ); - - Set setSpotDate = mapCCM.keySet(); - - for (JulianDate dtSpot : setSpotDate) { - strDump = dtSpot.toString() + "," + adblCreditIndexQuotedSpread[i++]; - - CreditCurveMetrics ccmSpot = mapCCM.get (dtSpot); - - for (String strForTenor : astrForTenor) { - JulianDate dtFor = dtSpot.addTenor (strForTenor); - - strDump += "," + ccmSpot.survivalProbability (dtFor) + "," + ccmSpot.recoveryRate (dtFor); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/credithistorical/CDXNAIGS245YMetrics.java b/org/drip/sample/credithistorical/CDXNAIGS245YMetrics.java deleted file mode 100644 index 0864c10..0000000 --- a/org/drip/sample/credithistorical/CDXNAIGS245YMetrics.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.sample.credithistorical; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.CreditCurveMetrics; -import org.drip.service.env.EnvManager; -import org.drip.service.state.CreditCurveAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS245YMetrics generates the Historical Credit Survival/Recovery Metrics for the Index Contract CDX - * NA IG S24 5Y. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS245YMetrics { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSeries = 24; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\CreditCDXMarks\\CDXNAIGS" + iSeries + "5YReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFundingFixingMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFundingFixingQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFundingFixingQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFundingFixingQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFundingFixingQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFundingFixingQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFundingFixingQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFundingFixingQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFundingFixingQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFundingFixingQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFundingFixingQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFundingFixingQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFundingFixingQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFundingFixingQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFundingFixingQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFundingFixingQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFundingFixingQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFundingFixingQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFundingFixingQuote50Y = csvGrid.doubleArrayAtColumn (18); - - String[] astrFullCreditIndexName = csvGrid.stringArrayAtColumn (19); - - double[] adblCreditIndexQuotedSpread = csvGrid.doubleArrayAtColumn (20); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFundingFixingQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFundingFixingQuote[i][0] = adblFundingFixingQuote1Y[i]; - aadblFundingFixingQuote[i][1] = adblFundingFixingQuote2Y[i]; - aadblFundingFixingQuote[i][2] = adblFundingFixingQuote3Y[i]; - aadblFundingFixingQuote[i][3] = adblFundingFixingQuote4Y[i]; - aadblFundingFixingQuote[i][4] = adblFundingFixingQuote5Y[i]; - aadblFundingFixingQuote[i][5] = adblFundingFixingQuote6Y[i]; - aadblFundingFixingQuote[i][6] = adblFundingFixingQuote7Y[i]; - aadblFundingFixingQuote[i][7] = adblFundingFixingQuote8Y[i]; - aadblFundingFixingQuote[i][8] = adblFundingFixingQuote9Y[i]; - aadblFundingFixingQuote[i][9] = adblFundingFixingQuote10Y[i]; - aadblFundingFixingQuote[i][10] = adblFundingFixingQuote11Y[i]; - aadblFundingFixingQuote[i][11] = adblFundingFixingQuote12Y[i]; - aadblFundingFixingQuote[i][12] = adblFundingFixingQuote15Y[i]; - aadblFundingFixingQuote[i][13] = adblFundingFixingQuote20Y[i]; - aadblFundingFixingQuote[i][14] = adblFundingFixingQuote25Y[i]; - aadblFundingFixingQuote[i][15] = adblFundingFixingQuote30Y[i]; - aadblFundingFixingQuote[i][16] = adblFundingFixingQuote40Y[i]; - aadblFundingFixingQuote[i][17] = adblFundingFixingQuote50Y[i]; - adblCreditIndexQuotedSpread[i] *= 10000.; - } - - int i = 0; - String strDump = "Date,QuotedSpread"; - - for (String strForTenor : astrForTenor) - strDump += ",SURVIVAL::" + strForTenor + ",RECOVERY::" + strForTenor; - - System.out.println (strDump); - - TreeMap mapCCM = CreditCurveAPI.HorizonMetrics ( - adtSpot, - astrFundingFixingMaturityTenor, - aadblFundingFixingQuote, - astrFullCreditIndexName, - adblCreditIndexQuotedSpread, - astrForTenor - ); - - Set setSpotDate = mapCCM.keySet(); - - for (JulianDate dtSpot : setSpotDate) { - strDump = dtSpot.toString() + "," + adblCreditIndexQuotedSpread[i++]; - - CreditCurveMetrics ccmSpot = mapCCM.get (dtSpot); - - for (String strForTenor : astrForTenor) { - JulianDate dtFor = dtSpot.addTenor (strForTenor); - - strDump += "," + ccmSpot.survivalProbability (dtFor) + "," + ccmSpot.recoveryRate (dtFor); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/credithistorical/CDXNAIGS255YMetrics.java b/org/drip/sample/credithistorical/CDXNAIGS255YMetrics.java deleted file mode 100644 index 3af9512..0000000 --- a/org/drip/sample/credithistorical/CDXNAIGS255YMetrics.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.sample.credithistorical; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.CreditCurveMetrics; -import org.drip.service.env.EnvManager; -import org.drip.service.state.CreditCurveAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS255YMetrics generates the Historical Credit Survival/Recovery Metrics for the Index Contract CDX - * NA IG S25 5Y. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS255YMetrics { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSeries = 25; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\CreditCDXMarks\\CDXNAIGS" + iSeries + "5YReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFundingFixingMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFundingFixingQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFundingFixingQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFundingFixingQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFundingFixingQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFundingFixingQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFundingFixingQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFundingFixingQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFundingFixingQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFundingFixingQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFundingFixingQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFundingFixingQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFundingFixingQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFundingFixingQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFundingFixingQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFundingFixingQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFundingFixingQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFundingFixingQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFundingFixingQuote50Y = csvGrid.doubleArrayAtColumn (18); - - String[] astrFullCreditIndexName = csvGrid.stringArrayAtColumn (19); - - double[] adblCreditIndexQuotedSpread = csvGrid.doubleArrayAtColumn (20); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFundingFixingQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFundingFixingQuote[i][0] = adblFundingFixingQuote1Y[i]; - aadblFundingFixingQuote[i][1] = adblFundingFixingQuote2Y[i]; - aadblFundingFixingQuote[i][2] = adblFundingFixingQuote3Y[i]; - aadblFundingFixingQuote[i][3] = adblFundingFixingQuote4Y[i]; - aadblFundingFixingQuote[i][4] = adblFundingFixingQuote5Y[i]; - aadblFundingFixingQuote[i][5] = adblFundingFixingQuote6Y[i]; - aadblFundingFixingQuote[i][6] = adblFundingFixingQuote7Y[i]; - aadblFundingFixingQuote[i][7] = adblFundingFixingQuote8Y[i]; - aadblFundingFixingQuote[i][8] = adblFundingFixingQuote9Y[i]; - aadblFundingFixingQuote[i][9] = adblFundingFixingQuote10Y[i]; - aadblFundingFixingQuote[i][10] = adblFundingFixingQuote11Y[i]; - aadblFundingFixingQuote[i][11] = adblFundingFixingQuote12Y[i]; - aadblFundingFixingQuote[i][12] = adblFundingFixingQuote15Y[i]; - aadblFundingFixingQuote[i][13] = adblFundingFixingQuote20Y[i]; - aadblFundingFixingQuote[i][14] = adblFundingFixingQuote25Y[i]; - aadblFundingFixingQuote[i][15] = adblFundingFixingQuote30Y[i]; - aadblFundingFixingQuote[i][16] = adblFundingFixingQuote40Y[i]; - aadblFundingFixingQuote[i][17] = adblFundingFixingQuote50Y[i]; - adblCreditIndexQuotedSpread[i] *= 10000.; - } - - int i = 0; - String strDump = "Date,QuotedSpread"; - - for (String strForTenor : astrForTenor) - strDump += ",SURVIVAL::" + strForTenor + ",RECOVERY::" + strForTenor; - - System.out.println (strDump); - - TreeMap mapCCM = CreditCurveAPI.HorizonMetrics ( - adtSpot, - astrFundingFixingMaturityTenor, - aadblFundingFixingQuote, - astrFullCreditIndexName, - adblCreditIndexQuotedSpread, - astrForTenor - ); - - Set setSpotDate = mapCCM.keySet(); - - for (JulianDate dtSpot : setSpotDate) { - strDump = dtSpot.toString() + "," + adblCreditIndexQuotedSpread[i++]; - - CreditCurveMetrics ccmSpot = mapCCM.get (dtSpot); - - for (String strForTenor : astrForTenor) { - JulianDate dtFor = dtSpot.addTenor (strForTenor); - - strDump += "," + ccmSpot.survivalProbability (dtFor) + "," + ccmSpot.recoveryRate (dtFor); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/credithistorical/CDXNAIGS265YMetrics.java b/org/drip/sample/credithistorical/CDXNAIGS265YMetrics.java deleted file mode 100644 index c4f96f5..0000000 --- a/org/drip/sample/credithistorical/CDXNAIGS265YMetrics.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.sample.credithistorical; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.CreditCurveMetrics; -import org.drip.service.env.EnvManager; -import org.drip.service.state.CreditCurveAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS265YMetrics generates the Historical Credit Survival/Recovery Metrics for the Index Contract CDX - * NA IG S26 5Y. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS265YMetrics { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSeries = 26; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\CreditCDXMarks\\CDXNAIGS" + iSeries + "5YReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFundingFixingMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFundingFixingQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFundingFixingQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFundingFixingQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFundingFixingQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFundingFixingQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFundingFixingQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFundingFixingQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFundingFixingQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFundingFixingQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFundingFixingQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFundingFixingQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFundingFixingQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFundingFixingQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFundingFixingQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFundingFixingQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFundingFixingQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFundingFixingQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFundingFixingQuote50Y = csvGrid.doubleArrayAtColumn (18); - - String[] astrFullCreditIndexName = csvGrid.stringArrayAtColumn (19); - - double[] adblCreditIndexQuotedSpread = csvGrid.doubleArrayAtColumn (20); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFundingFixingQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFundingFixingQuote[i][0] = adblFundingFixingQuote1Y[i]; - aadblFundingFixingQuote[i][1] = adblFundingFixingQuote2Y[i]; - aadblFundingFixingQuote[i][2] = adblFundingFixingQuote3Y[i]; - aadblFundingFixingQuote[i][3] = adblFundingFixingQuote4Y[i]; - aadblFundingFixingQuote[i][4] = adblFundingFixingQuote5Y[i]; - aadblFundingFixingQuote[i][5] = adblFundingFixingQuote6Y[i]; - aadblFundingFixingQuote[i][6] = adblFundingFixingQuote7Y[i]; - aadblFundingFixingQuote[i][7] = adblFundingFixingQuote8Y[i]; - aadblFundingFixingQuote[i][8] = adblFundingFixingQuote9Y[i]; - aadblFundingFixingQuote[i][9] = adblFundingFixingQuote10Y[i]; - aadblFundingFixingQuote[i][10] = adblFundingFixingQuote11Y[i]; - aadblFundingFixingQuote[i][11] = adblFundingFixingQuote12Y[i]; - aadblFundingFixingQuote[i][12] = adblFundingFixingQuote15Y[i]; - aadblFundingFixingQuote[i][13] = adblFundingFixingQuote20Y[i]; - aadblFundingFixingQuote[i][14] = adblFundingFixingQuote25Y[i]; - aadblFundingFixingQuote[i][15] = adblFundingFixingQuote30Y[i]; - aadblFundingFixingQuote[i][16] = adblFundingFixingQuote40Y[i]; - aadblFundingFixingQuote[i][17] = adblFundingFixingQuote50Y[i]; - adblCreditIndexQuotedSpread[i] *= 10000.; - } - - int i = 0; - String strDump = "Date,QuotedSpread"; - - for (String strForTenor : astrForTenor) - strDump += ",SURVIVAL::" + strForTenor + ",RECOVERY::" + strForTenor; - - System.out.println (strDump); - - TreeMap mapCCM = CreditCurveAPI.HorizonMetrics ( - adtSpot, - astrFundingFixingMaturityTenor, - aadblFundingFixingQuote, - astrFullCreditIndexName, - adblCreditIndexQuotedSpread, - astrForTenor - ); - - Set setSpotDate = mapCCM.keySet(); - - for (JulianDate dtSpot : setSpotDate) { - strDump = dtSpot.toString() + "," + adblCreditIndexQuotedSpread[i++]; - - CreditCurveMetrics ccmSpot = mapCCM.get (dtSpot); - - for (String strForTenor : astrForTenor) { - JulianDate dtFor = dtSpot.addTenor (strForTenor); - - strDump += "," + ccmSpot.survivalProbability (dtFor) + "," + ccmSpot.recoveryRate (dtFor); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/creditindexpnl/CDXNAIGS155YAttribution.java b/org/drip/sample/creditindexpnl/CDXNAIGS155YAttribution.java deleted file mode 100644 index 22fee79..0000000 --- a/org/drip/sample/creditindexpnl/CDXNAIGS155YAttribution.java +++ /dev/null @@ -1,209 +0,0 @@ - -package org.drip.sample.creditindexpnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.CreditIndexAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS155YAttribution contains the Functionality associated with the Attribution of the CDX NA IG 5Y S15 - * Index. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS155YAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSeries = 15; - int iHorizonGap = 1; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\CreditCDXMarks\\CDXNAIGS" + iSeries + "5YReconstitutor.csv"; - String[] astrFundingFixingMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFundingFixingQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFundingFixingQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFundingFixingQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFundingFixingQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFundingFixingQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFundingFixingQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFundingFixingQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFundingFixingQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFundingFixingQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFundingFixingQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFundingFixingQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFundingFixingQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFundingFixingQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFundingFixingQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFundingFixingQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFundingFixingQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFundingFixingQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFundingFixingQuote50Y = csvGrid.doubleArrayAtColumn (18); - - String[] astrFullCreditIndexName = csvGrid.stringArrayAtColumn (19); - - double[] adblCreditIndexQuotedSpread = csvGrid.doubleArrayAtColumn (20); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFundingFixingQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFundingFixingQuote[i][0] = adblFundingFixingQuote1Y[i]; - aadblFundingFixingQuote[i][1] = adblFundingFixingQuote2Y[i]; - aadblFundingFixingQuote[i][2] = adblFundingFixingQuote3Y[i]; - aadblFundingFixingQuote[i][3] = adblFundingFixingQuote4Y[i]; - aadblFundingFixingQuote[i][4] = adblFundingFixingQuote5Y[i]; - aadblFundingFixingQuote[i][5] = adblFundingFixingQuote6Y[i]; - aadblFundingFixingQuote[i][6] = adblFundingFixingQuote7Y[i]; - aadblFundingFixingQuote[i][7] = adblFundingFixingQuote8Y[i]; - aadblFundingFixingQuote[i][8] = adblFundingFixingQuote9Y[i]; - aadblFundingFixingQuote[i][9] = adblFundingFixingQuote10Y[i]; - aadblFundingFixingQuote[i][10] = adblFundingFixingQuote11Y[i]; - aadblFundingFixingQuote[i][11] = adblFundingFixingQuote12Y[i]; - aadblFundingFixingQuote[i][12] = adblFundingFixingQuote15Y[i]; - aadblFundingFixingQuote[i][13] = adblFundingFixingQuote20Y[i]; - aadblFundingFixingQuote[i][14] = adblFundingFixingQuote25Y[i]; - aadblFundingFixingQuote[i][15] = adblFundingFixingQuote30Y[i]; - aadblFundingFixingQuote[i][16] = adblFundingFixingQuote40Y[i]; - aadblFundingFixingQuote[i][17] = adblFundingFixingQuote50Y[i]; - adblCreditIndexQuotedSpread[i] *= 10000.; - } - - List lsPCC = CreditIndexAPI.HorizonChangeAttribution ( - adtSpot, - 1, - astrFundingFixingMaturityTenor, - aadblFundingFixingQuote, - astrFullCreditIndexName, - adblCreditIndexQuotedSpread - ); - - System.out.println ("FirstDate,SecondDate,CreditLabel,Horizon,TotalPnL,MarketShiftPnL,RollDownPnL,AccrualPnL,ExplainedPnL,UnexplainedPnL,FixedCoupon,FirstFairPremium,SecondFairPremium,RollDownFairPremium,CleanFixedDV01"); - - for (PositionChangeComponents pcc : lsPCC) { - if (null == pcc) continue; - - CDSMarketSnap cdsmsFirst = (CDSMarketSnap) pcc.pmsFirst(); - - CDSMarketSnap cdsmsSecond = (CDSMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - cdsmsFirst.creditLabel() + ", " + - iHorizonGap + "," + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.fixedCoupon(), 1, 2, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.currentFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsSecond.currentFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.rollDownFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.cleanDV01(), 1, 4, 1.) - ); - } - } -} diff --git a/org/drip/sample/creditindexpnl/CDXNAIGS165YAttribution.java b/org/drip/sample/creditindexpnl/CDXNAIGS165YAttribution.java deleted file mode 100644 index 381d3ac..0000000 --- a/org/drip/sample/creditindexpnl/CDXNAIGS165YAttribution.java +++ /dev/null @@ -1,209 +0,0 @@ - -package org.drip.sample.creditindexpnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.CreditIndexAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS165YAttribution contains the Functionality associated with the Attribution of the CDX NA IG 5Y S16 - * Index. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS165YAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSeries = 16; - int iHorizonGap = 1; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\CreditCDXMarks\\CDXNAIGS" + iSeries + "5YReconstitutor.csv"; - String[] astrFundingFixingMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFundingFixingQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFundingFixingQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFundingFixingQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFundingFixingQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFundingFixingQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFundingFixingQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFundingFixingQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFundingFixingQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFundingFixingQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFundingFixingQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFundingFixingQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFundingFixingQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFundingFixingQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFundingFixingQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFundingFixingQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFundingFixingQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFundingFixingQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFundingFixingQuote50Y = csvGrid.doubleArrayAtColumn (18); - - String[] astrFullCreditIndexName = csvGrid.stringArrayAtColumn (19); - - double[] adblCreditIndexQuotedSpread = csvGrid.doubleArrayAtColumn (20); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFundingFixingQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFundingFixingQuote[i][0] = adblFundingFixingQuote1Y[i]; - aadblFundingFixingQuote[i][1] = adblFundingFixingQuote2Y[i]; - aadblFundingFixingQuote[i][2] = adblFundingFixingQuote3Y[i]; - aadblFundingFixingQuote[i][3] = adblFundingFixingQuote4Y[i]; - aadblFundingFixingQuote[i][4] = adblFundingFixingQuote5Y[i]; - aadblFundingFixingQuote[i][5] = adblFundingFixingQuote6Y[i]; - aadblFundingFixingQuote[i][6] = adblFundingFixingQuote7Y[i]; - aadblFundingFixingQuote[i][7] = adblFundingFixingQuote8Y[i]; - aadblFundingFixingQuote[i][8] = adblFundingFixingQuote9Y[i]; - aadblFundingFixingQuote[i][9] = adblFundingFixingQuote10Y[i]; - aadblFundingFixingQuote[i][10] = adblFundingFixingQuote11Y[i]; - aadblFundingFixingQuote[i][11] = adblFundingFixingQuote12Y[i]; - aadblFundingFixingQuote[i][12] = adblFundingFixingQuote15Y[i]; - aadblFundingFixingQuote[i][13] = adblFundingFixingQuote20Y[i]; - aadblFundingFixingQuote[i][14] = adblFundingFixingQuote25Y[i]; - aadblFundingFixingQuote[i][15] = adblFundingFixingQuote30Y[i]; - aadblFundingFixingQuote[i][16] = adblFundingFixingQuote40Y[i]; - aadblFundingFixingQuote[i][17] = adblFundingFixingQuote50Y[i]; - adblCreditIndexQuotedSpread[i] *= 10000.; - } - - List lsPCC = CreditIndexAPI.HorizonChangeAttribution ( - adtSpot, - 1, - astrFundingFixingMaturityTenor, - aadblFundingFixingQuote, - astrFullCreditIndexName, - adblCreditIndexQuotedSpread - ); - - System.out.println ("FirstDate,SecondDate,CreditLabel,Horizon,TotalPnL,MarketShiftPnL,RollDownPnL,AccrualPnL,ExplainedPnL,UnexplainedPnL,FixedCoupon,FirstFairPremium,SecondFairPremium,RollDownFairPremium,CleanFixedDV01"); - - for (PositionChangeComponents pcc : lsPCC) { - if (null == pcc) continue; - - CDSMarketSnap cdsmsFirst = (CDSMarketSnap) pcc.pmsFirst(); - - CDSMarketSnap cdsmsSecond = (CDSMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - cdsmsFirst.creditLabel() + ", " + - iHorizonGap + "," + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.fixedCoupon(), 1, 2, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.currentFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsSecond.currentFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.rollDownFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.cleanDV01(), 1, 4, 1.) - ); - } - } -} diff --git a/org/drip/sample/creditindexpnl/CDXNAIGS175YAttribution.java b/org/drip/sample/creditindexpnl/CDXNAIGS175YAttribution.java deleted file mode 100644 index d8af39e..0000000 --- a/org/drip/sample/creditindexpnl/CDXNAIGS175YAttribution.java +++ /dev/null @@ -1,209 +0,0 @@ - -package org.drip.sample.creditindexpnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.CreditIndexAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS175YAttribution contains the Functionality associated with the Attribution of the CDX NA IG 5Y S17 - * Index. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS175YAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSeries = 17; - int iHorizonGap = 1; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\CreditCDXMarks\\CDXNAIGS" + iSeries + "5YReconstitutor.csv"; - String[] astrFundingFixingMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFundingFixingQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFundingFixingQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFundingFixingQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFundingFixingQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFundingFixingQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFundingFixingQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFundingFixingQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFundingFixingQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFundingFixingQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFundingFixingQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFundingFixingQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFundingFixingQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFundingFixingQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFundingFixingQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFundingFixingQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFundingFixingQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFundingFixingQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFundingFixingQuote50Y = csvGrid.doubleArrayAtColumn (18); - - String[] astrFullCreditIndexName = csvGrid.stringArrayAtColumn (19); - - double[] adblCreditIndexQuotedSpread = csvGrid.doubleArrayAtColumn (20); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFundingFixingQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFundingFixingQuote[i][0] = adblFundingFixingQuote1Y[i]; - aadblFundingFixingQuote[i][1] = adblFundingFixingQuote2Y[i]; - aadblFundingFixingQuote[i][2] = adblFundingFixingQuote3Y[i]; - aadblFundingFixingQuote[i][3] = adblFundingFixingQuote4Y[i]; - aadblFundingFixingQuote[i][4] = adblFundingFixingQuote5Y[i]; - aadblFundingFixingQuote[i][5] = adblFundingFixingQuote6Y[i]; - aadblFundingFixingQuote[i][6] = adblFundingFixingQuote7Y[i]; - aadblFundingFixingQuote[i][7] = adblFundingFixingQuote8Y[i]; - aadblFundingFixingQuote[i][8] = adblFundingFixingQuote9Y[i]; - aadblFundingFixingQuote[i][9] = adblFundingFixingQuote10Y[i]; - aadblFundingFixingQuote[i][10] = adblFundingFixingQuote11Y[i]; - aadblFundingFixingQuote[i][11] = adblFundingFixingQuote12Y[i]; - aadblFundingFixingQuote[i][12] = adblFundingFixingQuote15Y[i]; - aadblFundingFixingQuote[i][13] = adblFundingFixingQuote20Y[i]; - aadblFundingFixingQuote[i][14] = adblFundingFixingQuote25Y[i]; - aadblFundingFixingQuote[i][15] = adblFundingFixingQuote30Y[i]; - aadblFundingFixingQuote[i][16] = adblFundingFixingQuote40Y[i]; - aadblFundingFixingQuote[i][17] = adblFundingFixingQuote50Y[i]; - adblCreditIndexQuotedSpread[i] *= 10000.; - } - - List lsPCC = CreditIndexAPI.HorizonChangeAttribution ( - adtSpot, - 1, - astrFundingFixingMaturityTenor, - aadblFundingFixingQuote, - astrFullCreditIndexName, - adblCreditIndexQuotedSpread - ); - - System.out.println ("FirstDate,SecondDate,CreditLabel,Horizon,TotalPnL,MarketShiftPnL,RollDownPnL,AccrualPnL,ExplainedPnL,UnexplainedPnL,FixedCoupon,FirstFairPremium,SecondFairPremium,RollDownFairPremium,CleanFixedDV01"); - - for (PositionChangeComponents pcc : lsPCC) { - if (null == pcc) continue; - - CDSMarketSnap cdsmsFirst = (CDSMarketSnap) pcc.pmsFirst(); - - CDSMarketSnap cdsmsSecond = (CDSMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - cdsmsFirst.creditLabel() + ", " + - iHorizonGap + "," + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.fixedCoupon(), 1, 2, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.currentFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsSecond.currentFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.rollDownFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.cleanDV01(), 1, 4, 1.) - ); - } - } -} diff --git a/org/drip/sample/creditindexpnl/CDXNAIGS185YAttribution.java b/org/drip/sample/creditindexpnl/CDXNAIGS185YAttribution.java deleted file mode 100644 index b245562..0000000 --- a/org/drip/sample/creditindexpnl/CDXNAIGS185YAttribution.java +++ /dev/null @@ -1,209 +0,0 @@ - -package org.drip.sample.creditindexpnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.CreditIndexAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS185YAttribution contains the Functionality associated with the Attribution of the CDX NA IG 5Y S18 - * Index. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS185YAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSeries = 18; - int iHorizonGap = 1; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\CreditCDXMarks\\CDXNAIGS" + iSeries + "5YReconstitutor.csv"; - String[] astrFundingFixingMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFundingFixingQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFundingFixingQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFundingFixingQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFundingFixingQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFundingFixingQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFundingFixingQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFundingFixingQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFundingFixingQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFundingFixingQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFundingFixingQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFundingFixingQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFundingFixingQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFundingFixingQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFundingFixingQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFundingFixingQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFundingFixingQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFundingFixingQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFundingFixingQuote50Y = csvGrid.doubleArrayAtColumn (18); - - String[] astrFullCreditIndexName = csvGrid.stringArrayAtColumn (19); - - double[] adblCreditIndexQuotedSpread = csvGrid.doubleArrayAtColumn (20); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFundingFixingQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFundingFixingQuote[i][0] = adblFundingFixingQuote1Y[i]; - aadblFundingFixingQuote[i][1] = adblFundingFixingQuote2Y[i]; - aadblFundingFixingQuote[i][2] = adblFundingFixingQuote3Y[i]; - aadblFundingFixingQuote[i][3] = adblFundingFixingQuote4Y[i]; - aadblFundingFixingQuote[i][4] = adblFundingFixingQuote5Y[i]; - aadblFundingFixingQuote[i][5] = adblFundingFixingQuote6Y[i]; - aadblFundingFixingQuote[i][6] = adblFundingFixingQuote7Y[i]; - aadblFundingFixingQuote[i][7] = adblFundingFixingQuote8Y[i]; - aadblFundingFixingQuote[i][8] = adblFundingFixingQuote9Y[i]; - aadblFundingFixingQuote[i][9] = adblFundingFixingQuote10Y[i]; - aadblFundingFixingQuote[i][10] = adblFundingFixingQuote11Y[i]; - aadblFundingFixingQuote[i][11] = adblFundingFixingQuote12Y[i]; - aadblFundingFixingQuote[i][12] = adblFundingFixingQuote15Y[i]; - aadblFundingFixingQuote[i][13] = adblFundingFixingQuote20Y[i]; - aadblFundingFixingQuote[i][14] = adblFundingFixingQuote25Y[i]; - aadblFundingFixingQuote[i][15] = adblFundingFixingQuote30Y[i]; - aadblFundingFixingQuote[i][16] = adblFundingFixingQuote40Y[i]; - aadblFundingFixingQuote[i][17] = adblFundingFixingQuote50Y[i]; - adblCreditIndexQuotedSpread[i] *= 10000.; - } - - List lsPCC = CreditIndexAPI.HorizonChangeAttribution ( - adtSpot, - 1, - astrFundingFixingMaturityTenor, - aadblFundingFixingQuote, - astrFullCreditIndexName, - adblCreditIndexQuotedSpread - ); - - System.out.println ("FirstDate,SecondDate,CreditLabel,Horizon,TotalPnL,MarketShiftPnL,RollDownPnL,AccrualPnL,ExplainedPnL,UnexplainedPnL,FixedCoupon,FirstFairPremium,SecondFairPremium,RollDownFairPremium,CleanFixedDV01"); - - for (PositionChangeComponents pcc : lsPCC) { - if (null == pcc) continue; - - CDSMarketSnap cdsmsFirst = (CDSMarketSnap) pcc.pmsFirst(); - - CDSMarketSnap cdsmsSecond = (CDSMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - cdsmsFirst.creditLabel() + ", " + - iHorizonGap + "," + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.fixedCoupon(), 1, 2, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.currentFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsSecond.currentFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.rollDownFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.cleanDV01(), 1, 4, 1.) - ); - } - } -} diff --git a/org/drip/sample/creditindexpnl/CDXNAIGS195YAttribution.java b/org/drip/sample/creditindexpnl/CDXNAIGS195YAttribution.java deleted file mode 100644 index f39a4e7..0000000 --- a/org/drip/sample/creditindexpnl/CDXNAIGS195YAttribution.java +++ /dev/null @@ -1,209 +0,0 @@ - -package org.drip.sample.creditindexpnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.CreditIndexAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS195YAttribution contains the Functionality associated with the Attribution of the CDX NA IG 5Y S19 - * Index. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS195YAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSeries = 19; - int iHorizonGap = 1; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\CreditCDXMarks\\CDXNAIGS" + iSeries + "5YReconstitutor.csv"; - String[] astrFundingFixingMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFundingFixingQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFundingFixingQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFundingFixingQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFundingFixingQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFundingFixingQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFundingFixingQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFundingFixingQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFundingFixingQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFundingFixingQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFundingFixingQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFundingFixingQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFundingFixingQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFundingFixingQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFundingFixingQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFundingFixingQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFundingFixingQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFundingFixingQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFundingFixingQuote50Y = csvGrid.doubleArrayAtColumn (18); - - String[] astrFullCreditIndexName = csvGrid.stringArrayAtColumn (19); - - double[] adblCreditIndexQuotedSpread = csvGrid.doubleArrayAtColumn (20); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFundingFixingQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFundingFixingQuote[i][0] = adblFundingFixingQuote1Y[i]; - aadblFundingFixingQuote[i][1] = adblFundingFixingQuote2Y[i]; - aadblFundingFixingQuote[i][2] = adblFundingFixingQuote3Y[i]; - aadblFundingFixingQuote[i][3] = adblFundingFixingQuote4Y[i]; - aadblFundingFixingQuote[i][4] = adblFundingFixingQuote5Y[i]; - aadblFundingFixingQuote[i][5] = adblFundingFixingQuote6Y[i]; - aadblFundingFixingQuote[i][6] = adblFundingFixingQuote7Y[i]; - aadblFundingFixingQuote[i][7] = adblFundingFixingQuote8Y[i]; - aadblFundingFixingQuote[i][8] = adblFundingFixingQuote9Y[i]; - aadblFundingFixingQuote[i][9] = adblFundingFixingQuote10Y[i]; - aadblFundingFixingQuote[i][10] = adblFundingFixingQuote11Y[i]; - aadblFundingFixingQuote[i][11] = adblFundingFixingQuote12Y[i]; - aadblFundingFixingQuote[i][12] = adblFundingFixingQuote15Y[i]; - aadblFundingFixingQuote[i][13] = adblFundingFixingQuote20Y[i]; - aadblFundingFixingQuote[i][14] = adblFundingFixingQuote25Y[i]; - aadblFundingFixingQuote[i][15] = adblFundingFixingQuote30Y[i]; - aadblFundingFixingQuote[i][16] = adblFundingFixingQuote40Y[i]; - aadblFundingFixingQuote[i][17] = adblFundingFixingQuote50Y[i]; - adblCreditIndexQuotedSpread[i] *= 10000.; - } - - List lsPCC = CreditIndexAPI.HorizonChangeAttribution ( - adtSpot, - 1, - astrFundingFixingMaturityTenor, - aadblFundingFixingQuote, - astrFullCreditIndexName, - adblCreditIndexQuotedSpread - ); - - System.out.println ("FirstDate,SecondDate,CreditLabel,Horizon,TotalPnL,MarketShiftPnL,RollDownPnL,AccrualPnL,ExplainedPnL,UnexplainedPnL,FixedCoupon,FirstFairPremium,SecondFairPremium,RollDownFairPremium,CleanFixedDV01"); - - for (PositionChangeComponents pcc : lsPCC) { - if (null == pcc) continue; - - CDSMarketSnap cdsmsFirst = (CDSMarketSnap) pcc.pmsFirst(); - - CDSMarketSnap cdsmsSecond = (CDSMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - cdsmsFirst.creditLabel() + ", " + - iHorizonGap + "," + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.fixedCoupon(), 1, 2, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.currentFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsSecond.currentFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.rollDownFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.cleanDV01(), 1, 4, 1.) - ); - } - } -} diff --git a/org/drip/sample/creditindexpnl/CDXNAIGS205YAttribution.java b/org/drip/sample/creditindexpnl/CDXNAIGS205YAttribution.java deleted file mode 100644 index 6c1dade..0000000 --- a/org/drip/sample/creditindexpnl/CDXNAIGS205YAttribution.java +++ /dev/null @@ -1,209 +0,0 @@ - -package org.drip.sample.creditindexpnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.CreditIndexAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS205YAttribution contains the Functionality associated with the Attribution of the CDX NA IG 5Y S20 - * Index. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS205YAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSeries = 20; - int iHorizonGap = 1; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\CreditCDXMarks\\CDXNAIGS" + iSeries + "5YReconstitutor.csv"; - String[] astrFundingFixingMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFundingFixingQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFundingFixingQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFundingFixingQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFundingFixingQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFundingFixingQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFundingFixingQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFundingFixingQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFundingFixingQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFundingFixingQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFundingFixingQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFundingFixingQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFundingFixingQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFundingFixingQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFundingFixingQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFundingFixingQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFundingFixingQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFundingFixingQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFundingFixingQuote50Y = csvGrid.doubleArrayAtColumn (18); - - String[] astrFullCreditIndexName = csvGrid.stringArrayAtColumn (19); - - double[] adblCreditIndexQuotedSpread = csvGrid.doubleArrayAtColumn (20); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFundingFixingQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFundingFixingQuote[i][0] = adblFundingFixingQuote1Y[i]; - aadblFundingFixingQuote[i][1] = adblFundingFixingQuote2Y[i]; - aadblFundingFixingQuote[i][2] = adblFundingFixingQuote3Y[i]; - aadblFundingFixingQuote[i][3] = adblFundingFixingQuote4Y[i]; - aadblFundingFixingQuote[i][4] = adblFundingFixingQuote5Y[i]; - aadblFundingFixingQuote[i][5] = adblFundingFixingQuote6Y[i]; - aadblFundingFixingQuote[i][6] = adblFundingFixingQuote7Y[i]; - aadblFundingFixingQuote[i][7] = adblFundingFixingQuote8Y[i]; - aadblFundingFixingQuote[i][8] = adblFundingFixingQuote9Y[i]; - aadblFundingFixingQuote[i][9] = adblFundingFixingQuote10Y[i]; - aadblFundingFixingQuote[i][10] = adblFundingFixingQuote11Y[i]; - aadblFundingFixingQuote[i][11] = adblFundingFixingQuote12Y[i]; - aadblFundingFixingQuote[i][12] = adblFundingFixingQuote15Y[i]; - aadblFundingFixingQuote[i][13] = adblFundingFixingQuote20Y[i]; - aadblFundingFixingQuote[i][14] = adblFundingFixingQuote25Y[i]; - aadblFundingFixingQuote[i][15] = adblFundingFixingQuote30Y[i]; - aadblFundingFixingQuote[i][16] = adblFundingFixingQuote40Y[i]; - aadblFundingFixingQuote[i][17] = adblFundingFixingQuote50Y[i]; - adblCreditIndexQuotedSpread[i] *= 10000.; - } - - List lsPCC = CreditIndexAPI.HorizonChangeAttribution ( - adtSpot, - 1, - astrFundingFixingMaturityTenor, - aadblFundingFixingQuote, - astrFullCreditIndexName, - adblCreditIndexQuotedSpread - ); - - System.out.println ("FirstDate,SecondDate,CreditLabel,Horizon,TotalPnL,MarketShiftPnL,RollDownPnL,AccrualPnL,ExplainedPnL,UnexplainedPnL,FixedCoupon,FirstFairPremium,SecondFairPremium,RollDownFairPremium,CleanFixedDV01"); - - for (PositionChangeComponents pcc : lsPCC) { - if (null == pcc) continue; - - CDSMarketSnap cdsmsFirst = (CDSMarketSnap) pcc.pmsFirst(); - - CDSMarketSnap cdsmsSecond = (CDSMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - cdsmsFirst.creditLabel() + ", " + - iHorizonGap + "," + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.fixedCoupon(), 1, 2, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.currentFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsSecond.currentFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.rollDownFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.cleanDV01(), 1, 4, 1.) - ); - } - } -} diff --git a/org/drip/sample/creditindexpnl/CDXNAIGS215YAttribution.java b/org/drip/sample/creditindexpnl/CDXNAIGS215YAttribution.java deleted file mode 100644 index ab96a0d..0000000 --- a/org/drip/sample/creditindexpnl/CDXNAIGS215YAttribution.java +++ /dev/null @@ -1,209 +0,0 @@ - -package org.drip.sample.creditindexpnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.CreditIndexAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS215YAttribution contains the Functionality associated with the Attribution of the CDX NA IG 5Y S21 - * Index. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS215YAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSeries = 21; - int iHorizonGap = 1; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\CreditCDXMarks\\CDXNAIGS" + iSeries + "5YReconstitutor.csv"; - String[] astrFundingFixingMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFundingFixingQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFundingFixingQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFundingFixingQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFundingFixingQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFundingFixingQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFundingFixingQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFundingFixingQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFundingFixingQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFundingFixingQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFundingFixingQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFundingFixingQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFundingFixingQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFundingFixingQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFundingFixingQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFundingFixingQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFundingFixingQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFundingFixingQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFundingFixingQuote50Y = csvGrid.doubleArrayAtColumn (18); - - String[] astrFullCreditIndexName = csvGrid.stringArrayAtColumn (19); - - double[] adblCreditIndexQuotedSpread = csvGrid.doubleArrayAtColumn (20); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFundingFixingQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFundingFixingQuote[i][0] = adblFundingFixingQuote1Y[i]; - aadblFundingFixingQuote[i][1] = adblFundingFixingQuote2Y[i]; - aadblFundingFixingQuote[i][2] = adblFundingFixingQuote3Y[i]; - aadblFundingFixingQuote[i][3] = adblFundingFixingQuote4Y[i]; - aadblFundingFixingQuote[i][4] = adblFundingFixingQuote5Y[i]; - aadblFundingFixingQuote[i][5] = adblFundingFixingQuote6Y[i]; - aadblFundingFixingQuote[i][6] = adblFundingFixingQuote7Y[i]; - aadblFundingFixingQuote[i][7] = adblFundingFixingQuote8Y[i]; - aadblFundingFixingQuote[i][8] = adblFundingFixingQuote9Y[i]; - aadblFundingFixingQuote[i][9] = adblFundingFixingQuote10Y[i]; - aadblFundingFixingQuote[i][10] = adblFundingFixingQuote11Y[i]; - aadblFundingFixingQuote[i][11] = adblFundingFixingQuote12Y[i]; - aadblFundingFixingQuote[i][12] = adblFundingFixingQuote15Y[i]; - aadblFundingFixingQuote[i][13] = adblFundingFixingQuote20Y[i]; - aadblFundingFixingQuote[i][14] = adblFundingFixingQuote25Y[i]; - aadblFundingFixingQuote[i][15] = adblFundingFixingQuote30Y[i]; - aadblFundingFixingQuote[i][16] = adblFundingFixingQuote40Y[i]; - aadblFundingFixingQuote[i][17] = adblFundingFixingQuote50Y[i]; - adblCreditIndexQuotedSpread[i] *= 10000.; - } - - List lsPCC = CreditIndexAPI.HorizonChangeAttribution ( - adtSpot, - 1, - astrFundingFixingMaturityTenor, - aadblFundingFixingQuote, - astrFullCreditIndexName, - adblCreditIndexQuotedSpread - ); - - System.out.println ("FirstDate,SecondDate,CreditLabel,Horizon,TotalPnL,MarketShiftPnL,RollDownPnL,AccrualPnL,ExplainedPnL,UnexplainedPnL,FixedCoupon,FirstFairPremium,SecondFairPremium,RollDownFairPremium,CleanFixedDV01"); - - for (PositionChangeComponents pcc : lsPCC) { - if (null == pcc) continue; - - CDSMarketSnap cdsmsFirst = (CDSMarketSnap) pcc.pmsFirst(); - - CDSMarketSnap cdsmsSecond = (CDSMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - cdsmsFirst.creditLabel() + ", " + - iHorizonGap + "," + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.fixedCoupon(), 1, 2, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.currentFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsSecond.currentFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.rollDownFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.cleanDV01(), 1, 4, 1.) - ); - } - } -} diff --git a/org/drip/sample/creditindexpnl/CDXNAIGS225YAttribution.java b/org/drip/sample/creditindexpnl/CDXNAIGS225YAttribution.java deleted file mode 100644 index f3b98c2..0000000 --- a/org/drip/sample/creditindexpnl/CDXNAIGS225YAttribution.java +++ /dev/null @@ -1,209 +0,0 @@ - -package org.drip.sample.creditindexpnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.CreditIndexAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS225YAttribution contains the Functionality associated with the Attribution of the CDX NA IG 5Y S22 - * Index. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS225YAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSeries = 22; - int iHorizonGap = 1; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\CreditCDXMarks\\CDXNAIGS" + iSeries + "5YReconstitutor.csv"; - String[] astrFundingFixingMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFundingFixingQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFundingFixingQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFundingFixingQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFundingFixingQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFundingFixingQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFundingFixingQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFundingFixingQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFundingFixingQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFundingFixingQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFundingFixingQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFundingFixingQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFundingFixingQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFundingFixingQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFundingFixingQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFundingFixingQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFundingFixingQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFundingFixingQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFundingFixingQuote50Y = csvGrid.doubleArrayAtColumn (18); - - String[] astrFullCreditIndexName = csvGrid.stringArrayAtColumn (19); - - double[] adblCreditIndexQuotedSpread = csvGrid.doubleArrayAtColumn (20); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFundingFixingQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFundingFixingQuote[i][0] = adblFundingFixingQuote1Y[i]; - aadblFundingFixingQuote[i][1] = adblFundingFixingQuote2Y[i]; - aadblFundingFixingQuote[i][2] = adblFundingFixingQuote3Y[i]; - aadblFundingFixingQuote[i][3] = adblFundingFixingQuote4Y[i]; - aadblFundingFixingQuote[i][4] = adblFundingFixingQuote5Y[i]; - aadblFundingFixingQuote[i][5] = adblFundingFixingQuote6Y[i]; - aadblFundingFixingQuote[i][6] = adblFundingFixingQuote7Y[i]; - aadblFundingFixingQuote[i][7] = adblFundingFixingQuote8Y[i]; - aadblFundingFixingQuote[i][8] = adblFundingFixingQuote9Y[i]; - aadblFundingFixingQuote[i][9] = adblFundingFixingQuote10Y[i]; - aadblFundingFixingQuote[i][10] = adblFundingFixingQuote11Y[i]; - aadblFundingFixingQuote[i][11] = adblFundingFixingQuote12Y[i]; - aadblFundingFixingQuote[i][12] = adblFundingFixingQuote15Y[i]; - aadblFundingFixingQuote[i][13] = adblFundingFixingQuote20Y[i]; - aadblFundingFixingQuote[i][14] = adblFundingFixingQuote25Y[i]; - aadblFundingFixingQuote[i][15] = adblFundingFixingQuote30Y[i]; - aadblFundingFixingQuote[i][16] = adblFundingFixingQuote40Y[i]; - aadblFundingFixingQuote[i][17] = adblFundingFixingQuote50Y[i]; - adblCreditIndexQuotedSpread[i] *= 10000.; - } - - List lsPCC = CreditIndexAPI.HorizonChangeAttribution ( - adtSpot, - 1, - astrFundingFixingMaturityTenor, - aadblFundingFixingQuote, - astrFullCreditIndexName, - adblCreditIndexQuotedSpread - ); - - System.out.println ("FirstDate,SecondDate,CreditLabel,Horizon,TotalPnL,MarketShiftPnL,RollDownPnL,AccrualPnL,ExplainedPnL,UnexplainedPnL,FixedCoupon,FirstFairPremium,SecondFairPremium,RollDownFairPremium,CleanFixedDV01"); - - for (PositionChangeComponents pcc : lsPCC) { - if (null == pcc) continue; - - CDSMarketSnap cdsmsFirst = (CDSMarketSnap) pcc.pmsFirst(); - - CDSMarketSnap cdsmsSecond = (CDSMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - cdsmsFirst.creditLabel() + ", " + - iHorizonGap + "," + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.fixedCoupon(), 1, 2, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.currentFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsSecond.currentFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.rollDownFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.cleanDV01(), 1, 4, 1.) - ); - } - } -} diff --git a/org/drip/sample/creditindexpnl/CDXNAIGS235YAttribution.java b/org/drip/sample/creditindexpnl/CDXNAIGS235YAttribution.java deleted file mode 100644 index 132d1b0..0000000 --- a/org/drip/sample/creditindexpnl/CDXNAIGS235YAttribution.java +++ /dev/null @@ -1,209 +0,0 @@ - -package org.drip.sample.creditindexpnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.CreditIndexAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS235YAttribution contains the Functionality associated with the Attribution of the CDX NA IG 5Y S23 - * Index. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS235YAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSeries = 23; - int iHorizonGap = 1; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\CreditCDXMarks\\CDXNAIGS" + iSeries + "5YReconstitutor.csv"; - String[] astrFundingFixingMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFundingFixingQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFundingFixingQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFundingFixingQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFundingFixingQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFundingFixingQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFundingFixingQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFundingFixingQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFundingFixingQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFundingFixingQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFundingFixingQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFundingFixingQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFundingFixingQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFundingFixingQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFundingFixingQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFundingFixingQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFundingFixingQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFundingFixingQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFundingFixingQuote50Y = csvGrid.doubleArrayAtColumn (18); - - String[] astrFullCreditIndexName = csvGrid.stringArrayAtColumn (19); - - double[] adblCreditIndexQuotedSpread = csvGrid.doubleArrayAtColumn (20); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFundingFixingQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFundingFixingQuote[i][0] = adblFundingFixingQuote1Y[i]; - aadblFundingFixingQuote[i][1] = adblFundingFixingQuote2Y[i]; - aadblFundingFixingQuote[i][2] = adblFundingFixingQuote3Y[i]; - aadblFundingFixingQuote[i][3] = adblFundingFixingQuote4Y[i]; - aadblFundingFixingQuote[i][4] = adblFundingFixingQuote5Y[i]; - aadblFundingFixingQuote[i][5] = adblFundingFixingQuote6Y[i]; - aadblFundingFixingQuote[i][6] = adblFundingFixingQuote7Y[i]; - aadblFundingFixingQuote[i][7] = adblFundingFixingQuote8Y[i]; - aadblFundingFixingQuote[i][8] = adblFundingFixingQuote9Y[i]; - aadblFundingFixingQuote[i][9] = adblFundingFixingQuote10Y[i]; - aadblFundingFixingQuote[i][10] = adblFundingFixingQuote11Y[i]; - aadblFundingFixingQuote[i][11] = adblFundingFixingQuote12Y[i]; - aadblFundingFixingQuote[i][12] = adblFundingFixingQuote15Y[i]; - aadblFundingFixingQuote[i][13] = adblFundingFixingQuote20Y[i]; - aadblFundingFixingQuote[i][14] = adblFundingFixingQuote25Y[i]; - aadblFundingFixingQuote[i][15] = adblFundingFixingQuote30Y[i]; - aadblFundingFixingQuote[i][16] = adblFundingFixingQuote40Y[i]; - aadblFundingFixingQuote[i][17] = adblFundingFixingQuote50Y[i]; - adblCreditIndexQuotedSpread[i] *= 10000.; - } - - List lsPCC = CreditIndexAPI.HorizonChangeAttribution ( - adtSpot, - 1, - astrFundingFixingMaturityTenor, - aadblFundingFixingQuote, - astrFullCreditIndexName, - adblCreditIndexQuotedSpread - ); - - System.out.println ("FirstDate,SecondDate,CreditLabel,Horizon,TotalPnL,MarketShiftPnL,RollDownPnL,AccrualPnL,ExplainedPnL,UnexplainedPnL,FixedCoupon,FirstFairPremium,SecondFairPremium,RollDownFairPremium,CleanFixedDV01"); - - for (PositionChangeComponents pcc : lsPCC) { - if (null == pcc) continue; - - CDSMarketSnap cdsmsFirst = (CDSMarketSnap) pcc.pmsFirst(); - - CDSMarketSnap cdsmsSecond = (CDSMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - cdsmsFirst.creditLabel() + ", " + - iHorizonGap + "," + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.fixedCoupon(), 1, 2, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.currentFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsSecond.currentFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.rollDownFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.cleanDV01(), 1, 4, 1.) - ); - } - } -} diff --git a/org/drip/sample/creditindexpnl/CDXNAIGS245YAttribution.java b/org/drip/sample/creditindexpnl/CDXNAIGS245YAttribution.java deleted file mode 100644 index f4c5914..0000000 --- a/org/drip/sample/creditindexpnl/CDXNAIGS245YAttribution.java +++ /dev/null @@ -1,209 +0,0 @@ - -package org.drip.sample.creditindexpnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.CreditIndexAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS245YAttribution contains the Functionality associated with the Attribution of the CDX NA IG 5Y S24 - * Index. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS245YAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSeries = 24; - int iHorizonGap = 1; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\CreditCDXMarks\\CDXNAIGS" + iSeries + "5YReconstitutor.csv"; - String[] astrFundingFixingMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFundingFixingQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFundingFixingQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFundingFixingQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFundingFixingQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFundingFixingQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFundingFixingQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFundingFixingQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFundingFixingQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFundingFixingQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFundingFixingQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFundingFixingQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFundingFixingQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFundingFixingQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFundingFixingQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFundingFixingQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFundingFixingQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFundingFixingQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFundingFixingQuote50Y = csvGrid.doubleArrayAtColumn (18); - - String[] astrFullCreditIndexName = csvGrid.stringArrayAtColumn (19); - - double[] adblCreditIndexQuotedSpread = csvGrid.doubleArrayAtColumn (20); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFundingFixingQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFundingFixingQuote[i][0] = adblFundingFixingQuote1Y[i]; - aadblFundingFixingQuote[i][1] = adblFundingFixingQuote2Y[i]; - aadblFundingFixingQuote[i][2] = adblFundingFixingQuote3Y[i]; - aadblFundingFixingQuote[i][3] = adblFundingFixingQuote4Y[i]; - aadblFundingFixingQuote[i][4] = adblFundingFixingQuote5Y[i]; - aadblFundingFixingQuote[i][5] = adblFundingFixingQuote6Y[i]; - aadblFundingFixingQuote[i][6] = adblFundingFixingQuote7Y[i]; - aadblFundingFixingQuote[i][7] = adblFundingFixingQuote8Y[i]; - aadblFundingFixingQuote[i][8] = adblFundingFixingQuote9Y[i]; - aadblFundingFixingQuote[i][9] = adblFundingFixingQuote10Y[i]; - aadblFundingFixingQuote[i][10] = adblFundingFixingQuote11Y[i]; - aadblFundingFixingQuote[i][11] = adblFundingFixingQuote12Y[i]; - aadblFundingFixingQuote[i][12] = adblFundingFixingQuote15Y[i]; - aadblFundingFixingQuote[i][13] = adblFundingFixingQuote20Y[i]; - aadblFundingFixingQuote[i][14] = adblFundingFixingQuote25Y[i]; - aadblFundingFixingQuote[i][15] = adblFundingFixingQuote30Y[i]; - aadblFundingFixingQuote[i][16] = adblFundingFixingQuote40Y[i]; - aadblFundingFixingQuote[i][17] = adblFundingFixingQuote50Y[i]; - adblCreditIndexQuotedSpread[i] *= 10000.; - } - - List lsPCC = CreditIndexAPI.HorizonChangeAttribution ( - adtSpot, - 1, - astrFundingFixingMaturityTenor, - aadblFundingFixingQuote, - astrFullCreditIndexName, - adblCreditIndexQuotedSpread - ); - - System.out.println ("FirstDate,SecondDate,CreditLabel,Horizon,TotalPnL,MarketShiftPnL,RollDownPnL,AccrualPnL,ExplainedPnL,UnexplainedPnL,FixedCoupon,FirstFairPremium,SecondFairPremium,RollDownFairPremium,CleanFixedDV01"); - - for (PositionChangeComponents pcc : lsPCC) { - if (null == pcc) continue; - - CDSMarketSnap cdsmsFirst = (CDSMarketSnap) pcc.pmsFirst(); - - CDSMarketSnap cdsmsSecond = (CDSMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - cdsmsFirst.creditLabel() + ", " + - iHorizonGap + "," + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.fixedCoupon(), 1, 2, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.currentFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsSecond.currentFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.rollDownFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.cleanDV01(), 1, 4, 1.) - ); - } - } -} diff --git a/org/drip/sample/creditindexpnl/CDXNAIGS255YAttribution.java b/org/drip/sample/creditindexpnl/CDXNAIGS255YAttribution.java deleted file mode 100644 index 9545f80..0000000 --- a/org/drip/sample/creditindexpnl/CDXNAIGS255YAttribution.java +++ /dev/null @@ -1,209 +0,0 @@ - -package org.drip.sample.creditindexpnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.CreditIndexAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS255YAttribution contains the Functionality associated with the Attribution of the CDX NA IG 5Y S25 - * Index. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS255YAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSeries = 25; - int iHorizonGap = 1; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\CreditCDXMarks\\CDXNAIGS" + iSeries + "5YReconstitutor.csv"; - String[] astrFundingFixingMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFundingFixingQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFundingFixingQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFundingFixingQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFundingFixingQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFundingFixingQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFundingFixingQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFundingFixingQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFundingFixingQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFundingFixingQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFundingFixingQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFundingFixingQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFundingFixingQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFundingFixingQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFundingFixingQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFundingFixingQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFundingFixingQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFundingFixingQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFundingFixingQuote50Y = csvGrid.doubleArrayAtColumn (18); - - String[] astrFullCreditIndexName = csvGrid.stringArrayAtColumn (19); - - double[] adblCreditIndexQuotedSpread = csvGrid.doubleArrayAtColumn (20); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFundingFixingQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFundingFixingQuote[i][0] = adblFundingFixingQuote1Y[i]; - aadblFundingFixingQuote[i][1] = adblFundingFixingQuote2Y[i]; - aadblFundingFixingQuote[i][2] = adblFundingFixingQuote3Y[i]; - aadblFundingFixingQuote[i][3] = adblFundingFixingQuote4Y[i]; - aadblFundingFixingQuote[i][4] = adblFundingFixingQuote5Y[i]; - aadblFundingFixingQuote[i][5] = adblFundingFixingQuote6Y[i]; - aadblFundingFixingQuote[i][6] = adblFundingFixingQuote7Y[i]; - aadblFundingFixingQuote[i][7] = adblFundingFixingQuote8Y[i]; - aadblFundingFixingQuote[i][8] = adblFundingFixingQuote9Y[i]; - aadblFundingFixingQuote[i][9] = adblFundingFixingQuote10Y[i]; - aadblFundingFixingQuote[i][10] = adblFundingFixingQuote11Y[i]; - aadblFundingFixingQuote[i][11] = adblFundingFixingQuote12Y[i]; - aadblFundingFixingQuote[i][12] = adblFundingFixingQuote15Y[i]; - aadblFundingFixingQuote[i][13] = adblFundingFixingQuote20Y[i]; - aadblFundingFixingQuote[i][14] = adblFundingFixingQuote25Y[i]; - aadblFundingFixingQuote[i][15] = adblFundingFixingQuote30Y[i]; - aadblFundingFixingQuote[i][16] = adblFundingFixingQuote40Y[i]; - aadblFundingFixingQuote[i][17] = adblFundingFixingQuote50Y[i]; - adblCreditIndexQuotedSpread[i] *= 10000.; - } - - List lsPCC = CreditIndexAPI.HorizonChangeAttribution ( - adtSpot, - 1, - astrFundingFixingMaturityTenor, - aadblFundingFixingQuote, - astrFullCreditIndexName, - adblCreditIndexQuotedSpread - ); - - System.out.println ("FirstDate,SecondDate,CreditLabel,Horizon,TotalPnL,MarketShiftPnL,RollDownPnL,AccrualPnL,ExplainedPnL,UnexplainedPnL,FixedCoupon,FirstFairPremium,SecondFairPremium,RollDownFairPremium,CleanFixedDV01"); - - for (PositionChangeComponents pcc : lsPCC) { - if (null == pcc) continue; - - CDSMarketSnap cdsmsFirst = (CDSMarketSnap) pcc.pmsFirst(); - - CDSMarketSnap cdsmsSecond = (CDSMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - cdsmsFirst.creditLabel() + ", " + - iHorizonGap + "," + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.fixedCoupon(), 1, 2, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.currentFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsSecond.currentFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.rollDownFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.cleanDV01(), 1, 4, 1.) - ); - } - } -} diff --git a/org/drip/sample/creditindexpnl/CDXNAIGS265YAttribution.java b/org/drip/sample/creditindexpnl/CDXNAIGS265YAttribution.java deleted file mode 100644 index 62099dd..0000000 --- a/org/drip/sample/creditindexpnl/CDXNAIGS265YAttribution.java +++ /dev/null @@ -1,209 +0,0 @@ - -package org.drip.sample.creditindexpnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.CreditIndexAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDXNAIGS265YAttribution contains the Functionality associated with the Attribution of the CDX NA IG 5Y S26 - * Index. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXNAIGS265YAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iSeries = 26; - int iHorizonGap = 1; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\CreditCDXMarks\\CDXNAIGS" + iSeries + "5YReconstitutor.csv"; - String[] astrFundingFixingMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFundingFixingQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFundingFixingQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFundingFixingQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFundingFixingQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFundingFixingQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFundingFixingQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFundingFixingQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFundingFixingQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFundingFixingQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFundingFixingQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFundingFixingQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFundingFixingQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFundingFixingQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFundingFixingQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFundingFixingQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFundingFixingQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFundingFixingQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFundingFixingQuote50Y = csvGrid.doubleArrayAtColumn (18); - - String[] astrFullCreditIndexName = csvGrid.stringArrayAtColumn (19); - - double[] adblCreditIndexQuotedSpread = csvGrid.doubleArrayAtColumn (20); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFundingFixingQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFundingFixingQuote[i][0] = adblFundingFixingQuote1Y[i]; - aadblFundingFixingQuote[i][1] = adblFundingFixingQuote2Y[i]; - aadblFundingFixingQuote[i][2] = adblFundingFixingQuote3Y[i]; - aadblFundingFixingQuote[i][3] = adblFundingFixingQuote4Y[i]; - aadblFundingFixingQuote[i][4] = adblFundingFixingQuote5Y[i]; - aadblFundingFixingQuote[i][5] = adblFundingFixingQuote6Y[i]; - aadblFundingFixingQuote[i][6] = adblFundingFixingQuote7Y[i]; - aadblFundingFixingQuote[i][7] = adblFundingFixingQuote8Y[i]; - aadblFundingFixingQuote[i][8] = adblFundingFixingQuote9Y[i]; - aadblFundingFixingQuote[i][9] = adblFundingFixingQuote10Y[i]; - aadblFundingFixingQuote[i][10] = adblFundingFixingQuote11Y[i]; - aadblFundingFixingQuote[i][11] = adblFundingFixingQuote12Y[i]; - aadblFundingFixingQuote[i][12] = adblFundingFixingQuote15Y[i]; - aadblFundingFixingQuote[i][13] = adblFundingFixingQuote20Y[i]; - aadblFundingFixingQuote[i][14] = adblFundingFixingQuote25Y[i]; - aadblFundingFixingQuote[i][15] = adblFundingFixingQuote30Y[i]; - aadblFundingFixingQuote[i][16] = adblFundingFixingQuote40Y[i]; - aadblFundingFixingQuote[i][17] = adblFundingFixingQuote50Y[i]; - adblCreditIndexQuotedSpread[i] *= 10000.; - } - - List lsPCC = CreditIndexAPI.HorizonChangeAttribution ( - adtSpot, - 1, - astrFundingFixingMaturityTenor, - aadblFundingFixingQuote, - astrFullCreditIndexName, - adblCreditIndexQuotedSpread - ); - - System.out.println ("FirstDate,SecondDate,CreditLabel,Horizon,TotalPnL,MarketShiftPnL,RollDownPnL,AccrualPnL,ExplainedPnL,UnexplainedPnL,FixedCoupon,FirstFairPremium,SecondFairPremium,RollDownFairPremium,CleanFixedDV01"); - - for (PositionChangeComponents pcc : lsPCC) { - if (null == pcc) continue; - - CDSMarketSnap cdsmsFirst = (CDSMarketSnap) pcc.pmsFirst(); - - CDSMarketSnap cdsmsSecond = (CDSMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - cdsmsFirst.creditLabel() + ", " + - iHorizonGap + "," + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 4, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.fixedCoupon(), 1, 2, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.currentFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsSecond.currentFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.rollDownFairPremium(), 1, 4, 10000.) + ", " + - FormatUtil.FormatDouble (cdsmsFirst.cleanDV01(), 1, 4, 1.) - ); - } - } -} diff --git a/org/drip/sample/creditoption/CDSPayerReceiver.java b/org/drip/sample/creditoption/CDSPayerReceiver.java deleted file mode 100644 index f4d6d37..0000000 --- a/org/drip/sample/creditoption/CDSPayerReceiver.java +++ /dev/null @@ -1,500 +0,0 @@ - -package org.drip.sample.creditoption; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.market.otc.*; -import org.drip.param.creator.MarketParamsBuilder; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.pricer.CreditPricerParams; -import org.drip.param.valuation.ValuationParams; -import org.drip.pricer.option.BlackScholesAlgorithm; -import org.drip.product.creator.*; -import org.drip.product.definition.*; -import org.drip.product.option.CDSEuropeanOption; -import org.drip.product.params.LastTradingDateSetting; -import org.drip.product.rates.*; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.credit.CreditCurve; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * MultiCurvePayerReceiver contains the Demonstration of Valuing a Payer/Receiver CDS European Option Sample. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDSPayerReceiver { - - private static final FixFloatComponent OTCFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFutures, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFutures]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFutures, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFutures; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate" - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate", // 30Y - "SwapRate", // 40Y - "SwapRate" // 50Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - "USD" - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - } - - /* - * Sample API demonstrating the creation of the Credit Curve from the CDS instruments - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static CreditCurve MakeCC ( - final JulianDate dtSpot, - final String strCreditCurve, - final MergedDiscountForwardCurve dcFunding) - throws Exception - { - /* - * Populate the instruments, the calibration measures, and the calibration quotes - */ - - double[] adblQuotes = new double[5]; - String[] astrCalibMeasure = new String[5]; - CreditDefaultSwap[] aCDS = new CreditDefaultSwap[5]; - - for (int i = 0; i < 5; ++i) { - - /* - * The Calibration CDS - */ - - aCDS[i] = CDSBuilder.CreateSNAC ( - dtSpot, - (i + 1) + "Y", - 0.01, - strCreditCurve - ); - - /* - * Calibration Quote - */ - - adblQuotes[i] = 100.; - - /* - * Calibration Measure - */ - - astrCalibMeasure[i] = "FairPremium"; - } - - /* - * Create the Credit Curve from the give CDS instruments - */ - - CreditCurve cc = ScenarioCreditCurveBuilder.Custom ( - strCreditCurve, - dtSpot, - aCDS, - dcFunding, - adblQuotes, - astrCalibMeasure, - 0.4, - false - ); - - /* - * Valuation Parameters - */ - - ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); - - /* - * Standard Credit Pricer Parameters (check javadoc for details) - */ - - CreditPricerParams pricerParams = CreditPricerParams.Standard(); - - /* - * Re-calculate the input calibration measures for the input CDSes - */ - - for (int i = 0; i < aCDS.length; ++i) - System.out.println ( - "\t" + astrCalibMeasure[i] + "[" + i + "] = " + - aCDS[i].measureValue ( - valParams, pricerParams, MarketParamsBuilder.Create ( - dcFunding, - null, - null, - cc, - null, - null, - null, - null - ), - null, - astrCalibMeasure[i] - ) - ); - - return cc; - } - - /* - * Sample API demonstrating the display of the CDS coupon and loss cash flow - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "USD"; - String strCreditCurve = "DB"; - String strCDSForwardStartTenor = "3M"; - String strCDSMaturityTenor = "5Y"; - double dblCDSCoupon = 0.1; - String strManifestMeasure = "FairPremium"; - double dblFairPremiumVolatility = 0.4; - - MergedDiscountForwardCurve dcFunding = MakeDC ( - dtSpot, - strCurrency - ); - - CreditCurve cc = MakeCC ( - dtSpot, - strCreditCurve, - dcFunding - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Credit ( - dcFunding, - cc - ); - - CreditDefaultSwap cdsForward = CDSBuilder.CreateSNAC ( - dtSpot.addTenor (strCDSForwardStartTenor), - strCDSMaturityTenor, - dblCDSCoupon, - strCreditCurve - ); - - ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); - - CreditPricerParams pricerParams = CreditPricerParams.Standard(); - - csqc.setCustomVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtSpot.julian(), - VolatilityLabel.Standard (CustomLabel.Standard (cdsForward.name() + "_" + strManifestMeasure)), - strCurrency, - dblFairPremiumVolatility - ) - ); - - Map mapCDSForwardOutput = cdsForward.value ( - valParams, - pricerParams, - csqc, - null - ); - - double dblStrike = 1.01 * mapCDSForwardOutput.get (strManifestMeasure); - - CDSEuropeanOption cdsOptionReceiver = new CDSEuropeanOption ( - cdsForward.name() + "::RECEIVER_OPT", - cdsForward, - strManifestMeasure, - true, - dblStrike, - new LastTradingDateSetting ( - LastTradingDateSetting.MID_CURVE_OPTION_QUARTERLY, - "", - Integer.MIN_VALUE - ), - new BlackScholesAlgorithm(), - null - ); - - Map mapReceiverOptionOutput = cdsOptionReceiver.value ( - valParams, - null, - csqc, - null - ); - - System.out.println ("\n\t------------------------------------------------------------------"); - - for (Map.Entry me : mapReceiverOptionOutput.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - - System.out.println ("\n\t------------------------------------------------------------------"); - - CDSEuropeanOption cdsOptionPayer = new CDSEuropeanOption ( - cdsForward.name() + "::PAYER_OPT", - cdsForward, - strManifestMeasure, - false, - dblStrike, - new LastTradingDateSetting ( - LastTradingDateSetting.MID_CURVE_OPTION_QUARTERLY, - "", - Integer.MIN_VALUE - ), - new BlackScholesAlgorithm(), - null - ); - - Map mapPayerOptionOutput = cdsOptionPayer.value ( - valParams, - null, - csqc, - null - ); - - for (Map.Entry me : mapPayerOptionOutput.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - - System.out.println ("\n\t------------------------------------------------------------------"); - } -} diff --git a/org/drip/sample/creditoption/CDSPayerReceiverAnalysis.java b/org/drip/sample/creditoption/CDSPayerReceiverAnalysis.java deleted file mode 100644 index 138e2de..0000000 --- a/org/drip/sample/creditoption/CDSPayerReceiverAnalysis.java +++ /dev/null @@ -1,564 +0,0 @@ - -package org.drip.sample.creditoption; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.market.otc.*; -import org.drip.param.creator.MarketParamsBuilder; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.pricer.CreditPricerParams; -import org.drip.param.valuation.ValuationParams; -import org.drip.pricer.option.BlackScholesAlgorithm; -import org.drip.product.creator.*; -import org.drip.product.definition.*; -import org.drip.product.option.CDSEuropeanOption; -import org.drip.product.params.LastTradingDateSetting; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.credit.CreditCurve; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CDSPayerReceiverAnalysis carries out a Volatility Analysis of Payer/Receiver CDS European Option. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDSPayerReceiverAnalysis { - - private static final FixFloatComponent OTCFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFutures, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFutures]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFutures, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFutures; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate" - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate", // 30Y - "SwapRate", // 40Y - "SwapRate" // 50Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - "USD" - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - } - - /* - * Sample API demonstrating the creation of the Credit Curve from the CDS instruments - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static CreditCurve MakeCC ( - final JulianDate dtSpot, - final String strCreditCurve, - final MergedDiscountForwardCurve dcFunding) - throws Exception - { - /* - * Populate the instruments, the calibration measures, and the calibration quotes - */ - - double[] adblQuotes = new double[5]; - String[] astrCalibMeasure = new String[5]; - CreditDefaultSwap[] aCDS = new CreditDefaultSwap[5]; - - for (int i = 0; i < 5; ++i) { - - /* - * The Calibration CDS - */ - - aCDS[i] = CDSBuilder.CreateSNAC ( - dtSpot, - (i + 1) + "Y", - 0.01, - strCreditCurve - ); - - /* - * Calibration Quote - */ - - adblQuotes[i] = 100.; - - /* - * Calibration Measure - */ - - astrCalibMeasure[i] = "FairPremium"; - } - - /* - * Create the Credit Curve from the give CDS instruments - */ - - CreditCurve cc = ScenarioCreditCurveBuilder.Custom ( - strCreditCurve, - dtSpot, - aCDS, - dcFunding, - adblQuotes, - astrCalibMeasure, - 0.4, - false - ); - - /* - * Valuation Parameters - */ - - ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); - - /* - * Standard Credit Pricer Parameters (check javadoc for details) - */ - - CreditPricerParams pricerParams = CreditPricerParams.Standard(); - - /* - * Re-calculate the input calibration measures for the input CDSes - */ - - System.out.println ("\n\t|------------------------||"); - - for (int i = 0; i < aCDS.length; ++i) - System.out.println ( - "\t| " + aCDS[i].name() + " =" + - FormatUtil.FormatDouble (aCDS[i].measureValue ( - valParams, pricerParams, MarketParamsBuilder.Create ( - dcFunding, - null, - null, - cc, - null, - null, - null, - null - ), - null, - astrCalibMeasure[i] - ), 1, 1, 1.) + " ||" - ); - - System.out.println ("\t|------------------------||"); - - return cc; - } - - /* - * Sample API demonstrating the display of the CDS coupon and loss cash flow - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "USD"; - String strCreditCurve = "DB"; - String strCDSForwardStartTenor = "3M"; - String strCDSMaturityTenor = "5Y"; - double dblCDSCoupon = 0.1; - String strManifestMeasure = "FairPremium"; - - double[] adblFairPremiumVolatility = new double[] { - 0.10, - 0.15, - 0.20, - 0.25, - 0.30, - 0.35, - 0.40, - 0.45, - 0.50 - }; - - MergedDiscountForwardCurve dcFunding = MakeDC ( - dtSpot, - strCurrency - ); - - CreditCurve cc = MakeCC ( - dtSpot, - strCreditCurve, - dcFunding - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Credit ( - dcFunding, - cc - ); - - CreditDefaultSwap cdsForward = CDSBuilder.CreateSNAC ( - dtSpot.addTenor (strCDSForwardStartTenor), - strCDSMaturityTenor, - dblCDSCoupon, - strCreditCurve - ); - - ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); - - CreditPricerParams pricerParams = CreditPricerParams.Standard(); - - Map mapCDSForwardOutput = cdsForward.value ( - valParams, - pricerParams, - csqc, - null - ); - - double dblStrike = 1.005 * mapCDSForwardOutput.get (strManifestMeasure); - - CDSEuropeanOption cdsOptionReceiver = new CDSEuropeanOption ( - cdsForward.name() + "::RECEIVER_OPT", - cdsForward, - strManifestMeasure, - true, - dblStrike, - new LastTradingDateSetting ( - LastTradingDateSetting.MID_CURVE_OPTION_QUARTERLY, - "", - Integer.MIN_VALUE - ), - new BlackScholesAlgorithm(), - null - ); - - CDSEuropeanOption cdsOptionPayer = new CDSEuropeanOption ( - cdsForward.name() + "::PAYER_OPT", - cdsForward, - strManifestMeasure, - false, - dblStrike, - new LastTradingDateSetting ( - LastTradingDateSetting.MID_CURVE_OPTION_QUARTERLY, - "", - Integer.MIN_VALUE - ), - new BlackScholesAlgorithm(), - null - ); - - System.out.println ("\n\t||-------------------------------------------------------------------||----------------------------------------------------------|||"); - - System.out.println ("\t|| |||"); - - System.out.println ("\t|| CDS Payer Receiver Option Analysis |||"); - - System.out.println ("\t|| --- ----- -------- ------ -------- |||"); - - System.out.println ("\t|| L -> R: |||"); - - System.out.println ("\t|| Forward CDS Fair Premium Log-normal Volatility |||"); - - System.out.println ("\t|| Receiver ATM Fair Premium (bp) |||"); - - System.out.println ("\t|| Receiver Clean DV01 |||"); - - System.out.println ("\t|| Receiver Manifest Measure Intrinsic |||"); - - System.out.println ("\t|| Receiver Manifest Measure Intrinsic Value |||"); - - System.out.println ("\t|| Receiver Moneyness Factor |||"); - - System.out.println ("\t|| Receiver Option Price |||"); - - System.out.println ("\t|| Payer ATM Fair Premium (bp) |||"); - - System.out.println ("\t|| Payer Clean DV01 |||"); - - System.out.println ("\t|| Payer Manifest Measure Intrinsic |||"); - - System.out.println ("\t|| Payer Manifest Measure Intrinsic Value |||"); - - System.out.println ("\t|| Payer Moneyness Factor |||"); - - System.out.println ("\t|| Payer Option Price |||"); - - System.out.println ("\t|| |||"); - - System.out.println ("\t||-------------------------------------------------------------------||----------------------------------------------------------|||"); - - for (double dblFairPremiumVolatility : adblFairPremiumVolatility) { - csqc.setCustomVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtSpot.julian(), - VolatilityLabel.Standard (CustomLabel.Standard (cdsForward.name() + "_" + strManifestMeasure)), - cdsForward.payCurrency(), - dblFairPremiumVolatility - ) - ); - - Map mapReceiverOptionOutput = cdsOptionReceiver.value ( - valParams, - null, - csqc, - null - ); - - Map mapPayerOptionOutput = cdsOptionPayer.value ( - valParams, - null, - csqc, - null - ); - - System.out.println ( - "\t|| " + FormatUtil.FormatDouble (dblFairPremiumVolatility, 2, 1, 100.) + "% => " + - FormatUtil.FormatDouble (mapReceiverOptionOutput.get ("ATMManifestMeasure"), 3, 2, 1.) + " | " + - FormatUtil.FormatDouble (mapReceiverOptionOutput.get ("ManifestMeasurePriceTransformer"), 1, 2, 100.) + " | " + - FormatUtil.FormatDouble (mapReceiverOptionOutput.get ("ManifestMeasureIntrinsic"), 1, 4, 100.) + " | " + - FormatUtil.FormatDouble (mapReceiverOptionOutput.get ("ManifestMeasureIntrinsicValue"), 1, 2, 100.) + " | " + - FormatUtil.FormatDouble (mapReceiverOptionOutput.get ("MoneynessFactor"), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (mapReceiverOptionOutput.get ("Price"), 1, 4, 1.) + " || " + - FormatUtil.FormatDouble (mapPayerOptionOutput.get ("ATMManifestMeasure"), 3, 2, 1.) + " | " + - FormatUtil.FormatDouble (mapPayerOptionOutput.get ("ManifestMeasurePriceTransformer"), 1, 2, 100.) + " | " + - FormatUtil.FormatDouble (mapPayerOptionOutput.get ("ManifestMeasureIntrinsic"), 1, 4, 100.) + " | " + - FormatUtil.FormatDouble (mapPayerOptionOutput.get ("ManifestMeasureIntrinsicValue"), 1, 2, 100.) + " | " + - FormatUtil.FormatDouble (mapPayerOptionOutput.get ("MoneynessFactor"), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (mapPayerOptionOutput.get ("Price"), 1, 4, 1.) + " |||" - ); - } - - System.out.println ("\t||-------------------------------------------------------------------||----------------------------------------------------------|||"); - } -} diff --git a/org/drip/sample/cross/CrossFixedPlainFloat.java b/org/drip/sample/cross/CrossFixedPlainFloat.java deleted file mode 100644 index 0eae670..0000000 --- a/org/drip/sample/cross/CrossFixedPlainFloat.java +++ /dev/null @@ -1,387 +0,0 @@ - -package org.drip.sample.cross; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.params.*; -import org.drip.product.rates.*; -import org.drip.quant.common.*; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * CrossFixedPlainFloat demonstrates the construction, usage, and eventual valuation of a fix-float swap with - * a EUR Fixed leg that pays in USD, and a USD Floating Leg. Comparison is done across MTM and non-MTM fixed - * Leg Counterparts. - * - * @author Lakshmi Krishnamurthy - */ - -public class CrossFixedPlainFloat { - - private static final FixFloatComponent MakeFixFloatSwap ( - final JulianDate dtEffective, - final boolean bFXMTM, - final String strPayCurrency, - final String strFixedCouponCurrency, - final String strMaturityTenor, - final int iTenorInMonths) - throws Exception - { - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strFixedCouponCurrency, - false, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - iTenorInMonths + "M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strPayCurrency, - iTenorInMonths + "M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - 0.02, - 0., - strFixedCouponCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 12 / iTenorInMonths, - iTenorInMonths + "M", - strPayCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - "6M", - strPayCurrency, - null, - 1., - null, - null, - bFXMTM ? null : new FixingSetting ( - FixingSetting.FIXING_PRESET_STATIC, - null, - dtEffective.julian() - ), - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - iTenorInMonths + "M", - strMaturityTenor, - null - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - strMaturityTenor, - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - /* - * The fix-float swap instance - */ - - FixFloatComponent fixFloat = new FixFloatComponent ( - fixedStream, - floatingStream, - new CashSettleParams ( - 0, - strPayCurrency, - 0 - ) - ); - - return fixFloat; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - double dblUSDCollateralRate = 0.03; - double dblEURCollateralRate = 0.02; - double dblUSD3MForwardRate = 0.02; - double dblUSDEURFXRate = 1. / 1.35; - - double dblUSDFundingVol = 0.1; - double dblUSD3MVol = 0.1; - double dblUSD3MUSDFundingCorr = 0.1; - - double dblEURFundingVol = 0.1; - double dblUSDEURFXVol = 0.3; - double dblUSDFundingUSDEURFXCorr = 0.3; - - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = org.drip.analytics.date.DateUtil.Today(); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - "USD" - ); - - ForwardLabel fri3MUSD = ForwardLabel.Create ( - "USD", - "3M" - ); - - MergedDiscountForwardCurve dcUSDCollatDomestic = ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - dtToday, - "USD", - dblUSDCollateralRate - ); - - MergedDiscountForwardCurve dcEURCollatDomestic = ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - dtToday, - "EUR", - dblEURCollateralRate - ); - - ForwardCurve fc3MUSD = ScenarioForwardCurveBuilder.FlatForwardForwardCurve ( - dtToday, - fri3MUSD, - dblUSD3MForwardRate - ); - - CurrencyPair cp = CurrencyPair.FromCode ("USD/EUR"); - - FixFloatComponent fixMTMFloat = MakeFixFloatSwap ( - dtToday, - true, - "USD", - "EUR", - "2Y", - 3 - ); - - FixFloatComponent fixNonMTMFloat = MakeFixFloatSwap ( - dtToday, - false, - "USD", - "EUR", - "2Y", - 3 - ); - - FXLabel fxLabel = FXLabel.Standard (cp); - - FundingLabel fundingLabelUSD = org.drip.state.identifier.FundingLabel.Standard ("USD"); - - FundingLabel fundingLabelEUR = org.drip.state.identifier.FundingLabel.Standard ("EUR"); - - CurveSurfaceQuoteContainer mktParams = new CurveSurfaceQuoteContainer(); - - mktParams.setFundingState (dcUSDCollatDomestic); - - mktParams.setForwardState (fc3MUSD); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - valParams.valueDate(), - VolatilityLabel.Standard (fri3MUSD), - "USD", - dblUSD3MVol - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - valParams.valueDate(), - VolatilityLabel.Standard (fundingLabelUSD), - "USD", - dblUSDFundingVol - ) - ); - - mktParams.setForwardFundingCorrelation ( - fri3MUSD, - fundingLabelUSD, - new FlatUnivariate (dblUSD3MUSDFundingCorr) - ); - - mktParams.setFundingState (dcEURCollatDomestic); - - mktParams.setFXState ( - ScenarioFXCurveBuilder.CubicPolynomialCurve ( - fxLabel.fullyQualifiedName(), - dtToday, - cp, - new String[] {"10Y"}, - new double[] {dblUSDEURFXRate}, - dblUSDEURFXRate - ) - ); - - mktParams.setFixing ( - dtToday, - fxLabel, - dblUSDEURFXRate - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - valParams.valueDate(), - VolatilityLabel.Standard (fundingLabelEUR), - "EUR", - dblEURFundingVol - ) - ); - - mktParams.setFXVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - valParams.valueDate(), - VolatilityLabel.Standard (fxLabel), - "USD", - dblUSDEURFXVol - ) - ); - - mktParams.setFundingFXCorrelation ( - fundingLabelUSD, - fxLabel, - new FlatUnivariate (dblUSDFundingUSDEURFXCorr) - ); - - CaseInsensitiveTreeMap mapMTMOutput = fixMTMFloat.value ( - valParams, - null, - mktParams, - null - ); - - CaseInsensitiveTreeMap mapNonMTMOutput = fixNonMTMFloat.value ( - valParams, - null, - mktParams, - null - ); - - for (Map.Entry me : mapMTMOutput.entrySet()) { - String strKey = me.getKey(); - - if (null != me.getValue() && null != mapNonMTMOutput.get (strKey)) { - double dblMTMMeasure = me.getValue(); - - double dblNonMTMMeasure = mapNonMTMOutput.get (strKey); - - String strReconcile = NumberUtil.WithinTolerance ( - dblMTMMeasure, - dblNonMTMMeasure, - 1.e-08, - 1.e-04 - ) ? - "RECONCILES" : - "DOES NOT RECONCILE"; - - System.out.println ("\t" + - FormatUtil.FormatDouble (dblMTMMeasure, 1, 8, 1.) + " | " + - FormatUtil.FormatDouble (dblNonMTMMeasure, 1, 8, 1.) + " | " + - strReconcile + " <= " + strKey); - } - } - } -} diff --git a/org/drip/sample/cross/CrossFixedPlainFloatAnalysis.java b/org/drip/sample/cross/CrossFixedPlainFloatAnalysis.java deleted file mode 100644 index 9873a67..0000000 --- a/org/drip/sample/cross/CrossFixedPlainFloatAnalysis.java +++ /dev/null @@ -1,453 +0,0 @@ - -package org.drip.sample.cross; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.params.*; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * CrossFixedPlainFloatAnalysis demonstrates the impact of Funding Volatility, Forward Volatility, and - * Funding/Forward Correlation on the Valuation of a fix-float swap with a EUR Fixed leg that pays in USD, - * and a USD Floating Leg. Comparison is done across MTM and non-MTM fixed Leg Counterparts. - * - * @author Lakshmi Krishnamurthy - */ - -public class CrossFixedPlainFloatAnalysis { - - private static final FixFloatComponent MakeFixFloatSwap ( - final JulianDate dtEffective, - final boolean bFXMTM, - final String strPayCurrency, - final String strFixedCouponCurrency, - final String strMaturityTenor, - final int iTenorInMonths) - throws Exception - { - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strFixedCouponCurrency, - false, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - iTenorInMonths + "M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strPayCurrency, - iTenorInMonths + "M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - 0.02, - 0., - strFixedCouponCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 12 / iTenorInMonths, - iTenorInMonths + "M", - strPayCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - "6M", - strPayCurrency, - null, - 1., - null, - null, - bFXMTM ? null : new FixingSetting ( - FixingSetting.FIXING_PRESET_STATIC, - null, - dtEffective.julian() - ), - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - iTenorInMonths + "M", - strMaturityTenor, - null - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - strMaturityTenor, - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - /* - * The fix-float swap instance - */ - - FixFloatComponent fixFloat = new FixFloatComponent ( - fixedStream, - floatingStream, - new CashSettleParams ( - 0, - strPayCurrency, - 0 - ) - ); - - return fixFloat; - } - - private static final void SetMarketParams ( - final int iValueDate, - final CurveSurfaceQuoteContainer mktParams, - final ForwardLabel forwardLabel, - final FundingLabel fundingLabel, - final FXLabel fxLabel, - final double dblForwardVol, - final double dblFundingVol, - final double dblFXVol, - final double dblForwardFundingCorr, - final double dblForwardFXCorr, - final double dblFundingFXCorr) - throws Exception - { - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (forwardLabel), - forwardLabel.currency(), - dblForwardVol - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (fundingLabel), - forwardLabel.currency(), - dblFundingVol - ) - ); - - mktParams.setFXVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (fxLabel), - forwardLabel.currency(), - dblFXVol - ) - ); - - mktParams.setForwardFundingCorrelation ( - forwardLabel, - fundingLabel, - new FlatUnivariate (dblForwardFundingCorr) - ); - - mktParams.setForwardFXCorrelation ( - forwardLabel, - fxLabel, - new FlatUnivariate (dblForwardFXCorr) - ); - - mktParams.setFundingFXCorrelation ( - fundingLabel, - fxLabel, - new FlatUnivariate (dblFundingFXCorr) - ); - } - - private static final void VolCorrScenario ( - final FixFloatComponent[] aFixFloat, - final ValuationParams valParams, - final CurveSurfaceQuoteContainer mktParams, - final ForwardLabel forwardLabel, - final FundingLabel fundingLabel, - final FXLabel fxLabel, - final double dblForwardVol, - final double dblFundingVol, - final double dblFXVol, - final double dblForwardFundingCorr, - final double dblForwardFXCorr, - final double dblFundingFXCorr) - throws Exception - { - SetMarketParams ( - valParams.valueDate(), - mktParams, - forwardLabel, - fundingLabel, - fxLabel, - dblForwardVol, - dblFundingVol, - dblFXVol, - dblForwardFundingCorr, - dblForwardFXCorr, - dblFundingFXCorr - ); - - String strDump = "\t[" + - FormatUtil.FormatDouble (dblForwardVol, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblFundingVol, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblFXVol, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblForwardFundingCorr, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblForwardFXCorr, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblFundingFXCorr, 2, 0, 100.) + "%] = "; - - for (int i = 0; i < aFixFloat.length; ++i) { - CaseInsensitiveTreeMap mapOutput = aFixFloat[i].value (valParams, null, mktParams, null); - - if (0 != i) strDump += " || "; - - strDump += - FormatUtil.FormatDouble (mapOutput.get ("ReferenceCumulativeConvexityAdjustmentPremium"), 2, 0, 10000.) + " | " + - FormatUtil.FormatDouble (mapOutput.get ("DerivedCumulativeConvexityAdjustmentPremium"), 2, 0, 10000.) + " | " + - FormatUtil.FormatDouble (mapOutput.get ("CumulativeConvexityAdjustmentPremium"), 2, 0, 10000.); - } - - System.out.println (strDump); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - double dblUSDCollateralRate = 0.02; - double dblEURCollateralRate = 0.02; - double dblUSD3MForwardRate = 0.02; - double dblUSDEURFXRate = 1. / 1.35; - - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = org.drip.analytics.date.DateUtil.Today(); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - "USD" - ); - - ForwardLabel fri3M = ForwardLabel.Create ( - "USD", - "3M" - ); - - MergedDiscountForwardCurve dcUSDCollatDomestic = ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - dtToday, - "USD", - dblUSDCollateralRate - ); - - MergedDiscountForwardCurve dcEURCollatDomestic = ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - dtToday, - "EUR", - dblEURCollateralRate - ); - - ForwardCurve fc3MUSD = ScenarioForwardCurveBuilder.FlatForwardForwardCurve ( - dtToday, - fri3M, - dblUSD3MForwardRate - ); - - CurrencyPair cp = CurrencyPair.FromCode ("USD/EUR"); - - FixFloatComponent fixMTMFloat = MakeFixFloatSwap ( - dtToday, - true, - "USD", - "EUR", - "2Y", - 3 - ); - - FixFloatComponent fixNonMTMFloat = MakeFixFloatSwap ( - dtToday, - false, - "USD", - "EUR", - "2Y", - 3 - ); - - FXLabel fxLabel = FXLabel.Standard (cp); - - CurveSurfaceQuoteContainer mktParams = new CurveSurfaceQuoteContainer(); - - mktParams.setFundingState (dcUSDCollatDomestic); - - mktParams.setForwardState (fc3MUSD); - - mktParams.setFundingState (dcEURCollatDomestic); - - mktParams.setFXState ( - ScenarioFXCurveBuilder.CubicPolynomialCurve ( - fxLabel.fullyQualifiedName(), - dtToday, - cp, - new String[] {"10Y"}, - new double[] {dblUSDEURFXRate}, - dblUSDEURFXRate - ) - ); - - mktParams.setFixing ( - dtToday, - fxLabel, - dblUSDEURFXRate - ); - - double[] adblForwardVol = new double[] { - 0.1, 0.35, 0.60 - }; - - double[] adblFundingVol = new double[] { - 0.1, 0.35, 0.60 - }; - - double[] adblFXVol = new double[] { - 0.1, 0.35, 0.60 - }; - - double[] adblForwardFundingCorr = new double[] { - -0.1, 0.35 - }; - - double[] adblForwardFXCorr = new double[] { - -0.1, 0.35 - }; - - double[] adblFundingFXCorr = new double[] { - -0.1, 0.35 - }; - - for (double dblForwardVol : adblForwardVol) { - for (double dblFundingVol : adblFundingVol) { - for (double dblFXVol : adblFXVol) { - for (double dblForwardFundingCorr : adblForwardFundingCorr) { - for (double dblForwardFXCorr : adblForwardFXCorr) { - for (double dblFundingFXCorr : adblFundingFXCorr) - VolCorrScenario ( - new FixFloatComponent[] { - fixMTMFloat, - fixNonMTMFloat - }, - valParams, - mktParams, - fri3M, - FundingLabel.Standard ("USD"), - fxLabel, - dblForwardVol, - dblFundingVol, - dblFXVol, - dblForwardFundingCorr, - dblForwardFXCorr, - dblFundingFXCorr - ); - } - } - } - } - } - } -} diff --git a/org/drip/sample/cross/CrossFloatCrossFloat.java b/org/drip/sample/cross/CrossFloatCrossFloat.java deleted file mode 100644 index d9e0f8f..0000000 --- a/org/drip/sample/cross/CrossFloatCrossFloat.java +++ /dev/null @@ -1,407 +0,0 @@ - -package org.drip.sample.cross; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.params.*; -import org.drip.product.rates.*; -import org.drip.quant.common.*; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * CrossFloatCrossFloat demonstrates the construction, usage, and eventual valuation of the Mark-to-market - * float-float swap with a 3M EUR Floater leg that pays in USD, and a 6M EUR Floater leg that pays in USD. - * Comparison is done across MTM and non-MTM fixed Leg Counterparts. - * - * @author Lakshmi Krishnamurthy - */ - -public class CrossFloatCrossFloat { - - private static final FloatFloatComponent MakeFloatFloatSwap ( - final JulianDate dtEffective, - final boolean bFXMTM, - final String strPayCurrency, - final String strCouponCurrency, - final String strMaturityTenor, - final int iTenorInMonthsReference, - final int iTenorInMonthsDerived) - throws Exception - { - ComposableFloatingUnitSetting cfusReference = new ComposableFloatingUnitSetting ( - iTenorInMonthsReference + "M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCouponCurrency, - iTenorInMonthsReference + "M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFloatingUnitSetting cfusDerived = new ComposableFloatingUnitSetting ( - iTenorInMonthsDerived + "M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCouponCurrency, - iTenorInMonthsDerived + "M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cpsReference = new CompositePeriodSetting ( - 12 / iTenorInMonthsReference, - iTenorInMonthsReference + "M", - strPayCurrency, - null, - -1., - null, - null, - bFXMTM ? null : new FixingSetting ( - FixingSetting.FIXING_PRESET_STATIC, - null, - dtEffective.julian() - ), - null - ); - - CompositePeriodSetting cpsDerived = new CompositePeriodSetting ( - 12 / iTenorInMonthsDerived, - iTenorInMonthsDerived + "M", - strPayCurrency, - null, - 1., - null, - null, - bFXMTM ? null : new FixingSetting ( - FixingSetting.FIXING_PRESET_STATIC, - null, - dtEffective.julian() - ), - null - ); - - List lsReferenceStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - iTenorInMonthsReference + "M", - strMaturityTenor, - null - ); - - List lsDerivedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - iTenorInMonthsDerived + "M", - strMaturityTenor, - null - ); - - Stream referenceStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsReferenceStreamEdgeDate, - cpsReference, - cfusReference - ) - ); - - Stream derivedStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsDerivedStreamEdgeDate, - cpsDerived, - cfusDerived - ) - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strPayCurrency, - 0 - ); - - return new FloatFloatComponent ( - referenceStream, - derivedStream, - csp - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - double dblUSDFundingRate = 0.02; - double dblEUR3MForwardRate = 0.02; - double dblEUR6MForwardRate = 0.025; - double dblUSDEURFXRate = 1. / 1.35; - - double dblUSDFundingVol = 0.3; - double dblEURForward3MVol = 0.3; - double dblEURForward6MVol = 0.3; - double dblUSDEURFXVol = 0.3; - - double dblEUR3MUSDEURFXCorr = 0.1; - double dblEUR6MUSDEURFXCorr = 0.1; - double dblUSDFundingEUR3MCorr = 0.1; - double dblUSDFundingEUR6MCorr = 0.1; - double dblUSDFundingUSDEURFXCorr = 0.1; - - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = org.drip.analytics.date.DateUtil.Today(); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - "EUR" - ); - - MergedDiscountForwardCurve dcUSDFunding = ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - dtToday, - "USD", - dblUSDFundingRate - ); - - ForwardLabel friEUR3M = ForwardLabel.Create ( - "EUR", - "3M" - ); - - ForwardCurve fcEUR3M = ScenarioForwardCurveBuilder.FlatForwardForwardCurve ( - dtToday, - friEUR3M, - dblEUR3MForwardRate - ); - - ForwardLabel friEUR6M = ForwardLabel.Create ( - "EUR", - "6M" - ); - - ForwardCurve fcEUR6M = ScenarioForwardCurveBuilder.FlatForwardForwardCurve ( - dtToday, - friEUR6M, - dblEUR6MForwardRate - ); - - CurrencyPair cp = CurrencyPair.FromCode ("USD/EUR"); - - FloatFloatComponent floatFloatMTM = MakeFloatFloatSwap ( - dtToday, - true, - "USD", - "EUR", - "2Y", - 6, - 3 - ); - - floatFloatMTM.setPrimaryCode ("EUR__USD__MTM::FLOAT::3M::6M::2Y"); - - FloatFloatComponent floatFloatNonMTM = MakeFloatFloatSwap ( - dtToday, - false, - "USD", - "EUR", - "2Y", - 6, - 3 - ); - - floatFloatNonMTM.setPrimaryCode ("EUR__USD__NONMTM::FLOAT::3M::6M::2Y"); - - FXLabel fxLabel = FXLabel.Standard (cp); - - FundingLabel fundingLabelUSD = org.drip.state.identifier.FundingLabel.Standard ("USD"); - - CurveSurfaceQuoteContainer mktParams = new CurveSurfaceQuoteContainer(); - - mktParams.setFixing ( - dtToday, - fxLabel, - dblUSDEURFXRate - ); - - mktParams.setForwardState (fcEUR3M); - - mktParams.setForwardState (fcEUR6M); - - mktParams.setFundingState (dcUSDFunding); - - mktParams.setFXState ( - ScenarioFXCurveBuilder.CubicPolynomialCurve ( - fxLabel.fullyQualifiedName(), - dtToday, - cp, - new String[] {"10Y"}, - new double[] {dblUSDEURFXRate}, - dblUSDEURFXRate - ) - ); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - valParams.valueDate(), - VolatilityLabel.Standard (friEUR3M), - "EUR", - dblEURForward3MVol - ) - ); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - valParams.valueDate(), - VolatilityLabel.Standard (friEUR6M), - "EUR", - dblEURForward6MVol - ) - ); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - valParams.valueDate(), - VolatilityLabel.Standard (fundingLabelUSD), - "USD", - dblUSDFundingVol - ) - ); - - mktParams.setFXVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - valParams.valueDate(), - VolatilityLabel.Standard (fxLabel), - "USD", - dblUSDEURFXVol - ) - ); - - mktParams.setForwardFundingCorrelation ( - friEUR3M, - fundingLabelUSD, - new FlatUnivariate (dblUSDFundingEUR3MCorr) - ); - - mktParams.setForwardFundingCorrelation ( - friEUR6M, - fundingLabelUSD, - new FlatUnivariate (dblUSDFundingEUR6MCorr) - ); - - mktParams.setForwardFXCorrelation ( - friEUR3M, - fxLabel, - new FlatUnivariate (dblEUR3MUSDEURFXCorr) - ); - - mktParams.setForwardFXCorrelation ( - friEUR6M, - fxLabel, - new FlatUnivariate (dblEUR6MUSDEURFXCorr) - ); - - mktParams.setFundingFXCorrelation ( - fundingLabelUSD, - fxLabel, - new FlatUnivariate (dblUSDFundingUSDEURFXCorr) - ); - - CaseInsensitiveTreeMap mapMTMOutput = floatFloatMTM.value ( - valParams, - null, - mktParams, - null - ); - - CaseInsensitiveTreeMap mapNonMTMOutput = floatFloatNonMTM.value ( - valParams, - null, - mktParams, - null - ); - - for (Map.Entry me : mapMTMOutput.entrySet()) { - String strKey = me.getKey(); - - if (null != me.getValue() && null != mapNonMTMOutput.get (strKey)) { - double dblMTMMeasure = me.getValue(); - - double dblNonMTMMeasure = mapNonMTMOutput.get (strKey); - - String strReconcile = NumberUtil.WithinTolerance ( - dblMTMMeasure, - dblNonMTMMeasure, - 1.e-08, - 1.e-04 - ) ? "RECONCILES" : "DOES NOT RECONCILE"; - - System.out.println ("\t" + - FormatUtil.FormatDouble (dblMTMMeasure, 1, 8, 1.) + " | " + - FormatUtil.FormatDouble (dblNonMTMMeasure, 1, 8, 1.) + " | " + - strReconcile + " <= " + strKey); - } - } - } -} diff --git a/org/drip/sample/cross/CrossFloatCrossFloatAnalysis.java b/org/drip/sample/cross/CrossFloatCrossFloatAnalysis.java deleted file mode 100644 index c469a2f..0000000 --- a/org/drip/sample/cross/CrossFloatCrossFloatAnalysis.java +++ /dev/null @@ -1,520 +0,0 @@ - -package org.drip.sample.cross; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.params.*; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FloatFloatMTMVolAnalysis demonstrates the impact of Funding Volatility, Forward Volatility, and - * Funding/Forward, Funding/FX, and Forward/FX Correlation for each of the FRI's on the Valuation of a - * float-float swap with a 3M EUR Floater leg that pays in USD, and a 6M EUR Floater leg that pays in USD. - * Comparison is done across MTM and non-MTM fixed Leg Counterparts. - * - * @author Lakshmi Krishnamurthy - */ - -public class CrossFloatCrossFloatAnalysis { - - private static final FloatFloatComponent MakeFloatFloatSwap ( - final JulianDate dtEffective, - final boolean bFXMTM, - final String strPayCurrency, - final String strCouponCurrency, - final String strMaturityTenor, - final int iTenorInMonthsReference, - final int iTenorInMonthsDerived) - throws Exception - { - ComposableFloatingUnitSetting cfusReference = new ComposableFloatingUnitSetting ( - iTenorInMonthsReference + "M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCouponCurrency, - iTenorInMonthsReference + "M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFloatingUnitSetting cfusDerived = new ComposableFloatingUnitSetting ( - iTenorInMonthsDerived + "M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCouponCurrency, - iTenorInMonthsDerived + "M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cpsReference = new CompositePeriodSetting ( - 12 / iTenorInMonthsReference, - iTenorInMonthsReference + "M", - strPayCurrency, - null, - -1., - null, - null, - bFXMTM ? null : new FixingSetting ( - FixingSetting.FIXING_PRESET_STATIC, - null, - dtEffective.julian() - ), - null - ); - - CompositePeriodSetting cpsDerived = new CompositePeriodSetting ( - 12 / iTenorInMonthsDerived, - iTenorInMonthsDerived + "M", - strPayCurrency, - null, - 1., - null, - null, - bFXMTM ? null : new FixingSetting ( - FixingSetting.FIXING_PRESET_STATIC, - null, - dtEffective.julian() - ), - null - ); - - List lsReferenceStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - iTenorInMonthsReference + "M", - strMaturityTenor, - null - ); - - List lsDerivedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - iTenorInMonthsDerived + "M", - strMaturityTenor, - null - ); - - Stream referenceStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsReferenceStreamEdgeDate, - cpsReference, - cfusReference - ) - ); - - Stream derivedStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsDerivedStreamEdgeDate, - cpsDerived, - cfusDerived - ) - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strPayCurrency, - 0 - ); - - return new FloatFloatComponent ( - referenceStream, - derivedStream, - csp - ); - } - - private static final void SetMarketParams ( - final int iValueDate, - final CurveSurfaceQuoteContainer mktParams, - final ForwardLabel forwardLabel1, - final ForwardLabel forwardLabel2, - final FundingLabel fundingLabel, - final FXLabel fxLabel, - final double dblForward1Vol, - final double dblForward2Vol, - final double dblFundingVol, - final double dblFXVol, - final double dblForward1FundingCorr, - final double dblForward2FundingCorr, - final double dblForward1FXCorr, - final double dblForward2FXCorr, - final double dblFundingFXCorr) - throws Exception - { - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (forwardLabel1), - forwardLabel1.currency(), - dblForward1Vol - ) - ); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (forwardLabel2), - forwardLabel2.currency(), - dblForward2Vol - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (fundingLabel), - forwardLabel1.currency(), - dblFundingVol - ) - ); - - mktParams.setFXVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (fxLabel), - forwardLabel1.currency(), - dblFXVol - ) - ); - - mktParams.setForwardFundingCorrelation ( - forwardLabel1, - fundingLabel, - new FlatUnivariate (dblForward1FundingCorr) - ); - - mktParams.setForwardFundingCorrelation ( - forwardLabel2, - fundingLabel, - new FlatUnivariate (dblForward2FundingCorr) - ); - - mktParams.setForwardFXCorrelation ( - forwardLabel1, - fxLabel, - new FlatUnivariate (dblForward1FXCorr) - ); - - mktParams.setForwardFXCorrelation ( - forwardLabel2, - fxLabel, - new FlatUnivariate (dblForward2FXCorr) - ); - - mktParams.setFundingFXCorrelation ( - fundingLabel, - fxLabel, - new FlatUnivariate (dblFundingFXCorr) - ); - } - - private static final void VolCorrScenario ( - final FloatFloatComponent[] aFloatFloat, - final ValuationParams valParams, - final CurveSurfaceQuoteContainer mktParams, - final ForwardLabel forwardLabel1, - final ForwardLabel forwardLabel2, - final FundingLabel fundingLabel, - final FXLabel fxLabel, - final double dblForward1Vol, - final double dblForward2Vol, - final double dblFundingVol, - final double dblFXVol, - final double dblForward1FundingCorr, - final double dblForward2FundingCorr, - final double dblForward1FXCorr, - final double dblForward2FXCorr, - final double dblFundingFXCorr) - throws Exception - { - SetMarketParams ( - valParams.valueDate(), - mktParams, - forwardLabel1, - forwardLabel2, - fundingLabel, - fxLabel, - dblForward1Vol, - dblForward2Vol, - dblFundingVol, - dblFXVol, - dblForward1FundingCorr, - dblForward2FundingCorr, - dblForward1FXCorr, - dblForward2FXCorr, - dblFundingFXCorr - ); - - String strDump = "\t[" + - FormatUtil.FormatDouble (dblForward1Vol, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblForward2Vol, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblFundingVol, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblFXVol, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblForward1FundingCorr, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblForward2FundingCorr, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblForward1FXCorr, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblForward2FXCorr, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblFundingFXCorr, 2, 0, 100.) + "%] = "; - - for (int i = 0; i < aFloatFloat.length; ++i) { - CaseInsensitiveTreeMap mapOutput = aFloatFloat[i].value ( - valParams, - null, - mktParams, - null - ); - - if (0 != i) strDump += " || "; - - strDump += - FormatUtil.FormatDouble (mapOutput.get ("ReferenceCumulativeConvexityAdjustmentPremium"), 2, 0, 10000.) + " | " + - FormatUtil.FormatDouble (mapOutput.get ("DerivedCumulativeConvexityAdjustmentPremium"), 2, 0, 10000.) + " | " + - FormatUtil.FormatDouble (mapOutput.get ("CumulativeConvexityAdjustmentPremium"), 2, 0, 10000.); - } - - System.out.println (strDump); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - double dblEUR3MForwardRate = 0.02; - double dblEUR6MForwardRate = 0.025; - double dblUSDFundingRate = 0.02; - double dblUSDEURFXRate = 1. / 1.35; - - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = org.drip.analytics.date.DateUtil.Today(); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - "EUR" - ); - - MergedDiscountForwardCurve dcUSDFunding = ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - dtToday, - "USD", - dblUSDFundingRate - ); - - ForwardLabel friEUR3M = ForwardLabel.Create ( - "EUR", - "3M" - ); - - ForwardCurve fcEUR3M = ScenarioForwardCurveBuilder.FlatForwardForwardCurve ( - dtToday, - friEUR3M, - dblEUR3MForwardRate - ); - - ForwardLabel friEUR6M = ForwardLabel.Create ( - "EUR", - "6M" - ); - - ForwardCurve fcEUR6M = ScenarioForwardCurveBuilder.FlatForwardForwardCurve ( - dtToday, - friEUR6M, - dblEUR6MForwardRate - ); - - CurrencyPair cp = CurrencyPair.FromCode ("USD/EUR"); - - FloatFloatComponent floatFloatMTM = MakeFloatFloatSwap ( - dtToday, - true, - "USD", - "EUR", - "2Y", - 6, - 3 - ); - - floatFloatMTM.setPrimaryCode ("EUR__USD__MTM::FLOAT::3M::6M::2Y"); - - FloatFloatComponent floatFloatNonMTM = MakeFloatFloatSwap ( - dtToday, - false, - "USD", - "EUR", - "2Y", - 6, - 3 - ); - - floatFloatNonMTM.setPrimaryCode ("EUR__USD__NONMTM::FLOAT::3M::6M::2Y"); - - FXLabel fxLabel = FXLabel.Standard (cp); - - CurveSurfaceQuoteContainer mktParams = new CurveSurfaceQuoteContainer(); - - mktParams.setFixing ( - dtToday, - fxLabel, - dblUSDEURFXRate - ); - - mktParams.setForwardState (fcEUR3M); - - mktParams.setForwardState (fcEUR6M); - - mktParams.setFundingState (dcUSDFunding); - - mktParams.setFXState ( - ScenarioFXCurveBuilder.CubicPolynomialCurve ( - fxLabel.fullyQualifiedName(), - dtToday, - cp, - new String[] {"10Y"}, - new double[] {dblUSDEURFXRate}, - dblUSDEURFXRate - ) - ); - - double[] adblEURForward3MVol = new double[] { - 0.1, 0.3, 0.5 - }; - - double[] adblEURForward6MVol = new double[] { - 0.1, 0.3, 0.5 - }; - - double[] adblUSDFundingVol = new double[] { - 0.1, 0.3, 0.5 - }; - - double[] adblUSDEURFXVol = new double[] { - 0.1, 0.3, 0.5 - }; - - double[] adblEUR3MUSDFundingCorr = new double[] { - -0.2, 0.25 - }; - - double[] adblEUR6MUSDFundingCorr = new double[] { - -0.2, 0.25 - }; - - double[] adblEUR3MUSDEURFXCorr = new double[] { - -0.2, 0.25 - }; - - double[] adblEUR6MUSDEURFXCorr = new double[] { - -0.2, 0.25 - }; - - double[] adblUSDFundingUSDEURFXCorr = new double[] { - -0.2, 0.25 - }; - - for (double dblEURForward3MVol : adblEURForward3MVol) { - for (double dblEURForward6MVol : adblEURForward6MVol) { - for (double dblUSDFundingVol : adblUSDFundingVol) { - for (double dblUSDEURFXVol : adblUSDEURFXVol) { - for (double dblEUR3MUSDFundingCorr : adblEUR3MUSDFundingCorr) { - for (double dblEUR6MUSDFundingCorr : adblEUR6MUSDFundingCorr) { - for (double dblEUR3MUSDEURFXCorr : adblEUR3MUSDEURFXCorr) { - for (double dblEUR6MUSDEURFXCorr : adblEUR6MUSDEURFXCorr) { - for (double dblUSDFundingUSDEURFXCorr : adblUSDFundingUSDEURFXCorr) - VolCorrScenario ( - new FloatFloatComponent[] { - floatFloatMTM, - floatFloatNonMTM - }, - valParams, - mktParams, - friEUR3M, - friEUR6M, - FundingLabel.Standard ("USD"), - fxLabel, - dblEURForward3MVol, - dblEURForward6MVol, - dblUSDFundingVol, - dblUSDEURFXVol, - dblEUR3MUSDFundingCorr, - dblEUR6MUSDFundingCorr, - dblEUR3MUSDEURFXCorr, - dblEUR6MUSDEURFXCorr, - dblUSDFundingUSDEURFXCorr - ); - } - } - } - } - } - } - } - } - } -} diff --git a/org/drip/sample/cross/FixFloatFixFloat.java b/org/drip/sample/cross/FixFloatFixFloat.java deleted file mode 100644 index 3f190bd..0000000 --- a/org/drip/sample/cross/FixFloatFixFloat.java +++ /dev/null @@ -1,419 +0,0 @@ - -package org.drip.sample.cross; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.fx.ComponentPair; -import org.drip.product.params.*; -import org.drip.product.rates.*; -import org.drip.quant.common.*; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FixFloatFixFloat demonstrates the construction, the usage, and the eventual valuation of the Cross - * Currency Basis Swap built out of a pair of fix-float swaps. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixFloatFixFloat { - - private static final FixFloatComponent MakeFixFloatSwap ( - final JulianDate dtEffective, - final boolean bFXMTM, - final String strPayCurrency, - final String strCouponCurrency, - final String strMaturityTenor, - final int iTenorInMonths) - throws Exception - { - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCouponCurrency, - false, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - iTenorInMonths + "M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCouponCurrency, - iTenorInMonths + "M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - 0.02, - 0., - strCouponCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 12 / iTenorInMonths, - iTenorInMonths + "M", - strPayCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - "6M", - strPayCurrency, - null, - 1., - null, - null, - bFXMTM ? null : new FixingSetting ( - FixingSetting.FIXING_PRESET_STATIC, - null, - dtEffective.julian() - ), - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - iTenorInMonths + "M", - strMaturityTenor, - null - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - strMaturityTenor, - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent fixFloat = new FixFloatComponent ( - fixedStream, - floatingStream, - new CashSettleParams ( - 0, - strPayCurrency, - 0 - ) - ); - - return fixFloat; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - double dblUSD3MForwardRate = 0.0275; - double dblEUR3MForwardRate = 0.0175; - double dblUSDFundingRate = 0.03; - double dblUSDEURFXRate = 1. / 1.34; - - double dblUSD3MForwardVol = 0.3; - double dblEUR3MForwardVol = 0.3; - double dblUSDFundingVol = 0.3; - double dblUSDEURFXVol = 0.3; - - double dblUSD3MForwardUSDFundingCorr = 0.15; - double dblEUR3MForwardUSDFundingCorr = 0.15; - double dblEUR3MForwardUSDEURFXCorr = 0.15; - double dblUSDFundingUSDEURFXCorr = 0.15; - - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = org.drip.analytics.date.DateUtil.Today(); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - "USD" - ); - - ForwardLabel fri3MUSD = ForwardLabel.Create ( - "USD", - "3M" - ); - - ForwardLabel fri3MEUR = ForwardLabel.Create ( - "EUR", - "3M" - ); - - CurrencyPair cp = CurrencyPair.FromCode ("USD/EUR"); - - FundingLabel fundingLabelUSD = FundingLabel.Standard ("USD"); - - FXLabel fxLabel = FXLabel.Standard (cp); - - FixFloatComponent fixFloatUSD = MakeFixFloatSwap ( - dtToday, - false, - "USD", - "USD", - "2Y", - 3 - ); - - FixFloatComponent fixFloatEURMTM = MakeFixFloatSwap ( - dtToday, - true, - "USD", - "EUR", - "2Y", - 3 - ); - - ComponentPair cpMTM = new ComponentPair ( - "FFFF_MTM", - fixFloatUSD, - fixFloatEURMTM, - null - ); - - FixFloatComponent fixFloatEURNonMTM = MakeFixFloatSwap ( - dtToday, - false, - "USD", - "EUR", - "2Y", - 3 - ); - - ComponentPair cpNonMTM = new ComponentPair ( - "FFFF_Non_MTM", - fixFloatUSD, - fixFloatEURNonMTM, - null - ); - - CurveSurfaceQuoteContainer mktParams = new CurveSurfaceQuoteContainer(); - - mktParams.setFixing ( - dtToday, - fxLabel, - dblUSDEURFXRate - ); - - mktParams.setForwardState ( - ScenarioForwardCurveBuilder.FlatForwardForwardCurve ( - dtToday, - fri3MUSD, - dblUSD3MForwardRate - ) - ); - - mktParams.setForwardState ( - ScenarioForwardCurveBuilder.FlatForwardForwardCurve ( - dtToday, - fri3MEUR, - dblEUR3MForwardRate - ) - ); - - mktParams.setFundingState ( - ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - dtToday, - "USD", - dblUSDFundingRate - ) - ); - - mktParams.setFXState ( - ScenarioFXCurveBuilder.CubicPolynomialCurve ( - fxLabel.fullyQualifiedName(), - dtToday, - cp, - new String[] {"10Y"}, - new double[] {dblUSDEURFXRate}, - dblUSDEURFXRate - ) - ); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtToday.julian(), - VolatilityLabel.Standard (fri3MUSD), - "USD", - dblUSD3MForwardVol - ) - ); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtToday.julian(), - VolatilityLabel.Standard (fri3MEUR), - "EUR", - dblEUR3MForwardVol - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtToday.julian(), - VolatilityLabel.Standard (fundingLabelUSD), - "USD", - dblUSDFundingVol - ) - ); - - mktParams.setFXVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtToday.julian(), - VolatilityLabel.Standard (fxLabel), - "USD", - dblUSDEURFXVol - ) - ); - - mktParams.setForwardFundingCorrelation ( - fri3MUSD, - fundingLabelUSD, - new FlatUnivariate (dblUSD3MForwardUSDFundingCorr) - ); - - mktParams.setForwardFundingCorrelation ( - fri3MEUR, - fundingLabelUSD, - new FlatUnivariate (dblEUR3MForwardUSDFundingCorr) - ); - - mktParams.setForwardFXCorrelation ( - fri3MEUR, - fxLabel, - new FlatUnivariate (dblEUR3MForwardUSDEURFXCorr) - ); - - mktParams.setFundingFXCorrelation ( - fundingLabelUSD, - fxLabel, - new FlatUnivariate (dblUSDFundingUSDEURFXCorr) - ); - - CaseInsensitiveTreeMap mapMTMOutput = cpMTM.value ( - valParams, - null, - mktParams, - null - ); - - CaseInsensitiveTreeMap mapNonMTMOutput = cpNonMTM.value ( - valParams, - null, - mktParams, - null - ); - - for (Map.Entry me : mapMTMOutput.entrySet()) { - String strKey = me.getKey(); - - if (null != me.getValue() && null != mapNonMTMOutput.get (strKey)) { - double dblMTMMeasure = me.getValue(); - - double dblNonMTMMeasure = mapNonMTMOutput.get (strKey); - - String strReconcile = NumberUtil.WithinTolerance ( - dblMTMMeasure, - dblNonMTMMeasure, - 1.e-08, - 1.e-04 - ) ? "RECONCILES" : "DOES NOT RECONCILE"; - - System.out.println ("\t" + - FormatUtil.FormatDouble (dblMTMMeasure, 1, 8, 1.) + " | " + - FormatUtil.FormatDouble (dblNonMTMMeasure, 1, 8, 1.) + " | " + - strReconcile + " <= " + strKey); - } - } - } -} diff --git a/org/drip/sample/cross/FixFloatFixFloatAnalysis.java b/org/drip/sample/cross/FixFloatFixFloatAnalysis.java deleted file mode 100644 index dbe5813..0000000 --- a/org/drip/sample/cross/FixFloatFixFloatAnalysis.java +++ /dev/null @@ -1,517 +0,0 @@ - -package org.drip.sample.cross; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.fx.ComponentPair; -import org.drip.product.params.*; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FixFloatFixFloat demonstrates the Funding Volatility, Forward Volatility, FX Volatility, Funding/Forward - * Correlation, Funding/FX Correlation, and Forward/FX Correlation across the 2 currencies (USD and EUR) on - * the Valuation of the Cross Currency Basis Swap built out of a pair of fix-float swaps. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixFloatFixFloatAnalysis { - - private static final FixFloatComponent MakeFixFloatSwap ( - final JulianDate dtEffective, - final boolean bFXMTM, - final String strPayCurrency, - final String strCouponCurrency, - final String strMaturityTenor, - final int iTenorInMonths) - throws Exception - { - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCouponCurrency, - false, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - iTenorInMonths + "M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCouponCurrency, - iTenorInMonths + "M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - 0.02, - 0., - strCouponCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 12 / iTenorInMonths, - iTenorInMonths + "M", - strPayCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - "6M", - strPayCurrency, - null, - 1., - null, - null, - bFXMTM ? null : new FixingSetting ( - FixingSetting.FIXING_PRESET_STATIC, - null, - dtEffective.julian() - ), - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - iTenorInMonths + "M", - strMaturityTenor, - null - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - strMaturityTenor, - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent fixFloat = new FixFloatComponent ( - fixedStream, - floatingStream, - new CashSettleParams ( - 0, - strPayCurrency, - 0 - ) - ); - - return fixFloat; - } - - private static final void SetMarketParams ( - final int iValueDate, - final CurveSurfaceQuoteContainer mktParams, - final ForwardLabel forwardLabel1, - final ForwardLabel forwardLabel2, - final FundingLabel fundingLabel, - final FXLabel fxLabel, - final double dblForward1Vol, - final double dblForward2Vol, - final double dblFundingVol, - final double dblFXVol, - final double dblForward1FundingCorr, - final double dblForward2FundingCorr, - final double dblForward2FXCorr, - final double dblFundingFXCorr) - throws Exception - { - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (forwardLabel1), - forwardLabel1.currency(), - dblForward1Vol - ) - ); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (forwardLabel2), - forwardLabel2.currency(), - dblForward2Vol - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (fundingLabel), - forwardLabel1.currency(), - dblFundingVol - ) - ); - - mktParams.setFXVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (fxLabel), - forwardLabel1.currency(), - dblFXVol - ) - ); - - mktParams.setForwardFundingCorrelation ( - forwardLabel1, - fundingLabel, - new FlatUnivariate (dblForward1FundingCorr) - ); - - mktParams.setForwardFundingCorrelation ( - forwardLabel2, - fundingLabel, - new FlatUnivariate (dblForward2FundingCorr) - ); - - mktParams.setForwardFXCorrelation ( - forwardLabel2, - fxLabel, - new FlatUnivariate (dblForward2FXCorr) - ); - - mktParams.setFundingFXCorrelation ( - fundingLabel, - fxLabel, - new FlatUnivariate (dblFundingFXCorr) - ); - } - - private static final void VolCorrScenario ( - final ComponentPair[] aCP, - final ValuationParams valParams, - final CurveSurfaceQuoteContainer mktParams, - final ForwardLabel forwardLabel1, - final ForwardLabel forwardLabel2, - final FundingLabel fundingLabel, - final FXLabel fxLabel, - final double dblForward1Vol, - final double dblForward2Vol, - final double dblFundingVol, - final double dblFXVol, - final double dblForward1FundingCorr, - final double dblForward2FundingCorr, - final double dblForward2FXCorr, - final double dblFundingFXCorr) - throws Exception - { - SetMarketParams ( - valParams.valueDate(), - mktParams, - forwardLabel1, - forwardLabel2, - fundingLabel, - fxLabel, - dblForward1Vol, - dblForward2Vol, - dblFundingVol, - dblFXVol, - dblForward1FundingCorr, - dblForward2FundingCorr, - dblForward2FXCorr, - dblFundingFXCorr - ); - - String strDump = "\t[" + - FormatUtil.FormatDouble (dblForward1Vol, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblForward2Vol, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblFundingVol, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblFXVol, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblForward1FundingCorr, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblForward2FundingCorr, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblForward2FXCorr, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblFundingFXCorr, 2, 0, 100.) + "%] = "; - - for (int i = 0; i < aCP.length; ++i) { - CaseInsensitiveTreeMap mapOutput = aCP[i].value ( - valParams, - null, - mktParams, - null - ); - - if (0 != i) strDump += " || "; - - strDump += - FormatUtil.FormatDouble (mapOutput.get ("ReferenceCumulativeConvexityAdjustmentPremium"), 2, 0, 10000.) + " | " + - FormatUtil.FormatDouble (mapOutput.get ("DerivedCumulativeConvexityAdjustmentPremium"), 2, 0, 10000.) + " | " + - FormatUtil.FormatDouble (mapOutput.get ("CumulativeConvexityAdjustmentPremium"), 2, 0, 10000.); - } - - System.out.println (strDump); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - double dblUSD3MForwardRate = 0.0275; - double dblEUR3MForwardRate = 0.0175; - double dblUSDFundingRate = 0.03; - double dblUSDEURFXRate = 1. / 1.34; - - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = org.drip.analytics.date.DateUtil.Today(); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - "USD" - ); - - ForwardLabel fri3MUSD = ForwardLabel.Create ( - "USD", - "3M" - ); - - ForwardLabel fri3MEUR = ForwardLabel.Create ( - "EUR", - "3M" - ); - - FundingLabel fundingLabel = FundingLabel.Standard ("USD"); - - CurrencyPair cp = CurrencyPair.FromCode ("USD/EUR"); - - FXLabel fxLabel = FXLabel.Standard (cp); - - FixFloatComponent fixFloatUSD = MakeFixFloatSwap ( - dtToday, - false, - "USD", - "USD", - "2Y", - 3 - ); - - FixFloatComponent fixFloatEURMTM = MakeFixFloatSwap ( - dtToday, - true, - "USD", - "EUR", - "2Y", - 3 - ); - - ComponentPair cpMTM = new ComponentPair ( - "FFFF_MTM", - fixFloatUSD, - fixFloatEURMTM, - null - ); - - FixFloatComponent fixFloatEURNonMTM = MakeFixFloatSwap ( - dtToday, - false, - "USD", - "EUR", - "2Y", - 3 - ); - - ComponentPair cpNonMTM = new ComponentPair ( - "FFFF_Non_MTM", - fixFloatUSD, - fixFloatEURNonMTM, - null - ); - - CurveSurfaceQuoteContainer mktParams = new CurveSurfaceQuoteContainer(); - - mktParams.setFixing ( - dtToday, - fxLabel, - dblUSDEURFXRate - ); - - mktParams.setForwardState ( - ScenarioForwardCurveBuilder.FlatForwardForwardCurve ( - dtToday, - fri3MUSD, - dblUSD3MForwardRate - ) - ); - - mktParams.setForwardState ( - ScenarioForwardCurveBuilder.FlatForwardForwardCurve ( - dtToday, - fri3MEUR, - dblEUR3MForwardRate - ) - ); - - mktParams.setFundingState ( - ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - dtToday, - "USD", - dblUSDFundingRate - ) - ); - - mktParams.setFXState ( - ScenarioFXCurveBuilder.CubicPolynomialCurve ( - fxLabel.fullyQualifiedName(), - dtToday, - cp, - new String[] {"10Y"}, - new double[] {dblUSDEURFXRate}, - dblUSDEURFXRate - ) - ); - - double[] adblUSD3MForwardVol = new double[] { - 0.1, 0.4 - }; - double[] adblEUR3MForwardVol = new double[] { - 0.1, 0.4 - }; - double[] adblUSDFundingVol = new double[] { - 0.1, 0.4 - }; - double[] adblUSDEURFXVol = new double[] { - 0.1, 0.4 - }; - double[] adblUSD3MForwardUSDFundingCorr = new double[] { - -0.1, 0.2 - }; - double[] adblEUR3MForwardUSDFundingCorr = new double[] { - -0.1, 0.2 - }; - double[] adblEUR3MForwardUSDEURFXCorr = new double[] { - -0.1, 0.2 - }; - double[] adblUSDFundingUSDEURFXCorr = new double[] { - -0.1, 0.2 - }; - - for (double dblUSD3MForwardVol : adblUSD3MForwardVol) { - for (double dblEUR3MForwardVol : adblEUR3MForwardVol) { - for (double dblUSDFundingVol : adblUSDFundingVol) { - for (double dblUSDEURFXVol : adblUSDEURFXVol) { - for (double dblUSD3MForwardUSDFundingCorr : adblUSD3MForwardUSDFundingCorr) { - for (double dblEUR3MForwardUSDFundingCorr : adblEUR3MForwardUSDFundingCorr) { - for (double dblEUR3MForwardUSDEURFXCorr : adblEUR3MForwardUSDEURFXCorr) { - for (double dblUSDFundingUSDEURFXCorr : adblUSDFundingUSDEURFXCorr) - VolCorrScenario ( - new ComponentPair[] { - cpMTM, - cpNonMTM - }, - valParams, - mktParams, - fri3MUSD, - fri3MEUR, - fundingLabel, - fxLabel, - dblUSD3MForwardVol, - dblEUR3MForwardVol, - dblUSDFundingVol, - dblUSDEURFXVol, - dblUSD3MForwardUSDFundingCorr, - dblEUR3MForwardUSDFundingCorr, - dblEUR3MForwardUSDEURFXCorr, - dblUSDFundingUSDEURFXCorr - ); - } - } - } - } - } - } - } - } -} diff --git a/org/drip/sample/cross/FloatFloatFloatFloat.java b/org/drip/sample/cross/FloatFloatFloatFloat.java deleted file mode 100644 index 9f419b6..0000000 --- a/org/drip/sample/cross/FloatFloatFloatFloat.java +++ /dev/null @@ -1,518 +0,0 @@ - -package org.drip.sample.cross; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.fx.ComponentPair; -import org.drip.product.params.*; -import org.drip.product.rates.*; -import org.drip.quant.common.*; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FloatFloatFloatFloat demonstrates the construction, the usage, and the eventual valuation of the Cross - * Currency Basis Swap built out of a pair of float-float swaps. - * - * @author Lakshmi Krishnamurthy - */ - -public class FloatFloatFloatFloat { - - private static final FloatFloatComponent MakeFloatFloatSwap ( - final JulianDate dtEffective, - final boolean bFXMTM, - final String strPayCurrency, - final String strCouponCurrency, - final String strMaturityTenor, - final int iTenorInMonthsReference, - final int iTenorInMonthsDerived) - throws Exception - { - ComposableFloatingUnitSetting cfusReference = new ComposableFloatingUnitSetting ( - iTenorInMonthsReference + "M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCouponCurrency, - iTenorInMonthsReference + "M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFloatingUnitSetting cfusDerived = new ComposableFloatingUnitSetting ( - iTenorInMonthsDerived + "M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCouponCurrency, - iTenorInMonthsDerived + "M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cpsReference = new CompositePeriodSetting ( - 12 / iTenorInMonthsReference, - iTenorInMonthsReference + "M", - strPayCurrency, - null, - -1., - null, - null, - bFXMTM ? null : new FixingSetting ( - FixingSetting.FIXING_PRESET_STATIC, - null, - dtEffective.julian() - ), - null - ); - - CompositePeriodSetting cpsDerived = new CompositePeriodSetting ( - 12 / iTenorInMonthsDerived, - iTenorInMonthsDerived + "M", - strPayCurrency, - null, - 1., - null, - null, - bFXMTM ? null : new FixingSetting ( - FixingSetting.FIXING_PRESET_STATIC, - null, - dtEffective.julian() - ), - null - ); - - List lsReferenceStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - iTenorInMonthsReference + "M", - strMaturityTenor, - null - ); - - List lsDerivedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - iTenorInMonthsDerived + "M", - strMaturityTenor, - null - ); - - Stream referenceStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsReferenceStreamEdgeDate, - cpsReference, - cfusReference - ) - ); - - Stream derivedStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsDerivedStreamEdgeDate, - cpsDerived, - cfusDerived - ) - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strPayCurrency, - 0 - ); - - return new FloatFloatComponent ( - referenceStream, - derivedStream, - csp - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - String strReferenceCurrency = "USD"; - String strDerivedCurrency = "EUR"; - - double dblReference3MForwardRate = 0.00750; - double dblReference6MForwardRate = 0.01000; - double dblDerived3MForwardRate = 0.00375; - double dblDerived6MForwardRate = 0.00625; - double dblReferenceFundingRate = 0.02; - double dblReferenceDerivedFXRate = 1. / 1.28; - - double dblReference3MForwardVol = 0.3; - double dblReference6MForwardVol = 0.3; - double dblDerived3MForwardVol = 0.3; - double dblDerived6MForwardVol = 0.3; - double dblReferenceFundingVol = 0.3; - double dblReferenceDerivedFXVol = 0.3; - - double dblReference3MForwardFundingCorr = 0.15; - double dblReference6MForwardFundingCorr = 0.15; - double dblDerived3MForwardFundingCorr = 0.15; - double dblDerived6MForwardFundingCorr = 0.15; - - double dblReference3MForwardFXCorr = 0.15; - double dblReference6MForwardFXCorr = 0.15; - double dblDerived3MForwardFXCorr = 0.15; - double dblDerived6MForwardFXCorr = 0.15; - - double dblFundingFXCorr = 0.15; - - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = org.drip.analytics.date.DateUtil.Today(); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - strReferenceCurrency - ); - - ForwardLabel fri3MReference = ForwardLabel.Create ( - strReferenceCurrency, - "3M" - ); - - ForwardLabel fri6MReference = ForwardLabel.Create ( - strReferenceCurrency, - "6M" - ); - - ForwardLabel fri3MDerived = ForwardLabel.Create ( - strDerivedCurrency, - "3M" - ); - - ForwardLabel fri6MDerived = ForwardLabel.Create ( - strDerivedCurrency, - "6M" - ); - - FundingLabel fundingLabelReference = FundingLabel.Standard (strReferenceCurrency); - - CurrencyPair cp = CurrencyPair.FromCode (strReferenceCurrency + "/" + strDerivedCurrency); - - FXLabel fxLabel = FXLabel.Standard (cp); - - FloatFloatComponent floatFloatReference = MakeFloatFloatSwap ( - dtToday, - false, - strReferenceCurrency, - strReferenceCurrency, - "2Y", - 6, - 3 - ); - - floatFloatReference.setPrimaryCode ( - "FLOAT::FLOAT::" + strReferenceCurrency + "::" + strReferenceCurrency + "_3M::" + strReferenceCurrency + "_6M::2Y" - ); - - FloatFloatComponent floatFloatDerivedMTM = MakeFloatFloatSwap ( - dtToday, - true, - strReferenceCurrency, - strDerivedCurrency, - "2Y", - 6, - 3 - ); - - floatFloatDerivedMTM.setPrimaryCode ( - "FLOAT::FLOAT::MTM::" + strReferenceCurrency + "::" + strDerivedCurrency + "_3M::" + strDerivedCurrency + "_6M::2Y" - ); - - ComponentPair cpMTM = new ComponentPair ( - "FFFF_MTM", - floatFloatReference, - floatFloatDerivedMTM, - null - ); - - FloatFloatComponent floatFloatDerivedNonMTM = MakeFloatFloatSwap ( - dtToday, - false, - strReferenceCurrency, - strDerivedCurrency, - "2Y", - 6, - 3 - ); - - floatFloatDerivedNonMTM.setPrimaryCode ( - "FLOAT::FLOAT::NONMTM::" + strReferenceCurrency + "::" + strDerivedCurrency + "_3M::" + strDerivedCurrency + "_6M::2Y" - ); - - ComponentPair cpNonMTM = new ComponentPair ( - "FFFF_NonMTM", - floatFloatReference, - floatFloatDerivedNonMTM, - null - ); - - CurveSurfaceQuoteContainer mktParams = new CurveSurfaceQuoteContainer(); - - mktParams.setFixing ( - dtToday, - fxLabel, - dblReferenceDerivedFXRate - ); - - mktParams.setForwardState ( - ScenarioForwardCurveBuilder.FlatForwardForwardCurve ( - dtToday, - fri3MReference, - dblReference3MForwardRate - ) - ); - - mktParams.setForwardState ( - ScenarioForwardCurveBuilder.FlatForwardForwardCurve ( - dtToday, - fri6MReference, - dblReference6MForwardRate - ) - ); - - mktParams.setForwardState ( - ScenarioForwardCurveBuilder.FlatForwardForwardCurve ( - dtToday, - fri3MDerived, - dblDerived3MForwardRate - ) - ); - - mktParams.setForwardState ( - ScenarioForwardCurveBuilder.FlatForwardForwardCurve ( - dtToday, - fri6MDerived, - dblDerived6MForwardRate - ) - ); - - mktParams.setFundingState ( - ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - dtToday, - strReferenceCurrency, - dblReferenceFundingRate - ) - ); - - mktParams.setFXState ( - ScenarioFXCurveBuilder.CubicPolynomialCurve ( - fxLabel.fullyQualifiedName(), - dtToday, - cp, - new String[] {"10Y"}, - new double[] {dblReferenceDerivedFXRate}, - dblReferenceDerivedFXRate - ) - ); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtToday.julian(), - VolatilityLabel.Standard (fri3MReference), - fri3MReference.currency(), - dblReference3MForwardVol - ) - ); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtToday.julian(), - VolatilityLabel.Standard (fri6MReference), - fri6MReference.currency(), - dblReference6MForwardVol - ) - ); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtToday.julian(), - VolatilityLabel.Standard (fri3MDerived), - fri3MDerived.currency(), - dblDerived3MForwardVol - ) - ); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtToday.julian(), - VolatilityLabel.Standard (fri6MDerived), - fri6MDerived.currency(), - dblDerived6MForwardVol - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtToday.julian(), - VolatilityLabel.Standard (fundingLabelReference), - strReferenceCurrency, - dblReferenceFundingVol - ) - ); - - mktParams.setFXVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtToday.julian(), - VolatilityLabel.Standard (fxLabel), - strDerivedCurrency, - dblReferenceDerivedFXVol - ) - ); - - mktParams.setForwardFundingCorrelation ( - fri3MReference, - fundingLabelReference, - new FlatUnivariate (dblReference3MForwardFundingCorr) - ); - - mktParams.setForwardFundingCorrelation ( - fri6MReference, - fundingLabelReference, - new FlatUnivariate (dblReference6MForwardFundingCorr) - ); - - mktParams.setForwardFundingCorrelation ( - fri3MDerived, - fundingLabelReference, - new FlatUnivariate (dblDerived3MForwardFundingCorr) - ); - - mktParams.setForwardFundingCorrelation ( - fri6MDerived, - fundingLabelReference, - new FlatUnivariate (dblDerived6MForwardFundingCorr) - ); - - mktParams.setForwardFXCorrelation ( - fri3MReference, - fxLabel, - new FlatUnivariate (dblReference3MForwardFXCorr) - ); - - mktParams.setForwardFXCorrelation ( - fri6MReference, - fxLabel, - new FlatUnivariate (dblReference6MForwardFXCorr) - ); - - mktParams.setForwardFXCorrelation ( - fri3MDerived, - fxLabel, - new FlatUnivariate (dblDerived3MForwardFXCorr) - ); - - mktParams.setForwardFXCorrelation ( - fri6MDerived, - fxLabel, - new FlatUnivariate (dblDerived6MForwardFXCorr) - ); - - mktParams.setFundingFXCorrelation ( - fundingLabelReference, - fxLabel, - new FlatUnivariate (dblFundingFXCorr) - ); - - CaseInsensitiveTreeMap mapMTMOutput = cpMTM.value ( - valParams, - null, - mktParams, - null - ); - - CaseInsensitiveTreeMap mapNonMTMOutput = cpNonMTM.value ( - valParams, - null, - mktParams, - null - ); - - for (Map.Entry me : mapMTMOutput.entrySet()) { - String strKey = me.getKey(); - - if (null != me.getValue() && null != mapNonMTMOutput.get (strKey)) { - double dblMTMMeasure = me.getValue(); - - double dblNonMTMMeasure = mapNonMTMOutput.get (strKey); - - String strReconcile = NumberUtil.WithinTolerance ( - dblMTMMeasure, - dblNonMTMMeasure, - 1.e-08, - 1.e-04 - ) ? "RECONCILES" : "DOES NOT RECONCILE"; - - System.out.println ("\t" + - FormatUtil.FormatDouble (dblMTMMeasure, 1, 8, 1.) + " | " + - FormatUtil.FormatDouble (dblNonMTMMeasure, 1, 8, 1.) + " | " + - strReconcile + " <= " + strKey); - } - } - } -} diff --git a/org/drip/sample/cross/FloatFloatFloatFloatAnalysis.java b/org/drip/sample/cross/FloatFloatFloatFloatAnalysis.java deleted file mode 100644 index 6274496..0000000 --- a/org/drip/sample/cross/FloatFloatFloatFloatAnalysis.java +++ /dev/null @@ -1,688 +0,0 @@ - -package org.drip.sample.cross; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.fx.ComponentPair; -import org.drip.product.params.*; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FloatFloatFloatFloatAnalysis demonstrates the Funding Volatility, Forward Volatility, FX Volatility, - * Funding/Forward Correlation, Funding/FX Correlation, and Forward/FX Correlation of the Cross Currency - * Basis Swap built out of a pair of float-float swaps. - * - * @author Lakshmi Krishnamurthy - */ - -public class FloatFloatFloatFloatAnalysis { - - private static final FloatFloatComponent MakeFloatFloatSwap ( - final JulianDate dtEffective, - final boolean bFXMTM, - final String strPayCurrency, - final String strCouponCurrency, - final String strMaturityTenor, - final int iTenorInMonthsReference, - final int iTenorInMonthsDerived) - throws Exception - { - ComposableFloatingUnitSetting cfusReference = new ComposableFloatingUnitSetting ( - iTenorInMonthsReference + "M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCouponCurrency, - iTenorInMonthsReference + "M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFloatingUnitSetting cfusDerived = new ComposableFloatingUnitSetting ( - iTenorInMonthsDerived + "M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCouponCurrency, - iTenorInMonthsDerived + "M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cpsReference = new CompositePeriodSetting ( - 12 / iTenorInMonthsReference, - iTenorInMonthsReference + "M", - strPayCurrency, - null, - -1., - null, - null, - bFXMTM ? null : new FixingSetting ( - FixingSetting.FIXING_PRESET_STATIC, - null, - dtEffective.julian() - ), - null - ); - - CompositePeriodSetting cpsDerived = new CompositePeriodSetting ( - 12 / iTenorInMonthsDerived, - iTenorInMonthsDerived + "M", - strPayCurrency, - null, - 1., - null, - null, - bFXMTM ? null : new FixingSetting ( - FixingSetting.FIXING_PRESET_STATIC, - null, - dtEffective.julian() - ), - null - ); - - List lsReferenceStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - iTenorInMonthsReference + "M", - strMaturityTenor, - null - ); - - List lsDerivedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - iTenorInMonthsDerived + "M", - strMaturityTenor, - null - ); - - Stream referenceStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsReferenceStreamEdgeDate, - cpsReference, - cfusReference - ) - ); - - Stream derivedStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsDerivedStreamEdgeDate, - cpsDerived, - cfusDerived - ) - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strPayCurrency, - 0 - ); - - return new FloatFloatComponent ( - referenceStream, - derivedStream, - csp - ); - } - - private static final void SetMarketParams ( - final int iValueDate, - final CurveSurfaceQuoteContainer mktParams, - final ForwardLabel forwardReferenceLabel1, - final ForwardLabel forwardReferenceLabel2, - final ForwardLabel forwardDerivedLabel1, - final ForwardLabel forwardDerivedLabel2, - final FundingLabel fundingLabel, - final FXLabel fxLabel, - final double dblForwardReference1Vol, - final double dblForwardReference2Vol, - final double dblForwardDerived1Vol, - final double dblForwardDerived2Vol, - final double dblFundingVol, - final double dblFXVol, - final double dblForwardReference1FundingCorr, - final double dblForwardReference2FundingCorr, - final double dblForwardDerived1FundingCorr, - final double dblForwardDerived2FundingCorr, - final double dblForwardReference1FXCorr, - final double dblForwardReference2FXCorr, - final double dblForwardDerived1FXCorr, - final double dblForwardDerived2FXCorr, - final double dblFundingFXCorr) - throws Exception - { - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (forwardReferenceLabel1), - forwardReferenceLabel1.currency(), - dblForwardReference1Vol - ) - ); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (forwardReferenceLabel2), - forwardReferenceLabel2.currency(), - dblForwardReference2Vol - ) - ); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (forwardDerivedLabel1), - forwardDerivedLabel1.currency(), - dblForwardDerived1Vol - ) - ); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (forwardDerivedLabel2), - forwardDerivedLabel2.currency(), - dblForwardDerived2Vol - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (fundingLabel), - forwardDerivedLabel1.currency(), - dblFundingVol - ) - ); - - mktParams.setFXVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (fxLabel), - forwardDerivedLabel1.currency(), - dblFXVol - ) - ); - - mktParams.setForwardFundingCorrelation ( - forwardReferenceLabel1, - fundingLabel, - new FlatUnivariate (dblForwardReference1FundingCorr) - ); - - mktParams.setForwardFundingCorrelation ( - forwardReferenceLabel2, - fundingLabel, - new FlatUnivariate (dblForwardReference2FundingCorr) - ); - - mktParams.setForwardFundingCorrelation ( - forwardDerivedLabel1, - fundingLabel, - new FlatUnivariate (dblForwardDerived1FundingCorr) - ); - - mktParams.setForwardFundingCorrelation ( - forwardDerivedLabel2, - fundingLabel, - new FlatUnivariate (dblForwardDerived2FundingCorr) - ); - - mktParams.setForwardFXCorrelation ( - forwardReferenceLabel1, - fxLabel, - new FlatUnivariate (dblForwardReference1FXCorr) - ); - - mktParams.setForwardFXCorrelation ( - forwardReferenceLabel2, - fxLabel, - new FlatUnivariate (dblForwardReference2FXCorr) - ); - - mktParams.setForwardFXCorrelation ( - forwardDerivedLabel1, - fxLabel, - new FlatUnivariate (dblForwardDerived1FXCorr) - ); - - mktParams.setForwardFXCorrelation ( - forwardDerivedLabel2, - fxLabel, - new FlatUnivariate (dblForwardDerived2FXCorr) - ); - - mktParams.setFundingFXCorrelation ( - fundingLabel, - fxLabel, - new FlatUnivariate (dblFundingFXCorr) - ); - } - - private static final void VolCorrScenario ( - final ComponentPair[] aCP, - final ValuationParams valParams, - final CurveSurfaceQuoteContainer mktParams, - final ForwardLabel forwardReferenceLabel1, - final ForwardLabel forwardReferenceLabel2, - final ForwardLabel forwardDerivedLabel1, - final ForwardLabel forwardDerivedLabel2, - final FundingLabel fundingLabel, - final FXLabel fxLabel, - final double dblForwardReference1Vol, - final double dblForwardReference2Vol, - final double dblForwardDerived1Vol, - final double dblForwardDerived2Vol, - final double dblFundingVol, - final double dblFXVol, - final double dblForwardReference1FundingCorr, - final double dblForwardReference2FundingCorr, - final double dblForwardDerived1FundingCorr, - final double dblForwardDerived2FundingCorr, - final double dblForwardReference1FXCorr, - final double dblForwardReference2FXCorr, - final double dblForwardDerived1FXCorr, - final double dblForwardDerived2FXCorr, - final double dblFundingFXCorr) - throws Exception - { - SetMarketParams ( - valParams.valueDate(), - mktParams, - forwardReferenceLabel1, - forwardReferenceLabel2, - forwardDerivedLabel1, - forwardDerivedLabel2, - fundingLabel, - fxLabel, - dblForwardReference1Vol, - dblForwardReference2Vol, - dblForwardDerived1Vol, - dblForwardDerived2Vol, - dblFundingVol, - dblFXVol, - dblForwardReference1FundingCorr, - dblForwardReference2FundingCorr, - dblForwardDerived1FundingCorr, - dblForwardDerived2FundingCorr, - dblForwardReference1FXCorr, - dblForwardReference2FXCorr, - dblForwardDerived1FXCorr, - dblForwardDerived2FXCorr, - dblFundingFXCorr - ); - - String strDump = "\t[" + - FormatUtil.FormatDouble (dblForwardReference1Vol, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblForwardReference2Vol, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblForwardDerived1Vol, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblForwardDerived2Vol, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblFundingVol, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblFXVol, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblForwardReference1FundingCorr, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblForwardReference2FundingCorr, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblForwardDerived1FundingCorr, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblForwardDerived2FundingCorr, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblForwardReference1FXCorr, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblForwardReference2FXCorr, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblForwardDerived1FXCorr, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblForwardDerived2FXCorr, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblFundingFXCorr, 2, 0, 100.) + "%] = "; - - for (int i = 0; i < aCP.length; ++i) { - CaseInsensitiveTreeMap mapOutput = aCP[i].value ( - valParams, - null, - mktParams, - null - ); - - if (0 != i) strDump += " || "; - - strDump += - FormatUtil.FormatDouble (mapOutput.get ("ReferenceCumulativeConvexityAdjustmentPremium"), 2, 0, 10000.) + " | " + - FormatUtil.FormatDouble (mapOutput.get ("DerivedCumulativeConvexityAdjustmentPremium"), 2, 0, 10000.) + " | " + - FormatUtil.FormatDouble (mapOutput.get ("CumulativeConvexityAdjustmentPremium"), 2, 0, 10000.); - } - - System.out.println (strDump); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - String strReferenceCurrency = "USD"; - String strDerivedCurrency = "EUR"; - - double dblReference3MForwardRate = 0.00750; - double dblReference6MForwardRate = 0.01000; - double dblDerived3MForwardRate = 0.00375; - double dblDerived6MForwardRate = 0.00625; - double dblReferenceFundingRate = 0.02; - double dblReferenceDerivedFXRate = 1. / 1.28; - - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = org.drip.analytics.date.DateUtil.Today(); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - "USD" - ); - - ForwardLabel fri3MReference = ForwardLabel.Create ( - strReferenceCurrency, - "3M" - ); - - ForwardLabel fri6MReference = ForwardLabel.Create ( - strReferenceCurrency, - "6M" - ); - - ForwardLabel fri3MDerived = ForwardLabel.Create ( - strDerivedCurrency, - "3M" - ); - - ForwardLabel fri6MDerived = ForwardLabel.Create ( - strDerivedCurrency, - "6M" - ); - - FundingLabel fundingLabelReference = FundingLabel.Standard (strReferenceCurrency); - - CurrencyPair cp = CurrencyPair.FromCode (strReferenceCurrency + "/" + strDerivedCurrency); - - FXLabel fxLabel = FXLabel.Standard (cp); - - FloatFloatComponent floatFloatReference = MakeFloatFloatSwap ( - dtToday, - false, - strReferenceCurrency, - strReferenceCurrency, - "2Y", - 6, - 3 - ); - - floatFloatReference.setPrimaryCode ( - "FLOAT::FLOAT::" + strReferenceCurrency + "::" + strReferenceCurrency + "_3M::" + strReferenceCurrency + "_6M::2Y" - ); - - FloatFloatComponent floatFloatDerivedMTM = MakeFloatFloatSwap ( - dtToday, - true, - strReferenceCurrency, - strDerivedCurrency, - "2Y", - 6, - 3 - ); - - floatFloatDerivedMTM.setPrimaryCode ( - "FLOAT::FLOAT::MTM::" + strReferenceCurrency + "::" + strDerivedCurrency + "_3M::" + strDerivedCurrency + "_6M::2Y" - ); - - ComponentPair cpMTM = new ComponentPair ( - "FFFF_MTM", - floatFloatReference, - floatFloatDerivedMTM, - null - ); - - FloatFloatComponent floatFloatDerivedNonMTM = MakeFloatFloatSwap ( - dtToday, - false, - strReferenceCurrency, - strDerivedCurrency, - "2Y", - 6, - 3 - ); - - floatFloatDerivedNonMTM.setPrimaryCode ( - "FLOAT::FLOAT::NONMTM::" + strReferenceCurrency + "::" + strDerivedCurrency + "_3M::" + strDerivedCurrency + "_6M::2Y" - ); - - ComponentPair cpNonMTM = new ComponentPair ( - "FFFF_NonMTM", - floatFloatReference, - floatFloatDerivedNonMTM, - null - ); - - CurveSurfaceQuoteContainer mktParams = new CurveSurfaceQuoteContainer(); - - mktParams.setFixing ( - dtToday, - fxLabel, - dblReferenceDerivedFXRate - ); - - mktParams.setForwardState ( - ScenarioForwardCurveBuilder.FlatForwardForwardCurve ( - dtToday, - fri3MReference, - dblReference3MForwardRate - ) - ); - - mktParams.setForwardState ( - ScenarioForwardCurveBuilder.FlatForwardForwardCurve ( - dtToday, - fri6MReference, - dblReference6MForwardRate - ) - ); - - mktParams.setForwardState ( - ScenarioForwardCurveBuilder.FlatForwardForwardCurve ( - dtToday, - fri3MDerived, - dblDerived3MForwardRate - ) - ); - - mktParams.setForwardState ( - ScenarioForwardCurveBuilder.FlatForwardForwardCurve ( - dtToday, - fri6MDerived, - dblDerived6MForwardRate - ) - ); - - mktParams.setFundingState ( - ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - dtToday, - strReferenceCurrency, - dblReferenceFundingRate - ) - ); - - mktParams.setFXState ( - ScenarioFXCurveBuilder.CubicPolynomialCurve ( - fxLabel.fullyQualifiedName(), - dtToday, - cp, - new String[] {"10Y"}, - new double[] {dblReferenceDerivedFXRate}, - dblReferenceDerivedFXRate - ) - ); - - double[] adblReference3MForwardVol = new double[] { - 0.1, 0.4 - }; - double[] adblReference6MForwardVol = new double[] { - 0.1, 0.4 - }; - double[] adblDerived3MForwardVol = new double[] { - 0.1, 0.4 - }; - double[] adblDerived6MForwardVol = new double[] { - 0.1, 0.4 - }; - double[] adblReferenceFundingVol = new double[] { - 0.1, 0.4 - }; - double[] adblReferenceDerivedFXVol = new double[] { - 0.1, 0.4 - }; - - double[] adblReference3MForwardFundingCorr = new double[] { - -0.1, 0.2 - }; - double[] adblReference6MForwardFundingCorr = new double[] { - -0.1, 0.2 - }; - double[] adblDerived3MForwardFundingCorr = new double[] { - -0.1, 0.2 - }; - double[] adblDerived6MForwardFundingCorr = new double[] { - -0.1, 0.2 - }; - - double[] adblReference3MForwardFXCorr = new double[] { - -0.1, 0.2 - }; - double[] adblReference6MForwardFXCorr = new double[] { - -0.1, 0.2 - }; - double[] adblDerived3MForwardFXCorr = new double[] { - -0.1, 0.2 - }; - double[] adblDerived6MForwardFXCorr = new double[] { - -0.1, 0.2 - }; - - double[] adblFundingFXCorr = new double[] { - -0.1, 0.2 - }; - - for (double dblReference3MForwardVol : adblReference3MForwardVol) { - for (double dblReference6MForwardVol : adblReference6MForwardVol) { - for (double dblDerived3MForwardVol : adblDerived3MForwardVol) { - for (double dblDerived6MForwardVol : adblDerived6MForwardVol) { - for (double dblReferenceFundingVol : adblReferenceFundingVol) { - for (double dblReferenceDerivedFXVol : adblReferenceDerivedFXVol) { - for (double dblReference3MForwardFundingCorr : adblReference3MForwardFundingCorr) { - for (double dblReference6MForwardFundingCorr : adblReference6MForwardFundingCorr) { - for (double dblDerived3MForwardFundingCorr : adblDerived3MForwardFundingCorr) { - for (double dblDerived6MForwardFundingCorr : adblDerived6MForwardFundingCorr) { - for (double dblReference3MForwardFXCorr : adblReference3MForwardFXCorr) { - for (double dblReference6MForwardFXCorr : adblReference6MForwardFXCorr) { - for (double dblDerived3MForwardFXCorr : adblDerived3MForwardFXCorr) { - for (double dblDerived6MForwardFXCorr : adblDerived6MForwardFXCorr) { - for (double dblFundingFXCorr : adblFundingFXCorr) - VolCorrScenario ( - new ComponentPair[] { - cpMTM, - cpNonMTM - }, - valParams, - mktParams, - fri3MReference, - fri6MReference, - fri3MDerived, - fri6MDerived, - fundingLabelReference, - fxLabel, - dblReference3MForwardVol, - dblReference6MForwardVol, - dblDerived3MForwardVol, - dblDerived6MForwardVol, - dblReferenceFundingVol, - dblReferenceDerivedFXVol, - dblReference3MForwardFundingCorr, - dblReference6MForwardFundingCorr, - dblDerived3MForwardFundingCorr, - dblDerived6MForwardFundingCorr, - dblReference3MForwardFXCorr, - dblReference6MForwardFXCorr, - dblDerived3MForwardFXCorr, - dblDerived6MForwardFXCorr, - dblFundingFXCorr - ); - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } -} diff --git a/org/drip/sample/date/CalendarAPI.java b/org/drip/sample/date/CalendarAPI.java deleted file mode 100644 index ff5001e..0000000 --- a/org/drip/sample/date/CalendarAPI.java +++ /dev/null @@ -1,181 +0,0 @@ - -package org.drip.sample.date; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.analytics.daycount.Convention; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * CalendarAPI demonstrates Calendar API Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class CalendarAPI { - - /** - * Sample demonstrating the calendar API - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void CalenderAPISample() - throws Exception - { - /* - * Get all the holiday locations in CreditAnalytics - */ - - /* Set setLoc = CreditAnalytics.GetHolLocations(); - - System.out.println ("Num Hol Locations: " + setLoc.size()); - - for (String strLoc : setLoc) - System.out.println (strLoc); */ - - /* - * Get all the holidays in the year according the calendar set - */ - - /* JulianDate[] adtHols = CreditAnalytics.GetHolsInYear ( - "USD,GBP", - 2011 - ); - - System.out.println ("USD,GBP has " + adtHols.length + " hols"); - - for (int i = 0; i < adtHols.length; ++i) - System.out.println (adtHols[i]); */ - - /* - * Get all the week day holidays in the year according the calendar set - */ - - /* JulianDate[] adtWeekDayHols = CreditAnalytics.GetWeekDayHolsInYear ( - "USD,GBP", - 2011 - ); - - System.out.println ("USD,GBP has " + adtWeekDayHols.length + " week day hols"); - - for (int i = 0; i < adtWeekDayHols.length; ++i) - System.out.println (adtWeekDayHols[i]); */ - - /* - * Get all the weekend holidays in the year according the calendar set - */ - - /* JulianDate[] adtWeekendHols = CreditAnalytics.GetWeekendHolsInYear ( - "USD,GBP", - 2011 - ); - - System.out.println ("USD,GBP has " + adtWeekendHols.length + " weekend hols"); - - for (int i = 0; i < adtWeekendHols.length; ++i) - System.out.println (adtWeekendHols[i]); */ - - /* - * Indicate which days correspond to the weekend for the given calendar set - */ - - /* int[] aiWkendDays = CreditAnalytics.GetWeekendDays ("USD,GBP"); - - for (int i = 0; i < aiWkendDays.length; ++i) - System.out.println (DateUtil.DayChars (aiWkendDays[i])); - - System.out.println ("USD,GBP has " + aiWkendDays.length + " weekend days"); */ - - /* - * Check if the given day is a holiday - */ - - /* boolean bIsHoliday = CreditAnalytics.IsHoliday ( - "USD,GBP", - DateUtil.CreateFromYMD ( - 2011, - 12, - 28 - ) - ); - - System.out.println (DateUtil.CreateFromYMD (2011, 12, 28) + " is a USD,GBP holiday? " + bIsHoliday); */ - - JulianDate dtToday = DateUtil.Today(); - - /* - * List all the holidays between the specified days according to the calendar set - */ - - List lsHols = Convention.HolidaySet - (dtToday.julian(), dtToday.addYears (1).julian(), "USD,GBP"); - - for (int iDate : lsHols) - System.out.println (new JulianDate (iDate).toOracleDate()); - } - - public static final void main ( - final String astrArgs[]) - throws Exception - { - // String strConfig = "c:\\Lakshmi\\BondAnal\\Config.xml"; - - String strConfig = ""; - - EnvManager.InitEnv (strConfig); - - CalenderAPISample(); - } -} diff --git a/org/drip/sample/date/DateRollAPI.java b/org/drip/sample/date/DateRollAPI.java deleted file mode 100644 index fbb3e6a..0000000 --- a/org/drip/sample/date/DateRollAPI.java +++ /dev/null @@ -1,147 +0,0 @@ - -package org.drip.sample.date; - -import org.drip.analytics.date.*; -import org.drip.analytics.daycount.Convention; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * DateRollAPI demonstrates Date Roll Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class DateRollAPI { - public static final void main ( - final String astrArgs[]) - throws Exception - { - // String strConfig = "c:\\Lakshmi\\BondAnal\\Config.xml"; - - String strConfig = ""; - - EnvManager.InitEnv (strConfig); - - JulianDate dt = DateUtil.CreateFromYMD ( - 2012, - DateUtil.FEBRUARY, - 5 - ); - - System.out.println ("\tDATE_ROLL_ACTUAL : " + dt + " -> " + - new JulianDate ( - Convention.RollDate ( - dt.julian(), - Convention.DATE_ROLL_ACTUAL, - "USD", - 1 - ) - ) - ); - - System.out.println ("\tDATE_ROLL_FOLLOWING : " + dt + " -> " + - new JulianDate ( - Convention.RollDate ( - dt.julian(), - Convention.DATE_ROLL_FOLLOWING, - "USD", - 1 - ) - ) - ); - - System.out.println ("\tDATE_ROLL_MODIFIED_FOLLOWING : " + dt + " -> " + - new JulianDate ( - Convention.RollDate ( - dt.julian(), - Convention.DATE_ROLL_MODIFIED_FOLLOWING, - "USD", - 1 - ) - ) - ); - - System.out.println ("\tDATE_ROLL_MODIFIED_FOLLOWING_BIMONTHLY: " + dt + " -> " + - new JulianDate ( - Convention.RollDate ( - dt.julian(), - Convention.DATE_ROLL_MODIFIED_FOLLOWING_BIMONTHLY, - "USD", - 1 - ) - ) - ); - - System.out.println ("\tDATE_ROLL_PREVIOUS : " + dt + " -> " + - new JulianDate ( - Convention.RollDate ( - dt.julian(), - Convention.DATE_ROLL_PREVIOUS, - "USD", - 1 - ) - ) - ); - - System.out.println ("\tDATE_ROLL_MODIFIED_PREVIOUS : " + dt + " -> " + - new JulianDate ( - Convention.RollDate ( - dt.julian(), - Convention.DATE_ROLL_MODIFIED_PREVIOUS, - "USD", - 1 - ) - ) - ); - } -} diff --git a/org/drip/sample/date/DayCountAPI.java b/org/drip/sample/date/DayCountAPI.java deleted file mode 100644 index c0f856c..0000000 --- a/org/drip/sample/date/DayCountAPI.java +++ /dev/null @@ -1,175 +0,0 @@ - -package org.drip.sample.date; - -/* - * Generic imports - */ - -import org.drip.analytics.date.*; -import org.drip.analytics.daycount.Convention; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * DayCountAPI demonstrates Day-count API Functionality. It does the following: - * - Get all the holiday locations in CreditAnalytics, and all the holidays in the year according the - * calendar set. - * - Calculate year fraction between 2 dates according to semi-annual, Act/360, and USD calendar. - * - * @author Lakshmi Krishnamurthy - */ - -public class DayCountAPI { - - /** - * Sample API demonstrating the day count functionality - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void DayCountAPISample ( - final JulianDate dtStart, - final JulianDate dtEnd, - final String strDayCount) - throws Exception - { - /* - * Calculate year fraction between 2 dates according to semi-annual, Act/360, and USD calendar - */ - - double dblYearFraction = org.drip.analytics.daycount.Convention.YearFraction ( - dtStart.julian(), - dtEnd.julian(), - strDayCount, - false, - null, - "USD" - ); - - int iDaysAccrued = org.drip.analytics.daycount.Convention.DaysAccrued ( - dtStart.julian(), - dtEnd.julian(), - strDayCount, - false, - null, - "USD" - ); - - System.out.println ( - "\t[" + dtStart + " -> " + dtEnd + "] => " + FormatUtil.FormatDouble (dblYearFraction, 1, 4, 1.) + " | " + iDaysAccrued + " | " + strDayCount - ); - } - - private static final void DayCountSequence ( - final JulianDate dtStart, - final JulianDate dtEnd) - throws Exception - { - DayCountAPISample (dtStart, dtEnd, "28/360"); - - DayCountAPISample (dtStart, dtEnd, "30/365"); - - DayCountAPISample (dtStart, dtEnd, "30/360"); - - DayCountAPISample (dtStart, dtEnd, "30E/360 ISDA"); - - DayCountAPISample (dtStart, dtEnd, "30E/360"); - - DayCountAPISample (dtStart, dtEnd, "30E+/360"); - - DayCountAPISample (dtStart, dtEnd, "Act/360"); - - DayCountAPISample (dtStart, dtEnd, "Act/364"); - - DayCountAPISample (dtStart, dtEnd, "Act/365"); - - DayCountAPISample (dtStart, dtEnd, "Act/Act ISDA"); - - DayCountAPISample (dtStart, dtEnd, "Act/Act"); - - DayCountAPISample (dtStart, dtEnd, "NL/360"); - - DayCountAPISample (dtStart, dtEnd, "NL/365"); - } - - public static final void main ( - final String astrArgs[]) - throws Exception - { - // String strConfig = "c:\\Lakshmi\\BondAnal\\Config.xml"; - - String strConfig = ""; - - EnvManager.InitEnv (strConfig); - - /* - * List available day count - */ - - String strDCList = Convention.AvailableDC(); - - System.out.println (strDCList + "\n--------------------\n"); - - DayCountSequence ( - DateUtil.CreateFromYMD (2013, 5, 30), - DateUtil.CreateFromYMD (2013, 6, 24) - ); - - System.out.println ("\n--------------------\n"); - - DayCountSequence ( - DateUtil.CreateFromYMD (2010, 12, 30), - DateUtil.CreateFromYMD (2012, 12, 30) - ); - } -} diff --git a/org/drip/sample/date/FliegelvanFlandernJulian.java b/org/drip/sample/date/FliegelvanFlandernJulian.java deleted file mode 100644 index 3445b46..0000000 --- a/org/drip/sample/date/FliegelvanFlandernJulian.java +++ /dev/null @@ -1,93 +0,0 @@ - -package org.drip.sample.date; - -import org.drip.analytics.date.DateUtil; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * Fliegel van Flandern demonstrates Gregorian To-From Julian Date Conversion Functionality. The References are: - * - * 1) Fliegel, H. F., and T. C. van Flandern (1968): A Machine Algorithm for Processing Calendar Dates, - * Communications of the ACM 11 657. - * - * 2) Fenton, D. (2001): Julian to Calendar Date Conversion, - * http://mathforum.org/library/drmath/view/51907.html. - * - * @author Lakshmi Krishnamurthy - */ - -public class FliegelvanFlandernJulian { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iYear = 2001; - int iMonth = 2; - int iDate = 24; - - int iJulian = DateUtil.ToJulian ( - iYear, - iMonth, - iDate - ); - - System.out.println ( - "\tGregorian: [" + iYear + "/" + - FormatUtil.FormatDouble (iMonth, 2, 0, 1., false) + "/" + - FormatUtil.FormatDouble (iDate, 2, 0, 1., false) + - "]; Julian: " + iJulian - ); - - System.out.println ("\tJulian: " + iJulian + "; Gregorian: [" + DateUtil.YYYYMMDD (iJulian) + "]"); - } -} diff --git a/org/drip/sample/date/IMMRollAPI.java b/org/drip/sample/date/IMMRollAPI.java deleted file mode 100644 index 7dec1c0..0000000 --- a/org/drip/sample/date/IMMRollAPI.java +++ /dev/null @@ -1,94 +0,0 @@ - -package org.drip.sample.date; - -import org.drip.analytics.date.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * IMMRollAPI demonstrates the API used to generate IMM Rolled Dates specific to different Products. - * - * @author Lakshmi Krishnamurthy - */ - -public class IMMRollAPI { - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dt = DateUtil.CreateFromYMD ( - 2010, - DateUtil.DECEMBER, - 30 - ); - - int iDateGap = 10; - int iNumDate = 30; - - System.out.println ("\n\n\t|--------------------------------------------------------------------------------||"); - - System.out.println ("\t| SPOT DATE | NEXT RATES FUTURES IMM | NEXT BOND FUTURES IMM | NEXT CDS/CDX IMM ||"); - - System.out.println ("\t|--------------------------------------------------------------------------------||"); - - for (int i = 0; i < iNumDate; ++i) { - System.out.println ("\t| " + dt + " | " + - dt.nextRatesFuturesIMM (3) + " | " + - dt.nextBondFuturesIMM (3, "USD") + " | " + - dt.nextCreditIMM (3) + " ||" - ); - - dt = dt.addDays (iDateGap); - } - - System.out.println ("\t|--------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/descentverifier/ArmijoEvolutionMetrics.java b/org/drip/sample/descentverifier/ArmijoEvolutionMetrics.java deleted file mode 100644 index b194393..0000000 --- a/org/drip/sample/descentverifier/ArmijoEvolutionMetrics.java +++ /dev/null @@ -1,222 +0,0 @@ - -package org.drip.sample.descentverifier; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.*; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ArmijoEvolutionMetrics demonstrates the Impact of applying the Armijo Criterion on the Evolution of the - * R^d Fixed Point of a Constrained Minimization Search. - * - * @author Lakshmi Krishnamurthy - */ - -public class ArmijoEvolutionMetrics { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - FixedRdFinder.s_bVerifierIncrementBlog = true; - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.05, - 0.04, - 0.06, - 0.03, - 0.03, - 0.03, - 0.13 - }; - - double[] adblAssetUpperBound = new double[] { - 0.43, - 0.27, - 0.44, - 0.32, - 0.66, - 0.32, - 0.88 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.1300, - 0.0700, - 0.0400, - 0.0300, - 0.0800, - 0.1000, - 0.0100 - }; - - double dblPortfolioDesignReturn = 0.06000; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733 * 12, 0.002083 * 12, 0.001593 * 12, 0.000488 * 12, 0.001172 * 12, 0.002312 * 12, 0.000710 * 12}, - {0.002083 * 12, 0.002768 * 12, 0.001302 * 12, 0.000457 * 12, 0.001105 * 12, 0.001647 * 12, 0.000563 * 12}, - {0.001593 * 12, 0.001302 * 12, 0.001463 * 12, 0.000639 * 12, 0.001050 * 12, 0.001110 * 12, 0.000519 * 12}, - {0.000488 * 12, 0.000457 * 12, 0.000639 * 12, 0.000608 * 12, 0.000663 * 12, 0.000042 * 12, 0.000370 * 12}, - {0.001172 * 12, 0.001105 * 12, 0.001050 * 12, 0.000663 * 12, 0.001389 * 12, 0.000825 * 12, 0.000661 * 12}, - {0.002312 * 12, 0.001647 * 12, 0.001110 * 12, 0.000042 * 12, 0.000825 * 12, 0.005211 * 12, 0.000749 * 12}, - {0.000710 * 12, 0.000563 * 12, 0.000519 * 12, 0.000370 * 12, 0.000661 * 12, 0.000749 * 12, 0.000703 * 12} - }; - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightArmijo (false) - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - pdp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - cmva.allocate ( - pdp, - ausp - ); - } -} diff --git a/org/drip/sample/descentverifier/StrongCurvatureEvolutionMetrics.java b/org/drip/sample/descentverifier/StrongCurvatureEvolutionMetrics.java deleted file mode 100644 index acbaa17..0000000 --- a/org/drip/sample/descentverifier/StrongCurvatureEvolutionMetrics.java +++ /dev/null @@ -1,222 +0,0 @@ - -package org.drip.sample.descentverifier; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.*; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * StrongCurvatureEvolutionMetrics demonstrates the Impact of applying the Strong Curvature Criterion on the - * Evolution of the R^d Fixed Point of a Constrained Minimization Search. - * - * @author Lakshmi Krishnamurthy - */ - -public class StrongCurvatureEvolutionMetrics { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - FixedRdFinder.s_bVerifierIncrementBlog = true; - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.05, - 0.04, - 0.06, - 0.03, - 0.03, - 0.03, - 0.13 - }; - - double[] adblAssetUpperBound = new double[] { - 0.43, - 0.27, - 0.44, - 0.32, - 0.66, - 0.32, - 0.88 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.1300, - 0.0700, - 0.0400, - 0.0300, - 0.0800, - 0.1000, - 0.0100 - }; - - double dblPortfolioDesignReturn = 0.06000; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733 * 12, 0.002083 * 12, 0.001593 * 12, 0.000488 * 12, 0.001172 * 12, 0.002312 * 12, 0.000710 * 12}, - {0.002083 * 12, 0.002768 * 12, 0.001302 * 12, 0.000457 * 12, 0.001105 * 12, 0.001647 * 12, 0.000563 * 12}, - {0.001593 * 12, 0.001302 * 12, 0.001463 * 12, 0.000639 * 12, 0.001050 * 12, 0.001110 * 12, 0.000519 * 12}, - {0.000488 * 12, 0.000457 * 12, 0.000639 * 12, 0.000608 * 12, 0.000663 * 12, 0.000042 * 12, 0.000370 * 12}, - {0.001172 * 12, 0.001105 * 12, 0.001050 * 12, 0.000663 * 12, 0.001389 * 12, 0.000825 * 12, 0.000661 * 12}, - {0.002312 * 12, 0.001647 * 12, 0.001110 * 12, 0.000042 * 12, 0.000825 * 12, 0.005211 * 12, 0.000749 * 12}, - {0.000710 * 12, 0.000563 * 12, 0.000519 * 12, 0.000370 * 12, 0.000661 * 12, 0.000749 * 12, 0.000703 * 12} - }; - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongCurvature() - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - pdp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - cmva.allocate ( - pdp, - ausp - ); - } -} diff --git a/org/drip/sample/descentverifier/StrongWolfeEvolutionMetrics.java b/org/drip/sample/descentverifier/StrongWolfeEvolutionMetrics.java deleted file mode 100644 index 27b514a..0000000 --- a/org/drip/sample/descentverifier/StrongWolfeEvolutionMetrics.java +++ /dev/null @@ -1,222 +0,0 @@ - -package org.drip.sample.descentverifier; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.*; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * StrongWolfeEvolutionMetrics demonstrates the Impact of applying the Strong Wolfe Criterion on the - * Evolution of the R^d Fixed Point of a Constrained Minimization Search. - * - * @author Lakshmi Krishnamurthy - */ - -public class StrongWolfeEvolutionMetrics { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - FixedRdFinder.s_bVerifierIncrementBlog = true; - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.05, - 0.04, - 0.06, - 0.03, - 0.03, - 0.03, - 0.13 - }; - - double[] adblAssetUpperBound = new double[] { - 0.43, - 0.27, - 0.44, - 0.32, - 0.66, - 0.32, - 0.88 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.1300, - 0.0700, - 0.0400, - 0.0300, - 0.0800, - 0.1000, - 0.0100 - }; - - double dblPortfolioDesignReturn = 0.06000; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733 * 12, 0.002083 * 12, 0.001593 * 12, 0.000488 * 12, 0.001172 * 12, 0.002312 * 12, 0.000710 * 12}, - {0.002083 * 12, 0.002768 * 12, 0.001302 * 12, 0.000457 * 12, 0.001105 * 12, 0.001647 * 12, 0.000563 * 12}, - {0.001593 * 12, 0.001302 * 12, 0.001463 * 12, 0.000639 * 12, 0.001050 * 12, 0.001110 * 12, 0.000519 * 12}, - {0.000488 * 12, 0.000457 * 12, 0.000639 * 12, 0.000608 * 12, 0.000663 * 12, 0.000042 * 12, 0.000370 * 12}, - {0.001172 * 12, 0.001105 * 12, 0.001050 * 12, 0.000663 * 12, 0.001389 * 12, 0.000825 * 12, 0.000661 * 12}, - {0.002312 * 12, 0.001647 * 12, 0.001110 * 12, 0.000042 * 12, 0.000825 * 12, 0.005211 * 12, 0.000749 * 12}, - {0.000710 * 12, 0.000563 * 12, 0.000519 * 12, 0.000370 * 12, 0.000661 * 12, 0.000749 * 12, 0.000703 * 12} - }; - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - pdp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - cmva.allocate ( - pdp, - ausp - ); - } -} diff --git a/org/drip/sample/descentverifier/WeakCurvatureEvolutionMetrics.java b/org/drip/sample/descentverifier/WeakCurvatureEvolutionMetrics.java deleted file mode 100644 index b0adfc6..0000000 --- a/org/drip/sample/descentverifier/WeakCurvatureEvolutionMetrics.java +++ /dev/null @@ -1,222 +0,0 @@ - -package org.drip.sample.descentverifier; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.*; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * WeakCurvatureEvolutionMetrics demonstrates the Impact of applying the Weak Curvature Criterion on the - * Evolution of the R^d Fixed Point of a Constrained Minimization Search. - * - * @author Lakshmi Krishnamurthy - */ - -public class WeakCurvatureEvolutionMetrics { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - FixedRdFinder.s_bVerifierIncrementBlog = true; - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.05, - 0.04, - 0.06, - 0.03, - 0.03, - 0.03, - 0.13 - }; - - double[] adblAssetUpperBound = new double[] { - 0.43, - 0.27, - 0.44, - 0.32, - 0.66, - 0.32, - 0.88 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.1300, - 0.0700, - 0.0400, - 0.0300, - 0.0800, - 0.1000, - 0.0100 - }; - - double dblPortfolioDesignReturn = 0.06000; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733 * 12, 0.002083 * 12, 0.001593 * 12, 0.000488 * 12, 0.001172 * 12, 0.002312 * 12, 0.000710 * 12}, - {0.002083 * 12, 0.002768 * 12, 0.001302 * 12, 0.000457 * 12, 0.001105 * 12, 0.001647 * 12, 0.000563 * 12}, - {0.001593 * 12, 0.001302 * 12, 0.001463 * 12, 0.000639 * 12, 0.001050 * 12, 0.001110 * 12, 0.000519 * 12}, - {0.000488 * 12, 0.000457 * 12, 0.000639 * 12, 0.000608 * 12, 0.000663 * 12, 0.000042 * 12, 0.000370 * 12}, - {0.001172 * 12, 0.001105 * 12, 0.001050 * 12, 0.000663 * 12, 0.001389 * 12, 0.000825 * 12, 0.000661 * 12}, - {0.002312 * 12, 0.001647 * 12, 0.001110 * 12, 0.000042 * 12, 0.000825 * 12, 0.005211 * 12, 0.000749 * 12}, - {0.000710 * 12, 0.000563 * 12, 0.000519 * 12, 0.000370 * 12, 0.000661 * 12, 0.000749 * 12, 0.000703 * 12} - }; - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightWeakCurvature() - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - pdp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - cmva.allocate ( - pdp, - ausp - ); - } -} diff --git a/org/drip/sample/descentverifier/WeakWolfeEvolutionMetrics.java b/org/drip/sample/descentverifier/WeakWolfeEvolutionMetrics.java deleted file mode 100644 index b2c622b..0000000 --- a/org/drip/sample/descentverifier/WeakWolfeEvolutionMetrics.java +++ /dev/null @@ -1,222 +0,0 @@ - -package org.drip.sample.descentverifier; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.*; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * WeakWolfeEvolutionMetrics demonstrates the Impact of applying the Weak Wolfe Criterion on the Evolution of - * the R^d Fixed Point of a Constrained Minimization Search. - * - * @author Lakshmi Krishnamurthy - */ - -public class WeakWolfeEvolutionMetrics { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - FixedRdFinder.s_bVerifierIncrementBlog = true; - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.05, - 0.04, - 0.06, - 0.03, - 0.03, - 0.03, - 0.13 - }; - - double[] adblAssetUpperBound = new double[] { - 0.43, - 0.27, - 0.44, - 0.32, - 0.66, - 0.32, - 0.88 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.1300, - 0.0700, - 0.0400, - 0.0300, - 0.0800, - 0.1000, - 0.0100 - }; - - double dblPortfolioDesignReturn = 0.06000; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733 * 12, 0.002083 * 12, 0.001593 * 12, 0.000488 * 12, 0.001172 * 12, 0.002312 * 12, 0.000710 * 12}, - {0.002083 * 12, 0.002768 * 12, 0.001302 * 12, 0.000457 * 12, 0.001105 * 12, 0.001647 * 12, 0.000563 * 12}, - {0.001593 * 12, 0.001302 * 12, 0.001463 * 12, 0.000639 * 12, 0.001050 * 12, 0.001110 * 12, 0.000519 * 12}, - {0.000488 * 12, 0.000457 * 12, 0.000639 * 12, 0.000608 * 12, 0.000663 * 12, 0.000042 * 12, 0.000370 * 12}, - {0.001172 * 12, 0.001105 * 12, 0.001050 * 12, 0.000663 * 12, 0.001389 * 12, 0.000825 * 12, 0.000661 * 12}, - {0.002312 * 12, 0.001647 * 12, 0.001110 * 12, 0.000042 * 12, 0.000825 * 12, 0.005211 * 12, 0.000749 * 12}, - {0.000710 * 12, 0.000563 * 12, 0.000519 * 12, 0.000370 * 12, 0.000661 * 12, 0.000749 * 12, 0.000703 * 12} - }; - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightWeakWolfe (false) - ); - - BoundedPortfolioConstructionParameters pdp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblPortfolioDesignReturn - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - pdp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - cmva.allocate ( - pdp, - ausp - ); - } -} diff --git a/org/drip/sample/dual/CAD3M6MUSD3M6M.java b/org/drip/sample/dual/CAD3M6MUSD3M6M.java deleted file mode 100644 index da8f653..0000000 --- a/org/drip/sample/dual/CAD3M6MUSD3M6M.java +++ /dev/null @@ -1,801 +0,0 @@ - -package org.drip.sample.dual; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.sample.forward.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * CAD3M6MUSD3M6M demonstrates the setup and construction of the USD 3M Forward Curve from CAD3M6MUSD3M6M - * CCBS, CAD 3M, CAD 6M, and USD 6M Quotes. - * - * @author Lakshmi Krishnamurthy - */ - -public class CAD3M6MUSD3M6M { - private static final double _dblFXCADUSD = 0.9168; - - private static final int[] s_aiUSDOISDepositMaturityDays = new int[] { - 1, - 2, - 3 - }; - - private static final int[] s_aiCADOISDepositMaturityDays = new int[] { - 1, - 2, - 3 - }; - - private static final double[] s_adblUSDOISDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - private static final double[] s_adblCADOISDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - private static final String[] s_astrUSDShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - private static final String[] s_astrCADShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - private static final double[] s_adblUSDShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - private static final double[] s_adblCADShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - private static final String[] s_astrUSDOISFutureTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - private static final String[] s_astrCADOISFutureTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - private static final String[] s_astrUSDOISFutureMaturityTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final String[] s_astrCADOISFutureMaturityTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblUSDOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - private static final double[] s_adblCADOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - private static final String[] s_astrUSDLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final String[] s_astrCADLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblUSDLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - private static final double[] s_adblCADLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - private static final String[] s_astrUSD6MDepositTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final String[] s_astrCAD6MDepositTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblUSD6MDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - private static final double[] s_adblCAD6MDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - private static final String[] s_astrUSD6MFRATenor = new String[] { - "0D", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - private static final String[] s_astrCAD6MFRATenor = new String[] { - "0D", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - private static final double[] s_adblUSD6MFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - private static final double[] s_adblCAD6MFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - private static final String[] s_astrUSD6MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final String[] s_astrCAD6MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblUSD6MFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - private static final double[] s_adblCAD6MFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - private static final String[] s_astrUSD3MDepositTenor = new String[] { - "2W", - "3W", - "1M", - "2M" - }; - - private static final double[] s_adblUSD3MDepositQuote = new double[] { - 0.001865, - 0.001969, - 0.001951, - 0.001874 - }; - - private static final String[] s_astrUSD3MFRATenor = new String[] { - "0D", - "1M", - "3M", - "6M", - "9M", - "12M", - "15M", - "18M", - "21M" - }; - - private static final double[] s_adblUSD3MFRAQuote = new double[] { - 0.001790, - 0.001775, - 0.001274, - 0.001222, - 0.001269, - 0.001565, - 0.001961, - 0.002556, - 0.003101 - }; - - private static final String[] s_astrUSD3MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblUSD3MFixFloatQuote = new double[] { - 0.002850, // 3Y - 0.004370, // 4Y - 0.006230, // 5Y - 0.008170, // 6Y - 0.010000, // 7Y - 0.011710, // 8Y - 0.013240, // 9Y - 0.014590, // 10Y - 0.016920, // 12Y - 0.019330, // 15Y - 0.020990, // 20Y - 0.021560, // 25Y - 0.021860 // 30Y - }; - - private static final String[] s_astrUSD3MSyntheticFloatFloatTenor = new String[] { - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblUSD3MSyntheticFloatFloatQuote = new double[] { - 0.00065, - 0.00060, - 0.00054, - 0.00050 - }; - - private static final String[] s_astrCCBSTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "15Y", - "20Y" - }; - - private static final double[] s_adblCCBSQuote = new double[] { - 0.001050, // 1Y - 0.001150, // 2Y - 0.001225, // 3Y - 0.001325, // 4Y - 0.001425, // 5Y - 0.001500, // 7Y - 0.001500, // 10Y - 0.001525, // 15Y - 0.001525 // 20Y - }; - - private static final double[] s_adblIRSQuote = new double[] { - 0.01050, // 1Y - 0.01150, // 2Y - 0.01225, // 3Y - 0.01325, // 4Y - 0.01425, // 5Y - 0.01500, // 7Y - 0.01500, // 10Y - 0.01525, // 15Y - 0.01525 // 20Y - }; - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtValue = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - String strReferenceCurrency = "USD"; - String strDerivedCurrency = "CAD"; - - SegmentCustomBuilderControl scbcCubic = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - MergedDiscountForwardCurve dcReference = OvernightIndexCurve.MakeDC ( - strReferenceCurrency, - dtValue, - s_aiUSDOISDepositMaturityDays, - s_adblUSDOISDepositQuote, - s_astrUSDShortEndOISMaturityTenor, - s_adblUSDShortEndOISQuote, - s_astrUSDOISFutureTenor, - s_astrUSDOISFutureMaturityTenor, - s_adblUSDOISFutureQuote, - s_astrUSDLongEndOISMaturityTenor, - s_adblUSDLongEndOISQuote, - scbcCubic, - null - ); - - MergedDiscountForwardCurve dcDerived = OvernightIndexCurve.MakeDC ( - strDerivedCurrency, - dtValue, - s_aiCADOISDepositMaturityDays, - s_adblCADOISDepositQuote, - s_astrCADShortEndOISMaturityTenor, - s_adblCADShortEndOISQuote, - s_astrCADOISFutureTenor, - s_astrCADOISFutureMaturityTenor, - s_adblCADOISFutureQuote, - s_astrCADLongEndOISMaturityTenor, - s_adblCADLongEndOISQuote, - scbcCubic, - null - ); - - ForwardCurve fc6MReference = IBORCurve.CustomIBORBuilderSample ( - dcReference, - null, - ForwardLabel.Create ( - strReferenceCurrency, - "6M" - ), - scbcCubic, - s_astrUSD6MDepositTenor, - s_adblUSD6MDepositQuote, - "ForwardRate", - s_astrUSD6MFRATenor, - s_adblUSD6MFRAQuote, - "ParForwardRate", - s_astrUSD6MFixFloatTenor, - s_adblUSD6MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - "---- USD LIBOR 6M VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - ForwardCurve fc6MDerived = IBORCurve.CustomIBORBuilderSample ( - dcDerived, - null, - ForwardLabel.Create ( - strDerivedCurrency, - "6M" - ), - scbcCubic, - s_astrCAD6MDepositTenor, - s_adblCAD6MDepositQuote, - "ForwardRate", - s_astrCAD6MFRATenor, - s_adblCAD6MFRAQuote, - "ParForwardRate", - s_astrCAD6MFixFloatTenor, - s_adblCAD6MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - "---- CAD LIBOR 6M VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - ForwardCurve fc3MReference = IBORCurve.CustomIBORBuilderSample ( - dcReference, - fc6MReference, - ForwardLabel.Create ( - strReferenceCurrency, - "3M" - ), - scbcCubic, - s_astrUSD3MDepositTenor, - s_adblUSD3MDepositQuote, - "ForwardRate", - s_astrUSD3MFRATenor, - s_adblUSD3MFRAQuote, - "ParForwardRate", - s_astrUSD3MFixFloatTenor, - s_adblUSD3MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - s_astrUSD3MSyntheticFloatFloatTenor, - s_adblUSD3MSyntheticFloatFloatQuote, - "DerivedParBasisSpread", - "---- VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - CCBSForwardCurve.ForwardCurveReferenceComponentBasis ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - dcDerived, - fc6MDerived, - _dblFXCADUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - true - ); - - CCBSForwardCurve.ForwardCurveReferenceComponentBasis ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - dcDerived, - fc6MDerived, - _dblFXCADUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - false - ); - - CCBSDiscountCurve.MakeDiscountCurve ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - _dblFXCADUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - s_adblIRSQuote, - true - ); - - CCBSDiscountCurve.MakeDiscountCurve ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - _dblFXCADUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - s_adblIRSQuote, - false - ); - } -} diff --git a/org/drip/sample/dual/CCBSDiscountCurve.java b/org/drip/sample/dual/CCBSDiscountCurve.java deleted file mode 100644 index 0ab539e..0000000 --- a/org/drip/sample/dual/CCBSDiscountCurve.java +++ /dev/null @@ -1,448 +0,0 @@ - -package org.drip.sample.dual; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.analytics.support.*; -import org.drip.market.otc.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.fx.ComponentPair; -import org.drip.product.params.*; -import org.drip.product.rates.*; -import org.drip.quant.calculus.WengertJacobian; -import org.drip.quant.common.FormatUtil; -import org.drip.spline.params.SegmentCustomBuilderControl; -import org.drip.spline.stretch.*; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.estimator.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * CCBSDiscountCurve demonstrates the setup and construction of the Forward Curve from the CCBS Quotes. - * - * @author Lakshmi Krishnamurthy - */ - -public class CCBSDiscountCurve { - - /* - * Construct an array of float-float swaps from the corresponding reference (6M) and the derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FloatFloatComponent[] MakexM6MBasisSwap ( - final JulianDate dtEffective, - final String strPayCurrency, - final String strCouponCurrency, - final double dblNotional, - final String[] astrMaturityTenor, - final int iTenorInMonths) - throws Exception - { - FloatFloatComponent[] aFFC = new FloatFloatComponent[astrMaturityTenor.length]; - - ComposableFloatingUnitSetting cfusReference = new ComposableFloatingUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCouponCurrency, - "6M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFloatingUnitSetting cfusDerived = new ComposableFloatingUnitSetting ( - iTenorInMonths + "M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCouponCurrency, - iTenorInMonths + "M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cpsReference = new CompositePeriodSetting ( - 2, - "6M", - strPayCurrency, - null, - -1. * dblNotional, - null, - null, - strPayCurrency.equalsIgnoreCase (strCouponCurrency) ? null : - new FixingSetting ( - FixingSetting.FIXING_PRESET_STATIC, - null, - dtEffective.julian() - ), - null - ); - - CompositePeriodSetting cpsDerived = new CompositePeriodSetting ( - 12 / iTenorInMonths, - iTenorInMonths + "M", - strPayCurrency, - null, - 1. * dblNotional, - null, - null, - strPayCurrency.equalsIgnoreCase (strCouponCurrency) ? null : - new FixingSetting ( - FixingSetting.FIXING_PRESET_STATIC, - null, - dtEffective.julian() - ), - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strPayCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - List lsReferenceStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - astrMaturityTenor[i], - null - ); - - List lsDerivedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - iTenorInMonths + "M", - astrMaturityTenor[i], - null - ); - - Stream referenceStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsReferenceStreamEdgeDate, - cpsReference, - cfusReference - ) - ); - - Stream derivedStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsDerivedStreamEdgeDate, - cpsDerived, - cfusDerived - ) - ); - - aFFC[i] = new FloatFloatComponent ( - referenceStream, - derivedStream, - csp - ); - - aFFC[i].setPrimaryCode (referenceStream.name() + "||" + derivedStream.name()); - } - - return aFFC; - } - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] MakeIRS ( - final JulianDate dtEffective, - final String strCurrency, - final String[] astrTenor) - throws Exception - { - FixFloatComponent[] aCalibComp = new FixFloatComponent[astrTenor.length]; - - for (int i = 0; i < astrTenor.length; ++i) - aCalibComp[i] = OTCIRS ( - dtEffective, - strCurrency, - astrTenor[i], - 0. - ); - - return aCalibComp; - } - - private static final ComponentPair[] MakeCCSP ( - final JulianDate dtValue, - final String strReferenceCurrency, - final String strDerivedCurrency, - final String[] astrTenor, - final int iTenorInMonths) - throws Exception - { - FloatFloatComponent[] aFFCReference = MakexM6MBasisSwap ( - dtValue, - strReferenceCurrency, - strReferenceCurrency, - 1., - astrTenor, - 3 - ); - - FixFloatComponent[] aIRS = MakeIRS ( - dtValue, - strDerivedCurrency, - astrTenor - ); - - ComponentPair[] aCCSP = new ComponentPair[astrTenor.length]; - - for (int i = 0; i < aCCSP.length; ++i) - aCCSP[i] = new ComponentPair ( - "EURUSD_" + astrTenor[i], - aFFCReference[i], - aIRS[i], - null - ); - - return aCCSP; - } - - private static final void TenorJack ( - final JulianDate dtStart, - final String strTenor, - final String strManifestMeasure, - final MergedDiscountForwardCurve dc) - throws Exception - { - String strCurrency = dc.currency(); - - CalibratableComponent irsBespoke = OTCIRS ( - dtStart, - strCurrency, - strTenor, - 0. - ); - - WengertJacobian wjDFQuoteBespokeMat = dc.jackDDFDManifestMeasure ( - irsBespoke.maturityDate(), - strManifestMeasure - ); - - System.out.println ("\t" + strTenor + " => " + wjDFQuoteBespokeMat.displayString()); - } - - public static final void MakeDiscountCurve ( - final String strReferenceCurrency, - final String strDerivedCurrency, - final JulianDate dtValue, - final MergedDiscountForwardCurve dcReference, - final ForwardCurve fc6MReference, - final ForwardCurve fc3MReference, - final double dblRefDerFX, - final SegmentCustomBuilderControl scbc, - final String[] astrTenor, - final double[] adblCrossCurrencyBasis, - final double[] adblSwapRate, - final boolean bBasisOnDerivedLeg) - throws Exception - { - ComponentPair[] aCCSP = MakeCCSP ( - dtValue, - strReferenceCurrency, - strDerivedCurrency, - astrTenor, - 3 - ); - - CurveSurfaceQuoteContainer mktParams = new CurveSurfaceQuoteContainer(); - - mktParams.setFundingState (dcReference); - - mktParams.setForwardState (fc3MReference); - - mktParams.setForwardState (fc6MReference); - - CurrencyPair cp = CurrencyPair.FromCode (strDerivedCurrency + "/" + strReferenceCurrency); - - FXLabel fxLabel = FXLabel.Standard (cp); - - mktParams.setFXState ( - ScenarioFXCurveBuilder.CubicPolynomialCurve ( - fxLabel.fullyQualifiedName(), - dtValue, - cp, - new String[] {"10Y"}, - new double[] {dblRefDerFX}, - dblRefDerFX - ) - ); - - mktParams.setFixing ( - aCCSP[0].effective(), - fxLabel, - dblRefDerFX - ); - - ValuationParams valParams = new ValuationParams ( - dtValue, - dtValue, - strReferenceCurrency - ); - - LinearLatentStateCalibrator llsc = new LinearLatentStateCalibrator ( - scbc, - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - LatentStateStretchSpec stretchSpec = LatentStateStretchBuilder.ComponentPairDiscountStretch ( - "FIXFLOAT", - aCCSP, - valParams, - mktParams, - adblCrossCurrencyBasis, - adblSwapRate, - bBasisOnDerivedLeg - ); - - MergedDiscountForwardCurve dcDerived = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strDerivedCurrency, - llsc, - new LatentStateStretchSpec[] {stretchSpec}, - valParams, - null, - null, - null, - 1. - ); - - mktParams.setFundingState (dcDerived); - - System.out.println ("\t----------------------------------------------------------------"); - - if (bBasisOnDerivedLeg) - System.out.println ("\t IRS INSTRUMENTS QUOTE REVISION FROM CCBS DERIVED BASIS INPUTS"); - else - System.out.println ("\t IRS INSTRUMENTS QUOTE REVISION FROM CCBS REFERENCE BASIS INPUTS"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aCCSP.length; ++i) { - CalibratableComponent rcDerived = aCCSP[i].derivedComponent(); - - CaseInsensitiveTreeMap mapOP = aCCSP[i].value ( - valParams, - null, - mktParams, - null - ); - - double dblCalibSwapRate = mapOP.get (rcDerived.name() + "[SwapRate]"); - - System.out.println ("\t[" + rcDerived.effectiveDate() + " - " + rcDerived.maturityDate() + "] = " + - FormatUtil.FormatDouble (dblCalibSwapRate, 1, 3, 100.) + - "% | " + FormatUtil.FormatDouble (adblSwapRate[i], 1, 3, 100.) + "% | " + - FormatUtil.FormatDouble (adblSwapRate[i] - dblCalibSwapRate, 2, 0, 10000.) + " | " + - FormatUtil.FormatDouble (dcDerived.df (rcDerived.maturityDate()), 1, 4, 1.)); - } - - System.out.println ("\t----------------------------------------------------------------------"); - - if (bBasisOnDerivedLeg) - System.out.println ("\t CCBS DERIVED BASIS TENOR JACOBIAN"); - else - System.out.println ("\t CCBS REFERENCE BASIS TENOR JACOBIAN"); - - System.out.println ("\t----------------------------------------------------------------------"); - - for (int i = 0; i < aCCSP.length; ++i) - TenorJack ( - dtValue, - astrTenor[i], - "PV", - dcDerived - ); - } -} diff --git a/org/drip/sample/dual/CCBSForwardCurve.java b/org/drip/sample/dual/CCBSForwardCurve.java deleted file mode 100644 index 120efe0..0000000 --- a/org/drip/sample/dual/CCBSForwardCurve.java +++ /dev/null @@ -1,392 +0,0 @@ - -package org.drip.sample.dual; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.analytics.support.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.fx.*; -import org.drip.product.params.*; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.sample.forward.IBORCurve; -import org.drip.spline.params.SegmentCustomBuilderControl; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioFXCurveBuilder; -import org.drip.state.creator.ScenarioForwardCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * CCBSForwardCurve demonstrates the setup and construction of the Forward Curve from the CCBS Quotes. - * - * @author Lakshmi Krishnamurthy - */ - -public class CCBSForwardCurve { - - /* - * Construct an array of float-float swaps from the corresponding reference (6M) and the derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FloatFloatComponent[] MakexM6MBasisSwap ( - final JulianDate dtEffective, - final String strPayCurrency, - final String strCouponCurrency, - final double dblNotional, - final String[] astrMaturityTenor, - final int iTenorInMonths) - throws Exception - { - FloatFloatComponent[] aFFC = new FloatFloatComponent[astrMaturityTenor.length]; - - ComposableFloatingUnitSetting cfusReference = new ComposableFloatingUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCouponCurrency, - "6M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFloatingUnitSetting cfusDerived = new ComposableFloatingUnitSetting ( - iTenorInMonths + "M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCouponCurrency, - iTenorInMonths + "M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cpsReference = new CompositePeriodSetting ( - 2, - "6M", - strPayCurrency, - null, - -1. * dblNotional, - null, - null, - strPayCurrency.equalsIgnoreCase (strCouponCurrency) ? null : - new FixingSetting ( - FixingSetting.FIXING_PRESET_STATIC, - null, - dtEffective.julian() - ), - null - ); - - CompositePeriodSetting cpsDerived = new CompositePeriodSetting ( - 12 / iTenorInMonths, - iTenorInMonths + "M", - strPayCurrency, - null, - 1. * dblNotional, - null, - null, - strPayCurrency.equalsIgnoreCase (strCouponCurrency) ? null : - new FixingSetting ( - FixingSetting.FIXING_PRESET_STATIC, - null, - dtEffective.julian() - ), - null - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - List lsReferenceStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - astrMaturityTenor[i], - null - ); - - List lsDerivedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - iTenorInMonths + "M", - astrMaturityTenor[i], - null - ); - - Stream referenceStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsReferenceStreamEdgeDate, - cpsReference, - cfusReference - ) - ); - - Stream derivedStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsDerivedStreamEdgeDate, - cpsDerived, - cfusDerived - ) - ); - - /* - * The float-float swap instance - */ - - aFFC[i] = new FloatFloatComponent ( - referenceStream, - derivedStream, - new CashSettleParams ( - 0, - strPayCurrency, - 0 - ) - ); - - aFFC[i].setPrimaryCode (referenceStream.name() + "||" + derivedStream.name()); - } - - return aFFC; - } - - private static final ComponentPair[] MakeCCSP ( - final JulianDate dtValue, - final String strReferenceCurrency, - final String strDerivedCurrency, - final String[] astrTenor, - final int iTenorInMonths, - final double dblRefDerFX) - throws Exception - { - FloatFloatComponent[] aFFCReference = MakexM6MBasisSwap ( - dtValue, - strDerivedCurrency, - strReferenceCurrency, - -1., - astrTenor, - 3 - ); - - FloatFloatComponent[] aFFCDerived = MakexM6MBasisSwap ( - dtValue, - strDerivedCurrency, - strDerivedCurrency, - 1. / dblRefDerFX, - astrTenor, - 3 - ); - - ComponentPair[] aCCSP = new ComponentPair[astrTenor.length]; - - for (int i = 0; i < aCCSP.length; ++i) - aCCSP[i] = new ComponentPair ( - strDerivedCurrency + strReferenceCurrency + "_" + astrTenor[i], - aFFCReference[i], - aFFCDerived[i], - null - ); - - return aCCSP; - } - - public static final void ForwardCurveReferenceComponentBasis ( - final String strReferenceCurrency, - final String strDerivedCurrency, - final JulianDate dtValue, - final MergedDiscountForwardCurve dcReference, - final ForwardCurve fc6MReference, - final ForwardCurve fc3MReference, - final MergedDiscountForwardCurve dcDerived, - final ForwardCurve fc6MDerived, - final double dblRefDerFX, - final SegmentCustomBuilderControl scbc, - final String[] astrTenor, - final double[] adblCrossCurrencyBasis, - final boolean bBasisOnDerivedLeg) - throws Exception - { - ComponentPair[] aCCSP = MakeCCSP ( - dtValue, - strReferenceCurrency, - strDerivedCurrency, - astrTenor, - 3, - dblRefDerFX - ); - - CurveSurfaceQuoteContainer mktParams = new CurveSurfaceQuoteContainer(); - - mktParams.setFundingState (dcReference); - - mktParams.setFundingState (dcDerived); - - mktParams.setForwardState (fc3MReference); - - mktParams.setForwardState (fc6MReference); - - mktParams.setForwardState (fc6MDerived); - - CurrencyPair cp = CurrencyPair.FromCode (strDerivedCurrency + "/" + strReferenceCurrency); - - FXLabel fxLabelBase = FXLabel.Standard (cp); - - mktParams.setFXState ( - ScenarioFXCurveBuilder.CubicPolynomialCurve ( - fxLabelBase.fullyQualifiedName(), - dtValue, - cp, - new String[] {"10Y"}, - new double[] {dblRefDerFX}, - dblRefDerFX - ) - ); - - mktParams.setFixing ( - aCCSP[0].effective(), - fxLabelBase, - dblRefDerFX - ); - - ValuationParams valParams = new ValuationParams ( - dtValue, - dtValue, - strReferenceCurrency - ); - - LinearLatentStateCalibrator llsc = new LinearLatentStateCalibrator ( - scbc, - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - LatentStateStretchSpec stretchSpec = LatentStateStretchBuilder.ComponentPairForwardStretch ( - "FLOATFLOAT", - aCCSP, - valParams, - mktParams, - adblCrossCurrencyBasis, - false, - bBasisOnDerivedLeg - ); - - ForwardCurve fc3MDerived = ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - llsc, - new LatentStateStretchSpec[] {stretchSpec}, - ForwardLabel.Create ( - strDerivedCurrency, - "3M" - ), - valParams, - null, - MarketParamsBuilder.Create ( - dcDerived, - fc6MDerived, - null, - null, - null, - null, - null, - null - ), - null, - dcDerived.forward ( - dtValue.julian(), - dtValue.addTenor ("3M").julian() - ) - ); - - mktParams.setForwardState (fc3MDerived); - - System.out.println ("\t----------------------------------------------------------------"); - - if (bBasisOnDerivedLeg) - System.out.println ("\t RECOVERY OF THE CCBS REFERENCE COMPONENT DERIVED BASIS"); - else - System.out.println ("\t RECOVERY OF THE CCBS REFERENCE COMPONENT REFERENCE BASIS"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aCCSP.length; ++i) { - CalibratableComponent rc = aCCSP[i].derivedComponent(); - - CaseInsensitiveTreeMap mapOP = aCCSP[i].value ( - valParams, - null, - mktParams, - null - ); - - System.out.println ("\t[" + rc.effectiveDate() + " - " + rc.maturityDate() + "] = " + - FormatUtil.FormatDouble (mapOP.get (bBasisOnDerivedLeg ? "ReferenceCompDerivedBasis" : "ReferenceCompReferenceBasis"), 1, 3, 1.) + - " | " + FormatUtil.FormatDouble (adblCrossCurrencyBasis[i], 1, 3, 10000.) + " | " + - FormatUtil.FormatDouble (fc3MDerived.forward (rc.maturityDate()), 1, 4, 100.) + "%"); - } - - IBORCurve.ForwardJack ( - dtValue, - "---- CCBS DERIVED QUOTE FORWARD CURVE SENSITIVITY ---", - fc3MDerived, - "PV" - ); - } -} diff --git a/org/drip/sample/dual/CHF3M6MUSD3M6M.java b/org/drip/sample/dual/CHF3M6MUSD3M6M.java deleted file mode 100644 index 86e7d02..0000000 --- a/org/drip/sample/dual/CHF3M6MUSD3M6M.java +++ /dev/null @@ -1,801 +0,0 @@ - -package org.drip.sample.dual; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.sample.forward.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * CHF3M6MUSD3M6M demonstrates the setup and construction of the USD 3M Forward Curve from CHF3M6MUSD3M6M - * CCBS, CHF 3M, CHF 6M, and USD 6M Quotes. - * - * @author Lakshmi Krishnamurthy - */ - -public class CHF3M6MUSD3M6M { - private static final double _dblFXCHFUSD = 1.1121; - - private static final int[] s_aiUSDOISDepositMaturityDays = new int[] { - 1, - 2, - 3 - }; - - private static final int[] s_aiCHFOISDepositMaturityDays = new int[] { - 1, - 2, - 3 - }; - - private static final double[] s_adblUSDOISDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - private static final double[] s_adblCHFOISDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - private static final String[] s_astrUSDShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - private static final String[] s_astrCHFShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - private static final double[] s_adblUSDShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - private static final double[] s_adblCHFShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - private static final String[] s_astrUSDOISFutureTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - private static final String[] s_astrCHFOISFutureTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - private static final String[] s_astrUSDOISFutureMaturityTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final String[] s_astrCHFOISFutureMaturityTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblUSDOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - private static final double[] s_adblCHFOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - private static final String[] s_astrUSDLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final String[] s_astrCHFLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblUSDLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - private static final double[] s_adblCHFLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - private static final String[] s_astrUSD6MDepositTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final String[] s_astrCHF6MDepositTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblUSD6MDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - private static final double[] s_adblCHF6MDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - private static final String[] s_astrUSD6MFRATenor = new String[] { - "0D", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - private static final String[] s_astrCHF6MFRATenor = new String[] { - "0D", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - private static final double[] s_adblUSD6MFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - private static final double[] s_adblCHF6MFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - private static final String[] s_astrUSD6MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final String[] s_astrCHF6MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblUSD6MFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - private static final double[] s_adblCHF6MFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - private static final String[] s_astrUSD3MDepositTenor = new String[] { - "2W", - "3W", - "1M", - "2M" - }; - - private static final double[] s_adblUSD3MDepositQuote = new double[] { - 0.001865, - 0.001969, - 0.001951, - 0.001874 - }; - - private static final String[] s_astrUSD3MFRATenor = new String[] { - "0D", - "1M", - "3M", - "6M", - "9M", - "12M", - "15M", - "18M", - "21M" - }; - - private static final double[] s_adblUSD3MFRAQuote = new double[] { - 0.001790, - 0.001775, - 0.001274, - 0.001222, - 0.001269, - 0.001565, - 0.001961, - 0.002556, - 0.003101 - }; - - private static final String[] s_astrUSD3MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblUSD3MFixFloatQuote = new double[] { - 0.002850, // 3Y - 0.004370, // 4Y - 0.006230, // 5Y - 0.008170, // 6Y - 0.010000, // 7Y - 0.011710, // 8Y - 0.013240, // 9Y - 0.014590, // 10Y - 0.016920, // 12Y - 0.019330, // 15Y - 0.020990, // 20Y - 0.021560, // 25Y - 0.021860 // 30Y - }; - - private static final String[] s_astrUSD3MSyntheticFloatFloatTenor = new String[] { - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblUSD3MSyntheticFloatFloatQuote = new double[] { - 0.00065, - 0.00060, - 0.00054, - 0.00050 - }; - - private static final String[] s_astrCCBSTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "15Y", - "20Y" - }; - - private static final double[] s_adblCCBSQuote = new double[] { - -0.0000000, // 1Y - -0.0000500, // 2Y - -0.0001375, // 3Y - -0.0002250, // 4Y - -0.0002750, // 5Y - -0.0003000, // 7Y - -0.0003000, // 10Y - -0.0002750, // 15Y - -0.0002250 // 20Y - }; - - private static final double[] s_adblIRSQuote = new double[] { - 0.00500, // 1Y - 0.00500, // 2Y - 0.01375, // 3Y - 0.02250, // 4Y - 0.02750, // 5Y - 0.03000, // 7Y - 0.03000, // 10Y - 0.02750, // 15Y - 0.02250 // 20Y - }; - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtValue = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - String strReferenceCurrency = "USD"; - String strDerivedCurrency = "CHF"; - - SegmentCustomBuilderControl scbcCubic = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - MergedDiscountForwardCurve dcReference = OvernightIndexCurve.MakeDC ( - strReferenceCurrency, - dtValue, - s_aiUSDOISDepositMaturityDays, - s_adblUSDOISDepositQuote, - s_astrUSDShortEndOISMaturityTenor, - s_adblUSDShortEndOISQuote, - s_astrUSDOISFutureTenor, - s_astrUSDOISFutureMaturityTenor, - s_adblUSDOISFutureQuote, - s_astrUSDLongEndOISMaturityTenor, - s_adblUSDLongEndOISQuote, - scbcCubic, - null - ); - - ForwardCurve fc6MReference = IBORCurve.CustomIBORBuilderSample ( - dcReference, - null, - ForwardLabel.Create ( - strReferenceCurrency, - "6M" - ), - scbcCubic, - s_astrUSD6MDepositTenor, - s_adblUSD6MDepositQuote, - "ForwardRate", - s_astrUSD6MFRATenor, - s_adblUSD6MFRAQuote, - "ParForwardRate", - s_astrUSD6MFixFloatTenor, - s_adblUSD6MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - "---- USD LIBOR 6M VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - ForwardCurve fc3MReference = IBORCurve.CustomIBORBuilderSample ( - dcReference, - fc6MReference, - ForwardLabel.Create ( - strReferenceCurrency, - "3M" - ), - scbcCubic, - s_astrUSD3MDepositTenor, - s_adblUSD3MDepositQuote, - "ForwardRate", - s_astrUSD3MFRATenor, - s_adblUSD3MFRAQuote, - "ParForwardRate", - s_astrUSD3MFixFloatTenor, - s_adblUSD3MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - s_astrUSD3MSyntheticFloatFloatTenor, - s_adblUSD3MSyntheticFloatFloatQuote, - "DerivedParBasisSpread", - "---- VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - MergedDiscountForwardCurve dcDerived = OvernightIndexCurve.MakeDC ( - strDerivedCurrency, - dtValue, - s_aiCHFOISDepositMaturityDays, - s_adblCHFOISDepositQuote, - s_astrCHFShortEndOISMaturityTenor, - s_adblCHFShortEndOISQuote, - s_astrCHFOISFutureTenor, - s_astrCHFOISFutureMaturityTenor, - s_adblCHFOISFutureQuote, - s_astrCHFLongEndOISMaturityTenor, - s_adblCHFLongEndOISQuote, - scbcCubic, - null - ); - - ForwardCurve fc6MDerived = IBORCurve.CustomIBORBuilderSample ( - dcDerived, - null, - ForwardLabel.Create ( - strDerivedCurrency, - "6M" - ), - scbcCubic, - s_astrCHF6MDepositTenor, - s_adblCHF6MDepositQuote, - "ForwardRate", - s_astrCHF6MFRATenor, - s_adblCHF6MFRAQuote, - "ParForwardRate", - s_astrCHF6MFixFloatTenor, - s_adblCHF6MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - "---- CHF LIBOR 6M VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - CCBSForwardCurve.ForwardCurveReferenceComponentBasis ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - dcDerived, - fc6MDerived, - _dblFXCHFUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - true - ); - - CCBSForwardCurve.ForwardCurveReferenceComponentBasis ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - dcDerived, - fc6MDerived, - _dblFXCHFUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - false - ); - - CCBSDiscountCurve.MakeDiscountCurve ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - _dblFXCHFUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - s_adblIRSQuote, - true - ); - - CCBSDiscountCurve.MakeDiscountCurve ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - _dblFXCHFUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - s_adblIRSQuote, - false - ); - } -} diff --git a/org/drip/sample/dual/DKK3M6MUSD3M6M.java b/org/drip/sample/dual/DKK3M6MUSD3M6M.java deleted file mode 100644 index 9917e1b..0000000 --- a/org/drip/sample/dual/DKK3M6MUSD3M6M.java +++ /dev/null @@ -1,801 +0,0 @@ - -package org.drip.sample.dual; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.sample.forward.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * DKK3M6MUSD3M6M demonstrates the setup and construction of the USD 3M Forward Curve from DKK3M6MUSD3M6M - * CCBS, DKK 3M, DKK 6M, and USD 6M Quotes. - * - * @author Lakshmi Krishnamurthy - */ - -public class DKK3M6MUSD3M6M { - private static final double _dblFXDKKUSD = 0.1816; - - private static final int[] s_aiUSDOISDepositMaturityDays = new int[] { - 1, - 2, - 3 - }; - - private static final double[] s_adblUSDOISDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - private static final String[] s_astrUSDShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - private static final double[] s_adblUSDShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - private static final String[] s_astrUSDOISFutureTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - private static final String[] s_astrUSDOISFutureMaturityTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblUSDOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - private static final String[] s_astrUSDLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblUSDLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - private static final int[] s_aiDKKOISDepositMaturityDays = new int[] { - 1, - 2, - 3 - }; - - private static final double[] s_adblDKKOISDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - private static final String[] s_astrDKKShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - private static final double[] s_adblDKKShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - private static final String[] s_astrDKKOISFutureTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - private static final String[] s_astrDKKOISFutureMaturityTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblDKKOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - private static final String[] s_astrDKKLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblDKKLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - private static final String[] s_astrUSD6MDepositTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblUSD6MDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - private static final String[] s_astrUSD6MFRATenor = new String[] { - "0D", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - private static final double[] s_adblUSD6MFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - private static final String[] s_astrUSD6MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblUSD6MFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - private static final String[] s_astrUSD3MDepositTenor = new String[] { - "2W", - "3W", - "1M", - "2M" - }; - - private static final double[] s_adblUSD3MDepositQuote = new double[] { - 0.001865, - 0.001969, - 0.001951, - 0.001874 - }; - - private static final String[] s_astrUSD3MFRATenor = new String[] { - "0D", - "1M", - "3M", - "6M", - "9M", - "12M", - "15M", - "18M", - "21M" - }; - - private static final double[] s_adblUSD3MFRAQuote = new double[] { - 0.001790, - 0.001775, - 0.001274, - 0.001222, - 0.001269, - 0.001565, - 0.001961, - 0.002556, - 0.003101 - }; - - private static final String[] s_astrUSD3MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblUSD3MFixFloatQuote = new double[] { - 0.002850, // 3Y - 0.004370, // 4Y - 0.006230, // 5Y - 0.008170, // 6Y - 0.010000, // 7Y - 0.011710, // 8Y - 0.013240, // 9Y - 0.014590, // 10Y - 0.016920, // 12Y - 0.019330, // 15Y - 0.020990, // 20Y - 0.021560, // 25Y - 0.021860 // 30Y - }; - - private static final String[] s_astrUSD3MSyntheticFloatFloatTenor = new String[] { - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblUSD3MSyntheticFloatFloatQuote = new double[] { - 0.00065, - 0.00060, - 0.00054, - 0.00050 - }; - - private static final String[] s_astrDKK6MDepositTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblDKK6MDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - private static final String[] s_astrDKK6MFRATenor = new String[] { - "0D", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - private static final double[] s_adblDKK6MFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - private static final String[] s_astrDKK6MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblDKK6MFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - private static final String[] s_astrCCBSTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "15Y", - "20Y" - }; - - private static final double[] s_adblCCBSQuote = new double[] { - -0.0003000, // 1Y - -0.0003000, // 2Y - -0.0002750, // 3Y - -0.0002500, // 4Y - -0.0001750, // 5Y - -0.0001375, // 7Y - -0.0001375, // 10Y - -0.0001250, // 15Y - -0.0001250 // 20Y - }; - - private static final double[] s_adblIRSQuote = new double[] { - 0.01250, // 1Y - 0.01250, // 2Y - 0.01375, // 3Y - 0.01375, // 4Y - 0.01750, // 5Y - 0.02500, // 7Y - 0.02750, // 10Y - 0.03000, // 15Y - 0.03000 // 20Y - }; - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtValue = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - String strReferenceCurrency = "USD"; - String strDerivedCurrency = "DKK"; - - SegmentCustomBuilderControl scbcCubic = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - MergedDiscountForwardCurve dcReference = OvernightIndexCurve.MakeDC ( - strReferenceCurrency, - dtValue, - s_aiUSDOISDepositMaturityDays, - s_adblUSDOISDepositQuote, - s_astrUSDShortEndOISMaturityTenor, - s_adblUSDShortEndOISQuote, - s_astrUSDOISFutureTenor, - s_astrUSDOISFutureMaturityTenor, - s_adblUSDOISFutureQuote, - s_astrUSDLongEndOISMaturityTenor, - s_adblUSDLongEndOISQuote, - scbcCubic, - null - ); - - ForwardCurve fc6MReference = IBORCurve.CustomIBORBuilderSample ( - dcReference, - null, - ForwardLabel.Create ( - strReferenceCurrency, - "6M" - ), - scbcCubic, - s_astrUSD6MDepositTenor, - s_adblUSD6MDepositQuote, - "ForwardRate", - s_astrUSD6MFRATenor, - s_adblUSD6MFRAQuote, - "ParForwardRate", - s_astrUSD6MFixFloatTenor, - s_adblUSD6MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - "---- USD LIBOR 6M VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - ForwardCurve fc3MReference = IBORCurve.CustomIBORBuilderSample ( - dcReference, - fc6MReference, - ForwardLabel.Create ( - strReferenceCurrency, - "3M" - ), - scbcCubic, - s_astrUSD3MDepositTenor, - s_adblUSD3MDepositQuote, - "ForwardRate", - s_astrUSD3MFRATenor, - s_adblUSD3MFRAQuote, - "ParForwardRate", - s_astrUSD3MFixFloatTenor, - s_adblUSD3MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - s_astrUSD3MSyntheticFloatFloatTenor, - s_adblUSD3MSyntheticFloatFloatQuote, - "DerivedParBasisSpread", - "---- VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - MergedDiscountForwardCurve dcDerived = OvernightIndexCurve.MakeDC ( - strDerivedCurrency, - dtValue, - s_aiDKKOISDepositMaturityDays, - s_adblDKKOISDepositQuote, - s_astrDKKShortEndOISMaturityTenor, - s_adblDKKShortEndOISQuote, - s_astrDKKOISFutureTenor, - s_astrDKKOISFutureMaturityTenor, - s_adblDKKOISFutureQuote, - s_astrDKKLongEndOISMaturityTenor, - s_adblDKKLongEndOISQuote, - scbcCubic, - null - ); - - ForwardCurve fc6MDerived = IBORCurve.CustomIBORBuilderSample ( - dcDerived, - null, - ForwardLabel.Create ( - strDerivedCurrency, - "6M" - ), - scbcCubic, - s_astrDKK6MDepositTenor, - s_adblDKK6MDepositQuote, - "ForwardRate", - s_astrDKK6MFRATenor, - s_adblDKK6MFRAQuote, - "ParForwardRate", - s_astrDKK6MFixFloatTenor, - s_adblDKK6MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - "---- DKK LIBOR 6M VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - CCBSForwardCurve.ForwardCurveReferenceComponentBasis ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - dcDerived, - fc6MDerived, - _dblFXDKKUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - true - ); - - CCBSForwardCurve.ForwardCurveReferenceComponentBasis ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - dcDerived, - fc6MDerived, - _dblFXDKKUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - false - ); - - CCBSDiscountCurve.MakeDiscountCurve ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - _dblFXDKKUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - s_adblIRSQuote, - true - ); - - CCBSDiscountCurve.MakeDiscountCurve ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - _dblFXDKKUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - s_adblIRSQuote, - false - ); - } -} diff --git a/org/drip/sample/dual/EUR3M6MUSD3M6M.java b/org/drip/sample/dual/EUR3M6MUSD3M6M.java deleted file mode 100644 index bd53be0..0000000 --- a/org/drip/sample/dual/EUR3M6MUSD3M6M.java +++ /dev/null @@ -1,804 +0,0 @@ - -package org.drip.sample.dual; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.sample.forward.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * EUR3M6MUSD3M6M demonstrates the setup and construction of the USD 3M Forward Curve from EUR3M6MUSD3M6M - * CCBS, EUR 3M, EUR 6M, and USD 6M Quotes. - * - * @author Lakshmi Krishnamurthy - */ - -public class EUR3M6MUSD3M6M { - private static final double _dblFXEURUSD = 1.3593; - - private static final int[] s_aiUSDOISDepositMaturityDays = new int[] { - 1, - 2, - 3 - }; - - private static final double[] s_adblUSDOISDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - private static final String[] s_astrUSDShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - private static final double[] s_adblUSDShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - private static final String[] s_astrUSDOISFutureTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - private static final String[] s_astrUSDOISFutureMaturityTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblUSDOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - private static final String[] s_astrUSDLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblUSDLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - private static final int[] s_aiEONIADepositMaturityDays = new int[] { - 1, - 2, - 3 - }; - - private static final double[] s_adblEONIADepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - private static final String[] s_astrEURShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - private static final double[] s_adblEURShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - private static final String[] s_astrEUROISFutureTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - private static final String[] s_astrEUROISFutureMaturityTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblEUROISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - private static final String[] s_astrEURLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblEURLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - private static final String[] s_astrUSD6MDepositTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblUSD6MDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - private static final String[] s_astrUSD6MFRATenor = new String[] { - "0D", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - private static final double[] s_adblUSD6MFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - private static final String[] s_astrUSD6MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblUSD6MFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - private static final String[] s_astrUSD3MDepositTenor = new String[] { - "2W", - "3W", - "1M", - "2M" - }; - - private static final double[] s_adblUSD3MDepositQuote = new double[] { - 0.001865, - 0.001969, - 0.001951, - 0.001874 - }; - - private static final String[] s_astrUSD3MFRATenor = new String[] { - "0D", - "1M", - "3M", - "6M", - "9M", - "12M", - "15M", - "18M", - "21M" - }; - - private static final double[] s_adblUSD3MFRAQuote = new double[] { - 0.001790, - 0.001775, - 0.001274, - 0.001222, - 0.001269, - 0.001565, - 0.001961, - 0.002556, - 0.003101 - }; - - private static final String[] s_astrUSD3MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblUSD3MFixFloatQuote = new double[] { - 0.002850, // 3Y - 0.004370, // 4Y - 0.006230, // 5Y - 0.008170, // 6Y - 0.010000, // 7Y - 0.011710, // 8Y - 0.013240, // 9Y - 0.014590, // 10Y - 0.016920, // 12Y - 0.019330, // 15Y - 0.020990, // 20Y - 0.021560, // 25Y - 0.021860 // 30Y - }; - - private static final String[] s_astrUSD3MSyntheticFloatFloatTenor = new String[] { - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblUSD3MSyntheticFloatFloatQuote = new double[] { - 0.00065, - 0.00060, - 0.00054, - 0.00050 - }; - - private static final String[] s_astrEUR6MDepositTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblEUR6MDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - private static final String[] s_astrEUR6MFRATenor = new String[] { - "0D", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - private static final double[] s_adblEUR6MFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - private static final String[] s_astrEUR6MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblEUR6MFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - private static final String[] s_astrCCBSTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "15Y", - "20Y", - "30Y" - }; - - private static final double[] s_adblCCBSQuote = new double[] { - 0.0002125, // 1Y - 0.0002000, // 2Y - 0.0002000, // 3Y - 0.0002000, // 4Y - 0.0001750, // 5Y - 0.0001750, // 7Y - 0.0001750, // 10Y - 0.0002125, // 15Y - 0.0002125, // 20Y - 0.0002125 // 30Y - }; - - private static final double[] s_adblIRSQuote = new double[] { - 0.01750, // 1Y - 0.01750, // 2Y - 0.01750, // 3Y - 0.02000, // 4Y - 0.02000, // 5Y - 0.02000, // 7Y - 0.02125, // 10Y - 0.02125, // 15Y - 0.02125, // 20Y - 0.02125 // 30Y - }; - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtValue = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - String strReferenceCurrency = "USD"; - String strDerivedCurrency = "EUR"; - - SegmentCustomBuilderControl scbcCubic = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - MergedDiscountForwardCurve dcReference = OvernightIndexCurve.MakeDC ( - strReferenceCurrency, - dtValue, - s_aiUSDOISDepositMaturityDays, - s_adblUSDOISDepositQuote, - s_astrUSDShortEndOISMaturityTenor, - s_adblUSDShortEndOISQuote, - s_astrUSDOISFutureTenor, - s_astrUSDOISFutureMaturityTenor, - s_adblUSDOISFutureQuote, - s_astrUSDLongEndOISMaturityTenor, - s_adblUSDLongEndOISQuote, - scbcCubic, - null - ); - - ForwardCurve fc6MReference = IBORCurve.CustomIBORBuilderSample ( - dcReference, - null, - ForwardLabel.Create ( - strReferenceCurrency, - "6M" - ), - scbcCubic, - s_astrUSD6MDepositTenor, - s_adblUSD6MDepositQuote, - "ForwardRate", - s_astrUSD6MFRATenor, - s_adblUSD6MFRAQuote, - "ParForwardRate", - s_astrUSD6MFixFloatTenor, - s_adblUSD6MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - "---- USD LIBOR 6M VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - ForwardCurve fc3MReference = IBORCurve.CustomIBORBuilderSample ( - dcReference, - fc6MReference, - ForwardLabel.Create ( - strReferenceCurrency, - "3M" - ), - scbcCubic, - s_astrUSD3MDepositTenor, - s_adblUSD3MDepositQuote, - "ForwardRate", - s_astrUSD3MFRATenor, - s_adblUSD3MFRAQuote, - "ParForwardRate", - s_astrUSD3MFixFloatTenor, - s_adblUSD3MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - s_astrUSD3MSyntheticFloatFloatTenor, - s_adblUSD3MSyntheticFloatFloatQuote, - "DerivedParBasisSpread", - "---- VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - MergedDiscountForwardCurve dcDerived = OvernightIndexCurve.MakeDC ( - strDerivedCurrency, - dtValue, - s_aiEONIADepositMaturityDays, - s_adblEONIADepositQuote, - s_astrEURShortEndOISMaturityTenor, - s_adblEURShortEndOISQuote, - s_astrEUROISFutureTenor, - s_astrEUROISFutureMaturityTenor, - s_adblEUROISFutureQuote, - s_astrEURLongEndOISMaturityTenor, - s_adblEURLongEndOISQuote, - scbcCubic, - null - ); - - ForwardCurve fc6MDerived = IBORCurve.CustomIBORBuilderSample ( - dcDerived, - null, - ForwardLabel.Create ( - strDerivedCurrency, - "6M" - ), - scbcCubic, - s_astrEUR6MDepositTenor, - s_adblEUR6MDepositQuote, - "ForwardRate", - s_astrEUR6MFRATenor, - s_adblEUR6MFRAQuote, - "ParForwardRate", - s_astrEUR6MFixFloatTenor, - s_adblEUR6MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - "---- EURIBOR 6M VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - CCBSForwardCurve.ForwardCurveReferenceComponentBasis ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - dcDerived, - fc6MDerived, - _dblFXEURUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - true - ); - - CCBSForwardCurve.ForwardCurveReferenceComponentBasis ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - dcDerived, - fc6MDerived, - _dblFXEURUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - false - ); - - CCBSDiscountCurve.MakeDiscountCurve ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - _dblFXEURUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - s_adblIRSQuote, - true - ); - - CCBSDiscountCurve.MakeDiscountCurve ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - _dblFXEURUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - s_adblIRSQuote, - false - ); - } -} diff --git a/org/drip/sample/dual/GBP3M6MUSD3M6M.java b/org/drip/sample/dual/GBP3M6MUSD3M6M.java deleted file mode 100644 index 3bb9a18..0000000 --- a/org/drip/sample/dual/GBP3M6MUSD3M6M.java +++ /dev/null @@ -1,804 +0,0 @@ - -package org.drip.sample.dual; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.sample.forward.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * GBP3M6MUSD3M6M demonstrates the setup and construction of the USD 3M Forward Curve from GBP3M6MUSD3M6M - * CCBS, GBP 3M, GBP 6M, and USD 6M Quotes. - * - * @author Lakshmi Krishnamurthy - */ - -public class GBP3M6MUSD3M6M { - private static final double _dblFXGBPUSD = 1.6786; - - private static final int[] s_aiUSDOISDepositMaturityDays = new int[] { - 1, - 2, - 3 - }; - - private static final double[] s_adblUSDOISDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - private static final String[] s_astrUSDShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - private static final double[] s_adblUSDShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - private static final String[] s_astrUSDOISFutureTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - private static final String[] s_astrUSDOISFutureMaturityTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblUSDOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - private static final String[] s_astrUSDLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblUSDLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - private static final int[] s_aiSONIADepositMaturityDays = new int[] { - 1, - 2, - 3 - }; - - private static final double[] s_adblSONIADepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - private static final String[] s_astrGBPShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - private static final double[] s_adblGBPShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - private static final String[] s_astrGBPOISFutureTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - private static final String[] s_astrGBPOISFutureMaturityTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblGBPOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - private static final String[] s_astrGBPLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblGBPLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - private static final String[] s_astrUSD6MDepositTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblUSD6MDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - private static final String[] s_astrUSD6MFRATenor = new String[] { - "0D", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - private static final double[] s_adblUSD6MFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - private static final String[] s_astrUSD6MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblUSD6MFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - private static final String[] s_astrUSD3MDepositTenor = new String[] { - "2W", - "3W", - "1M", - "2M" - }; - - private static final double[] s_adblUSD3MDepositQuote = new double[] { - 0.001865, - 0.001969, - 0.001951, - 0.001874 - }; - - private static final String[] s_astrUSD3MFRATenor = new String[] { - "0D", - "1M", - "3M", - "6M", - "9M", - "12M", - "15M", - "18M", - "21M" - }; - - private static final double[] s_adblUSD3MFRAQuote = new double[] { - 0.001790, - 0.001775, - 0.001274, - 0.001222, - 0.001269, - 0.001565, - 0.001961, - 0.002556, - 0.003101 - }; - - private static final String[] s_astrUSD3MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblUSD3MFixFloatQuote = new double[] { - 0.002850, // 3Y - 0.004370, // 4Y - 0.006230, // 5Y - 0.008170, // 6Y - 0.010000, // 7Y - 0.011710, // 8Y - 0.013240, // 9Y - 0.014590, // 10Y - 0.016920, // 12Y - 0.019330, // 15Y - 0.020990, // 20Y - 0.021560, // 25Y - 0.021860 // 30Y - }; - - private static final String[] s_astrUSD3MSyntheticFloatFloatTenor = new String[] { - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblUSD3MSyntheticFloatFloatQuote = new double[] { - 0.00065, - 0.00060, - 0.00054, - 0.00050 - }; - - private static final String[] s_astrGBP6MDepositTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblGBP6MDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - private static final String[] s_astrGBP6MFRATenor = new String[] { - "0D", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - private static final double[] s_adblGBP6MFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - private static final String[] s_astrGBP6MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblGBP6MFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - private static final String[] s_astrCCBSTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "15Y", - "20Y", - "30Y" - }; - - private static final double[] s_adblCCBSQuote = new double[] { - 0.000050, // 1Y - 0.000050, // 2Y - 0.000025, // 3Y - 0.000000, // 4Y - -0.000025, // 5Y - -0.000125, // 7Y - -0.000275, // 10Y - -0.000425, // 15Y - -0.000450, // 20Y - -0.000450 // 30Y - }; - - private static final double[] s_adblIRSQuote = new double[] { - 0.0025, // 1Y - 0.0025, // 2Y - 0.0025, // 3Y - 0.0050, // 4Y - 0.0050, // 5Y - 0.0125, // 7Y - 0.0275, // 10Y - 0.0425, // 15Y - 0.0450, // 20Y - 0.0450 // 30Y - }; - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtValue = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - String strReferenceCurrency = "USD"; - String strDerivedCurrency = "GBP"; - - SegmentCustomBuilderControl scbcCubic = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - MergedDiscountForwardCurve dcReference = OvernightIndexCurve.MakeDC ( - strReferenceCurrency, - dtValue, - s_aiUSDOISDepositMaturityDays, - s_adblUSDOISDepositQuote, - s_astrUSDShortEndOISMaturityTenor, - s_adblUSDShortEndOISQuote, - s_astrUSDOISFutureTenor, - s_astrUSDOISFutureMaturityTenor, - s_adblUSDOISFutureQuote, - s_astrUSDLongEndOISMaturityTenor, - s_adblUSDLongEndOISQuote, - scbcCubic, - null - ); - - ForwardCurve fc6MReference = IBORCurve.CustomIBORBuilderSample ( - dcReference, - null, - ForwardLabel.Create ( - strReferenceCurrency, - "6M" - ), - scbcCubic, - s_astrUSD6MDepositTenor, - s_adblUSD6MDepositQuote, - "ForwardRate", - s_astrUSD6MFRATenor, - s_adblUSD6MFRAQuote, - "ParForwardRate", - s_astrUSD6MFixFloatTenor, - s_adblUSD6MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - "---- USD LIBOR 6M VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - ForwardCurve fc3MReference = IBORCurve.CustomIBORBuilderSample ( - dcReference, - fc6MReference, - ForwardLabel.Create ( - strReferenceCurrency, - "3M" - ), - scbcCubic, - s_astrUSD3MDepositTenor, - s_adblUSD3MDepositQuote, - "ForwardRate", - s_astrUSD3MFRATenor, - s_adblUSD3MFRAQuote, - "ParForwardRate", - s_astrUSD3MFixFloatTenor, - s_adblUSD3MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - s_astrUSD3MSyntheticFloatFloatTenor, - s_adblUSD3MSyntheticFloatFloatQuote, - "DerivedParBasisSpread", - "---- VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - MergedDiscountForwardCurve dcDerived = OvernightIndexCurve.MakeDC ( - strDerivedCurrency, - dtValue, - s_aiSONIADepositMaturityDays, - s_adblSONIADepositQuote, - s_astrGBPShortEndOISMaturityTenor, - s_adblGBPShortEndOISQuote, - s_astrGBPOISFutureTenor, - s_astrGBPOISFutureMaturityTenor, - s_adblGBPOISFutureQuote, - s_astrGBPLongEndOISMaturityTenor, - s_adblGBPLongEndOISQuote, - scbcCubic, - null - ); - - ForwardCurve fc6MDerived = IBORCurve.CustomIBORBuilderSample ( - dcDerived, - null, - ForwardLabel.Create ( - strDerivedCurrency, - "6M" - ), - scbcCubic, - s_astrGBP6MDepositTenor, - s_adblGBP6MDepositQuote, - "ForwardRate", - s_astrGBP6MFRATenor, - s_adblGBP6MFRAQuote, - "ParForwardRate", - s_astrGBP6MFixFloatTenor, - s_adblGBP6MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - "---- GBP LIBOR 6M VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - CCBSForwardCurve.ForwardCurveReferenceComponentBasis ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - dcDerived, - fc6MDerived, - _dblFXGBPUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - true - ); - - CCBSForwardCurve.ForwardCurveReferenceComponentBasis ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - dcDerived, - fc6MDerived, - _dblFXGBPUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - false - ); - - CCBSDiscountCurve.MakeDiscountCurve ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - _dblFXGBPUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - s_adblIRSQuote, - true - ); - - CCBSDiscountCurve.MakeDiscountCurve ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - _dblFXGBPUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - s_adblIRSQuote, - false - ); - } -} diff --git a/org/drip/sample/dual/JPY3M6MUSD3M6M.java b/org/drip/sample/dual/JPY3M6MUSD3M6M.java deleted file mode 100644 index 9f90ff5..0000000 --- a/org/drip/sample/dual/JPY3M6MUSD3M6M.java +++ /dev/null @@ -1,804 +0,0 @@ - -package org.drip.sample.dual; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.sample.forward.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * JPY3M6MUSD3M6M demonstrates the setup and construction of the USD 3M Forward Curve from JPY3M6MUSD3M6M - * CCBS, JPY 3M, JPY 6M, and USD 6M Quotes. - * - * @author Lakshmi Krishnamurthy - */ - -public class JPY3M6MUSD3M6M { - private static final double _dblFXJPYUSD = 0.009753; - - private static final int[] s_aiUSDOISDepositMaturityDays = new int[] { - 1, - 2, - 3 - }; - - private static final double[] s_adblUSDOISDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - private static final String[] s_astrUSDShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - private static final double[] s_adblUSDShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - private static final String[] s_astrUSDOISFutureTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - private static final String[] s_astrUSDOISFutureMaturityTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblUSDOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - private static final String[] s_astrUSDLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblUSDLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - private static final int[] s_aiJPYOISDepositMaturityDays = new int[] { - 1, - 2, - 3 - }; - - private static final double[] s_adblJPYOISDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - private static final String[] s_astrJPYShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - private static final double[] s_adblJPYShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - private static final String[] s_astrJPYOISFutureTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - private static final String[] s_astrJPYOISFutureMaturityTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblJPYOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - private static final String[] s_astrJPYLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblJPYLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - private static final String[] s_astrUSD6MDepositTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblUSD6MDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - private static final String[] s_astrUSD6MFRATenor = new String[] { - "0D", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - private static final double[] s_adblUSD6MFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - private static final String[] s_astrUSD6MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblUSD6MFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - private static final String[] s_astrUSD3MDepositTenor = new String[] { - "2W", - "3W", - "1M", - "2M" - }; - - private static final double[] s_adblUSD3MDepositQuote = new double[] { - 0.001865, - 0.001969, - 0.001951, - 0.001874 - }; - - private static final String[] s_astrUSD3MFRATenor = new String[] { - "0D", - "1M", - "3M", - "6M", - "9M", - "12M", - "15M", - "18M", - "21M" - }; - - private static final double[] s_adblUSD3MFRAQuote = new double[] { - 0.001790, - 0.001775, - 0.001274, - 0.001222, - 0.001269, - 0.001565, - 0.001961, - 0.002556, - 0.003101 - }; - - private static final String[] s_astrUSD3MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblUSD3MFixFloatQuote = new double[] { - 0.002850, // 3Y - 0.004370, // 4Y - 0.006230, // 5Y - 0.008170, // 6Y - 0.010000, // 7Y - 0.011710, // 8Y - 0.013240, // 9Y - 0.014590, // 10Y - 0.016920, // 12Y - 0.019330, // 15Y - 0.020990, // 20Y - 0.021560, // 25Y - 0.021860 // 30Y - }; - - private static final String[] s_astrUSD3MSyntheticFloatFloatTenor = new String[] { - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblUSD3MSyntheticFloatFloatQuote = new double[] { - 0.00065, - 0.00060, - 0.00054, - 0.00050 - }; - - private static final String[] s_astrJPY6MDepositTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblJPY6MDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - private static final String[] s_astrJPY6MFRATenor = new String[] { - "0D", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - private static final double[] s_adblJPY6MFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - private static final String[] s_astrJPY6MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblJPY6MFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - private static final String[] s_astrCCBSTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "15Y", - "20Y", - "30Y" - }; - - private static final double[] s_adblCCBSQuote = new double[] { - -0.000350, // 1Y - -0.000350, // 2Y - -0.000325, // 3Y - -0.000325, // 4Y - -0.000350, // 5Y - -0.000400, // 7Y - -0.000600, // 10Y - -0.001200, // 15Y - -0.001675, // 20Y - -0.002475 // 30Y - }; - - private static final double[] s_adblIRSQuote = new double[] { - 0.00325, // 1Y - 0.00325, // 2Y - 0.00350, // 3Y - 0.00350, // 4Y - 0.00350, // 5Y - 0.00400, // 7Y - 0.00600, // 10Y - 0.01200, // 15Y - 0.01675, // 20Y - 0.02475 // 30Y - }; - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtValue = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - String strReferenceCurrency = "USD"; - String strDerivedCurrency = "JPY"; - - SegmentCustomBuilderControl scbcCubic = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - MergedDiscountForwardCurve dcReference = OvernightIndexCurve.MakeDC ( - strReferenceCurrency, - dtValue, - s_aiUSDOISDepositMaturityDays, - s_adblUSDOISDepositQuote, - s_astrUSDShortEndOISMaturityTenor, - s_adblUSDShortEndOISQuote, - s_astrUSDOISFutureTenor, - s_astrUSDOISFutureMaturityTenor, - s_adblUSDOISFutureQuote, - s_astrUSDLongEndOISMaturityTenor, - s_adblUSDLongEndOISQuote, - scbcCubic, - null - ); - - ForwardCurve fc6MReference = IBORCurve.CustomIBORBuilderSample ( - dcReference, - null, - ForwardLabel.Create ( - strReferenceCurrency, - "6M" - ), - scbcCubic, - s_astrUSD6MDepositTenor, - s_adblUSD6MDepositQuote, - "ForwardRate", - s_astrUSD6MFRATenor, - s_adblUSD6MFRAQuote, - "ParForwardRate", - s_astrUSD6MFixFloatTenor, - s_adblUSD6MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - "---- USD LIBOR 6M VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - ForwardCurve fc3MReference = IBORCurve.CustomIBORBuilderSample ( - dcReference, - fc6MReference, - ForwardLabel.Create ( - strReferenceCurrency, - "3M" - ), - scbcCubic, - s_astrUSD3MDepositTenor, - s_adblUSD3MDepositQuote, - "ForwardRate", - s_astrUSD3MFRATenor, - s_adblUSD3MFRAQuote, - "ParForwardRate", - s_astrUSD3MFixFloatTenor, - s_adblUSD3MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - s_astrUSD3MSyntheticFloatFloatTenor, - s_adblUSD3MSyntheticFloatFloatQuote, - "DerivedParBasisSpread", - "---- VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - MergedDiscountForwardCurve dcDerived = OvernightIndexCurve.MakeDC ( - strDerivedCurrency, - dtValue, - s_aiJPYOISDepositMaturityDays, - s_adblJPYOISDepositQuote, - s_astrJPYShortEndOISMaturityTenor, - s_adblJPYShortEndOISQuote, - s_astrJPYOISFutureTenor, - s_astrJPYOISFutureMaturityTenor, - s_adblJPYOISFutureQuote, - s_astrJPYLongEndOISMaturityTenor, - s_adblJPYLongEndOISQuote, - scbcCubic, - null - ); - - ForwardCurve fc6MDerived = IBORCurve.CustomIBORBuilderSample ( - dcDerived, - null, - ForwardLabel.Create ( - strDerivedCurrency, - "6M" - ), - scbcCubic, - s_astrJPY6MDepositTenor, - s_adblJPY6MDepositQuote, - "ForwardRate", - s_astrJPY6MFRATenor, - s_adblJPY6MFRAQuote, - "ParForwardRate", - s_astrJPY6MFixFloatTenor, - s_adblJPY6MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - "---- JPY LIBOR 6M VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - CCBSForwardCurve.ForwardCurveReferenceComponentBasis ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - dcDerived, - fc6MDerived, - _dblFXJPYUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - true - ); - - CCBSForwardCurve.ForwardCurveReferenceComponentBasis ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - dcDerived, - fc6MDerived, - _dblFXJPYUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - false - ); - - CCBSDiscountCurve.MakeDiscountCurve ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - _dblFXJPYUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - s_adblIRSQuote, - true - ); - - CCBSDiscountCurve.MakeDiscountCurve ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - _dblFXJPYUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - s_adblIRSQuote, - false - ); - } -} diff --git a/org/drip/sample/dual/NOK3M6MUSD3M6M.java b/org/drip/sample/dual/NOK3M6MUSD3M6M.java deleted file mode 100644 index 8e37724..0000000 --- a/org/drip/sample/dual/NOK3M6MUSD3M6M.java +++ /dev/null @@ -1,814 +0,0 @@ - -package org.drip.sample.dual; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.CompositePeriodBuilder; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.market.definition.*; -import org.drip.sample.forward.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * NOK3M6MUSD3M6M demonstrates the setup and construction of the USD 3M Forward Curve from NOK3M6MUSD3M6M - * CCBS, NOK 3M, NOK 6M, and USD 6M Quotes. - * - * @author Lakshmi Krishnamurthy - */ - -public class NOK3M6MUSD3M6M { - private static final double _dblFXNOKUSD = 0.1676; - - private static final int[] s_aiUSDOISDepositMaturityDays = new int[] { - 1, - 2, - 3 - }; - - private static final double[] s_adblUSDOISDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - private static final String[] s_astrUSDShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - private static final double[] s_adblUSDShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - private static final String[] s_astrUSDOISFutureTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - private static final String[] s_astrUSDOISFutureMaturityTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblUSDOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - private static final String[] s_astrUSDLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblUSDLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - private static final int[] s_aiNOKOISDepositMaturityDays = new int[] { - 1, - 2, - 3 - }; - - private static final double[] s_adblNOKOISDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - private static final String[] s_astrNOKShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - private static final double[] s_adblNOKShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - private static final String[] s_astrNOKOISFutureTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - private static final String[] s_astrNOKOISFutureMaturityTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblNOKOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - private static final String[] s_astrNOKLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblNOKLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - private static final String[] s_astrUSD6MDepositTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblUSD6MDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - private static final String[] s_astrUSD6MFRATenor = new String[] { - "0D", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - private static final double[] s_adblUSD6MFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - private static final String[] s_astrUSD6MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblUSD6MFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - private static final String[] s_astrUSD3MDepositTenor = new String[] { - "2W", - "3W", - "1M", - "2M" - }; - - private static final double[] s_adblUSD3MDepositQuote = new double[] { - 0.001865, - 0.001969, - 0.001951, - 0.001874 - }; - - private static final String[] s_astrUSD3MFRATenor = new String[] { - "0D", - "1M", - "3M", - "6M", - "9M", - "12M", - "15M", - "18M", - "21M" - }; - - private static final double[] s_adblUSD3MFRAQuote = new double[] { - 0.001790, - 0.001775, - 0.001274, - 0.001222, - 0.001269, - 0.001565, - 0.001961, - 0.002556, - 0.003101 - }; - - private static final String[] s_astrUSD3MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblUSD3MFixFloatQuote = new double[] { - 0.002850, // 3Y - 0.004370, // 4Y - 0.006230, // 5Y - 0.008170, // 6Y - 0.010000, // 7Y - 0.011710, // 8Y - 0.013240, // 9Y - 0.014590, // 10Y - 0.016920, // 12Y - 0.019330, // 15Y - 0.020990, // 20Y - 0.021560, // 25Y - 0.021860 // 30Y - }; - - private static final String[] s_astrUSD3MSyntheticFloatFloatTenor = new String[] { - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblUSD3MSyntheticFloatFloatQuote = new double[] { - 0.00065, - 0.00060, - 0.00054, - 0.00050 - }; - - private static final String[] s_astrNOK6MDepositTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblNOK6MDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - private static final String[] s_astrNOK6MFRATenor = new String[] { - "0D", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - private static final double[] s_adblNOK6MFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - private static final String[] s_astrNOK6MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblNOK6MFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - private static final String[] s_astrCCBSTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "15Y", - "20Y" - }; - - private static final double[] s_adblCCBSQuote = new double[] { - -0.000600, // 1Y - -0.000600, // 2Y - -0.000600, // 3Y - -0.000575, // 4Y - -0.000575, // 5Y - -0.000575, // 7Y - -0.000575, // 10Y - -0.000600, // 15Y - -0.000600 // 20Y - }; - - private static final double[] s_adblIRSQuote = new double[] { - 0.0575, // 1Y - 0.0575, // 2Y - 0.0575, // 3Y - 0.0575, // 4Y - 0.0600, // 5Y - 0.0600, // 7Y - 0.0600, // 10Y - 0.0600, // 15Y - 0.0600 // 20Y - }; - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtValue = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - String strReferenceCurrency = "USD"; - String strDerivedCurrency = "NOK"; - - SegmentCustomBuilderControl scbcCubic = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - FloaterIndex fiNOK = new OvernightIndex ( - strDerivedCurrency + "OIS", - "OIS", - strDerivedCurrency, - "Act/360", - strDerivedCurrency, - "ON", - 0, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - MergedDiscountForwardCurve dcReference = OvernightIndexCurve.MakeDC ( - strReferenceCurrency, - dtValue, - s_aiUSDOISDepositMaturityDays, - s_adblUSDOISDepositQuote, - s_astrUSDShortEndOISMaturityTenor, - s_adblUSDShortEndOISQuote, - s_astrUSDOISFutureTenor, - s_astrUSDOISFutureMaturityTenor, - s_adblUSDOISFutureQuote, - s_astrUSDLongEndOISMaturityTenor, - s_adblUSDLongEndOISQuote, - scbcCubic, - null - ); - - ForwardCurve fc6MReference = IBORCurve.CustomIBORBuilderSample ( - dcReference, - null, - ForwardLabel.Create ( - strReferenceCurrency, - "6M" - ), - scbcCubic, - s_astrUSD6MDepositTenor, - s_adblUSD6MDepositQuote, - "ForwardRate", - s_astrUSD6MFRATenor, - s_adblUSD6MFRAQuote, - "ParForwardRate", - s_astrUSD6MFixFloatTenor, - s_adblUSD6MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - "---- USD LIBOR 6M VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - ForwardCurve fc3MReference = IBORCurve.CustomIBORBuilderSample ( - dcReference, - fc6MReference, - ForwardLabel.Create ( - strReferenceCurrency, - "3M" - ), - scbcCubic, - s_astrUSD3MDepositTenor, - s_adblUSD3MDepositQuote, - "ForwardRate", - s_astrUSD3MFRATenor, - s_adblUSD3MFRAQuote, - "ParForwardRate", - s_astrUSD3MFixFloatTenor, - s_adblUSD3MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - s_astrUSD3MSyntheticFloatFloatTenor, - s_adblUSD3MSyntheticFloatFloatQuote, - "DerivedParBasisSpread", - "---- VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - MergedDiscountForwardCurve dcDerived = OvernightIndexCurve.MakeDC ( - strDerivedCurrency, - dtValue, - s_aiNOKOISDepositMaturityDays, - s_adblNOKOISDepositQuote, - s_astrNOKShortEndOISMaturityTenor, - s_adblNOKShortEndOISQuote, - s_astrNOKOISFutureTenor, - s_astrNOKOISFutureMaturityTenor, - s_adblNOKOISFutureQuote, - s_astrNOKLongEndOISMaturityTenor, - s_adblNOKLongEndOISQuote, - scbcCubic, - fiNOK - ); - - ForwardCurve fc6MDerived = IBORCurve.CustomIBORBuilderSample ( - dcDerived, - null, - ForwardLabel.Create ( - fiNOK, - "6M" - ), - scbcCubic, - s_astrNOK6MDepositTenor, - s_adblNOK6MDepositQuote, - "ForwardRate", - s_astrNOK6MFRATenor, - s_adblNOK6MFRAQuote, - "ParForwardRate", - s_astrNOK6MFixFloatTenor, - s_adblNOK6MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - "---- NOK LIBOR 6M VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - CCBSForwardCurve.ForwardCurveReferenceComponentBasis ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - dcDerived, - fc6MDerived, - _dblFXNOKUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - true - ); - - CCBSForwardCurve.ForwardCurveReferenceComponentBasis ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - dcDerived, - fc6MDerived, - _dblFXNOKUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - false - ); - - CCBSDiscountCurve.MakeDiscountCurve ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - _dblFXNOKUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - s_adblIRSQuote, - true - ); - - CCBSDiscountCurve.MakeDiscountCurve ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - _dblFXNOKUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - s_adblIRSQuote, - false - ); - } -} diff --git a/org/drip/sample/dual/PLN3M6MUSD3M6M.java b/org/drip/sample/dual/PLN3M6MUSD3M6M.java deleted file mode 100644 index d28f6b6..0000000 --- a/org/drip/sample/dual/PLN3M6MUSD3M6M.java +++ /dev/null @@ -1,795 +0,0 @@ - -package org.drip.sample.dual; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.sample.forward.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * PLN3M6MUSD3M6M demonstrates the setup and construction of the USD 3M Forward Curve from PLN3M6MUSD3M6M - * CCBS, PLN 3M, PLN 6M, and USD 6M Quotes. - * - * @author Lakshmi Krishnamurthy - */ - -public class PLN3M6MUSD3M6M { - private static final double _dblFXPLNUSD = 0.3301; - - private static final int[] s_aiUSDOISDepositMaturityDays = new int[] { - 1, - 2, - 3 - }; - - private static final double[] s_adblUSDOISDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - private static final String[] s_astrUSDShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - private static final double[] s_adblUSDShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - private static final String[] s_astrUSDOISFutureTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - private static final String[] s_astrUSDOISFutureMaturityTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblUSDOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - private static final String[] s_astrUSDLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblUSDLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - private static final int[] s_aiPLNOISDepositMaturityDays = new int[] { - 1, - 2, - 3 - }; - - private static final double[] s_adblPLNOISDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - private static final String[] s_astrPLNShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - private static final double[] s_adblPLNShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - private static final String[] s_astrPLNOISFutureTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - private static final String[] s_astrPLNOISFutureMaturityTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblPLNOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - private static final String[] s_astrPLNLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblPLNLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - private static final String[] s_astrUSD6MDepositTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblUSD6MDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - private static final String[] s_astrUSD6MFRATenor = new String[] { - "0D", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - private static final double[] s_adblUSD6MFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - private static final String[] s_astrUSD6MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblUSD6MFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - private static final String[] s_astrUSD3MDepositTenor = new String[] { - "2W", - "3W", - "1M", - "2M" - }; - - private static final double[] s_adblUSD3MDepositQuote = new double[] { - 0.001865, - 0.001969, - 0.001951, - 0.001874 - }; - - private static final String[] s_astrUSD3MFRATenor = new String[] { - "0D", - "1M", - "3M", - "6M", - "9M", - "12M", - "15M", - "18M", - "21M" - }; - - private static final double[] s_adblUSD3MFRAQuote = new double[] { - 0.001790, - 0.001775, - 0.001274, - 0.001222, - 0.001269, - 0.001565, - 0.001961, - 0.002556, - 0.003101 - }; - - private static final String[] s_astrUSD3MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblUSD3MFixFloatQuote = new double[] { - 0.002850, // 3Y - 0.004370, // 4Y - 0.006230, // 5Y - 0.008170, // 6Y - 0.010000, // 7Y - 0.011710, // 8Y - 0.013240, // 9Y - 0.014590, // 10Y - 0.016920, // 12Y - 0.019330, // 15Y - 0.020990, // 20Y - 0.021560, // 25Y - 0.021860 // 30Y - }; - - private static final String[] s_astrUSD3MSyntheticFloatFloatTenor = new String[] { - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblUSD3MSyntheticFloatFloatQuote = new double[] { - 0.00065, - 0.00060, - 0.00054, - 0.00050 - }; - - private static final String[] s_astrPLN6MDepositTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblPLN6MDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - private static final String[] s_astrPLN6MFRATenor = new String[] { - "0D", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - private static final double[] s_adblPLN6MFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - private static final String[] s_astrPLN6MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblPLN6MFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - private static final String[] s_astrCCBSTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y" - }; - - private static final double[] s_adblCCBSQuote = new double[] { - -0.00035, // 1Y - -0.00035, // 2Y - -0.00035, // 3Y - -0.00035, // 4Y - -0.00035, // 5Y - -0.00035, // 7Y - -0.00035 // 10Y - }; - - private static final double[] s_adblIRSQuote = new double[] { - 0.035, // 1Y - 0.035, // 2Y - 0.035, // 3Y - 0.035, // 4Y - 0.035, // 5Y - 0.035, // 7Y - 0.035 // 10Y - }; - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtValue = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - String strReferenceCurrency = "USD"; - String strDerivedCurrency = "PLN"; - - SegmentCustomBuilderControl scbcCubic = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - MergedDiscountForwardCurve dcReference = OvernightIndexCurve.MakeDC ( - strReferenceCurrency, - dtValue, - s_aiUSDOISDepositMaturityDays, - s_adblUSDOISDepositQuote, - s_astrUSDShortEndOISMaturityTenor, - s_adblUSDShortEndOISQuote, - s_astrUSDOISFutureTenor, - s_astrUSDOISFutureMaturityTenor, - s_adblUSDOISFutureQuote, - s_astrUSDLongEndOISMaturityTenor, - s_adblUSDLongEndOISQuote, - scbcCubic, - null - ); - - ForwardCurve fc6MReference = IBORCurve.CustomIBORBuilderSample ( - dcReference, - null, - ForwardLabel.Create ( - strReferenceCurrency, - "6M" - ), - scbcCubic, - s_astrUSD6MDepositTenor, - s_adblUSD6MDepositQuote, - "ForwardRate", - s_astrUSD6MFRATenor, - s_adblUSD6MFRAQuote, - "ParForwardRate", - s_astrUSD6MFixFloatTenor, - s_adblUSD6MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - "---- USD LIBOR 6M VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - ForwardCurve fc3MReference = IBORCurve.CustomIBORBuilderSample ( - dcReference, - fc6MReference, - ForwardLabel.Create ( - strReferenceCurrency, - "3M" - ), - scbcCubic, - s_astrUSD3MDepositTenor, - s_adblUSD3MDepositQuote, - "ForwardRate", - s_astrUSD3MFRATenor, - s_adblUSD3MFRAQuote, - "ParForwardRate", - s_astrUSD3MFixFloatTenor, - s_adblUSD3MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - s_astrUSD3MSyntheticFloatFloatTenor, - s_adblUSD3MSyntheticFloatFloatQuote, - "DerivedParBasisSpread", - "---- VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - MergedDiscountForwardCurve dcDerived = OvernightIndexCurve.MakeDC ( - strDerivedCurrency, - dtValue, - s_aiPLNOISDepositMaturityDays, - s_adblPLNOISDepositQuote, - s_astrPLNShortEndOISMaturityTenor, - s_adblPLNShortEndOISQuote, - s_astrPLNOISFutureTenor, - s_astrPLNOISFutureMaturityTenor, - s_adblPLNOISFutureQuote, - s_astrPLNLongEndOISMaturityTenor, - s_adblPLNLongEndOISQuote, - scbcCubic, - null - ); - - ForwardCurve fc6MDerived = IBORCurve.CustomIBORBuilderSample ( - dcDerived, - null, - ForwardLabel.Create ( - strDerivedCurrency, - "6M" - ), - scbcCubic, - s_astrPLN6MDepositTenor, - s_adblPLN6MDepositQuote, - "ForwardRate", - s_astrPLN6MFRATenor, - s_adblPLN6MFRAQuote, - "ParForwardRate", - s_astrPLN6MFixFloatTenor, - s_adblPLN6MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - "---- PLN LIBOR 6M VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - CCBSForwardCurve.ForwardCurveReferenceComponentBasis ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - dcDerived, - fc6MDerived, - _dblFXPLNUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - true - ); - - CCBSForwardCurve.ForwardCurveReferenceComponentBasis ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - dcDerived, - fc6MDerived, - _dblFXPLNUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - false - ); - - CCBSDiscountCurve.MakeDiscountCurve ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - _dblFXPLNUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - s_adblIRSQuote, - true - ); - - CCBSDiscountCurve.MakeDiscountCurve ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - _dblFXPLNUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - s_adblIRSQuote, - false - ); - } -} diff --git a/org/drip/sample/dual/SEK3M6MUSD3M6M.java b/org/drip/sample/dual/SEK3M6MUSD3M6M.java deleted file mode 100644 index 05b7138..0000000 --- a/org/drip/sample/dual/SEK3M6MUSD3M6M.java +++ /dev/null @@ -1,801 +0,0 @@ - -package org.drip.sample.dual; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.sample.forward.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * SEK3M6MUSD3M6M demonstrates the setup and construction of the USD 3M Forward Curve from SEK3M6MUSD3M6M - * CCBS, SEK 3M, SEK 6M, and USD 6M Quotes. - * - * @author Lakshmi Krishnamurthy - */ - -public class SEK3M6MUSD3M6M { - private static final double _dblFXSEKUSD = 0.1496; - - private static final int[] s_aiUSDOISDepositMaturityDays = new int[] { - 1, - 2, - 3 - }; - - private static final double[] s_adblUSDOISDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - private static final String[] s_astrUSDShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - private static final double[] s_adblUSDShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - private static final String[] s_astrUSDOISFutureTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - private static final String[] s_astrUSDOISFutureMaturityTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblUSDOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - private static final String[] s_astrUSDLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblUSDLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - private static final int[] s_aiSEKOISDepositMaturityDays = new int[] { - 1, - 2, - 3 - }; - - private static final double[] s_adblSEKOISDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - private static final String[] s_astrSEKShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - private static final double[] s_adblSEKShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - private static final String[] s_astrSEKOISFutureTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - private static final String[] s_astrSEKOISFutureMaturityTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblSEKOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - private static final String[] s_astrSEKLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblSEKLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - private static final String[] s_astrUSD6MDepositTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblUSD6MDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - private static final String[] s_astrUSD6MFRATenor = new String[] { - "0D", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - private static final double[] s_adblUSD6MFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - private static final String[] s_astrUSD6MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblUSD6MFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - private static final String[] s_astrUSD3MDepositTenor = new String[] { - "2W", - "3W", - "1M", - "2M" - }; - - private static final double[] s_adblUSD3MDepositQuote = new double[] { - 0.001865, - 0.001969, - 0.001951, - 0.001874 - }; - - private static final String[] s_astrUSD3MFRATenor = new String[] { - "0D", - "1M", - "3M", - "6M", - "9M", - "12M", - "15M", - "18M", - "21M" - }; - - private static final double[] s_adblUSD3MFRAQuote = new double[] { - 0.001790, - 0.001775, - 0.001274, - 0.001222, - 0.001269, - 0.001565, - 0.001961, - 0.002556, - 0.003101 - }; - - private static final String[] s_astrUSD3MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - private static final double[] s_adblUSD3MFixFloatQuote = new double[] { - 0.002850, // 3Y - 0.004370, // 4Y - 0.006230, // 5Y - 0.008170, // 6Y - 0.010000, // 7Y - 0.011710, // 8Y - 0.013240, // 9Y - 0.014590, // 10Y - 0.016920, // 12Y - 0.019330, // 15Y - 0.020990, // 20Y - 0.021560, // 25Y - 0.021860 // 30Y - }; - - private static final String[] s_astrUSD3MSyntheticFloatFloatTenor = new String[] { - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblUSD3MSyntheticFloatFloatQuote = new double[] { - 0.00065, - 0.00060, - 0.00054, - 0.00050 - }; - - private static final String[] s_astrSEK6MDepositTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - private static final double[] s_adblSEK6MDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - private static final String[] s_astrSEK6MFRATenor = new String[] { - "0D", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - private static final double[] s_adblSEK6MFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - private static final String[] s_astrSEK6MFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - private static final double[] s_adblSEK6MFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - private static final String[] s_astrCCBSTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "15Y", - "20Y" - }; - - private static final double[] s_adblCCBSQuote = new double[] { - -0.000525, // 1Y - -0.000400, // 2Y - -0.000250, // 3Y - -0.000175, // 4Y - -0.000150, // 5Y - -0.000125, // 7Y - -0.000125, // 10Y - -0.000000, // 15Y - -0.000000 // 20Y - }; - - private static final double[] s_adblIRSQuote = new double[] { - 0.0100, // 1Y - 0.0100, // 2Y - 0.0125, // 3Y - 0.0125, // 4Y - 0.0150, // 5Y - 0.0175, // 7Y - 0.0250, // 10Y - 0.0400, // 15Y - 0.0525 // 20Y - }; - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtValue = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - String strReferenceCurrency = "USD"; - String strDerivedCurrency = "SEK"; - - SegmentCustomBuilderControl scbcCubic = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - MergedDiscountForwardCurve dcReference = OvernightIndexCurve.MakeDC ( - strReferenceCurrency, - dtValue, - s_aiUSDOISDepositMaturityDays, - s_adblUSDOISDepositQuote, - s_astrUSDShortEndOISMaturityTenor, - s_adblUSDShortEndOISQuote, - s_astrUSDOISFutureTenor, - s_astrUSDOISFutureMaturityTenor, - s_adblUSDOISFutureQuote, - s_astrUSDLongEndOISMaturityTenor, - s_adblUSDLongEndOISQuote, - scbcCubic, - null - ); - - ForwardCurve fc6MReference = IBORCurve.CustomIBORBuilderSample ( - dcReference, - null, - ForwardLabel.Create ( - strReferenceCurrency, - "6M" - ), - scbcCubic, - s_astrUSD6MDepositTenor, - s_adblUSD6MDepositQuote, - "ForwardRate", - s_astrUSD6MFRATenor, - s_adblUSD6MFRAQuote, - "ParForwardRate", - s_astrUSD6MFixFloatTenor, - s_adblUSD6MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - "---- USD LIBOR 6M VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - ForwardCurve fc3MReference = IBORCurve.CustomIBORBuilderSample ( - dcReference, - fc6MReference, - ForwardLabel.Create ( - strReferenceCurrency, - "3M" - ), - scbcCubic, - s_astrUSD3MDepositTenor, - s_adblUSD3MDepositQuote, - "ForwardRate", - s_astrUSD3MFRATenor, - s_adblUSD3MFRAQuote, - "ParForwardRate", - s_astrUSD3MFixFloatTenor, - s_adblUSD3MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - s_astrUSD3MSyntheticFloatFloatTenor, - s_adblUSD3MSyntheticFloatFloatQuote, - "DerivedParBasisSpread", - "---- VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - MergedDiscountForwardCurve dcDerived = OvernightIndexCurve.MakeDC ( - strDerivedCurrency, - dtValue, - s_aiSEKOISDepositMaturityDays, - s_adblSEKOISDepositQuote, - s_astrSEKShortEndOISMaturityTenor, - s_adblSEKShortEndOISQuote, - s_astrSEKOISFutureTenor, - s_astrSEKOISFutureMaturityTenor, - s_adblSEKOISFutureQuote, - s_astrSEKLongEndOISMaturityTenor, - s_adblSEKLongEndOISQuote, - scbcCubic, - null - ); - - ForwardCurve fc6MDerived = IBORCurve.CustomIBORBuilderSample ( - dcDerived, - null, - ForwardLabel.Create ( - strDerivedCurrency, - "6M" - ), - scbcCubic, - s_astrSEK6MDepositTenor, - s_adblSEK6MDepositQuote, - "ForwardRate", - s_astrSEK6MFRATenor, - s_adblSEK6MFRAQuote, - "ParForwardRate", - s_astrSEK6MFixFloatTenor, - s_adblSEK6MFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - "---- SEK LIBOR 6M VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - false - ); - - CCBSForwardCurve.ForwardCurveReferenceComponentBasis ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - dcDerived, - fc6MDerived, - _dblFXSEKUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - true - ); - - CCBSForwardCurve.ForwardCurveReferenceComponentBasis ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - dcDerived, - fc6MDerived, - _dblFXSEKUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - false - ); - - CCBSDiscountCurve.MakeDiscountCurve ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - _dblFXSEKUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - s_adblIRSQuote, - true - ); - - CCBSDiscountCurve.MakeDiscountCurve ( - strReferenceCurrency, - strDerivedCurrency, - dtValue, - dcReference, - fc6MReference, - fc3MReference, - _dblFXSEKUSD, - scbcCubic, - s_astrCCBSTenor, - s_adblCCBSQuote, - s_adblIRSQuote, - false - ); - } -} diff --git a/org/drip/sample/efficientfrontier/BoundedMarkovitzBullet.java b/org/drip/sample/efficientfrontier/BoundedMarkovitzBullet.java deleted file mode 100644 index 40147cc..0000000 --- a/org/drip/sample/efficientfrontier/BoundedMarkovitzBullet.java +++ /dev/null @@ -1,279 +0,0 @@ - -package org.drip.sample.efficientfrontier; - -import java.util.*; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.InteriorPointBarrierControl; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.mpt.MarkovitzBullet; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * BoundedMarkovitzBullet demonstrates the Construction of the Efficient Frontier using the Constrained Mean - * Variance Optimizer for a Bounded Portfolio. - * - * @author Lakshmi Krishnamurthy - */ - -public class BoundedMarkovitzBullet { - - private static void DisplayPortfolioMetrics ( - final OptimizationOutput optPort) - throws Exception - { - AssetComponent[] aACGlobalMinimum = optPort.optimalPortfolio().assets(); - - String strDump = "\t|" + - FormatUtil.FormatDouble (optPort.optimalMetrics().excessReturnsMean(), 1, 4, 100.) + "% |" + - FormatUtil.FormatDouble (optPort.optimalMetrics().excessReturnsStandardDeviation(), 1, 4, 100.) + " |"; - - for (AssetComponent ac : aACGlobalMinimum) - strDump += " " + FormatUtil.FormatDouble (ac.amount(), 3, 2, 100.) + "% |"; - - System.out.println (strDump + "|"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.05, - 0.05, - 0.05, - 0.10, - 0.05, - 0.05, - 0.03 - }; - - double[] adblAssetUpperBound = new double[] { - 0.40, - 0.40, - 0.30, - 0.60, - 0.35, - 0.15, - 0.50 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.008430, - 0.007230, - 0.006450, - 0.002560, - 0.004480, - 0.006840, - 0.001670 - }; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733, 0.002083, 0.001593, 0.000488, 0.001172, 0.002312, 0.000710}, - {0.002083, 0.002768, 0.001302, 0.000457, 0.001105, 0.001647, 0.000563}, - {0.001593, 0.001302, 0.001463, 0.000639, 0.001050, 0.001110, 0.000519}, - {0.000488, 0.000457, 0.000639, 0.000608, 0.000663, 0.000042, 0.000370}, - {0.001172, 0.001105, 0.001050, 0.000663, 0.001389, 0.000825, 0.000661}, - {0.002312, 0.001647, 0.001110, 0.000042, 0.000825, 0.005211, 0.000749}, - {0.000710, 0.000563, 0.000519, 0.000370, 0.000661, 0.000749, 0.000703} - }; - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - BoundedPortfolioConstructionParameters bpcp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT, - Double.NaN - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - bpcp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - int iFrontierSampleUnits = 20; - - MarkovitzBullet mb = cmva.efficientFrontier ( - bpcp, - ausp, - iFrontierSampleUnits - ); - - System.out.println ("\n\n\t|-----------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| GLOBAL MINIMUM VARIANCE AND MAXIMUM RETURNS PORTFOLIOS ||"); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||"); - - strHeader = "\t| RETURNS | RISK % |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||"); - - DisplayPortfolioMetrics (mb.globalMinimumVariance()); - - DisplayPortfolioMetrics (mb.longOnlyMaximumReturns()); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||\n\n\n"); - - TreeMap mapFrontierPortfolio = mb.optimalPortfolios(); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| EFFICIENT FRONTIER: PORTFOLIO RISK & RETURNS + CORRESPONDING ASSET ALLOCATION ||"); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||"); - - System.out.println (strHeader + "|"); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||"); - - for (Map.Entry me : mapFrontierPortfolio.entrySet()) - DisplayPortfolioMetrics (me.getValue()); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||\n\n"); - } -} diff --git a/org/drip/sample/efficientfrontier/LongOnlyMarkovitzBullet.java b/org/drip/sample/efficientfrontier/LongOnlyMarkovitzBullet.java deleted file mode 100644 index f49cb89..0000000 --- a/org/drip/sample/efficientfrontier/LongOnlyMarkovitzBullet.java +++ /dev/null @@ -1,279 +0,0 @@ - -package org.drip.sample.efficientfrontier; - -import java.util.*; - -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.InteriorPointBarrierControl; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.mpt.MarkovitzBullet; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * LongOnlyMarkovitzBullet demonstrates the Construction of the Efficient Frontier using the Constrained Mean - * Variance Optimizer for a Long-Only Portfolio. - * - * @author Lakshmi Krishnamurthy - */ - -public class LongOnlyMarkovitzBullet { - - private static void DisplayPortfolioMetrics ( - final OptimizationOutput optPort) - throws Exception - { - AssetComponent[] aACGlobalMinimum = optPort.optimalPortfolio().assets(); - - String strDump = "\t|" + - FormatUtil.FormatDouble (optPort.optimalMetrics().excessReturnsMean(), 1, 4, 100.) + "% |" + - FormatUtil.FormatDouble (optPort.optimalMetrics().excessReturnsStandardDeviation(), 1, 4, 100.) + " |"; - - for (AssetComponent ac : aACGlobalMinimum) - strDump += " " + FormatUtil.FormatDouble (ac.amount(), 3, 2, 100.) + "% |"; - - System.out.println (strDump + "|"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetLowerBound = new double[] { - 0.00, - 0.00, - 0.00, - 0.00, - 0.00, - 0.00, - 0.00 - }; - - double[] adblAssetUpperBound = new double[] { - 1.00, - 1.00, - 1.00, - 1.00, - 1.00, - 1.00, - 1.00 - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.008430, - 0.007230, - 0.006450, - 0.002560, - 0.004480, - 0.006840, - 0.001670 - }; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733, 0.002083, 0.001593, 0.000488, 0.001172, 0.002312, 0.000710}, - {0.002083, 0.002768, 0.001302, 0.000457, 0.001105, 0.001647, 0.000563}, - {0.001593, 0.001302, 0.001463, 0.000639, 0.001050, 0.001110, 0.000519}, - {0.000488, 0.000457, 0.000639, 0.000608, 0.000663, 0.000042, 0.000370}, - {0.001172, 0.001105, 0.001050, 0.000663, 0.001389, 0.000825, 0.000661}, - {0.002312, 0.001647, 0.001110, 0.000042, 0.000825, 0.005211, 0.000749}, - {0.000710, 0.000563, 0.000519, 0.000370, 0.000661, 0.000749, 0.000703} - }; - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetName, - adblAssetExpectedReturns, - aadblAssetReturnsCovariance - ) - ); - - double[][] aadblCovarianceMatrix = ausp.covariance (astrAssetName); - - System.out.println ("\n\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) { - String strDump = "\t| " + astrAssetName[i] + " "; - - for (int j = 0; j < astrAssetName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n\n"); - - System.out.println ("\t|-------------------||"); - - System.out.println ("\t| ASSET BOUNDS ||"); - - System.out.println ("\t|-------------------||"); - - for (int i = 0; i < astrAssetName.length; ++i) - System.out.println ( - "\t| " + astrAssetName[i] + " | " + - FormatUtil.FormatDouble (adblAssetLowerBound[i], 2, 0, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetUpperBound[i], 2, 0, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------||\n\n"); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| INTERIOR POINT METHOD BARRIER PARAMETERS ||"); - - System.out.println ("\t|--------------------------------------------||"); - - System.out.println ("\t| Barrier Decay Velocity : " + 1. / ipbc.decayVelocity()); - - System.out.println ("\t| Barrier Decay Steps : " + ipbc.numDecaySteps()); - - System.out.println ("\t| Initial Barrier Strength : " + ipbc.initialStrength()); - - System.out.println ("\t| Barrier Convergence Tolerance : " + ipbc.relativeTolerance()); - - System.out.println ("\t|--------------------------------------------||\n\n"); - - ConstrainedMeanVarianceOptimizer cmva = new ConstrainedMeanVarianceOptimizer ( - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - BoundedPortfolioConstructionParameters bpcp = new BoundedPortfolioConstructionParameters ( - astrAssetName, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT, - Double.NaN - ) - ); - - for (int i = 0; i < astrAssetName.length; ++i) - bpcp.addBound ( - astrAssetName[i], - adblAssetLowerBound[i], - adblAssetUpperBound[i] - ); - - int iFrontierSampleUnits = 20; - - MarkovitzBullet mb = cmva.efficientFrontier ( - bpcp, - ausp, - iFrontierSampleUnits - ); - - System.out.println ("\n\n\t|-----------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| GLOBAL MINIMUM VARIANCE AND MAXIMUM RETURNS PORTFOLIOS ||"); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||"); - - strHeader = "\t| RETURNS | RISK % |"; - - for (int i = 0; i < astrAssetName.length; ++i) - strHeader += " " + astrAssetName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||"); - - DisplayPortfolioMetrics (mb.globalMinimumVariance()); - - DisplayPortfolioMetrics (mb.longOnlyMaximumReturns()); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||\n\n\n"); - - TreeMap mapFrontierPortfolio = mb.optimalPortfolios(); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| EFFICIENT FRONTIER: PORTFOLIO RISK & RETURNS + CORRESPONDING ASSET ALLOCATION ||"); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||"); - - System.out.println (strHeader + "|"); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||"); - - for (Map.Entry me : mapFrontierPortfolio.entrySet()) - DisplayPortfolioMetrics (me.getValue()); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||\n\n"); - } -} diff --git a/org/drip/sample/efficientfrontier/UnboundedMarkovitzBullet.java b/org/drip/sample/efficientfrontier/UnboundedMarkovitzBullet.java deleted file mode 100644 index 05e6a21..0000000 --- a/org/drip/sample/efficientfrontier/UnboundedMarkovitzBullet.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.sample.efficientfrontier; - -import java.util.*; - -import org.drip.feed.loader.*; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.AssetComponent; -import org.drip.portfolioconstruction.mpt.MarkovitzBullet; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * UnboundedMarkovitzBullet demonstrates the Construction of the Efficient Frontier using the Unconstrained - * Quadratic Mean Variance Optimizer. - * - * @author Lakshmi Krishnamurthy - */ - -public class UnboundedMarkovitzBullet { - - private static void DisplayPortfolioMetrics ( - final OptimizationOutput optPort) - throws Exception - { - AssetComponent[] aACGlobalMinimum = optPort.optimalPortfolio().assets(); - - String strDump = "\t|" + - FormatUtil.FormatDouble (optPort.optimalMetrics().excessReturnsMean(), 1, 4, 100.) + "% |" + - FormatUtil.FormatDouble (optPort.optimalMetrics().excessReturnsStandardDeviation(), 1, 4, 100.) + " |"; - - for (AssetComponent ac : aACGlobalMinimum) - strDump += " " + FormatUtil.FormatDouble (ac.amount(), 3, 2, 100.) + "% |"; - - System.out.println (strDump + "|"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iFrontierSampleUnits = 20; - double dblRiskToleranceFactor = 0.; - String strSeriesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\MeanVarianceOptimizer\\FormattedSeries1.csv"; - - CSVGrid csvGrid = CSVParser.NamedStringGrid (strSeriesLocation); - - String[] astrVariateHeader = csvGrid.headers(); - - String[] astrAsset = new String[astrVariateHeader.length - 1]; - double[][] aadblVariateSample = new double[astrVariateHeader.length - 1][]; - - for (int i = 0; i < astrAsset.length; ++i) { - astrAsset[i] = astrVariateHeader[i + 1]; - - aadblVariateSample[i] = csvGrid.doubleArrayAtColumn (i + 1); - } - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAsset, - aadblVariateSample - ) - ); - - PortfolioConstructionParameters pcp = new PortfolioConstructionParameters ( - astrAsset, - CustomRiskUtilitySettings.RiskTolerant (dblRiskToleranceFactor), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT, - Double.NaN - ) - ); - - MeanVarianceOptimizer mvo = new QuadraticMeanVarianceOptimizer(); - - MarkovitzBullet mb = mvo.efficientFrontier ( - pcp, - ausp, - iFrontierSampleUnits - ); - - System.out.println ("\n\n\t|-----------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| GLOBAL MINIMUM VARIANCE AND MAXIMUM RETURNS PORTFOLIOS ||"); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| RETURNS | RISK % |"; - - for (int i = 0; i < astrAsset.length; ++i) - strHeader += " " + astrAsset[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||"); - - DisplayPortfolioMetrics (mb.globalMinimumVariance()); - - DisplayPortfolioMetrics (mb.longOnlyMaximumReturns()); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||\n\n\n"); - - TreeMap mapFrontierPortfolio = mb.optimalPortfolios(); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| EFFICIENT FRONTIER: PORTFOLIO RISK & RETURNS + CORRESPONDING ASSET ALLOCATION ||"); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||"); - - System.out.println (strHeader + "|"); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||"); - - for (Map.Entry me : mapFrontierPortfolio.entrySet()) - DisplayPortfolioMetrics (me.getValue()); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||\n\n"); - } -} diff --git a/org/drip/sample/efficientfrontier/UnboundedMarkovitzBulletExplicit.java b/org/drip/sample/efficientfrontier/UnboundedMarkovitzBulletExplicit.java deleted file mode 100644 index e40e719..0000000 --- a/org/drip/sample/efficientfrontier/UnboundedMarkovitzBulletExplicit.java +++ /dev/null @@ -1,188 +0,0 @@ - -package org.drip.sample.efficientfrontier; - -import org.drip.feed.loader.*; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.AssetComponent; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * UnboundedMarkovitzBulletExplicit demonstrates the Explicit Construction of the Efficient Frontier. - * - * @author Lakshmi Krishnamurthy - */ - -public class UnboundedMarkovitzBulletExplicit { - - private static double DisplayPortfolioMetrics ( - final OptimizationOutput optPort) - throws Exception - { - AssetComponent[] aACGlobalMinimum = optPort.optimalPortfolio().assets(); - - String strDump = "\t|" + - FormatUtil.FormatDouble (optPort.optimalMetrics().excessReturnsMean(), 1, 4, 100.) + "% |" + - FormatUtil.FormatDouble (optPort.optimalMetrics().excessReturnsStandardDeviation(), 1, 4, 100.) + " |"; - - for (AssetComponent ac : aACGlobalMinimum) - strDump += " " + FormatUtil.FormatDouble (ac.amount(), 3, 2, 100.) + "% |"; - - System.out.println (strDump + "|"); - - return optPort.optimalMetrics().excessReturnsMean(); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iRiskReturnGranularity = 40; - double dblRiskToleranceFactor = 0.; - String strSeriesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\MeanVarianceOptimizer\\FormattedSeries1.csv"; - - CSVGrid csvGrid = CSVParser.NamedStringGrid (strSeriesLocation); - - String[] astrVariateHeader = csvGrid.headers(); - - String[] astrAsset = new String[astrVariateHeader.length - 1]; - double[][] aadblVariateSample = new double[astrVariateHeader.length - 1][]; - - for (int i = 0; i < astrAsset.length; ++i) { - astrAsset[i] = astrVariateHeader[i + 1]; - - aadblVariateSample[i] = csvGrid.doubleArrayAtColumn (i + 1); - } - - AssetUniverseStatisticalProperties ausp = AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAsset, - aadblVariateSample - ) - ); - - PortfolioConstructionParameters pcp = new PortfolioConstructionParameters ( - astrAsset, - CustomRiskUtilitySettings.RiskTolerant (dblRiskToleranceFactor), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT, - Double.NaN - ) - ); - - MeanVarianceOptimizer mvo = new QuadraticMeanVarianceOptimizer(); - - System.out.println ("\n\n\t|-----------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| GLOBAL MINIMUM VARIANCE AND MAXIMUM RETURNS PORTFOLIOS ||"); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| RETURNS | RISK % |"; - - for (int i = 0; i < astrAsset.length; ++i) - strHeader += " " + astrAsset[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||"); - - double dblGMVReturns = DisplayPortfolioMetrics ( - mvo.globalMinimumVarianceAllocate ( - pcp, - ausp - ) - ); - - double dblMaximumReturns = DisplayPortfolioMetrics ( - mvo.longOnlyMaximumReturnsAllocate ( - pcp, - ausp - ) - ); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||\n\n\n"); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| EFFICIENT FRONTIER: PORTFOLIO RISK & RETURNS + CORRESPONDING ASSET ALLOCATION ||"); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||"); - - System.out.println (strHeader + "|"); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||"); - - double dblReturnsGrain = (dblMaximumReturns - dblGMVReturns) / iRiskReturnGranularity; - - for (int i = 0; i <= iRiskReturnGranularity; ++i) { - PortfolioConstructionParameters pcpReturnsConstrained = new PortfolioConstructionParameters ( - astrAsset, - CustomRiskUtilitySettings.VarianceMinimizer(), - new PortfolioEqualityConstraintSettings ( - PortfolioEqualityConstraintSettings.FULLY_INVESTED_CONSTRAINT | PortfolioEqualityConstraintSettings.RETURNS_CONSTRAINT, - dblGMVReturns + i * dblReturnsGrain - ) - ); - - DisplayPortfolioMetrics ( - mvo.allocate ( - pcpReturnsConstrained, - ausp - ) - ); - } - - System.out.println ("\t|-----------------------------------------------------------------------------------------------||\n\n"); - } -} diff --git a/org/drip/sample/efronstein/BinaryVariateSumBound.java b/org/drip/sample/efronstein/BinaryVariateSumBound.java deleted file mode 100644 index 5812fb0..0000000 --- a/org/drip/sample/efronstein/BinaryVariateSumBound.java +++ /dev/null @@ -1,360 +0,0 @@ - -package org.drip.sample.efronstein; - -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.custom.GlivenkoCantelliUniformDeviation; -import org.drip.sequence.functional.*; -import org.drip.sequence.metrics.SingleSequenceAgnosticMetrics; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BinaryVariateSumBound demonstrates the Computation of the Probabilistic Bounds for the Realization of the - * Values of a Multivariate Function over Random Sequence Values (in this case, sum of the independent - * Random Variates) using Variants of the Efron-Stein Methodology. - * - * @author Lakshmi Krishnamurthy - */ - -public class BinaryVariateSumBound { - - private static final SingleSequenceAgnosticMetrics[] IIDDraw ( - final UnivariateSequenceGenerator rsg, - final int iNumSample) - throws Exception - { - SingleSequenceAgnosticMetrics[] aSSAM = new SingleSequenceAgnosticMetrics[iNumSample]; - - for (int i = 0; i < iNumSample; ++i) - aSSAM[i] = rsg.sequence ( - iNumSample, - null - ); - - return aSSAM; - } - - private static final GlivenkoCantelliUniformDeviation BinarySumFunction ( - final Binary binarySequenceGenerator, - final int iNumVariate) - throws Exception - { - double[] adblWeight = new double[iNumVariate]; - - for (int i = 0; i < iNumVariate; ++i) - adblWeight[i] = 1. / iNumVariate; - - return new GlivenkoCantelliUniformDeviation ( - new BinaryIdempotentUnivariateRandom ( - 0., - null, - 1., - binarySequenceGenerator.positiveProbability() - ), - adblWeight - ); - } - - private static final void MartingaleDifferencesRun ( - final Binary binarySequenceGenerator, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - binarySequenceGenerator, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - BinarySumFunction ( - binarySequenceGenerator, - iNumSample - ), - aSSAM - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.martingaleVarianceUpperBound(), 1, 3, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void GhostVariateVarianceRun ( - final Binary binarySequenceGenerator, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - binarySequenceGenerator, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - BinarySumFunction ( - binarySequenceGenerator, - iNumSample - ), - aSSAM - ); - - SingleSequenceAgnosticMetrics[] aSSAMGhost = IIDDraw ( - binarySequenceGenerator, - iNumSample - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.ghostVarianceUpperBound (aSSAMGhost), 1, 3, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void EfronSteinSteeleRun ( - final Binary binarySequenceGenerator, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - binarySequenceGenerator, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - BinarySumFunction ( - binarySequenceGenerator, - iNumSample - ), - aSSAM - ); - - SingleSequenceAgnosticMetrics[] aSSAMGhost = IIDDraw ( - binarySequenceGenerator, - iNumSample - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.efronSteinSteeleBound (aSSAMGhost), 1, 3, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void PivotDifferencesRun ( - final Binary binarySequenceGenerator, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - MultivariateRandom func = BinarySumFunction ( - binarySequenceGenerator, - iNumSample - ); - - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - binarySequenceGenerator, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - func, - aSSAM - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.pivotVarianceUpperBound (new FlatMultivariateRandom (0.)), 1, 3, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void BoundedDifferencesRun ( - final Binary binarySequenceGenerator, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - binarySequenceGenerator, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - BinarySumFunction ( - binarySequenceGenerator, - iNumSample - ), - aSSAM - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.boundedVarianceUpperBound(), 1, 3, 1.); - } - - System.out.println (strDump + " |"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iNumSet = 5; - - int[] aiSampleSize = new int[] { - 3, 10, 25, 50 - }; - - Binary bin = new Binary (0.7); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Martingale Differences Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - MartingaleDifferencesRun ( - bin, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Symmetrized Variate Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - GhostVariateVarianceRun ( - bin, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - aiSampleSize = new int[] { - 3, 10, 25, 50, 75, 99 - }; - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Efron-Stein-Steele Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - EfronSteinSteeleRun ( - bin, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Pivoted Differences Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - PivotDifferencesRun ( - bin, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Bounded Differences Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - BoundedDifferencesRun ( - bin, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - } -} diff --git a/org/drip/sample/efronstein/BoundedVariateSumBound.java b/org/drip/sample/efronstein/BoundedVariateSumBound.java deleted file mode 100644 index 6d8dfcc..0000000 --- a/org/drip/sample/efronstein/BoundedVariateSumBound.java +++ /dev/null @@ -1,368 +0,0 @@ - -package org.drip.sample.efronstein; - -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.custom.GlivenkoCantelliUniformDeviation; -import org.drip.sequence.functional.*; -import org.drip.sequence.metrics.SingleSequenceAgnosticMetrics; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; - -/* - - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BoundedVariateSumBound demonstrates the Computation of the Probabilistic Bounds for the Realization of the - * Values of a Multivariate Function over Random Sequence Values (in this case, sum of the independent - * Random Variates) using Variants of the Efron-Stein Methodology. - * - * @author Lakshmi Krishnamurthy - */ - -public class BoundedVariateSumBound { - - private static final SingleSequenceAgnosticMetrics[] IIDDraw ( - final UnivariateSequenceGenerator rsg, - final int iNumSample) - throws Exception - { - SingleSequenceAgnosticMetrics[] aSSAM = new SingleSequenceAgnosticMetrics[iNumSample]; - - for (int i = 0; i < iNumSample; ++i) - aSSAM[i] = rsg.sequence ( - iNumSample, - null - ); - - return aSSAM; - } - - private static final GlivenkoCantelliUniformDeviation BoundedSumFunction ( - final BoundedUniform bu, - final int iNumVariate) - throws Exception - { - double[] adblWeight = new double[iNumVariate]; - - for (int i = 0; i < iNumVariate; ++i) - adblWeight[i] = 1.; - - return new GlivenkoCantelliUniformDeviation ( - new BoundedIdempotentUnivariateRandom ( - 0., - null, - bu.upperBound() - bu.lowerBound() - ), - adblWeight - ); - } - - private static final void MartingaleDifferencesRun ( - final BoundedUniform bu, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - bu, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - BoundedSumFunction ( - bu, - iNumSample - ), - aSSAM - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.martingaleVarianceUpperBound(), 2, 2, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void GhostVariateVarianceRun ( - final BoundedUniform bu, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - bu, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - BoundedSumFunction ( - bu, - iNumSample - ), - aSSAM - ); - - SingleSequenceAgnosticMetrics[] aSSAMGhost = IIDDraw ( - bu, - iNumSample - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.ghostVarianceUpperBound (aSSAMGhost), 2, 2, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void EfronSteinSteeleRun ( - final BoundedUniform bu, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - bu, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - BoundedSumFunction ( - bu, - iNumSample - ), - aSSAM - ); - - SingleSequenceAgnosticMetrics[] aSSAMGhost = IIDDraw ( - bu, - iNumSample - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.efronSteinSteeleBound (aSSAMGhost), 2, 2, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void PivotDifferencesRun ( - final BoundedUniform bu, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - bu, - iNumSample - ); - - MultivariateRandom func = BoundedSumFunction ( - bu, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - func, - aSSAM - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.pivotVarianceUpperBound (new FlatMultivariateRandom (0.)), 2, 2, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void BoundedDifferencesRun ( - final BoundedUniform bu, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - bu, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - BoundedSumFunction ( - bu, - iNumSample - ), - aSSAM - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.boundedVarianceUpperBound(), 2, 2, 1.); - } - - System.out.println (strDump + " |"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iNumSet = 5; - - int[] aiSampleSize = new int[] { - 3, 10, 25, 50 - }; - - BoundedUniform bu = new BoundedUniform ( - 0., - 1. - ); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Martingale Differences Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - MartingaleDifferencesRun ( - bu, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Symmetrized Variate Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - GhostVariateVarianceRun ( - bu, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - aiSampleSize = new int[] { - 3, 10, 25, 50, 75, 99 - }; - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Efron-Stein-Steele Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - EfronSteinSteeleRun ( - bu, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Pivoted Differences Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - PivotDifferencesRun ( - bu, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - double[] adblVariateBound = new double[aiSampleSize[aiSampleSize.length - 1]]; - - for (int i = 0; i < adblVariateBound.length; ++i) - adblVariateBound[i] = bu.upperBound() - bu.lowerBound(); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Bounded Differences Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - BoundedDifferencesRun ( - bu, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - } -} diff --git a/org/drip/sample/efronstein/GlivenkoCantelliSupremumBound.java b/org/drip/sample/efronstein/GlivenkoCantelliSupremumBound.java deleted file mode 100644 index 3cd78ad..0000000 --- a/org/drip/sample/efronstein/GlivenkoCantelliSupremumBound.java +++ /dev/null @@ -1,313 +0,0 @@ - -package org.drip.sample.efronstein; - -import org.drip.function.definition.R1ToR1; -import org.drip.function.r1tor1.OffsetIdempotent; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.custom.GlivenkoCantelliFunctionSupremum; -import org.drip.sequence.functional.*; -import org.drip.sequence.metrics.SingleSequenceAgnosticMetrics; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * GlivenkoCantelliSupremumBound demonstrates the Computation of the Probabilistic Bounds for the Supremum - * among the Class of Functions for an Empirical Sample from its Population Mean using Variants of the - * Efron-Stein Methodology. - * - * @author Lakshmi Krishnamurthy - */ - -public class GlivenkoCantelliSupremumBound { - - private static final SingleSequenceAgnosticMetrics[] IIDDraw ( - final UnivariateSequenceGenerator rsg, - final int iNumSample) - throws Exception - { - SingleSequenceAgnosticMetrics[] aSSAM = new SingleSequenceAgnosticMetrics[iNumSample]; - - for (int i = 0; i < iNumSample; ++i) - aSSAM[i] = rsg.sequence ( - iNumSample, - null - ); - - return aSSAM; - } - - private static final GlivenkoCantelliFunctionSupremum GlivenkoCantelliSupremum ( - final Binary bsg, - final int iNumVariate) - throws Exception - { - return GlivenkoCantelliFunctionSupremum.Create ( - new FunctionSupremumUnivariateRandom ( - new R1ToR1[] { - new OffsetIdempotent (0.), - new OffsetIdempotent (2. * bsg.positiveProbability()) - }, - null - ), - iNumVariate - ); - } - - private static final void MartingaleDifferencesRun ( - final Binary bsg, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - bsg, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - GlivenkoCantelliSupremum ( - bsg, - iNumSample - ), - aSSAM - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.martingaleVarianceUpperBound(), 1, 3, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void GhostVariateVarianceRun ( - final Binary bsg, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - bsg, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - GlivenkoCantelliSupremum ( - bsg, - iNumSample - ), - aSSAM - ); - - SingleSequenceAgnosticMetrics[] aSSAMGhost = IIDDraw ( - bsg, - iNumSample - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.ghostVarianceUpperBound (aSSAMGhost), 1, 3, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void EfronSteinSteeleRun ( - final Binary bsg, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - bsg, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - GlivenkoCantelliSupremum ( - bsg, - iNumSample - ), - aSSAM - ); - - SingleSequenceAgnosticMetrics[] aSSAMGhost = IIDDraw ( - bsg, - iNumSample - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.efronSteinSteeleBound (aSSAMGhost), 1, 3, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void PivotDifferencesRun ( - final Binary bsg, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - MultivariateRandom func = GlivenkoCantelliSupremum ( - bsg, - iNumSample - ); - - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - bsg, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - func, - aSSAM - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.pivotVarianceUpperBound (func), 1, 3, 1.); - } - - System.out.println (strDump + " |"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iNumSet = 5; - - int[] aiSampleSize = new int[] { - 3, 10, 25, 50 - }; - - Binary bin = new Binary (0.7); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Martingale Differences Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - MartingaleDifferencesRun ( - bin, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Symmetrized Variate Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - GhostVariateVarianceRun ( - bin, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - aiSampleSize = new int[] { - 3, 10, 25, 50, 75, 99 - }; - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Efron-Stein-Steele Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - EfronSteinSteeleRun ( - bin, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Pivoted Differences Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - PivotDifferencesRun ( - bin, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - } -} diff --git a/org/drip/sample/efronstein/GlivenkoCantelliUniformBound.java b/org/drip/sample/efronstein/GlivenkoCantelliUniformBound.java deleted file mode 100644 index c3c42bd..0000000 --- a/org/drip/sample/efronstein/GlivenkoCantelliUniformBound.java +++ /dev/null @@ -1,353 +0,0 @@ - -package org.drip.sample.efronstein; - -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.custom.GlivenkoCantelliUniformDeviation; -import org.drip.sequence.functional.*; -import org.drip.sequence.metrics.SingleSequenceAgnosticMetrics; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * GlivenkoCantelliUniformBound demonstrates the Computation of the Probabilistic Bounds for the Uniform - * Deviation of an Empirical Sample from its Population Mean using Variants of the Efron-Stein Methodology. - * - * @author Lakshmi Krishnamurthy - */ - -public class GlivenkoCantelliUniformBound { - - private static final SingleSequenceAgnosticMetrics[] IIDDraw ( - final UnivariateSequenceGenerator rsg, - final int iNumSample) - throws Exception - { - SingleSequenceAgnosticMetrics[] aSSAM = new SingleSequenceAgnosticMetrics[iNumSample]; - - for (int i = 0; i < iNumSample; ++i) - aSSAM[i] = rsg.sequence ( - iNumSample, - null - ); - - return aSSAM; - } - - private static final GlivenkoCantelliUniformDeviation GlivenkoCantelliFunction ( - final Binary binarySequenceGenerator, - final int iNumVariate) - throws Exception - { - return GlivenkoCantelliUniformDeviation.Create ( - new BoundedIdempotentUnivariateRandom ( - binarySequenceGenerator.positiveProbability(), - null, - 1. - ), - iNumVariate - ); - } - - private static final void MartingaleDifferencesRun ( - final Binary binarySequenceGenerator, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - binarySequenceGenerator, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - GlivenkoCantelliFunction ( - binarySequenceGenerator, - iNumSample - ), - aSSAM - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.martingaleVarianceUpperBound(), 1, 3, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void GhostVariateVarianceRun ( - final Binary binarySequenceGenerator, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - binarySequenceGenerator, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - GlivenkoCantelliFunction ( - binarySequenceGenerator, - iNumSample - ), - aSSAM - ); - - SingleSequenceAgnosticMetrics[] aSSAMGhost = IIDDraw ( - binarySequenceGenerator, - iNumSample - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.ghostVarianceUpperBound (aSSAMGhost), 1, 3, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void EfronSteinSteeleRun ( - final Binary binarySequenceGenerator, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - binarySequenceGenerator, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - GlivenkoCantelliFunction ( - binarySequenceGenerator, - iNumSample - ), - aSSAM - ); - - SingleSequenceAgnosticMetrics[] aSSAMGhost = IIDDraw ( - binarySequenceGenerator, - iNumSample - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.efronSteinSteeleBound (aSSAMGhost), 1, 3, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void PivotDifferencesRun ( - final Binary binarySequenceGenerator, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - MultivariateRandom func = GlivenkoCantelliFunction ( - binarySequenceGenerator, - iNumSample - ); - - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - binarySequenceGenerator, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - func, - aSSAM - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.pivotVarianceUpperBound (func), 1, 3, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void BoundedDifferencesRun ( - final Binary binarySequenceGenerator, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - binarySequenceGenerator, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - GlivenkoCantelliFunction ( - binarySequenceGenerator, - iNumSample - ), - aSSAM - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.boundedVarianceUpperBound(), 1, 3, 1.); - } - - System.out.println (strDump + " |"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iNumSet = 5; - - int[] aiSampleSize = new int[] { - 3, 10, 25, 50 - }; - - Binary bin = new Binary (0.7); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Martingale Differences Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - MartingaleDifferencesRun ( - bin, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Symmetrized Variate Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - GhostVariateVarianceRun ( - bin, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - aiSampleSize = new int[] { - 3, 10, 25, 50, 75, 99 - }; - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Efron-Stein-Steele Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - EfronSteinSteeleRun ( - bin, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Pivoted Differences Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - PivotDifferencesRun ( - bin, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Bounded Differences Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - BoundedDifferencesRun ( - bin, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - } -} diff --git a/org/drip/sample/efronstein/KernelDensityL1Bound.java b/org/drip/sample/efronstein/KernelDensityL1Bound.java deleted file mode 100644 index 8891dfb..0000000 --- a/org/drip/sample/efronstein/KernelDensityL1Bound.java +++ /dev/null @@ -1,292 +0,0 @@ - -package org.drip.sample.efronstein; - -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.custom.KernelDensityEstimationL1; -import org.drip.sequence.functional.*; -import org.drip.sequence.metrics.SingleSequenceAgnosticMetrics; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * KernelDensityL1Bound demonstrates the Computation of the Probabilistic Bounds for the L1 Errors of Kernel - * Density Estimation using Variants of the Efron-Stein Methodology. - * - * @author Lakshmi Krishnamurthy - */ - -public class KernelDensityL1Bound { - - private static final SingleSequenceAgnosticMetrics[] IIDDraw ( - final UnivariateSequenceGenerator rsg, - final int iNumSample) - throws Exception - { - SingleSequenceAgnosticMetrics[] aSSAM = new SingleSequenceAgnosticMetrics[iNumSample]; - - for (int i = 0; i < iNumSample; ++i) - aSSAM[i] = rsg.sequence ( - iNumSample, - null - ); - - return aSSAM; - } - - private static final KernelDensityEstimationL1 KernelDensityL1Function ( - final int iNumVariate) - throws Exception - { - return new KernelDensityEstimationL1 ( - new FlatUnivariate (0.), - 1., - iNumVariate, - new FlatUnivariate (-2.) - ); - } - - private static final void MartingaleDifferencesRun ( - final Binary bsg, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - bsg, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - KernelDensityL1Function (iNumSample), - aSSAM - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.martingaleVarianceUpperBound(), 1, 3, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void GhostVariateVarianceRun ( - final Binary bsg, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - bsg, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - KernelDensityL1Function (iNumSample), - aSSAM - ); - - SingleSequenceAgnosticMetrics[] aSSAMGhost = IIDDraw ( - bsg, - iNumSample - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.ghostVarianceUpperBound (aSSAMGhost), 1, 3, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void EfronSteinSteeleRun ( - final Binary bsg, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - bsg, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - KernelDensityL1Function (iNumSample), - aSSAM - ); - - SingleSequenceAgnosticMetrics[] aSSAMGhost = IIDDraw ( - bsg, - iNumSample - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.efronSteinSteeleBound (aSSAMGhost), 1, 3, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void PivotDifferencesRun ( - final Binary bsg, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - bsg, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - KernelDensityL1Function (iNumSample), - aSSAM - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.pivotVarianceUpperBound (new FlatMultivariateRandom (0.)), 1, 3, 1.); - } - - System.out.println (strDump + " |"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iNumSet = 5; - - int[] aiSampleSize = new int[] { - 3, 10, 25, 50 - }; - - Binary bin = new Binary (0.7); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Martingale Differences Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - MartingaleDifferencesRun ( - bin, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Symmetrized Variate Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - GhostVariateVarianceRun ( - bin, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - aiSampleSize = new int[] { - 3, 10, 25, 50, 75, 99 - }; - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Efron-Stein-Steele Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - EfronSteinSteeleRun ( - bin, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Pivoted Differences Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - PivotDifferencesRun ( - bin, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - } -} diff --git a/org/drip/sample/efronstein/LongestCommonSubsequenceBound.java b/org/drip/sample/efronstein/LongestCommonSubsequenceBound.java deleted file mode 100644 index 2eef5f9..0000000 --- a/org/drip/sample/efronstein/LongestCommonSubsequenceBound.java +++ /dev/null @@ -1,337 +0,0 @@ - -package org.drip.sample.efronstein; - -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.custom.LongestCommonSubsequence; -import org.drip.sequence.functional.*; -import org.drip.sequence.metrics.SingleSequenceAgnosticMetrics; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * LongestCommonSubsequenceBound demonstrates the Computation of the Probabilistic Bounds for the Longest - * Common Subsequence across each half over the Random Sequence Values using Variants of the Efron-Stein - * Methodology. - * - * @author Lakshmi Krishnamurthy - */ - -public class LongestCommonSubsequenceBound { - - private static final SingleSequenceAgnosticMetrics[] IIDDraw ( - final UnivariateSequenceGenerator rsg, - final int iNumSample) - throws Exception - { - SingleSequenceAgnosticMetrics[] aSSAM = new SingleSequenceAgnosticMetrics[iNumSample]; - - for (int i = 0; i < iNumSample; ++i) - aSSAM[i] = rsg.sequence ( - iNumSample, - null - ); - - return aSSAM; - } - - private static final void MartingaleDifferencesRun ( - final UnivariateSequenceGenerator rsg, - final MultivariateRandom func, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - rsg, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - func, - aSSAM - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.martingaleVarianceUpperBound(), 2, 2, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void GhostVariateVarianceRun ( - final UnivariateSequenceGenerator rsg, - final MultivariateRandom func, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - rsg, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - func, - aSSAM - ); - - SingleSequenceAgnosticMetrics[] aSSAMGhost = IIDDraw ( - rsg, - iNumSample - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.ghostVarianceUpperBound (aSSAMGhost), 2, 2, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void EfronSteinSteeleRun ( - final UnivariateSequenceGenerator rsg, - final MultivariateRandom func, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - rsg, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - func, - aSSAM - ); - - SingleSequenceAgnosticMetrics[] aSSAMGhost = IIDDraw ( - rsg, - iNumSample - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.efronSteinSteeleBound (aSSAMGhost), 2, 2, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void PivotDifferencesRun ( - final UnivariateSequenceGenerator rsg, - final MultivariateRandom func, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - rsg, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - func, - aSSAM - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.pivotVarianceUpperBound (func), 2, 2, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void BoundedDifferencesRun ( - final UnivariateSequenceGenerator rsg, - final MultivariateRandom func, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - rsg, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - func, - aSSAM - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.boundedVarianceUpperBound(), 2, 2, 1.); - } - - System.out.println (strDump + " |"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iNumSet = 5; - - int[] aiSampleSize = new int[] { - 3, 10, 25 - }; - - BoundedUniform bu = new BoundedUniform ( - 0., - 1. - ); - - MultivariateRandom func = new LongestCommonSubsequence(); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Martingale Differences Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - MartingaleDifferencesRun ( - bu, - func, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Symmetrized Variate Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - GhostVariateVarianceRun ( - bu, - func, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - aiSampleSize = new int[] { - 3, 10, 25, 50, 75, 99 - }; - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Efron-Stein-Steele Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - EfronSteinSteeleRun ( - bu, - func, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Pivoted Differences Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - PivotDifferencesRun ( - bu, - func, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Bounded Differences Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - BoundedDifferencesRun ( - bu, - func, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - } -} diff --git a/org/drip/sample/efronstein/MinimumBinPackingBound.java b/org/drip/sample/efronstein/MinimumBinPackingBound.java deleted file mode 100644 index 8e2cc41..0000000 --- a/org/drip/sample/efronstein/MinimumBinPackingBound.java +++ /dev/null @@ -1,336 +0,0 @@ - -package org.drip.sample.efronstein; - -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.custom.BinPacking; -import org.drip.sequence.functional.*; -import org.drip.sequence.metrics.SingleSequenceAgnosticMetrics; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * MinimumBinPackingBound demonstrates the Computation of the Probabilistic Bounds for the Minimum Number of - * Packing Bins over a Random Sequence Values using Variants of the Efron-Stein Methodology. - * - * @author Lakshmi Krishnamurthy - */ - -public class MinimumBinPackingBound { - - private static final SingleSequenceAgnosticMetrics[] IIDDraw ( - final UnivariateSequenceGenerator rsg, - final int iNumSample) - throws Exception - { - SingleSequenceAgnosticMetrics[] aSSAM = new SingleSequenceAgnosticMetrics[iNumSample]; - - for (int i = 0; i < iNumSample; ++i) - aSSAM[i] = rsg.sequence ( - iNumSample, - null - ); - - return aSSAM; - } - - private static final void MartingaleDifferencesRun ( - final UnivariateSequenceGenerator rsg, - final MultivariateRandom func, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - rsg, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - func, - aSSAM - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.martingaleVarianceUpperBound(), 2, 2, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void GhostVariateVarianceRun ( - final UnivariateSequenceGenerator rsg, - final MultivariateRandom func, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - rsg, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - func, - aSSAM - ); - - SingleSequenceAgnosticMetrics[] aSSAMGhost = IIDDraw ( - rsg, - iNumSample - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.ghostVarianceUpperBound (aSSAMGhost), 2, 2, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void EfronSteinSteeleRun ( - final UnivariateSequenceGenerator rsg, - final MultivariateRandom func, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - rsg, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - func, - aSSAM - ); - - SingleSequenceAgnosticMetrics[] aSSAMGhost = IIDDraw ( - rsg, - iNumSample - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.efronSteinSteeleBound (aSSAMGhost), 2, 2, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void PivotDifferencesRun ( - final UnivariateSequenceGenerator rsg, - final MultivariateRandom func, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - rsg, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - func, - aSSAM - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.pivotVarianceUpperBound (func), 2, 2, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void BoundedDifferencesRun ( - final UnivariateSequenceGenerator rsg, - final MultivariateRandom func, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - rsg, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - func, - aSSAM - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.boundedVarianceUpperBound(), 2, 2, 1.); - } - - System.out.println (strDump + " |"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iNumSet = 5; - - int[] aiSampleSize = new int[] { - 3, 10, 25 - }; - - BoundedUniform bu = new BoundedUniform ( - 0., - 1. - ); - - MultivariateRandom func = BinPacking.MinimumNumberOfBins(); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Martingale Differences Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - MartingaleDifferencesRun ( - bu, - func, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Symmetrized Variate Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - GhostVariateVarianceRun ( - bu, - func, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - aiSampleSize = new int[] { - 3, 10, 25, 50, 75, 99 - }; - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Efron-Stein-Steele Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - EfronSteinSteeleRun ( - bu, - func, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Pivoted Differences Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - PivotDifferencesRun ( - bu, - func, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Bounded Differences Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - BoundedDifferencesRun ( - bu, - func, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - } -} diff --git a/org/drip/sample/efronstein/OrientedPassageTimeBound.java b/org/drip/sample/efronstein/OrientedPassageTimeBound.java deleted file mode 100644 index 752b5a7..0000000 --- a/org/drip/sample/efronstein/OrientedPassageTimeBound.java +++ /dev/null @@ -1,339 +0,0 @@ - -package org.drip.sample.efronstein; - -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.custom.OrientedPercolationFirstPassage; -import org.drip.sequence.functional.*; -import org.drip.sequence.metrics.SingleSequenceAgnosticMetrics; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * OrientedPassageTimeBound demonstrates the Computation of the Probabilistic Bounds for the First Passage - * Time in a Grid of Oriented Percolation using Variants of the Efron-Stein Methodology. - * - * @author Lakshmi Krishnamurthy - */ - -public class OrientedPassageTimeBound { - - private static final SingleSequenceAgnosticMetrics[] IIDDraw ( - final UnivariateSequenceGenerator rsg, - final int iNumSample) - throws Exception - { - SingleSequenceAgnosticMetrics[] aSSAM = new SingleSequenceAgnosticMetrics[iNumSample]; - - for (int i = 0; i < iNumSample; ++i) - aSSAM[i] = rsg.sequence ( - iNumSample, - null - ); - - return aSSAM; - } - - private static final void MartingaleDifferencesRun ( - final UnivariateSequenceGenerator rsg, - final MultivariateRandom func, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - rsg, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - func, - aSSAM - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.martingaleVarianceUpperBound(), 2, 2, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void GhostVariateVarianceRun ( - final UnivariateSequenceGenerator rsg, - final MultivariateRandom func, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - rsg, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - func, - aSSAM - ); - - SingleSequenceAgnosticMetrics[] aSSAMGhost = IIDDraw ( - rsg, - iNumSample - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.ghostVarianceUpperBound (aSSAMGhost), 2, 2, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void EfronSteinSteeleRun ( - final UnivariateSequenceGenerator rsg, - final MultivariateRandom func, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - rsg, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - func, - aSSAM - ); - - SingleSequenceAgnosticMetrics[] aSSAMGhost = IIDDraw ( - rsg, - iNumSample - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.efronSteinSteeleBound (aSSAMGhost), 2, 2, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void PivotDifferencesRun ( - final UnivariateSequenceGenerator rsg, - final MultivariateRandom func, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - rsg, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - func, - aSSAM - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.pivotVarianceUpperBound (func), 2, 2, 1.); - } - - System.out.println (strDump + " |"); - } - - private static final void BoundedDifferencesRun ( - final UnivariateSequenceGenerator rsg, - final MultivariateRandom func, - final int iNumSample, - final int iNumSet) - throws Exception - { - String strDump = "\t| " + FormatUtil.FormatDouble (iNumSample, 2, 0, 1.) + " => "; - - for (int j = 0; j < iNumSet; ++j) { - SingleSequenceAgnosticMetrics[] aSSAM = IIDDraw ( - rsg, - iNumSample - ); - - EfronSteinMetrics esam = new EfronSteinMetrics ( - func, - aSSAM - ); - - if (0 != j) strDump += " |"; - - strDump += FormatUtil.FormatDouble (esam.boundedVarianceUpperBound(), 2, 2, 1.); - } - - System.out.println (strDump + " |"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iNumSet = 5; - - int[] aiSampleSize = new int[] { - 3, 10, 25 - }; - - BoundedUniform bu = new BoundedUniform ( - 0., - 1. - ); - - MultivariateRandom func = new OrientedPercolationFirstPassage ( - 0.5, - 1.0 - ); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Martingale Differences Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - MartingaleDifferencesRun ( - bu, - func, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Symmetrized Variate Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - GhostVariateVarianceRun ( - bu, - func, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - aiSampleSize = new int[] { - 3, 10, 25, 50, 75, 99 - }; - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Efron-Stein-Steele Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - EfronSteinSteeleRun ( - bu, - func, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Pivoted Differences Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - PivotDifferencesRun ( - bu, - func, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - - System.out.println ("\n\t|-----------------------------------------------|"); - - System.out.println ("\t| Bounded Differences Variance Upper Bound |"); - - System.out.println ("\t|-----------------------------------------------|"); - - for (int iSampleSize : aiSampleSize) - BoundedDifferencesRun ( - bu, - func, - iSampleSize, - iNumSet - ); - - System.out.println ("\t|-----------------------------------------------|"); - } -} diff --git a/org/drip/sample/env/CacheManagerAPI.java b/org/drip/sample/env/CacheManagerAPI.java deleted file mode 100644 index a8c7107..0000000 --- a/org/drip/sample/env/CacheManagerAPI.java +++ /dev/null @@ -1,86 +0,0 @@ - -package org.drip.sample.env; - -import org.drip.service.env.CacheManager; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CacheManagerAPI demonstrates Cache Manager API Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class CacheManagerAPI { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strObj = "TESTOBJECT"; - long lCacheEntryTimeout = 10L; // Cache Entry Time-out in Seconds - - CacheManager.Put ( - strObj, - strObj, - lCacheEntryTimeout - ); - - while (true) { - System.out.println ( - "\t[" + new java.util.Date() + "] " + strObj + " exists: " + - CacheManager.Contains (strObj) - ); - - java.lang.Thread.sleep (1000); - } - } -} diff --git a/org/drip/sample/execution/AlmgrenConstantTradingEnhanced.java b/org/drip/sample/execution/AlmgrenConstantTradingEnhanced.java deleted file mode 100644 index 0e540e8..0000000 --- a/org/drip/sample/execution/AlmgrenConstantTradingEnhanced.java +++ /dev/null @@ -1,206 +0,0 @@ - -package org.drip.sample.execution; - -import org.drip.execution.capture.TrajectoryShortfallEstimator; -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.ParticipationRateLinear; -import org.drip.execution.nonadaptive.*; -import org.drip.execution.optimum.*; -import org.drip.execution.profiletime.UniformParticipationRateLinear; -import org.drip.execution.risk.MeanVarianceObjectiveUtility; -import org.drip.execution.strategy.*; -import org.drip.function.definition.R1ToR1; -import org.drip.measure.gaussian.R1UnivariateNormal; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AlmgrenConstantTradingEnhanced demonstrates the Generation of the Optimal Trading Trajectory under the - * Condition of Constant Trading Enhanced Volatility using a Numerical Optimization Technique. The - * References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * @author Lakshmi Krishnamurthy - */ - -public class AlmgrenConstantTradingEnhanced { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblEta = 5.e-06; - double dblAlpha = 1.; - double dblSigma = 1.; - double dblLambda = 1.e-05; - - double dblX = 100000.; - double dblT = 5.; - int iNumInterval = 500; - - DiscreteTradingTrajectoryControl dttc = DiscreteTradingTrajectoryControl.FixedInterval ( - new OrderSpecification ( - dblX, - dblT - ), - iNumInterval - ); - - ArithmeticPriceEvolutionParameters apep = ArithmeticPriceEvolutionParametersBuilder.TradingEnhancedVolatility ( - dblSigma, - new UniformParticipationRateLinear (ParticipationRateLinear.SlopeOnly (dblEta)), - new UniformParticipationRateLinear ( - new ParticipationRateLinear ( - dblAlpha, - 0. - ) - ) - ); - - EfficientTradingTrajectoryDiscrete ettd = (EfficientTradingTrajectoryDiscrete) new StaticOptimalSchemeDiscrete ( - dttc, - apep, - new MeanVarianceObjectiveUtility (dblLambda) - ).generate(); - - double[] adblExecutionTimeNode = ettd.executionTimeNode(); - - double[] adblTradeList = ettd.tradeList(); - - double[] adblHoldings = ettd.holdings(); - - ContinuousConstantTradingEnhanced ccte = ContinuousConstantTradingEnhanced.Standard ( - dblX, - dblT, - apep, - dblLambda - ); - - EfficientTradingTrajectoryContinuous ettc = (EfficientTradingTrajectoryContinuous) ccte.generate(); - - R1ToR1 r1ToR1Holdings = ettc.holdings(); - - double[] adblHoldingsCF = new double[adblExecutionTimeNode.length]; - - for (int i = 0; i < adblExecutionTimeNode.length; ++i) - adblHoldingsCF[i] = r1ToR1Holdings.evaluate (adblExecutionTimeNode[i]); - - TrajectoryShortfallEstimator tse = new TrajectoryShortfallEstimator (ettd); - - R1UnivariateNormal r1un = tse.totalCostDistributionSynopsis (apep); - - System.out.println ("\n\t|------------------------------------------------||"); - - System.out.println ("\t| NUMERICAL - CLOSED FORM CONTINUOUS TRAJECTORY ||"); - - System.out.println ("\t|------------------------------------------------||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| - Execution Time Node ||"); - - System.out.println ("\t| - Holdings (Numerical) ||"); - - System.out.println ("\t| - Holdings (Continuous Closed Form) ||"); - - System.out.println ("\t| - Trade List (Numerical) ||"); - - System.out.println ("\t| - Trade List (Continuous Closed Form) ||"); - - System.out.println ("\t|------------------------------------------------||"); - - for (int i = 1; i < adblExecutionTimeNode.length; ++i) { - System.out.println ("\t| " + - FormatUtil.FormatDouble (adblExecutionTimeNode[i], 1, 2, 1.) + " => " + - FormatUtil.FormatDouble (adblHoldings[i] / dblX, 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (adblHoldingsCF[i] / dblX, 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (adblTradeList[i - 1] / dblX, 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble ((adblHoldingsCF[i] - adblHoldingsCF[i - 1]) / dblX, 2, 2, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------------------------------||"); - - System.out.println ("\n\t|--------------------------------------------------------------------------||"); - - System.out.println ("\t| TRANSACTION COST RECONCILIATION: EXPLICIT vs. NUMERICAL vs. CLOSED FORM ||"); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - - System.out.println ( - "\t| Transaction Cost Expectation : " + - FormatUtil.FormatDouble (r1un.mean(), 6, 1, 1.) + " | " + - FormatUtil.FormatDouble (ettd.transactionCostExpectation(), 6, 1, 1.) + " | " + - FormatUtil.FormatDouble (ettc.transactionCostExpectation(), 6, 1, 1.) + " ||" - ); - - System.out.println ( - "\t| Transaction Cost Variance (X 10^-06) : " + - FormatUtil.FormatDouble (r1un.variance(), 6, 1, 1.e-06) + " | " + - FormatUtil.FormatDouble (ettd.transactionCostVariance(), 6, 1, 1.e-06) + " | " + - FormatUtil.FormatDouble (ettc.transactionCostVariance(), 6, 1, 1.e-06) + " ||" - ); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/execution/AlmgrenLinearTradingEnhanced.java b/org/drip/sample/execution/AlmgrenLinearTradingEnhanced.java deleted file mode 100644 index 40f7846..0000000 --- a/org/drip/sample/execution/AlmgrenLinearTradingEnhanced.java +++ /dev/null @@ -1,203 +0,0 @@ - -package org.drip.sample.execution; - -import org.drip.execution.capture.TrajectoryShortfallEstimator; -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.ParticipationRateLinear; -import org.drip.execution.nonadaptive.*; -import org.drip.execution.optimum.*; -import org.drip.execution.profiletime.UniformParticipationRateLinear; -import org.drip.execution.risk.MeanVarianceObjectiveUtility; -import org.drip.execution.strategy.*; -import org.drip.measure.gaussian.R1UnivariateNormal; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AlmgrenLinearTradingEnhanced demonstrates the Generation of the Optimal Trading Trajectory under the - * Condition of Linear Trading Enhanced Volatility using a Numerical Optimization Technique. The References - * are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * @author Lakshmi Krishnamurthy - */ - -public class AlmgrenLinearTradingEnhanced { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblEta = 5.e-06; - double dblBeta = 2.e-06; - double dblSigma = 1.; - double dblLambda = 1.e-05; - - double dblX = 100000.; - double dblT = 5.; - int iNumInterval = 20; - - DiscreteTradingTrajectoryControl dttc = DiscreteTradingTrajectoryControl.FixedInterval ( - new OrderSpecification ( - dblX, - dblT - ), - iNumInterval - ); - - ArithmeticPriceEvolutionParameters apep = ArithmeticPriceEvolutionParametersBuilder.TradingEnhancedVolatility ( - dblSigma, - new UniformParticipationRateLinear (ParticipationRateLinear.SlopeOnly (dblEta)), - new UniformParticipationRateLinear ( - new ParticipationRateLinear ( - 0., - dblBeta - ) - ) - ); - - EfficientTradingTrajectoryDiscrete ettd = (EfficientTradingTrajectoryDiscrete) new StaticOptimalSchemeDiscrete ( - dttc, - apep, - new MeanVarianceObjectiveUtility (dblLambda) - ).generate(); - - double[] adblExecutionTimeNode = ettd.executionTimeNode(); - - double[] adblTradeList = ettd.tradeList(); - - double[] adblHoldings = ettd.holdings(); - - DiscreteLinearTradingEnhanced dlte = DiscreteLinearTradingEnhanced.Standard ( - dblX, - dblT, - iNumInterval, - apep, - dblLambda - ); - - TradingEnhancedDiscrete ted = (TradingEnhancedDiscrete) dlte.generate(); - - double[] adblTradeListCF = ted.tradeList(); - - double[] adblHoldingsCF = ted.holdings(); - - TrajectoryShortfallEstimator tse = new TrajectoryShortfallEstimator (ettd); - - R1UnivariateNormal r1un = tse.totalCostDistributionSynopsis (apep); - - System.out.println ("\n\t|------------------------------------------------||"); - - System.out.println ("\t| NUMERICAL - CLOSED FORM CONTINUOUS TRAJECTORY ||"); - - System.out.println ("\t|------------------------------------------------||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| - Execution Time Node ||"); - - System.out.println ("\t| - Holdings (Numerical) ||"); - - System.out.println ("\t| - Holdings (Continuous Closed Form) ||"); - - System.out.println ("\t| - Trade List (Numerical) ||"); - - System.out.println ("\t| - Trade List (Continuous Closed Form) ||"); - - System.out.println ("\t|------------------------------------------------||"); - - for (int i = 1; i < adblExecutionTimeNode.length; ++i) { - System.out.println ("\t| " + - FormatUtil.FormatDouble (adblExecutionTimeNode[i], 1, 2, 1.) + " => " + - FormatUtil.FormatDouble (adblHoldings[i] / dblX, 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (adblHoldingsCF[i] / dblX, 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (adblTradeList[i - 1] / dblX, 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (adblTradeListCF[i - 1] / dblX, 2, 2, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------------------------------||"); - - System.out.println ("\n\t|--------------------------------------------------------------------------||"); - - System.out.println ("\t| TRANSACTION COST RECONCILIATION: EXPLICIT vs. NUMERICAL vs. CLOSED FORM ||"); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - - System.out.println ( - "\t| Transaction Cost Expectation : " + - FormatUtil.FormatDouble (r1un.mean(), 6, 1, 1.) + " | " + - FormatUtil.FormatDouble (ettd.transactionCostExpectation(), 6, 1, 1.) + " | " + - FormatUtil.FormatDouble (ted.transactionCostExpectation(), 6, 1, 1.) + " ||" - ); - - System.out.println ( - "\t| Transaction Cost Variance (X 10^-06) : " + - FormatUtil.FormatDouble (r1un.variance(), 6, 1, 1.e-06) + " | " + - FormatUtil.FormatDouble (ettd.transactionCostVariance(), 6, 1, 1.e-06) + " | " + - FormatUtil.FormatDouble (ted.transactionCostVariance(), 6, 1, 1.e-06) + " ||" - ); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/execution/ConcaveImpactNoDrift.java b/org/drip/sample/execution/ConcaveImpactNoDrift.java deleted file mode 100644 index e328ca8..0000000 --- a/org/drip/sample/execution/ConcaveImpactNoDrift.java +++ /dev/null @@ -1,180 +0,0 @@ - -package org.drip.sample.execution; - -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.*; -import org.drip.execution.nonadaptive.StaticOptimalSchemeDiscrete; -import org.drip.execution.optimum.EfficientTradingTrajectoryDiscrete; -import org.drip.execution.parameters.*; -import org.drip.execution.profiletime.*; -import org.drip.execution.risk.MeanVarianceObjectiveUtility; -import org.drip.execution.strategy.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ConcaveImpactNoDrift generates the Trade/Holdings List of Optimal Execution Schedule based on the Concave - * Power Law Evolution Walk Parameters specified. The Generation follows a Numerical Optimizer Scheme, as - * opposed to the Closed Form; it also excludes the Impact of Drift. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConcaveImpactNoDrift { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblS0 = 50.; - double dblDailyVolume = 1000000.; - double dblBidAskSpread = 0.; - double dblPermanentImpactFactor = 0.; - double dblTemporaryImpactFactor = 0.01; - double dblK = 0.5; - double dblDailyVolumeExecutionFactor = 0.1; - double dblDrift = 0.; - double dblVolatility = 1.; - double dblX = 100000.; - double dblFinishTime = 0.04; - int iNumInterval = 2; - double dblLambdaU = 3.e-03; - - PriceMarketImpactPower pmip = new PriceMarketImpactPower ( - new AssetTransactionSettings ( - dblS0, - dblDailyVolume, - dblBidAskSpread - ), - dblPermanentImpactFactor, - dblTemporaryImpactFactor, - dblDailyVolumeExecutionFactor, - dblK - ); - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.Almgren2003 ( - new ArithmeticPriceDynamicsSettings ( - dblDrift, - new FlatUnivariate (dblVolatility), - 0. - ), - new UniformParticipationRateLinear ((ParticipationRateLinear) pmip.permanentTransactionFunction()), - new UniformParticipationRate ((ParticipationRatePower) pmip.temporaryTransactionFunction()) - ); - - DiscreteTradingTrajectoryControl dttc = DiscreteTradingTrajectoryControl.FixedInterval ( - new OrderSpecification ( - dblX, - dblFinishTime - ), - iNumInterval - ); - - EfficientTradingTrajectoryDiscrete ettd = (EfficientTradingTrajectoryDiscrete) new StaticOptimalSchemeDiscrete ( - dttc, - lpep, - new MeanVarianceObjectiveUtility (dblLambdaU) - ).generate(); - - double[] adblExecutionTimeNode = ettd.executionTimeNode(); - - double[] adblTradeList = ettd.tradeList(); - - double[] adblHoldings = ettd.holdings(); - - System.out.println ("\n\t|-----------------------------||"); - - System.out.println ("\t| Optimal Trading Trajectory ||"); - - System.out.println ("\t| ------- ------- ---------- ||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| Time Node ||"); - - System.out.println ("\t| Holdings ||"); - - System.out.println ("\t| Trade Amount ||"); - - System.out.println ("\t|-----------------------------||"); - - for (int i = 0; i <= iNumInterval; ++i) { - if (i == 0) - System.out.println ( - "\t|" + FormatUtil.FormatDouble (adblExecutionTimeNode[i], 1, 3, 1.) + " =>" + - FormatUtil.FormatDouble (adblHoldings[i], 7, 1, 1.) + " | " + - FormatUtil.FormatDouble (0., 6, 1, 1.) + " ||" - ); - else - System.out.println ( - "\t|" + FormatUtil.FormatDouble (adblExecutionTimeNode[i], 1, 3, 1.) + " =>" + - FormatUtil.FormatDouble (adblHoldings[i], 7, 1, 1.) + " | " + - FormatUtil.FormatDouble (adblTradeList[i - 1], 6, 1, 1.) + " ||" - ); - } - - System.out.println ("\t|-----------------------------||"); - } -} diff --git a/org/drip/sample/execution/LinearImpactNoDrift.java b/org/drip/sample/execution/LinearImpactNoDrift.java deleted file mode 100644 index b152bb6..0000000 --- a/org/drip/sample/execution/LinearImpactNoDrift.java +++ /dev/null @@ -1,268 +0,0 @@ - -package org.drip.sample.execution; - -import org.drip.execution.capture.LinearImpactTrajectoryEstimator; -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.*; -import org.drip.execution.nonadaptive.StaticOptimalSchemeDiscrete; -import org.drip.execution.optimum.EfficientTradingTrajectoryDiscrete; -import org.drip.execution.parameters.*; -import org.drip.execution.profiletime.UniformParticipationRateLinear; -import org.drip.execution.risk.MeanVarianceObjectiveUtility; -import org.drip.execution.strategy.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.measure.gaussian.R1UnivariateNormal; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * LinearImpactNoDrift generates the Trade/Holdings List of Optimal Execution Schedule based on the Evolution - * Walk Parameters specified. The Generation follows a Numerical Optimizer Scheme, as opposed to the - * Almgren-Chriss Closed Form; it also excludes the Impact of Drift. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class LinearImpactNoDrift { - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblS0 = 50.; - double dblX = 1000000.; - double dblT = 5.; - int iN = 5; - double dblAnnualVolatility = 0.30; - double dblAnnualReturns = 0.10; - double dblBidAsk = 0.125; - double dblDailyVolume = 5.e06; - double dblDailyVolumePermanentImpact = 0.1; - double dblDailyVolumeTemporaryImpact = 0.01; - double dblLambdaU = 1.e-06; - - ArithmeticPriceDynamicsSettings apds = ArithmeticPriceDynamicsSettings.FromAnnualReturnsSettings ( - dblAnnualReturns, - dblAnnualVolatility, - 0., - dblS0 - ); - - double dblAlpha = apds.drift(); - - double dblSigma = apds.epochVolatility(); - - PriceMarketImpactLinear pmil = new PriceMarketImpactLinear ( - new AssetTransactionSettings ( - dblS0, - dblDailyVolume, - dblBidAsk - ), - dblDailyVolumePermanentImpact, - dblDailyVolumeTemporaryImpact - ); - - ParticipationRateLinear prlPermanent = (ParticipationRateLinear) pmil.permanentTransactionFunction(); - - ParticipationRateLinear prlTemporary = (ParticipationRateLinear) pmil.temporaryTransactionFunction(); - - DiscreteTradingTrajectoryControl dttc = DiscreteTradingTrajectoryControl.FixedInterval ( - new OrderSpecification ( - dblX, - dblT - ), - iN - ); - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.LinearExpectation ( - new ArithmeticPriceDynamicsSettings ( - 0., - new FlatUnivariate (dblSigma), - 0. - ), - new UniformParticipationRateLinear (prlPermanent), - new UniformParticipationRateLinear (prlTemporary) - ); - - EfficientTradingTrajectoryDiscrete ettd = (EfficientTradingTrajectoryDiscrete) new StaticOptimalSchemeDiscrete ( - dttc, - lpep, - new MeanVarianceObjectiveUtility (dblLambdaU) - ).generate(); - - double[] adblExecutionTimeNode = ettd.executionTimeNode(); - - double[] adblTradeList = ettd.tradeList(); - - double[] adblHoldings = ettd.holdings(); - - LinearImpactTrajectoryEstimator lite = new LinearImpactTrajectoryEstimator (ettd); - - R1UnivariateNormal r1un = lite.totalCostDistributionSynopsis (lpep); - - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| ALMGREN-CHRISS TRAJECTORY GENERATOR INPUTS ||"); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\t| Initial Stock Price : " + dblS0); - - System.out.println ("\t| Initial Holdings : " + dblX); - - System.out.println ("\t| Liquidation Time : " + dblT); - - System.out.println ("\t| Number of Time Periods : " + iN); - - System.out.println ("\t| Annual Volatility :" + FormatUtil.FormatDouble (dblAnnualVolatility, 1, 0, 100.) + "%"); - - System.out.println ("\t| Annual Growth :" + FormatUtil.FormatDouble (dblAnnualReturns, 1, 0, 100.) + "%"); - - System.out.println ("\t| Bid-Ask Spread : " + dblBidAsk); - - System.out.println ("\t| Daily Volume : " + dblDailyVolume); - - System.out.println ("\t| Daily Volume Temporary Impact : " + dblDailyVolumeTemporaryImpact); - - System.out.println ("\t| Daily Volume Permanent Impact : " + dblDailyVolumePermanentImpact); - - System.out.println ("\t| Daily Volume 5 million Shares : " + prlPermanent.slope()); - - System.out.println ("\t| Static Holdings 11,000 Shares : " + dblLambdaU); - - System.out.println ("\t|"); - - System.out.println ( - "\t| Daily Volatility : " + - FormatUtil.FormatDouble (dblSigma, 1, 4, 1.) - ); - - System.out.println ( - "\t| Daily Returns : " + - FormatUtil.FormatDouble (dblAlpha, 1, 4, 1.) - ); - - System.out.println ("\t| Temporary Impact Fixed Offset : " + prlTemporary.offset()); - - System.out.println ("\t| Eta : " + prlTemporary.slope()); - - System.out.println ("\t| Gamma : " + prlPermanent.slope()); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\n\t|-----------------------------||"); - - System.out.println ("\t| Optimal Trading Trajectory ||"); - - System.out.println ("\t| ------- ------- ---------- ||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| Time Node ||"); - - System.out.println ("\t| Holdings ||"); - - System.out.println ("\t| Trade Amount ||"); - - System.out.println ("\t|-----------------------------||"); - - for (int i = 0; i <= iN; ++i) { - if (i == 0) - System.out.println ( - "\t|" + FormatUtil.FormatDouble (adblExecutionTimeNode[i], 1, 0, 1.) + " => " + - FormatUtil.FormatDouble (adblHoldings[i], 7, 1, 1.) + " | " + - FormatUtil.FormatDouble (0., 6, 1, 1.) + " ||" - ); - else - System.out.println ( - "\t|" + FormatUtil.FormatDouble (adblExecutionTimeNode[i], 1, 0, 1.) + " => " + - FormatUtil.FormatDouble (adblHoldings[i], 7, 1, 1.) + " | " + - FormatUtil.FormatDouble (adblTradeList[i - 1], 6, 1, 1.) + " ||" - ); - } - - System.out.println ("\t|-----------------------------||"); - - System.out.println ("\n\t|--------------------------------------------------------------||"); - - System.out.println ("\t| TRANSACTION COST RECONCILIATION: OPTIMAL vs. EXPLICIT LINEAR ||"); - - System.out.println ("\t|--------------------------------------------------------------||"); - - System.out.println ( - "\t| Transaction Cost Expectation : " + - FormatUtil.FormatDouble (r1un.mean(), 6, 1, 1.) + " | " + - FormatUtil.FormatDouble (ettd.transactionCostExpectation(), 6, 1, 1.) + " ||" - ); - - System.out.println ( - "\t| Transaction Cost Variance (X 10^-06) : " + - FormatUtil.FormatDouble (r1un.variance(), 6, 1, 1.e-06) + " | " + - FormatUtil.FormatDouble (ettd.transactionCostVariance(), 6, 1, 1.e-06) + " ||" - ); - - System.out.println ("\t|--------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/execution/LinearImpactWithDrift.java b/org/drip/sample/execution/LinearImpactWithDrift.java deleted file mode 100644 index 59db90b..0000000 --- a/org/drip/sample/execution/LinearImpactWithDrift.java +++ /dev/null @@ -1,268 +0,0 @@ - -package org.drip.sample.execution; - -import org.drip.execution.capture.LinearImpactTrajectoryEstimator; -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.*; -import org.drip.execution.nonadaptive.StaticOptimalSchemeDiscrete; -import org.drip.execution.optimum.EfficientTradingTrajectoryDiscrete; -import org.drip.execution.parameters.*; -import org.drip.execution.profiletime.UniformParticipationRateLinear; -import org.drip.execution.risk.MeanVarianceObjectiveUtility; -import org.drip.execution.strategy.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.measure.gaussian.R1UnivariateNormal; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * LinearImpactWithDrift generates the Trade/Holdings List of Optimal Execution Schedule based on the - * Evolution Walk Parameters specified. The Generation follows a Numerical Optimizer Scheme, as opposed to - * the Almgren-Chriss Closed Form; it includes the Impact of Drift. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets, - * 1, 1-50. - * - * - Chan, L. K. C., and J. Lakonishak (1995): The Behavior of Stock Prices around Institutional Trades, - * Journal of Finance, 50, 1147-1174. - * - * - Keim, D. B., and A. Madhavan (1997): Transaction Costs and Investment Style: An Inter-exchange - * Analysis of Institutional Equity Trades, Journal of Financial Economics, 46, 265-292. - * - * @author Lakshmi Krishnamurthy - */ - -public class LinearImpactWithDrift { - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblS0 = 50.; - double dblX = 1000000.; - double dblT = 5.; - int iN = 5; - double dblAnnualVolatility = 0.30; - double dblAnnualReturns = 0.10; - double dblBidAsk = 0.125; - double dblDailyVolume = 5.e06; - double dblDailyVolumePermanentImpact = 0.1; - double dblDailyVolumeTemporaryImpact = 0.01; - double dblLambdaU = 1.e-06; - - ArithmeticPriceDynamicsSettings apds = ArithmeticPriceDynamicsSettings.FromAnnualReturnsSettings ( - dblAnnualReturns, - dblAnnualVolatility, - 0., - dblS0 - ); - - double dblAlpha = apds.drift(); - - double dblSigma = apds.epochVolatility(); - - PriceMarketImpactLinear pmil = new PriceMarketImpactLinear ( - new AssetTransactionSettings ( - dblS0, - dblDailyVolume, - dblBidAsk - ), - dblDailyVolumePermanentImpact, - dblDailyVolumeTemporaryImpact - ); - - ParticipationRateLinear prlPermanent = (ParticipationRateLinear) pmil.permanentTransactionFunction(); - - ParticipationRateLinear prlTemporary = (ParticipationRateLinear) pmil.temporaryTransactionFunction(); - - DiscreteTradingTrajectoryControl dttc = DiscreteTradingTrajectoryControl.FixedInterval ( - new OrderSpecification ( - dblX, - dblT - ), - iN - ); - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.LinearExpectation ( - new ArithmeticPriceDynamicsSettings ( - dblAlpha, - new FlatUnivariate (dblSigma), - 0. - ), - new UniformParticipationRateLinear (prlPermanent), - new UniformParticipationRateLinear (prlTemporary) - ); - - EfficientTradingTrajectoryDiscrete ettd = (EfficientTradingTrajectoryDiscrete) new StaticOptimalSchemeDiscrete ( - dttc, - lpep, - new MeanVarianceObjectiveUtility (dblLambdaU) - ).generate(); - - double[] adblExecutionTimeNode = ettd.executionTimeNode(); - - double[] adblTradeList = ettd.tradeList(); - - double[] adblHoldings = ettd.holdings(); - - LinearImpactTrajectoryEstimator lite = new LinearImpactTrajectoryEstimator (ettd); - - R1UnivariateNormal r1un = lite.totalCostDistributionSynopsis (lpep); - - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| ALMGREN-CHRISS TRAJECTORY GENERATOR INPUTS ||"); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\t| Initial Stock Price : " + dblS0); - - System.out.println ("\t| Initial Holdings : " + dblX); - - System.out.println ("\t| Liquidation Time : " + dblT); - - System.out.println ("\t| Number of Time Periods : " + iN); - - System.out.println ("\t| Annual Volatility :" + FormatUtil.FormatDouble (dblAnnualVolatility, 1, 0, 100.) + "%"); - - System.out.println ("\t| Annual Growth :" + FormatUtil.FormatDouble (dblAnnualReturns, 1, 0, 100.) + "%"); - - System.out.println ("\t| Bid-Ask Spread : " + dblBidAsk); - - System.out.println ("\t| Daily Volume : " + dblDailyVolume); - - System.out.println ("\t| Daily Volume Temporary Impact : " + dblDailyVolumeTemporaryImpact); - - System.out.println ("\t| Daily Volume Permanent Impact : " + dblDailyVolumePermanentImpact); - - System.out.println ("\t| Daily Volume 5 million Shares : " + prlPermanent.slope()); - - System.out.println ("\t| Static Holdings 11,000 Shares : " + dblLambdaU); - - System.out.println ("\t|"); - - System.out.println ( - "\t| Daily Volatility : " + - FormatUtil.FormatDouble (dblSigma, 1, 4, 1.) - ); - - System.out.println ( - "\t| Daily Returns : " + - FormatUtil.FormatDouble (dblAlpha, 1, 4, 1.) - ); - - System.out.println ("\t| Temporary Impact Fixed Offset : " + prlTemporary.offset()); - - System.out.println ("\t| Eta : " + prlTemporary.slope()); - - System.out.println ("\t| Gamma : " + prlPermanent.slope()); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\n\t|-----------------------------||"); - - System.out.println ("\t| Optimal Trading Trajectory ||"); - - System.out.println ("\t| ------- ------- ---------- ||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| Time Node ||"); - - System.out.println ("\t| Holdings ||"); - - System.out.println ("\t| Trade Amount ||"); - - System.out.println ("\t|-----------------------------||"); - - for (int i = 0; i <= iN; ++i) { - if (i == 0) - System.out.println ( - "\t|" + FormatUtil.FormatDouble (adblExecutionTimeNode[i], 1, 0, 1.) + " => " + - FormatUtil.FormatDouble (adblHoldings[i], 7, 1, 1.) + " | " + - FormatUtil.FormatDouble (0., 6, 1, 1.) + " ||" - ); - else - System.out.println ( - "\t|" + FormatUtil.FormatDouble (adblExecutionTimeNode[i], 1, 0, 1.) + " => " + - FormatUtil.FormatDouble (adblHoldings[i], 7, 1, 1.) + " | " + - FormatUtil.FormatDouble (adblTradeList[i - 1], 6, 1, 1.) + " ||" - ); - } - - System.out.println ("\t|-----------------------------||"); - - System.out.println ("\n\t|--------------------------------------------------------------||"); - - System.out.println ("\t| TRANSACTION COST RECONCILIATION: OPTIMAL vs. EXPLICIT LINEAR ||"); - - System.out.println ("\t|--------------------------------------------------------------||"); - - System.out.println ( - "\t| Transaction Cost Expectation : " + - FormatUtil.FormatDouble (r1un.mean(), 6, 1, 1.) + " | " + - FormatUtil.FormatDouble (ettd.transactionCostExpectation(), 6, 1, 1.) + " ||" - ); - - System.out.println ( - "\t| Transaction Cost Variance (X 10^-06) : " + - FormatUtil.FormatDouble (r1un.variance(), 6, 1, 1.e-06) + " | " + - FormatUtil.FormatDouble (ettd.transactionCostVariance(), 6, 1, 1.e-06) + " ||" - ); - - System.out.println ("\t|--------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/fedfund/CompositeFedFundLIBORSwap.java b/org/drip/sample/fedfund/CompositeFedFundLIBORSwap.java deleted file mode 100644 index 81d8669..0000000 --- a/org/drip/sample/fedfund/CompositeFedFundLIBORSwap.java +++ /dev/null @@ -1,1051 +0,0 @@ - -package org.drip.sample.fedfund; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * CompositeFedFundLIBORSwap demonstrates the Construction, the Valuation, and Bloomberg Metrics Analysis for - * the Composite Fed Fund vs. LIBOR Basis Swaps. - * - * @author Lakshmi Krishnamurthy - */ - -public class CompositeFedFundLIBORSwap { - - private static final FloatFloatComponent OTCFloatFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strDerivedTenor, - final String strMaturityTenor, - final double dblBasis) - { - FloatFloatSwapConvention ffConv = IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - return ffConv.createFloatFloatComponent ( - dtSpot, - strDerivedTenor, - strMaturityTenor, - dblBasis, - 1. - ); - } - - private static final FixFloatComponent OTCOISFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = OvernightFixedFloatContainer.FundConventionFromJurisdiction ( - strCurrency - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - for (int i = 0; i < aiDay.length; ++i) - aDeposit[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - OvernightLabel.Create ( - strCurrency - ) - ); - - return aDeposit; - } - - /* - * Construct the Array of Overnight Index Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OISFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aOIS[i] = OTCOISFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aOIS; - } - - /* - * Construct the Array of Overnight Index Future Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OISFuturesFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrStartTenor, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOISFutures = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aOISFutures[i] = OTCOISFixFloat ( - dtSpot.addTenor (astrStartTenor[i]), - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aOISFutures; - } - - private static final MergedDiscountForwardCurve OISDiscountCurve ( - final JulianDate dtSpot, - final String strCurrency, - final String strHeaderComment) - throws Exception - { - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t " + strHeaderComment); - - System.out.println ("\t----------------------------------------------------------------"); - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 3 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0004, 0.0004, 0.0004 // Deposit - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - " DEPOSIT ", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of Short End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - CalibratableComponent[] aShortEndOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "1W", "2W", "3W", "1M" - }, - adblShortEndOISQuote - ); - - /* - * Construct the Short End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisShortEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SHORT END OIS", - aShortEndOISComp, - "SwapRate", - adblShortEndOISQuote - ); - - /* - * Construct the Array of OIS Futures Instruments and their Quotes from the given set of parameters - */ - - double[] adblOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - CalibratableComponent[] aOISFutureComp = OISFuturesFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "1M", "2M", "3M", "4M", "5M" - }, - new java.lang.String[] { - "1M", "1M", "1M", "1M", "1M" - }, - adblOISFutureQuote - ); - - /* - * Construct the OIS Future Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisFutureStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - " OIS FUTURE ", - aOISFutureComp, - "SwapRate", - adblOISFutureQuote - ); - - /* - * Construct the Array of Long End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - CalibratableComponent[] aLongEndOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "15M", "18M", "21M", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - adblLongEndOISQuote - ); - - /* - * Construct the Long End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisLongEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "LONG END OIS ", - aLongEndOISComp, - "SwapRate", - adblLongEndOISQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - oisShortEndStretch, - oisFutureStretch, - oisLongEndStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit and Swap Stretches. - */ - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - CurveSurfaceQuoteContainer csqs = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Cross-Comparison of the Deposit Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t[" + aDepositComp[i].effectiveDate() + " => " + aDepositComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aDepositComp[i].measureValue (valParams, null, csqs, null, "Rate"), 1, 6, 1.) + - " | " + FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the Short End OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS SHORT END INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aShortEndOISComp.length; ++i) { - Map mapCalc = aShortEndOISComp[i].value ( - valParams, - null, - csqs, - null - ); - - double dblCalibSwapRate = mapCalc.get ("CalibSwapRate"); - - double dblFairPremium = mapCalc.get ("FairPremium"); - - System.out.println ("\t[" + aShortEndOISComp[i].effectiveDate() + " => " + aShortEndOISComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (dblCalibSwapRate, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblShortEndOISQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblFairPremium, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblFairPremium - dblCalibSwapRate, 1, 2, 10000.) - ); - } - - /* - * Cross-Comparison of the OIS Future Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS FUTURE INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aOISFutureComp.length; ++i) { - Map mapCalc = aOISFutureComp[i].value ( - valParams, - null, - csqs, - null - ); - - double dblSwapRate = mapCalc.get ("SwapRate"); - - double dblFairPremium = mapCalc.get ("FairPremium"); - - System.out.println ("\t[" + aOISFutureComp[i].effectiveDate() + " => " + aOISFutureComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (dblSwapRate, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblOISFutureQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblFairPremium, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblFairPremium - dblSwapRate, 1, 2, 10000.) - ); - } - - /* - * Cross-Comparison of the Long End OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS LONG END INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aLongEndOISComp.length; ++i) { - Map mapCalc = aLongEndOISComp[i].value ( - valParams, - null, - csqs, - null - ); - - double dblCalibSwapRate = mapCalc.get ("CalibSwapRate"); - - double dblFairPremium = mapCalc.get ("FairPremium"); - - System.out.println ("\t[" + aLongEndOISComp[i].effectiveDate() + " => " + aLongEndOISComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (dblCalibSwapRate, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblLongEndOISQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblFairPremium, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblFairPremium - dblCalibSwapRate, 1, 2, 10000.) - ); - } - - return dc; - } - - /* - * Construct an array of float-float swaps from the corresponding reference (6M) and the derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FloatFloatComponent[] MakexM6MBasisSwap ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final int iTenorInMonths) - throws Exception - { - FloatFloatComponent[] aFFC = new FloatFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aFFC[i] = OTCFloatFloat ( - dtSpot, - strCurrency, - iTenorInMonths + "M", - astrMaturityTenor[i], - 0. - ); - - return aFFC; - } - - private static final ForwardCurve MakexMForwardCurve ( - final JulianDate dtSpot, - final String strCurrency, - final MergedDiscountForwardCurve dc, - final int iTenorInMonths, - final String[] astrxM6MFwdTenor, - final String strManifestMeasure, - final double[] adblxM6MBasisSwapQuote) - throws Exception - { - /* - * Construct the 6M-xM float-float basis swap. - */ - - FloatFloatComponent[] aFFC = MakexM6MBasisSwap ( - dtSpot, - strCurrency, - astrxM6MFwdTenor, - iTenorInMonths - ); - - String strBasisTenor = iTenorInMonths + "M"; - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Calculate the starting forward rate off of the discount curve. - */ - - double dblStartingFwd = dc.forward ( - dtSpot.julian(), - dtSpot.addTenor (strBasisTenor).julian() - ); - - /* - * Set the discount curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Construct the shape preserving forward curve off of Cubic Polynomial Basis Spline. - */ - - return ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - "CUBIC_FWD" + strBasisTenor, - ForwardLabel.Create ( - strCurrency, - strBasisTenor - ), - valParams, - null, - mktParams, - null, - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - aFFC, - strManifestMeasure, - adblxM6MBasisSwapQuote, - dblStartingFwd - ); - } - - private static final FloatFloatComponent[] FedFundLIBORBasisSwap ( - final JulianDate dtEffective, - final String strCurrency, - final String[] astrMaturityTenor) - throws Exception - { - FloatFloatComponent[] aFFC = new FloatFloatComponent[astrMaturityTenor.length]; - - ComposableFloatingUnitSetting cfusLIBOR = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Standard (strCurrency + "-3M"), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFloatingUnitSetting cfusFedFund = new ComposableFloatingUnitSetting ( - "ON", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_OVERNIGHT, - null, - OvernightLabel.Create ( - strCurrency - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cpsLIBOR = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFedFund = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - List lsReferenceStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - astrMaturityTenor[i], - null - ); - - List lsDerivedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - astrMaturityTenor[i], - null - ); - - Stream streamLIBOR = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsReferenceStreamEdgeDate, - cpsLIBOR, - cfusLIBOR - ) - ); - - Stream streamFedFund = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsDerivedStreamEdgeDate, - cpsFedFund, - cfusFedFund - ) - ); - - aFFC[i] = new FloatFloatComponent ( - streamLIBOR, - streamFedFund, - csp - ); - } - - return aFFC; - } - - /* - * Construct the Array of Overnight Index Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtEffective, - final String[] astrMaturityTenor, - final double[] adblCoupon, - final String strCurrency) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrMaturityTenor.length]; - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - false, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - java.lang.String strFixedTenor = Helper.LEFT_TENOR_LESSER == Helper.TenorCompare ( - astrMaturityTenor[i], - "6M" - ) ? astrMaturityTenor[i] : "6M"; - - java.lang.String strFloatingTenor = Helper.LEFT_TENOR_LESSER == Helper.TenorCompare ( - astrMaturityTenor[i], - "3M" - ) ? astrMaturityTenor[i] : "3M"; - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - strFixedTenor, - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - adblCoupon[i], - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 4, - strFloatingTenor, - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - strFixedTenor, - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - strFixedTenor, - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - strFloatingTenor, - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent ois = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - ois.setPrimaryCode ("OIS." + astrMaturityTenor[i] + "." + strCurrency); - - aOIS[i] = ois; - } - - return aOIS; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - - JulianDate dtToday = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - MergedDiscountForwardCurve dcOIS = OISDiscountCurve ( - dtToday, - strCurrency, - "OVERNIGHT INDEX RUN RECONCILIATION" - ); - - ForwardCurve fc = MakexMForwardCurve ( - dtToday, - strCurrency, - dcOIS, - 3, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - "ReferenceParBasisSpread", - new double[] { - 0.00186, // 1Y - 0.00127, // 2Y - 0.00097, // 3Y - 0.00080, // 4Y - 0.00067, // 5Y - 0.00058, // 6Y - 0.00051, // 7Y - 0.00046, // 8Y - 0.00042, // 9Y - 0.00038, // 10Y - 0.00035, // 11Y - 0.00033, // 12Y - 0.00028, // 15Y - 0.00022, // 20Y - 0.00020, // 25Y - 0.00018 // 30Y - } - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dcOIS, - null, - null, - null, - null, - null, - null - ); - - mktParams.setForwardState (fc); - - String[] astrMaturityTenor = new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }; - - FloatFloatComponent[] aFedFundLIBORSwap = FedFundLIBORBasisSwap ( - dtToday, - strCurrency, - astrMaturityTenor - ); - - FixFloatComponent[] aOIS = OISFromMaturityTenor ( - dtToday, - strCurrency, - astrMaturityTenor, - new double[] { - 0.00002, - 0.00036, - 0.00127, - 0.00274, - 0.00456, - 0.00647, - 0.00827, - 0.00996, - 0.01147, - 0.01280, - 0.01404, - 0.01516, - 0.01764, - 0.01939, - 0.02003, - 0.02038 - } - ); - - FixFloatComponent[] aIRS = SwapInstrumentsFromMaturityTenor ( - dtToday, - astrMaturityTenor, - new double[] { - 0.00002, - 0.00036, - 0.00127, - 0.00274, - 0.00456, - 0.00647, - 0.00827, - 0.00996, - 0.01147, - 0.01280, - 0.01404, - 0.01516, - 0.01764, - 0.01939, - 0.02003, - 0.02038 - }, - strCurrency - ); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - strCurrency - ); - - System.out.println ("\n\t--------------------------------------------------------------------------"); - - System.out.println ("\t FED FUND OIS BASIS COMPARISON"); - - System.out.println ("\t--------------------------------------------------------------------------"); - - System.out.println ("\t\tOutput Order[Effective Date - Maturity Date]"); - - System.out.println ("\t\t\t IRS Rate (%)"); - - System.out.println ("\t\t\t Fed Fund LIBOR Basis (bp)"); - - System.out.println ("\t\t\t OIS Rate Uncompounded (%) (Bloomberg 2010 Methodology)"); - - System.out.println ("\t\t\t OIS Rate Daily Compounded (%) (Bloomberg 2010 Methodology)"); - - System.out.println ("\t\t\t OIS Rate (%) From Full Calibration\n"); - - System.out.println ("\t--------------------------------------------------------------------------"); - - for (int i = 0; i < aFedFundLIBORSwap.length; ++i) { - Map mapOIS = aOIS[i].value ( - valParams, - null, - mktParams, - null - ); - - Map mapIRS = aIRS[i].value ( - valParams, - null, - mktParams, - null - ); - - double dblOISRate = mapOIS.get ("SwapRate"); - - double dblIRSRate = mapIRS.get ("SwapRate"); - - double dblLIBORFedFundBasis = dblIRSRate - dblOISRate; - - System.out.println ("\t[" + - aFedFundLIBORSwap[i].effectiveDate() + " - " + - aFedFundLIBORSwap[i].maturityDate() + "] => " + - FormatUtil.FormatDouble (dblIRSRate, 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dblLIBORFedFundBasis, 1, 1, 10000.) + " | " + - FormatUtil.FormatDouble (Helper.OISFromLIBORSwapFedFundBasis (dblIRSRate, -dblLIBORFedFundBasis), 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (Helper.OISFromLIBORSwapFedFundBasis2 (dblIRSRate, -dblLIBORFedFundBasis), 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dblOISRate, 1, 4, 100.) + "%" - ); - } - - System.out.println ("\t--------------------------------------------------------------------------"); - } -} diff --git a/org/drip/sample/fedfund/FedFundOvernightCompounding.java b/org/drip/sample/fedfund/FedFundOvernightCompounding.java deleted file mode 100644 index b2e95d3..0000000 --- a/org/drip/sample/fedfund/FedFundOvernightCompounding.java +++ /dev/null @@ -1,709 +0,0 @@ - -package org.drip.sample.fedfund; - -import java.util.*; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.analytics.daycount.Convention; -import org.drip.analytics.output.CompositePeriodCouponMetrics; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.*; -import org.drip.market.definition.OvernightIndex; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.*; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FedFundOvernightCompounding demonstrates in detail the methodology behind the overnight compounding used - * in the Overnight fund Floating Stream Accrual. - * - * @author Lakshmi Krishnamurthy - */ - -public class FedFundOvernightCompounding { - - private static final FixFloatComponent OTCOISFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = OvernightFixedFloatContainer.FundConventionFromJurisdiction ( - strCurrency - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - for (int i = 0; i < aiDay.length; ++i) - aDeposit[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - OvernightLabel.Create ( - strCurrency - ) - ); - - return aDeposit; - } - - /* - * Construct the Array of Overnight Index Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OISFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aOIS[i] = OTCOISFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aOIS; - } - - /* - * Construct the Array of Overnight Index Future Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OISFuturesFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrStartTenor, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOISFutures = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aOISFutures[i] = OTCOISFixFloat ( - dtSpot.addTenor (astrStartTenor[i]), - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aOISFutures; - } - - private static final MergedDiscountForwardCurve CustomOISCurveBuilderSample ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 3 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0004, 0.0004, 0.0004 // Deposit - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - " DEPOSIT ", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of Short End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - CalibratableComponent[] aShortEndOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "1W", "2W", "3W", "1M" - }, - adblShortEndOISQuote - ); - - /* - * Construct the Short End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisShortEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SHORT END OIS", - aShortEndOISComp, - "SwapRate", - adblShortEndOISQuote - ); - - /* - * Construct the Array of OIS Futures Instruments and their Quotes from the given set of parameters - */ - - double[] adblOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - CalibratableComponent[] aOISFutureComp = OISFuturesFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "1M", "2M", "3M", "4M", "5M" - }, - new java.lang.String[] { - "1M", "1M", "1M", "1M", "1M" - }, - adblOISFutureQuote - ); - - /* - * Construct the OIS Future Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisFutureStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - " OIS FUTURE ", - aOISFutureComp, - "SwapRate", - adblOISFutureQuote - ); - - /* - * Construct the Array of Long End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - CalibratableComponent[] aLongEndOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "15M", "18M", "21M", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - adblLongEndOISQuote - ); - - /* - * Construct the Long End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisLongEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "LONG END OIS ", - aLongEndOISComp, - "SwapRate", - adblLongEndOISQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - oisShortEndStretch, - oisFutureStretch, - oisLongEndStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - */ - - return ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - null, - null, - null, - 1. - ); - } - - private static final LatentStateFixingsContainer SetFlatOvernightFixings ( - final JulianDate dtStart, - final JulianDate dtEnd, - final JulianDate dtValue, - final ForwardLabel fri, - final double dblFlatFixing, - final double dblNotional) - throws Exception - { - LatentStateFixingsContainer lsfc = new LatentStateFixingsContainer(); - - double dblAccount = 1.; - - lsfc.add ( - dtStart, - fri, - dblFlatFixing - ); - - int iPrevDate = dtStart.julian(); - - JulianDate dt = dtStart.addDays (1); - - while (dt.julian() <= dtEnd.julian()) { - lsfc.add ( - dt, - fri, - dblFlatFixing - ); - - if (dt.julian() <= dtValue.julian()) { - double dblAccrualFraction = Convention.YearFraction ( - iPrevDate, - dt.julian(), - "Act/360", - false, - null, - "USD" - ); - - dblAccount *= (1. + dblFlatFixing * dblAccrualFraction); - } - - iPrevDate = dt.julian(); - - dt = dt.addBusDays ( - 1, - "USD" - ); - } - - System.out.println ("\tManual Calc Float Accrued (Geometric Compounding): " + (dblAccount - 1.) * dblNotional); - - double dblDCF = (dtValue.julian() - dtStart.julian()) / 360.; - - System.out.println ("\tManual Calc Float Accrued (Arithmetic Compounding): " + - (dblDCF * dblNotional * dblFlatFixing)); - - System.out.println ("\tManual Calc Float Accrued DCF (Arithmetic Compounding): " + dblDCF); - - return lsfc; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - - JulianDate dtToday = DateUtil.CreateFromYMD ( - 2015, - DateUtil.JANUARY, - 5 - ); - - MergedDiscountForwardCurve dc = CustomOISCurveBuilderSample ( - dtToday, - strCurrency - ); - - JulianDate dtCustomOISStart = dtToday.subtractTenor ("2M"); - - JulianDate dtCustomOISMaturity = dtToday.addTenor ("4M"); - - OvernightLabel fri = OvernightLabel.Create ( - strCurrency - ); - - FundingLabel fundingLabel = FundingLabel.Standard (strCurrency); - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 360, - "Act/360", - false, - "Act/360", - false, - strCurrency, - false, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloatingArithmetic = new ComposableFloatingUnitSetting ( - "ON", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_OVERNIGHT, - null, - OvernightLabel.Create ( - strCurrency - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFloatingUnitSetting cfusFloatingGeometric = new ComposableFloatingUnitSetting ( - "ON", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_OVERNIGHT, - null, - ForwardLabel.Create ( - new OvernightIndex ( - strCurrency + "FedFund", - "FedFund", - strCurrency, - "Act/360", - strCurrency, - "ON", - 0, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ), - "ON" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - 0., - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 360, - "ON", - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - "6M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtCustomOISStart, - "6M", - "6M", - null - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtCustomOISStart, - "6M", - "6M", - null - ); - - Stream floatStreamGeometric = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloatingGeometric - ) - ); - - List lsArithmeticFloatPeriods = CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloatingArithmetic - ); - - Stream floatStreamArithmetic = new Stream (lsArithmeticFloatPeriods); - - Stream fixStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent oisArithmetic = new FixFloatComponent ( - fixStream, - floatStreamArithmetic, - new CashSettleParams ( - 0, - strCurrency, - 0 - ) - ); - - FixFloatComponent oisGeometric = new FixFloatComponent ( - fixStream, - floatStreamGeometric, - new CashSettleParams ( - 0, - strCurrency, - 0 - ) - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - SetFlatOvernightFixings ( - dtCustomOISStart, - dtCustomOISMaturity, - dtToday, - fri, - 0.003, - -1. - ) - ); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - strCurrency - ); - - Map mapOISGeometricOutput = oisGeometric.value ( - valParams, - null, - mktParams, - null - ); - - System.out.println ("\tMachine Calc Float Accrued (Geometric Compounding): " + mapOISGeometricOutput.get ("FloatAccrued")); - - Map mapOISArithmeticOutput = oisArithmetic.value ( - valParams, - null, - mktParams, - null - ); - - System.out.println ("\tMachine Calc Float Accrued (Arithmetic Compounding): " + mapOISArithmeticOutput.get ("FloatAccrued")); - - System.out.println ("\tMachine Calc Float Accrued DCF (Arithmetic Compounding): " + - Math.abs (mapOISGeometricOutput.get ("FloatAccrued") / mapOISGeometricOutput.get ("ResetRate"))); - - CompositePeriod period = lsArithmeticFloatPeriods.get (0); - - CompositePeriodCouponMetrics pcmArithmetic = floatStreamArithmetic.coupon ( - period.endDate(), - valParams, - mktParams - ); - - System.out.println ("\tPeriod #1 Coupon Without Convexity Adjustment: " + pcmArithmetic.rate()); - - double dblOISVol = 0.3; - double dblUSDFundingVol = 0.3; - double dblUSDFundingUSDOISCorrelation = 0.3; - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - valParams.valueDate(), - VolatilityLabel.Standard (fri), - fri.currency(), - dblOISVol - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - valParams.valueDate(), - VolatilityLabel.Standard (fundingLabel), - fri.currency(), - dblUSDFundingVol - ) - ); - - mktParams.setForwardFundingCorrelation ( - fri, - fundingLabel, - new FlatUnivariate (dblUSDFundingUSDOISCorrelation) - ); - - System.out.println ( - "\tPeriod #1 Coupon With Convexity Adjustment: " + floatStreamArithmetic.coupon ( - period.endDate(), - valParams, - mktParams - ).rate() - ); - } -} diff --git a/org/drip/sample/fedfund/OvernightFedFundLIBORSwap.java b/org/drip/sample/fedfund/OvernightFedFundLIBORSwap.java deleted file mode 100644 index a96e73a..0000000 --- a/org/drip/sample/fedfund/OvernightFedFundLIBORSwap.java +++ /dev/null @@ -1,1050 +0,0 @@ - -package org.drip.sample.fedfund; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.creator.ScenarioForwardCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * OvernightFedFundLIBORSwap demonstrates the Construction, the Valuation, and Bloomberg Metrics Analysis for - * the Composite Fed Fund vs. LIBOR Basis Swaps. - * - * @author Lakshmi Krishnamurthy - */ - -public class OvernightFedFundLIBORSwap { - - private static final FloatFloatComponent OTCFloatFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strDerivedTenor, - final String strMaturityTenor, - final double dblBasis) - { - FloatFloatSwapConvention ffConv = IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - return ffConv.createFloatFloatComponent ( - dtSpot, - strDerivedTenor, - strMaturityTenor, - dblBasis, - 1. - ); - } - - private static final FixFloatComponent OTCOISFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = OvernightFixedFloatContainer.FundConventionFromJurisdiction ( - strCurrency - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - for (int i = 0; i < aiDay.length; ++i) - aDeposit[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - OvernightLabel.Create ( - strCurrency - ) - ); - - return aDeposit; - } - - /* - * Construct the Array of Overnight Index Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OISFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aOIS[i] = OTCOISFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aOIS; - } - - /* - * Construct the Array of Overnight Index Future Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OISFuturesFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrStartTenor, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOISFutures = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aOISFutures[i] = OTCOISFixFloat ( - dtSpot.addTenor (astrStartTenor[i]), - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aOISFutures; - } - - private static final MergedDiscountForwardCurve OISDiscountCurve ( - final JulianDate dtSpot, - final String strCurrency, - final String strHeaderComment) - throws Exception - { - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t " + strHeaderComment); - - System.out.println ("\t----------------------------------------------------------------"); - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 3 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0004, 0.0004, 0.0004 // Deposit - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - " DEPOSIT ", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of Short End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - CalibratableComponent[] aShortEndOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "1W", "2W", "3W", "1M" - }, - adblShortEndOISQuote - ); - - /* - * Construct the Short End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisShortEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SHORT END OIS", - aShortEndOISComp, - "SwapRate", - adblShortEndOISQuote - ); - - /* - * Construct the Array of OIS Futures Instruments and their Quotes from the given set of parameters - */ - - double[] adblOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - CalibratableComponent[] aOISFutureComp = OISFuturesFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "1M", "2M", "3M", "4M", "5M" - }, - new java.lang.String[] { - "1M", "1M", "1M", "1M", "1M" - }, - adblOISFutureQuote - ); - - /* - * Construct the OIS Future Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisFutureStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - " OIS FUTURE ", - aOISFutureComp, - "SwapRate", - adblOISFutureQuote - ); - - /* - * Construct the Array of Long End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - CalibratableComponent[] aLongEndOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "15M", "18M", "21M", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - adblLongEndOISQuote - ); - - /* - * Construct the Long End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisLongEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "LONG END OIS ", - aLongEndOISComp, - "SwapRate", - adblLongEndOISQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - oisShortEndStretch, - oisFutureStretch, - oisLongEndStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit and Swap Stretches. - */ - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - CurveSurfaceQuoteContainer csqs = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Cross-Comparison of the Deposit Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t[" + aDepositComp[i].effectiveDate() + " => " + aDepositComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aDepositComp[i].measureValue (valParams, null, csqs, null, "Rate"), 1, 6, 1.) + - " | " + FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the Short End OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS SHORT END INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aShortEndOISComp.length; ++i) { - Map mapCalc = aShortEndOISComp[i].value ( - valParams, - null, - csqs, - null - ); - - double dblCalibSwapRate = mapCalc.get ("CalibSwapRate"); - - double dblFairPremium = mapCalc.get ("FairPremium"); - - System.out.println ("\t[" + aShortEndOISComp[i].effectiveDate() + " => " + aShortEndOISComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (dblCalibSwapRate, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblShortEndOISQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblFairPremium, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblFairPremium - dblCalibSwapRate, 1, 2, 10000.) - ); - } - - /* - * Cross-Comparison of the OIS Future Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS FUTURE INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aOISFutureComp.length; ++i) { - Map mapCalc = aOISFutureComp[i].value ( - valParams, - null, - csqs, - null - ); - - double dblSwapRate = mapCalc.get ("SwapRate"); - - double dblFairPremium = mapCalc.get ("FairPremium"); - - System.out.println ("\t[" + aOISFutureComp[i].effectiveDate() + " => " + aOISFutureComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (dblSwapRate, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblOISFutureQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblFairPremium, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblFairPremium - dblSwapRate, 1, 2, 10000.) - ); - } - - /* - * Cross-Comparison of the Long End OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS LONG END INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aLongEndOISComp.length; ++i) { - Map mapCalc = aLongEndOISComp[i].value ( - valParams, - null, - csqs, - null - ); - - double dblCalibSwapRate = mapCalc.get ("CalibSwapRate"); - - double dblFairPremium = mapCalc.get ("FairPremium"); - - System.out.println ("\t[" + aLongEndOISComp[i].effectiveDate() + " => " + aLongEndOISComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (dblCalibSwapRate, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblLongEndOISQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblFairPremium, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblFairPremium - dblCalibSwapRate, 1, 2, 10000.) - ); - } - - return dc; - } - - /* - * Construct an array of float-float swaps from the corresponding reference (6M) and the derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FloatFloatComponent[] MakexM6MBasisSwap ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final int iTenorInMonths) - throws Exception - { - FloatFloatComponent[] aFFC = new FloatFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aFFC[i] = OTCFloatFloat ( - dtSpot, - strCurrency, - iTenorInMonths + "M", - astrMaturityTenor[i], - 0. - ); - - return aFFC; - } - - private static final ForwardCurve MakexMForwardCurve ( - final JulianDate dtSpot, - final String strCurrency, - final MergedDiscountForwardCurve dc, - final int iTenorInMonths, - final String[] astrxM6MFwdTenor, - final String strManifestMeasure, - final double[] adblxM6MBasisSwapQuote) - throws Exception - { - /* - * Construct the 6M-xM float-float basis swap. - */ - - FloatFloatComponent[] aFFC = MakexM6MBasisSwap ( - dtSpot, - strCurrency, - astrxM6MFwdTenor, - iTenorInMonths - ); - - String strBasisTenor = iTenorInMonths + "M"; - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Calculate the starting forward rate off of the discount curve. - */ - - double dblStartingFwd = dc.forward ( - dtSpot.julian(), - dtSpot.addTenor (strBasisTenor).julian() - ); - - /* - * Set the discount curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Construct the shape preserving forward curve off of Cubic Polynomial Basis Spline. - */ - - return ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - "CUBIC_FWD" + strBasisTenor, - ForwardLabel.Create ( - strCurrency, - strBasisTenor - ), - valParams, - null, - mktParams, - null, - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - aFFC, - strManifestMeasure, - adblxM6MBasisSwapQuote, - dblStartingFwd - ); - } - - private static final FloatFloatComponent[] FedFundLIBORBasisSwap ( - final JulianDate dtEffective, - final String strCurrency, - final String[] astrMaturityTenor) - throws Exception - { - FloatFloatComponent[] aFFC = new FloatFloatComponent[astrMaturityTenor.length]; - - ComposableFloatingUnitSetting cfusLIBOR = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Standard (strCurrency + "-3M"), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFloatingUnitSetting cfusFedFund = new ComposableFloatingUnitSetting ( - "ON", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_OVERNIGHT, - null, - OvernightLabel.Create ( - strCurrency - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cpsLIBOR = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFedFund = new CompositePeriodSetting ( - 360, - "ON", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - List lsLIBORStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - astrMaturityTenor[i], - null - ); - - List lsFedFundStreamEdgeDate = CompositePeriodBuilder.OvernightEdgeDates ( - dtEffective, - dtEffective.addTenor (astrMaturityTenor[i]), - strCurrency - ); - - Stream streamLIBOR = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsLIBORStreamEdgeDate, - cpsLIBOR, - cfusLIBOR - ) - ); - - Stream streamFedFund = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFedFundStreamEdgeDate, - cpsFedFund, - cfusFedFund - ) - ); - - aFFC[i] = new FloatFloatComponent ( - streamLIBOR, - streamFedFund, - csp - ); - } - - return aFFC; - } - - /* - * Construct the Array of Overnight Index Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtEffective, - final String[] astrMaturityTenor, - final double[] adblCoupon, - final String strCurrency) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrMaturityTenor.length]; - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - false, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - java.lang.String strFixedTenor = Helper.LEFT_TENOR_LESSER == Helper.TenorCompare ( - astrMaturityTenor[i], - "6M" - ) ? astrMaturityTenor[i] : "6M"; - - java.lang.String strFloatingTenor = Helper.LEFT_TENOR_LESSER == Helper.TenorCompare ( - astrMaturityTenor[i], - "3M" - ) ? astrMaturityTenor[i] : "3M"; - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - strFixedTenor, - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - adblCoupon[i], - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 4, - strFloatingTenor, - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - strFixedTenor, - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - strFixedTenor, - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - strFloatingTenor, - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent ois = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - ois.setPrimaryCode ("OIS." + astrMaturityTenor[i] + "." + strCurrency); - - aOIS[i] = ois; - } - - return aOIS; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - - JulianDate dtToday = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - MergedDiscountForwardCurve dcOIS = OISDiscountCurve ( - dtToday, - strCurrency, - "OVERNIGHT INDEX RUN RECONCILIATION" - ); - - ForwardCurve fc = MakexMForwardCurve ( - dtToday, - strCurrency, - dcOIS, - 3, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - "ReferenceParBasisSpread", - new double[] { - 0.00186, // 1Y - 0.00127, // 2Y - 0.00097, // 3Y - 0.00080, // 4Y - 0.00067, // 5Y - 0.00058, // 6Y - 0.00051, // 7Y - 0.00046, // 8Y - 0.00042, // 9Y - 0.00038, // 10Y - 0.00035, // 11Y - 0.00033, // 12Y - 0.00028, // 15Y - 0.00022, // 20Y - 0.00020, // 25Y - 0.00018 // 30Y - } - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dcOIS, - null, - null, - null, - null, - null, - null - ); - - mktParams.setForwardState (fc); - - String[] astrMaturityTenor = new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }; - - FloatFloatComponent[] aFedFundLIBORSwap = FedFundLIBORBasisSwap ( - dtToday, - strCurrency, - astrMaturityTenor - ); - - FixFloatComponent[] aOIS = OISFromMaturityTenor ( - dtToday, - strCurrency, - astrMaturityTenor, - new double[] { - 0.00002, - 0.00036, - 0.00127, - 0.00274, - 0.00456, - 0.00647, - 0.00827, - 0.00996, - 0.01147, - 0.01280, - 0.01404, - 0.01516, - 0.01764, - 0.01939, - 0.02003, - 0.02038 - } - ); - - FixFloatComponent[] aIRS = SwapInstrumentsFromMaturityTenor ( - dtToday, - astrMaturityTenor, - new double[] { - 0.00002, - 0.00036, - 0.00127, - 0.00274, - 0.00456, - 0.00647, - 0.00827, - 0.00996, - 0.01147, - 0.01280, - 0.01404, - 0.01516, - 0.01764, - 0.01939, - 0.02003, - 0.02038 - }, - strCurrency - ); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - strCurrency - ); - - System.out.println ("\n\t--------------------------------------------------------------------------"); - - System.out.println ("\t FED FUND OIS BASIS COMPARISON"); - - System.out.println ("\t--------------------------------------------------------------------------"); - - System.out.println ("\t\tOutput Order[Effective Date - Maturity Date]"); - - System.out.println ("\t\t\t IRS Rate (%)"); - - System.out.println ("\t\t\t Fed Fund LIBOR Basis (bp)"); - - System.out.println ("\t\t\t OIS Rate Uncompounded (%) (Bloomberg 2010 Methodology)"); - - System.out.println ("\t\t\t OIS Rate Daily Compounded (%) (Bloomberg 2010 Methodology)"); - - System.out.println ("\t\t\t OIS Rate (%) From Full Calibration\n"); - - System.out.println ("\t--------------------------------------------------------------------------"); - - for (int i = 0; i < aFedFundLIBORSwap.length; ++i) { - Map mapOIS = aOIS[i].value ( - valParams, - null, - mktParams, - null - ); - - Map mapIRS = aIRS[i].value ( - valParams, - null, - mktParams, - null - ); - - double dblOISRate = mapOIS.get ("SwapRate"); - - double dblIRSRate = mapIRS.get ("SwapRate"); - - double dblLIBORFedFundBasis = dblIRSRate - dblOISRate; - - System.out.println ("\t[" + - aFedFundLIBORSwap[i].effectiveDate() + " - " + - aFedFundLIBORSwap[i].maturityDate() + "] => " + - FormatUtil.FormatDouble (dblIRSRate, 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dblLIBORFedFundBasis, 1, 1, 10000.) + " | " + - FormatUtil.FormatDouble (Helper.OISFromLIBORSwapFedFundBasis (dblIRSRate, -dblLIBORFedFundBasis), 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (Helper.OISFromLIBORSwapFedFundBasis2 (dblIRSRate, -dblLIBORFedFundBasis), 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dblOISRate, 1, 4, 100.) + "%" - ); - } - - System.out.println ("\t--------------------------------------------------------------------------"); - } -} diff --git a/org/drip/sample/fixfloat/AmortizingCapitalizingAccruingSwap.java b/org/drip/sample/fixfloat/AmortizingCapitalizingAccruingSwap.java deleted file mode 100644 index c91df60..0000000 --- a/org/drip/sample/fixfloat/AmortizingCapitalizingAccruingSwap.java +++ /dev/null @@ -1,660 +0,0 @@ - -package org.drip.sample.fixfloat; - -import java.util.List; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.rates.*; -import org.drip.quant.common.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * AmortizingCapitalizingAccruingSwap demonstrates the construction and Valuation of in-advance Amortizing, - * Accruing, and Capitalizing Swaps. - * - * @author Lakshmi Krishnamurthy - */ - -public class AmortizingCapitalizingAccruingSwap { - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < aiDay.length; ++i) { - aDeposit[i] = new SingleStreamComponent ( - "DEPOSIT_" + aiDay[i], - new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.EdgePair ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ) - ), - cps, - cfus - ) - ), - csp - ); - - aDeposit[i].setPrimaryCode (aiDay[i] + "D"); - } - - return aDeposit; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtEffective, - final String strCurrency, - final Array2D fsNotional, - final String[] astrMaturityTenor) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - true, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCurrency, - "6M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - 0., - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 2, - "6M", - strCurrency, - null, - -1., - null, - fsNotional, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - "6M", - strCurrency, - null, - 1., - null, - fsNotional, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent irs = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - private static final Array2D StepDown ( - final JulianDate dtSpot) - { - return Array2D.FromArray ( - new double[] { - dtSpot.julian(), - dtSpot.addYears (2).julian(), - dtSpot.addYears (4).julian(), - dtSpot.addYears (6).julian(), - dtSpot.addYears (10).julian(), - dtSpot.addYears (15).julian(), - dtSpot.addYears (21).julian(), - dtSpot.addYears (29).julian(), - dtSpot.addYears (36).julian(), - dtSpot.addYears (51).julian() - }, - new double[] { - 1.00, - 0.99, - 0.97, - 0.94, - 0.90, - 0.85, - 0.78, - 0.70, - 0.61, - 0.51 - } - ); - } - - private static final Array2D StepUp ( - final JulianDate dtSpot) - { - return Array2D.FromArray ( - new double[] { - dtSpot.julian(), - dtSpot.addYears (2).julian(), - dtSpot.addYears (4).julian(), - dtSpot.addYears (6).julian(), - dtSpot.addYears (10).julian(), - dtSpot.addYears (15).julian(), - dtSpot.addYears (21).julian(), - dtSpot.addYears (29).julian(), - dtSpot.addYears (36).julian(), - dtSpot.addYears (51).julian() - }, - new double[] { - 1.00, - 1.01, - 1.03, - 1.06, - 1.10, - 1.15, - 1.21, - 1.28, - 1.36, - 1.45 - } - ); - } - - /* - * This sample demonstrates discount curve calibration and input instrument calibration quote recovery. - * It shows the following: - * - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void CustomDiscountCurveBuilderSample ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 7, 14, 30, 60 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0013, 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of EDF Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aEDFComp = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtSpot, - 8, - strCurrency - ); - - double[] adblEDFQuote = new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }; - - /* - * Construct the EDF Instrument Set Stretch Builder - */ - - LatentStateStretchSpec edfStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "EDF", - aEDFComp, - "ForwardRate", - adblEDFQuote - ); - - /* - * Construct the Array of Swap Instruments and their Quotes from the given set of parameters - */ - - FixFloatComponent[] aSwapInAdvance = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - null, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - } - ); - - FixFloatComponent[] aSwapInAdvanceAccruing = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - StepUp (dtSpot), - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - } - ); - - FixFloatComponent[] aSwapInAdvanceAmortizing = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - StepDown (dtSpot), - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - } - ); - - double[] adblSwapQuote = new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }; - - /* - * Construct the Swap Instrument Set Stretch Builder - */ - - LatentStateStretchSpec swapStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SWAP", - aSwapInAdvance, - "SwapRate", - adblSwapQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - edfStretch, - swapStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit, Futures, and Swap Stretches. - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - CurveSurfaceQuoteContainer csqs = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Cross-Comparison of the In-Advance/Arrears Swap "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t-------------------------------------------------------------------------------"); - - System.out.println ("\t IN-ADVANCE AMORTIZING/ACCRUING SWAP METRIC COMPARISON"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - System.out.println ("\t\tL -> R:"); - - System.out.println ("\t\t\t - Swap Maturity"); - - System.out.println ("\t\t\t - In Advance Calibration Quote"); - - System.out.println ("\t\t\t - In Advance Fair Premium"); - - System.out.println ("\t\t\t - In Advance Swap Rate"); - - System.out.println ("\t\t\t - In Advance Accruing Swap Rate"); - - System.out.println ("\t\t\t - In Advance Amortizing Swap Rate"); - - System.out.println ("\t\t\t - In Advance Accruing Swap Rate Shift"); - - System.out.println ("\t\t\t - In Advance Amortizing Swap Rate Shift"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - for (int i = 0; i < aSwapInAdvance.length; ++i) { - double dblInAdvanceStepUpFairPremium = aSwapInAdvanceAccruing[i].measureValue ( - valParams, - null, - csqs, - null, - "FairPremium" - ); - - double dblInAdvanceStepDownFairPremium = aSwapInAdvanceAmortizing[i].measureValue ( - valParams, - null, - csqs, - null, - "FairPremium" - ); - - System.out.println ("\t[" + aSwapInAdvance[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aSwapInAdvance[i].measureValue (valParams, null, csqs, null, "CalibSwapRate"), 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (adblSwapQuote[i], 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (aSwapInAdvance[i].measureValue (valParams, null, csqs, null, "FairPremium"), 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dblInAdvanceStepUpFairPremium, 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dblInAdvanceStepUpFairPremium - adblSwapQuote[i], 1, 0, 10000.) + " | " + - FormatUtil.FormatDouble (dblInAdvanceStepDownFairPremium, 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dblInAdvanceStepDownFairPremium - adblSwapQuote[i], 1, 0, 10000.) - ); - } - - System.out.println ("\n\t-------------------------------------------------------------------------------"); - - System.out.println ("\t IN-ADVANCE AMORTIZING/ACCRUING SWAP DV01 COMPARISON"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - System.out.println ("\t\tL -> R:"); - - System.out.println ("\t\t\t - Swap Maturity"); - - System.out.println ("\t\t\t - In Advance Swap DV01"); - - System.out.println ("\t\t\t - In Advance Accruing Swap DV01"); - - System.out.println ("\t\t\t - In Advance Accruing Swap DV01 Shift"); - - System.out.println ("\t\t\t - In Advance Amortizing Swap DV01"); - - System.out.println ("\t\t\t - In Advance Amortizing Swap DV01 Shift"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - for (int i = 0; i < aSwapInAdvance.length; ++i) { - double dblInAdvanceDV01 = aSwapInAdvance[i].measureValue ( - valParams, - null, - csqs, - null, - "FixedDV01" - ); - - double dblInAdvanceStepUpDV01 = aSwapInAdvanceAccruing[i].measureValue ( - valParams, - null, - csqs, - null, - "FixedDV01" - ); - - double dblInAdvanceStepDownDV01 = aSwapInAdvanceAmortizing[i].measureValue ( - valParams, - null, - csqs, - null, - "FixedDV01" - ); - - System.out.println ("\t[" + aSwapInAdvance[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (dblInAdvanceDV01, 2, 1, 10000.) + " | " + - FormatUtil.FormatDouble (dblInAdvanceStepUpDV01, 2, 1, 10000.) + " | " + - FormatUtil.FormatDouble (dblInAdvanceStepUpDV01 - dblInAdvanceDV01, 1, 2, 10000.) + " | " + - FormatUtil.FormatDouble (dblInAdvanceStepDownDV01, 2, 1, 10000.) + " | " + - FormatUtil.FormatDouble (dblInAdvanceStepDownDV01 - dblInAdvanceDV01, 1, 2, 10000.) - ); - } - - System.out.println ("\t-------------------------------------------------------------------------------"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - String strCurrency = "USD"; - - CustomDiscountCurveBuilderSample ( - dtToday, - strCurrency - ); - } -} diff --git a/org/drip/sample/fixfloat/CustomFixFloatSwap.java b/org/drip/sample/fixfloat/CustomFixFloatSwap.java deleted file mode 100644 index 995b4e4..0000000 --- a/org/drip/sample/fixfloat/CustomFixFloatSwap.java +++ /dev/null @@ -1,637 +0,0 @@ - -package org.drip.sample.fixfloat; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.analytics.daycount.*; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CustomFixFloatSwap demonstrates the Construction and Valuation of a Custom Fix-Float Swap. - * - * @author Lakshmi Krishnamurthy - */ - -public class CustomFixFloatSwap { - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final String strFloaterTenor, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - strFloaterTenor, - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - ForwardLabel.Create ( - strCurrency, - strFloaterTenor - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - Helper.TenorToFreq (strFloaterTenor), - strFloaterTenor, - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < aiDay.length; ++i) { - aDeposit[i] = new SingleStreamComponent ( - "DEPOSIT_" + aiDay[i], - new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.EdgePair ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ) - ), - cps, - cfus - ) - ), - csp - ); - - aDeposit[i].setPrimaryCode (aiDay[i] + "D"); - } - - return aDeposit; - } - - private static final FixFloatComponent CustomIRS ( - final JulianDate dtEffective, - final String strCurrency, - final JulianDate dtMaturity, - final String strFixedDayCount, - final double dblFixedCoupon, - final String strFixedTenor, - final String strFloaterComposableTenor, - final String strFloaterCompositeTenor, - final double dblNotional) - throws Exception - { - List lsFixedStreamEdgeDate = CompositePeriodBuilder.BackwardEdgeDates ( - dtEffective, - dtMaturity, - strFixedTenor, - new DateAdjustParams ( - Convention.DATE_ROLL_FOLLOWING, - 0, - strCurrency - ), - CompositePeriodBuilder.SHORT_STUB - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.BackwardEdgeDates ( - dtEffective, - dtMaturity, - strFloaterCompositeTenor, - new DateAdjustParams ( - Convention.DATE_ROLL_FOLLOWING, - 0, - strCurrency - ), - CompositePeriodBuilder.SHORT_STUB - ); - - return CustomIRS ( - dtEffective, - strCurrency, - lsFixedStreamEdgeDate, - lsFloatingStreamEdgeDate, - strFixedDayCount, - dblFixedCoupon, - strFixedTenor, - strFloaterComposableTenor, - strFloaterCompositeTenor, - dblNotional - ); - } - - private static final FixFloatComponent CustomIRS ( - final JulianDate dtEffective, - final String strCurrency, - final String strMaturityTenor, - final String strFixedDayCount, - final double dblFixedCoupon, - final String strFixedTenor, - final String strFloaterComposableTenor, - final String strFloaterCompositeTenor, - final double dblNotional) - throws Exception - { - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - strFixedTenor, - strMaturityTenor, - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - strFloaterComposableTenor, - strMaturityTenor, - null - ); - - return CustomIRS ( - dtEffective, - strCurrency, - lsFixedStreamEdgeDate, - lsFloatingStreamEdgeDate, - strFixedDayCount, - dblFixedCoupon, - strFixedTenor, - strFloaterComposableTenor, - strFloaterCompositeTenor, - dblNotional - ); - } - - /* - * Construct the Custom Fix-Float Instrument from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent CustomIRS ( - final JulianDate dtEffective, - final String strCurrency, - List lsFixedStreamEdgeDate, - List lsFloatingStreamEdgeDate, - final String strFixedDayCount, - final double dblFixedCoupon, - final String strFixedTenor, - final String strFloaterComposableTenor, - final String strFloaterCompositeTenor, - final double dblNotional) - throws Exception - { - int iFixedFreq = Helper.TenorToFreq (strFixedTenor); - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - iFixedFreq, - strFixedDayCount, - false, - strFixedDayCount, - false, - strCurrency, - false, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - strFloaterComposableTenor, - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - new DateAdjustParams ( - Convention.DATE_ROLL_FOLLOWING, - 0, - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - strFloaterComposableTenor - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - strFixedTenor, - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - new DateAdjustParams ( - Convention.DATE_ROLL_FOLLOWING, - 0, - strCurrency - ), - dblFixedCoupon, - 0., - strCurrency - ); - - int iFloaterFreq = Helper.TenorToFreq (strFloaterCompositeTenor); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - iFloaterFreq, - strFloaterCompositeTenor, - strCurrency, - null, - -1. * dblNotional, - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - iFixedFreq, - strFixedTenor, - strCurrency, - null, - 1. * dblNotional, - null, - null, - null, - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent irs = new FixFloatComponent ( - fixedStream, - floatingStream, - null - ); - - return irs; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtEffective, - final String strCurrency, - final String strFixedDayCount, - final double dblFixedCoupon, - final String strFixedTenor, - final String strFloaterComposableTenor, - final String strFloaterCompositeTenor, - final String[] astrMaturityTenor) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - FixFloatComponent irs = CustomIRS( - dtEffective, - strCurrency, - astrMaturityTenor[i], - strFixedDayCount, - dblFixedCoupon, - strFixedTenor, - strFloaterComposableTenor, - strFloaterCompositeTenor, - 1. - ); - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - /* - * This sample demonstrates discount curve calibration and input instrument calibration quote recovery. - * It shows the following: - * - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void CustomDiscountCurveBuilderSample ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - String strFloaterTenor = "3M"; - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - strFloaterTenor, - new int[] { - 1, 2, 7, 14, 30, 60 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0013, 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of EDF Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aEDFComp = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtSpot, - 8, - strCurrency - ); - - double[] adblEDFQuote = new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }; - - /* - * Construct the EDF Instrument Set Stretch Builder - */ - - LatentStateStretchSpec edfStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "EDF", - aEDFComp, - "ForwardRate", - adblEDFQuote - ); - - /* - * Construct the Array of Swap Instruments and their Quotes from the given set of parameters - */ - - String strFixedDayCount = "Act/360"; - double dblFixedCoupon = 0.01; - String strFixedTenor = "6M"; - String strFloaterComposableTenor = "6M"; - String strFloaterCompositeTenor = "6M"; - - FixFloatComponent[] aSwapInAdvance = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - strFixedDayCount, - dblFixedCoupon, - strFixedTenor, - strFloaterComposableTenor, - strFloaterCompositeTenor, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - } - ); - - double[] adblSwapQuote = new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }; - - /* - * Construct the Swap Instrument Set Stretch Builder - */ - - LatentStateStretchSpec swapStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SWAP", - aSwapInAdvance, - "SwapRate", - adblSwapQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - edfStretch, - swapStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit, Futures, and Swap Stretches. - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - CurveSurfaceQuoteContainer csqs = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - System.out.println ("\n\t-------------------------------------------------------------------------------\n"); - - JulianDate dtCustomEffective = dtSpot.addTenor ("1Y"); - - JulianDate dtCustomMaturity = dtSpot.addTenor ("11Y"); - - String strCustomFixedDayCount = "Act/360"; - double dblCustomFixedCoupon = 0.01; - String strCustomFixedTenor = "6M"; - String strCustomFloaterComposableTenor = "6M"; - String strCustomFloaterCompositeTenor = "6M"; - double dblCustomNotional = 1.0e6; - - FixFloatComponent ffcSwap = CustomIRS ( - dtCustomEffective, - strCurrency, - dtCustomMaturity, - strCustomFixedDayCount, - dblCustomFixedCoupon, - strCustomFixedTenor, - strCustomFloaterComposableTenor, - strCustomFloaterCompositeTenor, - dblCustomNotional - ); - - Map mapSwap = ffcSwap.value ( - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - null, - csqs, - null - ); - - for (Map.Entry me : mapSwap.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + FormatUtil.FormatDouble (me.getValue(), 1, 8, 1.) + " |"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - String strCurrency = "USD"; - - CustomDiscountCurveBuilderSample ( - dtToday, - strCurrency - ); - } -} diff --git a/org/drip/sample/fixfloat/InAdvanceIMMSwap.java b/org/drip/sample/fixfloat/InAdvanceIMMSwap.java deleted file mode 100644 index 228cc97..0000000 --- a/org/drip/sample/fixfloat/InAdvanceIMMSwap.java +++ /dev/null @@ -1,572 +0,0 @@ - -package org.drip.sample.fixfloat; - -import java.util.List; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * InAdvanceIMMSwap demonstrates the Construction and Valuation of a In-Advance IMM Swap. - * - * @author Lakshmi Krishnamurthy - */ - -public class InAdvanceIMMSwap { - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < aiDay.length; ++i) { - aDeposit[i] = new SingleStreamComponent ( - "DEPOSIT_" + aiDay[i], - new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.EdgePair ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ) - ), - cps, - cfus - ) - ), - csp - ); - - aDeposit[i].setPrimaryCode (aiDay[i] + "D"); - } - - return aDeposit; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtEffective, - final String strCurrency, - final String[] astrMaturityTenor, - final boolean bIsIMM) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - true, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCurrency, - "6M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - 0., - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 2, - "6M", - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - "6M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - List lsFixedStreamEdgeDate = !bIsIMM ? CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - astrMaturityTenor[i], - null - ) : CompositePeriodBuilder.IMMEdgeDates ( - dtEffective, - 3, - "6M", - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = !bIsIMM ? CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - astrMaturityTenor[i], - null - ) : CompositePeriodBuilder.IMMEdgeDates ( - dtEffective, - 3, - "6M", - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent irs = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - /* - * This sample demonstrates discount curve calibration and input instrument calibration quote recovery. - * It shows the following: - * - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void CustomDiscountCurveBuilderSample ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 7, 14, 30, 60 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0013, 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of EDF Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aEDFComp = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtSpot, - 8, - strCurrency - ); - - double[] adblEDFQuote = new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }; - - /* - * Construct the EDF Instrument Set Stretch Builder - */ - - LatentStateStretchSpec edfStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "EDF", - aEDFComp, - "ForwardRate", - adblEDFQuote - ); - - /* - * Construct the Array of Swap Instruments and their Quotes from the given set of parameters - */ - - FixFloatComponent[] aSwapInAdvance = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - false - ); - - FixFloatComponent[] aSwapInAdvanceIMM = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - true - ); - - double[] adblSwapQuote = new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }; - - /* - * Construct the Swap Instrument Set Stretch Builder - */ - - LatentStateStretchSpec swapStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SWAP", - aSwapInAdvance, - "SwapRate", - adblSwapQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - edfStretch, - swapStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit, Futures, and Swap Stretches. - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - CurveSurfaceQuoteContainer csqs = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Cross-Comparison of the In-Advance/Arrears Swap "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t-------------------------------------------------------------------------------"); - - System.out.println ("\t IN-ADVANCE W+W/O IMM SWAP INSTRUMENTS METRIC COMPARISON"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - System.out.println ("\t\tL -> R:"); - - System.out.println ("\t\t\t - Swap Maturity"); - - System.out.println ("\t\t\t - In Advance Calibration Quote"); - - System.out.println ("\t\t\t - In Advance Fair Premium"); - - System.out.println ("\t\t\t - In Advance Swap Rate"); - - System.out.println ("\t\t\t - In Advance IMM Swap Rate"); - - System.out.println ("\t\t\t - In Advance IMM Swap Rate Shift"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - for (int i = 0; i < aSwapInAdvance.length; ++i) { - double dblInAdvanceIMMFairPremium = aSwapInAdvanceIMM[i].measureValue ( - valParams, - null, - csqs, - null, - "FairPremium" - ); - - System.out.println ("\t[" + aSwapInAdvance[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aSwapInAdvance[i].measureValue (valParams, null, csqs, null, "CalibSwapRate"), 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (adblSwapQuote[i], 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (aSwapInAdvance[i].measureValue (valParams, null, csqs, null, "FairPremium"), 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dblInAdvanceIMMFairPremium, 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dblInAdvanceIMMFairPremium - adblSwapQuote[i], 1, 0, 10000.) - ); - } - - System.out.println ("\n\t-------------------------------------------------------------------------------"); - - System.out.println ("\t IN-ADVANCE W+W/O IMM SWAP INSTRUMENTS DV01 COMPARISON"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - System.out.println ("\t\tL -> R:"); - - System.out.println ("\t\t\t - Swap Maturity"); - - System.out.println ("\t\t\t - In Advance Swap DV01"); - - System.out.println ("\t\t\t - In Advance IMM Swap DV01"); - - System.out.println ("\t\t\t - In Advance IMM Swap DV01 Shift"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - for (int i = 0; i < aSwapInAdvance.length; ++i) { - double dblInAdvanceDV01 = aSwapInAdvance[i].measureValue ( - valParams, - null, - csqs, - null, - "FixedDV01" - ); - - double dblInAdvanceIMMDV01 = aSwapInAdvanceIMM[i].measureValue ( - valParams, - null, - csqs, - null, - "FixedDV01" - ); - - System.out.println ("\t[" + aSwapInAdvance[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (dblInAdvanceDV01, 2, 1, 10000.) + " | " + - FormatUtil.FormatDouble (dblInAdvanceIMMDV01, 2, 1, 10000.) + " | " + - FormatUtil.FormatDouble (dblInAdvanceIMMDV01 - dblInAdvanceDV01, 1, 2, 10000.) - ); - } - - System.out.println ("\t-------------------------------------------------------------------------------"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - String strCurrency = "USD"; - - CustomDiscountCurveBuilderSample ( - dtToday, - strCurrency - ); - } -} diff --git a/org/drip/sample/fixfloat/InAdvanceSwap.java b/org/drip/sample/fixfloat/InAdvanceSwap.java deleted file mode 100644 index b851541..0000000 --- a/org/drip/sample/fixfloat/InAdvanceSwap.java +++ /dev/null @@ -1,442 +0,0 @@ - -package org.drip.sample.fixfloat; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * InAdvanceSwap discount curve calibration and input instrument calibration quote recovery. It shows - * the following: - * - Construct the Array of Deposit/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Deposit/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - * @author Lakshmi Krishnamurthy - */ - -public class InAdvanceSwap { - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < aiDay.length; ++i) { - aDeposit[i] = new SingleStreamComponent ( - "DEPOSIT_" + aiDay[i], - new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.EdgePair ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ) - ), - cps, - cfus - ) - ), - csp - ); - - aDeposit[i].setPrimaryCode (aiDay[i] + "D"); - } - - return aDeposit; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCIRS ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - 0. - ); - - return aIRS; - } - - /* - * This sample demonstrates discount curve calibration and input instrument calibration quote recovery. - * It shows the following: - * - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void CustomDiscountCurveBuilderSample ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 7, 14, 30, 60 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0013, 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of EDF Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aEDFComp = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtSpot, - 8, - strCurrency - ); - - double[] adblEDFQuote = new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }; - - /* - * Construct the EDF Instrument Set Stretch Builder - */ - - LatentStateStretchSpec edfStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "EDF", - aEDFComp, - "ForwardRate", - adblEDFQuote - ); - - /* - * Construct the Array of Swap Instruments and their Quotes from the given set of parameters - */ - - FixFloatComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - } - ); - - double[] adblSwapQuote = new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }; - - /* - * Construct the Swap Instrument Set Stretch Builder - */ - - LatentStateStretchSpec swapStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SWAP", - aSwapComp, - "SwapRate", - adblSwapQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - edfStretch, - swapStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit, Futures, and Swap Stretches. - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - /* - * Cross-Comparison of the Deposit Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t[" + aDepositComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aDepositComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "Rate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the EDF Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t EDF INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aEDFComp.length; ++i) - System.out.println ("\t[" + aEDFComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aEDFComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "Rate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblEDFQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t SWAP INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aSwapComp.length; ++i) - System.out.println ("\t[" + aSwapComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aSwapComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "CalibSwapRate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblSwapQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aSwapComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "FairPremium"), 1, 6, 1.)); - - System.out.println ("\t----------------------------------------------------------------"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - String strCurrency = "USD"; - - CustomDiscountCurveBuilderSample ( - dtToday, - strCurrency - ); - } -} diff --git a/org/drip/sample/fixfloat/InArrearsSwap.java b/org/drip/sample/fixfloat/InArrearsSwap.java deleted file mode 100644 index d864b61..0000000 --- a/org/drip/sample/fixfloat/InArrearsSwap.java +++ /dev/null @@ -1,566 +0,0 @@ - -package org.drip.sample.fixfloat; - -import java.util.List; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * InArrearsSwap demonstrates the Construction and Valuation of a In-Arrears Swap. - * - * @author Lakshmi Krishnamurthy - */ - -public class InArrearsSwap { - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay, - final int iRefPeriodType) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - iRefPeriodType, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < aiDay.length; ++i) { - aDeposit[i] = new SingleStreamComponent ( - "DEPOSIT_" + aiDay[i], - new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.EdgePair ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ) - ), - cps, - cfus - ) - ), - csp - ); - - aDeposit[i].setPrimaryCode (aiDay[i] + "D"); - } - - return aDeposit; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtEffective, - final String strCurrency, - final String[] astrMaturityTenor, - final int iRefPeriodType) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - true, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCurrency, - "6M" - ), - iRefPeriodType, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - 0., - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 2, - "6M", - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - "6M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent irs = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - /* - * This sample demonstrates discount curve calibration and input instrument calibration quote recovery. - * It shows the following: - * - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void CustomDiscountCurveBuilderSample ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 7, 14, 30, 60 - }, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE - ); - - double[] adblDepositQuote = new double[] { - 0.0013, 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of EDF Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aEDFComp = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtSpot, - 8, - strCurrency - ); - - double[] adblEDFQuote = new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }; - - /* - * Construct the EDF Instrument Set Stretch Builder - */ - - LatentStateStretchSpec edfStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "EDF", - aEDFComp, - "ForwardRate", - adblEDFQuote - ); - - /* - * Construct the Array of Swap Instruments and their Quotes from the given set of parameters - */ - - FixFloatComponent[] aSwapInAdvance = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE - ); - - /* - * Construct the Array of Swap Instruments and their Quotes from the given set of parameters - */ - - FixFloatComponent[] aSwapInArrears = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ARREARS - ); - - double[] adblSwapQuote = new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }; - - /* - * Construct the Swap Instrument Set Stretch Builder - */ - - LatentStateStretchSpec swapStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SWAP", - aSwapInAdvance, - "SwapRate", - adblSwapQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - edfStretch, - swapStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit, Futures, and Swap Stretches. - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - CurveSurfaceQuoteContainer csqs = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Cross-Comparison of the In-Advance/Arrears Swap "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t-------------------------------------------------------------------------------"); - - System.out.println ("\t IN-ADVANCE/IN-ARREARS SWAP INSTRUMENTS METRIC COMPARISON"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - System.out.println ("\t\tL -> R:"); - - System.out.println ("\t\t\t - Swap Maturity"); - - System.out.println ("\t\t\t - In Advance Calibration Quote"); - - System.out.println ("\t\t\t - In Advance Fair Premium"); - - System.out.println ("\t\t\t - In Advance Swap Rate"); - - System.out.println ("\t\t\t - In Arrears Swap Rate"); - - System.out.println ("\t\t\t - In Arrears Swap Rate Shift"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - for (int i = 0; i < aSwapInAdvance.length; ++i) { - double dblInArrearsFairPremium = aSwapInArrears[i].measureValue ( - valParams, - null, - csqs, - null, - "FairPremium" - ); - - System.out.println ("\t[" + aSwapInAdvance[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aSwapInAdvance[i].measureValue (valParams, null, csqs, null, "CalibSwapRate"), 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (adblSwapQuote[i], 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (aSwapInAdvance[i].measureValue (valParams, null, csqs, null, "FairPremium"), 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dblInArrearsFairPremium, 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dblInArrearsFairPremium - adblSwapQuote[i], 1, 0, 10000.) - ); - } - - System.out.println ("\n\t-------------------------------------------------------------------------------"); - - System.out.println ("\t IN-ADVANCE/IN-ARREARS SWAP INSTRUMENTS DV01 COMPARISON"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - System.out.println ("\t\tL -> R:"); - - System.out.println ("\t\t\t - Swap Maturity"); - - System.out.println ("\t\t\t - In Advance Swap DV01"); - - System.out.println ("\t\t\t - In Arrears Swap DV01"); - - System.out.println ("\t\t\t - In Arrears Step Down Swap DV01 Shift"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - for (int i = 0; i < aSwapInAdvance.length; ++i) { - double dblInAdvanceDV01 = aSwapInAdvance[i].measureValue ( - valParams, - null, - csqs, - null, - "FixedDV01" - ); - - double dblInArrearsDV01 = aSwapInArrears[i].measureValue ( - valParams, - null, - csqs, - null, - "FixedDV01" - ); - - System.out.println ("\t[" + aSwapInAdvance[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (dblInAdvanceDV01, 2, 1, 10000.) + " | " + - FormatUtil.FormatDouble (dblInArrearsDV01, 2, 1, 10000.) + " | " + - FormatUtil.FormatDouble (dblInArrearsDV01 - dblInAdvanceDV01, 1, 2, 10000.) - ); - } - - System.out.println ("\t-------------------------------------------------------------------------------"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - String strCurrency = "USD"; - - CustomDiscountCurveBuilderSample ( - dtToday, - strCurrency - ); - } -} diff --git a/org/drip/sample/fixfloat/JurisdictionOTCIndexDefinitions.java b/org/drip/sample/fixfloat/JurisdictionOTCIndexDefinitions.java deleted file mode 100644 index 97c675c..0000000 --- a/org/drip/sample/fixfloat/JurisdictionOTCIndexDefinitions.java +++ /dev/null @@ -1,164 +0,0 @@ - -package org.drip.sample.fixfloat; - -import org.drip.market.otc.IBORFixedFloatContainer; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * JurisdictionOTCIndexDefinitions contains all the pre-fixed definitions of the Jurisdiction-specific OTC - * Fix-Float IRS contracts. - * - * @author Lakshmi Krishnamurthy - */ - -public class JurisdictionOTCIndexDefinitions { - private static final void DisplayIRSOTCInfo ( - String strCurrency, - String strLocation, - String strMaturityTenor, - String strIndex) - { - System.out.println ( - "\t" + strCurrency + "-" + strLocation + "-" + strMaturityTenor + "-" + strIndex + " => " + - IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - strLocation, - strMaturityTenor, - strIndex - ) - ); - } - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - System.out.println ("\n\t--------------------------------------------------------------------------------------------------------\n"); - - DisplayIRSOTCInfo ("AUD", "ALL", "1Y", "MAIN"); - - DisplayIRSOTCInfo ("AUD", "ALL", "5Y", "MAIN"); - - DisplayIRSOTCInfo ("CAD", "ALL", "1Y", "MAIN"); - - DisplayIRSOTCInfo ("CAD", "ALL", "5Y", "MAIN"); - - DisplayIRSOTCInfo ("CHF", "ALL", "1Y", "MAIN"); - - DisplayIRSOTCInfo ("CHF", "ALL", "5Y", "MAIN"); - - DisplayIRSOTCInfo ("CNY", "ALL", "1Y", "MAIN"); - - DisplayIRSOTCInfo ("CNY", "ALL", "5Y", "MAIN"); - - DisplayIRSOTCInfo ("DKK", "ALL", "1Y", "MAIN"); - - DisplayIRSOTCInfo ("DKK", "ALL", "5Y", "MAIN"); - - DisplayIRSOTCInfo ("EUR", "ALL", "1Y", "MAIN"); - - DisplayIRSOTCInfo ("EUR", "ALL", "5Y", "MAIN"); - - DisplayIRSOTCInfo ("GBP", "ALL", "1Y", "MAIN"); - - DisplayIRSOTCInfo ("GBP", "ALL", "5Y", "MAIN"); - - DisplayIRSOTCInfo ("HKD", "ALL", "1Y", "MAIN"); - - DisplayIRSOTCInfo ("HKD", "ALL", "5Y", "MAIN"); - - DisplayIRSOTCInfo ("INR", "ALL", "1Y", "MAIN"); - - DisplayIRSOTCInfo ("INR", "ALL", "5Y", "MAIN"); - - DisplayIRSOTCInfo ("JPY", "ALL", "1Y", "MAIN"); - - DisplayIRSOTCInfo ("JPY", "ALL", "5Y", "MAIN"); - - DisplayIRSOTCInfo ("JPY", "ALL", "1Y", "TIBOR"); - - DisplayIRSOTCInfo ("JPY", "ALL", "5Y", "TIBOR"); - - DisplayIRSOTCInfo ("NOK", "ALL", "1Y", "MAIN"); - - DisplayIRSOTCInfo ("NOK", "ALL", "5Y", "MAIN"); - - DisplayIRSOTCInfo ("NZD", "ALL", "1Y", "MAIN"); - - DisplayIRSOTCInfo ("NZD", "ALL", "5Y", "MAIN"); - - DisplayIRSOTCInfo ("PLN", "ALL", "1Y", "MAIN"); - - DisplayIRSOTCInfo ("PLN", "ALL", "5Y", "MAIN"); - - DisplayIRSOTCInfo ("SEK", "ALL", "1Y", "MAIN"); - - DisplayIRSOTCInfo ("SEK", "ALL", "5Y", "MAIN"); - - DisplayIRSOTCInfo ("SGD", "ALL", "1Y", "MAIN"); - - DisplayIRSOTCInfo ("SGD", "ALL", "5Y", "MAIN"); - - DisplayIRSOTCInfo ("USD", "LON", "1Y", "MAIN"); - - DisplayIRSOTCInfo ("USD", "LON", "5Y", "MAIN"); - - DisplayIRSOTCInfo ("USD", "NYC", "1Y", "MAIN"); - - DisplayIRSOTCInfo ("USD", "NYC", "5Y", "MAIN"); - - DisplayIRSOTCInfo ("ZAR", "ALL", "1Y", "MAIN"); - - DisplayIRSOTCInfo ("ZAR", "ALL", "5Y", "MAIN"); - - System.out.println ("\n\t--------------------------------------------------------------------------------------------------------\n"); - } -} diff --git a/org/drip/sample/fixfloat/JurisdictionOTCIndexSwaps.java b/org/drip/sample/fixfloat/JurisdictionOTCIndexSwaps.java deleted file mode 100644 index 570b2af..0000000 --- a/org/drip/sample/fixfloat/JurisdictionOTCIndexSwaps.java +++ /dev/null @@ -1,468 +0,0 @@ - -package org.drip.sample.fixfloat; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * JurisdictionOTCIndexSwaps contains curve construction and valuation of the common Jurisdiction-specific - * OTC IRS. - * - * @author Lakshmi Krishnamurthy - */ - -public class JurisdictionOTCIndexSwaps { - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strLocation, - final String strMaturityTenor, - final String strIndex, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - strLocation, - strMaturityTenor, - strIndex - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < aiDay.length; ++i) { - aDeposit[i] = new SingleStreamComponent ( - "DEPOSIT_" + aiDay[i], - new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.EdgePair ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ) - ), - cps, - cfus - ) - ), - csp - ); - - aDeposit[i].setPrimaryCode (aiDay[i] + "D"); - } - - return aDeposit; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String strLocation, - final String strIndex, - final String[] astrMaturityTenor) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCIRS ( - dtSpot, - strCurrency, - strLocation, - astrMaturityTenor[i], - strIndex, - 0. - ); - - return aIRS; - } - - /* - * This sample demonstrates discount curve calibration and input instrument calibration quote recovery. - * It shows the following: - * - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void OTCRun ( - final JulianDate dtSpot, - final String strCurrency, - final String strLocation, - final String[] astrOTCMaturityTenor, - final String strIndex) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 7, 14, 30, 60 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0013, 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of EDF Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aEDFComp = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtSpot, - 8, - strCurrency - ); - - double[] adblEDFQuote = new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }; - - /* - * Construct the EDF Instrument Set Stretch Builder - */ - - LatentStateStretchSpec edfStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "EDF", - aEDFComp, - "ForwardRate", - adblEDFQuote - ); - - /* - * Construct the Array of Swap Instruments and their Quotes from the given set of parameters - */ - - FixFloatComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - strLocation, - strIndex, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - } - ); - - double[] adblSwapQuote = new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }; - - /* - * Construct the Swap Instrument Set Stretch Builder - */ - - LatentStateStretchSpec swapStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SWAP", - aSwapComp, - "SwapRate", - adblSwapQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - edfStretch, - swapStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit, Futures, and Swap Stretches. - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - CurveSurfaceQuoteContainer csqs = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - System.out.print ("\t[" + strCurrency + " | " + strLocation + "] = "); - - for (int i = 0; i < astrOTCMaturityTenor.length; ++i) { - FixFloatComponent swap = OTCIRS ( - dtSpot, - strCurrency, - strLocation, - astrOTCMaturityTenor[i], - strIndex, - 0. - ); - - Map mapOutput = swap.value ( - valParams, - null, - csqs, - null - ); - - System.out.print ( - FormatUtil.FormatDouble (mapOutput.get ("CalibSwapRate"), 1, 4, 100.) + "% (" + - FormatUtil.FormatDouble (mapOutput.get ("FairPremium"), 1, 4, 100.) + "%) || " - ); - } - - System.out.println(); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - String[] astrOTCMaturityTenor = new String[] { - "1Y", "3Y", "5Y", "7Y", "10Y" - }; - - System.out.println ("\n\t--------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t JURISDICTION 1Y || 3Y || 5Y || 7Y || 10Y ||"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------"); - - OTCRun (dtToday, "AUD", "ALL", astrOTCMaturityTenor, "MAIN"); - - OTCRun (dtToday, "CAD", "ALL", astrOTCMaturityTenor, "MAIN"); - - OTCRun (dtToday, "CHF", "ALL", astrOTCMaturityTenor, "MAIN"); - - OTCRun (dtToday, "CNY", "ALL", astrOTCMaturityTenor, "MAIN"); - - OTCRun (dtToday, "DKK", "ALL", astrOTCMaturityTenor, "MAIN"); - - OTCRun (dtToday, "EUR", "ALL", astrOTCMaturityTenor, "MAIN"); - - OTCRun (dtToday, "GBP", "ALL", astrOTCMaturityTenor, "MAIN"); - - OTCRun (dtToday, "HKD", "ALL", astrOTCMaturityTenor, "MAIN"); - - OTCRun (dtToday, "INR", "ALL", astrOTCMaturityTenor, "MAIN"); - - OTCRun (dtToday, "JPY", "ALL", astrOTCMaturityTenor, "MAIN"); - - OTCRun (dtToday, "JPY", "ALL", astrOTCMaturityTenor, "TIBOR"); - - OTCRun (dtToday, "NOK", "ALL", astrOTCMaturityTenor, "MAIN"); - - OTCRun (dtToday, "NZD", "ALL", astrOTCMaturityTenor, "MAIN"); - - OTCRun (dtToday, "PLN", "ALL", astrOTCMaturityTenor, "MAIN"); - - OTCRun (dtToday, "SEK", "ALL", astrOTCMaturityTenor, "MAIN"); - - OTCRun (dtToday, "SGD", "ALL", astrOTCMaturityTenor, "MAIN"); - - OTCRun (dtToday, "USD", "LON", astrOTCMaturityTenor, "MAIN"); - - OTCRun (dtToday, "USD", "NYC", astrOTCMaturityTenor, "MAIN"); - - OTCRun (dtToday, "ZAR", "ALL", astrOTCMaturityTenor, "MAIN"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------"); - } -} diff --git a/org/drip/sample/fixfloat/LongTenorSwap.java b/org/drip/sample/fixfloat/LongTenorSwap.java deleted file mode 100644 index 043f590..0000000 --- a/org/drip/sample/fixfloat/LongTenorSwap.java +++ /dev/null @@ -1,607 +0,0 @@ - -package org.drip.sample.fixfloat; - -import java.util.List; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * LongTenorSwap demonstrates the Construction and Valuation of In-Advance and In-Arrears Long Tenor Swap. - * - * @author Lakshmi Krishnamurthy - */ - -public class LongTenorSwap { - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay, - final int iRefPeriodType) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - iRefPeriodType, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < aiDay.length; ++i) { - aDeposit[i] = new SingleStreamComponent ( - "DEPOSIT_" + aiDay[i], - new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.EdgePair ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ) - ), - cps, - cfus - ) - ), - csp - ); - - aDeposit[i].setPrimaryCode (aiDay[i] + "D"); - } - - return aDeposit; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtEffective, - final String strCurrency, - final String[] astrMaturityTenor, - final int iRefPeriodType, - final String strFloatingTenor, - final String strCompositeTenor) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - Helper.TenorToFreq (strCompositeTenor), - "Act/360", - false, - "Act/360", - false, - strCurrency, - true, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - strCompositeTenor, - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCurrency, - strFloatingTenor - ), - iRefPeriodType, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - strCompositeTenor, - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - 0., - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - Helper.TenorToFreq (strCompositeTenor), - strCompositeTenor, - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - Helper.TenorToFreq (strCompositeTenor), - strCompositeTenor, - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - strCompositeTenor, - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - strCompositeTenor, - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent irs = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - /* - * This sample demonstrates discount curve calibration and input instrument calibration quote recovery. - * It shows the following: - * - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void CustomDiscountCurveBuilderSample ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 7, 14, 30, 60 - }, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE - ); - - double[] adblDepositQuote = new double[] { - 0.0013, 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of EDF Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aEDFComp = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtSpot, - 8, - strCurrency - ); - - double[] adblEDFQuote = new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }; - - /* - * Construct the EDF Instrument Set Stretch Builder - */ - - LatentStateStretchSpec edfStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "EDF", - aEDFComp, - "ForwardRate", - adblEDFQuote - ); - - /* - * Construct the Array of Swap Instruments and their Quotes from the given set of parameters - */ - - FixFloatComponent[] aSwapInAdvance = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - "6M", - "6M" - ); - - FixFloatComponent[] aSwapInAdvanceLongTenor = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - "3M", - "12M" - ); - - FixFloatComponent[] aSwapInArrearsLongTenor = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ARREARS, - "3M", - "12M" - ); - - double[] adblSwapQuote = new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }; - - /* - * Construct the Swap Instrument Set Stretch Builder - */ - - LatentStateStretchSpec swapStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SWAP", - aSwapInAdvance, - "SwapRate", - adblSwapQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - edfStretch, - swapStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit, Futures, and Swap Stretches. - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - CurveSurfaceQuoteContainer csqs = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Cross-Comparison of the In-Advance/Arrears Swap "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t-------------------------------------------------------------------------------"); - - System.out.println ("\t IN-ADVANCE/IN-ARREARS LONG TENOR SWAP METRIC COMPARISON"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - System.out.println ("\t\tL -> R:"); - - System.out.println ("\t\t\t - Swap Maturity"); - - System.out.println ("\t\t\t - In Advance Calibration Quote"); - - System.out.println ("\t\t\t - In Advance Fair Premium"); - - System.out.println ("\t\t\t - In Advance Swap Rate"); - - System.out.println ("\t\t\t - In Advance Long Tenor Swap Rate"); - - System.out.println ("\t\t\t - In Arrears Long Tenor Swap Rate"); - - System.out.println ("\t\t\t - In Advance Long Tenor Swap Rate Shift"); - - System.out.println ("\t\t\t - In Arrears Long Tenor Swap Rate Shift"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - for (int i = 0; i < aSwapInAdvance.length; ++i) { - double dblInAdvanceLongTenorFairPremium = aSwapInAdvanceLongTenor[i].measureValue ( - valParams, - null, - csqs, - null, - "FairPremium" - ); - - double dblInArrearsLongTenorFairPremium = aSwapInArrearsLongTenor[i].measureValue ( - valParams, - null, - csqs, - null, - "FairPremium" - ); - - System.out.println ("\t[" + aSwapInAdvance[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aSwapInAdvance[i].measureValue (valParams, null, csqs, null, "CalibSwapRate"), 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (adblSwapQuote[i], 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (aSwapInAdvance[i].measureValue (valParams, null, csqs, null, "FairPremium"), 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dblInAdvanceLongTenorFairPremium, 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dblInArrearsLongTenorFairPremium, 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dblInAdvanceLongTenorFairPremium - adblSwapQuote[i], 1, 0, 10000.) + " | " + - FormatUtil.FormatDouble (dblInArrearsLongTenorFairPremium - adblSwapQuote[i], 1, 0, 10000.) - ); - } - - System.out.println ("\n\t-------------------------------------------------------------------------------"); - - System.out.println ("\t IN-ADVANCE/IN-ARREARS LONG TENOR SWAP DV01 COMPARISON"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - System.out.println ("\t\tL -> R:"); - - System.out.println ("\t\t\t - Swap Maturity"); - - System.out.println ("\t\t\t - In Advance Swap DV01"); - - System.out.println ("\t\t\t - In Advance Long Tenor Swap DV01"); - - System.out.println ("\t\t\t - In Arrears Long Tenor Swap DV01"); - - System.out.println ("\t\t\t - In Advance Long Tenor Swap DV01 Shift"); - - System.out.println ("\t\t\t - In Arrears Long Tenor Swap DV01 Shift"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - for (int i = 0; i < aSwapInAdvance.length; ++i) { - double dblInAdvanceDV01 = aSwapInAdvance[i].measureValue ( - valParams, - null, - csqs, - null, - "FixedDV01" - ); - - double dblInAdvanceLongTenorDV01 = aSwapInAdvanceLongTenor[i].measureValue ( - valParams, - null, - csqs, - null, - "FixedDV01" - ); - - double dblInArrearsLongTenorDV01 = aSwapInAdvanceLongTenor[i].measureValue ( - valParams, - null, - csqs, - null, - "FixedDV01" - ); - - System.out.println ("\t[" + aSwapInAdvance[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (dblInAdvanceDV01, 2, 1, 10000.) + " | " + - FormatUtil.FormatDouble (dblInAdvanceLongTenorDV01, 2, 1, 10000.) + " | " + - FormatUtil.FormatDouble (dblInArrearsLongTenorDV01, 2, 1, 10000.) + " | " + - FormatUtil.FormatDouble (dblInAdvanceLongTenorDV01 - dblInAdvanceDV01, 1, 2, 10000.) + " | " + - FormatUtil.FormatDouble (dblInArrearsLongTenorDV01 - dblInAdvanceDV01, 1, 2, 10000.) - ); - } - - System.out.println ("\t-------------------------------------------------------------------------------"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - String strCurrency = "USD"; - - CustomDiscountCurveBuilderSample ( - dtToday, - strCurrency - ); - } -} diff --git a/org/drip/sample/fixfloat/RollerCoasterSwap.java b/org/drip/sample/fixfloat/RollerCoasterSwap.java deleted file mode 100644 index 5fdd8c1..0000000 --- a/org/drip/sample/fixfloat/RollerCoasterSwap.java +++ /dev/null @@ -1,659 +0,0 @@ - -package org.drip.sample.fixfloat; - -import java.util.List; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.rates.*; -import org.drip.quant.common.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RollerCoasterSwap demonstrates the construction and Valuation of In-Advance Roller-Coaster Swap. - * - * @author Lakshmi Krishnamurthy - */ - -public class RollerCoasterSwap { - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < aiDay.length; ++i) { - aDeposit[i] = new SingleStreamComponent ( - "DEPOSIT_" + aiDay[i], - new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.EdgePair ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ) - ), - cps, - cfus - ) - ), - csp - ); - - aDeposit[i].setPrimaryCode (aiDay[i] + "D"); - } - - return aDeposit; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtEffective, - final String strCurrency, - final Array2D fsNotional, - final String[] astrMaturityTenor) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - true, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCurrency, - "6M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - 0., - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 2, - "6M", - strCurrency, - null, - -1., - null, - fsNotional, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - "6M", - strCurrency, - null, - 1., - null, - fsNotional, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent irs = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - private static final Array2D RollerCoaster1 ( - final JulianDate dtSpot) - { - return Array2D.FromArray ( - new double[] { - dtSpot.julian(), - dtSpot.addYears (2).julian(), - dtSpot.addYears (4).julian(), - dtSpot.addYears (6).julian(), - dtSpot.addYears (10).julian(), - dtSpot.addYears (15).julian(), - dtSpot.addYears (21).julian(), - dtSpot.addYears (29).julian(), - dtSpot.addYears (36).julian(), - dtSpot.addYears (51).julian() - }, - new double[] { - 1.00, - 0.98, - 0.94, - 0.88, - 0.80, - 0.70, - 0.81, - 0.90, - 0.96, - 1.00 - } - ); - } - - private static final Array2D RollerCoaster2 ( - final JulianDate dtSpot) - { - return Array2D.FromArray ( - new double[] { - dtSpot.julian(), - dtSpot.addYears (2).julian(), - dtSpot.addYears (4).julian(), - dtSpot.addYears (6).julian(), - dtSpot.addYears (10).julian(), - dtSpot.addYears (15).julian(), - dtSpot.addYears (21).julian(), - dtSpot.addYears (29).julian(), - dtSpot.addYears (36).julian(), - dtSpot.addYears (51).julian() - }, - new double[] { - 1.00, - 1.02, - 1.06, - 1.12, - 1.20, - 1.30, - 1.19, - 1.10, - 1.04, - 1.00 - } - ); - } - - /* - * This sample demonstrates discount curve calibration and input instrument calibration quote recovery. - * It shows the following: - * - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void CustomDiscountCurveBuilderSample ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 7, 14, 30, 60 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0013, 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of EDF Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aEDFComp = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtSpot, - 8, - strCurrency - ); - - double[] adblEDFQuote = new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }; - - /* - * Construct the EDF Instrument Set Stretch Builder - */ - - LatentStateStretchSpec edfStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "EDF", - aEDFComp, - "ForwardRate", - adblEDFQuote - ); - - /* - * Construct the Array of Swap Instruments and their Quotes from the given set of parameters - */ - - FixFloatComponent[] aSwapInAdvance = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - null, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - } - ); - - FixFloatComponent[] aSwapInAdvanceRollerCoaster1 = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - RollerCoaster1 (dtSpot), - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - } - ); - - FixFloatComponent[] aSwapInAdvanceRollerCoaster2 = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - RollerCoaster2 (dtSpot), - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - } - ); - - double[] adblSwapQuote = new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }; - - /* - * Construct the Swap Instrument Set Stretch Builder - */ - - LatentStateStretchSpec swapStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SWAP", - aSwapInAdvance, - "SwapRate", - adblSwapQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - edfStretch, - swapStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit, Futures, and Swap Stretches. - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - CurveSurfaceQuoteContainer csqs = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Cross-Comparison of the In-Advance/Arrears Swap "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t-------------------------------------------------------------------------------"); - - System.out.println ("\t IN-ADVANCE ROLLER COASTER SWAP METRIC COMPARISON"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - System.out.println ("\t\tL -> R:"); - - System.out.println ("\t\t\t - Swap Maturity"); - - System.out.println ("\t\t\t - In Advance Calibration Quote"); - - System.out.println ("\t\t\t - In Advance Fair Premium"); - - System.out.println ("\t\t\t - In Advance Swap Rate"); - - System.out.println ("\t\t\t - In Advance Roller Coaster #1 Swap Rate"); - - System.out.println ("\t\t\t - In Advance Roller Coaster #2 Swap Rate"); - - System.out.println ("\t\t\t - In Advance Roller Coaster #1 Swap Rate Shift"); - - System.out.println ("\t\t\t - In Advance Roller Coaster #2 Swap Rate Shift"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - for (int i = 0; i < aSwapInAdvance.length; ++i) { - double dblInAdvanceRollerCoaster1FairPremium = aSwapInAdvanceRollerCoaster1[i].measureValue ( - valParams, - null, - csqs, - null, - "FairPremium" - ); - - double dblInAdvanceRollerCoaster2FairPremium = aSwapInAdvanceRollerCoaster2[i].measureValue ( - valParams, - null, - csqs, - null, - "FairPremium" - ); - - System.out.println ("\t[" + aSwapInAdvance[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aSwapInAdvance[i].measureValue (valParams, null, csqs, null, "CalibSwapRate"), 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (adblSwapQuote[i], 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (aSwapInAdvance[i].measureValue (valParams, null, csqs, null, "FairPremium"), 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dblInAdvanceRollerCoaster1FairPremium, 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dblInAdvanceRollerCoaster1FairPremium - adblSwapQuote[i], 1, 0, 10000.) + " | " + - FormatUtil.FormatDouble (dblInAdvanceRollerCoaster2FairPremium, 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dblInAdvanceRollerCoaster2FairPremium - adblSwapQuote[i], 1, 0, 10000.) - ); - } - - System.out.println ("\n\t-------------------------------------------------------------------------------"); - - System.out.println ("\t IN-ADVANCE ROLLER COASTER SWAP DV01 COMPARISON"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - System.out.println ("\t\tL -> R:"); - - System.out.println ("\t\t\t - Swap Maturity"); - - System.out.println ("\t\t\t - In Advance Swap DV01"); - - System.out.println ("\t\t\t - In Advance Roller Coaster #1 DV01"); - - System.out.println ("\t\t\t - In Advance Roller Coaster #1 DV01 Shift"); - - System.out.println ("\t\t\t - In Advance Roller Coaster #2 DV01"); - - System.out.println ("\t\t\t - In Advance Roller Coaster #2 DV01 Shift"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - for (int i = 0; i < aSwapInAdvance.length; ++i) { - double dblInAdvanceDV01 = aSwapInAdvance[i].measureValue ( - valParams, - null, - csqs, - null, - "FixedDV01" - ); - - double dblInAdvanceRollerCoaster1DV01 = aSwapInAdvanceRollerCoaster1[i].measureValue ( - valParams, - null, - csqs, - null, - "FixedDV01" - ); - - double dblInAdvanceRollerCoaster2DV01 = aSwapInAdvanceRollerCoaster2[i].measureValue ( - valParams, - null, - csqs, - null, - "FixedDV01" - ); - - System.out.println ("\t[" + aSwapInAdvance[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (dblInAdvanceDV01, 2, 1, 10000.) + " | " + - FormatUtil.FormatDouble (dblInAdvanceRollerCoaster1DV01, 2, 1, 10000.) + " | " + - FormatUtil.FormatDouble (dblInAdvanceRollerCoaster1DV01 - dblInAdvanceDV01, 1, 2, 10000.) + " | " + - FormatUtil.FormatDouble (dblInAdvanceRollerCoaster2DV01, 2, 1, 10000.) + " | " + - FormatUtil.FormatDouble (dblInAdvanceRollerCoaster2DV01 - dblInAdvanceDV01, 1, 2, 10000.) - ); - } - - System.out.println ("\t-------------------------------------------------------------------------------"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - String strCurrency = "USD"; - - CustomDiscountCurveBuilderSample ( - dtToday, - strCurrency - ); - } -} diff --git a/org/drip/sample/fixfloat/ShortTenorSwap.java b/org/drip/sample/fixfloat/ShortTenorSwap.java deleted file mode 100644 index 7120c7c..0000000 --- a/org/drip/sample/fixfloat/ShortTenorSwap.java +++ /dev/null @@ -1,607 +0,0 @@ - -package org.drip.sample.fixfloat; - -import java.util.List; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ShortTenorSwap demonstrates the Construction and Valuation of In-Advance and In-Arrears Short Tenor Swap. - * - * @author Lakshmi Krishnamurthy - */ - -public class ShortTenorSwap { - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay, - final int iRefPeriodType) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - iRefPeriodType, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < aiDay.length; ++i) { - aDeposit[i] = new SingleStreamComponent ( - "DEPOSIT_" + aiDay[i], - new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.EdgePair ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ) - ), - cps, - cfus - ) - ), - csp - ); - - aDeposit[i].setPrimaryCode (aiDay[i] + "D"); - } - - return aDeposit; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtEffective, - final String strCurrency, - final String[] astrMaturityTenor, - final int iRefPeriodType, - final String strFloatingTenor, - final String strCompositeTenor) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - Helper.TenorToFreq (strCompositeTenor), - "Act/360", - false, - "Act/360", - false, - strCurrency, - true, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - strCompositeTenor, - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCurrency, - strFloatingTenor - ), - iRefPeriodType, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - strCompositeTenor, - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - 0., - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - Helper.TenorToFreq (strCompositeTenor), - strCompositeTenor, - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - Helper.TenorToFreq (strCompositeTenor), - strCompositeTenor, - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - strCompositeTenor, - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - strCompositeTenor, - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent irs = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - /* - * This sample demonstrates discount curve calibration and input instrument calibration quote recovery. - * It shows the following: - * - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void CustomDiscountCurveBuilderSample ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 7, 14, 30, 60 - }, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE - ); - - double[] adblDepositQuote = new double[] { - 0.0013, 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of EDF Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aEDFComp = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtSpot, - 8, - strCurrency - ); - - double[] adblEDFQuote = new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }; - - /* - * Construct the EDF Instrument Set Stretch Builder - */ - - LatentStateStretchSpec edfStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "EDF", - aEDFComp, - "ForwardRate", - adblEDFQuote - ); - - /* - * Construct the Array of Swap Instruments and their Quotes from the given set of parameters - */ - - FixFloatComponent[] aSwapInAdvance = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - "6M", - "6M" - ); - - FixFloatComponent[] aSwapInAdvanceShortTenor = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - "12M", - "3M" - ); - - FixFloatComponent[] aSwapInArrearsShortTenor = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ARREARS, - "12M", - "3M" - ); - - double[] adblSwapQuote = new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }; - - /* - * Construct the Swap Instrument Set Stretch Builder - */ - - LatentStateStretchSpec swapStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SWAP", - aSwapInAdvance, - "SwapRate", - adblSwapQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - edfStretch, - swapStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit, Futures, and Swap Stretches. - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - CurveSurfaceQuoteContainer csqs = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Cross-Comparison of the In-Advance/Arrears Swap "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t-------------------------------------------------------------------------------"); - - System.out.println ("\t IN-ADVANCE/IN-ARREARS SHORT TENOR SWAP METRIC COMPARISON"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - System.out.println ("\t\tL -> R:"); - - System.out.println ("\t\t\t - Swap Maturity"); - - System.out.println ("\t\t\t - In Advance Calibration Quote"); - - System.out.println ("\t\t\t - In Advance Fair Premium"); - - System.out.println ("\t\t\t - In Advance Swap Rate"); - - System.out.println ("\t\t\t - In Advance Short Tenor Swap Rate"); - - System.out.println ("\t\t\t - In Arrears Short Tenor Swap Rate"); - - System.out.println ("\t\t\t - In Advance Short Tenor Swap Rate Shift"); - - System.out.println ("\t\t\t - In Arrears Short Tenor Swap Rate Shift"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - for (int i = 0; i < aSwapInAdvance.length; ++i) { - double dblInAdvanceShortTenorFairPremium = aSwapInAdvanceShortTenor[i].measureValue ( - valParams, - null, - csqs, - null, - "FairPremium" - ); - - double dblInArrearsShortTenorFairPremium = aSwapInArrearsShortTenor[i].measureValue ( - valParams, - null, - csqs, - null, - "FairPremium" - ); - - System.out.println ("\t[" + aSwapInAdvance[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aSwapInAdvance[i].measureValue (valParams, null, csqs, null, "CalibSwapRate"), 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (adblSwapQuote[i], 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (aSwapInAdvance[i].measureValue (valParams, null, csqs, null, "FairPremium"), 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dblInAdvanceShortTenorFairPremium, 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dblInArrearsShortTenorFairPremium, 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dblInAdvanceShortTenorFairPremium - adblSwapQuote[i], 1, 0, 10000.) + " | " + - FormatUtil.FormatDouble (dblInArrearsShortTenorFairPremium - adblSwapQuote[i], 1, 0, 10000.) - ); - } - - System.out.println ("\n\t-------------------------------------------------------------------------------"); - - System.out.println ("\t IN-ADVANCE/IN-ARREARS SHORT TENOR SWAP DV01 COMPARISON"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - System.out.println ("\t\tL -> R:"); - - System.out.println ("\t\t\t - Swap Maturity"); - - System.out.println ("\t\t\t - In Advance Swap DV01"); - - System.out.println ("\t\t\t - In Advance Short Tenor Swap DV01"); - - System.out.println ("\t\t\t - In Arrears Short Tenor Swap DV01"); - - System.out.println ("\t\t\t - In Advance Short Tenor Swap DV01 Shift"); - - System.out.println ("\t\t\t - In Arrears Short Tenor Swap DV01 Shift"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - for (int i = 0; i < aSwapInAdvance.length; ++i) { - double dblInAdvanceDV01 = aSwapInAdvance[i].measureValue ( - valParams, - null, - csqs, - null, - "FixedDV01" - ); - - double dblInAdvanceShortTenorDV01 = aSwapInAdvanceShortTenor[i].measureValue ( - valParams, - null, - csqs, - null, - "FixedDV01" - ); - - double dblInArrearsShortTenorDV01 = aSwapInAdvanceShortTenor[i].measureValue ( - valParams, - null, - csqs, - null, - "FixedDV01" - ); - - System.out.println ("\t[" + aSwapInAdvance[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (dblInAdvanceDV01, 2, 1, 10000.) + " | " + - FormatUtil.FormatDouble (dblInAdvanceShortTenorDV01, 2, 1, 10000.) + " | " + - FormatUtil.FormatDouble (dblInArrearsShortTenorDV01, 2, 1, 10000.) + " | " + - FormatUtil.FormatDouble (dblInAdvanceShortTenorDV01 - dblInAdvanceDV01, 1, 2, 10000.) + " | " + - FormatUtil.FormatDouble (dblInArrearsShortTenorDV01 - dblInAdvanceDV01, 1, 2, 10000.) - ); - } - - System.out.println ("\t-------------------------------------------------------------------------------"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - String strCurrency = "USD"; - - CustomDiscountCurveBuilderSample ( - dtToday, - strCurrency - ); - } -} diff --git a/org/drip/sample/fixfloat/StepUpStepDown.java b/org/drip/sample/fixfloat/StepUpStepDown.java deleted file mode 100644 index e9d0473..0000000 --- a/org/drip/sample/fixfloat/StepUpStepDown.java +++ /dev/null @@ -1,660 +0,0 @@ - -package org.drip.sample.fixfloat; - -import java.util.List; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.rates.*; -import org.drip.quant.common.Array2D; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * StepUpStepDown demonstrates the construction and Valuation of in-advance step-up and step-down swaps. - * - * @author Lakshmi Krishnamurthy - */ - -public class StepUpStepDown { - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < aiDay.length; ++i) { - aDeposit[i] = new SingleStreamComponent ( - "DEPOSIT_" + aiDay[i], - new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.EdgePair ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ) - ), - cps, - cfus - ) - ), - csp - ); - - aDeposit[i].setPrimaryCode (aiDay[i] + "D"); - } - - return aDeposit; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtEffective, - final String strCurrency, - final Array2D fsCoupon, - final String[] astrMaturityTenor) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - true, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCurrency, - "6M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - 0., - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 2, - "6M", - strCurrency, - null, - -1., - fsCoupon, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - "6M", - strCurrency, - null, - 1., - fsCoupon, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent irs = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - private static final Array2D StepDown ( - final JulianDate dtSpot) - { - return Array2D.FromArray ( - new double[] { - dtSpot.julian(), - dtSpot.addYears (2).julian(), - dtSpot.addYears (4).julian(), - dtSpot.addYears (6).julian(), - dtSpot.addYears (10).julian(), - dtSpot.addYears (15).julian(), - dtSpot.addYears (21).julian(), - dtSpot.addYears (29).julian(), - dtSpot.addYears (36).julian(), - dtSpot.addYears (51).julian() - }, - new double[] { - 1.00, - 0.99, - 0.97, - 0.94, - 0.90, - 0.85, - 0.78, - 0.70, - 0.61, - 0.51 - } - ); - } - - private static final Array2D StepUp ( - final JulianDate dtSpot) - { - return Array2D.FromArray ( - new double[] { - dtSpot.julian(), - dtSpot.addYears (2).julian(), - dtSpot.addYears (4).julian(), - dtSpot.addYears (6).julian(), - dtSpot.addYears (10).julian(), - dtSpot.addYears (15).julian(), - dtSpot.addYears (21).julian(), - dtSpot.addYears (29).julian(), - dtSpot.addYears (36).julian(), - dtSpot.addYears (51).julian() - }, - new double[] { - 1.00, - 1.01, - 1.03, - 1.06, - 1.10, - 1.15, - 1.21, - 1.28, - 1.36, - 1.45 - } - ); - } - - /* - * This sample demonstrates discount curve calibration and input instrument calibration quote recovery. - * It shows the following: - * - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void CustomDiscountCurveBuilderSample ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 7, 14, 30, 60 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0013, 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of EDF Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aEDFComp = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtSpot, - 8, - strCurrency - ); - - double[] adblEDFQuote = new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }; - - /* - * Construct the EDF Instrument Set Stretch Builder - */ - - LatentStateStretchSpec edfStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "EDF", - aEDFComp, - "ForwardRate", - adblEDFQuote - ); - - /* - * Construct the Array of Swap Instruments and their Quotes from the given set of parameters - */ - - FixFloatComponent[] aSwapInAdvance = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - null, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - } - ); - - FixFloatComponent[] aSwapInAdvanceStepUp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - StepUp (dtSpot), - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - } - ); - - FixFloatComponent[] aSwapInAdvanceStepDown = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - StepDown (dtSpot), - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - } - ); - - double[] adblSwapQuote = new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }; - - /* - * Construct the Swap Instrument Set Stretch Builder - */ - - LatentStateStretchSpec swapStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SWAP", - aSwapInAdvance, - "SwapRate", - adblSwapQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - edfStretch, - swapStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit, Futures, and Swap Stretches. - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - CurveSurfaceQuoteContainer csqs = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Cross-Comparison of the In-Advance/Arrears Swap "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t-------------------------------------------------------------------------------"); - - System.out.println ("\t IN-ADVANCE STEP UP/DOWN SWAP METRIC COMPARISON"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - System.out.println ("\t\tL -> R:"); - - System.out.println ("\t\t\t - Swap Maturity"); - - System.out.println ("\t\t\t - In Advance Calibration Quote"); - - System.out.println ("\t\t\t - In Advance Fair Premium"); - - System.out.println ("\t\t\t - In Advance Swap Rate"); - - System.out.println ("\t\t\t - In Advance Step Up Swap Rate"); - - System.out.println ("\t\t\t - In Advance Step Down Swap Rate"); - - System.out.println ("\t\t\t - In Advance Step Up Swap Rate Shift"); - - System.out.println ("\t\t\t - In Advance Step Down Swap Rate Shift"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - for (int i = 0; i < aSwapInAdvance.length; ++i) { - double dblInAdvanceStepUpFairPremium = aSwapInAdvanceStepUp[i].measureValue ( - valParams, - null, - csqs, - null, - "FairPremium" - ); - - double dblInAdvanceStepDownFairPremium = aSwapInAdvanceStepDown[i].measureValue ( - valParams, - null, - csqs, - null, - "FairPremium" - ); - - System.out.println ("\t[" + aSwapInAdvance[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aSwapInAdvance[i].measureValue (valParams, null, csqs, null, "CalibSwapRate"), 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (adblSwapQuote[i], 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (aSwapInAdvance[i].measureValue (valParams, null, csqs, null, "FairPremium"), 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dblInAdvanceStepUpFairPremium, 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dblInAdvanceStepUpFairPremium - adblSwapQuote[i], 1, 0, 10000.) + " | " + - FormatUtil.FormatDouble (dblInAdvanceStepDownFairPremium, 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dblInAdvanceStepDownFairPremium - adblSwapQuote[i], 1, 0, 10000.) - ); - } - - System.out.println ("\n\t-------------------------------------------------------------------------------"); - - System.out.println ("\t IN-ADVANCE STEP UP/DOWN SWAP DV01 COMPARISON"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - System.out.println ("\t\tL -> R:"); - - System.out.println ("\t\t\t - Swap Maturity"); - - System.out.println ("\t\t\t - In Advance Swap DV01"); - - System.out.println ("\t\t\t - In Advance Step Up Swap DV01"); - - System.out.println ("\t\t\t - In Advance Step Up Swap DV01 Shift"); - - System.out.println ("\t\t\t - In Advance Step Down Swap DV01"); - - System.out.println ("\t\t\t - In Advance Step Down Swap DV01 Shift"); - - System.out.println ("\t-------------------------------------------------------------------------------"); - - for (int i = 0; i < aSwapInAdvance.length; ++i) { - double dblInAdvanceDV01 = aSwapInAdvance[i].measureValue ( - valParams, - null, - csqs, - null, - "FixedDV01" - ); - - double dblInAdvanceStepUpDV01 = aSwapInAdvanceStepUp[i].measureValue ( - valParams, - null, - csqs, - null, - "FixedDV01" - ); - - double dblInAdvanceStepDownDV01 = aSwapInAdvanceStepDown[i].measureValue ( - valParams, - null, - csqs, - null, - "FixedDV01" - ); - - System.out.println ("\t[" + aSwapInAdvance[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (dblInAdvanceDV01, 2, 1, 10000.) + " | " + - FormatUtil.FormatDouble (dblInAdvanceStepUpDV01, 2, 1, 10000.) + " | " + - FormatUtil.FormatDouble (dblInAdvanceStepUpDV01 - dblInAdvanceDV01, 1, 2, 10000.) + " | " + - FormatUtil.FormatDouble (dblInAdvanceStepDownDV01, 2, 1, 10000.) + " | " + - FormatUtil.FormatDouble (dblInAdvanceStepDownDV01 - dblInAdvanceDV01, 1, 2, 10000.) - ); - } - - System.out.println ("\t-------------------------------------------------------------------------------"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - String strCurrency = "USD"; - - CustomDiscountCurveBuilderSample ( - dtToday, - strCurrency - ); - } -} diff --git a/org/drip/sample/fixfloatoption/MultiCurvePayerReceiver.java b/org/drip/sample/fixfloatoption/MultiCurvePayerReceiver.java deleted file mode 100644 index a358794..0000000 --- a/org/drip/sample/fixfloatoption/MultiCurvePayerReceiver.java +++ /dev/null @@ -1,809 +0,0 @@ - -package org.drip.sample.fixfloatoption; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.*; -import org.drip.product.option.*; -import org.drip.product.params.LastTradingDateSetting; -import org.drip.product.rates.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * MultiCurvePayerReceiver contains the demonstration of the Multi-Curve Payer/Receiver Fix-Float IRS - * European Option Sample. - * - * @author Lakshmi Krishnamurthy - */ - -public class MultiCurvePayerReceiver { - - private static final FixFloatComponent OTCFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final FloatFloatComponent OTCFloatFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strDerivedTenor, - final String strMaturityTenor, - final double dblBasis) - { - FloatFloatSwapConvention ffConv = IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - return ffConv.createFloatFloatComponent ( - dtSpot, - strDerivedTenor, - strMaturityTenor, - dblBasis, - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFutures, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFutures]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFutures, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFutures; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate" - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate", // 30Y - "SwapRate", // 40Y - "SwapRate" // 50Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - "USD" - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - } - - /* - * Construct an array of float-float swaps from the corresponding reference (6M) and the derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FloatFloatComponent[] MakexM6MBasisSwap ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final int iTenorInMonths) - throws Exception - { - FloatFloatComponent[] aFFC = new FloatFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aFFC[i] = OTCFloatFloat ( - dtSpot, - strCurrency, - iTenorInMonths + "M", - astrMaturityTenor[i], - 0. - ); - - return aFFC; - } - - private static final ForwardCurve MakeFC ( - final JulianDate dtSpot, - final String strCurrency, - final MergedDiscountForwardCurve dc, - final int iTenorInMonths, - final String[] astrxM6MFwdTenor, - final double[] adblxM6MBasisSwapQuote) - throws Exception - { - /* - * Construct the 6M-xM float-float basis swap. - */ - - FloatFloatComponent[] aFFC = MakexM6MBasisSwap ( - dtSpot, - strCurrency, - astrxM6MFwdTenor, - iTenorInMonths - ); - - String strBasisTenor = iTenorInMonths + "M"; - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Calculate the starting forward rate off of the discount curve. - */ - - double dblStartingFwd = dc.forward ( - dtSpot.julian(), - dtSpot.addTenor (strBasisTenor).julian() - ); - - /* - * Set the discount curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Construct the shape preserving forward curve off of Quartic Polynomial Basis Spline. - */ - - return ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - "QUARTIC_FWD" + strBasisTenor, - ForwardLabel.Create ( - strCurrency, - strBasisTenor - ), - valParams, - null, - mktParams, - null, - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (5), - aFFC, - "DerivedParBasisSpread", - adblxM6MBasisSwapQuote, - dblStartingFwd - ); - } - - private static final Map MakeFC ( - final JulianDate dt, - final String strCurrency, - final MergedDiscountForwardCurve dc) - throws Exception - { - Map mapFC = new HashMap (); - - /* - * Build and run the sampling for the 1M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc1M = MakeFC ( - dt, - strCurrency, - dc, - 1, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00551, // 1Y - 0.00387, // 2Y - 0.00298, // 3Y - 0.00247, // 4Y - 0.00211, // 5Y - 0.00185, // 6Y - 0.00165, // 7Y - 0.00150, // 8Y - 0.00137, // 9Y - 0.00127, // 10Y - 0.00119, // 11Y - 0.00112, // 12Y - 0.00096, // 15Y - 0.00079, // 20Y - 0.00069, // 25Y - 0.00062 // 30Y - } - ); - - mapFC.put ( - "1M", - fc1M - ); - - /* - * Build and run the sampling for the 3M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc3M = MakeFC ( - dt, - strCurrency, - dc, - 3, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00186, // 1Y - 0.00127, // 2Y - 0.00097, // 3Y - 0.00080, // 4Y - 0.00067, // 5Y - 0.00058, // 6Y - 0.00051, // 7Y - 0.00046, // 8Y - 0.00042, // 9Y - 0.00038, // 10Y - 0.00035, // 11Y - 0.00033, // 12Y - 0.00028, // 15Y - 0.00022, // 20Y - 0.00020, // 25Y - 0.00018 // 30Y - } - ); - - mapFC.put ( - "3M", - fc3M - ); - - /* - * Build and run the sampling for the 12M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc12M = MakeFC ( - dt, - strCurrency, - dc, - 12, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", - "35Y", "40Y" // Extrapolated - }, - new double[] { - -0.00212, // 1Y - -0.00152, // 2Y - -0.00117, // 3Y - -0.00097, // 4Y - -0.00082, // 5Y - -0.00072, // 6Y - -0.00063, // 7Y - -0.00057, // 8Y - -0.00051, // 9Y - -0.00047, // 10Y - -0.00044, // 11Y - -0.00041, // 12Y - -0.00035, // 15Y - -0.00028, // 20Y - -0.00025, // 25Y - -0.00022, // 30Y - -0.00022, // 35Y Extrapolated - -0.00022, // 40Y Extrapolated - } - ); - - mapFC.put ( - "12M", - fc12M - ); - - return mapFC; - } - - private static final FixFloatComponent CreateSTIR ( - final JulianDate dtEffective, - final String strMaturityTenor, - final ForwardLabel fri, - final double dblCoupon, - final String strCurrency) - throws Exception - { - JulianDate dtMaturity = dtEffective.addTenor (strMaturityTenor); - - int iTenorInMonths = Helper.TenorToMonths (fri.tenor()); - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - true, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - fri.tenor(), - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - fri, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - dblCoupon, - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 12 / iTenorInMonths, - fri.tenor(), - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - "6M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - strMaturityTenor, - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - fri.tenor(), - strMaturityTenor, - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent irs = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - irs.setPrimaryCode ("IRS." + dtMaturity.toString() + "." + strCurrency); - - return irs; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strTenor = "3M"; - String strCurrency = "GBP"; - String strManifestMeasure = "SwapRate"; - double dblCustomMetricVolatility = 0.4; - double dblForwardVolatility = 0.3; - double dblFundingVolatility = 0.1; - double dblForwardFundingCorr = 0.2; - - JulianDate dtToday = DateUtil.Today().addTenorAndAdjust ( - "0D", - strCurrency - ); - - /* - * Construct the Discount Curve using its instruments and quotes - */ - - MergedDiscountForwardCurve dc = MakeDC ( - dtToday, - strCurrency - ); - - Map mapFC = MakeFC ( - dtToday, - strCurrency, - dc - ); - - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - JulianDate dtForward = dtToday.addTenor (strTenor); - - FixFloatComponent stir = CreateSTIR ( - dtForward, - "5Y", - fri, - 0.05, - strCurrency - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - mapFC.get (strTenor), - null, - null, - null, - null, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - strCurrency - ); - - FundingLabel fundingLabel = FundingLabel.Standard (strCurrency); - - mktParams.setCustomVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtToday.julian(), - VolatilityLabel.Standard (CustomLabel.Standard (stir.name() + "_" + strManifestMeasure)), - strCurrency, - dblCustomMetricVolatility - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtToday.julian(), - VolatilityLabel.Standard (fundingLabel), - strCurrency, - dblFundingVolatility - ) - ); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtToday.julian(), - VolatilityLabel.Standard (fri), - strCurrency, - dblForwardVolatility - ) - ); - - mktParams.setForwardFundingCorrelation ( - fri, - fundingLabel, - new FlatUnivariate (dblForwardFundingCorr) - ); - - Map mapSTIROutput = stir.value ( - valParams, - null, - mktParams, - null - ); - - double dblStrike = 1.01 * mapSTIROutput.get (strManifestMeasure); - - FixFloatEuropeanOption stirReceiver = new FixFloatEuropeanOption ( - stir.name() + "::RECEIVER_OPT", - stir, - strManifestMeasure, - true, - dblStrike, - 1., - new LastTradingDateSetting ( - LastTradingDateSetting.MID_CURVE_OPTION_QUARTERLY, - "", - Integer.MIN_VALUE - ), - null - ); - - Map mapSTIRReceiverOutput = stirReceiver.value ( - valParams, - null, - mktParams, - null - ); - - for (Map.Entry me : mapSTIRReceiverOutput.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - - System.out.println ("\n------------------------------------------------------------------"); - - System.out.println ("------------------------------------------------------------------\n"); - - FixFloatEuropeanOption stirPayer = new FixFloatEuropeanOption ( - stir.name() + "::PAYER_OPT", - stir, - strManifestMeasure, - false, - dblStrike, - 1., - new LastTradingDateSetting ( - LastTradingDateSetting.MID_CURVE_OPTION_QUARTERLY, - "", - Integer.MIN_VALUE - ), - null - ); - - Map mapSTIRPayerOutput = stirPayer.value ( - valParams, - null, - mktParams, - null - ); - - for (Map.Entry me : mapSTIRPayerOutput.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/fixfloatoption/MultiCurvePayerReceiverAnalysis.java b/org/drip/sample/fixfloatoption/MultiCurvePayerReceiverAnalysis.java deleted file mode 100644 index c718b57..0000000 --- a/org/drip/sample/fixfloatoption/MultiCurvePayerReceiverAnalysis.java +++ /dev/null @@ -1,878 +0,0 @@ - -package org.drip.sample.fixfloatoption; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.*; -import org.drip.product.option.FixFloatEuropeanOption; -import org.drip.product.params.LastTradingDateSetting; -import org.drip.product.rates.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * MultiCurvePayerReceiverAnalysis contains the demonstration of the custom volatility-correlation analysis - * of Multi-Curve Receiver/Payer Fix-Float Swap European Option sample. - * - * @author Lakshmi Krishnamurthy - */ - -public class MultiCurvePayerReceiverAnalysis { - - private static final FixFloatComponent OTCFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final FloatFloatComponent OTCFloatFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strDerivedTenor, - final String strMaturityTenor, - final double dblBasis) - { - FloatFloatSwapConvention ffConv = IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - return ffConv.createFloatFloatComponent ( - dtSpot, - strDerivedTenor, - strMaturityTenor, - dblBasis, - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFutures, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFutures]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFutures, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFutures; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate" - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate", // 30Y - "SwapRate", // 40Y - "SwapRate" // 50Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - "USD" - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - } - - /* - * Construct an array of float-float swaps from the corresponding reference (6M) and the derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FloatFloatComponent[] MakexM6MBasisSwap ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final int iTenorInMonths) - throws Exception - { - FloatFloatComponent[] aFFC = new FloatFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aFFC[i] = OTCFloatFloat ( - dtSpot, - strCurrency, - iTenorInMonths + "M", - astrMaturityTenor[i], - 0. - ); - - return aFFC; - } - - private static final ForwardCurve MakeFC ( - final JulianDate dtSpot, - final String strCurrency, - final MergedDiscountForwardCurve dc, - final int iTenorInMonths, - final String[] astrxM6MFwdTenor, - final double[] adblxM6MBasisSwapQuote) - throws Exception - { - /* - * Construct the 6M-xM float-float basis swap. - */ - - FloatFloatComponent[] aFFC = MakexM6MBasisSwap ( - dtSpot, - strCurrency, - astrxM6MFwdTenor, - iTenorInMonths - ); - - String strBasisTenor = iTenorInMonths + "M"; - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Calculate the starting forward rate off of the discount curve. - */ - - double dblStartingFwd = dc.forward ( - dtSpot.julian(), - dtSpot.addTenor (strBasisTenor).julian() - ); - - /* - * Set the discount curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Construct the shape preserving forward curve off of Quartic Polynomial Basis Spline. - */ - - return ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - "QUARTIC_FWD" + strBasisTenor, - ForwardLabel.Create ( - strCurrency, - strBasisTenor - ), - valParams, - null, - mktParams, - null, - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (5), - aFFC, - "DerivedParBasisSpread", - adblxM6MBasisSwapQuote, - dblStartingFwd - ); - } - - private static final Map MakeFC ( - final JulianDate dt, - final String strCurrency, - final MergedDiscountForwardCurve dc) - throws Exception - { - Map mapFC = new HashMap(); - - /* - * Build and run the sampling for the 1M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc1M = MakeFC ( - dt, - strCurrency, - dc, - 1, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00551, // 1Y - 0.00387, // 2Y - 0.00298, // 3Y - 0.00247, // 4Y - 0.00211, // 5Y - 0.00185, // 6Y - 0.00165, // 7Y - 0.00150, // 8Y - 0.00137, // 9Y - 0.00127, // 10Y - 0.00119, // 11Y - 0.00112, // 12Y - 0.00096, // 15Y - 0.00079, // 20Y - 0.00069, // 25Y - 0.00062 // 30Y - } - ); - - mapFC.put ( - "1M", - fc1M - ); - - /* - * Build and run the sampling for the 3M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc3M = MakeFC ( - dt, - strCurrency, - dc, - 3, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00186, // 1Y - 0.00127, // 2Y - 0.00097, // 3Y - 0.00080, // 4Y - 0.00067, // 5Y - 0.00058, // 6Y - 0.00051, // 7Y - 0.00046, // 8Y - 0.00042, // 9Y - 0.00038, // 10Y - 0.00035, // 11Y - 0.00033, // 12Y - 0.00028, // 15Y - 0.00022, // 20Y - 0.00020, // 25Y - 0.00018 // 30Y - } - ); - - mapFC.put ( - "3M", - fc3M - ); - - /* - * Build and run the sampling for the 12M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc12M = MakeFC ( - dt, - strCurrency, - dc, - 12, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", - "35Y", "40Y" // Extrapolated - }, - new double[] { - -0.00212, // 1Y - -0.00152, // 2Y - -0.00117, // 3Y - -0.00097, // 4Y - -0.00082, // 5Y - -0.00072, // 6Y - -0.00063, // 7Y - -0.00057, // 8Y - -0.00051, // 9Y - -0.00047, // 10Y - -0.00044, // 11Y - -0.00041, // 12Y - -0.00035, // 15Y - -0.00028, // 20Y - -0.00025, // 25Y - -0.00022, // 30Y - -0.00022, // 35Y Extrapolated - -0.00022, // 40Y Extrapolated - } - ); - - mapFC.put ( - "12M", - fc12M - ); - - return mapFC; - } - - private static final FixFloatComponent CreateSTIR ( - final JulianDate dtEffective, - final String strMaturityTenor, - final ForwardLabel fri, - final double dblCoupon, - final String strCurrency) - throws Exception - { - JulianDate dtMaturity = dtEffective.addTenor (strMaturityTenor); - - int iTenorInMonths = Helper.TenorToMonths (fri.tenor()); - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - true, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - fri.tenor(), - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - fri, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - dblCoupon, - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 12 / iTenorInMonths, - fri.tenor(), - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - "6M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - strMaturityTenor, - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - fri.tenor(), - strMaturityTenor, - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent irs = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - irs.setPrimaryCode ("IRS." + dtMaturity.toString() + "." + strCurrency); - - return irs; - } - - private static final void VolCorrScenario ( - final FixFloatComponent stir, - final ValuationParams valParams, - final CurveSurfaceQuoteContainer mktParams, - final double dblCustomMetricVolatility, - final double dblForwardVolatility, - final double dblFundingVolatility, - final double dblForwardFundingCorr) - throws Exception - { - String strManifestMeasure = "FairPremium"; - - ForwardLabel fri = stir.forwardLabel().get ("DERIVED"); - - FundingLabel fundingLabel = FundingLabel.Standard (fri.currency()); - - mktParams.setCustomVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - valParams.valueDate(), - VolatilityLabel.Standard (CustomLabel.Standard (stir.name() + "_" + strManifestMeasure)), - fri.currency(), - dblCustomMetricVolatility - ) - ); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - valParams.valueDate(), - VolatilityLabel.Standard (fri), - fri.currency(), - dblForwardVolatility - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - valParams.valueDate(), - VolatilityLabel.Standard (fundingLabel), - fri.currency(), - dblFundingVolatility - ) - ); - - mktParams.setForwardFundingCorrelation ( - fri, - fundingLabel, - new FlatUnivariate (dblForwardFundingCorr) - ); - - Map mapSTIROutput = stir.value ( - valParams, - null, - mktParams, - null - ); - - double dblStrike = 1.01 * mapSTIROutput.get (strManifestMeasure); - - FixFloatEuropeanOption stirReceiver = new FixFloatEuropeanOption ( - stir.name() + "::RECEIVER_OPT", - stir, - strManifestMeasure, - true, - dblStrike, - 1., - new LastTradingDateSetting ( - LastTradingDateSetting.MID_CURVE_OPTION_QUARTERLY, - "", - Integer.MIN_VALUE - ), - null - ); - - FixFloatEuropeanOption stirPayer = new FixFloatEuropeanOption ( - stir.name() + "::PAYER_OPT", - stir, - strManifestMeasure, - false, - dblStrike, - 1., - new LastTradingDateSetting ( - LastTradingDateSetting.MID_CURVE_OPTION_QUARTERLY, - "", - Integer.MIN_VALUE - ), - null - ); - - Map mapSTIRPayerOutput = stirPayer.value ( - valParams, - null, - mktParams, - null - ); - - Map mapSTIRReceiverOutput = stirReceiver.value ( - valParams, - null, - mktParams, - null - ); - - double dblATMSwapRate = mapSTIRPayerOutput.get ("ATMSwapRate"); - - double dblManifestMeasureIntrinsic = mapSTIRPayerOutput.get ("ManifestMeasureIntrinsic"); - - double dblManifestMeasureIntrinsicValue = mapSTIRPayerOutput.get ("ManifestMeasureIntrinsicValue"); - - double dblForwardPayerIntrinsic = mapSTIRPayerOutput.get ("ForwardIntrinsic"); - - double dblSpotPayerPrice = mapSTIRPayerOutput.get ("SpotPrice"); - - double dblForwardReceiverIntrinsic = mapSTIRReceiverOutput.get ("ForwardIntrinsic"); - - double dblSpotReceiverPrice = mapSTIRReceiverOutput.get ("SpotPrice"); - - System.out.println ("\t[" + - org.drip.quant.common.FormatUtil.FormatDouble (dblCustomMetricVolatility, 2, 0, 100.) + "%," + - org.drip.quant.common.FormatUtil.FormatDouble (dblForwardVolatility, 2, 0, 100.) + "%," + - org.drip.quant.common.FormatUtil.FormatDouble (dblFundingVolatility, 2, 0, 100.) + "%," + - org.drip.quant.common.FormatUtil.FormatDouble (dblForwardFundingCorr, 2, 0, 100.) + "%] =" + - org.drip.quant.common.FormatUtil.FormatDouble (dblATMSwapRate, 1, 4, 100.) + "% | " + - org.drip.quant.common.FormatUtil.FormatDouble (dblManifestMeasureIntrinsic, 1, 1, 10000.) + " | " + - org.drip.quant.common.FormatUtil.FormatDouble (dblManifestMeasureIntrinsicValue, 1, 4, 1.) + " | " + - org.drip.quant.common.FormatUtil.FormatDouble (dblForwardPayerIntrinsic, 1, 0, 10000.) + " | " + - org.drip.quant.common.FormatUtil.FormatDouble (dblSpotPayerPrice, 1, 4, 1.) + " | " + - org.drip.quant.common.FormatUtil.FormatDouble (dblForwardReceiverIntrinsic, 1, 0, 10000.) + " | " + - org.drip.quant.common.FormatUtil.FormatDouble (dblSpotReceiverPrice, 1, 4, 1.)); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strTenor = "3M"; - String strCurrency = "JPY"; - - JulianDate dtToday = DateUtil.Today().addTenorAndAdjust ( - "0D", - strCurrency - ); - - /* - * Construct the Discount Curve using its instruments and quotes - */ - - MergedDiscountForwardCurve dc = MakeDC ( - dtToday, - strCurrency - ); - - Map mapFC = MakeFC ( - dtToday, - strCurrency, - dc - ); - - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - JulianDate dtForward = dtToday.addTenor (strTenor); - - FixFloatComponent stir = CreateSTIR ( - dtForward, - "5Y", - fri, - 0.05, - strCurrency - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - mapFC.get (strTenor), - null, - null, - null, - null, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - strCurrency - ); - - double[] adblCustomMetricVolatility = new double[] {0.1, 0.5}; - double[] adblForwardVolatility = new double[] {0.1, 0.2, 0.3, 0.4, 0.5}; - double[] adblFundingVolatility = new double[] {0.10, 0.15, 0.20, 0.25, 0.30}; - double[] adblForwardFundingCorr = new double[] {-0.99, -0.50, 0.00, 0.50, 0.99}; - - System.out.println ("\tPrinting the STIR Option Output in Order (Left -> Right):"); - - System.out.println ("\t\tATM Swap Rate(%)"); - - System.out.println ("\t\tOption Intrinsic (bp)"); - - System.out.println ("\t\tOption Intrinsic Value"); - - System.out.println ("\t\tForward Intrinsic Payer (bp)"); - - System.out.println ("\t\tSpot Payer STIR Option Price"); - - System.out.println ("\t\tForward Intrinsic Receiver (bp)"); - - System.out.println ("\t\tSpot Receiver STIR Option Price"); - - System.out.println ("\t-------------------------------------------------------------"); - - System.out.println ("\t-------------------------------------------------------------"); - - for (double dblCustomMetricVolatility : adblCustomMetricVolatility) { - for (double dblForwardVolatility : adblForwardVolatility) { - for (double dblFundingVolatility : adblFundingVolatility) { - for (double dblForwardFundingCorr : adblForwardFundingCorr) - VolCorrScenario ( - stir, - valParams, - mktParams, - dblCustomMetricVolatility, - dblForwardVolatility, - dblFundingVolatility, - dblForwardFundingCorr - ); - } - } - } - } -} diff --git a/org/drip/sample/fixfloatpnl/AUDIRSAttribution.java b/org/drip/sample/fixfloatpnl/AUDIRSAttribution.java deleted file mode 100644 index 05c7bfd..0000000 --- a/org/drip/sample/fixfloatpnl/AUDIRSAttribution.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.sample.fixfloatpnl; - -import org.drip.feed.metric.FixFloatPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AUDIRSAttribution generates the Historical PnL Attribution for AUD IRS. - * - * @author Lakshmi Krishnamurthy - */ - -public class AUDIRSAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "AUD"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - - String[] astrFundingDepositTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M", - "6M" - }; - - int[] aiFundingDepositColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6 - }; - - String[] astrFundingFixFloatTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - int[] aiFundingFixFloatColumn = new int[] { - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24 - }; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - FixFloatPnLAttributor.TenorHorizonExplainComponents ( - strCurrency, - astrMaturityTenor, - aiHorizonGap, - strClosesLocation, - astrFundingDepositTenor, - aiFundingDepositColumn, - astrFundingFixFloatTenor, - aiFundingFixFloatColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/fixfloatpnl/CADIRSAttribution.java b/org/drip/sample/fixfloatpnl/CADIRSAttribution.java deleted file mode 100644 index d92ff84..0000000 --- a/org/drip/sample/fixfloatpnl/CADIRSAttribution.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.sample.fixfloatpnl; - -import org.drip.feed.metric.FixFloatPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CADIRSAttribution generates the Historical PnL Attribution for CAD IRS. - * - * @author Lakshmi Krishnamurthy - */ - -public class CADIRSAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "CAD"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - - String[] astrFundingDepositTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M", - "6M" - }; - - int[] aiFundingDepositColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6 - }; - - String[] astrFundingFixFloatTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - int[] aiFundingFixFloatColumn = new int[] { - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24 - }; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - FixFloatPnLAttributor.TenorHorizonExplainComponents ( - strCurrency, - astrMaturityTenor, - aiHorizonGap, - strClosesLocation, - astrFundingDepositTenor, - aiFundingDepositColumn, - astrFundingFixFloatTenor, - aiFundingFixFloatColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/fixfloatpnl/CHFIRSAttribution.java b/org/drip/sample/fixfloatpnl/CHFIRSAttribution.java deleted file mode 100644 index 9317b74..0000000 --- a/org/drip/sample/fixfloatpnl/CHFIRSAttribution.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.sample.fixfloatpnl; - -import org.drip.feed.metric.FixFloatPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CHFIRSAttribution generates the Historical PnL Attribution for CHF IRS. - * - * @author Lakshmi Krishnamurthy - */ - -public class CHFIRSAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "CHF"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - - String[] astrFundingDepositTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M", - "6M" - }; - - int[] aiFundingDepositColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6 - }; - - String[] astrFundingFixFloatTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - int[] aiFundingFixFloatColumn = new int[] { - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24 - }; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - FixFloatPnLAttributor.TenorHorizonExplainComponents ( - strCurrency, - astrMaturityTenor, - aiHorizonGap, - strClosesLocation, - astrFundingDepositTenor, - aiFundingDepositColumn, - astrFundingFixFloatTenor, - aiFundingFixFloatColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/fixfloatpnl/CZKIRSAttribution.java b/org/drip/sample/fixfloatpnl/CZKIRSAttribution.java deleted file mode 100644 index 55f98b6..0000000 --- a/org/drip/sample/fixfloatpnl/CZKIRSAttribution.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.sample.fixfloatpnl; - -import org.drip.feed.metric.FixFloatPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CZKIRSAttribution generates the Historical PnL Attribution for CZK IRS. - * - * @author Lakshmi Krishnamurthy - */ - -public class CZKIRSAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "CZK"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - - String[] astrFundingDepositTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M", - "6M" - }; - - int[] aiFundingDepositColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6 - }; - - String[] astrFundingFixFloatTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - int[] aiFundingFixFloatColumn = new int[] { - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24 - }; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - FixFloatPnLAttributor.TenorHorizonExplainComponents ( - strCurrency, - astrMaturityTenor, - aiHorizonGap, - strClosesLocation, - astrFundingDepositTenor, - aiFundingDepositColumn, - astrFundingFixFloatTenor, - aiFundingFixFloatColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/fixfloatpnl/DKKIRSAttribution.java b/org/drip/sample/fixfloatpnl/DKKIRSAttribution.java deleted file mode 100644 index f9e3aaa..0000000 --- a/org/drip/sample/fixfloatpnl/DKKIRSAttribution.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.sample.fixfloatpnl; - -import org.drip.feed.metric.FixFloatPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DKKIRSAttribution generates the Historical PnL Attribution for DKK IRS. - * - * @author Lakshmi Krishnamurthy - */ - -public class DKKIRSAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "DKK"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - - String[] astrFundingDepositTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M", - "6M" - }; - - int[] aiFundingDepositColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6 - }; - - String[] astrFundingFixFloatTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - int[] aiFundingFixFloatColumn = new int[] { - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24 - }; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - FixFloatPnLAttributor.TenorHorizonExplainComponents ( - strCurrency, - astrMaturityTenor, - aiHorizonGap, - strClosesLocation, - astrFundingDepositTenor, - aiFundingDepositColumn, - astrFundingFixFloatTenor, - aiFundingFixFloatColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/fixfloatpnl/EURIRSAttribution.java b/org/drip/sample/fixfloatpnl/EURIRSAttribution.java deleted file mode 100644 index 202a4fe..0000000 --- a/org/drip/sample/fixfloatpnl/EURIRSAttribution.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.sample.fixfloatpnl; - -import org.drip.feed.metric.FixFloatPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * EURIRSAttribution generates the Historical PnL Attribution for EUR IRS. - * - * @author Lakshmi Krishnamurthy - */ - -public class EURIRSAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "EUR"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - - String[] astrFundingDepositTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M", - "6M" - }; - - int[] aiFundingDepositColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6 - }; - - String[] astrFundingFixFloatTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - int[] aiFundingFixFloatColumn = new int[] { - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24 - }; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - FixFloatPnLAttributor.TenorHorizonExplainComponents ( - strCurrency, - astrMaturityTenor, - aiHorizonGap, - strClosesLocation, - astrFundingDepositTenor, - aiFundingDepositColumn, - astrFundingFixFloatTenor, - aiFundingFixFloatColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/fixfloatpnl/GBPIRSAttribution.java b/org/drip/sample/fixfloatpnl/GBPIRSAttribution.java deleted file mode 100644 index cff8e57..0000000 --- a/org/drip/sample/fixfloatpnl/GBPIRSAttribution.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.sample.fixfloatpnl; - -import org.drip.feed.metric.FixFloatPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * GBPIRSAttribution generates the Historical PnL Attribution for BPUD IRS. - * - * @author Lakshmi Krishnamurthy - */ - -public class GBPIRSAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "GBP"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - - String[] astrFundingDepositTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M", - "6M" - }; - - int[] aiFundingDepositColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6 - }; - - String[] astrFundingFixFloatTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - int[] aiFundingFixFloatColumn = new int[] { - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24 - }; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - FixFloatPnLAttributor.TenorHorizonExplainComponents ( - strCurrency, - astrMaturityTenor, - aiHorizonGap, - strClosesLocation, - astrFundingDepositTenor, - aiFundingDepositColumn, - astrFundingFixFloatTenor, - aiFundingFixFloatColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/fixfloatpnl/HKDIRSAttribution.java b/org/drip/sample/fixfloatpnl/HKDIRSAttribution.java deleted file mode 100644 index 51e4f09..0000000 --- a/org/drip/sample/fixfloatpnl/HKDIRSAttribution.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.sample.fixfloatpnl; - -import org.drip.feed.metric.FixFloatPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * HKDIRSAttribution generates the Historical PnL Attribution for HKD IRS. - * - * @author Lakshmi Krishnamurthy - */ - -public class HKDIRSAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "HKD"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - - String[] astrFundingDepositTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M", - "6M" - }; - - int[] aiFundingDepositColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6 - }; - - String[] astrFundingFixFloatTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - int[] aiFundingFixFloatColumn = new int[] { - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24 - }; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - FixFloatPnLAttributor.TenorHorizonExplainComponents ( - strCurrency, - astrMaturityTenor, - aiHorizonGap, - strClosesLocation, - astrFundingDepositTenor, - aiFundingDepositColumn, - astrFundingFixFloatTenor, - aiFundingFixFloatColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/fixfloatpnl/HUFIRSAttribution.java b/org/drip/sample/fixfloatpnl/HUFIRSAttribution.java deleted file mode 100644 index eaa449a..0000000 --- a/org/drip/sample/fixfloatpnl/HUFIRSAttribution.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.sample.fixfloatpnl; - -import org.drip.feed.metric.FixFloatPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * HUFIRSAttribution generates the Historical PnL Attribution for HUF IRS. - * - * @author Lakshmi Krishnamurthy - */ - -public class HUFIRSAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "HUF"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - - String[] astrFundingDepositTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M", - "6M" - }; - - int[] aiFundingDepositColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6 - }; - - String[] astrFundingFixFloatTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - int[] aiFundingFixFloatColumn = new int[] { - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24 - }; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - FixFloatPnLAttributor.TenorHorizonExplainComponents ( - strCurrency, - astrMaturityTenor, - aiHorizonGap, - strClosesLocation, - astrFundingDepositTenor, - aiFundingDepositColumn, - astrFundingFixFloatTenor, - aiFundingFixFloatColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/fixfloatpnl/ILSIRSAttribution.java b/org/drip/sample/fixfloatpnl/ILSIRSAttribution.java deleted file mode 100644 index 72ad9ca..0000000 --- a/org/drip/sample/fixfloatpnl/ILSIRSAttribution.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.sample.fixfloatpnl; - -import org.drip.feed.metric.FixFloatPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ILSIRSAttribution generates the Historical PnL Attribution for ILS IRS. - * - * @author Lakshmi Krishnamurthy - */ - -public class ILSIRSAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "ILS"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - - String[] astrFundingDepositTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M", - "6M" - }; - - int[] aiFundingDepositColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6 - }; - - String[] astrFundingFixFloatTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - int[] aiFundingFixFloatColumn = new int[] { - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24 - }; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - FixFloatPnLAttributor.TenorHorizonExplainComponents ( - strCurrency, - astrMaturityTenor, - aiHorizonGap, - strClosesLocation, - astrFundingDepositTenor, - aiFundingDepositColumn, - astrFundingFixFloatTenor, - aiFundingFixFloatColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/fixfloatpnl/JPYIRSAttribution.java b/org/drip/sample/fixfloatpnl/JPYIRSAttribution.java deleted file mode 100644 index b2e9e37..0000000 --- a/org/drip/sample/fixfloatpnl/JPYIRSAttribution.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.sample.fixfloatpnl; - -import org.drip.feed.metric.FixFloatPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * JPYIRSAttribution generates the Historical PnL Attribution for JPY IRS. - * - * @author Lakshmi Krishnamurthy - */ - -public class JPYIRSAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "JPY"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - - String[] astrFundingDepositTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M", - "6M" - }; - - int[] aiFundingDepositColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6 - }; - - String[] astrFundingFixFloatTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - int[] aiFundingFixFloatColumn = new int[] { - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24 - }; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - FixFloatPnLAttributor.TenorHorizonExplainComponents ( - strCurrency, - astrMaturityTenor, - aiHorizonGap, - strClosesLocation, - astrFundingDepositTenor, - aiFundingDepositColumn, - astrFundingFixFloatTenor, - aiFundingFixFloatColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/fixfloatpnl/MXNIRSAttribution.java b/org/drip/sample/fixfloatpnl/MXNIRSAttribution.java deleted file mode 100644 index 2b15f29..0000000 --- a/org/drip/sample/fixfloatpnl/MXNIRSAttribution.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.sample.fixfloatpnl; - -import org.drip.feed.metric.FixFloatPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * MXNIRSAttribution generates the Historical PnL Attribution for MXN IRS. - * - * @author Lakshmi Krishnamurthy - */ - -public class MXNIRSAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "MXN"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - - String[] astrFundingDepositTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M", - "6M" - }; - - int[] aiFundingDepositColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6 - }; - - String[] astrFundingFixFloatTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - int[] aiFundingFixFloatColumn = new int[] { - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24 - }; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - FixFloatPnLAttributor.TenorHorizonExplainComponents ( - strCurrency, - astrMaturityTenor, - aiHorizonGap, - strClosesLocation, - astrFundingDepositTenor, - aiFundingDepositColumn, - astrFundingFixFloatTenor, - aiFundingFixFloatColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/fixfloatpnl/NOKIRSAttribution.java b/org/drip/sample/fixfloatpnl/NOKIRSAttribution.java deleted file mode 100644 index a5832ce..0000000 --- a/org/drip/sample/fixfloatpnl/NOKIRSAttribution.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.sample.fixfloatpnl; - -import org.drip.feed.metric.FixFloatPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NOKIRSAttribution generates the Historical PnL Attribution for NOK IRS. - * - * @author Lakshmi Krishnamurthy - */ - -public class NOKIRSAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "NOK"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - - String[] astrFundingDepositTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M", - "6M" - }; - - int[] aiFundingDepositColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6 - }; - - String[] astrFundingFixFloatTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - int[] aiFundingFixFloatColumn = new int[] { - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24 - }; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - FixFloatPnLAttributor.TenorHorizonExplainComponents ( - strCurrency, - astrMaturityTenor, - aiHorizonGap, - strClosesLocation, - astrFundingDepositTenor, - aiFundingDepositColumn, - astrFundingFixFloatTenor, - aiFundingFixFloatColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/fixfloatpnl/NZDIRSAttribution.java b/org/drip/sample/fixfloatpnl/NZDIRSAttribution.java deleted file mode 100644 index b7f2fd6..0000000 --- a/org/drip/sample/fixfloatpnl/NZDIRSAttribution.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.sample.fixfloatpnl; - -import org.drip.feed.metric.FixFloatPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NZDIRSAttribution generates the Historical PnL Attribution for NZD IRS. - * - * @author Lakshmi Krishnamurthy - */ - -public class NZDIRSAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "NZD"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - - String[] astrFundingDepositTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M", - "6M" - }; - - int[] aiFundingDepositColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6 - }; - - String[] astrFundingFixFloatTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - int[] aiFundingFixFloatColumn = new int[] { - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24 - }; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - FixFloatPnLAttributor.TenorHorizonExplainComponents ( - strCurrency, - astrMaturityTenor, - aiHorizonGap, - strClosesLocation, - astrFundingDepositTenor, - aiFundingDepositColumn, - astrFundingFixFloatTenor, - aiFundingFixFloatColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/fixfloatpnl/PLNIRSAttribution.java b/org/drip/sample/fixfloatpnl/PLNIRSAttribution.java deleted file mode 100644 index 9345c3e..0000000 --- a/org/drip/sample/fixfloatpnl/PLNIRSAttribution.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.sample.fixfloatpnl; - -import org.drip.feed.metric.FixFloatPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PLNIRSAttribution generates the Historical PnL Attribution for PLN IRS. - * - * @author Lakshmi Krishnamurthy - */ - -public class PLNIRSAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "PLN"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - - String[] astrFundingDepositTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M", - "6M" - }; - - int[] aiFundingDepositColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6 - }; - - String[] astrFundingFixFloatTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - int[] aiFundingFixFloatColumn = new int[] { - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24 - }; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - FixFloatPnLAttributor.TenorHorizonExplainComponents ( - strCurrency, - astrMaturityTenor, - aiHorizonGap, - strClosesLocation, - astrFundingDepositTenor, - aiFundingDepositColumn, - astrFundingFixFloatTenor, - aiFundingFixFloatColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/fixfloatpnl/SEKIRSAttribution.java b/org/drip/sample/fixfloatpnl/SEKIRSAttribution.java deleted file mode 100644 index 5b62b12..0000000 --- a/org/drip/sample/fixfloatpnl/SEKIRSAttribution.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.sample.fixfloatpnl; - -import org.drip.feed.metric.FixFloatPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * SEKIRSAttribution generates the Historical PnL Attribution for SEK IRS. - * - * @author Lakshmi Krishnamurthy - */ - -public class SEKIRSAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "SEK"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - - String[] astrFundingDepositTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M", - "6M" - }; - - int[] aiFundingDepositColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6 - }; - - String[] astrFundingFixFloatTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - int[] aiFundingFixFloatColumn = new int[] { - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24 - }; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - FixFloatPnLAttributor.TenorHorizonExplainComponents ( - strCurrency, - astrMaturityTenor, - aiHorizonGap, - strClosesLocation, - astrFundingDepositTenor, - aiFundingDepositColumn, - astrFundingFixFloatTenor, - aiFundingFixFloatColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/fixfloatpnl/SGDIRSAttribution.java b/org/drip/sample/fixfloatpnl/SGDIRSAttribution.java deleted file mode 100644 index a4278ef..0000000 --- a/org/drip/sample/fixfloatpnl/SGDIRSAttribution.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.sample.fixfloatpnl; - -import org.drip.feed.metric.FixFloatPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * SGDIRSAttribution generates the Historical PnL Attribution for SGD IRS. - * - * @author Lakshmi Krishnamurthy - */ - -public class SGDIRSAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "SGD"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - - String[] astrFundingDepositTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M", - "6M" - }; - - int[] aiFundingDepositColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6 - }; - - String[] astrFundingFixFloatTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - int[] aiFundingFixFloatColumn = new int[] { - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24 - }; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - FixFloatPnLAttributor.TenorHorizonExplainComponents ( - strCurrency, - astrMaturityTenor, - aiHorizonGap, - strClosesLocation, - astrFundingDepositTenor, - aiFundingDepositColumn, - astrFundingFixFloatTenor, - aiFundingFixFloatColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/fixfloatpnl/TRYIRSAttribution.java b/org/drip/sample/fixfloatpnl/TRYIRSAttribution.java deleted file mode 100644 index 70d17fb..0000000 --- a/org/drip/sample/fixfloatpnl/TRYIRSAttribution.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.sample.fixfloatpnl; - -import org.drip.feed.metric.FixFloatPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TRYIRSAttribution generates the Historical PnL Attribution for TRY IRS. - * - * @author Lakshmi Krishnamurthy - */ - -public class TRYIRSAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "TRY"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - - String[] astrFundingDepositTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M", - "6M" - }; - - int[] aiFundingDepositColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6 - }; - - String[] astrFundingFixFloatTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - int[] aiFundingFixFloatColumn = new int[] { - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24 - }; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - FixFloatPnLAttributor.TenorHorizonExplainComponents ( - strCurrency, - astrMaturityTenor, - aiHorizonGap, - strClosesLocation, - astrFundingDepositTenor, - aiFundingDepositColumn, - astrFundingFixFloatTenor, - aiFundingFixFloatColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/fixfloatpnl/USDIRSAttribution.java b/org/drip/sample/fixfloatpnl/USDIRSAttribution.java deleted file mode 100644 index a789d7c..0000000 --- a/org/drip/sample/fixfloatpnl/USDIRSAttribution.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.sample.fixfloatpnl; - -import org.drip.feed.metric.FixFloatPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * USDIRSAttribution generates the Historical PnL Attribution for USD IRS. - * - * @author Lakshmi Krishnamurthy - */ - -public class USDIRSAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - - String[] astrFundingDepositTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M", - "6M" - }; - - int[] aiFundingDepositColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6 - }; - - String[] astrFundingFixFloatTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - int[] aiFundingFixFloatColumn = new int[] { - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24 - }; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - FixFloatPnLAttributor.TenorHorizonExplainComponents ( - strCurrency, - astrMaturityTenor, - aiHorizonGap, - strClosesLocation, - astrFundingDepositTenor, - aiFundingDepositColumn, - astrFundingFixFloatTenor, - aiFundingFixFloatColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/floatfloat/JurisdictionOTCIndexDefinitions.java b/org/drip/sample/floatfloat/JurisdictionOTCIndexDefinitions.java deleted file mode 100644 index d50d8df..0000000 --- a/org/drip/sample/floatfloat/JurisdictionOTCIndexDefinitions.java +++ /dev/null @@ -1,139 +0,0 @@ - -package org.drip.sample.floatfloat; - -import org.drip.market.otc.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * JurisdictionOTCIndexDefinitions contains all the pre-fixed Definitions of the Jurisdiction OTC Float-Float - * Swap Contracts. - * - * @author Lakshmi Krishnamurthy - */ - -public class JurisdictionOTCIndexDefinitions { - private static final void DisplayOTCInfo ( - String strCurrency) - { - FloatFloatSwapConvention ffConv = IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - System.out.println ( - "\t\t" + strCurrency + " => " + - ffConv.referenceTenor() + " | " + - ffConv.spotLag() + " | " + - ffConv.basisOnDerivedStream() + " | " + - ffConv.basisOnDerivedComponent() + " | " + - ffConv.derivedCompoundedToReference() + " | " + - ffConv.componentPair() - ); - } - - public static final void main ( - String[] args) - { - EnvManager.InitEnv (""); - - System.out.println ("\n\t--------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t\tL -> R:"); - - System.out.println ("\t\t\tCurrency"); - - System.out.println ("\t\t\tReference Tenor"); - - System.out.println ("\t\t\tSpot Lag"); - - System.out.println ("\t\t\tBasis on Derived Stream"); - - System.out.println ("\t\t\tBasis on Derived Component"); - - System.out.println ("\t\t\tDerived Stream Compounded To Reference Stream"); - - System.out.println ("\t\t\tComponent Pair"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------"); - - DisplayOTCInfo ("AUD"); - - DisplayOTCInfo ("CAD"); - - DisplayOTCInfo ("CHF"); - - DisplayOTCInfo ("CNY"); - - DisplayOTCInfo ("DKK"); - - DisplayOTCInfo ("EUR"); - - DisplayOTCInfo ("GBP"); - - DisplayOTCInfo ("HKD"); - - DisplayOTCInfo ("INR"); - - DisplayOTCInfo ("JPY"); - - DisplayOTCInfo ("NOK"); - - DisplayOTCInfo ("NZD"); - - DisplayOTCInfo ("PLN"); - - DisplayOTCInfo ("SEK"); - - DisplayOTCInfo ("SGD"); - - DisplayOTCInfo ("USD"); - - DisplayOTCInfo ("ZAR"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------"); - } -} diff --git a/org/drip/sample/floatfloat/JurisdictionOTCIndexSwaps.java b/org/drip/sample/floatfloat/JurisdictionOTCIndexSwaps.java deleted file mode 100644 index c25245a..0000000 --- a/org/drip/sample/floatfloat/JurisdictionOTCIndexSwaps.java +++ /dev/null @@ -1,1015 +0,0 @@ - -package org.drip.sample.floatfloat; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.*; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.definition.*; -import org.drip.product.fx.ComponentPair; -import org.drip.product.rates.*; -import org.drip.quant.common.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.stretch.*; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * JurisdictionOTCIndexSwaps demonstrates the Construction and Usage of the Jurisdiction Standard OTC - * Float-Float Swaps. - * - * @author Lakshmi Krishnamurthy - */ - -public class JurisdictionOTCIndexSwaps { - - private static final FixFloatComponent OTCFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final FloatFloatComponent OTCFloatFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strDerivedTenor, - final String strMaturityTenor, - final double dblBasis) - { - FloatFloatSwapConvention ffConv = IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - return ffConv.createFloatFloatComponent ( - dtSpot, - strDerivedTenor, - strMaturityTenor, - dblBasis, - 1. - ); - } - - private static final ComponentPair OTCComponentPair ( - final JulianDate dtSpot, - final String strCurrency, - final String strDerivedTenor, - final String strMaturityTenor, - final double dblReferenceFixedCoupon, - final double dblDerivedFixedCoupon, - final double dblDerivedStreamBasis) - { - FloatFloatSwapConvention ffConv = IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - return ffConv.createFixFloatComponentPair ( - dtSpot, - strDerivedTenor, - strMaturityTenor, - dblReferenceFixedCoupon, - dblDerivedFixedCoupon, - dblDerivedStreamBasis, - 1. - ); - } - - /* - * Construct the Array of Deposit from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFutures, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFutures]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - aiDay[i] + "D" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFutures, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFutures; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositFromMaturityDays ( - dtSpot, - new int[] { - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.0009875, // 9M - 0.00122, // 1Y - 0.00223, // 18M - 0.00383, // 2Y - 0.00827, // 3Y - 0.01245, // 4Y - 0.01605, // 5Y - 0.02597 // 10Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 9M - "SwapRate", // 1Y - "SwapRate", // 18M - "SwapRate", // 2Y - "SwapRate", // 3Y - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate" // 10Y - }; - - CalibratableComponent[] aSwapComp = SwapFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "9M", - "1Y", - "18M", - "2Y", - "3Y", - "4Y", - "5Y", - "10Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - aDepositComp, - adblDepositQuote, - null, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - } - - /* - * Construct an array of float-float swaps from the corresponding reference (6M) and the derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FloatFloatComponent[] OTCFloatFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final int iTenorInMonths) - throws Exception - { - FloatFloatComponent[] aFFC = new FloatFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aFFC[i] = OTCFloatFloat ( - dtSpot, - strCurrency, - iTenorInMonths + "M", - astrMaturityTenor[i], - 0. - ); - - return aFFC; - } - - /* - * Construct an array of fix-float component pairs from the corresponding reference (6M) and the derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final ComponentPair[] OTCComponentPair ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final int iTenorInMonths, - final CurveSurfaceQuoteContainer csqs) - throws Exception - { - if (null == astrMaturityTenor || 0 == astrMaturityTenor.length) return null; - - ComponentPair[] aFFCP = new ComponentPair[astrMaturityTenor.length]; - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - ComponentPair cp = OTCComponentPair ( - dtSpot, - strCurrency, - iTenorInMonths + "M", - astrMaturityTenor[i], - 0., - 0., - 0. - ); - - double dblReferenceFixedCoupon = cp.referenceComponent().measureValue ( - valParams, - null, - csqs, - null, - "FairPremium" - ); - - double dblDerivedFixedCoupon = cp.derivedComponent().measureValue ( - valParams, - null, - csqs, - null, - "FairPremium" - ); - - aFFCP[i] = OTCComponentPair ( - dtSpot, - strCurrency, - iTenorInMonths + "M", - astrMaturityTenor[i], - dblReferenceFixedCoupon, - dblDerivedFixedCoupon, - 0. - ); - } - - return aFFCP; - } - - private static final ForwardCurve MakeFloatFloatFC ( - final JulianDate dtSpot, - final String strCurrency, - final MergedDiscountForwardCurve dc, - final int iTenorInMonths, - final String[] astrxM6MFwdTenor, - final double[] adblxM6MBasisSwapQuote, - final boolean bDisplay) - throws Exception - { - if (bDisplay) { - System.out.println ("------------------------------------------------------------"); - - System.out.println (" SPL => n=4 | | |"); - - System.out.println ("---------------------------------------| LOG DF | LIBOR |"); - - System.out.println (" MSR => RECALC | REFEREN | DERIVED | | |"); - - System.out.println ("------------------------------------------------------------"); - } - - /* - * Construct the 6M-xM float-float basis swap. - */ - - FloatFloatComponent[] aFFC = OTCFloatFloat ( - dtSpot, - strCurrency, - astrxM6MFwdTenor, - iTenorInMonths - ); - - String strBasisTenor = iTenorInMonths + "M"; - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Calculate the starting forward rate off of the discount curve. - */ - - double dblStartingFwd = dc.forward ( - dtSpot.julian(), - dtSpot.addTenor (strBasisTenor).julian() - ); - - /* - * Set the discount curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Construct the shape preserving forward curve off of Quartic Polynomial Basis Spline. - */ - - ForwardCurve fcxMQuartic = ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - "QUARTIC_FWD" + strBasisTenor, - ForwardLabel.Create ( - strCurrency, - strBasisTenor - ), - valParams, - null, - mktParams, - null, - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - aFFC, - "DerivedParBasisSpread", - adblxM6MBasisSwapQuote, - dblStartingFwd - ); - - if (bDisplay) { - - /* - * Set the discount curve + quartic polynomial forward curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParamsQuarticFwd = MarketParamsBuilder.Create ( - dc, - fcxMQuartic, - null, - null, - null, - null, - null, - null - ); - - int iFreq = 12 / iTenorInMonths; - - /* - * Compute the following forward curve metrics for each of cubic polynomial forward, quartic - * polynomial forward, and KLK Hyperbolic tension forward curves: - * - Reference Basis Par Spread - * - Derived Basis Par Spread - * - * Further compare these with a) the forward rate off of the discount curve, b) the LIBOR rate, and - * c) Input Basis Swap Quote. - */ - - for (int i = 0; i < astrxM6MFwdTenor.length; ++i) { - FloatFloatComponent ffc = aFFC[i]; - String strMaturityTenor = astrxM6MFwdTenor[i]; - - int iFwdEndDate = dtSpot.addTenor (strMaturityTenor).julian(); - - int iFwdStartDate = dtSpot.addTenor (strMaturityTenor).subtractTenor (strBasisTenor).julian(); - - CaseInsensitiveTreeMap mapQuarticValue = ffc.value ( - valParams, - null, - mktParamsQuarticFwd, - null - ); - - System.out.println (" " + strMaturityTenor + " => " + - FormatUtil.FormatDouble (fcxMQuartic.forward (strMaturityTenor), 2, 2, 100.) + " | " + - FormatUtil.FormatDouble (mapQuarticValue.get ("ReferenceParBasisSpread"), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (mapQuarticValue.get ("DerivedParBasisSpread"), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (iFreq * java.lang.Math.log (dc.df (iFwdStartDate) / dc.df (iFwdEndDate)), 1, 2, 100.) + " | " + - FormatUtil.FormatDouble (dc.libor (iFwdStartDate, iFwdEndDate), 1, 2, 100.) + " | " - ); - } - } - - return fcxMQuartic; - } - - private static final ForwardCurve MakeComponentPairFC ( - final JulianDate dtSpot, - final String strCurrency, - final MergedDiscountForwardCurve dc, - final int iTenorInMonths, - final String[] astrComponentPairTenor, - final double[] adblComponentPairQuote, - final boolean bDisplay) - throws Exception - { - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Set the discount curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null, - null - ); - - org.drip.product.fx.ComponentPair[] aComponentPair = OTCComponentPair ( - dtSpot, - strCurrency, - astrComponentPairTenor, - iTenorInMonths, - mktParams - ); - - /* - * Construct the Float-Float Component Set Stretch Builder - */ - - FloatFloatSwapConvention ffConv = IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - LatentStateStretchSpec fixFloatCPStretch = LatentStateStretchBuilder.ComponentPairForwardStretch ( - "FIXFLOATCP", - aComponentPair, - valParams, - mktParams, - adblComponentPairQuote, - ffConv.basisOnDerivedComponent(), - ffConv.basisOnDerivedStream() - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - fixFloatCPStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new org.drip.spline.params.SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (5), - org.drip.spline.params.SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new org.drip.spline.params.ResponseScalingShapeControl ( - true, - new org.drip.function.r1tor1.QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - /* - * Construct the Shape Preserving Forward Curve by applying the linear curve calibrator to the array - * of Deposit and Swap Stretches. - */ - - ForwardCurve fcDerived = ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - lcc, - aStretchSpec, - aComponentPair[0].derivedComponent().forwardLabel().get ("DERIVED"), - valParams, - null, - mktParams, - null, - dc.libor ( - dtSpot, - iTenorInMonths + "M" - ) - ); - - /* - * Set the discount curve + cubic polynomial forward curve based component market parameters. - */ - - mktParams.setForwardState (fcDerived); - - if (bDisplay) { - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t----------------------------------------------------------------"); - - /* - * Cross-Comparison of the Fix-Float Component Pair "DerivedParBasisSpread" metric. - */ - - if (null != aComponentPair && null != adblComponentPairQuote) { - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t FIX-FLOAT COMPONENT PAIR QUOTE RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aComponentPair.length; ++i) - System.out.println ("\t[" + aComponentPair[i].effective() + " - " + aComponentPair[i].maturity() + "] = " + - FormatUtil.FormatDouble (aComponentPair[i].derivedComponent().measureValue (valParams, null, mktParams, null, "DerivedParBasisSpread"), 1, 2, 1.) + " | " + - FormatUtil.FormatDouble (aComponentPair[i].derivedComponent().measureValue (valParams, null, mktParams, null, "ReferenceParBasisSpread"), 1, 2, 1.) + " | " + - FormatUtil.FormatDouble (adblComponentPairQuote[i], 1, 2, 10000.) + " | " + - FormatUtil.FormatDouble (fcDerived.forward (aComponentPair[i].maturity()), 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dc.libor (aComponentPair[i].maturity().subtractTenor ("3M"), iTenorInMonths + "M"), 1, 4, 100.) + "%"); - } - - System.out.println ("\t---------------------------------------------------------"); - - System.out.println ("\n\t---------------------------------------------------------"); - - System.out.println ("\t\tFIX-FLOAT COMPONENT PAIR RUNS"); - - System.out.println ("\t---------------------------------------------------------"); - - System.out.println ("\tL -> R:"); - - System.out.println ("\t\tCurrency"); - - System.out.println ("\t\tFloat-Float Effective"); - - System.out.println ("\t\tFloat-Float Maturity"); - - System.out.println ("\t\tDerived Component Derived Stream Par Basis Spread"); - - System.out.println ("\t\tDerived Component Reference Stream Par Basis Spread"); - - System.out.println ("\t---------------------------------------------------------"); - } - - return fcDerived; - } - - private static final ForwardCurve MakeFloatFloatFC ( - final String strCurrency, - final MergedDiscountForwardCurve dc, - final boolean bDisplay) - throws Exception - { - /* - * Build and run the sampling for the 3M-6M Tenor Basis Swap from its instruments and quotes. - */ - - if (bDisplay) { - System.out.println ("\n------------------------------------------------------------"); - - System.out.println ("------------------- 3M-6M Basis Swap -----------------"); - } - - ForwardCurve fc3M = MakeFloatFloatFC ( - dc.epoch(), - strCurrency, - dc, - 3, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00186, // 1Y - 0.00127, // 2Y - 0.00097, // 3Y - 0.00080, // 4Y - 0.00067, // 5Y - 0.00058, // 6Y - 0.00051, // 7Y - 0.00046, // 8Y - 0.00042, // 9Y - 0.00038, // 10Y - 0.00035, // 11Y - 0.00033, // 12Y - 0.00028, // 15Y - 0.00022, // 20Y - 0.00020, // 25Y - 0.00018 // 30Y - }, - bDisplay - ); - - if (bDisplay) System.out.println ("------------------------------------------------------------\n\n"); - - return fc3M; - } - - private static final ForwardCurve MakeComponentPairFC ( - final String strCurrency, - final MergedDiscountForwardCurve dc, - final boolean bDisplay) - throws Exception - { - /* - * Build and run the sampling for the 3M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc3M = MakeComponentPairFC ( - dc.epoch(), - strCurrency, - dc, - 3, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00186, // 1Y - 0.00127, // 2Y - 0.00097, // 3Y - 0.00080, // 4Y - 0.00067, // 5Y - 0.00058, // 6Y - 0.00051, // 7Y - 0.00046, // 8Y - 0.00042, // 9Y - 0.00038, // 10Y - 0.00035, // 11Y - 0.00033, // 12Y - 0.00028, // 15Y - 0.00022, // 20Y - 0.00020, // 25Y - 0.00018 // 30Y - }, - bDisplay - ); - - return fc3M; - } - - private static final void OTCFloatFloatRun ( - final String strCurrency, - final JulianDate dtSpot, - final boolean bDisplay) - throws Exception - { - /* - * Construct the Discount Curve using its instruments and quotes - */ - - MergedDiscountForwardCurve dc = MakeDC ( - dtSpot, - strCurrency - ); - - ForwardCurve fc3M = MakeFloatFloatFC ( - strCurrency, - dc, - bDisplay - ); - - CurveSurfaceQuoteContainer csqs = MarketParamsBuilder.Create ( - dc, - fc3M, - null, - null, - null, - null, - null, - null - ); - - FloatFloatComponent ffc = OTCFloatFloat ( - dtSpot, - strCurrency, - "3M", - "10Y", - 0. - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - Map mapFFCMeasures = ffc.value ( - valParams, - null, - csqs, - null - ); - - System.out.println ( - "\t| " + strCurrency + " [" + ffc.effectiveDate() + " -> " + ffc.maturityDate() + "] => " + - FormatUtil.FormatDouble (mapFFCMeasures.get ("ReferenceParBasisSpread"), 1, 2, 1.) + " | " + - FormatUtil.FormatDouble (mapFFCMeasures.get ("DerivedParBasisSpread"), 1, 2, 1.) + " |" - ); - } - - private static final void OTCComponentPairRun ( - final String strCurrency, - final JulianDate dtSpot, - final String strMaturityTenor, - final boolean bDisplay) - throws Exception - { - /* - * Construct the Discount Curve using its instruments and quotes - */ - - MergedDiscountForwardCurve dc = MakeDC ( - dtSpot, - strCurrency - ); - - ForwardCurve fc3M = MakeComponentPairFC ( - strCurrency, - dc, - bDisplay - ); - - CurveSurfaceQuoteContainer csqs = MarketParamsBuilder.Create ( - dc, - fc3M, - null, - null, - null, - null, - null, - null - ); - - ComponentPair cp = OTCComponentPair ( - dtSpot, - strCurrency, - "3M", - strMaturityTenor, - 0., - 0., - 0. - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - Map mapComponentPairMeasures = cp.value ( - valParams, - null, - csqs, - null - ); - - System.out.println ( - "\t| " + strCurrency + " [" + cp.effective() + " -> " + cp.maturity() + "] => " + - FormatUtil.FormatDouble (mapComponentPairMeasures.get ("DerivedCompDerivedBasis"), 1, 2, 1.) + " | " + - FormatUtil.FormatDouble (mapComponentPairMeasures.get ("DerivedCompReferenceBasis"), 1, 2, 1.) + " |" - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - OTCFloatFloatRun ("AUD", dtSpot, true); - - System.out.println ("\t---------------------------------------------------------"); - - System.out.println ("\tL -> R:"); - - System.out.println ("\t\tCurrency"); - - System.out.println ("\t\tFloat-Float Effective"); - - System.out.println ("\t\tFloat-Float Maturity"); - - System.out.println ("\t\tReference Stream Par Basis Spread"); - - System.out.println ("\t\tDerived Stream Par Basis Spread"); - - System.out.println ("\t---------------------------------------------------------"); - - System.out.println ("\t\tFLOAT-FLOAT SINGLE COMPONENT RUNS"); - - System.out.println ("\t---------------------------------------------------------"); - - OTCFloatFloatRun ("AUD", dtSpot, false); - - OTCFloatFloatRun ("CAD", dtSpot, false); - - OTCFloatFloatRun ("CHF", dtSpot, false); - - OTCFloatFloatRun ("CNY", dtSpot, false); - - OTCFloatFloatRun ("DKK", dtSpot, false); - - OTCFloatFloatRun ("GBP", dtSpot, false); - - OTCFloatFloatRun ("HKD", dtSpot, false); - - OTCFloatFloatRun ("INR", dtSpot, false); - - OTCFloatFloatRun ("JPY", dtSpot, false); - - OTCFloatFloatRun ("NOK", dtSpot, false); - - OTCFloatFloatRun ("NZD", dtSpot, false); - - OTCFloatFloatRun ("PLN", dtSpot, false); - - OTCFloatFloatRun ("SEK", dtSpot, false); - - OTCFloatFloatRun ("SGD", dtSpot, false); - - OTCFloatFloatRun ("USD", dtSpot, false); - - OTCFloatFloatRun ("ZAR", dtSpot, false); - - OTCComponentPairRun ("EUR", dtSpot, "1Y", true); - - OTCComponentPairRun ("EUR", dtSpot, "2Y", false); - - OTCComponentPairRun ("EUR", dtSpot, "3Y", false); - - OTCComponentPairRun ("EUR", dtSpot, "4Y", false); - - OTCComponentPairRun ("EUR", dtSpot, "5Y", false); - - OTCComponentPairRun ("EUR", dtSpot, "6Y", false); - - OTCComponentPairRun ("EUR", dtSpot, "7Y", false); - - OTCComponentPairRun ("EUR", dtSpot, "8Y", false); - - OTCComponentPairRun ("EUR", dtSpot, "9Y", false); - - OTCComponentPairRun ("EUR", dtSpot, "11Y", false); - - OTCComponentPairRun ("EUR", dtSpot, "12Y", false); - - OTCComponentPairRun ("EUR", dtSpot, "15Y", false); - - OTCComponentPairRun ("EUR", dtSpot, "20Y", false); - - OTCComponentPairRun ("EUR", dtSpot, "25Y", false); - - OTCComponentPairRun ("EUR", dtSpot, "30Y", false); - - System.out.println ("\t---------------------------------------------------------"); - } -} diff --git a/org/drip/sample/forward/IBOR12MCubicKLKHyperbolic.java b/org/drip/sample/forward/IBOR12MCubicKLKHyperbolic.java deleted file mode 100644 index eaed6e9..0000000 --- a/org/drip/sample/forward/IBOR12MCubicKLKHyperbolic.java +++ /dev/null @@ -1,249 +0,0 @@ - -package org.drip.sample.forward; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.ExponentialTensionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * This Sample illustrates the Construction and Usage of the IBOR 12M Forward Curve Using Vanilla Cubic - * KLK Hyperbolic Tension B-Splines. - * - * @author Lakshmi Krishnamurthy - */ - -public class IBOR12MCubicKLKHyperbolic { - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtValue = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - String strTenor = "12M"; - String strCurrency = "USD"; - - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - MergedDiscountForwardCurve dcEONIA = OvernightIndexCurve.MakeDC ( - dtValue, - strCurrency - ); - - SegmentCustomBuilderControl scbcCubicKLKHyperbolic = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new ExponentialTensionSetParams (1.), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - double[] adblDepositQuote = new double[] { - 0.006537, - 0.006187, - 0.005772, - 0.005563, - 0.005400 - }; - - String[] astrDepositTenor = new String[] { - "1M", - "3M", - "6M", - "9M", - "12M" - }; - - /* - * Construct the Array of Fix-Float Component and their Quotes from the given set of parameters - */ - - double[] adblFRAQuote = new double[] { - 0.004974, - 0.004783, - 0.004822, - 0.005070, - 0.005481, - 0.006025 - }; - - String[] astrFRATenor = new String[] { - "3M", - "6M", - "9M", - "12M", - "15M", - "18M", - }; - - /* - * Construct the Array of Float-Float Component and their Quotes from the given set of parameters - */ - - double[] adblFloatFloatQuote = new double[] { - -0.002070, // 3Y - -0.001640, // 4Y - -0.001510, // 5Y - -0.001390, // 6Y - -0.001300, // 7Y - -0.001230, // 8Y - -0.001180, // 9Y - -0.001130, // 10Y - -0.001090, // 11Y - -0.001060, // 12Y - -0.000930, // 15Y - -0.000800, // 20Y - -0.000720, // 25Y - -0.000660 // 30Y - }; - - String[] astrFloatFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - /* - * Construct the Array of Terminal Synthetic Float-Float Components and their Quotes from the given set of parameters - */ - - String[] astrSyntheticFloatFloatTenor = new String[] { - "35Y", - "40Y", - "50Y", - "60Y" - }; - - double[] adblSyntheticFloatFloatQuote = new double[] { - -0.000660, - -0.000660, - -0.000660, - -0.000660 - }; - - ForwardCurve fc6M = IBOR6MCubicPolyVanilla.Make6MForward ( - dtValue, - strCurrency, - "6M", - true - ); - - ForwardCurve fc12M = IBORCurve.CustomIBORBuilderSample ( - dcEONIA, - fc6M, - fri, - scbcCubicKLKHyperbolic, - astrDepositTenor, - adblDepositQuote, - "ForwardRate", - astrFRATenor, - adblFRAQuote, - "ParForwardRate", - null, - null, - "SwapRate", - astrFloatFloatTenor, - adblFloatFloatQuote, - "ReferenceParBasisSpread", - astrSyntheticFloatFloatTenor, - adblSyntheticFloatFloatQuote, - "ReferenceParBasisSpread", - "---- VANILLA CUBIC KLK HYPERBOLIC TENSION B-SPLINE FORWARD CURVE ---", - true - ); - - IBORCurve.ForwardJack ( - dtValue, - "---- VANILLA CUBIC KLK HYPERBOLIC TENSION B-SPLINE FORWARD CURVE SENSITIVITY ---", - fc12M, - "DerivedParBasisSpread" - ); - } -} diff --git a/org/drip/sample/forward/IBOR12MCubicPolyVanilla.java b/org/drip/sample/forward/IBOR12MCubicPolyVanilla.java deleted file mode 100644 index 3bf488e..0000000 --- a/org/drip/sample/forward/IBOR12MCubicPolyVanilla.java +++ /dev/null @@ -1,249 +0,0 @@ - -package org.drip.sample.forward; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * This Sample illustrates the Construction and Usage of the IBOR 12M Forward Curve Using Vanilla Cubic - * Polynomial. - * - * @author Lakshmi Krishnamurthy - */ - -public class IBOR12MCubicPolyVanilla { - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtValue = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - String strTenor = "12M"; - String strCurrency = "USD"; - - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - MergedDiscountForwardCurve dcEONIA = OvernightIndexCurve.MakeDC ( - dtValue, - strCurrency - ); - - SegmentCustomBuilderControl scbcCubic = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - double[] adblDepositQuote = new double[] { - 0.006537, - 0.006187, - 0.005772, - 0.005563, - 0.005400 - }; - - String[] astrDepositTenor = new String[] { - "1M", - "3M", - "6M", - "9M", - "12M" - }; - - /* - * Construct the Array of Fix-Float Component and their Quotes from the given set of parameters - */ - - double[] adblFRAQuote = new double[] { - 0.004974, - 0.004783, - 0.004822, - 0.005070, - 0.005481, - 0.006025 - }; - - String[] astrFRATenor = new String[] { - "3M", - "6M", - "9M", - "12M", - "15M", - "18M", - }; - - /* - * Construct the Array of Float-Float Component and their Quotes from the given set of parameters - */ - - double[] adblFloatFloatQuote = new double[] { - -0.002070, // 3Y - -0.001640, // 4Y - -0.001510, // 5Y - -0.001390, // 6Y - -0.001300, // 7Y - -0.001230, // 8Y - -0.001180, // 9Y - -0.001130, // 10Y - -0.001090, // 11Y - -0.001060, // 12Y - -0.000930, // 15Y - -0.000800, // 20Y - -0.000720, // 25Y - -0.000660 // 30Y - }; - - String[] astrFloatFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - /* - * Construct the Array of Terminal Synthetic Float-Float Components and their Quotes from the given set of parameters - */ - - String[] astrSyntheticFloatFloatTenor = new String[] { - "35Y", - "40Y", - "50Y", - "60Y" - }; - - double[] adblSyntheticFloatFloatQuote = new double[] { - -0.000660, - -0.000660, - -0.000660, - -0.000660 - }; - - ForwardCurve fc6M = IBOR6MCubicPolyVanilla.Make6MForward ( - dtValue, - strCurrency, - "6M", - true - ); - - ForwardCurve fc12M = IBORCurve.CustomIBORBuilderSample ( - dcEONIA, - fc6M, - fri, - scbcCubic, - astrDepositTenor, - adblDepositQuote, - "ForwardRate", - astrFRATenor, - adblFRAQuote, - "ParForwardRate", - null, - null, - "SwapRate", - astrFloatFloatTenor, - adblFloatFloatQuote, - "ReferenceParBasisSpread", - astrSyntheticFloatFloatTenor, - adblSyntheticFloatFloatQuote, - "ReferenceParBasisSpread", - "---- VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - true - ); - - IBORCurve.ForwardJack ( - dtValue, - "---- VANILLA CUBIC POLYNOMIAL FORWARD CURVE SENSITIVITY ---", - fc12M, - "DerivedParBasisSpread" - ); - } -} diff --git a/org/drip/sample/forward/IBOR12MQuarticPolyVanilla.java b/org/drip/sample/forward/IBOR12MQuarticPolyVanilla.java deleted file mode 100644 index 98cd94d..0000000 --- a/org/drip/sample/forward/IBOR12MQuarticPolyVanilla.java +++ /dev/null @@ -1,249 +0,0 @@ - -package org.drip.sample.forward; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * This Sample illustrates the Construction and Usage of the IBOR 12M Forward Curve Using Vanilla Quartic - * Polynomial. - * - * @author Lakshmi Krishnamurthy - */ - -public class IBOR12MQuarticPolyVanilla { - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtValue = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - String strTenor = "12M"; - String strCurrency = "USD"; - - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - MergedDiscountForwardCurve dcEONIA = OvernightIndexCurve.MakeDC ( - dtValue, - strCurrency - ); - - SegmentCustomBuilderControl scbcQuartic = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (5), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - double[] adblDepositQuote = new double[] { - 0.006537, - 0.006187, - 0.005772, - 0.005563, - 0.005400 - }; - - String[] astrDepositTenor = new String[] { - "1M", - "3M", - "6M", - "9M", - "12M" - }; - - /* - * Construct the Array of Fix-Float Component and their Quotes from the given set of parameters - */ - - double[] adblFRAQuote = new double[] { - 0.004974, - 0.004783, - 0.004822, - 0.005070, - 0.005481, - 0.006025 - }; - - String[] astrFRATenor = new String[] { - "3M", - "6M", - "9M", - "12M", - "15M", - "18M", - }; - - /* - * Construct the Array of Float-Float Component and their Quotes from the given set of parameters - */ - - double[] adblFloatFloatQuote = new double[] { - -0.002070, // 3Y - -0.001640, // 4Y - -0.001510, // 5Y - -0.001390, // 6Y - -0.001300, // 7Y - -0.001230, // 8Y - -0.001180, // 9Y - -0.001130, // 10Y - -0.001090, // 11Y - -0.001060, // 12Y - -0.000930, // 15Y - -0.000800, // 20Y - -0.000720, // 25Y - -0.000660 // 30Y - }; - - String[] astrFloatFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - /* - * Construct the Array of Terminal Synthetic Float-Float Components and their Quotes from the given set of parameters - */ - - String[] astrSyntheticFloatFloatTenor = new String[] { - "35Y", - "40Y", - "50Y", - "60Y" - }; - - double[] adblSyntheticFloatFloatQuote = new double[] { - -0.000660, - -0.000660, - -0.000660, - -0.000660 - }; - - ForwardCurve fc6M = IBOR6MCubicPolyVanilla.Make6MForward ( - dtValue, - strCurrency, - "6M", - true - ); - - ForwardCurve fc12M = IBORCurve.CustomIBORBuilderSample ( - dcEONIA, - fc6M, - fri, - scbcQuartic, - astrDepositTenor, - adblDepositQuote, - "ForwardRate", - astrFRATenor, - adblFRAQuote, - "ParForwardRate", - null, - null, - "SwapRate", - astrFloatFloatTenor, - adblFloatFloatQuote, - "ReferenceParBasisSpread", - astrSyntheticFloatFloatTenor, - adblSyntheticFloatFloatQuote, - "ReferenceParBasisSpread", - "---- VANILLA QUARTIC POLYNOMIAL FORWARD CURVE ---", - true - ); - - IBORCurve.ForwardJack ( - dtValue, - "---- VANILLA QUARTIC POLYNOMIAL FORWARD CURVE SENSITIVITY ---", - fc12M, - "DerivedParBasisSpread" - ); - } -} diff --git a/org/drip/sample/forward/IBOR1MCubicKLKHyperbolic.java b/org/drip/sample/forward/IBOR1MCubicKLKHyperbolic.java deleted file mode 100644 index fea243e..0000000 --- a/org/drip/sample/forward/IBOR1MCubicKLKHyperbolic.java +++ /dev/null @@ -1,259 +0,0 @@ - -package org.drip.sample.forward; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.ExponentialTensionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * This Sample illustrates the Construction and Usage of the IBOR 1M Forward Curve Using Vanilla Cubic - * KLK Hyperbolic Tension B-Splines. - * - * @author Lakshmi Krishnamurthy - */ - -public class IBOR1MCubicKLKHyperbolic { - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtValue = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - String strTenor = "1M"; - String strCurrency = "USD"; - - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - MergedDiscountForwardCurve dcEONIA = OvernightIndexCurve.MakeDC ( - dtValue, - strCurrency - ); - - SegmentCustomBuilderControl scbcCubicKLKHyperbolic = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new ExponentialTensionSetParams (1.), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - double[] adblDepositQuote = new double[] { - 0.000661, - 0.000980, - 0.000993 - }; - - String[] astrDepositTenor = new String[] { - "1D", - "7D", - "14D" - }; - - /* - * Construct the Array of Fix-Float Component and their Quotes from the given set of parameters - */ - - double[] adblFixFloatQuote = new double[] { - 0.001100, - 0.001060, - 0.000960, - 0.000850, - 0.000790, - 0.000750, - 0.000710, - 0.000690, - 0.000660, - 0.000650, - 0.000640, - 0.000630 - }; - - String[] astrFixFloatTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M" - }; - - /* - * Construct the Array of Float-Float Component and their Quotes from the given set of parameters - */ - - double[] adblFloatFloatQuote = new double[] { - 0.002260, // 2Y - 0.002380, // 3Y - 0.002460, // 4Y - 0.002500, // 5Y - 0.002500, // 6Y - 0.002480, // 7Y - 0.002450, // 8Y - 0.002410, // 9Y - 0.002370, // 10Y - 0.002330, // 11Y - 0.002280, // 12Y - 0.002110, // 15Y - 0.001890, // 20Y - 0.001750, // 25Y - 0.001630 // 30Y - }; - - String[] astrFloatFloatTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - /* - * Construct the Array of Terminal Synthetic Float-Float Components and their Quotes from the given set of parameters - */ - - String[] astrSyntheticFloatFloatTenor = new String[] { - "35Y", - "40Y", - "50Y", - "60Y" - }; - - double[] adblSyntheticFloatFloatQuote = new double[] { - 0.001630, - 0.001630, - 0.001630, - 0.001630 - }; - - ForwardCurve fc6M = IBOR6MCubicPolyVanilla.Make6MForward ( - dtValue, - strCurrency, - "6M", - true - ); - - ForwardCurve fc = IBORCurve.CustomIBORBuilderSample ( - dcEONIA, - fc6M, - fri, - scbcCubicKLKHyperbolic, - astrDepositTenor, - adblDepositQuote, - "ForwardRate", - null, - null, - "ParForwardRate", - astrFixFloatTenor, - adblFixFloatQuote, - "SwapRate", - astrFloatFloatTenor, - adblFloatFloatQuote, - "DerivedParBasisSpread", - astrSyntheticFloatFloatTenor, - adblSyntheticFloatFloatQuote, - "DerivedParBasisSpread", - "---- VANILLA CUBIC KLK HYPERBOLIC TENSION B-SPLINE FORWARD CURVE ---", - true - ); - - IBORCurve.ForwardJack ( - dtValue, - "---- VANILLA CUBIC KLK HYPERBOLIC TENSION B-SPLINE FORWARD CURVE SENSITIVITY ---", - fc, - "DerivedParBasisSpread" - ); - } -} diff --git a/org/drip/sample/forward/IBOR1MCubicPolyVanilla.java b/org/drip/sample/forward/IBOR1MCubicPolyVanilla.java deleted file mode 100644 index 8731231..0000000 --- a/org/drip/sample/forward/IBOR1MCubicPolyVanilla.java +++ /dev/null @@ -1,258 +0,0 @@ - -package org.drip.sample.forward; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * This Sample illustrates the Construction and Usage of the IBOR 1M Forward Curve Using Vanilla Cubic - * Polynomial. - * - * @author Lakshmi Krishnamurthy - */ - -public class IBOR1MCubicPolyVanilla { - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtValue = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - String strTenor = "1M"; - String strCurrency = "GBP"; - - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - MergedDiscountForwardCurve dcEONIA = OvernightIndexCurve.MakeDC ( - dtValue, - strCurrency - ); - - SegmentCustomBuilderControl scbcCubic = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - double[] adblDepositQuote = new double[] { - 0.000661, - 0.000980, - 0.000993 - }; - - String[] astrDepositTenor = new String[] { - "1D", - "7D", - "14D" - }; - - /* - * Construct the Array of Fix-Float Component and their Quotes from the given set of parameters - */ - - double[] adblFixFloatQuote = new double[] { - 0.001100, - 0.001060, - 0.000960, - 0.000850, - 0.000790, - 0.000750, - 0.000710, - 0.000690, - 0.000660, - 0.000650, - 0.000640, - 0.000630 - }; - - String[] astrFixFloatTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M" - }; - - /* - * Construct the Array of Float-Float Component and their Quotes from the given set of parameters - */ - - double[] adblFloatFloatQuote = new double[] { - 0.002260, // 2Y - 0.002380, // 3Y - 0.002460, // 4Y - 0.002500, // 5Y - 0.002500, // 6Y - 0.002480, // 7Y - 0.002450, // 8Y - 0.002410, // 9Y - 0.002370, // 10Y - 0.002330, // 11Y - 0.002280, // 12Y - 0.002110, // 15Y - 0.001890, // 20Y - 0.001750, // 25Y - 0.001630 // 30Y - }; - - String[] astrFloatFloatTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - /* - * Construct the Array of Terminal Synthetic Float-Float Components and their Quotes from the given set of parameters - */ - - String[] astrSyntheticFloatFloatTenor = new String[] { - "35Y", - "40Y", - "50Y", - "60Y" - }; - - double[] adblSyntheticFloatFloatQuote = new double[] { - 0.001630, - 0.001630, - 0.001630, - 0.001630 - }; - - ForwardCurve fc6M = IBOR6MCubicPolyVanilla.Make6MForward ( - dtValue, - strCurrency, - "6M", - true); - - ForwardCurve fc = IBORCurve.CustomIBORBuilderSample ( - dcEONIA, - fc6M, - fri, - scbcCubic, - astrDepositTenor, - adblDepositQuote, - "ForwardRate", - null, - null, - "ParForwardRate", - astrFixFloatTenor, - adblFixFloatQuote, - "SwapRate", - astrFloatFloatTenor, - adblFloatFloatQuote, - "DerivedParBasisSpread", - astrSyntheticFloatFloatTenor, - adblSyntheticFloatFloatQuote, - "DerivedParBasisSpread", - "---- VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - true - ); - - IBORCurve.ForwardJack ( - dtValue, - "---- VANILLA CUBIC POLYNOMIAL FORWARD CURVE SENSITIVITY ---", - fc, - "DerivedParBasisSpread" - ); - } -} diff --git a/org/drip/sample/forward/IBOR1MQuarticPolyVanilla.java b/org/drip/sample/forward/IBOR1MQuarticPolyVanilla.java deleted file mode 100644 index 7cc2328..0000000 --- a/org/drip/sample/forward/IBOR1MQuarticPolyVanilla.java +++ /dev/null @@ -1,258 +0,0 @@ - -package org.drip.sample.forward; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * This Sample illustrates the Construction and Usage of the IBOR 1M Forward Curve Using Vanilla Quartic - * Polynomial. - * - * @author Lakshmi Krishnamurthy - */ - -public class IBOR1MQuarticPolyVanilla { - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtValue = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - String strTenor = "1M"; - String strCurrency = "USD"; - - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - MergedDiscountForwardCurve dcEONIA = OvernightIndexCurve.MakeDC ( - dtValue, - strCurrency - ); - - SegmentCustomBuilderControl scbcCubic = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (5), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - double[] adblDepositQuote = new double[] { - 0.000661, - 0.000980, - 0.000993 - }; - - String[] astrDepositTenor = new String[] { - "1D", - "7D", - "14D" - }; - - /* - * Construct the Array of Fix-Float Component and their Quotes from the given set of parameters - */ - - double[] adblFixFloatQuote = new double[] { - 0.001100, - 0.001060, - 0.000960, - 0.000850, - 0.000790, - 0.000750, - 0.000710, - 0.000690, - 0.000660, - 0.000650, - 0.000640, - 0.000630 - }; - - String[] astrFixFloatTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M" - }; - - /* - * Construct the Array of Float-Float Component and their Quotes from the given set of parameters - */ - - double[] adblFloatFloatQuote = new double[] { - 0.002260, // 2Y - 0.002380, // 3Y - 0.002460, // 4Y - 0.002500, // 5Y - 0.002500, // 6Y - 0.002480, // 7Y - 0.002450, // 8Y - 0.002410, // 9Y - 0.002370, // 10Y - 0.002330, // 11Y - 0.002280, // 12Y - 0.002110, // 15Y - 0.001890, // 20Y - 0.001750, // 25Y - 0.001630 // 30Y - }; - - String[] astrFloatFloatTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - /* - * Construct the Array of Terminal Synthetic Float-Float Components and their Quotes from the given set of parameters - */ - - String[] astrSyntheticFloatFloatTenor = new String[] { - "35Y", - "40Y", - "50Y", - "60Y" - }; - - double[] adblSyntheticFloatFloatQuote = new double[] { - 0.001630, - 0.001630, - 0.001630, - 0.001630 - }; - - ForwardCurve fc6M = IBOR6MCubicPolyVanilla.Make6MForward ( - dtValue, - strCurrency, - "6M", - true); - - ForwardCurve fc = IBORCurve.CustomIBORBuilderSample ( - dcEONIA, - fc6M, - fri, - scbcCubic, - astrDepositTenor, - adblDepositQuote, - "ForwardRate", - null, - null, - "ParForwardRate", - astrFixFloatTenor, - adblFixFloatQuote, - "SwapRate", - astrFloatFloatTenor, - adblFloatFloatQuote, - "DerivedParBasisSpread", - astrSyntheticFloatFloatTenor, - adblSyntheticFloatFloatQuote, - "DerivedParBasisSpread", - "---- VANILLA QUARTIC POLYNOMIAL FORWARD CURVE ---", - true - ); - - IBORCurve.ForwardJack ( - dtValue, - "---- VANILLA QUARTIC POLYNOMIAL FORWARD CURVE SENSITIVITY ---", - fc, - "DerivedParBasisSpread" - ); - } -} diff --git a/org/drip/sample/forward/IBOR3MCubicKLKHyperbolic.java b/org/drip/sample/forward/IBOR3MCubicKLKHyperbolic.java deleted file mode 100644 index 81023ac..0000000 --- a/org/drip/sample/forward/IBOR3MCubicKLKHyperbolic.java +++ /dev/null @@ -1,251 +0,0 @@ - -package org.drip.sample.forward; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.ExponentialTensionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * This Sample illustrates the Construction and Usage of the IBOR 3M Forward Curve Using Cubic KLK - * Hyperbolic Tension B-Spline. - * - * @author Lakshmi Krishnamurthy - */ - -public class IBOR3MCubicKLKHyperbolic { - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtValue = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - String strTenor = "3M"; - String strCurrency = "USD"; - - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - MergedDiscountForwardCurve dcEONIA = OvernightIndexCurve.MakeDC ( - dtValue, - strCurrency - ); - - SegmentCustomBuilderControl scbcKLKHyperbolic = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new ExponentialTensionSetParams (1.), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - double[] adblDepositQuote = new double[] { - 0.001865, - 0.001969, - 0.001951, - 0.001874 - }; - - String[] astrDepositTenor = new String[] { - "2W", - "3W", - "1M", - "2M" - }; - - /* - * Construct the Array of FRAs and their Quotes from the given set of parameters - */ - - double[] adblFRAQuote = new double[] { - 0.001790, - 0.001775, - 0.001274, - 0.001222, - 0.001269, - 0.001565, - 0.001961, - 0.002556, - 0.003101 - }; - - String[] astrFRATenor = new String[] { - "0D", - "1M", - "3M", - "6M", - "9M", - "12M", - "15M", - "18M", - "21M" - }; - - /* - * Construct the Array of Fix-Float Component and their Quotes from the given set of parameters - */ - - double[] adblFixFloatQuote = new double[] { - 0.002850, // 3Y - 0.004370, // 4Y - 0.006230, // 5Y - 0.008170, // 6Y - 0.010000, // 7Y - 0.011710, // 8Y - 0.013240, // 9Y - 0.014590, // 10Y - 0.016920, // 12Y - 0.019330, // 15Y - 0.020990, // 20Y - 0.021560, // 25Y - 0.021860 // 30Y - }; - - String[] astrFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - /* - * Construct the Array of Terminal Synthetic Float-Float Components and their Quotes from the given set of parameters - */ - - String[] astrSyntheticFloatFloatTenor = new String[] { - "35Y", - "40Y", - "50Y", - "60Y" - }; - - double[] adblSyntheticFloatFloatQuote = new double[] { - 0.00065, - 0.00060, - 0.00054, - 0.00050 - }; - - ForwardCurve fc6M = IBOR6MCubicPolyVanilla.Make6MForward ( - dtValue, - strCurrency, - "6M", - true - ); - - ForwardCurve fc = IBORCurve.CustomIBORBuilderSample ( - dcEONIA, - fc6M, - fri, - scbcKLKHyperbolic, - astrDepositTenor, - adblDepositQuote, - "ForwardRate", - astrFRATenor, - adblFRAQuote, - "ParForwardRate", - astrFixFloatTenor, - adblFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - astrSyntheticFloatFloatTenor, - adblSyntheticFloatFloatQuote, - "DerivedParBasisSpread", - "---- VANILLA CUBIC KLK HYPERBOLIC TENSION B-SPLINE FORWARD CURVE ---", - true - ); - - IBORCurve.ForwardJack ( - dtValue, - "---- VANILLA CUBIC KLK HYPERBOLIC TENSION B-SPLINE FORWARD CURVE SENSITIVITY ---", - fc, - "DerivedParBasisSpread" - ); - } -} diff --git a/org/drip/sample/forward/IBOR3MCubicPolyVanilla.java b/org/drip/sample/forward/IBOR3MCubicPolyVanilla.java deleted file mode 100644 index 6d077d7..0000000 --- a/org/drip/sample/forward/IBOR3MCubicPolyVanilla.java +++ /dev/null @@ -1,276 +0,0 @@ - -package org.drip.sample.forward; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * This Sample illustrates the Construction and Usage of the IBOR 3M Forward Curve Using Vanilla Cubic - * Polynomial. - * - * @author Lakshmi Krishnamurthy - */ - -public class IBOR3MCubicPolyVanilla { - - public static final ForwardCurve Make3MForward ( - final String strTenor, - final String strCurrency, - final JulianDate dtValue, - final MergedDiscountForwardCurve dcEONIA, - final ForwardCurve fc6M, - final SegmentCustomBuilderControl scbc, - final boolean bPrintMetric) - throws Exception - { - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - double[] adblDepositQuote = new double[] { - 0.001865, - 0.001969, - 0.001951, - 0.001874 - }; - - String[] astrDepositTenor = new String[] { - "2W", - "3W", - "1M", - "2M" - }; - - /* - * Construct the Array of FRAs and their Quotes from the given set of parameters - */ - - double[] adblFRAQuote = new double[] { - 0.001790, - 0.001775, - 0.001274, - 0.001222, - 0.001269, - 0.001565, - 0.001961, - 0.002556, - 0.003101 - }; - - String[] astrFRATenor = new String[] { - "0D", - "1M", - "3M", - "6M", - "9M", - "12M", - "15M", - "18M", - "21M" - }; - - /* - * Construct the Array of Fix-Float Component and their Quotes from the given set of parameters - */ - - double[] adblFixFloatQuote = new double[] { - 0.002850, // 3Y - 0.004370, // 4Y - 0.006230, // 5Y - 0.008170, // 6Y - 0.010000, // 7Y - 0.011710, // 8Y - 0.013240, // 9Y - 0.014590, // 10Y - 0.016920, // 12Y - 0.019330, // 15Y - 0.020990, // 20Y - 0.021560, // 25Y - 0.021860 // 30Y - }; - - String[] astrFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - /* - * Construct the Array of Terminal Synthetic Float-Float Components and their Quotes from the given set of parameters - */ - - String[] astrSyntheticFloatFloatTenor = new String[] { - "35Y", - "40Y", - "50Y", - "60Y" - }; - - double[] adblSyntheticFloatFloatQuote = new double[] { - 0.00065, - 0.00060, - 0.00054, - 0.00050 - }; - - ForwardCurve fc = - IBORCurve.CustomIBORBuilderSample ( - dcEONIA, - fc6M, - fri, - scbc, - astrDepositTenor, - adblDepositQuote, - "ForwardRate", - astrFRATenor, - adblFRAQuote, - "ParForwardRate", - astrFixFloatTenor, - adblFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - astrSyntheticFloatFloatTenor, - adblSyntheticFloatFloatQuote, - "DerivedParBasisSpread", - "---- VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - bPrintMetric - ); - - return fc; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtValue = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - String strTenor = "3M"; - String strCurrency = "GBP"; - - MergedDiscountForwardCurve dcEONIA = OvernightIndexCurve.MakeDC ( - dtValue, - strCurrency - ); - - ForwardCurve fc6M = IBOR6MCubicPolyVanilla.Make6MForward ( - dtValue, - strCurrency, - "6M", - true - ); - - SegmentCustomBuilderControl scbcCubic = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - ForwardCurve fc = Make3MForward ( - strTenor, - strCurrency, - dtValue, - dcEONIA, - fc6M, - scbcCubic, - true - ); - - IBORCurve.ForwardJack ( - dtValue, - "---- VANILLA CUBIC POLYNOMIAL FORWARD CURVE SENSITIVITY ---", - fc, - "DerivedParBasisSpread" - ); - } -} diff --git a/org/drip/sample/forward/IBOR3MQuarticPolyVanilla.java b/org/drip/sample/forward/IBOR3MQuarticPolyVanilla.java deleted file mode 100644 index ab02887..0000000 --- a/org/drip/sample/forward/IBOR3MQuarticPolyVanilla.java +++ /dev/null @@ -1,251 +0,0 @@ - -package org.drip.sample.forward; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * This Sample illustrates the Construction and Usage of the IBOR 3M Forward Curve Using Vanilla Quartic - * Polynomial. - * - * @author Lakshmi Krishnamurthy - */ - -public class IBOR3MQuarticPolyVanilla { - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtValue = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - String strTenor = "3M"; - String strCurrency = "USD"; - - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - MergedDiscountForwardCurve dcEONIA = OvernightIndexCurve.MakeDC ( - dtValue, - strCurrency - ); - - SegmentCustomBuilderControl scbcQuartic = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (5), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - double[] adblDepositQuote = new double[] { - 0.001865, - 0.001969, - 0.001951, - 0.001874 - }; - - String[] astrDepositTenor = new String[] { - "2W", - "3W", - "1M", - "2M" - }; - - /* - * Construct the Array of FRAs and their Quotes from the given set of parameters - */ - - double[] adblFRAQuote = new double[] { - 0.001790, - 0.001775, - 0.001274, - 0.001222, - 0.001269, - 0.001565, - 0.001961, - 0.002556, - 0.003101 - }; - - String[] astrFRATenor = new String[] { - "0D", - "1M", - "3M", - "6M", - "9M", - "12M", - "15M", - "18M", - "21M" - }; - - /* - * Construct the Array of Fix-Float Component and their Quotes from the given set of parameters - */ - - double[] adblFixFloatQuote = new double[] { - 0.002850, // 3Y - 0.004370, // 4Y - 0.006230, // 5Y - 0.008170, // 6Y - 0.010000, // 7Y - 0.011710, // 8Y - 0.013240, // 9Y - 0.014590, // 10Y - 0.016920, // 12Y - 0.019330, // 15Y - 0.020990, // 20Y - 0.021560, // 25Y - 0.021860 // 30Y - }; - - String[] astrFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - /* - * Construct the Array of Terminal Synthetic Float-Float Components and their Quotes from the given set of parameters - */ - - String[] astrSyntheticFloatFloatTenor = new String[] { - "35Y", - "40Y", - "50Y", - "60Y" - }; - - double[] adblSyntheticFloatFloatQuote = new double[] { - 0.00065, - 0.00060, - 0.00054, - 0.00050 - }; - - ForwardCurve fc6M = IBOR6MCubicPolyVanilla.Make6MForward ( - dtValue, - strCurrency, - "6M", - true); - - ForwardCurve fc = - IBORCurve.CustomIBORBuilderSample ( - dcEONIA, - fc6M, - fri, - scbcQuartic, - astrDepositTenor, - adblDepositQuote, - "ForwardRate", - astrFRATenor, - adblFRAQuote, - "ParForwardRate", - astrFixFloatTenor, - adblFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - astrSyntheticFloatFloatTenor, - adblSyntheticFloatFloatQuote, - "DerivedParBasisSpread", - "---- VANILLA QUARTIC POLYNOMIAL FORWARD CURVE ---", - true - ); - - IBORCurve.ForwardJack ( - dtValue, - "---- VANILLA QUARTIC POLYNOMIAL FORWARD CURVE SENSITIVITY ---", - fc, - "DerivedParBasisSpread" - ); - } -} diff --git a/org/drip/sample/forward/IBOR6MCubicKLKHyperbolic.java b/org/drip/sample/forward/IBOR6MCubicKLKHyperbolic.java deleted file mode 100644 index bca801e..0000000 --- a/org/drip/sample/forward/IBOR6MCubicKLKHyperbolic.java +++ /dev/null @@ -1,274 +0,0 @@ - -package org.drip.sample.forward; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.ExponentialTensionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * This Sample illustrates the Construction and Usage of the IBOR 6M Forward Curve Using Cubic KLK - * Hyperbolic Tension B-Spline. - * - * @author Lakshmi Krishnamurthy - */ - -public class IBOR6MCubicKLKHyperbolic { - public static final ForwardCurve Make6MForward ( - final JulianDate dtValue, - final String strCurrency, - final String strTenor) - throws Exception - { - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - MergedDiscountForwardCurve dcEONIA = OvernightIndexCurve.MakeDC ( - dtValue, - strCurrency - ); - - SegmentCustomBuilderControl scbcCubicKLKHyperbolic = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new ExponentialTensionSetParams (1.), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - double[] adblDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - String[] astrDepositTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - /* - * Construct the Array of FRAs and their Quotes from the given set of parameters - */ - - double[] adblFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - String[] astrFRATenor = new String[] { - "0D", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - /* - * Construct the Array of Fix-Float Component and their Quotes from the given set of parameters - */ - - double[] adblFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - String[] astrFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - ForwardCurve fc = IBORCurve.CustomIBORBuilderSample ( - dcEONIA, - null, - fri, - scbcCubicKLKHyperbolic, - astrDepositTenor, - adblDepositQuote, - "ForwardRate", - astrFRATenor, - adblFRAQuote, - "ParForwardRate", - astrFixFloatTenor, - adblFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - "---- EURIBOR 6M CUBIC KLK HYPERBOLIC TENSION B-SPLINE FORWARD CURVE ---", - true - ); - - /* IBOR.ForwardJack ( - dtValue, - "---- EURIBOR 6M CUBIC KLK HYPERBOLIC TENSION B-SPLINE FORWARD CURVE SENSITIVITY ---", - fc, - "DerivedParBasisSpread" - ); */ - - return fc; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - Make6MForward ( - DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ), - "EUR", - "6M" - ); - } -} diff --git a/org/drip/sample/forward/IBOR6MCubicPolyVanilla.java b/org/drip/sample/forward/IBOR6MCubicPolyVanilla.java deleted file mode 100644 index a051ca6..0000000 --- a/org/drip/sample/forward/IBOR6MCubicPolyVanilla.java +++ /dev/null @@ -1,277 +0,0 @@ - -package org.drip.sample.forward; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * This Sample illustrates the Construction and Usage of the IBOR 6M Forward Curve Using Vanilla Cubic - * Polynomial. - * - * @author Lakshmi Krishnamurthy - */ - -public class IBOR6MCubicPolyVanilla { - public static final ForwardCurve Make6MForward ( - final JulianDate dtValue, - final String strCurrency, - final String strTenor, - final boolean bPrintMetric) - throws Exception - { - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - MergedDiscountForwardCurve dcEONIA = OvernightIndexCurve.MakeDC ( - dtValue, - strCurrency - ); - - SegmentCustomBuilderControl scbcCubic = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - double[] adblDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - String[] astrDepositTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - /* - * Construct the Array of FRAs and their Quotes from the given set of parameters - */ - - double[] adblFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - String[] astrFRATenor = new String[] { - "0D", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - /* - * Construct the Array of Fix-Float Component and their Quotes from the given set of parameters - */ - - double[] adblFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - String[] astrFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - ForwardCurve fc = IBORCurve.CustomIBORBuilderSample ( - dcEONIA, - null, - fri, - scbcCubic, - astrDepositTenor, - adblDepositQuote, - "ForwardRate", - astrFRATenor, - adblFRAQuote, - "ParForwardRate", - astrFixFloatTenor, - adblFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - "---- EURIBOR 6M VANILLA CUBIC POLYNOMIAL FORWARD CURVE ---", - bPrintMetric - ); - - /* if (bPrintMetric) - IBORCurve.ForwardJack ( - dtValue, - "---- EURIBOR 6M VANILLA CUBIC POLYNOMIAL FORWARD CURVE SENSITIVITY ---", - fc, - "DerivedParBasisSpread" - ); */ - - return fc; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - Make6MForward ( - DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ), - "GBP", - "6M", - true - ); - } -} diff --git a/org/drip/sample/forward/IBOR6MQuarticPolyVanilla.java b/org/drip/sample/forward/IBOR6MQuarticPolyVanilla.java deleted file mode 100644 index 1e08aa2..0000000 --- a/org/drip/sample/forward/IBOR6MQuarticPolyVanilla.java +++ /dev/null @@ -1,271 +0,0 @@ - -package org.drip.sample.forward; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * This Sample illustrates the Construction and Usage of the IBOR 6M Forward Curve Using Vanilla Quartic - * Polynomial Spline. - * - * @author Lakshmi Krishnamurthy - */ - -public class IBOR6MQuarticPolyVanilla { - public static final ForwardCurve Make6MForward ( - final JulianDate dtValue, - final String strCurrency, - final String strTenor) - throws Exception - { - ForwardLabel fri = ForwardLabel.Create (strCurrency, strTenor); - - MergedDiscountForwardCurve dcEONIA = OvernightIndexCurve.MakeDC ( - dtValue, - strCurrency - ); - - SegmentCustomBuilderControl scbcQuartic = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (5), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - double[] adblDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - String[] astrDepositTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - /* - * Construct the Array of FRAs and their Quotes from the given set of parameters - */ - - double[] adblFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - String[] astrFRATenor = new String[] { - "0D", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "7M", - "8M", - "9M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - /* - * Construct the Array of Fix-Float Component and their Quotes from the given set of parameters - */ - - double[] adblFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - String[] astrFixFloatTenor = new String[] { - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - ForwardCurve fc = IBORCurve.CustomIBORBuilderSample ( - dcEONIA, - null, - fri, - scbcQuartic, - astrDepositTenor, - adblDepositQuote, - "ForwardRate", - astrFRATenor, - adblFRAQuote, - "ParForwardRate", - astrFixFloatTenor, - adblFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - "---- EURIBOR 6M VANILLA QUARTIC POLYNOMIAL FORWARD CURVE ---", - true - ); - - IBORCurve.ForwardJack ( - dtValue, - "---- EURIBOR 6M VANILLA QUARTIC POLYNOMIAL FORWARD CURVE SENSITIVITY ---", - fc, - "DerivedParBasisSpread" - ); - - return fc; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - Make6MForward ( - DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ), - "EUR", - "6M" - ); - } -} diff --git a/org/drip/sample/forward/IBORCurve.java b/org/drip/sample/forward/IBORCurve.java deleted file mode 100644 index 4e76d20..0000000 --- a/org/drip/sample/forward/IBORCurve.java +++ /dev/null @@ -1,1057 +0,0 @@ - -package org.drip.sample.forward; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.analytics.support.*; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.fra.FRAStandardComponent; -import org.drip.product.fx.ComponentPair; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioForwardCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * IBORCurve illustrates the Construction and Usage of the IBOR Forward Curve. - * - * @author Lakshmi Krishnamurthy - */ - -public class IBORCurve { - - private static final FloatFloatComponent OTCFloatFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strDerivedTenor, - final String strMaturityTenor, - final double dblBasis) - { - FloatFloatSwapConvention ffConv = IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - return ffConv.createFloatFloatComponent ( - dtSpot, - strDerivedTenor, - strMaturityTenor, - dblBasis, - 1. - ); - } - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strLocation, - final String strMaturityTenor, - final String strIndex, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - strLocation, - strMaturityTenor, - strIndex - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final ComponentPair OTCComponentPair ( - final JulianDate dtSpot, - final String strCurrency, - final String strDerivedTenor, - final String strMaturityTenor, - final double dblReferenceFixedCoupon, - final double dblDerivedFixedCoupon, - final double dblBasis) - { - FloatFloatSwapConvention ffConv = IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - return ffConv.createFixFloatComponentPair ( - dtSpot, - strDerivedTenor, - strMaturityTenor, - dblReferenceFixedCoupon, - dblDerivedFixedCoupon, - dblBasis, - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositFromMaturityDays ( - final JulianDate dtEffective, - final String[] astrMaturityTenor, - final ForwardLabel fri) - throws Exception - { - if (null == astrMaturityTenor || 0 == astrMaturityTenor.length) return null; - - SingleStreamComponent[] aDeposit = new SingleStreamComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aDeposit[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addTenor (astrMaturityTenor[i]), - fri - ); - - return aDeposit; - } - - /* - * Construct the Array of FRA from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FRAStandardComponent[] FRAFromMaturityDays ( - final JulianDate dtEffective, - final ForwardLabel fri, - final String[] astrMaturityTenor, - final double[] adblFRAStrike) - throws Exception - { - if (null == astrMaturityTenor || null == adblFRAStrike || 0 == astrMaturityTenor.length) return null; - - FRAStandardComponent[] aFRA = new FRAStandardComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aFRA[i] = SingleStreamComponentBuilder.FRAStandard ( - dtEffective.addTenor (astrMaturityTenor[i]), - fri, - adblFRAStrike[i] - ); - - return aFRA; - } - - private static final FixFloatComponent[] FixFloatSwap2 ( - final JulianDate dtEffective, - final ForwardLabel fri, - final String[] astrMaturityTenor) - throws Exception - { - if (null == astrMaturityTenor || 0 == astrMaturityTenor.length) return null; - - FixFloatComponent[] aFixFloat = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aFixFloat[i] = OTCIRS ( - dtEffective, - fri.currency(), - "ALL", - astrMaturityTenor[i], - "MAIN", - 0. - ); - - return aFixFloat; - } - - private static final FixFloatComponent[] FixFloatSwap ( - final JulianDate dtValue, - final ForwardLabel fri, - final String[] astrMaturityTenor) - throws Exception - { - if (null == astrMaturityTenor || 0 == astrMaturityTenor.length) return null; - - JulianDate dtEffective = dtValue.addDays (2); - - String strCurrency = fri.currency(); - - FixFloatComponent[] aFFC = new FixFloatComponent[astrMaturityTenor.length]; - - int iTenorInMonths = new Integer (fri.tenor().split ("M")[0]); - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 1, - "Act/360", - false, - "Act/360", - false, - strCurrency, - true, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - fri.tenor(), - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - fri, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 12 / iTenorInMonths, - fri.tenor(), - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - int iTenorCompare = Helper.TenorCompare ( - astrMaturityTenor[i], - "6M" - ); - - String strFixedTenor = Helper.LEFT_TENOR_LESSER == iTenorCompare ? astrMaturityTenor[i] : "6M"; - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - strFixedTenor, - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - 0., - 0., - strCurrency - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 1, - strFixedTenor, - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.BackwardEdgeDates ( - dtEffective, - dtEffective.addTenor (astrMaturityTenor[i]), - "1Y", - null, - CompositePeriodBuilder.SHORT_STUB - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - fri.tenor(), - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - aFFC[i] = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - aFFC[i].setPrimaryCode ("FixFloat:" + astrMaturityTenor[i]); - } - - return aFFC; - } - - /* - * Construct an array of float-float swaps from the corresponding reference (6M) and the derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FloatFloatComponent[] FloatFloatSwap ( - final JulianDate dtSpot, - final ForwardLabel fri, - final String[] astrMaturityTenor) - throws Exception - { - if (null == astrMaturityTenor || 0 == astrMaturityTenor.length) return null; - - FloatFloatComponent[] aFFC = new FloatFloatComponent[astrMaturityTenor.length]; - - int iTenorInMonths = new Integer (fri.tenor().split ("M")[0]); - - String strCurrency = fri.currency(); - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aFFC[i] = OTCFloatFloat ( - dtSpot, - strCurrency, - iTenorInMonths + "M", - astrMaturityTenor[i], - 0. - ); - - return aFFC; - } - - /* - * Construct an array of fix-float component pairs from the corresponding reference (6M) and the derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final ComponentPair[] FixFloatComponentPair ( - final JulianDate dtSpot, - final CurveSurfaceQuoteContainer csqs, - final ForwardLabel friDerived, - final String[] astrMaturityTenor) - throws Exception - { - if (null == astrMaturityTenor || 0 == astrMaturityTenor.length) return null; - - ComponentPair[] aFFCP = new ComponentPair[astrMaturityTenor.length]; - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - friDerived.currency() - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - ComponentPair cp = OTCComponentPair ( - dtSpot, - friDerived.currency(), - friDerived.tenor(), - astrMaturityTenor[i], - 0., - 0., - 0. - ); - - double dblReferenceFixedCoupon = cp.referenceComponent().measureValue ( - valParams, - null, - csqs, - null, - "FairPremium" - ); - - double dblDerivedFixedCoupon = cp.derivedComponent().measureValue ( - valParams, - null, - csqs, - null, - "FairPremium" - ); - - aFFCP[i] = OTCComponentPair ( - dtSpot, - friDerived.currency(), - friDerived.tenor(), - astrMaturityTenor[i], - dblReferenceFixedCoupon, - dblDerivedFixedCoupon, - 0. - ); - } - - return aFFCP; - } - - public static final ForwardCurve CustomIBORBuilderSample ( - final MergedDiscountForwardCurve dc, - final ForwardCurve fcReference, - final ForwardLabel fri, - final SegmentCustomBuilderControl scbc, - final String[] astrDepositTenor, - final double[] adblDepositQuote, - final String strDepositCalibMeasure, - final String[] astrFRATenor, - final double[] adblFRAQuote, - final String strFRACalibMeasure, - final String[] astrFixFloatTenor, - final double[] adblFixFloatQuote, - final String strFixFloatCalibMeasure, - final String[] astrFloatFloatTenor, - final double[] adblFloatFloatQuote, - final String strFloatFloatCalibMeasure, - final String[] astrSyntheticFloatFloatTenor, - final double[] adblSyntheticFloatFloatQuote, - final String strSyntheticFloatFloatCalibMeasure, - final String strHeaderComment, - final boolean bPrintMetric) - throws Exception - { - if (bPrintMetric) { - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t " + strHeaderComment); - - System.out.println ("\t----------------------------------------------------------------"); - } - - JulianDate dtValue = dc.epoch(); - - SingleStreamComponent[] aDeposit = DepositFromMaturityDays ( - dtValue, - astrDepositTenor, - fri - ); - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardStretchSpec ( - "DEPOSIT", - aDeposit, - strDepositCalibMeasure, - adblDepositQuote - ); - - FRAStandardComponent[] aFRA = FRAFromMaturityDays ( - dtValue, - fri, - astrFRATenor, - adblFRAQuote - ); - - /* - * Construct the FRA Instrument Set Stretch Builder - */ - - LatentStateStretchSpec fraStretch = LatentStateStretchBuilder.ForwardStretchSpec ( - "FRA", - aFRA, - strFRACalibMeasure, - adblFRAQuote - ); - - FixFloatComponent[] aFixFloat = FixFloatSwap2 ( - dtValue, - fri, - astrFixFloatTenor - ); - - /* - * Construct the Fix-Float Component Set Stretch Builder - */ - - LatentStateStretchSpec fixFloatStretch = LatentStateStretchBuilder.ForwardStretchSpec ( - "FIXFLOAT", - aFixFloat, - strFixFloatCalibMeasure, - adblFixFloatQuote - ); - - FloatFloatComponent[] aFloatFloat = FloatFloatSwap ( - dtValue, - fri, - astrFloatFloatTenor - ); - - /* - * Construct the Float-Float Component Set Stretch Builder - */ - - LatentStateStretchSpec floatFloatStretch = LatentStateStretchBuilder.ForwardStretchSpec ( - "FLOATFLOAT", - aFloatFloat, - strFloatFloatCalibMeasure, - adblFloatFloatQuote - ); - - FloatFloatComponent[] aSyntheticFloatFloat = FloatFloatSwap ( - dtValue, - fri, - astrSyntheticFloatFloatTenor - ); - - /* - * Construct the Synthetic Float-Float Component Set Stretch Builder - */ - - LatentStateStretchSpec syntheticFloatFloatStretch = LatentStateStretchBuilder.ForwardStretchSpec ( - "SYNTHETICFLOATFLOAT", - aSyntheticFloatFloat, - strSyntheticFloatFloatCalibMeasure, - adblSyntheticFloatFloatQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - fraStretch, - fixFloatStretch, - floatFloatStretch, - syntheticFloatFloatStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - scbc, - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtValue, - dtValue, - fri.currency() - ); - - /* - * Set the discount curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - fcReference, - null, - null, - null, - null, - null, - null - ); - - /* - * Construct the Shape Preserving Forward Curve by applying the linear curve calibrator to the array - * of Deposit and Swap Stretches. - */ - - ForwardCurve fcDerived = ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - lcc, - aStretchSpec, - fri, - valParams, - null, - mktParams, - null, - null == adblDepositQuote || 0 == adblDepositQuote.length ? adblFRAQuote[0] : adblDepositQuote[0] - ); - - /* - * Set the discount curve + cubic polynomial forward curve based component market parameters. - */ - - mktParams.setForwardState (fcDerived); - - if (bPrintMetric) { - /* - * Cross-Comparison of the Deposit Calibration Instrument "Forward" metric. - */ - - if (null != aDeposit && null != adblDepositQuote) { - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS QUOTE RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDeposit.length; ++i) - System.out.println ("\t[" + aDeposit[i].effectiveDate() + " - " + aDeposit[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aDeposit[i].measureValue (valParams, null, mktParams, null, strDepositCalibMeasure), 1, 6, 1.) + - " | " + FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (fcDerived.forward (aDeposit[i].maturityDate()), 1, 4, 100.) + "%"); - } - - /* - * Cross-Comparison of the FRA Calibration Instrument "Forward" metric. - */ - - if (null != aFRA && null != adblFRAQuote) { - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t FRA INSTRUMENTS QUOTE RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aFRA.length; ++i) - System.out.println ("\t[" + aFRA[i].effectiveDate() + " - " + aFRA[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aFRA[i].measureValue (valParams, null, mktParams, null, strFRACalibMeasure), 1, 6, 1.) + - " | " + FormatUtil.FormatDouble (adblFRAQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (fcDerived.forward (aFRA[i].maturityDate()), 1, 4, 100.) + "%"); - } - - /* - * Cross-Comparison of the Fix-Float Calibration Instrument "DerivedParBasisSpread" metric. - */ - - if (null != aFixFloat && null != adblFixFloatQuote) { - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t FIX-FLOAT INSTRUMENTS QUOTE RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aFixFloat.length; ++i) - System.out.println ("\t[" + aFixFloat[i].effectiveDate() + " - " + aFixFloat[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aFixFloat[i].measureValue (valParams, null, mktParams, null, strFixFloatCalibMeasure), 1, 4, 100.) + - "% | " + FormatUtil.FormatDouble (adblFixFloatQuote[i], 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (fcDerived.forward (aFixFloat[i].maturityDate()), 1, 4, 100.) + "%"); - } - - /* - * Cross-Comparison of the Float-Float Calibration Instrument "DerivedParBasisSpread" metric. - */ - - if (null != aFloatFloat && null != adblFloatFloatQuote) { - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t FLOAT-FLOAT INSTRUMENTS QUOTE RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aFloatFloat.length; ++i) - System.out.println ("\t[" + aFloatFloat[i].effectiveDate() + " - " + aFloatFloat[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aFloatFloat[i].measureValue (valParams, null, mktParams, null, strFloatFloatCalibMeasure), 1, 2, 1.) + - " | " + FormatUtil.FormatDouble (adblFloatFloatQuote[i], 1, 2, 10000.) + " | " + - FormatUtil.FormatDouble (fcDerived.forward (aFloatFloat[i].maturityDate()), 1, 4, 100.) + "%"); - } - - /* - * Cross-Comparison of the Synthetic Float-Float Calibration Instrument "DerivedParBasisSpread" metric. - */ - - if (null != aSyntheticFloatFloat && null != adblSyntheticFloatFloatQuote) { - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t SYNTHETIC FLOAT-FLOAT INSTRUMENTS QUOTE RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aSyntheticFloatFloat.length; ++i) - System.out.println ("\t[" + aSyntheticFloatFloat[i].effectiveDate() + " - " + aSyntheticFloatFloat[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aSyntheticFloatFloat[i].measureValue (valParams, null, mktParams, null, strSyntheticFloatFloatCalibMeasure), 1, 2, 1.) + - " | " + FormatUtil.FormatDouble (adblSyntheticFloatFloatQuote[i], 1, 2, 10000.) + " | " + - FormatUtil.FormatDouble (fcDerived.forward (aSyntheticFloatFloat[i].maturityDate()), 1, 4, 100.) + "%"); - } - } - - return fcDerived; - } - - public static final ForwardCurve CustomIBORBuilderSample2 ( - final MergedDiscountForwardCurve dc, - final ForwardCurve fcReference, - final ForwardLabel fri, - final SegmentCustomBuilderControl scbc, - final String[] astrDepositTenor, - final double[] adblDepositQuote, - final String strDepositCalibMeasure, - final String[] astrFRATenor, - final double[] adblFRAQuote, - final String strFRACalibMeasure, - final String[] astrFixFloatTenor, - final double[] adblFixFloatQuote, - final String strFixFloatCalibMeasure, - final String[] astrComponentPairTenor, - final double[] adblComponentPairQuote, - final String strComponentPairCalibMeasure, - final String[] astrSyntheticComponentPairTenor, - final double[] adblSyntheticComponentPairQuote, - final String strSyntheticComponentPairCalibMeasure, - final String strHeaderComment, - final boolean bPrintMetric) - throws Exception - { - if (bPrintMetric) { - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t " + strHeaderComment); - - System.out.println ("\t----------------------------------------------------------------"); - } - - JulianDate dtValue = dc.epoch(); - - ValuationParams valParams = new ValuationParams ( - dtValue, - dtValue, - fri.currency() - ); - - /* - * Set the discount curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - fcReference, - null, - null, - null, - null, - null, - null - ); - - SingleStreamComponent[] aDeposit = DepositFromMaturityDays ( - dtValue, - astrDepositTenor, - fri - ); - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardStretchSpec ( - "DEPOSIT", - aDeposit, - strDepositCalibMeasure, - adblDepositQuote - ); - - FRAStandardComponent[] aFRA = FRAFromMaturityDays ( - dtValue, - fri, - astrFRATenor, - adblFRAQuote - ); - - /* - * Construct the FRA Instrument Set Stretch Builder - */ - - LatentStateStretchSpec fraStretch = LatentStateStretchBuilder.ForwardStretchSpec ( - "FRA", - aFRA, - strFRACalibMeasure, - adblFRAQuote - ); - - FixFloatComponent[] aFixFloat = FixFloatSwap ( - dtValue, - fri, - astrFixFloatTenor - ); - - /* - * Construct the Fix-Float Component Set Stretch Builder - */ - - LatentStateStretchSpec fixFloatStretch = LatentStateStretchBuilder.ForwardStretchSpec ( - "FIXFLOAT", - aFixFloat, - strFixFloatCalibMeasure, - adblFixFloatQuote - ); - - org.drip.product.fx.ComponentPair[] aComponentPair = FixFloatComponentPair ( - dtValue, - mktParams, - fri, - astrComponentPairTenor - ); - - /* - * Construct the Float-Float Component Set Stretch Builder - */ - - LatentStateStretchSpec fixFloatCPStretch = LatentStateStretchBuilder.ComponentPairForwardStretch ( - "FIXFLOATCP", - aComponentPair, - valParams, - mktParams, - adblComponentPairQuote, - true, - true - ); - - org.drip.product.fx.ComponentPair[] aSyntheticComponentPair = FixFloatComponentPair ( - dtValue, - mktParams, - fri, - astrSyntheticComponentPairTenor - ); - - /* - * Construct the Synthetic Fix-Float Component Set Stretch Builder - */ - - LatentStateStretchSpec syntheticFixFloatCPStretch = LatentStateStretchBuilder.ComponentPairForwardStretch ( - "SYNTHETICFIXFLOATCP", - aSyntheticComponentPair, - valParams, - mktParams, - adblSyntheticComponentPairQuote, - true, - true - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - fraStretch, - fixFloatStretch, - fixFloatCPStretch, - syntheticFixFloatCPStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - scbc, - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - /* - * Construct the Shape Preserving Forward Curve by applying the linear curve calibrator to the array - * of Deposit and Swap Stretches. - */ - - ForwardCurve fcDerived = ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - lcc, - aStretchSpec, - fri, - valParams, - null, - mktParams, - null, - null == adblDepositQuote || 0 == adblDepositQuote.length ? adblFRAQuote[0] : adblDepositQuote[0] - ); - - /* - * Set the discount curve + cubic polynomial forward curve based component market parameters. - */ - - mktParams.setForwardState (fcDerived); - - if (bPrintMetric) { - /* - * Cross-Comparison of the Deposit Calibration Instrument "Forward" metric. - */ - - if (null != aDeposit && null != adblDepositQuote) { - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS QUOTE RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDeposit.length; ++i) - System.out.println ("\t[" + aDeposit[i].effectiveDate() + " - " + aDeposit[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aDeposit[i].measureValue (valParams, null, mktParams, null, strDepositCalibMeasure), 1, 6, 1.) + - " | " + FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (fcDerived.forward (aDeposit[i].maturityDate()), 1, 4, 100.) + "%"); - } - - /* - * Cross-Comparison of the FRA Calibration Instrument "Forward" metric. - */ - - if (null != aFRA && null != adblFRAQuote) { - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t FRA INSTRUMENTS QUOTE RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aFRA.length; ++i) - System.out.println ("\t[" + aFRA[i].effectiveDate() + " - " + aFRA[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aFRA[i].measureValue (valParams, null, mktParams, null, strFRACalibMeasure), 1, 6, 1.) + - " | " + FormatUtil.FormatDouble (adblFRAQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (fcDerived.forward (aFRA[i].maturityDate()), 1, 4, 100.) + "%"); - } - - /* - * Cross-Comparison of the Fix-Float Calibration Instrument "DerivedParBasisSpread" metric. - */ - - if (null != aFixFloat && null != adblFixFloatQuote) { - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t FIX-FLOAT INSTRUMENTS QUOTE RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aFixFloat.length; ++i) - System.out.println ("\t[" + aFixFloat[i].effectiveDate() + " - " + aFixFloat[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aFixFloat[i].measureValue (valParams, null, mktParams, null, strFixFloatCalibMeasure), 1, 2, 100.) + - "% | " + FormatUtil.FormatDouble (adblFixFloatQuote[i], 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (fcDerived.forward (aFixFloat[i].maturityDate()), 1, 4, 100.) + "%"); - } - - /* - * Cross-Comparison of the Fix-Float Component Pair "DerivedParBasisSpread" metric. - */ - - if (null != aComponentPair && null != adblComponentPairQuote) { - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t FIX-FLOAT COMPONENT PAIR QUOTE RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aComponentPair.length; ++i) - System.out.println ("\t[" + aComponentPair[i].effective() + " - " + aComponentPair[i].maturity() + "] = " + - FormatUtil.FormatDouble (aComponentPair[i].measureValue (valParams, null, mktParams, null, strComponentPairCalibMeasure), 1, 2, 1.) + - " | " + FormatUtil.FormatDouble (adblComponentPairQuote[i], 1, 2, 10000.) + " | " + - FormatUtil.FormatDouble (fcDerived.forward (aComponentPair[i].maturity()), 1, 4, 100.) + "%"); - } - - /* - * Cross-Comparison of the Synthetic Float-Float Component Pair "DerivedParBasisSpread" metric. - */ - - if (null != aSyntheticComponentPair && null != adblSyntheticComponentPairQuote) { - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t SYNTHETIC FIX-FLOAT COMPONENT PAIR QUOTE RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aSyntheticComponentPair.length; ++i) - System.out.println ("\t[" + aSyntheticComponentPair[i].effective() + " - " + aSyntheticComponentPair[i].maturity() + "] = " + - FormatUtil.FormatDouble (aSyntheticComponentPair[i].measureValue (valParams, null, mktParams, null, strSyntheticComponentPairCalibMeasure), 1, 2, 1.) + - " | " + FormatUtil.FormatDouble (adblSyntheticComponentPairQuote[i], 1, 2, 10000.) + " | " + - FormatUtil.FormatDouble (fcDerived.forward (aSyntheticComponentPair[i].maturity()), 1, 4, 100.) + "%"); - } - } - - return fcDerived; - } - - private static final void ForwardJack ( - final JulianDate dt, - final ForwardCurve fc, - final String strStartDateTenor, - final String strManifestMeasure) - { - JulianDate dtJack = dt.addTenor (strStartDateTenor); - - System.out.println ("\t" + - dtJack + " | " + - strStartDateTenor + ": " + - fc.jackDForwardDManifestMeasure ( - strManifestMeasure, - dtJack).displayString() - ); - } - - public static final void ForwardJack ( - final JulianDate dt, - final String strHeaderComment, - final ForwardCurve fc, - final String strManifestMeasure) - { - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t" + strHeaderComment); - - System.out.println ("\t----------------------------------------------------------------"); - - ForwardJack (dt, fc, "1Y", strManifestMeasure); - - ForwardJack (dt, fc, "2Y", strManifestMeasure); - - ForwardJack (dt, fc, "3Y", strManifestMeasure); - - ForwardJack (dt, fc, "5Y", strManifestMeasure); - - ForwardJack (dt, fc, "7Y", strManifestMeasure); - } -} diff --git a/org/drip/sample/forward/JurisdictionIBORIndexDefinition.java b/org/drip/sample/forward/JurisdictionIBORIndexDefinition.java deleted file mode 100644 index 830d10a..0000000 --- a/org/drip/sample/forward/JurisdictionIBORIndexDefinition.java +++ /dev/null @@ -1,143 +0,0 @@ - -package org.drip.sample.forward; - -import org.drip.analytics.support.CompositePeriodBuilder; -import org.drip.market.definition.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * JurisdictionIBORIndexDefinition demonstrates the functionality to retrieve the IBOR settings for the - * various Jurisdictions. - * - * @author Lakshmi Krishnamurthy - */ - -public class JurisdictionIBORIndexDefinition { - private static final String AccrualType ( - final int iAccrualCompounding) - { - return CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_ARITHMETIC == iAccrualCompounding ? "ARITHMETIC" : " GEOMETRIC"; - } - - private static final void DisplayNameOvernightSetting ( - final String strName) - { - IBORIndex index = IBORIndexContainer.IndexFromName (strName); - - String strLongestMaturity = index.longestMaturity(); - - String strShortestMaturity = index.shortestMaturity(); - - System.out.println ("\t[" + - index.currency() + "] => " + - index.dayCount() + " | " + - index.spotLag() + " | " + - AccrualType (index.accrualCompoundingRule()) + " | " + - (strShortestMaturity.isEmpty() ? " " : strShortestMaturity) + " | " + - (strLongestMaturity.isEmpty() ? " " : strLongestMaturity) + " | " + - index.name() - ); - } - - public static final void main ( - String[] args) - { - EnvManager.InitEnv (""); - - System.out.println ("\n\t---------------\n\t---------------\n"); - - DisplayNameOvernightSetting ("CHF-LIBOR"); - - DisplayNameOvernightSetting ("EUR-EURIBOR"); - - DisplayNameOvernightSetting ("EUR-LIBOR"); - - DisplayNameOvernightSetting ("GBP-LIBOR"); - - DisplayNameOvernightSetting ("JPY-LIBOR"); - - DisplayNameOvernightSetting ("USD-LIBOR"); - - System.out.println ("\n\t---------------\n\t---------------\n"); - - DisplayNameOvernightSetting ("AUD-LIBOR"); - - DisplayNameOvernightSetting ("CAD-LIBOR"); - - DisplayNameOvernightSetting ("CZK-LIBOR"); - - DisplayNameOvernightSetting ("DKK-LIBOR"); - - DisplayNameOvernightSetting ("HKD-LIBOR"); - - DisplayNameOvernightSetting ("HUF-LIBOR"); - - DisplayNameOvernightSetting ("IDR-LIBOR"); - - DisplayNameOvernightSetting ("INR-LIBOR"); - - DisplayNameOvernightSetting ("NOK-LIBOR"); - - DisplayNameOvernightSetting ("NZD-LIBOR"); - - DisplayNameOvernightSetting ("PLN-LIBOR"); - - DisplayNameOvernightSetting ("RMB-LIBOR"); - - DisplayNameOvernightSetting ("SGD-LIBOR"); - - DisplayNameOvernightSetting ("SEK-LIBOR"); - - DisplayNameOvernightSetting ("SKK-LIBOR"); - - DisplayNameOvernightSetting ("ZAR-LIBOR"); - } -} diff --git a/org/drip/sample/forward/OvernightIndexCurve.java b/org/drip/sample/forward/OvernightIndexCurve.java deleted file mode 100644 index e49439d..0000000 --- a/org/drip/sample/forward/OvernightIndexCurve.java +++ /dev/null @@ -1,788 +0,0 @@ - -package org.drip.sample.forward; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.market.definition.FloaterIndex; -import org.drip.market.otc.*; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.*; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * OvernightIndexCurve illustrates the Construction and Usage of the Overnight Index Discount Curve. - * - * @author Lakshmi Krishnamurthy - */ - -public class OvernightIndexCurve { - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay, - final FloaterIndex fi) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - for (int i = 0; i < aiDay.length; ++i) - aDeposit[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - null == fi ? OvernightLabel.Create ( - strCurrency - ) : ForwardLabel.Create ( - fi, - "ON" - ) - ); - - return aDeposit; - } - - private static final FixFloatComponent OTCOISFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = OvernightFixedFloatContainer.FundConventionFromJurisdiction ( - strCurrency - ); - - return null == ffConv ? null : ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Overnight Index Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OISFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - if (null == (aOIS[i] = OTCOISFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ))) - return null; - } - - return aOIS; - } - - private static final FixFloatComponent[] OvernightIndexFromMaturityTenor ( - final JulianDate dtEffective, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon, - final FloaterIndex fi) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrMaturityTenor.length]; - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - false, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - java.lang.String strFixedTenor = Helper.LEFT_TENOR_LESSER == Helper.TenorCompare ( - astrMaturityTenor[i], - "6M" - ) ? astrMaturityTenor[i] : "6M"; - - java.lang.String strFloatingTenor = Helper.LEFT_TENOR_LESSER == Helper.TenorCompare ( - astrMaturityTenor[i], - "3M" - ) ? astrMaturityTenor[i] : "3M"; - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "ON", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_OVERNIGHT, - null, - null == fi ? OvernightLabel.Create ( - strCurrency - ) : ForwardLabel.Create ( - fi, - "ON" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - strFixedTenor, - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - adblCoupon[i], - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 4, - strFloatingTenor, - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - strFixedTenor, - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - strFixedTenor, - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - strFloatingTenor, - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent ois = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - ois.setPrimaryCode ("OIS." + astrMaturityTenor[i] + "." + strCurrency); - - aOIS[i] = ois; - } - - return aOIS; - } - - /* - * Construct the Array of Overnight Index Future Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OISFuturesFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrStartTenor, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOISFutures = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - if (null == (aOISFutures[i] = OTCOISFixFloat ( - dtSpot.addTenor (astrStartTenor[i]), - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ))) - return null; - } - - return aOISFutures; - } - - private static final FixFloatComponent[] OvernightIndexFutureFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrStartTenor, - final String[] astrMaturityTenor, - final double[] adblCoupon, - final FloaterIndex fi) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrStartTenor.length]; - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrStartTenor.length; ++i) { - JulianDate dtEffective = dtSpot.addTenor (astrStartTenor[i]); - - java.lang.String strFixedTenor = Helper.LEFT_TENOR_LESSER == Helper.TenorCompare ( - astrMaturityTenor[i], - "6M" - ) ? astrMaturityTenor[i] : "6M"; - - java.lang.String strFloatingTenor = Helper.LEFT_TENOR_LESSER == Helper.TenorCompare ( - astrMaturityTenor[i], - "3M" - ) ? astrMaturityTenor[i] : "3M"; - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - strFixedTenor, - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - adblCoupon[i], - 0., - strCurrency - ); - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - false, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "ON", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_OVERNIGHT, - null, - null == fi ? OvernightLabel.Create ( - strCurrency - ) : ForwardLabel.Create ( - fi, - "ON" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 4, - strFloatingTenor, - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - strFixedTenor, - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent ois = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - ois.setPrimaryCode ("OIS." + astrMaturityTenor[i] + "." + strCurrency); - - aOIS[i] = ois; - } - - return aOIS; - } - - public static final MergedDiscountForwardCurve MakeDC ( - final String strCurrency, - final JulianDate dtSpot, - final int[] aiDepositMaturityDays, - final double[] adblDepositQuote, - final String[] astrShortEndOISMaturityTenor, - final double[] adblShortEndOISQuote, - final String[] astrOISFutureTenor, - final String[] astrOISFutureMaturityTenor, - final double[] adblOISFutureQuote, - final String[] astrLongEndOISMaturityTenor, - final double[] adblLongEndOISQuote, - final SegmentCustomBuilderControl scbc, - final FloaterIndex fi) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - aiDepositMaturityDays, - fi - ); - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of Short End OIS Instruments and their Quotes from the given set of parameters - */ - - CalibratableComponent[] aShortEndOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "1W", "2W", "3W", "1M" - }, - adblShortEndOISQuote - ); - - if (null == aShortEndOISComp) - aShortEndOISComp = OvernightIndexFromMaturityTenor (dtSpot, - strCurrency, - new java.lang.String[] { - "1W", "2W", "3W", "1M" - }, - adblShortEndOISQuote, - fi - ); - - /* - * Construct the Short End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisShortEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "OIS_SHORT_END", - aShortEndOISComp, - "SwapRate", - adblShortEndOISQuote - ); - - /* - * Construct the Array of OIS Futures Instruments and their Quotes from the given set of parameters - */ - - CalibratableComponent[] aOISFutureComp = OISFuturesFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "1M", "2M", "3M", "4M", "5M" - }, - new java.lang.String[] { - "1M", "1M", "1M", "1M", "1M" - }, - adblOISFutureQuote - ); - - if (null == aOISFutureComp) - aOISFutureComp = OvernightIndexFutureFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "1M", "2M", "3M", "4M", "5M" - }, - new java.lang.String[] { - "1M", "1M", "1M", "1M", "1M" - }, - adblOISFutureQuote, - fi - ); - - /* - * Construct the OIS Future Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisFutureStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "OIS_FUTURE", - aOISFutureComp, - "SwapRate", - adblOISFutureQuote - ); - - /* - * Construct the Array of Long End OIS Instruments and their Quotes from the given set of parameters - */ - - CalibratableComponent[] aLongEndOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "15M", "18M", "21M", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - adblLongEndOISQuote - ); - - /* - * Construct the Long End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisLongEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "OIS_LONG_END", - aLongEndOISComp, - "SwapRate", - adblLongEndOISQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - oisShortEndStretch, - oisFutureStretch, - oisLongEndStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - scbc, - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit and Swap Stretches. - */ - - return ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - null, - null, - null, - 1. - ); - } - - /** - * Construct an elaborate EONIA Discount Curve - * - * @param dtSpot The Spot Date - * @param strCurrency The Currency - * - * @return Instance of the EONIA Discount Curve - * - * @throws Exception Thrown if the OIS Discount Curve Could not be created - */ - - public static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - int[] aiDepositMaturityDays = new int[] { - 1, - 2, - 3 - }; - - double[] adblDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - /* - * Construct the Array of Short End OIS Instruments and their Quotes from the given set of parameters - */ - - String[] astrShortEndOISMaturityTenor = new java.lang.String[] { - "1W", - "2W", - "3W", - "1M" - }; - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - /* - * Construct the Array of OIS Futures Instruments and their Quotes from the given set of parameters - */ - - final String[] astrOISFutureTenor = new java.lang.String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - final String[] astrOISFutureMaturityTenor = new java.lang.String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - double[] adblOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - /* - * Construct the Array of Long End OIS Instruments and their Quotes from the given set of parameters - */ - - String[] astrLongEndOISMaturityTenor = new java.lang.String[] { - "15M", - "18M", - "21M", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - SegmentCustomBuilderControl scbcCubic = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - return MakeDC ( - strCurrency, - dtSpot, - aiDepositMaturityDays, - adblDepositQuote, - astrShortEndOISMaturityTenor, - adblShortEndOISQuote, - astrOISFutureTenor, - astrOISFutureMaturityTenor, - adblOISFutureQuote, - astrLongEndOISMaturityTenor, - adblLongEndOISQuote, - scbcCubic, - null - ); - } -} diff --git a/org/drip/sample/forwardratefutures/DIFutures.java b/org/drip/sample/forwardratefutures/DIFutures.java deleted file mode 100644 index 8faaead..0000000 --- a/org/drip/sample/forwardratefutures/DIFutures.java +++ /dev/null @@ -1,132 +0,0 @@ - -package org.drip.sample.forwardratefutures; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.param.creator.MarketParamsBuilder; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.rates.SingleStreamComponent; -import org.drip.sample.forward.OvernightIndexCurve; -import org.drip.service.env.EnvManager; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.OvernightLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * DIFutures contains the demonstration of the construction and the Valuation of the DI Futures Contract. - * - * @author Lakshmi Krishnamurthy - */ - -public class DIFutures { - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strCurrency = "BRL"; - - JulianDate dtToday = DateUtil.Today().addBusDays ( - 0, - strCurrency - ); - - MergedDiscountForwardCurve dcOIS = OvernightIndexCurve.MakeDC ( - dtToday, - strCurrency - ); - - SingleStreamComponent diFutures = SingleStreamComponentBuilder.Deposit ( - dtToday, - dtToday.addTenorAndAdjust ( - "1M", - strCurrency - ), - OvernightLabel.Create ( - strCurrency - ) - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dcOIS, - null, - null, - null, - null, - null, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - strCurrency - ); - - Map mapDIFuturesOutput = diFutures.value ( - valParams, - null, - mktParams, - null - ); - - for (Map.Entry me : mapDIFuturesOutput.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/forwardratefutures/EONIAFutures.java b/org/drip/sample/forwardratefutures/EONIAFutures.java deleted file mode 100644 index 5ff9506..0000000 --- a/org/drip/sample/forwardratefutures/EONIAFutures.java +++ /dev/null @@ -1,127 +0,0 @@ - -package org.drip.sample.forwardratefutures; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.param.creator.MarketParamsBuilder; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.rates.SingleStreamComponent; -import org.drip.sample.forward.OvernightIndexCurve; -import org.drip.service.env.EnvManager; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.OvernightLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * EONIAFutures contains the demonstration of the construction and the Valuation of the EONIA Futures - * Contract. - * - * @author Lakshmi Krishnamurthy - */ - -public class EONIAFutures { - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strCurrency = "EUR"; - - JulianDate dtToday = DateUtil.Today(); - - MergedDiscountForwardCurve dcEONIA = OvernightIndexCurve.MakeDC ( - dtToday, - strCurrency - ); - - SingleStreamComponent eoniaFutures = SingleStreamComponentBuilder.Deposit ( - dtToday, - dtToday.addTenor ("1M"), - OvernightLabel.Create ( - strCurrency - ) - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dcEONIA, - null, - null, - null, - null, - null, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - strCurrency - ); - - Map mapEONIAFuturesOutput = eoniaFutures.value ( - valParams, - null, - mktParams, - null - ); - - for (Map.Entry me : mapEONIAFuturesOutput.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/forwardratefutures/FedFundFutures.java b/org/drip/sample/forwardratefutures/FedFundFutures.java deleted file mode 100644 index 7534c7c..0000000 --- a/org/drip/sample/forwardratefutures/FedFundFutures.java +++ /dev/null @@ -1,127 +0,0 @@ - -package org.drip.sample.forwardratefutures; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.param.creator.MarketParamsBuilder; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.rates.SingleStreamComponent; -import org.drip.sample.forward.OvernightIndexCurve; -import org.drip.service.env.EnvManager; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.OvernightLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FedFundFutures contains the demonstration of the construction and the Valuation of the Fed Fund Futures - * Contract. - * - * @author Lakshmi Krishnamurthy - */ - -public class FedFundFutures { - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - - JulianDate dtToday = DateUtil.Today(); - - MergedDiscountForwardCurve dcOIS = OvernightIndexCurve.MakeDC ( - dtToday, - strCurrency - ); - - SingleStreamComponent fedFundFutures = SingleStreamComponentBuilder.Deposit ( - dtToday, - dtToday.addTenor ("1M"), - OvernightLabel.Create ( - strCurrency - ) - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dcOIS, - null, - null, - null, - null, - null, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - strCurrency - ); - - Map mapFedFundFuturesOutput = fedFundFutures.value ( - valParams, - null, - mktParams, - null - ); - - for (Map.Entry me : mapFedFundFuturesOutput.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/forwardratefutures/JurisdictionIRSFuturesDefinition.java b/org/drip/sample/forwardratefutures/JurisdictionIRSFuturesDefinition.java deleted file mode 100644 index ee8ddbe..0000000 --- a/org/drip/sample/forwardratefutures/JurisdictionIRSFuturesDefinition.java +++ /dev/null @@ -1,92 +0,0 @@ - -package org.drip.sample.forwardratefutures; - -import org.drip.market.exchange.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * JurisdictionIRSFuturesDefinition demonstrates the functionality to retrieve the IRS Futures Definitions - * for the various Jurisdictions. - * - * @author Lakshmi Krishnamurthy - */ - -public class JurisdictionIRSFuturesDefinition { - private static final void DisplayConvention ( - final String strCurrency, - final String strTenor) - { - DeliverableSwapFutures dsf = DeliverableSwapFuturesContainer.ProductInfo ( - strCurrency, - strTenor - ); - - System.out.println ("\t[" + strCurrency + "-" + strTenor + "] => " + - dsf.nominal() + " | " + - dsf.rateIncrement() + " | " + - dsf.ltds() - ); - } - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - DisplayConvention ("USD", "2Y"); - - DisplayConvention ("USD", "5Y"); - - DisplayConvention ("USD", "10Y"); - - DisplayConvention ("USD", "30Y"); - } -} diff --git a/org/drip/sample/forwardratefutures/JurisdictionIRSFuturesValuation.java b/org/drip/sample/forwardratefutures/JurisdictionIRSFuturesValuation.java deleted file mode 100644 index c4c68f7..0000000 --- a/org/drip/sample/forwardratefutures/JurisdictionIRSFuturesValuation.java +++ /dev/null @@ -1,460 +0,0 @@ - -package org.drip.sample.forwardratefutures; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.CompositePeriodBuilder; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.market.exchange.*; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * JurisdictionIRSFuturesValuation contains the demonstration of the construction and the Valuation of the - * Exchange-Traded IRS Futures Contract. - * - * @author Lakshmi Krishnamurthy - */ - -public class JurisdictionIRSFuturesValuation { - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < aiDay.length; ++i) { - aDeposit[i] = new SingleStreamComponent ( - "DEPOSIT_" + aiDay[i], - new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.EdgePair ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ) - ), - cps, - cfus - ) - ), - csp - ); - - aDeposit[i].setPrimaryCode (aiDay[i] + "D"); - } - - return aDeposit; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCIRS ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - 0. - ); - - return aIRS; - } - - /* - * This sample demonstrates discount curve calibration and input instrument calibration quote recovery. - * It shows the following: - * - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void OTCInstrumentCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 7, 14, 30, 60 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0013, 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of EDF Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aEDFComp = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtSpot, - 8, - strCurrency - ); - - double[] adblEDFQuote = new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }; - - /* - * Construct the EDF Instrument Set Stretch Builder - */ - - LatentStateStretchSpec edfStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "EDF", - aEDFComp, - "ForwardRate", - adblEDFQuote - ); - - /* - * Construct the Array of Swap Instruments and their Quotes from the given set of parameters - */ - - FixFloatComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - } - ); - - double[] adblSwapQuote = new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }; - - /* - * Construct the Swap Instrument Set Stretch Builder - */ - - LatentStateStretchSpec swapStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SWAP", - aSwapComp, - "SwapRate", - adblSwapQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] {depositStretch, edfStretch, swapStretch}; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit, Futures, and Swap Stretches. - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - CurveSurfaceQuoteContainer csqs = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Cross-Comparison of the Deposit Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t[" + aDepositComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aDepositComp[i].measureValue (valParams, null, csqs, - null, "Rate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the EDF Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t EDF INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aEDFComp.length; ++i) - System.out.println ("\t[" + aEDFComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aEDFComp[i].measureValue (valParams, null, csqs, null, "Rate"), 1, 6, 1.) - + " | " + FormatUtil.FormatDouble (adblEDFQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t SWAP INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aSwapComp.length; ++i) - System.out.println ("\t[" + aSwapComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aSwapComp[i].measureValue (valParams, null, csqs, null, "CalibSwapRate"), 1, 6, 1.) - + " | " + FormatUtil.FormatDouble (adblSwapQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aSwapComp[i].measureValue (valParams, null, csqs, null, "FairPremium"), 1, 6, 1.)); - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t EXCHANGE-TRADED SWAP INSTRUMENTS VALUATION"); - - System.out.println ("\t----------------------------------------------------------------"); - - String[] astrExchangeTenor = new String[] {"2Y", "5Y", "10Y", "30Y"}; - - double[] adblCoupon = new double[] {0.0075, 0.0200, 0.0325, 0.0400}; - - for (int i = 0; i < astrExchangeTenor.length; ++i) { - DeliverableSwapFutures dsf = DeliverableSwapFuturesContainer.ProductInfo ( - strCurrency, - astrExchangeTenor[i] - ); - - FixFloatComponent swapExchange = dsf.Create ( - dtSpot, - adblCoupon[i] - ); - - System.out.println ("\t[" + swapExchange.maturityDate() + "] = " + - FormatUtil.FormatDouble (swapExchange.measureValue (valParams, null, csqs, null, "CalibSwapRate"), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (swapExchange.measureValue (valParams, null, csqs, null, "FairPremium"), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (swapExchange.measureValue (valParams, null, csqs, null, "PV"), 4, 0, 1.) + " | " + - astrExchangeTenor[i] - ); - } - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - String strCurrency = "USD"; - - OTCInstrumentCurve ( - dtToday, - strCurrency - ); - } -} diff --git a/org/drip/sample/forwardratefutures/JurisdictionVenueOptionDetails.java b/org/drip/sample/forwardratefutures/JurisdictionVenueOptionDetails.java deleted file mode 100644 index 4f3f05e..0000000 --- a/org/drip/sample/forwardratefutures/JurisdictionVenueOptionDetails.java +++ /dev/null @@ -1,145 +0,0 @@ - -package org.drip.sample.forwardratefutures; - -import org.drip.market.exchange.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * JurisdictionVenueOptionDetails demonstrates the Functionality to retrieve the Futures Options Definitions - * for the various Jurisdictions and Venues. - * - * @author Lakshmi Krishnamurthy - */ - -public class JurisdictionVenueOptionDetails { - private static final void DisplayExchangeInfo ( - final String strFullyQualifiedName, - final String strTradingMode) - { - FuturesOptions fo = FuturesOptionsContainer.ExchangeInfo ( - strFullyQualifiedName, - strTradingMode - ); - - String strExchangeLTDS = ""; - - for (String strExchange : fo.exchanges()) { - strExchangeLTDS += "\n\t[" + strExchange + "=>"; - - for (int i = 0; i < fo.ltdsArray (strExchange).length; ++i) { - if (0 != i) strExchangeLTDS += "; "; - - strExchangeLTDS += fo.ltdsArray (strExchange)[i]; - } - - strExchangeLTDS += "]"; - } - - System.out.println ( - fo.fullyQualifiedName() + " | " + - fo.tradingMode() + - strExchangeLTDS - ); - } - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - System.out.println ("\n\t---------------\n\t---------------\n"); - - DisplayExchangeInfo ( - "CHF-LIBOR-3M", - "MARGIN" - ); - - DisplayExchangeInfo ( - "GBP-LIBOR-3M", - "MARGIN" - ); - - DisplayExchangeInfo ( - "EUR-EURIBOR-3M", - "MARGIN" - ); - - DisplayExchangeInfo ( - "JPY-LIBOR-3M", - "PREMIUM" - ); - - DisplayExchangeInfo ( - "JPY-TIBOR-3M", - "PREMIUM" - ); - - DisplayExchangeInfo ( - "JPY-LIBOR-3M", - "PREMIUM" - ); - - DisplayExchangeInfo ( - "USD-LIBOR-1M", - "PREMIUM" - ); - - DisplayExchangeInfo ( - "USD-LIBOR-3M", - "MARGIN" - ); - - DisplayExchangeInfo ( - "USD-LIBOR-3M", - "PREMIUM" - ); - } -} diff --git a/org/drip/sample/forwardratefutures/JurisdictionVenueOptionValuation.java b/org/drip/sample/forwardratefutures/JurisdictionVenueOptionValuation.java deleted file mode 100644 index 1331c99..0000000 --- a/org/drip/sample/forwardratefutures/JurisdictionVenueOptionValuation.java +++ /dev/null @@ -1,539 +0,0 @@ - -package org.drip.sample.forwardratefutures; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.*; -import org.drip.product.creator.SingleStreamOptionBuilder; -import org.drip.product.fra.FRAStandardCapFloorlet; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.sample.forward.OvernightIndexCurve; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * JurisdictionVenueOptionValuation contains the Demonstration of the Construction and the Valuation of the - * Options on Standardized LIBOR Futures Contract across Jurisdictions and Venues. - * - * @author Lakshmi Krishnamurthy - */ - -public class JurisdictionVenueOptionValuation { - - private static final FloatFloatComponent OTCFloatFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strDerivedTenor, - final String strMaturityTenor, - final double dblBasis) - { - FloatFloatSwapConvention ffConv = IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - return ffConv.createFloatFloatComponent ( - dtSpot, - strDerivedTenor, - strMaturityTenor, - dblBasis, - 1. - ); - } - - /* - * Construct an array of float-float swaps from the corresponding reference (6M) and the derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FloatFloatComponent[] MakexM6MBasisSwap ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final int iTenorInMonths) - throws Exception - { - FloatFloatComponent[] aFFC = new FloatFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aFFC[i] = OTCFloatFloat ( - dtSpot, - strCurrency, - iTenorInMonths + "M", - astrMaturityTenor[i], - 0. - ); - - return aFFC; - } - - private static final ForwardCurve MakeFC ( - final JulianDate dtSpot, - final String strCurrency, - final MergedDiscountForwardCurve dc, - final int iTenorInMonths, - final String[] astrxM6MFwdTenor, - final double[] adblxM6MBasisSwapQuote) - throws Exception - { - /* - * Construct the 6M-xM float-float basis swap. - */ - - FloatFloatComponent[] aFFC = MakexM6MBasisSwap ( - dtSpot, - strCurrency, - astrxM6MFwdTenor, - iTenorInMonths - ); - - String strBasisTenor = iTenorInMonths + "M"; - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Calculate the starting forward rate off of the discount curve. - */ - - double dblStartingFwd = dc.forward ( - dtSpot.julian(), - dtSpot.addTenor (strBasisTenor).julian() - ); - - /* - * Set the discount curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Construct the shape preserving forward curve off of Quartic Polynomial Basis Spline. - */ - - return ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - "QUARTIC_FWD" + strBasisTenor, - ForwardLabel.Create ( - strCurrency, - strBasisTenor - ), - valParams, - null, - mktParams, - null, - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (5), - aFFC, - "DerivedParBasisSpread", - adblxM6MBasisSwapQuote, - dblStartingFwd - ); - } - - private static final Map MakeFC ( - final JulianDate dt, - final String strCurrency, - final MergedDiscountForwardCurve dc) - throws Exception - { - Map mapFC = new HashMap(); - - /* - * Build and run the sampling for the 1M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc1M = MakeFC ( - dt, - strCurrency, - dc, - 1, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00551, // 1Y - 0.00387, // 2Y - 0.00298, // 3Y - 0.00247, // 4Y - 0.00211, // 5Y - 0.00185, // 6Y - 0.00165, // 7Y - 0.00150, // 8Y - 0.00137, // 9Y - 0.00127, // 10Y - 0.00119, // 11Y - 0.00112, // 12Y - 0.00096, // 15Y - 0.00079, // 20Y - 0.00069, // 25Y - 0.00062 // 30Y - } - ); - - mapFC.put ( - "1M", - fc1M - ); - - /* - * Build and run the sampling for the 3M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc3M = MakeFC ( - dt, - strCurrency, - dc, - 3, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00186, // 1Y - 0.00127, // 2Y - 0.00097, // 3Y - 0.00080, // 4Y - 0.00067, // 5Y - 0.00058, // 6Y - 0.00051, // 7Y - 0.00046, // 8Y - 0.00042, // 9Y - 0.00038, // 10Y - 0.00035, // 11Y - 0.00033, // 12Y - 0.00028, // 15Y - 0.00022, // 20Y - 0.00020, // 25Y - 0.00018 // 30Y - } - ); - - mapFC.put ( - "3M", - fc3M - ); - - /* - * Build and run the sampling for the 12M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc12M = MakeFC ( - dt, - strCurrency, - dc, - 12, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", - "35Y", "40Y" // Extrapolated - }, - new double[] { - -0.00212, // 1Y - -0.00152, // 2Y - -0.00117, // 3Y - -0.00097, // 4Y - -0.00082, // 5Y - -0.00072, // 6Y - -0.00063, // 7Y - -0.00057, // 8Y - -0.00051, // 9Y - -0.00047, // 10Y - -0.00044, // 11Y - -0.00041, // 12Y - -0.00035, // 15Y - -0.00028, // 20Y - -0.00025, // 25Y - -0.00022, // 30Y - -0.00022, // 35Y Extrapolated - -0.00022, // 40Y Extrapolated - } - ); - - mapFC.put ( - "12M", - fc12M - ); - - return mapFC; - } - - private static final void SetVolCorrelation ( - final int iValueDate, - final CurveSurfaceQuoteContainer mktParams, - final ForwardLabel fri, - final double dblForwardVol, - final double dblFundingVol, - final double dblForwardFundingCorr) - throws Exception - { - FundingLabel fundingLabel = FundingLabel.Standard (fri.currency()); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (fri), - fri.currency(), - dblForwardVol - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (fundingLabel), - fri.currency(), - dblFundingVol - ) - ); - - mktParams.setForwardFundingCorrelation ( - fri, - fundingLabel, - new FlatUnivariate (dblForwardFundingCorr) - ); - } - - private static final void FuturesOptionMetrics ( - final String strCurrency, - final String strTenor, - final JulianDate dtSpot, - final String strOptionType, - final String strExchange) - throws Exception - { - MergedDiscountForwardCurve dcOIS = OvernightIndexCurve.MakeDC ( - dtSpot, - strCurrency - ); - - ForwardLabel forwardLabel = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - Map mapFC = MakeFC ( - dtSpot, - strCurrency, - dcOIS - ); - - ForwardCurve fc = mapFC.get (strTenor); - - JulianDate dtEffective = dtSpot.addTenor ("3M"); - - FRAStandardCapFloorlet liborFuturesOption = SingleStreamOptionBuilder.ExchangeTradedFuturesOption ( - dtEffective, - forwardLabel, - fc.forward (dtEffective.addTenor (fc.tenor())), - "ParForward", - false, - strOptionType, - strExchange - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dcOIS, - fc, - null, - null, - null, - null, - null, - null - ); - - double dblForwardVol = 0.50; - double dblFundingVol = 0.50; - double dblForwardFundingCorr = 0.50; - - SetVolCorrelation ( - dtSpot.julian(), - mktParams, - forwardLabel, - dblForwardVol, - dblFundingVol, - dblForwardFundingCorr - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - Map mapOutput = liborFuturesOption.value ( - valParams, - null, - mktParams, - null - ); - - System.out.println ("\t\t" + strExchange + " | " + - FormatUtil.FormatDouble (mapOutput.get ("ATMFRA"), 1, 4, 100.) + " % | " + - FormatUtil.FormatDouble (mapOutput.get ("Upfront"), 1, 1, 10000.) + " bp | " + - forwardLabel.fullyQualifiedName() - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today(); - - System.out.println ("\tOutput Order - L -> R:"); - - System.out.println ("\t\tExchange\n\t\tATM Par FRA Level (%)\n\t\tOption Upfront (bp)\n\t\tFRA Label"); - - System.out.println ("\n\t-----------------------------------------------------"); - - System.out.println ("\t--------------- MARGIN TYPE OPTION ------------------"); - - System.out.println ("\t-----------------------------------------------------"); - - FuturesOptionMetrics ( - "CHF", - "3M", - dtToday, - "MARGIN", - "LIFFE" - ); - - FuturesOptionMetrics ( - "GBP", - "3M", - dtToday, - "MARGIN", - "LIFFE" - ); - - /* FuturesOptionMetrics ( - "EUR", - "3M", - dtToday, - "MARGIN", - "LIFFE" - ); */ - - FuturesOptionMetrics ( - "USD", - "3M", - dtToday, - "MARGIN", - "LIFFE" - ); - - System.out.println ("\t-----------------------------------------------------"); - - System.out.println ("\t-------------- PREMIUM TYPE OPTION ------------------"); - - System.out.println ("\t-----------------------------------------------------"); - - FuturesOptionMetrics ( - "JPY", - "3M", - dtToday, - "PREMIUM", - "SGX" - ); - - FuturesOptionMetrics ( - "USD", - "1M", - dtToday, - "PREMIUM", - "CME" - ); - - FuturesOptionMetrics ( - "USD", - "3M", - dtToday, - "PREMIUM", - "CME" - ); - - FuturesOptionMetrics ( - "USD", - "3M", - dtToday, - "PREMIUM", - "SGX" - ); - - System.out.println ("\t-----------------------------------------------------"); - - System.out.println ("\t-----------------------------------------------------"); - } -} diff --git a/org/drip/sample/forwardratefutures/ShortTermFuturesDefinition.java b/org/drip/sample/forwardratefutures/ShortTermFuturesDefinition.java deleted file mode 100644 index 8c6ee4d..0000000 --- a/org/drip/sample/forwardratefutures/ShortTermFuturesDefinition.java +++ /dev/null @@ -1,110 +0,0 @@ - -package org.drip.sample.forwardratefutures; - -import org.drip.market.exchange.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ShortTermFuturesDefinition illustrates the Construction and Usage of the Short Term Futures Exchange - * Details. - * - * @author Lakshmi Krishnamurthy - */ - -public class ShortTermFuturesDefinition { - private static final void DisplayExchangeInfo ( - final String strFullyQualifiedNameName) - { - ShortTermFutures stf = ShortTermFuturesContainer.ExchangeInfo (strFullyQualifiedNameName); - - String strExchange = ""; - - for (int i = 0; i < stf.exchanges().length; ++i) { - strExchange += stf.exchanges()[i]; - - if (0 != i) strExchange += " | "; - } - - System.out.println ("\t[" + - strFullyQualifiedNameName + "] => " + - stf.notional() + " || " + - strExchange - ); - } - - public static final void main ( - String[] args) - { - EnvManager.InitEnv (""); - - System.out.println ("\n\t---------------\n\t---------------\n"); - - DisplayExchangeInfo ("CAD-CDOR-3M"); - - DisplayExchangeInfo ("CHF-LIBOR-3M"); - - DisplayExchangeInfo ("DKK-CIBOR-3M"); - - DisplayExchangeInfo ("EUR-EURIBOR-3M"); - - DisplayExchangeInfo ("GBP-LIBOR-3M"); - - DisplayExchangeInfo ("JPY-LIBOR-3M"); - - DisplayExchangeInfo ("JPY-TIBOR-3M"); - - DisplayExchangeInfo ("USD-LIBOR-1M"); - - DisplayExchangeInfo ("USD-LIBOR-3M"); - - DisplayExchangeInfo ("ZAR-JIBAR-3M"); - } -} diff --git a/org/drip/sample/forwardratefuturesfeed/BA1ClosesReconstitutor.java b/org/drip/sample/forwardratefuturesfeed/BA1ClosesReconstitutor.java deleted file mode 100644 index 94408d6..0000000 --- a/org/drip/sample/forwardratefuturesfeed/BA1ClosesReconstitutor.java +++ /dev/null @@ -1,79 +0,0 @@ - -package org.drip.sample.forwardratefuturesfeed; - -import org.drip.feed.transformer.FundingFuturesClosesReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * BA1ClosesReconstitutor Cleanses, Transforms, and Re-constitutes the Formatted BA1 Closes Feed. - * - * @author Lakshmi Krishnamurthy - */ - -public class BA1ClosesReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iLastPriceIndex = 2; - int iFuturesExpiryDateIndex = 8; - String strFeedLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingFutures\\BA1_ClosesFormatted.csv"; - - FundingFuturesClosesReconstitutor.RegularizeCloses ( - strFeedLocation, - iSpotDateIndex, - iLastPriceIndex, - iFuturesExpiryDateIndex - ); - } -} diff --git a/org/drip/sample/forwardratefuturesfeed/ED1ClosesReconstitutor.java b/org/drip/sample/forwardratefuturesfeed/ED1ClosesReconstitutor.java deleted file mode 100644 index 32e6ac9..0000000 --- a/org/drip/sample/forwardratefuturesfeed/ED1ClosesReconstitutor.java +++ /dev/null @@ -1,79 +0,0 @@ - -package org.drip.sample.forwardratefuturesfeed; - -import org.drip.feed.transformer.FundingFuturesClosesReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ED1ClosesReconstitutor Cleanses, Transforms, and Re-constitutes the Formatted ED1 Closes Feed. - * - * @author Lakshmi Krishnamurthy - */ - -public class ED1ClosesReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iLastPriceIndex = 2; - int iFuturesExpiryDateIndex = 8; - String strFeedLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingFutures\\ED1_ClosesFormatted.csv"; - - FundingFuturesClosesReconstitutor.RegularizeCloses ( - strFeedLocation, - iSpotDateIndex, - iLastPriceIndex, - iFuturesExpiryDateIndex - ); - } -} diff --git a/org/drip/sample/forwardratefuturesfeed/EF1ClosesReconstitutor.java b/org/drip/sample/forwardratefuturesfeed/EF1ClosesReconstitutor.java deleted file mode 100644 index a853079..0000000 --- a/org/drip/sample/forwardratefuturesfeed/EF1ClosesReconstitutor.java +++ /dev/null @@ -1,79 +0,0 @@ - -package org.drip.sample.forwardratefuturesfeed; - -import org.drip.feed.transformer.FundingFuturesClosesReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * EF1ClosesReconstitutor Cleanses, Transforms, and Re-constitutes the Formatted EF1 Closes Feed. - * - * @author Lakshmi Krishnamurthy - */ - -public class EF1ClosesReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iLastPriceIndex = 2; - int iFuturesExpiryDateIndex = 8; - String strFeedLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingFutures\\EF1_ClosesFormatted.csv"; - - FundingFuturesClosesReconstitutor.RegularizeCloses ( - strFeedLocation, - iSpotDateIndex, - iLastPriceIndex, - iFuturesExpiryDateIndex - ); - } -} diff --git a/org/drip/sample/forwardratefuturesfeed/ER1ClosesReconstitutor.java b/org/drip/sample/forwardratefuturesfeed/ER1ClosesReconstitutor.java deleted file mode 100644 index f4cfc9b..0000000 --- a/org/drip/sample/forwardratefuturesfeed/ER1ClosesReconstitutor.java +++ /dev/null @@ -1,79 +0,0 @@ - -package org.drip.sample.forwardratefuturesfeed; - -import org.drip.feed.transformer.FundingFuturesClosesReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ER1ClosesReconstitutor Cleanses, Transforms, and Re-constitutes the Formatted ER1 Closes Feed. - * - * @author Lakshmi Krishnamurthy - */ - -public class ER1ClosesReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iLastPriceIndex = 2; - int iFuturesExpiryDateIndex = 8; - String strFeedLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingFutures\\ER1_ClosesFormatted.csv"; - - FundingFuturesClosesReconstitutor.RegularizeCloses ( - strFeedLocation, - iSpotDateIndex, - iLastPriceIndex, - iFuturesExpiryDateIndex - ); - } -} diff --git a/org/drip/sample/forwardratefuturesfeed/ES1ClosesReconstitutor.java b/org/drip/sample/forwardratefuturesfeed/ES1ClosesReconstitutor.java deleted file mode 100644 index f745769..0000000 --- a/org/drip/sample/forwardratefuturesfeed/ES1ClosesReconstitutor.java +++ /dev/null @@ -1,79 +0,0 @@ - -package org.drip.sample.forwardratefuturesfeed; - -import org.drip.feed.transformer.FundingFuturesClosesReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ES1ClosesReconstitutor Cleanses, Transforms, and Re-constitutes the Formatted ES1 Closes Feed. - * - * @author Lakshmi Krishnamurthy - */ - -public class ES1ClosesReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iLastPriceIndex = 2; - int iFuturesExpiryDateIndex = 8; - String strFeedLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingFutures\\ES1_ClosesFormatted.csv"; - - FundingFuturesClosesReconstitutor.RegularizeCloses ( - strFeedLocation, - iSpotDateIndex, - iLastPriceIndex, - iFuturesExpiryDateIndex - ); - } -} diff --git a/org/drip/sample/forwardratefuturesfeed/IR1ClosesReconstitutor.java b/org/drip/sample/forwardratefuturesfeed/IR1ClosesReconstitutor.java deleted file mode 100644 index 4deea34..0000000 --- a/org/drip/sample/forwardratefuturesfeed/IR1ClosesReconstitutor.java +++ /dev/null @@ -1,79 +0,0 @@ - -package org.drip.sample.forwardratefuturesfeed; - -import org.drip.feed.transformer.FundingFuturesClosesReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * IR1ClosesReconstitutor Cleanses, Transforms, and Re-constitutes the Formatted IR1 Closes Feed. - * - * @author Lakshmi Krishnamurthy - */ - -public class IR1ClosesReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iLastPriceIndex = 2; - int iFuturesExpiryDateIndex = 8; - String strFeedLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingFutures\\IR1_ClosesFormatted.csv"; - - FundingFuturesClosesReconstitutor.RegularizeCloses ( - strFeedLocation, - iSpotDateIndex, - iLastPriceIndex, - iFuturesExpiryDateIndex - ); - } -} diff --git a/org/drip/sample/forwardratefuturesfeed/L1ClosesReconstitutor.java b/org/drip/sample/forwardratefuturesfeed/L1ClosesReconstitutor.java deleted file mode 100644 index 25a4764..0000000 --- a/org/drip/sample/forwardratefuturesfeed/L1ClosesReconstitutor.java +++ /dev/null @@ -1,79 +0,0 @@ - -package org.drip.sample.forwardratefuturesfeed; - -import org.drip.feed.transformer.FundingFuturesClosesReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * L1ClosesReconstitutor Cleanses, Transforms, and Re-constitutes the Formatted L1 Closes Feed. - * - * @author Lakshmi Krishnamurthy - */ - -public class L1ClosesReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iLastPriceIndex = 2; - int iFuturesExpiryDateIndex = 8; - String strFeedLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingFutures\\L1_ClosesFormatted.csv"; - - FundingFuturesClosesReconstitutor.RegularizeCloses ( - strFeedLocation, - iSpotDateIndex, - iLastPriceIndex, - iFuturesExpiryDateIndex - ); - } -} diff --git a/org/drip/sample/forwardratefuturesfeed/YE1ClosesReconstitutor.java b/org/drip/sample/forwardratefuturesfeed/YE1ClosesReconstitutor.java deleted file mode 100644 index 9b82a33..0000000 --- a/org/drip/sample/forwardratefuturesfeed/YE1ClosesReconstitutor.java +++ /dev/null @@ -1,79 +0,0 @@ - -package org.drip.sample.forwardratefuturesfeed; - -import org.drip.feed.transformer.FundingFuturesClosesReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * YE1ClosesReconstitutor Cleanses, Transforms, and Re-constitutes the Formatted YE1 Closes Feed. - * - * @author Lakshmi Krishnamurthy - */ - -public class YE1ClosesReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iLastPriceIndex = 2; - int iFuturesExpiryDateIndex = 8; - String strFeedLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingFutures\\YE1_ClosesFormatted.csv"; - - FundingFuturesClosesReconstitutor.RegularizeCloses ( - strFeedLocation, - iSpotDateIndex, - iLastPriceIndex, - iFuturesExpiryDateIndex - ); - } -} diff --git a/org/drip/sample/forwardratefuturespnl/BA1Attribution.java b/org/drip/sample/forwardratefuturespnl/BA1Attribution.java deleted file mode 100644 index 465223b..0000000 --- a/org/drip/sample/forwardratefuturespnl/BA1Attribution.java +++ /dev/null @@ -1,114 +0,0 @@ - -package org.drip.sample.forwardratefuturespnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.FundingFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * BA1Attribution demonstrates the Invocation of the Historical PnL Horizon PnL Attribution analysis for the - * BA1 Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class BA1Attribution { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "CAD"; - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingFuturesCloses\\BA1ClosesReconstitutor.csv"; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblForwardRate = csvGrid.doubleArrayAtColumn (2); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (3); - - List lsPCC = FundingFuturesAPI.HorizonChangeAttribution ( - adtSpot, - adtExpiry, - adblForwardRate, - strCurrency - ); - - System.out.println ("FirstDate, SecondDate, Previous DV01, Previous Forward Rate, Spot DV01, Spot Forward Rate, 1D Gross PnL, 1D Market PnL, 1D Roll-down PnL, 1D Accrual PnL, 1D Explained PnL, 1D Unexplianed PnL, Floater Label"); - - for (PositionChangeComponents pcc : lsPCC) - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - FormatUtil.FormatDouble (pcc.pmsFirst().r1 ("DV01"), 1, 8, 1.) + ", " + - FormatUtil.FormatDouble (pcc.pmsFirst().r1 ("ForwardRate"), 1, 8, 100.) + ", " + - FormatUtil.FormatDouble (pcc.pmsSecond().r1 ("DV01"), 1, 8, 1.) + ", " + - FormatUtil.FormatDouble (pcc.pmsSecond().r1 ("ForwardRate"), 1, 8, 100.) + ", " + - FormatUtil.FormatDouble (pcc.grossChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 1, 8, 10000.) + ", " + - pcc.pmsFirst().c1 ("FloaterLabel") - ); - } -} diff --git a/org/drip/sample/forwardratefuturespnl/ED1Attribution.java b/org/drip/sample/forwardratefuturespnl/ED1Attribution.java deleted file mode 100644 index dad4a59..0000000 --- a/org/drip/sample/forwardratefuturespnl/ED1Attribution.java +++ /dev/null @@ -1,114 +0,0 @@ - -package org.drip.sample.forwardratefuturespnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.FundingFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ED1Attribution demonstrates the Invocation of the Historical PnL Horizon PnL Attribution analysis for the - * ED1 Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class ED1Attribution { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingFuturesCloses\\ED1ClosesReconstitutor.csv"; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblForwardRate = csvGrid.doubleArrayAtColumn (2); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (3); - - List lsPCC = FundingFuturesAPI.HorizonChangeAttribution ( - adtSpot, - adtExpiry, - adblForwardRate, - strCurrency - ); - - System.out.println ("FirstDate, SecondDate, Previous DV01, Previous Forward Rate, Spot DV01, Spot Forward Rate, 1D Gross PnL, 1D Market PnL, 1D Roll-down PnL, 1D Accrual PnL, 1D Explained PnL, 1D Unexplianed PnL, Floater Label"); - - for (PositionChangeComponents pcc : lsPCC) - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - FormatUtil.FormatDouble (pcc.pmsFirst().r1 ("DV01"), 1, 8, 1.) + ", " + - FormatUtil.FormatDouble (pcc.pmsFirst().r1 ("ForwardRate"), 1, 8, 100.) + ", " + - FormatUtil.FormatDouble (pcc.pmsSecond().r1 ("DV01"), 1, 8, 1.) + ", " + - FormatUtil.FormatDouble (pcc.pmsSecond().r1 ("ForwardRate"), 1, 8, 100.) + ", " + - FormatUtil.FormatDouble (pcc.grossChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 1, 8, 10000.) + ", " + - pcc.pmsFirst().c1 ("FloaterLabel") - ); - } -} diff --git a/org/drip/sample/forwardratefuturespnl/EF1Attribution.java b/org/drip/sample/forwardratefuturespnl/EF1Attribution.java deleted file mode 100644 index 461580d..0000000 --- a/org/drip/sample/forwardratefuturespnl/EF1Attribution.java +++ /dev/null @@ -1,114 +0,0 @@ - -package org.drip.sample.forwardratefuturespnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.FundingFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * EF1Attribution demonstrates the Invocation of the Historical PnL Horizon PnL Attribution analysis for the - * EF1 Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class EF1Attribution { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "JPY"; - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingFuturesCloses\\EF1ClosesReconstitutor.csv"; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblForwardRate = csvGrid.doubleArrayAtColumn (2); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (3); - - List lsPCC = FundingFuturesAPI.HorizonChangeAttribution ( - adtSpot, - adtExpiry, - adblForwardRate, - strCurrency - ); - - System.out.println ("FirstDate, SecondDate, Previous DV01, Previous Forward Rate, Spot DV01, Spot Forward Rate, 1D Gross PnL, 1D Market PnL, 1D Roll-down PnL, 1D Accrual PnL, 1D Explained PnL, 1D Unexplianed PnL, Floater Label"); - - for (PositionChangeComponents pcc : lsPCC) - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - FormatUtil.FormatDouble (pcc.pmsFirst().r1 ("DV01"), 1, 8, 1.) + ", " + - FormatUtil.FormatDouble (pcc.pmsFirst().r1 ("ForwardRate"), 1, 8, 100.) + ", " + - FormatUtil.FormatDouble (pcc.pmsSecond().r1 ("DV01"), 1, 8, 1.) + ", " + - FormatUtil.FormatDouble (pcc.pmsSecond().r1 ("ForwardRate"), 1, 8, 100.) + ", " + - FormatUtil.FormatDouble (pcc.grossChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 1, 8, 10000.) + ", " + - pcc.pmsFirst().c1 ("FloaterLabel") - ); - } -} diff --git a/org/drip/sample/forwardratefuturespnl/ER1Attribution.java b/org/drip/sample/forwardratefuturespnl/ER1Attribution.java deleted file mode 100644 index da49ea5..0000000 --- a/org/drip/sample/forwardratefuturespnl/ER1Attribution.java +++ /dev/null @@ -1,114 +0,0 @@ - -package org.drip.sample.forwardratefuturespnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.FundingFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ER1Attribution demonstrates the Invocation of the Historical PnL Horizon PnL Attribution analysis for the - * ER1 Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class ER1Attribution { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "EUR"; - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingFuturesCloses\\ER1ClosesReconstitutor.csv"; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblForwardRate = csvGrid.doubleArrayAtColumn (2); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (3); - - List lsPCC = FundingFuturesAPI.HorizonChangeAttribution ( - adtSpot, - adtExpiry, - adblForwardRate, - strCurrency - ); - - System.out.println ("FirstDate, SecondDate, Previous DV01, Previous Forward Rate, Spot DV01, Spot Forward Rate, 1D Gross PnL, 1D Market PnL, 1D Roll-down PnL, 1D Accrual PnL, 1D Explained PnL, 1D Unexplianed PnL, Floater Label"); - - for (PositionChangeComponents pcc : lsPCC) - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - FormatUtil.FormatDouble (pcc.pmsFirst().r1 ("DV01"), 1, 8, 1.) + ", " + - FormatUtil.FormatDouble (pcc.pmsFirst().r1 ("ForwardRate"), 1, 8, 100.) + ", " + - FormatUtil.FormatDouble (pcc.pmsSecond().r1 ("DV01"), 1, 8, 1.) + ", " + - FormatUtil.FormatDouble (pcc.pmsSecond().r1 ("ForwardRate"), 1, 8, 100.) + ", " + - FormatUtil.FormatDouble (pcc.grossChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 1, 8, 10000.) + ", " + - pcc.pmsFirst().c1 ("FloaterLabel") - ); - } -} diff --git a/org/drip/sample/forwardratefuturespnl/ES1Attribution.java b/org/drip/sample/forwardratefuturespnl/ES1Attribution.java deleted file mode 100644 index ef2f3a8..0000000 --- a/org/drip/sample/forwardratefuturespnl/ES1Attribution.java +++ /dev/null @@ -1,114 +0,0 @@ - -package org.drip.sample.forwardratefuturespnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.FundingFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ES1Attribution demonstrates the Invocation of the Historical PnL Horizon PnL Attribution analysis for the - * ES1 Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class ES1Attribution { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "CHF"; - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingFuturesCloses\\ES1ClosesReconstitutor.csv"; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblForwardRate = csvGrid.doubleArrayAtColumn (2); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (3); - - List lsPCC = FundingFuturesAPI.HorizonChangeAttribution ( - adtSpot, - adtExpiry, - adblForwardRate, - strCurrency - ); - - System.out.println ("FirstDate, SecondDate, Previous DV01, Previous Forward Rate, Spot DV01, Spot Forward Rate, 1D Gross PnL, 1D Market PnL, 1D Roll-down PnL, 1D Accrual PnL, 1D Explained PnL, 1D Unexplianed PnL, Floater Label"); - - for (PositionChangeComponents pcc : lsPCC) - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - FormatUtil.FormatDouble (pcc.pmsFirst().r1 ("DV01"), 1, 8, 1.) + ", " + - FormatUtil.FormatDouble (pcc.pmsFirst().r1 ("ForwardRate"), 1, 8, 100.) + ", " + - FormatUtil.FormatDouble (pcc.pmsSecond().r1 ("DV01"), 1, 8, 1.) + ", " + - FormatUtil.FormatDouble (pcc.pmsSecond().r1 ("ForwardRate"), 1, 8, 100.) + ", " + - FormatUtil.FormatDouble (pcc.grossChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 1, 8, 10000.) + ", " + - pcc.pmsFirst().c1 ("FloaterLabel") - ); - } -} diff --git a/org/drip/sample/forwardratefuturespnl/IR1Attribution.java b/org/drip/sample/forwardratefuturespnl/IR1Attribution.java deleted file mode 100644 index 89e24eb..0000000 --- a/org/drip/sample/forwardratefuturespnl/IR1Attribution.java +++ /dev/null @@ -1,114 +0,0 @@ - -package org.drip.sample.forwardratefuturespnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.FundingFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * IR1Attribution demonstrates the Invocation of the Historical PnL Horizon PnL Attribution analysis for the - * IR1 Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class IR1Attribution { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "AUD"; - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingFuturesCloses\\IR1ClosesReconstitutor.csv"; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblForwardRate = csvGrid.doubleArrayAtColumn (2); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (3); - - List lsPCC = FundingFuturesAPI.HorizonChangeAttribution ( - adtSpot, - adtExpiry, - adblForwardRate, - strCurrency - ); - - System.out.println ("FirstDate, SecondDate, Previous DV01, Previous Forward Rate, Spot DV01, Spot Forward Rate, 1D Gross PnL, 1D Market PnL, 1D Roll-down PnL, 1D Accrual PnL, 1D Explained PnL, 1D Unexplianed PnL, Floater Label"); - - for (PositionChangeComponents pcc : lsPCC) - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - FormatUtil.FormatDouble (pcc.pmsFirst().r1 ("DV01"), 1, 8, 1.) + ", " + - FormatUtil.FormatDouble (pcc.pmsFirst().r1 ("ForwardRate"), 1, 8, 100.) + ", " + - FormatUtil.FormatDouble (pcc.pmsSecond().r1 ("DV01"), 1, 8, 1.) + ", " + - FormatUtil.FormatDouble (pcc.pmsSecond().r1 ("ForwardRate"), 1, 8, 100.) + ", " + - FormatUtil.FormatDouble (pcc.grossChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 1, 8, 10000.) + ", " + - pcc.pmsFirst().c1 ("FloaterLabel") - ); - } -} diff --git a/org/drip/sample/forwardratefuturespnl/L1Attribution.java b/org/drip/sample/forwardratefuturespnl/L1Attribution.java deleted file mode 100644 index 829a4b7..0000000 --- a/org/drip/sample/forwardratefuturespnl/L1Attribution.java +++ /dev/null @@ -1,114 +0,0 @@ - -package org.drip.sample.forwardratefuturespnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.FundingFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * L1Attribution demonstrates the Invocation of the Historical PnL Horizon PnL Attribution analysis for the - * L1 Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class L1Attribution { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "GBP"; - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingFuturesCloses\\L1ClosesReconstitutor.csv"; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblForwardRate = csvGrid.doubleArrayAtColumn (2); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (3); - - List lsPCC = FundingFuturesAPI.HorizonChangeAttribution ( - adtSpot, - adtExpiry, - adblForwardRate, - strCurrency - ); - - System.out.println ("FirstDate, SecondDate, Previous DV01, Previous Forward Rate, Spot DV01, Spot Forward Rate, 1D Gross PnL, 1D Market PnL, 1D Roll-down PnL, 1D Accrual PnL, 1D Explained PnL, 1D Unexplianed PnL, Floater Label"); - - for (PositionChangeComponents pcc : lsPCC) - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - FormatUtil.FormatDouble (pcc.pmsFirst().r1 ("DV01"), 1, 8, 1.) + ", " + - FormatUtil.FormatDouble (pcc.pmsFirst().r1 ("ForwardRate"), 1, 8, 100.) + ", " + - FormatUtil.FormatDouble (pcc.pmsSecond().r1 ("DV01"), 1, 8, 1.) + ", " + - FormatUtil.FormatDouble (pcc.pmsSecond().r1 ("ForwardRate"), 1, 8, 100.) + ", " + - FormatUtil.FormatDouble (pcc.grossChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 1, 8, 10000.) + ", " + - pcc.pmsFirst().c1 ("FloaterLabel") - ); - } -} diff --git a/org/drip/sample/forwardratefuturespnl/YE1Attribution.java b/org/drip/sample/forwardratefuturespnl/YE1Attribution.java deleted file mode 100644 index 04bee5a..0000000 --- a/org/drip/sample/forwardratefuturespnl/YE1Attribution.java +++ /dev/null @@ -1,114 +0,0 @@ - -package org.drip.sample.forwardratefuturespnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.FundingFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * YE1Attribution demonstrates the Invocation of the Historical PnL Horizon PnL Attribution analysis for the - * YE1 Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class YE1Attribution { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "SEK"; - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingFuturesCloses\\YE1ClosesReconstitutor.csv"; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblForwardRate = csvGrid.doubleArrayAtColumn (2); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (3); - - List lsPCC = FundingFuturesAPI.HorizonChangeAttribution ( - adtSpot, - adtExpiry, - adblForwardRate, - strCurrency - ); - - System.out.println ("FirstDate, SecondDate, Previous DV01, Previous Forward Rate, Spot DV01, Spot Forward Rate, 1D Gross PnL, 1D Market PnL, 1D Roll-down PnL, 1D Accrual PnL, 1D Explained PnL, 1D Unexplianed PnL, Floater Label"); - - for (PositionChangeComponents pcc : lsPCC) - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - FormatUtil.FormatDouble (pcc.pmsFirst().r1 ("DV01"), 1, 8, 1.) + ", " + - FormatUtil.FormatDouble (pcc.pmsFirst().r1 ("ForwardRate"), 1, 8, 100.) + ", " + - FormatUtil.FormatDouble (pcc.pmsSecond().r1 ("DV01"), 1, 8, 1.) + ", " + - FormatUtil.FormatDouble (pcc.pmsSecond().r1 ("ForwardRate"), 1, 8, 100.) + ", " + - FormatUtil.FormatDouble (pcc.grossChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 1, 8, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 1, 8, 10000.) + ", " + - pcc.pmsFirst().c1 ("FloaterLabel") - ); - } -} diff --git a/org/drip/sample/forwardvolatility/CustomFRAVolatilityCurve.java b/org/drip/sample/forwardvolatility/CustomFRAVolatilityCurve.java deleted file mode 100644 index 8f64d92..0000000 --- a/org/drip/sample/forwardvolatility/CustomFRAVolatilityCurve.java +++ /dev/null @@ -1,463 +0,0 @@ - -package org.drip.sample.forwardvolatility; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.CompositePeriodBuilder; -import org.drip.market.otc.*; -import org.drip.param.creator.MarketParamsBuilder; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.ValuationParams; -import org.drip.pricer.option.BlackScholesAlgorithm; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.fra.FRAStandardCapFloor; -import org.drip.product.params.LastTradingDateSetting; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; -import org.drip.state.volatility.VolatilityCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CustomFRAVolatilityCurve demonstrates the Construction of the FRA Volatility Curve from the FRACap Quotes. - * The Marks and the Valuation References are sourced from: - * - * - Brace, A., D. Gatarek, and M. Musiela (1997): The Market Model of Interest Rate Dynamics, Mathematical - * Finance 7 (2), 127-155. - * - * @author Lakshmi Krishnamurthy - */ - -public class CustomFRAVolatilityCurve { - - private static final FixFloatComponent OTCFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFuture, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFuture]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFuture, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFuture; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aIRS; - } - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 30, - 60, - 91, - 182, - 273 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.0668750, // 30D - 0.0675000, // 60D - 0.0678125, // 91D - 0.0712500, // 182D - 0.0750000 // 273D - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", // 30D - "ForwardRate", // 60D - "ForwardRate", // 91D - "ForwardRate", // 182D - "ForwardRate" // 273D - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.08265, // 2Y - 0.08550, // 3Y - 0.08655, // 4Y - 0.08770, // 5Y - 0.08910, // 7Y - 0.08920 // 10Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 2Y - "SwapRate", // 3Y - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 7Y - "SwapRate" // 10Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - } - - private static final FRAStandardCapFloor MakeCap ( - final JulianDate dtEffective, - final ForwardLabel fri, - final String strMaturityTenor, - final String strManifestMeasure, - final double dblStrike) - throws Exception - { - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - fri.tenor(), - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - fri, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - fri.tenor(), - fri.currency(), - null, - 1., - null, - null, - null, - null - ); - - Stream floatStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.RegularEdgeDates ( - dtEffective.julian(), - fri.tenor(), - strMaturityTenor, - null - ), - cps, - cfus - ) - ); - - return new FRAStandardCapFloor ( - "FRA_CAP", - floatStream, - strManifestMeasure, - true, - dblStrike, - new LastTradingDateSetting ( - LastTradingDateSetting.MID_CURVE_OPTION_QUARTERLY, - "", - Integer.MIN_VALUE - ), - null, - new BlackScholesAlgorithm() - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 1995, - DateUtil.FEBRUARY, - 3 - ); - - String strFRATenor = "3M"; - String strCurrency = "GBP"; - String strManifestMeasure = "ParForward"; - - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strFRATenor - ); - - MergedDiscountForwardCurve dc = MakeDC ( - dtSpot, - strCurrency - ); - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y" - }; - - double[] adblATMStrike = new double[] { - 0.0788, // "1Y", - 0.0839, // "2Y", - 0.0864, // "3Y", - 0.0869, // "4Y", - 0.0879, // "5Y", - 0.0890, // "7Y", - 0.0889 // "10Y" - }; - - double[] adblATMPrice = new double[] { - 0.0027, // "1Y", - 0.0152, // "2Y", - 0.0267, // "3Y", - 0.0400, // "4Y", - 0.0546, // "5Y", - 0.0815, // "7Y" - 0.1078 // "10Y" - }; - - String[] astrCalibMeasure = new String[astrMaturityTenor.length]; - FRAStandardCapFloor[] aCap = new FRAStandardCapFloor[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - astrCalibMeasure[i] = "Price"; - - aCap[i] = MakeCap ( - dtSpot, - fri, - astrMaturityTenor[i], - strManifestMeasure, - adblATMStrike[i] - ); - } - - VolatilityCurve volCurve = ScenarioLocalVolatilityBuilder.NonlinearBuild ( - fri.fullyQualifiedName() + "::VOL", - dtSpot, - fri, - aCap, - adblATMPrice, - astrCalibMeasure, - dc, - dc.nativeForwardCurve (strFRATenor), - null - ); - - ForwardCurve fcNative = dc.nativeForwardCurve (strFRATenor); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - fcNative, - null, - null, - null, - null, - null, - null - ); - - mktParams.setForwardVolatility (volCurve); - - System.out.println ("\n\n\t|---------------------------------------------------------------------------------||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| GBP LIBOR Volatility Calibrations ||"); - - System.out.println ("\t| - Forward Label ||"); - - System.out.println ("\t| - Cap Stream Start ||"); - - System.out.println ("\t| - Cap Stream End ||"); - - System.out.println ("\t| - Market Price ||"); - - System.out.println ("\t| - Recon Price ||"); - - System.out.println ("\t| - Flat Cap Volatility ||"); - - System.out.println ("\t| - Flat Forward Volatility ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t|---------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - Map mapMeasures = aCap[i].value ( - valParams, - null, - mktParams, - null - ); - - System.out.println ( - "\t| " + aCap[i].forwardLabel().get ("DERIVED").fullyQualifiedName() + - " [" + aCap[i].stream().effective() + " - " + aCap[i].stream().maturity() + "] => " + - FormatUtil.FormatDouble (mapMeasures.get ("Price"), 1, 4, 1.) + " {" + - FormatUtil.FormatDouble (adblATMPrice[i], 1, 4, 1.) + "} | " + - FormatUtil.FormatDouble (mapMeasures.get ("FlatVolatility"), 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (volCurve.impliedVol (aCap[i].stream().maturity()), 2, 2, 100.) + "% ||" - ); - } - - System.out.println ("\t|---------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/fra/FRAStandardOption.java b/org/drip/sample/fra/FRAStandardOption.java deleted file mode 100644 index 23b4702..0000000 --- a/org/drip/sample/fra/FRAStandardOption.java +++ /dev/null @@ -1,743 +0,0 @@ - -package org.drip.sample.fra; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.*; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.*; -import org.drip.pricer.option.BlackScholesAlgorithm; -import org.drip.product.creator.*; -import org.drip.product.definition.*; -import org.drip.product.fra.*; -import org.drip.product.params.LastTradingDateSetting; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FRAStandardOption contains the demonstration of the Valuation of an Option on a Multi-Curve FRA Standard. - * - * @author Lakshmi Krishnamurthy - */ - -public class FRAStandardOption { - - private static final FixFloatComponent OTCFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final FloatFloatComponent OTCFloatFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strDerivedTenor, - final String strMaturityTenor, - final double dblBasis) - { - FloatFloatSwapConvention ffConv = IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - return ffConv.createFloatFloatComponent ( - dtSpot, - strDerivedTenor, - strMaturityTenor, - dblBasis, - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFuture, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFuture]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFuture, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFuture; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate" - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate", // 30Y - "SwapRate", // 40Y - "SwapRate" // 50Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - } - - /* - * Construct an array of float-float swaps from the corresponding reference (6M) and the derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FloatFloatComponent[] MakexM6MBasisSwap ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final int iTenorInMonths) - throws Exception - { - FloatFloatComponent[] aFFC = new FloatFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aFFC[i] = OTCFloatFloat ( - dtSpot, - strCurrency, - iTenorInMonths + "M", - astrMaturityTenor[i], - 0. - ); - - return aFFC; - } - - private static final ForwardCurve MakeFC ( - final JulianDate dtSpot, - final String strCurrency, - final MergedDiscountForwardCurve dc, - final int iTenorInMonths, - final String[] astrxM6MFwdTenor, - final double[] adblxM6MBasisSwapQuote) - throws Exception - { - /* - * Construct the 6M-xM float-float basis swap. - */ - - FloatFloatComponent[] aFFC = MakexM6MBasisSwap ( - dtSpot, - strCurrency, - astrxM6MFwdTenor, - iTenorInMonths - ); - - String strBasisTenor = iTenorInMonths + "M"; - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Calculate the starting forward rate off of the discount curve. - */ - - double dblStartingFwd = dc.forward ( - dtSpot.julian(), - dtSpot.addTenor (strBasisTenor).julian() - ); - - /* - * Set the discount curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Construct the shape preserving forward curve off of Quartic Polynomial Basis Spline. - */ - - return ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - "QUARTIC_FWD" + strBasisTenor, - ForwardLabel.Create ( - strCurrency, - strBasisTenor - ), - valParams, - null, - mktParams, - null, - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (5), - aFFC, - "DerivedParBasisSpread", - adblxM6MBasisSwapQuote, - dblStartingFwd - ); - } - - private static final Map MakeFC ( - final JulianDate dt, - final String strCurrency, - final MergedDiscountForwardCurve dc) - throws Exception - { - Map mapFC = new HashMap(); - - /* - * Build and run the sampling for the 1M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc1M = MakeFC ( - dt, - strCurrency, - dc, - 1, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00551, // 1Y - 0.00387, // 2Y - 0.00298, // 3Y - 0.00247, // 4Y - 0.00211, // 5Y - 0.00185, // 6Y - 0.00165, // 7Y - 0.00150, // 8Y - 0.00137, // 9Y - 0.00127, // 10Y - 0.00119, // 11Y - 0.00112, // 12Y - 0.00096, // 15Y - 0.00079, // 20Y - 0.00069, // 25Y - 0.00062 // 30Y - } - ); - - mapFC.put ( - "1M", - fc1M - ); - - /* - * Build and run the sampling for the 3M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc3M = MakeFC ( - dt, - strCurrency, - dc, - 3, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00186, // 1Y - 0.00127, // 2Y - 0.00097, // 3Y - 0.00080, // 4Y - 0.00067, // 5Y - 0.00058, // 6Y - 0.00051, // 7Y - 0.00046, // 8Y - 0.00042, // 9Y - 0.00038, // 10Y - 0.00035, // 11Y - 0.00033, // 12Y - 0.00028, // 15Y - 0.00022, // 20Y - 0.00020, // 25Y - 0.00018 // 30Y - } - ); - - mapFC.put ( - "3M", - fc3M - ); - - /* - * Build and run the sampling for the 12M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc12M = MakeFC ( - dt, - strCurrency, - dc, - 12, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "35Y", "40Y" - }, // Extrapolated - new double[] { - -0.00212, // 1Y - -0.00152, // 2Y - -0.00117, // 3Y - -0.00097, // 4Y - -0.00082, // 5Y - -0.00072, // 6Y - -0.00063, // 7Y - -0.00057, // 8Y - -0.00051, // 9Y - -0.00047, // 10Y - -0.00044, // 11Y - -0.00041, // 12Y - -0.00035, // 15Y - -0.00028, // 20Y - -0.00025, // 25Y - -0.00022, // 30Y - -0.00022, // 35Y Extrapolated - -0.00022, // 40Y Extrapolated - } - ); - - mapFC.put ( - "12M", - fc12M - ); - - return mapFC; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strTenor = "3M"; - String strCurrency = "USD"; - String strManifestMeasure = "QuantoAdjustedParForward"; - double dblForwardVol = 0.3; - double dblFundingVol = 0.1; - double dblForwardFundingCorr = 0.2; - double dblCorrMeanReverterHazard = 0.4 / 365.25; - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - /* - * Construct the Discount Curve using its instruments and quotes - */ - - MergedDiscountForwardCurve dc = MakeDC ( - dtToday, - strCurrency - ); - - Map mapFC = MakeFC ( - dtToday, - strCurrency, - dc - ); - - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - JulianDate dtForwardStart = dtToday.addTenor (strTenor); - - FRAStandardComponent fra = SingleStreamComponentBuilder.FRAStandard ( - dtForwardStart, - fri, - 0.006 - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - mapFC.get (strTenor), - null, - null, - null, - null, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - strCurrency - ); - - FundingLabel fundingLabel = FundingLabel.Standard (fri.currency()); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtToday.julian(), - VolatilityLabel.Standard (fri), - fri.currency(), - dblForwardVol - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtToday.julian(), - VolatilityLabel.Standard (fundingLabel), - fri.currency(), - dblFundingVol - ) - ); - - mktParams.setForwardFundingCorrelation ( - fri, - fundingLabel, - new AndersenPiterbargMeanReverter ( - new ExponentialDecay ( - dtToday.julian(), - dblCorrMeanReverterHazard), - new FlatUnivariate (dblForwardFundingCorr) - ) - ); - - Map mapFRAOutput = fra.value ( - valParams, - null, - mktParams, - null - ); - - double dblStrike = 1.01 * mapFRAOutput.get (strManifestMeasure); - - FRAStandardCapFloorlet fraCaplet = new FRAStandardCapFloorlet ( - fra.name() + "::CAPLET", - fra, - strManifestMeasure, - true, - dblStrike, - 1., - new LastTradingDateSetting ( - LastTradingDateSetting.MID_CURVE_OPTION_QUARTERLY, - "", - Integer.MIN_VALUE - ), - new BlackScholesAlgorithm(), - null - ); - - Map mapFRACapletOutput = fraCaplet.value ( - valParams, - null, - mktParams, - null - ); - - System.out.println ("\n------------------------------------------------------------------"); - - System.out.println ("------------------------------------------------------------------\n"); - - for (Map.Entry me : mapFRACapletOutput.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - - System.out.println ("\n------------------------------------------------------------------"); - - System.out.println ("------------------------------------------------------------------\n"); - - FRAStandardCapFloorlet fraFloorlet = new FRAStandardCapFloorlet ( - fra.name() + "::FLOORLET", - fra, - strManifestMeasure, - false, - dblStrike, - 1., - new LastTradingDateSetting ( - LastTradingDateSetting.MID_CURVE_OPTION_QUARTERLY, - "", - Integer.MIN_VALUE - ), - new BlackScholesAlgorithm(), - null - ); - - Map mapFRAFloorletOutput = fraFloorlet.value ( - valParams, - null, - mktParams, - null - ); - - for (Map.Entry me : mapFRAFloorletOutput.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - - System.out.println ("\n------------------------------------------------------------------"); - - System.out.println ("------------------------------------------------------------------\n"); - - System.out.println ( - "\tPrice Implied FRA Caplet Vol : " + - FormatUtil.FormatDouble (fraCaplet.implyVolatility ( - valParams, - null, - mktParams, - null, - "Price", - mapFRACapletOutput.get ("Price") - ), 1, 2, 100.) + "%" - ); - - System.out.println ( - "\tATM Price Implied FRA Caplet Vol : " + - FormatUtil.FormatDouble (fraCaplet.implyVolatility ( - valParams, - null, - mktParams, - null, - "ATMPrice", - mapFRACapletOutput.get ("ATMPrice") - ), 1, 2, 100.) + "%" - ); - - System.out.println ( - "\tPrice Implied FRA Floorlet Vol : " + - FormatUtil.FormatDouble (fraFloorlet.implyVolatility ( - valParams, - null, - mktParams, - null, - "Price", - mapFRAFloorletOutput.get ("Price") - ), 1, 2, 100.) + "%" - ); - - System.out.println ( - "\tATM Price Implied FRA Floorlet Vol : " + - FormatUtil.FormatDouble (fraFloorlet.implyVolatility ( - valParams, - null, - mktParams, - null, - "ATMPrice", - mapFRAFloorletOutput.get ("ATMPrice") - ), 1, 2, 100.) + "%" - ); - } -} diff --git a/org/drip/sample/fra/FRAStandardOptionAnalysis.java b/org/drip/sample/fra/FRAStandardOptionAnalysis.java deleted file mode 100644 index 49610f2..0000000 --- a/org/drip/sample/fra/FRAStandardOptionAnalysis.java +++ /dev/null @@ -1,726 +0,0 @@ - -package org.drip.sample.fra; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.*; -import org.drip.pricer.option.BlackScholesAlgorithm; -import org.drip.product.creator.*; -import org.drip.product.definition.*; -import org.drip.product.fra.*; -import org.drip.product.params.LastTradingDateSetting; -import org.drip.product.rates.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FRAStandardOptionAnalysis contains the demonstration of the custom volatility-correlation analysis of - * Option on a Standard Multi-Curve FRA. - * - * @author Lakshmi Krishnamurthy - */ - -public class FRAStandardOptionAnalysis { - - private static final FixFloatComponent OTCFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final FloatFloatComponent OTCFloatFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strDerivedTenor, - final String strMaturityTenor, - final double dblBasis) - { - FloatFloatSwapConvention ffConv = IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - return ffConv.createFloatFloatComponent ( - dtSpot, - strDerivedTenor, - strMaturityTenor, - dblBasis, - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFuture, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFuture]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFuture, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFuture; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate" - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate", // 30Y - "SwapRate", // 40Y - "SwapRate" // 50Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - } - - /* - * Construct an array of float-float swaps from the corresponding reference (6M) and the derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FloatFloatComponent[] MakexM6MBasisSwap ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final int iTenorInMonths) - throws Exception - { - FloatFloatComponent[] aFFC = new FloatFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aFFC[i] = OTCFloatFloat ( - dtSpot, - strCurrency, - iTenorInMonths + "M", - astrMaturityTenor[i], - 0. - ); - - return aFFC; - } - - private static final ForwardCurve MakeFC ( - final JulianDate dtSpot, - final String strCurrency, - final MergedDiscountForwardCurve dc, - final int iTenorInMonths, - final String[] astrxM6MFwdTenor, - final double[] adblxM6MBasisSwapQuote) - throws Exception - { - /* - * Construct the 6M-xM float-float basis swap. - */ - - FloatFloatComponent[] aFFC = MakexM6MBasisSwap ( - dtSpot, - strCurrency, - astrxM6MFwdTenor, - iTenorInMonths - ); - - String strBasisTenor = iTenorInMonths + "M"; - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Calculate the starting forward rate off of the discount curve. - */ - - double dblStartingFwd = dc.forward ( - dtSpot.julian(), - dtSpot.addTenor (strBasisTenor).julian() - ); - - /* - * Set the discount curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create (dc, null, null, null, null, null, null); - - /* - * Construct the shape preserving forward curve off of Quartic Polynomial Basis Spline. - */ - - return ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - "QUARTIC_FWD" + strBasisTenor, - ForwardLabel.Create ( - strCurrency, - strBasisTenor - ), - valParams, - null, - mktParams, - null, - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (5), - aFFC, - "DerivedParBasisSpread", - adblxM6MBasisSwapQuote, - dblStartingFwd - ); - } - - private static final Map MakeFC ( - final JulianDate dt, - final String strCurrency, - final MergedDiscountForwardCurve dc) - throws Exception - { - Map mapFC = new HashMap(); - - /* - * Build and run the sampling for the 1M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc1M = MakeFC ( - dt, - strCurrency, - dc, - 1, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00551, // 1Y - 0.00387, // 2Y - 0.00298, // 3Y - 0.00247, // 4Y - 0.00211, // 5Y - 0.00185, // 6Y - 0.00165, // 7Y - 0.00150, // 8Y - 0.00137, // 9Y - 0.00127, // 10Y - 0.00119, // 11Y - 0.00112, // 12Y - 0.00096, // 15Y - 0.00079, // 20Y - 0.00069, // 25Y - 0.00062 // 30Y - } - ); - - mapFC.put ( - "1M", - fc1M - ); - - /* - * Build and run the sampling for the 3M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc3M = MakeFC ( - dt, - strCurrency, - dc, - 3, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00186, // 1Y - 0.00127, // 2Y - 0.00097, // 3Y - 0.00080, // 4Y - 0.00067, // 5Y - 0.00058, // 6Y - 0.00051, // 7Y - 0.00046, // 8Y - 0.00042, // 9Y - 0.00038, // 10Y - 0.00035, // 11Y - 0.00033, // 12Y - 0.00028, // 15Y - 0.00022, // 20Y - 0.00020, // 25Y - 0.00018 // 30Y - } - ); - - mapFC.put ( - "3M", - fc3M - ); - - /* - * Build and run the sampling for the 12M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc12M = MakeFC ( - dt, - strCurrency, - dc, - 12, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "35Y", "40Y" - }, - new double[] { - -0.00212, // 1Y - -0.00152, // 2Y - -0.00117, // 3Y - -0.00097, // 4Y - -0.00082, // 5Y - -0.00072, // 6Y - -0.00063, // 7Y - -0.00057, // 8Y - -0.00051, // 9Y - -0.00047, // 10Y - -0.00044, // 11Y - -0.00041, // 12Y - -0.00035, // 15Y - -0.00028, // 20Y - -0.00025, // 25Y - -0.00022, // 30Y - -0.00022, // 35Y Extrapolated - -0.00022, // 40Y Extrapolated - } - ); - - mapFC.put ( - "12M", - fc12M - ); - - return mapFC; - } - - private static final void VolCorrScenario ( - final FRAStandardComponent fra, - final ValuationParams valParams, - final CurveSurfaceQuoteContainer mktParams, - final double dblForwardVol, - final double dblFundingVol, - final double dblForwardFundingCorr) - throws Exception - { - ForwardLabel fri = fra.forwardLabel().get ("DERIVED"); - - FundingLabel fundingLabel = FundingLabel.Standard (fri.currency()); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - valParams.valueDate(), - VolatilityLabel.Standard (fri), - fri.currency(), - dblForwardVol - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - valParams.valueDate(), - VolatilityLabel.Standard (fundingLabel), - fri.currency(), - dblFundingVol - ) - ); - - mktParams.setForwardFundingCorrelation ( - fri, - fundingLabel, - new FlatUnivariate (dblForwardFundingCorr) - ); - - double dblStrike = 0.0189; - String strManifestMeasure = "QuantoAdjustedParForward"; - - FRAStandardCapFloorlet fraCaplet = new FRAStandardCapFloorlet ( - fra.name() + "::CAPLET", - fra, - strManifestMeasure, - true, - dblStrike, - 1., - new LastTradingDateSetting ( - LastTradingDateSetting.MID_CURVE_OPTION_QUARTERLY, - "", - Integer.MIN_VALUE - ), - new BlackScholesAlgorithm(), - null - ); - - FRAStandardCapFloorlet fraFloorlet = new FRAStandardCapFloorlet ( - fra.name() + "::FLOORLET", - fra, - strManifestMeasure, - false, - dblStrike, - 1., - new LastTradingDateSetting ( - LastTradingDateSetting.MID_CURVE_OPTION_QUARTERLY, - "", - Integer.MIN_VALUE - ), - new BlackScholesAlgorithm(), - null - ); - - Map mapFRACapletOutput = fraCaplet.value ( - valParams, - null, - mktParams, - null - ); - - Map mapFRAFloorletOutput = fraFloorlet.value ( - valParams, - null, - mktParams, - null - ); - - double dblATMFRA = mapFRACapletOutput.get ("ATMFRA"); - - double dblManifestMeasureIntrinsic = mapFRACapletOutput.get ("ManifestMeasureIntrinsic"); - - double dblManifestMeasureIntrinsicValue = mapFRACapletOutput.get ("ManifestMeasureIntrinsicValue"); - - double dblForwardATMCapletPrice = mapFRACapletOutput.get ("ForwardATMIntrinsic"); - - double dblSpotCapletPrice = mapFRACapletOutput.get ("SpotPrice"); - - double dblForwardATMFloorletPrice = mapFRAFloorletOutput.get ("ForwardATMIntrinsic"); - - double dblSpotFloorletPrice = mapFRAFloorletOutput.get ("SpotPrice"); - - System.out.println ("\t[" + - org.drip.quant.common.FormatUtil.FormatDouble (dblForwardVol, 2, 0, 100.) + "%," + - org.drip.quant.common.FormatUtil.FormatDouble (dblFundingVol, 2, 0, 100.) + "%," + - org.drip.quant.common.FormatUtil.FormatDouble (dblForwardFundingCorr, 2, 0, 100.) + "%] =" + - org.drip.quant.common.FormatUtil.FormatDouble (dblATMFRA, 1, 4, 100.) + "% | " + - org.drip.quant.common.FormatUtil.FormatDouble (dblManifestMeasureIntrinsic, 1, 1, 10000.) + " | " + - org.drip.quant.common.FormatUtil.FormatDouble (dblManifestMeasureIntrinsicValue, 1, 1, 10000.) + " | " + - org.drip.quant.common.FormatUtil.FormatDouble (dblForwardATMCapletPrice, 1, 1, 10000.) + " | " + - org.drip.quant.common.FormatUtil.FormatDouble (dblSpotCapletPrice, 1, 1, 10000.) + " | " + - org.drip.quant.common.FormatUtil.FormatDouble (dblForwardATMFloorletPrice, 1, 1, 10000.) + " | " + - org.drip.quant.common.FormatUtil.FormatDouble (dblSpotFloorletPrice, 1, 1, 10000.)); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strTenor = "3M"; - String strCurrency = "USD"; - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - /* - * Construct the Discount Curve using its instruments and quotes - */ - - MergedDiscountForwardCurve dc = MakeDC ( - dtToday, - strCurrency - ); - - Map mapFC = MakeFC ( - dtToday, - strCurrency, - dc - ); - - ForwardLabel fri = ForwardLabel.Create (strCurrency, strTenor); - - JulianDate dtForwardStart = dtToday.addTenor (strTenor); - - FRAStandardComponent fra = SingleStreamComponentBuilder.FRAStandard ( - dtForwardStart, - fri, - 0.006 - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - mapFC.get (strTenor), - null, - null, - null, - null, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - strCurrency - ); - - double[] adblSigmaFwd = new double[] {0.1, 0.2, 0.3, 0.4, 0.5}; - double[] adblSigmaFwd2DomX = new double[] {0.10, 0.15, 0.20, 0.25, 0.30}; - double[] adblCorrFwdFwd2DomX = new double[] {-0.99, -0.50, 0.00, 0.50, 0.99}; - - System.out.println ("\tPrinting the IRS Output in Order (Left -> Right):"); - - System.out.println ("\t\tFRA ATM (%)"); - - System.out.println ("\t\tManifest Measure Instrinsic (bp)"); - - System.out.println ("\t\tManifest Measure Instrinsic Value"); - - System.out.println ("\t\tForward Caplet ATM Price"); - - System.out.println ("\t\tSpot Caplet Price"); - - System.out.println ("\t\tForward Floorlet ATM Price"); - - System.out.println ("\t\tSpot Floorlet Price"); - - System.out.println ("\t-------------------------------------------------------------"); - - System.out.println ("\t-------------------------------------------------------------"); - - for (double dblSigmaFwd : adblSigmaFwd) { - for (double dblSigmaFwd2DomX : adblSigmaFwd2DomX) { - for (double dblCorrFwdFwd2DomX : adblCorrFwdFwd2DomX) - VolCorrScenario ( - fra, - valParams, - mktParams, - dblSigmaFwd, - dblSigmaFwd2DomX, - dblCorrFwdFwd2DomX - ); - } - } - } -} diff --git a/org/drip/sample/fra/MultiCurveFRAMarket.java b/org/drip/sample/fra/MultiCurveFRAMarket.java deleted file mode 100644 index 8259ca8..0000000 --- a/org/drip/sample/fra/MultiCurveFRAMarket.java +++ /dev/null @@ -1,170 +0,0 @@ - -package org.drip.sample.fra; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.fra.FRAMarketComponent; -import org.drip.sample.forward.*; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDeterministicVolatilityBuilder; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * MultiCurveFRAMarket contains the demonstration of the Market Multi-Curve FRA Product sample. - * - * @author Lakshmi Krishnamurthy - */ - -public class MultiCurveFRAMarket { - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strTenor = "6M"; - String strCurrency = "JPY"; - double dblEURIBOR6MVol = 0.37; - double dblEONIAVol = 0.37; - double dblEONIAEURIBOR6MCorrelation = 0.8; - - JulianDate dtToday = DateUtil.Today(); - - MergedDiscountForwardCurve dcEONIA = OvernightIndexCurve.MakeDC ( - dtToday, - strCurrency - ); - - ForwardCurve fcEURIBOR6M = IBOR6MQuarticPolyVanilla.Make6MForward ( - dtToday, - strCurrency, - strTenor - ); - - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - FundingLabel fundingLabel = FundingLabel.Standard (strCurrency); - - JulianDate dtForwardStart = dtToday.addTenor (strTenor); - - FRAMarketComponent fra = SingleStreamComponentBuilder.FRAMarket ( - dtForwardStart, - fri, - 0.006 - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dcEONIA, - fcEURIBOR6M, - null, - null, - null, - null, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - strCurrency - ); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtToday.julian(), - VolatilityLabel.Standard (fri), - fri.currency(), - dblEURIBOR6MVol - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtToday.julian(), - VolatilityLabel.Standard (fundingLabel), - fri.currency(), - dblEONIAVol - ) - ); - - mktParams.setForwardFundingCorrelation ( - fri, - fundingLabel, - new FlatUnivariate (dblEONIAEURIBOR6MCorrelation) - ); - - Map mapFRAOutput = fra.value ( - valParams, - null, - mktParams, - null - ); - - for (Map.Entry me : mapFRAOutput.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/fra/MultiCurveFRAMarketAnalysis.java b/org/drip/sample/fra/MultiCurveFRAMarketAnalysis.java deleted file mode 100644 index 0d18776..0000000 --- a/org/drip/sample/fra/MultiCurveFRAMarketAnalysis.java +++ /dev/null @@ -1,291 +0,0 @@ - -package org.drip.sample.fra; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.*; -import org.drip.param.creator.MarketParamsBuilder; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.fra.FRAMarketComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.sample.forward.*; -import org.drip.service.env.EnvManager; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; -import org.drip.state.nonlinear.FlatForwardVolatilityCurve; -import org.drip.state.volatility.VolatilityCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * MultiCurveFRAMarketAnalysis contains an analysis of the correlation and volatility impact on the Market - * FRA. - * - * @author Lakshmi Krishnamurthy - */ - -public class MultiCurveFRAMarketAnalysis { - static class FRAMktConvexityCorrection { - double _dblParMktFwd = Double.NaN; - double _dblParStdFwd = Double.NaN; - double _dblConvexityCorrection = Double.NaN; - - FRAMktConvexityCorrection ( - final double dblParMktFwd, - final double dblParStdFwd, - final double dblConvexityCorrection) - { - _dblParMktFwd = dblParMktFwd; - _dblParStdFwd = dblParStdFwd; - _dblConvexityCorrection = dblConvexityCorrection; - } - } - - private static final VolatilityCurve ATMVolatilityCurve ( - final JulianDate dtEpoch, - final VolatilityLabel label, - final String strCurrency, - final String[] astrTenor, - final double[] adblVolatility) - throws Exception - { - int[] iPillarDate = new int[astrTenor.length]; - - for (int i = 0; i < iPillarDate.length; ++i) - iPillarDate[i] = dtEpoch.addTenor (astrTenor[i]).julian(); - - return new FlatForwardVolatilityCurve ( - dtEpoch.julian(), - label, - strCurrency, - iPillarDate, - adblVolatility - ); - } - - public static final FRAMktConvexityCorrection FRAMktMetric ( - final JulianDate dtValue, - final MergedDiscountForwardCurve dcEONIA, - final ForwardCurve fcEURIBOR6M, - final String strForwardStartTenor, - final VolatilityCurve vcEONIA, - final VolatilityCurve vcEURIBOR6M, - final double dblEONIAEURIBOR6MCorrelation) - throws Exception - { - String strTenor = "6M"; - String strCurrency = "USD"; - - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - FundingLabel fundingLabel = FundingLabel.Standard (strCurrency); - - JulianDate dtForwardStart = dtValue.addTenor (strForwardStartTenor); - - FRAMarketComponent fra = SingleStreamComponentBuilder.FRAMarket ( - dtForwardStart, - fri, - 0.006 - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dcEONIA, - fcEURIBOR6M, - null, - null, - null, - null, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtValue, - dtValue, - strCurrency - ); - - mktParams.setForwardVolatility (vcEURIBOR6M); - - mktParams.setFundingVolatility (vcEONIA); - - mktParams.setForwardFundingCorrelation ( - fri, - fundingLabel, - new FlatUnivariate (dblEONIAEURIBOR6MCorrelation) - ); - - Map mapFRAOutput = fra.value ( - valParams, - null, - mktParams, - null - ); - - return new FRAMktConvexityCorrection ( - mapFRAOutput.get ("shiftedlognormalparmarketfra"), - mapFRAOutput.get ("parstandardfra"), - mapFRAOutput.get ("shiftedlognormalconvexitycorrection") - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strTenor = "6M"; - String strCurrency = "USD"; - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - MergedDiscountForwardCurve dcEONIA = OvernightIndexCurve.MakeDC ( - dtToday, - strCurrency - ); - - ForwardCurve fcEURIBOR6M = IBOR6MQuarticPolyVanilla.Make6MForward ( - dtToday, - strCurrency, - strTenor - ); - - String[] astrForwardStartTenor = { - "6M", - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y" - }; - - double[] adblVolatility = new double[] { - 0.5946, // 6M - 0.5311, // 1Y - 0.3307, // 2Y - 0.2929, // 3Y - 0.2433, // 4Y - 0.2013, // 5Y - 0.1855, // 6Y - 0.1789, // 7Y - 0.1655, // 8Y - 0.1574 // 9Y - }; - - double dblEONIAEURIBOR6MCorrelation = 0.8; - - VolatilityCurve vcEONIA = ATMVolatilityCurve ( - dtToday, - VolatilityLabel.Standard (FundingLabel.Standard (strCurrency)), - strCurrency, - astrForwardStartTenor, - adblVolatility - ); - - VolatilityCurve vEURIBOR6M = ATMVolatilityCurve ( - dtToday, - VolatilityLabel.Standard ( - ForwardLabel.Create ( - strCurrency, - strTenor - ) - ), - strCurrency, - astrForwardStartTenor, - adblVolatility - ); - - System.out.println ("\t---------------------------------"); - - System.out.println ("\t---------------------------------"); - - System.out.println ("\t---------------------------------"); - - System.out.println ("\t---------------------------------"); - - System.out.println ("\tTNR => MKT | STD | CONV "); - - System.out.println ("\t---------------------------------"); - - for (String strForwardStartTenor : astrForwardStartTenor) { - FRAMktConvexityCorrection fraMktMetric = FRAMktMetric ( - dtToday, - dcEONIA, - fcEURIBOR6M, - strForwardStartTenor, - vcEONIA, - vEURIBOR6M, - dblEONIAEURIBOR6MCorrelation - ); - - System.out.println ( - "\t " + strForwardStartTenor + " => " + - FormatUtil.FormatDouble (fraMktMetric._dblParMktFwd, 1, 3, 100.) + "% | " + - FormatUtil.FormatDouble (fraMktMetric._dblParStdFwd, 1, 3, 100.) + "% | " + - FormatUtil.FormatDouble (fraMktMetric._dblConvexityCorrection, 1, 2, 10000.) - ); - } - } -} diff --git a/org/drip/sample/fra/MultiCurveFRAStandard.java b/org/drip/sample/fra/MultiCurveFRAStandard.java deleted file mode 100644 index f9c690e..0000000 --- a/org/drip/sample/fra/MultiCurveFRAStandard.java +++ /dev/null @@ -1,618 +0,0 @@ - -package org.drip.sample.fra; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.*; -import org.drip.product.fra.FRAStandardComponent; -import org.drip.product.rates.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * MultiCurveFRAStandard contains the demonstration of the Standard Multi-Curve FRA product sample. - * - * @author Lakshmi Krishnamurthy - */ - -public class MultiCurveFRAStandard { - - private static final FixFloatComponent OTCFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final FloatFloatComponent OTCFloatFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strDerivedTenor, - final String strMaturityTenor, - final double dblBasis) - { - FloatFloatSwapConvention ffConv = IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - return ffConv.createFloatFloatComponent ( - dtSpot, - strDerivedTenor, - strMaturityTenor, - dblBasis, - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFuture, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFuture]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFuture, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFuture; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate" - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate", // 30Y - "SwapRate", // 40Y - "SwapRate" // 50Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - } - - /* - * Construct an array of float-float swaps from the corresponding reference (6M) and the derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FloatFloatComponent[] MakexM6MBasisSwap ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final int iTenorInMonths) - throws Exception - { - FloatFloatComponent[] aFFC = new FloatFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aFFC[i] = OTCFloatFloat ( - dtSpot, - strCurrency, - iTenorInMonths + "M", - astrMaturityTenor[i], - 0. - ); - - return aFFC; - } - - private static final ForwardCurve MakeFC ( - final JulianDate dtSpot, - final String strCurrency, - final MergedDiscountForwardCurve dc, - final int iTenorInMonths, - final String[] astrxM6MFwdTenor, - final double[] adblxM6MBasisSwapQuote) - throws Exception - { - /* - * Construct the 6M-xM float-float basis swap. - */ - - FloatFloatComponent[] aFFC = MakexM6MBasisSwap ( - dtSpot, - strCurrency, - astrxM6MFwdTenor, - iTenorInMonths - ); - - String strBasisTenor = iTenorInMonths + "M"; - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Calculate the starting forward rate off of the discount curve. - */ - - double dblStartingFwd = dc.forward ( - dtSpot.julian(), - dtSpot.addTenor (strBasisTenor).julian() - ); - - /* - * Set the discount curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create (dc, null, null, null, null, null, null); - - /* - * Construct the shape preserving forward curve off of Quartic Polynomial Basis Spline. - */ - - return ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - "QUARTIC_FWD" + strBasisTenor, - ForwardLabel.Create ( - strCurrency, - strBasisTenor - ), - valParams, - null, - mktParams, - null, - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (5), - aFFC, - "DerivedParBasisSpread", - adblxM6MBasisSwapQuote, - dblStartingFwd - ); - } - - private static final Map MakeFC ( - final JulianDate dt, - final String strCurrency, - final MergedDiscountForwardCurve dc) - throws Exception - { - Map mapFC = new HashMap(); - - /* - * Build and run the sampling for the 1M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc1M = MakeFC ( - dt, - strCurrency, - dc, - 1, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00551, // 1Y - 0.00387, // 2Y - 0.00298, // 3Y - 0.00247, // 4Y - 0.00211, // 5Y - 0.00185, // 6Y - 0.00165, // 7Y - 0.00150, // 8Y - 0.00137, // 9Y - 0.00127, // 10Y - 0.00119, // 11Y - 0.00112, // 12Y - 0.00096, // 15Y - 0.00079, // 20Y - 0.00069, // 25Y - 0.00062 // 30Y - } - ); - - mapFC.put ( - "1M", - fc1M - ); - - /* - * Build and run the sampling for the 3M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc3M = MakeFC ( - dt, - strCurrency, - dc, - 3, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00186, // 1Y - 0.00127, // 2Y - 0.00097, // 3Y - 0.00080, // 4Y - 0.00067, // 5Y - 0.00058, // 6Y - 0.00051, // 7Y - 0.00046, // 8Y - 0.00042, // 9Y - 0.00038, // 10Y - 0.00035, // 11Y - 0.00033, // 12Y - 0.00028, // 15Y - 0.00022, // 20Y - 0.00020, // 25Y - 0.00018 // 30Y - } - ); - - mapFC.put ( - "3M", - fc3M - ); - - /* - * Build and run the sampling for the 12M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc12M = MakeFC ( - dt, - strCurrency, - dc, - 12, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", - "35Y", "40Y" // Extrapolated - }, - new double[] { - -0.00212, // 1Y - -0.00152, // 2Y - -0.00117, // 3Y - -0.00097, // 4Y - -0.00082, // 5Y - -0.00072, // 6Y - -0.00063, // 7Y - -0.00057, // 8Y - -0.00051, // 9Y - -0.00047, // 10Y - -0.00044, // 11Y - -0.00041, // 12Y - -0.00035, // 15Y - -0.00028, // 20Y - -0.00025, // 25Y - -0.00022, // 30Y - -0.00022, // 35Y Extrapolated - -0.00022, // 40Y Extrapolated - } - ); - - mapFC.put ( - "12M", - fc12M - ); - - return mapFC; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strTenor = "3M"; - String strCurrency = "CAD"; - double dblForwardVol = 0.3; - double dblFundingVol = 0.1; - double dblForwardFundingCorr = 0.2; - - JulianDate dtToday = DateUtil.Today().addTenorAndAdjust ( - "0D", - strCurrency - ); - - /* - * Construct the Discount Curve using its instruments and quotes - */ - - MergedDiscountForwardCurve dc = MakeDC ( - dtToday, - strCurrency - ); - - Map mapFC = MakeFC ( - dtToday, - strCurrency, - dc - ); - - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - JulianDate dtForwardStart = dtToday.addTenor (strTenor); - - FRAStandardComponent fra = SingleStreamComponentBuilder.FRAStandard ( - dtForwardStart, - fri, - 0.006 - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - mapFC.get (strTenor), - null, - null, - null, - null, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - strCurrency - ); - - FundingLabel fundingLabel = FundingLabel.Standard (fri.currency()); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtToday.julian(), - VolatilityLabel.Standard (fri), - fri.currency(), - dblForwardVol - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtToday.julian(), - VolatilityLabel.Standard (fundingLabel), - fri.currency(), - dblFundingVol - ) - ); - - mktParams.setForwardFundingCorrelation ( - fri, - fundingLabel, - new FlatUnivariate (dblForwardFundingCorr) - ); - - Map mapFRAOutput = fra.value ( - valParams, - null, - mktParams, - null - ); - - for (Map.Entry me : mapFRAOutput.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/fra/MultiCurveFRAStandardAnalysis.java b/org/drip/sample/fra/MultiCurveFRAStandardAnalysis.java deleted file mode 100644 index 693cc44..0000000 --- a/org/drip/sample/fra/MultiCurveFRAStandardAnalysis.java +++ /dev/null @@ -1,675 +0,0 @@ - -package org.drip.sample.fra; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.*; -import org.drip.product.fra.FRAStandardComponent; -import org.drip.product.rates.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * MultiCurveFRAStandardAnalysis contains an Analysis of the Correlation and the Volatility Impact on the - * Standard FRA. - * - * @author Lakshmi Krishnamurthy - */ - -public class MultiCurveFRAStandardAnalysis { - - private static final FixFloatComponent OTCFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final FloatFloatComponent OTCFloatFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strDerivedTenor, - final String strMaturityTenor, - final double dblBasis) - { - FloatFloatSwapConvention ffConv = IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - return ffConv.createFloatFloatComponent ( - dtSpot, - strDerivedTenor, - strMaturityTenor, - dblBasis, - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFuture, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFuture]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFuture, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFuture; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate" - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate", // 30Y - "SwapRate", // 40Y - "SwapRate" // 50Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - } - - /* - * Construct an array of float-float swaps from the corresponding reference (6M) and the derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FloatFloatComponent[] MakexM6MBasisSwap ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final int iTenorInMonths) - throws Exception - { - FloatFloatComponent[] aFFC = new FloatFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aFFC[i] = OTCFloatFloat ( - dtSpot, - strCurrency, - iTenorInMonths + "M", - astrMaturityTenor[i], - 0. - ); - - return aFFC; - } - - private static final ForwardCurve MakeFC ( - final JulianDate dtSpot, - final String strCurrency, - final MergedDiscountForwardCurve dc, - final int iTenorInMonths, - final String[] astrxM6MFwdTenor, - final double[] adblxM6MBasisSwapQuote) - throws Exception - { - /* - * Construct the 6M-xM float-float basis swap. - */ - - FloatFloatComponent[] aFFC = MakexM6MBasisSwap ( - dtSpot, - strCurrency, - astrxM6MFwdTenor, - iTenorInMonths - ); - - String strBasisTenor = iTenorInMonths + "M"; - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Calculate the starting forward rate off of the discount curve. - */ - - double dblStartingFwd = dc.forward ( - dtSpot.julian(), - dtSpot.addTenor (strBasisTenor).julian() - ); - - /* - * Set the discount curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Construct the shape preserving forward curve off of Quartic Polynomial Basis Spline. - */ - - return ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - "QUARTIC_FWD" + strBasisTenor, - ForwardLabel.Create ( - strCurrency, - strBasisTenor - ), - valParams, - null, - mktParams, - null, - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (5), - aFFC, - "DerivedParBasisSpread", - adblxM6MBasisSwapQuote, - dblStartingFwd - ); - } - - private static final Map MakeFC ( - final JulianDate dt, - final String strCurrency, - final MergedDiscountForwardCurve dc) - throws Exception - { - Map mapFC = new HashMap(); - - /* - * Build and run the sampling for the 1M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc1M = MakeFC ( - dt, - strCurrency, - dc, - 1, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00551, // 1Y - 0.00387, // 2Y - 0.00298, // 3Y - 0.00247, // 4Y - 0.00211, // 5Y - 0.00185, // 6Y - 0.00165, // 7Y - 0.00150, // 8Y - 0.00137, // 9Y - 0.00127, // 10Y - 0.00119, // 11Y - 0.00112, // 12Y - 0.00096, // 15Y - 0.00079, // 20Y - 0.00069, // 25Y - 0.00062 // 30Y - } - ); - - mapFC.put ( - "1M", - fc1M - ); - - /* - * Build and run the sampling for the 3M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc3M = MakeFC ( - dt, - strCurrency, - dc, - 3, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00186, // 1Y - 0.00127, // 2Y - 0.00097, // 3Y - 0.00080, // 4Y - 0.00067, // 5Y - 0.00058, // 6Y - 0.00051, // 7Y - 0.00046, // 8Y - 0.00042, // 9Y - 0.00038, // 10Y - 0.00035, // 11Y - 0.00033, // 12Y - 0.00028, // 15Y - 0.00022, // 20Y - 0.00020, // 25Y - 0.00018 // 30Y - } - ); - - mapFC.put ( - "3M", - fc3M - ); - - /* - * Build and run the sampling for the 12M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc12M = MakeFC ( - dt, - strCurrency, - dc, - 12, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", - "35Y", "40Y" // Extrapolated - }, - new double[] { - -0.00212, // 1Y - -0.00152, // 2Y - -0.00117, // 3Y - -0.00097, // 4Y - -0.00082, // 5Y - -0.00072, // 6Y - -0.00063, // 7Y - -0.00057, // 8Y - -0.00051, // 9Y - -0.00047, // 10Y - -0.00044, // 11Y - -0.00041, // 12Y - -0.00035, // 15Y - -0.00028, // 20Y - -0.00025, // 25Y - -0.00022, // 30Y - -0.00022, // 35Y Extrapolated - -0.00022, // 40Y Extrapolated - } - ); - - mapFC.put ( - "12M", - fc12M - ); - - return mapFC; - } - - private static final void RunWithVolCorrelation ( - final FRAStandardComponent fra, - final ValuationParams valParams, - final CurveSurfaceQuoteContainer mktParams, - final ForwardLabel fri, - final double dblForwardVol, - final double dblFundingVol, - final double dblForwardFundingCorr) - throws Exception - { - FundingLabel fundingLabel = FundingLabel.Standard (fri.currency()); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - valParams.valueDate(), - VolatilityLabel.Standard (fri), - fri.currency(), - dblForwardVol - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - valParams.valueDate(), - VolatilityLabel.Standard (fundingLabel), - fri.currency(), - dblFundingVol - ) - ); - - mktParams.setForwardFundingCorrelation ( - fri, - fundingLabel, - new FlatUnivariate (dblForwardFundingCorr) - ); - - Map mapFRAOutput = fra.value ( - valParams, - null, - mktParams, - null - ); - - System.out.println ("\t[" + - org.drip.quant.common.FormatUtil.FormatDouble (dblForwardVol, 2, 0, 100.) + "%," + - org.drip.quant.common.FormatUtil.FormatDouble (dblFundingVol, 2, 0, 100.) + "%," + - org.drip.quant.common.FormatUtil.FormatDouble (dblForwardFundingCorr, 2, 0, 100.) + "%] =" + - org.drip.quant.common.FormatUtil.FormatDouble (mapFRAOutput.get ("ParForward"), 1, 4, 100.) + "% |" + - org.drip.quant.common.FormatUtil.FormatDouble (mapFRAOutput.get ("QuantoAdjustedParForward"), 1, 4, 100.) + "% |" + - org.drip.quant.common.FormatUtil.FormatDouble (mapFRAOutput.get ("MultiplicativeQuantoAdjustment"), 1, 4, 1.) + " | " + - org.drip.quant.common.FormatUtil.FormatDouble (mapFRAOutput.get ("AdditiveQuantoAdjustment"), 1, 1, 10000.)); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strTenor = "3M"; - String strCurrency = "CHF"; - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - /* - * Construct the Discount Curve using its instruments and quotes - */ - - MergedDiscountForwardCurve dc = MakeDC ( - dtToday, - strCurrency - ); - - Map mapFC = MakeFC ( - dtToday, - strCurrency, - dc - ); - - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - FRAStandardComponent fra = SingleStreamComponentBuilder.FRAStandard ( - dtToday.addTenor (strTenor), - fri, - 0.006 - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - mapFC.get (strTenor), - null, - null, - null, - null, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - strCurrency - ); - - double[] adblSigmaFwd = new double[] { - 0.1, 0.2, 0.3, 0.4, 0.5 - }; - double[] adblSigmaFwd2DomX = new double[] { - 0.10, 0.15, 0.20, 0.25, 0.30 - }; - double[] adblCorrFwdFwd2DomX = new double[] { - -0.99, -0.50, 0.00, 0.50, 0.99 - }; - - System.out.println ("\tPrinting the FRA Output in Order (Left -> Right):"); - - System.out.println ("\t\tParForward (%)"); - - System.out.println ("\t\tQuantoAdjustedParForward (%)"); - - System.out.println ("\t\tMultiplicativeQuantoAdjustment (absolute)"); - - System.out.println ("\t\tAdditiveQuantoAdjustment (bp)"); - - System.out.println ("\t-------------------------------------------------------------"); - - System.out.println ("\t-------------------------------------------------------------"); - - for (double dblSigmaFwd : adblSigmaFwd) { - for (double dblSigmaFwd2DomX : adblSigmaFwd2DomX) { - for (double dblCorrFwdFwd2DomX : adblCorrFwdFwd2DomX) - RunWithVolCorrelation ( - fra, - valParams, - mktParams, - fri, - dblSigmaFwd, - dblSigmaFwd2DomX, - dblCorrFwdFwd2DomX - ); - } - } - } -} diff --git a/org/drip/sample/funding/CustomFundingCurveBuilder.java b/org/drip/sample/funding/CustomFundingCurveBuilder.java deleted file mode 100644 index 9756d2d..0000000 --- a/org/drip/sample/funding/CustomFundingCurveBuilder.java +++ /dev/null @@ -1,528 +0,0 @@ - -package org.drip.sample.funding; - -import java.util.List; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * CustomFundingCurveBuilder funding curve calibration and input instrument calibration quote recovery. It - * shows the following: - * - Construct the Array of Deposit/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Deposit/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - * @author Lakshmi Krishnamurthy - */ - -public class CustomFundingCurveBuilder { - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < aiDay.length; ++i) { - aDeposit[i] = new SingleStreamComponent ( - "DEPOSIT_" + aiDay[i], - new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.EdgePair ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ) - ), - cps, - cfus - ) - ), - csp - ); - - aDeposit[i].setPrimaryCode (aiDay[i] + "D"); - } - - return aDeposit; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtEffective, - final String strCurrency, - final String[] astrMaturityTenor) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - true, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCurrency, - "6M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - 0., - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 2, - "6M", - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - "6M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent irs = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - /* - * This sample demonstrates discount curve calibration and input instrument calibration quote recovery. - * It shows the following: - * - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void OTCInstrumentCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 7, 14, 30, 60 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0013, 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of EDF Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aEDFComp = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtSpot, - 8, - strCurrency - ); - - double[] adblEDFQuote = new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }; - - /* - * Construct the EDF Instrument Set Stretch Builder - */ - - LatentStateStretchSpec edfStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "EDF", - aEDFComp, - "ForwardRate", - adblEDFQuote - ); - - /* - * Construct the Array of Swap Instruments and their Quotes from the given set of parameters - */ - - FixFloatComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - } - ); - - double[] adblSwapQuote = new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }; - - /* - * Construct the Swap Instrument Set Stretch Builder - */ - - LatentStateStretchSpec swapStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SWAP", - aSwapComp, - "SwapRate", - adblSwapQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - edfStretch, - swapStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit, Futures, and Swap Stretches. - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - CurveSurfaceQuoteContainer csqs = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Cross-Comparison of the Deposit Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\n\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t[" + aDepositComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aDepositComp[i].measureValue (valParams, null, csqs, - null, "Rate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.)); - - System.out.println ("\t----------------------------------------------------------------"); - - /* - * Cross-Comparison of the EDF Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t EDF INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aEDFComp.length; ++i) - System.out.println ("\t[" + aEDFComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aEDFComp[i].measureValue (valParams, null, csqs, null, "Rate"), 1, 6, 1.) - + " | " + FormatUtil.FormatDouble (adblEDFQuote[i], 1, 6, 1.)); - - System.out.println ("\t----------------------------------------------------------------"); - - /* - * Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t SWAP INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aSwapComp.length; ++i) - System.out.println ("\t[" + aSwapComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aSwapComp[i].measureValue (valParams, null, csqs, null, "CalibSwapRate"), 1, 6, 1.) - + " | " + FormatUtil.FormatDouble (adblSwapQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aSwapComp[i].measureValue (valParams, null, csqs, null, "FairPremium"), 1, 6, 1.)); - - System.out.println ("\t----------------------------------------------------------------"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - String strCurrency = "USD"; - - OTCInstrumentCurve ( - dtToday, - strCurrency - ); - } -} diff --git a/org/drip/sample/funding/CustomFundingCurveReconciler.java b/org/drip/sample/funding/CustomFundingCurveReconciler.java deleted file mode 100644 index 8a9b87d..0000000 --- a/org/drip/sample/funding/CustomFundingCurveReconciler.java +++ /dev/null @@ -1,633 +0,0 @@ - -package org.drip.sample.funding; - -import java.util.List; - -import org.drip.analytics.date.*; -import org.drip.analytics.definition.Turn; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.param.creator.MarketParamsBuilder; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.curve.DiscountFactorDiscountCurve; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * CustomFundingCurveReconciler demonstrates the multi-stretch transition custom Funding curve - * construction, turns application, discount factor extraction, and calibration quote recovery. It shows the - * following steps: - * - Setup the linear curve calibrator. - * - Setup the cash instruments and their quotes for calibration. - * - Setup the cash instruments stretch latent state representation - this uses the discount factor - * quantification metric and the "rate" manifest measure. - * - Setup the swap instruments and their quotes for calibration. - * - Setup the swap instruments stretch latent state representation - this uses the discount factor - * quantification metric and the "rate" manifest measure. - * - Calibrate over the instrument set to generate a new overlapping latent state span instance. - * - Retrieve the "cash" stretch from the span. - * - Retrieve the "swap" stretch from the span. - * - Create a discount curve instance by converting the overlapping stretch to an exclusive - * non-overlapping stretch. - * - Compare the discount factors and their monotonicity emitted from the discount curve, the - * non-overlapping span, and the "swap" stretch across the range of tenor predictor ordinates. - * - Cross-Recovery of the Cash Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - Cross-Recovery of the Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - Create a turn list instance and add new turn instances. - * - Update the discount curve with the turn list. - * - Compare the discount factor implied the discount curve with and without applying the turns - * adjustment. - * - * @author Lakshmi Krishnamurthy - */ - -public class CustomFundingCurveReconciler { - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < aiDay.length; ++i) { - aDeposit[i] = new SingleStreamComponent ( - "DEPOSIT_" + aiDay[i], - new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.EdgePair ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ) - ), - cps, - cfus - ) - ), - csp - ); - - aDeposit[i].setPrimaryCode (aiDay[i] + "D"); - } - - return aDeposit; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtEffective, - final String strCurrency, - final String[] astrMaturityTenor) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - true, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCurrency, - "6M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - 0., - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 2, - "6M", - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - "6M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent irs = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - /* - * This sample demonstrates the multi-stretch transition custom discount curve construction, turns - * application, discount factor extraction, and calibration quote recovery. It shows the following - * steps: - * - Setup the linear curve calibrator. - * - Setup the cash instruments and their quotes for calibration. - * - Setup the cash instruments stretch latent state representation - this uses the discount factor - * quantification metric and the "rate" manifest measure. - * - Setup the swap instruments and their quotes for calibration. - * - Setup the swap instruments stretch latent state representation - this uses the discount factor - * quantification metric and the "rate" manifest measure. - * - Calibrate over the instrument set to generate a new overlapping latent state span instance. - * - Retrieve the "cash" stretch from the span. - * - Retrieve the "swap" stretch from the span. - * - Create a discount curve instance by converting the overlapping stretch to an exclusive - * non-overlapping stretch. - * - Compare the discount factors and their monotonicity emitted from the discount curve, the - * non-overlapping span, and the "swap" stretch across the range of tenor predictor ordinates. - * - Cross-Recovery of the Cash Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - Cross-Recovery of the Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - Create a turn list instance and add new turn instances. - * - Update the discount curve with the turn list. - * - Compare the discount factor implied the discount curve with and without applying the turns - * adjustment. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void SplineLinearDiscountCurve ( - final JulianDate dtSpot, - final String strCurrency, - final SegmentCustomBuilderControl scbc) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 7, 14, 30, 60 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0013, 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of EDF Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aEDFComp = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtSpot, - 8, - strCurrency - ); - - double[] adblEDFQuote = new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }; - - /* - * Construct the EDF Instrument Set Stretch Builder - */ - - LatentStateStretchSpec edfStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "EDF", - aEDFComp, - "ForwardRate", - adblEDFQuote - ); - - /* - * Construct the Array of Swap Instruments and their Quotes from the given set of parameters - */ - - FixFloatComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - } - ); - - double[] adblSwapQuote = new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }; - - /* - * Construct the Swap Instrument Set Stretch Builder - */ - - LatentStateStretchSpec swapStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SWAP", - aSwapComp, - "SwapRate", - adblSwapQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] {depositStretch, edfStretch, swapStretch}; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - scbc, - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Calibrate over the instrument set to generate a new overlapping latent state span instance - */ - - org.drip.spline.grid.OverlappingStretchSpan ors = lcc.calibrateSpan ( - aStretchSpec, - 1., - valParams, - null, - null, - null - ); - - /* - * Retrieve the "Deposit" stretch from the span - */ - - MultiSegmentSequence mssDeposit = ors.getStretch ("DEPOSIT"); - - /* - * Retrieve the "swap" stretch from the span - */ - - MultiSegmentSequence mssSwap = ors.getStretch ("SWAP"); - - /* - * Create a discount curve instance by converting the overlapping stretch to an exclusive - * non-overlapping stretch. - */ - - MergedDiscountForwardCurve dfdc = new DiscountFactorDiscountCurve ( - strCurrency, - ors - ); - - /* - * Compare the discount factors and their monotonicity emitted from the discount curve, the - * non-overlapping span, and the Deposit stretch across the range of tenor predictor ordinates. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT DF DFDC STRETCH LOCAL"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int iX = (int) mssDeposit.getLeftPredictorOrdinateEdge(); iX <= (int) mssDeposit.getRightPredictorOrdinateEdge(); - iX += 0.1 * (mssDeposit.getRightPredictorOrdinateEdge() - mssDeposit.getLeftPredictorOrdinateEdge())) { - try { - System.out.println ("\tDeposit [" + new JulianDate (iX) + "] = " + - FormatUtil.FormatDouble (dfdc.df (iX), 1, 8, 1.) + " || " + - ors.getContainingStretch (iX).name() + " || " + - FormatUtil.FormatDouble (mssDeposit.responseValue (iX), 1, 8, 1.) + " | " + - mssDeposit.monotoneType (iX)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - } - - /* - * Compare the discount factors and their monotonicity emitted from the discount curve, the - * non-overlapping span, and the "swap" stretch across the range of tenor predictor ordinates. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t SWAP DF DFDC STRETCH LOCAL"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int iX = (int) mssSwap.getLeftPredictorOrdinateEdge(); iX <= (int) mssSwap.getRightPredictorOrdinateEdge(); - iX += 0.05 * (mssSwap.getRightPredictorOrdinateEdge() - mssSwap.getLeftPredictorOrdinateEdge())) { - System.out.println ("\tSwap [" + new JulianDate (iX) + "] = " + - FormatUtil.FormatDouble (dfdc.df (iX), 1, 8, 1.) + " || " + - ors.getContainingStretch (iX).name() + " || " + - FormatUtil.FormatDouble (mssSwap.responseValue (iX), 1, 8, 1.) + " | " + - mssSwap.monotoneType (iX)); - } - - System.out.println ("\tSwap [" + dtSpot.addTenor ("60Y") + "] = " + - FormatUtil.FormatDouble (dfdc.df (dtSpot.addTenor ("60Y")), 1, 8, 1.)); - - /* - * Cross-Recovery of the Deposit Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t[" + aDepositComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aDepositComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dfdc, null, null, null, null, null, null), - null, "Rate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.)); - - /* - * Cross-Recovery of the Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t SWAP INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aSwapComp.length; ++i) - System.out.println ("\t[" + aSwapComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aSwapComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dfdc, null, null, null, null, null, null), - null, "CalibSwapRate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblSwapQuote[i], 1, 6, 1.)); - - /* - * Create a turn list instance and add new turn instances - */ - - TurnListDiscountFactor tldc = new TurnListDiscountFactor(); - - tldc.addTurn ( - new Turn ( - dtSpot.addTenor ("5Y").julian(), - dtSpot.addTenor ("40Y").julian(), - 0.001 - ) - ); - - /* - * Update the discount curve with the turn list. - */ - - dfdc.setTurns (tldc); - - /* - * Compare the discount factor implied the discount curve with and without applying the turns - * adjustment. - */ - - System.out.println ("\n\t-------------------------------"); - - System.out.println ("\t SWAP DF DFDC"); - - System.out.println ("\t-------------------------------"); - - for (int iX = (int) mssSwap.getLeftPredictorOrdinateEdge(); iX <= (int) mssSwap.getRightPredictorOrdinateEdge(); - iX += 0.05 * (mssSwap.getRightPredictorOrdinateEdge() - mssSwap.getLeftPredictorOrdinateEdge())) { - System.out.println ("\tSwap [" + new JulianDate (iX) + "] = " + - FormatUtil.FormatDouble (dfdc.df (iX), 1, 8, 1.)); - } - - System.out.println ("\t-------------------------------"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - /* - * Construct the segment Custom builder using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - */ - - SegmentCustomBuilderControl prbpPolynomial = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - /* - * Run the full spline linear discount curve builder sample. - */ - - SplineLinearDiscountCurve ( - DateUtil.Today(), - "USD", - prbpPolynomial - ); - } -} diff --git a/org/drip/sample/funding/HaganWestForwardInterpolator.java b/org/drip/sample/funding/HaganWestForwardInterpolator.java deleted file mode 100644 index db64542..0000000 --- a/org/drip/sample/funding/HaganWestForwardInterpolator.java +++ /dev/null @@ -1,296 +0,0 @@ - -package org.drip.sample.funding; - -import org.drip.function.r1tor1.LinearRationalShapeControl; -import org.drip.quant.common.FormatUtil; -import org.drip.spline.basis.ExponentialTensionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.pchip.*; -import org.drip.spline.stretch.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * This sample illustrates using the Hagan and West (2006) Estimator. It provides the following - * functionality: - * - Set up the Predictor ordinates and the response values.. - * - Construct the rational linear shape control with the specified tension. - * - Create the Segment Inelastic design using the Ck and Curvature Penalty Derivatives. - * - Build the Array of Segment Custom Builder Control Parameters of the KLK Hyperbolic Tension Basis - * Type, the tension, the segment inelastic design control, and the shape controller. - * - Setup the monotone convex stretch using the above settings, and with no linear inference, no - * spurious extrema, or no monotone filtering applied. - * - Setup the monotone convex stretch using the above settings, and with linear inference, no spurious - * extrema, or no monotone filtering applied. - * - Compute and display the monotone convex output with the linear forward state. - * - Compute and display the monotone convex output with the harmonic forward state. - * - * @author Lakshmi Krishnamurthy - */ - -public class HaganWestForwardInterpolator { - - /* - * Display the monotone convex response value pre- and post- positivity enforcement. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static void DisplayOP ( - final MonotoneConvexHaganWest mchw, - final MultiSegmentSequence mss, - final double[] adblTime) - throws Exception - { - /* - * Compare the stretch response values with that of the Monotone Convex across the range of the - * predictor ordinates pre-positivity enforcement. - */ - - double dblTimeBegin = 0.; - double dblTimeFinish = 30.; - double dblTimeDelta = 3.00; - double dblTime = dblTimeBegin; - - while (dblTime <= dblTimeFinish) { - System.out.println ("\t\tResponse[" + - FormatUtil.FormatDouble (dblTime, 2, 2, 1.) + "]: " + - FormatUtil.FormatDouble (mchw.evaluate (dblTime), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (mss.responseValue (dblTime), 1, 6, 1.) - ); - - dblTime += dblTimeDelta; - } - - /* - * Verify if the monotone convex positivity enforcement succeeded - */ - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t\tPositivity enforced? " + mchw.enforcePositivity()); - - System.out.println ("\t----------------------------------------------------------------"); - - dblTime = dblTimeBegin; - - /* - * Compare the stretch response values with that of the Monotone Convex across the range of the - * predictor ordinates post-positivity enforcement. - */ - - while (dblTime <= dblTimeFinish) { - System.out.println ("\t\tPositivity Enforced Response[" + - FormatUtil.FormatDouble (dblTime, 2, 2, 1.) + "]: " + - FormatUtil.FormatDouble (mchw.evaluate (dblTime), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (mss.responseValue (dblTime), 1, 6, 1.) - ); - - dblTime += dblTimeDelta; - } - } - - /* - * This sample demonstrates the construction and usage of the Monotone Hagan West Functionality. It shows - * the following: - * - Set up the Predictor ordinates and the response values.. - * - Construct the rational linear shape control with the specified tension. - * - Create the Segment Inelastic design using the Ck and Curvature Penalty Derivatives. - * - Build the Array of Segment Custom Builder Control Parameters of the KLK Hyperbolic Tension Basis - * Type, the tension, the segment inelastic design control, and the shape controller. - * - Setup the monotone convex stretch using the above settings, and with no linear inference, no - * spurious extrema, or no monotone filtering applied. - * - Setup the monotone convex stretch using the above settings, and with linear inference, no spurious - * extrema, or no monotone filtering applied. - * - Compute and display the monotone convex output with the linear forward state. - * - Compute and display the monotone convex output with the harmonic forward state. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void MonotoneHaganWestInterpolatorSample() - throws Exception - { - /* - * Set up the Predictor ordinates and the response values. - */ - - double[] adblTime = new double[] { - 0., 0.10, 1.0, 4.0, 9.0, 20.0, 30.0 - }; - double[] adblForwardRate = new double[] { - 1.008, 1.073, 1.221, 1.878, 2.226, 2.460 - }; - - /* - * Construct the rational linear shape control with the specified tension. - */ - - double dblShapeControllerTension = 1.; - - ResponseScalingShapeControl rssc = new ResponseScalingShapeControl ( - false, - new LinearRationalShapeControl (dblShapeControllerTension) - ); - - int iK = 2; - int iCurvaturePenaltyDerivativeOrder = 2; - - /* - * Create the Segment Inelastic design using the Ck and Curvature Penalty Derivatives. - */ - - SegmentInelasticDesignControl sdic = SegmentInelasticDesignControl.Create ( - iK, - iCurvaturePenaltyDerivativeOrder - ); - - /* - * Build the Array of Segment Custom Builder Control Parameters of the KLK Hyperbolic Tension Basis - * Type, the tension, the segment inelastic design control, and the shape controller. - */ - - double dblKLKTension = 1.; - - SegmentCustomBuilderControl scbc = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new ExponentialTensionSetParams (dblKLKTension), - sdic, - rssc, - null - ); - - SegmentCustomBuilderControl[] aSCBC = new SegmentCustomBuilderControl[adblForwardRate.length]; - - for (int i = 0; i < adblForwardRate.length; ++i) - aSCBC[i] = scbc; - - /* - * Setup the monotone convex stretch using the above settings, and with no linear inference, no - * spurious extrema, or no monotone filtering applied. - */ - - MultiSegmentSequence mssLinear = LocalControlStretchBuilder.CreateMonotoneConvexStretch ( - "MSS_LINEAR", - adblTime, - adblForwardRate, - aSCBC, - null, - MultiSegmentSequence.CALIBRATE, - false, - false, - false - ); - - /* - * Setup the monotone convex stretch using the above settings, and with linear inference, no - * spurious extrema, or no monotone filtering applied. - */ - - MultiSegmentSequence mssHarmonic = LocalControlStretchBuilder.CreateMonotoneConvexStretch ( - "MSS_HARMONIC", - adblTime, - adblForwardRate, - aSCBC, - null, - MultiSegmentSequence.CALIBRATE, - true, - false, - false - ); - - /* - * Compute and display the monotone convex output with the linear forward state. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t MONOTONE CONVEX HAGAN WEST WITH LINEAR FORWARD STATE"); - - System.out.println ("\t----------------------------------------------------------------"); - - /* - * Compute and display the monotone convex output with the harmonic forward state. - */ - - DisplayOP ( - MonotoneConvexHaganWest.Create ( - adblTime, - adblForwardRate, - false - ), - mssLinear, - adblTime - ); - - System.out.println ("\n\n\t----------------------------------------------------------------"); - - System.out.println ("\t MONOTONE CONVEX HAGAN WEST WITH HARMONIC FORWARD STATE"); - - System.out.println ("\t----------------------------------------------------------------"); - - DisplayOP ( - MonotoneConvexHaganWest.Create ( - adblTime, - adblForwardRate, - true - ), - mssHarmonic, - adblTime - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - MonotoneHaganWestInterpolatorSample(); - } -} diff --git a/org/drip/sample/funding/MultiStreamSwapMeasures.java b/org/drip/sample/funding/MultiStreamSwapMeasures.java deleted file mode 100644 index 933d769..0000000 --- a/org/drip/sample/funding/MultiStreamSwapMeasures.java +++ /dev/null @@ -1,520 +0,0 @@ - -package org.drip.sample.funding; - -/* - * Credit Analytics Imports - */ - -import org.drip.analytics.date.*; -import org.drip.analytics.daycount.*; -import org.drip.analytics.support.*; -import org.drip.market.otc.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.params.CurrencyPair; -import org.drip.product.rates.*; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.*; - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - -/** - * MultiStreamSwapMeasures illustrates the creation, invocation, and usage of the MultiStreamSwap. It shows - * how to: - * - * - Create the Discount Curve from the rates instruments. - * - Set up the valuation and the market parameters. - * - Create the Rates Basket from the fixed/float streams. - * - Value the Rates Basket. - * - * @author Lakshmi Krishnamurthy - */ - -public class MultiStreamSwapMeasures { - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Sample demonstrating building of rates curve from deposit/future/swaps - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static MergedDiscountForwardCurve BuildRatesCurveFromInstruments ( - final JulianDate dtStart, - final String[] astrDepositTenor, - final double[] adblDepositRate, - final String[] astrIRSTenor, - final double[] adblIRSRate, - final double dblBump, - final String strCurrency) - throws Exception - { - int iNumDCInstruments = astrDepositTenor.length + adblIRSRate.length; - int aiDate[] = new int[iNumDCInstruments]; - double adblRate[] = new double[iNumDCInstruments]; - String astrCalibMeasure[] = new String[iNumDCInstruments]; - double adblCompCalibValue[] = new double[iNumDCInstruments]; - CalibratableComponent aCompCalib[] = new CalibratableComponent[iNumDCInstruments]; - - // Deposit Calibration - - ComposableFloatingUnitSetting cfusDeposit = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cpsDeposit = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrDepositTenor.length; ++i) { - astrCalibMeasure[i] = "Rate"; - adblRate[i] = java.lang.Double.NaN; - adblCompCalibValue[i] = adblDepositRate[i] + dblBump; - - aCompCalib[i] = new SingleStreamComponent ( - "DEPOSIT_" + astrDepositTenor[i], - new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.EdgePair ( - dtStart, - new JulianDate (aiDate[i] = dtStart.addTenor (astrDepositTenor[i]).julian()) - ), - cpsDeposit, - cfusDeposit - ) - ), - csp - ); - - aCompCalib[i].setPrimaryCode (astrDepositTenor[i]); - } - - // IRS Calibration - - for (int i = 0; i < astrIRSTenor.length; ++i) { - astrCalibMeasure[i + astrDepositTenor.length] = "Rate"; - adblRate[i + astrDepositTenor.length] = java.lang.Double.NaN; - adblCompCalibValue[i + astrDepositTenor.length] = adblIRSRate[i] + dblBump; - - FixFloatComponent irs = OTCIRS ( - dtStart, - strCurrency, - astrIRSTenor[i], - adblIRSRate[i] + dblBump - ); - - irs.setPrimaryCode ("IRS." + astrIRSTenor[i] + "." + strCurrency); - - aCompCalib[i + astrDepositTenor.length] = irs; - } - - /* - * Build the IR curve from the components, their calibration measures, and their calibration quotes. - */ - - return ScenarioDiscountCurveBuilder.NonlinearBuild ( - dtStart, - strCurrency, - aCompCalib, - adblCompCalibValue, - astrCalibMeasure, - null - ); - } - - /* - * Sample demonstrating creation of a rates basket instance from component fixed and floating streams - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final RatesBasket MakeRatesBasket ( - final JulianDate dtEffective) - throws Exception - { - /* - * Create a sequence of Fixed Streams - */ - - Stream[] aFixedStream = new Stream[3]; - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - "USD", - false, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFixedUnitSetting cfusFixed3Y = new ComposableFixedUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - 0.03, - 0., - "USD" - ); - - ComposableFixedUnitSetting cfusFixed5Y = new ComposableFixedUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - 0.05, - 0., - "USD" - ); - - ComposableFixedUnitSetting cfusFixed7Y = new ComposableFixedUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - 0.07, - 0., - "USD" - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - "6M", - "USD", - null, - 1., - null, - null, - null, - null - ); - - aFixedStream[0] = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - "3Y", - null - ), - cpsFixed, - ucasFixed, - cfusFixed3Y - ) - ); - - aFixedStream[1] = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - "5Y", - null - ), - cpsFixed, - ucasFixed, - cfusFixed5Y - ) - ); - - aFixedStream[2] = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - "7Y", - null - ), - cpsFixed, - ucasFixed, - cfusFixed7Y - ) - ); - - /* - * Create a sequence of Float Streams - */ - - Stream[] aFloatStream = new Stream[3]; - - ComposableFloatingUnitSetting cfusFloat3Y = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - ForwardLabel.Create ( - "USD", - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0.03 - ); - - ComposableFloatingUnitSetting cfusFloat5Y = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - ForwardLabel.Create ( - "USD", - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0.05 - ); - - ComposableFloatingUnitSetting cfusFloat7Y = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - ForwardLabel.Create ( - "USD", - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0.07 - ); - - CompositePeriodSetting cpsFloat = new CompositePeriodSetting ( - 4, - "3M", - "USD", - null, - 1., - null, - null, - null, - null - ); - - aFloatStream[0] = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - "3Y", - null - ), - cpsFloat, - cfusFloat3Y - ) - ); - - aFloatStream[1] = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - "5Y", - null - ), - cpsFloat, - cfusFloat5Y - ) - ); - - aFloatStream[2] = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - "7Y", - null - ), - cpsFloat, - cfusFloat7Y - ) - ); - - /* - * Create a Rates Basket instance containing the fixed and floating streams - */ - - return new RatesBasket ( - "RATESBASKET", - aFixedStream, - aFloatStream - ); - } - - /* - * Sample demonstrating creation of discount curve from cash/futures/swaps - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void MultiLegSwapSample() - throws Exception - { - JulianDate dtValue = DateUtil.Today(); - - /* - * Create the Discount Curve from the rates instruments - */ - - String[] astrCashTenor = new String[] {"3M"}; - double[] adblCashRate = new double[] {0.00276}; - String[] astrIRSTenor = new String[] { "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", - "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y"}; - double[] adblIRSRate = new double[] {0.00367, 0.00533, 0.00843, 0.01238, 0.01609, 0.01926, 0.02191, - 0.02406, 0.02588, 0.02741, 0.02870, 0.02982, 0.03208, 0.03372, 0.03445, 0.03484, 0.03501, 0.03484}; - - MergedDiscountForwardCurve dc = BuildRatesCurveFromInstruments ( - dtValue, - astrCashTenor, - adblCashRate, - astrIRSTenor, - adblIRSRate, - 0., - "USD" - ); - - /* - * Set up the valuation and the market parameters - */ - - ValuationParams valParams = ValuationParams.Spot ( - dtValue, - 0, - "", - Convention.DATE_ROLL_ACTUAL - ); - - double dblUSDABCFXRate = 1.; - - CurveSurfaceQuoteContainer mktParams = new CurveSurfaceQuoteContainer(); - - mktParams.setFundingState (dc); - - CurrencyPair cp = CurrencyPair.FromCode ("USD/ABC"); - - mktParams.setFXState ( - ScenarioFXCurveBuilder.CubicPolynomialCurve ( - "FX::" + cp.code(), - dtValue, - cp, - new String[] {"10Y"}, - new double[] {dblUSDABCFXRate}, - dblUSDABCFXRate - ) - ); - - /* - * Create the Rates Basket from the streams - */ - - RatesBasket rb = MakeRatesBasket (dtValue); - - /* - * Value the Rates Basket - */ - - CaseInsensitiveTreeMap mapRBResults = rb.value ( - valParams, - null, - mktParams, - null - ); - - System.out.println (mapRBResults); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - // String strConfig = "c:\\Lakshmi\\BondAnal\\Config.xml"; - - String strConfig = ""; - - EnvManager.InitEnv (strConfig); - - MultiLegSwapSample(); - } -} diff --git a/org/drip/sample/funding/NonlinearCurveMeasures.java b/org/drip/sample/funding/NonlinearCurveMeasures.java deleted file mode 100644 index bfc8948..0000000 --- a/org/drip/sample/funding/NonlinearCurveMeasures.java +++ /dev/null @@ -1,399 +0,0 @@ - -package org.drip.sample.funding; - -/* - * Credit Product imports - */ - -import org.drip.analytics.date.JulianDate; -import org.drip.analytics.support.*; -import org.drip.market.otc.*; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.*; -import org.drip.product.rates.*; -import org.drip.param.creator.*; -import org.drip.quant.calculus.WengertJacobian; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * NonlinearCurveMeasures contains a demo of the Non-linear Rates Analytics API Usage. It shows the - * following: - * - * - Build a discount curve using: cash instruments only, EDF instruments only, IRS instruments only, or all - * of them strung together. - * - Re-calculate the component input measure quotes from the calibrated discount curve object. - * - Compute the PVDF Wengert Jacobian across all the instruments used in the curve construction. - * - * @author Lakshmi Krishnamurthy - */ - -public class NonlinearCurveMeasures { - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Sample API demonstrating the creation of the discount curve from the rates input instruments - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - public static void DiscountCurveFromRatesInstruments() - throws Exception - { - int NUM_DC_INSTR = 30; - double adblRate[] = new double[NUM_DC_INSTR]; - int aiMaturityDate[] = new int[NUM_DC_INSTR]; - String astrCalibMeasure[] = new String[NUM_DC_INSTR]; - double adblCompCalibValue[] = new double[NUM_DC_INSTR]; - CalibratableComponent aCompCalib[] = new CalibratableComponent[NUM_DC_INSTR]; - - JulianDate dtStart = org.drip.analytics.date.DateUtil.CreateFromYMD ( - 2011, - 4, - 6 - ); - - // First 7 instruments - cash calibration - - JulianDate dtCashEffective = dtStart.addBusDays (1, "USD"); - - aiMaturityDate[0] = dtCashEffective.addBusDays (1, "USD").julian(); // ON - - aiMaturityDate[1] = dtCashEffective.addBusDays (2, "USD").julian(); // 1D (TN) - - aiMaturityDate[2] = dtCashEffective.addBusDays (7, "USD").julian(); // 1W - - aiMaturityDate[3] = dtCashEffective.addBusDays (14, "USD").julian(); // 2W - - aiMaturityDate[4] = dtCashEffective.addBusDays (30, "USD").julian(); // 1M - - aiMaturityDate[5] = dtCashEffective.addBusDays (60, "USD").julian(); // 2M - - aiMaturityDate[6] = dtCashEffective.addBusDays (90, "USD").julian(); // 3M - - /* - * Cash Rate Quotes - */ - - adblCompCalibValue[0] = .0013; - adblCompCalibValue[1] = .0017; - adblCompCalibValue[2] = .0017; - adblCompCalibValue[3] = .0018; - adblCompCalibValue[4] = .0020; - adblCompCalibValue[5] = .0023; - adblCompCalibValue[6] = .0026; - - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - ForwardLabel.Create ( - "USD", - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - "3M", - "USD", - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - "USD", - 0 - ); - - for (int i = 0; i < 7; ++i) { - adblRate[i] = 0.01; - astrCalibMeasure[i] = "Rate"; - - aCompCalib[i] = SingleStreamComponentBuilder.Deposit ( - dtCashEffective, // Effective - new JulianDate (aiMaturityDate[i]).addBusDays ( - 2, - "USD" - ), // Maturity - ForwardLabel.Create ( - "USD", - "3M" - ) - ); - - aCompCalib[i] = new SingleStreamComponent ( - "DEPOSIT_" + aiMaturityDate[i], - new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.EdgePair ( - dtStart, - new JulianDate (aiMaturityDate[i]).addBusDays ( - 2, - "USD" - ) - ), - cps, - cfus - ) - ), - csp - ); - - aCompCalib[i].setPrimaryCode (aCompCalib[i].name()); - } - - // Next 8 instruments - EDF calibration - - adblCompCalibValue[7] = .0027; - adblCompCalibValue[8] = .0032; - adblCompCalibValue[9] = .0041; - adblCompCalibValue[10] = .0054; - adblCompCalibValue[11] = .0077; - adblCompCalibValue[12] = .0104; - adblCompCalibValue[13] = .0134; - adblCompCalibValue[14] = .0160; - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtStart, - 8, - "USD" - ); - - for (int i = 0; i < 8; ++i) { - adblRate[i + 7] = 0.01; - aCompCalib[i + 7] = aEDF[i]; - astrCalibMeasure[i + 7] = "Rate"; - - aiMaturityDate[i + 7] = aEDF[i].maturityDate().julian(); - } - - // Final 15 instruments - IRS calibration - - JulianDate dtIRSEffective = dtStart.addBusDays ( - 2, - "USD" - ); - - String[] astrIRSTenor = new String[] { - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y", - }; - - aiMaturityDate[15] = dtIRSEffective.addTenor (astrIRSTenor[0]).julian(); - - aiMaturityDate[16] = dtIRSEffective.addTenor (astrIRSTenor[1]).julian(); - - aiMaturityDate[17] = dtIRSEffective.addTenor (astrIRSTenor[2]).julian(); - - aiMaturityDate[18] = dtIRSEffective.addTenor (astrIRSTenor[3]).julian(); - - aiMaturityDate[19] = dtIRSEffective.addTenor (astrIRSTenor[4]).julian(); - - aiMaturityDate[20] = dtIRSEffective.addTenor (astrIRSTenor[5]).julian(); - - aiMaturityDate[21] = dtIRSEffective.addTenor (astrIRSTenor[6]).julian(); - - aiMaturityDate[22] = dtIRSEffective.addTenor (astrIRSTenor[7]).julian(); - - aiMaturityDate[23] = dtIRSEffective.addTenor (astrIRSTenor[8]).julian(); - - aiMaturityDate[24] = dtIRSEffective.addTenor (astrIRSTenor[9]).julian(); - - aiMaturityDate[25] = dtIRSEffective.addTenor (astrIRSTenor[10]).julian(); - - aiMaturityDate[26] = dtIRSEffective.addTenor (astrIRSTenor[11]).julian(); - - aiMaturityDate[27] = dtIRSEffective.addTenor (astrIRSTenor[12]).julian(); - - aiMaturityDate[28] = dtIRSEffective.addTenor (astrIRSTenor[13]).julian(); - - aiMaturityDate[29] = dtIRSEffective.addTenor (astrIRSTenor[14]).julian(); - - adblCompCalibValue[15] = .0166; - adblCompCalibValue[16] = .0206; - adblCompCalibValue[17] = .0241; - adblCompCalibValue[18] = .0269; - adblCompCalibValue[19] = .0292; - adblCompCalibValue[20] = .0311; - adblCompCalibValue[21] = .0326; - adblCompCalibValue[22] = .0340; - adblCompCalibValue[23] = .0351; - adblCompCalibValue[24] = .0375; - adblCompCalibValue[25] = .0393; - adblCompCalibValue[26] = .0402; - adblCompCalibValue[27] = .0407; - adblCompCalibValue[28] = .0409; - adblCompCalibValue[29] = .0409; - - for (int i = 0; i < 15; ++i) { - astrCalibMeasure[i + 15] = "Rate"; - adblRate[i + 15] = 0.01; - - aCompCalib[i + 15] = OTCIRS ( - dtIRSEffective, - "USD", - astrIRSTenor[i], - 0. - ); - } - - /* - * Build the IR curve from the components, their calibration measures, and their calibration quotes. - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.NonlinearBuild ( - dtStart, - "USD", - aCompCalib, - adblCompCalibValue, - astrCalibMeasure, - null - ); - - /* - * Re-calculate the component input measure quotes from the calibrated discount curve object - */ - - for (int i = 0; i < aCompCalib.length; ++i) - System.out.println (astrCalibMeasure[i] + "[" + i + "] = " + - FormatUtil.FormatDouble (aCompCalib[i].measureValue (new ValuationParams (dtStart, dtStart, "USD"), null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, astrCalibMeasure[i]), 1, 5, 1.) + " | " + FormatUtil.FormatDouble (adblCompCalibValue[i], 1, 5, 1.)); - - for (int i = 0; i < aCompCalib.length; ++i) { - WengertJacobian wjComp = aCompCalib[i].jackDDirtyPVDManifestMeasure ( - new ValuationParams ( - dtStart, - dtStart, - "USD" - ), - null, - MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ), - null - ); - - System.out.println ("PV/DF Micro Jack[" + aCompCalib[i].name() + "]=" + - (null == wjComp ? null : wjComp.displayString())); - } - } - - public static final void main ( - final String astrArgs[]) - throws Exception - { - String strConfig = ""; - - EnvManager.InitEnv (strConfig); - - long lStart = System.nanoTime(); - - DiscountCurveFromRatesInstruments(); - - System.out.println ("Time Taken: " + ((int)(1.e-09 * (System.nanoTime() - lStart))) + " sec"); - } -} diff --git a/org/drip/sample/funding/ShapePreservingZeroSmooth.java b/org/drip/sample/funding/ShapePreservingZeroSmooth.java deleted file mode 100644 index 2cbbdb6..0000000 --- a/org/drip/sample/funding/ShapePreservingZeroSmooth.java +++ /dev/null @@ -1,642 +0,0 @@ - -package org.drip.sample.funding; - -import org.drip.analytics.date.*; -import org.drip.analytics.definition.LatentStateStatic; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.*; -import org.drip.spline.params.*; -import org.drip.spline.pchip.LocalMonotoneCkGenerator; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.*; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ShapePreservingZeroSmooth demonstrates the usage of different shape preserving and smoothing techniques - * involved in the funding curve creation. It shows the following: - * - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Global Curve Control parameters as follows: - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Local Curve Control parameters as follows: - * - C1 Bessel Monotone Smoothener with no spurious extrema elimination and no monotone filter - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array of - * Cash and Swap Stretches. - * - Construct the Globally Smoothened Discount Curve by applying the linear curve calibrator and the Global - * Curve Control parameters to the array of Cash and Swap Stretches and the shape preserving discount - * curve. - * - Construct the Locally Smoothened Discount Curve by applying the linear curve calibrator and the Local - * Curve Control parameters to the array of Cash and Swap Stretches and the shape preserving discount - * curve. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies for a sequence of bespoke swap instruments. - * - * @author Lakshmi Krishnamurthy - */ - -public class ShapePreservingZeroSmooth { - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - for (int i = 0; i < aiDay.length; ++i) - aDeposit[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - "USD", - "3M" - ) - ); - - return aDeposit; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - FixFloatComponent irs = OTCIRS ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - 0. - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - /* - * This sample demonstrates the usage of different shape preserving and smoothing techniques involved in - * the discount curve creation. It shows the following: - * - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Global Curve Control parameters as follows: - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Local Curve Control parameters as follows: - * - C1 Bessel Monotone Smoothener with no spurious extrema elimination and no monotone filter - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - * - Construct the Globally Smoothened Discount Curve by applying the linear curve calibrator and the - * Global Curve Control parameters to the array of Cash and Swap Stretches and the shape preserving - * discount curve. - * - Construct the Locally Smoothened Discount Curve by applying the linear curve calibrator and the - * Local Curve Control parameters to the array of Cash and Swap Stretches and the shape preserving - * discount curve. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies for a sequence of bespoke swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void ShapePreservingDFZeroSmoothSample ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 7, 14, 30, 60 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0013, 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of EDF Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aEDFComp = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtSpot, - 8, - strCurrency - ); - - double[] adblEDFQuote = new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }; - - /* - * Construct the EDF Instrument Set Stretch Builder - */ - - LatentStateStretchSpec edfStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "EDF", - aEDFComp, - "ForwardRate", - adblEDFQuote - ); - - /* - * Construct the Array of Swap Instruments and their Quotes from the given set of parameters - */ - - FixFloatComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - } - ); - - double[] adblSwapQuote = new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }; - - /* - * Construct the Swap Instrument Set Stretch Builder - */ - - LatentStateStretchSpec swapStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SWAP", - aSwapComp, - "SwapRate", - adblSwapQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] {depositStretch, edfStretch, swapStretch}; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_EXPONENTIAL_MIXTURE, - new ExponentialMixtureSetParams ( - new double[] { - 0.01, - 0.05, - 0.25 - } - ), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - /* - * Set up the Global Curve Control parameters as follows: - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - GlobalControlCurveParams gccp = new GlobalControlCurveParams ( - LatentStateStatic.DISCOUNT_QM_ZERO_RATE, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - /* - * Set up the Local Curve Control parameters as follows: - * - C1 Bessel Monotone Smoothener with no spurious extrema elimination and no monotone filter - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LocalControlCurveParams lccp = new LocalControlCurveParams ( - LocalMonotoneCkGenerator.C1_BESSEL, - LatentStateStatic.DISCOUNT_QM_ZERO_RATE, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - MultiSegmentSequence.CALIBRATE, - null, - null, - false, - false - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit, Futures, and Swap Stretches. - */ - - MergedDiscountForwardCurve dcShapePreserving = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - /* - * Construct the Globally Smoothened Discount Curve by applying the linear curve calibrator and the - * Global Curve Control parameters to the array of Cash and Swap Stretches and the shape preserving - * discount curve. - */ - - MergedDiscountForwardCurve dcGloballySmooth = ScenarioDiscountCurveBuilder.SmoothingGlobalControlBuild ( - dcShapePreserving, - lcc, - gccp, - valParams, - null, - null, - null - ); - - /* - * Construct the Locally Smoothened Discount Curve by applying the linear curve calibrator and the - * Local Curve Control parameters to the array of Cash and Swap Stretches and the shape preserving - * discount curve. - */ - - MergedDiscountForwardCurve dcLocallySmooth = ScenarioDiscountCurveBuilder.SmoothingLocalControlBuild ( - dcShapePreserving, - lcc, - lccp, - valParams, - null, - null, - null - ); - - /* - * Cross-Comparison of the Deposit Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t SHAPE PRESERVING | SMOOTHING #1 | SMOOTHING #2 | INPUT QUOTE "); - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t[" + aDepositComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble ( - aDepositComp[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcShapePreserving, null, null, null, null, null, null), - null, - "Rate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aDepositComp[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcGloballySmooth, null, null, null, null, null, null), - null, - "Rate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aDepositComp[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcLocallySmooth, null, null, null, null, null, null), - null, - "Rate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.) - ); - - /* - * Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t SWAP INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t SHAPE PRESERVING | SMOOTHING #1 | SMOOTHING #2 | INPUT QUOTE "); - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aSwapComp.length; ++i) - System.out.println ("\t[" + aSwapComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble ( - aSwapComp[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcShapePreserving, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - /* FormatUtil.FormatDouble ( - aSwapComp[i].measureValue ( - new ValuationParams (dtToday, dtToday, "MXN"), null, - MarketParamsBuilder.Create (dcGloballySmooth, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + */ - FormatUtil.FormatDouble ( - aSwapComp[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcLocallySmooth, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblSwapQuote[i], 1, 6, 1.) - ); - - /* - * Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies for a sequence of bespoke swap instruments. - */ - - CalibratableComponent[] aCC = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "3Y", "6Y", "9Y", "12Y", "15Y", "18Y", "21Y", "24Y", "27Y", "30Y" - } - ); - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t BESPOKE SWAPS PAR RATE"); - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t SHAPE PRESERVING | SMOOTHING #1 | SMOOTHING #2"); - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aCC.length; ++i) - System.out.println ("\t[" + aCC[i].maturityDate() + "] = " + - FormatUtil.FormatDouble ( - aCC[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcShapePreserving, null, null, null, null, null, null), - null, - "CalibSwapRate" - ), - 1, 6, 1.) + " | " + - /* FormatUtil.FormatDouble ( - aCC[i].measureValue (new ValuationParams (dtToday, dtToday, "MXN"), null, - MarketParamsBuilder.Create (dcGloballySmooth, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + */ - FormatUtil.FormatDouble ( - aCC[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcLocallySmooth, null, null, null, null, null, null), - null, - "CalibSwapRate" - ), - 1, 6, 1.) - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - String strCurrency = "USD"; - - ShapePreservingDFZeroSmoothSample ( - dtToday, - strCurrency - ); - } -} diff --git a/org/drip/sample/funding/ShapeZeroLocalSmooth.java b/org/drip/sample/funding/ShapeZeroLocalSmooth.java deleted file mode 100644 index bb1b393..0000000 --- a/org/drip/sample/funding/ShapeZeroLocalSmooth.java +++ /dev/null @@ -1,1017 +0,0 @@ - -package org.drip.sample.funding; - -import org.drip.analytics.date.*; -import org.drip.analytics.definition.LatentStateStatic; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.*; -import org.drip.spline.params.*; -import org.drip.spline.pchip.LocalMonotoneCkGenerator; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.*; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ShapeZeroLocalSmooth demonstrates the usage of different local smoothing techniques involved in the - * funding curve creation. It shows the following: - * - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Akima Local Curve Control parameters as follows: - * - C1 Akima Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Harmonic Local Curve Control parameters as follows: - * - C1 Harmonic Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Hyman 1983 Local Curve Control parameters as follows: - * - C1 Hyman 1983 Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Hyman 1989 Local Curve Control parameters as follows: - * - C1 Akima Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Huynh-Le Floch Delimited Local Curve Control parameters as follows: - * - C1 Huynh-Le Floch Delimited Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Kruger Local Curve Control parameters as follows: - * - C1 Kruger Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - * - Construct the Akima Locally Smoothened Discount Curve by applying the linear curve calibrator and - * the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape - * preserving discount curve. - * - Construct the Harmonic Locally Smoothened Discount Curve by applying the linear curve calibrator - * and the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape - * preserving discount curve. - * - Construct the Hyman 1983 Locally Smoothened Discount Curve by applying the linear curve calibrator - * and the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape - * preserving discount curve. - * - Construct the Hyman 1989 Locally Smoothened Discount Curve by applying the linear curve calibrator - * and the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape - * preserving discount curve. - * - Construct the Huynh-Le Floch Delimiter Locally Smoothened Discount Curve by applying the linear - * curve calibrator and the Local Curve Control parameters to the array of Cash and Swap Stretches - * and the shape preserving discount curve. - * - Construct the Kruger Locally Smoothened Discount Curve by applying the linear curve calibrator and - * the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape - * preserving discount curve. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies for a sequence of bespoke swap instruments. - * - * @author Lakshmi Krishnamurthy - */ - -public class ShapeZeroLocalSmooth { - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - for (int i = 0; i < aiDay.length; ++i) - aDeposit[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - "USD", - "3M" - ) - ); - - return aDeposit; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCIRS ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - 0. - ); - - return aIRS; - } - - /* - * This sample demonstrates the usage of different local smoothing techniques involved in the discount - * curve creation. It shows the following: - * - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Akima Local Curve Control parameters as follows: - * - C1 Akima Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Harmonic Local Curve Control parameters as follows: - * - C1 Harmonic Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Hyman 1983 Local Curve Control parameters as follows: - * - C1 Hyman 1983 Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Hyman 1989 Local Curve Control parameters as follows: - * - C1 Akima Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Huynh-Le Floch Delimited Local Curve Control parameters as follows: - * - C1 Huynh-Le Floch Delimited Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Kruger Local Curve Control parameters as follows: - * - C1 Kruger Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - * - Construct the Akima Locally Smoothened Discount Curve by applying the linear curve calibrator and - * the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape - * preserving discount curve. - * - Construct the Harmonic Locally Smoothened Discount Curve by applying the linear curve calibrator - * and the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape - * preserving discount curve. - * - Construct the Hyman 1983 Locally Smoothened Discount Curve by applying the linear curve calibrator - * and the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape - * preserving discount curve. - * - Construct the Hyman 1989 Locally Smoothened Discount Curve by applying the linear curve calibrator - * and the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape - * preserving discount curve. - * - Construct the Huynh-Le Floch Delimiter Locally Smoothened Discount Curve by applying the linear - * curve calibrator and the Local Curve Control parameters to the array of Cash and Swap Stretches - * and the shape preserving discount curve. - * - Construct the Kruger Locally Smoothened Discount Curve by applying the linear curve calibrator and - * the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape - * preserving discount curve. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies for a sequence of bespoke swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void ShapeDFZeroLocalSmoothSample ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 7, 14, 30, 60 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0013, 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of EDF Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aEDFComp = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtSpot, - 8, - strCurrency - ); - - double[] adblEDFQuote = new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }; - - /* - * Construct the EDF Instrument Set Stretch Builder - */ - - LatentStateStretchSpec edfStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "EDF", - aEDFComp, - "ForwardRate", - adblEDFQuote - ); - - /* - * Construct the Array of Swap Instruments and their Quotes from the given set of parameters - */ - - FixFloatComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - } - ); - - double[] adblSwapQuote = new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }; - - /* - * Construct the Swap Instrument Set Stretch Builder - */ - - LatentStateStretchSpec swapStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SWAP", - aSwapComp, - "SwapRate", - adblSwapQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - edfStretch, - swapStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit, Futures, and Swap Stretches. - */ - - MergedDiscountForwardCurve dcShapePreserving = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - /* - * Set up the Akima Local Curve Control parameters as follows: - * - C1 Akima Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LocalControlCurveParams lccpAkima = new LocalControlCurveParams ( - LocalMonotoneCkGenerator.C1_AKIMA, - LatentStateStatic.DISCOUNT_QM_ZERO_RATE, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - MultiSegmentSequence.CALIBRATE, - null, - null, - true, - true - ); - - /* - * Set up the Harmonic Local Curve Control parameters as follows: - * - C1 Harmonic Monotone Smoothener with spurious extrema elimination and monotone filtering - * applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LocalControlCurveParams lccpHarmonic = new LocalControlCurveParams ( - LocalMonotoneCkGenerator.C1_HARMONIC, - LatentStateStatic.DISCOUNT_QM_ZERO_RATE, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - MultiSegmentSequence.CALIBRATE, - null, - null, - true, - true - ); - - /* - * Set up the Hyman 1983 Local Curve Control parameters as follows: - * - C1 Hyman 1983 Monotone Smoothener with spurious extrema elimination and monotone filtering - * applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LocalControlCurveParams lccpHyman83 = new LocalControlCurveParams ( - LocalMonotoneCkGenerator.C1_HYMAN83, - LatentStateStatic.DISCOUNT_QM_ZERO_RATE, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - MultiSegmentSequence.CALIBRATE, - null, - null, - true, - true - ); - - /* - * Set up the Hyman 1989 Local Curve Control parameters as follows: - * - C1 Hyman 1989 Monotone Smoothener with spurious extrema elimination and monotone filtering - * applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LocalControlCurveParams lccpHyman89 = new LocalControlCurveParams ( - LocalMonotoneCkGenerator.C1_HYMAN89, - LatentStateStatic.DISCOUNT_QM_ZERO_RATE, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - MultiSegmentSequence.CALIBRATE, - null, - null, - true, - true - ); - - /* - * Set up the Huynh-LeFloch Limiter Local Curve Control parameters as follows: - * - C1 Huynh-LeFloch Limiter Monotone Smoothener with spurious extrema elimination and monotone - * filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LocalControlCurveParams lccpHuynhLeFloch = new LocalControlCurveParams ( - LocalMonotoneCkGenerator.C1_HUYNH_LE_FLOCH, - LatentStateStatic.DISCOUNT_QM_ZERO_RATE, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - MultiSegmentSequence.CALIBRATE, - null, - null, - true, - true - ); - - /* - * Set up the Kruger Local Curve Control parameters as follows: - * - C1 Kruger Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LocalControlCurveParams lccpKruger = new LocalControlCurveParams ( - LocalMonotoneCkGenerator.C1_KRUGER, - LatentStateStatic.DISCOUNT_QM_ZERO_RATE, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - MultiSegmentSequence.CALIBRATE, - null, - null, - true, - true - ); - - /* - * Construct the Akima Locally Smoothened Discount Curve by applying the linear curve calibrator and - * the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape - * preserving discount curve. - */ - - MergedDiscountForwardCurve dcLocalAkima = ScenarioDiscountCurveBuilder.SmoothingLocalControlBuild ( - dcShapePreserving, - lcc, - lccpAkima, - valParams, - null, - null, - null - ); - - /* - * Construct the Harmonic Locally Smoothened Discount Curve by applying the linear curve calibrator - * and the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape - * preserving discount curve. - */ - - MergedDiscountForwardCurve dcLocalHarmonic = ScenarioDiscountCurveBuilder.SmoothingLocalControlBuild ( - dcShapePreserving, - lcc, - lccpHarmonic, - valParams, - null, - null, - null - ); - - /* - * Construct the Hyman 1983 Locally Smoothened Discount Curve by applying the linear curve calibrator - * and the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape - * preserving discount curve. - */ - - MergedDiscountForwardCurve dcLocalHyman83 = ScenarioDiscountCurveBuilder.SmoothingLocalControlBuild ( - dcShapePreserving, - lcc, - lccpHyman83, - valParams, - null, - null, - null - ); - - /* - * Construct the Hyman 1989 Locally Smoothened Discount Curve by applying the linear curve calibrator - * and the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape - * preserving discount curve. - */ - - MergedDiscountForwardCurve dcLocalHyman89 = ScenarioDiscountCurveBuilder.SmoothingLocalControlBuild ( - dcShapePreserving, - lcc, - lccpHyman89, - valParams, - null, - null, - null - ); - - /* - * Construct the Huynh-Le Floch delimited Locally Smoothened Discount Curve by applying the linear - * curve calibrator and the Local Curve Control parameters to the array of Cash and Swap Stretches - * and the shape preserving discount curve. - */ - - MergedDiscountForwardCurve dcLocalHuynhLeFloch = ScenarioDiscountCurveBuilder.SmoothingLocalControlBuild ( - dcShapePreserving, - lcc, - lccpHuynhLeFloch, - valParams, - null, - null, - null - ); - - /* - * Construct the Kruger Locally Smoothened Discount Curve by applying the linear curve calibrator and - * the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape - * preserving discount curve. - */ - - MergedDiscountForwardCurve dcLocalKruger = ScenarioDiscountCurveBuilder.SmoothingLocalControlBuild ( - dcShapePreserving, - lcc, - lccpKruger, - valParams, - null, - null, - null - ); - - /* - * Cross-Comparison of the Cash Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t-------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t SHAPE PRESERVING | LOCAL AKIMA | LOCAL HARMONIC | LOCAL HYMAN83 | LOCAL HYMAN89 | LOCAL HUYNHLF | LOCAL KRUGER | INPUT QUOTE "); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t[" + aDepositComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble ( - aDepositComp[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcShapePreserving, null, null, null, null, null, null), - null, - "Rate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aDepositComp[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcLocalAkima, null, null, null, null, null, null), - null, - "Rate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aDepositComp[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcLocalHarmonic, null, null, null, null, null, null), - null, - "Rate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aDepositComp[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcLocalHyman83, null, null, null, null, null, null), - null, - "Rate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aDepositComp[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcLocalHyman89, null, null, null, null, null, null), - null, - "Rate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aDepositComp[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcLocalHuynhLeFloch, null, null, null, null, null, null), - null, - "Rate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aDepositComp[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcLocalKruger, null, null, null, null, null, null), - null, - "Rate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.) - ); - - /* - * Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t SWAP INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t SHAPE PRESERVING | LOCAL AKIMA | LOCAL HARMONIC | LOCAL HYMAN83 | LOCAL HYMAN89 | LOCAL HUYNHLF | LOCAL KRUGER | INPUT QUOTE "); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - for (int i = 0; i < aSwapComp.length; ++i) - System.out.println ("\t[" + aSwapComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble ( - aSwapComp[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcShapePreserving, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aSwapComp[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcLocalAkima, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aSwapComp[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcLocalHarmonic, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aSwapComp[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcLocalHyman83, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aSwapComp[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcLocalHyman89, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aSwapComp[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcLocalHuynhLeFloch, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aSwapComp[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcLocalKruger, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblSwapQuote[i], 1, 6, 1.) - ); - - /* - * Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies for a sequence of bespoke swap instruments. - */ - - CalibratableComponent[] aCC = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "3Y", "6Y", "9Y", "12Y", "15Y", "18Y", "21Y", "24Y", "27Y", "30Y" - } - ); - - System.out.println ("\n\t--------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t BESPOKE SWAPS PAR RATE"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t SHAPE PRESERVING | LOCAL AKIMA | LOCAL HARMONIC | LOCAL HYMAN83 | LOCAL HYMAN89 | LOCAL HUYNHLF | LOCAL KRUGER "); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------"); - - for (int i = 0; i < aCC.length; ++i) - System.out.println ("\t[" + aCC[i].maturityDate() + "] = " + - FormatUtil.FormatDouble ( - aCC[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcShapePreserving, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aCC[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcLocalAkima, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aCC[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcLocalHarmonic, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aCC[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcLocalHyman83, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aCC[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcLocalHyman89, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aCC[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcLocalHuynhLeFloch, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aCC[i].measureValue ( - valParams, - null, - MarketParamsBuilder.Create (dcLocalKruger, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - String strCurrency = "USD"; - - ShapeDFZeroLocalSmoothSample ( - dtToday, - strCurrency - ); - } -} diff --git a/org/drip/sample/funding/TemplatedFundingCurveBuilder.java b/org/drip/sample/funding/TemplatedFundingCurveBuilder.java deleted file mode 100644 index f61c7db..0000000 --- a/org/drip/sample/funding/TemplatedFundingCurveBuilder.java +++ /dev/null @@ -1,529 +0,0 @@ - -package org.drip.sample.funding; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.definition.*; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * TemplatedFundingCurveBuilder sample demonstrates the usage of the different pre-built Funding Curve - * Builders. It shows the following: - * - Construct the Array of Cash Instruments and their Quotes from the given set of parameters. - * - Construct the Array of Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cubic Tension KLK Hyperbolic Discount Factor Shape Preserver. - * - Construct the Cubic Tension KLK Hyperbolic Discount Factor Shape Preserver with Zero Rate - * Smoothening applied. - * - Construct the Cubic Polynomial Discount Factor Shape Preserver. - * - Construct the Cubic Polynomial Discount Factor Shape Preserver with Zero Rate Smoothening applied. - * - Construct the Discount Curve using the Bear Sterns' DENSE Methodology. - * - Construct the Discount Curve using the Bear Sterns' DUALDENSE Methodology. - * - Cross-Comparison of the Cash Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - Cross-Comparison of the generated Discount Factor across the different curve construction - * Methodologies for different node points. - * - * @author Lakshmi Krishnamurthy - */ - -public class TemplatedFundingCurveBuilder { - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < aiDay.length; ++i) { - aDeposit[i] = new SingleStreamComponent ( - "DEPOSIT_" + aiDay[i], - new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.EdgePair ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ) - ), - cps, - cfus - ) - ), - csp - ); - - aDeposit[i].setPrimaryCode (aiDay[i] + "D"); - } - - return aDeposit; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - FixFloatComponent irs = OTCIRS ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - 0. - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - /* - * Compute the desired component Metric - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final double ComponentMetric ( - final Component comp, - final ValuationParams valParams, - final MergedDiscountForwardCurve dc, - final String strMeasure) - throws Exception - { - return comp.measureValue ( - valParams, - null, - MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ), - null, - strMeasure - ); - } - - /* - * This sample demonstrates the usage of the different pre-built Discount Curve Builders. It shows the - * following: - * - Construct the Array of Cash Instruments and their Quotes from the given set of parameters. - * - Construct the Array of Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cubic Tension KLK Hyperbolic Discount Factor Shape Preserver. - * - Construct the Cubic Tension KLK Hyperbolic Discount Factor Shape Preserver with Zero Rate - * Smoothening applied. - * - Construct the Cubic Polynomial Discount Factor Shape Preserver. - * - Construct the Cubic Polynomial Discount Factor Shape Preserver with Zero Rate Smoothening applied. - * - Construct the Discount Curve using the Bear Sterns' DENSE Methodology. - * - Construct the Discount Curve using the Bear Sterns' DUALDENSE Methodology. - * - Cross-Comparison of the Cash Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - Cross-Comparison of the generated Discount Factor across the different curve construction - * Methodologies for different node points. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - public static final void TemplatedDiscountCurveBuilderSample ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 2, 7, 14, 30, 60, 90, 180, 270, 360, 450, 540, 630, 720 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023, 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate" - }; - - /* - * Construct the Array of Swap Instruments and their Quotes from the given set of parameters - */ - - FixFloatComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - } - ); - - double[] adblSwapQuote = new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", "SwapRate", "SwapRate", "SwapRate", "SwapRate", "SwapRate", "SwapRate", "SwapRate", "SwapRate", "SwapRate", "SwapRate", "SwapRate", "SwapRate", "SwapRate", "SwapRate" - }; - - /* - * Construct the Cubic Tension KLK Hyperbolic Discount Factor Shape Preserver - */ - - MergedDiscountForwardCurve dcKLKHyperbolicShapePreserver = ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - valParams, - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - - /* - * Construct the Cubic Tension KLK Hyperbolic Discount Factor Shape Preserver with Zero Rate - * Smoothening applied - */ - - MergedDiscountForwardCurve dcKLKHyperbolicSmoother = ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SMOOTH_TEMPLATE", - valParams, - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - true - ); - - /* - * Construct the Cubic Polynomial Discount Factor Shape Preserver - */ - - MergedDiscountForwardCurve dcCubicPolyShapePreserver = ScenarioDiscountCurveBuilder.CubicPolyDFRateShapePreserver ( - "CUBIC_POLY_SHAPE_TEMPLATE", - valParams, - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - - /* - * Construct the Cubic Polynomial Discount Factor Shape Preserver with Zero Rate Smoothening applied. - */ - - MergedDiscountForwardCurve dcCubicPolySmoother = ScenarioDiscountCurveBuilder.CubicPolyDFRateShapePreserver ( - "CUBIC_POLY_SMOOTH_TEMPLATE", - valParams, - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - true - ); - - /* - * Construct the Discount Curve using the Bear Sterns' DENSE Methodology. - */ - - MergedDiscountForwardCurve dcDENSE = ScenarioDiscountCurveBuilder.DENSE ( - "DENSE", - valParams, - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - null - ); - - /* - * Construct the Discount Curve using the Bear Sterns' DUAL DENSE Methodology. - */ - - MergedDiscountForwardCurve dcDualDENSE = ScenarioDiscountCurveBuilder.DUALDENSE ( - "DENSE", - valParams, - aDepositComp, - adblDepositQuote, - "1M", - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - "3M", - astrSwapManifestMeasure, - null - ); - - /* - * Cross-Comparison of the Deposit Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t---------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t\t\t\t\t\t\tDEPOSIT INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t---------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t MATURITY | KLK HYPER SHAPE | KLK HYPER SMOTH | CUBE POLY SHAPE | CUBE POLY SMOTH | DENSE | DUAL DENSE | INPUT"); - - System.out.println ("\t---------------------------------------------------------------------------------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t[" + aDepositComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (ComponentMetric (aDepositComp[i], valParams, dcKLKHyperbolicShapePreserver, "Rate"), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (ComponentMetric (aDepositComp[i], valParams, dcKLKHyperbolicSmoother, "Rate"), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (ComponentMetric (aDepositComp[i], valParams, dcCubicPolyShapePreserver, "Rate"), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (ComponentMetric (aDepositComp[i], valParams, dcCubicPolySmoother, "Rate"), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (ComponentMetric (aDepositComp[i], valParams, dcDENSE, "Rate"), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (ComponentMetric (aDepositComp[i], valParams, dcDualDENSE, "Rate"), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.) - ); - - /* - * Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t---------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t\t\t\t\t\t\tSWAP INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t---------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t MATURITY | KLK HYPER SHAPE | KLK HYPER SMOTH | CUBE POLY SHAPE | CUBE POLY SMOTH | DENSE | DUAL DENSE | INPUT"); - - System.out.println ("\t---------------------------------------------------------------------------------------------------------------------------------------"); - - for (int i = 0; i < aSwapComp.length; ++i) - System.out.println ("\t[" + aSwapComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (ComponentMetric (aSwapComp[i], valParams, dcKLKHyperbolicShapePreserver, "CalibSwapRate"), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (ComponentMetric (aSwapComp[i], valParams, dcKLKHyperbolicSmoother, "CalibSwapRate"), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (ComponentMetric (aSwapComp[i], valParams, dcCubicPolyShapePreserver, "CalibSwapRate"), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (ComponentMetric (aSwapComp[i], valParams, dcCubicPolySmoother, "CalibSwapRate"), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (ComponentMetric (aSwapComp[i], valParams, dcDENSE, "CalibSwapRate"), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (ComponentMetric (aSwapComp[i], valParams, dcDualDENSE, "CalibSwapRate"), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblSwapQuote[i], 1, 6, 1.) - ); - - /* - * Cross-Comparison of the generated Discount Factor across the different curve construction - * methodologies for different node points. - */ - - System.out.println ("\n\t-----------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t DF | KLK HYPER SHAPE | KLK HYPER SMOTH | CUBE POLY SHAPE | CUBE POLY SMOTH | DENSE | DUAL DENSE "); - - System.out.println ("\t-----------------------------------------------------------------------------------------------------------------------------------"); - - int iStartDate = aDepositComp[0].maturityDate().julian(); - - int iEndDate = aSwapComp[aSwapComp.length - 1].maturityDate().julian(); - - int iDateIncrement = (iEndDate - iStartDate) / 20; - - for (int iDate = iStartDate; iDate <= iEndDate; iDate += iDateIncrement) { - System.out.println ("\t[" + new JulianDate (iDate) + "] = " + - FormatUtil.FormatDouble (dcKLKHyperbolicShapePreserver.df (iDate), 1, 8, 1.) + " | " + - FormatUtil.FormatDouble (dcKLKHyperbolicSmoother.df (iDate), 1, 8, 1.) + " | " + - FormatUtil.FormatDouble (dcCubicPolyShapePreserver.df (iDate), 1, 8, 1.) + " | " + - FormatUtil.FormatDouble (dcCubicPolySmoother.df (iDate), 1, 8, 1.) + " | " + - FormatUtil.FormatDouble (dcDENSE.df (iDate), 1, 8, 1.) + " | " + - FormatUtil.FormatDouble (dcDualDENSE.df (iDate), 1, 8, 1.) - ); - } - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strCurrency = "EUR"; - - JulianDate dtToday = DateUtil.Today().addTenorAndAdjust ( - "0D", - strCurrency - ); - - TemplatedDiscountCurveBuilderSample ( - dtToday, - strCurrency - ); - } -} diff --git a/org/drip/sample/fundingfeed/AUDShapePreservingReconstitutor.java b/org/drip/sample/fundingfeed/AUDShapePreservingReconstitutor.java deleted file mode 100644 index e6fc7ab..0000000 --- a/org/drip/sample/fundingfeed/AUDShapePreservingReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AUDShapePreservingReconstitutor Demonstrates the Cleansing and the Shape Preserving Re-constitution of the - * AUD Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class AUDShapePreservingReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "AUD"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/AUDSmoothReconstitutor.java b/org/drip/sample/fundingfeed/AUDSmoothReconstitutor.java deleted file mode 100644 index c3f8037..0000000 --- a/org/drip/sample/fundingfeed/AUDSmoothReconstitutor.java +++ /dev/null @@ -1,74 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AUDSmoothReconstitutor Demonstrates the Cleansing and the Smooth Re-constitution of the AUD Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class AUDSmoothReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "AUD"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.SmoothRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/CADShapePreservingReconstitutor.java b/org/drip/sample/fundingfeed/CADShapePreservingReconstitutor.java deleted file mode 100644 index 3badd3b..0000000 --- a/org/drip/sample/fundingfeed/CADShapePreservingReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CADShapePreservingReconstitutor Demonstrates the Cleansing and the Shape Preserving Re-constitution of the - * CAD Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class CADShapePreservingReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "CAD"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/CADSmoothReconstitutor.java b/org/drip/sample/fundingfeed/CADSmoothReconstitutor.java deleted file mode 100644 index 6cae30e..0000000 --- a/org/drip/sample/fundingfeed/CADSmoothReconstitutor.java +++ /dev/null @@ -1,74 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CADSmoothReconstitutor Demonstrates the Cleansing and the Smooth Re-constitution of the CAD Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class CADSmoothReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "CAD"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.SmoothRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/CHFShapePreservingReconstitutor.java b/org/drip/sample/fundingfeed/CHFShapePreservingReconstitutor.java deleted file mode 100644 index 2b611d8..0000000 --- a/org/drip/sample/fundingfeed/CHFShapePreservingReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CHFShapePreservingReconstitutor Demonstrates the Cleansing and the Shape Preserving Re-constitution of the - * CHF Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class CHFShapePreservingReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "CHF"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/CHFSmoothReconstitutor.java b/org/drip/sample/fundingfeed/CHFSmoothReconstitutor.java deleted file mode 100644 index bdb2ad4..0000000 --- a/org/drip/sample/fundingfeed/CHFSmoothReconstitutor.java +++ /dev/null @@ -1,74 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CHFSmoothReconstitutor Demonstrates the Cleansing and the Smooth Re-constitution of the CHF Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class CHFSmoothReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "CHF"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.SmoothRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/CZKShapePreservingReconstitutor.java b/org/drip/sample/fundingfeed/CZKShapePreservingReconstitutor.java deleted file mode 100644 index 07167e6..0000000 --- a/org/drip/sample/fundingfeed/CZKShapePreservingReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CZKShapePreservingReconstitutor Demonstrates the Cleansing and the Shape Preserving Re-constitution of the - * CZK Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class CZKShapePreservingReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "CZK"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/DKKShapePreservingReconstitutor.java b/org/drip/sample/fundingfeed/DKKShapePreservingReconstitutor.java deleted file mode 100644 index 18192bf..0000000 --- a/org/drip/sample/fundingfeed/DKKShapePreservingReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DKKShapePreservingReconstitutor Demonstrates the Cleansing and the Shape Preserving Re-constitution of the - * DKK Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class DKKShapePreservingReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "DKK"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/EURShapePreservingReconstitutor.java b/org/drip/sample/fundingfeed/EURShapePreservingReconstitutor.java deleted file mode 100644 index c9557df..0000000 --- a/org/drip/sample/fundingfeed/EURShapePreservingReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * EURShapePreservingReconstitutor Demonstrates the Cleansing and the Shape Preserving Re-constitution of the - * EUR Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class EURShapePreservingReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "EUR"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/EURSmoothReconstitutor.java b/org/drip/sample/fundingfeed/EURSmoothReconstitutor.java deleted file mode 100644 index 3b8a7a5..0000000 --- a/org/drip/sample/fundingfeed/EURSmoothReconstitutor.java +++ /dev/null @@ -1,74 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * EURSmoothReconstitutor Demonstrates the Cleansing and the Smooth Re-constitution of the EUR Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class EURSmoothReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "EUR"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.SmoothRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/GBPShapePreservingReconstitutor.java b/org/drip/sample/fundingfeed/GBPShapePreservingReconstitutor.java deleted file mode 100644 index f8f0a92..0000000 --- a/org/drip/sample/fundingfeed/GBPShapePreservingReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * GBPShapePreservingReconstitutor Demonstrates the Cleansing and the Shape Preserving Re-constitution of the - * GBP Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class GBPShapePreservingReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "GBP"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/GBPSmoothReconstitutor.java b/org/drip/sample/fundingfeed/GBPSmoothReconstitutor.java deleted file mode 100644 index bc7a5b4..0000000 --- a/org/drip/sample/fundingfeed/GBPSmoothReconstitutor.java +++ /dev/null @@ -1,74 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * GBPSmoothReconstitutor Demonstrates the Cleansing and the Smooth Re-constitution of the GBP Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class GBPSmoothReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "GBP"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.SmoothRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/HKDShapePreservingReconstitutor.java b/org/drip/sample/fundingfeed/HKDShapePreservingReconstitutor.java deleted file mode 100644 index 79522cb..0000000 --- a/org/drip/sample/fundingfeed/HKDShapePreservingReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * HKDShapePreservingReconstitutor Demonstrates the Cleansing and the Shape Preserving Re-constitution of the - * HKD Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class HKDShapePreservingReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "HKD"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/HUFShapePreservingReconstitutor.java b/org/drip/sample/fundingfeed/HUFShapePreservingReconstitutor.java deleted file mode 100644 index 1d1d18f..0000000 --- a/org/drip/sample/fundingfeed/HUFShapePreservingReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * HUFShapePreservingReconstitutor Demonstrates the Cleansing and the Shape Preserving Re-constitution of the - * HUF Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class HUFShapePreservingReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "HUF"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/ILSShapePreservingReconstitutor.java b/org/drip/sample/fundingfeed/ILSShapePreservingReconstitutor.java deleted file mode 100644 index 4cc5c67..0000000 --- a/org/drip/sample/fundingfeed/ILSShapePreservingReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ILSShapePreservingReconstitutor Demonstrates the Cleansing and the Shape Preserving Re-constitution of the - * ILS Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class ILSShapePreservingReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "ILS"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/JPYShapePreservingReconstitutor.java b/org/drip/sample/fundingfeed/JPYShapePreservingReconstitutor.java deleted file mode 100644 index 21f343a..0000000 --- a/org/drip/sample/fundingfeed/JPYShapePreservingReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * JPYShapePreservingReconstitutor Demonstrates the Cleansing and the Shape Preserving Re-constitution of the - * JPY Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class JPYShapePreservingReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "JPY"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/JPYSmoothReconstitutor.java b/org/drip/sample/fundingfeed/JPYSmoothReconstitutor.java deleted file mode 100644 index 374823a..0000000 --- a/org/drip/sample/fundingfeed/JPYSmoothReconstitutor.java +++ /dev/null @@ -1,74 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * JPYSmoothReconstitutor Demonstrates the Cleansing and the Smooth Re-constitution of the JPY Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class JPYSmoothReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "JPY"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.SmoothRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/MXNShapePreservingReconstitutor.java b/org/drip/sample/fundingfeed/MXNShapePreservingReconstitutor.java deleted file mode 100644 index 439b014..0000000 --- a/org/drip/sample/fundingfeed/MXNShapePreservingReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * MXNShapePreservingReconstitutor Demonstrates the Cleansing and the Shape Preserving Re-constitution of the - * MXN Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class MXNShapePreservingReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "MXN"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/NOKShapePreservingReconstitutor.java b/org/drip/sample/fundingfeed/NOKShapePreservingReconstitutor.java deleted file mode 100644 index 30c2c3d..0000000 --- a/org/drip/sample/fundingfeed/NOKShapePreservingReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NOKShapePreservingReconstitutor Demonstrates the Cleansing and the Shape Preserving Re-constitution of the - * NOK Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class NOKShapePreservingReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "NOK"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/NOKSmoothReconstitutor.java b/org/drip/sample/fundingfeed/NOKSmoothReconstitutor.java deleted file mode 100644 index 85bc397..0000000 --- a/org/drip/sample/fundingfeed/NOKSmoothReconstitutor.java +++ /dev/null @@ -1,74 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NOKSmoothReconstitutor Demonstrates the Cleansing and the Smooth Re-constitution of the NOK Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class NOKSmoothReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "NOK"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.SmoothRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/NZDShapePreservingReconstitutor.java b/org/drip/sample/fundingfeed/NZDShapePreservingReconstitutor.java deleted file mode 100644 index e934030..0000000 --- a/org/drip/sample/fundingfeed/NZDShapePreservingReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NZDShapePreservingReconstitutor Demonstrates the Cleansing and the Shape Preserving Re-constitution of the - * NZD Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class NZDShapePreservingReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "NZD"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/NZDSmoothReconstitutor.java b/org/drip/sample/fundingfeed/NZDSmoothReconstitutor.java deleted file mode 100644 index 7d88cec..0000000 --- a/org/drip/sample/fundingfeed/NZDSmoothReconstitutor.java +++ /dev/null @@ -1,74 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NZDSmoothReconstitutor Demonstrates the Cleansing and the Smooth Re-constitution of the NZD Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class NZDSmoothReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "NZD"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.SmoothRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/PLNShapePreservingReconstitutor.java b/org/drip/sample/fundingfeed/PLNShapePreservingReconstitutor.java deleted file mode 100644 index fbc5563..0000000 --- a/org/drip/sample/fundingfeed/PLNShapePreservingReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PLNShapePreservingReconstitutor Demonstrates the Cleansing and the Shape Preserving Re-constitution of the - * PLN Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class PLNShapePreservingReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "PLN"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/SEKShapePreservingReconstitutor.java b/org/drip/sample/fundingfeed/SEKShapePreservingReconstitutor.java deleted file mode 100644 index 7b5cd0a..0000000 --- a/org/drip/sample/fundingfeed/SEKShapePreservingReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * SEKShapePreservingReconstitutor Demonstrates the Cleansing and the Shape Preserving Re-constitution of the - * SEK Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class SEKShapePreservingReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "SEK"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/SEKSmoothReconstitutor.java b/org/drip/sample/fundingfeed/SEKSmoothReconstitutor.java deleted file mode 100644 index 64e1234..0000000 --- a/org/drip/sample/fundingfeed/SEKSmoothReconstitutor.java +++ /dev/null @@ -1,74 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * SEKSmoothReconstitutor Demonstrates the Cleansing and the Smooth Re-constitution of the SEK Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class SEKSmoothReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "SEK"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.SmoothRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/SGDShapePreservingReconstitutor.java b/org/drip/sample/fundingfeed/SGDShapePreservingReconstitutor.java deleted file mode 100644 index 952fd7b..0000000 --- a/org/drip/sample/fundingfeed/SGDShapePreservingReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * SGDShapePreservingReconstitutor Demonstrates the Cleansing and the Shape Preserving Re-constitution of the - * SGD Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class SGDShapePreservingReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "SGD"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/TRYShapePreservingReconstitutor.java b/org/drip/sample/fundingfeed/TRYShapePreservingReconstitutor.java deleted file mode 100644 index 0d3b064..0000000 --- a/org/drip/sample/fundingfeed/TRYShapePreservingReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TRYShapePreservingReconstitutor Demonstrates the Cleansing and the Shape Preserving Re-constitution of the - * TRY Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class TRYShapePreservingReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "TRY"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/USDShapePreservingReconstitutor.java b/org/drip/sample/fundingfeed/USDShapePreservingReconstitutor.java deleted file mode 100644 index 798e1c4..0000000 --- a/org/drip/sample/fundingfeed/USDShapePreservingReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * USDShapePreservingReconstitutor Demonstrates the Cleansing and the Shape Preserving Re-constitution of the - * USD Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class USDShapePreservingReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/USDSmoothReconstitutor.java b/org/drip/sample/fundingfeed/USDSmoothReconstitutor.java deleted file mode 100644 index 75d1ff6..0000000 --- a/org/drip/sample/fundingfeed/USDSmoothReconstitutor.java +++ /dev/null @@ -1,74 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * USDSmoothReconstitutor Demonstrates the Cleansing and the Smooth Re-constitution of the USD Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class USDSmoothReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.SmoothRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundingfeed/UnifiedShapePreserving1YStart.java b/org/drip/sample/fundingfeed/UnifiedShapePreserving1YStart.java deleted file mode 100644 index a294555..0000000 --- a/org/drip/sample/fundingfeed/UnifiedShapePreserving1YStart.java +++ /dev/null @@ -1,270 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import java.io.BufferedWriter; -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.*; -import org.drip.state.discount.MergedDiscountForwardCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * UnifiedShapePreserving1YStart demonstrates the unified re-constitution and Metrics Generation. - * - * @author Lakshmi Krishnamurthy - */ - -public class UnifiedShapePreserving1YStart { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - String strFundingMetricsLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Metrics\\FundingCurve\\Unified\\" + strCurrency + ".csv"; - - String[] astrPreFixFloatTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - String[] astrInTenor = new String[] { - "1Y" - }; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrPostFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strFundingMarksLocation, - false - ); - - Map mapISTQ = csvGrid.groupedOrderedDouble (0.01); - - int iNumClose = mapISTQ.size(); - - int iCloseDate = 0; - String strDump = "Date"; - JulianDate[] adtClose = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - BufferedWriter bwMetrics = new BufferedWriter (new java.io.FileWriter (strFundingMetricsLocation)); - - bwMetrics.write (strDump + "\n"); - - for (Map.Entry meISTQ : mapISTQ.entrySet()) { - if (null == meISTQ) continue; - - JulianDate dtSpot = meISTQ.getKey(); - - InstrumentSetTenorQuote istq = meISTQ.getValue(); - - if (null == dtSpot || null == istq) continue; - - double[] adblDepositQuote = istq.instrumentQuote ("DEPOSIT"); - - String[] astrDepositMaturityTenor = istq.instrumentTenor ("DEPOSIT"); - - double[] adblFixFloatQuote = istq.instrumentQuote ("FIXFLOAT"); - - String[] astrFixFloatMaturityTenor = istq.instrumentTenor ("FIXFLOAT"); - - int iNumDepositQuote = null == adblDepositQuote ? 0 : adblDepositQuote.length; - int iNumFixFloatQuote = null == adblFixFloatQuote ? 0 : adblFixFloatQuote.length; - int iNumDepositTenor = null == astrDepositMaturityTenor ? 0 : astrDepositMaturityTenor.length; - int iNumFixFloatTenor = null == astrFixFloatMaturityTenor ? 0 : astrFixFloatMaturityTenor.length; - - if (0 == iNumFixFloatQuote || iNumDepositQuote != iNumDepositTenor || iNumFixFloatQuote != - iNumFixFloatTenor) - continue; - - MergedDiscountForwardCurve dcFunding = LatentMarketStateBuilder.FundingCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - null, - "ForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate", - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - if (!csqc.setFundingState (dcFunding)) continue; - - ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); - - FixFloatComponent[] aFFC = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - astrPreFixFloatTenor, - "MAIN", - 0. - ); - - for (int j = 0; j < aFFC.length; ++j) - aadblFixFloatQuote[iCloseDate][j] = aFFC[j].measureValue ( - valParams, - null, - csqc, - null, - "SwapRate" - ); - - adtClose[iCloseDate] = dtSpot; - - if (++iCloseDate >= iNumClose) break; - } - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtClose, - astrPostFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtClose[i]); - - strDump = adtClose[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - - bwMetrics.write (strDump + "\n"); - } - - bwMetrics.close(); - } -} diff --git a/org/drip/sample/fundingfeed/ZARShapePreservingReconstitutor.java b/org/drip/sample/fundingfeed/ZARShapePreservingReconstitutor.java deleted file mode 100644 index d6c585c..0000000 --- a/org/drip/sample/fundingfeed/ZARShapePreservingReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.fundingfeed; - -import org.drip.feed.transformer.FundingFixFloatMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ZARShapePreservingReconstitutor Demonstrates the Cleansing and the Shape Preserving Re-constitution of the - * ZAR Input Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class ZARShapePreservingReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "ZAR"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\FundingMarks\\" + strCurrency + "Formatted.csv"; - - FundingFixFloatMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/fundinghistorical/AUDShapePreserving1YForward.java b/org/drip/sample/fundinghistorical/AUDShapePreserving1YForward.java deleted file mode 100644 index 0a49774..0000000 --- a/org/drip/sample/fundinghistorical/AUDShapePreserving1YForward.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AUDShapePreserving1YForward Generates the Historical AUD Shape Preserving Funding Curve Native 1Y - * Compounded Forward Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class AUDShapePreserving1YForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "AUD"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y" - }; - String[] astrInTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/AUDShapePreserving1YStart.java b/org/drip/sample/fundinghistorical/AUDShapePreserving1YStart.java deleted file mode 100644 index b1d6cdd..0000000 --- a/org/drip/sample/fundinghistorical/AUDShapePreserving1YStart.java +++ /dev/null @@ -1,228 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AUDShapePreserving1YStart Generates the Historical AUD Shape Preserving Funding Curve Native Compounded - * Forward Rate starting at 1Y Tenor. - * - * @author Lakshmi Krishnamurthy - */ - -public class AUDShapePreserving1YStart { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "AUD"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrInTenor = new String[] { - "1Y" - }; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) { - try { - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } catch (Exception e) { - } - } - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/AUDSmooth1YForward.java b/org/drip/sample/fundinghistorical/AUDSmooth1YForward.java deleted file mode 100644 index 471dae5..0000000 --- a/org/drip/sample/fundinghistorical/AUDSmooth1YForward.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AUDSmooth1YForward Generates the Historical AUD Smoothened Funding Curve Native 1Y Compounded Forward - * Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class AUDSmooth1YForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "AUD"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "SmoothReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y" - }; - String[] astrInTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SMOOTH - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/CADShapePreserving1YForward.java b/org/drip/sample/fundinghistorical/CADShapePreserving1YForward.java deleted file mode 100644 index 280c039..0000000 --- a/org/drip/sample/fundinghistorical/CADShapePreserving1YForward.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CADShapePreserving1YForward Generates the Historical CAD Shape Preserving Funding Curve Native 1Y - * Compounded Forward Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class CADShapePreserving1YForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "CAD"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y" - }; - String[] astrInTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/CADShapePreserving1YStart.java b/org/drip/sample/fundinghistorical/CADShapePreserving1YStart.java deleted file mode 100644 index 127027c..0000000 --- a/org/drip/sample/fundinghistorical/CADShapePreserving1YStart.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CADShapePreserving1YStart Generates the Historical CAD Shape Preserving Funding Curve Native Compounded - * Forward Rate starting at 1Y Tenor. - * - * @author Lakshmi Krishnamurthy - */ - -public class CADShapePreserving1YStart { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "CAD"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrInTenor = new String[] { - "1Y" - }; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/CADSmooth1YForward.java b/org/drip/sample/fundinghistorical/CADSmooth1YForward.java deleted file mode 100644 index 4809233..0000000 --- a/org/drip/sample/fundinghistorical/CADSmooth1YForward.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CADSmooth1YForward Generates the Historical CAD Smoothened Funding Curve Native 1Y Compounded Forward - * Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class CADSmooth1YForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "CAD"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "SmoothReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y" - }; - String[] astrInTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SMOOTH - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/CHFShapePreserving1YForward.java b/org/drip/sample/fundinghistorical/CHFShapePreserving1YForward.java deleted file mode 100644 index 2704b3a..0000000 --- a/org/drip/sample/fundinghistorical/CHFShapePreserving1YForward.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CHFShapePreserving1YForward Generates the Historical CHF Shape Preserving Funding Curve Native 1Y - * Compounded Forward Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class CHFShapePreserving1YForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "CHF"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y" - }; - String[] astrInTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/CHFShapePreserving1YStart.java b/org/drip/sample/fundinghistorical/CHFShapePreserving1YStart.java deleted file mode 100644 index 729b116..0000000 --- a/org/drip/sample/fundinghistorical/CHFShapePreserving1YStart.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CHFShapePreserving1YStart Generates the Historical CHF Shape Preserving Funding Curve Native Compounded - * Forward Rate starting at 1Y Tenor. - * - * @author Lakshmi Krishnamurthy - */ - -public class CHFShapePreserving1YStart { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "CHF"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrInTenor = new String[] { - "1Y" - }; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/CHFSmooth1YForward.java b/org/drip/sample/fundinghistorical/CHFSmooth1YForward.java deleted file mode 100644 index f992a91..0000000 --- a/org/drip/sample/fundinghistorical/CHFSmooth1YForward.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CHFSmooth1YForward Generates the Historical CHF Smoothened Funding Curve Native 1Y Compounded Forward - * Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class CHFSmooth1YForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "CHF"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "SmoothReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y" - }; - String[] astrInTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SMOOTH - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/CZKShapePreserving1YStart.java b/org/drip/sample/fundinghistorical/CZKShapePreserving1YStart.java deleted file mode 100644 index 8ff9a1f..0000000 --- a/org/drip/sample/fundinghistorical/CZKShapePreserving1YStart.java +++ /dev/null @@ -1,228 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CZKShapePreserving1YStart Generates the Historical CZK Shape Preserving Funding Curve Native Compounded - * Forward Rate starting at 1Y Tenor. - * - * @author Lakshmi Krishnamurthy - */ - -public class CZKShapePreserving1YStart { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "CZK"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrInTenor = new String[] { - "1Y" - }; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) { - try { - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } catch (Exception e) { - } - } - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/DKKShapePreserving1YStart.java b/org/drip/sample/fundinghistorical/DKKShapePreserving1YStart.java deleted file mode 100644 index bdb46b3..0000000 --- a/org/drip/sample/fundinghistorical/DKKShapePreserving1YStart.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DKKShapePreserving1YStart Generates the Historical DKK Shape Preserving Funding Curve Native Compounded - * Forward Rate starting at 1Y Tenor. - * - * @author Lakshmi Krishnamurthy - */ - -public class DKKShapePreserving1YStart { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "DKK"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrInTenor = new String[] { - "1Y" - }; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/EURShapePreserving1YForward.java b/org/drip/sample/fundinghistorical/EURShapePreserving1YForward.java deleted file mode 100644 index 8e00669..0000000 --- a/org/drip/sample/fundinghistorical/EURShapePreserving1YForward.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * EURShapePreserving1YForward Generates the Historical EUR Shape Preserving Funding Curve Native 1Y - * Compounded Forward Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class EURShapePreserving1YForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "EUR"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y" - }; - String[] astrInTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/EURShapePreserving1YStart.java b/org/drip/sample/fundinghistorical/EURShapePreserving1YStart.java deleted file mode 100644 index b47b1f6..0000000 --- a/org/drip/sample/fundinghistorical/EURShapePreserving1YStart.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * EURShapePreserving1YStart Generates the Historical EUR Shape Preserving Funding Curve Native Compounded - * Forward Rate starting at 1Y Tenor. - * - * @author Lakshmi Krishnamurthy - */ - -public class EURShapePreserving1YStart { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "EUR"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrInTenor = new String[] { - "1Y" - }; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/EURSmooth1YForward.java b/org/drip/sample/fundinghistorical/EURSmooth1YForward.java deleted file mode 100644 index bafe444..0000000 --- a/org/drip/sample/fundinghistorical/EURSmooth1YForward.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * EURSmooth1YForward Generates the Historical EUR Smoothened Funding Curve Native 1Y Compounded Forward - * Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class EURSmooth1YForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "EUR"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "SmoothReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y" - }; - String[] astrInTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SMOOTH - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/GBPShapePreserving1YForward.java b/org/drip/sample/fundinghistorical/GBPShapePreserving1YForward.java deleted file mode 100644 index 426ec1a..0000000 --- a/org/drip/sample/fundinghistorical/GBPShapePreserving1YForward.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * GBPShapePreserving1YForward Generates the Historical GBP Shape Preserving Funding Curve Native 1Y - * Compounded Forward Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class GBPShapePreserving1YForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "GBP"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y" - }; - String[] astrInTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/GBPShapePreserving1YStart.java b/org/drip/sample/fundinghistorical/GBPShapePreserving1YStart.java deleted file mode 100644 index 2dfd6b3..0000000 --- a/org/drip/sample/fundinghistorical/GBPShapePreserving1YStart.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * GBPShapePreserving1YStart Generates the Historical GBP Shape Preserving Funding Curve Native Compounded - * Forward Rate starting at 1Y Tenor. - * - * @author Lakshmi Krishnamurthy - */ - -public class GBPShapePreserving1YStart { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "GBP"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrInTenor = new String[] { - "1Y" - }; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/GBPSmooth1YForward.java b/org/drip/sample/fundinghistorical/GBPSmooth1YForward.java deleted file mode 100644 index 3b4b475..0000000 --- a/org/drip/sample/fundinghistorical/GBPSmooth1YForward.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * GBPSmooth1YForward Generates the Historical GBP Smoothened Funding Curve Native 1Y Compounded Forward - * Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class GBPSmooth1YForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "GBP"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "SmoothReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y" - }; - String[] astrInTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SMOOTH - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/HKDShapePreserving1YStart.java b/org/drip/sample/fundinghistorical/HKDShapePreserving1YStart.java deleted file mode 100644 index d5fc129..0000000 --- a/org/drip/sample/fundinghistorical/HKDShapePreserving1YStart.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * HKDShapePreserving1YStart Generates the Historical HKD Shape Preserving Funding Curve Native Compounded - * Forward Rate starting at 1Y Tenor. - * - * @author Lakshmi Krishnamurthy - */ - -public class HKDShapePreserving1YStart { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "HKD"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrInTenor = new String[] { - "1Y" - }; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/HUFShapePreserving1YStart.java b/org/drip/sample/fundinghistorical/HUFShapePreserving1YStart.java deleted file mode 100644 index 3e8e1ad..0000000 --- a/org/drip/sample/fundinghistorical/HUFShapePreserving1YStart.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * HUFShapePreserving1YStart Generates the Historical HUF Shape Preserving Funding Curve Native Compounded - * Forward Rate starting at 1Y Tenor. - * - * @author Lakshmi Krishnamurthy - */ - -public class HUFShapePreserving1YStart { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "HUF"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrInTenor = new String[] { - "1Y" - }; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/ILSShapePreserving1YStart.java b/org/drip/sample/fundinghistorical/ILSShapePreserving1YStart.java deleted file mode 100644 index 3d625f5..0000000 --- a/org/drip/sample/fundinghistorical/ILSShapePreserving1YStart.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ILSShapePreserving1YStart Generates the Historical ILS Shape Preserving Funding Curve Native Compounded - * Forward Rate starting at 1Y Tenor. - * - * @author Lakshmi Krishnamurthy - */ - -public class ILSShapePreserving1YStart { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "ILS"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrInTenor = new String[] { - "1Y" - }; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/JPYShapePreserving1YForward.java b/org/drip/sample/fundinghistorical/JPYShapePreserving1YForward.java deleted file mode 100644 index 3faa2b3..0000000 --- a/org/drip/sample/fundinghistorical/JPYShapePreserving1YForward.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * JPYShapePreserving1YForward Generates the Historical JPY Shape Preserving Funding Curve Native 1Y - * Compounded Forward Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class JPYShapePreserving1YForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "JPY"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y" - }; - String[] astrInTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/JPYShapePreserving1YStart.java b/org/drip/sample/fundinghistorical/JPYShapePreserving1YStart.java deleted file mode 100644 index eb50d7a..0000000 --- a/org/drip/sample/fundinghistorical/JPYShapePreserving1YStart.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * JPYShapePreserving1YStart Generates the Historical JPY Shape Preserving Funding Curve Native Compounded - * Forward Rate starting at 1Y Tenor. - * - * @author Lakshmi Krishnamurthy - */ - -public class JPYShapePreserving1YStart { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "JPY"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrInTenor = new String[] { - "1Y" - }; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/JPYSmooth1YForward.java b/org/drip/sample/fundinghistorical/JPYSmooth1YForward.java deleted file mode 100644 index c6082e2..0000000 --- a/org/drip/sample/fundinghistorical/JPYSmooth1YForward.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * JPYSmooth1YForward Generates the Historical JPY Smoothened Funding Curve Native 1Y Compounded Forward - * Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class JPYSmooth1YForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "JPY"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "SmoothReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y" - }; - String[] astrInTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SMOOTH - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/MXNShapePreserving1YStart.java b/org/drip/sample/fundinghistorical/MXNShapePreserving1YStart.java deleted file mode 100644 index a15a35b..0000000 --- a/org/drip/sample/fundinghistorical/MXNShapePreserving1YStart.java +++ /dev/null @@ -1,226 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * MXNShapePreserving1YStart Generates the Historical MXN Shape Preserving Funding Curve Native Compounded - * Forward Rate starting at 1Y Tenor. - * - * @author Lakshmi Krishnamurthy - */ - -public class MXNShapePreserving1YStart { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "MXN"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrInTenor = new String[] { - "1Y" - }; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - if (null == fcm) continue; - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/NOKShapePreserving1YForward.java b/org/drip/sample/fundinghistorical/NOKShapePreserving1YForward.java deleted file mode 100644 index fb37b8e..0000000 --- a/org/drip/sample/fundinghistorical/NOKShapePreserving1YForward.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NOKShapePreserving1YForward Generates the Historical NOK Shape Preserving Funding Curve Native 1Y - * Compounded Forward Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class NOKShapePreserving1YForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "NOK"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y" - }; - String[] astrInTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/NOKShapePreserving1YStart.java b/org/drip/sample/fundinghistorical/NOKShapePreserving1YStart.java deleted file mode 100644 index dfcc1ae..0000000 --- a/org/drip/sample/fundinghistorical/NOKShapePreserving1YStart.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NOKShapePreserving1YStart Generates the Historical NOK Shape Preserving Funding Curve Native Compounded - * Forward Rate starting at 1Y Tenor. - * - * @author Lakshmi Krishnamurthy - */ - -public class NOKShapePreserving1YStart { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "NOK"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrInTenor = new String[] { - "1Y" - }; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/NOKSmooth1YForward.java b/org/drip/sample/fundinghistorical/NOKSmooth1YForward.java deleted file mode 100644 index 89ba26b..0000000 --- a/org/drip/sample/fundinghistorical/NOKSmooth1YForward.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NOKSmooth1YForward Generates the Historical NOK Smoothened Funding Curve Native 1Y Compounded Forward - * Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class NOKSmooth1YForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "NOK"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "SmoothReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y" - }; - String[] astrInTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SMOOTH - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/NZDShapePreserving1YForward.java b/org/drip/sample/fundinghistorical/NZDShapePreserving1YForward.java deleted file mode 100644 index 4676ee5..0000000 --- a/org/drip/sample/fundinghistorical/NZDShapePreserving1YForward.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NZDShapePreserving1YForward Generates the Historical NZD Shape Preserving Funding Curve Native 1Y - * Compounded Forward Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class NZDShapePreserving1YForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "NZD"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y" - }; - String[] astrInTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/NZDShapePreserving1YStart.java b/org/drip/sample/fundinghistorical/NZDShapePreserving1YStart.java deleted file mode 100644 index 723730a..0000000 --- a/org/drip/sample/fundinghistorical/NZDShapePreserving1YStart.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NZDShapePreserving1YStart Generates the Historical NZD Shape Preserving Funding Curve Native Compounded - * Forward Rate starting at 1Y Tenor. - * - * @author Lakshmi Krishnamurthy - */ - -public class NZDShapePreserving1YStart { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "NZD"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrInTenor = new String[] { - "1Y" - }; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/NZDSmooth1YForward.java b/org/drip/sample/fundinghistorical/NZDSmooth1YForward.java deleted file mode 100644 index a567fcd..0000000 --- a/org/drip/sample/fundinghistorical/NZDSmooth1YForward.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NZDSmooth1YForward Generates the Historical NZD Smoothened Funding Curve Native 1Y Compounded Forward - * Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class NZDSmooth1YForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "NZD"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "SmoothReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y" - }; - String[] astrInTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SMOOTH - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/PLNShapePreserving1YStart.java b/org/drip/sample/fundinghistorical/PLNShapePreserving1YStart.java deleted file mode 100644 index d2d5a11..0000000 --- a/org/drip/sample/fundinghistorical/PLNShapePreserving1YStart.java +++ /dev/null @@ -1,226 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PLNShapePreserving1YStart Generates the Historical PLN Shape Preserving Funding Curve Native Compounded - * Forward Rate starting at 1Y Tenor. - * - * @author Lakshmi Krishnamurthy - */ - -public class PLNShapePreserving1YStart { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "PLN"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrInTenor = new String[] { - "1Y" - }; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - if (null == fcm) continue; - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/SEKShapePreserving1YForward.java b/org/drip/sample/fundinghistorical/SEKShapePreserving1YForward.java deleted file mode 100644 index 54393fa..0000000 --- a/org/drip/sample/fundinghistorical/SEKShapePreserving1YForward.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * SEKShapePreserving1YForward Generates the Historical SEK Shape Preserving Funding Curve Native 1Y - * Compounded Forward Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class SEKShapePreserving1YForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "SEK"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y" - }; - String[] astrInTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/SEKShapePreserving1YStart.java b/org/drip/sample/fundinghistorical/SEKShapePreserving1YStart.java deleted file mode 100644 index 59c165b..0000000 --- a/org/drip/sample/fundinghistorical/SEKShapePreserving1YStart.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * SEKShapePreserving1YStart Generates the Historical SEK Shape Preserving Funding Curve Native Compounded - * Forward Rate starting at 1Y Tenor. - * - * @author Lakshmi Krishnamurthy - */ - -public class SEKShapePreserving1YStart { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "SEK"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrInTenor = new String[] { - "1Y" - }; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/SEKSmooth1YForward.java b/org/drip/sample/fundinghistorical/SEKSmooth1YForward.java deleted file mode 100644 index 836cd42..0000000 --- a/org/drip/sample/fundinghistorical/SEKSmooth1YForward.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * SEKSmooth1YForward Generates the Historical SEK Smoothened Funding Curve Native 1Y Compounded Forward - * Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class SEKSmooth1YForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "SEK"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "SmoothReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y" - }; - String[] astrInTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SMOOTH - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/SGDShapePreserving1YStart.java b/org/drip/sample/fundinghistorical/SGDShapePreserving1YStart.java deleted file mode 100644 index 375e903..0000000 --- a/org/drip/sample/fundinghistorical/SGDShapePreserving1YStart.java +++ /dev/null @@ -1,226 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * SGDShapePreserving1YStart Generates the Historical SGD Shape Preserving Funding Curve Native Compounded - * Forward Rate starting at 1Y Tenor. - * - * @author Lakshmi Krishnamurthy - */ - -public class SGDShapePreserving1YStart { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "SGD"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrInTenor = new String[] { - "1Y" - }; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - if (null == fcm) continue; - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/TRYShapePreserving1YStart.java b/org/drip/sample/fundinghistorical/TRYShapePreserving1YStart.java deleted file mode 100644 index a47284f..0000000 --- a/org/drip/sample/fundinghistorical/TRYShapePreserving1YStart.java +++ /dev/null @@ -1,234 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TRYShapePreserving1YStart Generates the Historical TRY Shape Preserving Funding Curve Native Compounded - * Forward Rate starting at 1Y Tenor. - * - * @author Lakshmi Krishnamurthy - */ - -public class TRYShapePreserving1YStart { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "TRY"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrInTenor = new String[] { - "1Y" - }; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - if (null == fcm) continue; - - // System.out.println (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - try { - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } catch (Exception e) { - // e.printStackTrace(); - - continue; - } - } - } -} diff --git a/org/drip/sample/fundinghistorical/USDShapePreserving1YForward.java b/org/drip/sample/fundinghistorical/USDShapePreserving1YForward.java deleted file mode 100644 index b1e3d94..0000000 --- a/org/drip/sample/fundinghistorical/USDShapePreserving1YForward.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * USDShapePreserving1YForward Generates the Historical USD Shape Preserving Funding Curve Native 1Y - * Compounded Forward Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class USDShapePreserving1YForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y" - }; - String[] astrInTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/USDShapePreserving1YStart.java b/org/drip/sample/fundinghistorical/USDShapePreserving1YStart.java deleted file mode 100644 index 56e38c9..0000000 --- a/org/drip/sample/fundinghistorical/USDShapePreserving1YStart.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * USDShapePreserving1YStart Generates the Historical USD Shape Preserving Funding Curve Native Compounded - * Forward Rate starting at 1Y Tenor. - * - * @author Lakshmi Krishnamurthy - */ - -public class USDShapePreserving1YStart { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrInTenor = new String[] { - "1Y" - }; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/USDSmooth1YForward.java b/org/drip/sample/fundinghistorical/USDSmooth1YForward.java deleted file mode 100644 index ca8d2e1..0000000 --- a/org/drip/sample/fundinghistorical/USDSmooth1YForward.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * USDSmooth1YForward Generates the Historical USD Smoothened Funding Curve Native 1Y Compounded Forward - * Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class USDSmooth1YForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "SmoothReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1Y" - }; - String[] astrInTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SMOOTH - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fundinghistorical/ZARShapePreserving1YStart.java b/org/drip/sample/fundinghistorical/ZARShapePreserving1YStart.java deleted file mode 100644 index 10ae83b..0000000 --- a/org/drip/sample/fundinghistorical/ZARShapePreserving1YStart.java +++ /dev/null @@ -1,230 +0,0 @@ - -package org.drip.sample.fundinghistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.FundingCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ZARShapePreserving1YStart Generates the Historical ZAR Shape Preserving Funding Curve Native Compounded - * Forward Rate starting at 1Y Tenor. - * - * @author Lakshmi Krishnamurthy - */ - -public class ZARShapePreserving1YStart { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "ZAR"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; - String[] astrInTenor = new String[] { - "1Y" - }; - String[] astrForTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - }; - String[] astrFixFloatMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); - - double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); - - double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); - - double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); - - double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); - - double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); - - double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); - - double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); - - double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); - - double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); - - double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); - - double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); - - double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); - - double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblFixFloatQuote = new double[iNumClose][18]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; - aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; - aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; - aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; - aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; - aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; - aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; - aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; - aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; - aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; - aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; - aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; - aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; - aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; - aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; - aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; - aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; - aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = FundingCurveAPI.HorizonMetrics ( - adtSpot, - astrFixFloatMaturityTenor, - aadblFixFloatQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SHAPE_PRESERVING - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) { - double dblNativeForwardRate = Double.NaN; - - try { - dblNativeForwardRate = fcm.nativeForwardRate ( - strInTenor, - strForTenor - ); - } catch (Exception e) { - } - - strDump += "," + FormatUtil.FormatDouble (dblNativeForwardRate, 1, 5, 100.); - } - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/fx/CustomFXCurveBuilder.java b/org/drip/sample/fx/CustomFXCurveBuilder.java deleted file mode 100644 index d697ec5..0000000 --- a/org/drip/sample/fx/CustomFXCurveBuilder.java +++ /dev/null @@ -1,334 +0,0 @@ - -package org.drip.sample.fx; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.fx.FXForwardComponent; -import org.drip.product.params.CurrencyPair; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.*; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.fx.FXCurve; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CustomFXCurveBuilder illustrates the Construction and Usage of the FX Forward Curve. - * - * @author Lakshmi Krishnamurthy - */ - -public class CustomFXCurveBuilder { - - private static FXForwardComponent[] FXForwardCalibComponent ( - final CurrencyPair cp, - final JulianDate dtSpot, - final String[] astrMaturityTenor) - throws Exception - { - FXForwardComponent[] aFXForward = new FXForwardComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aFXForward[i] = new FXForwardComponent ( - cp.code() + "::FXFWD::" + astrMaturityTenor[i], - cp, - dtSpot.julian(), - dtSpot.addTenor (astrMaturityTenor[i]).julian(), - 1., - null - ); - - return aFXForward; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - CurrencyPair cp = CurrencyPair.FromCode ("USD/EUR"); - - double dblSpot = 1.0993; - - String[] astrMaturityTenor = new String[] { - "1W", - "1M", - "3M", - "6M", - "1Y", - "2Y", - "3Y" - }; - - FXForwardComponent[] aFXForward = FXForwardCalibComponent ( - cp, - dtToday, - astrMaturityTenor - ); - - double[] adblFXForward = new double[] { - 1.1000, // "1W", - 1.1012, // "1M", - 1.1039, // "3M", - 1.1148, // "6M", - 1.1232, // "1Y", - 1.1497, // "2Y", - 1.1865, // "3Y" - }; - - LatentStateStretchSpec fxForwardStretch = LatentStateStretchBuilder.FXStretchSpec ( - "FXFORWARD", - aFXForward, - "Outright", - adblFXForward - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - fxForwardStretch - }; - - LinearLatentStateCalibrator llsc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - cp.denomCcy() - ); - - FXCurve fxCurve = ScenarioFXCurveBuilder.ShapePreservingFXCurve ( - llsc, - aStretchSpec, - cp, - valParams, - null, - null, - null, - dblSpot - ); - - MergedDiscountForwardCurve dcUSD = ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - dtToday, - "USD", - 0.02 - ); - - MergedDiscountForwardCurve dcEUR = ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - dtToday, - "EUR", - 0.01 - ); - - CurveSurfaceQuoteContainer csqs = new CurveSurfaceQuoteContainer(); - - csqs.setFXState (fxCurve); - - System.out.println ("\n\t|-------------------------------------------------------------------||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| Custom FX Curve Builder Metrics #1 ||"); - - System.out.println ("\t| ------ -- ----- ------- ------- -- ||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| FX Forward Tenor ||"); - - System.out.println ("\t| Input FX Forward Outright ||"); - - System.out.println ("\t| Curve FX Forward Outright ||"); - - System.out.println ("\t| Product FX Forward Outright ||"); - - System.out.println ("\t| Product FX Forward PIP ||"); - - System.out.println ("\t| FX Forward Discount Curve Basis EUR Curve ||"); - - System.out.println ("\t| FX Forward Discount Curve Basis USD Curve ||"); - - System.out.println ("\t|-------------------------------------------------------------------||"); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - Map mapMeasures = aFXForward[i].value ( - valParams, - null, - csqs, - null - ); - - System.out.println ( - "\t| [" + astrMaturityTenor[i] + "] => " + - FormatUtil.FormatDouble (adblFXForward[i], 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (fxCurve.fx (astrMaturityTenor[i]), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (mapMeasures.get ("Outright"), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (mapMeasures.get ("PIP"), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble ( - aFXForward[i].discountCurveBasis ( - valParams, - dcEUR, - dcUSD, - dblSpot, - adblFXForward[i], - false - ), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble ( - aFXForward[i].discountCurveBasis ( - valParams, - dcEUR, - dcUSD, - dblSpot, - adblFXForward[i], - true - ), 1, 4, 1.) + " || " - ); - } - - System.out.println ("\t|-------------------------------------------------------------------||"); - - int[] aiDateNode = new int[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aiDateNode[i] = dtToday.addTenor (astrMaturityTenor[i]).julian(); - - double[] adblZeroUSDBasis = fxCurve.zeroBasis ( - aiDateNode, - valParams, - dcEUR, - dcUSD, - true - ); - - double[] adblZeroEURBasis = fxCurve.zeroBasis ( - aiDateNode, - valParams, - dcEUR, - dcUSD, - false - ); - - double[] adblBootstrappedUSDBasis = fxCurve.bootstrapBasis ( - aiDateNode, - valParams, - dcEUR, - dcUSD, - true - ); - - double[] adblBootstrappedEURBasis = fxCurve.bootstrapBasis ( - aiDateNode, - valParams, - dcEUR, - dcUSD, - false - ); - - System.out.println ("\n\t|-------------------------------------------------------------------||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| Custom FX Curve Builder Metrics #2 ||"); - - System.out.println ("\t| ------ -- ----- ------- ------- -- ||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| FX Forward Tenor ||"); - - System.out.println ("\t| FX Forward Discount Curve Zero Basis USD Curve ||"); - - System.out.println ("\t| FX Forward Discount Curve Zero Basis EUR Curve ||"); - - System.out.println ("\t| FX Forward Discount Curve Bootstrapped USD Curve Basis ||"); - - System.out.println ("\t| FX Forward Discount Curve Bootstrapped EUR Curve Basis ||"); - - System.out.println ("\t|-------------------------------------------------------------------||"); - - for (int i = 0; i < astrMaturityTenor.length; ++i) - System.out.println ( - "\t| [" + astrMaturityTenor[i] + "] => " + - FormatUtil.FormatDouble (adblZeroUSDBasis[i], 1, 4, 100.) + " | " + - FormatUtil.FormatDouble (adblZeroEURBasis[i], 1, 4, 100.) + " | " + - FormatUtil.FormatDouble (adblBootstrappedUSDBasis[i], 1, 4, 100.) + " | " + - FormatUtil.FormatDouble (adblBootstrappedEURBasis[i], 1, 4, 100.) + " ||" - ); - - System.out.println ("\t|-------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/fx/FXCurrencyPairConventions.java b/org/drip/sample/fx/FXCurrencyPairConventions.java deleted file mode 100644 index 7909db5..0000000 --- a/org/drip/sample/fx/FXCurrencyPairConventions.java +++ /dev/null @@ -1,169 +0,0 @@ - -package org.drip.sample.fx; - -import org.drip.market.definition.FXSettingContainer; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FXCurrencyPairConventions demonstrates the accessing of the Standard FX Currency Order and Currency Pair - * Conventions. - * - * @author Lakshmi Krishnamurthy - */ - -public class FXCurrencyPairConventions { - - private static final void CurrencyOrder ( - final String strCurrency) - throws Exception - { - System.out.println ("\t| " + strCurrency + " " + - FXSettingContainer.CurrencyOrder ( - strCurrency - ) + " |" - ); - } - - private static final void CurrencyPairInfo ( - final String strCurrency1, - final String strCurrency2) - throws Exception - { - System.out.println ("\t| " + strCurrency1 + "/" + strCurrency2 + " => " + - FXSettingContainer.CurrencyPair ( - strCurrency1, - strCurrency2 - ) - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - System.out.println ("\t|----------------|"); - - System.out.println ("\t| CURRENCY ORDER |"); - - System.out.println ("\t|----------------|"); - - CurrencyOrder ("AUD"); - - CurrencyOrder ("CAD"); - - CurrencyOrder ("CHF"); - - CurrencyOrder ("EUR"); - - CurrencyOrder ("GBP"); - - CurrencyOrder ("JPY"); - - CurrencyOrder ("NZD"); - - CurrencyOrder ("USD"); - - CurrencyOrder ("ZAR"); - - System.out.println ("\t|----------------|\n\n"); - - System.out.println ("\t|---------------------------------------|"); - - System.out.println ("\t| PAIR NUM DENOM BASE FACTOR |"); - - System.out.println ("\t|---------------------------------------|"); - - CurrencyPairInfo ("AUD", "EUR"); - - CurrencyPairInfo ("AUD", "USD"); - - CurrencyPairInfo ("EUR", "GBP"); - - CurrencyPairInfo ("EUR", "JPY"); - - CurrencyPairInfo ("EUR", "USD"); - - CurrencyPairInfo ("GBP", "JPY"); - - CurrencyPairInfo ("GBP", "USD"); - - CurrencyPairInfo ("USD", "BRL"); - - CurrencyPairInfo ("USD", "CAD"); - - CurrencyPairInfo ("USD", "CHF"); - - CurrencyPairInfo ("USD", "CNY"); - - CurrencyPairInfo ("USD", "EGP"); - - CurrencyPairInfo ("USD", "HUF"); - - CurrencyPairInfo ("USD", "INR"); - - CurrencyPairInfo ("USD", "JPY"); - - CurrencyPairInfo ("USD", "KRW"); - - CurrencyPairInfo ("USD", "MXN"); - - CurrencyPairInfo ("USD", "PLN"); - - CurrencyPairInfo ("USD", "TRY"); - - CurrencyPairInfo ("USD", "TWD"); - - CurrencyPairInfo ("USD", "ZAR"); - - System.out.println ("\t|---------------------------------------|"); - } -} diff --git a/org/drip/sample/govvie/NonlinearGovvieCurve.java b/org/drip/sample/govvie/NonlinearGovvieCurve.java deleted file mode 100644 index bfa7b91..0000000 --- a/org/drip/sample/govvie/NonlinearGovvieCurve.java +++ /dev/null @@ -1,359 +0,0 @@ - -package org.drip.sample.govvie; - -/* - * Credit Product imports - */ - -import org.drip.analytics.date.*; -import org.drip.param.valuation.*; -import org.drip.product.definition.*; -import org.drip.param.creator.*; -import org.drip.product.creator.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * NonlinearGovvieCurve contains a demo of construction and usage of the non-linear treasury discount curve - * from government bond inputs. It shows the following: - * - Create on-the-run TSY bond set. - * - Calibrate a discount curve off of the on-the-run yields and calculate the implied zeroes and DF's. - * - Price an off-the-run TSY. - * - * @author Lakshmi Krishnamurthy - */ - -public class NonlinearGovvieCurve { - - /* - * Sample demonstrating creation of simple fixed coupon treasury bond - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final Bond CreateTSYBond ( - final String strName, - final double dblCoupon, - final JulianDate dt, - int iNumYears) - throws Exception - { - return BondBuilder.CreateSimpleFixed ( // Simple Fixed Rate Bond - strName, // Name - "USD", // Fictitious Treasury Curve Name - "", // Empty Credit Curve - dblCoupon, // Bond Coupon - 2, // Frequency - "Act/Act", // Day Count - dt, // Effective - dt.addYears (iNumYears), // Maturity - null, // Principal Schedule - null - ); - } - - /* - * Sample demonstrating creation of a set of the on-the-run treasury bonds - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final Bond[] CreateOnTheRunTSYBondSet ( - final JulianDate dt, - final String[] astrTSYBondName, - final int[] aiMaturityYear, - final double[] adblCoupon) - throws Exception - { - Bond aTSYBond[] = new Bond[astrTSYBondName.length]; - - for (int i = 0; i < astrTSYBondName.length; ++i) - aTSYBond[i] = CreateTSYBond ( - astrTSYBondName[i], - adblCoupon[i], - dt, - aiMaturityYear[i] - ); - - return aTSYBond; - } - - /* - * Sample demonstrating building of the treasury discount curve based off the on-the run instruments and their yields - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve BuildOnTheRunTSYDiscountCurve ( - final JulianDate dt, - final Bond[] aTSYBond, - final double[] adblCalibYield) - throws Exception - { - String astrCalibMeasure[] = new String[aTSYBond.length]; - - for (int i = 0; i < aTSYBond.length; ++i) - astrCalibMeasure[i] = "Yield"; - - return ScenarioDiscountCurveBuilder.NonlinearBuild ( - dt, - "USD", - aTSYBond, - adblCalibYield, - astrCalibMeasure, - null - ); - } - - /* - * Sample demonstrating calculation of the yields of the input on the run treasury instruments - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final double[] GetOnTheRunYield ( - final JulianDate dt, - final MergedDiscountForwardCurve dcTSY, - final Bond[] aTSYBond) - throws Exception - { - double adblYield[] = new double[aTSYBond.length]; - - for (int i = 0; i < aTSYBond.length; ++i) { - double dblPrice = aTSYBond[i].priceFromFundingCurve ( - new ValuationParams ( - DateUtil.Today(), - DateUtil.Today(), - "USD" - ), - MarketParamsBuilder.Discount (dcTSY), - aTSYBond[i].maturityDate().julian(), - 1., - 0. - ); - - System.out.println ("\tPrice[" + aTSYBond[i].name() + "]: " + - FormatUtil.FormatDouble (dblPrice, 2, 3, 100.)); - - double dblYield = aTSYBond[i].yieldFromPrice ( - new ValuationParams ( - DateUtil.Today(), - DateUtil.Today(), - "USD" - ), - MarketParamsBuilder.Discount (dcTSY), - null, - dblPrice - ); - - System.out.println ("\tYield[" + aTSYBond[i].name() + "]: " + - FormatUtil.FormatDouble (dblYield, 1, 3, 100.)); - } - - return adblYield; - } - - /* - * This sample illustrates the construction and validation of the Treasury Curve API. It demonstrates the - * following: - * - Create the on-the-run treasury bonds. - * - Create the on-the-run treasury discount curve from the treasury bonds. - * - Compare the implied and the input yields for the on-the-run's. - * - Calculate the yield of an off-the-run instrument off of the on-the-run yield discount curve and - * cross verify it with the price. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void TreasuryCurveSample() - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - String strConfig = ""; - - EnvManager.InitEnv (strConfig); - - /* - * Define name, maturity, coupon, and the market yield of the input on-the-run treasuries - */ - - final String[] astrTSYName = new String[] {"TSY2YON", "TSY3YON", "TSY5YON", "TSY7YON", "TSY10YON", "TSY30YON"}; - final int[] aiMaturityYear = new int[] {2, 3, 5, 7, 10, 30}; - final double[] adblCoupon = new double[] {0.0200, 0.0250, 0.0300, 0.0325, 0.0375, 0.0400}; - final double[] adblCalibYield = new double[] {0.0200, 0.0250, 0.0300, 0.0325, 0.0375, 0.0400}; - - /* - * Create the on-the-run treasury bonds - */ - - long lTime = System.nanoTime(); - - Bond[] aTSYBond = CreateOnTheRunTSYBondSet ( - DateUtil.Today(), - astrTSYName, - aiMaturityYear, - adblCoupon - ); - - /* - * Create the on-the-run treasury discount curve - */ - - MergedDiscountForwardCurve dcTSY = BuildOnTheRunTSYDiscountCurve ( - DateUtil.Today(), - aTSYBond, - adblCalibYield - ); - - /* - * Compare the implied discount rate and input yields - in general they DO NOT match - */ - - for (int i = 0; i < astrTSYName.length; ++i) { - String strTenor = aiMaturityYear[i] + "Y"; - - System.out.println ("Zero[" + strTenor + "]: " + dcTSY.zero (strTenor) + - "; Yield[" + strTenor + "]: " + adblCalibYield[i]); - } - - System.out.println ("\n----\n"); - - double[] adblYield = GetOnTheRunYield ( - DateUtil.Today(), - dcTSY, - aTSYBond - ); - - /* - * Compare the implied and the input yields for the on-the-run's - they DO match - */ - - for (int i = 0; i < astrTSYName.length; ++i) { - String strTenor = aiMaturityYear[i] + "Y"; - - System.out.println ("CalcYield[" + strTenor + "]: " + adblYield[i] + "; Input[" + strTenor + "]: " + adblCalibYield[i]); - } - - /* - * Finally calculate the yield of an off-the-run instrument off of the on-the-run yield discount curve - */ - - /* - * Construct off-the-run - */ - - int iOffTheRunMaturityYears = 10; - - Bond bondOffTheRun = BondBuilder.CreateSimpleFixed ( // Simple Fixed Rate Bond - "USD" + iOffTheRunMaturityYears + "YOFF", - "USD", - "", - 0.0375, - 2, - "Act/Act", - DateUtil.Today(), - DateUtil.Today().addYears (iOffTheRunMaturityYears), // off-the-run - null, - null - ); - - /* - * Calculate price for off-the-run - */ - - double dblPrice = bondOffTheRun.priceFromFundingCurve ( - new ValuationParams ( - DateUtil.Today(), - DateUtil.Today(), - "USD" - ), - MarketParamsBuilder.Discount (dcTSY), - bondOffTheRun.maturityDate().julian(), - 1., - 0. - ); - - System.out.println ("\nOff-The-Run Price[" + iOffTheRunMaturityYears + "Y]: " + dblPrice); - - /* - * Calculate yield for off-the-run - */ - - double dblYieldOffTheRun = bondOffTheRun.yieldFromPrice ( - new ValuationParams ( - DateUtil.Today(), - DateUtil.Today(), - "USD" - ), - MarketParamsBuilder.Discount (dcTSY), - null, - dblPrice - ); - - System.out.println ("\nOff-The-Run Yield[" + iOffTheRunMaturityYears + "Y]: " + dblYieldOffTheRun); - - System.out.println ("\tTime => " + (System.nanoTime() - lTime) * 1.e-06 + " ms"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - TreasuryCurveSample(); - } -} diff --git a/org/drip/sample/govvie/SplineGovvieCurve.java b/org/drip/sample/govvie/SplineGovvieCurve.java deleted file mode 100644 index de1c7f1..0000000 --- a/org/drip/sample/govvie/SplineGovvieCurve.java +++ /dev/null @@ -1,153 +0,0 @@ - -package org.drip.sample.govvie; - -import org.drip.analytics.date.*; -import org.drip.product.credit.BondComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.TreasuryBuilder; -import org.drip.state.creator.ScenarioGovvieCurveBuilder; -import org.drip.state.govvie.GovvieCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * SplineGovvieCurve demonstrates the Construction and Usage of the Spline-based Govvie Curve. - * - * @author Lakshmi Krishnamurthy - */ - -public class SplineGovvieCurve { - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strTreasuryCode = "UST"; - String strCurrency = "USD"; - - int[] aiMaturityDate = { - dtSpot.addTenor ("01Y").julian(), - dtSpot.addTenor ("02Y").julian(), - dtSpot.addTenor ("03Y").julian(), - dtSpot.addTenor ("05Y").julian(), - dtSpot.addTenor ("07Y").julian(), - dtSpot.addTenor ("10Y").julian(), - dtSpot.addTenor ("30Y").julian() - }; - - double[] adblYield = { - 0.0113, // "01Y", - 0.0121, // "02Y", - 0.0127, // "03Y", - 0.0137, // "05Y", - 0.0145, // "07Y", - 0.0154, // "10Y" - 0.0198 // "30Y" - }; - - GovvieCurve gc = ScenarioGovvieCurveBuilder.CubicPolynomialCurve ( - strTreasuryCode, - dtSpot, - strTreasuryCode, - strCurrency, - aiMaturityDate, - adblYield - ); - - JulianDate[] adtEffective = new JulianDate[] { - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot - }; - - JulianDate[] adtMaturity = new JulianDate[] { - dtSpot.addTenor ("1Y"), - dtSpot.addTenor ("2Y"), - dtSpot.addTenor ("3Y"), - dtSpot.addTenor ("5Y"), - dtSpot.addTenor ("7Y"), - dtSpot.addTenor ("10Y"), - dtSpot.addTenor ("30Y") - }; - - BondComponent[] aTreasury = TreasuryBuilder.FromCode ( - strTreasuryCode, - adtEffective, - adtMaturity, - adblYield - ); - - GovvieCurve gcCalib = ScenarioGovvieCurveBuilder.CubicPolyShapePreserver ( - strTreasuryCode, - strTreasuryCode, - strCurrency, - dtSpot.julian(), - aTreasury, - adblYield, - "Yield" - ); - - System.out.println(); - - for (int i = 0; i < adblYield.length; ++i) - System.out.println ( - "\t[" + new JulianDate (aiMaturityDate[i]) + "] => " + - FormatUtil.FormatDouble (adblYield[i], 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (gc.yield (aiMaturityDate[i]), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (gcCalib.yield (aiMaturityDate[i]), 1, 2, 100.) + "% || " - ); - } -} diff --git a/org/drip/sample/helitterman/Table4DetailedBlowout.java b/org/drip/sample/helitterman/Table4DetailedBlowout.java deleted file mode 100644 index a9b6051..0000000 --- a/org/drip/sample/helitterman/Table4DetailedBlowout.java +++ /dev/null @@ -1,474 +0,0 @@ - -package org.drip.sample.helitterman; - -import org.drip.quant.common.FormatUtil; -import org.drip.quant.linearalgebra.Matrix; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * Table4DetailedBlowout replicates the detailed Steps involved in the Black-Litterman Model Process as - * illustrated in Table #4 the Following Paper: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * @author Lakshmi Krishnamurthy - */ - -public class Table4DetailedBlowout { - - public static void main ( - final String[] astrArgs) - throws Exception - { - String[] astrInputSovereign = new String[] { - "AUS", - "CAD", - "FRA", - "GER", - "JPN", - "UK ", - "USA" - }; - - double[][] aadblInputCorrelation = new double[][] { - {1.000, 0.488, 0.478, 0.515, 0.439, 0.512, 0.491}, - {0.488, 1.000, 0.664, 0.655, 0.310, 0.608, 0.779}, - {0.478, 0.664, 1.000, 0.861, 0.355, 0.783, 0.668}, - {0.515, 0.655, 0.861, 1.000, 0.354, 0.777, 0.653}, - {0.439, 0.310, 0.355, 0.354, 1.000, 0.405, 0.306}, - {0.512, 0.608, 0.783, 0.777, 0.405, 1.000, 0.652}, - {0.491, 0.779, 0.668, 0.653, 0.306, 0.652, 1.000} - }; - - double[] adblInputVolatility = new double[] { - 0.160, - 0.203, - 0.248, - 0.271, - 0.210, - 0.200, - 0.187 - }; - - double[] adblInputW = new double[] { - 0.016, - 0.022, - 0.052, - 0.055, - 0.116, - 0.124, - 0.615 - }; - - double dblInputDELTA = 2.5; - double dblInputTAU = 0.05; - - double[][] aadblInputP = new double[][] { - { 0.000, 0.000, -0.295, 1.000, 0.000, -0.705, 0.000} - }; - - double[][] aadblInputOmega = new double[][] { - {0.021} - }; - - double[] adblInputQ = new double[] { - 0.05 - }; - - int iNumSovereign = astrInputSovereign.length; - double[][] aadblSIGMA = new double[iNumSovereign][iNumSovereign]; - - for (int i = 0; i < iNumSovereign; ++i) { - for (int j = 0; j < iNumSovereign; ++j) - aadblSIGMA[i][j] = adblInputVolatility[i] * adblInputVolatility[j] * aadblInputCorrelation[i][j]; - } - - double[] adblPI = Matrix.Product ( - aadblSIGMA, - adblInputW - ); - - for (int i = 0; i < iNumSovereign; ++i) - adblPI[i] *= dblInputDELTA; - - System.out.println(); - - for (int i = 0; i < iNumSovereign; ++i) - System.out.println ( - "\t{PI}[" + astrInputSovereign[i] + "] =>" + - FormatUtil.FormatDouble (adblPI[i], 1, 1, 100.) + "%" - ); - - System.out.println(); - - double[] adblPdotPI = Matrix.Product ( - aadblInputP, - adblPI - ); - - for (int i = 0; i < adblPdotPI.length; ++i) - System.out.println ( - "\t{P.PI}[" + i + "] =>" + - FormatUtil.FormatDouble (adblPdotPI[i], 1, 6, 1.) - ); - - System.out.println(); - - double[] adblQMinus_PdotPI_ = new double[adblInputQ.length]; - - for (int i = 0; i < adblInputQ.length; ++i) - adblQMinus_PdotPI_[i] = adblInputQ[i] - adblPdotPI[i]; - - for (int i = 0; i < adblQMinus_PdotPI_.length; ++i) - System.out.println ( - "\t{Q-P.PI}[" + i + "] =>" + - FormatUtil.FormatDouble (adblQMinus_PdotPI_[i], 1, 6, 1.) - ); - - System.out.println(); - - double[][] aadblPTranspose = Matrix.Transpose (aadblInputP); - - double[][] aadblSIGMAdot_Ptranspose_ = Matrix.Product ( - aadblSIGMA, - aadblPTranspose - ); - - for (int i = 0; i < aadblSIGMAdot_Ptranspose_.length; ++i) - for (int j = 0; j < aadblSIGMAdot_Ptranspose_[0].length; ++j) { - System.out.println ( - "\t{SIGMA.PTRANSPOSE}[" + i + "][" + j + "] =>" + - FormatUtil.FormatDouble (aadblSIGMAdot_Ptranspose_[i][j], 1, 6, 1.) - ); - } - - System.out.println(); - - double[][] aadblPdotSIGMAdot_PTranspose_ = Matrix.Product ( - aadblInputP, - aadblSIGMAdot_Ptranspose_ - ); - - for (int i = 0; i < aadblPdotSIGMAdot_PTranspose_.length; ++i) - for (int j = 0; j < aadblPdotSIGMAdot_PTranspose_[0].length; ++j) { - System.out.println ( - "\t{P.SIGMA.PTRANSPOSE}[" + i + "][" + j + "] =>" + - FormatUtil.FormatDouble (aadblPdotSIGMAdot_PTranspose_[i][j], 1, 6, 1.) - ); - } - - System.out.println(); - - double[][] aadblPdotSIGMAdot_PTranspose_plusOMEGA = new double[aadblPdotSIGMAdot_PTranspose_.length][aadblPdotSIGMAdot_PTranspose_[0].length]; - - for (int i = 0; i < aadblPdotSIGMAdot_PTranspose_plusOMEGA.length; ++i) - for (int j = 0; j < aadblPdotSIGMAdot_PTranspose_plusOMEGA[0].length; ++j) { - aadblPdotSIGMAdot_PTranspose_plusOMEGA[i][j] = aadblPdotSIGMAdot_PTranspose_[i][j] + aadblInputOmega[i][j]; - - System.out.println ( - "\t{P.SIGMA.PTRANSPOSE+OMEGA}[" + i + "][" + j + "] =>" + - FormatUtil.FormatDouble (aadblPdotSIGMAdot_PTranspose_plusOMEGA[i][j], 1, 6, 1.) - ); - } - - System.out.println(); - - double[][] aadbl$PdotSIGMAdot_PTranspose_plusOMEGA$inverse = Matrix.InvertUsingGaussianElimination (aadblPdotSIGMAdot_PTranspose_plusOMEGA); - - for (int i = 0; i < aadbl$PdotSIGMAdot_PTranspose_plusOMEGA$inverse.length; ++i) - for (int j = 0; j < aadbl$PdotSIGMAdot_PTranspose_plusOMEGA$inverse[0].length; ++j) { - System.out.println ( - "\t{P.SIGMA.PTRANSPOSE+OMEGA}^(-1)[" + i + "][" + j + "] =>" + - FormatUtil.FormatDouble (aadbl$PdotSIGMAdot_PTranspose_plusOMEGA$inverse[i][j], 1, 6, 1.) - ); - } - - System.out.println(); - - double[] aadbl__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dot_Qminus__PdotPI__ = Matrix.Product ( - aadbl$PdotSIGMAdot_PTranspose_plusOMEGA$inverse, - adblQMinus_PdotPI_ - ); - - for (int i = 0; i < aadbl__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dot_Qminus__PdotPI__.length; ++i) - System.out.println ( - "\t{P.SIGMA.PTRANSPOSE+OMEGA}^(-1).{Q-P.PI}[" + i + "] =>" + - FormatUtil.FormatDouble (aadbl__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dot_Qminus__PdotPI__[i], 1, 6, 1.) - ); - - System.out.println(); - - double[] aadblSIGMAdot$Ptranspose$__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dot_Qminus__PdotPI__ = Matrix.Product ( - aadblSIGMAdot_Ptranspose_, - aadbl__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dot_Qminus__PdotPI__ - ); - - for (int i = 0; i < aadblSIGMAdot$Ptranspose$__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dot_Qminus__PdotPI__.length; ++i) - System.out.println ( - "\t{SIGMA.PTRANSPOSE}{P.SIGMA.PTRANSPOSE+OMEGA}^(-1).{Q-P.PI}[" + i + "] =>" + - FormatUtil.FormatDouble (aadblSIGMAdot$Ptranspose$__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dot_Qminus__PdotPI__[i], 1, 6, 1.) - ); - - System.out.println(); - - double[] adblPIHAT = new double[adblPI.length]; - - for (int i = 0; i < adblPIHAT.length; ++i) { - adblPIHAT[i] = adblPI[i] + aadblSIGMAdot$Ptranspose$__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dot_Qminus__PdotPI__[i]; - - System.out.println ( - "\tPIHAT=PI+{SIGMA.PTRANSPOSE}{P.SIGMA.PTRANSPOSE+OMEGA}^(-1).{Q-P.PI}[" + i + "] =>" + - FormatUtil.FormatDouble (adblPIHAT[i], 1, 1, 100.) + "%" - ); - } - - System.out.println(); - - double[][] aadblPdotSIGMA = Matrix.Product ( - aadblInputP, - aadblSIGMA - ); - - for (int i = 0; i < aadblPdotSIGMA.length; ++i) - for (int j = 0; j < aadblPdotSIGMA[0].length; ++j) - System.out.println ( - "\tP.SIGMA[" + i + "][" + j + "] =>" + - FormatUtil.FormatDouble (aadblPdotSIGMA[i][j], 1, 6, 1.) - ); - - System.out.println(); - - double[][] aadbl__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA = Matrix.Product ( - aadbl$PdotSIGMAdot_PTranspose_plusOMEGA$inverse, - aadblPdotSIGMA - ); - - for (int i = 0; i < aadbl__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA.length; ++i) - for (int j = 0; j < aadbl__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA[0].length; ++j) - System.out.println ( - "\t{P.SIGMA.PTRANSPOSE+OMEGA}^(-1).{P.SIGMA}[" + i + "][" + j + "] =>" + - FormatUtil.FormatDouble (aadbl__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA[i][j], 1, 6, 1.) - ); - - System.out.println(); - - double[][] aadblSIGMAdot_Ptranspose_dot__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA = Matrix.Product ( - aadblSIGMAdot_Ptranspose_, - aadbl__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA - ); - - for (int i = 0; i < aadblSIGMAdot_Ptranspose_dot__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA.length; ++i) - for (int j = 0; j < aadblSIGMAdot_Ptranspose_dot__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA[0].length; ++j) - System.out.println ( - "\t{SIGMA.PTRANSPOSE}.{P.SIGMA.PTRANSPOSE+OMEGA}^(-1).{P.SIGMA}[" + i + "][" + j + "] =>" + - FormatUtil.FormatDouble (aadblSIGMAdot_Ptranspose_dot__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA[i][j], 1, 6, 1.) - ); - - System.out.println(); - - double[][] aadblSIGMAminusSIGMAdot_Ptranspose_dot__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA = new double[iNumSovereign][iNumSovereign]; - - for (int i = 0; i < aadblSIGMAminusSIGMAdot_Ptranspose_dot__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA.length; ++i) - for (int j = 0; j < aadblSIGMAminusSIGMAdot_Ptranspose_dot__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA[0].length; ++j) { - aadblSIGMAminusSIGMAdot_Ptranspose_dot__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA[i][j] = - aadblSIGMA[i][j] - aadblSIGMAdot_Ptranspose_dot__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA[i][j]; - - System.out.println ( - "\tSIGMA-{SIGMA.PTRANSPOSE}.{P.SIGMA.PTRANSPOSE+OMEGA}^(-1).{P.SIGMA}[" + i + "][" + j + "] =>" + - FormatUtil.FormatDouble (aadblSIGMAminusSIGMAdot_Ptranspose_dot__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA[i][j], 1, 6, 1.) - ); - } - - System.out.println(); - - double[][] aadblTAUdot$$SIGMAminusSIGMAdot_Ptranspose_dot__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA$$ = - new double[iNumSovereign][iNumSovereign]; - - for (int i = 0; i < aadblTAUdot$$SIGMAminusSIGMAdot_Ptranspose_dot__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA$$.length; ++i) - for (int j = 0; j < aadblTAUdot$$SIGMAminusSIGMAdot_Ptranspose_dot__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA$$[0].length; ++j) { - aadblTAUdot$$SIGMAminusSIGMAdot_Ptranspose_dot__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA$$[i][j] = - dblInputTAU * aadblSIGMAminusSIGMAdot_Ptranspose_dot__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA[i][j]; - - System.out.println ( - "\tTAU.(SIGMA-{SIGMA.PTRANSPOSE}.{P.SIGMA.PTRANSPOSE+OMEGA}^(-1).{P.SIGMA})[" + i + "][" + j + "] =>" + - FormatUtil.FormatDouble (aadblTAUdot$$SIGMAminusSIGMAdot_Ptranspose_dot__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA$$[i][j], 1, 6, 1.) - ); - } - - System.out.println(); - - double[][] aadblSIGMAplusTAUdot$$SIGMAminusSIGMAdot_Ptranspose_dot__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA$$ = - new double[iNumSovereign][iNumSovereign]; - - for (int i = 0; i < aadblSIGMAplusTAUdot$$SIGMAminusSIGMAdot_Ptranspose_dot__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA$$.length; ++i) - for (int j = 0; j < aadblSIGMAplusTAUdot$$SIGMAminusSIGMAdot_Ptranspose_dot__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA$$[0].length; ++j) { - aadblSIGMAplusTAUdot$$SIGMAminusSIGMAdot_Ptranspose_dot__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA$$[i][j] = - aadblSIGMA[i][j] + - aadblTAUdot$$SIGMAminusSIGMAdot_Ptranspose_dot__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA$$[i][j]; - - System.out.println ( - "\tSIGMA+TAU.(SIGMA-{SIGMA.PTRANSPOSE}.{P.SIGMA.PTRANSPOSE+OMEGA}^(-1).{P.SIGMA})[" + i + "][" + j + "] =>" + - FormatUtil.FormatDouble (aadblSIGMAplusTAUdot$$SIGMAminusSIGMAdot_Ptranspose_dot__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA$$[i][j], 1, 6, 1.) - ); - } - - System.out.println(); - - double[][] aadblSIGMAPInverse = Matrix.InvertUsingGaussianElimination (aadblSIGMAplusTAUdot$$SIGMAminusSIGMAdot_Ptranspose_dot__$PdotSIGMAdot_PTranspose_plusOMEGA$inverse__dotPdotSIGMA$$); - - for (int i = 0; i < aadblSIGMAPInverse.length; ++i) - for (int j = 0; j < aadblSIGMAPInverse[0].length; ++j) { - System.out.println ( - "\t[SIGMA+TAU.(SIGMA-{SIGMA.PTRANSPOSE}.{P.SIGMA.PTRANSPOSE+OMEGA}^(-1).{P.SIGMA})]^(-1)[" + i + "][" + j + "] =>" + - FormatUtil.FormatDouble (aadblSIGMAPInverse[i][j], 1, 6, 1.) - ); - } - - System.out.println(); - - double[] adblSIGMAPInversedotPIHAT = Matrix.Product ( - aadblSIGMAPInverse, - adblPIHAT - ); - - for (int i = 0; i < adblSIGMAPInversedotPIHAT.length; ++i) { - adblSIGMAPInversedotPIHAT[i] /= dblInputDELTA; - - System.out.println ( - "\t[SIGMA+TAU.(SIGMA-{SIGMA.PTRANSPOSE}.{P.SIGMA.PTRANSPOSE+OMEGA}^(-1).{P.SIGMA})]^(-1).PIHAT[" + i + "] =>" + - FormatUtil.FormatDouble (adblSIGMAPInversedotPIHAT[i], 1, 1, 100.) + "%" - ); - } - - System.out.println ("\n\n\t|----------------||"); - - System.out.println ("\t| EQUILIBRIUM ||"); - - System.out.println ("\t| RETURNS ||"); - - System.out.println ("\t|----------------||"); - - for (int i = 0; i < adblPI.length; ++i) { - System.out.println ( - "\t| [" + astrInputSovereign[i] + "] =>" + - FormatUtil.FormatDouble (adblPI[i], 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\n\n\t|----------------||"); - - System.out.println ("\t| BLACK LITERMAN ||"); - - System.out.println ("\t| RETURNS ||"); - - System.out.println ("\t|----------------||"); - - for (int i = 0; i < adblPIHAT.length; ++i) { - System.out.println ( - "\t| [" + astrInputSovereign[i] + "] =>" + - FormatUtil.FormatDouble (adblPIHAT[i], 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\t|----------------||"); - - System.out.println ("\t|----------------||"); - - System.out.println ("\n\n\t|-----------------||"); - - System.out.println ("\t| EQUILIBRIUM ||"); - - System.out.println ("\t| ALLOCATION ||"); - - System.out.println ("\t|-----------------||"); - - for (int i = 0; i < adblInputW.length; ++i) { - System.out.println ( - "\t| [" + astrInputSovereign[i] + "] => " + - FormatUtil.FormatDouble (adblInputW[i] / (1. + dblInputTAU), 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\t|-----------------||"); - - System.out.println ("\n\n\t|-----------------||"); - - System.out.println ("\t| BLACK LITERMAN ||"); - - System.out.println ("\t| ALLOCATION ||"); - - System.out.println ("\t|-----------------||"); - - for (int i = 0; i < adblSIGMAPInversedotPIHAT.length; ++i) { - System.out.println ( - "\t| [" + astrInputSovereign[i] + "] => " + - FormatUtil.FormatDouble (adblSIGMAPInversedotPIHAT[i], 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\t|-----------------||"); - - System.out.println ("\n\n\t|------------------||"); - - System.out.println ("\t| BLACK LITERMAN ||"); - - System.out.println ("\t| ALLOCATION SHIFT ||"); - - System.out.println ("\t|------------------||"); - - for (int i = 0; i < adblSIGMAPInversedotPIHAT.length; ++i) { - System.out.println ( - "\t| [" + astrInputSovereign[i] + "] => " + - FormatUtil.FormatDouble (adblSIGMAPInversedotPIHAT[i] - (adblInputW[i] / (1. + dblInputTAU)), 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------||"); - } -} diff --git a/org/drip/sample/helitterman/Table4Reconciler.java b/org/drip/sample/helitterman/Table4Reconciler.java deleted file mode 100644 index 8a4aa89..0000000 --- a/org/drip/sample/helitterman/Table4Reconciler.java +++ /dev/null @@ -1,500 +0,0 @@ - -package org.drip.sample.helitterman; - -import org.drip.measure.bayesian.JointPosteriorMetrics; -import org.drip.measure.continuousjoint.MultivariateMeta; -import org.drip.measure.gaussian.*; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.bayesian.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * Table4Reconciler reconciles the First Set of Outputs (Table #4) of the Black-Litterman Model Process as - * illustrated in the Following Paper: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * @author Lakshmi Krishnamurthy - */ - -public class Table4Reconciler { - - public static final void main ( - final String[] astArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetID = new String[] { - "AUS", - "CAD", - "FRA", - "GER", - "JPN", - "UK ", - "USA" - }; - - double[] adblAssetEquilibriumWeight = new double[] { - 0.016, - 0.022, - 0.052, - 0.055, - 0.116, - 0.124, - 0.615 - }; - - double[][] aadblAssetExcessReturnsCorrelation = new double[][] { - {1.000, 0.488, 0.478, 0.515, 0.439, 0.512, 0.491}, - {0.488, 1.000, 0.664, 0.655, 0.310, 0.608, 0.779}, - {0.478, 0.664, 1.000, 0.861, 0.355, 0.783, 0.668}, - {0.515, 0.655, 0.861, 1.000, 0.354, 0.777, 0.653}, - {0.439, 0.310, 0.355, 0.354, 1.000, 0.405, 0.306}, - {0.512, 0.608, 0.783, 0.777, 0.405, 1.000, 0.652}, - {0.491, 0.779, 0.668, 0.653, 0.306, 0.652, 1.000} - }; - - double[] adblAssetExcessReturnsVolatility = new double[] { - 0.160, - 0.203, - 0.248, - 0.271, - 0.210, - 0.200, - 0.187 - }; - - double[][] aadblAssetSpaceViewProjection = new double[][] { - {0.000, 0.000, -0.295, 1.000, 0.000, -0.705, 0.000} - }; - - double dblTau = 0.05; - double dblRiskAversion = 2.5; - double dblRiskFreeRate = 0.0; - - double[] adblProjectionExpectedExcessReturns = new double[] { - 0.05 - }; - - double[][] aadblProjectionExcessReturnsCovariance = new double[][] { - {0.021 * dblTau} - }; - - R1MultivariateNormal viewDistribution = R1MultivariateNormal.Standard ( - new MultivariateMeta (new String[] {"TABLE 4"}), - adblProjectionExpectedExcessReturns, - aadblProjectionExcessReturnsCovariance - ); - - double[] adblAssetSpaceJointReturnsReconciler = new double[] { - 0.043, - 0.076, - 0.093, - 0.110, - 0.045, - 0.070, - 0.081 - }; - - double[] adblPosteriorOptimalWeightsReconciler = new double[] { - 0.015, - 0.021, - -0.040, - 0.354, - 0.110, - -0.095, - 0.586 - }; - - double[] adblPosteriorOptimalDeviationReconciler = new double[] { - 0.000, - 0.000, - -0.089, - 0.302, - 0.000, - -0.213, - 0.000 - }; - - double[] adblBayesPELoadingsReconciler = new double[] { - 0.302 - }; - - double[][] aadblAssetExcessReturnsCovariance = new double[astrAssetID.length][astrAssetID.length]; - - for (int i = 0; i < astrAssetID.length; ++i) { - for (int j = 0; j < astrAssetID.length; ++j) - aadblAssetExcessReturnsCovariance[i][j] = aadblAssetExcessReturnsCorrelation[i][j] * - adblAssetExcessReturnsVolatility[i] * adblAssetExcessReturnsVolatility[j]; - } - - BlackLittermanCombinationEngine blce = new BlackLittermanCombinationEngine ( - ForwardReverseOptimizationOutput.Reverse ( - Portfolio.Standard ( - astrAssetID, - adblAssetEquilibriumWeight - ), - aadblAssetExcessReturnsCovariance, - dblRiskAversion - ), - new PriorControlSpecification ( - false, - dblRiskFreeRate, - dblTau - ), - new ProjectionSpecification ( - viewDistribution, - aadblAssetSpaceViewProjection - ) - ); - - JointPosteriorMetrics jpm = blce.customConfidenceRun().combinationMetrics(); - - R1MultivariateNormal jointDistribution = (R1MultivariateNormal) jpm.joint(); - - R1MultivariateNormal posteriorDistribution = (R1MultivariateNormal) jpm.posterior(); - - double[] adblAssetSpaceJointReturns = jointDistribution.mean(); - - double[][] aadblAssetSpaceJointCovariance = jointDistribution.covariance().covarianceMatrix(); - - double[][] aadblAssetSpacePosteriorCovariance = posteriorDistribution.covariance().covarianceMatrix(); - - OptimizationOutput op = new QuadraticMeanVarianceOptimizer().allocate ( - new PortfolioConstructionParameters ( - astrAssetID, - CustomRiskUtilitySettings.RiskAversion (dblRiskAversion), - PortfolioEqualityConstraintSettings.Unconstrained() - ), - AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetID, - posteriorDistribution.mean(), - aadblAssetSpacePosteriorCovariance - ) - ) - ); - - AssetComponent[] aAC = op.optimalPortfolio().assets(); - - ProjectionExposure pe = blce.projectionExposureAttribution(); - - double[] adblInterViewComponent = pe.interViewComponent(); - - double[] adblIntraViewComponent = pe.intraViewComponent(); - - double[] adblPriorViewComponent = pe.priorViewComponent(); - - double[] adblCumulativeComponent = pe.cumulativeViewComponent(); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| TAU => " + FormatUtil.FormatDouble (dblTau, 1, 8, 1.) + " ||"); - - System.out.println ("\t| DELTA => " + FormatUtil.FormatDouble (dblRiskFreeRate, 1, 8, 1.) + " ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| ASSET EXCESS RETURNS ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => EQ WT | VOL ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < adblAssetSpaceJointReturnsReconciler.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (adblAssetEquilibriumWeight[i], 2, 1, 100.) + "% |" + - FormatUtil.FormatDouble (adblAssetExcessReturnsVolatility[i], 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| PRIOR CROSS ASSET CORRELATION MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetExcessReturnsCorrelation[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| PRIOR CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetExcessReturnsCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| VIEW SCOPING ASSET PROJECTION LOADING ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < aadblAssetSpaceViewProjection.length; ++i) { - String strDump = "\t| #" + i + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpaceViewProjection[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < aadblAssetSpaceViewProjection.length; ++i) { - String strDump = "\t| #" + i + " "; - - for (int j = 0; j < aadblAssetSpaceViewProjection.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblProjectionExcessReturnsCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "|" + FormatUtil.FormatDouble (adblProjectionExpectedExcessReturns[i], 1, 2, 100.) + "%"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| JOINT CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpaceJointCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| POSTERIOR CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpacePosteriorCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| JOINT/POSTERIOR RETURN ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => RIOC | HL99 ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < adblAssetSpaceJointReturnsReconciler.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (adblAssetSpaceJointReturns[i], 2, 1, 100.) + "% |" + - FormatUtil.FormatDouble (adblAssetSpaceJointReturnsReconciler[i], 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| OPTIMAL POSTERIOR WTS. ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => RIOC | HL99 ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < aAC.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (aAC[i].amount(), 2, 1, 100.) + "% |" + - FormatUtil.FormatDouble (adblPosteriorOptimalWeightsReconciler[i], 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| POSTERIOR DEVIATION ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => RIOC | HL99 ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < aAC.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (aAC[i].amount() - (adblAssetEquilibriumWeight[i]) / (1. + dblTau), 2, 1, 100.) + "% |" + - FormatUtil.FormatDouble (adblPosteriorOptimalDeviationReconciler[i], 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||\n"); - - System.out.println ("\t|-----------------------------------------------------------------||"); - - System.out.println ("\t| POSTERIOR DEVIATION WEIGHTS ATTRIBUTION ||"); - - System.out.println ("\t|-----------------------------------------------------------------||"); - - System.out.println ("\t| VIEW NUM => INTRA | INTER | PRIOR | CUMUL | BAYES | RECON ||"); - - System.out.println ("\t|-----------------------------------------------------------------||"); - - for (int i = 0; i < adblInterViewComponent.length; ++i) - System.out.println ( - "\t| VIEW #" + (i + 1) + " => " + - FormatUtil.FormatDouble (adblInterViewComponent[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblIntraViewComponent[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblPriorViewComponent[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblCumulativeComponent[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblCumulativeComponent[i] / (1. + dblTau), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblBayesPELoadingsReconciler[i], 1, 3, 1.) + " ||" - ); - - System.out.println ("\t|-----------------------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/helitterman/Table5Reconciler.java b/org/drip/sample/helitterman/Table5Reconciler.java deleted file mode 100644 index 192b2c9..0000000 --- a/org/drip/sample/helitterman/Table5Reconciler.java +++ /dev/null @@ -1,509 +0,0 @@ - -package org.drip.sample.helitterman; - -import org.drip.measure.bayesian.JointPosteriorMetrics; -import org.drip.measure.continuousjoint.MultivariateMeta; -import org.drip.measure.gaussian.*; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.bayesian.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * Table5Reconciler reconciles the First Set of Outputs (Table #5) of the Black-Litterman Model Process as - * illustrated in the Following Paper: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * @author Lakshmi Krishnamurthy - */ - -public class Table5Reconciler { - - public static final void main ( - final String[] astArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetID = new String[] { - "AUS", - "CAD", - "FRA", - "GER", - "JPN", - "UK ", - "USA" - }; - - double[] adblAssetEquilibriumWeight = new double[] { - 0.016, - 0.022, - 0.052, - 0.055, - 0.116, - 0.124, - 0.615 - }; - - double[][] aadblAssetExcessReturnsCorrelation = new double[][] { - {1.000, 0.488, 0.478, 0.515, 0.439, 0.512, 0.491}, - {0.488, 1.000, 0.664, 0.655, 0.310, 0.608, 0.779}, - {0.478, 0.664, 1.000, 0.861, 0.355, 0.783, 0.668}, - {0.515, 0.655, 0.861, 1.000, 0.354, 0.777, 0.653}, - {0.439, 0.310, 0.355, 0.354, 1.000, 0.405, 0.306}, - {0.512, 0.608, 0.783, 0.777, 0.405, 1.000, 0.652}, - {0.491, 0.779, 0.668, 0.653, 0.306, 0.652, 1.000} - }; - - double[] adblAssetExcessReturnsVolatility = new double[] { - 0.160, - 0.203, - 0.248, - 0.271, - 0.210, - 0.200, - 0.187 - }; - - double[][] aadblAssetSpaceViewProjection = new double[][] { - {0.000, 0.000, -0.295, 1.000, 0.000, -0.705, 0.000}, - {0.000, 1.000, 0.000, 0.000, 0.000, 0.000, -1.000} - }; - - double dblTau = 0.05; - double dblRiskAversion = 2.5; - double dblRiskFreeRate = 0.0; - - double[] adblProjectionExpectedExcessReturns = new double[] { - 0.05, - 0.03 - }; - - double[][] aadblProjectionExcessReturnsCovariance = new double[][] { - {0.021 * dblTau, 0.000 * dblTau}, - {0.000 * dblTau, 0.017 * dblTau} - }; - - R1MultivariateNormal viewDistribution = R1MultivariateNormal.Standard ( - new MultivariateMeta ( - new String[] { - "PROJECTION #1", - "PROJECTION #2" - } - ), - adblProjectionExpectedExcessReturns, - aadblProjectionExcessReturnsCovariance - ); - - double[] adblAssetSpaceJointReturnsReconciler = new double[] { - 0.044, - 0.087, - 0.095, - 0.112, - 0.046, - 0.070, - 0.075 - }; - - double[] adblPosteriorOptimalWeightsReconciler = new double[] { - 0.015, - 0.419, - -0.034, - 0.336, - 0.110, - -0.082, - 0.188 - }; - - double[] adblPosteriorOptimalDeviationReconciler = new double[] { - 0.000, - 0.398, - -0.084, - 0.284, - 0.000, - -0.200, - -0.398 - }; - - double[] adblPELoadingsReconciler = new double[] { - 0.298, - 0.418 - }; - - double[][] aadblAssetExcessReturnsCovariance = new double[astrAssetID.length][astrAssetID.length]; - - for (int i = 0; i < astrAssetID.length; ++i) { - for (int j = 0; j < astrAssetID.length; ++j) - aadblAssetExcessReturnsCovariance[i][j] = aadblAssetExcessReturnsCorrelation[i][j] * - adblAssetExcessReturnsVolatility[i] * adblAssetExcessReturnsVolatility[j]; - } - - BlackLittermanCombinationEngine blce = new BlackLittermanCombinationEngine ( - ForwardReverseOptimizationOutput.Reverse ( - Portfolio.Standard ( - astrAssetID, - adblAssetEquilibriumWeight - ), - aadblAssetExcessReturnsCovariance, - dblRiskAversion - ), - new PriorControlSpecification ( - false, - dblRiskFreeRate, - dblTau - ), - new ProjectionSpecification ( - viewDistribution, - aadblAssetSpaceViewProjection - ) - ); - - JointPosteriorMetrics jpm = blce.customConfidenceRun().combinationMetrics(); - - R1MultivariateNormal jointDistribution = (R1MultivariateNormal) jpm.joint(); - - R1MultivariateNormal posteriorDistribution = (R1MultivariateNormal) jpm.posterior(); - - double[] adblAssetSpaceJointReturns = jointDistribution.mean(); - - double[][] aadblAssetSpaceJointCovariance = jointDistribution.covariance().covarianceMatrix(); - - double[][] aadblAssetSpacePosteriorCovariance = posteriorDistribution.covariance().covarianceMatrix(); - - OptimizationOutput op = new QuadraticMeanVarianceOptimizer().allocate ( - new PortfolioConstructionParameters ( - astrAssetID, - CustomRiskUtilitySettings.RiskAversion (dblRiskAversion), - PortfolioEqualityConstraintSettings.Unconstrained() - ), - AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetID, - posteriorDistribution.mean(), - aadblAssetSpacePosteriorCovariance - ) - ) - ); - - AssetComponent[] aAC = op.optimalPortfolio().assets(); - - ProjectionExposure pe = blce.projectionExposureAttribution(); - - double[] adblInterViewComponent = pe.interViewComponent(); - - double[] adblIntraViewComponent = pe.intraViewComponent(); - - double[] adblPriorViewComponent = pe.priorViewComponent(); - - double[] adblCumulativeComponent = pe.cumulativeViewComponent(); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| TAU => " + FormatUtil.FormatDouble (dblTau, 1, 8, 1.) + " ||"); - - System.out.println ("\t| DELTA => " + FormatUtil.FormatDouble (dblRiskAversion, 1, 8, 1.) + " ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| ASSET EXCESS RETURNS ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => EQ WT | VOL ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < adblAssetSpaceJointReturnsReconciler.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (adblAssetEquilibriumWeight[i], 2, 1, 100.) + "% |" + - FormatUtil.FormatDouble (adblAssetExcessReturnsVolatility[i], 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| PRIOR CROSS ASSET CORRELATION MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetExcessReturnsCorrelation[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| PRIOR CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetExcessReturnsCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| VIEW SCOPING ASSET PROJECTION LOADING ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < aadblAssetSpaceViewProjection.length; ++i) { - String strDump = "\t| #" + i + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpaceViewProjection[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < aadblAssetSpaceViewProjection.length; ++i) { - String strDump = "\t| #" + i + " "; - - for (int j = 0; j < aadblAssetSpaceViewProjection.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblProjectionExcessReturnsCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "|" + FormatUtil.FormatDouble (adblProjectionExpectedExcessReturns[i], 1, 2, 100.) + "%"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| JOINT CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpaceJointCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| POSTERIOR CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpacePosteriorCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| JOINT/POSTERIOR RETURN ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => RIOC | HL99 ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < adblAssetSpaceJointReturnsReconciler.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (adblAssetSpaceJointReturns[i], 2, 1, 100.) + "% |" + - FormatUtil.FormatDouble (adblAssetSpaceJointReturnsReconciler[i], 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| OPTIMAL POSTERIOR WTS. ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => RIOC | HL99 ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < aAC.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (aAC[i].amount(), 2, 1, 100.) + "% |" + - FormatUtil.FormatDouble (adblPosteriorOptimalWeightsReconciler[i], 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| POSTERIOR DEVIATION ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => RIOC | HL99 ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < aAC.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (aAC[i].amount() - (adblAssetEquilibriumWeight[i]) / (1. + dblTau), 2, 1, 100.) + "% |" + - FormatUtil.FormatDouble (adblPosteriorOptimalDeviationReconciler[i], 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||\n"); - - System.out.println ("\t|-----------------------------------------------------------------||"); - - System.out.println ("\t| POSTERIOR DEVIATION WEIGHTS ATTRIBUTION ||"); - - System.out.println ("\t|-----------------------------------------------------------------||"); - - System.out.println ("\t| VIEW NUM => INTRA | INTER | PRIOR | CUMUL | RECON | BAYES ||"); - - System.out.println ("\t|-----------------------------------------------------------------||"); - - for (int i = 0; i < adblInterViewComponent.length; ++i) - System.out.println ( - "\t| VIEW #" + (i + 1) + " => " + - FormatUtil.FormatDouble (adblInterViewComponent[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblIntraViewComponent[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblPriorViewComponent[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblCumulativeComponent[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblPELoadingsReconciler[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblCumulativeComponent[i] / (1. + dblTau), 1, 3, 1.) + " ||" - ); - - System.out.println ("\t|-----------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/helitterman/Table6Reconciler.java b/org/drip/sample/helitterman/Table6Reconciler.java deleted file mode 100644 index 76f23db..0000000 --- a/org/drip/sample/helitterman/Table6Reconciler.java +++ /dev/null @@ -1,509 +0,0 @@ - -package org.drip.sample.helitterman; - -import org.drip.measure.bayesian.JointPosteriorMetrics; -import org.drip.measure.continuousjoint.MultivariateMeta; -import org.drip.measure.gaussian.*; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.bayesian.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * Table6Reconciler reconciles the First Set of Outputs (Table #6) of the Black-Litterman Model Process as - * illustrated in the Following Paper: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * @author Lakshmi Krishnamurthy - */ - -public class Table6Reconciler { - - public static final void main ( - final String[] astArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetID = new String[] { - "AUS", - "CAD", - "FRA", - "GER", - "JPN", - "UK ", - "USA" - }; - - double[] adblAssetEquilibriumWeight = new double[] { - 0.016, - 0.022, - 0.052, - 0.055, - 0.116, - 0.124, - 0.615 - }; - - double[][] aadblAssetExcessReturnsCorrelation = new double[][] { - {1.000, 0.488, 0.478, 0.515, 0.439, 0.512, 0.491}, - {0.488, 1.000, 0.664, 0.655, 0.310, 0.608, 0.779}, - {0.478, 0.664, 1.000, 0.861, 0.355, 0.783, 0.668}, - {0.515, 0.655, 0.861, 1.000, 0.354, 0.777, 0.653}, - {0.439, 0.310, 0.355, 0.354, 1.000, 0.405, 0.306}, - {0.512, 0.608, 0.783, 0.777, 0.405, 1.000, 0.652}, - {0.491, 0.779, 0.668, 0.653, 0.306, 0.652, 1.000} - }; - - double[] adblAssetExcessReturnsVolatility = new double[] { - 0.160, - 0.203, - 0.248, - 0.271, - 0.210, - 0.200, - 0.187 - }; - - double[][] aadblAssetSpaceViewProjection = new double[][] { - {0.000, 0.000, -0.295, 1.000, 0.000, -0.705, 0.000}, - {0.000, 1.000, 0.000, 0.000, 0.000, 0.000, -1.000} - }; - - double dblTau = 0.05; - double dblRiskAversion = 2.5; - double dblRiskFreeRate = 0.0; - - double[] adblProjectionExpectedExcessReturns = new double[] { - 0.05, - 0.04 - }; - - double[][] aadblProjectionExcessReturnsCovariance = new double[][] { - {0.021 * dblTau, 0.000 * dblTau}, - {0.000 * dblTau, 0.017 * dblTau} - }; - - R1MultivariateNormal viewDistribution = R1MultivariateNormal.Standard ( - new MultivariateMeta ( - new String[] { - "PROJECTION #1", - "PROJECTION #2" - } - ), - adblProjectionExpectedExcessReturns, - aadblProjectionExcessReturnsCovariance - ); - - double[] adblAssetSpaceJointReturnsReconciler = new double[] { - 0.044, - 0.091, - 0.095, - 0.113, - 0.046, - 0.070, - 0.073 - }; - - double[] adblPosteriorOptimalWeightsReconciler = new double[] { - 0.015, - 0.533, - -0.033, - 0.331, - 0.110, - -0.078, - 0.073 - }; - - double[] adblPosteriorOptimalDeviationReconciler = new double[] { - 0.000, - 0.513, - -0.082, - 0.278, - 0.000, - -0.196, - -0.513 - }; - - double[] adblPELoadingsReconciler = new double[] { - 0.292, - 0.538 - }; - - double[][] aadblAssetExcessReturnsCovariance = new double[astrAssetID.length][astrAssetID.length]; - - for (int i = 0; i < astrAssetID.length; ++i) { - for (int j = 0; j < astrAssetID.length; ++j) - aadblAssetExcessReturnsCovariance[i][j] = aadblAssetExcessReturnsCorrelation[i][j] * - adblAssetExcessReturnsVolatility[i] * adblAssetExcessReturnsVolatility[j]; - } - - BlackLittermanCombinationEngine blce = new BlackLittermanCombinationEngine ( - ForwardReverseOptimizationOutput.Reverse ( - Portfolio.Standard ( - astrAssetID, - adblAssetEquilibriumWeight - ), - aadblAssetExcessReturnsCovariance, - dblRiskAversion - ), - new PriorControlSpecification ( - false, - dblRiskFreeRate, - dblTau - ), - new ProjectionSpecification ( - viewDistribution, - aadblAssetSpaceViewProjection - ) - ); - - JointPosteriorMetrics jpm = blce.customConfidenceRun().combinationMetrics(); - - R1MultivariateNormal jointDistribution = (R1MultivariateNormal) jpm.joint(); - - R1MultivariateNormal posteriorDistribution = (R1MultivariateNormal) jpm.posterior(); - - double[] adblAssetSpaceJointReturns = jointDistribution.mean(); - - double[][] aadblAssetSpaceJointCovariance = jointDistribution.covariance().covarianceMatrix(); - - double[][] aadblAssetSpacePosteriorCovariance = posteriorDistribution.covariance().covarianceMatrix(); - - OptimizationOutput op = new QuadraticMeanVarianceOptimizer().allocate ( - new PortfolioConstructionParameters ( - astrAssetID, - CustomRiskUtilitySettings.RiskAversion (dblRiskAversion), - PortfolioEqualityConstraintSettings.Unconstrained() - ), - AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetID, - posteriorDistribution.mean(), - aadblAssetSpacePosteriorCovariance - ) - ) - ); - - AssetComponent[] aAC = op.optimalPortfolio().assets(); - - ProjectionExposure pe = blce.projectionExposureAttribution(); - - double[] adblInterViewComponent = pe.interViewComponent(); - - double[] adblIntraViewComponent = pe.intraViewComponent(); - - double[] adblPriorViewComponent = pe.priorViewComponent(); - - double[] adblCumulativeComponent = pe.cumulativeViewComponent(); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| TAU => " + FormatUtil.FormatDouble (dblTau, 1, 8, 1.) + " ||"); - - System.out.println ("\t| DELTA => " + FormatUtil.FormatDouble (dblRiskAversion, 1, 8, 1.) + " ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| ASSET EXCESS RETURNS ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => EQ WT | VOL ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < adblAssetSpaceJointReturnsReconciler.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (adblAssetEquilibriumWeight[i], 2, 1, 100.) + "% |" + - FormatUtil.FormatDouble (adblAssetExcessReturnsVolatility[i], 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| PRIOR CROSS ASSET CORRELATION MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetExcessReturnsCorrelation[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| PRIOR CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetExcessReturnsCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| VIEW SCOPING ASSET PROJECTION LOADING ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < aadblAssetSpaceViewProjection.length; ++i) { - String strDump = "\t| #" + i + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpaceViewProjection[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < aadblAssetSpaceViewProjection.length; ++i) { - String strDump = "\t| #" + i + " "; - - for (int j = 0; j < aadblAssetSpaceViewProjection.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblProjectionExcessReturnsCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "|" + FormatUtil.FormatDouble (adblProjectionExpectedExcessReturns[i], 1, 2, 100.) + "%"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| JOINT CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpaceJointCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| POSTERIOR CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpacePosteriorCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| JOINT/POSTERIOR RETURN ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => RIOC | HL99 ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < adblAssetSpaceJointReturnsReconciler.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (adblAssetSpaceJointReturns[i], 2, 1, 100.) + "% |" + - FormatUtil.FormatDouble (adblAssetSpaceJointReturnsReconciler[i], 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| OPTIMAL POSTERIOR WTS. ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => RIOC | HL99 ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < aAC.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (aAC[i].amount(), 2, 1, 100.) + "% |" + - FormatUtil.FormatDouble (adblPosteriorOptimalWeightsReconciler[i], 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| POSTERIOR DEVIATION ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => RIOC | HL99 ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < aAC.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (aAC[i].amount() - (adblAssetEquilibriumWeight[i]) / (1. + dblTau), 2, 1, 100.) + "% |" + - FormatUtil.FormatDouble (adblPosteriorOptimalDeviationReconciler[i], 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||\n"); - - System.out.println ("\t|-----------------------------------------------------------------||"); - - System.out.println ("\t| POSTERIOR DEVIATION WEIGHTS ATTRIBUTION ||"); - - System.out.println ("\t|-----------------------------------------------------------------||"); - - System.out.println ("\t| VIEW NUM => INTRA | INTER | PRIOR | CUMUL | RECON | BAYES ||"); - - System.out.println ("\t|-----------------------------------------------------------------||"); - - for (int i = 0; i < adblInterViewComponent.length; ++i) - System.out.println ( - "\t| VIEW #" + (i + 1) + " => " + - FormatUtil.FormatDouble (adblInterViewComponent[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblIntraViewComponent[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblPriorViewComponent[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblCumulativeComponent[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblPELoadingsReconciler[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblCumulativeComponent[i] / (1. + dblTau), 1, 3, 1.) + " ||" - ); - - System.out.println ("\t|-----------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/helitterman/Table7Reconciler.java b/org/drip/sample/helitterman/Table7Reconciler.java deleted file mode 100644 index 0881da6..0000000 --- a/org/drip/sample/helitterman/Table7Reconciler.java +++ /dev/null @@ -1,509 +0,0 @@ - -package org.drip.sample.helitterman; - -import org.drip.measure.bayesian.JointPosteriorMetrics; -import org.drip.measure.continuousjoint.MultivariateMeta; -import org.drip.measure.gaussian.*; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.bayesian.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * Table7Reconciler reconciles the First Set of Outputs (Table #7) of the Black-Litterman Model Process as - * illustrated in the Following Paper: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * @author Lakshmi Krishnamurthy - */ - -public class Table7Reconciler { - - public static final void main ( - final String[] astArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetID = new String[] { - "AUS", - "CAD", - "FRA", - "GER", - "JPN", - "UK ", - "USA" - }; - - double[] adblAssetEquilibriumWeight = new double[] { - 0.016, - 0.022, - 0.052, - 0.055, - 0.116, - 0.124, - 0.615 - }; - - double[][] aadblAssetExcessReturnsCorrelation = new double[][] { - {1.000, 0.488, 0.478, 0.515, 0.439, 0.512, 0.491}, - {0.488, 1.000, 0.664, 0.655, 0.310, 0.608, 0.779}, - {0.478, 0.664, 1.000, 0.861, 0.355, 0.783, 0.668}, - {0.515, 0.655, 0.861, 1.000, 0.354, 0.777, 0.653}, - {0.439, 0.310, 0.355, 0.354, 1.000, 0.405, 0.306}, - {0.512, 0.608, 0.783, 0.777, 0.405, 1.000, 0.652}, - {0.491, 0.779, 0.668, 0.653, 0.306, 0.652, 1.000} - }; - - double[] adblAssetExcessReturnsVolatility = new double[] { - 0.160, - 0.203, - 0.248, - 0.271, - 0.210, - 0.200, - 0.187 - }; - - double[][] aadblAssetSpaceViewProjection = new double[][] { - {0.000, 0.000, -0.295, 1.000, 0.000, -0.705, 0.000}, - {0.000, 1.000, 0.000, 0.000, 0.000, 0.000, -1.000} - }; - - double dblTau = 0.05; - double dblRiskAversion = 2.5; - double dblRiskFreeRate = 0.0; - - double[] adblProjectionExpectedExcessReturns = new double[] { - 0.05, - 0.04 - }; - - double[][] aadblProjectionExcessReturnsCovariance = new double[][] { - {0.043 * dblTau, 0.000 * dblTau}, - {0.000 * dblTau, 0.017 * dblTau} - }; - - R1MultivariateNormal viewDistribution = R1MultivariateNormal.Standard ( - new MultivariateMeta ( - new String[] { - "PROJECTION #1", - "PROJECTION #2" - } - ), - adblProjectionExpectedExcessReturns, - aadblProjectionExcessReturnsCovariance - ); - - double[] adblAssetSpaceJointReturnsReconciler = new double[] { - 0.043, - 0.089, - 0.093, - 0.106, - 0.046, - 0.069, - 0.072 - }; - - double[] adblPosteriorOptimalWeightsReconciler = new double[] { - 0.015, - 0.539, - -0.005, - 0.236, - 0.110, - -0.011, - 0.068 - }; - - double[] adblPosteriorOptimalDeviationReconciler = new double[] { - 0.000, - 0.518, - -0.054, - 0.184, - 0.000, - -0.130, - -0.518 - }; - - double[] adblPELoadingsReconciler = new double[] { - 0.193, - 0.544 - }; - - double[][] aadblAssetExcessReturnsCovariance = new double[astrAssetID.length][astrAssetID.length]; - - for (int i = 0; i < astrAssetID.length; ++i) { - for (int j = 0; j < astrAssetID.length; ++j) - aadblAssetExcessReturnsCovariance[i][j] = aadblAssetExcessReturnsCorrelation[i][j] * - adblAssetExcessReturnsVolatility[i] * adblAssetExcessReturnsVolatility[j]; - } - - BlackLittermanCombinationEngine blce = new BlackLittermanCombinationEngine ( - ForwardReverseOptimizationOutput.Reverse ( - Portfolio.Standard ( - astrAssetID, - adblAssetEquilibriumWeight - ), - aadblAssetExcessReturnsCovariance, - dblRiskAversion - ), - new PriorControlSpecification ( - false, - dblRiskFreeRate, - dblTau - ), - new ProjectionSpecification ( - viewDistribution, - aadblAssetSpaceViewProjection - ) - ); - - JointPosteriorMetrics jpm = blce.customConfidenceRun().combinationMetrics(); - - R1MultivariateNormal jointDistribution = (R1MultivariateNormal) jpm.joint(); - - R1MultivariateNormal posteriorDistribution = (R1MultivariateNormal) jpm.posterior(); - - double[] adblAssetSpaceJointReturns = jointDistribution.mean(); - - double[][] aadblAssetSpaceJointCovariance = jointDistribution.covariance().covarianceMatrix(); - - double[][] aadblAssetSpacePosteriorCovariance = posteriorDistribution.covariance().covarianceMatrix(); - - OptimizationOutput op = new QuadraticMeanVarianceOptimizer().allocate ( - new PortfolioConstructionParameters ( - astrAssetID, - CustomRiskUtilitySettings.RiskAversion (dblRiskAversion), - PortfolioEqualityConstraintSettings.Unconstrained() - ), - AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetID, - posteriorDistribution.mean(), - aadblAssetSpacePosteriorCovariance - ) - ) - ); - - AssetComponent[] aAC = op.optimalPortfolio().assets(); - - ProjectionExposure pe = blce.projectionExposureAttribution(); - - double[] adblInterViewComponent = pe.interViewComponent(); - - double[] adblIntraViewComponent = pe.intraViewComponent(); - - double[] adblPriorViewComponent = pe.priorViewComponent(); - - double[] adblCumulativeComponent = pe.cumulativeViewComponent(); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| TAU => " + FormatUtil.FormatDouble (dblTau, 1, 8, 1.) + " ||"); - - System.out.println ("\t| DELTA => " + FormatUtil.FormatDouble (dblRiskAversion, 1, 8, 1.) + " ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| ASSET EXCESS RETURNS ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => EQ WT | VOL ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < adblAssetSpaceJointReturnsReconciler.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (adblAssetEquilibriumWeight[i], 2, 1, 100.) + "% |" + - FormatUtil.FormatDouble (adblAssetExcessReturnsVolatility[i], 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| PRIOR CROSS ASSET CORRELATION MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetExcessReturnsCorrelation[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| PRIOR CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetExcessReturnsCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| VIEW SCOPING ASSET PROJECTION LOADING ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < aadblAssetSpaceViewProjection.length; ++i) { - String strDump = "\t| #" + i + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpaceViewProjection[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < aadblAssetSpaceViewProjection.length; ++i) { - String strDump = "\t| #" + i + " "; - - for (int j = 0; j < aadblAssetSpaceViewProjection.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblProjectionExcessReturnsCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "|" + FormatUtil.FormatDouble (adblProjectionExpectedExcessReturns[i], 1, 2, 100.) + "%"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| JOINT CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpaceJointCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| POSTERIOR CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpacePosteriorCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| JOINT/POSTERIOR RETURN ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => RIOC | HL99 ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < adblAssetSpaceJointReturnsReconciler.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (adblAssetSpaceJointReturns[i], 2, 1, 100.) + "% |" + - FormatUtil.FormatDouble (adblAssetSpaceJointReturnsReconciler[i], 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| OPTIMAL POSTERIOR WTS. ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => RIOC | HL99 ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < aAC.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (aAC[i].amount(), 2, 1, 100.) + "% |" + - FormatUtil.FormatDouble (adblPosteriorOptimalWeightsReconciler[i], 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| POSTERIOR DEVIATION ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => RIOC | HL99 ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < aAC.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (aAC[i].amount() - (adblAssetEquilibriumWeight[i]) / (1. + dblTau), 2, 1, 100.) + "% |" + - FormatUtil.FormatDouble (adblPosteriorOptimalDeviationReconciler[i], 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||\n"); - - System.out.println ("\t|-----------------------------------------------------------------||"); - - System.out.println ("\t| POSTERIOR DEVIATION WEIGHTS ATTRIBUTION ||"); - - System.out.println ("\t|-----------------------------------------------------------------||"); - - System.out.println ("\t| VIEW NUM => INTRA | INTER | PRIOR | CUMUL | RECON | BAYES ||"); - - System.out.println ("\t|-----------------------------------------------------------------||"); - - for (int i = 0; i < adblInterViewComponent.length; ++i) - System.out.println ( - "\t| VIEW #" + (i + 1) + " => " + - FormatUtil.FormatDouble (adblInterViewComponent[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblIntraViewComponent[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblPriorViewComponent[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblCumulativeComponent[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblPELoadingsReconciler[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblCumulativeComponent[i] / (1. + dblTau), 1, 3, 1.) + " ||" - ); - - System.out.println ("\t|-----------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/helitterman/Table8Reconciler.java b/org/drip/sample/helitterman/Table8Reconciler.java deleted file mode 100644 index 2c6eed2..0000000 --- a/org/drip/sample/helitterman/Table8Reconciler.java +++ /dev/null @@ -1,514 +0,0 @@ - -package org.drip.sample.helitterman; - -import org.drip.measure.bayesian.JointPosteriorMetrics; -import org.drip.measure.continuousjoint.MultivariateMeta; -import org.drip.measure.gaussian.*; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.portfolioconstruction.allocator.*; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.bayesian.*; -import org.drip.portfolioconstruction.params.AssetUniverseStatisticalProperties; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * Table8Reconciler reconciles the First Set of Outputs (Table #8) of the Black-Litterman Model Process as - * illustrated in the Following Paper: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * @author Lakshmi Krishnamurthy - */ - -public class Table8Reconciler { - - public static final void main ( - final String[] astArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetID = new String[] { - "AUS", - "CAD", - "FRA", - "GER", - "JPN", - "UK ", - "USA" - }; - - double[] adblAssetEquilibriumWeight = new double[] { - 0.016, - 0.022, - 0.052, - 0.055, - 0.116, - 0.124, - 0.615 - }; - - double[][] aadblAssetExcessReturnsCorrelation = new double[][] { - {1.000, 0.488, 0.478, 0.515, 0.439, 0.512, 0.491}, - {0.488, 1.000, 0.664, 0.655, 0.310, 0.608, 0.779}, - {0.478, 0.664, 1.000, 0.861, 0.355, 0.783, 0.668}, - {0.515, 0.655, 0.861, 1.000, 0.354, 0.777, 0.653}, - {0.439, 0.310, 0.355, 0.354, 1.000, 0.405, 0.306}, - {0.512, 0.608, 0.783, 0.777, 0.405, 1.000, 0.652}, - {0.491, 0.779, 0.668, 0.653, 0.306, 0.652, 1.000} - }; - - double[] adblAssetExcessReturnsVolatility = new double[] { - 0.160, - 0.203, - 0.248, - 0.271, - 0.210, - 0.200, - 0.187 - }; - - double[][] aadblAssetSpaceViewProjection = new double[][] { - {0.000, 0.000, -0.295, 1.000, 0.000, -0.705, 0.000}, - {0.000, 1.000, 0.000, 0.000, 0.000, 0.000, -1.000}, - {0.000, 1.000, 0.000, 0.000, -1.000, 0.000, 0.000} - }; - - double dblTau = 0.05; - double dblRiskAversion = 2.5; - double dblRiskFreeRate = 0.0; - - double[] adblProjectionExpectedExcessReturns = new double[] { - 0.0500, - 0.0400, - 0.0412 - }; - - double[][] aadblProjectionExcessReturnsCovariance = new double[][] { - {0.043 * dblTau, 0.000 * dblTau, 0.000 * dblTau}, - {0.000 * dblTau, 0.017 * dblTau, 0.000 * dblTau}, - {0.000 * dblTau, 0.000 * dblTau, 0.059 * dblTau} - }; - - R1MultivariateNormal viewDistribution = R1MultivariateNormal.Standard ( - new MultivariateMeta ( - new String[] { - "PROJECTION #1", - "PROJECTION #2", - "PROJECTION #3" - } - ), - adblProjectionExpectedExcessReturns, - aadblProjectionExcessReturnsCovariance - ); - - double[] adblAssetSpaceJointReturnsReconciler = new double[] { - 0.043, - 0.089, - 0.093, - 0.106, - 0.046, - 0.069, - 0.072 - }; - - double[] adblPosteriorOptimalWeightsReconciler = new double[] { - 0.015, - 0.539, - -0.005, - 0.236, - 0.110, - -0.011, - 0.068 - }; - - double[] adblPosteriorOptimalDeviationReconciler = new double[] { - 0.000, - 0.518, - -0.054, - 0.184, - 0.000, - -0.130, - -0.518 - }; - - double[] adblPELoadingsReconciler = new double[] { - 0.193, - 0.544, - 0.000 - }; - - double[][] aadblAssetExcessReturnsCovariance = new double[astrAssetID.length][astrAssetID.length]; - - for (int i = 0; i < astrAssetID.length; ++i) { - for (int j = 0; j < astrAssetID.length; ++j) - aadblAssetExcessReturnsCovariance[i][j] = aadblAssetExcessReturnsCorrelation[i][j] * - adblAssetExcessReturnsVolatility[i] * adblAssetExcessReturnsVolatility[j]; - } - - BlackLittermanCombinationEngine blce = new BlackLittermanCombinationEngine ( - ForwardReverseOptimizationOutput.Reverse ( - Portfolio.Standard ( - astrAssetID, - adblAssetEquilibriumWeight - ), - aadblAssetExcessReturnsCovariance, - dblRiskAversion - ), - new PriorControlSpecification ( - false, - dblRiskFreeRate, - dblTau - ), - new ProjectionSpecification ( - viewDistribution, - aadblAssetSpaceViewProjection - ) - ); - - JointPosteriorMetrics jpm = blce.customConfidenceRun().combinationMetrics(); - - R1MultivariateNormal jointDistribution = (R1MultivariateNormal) jpm.joint(); - - R1MultivariateNormal posteriorDistribution = (R1MultivariateNormal) jpm.posterior(); - - double[] adblAssetSpaceJointReturns = jointDistribution.mean(); - - double[][] aadblAssetSpaceJointCovariance = jointDistribution.covariance().covarianceMatrix(); - - double[][] aadblAssetSpacePosteriorCovariance = posteriorDistribution.covariance().covarianceMatrix(); - - OptimizationOutput op = new QuadraticMeanVarianceOptimizer().allocate ( - new PortfolioConstructionParameters ( - astrAssetID, - CustomRiskUtilitySettings.RiskAversion (dblRiskAversion), - PortfolioEqualityConstraintSettings.Unconstrained() - ), - AssetUniverseStatisticalProperties.FromMultivariateMetrics ( - MultivariateMoments.Standard ( - astrAssetID, - posteriorDistribution.mean(), - aadblAssetSpacePosteriorCovariance - ) - ) - ); - - AssetComponent[] aAC = op.optimalPortfolio().assets(); - - ProjectionExposure pe = blce.projectionExposureAttribution(); - - double[] adblInterViewComponent = pe.interViewComponent(); - - double[] adblIntraViewComponent = pe.intraViewComponent(); - - double[] adblPriorViewComponent = pe.priorViewComponent(); - - double[] adblCumulativeComponent = pe.cumulativeViewComponent(); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| TAU => " + FormatUtil.FormatDouble (dblTau, 1, 8, 1.) + " ||"); - - System.out.println ("\t| DELTA => " + FormatUtil.FormatDouble (dblRiskAversion, 1, 8, 1.) + " ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| ASSET EXCESS RETURNS ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => EQ WT | VOL ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < adblAssetSpaceJointReturnsReconciler.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (adblAssetEquilibriumWeight[i], 2, 1, 100.) + "% |" + - FormatUtil.FormatDouble (adblAssetExcessReturnsVolatility[i], 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| PRIOR CROSS ASSET CORRELATION MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetExcessReturnsCorrelation[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| PRIOR CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetExcessReturnsCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| VIEW SCOPING ASSET PROJECTION LOADING ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < aadblAssetSpaceViewProjection.length; ++i) { - String strDump = "\t| #" + i + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpaceViewProjection[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < aadblAssetSpaceViewProjection.length; ++i) { - String strDump = "\t| #" + i + " "; - - for (int j = 0; j < aadblAssetSpaceViewProjection.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblProjectionExcessReturnsCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "|" + FormatUtil.FormatDouble (adblProjectionExpectedExcessReturns[i], 1, 2, 100.) + "%"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| JOINT CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpaceJointCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| POSTERIOR CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrAssetID.length; ++i) - strHeader += " " + astrAssetID[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpacePosteriorCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------||\n"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| JOINT/POSTERIOR RETURN ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => RIOC | HL99 ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < adblAssetSpaceJointReturnsReconciler.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (adblAssetSpaceJointReturns[i], 2, 1, 100.) + "% |" + - FormatUtil.FormatDouble (adblAssetSpaceJointReturnsReconciler[i], 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| OPTIMAL POSTERIOR WTS. ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => RIOC | HL99 ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < aAC.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (aAC[i].amount(), 2, 1, 100.) + "% |" + - FormatUtil.FormatDouble (adblPosteriorOptimalWeightsReconciler[i], 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\t|------------------------||"); - - System.out.println ("\t| POSTERIOR DEVIATION ||"); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\t| ID => RIOC | HL99 ||"); - - System.out.println ("\t|------------------------||"); - - for (int i = 0; i < aAC.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (aAC[i].amount() - (adblAssetEquilibriumWeight[i]) / (1. + dblTau), 2, 1, 100.) + "% |" + - FormatUtil.FormatDouble (adblPosteriorOptimalDeviationReconciler[i], 2, 1, 100.) + "% ||" - ); - } - - System.out.println ("\t|------------------------||\n"); - - System.out.println ("\t|-----------------------------------------------------------------||"); - - System.out.println ("\t| POSTERIOR DEVIATION WEIGHTS ATTRIBUTION ||"); - - System.out.println ("\t|-----------------------------------------------------------------||"); - - System.out.println ("\t| VIEW NUM => INTRA | INTER | PRIOR | CUMUL | RECON | BAYES ||"); - - System.out.println ("\t|-----------------------------------------------------------------||"); - - for (int i = 0; i < adblInterViewComponent.length; ++i) - System.out.println ( - "\t| VIEW #" + (i + 1) + " => " + - FormatUtil.FormatDouble (adblInterViewComponent[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblIntraViewComponent[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblPriorViewComponent[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblCumulativeComponent[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblPELoadingsReconciler[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (adblCumulativeComponent[i] / (1. + dblTau), 1, 3, 1.) + " ||" - ); - - System.out.println ("\t|-----------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/hjm/G2PlusPlusDynamics.java b/org/drip/sample/hjm/G2PlusPlusDynamics.java deleted file mode 100644 index 9c49ed7..0000000 --- a/org/drip/sample/hjm/G2PlusPlusDynamics.java +++ /dev/null @@ -1,221 +0,0 @@ - -package org.drip.sample.hjm; - -import org.drip.analytics.date.*; -import org.drip.dynamics.hjm.G2PlusPlus; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * G2PlusPlusDynamics demonstrates the Construction and Usage of the G2++ 2-Factor HJM Model Dynamics for the - * Evolution of the Short Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class G2PlusPlusDynamics { - - private static final G2PlusPlus G2PlusPlusEvolver ( - final double dblSigma, - final double dblA, - final double dblEta, - final double dblB, - final double dblRho, - final double dblStartingForwardRate) - throws Exception - { - return new G2PlusPlus ( - dblSigma, - dblA, - dblEta, - dblB, - new UnivariateSequenceGenerator[] { - new BoxMullerGaussian ( - 0., - 1. - ), - new BoxMullerGaussian ( - 0., - 1. - ) - }, - dblRho, - new FlatUnivariate (dblStartingForwardRate) - ); - } - - private static final void ShortRateEvolution ( - final G2PlusPlus g2pp, - final JulianDate dtStart, - final String strCurrency, - final String strViewTenor, - final double dblStartingShortRate) - throws Exception - { - int iDayStep = 2; - double dblX = 0.; - double dblY = 0.; - JulianDate dtSpot = dtStart; - double dblShortRate = dblStartingShortRate; - - int iStartDate = dtStart.julian(); - - int iEndDate = dtStart.addTenor (strViewTenor).julian(); - - System.out.println ("\t|-----------------------------------------------------------------------||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| G2++ - 2-factor HJM Model - Short Rate Evolution Run ||"); - - System.out.println ("\t|-----------------------------------------------------------------------||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| L->R: ||"); - - System.out.println ("\t| Date ||"); - - System.out.println ("\t| X (%) ||"); - - System.out.println ("\t| X - Increment (%) ||"); - - System.out.println ("\t| Y (%) ||"); - - System.out.println ("\t| Y - Increment (%) ||"); - - System.out.println ("\t| Phi (%) ||"); - - System.out.println ("\t| Short Rate (%) ||"); - - System.out.println ("\t|-----------------------------------------------------------------------||"); - - while (dtSpot.julian() < iEndDate) { - int iSpotDate = dtSpot.julian(); - - double dblDeltaX = g2pp.deltaX ( - iStartDate, - iSpotDate, - dblX, - iDayStep - ); - - dblX += dblDeltaX; - - double dblDeltaY = g2pp.deltaY ( - iStartDate, - iSpotDate, - dblY, - iDayStep - ); - - dblY += dblDeltaY; - - double dblPhi = g2pp.phi ( - iStartDate, - iSpotDate - ); - - dblShortRate = dblX + dblY + dblPhi; - - System.out.println ("\t| [" + dtSpot + "] = " + - FormatUtil.FormatDouble (dblX, 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblDeltaX, 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (dblY, 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblDeltaY, 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (dblPhi, 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (dblShortRate, 1, 2, 100.) + "% || " - ); - - dtSpot = dtSpot.addBusDays ( - iDayStep, - strCurrency - ); - } - - System.out.println ("\t|-----------------------------------------------------------------------||"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "USD"; - double dblStartingShortRate = 0.05; - double dblSigma = 0.05; - double dblA = 0.5; - double dblEta = 0.05; - double dblB = 0.5; - double dblRho = 0.5; - - G2PlusPlus g2pp = G2PlusPlusEvolver ( - dblSigma, - dblA, - dblEta, - dblB, - dblRho, - dblStartingShortRate - ); - - ShortRateEvolution ( - g2pp, - dtSpot, - strCurrency, - "4M", - dblStartingShortRate - ); - } -} diff --git a/org/drip/sample/hjm/MultiFactorDynamics.java b/org/drip/sample/hjm/MultiFactorDynamics.java deleted file mode 100644 index 2f8434f..0000000 --- a/org/drip/sample/hjm/MultiFactorDynamics.java +++ /dev/null @@ -1,380 +0,0 @@ - -package org.drip.sample.hjm; - -import org.drip.analytics.date.*; -import org.drip.analytics.definition.MarketSurface; -import org.drip.dynamics.hjm.*; -import org.drip.function.definition.R1ToR1; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.ScenarioMarketSurfaceBuilder; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * MultiFactorDynamics demonstrates the Construction and Usage of the Multi-Factor Gaussian Model Dynamics - * for the Evolution of the Instantaneous Forward Rate, the Price, and the Short Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class MultiFactorDynamics { - - private static final MarketSurface FlatVolatilitySurface ( - final JulianDate dtStart, - final String strCurrency, - final double dblFlatVol) - throws Exception - { - return ScenarioMarketSurfaceBuilder.CustomSplineWireSurface ( - "VIEW_TARGET_VOLATILITY_SURFACE", - dtStart, - strCurrency, - new double[] { - dtStart.julian(), - dtStart.addYears (2).julian(), - dtStart.addYears (4).julian(), - dtStart.addYears (6).julian(), - dtStart.addYears (8).julian(), - dtStart.addYears (10).julian() - }, - new double[] { - dtStart.julian(), - dtStart.addYears (2).julian(), - dtStart.addYears (4).julian(), - dtStart.addYears (6).julian(), - dtStart.addYears (8).julian(), - dtStart.addYears (10).julian() - }, - new double[][] { - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - }, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ), - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ) - ); - } - - private static final MultiFactorStateEvolver HJMInstance ( - final JulianDate dtStart, - final String strCurrency, - final MarketSurface mktSurfFlatVol1, - final MarketSurface mktSurfFlatVol2, - final MarketSurface mktSurfFlatVol3, - final R1ToR1 auForwardRate) - throws Exception - { - MultiFactorVolatility mfv = new MultiFactorVolatility ( - new MarketSurface[] { - mktSurfFlatVol1, - mktSurfFlatVol2, - mktSurfFlatVol3 - }, - new PrincipalFactorSequenceGenerator ( - new UnivariateSequenceGenerator[] { - new BoxMullerGaussian ( - 0., - 1. - ), - new BoxMullerGaussian ( - 0., - 1. - ), - new BoxMullerGaussian ( - 0., - 1. - ) - }, - new double[][] { - {1.0, 0.1, 0.2}, - {0.1, 1.0, 0.2}, - {0.2, 0.1, 1.0} - }, - 3 - ) - ); - - return new MultiFactorStateEvolver ( - FundingLabel.Standard (strCurrency), - ForwardLabel.Create ( - strCurrency, - "6M" - ), - mfv, - auForwardRate - ); - } - - private static final void Evolve ( - final MultiFactorStateEvolver hjm, - final JulianDate dtStart, - final String strCurrency, - final String strViewTenor, - final String strTargetTenor, - final double dblStartingForwardRate, - final double dblStartingPrice) - throws Exception - { - int iViewDate = dtStart.addTenor (strViewTenor).julian(); - - int iTargetDate = dtStart.addTenor (strTargetTenor).julian(); - - int iDayStep = 2; - JulianDate dtSpot = dtStart; - double dblPrice = dblStartingPrice; - double dblShortRate = dblStartingForwardRate; - double dblLIBORForwardRate = dblStartingForwardRate; - double dblInstantaneousForwardRate = dblStartingForwardRate; - double dblContinuouslyCompoundedShortRate = dblStartingForwardRate; - double dblShiftedLIBORForwardRate = dblStartingForwardRate + (365.25 / (iTargetDate - iViewDate)); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| Heath-Jarrow-Morton Gaussian Run ||"); - - System.out.println ("\t| -------------------------------- ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| L->R: ||"); - - System.out.println ("\t| Date ||"); - - System.out.println ("\t| Instantaneous Forward Rate (%) ||"); - - System.out.println ("\t| Instantaneous Forward Rate - Change (%) ||"); - - System.out.println ("\t| LIBOR Forward Rate (%) ||"); - - System.out.println ("\t| LIBOR Forward Rate - Change (%) ||"); - - System.out.println ("\t| Shifted LIBOR Forward Rate (%) ||"); - - System.out.println ("\t| Shifted LIBOR Forward Rate - Change (%) ||"); - - System.out.println ("\t| Short Rate (%) ||"); - - System.out.println ("\t| Short Rate - Change (%) ||"); - - System.out.println ("\t| Continuously Compounded Short Rate (%) ||"); - - System.out.println ("\t| Continuously Compounded Short Rate - Change (%) ||"); - - System.out.println ("\t| Price ||"); - - System.out.println ("\t| Price - Change ||"); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------||"); - - while (dtSpot.julian() < iViewDate) { - int iSpotDate = dtSpot.julian(); - - double dblIFRIncrement = hjm.instantaneousForwardRateIncrement ( - iViewDate, - iTargetDate, - iDayStep - ); - - dblInstantaneousForwardRate += dblIFRIncrement; - - double dblLIBORForwardRateIncrement = hjm.liborForwardRateIncrement ( - iSpotDate, - iViewDate, - iTargetDate, - dblLIBORForwardRate, - iDayStep - ); - - dblLIBORForwardRate += dblLIBORForwardRateIncrement; - - double dblShiftedLIBORForwardRateIncrement = hjm.shiftedLIBORForwardIncrement ( - iSpotDate, - iViewDate, - iTargetDate, - dblShiftedLIBORForwardRate, - iDayStep - ); - - dblShiftedLIBORForwardRate += dblShiftedLIBORForwardRateIncrement; - - double dblShortRateIncrement = hjm.shortRateIncrement ( - iSpotDate, - iViewDate, - iDayStep - ); - - dblShortRate += dblShortRateIncrement; - - double dblProportionalPriceIncrement = hjm.proportionalPriceIncrement ( - iViewDate, - iTargetDate, - dblShortRate, - iDayStep - ); - - dblPrice *= (1. + dblProportionalPriceIncrement); - - double dblContinuouslyCompoundedShortRateIncrement = hjm.compoundedShortRateIncrement ( - iSpotDate, - iViewDate, - iTargetDate, - dblContinuouslyCompoundedShortRate, - dblShortRate, - iDayStep - ); - - dblContinuouslyCompoundedShortRate += dblContinuouslyCompoundedShortRateIncrement; - - System.out.println ("\t| [" + dtSpot + "] = " + - FormatUtil.FormatDouble (dblInstantaneousForwardRate, 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblIFRIncrement, 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (dblLIBORForwardRate, 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblLIBORForwardRateIncrement, 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (dblShiftedLIBORForwardRate, 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (dblShiftedLIBORForwardRateIncrement, 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (dblShortRate, 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblShortRateIncrement, 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (dblContinuouslyCompoundedShortRate, 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblContinuouslyCompoundedShortRateIncrement, 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (dblPrice, 2, 2, 100.) + " | " + - FormatUtil.FormatDouble (dblProportionalPriceIncrement, 1, 2, 100.) + " || " - ); - - dtSpot = dtSpot.addBusDays ( - iDayStep, - strCurrency - ); - } - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------||"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - - JulianDate dtSpot = DateUtil.Today(); - - double dblFlatVol1 = 0.01; - double dblFlatVol2 = 0.02; - double dblFlatVol3 = 0.03; - double dblFlatForwardRate = 0.05; - double dblStartingPrice = 0.9875; - - MarketSurface mktSurfFlatVol1 = FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol1 - ); - - MarketSurface mktSurfFlatVol2 = FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol2 - ); - - MarketSurface mktSurfFlatVol3 = FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol3 - ); - - MultiFactorStateEvolver hjm = HJMInstance ( - dtSpot, - strCurrency, - mktSurfFlatVol1, - mktSurfFlatVol2, - mktSurfFlatVol3, - new FlatUnivariate (dblFlatForwardRate) - ); - - Evolve ( - hjm, - dtSpot, - strCurrency, - "3M", - "6M", - dblFlatForwardRate, - dblStartingPrice - ); - } -} diff --git a/org/drip/sample/hjm/MultiFactorQMDynamics.java b/org/drip/sample/hjm/MultiFactorQMDynamics.java deleted file mode 100644 index 38540ef..0000000 --- a/org/drip/sample/hjm/MultiFactorQMDynamics.java +++ /dev/null @@ -1,367 +0,0 @@ - -package org.drip.sample.hjm; - -import org.drip.analytics.date.*; -import org.drip.analytics.definition.MarketSurface; -import org.drip.analytics.support.Helper; -import org.drip.dynamics.hjm.*; -import org.drip.function.definition.R1ToR1; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.ScenarioMarketSurfaceBuilder; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * MultiFactorQMDynamics demonstrates the Construction and Usage of the 3-Factor Gaussian Model Dynamics for - * the Evolution of the Discount Factor Quantification Metrics - the Instantaneous Forward Rate, the LIBOR - * Forward Rate, the Shifted LIBOR Forward Rate, the Short Rate, the Compounded Short Rate, and the Price. - * - * @author Lakshmi Krishnamurthy - */ - -public class MultiFactorQMDynamics { - - private static final MarketSurface FlatVolatilitySurface ( - final JulianDate dtStart, - final String strCurrency, - final double dblFlatVol) - throws Exception - { - return ScenarioMarketSurfaceBuilder.CustomSplineWireSurface ( - "VIEW_TARGET_VOLATILITY_SURFACE", - dtStart, - strCurrency, - new double[] { - dtStart.julian(), - dtStart.addYears (2).julian(), - dtStart.addYears (4).julian(), - dtStart.addYears (6).julian(), - dtStart.addYears (8).julian(), - dtStart.addYears (10).julian() - }, - new double[] { - dtStart.julian(), - dtStart.addYears (2).julian(), - dtStart.addYears (4).julian(), - dtStart.addYears (6).julian(), - dtStart.addYears (8).julian(), - dtStart.addYears (10).julian() - }, - new double[][] { - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - }, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ), - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ) - ); - } - - private static final MultiFactorStateEvolver HJMInstance ( - final JulianDate dtStart, - final String strCurrency, - final String strTenor, - final MarketSurface mktSurfFlatVol1, - final MarketSurface mktSurfFlatVol2, - final MarketSurface mktSurfFlatVol3, - final R1ToR1 auForwardRate) - throws Exception - { - MultiFactorVolatility mfv = new MultiFactorVolatility ( - new MarketSurface[] { - mktSurfFlatVol1, - mktSurfFlatVol2, - mktSurfFlatVol3 - }, - new PrincipalFactorSequenceGenerator ( - new UnivariateSequenceGenerator[] { - new BoxMullerGaussian ( - 0., - 1. - ), - new BoxMullerGaussian ( - 0., - 1. - ), - new BoxMullerGaussian ( - 0., - 1. - ) - }, - new double[][] { - {1.0, 0.1, 0.2}, - {0.1, 1.0, 0.2}, - {0.2, 0.1, 1.0} - }, - 3 - ) - ); - - return new MultiFactorStateEvolver ( - FundingLabel.Standard (strCurrency), - ForwardLabel.Create ( - strCurrency, - strTenor - ), - mfv, - auForwardRate - ); - } - - private static final ShortForwardRateUpdate InitQMSnap ( - final JulianDate dtStart, - final String strCurrency, - final String strViewTenor, - final String strTenor, - final double dblInitialForwardRate, - final double dblInitialPrice) - throws Exception - { - return ShortForwardRateUpdate.Create ( - FundingLabel.Standard (strCurrency), - ForwardLabel.Create ( - strCurrency, - strTenor - ), - dtStart.julian(), - dtStart.julian(), - dtStart.addTenor (strViewTenor).julian(), - dblInitialForwardRate, - 0., - dblInitialForwardRate, - 0., - dblInitialForwardRate + (365.25 / Helper.TenorToDays (strTenor)), - 0., - dblInitialForwardRate, - 0., - dblInitialForwardRate, - 0., - dblInitialPrice, - 0. - ); - } - - private static final void QMEvolution ( - final MultiFactorStateEvolver hjm, - final JulianDate dtStart, - final String strCurrency, - final String strViewTenor, - final ShortForwardRateUpdate qmInitial) - throws Exception - { - int iViewDate = dtStart.addTenor (strViewTenor).julian(); - - int iDayStep = 2; - ShortForwardRateUpdate qm = qmInitial; - JulianDate dtSpot = dtStart; - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| 3-Factor Gaussian HJM Quantification Metric Run ||"); - - System.out.println ("\t| ----------------------------------------------- ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| L->R: ||"); - - System.out.println ("\t| Date ||"); - - System.out.println ("\t| Instantaneous Forward Rate (%) ||"); - - System.out.println ("\t| Instantaneous Forward Rate - Change (%) ||"); - - System.out.println ("\t| LIBOR Forward Rate (%) ||"); - - System.out.println ("\t| LIBOR Forward Rate - Change (%) ||"); - - System.out.println ("\t| Shifted LIBOR Forward Rate (%) ||"); - - System.out.println ("\t| Shifted LIBOR Forward Rate - Change (%) ||"); - - System.out.println ("\t| Short Rate (%) ||"); - - System.out.println ("\t| Short Rate - Change (%) ||"); - - System.out.println ("\t| Continuously Compounded Short Rate (%) ||"); - - System.out.println ("\t| Continuously Compounded Short Rate - Change (%) ||"); - - System.out.println ("\t| Price ||"); - - System.out.println ("\t| Price - Change ||"); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------||"); - - while (dtSpot.julian() < iViewDate) { - int iSpotDate = dtSpot.julian(); - - qm = (ShortForwardRateUpdate) hjm.evolve ( - iSpotDate, - iViewDate, - iDayStep, - qm - ); - - System.out.println ("\t| [" + dtSpot + "] = " + - FormatUtil.FormatDouble (qm.instantaneousForwardRate(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (qm.instantaneousForwardRateIncrement(), 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (qm.liborForwardRate(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (qm.liborForwardRateIncrement(), 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (qm.shiftedLIBORForwardRate(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (qm.shiftedLIBORForwardRateIncrement(), 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (qm.shortRate(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (qm.shortRateIncrement(), 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (qm.compoundedShortRate(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (qm.compoundedShortRateIncrement(), 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (qm.price(), 2, 2, 100.) + " | " + - FormatUtil.FormatDouble (qm.priceIncrement(), 1, 2, 100.) + " || " - ); - - dtSpot = dtSpot.addBusDays ( - iDayStep, - strCurrency - ); - } - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------||"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - double dblFlatVol1 = 0.007; - double dblFlatVol2 = 0.009; - double dblFlatVol3 = 0.004; - double dblFlatForwardRate = 0.05; - double dblInitialPrice = 0.9875; - String strViewTenor = "3M"; - String strTenor = "6M"; - - JulianDate dtSpot = DateUtil.Today(); - - MarketSurface mktSurfFlatVol1 = FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol1 - ); - - MarketSurface mktSurfFlatVol2 = FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol2 - ); - - MarketSurface mktSurfFlatVol3 = FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol3 - ); - - MultiFactorStateEvolver hjm = HJMInstance ( - dtSpot, - strCurrency, - strTenor, - mktSurfFlatVol1, - mktSurfFlatVol2, - mktSurfFlatVol3, - new FlatUnivariate (dblFlatForwardRate) - ); - - ShortForwardRateUpdate qmInitial = InitQMSnap ( - dtSpot, - strCurrency, - strViewTenor, - strTenor, - dblFlatForwardRate, - dblInitialPrice - ); - - QMEvolution ( - hjm, - dtSpot, - strCurrency, - strViewTenor, - qmInitial - ); - } -} diff --git a/org/drip/sample/hjm/PrincipalComponentDynamics.java b/org/drip/sample/hjm/PrincipalComponentDynamics.java deleted file mode 100644 index 20d47b8..0000000 --- a/org/drip/sample/hjm/PrincipalComponentDynamics.java +++ /dev/null @@ -1,389 +0,0 @@ - -package org.drip.sample.hjm; - -import org.drip.analytics.date.*; -import org.drip.analytics.definition.MarketSurface; -import org.drip.dynamics.hjm.*; -import org.drip.function.definition.R1ToR1; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.ScenarioMarketSurfaceBuilder; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * PrincipalComponentDynamics demonstrates the Construction and Usage of the PCA-Based Multi-Factor Gaussian - * Model Dynamics for the Evolution of the Instantaneous Forward Rate, the Price, and the Short Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class PrincipalComponentDynamics { - - private static final MarketSurface FlatVolatilitySurface ( - final JulianDate dtStart, - final String strCurrency, - final double dblFlatVol) - throws Exception - { - return ScenarioMarketSurfaceBuilder.CustomSplineWireSurface ( - "VIEW_TARGET_VOLATILITY_SURFACE", - dtStart, - strCurrency, - new double[] { - dtStart.julian(), - dtStart.addYears (2).julian(), - dtStart.addYears (4).julian(), - dtStart.addYears (6).julian(), - dtStart.addYears (8).julian(), - dtStart.addYears (10).julian() - }, - new double[] { - dtStart.julian(), - dtStart.addYears (2).julian(), - dtStart.addYears (4).julian(), - dtStart.addYears (6).julian(), - dtStart.addYears (8).julian(), - dtStart.addYears (10).julian() - }, - new double[][] { - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - }, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ), - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ) - ); - } - - private static final MultiFactorStateEvolver HJMInstance ( - final JulianDate dtStart, - final String strCurrency, - final MarketSurface mktSurfFlatVol1, - final MarketSurface mktSurfFlatVol2, - final MarketSurface mktSurfFlatVol3, - final R1ToR1 auForwardRate, - final int iNumFactor) - throws Exception - { - MultiFactorVolatility mfv = new MultiFactorVolatility ( - new MarketSurface[] { - mktSurfFlatVol1, - mktSurfFlatVol2, - mktSurfFlatVol3 - }, - new PrincipalFactorSequenceGenerator ( - new UnivariateSequenceGenerator[] { - new BoxMullerGaussian ( - 0., - 1. - ), - new BoxMullerGaussian ( - 0., - 1. - ), - new BoxMullerGaussian ( - 0., - 1. - ) - }, - new double[][] { - {1.0, 0.1, 0.2}, - {0.1, 1.0, 0.2}, - {0.2, 0.1, 1.0} - }, - iNumFactor - ) - ); - - return new MultiFactorStateEvolver ( - FundingLabel.Standard (strCurrency), - ForwardLabel.Create ( - strCurrency, - "6M" - ), - mfv, - auForwardRate - ); - } - - private static final void Evolve ( - final MultiFactorStateEvolver hjm, - final JulianDate dtStart, - final String strCurrency, - final String strViewTenor, - final String strTargetTenor, - final double dblStartingForwardRate, - final double dblStartingPrice) - throws Exception - { - int iViewDate = dtStart.addTenor (strViewTenor).julian(); - - int iTargetDate = dtStart.addTenor (strTargetTenor).julian(); - - int iDayStep = 2; - JulianDate dtSpot = dtStart; - double dblPrice = dblStartingPrice; - double dblShortRate = dblStartingForwardRate; - double dblLIBORForwardRate = dblStartingForwardRate; - double dblInstantaneousForwardRate = dblStartingForwardRate; - double dblContinuouslyCompoundedShortRate = dblStartingForwardRate; - double dblShiftedLIBORForwardRate = dblStartingForwardRate + (365.25 / (iTargetDate - iViewDate)); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| Multi-Factor PCA-Based Gaussian HJM Run ||"); - - System.out.println ("\t| --------------------------------------- ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| Number of Prinicipal Components: " + hjm.mfv().msg().numFactor() + " ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| L->R: ||"); - - System.out.println ("\t| Date ||"); - - System.out.println ("\t| Instantaneous Forward Rate (%) ||"); - - System.out.println ("\t| Instantaneous Forward Rate - Change (%) ||"); - - System.out.println ("\t| LIBOR Forward Rate (%) ||"); - - System.out.println ("\t| LIBOR Forward Rate - Change (%) ||"); - - System.out.println ("\t| Shifted LIBOR Forward Rate (%) ||"); - - System.out.println ("\t| Shifted LIBOR Forward Rate - Change (%) ||"); - - System.out.println ("\t| Short Rate (%) ||"); - - System.out.println ("\t| Short Rate - Change (%) ||"); - - System.out.println ("\t| Continuously Compounded Short Rate (%) ||"); - - System.out.println ("\t| Continuously Compounded Short Rate - Change (%) ||"); - - System.out.println ("\t| Price ||"); - - System.out.println ("\t| Price - Change ||"); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------||"); - - while (dtSpot.julian() < iViewDate) { - int iSpotDate = dtSpot.julian(); - - double dblIFRIncrement = hjm.instantaneousForwardRateIncrement ( - iViewDate, - iTargetDate, - iDayStep - ); - - dblInstantaneousForwardRate += dblIFRIncrement; - - double dblLIBORForwardRateIncrement = hjm.liborForwardRateIncrement ( - iSpotDate, - iViewDate, - iTargetDate, - dblLIBORForwardRate, - iDayStep - ); - - dblLIBORForwardRate += dblLIBORForwardRateIncrement; - - double dblShiftedLIBORForwardRateIncrement = hjm.shiftedLIBORForwardIncrement ( - iSpotDate, - iViewDate, - iTargetDate, - dblShiftedLIBORForwardRate, - iDayStep - ); - - dblShiftedLIBORForwardRate += dblShiftedLIBORForwardRateIncrement; - - double dblShortRateIncrement = hjm.shortRateIncrement ( - iSpotDate, - iViewDate, - iDayStep - ); - - dblShortRate += dblShortRateIncrement; - - double dblProportionalPriceIncrement = hjm.proportionalPriceIncrement ( - iSpotDate, - iViewDate, - dblShortRate, - iDayStep - ); - - dblPrice *= (1. + dblProportionalPriceIncrement); - - double dblContinuouslyCompoundedShortRateIncrement = hjm.compoundedShortRateIncrement ( - iSpotDate, - iViewDate, - iTargetDate, - dblContinuouslyCompoundedShortRate, - dblShortRate, - iDayStep - ); - - dblContinuouslyCompoundedShortRate += dblContinuouslyCompoundedShortRateIncrement; - - System.out.println ("\t| [" + dtSpot + "] = " + - FormatUtil.FormatDouble (dblInstantaneousForwardRate, 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblIFRIncrement, 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (dblLIBORForwardRate, 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblLIBORForwardRateIncrement, 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (dblShiftedLIBORForwardRate, 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (dblShiftedLIBORForwardRateIncrement, 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (dblShortRate, 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblShortRateIncrement, 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (dblContinuouslyCompoundedShortRate, 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblContinuouslyCompoundedShortRateIncrement, 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (dblPrice, 2, 2, 100.) + " | " + - FormatUtil.FormatDouble (dblProportionalPriceIncrement, 1, 2, 100.) + " || " - ); - - dtSpot = dtSpot.addBusDays (iDayStep, strCurrency); - } - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------||"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - - JulianDate dtSpot = DateUtil.Today(); - - double dblFlatVol1 = 0.01; - double dblFlatVol2 = 0.02; - double dblFlatVol3 = 0.03; - double dblFlatForwardRate = 0.05; - double dblStartingPrice = 0.9875; - - MarketSurface mktSurfFlatVol1 = FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol1 - ); - - MarketSurface mktSurfFlatVol2 = FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol2 - ); - - MarketSurface mktSurfFlatVol3 = FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol3 - ); - - int[] aiNumFactor = new int[] { - 1, 2, 3 - }; - - for (int iNumFactor : aiNumFactor) { - MultiFactorStateEvolver hjm = HJMInstance ( - dtSpot, - strCurrency, - mktSurfFlatVol1, - mktSurfFlatVol2, - mktSurfFlatVol3, - new FlatUnivariate (dblFlatForwardRate), - iNumFactor - ); - - Evolve ( - hjm, - dtSpot, - strCurrency, - "3M", - "6M", - dblFlatForwardRate, - dblStartingPrice - ); - } - } -} diff --git a/org/drip/sample/hjm/PrincipalComponentQMDynamics.java b/org/drip/sample/hjm/PrincipalComponentQMDynamics.java deleted file mode 100644 index 384137c..0000000 --- a/org/drip/sample/hjm/PrincipalComponentQMDynamics.java +++ /dev/null @@ -1,380 +0,0 @@ - -package org.drip.sample.hjm; - -import org.drip.analytics.date.*; -import org.drip.analytics.definition.MarketSurface; -import org.drip.analytics.support.Helper; -import org.drip.dynamics.hjm.*; -import org.drip.function.definition.R1ToR1; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.ScenarioMarketSurfaceBuilder; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * PrincipalComponentQMDynamics demonstrates the Construction and Usage of the Principal Component-Based - * Gaussian Model Dynamics for the Evolution of the Discount Factor Quantification Metrics - the - * Instantaneous Forward Rate, the LIBOR Forward Rate, the Shifted LIBOR Forward Rate, the Short Rate, the - * Compounded Short Rate, and the Price. - * - * @author Lakshmi Krishnamurthy - */ - -public class PrincipalComponentQMDynamics { - - private static final MarketSurface FlatVolatilitySurface ( - final JulianDate dtStart, - final String strCurrency, - final double dblFlatVol) - throws Exception - { - return ScenarioMarketSurfaceBuilder.CustomSplineWireSurface ( - "VIEW_TARGET_VOLATILITY_SURFACE", - dtStart, - strCurrency, - new double[] { - dtStart.julian(), - dtStart.addYears (2).julian(), - dtStart.addYears (4).julian(), - dtStart.addYears (6).julian(), - dtStart.addYears (8).julian(), - dtStart.addYears (10).julian() - }, - new double[] { - dtStart.julian(), - dtStart.addYears (2).julian(), - dtStart.addYears (4).julian(), - dtStart.addYears (6).julian(), - dtStart.addYears (8).julian(), - dtStart.addYears (10).julian() - }, - new double[][] { - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - }, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ), - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ) - ); - } - - private static final MultiFactorStateEvolver HJMInstance ( - final JulianDate dtStart, - final String strCurrency, - final String strTenor, - final MarketSurface mktSurfFlatVol1, - final MarketSurface mktSurfFlatVol2, - final MarketSurface mktSurfFlatVol3, - final R1ToR1 auForwardRate, - final int iNumFactor) - throws Exception - { - MultiFactorVolatility mfv = new MultiFactorVolatility ( - new MarketSurface[] { - mktSurfFlatVol1, - mktSurfFlatVol2, - mktSurfFlatVol3 - }, - new PrincipalFactorSequenceGenerator ( - new UnivariateSequenceGenerator[] { - new BoxMullerGaussian ( - 0., - 1. - ), - new BoxMullerGaussian ( - 0., - 1. - ), - new BoxMullerGaussian ( - 0., - 1. - ) - }, - new double[][] { - {1.0, 0.1, 0.2}, - {0.1, 1.0, 0.2}, - {0.2, 0.1, 1.0} - }, - iNumFactor - ) - ); - - return new MultiFactorStateEvolver ( - FundingLabel.Standard (strCurrency), - ForwardLabel.Create ( - strCurrency, - strTenor - ), - mfv, - auForwardRate - ); - } - - private static final ShortForwardRateUpdate InitQMSnap ( - final JulianDate dtStart, - final String strCurrency, - final String strViewTenor, - final String strTenor, - final double dblInitialForwardRate, - final double dblInitialPrice) - throws Exception - { - return ShortForwardRateUpdate.Create ( - FundingLabel.Standard (strCurrency), - ForwardLabel.Create ( - strCurrency, - strTenor - ), - dtStart.julian(), - dtStart.julian(), - dtStart.addTenor (strViewTenor).julian(), - dblInitialForwardRate, - 0., - dblInitialForwardRate, - 0., - dblInitialForwardRate + (365.25 / Helper.TenorToDays (strTenor)), - 0., - dblInitialForwardRate, - 0., - dblInitialForwardRate, - 0., - dblInitialPrice, - 0. - ); - } - - private static final void QMEvolution ( - final MultiFactorStateEvolver hjm, - final JulianDate dtStart, - final String strCurrency, - final String strViewTenor, - final ShortForwardRateUpdate qmInitial) - throws Exception - { - int iViewDate = dtStart.addTenor (strViewTenor).julian(); - - int iDayStep = 2; - ShortForwardRateUpdate qm = qmInitial; - JulianDate dtSpot = dtStart; - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| Multi-Factor PCA-Based Gaussian HJM Quantification Metric Run ||"); - - System.out.println ("\t| ------------------------------------------------------------- ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| Number of Prinicipal Components: " + hjm.mfv().msg().numFactor() + " ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| L->R: ||"); - - System.out.println ("\t| Date ||"); - - System.out.println ("\t| Instantaneous Forward Rate (%) ||"); - - System.out.println ("\t| Instantaneous Forward Rate - Change (%) ||"); - - System.out.println ("\t| LIBOR Forward Rate (%) ||"); - - System.out.println ("\t| LIBOR Forward Rate - Change (%) ||"); - - System.out.println ("\t| Shifted LIBOR Forward Rate (%) ||"); - - System.out.println ("\t| Shifted LIBOR Forward Rate - Change (%) ||"); - - System.out.println ("\t| Short Rate (%) ||"); - - System.out.println ("\t| Short Rate - Change (%) ||"); - - System.out.println ("\t| Continuously Compounded Short Rate (%) ||"); - - System.out.println ("\t| Continuously Compounded Short Rate - Change (%) ||"); - - System.out.println ("\t| Price ||"); - - System.out.println ("\t| Price - Change ||"); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------||"); - - while (dtSpot.julian() < iViewDate) { - int iSpotDate = dtSpot.julian(); - - qm = (ShortForwardRateUpdate) hjm.evolve ( - iSpotDate, - iViewDate, - iDayStep, - qm - ); - - System.out.println ("\t| [" + dtSpot + "] = " + - FormatUtil.FormatDouble (qm.instantaneousForwardRate(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (qm.instantaneousForwardRateIncrement(), 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (qm.liborForwardRate(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (qm.liborForwardRateIncrement(), 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (qm.shiftedLIBORForwardRate(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (qm.shiftedLIBORForwardRateIncrement(), 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (qm.shortRate(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (qm.shortRateIncrement(), 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (qm.compoundedShortRate(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (qm.compoundedShortRateIncrement(), 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (qm.price(), 2, 2, 100.) + " | " + - FormatUtil.FormatDouble (qm.priceIncrement(), 1, 2, 100.) + " || " - ); - - dtSpot = dtSpot.addBusDays ( - iDayStep, - strCurrency - ); - } - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------||"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - double dblFlatVol1 = 0.007; - double dblFlatVol2 = 0.009; - double dblFlatVol3 = 0.004; - double dblFlatForwardRate = 0.05; - double dblInitialPrice = 0.9875; - String strViewTenor = "3M"; - String strTenor = "3M"; - - JulianDate dtSpot = DateUtil.Today(); - - MarketSurface mktSurfFlatVol1 = FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol1 - ); - - MarketSurface mktSurfFlatVol2 = FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol2 - ); - - MarketSurface mktSurfFlatVol3 = FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol3 - ); - - ShortForwardRateUpdate qmInitial = InitQMSnap ( - dtSpot, - strCurrency, - strViewTenor, - strTenor, - dblFlatForwardRate, - dblInitialPrice - ); - - int[] aiNumFactor = new int[] { - 1, 2, 3 - }; - - for (int iNumFactor : aiNumFactor) { - MultiFactorStateEvolver hjm = HJMInstance ( - dtSpot, - strCurrency, - strTenor, - mktSurfFlatVol1, - mktSurfFlatVol2, - mktSurfFlatVol3, - new FlatUnivariate (dblFlatForwardRate), - iNumFactor - ); - - QMEvolution ( - hjm, - dtSpot, - strCurrency, - strViewTenor, - qmInitial - ); - } - } -} diff --git a/org/drip/sample/hullwhite/EvolutionMetrics.java b/org/drip/sample/hullwhite/EvolutionMetrics.java deleted file mode 100644 index bbaf46a..0000000 --- a/org/drip/sample/hullwhite/EvolutionMetrics.java +++ /dev/null @@ -1,180 +0,0 @@ - -package org.drip.sample.hullwhite; - -import org.drip.analytics.date.*; -import org.drip.dynamics.hullwhite.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.random.BoxMullerGaussian; -import org.drip.service.env.EnvManager; -import org.drip.state.identifier.FundingLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * EvolutionMetrics demonstrates the Construction and Usage of the Hull-White Metrics Using Hull-White 1F - * Model Dynamics for the Evolution of the Short Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class EvolutionMetrics { - - private static final SingleFactorStateEvolver HullWhiteEvolver ( - final String strCurrency, - final double dblSigma, - final double dblA, - final double dblStartingForwardRate) - throws Exception - { - return new SingleFactorStateEvolver ( - FundingLabel.Standard (strCurrency), - dblSigma, - dblA, - new FlatUnivariate (dblStartingForwardRate), - new BoxMullerGaussian ( - 0., - 1. - ) - ); - } - - private static final void DumpMetrics ( - final ShortRateUpdate hwem) - throws Exception - { - System.out.println ("\t| [" + new JulianDate (hwem.evolutionStartDate()) + " -> " + - new JulianDate (hwem.evolutionFinishDate()) + "] => " + - FormatUtil.FormatDouble (hwem.initialShortRate(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (hwem.realizedFinalShortRate(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (hwem.expectedFinalShortRate(), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (hwem.zeroCouponBondPrice (0.975), 1, 2, 100.) + " | " + - FormatUtil.FormatDouble (Math.sqrt (hwem.finalShortRateVariance()), 1, 2, 100.) + "% || " - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "USD"; - double dblStartingShortRate = 0.05; - double dblSigma = 0.03; - double dblA = 1.; - int iNumRun = 50; - - SingleFactorStateEvolver hw = HullWhiteEvolver ( - strCurrency, - dblSigma, - dblA, - dblStartingShortRate - ); - - int iSpotDate = dtSpot.julian(); - - int iInitialDate = dtSpot.addMonths (1).julian(); - - int iFinalDate = dtSpot.addMonths (7).julian(); - - System.out.println ("\n\t|--------------------------------------------------------------------------||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| Hull-White Scenario Evolution Metrics ||"); - - System.out.println ("\t| ------------------------------------- ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| L->R: ||"); - - System.out.println ("\t| Initial Date ||"); - - System.out.println ("\t| Final Date ||"); - - System.out.println ("\t| Initial Short Rate (%) ||"); - - System.out.println ("\t| Realized Final Short Rate (%) ||"); - - System.out.println ("\t| Expected Final Short Rate (%) ||"); - - System.out.println ("\t| Zero Coupon Bond Price ||"); - - System.out.println ("\t| Final Short Rate Variance (%) ||"); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - - ShortRateUpdate sruInitial = ShortRateUpdate.Create ( - FundingLabel.Standard (strCurrency), - iInitialDate, - iInitialDate, - iFinalDate, - dblStartingShortRate, - dblStartingShortRate, - dblStartingShortRate, - 0., - 1. - ); - - for (int i = 0; i < iNumRun; ++i) - DumpMetrics ( - (ShortRateUpdate) hw.evolve ( - iSpotDate, - iInitialDate, - iFinalDate - iInitialDate, - sruInitial - ) - ); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/hullwhite/ShortRateDynamics.java b/org/drip/sample/hullwhite/ShortRateDynamics.java deleted file mode 100644 index 94b15c0..0000000 --- a/org/drip/sample/hullwhite/ShortRateDynamics.java +++ /dev/null @@ -1,193 +0,0 @@ - -package org.drip.sample.hullwhite; - -import org.drip.analytics.date.*; -import org.drip.dynamics.hullwhite.SingleFactorStateEvolver; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.random.BoxMullerGaussian; -import org.drip.service.env.EnvManager; -import org.drip.state.identifier.FundingLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ShortRateDynamics demonstrates the Construction and Usage of the Hull-White 1F Model Dynamics for the - * Evolution of the Short Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class ShortRateDynamics { - - private static final SingleFactorStateEvolver HullWhiteEvolver ( - final String strCurrency, - final double dblSigma, - final double dblA, - final double dblStartingForwardRate) - throws Exception - { - return new SingleFactorStateEvolver ( - FundingLabel.Standard (strCurrency), - dblSigma, - dblA, - new FlatUnivariate (dblStartingForwardRate), - new BoxMullerGaussian ( - 0., - 1. - ) - ); - } - - private static final void ShortRateEvolution ( - final SingleFactorStateEvolver hw, - final JulianDate dtSpot, - final String strCurrency, - final String strViewTenor, - final double dblStartingShortRate) - throws Exception - { - int iDayStep = 2; - JulianDate dtView = dtSpot; - double dblShortRate = dblStartingShortRate; - - int iSpotDate = dtSpot.julian(); - - int iEndDate = dtSpot.addTenor (strViewTenor).julian(); - - System.out.println ("\n\n\t|------------------------------------------------------||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| Hull-White Evolution Run ||"); - - System.out.println ("\t| ------------------------ ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| L->R: ||"); - - System.out.println ("\t| Date ||"); - - System.out.println ("\t| Short Rate (%) ||"); - - System.out.println ("\t| Short Rate - Change (%) ||"); - - System.out.println ("\t| Alpha (%) ||"); - - System.out.println ("\t| Theta (%) ||"); - - System.out.println ("\t|------------------------------------------------------||"); - - while (dtView.julian() < iEndDate) { - int iViewDate = dtView.julian(); - - double dblAlpha = hw.alpha ( - iSpotDate, - iViewDate - ); - - double dblTheta = hw.theta ( - iSpotDate, - iViewDate - ); - - double dblShortRateIncrement = hw.shortRateIncrement ( - iSpotDate, - iViewDate, - dblShortRate, - iDayStep - ); - - dblShortRate += dblShortRateIncrement; - - System.out.println ("\t| [" + dtView + "] = " + - FormatUtil.FormatDouble (dblShortRate, 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblShortRateIncrement, 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblAlpha, 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (dblTheta, 1, 4, 100.) + "% || " - ); - - dtView = dtView.addBusDays ( - iDayStep, - strCurrency - ); - } - - System.out.println ("\t|------------------------------------------------------||"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "USD"; - double dblStartingShortRate = 0.05; - double dblSigma = 0.05; - double dblA = 1.; - - SingleFactorStateEvolver hw = HullWhiteEvolver ( - strCurrency, - dblSigma, - dblA, - dblStartingShortRate - ); - - ShortRateEvolution ( - hw, - dtSpot, - strCurrency, - "4M", - dblStartingShortRate - ); - } -} diff --git a/org/drip/sample/hullwhite/TrinomialTreeCalibration.java b/org/drip/sample/hullwhite/TrinomialTreeCalibration.java deleted file mode 100644 index e764a8a..0000000 --- a/org/drip/sample/hullwhite/TrinomialTreeCalibration.java +++ /dev/null @@ -1,288 +0,0 @@ - -package org.drip.sample.hullwhite; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.dynamics.hullwhite.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.random.BoxMullerGaussian; -import org.drip.service.env.EnvManager; -import org.drip.state.identifier.FundingLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * TrinomialTreeCalibration demonstrates the Construction and Calibration of the Hull-White Trinomial Tree - * and the Eventual Evolution of the Short Rate on it. - * - * @author Lakshmi Krishnamurthy - */ - -public class TrinomialTreeCalibration { - - private static final String SourceToTarget ( - final String strKey) - { - String[] astrNode = strKey.split ("#"); - - String[] astrSourceNode = astrNode[0].split (","); - - String[] astrTargetNode = astrNode[1].split (","); - - return "[" + - astrSourceNode[0] + "," + - FormatUtil.FormatDouble (Double.parseDouble (astrSourceNode[1]), 1, 0, 1.) + "] => [" + - astrTargetNode[0] + "," + - FormatUtil.FormatDouble (Double.parseDouble (astrTargetNode[1]), 1, 0, 1.) + "]"; - } - - private static final SingleFactorStateEvolver HullWhiteEvolver ( - final String strCurrency, - final double dblSigma, - final double dblA, - final double dblStartingForwardRate) - throws Exception - { - return new SingleFactorStateEvolver ( - FundingLabel.Standard (strCurrency), - dblSigma, - dblA, - new FlatUnivariate (dblStartingForwardRate), - new BoxMullerGaussian ( - 0., - 1. - ) - ); - } - - private static void EmitNodeDetails ( - final TrinomialTreeTransitionMetrics hwtm, - final TrinomialTreeNodeMetrics hwnm) - throws Exception - { - System.out.println ("\n\n\t|----------------------------------------------------------|"); - - System.out.println ("\t| NODE [" + hwnm.timeIndex() + ", " + hwnm.xStochasticIndex() + "] |"); - - System.out.println ("\t|----------------------------------------------------------|"); - - System.out.println ("\t| Expected Terminal X : " + FormatUtil.FormatDouble (hwtm.expectedTerminalX(), 1, 6, 1.) + " |"); - - System.out.println ("\t| X Variance : " + FormatUtil.FormatDouble (hwtm.xVariance(), 1, 6, 1.) + " |"); - - System.out.println ("\t| X Stochastic Volatility Shift : " + FormatUtil.FormatDouble (hwtm.xStochasticShift(), 1, 6, 1.) + " |"); - - System.out.println ("\t| X Tree Stochastic Displacement Index : " + hwtm.treeStochasticDisplacementIndex() + " |"); - - System.out.println ("\t| Probability Up : " + FormatUtil.FormatDouble (hwtm.probabilityUp(), 1, 6, 1.) + " |"); - - System.out.println ("\t| Probability Stay : " + FormatUtil.FormatDouble (hwtm.probabilityStay(), 1, 6, 1.) + " |"); - - System.out.println ("\t| Probability Down : " + FormatUtil.FormatDouble (hwtm.probabilityDown(), 1, 6, 1.) + " |"); - - System.out.println ("\t| Node X Value : " + FormatUtil.FormatDouble (hwnm.x(), 1, 6, 1.) + " |"); - - System.out.println ("\t| Node Alpha : " + FormatUtil.FormatDouble (hwnm.alpha(), 1, 6, 1.) + " |"); - - System.out.println ("\t| Node Short Rate : " + FormatUtil.FormatDouble (hwnm.shortRate(), 1, 6, 1.) + " |"); - - System.out.println ("\t|----------------------------------------------------------|"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2011, - DateUtil.MAY, - 18 - ); - - double dblA = 0.1; - double dblSigma = 0.01; - String strCurrency = "USD"; - String[] astrTenor = { - "3M", "6M", "9M" - }; - double[] adblQuote = { - 0.0026, 0.00412, 0.00572 - }; - - SingleFactorStateEvolver hw = HullWhiteEvolver ( - strCurrency, - dblSigma, - dblA, - adblQuote[0] - ); - - TrinomialTreeTransitionMetrics hwtmp0p0 = hw.evolveTrinomialTree ( - dtSpot.julian(), - dtSpot.julian(), - dtSpot.addTenor (astrTenor[0]).julian(), - null - ); - - EmitNodeDetails ( - hwtmp0p0, - hwtmp0p0.downNodeMetrics() - ); - - EmitNodeDetails ( - hwtmp0p0, - hwtmp0p0.stayNodeMetrics() - ); - - EmitNodeDetails ( - hwtmp0p0, - hwtmp0p0.upNodeMetrics() - ); - - TrinomialTreeTransitionMetrics hwtmp1n1 = hw.evolveTrinomialTree ( - dtSpot.julian(), - dtSpot.addTenor (astrTenor[0]).julian(), - dtSpot.addTenor (astrTenor[1]).julian(), - hwtmp0p0.downNodeMetrics() - ); - - EmitNodeDetails ( - hwtmp1n1, - hwtmp1n1.downNodeMetrics() - ); - - EmitNodeDetails ( - hwtmp1n1, - hwtmp1n1.stayNodeMetrics() - ); - - EmitNodeDetails ( - hwtmp1n1, - hwtmp1n1.upNodeMetrics() - ); - - TrinomialTreeTransitionMetrics hwtmp1n0 = hw.evolveTrinomialTree ( - dtSpot.julian(), - dtSpot.addTenor (astrTenor[0]).julian(), - dtSpot.addTenor (astrTenor[1]).julian(), - hwtmp0p0.stayNodeMetrics() - ); - - EmitNodeDetails ( - hwtmp1n0, - hwtmp1n0.downNodeMetrics() - ); - - EmitNodeDetails ( - hwtmp1n0, - hwtmp1n0.stayNodeMetrics() - ); - - EmitNodeDetails ( - hwtmp1n0, - hwtmp1n0.upNodeMetrics() - ); - - TrinomialTreeTransitionMetrics hwtmp1p1 = hw.evolveTrinomialTree ( - dtSpot.julian(), - dtSpot.addTenor (astrTenor[0]).julian(), - dtSpot.addTenor (astrTenor[1]).julian(), - hwtmp0p0.upNodeMetrics() - ); - - EmitNodeDetails ( - hwtmp1p1, - hwtmp1p1.downNodeMetrics() - ); - - EmitNodeDetails ( - hwtmp1p1, - hwtmp1p1.stayNodeMetrics() - ); - - EmitNodeDetails ( - hwtmp1p1, - hwtmp1p1.upNodeMetrics() - ); - - TrinomialTreeSequenceMetrics hwsm = hw.evolveTrinomialTreeSequence ( - dtSpot.julian(), - 30, - 2 - ); - - System.out.println ("\n\t|-----------------------------------|"); - - System.out.println ("\t| SOURCE TARGET PROBABILITY METRICS |"); - - System.out.println ("\t|-----------------------------------|"); - - Map mapProbSourceTarget = hwsm.sourceTargetTransitionProbability(); - - for (Map.Entry me : mapProbSourceTarget.entrySet()) - System.out.println ("\t| " + SourceToTarget (me.getKey()) + ": " + FormatUtil.FormatDouble (me.getValue(), 1, 6, 1.) + " |"); - - System.out.println ("\t|-----------------------------------|"); - - System.out.println ("\n\t|-----------------------------------|"); - - System.out.println ("\t| TARGET SOURCE PROBABILITY METRICS |"); - - System.out.println ("\t|-----------------------------------|"); - - Map mapProbTargetSource = hwsm.targetSourceTransitionProbability(); - - for (Map.Entry me : mapProbTargetSource.entrySet()) - System.out.println ("\t| " + SourceToTarget (me.getKey()) + ": " + FormatUtil.FormatDouble (me.getValue(), 1, 6, 1.) + " |"); - - System.out.println ("\t|-----------------------------------|"); - } -} diff --git a/org/drip/sample/hullwhite/TrinomialTreeEvolution.java b/org/drip/sample/hullwhite/TrinomialTreeEvolution.java deleted file mode 100644 index 5e8e689..0000000 --- a/org/drip/sample/hullwhite/TrinomialTreeEvolution.java +++ /dev/null @@ -1,243 +0,0 @@ - -package org.drip.sample.hullwhite; - -import org.drip.analytics.date.*; -import org.drip.dynamics.hullwhite.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.random.BoxMullerGaussian; -import org.drip.service.env.EnvManager; -import org.drip.state.identifier.FundingLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * TrinomialTreeEvolution demonstrates the Construction and Usage of the Hull-White Trinomial Tree and the - * Eventual Evolution of the Short Rate on it. - * - * @author Lakshmi Krishnamurthy - */ - -public class TrinomialTreeEvolution { - - private static final SingleFactorStateEvolver HullWhiteEvolver ( - final String strCurrency, - final double dblSigma, - final double dblA, - final double dblStartingForwardRate) - throws Exception - { - return new SingleFactorStateEvolver ( - FundingLabel.Standard (strCurrency), - dblSigma, - dblA, - new FlatUnivariate (dblStartingForwardRate), - new BoxMullerGaussian ( - 0., - 1. - ) - ); - } - - private static final void DumpMetrics ( - final TrinomialTreeTransitionMetrics hwtm) - throws Exception - { - System.out.println ("\t| [" + new JulianDate (hwtm.initialDate()) + " -> " + - new JulianDate (hwtm.terminalDate()) + "] => " + - FormatUtil.FormatDouble (hwtm.expectedTerminalX(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (Math.sqrt (hwtm.xVariance()), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (hwtm.xStochasticShift(), 1, 4, 1.) + " || " + - FormatUtil.FormatDouble (hwtm.probabilityUp(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (hwtm.upNodeMetrics().x(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (hwtm.upNodeMetrics().shortRate(), 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (hwtm.probabilityDown(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (hwtm.downNodeMetrics().x(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (hwtm.downNodeMetrics().shortRate(), 1, 2, 100.) + "% || " + - FormatUtil.FormatDouble (hwtm.probabilityStay(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (hwtm.stayNodeMetrics().x(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (hwtm.stayNodeMetrics().shortRate(), 1, 2, 100.) + "% ||" - ); - } - - private static final void TreeHeader ( - final String strEvolutionComment) - throws Exception - { - System.out.println ("\n\n\t|----------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| ||"); - - System.out.println (strEvolutionComment); - - System.out.println ("\t| --------------------------------------------------- ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| L->R: ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| Initial Date ||"); - - System.out.println ("\t| Final Date ||"); - - System.out.println ("\t| Expected Final X ||"); - - System.out.println ("\t| X Volatility (%) ||"); - - System.out.println ("\t| X Stochastic Shift ||"); - - System.out.println ("\t| Move-Up Probability ||"); - - System.out.println ("\t| Move-Up X Node Value ||"); - - System.out.println ("\t| Move-Up Short Rate ||"); - - System.out.println ("\t| Move-Down Probability ||"); - - System.out.println ("\t| Move-Down X Node Value ||"); - - System.out.println ("\t| Move-Down Short Rate ||"); - - System.out.println ("\t| Stay Probability ||"); - - System.out.println ("\t| Stay X Node Value ||"); - - System.out.println ("\t| Stay Short Rate ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "USD"; - double dblStartingShortRate = 0.05; - double dblSigma = 0.01; - double dblA = 1.; - - SingleFactorStateEvolver hw = HullWhiteEvolver ( - strCurrency, - dblSigma, - dblA, - dblStartingShortRate - ); - - int iSpotDate = dtSpot.julian(); - - int iFinalDate = dtSpot.addMonths (6).julian(); - - int iInitialDate = iSpotDate; - TrinomialTreeTransitionMetrics hwtm = null; - - TreeHeader ("\t| Hull-White Trinomial Tree Upwards Evolution Metrics ||"); - - while (iInitialDate < iFinalDate) { - DumpMetrics (hwtm = - hw.evolveTrinomialTree ( - iSpotDate, - iInitialDate, - iFinalDate, - null == hwtm ? null : hwtm.upNodeMetrics() - ) - ); - - iInitialDate += 10; - } - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||"); - - hwtm = null; - iInitialDate = iSpotDate; - - TreeHeader ("\t| Hull-White Trinomial Tree Downwards Evolution Metrics ||"); - - while (iInitialDate < iFinalDate) { - DumpMetrics (hwtm = - hw.evolveTrinomialTree ( - iSpotDate, - iInitialDate, - iFinalDate, - null == hwtm ? null : hwtm.downNodeMetrics() - ) - ); - - iInitialDate += 10; - } - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||"); - - hwtm = null; - iInitialDate = iSpotDate; - - TreeHeader ("\t| Hull-White Trinomial Tree Stay-Put Evolution Metrics ||"); - - while (iInitialDate < iFinalDate) { - DumpMetrics (hwtm = - hw.evolveTrinomialTree ( - iSpotDate, - iInitialDate, - iFinalDate, - null == hwtm ? null : hwtm.stayNodeMetrics() - ) - ); - - iInitialDate += 10; - } - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/idzorek/ExpectedExcessReturnsWeights.java b/org/drip/sample/idzorek/ExpectedExcessReturnsWeights.java deleted file mode 100644 index 2e0cd16..0000000 --- a/org/drip/sample/idzorek/ExpectedExcessReturnsWeights.java +++ /dev/null @@ -1,280 +0,0 @@ - -package org.drip.sample.idzorek; - -import org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput; -import org.drip.portfolioconstruction.asset.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ExpectedExcessReturnsWeights reconciles the Expected Returns and the corresponding Weights for different - * Input Asset Distributions using the Black-Litterman Model Process. The References are: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * - Idzorek, T. (2005): A Step-by-Step Guide to the Black-Litterman Model: Incorporating User-Specified - * Confidence Levels, Ibbotson Associates, Chicago - * - * @author Lakshmi Krishnamurthy - */ - -public class ExpectedExcessReturnsWeights { - - private static final void ForwardOptimizationWeights ( - final ForwardReverseOptimizationOutput from, - final double[] adblWeightReconciler, - final int iLeft, - final int iRight, - final String strHeader) - { - Portfolio fromPortfolio = from.optimalPortfolio(); - - String[] astrAssetID = fromPortfolio.id(); - - double[] adblWeight = fromPortfolio.weights(); - - AssetComponent acMaxWeight = fromPortfolio.maxWeight(); - - AssetComponent acMinWeight = fromPortfolio.minWeight(); - - System.out.println ("\t|------------------------------------------------------||"); - - System.out.println (strHeader); - - System.out.println ("\t|------------------------------------------------------||"); - - System.out.println ("\t| ID => CALC | VERIFY ||"); - - System.out.println ("\t|------------------------------------------------------||"); - - for (int i = 0; i < adblWeight.length; ++i) - System.out.println ( - "\t| [" + astrAssetID[i] + "] => " + - FormatUtil.FormatDouble (adblWeight[i], iLeft, iRight, 100.) + "% | " + - FormatUtil.FormatDouble (adblWeightReconciler[i], iLeft, iRight, 100.) + "% ||" - ); - - System.out.println ("\t|------------------------------------------------------||"); - - System.out.println ("\t| HIGH : " + acMaxWeight.id() + " => "+ FormatUtil.FormatDouble (acMaxWeight.amount(), iLeft, iRight, 100.) + "% ||"); - - System.out.println ("\t| LOW : " + acMinWeight.id() + " => "+ FormatUtil.FormatDouble (acMinWeight.amount(), iLeft, iRight, 100.) + "% ||"); - - System.out.println ("\t|------------------------------------------------------||\n"); - } - - public static final void main ( - final String[] astArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblRiskAversion = 3.07; - - String[] astrAssetID = new String[] { - "US BONDS ", - "INTERNATIONAL BONDS ", - "US LARGE GROWTH ", - "US LARGE VALUE ", - "US SMALL GROWTH ", - "US SMALL VALUE ", - "INTERNATIONAL DEVELOPED EQUITY ", - "INTERNATIONAL EMERGING EQUITY " - }; - - double[] adblAssetEquilibriumWeight = new double[] { - 0.1934, - 0.2613, - 0.1209, - 0.1209, - 0.0134, - 0.0134, - 0.2418, - 0.0349 - }; - - double[][] aadblAssetExcessReturnsCovariance = new double[][] { - { 0.001005, 0.001328, -0.000579, -0.000675, 0.000121, 0.000128, -0.000445, -0.000437}, - { 0.001328, 0.007277, -0.001307, -0.000610, -0.002237, -0.000989, 0.001442, -0.001535}, - {-0.000579, -0.001307, 0.059582, 0.027588, 0.063497, 0.023036, 0.032967, 0.048039}, - {-0.000675, -0.000610, 0.027588, 0.029609, 0.026572, 0.021465, 0.020697, 0.029854}, - { 0.000121, -0.002237, 0.063497, 0.026572, 0.102488, 0.042744, 0.039943, 0.065994}, - { 0.000128, -0.000989, 0.023036, 0.021465, 0.042744, 0.032056, 0.019881, 0.032235}, - {-0.000445, 0.001442, 0.032967, 0.020697, 0.039943, 0.019881, 0.028355, 0.035064}, - {-0.000437, -0.001535, 0.048039, 0.029854, 0.065994, 0.032235, 0.035064, 0.079958} - }; - - double[] adblAssetSpaceHistoricalReturns = new double[] { - 0.0315, - 0.0175, - -0.0639, - -0.0286, - -0.0675, - -0.0054, - -0.0675, - -0.0526 - }; - - double[] adblAssetSpaceCAPMReturns = new double[] { - 0.0008, - 0.0067, - 0.0641, - 0.0408, - 0.0743, - 0.0370, - 0.0480, - 0.0660 - }; - - double[] adblAssetSpaceGSMIReturns = new double[] { - 0.0002, - 0.0018, - 0.0557, - 0.0339, - 0.0659, - 0.0316, - 0.0392, - 0.0560 - }; - - double[] adblHistoricalPortfolioWeightReconciler = new double[] { - 11.4432, - -1.0459, - 0.5459, - -0.0529, - -0.6052, - 0.8147, - -1.0436, - 0.1459 - }; - - double[] adblCAPMGSMIPortfolioWeightReconciler = new double[] { - 0.2133, - 0.0519, - 0.1080, - 0.1082, - 0.0373, - -0.0049, - 0.1710, - 0.0214 - }; - - ForwardReverseOptimizationOutput fromPrior = ForwardReverseOptimizationOutput.Reverse ( - Portfolio.Standard ( - astrAssetID, - adblAssetEquilibriumWeight - ), - aadblAssetExcessReturnsCovariance, - dblRiskAversion - ); - - double[] adblImpliedEquilibriumExcessReturns = fromPrior.expectedAssetExcessReturns(); - - System.out.println ("\n\t|---------------------------------------------------------------------||"); - - System.out.println ("\t| STARTING RETURNS SOURCES RECONCILIATION ||"); - - System.out.println ("\t|---------------------------------------------------------------------||"); - - System.out.println ("\t| ID => HIST | GSMI | CAPM | IMPL ||"); - - System.out.println ("\t|---------------------------------------------------------------------||"); - - for (int i = 0; i < adblImpliedEquilibriumExcessReturns.length; ++i) - System.out.println ( - "\t| [" + astrAssetID[i] + "] => " + - FormatUtil.FormatDouble (adblAssetSpaceHistoricalReturns[i], 1, 2, 100.) + "% |" + - FormatUtil.FormatDouble (adblAssetSpaceGSMIReturns[i], 1, 2, 100.) + "% |" + - FormatUtil.FormatDouble (adblAssetSpaceCAPMReturns[i], 1, 2, 100.) + "% |" + - FormatUtil.FormatDouble (dblRiskAversion * adblImpliedEquilibriumExcessReturns[i], 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t|---------------------------------------------------------------------||\n"); - - ForwardOptimizationWeights ( - ForwardReverseOptimizationOutput.Forward ( - astrAssetID, - adblAssetSpaceHistoricalReturns, - aadblAssetExcessReturnsCovariance, - dblRiskAversion - ), - adblHistoricalPortfolioWeightReconciler, - 4, - 0, - "\t| HISTORICAL WEIGHTS RECONCILER ||" - ); - - ForwardOptimizationWeights ( - ForwardReverseOptimizationOutput.Forward ( - astrAssetID, - adblAssetSpaceGSMIReturns, - aadblAssetExcessReturnsCovariance, - dblRiskAversion - ), - adblCAPMGSMIPortfolioWeightReconciler, - 2, - 1, - "\t| CAPM GSMI WEIGHTS RECONCILER ||" - ); - - ForwardOptimizationWeights ( - ForwardReverseOptimizationOutput.Forward ( - astrAssetID, - adblAssetSpaceCAPMReturns, - aadblAssetExcessReturnsCovariance, - dblRiskAversion - ), - adblAssetEquilibriumWeight, - 2, - 1, - "\t| EQUILIBRIUM WEIGHTS RECONCILER ||" - ); - } -} diff --git a/org/drip/sample/idzorek/PortfolioAndBenchmarkMetrics.java b/org/drip/sample/idzorek/PortfolioAndBenchmarkMetrics.java deleted file mode 100644 index ac35d7b..0000000 --- a/org/drip/sample/idzorek/PortfolioAndBenchmarkMetrics.java +++ /dev/null @@ -1,249 +0,0 @@ - -package org.drip.sample.idzorek; - -import org.drip.measure.bayesian.*; -import org.drip.measure.continuousjoint.MultivariateMeta; -import org.drip.measure.gaussian.*; -import org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.bayesian.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PortfolioAndBenchmarkMetrics demonstrates the Prior-Posterior Portfolio Statistics using the - * Black-Litterman Model augmented with the Idzorek Model. The References are: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * - Idzorek, T. (2005): A Step-by-Step Guide to the Black-Litterman Model: Incorporating User-Specified - * Confidence Levels, Ibbotson Associates, Chicago - * - * @author Lakshmi Krishnamurthy - */ - -public class PortfolioAndBenchmarkMetrics { - - public static final void main ( - final String[] astArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblTau = 0.025; - double dblRiskAversion = 3.07; - double dblRiskFreeRate = 0.00; - - String[] astrAssetID = new String[] { - "US BONDS ", - "INTERNATIONAL BONDS ", - "US LARGE GROWTH ", - "US LARGE VALUE ", - "US SMALL GROWTH ", - "US SMALL VALUE ", - "INTERNATIONAL DEVELOPED EQUITY ", - "INTERNATIONAL EMERGING EQUITY " - }; - - double[] adblAssetEquilibriumWeight = new double[] { - 0.1934, - 0.2613, - 0.1209, - 0.1209, - 0.0134, - 0.0134, - 0.2418, - 0.0349 - }; - - double[][] aadblAssetExcessReturnsCovariance = new double[][] { - { 0.001005, 0.001328, -0.000579, -0.000675, 0.000121, 0.000128, -0.000445, -0.000437}, - { 0.001328, 0.007277, -0.001307, -0.000610, -0.002237, -0.000989, 0.001442, -0.001535}, - {-0.000579, -0.001307, 0.059582, 0.027588, 0.063497, 0.023036, 0.032967, 0.048039}, - {-0.000675, -0.000610, 0.027588, 0.029609, 0.026572, 0.021465, 0.020697, 0.029854}, - { 0.000121, -0.002237, 0.063497, 0.026572, 0.102488, 0.042744, 0.039943, 0.065994}, - { 0.000128, -0.000989, 0.023036, 0.021465, 0.042744, 0.032056, 0.019881, 0.032235}, - {-0.000445, 0.001442, 0.032967, 0.020697, 0.039943, 0.019881, 0.028355, 0.035064}, - {-0.000437, -0.001535, 0.048039, 0.029854, 0.065994, 0.032235, 0.035064, 0.079958} - }; - - double[][] aadblAssetSpaceViewProjection = new double[][] { - { 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 1.00, 0.00}, - { -1.00, 1.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00}, - { 0.00, 0.00, 0.90, -0.90, 0.10, -0.10, 0.00, 0.00} - }; - - double[] adblProjectionExpectedExcessReturns = new double[] { - 0.0525, - 0.0025, - 0.0200 - }; - - double[][] aadblProjectionExcessReturnsCovariance = ProjectionDistributionLoading.ProjectionCovariance ( - aadblAssetExcessReturnsCovariance, - aadblAssetSpaceViewProjection, - dblTau - ); - - R1MultivariateNormal viewDistribution = R1MultivariateNormal.Standard ( - new MultivariateMeta ( - new String[] { - "PROJECTION #1", - "PROJECTION #2", - "PROJECTION #3" - } - ), - adblProjectionExpectedExcessReturns, - aadblProjectionExcessReturnsCovariance - ); - - BlackLittermanCombinationEngine blce = new BlackLittermanCombinationEngine ( - ForwardReverseOptimizationOutput.Reverse ( - Portfolio.Standard ( - astrAssetID, - adblAssetEquilibriumWeight - ), - aadblAssetExcessReturnsCovariance, - dblRiskAversion - ), - new PriorControlSpecification ( - false, - dblRiskFreeRate, - dblTau - ), - new ProjectionSpecification ( - viewDistribution, - aadblAssetSpaceViewProjection - ) - ); - - JointPosteriorMetrics jpm = blce.customConfidenceRun().combinationMetrics(); - - R1MultivariateNormal jointDistribution = (R1MultivariateNormal) jpm.joint(); - - double[] adblAssetSpaceJointReturns = jointDistribution.mean(); - - ForwardReverseOptimizationOutput fromPrior = ForwardReverseOptimizationOutput.Reverse ( - Portfolio.Standard ( - astrAssetID, - adblAssetEquilibriumWeight - ), - aadblAssetExcessReturnsCovariance, - dblRiskAversion - ); - - PortfolioMetrics pmPrior = fromPrior.optimalMetrics(); - - ForwardReverseOptimizationOutput fromPosterior = ForwardReverseOptimizationOutput.Forward ( - astrAssetID, - adblAssetSpaceJointReturns, - aadblAssetExcessReturnsCovariance, - dblRiskAversion - ); - - PortfolioMetrics pmPosterior = fromPosterior.optimalMetrics(); - - PortfolioBenchmarkMetrics pbm = fromPosterior.benchmarkMetrics (pmPrior); - - System.out.println ("\n\t|---------------------------------------------------------||"); - - System.out.println ("\t| EXCESS RETURN MEAN => " + - FormatUtil.FormatDouble (pmPrior.excessReturnsMean(), 1, 3, 100.) + "% | " + - FormatUtil.FormatDouble (pmPosterior.excessReturnsMean(), 1, 3, 100.) + "% ||" - ); - - System.out.println ("\t| EXCESS RETURN VARIANCE => " + - FormatUtil.FormatDouble (pmPrior.excessReturnsVariance(), 1, 5, 1.) + " | " + - FormatUtil.FormatDouble (pmPosterior.excessReturnsVariance(), 1, 5, 1.) + " ||" - ); - - System.out.println ("\t| EXCESS RETURN STANDARD DEVIATION => " + - FormatUtil.FormatDouble (pmPrior.excessReturnsStandardDeviation(), 1, 3, 100.) + "% |" + - FormatUtil.FormatDouble (pmPosterior.excessReturnsStandardDeviation(), 2, 3, 100.) + "% ||" - ); - - System.out.println ("\t| BETA => " + - FormatUtil.FormatDouble (fromPrior.benchmarkMetrics (pmPrior).beta(), 1, 5, 1.) + " | " + - FormatUtil.FormatDouble (pbm.beta(), 1, 5, 1.) + " ||" - ); - - System.out.println ("\t| ACTIVE BETA => " + - FormatUtil.FormatDouble (0., 1, 5, 1.) + " | " + - FormatUtil.FormatDouble (pbm.activeBeta(), 1, 5, 1.) + " ||" - ); - - System.out.println ("\t| RESIDUAL RETURN => " + - FormatUtil.FormatDouble (0., 1, 3, 100.) + "% | " + - FormatUtil.FormatDouble (pbm.residualReturn(), 1, 3, 100.) + "% ||" - ); - - System.out.println ("\t| RESIDUAL RISK => " + - FormatUtil.FormatDouble (0., 1, 3, 100.) + "% | " + - FormatUtil.FormatDouble (pbm.residualRisk(), 1, 3, 100.) + "% ||" - ); - - System.out.println ("\t| ACTIVE RETURN => " + - FormatUtil.FormatDouble (0., 1, 3, 100.) + "% | " + - FormatUtil.FormatDouble (pbm.activeReturn(), 1, 3, 100.) + "% ||" - ); - - System.out.println ("\t| ACTIVE RISK => " + - FormatUtil.FormatDouble (0., 1, 3, 100.) + "% | " + - FormatUtil.FormatDouble (pbm.activeRisk(), 1, 3, 100.) + "% ||" - ); - - System.out.println ("\t| SHARPE RATIO => " + - FormatUtil.FormatDouble (pmPrior.sharpeRatio(), 1, 5, 1.) + " | " + - FormatUtil.FormatDouble (pmPosterior.sharpeRatio(), 1, 5, 1.) + " ||" - ); - - System.out.println ("\t|---------------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/idzorek/PriorPosteriorMetricsComparison.java b/org/drip/sample/idzorek/PriorPosteriorMetricsComparison.java deleted file mode 100644 index da22d0e..0000000 --- a/org/drip/sample/idzorek/PriorPosteriorMetricsComparison.java +++ /dev/null @@ -1,442 +0,0 @@ - -package org.drip.sample.idzorek; - -import org.drip.measure.bayesian.*; -import org.drip.measure.continuousjoint.MultivariateMeta; -import org.drip.measure.gaussian.*; -import org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput; -import org.drip.portfolioconstruction.asset.*; -import org.drip.portfolioconstruction.bayesian.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PriorPosteriorMetricsComparison reconciles the Prior-Posterior Black-Litterman Model Process Metrics - * generated using the Idzorek Model. The References are: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * - Idzorek, T. (2005): A Step-by-Step Guide to the Black-Litterman Model: Incorporating User-Specified - * Confidence Levels, Ibbotson Associates, Chicago - * - * @author Lakshmi Krishnamurthy - */ - -public class PriorPosteriorMetricsComparison { - - private static final void ForwardOptimizationWeights ( - final ForwardReverseOptimizationOutput from, - final double[] adblWeightReconciler, - final int iLeft, - final int iRight, - final String strHeader) - { - Portfolio fromPortfolio = from.optimalPortfolio(); - - String[] astrAssetID = fromPortfolio.id(); - - double[] adblWeight = fromPortfolio.weights(); - - AssetComponent acMaxWeight = fromPortfolio.maxWeight(); - - AssetComponent acMinWeight = fromPortfolio.minWeight(); - - System.out.println ("\t|--------------------------------------------------------||"); - - System.out.println (strHeader); - - System.out.println ("\t|--------------------------------------------------------||"); - - System.out.println ("\t| ID => CALC | VERIFY ||"); - - System.out.println ("\t|--------------------------------------------------------||"); - - for (int i = 0; i < adblWeight.length; ++i) - System.out.println ( - "\t| [" + astrAssetID[i] + "] => " + - FormatUtil.FormatDouble (adblWeight[i], iLeft, iRight, 100.) + "% | " + - FormatUtil.FormatDouble (adblWeightReconciler[i], iLeft, iRight, 100.) + "% ||" - ); - - System.out.println ("\t|--------------------------------------------------------||"); - - System.out.println ("\t| HIGH : " + acMaxWeight.id() + " => " + FormatUtil.FormatDouble (acMaxWeight.amount(), iLeft, iRight, 100.) + "% ||"); - - System.out.println ("\t| LOW : " + acMinWeight.id() + " => " + FormatUtil.FormatDouble (acMinWeight.amount(), iLeft, iRight, 100.) + "% ||"); - - System.out.println ("\t|--------------------------------------------------------||"); - - System.out.println ("\t| TOTAL : " + FormatUtil.FormatDouble (fromPortfolio.notional(), iLeft, iRight, 100.) + "% ||"); - - System.out.println ("\t|--------------------------------------------------------||\n"); - } - - public static final void main ( - final String[] astArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblTau = 0.025; - double dblRiskAversion = 3.07; - double dblRiskFreeRate = 0.00; - - double[] adblAssetSpaceJointReturnsReconciler = new double[] { - 0.0007, - 0.0050, - 0.0650, - 0.0432, - 0.0759, - 0.0394, - 0.0493, - 0.0684 - }; - - double[] adblPosteriorPriorDeviationReconciler = new double[] { - -0.0002, - -0.0017, - 0.0008, - 0.0024, - 0.0016, - 0.0023, - 0.0013, - 0.0024 - }; - - double[] adblPosteriorPortfolioWeightReconciler = new double[] { - 0.2988, - 0.1559, - 0.0935, - 0.1482, - 0.0104, - 0.0165, - 0.2781, - 0.0349 - }; - - double[] adblPosteriorWeightDeviationReconciler = new double[] { - 0.1054, - -0.1054, - -0.0273, - 0.0273, - -0.0030, - 0.0030, - 0.0363, - 0.0000 - }; - - String[] astrAssetID = new String[] { - "US BONDS ", - "INTERNATIONAL BONDS ", - "US LARGE GROWTH ", - "US LARGE VALUE ", - "US SMALL GROWTH ", - "US SMALL VALUE ", - "INTERNATIONAL DEVELOPED EQUITY ", - "INTERNATIONAL EMERGING EQUITY " - }; - - double[] adblAssetEquilibriumWeight = new double[] { - 0.1934, - 0.2613, - 0.1209, - 0.1209, - 0.0134, - 0.0134, - 0.2418, - 0.0349 - }; - - double[][] aadblAssetExcessReturnsCovariance = new double[][] { - { 0.001005, 0.001328, -0.000579, -0.000675, 0.000121, 0.000128, -0.000445, -0.000437}, - { 0.001328, 0.007277, -0.001307, -0.000610, -0.002237, -0.000989, 0.001442, -0.001535}, - {-0.000579, -0.001307, 0.059582, 0.027588, 0.063497, 0.023036, 0.032967, 0.048039}, - {-0.000675, -0.000610, 0.027588, 0.029609, 0.026572, 0.021465, 0.020697, 0.029854}, - { 0.000121, -0.002237, 0.063497, 0.026572, 0.102488, 0.042744, 0.039943, 0.065994}, - { 0.000128, -0.000989, 0.023036, 0.021465, 0.042744, 0.032056, 0.019881, 0.032235}, - {-0.000445, 0.001442, 0.032967, 0.020697, 0.039943, 0.019881, 0.028355, 0.035064}, - {-0.000437, -0.001535, 0.048039, 0.029854, 0.065994, 0.032235, 0.035064, 0.079958} - }; - - double[][] aadblAssetSpaceViewProjection = new double[][] { - { 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 1.00, 0.00}, - { -1.00, 1.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00}, - { 0.00, 0.00, 0.90, -0.90, 0.10, -0.10, 0.00, 0.00} - }; - - double[] adblProjectionExpectedExcessReturns = new double[] { - 0.0525, - 0.0025, - 0.0200 - }; - - double[][] aadblProjectionExcessReturnsCovariance = ProjectionDistributionLoading.ProjectionCovariance ( - aadblAssetExcessReturnsCovariance, - aadblAssetSpaceViewProjection, - dblTau - ); - - R1MultivariateNormal viewDistribution = R1MultivariateNormal.Standard ( - new MultivariateMeta ( - new String[] { - "PROJECTION #1", - "PROJECTION #2", - "PROJECTION #3" - } - ), - adblProjectionExpectedExcessReturns, - aadblProjectionExcessReturnsCovariance - ); - - BlackLittermanCombinationEngine blce = new BlackLittermanCombinationEngine ( - ForwardReverseOptimizationOutput.Reverse ( - Portfolio.Standard ( - astrAssetID, - adblAssetEquilibriumWeight - ), - aadblAssetExcessReturnsCovariance, - dblRiskAversion - ), - new PriorControlSpecification ( - true, - dblRiskFreeRate, - dblTau - ), - new ProjectionSpecification ( - viewDistribution, - aadblAssetSpaceViewProjection - ) - ); - - JointPosteriorMetrics jpm = blce.customConfidenceRun().combinationMetrics(); - - R1MultivariateNormal priorDistribution = (R1MultivariateNormal) jpm.prior(); - - R1MultivariateNormal jointDistribution = (R1MultivariateNormal) jpm.joint(); - - R1MultivariateNormal posteriorDistribution = (R1MultivariateNormal) jpm.posterior(); - - double[] adblAssetSpacePriorReturns = priorDistribution.mean(); - - double[] adblAssetSpaceJointReturns = jointDistribution.mean(); - - double[][] aadblAssetSpaceJointCovariance = jointDistribution.covariance().covarianceMatrix(); - - double[][] aadblAssetSpacePosteriorCovariance = posteriorDistribution.covariance().covarianceMatrix(); - - ForwardReverseOptimizationOutput fromPosterior = ForwardReverseOptimizationOutput.Forward ( - astrAssetID, - adblAssetSpaceJointReturns, - aadblAssetExcessReturnsCovariance, - dblRiskAversion - ); - - double[] adblPosteriorWeight = fromPosterior.optimalPortfolio().weights(); - - System.out.println ("\n\t|---------------------------||"); - - System.out.println ("\t| TAU => " + FormatUtil.FormatDouble (dblTau, 1, 4, 1.) + " ||"); - - System.out.println ("\t| RISK AVERSION => " + FormatUtil.FormatDouble (dblRiskAversion, 1, 4, 1.) + " ||"); - - System.out.println ("\t| RISK FREE RATE => " + FormatUtil.FormatDouble (dblRiskAversion, 1, 4, 1.) + " ||"); - - System.out.println ("\t|---------------------------||"); - - System.out.println ("\n\t|-----------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| PRIOR CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetExcessReturnsCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|-----------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|---------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| VIEW SCOPING ASSET PROJECTION LOADING ||"); - - System.out.println ("\t|---------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < aadblAssetSpaceViewProjection.length; ++i) { - String strDump = "\t| #" + i + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "| " + FormatUtil.FormatDouble (aadblAssetSpaceViewProjection[i][j], 1, 5, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|---------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|----------------------------------------------||"); - - for (int i = 0; i < aadblAssetSpaceViewProjection.length; ++i) { - String strDump = "\t| #" + i + " "; - - for (int j = 0; j < aadblAssetSpaceViewProjection.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblProjectionExcessReturnsCovariance[i][j], 1, 6, 1.) + " "; - - System.out.println (strDump + "|" + FormatUtil.FormatDouble (adblProjectionExpectedExcessReturns[i], 1, 2, 100.) + "% ||"); - } - - System.out.println ("\t|----------------------------------------------||"); - - System.out.println ("\n\t|-----------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| JOINT CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpaceJointCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|-----------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|-----------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| POSTERIOR CROSS ASSET COVARIANCE MATRIX ||"); - - System.out.println ("\t|-----------------------------------------------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < astrAssetID.length; ++i) { - String strDump = "\t| " + astrAssetID[i] + " "; - - for (int j = 0; j < astrAssetID.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblAssetSpacePosteriorCovariance[i][j], 1, 8, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|-----------------------------------------------------------------------------------------------------------------------------------------||\n"); - - System.out.println ("\t|----------------------------------------------------||"); - - System.out.println ("\t| JOINT/POSTERIOR RETURN ||"); - - System.out.println ("\t|----------------------------------------------------||"); - - System.out.println ("\t| ID => DRIP | IDZO ||"); - - System.out.println ("\t|----------------------------------------------------||"); - - for (int i = 0; i < adblAssetSpaceJointReturnsReconciler.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (adblAssetSpaceJointReturns[i], 1, 2, 100.) + "% |" + - FormatUtil.FormatDouble (adblAssetSpaceJointReturnsReconciler[i], 1, 2, 100.) + "% ||" - ); - } - - System.out.println ("\t|----------------------------------------------------||\n"); - - System.out.println ("\t|----------------------------------------------------||"); - - System.out.println ("\t| RETURNS DEVIATION RECONCILER ||"); - - System.out.println ("\t|----------------------------------------------------||"); - - System.out.println ("\t| ID => DRIP | IDZO ||"); - - System.out.println ("\t|----------------------------------------------------||"); - - for (int i = 0; i < adblAssetSpacePriorReturns.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] =>" + - FormatUtil.FormatDouble (adblAssetSpaceJointReturns[i] - adblAssetSpacePriorReturns[i], 1, 2, 100.) + "% |" + - FormatUtil.FormatDouble (adblPosteriorPriorDeviationReconciler[i], 1, 2, 100.) + "% ||" - ); - } - - System.out.println ("\t|----------------------------------------------------||\n"); - - ForwardOptimizationWeights ( - fromPosterior, - adblPosteriorPortfolioWeightReconciler, - 2, - 2, - "\t| POSTERIOR WEIGHTS RECONCILER ||" - ); - - System.out.println ("\t|--------------------------------------------------------||"); - - System.out.println ("\t| WEIGHT DEVIATION RECONCILER ||"); - - System.out.println ("\t|--------------------------------------------------------||"); - - System.out.println ("\t| ID => DRIP | IDZO ||"); - - System.out.println ("\t|--------------------------------------------------------||"); - - for (int i = 0; i < adblAssetEquilibriumWeight.length; ++i) { - System.out.println ( - "\t| [" + astrAssetID[i] + "] => " + - FormatUtil.FormatDouble (adblPosteriorWeight[i] - adblAssetEquilibriumWeight[i], 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (adblPosteriorWeightDeviationReconciler[i], 2, 2, 100.) + "% ||" - ); - } - - System.out.println ("\t|--------------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/idzorek/ProjectionImpliedConfidenceLevel.java b/org/drip/sample/idzorek/ProjectionImpliedConfidenceLevel.java deleted file mode 100644 index 6b5bce4..0000000 --- a/org/drip/sample/idzorek/ProjectionImpliedConfidenceLevel.java +++ /dev/null @@ -1,338 +0,0 @@ - -package org.drip.sample.idzorek; - -import org.drip.measure.bayesian.ProjectionDistributionLoading; -import org.drip.measure.continuousjoint.MultivariateMeta; -import org.drip.measure.gaussian.*; -import org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput; -import org.drip.portfolioconstruction.asset.Portfolio; -import org.drip.portfolioconstruction.bayesian.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ProjectionImpliedConfidenceLevel reconciles the Implied Confidence Black-Litterman Model Process Levels - * generated using the Idzorek Model. The References are: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * - Idzorek, T. (2005): A Step-by-Step Guide to the Black-Litterman Model: Incorporating User-Specified - * Confidence Levels, Ibbotson Associates, Chicago - * - * @author Lakshmi Krishnamurthy - */ - -public class ProjectionImpliedConfidenceLevel { - - public static final void main ( - final String[] astArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblTau = 0.025; - double dblRiskAversion = 3.07; - double dblRiskFreeRate = 0.00; - - double[] adblCustomConfidenceWeightReconciler = new double[] { - 0.2988, - 0.1559, - 0.0935, - 0.1482, - 0.0104, - 0.0165, - 0.2781, - 0.0349 - }; - - double[] adblFullConfidenceWeightReconciler = new double[] { - 0.4382, - 0.0165, - 0.0381, - 0.2037, - 0.0042, - 0.0226, - 0.3521, - 0.0349 - }; - - double[] adblCustomWeightDeviationReconciler = new double[] { - 0.1054, - -0.1054, - -0.0273, - 0.0273, - -0.0030, - 0.0030, - 0.0363 - }; - - double[] adblFullWeightDeviationReconciler = new double[] { - 0.2448, - -0.2448, - -0.0828, - 0.0828, - -0.0092, - 0.0092, - 0.1103 - }; - - double[] adblImpliedConfidenceLevelReconciler = new double[] { - 0.4306, - 0.4306, - 0.3302, - 0.3302, - 0.3302, - 0.3302, - 0.3294 - }; - - String[] astrAssetID = new String[] { - "US BONDS ", - "INTERNATIONAL BONDS ", - "US LARGE GROWTH ", - "US LARGE VALUE ", - "US SMALL GROWTH ", - "US SMALL VALUE ", - "INTERNATIONAL DEVELOPED EQUITY ", - "INTERNATIONAL EMERGING EQUITY " - }; - - double[] adblAssetEquilibriumWeight = new double[] { - 0.1934, - 0.2613, - 0.1209, - 0.1209, - 0.0134, - 0.0134, - 0.2418, - 0.0349 - }; - - double[][] aadblAssetExcessReturnsCovariance = new double[][] { - { 0.001005, 0.001328, -0.000579, -0.000675, 0.000121, 0.000128, -0.000445, -0.000437}, - { 0.001328, 0.007277, -0.001307, -0.000610, -0.002237, -0.000989, 0.001442, -0.001535}, - {-0.000579, -0.001307, 0.059582, 0.027588, 0.063497, 0.023036, 0.032967, 0.048039}, - {-0.000675, -0.000610, 0.027588, 0.029609, 0.026572, 0.021465, 0.020697, 0.029854}, - { 0.000121, -0.002237, 0.063497, 0.026572, 0.102488, 0.042744, 0.039943, 0.065994}, - { 0.000128, -0.000989, 0.023036, 0.021465, 0.042744, 0.032056, 0.019881, 0.032235}, - {-0.000445, 0.001442, 0.032967, 0.020697, 0.039943, 0.019881, 0.028355, 0.035064}, - {-0.000437, -0.001535, 0.048039, 0.029854, 0.065994, 0.032235, 0.035064, 0.079958} - }; - - double[][] aadblAssetSpaceViewProjection = new double[][] { - { 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 1.00, 0.00}, - { -1.00, 1.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00}, - { 0.00, 0.00, 0.90, -0.90, 0.10, -0.10, 0.00, 0.00} - }; - - double[] adblProjectionExpectedExcessReturns = new double[] { - 0.0525, - 0.0025, - 0.0200 - }; - - double[][] aadblProjectionExcessReturnsCovariance = ProjectionDistributionLoading.ProjectionCovariance ( - aadblAssetExcessReturnsCovariance, - aadblAssetSpaceViewProjection, - dblTau - ); - - R1MultivariateNormal viewDistribution = R1MultivariateNormal.Standard ( - new MultivariateMeta ( - new String[] { - "PROJECTION #1", - "PROJECTION #2", - "PROJECTION #3" - } - ), - adblProjectionExpectedExcessReturns, - aadblProjectionExcessReturnsCovariance - ); - - BlackLittermanCombinationEngine blce = new BlackLittermanCombinationEngine ( - ForwardReverseOptimizationOutput.Reverse ( - Portfolio.Standard ( - astrAssetID, - adblAssetEquilibriumWeight - ), - aadblAssetExcessReturnsCovariance, - dblRiskAversion - ), - new PriorControlSpecification ( - true, - dblRiskFreeRate, - dblTau - ), - new ProjectionSpecification ( - viewDistribution, - aadblAssetSpaceViewProjection - ) - ); - - ProjectionImpliedConfidenceOutput pico = blce.impliedConfidenceRun(); - - ForwardReverseOptimizationOutput frooCustomProjectionConfidence = pico.customConfidenceOutput().adjustedMetrics(); - - double[] adblCustomConfidenceReturns = frooCustomProjectionConfidence.expectedAssetExcessReturns(); - - ForwardReverseOptimizationOutput frooFullProjectionConfidence = pico.fullConfidenceOutput().adjustedMetrics(); - - double[] adblFullConfidenceReturns = frooFullProjectionConfidence.expectedAssetExcessReturns(); - - double[] adblFullConfidenceWeight = pico.fullProjectionConfidenceWeight(); - - double[] adblCustomConfidenceWeight = pico.customProjectionConfidenceWeight(); - - double[] adblFullWeightDeviation = pico.fullProjectionConfidenceDeviation(); - - double[] adblCustomWeightDeviation = pico.customProjectionConfidenceDeviation(); - - double[] adblImpliedConfidenceLevel = pico.level(); - - System.out.println ("\n\n\t|----------------------------------------------------||"); - - System.out.println ("\t| CUSTOM vs. FULL CONFIDENCE RETURNS COMPARISON ||"); - - System.out.println ("\t|----------------------------------------------------||"); - - System.out.println ("\t| ASSET => FULL | CUSTOM ||"); - - System.out.println ("\t|----------------------------------------------------||"); - - for (int i = 0; i < adblFullConfidenceWeight.length; ++i) - System.out.println ("\t| " + - astrAssetID[i] + " => " + - FormatUtil.FormatDouble (adblFullConfidenceReturns[i], 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (adblCustomConfidenceReturns[i], 1, 2, 100.) + "% || " - ); - - System.out.println ("\t|----------------------------------------------------||\n"); - - System.out.println ("\t|----------------------------------------------------------------||"); - - System.out.println ("\t| {IDZO} EQUILIBRIUM WEIGHTS COMPARISON ACROSS CONFIDENCE LEVELS ||"); - - System.out.println ("\t|----------------------------------------------------------------||"); - - System.out.println ("\t| ASSET => FULL | CUSTOM | NONE ||"); - - System.out.println ("\t|----------------------------------------------------------------||"); - - for (int i = 0; i < adblFullConfidenceWeight.length; ++i) - System.out.println ("\t| " + - astrAssetID[i] + " => " + - FormatUtil.FormatDouble (adblFullConfidenceWeightReconciler[i], 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (adblCustomConfidenceWeightReconciler[i], 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetEquilibriumWeight[i], 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t|----------------------------------------------------------------||\n"); - - System.out.println ("\t|----------------------------------------------------------------||"); - - System.out.println ("\t| {DRIP} EQUILIBRIUM WEIGHTS COMPARISON ACROSS CONFIDENCE LEVELS ||"); - - System.out.println ("\t|----------------------------------------------------------------||"); - - System.out.println ("\t| ASSET => FULL | CUSTOM | NONE ||"); - - System.out.println ("\t|----------------------------------------------------------------||"); - - for (int i = 0; i < adblFullConfidenceWeight.length; ++i) - System.out.println ("\t| " + - astrAssetID[i] + " => " + - FormatUtil.FormatDouble (adblFullConfidenceWeight[i], 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (adblCustomConfidenceWeight[i], 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (adblAssetEquilibriumWeight[i], 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t|----------------------------------------------------------------||\n"); - - System.out.println ("\t|----------------------------------------------------------------||"); - - System.out.println ("\t| {IDZO} WEIGHTS DEVIATION COMPARISON ACROSS CONFIDENCE LEVELS ||"); - - System.out.println ("\t|----------------------------------------------------------------||"); - - System.out.println ("\t| ASSET => FULL | CUSTOM | NONE ||"); - - System.out.println ("\t|----------------------------------------------------------------||"); - - for (int i = 0; i < adblFullConfidenceWeight.length - 1; ++i) - System.out.println ("\t| " + - astrAssetID[i] + " => " + - FormatUtil.FormatDouble (adblFullWeightDeviationReconciler[i], 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (adblCustomWeightDeviationReconciler[i], 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (adblImpliedConfidenceLevelReconciler[i], 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t|----------------------------------------------------------------||\n"); - - System.out.println ("\t|----------------------------------------------------------------||"); - - System.out.println ("\t| {DRIP} WEIGHTS DEVIATION COMPARISON ACROSS CONFIDENCE LEVELS ||"); - - System.out.println ("\t|----------------------------------------------------------------||"); - - System.out.println ("\t| ASSET => FULL | CUSTOM | LEVEL ||"); - - System.out.println ("\t|----------------------------------------------------------------||"); - - for (int i = 0; i < adblFullConfidenceWeight.length - 1; ++i) - System.out.println ("\t| " + - astrAssetID[i] + " => " + - FormatUtil.FormatDouble (adblFullWeightDeviation[i], 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (adblCustomWeightDeviation[i], 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (adblImpliedConfidenceLevel[i], 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t|----------------------------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/idzorek/ProjectionImpliedConfidenceTilt.java b/org/drip/sample/idzorek/ProjectionImpliedConfidenceTilt.java deleted file mode 100644 index ad16b67..0000000 --- a/org/drip/sample/idzorek/ProjectionImpliedConfidenceTilt.java +++ /dev/null @@ -1,217 +0,0 @@ - -package org.drip.sample.idzorek; - -import org.drip.measure.bayesian.ProjectionDistributionLoading; -import org.drip.measure.continuousjoint.MultivariateMeta; -import org.drip.measure.gaussian.*; -import org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput; -import org.drip.portfolioconstruction.asset.Portfolio; -import org.drip.portfolioconstruction.bayesian.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ProjectionImpliedConfidenceTilt computes the Tilt induced on an Asset by a User-specified Confidence. The - * References are: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * - Idzorek, T. (2005): A Step-by-Step Guide to the Black-Litterman Model: Incorporating User-Specified - * Confidence Levels, Ibbotson Associates, Chicago - * - * @author Lakshmi Krishnamurthy - */ - -public class ProjectionImpliedConfidenceTilt { - - private static final void DisplayTilt ( - final String[] astrAssetID, - final int iViewIndex, - final double[] adblImpliedTilt, - final double[] adblUnadjustedWeight, - final double dblProjectionUserConfidence) - throws Exception - { - System.out.println ("\t|------------------------------------------------------||"); - - System.out.println ( - "\t| VIEW #" + iViewIndex + " CONFIDENCE => " + - FormatUtil.FormatDouble (dblProjectionUserConfidence, 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t|------------------------------------------------------||"); - - System.out.println ("\t| ASSET ID => TILT | WEIGHT ||"); - - System.out.println ("\t|------------------------------------------------------||"); - - for (int i = 0; i < adblImpliedTilt.length; ++i) - System.out.println ( - "\t| " + astrAssetID[i] + " => " + - FormatUtil.FormatDouble (adblImpliedTilt[i], 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (adblImpliedTilt[i] + adblUnadjustedWeight[i], 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t|------------------------------------------------------||\n"); - } - - public static final void main ( - final String[] astArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblTau = 0.025; - double dblRiskAversion = 3.07; - double dblRiskFreeRate = 0.00; - - String[] astrAssetID = new String[] { - "US BONDS ", - "INTERNATIONAL BONDS ", - "US LARGE GROWTH ", - "US LARGE VALUE ", - "US SMALL GROWTH ", - "US SMALL VALUE ", - "INTERNATIONAL DEVELOPED EQUITY ", - "INTERNATIONAL EMERGING EQUITY " - }; - - double[] adblAssetEquilibriumWeight = new double[] { - 0.1934, - 0.2613, - 0.1209, - 0.1209, - 0.0134, - 0.0134, - 0.2418, - 0.0349 - }; - - double[][] aadblAssetExcessReturnsCovariance = new double[][] { - { 0.001005, 0.001328, -0.000579, -0.000675, 0.000121, 0.000128, -0.000445, -0.000437}, - { 0.001328, 0.007277, -0.001307, -0.000610, -0.002237, -0.000989, 0.001442, -0.001535}, - {-0.000579, -0.001307, 0.059582, 0.027588, 0.063497, 0.023036, 0.032967, 0.048039}, - {-0.000675, -0.000610, 0.027588, 0.029609, 0.026572, 0.021465, 0.020697, 0.029854}, - { 0.000121, -0.002237, 0.063497, 0.026572, 0.102488, 0.042744, 0.039943, 0.065994}, - { 0.000128, -0.000989, 0.023036, 0.021465, 0.042744, 0.032056, 0.019881, 0.032235}, - {-0.000445, 0.001442, 0.032967, 0.020697, 0.039943, 0.019881, 0.028355, 0.035064}, - {-0.000437, -0.001535, 0.048039, 0.029854, 0.065994, 0.032235, 0.035064, 0.079958} - }; - - double[][] aadblAssetSpaceViewProjection = new double[][] { - { 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 1.00, 0.00}, - { -1.00, 1.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00}, - { 0.00, 0.00, 0.90, -0.90, 0.10, -0.10, 0.00, 0.00} - }; - - double[] adblProjectionExpectedExcessReturns = new double[] { - 0.0525, - 0.0025, - 0.0200 - }; - - double[] adblUserSpecifiedProjectionConfidence = new double[] { - 0.25, - 0.50, - 0.65 - }; - - double[][] aadblProjectionExcessReturnsCovariance = ProjectionDistributionLoading.ProjectionCovariance ( - aadblAssetExcessReturnsCovariance, - aadblAssetSpaceViewProjection, - dblTau - ); - - R1MultivariateNormal viewDistribution = R1MultivariateNormal.Standard ( - new MultivariateMeta ( - new String[] { - "PROJECTION #1", - "PROJECTION #2", - "PROJECTION #3" - } - ), - adblProjectionExpectedExcessReturns, - aadblProjectionExcessReturnsCovariance - ); - - BlackLittermanCombinationEngine blce = new BlackLittermanCombinationEngine ( - ForwardReverseOptimizationOutput.Reverse ( - Portfolio.Standard ( - astrAssetID, - adblAssetEquilibriumWeight - ), - aadblAssetExcessReturnsCovariance, - dblRiskAversion - ), - new PriorControlSpecification ( - true, - dblRiskFreeRate, - dblTau - ), - new ProjectionSpecification ( - viewDistribution, - aadblAssetSpaceViewProjection - ) - ); - - double[][] aadblProjectionTilt = blce.userConfidenceProjectionTilt (adblUserSpecifiedProjectionConfidence); - - System.out.println ("\n\n"); - - for (int i = 0; i < adblUserSpecifiedProjectionConfidence.length; ++i) - DisplayTilt ( - astrAssetID, - i, - aadblProjectionTilt[i], - adblAssetEquilibriumWeight, - adblUserSpecifiedProjectionConfidence[i] - ); - } -} diff --git a/org/drip/sample/idzorek/UserConfidenceProjectionCalibration.java b/org/drip/sample/idzorek/UserConfidenceProjectionCalibration.java deleted file mode 100644 index beddfee..0000000 --- a/org/drip/sample/idzorek/UserConfidenceProjectionCalibration.java +++ /dev/null @@ -1,234 +0,0 @@ - -package org.drip.sample.idzorek; - -import org.drip.function.definition.R1ToR1; -import org.drip.measure.bayesian.ProjectionDistributionLoading; -import org.drip.measure.continuousjoint.MultivariateMeta; -import org.drip.measure.gaussian.R1MultivariateNormal; -import org.drip.portfolioconstruction.allocator.ForwardReverseOptimizationOutput; -import org.drip.portfolioconstruction.asset.Portfolio; -import org.drip.portfolioconstruction.bayesian.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * UserConfidenceProjectionCalibration calibrates the Black Litterman Projection Variance using the Implied - * Allocation Tilts. The References are: - * - * - He. G., and R. Litterman (1999): The Intuition behind the Black-Litterman Model Portfolios, Goldman - * Sachs Asset Management - * - * - Idzorek, T. (2005): A Step-by-Step Guide to the Black-Litterman Model: Incorporating User-Specified - * Confidence Levels, Ibbotson Associates, Chicago - * - * @author Lakshmi Krishnamurthy - */ - -public class UserConfidenceProjectionCalibration { - - private static final void IdzorekImpliedProjectionConfidence ( - final BlackLittermanCombinationEngine blce, - final int iViewIndex, - final double[] adblImpliedTilt, - final double dblProjectionUserConfidence) - throws Exception - { - System.out.println ("\t|-----------------------------||"); - - System.out.println ( - "\t| VIEW #" + iViewIndex + " ||" - ); - - System.out.println ("\t|-----------------------------||"); - - System.out.println ( - "\t| CONFIDENCE =>" + - FormatUtil.FormatDouble (dblProjectionUserConfidence, 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t|-----------------------------||"); - - R1ToR1 r1ToR1TiltDeparture = blce.tiltDepartureR1ToR1 ( - adblImpliedTilt, - iViewIndex, - false - ); - - R1ToR1 r1ToR1TiltDerivative = blce.tiltDepartureR1ToR1 ( - adblImpliedTilt, - iViewIndex, - true - ); - - for (int i = 1; i <= 15; ++i) - System.out.println ("\t| " + - FormatUtil.FormatDouble (0.01 * i, 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (r1ToR1TiltDeparture.evaluate (0.01 * i), 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (r1ToR1TiltDerivative.evaluate (0.01 * i), 2, 2, 100.) + "% ||" - ); - - /* FixedPointFinderOutput fpfo = new FixedPointFinderBrent (0., r1ToR1TiltDerivative, false).findRoot(); - - System.out.println (fpfo.getRoot()); */ - - System.out.println ("\t|-----------------------------||\n"); - } - - public static final void main ( - final String[] astArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblTau = 0.025; - double dblRiskAversion = 3.07; - double dblRiskFreeRate = 0.00; - - String[] astrAssetID = new String[] { - "US BONDS ", - "INTERNATIONAL BONDS ", - "US LARGE GROWTH ", - "US LARGE VALUE ", - "US SMALL GROWTH ", - "US SMALL VALUE ", - "INTERNATIONAL DEVELOPED EQUITY ", - "INTERNATIONAL EMERGING EQUITY " - }; - - double[] adblAssetEquilibriumWeight = new double[] { - 0.1934, - 0.2613, - 0.1209, - 0.1209, - 0.0134, - 0.0134, - 0.2418, - 0.0349 - }; - - double[][] aadblAssetExcessReturnsCovariance = new double[][] { - { 0.001005, 0.001328, -0.000579, -0.000675, 0.000121, 0.000128, -0.000445, -0.000437}, - { 0.001328, 0.007277, -0.001307, -0.000610, -0.002237, -0.000989, 0.001442, -0.001535}, - {-0.000579, -0.001307, 0.059582, 0.027588, 0.063497, 0.023036, 0.032967, 0.048039}, - {-0.000675, -0.000610, 0.027588, 0.029609, 0.026572, 0.021465, 0.020697, 0.029854}, - { 0.000121, -0.002237, 0.063497, 0.026572, 0.102488, 0.042744, 0.039943, 0.065994}, - { 0.000128, -0.000989, 0.023036, 0.021465, 0.042744, 0.032056, 0.019881, 0.032235}, - {-0.000445, 0.001442, 0.032967, 0.020697, 0.039943, 0.019881, 0.028355, 0.035064}, - {-0.000437, -0.001535, 0.048039, 0.029854, 0.065994, 0.032235, 0.035064, 0.079958} - }; - - double[][] aadblAssetSpaceViewProjection = new double[][] { - { 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 1.00, 0.00}, - { -1.00, 1.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00}, - { 0.00, 0.00, 0.90, -0.90, 0.10, -0.10, 0.00, 0.00} - }; - - double[] adblProjectionExpectedExcessReturns = new double[] { - 0.0525, - 0.0025, - 0.0200 - }; - - double[] adblUserSpecifiedProjectionConfidence = new double[] { - 0.25, - 0.50, - 0.65 - }; - - double[][] aadblProjectionExcessReturnsCovariance = ProjectionDistributionLoading.ProjectionCovariance ( - aadblAssetExcessReturnsCovariance, - aadblAssetSpaceViewProjection, - dblTau - ); - - R1MultivariateNormal viewDistribution = R1MultivariateNormal.Standard ( - new MultivariateMeta ( - new String[] { - "PROJECTION #1", - "PROJECTION #2", - "PROJECTION #3" - } - ), - adblProjectionExpectedExcessReturns, - aadblProjectionExcessReturnsCovariance - ); - - BlackLittermanCombinationEngine blce = new BlackLittermanCombinationEngine ( - ForwardReverseOptimizationOutput.Reverse ( - Portfolio.Standard ( - astrAssetID, - adblAssetEquilibriumWeight - ), - aadblAssetExcessReturnsCovariance, - dblRiskAversion - ), - new PriorControlSpecification ( - true, - dblRiskFreeRate, - dblTau - ), - new ProjectionSpecification ( - viewDistribution, - aadblAssetSpaceViewProjection - ) - ); - - double[][] aadblProjectionTilt = blce.userConfidenceProjectionTilt (adblUserSpecifiedProjectionConfidence); - - System.out.println ("\n\n"); - - for (int i = 0; i < adblUserSpecifiedProjectionConfidence.length; ++i) - IdzorekImpliedProjectionConfidence ( - blce, - i, - aadblProjectionTilt[i], - adblUserSpecifiedProjectionConfidence[i] - ); - } -} diff --git a/org/drip/sample/json/Test.java b/org/drip/sample/json/Test.java deleted file mode 100644 index 4fb328f..0000000 --- a/org/drip/sample/json/Test.java +++ /dev/null @@ -1,438 +0,0 @@ - -package org.drip.sample.json; - -import java.io.*; -import java.util.*; - -import org.drip.json.parser.*; -import org.drip.json.simple.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * Test is an Adaptation of the Test Class from the RFC4627 compliant JSON Simple - * (https://code.google.com/p/json-simple/). - * - * @author Fang Yidong - * @author Lakshmi Krishnamurthy - */ - -public class Test { - - @SuppressWarnings ("rawtypes") public static final void testDecode() throws Exception{ - System.out.println("=======decode======="); - - String s="[0,{\"1\":{\"2\":{\"3\":{\"4\":[5,{\"6\":7}]}}}}]"; - Object obj=JSONValue.parse(s); - JSONArray array=(JSONArray)obj; - System.out.println("======the 2nd element of array======"); - System.out.println(array.get(1)); - System.out.println(); - System.out.println ("{\"1\":{\"2\":{\"3\":{\"4\":[5,{\"6\":7}]}}}}".equalsIgnoreCase(array.get(1).toString())); - - JSONObject obj2=(JSONObject)array.get(1); - System.out.println("======field \"1\"=========="); - System.out.println(obj2.get("1")); - System.out.println ("{\"2\":{\"3\":{\"4\":[5,{\"6\":7}]}}}".equalsIgnoreCase(obj2.get("1").toString())); - - s="{}"; - obj=JSONValue.parse(s); - System.out.println ("{}".equalsIgnoreCase(obj.toString())); - - s="[5,]"; - obj=JSONValue.parse(s); - System.out.println ("[5]".equalsIgnoreCase(obj.toString())); - - s="[5,,2]"; - obj=JSONValue.parse(s); - System.out.println ("[5,2]".equalsIgnoreCase(obj.toString())); - - s="[\"hello\\bworld\\\"abc\\tdef\\\\ghi\\rjkl\\n123\\u4e2d\"]"; - obj=JSONValue.parse(s); - System.out.println ("hello\bworld\"abc\tdef\\ghi\rjkl\n123中".equalsIgnoreCase(((List)obj).get(0).toString())); - - JSONParser parser = new JSONParser(); - s="{\"name\":"; - try{ - obj = parser.parse(s); - } - catch(ParseException pe){ - System.out.println (ParseException.ERROR_UNEXPECTED_TOKEN == pe.getErrorType()); - System.out.println (8 == pe.getPosition()); - } - - s="{\"name\":}"; - try{ - obj = parser.parse(s); - } - catch(ParseException pe){ - System.out.println (ParseException.ERROR_UNEXPECTED_TOKEN == pe.getErrorType()); - System.out.println (8 == pe.getPosition()); - } - - - s="{\"name"; - try{ - obj = parser.parse(s); - } - catch(ParseException pe){ - System.out.println (ParseException.ERROR_UNEXPECTED_TOKEN == pe.getErrorType()); - System.out.println (6 == pe.getPosition()); - } - - - s = "[[null, 123.45, \"a\\\tb c\"}, true]"; - try{ - parser.parse(s); - } - catch(ParseException pe){ - System.out.println (24 == pe.getPosition()); - System.out.println("Error at character position: " + pe.getPosition()); - switch(pe.getErrorType()){ - case ParseException.ERROR_UNEXPECTED_TOKEN: - System.out.println("Unexpected token: " + pe.getUnexpectedObject()); - break; - case ParseException.ERROR_UNEXPECTED_CHAR: - System.out.println("Unexpected character: " + pe.getUnexpectedObject()); - break; - case ParseException.ERROR_UNEXPECTED_EXCEPTION: - ((Exception)pe.getUnexpectedObject()).printStackTrace(); - break; - } - } - - s = "{\"first\": 123, \"second\": [4, 5, 6], \"third\": 789}"; - ContainerFactory containerFactory = new ContainerFactory(){ - public List creatArrayContainer() { - return new LinkedList(); - } - - public Map createObjectContainer() { - return new LinkedHashMap(); - } - - }; - - try{ - Map json = (Map)parser.parse(s, containerFactory); - Iterator iter = json.entrySet().iterator(); - System.out.println("==iterate result=="); - while(iter.hasNext()){ - Map.Entry entry = (Map.Entry)iter.next(); - System.out.println(entry.getKey() + "=>" + entry.getValue()); - } - - System.out.println("==toJSONString()=="); - System.out.println(JSONValue.toJSONString(json)); - System.out.println ("{\"first\":123,\"second\":[4,5,6],\"third\":789}".equalsIgnoreCase(JSONValue.toJSONString(json))); - } - catch(ParseException pe){ - pe.printStackTrace(); - } - - s = "{\"first\": 123, \"second\": [{\"s1\":{\"s11\":\"v11\"}}, 4, 5, 6], \"third\": 789}"; - ContentHandler myHandler = new ContentHandler() { - - public boolean endArray() throws ParseException { - System.out.println("endArray()"); - return true; - } - - public void endJSON() throws ParseException { - System.out.println("endJSON()"); - } - - public boolean endObject() throws ParseException { - System.out.println("endObject()"); - return true; - } - - public boolean endObjectEntry() throws ParseException { - System.out.println("endObjectEntry()"); - return true; - } - - public boolean primitive(Object value) throws ParseException { - System.out.println("primitive(): " + value); - return true; - } - - public boolean startArray() throws ParseException { - System.out.println("startArray()"); - return true; - } - - public void startJSON() throws ParseException { - System.out.println("startJSON()"); - } - - public boolean startObject() throws ParseException { - System.out.println("startObject()"); - return true; - } - - public boolean startObjectEntry(String key) throws ParseException { - System.out.println("startObjectEntry(), key:" + key); - return true; - } - - }; - try{ - parser.parse(s, myHandler); - } - catch(ParseException pe){ - pe.printStackTrace(); - } - - class KeyFinder implements ContentHandler{ - private Object value; - private boolean found = false; - private boolean end = false; - private String key; - private String matchKey; - - public void setMatchKey(String matchKey){ - this.matchKey = matchKey; - } - - public Object getValue(){ - return value; - } - - public boolean isEnd(){ - return end; - } - - public void setFound(boolean found){ - this.found = found; - } - - public boolean isFound(){ - return found; - } - - public void startJSON() throws ParseException, IOException { - found = false; - end = false; - } - - public void endJSON() throws ParseException, IOException { - end = true; - } - - public boolean primitive(Object value) throws ParseException, IOException { - if(key != null){ - if(key.equals(matchKey)){ - found = true; - this.value = value; - key = null; - return false; - } - } - return true; - } - - public boolean startArray() throws ParseException, IOException { - return true; - } - - - public boolean startObject() throws ParseException, IOException { - return true; - } - - public boolean startObjectEntry(String key) throws ParseException, IOException { - this.key = key; - return true; - } - - public boolean endArray() throws ParseException, IOException { - return false; - } - - public boolean endObject() throws ParseException, IOException { - return true; - } - - public boolean endObjectEntry() throws ParseException, IOException { - return true; - } - }; - - s = "{\"first\": 123, \"second\": [{\"k1\":{\"id\":\"id1\"}}, 4, 5, 6, {\"id\": 123}], \"third\": 789, \"id\": null}"; - parser.reset(); - KeyFinder keyFinder = new KeyFinder(); - keyFinder.setMatchKey("id"); - int i = 0; - try{ - while(!keyFinder.isEnd()){ - parser.parse(s, keyFinder, true); - if(keyFinder.isFound()){ - i++; - keyFinder.setFound(false); - System.out.println("found id:"); - System.out.println(keyFinder.getValue()); - if(i == 1) - System.out.println ("id1".equalsIgnoreCase((String)keyFinder.getValue())); - if(i == 2){ - System.out.println (keyFinder.getValue() instanceof Number); - System.out.println ("123".equalsIgnoreCase(String.valueOf(keyFinder.getValue()))); - } - if(i == 3) - System.out.println (null == keyFinder.getValue()); - } - } - } - catch(ParseException pe){ - pe.printStackTrace(); - } - } - - @SuppressWarnings ({"rawtypes", "unchecked"}) public static final void testEncode() throws Exception{ - System.out.println("=======encode======="); - - JSONArray array1=new JSONArray(); - array1.add("abc\u0010a/"); - array1.add(new Integer(123)); - array1.add(new Double(222.123)); - array1.add(new Boolean(true)); - System.out.println("======array1=========="); - System.out.println(array1); - System.out.println(); - System.out.println ("[\"abc\\u0010a\\/\",123,222.123,true]".equalsIgnoreCase(array1.toString())); - - JSONObject obj1=new JSONObject(); - obj1.put("name","fang"); - obj1.put("age",new Integer(27)); - obj1.put("is_developer",new Boolean(true)); - obj1.put("weight",new Double(60.21)); - obj1.put("array1",array1); - System.out.println("======obj1 with array1==========="); - System.out.println(obj1); - System.out.println(); - System.out.println ("{\"array1\":[\"abc\\u0010a\\/\",123,222.123,true],\"weight\":60.21,\"age\":27,\"name\":\"fang\",\"is_developer\":true}".equalsIgnoreCase(obj1.toString())); - - obj1.remove("array1"); - array1.add(obj1); - System.out.println("======array1 with obj1========"); - System.out.println(array1); - System.out.println(); - System.out.println ("[\"abc\\u0010a\\/\",123,222.123,true,{\"weight\":60.21,\"age\":27,\"name\":\"fang\",\"is_developer\":true}]".equalsIgnoreCase(array1.toString())); - - List list = new ArrayList(); - list.add("abc\u0010a/"); - list.add(new Integer(123)); - list.add(new Double(222.123)); - list.add(new Boolean(true)); - list.add(null); - System.out.println("======list=========="); - System.out.println(JSONArray.toJSONString(list)); - System.out.println(); - System.out.println ("[\"abc\\u0010a\\/\",123,222.123,true,null]".equalsIgnoreCase(JSONArray.toJSONString(list))); - - Map map = new HashMap(); - map.put("name","fang"); - map.put("age",new Integer(27)); - map.put("is_developer",new Boolean(true)); - map.put("weight",new Double(60.21)); - map.put("array1",list); - System.out.println("======map with list==========="); - System.out.println(map); - System.out.println(); - System.out.println ("{\"array1\":[\"abc\\u0010a\\/\",123,222.123,true,null],\"weight\":60.21,\"age\":27,\"name\":\"fang\",\"is_developer\":true}".equalsIgnoreCase(JSONObject.toJSONString(map))); - - Map m1 = new LinkedHashMap(); - Map m2 = new HashMap(); - List l1 = new LinkedList(); - - m1.put("k11","v11"); - m1.put("k12","v12"); - m1.put("k13", "v13"); - m2.put("k21","v21"); - m2.put("k22","v22"); - m2.put("k23","v23"); - l1.add(m1); - l1.add(m2); - String jsonString = JSONValue.toJSONString(l1); - System.out.println(jsonString); - System.out.println ("[{\"k11\":\"v11\",\"k12\":\"v12\",\"k13\":\"v13\"},{\"k22\":\"v22\",\"k21\":\"v21\",\"k23\":\"v23\"}]".equalsIgnoreCase(jsonString)); - - StringWriter out = new StringWriter(); - JSONValue.writeJSONString(l1, out); - jsonString = out.toString(); - System.out.println(jsonString); - System.out.println ("[{\"k11\":\"v11\",\"k12\":\"v12\",\"k13\":\"v13\"},{\"k22\":\"v22\",\"k21\":\"v21\",\"k23\":\"v23\"}]".equalsIgnoreCase(jsonString)); - - List l2 = new LinkedList(); - Map m3 = new LinkedHashMap(); - m3.put("k31", "v3"); - m3.put("k32", new Double(123.45)); - m3.put("k33", new Boolean(false)); - m3.put("k34", null); - l2.add("vvv"); - l2.add("1.23456789123456789"); - l2.add(new Boolean(true)); - l2.add(null); - m3.put("k35", l2); - m1.put("k14", m3); - out = new StringWriter(); - JSONValue.writeJSONString(l1, out); - jsonString = out.toString(); - System.out.println(jsonString); - System.out.println ("[{\"k11\":\"v11\",\"k12\":\"v12\",\"k13\":\"v13\",\"k14\":{\"k31\":\"v3\",\"k32\":123.45,\"k33\":false,\"k34\":null,\"k35\":[\"vvv\",\"1.23456789123456789\",true,null]}},{\"k22\":\"v22\",\"k21\":\"v21\",\"k23\":\"v23\"}]".equalsIgnoreCase(jsonString)); -} - - public static final void main ( - final String[] astrArgs) - throws Exception - { - testEncode(); - - testDecode(); - } -} diff --git a/org/drip/sample/json/YylexTest.java b/org/drip/sample/json/YylexTest.java deleted file mode 100644 index 4966a2b..0000000 --- a/org/drip/sample/json/YylexTest.java +++ /dev/null @@ -1,141 +0,0 @@ - -package org.drip.sample.json; - -import java.io.*; - -import org.drip.json.parser.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * YylexTest is an Adaptation of the YylexTest Class from the RFC4627 compliant JSON Simple - * (https://code.google.com/p/json-simple/). - * - * @author Fang Yidong - * @author Lakshmi Krishnamurthy - */ - -public class YylexTest { - - public static final void testYylex() throws Exception{ - String s="\"\\/\""; - System.out.println(s); - StringReader in = new StringReader(s); - Yylex lexer=new Yylex(in); - Yytoken token=lexer.yylex(); - System.out.println (Yytoken.TYPE_VALUE == token.type); - System.out.println ("/".equalsIgnoreCase ((String) token.value)); - - s="\"abc\\/\\r\\b\\n\\t\\f\\\\\""; - System.out.println(s); - in = new StringReader(s); - lexer=new Yylex(in); - token=lexer.yylex(); - System.out.println (Yytoken.TYPE_VALUE == token.type); - System.out.println ("abc/\r\b\n\t\f\\".equalsIgnoreCase ((String)token.value)); - - s="[\t \n\r\n{ \t \t\n\r}"; - System.out.println(s); - in = new StringReader(s); - lexer=new Yylex(in); - token=lexer.yylex(); - System.out.println (Yytoken.TYPE_LEFT_SQUARE == token.type); - token=lexer.yylex(); - System.out.println (Yytoken.TYPE_LEFT_BRACE == token.type); - token=lexer.yylex(); - System.out.println (Yytoken.TYPE_RIGHT_BRACE == token.type); - - s="\b\f{"; - System.out.println(s); - in = new StringReader(s); - lexer=new Yylex(in); - ParseException err=null; - try{ - token=lexer.yylex(); - } - catch(ParseException e){ - err=e; - System.out.println("error:"+err); - System.out.println (ParseException.ERROR_UNEXPECTED_CHAR == e.getErrorType()); - System.out.println (0 == e.getPosition()); - System.out.println (new Character('\b') == e.getUnexpectedObject()); - } - catch(IOException ie){ - throw ie; - } - System.out.println (err!=null); - - s="{a : b}"; - System.out.println(s); - in = new StringReader(s); - lexer=new Yylex(in); - err=null; - try{ - lexer.yylex(); - token=lexer.yylex(); - } - catch(ParseException e){ - err=e; - System.out.println("error:"+err); - System.out.println (ParseException.ERROR_UNEXPECTED_CHAR == e.getErrorType()); - System.out.println (new Character('a') == e.getUnexpectedObject()); - System.out.println (1 == e.getPosition()); - } - catch(IOException ie){ - throw ie; - } - System.out.println (err!=null); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - testYylex(); - } -} diff --git a/org/drip/sample/lmm/ContinuousForwardRateVolatility.java b/org/drip/sample/lmm/ContinuousForwardRateVolatility.java deleted file mode 100644 index 0181f6d..0000000 --- a/org/drip/sample/lmm/ContinuousForwardRateVolatility.java +++ /dev/null @@ -1,256 +0,0 @@ - -package org.drip.sample.lmm; - -import org.drip.analytics.date.JulianDate; -import org.drip.analytics.definition.MarketSurface; -import org.drip.dynamics.lmm.LognormalLIBORVolatility; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ContinuousForwardRateVolatility demonstrates the Implying of the Volatility of the Continuously - * Compounded Forward Rate from the Corresponding LIBOR Forward Rate Volatility. The References are: - * - * 1) Goldys, B., M. Musiela, and D. Sondermann (1994): Log-normality of Rates and Term Structure Models, - * The University of New South Wales. - * - * 2) Musiela, M. (1994): Nominal Annual Rates and Log-normal Volatility Structure, The University of New - * South Wales. - * - * 3) Brace, A., D. Gatarek, and M. Musiela (1997): The Market Model of Interest Rate Dynamics, Mathematical - * Finance 7 (2), 127-155. - * - * @author Lakshmi Krishnamurthy - */ - -public class ContinuousForwardRateVolatility { - - private static final MarketSurface FlatVolatilitySurface ( - final JulianDate dtStart, - final String strCurrency, - final double dblFlatVol) - throws Exception - { - return ScenarioMarketSurfaceBuilder.CustomSplineWireSurface ( - "VIEW_TARGET_VOLATILITY_SURFACE", - dtStart, - strCurrency, - new double[] { - dtStart.julian(), - dtStart.addYears (2).julian(), - dtStart.addYears (4).julian(), - dtStart.addYears (6).julian(), - dtStart.addYears (8).julian(), - dtStart.addYears (10).julian() - }, - new double[] { - dtStart.julian(), - dtStart.addYears (2).julian(), - dtStart.addYears (4).julian(), - dtStart.addYears (6).julian(), - dtStart.addYears (8).julian(), - dtStart.addYears (10).julian() - }, - new double[][] { - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - }, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ), - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ) - ); - } - - private static final void DisplayVolArray ( - final String strTenor, - final double[] adblVol) - { - String strDump = "\t | " + strTenor + " => "; - - for (int i = 0; i < adblVol.length; ++i) - strDump += FormatUtil.FormatDouble (adblVol[i], 1, 2, 100.) + "% |"; - - System.out.println (strDump); - } - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strTenor = "3M"; - String strCurrency = "USD"; - double dblFlatVol1 = 0.35; - double dblFlatVol2 = 0.42; - double dblFlatVol3 = 0.27; - double dblFlatForwardRate = 0.02; - - int[] aiNumFactor = { - 1, 2, 3 - }; - - String[] astrForwardTenor = { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y" - }; - - ForwardLabel forwardLabel = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - JulianDate dtSpot = org.drip.analytics.date.DateUtil.Today(); - - MarketSurface mktSurfFlatVol1 = FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol1 - ); - - MarketSurface mktSurfFlatVol2 = FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol2 - ); - - MarketSurface mktSurfFlatVol3 = FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol3 - ); - - ForwardCurve fc = ScenarioForwardCurveBuilder.FlatForwardForwardCurve ( - dtSpot, - forwardLabel, - dblFlatForwardRate - ); - - for (int iNumFactor : aiNumFactor) { - LognormalLIBORVolatility llv = new LognormalLIBORVolatility ( - dtSpot.julian(), - forwardLabel, - new MarketSurface[] { - mktSurfFlatVol1, - mktSurfFlatVol2, - mktSurfFlatVol3 - }, - new PrincipalFactorSequenceGenerator ( - new UnivariateSequenceGenerator[] { - new BoxMullerGaussian ( - 0., - 1. - ), - new BoxMullerGaussian ( - 0., - 1. - ), - new BoxMullerGaussian ( - 0., - 1. - ) - }, - new double[][] { - {1.0, 0.1, 0.2}, - {0.1, 1.0, 0.2}, - {0.2, 0.1, 1.0} - }, - iNumFactor - ) - ); - - System.out.println ("\n\t |------------------------------|"); - - System.out.println ("\t | CONTINUOUS FORWARD RATE VOL |"); - - System.out.println ("\t | Num Factors: " + iNumFactor + " |"); - - System.out.println ("\t |------------------------------|"); - - for (String strForwardTenor : astrForwardTenor) - DisplayVolArray ( - strForwardTenor, - llv.continuousForwardVolatility ( - dtSpot.addTenor (strForwardTenor).julian(), - fc - ) - ); - - System.out.println ("\t |------------------------------|"); - } - } -} diff --git a/org/drip/sample/lmm/FixFloatMonteCarloEvolver.java b/org/drip/sample/lmm/FixFloatMonteCarloEvolver.java deleted file mode 100644 index b2f03ee..0000000 --- a/org/drip/sample/lmm/FixFloatMonteCarloEvolver.java +++ /dev/null @@ -1,874 +0,0 @@ - -package org.drip.sample.lmm; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.analytics.definition.MarketSurface; -import org.drip.analytics.support.CompositePeriodBuilder; -import org.drip.dynamics.lmm.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.grid.OverlappingStretchSpan; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.*; -import org.drip.state.curve.BasisSplineForwardRate; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FixFloatMonteCarloEvolver demonstrates the steps associated with a LMM-Based Monte-Carlo pricing of a - * Standard Fix-Float Swap. The References are: - * - * 1) Goldys, B., M. Musiela, and D. Sondermann (1994): Log-normality of Rates and Term Structure Models, - * The University of New South Wales. - * - * 2) Musiela, M. (1994): Nominal Annual Rates and Log-normal Volatility Structure, The University of New - * South Wales. - * - * 3) Brace, A., D. Gatarek, and M. Musiela (1997): The Market Model of Interest Rate Dynamics, Mathematical - * Finance 7 (2), 127-155. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixFloatMonteCarloEvolver { - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < aiDay.length; ++i) { - aDeposit[i] = new SingleStreamComponent ( - "DEPOSIT_" + aiDay[i], - new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.EdgePair ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ) - ), - cps, - cfus - ) - ), - csp - ); - - aDeposit[i].setPrimaryCode (aiDay[i] + "D"); - } - - return aDeposit; - } - - /* - * Construct the Swap Instrument from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent SwapInstrumentFromMaturityTenor ( - final JulianDate dtEffective, - final String strCurrency, - final double dblFixedCoupon, - final String strMaturityTenor) - throws Exception - { - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 4, - "Act/360", - false, - "Act/360", - false, - strCurrency, - true, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - dblFixedCoupon, - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - strMaturityTenor, - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - strMaturityTenor, - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent irs = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - irs.setPrimaryCode ("IRS." + strMaturityTenor + "." + strCurrency); - - return irs; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtEffective, - final String strCurrency, - final String[] astrMaturityTenor) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = SwapInstrumentFromMaturityTenor ( - dtEffective, - strCurrency, - 0., - astrMaturityTenor[i] - ); - - return aIRS; - } - - /* - * This sample demonstrates discount curve calibration and input instrument calibration quote recovery. - * It shows the following: - * - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve OTCInstrumentCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 7, 14, 30, 60 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0013, 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of EDF Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aEDFComp = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtSpot, - 8, - strCurrency - ); - - double[] adblEDFQuote = new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }; - - /* - * Construct the EDF Instrument Set Stretch Builder - */ - - LatentStateStretchSpec edfStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "EDF", - aEDFComp, - "ForwardRate", - adblEDFQuote - ); - - /* - * Construct the Array of Swap Instruments and their Quotes from the given set of parameters - */ - - FixFloatComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - } - ); - - double[] adblSwapQuote = new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }; - - /* - * Construct the Swap Instrument Set Stretch Builder - */ - - LatentStateStretchSpec swapStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SWAP", - aSwapComp, - "SwapRate", - adblSwapQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - edfStretch, - swapStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit, Futures, and Swap Stretches. - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - CurveSurfaceQuoteContainer csqs = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Cross-Comparison of the Deposit Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t[" + aDepositComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aDepositComp[i].measureValue (valParams, null, csqs, - null, "Rate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the EDF Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t EDF INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aEDFComp.length; ++i) - System.out.println ("\t[" + aEDFComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aEDFComp[i].measureValue (valParams, null, csqs, null, "Rate"), 1, 6, 1.) - + " | " + FormatUtil.FormatDouble (adblEDFQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t SWAP INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aSwapComp.length; ++i) - System.out.println ("\t[" + aSwapComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aSwapComp[i].measureValue (valParams, null, csqs, null, "CalibSwapRate"), 1, 6, 1.) - + " | " + FormatUtil.FormatDouble (adblSwapQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aSwapComp[i].measureValue (valParams, null, csqs, null, "FairPremium"), 1, 6, 1.)); - - return dc; - } - - private static final ForwardCurve LIBORSpan ( - final MergedDiscountForwardCurve dc, - final ForwardLabel forwardLabel, - final SegmentCustomBuilderControl scbc, - final JulianDate dtView, - final int iNumForwardTenor) - throws Exception - { - int[] aiDate = new int[iNumForwardTenor + 1]; - double[] adblLIBOR = new double[iNumForwardTenor + 1]; - SegmentCustomBuilderControl[] aSCBC = new SegmentCustomBuilderControl[iNumForwardTenor]; - - JulianDate dtForward = dtView.subtractTenor (forwardLabel.tenor()); - - for (int i = 0; i <= iNumForwardTenor; ++i) { - if (iNumForwardTenor != i) aSCBC[i] = scbc; - - aiDate[i] = dtForward.julian(); - - adblLIBOR[i] = dc.libor (dtForward, forwardLabel.tenor()); - - dtForward = dtForward.addTenor (forwardLabel.tenor()); - } - - return new BasisSplineForwardRate ( - forwardLabel, - new OverlappingStretchSpan ( - MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator ( - "SPOT_QM_LIBOR", - aiDate, - adblLIBOR, - aSCBC, - null, - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE - ) - ) - ); - } - - private static final MarketSurface FlatVolatilitySurface ( - final JulianDate dtStart, - final String strCurrency, - final double dblFlatVol) - throws Exception - { - return ScenarioMarketSurfaceBuilder.CustomSplineWireSurface ( - "VIEW_TARGET_VOLATILITY_SURFACE", - dtStart, - strCurrency, - new double[] { - dtStart.julian(), - dtStart.addYears (2).julian(), - dtStart.addYears (4).julian(), - dtStart.addYears (6).julian(), - dtStart.addYears (8).julian(), - dtStart.addYears (10).julian() - }, - new double[] { - dtStart.julian(), - dtStart.addYears (2).julian(), - dtStart.addYears (4).julian(), - dtStart.addYears (6).julian(), - dtStart.addYears (8).julian(), - dtStart.addYears (10).julian() - }, - new double[][] { - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - }, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ), - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ) - ); - } - - private static final LognormalLIBORVolatility LLVInstance ( - final int iSpotDate, - final ForwardLabel forwardLabel, - final MarketSurface[] aMS, - final double[][] aadblCorrelation, - final int iNumFactor) - throws Exception - { - UnivariateSequenceGenerator[] aUSG = new UnivariateSequenceGenerator[aMS.length]; - - for (int i = 0; i < aUSG.length; ++i) - aUSG[i] = new BoxMullerGaussian ( - 0., - 1. - ); - - return new LognormalLIBORVolatility ( - iSpotDate, - forwardLabel, - aMS, - new PrincipalFactorSequenceGenerator ( - aUSG, - aadblCorrelation, - iNumFactor - ) - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strForwardTenor = "3M"; - String strViewTenor = "6M"; - String strSimulationTenor = "6M"; - String strSwapTenor = "5Y"; - String strCurrency = "USD"; - double dblFlatVol1 = 0.35; - double dblFlatVol2 = 0.42; - double dblFlatVol3 = 0.27; - int iNumForwardTenor = 30; - int iNumFactor = 2; - int iNumRun = 100; - - double[][] aadblCorrelation = new double[][] { - {1.0, 0.1, 0.2}, - {0.1, 1.0, 0.2}, - {0.2, 0.1, 1.0} - }; - - SegmentCustomBuilderControl scbc = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (1.) - ), - null - ); - - JulianDate dtSpot = org.drip.analytics.date.DateUtil.Today(); - - MarketSurface[] aMS = new MarketSurface[] { - FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol1 - ), - FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol2 - ), - FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol3 - ) - }; - - FundingLabel fundingLabel = FundingLabel.Standard ( - strCurrency - ); - - ForwardLabel forwardLabel = ForwardLabel.Create ( - strCurrency, - strForwardTenor - ); - - JulianDate dtView = dtSpot.addTenor ( - strViewTenor - ); - - JulianDate dtSimulationEnd = dtSpot.addTenor ( - strSimulationTenor - ); - - MergedDiscountForwardCurve dc = OTCInstrumentCurve ( - dtSpot, - strCurrency - ); - - FixFloatComponent ffcFixFloat = SwapInstrumentFromMaturityTenor ( - dtView, - strCurrency, - 0., - strSwapTenor - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - ForwardCurve fc = LIBORSpan ( - dc, - forwardLabel, - scbc, - dtView, - iNumForwardTenor - ); - - CurveSurfaceQuoteContainer csqs = MarketParamsBuilder.DiscountForward ( - dc, - fc - ); - - double dblBaselineSwapRate = ffcFixFloat.value ( - valParams, - null, - csqs, - null - ).get ( - "FairPremium" - ); - - ffcFixFloat = SwapInstrumentFromMaturityTenor ( - dtSpot, - strCurrency, - dblBaselineSwapRate, - strSwapTenor - ); - - LognormalLIBORCurveEvolver llce = LognormalLIBORCurveEvolver.Create ( - fundingLabel, - forwardLabel, - iNumForwardTenor, - scbc - ); - - BGMCurveUpdate bgmInitial = BGMCurveUpdate.Create ( - fundingLabel, - forwardLabel, - dtSpot.julian(), - dtSpot.julian(), - fc, - null, - dc, - null, - null, - null, - null, - null, - LLVInstance ( - dtSpot.julian(), - forwardLabel, - aMS, - aadblCorrelation, - iNumFactor - ) - ); - - ForwardCurve[] aFCLIBOR = llce.simulateTerminalLatentState ( - dtSpot.julian(), - dtSimulationEnd.julian(), - 1, - dtView.julian(), - bgmInitial, - iNumRun - ); - - System.out.println ("\n\t||---------------------------------||"); - - System.out.println ("\t|| SIML | BASE | PV | ITM ||"); - - System.out.println ("\t||---------------------------------||"); - - int iNumITM = 0; - double dblOptionPayout = 0.; - - for (int i = 0; i < iNumRun; ++i) { - Map mapScenOutput = ffcFixFloat.value ( - new ValuationParams ( - dtSimulationEnd, - dtSimulationEnd, - strCurrency - ), - null, - MarketParamsBuilder.DiscountForward ( - dc, - aFCLIBOR[i] - ), - null - ); - - double dblSimulatedPayout = mapScenOutput.get ("PV"); - - double dblSimulatedSwapRate = mapScenOutput.get ("FairPremium"); - - boolean bITM = dblSimulatedSwapRate < dblBaselineSwapRate; - - if (bITM) { - ++iNumITM; - dblOptionPayout += dblSimulatedPayout; - } - - System.out.println ("\t|| " + - FormatUtil.FormatDouble (dblSimulatedSwapRate, 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblBaselineSwapRate, 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblSimulatedPayout, 1, 2, 1.) + " | " + - (bITM ? " OUI ||" : " NON ||") - ); - } - - System.out.println ("\t||---------------------------------||"); - - System.out.println ("\n\t||---------------------------||"); - - System.out.println ("\t|| ITM Success Rate:" + - FormatUtil.FormatDouble (((double) iNumITM) / iNumRun, 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t|| Option Payout :" + - FormatUtil.FormatDouble (dblOptionPayout / iNumRun, 1, 4, 1.) + " ||" - ); - - System.out.println ("\t|| Option PV :" + - FormatUtil.FormatDouble (dblOptionPayout * dc.df (dtSimulationEnd) / iNumRun, 1, 4, 1.) + " ||" - ); - - System.out.println ("\t||---------------------------||"); - } -} diff --git a/org/drip/sample/lmm/MultiFactorCurveDynamics.java b/org/drip/sample/lmm/MultiFactorCurveDynamics.java deleted file mode 100644 index 9c769a9..0000000 --- a/org/drip/sample/lmm/MultiFactorCurveDynamics.java +++ /dev/null @@ -1,809 +0,0 @@ - -package org.drip.sample.lmm; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.analytics.definition.MarketSurface; -import org.drip.analytics.support.CompositePeriodBuilder; -import org.drip.dynamics.lmm.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.grid.Span; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * MultiFactorCurveDynamics demonstrates the Construction and Usage of the Curve LIBOR State Evolver, and the - * eventual Evolution of the related Discount/Forward Latent State Quantification Metrics. The References - * are: - * - * 1) Goldys, B., M. Musiela, and D. Sondermann (1994): Log-normality of Rates and Term Structure Models, - * The University of New South Wales. - * - * 2) Musiela, M. (1994): Nominal Annual Rates and Log-normal Volatility Structure, The University of New - * South Wales. - * - * 3) Brace, A., D. Gatarek, and M. Musiela (1997): The Market Model of Interest Rate Dynamics, Mathematical - * Finance 7 (2), 127-155. - * - * @author Lakshmi Krishnamurthy - */ - -public class MultiFactorCurveDynamics { - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < aiDay.length; ++i) { - aDeposit[i] = new SingleStreamComponent ( - "DEPOSIT_" + aiDay[i], - new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.EdgePair ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ) - ), - cps, - cfus - ) - ), - csp - ); - - aDeposit[i].setPrimaryCode (aiDay[i] + "D"); - } - - return aDeposit; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtEffective, - final String strCurrency, - final String[] astrMaturityTenor) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 4, - "Act/360", - false, - "Act/360", - false, - strCurrency, - true, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - 0., - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent irs = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - /* - * This sample demonstrates discount curve calibration and input instrument calibration quote recovery. - * It shows the following: - * - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve OTCInstrumentCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 7, 14, 30, 60 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0013, 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of EDF Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aEDFComp = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtSpot, - 8, - strCurrency - ); - - double[] adblEDFQuote = new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }; - - /* - * Construct the EDF Instrument Set Stretch Builder - */ - - LatentStateStretchSpec edfStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "EDF", - aEDFComp, - "ForwardRate", - adblEDFQuote - ); - - /* - * Construct the Array of Swap Instruments and their Quotes from the given set of parameters - */ - - FixFloatComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - } - ); - - double[] adblSwapQuote = new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }; - - /* - * Construct the Swap Instrument Set Stretch Builder - */ - - LatentStateStretchSpec swapStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SWAP", - aSwapComp, - "SwapRate", - adblSwapQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - edfStretch, - swapStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit, Futures, and Swap Stretches. - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - CurveSurfaceQuoteContainer csqs = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Cross-Comparison of the Deposit Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t[" + aDepositComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aDepositComp[i].measureValue (valParams, null, csqs, - null, "Rate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the EDF Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t EDF INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aEDFComp.length; ++i) - System.out.println ("\t[" + aEDFComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aEDFComp[i].measureValue (valParams, null, csqs, null, "Rate"), 1, 6, 1.) - + " | " + FormatUtil.FormatDouble (adblEDFQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t SWAP INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aSwapComp.length; ++i) - System.out.println ("\t[" + aSwapComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aSwapComp[i].measureValue (valParams, null, csqs, null, "CalibSwapRate"), 1, 6, 1.) - + " | " + FormatUtil.FormatDouble (adblSwapQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aSwapComp[i].measureValue (valParams, null, csqs, null, "FairPremium"), 1, 6, 1.)); - - return dc; - } - - private static final MarketSurface FlatVolatilitySurface ( - final JulianDate dtStart, - final String strCurrency, - final double dblFlatVol) - throws Exception - { - return ScenarioMarketSurfaceBuilder.CustomSplineWireSurface ( - "VIEW_TARGET_VOLATILITY_SURFACE", - dtStart, - strCurrency, - new double[] { - dtStart.julian(), - dtStart.addYears (2).julian(), - dtStart.addYears (4).julian(), - dtStart.addYears (6).julian(), - dtStart.addYears (8).julian(), - dtStart.addYears (10).julian() - }, - new double[] { - dtStart.julian(), - dtStart.addYears (2).julian(), - dtStart.addYears (4).julian(), - dtStart.addYears (6).julian(), - dtStart.addYears (8).julian(), - dtStart.addYears (10).julian() - }, - new double[][] { - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - }, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ), - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ) - ); - } - - private static final LognormalLIBORVolatility LLVInstance ( - final int iSpotDate, - final ForwardLabel forwardLabel, - final MarketSurface[] aMS, - final double[][] aadblCorrelation, - final int iNumFactor) - throws Exception - { - UnivariateSequenceGenerator[] aUSG = new UnivariateSequenceGenerator[aMS.length]; - - for (int i = 0; i < aUSG.length; ++i) - aUSG[i] = new BoxMullerGaussian ( - 0., - 1. - ); - - return new LognormalLIBORVolatility ( - iSpotDate, - forwardLabel, - aMS, - new PrincipalFactorSequenceGenerator ( - aUSG, - aadblCorrelation, - iNumFactor - ) - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strTenor = "3M"; - String strCurrency = "USD"; - double dblFlatVol1 = 0.35; - double dblFlatVol2 = 0.42; - double dblFlatVol3 = 0.27; - double dblFlatForwardRate = 0.02; - int iNumRun = 1; - - int[] aiNumFactor = { - 1, 2, 3 - }; - - double[][] aadblCorrelation = new double[][] { - {1.0, 0.1, 0.2}, - {0.1, 1.0, 0.2}, - {0.2, 0.1, 1.0} - }; - - ForwardLabel forwardLabel = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - FundingLabel fundingLabel = FundingLabel.Standard ( - strCurrency - ); - - JulianDate dtSpot = org.drip.analytics.date.DateUtil.Today(); - - MarketSurface[] aMS = new MarketSurface[] { - FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol1 - ), - FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol2 - ), - FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol3 - ) - }; - - ForwardCurve fc = ScenarioForwardCurveBuilder.FlatForwardForwardCurve ( - dtSpot, - forwardLabel, - dblFlatForwardRate - ); - - MergedDiscountForwardCurve dc = OTCInstrumentCurve ( - dtSpot, - strCurrency - ); - - int iSpotDate = dtSpot.julian(); - - JulianDate dtView = dtSpot.addTenor ("1Y"); - - int iViewDate = dtView.julian(); - - int iNumForwardTenor = 5; - int iViewTimeIncrement = 1; - String strBoundary = "\t|"; - String strTenorDump = "\t|"; - JulianDate[] adtIndex = new JulianDate[iNumForwardTenor + 1]; - JulianDate[] adtForward = new JulianDate[iNumForwardTenor + 1]; - - for (int iTenorDate = 0; iTenorDate <= iNumForwardTenor; ++iTenorDate) { - adtIndex[iTenorDate] = 0 == iTenorDate ? dtView : adtIndex[iTenorDate - 1].addTenor (forwardLabel.tenor()); - - adtForward[iTenorDate] = 0 == iTenorDate ? - dtView.addTenor (forwardLabel.tenor()) : - adtForward[iTenorDate - 1].addTenor (forwardLabel.tenor()); - - strBoundary += "---------------"; - strTenorDump += " " + adtForward[iTenorDate] + " |"; - } - - SegmentCustomBuilderControl scbc = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (1.) - ), - null - ); - - for (int iNumFactor : aiNumFactor) { - LognormalLIBORCurveEvolver llce = LognormalLIBORCurveEvolver.Create ( - fundingLabel, - forwardLabel, - iNumForwardTenor, - scbc - ); - - BGMCurveUpdate bgmcu = BGMCurveUpdate.Create ( - fundingLabel, - forwardLabel, - iSpotDate, - iSpotDate, - fc, - null, - dc, - null, - null, - null, - null, - null, - LLVInstance ( - dtSpot.julian(), - forwardLabel, - aMS, - aadblCorrelation, - iNumFactor - ) - ); - - for (int iRun = 0; iRun < iNumRun; ++iRun) { - String strLIBORDump = "\t|"; - String strDiscountFactorDump = "\t|"; - String strLIBORIncrementDump = "\t|"; - String strSpotRateIncrementDump = "\t|"; - String strNominalAnnualForwardDump = "\t|"; - String strEffectiveAnnualForwardDump = "\t|"; - String strDiscountFactorIncrementDump = "\t|"; - String strContinuousForwardIncrementDump = "\t|"; - - BGMCurveUpdate bgmUpdate = llce.evolve ( - iSpotDate, - iViewDate, - iViewTimeIncrement, - bgmcu - ); - - ForwardCurve fcLIBOR = bgmUpdate.forwardCurve(); - - MergedDiscountForwardCurve dcDiscountFactor = bgmUpdate.discountCurve(); - - Span spanLIBORIncrement = bgmUpdate.forwardCurveIncrement(); - - Span spanDFIncrement = bgmUpdate.discountCurveIncrement(); - - Span spanContinuousForwardIncrement = bgmUpdate.continuousForwardRateIncrement(); - - Span spanSpotRateIncrement = bgmUpdate.spotRateIncrement(); - - Span spanEffectiveAnnualForward = bgmUpdate.instantaneousEffectiveForwardRate(); - - Span spanNominalAnnualForward = bgmUpdate.instantaneousNominalForwardRate(); - - for (int iTenorDate = 0; iTenorDate <= iNumForwardTenor; ++iTenorDate) { - strLIBORDump += " " + - FormatUtil.FormatDouble (fcLIBOR.forward (adtForward[iTenorDate]), 1, 2, 100.) + - "% |"; - - strDiscountFactorDump += " " + - FormatUtil.FormatDouble (dcDiscountFactor.df (adtIndex[iTenorDate]), 1, 4, 1.) + - " |"; - - strLIBORIncrementDump += " " + - FormatUtil.FormatDouble (spanLIBORIncrement.calcResponseValue (adtIndex[iTenorDate].julian()), 2, 0, 10000.) + - " |"; - - strDiscountFactorIncrementDump += " " + - FormatUtil.FormatDouble (spanDFIncrement.calcResponseValue (adtIndex[iTenorDate].julian()), 2, 0, 100.) + - " |"; - - strContinuousForwardIncrementDump += " " + - FormatUtil.FormatDouble (spanContinuousForwardIncrement.calcResponseValue (adtIndex[iTenorDate].julian()), 2, 0, 10000.) + - " |"; - - strSpotRateIncrementDump += " " + - FormatUtil.FormatDouble (spanSpotRateIncrement.calcResponseValue (adtIndex[iTenorDate].julian()), 2, 0, 10000.) + - " |"; - - strEffectiveAnnualForwardDump += " " + - FormatUtil.FormatDouble (spanEffectiveAnnualForward.calcResponseValue (adtIndex[iTenorDate].julian()), 1, 2, 100.) + - "% |"; - - strNominalAnnualForwardDump += " " + - FormatUtil.FormatDouble (spanNominalAnnualForward.calcResponseValue (adtIndex[iTenorDate].julian()), 1, 2, 100.) + - "% |"; - } - - System.out.println ("\n\n" + - strBoundary + "\n" + - strTenorDump + "\n" + - strBoundary + "\n" + - strLIBORDump + "\n" + - strDiscountFactorDump + "\n" + - strLIBORIncrementDump + "\n" + - strDiscountFactorIncrementDump + "\n" + - strContinuousForwardIncrementDump + "\n" + - strSpotRateIncrementDump + "\n" + - strEffectiveAnnualForwardDump + "\n" + - strNominalAnnualForwardDump + "\n" + - strBoundary - ); - } - } - } -} diff --git a/org/drip/sample/lmm/MultiFactorLIBORCurveEvolver.java b/org/drip/sample/lmm/MultiFactorLIBORCurveEvolver.java deleted file mode 100644 index 7f49fd7..0000000 --- a/org/drip/sample/lmm/MultiFactorLIBORCurveEvolver.java +++ /dev/null @@ -1,792 +0,0 @@ - -package org.drip.sample.lmm; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.analytics.definition.MarketSurface; -import org.drip.analytics.support.CompositePeriodBuilder; -import org.drip.dynamics.lmm.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.grid.OverlappingStretchSpan; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.*; -import org.drip.state.curve.BasisSplineForwardRate; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * MultiFactorLIBORCurveEvolver demonstrates the Evolution Sequence of the full LIBOR Forward Curve. The - * References are: - * - * 1) Goldys, B., M. Musiela, and D. Sondermann (1994): Log-normality of Rates and Term Structure Models, - * The University of New South Wales. - * - * 2) Musiela, M. (1994): Nominal Annual Rates and Log-normal Volatility Structure, The University of New - * South Wales. - * - * 3) Brace, A., D. Gatarek, and M. Musiela (1997): The Market Model of Interest Rate Dynamics, Mathematical - * Finance 7 (2), 127-155. - * - * @author Lakshmi Krishnamurthy - */ - -public class MultiFactorLIBORCurveEvolver { - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < aiDay.length; ++i) { - aDeposit[i] = new SingleStreamComponent ( - "DEPOSIT_" + aiDay[i], - new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.EdgePair ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ) - ), - cps, - cfus - ) - ), - csp - ); - - aDeposit[i].setPrimaryCode (aiDay[i] + "D"); - } - - return aDeposit; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtEffective, - final String strCurrency, - final String[] astrMaturityTenor) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 4, - "Act/360", - false, - "Act/360", - false, - strCurrency, - true, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - 0., - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent irs = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - /* - * This sample demonstrates discount curve calibration and input instrument calibration quote recovery. - * It shows the following: - * - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve OTCInstrumentCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 7, 14, 30, 60 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0013, 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of EDF Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aEDFComp = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtSpot, - 8, - strCurrency - ); - - double[] adblEDFQuote = new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }; - - /* - * Construct the EDF Instrument Set Stretch Builder - */ - - LatentStateStretchSpec edfStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "EDF", - aEDFComp, - "ForwardRate", - adblEDFQuote - ); - - /* - * Construct the Array of Swap Instruments and their Quotes from the given set of parameters - */ - - FixFloatComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - } - ); - - double[] adblSwapQuote = new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }; - - /* - * Construct the Swap Instrument Set Stretch Builder - */ - - LatentStateStretchSpec swapStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SWAP", - aSwapComp, - "SwapRate", - adblSwapQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - edfStretch, - swapStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit, Futures, and Swap Stretches. - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - CurveSurfaceQuoteContainer csqs = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Cross-Comparison of the Deposit Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t[" + aDepositComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aDepositComp[i].measureValue (valParams, null, csqs, - null, "Rate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the EDF Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t EDF INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aEDFComp.length; ++i) - System.out.println ("\t[" + aEDFComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aEDFComp[i].measureValue (valParams, null, csqs, null, "Rate"), 1, 6, 1.) - + " | " + FormatUtil.FormatDouble (adblEDFQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t SWAP INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aSwapComp.length; ++i) - System.out.println ("\t[" + aSwapComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aSwapComp[i].measureValue (valParams, null, csqs, null, "CalibSwapRate"), 1, 6, 1.) - + " | " + FormatUtil.FormatDouble (adblSwapQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aSwapComp[i].measureValue (valParams, null, csqs, null, "FairPremium"), 1, 6, 1.)); - - return dc; - } - - private static final ForwardCurve LIBORSpan ( - final MergedDiscountForwardCurve dc, - final ForwardLabel forwardLabel, - final SegmentCustomBuilderControl scbc, - final JulianDate dtView, - final int iNumForwardTenor) - throws Exception - { - int[] aiDate = new int[iNumForwardTenor + 1]; - double[] adblLIBOR = new double[iNumForwardTenor + 1]; - SegmentCustomBuilderControl[] aSCBC = new SegmentCustomBuilderControl[iNumForwardTenor]; - - JulianDate dtForward = dtView.subtractTenor (forwardLabel.tenor()); - - for (int i = 0; i <= iNumForwardTenor; ++i) { - if (iNumForwardTenor != i) aSCBC[i] = scbc; - - aiDate[i] = dtForward.julian(); - - adblLIBOR[i] = dc.libor ( - dtForward, - forwardLabel.tenor() - ); - - dtForward = dtForward.addTenor (forwardLabel.tenor()); - } - - return new BasisSplineForwardRate ( - forwardLabel, - new OverlappingStretchSpan ( - MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator ( - "SPOT_QM_LIBOR", - aiDate, - adblLIBOR, - aSCBC, - null, - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE - ) - ) - ); - } - - private static final MarketSurface FlatVolatilitySurface ( - final JulianDate dtStart, - final String strCurrency, - final double dblFlatVol) - throws Exception - { - return ScenarioMarketSurfaceBuilder.CustomSplineWireSurface ( - "VIEW_TARGET_VOLATILITY_SURFACE", - dtStart, - strCurrency, - new double[] { - dtStart.julian(), - dtStart.addYears (2).julian(), - dtStart.addYears (4).julian(), - dtStart.addYears (6).julian(), - dtStart.addYears (8).julian(), - dtStart.addYears (10).julian() - }, - new double[] { - dtStart.julian(), - dtStart.addYears (2).julian(), - dtStart.addYears (4).julian(), - dtStart.addYears (6).julian(), - dtStart.addYears (8).julian(), - dtStart.addYears (10).julian() - }, - new double[][] { - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - }, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ), - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ) - ); - } - - private static final LognormalLIBORVolatility LLVInstance ( - final int iSpotDate, - final ForwardLabel forwardLabel, - final MarketSurface[] aMS, - final double[][] aadblCorrelation, - final int iNumFactor) - throws Exception - { - UnivariateSequenceGenerator[] aUSG = new UnivariateSequenceGenerator[aMS.length]; - - for (int i = 0; i < aUSG.length; ++i) - aUSG[i] = new BoxMullerGaussian ( - 0., - 1. - ); - - return new LognormalLIBORVolatility ( - iSpotDate, - forwardLabel, - aMS, - new PrincipalFactorSequenceGenerator ( - aUSG, - aadblCorrelation, - iNumFactor - ) - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strTenor = "3M"; - String strViewTenor = "1Y"; - String strSimulationTenor = "1M"; - String strCurrency = "USD"; - double dblFlatVol1 = 0.35; - double dblFlatVol2 = 0.42; - double dblFlatVol3 = 0.27; - int iNumForwardTenor = 5; - int iNumFactor = 2; - - double[][] aadblCorrelation = new double[][] { - {1.0, 0.1, 0.2}, - {0.1, 1.0, 0.2}, - {0.2, 0.1, 1.0} - }; - - SegmentCustomBuilderControl scbc = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (1.) - ), - null - ); - - JulianDate dtSpot = org.drip.analytics.date.DateUtil.Today(); - - MarketSurface[] aMS = new MarketSurface[] { - FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol1 - ), - FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol2 - ), - FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol3 - ) - }; - - FundingLabel fundingLabel = FundingLabel.Standard ( - strCurrency - ); - - ForwardLabel forwardLabel = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - MergedDiscountForwardCurve dc = OTCInstrumentCurve ( - dtSpot, - strCurrency - ); - - JulianDate dtView = dtSpot.addTenor (strViewTenor); - - ForwardCurve fc = LIBORSpan ( - dc, - forwardLabel, - scbc, - dtView, - iNumForwardTenor - ); - - LognormalLIBORCurveEvolver llce = LognormalLIBORCurveEvolver.Create ( - fundingLabel, - forwardLabel, - iNumForwardTenor, - scbc - ); - - BGMCurveUpdate bgmcu = BGMCurveUpdate.Create ( - fundingLabel, - forwardLabel, - dtSpot.julian(), - dtSpot.julian(), - fc, - null, - dc, - null, - null, - null, - null, - null, - LLVInstance ( - dtSpot.julian(), - forwardLabel, - aMS, - aadblCorrelation, - iNumFactor - ) - ); - - int iSimulationEndDate = dtSpot.addTenor (strSimulationTenor).julian(); - - String strBoundary = "\t|---"; - String strTenorDump = "\t| |"; - JulianDate dtSimulation = dtSpot; - JulianDate[] adtForward = new JulianDate[iNumForwardTenor + 1]; - - for (int iTenorDate = 0; iTenorDate <= iNumForwardTenor; ++iTenorDate) { - adtForward[iTenorDate] = 0 == iTenorDate ? - dtView.addTenor (forwardLabel.tenor()) : - adtForward[iTenorDate - 1].addTenor (forwardLabel.tenor()); - - strBoundary += "-----------------"; - strTenorDump += " " + adtForward[iTenorDate] + " |"; - } - - System.out.println ("\n\n" + - strBoundary + "\n" + - strTenorDump + "\n" + - strBoundary - ); - - while (dtSimulation.julian() < iSimulationEndDate && null != bgmcu) { - ForwardCurve fcLIBOR = bgmcu.forwardCurve(); - - String strLIBORDump = "\t| " + dtSimulation + " |"; - - for (int iTenorDate = 0; iTenorDate <= iNumForwardTenor; ++iTenorDate) { - strLIBORDump += " " + - FormatUtil.FormatDouble (fcLIBOR.forward (adtForward[iTenorDate]), 1, 2, 100.) + - "% |"; - } - - System.out.println (strLIBORDump); - - bgmcu = llce.evolve ( - dtSimulation.julian(), - dtView.julian(), - 1, - bgmcu - ); - - dtSimulation = dtSimulation.addDays (1); - } - - System.out.println (strBoundary); - } -} diff --git a/org/drip/sample/lmm/MultiFactorLIBORMonteCarlo.java b/org/drip/sample/lmm/MultiFactorLIBORMonteCarlo.java deleted file mode 100644 index febdb91..0000000 --- a/org/drip/sample/lmm/MultiFactorLIBORMonteCarlo.java +++ /dev/null @@ -1,783 +0,0 @@ - -package org.drip.sample.lmm; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.analytics.definition.MarketSurface; -import org.drip.analytics.support.CompositePeriodBuilder; -import org.drip.dynamics.lmm.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.grid.OverlappingStretchSpan; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.*; -import org.drip.state.curve.BasisSplineForwardRate; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * MultiFactorLIBORMonteCarlo demonstrates the Monte-Carlo Evolution Sequence of the LIBOR Forward Curve. The - * References are: - * - * 1) Goldys, B., M. Musiela, and D. Sondermann (1994): Log-normality of Rates and Term Structure Models, - * The University of New South Wales. - * - * 2) Musiela, M. (1994): Nominal Annual Rates and Log-normal Volatility Structure, The University of New - * South Wales. - * - * 3) Brace, A., D. Gatarek, and M. Musiela (1997): The Market Model of Interest Rate Dynamics, Mathematical - * Finance 7 (2), 127-155. - * - * @author Lakshmi Krishnamurthy - */ - -public class MultiFactorLIBORMonteCarlo { - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cps = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < aiDay.length; ++i) { - aDeposit[i] = new SingleStreamComponent ( - "DEPOSIT_" + aiDay[i], - new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - CompositePeriodBuilder.EdgePair ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ) - ), - cps, - cfus - ) - ), - csp - ); - - aDeposit[i].setPrimaryCode (aiDay[i] + "D"); - } - - return aDeposit; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtEffective, - final String strCurrency, - final String[] astrMaturityTenor) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 4, - "Act/360", - false, - "Act/360", - false, - strCurrency, - true, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCurrency, - "3M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "3M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - 0., - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent irs = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - /* - * This sample demonstrates discount curve calibration and input instrument calibration quote recovery. - * It shows the following: - * - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve OTCInstrumentCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 7, 14, 30, 60 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0013, 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of EDF Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aEDFComp = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtSpot, - 8, - strCurrency - ); - - double[] adblEDFQuote = new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }; - - /* - * Construct the EDF Instrument Set Stretch Builder - */ - - LatentStateStretchSpec edfStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "EDF", - aEDFComp, - "ForwardRate", - adblEDFQuote - ); - - /* - * Construct the Array of Swap Instruments and their Quotes from the given set of parameters - */ - - FixFloatComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - } - ); - - double[] adblSwapQuote = new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }; - - /* - * Construct the Swap Instrument Set Stretch Builder - */ - - LatentStateStretchSpec swapStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SWAP", - aSwapComp, - "SwapRate", - adblSwapQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - edfStretch, - swapStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit, Futures, and Swap Stretches. - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - CurveSurfaceQuoteContainer csqs = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Cross-Comparison of the Deposit Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t[" + aDepositComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aDepositComp[i].measureValue (valParams, null, csqs, - null, "Rate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the EDF Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t EDF INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aEDFComp.length; ++i) - System.out.println ("\t[" + aEDFComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aEDFComp[i].measureValue (valParams, null, csqs, null, "Rate"), 1, 6, 1.) - + " | " + FormatUtil.FormatDouble (adblEDFQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t SWAP INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aSwapComp.length; ++i) - System.out.println ("\t[" + aSwapComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aSwapComp[i].measureValue (valParams, null, csqs, null, "CalibSwapRate"), 1, 6, 1.) - + " | " + FormatUtil.FormatDouble (adblSwapQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aSwapComp[i].measureValue (valParams, null, csqs, null, "FairPremium"), 1, 6, 1.)); - - return dc; - } - - private static final ForwardCurve LIBORSpan ( - final MergedDiscountForwardCurve dc, - final ForwardLabel forwardLabel, - final SegmentCustomBuilderControl scbc, - final JulianDate dtView, - final int iNumForwardTenor) - throws Exception - { - int[] aiDate = new int[iNumForwardTenor + 1]; - double[] adblLIBOR = new double[iNumForwardTenor + 1]; - SegmentCustomBuilderControl[] aSCBC = new SegmentCustomBuilderControl[iNumForwardTenor]; - - JulianDate dtForward = dtView.subtractTenor (forwardLabel.tenor()); - - for (int i = 0; i <= iNumForwardTenor; ++i) { - if (iNumForwardTenor != i) aSCBC[i] = scbc; - - aiDate[i] = dtForward.julian(); - - adblLIBOR[i] = dc.libor (dtForward, forwardLabel.tenor()); - - dtForward = dtForward.addTenor (forwardLabel.tenor()); - } - - return new BasisSplineForwardRate ( - forwardLabel, - new OverlappingStretchSpan ( - MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator ( - "SPOT_QM_LIBOR", - aiDate, - adblLIBOR, - aSCBC, - null, - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE - ) - ) - ); - } - - private static final MarketSurface FlatVolatilitySurface ( - final JulianDate dtStart, - final String strCurrency, - final double dblFlatVol) - throws Exception - { - return ScenarioMarketSurfaceBuilder.CustomSplineWireSurface ( - "VIEW_TARGET_VOLATILITY_SURFACE", - dtStart, - strCurrency, - new double[] { - dtStart.julian(), - dtStart.addYears (2).julian(), - dtStart.addYears (4).julian(), - dtStart.addYears (6).julian(), - dtStart.addYears (8).julian(), - dtStart.addYears (10).julian() - }, - new double[] { - dtStart.julian(), - dtStart.addYears (2).julian(), - dtStart.addYears (4).julian(), - dtStart.addYears (6).julian(), - dtStart.addYears (8).julian(), - dtStart.addYears (10).julian() - }, - new double[][] { - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - }, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ), - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ) - ); - } - - private static final LognormalLIBORVolatility LLVInstance ( - final int iSpotDate, - final ForwardLabel forwardLabel, - final MarketSurface[] aMS, - final double[][] aadblCorrelation, - final int iNumFactor) - throws Exception - { - UnivariateSequenceGenerator[] aUSG = new UnivariateSequenceGenerator[aMS.length]; - - for (int i = 0; i < aUSG.length; ++i) - aUSG[i] = new BoxMullerGaussian ( - 0., - 1. - ); - - return new LognormalLIBORVolatility ( - iSpotDate, - forwardLabel, - aMS, - new PrincipalFactorSequenceGenerator ( - aUSG, - aadblCorrelation, - iNumFactor - ) - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strForwardTenor = "3M"; - String strViewTenor = "1Y"; - String strSimulationTenor = "1M"; - String strCurrency = "USD"; - double dblFlatVol1 = 0.35; - double dblFlatVol2 = 0.42; - double dblFlatVol3 = 0.27; - int iNumForwardTenor = 5; - int iNumFactor = 2; - - double[][] aadblCorrelation = new double[][] { - {1.0, 0.1, 0.2}, - {0.1, 1.0, 0.2}, - {0.2, 0.1, 1.0} - }; - - SegmentCustomBuilderControl scbc = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (1.) - ), - null - ); - - JulianDate dtSpot = org.drip.analytics.date.DateUtil.Today(); - - MarketSurface[] aMS = new MarketSurface[] { - FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol1 - ), - FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol2 - ), - FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol3 - ) - }; - - FundingLabel fundingLabel = FundingLabel.Standard ( - strCurrency - ); - - ForwardLabel forwardLabel = ForwardLabel.Create ( - strCurrency, - strForwardTenor - ); - - MergedDiscountForwardCurve dc = OTCInstrumentCurve ( - dtSpot, - strCurrency - ); - - JulianDate dtView = dtSpot.addTenor (strViewTenor); - - ForwardCurve fc = LIBORSpan ( - dc, - forwardLabel, - scbc, - dtView, - iNumForwardTenor - ); - - LognormalLIBORCurveEvolver llce = LognormalLIBORCurveEvolver.Create ( - fundingLabel, - forwardLabel, - iNumForwardTenor, - scbc - ); - - BGMCurveUpdate bgmInitial = BGMCurveUpdate.Create ( - fundingLabel, - forwardLabel, - dtSpot.julian(), - dtSpot.julian(), - fc, - null, - dc, - null, - null, - null, - null, - null, - LLVInstance ( - dtSpot.julian(), - forwardLabel, - aMS, - aadblCorrelation, - iNumFactor - ) - ); - - double[][] aadblTenorLIBOR = llce.simulatePrincipalMetric ( - dtSpot.julian(), - dtSpot.addTenor (strSimulationTenor).julian(), - 1, - dtView.julian(), - bgmInitial, - 2 - ); - - String strBoundary = "\t|---"; - String strTenorDump = "\t| |"; - JulianDate[] adtForward = new JulianDate[iNumForwardTenor + 1]; - - for (int iTenorDate = 0; iTenorDate <= iNumForwardTenor; ++iTenorDate) { - adtForward[iTenorDate] = 0 == iTenorDate ? - dtView.addTenor (forwardLabel.tenor()) : - adtForward[iTenorDate - 1].addTenor (forwardLabel.tenor()); - - strBoundary += "-----------------"; - strTenorDump += " " + adtForward[iTenorDate] + " |"; - } - - System.out.println ("\n\n" + - strBoundary + "\n" + - strTenorDump + "\n" + - strBoundary - ); - - for (int iSimulationDate = 0; iSimulationDate < aadblTenorLIBOR.length; ++iSimulationDate) { - double[] adblCurveNode = aadblTenorLIBOR[iSimulationDate]; - - String strCurveNodeDump = "\t| " + dtSpot.addDays (iSimulationDate + 1) + " =>"; - - for (int i = 0; i < aadblTenorLIBOR[i].length; ++i) - strCurveNodeDump += " " + FormatUtil.FormatDouble (adblCurveNode[i], 1, 3, 100.) + "% |"; - - System.out.println (strCurveNodeDump); - } - - System.out.println (strBoundary); - } -} diff --git a/org/drip/sample/lmm/PointAncillaryMetricsDynamics.java b/org/drip/sample/lmm/PointAncillaryMetricsDynamics.java deleted file mode 100644 index 650311c..0000000 --- a/org/drip/sample/lmm/PointAncillaryMetricsDynamics.java +++ /dev/null @@ -1,309 +0,0 @@ - -package org.drip.sample.lmm; - -import org.drip.analytics.date.JulianDate; -import org.drip.analytics.definition.MarketSurface; -import org.drip.dynamics.lmm.*; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * PointAncillaryMetricsDynamics demonstrates the Construction and Usage of the Point LIBOR State Evolver, - * and the eventual Evolution of the related Ancillary bDiscount/Forward Latent State Quantification - * Metrics. The References are: - * - * 1) Goldys, B., M. Musiela, and D. Sondermann (1994): Log-normality of Rates and Term Structure Models, - * The University of New South Wales. - * - * 2) Musiela, M. (1994): Nominal Annual Rates and Log-normal Volatility Structure, The University of New - * South Wales. - * - * 3) Brace, A., D. Gatarek, and M. Musiela (1997): The Market Model of Interest Rate Dynamics, Mathematical - * Finance 7 (2), 127-155. - * - * @author Lakshmi Krishnamurthy - */ - -public class PointAncillaryMetricsDynamics { - - private static final MarketSurface FlatVolatilitySurface ( - final JulianDate dtStart, - final String strCurrency, - final double dblFlatVol) - throws Exception - { - return ScenarioMarketSurfaceBuilder.CustomSplineWireSurface ( - "VIEW_TARGET_VOLATILITY_SURFACE", - dtStart, - strCurrency, - new double[] { - dtStart.julian(), - dtStart.addYears (2).julian(), - dtStart.addYears (4).julian(), - dtStart.addYears (6).julian(), - dtStart.addYears (8).julian(), - dtStart.addYears (10).julian() - }, - new double[] { - dtStart.julian(), - dtStart.addYears (2).julian(), - dtStart.addYears (4).julian(), - dtStart.addYears (6).julian(), - dtStart.addYears (8).julian(), - dtStart.addYears (10).julian() - }, - new double[][] { - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - }, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ), - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ) - ); - } - - private static final LognormalLIBORVolatility LLVInstance ( - final int iSpotDate, - final ForwardLabel forwardLabel, - final MarketSurface[] aMS, - final double[][] aadblCorrelation, - final int iNumFactor) - throws Exception - { - UnivariateSequenceGenerator[] aUSG = new UnivariateSequenceGenerator[aMS.length]; - - for (int i = 0; i < aUSG.length; ++i) - aUSG[i] = new BoxMullerGaussian (0., 1.); - - return new LognormalLIBORVolatility ( - iSpotDate, - forwardLabel, - aMS, - new PrincipalFactorSequenceGenerator ( - aUSG, - aadblCorrelation, - iNumFactor - ) - ); - } - - private static final void DisplayRunSnap ( - final BGMPointUpdate bgmRunSnap) - throws Exception - { - System.out.println ( - "\t| [" + new JulianDate (bgmRunSnap.evolutionStartDate()) + - " -> " + new JulianDate (bgmRunSnap.evolutionFinishDate()) + - "] => " + FormatUtil.FormatDouble (bgmRunSnap.libor(), 1, 2, 100.) + - "% | " + FormatUtil.FormatDouble (bgmRunSnap.liborIncrement(), 2, 0, 10000.) + - " | " + FormatUtil.FormatDouble (bgmRunSnap.instantaneousEffectiveForwardRate(), 1, 2, 100.) + - "% | " + FormatUtil.FormatDouble (bgmRunSnap.instantaneousNominalForwardRate(), 1, 2, 100.) + - "% | " - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strTenor = "3M"; - String strCurrency = "USD"; - double dblFlatVol1 = 0.35; - double dblFlatVol2 = 0.42; - double dblFlatVol3 = 0.27; - double dblZeroRate = 0.02; - double dblFlatForwardRate = 0.02; - int iNumRun = 20; - - int[] aiNumFactor = { - 1, 2, 3 - }; - - double[][] aadblCorrelation = new double[][] { - {1.0, 0.1, 0.2}, - {0.1, 1.0, 0.2}, - {0.2, 0.1, 1.0} - }; - - ForwardLabel forwardLabel = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - FundingLabel fundingLabel = FundingLabel.Standard ( - strCurrency - ); - - JulianDate dtSpot = org.drip.analytics.date.DateUtil.Today(); - - MarketSurface[] aMS = new MarketSurface[] { - FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol1 - ), - FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol2 - ), - FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol3 - ) - }; - - ForwardCurve fc = ScenarioForwardCurveBuilder.FlatForwardForwardCurve ( - dtSpot, - forwardLabel, - dblFlatForwardRate - ); - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - dtSpot, - strCurrency, - dblZeroRate - ); - - int iSpotDate = dtSpot.julian(); - - int iViewDate = dtSpot.addTenor ("1Y").julian(); - - int iViewTimeIncrement = 1; - - for (int iNumFactor : aiNumFactor) { - System.out.println ("\n\n\t|----------------------------------------------------------------------------------------------------------|"); - - System.out.println ("\t| |"); - - System.out.println ("\t| LOG-NORMAL LIBOR EVOLVER |"); - - System.out.println ("\t| ---------- ----- ------- |"); - - System.out.println ("\t| |"); - - System.out.println ("\t| Num Factors: " + iNumFactor + " |"); - - System.out.println ("\t| Start Date |"); - - System.out.println ("\t| End Date |"); - - System.out.println ("\t| Adjacent Step LIBOR (%) |"); - - System.out.println ("\t| Adjacent Step LIBOR Increment (bp) |"); - - System.out.println ("\t| Adjacent Step Effective Annual Forward Rate (%) |"); - - System.out.println ("\t| Adjacent Step Nominal Annual Forward Rate (%) |"); - - System.out.println ("\t| |"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------|"); - - LognormalLIBORPointEvolver lle = new LognormalLIBORPointEvolver ( - fundingLabel, - forwardLabel, - LLVInstance ( - dtSpot.julian(), - forwardLabel, - aMS, - aadblCorrelation, - iNumFactor - ), - fc, - dc - ); - - for (int iRun = 0; iRun < iNumRun; ++iRun) - DisplayRunSnap ( - lle.evolve ( - iSpotDate, - iViewDate, - iViewTimeIncrement, - null - ) - ); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------|"); - } - } -} diff --git a/org/drip/sample/lmm/PointCoreMetricsDynamics.java b/org/drip/sample/lmm/PointCoreMetricsDynamics.java deleted file mode 100644 index 8d181ef..0000000 --- a/org/drip/sample/lmm/PointCoreMetricsDynamics.java +++ /dev/null @@ -1,330 +0,0 @@ - -package org.drip.sample.lmm; - -import org.drip.analytics.date.JulianDate; -import org.drip.analytics.definition.MarketSurface; -import org.drip.dynamics.lmm.*; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * PointCoreMetricsDynamics demonstrates the Construction and Usage of the Point LIBOR State Evolver, and the - * eventual Evolution of the related Core bDiscount/Forward Latent State Quantification Metrics. The - * References are: - * - * 1) Goldys, B., M. Musiela, and D. Sondermann (1994): Log-normality of Rates and Term Structure Models, - * The University of New South Wales. - * - * 2) Musiela, M. (1994): Nominal Annual Rates and Log-normal Volatility Structure, The University of New - * South Wales. - * - * 3) Brace, A., D. Gatarek, and M. Musiela (1997): The Market Model of Interest Rate Dynamics, Mathematical - * Finance 7 (2), 127-155. - * - * @author Lakshmi Krishnamurthy - */ - -public class PointCoreMetricsDynamics { - - private static final MarketSurface FlatVolatilitySurface ( - final JulianDate dtStart, - final String strCurrency, - final double dblFlatVol) - throws Exception - { - return ScenarioMarketSurfaceBuilder.CustomSplineWireSurface ( - "VIEW_TARGET_VOLATILITY_SURFACE", - dtStart, - strCurrency, - new double[] { - dtStart.julian(), - dtStart.addYears (2).julian(), - dtStart.addYears (4).julian(), - dtStart.addYears (6).julian(), - dtStart.addYears (8).julian(), - dtStart.addYears (10).julian() - }, - new double[] { - dtStart.julian(), - dtStart.addYears (2).julian(), - dtStart.addYears (4).julian(), - dtStart.addYears (6).julian(), - dtStart.addYears (8).julian(), - dtStart.addYears (10).julian() - }, - new double[][] { - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, - }, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ), - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ) - ); - } - - private static final LognormalLIBORVolatility LLVInstance ( - final int iSpotDate, - final ForwardLabel forwardLabel, - final MarketSurface[] aMS, - final double[][] aadblCorrelation, - final int iNumFactor) - throws Exception - { - UnivariateSequenceGenerator[] aUSG = new UnivariateSequenceGenerator[aMS.length]; - - for (int i = 0; i < aUSG.length; ++i) - aUSG[i] = new BoxMullerGaussian ( - 0., - 1. - ); - - return new LognormalLIBORVolatility ( - iSpotDate, - forwardLabel, - aMS, - new PrincipalFactorSequenceGenerator ( - aUSG, - aadblCorrelation, - iNumFactor - ) - ); - } - - private static final void DisplayRunSnap ( - final BGMPointUpdate bgmRunSnap) - throws Exception - { - System.out.println ( - "\t| [" + new JulianDate (bgmRunSnap.evolutionStartDate()) + - " -> " + new JulianDate (bgmRunSnap.evolutionFinishDate()) + - "] => " + FormatUtil.FormatDouble (bgmRunSnap.libor(), 1, 2, 100.) + - "% | " + FormatUtil.FormatDouble (bgmRunSnap.liborIncrement(), 2, 0, 10000.) + - " | " + FormatUtil.FormatDouble (bgmRunSnap.continuousForwardRate(), 1, 2, 100.) + - "% | " + FormatUtil.FormatDouble (bgmRunSnap.continuousForwardRateIncrement(), 2, 0, 10000.) + - " | " + FormatUtil.FormatDouble (bgmRunSnap.spotRate(), 1, 2, 100.) + - "% | " + FormatUtil.FormatDouble (bgmRunSnap.spotRateIncrement(), 2, 0, 10000.) + - " | " + FormatUtil.FormatDouble (bgmRunSnap.discountFactor(), 1, 2, 100.) + - " | " + FormatUtil.FormatDouble (bgmRunSnap.discountFactorIncrement(), 2, 0, 10000.) + - " | " + FormatUtil.FormatDouble (bgmRunSnap.lognormalLIBORVolatility(), 2, 0, 100.) + - "% | " + FormatUtil.FormatDouble (bgmRunSnap.continuouslyCompoundedForwardVolatility(), 1, 2, 100.) + - "% | " - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strTenor = "3M"; - String strCurrency = "USD"; - double dblFlatVol1 = 0.35; - double dblFlatVol2 = 0.42; - double dblFlatVol3 = 0.27; - double dblZeroRate = 0.02; - double dblFlatForwardRate = 0.02; - int iNumRun = 20; - - int[] aiNumFactor = { - 1, 2, 3 - }; - - double[][] aadblCorrelation = new double[][] { - {1.0, 0.1, 0.2}, - {0.1, 1.0, 0.2}, - {0.2, 0.1, 1.0} - }; - - ForwardLabel forwardLabel = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - FundingLabel fundingLabel = FundingLabel.Standard ( - strCurrency - ); - - JulianDate dtSpot = org.drip.analytics.date.DateUtil.Today(); - - MarketSurface[] aMS = new MarketSurface[] { - FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol1 - ), - FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol2 - ), - FlatVolatilitySurface ( - dtSpot, - strCurrency, - dblFlatVol3 - ) - }; - - ForwardCurve fc = ScenarioForwardCurveBuilder.FlatForwardForwardCurve ( - dtSpot, - forwardLabel, - dblFlatForwardRate - ); - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - dtSpot, - strCurrency, - dblZeroRate - ); - - int iSpotDate = dtSpot.julian(); - - int iViewDate = dtSpot.addTenor ("1Y").julian(); - - int iViewTimeIncrement = 1; - - for (int iNumFactor : aiNumFactor) { - System.out.println ("\n\n\t|----------------------------------------------------------------------------------------------------------|"); - - System.out.println ("\t| |"); - - System.out.println ("\t| LOG-NORMAL LIBOR EVOLVER |"); - - System.out.println ("\t| ---------- ----- ------- |"); - - System.out.println ("\t| |"); - - System.out.println ("\t| Num Factors: " + iNumFactor + " |"); - - System.out.println ("\t| Start Date |"); - - System.out.println ("\t| End Date |"); - - System.out.println ("\t| Adjacent Step LIBOR (%) |"); - - System.out.println ("\t| Adjacent Step LIBOR Increment (bp) |"); - - System.out.println ("\t| Adjacent Step Continuously Compounded Forward Rate (%) |"); - - System.out.println ("\t| Adjacent Step Continuously Compounded Forward Rate Increment (bp) |"); - - System.out.println ("\t| Adjacent Step Spot Rate (%) |"); - - System.out.println ("\t| Adjacent Step Spot Rate Increment (bp) |"); - - System.out.println ("\t| Adjacent Step Discount Function |"); - - System.out.println ("\t| Adjacent Step Discount Function Increment (c) |"); - - System.out.println ("\t| Log-normal LIBOR Rate Volatility (%) |"); - - System.out.println ("\t| Continuously Compounded Forward Rate Volatility (%) |"); - - System.out.println ("\t| |"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------|"); - - LognormalLIBORPointEvolver lle = new LognormalLIBORPointEvolver ( - fundingLabel, - forwardLabel, - LLVInstance ( - dtSpot.julian(), - forwardLabel, - aMS, - aadblCorrelation, - iNumFactor - ), - fc, - dc - ); - - for (int iRun = 0; iRun < iNumRun; ++iRun) - DisplayRunSnap ( - lle.evolve ( - iSpotDate, - iViewDate, - iViewTimeIncrement, - null - ) - ); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------|"); - } - } -} diff --git a/org/drip/sample/lmm/TwoFactorLIBORVolatility.java b/org/drip/sample/lmm/TwoFactorLIBORVolatility.java deleted file mode 100644 index dcc6314..0000000 --- a/org/drip/sample/lmm/TwoFactorLIBORVolatility.java +++ /dev/null @@ -1,474 +0,0 @@ - -package org.drip.sample.lmm; - -import org.drip.analytics.date.*; -import org.drip.analytics.definition.MarketSurface; -import org.drip.dynamics.lmm.LognormalLIBORVolatility; -import org.drip.market.otc.*; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * TwoFactorLIBORVolatility demonstrates the Construction and Usage of the 2 Factor LIBOR Forward Rate - * Volatility. The References are: - * - * 1) Goldys, B., M. Musiela, and D. Sondermann (1994): Log-normality of Rates and Term Structure Models, - * The University of New South Wales. - * - * 2) Musiela, M. (1994): Nominal Annual Rates and Log-normal Volatility Structure, The University of New - * South Wales. - * - * 3) Brace, A., D. Gatarek, and M. Musiela (1997): The Market Model of Interest Rate Dynamics, Mathematical - * Finance 7 (2), 127-155. - * - * @author Lakshmi Krishnamurthy - */ - -public class TwoFactorLIBORVolatility { - - private static final FixFloatComponent OTCFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFuture, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFuture]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFuture, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFuture; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aIRS; - } - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 30, - 60, - 91, - 182, - 273 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.0668750, // 30D - 0.0675000, // 60D - 0.0678125, // 91D - 0.0712500, // 182D - 0.0750000 // 273D - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", // 30D - "ForwardRate", // 60D - "ForwardRate", // 91D - "ForwardRate", // 182D - "ForwardRate" // 273D - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.08265, // 2Y - 0.08550, // 3Y - 0.08655, // 4Y - 0.08770, // 5Y - 0.08910, // 7Y - 0.08920 // 10Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 2Y - "SwapRate", // 3Y - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 7Y - "SwapRate" // 10Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - } - - private static final MarketSurface FactorFlatVolatilitySurface ( - final JulianDate dtStart, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblFactorFlatVolatility, - final double[] adblTermStructureLoading) - throws Exception - { - int iNumNode = astrMaturityTenor.length + 1; - double[] adblDate = new double[iNumNode]; - double[][] aadblVolatility = new double[iNumNode][iNumNode]; - - for (int i = 0; i < iNumNode; ++i) - adblDate[i] = 0 == i ? adblDate[i] = dtStart.julian() : dtStart.addTenor (astrMaturityTenor[i - 1]).julian(); - - for (int i = 0; i < iNumNode; ++i) { - for (int j = 0; j < iNumNode; ++j) - aadblVolatility[i][j] = - 0 == i || 0 == j ? - adblFactorFlatVolatility[0] : - adblTermStructureLoading[i - 1] * adblFactorFlatVolatility[j - 1]; - } - - return ScenarioMarketSurfaceBuilder.CustomSplineWireSurface ( - "VIEW_TARGET_VOLATILITY_SURFACE", - dtStart, - strCurrency, - adblDate, - adblDate, - aadblVolatility, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (2), - SegmentInelasticDesignControl.Create ( - 0, - 2 - ), - null, - null - ), - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ) - ); - } - - private static final void DisplayVolArray ( - final String strTenor, - final double[] adblVol) - { - String strDump = "\t | " + strTenor + " => "; - - for (int i = 0; i < adblVol.length; ++i) - strDump += FormatUtil.FormatDouble (adblVol[i], 1, 2, 100.) + "% | "; - - System.out.println (strDump); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 1995, - DateUtil.FEBRUARY, - 3 - ); - - String strFRATenor = "3M"; - String strCurrency = "GBP"; - - ForwardLabel forwardLabel = ForwardLabel.Create ( - strCurrency, - strFRATenor - ); - - MergedDiscountForwardCurve dc = MakeDC ( - dtSpot, - strCurrency - ); - - ForwardCurve fcNative = dc.nativeForwardCurve (strFRATenor); - - String[] astrMaturityTenor = new String[] { - "3M", - "6M", - "12M", - "18M", - "24M", - "30M", - "3Y", - "4Y", - "5Y", - "7Y", - "9Y", - "11Y" - }; - - double[] adblFlatTermStructure = new double[] { - 1.00000000, // "3M", - 1.00000000, // "6M", - 0.99168448, // "12M", - 1.00388389, // "18M", - 1.00388389, // "24M", - 1.07602593, // "30M", - 1.07602593, // "3Y", - 1.04727642, // "4Y", - 1.02727799, // "5Y", - 0.96660430, // "7Y", - 0.93012459, // "9Y", - 0.81425256 // "11Y" - }; - - double[] adblFlatVolFactor1 = new double[] { - 0.09481393, // "3M", - 0.08498925, // "6M", - 0.22939966, // "12M", - 0.19166872, // "18M", - 0.08232925, // "24M", - 0.18548202, // "30M", - 0.13817885, // "3Y", - 0.08562258, // "4Y", - 0.14547123, // "5Y", - 0.08869328, // "7Y", - 0.04121240, // "9Y", - 0.15206796 // "11Y" - }; - - double[] adblFlatVolFactor2 = new double[] { - 0.12146092, // "3M", - 0.05117321, // "6M", - 0.09100802, // "12M", - 0.02876211, // "18M", - 0.01172983, // "24M", - 0.00047705, // "30M", - -0.01160086, // "3Y", - -0.04673283, // "4Y", - -0.04181446, // "5Y", - -0.05459175, // "7Y", - -0.03631021, // "9Y", - -0.16626765 // "11Y" - }; - - MarketSurface mktSurf1 = FactorFlatVolatilitySurface ( - dtSpot, - strCurrency, - astrMaturityTenor, - adblFlatVolFactor1, - adblFlatTermStructure - ); - - MarketSurface mktSurf2 = FactorFlatVolatilitySurface ( - dtSpot, - strCurrency, - astrMaturityTenor, - adblFlatVolFactor2, - adblFlatTermStructure - ); - - LognormalLIBORVolatility llv = new LognormalLIBORVolatility ( - dtSpot.julian(), - forwardLabel, - new MarketSurface[] { - mktSurf1, - mktSurf2 - }, - new PrincipalFactorSequenceGenerator ( - new UnivariateSequenceGenerator[] { - new BoxMullerGaussian ( - 0., - 1. - ), - new BoxMullerGaussian ( - 0., - 1. - ) - }, - new double[][] { - {1.0, 0.1}, - {0.1, 1.0}, - }, - 2 - ) - ); - - String[] astrForwardTenor = { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y" - }; - - System.out.println ("\n\t |------------------------------|"); - - System.out.println ("\t | CONTINUOUS FORWARD RATE VOL |"); - - System.out.println ("\t |------------------------------|"); - - for (String strForwardTenor : astrForwardTenor) - DisplayVolArray ( - strForwardTenor, - llv.continuousForwardVolatility ( - dtSpot.addTenor (strForwardTenor).julian(), - fcNative - ) - ); - - System.out.println ("\t |------------------------------|"); - } -} diff --git a/org/drip/sample/lvar/OptimalTrajectoryNoDrift.java b/org/drip/sample/lvar/OptimalTrajectoryNoDrift.java deleted file mode 100644 index a0dc59f..0000000 --- a/org/drip/sample/lvar/OptimalTrajectoryNoDrift.java +++ /dev/null @@ -1,245 +0,0 @@ - -package org.drip.sample.lvar; - -import org.drip.execution.capture.LinearImpactTrajectoryEstimator; -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.*; -import org.drip.execution.nonadaptive.StaticOptimalSchemeDiscrete; -import org.drip.execution.optimum.EfficientTradingTrajectoryDiscrete; -import org.drip.execution.parameters.ArithmeticPriceDynamicsSettings; -import org.drip.execution.profiletime.UniformParticipationRateLinear; -import org.drip.execution.risk.PowerVarianceObjectiveUtility; -import org.drip.execution.strategy.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.measure.gaussian.R1UnivariateNormal; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OptimalTrajectoryNoDrift generates the Trade/Holdings List of Optimal Execution Schedule based on the - * Evolution Walk Parameters specified according to the Liquidity VaR Optimal Objective Function, exclusive - * of Drift. The Generation follows a Numerical Optimizer Scheme. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk, 3 (2), - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Non-linear Impact Functions and Trading Enhanced Risk, - * Applied Mathematical Finance, 10, 1-18. - * - * - Artzner, P., F. Delbaen, J. M. Eber, and D. Heath (1999): Coherent Measures of Risk, Mathematical - * Finance, 9, 203-228. - * - * - Basak, S., and A. Shapiro (2001): Value-at-Risk Based Risk Management: Optimal Policies and Asset - * Prices, Review of Financial Studies, 14, 371-405. - * - * @author Lakshmi Krishnamurthy - */ - -public class OptimalTrajectoryNoDrift { - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblS0 = 50.; - double dblSigma = 0.9487; - double dblAlpha = 0.02; - double dblEpsilon = 0.0625; - double dblGamma = 2.5e-07; - double dblEta = 2.5e-06; - double dblConfidenceLevel = 0.90; - - double dblX = 1000000.; - double dblT = 5.; - int iN = 5; - - double dblLambdaV = R1UnivariateNormal.Standard().confidenceInterval (dblConfidenceLevel); - - DiscreteTradingTrajectoryControl dttc = DiscreteTradingTrajectoryControl.FixedInterval ( - new OrderSpecification ( - dblX, - dblT - ), - iN - ); - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.LinearExpectation ( - new ArithmeticPriceDynamicsSettings ( - 0., - new FlatUnivariate (dblSigma), - 0. - ), - new UniformParticipationRateLinear ( - new ParticipationRateLinear ( - 0., - dblGamma - ) - ), - new UniformParticipationRateLinear ( - new ParticipationRateLinear ( - dblEpsilon, - dblEta - ) - ) - ); - - EfficientTradingTrajectoryDiscrete ettd = (EfficientTradingTrajectoryDiscrete) new StaticOptimalSchemeDiscrete ( - dttc, - lpep, - PowerVarianceObjectiveUtility.LiquidityVaR (dblLambdaV) - ).generate(); - - double[] adblExecutionTimeNode = ettd.executionTimeNode(); - - double[] adblTradeList = ettd.tradeList(); - - double[] adblHoldings = ettd.holdings(); - - LinearImpactTrajectoryEstimator lite = new LinearImpactTrajectoryEstimator (ettd); - - R1UnivariateNormal r1un = lite.totalCostDistributionSynopsis (lpep); - - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| ALMGREN-CHRISS TRAJECTORY GENERATOR INPUTS ||"); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\t| Initial Stock Price : " + dblS0); - - System.out.println ("\t| Initial Holdings : " + dblX); - - System.out.println ("\t| Liquidation Time : " + dblT); - - System.out.println ("\t| Number of Time Periods : " + iN); - - System.out.println ("\t| Daily Volume 5 million Shares : " + dblGamma); - - System.out.println ("\t| VaR Confidence Level :" + FormatUtil.FormatDouble (dblConfidenceLevel, 2, 2, 100.) + "%"); - - System.out.println ("\t| VaR Based Risk Aversion : " + dblLambdaV); - - System.out.println ("\t|"); - - System.out.println ( - "\t| Daily Volatility : " + - FormatUtil.FormatDouble (dblSigma, 1, 4, 1.) - ); - - System.out.println ( - "\t| Daily Returns : " + - FormatUtil.FormatDouble (dblAlpha, 1, 4, 1.) - ); - - System.out.println ("\t| Temporary Impact Fixed Offset : " + dblEpsilon); - - System.out.println ("\t| Eta : " + dblEta); - - System.out.println ("\t| Gamma : " + dblGamma); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\n\t|-----------------------------||"); - - System.out.println ("\t| Optimal Trading Trajectory ||"); - - System.out.println ("\t| ------- ------- ---------- ||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| Time Node ||"); - - System.out.println ("\t| Holdings ||"); - - System.out.println ("\t| Trade Amount ||"); - - System.out.println ("\t|-----------------------------||"); - - for (int i = 0; i <= iN; ++i) { - if (i == 0) - System.out.println ( - "\t|" + FormatUtil.FormatDouble (adblExecutionTimeNode[i], 1, 0, 1.) + " => " + - FormatUtil.FormatDouble (adblHoldings[i], 7, 1, 1.) + " | " + - FormatUtil.FormatDouble (0., 6, 1, 1.) + " ||" - ); - else - System.out.println ( - "\t|" + FormatUtil.FormatDouble (adblExecutionTimeNode[i], 1, 0, 1.) + " => " + - FormatUtil.FormatDouble (adblHoldings[i], 7, 1, 1.) + " | " + - FormatUtil.FormatDouble (adblTradeList[i - 1], 6, 1, 1.) + " ||" - ); - } - - System.out.println ("\t|-----------------------------||"); - - System.out.println ("\n\t|----------------------------------------------------------------||"); - - System.out.println ("\t| TRANSACTION COST RECONCILIATION: OPTIMAL vs. EXPLICIT LINEAR ||"); - - System.out.println ("\t|----------------------------------------------------------------||"); - - System.out.println ( - "\t| Transaction Cost Expectation : " + - FormatUtil.FormatDouble (r1un.mean(), 7, 1, 1.) + " | " + - FormatUtil.FormatDouble (ettd.transactionCostExpectation(), 7, 1, 1.) + " ||" - ); - - System.out.println ( - "\t| Transaction Cost Variance (X 10^-06) : " + - FormatUtil.FormatDouble (r1un.variance(), 7, 1, 1.e-06) + " | " + - FormatUtil.FormatDouble (ettd.transactionCostVariance(), 7, 1, 1.e-06) + " ||" - ); - - System.out.println ("\t|----------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/lvar/OptimalTrajectoryWithDrift.java b/org/drip/sample/lvar/OptimalTrajectoryWithDrift.java deleted file mode 100644 index 71b6aec..0000000 --- a/org/drip/sample/lvar/OptimalTrajectoryWithDrift.java +++ /dev/null @@ -1,245 +0,0 @@ - -package org.drip.sample.lvar; - -import org.drip.execution.capture.LinearImpactTrajectoryEstimator; -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.*; -import org.drip.execution.nonadaptive.StaticOptimalSchemeDiscrete; -import org.drip.execution.optimum.EfficientTradingTrajectoryDiscrete; -import org.drip.execution.parameters.ArithmeticPriceDynamicsSettings; -import org.drip.execution.profiletime.UniformParticipationRateLinear; -import org.drip.execution.risk.PowerVarianceObjectiveUtility; -import org.drip.execution.strategy.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.measure.gaussian.R1UnivariateNormal; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OptimalTrajectoryWithDrift generates the Trade/Holdings List of Optimal Execution Schedule based on the - * Evolution Walk Parameters specified according to the Liquidity VaR Optimal Objective Function, inclusive - * of Drift. The Generation follows a Numerical Optimizer Scheme. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk, 3 (2), - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Non-linear Impact Functions and Trading Enhanced Risk, - * Applied Mathematical Finance, 10, 1-18. - * - * - Artzner, P., F. Delbaen, J. M. Eber, and D. Heath (1999): Coherent Measures of Risk, Mathematical - * Finance, 9, 203-228. - * - * - Basak, S., and A. Shapiro (2001): Value-at-Risk Based Risk Management: Optimal Policies and Asset - * Prices, Review of Financial Studies, 14, 371-405. - * - * @author Lakshmi Krishnamurthy - */ - -public class OptimalTrajectoryWithDrift { - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblS0 = 50.; - double dblSigma = 0.9487; - double dblAlpha = 0.02; - double dblEpsilon = 0.0625; - double dblGamma = 2.5e-07; - double dblEta = 2.5e-06; - double dblConfidenceLevel = 0.90; - - double dblX = 1000000.; - double dblT = 5.; - int iN = 5; - - double dblLambdaV = R1UnivariateNormal.Standard().confidenceInterval (dblConfidenceLevel); - - DiscreteTradingTrajectoryControl dttc = DiscreteTradingTrajectoryControl.FixedInterval ( - new OrderSpecification ( - dblX, - dblT - ), - iN - ); - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.LinearExpectation ( - new ArithmeticPriceDynamicsSettings ( - dblAlpha, - new FlatUnivariate (dblSigma), - 0. - ), - new UniformParticipationRateLinear ( - new ParticipationRateLinear ( - 0., - dblGamma - ) - ), - new UniformParticipationRateLinear ( - new ParticipationRateLinear ( - dblEpsilon, - dblEta - ) - ) - ); - - EfficientTradingTrajectoryDiscrete ettd = (EfficientTradingTrajectoryDiscrete) new StaticOptimalSchemeDiscrete ( - dttc, - lpep, - PowerVarianceObjectiveUtility.LiquidityVaR (dblLambdaV) - ).generate(); - - double[] adblExecutionTimeNode = ettd.executionTimeNode(); - - double[] adblTradeList = ettd.tradeList(); - - double[] adblHoldings = ettd.holdings(); - - LinearImpactTrajectoryEstimator lite = new LinearImpactTrajectoryEstimator (ettd); - - R1UnivariateNormal r1un = lite.totalCostDistributionSynopsis (lpep); - - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| ALMGREN-CHRISS TRAJECTORY GENERATOR INPUTS ||"); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\t| Initial Stock Price : " + dblS0); - - System.out.println ("\t| Initial Holdings : " + dblX); - - System.out.println ("\t| Liquidation Time : " + dblT); - - System.out.println ("\t| Number of Time Periods : " + iN); - - System.out.println ("\t| Daily Volume 5 million Shares : " + dblGamma); - - System.out.println ("\t| VaR Confidence Level :" + FormatUtil.FormatDouble (dblConfidenceLevel, 2, 2, 100.) + "%"); - - System.out.println ("\t| VaR Based Risk Aversion : " + dblLambdaV); - - System.out.println ("\t|"); - - System.out.println ( - "\t| Daily Volatility : " + - FormatUtil.FormatDouble (dblSigma, 1, 4, 1.) - ); - - System.out.println ( - "\t| Daily Returns : " + - FormatUtil.FormatDouble (dblAlpha, 1, 4, 1.) - ); - - System.out.println ("\t| Temporary Impact Fixed Offset : " + dblEpsilon); - - System.out.println ("\t| Eta : " + dblEta); - - System.out.println ("\t| Gamma : " + dblGamma); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\n\t|-----------------------------||"); - - System.out.println ("\t| Optimal Trading Trajectory ||"); - - System.out.println ("\t| ------- ------- ---------- ||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| Time Node ||"); - - System.out.println ("\t| Holdings ||"); - - System.out.println ("\t| Trade Amount ||"); - - System.out.println ("\t|-----------------------------||"); - - for (int i = 0; i <= iN; ++i) { - if (i == 0) - System.out.println ( - "\t|" + FormatUtil.FormatDouble (adblExecutionTimeNode[i], 1, 0, 1.) + " => " + - FormatUtil.FormatDouble (adblHoldings[i], 7, 1, 1.) + " | " + - FormatUtil.FormatDouble (0., 6, 1, 1.) + " ||" - ); - else - System.out.println ( - "\t|" + FormatUtil.FormatDouble (adblExecutionTimeNode[i], 1, 0, 1.) + " => " + - FormatUtil.FormatDouble (adblHoldings[i], 7, 1, 1.) + " | " + - FormatUtil.FormatDouble (adblTradeList[i - 1], 6, 1, 1.) + " ||" - ); - } - - System.out.println ("\t|-----------------------------||"); - - System.out.println ("\n\t|----------------------------------------------------------------||"); - - System.out.println ("\t| TRANSACTION COST RECONCILIATION: OPTIMAL vs. EXPLICIT LINEAR ||"); - - System.out.println ("\t|----------------------------------------------------------------||"); - - System.out.println ( - "\t| Transaction Cost Expectation : " + - FormatUtil.FormatDouble (r1un.mean(), 7, 1, 1.) + " | " + - FormatUtil.FormatDouble (ettd.transactionCostExpectation(), 7, 1, 1.) + " ||" - ); - - System.out.println ( - "\t| Transaction Cost Variance (X 10^-06) : " + - FormatUtil.FormatDouble (r1un.variance(), 7, 1, 1.e-06) + " | " + - FormatUtil.FormatDouble (ettd.transactionCostVariance(), 7, 1, 1.e-06) + " ||" - ); - - System.out.println ("\t|----------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/matrix/CholeskyFactorization.java b/org/drip/sample/matrix/CholeskyFactorization.java deleted file mode 100644 index e4f78a3..0000000 --- a/org/drip/sample/matrix/CholeskyFactorization.java +++ /dev/null @@ -1,98 +0,0 @@ - -package org.drip.sample.matrix; - -import org.drip.quant.common.NumberUtil; -import org.drip.quant.linearalgebra.Matrix; -import org.drip.service.env.EnvManager; - -/* - - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CholeskyFactorization demonstrates the Cholesky Factorization and Transpose Reconciliation of the Input - * Matrix. - * - * @author Lakshmi Krishnamurthy - */ - -public class CholeskyFactorization { - - public static final void main ( - final String[] astrArg) - throws Exception - { - EnvManager.InitEnv (""); - - double[][] aadblA = { - {1.0, 0.3, 0.0}, - {0.3, 1.0, 0.1}, - {0.0, 0.1, 1.0} - }; - - double[][] aadblACholesky = Matrix.CholeskyBanachiewiczFactorization (aadblA); - - double[][] aadblACholeskyTranspose = Matrix.Transpose (aadblACholesky); - - System.out.println ("\n\t------------------------------------------------------------------------------------------------------"); - - NumberUtil.Print2DArrayTriplet ( - "\t\tSOURCE", - "CHOLESKY", - "ORIGINAL", - aadblA, - aadblACholesky, - Matrix.Product ( - aadblACholesky, - aadblACholeskyTranspose - ), - false - ); - - System.out.println ("\t------------------------------------------------------------------------------------------------------"); - } -} diff --git a/org/drip/sample/matrix/Eigenization.java b/org/drip/sample/matrix/Eigenization.java deleted file mode 100644 index e11d33b..0000000 --- a/org/drip/sample/matrix/Eigenization.java +++ /dev/null @@ -1,129 +0,0 @@ - -package org.drip.sample.matrix; - -import org.drip.quant.common.*; -import org.drip.quant.eigen.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * Eigenization demonstrates how to generate the eigenvalue and eigenvector for the Input Matrix. - * - * @author Lakshmi Krishnamurthy - */ - -public class Eigenization { - - private static final void EigenRun ( - final QREigenComponentExtractor qrece) - { - double dblCorr1 = 0.5 * Math.random(); - - double dblCorr2 = 0.5 * Math.random(); - - double[][] aadblA = { - { 1.0, dblCorr1, 0.0}, - {dblCorr1, 1.0, dblCorr2}, - { 0.0, dblCorr2, 1.0} - }; - - EigenOutput eo = qrece.eigenize (aadblA); - - if (null == eo) return; - - System.out.println ("\n\t|----------------------------------------|"); - - System.out.println ( - "\t|-----------" + - FormatUtil.FormatDouble (dblCorr1, 1, 4, 1.) + " ||| " + - FormatUtil.FormatDouble (dblCorr2, 1, 4, 1.) + " ---------|" - ); - - System.out.println ("\t|----------------------------------------|"); - - for (int i = 0; i < aadblA.length; ++i) { - java.lang.String strDump = "\t[" + FormatUtil.FormatDouble (eo.eigenvalue()[i], 1, 4, 1.) + "] => "; - - for (int j = 0; j < aadblA.length; ++j) - strDump += FormatUtil.FormatDouble (eo.eigenvector()[i][j], 1, 4, 1.) + " | "; - - System.out.println (strDump); - } - - EigenComponent ec = qrece.principalComponent (aadblA); - - double[] adblEigenvector = ec.eigenvector(); - - java.lang.String strDump = "[" + FormatUtil.FormatDouble (ec.eigenvalue(), 1, 4, 1.) + "] => "; - - for (int i = 0; i < adblEigenvector.length; ++i) - strDump += FormatUtil.FormatDouble (adblEigenvector[i], 1, 4, 1.) + " | "; - - System.out.println ("\t" + strDump); - - System.out.println ("\t|----------------------------------------|"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - QREigenComponentExtractor qrece = new QREigenComponentExtractor ( - 50, - 0.00001 - ); - - int iNumRun = 10; - - for (int iRun = 0; iRun < iNumRun; ++iRun) - EigenRun (qrece); - } -} diff --git a/org/drip/sample/matrix/GrahamSchmidtProcess.java b/org/drip/sample/matrix/GrahamSchmidtProcess.java deleted file mode 100644 index 6919894..0000000 --- a/org/drip/sample/matrix/GrahamSchmidtProcess.java +++ /dev/null @@ -1,112 +0,0 @@ - -package org.drip.sample.matrix; - -import org.drip.quant.common.*; -import org.drip.quant.linearalgebra.Matrix; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * GrahamSchmidtProcess illustrates the Graham Schmidt Orthogonalization and Orthonormalization. - * - * @author Lakshmi Krishnamurthy - */ - -public class GrahamSchmidtProcess { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double[][] aadblV = new double[][] { - {3, 1, 4, 9}, - {2, 2, 6, 0}, - {1, 8, 3, 5}, - {7, 0, 4, 5} - }; - - double[][] aadblUOrthogonal = Matrix.GrahamSchmidtOrthogonalization (aadblV); - - NumberUtil.PrintMatrix ( - "ORTHOGONAL", - aadblUOrthogonal - ); - - System.out.println ( - "ORTHOGONAL TEST: " + - FormatUtil.FormatDouble ( - Matrix.DotProduct ( - aadblUOrthogonal[0], - aadblUOrthogonal[1] - ), - 1, 1, 1. - ) - ); - - double[][] aadblUOrthonormal = Matrix.GrahamSchmidtOrthonormalization (aadblV); - - NumberUtil.PrintMatrix ( - "ORTHONORMAL", - aadblUOrthonormal - ); - - System.out.println ( - "ORTHONORMAL TEST: " + - FormatUtil.FormatDouble ( - Matrix.DotProduct ( - aadblUOrthonormal[0], - aadblUOrthonormal[1] - ), - 1, 1, 1. - ) - ); - } -} diff --git a/org/drip/sample/matrix/LinearAlgebra.java b/org/drip/sample/matrix/LinearAlgebra.java deleted file mode 100644 index 85f1cc3..0000000 --- a/org/drip/sample/matrix/LinearAlgebra.java +++ /dev/null @@ -1,216 +0,0 @@ - -package org.drip.sample.matrix; - -import org.drip.quant.common.*; -import org.drip.quant.linearalgebra.*; - -/* - - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * LinearAlgebra implements Samples for Linear Algebra and Matrix Manipulations. It demonstrates the - * following: - * - Compute the inverse of a matrix, and multiply with the original to recover the unit matrix - * - Solves system of linear equations using one the exposed techniques - * - * @author Lakshmi Krishnamurthy - */ - -public class LinearAlgebra { - - /* - * Sample illustrating the Invocation of Base Matrix Inversion and Product Computation Verification. - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final void InverseVerifyDump ( - final String strLabel, - final double[][] aadblA) - { - double[][] aadblAInv = Matrix.InvertUsingGaussianElimination (aadblA); - - System.out.println ("--- TESTS FOR " + strLabel + "---"); - - System.out.println ("---------------------------------"); - - NumberUtil.Print2DArrayTriplet ( - "\tSOURCE" + strLabel, - "INVERSE" + strLabel, - "PRODUCT" + strLabel, - aadblA, - aadblAInv, - Matrix.Product ( - aadblA, - aadblAInv - ), - false - ); - - System.out.println ("---------------------------------\n\n"); - } - - /* - * Sample illustrating the Invocation of Base Matrix Manipulation Functionality - * - * WARNING: Insufficient Error Checking, so use caution - */ - - public static final void MatrixManipulation() - { - InverseVerifyDump ("#A", new double[][] { - {1, 2, 3}, - {4, 5, 6}, - {7, 8, 9.01} - }); - - InverseVerifyDump ("#B", new double[][] { - { 0.1667, 0.0000, 0.0000, 0.0000}, - { 0.0000, 0.0000, 0.0000, 0.1667}, - {-0.6667, 0.5000, 0.0000, 0.0000}, - { 2.6667, -3.0000, 1.0000, 0.0000} - }); - - InverseVerifyDump ("#C", new double[][] { - { 1.0000, 0.0000, 0.0000, 0.0000}, - { 1.0000, 1.0000, 1.0000, 1.0000}, - { 0.0000, 1.0000, 0.0000, 0.0000}, - { 0.0000, 0.0000, 2.0000, 0.0000} - }); - - InverseVerifyDump ("#D", new double[][] { - { 0.0000, 1.0000}, - { 1.0000, 2.0000} - }); - - InverseVerifyDump ("#E", new double[][] { - { 0.0000, 1.0000}, - { 1.0000, 0.0000} - }); - - InverseVerifyDump ("#F", new double[][] { - { 1.0000, 0.0000, 0.0000, 0.0000}, - { 1.0000, 1.0000, 1.0000, 1.0000}, - {-1.0000, 1.0000, 0.0000, 0.0000}, - { 1.0000, 2.0000, 3.0000, 4.0000} - }); - - InverseVerifyDump ("#G", new double[][] { - { 0.0000, 1.0000, 0.0000, 0.0000}, - { 0.0000, 0.0000, 2.0000, 0.0000}, - { 0.0434, 0.0188, 16.0083, 24.0037}, - { 0.0188, 0.0083, 24.0037, 48.0017} - }); - } - - /* - * Sample illustrating the Invocation of Linear System Solver Functionality - * - * WARNING: Insufficient Error Checking, so use caution - */ - - public static final void LinearSystemSolver() - { - double[][] aadblA = new double[][] { - {1.000, 0.500, 0.333, 0.000, 0.000, 0.000}, - {0.000, 0.000, 0.000, 1.000, 0.500, 0.333}, - {1.000, 1.000, 1.000, -1.000, 0.000, 0.000}, - {0.000, 0.500, 2.000, 0.000, -0.500, 0.000}, - {0.000, 1.000, 0.000, 0.000, 0.000, 0.000}, - {0.000, 0.000, 0.000, 0.000, 1.000, 0.000}, - }; - double[] adblB = new double[] {0.02, 0.026, 0., 0., 0., 0.}; - - org.drip.quant.common.NumberUtil.Print2DArray ( - "\tCOEFF", - aadblA, - false - ); - - /* - * Solve the Linear System using Gaussian Elimination - */ - - LinearizationOutput lssGaussianElimination = LinearSystemSolver.SolveUsingGaussianElimination ( - aadblA, - adblB - ); - - for (int i = 0; i < lssGaussianElimination.getTransformedRHS().length; ++i) - System.out.println ("GaussianElimination[" + i + "] = " + FormatUtil.FormatDouble - (lssGaussianElimination.getTransformedRHS()[i], 0, 6, 1.)); - - for (int i = 0; i < 6; ++i) { - double dblRHS = 0.; - - for (int j = 0; j < 6; ++j) - dblRHS += aadblA[i][j] * lssGaussianElimination.getTransformedRHS()[j]; - - System.out.println ("RHS[" + i + "]: " + dblRHS); - } - - /* - * Solve the Linear System using the Gauss-Seidel method - */ - - /* LinearSystemSolution lssGaussSeidel = LinearSystemSolver.SolveUsingGaussSeidel (aadblA, adblB); - - for (int i = 0; i < lssGaussSeidel.getSolution().length; ++i) - System.out.println ("GaussSeidel[" + i + "] = " + FormatUtil.FormatDouble (lssGaussSeidel.getSolution()[i], 0, 2, 1.)); */ - } - - public static final void main ( - final String[] astrArgs) - { - MatrixManipulation(); - - LinearSystemSolver(); - } -} diff --git a/org/drip/sample/matrix/MultivariateRandom.java b/org/drip/sample/matrix/MultivariateRandom.java deleted file mode 100644 index 3a9f402..0000000 --- a/org/drip/sample/matrix/MultivariateRandom.java +++ /dev/null @@ -1,99 +0,0 @@ - -package org.drip.sample.matrix; - -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; - -/* - - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * MultivariateRandom demonstrates the Technique to generate Correlated Multivariate Random Variables using - * Cholesky Factorial Method. - * - * @author Lakshmi Krishnamurthy - */ - -public class MultivariateRandom { - - public static final void main ( - final String[] astrArg) - throws Exception - { - EnvManager.InitEnv (""); - - double[][] aadblCorrelation = { - {1.0, 0.3, 0.0}, - {0.3, 1.0, 0.1}, - {0.0, 0.1, 1.0} - }; - - UnivariateSequenceGenerator[] aUSG = new UnivariateSequenceGenerator[] { - new BoxMullerGaussian (0., 1.), - new BoxMullerGaussian (0., 1.), - new BoxMullerGaussian (0., 1.) - }; - - MultivariateSequenceGenerator msg = new MultivariateSequenceGenerator ( - aUSG, - aadblCorrelation - ); - - for (int j = 0; j < 100; ++j) { - String strDump = "[" + j + "] => "; - - double[] adblRandom = msg.random(); - - for (int i = 0; i < aadblCorrelation.length; ++i) - strDump += FormatUtil.FormatDouble (adblRandom[i], 1, 4, 1.) + " | "; - - System.out.println ("\t" + strDump); - } - } -} diff --git a/org/drip/sample/matrix/PrincipalComponent.java b/org/drip/sample/matrix/PrincipalComponent.java deleted file mode 100644 index c339bb4..0000000 --- a/org/drip/sample/matrix/PrincipalComponent.java +++ /dev/null @@ -1,109 +0,0 @@ - -package org.drip.sample.matrix; - -import org.drip.quant.common.FormatUtil; -import org.drip.quant.eigen.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * PrincipalComponent demonstrates how to generate the Principal eigenvalue and eigenvector for the Input - * Matrix. - * - * @author Lakshmi Krishnamurthy - */ - -public class PrincipalComponent { - - private static final void PrincipalComponentRun ( - final PowerIterationComponentExtractor pice) - throws Exception - { - double dblCorr1 = 0.5 * Math.random(); - - double dblCorr2 = 0.5 * Math.random(); - - double[][] aadblA = { - { 1.0, dblCorr1, 0.0}, - {dblCorr1, 1.0, dblCorr2}, - { 0.0, dblCorr2, 1.0} - }; - - EigenComponent ec = pice.principalComponent (aadblA); - - double[] adblEigenvector = ec.eigenvector(); - - java.lang.String strDump = "[" + FormatUtil.FormatDouble (ec.eigenvalue(), 1, 4, 1.) + "] => "; - - for (int i = 0; i < adblEigenvector.length; ++i) - strDump += FormatUtil.FormatDouble (adblEigenvector[i], 1, 4, 1.) + " | "; - - System.out.println ( - "\t{" + - FormatUtil.FormatDouble (dblCorr1, 1, 4, 1.) + " ||" + - FormatUtil.FormatDouble (dblCorr2, 1, 4, 1.) + "} => " + strDump - ); - } - - public static final void main ( - final String[] astrArg) - throws Exception - { - EnvManager.InitEnv (""); - - PowerIterationComponentExtractor pice = new PowerIterationComponentExtractor ( - 30, - 0.000001, - false - ); - - for (int i = 0; i < 50; ++i) - PrincipalComponentRun (pice); - } -} diff --git a/org/drip/sample/matrix/QRDecomposition.java b/org/drip/sample/matrix/QRDecomposition.java deleted file mode 100644 index 6b1ae8e..0000000 --- a/org/drip/sample/matrix/QRDecomposition.java +++ /dev/null @@ -1,106 +0,0 @@ - -package org.drip.sample.matrix; - -import org.drip.quant.common.NumberUtil; -import org.drip.quant.linearalgebra.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * QRDecomposition demonstrates the technique to perform a QR Decomposition of the Input Square Matrix into - * an Orthogonal and an Upper Triangular Counterparts. - * - * @author Lakshmi Krishnamurthy - */ - -public class QRDecomposition { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - /* double[][] aadblA = { - { 12, -51, 4}, - { 6, 167, -68}, - { -4, 24, -41} - }; */ - - double[][] aadblA = { - { 1.0, 0.1, 0.0}, - { 0.1, 1.0, 0.4}, - { 0.0, 0.4, 1.0} - }; - - QR qr = Matrix.QRDecomposition (aadblA); - - double[][] aadblR = qr.r(); - - NumberUtil.PrintMatrix ("Initial R: ", aadblR); - - System.out.println(); - - double[][] aadblQ = qr.q(); - - NumberUtil.PrintMatrix ("Initial Q: ", aadblQ); - - System.out.println(); - - NumberUtil.PrintMatrix ("Inverse Q: ", Matrix.InvertUsingGaussianElimination (aadblQ)); - - System.out.println(); - - double[][] aadblQT = Matrix.Transpose (aadblQ); - - NumberUtil.PrintMatrix ("Transpose Q: ", aadblQT); - - System.out.println(); - } -} diff --git a/org/drip/sample/measure/BrownianBridgeConcave.java b/org/drip/sample/measure/BrownianBridgeConcave.java deleted file mode 100644 index be6aaac..0000000 --- a/org/drip/sample/measure/BrownianBridgeConcave.java +++ /dev/null @@ -1,135 +0,0 @@ - -package org.drip.sample.measure; - -import org.drip.analytics.date.*; -import org.drip.measure.continuousmarginal.BrokenDateBridgeBrownian3P; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * BrownianBridgeConcave demonstrates using the Brownian Bridge Scheme to Interpolate Three Concave Value - * Points. - * - * @author Lakshmi Krishnamurthy - */ - -public class BrownianBridgeConcave { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dt1 = DateUtil.CreateFromYMD ( - 2015, - DateUtil.JULY, - 1 - ); - - JulianDate dt2 = DateUtil.CreateFromYMD ( - 2015, - DateUtil.AUGUST, - 1 - ); - - JulianDate dt3 = DateUtil.CreateFromYMD ( - 2015, - DateUtil.SEPTEMBER, - 1 - ); - - double dblV1 = 10.; - double dblV2 = 30.; - double dblV3 = 20.; - - int iDaysStep = 2; - - BrokenDateBridgeBrownian3P tpbb = new BrokenDateBridgeBrownian3P ( - dt1.julian(), - dt2.julian(), - dt3.julian(), - dblV1, - dblV2, - dblV3 - ); - - System.out.println(); - - System.out.println ("\t||--------------------------||"); - - System.out.println ("\t|| BROWNIAN BRIDGE CONCAVE ||"); - - System.out.println ("\t||--------------------------||"); - - System.out.println ( - "\t|| [" + dt1 + "] => " + - FormatUtil.FormatDouble (tpbb.interpolate (dt1.julian()), 2, 3, 1.) + " ||" - ); - - JulianDate dt = dt1.addDays (iDaysStep); - - while (dt.julian() < dt3.julian()) { - System.out.println ( - "\t|| [" + dt + "] => " + - FormatUtil.FormatDouble (tpbb.interpolate (dt.julian()), 2, 3, 1.) + " ||" - ); - - dt = dt.addDays (iDaysStep); - } - - System.out.println ( - "\t|| [" + dt3 + "] => " + - FormatUtil.FormatDouble (tpbb.interpolate (dt3.julian()), 2, 3, 1.) + " ||" - ); - - System.out.println ("\t||--------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/measure/BrownianBridgeConvex.java b/org/drip/sample/measure/BrownianBridgeConvex.java deleted file mode 100644 index 9478bb2..0000000 --- a/org/drip/sample/measure/BrownianBridgeConvex.java +++ /dev/null @@ -1,135 +0,0 @@ - -package org.drip.sample.measure; - -import org.drip.analytics.date.*; -import org.drip.measure.continuousmarginal.BrokenDateBridgeBrownian3P; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * BrownianBridgeConvex demonstrates using the Brownian Bridge Scheme to Interpolate Three Convex Value - * Points. - * - * @author Lakshmi Krishnamurthy - */ - -public class BrownianBridgeConvex { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dt1 = DateUtil.CreateFromYMD ( - 2015, - DateUtil.JULY, - 1 - ); - - JulianDate dt2 = DateUtil.CreateFromYMD ( - 2015, - DateUtil.AUGUST, - 1 - ); - - JulianDate dt3 = DateUtil.CreateFromYMD ( - 2015, - DateUtil.SEPTEMBER, - 1 - ); - - double dblV1 = 10.; - double dblV2 = 5.; - double dblV3 = 20.; - - int iDaysStep = 2; - - BrokenDateBridgeBrownian3P tpbb = new BrokenDateBridgeBrownian3P ( - dt1.julian(), - dt2.julian(), - dt3.julian(), - dblV1, - dblV2, - dblV3 - ); - - System.out.println(); - - System.out.println ("\t||--------------------------||"); - - System.out.println ("\t|| BROWNIAN BRIDGE CONVEX ||"); - - System.out.println ("\t||--------------------------||"); - - System.out.println ( - "\t|| [" + dt1 + "] => " + - FormatUtil.FormatDouble (tpbb.interpolate (dt1.julian()), 2, 3, 1.) + " ||" - ); - - JulianDate dt = dt1.addDays (iDaysStep); - - while (dt.julian() < dt3.julian()) { - System.out.println ( - "\t|| [" + dt + "] => " + - FormatUtil.FormatDouble (tpbb.interpolate (dt.julian()), 2, 3, 1.) + " ||" - ); - - dt = dt.addDays (iDaysStep); - } - - System.out.println ( - "\t|| [" + dt3 + "] => " + - FormatUtil.FormatDouble (tpbb.interpolate (dt3.julian()), 2, 3, 1.) + " ||" - ); - - System.out.println ("\t||--------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/measure/BrownianBridgeLinear.java b/org/drip/sample/measure/BrownianBridgeLinear.java deleted file mode 100644 index 5fc1e2d..0000000 --- a/org/drip/sample/measure/BrownianBridgeLinear.java +++ /dev/null @@ -1,135 +0,0 @@ - -package org.drip.sample.measure; - -import org.drip.analytics.date.*; -import org.drip.measure.continuousmarginal.BrokenDateBridgeBrownian3P; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * BrownianBridgeLinear demonstrates using the Brownian Bridge Scheme to Interpolate Three Linear Value - * Points. - * - * @author Lakshmi Krishnamurthy - */ - -public class BrownianBridgeLinear { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dt1 = DateUtil.CreateFromYMD ( - 2015, - DateUtil.JULY, - 1 - ); - - JulianDate dt2 = DateUtil.CreateFromYMD ( - 2015, - DateUtil.AUGUST, - 1 - ); - - JulianDate dt3 = DateUtil.CreateFromYMD ( - 2015, - DateUtil.SEPTEMBER, - 1 - ); - - double dblV1 = 10.; - double dblV2 = 15.; - double dblV3 = 20.; - - int iDaysStep = 2; - - BrokenDateBridgeBrownian3P tpbb = new BrokenDateBridgeBrownian3P ( - dt1.julian(), - dt2.julian(), - dt3.julian(), - dblV1, - dblV2, - dblV3 - ); - - System.out.println(); - - System.out.println ("\t||--------------------------||"); - - System.out.println ("\t|| BROWNIAN BRIDGE LINEAR ||"); - - System.out.println ("\t||--------------------------||"); - - System.out.println ( - "\t|| [" + dt1 + "] => " + - FormatUtil.FormatDouble (tpbb.interpolate (dt1.julian()), 2, 3, 1.) + " ||" - ); - - JulianDate dt = dt1.addDays (iDaysStep); - - while (dt.julian() < dt3.julian()) { - System.out.println ( - "\t|| [" + dt + "] => " + - FormatUtil.FormatDouble (tpbb.interpolate (dt.julian()), 2, 3, 1.) + " ||" - ); - - dt = dt.addDays (iDaysStep); - } - - System.out.println ( - "\t|| [" + dt3 + "] => " + - FormatUtil.FormatDouble (tpbb.interpolate (dt3.julian()), 2, 3, 1.) + " ||" - ); - - System.out.println ("\t||--------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/measure/GaussianSequence.java b/org/drip/sample/measure/GaussianSequence.java deleted file mode 100644 index 6ce79cc..0000000 --- a/org/drip/sample/measure/GaussianSequence.java +++ /dev/null @@ -1,127 +0,0 @@ - -package org.drip.sample.measure; - -import org.drip.measure.discretemarginal.SequenceGenerator; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * GaussianSequence demonstrates the Generation of R^1 and Correlated/Uncorrelated R^d Gaussian Random - * Number Sequence. - * - * @author Lakshmi Krishnamurthy - */ - -public class GaussianSequence { - - private static final void CorrelatedSequence ( - final int iCount, - final double[][] aadblCorrelation, - final String strHeader) - throws Exception - { - double[][] aadblGaussianJoint = SequenceGenerator.GaussianJoint ( - iCount, - aadblCorrelation - ); - - System.out.println(); - - System.out.println ("\t||----------------------------------------------------||"); - - System.out.println (strHeader); - - System.out.println ("\t||----------------------------------------------------||"); - - for (int i = 0; i < iCount; ++i) { - String strDump = "\t||" + FormatUtil.FormatDouble (i, 2, 0, 1.) + " |"; - - for (int j = 0; j < aadblCorrelation.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (aadblGaussianJoint[i][j], 1, 6, 1.) + " |"; - - System.out.println (strDump + "|"); - } - - System.out.println ("\t||----------------------------------------------------||"); - - System.out.println(); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iCount = 50; - double[][] aadblCorrelation1 = new double[][] { - {1.00, 0.70, 0.25, 0.05}, - {0.70, 1.00, 0.13, 0.01}, - {0.25, 0.13, 1.00, 0.00}, - {0.05, 0.01, 0.00, 1.00} - }; - double[][] aadblCorrelation2 = new double[][] { - {1.00, 0.00, 0.00, 0.00}, - {0.00, 1.00, 0.00, 0.00}, - {0.00, 0.00, 1.00, 0.00}, - {0.00, 0.00, 0.00, 1.00} - }; - - CorrelatedSequence ( - iCount, - aadblCorrelation1, - "\t|| CORRELATED GAUSSIAN SEQUENCE ||" - ); - - CorrelatedSequence ( - iCount, - aadblCorrelation2, - "\t|| UNCORRELATED GAUSSIAN SEQUENCE ||" - ); - } -} diff --git a/org/drip/sample/measure/PiecewiseDisplacedLebesgue.java b/org/drip/sample/measure/PiecewiseDisplacedLebesgue.java deleted file mode 100644 index 77e8cba..0000000 --- a/org/drip/sample/measure/PiecewiseDisplacedLebesgue.java +++ /dev/null @@ -1,254 +0,0 @@ - -package org.drip.sample.measure; - -import org.drip.analytics.date.DateUtil; -import org.drip.analytics.date.JulianDate; -import org.drip.measure.lebesgue.R1PiecewiseDisplaced; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PiecewiseDisplacedLebesgue demonstrates the Generation, the Reconciliation, and the Usage of a Piece-wise - * Displaced Linear Lebesgue Measure. - * - * @author Lakshmi Krishnamurthy - */ - -public class PiecewiseDisplacedLebesgue { - - private static final void RPDL ( - final String strMessage, - final double dblXMin, - final double dblXMax, - final double[] adblX, - final double[] adblProb, - final double dblXMean) - throws Exception - { - R1PiecewiseDisplaced rpdl = R1PiecewiseDisplaced.Standard ( - dblXMin, - dblXMax, - adblX, - adblProb, - dblXMean - ); - - double[] adblQuintile = new double[] { - 0.25, - 0.50, - 0.75 - }; - - String strDump = "\t|| " + strMessage + " | "; - - /* for (int i = 0; i < adblX.length; ++i) - strDump += - FormatUtil.FormatDouble (adblX[i], 3, 3, 1.) + " =>" + - FormatUtil.FormatDouble (rpdl.cumulative (adblX[i]), 1, 2, 1.) + " | "; */ - - for (int i = 0; i < adblQuintile.length; ++i) - strDump += " " + - FormatUtil.FormatDouble (rpdl.invCumulative (adblQuintile[i]), 3, 3, 1.) + " =>" + - FormatUtil.FormatDouble (adblQuintile[i], 1, 2, 1.) + " | "; - - double[] adblDensitySlope = rpdl.piecewiseDensitySlopes(); - - for (int i = 0; i < adblDensitySlope.length; ++i) - strDump += FormatUtil.FormatDouble (adblDensitySlope[i], 1, 9, 1.) + ","; - - System.out.println (strDump + FormatUtil.FormatDouble (rpdl.densityDisplacement(), 1, 9, 1.) + " ||"); - } - - private static final void DateRPDL ( - final String strMessage, - final double dblXMin, - final double dblXMax, - final double[] adblX, - final double[] adblProb, - final double dblXMean) - throws Exception - { - R1PiecewiseDisplaced rpdl = R1PiecewiseDisplaced.Standard ( - dblXMin, - dblXMax, - adblX, - adblProb, - dblXMean - ); - - double[] adblQuintile = new double[] { - 0.25, - 0.50, - 0.75 - }; - - String strDump = "\t|| " + strMessage + " | "; - - for (int i = 0; i < adblQuintile.length; ++i) - strDump += - new JulianDate ((int) rpdl.invCumulative (adblQuintile[i])) + " =>" + - FormatUtil.FormatDouble (adblQuintile[i], 1, 2, 1.) + " | "; - - double[] adblDensitySlope = rpdl.piecewiseDensitySlopes(); - - for (int i = 0; i < adblDensitySlope.length; ++i) - strDump += FormatUtil.FormatDouble (adblDensitySlope[i], 1, 9, 1.) + ","; - - System.out.println (strDump + FormatUtil.FormatDouble (rpdl.densityDisplacement(), 1, 9, 1.) + " ||"); - } - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - System.out.println(); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| FIELD | CUMULATIVE PROBABILITY | PROBABILITY DENSITY PARAMETERS ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - RPDL ( - "Age (Months In Balance) ", - 0., - 60., - new double[] {3., 8., 15.}, - new double[] {0.25, 0.50, 0.75}, - 10.1 - ); - - DateRPDL ( - "Vintage ", - DateUtil.CreateFromDDMMMYYYY ("15-FEB-2007").julian(), - DateUtil.CreateFromDDMMMYYYY ("15-FEB-2015").julian(), - new double[] { - DateUtil.CreateFromDDMMMYYYY ("15-APR-2012").julian(), - DateUtil.CreateFromDDMMMYYYY ("15-MAR-2013").julian(), - DateUtil.CreateFromDDMMMYYYY ("15-FEB-2014").julian() - }, - new double[] {0.25, 0.50, 0.75}, - DateUtil.CreateFromDDMMMYYYY ("15-FEB-2013").julian() - ); - - RPDL ( - "Original Principal ('000s) ", - 0.5, - 35., - new double[] {8., 12., 20.}, - new double[] {0.25, 0.50, 0.75}, - 14.254 - ); - - RPDL ( - "Monthly Gross Income ('000s) ", - 0.25, - 725.549, - new double[] {3.75, 5.167, 7.333}, - new double[] {0.25, 0.50, 0.75}, - 6.066 - ); - - RPDL ( - "Coupon (%) ", - 5.3, - 29., - new double[] {10.6, 13.5, 16.3}, - new double[] {0.25, 0.50, 0.75}, - 13.70 - ); - - RPDL ( - "FICO At Origination ", - 612., - 847., - new double[] {677., 692., 717.}, - new double[] {0.25, 0.50, 0.75}, - 699. - ); - - RPDL ( - "DTI ex Mortgage (%) ", - 0., - 39., - new double[] {11., 16., 22.}, - new double[] {0.25, 0.50, 0.75}, - 16.6 - ); - - RPDL ( - "Total Borrower Accounts ", - 1, - 162, - new double[] {16., 23., 31.}, - new double[] {0.25, 0.50, 0.75}, - 25 - ); - - RPDL ( - "Revolving Utilization Rate (%) ", - 0., - 892., - new double[] {40., 58., 75.}, - new double[] {0.25, 0.50, 0.75}, - 57. - ); - - RPDL ( - "Inquiries in Last 6 Months ", - 0., - 33., - new double[] {1.}, - new double[] {0.75}, - 0.9 - ); - } -} diff --git a/org/drip/sample/measure/PiecewiseLinearLebesgue.java b/org/drip/sample/measure/PiecewiseLinearLebesgue.java deleted file mode 100644 index cba3429..0000000 --- a/org/drip/sample/measure/PiecewiseLinearLebesgue.java +++ /dev/null @@ -1,266 +0,0 @@ - -package org.drip.sample.measure; - -import org.drip.analytics.date.DateUtil; -import org.drip.analytics.date.JulianDate; -import org.drip.measure.lebesgue.R1PiecewiseLinear; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PiecewiseLinearLebesgue demonstrates the Generation, the Reconciliation, and the Usage of a Piece-wise - * Linear Lebesgue Measure. - * - * @author Lakshmi Krishnamurthy - */ - -public class PiecewiseLinearLebesgue { - - private static final void RPLL ( - final String strMessage, - final double dblXMin, - final double dblXMax, - final double[] adblX, - final double[] adblProb) - throws Exception - { - R1PiecewiseLinear rpll = R1PiecewiseLinear.Standard ( - dblXMin, - dblXMax, - adblX, - adblProb - ); - - double[] adblQuintile = new double[] { - 0.25, - 0.50, - 0.75 - }; - - String strDump = "\t|| " + strMessage + " | "; - - /* for (int i = 0; i < adblX.length; ++i) - strDump += - FormatUtil.FormatDouble (adblX[i], 3, 3, 1.) + " =>" + - FormatUtil.FormatDouble (rpll.cumulative (adblX[i]), 1, 2, 1.) + " | "; */ - - for (int i = 0; i < adblQuintile.length; ++i) - strDump += " " + - FormatUtil.FormatDouble (rpll.invCumulative (adblQuintile[i]), 3, 3, 1.) + " =>" + - FormatUtil.FormatDouble (adblQuintile[i], 1, 2, 1.) + " | "; - - double[] adblDensity = rpll.piecewiseDensities(); - - for (int i = 0; i < adblDensity.length; ++i) - strDump += FormatUtil.FormatDouble (adblDensity[i], 1, 9, 1.) + ","; - - System.out.println (strDump + " ||"); - } - - private static final void DateRPLL ( - final String strMessage, - final double dblXMin, - final double dblXMax, - final double[] adblX, - final double[] adblProb) - throws Exception - { - R1PiecewiseLinear rpll = R1PiecewiseLinear.Standard ( - dblXMin, - dblXMax, - adblX, - adblProb - ); - - double[] adblQuintile = new double[] { - 0.25, - 0.50, - 0.75 - }; - - String strDump = "\t|| " + strMessage + " | "; - - for (int i = 0; i < adblQuintile.length; ++i) - strDump += - new JulianDate ((int) rpll.invCumulative (adblQuintile[i])) + " =>" + - FormatUtil.FormatDouble (adblQuintile[i], 1, 2, 1.) + " | "; - - double[] adblDensity = rpll.piecewiseDensities(); - - for (int i = 0; i < adblDensity.length; ++i) - strDump += FormatUtil.FormatDouble (adblDensity[i], 1, 9, 1.) + ","; - - System.out.println (strDump + " ||"); - } - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - System.out.println(); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| FIELD | CUMULATIVE PROBABILITY | PROBABILITY DENSITY NODES ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - RPLL ( - "Age (Months In Balance) ", - 0., - 60., - new double[] {3., 8., 15.}, - new double[] {0.25, 0.50, 0.75} - ); - - DateRPLL ( - "Vintage ", - DateUtil.CreateFromDDMMMYYYY ("01-FEB-2007").julian(), - DateUtil.CreateFromDDMMMYYYY ("01-FEB-2015").julian(), - new double[] { - DateUtil.CreateFromDDMMMYYYY ("01-APR-2012").julian(), - DateUtil.CreateFromDDMMMYYYY ("01-MAR-2013").julian(), - DateUtil.CreateFromDDMMMYYYY ("01-FEB-2014").julian() - }, - new double[] {0.25, 0.50, 0.75} - ); - - RPLL ( - "Original Principal ('000s) ", - 0.5, - 35., - new double[] {8., 12., 20.}, - new double[] {0.25, 0.50, 0.75} - ); - - RPLL ( - "Monthly Gross Income ('000s) ", - 0.25, - 725.549, - new double[] {3.75, 5.167, 7.333}, - new double[] {0.25, 0.50, 0.75} - ); - - RPLL ( - "Coupon (%) ", - 5.3, - 29., - new double[] {10.6, 13.5, 16.3}, - new double[] {0.25, 0.50, 0.75} - ); - - RPLL ( - "FICO At Origination ", - 612., - 847., - new double[] {677., 692., 717.}, - new double[] {0.25, 0.50, 0.75} - ); - - RPLL ( - "DTI ex Mortgage (%) ", - 0., - 30., - new double[] {11., 16., 22.}, - new double[] {0.25, 0.50, 0.75} - ); - - RPLL ( - "Total Borrower Accounts ", - 1., - 162., - new double[] {16., 23., 31.}, - new double[] {0.25, 0.50, 0.75} - ); - - RPLL ( - "Revolving Utilization Rate (%) ", - 0., - 892., - new double[] {40., 58., 75.}, - new double[] {0.25, 0.50, 0.75} - ); - - RPLL ( - "Inquiries in Last 6 Months ", - 0., - 33., - new double[] {1.}, - new double[] {0.75} - ); - - RPLL ( - "Months Since Last Delinquency ", - 0., - 188., - new double[] {16., 31., 50.}, - new double[] {0.25, 0.50, 0.75} - ); - - RPLL ( - "Months Since Last Public Record ", - 0., - 129., - new double[] {55., 79., 102.}, - new double[] {0.25, 0.50, 0.75} - ); - - RPLL ( - "Total Open Credit Lines ", - 0., - 90., - new double[] {8., 10., 14.}, - new double[] {0.25, 0.50, 0.75} - ); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/multicurve/CustomBasisCurveBuilder.java b/org/drip/sample/multicurve/CustomBasisCurveBuilder.java deleted file mode 100644 index f1212ad..0000000 --- a/org/drip/sample/multicurve/CustomBasisCurveBuilder.java +++ /dev/null @@ -1,253 +0,0 @@ - -package org.drip.sample.multicurve; - -import org.drip.analytics.date.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.basis.BasisCurve; -import org.drip.state.creator.ScenarioBasisCurveBuilder; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * CustomBasisCurveBuilder contains the sample demonstrating the full functionality behind creating highly - * customized spline based Basis curves. - * - * @author Lakshmi Krishnamurthy - */ - -public class CustomBasisCurveBuilder { - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today(); - - String[] astrTenor = new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }; - - double[] adblBasis = new double[] { - 0.00186, // 1Y - 0.00127, // 2Y - 0.00097, // 3Y - 0.00080, // 4Y - 0.00067, // 5Y - 0.00058, // 6Y - 0.00051, // 7Y - 0.00046, // 8Y - 0.00042, // 9Y - 0.00038, // 10Y - 0.00035, // 11Y - 0.00033, // 12Y - 0.00028, // 15Y - 0.00022, // 20Y - 0.00020, // 25Y - 0.00018 // 30Y - }; - - BasisCurve bcCubicPolynomial = ScenarioBasisCurveBuilder.CubicPolynomialBasisCurve ( - "USD3M6MBasis_CubicPolynomial", - dtToday, - ForwardLabel.Create ( - "USD", - "6M" - ), - ForwardLabel.Create ( - "USD", - "3M" - ), - false, - astrTenor, - adblBasis - ); - - BasisCurve bcQuinticPolynomial = ScenarioBasisCurveBuilder.QuarticPolynomialBasisCurve ( - "USD3M6MBasis_QuinticPolynomial", - dtToday, - ForwardLabel.Create ( - "USD", - "6M" - ), - ForwardLabel.Create ( - "USD", - "3M" - ), - false, - astrTenor, - adblBasis - ); - - BasisCurve bcKaklisPandelis = ScenarioBasisCurveBuilder.KaklisPandelisBasisCurve ( - "USD3M6MBasis_KaklisPandelis", - dtToday, - ForwardLabel.Create ( - "USD", - "6M" - ), - ForwardLabel.Create ( - "USD", - "3M" - ), - false, - astrTenor, - adblBasis - ); - - BasisCurve bcKLKHyperbolic = ScenarioBasisCurveBuilder.KLKHyperbolicBasisCurve ( - "USD3M6MBasis_KLKHyperbolic", - dtToday, - ForwardLabel.Create ( - "USD", - "6M" - ), - ForwardLabel.Create ( - "USD", - "3M" - ), - false, - astrTenor, - adblBasis, - 1. - ); - - BasisCurve bcKLKRationalLinear = ScenarioBasisCurveBuilder.KLKRationalLinearBasisCurve ( - "USD3M6MBasis_KLKRationalLinear", - dtToday, - ForwardLabel.Create ( - "USD", - "6M" - ), - ForwardLabel.Create ( - "USD", - "3M" - ), - false, - astrTenor, - adblBasis, - 0.1 - ); - - BasisCurve bcKLKRationalQuadratic = ScenarioBasisCurveBuilder.KLKRationalLinearBasisCurve ( - "USD3M6MBasis_KLKRationalQuadratic", - dtToday, - ForwardLabel.Create ( - "USD", - "6M" - ), - ForwardLabel.Create ( - "USD", - "3M" - ), - false, - astrTenor, - adblBasis, - 2. - ); - - System.out.println ("\tPrinting the Basis Node Values in Order (Left -> Right):"); - - System.out.println ("\t\tCalculated Cubic Polynomial Basis (%)"); - - System.out.println ("\t\tCalculated Quintic Polynomial Basis (%)"); - - System.out.println ("\t\tCalculated Kaklis Pandelis Basis (%)"); - - System.out.println ("\t\tCalculated KLK Hyperbolic Basis (%)"); - - System.out.println ("\t\tCalculated KLK Rational Linear Basis (%)"); - - System.out.println ("\t\tCalculated KLK Rational Quadratic Basis (%)"); - - System.out.println ("\t\tInput Quote (bp)"); - - System.out.println ("\t-------------------------------------------------------------"); - - System.out.println ("\t-------------------------------------------------------------"); - - for (int i = 0; i < adblBasis.length; ++i) - System.out.println ("\t" + astrTenor[i] + " => " + - FormatUtil.FormatDouble (bcCubicPolynomial.basis (astrTenor[i]), 1, 2, 10000.) + " | " + - FormatUtil.FormatDouble (bcQuinticPolynomial.basis (astrTenor[i]), 1, 2, 10000.) + " | " + - FormatUtil.FormatDouble (bcKaklisPandelis.basis (astrTenor[i]), 1, 2, 10000.) + " | " + - FormatUtil.FormatDouble (bcKLKHyperbolic.basis (astrTenor[i]), 1, 2, 10000.) + " | " + - FormatUtil.FormatDouble (bcKLKRationalLinear.basis (astrTenor[i]), 1, 2, 10000.) + " | " + - FormatUtil.FormatDouble (bcKLKRationalQuadratic.basis (astrTenor[i]), 1, 2, 10000.) + " | " + - FormatUtil.FormatDouble (adblBasis[i], 1, 2, 10000.) - ); - - System.out.println ("\n\t|----------------------------------------------------------------------------|"); - - System.out.println ("\t| DATE => CUBIC | QUINTIC | KAKPAND | KLKHYPER | KLKRATLNR | KLKRATQUA |"); - - System.out.println ("\t|----------------------------------------------------------------------------|\n"); - - for (int i = 3; i < 30; ++i) { - JulianDate dt = dtToday.addTenor (i + "Y"); - - System.out.println ("\t" + dt + " => " + - FormatUtil.FormatDouble (bcCubicPolynomial.basis (dt), 1, 2, 10000.) + " | " + - FormatUtil.FormatDouble (bcQuinticPolynomial.basis (dt), 1, 2, 10000.) + " | " + - FormatUtil.FormatDouble (bcKaklisPandelis.basis (dt), 1, 2, 10000.) + " | " + - FormatUtil.FormatDouble (bcKLKHyperbolic.basis (dt), 1, 2, 10000.) + " | " + - FormatUtil.FormatDouble (bcKLKRationalLinear.basis (dt), 1, 2, 10000.) + " | " + - FormatUtil.FormatDouble (bcKLKRationalQuadratic.basis (dt), 1, 2, 10000.) + " | " - ); - } - - System.out.println ("\n\t|----------------------------------------------------------------------------|"); - } -} diff --git a/org/drip/sample/multicurve/FixFloatForwardCurve.java b/org/drip/sample/multicurve/FixFloatForwardCurve.java deleted file mode 100644 index 9867c48..0000000 --- a/org/drip/sample/multicurve/FixFloatForwardCurve.java +++ /dev/null @@ -1,721 +0,0 @@ - -package org.drip.sample.multicurve; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FixFloatForwardCurve contains the sample demonstrating the full functionality behind creating highly - * customized spline based forward curves from fix-float swaps and the discount curves. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixFloatForwardCurve { - - private static final FixFloatComponent OTCFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFutures, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFutures]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFutures, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFutures; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency, - final double dblBump) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] {}, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] {}; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - // 0.00092 + dblBump, // 6M - 0.0009875 + dblBump, // 9M - 0.00122 + dblBump, // 1Y - 0.00223 + dblBump, // 18M - 0.00383 + dblBump, // 2Y - 0.00827 + dblBump, // 3Y - 0.01245 + dblBump, // 4Y - 0.01605 + dblBump, // 5Y - 0.02597 + dblBump // 10Y - }; - - String[] astrSwapManifestMeasure = new String[] { - // "SwapRate", // 6M - "SwapRate", // 9M - "SwapRate", // 1Y - "SwapRate", // 18M - "SwapRate", // 2Y - "SwapRate", // 3Y - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate" // 10Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "9M", "1Y", "18M", "2Y", "3Y", "4Y", "5Y", "10Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - "USD" - ), - aDepositComp, - adblDepositQuote, - null, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - true - ); - } - - /* - * Construct an array of fix-float swaps from the fixed reference and the xM floater derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] MakeFixFloatxMSwap ( - final JulianDate dtEffective, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon, - final int iTenorInMonths) - throws Exception - { - FixFloatComponent[] aFFC = new FixFloatComponent[astrMaturityTenor.length]; - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - true, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - iTenorInMonths + "M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - ForwardLabel.Create ( - strCurrency, - iTenorInMonths + "M" - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 12 / iTenorInMonths, - iTenorInMonths + "M", - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - "6M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - adblCoupon[i], - 0., - strCurrency - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - iTenorInMonths + "M", - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - aFFC[i] = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - } - - return aFFC; - } - - private static final Map FixFloatxMBasisSample ( - final JulianDate dtSpot, - final String strCurrency, - final MergedDiscountForwardCurve dc, - final int iTenorInMonths, - final String[] astrxM6MFwdTenor, - final String strManifestMeasure, - final double[] adblxM6MBasisSwapQuote, - final double[] adblSwapCoupon) - throws Exception - { - System.out.println ("-----------------------------------------------------------------------------------------------------------------------------"); - - System.out.println (" SPL => n=3 | n=4 | KLK | | |"); - - System.out.println ("--------------------------------------------------------------------------------------------------------| LOG DF | LIBOR |"); - - System.out.println (" MSR => RECALC | REFEREN | DERIVED | RECALC | REFEREN | DERIVED | RECALC | REFEREN | DERIVED | | |"); - - System.out.println ("-----------------------------------------------------------------------------------------------------------------------------"); - - /* - * Construct the 6M-xM float-float basis swap. - */ - - FixFloatComponent[] aFFC = MakeFixFloatxMSwap ( - dtSpot, - strCurrency, - astrxM6MFwdTenor, - adblSwapCoupon, - iTenorInMonths - ); - - String strBasisTenor = iTenorInMonths + "M"; - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Calculate the starting forward rate off of the discount curve. - */ - - double dblStartingFwd = dc.forward ( - dtSpot.julian(), - dtSpot.addTenor (strBasisTenor).julian() - ); - - /* - * Set the discount curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - Map mapForward = new HashMap(); - - /* - * Construct the shape preserving forward curve off of Cubic Polynomial Basis Spline. - */ - - ForwardCurve fcxMCubic = ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - "CUBIC_FWD" + strBasisTenor, - ForwardLabel.Create ( - strCurrency, - strBasisTenor - ), - valParams, - null, - mktParams, - null, - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - aFFC, - strManifestMeasure, - adblxM6MBasisSwapQuote, - dblStartingFwd - ); - - mapForward.put ( - " CUBIC_FWD" + strBasisTenor, - fcxMCubic - ); - - /* - * Set the discount curve + cubic polynomial forward curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParamsCubicFwd = MarketParamsBuilder.Create ( - dc, - fcxMCubic, - null, - null, - null, - null, - null, - null - ); - - /* - * Construct the shape preserving forward curve off of Quartic Polynomial Basis Spline. - */ - - ForwardCurve fcxMQuartic = ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - "QUARTIC_FWD" + strBasisTenor, - ForwardLabel.Create ( - strCurrency, - strBasisTenor - ), - valParams, - null, - mktParams, - null, - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (5), - aFFC, - strManifestMeasure, - adblxM6MBasisSwapQuote, - dblStartingFwd - ); - - mapForward.put ( - " QUARTIC_FWD" + strBasisTenor, - fcxMQuartic - ); - - /* - * Set the discount curve + quartic polynomial forward curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParamsQuarticFwd = MarketParamsBuilder.Create ( - dc, - fcxMQuartic, - null, - null, - null, - null, - null, - null - ); - - /* - * Construct the shape preserving forward curve off of Hyperbolic Tension Based Basis Spline. - */ - - ForwardCurve fcxMKLKHyper = ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - "KLKHYPER_FWD" + strBasisTenor, - ForwardLabel.Create ( - strCurrency, - strBasisTenor - ), - valParams, - null, - mktParams, - null, - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new ExponentialTensionSetParams (1.), - aFFC, - strManifestMeasure, - adblxM6MBasisSwapQuote, - dblStartingFwd - ); - - mapForward.put ( - "KLKHYPER_FWD" + strBasisTenor, - fcxMKLKHyper - ); - - /* - * Set the discount curve + hyperbolic tension forward curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParamsKLKHyperFwd = MarketParamsBuilder.Create ( - dc, - fcxMKLKHyper, - null, - null, - null, - null, - null, - null - ); - - int i = 0; - int iFreq = 12 / iTenorInMonths; - - /* - * Compute the following forward curve metrics for each of cubic polynomial forward, quartic - * polynomial forward, and KLK Hyperbolic tension forward curves: - * - Reference Basis Par Spread - * - Derived Basis Par Spread - * - * Further compare these with a) the forward rate off of the discount curve, b) the LIBOR rate, and - * c) Input Basis Swap Quote. - */ - - for (String strMaturityTenor : astrxM6MFwdTenor) { - int iFwdEndDate = dtSpot.addTenor (strMaturityTenor).julian(); - - int iFwdStartDate = dtSpot.addTenor (strMaturityTenor).subtractTenor (strBasisTenor).julian(); - - FixFloatComponent ffc = aFFC[i++]; - - CaseInsensitiveTreeMap mapCubicValue = ffc.value ( - valParams, - null, - mktParamsCubicFwd, - null - ); - - CaseInsensitiveTreeMap mapQuarticValue = ffc.value ( - valParams, - null, - mktParamsQuarticFwd, - null - ); - - CaseInsensitiveTreeMap mapKLKHyperValue = ffc.value ( - valParams, - null, - mktParamsKLKHyperFwd, - null - ); - - System.out.println (" " + strMaturityTenor + " => " + - FormatUtil.FormatDouble (fcxMCubic.forward (iFwdStartDate), 2, 2, 100.) + " | " + - FormatUtil.FormatDouble (mapCubicValue.get ("ReferenceParBasisSpread"), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (mapCubicValue.get ("DerivedParBasisSpread"), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (fcxMQuartic.forward (iFwdStartDate), 2, 2, 100.) + " | " + - FormatUtil.FormatDouble (mapQuarticValue.get ("ReferenceParBasisSpread"), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (mapQuarticValue.get ("DerivedParBasisSpread"), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (fcxMKLKHyper.forward (iFwdStartDate), 2, 2, 100.) + " | " + - FormatUtil.FormatDouble (mapKLKHyperValue.get ("ReferenceParBasisSpread"), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (mapKLKHyperValue.get ("DerivedParBasisSpread"), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (iFreq * java.lang.Math.log (dc.df (iFwdStartDate) / dc.df (iFwdEndDate)), 1, 2, 100.) + " | " + - FormatUtil.FormatDouble (dc.libor (iFwdStartDate, iFwdEndDate), 1, 2, 100.) + " | " - ); - } - - return mapForward; - } - - private static final Map CustomFixFloatForwardCurveSample ( - final JulianDate dtValue, - final String strCurrency, - final MergedDiscountForwardCurve dc, - final String strCalibMeasure, - final int iTenorInMonths) - throws Exception - { - return FixFloatxMBasisSample ( - dtValue, - "USD", - dc, - iTenorInMonths, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - strCalibMeasure, - new double[] { - 0.0005, // 4Y - 0.0005, // 5Y - 0.0005, // 6Y - 0.0005, // 7Y - 0.0005, // 8Y - 0.0005, // 9Y - 0.0005, // 10Y - 0.0005, // 11Y - 0.0005, // 12Y - 0.0005, // 15Y - 0.0005, // 20Y - 0.0005, // 25Y - 0.0005, // 30Y - 0.0005, // 40Y - 0.0005 // 50Y - }, - new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - } - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - /* - * Construct the Discount Curve using its instruments and quotes - */ - - MergedDiscountForwardCurve dc = MakeDC ( - dtToday, - strCurrency, - 0. - ); - - CustomFixFloatForwardCurveSample ( - dtToday, - strCurrency, - dc, - "DerivedParBasisSpread", - 3 - ); - - CustomFixFloatForwardCurveSample ( - dtToday, - strCurrency, - dc, - "ReferenceParBasisSpread", - 3 - ); - } -} diff --git a/org/drip/sample/multicurve/FixFloatSwap.java b/org/drip/sample/multicurve/FixFloatSwap.java deleted file mode 100644 index e11cb5c..0000000 --- a/org/drip/sample/multicurve/FixFloatSwap.java +++ /dev/null @@ -1,758 +0,0 @@ - -package org.drip.sample.multicurve; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.*; -import org.drip.product.rates.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FixFloatSwap contains a full valuation run on the Multi-Curve Fix-Float IRS Product. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixFloatSwap { - - private static final FixFloatComponent OTCFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final FloatFloatComponent OTCFloatFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strDerivedTenor, - final String strMaturityTenor, - final double dblBasis) - { - FloatFloatSwapConvention ffConv = IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - return ffConv.createFloatFloatComponent ( - dtSpot, - strDerivedTenor, - strMaturityTenor, - dblBasis, - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFutures, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFutures]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFutures, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFutures; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate" - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate", // 30Y - "SwapRate", // 40Y - "SwapRate" // 50Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - "USD" - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - } - - /* - * Construct an array of float-float swaps from the corresponding reference (6M) and the derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FloatFloatComponent[] MakexM6MBasisSwap ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final int iTenorInMonths) - throws Exception - { - FloatFloatComponent[] aFFC = new FloatFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aFFC[i] = OTCFloatFloat ( - dtSpot, - strCurrency, - iTenorInMonths + "M", - astrMaturityTenor[i], - 0. - ); - - return aFFC; - } - - private static final ForwardCurve MakeFC ( - final JulianDate dtSpot, - final String strCurrency, - final MergedDiscountForwardCurve dc, - final int iTenorInMonths, - final String[] astrxM6MFwdTenor, - final double[] adblxM6MBasisSwapQuote) - throws Exception - { - /* - * Construct the 6M-xM float-float basis swap. - */ - - FloatFloatComponent[] aFFC = MakexM6MBasisSwap ( - dtSpot, - strCurrency, - astrxM6MFwdTenor, - iTenorInMonths - ); - - String strBasisTenor = iTenorInMonths + "M"; - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Calculate the starting forward rate off of the discount curve. - */ - - double dblStartingFwd = dc.forward ( - dtSpot.julian(), - dtSpot.addTenor (strBasisTenor).julian() - ); - - /* - * Set the discount curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Construct the shape preserving forward curve off of Quartic Polynomial Basis Spline. - */ - - return ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - "QUARTIC_FWD" + strBasisTenor, - ForwardLabel.Create ( - strCurrency, - strBasisTenor - ), - valParams, - null, - mktParams, - null, - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (5), - aFFC, - "DerivedParBasisSpread", - adblxM6MBasisSwapQuote, - dblStartingFwd - ); - } - - private static final Map MakeFC ( - final JulianDate dt, - final String strCurrency, - final MergedDiscountForwardCurve dc) - throws Exception - { - Map mapFC = new HashMap(); - - /* - * Build and run the sampling for the 1M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc1M = MakeFC ( - dt, - strCurrency, - dc, - 1, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00551, // 1Y - 0.00387, // 2Y - 0.00298, // 3Y - 0.00247, // 4Y - 0.00211, // 5Y - 0.00185, // 6Y - 0.00165, // 7Y - 0.00150, // 8Y - 0.00137, // 9Y - 0.00127, // 10Y - 0.00119, // 11Y - 0.00112, // 12Y - 0.00096, // 15Y - 0.00079, // 20Y - 0.00069, // 25Y - 0.00062 // 30Y - } - ); - - mapFC.put ( - "1M", - fc1M - ); - - /* - * Build and run the sampling for the 3M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc3M = MakeFC ( - dt, - strCurrency, - dc, - 3, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00186, // 1Y - 0.00127, // 2Y - 0.00097, // 3Y - 0.00080, // 4Y - 0.00067, // 5Y - 0.00058, // 6Y - 0.00051, // 7Y - 0.00046, // 8Y - 0.00042, // 9Y - 0.00038, // 10Y - 0.00035, // 11Y - 0.00033, // 12Y - 0.00028, // 15Y - 0.00022, // 20Y - 0.00020, // 25Y - 0.00018 // 30Y - } - ); - - mapFC.put ( - "3M", - fc3M - ); - - /* - * Build and run the sampling for the 12M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc12M = MakeFC ( - dt, - strCurrency, - dc, - 12, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", - "35Y", "40Y" // Extrapolated - }, - new double[] { - -0.00212, // 1Y - -0.00152, // 2Y - -0.00117, // 3Y - -0.00097, // 4Y - -0.00082, // 5Y - -0.00072, // 6Y - -0.00063, // 7Y - -0.00057, // 8Y - -0.00051, // 9Y - -0.00047, // 10Y - -0.00044, // 11Y - -0.00041, // 12Y - -0.00035, // 15Y - -0.00028, // 20Y - -0.00025, // 25Y - -0.00022, // 30Y - -0.00022, // 35Y Extrapolated - -0.00022, // 40Y Extrapolated - } - ); - - mapFC.put ( - "12M", - fc12M - ); - - return mapFC; - } - - private static final FixFloatComponent CreateSTIR ( - final JulianDate dtEffective, - final String strMaturityTenor, - final ForwardLabel fri, - final double dblCoupon, - final String strCurrency) - throws Exception - { - JulianDate dtMaturity = dtEffective.addTenor (strMaturityTenor); - - int iTenorInMonths = Helper.TenorToMonths (fri.tenor()); - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - true, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - fri.tenor(), - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - fri, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - dblCoupon, - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 12 / iTenorInMonths, - fri.tenor(), - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - "6M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - strMaturityTenor, - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - fri.tenor(), - strMaturityTenor, - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent irs = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - irs.setPrimaryCode ("IRS." + dtMaturity.toString() + "." + strCurrency); - - return irs; - } - - private static final void RunWithVolCorrelation ( - final FixFloatComponent stir, - final ValuationParams valParams, - final CurveSurfaceQuoteContainer mktParams, - final ForwardLabel fri, - final double dblForwardVol, - final double dblFundingVol, - final double dblForwardFundingCorr) - throws Exception - { - FundingLabel fundingLabel = FundingLabel.Standard (fri.currency()); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - valParams.valueDate(), - VolatilityLabel.Standard (fri), - fri.currency(), - dblForwardVol - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - valParams.valueDate(), - VolatilityLabel.Standard (fundingLabel), - fri.currency(), - dblFundingVol - ) - ); - - mktParams.setForwardFundingCorrelation ( - fri, - fundingLabel, - new FlatUnivariate (dblForwardFundingCorr) - ); - - Map mapSTIROutput = stir.value ( - valParams, - null, - mktParams, - null - ); - - for (Map.Entry me : mapSTIROutput.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strTenor = "3M"; - String strCurrency = "USD"; - double dblForwardVolatility = 0.3; - double dblFundingVolatility = 0.1; - double dblForwardFundingCorr = 0.2; - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - /* - * Construct the Discount Curve using its instruments and quotes - */ - - MergedDiscountForwardCurve dc = MakeDC ( - dtToday, - strCurrency - ); - - Map mapFC = MakeFC ( - dtToday, - strCurrency, - dc - ); - - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - FixFloatComponent stir = CreateSTIR ( - dtToday.addTenor (strTenor), - "5Y", - fri, - 0.05, - strCurrency - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - mapFC.get (strTenor), - null, - null, - null, - null, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - strCurrency - ); - - RunWithVolCorrelation ( - stir, - valParams, - mktParams, - fri, - dblForwardVolatility, - dblFundingVolatility, - dblForwardFundingCorr - ); - } -} diff --git a/org/drip/sample/multicurve/FixFloatSwapAnalysis.java b/org/drip/sample/multicurve/FixFloatSwapAnalysis.java deleted file mode 100644 index 794d3bb..0000000 --- a/org/drip/sample/multicurve/FixFloatSwapAnalysis.java +++ /dev/null @@ -1,795 +0,0 @@ - -package org.drip.sample.multicurve; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.*; -import org.drip.product.rates.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FixFloatSwapAnalysis contains an analysis if the correlation and volatility impact on the fix-float Swap. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixFloatSwapAnalysis { - - private static final FixFloatComponent OTCFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final FloatFloatComponent OTCFloatFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strDerivedTenor, - final String strMaturityTenor, - final double dblBasis) - { - FloatFloatSwapConvention ffConv = IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - return ffConv.createFloatFloatComponent ( - dtSpot, - strDerivedTenor, - strMaturityTenor, - dblBasis, - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFutures, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFutures]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFutures, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFutures; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate" - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate", // 30Y - "SwapRate", // 40Y - "SwapRate" // 50Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - "USD" - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - } - - /* - * Construct an array of float-float swaps from the corresponding reference (6M) and the derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FloatFloatComponent[] MakexM6MBasisSwap ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final int iTenorInMonths) - throws Exception - { - FloatFloatComponent[] aFFC = new FloatFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aFFC[i] = OTCFloatFloat ( - dtSpot, - strCurrency, - iTenorInMonths + "M", - astrMaturityTenor[i], - 0. - ); - - return aFFC; - } - - private static final ForwardCurve MakeFC ( - final JulianDate dtSpot, - final String strCurrency, - final MergedDiscountForwardCurve dc, - final int iTenorInMonths, - final String[] astrxM6MFwdTenor, - final double[] adblxM6MBasisSwapQuote) - throws Exception - { - /* - * Construct the 6M-xM float-float basis swap. - */ - - FloatFloatComponent[] aFFC = MakexM6MBasisSwap ( - dtSpot, - strCurrency, - astrxM6MFwdTenor, - iTenorInMonths - ); - - String strBasisTenor = iTenorInMonths + "M"; - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Calculate the starting forward rate off of the discount curve. - */ - - double dblStartingFwd = dc.forward ( - dtSpot.julian(), - dtSpot.addTenor (strBasisTenor).julian() - ); - - /* - * Set the discount curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Construct the shape preserving forward curve off of Quartic Polynomial Basis Spline. - */ - - return ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - "QUARTIC_FWD" + strBasisTenor, - ForwardLabel.Create ( - strCurrency, - strBasisTenor - ), - valParams, - null, - mktParams, - null, - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (5), - aFFC, - "DerivedParBasisSpread", - adblxM6MBasisSwapQuote, - dblStartingFwd - ); - } - - private static final Map MakeFC ( - final JulianDate dt, - final String strCurrency, - final MergedDiscountForwardCurve dc) - throws Exception - { - Map mapFC = new HashMap(); - - /* - * Build and run the sampling for the 1M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc1M = MakeFC ( - dt, - strCurrency, - dc, - 1, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00551, // 1Y - 0.00387, // 2Y - 0.00298, // 3Y - 0.00247, // 4Y - 0.00211, // 5Y - 0.00185, // 6Y - 0.00165, // 7Y - 0.00150, // 8Y - 0.00137, // 9Y - 0.00127, // 10Y - 0.00119, // 11Y - 0.00112, // 12Y - 0.00096, // 15Y - 0.00079, // 20Y - 0.00069, // 25Y - 0.00062 // 30Y - } - ); - - mapFC.put ( - "1M", - fc1M - ); - - /* - * Build and run the sampling for the 3M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc3M = MakeFC ( - dt, - strCurrency, - dc, - 3, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00186, // 1Y - 0.00127, // 2Y - 0.00097, // 3Y - 0.00080, // 4Y - 0.00067, // 5Y - 0.00058, // 6Y - 0.00051, // 7Y - 0.00046, // 8Y - 0.00042, // 9Y - 0.00038, // 10Y - 0.00035, // 11Y - 0.00033, // 12Y - 0.00028, // 15Y - 0.00022, // 20Y - 0.00020, // 25Y - 0.00018 // 30Y - } - ); - - mapFC.put ( - "3M", - fc3M - ); - - /* - * Build and run the sampling for the 12M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc12M = MakeFC ( - dt, - strCurrency, - dc, - 12, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", - "35Y", "40Y" // Extrapolated - }, - new double[] { - -0.00212, // 1Y - -0.00152, // 2Y - -0.00117, // 3Y - -0.00097, // 4Y - -0.00082, // 5Y - -0.00072, // 6Y - -0.00063, // 7Y - -0.00057, // 8Y - -0.00051, // 9Y - -0.00047, // 10Y - -0.00044, // 11Y - -0.00041, // 12Y - -0.00035, // 15Y - -0.00028, // 20Y - -0.00025, // 25Y - -0.00022, // 30Y - -0.00022, // 35Y Extrapolated - -0.00022, // 40Y Extrapolated - } - ); - - mapFC.put ( - "12M", - fc12M - ); - - return mapFC; - } - - private static final FixFloatComponent CreateIRS ( - final JulianDate dtEffective, - final String strMaturityTenor, - final ForwardLabel fri, - final double dblCoupon, - final String strCurrency) - throws Exception - { - JulianDate dtMaturity = dtEffective.addTenor (strMaturityTenor); - - int iTenorInMonths = Helper.TenorToMonths (fri.tenor()); - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - true, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - fri.tenor(), - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - fri, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - dblCoupon, - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 12 / iTenorInMonths, - fri.tenor(), - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - "6M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - strMaturityTenor, - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - fri.tenor(), - strMaturityTenor, - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent irs = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - irs.setPrimaryCode ("IRS." + dtMaturity.toString() + "." + strCurrency); - - return irs; - } - - private static final double RunWithVolCorrelation ( - final FixFloatComponent irs, - final ValuationParams valParams, - final CurveSurfaceQuoteContainer mktParams, - final ForwardLabel fri, - final double dblBaselineSwapRate, - final double dblForwardVol, - final double dblFundingVol, - final double dblForwardFundingCorr) - throws Exception - { - FundingLabel fundingLabel = FundingLabel.Standard (fri.currency()); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - valParams.valueDate(), - VolatilityLabel.Standard (fri), - fri.currency(), - dblForwardVol - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - valParams.valueDate(), - VolatilityLabel.Standard (fundingLabel), - fri.currency(), - dblFundingVol - ) - ); - - mktParams.setForwardFundingCorrelation ( - fri, - fundingLabel, - new FlatUnivariate (dblForwardFundingCorr) - ); - - Map mapIRSOutput = irs.value ( - valParams, - null, - mktParams, - null - ); - - double dblSwapRate = mapIRSOutput.get ("SwapRate"); - - System.out.println ("\t[" + - org.drip.quant.common.FormatUtil.FormatDouble (dblForwardVol, 2, 0, 100.) + "%," + - org.drip.quant.common.FormatUtil.FormatDouble (dblFundingVol, 2, 0, 100.) + "%," + - org.drip.quant.common.FormatUtil.FormatDouble (dblForwardFundingCorr, 2, 0, 100.) + "%] =" + - org.drip.quant.common.FormatUtil.FormatDouble (dblSwapRate, 1, 4, 100.) + "% | " + - org.drip.quant.common.FormatUtil.FormatDouble (dblSwapRate - dblBaselineSwapRate, 1, 0, 10000.)); - - return dblSwapRate; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strTenor = "3M"; - String strCurrency = "USD"; - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - /* - * Construct the Discount Curve using its instruments and quotes - */ - - MergedDiscountForwardCurve dc = MakeDC ( - dtToday, - strCurrency - ); - - Map mapFC = MakeFC ( - dtToday, - strCurrency, - dc - ); - - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - FixFloatComponent irs = CreateIRS ( - dtToday.addTenor (strTenor), - "5Y", - fri, - 0.05, - strCurrency - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - mapFC.get (strTenor), - null, - null, - null, - null, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - strCurrency - ); - - double[] adblSigmaFwd = new double[] {0.1, 0.2, 0.3, 0.4, 0.5}; - double[] adblSigmaFwd2DomX = new double[] {0.10, 0.15, 0.20, 0.25, 0.30}; - double[] adblCorrFwdFwd2DomX = new double[] {-0.99, -0.50, 0.00, 0.50, 0.99}; - - System.out.println ("\tPrinting the IRS Output in Order (Left -> Right):"); - - System.out.println ("\t\tParSwapRate (%)"); - - System.out.println ("\t\tDifference (bp)"); - - System.out.println ("\t-------------------------------------------------------------"); - - System.out.println ("\t-------------------------------------------------------------"); - - double dblBaselineSwapRate = RunWithVolCorrelation ( - irs, - valParams, - mktParams, - fri, - 0., - 0., - 0., - 0. - ); - - for (double dblSigmaFwd : adblSigmaFwd) { - for (double dblSigmaFwd2DomX : adblSigmaFwd2DomX) { - for (double dblCorrFwdFwd2DomX : adblCorrFwdFwd2DomX) - RunWithVolCorrelation ( - irs, - valParams, - mktParams, - fri, - dblBaselineSwapRate, - dblSigmaFwd, - dblSigmaFwd2DomX, - dblCorrFwdFwd2DomX - ); - } - } - } -} diff --git a/org/drip/sample/multicurve/FixFloatSwapIMM.java b/org/drip/sample/multicurve/FixFloatSwapIMM.java deleted file mode 100644 index 7e44711..0000000 --- a/org/drip/sample/multicurve/FixFloatSwapIMM.java +++ /dev/null @@ -1,754 +0,0 @@ - -package org.drip.sample.multicurve; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.*; -import org.drip.product.rates.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FixFloatSwapIMM contains a full valuation run on the IMM Fix-Float Swap Product. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixFloatSwapIMM { - - private static final FixFloatComponent OTCFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final FloatFloatComponent OTCFloatFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strDerivedTenor, - final String strMaturityTenor, - final double dblBasis) - { - FloatFloatSwapConvention ffConv = IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - return ffConv.createFloatFloatComponent ( - dtSpot, - strDerivedTenor, - strMaturityTenor, - dblBasis, - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFutures, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFutures]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFutures, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFutures; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate", - "ForwardRate" - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate", // 30Y - "SwapRate", // 40Y - "SwapRate" // 50Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - "USD" - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - } - - /* - * Construct an array of float-float swaps from the corresponding reference (6M) and the derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FloatFloatComponent[] MakexM6MBasisSwap ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final int iTenorInMonths) - throws Exception - { - FloatFloatComponent[] aFFC = new FloatFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aFFC[i] = OTCFloatFloat ( - dtSpot, - strCurrency, - iTenorInMonths + "M", - astrMaturityTenor[i], - 0. - ); - - return aFFC; - } - - private static final ForwardCurve MakeFC ( - final JulianDate dtSpot, - final String strCurrency, - final MergedDiscountForwardCurve dc, - final int iTenorInMonths, - final String[] astrxM6MFwdTenor, - final double[] adblxM6MBasisSwapQuote) - throws Exception - { - /* - * Construct the 6M-xM float-float basis swap. - */ - - FloatFloatComponent[] aFFC = MakexM6MBasisSwap ( - dtSpot, - strCurrency, - astrxM6MFwdTenor, - iTenorInMonths - ); - - String strBasisTenor = iTenorInMonths + "M"; - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Calculate the starting forward rate off of the discount curve. - */ - - double dblStartingFwd = dc.forward ( - dtSpot.julian(), - dtSpot.addTenor (strBasisTenor).julian() - ); - - /* - * Set the discount curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - /* - * Construct the shape preserving forward curve off of Quartic Polynomial Basis Spline. - */ - - return ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - "QUARTIC_FWD" + strBasisTenor, - ForwardLabel.Create ( - strCurrency, - strBasisTenor - ), - valParams, - null, - mktParams, - null, - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (5), - aFFC, - "DerivedParBasisSpread", - adblxM6MBasisSwapQuote, - dblStartingFwd - ); - } - - private static final Map MakeFC ( - final JulianDate dt, - final String strCurrency, - final MergedDiscountForwardCurve dc) - throws Exception - { - Map mapFC = new HashMap(); - - /* - * Build and run the sampling for the 1M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc1M = MakeFC ( - dt, - strCurrency, - dc, - 1, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00551, // 1Y - 0.00387, // 2Y - 0.00298, // 3Y - 0.00247, // 4Y - 0.00211, // 5Y - 0.00185, // 6Y - 0.00165, // 7Y - 0.00150, // 8Y - 0.00137, // 9Y - 0.00127, // 10Y - 0.00119, // 11Y - 0.00112, // 12Y - 0.00096, // 15Y - 0.00079, // 20Y - 0.00069, // 25Y - 0.00062 // 30Y - } - ); - - mapFC.put ("1M", fc1M); - - /* - * Build and run the sampling for the 3M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc3M = MakeFC ( - dt, - strCurrency, - dc, - 3, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00186, // 1Y - 0.00127, // 2Y - 0.00097, // 3Y - 0.00080, // 4Y - 0.00067, // 5Y - 0.00058, // 6Y - 0.00051, // 7Y - 0.00046, // 8Y - 0.00042, // 9Y - 0.00038, // 10Y - 0.00035, // 11Y - 0.00033, // 12Y - 0.00028, // 15Y - 0.00022, // 20Y - 0.00020, // 25Y - 0.00018 // 30Y - } - ); - - mapFC.put ( - "3M", - fc3M - ); - - /* - * Build and run the sampling for the 12M-6M Tenor Basis Swap from its instruments and quotes. - */ - - ForwardCurve fc12M = MakeFC ( - dt, - strCurrency, - dc, - 12, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", - "35Y", "40Y" // Extrapolated - }, - new double[] { - -0.00212, // 1Y - -0.00152, // 2Y - -0.00117, // 3Y - -0.00097, // 4Y - -0.00082, // 5Y - -0.00072, // 6Y - -0.00063, // 7Y - -0.00057, // 8Y - -0.00051, // 9Y - -0.00047, // 10Y - -0.00044, // 11Y - -0.00041, // 12Y - -0.00035, // 15Y - -0.00028, // 20Y - -0.00025, // 25Y - -0.00022, // 30Y - -0.00022, // 35Y Extrapolated - -0.00022, // 40Y Extrapolated - } - ); - - mapFC.put ( - "12M", - fc12M - ); - - return mapFC; - } - - private static final FixFloatComponent CreateSTIR ( - final JulianDate dtEffective, - final String strMaturityTenor, - final ForwardLabel fri, - final double dblCoupon, - final String strCurrency) - throws Exception - { - JulianDate dtMaturity = dtEffective.addTenor (strMaturityTenor); - - int iTenorInMonths = Helper.TenorToMonths (fri.tenor()); - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - true, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - fri.tenor(), - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, - fri, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - dblCoupon, - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 12 / iTenorInMonths, - fri.tenor(), - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - "6M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - strMaturityTenor, - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - fri.tenor(), - strMaturityTenor, - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent irs = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - irs.setPrimaryCode ("IRS." + dtMaturity.toString() + "." + strCurrency); - - return irs; - } - - private static final void RunWithVolCorrelation ( - final FixFloatComponent stir, - final ValuationParams valParams, - final CurveSurfaceQuoteContainer mktParams, - final ForwardLabel fri, - final double dblForwardVol, - final double dblFundingVol, - final double dblForwardFundingCorr) - throws Exception - { - FundingLabel fundingLabel = FundingLabel.Standard (fri.currency()); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - valParams.valueDate(), - VolatilityLabel.Standard (fri), - fri.currency(), - dblForwardVol - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - valParams.valueDate(), - VolatilityLabel.Standard (fundingLabel), - fri.currency(), - dblFundingVol - ) - ); - - mktParams.setForwardFundingCorrelation ( - fri, - fundingLabel, - new FlatUnivariate (dblForwardFundingCorr) - ); - - Map mapSTIROutput = stir.value ( - valParams, - null, - mktParams, - null - ); - - for (Map.Entry me : mapSTIROutput.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strTenor = "3M"; - String strCurrency = "USD"; - double dblForwardVolatility = 0.3; - double dblFundingVolatility = 0.1; - double dblForwardFundingCorr = 0.2; - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - /* - * Construct the Discount Curve using its instruments and quotes - */ - - MergedDiscountForwardCurve dc = MakeDC ( - dtToday, - strCurrency - ); - - Map mapFC = MakeFC ( - dtToday, - strCurrency, - dc - ); - - ForwardLabel fri = ForwardLabel.Create ( - strCurrency, - strTenor - ); - - FixFloatComponent stir = CreateSTIR ( - dtToday.addTenor (strTenor), - "5Y", - fri, - 0.05, - strCurrency - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - mapFC.get (strTenor), - null, - null, - null, - null, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - strCurrency - ); - - RunWithVolCorrelation ( - stir, - valParams, - mktParams, - fri, - dblForwardVolatility, - dblFundingVolatility, - dblForwardFundingCorr - ); - } -} diff --git a/org/drip/sample/multicurve/FloatFloatForwardCurve.java b/org/drip/sample/multicurve/FloatFloatForwardCurve.java deleted file mode 100644 index 60ea1ab..0000000 --- a/org/drip/sample/multicurve/FloatFloatForwardCurve.java +++ /dev/null @@ -1,771 +0,0 @@ - -package org.drip.sample.multicurve; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.*; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * FloatFloatForwardCurve contains the sample demonstrating the full functionality behind creating highly - * customized spline based forward curves. - * - * The first sample illustrates the creation and usage of the xM-6M Tenor Basis Swap: - * - Construct the 6M-xM float-float basis swap. - * - Calculate the corresponding starting forward rate off of the discount curve. - * - Construct the shape preserving forward curve off of Cubic Polynomial Basis Spline. - * - Construct the shape preserving forward curve off of Quartic Polynomial Basis Spline. - * - Construct the shape preserving forward curve off of Hyperbolic Tension Based Basis Spline. - * - Set the discount curve based component market parameters. - * - Set the discount curve + cubic polynomial forward curve based component market parameters. - * - Set the discount curve + quartic polynomial forward curve based component market parameters. - * - Set the discount curve + hyperbolic tension forward curve based component market parameters. - * - Compute the following forward curve metrics for each of cubic polynomial forward, quartic - * polynomial forward, and KLK Hyperbolic tension forward curves: - * - Reference Basis Par Spread - * - Derived Basis Par Spread - * - Compare these with a) the forward rate off of the discount curve, b) The LIBOR rate, and c) The - * Input Basis Swap Quote. - * - * The second sample illustrates how to build and test the forward curves across various tenor basis. It - * shows the following steps: - * - Construct the Discount Curve using its instruments and quotes. - * - Build and run the sampling for the 1M-6M Tenor Basis Swap from its instruments and quotes. - * - Build and run the sampling for the 3M-6M Tenor Basis Swap from its instruments and quotes. - * - Build and run the sampling for the 6M-6M Tenor Basis Swap from its instruments and quotes. - * - Build and run the sampling for the 12M-6M Tenor Basis Swap from its instruments and quotes. - * - * @author Lakshmi Krishnamurthy - */ - -public class FloatFloatForwardCurve { - - private static final FixFloatComponent OTCFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final FloatFloatComponent OTCFloatFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strDerivedTenor, - final String strMaturityTenor, - final double dblBasis) - { - FloatFloatSwapConvention ffConv = IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - return ffConv.createFloatFloatComponent ( - dtSpot, - strDerivedTenor, - strMaturityTenor, - dblBasis, - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFutures, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFutures]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFutures, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFutures; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency, - final double dblBump) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] {}, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] {}; // Futures - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - // 0.00092 + dblBump, // 6M - 0.0009875 + dblBump, // 9M - 0.00122 + dblBump, // 1Y - 0.00223 + dblBump, // 18M - 0.00383 + dblBump, // 2Y - 0.00827 + dblBump, // 3Y - 0.01245 + dblBump, // 4Y - 0.01605 + dblBump, // 5Y - 0.02597 + dblBump // 10Y - }; - - String[] astrSwapManifestMeasure = new String[] { - // "SwapRate", // 6M - "SwapRate", // 9M - "SwapRate", // 1Y - "SwapRate", // 18M - "SwapRate", // 2Y - "SwapRate", // 3Y - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate" // 10Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - // new java.lang.String[] {"6M", "9M", "1Y", "18M", "2Y", "3Y", "4Y", "5Y", "10Y"}, - new java.lang.String[] { - "9M", "1Y", "18M", "2Y", "3Y", "4Y", "5Y", "10Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - "USD" - ), - aDepositComp, - adblDepositQuote, - null, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - } - - /* - * Construct an array of float-float swaps from the corresponding reference (6M) and the derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FloatFloatComponent[] MakexM6MBasisSwap ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final int iTenorInMonths) - throws Exception - { - FloatFloatComponent[] aFFC = new FloatFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aFFC[i] = OTCFloatFloat ( - dtSpot, - strCurrency, - iTenorInMonths + "M", - astrMaturityTenor[i], - 0. - ); - - return aFFC; - } - - /* - * This sample illustrates the creation and usage of the xM-6M Tenor Basis Swap. It shows the following: - * - Construct the 6M-xM float-float basis swap. - * - Calculate the corresponding starting forward rate off of the discount curve. - * - Construct the shape preserving forward curve off of Cubic Polynomial Basis Spline. - * - Construct the shape preserving forward curve off of Quartic Polynomial Basis Spline. - * - Construct the shape preserving forward curve off of Hyperbolic Tension Based Basis Spline. - * - Set the discount curve based component market parameters. - * - Set the discount curve + cubic polynomial forward curve based component market parameters. - * - Set the discount curve + quartic polynomial forward curve based component market parameters. - * - Set the discount curve + hyperbolic tension forward curve based component market parameters. - * - Compute the following forward curve metrics for each of cubic polynomial forward, quartic - * polynomial forward, and KLK Hyperbolic tension forward curves: - * - Reference Basis Par Spread - * - Derived Basis Par Spread - * - Compare these with a) the forward rate off of the discount curve, b) The LIBOR rate, and c) The - * Input Basis Swap Quote. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final Map xM6MBasisSample ( - final JulianDate dtSpot, - final String strCurrency, - final MergedDiscountForwardCurve dc, - final int iTenorInMonths, - final String[] astrxM6MFwdTenor, - final String strManifestMeasure, - final double[] adblxM6MBasisSwapQuote) - throws Exception - { - System.out.println ("-----------------------------------------------------------------------------------------------------------------------------"); - - System.out.println (" SPL => n=3 | n=4 | KLK | | |"); - - System.out.println ("--------------------------------------------------------------------------------------------------------| LOG DF | LIBOR |"); - - System.out.println (" MSR => RECALC | REFEREN | DERIVED | RECALC | REFEREN | DERIVED | RECALC | REFEREN | DERIVED | | |"); - - System.out.println ("-----------------------------------------------------------------------------------------------------------------------------"); - - /* - * Construct the 6M-xM float-float basis swap. - */ - - FloatFloatComponent[] aFFC = MakexM6MBasisSwap ( - dtSpot, - strCurrency, - astrxM6MFwdTenor, - iTenorInMonths - ); - - String strBasisTenor = iTenorInMonths + "M"; - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Calculate the starting forward rate off of the discount curve. - */ - - double dblStartingFwd = dc.forward ( - dtSpot.julian(), - dtSpot.addTenor (strBasisTenor).julian() - ); - - /* - * Set the discount curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - Map mapForward = new HashMap(); - - /* - * Construct the shape preserving forward curve off of Cubic Polynomial Basis Spline. - */ - - ForwardCurve fcxMCubic = ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - "CUBIC_FWD" + strBasisTenor, - ForwardLabel.Create ( - strCurrency, - strBasisTenor - ), - valParams, - null, - mktParams, - null, - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - aFFC, - strManifestMeasure, - adblxM6MBasisSwapQuote, - dblStartingFwd - ); - - mapForward.put ( - " CUBIC_FWD" + strBasisTenor, - fcxMCubic - ); - - /* - * Set the discount curve + cubic polynomial forward curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParamsCubicFwd = MarketParamsBuilder.Create ( - dc, - fcxMCubic, - null, - null, - null, - null, - null, - null - ); - - /* - * Construct the shape preserving forward curve off of Quartic Polynomial Basis Spline. - */ - - ForwardCurve fcxMQuartic = ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - "QUARTIC_FWD" + strBasisTenor, - ForwardLabel.Create ( - strCurrency, - strBasisTenor - ), - valParams, - null, - mktParams, - null, - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (5), - aFFC, - strManifestMeasure, - adblxM6MBasisSwapQuote, - dblStartingFwd - ); - - mapForward.put ( - " QUARTIC_FWD" + strBasisTenor, - fcxMQuartic - ); - - /* - * Set the discount curve + quartic polynomial forward curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParamsQuarticFwd = MarketParamsBuilder.Create ( - dc, - fcxMQuartic, - null, - null, - null, - null, - null, - null - ); - - /* - * Construct the shape preserving forward curve off of Hyperbolic Tension Based Basis Spline. - */ - - ForwardCurve fcxMKLKHyper = ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - "KLKHYPER_FWD" + strBasisTenor, - ForwardLabel.Create ( - strCurrency, - strBasisTenor - ), - valParams, - null, - mktParams, - null, - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new ExponentialTensionSetParams (1.), - aFFC, - strManifestMeasure, - adblxM6MBasisSwapQuote, - dblStartingFwd - ); - - mapForward.put ( - "KLKHYPER_FWD" + strBasisTenor, - fcxMKLKHyper - ); - - /* - * Set the discount curve + hyperbolic tension forward curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParamsKLKHyperFwd = MarketParamsBuilder.Create ( - dc, - fcxMKLKHyper, - null, - null, - null, - null, - null, - null - ); - - int i = 0; - int iFreq = 12 / iTenorInMonths; - - /* - * Compute the following forward curve metrics for each of cubic polynomial forward, quartic - * polynomial forward, and KLK Hyperbolic tension forward curves: - * - Reference Basis Par Spread - * - Derived Basis Par Spread - * - * Further compare these with a) the forward rate off of the discount curve, b) the LIBOR rate, and - * c) Input Basis Swap Quote. - */ - - for (String strMaturityTenor : astrxM6MFwdTenor) { - int iFwdEndDate = dtSpot.addTenor (strMaturityTenor).julian(); - - int iFwdStartDate = dtSpot.addTenor (strMaturityTenor).subtractTenor (strBasisTenor).julian(); - - FloatFloatComponent ffc = aFFC[i++]; - - CaseInsensitiveTreeMap mapCubicValue = ffc.value ( - valParams, - null, - mktParamsCubicFwd, - null - ); - - CaseInsensitiveTreeMap mapQuarticValue = ffc.value ( - valParams, - null, - mktParamsQuarticFwd, - null - ); - - CaseInsensitiveTreeMap mapKLKHyperValue = ffc.value ( - valParams, - null, - mktParamsKLKHyperFwd, - null - ); - - System.out.println (" " + strMaturityTenor + " => " + - FormatUtil.FormatDouble (fcxMCubic.forward (iFwdEndDate), 2, 2, 100.) + " | " + - FormatUtil.FormatDouble (mapCubicValue.get ("ReferenceParBasisSpread"), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (mapCubicValue.get ("DerivedParBasisSpread"), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (fcxMQuartic.forward (iFwdEndDate), 2, 2, 100.) + " | " + - FormatUtil.FormatDouble (mapQuarticValue.get ("ReferenceParBasisSpread"), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (mapQuarticValue.get ("DerivedParBasisSpread"), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (fcxMKLKHyper.forward (iFwdEndDate), 2, 2, 100.) + " | " + - FormatUtil.FormatDouble (mapKLKHyperValue.get ("ReferenceParBasisSpread"), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (mapKLKHyperValue.get ("DerivedParBasisSpread"), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (iFreq * java.lang.Math.log (dc.df (iFwdStartDate) / dc.df (iFwdEndDate)), 1, 2, 100.) + " | " + - FormatUtil.FormatDouble (dc.libor (iFwdStartDate, iFwdEndDate), 1, 2, 100.) + " | " - ); - } - - return mapForward; - } - - /* - * This sample illustrates how to build and test the forward curves across various tenor basis. It shows - * the following steps: - * - Construct the Discount Curve using its instruments and quotes. - * - Build and run the sampling for the 1M-6M Tenor Basis Swap from its instruments and quotes. - * - Build and run the sampling for the 3M-6M Tenor Basis Swap from its instruments and quotes. - * - Build and run the sampling for the 12M-6M Tenor Basis Swap from its instruments and quotes. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void CustomForwardCurveBuilderSample ( - final String strManifestMeasure) - throws Exception - { - String strCurrency = "USD"; - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - /* - * Construct the Discount Curve using its instruments and quotes - */ - - MergedDiscountForwardCurve dc = MakeDC ( - dtToday, - strCurrency, - 0. - ); - - System.out.println ("\n-----------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("--------------------------------------------------- 1M-6M Basis Swap --------------------------------------------------"); - - /* - * Build and run the sampling for the 1M-6M Tenor Basis Swap from its instruments and quotes. - */ - - xM6MBasisSample ( - dtToday, - strCurrency, - dc, - 1, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - strManifestMeasure, - new double[] { - 0.00551, // 1Y - 0.00387, // 2Y - 0.00298, // 3Y - 0.00247, // 4Y - 0.00211, // 5Y - 0.00185, // 6Y - 0.00165, // 7Y - 0.00150, // 8Y - 0.00137, // 9Y - 0.00127, // 10Y - 0.00119, // 11Y - 0.00112, // 12Y - 0.00096, // 15Y - 0.00079, // 20Y - 0.00069, // 25Y - 0.00062 // 30Y - } - ); - - /* - * Build and run the sampling for the 3M-6M Tenor Basis Swap from its instruments and quotes. - */ - - System.out.println ("\n-----------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("--------------------------------------------------- 3M-6M Basis Swap --------------------------------------------------"); - - xM6MBasisSample ( - dtToday, - strCurrency, - dc, - 3, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - strManifestMeasure, - new double[] { - 0.00186, // 1Y - 0.00127, // 2Y - 0.00097, // 3Y - 0.00080, // 4Y - 0.00067, // 5Y - 0.00058, // 6Y - 0.00051, // 7Y - 0.00046, // 8Y - 0.00042, // 9Y - 0.00038, // 10Y - 0.00035, // 11Y - 0.00033, // 12Y - 0.00028, // 15Y - 0.00022, // 20Y - 0.00020, // 25Y - 0.00018 // 30Y - } - ); - - /* - * Build and run the sampling for the 12M-6M Tenor Basis Swap from its instruments and quotes. - */ - - System.out.println ("\n-----------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("--------------------------------------------------- 12M-6M Basis Swap --------------------------------------------------"); - - xM6MBasisSample ( - dtToday, - strCurrency, - dc, - 12, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", - "35Y", "40Y" // Extrapolated - }, - strManifestMeasure, - new double[] { - -0.00212, // 1Y - -0.00152, // 2Y - -0.00117, // 3Y - -0.00097, // 4Y - -0.00082, // 5Y - -0.00072, // 6Y - -0.00063, // 7Y - -0.00057, // 8Y - -0.00051, // 9Y - -0.00047, // 10Y - -0.00044, // 11Y - -0.00041, // 12Y - -0.00035, // 15Y - -0.00028, // 20Y - -0.00025, // 25Y - -0.00022, // 30Y - -0.00022, // 35Y Extrapolated - -0.00022, // 40Y Extrapolated - } - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - System.out.println ("\n-----------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("-----------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("----------------------------------------------- BASIS ON THE DERIVED LEG -----------------------------------------------"); - - System.out.println ("-----------------------------------------------------------------------------------------------------------------------------"); - - CustomForwardCurveBuilderSample ("DerivedParBasisSpread"); - - System.out.println ("\n-----------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("-----------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("---------------------------------------------- BASIS ON THE REFERENCE LEG ----------------------------------------------"); - - System.out.println ("-----------------------------------------------------------------------------------------------------------------------------"); - - CustomForwardCurveBuilderSample ("ReferenceParBasisSpread"); - } -} diff --git a/org/drip/sample/multicurve/FundingNativeForwardReconciler.java b/org/drip/sample/multicurve/FundingNativeForwardReconciler.java deleted file mode 100644 index c995ab7..0000000 --- a/org/drip/sample/multicurve/FundingNativeForwardReconciler.java +++ /dev/null @@ -1,314 +0,0 @@ - -package org.drip.sample.multicurve; - -import org.drip.analytics.date.*; -import org.drip.market.otc.*; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FundingNativeForwardReconciler demonstrates the Construction of the Forward Curve Native to the Discount - * Curve across different Tenors, and display their Reconciliation. - * - * @author Lakshmi Krishnamurthy - */ - -public class FundingNativeForwardReconciler { - - private static final FixFloatComponent OTCFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFuture, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFuture]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFuture, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFuture; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aIRS; - } - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 30, - 60, - 91, - 182, - 273 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.0668750, // 30D - 0.0675000, // 60D - 0.0678125, // 91D - 0.0712500, // 182D - 0.0750000 // 273D - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", // 30D - "ForwardRate", // 60D - "ForwardRate", // 91D - "ForwardRate", // 182D - "ForwardRate" // 273D - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.08265, // 2Y - 0.08550, // 3Y - 0.08655, // 4Y - 0.08770, // 5Y - 0.08910, // 7Y - 0.08920 // 10Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 2Y - "SwapRate", // 3Y - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 7Y - "SwapRate" // 10Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - } - - private static final void DiscountForwardReconciliation ( - final JulianDate dtSpot, - final MergedDiscountForwardCurve dc, - final ForwardCurve fc, - final String strTenor) - throws Exception - { - int iNumTenor = 20; - JulianDate dtStart = dtSpot; - - System.out.println ("\n\t|--------------------------------------------------||"); - - System.out.println ("\t|-------- RECONCILIATION FOR " + fc.label().fullyQualifiedName() + " ---------||"); - - System.out.println ("\t|--------------------------------------------------||"); - - System.out.println ("\t| ||"); - - for (int i = 0; i < iNumTenor; ++i) { - JulianDate dtEnd = dtStart.addTenor (strTenor); - - System.out.println ( - "\t| [" + dtStart + " - " + dtEnd + "] | " + - FormatUtil.FormatDouble (dc.libor (dtStart, strTenor), 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (fc.forward (dtEnd), 1, 2, 100.) + "% ||" - ); - - dtStart = dtEnd; - } - - System.out.println ("\t| ||"); - - System.out.println ("\t|--------------------------------------------------||"); - - System.out.println ("\t|--------------------------------------------------||\n"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 1995, - DateUtil.FEBRUARY, - 3 - ); - - String strCurrency = "GBP"; - String[] astrFRATenor = { - "1M", "3M", "6M", "12M" - }; - - MergedDiscountForwardCurve dc = MakeDC ( - dtSpot, - strCurrency - ); - - for (String strFRATenor : astrFRATenor) { - ForwardCurve fcNative = dc.nativeForwardCurve (strFRATenor); - - DiscountForwardReconciliation ( - dtSpot, - dc, - fcNative, - strFRATenor - ); - } - } -} diff --git a/org/drip/sample/multicurve/OTCSwapOptionSettlements.java b/org/drip/sample/multicurve/OTCSwapOptionSettlements.java deleted file mode 100644 index e616423..0000000 --- a/org/drip/sample/multicurve/OTCSwapOptionSettlements.java +++ /dev/null @@ -1,106 +0,0 @@ - -package org.drip.sample.multicurve; - -import org.drip.market.otc.SwapOptionSettlementContainer; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * OTCSwapOptionSettlements contains all the pre-fixed Definitions of the OTC Swap Option Settlements. - * - * @author Lakshmi Krishnamurthy - */ - -public class OTCSwapOptionSettlements { - private static final void DisplayOTCSwapOptionSettlement ( - final String strCurrency) - { - System.out.println ("\t\t" + strCurrency + " => " + - SwapOptionSettlementContainer.ConventionFromJurisdiction (strCurrency) - ); - } - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - System.out.println ("\n\t--------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t\tL -> R:"); - - System.out.println ("\t\t\tReference Currency"); - - System.out.println ("\t\t\tSettlement Type"); - - System.out.println ("\t\t\tSettlement Quote Valuation (for Cash Settled Options)"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------"); - - DisplayOTCSwapOptionSettlement ("AUD"); - - DisplayOTCSwapOptionSettlement ("CHF"); - - DisplayOTCSwapOptionSettlement ("DKK"); - - DisplayOTCSwapOptionSettlement ("EUR"); - - DisplayOTCSwapOptionSettlement ("GBP"); - - DisplayOTCSwapOptionSettlement ("JPY"); - - DisplayOTCSwapOptionSettlement ("NOK"); - - DisplayOTCSwapOptionSettlement ("SEK"); - - DisplayOTCSwapOptionSettlement ("USD"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------"); - } -} diff --git a/org/drip/sample/netting/PortfolioGroupRun.java b/org/drip/sample/netting/PortfolioGroupRun.java deleted file mode 100644 index 5bce3f1..0000000 --- a/org/drip/sample/netting/PortfolioGroupRun.java +++ /dev/null @@ -1,384 +0,0 @@ - -package org.drip.sample.netting; - -import org.drip.analytics.date.*; -import org.drip.measure.discretemarginal.SequenceGenerator; -import org.drip.measure.dynamics.DiffusionEvaluatorLogarithmic; -import org.drip.measure.process.DiffusionEvolver; -import org.drip.measure.realization.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.xva.trajectory.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * PortfolioGroupRun demonstrates the Simulation Run of the Netting Group Exposure. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class PortfolioGroupRun { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iNumStep = 10; - double dblTime = 5.; - double dblAssetDrift = 0.06; - double dblAssetVolatility = 0.15; - double dblInitialAssetValue = 1.; - double dblCollateralDrift = 0.01; - double dblBankHazardRate = 0.015; - double dblBankRecoveryRate = 0.40; - double dblCounterPartyHazardRate = 0.030; - double dblCounterPartyRecoveryRate = 0.30; - - double dblTimeWidth = dblTime / iNumStep; - double[] adblCollateral = new double[iNumStep]; - double[] adblBankSurvival = new double[iNumStep]; - double[] adblBankRecovery = new double[iNumStep]; - JulianDate[] adtVertex = new JulianDate[iNumStep]; - double[] adblBankFundingSpread = new double[iNumStep]; - double[] adblCounterPartySurvival = new double[iNumStep]; - double[] adblCounterPartyRecovery = new double[iNumStep]; - CollateralGroupEdge[] aCGE1 = new CollateralGroupEdge[iNumStep - 1]; - CollateralGroupEdge[] aCGE2 = new CollateralGroupEdge[iNumStep - 1]; - CollateralGroupVertex[] aCGV1 = new CollateralGroupVertex[iNumStep]; - CollateralGroupVertex[] aCGV2 = new CollateralGroupVertex[iNumStep]; - double dblBankFundingSpread = dblBankHazardRate / (1. - dblBankRecoveryRate); - CollateralGroupVertexExposure[] aCGVE1 = new CollateralGroupVertexExposure[iNumStep]; - CollateralGroupVertexExposure[] aCGVE2 = new CollateralGroupVertexExposure[iNumStep]; - CollateralGroupVertexNumeraire[] aCGVN = new CollateralGroupVertexNumeraire[iNumStep]; - - JulianDate dtSpot = DateUtil.Today(); - - DiffusionEvolver deAsset = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblAssetDrift, - dblAssetVolatility - ) - ); - - JumpDiffusionEdge[] aJDEAsset1 = deAsset.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblInitialAssetValue, - 0., - false - ), - UnitRandom.Diffusion (SequenceGenerator.Gaussian (iNumStep)), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDEAsset2 = deAsset.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblInitialAssetValue, - 0., - false - ), - UnitRandom.Diffusion (SequenceGenerator.Gaussian (iNumStep)), - dblTimeWidth - ); - - System.out.println(); - - System.out.println ("\t|--------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| PATH VERTEX EXPOSURES AND NUMERAIRE REALIZATIONS ||"); - - System.out.println ("\t|--------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| - Path #1 Gross Exposure ||"); - - System.out.println ("\t| - Path #1 Positive Exposure ||"); - - System.out.println ("\t| - Path #1 Negative Exposure ||"); - - System.out.println ("\t| - Path #2 Gross Exposure ||"); - - System.out.println ("\t| - Path #2 Positive Exposure ||"); - - System.out.println ("\t| - Path #2 Negative Exposure ||"); - - System.out.println ("\t| - Collateral Numeraire ||"); - - System.out.println ("\t| - Bank Survival Probability ||"); - - System.out.println ("\t| - Bank Recovery Rate ||"); - - System.out.println ("\t| - Bank Funding Spread ||"); - - System.out.println ("\t| - Counter Party Survival Probability ||"); - - System.out.println ("\t| - Counter Party Recovery Rate ||"); - - System.out.println ("\t|--------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < aJDEAsset1.length; ++i) { - adblBankRecovery[i] = dblBankRecoveryRate; - adblBankFundingSpread[i] = dblBankFundingSpread; - adblCounterPartyRecovery[i] = dblCounterPartyRecoveryRate; - - adtVertex[i] = dtSpot.addMonths (6 * i + 6); - - adblCollateral[i] = Math.exp (0.5 * dblCollateralDrift * (i + 1)); - - adblBankSurvival[i] = Math.exp (-0.5 * dblBankHazardRate * (i + 1)); - - aCGVE1[i] = new CollateralGroupVertexExposure ( - aJDEAsset1[i].finish(), - 0., - 0. - ); - - aCGVE2[i] = new CollateralGroupVertexExposure ( - aJDEAsset2[i].finish(), - 0., - 0. - ); - - adblCounterPartySurvival[i] = Math.exp (-0.5 * dblCounterPartyHazardRate * (i + 1)); - - aCGVN[i] = new CollateralGroupVertexNumeraire ( - adblCollateral[i], - adblBankSurvival[i], - adblBankRecovery[i], - adblBankFundingSpread[i], - adblCounterPartySurvival[i], - adblCounterPartyRecovery[i] - ); - - aCGV1[i] = new CollateralGroupVertex ( - adtVertex[i], - aCGVE1[i], - aCGVN[i] - ); - - aCGV2[i] = new CollateralGroupVertex ( - adtVertex[i], - aCGVE2[i], - aCGVN[i] - ); - - System.out.println ( - "\t| " + adtVertex[i] + " => " + - FormatUtil.FormatDouble (aCGVE1[i].net(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aCGVE1[i].positive(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aCGVE1[i].negative(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aCGVE2[i].net(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aCGVE2[i].positive(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aCGVE2[i].negative(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblCollateral[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblBankSurvival[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblBankRecovery[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblBankFundingSpread[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblCounterPartySurvival[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblCounterPartyRecovery[i], 1, 6, 1.) + " ||" - ); - } - - System.out.println ("\t|--------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| PERIOD CREDIT, DEBT, AND FUNDING VALUATION ADJUSTMENTS ||"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| - Forward Period ||"); - - System.out.println ("\t| - Path #1 Period Credit Adjustments ||"); - - System.out.println ("\t| - Path #1 Period Debt Adjustments ||"); - - System.out.println ("\t| - Path #1 Period Funding Adjustments ||"); - - System.out.println ("\t| - Path #2 Period Credit Adjustments ||"); - - System.out.println ("\t| - Path #2 Period Debt Adjustments ||"); - - System.out.println ("\t| - Path #2 Period Funding Adjustments ||"); - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------||"); - - for (int i = 1; i < aJDEAsset1.length; ++i) { - aCGE1[i - 1] = new CollateralGroupEdge ( - aCGV1[i - 1], - aCGV1[i] - ); - - aCGE2[i - 1] = new CollateralGroupEdge ( - aCGV2[i - 1], - aCGV2[i] - ); - - System.out.println ("\t| [" + - aCGE1[i - 1].head().vertex() + " -> " + aCGE1[i - 1].tail().vertex() + "] => " + - FormatUtil.FormatDouble (aCGE1[i - 1].credit(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aCGE1[i - 1].debt(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aCGE1[i - 1].funding(), 1, 6, 1.) + " || " + - FormatUtil.FormatDouble (aCGE2[i - 1].credit(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aCGE2[i - 1].debt(), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aCGE2[i - 1].funding(), 1, 6, 1.) + " ||" - ); - } - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - - NettingGroupPathAggregator ngpa = NettingGroupPathAggregator.Standard ( - new CollateralGroupPath[] { - new CollateralGroupPath (aCGE1), - new CollateralGroupPath (aCGE2) - } - ); - - JulianDate[] adtVertexNode = ngpa.vertexes(); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - String strDump = "\t| DATE =>" ; - - for (int i = 0; i < adtVertexNode.length; ++i) - strDump = strDump + " " + adtVertexNode[i] + " |"; - - System.out.println (strDump); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - double[] adblEE = ngpa.collateralizedExposure(); - - strDump = "\t| EXPOSURE => " + FormatUtil.FormatDouble (dblInitialAssetValue, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEPE = ngpa.collateralizedPositiveExposure(); - - strDump = "\t| POSITIVE EXPOSURE => " + FormatUtil.FormatDouble (dblInitialAssetValue, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEPE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEPE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblENE = ngpa.collateralizedNegativeExposure(); - - strDump = "\t| NEGATIVE EXPOSURE => " + FormatUtil.FormatDouble (0., 1, 4, 1.) + " |"; - - for (int j = 0; j < adblENE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblENE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEEPV = ngpa.collateralizedExposurePV(); - - strDump = "\t| EXPOSURE PV => " + FormatUtil.FormatDouble (dblInitialAssetValue, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEPEPV = ngpa.collateralizedPositiveExposurePV(); - - strDump = "\t| POSITIVE EXPOSURE PV => " + FormatUtil.FormatDouble (dblInitialAssetValue, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEPEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEPEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblENEPV = ngpa.collateralizedNegativeExposurePV(); - - strDump = "\t| NEGATIVE EXPOSURE PV => " + FormatUtil.FormatDouble (0., 1, 4, 1.) + " |"; - - for (int j = 0; j < adblENEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblENEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - System.out.println(); - - System.out.println ("\t||----------------||"); - - System.out.println ("\t|| CVA => " + FormatUtil.FormatDouble (ngpa.cva(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|| DVA => " + FormatUtil.FormatDouble (ngpa.dva(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|| FVA => " + FormatUtil.FormatDouble (ngpa.fca(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t||----------------||"); - } -} diff --git a/org/drip/sample/netting/PortfolioGroupSimulation.java b/org/drip/sample/netting/PortfolioGroupSimulation.java deleted file mode 100644 index 3933e71..0000000 --- a/org/drip/sample/netting/PortfolioGroupSimulation.java +++ /dev/null @@ -1,287 +0,0 @@ - -package org.drip.sample.netting; - -import org.drip.analytics.date.*; -import org.drip.measure.discretemarginal.SequenceGenerator; -import org.drip.measure.dynamics.DiffusionEvaluatorLogarithmic; -import org.drip.measure.process.DiffusionEvolver; -import org.drip.measure.realization.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.xva.trajectory.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * PortfolioGroupRun demonstrates a Set of Netting Group Exposure Simulations. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class PortfolioGroupSimulation { - - private static final JumpDiffusionEdge[][] PortfolioRealization ( - final DiffusionEvolver dePortfolio, - final double dblInitialAssetValue, - final double dblTime, - final double dblTimeWidth, - final int iNumStep, - final int iNumSimulation) - throws Exception - { - JumpDiffusionEdge[][] aaJDE = new JumpDiffusionEdge[iNumSimulation][]; - - for (int i = 0; i < iNumSimulation; ++i) - aaJDE[i] = dePortfolio.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblInitialAssetValue, - 0., - false - ), - UnitRandom.Diffusion (SequenceGenerator.Gaussian (iNumStep)), - dblTimeWidth - ); - - return aaJDE; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iNumStep = 10; - double dblTime = 5.; - int iNumSimulation = 10000; - double dblAssetDrift = 0.06; - double dblAssetVolatility = 0.15; - double dblInitialAssetValue = 1.; - double dblCollateralDrift = 0.01; - double dblBankHazardRate = 0.015; - double dblBankRecoveryRate = 0.40; - double dblCounterPartyHazardRate = 0.030; - double dblCounterPartyRecoveryRate = 0.30; - - double dblTimeWidth = dblTime / iNumStep; - double[] adblCollateral = new double[iNumStep]; - double[] adblBankSurvival = new double[iNumStep]; - double[] adblBankRecovery = new double[iNumStep]; - JulianDate[] adtVertex = new JulianDate[iNumStep]; - double[] adblBankFundingSpread = new double[iNumStep]; - double[] adblCounterPartySurvival = new double[iNumStep]; - double[] adblCounterPartyRecovery = new double[iNumStep]; - CollateralGroupPath[] aCGP = new CollateralGroupPath[iNumSimulation]; - double dblBankFundingSpread = dblBankHazardRate / (1. - dblBankRecoveryRate); - CollateralGroupVertex[][] aaCGV = new CollateralGroupVertex[iNumSimulation][iNumStep]; - - JulianDate dtSpot = DateUtil.Today(); - - DiffusionEvolver dePortfolio = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblAssetDrift, - dblAssetVolatility - ) - ); - - JumpDiffusionEdge[][] aaJDEPortfolio = PortfolioRealization ( - dePortfolio, - dblInitialAssetValue, - dblTime, - dblTimeWidth, - iNumStep, - iNumSimulation - ); - - for (int i = 0; i < iNumStep; ++i) { - adblBankRecovery[i] = dblBankRecoveryRate; - adblBankFundingSpread[i] = dblBankFundingSpread; - adblCounterPartyRecovery[i] = dblCounterPartyRecoveryRate; - - adtVertex[i] = dtSpot.addMonths (6 * i + 6); - - adblCollateral[i] = Math.exp (0.5 * dblCollateralDrift * (i + 1)); - - adblBankSurvival[i] = Math.exp (-0.5 * dblBankHazardRate * (i + 1)); - - adblCounterPartySurvival[i] = Math.exp (-0.5 * dblCounterPartyHazardRate * (i + 1)); - } - - for (int i = 0; i < iNumStep; ++i) { - for (int j = 0; j < iNumSimulation; ++j) - aaCGV[j][i] = new CollateralGroupVertex ( - adtVertex[i], - new CollateralGroupVertexExposure ( - aaJDEPortfolio[j][i].finish(), - 0., - 0. - ), - new CollateralGroupVertexNumeraire ( - adblCollateral[i], - adblBankSurvival[i], - adblBankRecovery[i], - adblBankFundingSpread[i], - adblCounterPartySurvival[i], - adblCounterPartyRecovery[i] - ) - ); - } - - for (int j = 0; j < iNumSimulation; ++j) { - CollateralGroupEdge[] aCGE = new CollateralGroupEdge[iNumStep - 1]; - - for (int i = 1; i < iNumStep; ++i) - aCGE[i - 1] = new CollateralGroupEdge ( - aaCGV[j][i - 1], - aaCGV[j][i] - ); - - aCGP[j] = new CollateralGroupPath (aCGE); - } - - NettingGroupPathAggregator ngpa = NettingGroupPathAggregator.Standard (aCGP); - - JulianDate[] adtVertexNode = ngpa.vertexes(); - - System.out.println(); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - String strDump = "\t| DATE =>" ; - - for (int i = 0; i < adtVertexNode.length; ++i) - strDump = strDump + " " + adtVertexNode[i] + " |"; - - System.out.println (strDump); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - double[] adblEE = ngpa.collateralizedExposure(); - - strDump = "\t| EXPOSURE => " + FormatUtil.FormatDouble (dblInitialAssetValue, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEPE = ngpa.collateralizedPositiveExposure(); - - strDump = "\t| POSITIVE EXPOSURE => " + FormatUtil.FormatDouble (dblInitialAssetValue, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEPE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEPE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblENE = ngpa.collateralizedNegativeExposure(); - - strDump = "\t| NEGATIVE EXPOSURE => " + FormatUtil.FormatDouble (0., 1, 4, 1.) + " |"; - - for (int j = 0; j < adblENE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblENE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEEPV = ngpa.collateralizedExposurePV(); - - strDump = "\t| EXPOSURE PV => " + FormatUtil.FormatDouble (dblInitialAssetValue, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEPEPV = ngpa.collateralizedPositiveExposurePV(); - - strDump = "\t| POSITIVE EXPOSURE PV => " + FormatUtil.FormatDouble (dblInitialAssetValue, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEPEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEPEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblENEPV = ngpa.collateralizedNegativeExposurePV(); - - strDump = "\t| NEGATIVE EXPOSURE PV => " + FormatUtil.FormatDouble (0., 1, 4, 1.) + " |"; - - for (int j = 0; j < adblENEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblENEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - System.out.println(); - - System.out.println ("\t||----------------||"); - - System.out.println ("\t|| CVA => " + FormatUtil.FormatDouble (ngpa.cva(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|| DVA => " + FormatUtil.FormatDouble (ngpa.dva(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|| FVA => " + FormatUtil.FormatDouble (ngpa.fca(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t||----------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/netting/PortfolioPathAggregationCorrelated.java b/org/drip/sample/netting/PortfolioPathAggregationCorrelated.java deleted file mode 100644 index 79acd59..0000000 --- a/org/drip/sample/netting/PortfolioPathAggregationCorrelated.java +++ /dev/null @@ -1,377 +0,0 @@ - -package org.drip.sample.netting; - -import org.drip.analytics.date.*; -import org.drip.measure.discretemarginal.SequenceGenerator; -import org.drip.measure.dynamics.*; -import org.drip.measure.process.DiffusionEvolver; -import org.drip.measure.realization.*; -import org.drip.quant.common.FormatUtil; -import org.drip.quant.linearalgebra.Matrix; -import org.drip.service.env.EnvManager; -import org.drip.xva.trajectory.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * PortfolioPathAggregationCorrelated generates the Aggregation of the Portfolio Paths evolved using - * Correlated Market Parameters. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class PortfolioPathAggregationCorrelated { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iNumStep = 10; - double dblTime = 5.; - int iNumSimulation = 10000; - double dblPortfolioDrift = 0.06; - double dblPortfolioVolatility = 0.15; - double dblPortfolioInitial = 1.; - double dblCSADrift = 0.01; - double dblCSAVolatility = 0.05; - double dblCSAInitial = 1.; - double dblBankHazardRateDrift = 0.002; - double dblBankHazardRateVolatility = 0.20; - double dblBankHazardRateInitial = 0.015; - double dblBankRecoveryRateDrift = 0.002; - double dblBankRecoveryRateVolatility = 0.02; - double dblBankRecoveryRateInitial = 0.40; - double dblCounterPartyHazardRateDrift = 0.002; - double dblCounterPartyHazardRateVolatility = 0.30; - double dblCounterPartyHazardRateInitial = 0.030; - double dblCounterPartyRecoveryRateDrift = 0.002; - double dblCounterPartyRecoveryRateVolatility = 0.02; - double dblCounterPartyRecoveryRateInitial = 0.30; - double dblBankFundingSpreadDrift = 0.00002; - double dblBankFundingSpreadVolatility = 0.002; - - double[][] aadblCorrelation = new double[][] { - {1.00, 0.03, 0.07, 0.04, 0.05, 0.08, 0.00}, // PORTFOLIO - {0.03, 1.00, 0.26, 0.33, 0.21, 0.35, 0.13}, // CSA - {0.07, 0.26, 1.00, 0.45, -0.17, 0.07, 0.77}, // BANK HAZARD - {0.04, 0.33, 0.45, 1.00, -0.22, -0.54, 0.58}, // COUNTER PARTY HAZARD - {0.05, 0.21, -0.17, -0.22, 1.00, 0.47, -0.23}, // BANK RECOVERY - {0.08, 0.35, 0.07, -0.54, 0.47, 1.00, 0.01}, // COUNTER PARTY RECOVERY - {0.00, 0.13, 0.77, 0.58, -0.23, 0.01, 1.00} // BANK FUNDING SPREAD - }; - - double dblTimeWidth = dblTime / iNumStep; - JulianDate[] adtVertex = new JulianDate[iNumStep]; - double[][] aadblPortfolioValue = new double[iNumSimulation][iNumStep]; - double[][] aadblCollateralBalance = new double[iNumSimulation][iNumStep]; - double dblBankFundingSpreadInitial = dblBankHazardRateInitial / (1. - dblBankRecoveryRateInitial); - CollateralGroupVertexNumeraire[][] aaCGVN = new CollateralGroupVertexNumeraire[iNumSimulation][iNumStep]; - - JulianDate dtSpot = DateUtil.Today(); - - for (int j = 0; j < iNumStep; ++j) - adtVertex[j] = dtSpot.addMonths (6 * j + 6); - - DiffusionEvolver dePortfolio = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblPortfolioDrift, - dblPortfolioVolatility - ) - ); - - DiffusionEvolver deCSA = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblCSADrift, - dblCSAVolatility - ) - ); - - DiffusionEvolver deBankHazardRate = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblBankHazardRateDrift, - dblBankHazardRateVolatility - ) - ); - - DiffusionEvolver deCounterPartyHazardRate = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblCounterPartyHazardRateDrift, - dblCounterPartyHazardRateVolatility - ) - ); - - DiffusionEvolver deBankRecoveryRate = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblBankRecoveryRateDrift, - dblBankRecoveryRateVolatility - ) - ); - - DiffusionEvolver deCounterPartyRecoveryRate = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblCounterPartyRecoveryRateDrift, - dblCounterPartyRecoveryRateVolatility - ) - ); - - DiffusionEvolver deBankFundingSpread = new DiffusionEvolver ( - DiffusionEvaluatorLinear.Standard ( - dblBankFundingSpreadDrift, - dblBankFundingSpreadVolatility - ) - ); - - for (int i = 0; i < iNumSimulation; ++i) { - double[][] aadblNumeraire = Matrix.Transpose ( - SequenceGenerator.GaussianJoint ( - iNumStep, - aadblCorrelation - ) - ); - - JumpDiffusionEdge[] aJDEPortfolio = dePortfolio.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblPortfolioInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[0]), - dblTimeWidth - ); - - for (int j = 0; j < aJDEPortfolio.length; ++j) - aadblPortfolioValue[i][j] = aJDEPortfolio[j].finish(); - - JumpDiffusionEdge[] aJDECSA = deCSA.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblCSAInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[1]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDEBankHazardRate = deBankHazardRate.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblBankHazardRateInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[2]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDECounterPartyHazardRate = deCounterPartyHazardRate.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblCounterPartyHazardRateInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[3]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDEBankRecoveryRate = deBankRecoveryRate.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblBankRecoveryRateInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[4]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDECounterPartyRecoveryRate = deCounterPartyRecoveryRate.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblCounterPartyRecoveryRateInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[5]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDEBankFundingSpread = deBankFundingSpread.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblBankFundingSpreadInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[6]), - dblTimeWidth - ); - - for (int j = 0; j < iNumStep; ++j) { - aaCGVN[i][j] = new CollateralGroupVertexNumeraire ( - aJDECSA[j].finish(), - Math.exp (-0.5 * aJDEBankHazardRate[j].finish() * (j + 1)), - aJDEBankRecoveryRate[j].finish(), - aJDEBankFundingSpread[j].finish(), - Math.exp (-0.5 * aJDECounterPartyHazardRate[j].finish() * (j + 1)), - aJDECounterPartyRecoveryRate[j].finish() - ); - - aadblCollateralBalance[i][j] = 0.; - } - } - - NettingGroupPathAggregator ngpa = NettingGroupPathAggregator.Standard ( - adtVertex, - aadblPortfolioValue, - aadblCollateralBalance, - aaCGVN - ); - - JulianDate[] adtVertexNode = ngpa.vertexes(); - - System.out.println(); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - String strDump = "\t| DATE =>" ; - - for (int i = 0; i < adtVertexNode.length; ++i) - strDump = strDump + " " + adtVertexNode[i] + " |"; - - System.out.println (strDump); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - double[] adblEE = ngpa.collateralizedExposure(); - - strDump = "\t| EXPOSURE => " + FormatUtil.FormatDouble (dblPortfolioInitial, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEPE = ngpa.collateralizedPositiveExposure(); - - strDump = "\t| POSITIVE EXPOSURE => " + FormatUtil.FormatDouble (dblPortfolioInitial, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEPE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEPE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblENE = ngpa.collateralizedNegativeExposure(); - - strDump = "\t| NEGATIVE EXPOSURE => " + FormatUtil.FormatDouble (0., 1, 4, 1.) + " |"; - - for (int j = 0; j < adblENE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblENE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEEPV = ngpa.collateralizedExposurePV(); - - strDump = "\t| EXPOSURE PV => " + FormatUtil.FormatDouble (dblPortfolioInitial, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEPEPV = ngpa.collateralizedPositiveExposurePV(); - - strDump = "\t| POSITIVE EXPOSURE PV => " + FormatUtil.FormatDouble (dblPortfolioInitial, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEPEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEPEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblENEPV = ngpa.collateralizedNegativeExposurePV(); - - strDump = "\t| NEGATIVE EXPOSURE PV => " + FormatUtil.FormatDouble (0., 1, 4, 1.) + " |"; - - for (int j = 0; j < adblENEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblENEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - System.out.println(); - - System.out.println ("\t||----------------||"); - - System.out.println ("\t|| CVA => " + FormatUtil.FormatDouble (ngpa.cva(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|| DVA => " + FormatUtil.FormatDouble (ngpa.dva(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|| FVA => " + FormatUtil.FormatDouble (ngpa.fca(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t||----------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/netting/PortfolioPathAggregationDeterministic.java b/org/drip/sample/netting/PortfolioPathAggregationDeterministic.java deleted file mode 100644 index d2cf446..0000000 --- a/org/drip/sample/netting/PortfolioPathAggregationDeterministic.java +++ /dev/null @@ -1,261 +0,0 @@ - -package org.drip.sample.netting; - -import org.drip.analytics.date.*; -import org.drip.measure.discretemarginal.SequenceGenerator; -import org.drip.measure.dynamics.DiffusionEvaluatorLogarithmic; -import org.drip.measure.process.DiffusionEvolver; -import org.drip.measure.realization.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.xva.trajectory.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * PortfolioPathAggregationDeterministic generates an Aggregation of the Portfolio Paths evolved using - * Deterministic Market Parameters. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class PortfolioPathAggregationDeterministic { - - private static final double[][] PortfolioRealization ( - final DiffusionEvolver dePortfolio, - final double dblInitialAssetValue, - final double dblTime, - final double dblTimeWidth, - final int iNumStep, - final int iNumSimulation) - throws Exception - { - double[][] aadblPortfolioValue = new double[iNumSimulation][]; - - for (int i = 0; i < iNumSimulation; ++i) { - JumpDiffusionEdge[] aJDE = dePortfolio.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblInitialAssetValue, - 0., - false - ), - UnitRandom.Diffusion (SequenceGenerator.Gaussian (iNumStep)), - dblTimeWidth - ); - - aadblPortfolioValue[i] = new double[aJDE.length]; - - for (int j = 0; j < aJDE.length; ++j) - aadblPortfolioValue[i][j] = aJDE[j].finish(); - } - - return aadblPortfolioValue; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iNumStep = 10; - double dblTime = 5.; - int iNumSimulation = 50000; - double dblAssetDrift = 0.06; - double dblAssetVolatility = 0.15; - double dblInitialAssetValue = 1.; - double dblCollateralDrift = 0.01; - double dblBankHazardRate = 0.015; - double dblBankRecoveryRate = 0.40; - double dblCounterPartyHazardRate = 0.030; - double dblCounterPartyRecoveryRate = 0.30; - - double dblTimeWidth = dblTime / iNumStep; - JulianDate[] adtVertex = new JulianDate[iNumStep]; - double[][] aadblCollateralBalance = new double[iNumSimulation][iNumStep]; - double dblBankFundingSpread = dblBankHazardRate / (1. - dblBankRecoveryRate); - CollateralGroupVertexNumeraire[] aCGVN = new CollateralGroupVertexNumeraire[iNumStep]; - - JulianDate dtSpot = DateUtil.Today(); - - double[][] aadblPortfolioValue = PortfolioRealization ( - new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblAssetDrift, - dblAssetVolatility - ) - ), - dblInitialAssetValue, - dblTime, - dblTimeWidth, - iNumStep, - iNumSimulation - ); - - for (int i = 0; i < iNumStep; ++i) { - adtVertex[i] = dtSpot.addMonths (6 * i + 6); - - aCGVN[i] = new CollateralGroupVertexNumeraire ( - Math.exp (0.5 * dblCollateralDrift * (i + 1)), - Math.exp (-0.5 * dblBankHazardRate * (i + 1)), - dblBankRecoveryRate, - dblBankFundingSpread, - Math.exp (-0.5 * dblCounterPartyHazardRate * (i + 1)), - dblCounterPartyRecoveryRate - ); - - for (int j = 0; j < iNumSimulation; ++j) - aadblCollateralBalance[j][i] = 0.; - } - - NettingGroupPathAggregator ngpa = NettingGroupPathAggregator.Standard ( - adtVertex, - aadblPortfolioValue, - aadblCollateralBalance, - aCGVN - ); - - JulianDate[] adtVertexNode = ngpa.vertexes(); - - System.out.println(); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - String strDump = "\t| DATE =>" ; - - for (int i = 0; i < adtVertexNode.length; ++i) - strDump = strDump + " " + adtVertexNode[i] + " |"; - - System.out.println (strDump); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - double[] adblEE = ngpa.collateralizedExposure(); - - strDump = "\t| EXPOSURE => " + FormatUtil.FormatDouble (dblInitialAssetValue, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEPE = ngpa.collateralizedPositiveExposure(); - - strDump = "\t| POSITIVE EXPOSURE => " + FormatUtil.FormatDouble (dblInitialAssetValue, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEPE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEPE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblENE = ngpa.collateralizedNegativeExposure(); - - strDump = "\t| NEGATIVE EXPOSURE => " + FormatUtil.FormatDouble (0., 1, 4, 1.) + " |"; - - for (int j = 0; j < adblENE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblENE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEEPV = ngpa.collateralizedExposurePV(); - - strDump = "\t| EXPOSURE PV => " + FormatUtil.FormatDouble (dblInitialAssetValue, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEPEPV = ngpa.collateralizedPositiveExposurePV(); - - strDump = "\t| POSITIVE EXPOSURE PV => " + FormatUtil.FormatDouble (dblInitialAssetValue, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEPEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEPEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblENEPV = ngpa.collateralizedNegativeExposurePV(); - - strDump = "\t| NEGATIVE EXPOSURE PV => " + FormatUtil.FormatDouble (0., 1, 4, 1.) + " |"; - - for (int j = 0; j < adblENEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblENEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - System.out.println(); - - System.out.println ("\t||----------------||"); - - System.out.println ("\t|| CVA => " + FormatUtil.FormatDouble (ngpa.cva(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|| DVA => " + FormatUtil.FormatDouble (ngpa.dva(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|| FVA => " + FormatUtil.FormatDouble (ngpa.fca(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t||----------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/netting/PortfolioPathAggregationUncorrelated.java b/org/drip/sample/netting/PortfolioPathAggregationUncorrelated.java deleted file mode 100644 index 2e359c9..0000000 --- a/org/drip/sample/netting/PortfolioPathAggregationUncorrelated.java +++ /dev/null @@ -1,371 +0,0 @@ - -package org.drip.sample.netting; - -import org.drip.analytics.date.*; -import org.drip.measure.discretemarginal.SequenceGenerator; -import org.drip.measure.dynamics.*; -import org.drip.measure.process.DiffusionEvolver; -import org.drip.measure.realization.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.xva.trajectory.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * PortfolioPathAggregationUncorrelated generates the Aggregation of the Portfolio Paths evolved using - * Uncorrelated Market Parameters. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class PortfolioPathAggregationUncorrelated { - - private static final JumpDiffusionEdge[] PathRealization ( - final DiffusionEvolver de, - final double dblInitialValue, - final double dblTime, - final double dblTimeWidth, - final int iNumStep) - throws Exception - { - return de.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblInitialValue, - 0., - false - ), - UnitRandom.Diffusion (SequenceGenerator.Gaussian (iNumStep)), - dblTimeWidth - ); - } - - private static final double[][] PortfolioRealization ( - final DiffusionEvolver dePortfolio, - final double dblInitialAssetValue, - final double dblTime, - final double dblTimeWidth, - final int iNumStep, - final int iNumSimulation) - throws Exception - { - double[][] aadblPortfolioValue = new double[iNumSimulation][]; - - for (int i = 0; i < iNumSimulation; ++i) { - JumpDiffusionEdge[] aJDE = dePortfolio.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblInitialAssetValue, - 0., - false - ), - UnitRandom.Diffusion (SequenceGenerator.Gaussian (iNumStep)), - dblTimeWidth - ); - - aadblPortfolioValue[i] = new double[aJDE.length]; - - for (int j = 0; j < aJDE.length; ++j) - aadblPortfolioValue[i][j] = aJDE[j].finish(); - } - - return aadblPortfolioValue; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iNumStep = 10; - double dblTime = 5.; - int iNumSimulation = 100000; - double dblAssetDrift = 0.06; - double dblAssetVolatility = 0.15; - double dblAssetInitial = 1.; - double dblCSADrift = 0.01; - double dblCSAVolatility = 0.05; - double dblCSAInitial = 1.; - double dblBankHazardRateDrift = 0.002; - double dblBankHazardRateVolatility = 0.20; - double dblBankHazardRateInitial = 0.015; - double dblBankRecoveryRateDrift = 0.002; - double dblBankRecoveryRateVolatility = 0.02; - double dblBankRecoveryRateInitial = 0.40; - double dblCounterPartyHazardRateDrift = 0.002; - double dblCounterPartyHazardRateVolatility = 0.30; - double dblCounterPartyHazardRateInitial = 0.030; - double dblCounterPartyRecoveryRateDrift = 0.002; - double dblCounterPartyRecoveryRateVolatility = 0.02; - double dblCounterPartyRecoveryRateInitial = 0.30; - double dblBankFundingSpreadDrift = 0.00002; - double dblBankFundingSpreadVolatility = 0.002; - - double dblTimeWidth = dblTime / iNumStep; - JulianDate[] adtVertex = new JulianDate[iNumStep]; - double[][] aadblCollateralBalance = new double[iNumSimulation][iNumStep]; - CollateralGroupVertexNumeraire[] aCGVN = new CollateralGroupVertexNumeraire[iNumStep]; - double dblBankFundingSpreadInitial = dblBankHazardRateInitial / (1. - dblBankRecoveryRateInitial); - - JulianDate dtSpot = DateUtil.Today(); - - double[][] aadblPortfolioValue = PortfolioRealization ( - new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblAssetDrift, - dblAssetVolatility - ) - ), - dblAssetInitial, - dblTime, - dblTimeWidth, - iNumStep, - iNumSimulation - ); - - JumpDiffusionEdge[] aJDECollateral = PathRealization ( - new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblCSADrift, - dblCSAVolatility - ) - ), - dblCSAInitial, - dblTime, - dblTimeWidth, - iNumStep - ); - - JumpDiffusionEdge[] aJDEBankHazardRate = PathRealization ( - new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblBankHazardRateDrift, - dblBankHazardRateVolatility - ) - ), - dblBankHazardRateInitial, - dblTime, - dblTimeWidth, - iNumStep - ); - - JumpDiffusionEdge[] aJDEBankRecoveryRate = PathRealization ( - new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblBankRecoveryRateDrift, - dblBankRecoveryRateVolatility - ) - ), - dblBankRecoveryRateInitial, - dblTime, - dblTimeWidth, - iNumStep - ); - - JumpDiffusionEdge[] aJDECounterPartyHazardRate = PathRealization ( - new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblCounterPartyHazardRateDrift, - dblCounterPartyHazardRateVolatility - ) - ), - dblCounterPartyHazardRateInitial, - dblTime, - dblTimeWidth, - iNumStep - ); - - JumpDiffusionEdge[] aJDECounterPartyRecoveryRate = PathRealization ( - new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblCounterPartyRecoveryRateDrift, - dblCounterPartyRecoveryRateVolatility - ) - ), - dblCounterPartyRecoveryRateInitial, - dblTime, - dblTimeWidth, - iNumStep - ); - - JumpDiffusionEdge[] aJDEBankFundingSpread = PathRealization ( - new DiffusionEvolver ( - DiffusionEvaluatorLinear.Standard ( - dblBankFundingSpreadDrift, - dblBankFundingSpreadVolatility - ) - ), - dblBankFundingSpreadInitial, - dblTime, - dblTimeWidth, - iNumStep - ); - - for (int i = 0; i < iNumStep; ++i) { - adtVertex[i] = dtSpot.addMonths (6 * i + 6); - - aCGVN[i] = new CollateralGroupVertexNumeraire ( - aJDECollateral[i].finish(), - Math.exp (-0.5 * aJDEBankHazardRate[i].finish() * (i + 1)), - aJDEBankRecoveryRate[i].finish(), - aJDEBankFundingSpread[i].finish(), - Math.exp (-0.5 * aJDECounterPartyHazardRate[i].finish() * (i + 1)), - aJDECounterPartyRecoveryRate[i].finish() - ); - - for (int j = 0; j < iNumSimulation; ++j) - aadblCollateralBalance[j][i] = 0.; - } - - NettingGroupPathAggregator ngpa = NettingGroupPathAggregator.Standard ( - adtVertex, - aadblPortfolioValue, - aadblCollateralBalance, - aCGVN - ); - - JulianDate[] adtVertexNode = ngpa.vertexes(); - - System.out.println(); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - String strDump = "\t| DATE =>" ; - - for (int i = 0; i < adtVertexNode.length; ++i) - strDump = strDump + " " + adtVertexNode[i] + " |"; - - System.out.println (strDump); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - double[] adblEE = ngpa.collateralizedExposure(); - - strDump = "\t| EXPOSURE => " + FormatUtil.FormatDouble (dblAssetInitial, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEPE = ngpa.collateralizedPositiveExposure(); - - strDump = "\t| POSITIVE EXPOSURE => " + FormatUtil.FormatDouble (dblAssetInitial, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEPE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEPE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblENE = ngpa.collateralizedNegativeExposure(); - - strDump = "\t| NEGATIVE EXPOSURE => " + FormatUtil.FormatDouble (0., 1, 4, 1.) + " |"; - - for (int j = 0; j < adblENE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblENE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEEPV = ngpa.collateralizedExposurePV(); - - strDump = "\t| EXPOSURE PV => " + FormatUtil.FormatDouble (dblAssetInitial, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEPEPV = ngpa.collateralizedPositiveExposurePV(); - - strDump = "\t| POSITIVE EXPOSURE PV => " + FormatUtil.FormatDouble (dblAssetInitial, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEPEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEPEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblENEPV = ngpa.collateralizedNegativeExposurePV(); - - strDump = "\t| NEGATIVE EXPOSURE PV => " + FormatUtil.FormatDouble (0., 1, 4, 1.) + " |"; - - for (int j = 0; j < adblENEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblENEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - System.out.println(); - - System.out.println ("\t||----------------||"); - - System.out.println ("\t|| CVA => " + FormatUtil.FormatDouble (ngpa.cva(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|| DVA => " + FormatUtil.FormatDouble (ngpa.dva(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|| FVA => " + FormatUtil.FormatDouble (ngpa.fca(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t||----------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/numeraire/R1JointDiffusion.java b/org/drip/sample/numeraire/R1JointDiffusion.java deleted file mode 100644 index e9d13be..0000000 --- a/org/drip/sample/numeraire/R1JointDiffusion.java +++ /dev/null @@ -1,259 +0,0 @@ - -package org.drip.sample.numeraire; - -import org.drip.measure.discretemarginal.SequenceGenerator; -import org.drip.measure.dynamics.DiffusionEvaluatorLogarithmic; -import org.drip.measure.process.DiffusionEvolver; -import org.drip.measure.realization.*; -import org.drip.quant.common.FormatUtil; -import org.drip.quant.linearalgebra.Matrix; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * R1JointDiffusion demonstrates the Joint Evolution of R^1 Diffusion Variates - the Continuous Asset, the - * Collateral, the Bank, and the Counter-Party Numeraires involved in the Dynamic XVA Replication Portfolio - * of the Burgard and Kjaer (2011) Methodology. 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class R1JointDiffusion { - - private static final double[][] NumeraireSequence ( - final int iCount, - final double[][] aadblCorrelation, - final String strHeader) - throws Exception - { - double[][] aadblGaussianJoint = SequenceGenerator.GaussianJoint ( - iCount, - aadblCorrelation - ); - - System.out.println(); - - System.out.println ("\t||----------------------------------------------------||"); - - System.out.println (strHeader); - - System.out.println ("\t||----------------------------------------------------||"); - - for (int i = 0; i < iCount; ++i) { - String strDump = "\t||" + FormatUtil.FormatDouble (i, 2, 0, 1.) + " |"; - - for (int j = 0; j < aadblCorrelation.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (aadblGaussianJoint[i][j], 1, 6, 1.) + " |"; - - System.out.println (strDump + "|"); - } - - System.out.println ("\t||----------------------------------------------------||"); - - System.out.println(); - - return Matrix.Transpose (aadblGaussianJoint); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblTimeWidth = 1. / 24.; - double dblTime = 1.; - double[][] aadblCorrelation = new double[][] { - {1.00, 0.20, 0.15, 0.05}, // #0 ASSET - {0.20, 1.00, 0.13, 0.25}, // #1 COLLATERAL - {0.15, 0.13, 1.00, 0.00}, // #2 BANK - {0.05, 0.25, 0.00, 1.00} // #3 COUNTER PARTY - }; - double dblAssetDrift = 0.06; - double dblAssetVolatility = 0.15; - double dblTerminalBankNumeraire = 1.; - double dblTerminalAssetNumeraire = 1.; - double dblTerminalCollateralNumeraire = 1.; - - int iNumTimeStep = (int) (dblTime / dblTimeWidth); - - DiffusionEvolver meAsset = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblAssetDrift, - dblAssetVolatility - ) - ); - - double[][] aadblNumeraireTimeSeries = NumeraireSequence ( - iNumTimeStep, - aadblCorrelation, - "\t|| ASSET, COLLATERAL, BANK, COUNTER PARTY REALIZATION ||" - ); - - JumpDiffusionEdge[] aR1AssetLR = meAsset.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblTerminalAssetNumeraire, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraireTimeSeries[0]), - -1. * dblTimeWidth - ); - - JumpDiffusionEdge[] aR1CollateralLR = meAsset.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblTerminalCollateralNumeraire, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraireTimeSeries[1]), - -1. * dblTimeWidth - ); - - JumpDiffusionEdge[] aR1BankLR = meAsset.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblTerminalBankNumeraire, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraireTimeSeries[2]), - -1. * dblTimeWidth - ); - - JumpDiffusionEdge[] aR1CounterPartyLR = meAsset.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblTerminalBankNumeraire, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraireTimeSeries[3]), - -1. * dblTimeWidth - ); - - System.out.println(); - - System.out.println("\t||----------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println("\t|| BURGARD & KJAER (2011) CORRELATED JOINT ASSET/COLLATERAL/BANK/COUNTER-PARTY NUMERAIRE EVOLUTION ||"); - - System.out.println("\t||----------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println("\t|| L -> R: ||"); - - System.out.println("\t|| - Time ||"); - - System.out.println("\t|| - Asset Numeraire Finish Value ||"); - - System.out.println("\t|| - Asset Numeraire Start Value ||"); - - System.out.println("\t|| - Asset Numeraire Continuous Wander Realization ||"); - - System.out.println("\t|| - Collateral Numeraire Finish Value ||"); - - System.out.println("\t|| - Collateral Numeraire Start Value ||"); - - System.out.println("\t|| - Collateral Numeraire Continuous Wander Realization ||"); - - System.out.println("\t|| - Bank Numeraire Finish Value ||"); - - System.out.println("\t|| - Bank Numeraire Start Value ||"); - - System.out.println("\t|| - Bank Numeraire Continuous Wander Realization ||"); - - System.out.println("\t|| - Counter-Party Numeraire Finish Value ||"); - - System.out.println("\t|| - Counter-Party Numeraire Start Value ||"); - - System.out.println("\t|| - Counter-Party Numeraire Continuous Wander Realization ||"); - - System.out.println("\t||----------------------------------------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < iNumTimeStep; ++i) { - dblTime = dblTime - dblTimeWidth; - - System.out.println ( - "\t|| " + - FormatUtil.FormatDouble (dblTime, 1, 4, 1.) + " => " + - FormatUtil.FormatDouble (aR1AssetLR[i].start(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (aR1AssetLR[i].finish(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (aR1AssetLR[i].diffusionWander(), 1, 4, 1.) + " ||" + - FormatUtil.FormatDouble (aR1CollateralLR[i].start(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (aR1CollateralLR[i].finish(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (aR1CollateralLR[i].diffusionWander(), 1, 4, 1.) + " ||" + - FormatUtil.FormatDouble (aR1BankLR[i].start(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (aR1BankLR[i].finish(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (aR1BankLR[i].diffusionWander(), 1, 4, 1.) + " ||" + - FormatUtil.FormatDouble (aR1CounterPartyLR[i].start(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (aR1CounterPartyLR[i].finish(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (aR1CounterPartyLR[i].diffusionWander(), 1, 4, 1.) + " ||" - ); - } - - System.out.println("\t||----------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/numeraire/R1JointJumpDiffusion.java b/org/drip/sample/numeraire/R1JointJumpDiffusion.java deleted file mode 100644 index e60b980..0000000 --- a/org/drip/sample/numeraire/R1JointJumpDiffusion.java +++ /dev/null @@ -1,312 +0,0 @@ - -package org.drip.sample.numeraire; - -import org.drip.measure.discretemarginal.SequenceGenerator; -import org.drip.measure.dynamics.*; -import org.drip.measure.process.*; -import org.drip.measure.realization.*; -import org.drip.quant.common.FormatUtil; -import org.drip.quant.linearalgebra.Matrix; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * R1JointJumpDiffusion demonstrates the Joint Evolution of R^1 Jump Diffusion Variates - the Continuous - * Asset, the Collateral, the Bank, and the Counter-Party Numeraires involved in the Dynamic XVA Replication - * Portfolio of the Burgard and Kjaer (2011) Methodology. 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class R1JointJumpDiffusion { - - private static final double[][] NumeraireSequence ( - final int iCount, - final double[][] aadblCorrelation, - final String strHeader) - throws Exception - { - double[][] aadblGaussianJoint = SequenceGenerator.GaussianJoint ( - iCount, - aadblCorrelation - ); - - System.out.println(); - - System.out.println ("\t||----------------------------------------------------||"); - - System.out.println (strHeader); - - System.out.println ("\t||----------------------------------------------------||"); - - for (int i = 0; i < iCount; ++i) { - String strDump = "\t||" + FormatUtil.FormatDouble (i, 2, 0, 1.) + " |"; - - for (int j = 0; j < aadblCorrelation.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (aadblGaussianJoint[i][j], 1, 6, 1.) + " |"; - - System.out.println (strDump + "|"); - } - - System.out.println ("\t||----------------------------------------------------||"); - - System.out.println(); - - return Matrix.Transpose (aadblGaussianJoint); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblTimeWidth = 1. / 24.; - double dblTime = 0.; - double[][] aadblCorrelation = new double[][] { - {1.00, 0.20, 0.15, 0.05}, // #0 ASSET - {0.20, 1.00, 0.13, 0.25}, // #1 COLLATERAL - {0.15, 0.13, 1.00, 0.00}, // #2 BANK - {0.05, 0.25, 0.00, 1.00} // #3 COUNTER PARTY - }; - double dblAssetDrift = 0.06; - double dblAssetVolatility = 0.15; - double dblInitialAssetNumeraire = 1.; - - double dblZeroCouponBankBondDrift = 0.03; - double dblZeroCouponBankBondVolatility = 0.10; - double dblBankHazardRate = 0.03; - double dblBankRecoveryRate = 0.45; - double dblInitialBankNumeraire = 1.; - - double dblZeroCouponCollateralBondDrift = 0.01; - double dblZeroCouponCollateralBondVolatility = 0.05; - double dblInitialCollateralNumeraire = 1.; - - double dblZeroCouponCounterPartyBondDrift = 0.03; - double dblZeroCouponCounterPartyBondVolatility = 0.10; - double dblCounterPartyHazardRate = 0.05; - double dblCounterPartyRecoveryRate = 0.30; - double dblInitialCounterPartyNumeraire = 1.; - - int iNumTimeStep = (int) (1. / dblTimeWidth); - - DiffusionEvolver meAsset = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblAssetDrift, - dblAssetVolatility - ) - ); - - DiffusionEvolver meZeroCouponCollateralBond = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponCollateralBondDrift, - dblZeroCouponCollateralBondVolatility - ) - ); - - JumpDiffusionEvolver meZeroCouponBankBond = new JumpDiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponBankBondDrift, - dblZeroCouponBankBondVolatility - ), - HazardJumpEvaluator.Standard ( - dblBankHazardRate, - dblBankRecoveryRate - ) - ); - - JumpDiffusionEvolver meZeroCouponCounterPartyBond = new JumpDiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblZeroCouponCounterPartyBondDrift, - dblZeroCouponCounterPartyBondVolatility - ), - HazardJumpEvaluator.Standard ( - dblCounterPartyHazardRate, - dblCounterPartyRecoveryRate - ) - ); - - double[][] aadblNumeraireTimeSeries = NumeraireSequence ( - iNumTimeStep, - aadblCorrelation, - "\t|| ASSET, COLLATERAL, BANK, COUNTER PARTY REALIZATION ||" - ); - - double[] adblBankDefaultIndicator = SequenceGenerator.Uniform (iNumTimeStep); - - double[] adblCounterPartyDefaultIndicator = SequenceGenerator.Uniform (iNumTimeStep); - - JumpDiffusionEdge[] aR1AssetLR = meAsset.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblInitialAssetNumeraire, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraireTimeSeries[0]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aR1CollateralLR = meZeroCouponCollateralBond.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblInitialCollateralNumeraire, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraireTimeSeries[1]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aR1BankLR = meZeroCouponBankBond.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblInitialBankNumeraire, - 0., - false - ), - UnitRandom.JumpDiffusion ( - aadblNumeraireTimeSeries[2], - adblBankDefaultIndicator - ), - dblTimeWidth - ); - - JumpDiffusionEdge[] aR1CounterPartyLR = meZeroCouponCounterPartyBond.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblInitialCounterPartyNumeraire, - 0., - false - ), - UnitRandom.JumpDiffusion ( - aadblNumeraireTimeSeries[3], - adblCounterPartyDefaultIndicator - ), - dblTimeWidth - ); - - System.out.println(); - - System.out.println("\t||----------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println("\t|| BURGARD & KJAER (2011) CORRELATED JOINT ASSET/COLLATERAL/BANK/COUNTER-PARTY NUMERAIRE EVOLUTION ||"); - - System.out.println("\t||----------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println("\t|| L -> R: ||"); - - System.out.println("\t|| - Time ||"); - - System.out.println("\t|| - Asset Numeraire Finish Value ||"); - - System.out.println("\t|| - Asset Numeraire Start Value ||"); - - System.out.println("\t|| - Asset Numeraire Continuous Wander Realization ||"); - - System.out.println("\t|| - Collateral Numeraire Finish Value ||"); - - System.out.println("\t|| - Collateral Numeraire Start Value ||"); - - System.out.println("\t|| - Collateral Numeraire Continuous Wander Realization ||"); - - System.out.println("\t|| - Bank Numeraire Finish Value ||"); - - System.out.println("\t|| - Bank Numeraire Start Value ||"); - - System.out.println("\t|| - Bank Numeraire Continuous Wander Realization ||"); - - System.out.println("\t|| - Counter-Party Numeraire Finish Value ||"); - - System.out.println("\t|| - Counter-Party Numeraire Start Value ||"); - - System.out.println("\t|| - Counter-Party Numeraire Continuous Wander Realization ||"); - - System.out.println("\t||----------------------------------------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < iNumTimeStep; ++i) { - dblTime = dblTime + dblTimeWidth; - - System.out.println ( - "\t|| " + - FormatUtil.FormatDouble (dblTime, 1, 4, 1.) + " => " + - FormatUtil.FormatDouble (aR1AssetLR[i].start(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (aR1AssetLR[i].finish(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (aR1AssetLR[i].diffusionWander(), 1, 4, 1.) + " ||" + - FormatUtil.FormatDouble (aR1CollateralLR[i].start(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (aR1CollateralLR[i].finish(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (aR1CollateralLR[i].diffusionWander(), 1, 4, 1.) + " ||" + - FormatUtil.FormatDouble (aR1BankLR[i].start(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (aR1BankLR[i].finish(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (aR1BankLR[i].diffusionWander(), 1, 4, 1.) + " ||" + - FormatUtil.FormatDouble (aR1CounterPartyLR[i].start(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (aR1CounterPartyLR[i].finish(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (aR1CounterPartyLR[i].diffusionWander(), 1, 4, 1.) + " ||" - ); - } - - System.out.println("\t||----------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/numeraire/R1Jump.java b/org/drip/sample/numeraire/R1Jump.java deleted file mode 100644 index a9685b7..0000000 --- a/org/drip/sample/numeraire/R1Jump.java +++ /dev/null @@ -1,141 +0,0 @@ - -package org.drip.sample.numeraire; - -import org.drip.measure.discretemarginal.SequenceGenerator; -import org.drip.measure.dynamics.*; -import org.drip.measure.process.JumpDiffusionEvolver; -import org.drip.measure.realization.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * R1Jump demonstrates the Jump Evolution of a Default-able Asset. 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class R1Jump { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblTimeWidth = 1. / 24.; - double dblTime = 0.; - double dblAssetDrift = 0.06; - double dblAssetVolatility = 0.15; - double dblAssetHazard = 0.05; - double dblAssetDefaultMagnitude = 0.6; - double dblTerminalAssetNumeraire = 1.; - - int iNumTimeStep = (int) (1. / dblTimeWidth); - - JumpDiffusionEvolver meAsset = new JumpDiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblAssetDrift, - dblAssetVolatility - ), - HazardJumpEvaluator.Standard ( - dblAssetHazard, - dblAssetDefaultMagnitude - ) - ); - - double[] adblAssetNumeraireTimeSeries = SequenceGenerator.Gaussian (iNumTimeStep); - - double[] adblDefaultIndicatorTimeSeries = SequenceGenerator.Uniform (iNumTimeStep); - - JumpDiffusionEdge[] aR1AssetLR = meAsset.incrementSequence ( - new JumpDiffusionVertex ( - 0., - dblTerminalAssetNumeraire, - 0., - false - ), - UnitRandom.JumpDiffusion ( - adblAssetNumeraireTimeSeries, - adblDefaultIndicatorTimeSeries - ), - dblTimeWidth - ); - - System.out.println(); - - for (int i = 0; i < iNumTimeStep; ++i) { - dblTime = dblTime + dblTimeWidth; - - System.out.println ( - "\t|| " + - FormatUtil.FormatDouble (dblTime, 1, 6, 1.) + " => " + - FormatUtil.FormatDouble (aR1AssetLR[i].start(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (aR1AssetLR[i].finish(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (aR1AssetLR[i].diffusionWander(), 1, 4, 1.) + " | " + - aR1AssetLR[i].stochasticJumpEdge().jumpOccurred() + " ||" - ); - } - - System.out.println(); - } -} diff --git a/org/drip/sample/numerical/FixedPointSearch.java b/org/drip/sample/numerical/FixedPointSearch.java deleted file mode 100644 index 9904007..0000000 --- a/org/drip/sample/numerical/FixedPointSearch.java +++ /dev/null @@ -1,442 +0,0 @@ - -package org.drip.sample.numerical; - -import org.drip.function.definition.R1ToR1; -import org.drip.function.r1tor1solver.*; -import org.drip.quant.calculus.*; -import org.drip.quant.common.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * FixedPointSearch contains a sample illustration of usage of the Root Finder Library. It demonstrates the - * fixed point extraction using the following techniques: - * - Newton-Raphson method - * - Bisection Method - * - False Position - * - Quadratic Interpolation - * - Inverse Quadratic Interpolation - * - Ridder's method - * - Brent's method - * - Zheng's method - * - * @author Lakshmi Krishnamurthy - */ - -public class FixedPointSearch { - - /* - * Sample illustrating the Invocation of the Newton-Raphson Open Method - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final void InvokeNewton ( - final R1ToR1 func) - { - try { - FixedPointFinderOutput fpop = new FixedPointFinderNewton ( - 0., - func, - true - ).findRoot(); - - System.out.println ("--------\nNEWTON START\n-------"); - - if (null != fpop && fpop.containsRoot()) { - System.out.println ("Root: " + FormatUtil.FormatDouble (fpop.getRoot(), 1, 4, 1.)); - - System.out.println (fpop.displayString()); - } else - System.out.println ("Root searched failed!"); - - System.out.println ("--------\nNEWTON FINISH\n-------\n"); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /* - * Sample illustrating the Invocation of the Bisection Bracketing Method - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final void InvokeBisection ( - final R1ToR1 func) - { - try { - FixedPointFinderOutput fpop = new FixedPointFinderBracketing ( - 0., - func, - null, - VariateIteratorPrimitive.BISECTION, - true - ).findRoot(); - - System.out.println ("--------\nBISECTION START\n-------"); - - if (null != fpop && fpop.containsRoot()) { - System.out.println ("Root: " + FormatUtil.FormatDouble (fpop.getRoot(), 1, 4, 1.)); - - System.out.println (fpop.displayString()); - } else - System.out.println ("Root searched failed!"); - - System.out.println ("--------\nBISECTION FINISH\n-------\n"); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /* - * Sample illustrating the Invocation of the False Position Method - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final void InvokeFalsePosition ( - final R1ToR1 func) - { - try { - FixedPointFinderOutput fpop = new FixedPointFinderBracketing ( - 0., - func, - null, - VariateIteratorPrimitive.FALSE_POSITION, - true - ).findRoot(); - - System.out.println ("--------\nFALSE POSITION START\n-------"); - - if (null != fpop && fpop.containsRoot()) { - System.out.println ("Root: " + FormatUtil.FormatDouble (fpop.getRoot(), 1, 4, 1.)); - - System.out.println (fpop.displayString()); - } else - System.out.println ("Root searched failed!"); - - System.out.println ("--------\nFALSE POSITION FINISH\n-------\n"); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /* - * Sample illustrating the Invocation of the Quadratic Interpolation Bracketing Method - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final void InvokeQuadraticInterpolation ( - final R1ToR1 func) - { - try { - FixedPointFinderOutput fpop = new FixedPointFinderBracketing ( - 0., - func, - null, - VariateIteratorPrimitive.QUADRATIC_INTERPOLATION, - true - ).findRoot(); - - System.out.println ("--------\nQUADRATIC INTERPOLATION START\n-------"); - - if (null != fpop && fpop.containsRoot()) { - System.out.println ("Root: " + FormatUtil.FormatDouble (fpop.getRoot(), 1, 4, 1.)); - - System.out.println (fpop.displayString()); - } else - System.out.println ("Root searched failed!"); - - System.out.println ("--------\nQUADRATIC INTERPOLATION FINISH\n-------\n"); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /* - * Sample illustrating the Invocation of the Inverse Quadratic Interpolation Bracketing Method - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final void InvokeInverseQuadraticInterpolation ( - final R1ToR1 func) - { - try { - FixedPointFinderOutput fpop = new FixedPointFinderBracketing ( - 0., - func, - null, - VariateIteratorPrimitive.INVERSE_QUADRATIC_INTERPOLATION, - true - ).findRoot(); - - System.out.println ("--------\nINVERSE QUADRATIC INTERPOLATION START\n-------"); - - if (null != fpop && fpop.containsRoot()) { - System.out.println ("Root: " + FormatUtil.FormatDouble (fpop.getRoot(), 1, 4, 1.)); - - System.out.println (fpop.displayString()); - } else - System.out.println ("Root searched failed!"); - - System.out.println ("--------\nINVERSE QUADRATIC INTERPOLATION FINISH\n-------\n"); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /* - * Sample illustrating the Invocation of the Ridder Bracketing Method - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final void InvokeRidder ( - final R1ToR1 func) - { - try { - FixedPointFinderOutput fpop = new FixedPointFinderBracketing ( - 0., - func, - null, - VariateIteratorPrimitive.RIDDER, - true - ).findRoot(); - - System.out.println ("--------\nRIDDER START\n-------"); - - if (null != fpop && fpop.containsRoot()) { - System.out.println ("Root: " + FormatUtil.FormatDouble (fpop.getRoot(), 1, 4, 1.)); - - System.out.println (fpop.displayString()); - } else - System.out.println ("Root searched failed!"); - - System.out.println ("--------\nRIDDER FINISH\n-------\n"); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /* - * Sample illustrating the Invocation of the Brent's Bracketing Method - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final void InvokeBrent ( - final R1ToR1 func) - { - try { - FixedPointFinderOutput fpop = new FixedPointFinderBrent ( - 0., - func, - true - ).findRoot(); - - System.out.println ("--------\nBRENT START\n-------"); - - if (null != fpop && fpop.containsRoot()) { - System.out.println ("Root: " + FormatUtil.FormatDouble (fpop.getRoot(), 1, 4, 1.)); - - System.out.println (fpop.displayString()); - } else - System.out.println ("Root searched failed!"); - - System.out.println ("--------\nBRENT FINISH\n-------\n"); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /* - * Sample illustrating the Invocation of the Zheng's Bracketing Method - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final void InvokeZheng ( - final R1ToR1 func) - { - try { - FixedPointFinderOutput fpop = new FixedPointFinderZheng ( - 0., - func, - true - ).findRoot(); - - System.out.println ("--------\nZHENG START\n-------"); - - if (null != fpop && fpop.containsRoot()) { - System.out.println ("Root: " + FormatUtil.FormatDouble (fpop.getRoot(), 1, 4, 1.)); - - System.out.println (fpop.displayString()); - } else - System.out.println ("Root searched failed!"); - - System.out.println ("--------\nZHENG FINISH\n-------\n"); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static final void main ( - final String[] astrArgs) - { - /* - * Define and implement the objective function - */ - - R1ToR1 func = new R1ToR1 (null) { - @Override public double evaluate ( - final double dblVariate) - throws Exception - { - return Math.cos (dblVariate) - dblVariate * dblVariate * dblVariate; - - /* return dblVariate * dblVariate * dblVariate - 3. * dblVariate * dblVariate + 2. * - dblVariate; - - return dblVariate * dblVariate * dblVariate + 4. * dblVariate + 4.; - - return 32. * dblVariate * dblVariate * dblVariate * dblVariate * dblVariate * dblVariate - - 48. * dblVariate * dblVariate * dblVariate * dblVariate + 18. * dblVariate * - dblVariate - 1.; - - return 1. + 3. * dblVariate - 2. * java.lang.Math.sin (dblVariate); */ - } - - @Override public Differential differential ( - final double dblVariate, - final double dblOFBase, - final int iOrder) - { - if (0 >= iOrder || 2 < iOrder) return null; - - double dblVariateInfinitesimal = Double.NaN; - - try { - dblVariateInfinitesimal = _dc.getVariateInfinitesimal (dblVariate); - } catch (Exception e) { - e.printStackTrace(); - - return null; - } - - if (1 != iOrder) { - try { - return new Differential (dblVariateInfinitesimal, (-1. * Math.cos (dblVariate) - 6. * dblVariate) - * dblVariateInfinitesimal); - - /* return new Differential (dblVariateInfinitesimal, (6. * dblVariate - 6.) * dblVariateInfinitesimal); - - return new Differential (dblVariateInfinitesimal, (6. * dblVariate) * dblVariateInfinitesimal); - - return new Differential (dblVariateInfinitesimal, (960. * dblVariate * dblVariate * dblVariate * - dblVariate - 576. * dblVariate * dblVariate + 36.) * dblVariateInfinitesimal); - - return new Differential (dblVariateInfinitesimal, (2. * Math.sin (dblVariate)) * dblVariateInfinitesimal); */ - } catch (Exception e) { - e.printStackTrace(); - } - - return null; - } - - try { - return new Differential (dblVariateInfinitesimal, (-1. * Math.sin (dblVariate) - 3. * dblVariate * dblVariate) * - dblVariateInfinitesimal); - - /* return new Differential (dblVariateInfinitesimal, (3. * dblVariate * dblVariate - 6. * dblVariate + 2.) * - dblVariateInfinitesimal); - - return new Differential (dblVariateInfinitesimal, (3. * dblVariate * dblVariate + 4.) * dblVariateInfinitesimal); - - return new Differential (dblVariateInfinitesimal, (192. * dblVariate * dblVariate * dblVariate * dblVariate * - dblVariate - 192. * dblVariate * dblVariate * dblVariate + 36. * dblVariate) * dblVariateInfinitesimal); - - return new Differential (dblVariateInfinitesimal, (3. - 2. * Math.cos (dblVariate)) * dblVariateInfinitesimal); */ - } catch (Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws Exception - { - return R1ToR1Integrator.Boole (this, dblBegin, dblEnd); - } - }; - - InvokeNewton (func); - - InvokeBisection (func); - - InvokeFalsePosition (func); - - InvokeQuadraticInterpolation (func); - - InvokeInverseQuadraticInterpolation (func); - - InvokeRidder (func); - - InvokeBrent (func); - - InvokeZheng (func); - } -} diff --git a/org/drip/sample/numerical/IntegrandQuadrature.java b/org/drip/sample/numerical/IntegrandQuadrature.java deleted file mode 100644 index ccbcd29..0000000 --- a/org/drip/sample/numerical/IntegrandQuadrature.java +++ /dev/null @@ -1,241 +0,0 @@ - -package org.drip.sample.numerical; - -import org.drip.function.definition.R1ToR1; -import org.drip.function.r1tor1.*; -import org.drip.quant.calculus.R1ToR1Integrator; -import org.drip.quant.common.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * IntegrandQuadrature shows samples for the following routines for integrating the objective function: - * - Mid-Point Scheme - * - Trapezoidal Scheme - * - Simpson/Simpson38 schemes - * - Boole Scheme - * - * @author Lakshmi Krishnamurthy - */ - -public class IntegrandQuadrature { - - /* - * Compute the Integrand Quadrature for the specified Univariate Function using the various methods. - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static void ComputeQuadrature ( - final R1ToR1 au, - final double dblActual, - final double dblStart, - final double dblEnd) - throws Exception - { - int iRightDecimal = 8; - - System.out.println ("\t\tActual : " + - FormatUtil.FormatDouble (dblActual, 1, iRightDecimal, 1.) - ); - - System.out.println ("\t\tLinear : " + - FormatUtil.FormatDouble ( - R1ToR1Integrator.LinearQuadrature ( - au, - dblStart, - dblEnd - ), - 1, - iRightDecimal, - 1. - ) - ); - - System.out.println ("\t\tMidPoint : " + - FormatUtil.FormatDouble ( - R1ToR1Integrator.MidPoint ( - au, - dblStart, - dblEnd - ), - 1, - iRightDecimal, - 1. - ) - ); - - System.out.println ("\t\tTrapezoidal : " + - FormatUtil.FormatDouble ( - R1ToR1Integrator.Trapezoidal ( - au, - dblStart, - dblEnd - ), - 1, - iRightDecimal, - 1. - ) - ); - - System.out.println ("\t\tSimpson : " + - FormatUtil.FormatDouble ( - R1ToR1Integrator.Simpson ( - au, - dblStart, - dblEnd - ), - 1, - iRightDecimal, - 1. - ) - ); - - System.out.println ("\t\tSimpson 38 : " + - FormatUtil.FormatDouble ( - R1ToR1Integrator.Simpson38 ( - au, - dblStart, - dblEnd - ), - 1, - iRightDecimal, - 1. - ) - ); - - System.out.println ("\t\tBoole : " + - FormatUtil.FormatDouble ( - R1ToR1Integrator.Boole ( - au, - dblStart, - dblEnd - ), - 1, - iRightDecimal, - 1. - ) - ); - } - - /* - * Compute the Integrand Quadrature for the various Univariate Functions using the different methods. - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static void IntegrandQuadratureSample() - throws Exception - { - double dblStart = 0.; - double dblEnd = 1.; - - R1ToR1 auExp = new ExponentialTension ( - Math.E, - 1. - ); - - System.out.println ("\n\t-------------------------------------\n"); - - ComputeQuadrature ( - auExp, - auExp.evaluate (dblEnd) - auExp.evaluate (dblStart), - dblStart, - dblEnd - ); - - System.out.println ("\n\t-------------------------------------\n"); - - R1ToR1 au1 = new R1ToR1 (null) { - @Override public double evaluate ( - final double dblVariate) - throws Exception - { - return Math.cos (dblVariate) - dblVariate * dblVariate * dblVariate; - } - }; - - ComputeQuadrature ( - au1, - Math.sin (dblEnd) - Math.sin (dblStart) - 0.25 * (dblEnd * dblEnd * dblEnd * dblEnd - dblStart * dblStart * dblStart * dblStart), - dblStart, - dblEnd - ); - - System.out.println ("\n\t-------------------------------------\n"); - - R1ToR1 au2 = new R1ToR1 (null) { - @Override public double evaluate ( - final double dblVariate) - throws Exception - { - return dblVariate * dblVariate * dblVariate - 3. * dblVariate * dblVariate + 2. * dblVariate; - } - }; - - ComputeQuadrature ( - au2, - 0.25 * (dblEnd * dblEnd * dblEnd * dblEnd - dblStart * dblStart * dblStart * dblStart) - - (dblEnd * dblEnd * dblEnd - dblStart * dblStart * dblStart) + - (dblEnd * dblEnd - dblStart * dblStart), - dblStart, - dblEnd - ); - - System.out.println ("\n\t-------------------------------------\n"); - } - - public static void main ( - final String astrArgs[]) - throws Exception - { - IntegrandQuadratureSample(); - } -} diff --git a/org/drip/sample/numerical/PhaseTrackerComparison.java b/org/drip/sample/numerical/PhaseTrackerComparison.java deleted file mode 100644 index fdeb79d..0000000 --- a/org/drip/sample/numerical/PhaseTrackerComparison.java +++ /dev/null @@ -1,182 +0,0 @@ - -package org.drip.sample.numerical; - -import java.util.Map; - -import org.drip.param.pricer.HestonOptionPricerParams; -import org.drip.pricer.option.HestonStochasticVolatilityAlgorithm; -import org.drip.quant.common.FormatUtil; -import org.drip.quant.fourier.PhaseAdjuster; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * PhaseTrackerComparison demonstrates the Log + Power Complex Number Phase Correction Functionality - * implemented by three different ways for the calculation of the Inverse Fourier Transforms. The sample - * problem chosen is the stochastic volatility evolution using the Heston Method. - * - * @author Lakshmi Krishnamurthy - */ - -public class PhaseTrackerComparison { - - private static final Map PhaseSet ( - final double dblRho, - final double dblKappa, - final double dblSigma, - final double dblTheta, - final double dblLambda, - final double dblStrike, - final double dbTimeToExpiry, - final double dblRiskFreeRate, - final double dblSpot, - final double dblSpotVolatility, - final int iPhaseTrackerType) - throws Exception - { - HestonOptionPricerParams fphp = new HestonOptionPricerParams ( - HestonStochasticVolatilityAlgorithm.PAYOFF_TRANSFORM_SCHEME_HESTON_1993, - dblRho, - dblKappa, - dblSigma, - dblTheta, - dblLambda, - iPhaseTrackerType - ); - - HestonStochasticVolatilityAlgorithm hsva = new HestonStochasticVolatilityAlgorithm (fphp); - - return hsva.recordPhase ( - dblStrike, - dbTimeToExpiry, - dblRiskFreeRate, - dblSpot, - dblSpotVolatility, - true - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - double dblRho = 0.3; - double dblKappa = 1.; - double dblSigma = 0.5; - double dblTheta = 0.2; - double dblLambda = 0.; - - double dblStrike = 1.; - double dbTimeToExpiry = 0.5; - double dblRiskFreeRate = 0.0; - double dblSpot = 1.; - double dblSpotVolatility = 0.1; - - Map mapFreqPhaseNoAdjust = PhaseSet ( - dblRho, - dblKappa, - dblSigma, - dblTheta, - dblLambda, - dblStrike, - dbTimeToExpiry, - dblRiskFreeRate, - dblSpot, - dblSpotVolatility, - PhaseAdjuster.MULTI_VALUE_BRANCH_PHASE_TRACKER_NONE - ); - - Map mapFreqPhaseRotationCount = PhaseSet ( - dblRho, - dblKappa, - dblSigma, - dblTheta, - dblLambda, - dblStrike, - dbTimeToExpiry, - dblRiskFreeRate, - dblSpot, - dblSpotVolatility, - PhaseAdjuster.MULTI_VALUE_BRANCH_PHASE_TRACKER_ROTATION_COUNT - ); - - Map mapFreqPhaseKahlJackel = PhaseSet ( - dblRho, - dblKappa, - dblSigma, - dblTheta, - dblLambda, - dblStrike, - dbTimeToExpiry, - dblRiskFreeRate, - dblSpot, - dblSpotVolatility, - PhaseAdjuster.MULTI_VALUE_BRANCH_POWER_PHASE_TRACKER_KAHL_JACKEL - ); - - System.out.println ("\t|--------------------------------------------|"); - - System.out.println ("\t| u => NO CORECT | ROT COUNT | KAHL JACKEL |"); - - System.out.println ("\t|--------------------------------------------|"); - - for (Map.Entry me : mapFreqPhaseKahlJackel.entrySet()) { - Double dblKey = me.getKey(); - - System.out.println ("\t|" + - FormatUtil.FormatDouble (dblKey, 2, 0, 1.) + " => " + - FormatUtil.FormatDouble (mapFreqPhaseNoAdjust.get (dblKey), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (mapFreqPhaseRotationCount.get (dblKey), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (mapFreqPhaseKahlJackel.get (dblKey), 1, 6, 1.) + " |" - ); - } - - System.out.println ("\t|--------------------------------------------|"); - } -} diff --git a/org/drip/sample/ois/CrossOvernightFloatingStream.java b/org/drip/sample/ois/CrossOvernightFloatingStream.java deleted file mode 100644 index be64c03..0000000 --- a/org/drip/sample/ois/CrossOvernightFloatingStream.java +++ /dev/null @@ -1,542 +0,0 @@ - -package org.drip.sample.ois; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.analytics.daycount.Convention; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.*; -import org.drip.market.definition.OvernightIndex; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.*; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.*; -import org.drip.quant.common.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * CrossOvernightStream demonstrates the construction, customization, and valuation of Cross-Currency - * Overnight Floating Streams. - * - * @author Lakshmi Krishnamurthy - */ - -public class CrossOvernightFloatingStream { - - private static final FixFloatComponent OTCOISFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = OvernightFixedFloatContainer.FundConventionFromJurisdiction ( - strCurrency - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - for (int i = 0; i < aiDay.length; ++i) - aDeposit[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - OvernightLabel.Create ( - strCurrency - ) - ); - - return aDeposit; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OISFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aOIS[i] = OTCOISFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aOIS; - } - - private static final MergedDiscountForwardCurve CustomOISCurveBuilderSample ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - } - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850, // Cash - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of EDF Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aEDFComp = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtSpot, - 4, - strCurrency - ); - - double[] adblEDFQuote = new double[] { - 0.01612, 0.01580, 0.01589, 0.01598 - }; - - /* - * Construct the Cash Instrument Set Stretch Builder - */ - - LatentStateStretchSpec edfStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "EDF", - aEDFComp, - "ForwardRate", - adblEDFQuote - ); - - /* - * Construct the Array of OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblOISQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488 // 10Y - }; - - CalibratableComponent[] aOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y" - }, - adblOISQuote - ); - - /* - * Construct the OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SWAP", - aOISComp, - "SwapRate", - adblOISQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - edfStretch, - oisStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - */ - - return ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - null, - null, - null, - 1. - ); - } - - private static final LatentStateFixingsContainer SetFlatOvernightFixings ( - final JulianDate dtStart, - final JulianDate dtEnd, - final JulianDate dtValue, - final ForwardLabel fri, - final double dblFlatFixing, - final double dblNotional) - throws Exception - { - LatentStateFixingsContainer lsfc = new LatentStateFixingsContainer(); - - double dblAccount = 1.; - - int iPrevDate = dtStart.julian(); - - JulianDate dt = dtStart.addDays (1); - - while (dt.julian() <= dtEnd.julian()) { - lsfc.add ( - dt, - fri, - dblFlatFixing - ); - - if (dt.julian() <= dtValue.julian()) { - double dblAccrualFraction = Convention.YearFraction ( - iPrevDate, - dt.julian(), - "Act/360", - false, - null, - "USD" - ); - - dblAccount *= (1. + dblFlatFixing * dblAccrualFraction); - } - - iPrevDate = dt.julian(); - - dt = dt.addBusDays ( - 1, - "USD" - ); - } - - System.out.println ("\tManual Calc Float Accrued (Geometric Compounding): " + (dblAccount - 1.) * dblNotional); - - System.out.println ("\tManual Calc Float Accrued (Arithmetic Compounding): " + - ((dtValue.julian() - dtStart.julian()) * dblNotional * dblFlatFixing / 360.)); - - return lsfc; - } - - public static final Map CompoundingRun ( - final ForwardLabel fri) - throws Exception - { - double dblOISVol = 0.3; - double dblUSDFundingVol = 0.3; - double dblUSDFundingUSDOISCorrelation = 0.3; - - String strCurrency = fri.currency(); - - JulianDate dtToday = org.drip.analytics.date.DateUtil.Today().addTenorAndAdjust ( - "0D", - strCurrency - ); - - MergedDiscountForwardCurve dc = CustomOISCurveBuilderSample ( - dtToday, - strCurrency - ); - - JulianDate dtCustomOISStart = dtToday.subtractTenor ("2M"); - - JulianDate dtCustomOISMaturity = dtToday.addTenor ("4M"); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 360, - "ON", - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "ON", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_OVERNIGHT, - null, - fri, - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.OvernightEdgeDates ( - dtCustomOISStart, - dtCustomOISStart.addTenorAndAdjust ( - "6M", - strCurrency - ), - strCurrency - ); - - Stream floatStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - SetFlatOvernightFixings ( - dtCustomOISStart, - dtCustomOISMaturity, - dtToday, - fri, - 0.003, - -1. - ) - ); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - strCurrency - ); - - FundingLabel fundingLabelUSD = FundingLabel.Standard ("USD"); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtToday.julian(), - VolatilityLabel.Standard (fri), - fri.currency(), - dblOISVol - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtToday.julian(), - VolatilityLabel.Standard (fundingLabelUSD), - "USD", - dblUSDFundingVol - ) - ); - - mktParams.setForwardFundingCorrelation ( - fri, - fundingLabelUSD, - new FlatUnivariate (dblUSDFundingUSDOISCorrelation) - ); - - return floatStream.value ( - valParams, - null, - mktParams, - null - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - - Map mapArithmeticOutput = CompoundingRun ( - OvernightLabel.Create ( - strCurrency - ) - ); - - Map mapGeometricOutput = CompoundingRun ( - ForwardLabel.Create ( - new OvernightIndex ( - strCurrency + "OIS", - "OIS", - strCurrency, - "Act/360", - strCurrency, - "ON", - 0, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ), - "ON" - ) - ); - - System.out.println ("\n\t-----------------------------------"); - - System.out.println ("\t GEOMETRIC | ARITHMETIC | CHECK"); - - System.out.println ("\t-----------------------------------\n"); - - for (Map.Entry meGeometric : mapGeometricOutput.entrySet()) { - String strKey = meGeometric.getKey(); - - double dblGeometricMeasure = meGeometric.getValue(); - - double dblArithmeticMeasure = mapArithmeticOutput.get (strKey); - - String strMatch = NumberUtil.WithinTolerance ( - dblGeometricMeasure, - dblArithmeticMeasure, - 1.e-08, - 1.e-04 - ) ? - "MATCH " : - "DIFFER"; - - System.out.println ("\t" + - FormatUtil.FormatDouble (dblGeometricMeasure, 1, 8, 1.) + " | " + - FormatUtil.FormatDouble (dblArithmeticMeasure, 1, 8, 1.) + " | " + - strMatch + " <= " + strKey - ); - } - } -} diff --git a/org/drip/sample/ois/IndexFundCurvesReconciliation.java b/org/drip/sample/ois/IndexFundCurvesReconciliation.java deleted file mode 100644 index dc597d9..0000000 --- a/org/drip/sample/ois/IndexFundCurvesReconciliation.java +++ /dev/null @@ -1,1135 +0,0 @@ - -package org.drip.sample.ois; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.*; -import org.drip.quant.common.*; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * IndexFundCurvesReconciliation demonstrates the Construction, Usage, Coupon Extraction and Measure - * Generation for an OIS Product Sample using the Index and the Fund Curves, and their Reconciliation. - * - * @author Lakshmi Krishnamurthy - */ - -public class IndexFundCurvesReconciliation { - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - for (int i = 0; i < aiDay.length; ++i) - aDeposit[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - OvernightLabel.Create ( - strCurrency - ) - ); - - return aDeposit; - } - - /* - * Construct the Array of Overnight Index Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OvernightIndexFromMaturityTenor ( - final JulianDate dtEffective, - final String[] astrMaturityTenor, - final double[] adblCoupon, - final String strCurrency) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrMaturityTenor.length]; - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - false, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - java.lang.String strFixedTenor = Helper.LEFT_TENOR_LESSER == Helper.TenorCompare ( - astrMaturityTenor[i], - "6M" - ) ? astrMaturityTenor[i] : "6M"; - - java.lang.String strFloatingTenor = Helper.LEFT_TENOR_LESSER == Helper.TenorCompare ( - astrMaturityTenor[i], - "3M" - ) ? astrMaturityTenor[i] : "3M"; - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "ON", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_OVERNIGHT, - null, - OvernightLabel.Create ( - strCurrency - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - strFixedTenor, - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - adblCoupon[i], - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 4, - strFloatingTenor, - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - strFixedTenor, - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - strFixedTenor, - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - strFloatingTenor, - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent ois = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - ois.setPrimaryCode ("OIS." + astrMaturityTenor[i] + "." + strCurrency); - - aOIS[i] = ois; - } - - return aOIS; - } - - /* - * Construct the Array of Overnight Fund Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OvernightFundFromMaturityTenor ( - final JulianDate dtEffective, - final String[] astrMaturityTenor, - final double[] adblCoupon, - final String strCurrency) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrMaturityTenor.length]; - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - false, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - java.lang.String strFixedTenor = Helper.LEFT_TENOR_LESSER == Helper.TenorCompare ( - astrMaturityTenor[i], - "6M" - ) ? astrMaturityTenor[i] : "6M"; - - java.lang.String strFloatingTenor = "ON"; - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "ON", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_OVERNIGHT, - null, - OvernightLabel.Create ( - strCurrency - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - strFixedTenor, - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - adblCoupon[i], - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 360, - strFloatingTenor, - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - strFixedTenor, - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - strFixedTenor, - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.OvernightEdgeDates ( - dtEffective, - dtEffective.addTenor (astrMaturityTenor[i]), - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent ois = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - ois.setPrimaryCode ("OIS." + astrMaturityTenor[i] + "." + strCurrency); - - aOIS[i] = ois; - } - - return aOIS; - } - - /* - * Construct the Array of Overnight Index Future Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OvernightIndexFutureFromMaturityTenor ( - final JulianDate dtSpot, - final String[] astrStartTenor, - final String[] astrMaturityTenor, - final double[] adblCoupon, - final String strCurrency) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrStartTenor.length]; - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrStartTenor.length; ++i) { - JulianDate dtEffective = dtSpot.addTenor (astrStartTenor[i]); - - java.lang.String strFixedTenor = Helper.LEFT_TENOR_LESSER == Helper.TenorCompare ( - astrMaturityTenor[i], - "6M" - ) ? astrMaturityTenor[i] : "6M"; - - java.lang.String strFloatingTenor = Helper.LEFT_TENOR_LESSER == Helper.TenorCompare ( - astrMaturityTenor[i], - "3M" - ) ? astrMaturityTenor[i] : "3M"; - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - strFixedTenor, - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - adblCoupon[i], - 0., - strCurrency - ); - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - false, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "ON", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_OVERNIGHT, - null, - OvernightLabel.Create ( - strCurrency - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 4, - strFloatingTenor, - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - strFixedTenor, - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent ois = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - ois.setPrimaryCode ("OIS." + astrMaturityTenor[i] + "." + strCurrency); - - aOIS[i] = ois; - } - - return aOIS; - } - - /* - * Construct the Array of Overnight Fund Future Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OvernightFundFutureFromMaturityTenor ( - final JulianDate dtSpot, - final String[] astrStartTenor, - final String[] astrMaturityTenor, - final double[] adblCoupon, - final String strCurrency) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrStartTenor.length]; - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrStartTenor.length; ++i) { - JulianDate dtEffective = dtSpot.addTenor (astrStartTenor[i]); - - java.lang.String strFixedTenor = Helper.LEFT_TENOR_LESSER == Helper.TenorCompare ( - astrMaturityTenor[i], - "6M" - ) ? astrMaturityTenor[i] : "6M"; - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - strFixedTenor, - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - adblCoupon[i], - 0., - strCurrency - ); - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - false, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "ON", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_OVERNIGHT, - null, - OvernightLabel.Create ( - strCurrency - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 4, - "ON", - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - strFixedTenor, - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent ois = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - ois.setPrimaryCode ("OIS." + astrMaturityTenor[i] + "." + strCurrency); - - aOIS[i] = ois; - } - - return aOIS; - } - - private static final MergedDiscountForwardCurve CustomOISCurveBuilderSample ( - final JulianDate dtToday, - final String strHeaderComment, - final String strCurrency, - final boolean bOvernightIndex) - throws Exception - { - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t " + strHeaderComment); - - System.out.println ("\t----------------------------------------------------------------"); - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtToday, - strCurrency, - new int[] { - 1, 2, 3 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0004, 0.0004, 0.0004 // Deposit - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - " DEPOSIT ", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of Short End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - CalibratableComponent[] aShortEndOISComp = bOvernightIndex ? - OvernightIndexFromMaturityTenor ( - dtToday, - new java.lang.String[] - {"1W", "2W", "3W", "1M"}, - adblShortEndOISQuote, - strCurrency) : - OvernightFundFromMaturityTenor ( - dtToday, - new java.lang.String[] - {"1W", "2W", "3W", "1M"}, - adblShortEndOISQuote, - strCurrency - ); - - /* - * Construct the Short End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisShortEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SHORT END OIS", - aShortEndOISComp, - "SwapRate", - adblShortEndOISQuote - ); - - /* - * Construct the Array of OIS Futures Instruments and their Quotes from the given set of parameters - */ - - double[] adblOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - CalibratableComponent[] aOISFutureComp = bOvernightIndex ? - OvernightIndexFutureFromMaturityTenor ( - dtToday, - new java.lang.String[] {"1M", "2M", "3M", "4M", "5M"}, - new java.lang.String[] {"1M", "1M", "1M", "1M", "1M"}, - adblOISFutureQuote, - strCurrency - ) : - OvernightFundFutureFromMaturityTenor ( - dtToday, - new java.lang.String[] {"1M", "2M", "3M", "4M", "5M"}, - new java.lang.String[] {"1M", "1M", "1M", "1M", "1M"}, - adblOISFutureQuote, - strCurrency - ); - - /* - * Construct the OIS Future Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisFutureStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - " OIS FUTURE ", - aOISFutureComp, - "SwapRate", - adblOISFutureQuote - ); - - /* - * Construct the Array of Long End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - CalibratableComponent[] aLongEndOISComp = bOvernightIndex ? - OvernightIndexFromMaturityTenor ( - dtToday, - new java.lang.String[] - {"15M", "18M", "21M", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y"}, - adblLongEndOISQuote, - strCurrency - ) : OvernightFundFromMaturityTenor ( - dtToday, - new java.lang.String[] - {"15M", "18M", "21M", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y"}, - adblLongEndOISQuote, - strCurrency - ); - - - /* - * Construct the Long End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisLongEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "LONG END OIS ", - aLongEndOISComp, - "SwapRate", - adblLongEndOISQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - oisShortEndStretch, - oisFutureStretch, - oisLongEndStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit and Swap Stretches. - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - new ValuationParams ( - dtToday, - dtToday, - strCurrency - ), - null, - null, - null, - 1. - ); - - /* - * Cross-Comparison of the Deposit Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t[" + aDepositComp[i].effectiveDate() + " => " + aDepositComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aDepositComp[i].measureValue (new ValuationParams (dtToday, dtToday, strCurrency), null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "Rate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the Short End OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS SHORT END INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aShortEndOISComp.length; ++i) - System.out.println ("\t[" + aShortEndOISComp[i].effectiveDate() + " => " + aShortEndOISComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aShortEndOISComp[i].measureValue (new ValuationParams (dtToday, dtToday, strCurrency), null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "CalibSwapRate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblShortEndOISQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aShortEndOISComp[i].measureValue (new ValuationParams (dtToday, dtToday, strCurrency), null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "FairPremium"), 1, 6, 1.)); - - /* - * Cross-Comparison of the OIS Future Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS FUTURE INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aOISFutureComp.length; ++i) - System.out.println ("\t[" + aOISFutureComp[i].effectiveDate() + " => " + aOISFutureComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aOISFutureComp[i].measureValue (new ValuationParams (dtToday, dtToday, strCurrency), null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "SwapRate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblOISFutureQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aOISFutureComp[i].measureValue (new ValuationParams (dtToday, dtToday, strCurrency), null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "FairPremium"), 1, 6, 1.)); - - /* - * Cross-Comparison of the Long End OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS LONG END INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aLongEndOISComp.length; ++i) - System.out.println ("\t[" + aLongEndOISComp[i].effectiveDate() + " => " + aLongEndOISComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aLongEndOISComp[i].measureValue (new ValuationParams (dtToday, dtToday, strCurrency), null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "CalibSwapRate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblLongEndOISQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aLongEndOISComp[i].measureValue (new ValuationParams (dtToday, dtToday, strCurrency), null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "FairPremium"), 1, 6, 1.)); - - return dc; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strCurrency = "EUR"; - - JulianDate dtToday = org.drip.analytics.date.DateUtil.Today().addTenor ("0D"); - - MergedDiscountForwardCurve dcIndex = CustomOISCurveBuilderSample ( - dtToday, - "---- DISCOUNT CURVE WITH OVERNIGHT INDEX ---", - strCurrency, - true - ); - - MergedDiscountForwardCurve dcFund = CustomOISCurveBuilderSample ( - dtToday, - "---- DISCOUNT CURVE WITH OVERNIGHT FUND ---", - strCurrency, - false - ); - - JulianDate dtCustomOISStart = dtToday.subtractTenor ("2M"); - - UnitCouponAccrualSetting ucasCustomFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - true, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusCustomFloating = new ComposableFloatingUnitSetting ( - "ON", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_OVERNIGHT, - null, - OvernightLabel.Create ( - strCurrency - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusCustomFixed = new ComposableFixedUnitSetting ( - "6M", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - 0.003, - 0., - strCurrency - ); - - CompositePeriodSetting cpsCustomFloating = new CompositePeriodSetting ( - 4, - "3M", - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsCustomFixed = new CompositePeriodSetting ( - 2, - "6M", - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - List lsCustomFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtCustomOISStart, - "6M", - "4M", - null - ); - - List lsCustomFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtCustomOISStart, - "3M", - "4M", - null - ); - - Stream customFloatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsCustomFloatingStreamEdgeDate, - cpsCustomFloating, - cfusCustomFloating - ) - ); - - Stream customFixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsCustomFixedStreamEdgeDate, - cpsCustomFixed, - ucasCustomFixed, - cfusCustomFixed - ) - ); - - FixFloatComponent ois = new FixFloatComponent ( - customFixedStream, - customFloatingStream, - new CashSettleParams ( - 0, - strCurrency, - 0 - ) - ); - - CurveSurfaceQuoteContainer mktParamsIndex = MarketParamsBuilder.Create ( - dcIndex, - null, - null, - null, - null, - null, - null - ); - - CurveSurfaceQuoteContainer mktParamsFund = MarketParamsBuilder.Create ( - dcFund, - null, - null, - null, - null, - null, - null - ); - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t----------------------------------------------------------------\n"); - - Map mapOISOutputIndex = ois.value ( - new ValuationParams ( - dtToday, - dtToday, - strCurrency - ), - null, - mktParamsIndex, - null - ); - - Map mapOISOutputFund = ois.value ( - new ValuationParams ( - dtToday, - dtToday, - strCurrency - ), - null, - mktParamsFund, - null - ); - - for (Map.Entry me : mapOISOutputIndex.entrySet()) { - String strKey = me.getKey(); - - double dblIndexMeasure = me.getValue(); - - double dblFundMeasure = mapOISOutputFund.get (strKey); - - String strReconcile = NumberUtil.WithinTolerance ( - dblIndexMeasure, - dblFundMeasure, - 1.e-08, - 1.e-04) ? - "RECONCILES" : - "DOES NOT RECONCILE"; - - System.out.println ("\t" + - FormatUtil.FormatDouble (dblIndexMeasure, 1, 8, 1.) + " | " + - FormatUtil.FormatDouble (dblFundMeasure, 1, 8, 1.) + " | " + - strReconcile + " <= " + strKey - ); - } - } -} diff --git a/org/drip/sample/ois/JurisdictionOTCInstrumentDefinitions.java b/org/drip/sample/ois/JurisdictionOTCInstrumentDefinitions.java deleted file mode 100644 index 9ab4ab3..0000000 --- a/org/drip/sample/ois/JurisdictionOTCInstrumentDefinitions.java +++ /dev/null @@ -1,98 +0,0 @@ - -package org.drip.sample.ois; - -import org.drip.market.otc.OvernightFixedFloatContainer; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * JurisdictionOTCInstrumentDefinitions contains all the pre-fixed definitions of the Jurisdiction OTC OIS - * Instrument Contracts. - * - * @author Lakshmi Krishnamurthy - */ - -public class JurisdictionOTCInstrumentDefinitions { - private static final void DisplayOvernightOTCInfo ( - String strCurrency) - { - System.out.println ( - "\t" + strCurrency + " => " + - OvernightFixedFloatContainer.FundConventionFromJurisdiction ( - strCurrency - ) - ); - } - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - System.out.println ("\n\t--------------------------------------------------------------------------------------------------------\n"); - - DisplayOvernightOTCInfo ("AUD"); - - DisplayOvernightOTCInfo ("CAD"); - - DisplayOvernightOTCInfo ("GBP"); - - DisplayOvernightOTCInfo ("EUR"); - - DisplayOvernightOTCInfo ("INR"); - - DisplayOvernightOTCInfo ("JPY"); - - DisplayOvernightOTCInfo ("SGD"); - - DisplayOvernightOTCInfo ("USD"); - - System.out.println ("\n\t--------------------------------------------------------------------------------------------------------\n"); - } -} diff --git a/org/drip/sample/ois/JurisdictionOTCInstrumentMeasures.java b/org/drip/sample/ois/JurisdictionOTCInstrumentMeasures.java deleted file mode 100644 index bdfa662..0000000 --- a/org/drip/sample/ois/JurisdictionOTCInstrumentMeasures.java +++ /dev/null @@ -1,553 +0,0 @@ - -package org.drip.sample.ois; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.identifier.OvernightLabel; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * JurisdictionOTCInstrumentMeasures contains the Curve Construction and Valuation Functionality of the OTC - * OIS Instruments across Multiple Jurisdictions. - * - * @author Lakshmi Krishnamurthy - */ - -public class JurisdictionOTCInstrumentMeasures { - - private static final FixFloatComponent OTCOISFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = OvernightFixedFloatContainer.FundConventionFromJurisdiction ( - strCurrency - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - for (int i = 0; i < aiDay.length; ++i) - aDeposit[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - OvernightLabel.Create ( - strCurrency - ) - ); - - return aDeposit; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OISFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aOIS[i] = OTCOISFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aOIS; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OISFuturesFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrStartTenor, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOISFutures = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aOISFutures[i] = OTCOISFixFloat ( - dtSpot.addTenor (astrStartTenor[i]), - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aOISFutures; - } - - private static final void OTCOISRun ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrOTCMaturityTenor, - final boolean bCalibMetricDisplay) - throws Exception - { - if (bCalibMetricDisplay) { - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t--------- DISCOUNT CURVE WITH OVERNIGHT INDEX ------------------"); - - System.out.println ("\t----------------------------------------------------------------"); - } - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 3 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0004, 0.0004, 0.0004 // Deposit - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - " DEPOSIT ", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of Short End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - CalibratableComponent[] aShortEndOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "1W", "2W", "3W", "1M" - }, - adblShortEndOISQuote - ); - - /* - * Construct the Short End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisShortEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SHORT END OIS", - aShortEndOISComp, - "SwapRate", - adblShortEndOISQuote - ); - - /* - * Construct the Array of OIS Futures Instruments and their Quotes from the given set of parameters - */ - - double[] adblOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - CalibratableComponent[] aOISFutureComp = OISFuturesFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "1M", "2M", "3M", "4M", "5M" - }, - new java.lang.String[] { - "1M", "1M", "1M", "1M", "1M" - }, - adblOISFutureQuote - ); - - /* - * Construct the OIS Future Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisFutureStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - " OIS FUTURE ", - aOISFutureComp, - "SwapRate", - adblOISFutureQuote - ); - - /* - * Construct the Array of Long End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - CalibratableComponent[] aLongEndOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "15M", "18M", "21M", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - adblLongEndOISQuote - ); - - /* - * Construct the Long End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisLongEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "LONG END OIS ", - aLongEndOISComp, - "SwapRate", - adblLongEndOISQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - oisShortEndStretch, - oisFutureStretch, - oisLongEndStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit and Swap Stretches. - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - if (bCalibMetricDisplay) { - - /* - * Cross-Comparison of the Deposit Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t[" + aDepositComp[i].effectiveDate() + " => " + aDepositComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aDepositComp[i].measureValue (valParams, null, mktParams, null, "Rate"), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the Short End OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS SHORT END INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aShortEndOISComp.length; ++i) { - Map mapShortEndOISComp = aShortEndOISComp[i].value (valParams, null, mktParams, null); - - System.out.println ("\t[" + aShortEndOISComp[i].effectiveDate() + " => " + aShortEndOISComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (mapShortEndOISComp.get ("CalibSwapRate"), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblShortEndOISQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (mapShortEndOISComp.get ("FairPremium"), 1, 6, 1.) - ); - } - - /* - * Cross-Comparison of the OIS Future Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS FUTURE INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aOISFutureComp.length; ++i) { - Map mapOISFutureComp = aOISFutureComp[i].value (valParams, null, mktParams, null); - - System.out.println ("\t[" + aOISFutureComp[i].effectiveDate() + " => " + aOISFutureComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (mapOISFutureComp.get ("SwapRate"), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblOISFutureQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (mapOISFutureComp.get ("FairPremium"), 1, 6, 1.) - ); - } - - /* - * Cross-Comparison of the Long End OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS LONG END INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aLongEndOISComp.length; ++i) { - Map mapLongEndOISComp = aLongEndOISComp[i].value (valParams, null, mktParams, null); - - System.out.println ("\t[" + aLongEndOISComp[i].effectiveDate() + " => " + aLongEndOISComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (mapLongEndOISComp.get ("CalibSwapRate"), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblLongEndOISQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (mapLongEndOISComp.get ("FairPremium"), 1, 6, 1.) - ); - } - - System.out.println ("\t----------------------------------------------------------------"); - } - - System.out.print ("\t[" + strCurrency + "] = "); - - for (int i = 0; i < astrOTCMaturityTenor.length; ++i) { - FixFloatComponent swap = OTCOISFixFloat ( - dtSpot, - strCurrency, - astrOTCMaturityTenor[i], - 0. - ); - - Map mapOutput = swap.value ( - valParams, - null, - mktParams, - null - ); - - System.out.print ( - FormatUtil.FormatDouble (mapOutput.get ("SwapRate"), 1, 4, 100.) + "% (" + - FormatUtil.FormatDouble (mapOutput.get ("FairPremium"), 1, 4, 100.) + "%) || " - ); - } - - System.out.println(); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = org.drip.analytics.date.DateUtil.Today(); - - String[] astrOTCMaturityTenor = new String[] { - "1Y", "3Y", "5Y", "7Y", "10Y" - }; - - OTCOISRun (dtToday, "AUD", astrOTCMaturityTenor, true); - - System.out.println ("\n\t--------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t JURISDICTION 1Y || 3Y || 5Y || 7Y || 10Y ||"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------"); - - OTCOISRun (dtToday, "AUD", astrOTCMaturityTenor, false); - - OTCOISRun (dtToday, "CAD", astrOTCMaturityTenor, false); - - OTCOISRun (dtToday, "EUR", astrOTCMaturityTenor, false); - - OTCOISRun (dtToday, "GBP", astrOTCMaturityTenor, false); - - OTCOISRun (dtToday, "INR", astrOTCMaturityTenor, false); - - OTCOISRun (dtToday, "JPY", astrOTCMaturityTenor, false); - - OTCOISRun (dtToday, "SGD", astrOTCMaturityTenor, false); - - OTCOISRun (dtToday, "USD", astrOTCMaturityTenor, false); - } -} diff --git a/org/drip/sample/ois/OvernightArithmeticCompoundingConvexity.java b/org/drip/sample/ois/OvernightArithmeticCompoundingConvexity.java deleted file mode 100644 index be22f6e..0000000 --- a/org/drip/sample/ois/OvernightArithmeticCompoundingConvexity.java +++ /dev/null @@ -1,610 +0,0 @@ - -package org.drip.sample.ois; - -import java.util.*; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.*; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.*; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * OvernightArithmeticCompoundingConvexity contains an assessment of the impact of the Overnight Index - * Volatility, the Funding Numeraire Volatility, and the ON Index/Funding Correlation on the Overnight - * Floating Stream. - * - * @author Lakshmi Krishnamurthy - */ - -public class OvernightArithmeticCompoundingConvexity { - - private static final FixFloatComponent OTCOISFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = OvernightFixedFloatContainer.FundConventionFromJurisdiction ( - strCurrency - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - for (int i = 0; i < aiDay.length; ++i) - aDeposit[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - OvernightLabel.Create ( - strCurrency - ) - ); - - return aDeposit; - } - - private static final FixFloatComponent[] OISFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aOIS[i] = OTCOISFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aOIS; - } - - private static final FixFloatComponent[] OISFuturesFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrStartTenor, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOISFutures = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aOISFutures[i] = OTCOISFixFloat ( - dtSpot.addTenor (astrStartTenor[i]), - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aOISFutures; - } - - private static final MergedDiscountForwardCurve CustomOISCurveBuilderSample ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 3 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0004, 0.0004, 0.0004 // Deposit - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - " DEPOSIT ", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of Short End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - CalibratableComponent[] aShortEndOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "1W", "2W", "3W", "1M" - }, - adblShortEndOISQuote - ); - - /* - * Construct the Short End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisShortEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SHORT END OIS", - aShortEndOISComp, - "SwapRate", - adblShortEndOISQuote - ); - - /* - * Construct the Array of OIS Futures Instruments and their Quotes from the given set of parameters - */ - - double[] adblOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - CalibratableComponent[] aOISFutureComp = OISFuturesFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "1M", "2M", "3M", "4M", "5M" - }, - new java.lang.String[] { - "1M", "1M", "1M", "1M", "1M" - }, - adblOISFutureQuote - ); - - /* - * Construct the OIS Future Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisFutureStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - " OIS FUTURE ", - aOISFutureComp, - "SwapRate", - adblOISFutureQuote - ); - - /* - * Construct the Array of Long End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - CalibratableComponent[] aLongEndOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "15M", "18M", "21M", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - adblLongEndOISQuote - ); - - /* - * Construct the Long End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisLongEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "LONG END OIS ", - aLongEndOISComp, - "SwapRate", - adblLongEndOISQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - oisShortEndStretch, - oisFutureStretch, - oisLongEndStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - */ - - return ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - null, - null, - null, - 1. - ); - } - - private static final LatentStateFixingsContainer SetFlatOvernightFixings ( - final JulianDate dtStart, - final JulianDate dtEnd, - final JulianDate dtValue, - final ForwardLabel fri, - final double dblFlatFixing, - final double dblNotional) - throws Exception - { - LatentStateFixingsContainer lsfc = new LatentStateFixingsContainer(); - - JulianDate dt = dtStart.addDays (1); - - while (dt.julian() <= dtEnd.julian()) { - lsfc.add ( - dt, - fri, - dblFlatFixing - ); - - dt = dt.addBusDays (1, "USD"); - } - - return lsfc; - } - - private static final void SetMarketParams ( - final int iValueDate, - final CurveSurfaceQuoteContainer mktParams, - final String strCurrency, - final ForwardLabel fri, - final double dblOISVol, - final double dblUSDFundingVol, - final double dblUSDFundingUSDOISCorrelation) - throws Exception - { - FundingLabel fundingLabel = FundingLabel.Standard (strCurrency); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (fri), - fri.currency(), - dblOISVol - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - iValueDate, - VolatilityLabel.Standard (fundingLabel), - "USD", - dblUSDFundingVol - ) - ); - - - mktParams.setForwardFundingCorrelation ( - fri, - fundingLabel, - new FlatUnivariate (dblUSDFundingUSDOISCorrelation) - ); - } - - private static final void VolCorrScenario ( - final Stream[] aFloatStream, - final String strCurrency, - final ForwardLabel fri, - final ValuationParams valParams, - final CurveSurfaceQuoteContainer mktParams, - final double dblOISVol, - final double dblUSDFundingVol, - final double dblUSDFundingUSDOISCorrelation) - throws Exception - { - SetMarketParams ( - valParams.valueDate(), - mktParams, - strCurrency, - fri, - dblOISVol, - dblUSDFundingVol, - dblUSDFundingUSDOISCorrelation - ); - - String strDump = "\t[" + - FormatUtil.FormatDouble (dblOISVol, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblUSDFundingVol, 2, 0, 100.) + "%," + - FormatUtil.FormatDouble (dblUSDFundingUSDOISCorrelation, 2, 0, 100.) + "%] = "; - - for (int i = 0; i < aFloatStream.length; ++i) { - Map mapValue = aFloatStream[i].value ( - valParams, - null, - mktParams, - null - ); - - if (0 != i) strDump += " || "; - - strDump += - FormatUtil.FormatDouble (mapValue.get ("UnadjustedFairPremium"), 1, 4, 100.) + "% | " + - FormatUtil.FormatDouble (mapValue.get ("CompoundingAdjustmentFactor") - 1, 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (mapValue.get ("CumulativeConvexityAdjustmentFactor") - 1, 1, 2, 100.) + "%"; - } - - System.out.println (strDump); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - String strCurrency = "USD"; - - MergedDiscountForwardCurve dc = CustomOISCurveBuilderSample ( - dtToday, - strCurrency - ); - - JulianDate dtCustomOISStart = dtToday.subtractTenor ("2M"); - - JulianDate dtCustomOISMaturity = dtToday.addTenor ("4M"); - - ForwardLabel fri = OvernightLabel.Create (strCurrency); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "ON", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_OVERNIGHT, - null, - OvernightLabel.Create ( - strCurrency - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 360, - "ON", - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtCustomOISStart, - "6M", - "6M", - null - ); - - List lsCP = CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ); - - Stream floatStream = new Stream (lsCP); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - SetFlatOvernightFixings ( - dtCustomOISStart, - dtCustomOISMaturity, - dtToday, - fri, - 0.003, - -1. - ) - ); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - strCurrency - ); - - double[] adblOISVol = new double [] { - 0.1, 0.3, 0.5 - }; - double[] adblUSDFundingVol = new double [] { - 0.1, 0.3, 0.5 - }; - double[] adblUSDFundingUSDOISCorrelation = new double [] { - -0.3, 0.0, 0.3 - }; - - System.out.println ("\n\t-------------------------------------------------------------------------------------"); - - System.out.println ("\tInput Order (LHS) L->R:"); - - System.out.println ("\t\tOIS Volatility, Funding Volatility, OIS/Funding Correlation\n"); - - System.out.println ("\tOutput Order (RHS) L->R:"); - - System.out.println ("\t\tUnadjusted Fair Premium, Compounding Adjustment Factor (% - Relative), Convexity Adjustment Factor (% - Relative)\n"); - - System.out.println ("\t-------------------------------------------------------------------------------------"); - - for (double dblOISVol : adblOISVol) { - for (double dblUSDFundingVol : adblUSDFundingVol) { - for (double dblUSDFundingUSDOISCorrelation : adblUSDFundingUSDOISCorrelation) - VolCorrScenario ( - new Stream[] {floatStream}, - strCurrency, - fri, - valParams, - mktParams, - dblOISVol, - dblUSDFundingVol, - dblUSDFundingUSDOISCorrelation - ); - } - } - - System.out.println ("\t-------------------------------------------------------------------------------------"); - } -} diff --git a/org/drip/sample/ois/OvernightJurisdictionIndexDefinition.java b/org/drip/sample/ois/OvernightJurisdictionIndexDefinition.java deleted file mode 100644 index c260d17..0000000 --- a/org/drip/sample/ois/OvernightJurisdictionIndexDefinition.java +++ /dev/null @@ -1,134 +0,0 @@ - -package org.drip.sample.ois; - -import org.drip.analytics.support.CompositePeriodBuilder; -import org.drip.market.definition.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * OvernightJurisdictionIndexDefinition demonstrates the functionality to retrieve the Overnight Index - * Settings across the various Jurisdictions. - * - * @author Lakshmi Krishnamurthy - */ - -public class OvernightJurisdictionIndexDefinition { - private static final String AccrualType ( - final int iAccrualCompounding) - { - return CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_ARITHMETIC == iAccrualCompounding ? "ARITHMETIC" : " GEOMETRIC"; - } - - private static final void DisplayJurisdictionOvernightSetting ( - final String strJurisdiction) - { - OvernightIndex index = OvernightIndexContainer.IndexFromJurisdiction (strJurisdiction); - - System.out.println ("\t[" + - index.currency() + "] => " + - index.dayCount() + " | " + - AccrualType (index.accrualCompoundingRule()) + " | " + - index.referenceLag() + " | " + - index.publicationLag() + " | " + - index.name() - ); - } - - public static final void main ( - String[] args) - { - EnvManager.InitEnv (""); - - System.out.println ("\n\t---------------\n\t---------------\n"); - - DisplayJurisdictionOvernightSetting ("CHF"); - - DisplayJurisdictionOvernightSetting ("EUR"); - - DisplayJurisdictionOvernightSetting ("GBP"); - - DisplayJurisdictionOvernightSetting ("JPY"); - - DisplayJurisdictionOvernightSetting ("USD"); - - System.out.println ("\n\t---------------\n\t---------------\n"); - - DisplayJurisdictionOvernightSetting ("AUD"); - - DisplayJurisdictionOvernightSetting ("BRL"); - - DisplayJurisdictionOvernightSetting ("CAD"); - - DisplayJurisdictionOvernightSetting ("CZK"); - - DisplayJurisdictionOvernightSetting ("DKK"); - - DisplayJurisdictionOvernightSetting ("HKD"); - - DisplayJurisdictionOvernightSetting ("HUF"); - - DisplayJurisdictionOvernightSetting ("INR"); - - DisplayJurisdictionOvernightSetting ("NZD"); - - DisplayJurisdictionOvernightSetting ("PLN"); - - DisplayJurisdictionOvernightSetting ("SEK"); - - DisplayJurisdictionOvernightSetting ("SGD"); - - DisplayJurisdictionOvernightSetting ("ZAR"); - - DisplayJurisdictionOvernightSetting ("INR2"); - - DisplayJurisdictionOvernightSetting ("ZAR2"); - } -} diff --git a/org/drip/sample/oisapi/CustomSwapMeasures.java b/org/drip/sample/oisapi/CustomSwapMeasures.java deleted file mode 100644 index 6f5195f..0000000 --- a/org/drip/sample/oisapi/CustomSwapMeasures.java +++ /dev/null @@ -1,136 +0,0 @@ - -package org.drip.sample.oisapi; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.service.product.OvernightIndexSwapAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CustomSwapMeasures demonstrates the Invocation and Usage of the OIS API. - * - * @author Lakshmi Krishnamurthy - */ - -public class CustomSwapMeasures { - - public static void main ( - final String[] astrArgs) - throws Exception - { - JulianDate dtSpot = DateUtil.Today(); - - String strOISCurrency = "USD"; - String strOISTenor = "3W"; - double dblOISCoupon = 0.0043; - - String[] astrOvernightCurveDepositTenor = new String[] { - "1D" - }; - - double[] adblOvernightCurveDepositQuote = new double[] { - 0.0010 - }; - - String[] astrOvernightCurveOISTenor = new String[] { - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "9M", - "1Y", - "18M", - "2Y", - "3Y", - "4Y", - "5Y" - }; - - double[] adblOvernightCurveOISQuote = new double[] { - 0.0020, // 1W - 0.0028, // 2W - 0.0043, // 3W - 0.0064, // 1M - 0.0086, // 2M - 0.0109, // 3M - 0.0133, // 4M - 0.0154, // 5M - 0.0171, // 6M - 0.0210, // 9M - 0.0231, // 1Y - 0.0234, // 18M - 0.0235, // 2Y - 0.0235, // 3Y - 0.0237, // 4Y - 0.0240 // 5Y - }; - - Map mapMeasures = OvernightIndexSwapAPI.ValuationMetrics ( - strOISCurrency, - strOISTenor, - dblOISCoupon, - dtSpot.julian(), - astrOvernightCurveDepositTenor, - adblOvernightCurveDepositQuote, - astrOvernightCurveOISTenor, - adblOvernightCurveOISQuote, - false - ); - - Set setstrKeys = mapMeasures.keySet(); - - for (String strKey : setstrKeys) - System.out.println ("\t" + strKey + " => " + mapMeasures.get (strKey)); - } -} diff --git a/org/drip/sample/optimizer/KKTNecessarySufficientConditions.java b/org/drip/sample/optimizer/KKTNecessarySufficientConditions.java deleted file mode 100644 index 351cf44..0000000 --- a/org/drip/sample/optimizer/KKTNecessarySufficientConditions.java +++ /dev/null @@ -1,387 +0,0 @@ - -package org.drip.sample.optimizer; - -import org.drip.function.definition.RdToR1; -import org.drip.function.rdtor1solver.*; -import org.drip.optimization.constrained.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * KKTNecessarySufficientConditions carries out the Zero and the First Order Necessary and the Second Order - * Sufficiency Checks for a Constrained KKT Optimization Problem. The References are: - * - * - Boyd, S., and L. van den Berghe (2009): Convex Optimization, Cambridge University Press, Cambridge UK. - * - * - Eustaquio, R., E. Karas, and A. Ribeiro (2008): Constraint Qualification for Nonlinear Programming, - * Technical Report, Federal University of Parana. - * - * - Karush, A. (1939): Minima of Functions of Several Variables with Inequalities as Side Constraints, - * M. Sc., University of Chicago, Chicago IL. - * - * - Kuhn, H. W., and A. W. Tucker (1951): Nonlinear Programming, Proceedings of the Second Berkeley - * Symposium, University of California, Berkeley CA 481-492. - * - * - Ruszczynski, A. (2006): Nonlinear Optimization, Princeton University Press, Princeton NJ. - * - * @author Lakshmi Krishnamurthy - */ - -public class KKTNecessarySufficientConditions { - - private static final RdToR1 Objective ( - final double dblX0, - final double dblX1, - final double dblX2) - throws Exception - { - return new RdToR1 (null) { - @Override public int dimension() - { - return 3; - } - - @Override public double evaluate ( - final double[] adblVariate) - throws Exception - { - return (adblVariate[0] - dblX0) * (adblVariate[0] - dblX0) + - (adblVariate[1] - dblX1) * (adblVariate[1] - dblX1) + - (adblVariate[2] - dblX2) * (adblVariate[2] - dblX2); - } - - @Override public double[] jacobian ( - final double[] adblVariate) - { - return new double[] { - 2. * (dblX0 - adblVariate[0]), - 2. * (dblX1 - adblVariate[1]), - 2. * (dblX2 - adblVariate[2]) - }; - } - - @Override public double[][] hessian ( - final double[] adblVariate) - { - return new double[][] { - {2., 0., 0.}, - {0., 2., 0.}, - {0., 0., 2.} - }; - } - }; - } - - private static final RdToR1 RightConstraint ( - final double dblDeadCenter, - final int iDimension, - final double dblHalfWidth, - final boolean bSignFlip) - throws Exception - { - return new RdToR1 (null) { - @Override public int dimension() - { - return 3; - } - - @Override public double evaluate ( - final double[] adblVariate) - throws Exception - { - return (bSignFlip ? -1. : 1.) * (dblDeadCenter + dblHalfWidth - adblVariate[iDimension]); - } - - @Override public double[] jacobian ( - final double[] adblVariate) - { - return new double[] { - iDimension == 0 ? (bSignFlip ? -1. : 1.) * -1. : 0., - iDimension == 1 ? (bSignFlip ? -1. : 1.) * -1. : 0., - iDimension == 2 ? (bSignFlip ? -1. : 1.) * -1. : 0. - }; - } - - @Override public double[][] hessian ( - final double[] adblVariate) - { - return new double[][] { - {0., 0., 0.}, - {0., 0., 0.}, - {0., 0., 0.} - }; - } - }; - } - - private static final RdToR1 LeftConstraint ( - final double dblDeadCenter, - final int iDimension, - final double dblHalfWidth, - final boolean bSignFlip) - throws Exception - { - return new RdToR1 (null) { - @Override public int dimension() - { - return 3; - } - - @Override public double evaluate ( - final double[] adblVariate) - throws Exception - { - return (bSignFlip ? -1. : 1.) * (adblVariate[iDimension] - dblDeadCenter + dblHalfWidth); - } - - @Override public double[] jacobian ( - final double[] adblVariate) - { - return new double[] { - iDimension == 0 ? (bSignFlip ? -1. : 1.) * 1. : 0., - iDimension == 1 ? (bSignFlip ? -1. : 1.) * 1. : 0., - iDimension == 2 ? (bSignFlip ? -1. : 1.) * 1. : 0. - }; - } - - @Override public double[][] hessian ( - final double[] adblVariate) - { - return new double[][] { - {0., 0., 0.}, - {0., 0., 0.}, - {0., 0., 0.} - }; - } - }; - } - - private static final RdToR1[] ConstraintSet ( - final double dblX0, - final double dblX1, - final double dblX2, - final double dblHalfWidth, - final boolean bSignFlip) - throws Exception - { - return new RdToR1[] { - LeftConstraint ( - dblX0, - 0, - dblHalfWidth, - bSignFlip - ), - RightConstraint ( - dblX0, - 0, - dblHalfWidth, - bSignFlip - ), - LeftConstraint ( - dblX1, - 1, - dblHalfWidth, - bSignFlip - ), - RightConstraint ( - dblX1, - 1, - dblHalfWidth, - bSignFlip - ), - LeftConstraint ( - dblX2, - 2, - dblHalfWidth, - bSignFlip - ), - RightConstraint ( - dblX2, - 2, - dblHalfWidth, - bSignFlip - ) - }; - } - public static final void main ( - final String[] asrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblX0 = 1.; - double dblX1 = 2.; - double dblX2 = 3.; - double dblHalfWidth = 1.; - - RdToR1 objectiveRdToR1 = Objective ( - dblX0, - dblX1, - dblX2 - ); - - RdToR1[] aConstraintRdToR1 = ConstraintSet ( - dblX0, - dblX1, - dblX2, - dblHalfWidth, - false - ); - - BarrierFixedPointFinder bfpf = new BarrierFixedPointFinder ( - objectiveRdToR1, - aConstraintRdToR1, - new InteriorPointBarrierControl ( - InteriorPointBarrierControl.VARIATE_CONSTRAINT_SEQUENCE_CONVERGENCE, - 5.0e-06, - 1.0e-07, - 1.0e+10, - 0.5, - 20 - ), - null - ); - - double[] adblStartingVariate = new double[3]; - adblStartingVariate[0] = dblX0 + 0.25 * dblHalfWidth; - adblStartingVariate[1] = dblX1 + 0.25 * dblHalfWidth; - adblStartingVariate[2] = dblX2 + 0.25 * dblHalfWidth; - - VariateInequalityConstraintMultiplier vicm = bfpf.solve (adblStartingVariate); - - double[] adblVariate = new double[] { - dblX0, - dblX1, - dblX2 - }; - - FritzJohnMultipliers fjm = FritzJohnMultipliers.KarushKuhnTucker ( - null, - vicm.constraintMultipliers() - ); - - OptimizationFramework of = new OptimizationFramework ( - objectiveRdToR1, - null, - ConstraintSet ( - dblX0, - dblX1, - dblX2, - dblHalfWidth, - true - ) - ); - - NecessarySufficientConditions nsc = of.necessarySufficientQualifier ( - fjm, - adblVariate, - true - ); - - System.out.println(); - - System.out.println ("\t||---------------------------------------------------||"); - - System.out.println ("\t|| KKT NECESSARY & SUFFICIENT CONDITIONS CHECK ||"); - - System.out.println ("\t||---------------------------------------------------||"); - - System.out.println ("\t|| KKT Multiplier Compatibility : " + - of.isCompatible (fjm) + " ||" - ); - - System.out.println ("\t|| Dual Feasibility Check : " + - fjm.dualFeasibilityCheck() + " ||" - ); - - System.out.println ("\t|| Primal Feasibility Check : " + - of.primalFeasibilityCheck (adblVariate) + " ||" - ); - - System.out.println ("\t|| Complementary Slackness Check : " + - of.complementarySlacknessCheck ( - fjm, - adblVariate - ) + " ||" - ); - - System.out.println ("\t|| First Order Necessary Condition Check : " + - of.isFONC ( - fjm, - adblVariate - ) + " ||" - ); - - System.out.println ("\t|| Second Order Sufficiency Condition Check : " + - of.isSOSC ( - fjm, - adblVariate, - true - ) + " ||" - ); - - System.out.println ("\t||---------------------------------------------------||"); - - System.out.println(); - - System.out.println ("\t||------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| KKT NECESSARY & SUFFICIENT CONSTIONS - ZERO, FIRST, & SECOND ORDERS ||"); - - System.out.println ("\t||------------------------------------------------------------------------------------------------------||"); - - String[] astrNSC = nsc.conditionOrder(); - - for (int i = 0; i < astrNSC.length; ++i) - System.out.println ("\t|| " + astrNSC[i]); - - System.out.println ("\t||------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/optimizer/KKTRegularityConditions.java b/org/drip/sample/optimizer/KKTRegularityConditions.java deleted file mode 100644 index 4e8a15d..0000000 --- a/org/drip/sample/optimizer/KKTRegularityConditions.java +++ /dev/null @@ -1,385 +0,0 @@ - -package org.drip.sample.optimizer; - -import org.drip.function.definition.RdToR1; -import org.drip.function.rdtor1solver.*; -import org.drip.optimization.constrained.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * KKTRegularityConditions carries out the Regularity Checks satisfied by the Optimizing Variate for a - * Constrained KKT Optimization Problem. The References are: - * - * - Boyd, S., and L. van den Berghe (2009): Convex Optimization, Cambridge University Press, Cambridge UK. - * - * - Eustaquio, R., E. Karas, and A. Ribeiro (2008): Constraint Qualification for Nonlinear Programming, - * Technical Report, Federal University of Parana. - * - * - Karush, A. (1939): Minima of Functions of Several Variables with Inequalities as Side Constraints, - * M. Sc., University of Chicago, Chicago IL. - * - * - Kuhn, H. W., and A. W. Tucker (1951): Nonlinear Programming, Proceedings of the Second Berkeley - * Symposium, University of California, Berkeley CA 481-492. - * - * - Ruszczynski, A. (2006): Nonlinear Optimization, Princeton University Press, Princeton NJ. - * - * @author Lakshmi Krishnamurthy - */ - -public class KKTRegularityConditions { - - private static final RdToR1 Objective ( - final double dblX0, - final double dblX1, - final double dblX2) - throws Exception - { - return new RdToR1 (null) { - @Override public int dimension() - { - return 3; - } - - @Override public double evaluate ( - final double[] adblVariate) - throws Exception - { - return (adblVariate[0] - dblX0) * (adblVariate[0] - dblX0) + - (adblVariate[1] - dblX1) * (adblVariate[1] - dblX1) + - (adblVariate[2] - dblX2) * (adblVariate[2] - dblX2); - } - - @Override public double[] jacobian ( - final double[] adblVariate) - { - return new double[] { - 2. * (dblX0 - adblVariate[0]), - 2. * (dblX1 - adblVariate[1]), - 2. * (dblX2 - adblVariate[2]) - }; - } - - @Override public double[][] hessian ( - final double[] adblVariate) - { - return new double[][] { - {2., 0., 0.}, - {0., 2., 0.}, - {0., 0., 2.} - }; - } - }; - } - - private static final RdToR1 RightConstraint ( - final double dblDeadCenter, - final int iDimension, - final double dblHalfWidth, - final boolean bSignFlip) - throws Exception - { - return new RdToR1 (null) { - @Override public int dimension() - { - return 3; - } - - @Override public double evaluate ( - final double[] adblVariate) - throws Exception - { - return (bSignFlip ? -1. : 1.) * (dblDeadCenter + dblHalfWidth - adblVariate[iDimension]); - } - - @Override public double[] jacobian ( - final double[] adblVariate) - { - return new double[] { - iDimension == 0 ? (bSignFlip ? -1. : 1.) * -1. : 0., - iDimension == 1 ? (bSignFlip ? -1. : 1.) * -1. : 0., - iDimension == 2 ? (bSignFlip ? -1. : 1.) * -1. : 0. - }; - } - - @Override public double[][] hessian ( - final double[] adblVariate) - { - return new double[][] { - {0., 0., 0.}, - {0., 0., 0.}, - {0., 0., 0.} - }; - } - }; - } - - private static final RdToR1 LeftConstraint ( - final double dblDeadCenter, - final int iDimension, - final double dblHalfWidth, - final boolean bSignFlip) - throws Exception - { - return new RdToR1 (null) { - @Override public int dimension() - { - return 3; - } - - @Override public double evaluate ( - final double[] adblVariate) - throws Exception - { - return (bSignFlip ? -1. : 1.) * (adblVariate[iDimension] - dblDeadCenter + dblHalfWidth); - } - - @Override public double[] jacobian ( - final double[] adblVariate) - { - return new double[] { - iDimension == 0 ? (bSignFlip ? -1. : 1.) * 1. : 0., - iDimension == 1 ? (bSignFlip ? -1. : 1.) * 1. : 0., - iDimension == 2 ? (bSignFlip ? -1. : 1.) * 1. : 0. - }; - } - - @Override public double[][] hessian ( - final double[] adblVariate) - { - return new double[][] { - {0., 0., 0.}, - {0., 0., 0.}, - {0., 0., 0.} - }; - } - }; - } - - private static final RdToR1[] ConstraintSet ( - final double dblX0, - final double dblX1, - final double dblX2, - final double dblHalfWidth, - final boolean bSignFlip) - throws Exception - { - return new RdToR1[] { - LeftConstraint ( - dblX0, - 0, - dblHalfWidth, - bSignFlip - ), - RightConstraint ( - dblX0, - 0, - dblHalfWidth, - bSignFlip - ), - LeftConstraint ( - dblX1, - 1, - dblHalfWidth, - bSignFlip - ), - RightConstraint ( - dblX1, - 1, - dblHalfWidth, - bSignFlip - ), - LeftConstraint ( - dblX2, - 2, - dblHalfWidth, - bSignFlip - ), - RightConstraint ( - dblX2, - 2, - dblHalfWidth, - bSignFlip - ) - }; - } - public static final void main ( - final String[] asrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblX0 = 1.; - double dblX1 = 2.; - double dblX2 = 3.; - double dblHalfWidth = 1.; - - RdToR1 objectiveRdToR1 = Objective ( - dblX0, - dblX1, - dblX2 - ); - - RdToR1[] aConstraintRdToR1 = ConstraintSet ( - dblX0, - dblX1, - dblX2, - dblHalfWidth, - false - ); - - BarrierFixedPointFinder bfpf = new BarrierFixedPointFinder ( - objectiveRdToR1, - aConstraintRdToR1, - new InteriorPointBarrierControl ( - InteriorPointBarrierControl.VARIATE_CONSTRAINT_SEQUENCE_CONVERGENCE, - 5.0e-06, - 1.0e-07, - 1.0e+10, - 0.5, - 20 - ), - null - ); - - double[] adblStartingVariate = new double[3]; - adblStartingVariate[0] = dblX0 + 0.25 * dblHalfWidth; - adblStartingVariate[1] = dblX1 + 0.25 * dblHalfWidth; - adblStartingVariate[2] = dblX2 + 0.25 * dblHalfWidth; - - VariateInequalityConstraintMultiplier vicm = bfpf.solve (adblStartingVariate); - - double[] adblVariate = new double[] { - dblX0, - dblX1, - dblX2 - }; - - FritzJohnMultipliers fjm = FritzJohnMultipliers.KarushKuhnTucker ( - null, - vicm.constraintMultipliers() - ); - - OptimizationFramework of = new OptimizationFramework ( - objectiveRdToR1, - null, - ConstraintSet ( - dblX0, - dblX1, - dblX2, - dblHalfWidth, - true - ) - ); - - String[] astrSO = of.regularityQualifier ( - fjm, - adblVariate - ).strengthOrder(); - - System.out.println(); - - System.out.println ("\t||----------------------------------------------------------------------||"); - - System.out.println ("\t|| KKT REGULARITY CONDITIONS ||"); - - System.out.println ("\t||----------------------------------------------------------------------||"); - - System.out.println ("\t|| ACTIVE SET RANK : " + - of.activeConstraintRank (adblVariate) + " ||" - ); - - System.out.println ("\t|| LINEAR CONSTRAINT QUALIFICATION : " + - of.isLCQ() + " ||" - ); - - System.out.println ("\t|| LINEAR INDEPENDENT CONSTRAINT QUALIFICATION : " + - of.isLICQ (adblVariate) + " ||" - ); - - System.out.println ("\t|| MANGASARIAN FROMOVITZ CONSTRAINT QUALIFICATION : " + - of.isMFCQ (adblVariate) + " ||" - ); - - System.out.println ("\t|| CONSTANT RANK CONSTRAINT QUALIFICATION : " + - of.isCRCQ (adblVariate) + " ||" - ); - - System.out.println ("\t|| CONSTANT POSITIVE LINEAR DEPENDENCE CONSTRAINT QUALIFICATION : " + - of.isCPLDCQ (adblVariate) + " ||" - ); - - System.out.println ("\t|| QUASI NORMAL CONSTRAINT QUALIFICATION : " + - of.isQNCQ ( - fjm, - adblVariate - ) + " ||" - ); - - System.out.println ("\t|| SLATER'S CONDITION CONSTRAINT QUALIFICATION : " + - of.isSCCQ (adblVariate) + " ||" - ); - - System.out.println ("\t||----------------------------------------------------------------------||"); - - System.out.println(); - - System.out.println ("\t||----------------------------------------------------------------------||"); - - System.out.println ("\t|| KKT REGULARITY CONDITIONS ||"); - - System.out.println ("\t||----------------------------------------------------------------------||"); - - for (int i = 0; i < astrSO.length; ++i) - System.out.println ("\t|| " + astrSO[i]); - - System.out.println ("\t||----------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/optimizer/NSphereSurfaceExtremization.java b/org/drip/sample/optimizer/NSphereSurfaceExtremization.java deleted file mode 100644 index 914f22c..0000000 --- a/org/drip/sample/optimizer/NSphereSurfaceExtremization.java +++ /dev/null @@ -1,243 +0,0 @@ - -package org.drip.sample.optimizer; - -import org.drip.function.definition.RdToR1; -import org.drip.function.rdtor1.LagrangianMultivariate; -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NSphereSurfaceExtremization computes the Equality-Constrained Extrema of the Specified Function along the - * Surface of an N-Sphere using Lagrange Multipliers. - * - * @author Lakshmi Krishnamurthy - */ - -public class NSphereSurfaceExtremization { - - private static final void Solve ( - final NewtonFixedPointFinder nfpf, - final double[] adblVariateStarting) - throws Exception - { - System.out.println ("\n\t|------------------------------------||"); - - String strDump = "\t| STARTER: ["; - - strDump += FormatUtil.FormatDouble (adblVariateStarting[0], 1, 4, 1.) + ","; - - strDump += FormatUtil.FormatDouble (adblVariateStarting[1], 1, 4, 1.) + ","; - - strDump += FormatUtil.FormatDouble (adblVariateStarting[2], 1, 4, 1.); - - System.out.println (strDump + "] ||"); - - System.out.println ("\t|------------------------------------||"); - - VariateInequalityConstraintMultiplier vcmt = nfpf.convergeVariate ( - new VariateInequalityConstraintMultiplier ( - false, - adblVariateStarting, - null - ) - ); - - double[] adblVariate = vcmt.variates(); - - System.out.println ("\t| Optimal X : " + FormatUtil.FormatDouble (adblVariate[0], 1, 4, 1.) + " ||"); - - System.out.println ("\t| Optimal Y : " + FormatUtil.FormatDouble (adblVariate[1], 1, 4, 1.) + " ||"); - - System.out.println ("\t| Optimal Lambda : " + FormatUtil.FormatDouble (adblVariate[2], 1, 4, 1.) + " ||"); - - System.out.println ("\t|------------------------------------||"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - RdToR1 rdToR1VariateSumObjectiveFunction = new RdToR1 (null) { - @Override public double evaluate ( - final double[] adblVariate) - throws Exception - { - return adblVariate[0] * adblVariate[0] * adblVariate[1]; - } - - @Override public int dimension() - { - return 2; - } - - @Override public double[] jacobian ( - final double[] adblVariate) - { - double[] adblJacobian = new double[2]; - adblJacobian[0] = 2. * adblVariate[0] * adblVariate[1]; - adblJacobian[1] = adblVariate[0] * adblVariate[0]; - return adblJacobian; - } - - @Override public double[][] hessian ( - final double[] adblVariate) - { - double[][] aadblHessian = new double[2][2]; - aadblHessian[0][0] = 2. * adblVariate[1]; - aadblHessian[0][1] = 2. * adblVariate[0]; - aadblHessian[1][0] = 2. * adblVariate[0]; - aadblHessian[1][1] = 0.; - return aadblHessian; - } - }; - - RdToR1 rdToR1SphereSurfaceConstraintFunction = new RdToR1 (null) { - @Override public double evaluate ( - final double[] adblVariate) - throws Exception - { - return adblVariate[0] * adblVariate[0] + adblVariate[1] * adblVariate[1] - 3.; - } - - @Override public int dimension() - { - return 2; - } - - @Override public double[] jacobian ( - final double[] adblVariate) - { - double[] adblJacobian = new double[2]; - adblJacobian[0] = 2. * adblVariate[0]; - adblJacobian[1] = 2. * adblVariate[1]; - return adblJacobian; - } - - @Override public double[][] hessian ( - final double[] adblVariate) - { - double[][] aadblHessian = new double[2][2]; - aadblHessian[0][0] = 2.; - aadblHessian[0][1] = 0.; - aadblHessian[1][0] = 0.; - aadblHessian[1][1] = 2.; - return aadblHessian; - } - }; - - LagrangianMultivariate lm = new LagrangianMultivariate ( - rdToR1VariateSumObjectiveFunction, - new RdToR1[] {rdToR1SphereSurfaceConstraintFunction} - ); - - NewtonFixedPointFinder nfpf = new NewtonFixedPointFinder ( - lm, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false), - ConvergenceControl.Standard() - ); - - Solve ( - nfpf, - new double[] { - 2., - 1., - 1. - } - ); - - Solve ( - nfpf, - new double[] { - -2., - 1., - 1. - } - ); - - Solve ( - nfpf, - new double[] { - 2., - -1., - 1. - } - ); - - Solve ( - nfpf, - new double[] { - -2., - -1., - 1. - } - ); - - Solve ( - nfpf, - new double[] { - 0., - 1., - 0. - } - ); - - Solve ( - nfpf, - new double[] { - 0., - -1., - 0. - } - ); - } -} diff --git a/org/drip/sample/optimizer/VariateSumExtremization.java b/org/drip/sample/optimizer/VariateSumExtremization.java deleted file mode 100644 index 973b515..0000000 --- a/org/drip/sample/optimizer/VariateSumExtremization.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.sample.optimizer; - -import org.drip.function.definition.RdToR1; -import org.drip.function.rdtor1.LagrangianMultivariate; -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * VariateSumExtremization computes the Equality Constrained Extrema of the Sum of Variates along the Surface - * of the Sphere using Lagrange Multipliers. - * - * @author Lakshmi Krishnamurthy - */ - -public class VariateSumExtremization { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - RdToR1 rdToR1VariateSumObjectiveFunction = new RdToR1 (null) { - @Override public double evaluate ( - final double[] adblVariate) - throws Exception - { - return adblVariate[0] + adblVariate[1]; - } - - @Override public int dimension() - { - return 2; - } - - @Override public double[] jacobian ( - final double[] adblVariate) - { - double[] adblJacobian = new double[2]; - adblJacobian[0] = 1.; - adblJacobian[1] = 1.; - return adblJacobian; - } - - @Override public double[][] hessian ( - final double[] adblVariate) - { - double[][] aadblHessian = new double[2][2]; - aadblHessian[0][0] = 0.; - aadblHessian[0][1] = 0.; - aadblHessian[1][0] = 0.; - aadblHessian[1][1] = 0.; - return aadblHessian; - } - }; - - RdToR1 rdToR1SphereSurfaceConstraintFunction = new RdToR1 (null) { - @Override public double evaluate ( - final double[] adblVariate) - throws Exception - { - return adblVariate[0] * adblVariate[0] + adblVariate[1] * adblVariate[1] - 1.; - } - - @Override public int dimension() - { - return 2; - } - - @Override public double[] jacobian ( - final double[] adblVariate) - { - double[] adblJacobian = new double[2]; - adblJacobian[0] = 2. * adblVariate[0]; - adblJacobian[1] = 2. * adblVariate[1]; - return adblJacobian; - } - - @Override public double[][] hessian ( - final double[] adblVariate) - { - double[][] aadblHessian = new double[2][2]; - aadblHessian[0][0] = 2.; - aadblHessian[0][1] = 0.; - aadblHessian[1][0] = 0.; - aadblHessian[1][1] = 2.; - return aadblHessian; - } - }; - - LagrangianMultivariate lm = new LagrangianMultivariate ( - rdToR1VariateSumObjectiveFunction, - new RdToR1[] {rdToR1SphereSurfaceConstraintFunction} - ); - - NewtonFixedPointFinder nfpf = new NewtonFixedPointFinder ( - lm, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false), - ConvergenceControl.Standard() - ); - - VariateInequalityConstraintMultiplier vcmt = nfpf.convergeVariate ( - new VariateInequalityConstraintMultiplier ( - false, - new double[] { - 1., - 1., - 1. - }, - null - ) - ); - - double[] adblVariate = vcmt.variates(); - - System.out.println ("\tOptimal X : " + FormatUtil.FormatDouble (adblVariate[0], 1, 4, 1.)); - - System.out.println ("\tOptimal Y : " + FormatUtil.FormatDouble (adblVariate[1], 1, 4, 1.)); - - System.out.println ("\tOptimal Lambda : " + FormatUtil.FormatDouble (adblVariate[2], 1, 4, 1.)); - } -} diff --git a/org/drip/sample/option/ATMTermStructureSpline.java b/org/drip/sample/option/ATMTermStructureSpline.java deleted file mode 100644 index e2efcc9..0000000 --- a/org/drip/sample/option/ATMTermStructureSpline.java +++ /dev/null @@ -1,550 +0,0 @@ - -package org.drip.sample.option; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.analytics.definition.NodeStructure; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.market.otc.*; -import org.drip.param.valuation.*; -import org.drip.pricer.option.BlackScholesAlgorithm; -import org.drip.product.creator.*; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.option.EuropeanCallPut; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ATMTermStructureSpline contains an illustration of the Calibration and Extraction of the Deterministic ATM - * Price and Volatility Term Structures using Custom Splines. This does not deal with Local Volatility - * Surfaces. - * - * @author Lakshmi Krishnamurthy - */ - -public class ATMTermStructureSpline { - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFutures, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFutures]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFutures, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFutures; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - FixFloatComponent irs = OTCIRS ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate" - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate", // 30Y - "SwapRate", // 40Y - "SwapRate" // 50Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - true - ); - } - - private static final double ATMCall ( - final JulianDate dtMaturity, - final ValuationParams valParams, - final MergedDiscountForwardCurve dc, - final double dblVolatility, - final String strMeasure) - throws Exception - { - Map mapOptionCalc = new EuropeanCallPut (dtMaturity, 1.).value ( - valParams, - 1., - false, - dc, - new FlatUnivariate (dblVolatility), - new BlackScholesAlgorithm() - ); - - return mapOptionCalc.get (strMeasure); - } - - private static final void InputNodeReplicator ( - final NodeStructure ts, - final String[] astrMaturityTenor, - final double[] dblNodeInput) - throws Exception - { - System.out.println ("\n\t" + ts.label()); - - System.out.println ("\n\t|--------------------------|"); - - System.out.println ("\t| TNR => CALC | INPUT |"); - - System.out.println ("\t|--------------------------|"); - - for (int i = 0; i < astrMaturityTenor.length; ++i) - System.out.println ("\t| " + astrMaturityTenor[i] + " => " + - FormatUtil.FormatDouble (ts.node (astrMaturityTenor[i]), 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblNodeInput[i], 2, 2, 100.) + "% |"); - - System.out.println ("\t|--------------------------|"); - } - - private static final void OffGrid ( - final String strHeader, - final String[] astrLabel, - final NodeStructure[] aTS, - final String[] astrMaturityTenor) - throws Exception - { - System.out.println ("\n\n\t\t" + strHeader + "\n"); - - System.out.print ("\t| TNR =>"); - - for (int i = 0; i < aTS.length; ++i) - System.out.print (" " + astrLabel[i] + " | "); - - System.out.println ("\n"); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - System.out.print ("\t| " + astrMaturityTenor[i] + " =>"); - - for (int j = 0; j < aTS.length; ++j) - System.out.print (" " + FormatUtil.FormatDouble (aTS[j].node (astrMaturityTenor[i]), 2, 2, 100.) + "% | "); - - System.out.print ("\n"); - } - - System.out.println ("\n"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today(); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - "USD" - ); - - /* - * Construct the Discount Curve using its instruments and quotes - */ - - MergedDiscountForwardCurve dc = MakeDC ( - dtToday, - "USD" - ); - - String[] astrMaturityTenor = new String[] { - "06M", "01Y", "02Y", "03Y", "04Y", "05Y", "07Y", "10Y", "15Y", "20Y" - }; - double[] adblVolatility = new double[] { - 0.20, 0.23, 0.27, 0.30, 0.33, 0.35, 0.34, 0.29, 0.26, 0.19 - }; - double[] adblCallPrice = new double[adblVolatility.length]; - double[] adblImpliedCallVolatility = new double[adblVolatility.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - adblCallPrice[i] = ATMCall ( - dtToday.addTenor (astrMaturityTenor[i]), - valParams, - dc, - adblVolatility[i], - "CallPrice"); - - adblImpliedCallVolatility[i] = ATMCall ( - dtToday.addTenor (astrMaturityTenor[i]), - valParams, - dc, - adblVolatility[i], - "ImpliedCallVolatility"); - } - - NodeStructure tsCallPriceCubicPoly = ScenarioTermStructureBuilder.CubicPolynomialTermStructure ( - "CUBIC_POLY_CALLPRICE_TERMSTRUCTURE", - dtToday, - "USD", - astrMaturityTenor, - adblCallPrice - ); - - NodeStructure tsCallPriceQuarticPoly = ScenarioTermStructureBuilder.QuarticPolynomialTermStructure ( - "QUARTIC_POLY_CALLPRICE_TERMSTRUCTURE", - dtToday, - "USD", - astrMaturityTenor, - adblCallPrice - ); - - NodeStructure tsCallPriceKaklisPandelis = ScenarioTermStructureBuilder.KaklisPandelisTermStructure ( - "KAKLIS_PANDELIS_CALLPRICE_TERMSTRUCTURE", - dtToday, - "USD", - astrMaturityTenor, - adblCallPrice - ); - - NodeStructure tsCallPriceKLKHyperbolic = ScenarioTermStructureBuilder.KLKHyperbolicTermStructure ( - "KLK_HYPERBOLIC_CALLPRICE_TERMSTRUCTURE", - dtToday, - "USD", - astrMaturityTenor, - adblCallPrice, - 1. - ); - - NodeStructure tsCallPriceKLKRationalLinear = ScenarioTermStructureBuilder.KLKRationalLinearTermStructure ( - "KLK_RATIONAL_LINEAR_CALLPRICE_TERMSTRUCTURE", - dtToday, - "USD", - astrMaturityTenor, - adblCallPrice, - 1. - ); - - NodeStructure tsCallPriceKLKRationalQuadratic = ScenarioTermStructureBuilder.KLKRationalQuadraticTermStructure ( - "KLK_RATIONAL_QUADRATIC_CALLPRICE_TERMSTRUCTURE", - dtToday, - "USD", - astrMaturityTenor, - adblCallPrice, - 0.0001 - ); - - InputNodeReplicator ( - tsCallPriceCubicPoly, - astrMaturityTenor, - adblCallPrice - ); - - NodeStructure tsCallVolatilityCubicPoly = ScenarioTermStructureBuilder.CubicPolynomialTermStructure ( - "CUBIC_POLY_CALLVOL_TERMSTRUCTURE", - dtToday, - "USD", - astrMaturityTenor, - adblImpliedCallVolatility - ); - - NodeStructure tsCallVolatilityQuarticPoly = ScenarioTermStructureBuilder.QuarticPolynomialTermStructure ( - "QUARTIC_POLY_CALLVOL_TERMSTRUCTURE", - dtToday, - "USD", - astrMaturityTenor, - adblImpliedCallVolatility - ); - - NodeStructure tsCallVolatilityKaklisPandelis = ScenarioTermStructureBuilder.KaklisPandelisTermStructure ( - "KAKLIS_PANDELIS_CALLVOL_TERMSTRUCTURE", - dtToday, - "USD", - astrMaturityTenor, - adblImpliedCallVolatility - ); - - NodeStructure tsCallVolatilityKLKHyperbolic = ScenarioTermStructureBuilder.KLKHyperbolicTermStructure ( - "KLK_HYPERBOLIC_CALLVOL_TERMSTRUCTURE", - dtToday, - "USD", - astrMaturityTenor, - adblImpliedCallVolatility, - 1. - ); - - NodeStructure tsCallVolatilityKLKRationalLinear = ScenarioTermStructureBuilder.KLKRationalLinearTermStructure ( - "KLK_RATIONAL_LINEAR_CALLVOL_TERMSTRUCTURE", - dtToday, - "USD", - astrMaturityTenor, - adblImpliedCallVolatility, - 1. - ); - - NodeStructure tsCallVolatilityKLKRationalQuadratic = ScenarioTermStructureBuilder.KLKRationalQuadraticTermStructure ( - "KLK_RATIONAL_QUADRATIC_CALLVOL_TERMSTRUCTURE", - dtToday, - "USD", - astrMaturityTenor, - adblImpliedCallVolatility, - 0.0001 - ); - - InputNodeReplicator ( - tsCallVolatilityCubicPoly, - astrMaturityTenor, - adblImpliedCallVolatility - ); - - String[] astrOffGridTenor = new String[] { - "03M", "09M", "18M", "30Y", "42M", "54M", "06Y", "09Y", "12Y", "18Y", "25Y" - }; - - OffGrid ( - "ATM_CALLPRICE_TERM_STRUCTURE", - new String[] { - "Cubic Poly", "Quart Poly", "KaklisPand", "KLKHyperbl", "KLKRatlLin", "KLKRatlQua" - }, - new NodeStructure[] { - tsCallPriceCubicPoly, - tsCallPriceQuarticPoly, - tsCallPriceKaklisPandelis, - tsCallPriceKLKHyperbolic, - tsCallPriceKLKRationalLinear, - tsCallPriceKLKRationalQuadratic - }, - astrOffGridTenor - ); - - OffGrid ( - "ATM_CALLVOL_TERM_STRUCTURE", - new String[] { - "Cubic Poly", "Quart Poly", "KaklisPand", "KLKHyperbl", "KLKRatlLin", "KLKRatlQua" - }, - new NodeStructure[] { - tsCallVolatilityCubicPoly, - tsCallVolatilityQuarticPoly, - tsCallVolatilityKaklisPandelis, - tsCallVolatilityKLKHyperbolic, - tsCallVolatilityKLKRationalLinear, - tsCallVolatilityKLKRationalQuadratic - }, - astrOffGridTenor - ); - } -} diff --git a/org/drip/sample/option/BlackHestonForwardOption.java b/org/drip/sample/option/BlackHestonForwardOption.java deleted file mode 100644 index 6765670..0000000 --- a/org/drip/sample/option/BlackHestonForwardOption.java +++ /dev/null @@ -1,402 +0,0 @@ - -package org.drip.sample.option; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.market.otc.*; -import org.drip.param.pricer.HestonOptionPricerParams; -import org.drip.param.valuation.*; -import org.drip.pricer.option.*; -import org.drip.product.creator.*; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.option.EuropeanCallPut; -import org.drip.product.rates.*; -import org.drip.quant.fourier.PhaseAdjuster; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * BlackHestonForwardOption illustrates pricing a forward using the Black '76 variant and the Heston's - * stochastic Volatility Models. - * - * @author Lakshmi Krishnamurthy - */ - -public class BlackHestonForwardOption { - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFutures, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFutures]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFutures, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFutures; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - FixFloatComponent irs = OTCIRS ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate" - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate", // 30Y - "SwapRate", // 40Y - "SwapRate" // 50Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - true - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today(); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - "USD" - ); - - /* - * Construct the Discount Curve using its instruments and quotes - */ - - MergedDiscountForwardCurve dc = MakeDC ( - dtToday, - "USD" - ); - - JulianDate dtMaturity = dtToday.addTenor ("6M"); - - double dblStrike = 1.; - - EuropeanCallPut option = new EuropeanCallPut ( - dtMaturity, - dblStrike - ); - - double dblSpot = 1.; - - double dblRho = 0.3; - double dblKappa = 1.; - double dblSigma = 0.5; - double dblTheta = 0.2; - double dblLambda = 0.; - double dblSpotVolatility = 0.2; - - HestonOptionPricerParams fphp = new HestonOptionPricerParams ( - HestonStochasticVolatilityAlgorithm.PAYOFF_TRANSFORM_SCHEME_HESTON_1993, - dblRho, // Rho - dblKappa, // Kappa - dblSigma, // Sigma - dblTheta, // Theta - dblLambda, // Lambda - PhaseAdjuster.MULTI_VALUE_BRANCH_POWER_PHASE_TRACKER_KAHL_JACKEL // Indicates Apply Phase Tracking Adjustment for Log + Power - ); - - FokkerPlanckGenerator fpg = new HestonStochasticVolatilityAlgorithm ( - fphp // FP Heston Parameters - ); - - System.out.println ("---------------------------------------------------------"); - - System.out.println ("\t\t HESTON 1993 SPOT OPTION PRICING"); - - System.out.println ("---------------------------------------------------------"); - - System.out.println ( - option.value ( - valParams, - dblSpot, - false, - dc, - new FlatUnivariate (dblSpotVolatility), - fpg - ) - ); - - System.out.println ("---------------------------------------------------------"); - - System.out.println ("\t\t HESTON 1993 FORWARD OPTION PRICING"); - - System.out.println ("---------------------------------------------------------"); - - System.out.println ( - option.value ( - valParams, - dblSpot, - true, - dc, - new FlatUnivariate (dblSpotVolatility), - fpg - ) - ); - - System.out.println ("---------------------------------------------------------"); - - System.out.println ("\t\t BLACK SCHOLES SPOT OPTION PRICING"); - - System.out.println ("---------------------------------------------------------"); - - System.out.println ( - option.value ( - valParams, - dblSpot, - false, - dc, - new FlatUnivariate (dblSpotVolatility), - new BlackScholesAlgorithm() - ) - ); - - System.out.println ("---------------------------------------------------------"); - - System.out.println ("\t\t BLACK '76 FORWARD OPTION PRICING"); - - System.out.println ("---------------------------------------------------------"); - - System.out.println ( - option.value ( - valParams, - dblSpot, - true, - dc, - new FlatUnivariate (dblSpotVolatility), - new BlackScholesAlgorithm() - ) - ); - } -} diff --git a/org/drip/sample/option/BrokenDateVolSurface.java b/org/drip/sample/option/BrokenDateVolSurface.java deleted file mode 100644 index 70b2f44..0000000 --- a/org/drip/sample/option/BrokenDateVolSurface.java +++ /dev/null @@ -1,175 +0,0 @@ - -package org.drip.sample.option; - -import org.drip.analytics.date.*; -import org.drip.analytics.definition.MarketSurface; -import org.drip.quant.common.FormatUtil; -import org.drip.state.creator.ScenarioMarketSurfaceBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * BrokenDateVolSurface contains an illustration of the Construction and Usage of the Option Volatility - * Surface, and the Evaluation at the supplied Broken Dates. - * - * @author Lakshmi Krishnamurthy - */ - -public class BrokenDateVolSurface { - public static final void main ( - final String[] asrtArgs) - throws Exception - { - JulianDate dtStart = DateUtil.Today(); - - double[] adblStrikeATMFactor = new double[] { - 0.8, 0.9, 1.0, 1.1, 1.2 - }; - String[] astrMaturityTenor = new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y" - }; - - double[][] aadblImpliedVolatility = new double[][] { - {0.44, 0.38, 0.33, 0.27, 0.25}, - {0.41, 0.34, 0.30, 0.22, 0.27}, - {0.36, 0.31, 0.28, 0.30, 0.37}, - {0.38, 0.31, 0.34, 0.40, 0.47}, - {0.43, 0.46, 0.48, 0.52, 0.57} - }; - - MarketSurface volSurface = ScenarioMarketSurfaceBuilder.CubicPolynomialWireSurface ( - "SAMPLE_VOL_SURFACE", - dtStart, - "USD", - adblStrikeATMFactor, - astrMaturityTenor, - aadblImpliedVolatility - ); - - System.out.println ("\n\t|------------------------------------------------------------|"); - - System.out.println ("\t|----------------- INPUT SURFACE RECOVERY -----------------|"); - - System.out.print ("\t|------------------------------------------------------------|\n\t| ATM/TTE =>"); - - for (String strMaturity : astrMaturityTenor) - System.out.print (" " + strMaturity + " "); - - System.out.println (" |\n\t|------------------------------------------------------------|"); - - for (double dblStrike : adblStrikeATMFactor) { - System.out.print ("\t| " + FormatUtil.FormatDouble (dblStrike, 1, 2, 1.) + " =>"); - - for (String strMaturity : astrMaturityTenor) - System.out.print (" " + FormatUtil.FormatDouble (volSurface.node (dblStrike, strMaturity), 2, 2, 100.) + "%"); - - System.out.print (" |\n"); - } - - System.out.println ("\t|------------------------------------------------------------|"); - - adblStrikeATMFactor = new double[] { - 0.850, 0.925, 1.000, 1.075, 1.15 - }; - astrMaturityTenor = new String[] { - "18M", "27M", "36M", "45M", "54M" - }; - - System.out.println ("\n\t|------------------------------------------------------------|"); - - System.out.println ("\t|------------- INTERIM SURFACE RECALCULATION --------------|"); - - System.out.print ("\t|------------------------------------------------------------|\n\t| ATM/TTE =>"); - - for (String strMaturity : astrMaturityTenor) - System.out.print (" " + strMaturity + " "); - - System.out.println (" |\n\t|------------------------------------------------------------|"); - - for (double dblStrike : adblStrikeATMFactor) { - System.out.print ("\t| " + FormatUtil.FormatDouble (dblStrike, 1, 2, 1.) + " =>"); - - for (String strMaturity : astrMaturityTenor) - System.out.print (" " + FormatUtil.FormatDouble (volSurface.node (dblStrike, strMaturity), 2, 2, 100.) + "%"); - - System.out.print (" |\n"); - } - - System.out.println ("\t|------------------------------------------------------------|"); - - adblStrikeATMFactor = new double[] { - 0.700, 0.850, 1.000, 1.150, 1.300 - }; - astrMaturityTenor = new String[] { - "06M", "21M", "36M", "51M", "66M" - }; - - System.out.println ("\n\t|------------------------------------------------------------|"); - - System.out.println ("\t|------------- INTERIM SURFACE RECALCULATION --------------|"); - - System.out.print ("\t|------------------------------------------------------------|\n\t| ATM/TTE =>"); - - for (String strMaturity : astrMaturityTenor) - System.out.print (" " + strMaturity + " "); - - System.out.println (" |\n\t|------------------------------------------------------------|"); - - for (double dblStrike : adblStrikeATMFactor) { - System.out.print ("\t| " + FormatUtil.FormatDouble (dblStrike, 1, 2, 1.) + " =>"); - - for (String strMaturity : astrMaturityTenor) - System.out.print (" " + FormatUtil.FormatDouble (volSurface.node (dblStrike, strMaturity), 2, 2, 100.) + "%"); - - System.out.print (" |\n"); - } - - System.out.println ("\t|------------------------------------------------------------|"); - } -} diff --git a/org/drip/sample/option/CustomVolSurfaceBuilder.java b/org/drip/sample/option/CustomVolSurfaceBuilder.java deleted file mode 100644 index 1acb62d..0000000 --- a/org/drip/sample/option/CustomVolSurfaceBuilder.java +++ /dev/null @@ -1,342 +0,0 @@ - -package org.drip.sample.option; - -import org.drip.analytics.date.*; -import org.drip.analytics.definition.MarketSurface; -import org.drip.quant.common.FormatUtil; -import org.drip.spline.basis.*; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.ScenarioMarketSurfaceBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * CustomVolSurfaceBuilder contains an Comparison of the Construction of the Volatility Surface using - * different Splining Techniques. - * - * @author Lakshmi Krishnamurthy - */ - -public class CustomVolSurfaceBuilder { - private static final SegmentCustomBuilderControl CubicPolySCBC() - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ); - } - - private static final SegmentCustomBuilderControl QuarticPolySCBC() - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (5), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ); - } - - private static final SegmentCustomBuilderControl KaklisPandelisSCBC() - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KAKLIS_PANDELIS, - new KaklisPandelisSetParams (2), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ); - } - - private static final SegmentCustomBuilderControl KLKHyperbolicSCBC( - final double dblTension) - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new ExponentialTensionSetParams (dblTension), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ); - } - - private static final SegmentCustomBuilderControl KLKRationalLinearSCBC( - final double dblTension) - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_RATIONAL_LINEAR_TENSION, - new ExponentialTensionSetParams (dblTension), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ); - } - - private static final SegmentCustomBuilderControl KLKRationalQuadraticSCBC( - final double dblTension) - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_RATIONAL_QUADRATIC_TENSION, - new ExponentialTensionSetParams (dblTension), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ); - } - - private static final void EvaluateSplineSurface ( - final MarketSurface volSurface, - final double[] adblStrikeATMFactor, - final String[] astrMaturityTenor) - throws Exception - { - System.out.println ("\t|------------------------------------------------------------|"); - - System.out.print ("\t|------------------------------------------------------------|\n\t| ATM/TTE =>"); - - for (String strMaturity : astrMaturityTenor) - System.out.print (" " + strMaturity + " "); - - System.out.println (" |\n\t|------------------------------------------------------------|"); - - for (double dblStrike : adblStrikeATMFactor) { - System.out.print ("\t| " + FormatUtil.FormatDouble (dblStrike, 1, 2, 1.) + " =>"); - - for (String strMaturity : astrMaturityTenor) - System.out.print (" " + FormatUtil.FormatDouble (volSurface.node (dblStrike, strMaturity), 2, 2, 100.) + "%"); - - System.out.print (" |\n"); - } - - System.out.println ("\t|------------------------------------------------------------|"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - JulianDate dtStart = DateUtil.Today(); - - double[] adblStrikeATMFactorCalib = new double[] { - 0.8, 0.9, 1.0, 1.1, 1.2 - }; - String[] astrMaturityTenorCalib = new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y" - }; - - double[][] aadblImpliedVolatility = new double[][] { - {0.44, 0.38, 0.33, 0.27, 0.25}, - {0.41, 0.34, 0.30, 0.22, 0.27}, - {0.36, 0.31, 0.28, 0.30, 0.37}, - {0.38, 0.31, 0.34, 0.40, 0.47}, - {0.43, 0.46, 0.48, 0.52, 0.57} - }; - - double[] adblStrikeATMFactorCalc = new double[] { - 0.700, 0.850, 1.000, 1.150, 1.300 - }; - String[] astrMaturityTenorCalc = new String[] { - "06M", "21M", "36M", "51M", "66M" - }; - - EvaluateSplineSurface ( - ScenarioMarketSurfaceBuilder.CubicPolynomialWireSurface ( - "CUBIC_POLY_VOL_SURFACE", - dtStart, - "USD", - adblStrikeATMFactorCalib, - astrMaturityTenorCalib, - aadblImpliedVolatility - ), - adblStrikeATMFactorCalc, - astrMaturityTenorCalc - ); - - EvaluateSplineSurface ( - ScenarioMarketSurfaceBuilder.QuarticPolynomialWireSurface ( - "QUARTIC_POLY_VOL_SURFACE", - dtStart, - "USD", - adblStrikeATMFactorCalib, - astrMaturityTenorCalib, - aadblImpliedVolatility - ), - adblStrikeATMFactorCalc, - astrMaturityTenorCalc - ); - - EvaluateSplineSurface ( - ScenarioMarketSurfaceBuilder.KaklisPandelisWireSurface ( - "KAKLIS_PANDELIS_VOL_SURFACE", - dtStart, - "USD", - adblStrikeATMFactorCalib, - astrMaturityTenorCalib, - aadblImpliedVolatility - ), - adblStrikeATMFactorCalc, - astrMaturityTenorCalc - ); - - EvaluateSplineSurface ( - ScenarioMarketSurfaceBuilder.KLKHyperbolicWireSurface ( - "KLK_HYPERBOLIC_VOL_SURFACE", - dtStart, - "USD", - adblStrikeATMFactorCalib, - astrMaturityTenorCalib, - aadblImpliedVolatility, - 1. - ), - adblStrikeATMFactorCalc, - astrMaturityTenorCalc - ); - - EvaluateSplineSurface ( - ScenarioMarketSurfaceBuilder.KLKRationalLinearWireSurface ( - "KLK_RATIONAL_LINEAR_VOL_SURFACE", - dtStart, - "USD", - adblStrikeATMFactorCalib, - astrMaturityTenorCalib, - aadblImpliedVolatility, - 1. - ), - adblStrikeATMFactorCalc, - astrMaturityTenorCalc - ); - - EvaluateSplineSurface ( - ScenarioMarketSurfaceBuilder.KLKRationalQuadraticWireSurface ( - "KLK_RATIONAL_QUADRATIC_VOL_SURFACE", - dtStart, - "USD", - adblStrikeATMFactorCalib, - astrMaturityTenorCalib, - aadblImpliedVolatility, - 1. - ), - adblStrikeATMFactorCalc, - astrMaturityTenorCalc - ); - - EvaluateSplineSurface ( - ScenarioMarketSurfaceBuilder.CustomWireSurface ( - "CUBIC_WIRESPAN_QUARTIC_SURFACE_VOL_SURFACE", - dtStart, - "USD", - adblStrikeATMFactorCalib, - astrMaturityTenorCalib, - aadblImpliedVolatility, - CubicPolySCBC(), - QuarticPolySCBC() - ), - adblStrikeATMFactorCalc, - astrMaturityTenorCalc - ); - - EvaluateSplineSurface ( - ScenarioMarketSurfaceBuilder.CustomWireSurface ( - "KAKLISPANDELIS_WIRESPAN_KLKHYPERBOLIC_SURFACE_VOL_SURFACE", - dtStart, - "USD", - adblStrikeATMFactorCalib, - astrMaturityTenorCalib, - aadblImpliedVolatility, - KaklisPandelisSCBC(), - KLKHyperbolicSCBC (2.) - ), - adblStrikeATMFactorCalc, - astrMaturityTenorCalc - ); - - EvaluateSplineSurface ( - ScenarioMarketSurfaceBuilder.CustomWireSurface ( - "KLKRATIONALLINEAR_WIRESPAN_KLKRATIONALQUADRATIC_SURFACE_VOL_SURFACE", - dtStart, - "USD", - adblStrikeATMFactorCalib, - astrMaturityTenorCalib, - aadblImpliedVolatility, - KLKRationalLinearSCBC (3.), - KLKRationalQuadraticSCBC (1.) - ), - adblStrikeATMFactorCalc, - astrMaturityTenorCalc - ); - } -} diff --git a/org/drip/sample/option/DeterministicVolBlackScholes.java b/org/drip/sample/option/DeterministicVolBlackScholes.java deleted file mode 100644 index 071d6f8..0000000 --- a/org/drip/sample/option/DeterministicVolBlackScholes.java +++ /dev/null @@ -1,356 +0,0 @@ - -package org.drip.sample.option; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.SABRLIBORCapVolatility; -import org.drip.market.otc.*; -import org.drip.param.valuation.*; -import org.drip.pricer.option.BlackScholesAlgorithm; -import org.drip.product.creator.*; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.option.EuropeanCallPut; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * DeterministicVolBlackScholes contains an illustration of the Black Scholes based European Call and Put - * Options Pricer that uses deterministic Volatility Function. - * - * @author Lakshmi Krishnamurthy - */ - -public class DeterministicVolBlackScholes { - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Cash Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFutures, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFutures]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFutures, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFutures; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - FixFloatComponent irs = OTCIRS ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate" - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate", // 30Y - "SwapRate", // 40Y - "SwapRate" // 50Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - true - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today(); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - "USD" - ); - - /* - * Construct the Discount Curve using its instruments and quotes - */ - - MergedDiscountForwardCurve dc = MakeDC ( - dtToday, - "USD" - ); - - JulianDate dtMaturity = dtToday.addTenor ("6M"); - - double dblStrike = 1.; - - EuropeanCallPut option = new EuropeanCallPut ( - dtMaturity, - dblStrike - ); - - double dblSpot = 1.; - - SABRLIBORCapVolatility auSABRLIBORCapVol = new SABRLIBORCapVolatility ( - dtToday.julian(), - 0.2000, // A - 0.0005 / 365.25, // B - 0.1000 / 365.25, // C - 0.0050 // D - ); - - Map mapOptionCalc = option.value ( - valParams, - dblSpot, - false, - dc, - auSABRLIBORCapVol, - new BlackScholesAlgorithm() - ); - - for (Map.Entry me : mapOptionCalc.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - - System.out.println ( - "\n\tImplied Volatility From Call Price :" + FormatUtil.FormatDouble ( - option.implyVolatilityFromCallPrice ( - valParams, - dblSpot, - false, - dc, - mapOptionCalc.get ("CallPrice") - ), 2, 2, 100.) + "%" - ); - - System.out.println ( - "\tImplied Volatility From Put Price :" + FormatUtil.FormatDouble ( - option.implyVolatilityFromPutPrice ( - valParams, - dblSpot, - false, - dc, - mapOptionCalc.get ("PutPrice") - ), 2, 2, 100.) + "%" - ); - } -} diff --git a/org/drip/sample/option/DeterministicVolTermStructure.java b/org/drip/sample/option/DeterministicVolTermStructure.java deleted file mode 100644 index 07d353c..0000000 --- a/org/drip/sample/option/DeterministicVolTermStructure.java +++ /dev/null @@ -1,219 +0,0 @@ - -package org.drip.sample.option; - -import org.drip.analytics.date.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDeterministicVolatilityBuilder; -import org.drip.state.volatility.VolatilityCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * DeterministicVolatilityTermStructure contains an illustration of the Calibration and Extraction of the - * Implied and the Deterministic Volatility Term Structures. This does not deal with Local Volatility - * Surfaces. - * - * @author Lakshmi Krishnamurthy - */ - -public class DeterministicVolTermStructure { - - private static final void OnGrid ( - final VolatilityCurve vts, - final String[] astrMaturityTenor, - final double[] dblNodeInput) - throws Exception - { - System.out.println ("\n\t|------------------------------------|"); - - System.out.println ("\t| TNR => CALC | IMPL | INPUT |"); - - System.out.println ("\t|------------------------------------|"); - - for (int i = 0; i < astrMaturityTenor.length; ++i) - System.out.println ("\t| " + astrMaturityTenor[i] + " => " + - FormatUtil.FormatDouble (vts.node (astrMaturityTenor[i]), 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (vts.impliedVol (astrMaturityTenor[i]), 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblNodeInput[i], 2, 2, 100.) + "% |"); - - System.out.println ("\t|------------------------------------|"); - } - - private static final void OffGrid ( - final String strHeader, - final String[] astrLabel, - final VolatilityCurve[] aVTS, - final String[] astrMaturityTenor) - throws Exception - { - System.out.println ("\n\n\t\t" + strHeader + "\n"); - - System.out.print ("\t| TNR =>"); - - for (int i = 0; i < aVTS.length; ++i) - System.out.print (" " + astrLabel[i] + " | "); - - System.out.println ("\n"); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - System.out.print ("\t| " + astrMaturityTenor[i] + " =>"); - - for (int j = 0; j < aVTS.length; ++j) - System.out.print (" " + FormatUtil.FormatDouble (aVTS[j].node (astrMaturityTenor[i]), 2, 2, 100.) + "% | "); - - System.out.print ("\n"); - } - - System.out.println ("\n"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today(); - - String[] astrMaturityTenor = new String[] { - "01Y", "02Y", "03Y", "04Y", "05Y", "06Y", "07Y", "08Y", "09Y" - }; - double[] adblImpliedCallVolatility = new double[] { - 0.700, 0.672, 0.661, 0.596, 0.551, 0.518, 0.492, 0.471, 0.452 - }; - - VolatilityCurve tsCallVolatilityCubicPoly = - ScenarioDeterministicVolatilityBuilder.CubicPolynomialTermStructure ( - "CUBIC_POLY_CALLVOL_TERMSTRUCTURE", - dtToday, - "USD", - astrMaturityTenor, - adblImpliedCallVolatility - ); - - VolatilityCurve tsCallVolatilityQuarticPoly = - ScenarioDeterministicVolatilityBuilder.QuarticPolynomialTermStructure ( - "QUARTIC_POLY_CALLVOL_TERMSTRUCTURE", - dtToday, - "USD", - astrMaturityTenor, - adblImpliedCallVolatility - ); - - VolatilityCurve tsCallVolatilityKaklisPandelis = - ScenarioDeterministicVolatilityBuilder.KaklisPandelisTermStructure ( - "KAKLIS_PANDELIS_CALLVOL_TERMSTRUCTURE", - dtToday, - "USD", - astrMaturityTenor, - adblImpliedCallVolatility - ); - - VolatilityCurve tsCallVolatilityKLKHyperbolic = - ScenarioDeterministicVolatilityBuilder.KLKHyperbolicTermStructure ( - "KLK_HYPERBOLIC_CALLVOL_TERMSTRUCTURE", - dtToday, - "USD", - astrMaturityTenor, - adblImpliedCallVolatility, - 1. - ); - - VolatilityCurve tsCallVolatilityKLKRationalLinear = - ScenarioDeterministicVolatilityBuilder.KLKRationalLinearTermStructure ( - "KLK_RATIONAL_LINEAR_CALLVOL_TERMSTRUCTURE", - dtToday, - "USD", - astrMaturityTenor, - adblImpliedCallVolatility, - 1. - ); - - VolatilityCurve tsCallVolatilityKLKRationalQuadratic = - ScenarioDeterministicVolatilityBuilder.KLKRationalQuadraticTermStructure ( - "KLK_RATIONAL_QUADRATIC_CALLVOL_TERMSTRUCTURE", - dtToday, - "USD", - astrMaturityTenor, - adblImpliedCallVolatility, - 0.0001 - ); - - OnGrid ( - tsCallVolatilityKLKHyperbolic, - astrMaturityTenor, - adblImpliedCallVolatility - ); - - String[] astrOffGridTenor = new String[] { - "18M", "30M", "42M", "54M", "06Y", "09Y" - }; - - OffGrid ( - "ATM_CALLVOL_TERM_STRUCTURE", - new String[] { - "Cubic Poly", "Quart Poly", "KaklisPand", "KLKHyperbl", "KLKRatlLin", "KLKRatlQua" - }, - new VolatilityCurve[] { - tsCallVolatilityCubicPoly, - tsCallVolatilityQuarticPoly, - tsCallVolatilityKaklisPandelis, - tsCallVolatilityKLKHyperbolic, - tsCallVolatilityKLKRationalLinear, - tsCallVolatilityKLKRationalQuadratic - }, - astrOffGridTenor - ); - } -} diff --git a/org/drip/sample/option/LocalVolatilityTermStructure.java b/org/drip/sample/option/LocalVolatilityTermStructure.java deleted file mode 100644 index 2ce4940..0000000 --- a/org/drip/sample/option/LocalVolatilityTermStructure.java +++ /dev/null @@ -1,186 +0,0 @@ - -package org.drip.sample.option; - -import org.drip.analytics.date.*; -import org.drip.analytics.definition.*; -import org.drip.quant.common.FormatUtil; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.ScenarioMarketSurfaceBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * LocalVolatilityTermStructure contains an illustration of the Calibration and Extraction of the Implied and - * the Local Volatility Surfaces and their eventual Strike and Maturity Anchor Term Structures. - * - * @author Lakshmi Krishnamurthy - */ - -public class LocalVolatilityTermStructure { - private static final SegmentCustomBuilderControl scbc() - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ); - } - - private static final void EvaluateLocalVolSurface ( - final MarketSurface volSurface, - final double[] adblStrikeATMFactor, - final String[] astrMaturityTenor) - throws Exception - { - System.out.println ("\n\t " + volSurface.label()); - - System.out.println ("\t|------------------------------------------------------------|"); - - System.out.print ("\t|------------------------------------------------------------|\n\t| ATM/TTE =>"); - - NodeStructure[] aTSMaturityAnchor = new NodeStructure[astrMaturityTenor.length]; - - for (int j = 0; j < astrMaturityTenor.length; ++j) { - aTSMaturityAnchor[j] = volSurface.maturityAnchorTermStructure (astrMaturityTenor[j]); - - System.out.print (" " + astrMaturityTenor[j] + " "); - } - - System.out.println (" |\n\t|------------------------------------------------------------|"); - - for (int i = 0; i < adblStrikeATMFactor.length; ++i) { - System.out.print ("\t| " + FormatUtil.FormatDouble (adblStrikeATMFactor[i], 1, 2, 1.) + " =>"); - - NodeStructure tsStrikeAnchor = volSurface.xAnchorTermStructure (adblStrikeATMFactor[i]); - - for (int j = 0; j < astrMaturityTenor.length; ++j) { - double dblLocalVol = Math.sqrt (2. * (tsStrikeAnchor.nodeDerivative (astrMaturityTenor[j], 1) + - 0.0 * adblStrikeATMFactor[i] * aTSMaturityAnchor[j].nodeDerivative ((int) adblStrikeATMFactor[i], 1)) / - (adblStrikeATMFactor[i] * adblStrikeATMFactor[i] * - aTSMaturityAnchor[j].nodeDerivative ((int) adblStrikeATMFactor[i], 2))); - - System.out.print (" " + FormatUtil.FormatDouble (dblLocalVol, 2, 2, 100.) + "%"); - } - - System.out.print (" |\n"); - } - - System.out.println ("\t|------------------------------------------------------------|"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - JulianDate dtStart = DateUtil.Today(); - - double[] adblStrikeATMFactorCalib = new double[] { - 0.8, 0.9, 1.0, 1.1, 1.2 - }; - String[] astrMaturityTenorCalib = new String[] { - "12M", "24M", "36M", "48M", "60M" - }; - double[][] aadblVol = new double[][] { - {0.171, 0.169, 0.168, 0.168, 0.168}, - {0.159, 0.161, 0.161, 0.162, 0.164}, - {0.138, 0.145, 0.149, 0.152, 0.154}, - {0.115, 0.130, 0.137, 0.143, 0.148}, - {0.103, 0.119, 0.128, 0.135, 0.140} - }; - - MarketSurface priceSurfCubicPoly = ScenarioMarketSurfaceBuilder.CustomWireSurface ( - "HESTON1993_CUBICPOLY_CALLPRICE_SURFACE", - dtStart, - "USD", - adblStrikeATMFactorCalib, - astrMaturityTenorCalib, - aadblVol, - scbc(), - scbc() - ); - - double[] adblStrikeATMFactor = new double[] { - 0.850, 0.925, 1.000, 1.075, 1.150 - }; - String[] astrMaturityTenor = new String[] { - "18M", "27M", "36M", "45M", "54M" - }; - - NodeStructure[] aTSMaturityAnchor = new NodeStructure[astrMaturityTenor.length]; - - for (int j = 0; j < astrMaturityTenor.length; ++j) - aTSMaturityAnchor[j] = priceSurfCubicPoly.maturityAnchorTermStructure (astrMaturityTenor[j]); - - for (int i = 0; i < adblStrikeATMFactor.length; ++i) { - NodeStructure tsStrikeAnchor = priceSurfCubicPoly.xAnchorTermStructure (adblStrikeATMFactor[i]); - - for (int j = 0; j < astrMaturityTenor.length; ++j) { - System.out.println (Math.sqrt (2. * (tsStrikeAnchor.nodeDerivative (astrMaturityTenor[j], 1) + - 0.0 * adblStrikeATMFactor[i] * aTSMaturityAnchor[j].nodeDerivative ((int) adblStrikeATMFactor[i], 1)) / - (adblStrikeATMFactor[i] * adblStrikeATMFactor[i] * - aTSMaturityAnchor[j].nodeDerivative ((int) adblStrikeATMFactor[i], 2))) + " | " + - aTSMaturityAnchor[j].nodeDerivative ((int) adblStrikeATMFactor[i], 2)); - } - } - - EvaluateLocalVolSurface ( - priceSurfCubicPoly, - adblStrikeATMFactor, - astrMaturityTenor - ); - } -} diff --git a/org/drip/sample/option/MarketSurfaceTermStructure.java b/org/drip/sample/option/MarketSurfaceTermStructure.java deleted file mode 100644 index bb244a7..0000000 --- a/org/drip/sample/option/MarketSurfaceTermStructure.java +++ /dev/null @@ -1,253 +0,0 @@ - -package org.drip.sample.option; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.analytics.definition.*; -import org.drip.param.pricer.HestonOptionPricerParams; -import org.drip.pricer.option.HestonStochasticVolatilityAlgorithm; -import org.drip.quant.common.FormatUtil; -import org.drip.quant.fourier.PhaseAdjuster; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.ScenarioMarketSurfaceBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * MarketSurfaceTermStructure contains an illustration of the Creation and Usage of the Strike Anchored and - * Maturity Anchored Term Structures extracted from the given Market Surface. - * - * @author Lakshmi Krishnamurthy - */ - -public class MarketSurfaceTermStructure { - - private static final SegmentCustomBuilderControl CubicPolySCBC() - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ); - } - - private static final void EvaluateSplineSurface ( - final MarketSurface mktSurf, - final double[] adblStrikeATMFactor, - final String[] astrMaturityTenor) - throws Exception - { - System.out.println ("\t|------------------------------------------------------------|"); - - System.out.print ("\t|------------------------------------------------------------|\n\t| ATM/TTE =>"); - - for (String strMaturity : astrMaturityTenor) - System.out.print (" " + strMaturity + " "); - - System.out.println (" |\n\t|------------------------------------------------------------|"); - - for (double dblStrike : adblStrikeATMFactor) { - System.out.print ("\t| " + FormatUtil.FormatDouble (dblStrike, 1, 2, 1.) + " =>"); - - for (String strMaturity : astrMaturityTenor) - System.out.print (" " + FormatUtil.FormatDouble (mktSurf.node (dblStrike, strMaturity), 2, 2, 100.) + "%"); - - System.out.print (" |\n"); - } - - System.out.println ("\t|------------------------------------------------------------|"); - } - - private static final void EvaluateStrikeTermStructure ( - final MarketSurface mktSurf, - final double[] adblStrikeATMFactor, - final String[] astrMaturityTenor) - throws Exception - { - System.out.println ("\n\t|--------- STRIKE TERM STRUCTURE FROM MARKET SURFACE --------|"); - - System.out.println ("\t|------------------------------------------------------------|"); - - System.out.print ("\t|------------------------------------------------------------|\n\t| ATM/TTE =>"); - - for (String strMaturity : astrMaturityTenor) - System.out.print (" " + strMaturity + " "); - - System.out.println (" |\n\t|------------------------------------------------------------|"); - - for (double dblStrike : adblStrikeATMFactor) { - System.out.print ("\t| " + FormatUtil.FormatDouble (dblStrike, 1, 2, 1.) + " =>"); - - NodeStructure tsStrike = mktSurf.xAnchorTermStructure (dblStrike); - - for (String strMaturity : astrMaturityTenor) - System.out.print (" " + FormatUtil.FormatDouble (tsStrike.node (strMaturity), 2, 2, 100.) + "%"); - - System.out.print (" |\n"); - } - - System.out.println ("\t|------------------------------------------------------------|"); - } - - private static final void EvaluateMaturityTermStructure ( - final MarketSurface mktSurf, - final double[] adblStrikeATMFactor, - final String[] astrMaturityTenor) - throws Exception - { - System.out.println ("\n\t|-------- MATURITY TERM STRUCTURE FROM MARKET SURFACE -------|"); - - System.out.println ("\t|------------------------------------------------------------|"); - - System.out.print ("\t|------------------------------------------------------------|\n\t| ATM/TTE =>"); - - Map mapMaturityTS = new TreeMap(); - - for (String strMaturity : astrMaturityTenor) { - System.out.print (" " + strMaturity + " "); - - mapMaturityTS.put (strMaturity, mktSurf.maturityAnchorTermStructure (strMaturity)); - } - - System.out.println (" |\n\t|------------------------------------------------------------|"); - - for (double dblStrike : adblStrikeATMFactor) { - System.out.print ("\t| " + FormatUtil.FormatDouble (dblStrike, 1, 2, 1.) + " =>"); - - for (String strMaturity : astrMaturityTenor) { - NodeStructure tsMaturity = mapMaturityTS.get (strMaturity); - - System.out.print (" " + FormatUtil.FormatDouble (tsMaturity.node ((int) dblStrike), 2, 2, 100.) + "%"); - } - - System.out.print (" |\n"); - } - - System.out.println ("\t|------------------------------------------------------------|"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - JulianDate dtStart = DateUtil.Today(); - - double[] adblStrikeATMFactorCalib = new double[] { - 0.8, 0.9, 1.0, 1.1, 1.2 - }; - String[] astrMaturityTenorCalib = new String[] { - "12M", "24M", "36M", "48M", "60M" - }; - - double dblRho = 0.3; - double dblKappa = 1.; - double dblSigma = 0.5; - double dblTheta = 0.2; - double dblLambda = 0.; - - HestonOptionPricerParams hopp = new HestonOptionPricerParams ( - HestonStochasticVolatilityAlgorithm.PAYOFF_TRANSFORM_SCHEME_AMST_2007, - dblRho, - dblKappa, - dblSigma, - dblTheta, - dblLambda, - PhaseAdjuster.MULTI_VALUE_BRANCH_POWER_PHASE_TRACKER_KAHL_JACKEL - ); - - MarketSurface priceSurfCubicPoly = ScenarioMarketSurfaceBuilder.HestonRunMarketSurface ( - "HESTON1993_CUBICPOLY_CALLPRICE_SURFACE", - dtStart, - "USD", - 0.01, - 1., - false, - 0.20, - adblStrikeATMFactorCalib, - astrMaturityTenorCalib, - hopp, - true, - CubicPolySCBC(), - CubicPolySCBC() - ); - - EvaluateSplineSurface ( - priceSurfCubicPoly, - adblStrikeATMFactorCalib, - astrMaturityTenorCalib - ); - - EvaluateSplineSurface ( - priceSurfCubicPoly, - new double[] {0.500, 0.700, 0.850, 1.000, 1.150, 1.300, 1.500}, - new String[] {"06M", "21M", "36M", "51M", "66M"} - ); - - EvaluateStrikeTermStructure ( - priceSurfCubicPoly, - new double[] {0.500, 0.700, 0.850, 1.000, 1.150, 1.300, 1.500}, - new String[] {"06M", "21M", "36M", "51M", "66M"} - ); - - EvaluateMaturityTermStructure ( - priceSurfCubicPoly, - new double[] {0.500, 0.700, 0.850, 1.000, 1.150, 1.300, 1.500}, - new String[] {"06M", "21M", "36M", "51M", "66M"} - ); - } -} diff --git a/org/drip/sample/option/VanillaBlackNormalPricing.java b/org/drip/sample/option/VanillaBlackNormalPricing.java deleted file mode 100644 index 85dc5e6..0000000 --- a/org/drip/sample/option/VanillaBlackNormalPricing.java +++ /dev/null @@ -1,332 +0,0 @@ - -package org.drip.sample.option; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.market.otc.*; -import org.drip.param.valuation.*; -import org.drip.pricer.option.*; -import org.drip.product.creator.*; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.option.EuropeanCallPut; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * VanillaBlackNormalPricing contains an illustration of the Vanilla Black Normal European Call and Put - * Options Pricer. - * - * @author Lakshmi Krishnamurthy - */ - -public class VanillaBlackNormalPricing { - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFutures, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFutures]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFutures, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFutures; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - FixFloatComponent irs = OTCIRS ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate" - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate", // 30Y - "SwapRate", // 40Y - "SwapRate" // 50Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - true - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today(); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - "USD" - ); - - /* - * Construct the Discount Curve using its instruments and quotes - */ - - MergedDiscountForwardCurve dc = MakeDC (dtToday, "USD"); - - JulianDate dtMaturity = dtToday.addTenor ("6M"); - - double dblStrike = 1.; - - EuropeanCallPut option = new EuropeanCallPut ( - dtMaturity, - dblStrike - ); - - double dblSpot = 1.; - double dblVolatility = 1.; - - Map mapOptionCalc = option.value ( - valParams, - dblSpot, - false, - dc, - new FlatUnivariate (dblVolatility), - new BlackNormalAlgorithm() - ); - - for (Map.Entry me : mapOptionCalc.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - - System.out.println ("\n\tImplied Vol:" + FormatUtil.FormatDouble (option.implyVolatilityFromCallPrice ( - valParams, - dblSpot, - false, - dc, - mapOptionCalc.get ("CallPrice")), 2, 2, 100.) + "%" - ); - } -} diff --git a/org/drip/sample/option/VanillaBlackScholesPricing.java b/org/drip/sample/option/VanillaBlackScholesPricing.java deleted file mode 100644 index f26a65a..0000000 --- a/org/drip/sample/option/VanillaBlackScholesPricing.java +++ /dev/null @@ -1,335 +0,0 @@ - -package org.drip.sample.option; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.market.otc.*; -import org.drip.param.valuation.*; -import org.drip.pricer.option.*; -import org.drip.product.creator.*; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.option.EuropeanCallPut; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * VanillaBlackScholesPricing contains an illustration of the Vanilla Black Scholes based European Call and - * Put Options Pricer. - * - * @author Lakshmi Krishnamurthy - */ - -public class VanillaBlackScholesPricing { - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFutures, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFutures]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFutures, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFutures; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - FixFloatComponent irs = OTCIRS ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate" - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate", // 30Y - "SwapRate", // 40Y - "SwapRate" // 50Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - true - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today(); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - "USD" - ); - - /* - * Construct the Discount Curve using its instruments and quotes - */ - - MergedDiscountForwardCurve dc = MakeDC ( - dtToday, - "USD" - ); - - JulianDate dtMaturity = dtToday.addTenor ("6M"); - - double dblStrike = 1.; - - EuropeanCallPut option = new EuropeanCallPut ( - dtMaturity, - dblStrike - ); - - double dblSpot = 1.; - double dblVolatility = 1.; - - Map mapOptionCalc = option.value ( - valParams, - dblSpot, - false, - dc, - new FlatUnivariate (dblVolatility), - new BlackScholesAlgorithm() - ); - - for (Map.Entry me : mapOptionCalc.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - - System.out.println ("\n\tImplied Vol:" + FormatUtil.FormatDouble (option.implyVolatilityFromCallPrice ( - valParams, - dblSpot, - false, - dc, - mapOptionCalc.get ("CallPrice")), 2, 2, 100.) + "%" - ); - } -} diff --git a/org/drip/sample/overnight/CustomOvernightCurveReconciler.java b/org/drip/sample/overnight/CustomOvernightCurveReconciler.java deleted file mode 100644 index 7ad61fe..0000000 --- a/org/drip/sample/overnight/CustomOvernightCurveReconciler.java +++ /dev/null @@ -1,696 +0,0 @@ - -package org.drip.sample.overnight; - -import org.drip.analytics.date.*; -import org.drip.analytics.definition.Turn; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.curve.DiscountFactorDiscountCurve; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * CustomOvernightCurveReconciler demonstrates the multi-stretch transition custom Overnight curve - * construction, turns application, discount factor extraction, and calibration quote recovery. - * - * @author Lakshmi Krishnamurthy - */ - -public class CustomOvernightCurveReconciler { - - private static final FixFloatComponent OTCOISFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = OvernightFixedFloatContainer.FundConventionFromJurisdiction ( - strCurrency - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - for (int i = 0; i < aiDay.length; ++i) - aDeposit[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - OvernightLabel.Create ( - strCurrency - ) - ); - - return aDeposit; - } - - /* - * Construct the Array of Overnight Index Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OISFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aOIS[i] = OTCOISFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aOIS; - } - - /* - * Construct the Array of Overnight Index Future Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OISFuturesFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrStartTenor, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOISFutures = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aOISFutures[i] = OTCOISFixFloat ( - dtSpot.addTenor (astrStartTenor[i]), - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aOISFutures; - } - - /* - * This sample demonstrates the multi-stretch transition custom discount curve construction, turns - * application, discount factor extraction, and calibration quote recovery. It shows the following - * steps: - * - Setup the linear curve calibrator. - * - Setup the Deposit instruments and their quotes for calibration. - * - Setup the Deposit instruments stretch latent state representation - this uses the discount factor - * quantification metric and the "rate" manifest measure. - * - Setup the OIS instruments and their quotes for calibration. - * - Setup the OIS instruments stretch latent state representation - this uses the discount factor - * quantification metric and the "rate" manifest measure. - * - Calibrate over the instrument set to generate a new overlapping latent state span instance. - * - Retrieve the "Deposit" stretch from the span. - * - Retrieve the "OIS" stretch from the span. - * - Create a discount curve instance by converting the overlapping stretch to an exclusive - * non-overlapping stretch. - * - Compare the discount factors and their monotonicity emitted from the discount curve, the - * non-overlapping span, and the "OIS" stretch across the range of tenor predictor ordinates. - * - Cross-Recovery of the Deposit Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - Cross-Recovery of the OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - Create a turn list instance and add new turn instances. - * - Update the discount curve with the turn list. - * - Compare the discount factor implied the discount curve with and without applying the turns - * adjustment. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void SplineLinearOISDiscountCurve ( - final JulianDate dtSpot, - final SegmentCustomBuilderControl prbp, - final String strHeaderComment, - final String strCurrency) - throws Exception - { - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t" + strHeaderComment); - - /* - * Setup the linear curve calibrator - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - prbp, - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 3 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0004, 0.0004, 0.0004 // Deposit - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - " DEPOSIT ", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of Short End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - CalibratableComponent[] aShortEndOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "1W", "2W", "3W", "1M" - }, - adblShortEndOISQuote - ); - - /* - * Construct the Short End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisShortEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SHORT END OIS", - aShortEndOISComp, - "SwapRate", - adblShortEndOISQuote - ); - - /* - * Construct the Array of OIS Futures Instruments and their Quotes from the given set of parameters - */ - - double[] adblOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - CalibratableComponent[] aOISFutureComp = OISFuturesFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "1M", "2M", "3M", "4M", "5M" - }, - new java.lang.String[] { - "1M", "1M", "1M", "1M", "1M" - }, - adblOISFutureQuote - ); - - /* - * Construct the OIS Future Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisFutureStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - " OIS FUTURE ", - aOISFutureComp, - "SwapRate", - adblOISFutureQuote - ); - - /* - * Construct the Array of Long End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - CalibratableComponent[] aLongEndOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "15M", "18M", "21M", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - adblLongEndOISQuote - ); - - /* - * Construct the Long End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisLongEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "LONG END OIS ", - aLongEndOISComp, - "SwapRate", - adblLongEndOISQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - oisShortEndStretch, - oisFutureStretch, - oisLongEndStretch - }; - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit and Swap Stretches. - */ - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Calibrate over the instrument set to generate a new overlapping latent state span instance - */ - - org.drip.spline.grid.OverlappingStretchSpan ors = lcc.calibrateSpan ( - aStretchSpec, - 1., - valParams, - null, - null, - null - ); - - /* - * Retrieve the "Deposit" stretch from the span - */ - - MultiSegmentSequence mssDeposit = ors.getStretch (" DEPOSIT "); - - /* - * Retrieve the OIS Short End stretch from the span - */ - - MultiSegmentSequence mssOISShortEnd = ors.getStretch ("SHORT END OIS"); - - /* - * Retrieve the OIS Future stretch from the span - */ - - MultiSegmentSequence mssOISFuture = ors.getStretch (" OIS FUTURE "); - - /* - * Retrieve the OIS Long End stretch from the span - */ - - MultiSegmentSequence mssOISLongEnd = ors.getStretch ("LONG END OIS "); - - /* - * Create a discount curve instance by converting the overlapping stretch to an exclusive - * non-overlapping stretch. - */ - - MergedDiscountForwardCurve dfdc = new DiscountFactorDiscountCurve ( - strCurrency, - ors - ); - - /* - * Compare the discount factors and their monotonicity emitted from the discount curve, the - * non-overlapping span, and the "Deposit" stretch across the range of tenor predictor ordinates. - */ - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSITS DF DFDC STRETCH LOCAL"); - - System.out.println ("\t----------------------------------------------------------------"); - - int iDepositWidth = (int) (0.25 * (mssDeposit.getRightPredictorOrdinateEdge() - mssDeposit.getLeftPredictorOrdinateEdge())); - - if (0 == iDepositWidth) iDepositWidth = 1; - - for (int iX = (int) mssDeposit.getLeftPredictorOrdinateEdge(); iX <= (int) mssDeposit.getRightPredictorOrdinateEdge(); - iX += iDepositWidth) { - try { - System.out.println ("\tDEPOSIT [" + new JulianDate (iX) + "] = " + - FormatUtil.FormatDouble (dfdc.df (iX), 1, 8, 1.) + " || " + - ors.getContainingStretch (iX).name() + " || " + - FormatUtil.FormatDouble (mssDeposit.responseValue (iX), 1, 8, 1.) + " | " + - mssDeposit.monotoneType (iX)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - } - - /* - * Compare the discount factors and their monotonicity emitted from the discount curve, the - * non-overlapping span, and the OIS SHORT END stretch across the range of tenor predictor ordinates. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\tSHORT END OIS DF DFDC STRETCH LOCAL"); - - System.out.println ("\t----------------------------------------------------------------"); - - double dblShortOISWidth = 0.2 * (mssOISShortEnd.getRightPredictorOrdinateEdge() - mssOISShortEnd.getLeftPredictorOrdinateEdge()); - - for (int iX = (int) mssOISShortEnd.getLeftPredictorOrdinateEdge(); iX <= (int) mssOISShortEnd.getRightPredictorOrdinateEdge(); - iX += dblShortOISWidth) { - System.out.println ("\tOIS [" + new JulianDate (iX) + "] = " + - FormatUtil.FormatDouble (dfdc.df (iX), 1, 8, 1.) + " || " + - ors.getContainingStretch (iX).name() + " || " + - FormatUtil.FormatDouble (mssOISShortEnd.responseValue (iX), 1, 8, 1.) + " | " + - mssOISShortEnd.monotoneType (iX)); - } - - /* - * Compare the discount factors and their monotonicity emitted from the discount curve, the - * non-overlapping span, and the OIS FUTURE stretch across the range of tenor predictor ordinates. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS FUTURE DF DFDC STRETCH LOCAL"); - - System.out.println ("\t----------------------------------------------------------------"); - - int iOISFutureWidth = (int) (0.2 * (mssOISFuture.getRightPredictorOrdinateEdge() - mssOISFuture.getLeftPredictorOrdinateEdge())); - - for (int iX = (int) mssOISFuture.getLeftPredictorOrdinateEdge(); iX <= (int) mssOISFuture.getRightPredictorOrdinateEdge(); - iX += iOISFutureWidth) { - System.out.println ("\tOIS [" + new JulianDate (iX) + "] = " + - FormatUtil.FormatDouble (dfdc.df (iX), 1, 8, 1.) + " || " + - ors.getContainingStretch (iX).name() + " || " + - FormatUtil.FormatDouble (mssOISFuture.responseValue (iX), 1, 8, 1.) + " | " + - mssOISFuture.monotoneType (iX)); - } - - /* - * Compare the discount factors and their monotonicity emitted from the discount curve, the - * non-overlapping span, and the OIS LONG END stretch across the range of tenor predictor ordinates. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\tLONG END OIS DF DFDC STRETCH LOCAL"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int iX = (int) mssOISFuture.getLeftPredictorOrdinateEdge(); iX <= (int) mssOISFuture.getRightPredictorOrdinateEdge(); - iX += iOISFutureWidth) { - System.out.println ("\tOIS [" + new JulianDate (iX) + "] = " + - FormatUtil.FormatDouble (dfdc.df (iX), 1, 8, 1.) + " || " + - ors.getContainingStretch (iX).name() + " || " + - FormatUtil.FormatDouble (mssOISFuture.responseValue (iX), 1, 8, 1.) + " | " + - mssOISFuture.monotoneType (iX)); - } - - int iLongOISWidth = ((int) mssOISLongEnd.getRightPredictorOrdinateEdge() - (int) mssOISLongEnd.getLeftPredictorOrdinateEdge()) / 10; - - for (int iX = (int) mssOISLongEnd.getLeftPredictorOrdinateEdge() + iLongOISWidth; iX <= (int) mssOISLongEnd.getRightPredictorOrdinateEdge(); - iX += iLongOISWidth) { - System.out.println ("\tOIS [" + new JulianDate (iX) + "] = " + - FormatUtil.FormatDouble (dfdc.df (iX), 1, 8, 1.) + " || " + - ors.getContainingStretch (iX).name() + " || " + - FormatUtil.FormatDouble (mssOISLongEnd.responseValue (iX), 1, 8, 1.) + " | " + - mssOISLongEnd.monotoneType (iX)); - } - - System.out.println ("\tOIS [" + dtSpot.addTenor ("60Y") + "] = " + - FormatUtil.FormatDouble (dfdc.df (dtSpot.addTenor ("60Y")), 1, 8, 1.)); - - /* - * Cross-Recovery of the Deposit Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t[" + aDepositComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aDepositComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dfdc, null, null, null, null, null, null), - null, "Rate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.)); - - /* - * Cross-Recovery of the OIS Short End Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS SHORT END INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aShortEndOISComp.length; ++i) - System.out.println ("\t[" + aShortEndOISComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aShortEndOISComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dfdc, null, null, null, null, null, null), - null, "SwapRate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblShortEndOISQuote[i], 1, 6, 1.)); - - /* - * Cross-Recovery of the OIS Future Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS FUTURES INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aOISFutureComp.length; ++i) - System.out.println ("\t[" + aOISFutureComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aOISFutureComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dfdc, null, null, null, null, null, null), - null, "SwapRate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblOISFutureQuote[i], 1, 6, 1.)); - - /* - * Cross-Recovery of the OIS Long End Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS LONG END INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aLongEndOISComp.length; ++i) - System.out.println ("\t[" + aLongEndOISComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aLongEndOISComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dfdc, null, null, null, null, null, null), - null, "CalibSwapRate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblLongEndOISQuote[i], 1, 6, 1.)); - - /* - * Create a turn list instance and add new turn instances - */ - - TurnListDiscountFactor tldc = new TurnListDiscountFactor(); - - tldc.addTurn ( - new Turn ( - dtSpot.addTenor ("5Y").julian(), - dtSpot.addTenor ("40Y").julian(), - 0.001 - ) - ); - - /* - * Update the discount curve with the turn list. - */ - - dfdc.setTurns (tldc); - - /* - * Compare the discount factor implied the discount curve with and without applying the turns - * adjustment. - */ - - System.out.println ("\n\t-------------------------------"); - - System.out.println ("\t TURNS ADJ DF DFDC"); - - System.out.println ("\t-------------------------------"); - - for (int iX = (int) mssOISShortEnd.getLeftPredictorOrdinateEdge(); iX <= (int) mssOISLongEnd.getRightPredictorOrdinateEdge(); - iX += 0.05 * (mssOISLongEnd.getRightPredictorOrdinateEdge() - mssOISShortEnd.getLeftPredictorOrdinateEdge())) { - System.out.println ("\tOIS [" + new JulianDate (iX) + "] = " + - FormatUtil.FormatDouble (dfdc.df (iX), 1, 8, 1.)); - } - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - /* - * Construct the segment Custom builder using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - */ - - SegmentCustomBuilderControl prbpPolynomial = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ); - - String strCurrency = "EUR"; - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - /* - * Runs the full spline linear discount curve builder sample using the overnight index discount curve. - */ - - SplineLinearOISDiscountCurve ( - dtToday, - prbpPolynomial, - "---- DISCOUNT CURVE WITH OVERNIGHT INDEX ---", - strCurrency - ); - } -} diff --git a/org/drip/sample/overnight/MultiStretchCurveBuilder.java b/org/drip/sample/overnight/MultiStretchCurveBuilder.java deleted file mode 100644 index f6e4377..0000000 --- a/org/drip/sample/overnight/MultiStretchCurveBuilder.java +++ /dev/null @@ -1,559 +0,0 @@ - -package org.drip.sample.overnight; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * MultiStretchCurveBuilder contains a sample of the construction and usage of the Overnight Curve built - * using the Overnight Indexed Swap Product Instruments in their distinct stretches. The Tenors/Quotes to - * replicate are taken from: - * - * - Ametrano, F., and M. Bianchetti (2013): Everything You Always Wanted to Know About Multiple Interest - * Rate Curve Bootstrapping but Were Afraid to Ask, - * http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2219548 - * - * @author Lakshmi Krishnamurthy - */ - -public class MultiStretchCurveBuilder { - - private static final FixFloatComponent OTCOISFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = OvernightFixedFloatContainer.FundConventionFromJurisdiction ( - strCurrency - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - for (int i = 0; i < aiDay.length; ++i) - aDeposit[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - OvernightLabel.Create ( - strCurrency - ) - ); - - return aDeposit; - } - - /* - * Construct the Array of Overnight Index Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OISFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aOIS[i] = OTCOISFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aOIS; - } - - private static final FixFloatComponent[] OISFuturesFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrStartTenor, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOISFutures = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aOISFutures[i] = OTCOISFixFloat ( - dtSpot.addTenor (astrStartTenor[i]), - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aOISFutures; - } - - /* - * Construct the Array of Overnight Index Future Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void CustomOISCurveBuilderSample ( - final JulianDate dtSpot, - final String strCurrency, - final String strHeaderComment) - throws Exception - { - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t " + strHeaderComment); - - System.out.println ("\t----------------------------------------------------------------"); - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 3 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - String[] astrDepositMeasure = new String[] { - "ForwardRate", // 1D - "ForwardRate", // 2D - "ForwardRate" // 3D - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - astrDepositMeasure, - adblDepositQuote - ); - - /* - * Construct the Array of Short End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - CalibratableComponent[] aShortEndOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new String[] { - "1W", - "2W", - "3W", - "1M" - }, - adblShortEndOISQuote - ); - - String[] astrShortEndOISMeasure = new String[] { - "SwapRate", // 1W - "SwapRate", // 2W - "SwapRate", // 3W - "SwapRate" // 1M - }; - - /* - * Construct the Short End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisShortEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "OIS_SHORT_END", - aShortEndOISComp, - astrShortEndOISMeasure, - adblShortEndOISQuote - ); - - /* - * Construct the Array of OIS Futures Instruments and their Quotes from the given set of parameters - */ - - double[] adblOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - CalibratableComponent[] aOISFutureComp = OISFuturesFromMaturityTenor ( - dtSpot, - strCurrency, - new String[] { - "1M", "2M", "3M", "4M", "5M" - }, - new String[] { - "1M", "1M", "1M", "1M", "1M" - }, - adblOISFutureQuote - ); - - String[] astrOISFutureMeasure = new String[] { - "SwapRate", // 1M - "SwapRate", // 2M - "SwapRate", // 3M - "SwapRate", // 4M - "SwapRate" // 5M - }; - - /* - * Construct the OIS Future Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisFutureStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "OIS_FUTURE", - aOISFutureComp, - astrOISFutureMeasure, - adblOISFutureQuote - ); - - /* - * Construct the Array of Long End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - String[] adblLongEndOISMeasure = new String[] { - "SwapRate", // 15M - "SwapRate", // 18M - "SwapRate", // 21M - "SwapRate", // 2Y - "SwapRate", // 3Y - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate" // 30Y - }; - - CalibratableComponent[] aLongEndOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new String[] { - "15M", - "18M", - "21M", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }, - adblLongEndOISQuote - ); - - /* - * Construct the Long End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisLongEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "OIS_LONG_END", - aLongEndOISComp, - adblLongEndOISMeasure, - adblLongEndOISQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - oisShortEndStretch, - oisFutureStretch, - oisLongEndStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit and Swap Stretches. - */ - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - /* - * Cross-Comparison of the Deposit Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t[" + aDepositComp[i].effectiveDate() + " => " + aDepositComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aDepositComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "Rate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the Short End OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS SHORT END INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aShortEndOISComp.length; ++i) - System.out.println ("\t[" + aShortEndOISComp[i].effectiveDate() + " => " + aShortEndOISComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aShortEndOISComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "CalibSwapRate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblShortEndOISQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aShortEndOISComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "FairPremium"), 1, 6, 1.)); - - /* - * Cross-Comparison of the OIS Future Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS FUTURE INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aOISFutureComp.length; ++i) - System.out.println ("\t[" + aOISFutureComp[i].effectiveDate() + " => " + aOISFutureComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aOISFutureComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "SwapRate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblOISFutureQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aOISFutureComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "FairPremium"), 1, 6, 1.)); - - /* - * Cross-Comparison of the Long End OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS LONG END INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aLongEndOISComp.length; ++i) - System.out.println ("\t[" + aLongEndOISComp[i].effectiveDate() + " => " + aLongEndOISComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aLongEndOISComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "CalibSwapRate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblLongEndOISQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aLongEndOISComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "FairPremium"), 1, 6, 1.)); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strCurrency = "EUR"; - - JulianDate dtToday = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - CustomOISCurveBuilderSample ( - dtToday, - strCurrency, - "OVERNIGHT INDEX RUN RECONCILIATION" - ); - } -} diff --git a/org/drip/sample/overnight/ShapeOvernightZeroLocalSmooth.java b/org/drip/sample/overnight/ShapeOvernightZeroLocalSmooth.java deleted file mode 100644 index eee79d0..0000000 --- a/org/drip/sample/overnight/ShapeOvernightZeroLocalSmooth.java +++ /dev/null @@ -1,1357 +0,0 @@ - -package org.drip.sample.overnight; - -import java.util.List; - -import org.drip.analytics.date.*; -import org.drip.analytics.definition.LatentStateStatic; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.*; -import org.drip.spline.params.*; -import org.drip.spline.pchip.LocalMonotoneCkGenerator; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.*; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ShapeOvernightZeroLocalSmooth demonstrates the usage of different local smoothing techniques involved in - * the Overnight curve creation. It shows the following: - * - Construct the Array of Deposit/OIS Instruments and their Quotes from the given set of parameters. - * - Construct the Deposit/OIS Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Akima Local Curve Control parameters as follows: - * - C1 Akima Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Harmonic Local Curve Control parameters as follows: - * - C1 Harmonic Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Hyman 1983 Local Curve Control parameters as follows: - * - C1 Hyman 1983 Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Hyman 1989 Local Curve Control parameters as follows: - * - C1 Akima Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Huynh-Le Floch Delimited Local Curve Control parameters as follows: - * - C1 Huynh-Le Floch Delimited Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Kruger Local Curve Control parameters as follows: - * - C1 Kruger Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving OIS Discount Curve by applying the linear curve calibrator to the array - * of Deposit and OIS Stretches. - * - Construct the Akima Locally Smoothened OIS Discount Curve by applying the linear curve calibrator and - * the Local Curve Control parameters to the array of Deposit and OIS Stretches and the shape - * preserving discount curve. - * - Construct the Harmonic Locally Smoothened OIS Discount Curve by applying the linear curve calibrator - * and the Local Curve Control parameters to the array of Deposit and OIS Stretches and the shape - * preserving discount curve. - * - Construct the Hyman 1983 Locally Smoothened OIS Discount Curve by applying the linear curve calibrator - * and the Local Curve Control parameters to the array of Deposit and OIS Stretches and the shape - * preserving discount curve. - * - Construct the Hyman 1989 Locally Smoothened OIS Discount Curve by applying the linear curve calibrator - * and the Local Curve Control parameters to the array of Deposit and OIS Stretches and the shape - * preserving discount curve. - * - Construct the Huynh-Le Floch Delimiter Locally Smoothened OIS Discount Curve by applying the linear - * curve calibrator and the Local Curve Control parameters to the array of Deposit and OIS Stretches - * and the shape preserving discount curve. - * - Construct the Kruger Locally Smoothened OIS Discount Curve by applying the linear curve calibrator and - * the Local Curve Control parameters to the array of Deposit and OIS Stretches and the shape - * preserving discount curve. - * - Cross-Comparison of the Deposit/OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - Cross-Comparison of the OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies for a sequence of bespoke swap instruments. - * - * @author Lakshmi Krishnamurthy - */ - -public class ShapeOvernightZeroLocalSmooth { - - private static final FixFloatComponent OTCOISFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = OvernightFixedFloatContainer.FundConventionFromJurisdiction ( - strCurrency - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - for (int i = 0; i < aiDay.length; ++i) - aDeposit[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - OvernightLabel.Create ( - strCurrency - ) - ); - - return aDeposit; - } - - /* - * Construct the Array of Overnight Index Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OvernightIndexFromMaturityTenor ( - final JulianDate dtEffective, - final String[] astrMaturityTenor, - final double[] adblCoupon, - final String strCurrency) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrMaturityTenor.length]; - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - false, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - java.lang.String strFixedTenor = Helper.LEFT_TENOR_LESSER == Helper.TenorCompare ( - astrMaturityTenor[i], - "6M" - ) ? astrMaturityTenor[i] : "6M"; - - java.lang.String strFloatingTenor = Helper.LEFT_TENOR_LESSER == Helper.TenorCompare ( - astrMaturityTenor[i], - "3M" - ) ? astrMaturityTenor[i] : "3M"; - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "ON", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_OVERNIGHT, - null, - OvernightLabel.Create ( - strCurrency - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - strFixedTenor, - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - adblCoupon[i], - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 4, - strFloatingTenor, - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - strFixedTenor, - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - strFixedTenor, - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - strFloatingTenor, - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent ois = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - ois.setPrimaryCode ("OIS." + astrMaturityTenor[i] + "." + strCurrency); - - aOIS[i] = ois; - } - - return aOIS; - } - - private static final FixFloatComponent[] OISFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aOIS[i] = OTCOISFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aOIS; - } - - /* - * Construct the Array of Overnight Index Future Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OISFuturesFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrStartTenor, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOISFutures = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aOISFutures[i] = OTCOISFixFloat ( - dtSpot.addTenor (astrStartTenor[i]), - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aOISFutures; - } - - /* - * This sample demonstrates the usage of different local smoothing techniques involved in the OIS discount - * curve creation. It shows the following: - * - Construct the Array of Deposit/OIS Instruments and their Quotes from the given set of parameters. - * - Construct the Deposit/OIS Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Akima Local Curve Control parameters as follows: - * - C1 Akima Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Harmonic Local Curve Control parameters as follows: - * - C1 Harmonic Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Hyman 1983 Local Curve Control parameters as follows: - * - C1 Hyman 1983 Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Hyman 1989 Local Curve Control parameters as follows: - * - C1 Akima Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Huynh-Le Floch Delimited Local Curve Control parameters as follows: - * - C1 Huynh-Le Floch Delimited Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Kruger Local Curve Control parameters as follows: - * - C1 Kruger Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving OIS Discount Curve by applying the linear curve calibrator to the array - * of Deposit and OIS Stretches. - * - Construct the Akima Locally Smoothened OIS Discount Curve by applying the linear curve calibrator and - * the Local Curve Control parameters to the array of Deposit and OIS Stretches and the shape - * preserving discount curve. - * - Construct the Harmonic Locally Smoothened OIS Discount Curve by applying the linear curve calibrator - * and the Local Curve Control parameters to the array of Deposit and OIS Stretches and the shape - * preserving discount curve. - * - Construct the Hyman 1983 Locally Smoothened OIS Discount Curve by applying the linear curve calibrator - * and the Local Curve Control parameters to the array of Deposit and OIS Stretches and the shape - * preserving discount curve. - * - Construct the Hyman 1989 Locally Smoothened OIS Discount Curve by applying the linear curve calibrator - * and the Local Curve Control parameters to the array of Deposit and OIS Stretches and the shape - * preserving discount curve. - * - Construct the Huynh-Le Floch Delimiter Locally Smoothened OIS Discount Curve by applying the linear - * curve calibrator and the Local Curve Control parameters to the array of Deposit and OIS Stretches - * and the shape preserving discount curve. - * - Construct the Kruger Locally Smoothened OIS Discount Curve by applying the linear curve calibrator and - * the Local Curve Control parameters to the array of Deposit and OIS Stretches and the shape - * preserving discount curve. - * - Cross-Comparison of the Deposit/OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - Cross-Comparison of the OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies for a sequence of bespoke OIS instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void ShapeOISDFZeroLocalSmoothSample ( - final JulianDate dtSpot, - final String strHeaderComment, - final String strCurrency) - throws Exception - { - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t" + strHeaderComment); - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 3 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0004, 0.0004, 0.0004 // Deposit - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - " DEPOSIT ", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of Short End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - CalibratableComponent[] aShortEndOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "1W", "2W", "3W", "1M" - }, - adblShortEndOISQuote - ); - - /* - * Construct the Short End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisShortEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SHORT END OIS", - aShortEndOISComp, - "SwapRate", - adblShortEndOISQuote - ); - - /* - * Construct the Array of OIS Futures Instruments and their Quotes from the given set of parameters - */ - - double[] adblOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - CalibratableComponent[] aOISFutureComp = OISFuturesFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "1M", "2M", "3M", "4M", "5M" - }, - new java.lang.String[] { - "1M", "1M", "1M", "1M", "1M" - }, - adblOISFutureQuote - ); - - /* - * Construct the OIS Future Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisFutureStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - " OIS FUTURE ", - aOISFutureComp, - "SwapRate", - adblOISFutureQuote - ); - - /* - * Construct the Array of Long End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - CalibratableComponent[] aLongEndOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "15M", "18M", "21M", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - adblLongEndOISQuote - ); - - /* - * Construct the Long End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisLongEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "LONG END OIS ", - aLongEndOISComp, - "SwapRate", - adblLongEndOISQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - oisShortEndStretch, - oisFutureStretch, - oisLongEndStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_EXPONENTIAL_MIXTURE, - new ExponentialMixtureSetParams ( - new double[] { - 0.01, - 0.05, - 0.25 - } - ), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - /* - * Set up the Akima Local Curve Control parameters as follows: - * - C1 Akima Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LocalControlCurveParams lccpAkima = new LocalControlCurveParams ( - LocalMonotoneCkGenerator.C1_AKIMA, - LatentStateStatic.DISCOUNT_QM_ZERO_RATE, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - MultiSegmentSequence.CALIBRATE, - null, - null, - true, - true - ); - - /* - * Set up the Harmonic Local Curve Control parameters as follows: - * - C1 Harmonic Monotone Smoothener with spurious extrema elimination and monotone filtering - * applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LocalControlCurveParams lccpHarmonic = new LocalControlCurveParams ( - LocalMonotoneCkGenerator.C1_HARMONIC, - LatentStateStatic.DISCOUNT_QM_ZERO_RATE, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - MultiSegmentSequence.CALIBRATE, - null, - null, - true, - true - ); - - /* - * Set up the Hyman 1983 Local Curve Control parameters as follows: - * - C1 Hyman 1983 Monotone Smoothener with spurious extrema elimination and monotone filtering - * applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LocalControlCurveParams lccpHyman83 = new LocalControlCurveParams ( - LocalMonotoneCkGenerator.C1_HYMAN83, - LatentStateStatic.DISCOUNT_QM_ZERO_RATE, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - MultiSegmentSequence.CALIBRATE, - null, - null, - true, - true - ); - - /* - * Set up the Hyman 1989 Local Curve Control parameters as follows: - * - C1 Hyman 1989 Monotone Smoothener with spurious extrema elimination and monotone filtering - * applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LocalControlCurveParams lccpHyman89 = new LocalControlCurveParams ( - LocalMonotoneCkGenerator.C1_HYMAN89, - LatentStateStatic.DISCOUNT_QM_ZERO_RATE, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - MultiSegmentSequence.CALIBRATE, - null, - null, - true, - true - ); - - /* - * Set up the Huynh-LeFloch Limiter Local Curve Control parameters as follows: - * - C1 Huynh-LeFloch Limiter Monotone Smoothener with spurious extrema elimination and monotone - * filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LocalControlCurveParams lccpHuynhLeFloch = new LocalControlCurveParams ( - LocalMonotoneCkGenerator.C1_HUYNH_LE_FLOCH, - LatentStateStatic.DISCOUNT_QM_ZERO_RATE, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - MultiSegmentSequence.CALIBRATE, - null, - null, - true, - true - ); - - /* - * Set up the Kruger Local Curve Control parameters as follows: - * - C1 Kruger Monotone Smoothener with spurious extrema elimination and monotone filtering applied - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LocalControlCurveParams lccpKruger = new LocalControlCurveParams ( - LocalMonotoneCkGenerator.C1_KRUGER, - LatentStateStatic.DISCOUNT_QM_ZERO_RATE, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - MultiSegmentSequence.CALIBRATE, - null, - null, - true, - true - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit and OIS Stretches. - */ - - MergedDiscountForwardCurve dcShapePreserving = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - /* - * Construct the Akima Locally Smoothened Discount Curve by applying the linear curve calibrator and - * the Local Curve Control parameters to the array of Deposit and OIS Stretches and the shape - * preserving discount curve. - */ - - MergedDiscountForwardCurve dcLocalAkima = ScenarioDiscountCurveBuilder.SmoothingLocalControlBuild ( - dcShapePreserving, - lcc, - lccpAkima, - valParams, - null, - null, - null - ); - - /* - * Construct the Harmonic Locally Smoothened Discount Curve by applying the linear curve calibrator - * and the Local Curve Control parameters to the array of Deposit and OIS Stretches and the shape - * preserving discount curve. - */ - - MergedDiscountForwardCurve dcLocalHarmonic = ScenarioDiscountCurveBuilder.SmoothingLocalControlBuild ( - dcShapePreserving, - lcc, - lccpHarmonic, - valParams, - null, - null, - null - ); - - /* - * Construct the Hyman 1983 Locally Smoothened Discount Curve by applying the linear curve calibrator - * and the Local Curve Control parameters to the array of Deposit and OIS Stretches and the shape - * preserving discount curve. - */ - - MergedDiscountForwardCurve dcLocalHyman83 = ScenarioDiscountCurveBuilder.SmoothingLocalControlBuild ( - dcShapePreserving, - lcc, - lccpHyman83, - valParams, - null, - null, - null - ); - - /* - * Construct the Hyman 1989 Locally Smoothened OIS Discount Curve by applying the linear curve calibrator - * and the Local Curve Control parameters to the array of Deposit and OIS Stretches and the shape - * preserving discount curve. - */ - - MergedDiscountForwardCurve dcLocalHyman89 = ScenarioDiscountCurveBuilder.SmoothingLocalControlBuild ( - dcShapePreserving, - lcc, - lccpHyman89, - valParams, - null, - null, - null - ); - - /* - * Construct the Huynh-Le Floch delimited Locally Smoothened OIS Discount Curve by applying the linear - * curve calibrator and the Local Curve Control parameters to the array of Deposit and OIS Stretches - * and the shape preserving discount curve. - */ - - MergedDiscountForwardCurve dcLocalHuynhLeFloch = ScenarioDiscountCurveBuilder.SmoothingLocalControlBuild ( - dcShapePreserving, - lcc, - lccpHuynhLeFloch, - valParams, - null, - null, - null - ); - - /* - * Construct the Kruger Locally Smoothened OIS Discount Curve by applying the linear curve calibrator and - * the Local Curve Control parameters to the array of Deposit and OIS Stretches and the shape - * preserving discount curve. - */ - - MergedDiscountForwardCurve dcLocalKruger = ScenarioDiscountCurveBuilder.SmoothingLocalControlBuild ( - dcShapePreserving, - lcc, - lccpKruger, - valParams, - null, - null, - null - ); - - /* - * Cross-Comparison of the Deposit Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t-------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t SHAPE PRESERVING | LOCAL AKIMA | LOCAL HARMONIC | LOCAL HYMAN83 | LOCAL HYMAN89 | LOCAL HUYNHLF | LOCAL KRUGER | INPUT QUOTE "); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t[" + aDepositComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble ( - aDepositComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcShapePreserving, null, null, null, null, null, null), - null, - "Rate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aDepositComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcLocalAkima, null, null, null, null, null, null), - null, - "Rate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aDepositComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcLocalHarmonic, null, null, null, null, null, null), - null, - "Rate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aDepositComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcLocalHyman83, null, null, null, null, null, null), - null, - "Rate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aDepositComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcLocalHyman89, null, null, null, null, null, null), - null, - "Rate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aDepositComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcLocalHuynhLeFloch, null, null, null, null, null, null), - null, - "Rate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aDepositComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcLocalKruger, null, null, null, null, null, null), - null, - "Rate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.) - ); - - /* - * Cross-Comparison of the Short End OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t SHORT END OIS INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t SHAPE PRESERVING | LOCAL AKIMA | LOCAL HARMONIC | LOCAL HYMAN83 | LOCAL HYMAN89 | LOCAL HUYNHLF | LOCAL KRUGER | INPUT QUOTE "); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - for (int i = 0; i < aShortEndOISComp.length; ++i) - System.out.println ("\t[" + aShortEndOISComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble ( - aShortEndOISComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcShapePreserving, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aShortEndOISComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcLocalAkima, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aShortEndOISComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcLocalHarmonic, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aShortEndOISComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcLocalHyman83, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aShortEndOISComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcLocalHyman89, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aShortEndOISComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcLocalHuynhLeFloch, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aShortEndOISComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcLocalKruger, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblShortEndOISQuote[i], 1, 6, 1.) - ); - - /* - * Cross-Comparison of the OIS Future Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t OIS FUTURE INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t SHAPE PRESERVING | LOCAL AKIMA | LOCAL HARMONIC | LOCAL HYMAN83 | LOCAL HYMAN89 | LOCAL HUYNHLF | LOCAL KRUGER | INPUT QUOTE "); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - for (int i = 0; i < aOISFutureComp.length; ++i) - System.out.println ("\t[" + aOISFutureComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble ( - aOISFutureComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcShapePreserving, null, null, null, null, null, null), - null, - "SwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aOISFutureComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcLocalAkima, null, null, null, null, null, null), - null, - "SwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aOISFutureComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcLocalHarmonic, null, null, null, null, null, null), - null, - "SwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aOISFutureComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcLocalHyman83, null, null, null, null, null, null), - null, - "SwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aOISFutureComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcLocalHyman89, null, null, null, null, null, null), - null, - "SwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aOISFutureComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcLocalHuynhLeFloch, null, null, null, null, null, null), - null, - "SwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aOISFutureComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcLocalKruger, null, null, null, null, null, null), - null, - "SwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblOISFutureQuote[i], 1, 6, 1.) - ); - - System.out.println ("\n\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t LONG END OIS INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t SHAPE PRESERVING | LOCAL AKIMA | LOCAL HARMONIC | LOCAL HYMAN83 | LOCAL HYMAN89 | LOCAL HUYNHLF | LOCAL KRUGER | INPUT QUOTE "); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------------------"); - - for (int i = 0; i < aLongEndOISComp.length; ++i) - System.out.println ("\t[" + aLongEndOISComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble ( - aLongEndOISComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcShapePreserving, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aLongEndOISComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcLocalAkima, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aLongEndOISComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcLocalHarmonic, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aLongEndOISComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcLocalHyman83, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aLongEndOISComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcLocalHyman89, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aLongEndOISComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcLocalHuynhLeFloch, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aLongEndOISComp[i].measureValue ( - valParams, null, - MarketParamsBuilder.Create (dcLocalKruger, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblLongEndOISQuote[i], 1, 6, 1.) - ); - - /* - * Cross-Comparison of the OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies for a sequence of bespoke OIS instruments. - */ - - CalibratableComponent[] aCC = OvernightIndexFromMaturityTenor ( - dtSpot, - new java.lang.String[] { - "3Y", "6Y", "9Y", "12Y", "15Y", "18Y", "21Y", "24Y", "27Y", "30Y" - }, - new double[] { - 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01 - }, - strCurrency - ); - - System.out.println ("\n\t--------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t BESPOKE OIS PAR RATE"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t SHAPE PRESERVING | LOCAL AKIMA | LOCAL HARMONIC | LOCAL HYMAN83 | LOCAL HYMAN89 | LOCAL HUYNHLF | LOCAL KRUGER "); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------------------------------"); - - for (int i = 0; i < aCC.length; ++i) - System.out.println ("\t[" + aCC[i].maturityDate() + "] = " + - FormatUtil.FormatDouble ( - aCC[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dcShapePreserving, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aCC[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dcLocalAkima, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aCC[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dcLocalHarmonic, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aCC[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dcLocalHyman83, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aCC[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dcLocalHyman89, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aCC[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dcLocalHuynhLeFloch, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble ( - aCC[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dcLocalKruger, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - ShapeOISDFZeroLocalSmoothSample ( - dtSpot, - "---- DISCOUNT CURVE WITH OVERNIGHT INDEX ---", - "EUR" - ); - } -} diff --git a/org/drip/sample/overnight/ShapePreservingOvernightZeroSmooth.java b/org/drip/sample/overnight/ShapePreservingOvernightZeroSmooth.java deleted file mode 100644 index 43c8560..0000000 --- a/org/drip/sample/overnight/ShapePreservingOvernightZeroSmooth.java +++ /dev/null @@ -1,815 +0,0 @@ - -package org.drip.sample.overnight; - -import java.util.List; - -import org.drip.analytics.date.*; -import org.drip.analytics.definition.LatentStateStatic; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.*; -import org.drip.spline.params.*; -import org.drip.spline.pchip.LocalMonotoneCkGenerator; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.*; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ShapePreservingOvernightZeroSmooth demonstrates the usage of different shape preserving and smoothing - * techniques involved in the Overnight curve creation. It shows the following: - * - Construct the Array of Cash/OIS Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/OIS Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Global Curve Control parameters as follows: - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Local Curve Control parameters as follows: - * - C1 Bessel Monotone Smoothener with no spurious extrema elimination and no monotone filter - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving OIS Discount Curve by applying the linear curve calibrator to the array of - * Cash and OIS Stretches. - * - Construct the Globally Smoothened OIS Discount Curve by applying the linear curve calibrator and the Global - * Curve Control parameters to the array of Cash and OIS Stretches and the shape preserving discount - * curve. - * - Construct the Locally Smoothened OIS Discount Curve by applying the linear curve calibrator and the Local - * Curve Control parameters to the array of Cash and OIS Stretches and the shape preserving discount - * curve. - * - Cross-Comparison of the Cash/OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - Cross-Comparison of the OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies for a sequence of bespoke OIS instruments. - * - * @author Lakshmi Krishnamurthy - */ - -public class ShapePreservingOvernightZeroSmooth { - - private static final FixFloatComponent OTCOISFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = OvernightFixedFloatContainer.FundConventionFromJurisdiction ( - strCurrency - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - for (int i = 0; i < aiDay.length; ++i) - aDeposit[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - OvernightLabel.Create ( - strCurrency - ) - ); - - return aDeposit; - } - - /* - * Construct the Array of Overnight Index Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OISFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aOIS[i] = OTCOISFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aOIS; - } - - private static final FixFloatComponent[] OvernightIndexFromMaturityTenor ( - final JulianDate dtEffective, - final String[] astrMaturityTenor, - final double[] adblCoupon, - final String strCurrency) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrMaturityTenor.length]; - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - false, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - java.lang.String strFixedTenor = Helper.LEFT_TENOR_LESSER == Helper.TenorCompare ( - astrMaturityTenor[i], - "6M" - ) ? astrMaturityTenor[i] : "6M"; - - java.lang.String strFloatingTenor = Helper.LEFT_TENOR_LESSER == Helper.TenorCompare ( - astrMaturityTenor[i], - "3M" - ) ? astrMaturityTenor[i] : "3M"; - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "ON", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_OVERNIGHT, - null, - OvernightLabel.Create ( - strCurrency - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - strFixedTenor, - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - adblCoupon[i], - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 4, - strFloatingTenor, - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - strFixedTenor, - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - strFixedTenor, - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - strFloatingTenor, - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent ois = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - ois.setPrimaryCode ("OIS." + astrMaturityTenor[i] + "." + strCurrency); - - aOIS[i] = ois; - } - - return aOIS; - } - - /* - * Construct the Array of Overnight Index Future Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OISFuturesFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrStartTenor, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOISFutures = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aOISFutures[i] = OTCOISFixFloat ( - dtSpot.addTenor (astrStartTenor[i]), - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aOISFutures; - } - - /* - * This sample demonstrates the usage of different shape preserving and smoothing techniques involved in - * the OIS discount curve creation. It shows the following: - * - Construct the Array of Cash/OIS Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/OIS Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Global Curve Control parameters as follows: - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Set up the Local Curve Control parameters as follows: - * - C1 Bessel Monotone Smoothener with no spurious extrema elimination and no monotone filter - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving OIS Discount Curve by applying the linear curve calibrator to the array - * of Cash and OIS Stretches. - * - Construct the Globally Smoothened OIS Discount Curve by applying the linear curve calibrator and the - * Global Curve Control parameters to the array of Cash and OIS Stretches and the shape preserving - * discount curve. - * - Construct the Locally Smoothened OIS Discount Curve by applying the linear curve calibrator and the - * Local Curve Control parameters to the array of Cash and OIS Stretches and the shape preserving - * discount curve. - * - Cross-Comparison of the Cash/OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - Cross-Comparison of the OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies for a sequence of bespoke OIS instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void ShapePreservingOISDFZeroSmoothSample ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 3 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0004, 0.0004, 0.0004 // Deposit - }; - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - " DEPOSIT ", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of Short End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - CalibratableComponent[] aShortEndOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "1W", "2W", "3W", "1M" - }, - adblShortEndOISQuote - ); - - /* - * Construct the Short End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisShortEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SHORT END OIS", - aShortEndOISComp, - "SwapRate", - adblShortEndOISQuote - ); - - /* - * Construct the Array of OIS Futures Instruments and their Quotes from the given set of parameters - */ - - double[] adblOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - CalibratableComponent[] aOISFutureComp = OISFuturesFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "1M", "2M", "3M", "4M", "5M" - }, - new java.lang.String[] { - "1M", "1M", "1M", "1M", "1M" - }, - adblOISFutureQuote - ); - - /* - * Construct the OIS Future Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisFutureStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - " OIS FUTURE ", - aOISFutureComp, - "SwapRate", - adblOISFutureQuote - ); - - /* - * Construct the Array of Long End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - CalibratableComponent[] aLongEndOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "15M", "18M", "21M", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - adblLongEndOISQuote - ); - - /* - * Construct the Long End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisLongEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "LONG END OIS ", - aLongEndOISComp, - "SwapRate", - adblLongEndOISQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - oisShortEndStretch, - oisFutureStretch, - oisLongEndStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_EXPONENTIAL_MIXTURE, - new ExponentialMixtureSetParams ( - new double[] { - 0.01, - 0.05, - 0.25 - } - ), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - /* - * Set up the Local Curve Control parameters as follows: - * - C1 Bessel Monotone Smoothener with no spurious extrema elimination and no monotone filter - * - Zero Rate Quantification Metric - * - Cubic Polynomial Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LocalControlCurveParams lccp = new LocalControlCurveParams ( - LocalMonotoneCkGenerator.C1_BESSEL, - LatentStateStatic.DISCOUNT_QM_ZERO_RATE, - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - MultiSegmentSequence.CALIBRATE, - null, - null, - false, - false - ); - - /* - * Construct the Shape Preserving OIS Discount Curve by applying the linear curve calibrator to the array - * of Cash and OIS Stretches. - */ - - MergedDiscountForwardCurve dcShapePreserving = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - null, - null, - null, - 1. - ); - - /* - * Construct the Globally Smoothened OIS Discount Curve by applying the linear curve calibrator and the - * Global Curve Control parameters to the array of Cash and OIS Stretches and the shape preserving - * discount curve. - */ - - /* DiscountCurve dcGloballySmooth = ScenarioDiscountCurveBuilder.SmoothingGlobalControlBuild ( - dcShapePreserving, - lcc, - gccp, - aRRS, - new ValuationParams (dtToday, dtToday, "USD"), - null, - null, - null); */ - - /* - * Construct the Locally Smoothened OIS Discount Curve by applying the linear curve calibrator and the - * Local Curve Control parameters to the array of Cash and OIS Stretches and the shape preserving - * discount curve. - */ - - MergedDiscountForwardCurve dcLocallySmooth = ScenarioDiscountCurveBuilder.SmoothingLocalControlBuild ( - dcShapePreserving, - lcc, - lccp, - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - null, - null, - null - ); - - /* - * Cross-Comparison of the Deposit Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t SHAPE PRESERVING | SMOOTHING #1 | SMOOTHING #2 | INPUT QUOTE "); - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t[" + aDepositComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble ( - aDepositComp[i].measureValue ( - new ValuationParams (dtSpot, dtSpot, strCurrency), null, - MarketParamsBuilder.Create (dcShapePreserving, null, null, null, null, null, null), - null, - "Rate"), - 1, 6, 1.) + " | " + - /* FormatUtil.FormatDouble ( - aDeposit[i].measureValue ( - new ValuationParams (dtToday, dtToday, "USD"), null, - ComponentMarketParamsBuilder.Create (dcGloballySmooth, null, null, null, null, null, null), - null, - "Rate"), - 1, 6, 1.) + " | " + */ - FormatUtil.FormatDouble ( - aDepositComp[i].measureValue ( - new ValuationParams (dtSpot, dtSpot, strCurrency), null, - MarketParamsBuilder.Create (dcLocallySmooth, null, null, null, null, null, null), - null, - "Rate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.) - ); - - /* - * Cross-Comparison of the OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t OIS INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t SHAPE PRESERVING | SMOOTHING #1 | SMOOTHING #2 | INPUT QUOTE "); - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aLongEndOISComp.length; ++i) - System.out.println ("\t[" + aLongEndOISComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble ( - aLongEndOISComp[i].measureValue ( - new ValuationParams (dtSpot, dtSpot, strCurrency), null, - MarketParamsBuilder.Create (dcShapePreserving, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - /* FormatUtil.FormatDouble ( - aOISComp[i].measureValue ( - new ValuationParams (dtToday, dtToday, "USD"), null, - ComponentMarketParamsBuilder.Create (dcGloballySmooth, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + */ - FormatUtil.FormatDouble ( - aLongEndOISComp[i].measureValue ( - new ValuationParams (dtSpot, dtSpot, strCurrency), null, - MarketParamsBuilder.Create (dcLocallySmooth, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (adblLongEndOISQuote[i], 1, 6, 1.) - ); - - /* - * Cross-Comparison of the OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies for a sequence of bespoke OIS instruments. - */ - - CalibratableComponent[] aCC = OvernightIndexFromMaturityTenor ( - dtSpot, - new java.lang.String[] { - "3Y", "6Y", "9Y", "12Y", "15Y", "18Y", "21Y", "24Y", "27Y", "30Y" - }, - new double[] { - 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01 - }, - strCurrency - ); - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t BESPOKE OIS PAR RATE"); - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t SHAPE PRESERVING | SMOOTHING #1 | SMOOTHING #2"); - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aCC.length; ++i) - System.out.println ("\t[" + aCC[i].maturityDate() + "] = " + - FormatUtil.FormatDouble ( - aCC[i].measureValue (new ValuationParams (dtSpot, dtSpot, strCurrency), null, - MarketParamsBuilder.Create (dcShapePreserving, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + - /* FormatUtil.FormatDouble ( - aCC[i].measureValue (new ValuationParams (dtToday, dtToday, "USD"), null, - ComponentMarketParamsBuilder.Create (dcGloballySmooth, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) + " | " + */ - FormatUtil.FormatDouble ( - aCC[i].measureValue (new ValuationParams (dtSpot, dtSpot, strCurrency), null, - MarketParamsBuilder.Create (dcLocallySmooth, null, null, null, null, null, null), - null, - "CalibSwapRate"), - 1, 6, 1.) - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - ShapePreservingOISDFZeroSmoothSample ( - DateUtil.Today(), - "EUR" - ); - } -} diff --git a/org/drip/sample/overnight/SingleStretchCurveBuilder.java b/org/drip/sample/overnight/SingleStretchCurveBuilder.java deleted file mode 100644 index 8c0e91d..0000000 --- a/org/drip/sample/overnight/SingleStretchCurveBuilder.java +++ /dev/null @@ -1,594 +0,0 @@ - -package org.drip.sample.overnight; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * SingleStretchCurveBuilder contains a sample of the construction and usage of the Overnight Curve built - * using the Overnight Indexed Swap Product Instruments inside a single stretch. The Tenors/Quotes to - * replicate are taken from: - * - * - Ametrano, F., and M. Bianchetti (2013): Everything You Always Wanted to Know About Multiple Interest - * Rate Curve Bootstrapping but Were Afraid to Ask, - * http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2219548 - * - * @author Lakshmi Krishnamurthy - */ - -public class SingleStretchCurveBuilder { - - private static final FixFloatComponent OTCOISFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = OvernightFixedFloatContainer.FundConventionFromJurisdiction ( - strCurrency - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - for (int i = 0; i < aiDay.length; ++i) - aDeposit[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - OvernightLabel.Create ( - strCurrency - ) - ); - - return aDeposit; - } - - /* - * Construct the Array of Overnight Index Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OISFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aOIS[i] = OTCOISFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aOIS; - } - - private static final FixFloatComponent[] OISFuturesFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrStartTenor, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aOISFutures = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aOISFutures[i] = OTCOISFixFloat ( - dtSpot.addTenor (astrStartTenor[i]), - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aOISFutures; - } - - private static final CalibratableComponent[] MergeComp ( - final CalibratableComponent[] aDepositComp, - final CalibratableComponent[] aShortEndOISComp, - final CalibratableComponent[] aOISFutureComp, - final CalibratableComponent[] aLongEndOISComp) - throws Exception - { - CalibratableComponent[] aComp = new CalibratableComponent[aDepositComp.length + aShortEndOISComp.length + aOISFutureComp.length + aLongEndOISComp.length]; - - for (int i = 0; i < aComp.length; ++i) { - if (i < aDepositComp.length) - aComp[i] = aDepositComp[i]; - else if (i < aDepositComp.length + aShortEndOISComp.length) - aComp[i] = aShortEndOISComp[i - aDepositComp.length]; - else if (i < aDepositComp.length + aShortEndOISComp.length + aOISFutureComp.length) - aComp[i] = aOISFutureComp[i - aDepositComp.length - aShortEndOISComp.length]; - else - aComp[i] = aLongEndOISComp[i - aDepositComp.length - aShortEndOISComp.length - aOISFutureComp.length]; - } - - return aComp; - } - - private static final String[] MergeMeasures ( - final String[] astrDepositMeasure, - final String[] astrShortEndOISMeasure, - final String[] astrOISFutureMeasure, - final String[] astrLongEndOISMeasure) - throws Exception - { - String[] astrMeasure = new String[astrDepositMeasure.length + astrShortEndOISMeasure.length + astrOISFutureMeasure.length + astrLongEndOISMeasure.length]; - - for (int i = 0; i < astrMeasure.length; ++i) { - if (i < astrDepositMeasure.length) - astrMeasure[i] = astrDepositMeasure[i]; - else if (i < astrDepositMeasure.length + astrShortEndOISMeasure.length) - astrMeasure[i] = astrShortEndOISMeasure[i - astrDepositMeasure.length]; - else if (i < astrDepositMeasure.length + astrShortEndOISMeasure.length + astrOISFutureMeasure.length) - astrMeasure[i] = astrOISFutureMeasure[i - astrDepositMeasure.length - astrShortEndOISMeasure.length]; - else - astrMeasure[i] = astrLongEndOISMeasure[i - astrDepositMeasure.length - astrShortEndOISMeasure.length - astrOISFutureMeasure.length]; - } - - return astrMeasure; - } - - private static final double[] MergeQuotes ( - final double[] adblDepositQuote, - final double[] adblShortEndOISQuote, - final double[] adblOISFutureQuote, - final double[] adblLongEndOISQuote) - throws Exception - { - double[] adblQuote = new double[adblDepositQuote.length + adblShortEndOISQuote.length + adblOISFutureQuote.length + adblLongEndOISQuote.length]; - - for (int i = 0; i < adblQuote.length; ++i) { - if (i < adblDepositQuote.length) - adblQuote[i] = adblDepositQuote[i]; - else if (i < adblDepositQuote.length + adblShortEndOISQuote.length) - adblQuote[i] = adblShortEndOISQuote[i - adblDepositQuote.length]; - else if (i < adblDepositQuote.length + adblShortEndOISQuote.length + adblOISFutureQuote.length) - adblQuote[i] = adblOISFutureQuote[i - adblDepositQuote.length - adblShortEndOISQuote.length]; - else - adblQuote[i] = adblLongEndOISQuote[i - adblDepositQuote.length - adblShortEndOISQuote.length - adblOISFutureQuote.length]; - } - - return adblQuote; - } - - /* - * Construct the Array of Overnight Index Future Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void CustomOISCurveBuilderSample ( - final JulianDate dtSpot, - final String strCurrency, - final String strHeaderComment) - throws Exception - { - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t " + strHeaderComment); - - System.out.println ("\t----------------------------------------------------------------"); - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 3 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0004, 0.0004, 0.0004 // Deposit - }; - - String[] astrDepositMeasure = new String[] { - "Rate", "Rate", "Rate" // Deposit - }; - - /* - * Construct the Array of Short End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - CalibratableComponent[] aShortEndOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "1W", "2W", "3W", "1M" - }, - adblShortEndOISQuote - ); - - String[] astrShortEndOISMeasure = new String[] { - "SwapRate", // 1W - "SwapRate", // 2W - "SwapRate", // 3W - "SwapRate" // 1M - }; - - /* - * Construct the Array of OIS Futures Instruments and their Quotes from the given set of parameters - */ - - double[] adblOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - CalibratableComponent[] aOISFutureComp = OISFuturesFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "1M", "2M", "3M", "4M", "5M" - }, - new java.lang.String[] { - "1M", "1M", "1M", "1M", "1M" - }, - adblOISFutureQuote - ); - - String[] astrOISFutureMeasure = new String[] { - "SwapRate", // 1M - "SwapRate", // 2M - "SwapRate", // 3M - "SwapRate", // 4M - "SwapRate" // 5M - }; - - /* - * Construct the Array of Long End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - String[] astrLongEndOISMeasure = new String[] { - "SwapRate", // 15M - "SwapRate", // 18M - "SwapRate", // 21M - "SwapRate", // 2Y - "SwapRate", // 3Y - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate" // 30Y - }; - - CalibratableComponent[] aLongEndOISComp = OISFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "15M", - "18M", - "21M", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }, - adblLongEndOISQuote - ); - - LatentStateStretchSpec oisSingleStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "OIS_SINGLE_STRETCH", - MergeComp ( - aDepositComp, - aShortEndOISComp, - aOISFutureComp,aLongEndOISComp - ), - MergeMeasures ( - astrDepositMeasure, - astrShortEndOISMeasure, - astrOISFutureMeasure, - astrLongEndOISMeasure - ), - MergeQuotes ( - adblDepositQuote, - adblShortEndOISQuote, - adblOISFutureQuote, - adblLongEndOISQuote - ) - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - oisSingleStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - null - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit and Swap Stretches. - */ - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - /* - * Cross-Comparison of the Deposit Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t[" + aDepositComp[i].effectiveDate() + " => " + aDepositComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aDepositComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "Rate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the Short End OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS SHORT END INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aShortEndOISComp.length; ++i) - System.out.println ("\t[" + aShortEndOISComp[i].effectiveDate() + " => " + aShortEndOISComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aShortEndOISComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "CalibSwapRate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblShortEndOISQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aShortEndOISComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "FairPremium"), 1, 6, 1.)); - - /* - * Cross-Comparison of the OIS Future Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS FUTURE INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aOISFutureComp.length; ++i) - System.out.println ("\t[" + aOISFutureComp[i].effectiveDate() + " => " + aOISFutureComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aOISFutureComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "SwapRate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblOISFutureQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aOISFutureComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "FairPremium"), 1, 6, 1.)); - - /* - * Cross-Comparison of the Long End OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS LONG END INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aLongEndOISComp.length; ++i) - System.out.println ("\t[" + aLongEndOISComp[i].effectiveDate() + " => " + aLongEndOISComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aLongEndOISComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "CalibSwapRate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblLongEndOISQuote[i], 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (aLongEndOISComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "FairPremium"), 1, 6, 1.)); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strCurrency = "EUR"; - - JulianDate dtToday = DateUtil.CreateFromYMD ( - 2012, - DateUtil.DECEMBER, - 11 - ); - - CustomOISCurveBuilderSample ( - dtToday, - strCurrency, - "OVERNIGHT INDEX RUN RECONCILIATION" - ); - } -} diff --git a/org/drip/sample/overnightfeed/AUDOISSmoothReconstitutor.java b/org/drip/sample/overnightfeed/AUDOISSmoothReconstitutor.java deleted file mode 100644 index c6e667e..0000000 --- a/org/drip/sample/overnightfeed/AUDOISSmoothReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.overnightfeed; - -import org.drip.feed.transformer.OvernightIndexMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AUDOISSmoothReconstitutor Demonstrates the Cleansing and the Smooth Re-constitution of the AUD Input OIS - * Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class AUDOISSmoothReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "AUD"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\OvernightMarks\\" + strCurrency + "OISFormatted.csv"; - - OvernightIndexMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/overnightfeed/CADOISSmoothReconstitutor.java b/org/drip/sample/overnightfeed/CADOISSmoothReconstitutor.java deleted file mode 100644 index e381a44..0000000 --- a/org/drip/sample/overnightfeed/CADOISSmoothReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.overnightfeed; - -import org.drip.feed.transformer.OvernightIndexMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CADOISSmoothReconstitutor Demonstrates the Cleansing and the Smooth Re-constitution of the CAD Input OIS - * Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class CADOISSmoothReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "CAD"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\OvernightMarks\\" + strCurrency + "OISFormatted.csv"; - - OvernightIndexMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/overnightfeed/CHFOISSmoothReconstitutor.java b/org/drip/sample/overnightfeed/CHFOISSmoothReconstitutor.java deleted file mode 100644 index bfe6bfc..0000000 --- a/org/drip/sample/overnightfeed/CHFOISSmoothReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.overnightfeed; - -import org.drip.feed.transformer.OvernightIndexMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CHFOISSmoothReconstitutor Demonstrates the Cleansing and the Smooth Re-constitution of the CHF Input OIS - * Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class CHFOISSmoothReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "CHF"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\OvernightMarks\\" + strCurrency + "OISFormatted.csv"; - - OvernightIndexMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/overnightfeed/EUROISSmoothReconstitutor.java b/org/drip/sample/overnightfeed/EUROISSmoothReconstitutor.java deleted file mode 100644 index a11180b..0000000 --- a/org/drip/sample/overnightfeed/EUROISSmoothReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.overnightfeed; - -import org.drip.feed.transformer.OvernightIndexMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * EUROISSmoothReconstitutor Demonstrates the Cleansing and the Smooth Re-constitution of the EUR Input OIS - * Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class EUROISSmoothReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "EUR"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\OvernightMarks\\" + strCurrency + "OISFormatted.csv"; - - OvernightIndexMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/overnightfeed/GBPOISSmoothReconstitutor.java b/org/drip/sample/overnightfeed/GBPOISSmoothReconstitutor.java deleted file mode 100644 index de2bde7..0000000 --- a/org/drip/sample/overnightfeed/GBPOISSmoothReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.overnightfeed; - -import org.drip.feed.transformer.OvernightIndexMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * GBPOISSmoothReconstitutor Demonstrates the Cleansing and the Smooth Re-constitution of the GBP Input OIS - * Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class GBPOISSmoothReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "GBP"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\OvernightMarks\\" + strCurrency + "OISFormatted.csv"; - - OvernightIndexMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/overnightfeed/JPYOISSmoothReconstitutor.java b/org/drip/sample/overnightfeed/JPYOISSmoothReconstitutor.java deleted file mode 100644 index 9252fcc..0000000 --- a/org/drip/sample/overnightfeed/JPYOISSmoothReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.overnightfeed; - -import org.drip.feed.transformer.OvernightIndexMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * JPYOISSmoothReconstitutor Demonstrates the Cleansing and the Smooth Re-constitution of the JPY Input OIS - * Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class JPYOISSmoothReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "JPY"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\OvernightMarks\\" + strCurrency + "OISFormatted.csv"; - - OvernightIndexMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/overnightfeed/NZDOISSmoothReconstitutor.java b/org/drip/sample/overnightfeed/NZDOISSmoothReconstitutor.java deleted file mode 100644 index 48b4882..0000000 --- a/org/drip/sample/overnightfeed/NZDOISSmoothReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.overnightfeed; - -import org.drip.feed.transformer.OvernightIndexMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NZDOISSmoothReconstitutor Demonstrates the Cleansing and the Smooth Re-constitution of the NZD Input OIS - * Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class NZDOISSmoothReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "NZD"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\OvernightMarks\\" + strCurrency + "OISFormatted.csv"; - - OvernightIndexMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/overnightfeed/SEKOISSmoothReconstitutor.java b/org/drip/sample/overnightfeed/SEKOISSmoothReconstitutor.java deleted file mode 100644 index 3449aef..0000000 --- a/org/drip/sample/overnightfeed/SEKOISSmoothReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.overnightfeed; - -import org.drip.feed.transformer.OvernightIndexMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * SEKOISSmoothReconstitutor Demonstrates the Cleansing and the Smooth Re-constitution of the SEK Input OIS - * Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class SEKOISSmoothReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "SEK"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\OvernightMarks\\" + strCurrency + "OISFormatted.csv"; - - OvernightIndexMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/overnightfeed/USDOISSmoothReconstitutor.java b/org/drip/sample/overnightfeed/USDOISSmoothReconstitutor.java deleted file mode 100644 index a305fe4..0000000 --- a/org/drip/sample/overnightfeed/USDOISSmoothReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.overnightfeed; - -import org.drip.feed.transformer.OvernightIndexMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * USDOISSmoothReconstitutor Demonstrates the Cleansing and the Smooth Re-constitution of the USD Input OIS - * Marks. - * - * @author Lakshmi Krishnamurthy - */ - -public class USDOISSmoothReconstitutor { - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - String strFundingMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\OvernightMarks\\" + strCurrency + "OISFormatted.csv"; - - OvernightIndexMarksReconstitutor.ShapePreservingRegularization ( - strCurrency, - strFundingMarksLocation - ); - } -} diff --git a/org/drip/sample/overnighthistorical/AUDSmooth1MForward.java b/org/drip/sample/overnighthistorical/AUDSmooth1MForward.java deleted file mode 100644 index db40c2d..0000000 --- a/org/drip/sample/overnighthistorical/AUDSmooth1MForward.java +++ /dev/null @@ -1,217 +0,0 @@ - -package org.drip.sample.overnighthistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.OvernightCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AUDSmooth1MForward Generates the Historical AUD Smoothened Overnight Curve Native 1M Compounded Forward - * Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class AUDSmooth1MForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "AUD"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\OvernightOISMarks\\" + strCurrency + "OISSmoothReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1M" - }; - String[] astrInTenor = new String[] { - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "9M", - "1Y", - "18M", - "2Y", - "3Y", - "4Y", - "5Y" - }; - String[] astrOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "9M", - "1Y", - "18M", - "2Y", - "3Y", - "4Y", - "5Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblOISQuote1W = csvGrid.doubleArrayAtColumn (1); - - double[] adblOISQuote2W = csvGrid.doubleArrayAtColumn (2); - - double[] adblOISQuote3W = csvGrid.doubleArrayAtColumn (3); - - double[] adblOISQuote1M = csvGrid.doubleArrayAtColumn (4); - - double[] adblOISQuote2M = csvGrid.doubleArrayAtColumn (5); - - double[] adblOISQuote3M = csvGrid.doubleArrayAtColumn (6); - - double[] adblOISQuote4M = csvGrid.doubleArrayAtColumn (7); - - double[] adblOISQuote5M = csvGrid.doubleArrayAtColumn (8); - - double[] adblOISQuote6M = csvGrid.doubleArrayAtColumn (9); - - double[] adblOISQuote9M = csvGrid.doubleArrayAtColumn (10); - - double[] adblOISQuote1Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblOISQuote18M = csvGrid.doubleArrayAtColumn (12); - - double[] adblOISQuote2Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblOISQuote3Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblOISQuote4Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblOISQuote5Y = csvGrid.doubleArrayAtColumn (16); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblOISQuote = new double[iNumClose][16]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblOISQuote[i][0] = adblOISQuote1W[i]; - aadblOISQuote[i][1] = adblOISQuote2W[i]; - aadblOISQuote[i][2] = adblOISQuote3W[i]; - aadblOISQuote[i][3] = adblOISQuote1M[i]; - aadblOISQuote[i][4] = adblOISQuote2M[i]; - aadblOISQuote[i][5] = adblOISQuote3M[i]; - aadblOISQuote[i][6] = adblOISQuote4M[i]; - aadblOISQuote[i][7] = adblOISQuote5M[i]; - aadblOISQuote[i][8] = adblOISQuote6M[i]; - aadblOISQuote[i][9] = adblOISQuote9M[i]; - aadblOISQuote[i][10] = adblOISQuote1Y[i]; - aadblOISQuote[i][11] = adblOISQuote18M[i]; - aadblOISQuote[i][12] = adblOISQuote2Y[i]; - aadblOISQuote[i][13] = adblOISQuote3Y[i]; - aadblOISQuote[i][14] = adblOISQuote4Y[i]; - aadblOISQuote[i][15] = adblOISQuote5Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = OvernightCurveAPI.HorizonMetrics ( - adtSpot, - astrOISMaturityTenor, - aadblOISQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SMOOTH - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/overnighthistorical/CADSmooth1MForward.java b/org/drip/sample/overnighthistorical/CADSmooth1MForward.java deleted file mode 100644 index 62a360a..0000000 --- a/org/drip/sample/overnighthistorical/CADSmooth1MForward.java +++ /dev/null @@ -1,217 +0,0 @@ - -package org.drip.sample.overnighthistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.OvernightCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CADSmooth1MForward Generates the Historical CAD Smoothened Overnight Curve Native 1M Compounded Forward - * Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class CADSmooth1MForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "CAD"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\OvernightOISMarks\\" + strCurrency + "OISSmoothReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1M" - }; - String[] astrInTenor = new String[] { - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "9M", - "1Y", - "18M", - "2Y", - "3Y", - "4Y", - "5Y" - }; - String[] astrOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "9M", - "1Y", - "18M", - "2Y", - "3Y", - "4Y", - "5Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblOISQuote1W = csvGrid.doubleArrayAtColumn (1); - - double[] adblOISQuote2W = csvGrid.doubleArrayAtColumn (2); - - double[] adblOISQuote3W = csvGrid.doubleArrayAtColumn (3); - - double[] adblOISQuote1M = csvGrid.doubleArrayAtColumn (4); - - double[] adblOISQuote2M = csvGrid.doubleArrayAtColumn (5); - - double[] adblOISQuote3M = csvGrid.doubleArrayAtColumn (6); - - double[] adblOISQuote4M = csvGrid.doubleArrayAtColumn (7); - - double[] adblOISQuote5M = csvGrid.doubleArrayAtColumn (8); - - double[] adblOISQuote6M = csvGrid.doubleArrayAtColumn (9); - - double[] adblOISQuote9M = csvGrid.doubleArrayAtColumn (10); - - double[] adblOISQuote1Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblOISQuote18M = csvGrid.doubleArrayAtColumn (12); - - double[] adblOISQuote2Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblOISQuote3Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblOISQuote4Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblOISQuote5Y = csvGrid.doubleArrayAtColumn (16); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblOISQuote = new double[iNumClose][16]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblOISQuote[i][0] = adblOISQuote1W[i]; - aadblOISQuote[i][1] = adblOISQuote2W[i]; - aadblOISQuote[i][2] = adblOISQuote3W[i]; - aadblOISQuote[i][3] = adblOISQuote1M[i]; - aadblOISQuote[i][4] = adblOISQuote2M[i]; - aadblOISQuote[i][5] = adblOISQuote3M[i]; - aadblOISQuote[i][6] = adblOISQuote4M[i]; - aadblOISQuote[i][7] = adblOISQuote5M[i]; - aadblOISQuote[i][8] = adblOISQuote6M[i]; - aadblOISQuote[i][9] = adblOISQuote9M[i]; - aadblOISQuote[i][10] = adblOISQuote1Y[i]; - aadblOISQuote[i][11] = adblOISQuote18M[i]; - aadblOISQuote[i][12] = adblOISQuote2Y[i]; - aadblOISQuote[i][13] = adblOISQuote3Y[i]; - aadblOISQuote[i][14] = adblOISQuote4Y[i]; - aadblOISQuote[i][15] = adblOISQuote5Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = OvernightCurveAPI.HorizonMetrics ( - adtSpot, - astrOISMaturityTenor, - aadblOISQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SMOOTH - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/overnighthistorical/CHFSmooth1MForward.java b/org/drip/sample/overnighthistorical/CHFSmooth1MForward.java deleted file mode 100644 index 113099d..0000000 --- a/org/drip/sample/overnighthistorical/CHFSmooth1MForward.java +++ /dev/null @@ -1,217 +0,0 @@ - -package org.drip.sample.overnighthistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.OvernightCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CHFSmooth1MForward Generates the Historical CHF Smoothened Overnight Curve Native 1M Compounded Forward - * Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class CHFSmooth1MForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "EUR"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\OvernightOISMarks\\" + strCurrency + "OISSmoothReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1M" - }; - String[] astrInTenor = new String[] { - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "9M", - "1Y", - "18M", - "2Y", - "3Y", - "4Y", - "5Y" - }; - String[] astrOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "9M", - "1Y", - "18M", - "2Y", - "3Y", - "4Y", - "5Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblOISQuote1W = csvGrid.doubleArrayAtColumn (1); - - double[] adblOISQuote2W = csvGrid.doubleArrayAtColumn (2); - - double[] adblOISQuote3W = csvGrid.doubleArrayAtColumn (3); - - double[] adblOISQuote1M = csvGrid.doubleArrayAtColumn (4); - - double[] adblOISQuote2M = csvGrid.doubleArrayAtColumn (5); - - double[] adblOISQuote3M = csvGrid.doubleArrayAtColumn (6); - - double[] adblOISQuote4M = csvGrid.doubleArrayAtColumn (7); - - double[] adblOISQuote5M = csvGrid.doubleArrayAtColumn (8); - - double[] adblOISQuote6M = csvGrid.doubleArrayAtColumn (9); - - double[] adblOISQuote9M = csvGrid.doubleArrayAtColumn (10); - - double[] adblOISQuote1Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblOISQuote18M = csvGrid.doubleArrayAtColumn (12); - - double[] adblOISQuote2Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblOISQuote3Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblOISQuote4Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblOISQuote5Y = csvGrid.doubleArrayAtColumn (16); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblOISQuote = new double[iNumClose][16]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblOISQuote[i][0] = adblOISQuote1W[i]; - aadblOISQuote[i][1] = adblOISQuote2W[i]; - aadblOISQuote[i][2] = adblOISQuote3W[i]; - aadblOISQuote[i][3] = adblOISQuote1M[i]; - aadblOISQuote[i][4] = adblOISQuote2M[i]; - aadblOISQuote[i][5] = adblOISQuote3M[i]; - aadblOISQuote[i][6] = adblOISQuote4M[i]; - aadblOISQuote[i][7] = adblOISQuote5M[i]; - aadblOISQuote[i][8] = adblOISQuote6M[i]; - aadblOISQuote[i][9] = adblOISQuote9M[i]; - aadblOISQuote[i][10] = adblOISQuote1Y[i]; - aadblOISQuote[i][11] = adblOISQuote18M[i]; - aadblOISQuote[i][12] = adblOISQuote2Y[i]; - aadblOISQuote[i][13] = adblOISQuote3Y[i]; - aadblOISQuote[i][14] = adblOISQuote4Y[i]; - aadblOISQuote[i][15] = adblOISQuote5Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = OvernightCurveAPI.HorizonMetrics ( - adtSpot, - astrOISMaturityTenor, - aadblOISQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SMOOTH - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/overnighthistorical/EURSmooth1MForward.java b/org/drip/sample/overnighthistorical/EURSmooth1MForward.java deleted file mode 100644 index 248bda4..0000000 --- a/org/drip/sample/overnighthistorical/EURSmooth1MForward.java +++ /dev/null @@ -1,217 +0,0 @@ - -package org.drip.sample.overnighthistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.OvernightCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * EURSmooth1MForward Generates the Historical EUR Smoothened Overnight Curve Native 1M Compounded Forward - * Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class EURSmooth1MForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "EUR"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\OvernightOISMarks\\" + strCurrency + "OISSmoothReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1M" - }; - String[] astrInTenor = new String[] { - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "9M", - "1Y", - "18M", - "2Y", - "3Y", - "4Y", - "5Y" - }; - String[] astrOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "9M", - "1Y", - "18M", - "2Y", - "3Y", - "4Y", - "5Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblOISQuote1W = csvGrid.doubleArrayAtColumn (1); - - double[] adblOISQuote2W = csvGrid.doubleArrayAtColumn (2); - - double[] adblOISQuote3W = csvGrid.doubleArrayAtColumn (3); - - double[] adblOISQuote1M = csvGrid.doubleArrayAtColumn (4); - - double[] adblOISQuote2M = csvGrid.doubleArrayAtColumn (5); - - double[] adblOISQuote3M = csvGrid.doubleArrayAtColumn (6); - - double[] adblOISQuote4M = csvGrid.doubleArrayAtColumn (7); - - double[] adblOISQuote5M = csvGrid.doubleArrayAtColumn (8); - - double[] adblOISQuote6M = csvGrid.doubleArrayAtColumn (9); - - double[] adblOISQuote9M = csvGrid.doubleArrayAtColumn (10); - - double[] adblOISQuote1Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblOISQuote18M = csvGrid.doubleArrayAtColumn (12); - - double[] adblOISQuote2Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblOISQuote3Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblOISQuote4Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblOISQuote5Y = csvGrid.doubleArrayAtColumn (16); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblOISQuote = new double[iNumClose][16]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblOISQuote[i][0] = adblOISQuote1W[i]; - aadblOISQuote[i][1] = adblOISQuote2W[i]; - aadblOISQuote[i][2] = adblOISQuote3W[i]; - aadblOISQuote[i][3] = adblOISQuote1M[i]; - aadblOISQuote[i][4] = adblOISQuote2M[i]; - aadblOISQuote[i][5] = adblOISQuote3M[i]; - aadblOISQuote[i][6] = adblOISQuote4M[i]; - aadblOISQuote[i][7] = adblOISQuote5M[i]; - aadblOISQuote[i][8] = adblOISQuote6M[i]; - aadblOISQuote[i][9] = adblOISQuote9M[i]; - aadblOISQuote[i][10] = adblOISQuote1Y[i]; - aadblOISQuote[i][11] = adblOISQuote18M[i]; - aadblOISQuote[i][12] = adblOISQuote2Y[i]; - aadblOISQuote[i][13] = adblOISQuote3Y[i]; - aadblOISQuote[i][14] = adblOISQuote4Y[i]; - aadblOISQuote[i][15] = adblOISQuote5Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = OvernightCurveAPI.HorizonMetrics ( - adtSpot, - astrOISMaturityTenor, - aadblOISQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SMOOTH - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/overnighthistorical/GBPSmooth1MForward.java b/org/drip/sample/overnighthistorical/GBPSmooth1MForward.java deleted file mode 100644 index 16a6f89..0000000 --- a/org/drip/sample/overnighthistorical/GBPSmooth1MForward.java +++ /dev/null @@ -1,217 +0,0 @@ - -package org.drip.sample.overnighthistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.OvernightCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * GBPSmooth1MForward Generates the Historical GBP Smoothened Overnight Curve Native 1M Compounded Forward - * Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class GBPSmooth1MForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "GBP"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\OvernightOISMarks\\" + strCurrency + "OISSmoothReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1M" - }; - String[] astrInTenor = new String[] { - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "9M", - "1Y", - "18M", - "2Y", - "3Y", - "4Y", - "5Y" - }; - String[] astrOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "9M", - "1Y", - "18M", - "2Y", - "3Y", - "4Y", - "5Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblOISQuote1W = csvGrid.doubleArrayAtColumn (1); - - double[] adblOISQuote2W = csvGrid.doubleArrayAtColumn (2); - - double[] adblOISQuote3W = csvGrid.doubleArrayAtColumn (3); - - double[] adblOISQuote1M = csvGrid.doubleArrayAtColumn (4); - - double[] adblOISQuote2M = csvGrid.doubleArrayAtColumn (5); - - double[] adblOISQuote3M = csvGrid.doubleArrayAtColumn (6); - - double[] adblOISQuote4M = csvGrid.doubleArrayAtColumn (7); - - double[] adblOISQuote5M = csvGrid.doubleArrayAtColumn (8); - - double[] adblOISQuote6M = csvGrid.doubleArrayAtColumn (9); - - double[] adblOISQuote9M = csvGrid.doubleArrayAtColumn (10); - - double[] adblOISQuote1Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblOISQuote18M = csvGrid.doubleArrayAtColumn (12); - - double[] adblOISQuote2Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblOISQuote3Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblOISQuote4Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblOISQuote5Y = csvGrid.doubleArrayAtColumn (16); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblOISQuote = new double[iNumClose][16]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblOISQuote[i][0] = adblOISQuote1W[i]; - aadblOISQuote[i][1] = adblOISQuote2W[i]; - aadblOISQuote[i][2] = adblOISQuote3W[i]; - aadblOISQuote[i][3] = adblOISQuote1M[i]; - aadblOISQuote[i][4] = adblOISQuote2M[i]; - aadblOISQuote[i][5] = adblOISQuote3M[i]; - aadblOISQuote[i][6] = adblOISQuote4M[i]; - aadblOISQuote[i][7] = adblOISQuote5M[i]; - aadblOISQuote[i][8] = adblOISQuote6M[i]; - aadblOISQuote[i][9] = adblOISQuote9M[i]; - aadblOISQuote[i][10] = adblOISQuote1Y[i]; - aadblOISQuote[i][11] = adblOISQuote18M[i]; - aadblOISQuote[i][12] = adblOISQuote2Y[i]; - aadblOISQuote[i][13] = adblOISQuote3Y[i]; - aadblOISQuote[i][14] = adblOISQuote4Y[i]; - aadblOISQuote[i][15] = adblOISQuote5Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = OvernightCurveAPI.HorizonMetrics ( - adtSpot, - astrOISMaturityTenor, - aadblOISQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SMOOTH - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/overnighthistorical/JPYSmooth1MForward.java b/org/drip/sample/overnighthistorical/JPYSmooth1MForward.java deleted file mode 100644 index 964ed43..0000000 --- a/org/drip/sample/overnighthistorical/JPYSmooth1MForward.java +++ /dev/null @@ -1,217 +0,0 @@ - -package org.drip.sample.overnighthistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.OvernightCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * JPYSmooth1MForward Generates the Historical JPY Smoothened Overnight Curve Native 1M Compounded Forward - * Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class JPYSmooth1MForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "JPY"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\OvernightOISMarks\\" + strCurrency + "OISSmoothReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1M" - }; - String[] astrInTenor = new String[] { - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "9M", - "1Y", - "18M", - "2Y", - "3Y", - "4Y", - "5Y" - }; - String[] astrOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "9M", - "1Y", - "18M", - "2Y", - "3Y", - "4Y", - "5Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblOISQuote1W = csvGrid.doubleArrayAtColumn (1); - - double[] adblOISQuote2W = csvGrid.doubleArrayAtColumn (2); - - double[] adblOISQuote3W = csvGrid.doubleArrayAtColumn (3); - - double[] adblOISQuote1M = csvGrid.doubleArrayAtColumn (4); - - double[] adblOISQuote2M = csvGrid.doubleArrayAtColumn (5); - - double[] adblOISQuote3M = csvGrid.doubleArrayAtColumn (6); - - double[] adblOISQuote4M = csvGrid.doubleArrayAtColumn (7); - - double[] adblOISQuote5M = csvGrid.doubleArrayAtColumn (8); - - double[] adblOISQuote6M = csvGrid.doubleArrayAtColumn (9); - - double[] adblOISQuote9M = csvGrid.doubleArrayAtColumn (10); - - double[] adblOISQuote1Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblOISQuote18M = csvGrid.doubleArrayAtColumn (12); - - double[] adblOISQuote2Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblOISQuote3Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblOISQuote4Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblOISQuote5Y = csvGrid.doubleArrayAtColumn (16); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblOISQuote = new double[iNumClose][16]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblOISQuote[i][0] = adblOISQuote1W[i]; - aadblOISQuote[i][1] = adblOISQuote2W[i]; - aadblOISQuote[i][2] = adblOISQuote3W[i]; - aadblOISQuote[i][3] = adblOISQuote1M[i]; - aadblOISQuote[i][4] = adblOISQuote2M[i]; - aadblOISQuote[i][5] = adblOISQuote3M[i]; - aadblOISQuote[i][6] = adblOISQuote4M[i]; - aadblOISQuote[i][7] = adblOISQuote5M[i]; - aadblOISQuote[i][8] = adblOISQuote6M[i]; - aadblOISQuote[i][9] = adblOISQuote9M[i]; - aadblOISQuote[i][10] = adblOISQuote1Y[i]; - aadblOISQuote[i][11] = adblOISQuote18M[i]; - aadblOISQuote[i][12] = adblOISQuote2Y[i]; - aadblOISQuote[i][13] = adblOISQuote3Y[i]; - aadblOISQuote[i][14] = adblOISQuote4Y[i]; - aadblOISQuote[i][15] = adblOISQuote5Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = OvernightCurveAPI.HorizonMetrics ( - adtSpot, - astrOISMaturityTenor, - aadblOISQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SMOOTH - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/overnighthistorical/NZDSmooth1MForward.java b/org/drip/sample/overnighthistorical/NZDSmooth1MForward.java deleted file mode 100644 index 1c32780..0000000 --- a/org/drip/sample/overnighthistorical/NZDSmooth1MForward.java +++ /dev/null @@ -1,217 +0,0 @@ - -package org.drip.sample.overnighthistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.OvernightCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NZDSmooth1MForward Generates the Historical NZD Smoothened Overnight Curve Native 1M Compounded Forward - * Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class NZDSmooth1MForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "NZD"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\OvernightOISMarks\\" + strCurrency + "OISSmoothReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1M" - }; - String[] astrInTenor = new String[] { - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "9M", - "1Y", - "18M", - "2Y", - "3Y", - "4Y", - "5Y" - }; - String[] astrOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "9M", - "1Y", - "18M", - "2Y", - "3Y", - "4Y", - "5Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblOISQuote1W = csvGrid.doubleArrayAtColumn (1); - - double[] adblOISQuote2W = csvGrid.doubleArrayAtColumn (2); - - double[] adblOISQuote3W = csvGrid.doubleArrayAtColumn (3); - - double[] adblOISQuote1M = csvGrid.doubleArrayAtColumn (4); - - double[] adblOISQuote2M = csvGrid.doubleArrayAtColumn (5); - - double[] adblOISQuote3M = csvGrid.doubleArrayAtColumn (6); - - double[] adblOISQuote4M = csvGrid.doubleArrayAtColumn (7); - - double[] adblOISQuote5M = csvGrid.doubleArrayAtColumn (8); - - double[] adblOISQuote6M = csvGrid.doubleArrayAtColumn (9); - - double[] adblOISQuote9M = csvGrid.doubleArrayAtColumn (10); - - double[] adblOISQuote1Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblOISQuote18M = csvGrid.doubleArrayAtColumn (12); - - double[] adblOISQuote2Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblOISQuote3Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblOISQuote4Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblOISQuote5Y = csvGrid.doubleArrayAtColumn (16); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblOISQuote = new double[iNumClose][16]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblOISQuote[i][0] = adblOISQuote1W[i]; - aadblOISQuote[i][1] = adblOISQuote2W[i]; - aadblOISQuote[i][2] = adblOISQuote3W[i]; - aadblOISQuote[i][3] = adblOISQuote1M[i]; - aadblOISQuote[i][4] = adblOISQuote2M[i]; - aadblOISQuote[i][5] = adblOISQuote3M[i]; - aadblOISQuote[i][6] = adblOISQuote4M[i]; - aadblOISQuote[i][7] = adblOISQuote5M[i]; - aadblOISQuote[i][8] = adblOISQuote6M[i]; - aadblOISQuote[i][9] = adblOISQuote9M[i]; - aadblOISQuote[i][10] = adblOISQuote1Y[i]; - aadblOISQuote[i][11] = adblOISQuote18M[i]; - aadblOISQuote[i][12] = adblOISQuote2Y[i]; - aadblOISQuote[i][13] = adblOISQuote3Y[i]; - aadblOISQuote[i][14] = adblOISQuote4Y[i]; - aadblOISQuote[i][15] = adblOISQuote5Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = OvernightCurveAPI.HorizonMetrics ( - adtSpot, - astrOISMaturityTenor, - aadblOISQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SMOOTH - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/overnighthistorical/SEKSmooth1MForward.java b/org/drip/sample/overnighthistorical/SEKSmooth1MForward.java deleted file mode 100644 index 2e23ae1..0000000 --- a/org/drip/sample/overnighthistorical/SEKSmooth1MForward.java +++ /dev/null @@ -1,217 +0,0 @@ - -package org.drip.sample.overnighthistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.OvernightCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * SEKSmooth1MForward Generates the Historical SEK Smoothened Overnight Curve Native 1M Compounded Forward - * Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class SEKSmooth1MForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "SEK"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\OvernightOISMarks\\" + strCurrency + "OISSmoothReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1M" - }; - String[] astrInTenor = new String[] { - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "9M", - "1Y", - "18M", - "2Y", - "3Y", - "4Y", - "5Y" - }; - String[] astrOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "9M", - "1Y", - "18M", - "2Y", - "3Y", - "4Y", - "5Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblOISQuote1W = csvGrid.doubleArrayAtColumn (1); - - double[] adblOISQuote2W = csvGrid.doubleArrayAtColumn (2); - - double[] adblOISQuote3W = csvGrid.doubleArrayAtColumn (3); - - double[] adblOISQuote1M = csvGrid.doubleArrayAtColumn (4); - - double[] adblOISQuote2M = csvGrid.doubleArrayAtColumn (5); - - double[] adblOISQuote3M = csvGrid.doubleArrayAtColumn (6); - - double[] adblOISQuote4M = csvGrid.doubleArrayAtColumn (7); - - double[] adblOISQuote5M = csvGrid.doubleArrayAtColumn (8); - - double[] adblOISQuote6M = csvGrid.doubleArrayAtColumn (9); - - double[] adblOISQuote9M = csvGrid.doubleArrayAtColumn (10); - - double[] adblOISQuote1Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblOISQuote18M = csvGrid.doubleArrayAtColumn (12); - - double[] adblOISQuote2Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblOISQuote3Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblOISQuote4Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblOISQuote5Y = csvGrid.doubleArrayAtColumn (16); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblOISQuote = new double[iNumClose][16]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblOISQuote[i][0] = adblOISQuote1W[i]; - aadblOISQuote[i][1] = adblOISQuote2W[i]; - aadblOISQuote[i][2] = adblOISQuote3W[i]; - aadblOISQuote[i][3] = adblOISQuote1M[i]; - aadblOISQuote[i][4] = adblOISQuote2M[i]; - aadblOISQuote[i][5] = adblOISQuote3M[i]; - aadblOISQuote[i][6] = adblOISQuote4M[i]; - aadblOISQuote[i][7] = adblOISQuote5M[i]; - aadblOISQuote[i][8] = adblOISQuote6M[i]; - aadblOISQuote[i][9] = adblOISQuote9M[i]; - aadblOISQuote[i][10] = adblOISQuote1Y[i]; - aadblOISQuote[i][11] = adblOISQuote18M[i]; - aadblOISQuote[i][12] = adblOISQuote2Y[i]; - aadblOISQuote[i][13] = adblOISQuote3Y[i]; - aadblOISQuote[i][14] = adblOISQuote4Y[i]; - aadblOISQuote[i][15] = adblOISQuote5Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = OvernightCurveAPI.HorizonMetrics ( - adtSpot, - astrOISMaturityTenor, - aadblOISQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SMOOTH - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/overnighthistorical/USDSmooth1MForward.java b/org/drip/sample/overnighthistorical/USDSmooth1MForward.java deleted file mode 100644 index ddd8ef4..0000000 --- a/org/drip/sample/overnighthistorical/USDSmooth1MForward.java +++ /dev/null @@ -1,217 +0,0 @@ - -package org.drip.sample.overnighthistorical; - -import java.util.Map; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.state.FundingCurveMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.state.OvernightCurveAPI; -import org.drip.service.template.LatentMarketStateBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * USDSmooth1MForward Generates the Historical USD Smoothened Overnight Curve Native 1M Compounded Forward - * Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class USDSmooth1MForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\OvernightOISMarks\\" + strCurrency + "OISSmoothReconstitutor.csv"; - String[] astrForTenor = new String[] { - "1M" - }; - String[] astrInTenor = new String[] { - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "9M", - "1Y", - "18M", - "2Y", - "3Y", - "4Y", - "5Y" - }; - String[] astrOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M", - "6M", - "9M", - "1Y", - "18M", - "2Y", - "3Y", - "4Y", - "5Y" - }; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strClosesLocation, - true - ); - - JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); - - double[] adblOISQuote1W = csvGrid.doubleArrayAtColumn (1); - - double[] adblOISQuote2W = csvGrid.doubleArrayAtColumn (2); - - double[] adblOISQuote3W = csvGrid.doubleArrayAtColumn (3); - - double[] adblOISQuote1M = csvGrid.doubleArrayAtColumn (4); - - double[] adblOISQuote2M = csvGrid.doubleArrayAtColumn (5); - - double[] adblOISQuote3M = csvGrid.doubleArrayAtColumn (6); - - double[] adblOISQuote4M = csvGrid.doubleArrayAtColumn (7); - - double[] adblOISQuote5M = csvGrid.doubleArrayAtColumn (8); - - double[] adblOISQuote6M = csvGrid.doubleArrayAtColumn (9); - - double[] adblOISQuote9M = csvGrid.doubleArrayAtColumn (10); - - double[] adblOISQuote1Y = csvGrid.doubleArrayAtColumn (11); - - double[] adblOISQuote18M = csvGrid.doubleArrayAtColumn (12); - - double[] adblOISQuote2Y = csvGrid.doubleArrayAtColumn (13); - - double[] adblOISQuote3Y = csvGrid.doubleArrayAtColumn (14); - - double[] adblOISQuote4Y = csvGrid.doubleArrayAtColumn (15); - - double[] adblOISQuote5Y = csvGrid.doubleArrayAtColumn (16); - - int iNumClose = adtClose.length; - JulianDate[] adtSpot = new JulianDate[iNumClose]; - double[][] aadblOISQuote = new double[iNumClose][16]; - - for (int i = 0; i < iNumClose; ++i) { - adtSpot[i] = adtClose[i]; - aadblOISQuote[i][0] = adblOISQuote1W[i]; - aadblOISQuote[i][1] = adblOISQuote2W[i]; - aadblOISQuote[i][2] = adblOISQuote3W[i]; - aadblOISQuote[i][3] = adblOISQuote1M[i]; - aadblOISQuote[i][4] = adblOISQuote2M[i]; - aadblOISQuote[i][5] = adblOISQuote3M[i]; - aadblOISQuote[i][6] = adblOISQuote4M[i]; - aadblOISQuote[i][7] = adblOISQuote5M[i]; - aadblOISQuote[i][8] = adblOISQuote6M[i]; - aadblOISQuote[i][9] = adblOISQuote9M[i]; - aadblOISQuote[i][10] = adblOISQuote1Y[i]; - aadblOISQuote[i][11] = adblOISQuote18M[i]; - aadblOISQuote[i][12] = adblOISQuote2Y[i]; - aadblOISQuote[i][13] = adblOISQuote3Y[i]; - aadblOISQuote[i][14] = adblOISQuote4Y[i]; - aadblOISQuote[i][15] = adblOISQuote5Y[i]; - } - - String strDump = "Date"; - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + strInTenor + strForTenor; - } - - System.out.println (strDump); - - Map mapFCM = OvernightCurveAPI.HorizonMetrics ( - adtSpot, - astrOISMaturityTenor, - aadblOISQuote, - astrInTenor, - astrForTenor, - strCurrency, - LatentMarketStateBuilder.SMOOTH - ); - - for (int i = 0; i < iNumClose; ++i) { - FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); - - strDump = adtSpot[i].toString(); - - for (String strInTenor : astrInTenor) { - for (String strForTenor : astrForTenor) - strDump += "," + FormatUtil.FormatDouble ( - fcm.nativeForwardRate ( - strInTenor, - strForTenor - ), 1, 5, 100. - ); - } - - System.out.println (strDump); - } - } -} diff --git a/org/drip/sample/piterbarg2010/CSAFundingAbsoluteForward.java b/org/drip/sample/piterbarg2010/CSAFundingAbsoluteForward.java deleted file mode 100644 index a38f571..0000000 --- a/org/drip/sample/piterbarg2010/CSAFundingAbsoluteForward.java +++ /dev/null @@ -1,155 +0,0 @@ - -package org.drip.sample.piterbarg2010; - -import org.drip.measure.dynamics.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.xva.collateralized.FundingBasisEvolver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CSAFundingAbsoluteForward compares the Absolute Differences between the CSA and the non-CSA Forward LIBOR - * under a Stochastic Funding Model. The References are: - * - * - Barden, P. (2009): Equity Forward Prices in the Presence of Funding Spreads, ICBI Conference, Rome. - * - * - Burgard, C., and M. Kjaer (2009): Modeling and successful Management of Credit Counter-party Risk of - * Derivative Portfolios, ICBI Conference, Rome. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Johannes, M., and S. Sundaresan (2007): Pricing Collateralized Swaps, Journal of Finance 62 383-410. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CSAFundingAbsoluteForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblUnderlyingVolatility = 0.3; - double dblFundingSpreadVolatility = 0.015; - double dblFundingSpreadMeanReversionRate = 0.05; - double dblCSALIBOR = 0.018; - - double[] adblCorrelation = new double[] { - -0.20, - 0.00, - 0.20, - 0.40 - }; - - int[] aiTenor = new int[] { - 1, - 2, - 3, - 4, - 5, - 7, - 10, - 15, - 20, - 25, - 30 - }; - - DiffusionEvaluatorLogarithmic delUnderlying = DiffusionEvaluatorLogarithmic.Standard ( - 0., - dblUnderlyingVolatility - ); - - DiffusionEvaluatorMeanReversion demrFundingSpread = DiffusionEvaluatorMeanReversion.Standard ( - dblFundingSpreadMeanReversionRate, - 0., - dblFundingSpreadVolatility - ); - - System.out.println(); - - System.out.println ("\t||--------------------------------------------||"); - - System.out.println ("\t|| DRIP CSA vs Non CSA Forward Rates ||"); - - System.out.println ("\t||--------------------------------------------||"); - - String strHeader = "\t|| CORR => "; - - for (double dblCorrelation : adblCorrelation) - strHeader = strHeader + " " + FormatUtil.FormatDouble (dblCorrelation, 2, 0, 100.) + "% |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t||--------------------------------------------||"); - - for (int iTenor : aiTenor) { - String strDump = "\t|| " + FormatUtil.FormatDouble (iTenor, 2, 0, 1.) + "Y => "; - - for (double dblCorrelation : adblCorrelation) { - FundingBasisEvolver sftf = new FundingBasisEvolver ( - delUnderlying, - demrFundingSpread, - dblCorrelation - ); - - strDump = strDump + " " + FormatUtil.FormatDouble (dblCSALIBOR * (sftf.CSANoCSARatio (iTenor + "Y") - 1.), 1, 2, 100.) + "% |"; - } - - System.out.println (strDump + "|"); - } - - System.out.println ("\t||--------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/piterbarg2010/CSAFundingRelativeForward.java b/org/drip/sample/piterbarg2010/CSAFundingRelativeForward.java deleted file mode 100644 index 8f11ee6..0000000 --- a/org/drip/sample/piterbarg2010/CSAFundingRelativeForward.java +++ /dev/null @@ -1,195 +0,0 @@ - -package org.drip.sample.piterbarg2010; - -import org.drip.measure.dynamics.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.xva.collateralized.FundingBasisEvolver; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CSAFundingRelativeForward compares the Relative Differences between the CSA and the non-CSA Forward Prices - * under a Stochastic Funding Model. The References are: - * - * - Barden, P. (2009): Equity Forward Prices in the Presence of Funding Spreads, ICBI Conference, Rome. - * - * - Burgard, C., and M. Kjaer (2009): Modeling and successful Management of Credit Counter-party Risk of - * Derivative Portfolios, ICBI Conference, Rome. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Johannes, M., and S. Sundaresan (2007): Pricing Collateralized Swaps, Journal of Finance 62 383-410. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CSAFundingRelativeForward { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblUnderlyingVolatility = 0.3; - double dblFundingSpreadVolatility = 0.015; - double dblFundingSpreadMeanReversionRate = 0.05; - - double[] adblCorrelation = new double[] { - -0.30, - -0.20, - -0.10, - 0.00, - 0.10 - }; - - int[] aiTenor = new int[] { - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10 - }; - - double[][] aadblRelativeDifferenceReconciler = new double[][] { - { 0.0007, 0.0004, 0.0002, 0.0000, -0.0002}, - { 0.0026, 0.0017, 0.0009, 0.0000, -0.0009}, - { 0.0058, 0.0039, 0.0019, 0.0000, -0.0019}, - { 0.0102, 0.0068, 0.0034, 0.0000, -0.0034}, - { 0.0157, 0.0104, 0.0052, 0.0000, -0.0052}, - { 0.0223, 0.0148, 0.0074, 0.0000, -0.0073}, - { 0.0300, 0.0199, 0.0099, 0.0000, -0.0098}, - { 0.0387, 0.0256, 0.0127, 0.0000, -0.0126}, - { 0.0485, 0.0320, 0.0159, 0.0000, -0.0156}, - { 0.0592, 0.0391, 0.0194, 0.0000, -0.0190} - }; - - DiffusionEvaluatorLogarithmic delUnderlying = DiffusionEvaluatorLogarithmic.Standard ( - 0., - dblUnderlyingVolatility - ); - - DiffusionEvaluatorMeanReversion demrFundingSpread = DiffusionEvaluatorMeanReversion.Standard ( - dblFundingSpreadMeanReversionRate, - 0., - dblFundingSpreadVolatility - ); - - System.out.println(); - - System.out.println ("\t||-----------------------------------------------------||"); - - System.out.println ("\t|| DRIP CSA vs Non CSA Forward Prices ||"); - - System.out.println ("\t||-----------------------------------------------------||"); - - String strHeader = "\t|| CORR => "; - - for (double dblCorrelation : adblCorrelation) - strHeader = strHeader + " " + FormatUtil.FormatDouble (dblCorrelation, 2, 0, 100.) + "% |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t||-----------------------------------------------------||"); - - for (int iTenor : aiTenor) { - String strDump = "\t|| " + FormatUtil.FormatDouble (iTenor, 2, 0, 1.) + "Y => "; - - for (double dblCorrelation : adblCorrelation) { - FundingBasisEvolver sftf = new FundingBasisEvolver ( - delUnderlying, - demrFundingSpread, - dblCorrelation - ); - - strDump = strDump + " " + FormatUtil.FormatDouble (sftf.CSANoCSARatio (iTenor + "Y") - 1., 1, 2, 100.) + "% |"; - } - - System.out.println (strDump + "|"); - } - - System.out.println ("\t||-----------------------------------------------------||"); - - System.out.println(); - - System.out.println ("\t||-----------------------------------------------------||"); - - System.out.println ("\t|| Piterbarg 2010 CSA vs Non CSA Forward Prices ||"); - - System.out.println ("\t||-----------------------------------------------------||"); - - strHeader = "\t|| CORR => "; - - for (double dblCorrelation : adblCorrelation) - strHeader = strHeader + " " + FormatUtil.FormatDouble (dblCorrelation, 2, 0, 100.) + "% |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t||-----------------------------------------------------||"); - - for (int i = 0; i < aiTenor.length; ++i) { - String strDump = "\t|| " + FormatUtil.FormatDouble (aiTenor[i], 2, 0, 1.) + "Y => "; - - for (int j = 0; j < adblCorrelation.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (aadblRelativeDifferenceReconciler[i][j], 1, 2, 100.) + "% |"; - - System.out.println (strDump + "|"); - } - - System.out.println ("\t||-----------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/piterbarg2010/CSAImpliedMeasureDifference.java b/org/drip/sample/piterbarg2010/CSAImpliedMeasureDifference.java deleted file mode 100644 index 25616ed..0000000 --- a/org/drip/sample/piterbarg2010/CSAImpliedMeasureDifference.java +++ /dev/null @@ -1,394 +0,0 @@ - -package org.drip.sample.piterbarg2010; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.measure.dynamics.*; -import org.drip.param.valuation.ValuationParams; -import org.drip.pricer.option.BlackScholesAlgorithm; -import org.drip.product.option.EuropeanCallPut; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.LatentMarketStateBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.xva.collateralized.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CSAImpliedMeasureDifference compares the Differences between the CSA and the non-CSA Implied Distribution, - * expressed in Implied Volatilities across Strikes, and across Correlations. The References are: - * - * - Barden, P. (2009): Equity Forward Prices in the Presence of Funding Spreads, ICBI Conference, Rome. - * - * - Burgard, C., and M. Kjaer (2009): Modeling and successful Management of Credit Counter-party Risk of - * Derivative Portfolios, ICBI Conference, Rome. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Johannes, M., and S. Sundaresan (2007): Pricing Collateralized Swaps, Journal of Finance 62 383-410. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CSAImpliedMeasureDifference { - - private static final MergedDiscountForwardCurve OvernightCurve ( - final String strCurrency, - final JulianDate dtSpot) - throws Exception - { - String[] astrDepositMaturityTenor = new String[] { - "1D", - // "2D", - "3D" - }; - - double[] adblDepositQuote = new double[] { - 0.0004, // 1D - // 0.0004, // 2D - 0.0004 // 3D - }; - - String[] astrShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - String[] astrOISFuturesEffectiveTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - String[] astrOISFuturesMaturityTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - double[] adblOISFuturesQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - String[] astrLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - return LatentMarketStateBuilder.SmoothOvernightCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "Rate", - astrShortEndOISMaturityTenor, - adblShortEndOISQuote, - "SwapRate", - astrOISFuturesEffectiveTenor, - astrOISFuturesMaturityTenor, - adblOISFuturesQuote, - "SwapRate", - astrLongEndOISMaturityTenor, - adblLongEndOISQuote, - "SwapRate" - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strTenor = "10Y"; - double dblCSAForward = 100.; - double dblFundingSpreadVolatility = 0.015; - double dblFundingSpreadMeanReversionRate = 0.05; - String strCurrency = "USD"; - - JulianDate dtSpot = DateUtil.Today().addBusDays ( - 0, - strCurrency - ); - - double[] adblCorrelation = new double[] { - -0.30, - -0.10, - 0.00, - 0.10 - }; - - double[] adblStrike = new double[] { - 50., - 60., - 70., - 80., - 90., - 100., - 110., - 120., - 130., - 140., - 150. - }; - - double[] adblCSAImpliedVolatility = new double[] { - 0.30, - 0.30, - 0.30, - 0.30, - 0.30, - 0.30, - 0.30, - 0.30, - 0.30, - 0.30, - 0.30 - }; - - double[][] aadblNoCSAForward = new double[adblCorrelation.length][adblStrike.length]; - double[][] aadblMeasureShiftScale = new double[adblCorrelation.length][adblStrike.length]; - - DiffusionEvaluatorMeanReversion demrFundingSpread = DiffusionEvaluatorMeanReversion.Standard ( - dblFundingSpreadMeanReversionRate, - 0., - dblFundingSpreadVolatility - ); - - System.out.println (); - - System.out.println ("\t||----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| PROBABILITY MEASURE DISTRIBUTION SHIFT ||"); - - System.out.println ("\t||----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| L -> R : ||"); - - System.out.println ("\t|| - Correlation ||"); - - System.out.println ("\t|| - Adjustments for Strikes in unit of 10, from 50 to 150 ||"); - - System.out.println ("\t||----------------------------------------------------------------------------------------------------------------------||"); - - for (int j = 0; j < adblCorrelation.length; ++j) { - String strDump = "\t|| " + FormatUtil.FormatDouble (adblCorrelation[j], 2, 0, 100.) + "% => "; - - for (int i = 0; i < adblStrike.length; ++i) { - DiffusionEvaluatorLogarithmic delUnderlying = DiffusionEvaluatorLogarithmic.Standard ( - 0., - adblCSAImpliedVolatility[i] - ); - - FundingBasisEvolver sftf = new FundingBasisEvolver ( - delUnderlying, - demrFundingSpread, - adblCorrelation[j] - ); - - aadblNoCSAForward[j][i] = dblCSAForward * sftf.CSANoCSARatio (strTenor); - - CSAInducedMeasureShift cims = new CSAInducedMeasureShift ( - dblCSAForward, - aadblNoCSAForward[j][i], - dblCSAForward * dblCSAForward * adblCSAImpliedVolatility[i] * adblCSAImpliedVolatility[i] - ); - - aadblMeasureShiftScale[j][i] = cims.densityRescale (adblStrike[i]); - - strDump = strDump + " " + FormatUtil.FormatDouble (aadblMeasureShiftScale[j][i], 1, 4, 1.) + " |"; - } - - System.out.println (strDump + "|");; - } - - System.out.println ("\t||----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println (); - - MergedDiscountForwardCurve dcOvernight = OvernightCurve ( - strCurrency, - dtSpot - ); - - JulianDate dtMaturity = dtSpot.addTenor (strTenor); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - double[] adblPrice = new double[adblStrike.length]; - EuropeanCallPut[] aECP = new EuropeanCallPut[adblStrike.length]; - - System.out.println ("\t||---------------------------------------------------------------------------------------------------------------------------||"); - - String strDump = "\t|| CSA ATM Option Price => "; - - for (int i = 0; i < adblStrike.length; ++i) { - aECP[i] = new EuropeanCallPut ( - dtMaturity, - adblStrike[i] - ); - - Map mapOptionCalc = aECP[i].value ( - valParams, - dblCSAForward, - true, - dcOvernight, - new FlatUnivariate (adblCSAImpliedVolatility[i]), - new BlackScholesAlgorithm() - ); - - adblPrice[i] = mapOptionCalc.get ("CallPrice"); - - strDump = strDump + FormatUtil.FormatDouble (adblPrice[i], 2, 2, 1.) + " |"; - } - - System.out.println (strDump + "|"); - - System.out.println ("\t||---------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println (); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| CSA CONVEXITY ADJUSTMENT IMPLIED VOLATILITY ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| L -> R : ||"); - - System.out.println ("\t|| - Implied Volatility (%) ||"); - - System.out.println ("\t|| - Adjustments for Strikes in unit of 10, from 50 to 150 ||"); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------||"); - - for (int j = 0; j < adblCorrelation.length; ++j) { - strDump = "\t|| " + FormatUtil.FormatDouble (adblCorrelation[j], 2, 0, 100.) + "% => "; - - for (int i = 0; i < adblStrike.length; ++i) { - double dblReimpliedVolatility = aECP[i].implyVolatilityFromCallPrice ( - valParams, - aadblNoCSAForward[j][i], - true, - dcOvernight, - adblPrice[i] - ); - - strDump = strDump + FormatUtil.FormatDouble (dblReimpliedVolatility, 2, 2, 100.) + "% |"; - } - - System.out.println (strDump + "|"); - } - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------||"); - - System.out.println (); - } -} diff --git a/org/drip/sample/piterbarg2010/ForwardContract.java b/org/drip/sample/piterbarg2010/ForwardContract.java deleted file mode 100644 index f996f7e..0000000 --- a/org/drip/sample/piterbarg2010/ForwardContract.java +++ /dev/null @@ -1,371 +0,0 @@ - -package org.drip.sample.piterbarg2010; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.Helper; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.LatentMarketStateBuilder; -import org.drip.state.discount.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * ForwardContract examines the Valuation of Forward Contract under CSA and non-CSA Settle Agreements. CSA is - * proxied using the OIS Curve, and non-CSA using the Issuer Hedge Funding Curve. The corresponding - * Convexity Adjustments using Spread/CSA Covariance are also calculated. The References are: - * - * - Barden, P. (2009): Equity Forward Prices in the Presence of Funding Spreads, ICBI Conference, Rome. - * - * - Burgard, C., and M. Kjaer (2009): Modeling and successful Management of Credit Counter-party Risk of - * Derivative Portfolios, ICBI Conference, Rome. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Johannes, M., and S. Sundaresan (2007): Pricing Collateralized Swaps, Journal of Finance 62 383-410. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class ForwardContract { - - private static final DiscountCurve CSACurve ( - final String strCurrency, - final JulianDate dtSpot) - throws Exception - { - String[] astrDepositMaturityTenor = new String[] { - "1D", - // "2D", - "3D" - }; - - double[] adblDepositQuote = new double[] { - 0.0004, // 1D - // 0.0004, // 2D - 0.0004 // 3D - }; - - String[] astrShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - String[] astrOISFuturesEffectiveTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - String[] astrOISFuturesMaturityTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - double[] adblOISFuturesQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - String[] astrLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - return LatentMarketStateBuilder.SmoothOvernightCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "Rate", - astrShortEndOISMaturityTenor, - adblShortEndOISQuote, - "SwapRate", - astrOISFuturesEffectiveTenor, - astrOISFuturesMaturityTenor, - adblOISFuturesQuote, - "SwapRate", - astrLongEndOISMaturityTenor, - adblLongEndOISQuote, - "SwapRate" - ); - } - - private static final DiscountCurve NonCSACurve ( - final String strCurrency, - final JulianDate dtSpot) - throws Exception - { - String[] astrDepositMaturityTenor = new String[] { - "01D", - "04D", - "07D", - "14D", - "30D", - "60D" - }; - - double[] adblDepositQuote = new double[] { - 0.0013, // 1D - 0.0017, // 2D - 0.0017, // 7D - 0.0018, // 14D - 0.0020, // 30D - 0.0023 // 60D - }; - - double[] adblFuturesQuote = new double[] { - 0.0027, - 0.0032, - 0.0041, - 0.0054, - 0.0077, - 0.0104, - 0.0134, - 0.0160 - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.0166, // 4Y - 0.0206, // 5Y - 0.0241, // 6Y - 0.0269, // 7Y - 0.0292, // 8Y - 0.0311, // 9Y - 0.0326, // 10Y - 0.0340, // 11Y - 0.0351, // 12Y - 0.0375, // 15Y - 0.0393, // 20Y - 0.0402, // 25Y - 0.0407, // 30Y - 0.0409, // 40Y - 0.0409 // 50Y - }; - - return LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - adblFuturesQuote, - "ForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate" - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - double dblATMForward = 50.; - double dblCSAVolatility = 0.1; - double dblCSANonCSASpreadVolatility = 0.2; - double dblCSANonCSASpreadCorrelation = 0.2; - - JulianDate dtSpot = DateUtil.Today().addBusDays ( - 0, - strCurrency - ); - - String[] astrTenor = new String[] { - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "6M", - "9M", - "12M", - "18M", - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - DiscountCurve dcOvernight = CSACurve ( - strCurrency, - dtSpot - ); - - DiscountCurve dcFunding = NonCSACurve ( - strCurrency, - dtSpot - ); - - System.out.println(); - - System.out.println ("\t||-----------------------------------------------||"); - - System.out.println ("\t|| FORWARD CONTRACT CONVEXITY ADJUSTMENT ||"); - - System.out.println ("\t||-----------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Date ||"); - - System.out.println ("\t|| - Spread Numeraire ||"); - - System.out.println ("\t|| - Convexity Adjustment ||"); - - System.out.println ("\t|| - CSA-Funding Convexity Adjustment ||"); - - System.out.println ("\t||-----------------------------------------------||"); - - for (String strTenor : astrTenor) { - JulianDate dt = dtSpot.addTenor (strTenor); - - double dblTenorToYF = Helper.TenorToYearFraction (strTenor); - - double dblSpreadNumeraire = dcFunding.df (dt) / dcOvernight.df (dt); - - double dblConvexityAdjustment = dblCSANonCSASpreadCorrelation * dblCSANonCSASpreadVolatility * dblCSAVolatility; - - System.out.println ("\t|| " + dt + " | " + - FormatUtil.FormatDouble (dblSpreadNumeraire, 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (dblConvexityAdjustment * dblTenorToYF, 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (dblConvexityAdjustment * dblATMForward * dblSpreadNumeraire * dblTenorToYF, 1, 6, 1.) + " ||" - ); - } - - System.out.println ("\t||-----------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/piterbarg2010/ZeroStrikeCallOption.java b/org/drip/sample/piterbarg2010/ZeroStrikeCallOption.java deleted file mode 100644 index c710476..0000000 --- a/org/drip/sample/piterbarg2010/ZeroStrikeCallOption.java +++ /dev/null @@ -1,370 +0,0 @@ - -package org.drip.sample.piterbarg2010; - -import org.drip.analytics.date.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.LatentMarketStateBuilder; -import org.drip.state.discount.DiscountCurve; -import org.drip.state.discount.MergedDiscountForwardCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * ZeroStrikeCallOption examines the Impact of Funding and Collateralization on a "Zero Strike Call", i.e., - * the Futures Contract on an Asset with Non-Zero Value. The References are: - * - * - Barden, P. (2009): Equity Forward Prices in the Presence of Funding Spreads, ICBI Conference, Rome. - * - * - Burgard, C., and M. Kjaer (2009): Modeling and successful Management of Credit Counter-party Risk of - * Derivative Portfolios, ICBI Conference, Rome. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Johannes, M., and S. Sundaresan (2007): Pricing Collateralized Swaps, Journal of Finance 62 383-410. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class ZeroStrikeCallOption { - - private static final DiscountCurve OvernightCurve ( - final String strCurrency, - final JulianDate dtSpot) - throws Exception - { - String[] astrDepositMaturityTenor = new String[] { - "1D", - // "2D", - "3D" - }; - - double[] adblDepositQuote = new double[] { - 0.0004, // 1D - // 0.0004, // 2D - 0.0004 // 3D - }; - - String[] astrShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - String[] astrOISFuturesEffectiveTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - String[] astrOISFuturesMaturityTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - double[] adblOISFuturesQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - String[] astrLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - return LatentMarketStateBuilder.SmoothOvernightCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "Rate", - astrShortEndOISMaturityTenor, - adblShortEndOISQuote, - "SwapRate", - astrOISFuturesEffectiveTenor, - astrOISFuturesMaturityTenor, - adblOISFuturesQuote, - "SwapRate", - astrLongEndOISMaturityTenor, - adblLongEndOISQuote, - "SwapRate" - ); - } - - private static final DiscountCurve FundingCurve ( - final String strCurrency, - final JulianDate dtSpot) - throws Exception - { - String[] astrDepositMaturityTenor = new String[] { - "01D", - "04D", - "07D", - "14D", - "30D", - "60D" - }; - - double[] adblDepositQuote = new double[] { - 0.0013, // 1D - 0.0017, // 2D - 0.0017, // 7D - 0.0018, // 14D - 0.0020, // 30D - 0.0023 // 60D - }; - - double[] adblFuturesQuote = new double[] { - 0.0027, - 0.0032, - 0.0041, - 0.0054, - 0.0077, - 0.0104, - 0.0134, - 0.0160 - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.0166, // 4Y - 0.0206, // 5Y - 0.0241, // 6Y - 0.0269, // 7Y - 0.0292, // 8Y - 0.0311, // 9Y - 0.0326, // 10Y - 0.0340, // 11Y - 0.0351, // 12Y - 0.0375, // 15Y - 0.0393, // 20Y - 0.0402, // 25Y - 0.0407, // 30Y - 0.0409, // 40Y - 0.0409 // 50Y - }; - - return LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - adblFuturesQuote, - "ForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate" - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - - JulianDate dtSpot = DateUtil.Today().addBusDays ( - 0, - strCurrency - ); - - String[] astrTenor = new String[] { - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "6M", - "9M", - "12M", - "18M", - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - MergedDiscountForwardCurve dcOvernight = (MergedDiscountForwardCurve) OvernightCurve ( - strCurrency, - dtSpot - ); - - MergedDiscountForwardCurve dcFunding = (MergedDiscountForwardCurve) FundingCurve ( - strCurrency, - dtSpot - ); - - System.out.println(); - - System.out.println ("\t||----------------------------------------------------------||"); - - System.out.println ("\t|| PITERBARG (2010) ZERO STRIKE CALL OPTION ||"); - - System.out.println ("\t||----------------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Date ||"); - - System.out.println ("\t|| - Overnight Zero Coupon Bond Price (100 - PAR)||"); - - System.out.println ("\t|| - Funding Zero Coupon Bond Price (100 - PAR) ||"); - - System.out.println ("\t|| - Overnight Zero Rate (%) ||"); - - System.out.println ("\t|| - Funding Zero Rate (%) ||"); - - System.out.println ("\t|| - Funding - Overnight Basis (bp) ||"); - - System.out.println ("\t||----------------------------------------------------------||"); - - for (String strTenor : astrTenor) { - JulianDate dt = dtSpot.addTenor (strTenor); - - double dblOvernightZeroRate = dcOvernight.zero (strTenor); - - double dblFundingZeroRate = dcFunding.zero (strTenor); - - System.out.println ("\t|| " + dt + " | " + - FormatUtil.FormatDouble (dcOvernight.df (dt), 3, 2, 100.) + " | " + - FormatUtil.FormatDouble (dcFunding.df (dt), 3, 2, 100.) + " | " + - FormatUtil.FormatDouble (dblOvernightZeroRate, 1, 2, 100.) + "% | " + - FormatUtil.FormatDouble (dblFundingZeroRate, 1, 2, 100.) + "% ||" + - FormatUtil.FormatDouble (dblFundingZeroRate - dblOvernightZeroRate, 3, 0, 10000.) + " ||" - ); - } - - System.out.println ("\t||----------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/piterbarg2012/DeterministicCollateralChoiceZeroCoupon.java b/org/drip/sample/piterbarg2012/DeterministicCollateralChoiceZeroCoupon.java deleted file mode 100644 index 054c2d8..0000000 --- a/org/drip/sample/piterbarg2012/DeterministicCollateralChoiceZeroCoupon.java +++ /dev/null @@ -1,177 +0,0 @@ - -package org.drip.sample.piterbarg2012; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.*; -import org.drip.product.params.CurrencyPair; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.curve.*; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.fx.FXCurve; -import org.drip.state.identifier.*; -import org.drip.state.nonlinear.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * DeterministicCollateralChoiceZeroCoupon contains an analysis of the impact on the single cash flow - * discount factor of a Zero Coupon collateralized using a deterministic choice of collateral. - * - * @author Lakshmi Krishnamurthy - */ - -public class DeterministicCollateralChoiceZeroCoupon { - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today(); - - String strDomesticCurrency = "USD"; - String strForeignCurrency = "EUR"; - double dblDomesticCollateralRate = 0.03; - double dblForeignCollateralRate = 0.02; - double dblCollateralizedFXRate = 1.03; - double dblForeignRatesVolatility = 0.20; - double dblFXVolatility = 0.10; - double dblFXForeignRatesCorrelation = 0.30; - int iDiscreteCollateralizationIncrement = 30; // 30 Days - String strCollateralizationCheckTenor = "5Y"; - - MergedDiscountForwardCurve dcCcyDomesticCollatDomestic = ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - dtToday, - strDomesticCurrency, - dblDomesticCollateralRate - ); - - MergedDiscountForwardCurve dcCcyForeignCollatForeign = ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - dtToday, - strForeignCurrency, - dblForeignCollateralRate - ); - - CurrencyPair cp = CurrencyPair.FromCode (strForeignCurrency + "/" + strDomesticCurrency); - - FXCurve fxCurve = new FlatForwardFXCurve ( - dtToday.julian(), - cp, - dblCollateralizedFXRate, - new int[] {dtToday.julian()}, - new double[] {dblCollateralizedFXRate} - ); - - ForeignCollateralizedDiscountCurve dcCcyDomesticCollatForeign = new ForeignCollateralizedDiscountCurve ( - strDomesticCurrency, - dcCcyForeignCollatForeign, - fxCurve, - new FlatForwardVolatilityCurve ( - dtToday.julian(), - VolatilityLabel.Standard (CollateralLabel.Standard (strForeignCurrency)), - cp.denomCcy(), - new int[] {dtToday.julian()}, - new double[] {dblForeignRatesVolatility} - ), - new FlatForwardVolatilityCurve ( - dtToday.julian(), - VolatilityLabel.Standard (FXLabel.Standard (cp)), - cp.denomCcy(), - new int[] {dtToday.julian()}, - new double[] {dblFXVolatility} - ), - new FlatUnivariate (dblFXForeignRatesCorrelation) - ); - - DeterministicCollateralChoiceDiscountCurve dccdc = new DeterministicCollateralChoiceDiscountCurve ( - dcCcyDomesticCollatDomestic, - new org.drip.state.curve.ForeignCollateralizedDiscountCurve[] {dcCcyDomesticCollatForeign}, - iDiscreteCollateralizationIncrement - ); - - int iStart = dtToday.julian() + iDiscreteCollateralizationIncrement; - - double dblCollateralizationCheckDate = dtToday.addTenor (strCollateralizationCheckTenor).julian(); - - System.out.println ("\tPrinting the Zero Coupon Bond Price in Order (Left -> Right):"); - - System.out.println ("\t\tDate"); - - System.out.println ("\t\tDomestic Collateral Price (Par = 100)"); - - System.out.println ("\t\tForeign Collateral Price (Par = 100)"); - - System.out.println ("\t\tChoice Collateral Price (Par = 100)"); - - System.out.println ("\t-------------------------------------------------------------"); - - System.out.println ("\t-------------------------------------------------------------"); - - for (int iDate = iStart; iDate <= dblCollateralizationCheckDate; iDate += iDiscreteCollateralizationIncrement) { - double dblDomesticCollateralDF = dcCcyDomesticCollatDomestic.df (iDate); - - double dblForeignCollateralDF = dcCcyDomesticCollatForeign.df (iDate); - - double dblChoiceCollateralDF = dccdc.df (iDate); - - System.out.println ( - new JulianDate (iDate) + " => " + - FormatUtil.FormatDouble (dblDomesticCollateralDF, 2, 2, 100.) + " | " + - FormatUtil.FormatDouble (dblForeignCollateralDF, 2, 2, 100.) + " | " + - FormatUtil.FormatDouble (dblChoiceCollateralDF, 2, 2, 100.) - ); - } - } -} diff --git a/org/drip/sample/piterbarg2012/DomesticCollateralForeignForex.java b/org/drip/sample/piterbarg2012/DomesticCollateralForeignForex.java deleted file mode 100644 index 0fce6d7..0000000 --- a/org/drip/sample/piterbarg2012/DomesticCollateralForeignForex.java +++ /dev/null @@ -1,195 +0,0 @@ - -package org.drip.sample.piterbarg2012; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.CaseInsensitiveTreeMap; -import org.drip.function.r1tor1.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.*; -import org.drip.product.fx.DomesticCollateralizedForeignForward; -import org.drip.product.params.CurrencyPair; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.curve.ForeignCollateralizedDiscountCurve; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.fx.FXCurve; -import org.drip.state.identifier.*; -import org.drip.state.nonlinear.*; -import org.drip.state.volatility.VolatilityCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * DomesticCollateralForeignForex demonstrates the construction and the usage of Domestic Currency - * Collateralized Foreign Pay-out FX forward product, and the generation of its measures. - * - * @author Lakshmi Krishnamurthy - */ - -public class DomesticCollateralForeignForex { - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today(); - - String strDomesticCurrency = "USD"; - String strForeignCurrency = "EUR"; - String strMaturity = "1Y"; - double dblFXFwdStrike = 0.984; - double dblForeignCollateralRate = 0.02; - double dblCollateralizedFXRate = 1.10; - double dblForeignRatesVolatility = 0.30; - double dblFXVolatility = 0.20; - double dblFXForeignRatesCorrelation = 0.50; - - CurrencyPair cp = CurrencyPair.FromCode (strForeignCurrency + "/" + strDomesticCurrency); - - MergedDiscountForwardCurve dcCcyDomesticCollatDomestic = ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - dtToday, - strForeignCurrency, - dblForeignCollateralRate - ); - - FXCurve fxCurve = new FlatForwardFXCurve ( - dtToday.julian(), - cp, - dblCollateralizedFXRate, - new int[] {dtToday.julian()}, - new double[] {dblCollateralizedFXRate} - ); - - VolatilityCurve vcForeignFunding = new FlatForwardVolatilityCurve ( - dtToday.julian(), - VolatilityLabel.Standard (CollateralLabel.Standard (strForeignCurrency)), - strDomesticCurrency, - new int[] {dtToday.julian()}, - new double[] {dblForeignRatesVolatility} - ); - - VolatilityCurve vcFX = new FlatForwardVolatilityCurve ( - dtToday.julian(), - VolatilityLabel.Standard (FXLabel.Standard (cp)), - strDomesticCurrency, - new int[] {dtToday.julian()}, - new double[] {dblFXVolatility} - ); - - MergedDiscountForwardCurve dcCcyForeignCollatDomestic = new ForeignCollateralizedDiscountCurve ( - strForeignCurrency, - dcCcyDomesticCollatDomestic, - fxCurve, - vcForeignFunding, - vcFX, - new FlatUnivariate (dblFXForeignRatesCorrelation) - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - null, - null, - null, - null, - null, - null, - null - ); - - mktParams.setPayCurrencyCollateralCurrencyCurve ( - strForeignCurrency, - strDomesticCurrency, - dcCcyForeignCollatDomestic - ); - - mktParams.setPayCurrencyCollateralCurrencyCurve ( - strDomesticCurrency, - strDomesticCurrency, - dcCcyDomesticCollatDomestic - ); - - mktParams.setFXState ( - ScenarioFXCurveBuilder.CubicPolynomialCurve ( - "FX::" + cp.code(), - dtToday, - cp, - new String[] {"10Y"}, - new double[] {dblCollateralizedFXRate}, - dblCollateralizedFXRate - ) - ); - - DomesticCollateralizedForeignForward dcff = new DomesticCollateralizedForeignForward ( - cp, - dblFXFwdStrike, - dtToday.addTenor (strMaturity) - ); - - CaseInsensitiveTreeMap mapDCFF = dcff.value ( - new ValuationParams ( - dtToday, - dtToday, - strDomesticCurrency - ), - null, - mktParams, - null - ); - - for (Map.Entry me : mapDCFF.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/piterbarg2012/DomesticCollateralForeignForexAnalysis.java b/org/drip/sample/piterbarg2012/DomesticCollateralForeignForexAnalysis.java deleted file mode 100644 index c4f88d5..0000000 --- a/org/drip/sample/piterbarg2012/DomesticCollateralForeignForexAnalysis.java +++ /dev/null @@ -1,275 +0,0 @@ - -package org.drip.sample.piterbarg2012; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.CaseInsensitiveTreeMap; -import org.drip.function.r1tor1.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.*; -import org.drip.product.fx.DomesticCollateralizedForeignForward; -import org.drip.product.params.CurrencyPair; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.curve.ForeignCollateralizedDiscountCurve; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.fx.FXCurve; -import org.drip.state.identifier.*; -import org.drip.state.nonlinear.*; -import org.drip.state.volatility.VolatilityCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * DomesticCollateralForeignForexAnalysis contains an analysis of the correlation and volatility impact on the - * price of a Domestic Collateralized ForeignPay-out Forex Contract. - * - * @author Lakshmi Krishnamurthy - */ - -public class DomesticCollateralForeignForexAnalysis { - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today(); - - String strDomesticCurrency = "USD"; - String strForeignCurrency = "EUR"; - String strMaturity = "1Y"; - double dblFXFwdStrike = 0.984; - double dblDomesticCollateralRate = 0.02; - double dblCollateralizedFXRate = 1.10; - - CurrencyPair cp = CurrencyPair.FromCode (strForeignCurrency + "/" + strDomesticCurrency); - - MergedDiscountForwardCurve dcCcyDomesticCollatDomestic = ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - dtToday, - strDomesticCurrency, - dblDomesticCollateralRate - ); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - strDomesticCurrency - ); - - FXCurve fxCurve = new FlatForwardFXCurve ( - dtToday.julian(), - cp, - dblCollateralizedFXRate, - new int[] {dtToday.julian()}, - new double[] {dblCollateralizedFXRate} - ); - - VolatilityCurve vcForeignFunding = new FlatForwardVolatilityCurve ( - dtToday.julian(), - VolatilityLabel.Standard (CollateralLabel.Standard (strForeignCurrency)), - strDomesticCurrency, - new int[] {dtToday.julian()}, - new double[] {0.} - ); - - VolatilityCurve vcFX = new FlatForwardVolatilityCurve ( - dtToday.julian(), - VolatilityLabel.Standard (FXLabel.Standard (cp)), - strDomesticCurrency, - new int[] {dtToday.julian()}, - new double[] {0.} - ); - - MergedDiscountForwardCurve dcCcyForeignCollatDomestic = new ForeignCollateralizedDiscountCurve ( - strForeignCurrency, - dcCcyDomesticCollatDomestic, - fxCurve, - vcForeignFunding, - vcFX, - new FlatUnivariate (0.) - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - null, - null, - null, - null, - null, - null, - null - ); - - mktParams.setPayCurrencyCollateralCurrencyCurve ( - strForeignCurrency, - strDomesticCurrency, - dcCcyForeignCollatDomestic - ); - - mktParams.setPayCurrencyCollateralCurrencyCurve ( - strDomesticCurrency, - strDomesticCurrency, - dcCcyDomesticCollatDomestic - ); - - mktParams.setFXState ( - ScenarioFXCurveBuilder.CubicPolynomialCurve ( - "FX::" + cp.code(), - dtToday, - cp, - new String[] {"10Y"}, - new double[] {dblCollateralizedFXRate}, - dblCollateralizedFXRate - ) - ); - - DomesticCollateralizedForeignForward dcff = new DomesticCollateralizedForeignForward ( - cp, - dblFXFwdStrike, - dtToday.addTenor (strMaturity) - ); - - CaseInsensitiveTreeMap mapBaseValue = dcff.value ( - new ValuationParams ( - dtToday, - dtToday, - strDomesticCurrency - ), - null, - mktParams, - null - ); - - double dblBaselinePrice = mapBaseValue.get ("Price"); - - double dblBaselineParForward = mapBaseValue.get ("ParForward"); - - double[] adblForeignRatesVolatility = new double[] { - 0.1, 0.2, 0.3, 0.4, 0.5 - }; - double[] adblFXVolatility = new double[] { - 0.10, 0.15, 0.20, 0.25, 0.30 - }; - double[] adblFXForeignRatesCorrelation = new double[] { - -0.99, -0.50, 0.00, 0.50, 0.99 - }; - - System.out.println ("\tPrinting the Domestic Collateralized Foreign Forex Output in Order (Left -> Right):"); - - System.out.println ("\t\tPrice (%)"); - - System.out.println ("\t\tPrice Difference (%)"); - - System.out.println ("\t\tPar Forward (abs)"); - - System.out.println ("\t\tPar Forward Difference (abs)"); - - System.out.println ("\t-------------------------------------------------------------"); - - System.out.println ("\t-------------------------------------------------------------"); - - for (double dblForeignRatesVolatility : adblForeignRatesVolatility) { - for (double dblFXVolatility : adblFXVolatility) { - for (double dblFXForeignRatesCorrelation : adblFXForeignRatesCorrelation) { - dcCcyForeignCollatDomestic = new ForeignCollateralizedDiscountCurve ( - strForeignCurrency, - dcCcyDomesticCollatDomestic, - fxCurve, - new FlatForwardVolatilityCurve ( - dtToday.julian(), - VolatilityLabel.Standard (CollateralLabel.Standard (strForeignCurrency)), - strDomesticCurrency, - new int[] {dtToday.julian()}, - new double[] {dblForeignRatesVolatility} - ), - new FlatForwardVolatilityCurve ( - dtToday.julian(), - VolatilityLabel.Standard (FXLabel.Standard (cp)), - strDomesticCurrency, - new int[] {dtToday.julian()}, - new double[] {dblFXVolatility} - ), - new FlatUnivariate (dblFXForeignRatesCorrelation) - ); - - mktParams.setPayCurrencyCollateralCurrencyCurve ( - strForeignCurrency, - strDomesticCurrency, - dcCcyForeignCollatDomestic - ); - - CaseInsensitiveTreeMap mapDCFF = dcff.value ( - valParams, - null, - mktParams, - null - ); - - double dblPrice = mapDCFF.get ("Price"); - - double dblParForward = mapDCFF.get ("ParForward"); - - System.out.println ("\t[" + - org.drip.quant.common.FormatUtil.FormatDouble (dblForeignRatesVolatility, 2, 0, 100.) + "%," + - org.drip.quant.common.FormatUtil.FormatDouble (dblFXVolatility, 2, 0, 100.) + "%," + - org.drip.quant.common.FormatUtil.FormatDouble (dblFXForeignRatesCorrelation, 2, 0, 100.) + "%] = " + - org.drip.quant.common.FormatUtil.FormatDouble (dblPrice, 2, 2, 100.) + " | " + - org.drip.quant.common.FormatUtil.FormatDouble (dblPrice - dblBaselinePrice, 2, 2, 100.) + " | " + - org.drip.quant.common.FormatUtil.FormatDouble (dblParForward, 1, 4, 1.) + " | " + - org.drip.quant.common.FormatUtil.FormatDouble (dblParForward - dblBaselineParForward, 1, 4, 1.) - ); - } - } - } - } -} diff --git a/org/drip/sample/piterbarg2012/ForeignCollateralDomesticForex.java b/org/drip/sample/piterbarg2012/ForeignCollateralDomesticForex.java deleted file mode 100644 index 2742423..0000000 --- a/org/drip/sample/piterbarg2012/ForeignCollateralDomesticForex.java +++ /dev/null @@ -1,195 +0,0 @@ - -package org.drip.sample.piterbarg2012; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.CaseInsensitiveTreeMap; -import org.drip.function.r1tor1.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.*; -import org.drip.product.fx.ForeignCollateralizedDomesticForward; -import org.drip.product.params.CurrencyPair; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.curve.ForeignCollateralizedDiscountCurve; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.fx.FXCurve; -import org.drip.state.identifier.*; -import org.drip.state.nonlinear.*; -import org.drip.state.volatility.VolatilityCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ForeignCollateralDomesticForex demonstrates the construction and the usage of Foreign Currency - * Collateralized Domestic Pay-out FX forward product, and generation of its measures. - * - * @author Lakshmi Krishnamurthy - */ - -public class ForeignCollateralDomesticForex { - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today(); - - String strDomesticCurrency = "USD"; - String strForeignCurrency = "EUR"; - String strMaturity = "1Y"; - double dblFXFwdStrike = 1.016; - double dblForeignCollateralRate = 0.02; - double dblCollateralizedFXRate = 1.010; - double dblForeignRatesVolatility = 0.30; - double dblFXVolatility = 0.10; - double dblFXForeignRatesCorrelation = 0.20; - - CurrencyPair cp = CurrencyPair.FromCode (strForeignCurrency + "/" + strDomesticCurrency); - - MergedDiscountForwardCurve dcCcyForeignCollatForeign = ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - dtToday, - strForeignCurrency, - dblForeignCollateralRate - ); - - FXCurve fxCurve = new FlatForwardFXCurve ( - dtToday.julian(), - cp, - dblCollateralizedFXRate, - new int[] {dtToday.julian()}, - new double[] {dblCollateralizedFXRate} - ); - - VolatilityCurve vcForeignFunding = new FlatForwardVolatilityCurve ( - dtToday.julian(), - VolatilityLabel.Standard (CollateralLabel.Standard (strForeignCurrency)), - strDomesticCurrency, - new int[] {dtToday.julian()}, - new double[] {dblForeignRatesVolatility} - ); - - VolatilityCurve vcFX = new FlatForwardVolatilityCurve ( - dtToday.julian(), - VolatilityLabel.Standard (FXLabel.Standard (cp)), - strDomesticCurrency, - new int[] {dtToday.julian()}, - new double[] {dblFXVolatility} - ); - - MergedDiscountForwardCurve dcCcyDomesticCollatForeign = new ForeignCollateralizedDiscountCurve ( - strDomesticCurrency, - dcCcyForeignCollatForeign, - fxCurve, - vcForeignFunding, - vcFX, - new FlatUnivariate (dblFXForeignRatesCorrelation) - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - null, - null, - null, - null, - null, - null, - null - ); - - mktParams.setPayCurrencyCollateralCurrencyCurve ( - strDomesticCurrency, - strForeignCurrency, - dcCcyDomesticCollatForeign - ); - - mktParams.setPayCurrencyCollateralCurrencyCurve ( - strForeignCurrency, - strForeignCurrency, - dcCcyForeignCollatForeign - ); - - mktParams.setFXState ( - ScenarioFXCurveBuilder.CubicPolynomialCurve ( - "FX::" + cp.code(), - dtToday, - cp, - new String[] {"10Y"}, - new double[] {dblCollateralizedFXRate / 365.25}, - dblCollateralizedFXRate / 365.25 - ) - ); - - ForeignCollateralizedDomesticForward fcff = new ForeignCollateralizedDomesticForward ( - cp, - dblFXFwdStrike, - dtToday.addTenor (strMaturity) - ); - - CaseInsensitiveTreeMap mapFCFF = fcff.value ( - new ValuationParams ( - dtToday, - dtToday, - strDomesticCurrency - ), - null, - mktParams, - null - ); - - for (Map.Entry me : mapFCFF.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/piterbarg2012/ForeignCollateralDomesticForexAnalysis.java b/org/drip/sample/piterbarg2012/ForeignCollateralDomesticForexAnalysis.java deleted file mode 100644 index 9cb65b0..0000000 --- a/org/drip/sample/piterbarg2012/ForeignCollateralDomesticForexAnalysis.java +++ /dev/null @@ -1,275 +0,0 @@ - -package org.drip.sample.piterbarg2012; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.CaseInsensitiveTreeMap; -import org.drip.function.r1tor1.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.*; -import org.drip.product.fx.ForeignCollateralizedDomesticForward; -import org.drip.product.params.CurrencyPair; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.curve.ForeignCollateralizedDiscountCurve; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.fx.FXCurve; -import org.drip.state.identifier.*; -import org.drip.state.nonlinear.*; -import org.drip.state.volatility.VolatilityCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ForeignCollateralDomesticForexAnalysis contains an analysis of the correlation and volatility impact on the - * price of a Foreign Collateralized Domestic Pay-out Forex Contract. - * - * @author Lakshmi Krishnamurthy - */ - -public class ForeignCollateralDomesticForexAnalysis { - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today(); - - String strDomesticCurrency = "USD"; - String strForeignCurrency = "EUR"; - String strMaturity = "1Y"; - double dblFXFwdStrike = 1.016; - double dblForeignCollateralRate = 0.02; - double dblCollateralizedFXRate = 0.01; - - CurrencyPair cp = CurrencyPair.FromCode (strForeignCurrency + "/" + strDomesticCurrency); - - MergedDiscountForwardCurve dcCcyForeignCollatForeign = ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - dtToday, - strForeignCurrency, - dblForeignCollateralRate - ); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - strDomesticCurrency - ); - - FXCurve fxCurve = new FlatForwardFXCurve ( - dtToday.julian(), - cp, - dblCollateralizedFXRate, - new int[] {dtToday.julian()}, - new double[] {dblCollateralizedFXRate} - ); - - VolatilityCurve vcForeignFunding = new FlatForwardVolatilityCurve ( - dtToday.julian(), - VolatilityLabel.Standard (CollateralLabel.Standard (strForeignCurrency)), - strDomesticCurrency, - new int[] {dtToday.julian()}, - new double[] {0.} - ); - - VolatilityCurve vcFX = new FlatForwardVolatilityCurve ( - dtToday.julian(), - VolatilityLabel.Standard (FXLabel.Standard (cp)), - strDomesticCurrency, - new int[] {dtToday.julian()}, - new double[] {0.} - ); - - MergedDiscountForwardCurve dcCcyDomesticCollatForeign = new ForeignCollateralizedDiscountCurve ( - strDomesticCurrency, - dcCcyForeignCollatForeign, - fxCurve, - vcForeignFunding, - vcFX, - new FlatUnivariate (0.) - ); - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - null, - null, - null, - null, - null, - null, - null - ); - - mktParams.setPayCurrencyCollateralCurrencyCurve ( - strDomesticCurrency, - strForeignCurrency, - dcCcyDomesticCollatForeign - ); - - mktParams.setPayCurrencyCollateralCurrencyCurve ( - strForeignCurrency, - strForeignCurrency, - dcCcyForeignCollatForeign - ); - - mktParams.setFXState ( - ScenarioFXCurveBuilder.CubicPolynomialCurve ( - "FX::" + cp.code(), - dtToday, - cp, - new String[] {"10Y"}, - new double[] {dblCollateralizedFXRate / 365.25}, - dblCollateralizedFXRate / 365.25 - ) - ); - - ForeignCollateralizedDomesticForward fcff = new ForeignCollateralizedDomesticForward ( - cp, - dblFXFwdStrike, - dtToday.addTenor (strMaturity) - ); - - CaseInsensitiveTreeMap mapBaseValue = fcff.value ( - new ValuationParams ( - dtToday, - dtToday, - strDomesticCurrency - ), - null, - mktParams, - null - ); - - double dblBaselinePrice = mapBaseValue.get ("Price"); - - double dblBaselineParForward = mapBaseValue.get ("ParForward"); - - double[] adblForeignRatesVolatility = new double[] { - 0.1, 0.2, 0.3, 0.4, 0.5 - }; - double[] adblFXVolatility = new double[] { - 0.10, 0.15, 0.20, 0.25, 0.30 - }; - double[] adblFXForeignRatesCorrelation = new double[] { - -0.99, -0.50, 0.00, 0.50, 0.99 - }; - - System.out.println ("\tPrinting the Foreign Collateralized Forex Output in Order (Left -> Right):"); - - System.out.println ("\t\tPrice (%)"); - - System.out.println ("\t\tPrice Difference (%)"); - - System.out.println ("\t\tPar Forward (abs)"); - - System.out.println ("\t\tPar Forward Difference (abs)"); - - System.out.println ("\t-------------------------------------------------------------"); - - System.out.println ("\t-------------------------------------------------------------"); - - for (double dblForeignRatesVolatility : adblForeignRatesVolatility) { - for (double dblFXVolatility : adblFXVolatility) { - for (double dblFXForeignRatesCorrelation : adblFXForeignRatesCorrelation) { - dcCcyDomesticCollatForeign = new ForeignCollateralizedDiscountCurve ( - strDomesticCurrency, - dcCcyForeignCollatForeign, - fxCurve, - new FlatForwardVolatilityCurve ( - dtToday.julian(), - VolatilityLabel.Standard (CollateralLabel.Standard (strForeignCurrency)), - strDomesticCurrency, - new int[] {dtToday.julian()}, - new double[] {dblForeignRatesVolatility} - ), - new FlatForwardVolatilityCurve ( - dtToday.julian(), - VolatilityLabel.Standard (FXLabel.Standard (cp)), - strDomesticCurrency, - new int[] {dtToday.julian()}, - new double[] {dblFXVolatility} - ), - new FlatUnivariate (dblFXForeignRatesCorrelation) - ); - - mktParams.setPayCurrencyCollateralCurrencyCurve ( - strDomesticCurrency, - strForeignCurrency, - dcCcyDomesticCollatForeign - ); - - CaseInsensitiveTreeMap mapFCFF = fcff.value ( - valParams, - null, - mktParams, - null - ); - - double dblPrice = mapFCFF.get ("Price"); - - double dblParForward = mapFCFF.get ("ParForward"); - - System.out.println ("\t[" + - org.drip.quant.common.FormatUtil.FormatDouble (dblForeignRatesVolatility, 2, 0, 100.) + "%," + - org.drip.quant.common.FormatUtil.FormatDouble (dblFXVolatility, 2, 0, 100.) + "%," + - org.drip.quant.common.FormatUtil.FormatDouble (dblFXForeignRatesCorrelation, 2, 0, 100.) + "%] = " + - org.drip.quant.common.FormatUtil.FormatDouble (dblPrice, 1, 2, 100.) + " | " + - org.drip.quant.common.FormatUtil.FormatDouble (dblPrice - dblBaselinePrice, 1, 2, 100.) + " | " + - org.drip.quant.common.FormatUtil.FormatDouble (dblParForward, 1, 4, 1.) + " | " + - org.drip.quant.common.FormatUtil.FormatDouble (dblParForward - dblBaselineParForward, 1, 4, 1.) - ); - } - } - } - } -} diff --git a/org/drip/sample/piterbarg2012/ForeignCollateralizedZeroCoupon.java b/org/drip/sample/piterbarg2012/ForeignCollateralizedZeroCoupon.java deleted file mode 100644 index 4b0c66b..0000000 --- a/org/drip/sample/piterbarg2012/ForeignCollateralizedZeroCoupon.java +++ /dev/null @@ -1,202 +0,0 @@ - -package org.drip.sample.piterbarg2012; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.*; -import org.drip.product.params.CurrencyPair; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.curve.ForeignCollateralizedDiscountCurve; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.fx.FXCurve; -import org.drip.state.identifier.*; -import org.drip.state.nonlinear.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ForeignCollateralizedZeroCoupon contains an analysis of the correlation and volatility impact on the - * single cash flow discount factor of a Foreign Collateralized Zero Coupon. - * - * @author Lakshmi Krishnamurthy - */ - -public class ForeignCollateralizedZeroCoupon { - private static final double ZeroCouponVolCorr ( - final JulianDate dtSpot, - final CurrencyPair cp, - final MergedDiscountForwardCurve dcCcyForeignCollatForeign, - final FXCurve fxCurve, - final double dblForeignRatesVolatility, - final double dblFXVolatility, - final double dblFXForeignRatesCorrelation, - final JulianDate dtMaturity, - final double dblBaselinePrice) - throws Exception - { - MergedDiscountForwardCurve dcCcyDomesticCollatForeign = new ForeignCollateralizedDiscountCurve ( - cp.denomCcy(), - dcCcyForeignCollatForeign, - fxCurve, - new FlatForwardVolatilityCurve ( - dtSpot.julian(), - VolatilityLabel.Standard (CollateralLabel.Standard (cp.numCcy())), - cp.denomCcy(), - new int[] {dtSpot.julian()}, - new double[] {dblForeignRatesVolatility} - ), - new FlatForwardVolatilityCurve ( - dtSpot.julian(), - VolatilityLabel.Standard (FXLabel.Standard (cp)), - cp.denomCcy(), - new int[] {dtSpot.julian()}, - new double[] {dblFXVolatility} - ), - new FlatUnivariate (dblFXForeignRatesCorrelation) - ); - - double dblPrice = dcCcyDomesticCollatForeign.df (dtMaturity); - - System.out.println ("\t[" + - org.drip.quant.common.FormatUtil.FormatDouble (dblForeignRatesVolatility, 2, 0, 100.) + "%," + - org.drip.quant.common.FormatUtil.FormatDouble (dblFXVolatility, 2, 0, 100.) + "%," + - org.drip.quant.common.FormatUtil.FormatDouble (dblFXForeignRatesCorrelation, 2, 0, 100.) + "%] =" + - org.drip.quant.common.FormatUtil.FormatDouble (dblPrice, 1, 2, 100.) + " | " + - org.drip.quant.common.FormatUtil.FormatDouble (dblPrice - dblBaselinePrice, 1, 0, 10000.) - ); - - return dblPrice; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today(); - - String strMaturityTenor = "5Y"; - String strDomesticCurrency = "USD"; - String strForeignCurrency = "JPY"; - double dblForeignCollateralRate = 0.02; - double dblCollateralizedFXRate = 0.01; - - JulianDate dtZeroCouponMaturity = dtToday.addTenor (strMaturityTenor); - - MergedDiscountForwardCurve dcCcyForeignCollatForeign = ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - dtToday, - strForeignCurrency, - dblForeignCollateralRate - ); - - CurrencyPair cp = CurrencyPair.FromCode (strForeignCurrency + "/" + strDomesticCurrency); - - FXCurve fxCurve = new FlatForwardFXCurve ( - dtToday.julian(), - cp, - dblCollateralizedFXRate, - new int[] {dtToday.julian()}, - new double[] {dblCollateralizedFXRate} - ); - - double dblBaselinePrice = ZeroCouponVolCorr ( - dtToday, - cp, - dcCcyForeignCollatForeign, - fxCurve, - 0., - 0., - 0., - dtZeroCouponMaturity, - 0. - ); - - double[] adblForeignRatesVol = new double[] { - 0.1, 0.2, 0.3, 0.4, 0.5 - }; - double[] adblFXVol = new double[] { - 0.10, 0.15, 0.20, 0.25, 0.30 - }; - double[] adblForeignRatesFXCorr = new double[] { - -0.99, -0.50, 0.00, 0.50, 0.99 - }; - - System.out.println ("\tPrinting the Zero Coupon Bond Price in Order (Left -> Right):"); - - System.out.println ("\t\tPrice (%)"); - - System.out.println ("\t\tDifference from Baseline (pt)"); - - System.out.println ("\t-------------------------------------------------------------"); - - System.out.println ("\t-------------------------------------------------------------"); - - for (double dblForeignRatesVol : adblForeignRatesVol) { - for (double dblFXVol : adblFXVol) { - for (double dblForeignRatesFXCorr : adblForeignRatesFXCorr) - ZeroCouponVolCorr ( - dtToday, - cp, - dcCcyForeignCollatForeign, - fxCurve, - dblForeignRatesVol, - dblFXVol, - dblForeignRatesFXCorr, - dtZeroCouponMaturity, - dblBaselinePrice - ); - } - } - } -} diff --git a/org/drip/sample/principal/ImpactExponentAnalysis.java b/org/drip/sample/principal/ImpactExponentAnalysis.java deleted file mode 100644 index 02fd808..0000000 --- a/org/drip/sample/principal/ImpactExponentAnalysis.java +++ /dev/null @@ -1,206 +0,0 @@ - -package org.drip.sample.principal; - -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.*; -import org.drip.execution.nonadaptive.ContinuousPowerImpact; -import org.drip.execution.optimum.PowerImpactContinuous; -import org.drip.execution.parameters.*; -import org.drip.execution.principal.Almgren2003Estimator; -import org.drip.execution.profiletime.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ImpactExponentAnalysis demonstrates the Analysis of the Dependence of the Optimal Principal Measures on - * the Exponent of the Temporary Market Impact. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class ImpactExponentAnalysis { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblS0 = 50.; - double dblX = 100000.; - double dblVolatility = 1.; - double dblDailyVolume = 1000000.; - double dblDailyVolumeExecutionFactor = 0.1; - double dblPermanentImpactFactor = 0.; - double dblTemporaryImpactFactor = 0.01; - double dblT = 5.; - double dblLambda = 1.e-06; - double dblPrincipalDiscount = 0.15; - - double[] adblK = new double[] { - 0.20, - 0.25, - 0.30, - 0.35, - 0.40, - 0.45, - 0.50, - 0.55, - 0.60, - 0.65, - 0.70, - 0.75, - 0.80, - 0.85, - 0.90, - 0.95, - 1.00, - 1.10, - 1.20, - 1.35, - 1.50 - }; - - System.out.println(); - - System.out.println ("\t|---------------------------------------------------------------------------||"); - - System.out.println ("\t| OPTIMAL MEASURES IMPACT EXPONENT DEPENDENCE ||"); - - System.out.println ("\t|---------------------------------------------------------------------------||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| - Temporary Market Impact Exponent ||"); - - System.out.println ("\t| - Principal Discount ||"); - - System.out.println ("\t| - Gross Profit Expectation ||"); - - System.out.println ("\t| - Gross Profit Standard Deviation ||"); - - System.out.println ("\t| - Gross Returns Expectation ||"); - - System.out.println ("\t| - Gross Returns Standard Deviation ||"); - - System.out.println ("\t| - Information Ratio ||"); - - System.out.println ("\t| - Optimal Information Ratio ||"); - - System.out.println ("\t| - Optimal Information Ratio Horizon ||"); - - System.out.println ("\t|---------------------------------------------------------------------------||"); - - for (double dblK : adblK) { - PriceMarketImpactPower pmip = new PriceMarketImpactPower ( - new AssetTransactionSettings ( - dblS0, - dblDailyVolume, - 0. - ), - dblPermanentImpactFactor, - dblTemporaryImpactFactor, - dblDailyVolumeExecutionFactor, - dblK - ); - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.Almgren2003 ( - new ArithmeticPriceDynamicsSettings ( - 0., - new FlatUnivariate (dblVolatility), - 0. - ), - new UniformParticipationRateLinear ((ParticipationRateLinear) pmip.permanentTransactionFunction()), - new UniformParticipationRate ((ParticipationRatePower) pmip.temporaryTransactionFunction()) - ); - - ContinuousPowerImpact cpi = ContinuousPowerImpact.Standard ( - dblX, - dblT, - lpep, - dblLambda - ); - - PowerImpactContinuous pic = (PowerImpactContinuous) cpi.generate(); - - Almgren2003Estimator a2003e = new Almgren2003Estimator ( - pic, - lpep - ); - - System.out.println ( - "\t|" + - FormatUtil.FormatDouble (dblK, 1, 2, 1.) + " |" + - FormatUtil.FormatDouble (a2003e.breakevenPrincipalDiscount(), 1, 2, 1.) + " | " + - FormatUtil.FormatDouble (a2003e.principalMeasure (dblPrincipalDiscount).mean(), 5, 0, 1.) + " |" + - FormatUtil.FormatDouble (Math.sqrt (a2003e.principalMeasure (dblPrincipalDiscount).variance()), 6, 0, 1.) + " |" + - FormatUtil.FormatDouble (a2003e.horizonPrincipalMeasure (dblPrincipalDiscount).mean(), 5, 0, 1.) + " |" + - FormatUtil.FormatDouble (Math.sqrt (a2003e.horizonPrincipalMeasure (dblPrincipalDiscount).variance()), 5, 0, 1.) + " | " + - FormatUtil.FormatDouble (a2003e.informationRatio (dblPrincipalDiscount), 1, 4, 1.) + " |" + - FormatUtil.FormatDouble (a2003e.optimalInformationRatio (dblPrincipalDiscount), 1, 4, 1.) + " |" + - FormatUtil.FormatDouble (a2003e.optimalInformationRatioHorizon (dblPrincipalDiscount), 3, 2, 1.) + " ||" - ); - } - - System.out.println ("\t|---------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/principal/InformationRatioAnalysis.java b/org/drip/sample/principal/InformationRatioAnalysis.java deleted file mode 100644 index fd8a5a3..0000000 --- a/org/drip/sample/principal/InformationRatioAnalysis.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.sample.principal; - -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.*; -import org.drip.execution.nonadaptive.ContinuousPowerImpact; -import org.drip.execution.optimum.PowerImpactContinuous; -import org.drip.execution.parameters.*; -import org.drip.execution.principal.Almgren2003Estimator; -import org.drip.execution.profiletime.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * InformationRatioAnalysis demonstrates the Analysis of the Dependence of the Optimal Principal Measures on - * the Information Ratio Hurdle. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class InformationRatioAnalysis { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblS0 = 50.; - double dblX = 100000.; - double dblVolatility = 1.; - double dblDailyVolume = 1000000.; - double dblDailyVolumeExecutionFactor = 0.1; - double dblPermanentImpactFactor = 0.; - double dblTemporaryImpactFactor = 0.01; - double dblT = 5.; - double dblLambda = 1.e-06; - double dblK = 1.; - - double[] adblInformationRatio = new double[] { - 0.01, - 0.02, - 0.03, - 0.04, - 0.05, - 0.07, - 0.09, - 0.11, - 0.13, - 0.15, - 0.18, - 0.21, - 0.24, - 0.28, - 0.32, - 0.36, - 0.40, - 0.45, - 0.50, - 0.55, - 0.60, - 0.66, - 0.72, - 0.78, - 0.84, - 0.91, - 0.98, - 1.05, - 1.12, - 1.20, - 1.28, - 1.36, - 1.44 - }; - - PriceMarketImpactPower pmip = new PriceMarketImpactPower ( - new AssetTransactionSettings ( - dblS0, - dblDailyVolume, - 0. - ), - dblPermanentImpactFactor, - dblTemporaryImpactFactor, - dblDailyVolumeExecutionFactor, - dblK - ); - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.Almgren2003 ( - new ArithmeticPriceDynamicsSettings ( - 0., - new FlatUnivariate (dblVolatility), - 0. - ), - new UniformParticipationRateLinear ((ParticipationRateLinear) pmip.permanentTransactionFunction()), - new UniformParticipationRate ((ParticipationRatePower) pmip.temporaryTransactionFunction()) - ); - - ContinuousPowerImpact cpi = ContinuousPowerImpact.Standard ( - dblX, - dblT, - lpep, - dblLambda - ); - - PowerImpactContinuous pic = (PowerImpactContinuous) cpi.generate(); - - Almgren2003Estimator a2003e = new Almgren2003Estimator ( - pic, - lpep - ); - - System.out.println(); - - System.out.println ("\t|-------------------------------------------------------------------------||"); - - System.out.println ("\t| OPTIMAL MEASURES INFORMATION RATIO DEPENDENCE ||"); - - System.out.println ("\t|-------------------------------------------------------------------------||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| - Information Ratio Hurdle ||"); - - System.out.println ("\t| - Principal Discount ||"); - - System.out.println ("\t| - Gross Profit Expectation ||"); - - System.out.println ("\t| - Gross Profit Standard Deviation ||"); - - System.out.println ("\t| - Gross Returns Expectation ||"); - - System.out.println ("\t| - Gross Returns Standard Deviation ||"); - - System.out.println ("\t| - Information Ratio ||"); - - System.out.println ("\t| - Optimal Information Ratio ||"); - - System.out.println ("\t| - Optimal Information Ratio Horizon ||"); - - System.out.println ("\t|-------------------------------------------------------------------------||"); - - for (double dblInformationRatio : adblInformationRatio) { - double dblPrincipalDiscount = a2003e.principalDiscountHurdle (dblInformationRatio); - - System.out.println ( - "\t|" + - FormatUtil.FormatDouble (dblInformationRatio, 1, 2, 1.) + " |" + - FormatUtil.FormatDouble (dblPrincipalDiscount, 1, 2, 1.) + " |" + - FormatUtil.FormatDouble (a2003e.principalMeasure (dblPrincipalDiscount).mean(), 5, 0, 1.) + " |" + - FormatUtil.FormatDouble (Math.sqrt (a2003e.principalMeasure (dblPrincipalDiscount).variance()), 6, 0, 1.) + " |" + - FormatUtil.FormatDouble (a2003e.horizonPrincipalMeasure (dblPrincipalDiscount).mean(), 5, 0, 1.) + " |" + - FormatUtil.FormatDouble (Math.sqrt (a2003e.horizonPrincipalMeasure (dblPrincipalDiscount).variance()), 5, 0, 1.) + " |" + - FormatUtil.FormatDouble (a2003e.informationRatio (dblPrincipalDiscount), 1, 4, 1.) + " |" + - FormatUtil.FormatDouble (a2003e.optimalInformationRatio (dblPrincipalDiscount), 1, 4, 1.) + " |" + - FormatUtil.FormatDouble (a2003e.optimalInformationRatioHorizon (dblPrincipalDiscount), 1, 4, 1.) + " ||" - ); - } - - System.out.println ("\t|-------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/principal/OptimalMeasuresConstantExponent.java b/org/drip/sample/principal/OptimalMeasuresConstantExponent.java deleted file mode 100644 index 3186b56..0000000 --- a/org/drip/sample/principal/OptimalMeasuresConstantExponent.java +++ /dev/null @@ -1,180 +0,0 @@ - -package org.drip.sample.principal; - -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.*; -import org.drip.execution.nonadaptive.ContinuousPowerImpact; -import org.drip.execution.optimum.PowerImpactContinuous; -import org.drip.execution.parameters.*; -import org.drip.execution.principal.*; -import org.drip.execution.profiletime.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OptimalMeasuresConstantExponent demonstrates the Dependence Exponents on Liquidity, Trade Size, and - * Permanent Impact Adjusted Principal Discount for the Optimal Principal Horizon and the Optional - * Information Ratio. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 16 (6) 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class OptimalMeasuresConstantExponent { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblS0 = 50.; - double dblDailyVolume = 1000000.; - double dblBidAskSpread = 0.; - double dblPermanentImpactFactor = 0.; - double dblTemporaryImpactFactor = 0.01; - double dblDailyVolumeExecutionFactor = 0.1; - double dblDrift = 0.; - double dblVolatility = 1.; - double dblSerialCorrelation = 0.; - double dblX = 100000.; - double dblFinishTime = 1.; - double dblLambda = 5.e-06; - - double[] adblK = new double[] { - 0.5, - 1.0, - 1.5, - 2.0, - 2.5, - 3.0, - 3.5, - 4.0, - 4.5, - 5.0, - 5.5, - 6.0, - 6.5, - 7.0, - 7.5, - 8.0, - 8.5, - 9.0, - 9.5 - }; - - System.out.println(); - - System.out.println ("\t|-----------------------------------------------------||"); - - System.out.println ("\t| Optimal Market Parameters Horizon Dependence ||"); - - System.out.println ("\t|-----------------------------------------------------||"); - - for (double dblK : adblK) { - PriceMarketImpactPower pmip = new PriceMarketImpactPower ( - new AssetTransactionSettings ( - dblS0, - dblDailyVolume, - dblBidAskSpread - ), - dblPermanentImpactFactor, - dblTemporaryImpactFactor, - dblDailyVolumeExecutionFactor, - dblK - ); - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.Almgren2003 ( - new ArithmeticPriceDynamicsSettings ( - dblDrift, - new FlatUnivariate (dblVolatility), - dblSerialCorrelation - ), - new UniformParticipationRateLinear ((ParticipationRateLinear) pmip.permanentTransactionFunction()), - new UniformParticipationRate ((ParticipationRatePower) pmip.temporaryTransactionFunction()) - ); - - Almgren2003Estimator a2003e = new Almgren2003Estimator ( - (PowerImpactContinuous) ContinuousPowerImpact.Standard ( - dblX, - dblFinishTime, - lpep, - dblLambda - ).generate(), - lpep - ); - - OptimalMeasureDependence omd = a2003e.optimalMeasures().omdHorizon(); - - System.out.println ( - "\t| " + - FormatUtil.FormatDouble (dblK, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (omd.constant(), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (omd.liquidityExponent(), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (omd.blockSizeExponent(), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (omd.volatilityExponent(), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (omd.adjustedPrincipalDiscountExponent(), 1, 3, 1.) + " ||" - ); - } - - System.out.println ("\t|-----------------------------------------------------||"); - } -} diff --git a/org/drip/sample/principal/OptimalMeasuresDiscountDependence.java b/org/drip/sample/principal/OptimalMeasuresDiscountDependence.java deleted file mode 100644 index c0c8f39..0000000 --- a/org/drip/sample/principal/OptimalMeasuresDiscountDependence.java +++ /dev/null @@ -1,205 +0,0 @@ - -package org.drip.sample.principal; - -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.*; -import org.drip.execution.nonadaptive.ContinuousPowerImpact; -import org.drip.execution.optimum.PowerImpactContinuous; -import org.drip.execution.parameters.*; -import org.drip.execution.principal.Almgren2003Estimator; -import org.drip.execution.profiletime.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OptimalMeasuresDiscountDependence demonstrates the Dependence of the Optimal Principal Measures on the - * Discount. The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class OptimalMeasuresDiscountDependence { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblS0 = 50.; - double dblX = 100000.; - double dblVolatility = 1.; - double dblDailyVolume = 1000000.; - double dblDailyVolumeExecutionFactor = 0.1; - double dblPermanentImpactFactor = 0.; - double dblTemporaryImpactFactor = 0.01; - double dblT = 5.; - double dblLambda = 1.e-06; - double dblK = 1.; - - double[] adblPrincipalDiscount = new double[] { - 0.12, - 0.13, - 0.14, - 0.15, - 0.16, - 0.18, - 0.21, - 0.24, - 0.27, - 0.30, - 0.33, - 0.36, - 0.39, - 0.42, - 0.45, - 0.50, - 0.55, - 0.60, - 0.66, - 0.72, - 0.78, - 0.84, - 0.91, - 0.98 - }; - - PriceMarketImpactPower pmip = new PriceMarketImpactPower ( - new AssetTransactionSettings ( - dblS0, - dblDailyVolume, - 0. - ), - dblPermanentImpactFactor, - dblTemporaryImpactFactor, - dblDailyVolumeExecutionFactor, - dblK - ); - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.Almgren2003 ( - new ArithmeticPriceDynamicsSettings ( - 0., - new FlatUnivariate (dblVolatility), - 0. - ), - new UniformParticipationRateLinear ((ParticipationRateLinear) pmip.permanentTransactionFunction()), - new UniformParticipationRate ((ParticipationRatePower) pmip.temporaryTransactionFunction()) - ); - - ContinuousPowerImpact cpi = ContinuousPowerImpact.Standard ( - dblX, - dblT, - lpep, - dblLambda - ); - - PowerImpactContinuous pic = (PowerImpactContinuous) cpi.generate(); - - Almgren2003Estimator a2003e = new Almgren2003Estimator ( - pic, - lpep - ); - - System.out.println(); - - System.out.println ("\t|------------------------------------------------------------------||"); - - System.out.println ("\t| OPTIMAL MEASURES PRINCIPAL DISCOUNT DEPENDENCE ||"); - - System.out.println ("\t|------------------------------------------------------------------||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| - Principal Discount ||"); - - System.out.println ("\t| - Gross Profit Expectation ||"); - - System.out.println ("\t| - Gross Profit Standard Deviation ||"); - - System.out.println ("\t| - Gross Returns Expectation ||"); - - System.out.println ("\t| - Gross Returns Standard Deviation ||"); - - System.out.println ("\t| - Information Ratio ||"); - - System.out.println ("\t| - Optimal Information Ratio ||"); - - System.out.println ("\t| - Optimal Information Ratio Horizon ||"); - - System.out.println ("\t|------------------------------------------------------------------||"); - - for (double dblPrincipalDiscount : adblPrincipalDiscount) - System.out.println ( - "\t|" + - FormatUtil.FormatDouble (dblPrincipalDiscount, 1, 2, 1.) + " |" + - FormatUtil.FormatDouble (a2003e.principalMeasure (dblPrincipalDiscount).mean(), 5, 0, 1.) + " |" + - FormatUtil.FormatDouble (Math.sqrt (a2003e.principalMeasure (dblPrincipalDiscount).variance()), 6, 0, 1.) + " |" + - FormatUtil.FormatDouble (a2003e.horizonPrincipalMeasure (dblPrincipalDiscount).mean(), 5, 0, 1.) + " |" + - FormatUtil.FormatDouble (Math.sqrt (a2003e.horizonPrincipalMeasure (dblPrincipalDiscount).variance()), 5, 0, 1.) + " |" + - FormatUtil.FormatDouble (a2003e.informationRatio (dblPrincipalDiscount), 1, 4, 1.) + " |" + - FormatUtil.FormatDouble (a2003e.optimalInformationRatio (dblPrincipalDiscount), 1, 4, 1.) + " |" + - FormatUtil.FormatDouble (a2003e.optimalInformationRatioHorizon (dblPrincipalDiscount), 1, 4, 1.) + " ||" - ); - - System.out.println ("\t|------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/principal/OptimalMeasuresReconciler.java b/org/drip/sample/principal/OptimalMeasuresReconciler.java deleted file mode 100644 index c957662..0000000 --- a/org/drip/sample/principal/OptimalMeasuresReconciler.java +++ /dev/null @@ -1,262 +0,0 @@ - -package org.drip.sample.principal; - -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.*; -import org.drip.execution.nonadaptive.ContinuousPowerImpact; -import org.drip.execution.optimum.PowerImpactContinuous; -import org.drip.execution.parameters.*; -import org.drip.execution.principal.*; -import org.drip.execution.profiletime.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OptimalMeasuresReconciler reconciles the Dependence Exponents on Liquidity, Trade Size, and Permanent - * Impact Adjusted Principal Discount for the Optimal Principal Horizon and the Optional Information Ratio - * with Almgren and Chriss (2003). The References are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 16 (6) 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class OptimalMeasuresReconciler { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblS0 = 50.; - double dblDailyVolume = 1000000.; - double dblBidAskSpread = 0.; - double dblPermanentImpactFactor = 0.; - double dblTemporaryImpactFactor = 0.01; - double dblDailyVolumeExecutionFactor = 0.1; - double dblDrift = 0.; - double dblVolatility = 1.; - double dblSerialCorrelation = 0.; - double dblX = 100000.; - double dblFinishTime = 1.; - double dblLambda = 5.e-06; - - double[] adblK = new double[] { - 0.5, - 1.0, - 2.0 - }; - - double[][] aadblOptimalHorizonDependenceReconciler = new double[][] { - {0.810, 2.0, 1.0, 0.0, -2.0}, - {1.000, 1.0, 1.0, 0.0, -1.0}, - {1.134, 0.5, 1.0, 0.0, -0.5} - }; - - double[][] aadblOptimalInformationRatioDependenceReconciler = new double[][] { - {1.063, -2.0, -1.0, -1.0, 3.0}, - {0.707, -1.0, -1.0, -1.0, 2.0}, - {0.449, -0.5, -1.0, -1.0, 1.5} - }; - - System.out.println(); - - System.out.println ("\t|-----------------------------------------------------||"); - - System.out.println ("\t| Optimal Market Parameters Horizon Dependence ||"); - - System.out.println ("\t|-----------------------------------------------------||"); - - for (double dblK : adblK) { - PriceMarketImpactPower pmip = new PriceMarketImpactPower ( - new AssetTransactionSettings ( - dblS0, - dblDailyVolume, - dblBidAskSpread - ), - dblPermanentImpactFactor, - dblTemporaryImpactFactor, - dblDailyVolumeExecutionFactor, - dblK - ); - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.Almgren2003 ( - new ArithmeticPriceDynamicsSettings ( - dblDrift, - new FlatUnivariate (dblVolatility), - dblSerialCorrelation - ), - new UniformParticipationRateLinear ((ParticipationRateLinear) pmip.permanentTransactionFunction()), - new UniformParticipationRate ((ParticipationRatePower) pmip.temporaryTransactionFunction()) - ); - - Almgren2003Estimator a2003e = new Almgren2003Estimator ( - (PowerImpactContinuous) ContinuousPowerImpact.Standard ( - dblX, - dblFinishTime, - lpep, - dblLambda - ).generate(), - lpep - ); - - OptimalMeasureDependence omd = a2003e.optimalMeasures().omdHorizon(); - - System.out.println ( - "\t| " + - FormatUtil.FormatDouble (dblK, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (omd.constant(), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (omd.liquidityExponent(), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (omd.blockSizeExponent(), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (omd.volatilityExponent(), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (omd.adjustedPrincipalDiscountExponent(), 1, 3, 1.) + " ||" - ); - } - - System.out.println ("\t|-----------------------------------------------------||"); - - System.out.println ("\t|-----------------------------------------------------||"); - - for (int i = 0; i < adblK.length; ++i) - System.out.println ( - "\t| " + - FormatUtil.FormatDouble (adblK[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (aadblOptimalHorizonDependenceReconciler[i][0], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (aadblOptimalHorizonDependenceReconciler[i][1], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (aadblOptimalHorizonDependenceReconciler[i][2], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (aadblOptimalHorizonDependenceReconciler[i][3], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (aadblOptimalHorizonDependenceReconciler[i][4], 1, 3, 1.) + " ||" - ); - - System.out.println ("\t|-----------------------------------------------------||"); - - System.out.println(); - - System.out.println ("\t|-----------------------------------------------------||"); - - System.out.println ("\t| Optimal Market Parameters Information Ratio ||"); - - System.out.println ("\t|-----------------------------------------------------||"); - - for (double dblK : adblK) { - PriceMarketImpactPower pmip = new PriceMarketImpactPower ( - new AssetTransactionSettings ( - dblS0, - dblDailyVolume, - dblBidAskSpread - ), - dblPermanentImpactFactor, - dblTemporaryImpactFactor, - dblDailyVolumeExecutionFactor, - dblK - ); - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.Almgren2003 ( - new ArithmeticPriceDynamicsSettings ( - dblDrift, - new FlatUnivariate (dblVolatility), - dblSerialCorrelation - ), - new UniformParticipationRateLinear ((ParticipationRateLinear) pmip.permanentTransactionFunction()), - new UniformParticipationRate ((ParticipationRatePower) pmip.temporaryTransactionFunction()) - ); - - Almgren2003Estimator a2003e = new Almgren2003Estimator ( - (PowerImpactContinuous) ContinuousPowerImpact.Standard ( - dblX, - dblFinishTime, - lpep, - dblLambda - ).generate(), - lpep - ); - - OptimalMeasureDependence omd = a2003e.optimalMeasures().omdInformationRatio(); - - System.out.println ( - "\t| " + - FormatUtil.FormatDouble (dblK, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (omd.constant(), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (omd.liquidityExponent(), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (omd.blockSizeExponent(), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (omd.volatilityExponent(), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (omd.adjustedPrincipalDiscountExponent(), 1, 3, 1.) + " ||" - ); - } - - System.out.println ("\t|-----------------------------------------------------||"); - - System.out.println ("\t|-----------------------------------------------------||"); - - for (int i = 0; i < adblK.length; ++i) - System.out.println ( - "\t| " + - FormatUtil.FormatDouble (adblK[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (aadblOptimalInformationRatioDependenceReconciler[i][0], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (aadblOptimalInformationRatioDependenceReconciler[i][1], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (aadblOptimalInformationRatioDependenceReconciler[i][2], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (aadblOptimalInformationRatioDependenceReconciler[i][3], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (aadblOptimalInformationRatioDependenceReconciler[i][4], 1, 3, 1.) + " ||" - ); - - System.out.println ("\t|-----------------------------------------------------||"); - } -} diff --git a/org/drip/sample/principal/OptimalTrajectoryMeasures.java b/org/drip/sample/principal/OptimalTrajectoryMeasures.java deleted file mode 100644 index 8973efb..0000000 --- a/org/drip/sample/principal/OptimalTrajectoryMeasures.java +++ /dev/null @@ -1,252 +0,0 @@ - -package org.drip.sample.principal; - -import org.drip.execution.dynamics.*; -import org.drip.execution.impact.*; -import org.drip.execution.nonadaptive.ContinuousPowerImpact; -import org.drip.execution.optimum.PowerImpactContinuous; -import org.drip.execution.parameters.*; -import org.drip.execution.principal.Almgren2003Estimator; -import org.drip.execution.profiletime.*; -import org.drip.function.definition.R1ToR1; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OptimalTrajectoryMeasures demonstrates the Trade Scheduling using the Equity Market Impact Functions - * determined empirically by Almgren, Thum, Hauptmann, and Li (2005), using the Parameterization of Almgren - * (2003) for IBM. It generates the Transaction Cost/Principal Discount Measures from the Run The References - * are: - * - * - Almgren, R., and N. Chriss (1999): Value under Liquidation, Risk 12 (12). - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Almgren, R. (2003): Optimal Execution with Nonlinear Impact Functions and Trading-Enhanced Risk, - * Applied Mathematical Finance 10 (1) 1-18. - * - * - Almgren, R., and N. Chriss (2003): Bidding Principles, Risk 97-102. - * - * - Almgren, R., C. Thum, E. Hauptmann, and H. Li (2005): Equity Market Impact, Risk 18 (7) 57-62. - * - * @author Lakshmi Krishnamurthy - */ - -public class OptimalTrajectoryMeasures { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblS0 = 50.; - double dblX = 100000.; - double dblVolatility = 1.; - double dblDailyVolume = 1000000.; - double dblDailyVolumeExecutionFactor = 0.1; - double dblPermanentImpactFactor = 0.; - double dblTemporaryImpactFactor = 0.01; - double dblT = 5.; - int iNumInterval = 20; - double dblLambda = 1.e-06; - double dblK = 1.; - double dblPrincipalDiscount = 0.15; - - PriceMarketImpactPower pmip = new PriceMarketImpactPower ( - new AssetTransactionSettings ( - dblS0, - dblDailyVolume, - 0. - ), - dblPermanentImpactFactor, - dblTemporaryImpactFactor, - dblDailyVolumeExecutionFactor, - dblK - ); - - LinearPermanentExpectationParameters lpep = ArithmeticPriceEvolutionParametersBuilder.Almgren2003 ( - new ArithmeticPriceDynamicsSettings ( - 0., - new FlatUnivariate (dblVolatility), - 0. - ), - new UniformParticipationRateLinear ((ParticipationRateLinear) pmip.permanentTransactionFunction()), - new UniformParticipationRate ((ParticipationRatePower) pmip.temporaryTransactionFunction()) - ); - - ContinuousPowerImpact cpi = ContinuousPowerImpact.Standard ( - dblX, - dblT, - lpep, - dblLambda - ); - - PowerImpactContinuous pic = (PowerImpactContinuous) cpi.generate(); - - R1ToR1 r1ToR1Holdings = pic.holdings(); - - double[] adblHoldings = new double[iNumInterval]; - double[] adblExecutionTime = new double[iNumInterval]; - - for (int i = 1; i <= iNumInterval; ++i) { - adblExecutionTime[i - 1] = dblT * i / iNumInterval; - - adblHoldings[i - 1] = r1ToR1Holdings.evaluate (adblExecutionTime[i - 1]); - } - - Almgren2003Estimator a2003e = new Almgren2003Estimator ( - pic, - lpep - ); - - System.out.println(); - - System.out.println ("\t|----------------------------------||"); - - System.out.println ("\t| IBM ATHL 2005 Optimal Trajectory ||"); - - System.out.println ("\t|----------------------------------||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| - Execution Time Node ||"); - - System.out.println ("\t| - Holdings Remaining ||"); - - System.out.println ("\t| - Trade List Amount ||"); - - System.out.println ("\t| - Holdings (%) ||"); - - System.out.println ("\t|----------------------------------||"); - - for (int i = 1; i < adblExecutionTime.length; ++i) - System.out.println ( - "\t| " + - FormatUtil.FormatDouble (adblExecutionTime[i], 1, 2, 1.) + " | " + - FormatUtil.FormatDouble (adblHoldings[i], 5, 0, 1.) + " | " + - FormatUtil.FormatDouble (adblHoldings[i] - adblHoldings[i - 1], 5, 0, 1.) + " | " + - FormatUtil.FormatDouble (adblHoldings[i] / dblX, 2, 1, 100.) + "% ||" - ); - - System.out.println ("\t|----------------------------------||"); - - System.out.println(); - - System.out.println ("\t|-----------------------------------------------------------------------||"); - - System.out.println ("\t| IBM ATHL 2005 Optimal Trajectory Transaction Cost Measures ||"); - - System.out.println ("\t|-----------------------------------------------------------------------||"); - - System.out.println ( - "\t| Transaction Cost Expectation ( X 10^-03) : " + - FormatUtil.FormatDouble (pic.transactionCostExpectation(), 5, 2, 1.e-03) + " ||" - ); - - System.out.println ( - "\t| Transaction Cost Variance ( X 10^-06) : " + - FormatUtil.FormatDouble (pic.transactionCostVariance(), 5, 2, 1.e-06) + " ||" - ); - - System.out.println ( - "\t| Characteristic Time : " + - FormatUtil.FormatDouble (pic.characteristicTime(), 5, 2, 1.) + " ||" - ); - - System.out.println ( - "\t| Efficient Frontier Hyperboloid Boundary Value ( X 10^-12) : " + - FormatUtil.FormatDouble (pic.hyperboloidBoundaryValue(), 5, 2, 1.e-12) + " ||" - ); - - System.out.println ( - "\t| Break-even Principal Discount (cents per unit) : " + - FormatUtil.FormatDouble (a2003e.breakevenPrincipalDiscount(), 5, 2, 100.) + " ||" - ); - - System.out.println ( - "\t| Gross Profit Expectation : " + - FormatUtil.FormatDouble (a2003e.principalMeasure (dblPrincipalDiscount).mean(), 5, 2, 1.) + " ||" - ); - - System.out.println ( - "\t| Gross Profit Variance ( X 10^-06) : " + - FormatUtil.FormatDouble (a2003e.principalMeasure (dblPrincipalDiscount).variance(), 5, 2, 1.e-06) + " ||" - ); - - System.out.println ( - "\t| Gross Returns Expectation : " + - FormatUtil.FormatDouble (a2003e.horizonPrincipalMeasure (dblPrincipalDiscount).mean(), 5, 2, 1.) + " ||" - ); - - System.out.println ( - "\t| Gross Returns Variance ( X 10^-06) : " + - FormatUtil.FormatDouble (a2003e.horizonPrincipalMeasure (dblPrincipalDiscount).variance(), 5, 2, 1.e-06) + " ||" - ); - - System.out.println ( - "\t| Information Ratio ( X 10^+03) : " + - FormatUtil.FormatDouble (a2003e.informationRatio (dblPrincipalDiscount), 5, 2, 1.e+03) + " ||" - ); - - System.out.println ( - "\t| Optimal Information Ratio ( X 10^+03) : " + - FormatUtil.FormatDouble (a2003e.optimalInformationRatio (dblPrincipalDiscount), 5, 2, 1.e+03) + " ||" - ); - - System.out.println ( - "\t| Optimal Information Ratio Horizon : " + - FormatUtil.FormatDouble (a2003e.optimalInformationRatioHorizon (dblPrincipalDiscount), 5, 2, 1.) + " ||" - ); - - System.out.println ("\t|-----------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/rdtor1/ConstrainedCovarianceEllipsoid.java b/org/drip/sample/rdtor1/ConstrainedCovarianceEllipsoid.java deleted file mode 100644 index c4b3fac..0000000 --- a/org/drip/sample/rdtor1/ConstrainedCovarianceEllipsoid.java +++ /dev/null @@ -1,173 +0,0 @@ - -package org.drip.sample.rdtor1; - -import org.drip.function.definition.RdToR1; -import org.drip.function.rdtor1.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ConstrainedCovarianceEllipsoid demonstrates the Construction and Usage of a Co-variance Ellipsoid with - * Linear Constraints. - * - * @author Lakshmi Krishnamurthy - */ - -public class ConstrainedCovarianceEllipsoid { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double[][] aadblCovarianceMatrix = new double[][] { - {0.09, 0.12}, - {0.12, 0.04} - }; - - double[] adblEqualityConstraint = new double[] { - 1., - 1. - }; - - double dblEqualityConstraintConstant = -1.; - - AffineMultivariate lmConstraintRdToR1 = new AffineMultivariate ( - adblEqualityConstraint, - dblEqualityConstraintConstant - ); - - CovarianceEllipsoidMultivariate ceObjectiveRdToR1 = new CovarianceEllipsoidMultivariate (aadblCovarianceMatrix); - - LagrangianMultivariate ceec = new LagrangianMultivariate ( - ceObjectiveRdToR1, - new RdToR1[] { - lmConstraintRdToR1 - } - ); - - double[][] aadblVariate = { - {0.0, 1.0, 1.0}, - {0.1, 0.9, 1.0}, - {0.2, 0.8, 1.0}, - {0.3, 0.7, 1.0}, - {0.4, 0.6, 1.0}, - {0.5, 0.5, 1.0}, - {0.6, 0.4, 1.0}, - {0.7, 0.3, 1.0}, - {0.8, 0.2, 1.0}, - {0.9, 0.1, 1.0}, - {1.0, 0.0, 1.0}, - }; - - System.out.println ("\n\n\t|------------------------||"); - - System.out.println ("\t| POINT VALUE ||"); - - System.out.println ("\t|------------------------||"); - - for (double[] adblVariate : aadblVariate) - System.out.println ( - "\t| [" + adblVariate[0] + - " | " + adblVariate[1] + - "] = " + FormatUtil.FormatDouble (ceec.evaluate (adblVariate), 1, 4, 1.) + " ||" - ); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\n\t|-------------------------------------------||"); - - System.out.println ("\t| JACOBIAN ||"); - - System.out.println ("\t|-------------------------------------------||"); - - for (double[] adblVariate : aadblVariate) { - String strJacobian = ""; - - double[] adblJacobian = ceec.jacobian (adblVariate); - - for (double dblJacobian : adblJacobian) - strJacobian += FormatUtil.FormatDouble (dblJacobian, 1, 4, 1.) + ","; - - System.out.println ( - "\t| [" + adblVariate[0] + - " | " + adblVariate[1] + - "] = {" + strJacobian + "} ||" - ); - } - - System.out.println ("\t|-------------------------------------------||"); - - double[][] aadblHessian = ceec.hessian ( - new double[] { - 0.20, - 0.80, - 1. - } - ); - - System.out.println ("\n\n\t|----------------------------||"); - - System.out.println ("\t| HESSIAN ||"); - - System.out.println ("\t|----------------------------||"); - - for (double[] adblHessian : aadblHessian) { - String strHessian = ""; - - for (double dblHessian : adblHessian) - strHessian += FormatUtil.FormatDouble (dblHessian, 1, 4, 1.) + ","; - - System.out.println ("\t| [" + strHessian + "] ||"); - } - - System.out.println ("\t|----------------------------||"); - } -} diff --git a/org/drip/sample/rdtor1/UnconstrainedCovarianceEllipsoid.java b/org/drip/sample/rdtor1/UnconstrainedCovarianceEllipsoid.java deleted file mode 100644 index 4eb8526..0000000 --- a/org/drip/sample/rdtor1/UnconstrainedCovarianceEllipsoid.java +++ /dev/null @@ -1,151 +0,0 @@ - -package org.drip.sample.rdtor1; - -import org.drip.function.rdtor1.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * UnconstrainedCovarianceEllipsoid demonstrates the Construction and Usage of a Co-variance Ellipsoid. - * - * @author Lakshmi Krishnamurthy - */ - -public class UnconstrainedCovarianceEllipsoid { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double[][] aadblCovarianceMatrix = new double[][] { - {0.09, 0.12}, - {0.12, 0.04} - }; - - CovarianceEllipsoidMultivariate ce = new CovarianceEllipsoidMultivariate (aadblCovarianceMatrix); - - double[][] aadblVariate = { - {0.0, 1.0}, - {0.1, 0.9}, - {0.2, 0.8}, - {0.3, 0.7}, - {0.4, 0.6}, - {0.5, 0.5}, - {0.6, 0.4}, - {0.7, 0.3}, - {0.8, 0.2}, - {0.9, 0.1}, - {1.0, 0.0}, - }; - - System.out.println ("\n\n\t|------------------------||"); - - System.out.println ("\t| POINT VALUE ||"); - - System.out.println ("\t|------------------------||"); - - for (double[] adblVariate : aadblVariate) - System.out.println ( - "\t| [" + adblVariate[0] + - " | " + adblVariate[1] + - "] = " + FormatUtil.FormatDouble (ce.evaluate (adblVariate), 1, 4, 1.) + " ||" - ); - - System.out.println ("\t|------------------------||"); - - System.out.println ("\n\n\t|-----------------------------------||"); - - System.out.println ("\t| JACOBIAN ||"); - - System.out.println ("\t|-----------------------------------||"); - - for (double[] adblVariate : aadblVariate) { - String strJacobian = ""; - - double[] adblJacobian = ce.jacobian (adblVariate); - - for (double dblJacobian : adblJacobian) - strJacobian += FormatUtil.FormatDouble (dblJacobian, 1, 4, 1.) + ","; - - System.out.println ( - "\t| [" + adblVariate[0] + - " | " + adblVariate[1] + - "] = {" + strJacobian + "} ||" - ); - } - - System.out.println ("\t|-----------------------------------||"); - - double[][] aadblHessian = ce.hessian ( - new double[] { - 0.20, - 0.80 - } - ); - - System.out.println ("\n\n\t|--------------------||"); - - System.out.println ("\t| HESSIAN ||"); - - System.out.println ("\t|--------------------||"); - - for (double[] adblHessian : aadblHessian) { - String strHessian = ""; - - for (double dblHessian : adblHessian) - strHessian += FormatUtil.FormatDouble (dblHessian, 1, 4, 1.) + ","; - - System.out.println ("\t| [" + strHessian + "] ||"); - } - - System.out.println ("\t|--------------------||"); - } -} diff --git a/org/drip/sample/rng/LCGNumericalRecipesDouble.java b/org/drip/sample/rng/LCGNumericalRecipesDouble.java deleted file mode 100644 index 0ef8c30..0000000 --- a/org/drip/sample/rng/LCGNumericalRecipesDouble.java +++ /dev/null @@ -1,92 +0,0 @@ - -package org.drip.sample.rng; - -import org.drip.measure.crng.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * LCGNumericalRecipesDouble demonstrates the Construction and Invocation of Linear Congruential Generator - * based Random Number Double's. It uses MRG32k3a Variant of the L'Ecuyer's Multiple Recursive Generator. - * - * @author Lakshmi Krishnamurthy - */ - -public class LCGNumericalRecipesDouble { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iRow = 50; - int iColumn = 16; - - LinearCongruentialGenerator lcgNR = LinearCongruentialGenerator.NumericalRecipes ( - MultipleRecursiveGeneratorLEcuyer.MRG32k3a() - ); - - System.out.println(); - - System.out.println ("\t||---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < iRow; ++i) { - String strDump = "\t||"; - - for (int j = 0; j < iColumn; ++j) - strDump = strDump + FormatUtil.FormatDouble (lcgNR.nextDouble01(), 1, 8, 1.) + " |"; - - System.out.println (strDump + "|"); - } - - System.out.println ("\t||---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/rng/LCGNumericalRecipesLong.java b/org/drip/sample/rng/LCGNumericalRecipesLong.java deleted file mode 100644 index e9d408c..0000000 --- a/org/drip/sample/rng/LCGNumericalRecipesLong.java +++ /dev/null @@ -1,92 +0,0 @@ - -package org.drip.sample.rng; - -import org.drip.measure.crng.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * LCGNumericalRecipesLong demonstrates the Construction and Invocation of Linear Congruential Generator - * based Random Number Long's. It uses MRG32k3a Variant of the L'Ecuyer's Multiple Recursive Generator. - * - * @author Lakshmi Krishnamurthy - */ - -public class LCGNumericalRecipesLong { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iRow = 50; - int iColumn = 16; - - LinearCongruentialGenerator lcgNR = LinearCongruentialGenerator.NumericalRecipes ( - MultipleRecursiveGeneratorLEcuyer.MRG32k3a() - ); - - System.out.println(); - - System.out.println ("\t||---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < iRow; ++i) { - String strDump = "\t||"; - - for (int j = 0; j < iColumn; ++j) - strDump = strDump + FormatUtil.FormatDouble (lcgNR.nextLong(), 10, 0, 1.) + " |"; - - System.out.println (strDump + "|"); - } - - System.out.println ("\t||---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/rng/MRG32k3a.java b/org/drip/sample/rng/MRG32k3a.java deleted file mode 100644 index 2bd49db..0000000 --- a/org/drip/sample/rng/MRG32k3a.java +++ /dev/null @@ -1,90 +0,0 @@ - -package org.drip.sample.rng; - -import org.drip.measure.crng.MultipleRecursiveGeneratorLEcuyer; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * MRG32k3a demonstrates the Construction and Invocation of MRG32k3a Variant of the L'Ecuyer's Multiple - * Recursive Generator. - * - * @author Lakshmi Krishnamurthy - */ - -public class MRG32k3a { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iRow = 50; - int iColumn = 15; - - MultipleRecursiveGeneratorLEcuyer mrgl = MultipleRecursiveGeneratorLEcuyer.MRG32k3a(); - - System.out.println(); - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < iRow; ++i) { - String strDump = "\t||"; - - for (int j = 0; j < iColumn; ++j) - strDump = strDump + FormatUtil.FormatDouble (mrgl.next(), 11, 0, 1.) + " |"; - - System.out.println (strDump + "|"); - } - - System.out.println ("\t||-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/rng/ShiftRegisterDouble.java b/org/drip/sample/rng/ShiftRegisterDouble.java deleted file mode 100644 index 3d79320..0000000 --- a/org/drip/sample/rng/ShiftRegisterDouble.java +++ /dev/null @@ -1,91 +0,0 @@ - -package org.drip.sample.rng; - -import org.drip.measure.crng.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * ShiftRegisterDouble demonstrates the Construction and Invocation of Shift Register Generator based Random - * Number Double's. - * - * @author Lakshmi Krishnamurthy - */ - -public class ShiftRegisterDouble { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iRow = 50; - int iColumn = 16; - int iShiftBitSize = 16; - - ShiftRegisterGenerator srg = ShiftRegisterGenerator.Standard (iShiftBitSize); - - System.out.println(); - - System.out.println ("\t||---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < iRow; ++i) { - String strDump = "\t||"; - - for (int j = 0; j < iColumn; ++j) - strDump = strDump + FormatUtil.FormatDouble (srg.nextDouble01(), 1, 8, 1.) + " |"; - - System.out.println (strDump + "|"); - } - - System.out.println ("\t||---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/rng/ShiftRegisterLong.java b/org/drip/sample/rng/ShiftRegisterLong.java deleted file mode 100644 index 1da6e05..0000000 --- a/org/drip/sample/rng/ShiftRegisterLong.java +++ /dev/null @@ -1,91 +0,0 @@ - -package org.drip.sample.rng; - -import org.drip.measure.crng.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * ShiftRegisterLong demonstrates the Construction and Invocation of Shift Register Generator based Random - * Number Long's. - * - * @author Lakshmi Krishnamurthy - */ - -public class ShiftRegisterLong { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iRow = 50; - int iColumn = 16; - int iShiftBitSize = 32; - - ShiftRegisterGenerator srg = ShiftRegisterGenerator.Standard (iShiftBitSize); - - System.out.println(); - - System.out.println ("\t||---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < iRow; ++i) { - String strDump = "\t||"; - - for (int j = 0; j < iColumn; ++j) - strDump = strDump + FormatUtil.FormatDouble (srg.nextLong(), 10, 0, 1.) + " |"; - - System.out.println (strDump + "|"); - } - - System.out.println ("\t||---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/sabr/BlackVolatility.java b/org/drip/sample/sabr/BlackVolatility.java deleted file mode 100644 index 266eab0..0000000 --- a/org/drip/sample/sabr/BlackVolatility.java +++ /dev/null @@ -1,155 +0,0 @@ - -package org.drip.sample.sabr; - -import org.drip.dynamics.sabr.*; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.random.BoxMullerGaussian; -import org.drip.service.env.EnvManager; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BlackVolatility demonstrates the Construction and Usage of the SABR Model to Imply the Black Volatility of - * a given Contract. - * - * @author Lakshmi Krishnamurthy - */ - -public class BlackVolatility { - - private static StochasticVolatilityStateEvolver SABREvolver ( - final double dblBeta, - final double dblRho, - final double dblVolatilityOfVolatility) - throws Exception - { - return new StochasticVolatilityStateEvolver ( - ForwardLabel.Create ( - "USD", - "6M" - ), - dblBeta, - dblRho, - dblVolatilityOfVolatility, - new BoxMullerGaussian ( - 0., - 1. - ), - new BoxMullerGaussian ( - 0., - 1. - ) - ); - } - - private static void VolatilitySurface ( - final StochasticVolatilityStateEvolver seSABR, - final double[] adblStrike, - final double dblATMForwardRate, - final double dblTTE, - final double dblSigma0) - { - String strDump = "\t| " + FormatUtil.FormatDouble (dblTTE, 1, 2, 1.) + " => "; - - for (int i = 0; i < adblStrike.length; ++i) { - ImpliedBlackVolatility ibv = seSABR.computeBlackVolatility ( - adblStrike[i], - dblATMForwardRate, - dblTTE, - dblSigma0 - ); - - strDump += FormatUtil.FormatDouble (ibv.impliedVolatility(), 2, 1, 100.) + " | "; - } - - System.out.println (strDump); - } - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblRho = 0.; - double dblBeta = 0.7; - double dblATMForwardRate = 0.04; - double dblVolatilityOfVolatility = 0.5; - double adblForwardRateVolatility = 0.10; - double[] adblStrike = { - 0.30, 0.35, 0.40, 0.45, 0.50 - }; - double[] adblTTE = { - 0.25, 0.50, 0.75, 1.00, 2.00, 3.00, 4.00, 5.00, 7.00, 9.99 - }; - - StochasticVolatilityStateEvolver seSABR = SABREvolver ( - dblBeta, - dblRho, - dblVolatilityOfVolatility - ); - - System.out.println ("\n\t|------------------------------------------------|"); - - System.out.println ("\t| SABR IMPLIED BLACK VOLATILITY |"); - - System.out.println ("\t|------------------------------------------------|"); - - for (double dblTTE : adblTTE) - VolatilitySurface ( - seSABR, - adblStrike, - dblATMForwardRate, - dblTTE, - adblForwardRateVolatility - ); - - System.out.println ("\t|------------------------------------------------|"); - } -} diff --git a/org/drip/sample/sabr/ForwardRateEvolution.java b/org/drip/sample/sabr/ForwardRateEvolution.java deleted file mode 100644 index 9e91b6d..0000000 --- a/org/drip/sample/sabr/ForwardRateEvolution.java +++ /dev/null @@ -1,261 +0,0 @@ - -package org.drip.sample.sabr; - -import org.drip.analytics.date.*; -import org.drip.dynamics.sabr.*; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.random.BoxMullerGaussian; -import org.drip.service.env.EnvManager; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ForwardRateEvolution demonstrates the Construction and Usage of the SABR Model Dynamics for the Evolution - * of Forward Rate. - * - * @author Lakshmi Krishnamurthy - */ - -public class ForwardRateEvolution { - - private static StochasticVolatilityStateEvolver SABREvolver ( - final double dblBeta, - final double dblRho, - final double dblVolatilityOfVolatility) - throws Exception - { - return new StochasticVolatilityStateEvolver ( - ForwardLabel.Create ( - "USD", - "6M" - ), - dblBeta, - dblRho, - dblVolatilityOfVolatility, - new BoxMullerGaussian ( - 0., - 1. - ), - new BoxMullerGaussian ( - 0., - 1. - ) - ); - } - - private static void SABREvolution ( - final StochasticVolatilityStateEvolver seSABR1, - final StochasticVolatilityStateEvolver seSABR2, - final StochasticVolatilityStateEvolver seSABR3, - final int iSpotDate, - final int iTerminalDate, - final ForwardRateUpdate lsqmInitial1, - final ForwardRateUpdate lsqmInitial2, - final ForwardRateUpdate lsqmInitial3) - throws Exception - { - int iDayStep = 2; - int iDate = iSpotDate; - ForwardRateUpdate lsqm1 = lsqmInitial1; - ForwardRateUpdate lsqm2 = lsqmInitial2; - ForwardRateUpdate lsqm3 = lsqmInitial3; - - System.out.println ("\n\t||---------------------------------------------------------------------------------||"); - - System.out.println ("\t|| SABR EVOLUTION DYNAMICS ||"); - - System.out.println ("\t||---------------------------------------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| Forward Rate (%) - Gaussian (beta = 0.0) ||"); - - System.out.println ("\t|| Forward Rate Vol (%) - Gaussian (beta = 0.0) ||"); - - System.out.println ("\t|| Forward Rate (%) - beta = 0.5 ||"); - - System.out.println ("\t|| Forward Rate Vol (%) - beta = 0.5 ||"); - - System.out.println ("\t|| Forward Rate (%) - Lognormal (beta = 1.0) ||"); - - System.out.println ("\t|| Forward Rate Vol (%) - Lognormal (beta = 1.0) ||"); - - System.out.println ("\t||---------------------------------------------------------------------------------||"); - - while (iDate < iTerminalDate) { - lsqm1 = (ForwardRateUpdate) seSABR1.evolve ( - iSpotDate, - iDate, - iDayStep, - lsqm1 - ); - - lsqm2 = (ForwardRateUpdate) seSABR2.evolve ( - iSpotDate, - iDate, - iDayStep, - lsqm2 - ); - - lsqm3 = (ForwardRateUpdate) seSABR3.evolve ( - iSpotDate, - iDate, - iDayStep, - lsqm3 - ); - - System.out.println ( - "\t|| " + new JulianDate (iDate) + " => " + - FormatUtil.FormatDouble (lsqm1.forwardRate(), 1, 4, 100.) + " % | " + - FormatUtil.FormatDouble (lsqm1.forwardRateVolatility(), 1, 2, 100.) + " % || " + - FormatUtil.FormatDouble (lsqm2.forwardRate(), 1, 4, 100.) + " % | " + - FormatUtil.FormatDouble (lsqm2.forwardRateVolatility(), 1, 1, 100.) + " % || " + - FormatUtil.FormatDouble (lsqm3.forwardRate(), 1, 4, 100.) + " % | " + - FormatUtil.FormatDouble (lsqm3.forwardRateVolatility(), 1, 1, 100.) + " % ||" - ); - - iDate += iDayStep; - } - - System.out.println ("\t||---------------------------------------------------------------------------------||"); - } - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - double dblRho = 0.1; - double dblForwardRate = 0.04; - double dblVolatilityOfVolatility = 0.59; - String strViewTenor = "3M"; - double[] adblBeta = { - 0.00, 0.50, 1.00 - }; - double[] adblForwardRateVolatility = { - 0.03, 0.26, 0.51 - }; - - int iViewDate = dtSpot.addTenor (strViewTenor).julian(); - - StochasticVolatilityStateEvolver seSABR1 = SABREvolver ( - adblBeta[0], - dblRho, - dblVolatilityOfVolatility - ); - - StochasticVolatilityStateEvolver seSABR2 = SABREvolver ( - adblBeta[1], - dblRho, - dblVolatilityOfVolatility - ); - - StochasticVolatilityStateEvolver seSABR3 = SABREvolver ( - adblBeta[2], - dblRho, - dblVolatilityOfVolatility - ); - - ForwardRateUpdate lsqmInitial1 = ForwardRateUpdate.Create ( - ForwardLabel.Create ( - "USD", - "6M" - ), - dtSpot.julian(), - dtSpot.julian(), - iViewDate, - dblForwardRate, - 0., - adblForwardRateVolatility[0], - 0. - ); - - ForwardRateUpdate lsqmInitial2 = ForwardRateUpdate.Create ( - ForwardLabel.Create ( - "USD", - "6M" - ), - dtSpot.julian(), - dtSpot.julian(), - iViewDate, - dblForwardRate, - 0., - adblForwardRateVolatility[1], - 0. - ); - - ForwardRateUpdate lsqmInitial3 = ForwardRateUpdate.Create ( - ForwardLabel.Create ( - "USD", - "6M" - ), - dtSpot.julian(), - dtSpot.julian(), - iViewDate, - dblForwardRate, - 0., - adblForwardRateVolatility[2], - 0. - ); - - SABREvolution ( - seSABR1, - seSABR2, - seSABR3, - dtSpot.julian(), - iViewDate, - lsqmInitial1, - lsqmInitial2, - lsqmInitial3 - ); - } -} diff --git a/org/drip/sample/semidefinite/DualConstrainedEllipsoidVariance.java b/org/drip/sample/semidefinite/DualConstrainedEllipsoidVariance.java deleted file mode 100644 index 4d1a74e..0000000 --- a/org/drip/sample/semidefinite/DualConstrainedEllipsoidVariance.java +++ /dev/null @@ -1,208 +0,0 @@ - -package org.drip.sample.semidefinite; - -import org.drip.function.definition.RdToR1; -import org.drip.function.rdtor1.*; -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DualConstrainedEllipsoidVariance demonstrates the Application of the Interior Point Method for Minimizing - * the Variance Across The Specified Ellipsoid under both Normalization and first Moment Constraints. - * - * @author Lakshmi Krishnamurthy - */ - -public class DualConstrainedEllipsoidVariance { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrEntityName = new String[] { - "IBM", - "ATT", - "ALU", - "QCO", - "INT", - "MSF", - "VER" - }; - - double[] adblEntityReturn = new double[] { - 0.0264, - 0.0332, - 0.0400, - 0.0468, - 0.0536, - 0.0604, - 0.0672 - }; - - double dblEntityDesignReturn = 0.0468; - - double[][] aadblEntityCovariance = new double[][] { - {1.00, 0.76, 0.80, 0.38, 0.60, 0.61, 0.51}, - {0.76, 1.00, 0.65, 0.35, 0.56, 0.43, 0.40}, - {0.80, 0.65, 1.00, 0.68, 0.74, 0.40, 0.51}, - {0.38, 0.35, 0.68, 1.00, 0.72, 0.02, 0.57}, - {0.60, 0.56, 0.74, 0.72, 1.00, 0.31, 0.67}, - {0.61, 0.43, 0.40, 0.02, 0.31, 1.00, 0.39}, - {0.51, 0.40, 0.51, 0.57, 0.67, 0.39, 1.00} - }; - - System.out.println ("\n\n\t|------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrEntityName.length; ++i) - strHeader += " " + astrEntityName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------||"); - - for (int i = 0; i < astrEntityName.length; ++i) { - String strDump = "\t| " + astrEntityName[i] + " "; - - for (int j = 0; j < astrEntityName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblEntityCovariance[i][j], 1, 2, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------||\n\n"); - - double dblEqualityConstraintConstant = -1.; - int iNumEntity = aadblEntityCovariance.length; - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - RdToR1[] aRdToR1EqualityConstraint = new RdToR1[] { - new AffineMultivariate ( - ObjectiveConstraintVariateSet.Unitary (iNumEntity), - dblEqualityConstraintConstant - ), - new AffineMultivariate ( - adblEntityReturn, - -1. * dblEntityDesignReturn - ) - }; - - int iNumEqualityConstraint = aRdToR1EqualityConstraint.length; - - RdToR1[] aRdToR1InequalityConstraint = new RdToR1[] { - new AffineBoundMultivariate (false, 0, iNumEntity + iNumEqualityConstraint, 0.05), - new AffineBoundMultivariate (true, 0, iNumEntity + iNumEqualityConstraint, 0.65), - new AffineBoundMultivariate (false, 1, iNumEntity + iNumEqualityConstraint, 0.05), - new AffineBoundMultivariate (true, 1, iNumEntity + iNumEqualityConstraint, 0.65), - new AffineBoundMultivariate (false, 2, iNumEntity + iNumEqualityConstraint, 0.05), - new AffineBoundMultivariate (true, 2, iNumEntity + iNumEqualityConstraint, 0.65), - new AffineBoundMultivariate (false, 3, iNumEntity + iNumEqualityConstraint, 0.05), - new AffineBoundMultivariate (true, 3, iNumEntity + iNumEqualityConstraint, 0.65), - new AffineBoundMultivariate (false, 4, iNumEntity + iNumEqualityConstraint, 0.05), - new AffineBoundMultivariate (true, 4, iNumEntity + iNumEqualityConstraint, 0.65), - new AffineBoundMultivariate (false, 5, iNumEntity + iNumEqualityConstraint, 0.05), - new AffineBoundMultivariate (true, 5, iNumEntity + iNumEqualityConstraint, 0.65), - new AffineBoundMultivariate (false, 6, iNumEntity + iNumEqualityConstraint, 0.05), - new AffineBoundMultivariate (true, 6, iNumEntity + iNumEqualityConstraint, 0.65) - }; - - LagrangianMultivariate ceec = new LagrangianMultivariate ( - new CovarianceEllipsoidMultivariate (aadblEntityCovariance), - aRdToR1EqualityConstraint - ); - - BarrierFixedPointFinder ifpm = new BarrierFixedPointFinder ( - ceec, - aRdToR1InequalityConstraint, - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - VariateInequalityConstraintMultiplier vcmt = ifpm.solve ( - ObjectiveConstraintVariateSet.Uniform ( - iNumEntity, - ceec.constraintFunctionDimension() - ) - ); - - double[] adblOptimalVariate = vcmt.variates(); - - System.out.println ("\t|----------------------||"); - - System.out.println ("\t| OPTIMAL ENTITIES ||"); - - System.out.println ("\t|----------------------||"); - - double dblExpectedReturn = 0.; - - for (int i = 0; i < iNumEntity; ++i) { - System.out.println ("\t| " + astrEntityName[i] + " => " + FormatUtil.FormatDouble (adblOptimalVariate[i], 2, 2, 100.) + "% ||"); - - dblExpectedReturn += adblOptimalVariate[i] * adblEntityReturn[i]; - } - - System.out.println ("\t|----------------------||\n"); - - System.out.println ("\t|------------------------------||"); - - System.out.println ("\t| DESIGN RETURN => " + FormatUtil.FormatDouble (dblEntityDesignReturn, 1, 5, 1.) + " ||"); - - System.out.println ("\t| EXPECTED RETURN => " + FormatUtil.FormatDouble (dblExpectedReturn, 1, 5, 1.) + " ||"); - - System.out.println ("\t| OPTIMAL VARIANCE => " + FormatUtil.FormatDouble (ceec.evaluate (adblOptimalVariate), 1, 5, 1.) + " ||"); - - System.out.println ("\t|------------------------------||\n"); - } -} diff --git a/org/drip/sample/semidefinite/TwoVariateConstrainedVariance.java b/org/drip/sample/semidefinite/TwoVariateConstrainedVariance.java deleted file mode 100644 index 4b77131..0000000 --- a/org/drip/sample/semidefinite/TwoVariateConstrainedVariance.java +++ /dev/null @@ -1,215 +0,0 @@ - -package org.drip.sample.semidefinite; - -import org.drip.function.definition.RdToR1; -import org.drip.function.rdtor1.*; -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TwoVariateConstrainedVariance demonstrates the Application of the Interior Point Method for minimizing - * the Variance Across Two Variates under the Normalization Constraint. - * - * @author Lakshmi Krishnamurthy - */ - -public class TwoVariateConstrainedVariance { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double[][] aadblCovarianceMatrix = new double[][] { - {0.09, 0.12}, - {0.12, 0.04} - }; - - double[] adblEqualityConstraint = new double[] { - 1., - 1. - }; - - double dblEqualityConstraintConstant = -1.; - int iObjectiveDimension = aadblCovarianceMatrix.length; - - RdToR1[] aEqualityConstraintRdToR1 = new AffineMultivariate[] { - new AffineMultivariate ( - adblEqualityConstraint, - dblEqualityConstraintConstant - ) - }; - - int iNumEqualityConstraint = aEqualityConstraintRdToR1.length; - - AffineBoundMultivariate lmbConstraint1 = new AffineBoundMultivariate ( - true, - 0, - 2 + iNumEqualityConstraint, - 0.65 - ); - - AffineBoundMultivariate lmbConstraint2 = new AffineBoundMultivariate ( - true, - 1, - 2 + iNumEqualityConstraint, - 0.65 - ); - - AffineBoundMultivariate lmbConstraint3 = new AffineBoundMultivariate ( - false, - 0, - 2 + iNumEqualityConstraint, - 0.15 - ); - - AffineBoundMultivariate lmbConstraint4 = new AffineBoundMultivariate ( - false, - 1, - 2 + iNumEqualityConstraint, - 0.15 - ); - - RdToR1[] aRdToR1InequalityConstraint = new RdToR1[] { - lmbConstraint1, - lmbConstraint2, - lmbConstraint3, - lmbConstraint4 - }; - - double dblBarrierStrength = 1.; - - CovarianceEllipsoidMultivariate ce = new CovarianceEllipsoidMultivariate (aadblCovarianceMatrix); - - LagrangianMultivariate ceec = new LagrangianMultivariate ( - ce, - aEqualityConstraintRdToR1 - ); - - double[] adblStartingVariate = ObjectiveConstraintVariateSet.Uniform ( - iObjectiveDimension, - 1 - ); - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - BarrierFixedPointFinder ifpm = new BarrierFixedPointFinder ( - ceec, - aRdToR1InequalityConstraint, - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - VariateInequalityConstraintMultiplier vcmt = ifpm.solve (adblStartingVariate); - - System.out.println ("\n\n\t|----------------------------------------------------||"); - - System.out.println ( - "\t| OPTIMAL VARIATES => " + FormatUtil.FormatDouble (vcmt.variates()[0], 1, 5, 1.) + - " | " + FormatUtil.FormatDouble (vcmt.variates()[1], 1, 5, 1.) + - " | " + FormatUtil.FormatDouble (ceec.evaluate (vcmt.variates()), 1, 5, 1.) + " ||" - ); - - System.out.println ("\t|----------------------------------------------------||\n\n"); - - int iStepDown = 20; - - double[] adblConstraintMultiplier = new double[aRdToR1InequalityConstraint.length]; - - for (int i = 0; i < aRdToR1InequalityConstraint.length; ++i) - adblConstraintMultiplier[i] = dblBarrierStrength / aRdToR1InequalityConstraint[i].evaluate (adblStartingVariate); - - vcmt = new VariateInequalityConstraintMultiplier ( - false, - adblStartingVariate, - adblConstraintMultiplier - ); - - ConvergenceControl cc = new ConvergenceControl ( - ConvergenceControl.OBJECTIVE_FUNCTION_SEQUENCE_CONVERGENCE, - 5.0e-02, - 1.0e-06, - 70 - ); - - System.out.println ("\t|-------------------------------------------------||"); - - System.out.println ("\t| BARRIER => VARIATES | VARIANCE ||"); - - System.out.println ("\t|-------------------------------------------------||"); - - while (--iStepDown > 0) { - InteriorFixedPointFinder bfpf = new InteriorFixedPointFinder ( - ceec, - aRdToR1InequalityConstraint, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false), - cc, - dblBarrierStrength - ); - - vcmt = bfpf.find (vcmt); - - adblStartingVariate = vcmt.variates(); - - System.out.println ( - "\t| " + FormatUtil.FormatDouble (dblBarrierStrength, 1, 10, 1.) + - " => " + FormatUtil.FormatDouble (vcmt.variates()[0], 1, 5, 1.) + - " | " + FormatUtil.FormatDouble (vcmt.variates()[1], 1, 5, 1.) + - " | " + FormatUtil.FormatDouble (ceec.evaluate (vcmt.variates()), 1, 5, 1.) + " ||" - ); - - dblBarrierStrength *= 0.5; - } - - System.out.println ("\t|-------------------------------------------------||\n\n"); - } -} diff --git a/org/drip/sample/semidefinite/WeightConstrainedEllipsoidVariance.java b/org/drip/sample/semidefinite/WeightConstrainedEllipsoidVariance.java deleted file mode 100644 index 6c18409..0000000 --- a/org/drip/sample/semidefinite/WeightConstrainedEllipsoidVariance.java +++ /dev/null @@ -1,183 +0,0 @@ - -package org.drip.sample.semidefinite; - -import org.drip.function.definition.RdToR1; -import org.drip.function.rdtor1.*; -import org.drip.function.rdtor1descent.LineStepEvolutionControl; -import org.drip.function.rdtor1solver.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * WeightConstrainedEllipsoidVariance demonstrates the Application of the Interior Point Method for - * Minimizing the Variance Across The Specified Ellipsoid under the Normalization Constraint. - * - * @author Lakshmi Krishnamurthy - */ - -public class WeightConstrainedEllipsoidVariance { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrEntityName = new String[] { - "IBM", - "ATT", - "ALU", - "QCO", - "INT", - "MSF", - "VER" - }; - - double[][] aadblCovarianceMatrix = new double[][] { - {1.00, 0.76, 0.80, 0.38, 0.60, 0.61, 0.51}, - {0.76, 1.00, 0.65, 0.35, 0.56, 0.43, 0.40}, - {0.80, 0.65, 1.00, 0.68, 0.74, 0.40, 0.51}, - {0.38, 0.35, 0.68, 1.00, 0.72, 0.02, 0.57}, - {0.60, 0.56, 0.74, 0.72, 1.00, 0.31, 0.67}, - {0.61, 0.43, 0.40, 0.02, 0.31, 1.00, 0.39}, - {0.51, 0.40, 0.51, 0.57, 0.67, 0.39, 1.00} - }; - - System.out.println ("\n\n\t|------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrEntityName.length; ++i) - strHeader += " " + astrEntityName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------||"); - - for (int i = 0; i < astrEntityName.length; ++i) { - String strDump = "\t| " + astrEntityName[i] + " "; - - for (int j = 0; j < astrEntityName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble (aadblCovarianceMatrix[i][j], 1, 2, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------||\n\n"); - - double dblEqualityConstraintConstant = -1.; - int iNumEntity = aadblCovarianceMatrix.length; - - InteriorPointBarrierControl ipbc = InteriorPointBarrierControl.Standard(); - - RdToR1[] aRdToR1EqualityConstraint = new RdToR1[] { - new AffineMultivariate ( - ObjectiveConstraintVariateSet.Unitary (iNumEntity), - dblEqualityConstraintConstant - ) - }; - - int iNumEqualityConstraint = aRdToR1EqualityConstraint.length; - - RdToR1[] aRdToR1InequalityConstraint = new RdToR1[] { - new AffineBoundMultivariate (false, 0, iNumEntity + iNumEqualityConstraint, 0.05), - new AffineBoundMultivariate (true, 0, iNumEntity + iNumEqualityConstraint, 0.65), - new AffineBoundMultivariate (false, 1, iNumEntity + iNumEqualityConstraint, 0.05), - new AffineBoundMultivariate (true, 1, iNumEntity + iNumEqualityConstraint, 0.65), - new AffineBoundMultivariate (false, 2, iNumEntity + iNumEqualityConstraint, 0.05), - new AffineBoundMultivariate (true, 2, iNumEntity + iNumEqualityConstraint, 0.65), - new AffineBoundMultivariate (false, 3, iNumEntity + iNumEqualityConstraint, 0.05), - new AffineBoundMultivariate (true, 3, iNumEntity + iNumEqualityConstraint, 0.65), - new AffineBoundMultivariate (false, 4, iNumEntity + iNumEqualityConstraint, 0.05), - new AffineBoundMultivariate (true, 4, iNumEntity + iNumEqualityConstraint, 0.65), - new AffineBoundMultivariate (false, 5, iNumEntity + iNumEqualityConstraint, 0.05), - new AffineBoundMultivariate (true, 5, iNumEntity + iNumEqualityConstraint, 0.65), - new AffineBoundMultivariate (false, 6, iNumEntity + iNumEqualityConstraint, 0.05), - new AffineBoundMultivariate (true, 6, iNumEntity + iNumEqualityConstraint, 0.65) - }; - - LagrangianMultivariate ceec = new LagrangianMultivariate ( - new CovarianceEllipsoidMultivariate (aadblCovarianceMatrix), - aRdToR1EqualityConstraint - ); - - BarrierFixedPointFinder ifpm = new BarrierFixedPointFinder ( - ceec, - aRdToR1InequalityConstraint, - ipbc, - LineStepEvolutionControl.NocedalWrightStrongWolfe (false) - ); - - VariateInequalityConstraintMultiplier vcmt = ifpm.solve ( - ObjectiveConstraintVariateSet.Uniform ( - iNumEntity, - iNumEqualityConstraint - ) - ); - - double[] adblOptimalVariate = vcmt.variates(); - - System.out.println ("\t|----------------------||"); - - System.out.println ("\t| OPTIMAL ENTITIES ||"); - - System.out.println ("\t|----------------------||"); - - for (int i = 0; i < iNumEntity; ++i) - System.out.println ("\t| " + astrEntityName[i] + " => " + FormatUtil.FormatDouble (adblOptimalVariate[i], 2, 2, 100.) + "% ||"); - - System.out.println ("\t|----------------------||\n"); - - System.out.println ("\t|------------------------------||"); - - System.out.println ("\t| OPTIMAL VARIANCE => " + FormatUtil.FormatDouble (ceec.evaluate (adblOptimalVariate), 1, 5, 1.) + " ||"); - - System.out.println ("\t|------------------------------||\n"); - } -} diff --git a/org/drip/sample/sensitivity/ForwardDerivedBasisSensitivity.java b/org/drip/sample/sensitivity/ForwardDerivedBasisSensitivity.java deleted file mode 100644 index ed1320b..0000000 --- a/org/drip/sample/sensitivity/ForwardDerivedBasisSensitivity.java +++ /dev/null @@ -1,709 +0,0 @@ - -package org.drip.sample.sensitivity; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.*; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * ForwardDerivedBasisSensitivity contains the sample demonstrating the full functionality behind creating - * highly customized spline based forward curves. - * - * The first sample illustrates the creation and usage of the xM-6M Tenor Basis Swap: - * - Construct the 6M-xM float-float basis swap. - * - Calculate the corresponding starting forward rate off of the discount curve. - * - Construct the shape preserving forward curve off of Cubic Polynomial Basis Spline. - * - Construct the shape preserving forward curve off of Quartic Polynomial Basis Spline. - * - Construct the shape preserving forward curve off of Hyperbolic Tension Based Basis Spline. - * - Set the discount curve based component market parameters. - * - Set the discount curve + cubic polynomial forward curve based component market parameters. - * - Set the discount curve + quartic polynomial forward curve based component market parameters. - * - Set the discount curve + hyperbolic tension forward curve based component market parameters. - * - Compute the following forward curve metrics for each of cubic polynomial forward, quartic - * polynomial forward, and KLK Hyperbolic tension forward curves: - * - Reference Basis Par Spread - * - Derived Basis Par Spread - * - Compare these with a) the forward rate off of the discount curve, b) The LIBOR rate, and c) The - * Input Basis Swap Quote. - * - * The second sample illustrates how to build and test the forward curves across various tenor basis. It - * shows the following steps: - * - Construct the Discount Curve using its instruments and quotes. - * - Build and run the sampling for the 1M-6M Tenor Basis Swap from its instruments and quotes. - * - Build and run the sampling for the 3M-6M Tenor Basis Swap from its instruments and quotes. - * - Build and run the sampling for the 6M-6M Tenor Basis Swap from its instruments and quotes. - * - Build and run the sampling for the 12M-6M Tenor Basis Swap from its instruments and quotes. - * - * @author Lakshmi Krishnamurthy - */ - -public class ForwardDerivedBasisSensitivity { - - private static final FixFloatComponent OTCFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final FloatFloatComponent OTCFloatFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strDerivedTenor, - final String strMaturityTenor, - final double dblBasis) - { - FloatFloatSwapConvention ffConv = IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - return ffConv.createFloatFloatComponent ( - dtSpot, - strDerivedTenor, - strMaturityTenor, - dblBasis, - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFutures, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFutures]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - aiDay[i] + "D" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFutures, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFutures; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.0009875, // 9M - 0.00122, // 1Y - 0.00223, // 18M - 0.00383, // 2Y - 0.00827, // 3Y - 0.01245, // 4Y - 0.01605, // 5Y - 0.02597 // 10Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 9M - "SwapRate", // 1Y - "SwapRate", // 18M - "SwapRate", // 2Y - "SwapRate", // 3Y - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate" // 10Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "9M", - "1Y", - "18M", - "2Y", - "3Y", - "4Y", - "5Y", - "10Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - aDepositComp, - adblDepositQuote, - null, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - } - - /* - * Construct an array of float-float swaps from the corresponding reference (6M) and the derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FloatFloatComponent[] MakexM6MBasisSwap ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final int iTenorInMonths) - throws Exception - { - FloatFloatComponent[] aFFC = new FloatFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aFFC[i] = OTCFloatFloat ( - dtSpot, - strCurrency, - iTenorInMonths + "M", - astrMaturityTenor[i], - 0. - ); - - return aFFC; - } - - private static final void ForwardJack ( - final JulianDate dt, - final Map mapForward, - final String strStartDateTenor) - { - for (Map.Entry me : mapForward.entrySet()) - System.out.println (me.getKey() + " | " + strStartDateTenor + ": " + - me.getValue().jackDForwardDManifestMeasure ( - "PV", - dt.addTenor (strStartDateTenor)).displayString() - ); - } - - private static final void ForwardJack ( - final JulianDate dt, - final Map mapForward) - { - ForwardJack (dt, mapForward, "1Y"); - - ForwardJack (dt, mapForward, "2Y"); - - ForwardJack (dt, mapForward, "3Y"); - - ForwardJack (dt, mapForward, "5Y"); - - ForwardJack (dt, mapForward, "7Y"); - } - - /* - * This sample illustrates the creation and usage of the xM-6M Tenor Basis Swap. It shows the following: - * - Construct the 6M-xM float-float basis swap. - * - Calculate the corresponding starting forward rate off of the discount curve. - * - Construct the shape preserving forward curve off of Cubic Polynomial Basis Spline. - * - Construct the shape preserving forward curve off of Quartic Polynomial Basis Spline. - * - Construct the shape preserving forward curve off of Hyperbolic Tension Based Basis Spline. - * - Set the discount curve based component market parameters. - * - Set the discount curve + cubic polynomial forward curve based component market parameters. - * - Set the discount curve + quartic polynomial forward curve based component market parameters. - * - Set the discount curve + hyperbolic tension forward curve based component market parameters. - * - Compute the following forward curve metrics for each of cubic polynomial forward, quartic - * polynomial forward, and KLK Hyperbolic tension forward curves: - * - Reference Basis Par Spread - * - Derived Basis Par Spread - * - Compare these with a) the forward rate off of the discount curve, b) The LIBOR rate, and c) The - * Input Basis Swap Quote. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final Map xM6MBasisSample ( - final JulianDate dtSpot, - final String strCurrency, - final MergedDiscountForwardCurve dc, - final int iTenorInMonths, - final String[] astrxM6MFwdTenor, - final double[] adblxM6MBasisSwapQuote) - throws Exception - { - System.out.println ("------------------------------------------------------------"); - - System.out.println (" SPL => n=4 | | |"); - - System.out.println ("---------------------------------------| LOG DF | LIBOR |"); - - System.out.println (" MSR => RECALC | REFEREN | DERIVED | | |"); - - System.out.println ("------------------------------------------------------------"); - - /* - * Construct the 6M-xM float-float basis swap. - */ - - FloatFloatComponent[] aFFC = MakexM6MBasisSwap ( - dtSpot, - strCurrency, - astrxM6MFwdTenor, - iTenorInMonths - ); - - String strBasisTenor = iTenorInMonths + "M"; - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Calculate the starting forward rate off of the discount curve. - */ - - double dblStartingFwd = dc.forward ( - dtSpot.julian(), - dtSpot.addTenor (strBasisTenor).julian() - ); - - /* - * Set the discount curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - Map mapForward = new HashMap(); - - /* - * Construct the shape preserving forward curve off of Quartic Polynomial Basis Spline. - */ - - ForwardCurve fcxMQuartic = ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - "QUARTIC_FWD" + strBasisTenor, - ForwardLabel.Create ( - strCurrency, - strBasisTenor - ), - valParams, - null, - mktParams, - null, - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (5), - aFFC, - "ReferenceParBasisSpread", - adblxM6MBasisSwapQuote, - dblStartingFwd - ); - - mapForward.put ( - " QUARTIC_FWD" + strBasisTenor, - fcxMQuartic - ); - - /* - * Set the discount curve + quartic polynomial forward curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParamsQuarticFwd = MarketParamsBuilder.Create ( - dc, - fcxMQuartic, - null, - null, - null, - null, - null, - null - ); - - int i = 0; - int iFreq = 12 / iTenorInMonths; - - /* - * Compute the following forward curve metrics for each of cubic polynomial forward, quartic - * polynomial forward, and KLK Hyperbolic tension forward curves: - * - Reference Basis Par Spread - * - Derived Basis Par Spread - * - * Further compare these with a) the forward rate off of the discount curve, b) the LIBOR rate, and - * c) Input Basis Swap Quote. - */ - - for (String strMaturityTenor : astrxM6MFwdTenor) { - int iFwdEndDate = dtSpot.addTenor (strMaturityTenor).julian(); - - int iFwdStartDate = dtSpot.addTenor (strMaturityTenor).subtractTenor (strBasisTenor).julian(); - - FloatFloatComponent ffc = aFFC[i++]; - - CaseInsensitiveTreeMap mapQuarticValue = ffc.value ( - valParams, - null, - mktParamsQuarticFwd, - null - ); - - System.out.println (" " + strMaturityTenor + " => " + - FormatUtil.FormatDouble (fcxMQuartic.forward (strMaturityTenor), 2, 2, 100.) + " | " + - FormatUtil.FormatDouble (mapQuarticValue.get ("ReferenceParBasisSpread"), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (mapQuarticValue.get ("DerivedParBasisSpread"), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (iFreq * java.lang.Math.log (dc.df (iFwdStartDate) / dc.df (iFwdEndDate)), 1, 2, 100.) + " | " + - FormatUtil.FormatDouble (dc.libor (iFwdStartDate, iFwdEndDate), 1, 2, 100.) + " | " - ); - } - - return mapForward; - } - - /* - * This sample illustrates how to build and test the forward curves across various tenor basis. It shows - * the following steps: - * - Construct the Discount Curve using its instruments and quotes. - * - Build and run the sampling for the 1M-6M Tenor Basis Swap from its instruments and quotes. - * - Build and run the sampling for the 3M-6M Tenor Basis Swap from its instruments and quotes. - * - Build and run the sampling for the 6M-6M Tenor Basis Swap from its instruments and quotes. - * - Build and run the sampling for the 12M-6M Tenor Basis Swap from its instruments and quotes. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void CustomForwardCurveBuilderSample() - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strCurrency = "AUD"; - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - /* - * Construct the Discount Curve using its instruments and quotes - */ - - MergedDiscountForwardCurve dc = MakeDC ( - dtToday, - strCurrency - ); - - System.out.println ("\n------------------------------------------------------------"); - - System.out.println ("------------------- 1M-6M Basis Swap -----------------"); - - /* - * Build and run the sampling for the 1M-6M Tenor Basis Swap from its instruments and quotes. - */ - - Map mapForward1M6M = xM6MBasisSample ( - dtToday, - strCurrency, - dc, - 1, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00551, // 1Y - 0.00387, // 2Y - 0.00298, // 3Y - 0.00247, // 4Y - 0.00211, // 5Y - 0.00185, // 6Y - 0.00165, // 7Y - 0.00150, // 8Y - 0.00137, // 9Y - 0.00127, // 10Y - 0.00119, // 11Y - 0.00112, // 12Y - 0.00096, // 15Y - 0.00079, // 20Y - 0.00069, // 25Y - 0.00062 // 30Y - } - ); - - /* - * Build and run the sampling for the 3M-6M Tenor Basis Swap from its instruments and quotes. - */ - - System.out.println ("\n------------------------------------------------------------"); - - System.out.println ("------------------- 3M-6M Basis Swap -----------------"); - - Map mapForward3M6M = xM6MBasisSample ( - dtToday, - strCurrency, - dc, - 3, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00186, // 1Y - 0.00127, // 2Y - 0.00097, // 3Y - 0.00080, // 4Y - 0.00067, // 5Y - 0.00058, // 6Y - 0.00051, // 7Y - 0.00046, // 8Y - 0.00042, // 9Y - 0.00038, // 10Y - 0.00035, // 11Y - 0.00033, // 12Y - 0.00028, // 15Y - 0.00022, // 20Y - 0.00020, // 25Y - 0.00018 // 30Y - } - ); - - /* - * Build and run the sampling for the 12M-6M Tenor Basis Swap from its instruments and quotes. - */ - - System.out.println ("\n------------------------------------------------------------"); - - System.out.println ("------------------- 12M-6M Basis Swap -----------------"); - - Map mapForward12M6M = xM6MBasisSample ( - dtToday, - strCurrency, - dc, - 12, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "35Y", "40Y" - }, - new double[] { - -0.00212, // 1Y - -0.00152, // 2Y - -0.00117, // 3Y - -0.00097, // 4Y - -0.00082, // 5Y - -0.00072, // 6Y - -0.00063, // 7Y - -0.00057, // 8Y - -0.00051, // 9Y - -0.00047, // 10Y - -0.00044, // 11Y - -0.00041, // 12Y - -0.00035, // 15Y - -0.00028, // 20Y - -0.00025, // 25Y - -0.00022, // 30Y - -0.00022, // 35Y Extrapolated - -0.00022, // 40Y Extrapolated - } - ); - - System.out.println ("\n--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("------------------------------------------------------- 1M-6M Micro Jack -------------------------------------------------------------------"); - - System.out.println ("--------------------------------------------------------------------------------------------------------------------------------------------\n"); - - ForwardJack ( - dtToday, - mapForward1M6M - ); - - System.out.println ("\n--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("------------------------------------------------------- 3M-6M Micro Jack -------------------------------------------------------------------"); - - System.out.println ("--------------------------------------------------------------------------------------------------------------------------------------------\n"); - - ForwardJack ( - dtToday, - mapForward3M6M - ); - - System.out.println ("\n--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("------------------------------------------------------ 12M-6M Micro Jack -------------------------------------------------------------------"); - - System.out.println ("--------------------------------------------------------------------------------------------------------------------------------------------\n"); - - ForwardJack ( - dtToday, - mapForward12M6M - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - CustomForwardCurveBuilderSample(); - } -} diff --git a/org/drip/sample/sensitivity/ForwardReferenceBasisSensitivity.java b/org/drip/sample/sensitivity/ForwardReferenceBasisSensitivity.java deleted file mode 100644 index 0f2fd95..0000000 --- a/org/drip/sample/sensitivity/ForwardReferenceBasisSensitivity.java +++ /dev/null @@ -1,704 +0,0 @@ - -package org.drip.sample.sensitivity; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.*; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * ForwardReferenceBasisSensitivity contains the sample demonstrating the full functionality behind creating - * highly customized spline based forward curves. - * - * The first sample illustrates the creation and usage of the xM-6M Tenor Basis Swap: - * - Construct the 6M-xM float-float basis swap. - * - Calculate the corresponding starting forward rate off of the discount curve. - * - Construct the shape preserving forward curve off of Cubic Polynomial Basis Spline. - * - Construct the shape preserving forward curve off of Quartic Polynomial Basis Spline. - * - Construct the shape preserving forward curve off of Hyperbolic Tension Based Basis Spline. - * - Set the discount curve based component market parameters. - * - Set the discount curve + cubic polynomial forward curve based component market parameters. - * - Set the discount curve + quartic polynomial forward curve based component market parameters. - * - Set the discount curve + hyperbolic tension forward curve based component market parameters. - * - Compute the following forward curve metrics for each of cubic polynomial forward, quartic - * polynomial forward, and KLK Hyperbolic tension forward curves: - * - Reference Basis Par Spread - * - Derived Basis Par Spread - * - Compare these with a) the forward rate off of the discount curve, b) The LIBOR rate, and c) The - * Input Basis Swap Quote. - * - * The second sample illustrates how to build and test the forward curves across various tenor basis. It - * shows the following steps: - * - Construct the Discount Curve using its instruments and quotes. - * - Build and run the sampling for the 1M-6M Tenor Basis Swap from its instruments and quotes. - * - Build and run the sampling for the 3M-6M Tenor Basis Swap from its instruments and quotes. - * - Build and run the sampling for the 6M-6M Tenor Basis Swap from its instruments and quotes. - * - Build and run the sampling for the 12M-6M Tenor Basis Swap from its instruments and quotes. - * - * @author Lakshmi Krishnamurthy - */ - -public class ForwardReferenceBasisSensitivity { - - private static final FixFloatComponent OTCFixFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - private static final FloatFloatComponent OTCFloatFloat ( - final JulianDate dtSpot, - final String strCurrency, - final String strDerivedTenor, - final String strMaturityTenor, - final double dblBasis) - { - FloatFloatSwapConvention ffConv = IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - return ffConv.createFloatFloatComponent ( - dtSpot, - strDerivedTenor, - strMaturityTenor, - dblBasis, - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFutures, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFutures]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - aiDay[i] + "D" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFutures, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFutures; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aIRS[i] = OTCFixFloat ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency, - final double dblBump) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] {}, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] {}; // Futures - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.0009875 + dblBump, // 9M - 0.00122 + dblBump, // 1Y - 0.00223 + dblBump, // 18M - 0.00383 + dblBump, // 2Y - 0.00827 + dblBump, // 3Y - 0.01245 + dblBump, // 4Y - 0.01605 + dblBump, // 5Y - 0.02597 + dblBump // 10Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 9M - "SwapRate", // 1Y - "SwapRate", // 18M - "SwapRate", // 2Y - "SwapRate", // 3Y - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate" // 10Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "9M", "1Y", "18M", "2Y", "3Y", "4Y", "5Y", "10Y" - }, - new double[] { - 0.0009875, 0.00122, 0.00223, 0.00383, 0.00827, 0.01245, 0.01605, 0.02597 - } - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - aDepositComp, - adblDepositQuote, - null, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - false - ); - } - - /* - * Construct an array of float-float swaps from the corresponding reference (6M) and the derived legs. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FloatFloatComponent[] MakexM6MBasisSwap ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final int iTenorInMonths) - throws Exception - { - FloatFloatComponent[] aFFC = new FloatFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) - aFFC[i] = OTCFloatFloat ( - dtSpot, - strCurrency, - iTenorInMonths + "M", - astrMaturityTenor[i], - 0. - ); - - return aFFC; - } - - private static final void ForwardJack ( - final JulianDate dt, - final Map mapForward, - final String strStartDateTenor) - { - for (Map.Entry me : mapForward.entrySet()) - System.out.println (me.getKey() + " | " + strStartDateTenor + ": " + - me.getValue().jackDForwardDManifestMeasure ( - "PV", - dt.addTenor (strStartDateTenor)).displayString() - ); - } - - private static final void ForwardJack ( - final JulianDate dt, - final Map mapForward) - { - ForwardJack (dt, mapForward, "1Y"); - - ForwardJack (dt, mapForward, "2Y"); - - ForwardJack (dt, mapForward, "3Y"); - - ForwardJack (dt, mapForward, "5Y"); - - ForwardJack (dt, mapForward, "7Y"); - } - - /* - * This sample illustrates the creation and usage of the xM-6M Tenor Basis Swap. It shows the following: - * - Construct the 6M-xM float-float basis swap. - * - Calculate the corresponding starting forward rate off of the discount curve. - * - Construct the shape preserving forward curve off of Cubic Polynomial Basis Spline. - * - Construct the shape preserving forward curve off of Quartic Polynomial Basis Spline. - * - Construct the shape preserving forward curve off of Hyperbolic Tension Based Basis Spline. - * - Set the discount curve based component market parameters. - * - Set the discount curve + cubic polynomial forward curve based component market parameters. - * - Set the discount curve + quartic polynomial forward curve based component market parameters. - * - Set the discount curve + hyperbolic tension forward curve based component market parameters. - * - Compute the following forward curve metrics for each of cubic polynomial forward, quartic - * polynomial forward, and KLK Hyperbolic tension forward curves: - * - Reference Basis Par Spread - * - Derived Basis Par Spread - * - Compare these with a) the forward rate off of the discount curve, b) The LIBOR rate, and c) The - * Input Basis Swap Quote. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final Map xM6MBasisSample ( - final JulianDate dtSpot, - final String strCurrency, - final MergedDiscountForwardCurve dc, - final int iTenorInMonths, - final String[] astrxM6MFwdTenor, - final double[] adblxM6MBasisSwapQuote) - throws Exception - { - System.out.println ("------------------------------------------------------------"); - - System.out.println (" SPL => n=4 | | |"); - - System.out.println ("---------------------------------------| LOG DF | LIBOR |"); - - System.out.println (" MSR => RECALC | REFEREN | DERIVED | | |"); - - System.out.println ("------------------------------------------------------------"); - - /* - * Construct the 6M-xM float-float basis swap. - */ - - FloatFloatComponent[] aFFC = MakexM6MBasisSwap ( - dtSpot, - strCurrency, - astrxM6MFwdTenor, - iTenorInMonths - ); - - String strBasisTenor = iTenorInMonths + "M"; - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Calculate the starting forward rate off of the discount curve. - */ - - double dblStartingFwd = dc.forward ( - dtSpot.julian(), - dtSpot.addTenor (strBasisTenor).julian() - ); - - /* - * Set the discount curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ); - - Map mapForward = new HashMap(); - - /* - * Construct the shape preserving forward curve off of Quartic Polynomial Basis Spline. - */ - - ForwardCurve fcxMQuartic = ScenarioForwardCurveBuilder.ShapePreservingForwardCurve ( - "QUARTIC_FWD" + strBasisTenor, - ForwardLabel.Create ( - strCurrency, - strBasisTenor - ), - valParams, - null, - mktParams, - null, - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (5), - aFFC, - "ReferenceParBasisSpread", - adblxM6MBasisSwapQuote, - dblStartingFwd - ); - - mapForward.put ( - " QUARTIC_FWD" + strBasisTenor, - fcxMQuartic - ); - - /* - * Set the discount curve + quartic polynomial forward curve based component market parameters. - */ - - CurveSurfaceQuoteContainer mktParamsQuarticFwd = MarketParamsBuilder.Create ( - dc, - fcxMQuartic, - null, - null, - null, - null, - null, - null - ); - - int i = 0; - int iFreq = 12 / iTenorInMonths; - - /* - * Compute the following forward curve metrics for each of cubic polynomial forward, quartic - * polynomial forward, and KLK Hyperbolic tension forward curves: - * - Reference Basis Par Spread - * - Derived Basis Par Spread - * - * Further compare these with a) the forward rate off of the discount curve, b) the LIBOR rate, and - * c) Input Basis Swap Quote. - */ - - for (String strMaturityTenor : astrxM6MFwdTenor) { - int iFwdEndDate = dtSpot.addTenor (strMaturityTenor).julian(); - - int iFwdStartDate = dtSpot.addTenor (strMaturityTenor).subtractTenor (strBasisTenor).julian(); - - FloatFloatComponent ffc = aFFC[i++]; - - CaseInsensitiveTreeMap mapQuarticValue = ffc.value ( - valParams, - null, - mktParamsQuarticFwd, - null - ); - - System.out.println (" " + strMaturityTenor + " => " + - FormatUtil.FormatDouble (fcxMQuartic.forward (strMaturityTenor), 2, 2, 100.) + " | " + - FormatUtil.FormatDouble (mapQuarticValue.get ("ReferenceParBasisSpread"), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (mapQuarticValue.get ("DerivedParBasisSpread"), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (iFreq * java.lang.Math.log (dc.df (iFwdStartDate) / dc.df (iFwdEndDate)), 1, 2, 100.) + " | " + - FormatUtil.FormatDouble (dc.libor (iFwdStartDate, iFwdEndDate), 1, 2, 100.) + " | " - ); - } - - return mapForward; - } - - /* - * This sample illustrates how to build and test the forward curves across various tenor basis. It shows - * the following steps: - * - Construct the Discount Curve using its instruments and quotes. - * - Build and run the sampling for the 1M-6M Tenor Basis Swap from its instruments and quotes. - * - Build and run the sampling for the 3M-6M Tenor Basis Swap from its instruments and quotes. - * - Build and run the sampling for the 6M-6M Tenor Basis Swap from its instruments and quotes. - * - Build and run the sampling for the 12M-6M Tenor Basis Swap from its instruments and quotes. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void CustomForwardCurveBuilderSample() - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strCurrency = "AUD"; - - JulianDate dtToday = DateUtil.Today().addTenor ("0D"); - - /* - * Construct the Discount Curve using its instruments and quotes - */ - - MergedDiscountForwardCurve dc = MakeDC ( - dtToday, - strCurrency, - 0. - ); - - System.out.println ("\n------------------------------------------------------------"); - - System.out.println ("------------------- 1M-6M Basis Swap -----------------"); - - /* - * Build and run the sampling for the 1M-6M Tenor Basis Swap from its instruments and quotes. - */ - - Map mapForward1M6M = xM6MBasisSample ( - dtToday, - strCurrency, - dc, - 1, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00551, // 1Y - 0.00387, // 2Y - 0.00298, // 3Y - 0.00247, // 4Y - 0.00211, // 5Y - 0.00185, // 6Y - 0.00165, // 7Y - 0.00150, // 8Y - 0.00137, // 9Y - 0.00127, // 10Y - 0.00119, // 11Y - 0.00112, // 12Y - 0.00096, // 15Y - 0.00079, // 20Y - 0.00069, // 25Y - 0.00062 // 30Y - } - ); - - /* - * Build and run the sampling for the 3M-6M Tenor Basis Swap from its instruments and quotes. - */ - - System.out.println ("\n------------------------------------------------------------"); - - System.out.println ("------------------- 3M-6M Basis Swap -----------------"); - - Map mapForward3M6M = xM6MBasisSample ( - dtToday, - strCurrency, - dc, - 3, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - new double[] { - 0.00186, // 1Y - 0.00127, // 2Y - 0.00097, // 3Y - 0.00080, // 4Y - 0.00067, // 5Y - 0.00058, // 6Y - 0.00051, // 7Y - 0.00046, // 8Y - 0.00042, // 9Y - 0.00038, // 10Y - 0.00035, // 11Y - 0.00033, // 12Y - 0.00028, // 15Y - 0.00022, // 20Y - 0.00020, // 25Y - 0.00018 // 30Y - } - ); - - /* - * Build and run the sampling for the 12M-6M Tenor Basis Swap from its instruments and quotes. - */ - - System.out.println ("\n------------------------------------------------------------"); - - System.out.println ("------------------- 12M-6M Basis Swap -----------------"); - - Map mapForward12M6M = xM6MBasisSample ( - dtToday, - strCurrency, - dc, - 12, - new String[] { - "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "35Y", "40Y" - }, - new double[] { - -0.00212, // 1Y - -0.00152, // 2Y - -0.00117, // 3Y - -0.00097, // 4Y - -0.00082, // 5Y - -0.00072, // 6Y - -0.00063, // 7Y - -0.00057, // 8Y - -0.00051, // 9Y - -0.00047, // 10Y - -0.00044, // 11Y - -0.00041, // 12Y - -0.00035, // 15Y - -0.00028, // 20Y - -0.00025, // 25Y - -0.00022, // 30Y - -0.00022, // 35Y Extrapolated - -0.00022, // 40Y Extrapolated - } - ); - - System.out.println ("\n--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("------------------------------------------------------- 1M-6M Micro Jack -------------------------------------------------------------------"); - - System.out.println ("--------------------------------------------------------------------------------------------------------------------------------------------\n"); - - ForwardJack ( - dtToday, - mapForward1M6M - ); - - System.out.println ("\n--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("------------------------------------------------------- 3M-6M Micro Jack -------------------------------------------------------------------"); - - System.out.println ("--------------------------------------------------------------------------------------------------------------------------------------------\n"); - - ForwardJack ( - dtToday, - mapForward3M6M - ); - - System.out.println ("\n--------------------------------------------------------------------------------------------------------------------------------------------"); - - System.out.println ("------------------------------------------------------ 12M-6M Micro Jack -------------------------------------------------------------------"); - - System.out.println ("--------------------------------------------------------------------------------------------------------------------------------------------\n"); - - ForwardJack ( - dtToday, - mapForward12M6M - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - CustomForwardCurveBuilderSample(); - } -} diff --git a/org/drip/sample/sensitivity/FundingCurveQuoteSensitivity.java b/org/drip/sample/sensitivity/FundingCurveQuoteSensitivity.java deleted file mode 100644 index a3cdcbc..0000000 --- a/org/drip/sample/sensitivity/FundingCurveQuoteSensitivity.java +++ /dev/null @@ -1,672 +0,0 @@ - -package org.drip.sample.sensitivity; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.definition.*; -import org.drip.product.rates.*; -import org.drip.quant.calculus.WengertJacobian; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.*; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * FundingCurveQuoteSensitivity demonstrates the calculation of the Funding curve sensitivity to the - * calibration instrument quotes. It does the following: - * - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - Display of the Cash Instrument Discount Factor Quote Jacobian Sensitivities. - * - Display of the Swap Instrument Discount Factor Quote Jacobian Sensitivities. - * - * @author Lakshmi Krishnamurthy - */ - -public class FundingCurveQuoteSensitivity { - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - for (int i = 0; i < aiDay.length; ++i) - aDeposit[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - OvernightLabel.Create ( - strCurrency - ) - ); - - return aDeposit; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - FixFloatComponent irs = OTCIRS ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - 0. - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - private static final void TenorJack ( - final JulianDate dtStart, - final String strTenor, - final String strCurrency, - final String strManifestMeasure, - final MergedDiscountForwardCurve dc) - throws Exception - { - CalibratableComponent irsBespoke = OTCIRS ( - dtStart, - strCurrency, - strTenor, - 0. - ); - - WengertJacobian wjDFQuoteBespokeMat = dc.jackDDFDManifestMeasure ( - irsBespoke.maturityDate(), - strManifestMeasure - ); - - System.out.println (strTenor + " => " + wjDFQuoteBespokeMat.displayString()); - } - - private static final void Forward6MRateJack ( - final JulianDate dtStart, - final String strStartTenor, - final String strManifestMeasure, - final MergedDiscountForwardCurve dc) - { - JulianDate dtBegin = dtStart.addTenor (strStartTenor); - - WengertJacobian wjForwardRate = dc.jackDForwardDManifestMeasure ( - dtBegin, - "6M", - strManifestMeasure, - 0.5 - ); - - System.out.println ("[" + dtBegin + " | 6M] => " + wjForwardRate.displayString()); - } - - /* - * This sample demonstrates the calculation of the discount curve sensitivity to the calibration - * instrument quotes. It does the following: - * - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/Swap Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and Swap Stretches. - * - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - Display of the Cash Instrument Discount Factor Quote Jacobian Sensitivities. - * - Display of the Swap Instrument Discount Factor Quote Jacobian Sensitivities. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void DiscountCurveQuoteSensitivitySample ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the Array of DEPOSIT Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 7, 14, 30, 60 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0013, 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }; // Cash Rate - - /* - * Construct the Deposit Instrument Set Stretch Builder - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "DEPOSIT", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of FUTURE Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aEDFComp = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtSpot, - 8, - strCurrency - ); - - double[] adblEDFQuote = new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }; - - /* - * Construct the EDF Instrument Set Stretch Builder - */ - - LatentStateStretchSpec edfStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "EDF", - aEDFComp, - "ForwardRate", - adblEDFQuote - ); - - /* - * Construct the Array of SWAP Instruments and their Quotes from the given set of parameters - */ - - FixFloatComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - } - ); - - double[] adblSwapQuote = new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }; - - /* - * Construct the Swap Instrument Set Stretch Builder - */ - - LatentStateStretchSpec swapStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SWAP", - aSwapComp, - "SwapRate", - adblSwapQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - edfStretch, - swapStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following Default Segment Control parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Prior Quote Sensitivity Control with first derivative tail fade, with FADE ON - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new ExponentialTensionSetParams (2.), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - new org.drip.spline.params.PreceedingManifestSensitivityControl ( - true, - 1, - null - ) - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - /* - * Set up the DEPOSIT Segment Control parameters with the following details: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Prior Quote Sensitivity Control with first derivative tail fade, with FADE ON - * - Natural Boundary Setting - */ - - lcc.setStretchSegmentBuilderControl ( - depositStretch.name(), - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new ExponentialTensionSetParams (2.), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - new org.drip.spline.params.PreceedingManifestSensitivityControl ( - true, - 1, - null - ) - ) - ); - - /* - * Set up the FUTURE Segment Control parameters with the following details: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Prior Quote Sensitivity Control with first derivative tail fade, with FADE OFF, RETAIN ON - * - Natural Boundary Setting - */ - - lcc.setStretchSegmentBuilderControl ( - edfStretch.name(), - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new ExponentialTensionSetParams (2.), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - new org.drip.spline.params.PreceedingManifestSensitivityControl ( - false, - 1, - null - ) - ) - ); - - /* - * Set up the SWAP Segment Control parameters with the following details: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Prior Quote Sensitivity Control with first derivative tail fade, with FADE ON - * - Natural Boundary Setting - */ - - lcc.setStretchSegmentBuilderControl ( - swapStretch.name(), - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new ExponentialTensionSetParams (2.), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - new org.drip.spline.params.PreceedingManifestSensitivityControl ( - true, - 1, - null - ) - ) - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Deposit, Futures, and Swap Stretches. - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - /* - * Cross-Comparison of the DEPOSIT Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t[" + aDepositComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aDepositComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "Rate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the FUTURE Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t FUTURE INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aEDFComp.length; ++i) - System.out.println ("\t[" + aEDFComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aEDFComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "Rate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblEDFQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the SWAP Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t SWAP INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aSwapComp.length; ++i) - System.out.println ("\t[" + aSwapComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aSwapComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "CalibSwapRate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblSwapQuote[i], 1, 6, 1.)); - - /* - * Display of the DEPOSIT Instrument Discount Factor Quote Jacobian Sensitivities. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT MATURITY DISCOUNT FACTOR JACOBIAN"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) { - org.drip.quant.calculus.WengertJacobian wj = dc.jackDDFDManifestMeasure (aDepositComp[i].maturityDate(), "PV"); - - System.out.println (aDepositComp[i].maturityDate() + " => " + wj.displayString()); - } - - /* - * Display of the FUTURE Instrument Discount Factor Quote Jacobian Sensitivities. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t FUTURE MATURITY DISCOUNT FACTOR JACOBIAN"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aEDFComp.length; ++i) { - org.drip.quant.calculus.WengertJacobian wj = dc.jackDDFDManifestMeasure ( - aEDFComp[i].maturityDate(), - "PV" - ); - - System.out.println (aEDFComp[i].maturityDate() + " => " + wj.displayString()); - } - - /* - * Display of the SWAP Instrument Discount Factor Quote Jacobian Sensitivities. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t SWAP MATURITY DISCOUNT FACTOR JACOBIAN"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aSwapComp.length; ++i) { - org.drip.quant.calculus.WengertJacobian wjDFQuote = dc.jackDDFDManifestMeasure ( - aSwapComp[i].maturityDate(), - "PV" - ); - - System.out.println (aSwapComp[i].maturityDate() + " => " + wjDFQuote.displayString()); - } - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t COMPONENT-BY-COMPONENT QUOTE JACOBIAN"); - - System.out.println ("\t----------------------------------------------------------------"); - - WengertJacobian wj = dc.compJackDPVDManifestMeasure (dtSpot); - - System.out.println (wj.displayString()); - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t BESPOKE 35Y SWAP QUOTE JACOBIAN"); - - System.out.println ("\t----------------------------------------------------------------"); - - CalibratableComponent irs35Y = OTCIRS ( - dtSpot, - strCurrency, - "35Y", - 0. - ); - - WengertJacobian wjIRSBespokeQuoteJack = irs35Y.jackDDirtyPVDManifestMeasure ( - valParams, - null, - MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null, - null - ), - null - ); - - System.out.println (wjIRSBespokeQuoteJack.displayString()); - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t BESPOKE SWAP MATURITY QUOTE JACOBIAN"); - - System.out.println ("\t----------------------------------------------------------------"); - - TenorJack (dtSpot, "30Y", strCurrency, "PV", dc); - - TenorJack (dtSpot, "32Y", strCurrency, "PV", dc); - - TenorJack (dtSpot, "34Y", strCurrency, "PV", dc); - - TenorJack (dtSpot, "36Y", strCurrency, "PV", dc); - - TenorJack (dtSpot, "38Y", strCurrency, "PV", dc); - - TenorJack (dtSpot, "40Y", strCurrency, "PV", dc); - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t DISCOUNT CURVE IMPLIED 6M FORWARD RATE QUOTE JACOBIAN"); - - System.out.println ("\t----------------------------------------------------------------"); - - Forward6MRateJack (dtSpot, "1D", "PV", dc); - - Forward6MRateJack (dtSpot, "3M", "PV", dc); - - Forward6MRateJack (dtSpot, "6M", "PV", dc); - - Forward6MRateJack (dtSpot, "1Y", "PV", dc); - - Forward6MRateJack (dtSpot, "2Y", "PV", dc); - - Forward6MRateJack (dtSpot, "5Y", "PV", dc); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - - DiscountCurveQuoteSensitivitySample ( - DateUtil.Today(), - strCurrency - ); - } -} diff --git a/org/drip/sample/sensitivity/OISCurveQuoteSensitivity.java b/org/drip/sample/sensitivity/OISCurveQuoteSensitivity.java deleted file mode 100644 index d9f1a5d..0000000 --- a/org/drip/sample/sensitivity/OISCurveQuoteSensitivity.java +++ /dev/null @@ -1,875 +0,0 @@ - -package org.drip.sample.sensitivity; - -import java.util.List; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.*; -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.param.creator.*; -import org.drip.param.period.*; -import org.drip.param.valuation.*; -import org.drip.product.creator.*; -import org.drip.product.rates.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.spline.basis.ExponentialTensionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.*; -import org.drip.state.estimator.LatentStateStretchBuilder; -import org.drip.state.identifier.*; -import org.drip.state.inference.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * OISCurveQuoteSensitivity demonstrates the calculation of the OIS discount curve sensitivity to the - * calibration instrument quotes. It does the following: - * - Construct the Array of Cash/OIS Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/OIS Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving OIS Discount Curve by applying the linear curve calibrator to the array - * of Cash and OIS Stretches. - * - Cross-Comparison of the Cash/OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - Display of the Cash Instrument Discount Factor Quote Jacobian Sensitivities. - * - Display of the OIS Instrument Discount Factor Quote Jacobian Sensitivities. - * - * @author Lakshmi Krishnamurthy - */ - -public class OISCurveQuoteSensitivity { - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final String strCurrency, - final int[] aiDay) - throws Exception - { - SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length]; - - for (int i = 0; i < aiDay.length; ++i) - aDeposit[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - OvernightLabel.Create ( - strCurrency - ) - ); - - return aDeposit; - } - - /* - * Construct the Array of Overnight Index Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OvernightIndexFromMaturityTenor ( - final JulianDate dtEffective, - final String[] astrMaturityTenor, - final double[] adblCoupon, - final String strCurrency) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrMaturityTenor.length]; - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - false, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - java.lang.String strFixedTenor = Helper.LEFT_TENOR_LESSER == Helper.TenorCompare ( - astrMaturityTenor[i], - "6M" - ) ? astrMaturityTenor[i] : "6M"; - - java.lang.String strFloatingTenor = Helper.LEFT_TENOR_LESSER == Helper.TenorCompare ( - astrMaturityTenor[i], - "3M" - ) ? astrMaturityTenor[i] : "3M"; - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "ON", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_OVERNIGHT, - null, - OvernightLabel.Create ( - strCurrency - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - strFixedTenor, - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - adblCoupon[i], - 0., - strCurrency - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 4, - strFloatingTenor, - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - strFixedTenor, - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - strFixedTenor, - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - strFloatingTenor, - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent ois = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - ois.setPrimaryCode ("OIS." + astrMaturityTenor[i] + "." + strCurrency); - - aOIS[i] = ois; - } - - return aOIS; - } - - /* - * Construct the Array of Overnight Index Future Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] OvernightIndexFutureFromMaturityTenor ( - final JulianDate dtSpot, - final String[] astrStartTenor, - final String[] astrMaturityTenor, - final double[] adblCoupon, - final String strCurrency) - throws Exception - { - FixFloatComponent[] aOIS = new FixFloatComponent[astrStartTenor.length]; - - CashSettleParams csp = new CashSettleParams ( - 0, - strCurrency, - 0 - ); - - for (int i = 0; i < astrStartTenor.length; ++i) { - JulianDate dtEffective = dtSpot.addTenor (astrStartTenor[i]); - - java.lang.String strFixedTenor = Helper.LEFT_TENOR_LESSER == Helper.TenorCompare ( - astrMaturityTenor[i], - "6M" - ) ? astrMaturityTenor[i] : "6M"; - - java.lang.String strFloatingTenor = Helper.LEFT_TENOR_LESSER == Helper.TenorCompare ( - astrMaturityTenor[i], - "3M" - ) ? astrMaturityTenor[i] : "3M"; - - ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting ( - strFixedTenor, - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, - null, - adblCoupon[i], - 0., - strCurrency - ); - - UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting ( - 2, - "Act/360", - false, - "Act/360", - false, - strCurrency, - false, - CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC - ); - - ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting ( - "ON", - CompositePeriodBuilder.EDGE_DATE_SEQUENCE_OVERNIGHT, - null, - OvernightLabel.Create ( - strCurrency - ), - CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0. - ); - - CompositePeriodSetting cpsFloating = new CompositePeriodSetting ( - 4, - strFloatingTenor, - strCurrency, - null, - -1., - null, - null, - null, - null - ); - - CompositePeriodSetting cpsFixed = new CompositePeriodSetting ( - 2, - strFixedTenor, - strCurrency, - null, - 1., - null, - null, - null, - null - ); - - List lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "6M", - astrMaturityTenor[i], - null - ); - - List lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates ( - dtEffective, - "3M", - astrMaturityTenor[i], - null - ); - - Stream floatingStream = new Stream ( - CompositePeriodBuilder.FloatingCompositeUnit ( - lsFloatingStreamEdgeDate, - cpsFloating, - cfusFloating - ) - ); - - Stream fixedStream = new Stream ( - CompositePeriodBuilder.FixedCompositeUnit ( - lsFixedStreamEdgeDate, - cpsFixed, - ucasFixed, - cfusFixed - ) - ); - - FixFloatComponent ois = new FixFloatComponent ( - fixedStream, - floatingStream, - csp - ); - - ois.setPrimaryCode ("OIS." + astrMaturityTenor[i] + "." + strCurrency); - - aOIS[i] = ois; - } - - return aOIS; - } - - /* - * This sample demonstrates the calculation of the discount curve sensitivity to the calibration - * instrument quotes. It does the following: - * - Construct the Array of Cash/OIS Instruments and their Quotes from the given set of parameters. - * - Construct the Cash/OIS Instrument Set Stretch Builder. - * - Set up the Linear Curve Calibrator using the following parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Natural Boundary Setting - * - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of Cash and OIS Stretches. - * - Cross-Comparison of the Cash/OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - * - Display of the Cash Instrument Discount Factor Quote Jacobian Sensitivities. - * - Display of the OIS Instrument Discount Factor Quote Jacobian Sensitivities. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void OISCurveQuoteSensitivitySample ( - final JulianDate dtSpot, - final String strHeaderComment, - final String strCurrency) - throws Exception - { - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t" + strHeaderComment); - - /* - * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters - */ - - SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - strCurrency, - new int[] { - 1, 2, 3 - } - ); - - double[] adblDepositQuote = new double[] { - 0.0004, 0.0004, 0.0004 // Deposit - }; - - /* - * Setup the Deposit instruments stretch latent state representation - this uses the discount factor - * quantification metric and the "rate" manifest measure. - */ - - LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - " DEPOSIT ", - aDepositComp, - "ForwardRate", - adblDepositQuote - ); - - /* - * Construct the Array of Short End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - FixFloatComponent[] aShortEndOISComp = OvernightIndexFromMaturityTenor ( - dtSpot, - new java.lang.String[] { - "1W", "2W", "3W", "1M" - }, - adblShortEndOISQuote, - strCurrency - ); - - /* - * Construct the Short End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisShortEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "SHORT END OIS", - aShortEndOISComp, - "SwapRate", - adblShortEndOISQuote - ); - - /* - * Construct the Array of OIS Futures Instruments and their Quotes from the given set of parameters - */ - - double[] adblOISFutureQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - FixFloatComponent[] aOISFutureComp = OvernightIndexFutureFromMaturityTenor ( - dtSpot, - new java.lang.String[] { - "1M", "2M", "3M", "4M", "5M" - }, - new java.lang.String[] { - "1M", "1M", "1M", "1M", "1M" - }, - adblOISFutureQuote, - strCurrency - ); - - /* - * Construct the OIS Future Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisFutureStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - " OIS FUTURE ", - aOISFutureComp, - "SwapRate", - adblOISFutureQuote - ); - - /* - * Construct the Array of Long End OIS Instruments and their Quotes from the given set of parameters - */ - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - FixFloatComponent[] aLongEndOISComp = OvernightIndexFromMaturityTenor ( - dtSpot, - new java.lang.String[] { - "15M", "18M", "21M", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y" - }, - adblLongEndOISQuote, - strCurrency - ); - - /* - * Construct the Long End OIS Instrument Set Stretch Builder - */ - - LatentStateStretchSpec oisLongEndStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec ( - "LONG END OIS ", - aLongEndOISComp, - "SwapRate", - adblLongEndOISQuote - ); - - LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] { - depositStretch, - oisShortEndStretch, - oisFutureStretch, - oisLongEndStretch - }; - - /* - * Set up the Linear Curve Calibrator using the following Default Segment Control parameters: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Prior Quote Sensitivity Control with first derivative tail fade, with FADE ON - * - Natural Boundary Setting - */ - - LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator ( - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new ExponentialTensionSetParams (2.), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - new org.drip.spline.params.PreceedingManifestSensitivityControl ( - true, - 1, - null - ) - ), - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE, - null, - null - ); - - /* - * Set up the DEPOSIT Segment Control parameters with the following details: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Prior Quote Sensitivity Control with first derivative tail fade, with FADE ON - * - Natural Boundary Setting - */ - - lcc.setStretchSegmentBuilderControl ( - depositStretch.name(), - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new ExponentialTensionSetParams (2.), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - new org.drip.spline.params.PreceedingManifestSensitivityControl ( - true, - 1, - null - ) - ) - ); - - /* - * Set up the Short End OIS Segment Control parameters with the following details: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Prior Quote Sensitivity Control with first derivative tail fade, with FADE ON - * - Natural Boundary Setting - */ - - lcc.setStretchSegmentBuilderControl ( - oisShortEndStretch.name(), - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new ExponentialTensionSetParams (2.), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - new org.drip.spline.params.PreceedingManifestSensitivityControl ( - true, - 1, - null - ) - ) - ); - - /* - * Set up the Long End OIS Segment Control parameters with the following details: - * - Cubic Exponential Mixture Basis Spline Set - * - Ck = 2, Segment Curvature Penalty = 2 - * - Quadratic Rational Shape Controller - * - Prior Quote Sensitivity Control with first derivative tail fade, with FADE ON - * - Natural Boundary Setting - */ - - lcc.setStretchSegmentBuilderControl ( - oisLongEndStretch.name(), - new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new ExponentialTensionSetParams (2.), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.) - ), - new org.drip.spline.params.PreceedingManifestSensitivityControl ( - true, - 1, - null - ) - ) - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - /* - * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array - * of DEPOSIT, OIS SHORT END, and OIS LONG END Stretches. - */ - - MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild ( - strCurrency, - lcc, - aStretchSpec, - valParams, - null, - null, - null, - 1. - ); - - /* - * Cross-Comparison of the DEPOSIT Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t[" + aDepositComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aDepositComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "Rate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the Short End OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t SHORT END OIS INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aShortEndOISComp.length; ++i) - System.out.println ("\t[" + aShortEndOISComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aShortEndOISComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "CalibSwapRate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblShortEndOISQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the OIS Future Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS FUTURE INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aOISFutureComp.length; ++i) - System.out.println ("\t[" + aOISFutureComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aOISFutureComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "SwapRate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblOISFutureQuote[i], 1, 6, 1.)); - - /* - * Cross-Comparison of the Long End OIS Calibration Instrument "Rate" metric across the different curve - * construction methodologies. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t LONG END OIS INSTRUMENTS CALIBRATION RECOVERY"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aLongEndOISComp.length; ++i) - System.out.println ("\t[" + aLongEndOISComp[i].maturityDate() + "] = " + - FormatUtil.FormatDouble (aLongEndOISComp[i].measureValue (valParams, null, - MarketParamsBuilder.Create (dc, null, null, null, null, null, null), - null, "CalibSwapRate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblLongEndOISQuote[i], 1, 6, 1.)); - - /* - * Display of the DEPOSIT Instrument Discount Factor Quote Jacobian Sensitivities. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t DEPOSIT MATURITY DISCOUNT FACTOR JACOBIAN"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aDepositComp.length; ++i) { - org.drip.quant.calculus.WengertJacobian wj = dc.jackDDFDManifestMeasure ( - aDepositComp[i].maturityDate(), - "PV" - ); - - System.out.println (aDepositComp[i].maturityDate() + " => " + wj.displayString()); - } - - /* - * Display of the Short End OIS Instrument Discount Factor Quote Jacobian Sensitivities. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t SHORT END OIS MATURITY DISCOUNT FACTOR JACOBIAN"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aShortEndOISComp.length; ++i) { - org.drip.quant.calculus.WengertJacobian wjDFQuote = dc.jackDDFDManifestMeasure ( - aShortEndOISComp[i].maturityDate(), - "PV" - ); - - System.out.println (aShortEndOISComp[i].maturityDate() + " => " + wjDFQuote.displayString()); - } - - /* - * Display of the OIS Future Instrument Discount Factor Quote Jacobian Sensitivities. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t OIS FUTURE MATURITY DISCOUNT FACTOR JACOBIAN"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aOISFutureComp.length; ++i) { - org.drip.quant.calculus.WengertJacobian wjDFQuote = dc.jackDDFDManifestMeasure ( - aOISFutureComp[i].maturityDate(), - "PV" - ); - - System.out.println (aOISFutureComp[i].maturityDate() + " => " + wjDFQuote.displayString()); - } - - /* - * Display of the Long End OIS Instrument Discount Factor Quote Jacobian Sensitivities. - */ - - System.out.println ("\n\t----------------------------------------------------------------"); - - System.out.println ("\t LONG END OIS MATURITY DISCOUNT FACTOR JACOBIAN"); - - System.out.println ("\t----------------------------------------------------------------"); - - for (int i = 0; i < aLongEndOISComp.length; ++i) { - org.drip.quant.calculus.WengertJacobian wjDFQuote = dc.jackDDFDManifestMeasure ( - aLongEndOISComp[i].maturityDate(), - "PV" - ); - - System.out.println (aLongEndOISComp[i].maturityDate() + " => " + wjDFQuote.displayString()); - } - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - OISCurveQuoteSensitivitySample ( - dtSpot, - "---- DISCOUNT CURVE WITH OVERNIGHT INDEX ---", - "EUR" - ); - } -} diff --git a/org/drip/sample/sequence/DualRandomSequenceBound.java b/org/drip/sample/sequence/DualRandomSequenceBound.java deleted file mode 100644 index 6b4f3d1..0000000 --- a/org/drip/sample/sequence/DualRandomSequenceBound.java +++ /dev/null @@ -1,127 +0,0 @@ - -package org.drip.sample.sequence; - -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.metrics.*; -import org.drip.sequence.random.BoundedUniform; -import org.drip.service.env.EnvManager; - -/* - - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * DualRandomSequenceBound demonstrates the Computation of the Probabilistic Bounds for a Joint Realizations - * of a Sample Random Sequence. - * - * @author Lakshmi Krishnamurthy - */ - -public class DualRandomSequenceBound { - - private static final void CauchySchwartzBound ( - final double dblLeft1, - final double dblRight1, - final double dblLeft2, - final double dblRight2) - throws Exception - { - SingleSequenceAgnosticMetrics ssam1 = new BoundedUniform ( - dblLeft1, - dblRight1 - ).sequence ( - 50000, - null - ); - - SingleSequenceAgnosticMetrics ssam2 = new BoundedUniform ( - dblLeft2, - dblRight2 - ).sequence ( - 50000, - null - ); - - DualSequenceAgnosticMetrics dsam = new DualSequenceAgnosticMetrics ( - ssam1, - ssam2 - ); - - System.out.println ("\t| " + - FormatUtil.FormatDouble (ssam1.empiricalExpectation(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (ssam2.empiricalExpectation(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (dsam.cauchySchwarzAbsoluteBound(), 1, 4, 1.) + " |" - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - System.out.println(); - - System.out.println ("\t|-----------------------------|"); - - System.out.println ("\t| MEAN #1 | MEAN #2 | JOINT |"); - - System.out.println ("\t|-----------------------------|"); - - CauchySchwartzBound (0., 1., 0., 1.); - - CauchySchwartzBound (0., 1., 1., 2.); - - CauchySchwartzBound (0., 1., 2., 3.); - - CauchySchwartzBound (0., 1., 3., 4.); - - CauchySchwartzBound (0., 1., 4., 5.); - - System.out.println ("\t|-----------------------------|"); - } -} diff --git a/org/drip/sample/sequence/IIDSequenceSumBound.java b/org/drip/sample/sequence/IIDSequenceSumBound.java deleted file mode 100644 index 6c36b4d..0000000 --- a/org/drip/sample/sequence/IIDSequenceSumBound.java +++ /dev/null @@ -1,293 +0,0 @@ - -package org.drip.sample.sequence; - -import org.drip.measure.continuousmarginal.*; -import org.drip.measure.lebesgue.R1Uniform; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.metrics.*; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; - -/* - - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * IIDSequenceSumBound demonstrates the Computation of the Different Probabilistic Bounds for Sums of i.i.d. - * Random Sequences. - * - * @author Lakshmi Krishnamurthy - */ - -public class IIDSequenceSumBound { - - private static final void Head ( - final String strHeader) - { - System.out.println(); - - System.out.println ("\t|---------------------------------------------------------------------------------------|"); - - System.out.println (strHeader); - - System.out.println ("\t|---------------------------------------------------------------------------------------|"); - - System.out.println ("\t| SAMPLE || <- TOLERANCES -> |"); - - System.out.println ("\t|---------------------------------------------------------------------------------------|"); - } - - private static final void WeakLawBounds ( - final UnivariateSequenceGenerator iidsg, - final R1 dist, - final int[] aiSampleSize, - final double[] adblTolerance) - throws Exception - { - for (int iSampleSize : aiSampleSize) { - SingleSequenceAgnosticMetrics ssamDist = iidsg.sequence ( - iSampleSize, - dist - ); - - String strDump = "\t| " + FormatUtil.FormatDouble (iSampleSize, 8, 0, 1) + " => "; - - for (double dblTolerance : adblTolerance) - strDump += FormatUtil.FormatDouble (ssamDist.weakLawAverageBounds (dblTolerance).upper(), 1, 9, 1.) + " | "; - - System.out.println (strDump); - } - } - - private static final void ChernoffHoeffdingBounds ( - final UnivariateSequenceGenerator iidsg, - final R1 dist, - final double dblSupport, - final int[] aiSampleSize, - final double[] adblTolerance) - throws Exception - { - for (int iSampleSize : aiSampleSize) { - BoundedSequenceAgnosticMetrics ssamDist = (BoundedSequenceAgnosticMetrics) iidsg.sequence ( - iSampleSize, - dist - ); - - String strDump = "\t| " + FormatUtil.FormatDouble (iSampleSize, 8, 0, 1) + " => "; - - for (double dblTolerance : adblTolerance) - strDump += FormatUtil.FormatDouble (ssamDist.chernoffHoeffdingAverageBounds (dblTolerance).upper(), 1, 9, 1.) + " | "; - - System.out.println (strDump); - } - } - - private static final void BennettBounds ( - final UnivariateSequenceGenerator iidsg, - final R1 dist, - final double dblSupport, - final int[] aiSampleSize, - final double[] adblTolerance) - throws Exception - { - for (int iSampleSize : aiSampleSize) { - BoundedSequenceAgnosticMetrics ssamDist = (BoundedSequenceAgnosticMetrics) iidsg.sequence ( - iSampleSize, - dist - ); - - String strDump = "\t| " + FormatUtil.FormatDouble (iSampleSize, 8, 0, 1) + " => "; - - for (double dblTolerance : adblTolerance) - strDump += FormatUtil.FormatDouble (ssamDist.bennettAverageBounds (dblTolerance).upper(), 1, 9, 1.) + " | "; - - System.out.println (strDump); - } - } - - private static final void BernsteinBounds ( - final UnivariateSequenceGenerator iidsg, - final R1 dist, - final double dblSupport, - final int[] aiSampleSize, - final double[] adblTolerance) - throws Exception - { - for (int iSampleSize : aiSampleSize) { - BoundedSequenceAgnosticMetrics ssamDist = (BoundedSequenceAgnosticMetrics) iidsg.sequence ( - iSampleSize, - dist - ); - - String strDump = "\t| " + FormatUtil.FormatDouble (iSampleSize, 8, 0, 1) + " => "; - - for (double dblTolerance : adblTolerance) - strDump += FormatUtil.FormatDouble (ssamDist.bernsteinAverageBounds (dblTolerance).upper(), 1, 9, 1.) + " | "; - - System.out.println (strDump); - } - } - - public static void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - BoundedUniform uniformRandom = new BoundedUniform ( - 0., - 1. - ); - - R1Uniform uniformDistribution = new R1Uniform ( - 0., - 1. - ); - - int[] aiSampleSize = new int[] { - 50, 500, 5000, 50000, 500000, 5000000, 50000000 - }; - - double[] adblTolerance = new double[] { - 0.01, 0.03, 0.05, 0.07, 0.10 - }; - - Head ("\t| WEAK LAW OF LARGE NUMBERS - METRICS FROM UNDERLYING GENERATOR |"); - - WeakLawBounds ( - uniformRandom, - uniformDistribution, - aiSampleSize, - adblTolerance - ); - - System.out.println ("\t|---------------------------------------------------------------------------------------|"); - - Head ("\t| WEAK LAW OF LARGE NUMBERS - METRICS FROM EMPIRICAL DISTRIBUTION |"); - - WeakLawBounds ( - uniformRandom, - null, - aiSampleSize, - adblTolerance - ); - - System.out.println ("\t|---------------------------------------------------------------------------------------|"); - - Head ("\t| CHERNOFF-HOEFFDING BOUNDS - METRICS FROM UNDERLYING GENERATOR |"); - - ChernoffHoeffdingBounds ( - uniformRandom, - uniformDistribution, - uniformRandom.upperBound() - uniformRandom.lowerBound(), - aiSampleSize, - adblTolerance - ); - - System.out.println ("\t|---------------------------------------------------------------------------------------|"); - - Head ("\t| CHERNOFF-HOEFFDING BOUNDS - METRICS FROM EMPIRICAL DISTRIBUTION |"); - - ChernoffHoeffdingBounds ( - uniformRandom, - null, - uniformRandom.upperBound() - uniformRandom.lowerBound(), - aiSampleSize, - adblTolerance - ); - - System.out.println ("\t|---------------------------------------------------------------------------------------|"); - - Head ("\t| BENNETT BOUNDS - METRICS FROM UNDERLYING GENERATOR |"); - - BennettBounds ( - uniformRandom, - uniformDistribution, - uniformRandom.upperBound() - uniformRandom.lowerBound(), - aiSampleSize, - adblTolerance - ); - - System.out.println ("\t|---------------------------------------------------------------------------------------|"); - - Head ("\t| BENNETT BOUNDS - METRICS FROM EMPIRICAL DISTRIBUTION |"); - - BennettBounds ( - uniformRandom, - null, - uniformRandom.upperBound() - uniformRandom.lowerBound(), - aiSampleSize, - adblTolerance - ); - - System.out.println ("\t|---------------------------------------------------------------------------------------|"); - - Head ("\t| BERNSTEIN BOUNDS - METRICS FROM UNDERLYING GENERATOR |"); - - BernsteinBounds ( - uniformRandom, - uniformDistribution, - uniformRandom.upperBound() - uniformRandom.lowerBound(), - aiSampleSize, - adblTolerance - ); - - System.out.println ("\t|---------------------------------------------------------------------------------------|"); - - Head ("\t| BERNSTEIN BOUNDS - METRICS FROM EMPIRICAL DISTRIBUTION |"); - - BernsteinBounds ( - uniformRandom, - uniformDistribution, - uniformRandom.upperBound() - uniformRandom.lowerBound(), - aiSampleSize, - adblTolerance - ); - - System.out.println ("\t|---------------------------------------------------------------------------------------|"); - } -} diff --git a/org/drip/sample/sequence/IntegerRandomSequenceBound.java b/org/drip/sample/sequence/IntegerRandomSequenceBound.java deleted file mode 100644 index 47170e8..0000000 --- a/org/drip/sample/sequence/IntegerRandomSequenceBound.java +++ /dev/null @@ -1,153 +0,0 @@ - -package org.drip.sample.sequence; - -import org.drip.measure.continuousmarginal.R1; -import org.drip.measure.discretemarginal.*; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.metrics.*; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * IntegerRandomSequenceBound demonstrates the Computation of the Probabilistic Bounds for a Sample Random - * Integer Sequence. - * - * @author Lakshmi Krishnamurthy - */ - -public class IntegerRandomSequenceBound { - - private static final void IntegerBounds ( - final UnivariateSequenceGenerator iidsg, - final R1 dist, - final int[] aiSampleSize) - throws Exception - { - for (int iSampleSize : aiSampleSize) { - IntegerSequenceAgnosticMetrics ssamDist = (IntegerSequenceAgnosticMetrics) iidsg.sequence ( - iSampleSize, - dist - ); - - String strDump = "\t| " + FormatUtil.FormatDouble (iSampleSize, 3, 0, 1) + " => "; - - strDump += - FormatUtil.FormatDouble (ssamDist.probGreaterThanZeroUpperBound(), 1, 9, 1.) + " | " + - FormatUtil.FormatDouble (ssamDist.probEqualToZeroUpperBound(), 1, 9, 1.) + " | "; - - System.out.println (strDump); - } - } - - public static void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - BoundedUniformInteger buiSequence = new BoundedUniformInteger ( - 0, - 100 - ); - - BoundedUniformIntegerDistribution buiDistribution = new BoundedUniformIntegerDistribution ( - 0, - 100 - ); - - int[] aiSampleSize = new int[] { - 10, 20, 50, 100, 250 - }; - - System.out.println(); - - System.out.println ("\t|----------------------------------------------------------------------------------|"); - - System.out.println ("\t| Generating Integer Random Sequence Metrics"); - - System.out.println ("\t| \tL -> R:"); - - System.out.println ("\t| \t\tSample Size"); - - System.out.println ("\t| \t\tUpper Probability Bound for X != 0"); - - System.out.println ("\t| \t\tUpper Probability Bound for X = 0"); - - System.out.println ("\t|----------------------------------------------------------------------------------|"); - - System.out.println ("\t| Generating Metrics off of Underlying Distribution"); - - System.out.println ("\t|----------------------------------------------------------------------------------|"); - - IntegerBounds ( - buiSequence, - buiDistribution, - aiSampleSize - ); - - System.out.println ("\t|----------------------------------------------------------------------------------|"); - - System.out.println(); - - System.out.println ("\t|----------------------------------------------------------------------------------|"); - - System.out.println ("\t| Generating Metrics off of Empirical Distribution"); - - System.out.println ("\t|----------------------------------------------------------------------------------|"); - - IntegerBounds ( - buiSequence, - null, - aiSampleSize - ); - - System.out.println ("\t|----------------------------------------------------------------------------------|"); - } -} diff --git a/org/drip/sample/sequence/PoissonRandomSequenceBound.java b/org/drip/sample/sequence/PoissonRandomSequenceBound.java deleted file mode 100644 index 36f986a..0000000 --- a/org/drip/sample/sequence/PoissonRandomSequenceBound.java +++ /dev/null @@ -1,146 +0,0 @@ - -package org.drip.sample.sequence; - -import org.drip.measure.continuousmarginal.R1; -import org.drip.measure.discretemarginal.*; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.metrics.*; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; - -/* - - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * PoissonRandomSequenceBound demonstrates the Computation of the Probabilistic Bounds for a Sample Random - * Poisson Sequence. - * - * @author Lakshmi Krishnamurthy - */ - -public class PoissonRandomSequenceBound { - - private static final void Head ( - final String strHeader) - { - System.out.println(); - - System.out.println ("\t|----------------------------------------------------------------------------------|"); - - System.out.println (strHeader); - - System.out.println ("\t|----------------------------------------------------------------------------------|"); - - System.out.println ("\t| SIZE || <- TOLERANCES -> |"); - - System.out.println ("\t|----------------------------------------------------------------------------------|"); - } - - private static final void ChernoffStirlingBounds ( - final UnivariateSequenceGenerator iidsg, - final R1 dist, - final int[] aiSampleSize, - final double[] adblTolerance) - throws Exception - { - for (int iSampleSize : aiSampleSize) { - PoissonSequenceAgnosticMetrics ssamDist = (PoissonSequenceAgnosticMetrics) iidsg.sequence ( - iSampleSize, - dist - ); - - String strDump = "\t| " + FormatUtil.FormatDouble (iSampleSize, 3, 0, 1) + " => "; - - for (double dblTolerance : adblTolerance) - strDump += FormatUtil.FormatDouble (ssamDist.chernoffStirlingUpperBound (dblTolerance), 1, 9, 1.) + " | "; - - System.out.println (strDump); - } - } - - public static void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - Poisson poissonRandom = new Poisson (10.); - - PoissonDistribution poissonDistribution = new PoissonDistribution (10.); - - int[] aiSampleSize = new int[] { - 10, 20, 50, 100, 250 - }; - - double[] adblTolerance = new double[] { - 5., 10., 15., 20., 25. - }; - - Head ("\t| CHERNOFF-STIRLING BOUNDS - METRICS FROM UNDERLYING GENERATOR |"); - - ChernoffStirlingBounds ( - poissonRandom, - poissonDistribution, - aiSampleSize, - adblTolerance - ); - - System.out.println ("\t|----------------------------------------------------------------------------------|"); - - Head ("\t| CHERNOFF-STIRLING BOUNDS - METRICS FROM EMPIRICAL DISTRIBUTION |"); - - ChernoffStirlingBounds ( - poissonRandom, - null, - aiSampleSize, - adblTolerance - ); - - System.out.println ("\t|----------------------------------------------------------------------------------|"); - } -} diff --git a/org/drip/sample/sequence/SingleRandomSequenceBound.java b/org/drip/sample/sequence/SingleRandomSequenceBound.java deleted file mode 100644 index b872e6d..0000000 --- a/org/drip/sample/sequence/SingleRandomSequenceBound.java +++ /dev/null @@ -1,260 +0,0 @@ - -package org.drip.sample.sequence; - -import org.drip.function.definition.R1ToR1; -import org.drip.function.r1tor1.*; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.metrics.*; -import org.drip.sequence.random.BoundedUniform; -import org.drip.service.env.EnvManager; - -/* - - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * SingleRandomSequenceBound demonstrates the Computation of the Probabilistic Bounds for a Sample Random - * Sequence. - * - * @author Lakshmi Krishnamurthy - */ - -public class SingleRandomSequenceBound { - - private static final void MarkovBound ( - final SingleSequenceAgnosticMetrics sm, - final double dblLevel, - final R1ToR1 au) - throws Exception - { - System.out.println ( - (null == au ? "\tMarkov Base Bound [" : "\tMarkov Function Bound [") + - FormatUtil.FormatDouble (dblLevel, 1, 2, 1.) + "] : " + - FormatUtil.FormatDouble (sm.markovUpperProbabilityBound (dblLevel, au), 1, 4, 1.) + " |" + - FormatUtil.FormatDouble (1. - dblLevel, 1, 4, 1.) - ); - } - - private static final void ChebyshevBound ( - final SingleSequenceAgnosticMetrics sm, - final double dblLevel) - throws Exception - { - System.out.println ( - "\tChebyshev Bound [" + - FormatUtil.FormatDouble (dblLevel, 1, 2, 1.) + "] : " + - FormatUtil.FormatDouble (sm.chebyshevBound (dblLevel).lower(), 1, 4, 1.) + " |" + - FormatUtil.FormatDouble (sm.chebyshevBound (dblLevel).upper(), 1, 4, 1.) + " |" + - FormatUtil.FormatDouble (1. - 2. * dblLevel, 1, 4, 1.) - ); - } - - private static final void ChebyshevCantelliBound ( - final SingleSequenceAgnosticMetrics sm, - final double dblLevel) - throws Exception - { - System.out.println ( - "\tChebyshev Cantelli Bound [" + - FormatUtil.FormatDouble (dblLevel, 1, 2, 1.) + "] : " + - " |" + - FormatUtil.FormatDouble (sm.chebyshevCantelliBound (dblLevel).upper(), 1, 4, 1.) + " |" + - FormatUtil.FormatDouble (1. - dblLevel, 1, 4, 1.) - ); - } - - private static final void CentralMomentBound ( - final SingleSequenceAgnosticMetrics sm, - final double dblLevel, - final int iMoment) - throws Exception - { - System.out.println ( - "\tMoment #" + iMoment + " Bound [" + - FormatUtil.FormatDouble (dblLevel, 1, 2, 1.) + "] : " + - FormatUtil.FormatDouble (sm.centralMomentBound (dblLevel, iMoment).lower(), 1, 4, 1.) + " |" + - FormatUtil.FormatDouble (sm.centralMomentBound (dblLevel, iMoment).upper(), 1, 4, 1.) + " |" + - FormatUtil.FormatDouble (1. - 2. * dblLevel, 1, 4, 1.) - ); - } - - private static final void MarkovBound ( - final SingleSequenceAgnosticMetrics sm, - final R1ToR1 au) - throws Exception - { - MarkovBound (sm, 0.20, au); - - MarkovBound (sm, 0.40, au); - - MarkovBound (sm, 0.59, au); - - MarkovBound (sm, 0.79, au); - - MarkovBound (sm, 0.99, au); - } - - private static final void ChebyshevBound ( - final SingleSequenceAgnosticMetrics sm) - throws Exception - { - ChebyshevBound (sm, 0.20); - - ChebyshevBound (sm, 0.25); - - ChebyshevBound (sm, 0.30); - - ChebyshevBound (sm, 0.35); - - ChebyshevBound (sm, 0.40); - } - - private static final void ChebyshevCantelliBound ( - final SingleSequenceAgnosticMetrics sm) - throws Exception - { - ChebyshevCantelliBound (sm, 0.20); - - ChebyshevCantelliBound (sm, 0.25); - - ChebyshevCantelliBound (sm, 0.30); - - ChebyshevCantelliBound (sm, 0.35); - - ChebyshevCantelliBound (sm, 0.40); - } - - private static final void CentralMomentBound ( - final SingleSequenceAgnosticMetrics sm, - final int iMoment) - throws Exception - { - CentralMomentBound (sm, 0.20, iMoment); - - CentralMomentBound (sm, 0.25, iMoment); - - CentralMomentBound (sm, 0.30, iMoment); - - CentralMomentBound (sm, 0.35, iMoment); - - CentralMomentBound (sm, 0.40, iMoment); - } - - private static final void SequenceGenerationRun ( - final SingleSequenceAgnosticMetrics sm) - throws Exception - { - System.out.println ("\tExpectation : " + FormatUtil.FormatDouble (sm.empiricalExpectation(), 1, 4, 1.)); - - System.out.println ("\tVariance : " + FormatUtil.FormatDouble (sm.empiricalVariance(), 1, 4, 1.)); - - System.out.println ("\t---------------------------------------------------"); - - MarkovBound (sm, new ExponentialTension (Math.E, 0.1)); - - System.out.println ("\t---------------------------------------------------"); - - MarkovBound (sm, new ExponentialTension (Math.E, 1.0)); - - System.out.println ("\t---------------------------------------------------"); - - MarkovBound (sm, new ExponentialTension (Math.E, 5.0)); - - System.out.println ("\t---------------------------------------------------"); - - MarkovBound (sm, null); - - System.out.println ("\t---------------------------------------------------"); - - ChebyshevBound (sm); - - System.out.println ("\t---------------------------------------------------"); - - ChebyshevCantelliBound (sm); - - System.out.println ("\t---------------------------------------------------"); - - CentralMomentBound (sm, 3); - - System.out.println ("\t---------------------------------------------------"); - - CentralMomentBound (sm, 4); - - System.out.println ("\t---------------------------------------------------"); - - CentralMomentBound (sm, 5); - } - - public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - /* System.out.println ("\t---------------------------------------------------"); - - System.out.println ("\t| BOUNDED GAUSSIAN RUN |"); - - System.out.println ("\t---------------------------------------------------"); - - SequenceGenerationRun (new BoundedGaussian (0.5, 1., 0., 1.).sequence (50000, null)); - - System.out.println ("\t---------------------------------------------------"); - - System.out.println(); */ - - System.out.println ("\t---------------------------------------------------"); - - System.out.println ("\t| BOUNDED UNIFORM RUN |"); - - System.out.println ("\t---------------------------------------------------"); - - SequenceGenerationRun (new BoundedUniform (0., 1.).sequence (50000, null)); - - System.out.println ("\t---------------------------------------------------"); - } -} diff --git a/org/drip/sample/sequence/UnitRandomSequenceBound.java b/org/drip/sample/sequence/UnitRandomSequenceBound.java deleted file mode 100644 index df08f65..0000000 --- a/org/drip/sample/sequence/UnitRandomSequenceBound.java +++ /dev/null @@ -1,288 +0,0 @@ - -package org.drip.sample.sequence; - -import org.drip.measure.continuousmarginal.*; -import org.drip.measure.lebesgue.R1Uniform; -import org.drip.quant.common.FormatUtil; -import org.drip.sequence.metrics.*; -import org.drip.sequence.random.*; -import org.drip.service.env.EnvManager; - -/* - - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * SingleRandomSequenceBound demonstrates the Computation of the Probabilistic Bounds for a Sample Random - * Sequence. - * - * @author Lakshmi Krishnamurthy - */ - -public class UnitRandomSequenceBound { - - private static final void Head ( - final String strHeader) - { - System.out.println(); - - System.out.println ("\t|----------------------------------------------------------------------------------|"); - - System.out.println (strHeader); - - System.out.println ("\t|----------------------------------------------------------------------------------|"); - - System.out.println ("\t| SIZE || <- TOLERANCES -> |"); - - System.out.println ("\t|----------------------------------------------------------------------------------|"); - } - - private static final void ChernoffBinomialBounds ( - final UnivariateSequenceGenerator iidsg, - final R1 dist, - final int[] aiSampleSize, - final double[] adblTolerance) - throws Exception - { - for (int iSampleSize : aiSampleSize) { - UnitSequenceAgnosticMetrics ssamDist = (UnitSequenceAgnosticMetrics) iidsg.sequence ( - iSampleSize, - dist - ); - - String strDump = "\t| " + FormatUtil.FormatDouble (iSampleSize, 3, 0, 1) + " => "; - - for (double dblTolerance : adblTolerance) - strDump += FormatUtil.FormatDouble (ssamDist.chernoffBinomialUpperBound (dblTolerance), 1, 9, 1.) + " | "; - - System.out.println (strDump); - } - } - - private static final void PoissonChernoffBinomialBounds ( - final UnivariateSequenceGenerator iidsg, - final R1 dist, - final int[] aiSampleSize, - final double[] adblTolerance) - throws Exception - { - for (int iSampleSize : aiSampleSize) { - UnitSequenceAgnosticMetrics ssamDist = (UnitSequenceAgnosticMetrics) iidsg.sequence ( - iSampleSize, - dist - ); - - String strDump = "\t| " + FormatUtil.FormatDouble (iSampleSize, 3, 0, 1) + " => "; - - for (double dblTolerance : adblTolerance) - strDump += FormatUtil.FormatDouble (ssamDist.chernoffPoissonUpperBound (dblTolerance), 1, 9, 1.) + " | "; - - System.out.println (strDump); - } - } - - private static final void KarpHagerupRubUpperBounds ( - final UnivariateSequenceGenerator iidsg, - final R1 dist, - final int[] aiSampleSize, - final double[] adblTolerance) - throws Exception - { - for (int iSampleSize : aiSampleSize) { - UnitSequenceAgnosticMetrics ssamDist = (UnitSequenceAgnosticMetrics) iidsg.sequence ( - iSampleSize, - dist - ); - - String strDump = "\t| " + FormatUtil.FormatDouble (iSampleSize, 3, 0, 1) + " => "; - - for (double dblTolerance : adblTolerance) - strDump += FormatUtil.FormatDouble (ssamDist.karpHagerupRubBounds (dblTolerance).upper(), 1, 9, 1.) + " | "; - - System.out.println (strDump); - } - } - - private static final void KarpHagerupRubLowerBounds ( - final UnivariateSequenceGenerator iidsg, - final R1 dist, - final int[] aiSampleSize, - final double[] adblTolerance) - throws Exception - { - for (int iSampleSize : aiSampleSize) { - UnitSequenceAgnosticMetrics ssamDist = (UnitSequenceAgnosticMetrics) iidsg.sequence ( - iSampleSize, - dist - ); - - String strDump = "\t| " + FormatUtil.FormatDouble (iSampleSize, 3, 0, 1) + " => "; - - for (double dblTolerance : adblTolerance) - strDump += FormatUtil.FormatDouble (ssamDist.karpHagerupRubBounds (dblTolerance).lower(), 1, 9, 1.) + " | "; - - System.out.println (strDump); - } - } - - public static void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - BoundedUniform uniformRandom = new BoundedUniform ( - 0., - 1. - ); - - R1Uniform uniformDistribution = new R1Uniform ( - 0., - 1. - ); - - int[] aiSampleSize = new int[] { - 10, 20, 50, 100, 250 - }; - - double[] adblTolerance = new double[] { - 0.01, 0.03, 0.05, 0.07, 0.10 - }; - - Head ("\t| CHERNOFF-BINOMIAL BOUNDS - METRICS FROM UNDERLYING GENERATOR |"); - - ChernoffBinomialBounds ( - uniformRandom, - uniformDistribution, - aiSampleSize, - adblTolerance - ); - - System.out.println ("\t|----------------------------------------------------------------------------------|"); - - Head ("\t| CHERNOFF-BINOMIAL BOUNDS - METRICS FROM EMPIRICAL DISTRIBUTION |"); - - ChernoffBinomialBounds ( - uniformRandom, - null, - aiSampleSize, - adblTolerance - ); - - System.out.println ("\t|----------------------------------------------------------------------------------|"); - - Head ("\t| POISSON CHERNOFF-BINOMIAL BOUNDS - METRICS FROM UNDERLYING GENERATOR |"); - - PoissonChernoffBinomialBounds ( - uniformRandom, - uniformDistribution, - aiSampleSize, - adblTolerance - ); - - System.out.println ("\t|----------------------------------------------------------------------------------|"); - - Head ("\t| POISSON CHERNOFF-BINOMIAL BOUNDS - METRICS FROM EMPIRICAL DISTRIBUTION |"); - - PoissonChernoffBinomialBounds ( - uniformRandom, - null, - aiSampleSize, - adblTolerance - ); - - aiSampleSize = new int[] { - 100, 200, 300, 500, 999 - }; - - System.out.println ("\t|----------------------------------------------------------------------------------|"); - - Head ("\t| KARP-HAGERUP-RUB UPPER BOUNDS - METRICS FROM UNDERLYING GENERATOR |"); - - KarpHagerupRubUpperBounds ( - uniformRandom, - null, - aiSampleSize, - adblTolerance - ); - - System.out.println ("\t|----------------------------------------------------------------------------------|"); - - Head ("\t| KARP-HAGERUP-RUB UPPER BOUNDS - METRICS FROM EMPIRICAL DISTRIBUTION |"); - - KarpHagerupRubUpperBounds ( - uniformRandom, - null, - aiSampleSize, - adblTolerance - ); - - System.out.println ("\t|----------------------------------------------------------------------------------|"); - - Head ("\t| KARP-HAGERUP-RUB LOWER BOUNDS - METRICS FROM UNDERLYING GENERATOR |"); - - KarpHagerupRubLowerBounds ( - uniformRandom, - null, - aiSampleSize, - adblTolerance - ); - - System.out.println ("\t|----------------------------------------------------------------------------------|"); - - Head ("\t| KARP-HAGERUP-RUB LOWER BOUNDS - METRICS FROM EMPIRICAL DISTRIBUTION |"); - - KarpHagerupRubLowerBounds ( - uniformRandom, - null, - aiSampleSize, - adblTolerance - ); - - System.out.println ("\t|----------------------------------------------------------------------------------|"); - } -} diff --git a/org/drip/sample/service/BlackLittermanBayesianClient.java b/org/drip/sample/service/BlackLittermanBayesianClient.java deleted file mode 100644 index 4e09577..0000000 --- a/org/drip/sample/service/BlackLittermanBayesianClient.java +++ /dev/null @@ -1,183 +0,0 @@ - -package org.drip.sample.service; - -import org.drip.json.parser.Converter; -import org.drip.json.simple.JSONObject; -import org.drip.service.env.EnvManager; -import org.drip.service.json.KeyHoleSkeleton; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * BudgetConstrainedAllocationClient demonstrates the Invocation and Examination of the JSON-based - * Budget Constrained Portfolio Allocation Service Client. - * - * @author Lakshmi Krishnamurthy - */ - -public class BlackLittermanBayesianClient { - - @SuppressWarnings ("unchecked") public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblTau = 1.0000; - double dblDelta = 2.6; - double dblRiskFreeRate = 0.00; - - String[] astrAssetName = new String[] { - "ASSET 1", - "ASSET 2", - "ASSET 3", - "ASSET 4", - "ASSET 5", - "ASSET 6" - }; - - double[] adblAssetEquilibriumWeight = new double[] { - 0.2535, - 0.1343, - 0.1265, - 0.1375, - 0.0733, - 0.2749 - }; - - double[][] aadblAssetExcessReturnsCovariance = new double[][] { - {0.00273, 0.00208, 0.00159, 0.00049, 0.00117, 0.00071}, - {0.00208, 0.00277, 0.00130, 0.00046, 0.00111, 0.00056}, - {0.00159, 0.00130, 0.00146, 0.00064, 0.00105, 0.00052}, - {0.00049, 0.00046, 0.00064, 0.00061, 0.00066, 0.00037}, - {0.00117, 0.00111, 0.00105, 0.00066, 0.00139, 0.00066}, - {0.00071, 0.00056, 0.00052, 0.00037, 0.00066, 0.00070} - }; - - double[][] aadblAssetSpaceViewProjection = new double[][] { - { 0.00, 0.00, -1.00, 0.00, 1.00, 0.00}, - { 0.00, 1.00, 0.00, 0.00, -1.00, 0.00}, - { -1.00, 1.00, 1.00, 0.00, 0.00, -1.00} - }; - - double[] adblProjectionExpectedExcessReturns = new double[] { - 0.0002, - 0.0003, - 0.0001 - }; - - double[][] aadblProjectionExcessReturnsCovariance = new double[][] { - { 0.00075, -0.00053, -0.00033}, - {-0.00053, 0.00195, 0.00110}, - {-0.00033, 0.00110, 0.00217} - }; - - JSONObject jsonParameters = new JSONObject(); - - jsonParameters.put ( - "AssetSet", - Converter.Array (astrAssetName) - ); - - jsonParameters.put ( - "AssetSpaceViewProjection", - Converter.Array (aadblAssetSpaceViewProjection) - ); - - jsonParameters.put ( - "AssetEquilibriumWeight", - Converter.Array (adblAssetEquilibriumWeight) - ); - - jsonParameters.put ( - "AssetExcessReturnsCovariance", - Converter.Array (aadblAssetExcessReturnsCovariance) - ); - - jsonParameters.put ( - "ProjectionExpectedExcessReturns", - Converter.Array (adblProjectionExpectedExcessReturns) - ); - - jsonParameters.put ( - "ProjectionExcessReturnsCovariance", - Converter.Array (aadblProjectionExcessReturnsCovariance) - ); - - jsonParameters.put ( - "RiskFreeRate", - dblRiskFreeRate - ); - - jsonParameters.put ( - "Delta", - dblDelta - ); - - jsonParameters.put ( - "Tau", - dblTau - ); - - JSONObject jsonRequest = new JSONObject(); - - jsonRequest.put ( - "API", - "BLACKLITTERMAN::BAYESIANMETRICS" - ); - - jsonRequest.put ("Parameters", jsonParameters); - - System.out.println ("\n\t|---------------- JSON REQUEST -----------------|\n"); - - System.out.println (jsonRequest.toJSONString()); - - System.out.println ("\n\t|---------------- JSON RESPONSE ----------------|\n"); - - System.out.println (KeyHoleSkeleton.Thunker (jsonRequest.toJSONString())); - } -} diff --git a/org/drip/sample/service/BudgetConstrainedAllocationClient.java b/org/drip/sample/service/BudgetConstrainedAllocationClient.java deleted file mode 100644 index 392fb85..0000000 --- a/org/drip/sample/service/BudgetConstrainedAllocationClient.java +++ /dev/null @@ -1,155 +0,0 @@ - -package org.drip.sample.service; - -import org.drip.json.parser.Converter; -import org.drip.json.simple.JSONObject; -import org.drip.service.env.EnvManager; -import org.drip.service.json.KeyHoleSkeleton; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * BudgetConstrainedAllocationClient demonstrates the Invocation and Examination of the JSON-based - * Budget Constrained Portfolio Allocation Service Client. - * - * @author Lakshmi Krishnamurthy - */ - -public class BudgetConstrainedAllocationClient { - - @SuppressWarnings ("unchecked") public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.008355, - 0.007207, - 0.006279, - 0.002466, - 0.004472, - 0.006821, - 0.001570 - }; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733, 0.002083, 0.001593, 0.000488, 0.001172, 0.002312, 0.000710}, - {0.002083, 0.002768, 0.001302, 0.000457, 0.001105, 0.001647, 0.000563}, - {0.001593, 0.001302, 0.001463, 0.000639, 0.001050, 0.001110, 0.000519}, - {0.000488, 0.000457, 0.000639, 0.000608, 0.000663, 0.000042, 0.000370}, - {0.001172, 0.001105, 0.001050, 0.000663, 0.001389, 0.000825, 0.000661}, - {0.002312, 0.001647, 0.001110, 0.000042, 0.000825, 0.005211, 0.000749}, - {0.000710, 0.000563, 0.000519, 0.000370, 0.000661, 0.000749, 0.000703} - }; - - double[] adblAssetLowerBound = new double[] { - 0.05, - 0.05, - 0.05, - 0.10, - 0.05, - 0.05, - 0.03 - }; - - double[] adblAssetUpperBound = new double[] { - 0.40, - 0.40, - 0.30, - 0.60, - 0.35, - 0.15, - 0.50 - }; - - double[][] aadblBound = new double[adblAssetExpectedReturns.length][2]; - - for (int i = 0; i < adblAssetExpectedReturns.length; ++i) { - aadblBound[i][0] = adblAssetLowerBound[i]; - aadblBound[i][1] = adblAssetUpperBound[i]; - } - - JSONObject jsonParameters = new JSONObject(); - - jsonParameters.put ("AssetSet", Converter.Array (astrAssetName)); - - jsonParameters.put ("AssetExpectedReturns", Converter.Array (adblAssetExpectedReturns)); - - jsonParameters.put ("AssetReturnsCovariance", Converter.Array (aadblAssetReturnsCovariance)); - - for (int i = 0; i < adblAssetExpectedReturns.length; ++i) { - jsonParameters.put (astrAssetName[i] + "::LowerBound", aadblBound[i][0]); - - jsonParameters.put (astrAssetName[i] + "::UpperBound", aadblBound[i][1]); - } - - JSONObject jsonRequest = new JSONObject(); - - jsonRequest.put ("API", "PORTFOLIOALLOCATION::BUDGETCONSTRAINEDMEANVARIANCE"); - - jsonRequest.put ("Parameters", jsonParameters); - - System.out.println ("\n\t|---------------- JSON REQUEST -----------------|\n"); - - System.out.println (jsonRequest.toJSONString()); - - System.out.println ("\n\t|---------------- JSON RESPONSE ----------------|\n"); - - System.out.println (KeyHoleSkeleton.Thunker (jsonRequest.toJSONString())); - } -} diff --git a/org/drip/sample/service/CreditDefaultSwapClient.java b/org/drip/sample/service/CreditDefaultSwapClient.java deleted file mode 100644 index 9f4a23d..0000000 --- a/org/drip/sample/service/CreditDefaultSwapClient.java +++ /dev/null @@ -1,200 +0,0 @@ - -package org.drip.sample.service; - -import org.drip.analytics.date.*; -import org.drip.json.parser.Converter; -import org.drip.json.simple.JSONObject; -import org.drip.service.env.EnvManager; -import org.drip.service.json.KeyHoleSkeleton; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CreditDefaultSwapClient demonstrates the Invocation and Examination of the JSON-based CDS Service Client. - * - * @author Lakshmi Krishnamurthy - */ - -public class CreditDefaultSwapClient { - - @SuppressWarnings ("unchecked") public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "USD"; - String strReferenceEntity = "DRIP"; - - String[] astrDepositMaturityTenor = new String[] { - "04D", - "07D", - "14D", - "30D", - "60D" - }; - - double[] adblDepositQuote = new double[] { - 0.0017, // 2D - 0.0017, // 7D - 0.0018, // 14D - 0.0020, // 30D - 0.0023 // 60D - }; - - double[] adblFuturesQuote = new double[] { - 0.0027, - 0.0032, - 0.0041, - 0.0054, - 0.0077, - 0.0104, - 0.0134, - 0.0160 - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.0166, // 4Y - 0.0206, // 5Y - 0.0241, // 6Y - 0.0269, // 7Y - 0.0292, // 8Y - 0.0311, // 9Y - 0.0326, // 10Y - 0.0340, // 11Y - 0.0351, // 12Y - 0.0375, // 15Y - 0.0393, // 20Y - 0.0402, // 25Y - 0.0407, // 30Y - 0.0409, // 40Y - 0.0409 // 50Y - }; - - String[] astrCDSMaturityTenor = new String[] { - "06M", - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "07Y", - "10Y" - }; - - double[] adblCDSQuote = new double[] { - 60., // 6M - 68., // 1Y - 88., // 2Y - 102., // 3Y - 121., // 4Y - 138., // 5Y - 168., // 7Y - 188. // 10Y - }; - - JSONObject jsonParameters = new JSONObject(); - - jsonParameters.put ("SpotDate", dtSpot.toString()); - - jsonParameters.put ("Currency", strCurrency); - - jsonParameters.put ("ReferenceEntity", strReferenceEntity); - - jsonParameters.put ("DepositTenor", Converter.Array (astrDepositMaturityTenor)); - - jsonParameters.put ("DepositQuote", Converter.Array (adblDepositQuote)); - - jsonParameters.put ("FuturesQuote", Converter.Array (adblFuturesQuote)); - - jsonParameters.put ("FixFloatTenor", Converter.Array (astrFixFloatMaturityTenor)); - - jsonParameters.put ("FixFloatQuote", Converter.Array (adblFixFloatQuote)); - - jsonParameters.put ("CDSTenor", Converter.Array (astrCDSMaturityTenor)); - - jsonParameters.put ("CDSQuote", Converter.Array (adblCDSQuote)); - - jsonParameters.put ("CDSMaturity", "05Y"); - - jsonParameters.put ("CDSCoupon", 0.0100); - - JSONObject jsonRequest = new JSONObject(); - - jsonRequest.put ("API", "CREDITDEFAULTSWAP::CURVEMETRICS"); - - jsonRequest.put ("Parameters", jsonParameters); - - System.out.println ("\n\t|---------------- JSON REQUEST -----------------|\n"); - - System.out.println (jsonRequest.toJSONString()); - - System.out.println ("\n\t|---------------- JSON RESPONSE ----------------|\n"); - - System.out.println (KeyHoleSkeleton.Thunker (jsonRequest.toJSONString())); - } -} diff --git a/org/drip/sample/service/CreditStateClient.java b/org/drip/sample/service/CreditStateClient.java deleted file mode 100644 index 3780e15..0000000 --- a/org/drip/sample/service/CreditStateClient.java +++ /dev/null @@ -1,197 +0,0 @@ - -package org.drip.sample.service; - -import org.drip.analytics.date.*; -import org.drip.json.parser.Converter; -import org.drip.json.simple.JSONObject; -import org.drip.service.env.EnvManager; -import org.drip.service.json.KeyHoleSkeleton; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CreditStateClient demonstrates the Invocation and Examination of the JSON-based Credit Service Client. - * - * @author Lakshmi Krishnamurthy - */ - -public class CreditStateClient { - - @SuppressWarnings ("unchecked") public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "USD"; - String strReferenceEntity = "DRIP"; - - String[] astrDepositMaturityTenor = new String[] { - "04D", - "07D", - "14D", - "30D", - "60D" - }; - - double[] adblDepositQuote = new double[] { - 0.0017, // 2D - 0.0017, // 7D - 0.0018, // 14D - 0.0020, // 30D - 0.0023 // 60D - }; - - double[] adblFuturesQuote = new double[] { - 0.0027, - 0.0032, - 0.0041, - 0.0054, - 0.0077, - 0.0104, - 0.0134, - 0.0160 - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.0166, // 4Y - 0.0206, // 5Y - 0.0241, // 6Y - 0.0269, // 7Y - 0.0292, // 8Y - 0.0311, // 9Y - 0.0326, // 10Y - 0.0340, // 11Y - 0.0351, // 12Y - 0.0375, // 15Y - 0.0393, // 20Y - 0.0402, // 25Y - 0.0407, // 30Y - 0.0409, // 40Y - 0.0409 // 50Y - }; - - String[] astrCDSMaturityTenor = new String[] { - "06M", - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "07Y", - "10Y" - }; - - double[] adblCDSQuote = new double[] { - 60., // 6M - 68., // 1Y - 88., // 2Y - 102., // 3Y - 121., // 4Y - 138., // 5Y - 168., // 7Y - 188. // 10Y - }; - - JSONObject jsonParameters = new JSONObject(); - - jsonParameters.put ("SpotDate", dtSpot.toString()); - - jsonParameters.put ("Currency", strCurrency); - - jsonParameters.put ("ReferenceEntity", strReferenceEntity); - - jsonParameters.put ("DepositTenor", Converter.Array (astrDepositMaturityTenor)); - - jsonParameters.put ("DepositQuote", Converter.Array (adblDepositQuote)); - - jsonParameters.put ("FuturesQuote", Converter.Array (adblFuturesQuote)); - - jsonParameters.put ("FixFloatTenor", Converter.Array (astrFixFloatMaturityTenor)); - - jsonParameters.put ("FixFloatQuote", Converter.Array (adblFixFloatQuote)); - - jsonParameters.put ("CDSTenor", Converter.Array (astrCDSMaturityTenor)); - - jsonParameters.put ("CDSQuote", Converter.Array (adblCDSQuote)); - - JSONObject jsonRequest = new JSONObject(); - - jsonRequest.put ("API", "CREDITSTATE"); - - jsonRequest.put ("Parameters", jsonParameters); - - System.out.println ("\n\t|---------------- JSON REQUEST -----------------|\n"); - - System.out.println (jsonRequest.toJSONString()); - - System.out.println ("\n\t|---------------- JSON RESPONSE ----------------|\n"); - - System.out.println (KeyHoleSkeleton.Thunker (jsonRequest.toJSONString())); - } -} diff --git a/org/drip/sample/service/DateManipulationClient.java b/org/drip/sample/service/DateManipulationClient.java deleted file mode 100644 index c100ff0..0000000 --- a/org/drip/sample/service/DateManipulationClient.java +++ /dev/null @@ -1,206 +0,0 @@ - -package org.drip.sample.service; - -import org.drip.analytics.date.*; -import org.drip.json.parser.Converter; -import org.drip.json.simple.*; -import org.drip.service.env.EnvManager; -import org.drip.service.json.KeyHoleSkeleton; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DateManipulationClient demonstrates the Invocation and Examination of the JSON-based Date Manipulation - * Service Client. - * - * @author Lakshmi Krishnamurthy - */ - -public class DateManipulationClient { - - @SuppressWarnings ("unchecked") static String IsHoliday ( - final JulianDate dt, - final String strCalendar) - { - JSONObject jsonParameters = new JSONObject(); - - jsonParameters.put ("Date", dt.toString()); - - jsonParameters.put ("Calendar", strCalendar); - - JSONObject jsonRequest = new JSONObject(); - - jsonRequest.put ("API", "DATE::ISHOLIDAY"); - - jsonRequest.put ("Parameters", jsonParameters); - - return KeyHoleSkeleton.Thunker (jsonRequest.toJSONString()); - } - - @SuppressWarnings ("unchecked") static String Adjust ( - final JulianDate dt, - final String strCalendar, - final int iNumDaysToAdjust) - { - JSONObject jsonParameters = new JSONObject(); - - jsonParameters.put ("Date", dt.toString()); - - jsonParameters.put ("Calendar", strCalendar); - - jsonParameters.put ("DaysToAdjust", iNumDaysToAdjust); - - JSONObject jsonRequest = new JSONObject(); - - jsonRequest.put ("API", "DATE::ADJUSTBUSINESSDAYS"); - - jsonRequest.put ("Parameters", jsonParameters); - - return KeyHoleSkeleton.Thunker (jsonRequest.toJSONString()); - } - - @SuppressWarnings ("unchecked") static String Add ( - final JulianDate dt, - final int iNumDaysToAdd) - { - JSONObject jsonParameters = new JSONObject(); - - jsonParameters.put ("Date", dt.toString()); - - jsonParameters.put ("DaysToAdd", iNumDaysToAdd); - - JSONObject jsonRequest = new JSONObject(); - - jsonRequest.put ("API", "DATE::ADDDAYS"); - - jsonRequest.put ("Parameters", jsonParameters); - - return KeyHoleSkeleton.Thunker (jsonRequest.toJSONString()); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2016, - DateUtil.MARCH, - 27 - ); - - int iNumDays = 10; - String strCalendar = "MXN"; - - System.out.println ("\n\t|-----------------------------------------|"); - - for (int i = 0; i < iNumDays; ++i) { - JSONObject jsonResponse = (JSONObject) JSONValue.parse ( - Adjust ( - dtSpot, - strCalendar, - i - ) - ); - - System.out.println ( - "\t| Adjusted[" + dtSpot + " + " + i + "] = " + - Converter.DateEntry ( - jsonResponse, - "DateOut" - ) + " |" - ); - } - - System.out.println ("\t|-----------------------------------------|"); - - System.out.println ("\n\n\t|-------------------------------------------|"); - - for (int i = 0; i < iNumDays; ++i) { - JSONObject jsonResponse = (JSONObject) JSONValue.parse ( - Add ( - dtSpot, - i - ) - ); - - System.out.println ( - "\t| Unadjusted[" + dtSpot + " + " + i + "] = " + - Converter.DateEntry ( - jsonResponse, - "DateOut" - ) + " |" - ); - } - - System.out.println ("\t|-------------------------------------------|"); - - System.out.println ("\n\n\t|---------------------------------|"); - - for (int i = 0; i < iNumDays; ++i) { - JulianDate dt = dtSpot.addDays (i); - - JSONObject jsonResponse = (JSONObject) JSONValue.parse ( - IsHoliday ( - dt, - strCalendar - ) - ); - - System.out.println ( - "\t| Is " + dt + " a Holiday? " + - Converter.BooleanEntry ( - jsonResponse, - "IsHoliday" - ) + " |" - ); - } - - System.out.println ("\t|---------------------------------|"); - } -} diff --git a/org/drip/sample/service/DepositClient.java b/org/drip/sample/service/DepositClient.java deleted file mode 100644 index a7bf623..0000000 --- a/org/drip/sample/service/DepositClient.java +++ /dev/null @@ -1,173 +0,0 @@ - -package org.drip.sample.service; - -import org.drip.analytics.date.*; -import org.drip.json.parser.Converter; -import org.drip.json.simple.JSONObject; -import org.drip.service.env.EnvManager; -import org.drip.service.json.KeyHoleSkeleton; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * DepositClient demonstrates the Invocation and Examination of the JSON-based Deposit Valuation Service - * Client. - * - * @author Lakshmi Krishnamurthy - */ - -public class DepositClient { - - @SuppressWarnings ("unchecked") public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "USD"; - - String[] astrDepositMaturityTenor = new String[] { - "01D", - "04D", - "07D", - "14D", - "30D", - "60D" - }; - - double[] adblDepositQuote = new double[] { - 0.0013, // 1D - 0.0017, // 2D - 0.0017, // 7D - 0.0018, // 14D - 0.0020, // 30D - 0.0023 // 60D - }; - - double[] adblFuturesQuote = new double[] { - 0.0027, - 0.0032, - 0.0041, - 0.0054, - 0.0077, - 0.0104, - 0.0134, - 0.0160 - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.0166, // 4Y - 0.0206, // 5Y - 0.0241, // 6Y - 0.0269, // 7Y - 0.0292, // 8Y - 0.0311, // 9Y - 0.0326, // 10Y - 0.0340, // 11Y - 0.0351, // 12Y - 0.0375, // 15Y - 0.0393, // 20Y - 0.0402, // 25Y - 0.0407, // 30Y - 0.0409, // 40Y - 0.0409 // 50Y - }; - - JSONObject jsonParameters = new JSONObject(); - - jsonParameters.put ("SpotDate", dtSpot.toString()); - - jsonParameters.put ("Currency", strCurrency); - - jsonParameters.put ("DepositMaturity", "06Y"); - - jsonParameters.put ("DepositTenor", Converter.Array (astrDepositMaturityTenor)); - - jsonParameters.put ("DepositQuote", Converter.Array (adblDepositQuote)); - - jsonParameters.put ("FuturesQuote", Converter.Array (adblFuturesQuote)); - - jsonParameters.put ("FixFloatTenor", Converter.Array (astrFixFloatMaturityTenor)); - - jsonParameters.put ("FixFloatQuote", Converter.Array (adblFixFloatQuote)); - - JSONObject jsonRequest = new JSONObject(); - - jsonRequest.put ("API", "DEPOSIT::CURVEMETRICS"); - - jsonRequest.put ("Parameters", jsonParameters); - - System.out.println ("\n\t|---------------- JSON REQUEST -----------------|\n"); - - System.out.println (jsonRequest.toJSONString()); - - System.out.println ("\n\t|---------------- JSON RESPONSE ----------------|\n"); - - System.out.println (KeyHoleSkeleton.Thunker (jsonRequest.toJSONString())); - } -} diff --git a/org/drip/sample/service/FixFloatClient.java b/org/drip/sample/service/FixFloatClient.java deleted file mode 100644 index 2af79f0..0000000 --- a/org/drip/sample/service/FixFloatClient.java +++ /dev/null @@ -1,175 +0,0 @@ - -package org.drip.sample.service; - -import org.drip.analytics.date.*; -import org.drip.json.parser.Converter; -import org.drip.json.simple.JSONObject; -import org.drip.service.env.EnvManager; -import org.drip.service.json.KeyHoleSkeleton; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FixFloatClient demonstrates the Invocation and Examination of the JSON-based Fix Float Valuation Service - * Client. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixFloatClient { - - @SuppressWarnings ("unchecked") public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "USD"; - - String[] astrDepositMaturityTenor = new String[] { - "01D", - "04D", - "07D", - "14D", - "30D", - "60D" - }; - - double[] adblDepositQuote = new double[] { - 0.0013, // 1D - 0.0017, // 2D - 0.0017, // 7D - 0.0018, // 14D - 0.0020, // 30D - 0.0023 // 60D - }; - - double[] adblFuturesQuote = new double[] { - 0.0027, - 0.0032, - 0.0041, - 0.0054, - 0.0077, - 0.0104, - 0.0134, - 0.0160 - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.0166, // 4Y - 0.0206, // 5Y - 0.0241, // 6Y - 0.0269, // 7Y - 0.0292, // 8Y - 0.0311, // 9Y - 0.0326, // 10Y - 0.0340, // 11Y - 0.0351, // 12Y - 0.0375, // 15Y - 0.0393, // 20Y - 0.0402, // 25Y - 0.0407, // 30Y - 0.0409, // 40Y - 0.0409 // 50Y - }; - - JSONObject jsonParameters = new JSONObject(); - - jsonParameters.put ("SpotDate", dtSpot.toString()); - - jsonParameters.put ("Currency", strCurrency); - - jsonParameters.put ("FixFloatMaturity", "05Y"); - - jsonParameters.put ("FixFloatCoupon", 0.0206); - - jsonParameters.put ("DepositTenor", Converter.Array (astrDepositMaturityTenor)); - - jsonParameters.put ("DepositQuote", Converter.Array (adblDepositQuote)); - - jsonParameters.put ("FuturesQuote", Converter.Array (adblFuturesQuote)); - - jsonParameters.put ("FixFloatTenor", Converter.Array (astrFixFloatMaturityTenor)); - - jsonParameters.put ("FixFloatQuote", Converter.Array (adblFixFloatQuote)); - - JSONObject jsonRequest = new JSONObject(); - - jsonRequest.put ("API", "FIXFLOAT::SECULARMETRICS"); - - jsonRequest.put ("Parameters", jsonParameters); - - System.out.println ("\n\t|---------------- JSON REQUEST -----------------|\n"); - - System.out.println (jsonRequest.toJSONString()); - - System.out.println ("\n\t|---------------- JSON RESPONSE ----------------|\n"); - - System.out.println (KeyHoleSkeleton.Thunker (jsonRequest.toJSONString())); - } -} diff --git a/org/drip/sample/service/FixedAssetBackedClient.java b/org/drip/sample/service/FixedAssetBackedClient.java deleted file mode 100644 index a6997af..0000000 --- a/org/drip/sample/service/FixedAssetBackedClient.java +++ /dev/null @@ -1,132 +0,0 @@ - -package org.drip.sample.service; - -import org.drip.analytics.date.*; -import org.drip.json.simple.JSONObject; -import org.drip.service.env.EnvManager; -import org.drip.service.json.KeyHoleSkeleton; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FixedAssetBackedClient demonstrates the Invocation and Examination of the JSON-based Fixed Payment Asset - * Backed Loan Service Client. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixedAssetBackedClient { - - @SuppressWarnings ("unchecked") public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblBeginPrincipalFactor = 1.; - double dblCouponRate = 0.1189; - double dblServiceFeeRate = 0.00; - double dblBondNotional = 147544.28; - String strDayCount = "Act/365"; - String strCurrency = "USD"; - int iNumPayment = 48; - int iPayFrequency = 12; - double dblFixedMonthlyAmount = 3941.98; - - JulianDate dtEffective = DateUtil.CreateFromYMD ( - 2015, - DateUtil.OCTOBER, - 22 - ); - - JulianDate dtSettle = DateUtil.CreateFromYMD ( - 2015, - DateUtil.DECEMBER, - 1 - ); - - JSONObject jsonParameters = new JSONObject(); - - jsonParameters.put ("Name", "FPMG 11.89 2019"); - - jsonParameters.put ("SettleDate", dtSettle.toString()); - - jsonParameters.put ("EffectiveDate", dtEffective.toString()); - - jsonParameters.put ("BeginPrincipalFactor", dblBeginPrincipalFactor); - - jsonParameters.put ("CouponRate", dblCouponRate); - - jsonParameters.put ("ServiceFeeRate", dblServiceFeeRate); - - jsonParameters.put ("BondNotional", dblBondNotional); - - jsonParameters.put ("DayCount", strDayCount); - - jsonParameters.put ("NumPayment", iNumPayment); - - jsonParameters.put ("Currency", strCurrency); - - jsonParameters.put ("PayFrequency", iPayFrequency); - - jsonParameters.put ("FixedMonthlyAmount", dblFixedMonthlyAmount); - - JSONObject jsonRequest = new JSONObject(); - - jsonRequest.put ("API", "FIXEDASSETBACKED::SECULARMETRICS"); - - jsonRequest.put ("Parameters", jsonParameters); - - System.out.println ("\n\t|---------------- JSON REQUEST -----------------|\n"); - - System.out.println (jsonRequest.toJSONString()); - - System.out.println ("\n\t|---------------- JSON RESPONSE ----------------|\n"); - - System.out.println (KeyHoleSkeleton.Thunker (jsonRequest.toJSONString())); - } -} diff --git a/org/drip/sample/service/ForwardRateFuturesClient.java b/org/drip/sample/service/ForwardRateFuturesClient.java deleted file mode 100644 index e1128e9..0000000 --- a/org/drip/sample/service/ForwardRateFuturesClient.java +++ /dev/null @@ -1,173 +0,0 @@ - -package org.drip.sample.service; - -import org.drip.analytics.date.*; -import org.drip.json.parser.Converter; -import org.drip.json.simple.JSONObject; -import org.drip.service.env.EnvManager; -import org.drip.service.json.KeyHoleSkeleton; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ForwardRateFuturesClient demonstrates the Invocation and Examination of the JSON-based Forward Rate - * Futures Valuation Service Client. - * - * @author Lakshmi Krishnamurthy - */ - -public class ForwardRateFuturesClient { - - @SuppressWarnings ("unchecked") public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "USD"; - - String[] astrDepositMaturityTenor = new String[] { - "01D", - "04D", - "07D", - "14D", - "30D", - "60D" - }; - - double[] adblDepositQuote = new double[] { - 0.0013, // 1D - 0.0017, // 2D - 0.0017, // 7D - 0.0018, // 14D - 0.0020, // 30D - 0.0023 // 60D - }; - - double[] adblFuturesQuote = new double[] { - 0.0027, - 0.0032, - 0.0041, - 0.0054, - 0.0077, - 0.0104, - 0.0134, - 0.0160 - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.0166, // 4Y - 0.0206, // 5Y - 0.0241, // 6Y - 0.0269, // 7Y - 0.0292, // 8Y - 0.0311, // 9Y - 0.0326, // 10Y - 0.0340, // 11Y - 0.0351, // 12Y - 0.0375, // 15Y - 0.0393, // 20Y - 0.0402, // 25Y - 0.0407, // 30Y - 0.0409, // 40Y - 0.0409 // 50Y - }; - - JSONObject jsonParameters = new JSONObject(); - - jsonParameters.put ("SpotDate", dtSpot.toString()); - - jsonParameters.put ("Currency", strCurrency); - - jsonParameters.put ("FuturesEffectiveTenor", "02Y"); - - jsonParameters.put ("DepositTenor", Converter.Array (astrDepositMaturityTenor)); - - jsonParameters.put ("DepositQuote", Converter.Array (adblDepositQuote)); - - jsonParameters.put ("FuturesQuote", Converter.Array (adblFuturesQuote)); - - jsonParameters.put ("FixFloatTenor", Converter.Array (astrFixFloatMaturityTenor)); - - jsonParameters.put ("FixFloatQuote", Converter.Array (adblFixFloatQuote)); - - JSONObject jsonRequest = new JSONObject(); - - jsonRequest.put ("API", "FORWARDRATEFUTURES::CURVEMETRICS"); - - jsonRequest.put ("Parameters", jsonParameters); - - System.out.println ("\n\t|---------------- JSON REQUEST -----------------|\n"); - - System.out.println (jsonRequest.toJSONString()); - - System.out.println ("\n\t|---------------- JSON RESPONSE ----------------|\n"); - - System.out.println (KeyHoleSkeleton.Thunker (jsonRequest.toJSONString())); - } -} diff --git a/org/drip/sample/service/FundingStateClient.java b/org/drip/sample/service/FundingStateClient.java deleted file mode 100644 index 01938c8..0000000 --- a/org/drip/sample/service/FundingStateClient.java +++ /dev/null @@ -1,170 +0,0 @@ - -package org.drip.sample.service; - -import org.drip.analytics.date.*; -import org.drip.json.parser.Converter; -import org.drip.json.simple.JSONObject; -import org.drip.service.env.EnvManager; -import org.drip.service.json.KeyHoleSkeleton; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FundingStateClient demonstrates the Invocation and Examination of the JSON-based Funding Service Client. - * - * @author Lakshmi Krishnamurthy - */ - -public class FundingStateClient { - - @SuppressWarnings ("unchecked") public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "USD"; - - String[] astrDepositMaturityTenor = new String[] { - "01D", - "04D", - "07D", - "14D", - "30D", - "60D" - }; - - double[] adblDepositQuote = new double[] { - 0.0013, // 1D - 0.0017, // 2D - 0.0017, // 7D - 0.0018, // 14D - 0.0020, // 30D - 0.0023 // 60D - }; - - double[] adblFuturesQuote = new double[] { - 0.0027, - 0.0032, - 0.0041, - 0.0054, - 0.0077, - 0.0104, - 0.0134, - 0.0160 - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.0166, // 4Y - 0.0206, // 5Y - 0.0241, // 6Y - 0.0269, // 7Y - 0.0292, // 8Y - 0.0311, // 9Y - 0.0326, // 10Y - 0.0340, // 11Y - 0.0351, // 12Y - 0.0375, // 15Y - 0.0393, // 20Y - 0.0402, // 25Y - 0.0407, // 30Y - 0.0409, // 40Y - 0.0409 // 50Y - }; - - JSONObject jsonParameters = new JSONObject(); - - jsonParameters.put ("SpotDate", dtSpot.toString()); - - jsonParameters.put ("Currency", strCurrency); - - jsonParameters.put ("DepositTenor", Converter.Array (astrDepositMaturityTenor)); - - jsonParameters.put ("DepositQuote", Converter.Array (adblDepositQuote)); - - jsonParameters.put ("FuturesQuote", Converter.Array (adblFuturesQuote)); - - jsonParameters.put ("FixFloatTenor", Converter.Array (astrFixFloatMaturityTenor)); - - jsonParameters.put ("FixFloatQuote", Converter.Array (adblFixFloatQuote)); - - JSONObject jsonRequest = new JSONObject(); - - jsonRequest.put ("API", "FUNDINGSTATE"); - - jsonRequest.put ("Parameters", jsonParameters); - - System.out.println ("\n\t|---------------- JSON REQUEST -----------------|\n"); - - System.out.println (jsonRequest.toJSONString()); - - System.out.println ("\n\t|---------------- JSON RESPONSE ----------------|\n"); - - System.out.println (KeyHoleSkeleton.Thunker (jsonRequest.toJSONString())); - } -} diff --git a/org/drip/sample/service/PrepayAssetBackedClient.java b/org/drip/sample/service/PrepayAssetBackedClient.java deleted file mode 100644 index da97560..0000000 --- a/org/drip/sample/service/PrepayAssetBackedClient.java +++ /dev/null @@ -1,135 +0,0 @@ - -package org.drip.sample.service; - -import org.drip.analytics.date.*; -import org.drip.json.simple.JSONObject; -import org.drip.service.env.EnvManager; -import org.drip.service.json.KeyHoleSkeleton; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PrepayAssetBackedClient demonstrates the Invocation and Examination of the JSON-based Pre-payable - * Constant Payment Asset Backed Loan Service Client. - * - * @author Lakshmi Krishnamurthy - */ - -public class PrepayAssetBackedClient { - - @SuppressWarnings ("unchecked") public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblBeginPrincipalFactor = 1.; - double dblCouponRate = 0.1189; - double dblServiceFeeRate = 0.00; - double dblCPR = 0.01; - double dblBondNotional = 147544.28; - String strDayCount = "Act/365"; - String strCurrency = "USD"; - int iNumPayment = 48; - int iPayFrequency = 12; - double dblFixedMonthlyAmount = 3941.98; - - JulianDate dtEffective = DateUtil.CreateFromYMD ( - 2015, - DateUtil.OCTOBER, - 22 - ); - - JulianDate dtSettle = DateUtil.CreateFromYMD ( - 2015, - DateUtil.DECEMBER, - 1 - ); - - JSONObject jsonParameters = new JSONObject(); - - jsonParameters.put ("Name", "FPMG 11.89 2019"); - - jsonParameters.put ("SettleDate", dtSettle.toString()); - - jsonParameters.put ("EffectiveDate", dtEffective.toString()); - - jsonParameters.put ("BeginPrincipalFactor", dblBeginPrincipalFactor); - - jsonParameters.put ("CouponRate", dblCouponRate); - - jsonParameters.put ("ServiceFeeRate", dblServiceFeeRate); - - jsonParameters.put ("CPR", dblCPR); - - jsonParameters.put ("BondNotional", dblBondNotional); - - jsonParameters.put ("DayCount", strDayCount); - - jsonParameters.put ("NumPayment", iNumPayment); - - jsonParameters.put ("Currency", strCurrency); - - jsonParameters.put ("PayFrequency", iPayFrequency); - - jsonParameters.put ("FixedMonthlyAmount", dblFixedMonthlyAmount); - - JSONObject jsonRequest = new JSONObject(); - - jsonRequest.put ("API", "PREPAYASSETBACKED::SECULARMETRICS"); - - jsonRequest.put ("Parameters", jsonParameters); - - System.out.println ("\n\t|---------------- JSON REQUEST -----------------|\n"); - - System.out.println (jsonRequest.toJSONString()); - - System.out.println ("\n\t|---------------- JSON RESPONSE ----------------|\n"); - - System.out.println (KeyHoleSkeleton.Thunker (jsonRequest.toJSONString())); - } -} diff --git a/org/drip/sample/service/ReturnsConstrainedAllocationClient.java b/org/drip/sample/service/ReturnsConstrainedAllocationClient.java deleted file mode 100644 index bbe798b..0000000 --- a/org/drip/sample/service/ReturnsConstrainedAllocationClient.java +++ /dev/null @@ -1,159 +0,0 @@ - -package org.drip.sample.service; - -import org.drip.json.parser.Converter; -import org.drip.json.simple.JSONObject; -import org.drip.service.env.EnvManager; -import org.drip.service.json.KeyHoleSkeleton; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ReturnsConstrainedAllocationClient demonstrates the Invocation and Examination of the JSON-based - * Weight Normalized/Returns Constrained Portfolio Allocation Service Client. - * - * @author Lakshmi Krishnamurthy - */ - -public class ReturnsConstrainedAllocationClient { - - @SuppressWarnings ("unchecked") public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.008355, - 0.007207, - 0.006279, - 0.002466, - 0.004472, - 0.006821, - 0.001570 - }; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733, 0.002083, 0.001593, 0.000488, 0.001172, 0.002312, 0.000710}, - {0.002083, 0.002768, 0.001302, 0.000457, 0.001105, 0.001647, 0.000563}, - {0.001593, 0.001302, 0.001463, 0.000639, 0.001050, 0.001110, 0.000519}, - {0.000488, 0.000457, 0.000639, 0.000608, 0.000663, 0.000042, 0.000370}, - {0.001172, 0.001105, 0.001050, 0.000663, 0.001389, 0.000825, 0.000661}, - {0.002312, 0.001647, 0.001110, 0.000042, 0.000825, 0.005211, 0.000749}, - {0.000710, 0.000563, 0.000519, 0.000370, 0.000661, 0.000749, 0.000703} - }; - - double[] adblAssetLowerBound = new double[] { - 0.05, - 0.05, - 0.05, - 0.10, - 0.05, - 0.05, - 0.03 - }; - - double[] adblAssetUpperBound = new double[] { - 0.40, - 0.40, - 0.30, - 0.60, - 0.35, - 0.15, - 0.50 - }; - - double[][] aadblBound = new double[adblAssetExpectedReturns.length][2]; - - for (int i = 0; i < adblAssetExpectedReturns.length; ++i) { - aadblBound[i][0] = adblAssetLowerBound[i]; - aadblBound[i][1] = adblAssetUpperBound[i]; - } - - double dblPortfolioDesignReturn = 0.005262; - - JSONObject jsonParameters = new JSONObject(); - - jsonParameters.put ("AssetSet", Converter.Array (astrAssetName)); - - jsonParameters.put ("AssetReturnsMean", Converter.Array (adblAssetExpectedReturns)); - - jsonParameters.put ("AssetReturnsCovariance", Converter.Array (aadblAssetReturnsCovariance)); - - jsonParameters.put ("PortfolioDesignReturn", dblPortfolioDesignReturn); - - for (int i = 0; i < adblAssetExpectedReturns.length; ++i) { - jsonParameters.put (astrAssetName[i] + "::LowerBound", aadblBound[i][0]); - - jsonParameters.put (astrAssetName[i] + "::UpperBound", aadblBound[i][1]); - } - - JSONObject jsonRequest = new JSONObject(); - - jsonRequest.put ("API", "PORTFOLIOALLOCATION::RETURNSCONSTRAINEDMEANVARIANCE"); - - jsonRequest.put ("Parameters", jsonParameters); - - System.out.println ("\n\t|---------------- JSON REQUEST -----------------|\n"); - - System.out.println (jsonRequest.toJSONString()); - - System.out.println ("\n\t|---------------- JSON RESPONSE ----------------|\n"); - - System.out.println (KeyHoleSkeleton.Thunker (jsonRequest.toJSONString())); - } -} diff --git a/org/drip/sample/service/TreasuryBondClient.java b/org/drip/sample/service/TreasuryBondClient.java deleted file mode 100644 index 7a0886f..0000000 --- a/org/drip/sample/service/TreasuryBondClient.java +++ /dev/null @@ -1,123 +0,0 @@ - -package org.drip.sample.service; - -import org.drip.analytics.date.*; -import org.drip.json.simple.JSONObject; -import org.drip.service.env.EnvManager; -import org.drip.service.json.KeyHoleSkeleton; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TreasuryBondClient demonstrates the Invocation and Examination of the JSON-based Treasury Bond Service - * Client. - * - * @author Lakshmi Krishnamurthy - */ - -public class TreasuryBondClient { - - @SuppressWarnings ("unchecked") public static void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblCoupon = 0.10; - double dblNotional = 100000000.; - double dblCleanPrice = 1.35213; - String strTreasuryCode = "MBONO"; - - JulianDate dtEffective = DateUtil.CreateFromYMD ( - 2011, - DateUtil.NOVEMBER, - 20 - ); - - JulianDate dtMaturity = DateUtil.CreateFromYMD ( - 2036, - DateUtil.NOVEMBER, - 20 - ); - - JulianDate dtSettle = DateUtil.CreateFromYMD ( - 2016, - DateUtil.MARCH, - 30 - ); - - JSONObject jsonParameters = new JSONObject(); - - jsonParameters.put ("TreasuryCode", strTreasuryCode); - - jsonParameters.put ("EffectiveDate", dtEffective.toString()); - - jsonParameters.put ("MaturityDate", dtMaturity.toString()); - - jsonParameters.put ("Coupon", dblCoupon); - - jsonParameters.put ("Notional", dblNotional); - - jsonParameters.put ("SettleDate", dtSettle.toString()); - - jsonParameters.put ("CleanPrice", dblCleanPrice); - - JSONObject jsonRequest = new JSONObject(); - - jsonRequest.put ("API", "TREASURYBOND::SECULARMETRICS"); - - jsonRequest.put ("Parameters", jsonParameters); - - System.out.println ("\n\t|---------------- JSON REQUEST -----------------|\n"); - - System.out.println (jsonRequest.toJSONString()); - - System.out.println ("\n\t|---------------- JSON RESPONSE ----------------|\n"); - - System.out.println (KeyHoleSkeleton.Thunker (jsonRequest.toJSONString())); - } -} diff --git a/org/drip/sample/spline/BSplineSequence.java b/org/drip/sample/spline/BSplineSequence.java deleted file mode 100644 index 17cb36f..0000000 --- a/org/drip/sample/spline/BSplineSequence.java +++ /dev/null @@ -1,211 +0,0 @@ - -package org.drip.sample.spline; - -import org.drip.quant.common.FormatUtil; -import org.drip.spline.bspline.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * BSplineSequence implements Samples for the Construction and the usage of various monic basis B Spline - * Sequences. It demonstrates the following: - * - Construction and Usage of segment Monic B Spline Sequence. - * - Construction and Usage of segment Multic B Spline Sequence. - * - * @author Lakshmi Krishnamurthy - */ - -public class BSplineSequence { - - /* - * This sample shows the computation of the response value, the normalized cumulative, and the ordered - * derivative of the specified Segment Basis Function. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void ComputeResponseMetric ( - final SegmentBasisFunction me, - final String strComment) - throws Exception - { - int iOrder = 1; - double dblXIncrement = 0.25; - - double dblX = me.leading() - dblXIncrement; - - double dblXEnd = me.trailing() + dblXIncrement; - - System.out.println ("\n\t---------------------------------------------------------------"); - - System.out.println ("\t-------------------------" + strComment + "---------------------------"); - - System.out.println ("\t---------------------------------------------------------------\n"); - - while (dblX <= dblXEnd) { - System.out.println ( - "\t\tResponse[" + FormatUtil.FormatDouble (dblX, 1, 3, 1.) + "] : " + - FormatUtil.FormatDouble (me.evaluate (dblX), 1, 5, 1.) + " | " + - FormatUtil.FormatDouble (me.normalizedCumulative (dblX), 1, 5, 1.) + " | " + - FormatUtil.FormatDouble (me.derivative (dblX, iOrder), 1, 5, 1.) - ); - - dblX += dblXIncrement; - } - } - - /* - * This sample demonstrates the construction and usage of the following monic/multic basis spline arrays: - * - Hyperbolic Rational Linear Monic. - * - Multic basis functions of 3rd degree (i.e., quadratic). - * - Multic basis functions of 4th degree (i.e., cubic). - * - Multic basis functions of 5th degree (i.e., quartic). - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void BSplineSequenceSample() - throws Exception - { - double[] adblPredictorOrdinate = new double[] { - 1., 2., 3., 4., 5., 6. - }; - - /* - * Construct the Array of Hyperbolic Rational Linear Monic Segment Basis Functions. - */ - - SegmentBasisFunction[] aMonic = SegmentBasisFunctionGenerator.MonicSequence ( - BasisHatPairGenerator.RAW_TENSION_HYPERBOLIC, - BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_LINEAR, - adblPredictorOrdinate, - 0, - 1. - ); - - /* - * Display the response value, the normalized cumulative, and the ordered derivative of the Monic - * Segment Basis Function. - */ - - for (int i = 0; i < aMonic.length; ++i) - ComputeResponseMetric ( - aMonic[i], - " MONIC " - ); - - /* - * Construct the array of multic basis functions of 3rd degree (i.e., quadratic). - */ - - SegmentBasisFunction[] aQuadratic = SegmentBasisFunctionGenerator.MulticSequence ( - 3, - aMonic - ); - - /* - * Display the response value, the normalized cumulative, and the ordered derivative of the Quadratic - * Multic Segment Basis Function. - */ - - for (int i = 0; i < aQuadratic.length; ++i) - ComputeResponseMetric ( - aQuadratic[i], - " QUADRATIC " - ); - - /* - * Construct the array of multic basis functions of 4th degree (i.e., cubic). - */ - - SegmentBasisFunction[] aCubic = SegmentBasisFunctionGenerator.MulticSequence ( - 4, - aQuadratic - ); - - /* - * Display the response value, the normalized cumulative, and the ordered derivative of the Cubic - * Multic Segment Basis Function. - */ - - for (int i = 0; i < aCubic.length; ++i) - ComputeResponseMetric ( - aCubic[i], - " CUBIC " - ); - - /* - * Construct the array of multic basis functions of 5th degree (i.e., quartic). - */ - - SegmentBasisFunction[] aQuartic = SegmentBasisFunctionGenerator.MulticSequence ( - 5, - aCubic - ); - - /* - * Display the response value, the normalized cumulative, and the ordered derivative of the Quartic - * Multic Segment Basis Function. - */ - - for (int i = 0; i < aQuartic.length; ++i) - ComputeResponseMetric ( - aQuartic[i], - " QUARTIC " - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - BSplineSequenceSample(); - } -} diff --git a/org/drip/sample/spline/BasisBSplineSet.java b/org/drip/sample/spline/BasisBSplineSet.java deleted file mode 100644 index c2d6e9b..0000000 --- a/org/drip/sample/spline/BasisBSplineSet.java +++ /dev/null @@ -1,181 +0,0 @@ - -package org.drip.sample.spline; - -import org.drip.spline.basis.*; -import org.drip.spline.bspline.*; -import org.drip.spline.params.*; -import org.drip.spline.segment.LatentStateResponseModel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * BasisSplineSet implements Samples for the Construction and the usage of various basis spline functions. It - * demonstrates the following: - * - Construction of segment control parameters - polynomial (regular/Bernstein) segment control, - * exponential/hyperbolic tension segment control, Kaklis-Pandelis tension segment control, and C1 - * Hermite. - * - Control the segment using the rational shape controller, and the appropriate Ck. - * - Estimate the node value and the node value Jacobian with the segment, as well as at the boundaries. - * - Calculate the segment monotonicity. - - * @author Lakshmi Krishnamurthy - */ - -public class BasisBSplineSet { - - /* - * This sample demonstrates construction and usage of B Spline hat functions over solitary segments. It - * shows the constructions of left/right segments, their calibration, and Jacobian evaluation. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void TestSpline ( - final FunctionSet fs, - final ResponseScalingShapeControl rssc, - final SegmentInelasticDesignControl segParams) - throws Exception - { - /* - * Construct the left and the right segments - */ - - LatentStateResponseModel seg1 = LatentStateResponseModel.Create ( - 1.0, - 1.5, - fs, - rssc, - segParams - ); - - /* - * Calibrate the left segment using the node values, and compute the segment Jacobian - */ - - System.out.println ( - seg1.calibrate ( - 25., - 0., - 20.25, - null - ) - ); - - System.out.println ("\tY[" + 1.0 + "]: " + seg1.responseValue (1.)); - - System.out.println ("\tY[" + 1.5 + "]: " + seg1.responseValue (1.5)); - } - - /* - * This sample demonstrates the construction and usage of the Basis B Spline Set Functionality. It shows - * the following: - * - Set up the B Spline Sequence Parameters for the Cubic Rational Hat Type, Linear Shape Controller, - * using the specified tension and derivative order parameters. - * - Setup the B Spline Basis Set. - * - Construct the segment inelastic parameter that is C2 (iK = 2 sets it to C2), with second order - * curvature penalty, and without constraint. - * - Construct and Evaluate the B Spline. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void BasisBSplineSetSample() - throws Exception - { - /* - * Set up the B Spline Sequence Parameters for the Cubic Rational Hat Type, Linear Shape Controller, - * using the specified tension and derivative order parameters. - */ - - BSplineSequenceParams bssp = new BSplineSequenceParams ( - BasisHatPairGenerator.PROCESSED_CUBIC_RATIONAL, - BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_LINEAR, - 2, - 4, - 1., - 2); - - /* - * Setup the B Spline Basis Set - */ - - FunctionSet fsBSS = FunctionSetBuilder.BSplineBasisSet (bssp); - - /* - * Construct the segment inelastic parameter that is C2 (iK = 2 sets it to C2), with second order - * curvature penalty, and without constraint - */ - - int iK = 2; - int iCurvaturePenaltyDerivativeOrder = 2; - - SegmentInelasticDesignControl segParams = SegmentInelasticDesignControl.Create ( - iK, - iCurvaturePenaltyDerivativeOrder - ); - - /* - * Construct and Evaluate the B Spline - */ - - TestSpline ( - fsBSS, - null, - segParams - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - BasisBSplineSetSample(); - } -} diff --git a/org/drip/sample/spline/BasisMonicBSpline.java b/org/drip/sample/spline/BasisMonicBSpline.java deleted file mode 100644 index fbbe83d..0000000 --- a/org/drip/sample/spline/BasisMonicBSpline.java +++ /dev/null @@ -1,364 +0,0 @@ - -package org.drip.sample.spline; - -import org.drip.spline.bspline.*; -import org.drip.quant.common.FormatUtil; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * BasisMonicBSpline implements Samples for the Construction and the usage of various monic basis B Splines. - * It demonstrates the following: - * - Construction of segment B Spline Hat Basis Functions. - * - Estimation of the derivatives and the basis envelope cumulative integrands. - * - Estimation of the normalizer and the basis envelope cumulative normalized integrands. - * - * @author Lakshmi Krishnamurthy - */ - -public class BasisMonicBSpline { - - /* - * This sample illustrates the construction and the usage of the monic basis B Splines. It shows the - * following: - * - Construct the segment basis monic function from the specified hat type, the shape controller, the - * derivative order, and the tension. - * - Compare the responses emitted by the basis hat functions and the monic basis functions. - * - Compute the normalized cumulative emitted by the monic basis functions. - * - Compute the ordered derivative emitted by the monic basis functions. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void TestMonicHatBasis ( - final String strHatType, - final String strShapeController, - final TensionBasisHat[] aTBH, - final double[] adblPredictorOrdinate, - final String strTest) - throws Exception - { - /* - * Construct the segment basis monic function from the specified hat type, the shape controller, the - * derivative order, and the tension. - */ - - SegmentBasisFunction me = SegmentBasisFunctionGenerator.Monic ( - strHatType, - strShapeController, - adblPredictorOrdinate, - 2, - aTBH[0].tension() - ); - - /* - * Compare the responses emitted by the basis hat functions and the monic basis functions. - */ - - double dblX = 1.0; - double dblXIncrement = 0.25; - - System.out.println ("\n\t-------------------------------------------------"); - - System.out.println ("\t--------------" + strTest + "-------------"); - - System.out.println ("\t-------------------------------------------------\n"); - - System.out.println ("\t-------------X---|---LEFT---|---RIGHT--|--MONIC--\n"); - - while (dblX <= 3.0) { - System.out.println ( - "\tResponse[" + FormatUtil.FormatDouble (dblX, 1, 3, 1.) + "] : " + - FormatUtil.FormatDouble (aTBH[0].evaluate (dblX), 1, 5, 1.) + " | " + - FormatUtil.FormatDouble (aTBH[1].evaluate (dblX), 1, 5, 1.) + " | " + - FormatUtil.FormatDouble (me.evaluate (dblX), 1, 5, 1.)); - - dblX += dblXIncrement; - } - - System.out.println ("\n\t------------------------------------------------\n"); - - /* - * Compute the normalized cumulative emitted by the monic basis functions. - */ - - dblX = 1.0; - - while (dblX <= 3.0) { - System.out.println ( - "\t\tNormCumulative[" + FormatUtil.FormatDouble (dblX, 1, 3, 1.) + "] : " + - FormatUtil.FormatDouble (me.normalizedCumulative (dblX), 1, 5, 1.) - ); - - dblX += dblXIncrement; - } - - System.out.println ("\n\t------------------------------------------------\n"); - - /* - * Compute the ordered derivative emitted by the monic basis functions. - */ - - dblX = 1.0; - int iOrder = 1; - - while (dblX <= 3.0) { - System.out.println ( - "\t\t\tDeriv[" + FormatUtil.FormatDouble (dblX, 1, 3, 1.) + "] : " + - FormatUtil.FormatDouble (me.derivative (dblX, iOrder), 1, 5, 1.) - ); - - dblX += dblXIncrement; - } - - System.out.println ("\n\t-----------------------------------------------\n"); - } - - /* - * This sample illustrates the construction and usage of raw/processed basis tension splines, and their - * comparisons with the correspondingly constructed monic hat basis functions. It shows the following: - * - Construct the Processed Hyperbolic Tension Hat Pair from the co-ordinate arrays, the Ck, and the - * tension. - * - Implement and test the basis monic spline function using the constructed Processed Hyperbolic - * Tension Hat Pair and the Rational Linear Shape Controller. - * - Construct the Raw Hyperbolic Tension Hat Pair from the co-ordinate arrays and the tension. - * - Implement and test the basis monic spline function using the constructed Raw Hyperbolic Tension Hat - * Pair and the Rational Linear Shape Controller. - * - Construct the Processed Cubic Rational Tension Hat Pair from the co-ordinate arrays, Linear - * Rational Shape Controller, and no tension. - * - Implement and test the basis monic spline function using the constructed Flat Processed Cubic - * Tension Hat Pair and the Rational Linear Shape Controller. - * - Construct the Processed Cubic Rational Tension Hat Pair from the co-ordinate arrays, Linear - * Rational Shape Controller, and non-zero tension. - * - Implement and test the basis monic spline function using the constructed Processed Cubic Rational - * Tension Hat Pair and the Rational Linear Shape Controller. - * - Construct the Processed Cubic Rational Tension Hat Pair from the co-ordinate arrays, Quadratic - * Rational Shape Controller, and the tension. - * - Implement and test the basis monic spline function using the constructed Processed Cubic Rational - * Tension Hat Pair and the Quadratic Linear Shape Controller. - * - Construct the Processed Cubic Rational Tension Hat Pair from the co-ordinate arrays, Exponential - * Rational Shape Controller, and the tension. - * - Implement and test the basis monic spline function using the constructed Processed Cubic Rational - * Tension Hat Pair and the Rational Exponential Shape Controller. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void BasisMonicBSplineSample() - throws Exception - { - double[] adblPredictorOrdinate = new double[] {1., 2., 3.}; - - /* - * Construct the Processed Hyperbolic Tension Hat Pair from the co-ordinate arrays, the Ck, and the - * tension. - */ - - TensionBasisHat[] aTBHProcessed = BasisHatPairGenerator.ProcessedHyperbolicTensionHatPair ( - adblPredictorOrdinate[0], - adblPredictorOrdinate[1], - adblPredictorOrdinate[2], - 2, - 1. - ); - - /* - * Implement and test the basis monic spline function using the constructed Processed Hyperbolic - * Tension Hat Pair and the Rational Linear Shape Controller. - */ - - TestMonicHatBasis ( - BasisHatPairGenerator.PROCESSED_TENSION_HYPERBOLIC, - BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_LINEAR, - aTBHProcessed, - adblPredictorOrdinate, - " PROCESSED HYPERBOLIC " - ); - - /* - * Construct the Raw Hyperbolic Tension Hat Pair from the co-ordinate arrays and the tension. - */ - - TensionBasisHat[] aTBHStraight = BasisHatPairGenerator.HyperbolicTensionHatPair ( - adblPredictorOrdinate[0], - adblPredictorOrdinate[1], - adblPredictorOrdinate[2], - 1. - ); - - /* - * Implement and test the basis monic spline function using the constructed Raw Hyperbolic Tension - * Hat Pair and the Rational Linear Shape Controller. - */ - - TestMonicHatBasis ( - BasisHatPairGenerator.RAW_TENSION_HYPERBOLIC, - BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_LINEAR, - aTBHStraight, - adblPredictorOrdinate, - " STRAIGHT HYPERBOLIC " - ); - - /* - * Construct the Processed Cubic Rational Tension Hat Pair from the co-ordinate arrays, Linear - * Rational Shape Controller, and no tension. - */ - - TensionBasisHat[] aTBHCubicRationalPlain = BasisHatPairGenerator.ProcessedCubicRationalHatPair ( - BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_LINEAR, - adblPredictorOrdinate[0], - adblPredictorOrdinate[1], - adblPredictorOrdinate[2], - 2, - 0. - ); - - /* - * Implement and test the basis monic spline function using the constructed Flat Processed Cubic - * Tension Hat Pair and the Rational Linear Shape Controller. - */ - - TestMonicHatBasis ( - BasisHatPairGenerator.PROCESSED_CUBIC_RATIONAL, - BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_LINEAR, - aTBHCubicRationalPlain, - adblPredictorOrdinate, - " CUBIC FLAT " - ); - - /* - * Construct the Processed Cubic Rational Tension Hat Pair from the co-ordinate arrays, Linear - * Rational Shape Controller, and non-zero tension. - */ - - TensionBasisHat[] aTBHCubicRationalLinear = BasisHatPairGenerator.ProcessedCubicRationalHatPair ( - BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_LINEAR, - adblPredictorOrdinate[0], - adblPredictorOrdinate[1], - adblPredictorOrdinate[2], - 2, - 1. - ); - - /* - * Implement and test the basis monic spline function using the constructed Processed Cubic Rational - * Tension Hat Pair and the Rational Linear Shape Controller. - */ - - TestMonicHatBasis ( - BasisHatPairGenerator.PROCESSED_CUBIC_RATIONAL, - BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_LINEAR, - aTBHCubicRationalLinear, - adblPredictorOrdinate, - " CUBIC LINEAR RATIONAL " - ); - - /* - * Construct the Processed Cubic Rational Tension Hat Pair from the co-ordinate arrays, Quadratic - * Rational Shape Controller, and the tension. - */ - - TensionBasisHat[] aTBHCubicRationalQuadratic = BasisHatPairGenerator.ProcessedCubicRationalHatPair ( - BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_QUADRATIC, - adblPredictorOrdinate[0], - adblPredictorOrdinate[1], - adblPredictorOrdinate[2], - 2, - 1. - ); - - /* - * Implement and test the basis monic spline function using the constructed Processed Cubic Rational - * Tension Hat Pair and the Quadratic Linear Shape Controller. - */ - - TestMonicHatBasis ( - BasisHatPairGenerator.PROCESSED_CUBIC_RATIONAL, - BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_QUADRATIC, - aTBHCubicRationalQuadratic, - adblPredictorOrdinate, - " CUBIC QUAD RATIONAL " - ); - - /* - * Construct the Processed Cubic Rational Tension Hat Pair from the co-ordinate arrays, Exponential - * Rational Shape Controller, and the tension. - */ - - TensionBasisHat[] aTBHCubicRationalExponential = BasisHatPairGenerator.ProcessedCubicRationalHatPair ( - BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_EXPONENTIAL, - adblPredictorOrdinate[0], - adblPredictorOrdinate[1], - adblPredictorOrdinate[2], - 2, - 1. - ); - - /* - * Implement and test the basis monic spline function using the constructed Processed Cubic Rational - * Tension Hat Pair and the Rational Exponential Shape Controller. - */ - - TestMonicHatBasis ( - BasisHatPairGenerator.PROCESSED_CUBIC_RATIONAL, - BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_EXPONENTIAL, - aTBHCubicRationalExponential, - adblPredictorOrdinate, - " CUBIC EXP RATIONAL " - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - BasisMonicBSplineSample(); - } -} diff --git a/org/drip/sample/spline/BasisMonicHatComparison.java b/org/drip/sample/spline/BasisMonicHatComparison.java deleted file mode 100644 index 3818f9a..0000000 --- a/org/drip/sample/spline/BasisMonicHatComparison.java +++ /dev/null @@ -1,255 +0,0 @@ - -package org.drip.sample.spline; - -import org.drip.spline.bspline.*; -import org.drip.quant.common.FormatUtil; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * BasisMonicBSpline implements the comparison of the basis hat functions used in the construction of the - * monic basis B Splines. It demonstrates the following: - * - Construction of the Linear Cubic Rational Raw Hat Functions - * - Construction of the Quadratic Cubic Rational Raw Hat Functions - * - Construction of the Corresponding Processed Tension Basis Hat Functions - * - Construction of the Wrapping Monic Functions - * - Estimation and Comparison of the Ordered Derivatives - * - * @author Lakshmi Krishnamurthy - */ - -public class BasisMonicHatComparison { - - /* - * This sample display the test of the different shape controller functions. It demonstrates the - * following: - * - Construct the Raw Cubic rational left Tension Basis using the specified shape controller and - * tension. - * - Construct the Raw Cubic rational right Tension Basis using the specified shape controller and - * tension. - * - Construct the processed Cubic rational left Tension Basis using the Raw Cubic rational left Tension - * Basis. - * - Construct the processed Cubic rational Right Tension Basis using the Raw Cubic rational Right - * Tension Basis. - * - Construct the Segment Monic Basis Function using the left and the right processed hat functions. - * - Display the response and the derivatives for the left/right cubic rational, and their corresponding - * processed tension hat basis functions. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void ShapeControllerTest ( - final String strShapeController, - final double dblTension) - throws Exception - { - /* - * Construct the Raw Cubic rational left Tension Basis using the specified shape controller and - * tension. - */ - - CubicRationalLeftRaw crlr = new CubicRationalLeftRaw ( - 1., - 2., - strShapeController, - dblTension - ); - - /* - * Construct the Raw Cubic rational right Tension Basis using the specified shape controller and - * tension. - */ - - CubicRationalRightRaw crrr = new CubicRationalRightRaw ( - 2., - 3., - strShapeController, - dblTension - ); - - /* - * Construct the processed Cubic rational left Tension Basis using the Raw Cubic rational left - * Tension Basis. - */ - - TensionProcessedBasisHat tpbhLeft = new TensionProcessedBasisHat ( - crlr, - 2 - ); - - /* - * Construct the processed Cubic rational right Tension Basis using the Raw Cubic rational Right - * Tension Basis. - */ - - TensionProcessedBasisHat tpbhRight = new TensionProcessedBasisHat ( - crrr, - 2 - ); - - /* - * Construct the Segment Monic Basis Function using the left and the right processed hat functions. - */ - - SegmentMonicBasisFunction smbf = new SegmentMonicBasisFunction ( - tpbhLeft, - tpbhRight - ); - - /* - * Display the response and the derivatives for the left/right cubic rational, and their - * corresponding processed tension hat basis functions. - */ - - double dblX = crlr.left(); - - while (dblX <= crrr.right()) { - System.out.println ("\tDeriv[" + dblX + "] => " + - FormatUtil.FormatDouble (smbf.derivative (dblX, 1), 1, 5, 1.)); - - System.out.println ("\t\tCubic Rational Left Deriv[" + dblX + "] => " + - FormatUtil.FormatDouble (crlr.derivative (dblX, 3), 1, 5, 1.)); - - System.out.println ("\t\tCubic Rational Right Deriv[" + dblX + "] => " + - FormatUtil.FormatDouble (crrr.derivative (dblX, 3), 1, 5, 1.)); - - System.out.println ("\t\tTPBH Left Deriv[" + dblX + "] => " + - FormatUtil.FormatDouble (tpbhLeft.derivative (dblX, 1), 1, 5, 1.)); - - System.out.println ("\t\tTPBH Right Deriv[" + dblX + "] => " + - FormatUtil.FormatDouble (tpbhRight.derivative (dblX, 1), 1, 5, 1.)); - - dblX += 0.5; - } - } - - /* - * Sample illustrating the construction and usage of different monic basis hat shape controllers. This - * example illustrates the following: - * - Test Rational Linear Shape Control with 0.0 Tension Parameter (i.e., no shape control). - * - Test Rational Linear Shape Control with 1.0 Tension Parameter. - * - Test Rational Quadratic Shape Control with 1.0 Tension Parameter. - * - Test Exponential Shape Control with 1.0 Tension Parameter. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void BasisMonicHatComparisonSample() - throws Exception - { - /* - * Test Rational Linear Shape Control with 0.0 Tension Parameter (i.e., no shape control) - */ - - System.out.println ("\n-------------------------------------------------------------------"); - - System.out.println ("----------------- NO SHAPE CONTROL --------------------------------"); - - System.out.println ("-------------------------------------------------------------------"); - - ShapeControllerTest ( - BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_LINEAR, - 0. - ); - - /* - * Test Rational Linear Shape Control with 1.0 Tension Parameter - */ - - System.out.println ("\n-------------------------------------------------------------------"); - - System.out.println ("----------------- LINEAR SHAPE CONTROL; Tension 1.0 ---------------"); - - System.out.println ("-------------------------------------------------------------------"); - - ShapeControllerTest ( - BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_LINEAR, - 1. - ); - - /* - * Test Rational Quadratic Shape Control with 1.0 Tension Parameter - */ - - System.out.println ("\n-------------------------------------------------------------------"); - - System.out.println ("-------------- QUADRATIC SHAPE CONTROL; Tension 1.0 ---------------"); - - System.out.println ("-------------------------------------------------------------------"); - - ShapeControllerTest ( - BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_QUADRATIC, - 1. - ); - - /* - * Test Exponential Shape Control with 1.0 Tension Parameter - */ - - System.out.println ("\n-------------------------------------------------------------------"); - - System.out.println ("-------------- EXPONENTIAL SHAPE CONTROL; Tension 1.0 ---------------"); - - System.out.println ("-------------------------------------------------------------------"); - - ShapeControllerTest ( - BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_EXPONENTIAL, - 1. - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - BasisMonicHatComparisonSample(); - } -} diff --git a/org/drip/sample/spline/BasisMulticBSpline.java b/org/drip/sample/spline/BasisMulticBSpline.java deleted file mode 100644 index d34467f..0000000 --- a/org/drip/sample/spline/BasisMulticBSpline.java +++ /dev/null @@ -1,356 +0,0 @@ - -package org.drip.sample.spline; - -import org.drip.spline.bspline.*; -import org.drip.quant.common.FormatUtil; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * BasisMulticBSpline implements Samples for the Construction and the usage of various multic basis B Splines. - * It demonstrates the following: - * - Construction of segment higher order B Spline from the corresponding Hat Basis Functions. - * - Estimation of the derivatives and the basis envelope cumulative integrands. - * - Estimation of the normalizer and the basis envelope cumulative normalized integrands. - * - * @author Lakshmi Krishnamurthy - */ - -public class BasisMulticBSpline { - - /* - * This sample illustrates the construction and the usage of multic basis functions, and their eventual - * response/derivative computation and comparison with the corresponding raw/processed and monic basis. - * It shows the following: - * - Construct the hyperbolic tension basis hat pair using the left predictor ordinates and the tension. - * - Construct the hyperbolic tension basis hat pair using the right predictor ordinates and the - * tension. - * - Generate the left monic basis function from the hat type, left predictor ordinates, shape control, - * and the tension parameters. - * - Generate the right monic basis function from the hat type, right predictor ordinates, shape - * control, and the tension parameters. - * - Run a response value calculation comparison across the predictor ordinates for each of the left - * basis hat and the monic basis functions. - * - Run a response value calculation comparison across the predictor ordinates for each of the right - * basis hat and the monic basis functions. - * - Construct a multic basis function using the left/right monic basis functions, and the multic order. - * - Display the multic Basis Function response as well as normalized Cumulative across the specified - * variate range. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void RunMulticBSplineTest ( - final String strHatType, - final String strShapeControlType, - final double dblTension, - final int iMulticBSplineOrder) - throws Exception - { - double[] adblPredictorOrdinateLeft = new double[] { - 1., 2., 3. - }; - double[] adblPredictorOrdinateRight = new double[] { - 2., 3., 4. - }; - - /* - * Construct the hyperbolic tension basis hat pair using the left predictor ordinates and the - * tension. - */ - - TensionBasisHat[] aTBHLeft = BasisHatPairGenerator.HyperbolicTensionHatPair ( - adblPredictorOrdinateLeft[0], - adblPredictorOrdinateLeft[1], - adblPredictorOrdinateLeft[2], - dblTension - ); - - /* - * Construct the hyperbolic tension basis hat pair using the right predictor ordinates and the - * tension. - */ - - TensionBasisHat[] aTBHRight = BasisHatPairGenerator.HyperbolicTensionHatPair ( - adblPredictorOrdinateRight[0], - adblPredictorOrdinateRight[1], - adblPredictorOrdinateRight[2], - dblTension - ); - - /* - * Generate the left monic basis function from the hat type, left predictor ordinates, shape control, - * and the tension parameters. - */ - - SegmentBasisFunction sbfMonicLeft = SegmentBasisFunctionGenerator.Monic ( - strHatType, - strShapeControlType, - adblPredictorOrdinateLeft, - 2, - dblTension - ); - - /* - * Generate the right monic basis function from the hat type, right predictor ordinates, shape - * control, and the tension parameters. - */ - - SegmentBasisFunction sbfMonicRight = SegmentBasisFunctionGenerator.Monic ( - strHatType, - strShapeControlType, - adblPredictorOrdinateRight, - 2, - dblTension - ); - - /* - * Run a response value calculation comparison across the predictor ordinates for each of the left - * basis hat and the monic basis functions. - */ - - System.out.println ("\n\t-------------------------------------------------"); - - System.out.println ("\t X | LEFT | RIGHT | MONIC "); - - System.out.println ("\t-------------------------------------------------"); - - double dblX = 0.50; - double dblXIncrement = 0.25; - - while (dblX <= 4.50) { - System.out.println ( - "\tResponse[" + FormatUtil.FormatDouble (dblX, 1, 3, 1.) + "] : " + - FormatUtil.FormatDouble (aTBHLeft[0].evaluate (dblX), 1, 5, 1.) + " | " + - FormatUtil.FormatDouble (aTBHLeft[1].evaluate (dblX), 1, 5, 1.) + " | " + - FormatUtil.FormatDouble (sbfMonicLeft.evaluate (dblX), 1, 5, 1.) - ); - - dblX += dblXIncrement; - } - - /* - * Run a response value calculation comparison across the predictor ordinates for each of the right - * basis hat and the monic basis functions. - */ - - System.out.println ("\n\t-------------------------------------------------"); - - System.out.println ("\t X | LEFT | RIGHT | MONIC "); - - System.out.println ("\t-------------------------------------------------"); - - dblX = 0.50; - - while (dblX <= 4.50) { - System.out.println ( - "\tResponse[" + FormatUtil.FormatDouble (dblX, 1, 3, 1.) + "] : " + - FormatUtil.FormatDouble (aTBHRight[0].evaluate (dblX), 1, 5, 1.) + " | " + - FormatUtil.FormatDouble (aTBHRight[1].evaluate (dblX), 1, 5, 1.) + " | " + - FormatUtil.FormatDouble (sbfMonicRight.evaluate (dblX), 1, 5, 1.) - ); - - dblX += dblXIncrement; - } - - /* - * Construct a multic basis function using the left/right monic basis functions, and the multic - * order. - */ - - SegmentBasisFunction[] sbfMultic = SegmentBasisFunctionGenerator.MulticSequence ( - iMulticBSplineOrder, - new SegmentBasisFunction[] { - sbfMonicLeft, - sbfMonicRight - } - ); - - /* - * Display the multic Basis Function response as well as normalized Cumulative across the specified - * variate range. - */ - - System.out.println ("\n\t-------------------------------------------------"); - - System.out.println ("\t PREDICTOR | RESPONSE | CUMULATIVE "); - - System.out.println ("\t-------------------------------------------------"); - - dblX = 0.50; - dblXIncrement = 0.125; - - while (dblX <= 4.50) { - System.out.println ( - "\t\tMultic[" + FormatUtil.FormatDouble (dblX, 1, 3, 1.) + "] : " + - FormatUtil.FormatDouble (sbfMultic[0].evaluate (dblX), 1, 5, 1.) + " | " + - FormatUtil.FormatDouble (sbfMultic[0].normalizedCumulative (dblX), 1, 5, 1.) - ); - - dblX += dblXIncrement; - } - - System.out.println ("\n\t-------------------------------------------------\n"); - } - - /* - * This sample illustrates a sequence of tests using basis multic B Splines. In particular it shows the - * following: - * - Creation and usage of Multic B Spline built off of raw hyperbolic tension basis function, rational - * linear shape controller, tension = 1.0, and 3rd order multic. - * - Creation and usage of Multic B Spline built off of processed hyperbolic tension basis function, - * rational linear shape controller, tension = 1.0, and 3rd order multic. - * - Creation and usage of Multic B Spline built off of raw cubic tension basis function, rational - * linear shape controller, tension = 0.0, and 3rd order multic. - * - Creation and usage of Multic B Spline built off of raw cubic tension basis function, rational - * linear shape controller, tension = 1.0, and 3rd order multic. - * - Creation and usage of Multic B Spline built off of raw cubic tension basis function, rational - * quadratic shape controller, tension = 1.0, and 3rd order multic. - * - Creation and usage of Multic B Spline built off of raw cubic tension basis function, rational - * exponential shape controller, tension = 1.0, and 3rd order multic. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void BasisMulticBSplineSample() - throws Exception - { - /* - * Creation and usage of Multic B Spline built off of raw hyperbolic tension basis function, - * rational linear shape controller, tension = 1.0, and 3rd order multic. - */ - - System.out.println ("\n RAW TENSION HYPERBOLIC | LINEAR SHAPE CONTROL | TENSION = 1.0 | CUBIC B SPLINE"); - - RunMulticBSplineTest ( - BasisHatPairGenerator.RAW_TENSION_HYPERBOLIC, - BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_LINEAR, - 1., - 3 - ); - - /* - * Creation and usage of Multic B Spline built off of processed hyperbolic tension basis function, - * rational linear shape controller, tension = 1.0, and 3rd order multic. - */ - - System.out.println ("\n PROC TENSION HYPERBOLIC | LINEAR SHAPE CONTROL | TENSION = 1.0 | CUBIC B SPLINE"); - - RunMulticBSplineTest ( - BasisHatPairGenerator.PROCESSED_TENSION_HYPERBOLIC, - BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_LINEAR, - 1., - 3 - ); - - /* - * Creation and usage of Multic B Spline built off of raw cubic tension basis function, rational - * linear shape controller, tension = 0.0, and 3rd order multic. - */ - - System.out.println ("\n RAW CUBIC RATIONAL | LINEAR SHAPE CONTROL | TENSION = 0.0 | CUBIC B SPLINE"); - - RunMulticBSplineTest ( - BasisHatPairGenerator.PROCESSED_CUBIC_RATIONAL, - BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_LINEAR, - 0., - 3 - ); - - /* - * Creation and usage of Multic B Spline built off of raw cubic tension basis function, rational - * linear shape controller, tension = 1.0, and 3rd order multic. - */ - - System.out.println ("\n RAW CUBIC RATIONAL | LINEAR SHAPE CONTROL | TENSION = 1.0 | CUBIC B SPLINE"); - - RunMulticBSplineTest ( - BasisHatPairGenerator.PROCESSED_CUBIC_RATIONAL, - BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_LINEAR, - 1., - 3 - ); - - /* - * Creation and usage of Multic B Spline built off of raw cubic tension basis function, rational - * quadratic shape controller, tension = 1.0, and 3rd order multic. - */ - - System.out.println ("\n RAW CUBIC RATIONAL | QUADRATIC SHAPE CONTROL | TENSION = 1.0 | CUBIC B SPLINE"); - - RunMulticBSplineTest ( - BasisHatPairGenerator.PROCESSED_CUBIC_RATIONAL, - BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_QUADRATIC, - 1., - 3 - ); - - /* - * Creation and usage of Multic B Spline built off of raw cubic tension basis function, rational - * exponential shape controller, tension = 1.0, and 3rd order multic. - */ - - System.out.println ("\n RAW CUBIC RATIONAL | EXPONENTIAL SHAPE CONTROL | TENSION = 1.0 | CUBIC B SPLINE"); - - RunMulticBSplineTest ( - BasisHatPairGenerator.PROCESSED_CUBIC_RATIONAL, - BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_EXPONENTIAL, - 1., - 3 - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - BasisMulticBSplineSample(); - } -} diff --git a/org/drip/sample/spline/BasisSplineSet.java b/org/drip/sample/spline/BasisSplineSet.java deleted file mode 100644 index 0b8bb07..0000000 --- a/org/drip/sample/spline/BasisSplineSet.java +++ /dev/null @@ -1,520 +0,0 @@ - -package org.drip.sample.spline; - -import org.drip.function.r1tor1.*; -import org.drip.quant.calculus.WengertJacobian; -import org.drip.spline.basis.*; -import org.drip.spline.params.*; -import org.drip.spline.segment.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * BasisSplineSet implements Samples for the Construction and the usage of various basis spline functions. It - * demonstrates the following: - * - Construction of segment control parameters - polynomial (regular/Bernstein) segment control, - * exponential/hyperbolic tension segment control, Kaklis-Pandelis tension segment control, and C1 - * Hermite. - * - Control the segment using the rational shape controller, and the appropriate Ck. - * - Estimate the node value and the node value Jacobian with the segment, as well as at the boundaries. - * - Calculate the segment monotonicity. - - * @author Lakshmi Krishnamurthy - */ - -public class BasisSplineSet { - - /* - * Sample demonstrating the creation of the polynomial basis spline set - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FunctionSet CreatePolynomialSpline() - throws Exception - { - int iNumBasis = 4; - - /* - * Create the basis parameter set from the number of basis functions, and construct the basis - */ - - PolynomialFunctionSetParams polybsbp = new PolynomialFunctionSetParams (iNumBasis); - - return FunctionSetBuilder.PolynomialBasisSet (polybsbp); - } - - /* - * Sample demonstrating the creation of the Bernstein polynomial basis spline set - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FunctionSet CreateBernsteinPolynomialSpline() - throws Exception - { - int iNumBasis = 4; - - /* - * Create the basis parameter set from the number of basis functions, and construct the basis - */ - - PolynomialFunctionSetParams polybsbp = new PolynomialFunctionSetParams (iNumBasis); - - return FunctionSetBuilder.BernsteinPolynomialBasisSet (polybsbp); - } - - /* - * Sample demonstrating the creation of the exponential tension basis spline set - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FunctionSet CreateExponentialTensionSpline() - throws Exception - { - double dblTension = 1.; - - /* - * Create the basis parameter set from the segment tension parameter, and construct the basis - */ - - ExponentialTensionSetParams etbsbp = new ExponentialTensionSetParams (dblTension); - - return FunctionSetBuilder.ExponentialTensionBasisSet (etbsbp); - } - - /* - * Sample demonstrating the creation of the hyperbolic tension basis spline set - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FunctionSet CreateHyperbolicTensionSpline() - throws Exception - { - double dblTension = 1.; - - /* - * Create the basis parameter set from the segment tension parameter, and construct the basis - */ - - ExponentialTensionSetParams etbsbp = new ExponentialTensionSetParams (dblTension); - - return FunctionSetBuilder.HyperbolicTensionBasisSet (etbsbp); - } - - /* - * Sample demonstrating the creation of the Kaklis Pandelis basis spline set - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FunctionSet CreateKaklisPandelisSpline() - throws Exception - { - int iPolynomialTensionDegree = 2; - - /* - * Create the basis parameter set from the segment polynomial tension control, and construct the basis - */ - - KaklisPandelisSetParams kpbpsp = new KaklisPandelisSetParams (iPolynomialTensionDegree); - - return FunctionSetBuilder.KaklisPandelisBasisSet (kpbpsp); - } - - /* - * This sample demonstrates the following: - * - * - Construction of two segments, 1 and 2. - * - Calibration of the segments to the left and the right node values - * - Extraction of the segment Jacobians and segment monotonicity - * - Estimate point value and the Jacobian - * - Estimate the curvature penalty - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void TestSpline ( - final FunctionSet fs, - final ResponseScalingShapeControl rssc, - final SegmentInelasticDesignControl segParams) - throws Exception - { - /* - * Construct the left and the right segments - */ - - LatentStateResponseModel seg1 = LatentStateResponseModel.Create ( - 1.0, - 1.5, - fs, - rssc, - segParams - ); - - LatentStateResponseModel seg2 = LatentStateResponseModel.Create ( - 1.5, - 2.0, - fs, - rssc, - segParams - ); - - /* - * Calibrate the left segment using the node values, and compute the segment Jacobian, monotonicity, and curvature penalty - */ - - WengertJacobian wj1 = seg1.jackDCoeffDEdgeParams ( - 25., - 0., - 20.25, - null - ); - - System.out.println ("\tY[" + 1.0 + "]: " + seg1.responseValue (1.)); - - System.out.println ("\tY[" + 1.5 + "]: " + seg1.responseValue (1.5)); - - System.out.println ("Segment 1 Jacobian: " + wj1.displayString()); - - System.out.println ("Segment 1 Head: " + seg1.jackDCoeffDEdgeInputs().displayString()); - - System.out.println ("Segment 1 Monotone Type: " + seg1.monotoneType()); - - System.out.println ("Segment 1 DPE: " + seg1.curvatureDPE()); - - /* - * Calibrate the right segment using the node values, and compute the segment Jacobian, monotonicity, and curvature penalty - */ - - WengertJacobian wj2 = seg2.jackDCoeffDEdgeParams ( - seg1, - "Default", - 16., - null, - Double.NaN, - null - ); - - System.out.println ("\tY[" + 1.5 + "]: " + seg2.responseValue (1.5)); - - System.out.println ("\tY[" + 2. + "]: " + seg2.responseValue (2.)); - - System.out.println ("Segment 2 Jacobian: " + wj2.displayString()); - - System.out.println ("Segment 2 Regular Jacobian: " + seg2.jackDCoeffDEdgeInputs().displayString()); - - System.out.println ("Segment 2 Monotone Type: " + seg2.monotoneType()); - - System.out.println ("Segment 2 DPE: " + seg2.curvatureDPE()); - - /* - * Re-calibrate Segment #2 with a different response value - */ - - seg2.calibrate ( - seg1, - 14., - null - ); - - /* - * Estimate the segment value at the given variate, and compute the corresponding Jacobian and curvature penalty - */ - - double dblX = 2.0; - - System.out.println ("\t\tValue[" + dblX + "]: " + seg2.responseValue (dblX)); - - System.out.println ("\t\tValue Jacobian[" + dblX + "]: " + seg2.jackDResponseDEdgeInput (dblX, 1).displayString()); - - System.out.println ("\t\tSegment 2 DPE: " + seg2.curvatureDPE()); - } - - /* - * This sample demonstrates the following specifically for the C1 Hermite Splines, which are calibrated - * using left and right node values, along with their derivatives: - * - * - Construction of two segments, 1 and 2. - * - Calibration of the segments to the left and the right node values - * - Extraction of the segment Jacobians and segment monotonicity - * - Estimate point value and the Jacobian - * - Estimate the curvature penalty - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void TestC1HermiteSpline ( - final FunctionSet fs, - final ResponseScalingShapeControl sc, - final SegmentInelasticDesignControl segParams) - throws Exception - { - /* - * Construct the left and the right segments - */ - - LatentStateResponseModel seg1 = LatentStateResponseModel.Create ( - 0.0, - 1.0, - fs, - sc, - segParams - ); - - LatentStateResponseModel seg2 = LatentStateResponseModel.Create ( - 1.0, - 2.0, - fs, - sc, - segParams - ); - - /* - * Calibrate the left segment using the node values, and compute the segment Jacobian, monotonicity, and curvature penalty - */ - - WengertJacobian wj1 = seg1.jackDCoeffDEdgeParams ( - new double[] {0., 1.}, // Left/Right X - new double[] {1., 4.}, // Left/Right Y - new double[] {1.}, // Left Deriv - new double[] {6.}, // Right Deriv - null, - null // Constraints, Fitness Weighted Response - ); - - System.out.println ("\tY[" + 0.0 + "]: " + seg1.responseValue (0.0)); - - System.out.println ("\tY[" + 1.0 + "]: " + seg1.responseValue (1.0)); - - System.out.println ("Segment 1 Jacobian: " + wj1.displayString()); - - System.out.println ("Segment 1 Head: " + seg1.jackDCoeffDEdgeInputs().displayString()); - - System.out.println ("Segment 1 Monotone Type: " + seg1.monotoneType()); - - System.out.println ("Segment 1 DPE: " + seg1.curvatureDPE()); - - /* - * Calibrate the right segment using the node values, and compute the segment Jacobian, monotonicity, and curvature penalty - */ - - WengertJacobian wj2 = seg2.jackDCoeffDEdgeParams ( - new double[] {1., 2.}, // Left/Right X - new double[] {4., 15.}, // Left/Right Y - new double[] {6.}, // Left Deriv - new double[] {17.}, // Right Deriv - null, - null // Constraints, Fitness Weighted Response - ); - - System.out.println ("\tY[" + 1.0 + "]: " + seg2.responseValue (1.0)); - - System.out.println ("\tY[" + 2.0 + "]: " + seg2.responseValue (2.0)); - - System.out.println ("Segment 2 Jacobian: " + wj2.displayString()); - - System.out.println ("Segment 2 Regular Jacobian: " + seg2.jackDCoeffDEdgeInputs().displayString()); - - System.out.println ("Segment 2 Monotone Type: " + seg2.monotoneType()); - - System.out.println ("Segment 2 DPE: " + seg2.curvatureDPE()); - - /* - * Re-calibrate Segment #2 with a different response value - */ - - seg2.calibrate ( - seg1, - 14., - null - ); - - /* - * Estimate the segment value at the given variate, and compute the corresponding Jacobian, monotonicity, and curvature penalty - */ - - double dblX = 2.0; - - System.out.println ("\t\tValue[" + dblX + "]: " + seg2.responseValue (dblX)); - - System.out.println ("\t\tValue Jacobian[" + dblX + "]: " + seg2.jackDResponseDEdgeInput (dblX, 1).displayString()); - - System.out.println ("\t\tSegment 2 DPE: " + seg2.curvatureDPE()); - } - - /* - * This sample illustrates the construction and the usage of basis splines (all types, really). It shows - * the following: - * - Construct a rational shape controller with the specified shape controller tension. - * - Construct the segment inelastic parameter that is C2 (iK = 2 sets it to C2), with second order - * curvature penalty, and without constraint. - * - Test the polynomial basis spline. - * - Test the Bernstein polynomial basis spline. - * - Test the exponential tension basis spline. - * - Test the hyperbolic tension basis spline. - * - Test the Kaklis-Pandelis basis spline. - * - Test the C1 Hermite basis spline. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void BasisSplineSetSample() - throws Exception - { - /* - * Construct a rational shape controller with the shape controller tension of 1. - */ - - double dblShapeControllerTension = 1.; - - ResponseScalingShapeControl rssc = new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (dblShapeControllerTension) - ); - - /* - * Construct the segment inelastic parameter that is C2 (iK = 2 sets it to C2), with second order - * curvature penalty, and without constraint - */ - - int iK = 2; - int iCurvaturePenaltyDerivativeOrder = 2; - - SegmentInelasticDesignControl segParams = SegmentInelasticDesignControl.Create ( - iK, - iCurvaturePenaltyDerivativeOrder - ); - - /* - * Test the polynomial spline - */ - - System.out.println (" ---------- \n POLYNOMIAL \n ---------- \n"); - - TestSpline ( - CreatePolynomialSpline(), - null, - segParams - ); - - /* - * Test the Bernstein polynomial spline - */ - - System.out.println (" -------------------- \n BERNSTEINPOLYNOMIAL \n -------------------- \n"); - - TestSpline ( - CreateBernsteinPolynomialSpline(), - rssc, - segParams - ); - - /* - * Test the exponential tension spline - */ - - System.out.println ( " ----------- \n EXPONENTIAL \n ----------- \n"); - - TestSpline ( - CreateExponentialTensionSpline(), - rssc, - segParams - ); - - /* - * Test the hyperbolic tension spline - */ - - System.out.println (" ---------- \n HYPERBOLIC \n ---------- \n"); - - TestSpline ( - CreateHyperbolicTensionSpline(), - rssc, - segParams - ); - - /* - * Test the Kaklis-Pandelis spline - */ - - System.out.println (" -------------------- \n KAKLISPANDELIS \n -------------------- \n"); - - TestSpline ( - CreateKaklisPandelisSpline(), - rssc, - segParams - ); - - /* - * Test the C1 Hermite spline - */ - - System.out.println (" -------------------- \n C1 HERMITE \n -------------------- \n"); - - TestC1HermiteSpline ( - CreatePolynomialSpline(), - rssc, - SegmentInelasticDesignControl.Create ( - 1, - iCurvaturePenaltyDerivativeOrder - ) - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - BasisSplineSetSample(); - } -} diff --git a/org/drip/sample/spline/BasisTensionSplineSet.java b/org/drip/sample/spline/BasisTensionSplineSet.java deleted file mode 100644 index d866e11..0000000 --- a/org/drip/sample/spline/BasisTensionSplineSet.java +++ /dev/null @@ -1,359 +0,0 @@ - -package org.drip.sample.spline; - -import org.drip.function.r1tor1.*; -import org.drip.quant.calculus.WengertJacobian; -import org.drip.spline.basis.*; -import org.drip.spline.params.*; -import org.drip.spline.segment.*; -import org.drip.spline.tension.KochLycheKvasovFamily; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * BasisTensionSplineSet implements Samples for the Construction and the usage of various basis spline - * functions. It demonstrates the following: - * - Construction of Kocke-Lyche-Kvasov tension spline segment control parameters - using hyperbolic, - * exponential, rational linear, and rational quadratic primitives. - * - Control the segment using the rational shape controller, and the appropriate Ck. - * - Estimate the node value and the node value Jacobian with the segment, as well as at the boundaries. - * - Calculate the segment monotonicity. - - * @author Lakshmi Krishnamurthy - */ - -public class BasisTensionSplineSet { - - /* - * Sample demonstrating the creation of the KLK Hyperbolic tension basis spline set - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FunctionSet KLKHyperbolicTensionSpline() - throws Exception - { - double dblTension = .01; - - /* - * Create the basis parameter set from the segment tension parameter, and construct the basis - */ - - ExponentialTensionSetParams etbsbp = new ExponentialTensionSetParams (dblTension); - - return KochLycheKvasovFamily.FromHyperbolicPrimitive (etbsbp); - } - - /* - * Sample demonstrating the creation of the KLK Rational Linear tension basis spline set - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FunctionSet KLKRationalLinearTensionSpline() - throws Exception - { - double dblTension = 1.; - - /* - * Create the basis parameter set from the segment tension parameter, and construct the basis - */ - - ExponentialTensionSetParams etbsbp = new ExponentialTensionSetParams (dblTension); - - return KochLycheKvasovFamily.FromRationalLinearPrimitive (etbsbp); - } - - /* - * Sample demonstrating the creation of the KLK Rational Quadratic tension basis spline set - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FunctionSet KLKRationalQuadraticTensionSpline() - throws Exception - { - double dblTension = 1.; - - /* - * Create the basis parameter set from the segment tension parameter, and construct the basis - */ - - ExponentialTensionSetParams etbsbp = new ExponentialTensionSetParams (dblTension); - - return KochLycheKvasovFamily.FromRationalQuadraticPrimitive (etbsbp); - } - - /* - * Sample demonstrating the creation of the KLK Exponential tension basis spline set - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FunctionSet KLKExponentialTensionSpline() - throws Exception - { - double dblTension = 1.; - - /* - * Create the basis parameter set from the segment tension parameter, and construct the basis - */ - - ExponentialTensionSetParams etbsbp = new ExponentialTensionSetParams (dblTension); - - return KochLycheKvasovFamily.FromExponentialPrimitive (etbsbp); - } - - /* - * This sample demonstrates the following: - * - * - Construction of two segments, 1 and 2. - * - Calibration of the segments to the left and the right node values - * - Extraction of the segment Jacobians and segment monotonicity - * - Estimate point value and the Jacobian - * - Estimate the curvature penalty - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void TestSpline ( - final FunctionSet fs, - final ResponseScalingShapeControl rssc, - final SegmentInelasticDesignControl segParams) - throws Exception - { - /* - * Construct the left and the right segments - */ - - LatentStateResponseModel seg1 = LatentStateResponseModel.Create ( - 1.0, - 1.5, - fs, - rssc, - segParams - ); - - LatentStateResponseModel seg2 = LatentStateResponseModel.Create ( - 1.5, - 2.0, - fs, - rssc, - segParams - ); - - /* - * Calibrate the left segment using the node values, and compute the segment Jacobian, the monotonicity, and the curvature penalty - */ - - WengertJacobian wj1 = seg1.jackDCoeffDEdgeParams ( - 25., - 0., - 20.25, - null - ); - - System.out.println ("\tY[" + 1.0 + "]: " + seg1.responseValue (1.)); - - System.out.println ("\tY[" + 1.5 + "]: " + seg1.responseValue (1.5)); - - System.out.println ("Segment 1 Jacobian: " + wj1.displayString()); - - System.out.println ("Segment 1 Head: " + seg1.jackDCoeffDEdgeInputs().displayString()); - - System.out.println ("Segment 1 Monotone Type: " + seg1.monotoneType()); - - System.out.println ("\tSegment 1 DPE: " + seg1.curvatureDPE()); - - /* - * Calibrate the right segment using the node values, and compute the segment Jacobian, the monotonicity, and the curvature penalty - */ - - WengertJacobian wj2 = seg2.jackDCoeffDEdgeParams ( - seg1, - "Default", - 16., - null, - Double.NaN, - null - ); - - System.out.println ("\tY[" + 1.5 + "]: " + seg2.responseValue (1.5)); - - System.out.println ("\tY[" + 2. + "]: " + seg2.responseValue (2.)); - - System.out.println ("Segment 2 Jacobian: " + wj2.displayString()); - - System.out.println ("Segment 2 Regular Jacobian: " + seg2.jackDCoeffDEdgeInputs().displayString()); - - System.out.println ("Segment 2 Monotone Type: " + seg2.monotoneType()); - - System.out.println ("\tSegment 2 DPE: " + seg2.curvatureDPE()); - - /* - * Re-calibrate Segment #2 with a different response value - */ - - seg2.calibrate ( - seg1, - 14., - null - ); - - /* - * Estimate the segment value at the given variate, and compute the corresponding Jacobian and the curvature penalty - */ - - double dblX = 2.0; - - System.out.println ("\t\tValue[" + dblX + "]: " + seg2.responseValue (dblX)); - - System.out.println ("\t\tValue Jacobian[" + dblX + "]: " + seg2.jackDResponseDEdgeInput (dblX, 1).displayString()); - - System.out.println ("\t\tSegment 2 DPE: " + seg2.curvatureDPE()); - } - - /* - * This sample illustrates the construction and the usage of basis splines (all types, really). It shows - * the following: - * - Construct a rational shape controller with the specified shape controller tension. - * - Construct the segment inelastic parameter that is C2 (iK = 2 sets it to C2), with second order - * curvature penalty, and without constraint. - * - Test the KLK Hyperbolic Tension basis tension spline. - * - Test the KLK Rational Linear basis tension spline. - * - Test the KLK Rational Quadratic basis tension spline. - * - Test the KLK Exponential Tension basis tension spline. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void BasisTensionSplineSetSample() - throws Exception - { - /* - * Construct a rational shape controller with the shape controller tension of 1. - */ - - double dblShapeControllerTension = 1.; - - ResponseScalingShapeControl rssc = new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (dblShapeControllerTension) - ); - - /* - * Construct the segment inelastic parameter that is C2 (iK = 2 sets it to C2), with second order - * curvature penalty, and without constraint - */ - - int iK = 2; - int iCurvaturePenaltyDerivativeOrder = 2; - - SegmentInelasticDesignControl segParams = SegmentInelasticDesignControl.Create ( - iK, - iCurvaturePenaltyDerivativeOrder - ); - - /* - * Test the KLK Hyperbolic tension spline - */ - - System.out.println ( " ----------- \n KLK HYPERBOLIC \n ----------- \n"); - - TestSpline ( - KLKHyperbolicTensionSpline(), - rssc, - segParams - ); - - /* - * Test the KLK Rational Linear tension spline - */ - - System.out.println ( " ----------- \n KLK RATIONAL LINEAR \n ----------- \n"); - - TestSpline ( - KLKRationalLinearTensionSpline(), - rssc, - segParams - ); - - /* - * Test the KLK Rational Quadratic tension spline - */ - - System.out.println ( " ----------- \n KLK RATIONAL QUADRATIC \n ----------- \n"); - - TestSpline ( - KLKRationalQuadraticTensionSpline(), - rssc, - segParams - ); - - /* - * Test the KLK Exponential tension spline - */ - - System.out.println ( " ----------- \n KLK EXPONENTIAL \n ----------- \n"); - - TestSpline ( - KLKExponentialTensionSpline(), - rssc, - segParams - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - BasisTensionSplineSetSample(); - } -} diff --git a/org/drip/sample/spline/PolynomialBasisSpline.java b/org/drip/sample/spline/PolynomialBasisSpline.java deleted file mode 100644 index e5e58a1..0000000 --- a/org/drip/sample/spline/PolynomialBasisSpline.java +++ /dev/null @@ -1,426 +0,0 @@ - -package org.drip.sample.spline; - -import org.drip.function.r1tor1.*; -import org.drip.quant.calculus.WengertJacobian; -import org.drip.spline.basis.*; -import org.drip.spline.params.*; -import org.drip.spline.segment.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * PolynomialBasisSpline implements Samples for the Construction and the usage of polynomial (both regular - * and Hermite) basis spline functions. It demonstrates the following: - * - Control the polynomial segment using the rational shape controller, the appropriate Ck, and the basis - * function. - * - Demonstrate the variational shape optimization behavior. - * - Estimate the node value and the node value Jacobian with the segment, as well as at the boundaries. - * - Calculate the segment monotonicity and the curvature penalty. - * - * @author Lakshmi Krishnamurthy - */ - -public class PolynomialBasisSpline { - - /* - * This sample demonstrates the following: - * - * - Construction of two segments, 1 and 2. - * - Calibration of the segments to the left and the right node values - * - Extraction of the segment Jacobians and segment monotonicity - * - Estimate point value and the Jacobian, monotonicity, and curvature penalty - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void TestPolynomialSpline ( - final int iNumBasis, - final int iCk, - final int iRoughnessPenaltyDerivativeOrder, - final ResponseScalingShapeControl rssc) - throws Exception - { - System.out.println (" ------------------------------ \n POLYNOMIAL n = " + iNumBasis + - "; Ck = " + iCk + "\n ------------------------------ \n"); - - /* - * Construct the segment inelastic parameter that is C2 (iCk = 2 sets it to C2), without constraint - */ - - SegmentInelasticDesignControl sdic = SegmentInelasticDesignControl.Create ( - iCk, - iRoughnessPenaltyDerivativeOrder - ); - - /* - * Create the basis parameter set from the number of basis functions, and construct the basis - */ - - PolynomialFunctionSetParams pfsp = new PolynomialFunctionSetParams (iNumBasis); - - FunctionSet fs = FunctionSetBuilder.PolynomialBasisSet (pfsp); - - /* - * Construct the left and the right segments - */ - - LatentStateResponseModel ecs1 = LatentStateResponseModel.Create ( - 1.0, - 1.5, - fs, - rssc, - sdic - ); - - LatentStateResponseModel ecs2 = LatentStateResponseModel.Create ( - 1.5, - 2.0, - fs, - rssc, - sdic - ); - - /* - * Calibrate the left segment using the node values, and compute the segment Jacobian, monotonicity, and curvature penalty - */ - - WengertJacobian wj1 = ecs1.jackDCoeffDEdgeParams ( - 25., - 0., - 20.25, - null - ); - - System.out.println ("\tY[" + 1.0 + "]: " + ecs1.responseValue (1.)); - - System.out.println ("\tY[" + 1.5 + "]: " + ecs1.responseValue (1.5)); - - System.out.println ("Segment 1 Jacobian: " + wj1.displayString()); - - System.out.println ("Segment 1 Head: " + ecs1.jackDCoeffDEdgeInputs().displayString()); - - System.out.println ("Segment 1 Monotone Type: " + ecs1.monotoneType()); - - System.out.println ("Segment 1 DPE: " + ecs1.curvatureDPE()); - - /* - * Calibrate the right segment using the node values, and compute the segment Jacobian, monotonicity, and curvature penalty - */ - - WengertJacobian wj2 = ecs2.jackDCoeffDEdgeParams ( - ecs1, - "Default", - 16., - null, - Double.NaN, - null - ); - - System.out.println ("\tY[" + 1.5 + "]: " + ecs2.responseValue (1.5)); - - System.out.println ("\tY[" + 2. + "]: " + ecs2.responseValue (2.)); - - System.out.println ("Segment 2 Jacobian: " + wj2.displayString()); - - System.out.println ("Segment 2 Regular Jacobian: " + ecs2.jackDCoeffDEdgeInputs().displayString()); - - System.out.println ("Segment 2 Monotone Type: " + ecs2.monotoneType()); - - System.out.println ("Segment 2 DPE: " + ecs2.curvatureDPE()); - - /* - * Re-calibrate Segment #2 with a new Response Value - */ - - ecs2.calibrate ( - ecs1, - 14., - null - ); - - /* - * Estimate the segment value at the given variate, and compute the corresponding Jacobian, and curvature penalty - */ - - double dblX = 2.0; - - System.out.println ("\t\tValue[" + dblX + "]: " + ecs2.responseValue (dblX)); - - System.out.println ("\t\tValue Jacobian[" + dblX + "]: " + ecs2.jackDResponseDEdgeInput (dblX, 1).displayString()); - - System.out.println ("\t\tSegment 2 DPE: " + ecs2.curvatureDPE()); - } - - /* - * This sample demonstrates the following specifically for the Ck Hermite Splines, which are calibrated - * using left and right node values, along with their derivatives: - * - * - Construction of two segments, 1 and 2. - * - Calibration of the segments to the left and the right node values - * - Extraction of the segment Jacobians and segment monotonicity - * - Estimate point value and the Jacobian, monotonicity, and curvature penalty - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void TestC1HermiteSpline ( - final int iNumBasis, - final int iCk, - final int iRoughnessPenaltyDerivativeOrder, - final ResponseScalingShapeControl rssc) - throws Exception - { - System.out.println (" ------------------------------ \n HERMITE POLYNOMIAL n = " + iNumBasis + - "; Ck = " + iCk + "\n ------------------------------ \n"); - - /* - * Construct the segment inelastic parameter that is C2 (iCk = 2 sets it to C2), without constraint - */ - - SegmentInelasticDesignControl sdic = SegmentInelasticDesignControl.Create ( - iCk, - iRoughnessPenaltyDerivativeOrder - ); - - /* - * Create the basis parameter set from the number of basis functions, and construct the basis - */ - - PolynomialFunctionSetParams pfsp = new PolynomialFunctionSetParams (iNumBasis); - - FunctionSet fs = FunctionSetBuilder.PolynomialBasisSet (pfsp); - - /* - * Construct the left and the right segments - */ - - LatentStateResponseModel ecs1 = LatentStateResponseModel.Create ( - 0.0, - 1.0, - fs, - rssc, - sdic - ); - - LatentStateResponseModel ecs2 = LatentStateResponseModel.Create ( - 1.0, - 2.0, - fs, - rssc, - sdic - ); - - /* - * Calibrate the left segment using the node values, and compute the segment Jacobian, monotonicity, and curvature penalty - */ - - ecs1.calibrateState ( - new SegmentStateCalibrationInputs ( - new double[] {0., 1.}, // Segment Calibration Nodes - new double[] {1., 4.}, // Segment Calibration Values - new double[] {1.}, // Segment Left Derivative - new double[] {6.}, // Segment Left Derivative - null, - null // Segment Constraint AND Fitness Penalty Response - ) - ); - - System.out.println ("\tY[" + 0.0 + "]: " + ecs1.responseValue (0.0)); - - System.out.println ("\tY[" + 1.0 + "]: " + ecs1.responseValue (1.0)); - - System.out.println ("Segment 1 Head: " + ecs1.jackDCoeffDEdgeInputs().displayString()); - - System.out.println ("Segment 1 Monotone Type: " + ecs1.monotoneType()); - - System.out.println ("Segment 1 DPE: " + ecs1.curvatureDPE()); - - /* - * Calibrate the right segment using the node values, and compute the segment Jacobian, monotonicity, and curvature penalty - */ - - ecs2.calibrateState ( - new SegmentStateCalibrationInputs ( - new double[] {1., 2.}, // Segment Calibration Nodes - new double[] {4., 15.}, // Segment Calibration Values - new double[] {6.}, // Segment Left Derivative - new double[] {17.}, // Segment Left Derivative - null, // Segment Constraint - null // Fitness Penalty Response - ) - ); - - System.out.println ("\tY[" + 1.0 + "]: " + ecs2.responseValue (1.0)); - - System.out.println ("\tY[" + 2.0 + "]: " + ecs2.responseValue (2.0)); - - System.out.println ("Segment 2 Regular Jacobian: " + ecs2.jackDCoeffDEdgeInputs().displayString()); - - System.out.println ("Segment 2 Monotone Type: " + ecs2.monotoneType()); - - System.out.println ("Segment 2 DPE: " + ecs2.curvatureDPE()); - - /* - * Re-calibrate Segment #2 with a new Response Value - */ - - ecs2.calibrate ( - ecs1, - 14., - null - ); - - /* - * Estimate the segment value at the given variate, and compute the corresponding Jacobian, monotonicity, and curvature penalty - */ - - double dblX = 2.0; - - System.out.println ("\t\tValue[" + dblX + "]: " + ecs2.responseValue (dblX)); - - System.out.println ("\t\tValue Jacobian[" + dblX + "]: " + ecs2.jackDResponseDEdgeInput (dblX, 1).displayString()); - - System.out.println ("\t\tSegment 2 DPE: " + ecs2.curvatureDPE()); - } - - /* - * This sample illustrates the construction and usage for polynomial basis splines. It shows the - * following: - * - Construct a rational shape controller with the specified shape controller tension. - * - Set the Roughness Penalty to 2nd order Roughness Penalty Derivative Order. - * - Test the polynomial spline across different polynomial degrees and Ck's. - * - Test the C1 Hermite spline. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final void PolynomialBasisSplineSample() - throws Exception - { - /* - * Construct a rational shape controller with the shape controller tension of 1. - */ - - double dblShapeControllerTension = 1.; - - ResponseScalingShapeControl rssc = new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (dblShapeControllerTension) - ); - - /* - * Set to 2nd order Roughness Penalty Derivative Order. - */ - - int iRoughnessPenaltyDerivativeOrder = 2; - - /* - * Test the polynomial spline across different polynomial degrees and Ck's - */ - - TestPolynomialSpline (2, 0, iRoughnessPenaltyDerivativeOrder, rssc); - - TestPolynomialSpline (3, 0, iRoughnessPenaltyDerivativeOrder, rssc); - - TestPolynomialSpline (3, 1, iRoughnessPenaltyDerivativeOrder, rssc); - - TestPolynomialSpline (4, 0, iRoughnessPenaltyDerivativeOrder, rssc); - - TestPolynomialSpline (4, 1, iRoughnessPenaltyDerivativeOrder, rssc); - - TestPolynomialSpline (4, 2, iRoughnessPenaltyDerivativeOrder, rssc); - - TestPolynomialSpline (5, 0, iRoughnessPenaltyDerivativeOrder, rssc); - - TestPolynomialSpline (5, 1, iRoughnessPenaltyDerivativeOrder, rssc); - - TestPolynomialSpline (5, 2, iRoughnessPenaltyDerivativeOrder, rssc); - - TestPolynomialSpline (5, 3, iRoughnessPenaltyDerivativeOrder, rssc); - - TestPolynomialSpline (6, 0, iRoughnessPenaltyDerivativeOrder, rssc); - - TestPolynomialSpline (6, 1, iRoughnessPenaltyDerivativeOrder, rssc); - - TestPolynomialSpline (6, 2, iRoughnessPenaltyDerivativeOrder, rssc); - - TestPolynomialSpline (6, 3, iRoughnessPenaltyDerivativeOrder, rssc); - - TestPolynomialSpline (6, 4, iRoughnessPenaltyDerivativeOrder, rssc); - - TestPolynomialSpline (7, 0, iRoughnessPenaltyDerivativeOrder, rssc); - - TestPolynomialSpline (7, 1, iRoughnessPenaltyDerivativeOrder, rssc); - - TestPolynomialSpline (7, 2, iRoughnessPenaltyDerivativeOrder, rssc); - - TestPolynomialSpline (7, 3, iRoughnessPenaltyDerivativeOrder, rssc); - - TestPolynomialSpline (7, 4, iRoughnessPenaltyDerivativeOrder, rssc); - - TestPolynomialSpline (7, 5, iRoughnessPenaltyDerivativeOrder, rssc); - - /* - * Test the C1 Hermite spline - */ - - System.out.println (" -------------------- \n Ck HERMITE \n -------------------- \n"); - - TestC1HermiteSpline (4, 1, iRoughnessPenaltyDerivativeOrder, rssc); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - PolynomialBasisSplineSample(); - } -} diff --git a/org/drip/sample/statistics/MultivariateSequence.java b/org/drip/sample/statistics/MultivariateSequence.java deleted file mode 100644 index abb4e56..0000000 --- a/org/drip/sample/statistics/MultivariateSequence.java +++ /dev/null @@ -1,154 +0,0 @@ - -package org.drip.sample.statistics; - -import org.drip.feed.loader.*; -import org.drip.measure.statistics.MultivariateMoments; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * UnivariateSequence demonstrates the Generation of the Statistical Measures for the Input Series of - * Univariate Sequences. - * - * @author Lakshmi Krishnamurthy - */ - -public class MultivariateSequence { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strSeriesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\MeanVarianceOptimizer\\FormattedSeries1.csv"; - - CSVGrid csvGrid = CSVParser.NamedStringGrid (strSeriesLocation); - - String[] astrVariateHeader = csvGrid.headers(); - - String[] astrVariateName = new String[astrVariateHeader.length - 1]; - double[][] aadblVariateSample = new double[astrVariateHeader.length - 1][]; - - for (int i = 0; i < astrVariateName.length; ++i) { - astrVariateName[i] = astrVariateHeader[i + 1]; - - aadblVariateSample[i] = csvGrid.doubleArrayAtColumn (i + 1); - } - - MultivariateMoments mvm = MultivariateMoments.Standard ( - astrVariateName, - aadblVariateSample - ); - - System.out.println ("\n\n\t|-------------------------------------------------------------------||"); - - for (int i = 0; i < astrVariateName.length; ++i) - System.out.println ( - "\t| Mean/Variance/Standard Deviation [" + astrVariateName[i] + "] => " + - FormatUtil.FormatDouble (mvm.mean (astrVariateName[i]), 1, 2, 1200.) + "% | " + - FormatUtil.FormatDouble (mvm.variance (astrVariateName[i]), 1, 2, 1200.) + " | " + - FormatUtil.FormatDouble (mvm.variance (astrVariateName[i]), 1, 2, 100. * Math.sqrt (12)) + "% ||" - ); - - System.out.println ("\t|-------------------------------------------------------------------||\n\n"); - - System.out.println ("\n\n\t|------------------------------------------------------||"); - - String strHeader = "\t| |"; - - for (int i = 0; i < astrVariateName.length; ++i) - strHeader += " " + astrVariateName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------||"); - - for (int i = 0; i < astrVariateName.length; ++i) { - String strDump = "\t| " + astrVariateName[i] + " "; - - for (int j = 0; j < astrVariateName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble ( - mvm.covariance ( - astrVariateName[i], - astrVariateName[j] - ), 1, 2, 1200.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------||\n\n"); - - System.out.println ("\n\n\t|------------------------------------------------------||"); - - strHeader = "\t| |"; - - for (int i = 0; i < astrVariateName.length; ++i) - strHeader += " " + astrVariateName[i] + " |"; - - System.out.println (strHeader + "|"); - - System.out.println ("\t|------------------------------------------------------||"); - - for (int i = 0; i < astrVariateName.length; ++i) { - String strDump = "\t| " + astrVariateName[i] + " "; - - for (int j = 0; j < astrVariateName.length; ++j) - strDump += "|" + FormatUtil.FormatDouble ( - mvm.correlation ( - astrVariateName[i], - astrVariateName[j] - ), 1, 2, 1.) + " "; - - System.out.println (strDump + "||"); - } - - System.out.println ("\t|------------------------------------------------------||\n\n"); - } -} diff --git a/org/drip/sample/statistics/UnivariateSequence.java b/org/drip/sample/statistics/UnivariateSequence.java deleted file mode 100644 index a66929e..0000000 --- a/org/drip/sample/statistics/UnivariateSequence.java +++ /dev/null @@ -1,162 +0,0 @@ - -package org.drip.sample.statistics; - -import org.drip.feed.loader.*; -import org.drip.measure.statistics.UnivariateMoments; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * UnivariateSequence demonstrates the Generation of the Statistical Measures for the Input Series of - * Univariate Sequences. - * - * @author Lakshmi Krishnamurthy - */ - -public class UnivariateSequence { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strSeriesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\MeanVarianceOptimizer\\FormattedSeries1.csv"; - - CSVGrid csvGrid = CSVParser.NamedStringGrid (strSeriesLocation); - - UnivariateMoments mvTOK = UnivariateMoments.Standard ( - csvGrid.header (1), - csvGrid.doubleArrayAtColumn (1) - ); - - UnivariateMoments mvEWJ = UnivariateMoments.Standard ( - csvGrid.header (2), - csvGrid.doubleArrayAtColumn (2) - ); - - UnivariateMoments mvHYG = UnivariateMoments.Standard ( - csvGrid.header (3), - csvGrid.doubleArrayAtColumn (3) - ); - - UnivariateMoments mvLQD = UnivariateMoments.Standard ( - csvGrid.header (4), - csvGrid.doubleArrayAtColumn (4) - ); - - UnivariateMoments mvEMD = UnivariateMoments.Standard ( - csvGrid.header (5), - csvGrid.doubleArrayAtColumn (5) - ); - - UnivariateMoments mvGSG = UnivariateMoments.Standard ( - csvGrid.header (6), - csvGrid.doubleArrayAtColumn (6) - ); - - UnivariateMoments mvBWX = UnivariateMoments.Standard ( - csvGrid.header (7), - csvGrid.doubleArrayAtColumn (7) - ); - - System.out.println ("\n\t|----------------------------||"); - - System.out.println ( - "\t| " + mvTOK.name() + " | " + - FormatUtil.FormatDouble (mvTOK.mean(), 1, 2, 1200) + "% | " + - FormatUtil.FormatDouble (mvTOK.stdDev(), 2, 1, 100 * Math.sqrt (12)) + "% | " + - mvTOK.numSample() + " ||" - ); - - System.out.println ( - "\t| " + mvEWJ.name() + " | " + - FormatUtil.FormatDouble (mvEWJ.mean(), 1, 2, 1200) + "% | " + - FormatUtil.FormatDouble (mvEWJ.stdDev(), 2, 1, 100 * Math.sqrt (12)) + "% | " + - mvEWJ.numSample() + " ||" - ); - - System.out.println ( - "\t| " + mvHYG.name() + " | " + - FormatUtil.FormatDouble (mvHYG.mean(), 1, 2, 1200) + "% | " + - FormatUtil.FormatDouble (mvHYG.stdDev(), 2, 1, 100 * Math.sqrt (12)) + "% | " + - mvHYG.numSample() + " ||" - ); - - System.out.println ( - "\t| " + mvLQD.name() + " | " + - FormatUtil.FormatDouble (mvLQD.mean(), 1, 2, 1200) + "% | " + - FormatUtil.FormatDouble (mvLQD.stdDev(), 2, 1, 100 * Math.sqrt (12)) + "% | " + - mvLQD.numSample() + " ||" - ); - - System.out.println ( - "\t| " + mvEMD.name() + " | " + - FormatUtil.FormatDouble (mvEMD.mean(), 1, 2, 1200) + "% | " + - FormatUtil.FormatDouble (mvEMD.stdDev(), 2, 1, 100 * Math.sqrt (12)) + "% | " + - mvEMD.numSample() + " ||" - ); - - System.out.println ( - "\t| " + mvGSG.name() + " | " + - FormatUtil.FormatDouble (mvGSG.mean(), 1, 2, 1200) + "% | " + - FormatUtil.FormatDouble (mvGSG.stdDev(), 2, 1, 100 * Math.sqrt (12)) + "% | " + - mvGSG.numSample() + " ||" - ); - - System.out.println ( - "\t| " + mvBWX.name() + " | " + - FormatUtil.FormatDouble (mvBWX.mean(), 1, 2, 1200) + "% | " + - FormatUtil.FormatDouble (mvBWX.stdDev(), 2, 1, 100 * Math.sqrt (12)) + "% | " + - mvBWX.numSample() + " ||" - ); - - System.out.println ("\t|----------------------------||\n"); - } -} diff --git a/org/drip/sample/stochasticvolatility/AlbrecherMayerSchoutensTistaert.java b/org/drip/sample/stochasticvolatility/AlbrecherMayerSchoutensTistaert.java deleted file mode 100644 index fa84670..0000000 --- a/org/drip/sample/stochasticvolatility/AlbrecherMayerSchoutensTistaert.java +++ /dev/null @@ -1,166 +0,0 @@ - -package org.drip.sample.stochasticvolatility; - -import org.drip.param.pricer.HestonOptionPricerParams; -import org.drip.pricer.option.Greeks; -import org.drip.pricer.option.HestonStochasticVolatilityAlgorithm; -import org.drip.quant.common.FormatUtil; -import org.drip.quant.fourier.PhaseAdjuster; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * AlbrecherMayerSchoutensTistaert displays the Heston (1993) Price/Vol Surface across the Range of Strikes - * and Maturities, demonstrating the smiles and the skews. It also runs a Robustness Comparison Run using - * the Methodology of Albrecher, Mayer, Schoutens, and Tistaert (2007). - * - * @author Lakshmi Krishnamurthy - */ - -public class AlbrecherMayerSchoutensTistaert { - private static final double CallPrice ( - final double dblATMFactor, - final double dblTimeToExpiry, - final int iPayoffTransformScheme) - throws Exception - { - double dblRho = 0.3; - double dblKappa = 1.; - double dblSigma = 0.5; - double dblTheta = 0.2; - double dblLambda = 0.; - - HestonOptionPricerParams fphp = new HestonOptionPricerParams ( - iPayoffTransformScheme, - dblRho, - dblKappa, - dblSigma, - dblTheta, - dblLambda, - PhaseAdjuster.MULTI_VALUE_BRANCH_POWER_PHASE_TRACKER_KAHL_JACKEL - ); - - HestonStochasticVolatilityAlgorithm hsva = new HestonStochasticVolatilityAlgorithm (fphp); - - double dblStrike = dblATMFactor; - double dblRiskFreeRate = 0.0; - double dblSpot = 1.; - double dblInitialVolatility = 0.1; - - Greeks greeks = hsva.greeks ( - dblStrike, - dblTimeToExpiry, - dblRiskFreeRate, - dblSpot, - false, - false, - dblInitialVolatility - ); - - return greeks.price(); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - double[] adblATMFactor = new double[] { - 0.8, 0.9, 1.0, 1.1, 1.2 - }; - double[] adblTTE = new double[] { - 0.5, 1., 2., 3., 4., 5., 7., 10., 12., 15., 20., 25., 30. - }; - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------------------------------------------|"); - - System.out.println ("\t\t\t---- HESTON 1993 TRANSFORM ----"); - - System.out.print ("\t|------------------------------------------------------------------------------------------------------------------------------------|\n\t| ATM/TTE =>"); - - for (double dblTTE : adblTTE) - System.out.print (" " + FormatUtil.FormatDouble (dblTTE, 2, 2, 1.) + " "); - - System.out.println (" |\n\t|------------------------------------------------------------------------------------------------------------------------------------|"); - - for (double dblATMFactor : adblATMFactor) { - System.out.print ("\t| " + FormatUtil.FormatDouble (dblATMFactor, 2, 2, 1.) + " =>"); - - for (double dblTTE : adblTTE) - System.out.print (" " + FormatUtil.FormatDouble (CallPrice (dblATMFactor, dblTTE, - HestonStochasticVolatilityAlgorithm.PAYOFF_TRANSFORM_SCHEME_HESTON_1993), 1, 4, 1.)); - - System.out.print (" |\n"); - } - - System.out.println (" \t|------------------------------------------------------------------------------------------------------------------------------------|"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------------------------------------------|"); - - System.out.println ("\t\t\t---- ALBRECHER, MAYER, SCHOUTENS, TISTAERT 2007 TRANSFORM ----"); - - System.out.print ("\t|------------------------------------------------------------------------------------------------------------------------------------|\n\t| ATM/TTE =>"); - - for (double dblTTE : adblTTE) - System.out.print (" " + FormatUtil.FormatDouble (dblTTE, 2, 2, 1.) + " "); - - System.out.println (" |\n\t|------------------------------------------------------------------------------------------------------------------------------------|"); - - for (double dblATMFactor : adblATMFactor) { - System.out.print ("\t| " + FormatUtil.FormatDouble (dblATMFactor, 2, 2, 1.) + " =>"); - - for (double dblTTE : adblTTE) - System.out.print (" " + FormatUtil.FormatDouble (CallPrice (dblATMFactor, dblTTE, - HestonStochasticVolatilityAlgorithm.PAYOFF_TRANSFORM_SCHEME_AMST_2007), 1, 4, 1.)); - - System.out.print (" |\n"); - } - - System.out.println (" \t|------------------------------------------------------------------------------------------------------------------------------------|"); - } -} diff --git a/org/drip/sample/stochasticvolatility/CallPriceSplineSurface.java b/org/drip/sample/stochasticvolatility/CallPriceSplineSurface.java deleted file mode 100644 index cc04cd3..0000000 --- a/org/drip/sample/stochasticvolatility/CallPriceSplineSurface.java +++ /dev/null @@ -1,219 +0,0 @@ - -package org.drip.sample.stochasticvolatility; - -import org.drip.analytics.date.*; -import org.drip.analytics.definition.MarketSurface; -import org.drip.param.pricer.HestonOptionPricerParams; -import org.drip.pricer.option.HestonStochasticVolatilityAlgorithm; -import org.drip.quant.common.FormatUtil; -import org.drip.quant.fourier.PhaseAdjuster; -import org.drip.spline.basis.*; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.ScenarioMarketSurfaceBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * CallPriceSplineSurface demonstrates the spline volatility surface generated by a stochastic volatility - * algorithm, i.e., in this case the Heston 1993 algorithm. - * - * @author Lakshmi Krishnamurthy - */ - -public class CallPriceSplineSurface { - - private static final SegmentCustomBuilderControl CubicPolySCBC() - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ); - } - - private static final SegmentCustomBuilderControl KLKHyperbolicSCBC ( - final double dblTension) - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new ExponentialTensionSetParams (dblTension), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ); - } - - private static final void EvaluateSplineSurface ( - final MarketSurface volSurface, - final double[] adblStrikeATMFactor, - final String[] astrMaturityTenor) - throws Exception - { - System.out.println ("\t|------------------------------------------------------------|"); - - System.out.print ("\t|------------------------------------------------------------|\n\t| ATM/TTE =>"); - - for (String strMaturity : astrMaturityTenor) - System.out.print (" " + strMaturity + " "); - - System.out.println (" |\n\t|------------------------------------------------------------|"); - - for (double dblStrike : adblStrikeATMFactor) { - System.out.print ("\t| " + FormatUtil.FormatDouble (dblStrike, 1, 2, 1.) + " =>"); - - for (String strMaturity : astrMaturityTenor) - System.out.print (" " + FormatUtil.FormatDouble (volSurface.node (dblStrike, strMaturity), 2, 2, 100.) + "%"); - - System.out.print (" |\n"); - } - - System.out.println ("\t|------------------------------------------------------------|"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - JulianDate dtStart = DateUtil.Today(); - - double[] adblStrikeATMFactorCalib = new double[] { - 0.8, 0.9, 1.0, 1.1, 1.2 - }; - String[] astrMaturityTenorCalib = new String[] { - "12M", "24M", "36M", "48M", "60M" - }; - - double dblRho = 0.3; - double dblKappa = 1.; - double dblSigma = 0.5; - double dblTheta = 0.2; - double dblLambda = 0.; - - HestonOptionPricerParams hopp = new HestonOptionPricerParams ( - HestonStochasticVolatilityAlgorithm.PAYOFF_TRANSFORM_SCHEME_AMST_2007, - dblRho, - dblKappa, - dblSigma, - dblTheta, - dblLambda, - PhaseAdjuster.MULTI_VALUE_BRANCH_POWER_PHASE_TRACKER_KAHL_JACKEL - ); - - MarketSurface priceSurfCubicPoly = ScenarioMarketSurfaceBuilder.HestonRunMarketSurface ( - "HESTON1993_CUBICPOLY_CALLPRICE_SURFACE", - dtStart, - "USD", - 0.01, - 1., - false, - 0.20, - adblStrikeATMFactorCalib, - astrMaturityTenorCalib, - hopp, - true, - CubicPolySCBC(), - CubicPolySCBC() - ); - - EvaluateSplineSurface ( - priceSurfCubicPoly, - adblStrikeATMFactorCalib, - astrMaturityTenorCalib - ); - - EvaluateSplineSurface ( - priceSurfCubicPoly, - new double[] {0.500, 0.700, 0.850, 1.000, 1.150, 1.300, 1.500}, - new String[] {"06M", "21M", "36M", "51M", "66M"} - ); - - MarketSurface priceSurfKLKHyper = ScenarioMarketSurfaceBuilder.HestonRunMarketSurface ( - "HESTON1993_KLKHYPER_CALLPRICE_SURFACE", - dtStart, - "USD", - 0.01, - 1., - false, - 0.20, - adblStrikeATMFactorCalib, - astrMaturityTenorCalib, - hopp, - true, - KLKHyperbolicSCBC (4.), - KLKHyperbolicSCBC (2.) - ); - - EvaluateSplineSurface ( - priceSurfKLKHyper, - adblStrikeATMFactorCalib, - astrMaturityTenorCalib - ); - - EvaluateSplineSurface ( - priceSurfKLKHyper, - new double[] { - 0.500, 0.700, 0.850, 1.000, 1.150, 1.300, 1.500 - }, - new String[] { - "06M", "21M", "36M", "51M", "66M" - } - ); - } -} diff --git a/org/drip/sample/stochasticvolatility/CallVolSplineSurface.java b/org/drip/sample/stochasticvolatility/CallVolSplineSurface.java deleted file mode 100644 index cab5482..0000000 --- a/org/drip/sample/stochasticvolatility/CallVolSplineSurface.java +++ /dev/null @@ -1,222 +0,0 @@ - -package org.drip.sample.stochasticvolatility; - -import org.drip.analytics.date.*; -import org.drip.analytics.definition.MarketSurface; -import org.drip.param.pricer.HestonOptionPricerParams; -import org.drip.pricer.option.HestonStochasticVolatilityAlgorithm; -import org.drip.quant.common.FormatUtil; -import org.drip.quant.fourier.PhaseAdjuster; -import org.drip.spline.basis.*; -import org.drip.spline.params.*; -import org.drip.spline.stretch.MultiSegmentSequenceBuilder; -import org.drip.state.creator.ScenarioMarketSurfaceBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * CallVolSplineSurface demonstrates the spline volatility surface generator by a stochastic volatility - * algorithm, i.e., in this case the Heston 1993 algorithm. - * - * @author Lakshmi Krishnamurthy - */ - -public class CallVolSplineSurface { - private static final SegmentCustomBuilderControl CubicPolySCBC() - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ); - } - - private static final SegmentCustomBuilderControl KLKHyperbolicSCBC ( - final double dblTension) - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new ExponentialTensionSetParams (dblTension), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ); - } - - private static final void EvaluateSplineSurface ( - final MarketSurface volSurface, - final double[] adblStrikeATMFactor, - final String[] astrMaturityTenor) - throws Exception - { - System.out.println ("\t|------------------------------------------------------------|"); - - System.out.print ("\t|------------------------------------------------------------|\n\t| ATM/TTE =>"); - - for (String strMaturity : astrMaturityTenor) - System.out.print (" " + strMaturity + " "); - - System.out.println (" |\n\t|------------------------------------------------------------|"); - - for (double dblStrike : adblStrikeATMFactor) { - System.out.print ("\t| " + FormatUtil.FormatDouble (dblStrike, 1, 2, 1.) + " =>"); - - for (String strMaturity : astrMaturityTenor) - System.out.print (" " + FormatUtil.FormatDouble (volSurface.node (dblStrike, strMaturity), 2, 2, 100.) + "%"); - - System.out.print (" |\n"); - } - - System.out.println ("\t|------------------------------------------------------------|"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - JulianDate dtStart = DateUtil.Today(); - - double[] adblStrikeATMFactorCalib = new double[] { - 0.8, 0.9, 1.0, 1.1, 1.2 - }; - String[] astrMaturityTenorCalib = new String[] { - "12M", "24M", "36M", "48M", "60M" - }; - - double dblRho = 0.3; - double dblKappa = 1.; - double dblSigma = 0.5; - double dblTheta = 0.2; - double dblLambda = 0.; - - HestonOptionPricerParams hopp = new HestonOptionPricerParams ( - HestonStochasticVolatilityAlgorithm.PAYOFF_TRANSFORM_SCHEME_AMST_2007, - dblRho, - dblKappa, - dblSigma, - dblTheta, - dblLambda, - PhaseAdjuster.MULTI_VALUE_BRANCH_POWER_PHASE_TRACKER_KAHL_JACKEL - ); - - MarketSurface priceSurfCubicPoly = ScenarioMarketSurfaceBuilder.HestonRunMarketSurface ( - "HESTON1993_CUBICPOLY_VOLATILITY_SURFACE", - dtStart, - "USD", - 0.01, - 1., - false, - 0.20, - adblStrikeATMFactorCalib, - astrMaturityTenorCalib, - hopp, - false, - CubicPolySCBC(), - CubicPolySCBC() - ); - - EvaluateSplineSurface ( - priceSurfCubicPoly, - adblStrikeATMFactorCalib, - astrMaturityTenorCalib - ); - - EvaluateSplineSurface ( - priceSurfCubicPoly, - new double[] { - 0.500, 0.700, 0.850, 1.000, 1.150, 1.300, 1.500 - }, - new String[] { - "06M", "21M", "36M", "51M", "66M" - } - ); - - MarketSurface priceSurfKLKHyper = ScenarioMarketSurfaceBuilder.HestonRunMarketSurface ( - "HESTON1993_KLKHYPER_VOLATILITY_SURFACE", - dtStart, - "USD", - 0.01, - 1., - false, - 0.20, - adblStrikeATMFactorCalib, - astrMaturityTenorCalib, - hopp, - false, - KLKHyperbolicSCBC (4.), - KLKHyperbolicSCBC (2.) - ); - - EvaluateSplineSurface ( - priceSurfKLKHyper, - adblStrikeATMFactorCalib, - astrMaturityTenorCalib - ); - - EvaluateSplineSurface ( - priceSurfKLKHyper, - new double[] { - 0.500, 0.700, 0.850, 1.000, 1.150, 1.300, 1.500 - }, - new String[] { - "06M", "21M", "36M", "51M", "66M" - } - ); - } -} diff --git a/org/drip/sample/stochasticvolatility/HestonAMSTPayoffTransform.java b/org/drip/sample/stochasticvolatility/HestonAMSTPayoffTransform.java deleted file mode 100644 index 8f46f43..0000000 --- a/org/drip/sample/stochasticvolatility/HestonAMSTPayoffTransform.java +++ /dev/null @@ -1,157 +0,0 @@ - -package org.drip.sample.stochasticvolatility; - -import org.drip.param.pricer.HestonOptionPricerParams; -import org.drip.pricer.option.Greeks; -import org.drip.pricer.option.HestonStochasticVolatilityAlgorithm; -import org.drip.quant.common.FormatUtil; -import org.drip.quant.fourier.PhaseAdjuster; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * HestonAMSTPayoffTransform contains an Comparison of the two ways of computing the Fourier convolution of - * the terminal payoff - the original Heston (1993) method, and the Albrecher, Mayer, Schoutens, and - * Tistaert tweak (2007). - * - * @author Lakshmi Krishnamurthy - */ - -public class HestonAMSTPayoffTransform { - public static final double TestPayoffScheme ( - final double dblTimeToExpiry, - final int iPayoffTransformScheme, - final boolean bProb1) - throws Exception - { - double dblRho = 0.3; - double dblKappa = 1.; - double dblSigma = 0.5; - double dblTheta = 0.2; - double dblLambda = 0.; - - HestonOptionPricerParams fphp = new HestonOptionPricerParams ( - iPayoffTransformScheme, - dblRho, - dblKappa, - dblSigma, - dblTheta, - dblLambda, - PhaseAdjuster.MULTI_VALUE_BRANCH_POWER_PHASE_TRACKER_KAHL_JACKEL - ); - - HestonStochasticVolatilityAlgorithm hsva = new HestonStochasticVolatilityAlgorithm (fphp); - - double dblStrike = 1.; - double dblRiskFreeRate = 0.0; - double dblSpot = 1.; - double dblSpotVolatility = 0.1; - - Greeks greeks = hsva.greeks ( - dblStrike, - dblTimeToExpiry, - dblRiskFreeRate, - dblSpot, - false, - false, - dblSpotVolatility - ); - - return bProb1 ? greeks.prob1() : greeks.prob2(); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - double[] adblTTE = new double[] { - 0.5, 1., 2., 3., 4., 5., 7., 10., 12., 15., 20., 25., 30. - }; - - System.out.println ("\n\t|---------------------------|"); - - System.out.println ("\t| Prob 1 Comparison |"); - - System.out.println ("\t|---------------------------|"); - - System.out.println ("\t| TTE = HSTN | AMST |"); - - System.out.println ("\t|---------------------------|"); - - for (double dblTTE : adblTTE) { - System.out.println ("\t|" + FormatUtil.FormatDouble (dblTTE, 2, 2, 1.) + " = " + - FormatUtil.FormatDouble (TestPayoffScheme (dblTTE, - HestonStochasticVolatilityAlgorithm.PAYOFF_TRANSFORM_SCHEME_HESTON_1993, true), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (TestPayoffScheme (dblTTE, - HestonStochasticVolatilityAlgorithm.PAYOFF_TRANSFORM_SCHEME_AMST_2007, true), 1, 4, 1.) + " |"); - } - - System.out.println ("\t|---------------------------|"); - - System.out.println ("\n\t|---------------------------|"); - - System.out.println ("\t| Prob 2 Comparison |"); - - System.out.println ("\t|---------------------------|"); - - System.out.println ("\t| TTE = HSTN | AMST |"); - - System.out.println ("\t|---------------------------|"); - - for (double dblTTE : adblTTE) { - System.out.println ("\t|" + FormatUtil.FormatDouble (dblTTE, 2, 2, 1.) + " = " + - FormatUtil.FormatDouble (TestPayoffScheme (dblTTE, - HestonStochasticVolatilityAlgorithm.PAYOFF_TRANSFORM_SCHEME_HESTON_1993, false), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (TestPayoffScheme (dblTTE, - HestonStochasticVolatilityAlgorithm.PAYOFF_TRANSFORM_SCHEME_AMST_2007, false), 1, 4, 1.) + " |"); - } - - System.out.println ("\t|---------------------------|"); - } -} diff --git a/org/drip/sample/stochasticvolatility/StandardHestonPricingMeasures.java b/org/drip/sample/stochasticvolatility/StandardHestonPricingMeasures.java deleted file mode 100644 index 3f99ad9..0000000 --- a/org/drip/sample/stochasticvolatility/StandardHestonPricingMeasures.java +++ /dev/null @@ -1,345 +0,0 @@ - -package org.drip.sample.stochasticvolatility; - -import org.drip.analytics.date.*; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.market.otc.*; -import org.drip.param.pricer.HestonOptionPricerParams; -import org.drip.param.valuation.*; -import org.drip.pricer.option.*; -import org.drip.product.creator.SingleStreamComponentBuilder; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.option.EuropeanCallPut; -import org.drip.product.rates.*; -import org.drip.quant.fourier.PhaseAdjuster; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * StandardHestonPricingMeasures contains an illustration of the Stochastic Volatility based Pricing - * Algorithm of an European Call Using the Heston Algorithm. - * - * @author Lakshmi Krishnamurthy - */ - -public class StandardHestonPricingMeasures { - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Construct the Array of Deposit Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays ( - final JulianDate dtEffective, - final int[] aiDay, - final int iNumFutures, - final String strCurrency) - throws Exception - { - CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFutures]; - - for (int i = 0; i < aiDay.length; ++i) - aCalibComp[i] = SingleStreamComponentBuilder.Deposit ( - dtEffective, - dtEffective.addBusDays ( - aiDay[i], - strCurrency - ), - ForwardLabel.Create ( - strCurrency, - "3M" - ) - ); - - CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack ( - dtEffective, - iNumFutures, - strCurrency - ); - - for (int i = aiDay.length; i < aiDay.length + iNumFutures; ++i) - aCalibComp[i] = aEDF[i - aiDay.length]; - - return aCalibComp; - } - - /* - * Construct the Array of Swap Instruments from the given set of parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor ( - final JulianDate dtSpot, - final String strCurrency, - final String[] astrMaturityTenor, - final double[] adblCoupon) - throws Exception - { - FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length]; - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - FixFloatComponent irs = OTCIRS ( - dtSpot, - strCurrency, - astrMaturityTenor[i], - adblCoupon[i] - ); - - irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency); - - aIRS[i] = irs; - } - - return aIRS; - } - - /* - * Construct the discount curve using the following steps: - * - Construct the array of cash instruments and their quotes. - * - Construct the array of swap instruments and their quotes. - * - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MergedDiscountForwardCurve MakeDC ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - /* - * Construct the array of Deposit instruments and their quotes. - */ - - CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays ( - dtSpot, - new int[] { - 1, 2, 3, 7, 14, 21, 30, 60 - }, - 0, - strCurrency - ); - - double[] adblDepositQuote = new double[] { - 0.01200, 0.01200, 0.01200, 0.01450, 0.01550, 0.01600, 0.01660, 0.01850 - }; - - String[] astrDepositManifestMeasure = new String[] { - "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate", "ForwardRate" - }; - - /* - * Construct the array of Swap instruments and their quotes. - */ - - double[] adblSwapQuote = new double[] { - 0.02604, // 4Y - 0.02808, // 5Y - 0.02983, // 6Y - 0.03136, // 7Y - 0.03268, // 8Y - 0.03383, // 9Y - 0.03488, // 10Y - 0.03583, // 11Y - 0.03668, // 12Y - 0.03833, // 15Y - 0.03854, // 20Y - 0.03672, // 25Y - 0.03510, // 30Y - 0.03266, // 40Y - 0.03145 // 50Y - }; - - String[] astrSwapManifestMeasure = new String[] { - "SwapRate", // 4Y - "SwapRate", // 5Y - "SwapRate", // 6Y - "SwapRate", // 7Y - "SwapRate", // 8Y - "SwapRate", // 9Y - "SwapRate", // 10Y - "SwapRate", // 11Y - "SwapRate", // 12Y - "SwapRate", // 15Y - "SwapRate", // 20Y - "SwapRate", // 25Y - "SwapRate", // 30Y - "SwapRate", // 40Y - "SwapRate" // 50Y - }; - - CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor ( - dtSpot, - strCurrency, - new java.lang.String[] { - "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - adblSwapQuote - ); - - /* - * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments. - */ - - return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver ( - "KLK_HYPERBOLIC_SHAPE_TEMPLATE", - new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ), - aDepositComp, - adblDepositQuote, - astrDepositManifestMeasure, - aSwapComp, - adblSwapQuote, - astrSwapManifestMeasure, - true - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtToday = DateUtil.Today(); - - ValuationParams valParams = new ValuationParams ( - dtToday, - dtToday, - "USD" - ); - - /* - * Construct the Discount Curve using its instruments and quotes - */ - - MergedDiscountForwardCurve dc = MakeDC ( - dtToday, - "USD" - ); - - JulianDate dtMaturity = dtToday.addTenor ("6M"); - - double dblStrike = 1.; - - EuropeanCallPut option = new EuropeanCallPut ( - dtMaturity, - dblStrike - ); - - double dblSpot = 1.; - - double dblRho = 0.3; - double dblKappa = 1.; - double dblSigma = 0.5; - double dblTheta = 0.2; - double dblLambda = 0.; - double dblSpotVolatility = 0.2; - - HestonOptionPricerParams fphp = new HestonOptionPricerParams ( - HestonStochasticVolatilityAlgorithm.PAYOFF_TRANSFORM_SCHEME_HESTON_1993, - dblRho, // Rho - dblKappa, // Kappa - dblSigma, // Sigma - dblTheta, // Theta - dblLambda, // Lambda - PhaseAdjuster.MULTI_VALUE_BRANCH_POWER_PHASE_TRACKER_KAHL_JACKEL // Indicates Apply Phase Tracking Adjustment for Log + Power - ); - - FokkerPlanckGenerator fpg = new HestonStochasticVolatilityAlgorithm ( - fphp // FP Heston Parameters - ); - - System.out.println ( - option.value ( - valParams, - dblSpot, - false, - dc, - new FlatUnivariate (dblSpotVolatility), - fpg - ) - ); - } -} diff --git a/org/drip/sample/stretch/ATMTTESurface2D.java b/org/drip/sample/stretch/ATMTTESurface2D.java deleted file mode 100644 index 52cd8fc..0000000 --- a/org/drip/sample/stretch/ATMTTESurface2D.java +++ /dev/null @@ -1,230 +0,0 @@ - -package org.drip.sample.stretch; - -import java.util.TreeMap; - -import org.drip.quant.common.FormatUtil; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.grid.*; -import org.drip.spline.multidimensional.WireSurfaceStretch; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ATMTTESurface2D demonstrates the Surface 2D ATM/TTE (X/Y) Stretch Construction and usage API. - * - * @author Lakshmi Krishnamurthy - */ - -public class ATMTTESurface2D { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - double[] adblATMFactor = new double[] { - 0.8, 0.9, 1.0, 1.1, 1.2 - }; - double[] adblTTE = new double[] { - 1., 2., 3., 4., 5. - }; - - double[][] aadblImpliedVolatility = new double[][] { - {0.44, 0.38, 0.33, 0.27, 0.25}, - {0.41, 0.34, 0.30, 0.22, 0.27}, - {0.36, 0.31, 0.28, 0.30, 0.37}, - {0.38, 0.31, 0.34, 0.40, 0.47}, - {0.43, 0.46, 0.48, 0.52, 0.57} - }; - - SegmentCustomBuilderControl scbcSpan = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ); - - TreeMap mapSpan = new TreeMap(); - - SegmentCustomBuilderControl[] aSCBCSpan = new SegmentCustomBuilderControl[adblATMFactor.length - 1]; - - for (int i = 0; i < aSCBCSpan.length; ++i) - aSCBCSpan[i] = scbcSpan; - - for (int i = 0; i < adblATMFactor.length; ++i) - mapSpan.put (adblATMFactor[i], new OverlappingStretchSpan ( - MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator ( - "Stretch@" + adblTTE + "@" + org.drip.quant.common.StringUtil.GUID(), - adblTTE, - aadblImpliedVolatility[i], - aSCBCSpan, - null, - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE - ) - ) - ); - - SegmentCustomBuilderControl scbcSurface = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (4), - SegmentInelasticDesignControl.Create ( - 2, - 2 - ), - null, - null - ); - - WireSurfaceStretch ss = new WireSurfaceStretch ( - "SurfaceStretch@" + org.drip.quant.common.StringUtil.GUID(), - scbcSurface, - mapSpan - ); - - System.out.println ("\n\t|------------------------------------------------------------|"); - - System.out.println ("\t|----------------- INPUT SURFACE RECOVERY -----------------|"); - - System.out.print ("\t|------------------------------------------------------------|\n\t| ATM/TTE =>"); - - for (double dblTTE : adblTTE) - System.out.print (" " + FormatUtil.FormatDouble (dblTTE, 1, 2, 1.) + " "); - - System.out.println (" |\n\t|------------------------------------------------------------|"); - - for (double dblATMFactor : adblATMFactor) { - System.out.print ("\t| " + FormatUtil.FormatDouble (dblATMFactor, 1, 2, 1.) + " =>"); - - for (double dblTTE : adblTTE) - System.out.print (" " + - FormatUtil.FormatDouble (ss.responseValue ( - dblATMFactor, - dblTTE - ), 2, 2, 100.) + "%"); - - System.out.print (" |\n"); - } - - System.out.println ("\t|------------------------------------------------------------|"); - - adblATMFactor = new double[] { - 0.850, 0.925, 1.000, 1.075, 1.15 - }; - adblTTE = new double[] { - 1.50, 2.25, 3., 3.75, 4.50 - }; - - System.out.println ("\n\t|------------------------------------------------------------|"); - - System.out.println ("\t|------------- IN-SURFACE RESPONSE CALCULATION --------------|"); - - System.out.print ("\t|------------------------------------------------------------|\n\t| ATM/TTE =>"); - - for (double dblTTE : adblTTE) - System.out.print (" " + FormatUtil.FormatDouble (dblTTE, 1, 2, 1.) + " "); - - System.out.println (" |\n\t|------------------------------------------------------------|"); - - for (double dblATMFactor : adblATMFactor) { - System.out.print ("\t| " + FormatUtil.FormatDouble (dblATMFactor, 1, 2, 1.) + " =>"); - - for (double dblTTE : adblTTE) - System.out.print (" " + - FormatUtil.FormatDouble ( - ss.responseValue ( - dblATMFactor, - dblTTE - ), 2, 2, 100.) + "%"); - - System.out.print (" |\n"); - } - - System.out.println ("\t|------------------------------------------------------------|"); - - adblATMFactor = new double[] { - 0.70, 0.85, 1.00, 1.15, 1.30 - }; - adblTTE = new double[] { - 0.50, 1.75, 3.00, 4.25, 5.50 - }; - - System.out.println ("\n\t|------------------------------------------------------------|"); - - System.out.println ("\t|------------- OFF-SURFACE RESPONSE CALCULATION -------------|"); - - System.out.print ("\t|------------------------------------------------------------|\n\t| ATM/TTE =>"); - - for (double dblTTE : adblTTE) - System.out.print (" " + FormatUtil.FormatDouble (dblTTE, 1, 2, 1.) + " "); - - System.out.println (" |\n\t|------------------------------------------------------------|"); - - for (double dblATMFactor : adblATMFactor) { - System.out.print ("\t| " + FormatUtil.FormatDouble (dblATMFactor, 1, 2, 1.) + " =>"); - - for (double dblTTE : adblTTE) - System.out.print (" " + FormatUtil.FormatDouble ( - ss.responseValue ( - dblATMFactor, - dblTTE - ), 2, 2, 100.) + "%"); - - System.out.print (" |\n"); - } - - System.out.println ("\t|------------------------------------------------------------|"); - } -} diff --git a/org/drip/sample/stretch/CurvatureLengthRoughnessPenalty.java b/org/drip/sample/stretch/CurvatureLengthRoughnessPenalty.java deleted file mode 100644 index 4b754cc..0000000 --- a/org/drip/sample/stretch/CurvatureLengthRoughnessPenalty.java +++ /dev/null @@ -1,368 +0,0 @@ - -package org.drip.sample.stretch; - -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.quant.common.FormatUtil; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * PenalizedCurvatureLCurvatureLengthRoughnessPenaltyengthFit demonstrates the setting up and the usage of - * the curvature, the length, and the closeness of fit penalizing spline. This sample shows the following: - * - Set up the X Predictor Ordinate and the Y Response Value Set. - * - Construct a set of Predictor Ordinates, their Responses, and corresponding Weights to serve as - * weighted closeness of fit. - * - Construct a rational shape controller with the desired shape controller tension parameters and Global - * Scaling. - * - Construct the Segment Inelastic Parameter that is C2 (iK = 2 sets it to C2), with First Order Segment - * Length Penalty Derivative, Second Order Segment Curvature Penalty Derivative, their Amplitudes, and - * without Constraint. - * - Construct the base, the base + 1 degree segment builder control. - * - Construct the base, the elevated, and the best fit basis spline stretches. - * - Compute the segment-by-segment monotonicity for all the three stretches. - * - Compute the Stretch Jacobian for all the three stretches. - * - Compute the Base Stretch Curvature, Length, and the Best Fit DPE. - * - Compute the Elevated Stretch Curvature, Length, and the Best Fit DPE. - * - Compute the Best Fit Stretch Curvature, Length, and the Best Fit DPE. - * - * @author Lakshmi Krishnamurthy - */ - -public class CurvatureLengthRoughnessPenalty { - - /* - * Build Polynomial Segment Control Parameters - * - * WARNING: Insufficient Error Checking, so use caution - */ - - public static final SegmentCustomBuilderControl PolynomialSegmentControlParams ( - final int iNumBasis, - final SegmentInelasticDesignControl sdic, - final ResponseScalingShapeControl rssc) - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (iNumBasis), - sdic, - rssc, - null - ); - } - - /* - * Construct the Basis Spline Stretch Instance using the following inputs: - * - Array of Segment Builder Parameters - one per segment - * - Construct a Calibrated Stretch instance - * - * WARNING: Insufficient Error Checking, so use caution - */ - - public static final MultiSegmentSequence BasisSplineStretchTest ( - final double[] adblX, - final double[] adblY, - final SegmentCustomBuilderControl scbc, - final StretchBestFitResponse rbfr) - throws Exception - { - /* - * Array of Segment Builder Parameters - one per segment - */ - - SegmentCustomBuilderControl[] aSCBC = new SegmentCustomBuilderControl[adblX.length - 1]; - - for (int i = 0; i < adblX.length - 1; ++i) - aSCBC[i] = scbc; - - /* - * Construct a Stretch instance - */ - - return MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator ( - "SPLINE_STRETCH", - adblX, // predictors - adblY, // responses - aSCBC, // Basis Segment Builder parameters - rbfr, // Fitness Weighted Response - BoundarySettings.NaturalStandard(), // Boundary Condition - Natural - MultiSegmentSequence.CALIBRATE // Calibrate the Stretch predictors to the responses - ); - } - - /* - * Illustrate the Penalized Curvature+Length+BestFit Usage Sample. This sample shows the following: - * - Set up the X Predictor Ordinate and the Y Response Value Set. - * - Construct a set of Predictor Ordinates, their Responses, and corresponding Weights to serve as - * weighted closeness of fit. - * - Construct a rational shape controller with the desired shape controller tension parameters and Global Scaling. - * - Construct the Segment Inelastic Parameter that is C2 (iK = 2 sets it to C2), with First Order - * Segment Length Penalty Derivative, Second Order Segment Curvature Penalty Derivative, their - * Amplitudes, and without Constraint. - * - Construct the base, the base + 1 degree segment builder control. - * - Construct the base, the elevated, and the best fit basis spline stretches. - * - Compute the segment-by-segment monotonicity for all the three stretches. - * - Compute the Stretch Jacobian for all the three stretches. - * - Compute the Base Stretch Curvature, Length, and the Best Fit DPE. - * - Compute the Elevated Stretch Curvature, Length, and the Best Fit DPE. - * - Compute the Best Fit Stretch Curvature, Length, and the Best Fit DPE. - */ - - public static final void PenalizedCurvatureLengthFitTest() - throws Exception - { - /* - * X predictors - */ - - double[] adblX = new double[] { 1.00, 1.50, 2.00, 3.00, 4.00, 5.00, 6.50, 8.00, 10.00}; - - /* - * Y responses - */ - - double[] adblY = new double[] {25.00, 20.25, 16.00, 9.00, 4.00, 1.00, 0.25, 4.00, 16.00}; - - /* - * Construct a set of Predictor Ordinates, their Responses, and corresponding Weights to serve as - * weighted closeness of fit. - */ - - StretchBestFitResponse rbfr = StretchBestFitResponse.Create ( - new double[] { 2.28, 2.52, 2.73, 3.00, 5.50, 8.44, 8.76, 9.08, 9.80, 9.92}, - new double[] {14.27, 12.36, 10.61, 9.25, -0.50, 7.92, 10.07, 12.23, 15.51, 16.36}, - new double[] { 1.09, 0.82, 1.34, 1.10, 0.50, 0.79, 0.65, 0.49, 0.24, 0.21} - ); - - /* - * Construct a rational shape controller with the shape controller tension of 1, and Global Scaling. - */ - - double dblShapeControllerTension = 1.; - - ResponseScalingShapeControl rssc = new ResponseScalingShapeControl ( - false, - new QuadraticRationalShapeControl (dblShapeControllerTension) - ); - - /* - * Construct the Segment Inelastic Parameter that is C2 (iK = 2 sets it to C2), with First Order - * Segment Length Penalty Derivative, Second Order Segment Curvature Penalty Derivative, their - * Amplitudes, and without Constraint - */ - - int iK = 2; - double dblLengthPenaltyAmplitude = 1.; - double dblCurvaturePenaltyAmplitude = 1.; - int iLengthPenaltyDerivativeOrder = 1; - int iCurvaturePenaltyDerivativeOrder = 2; - - SegmentInelasticDesignControl sdic = new SegmentInelasticDesignControl ( - iK, - new org.drip.spline.params.SegmentFlexurePenaltyControl ( - iLengthPenaltyDerivativeOrder, - dblLengthPenaltyAmplitude - ), - new org.drip.spline.params.SegmentFlexurePenaltyControl ( - iCurvaturePenaltyDerivativeOrder, - dblCurvaturePenaltyAmplitude - ) - ); - - System.out.println (" \n--------------------------------------------------------------------------------------------------"); - - System.out.println (" \n == ORIGINAL #1 == $$ == ORIGINAL #2 == $$ == BEST FIT == "); - - System.out.println (" \n--------------------------------------------------------------------------------------------------"); - - int iPolyNumBasis = 4; - - /* - * Construct the base, the base + 1 degree segment builder control - */ - - SegmentCustomBuilderControl scbc1 = PolynomialSegmentControlParams ( - iPolyNumBasis, - sdic, - rssc - ); - - SegmentCustomBuilderControl scbc2 = PolynomialSegmentControlParams ( - iPolyNumBasis + 1, - sdic, - rssc - ); - - /* - * Construct the base, the elevated, and the best fit basis spline stretches - */ - - MultiSegmentSequence mssBase1 = BasisSplineStretchTest ( - adblX, - adblY, - scbc1, - null - ); - - MultiSegmentSequence mssBase2 = BasisSplineStretchTest ( - adblX, - adblY, - scbc2, - null - ); - - MultiSegmentSequence mssBestFit = BasisSplineStretchTest ( - adblX, - adblY, - scbc2, - rbfr - ); - - /* - * Compute the segment-by-segment response and monotonicity for all the three stretches - */ - - double dblX = mssBase1.getLeftPredictorOrdinateEdge(); - - double dblXMax = mssBase1.getRightPredictorOrdinateEdge(); - - while (dblX <= dblXMax) { - System.out.println ( - "Y[" + FormatUtil.FormatDouble (dblX, 1, 2, 1.) + "] " + - FormatUtil.FormatDouble (mssBase1.responseValue (dblX), 2, 2, 1.) + " | " - + mssBase1.monotoneType (dblX) + " $$ " - + FormatUtil.FormatDouble (mssBase2.responseValue (dblX), 2, 2, 1.) + " | " - + mssBase2.monotoneType (dblX) + " $$ " - + FormatUtil.FormatDouble (mssBestFit.responseValue (dblX), 2, 2, 1.) + " | " - + mssBestFit.monotoneType (dblX)); - - dblX += 0.25; - } - - /* - * Compute the Stretch Jacobian for all the three stretches - */ - - dblX = mssBase1.getLeftPredictorOrdinateEdge(); - - while (dblX <= dblXMax) { - System.out.println ( - "\t\tJacobian Y[" + FormatUtil.FormatDouble (dblX, 2, 2, 1.) + "] => " + - mssBase1.jackDResponseDCalibrationInput (dblX, 1).displayString()); - - System.out.println ( - "\t\tJacobian Y[" + FormatUtil.FormatDouble (dblX, 2, 2, 1.) + "] => " + - mssBase2.jackDResponseDCalibrationInput (dblX, 1).displayString()); - - System.out.println ( - "\t\tJacobian Y[" + FormatUtil.FormatDouble (dblX, 2, 2, 1.) + "] => " + - mssBestFit.jackDResponseDCalibrationInput (dblX, 1).displayString()); - - System.out.println ("\t\t----\n\t\t----"); - - dblX += 0.25; - } - - /* - * Compute the Base Stretch Curvature, Length, and the Best Fit DPE - */ - - System.out.println ("\n\t\t----STRETCH #1----\n\t\t-----------------"); - - System.out.println ("\tCURVATURE DPE => " + - FormatUtil.FormatDouble (mssBase1.curvatureDPE(), 10, 0, 1.)); - - System.out.println ("\tLENGTH DPE => " + - FormatUtil.FormatDouble (mssBase1.lengthDPE(), 10, 0, 1.)); - - System.out.println ("\tBEST FIT DPE => " + - FormatUtil.FormatDouble (mssBase1.bestFitDPE (rbfr), 10, 0, 1.)); - - /* - * Compute the Elevated Stretch Curvature, Length, and the Best Fit DPE - */ - - System.out.println ("\n\t\t----STRETCH #2----\n\t\t-----------------"); - - System.out.println ("\tCURVATURE DPE => " + - FormatUtil.FormatDouble (mssBase2.curvatureDPE(), 10, 0, 1.)); - - System.out.println ("\tLENGTH DPE => " + - FormatUtil.FormatDouble (mssBase2.lengthDPE(), 10, 0, 1.)); - - System.out.println ("\tBEST FIT DPE => " + - FormatUtil.FormatDouble (mssBase2.bestFitDPE (rbfr), 10, 0, 1.)); - - /* - * Compute the Best Fit Stretch Curvature, Length, and the Best Fit DPE - */ - - System.out.println ("\n\t\t----STRETCH BEST FIT----\n\t\t-----------------------"); - - System.out.println ("\tCURVATURE DPE => " + - FormatUtil.FormatDouble (mssBestFit.curvatureDPE(), 10, 0, 1.)); - - System.out.println ("\tLENGTH DPE => " + - FormatUtil.FormatDouble (mssBestFit.lengthDPE(), 10, 0, 1.)); - - System.out.println ("\tBEST FIT DPE => " + - FormatUtil.FormatDouble (mssBestFit.bestFitDPE (rbfr), 10, 0, 1.)); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - PenalizedCurvatureLengthFitTest(); - } -} diff --git a/org/drip/sample/stretch/CurvatureRoughnessPenaltyFit.java b/org/drip/sample/stretch/CurvatureRoughnessPenaltyFit.java deleted file mode 100644 index 967a48e..0000000 --- a/org/drip/sample/stretch/CurvatureRoughnessPenaltyFit.java +++ /dev/null @@ -1,328 +0,0 @@ - -package org.drip.sample.stretch; - -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.quant.common.FormatUtil; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * CurvatureRoughnessPenaltyFit demonstrates the setting up and the usage of the curvature and closeness of - * fit penalizing spline. It illustrates in detail the following steps: - * - Set up the X Predictor Ordinate and the Y Response Value Set. - * - Construct a set of Predictor Ordinates, their Responses, and corresponding Weights to serve as - * weighted closeness of fit. - * - Construct a rational shape controller with the desired shape controller tension parameters and Global - * Scaling. - * - Construct the segment inelastic parameter that is C2 (iK = 2 sets it to C2), with 2nd order roughness - * penalty derivative, and without constraint. - * - Construct the base, the base + 1 degree segment builder control. - * - Construct the base, the elevated, and the best fit basis spline stretches. - * - Compute the segment-by-segment monotonicity for all the three stretches. - * - Compute the Stretch Jacobian for all the three stretches. - * - Compute the Base Stretch Curvature Penalty Estimate. - * - Compute the Elevated Stretch Curvature Penalty Estimate. - * - Compute the Best Fit Stretch Curvature Penalty Estimate. - * - * @author Lakshmi Krishnamurthy - */ - -public class CurvatureRoughnessPenaltyFit { - - /* - * Build Polynomial Segment Control Parameters - * - * WARNING: Insufficient Error Checking, so use caution - */ - - public static final SegmentCustomBuilderControl PolynomialSegmentControlParams ( - final int iNumBasis, - final SegmentInelasticDesignControl sdic, - final ResponseScalingShapeControl rssc) - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (iNumBasis), - sdic, - rssc, - null - ); - } - - /* - * Construct the Basis Spline Stretch Instance using the following inputs: - * - Array of Segment Builder Parameters - one per segment - * - Construct a Calibrated Stretch instance - * - * WARNING: Insufficient Error Checking, so use caution - */ - - public static final MultiSegmentSequence BasisSplineStretchTest ( - final double[] adblX, - final double[] adblY, - final SegmentCustomBuilderControl scbc, - final StretchBestFitResponse sbfr) - throws Exception - { - /* - * Array of Segment Builder Parameters - one per segment - */ - - SegmentCustomBuilderControl[] aSCBC = new SegmentCustomBuilderControl[adblX.length - 1]; - - for (int i = 0; i < adblX.length - 1; ++i) - aSCBC[i] = scbc; - - /* - * Construct a Calibrated Stretch instance - */ - - return MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator ( - "SPLINE_STRETCH", - adblX, // predictors - adblY, // responses - aSCBC, // Basis Segment Builder parameters - sbfr, // Stretch Fitness Weighted Response - BoundarySettings.NaturalStandard(), // Boundary Condition - Natural - MultiSegmentSequence.CALIBRATE // Calibrate the Stretch predictors to the responses - ); - } - - /* - * Bring it all together in the Penalized Curvature Fit Test using the following steps: - * - Set up the X Predictor Ordinate and the Y Response Value Set. - * - Construct a set of Predictor Ordinates, their Responses, and corresponding Weights to serve as - * weighted closeness of fit. - * - Construct a rational shape controller with the desired shape controller tension parameters and Global Scaling. - * - Construct the segment inelastic parameter that is C2 (iK = 2 sets it to C2), with 2nd order - * roughness penalty derivative, and without constraint. - * - Construct the base, the base + 1 degree segment builder control. - * - Construct the base, the elevated, and the best fit basis spline stretches. - * - Compute the segment-by-segment monotonicity for all the three stretches. - * - Compute the Stretch Jacobian for all the three stretches. - * - Compute the Base Stretch Curvature Penalty Estimate. - * - Compute the Elevated Stretch Curvature Penalty Estimate. - * - Compute the Best Fit Stretch Curvature Penalty Estimate. - */ - - public static final void PenalizedCurvatureFitTest() - throws Exception - { - /* - * X predictors - */ - - double[] adblX = new double[] { 1.00, 1.50, 2.00, 3.00, 4.00, 5.00, 6.50, 8.00, 10.00}; - - /* - * Y responses - */ - - double[] adblY = new double[] {25.00, 20.25, 16.00, 9.00, 4.00, 1.00, 0.25, 4.00, 16.00}; - - /* - * Construct a set of Predictor Ordinates, their Responses, and corresponding Weights to serve as - * weighted closeness of fit. - */ - - StretchBestFitResponse sbfr = StretchBestFitResponse.Create ( - new double[] { 2.28, 2.52, 2.73, 3.00, 5.50, 8.44, 8.76, 9.08, 9.80, 9.92}, - new double[] {14.27, 12.36, 10.61, 9.25, -0.50, 7.92, 10.07, 12.23, 15.51, 16.36}, - new double[] { 1.09, 0.82, 1.34, 1.10, 0.50, 0.79, 0.65, 0.49, 0.24, 0.21} - ); - - /* - * Construct a rational shape controller with the shape controller tension of 1, and Global Scaling. - */ - - double dblShapeControllerTension = 1.; - - ResponseScalingShapeControl rssc = new ResponseScalingShapeControl ( - false, - new QuadraticRationalShapeControl (dblShapeControllerTension) - ); - - /* - * Construct the segment inelastic parameter that is C2 (iK = 2 sets it to C2), with 2nd order - * roughness penalty derivative, and without constraint - */ - - int iK = 2; - int iRoughnessPenaltyDerivativeOrder = 2; - - SegmentInelasticDesignControl sdic = SegmentInelasticDesignControl.Create ( - iK, - iRoughnessPenaltyDerivativeOrder - ); - - System.out.println (" \n--------------------------------------------------------------------------------------------------"); - - System.out.println (" \n == ORIGINAL #1 == $$ == ORIGINAL #2 == $$ == BEST FIT == "); - - System.out.println (" \n--------------------------------------------------------------------------------------------------"); - - int iPolyNumBasis = 4; - - /* - * Construct the base, the base + 1 degree segment builder control - */ - - SegmentCustomBuilderControl scbc1 = PolynomialSegmentControlParams ( - iPolyNumBasis, - sdic, - rssc - ); - - SegmentCustomBuilderControl scbc2 = PolynomialSegmentControlParams ( - iPolyNumBasis + 1, - sdic, - rssc - ); - - /* - * Construct the base, the elevated, and the best fit basis spline stretches - */ - - MultiSegmentSequence mssBase1 = BasisSplineStretchTest ( - adblX, - adblY, - scbc1, - null - ); - - MultiSegmentSequence mssBase2 = BasisSplineStretchTest ( - adblX, - adblY, - scbc2, - null - ); - - MultiSegmentSequence mssBestFit = BasisSplineStretchTest ( - adblX, - adblY, - scbc2, - sbfr - ); - - /* - * Compute the segment-by-segment monotonicity for all the three stretches - */ - - double dblX = mssBase1.getLeftPredictorOrdinateEdge(); - - double dblXMax = mssBase1.getRightPredictorOrdinateEdge(); - - while (dblX <= dblXMax) { - System.out.println ( - "Y[" + FormatUtil.FormatDouble (dblX, 1, 2, 1.) + "] " + - FormatUtil.FormatDouble (mssBase1.responseValue (dblX), 2, 2, 1.) + " | " - + mssBase1.monotoneType (dblX) + " $$ " - + FormatUtil.FormatDouble (mssBase2.responseValue (dblX), 2, 2, 1.) + " | " - + mssBase2.monotoneType (dblX) + " $$ " - + FormatUtil.FormatDouble (mssBestFit.responseValue (dblX), 2, 2, 1.) + " | " - + mssBestFit.monotoneType (dblX)); - - dblX += 0.25; - } - - /* - * Compute the Stretch Jacobian for all the three stretches - */ - - dblX = mssBase1.getLeftPredictorOrdinateEdge(); - - while (dblX <= dblXMax) { - System.out.println ( - "\t\tJacobian Y[" + FormatUtil.FormatDouble (dblX, 2, 2, 1.) + "] => " + - mssBase1.jackDResponseDCalibrationInput (dblX, 1).displayString()); - - System.out.println ( - "\t\tJacobian Y[" + FormatUtil.FormatDouble (dblX, 2, 2, 1.) + "] => " + - mssBase2.jackDResponseDCalibrationInput (dblX, 1).displayString()); - - System.out.println ( - "\t\tJacobian Y[" + FormatUtil.FormatDouble (dblX, 2, 2, 1.) + "] => " + - mssBestFit.jackDResponseDCalibrationInput (dblX, 1).displayString()); - - System.out.println ("\t\t----\n\t\t----"); - - dblX += 0.25; - } - - /* - * Compute the Base Stretch Curvature Penalty Estimate - */ - - System.out.println ("\tBASE #1 DPE: " + FormatUtil.FormatDouble (mssBase1.curvatureDPE(), 10, 0, 1.)); - - /* - * Compute the Elevated Stretch Curvature Penalty Estimate - */ - - System.out.println ("\tBASE #2 DPE: " + FormatUtil.FormatDouble (mssBase2.curvatureDPE(), 10, 0, 1.)); - - /* - * Compute the Best Fit Stretch Curvature Penalty Estimate - */ - - System.out.println ("\tBEST FIT DPE: " + FormatUtil.FormatDouble (mssBestFit.curvatureDPE(), 10, 0, 1.)); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - PenalizedCurvatureFitTest(); - } -} diff --git a/org/drip/sample/stretch/CustomDiscountCurveBuilder.java b/org/drip/sample/stretch/CustomDiscountCurveBuilder.java deleted file mode 100644 index e4ee176..0000000 --- a/org/drip/sample/stretch/CustomDiscountCurveBuilder.java +++ /dev/null @@ -1,619 +0,0 @@ - -package org.drip.sample.stretch; - -/* - * Java Imports - */ - -import java.util.*; - -import org.drip.function.r1tor1.QuadraticRationalShapeControl; -import org.drip.quant.common.FormatUtil; -import org.drip.spline.basis.*; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * CustomDiscountCurveBuilder contains samples that demo how to build a discount curve from purely the cash - * flows. It provides for elaborate curve builder control, both at the segment level and at the Stretch - * level. In particular, it shows the following: - * - Construct a discount curve from the discount factors available purely from the cash and the euro-dollar - * instruments. - * - Construct a discount curve from the cash flows available from the swap instruments. - * - * In addition, the sample demonstrates the following ways of controlling curve construction: - * - Control over the type of segment basis spline - * - Control over the polynomial basis spline order, Ck, and tension parameters - * - Provision of custom shape controllers (in this case rational shape controller) - * - Calculation of segment monotonicity and convexity - * - * @author Lakshmi Krishnamurthy - */ - -public class CustomDiscountCurveBuilder { - - /* - * Sample API demonstrating the creation of the segment builder parameters based on Koch-Lyche-Kvasov tension spline. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SegmentCustomBuilderControl MakeKLKTensionSCBC ( - final double dblTension) - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, // Spline Type KLK Hyperbolic Basis Tension - new ExponentialTensionSetParams (dblTension), // Segment Tension Parameter Value - SegmentInelasticDesignControl.Create (2, 2), // Ck = 2; Curvature penalty (if necessary) order: 2 - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.0)), // Univariate Rational Shape Controller - null - ); - } - - /* - * Sample API demonstrating the creation of the segment builder parameters based on polynomial spline. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - public static final SegmentCustomBuilderControl MakePolynomialSBP ( - final int iNumDegree) - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, // Spline Type Polynomial - new PolynomialFunctionSetParams (iNumDegree + 1), // Polynomial of degree (i.e, cubic would be 3+1; 4 basis functions - 1 "intercept") - SegmentInelasticDesignControl.Create (2, 2), // Ck = 2; Curvature penalty (if necessary) order: 2 - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.0)), // Univariate Rational Shape Controller - null - ); - } - - /* - * Sample API demonstrating the creation of the segment builder parameters - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SegmentCustomBuilderControl MakeSCBC ( - final String strBasisSpline) - throws Exception - { - if (strBasisSpline.equalsIgnoreCase (MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL)) // Polynomial Basis Spline - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, // Spline Type Polynomial - new PolynomialFunctionSetParams (4), // Polynomial of order 3 (i.e, cubic - 4 basis functions - 1 "intercept") - SegmentInelasticDesignControl.Create (2, 2), // Ck = 2; Curvature penalty (if necessary) order: 2 - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.0)), // Univariate Rational Shape Controller - null - ); - - if (strBasisSpline.equalsIgnoreCase (MultiSegmentSequenceBuilder.BASIS_SPLINE_EXPONENTIAL_TENSION)) // Exponential Tension Basis Spline - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_EXPONENTIAL_TENSION, // Spline Type Exponential Basis Tension - new ExponentialTensionSetParams (1.), // Segment Tension Parameter Value = 1. - SegmentInelasticDesignControl.Create (2, 2), // Ck = 2; Curvature penalty (if necessary) order: 2 - new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (0.0)), // Univariate Rational Shape Controller - null - ); - - return null; - } - - /* - * Generate the sample Swap Cash Flows to a given maturity, for the frequency/coupon. - * Cash Flow is in the form of Map. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final TreeMap SwapCashFlow ( - final double dblCoupon, - final int iFreq, - final double dblTenorInYears) - { - TreeMap mapCF = new TreeMap(); - - for (double dblCFDate = 1. / iFreq; dblCFDate < dblTenorInYears; dblCFDate += 1. / iFreq) - mapCF.put ( - dblCFDate, - dblCoupon / iFreq - ); - - mapCF.put ( - 0., - -1. - ); - - mapCF.put ( - 1. * dblTenorInYears, - 1. + dblCoupon / iFreq - ); - - return mapCF; - } - - /** - * Generate the DRIP linear constraint corresponding to an exclusive swap segment. This constraint is - * used to calibrate the discount curve in this segment. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final SegmentResponseValueConstraint GenerateSegmentConstraint ( - final TreeMap mapCF, - final MultiSegmentSequence mssDF) - throws Exception - { - double dblValue = 0.; - - List lsTime = new ArrayList(); - - List lsWeight = new ArrayList(); - - for (Map.Entry me : mapCF.entrySet()) { - double dblTime = me.getKey(); - - if (null != mssDF && mssDF.in (dblTime)) - dblValue += mssDF.responseValue (dblTime) * me.getValue(); - else { - lsTime.add (me.getKey()); - - lsWeight.add (me.getValue()); - } - } - - int iSize = lsTime.size(); - - double[] adblNode = new double[iSize]; - double[] adblNodeWeight = new double[iSize]; - - for (int i = 0; i < iSize; ++i) { - adblNode[i] = lsTime.get (i); - - adblNodeWeight[i] = lsWeight.get (i); - } - - return new SegmentResponseValueConstraint ( - adblNode, - adblNodeWeight, - -dblValue - ); - } - - /** - * The set of Par Swap Quotes. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final Map SwapQuotes() - { - Map mapSwapQuotes = new TreeMap(); - - mapSwapQuotes.put (4., 0.0166); - - mapSwapQuotes.put (5., 0.0206); - - mapSwapQuotes.put (6., 0.0241); - - mapSwapQuotes.put (7., 0.0269); - - mapSwapQuotes.put (8., 0.0292); - - mapSwapQuotes.put (9., 0.0311); - - mapSwapQuotes.put (10., 0.0326); - - mapSwapQuotes.put (11., 0.0340); - - mapSwapQuotes.put (12., 0.0351); - - mapSwapQuotes.put (15., 0.0375); - - mapSwapQuotes.put (20., 0.0393); - - mapSwapQuotes.put (25., 0.0402); - - mapSwapQuotes.put (30., 0.0407); - - mapSwapQuotes.put (40., 0.0409); - - mapSwapQuotes.put (50., 0.0409); - - return mapSwapQuotes; - } - - /** - * Sample Function illustrating the construction of the discount curve off of swap cash flows and - * detailed segment level controls for the swap instruments.Further, the Segment Builder Parameters - * for the cash/swap bridging stretch shown here illustrate using an exponential/hyperbolic spline with - * very high tension (100000.) to "stitch" the cash stretch with the swaps Stretch. - * - * Each of the respective stretches have their own tension settings, so the "high" tension - * ensures that there is no propagation of derivatives and therefore high locality. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MultiSegmentSequence BuildSwapCurve ( - MultiSegmentSequence mss, - final BoundarySettings bs, - final int iCalibrationDetail) - throws Exception - { - boolean bFirstNode = true; - - /* - * Iterate through the swap instruments and their quotes. - */ - - for (Map.Entry meSwapQuote : SwapQuotes().entrySet()) { - double dblTenorInYears = meSwapQuote.getKey(); // Swap Maturity in Years - - double dblQuote = meSwapQuote.getValue(); // Par Swap Quote - - /* - * Generate the Cash flow for the swap Instrument - */ - - TreeMap mapCF = SwapCashFlow ( - dblQuote, - 2, - dblTenorInYears - ); - - /* - * Convert the Cash flow into a DRIP segment constraint using the "prior" curve stretch - */ - - SegmentResponseValueConstraint srvc = GenerateSegmentConstraint ( - mapCF, - mss - ); - - /* - * If it is the head segment, create a stretch instance for the discount curve. - */ - - if (null == mss) { - /* - * Set the Segment Builder Parameters. This may be set on a segment-by-segment basis. - */ - - SegmentCustomBuilderControl scbc = MakeSCBC (MultiSegmentSequenceBuilder.BASIS_SPLINE_EXPONENTIAL_TENSION); - - /* - * Start off with a single segment stretch, with the corresponding Builder Parameters - */ - - mss = MultiSegmentSequenceBuilder.CreateUncalibratedStretchEstimator ( - "SWAP", - new double[] {0., dblTenorInYears}, - new SegmentCustomBuilderControl[] {scbc} - ); - - /* - * Set the stretch up by carrying out a "Natural Boundary" Spline Calibration - */ - - mss.setup ( - 1., - new SegmentResponseValueConstraint[] {srvc}, - null, - bs, - iCalibrationDetail - ); - } else { - /* - * The Segment Builder Parameters shown here illustrate using an exponential/hyperbolic - * spline with high tension (15.) to "stitch" the cash stretch with the swaps stretch. - * - * Each of the respective stretches have their own tension settings, so the "high" tension - * ensures that there is no propagation of derivatives and therefore high locality. - */ - - SegmentCustomBuilderControl scbcLocal = null; - - if (bFirstNode) { - bFirstNode = false; - - scbcLocal = MakeKLKTensionSCBC (1.); - } else - scbcLocal = MakeKLKTensionSCBC (1.); - - /* - * If not the head segment, just append the exclusive swap instrument segment to the tail of - * the current stretch state, using the constraint generated from the swap cash flow. - */ - - mss = org.drip.spline.stretch.MultiSegmentSequenceModifier.AppendSegment ( - mss, - dblTenorInYears, - srvc, - scbcLocal, - bs, - iCalibrationDetail - ); - } - } - - return mss; - } - - /** - * The set of Cash Discount Factors. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final Map CashDFQuotes() - { - Map mapDFCashQuotes = new TreeMap(); - - mapDFCashQuotes.put (0.005556, 0.999991); - - mapDFCashQuotes.put (0.019444, 0.999967); - - mapDFCashQuotes.put (0.038889, 0.999931); - - mapDFCashQuotes.put (0.083333, 0.999836); - - mapDFCashQuotes.put (0.166667, 0.999622); - - mapDFCashQuotes.put (0.250000, 0.999360); - - mapDFCashQuotes.put (0.500000, 0.998686); - - mapDFCashQuotes.put (0.750000, 0.997888); - - mapDFCashQuotes.put (1.000000, 0.996866); - - mapDFCashQuotes.put (1.250000, 0.995522); - - mapDFCashQuotes.put (1.500000, 0.993609); - - mapDFCashQuotes.put (1.750000, 0.991033); - - mapDFCashQuotes.put (2.000000, 0.987724); - - mapDFCashQuotes.put (2.250000, 0.983789); - - return mapDFCashQuotes; - } - - /** - * Sample Function illustrating the construction of the discount curve off of discount factors and - * detailed segment level controls for the cash instruments. - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final MultiSegmentSequence BuildCashCurve ( - final org.drip.spline.stretch.BoundarySettings bs, - final int iCalibrationDetail) - throws Exception - { - /* - * For the head segment, create a calibrated stretch instance for the discount curve. - */ - - MultiSegmentSequence mssCash = MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator ( - "CASH", - new double[] {0., 0.002778}, // t0 and t1 for the segment - new double[] {1., 0.999996}, // the corresponding discount factors - new SegmentCustomBuilderControl[] { - // MakeSCBC (MultiSegmentSequenceBuilder.BASIS_SPLINE_EXPONENTIAL_TENSION) - MakeKLKTensionSCBC (1.) - }, // Exponential Tension Basis Spline - null, - bs, - iCalibrationDetail // "Natural" Spline Boundary Condition + Calibrate the full stretch - ); - - /* - * Construct the discount curve by iterating through the cash instruments and their discount - * factors, and inserting them as "knots" onto the existing stretch. - */ - - for (Map.Entry meCashDFQuote : CashDFQuotes().entrySet()) { - double dblTenorInYears = meCashDFQuote.getKey(); // Instrument Tenor in Years - - double dblDF = meCashDFQuote.getValue(); // Discount Factor - - /* - * Insert the instrument/quote as a "knot" entity into the stretch. Given the "natural" spline - */ - - mssCash = MultiSegmentSequenceModifier.InsertKnot ( - mssCash, - dblTenorInYears, - dblDF, - bs, - iCalibrationDetail - ); - } - - return mssCash; - } - - /* - * This sample demonstrates the usage construction and usage of Custom Curve Building. It shows the following: - * - Construct the Cash Curve Sequence with the Standard Natural Boundary Condition. - * - Construct the Cash Curve Sequence with the Standard Financial Boundary Condition. - * - Construct the Cash Curve Sequence with the Standard Not-A-Knot Boundary Condition. - * - Display the DF and the monotonicity for the cash instruments. - * - Construct the Swap Curve Sequence with the Standard Natural Boundary Condition. - * - Construct the Swap Curve Sequence with the Standard Financial Boundary Condition. - * - Construct the Swap Curve Sequence with the Standard Not-A-Knot Boundary Condition. - * - Display the DF and the monotonicity for the swap instruments. - */ - - private static final void CustomCurveBuilderTest() - throws Exception - { - /* - * Construct the Cash Curve Sequence with the Standard Natural Boundary Condition - */ - - MultiSegmentSequence mssNaturalCash = BuildCashCurve ( - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE - ); - - /* - * Construct the Cash Curve Sequence with the Standard Financial Boundary Condition - */ - - MultiSegmentSequence mssFinancialCash = BuildCashCurve ( - BoundarySettings.FinancialStandard(), - MultiSegmentSequence.CALIBRATE - ); - - /* - * Construct the Cash Curve Sequence with the Standard Not-A-Knot Boundary Condition - */ - - MultiSegmentSequence mssNotAKnotCash = BuildCashCurve ( - BoundarySettings.NotAKnotStandard (1, 1), - MultiSegmentSequence.CALIBRATE - ); - - double dblXShift = 0.1 * (mssNaturalCash.getRightPredictorOrdinateEdge() - mssNaturalCash.getLeftPredictorOrdinateEdge()); - - System.out.println ("\n\t\t\t---------------- <====> ------------------ <====> ------------------"); - - System.out.println ("\t\t\tNATURAL BOUNDARY <====> NOT A KNOT BOUNDARY <====> FINANCIAL BOUNDARY"); - - System.out.println ("\t\t\t---------------- <====> ------------------ <====> ------------------\n"); - - /* - * Display the DF and the monotonicity for the cash instruments. - */ - - for (double dblX = mssNaturalCash.getLeftPredictorOrdinateEdge(); dblX <= mssNaturalCash.getRightPredictorOrdinateEdge(); dblX = dblX + dblXShift) - System.out.println ("Cash DF[" + - FormatUtil.FormatDouble (dblX, 1, 3, 1.) + "Y] => " + - FormatUtil.FormatDouble (mssNaturalCash.responseValue (dblX), 1, 6, 1.) + " | " + - mssNaturalCash.monotoneType (dblX) + " <====> " + - FormatUtil.FormatDouble (mssNotAKnotCash.responseValue (dblX), 1, 6, 1.) + " | " + - mssNotAKnotCash.monotoneType (dblX) + " <====> " + - FormatUtil.FormatDouble (mssFinancialCash.responseValue (dblX), 1, 6, 1.) + " | " + - mssNaturalCash.monotoneType (dblX)); - - System.out.println ("\n"); - - /* - * Construct the Swap Curve Sequence with the Standard Natural Boundary Condition - */ - - MultiSegmentSequence mssNaturalSwap = BuildSwapCurve ( - mssNaturalCash, - BoundarySettings.NaturalStandard(), - MultiSegmentSequence.CALIBRATE - ); - - /* - * Construct the Swap Curve Sequence with the Standard Financial Boundary Condition - */ - - MultiSegmentSequence mssFinancialSwap = BuildSwapCurve ( - mssFinancialCash, - BoundarySettings.FinancialStandard(), - MultiSegmentSequence.CALIBRATE - ); - - /* - * Construct the Swap Curve Sequence with the Standard Not-A-Knot Boundary Condition - */ - - MultiSegmentSequence mssNotAKnotSwap = BuildSwapCurve ( - mssNotAKnotCash, - BoundarySettings.NotAKnotStandard (1, 1), - MultiSegmentSequence.CALIBRATE - ); - - /* - * Display the DF and the monotonicity for the swaps. - */ - - dblXShift = 0.05 * (mssNaturalSwap.getRightPredictorOrdinateEdge() - mssNaturalSwap.getLeftPredictorOrdinateEdge()); - - for (double dblX = mssNaturalSwap.getLeftPredictorOrdinateEdge(); dblX <= mssNaturalSwap.getRightPredictorOrdinateEdge(); dblX = dblX + dblXShift) - System.out.println ( - "Swap DF [" + - FormatUtil.FormatDouble (dblX, 2, 0, 1.) + "Y] => " + - FormatUtil.FormatDouble (mssNaturalSwap.responseValue (dblX), 1, 6, 1.) + " | " + - mssNaturalSwap.monotoneType (dblX) + " <====> " + - FormatUtil.FormatDouble (mssNotAKnotSwap.responseValue (dblX), 1, 6, 1.) + " | " + - mssNotAKnotSwap.monotoneType (dblX) + " <====> " + - FormatUtil.FormatDouble (mssFinancialSwap.responseValue (dblX), 1, 6, 1.) + " | " + - mssFinancialSwap.monotoneType (dblX) - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - CustomCurveBuilderTest(); - } -} diff --git a/org/drip/sample/stretch/KnotInsertionPolynomialEstimator.java b/org/drip/sample/stretch/KnotInsertionPolynomialEstimator.java deleted file mode 100644 index 1e8ef1f..0000000 --- a/org/drip/sample/stretch/KnotInsertionPolynomialEstimator.java +++ /dev/null @@ -1,1037 +0,0 @@ - -package org.drip.sample.stretch; - -import org.drip.function.r1tor1.*; -import org.drip.quant.common.FormatUtil; -import org.drip.spline.basis.*; -import org.drip.spline.params.*; -import org.drip.spline.pchip.*; -import org.drip.spline.stretch.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * KnotInsertionPolynomialEstimator demonstrates the Stretch builder and usage API. It shows the following: - * - * - Construction of segment control parameters - polynomial (regular/Bernstein) segment control, - * exponential/hyperbolic tension segment control, Kaklis-Pandelis tension segment control. - * - Perform the following sequence of tests for a given segment control for a predictor/response range - * - Assign the array of Segment Builder Parameters - one per segment - * - Construct the Stretch Instance - * - Estimate, compute the segment-by-segment monotonicity and the Stretch Jacobian - * - Construct a new Stretch instance by inserting a pair of of predictor/response knots - * - Estimate, compute the segment-by-segment monotonicity and the Stretch Jacobian - * - Demonstrate the construction, the calibration, and the usage of Local Control Segment Spline. - * - Demonstrate the construction, the calibration, and the usage of Lagrange Polynomial Stretch. - * - Demonstrate the construction, the calibration, and the usage of C1 Stretch with the desired customization. - * - * @author Lakshmi Krishnamurthy - */ - -public class KnotInsertionPolynomialEstimator { - - /* - * Build Polynomial Segment Control Parameters. - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final SegmentCustomBuilderControl PolynomialSegmentControlParams ( - final int iNumBasis, - final SegmentInelasticDesignControl sdic, - final ResponseScalingShapeControl rssc) - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (iNumBasis), - sdic, - rssc, - null - ); - } - - /* - * Build Bernstein Polynomial Segment Control Parameters. - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final SegmentCustomBuilderControl BernsteinPolynomialSegmentControlParams ( - final int iNumBasis, - final SegmentInelasticDesignControl sdic, - final ResponseScalingShapeControl rssc) - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_BERNSTEIN_POLYNOMIAL, - new PolynomialFunctionSetParams (iNumBasis), - sdic, - rssc, - null - ); - } - - /* - * Build Exponential Tension Segment Control Parameters. - * - * WARNING: Insufficient Error Checking, so use caution - */ - - public static final SegmentCustomBuilderControl ExponentialTensionSegmentControlParams ( - final double dblTension, - final SegmentInelasticDesignControl sdic, - final ResponseScalingShapeControl rssc) - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_EXPONENTIAL_TENSION, - new ExponentialTensionSetParams (dblTension), - sdic, - rssc, - null - ); - } - - /* - * Build Hyperbolic Tension Segment Control Parameters. - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final SegmentCustomBuilderControl HyperbolicTensionSegmentControlParams ( - final double dblTension, - final SegmentInelasticDesignControl sdic, - final ResponseScalingShapeControl rssc) - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_HYPERBOLIC_TENSION, - new ExponentialTensionSetParams (dblTension), - sdic, - rssc, - null - ); - } - - /* - * Build Kaklis-Pandelis Segment Control Parameters - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final SegmentCustomBuilderControl KaklisPandelisSegmentControlParams ( - final int iKPTensionDegree, - final SegmentInelasticDesignControl sdic, - final ResponseScalingShapeControl rssc) - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KAKLIS_PANDELIS, - new KaklisPandelisSetParams (iKPTensionDegree), - sdic, - rssc, - null - ); - } - - /* - * Perform the following sequence of tests for a given segment control for a predictor/response range - * - Estimate - * - Compute the segment-by-segment monotonicity - * - Stretch Jacobian - * - Stretch knot insertion - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final void BasisSplineStretchTest ( - final double[] adblX, - final double[] adblY, - final SegmentCustomBuilderControl scbc) - throws Exception - { - double dblX = 1.; - double dblXMax = 10.; - - /* - * Assign the array of Segment Builder Parameters - one per segment - */ - - SegmentCustomBuilderControl[] aSCBC = new SegmentCustomBuilderControl[adblX.length - 1]; - - for (int i = 0; i < adblX.length - 1; ++i) - aSCBC[i] = scbc; - - /* - * Construct a Stretch instance - */ - - MultiSegmentSequence mss = MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator ( - "SPLINE_STRETCH", // Name - adblX, // predictors - adblY, // responses - aSCBC, // Basis Segment Builder parameters - null, // NULL segment Best Fit Response - BoundarySettings.NaturalStandard(), // Boundary Condition - Natural - MultiSegmentSequence.CALIBRATE // Calibrate the Stretch predictors to the responses - ); - - /* - * Estimate, compute the segment-by-segment monotonicity and the Stretch Jacobian - */ - - while (dblX <= dblXMax) { - System.out.println ("Y[" + dblX + "] " + FormatUtil.FormatDouble (mss.responseValue (dblX), 1, 2, 1.) + " | " + - mss.monotoneType (dblX)); - - System.out.println ("Jacobian Y[" + dblX + "]=" + mss.jackDResponseDCalibrationInput (dblX, 1).displayString()); - - dblX += 1.; - } - - System.out.println ("SPLINE_STRETCH DPE: " + mss.curvatureDPE()); - - /* - * Construct a new Stretch instance by inserting a pair of of predictor/response knots - */ - - MultiSegmentSequence mssInsert = MultiSegmentSequenceModifier.InsertKnot ( - mss, // The Original MSS - 9., // Predictor Ordinate at which the Insertion is to be made - 10., // Response Value to be inserted - BoundarySettings.NaturalStandard(), // Boundary Condition - Natural - MultiSegmentSequence.CALIBRATE // Calibrate the Stretch predictors to the responses - ); - - dblX = 1.; - - /* - * Estimate, compute the sgement-by-segment monotonicty and the Stretch Jacobian - */ - - while (dblX <= dblXMax) { - System.out.println ("Inserted Y[" + dblX + "] " + FormatUtil.FormatDouble (mssInsert.responseValue (dblX), 1, 2, 1.) - + " | " + mssInsert.monotoneType (dblX)); - - dblX += 1.; - } - - System.out.println ("SPLINE_STRETCH_INSERT DPE: " + mssInsert.curvatureDPE()); - } - - /* - * This function demonstrates the construction, the calibration, and the usage of Local Control Segment Spline. - * It does the following: - * - Set up the predictor/response values, the shape controller, and the basis spline (in this case polynomial) - * - Create the left and the right segment edge derivative parameters for each segment - * - Construct the C1 Hermite Polynomial Spline based Stretch Estimator by using the following steps: - * - Set up the Stretch Builder Parameter - * - Set the array of Segment Builder Parameters - one per segment - * - Construct the Stretch - * - Set up the left and the local control Parameters - in this case the derivatives - * - Calibrate the Stretch and compute the Jacobian - * - Display the Estimated Y and the Stretch Jacobian across the variates - * - Insert the Local Control spline point(s) for the following variants: - * - Local Control Explicit Hermite Point - * - Local Control Explicit Cardinal Point - * - Local Control Explicit Catmull-Rom Point - * - In each of the above instances perform the following tests: - * - Set up the left and the right segment edge parameters - * - Insert the pair of edge parameters at the chosen variate node. - * - Compute the Estimated segment value and the motonicity across a suitable variate range. - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final void TestHermiteCatmullRomCardinal() - throws java.lang.Exception - { - /* - * X predictors - */ - - double[] adblX = new double[] {0.00, 1.00, 2.00, 3.00, 4.00}; - - /* - * Y responses - */ - - double[] adblY = new double[] {1.00, 4.00, 15.00, 40.00, 85.00}; - - /* - * DY/DX explicit local shape control for the responses - */ - - double[] adblDYDX = new double[] {1.00, 6.00, 17.00, 34.00, 57.00}; - - /* - * Construct a rational shape controller with the shape controller tension of 1. - */ - - double dblShapeControllerTension = 1.; - - ResponseScalingShapeControl rssc = new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (dblShapeControllerTension) - ); - - /* - * Construct the segment inelastic parameter that is C2 (iK = 2 sets it to C2), with 2nd order - * roughness penalty derivative, and without constraint - */ - - int iK = 1; - int iRoughnessPenaltyDerivativeOrder = 2; - - SegmentInelasticDesignControl sdic = SegmentInelasticDesignControl.Create ( - iK, - iRoughnessPenaltyDerivativeOrder - ); - - /* - * Construct the C1 Hermite Polynomial Spline based Stretch Estimator by using the following steps: - * - * - 1) Set up the Stretch Builder Parameter - */ - - int iNumBasis = 4; - - SegmentCustomBuilderControl scbc = new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (iNumBasis), - sdic, - rssc, - null - ); - - /* - * - 2a) Set the array of Segment Builder Parameters - one per segment - */ - - SegmentCustomBuilderControl[] aSCBC = new SegmentCustomBuilderControl[adblX.length - 1]; - - for (int i = 0; i < adblX.length - 1; ++i) - aSCBC[i] = scbc; - - /* - * - 2b) Construct the Stretch - */ - - MultiSegmentSequence mss = MultiSegmentSequenceBuilder.CreateUncalibratedStretchEstimator ( - "SPLINE_STRETCH", - adblX, - aSCBC - ); - - SegmentPredictorResponseDerivative[] aSPRDLeft = new SegmentPredictorResponseDerivative[adblY.length - 1]; - SegmentPredictorResponseDerivative[] aSPRDRight = new SegmentPredictorResponseDerivative[adblY.length - 1]; - - /* - * - 3) Set up the left and the local control Parameters - in this case the derivatives - */ - - for (int i = 0; i < adblY.length - 1; ++i) { - aSPRDLeft[i] = new SegmentPredictorResponseDerivative (adblY[i], new double[] {adblDYDX[i]}); - - aSPRDRight[i] = new SegmentPredictorResponseDerivative (adblY[i + 1], new double[] {adblDYDX[i + 1]}); - } - - /* - * - 4) Calibrate the Stretch and compute the Jacobian - */ - - System.out.println ("Stretch Setup Succeeded: " + - mss.setupHermite ( - aSPRDLeft, - aSPRDRight, - null, - null, - MultiSegmentSequence.CALIBRATE - ) - ); - - double dblX = 0.; - double dblXMax = 4.; - - /* - * - 5) Display the Estimated Y and the Stretch Jacobian across the variates - */ - - while (dblX <= dblXMax) { - System.out.println ("Y[" + dblX + "] " + FormatUtil.FormatDouble (mss.responseValue (dblX), 1, 2, 1.) + " | " + - mss.monotoneType (dblX)); - - System.out.println ("Jacobian Y[" + dblX + "]=" + mss.jackDResponseDCalibrationInput (dblX, 1).displayString()); - - dblX += 0.5; - } - - System.out.println ("SPLINE_STRETCH DPE: " + mss.curvatureDPE()); - - /* - * We now insert a Hermite local control knot. The following are the steps: - * - * - 1) Set up the left and the right segment edge parameters - * - 2) Insert the pair of edge parameters at the chosen variate node. - * - 3) Compute the Estimated segment value and the motonicity across a suitable variate range. - */ - - SegmentPredictorResponseDerivative sprdLeftSegmentRightNode = new SegmentPredictorResponseDerivative ( - 27.5, - new double[] {25.5} - ); - - SegmentPredictorResponseDerivative sprdRightSegmentLeftNode = new SegmentPredictorResponseDerivative ( - 27.5, - new double[] {25.5} - ); - - MultiSegmentSequence mssInsert = MultiSegmentSequenceModifier.InsertKnot ( - mss, - 2.5, - sprdLeftSegmentRightNode, - sprdRightSegmentLeftNode - ); - - dblX = 1.; - - while (dblX <= dblXMax) { - System.out.println ("Inserted Y[" + dblX + "] " + FormatUtil.FormatDouble (mssInsert.responseValue (dblX), 1, 2, 1.) - + " | " + mssInsert.monotoneType (dblX)); - - dblX += 0.5; - } - - System.out.println ("SPLINE_STRETCH_INSERT DPE: " + mssInsert.curvatureDPE()); - - /* - * We now insert a Cardinal local control knot. The following are the steps: - * - * - 1) Set up the left and the right segment edge parameters - * - 2) Insert the pair of edge parameters at the chosen variate node. - * - 3) Compute the Estimated segment value and the motonicity across a suitable variate range. - */ - - MultiSegmentSequence mssCardinalInsert = MultiSegmentSequenceModifier.InsertCardinalKnot ( - mss, - 2.5, - 0. - ); - - dblX = 1.; - - while (dblX <= dblXMax) { - System.out.println ("Cardinal Inserted Y[" + dblX + "] " + FormatUtil.FormatDouble - (mssCardinalInsert.responseValue (dblX), 1, 2, 1.) + " | " + mssInsert.monotoneType (dblX)); - - dblX += 0.5; - } - - System.out.println ("SPLINE_STRETCH_CARDINAL_INSERT DPE: " + mssCardinalInsert.curvatureDPE()); - - /* - * We now insert a Catmull-Rom local control knot. The following are the steps: - * - * - 1) Set up the left and the right segment edge parameters - * - 2) Insert the pair of edge parameters at the chosen variate node. - * - 3) Compute the Estimated segment value and the motonicity across a suitable variate range. - */ - - MultiSegmentSequence mssCatmullRomInsert = MultiSegmentSequenceModifier.InsertCatmullRomKnot ( - mss, - 2.5 - ); - - dblX = 1.; - - while (dblX <= dblXMax) { - System.out.println ("Catmull-Rom Inserted Y[" + dblX + "] " + FormatUtil.FormatDouble - (mssCatmullRomInsert.responseValue (dblX), 1, 2, 1.) + " | " + mssInsert.monotoneType (dblX)); - - dblX += 0.5; - } - - System.out.println ("SPLINE_STRETCH_CATMULL_ROM_INSERT DPE: " + mssCatmullRomInsert.curvatureDPE()); - } - - /* - * This function demonstrates the construction, the calibration, and the usage of Lagrange Polynomial Stretch. - * It does the following: - * - Set up the predictors and the Lagrange Polynomial Stretch. - * - Calibrate to a target Y array. - * - Calibrate the value to a target X. - * - Calibrate the value Jacobian to a target X. - * - Verify the local monotonicity and convexity (both the co- and the local versions). - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final void TestLagrangePolynomialStretch() - throws java.lang.Exception - { - SingleSegmentSequence sslp = new SingleSegmentLagrangePolynomial (new double[] {-2., -1., 2., 5.}); - - System.out.println ("Setup: " + sslp.setup ( - 0.25, // Left Edge Response Value - new double[] {0.25, 0.25, 12.25, 42.25}, // Array of Segment Response Values - null, // Fitness Weighted Response - BoundarySettings.NaturalStandard(), // Boundary Condition - Natural - MultiSegmentSequence.CALIBRATE) // Calibrate the Stretch predictors to the responses - ); - - System.out.println ("Value = " + sslp.responseValue (2.16)); - - System.out.println ("Value Jacobian = " + sslp.jackDResponseDCalibrationInput (2.16, 1).displayString()); - - System.out.println ("Value Monotone Type: " + sslp.monotoneType (2.16)); - - System.out.println ("Is Locally Monotone: " + sslp.isLocallyMonotone()); - } - - /* - * Construct the C1 Stretch with the desired customization - this demonstrates the following steps: - * - Construct the Local Monotone C1 Generator with the desired Customization. - * - Array of Segment Builder Parameters - one per segment. - * - Construct the Local Control Stretch instance. - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final MultiSegmentSequence ConstructSpecifiedC1Stretch ( - final double[] adblX, - final double[] adblY, - final java.lang.String strGeneratorType, - final SegmentCustomBuilderControl scbc, - final boolean bEliminateSpuriousExtrema, - final boolean bApplyMonotoneFilter) - { - /* - * Construct the Local Monotone C1 Generator with the desired Customization - */ - - LocalMonotoneCkGenerator lmcg = LocalMonotoneCkGenerator.Create ( - adblX, // The Array of Predictor Ordinates - adblY, // The Array of Response Value - strGeneratorType, // The C1 Generator Type - bEliminateSpuriousExtrema, // TRUE => Eliminate Spurious Extremum - bApplyMonotoneFilter // TRUE => Apply Monotone Filter - ); - - /* - * Array of Segment Builder Parameters - one per segment - */ - - SegmentCustomBuilderControl[] aSCBC = new SegmentCustomBuilderControl[adblX.length - 1]; - - for (int i = 0; i < adblX.length - 1; ++i) - aSCBC[i] = scbc; - - /* - * Construct the Local Control Stretch instance - */ - - return LocalControlStretchBuilder.CustomSlopeHermiteSpline ( - strGeneratorType + "_LOCAL_STRETCH", - adblX, - adblY, - lmcg.C1(), - aSCBC, - null, - MultiSegmentSequence.CALIBRATE - ); - } - - /* - * Perform the following sequence of tests for a given segment control for a predictor/response range: - * - Estimate, compute the segment-by-segment monotonicity and the Stretch Jacobian. - * - Construct a new Stretch instance by inserting a pair of of predictor/response knots. - * - Estimate, compute the segment-by-segment monotonicity and the Stretch Jacobian. - * - Stretch knot insertion - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final void C1GeneratedStretchTest ( - final double[] adblX, - final double[] adblY, - final MultiSegmentSequence mss) - throws Exception - { - double dblX = 1.; - double dblXMax = 10.; - - /* - * Estimate, compute the segment-by-segment monotonicity and the Stretch Jacobian - */ - - while (dblX <= dblXMax) { - System.out.println ( - "Y[" + dblX + "] => " + FormatUtil.FormatDouble (mss.responseValue (dblX), 1, 2, 1.) + " | " + - mss.monotoneType (dblX)); - - System.out.println ("Jacobian Y[" + dblX + "]=" + mss.jackDResponseDCalibrationInput (dblX, 1).displayString()); - - dblX += 1.; - } - - System.out.println ("\tSPLINE_STRETCH DPE: " + mss.curvatureDPE()); - - /* - * Construct a new Stretch instance by inserting a pair of of predictor/response knots - */ - - MultiSegmentSequence mssInsert = MultiSegmentSequenceModifier.InsertKnot ( - mss, // The Original MSS - 9., // Predictor Ordinate at which the Insertion is to be made - 10., // Response Value to be inserted - BoundarySettings.NaturalStandard(), // Boundary Condition - Natural - MultiSegmentSequence.CALIBRATE // Calibrate the Stretch predictors to the responses - ); - - dblX = 1.; - - /* - * Estimate, compute the segment-by-segment monotonicity and the Stretch Jacobian - */ - - while (dblX <= dblXMax) { - System.out.println ("Inserted Y[" + dblX + "] " + FormatUtil.FormatDouble (mssInsert.responseValue (dblX), 1, 2, 1.) - + " | " + mssInsert.monotoneType (dblX)); - - dblX += 1.; - } - - System.out.println ("\tSPLINE_STRETCH_INSERT DPE: " + mssInsert.curvatureDPE()); - } - - /* - * This function brings it all together. It demonstrates the following sequence: - * - Setup and X predictor ordinate and Y response value arrays. - * - Construct a rational shape controller with the specified shape controller tension parameter. - * - Construct the segment inelastic parameter that is C2 (iK = 2 sets it to C2), with 2nd order - * roughness penalty derivative, and without constraint - * - Regular Polynomial Basis Spline Stretch Test. - * - Bernstein Polynomial Basis Spline Stretch Test. - * - Exponential Tension Basis Spline Stretch Test. - * - Hyperbolic Tension Basis Spline Stretch Test. - * - Kaklis-Pandelis Basis Spline Stretch Test. - * - Catmull-Rom Cardinal Hermite Basis Spline Stretch Test. - * - Lagrange Polynomial Basis Spline Stretch Test. - * - Akima C1 Basis Spline Stretch Test. - * - Bessel/Hermite C1 Basis Spline Stretch Test. - * - Harmonic Monotone C1 Basis Spline Stretch Test with Filter. - * - Harmonic Monotone C1 Basis Spline Stretch Test without Filter. - * - Huynh-Le Floch Limiter Monotone C1 Basis Spline Stretch Test without Filter. - * - Hyman 1983 Monotone C1 Basis Spline Stretch Test with Filter. - * - Hyman 1989 Monotone C1 Basis Spline Stretch Test with Filter. - * - Kruger C1 Basis Spline Stretch Test with Filter. - * - Van Leer Limiter Monotone C1 Basis Spline Stretch Test without Filter. - */ - - public static final void StretchEstimationTestSequence() - throws Exception - { - /* - * X predictors - */ - - double[] adblX = new double[] { 1.00, 1.50, 2.00, 3.00, 4.00, 5.00, 6.50, 8.00, 10.00}; - - /* - * Y responses - */ - - double[] adblY = new double[] {25.00, 20.25, 16.00, 9.00, 4.00, 1.00, 0.25, 4.00, 16.00}; - - /* - * Construct a rational shape controller with the shape controller tension of 1. - */ - - double dblShapeControllerTension = 1.; - - ResponseScalingShapeControl rssc = new ResponseScalingShapeControl ( - true, - new QuadraticRationalShapeControl (dblShapeControllerTension) - ); - - /* - * Construct the segment inelastic parameter that is C2 (iK = 2 sets it to C2), with 2nd order - * roughness penalty derivative, and without constraint - */ - - int iK = 2; - int iRoughnessPenaltyDerivativeOrder = 2; - - SegmentInelasticDesignControl sdic = SegmentInelasticDesignControl.Create ( - iK, - iRoughnessPenaltyDerivativeOrder - ); - - /* - * Bernstein Polynomial Basis Spline Stretch Test - */ - - System.out.println (" \n---------- \n BERNSTEIN POLYNOMIAL \n ---------- \n"); - - int iBernPolyNumBasis = 4; - - BasisSplineStretchTest ( - adblX, - adblY, - BernsteinPolynomialSegmentControlParams ( - iBernPolyNumBasis, - sdic, - rssc - ) - ); - - /* - * Regular Polynomial Basis Spline Stretch Test - */ - - System.out.println (" \n---------- \n POLYNOMIAL \n ---------- \n"); - - int iPolyNumBasis = 4; - - BasisSplineStretchTest ( - adblX, - adblY, - PolynomialSegmentControlParams ( - iPolyNumBasis, - sdic, - rssc - ) - ); - - /* - * Exponential Tension Basis Spline Stretch Test - */ - - System.out.println (" \n---------- \n EXPONENTIAL TENSION \n ---------- \n"); - - double dblTension = 1.; - - BasisSplineStretchTest ( - adblX, - adblY, - ExponentialTensionSegmentControlParams ( - dblTension, - sdic, - rssc - ) - ); - - /* - * Hyperbolic Tension Basis Spline Stretch Test - */ - - System.out.println (" \n---------- \n HYPERBOLIC TENSION \n ---------- \n"); - - BasisSplineStretchTest ( - adblX, - adblY, - HyperbolicTensionSegmentControlParams ( - dblTension, - sdic, - rssc - ) - ); - - /* - * Kaklis-Pandelis Basis Spline Stretch Test - */ - - System.out.println (" \n---------- \n KAKLIS PANDELIS \n ---------- \n"); - - int iKPTensionDegree = 2; - - BasisSplineStretchTest ( - adblX, - adblY, - KaklisPandelisSegmentControlParams ( - iKPTensionDegree, - sdic, - rssc - ) - ); - - /* - * Catmull-Rom Cardinal Hermite Basis Spline Stretch Test - */ - - System.out.println (" \n---------- \n HERMITE - CATMULL ROM - CARDINAL \n ---------- \n"); - - TestHermiteCatmullRomCardinal(); - - /* - * Lagrange Polynomial Basis Spline Stretch Test - */ - - System.out.println (" \n---------- \n LAGRANGE POLYNOMIAL STRETCH\n ---------- \n"); - - TestLagrangePolynomialStretch(); - - /* - * Akima C1 Basis Spline Stretch Test - */ - - System.out.println (" \n---------- \n C1 AKIMA STRETCH\n ---------- \n"); - - C1GeneratedStretchTest ( - adblX, - adblY, - ConstructSpecifiedC1Stretch ( - adblX, - adblY, - LocalMonotoneCkGenerator.C1_AKIMA, - PolynomialSegmentControlParams ( - iPolyNumBasis, - sdic, - rssc - ), - true, - true - ) - ); - - /* - * Bessel/Hermite C1 Basis Spline Stretch Test - */ - - System.out.println (" \n---------- \n C1 BESSEL/HERMITE \n ---------- \n"); - - C1GeneratedStretchTest ( - adblX, - adblY, - ConstructSpecifiedC1Stretch ( - adblX, - adblY, - LocalMonotoneCkGenerator.C1_BESSEL, - PolynomialSegmentControlParams ( - iPolyNumBasis, - sdic, - rssc - ), - true, - true - ) - ); - - /* - * Harmonic Monotone C1 Basis Spline Stretch Test with Filter - */ - - System.out.println (" \n---------- \n C1 HARMONIC MONOTONE WITH FILTER \n ---------- \n"); - - C1GeneratedStretchTest ( - adblX, - adblY, - ConstructSpecifiedC1Stretch ( - adblX, - adblY, - LocalMonotoneCkGenerator.C1_HARMONIC, - PolynomialSegmentControlParams ( - iPolyNumBasis, - sdic, - rssc - ), - true, - true - ) - ); - - /* - * Harmonic Monotone C1 Basis Spline Stretch Test without Filter - */ - - System.out.println (" \n---------- \n C1 HARMONIC MONOTONE WITHOUT FILTER \n ---------- \n"); - - C1GeneratedStretchTest ( - adblX, - adblY, - ConstructSpecifiedC1Stretch ( - adblX, - adblY, - LocalMonotoneCkGenerator.C1_HARMONIC, - PolynomialSegmentControlParams ( - iPolyNumBasis, - sdic, - rssc - ), - true, - false - ) - ); - - /* - * Huynh-Le Floch Limiter Monotone C1 Basis Spline Stretch Test without Filter - */ - - System.out.println (" \n---------- \n C1 HUYNH LE-FLOCH LIMITER STRETCH WITHOUT FILTER \n ---------- \n"); - - C1GeneratedStretchTest ( - adblX, - adblY, - ConstructSpecifiedC1Stretch ( - adblX, - adblY, - LocalMonotoneCkGenerator.C1_HUYNH_LE_FLOCH, - PolynomialSegmentControlParams ( - iPolyNumBasis, - sdic, - rssc - ), - true, - true - ) - ); - - /* - * - * Hyman 1983 Monotone C1 Basis Spline Stretch Test with Filter - */ - - System.out.println (" \n---------- \n C1 HYMAN 1983 MONOTONE \n ---------- \n"); - - C1GeneratedStretchTest ( - adblX, - adblY, - ConstructSpecifiedC1Stretch ( - adblX, - adblY, - LocalMonotoneCkGenerator.C1_HYMAN83, - PolynomialSegmentControlParams ( - iPolyNumBasis, - sdic, - rssc - ), - true, - true - ) - ); - - /* - * Hyman 1989 Monotone C1 Basis Spline Stretch Test with Filter - */ - - System.out.println (" \n---------- \n C1 HYMAN 1989 MONOTONE \n ---------- \n"); - - C1GeneratedStretchTest ( - adblX, - adblY, - ConstructSpecifiedC1Stretch ( - adblX, - adblY, - LocalMonotoneCkGenerator.C1_HYMAN89, - PolynomialSegmentControlParams ( - iPolyNumBasis, - sdic, - rssc - ), - true, - true - ) - ); - - /* - * Kruger C1 Basis Spline Stretch Test with Filter - */ - - System.out.println (" \n---------- \n C1 KRUGER STRETCH\n ---------- \n"); - - C1GeneratedStretchTest ( - adblX, - adblY, - ConstructSpecifiedC1Stretch ( - adblX, - adblY, - LocalMonotoneCkGenerator.C1_KRUGER, - PolynomialSegmentControlParams ( - iPolyNumBasis, - sdic, - rssc - ), - true, - true - ) - ); - - /* - * Van Leer Limiter Monotone C1 Basis Spline Stretch Test without Filter - */ - - System.out.println (" \n---------- \n C1 VAN LEER LIMITER STRETCH WITHOUT FILTER \n ---------- \n"); - - C1GeneratedStretchTest ( - adblX, - adblY, - ConstructSpecifiedC1Stretch ( - adblX, - adblY, - LocalMonotoneCkGenerator.C1_VAN_LEER, - PolynomialSegmentControlParams ( - iPolyNumBasis, - sdic, - rssc - ), - true, - false - ) - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - StretchEstimationTestSequence(); - } -} diff --git a/org/drip/sample/stretch/KnotInsertionSequenceAdjuster.java b/org/drip/sample/stretch/KnotInsertionSequenceAdjuster.java deleted file mode 100644 index 7c4e179..0000000 --- a/org/drip/sample/stretch/KnotInsertionSequenceAdjuster.java +++ /dev/null @@ -1,344 +0,0 @@ - -package org.drip.sample.stretch; - -import org.drip.function.r1tor1.*; -import org.drip.quant.common.FormatUtil; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * KnotInsertionSequenceAdjuster demonstrates the Stretch Manipulation and Adjustment API. It shows the - * following: - * - Construct a simple Base Stretch. - * - Clip a left Portion of the Stretch to construct a left-clipped Stretch. - * - Clip a right Portion of the Stretch to construct a tight-clipped Stretch. - * - Compare the values across all the stretches to establish a) the continuity in the base smoothness is, - * preserved, and b) Continuity across the predictor ordinate for the implied response value is also - * preserved. - * - * @author Lakshmi Krishnamurthy - */ - -public class KnotInsertionSequenceAdjuster { - - /* - * Build Polynomial Segment Control Parameters - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final SegmentCustomBuilderControl PolynomialSegmentControlParams ( - final int iNumBasis, - final SegmentInelasticDesignControl sdic, - final ResponseScalingShapeControl rssc) - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (iNumBasis), - sdic, - rssc, - null - ); - } - - /* - * Basis Spline Stretch Test Sample. Performs the following: - * - Construct the Array of Segment Builder Parameters - one per segment. - * - Construct the Stretch instance. - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final MultiSegmentSequence BasisSplineStretchTest ( - final double[] adblX, - final double[] adblY, - final SegmentCustomBuilderControl scbc) - throws Exception - { - /* - * Array of Segment Builder Parameters - one per segment - */ - - SegmentCustomBuilderControl[] aSCBC = new SegmentCustomBuilderControl[adblX.length - 1]; - - for (int i = 0; i < adblX.length - 1; ++i) - aSCBC[i] = scbc; - - /* - * Construct a Stretch instance - */ - - return MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator ( - "SPLINE_STRETCH", - adblX, // predictors - adblY, // responses - aSCBC, // Basis Segment Builder parameters - null, - BoundarySettings.NaturalStandard(), // Boundary Condition - Natural - MultiSegmentSequence.CALIBRATE // Calibrate the Stretch predictors to the responses - ); - } - - /* - * The Stretch Adjuster Test - this brings it altogether. - */ - - private static final void StretchAdjusterTest() - throws Exception - { - /* - * X predictors - */ - - double[] adblX = new double[] { 1.00, 1.50, 2.00, 3.00, 4.00, 5.00, 6.50, 8.00, 10.00}; - - /* - * Y responses - */ - - double[] adblY = new double[] {25.00, 20.25, 16.00, 9.00, 4.00, 1.00, 0.25, 4.00, 16.00}; - - /* - * Construct a rational shape controller with the shape controller tension of 1. - */ - - double dblShapeControllerTension = 1.; - - ResponseScalingShapeControl rssc = new ResponseScalingShapeControl ( - false, - new QuadraticRationalShapeControl (dblShapeControllerTension) - ); - - /* - * Construct the segment inelastic parameter that is C2 (iK = 2 sets it to C2), with 2nd order - * roughness penalty derivative, and without constraint - */ - - int iK = 2; - int iRoughnessPenaltyDerivativeOrder = 2; - - SegmentInelasticDesignControl sdic = SegmentInelasticDesignControl.Create ( - iK, - iRoughnessPenaltyDerivativeOrder - ); - - /* - * Build the polynomial basis spline segment control parameters, and set up the stretch - */ - - System.out.println (" \n---------- \n POLYNOMIAL \n ---------- \n"); - - int iPolyNumBasis = 4; - - SegmentCustomBuilderControl scbc = PolynomialSegmentControlParams ( - iPolyNumBasis, - sdic, - rssc - ); - - MultiSegmentSequence mssBase = BasisSplineStretchTest ( - adblX, - adblY, - scbc - ); - - /* - * Estimate, compute the segment-by-segment monotonicity and the Stretch Jacobian - */ - - double dblX = mssBase.getLeftPredictorOrdinateEdge(); - - double dblXMax = mssBase.getRightPredictorOrdinateEdge(); - - while (dblX <= dblXMax) { - System.out.println ("Y[" + dblX + "] " + FormatUtil.FormatDouble (mssBase.responseValue (dblX), 1, 2, 1.) + " | " - + mssBase.monotoneType (dblX)); - - System.out.println ("Jacobian Y[" + dblX + "]=" + mssBase.jackDResponseDCalibrationInput (dblX, 1).displayString()); - - dblX += 1.; - } - - /* - * Clip part of the stretch left of the specified predictor ordinate - */ - - System.out.println ("\tSPLINE_STRETCH_BASE DPE: " + mssBase.curvatureDPE()); - - System.out.println (" \n---------- \n LEFT CLIPPED \n ---------- \n"); - - MultiSegmentSequence mssLeftClipped = mssBase.clipLeft ( - "LEFT_CLIP", - 1.66 - ); - - dblX = mssBase.getLeftPredictorOrdinateEdge(); - - /* - * Estimate, compute the segment-by-segment monotonicity and the Stretch Jacobian of the left clipped stretch - */ - - while (dblX <= dblXMax) { - if (mssLeftClipped.in (dblX)) { - System.out.println ("Y[" + dblX + "] " + FormatUtil.FormatDouble (mssLeftClipped.responseValue (dblX), 1, 2, 1.) + " | " - + mssLeftClipped.monotoneType (dblX)); - - System.out.println ("Jacobian Y[" + dblX + "]=" + mssLeftClipped.jackDResponseDCalibrationInput (dblX, 1).displayString()); - } - - dblX += 1.; - } - - /* - * Left clipped stretch DPE - */ - - System.out.println ("\tSPLINE_STRETCH_LEFT DPE: " + mssLeftClipped.curvatureDPE()); - - /* - * Clip part of the stretch right of the specified predictor ordinate - */ - - System.out.println (" \n---------- \n RIGHT CLIPPED \n ---------- \n"); - - MultiSegmentSequence mssRightClipped = mssBase.clipRight ( - "RIGHT_CLIP", - 7.48 - ); - - /* - * Estimate, compute the segment-by-segment monotonicity and the Stretch Jacobian of the right clipped stretch - */ - - dblX = mssBase.getLeftPredictorOrdinateEdge(); - - while (dblX <= dblXMax) { - if (mssRightClipped.in (dblX)) { - System.out.println ("Y[" + dblX + "] " + FormatUtil.FormatDouble (mssRightClipped.responseValue (dblX), 1, 2, 1.) + " | " - + mssRightClipped.monotoneType (dblX)); - - System.out.println ("Jacobian Y[" + dblX + "]=" + mssRightClipped.jackDResponseDCalibrationInput (dblX, 1).displayString()); - } - - dblX += 1.; - } - - /* - * Right clipped stretch DPE - */ - - System.out.println ("\tSPLINE_STRETCH_RIGHT DPE: " + mssRightClipped.curvatureDPE()); - - /* - * Ordered Side by side Comparison of left clipped - unclipped - right clipped response values - */ - - dblX = mssBase.getLeftPredictorOrdinateEdge(); - - dblXMax = mssBase.getRightPredictorOrdinateEdge(); - - System.out.println ("\n-----------------------------------------------------------------------------------------------------"); - - System.out.println (" BASE || LEFT CLIPPED || RIGHT CLIPPED"); - - System.out.println ("-----------------------------------------------------------------------------------------------------"); - - while (dblX <= dblXMax) { - java.lang.String strLeftClippedValue = " "; - java.lang.String strRightClippedValue = " "; - java.lang.String strLeftClippedMonotonocity = " "; - java.lang.String strRightClippedMonotonocity = " "; - - /* - * Unclipped - */ - - java.lang.String strDisplay = "Y[" + FormatUtil.FormatDouble (dblX, 2, 3, 1.) + "] => " - + FormatUtil.FormatDouble (mssBase.responseValue (dblX), 2, 6, 1.) + " | " - + mssBase.monotoneType (dblX); - - /* - * Left clipped - */ - - if (mssLeftClipped.in (dblX)) { - strLeftClippedValue = FormatUtil.FormatDouble (mssLeftClipped.responseValue (dblX), 2, 6, 1.); - - strLeftClippedMonotonocity = mssLeftClipped.monotoneType (dblX).toString(); - } - - /* - * Right clipped - */ - - if (mssRightClipped.in (dblX)) { - strRightClippedValue = FormatUtil.FormatDouble (mssRightClipped.responseValue (dblX), 2, 6, 1.); - - strRightClippedMonotonocity = mssRightClipped.monotoneType (dblX).toString(); - } - - System.out.println (strDisplay + " || " + strLeftClippedValue + " | " + strLeftClippedMonotonocity + - " || " + strRightClippedValue + " | " + strRightClippedMonotonocity); - - dblX += 0.5; - } - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - StretchAdjusterTest(); - } -} diff --git a/org/drip/sample/stretch/KnotInsertionTensionEstimator.java b/org/drip/sample/stretch/KnotInsertionTensionEstimator.java deleted file mode 100644 index fa499c5..0000000 --- a/org/drip/sample/stretch/KnotInsertionTensionEstimator.java +++ /dev/null @@ -1,367 +0,0 @@ - -package org.drip.sample.stretch; - -import org.drip.function.r1tor1.*; -import org.drip.quant.common.FormatUtil; -import org.drip.spline.basis.*; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * KnotInsertionTensionEstimator demonstrates the Stretch builder and usage API. It shows the following: - * - * - Construction of segment control parameters - polynomial (regular/Bernstein) segment control, - * exponential/hyperbolic tension segment control, Kaklis-Pandelis tension segment control. - * - Tension Basis Spline Test using the specified predictor/response set and the array of segment custom - * builder control parameters. - * - Complete the full tension stretch estimation sample test. - * - * @author Lakshmi Krishnamurthy - */ - -public class KnotInsertionTensionEstimator { - - /* - * Build KLK Exponential Tension Segment Control Parameters - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final SegmentCustomBuilderControl KLKExponentialTensionSegmentControlParams ( - final double dblTension, - final SegmentInelasticDesignControl sdic, - final ResponseScalingShapeControl rssc) - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_EXPONENTIAL_TENSION, - new ExponentialTensionSetParams (dblTension), - sdic, - rssc, - null - ); - } - - /* - * Build KLK Hyperbolic Tension Segment Control Parameters - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final SegmentCustomBuilderControl KLKHyperbolicTensionSegmentControlParams ( - final double dblTension, - final SegmentInelasticDesignControl sdic, - final ResponseScalingShapeControl rssc) - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new ExponentialTensionSetParams (dblTension), - sdic, - rssc, - null - ); - } - - /* - * Build KLK Rational Linear Tension Segment Control Parameters - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final SegmentCustomBuilderControl KLKRationalLinearTensionSegmentControlParams ( - final double dblTension, - final SegmentInelasticDesignControl sdic, - final ResponseScalingShapeControl rssc) - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_RATIONAL_LINEAR_TENSION, - new ExponentialTensionSetParams (dblTension), - sdic, - rssc, - null - ); - } - - /* - * Build KLK Rational Quadratic Tension Segment Control Parameters - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final SegmentCustomBuilderControl KLKRationalQuadraticTensionSegmentControlParams ( - final double dblTension, - final SegmentInelasticDesignControl sdic, - final ResponseScalingShapeControl rssc) - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_RATIONAL_QUADRATIC_TENSION, - new ExponentialTensionSetParams (dblTension), - sdic, - rssc, - null - ); - } - - /* - * Tension Basis Spline Test using the specified predictor/response set and the array of segment custom - * builder control parameters. It consists of the following steps: - * - Array of Segment Builder Parameters - one per segment - * - Construct a Stretch instance - * - Estimate, compute the segment-by-segment monotonicity and the Stretch Jacobian - * - Construct a new Stretch instance by inserting a pair of of predictor/response knots - * - Estimate, compute the segment-by-segment monotonicity and the Stretch Jacobian - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final void BasisSplineStretchTest ( - final double[] adblX, - final double[] adblY, - final SegmentCustomBuilderControl scbc) - throws Exception - { - double dblX = 1.; - double dblXMax = 10.; - - /* - * Array of Segment Builder Parameters - one per segment - */ - - SegmentCustomBuilderControl[] aSCBC = new SegmentCustomBuilderControl[adblX.length - 1]; - - for (int i = 0; i < adblX.length - 1; ++i) - aSCBC[i] = scbc; - - /* - * Construct a Stretch instance - */ - - MultiSegmentSequence mss = MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator ( - "SPLINE_STRETCH", - adblX, // predictors - adblY, // responses - aSCBC, // Basis Segment Builder parameters - null, - BoundarySettings.NaturalStandard(), // Boundary Condition - Natural - MultiSegmentSequence.CALIBRATE // Calibrate the Stretch predictors to the responses - ); - - /* - * Estimate, compute the segment-by-segment monotonicity and the Stretch Jacobian - */ - - while (dblX <= dblXMax) { - System.out.println ("Y[" + dblX + "] " + FormatUtil.FormatDouble (mss.responseValue (dblX), 1, 2, 1.) + " | " + - mss.monotoneType (dblX)); - - System.out.println ("\tJacobian Y[" + dblX + "]=" + mss.jackDResponseDCalibrationInput (dblX, 1).displayString()); - - dblX += 1.; - } - - System.out.println ("\t\tSPLINE_STRETCH DPE: " + mss.curvatureDPE()); - - /* - * Construct a new Stretch instance by inserting a pair of of predictor/response knots - */ - - MultiSegmentSequence mssInsert = MultiSegmentSequenceModifier.InsertKnot (mss, - 9., - 10., - BoundarySettings.NaturalStandard(), // Boundary Condition - Natural - MultiSegmentSequence.CALIBRATE // Calibrate the Stretch predictors to the responses - ); - - dblX = 1.; - - /* - * Estimate, compute the sgement-by-segment monotonicty and the Stretch Jacobian - */ - - while (dblX <= dblXMax) { - System.out.println ("Inserted Y[" + dblX + "] " + FormatUtil.FormatDouble (mssInsert.responseValue (dblX), 1, 2, 1.) - + " | " + mssInsert.monotoneType (dblX)); - - dblX += 1.; - } - - System.out.println ("\t\tSPLINE_STRETCH_INSERT DPE: " + mssInsert.curvatureDPE()); - } - - /* - * Complete the full tension stretch estimation sample test by doing the following: - * - Composing the array of predictor/responses - * - Construct a rational shape controller with the desired shape controller tension - * - Construct the Segment Inelastic Parameter that is C2 (iK = 2 sets it to C2), with Second Order - * Curvature Penalty Derivative, and without constraint - * - KLK Hyperbolic Tension Basis Spline Stretch Test - * - KLK Exponential Tension Basis Spline Stretch Test - * - KLK Rational Linear Tension Basis Spline Stretch Test - * - KLK Rational Quadratic Tension Basis Spline Stretch Test - */ - - public static final void TensionStretchEstimationSample() - throws Exception - { - /* - * X predictors - */ - - double[] adblX = new double[] { 1.00, 1.50, 2.00, 3.00, 4.00, 5.00, 6.50, 8.00, 10.00}; - - /* - * Y responses - */ - - double[] adblY = new double[] {25.00, 20.25, 16.00, 9.00, 4.00, 1.00, 0.25, 4.00, 16.00}; - - /* - * Construct a rational shape controller with the shape controller tension of 1. - */ - - double dblShapeControllerTension = 1.; - - ResponseScalingShapeControl rssc = new ResponseScalingShapeControl ( - false, - new LinearRationalShapeControl (dblShapeControllerTension) - ); - - /* - * Construct the Segment Inelastic Parameter that is C2 (iK = 2 sets it to C2), with Second Order - * Curvature Penalty Derivative, and without constraint - */ - - int iK = 2; - int iCurvaturePenaltyDerivativeOrder= 2; - - SegmentInelasticDesignControl segParams = SegmentInelasticDesignControl.Create ( - iK, - iCurvaturePenaltyDerivativeOrder - ); - - double dblKLKTension = 1.; - - /* - * KLK Hyperbolic Tension Basis Spline Stretch Test - */ - - System.out.println (" \n---------- \n KLK HYPERBOLIC TENSION \n ---------- \n"); - - BasisSplineStretchTest ( - adblX, - adblY, - KLKHyperbolicTensionSegmentControlParams ( - dblKLKTension, - segParams, - rssc - ) - ); - - /* - * KLK Exponential Tension Basis Spline Stretch Test - */ - - System.out.println (" \n---------- \n KLK EXPONENTIAL TENSION \n ---------- \n"); - - BasisSplineStretchTest ( - adblX, - adblY, - KLKExponentialTensionSegmentControlParams ( - dblKLKTension, - segParams, - rssc - ) - ); - - /* - * KLK Rational Linear Tension Basis Spline Stretch Test - */ - - System.out.println (" \n---------- \n KLK RATIONAL LINEAR TENSION \n ---------- \n"); - - BasisSplineStretchTest ( - adblX, - adblY, - KLKRationalLinearTensionSegmentControlParams ( - dblKLKTension, - segParams, - rssc - ) - ); - - /* - * KLK Rational Quadratic Tension Basis Spline Stretch Test - */ - - System.out.println (" \n---------- \n KLK RATIONAL QUADRATIC TENSION \n ---------- \n"); - - BasisSplineStretchTest ( - adblX, - adblY, - KLKRationalQuadraticTensionSegmentControlParams ( - dblKLKTension, - segParams, - rssc - ) - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - TensionStretchEstimationSample(); - } -} diff --git a/org/drip/sample/stretch/KnottedRegressionSplineEstimator.java b/org/drip/sample/stretch/KnottedRegressionSplineEstimator.java deleted file mode 100644 index e66f3bf..0000000 --- a/org/drip/sample/stretch/KnottedRegressionSplineEstimator.java +++ /dev/null @@ -1,216 +0,0 @@ - -package org.drip.sample.stretch; - -import org.drip.quant.common.FormatUtil; -import org.drip.spline.basis.*; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * KnottedRegressionSplineEstimator shows the sample construction and usage of Knot-based Regression Splines. - * It demonstrates construction of the segment's predictor ordinate/response value combination, and eventual - * calibration. - * - * @author Lakshmi Krishnamurthy - */ - -public class KnottedRegressionSplineEstimator { - - /* - * Build Polynomial Segment Control Parameters - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final SegmentCustomBuilderControl PolynomialSegmentControlParams ( - final int iNumBasis, - final SegmentInelasticDesignControl sdic) - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (iNumBasis), - sdic, - null, - null - ); - } - - /* - * Basis Spline Stretch Test Sample. Performs the following: - * - Construct the Array of Segment Builder Parameters - one per segment. - * - Construct a Stretch instance using the predictor ordinate array and the Segment Best Fit Response Values. - * - Estimate, compute the segment-by-segment monotonicity and the Stretch Jacobian - * - Compute the Segment Curvature Penalty Estimate. - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final void BasisSplineStretchTest ( - final double[] adblX, - final SegmentCustomBuilderControl scbc, - final StretchBestFitResponse sbfr) - throws Exception - { - double dblX = 1.; - double dblXMax = 10.; - - /* - * Array of Segment Builder Parameters - one per segment - */ - - SegmentCustomBuilderControl[] aSCBC = new SegmentCustomBuilderControl[adblX.length - 1]; - - for (int i = 0; i < adblX.length - 1; ++i) - aSCBC[i] = scbc; - - /* - * Construct a Stretch instance using the predictor ordinate array and the Segment Best Fit Response Values - */ - - MultiSegmentSequence mss = MultiSegmentSequenceBuilder.CreateRegressionSplineEstimator ( - "SPLINE_STRETCH", - adblX, // predictors - aSCBC, // Basis Segment Builder parameters - sbfr, - BoundarySettings.NaturalStandard(), // Boundary Condition - Natural - MultiSegmentSequence.CALIBRATE // Calibrate the Stretch predictors to the responses - ); - - /* - * Estimate, compute the segment-by-segment monotonicity and the Stretch Jacobian - */ - - while (dblX <= dblXMax) { - System.out.println ("Y[" + dblX + "] " + FormatUtil.FormatDouble (mss.responseValue (dblX), 1, 2, 1.) + " | " + - mss.monotoneType (dblX)); - - System.out.println ("\t\tJacobian Y[" + dblX + "]=" + mss.jackDResponseDCalibrationInput (dblX, 1).displayString()); - - dblX += 1.; - } - - /* - * Compute the Segment Curvature Penalty Estimate - */ - - System.out.println ("\tSPLINE_STRETCH DPE: " + mss.curvatureDPE()); - } - - /* - * Bring together to compose the Regression Spline Estimator Test. It is made up of the following steps: - * - Set the Predictor Ordinate Knot Points. - * - Construct a set of Predictor Ordinates, their Responses, and corresponding Weights to serve as - * weighted closeness of fit. - * - Construct the segment inelastic parameter that is C2 (iK = 2 sets it to C2), with 2nd order - * roughness penalty derivative, and without constraint. - * - Basis Spline Stretch Test Using the Segment Best Fit Response. - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final void RegressionSplineEstimatorTest() - throws Exception - { - /* - * Set the Knot Points - */ - - double[] adblX = new double[] { 1.00, 5.00, 10.00}; - - /* - * Construct a set of Predictor Ordinates, their Responses, and corresponding Weights to serve as - * weighted closeness of fit. - */ - - StretchBestFitResponse sbfr = StretchBestFitResponse.Create ( - new double[] { 2.28, 2.52, 2.73, 3.00, 5.50, 8.44, 8.76, 9.08, 9.80, 9.92}, - new double[] {14.27, 12.36, 10.61, 9.25, -0.50, 7.92, 10.07, 12.23, 15.51, 16.36}, - new double[] { 1.09, 0.82, 1.34, 1.10, 0.50, 0.79, 0.65, 0.49, 0.24, 0.21} - ); - - /* - * Construct the segment inelastic parameter that is C2 (iK = 2 sets it to C2), with 2nd order - * roughness penalty derivative, and without constraint - */ - - int iK = 2; - int iRoughnessPenaltyDerivativeOrder = 2; - - SegmentInelasticDesignControl sdic = SegmentInelasticDesignControl.Create ( - iK, - iRoughnessPenaltyDerivativeOrder - ); - - int iPolyNumBasis = 4; - - /* - * Basis Spline Stretch Test Using the Segment Best Fit Response - */ - - BasisSplineStretchTest ( - adblX, - PolynomialSegmentControlParams ( - iPolyNumBasis, - sdic - ), - sbfr - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - RegressionSplineEstimatorTest(); - } -} diff --git a/org/drip/sample/stretch/MultiSpanAggregationEstimator.java b/org/drip/sample/stretch/MultiSpanAggregationEstimator.java deleted file mode 100644 index 2be8e33..0000000 --- a/org/drip/sample/stretch/MultiSpanAggregationEstimator.java +++ /dev/null @@ -1,164 +0,0 @@ - -package org.drip.sample.stretch; - -import java.util.*; - -import org.drip.quant.common.FormatUtil; -import org.drip.spline.basis.PolynomialFunctionSetParams; -import org.drip.spline.grid.*; -import org.drip.spline.params.*; -import org.drip.spline.stretch.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * MultiSpanAggregationEstimator demonstrates the Construction and Usage of the Multiple Span Aggregation - * Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class MultiSpanAggregationEstimator { - - /* - * Build Polynomial Segment Control Parameters. - * - * WARNING: Insufficient Error Checking, so use caution - */ - - private static final SegmentCustomBuilderControl PolynomialSegmentControlParams ( - final int iNumBasis, - final SegmentInelasticDesignControl sdic, - final ResponseScalingShapeControl rssc) - throws Exception - { - return new SegmentCustomBuilderControl ( - MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new PolynomialFunctionSetParams (iNumBasis), - sdic, - rssc, - null - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - double[] adblX = new double[] { 1.00, 1.50, 2.00, 3.00, 4.00, 5.00, 6.50, 8.00, 10.00}; - double[] adblY1 = new double[] {25.00, 20.25, 16.00, 9.00, 4.00, 1.00, 0.25, 4.00, 16.00}; - double[] adblY2 = new double[] {27.00, 22.25, 18.00, 11.00, 6.00, 3.00, 2.25, 6.00, 18.00}; - - SegmentCustomBuilderControl scbc = PolynomialSegmentControlParams ( - 4, - SegmentInelasticDesignControl.Create (2, 2), - null - ); - - SegmentCustomBuilderControl[] aSCBC = new SegmentCustomBuilderControl[adblX.length - 1]; - - for (int i = 0; i < adblX.length - 1; ++i) - aSCBC[i] = scbc; - - MultiSegmentSequence mss1 = MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator ( - "SPLINE_STRETCH_1", // Name - adblX, // predictors - adblY1, // responses - aSCBC, // Basis Segment Builder parameters - null, // NULL segment Best Fit Response - BoundarySettings.NaturalStandard(), // Boundary Condition - Natural - MultiSegmentSequence.CALIBRATE // Calibrate the Stretch predictors to the responses - ); - - Span span1 = new OverlappingStretchSpan (mss1); - - MultiSegmentSequence mss2 = MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator ( - "SPLINE_STRETCH_2", // Name - adblX, // predictors - adblY2, // responses - aSCBC, // Basis Segment Builder parameters - null, // NULL segment Best Fit Response - BoundarySettings.NaturalStandard(), // Boundary Condition - Natural - MultiSegmentSequence.CALIBRATE // Calibrate the Stretch predictors to the responses - ); - - Span span2 = new OverlappingStretchSpan (mss2); - - List lsWeight = new ArrayList(); - - lsWeight.add (0.14); - - lsWeight.add (0.71); - - List lsSpan = new ArrayList(); - - lsSpan.add (span1); - - lsSpan.add (span2); - - AggregatedSpan ass = new AggregatedSpan ( - lsSpan, - lsWeight - ); - - double dblX = 1.; - double dblXMax = 10.; - - while (dblX <= dblXMax) { - double dblStretchResponse = 0.14 * mss1.responseValue (dblX) + 0.71 * mss2.responseValue (dblX); - - System.out.println ("Y[" + dblX + "] " + - FormatUtil.FormatDouble (ass.calcResponseValue (dblX), 2, 2, 1.) + " | " + - FormatUtil.FormatDouble (dblStretchResponse, 2, 2, 1.) - ); - - dblX += 1.; - } - } -} diff --git a/org/drip/sample/treasury/GovvieBondDefinitions.java b/org/drip/sample/treasury/GovvieBondDefinitions.java deleted file mode 100644 index 73abe47..0000000 --- a/org/drip/sample/treasury/GovvieBondDefinitions.java +++ /dev/null @@ -1,181 +0,0 @@ - -package org.drip.sample.treasury; - -import org.drip.market.issue.*; -import org.drip.service.env.EnvManager; - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * GovvieBondDefinitions contains the Details of the Standard Built-in Govvie Bonds. - * - * @author Lakshmi Krishnamurthy - */ - -public class GovvieBondDefinitions { - - private static final void DisplayDetails ( - final String strTreasuryCode) - { - TreasurySetting ts = TreasurySettingContainer.TreasurySetting (strTreasuryCode); - - System.out.println ( - "\t| " + ts.code() + - " | " + ts.currency() + - " | " + ts.frequency() + - " | " + ts.dayCount() + - " | " + ts.calendar() + " ||" - ); - } - - private static final void DefaultTreasuryCode ( - final String strCurrency) - { - System.out.println ("\t| " + strCurrency + " => " + TreasurySettingContainer.CurrencyBenchmarkCode (strCurrency) + " ||"); - } - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - System.out.println ("\n\t|-------------------------------------||"); - - System.out.println ("\t| BUILT-IN GOVVIE BOND STATIC DETAILS ||"); - - System.out.println ("\t| -------- ------ ---- ------ ------- ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| L -> R ||"); - - System.out.println ("\t| Treasury Code ||"); - - System.out.println ("\t| Currency ||"); - - System.out.println ("\t| Frequency ||"); - - System.out.println ("\t| Day Count ||"); - - System.out.println ("\t| Calendar ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t|-------------------------------------||"); - - DisplayDetails ("AGB"); - - DisplayDetails ("BTPS"); - - DisplayDetails ("CAN"); - - DisplayDetails ("DBR"); - - DisplayDetails ("DGB"); - - DisplayDetails ("FRTR"); - - DisplayDetails ("GGB"); - - DisplayDetails ("GILT"); - - DisplayDetails ("GSWISS"); - - DisplayDetails ("JGB"); - - DisplayDetails ("MBONO"); - - DisplayDetails ("NGB"); - - DisplayDetails ("NZGB"); - - DisplayDetails ("SGB"); - - DisplayDetails ("SPGB"); - - DisplayDetails ("UST"); - - System.out.println ("\t|-------------------------------------||"); - - System.out.println ("\n\n\t|------------||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| GOVVIE ||"); - - System.out.println ("\t| BOND ||"); - - System.out.println ("\t| CURRENCY ||"); - - System.out.println ("\t| DEFAULTS ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t|------------||"); - - DefaultTreasuryCode ("AUD"); - - DefaultTreasuryCode ("CAD"); - - DefaultTreasuryCode ("CHF"); - - DefaultTreasuryCode ("EUR"); - - DefaultTreasuryCode ("GBP"); - - DefaultTreasuryCode ("JPY"); - - DefaultTreasuryCode ("MXN"); - - DefaultTreasuryCode ("NOK"); - - DefaultTreasuryCode ("SEK"); - - DefaultTreasuryCode ("USD"); - - DefaultTreasuryCode ("AUD"); - - System.out.println ("\t|------------||"); - } -} diff --git a/org/drip/sample/treasury/YAS_BTPS.java b/org/drip/sample/treasury/YAS_BTPS.java deleted file mode 100644 index f0f9756..0000000 --- a/org/drip/sample/treasury/YAS_BTPS.java +++ /dev/null @@ -1,392 +0,0 @@ - -package org.drip.sample.treasury; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.creator.*; -import org.drip.product.credit.BondComponent; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * YAS_BTPS contains the sample demonstrating the replication of Bloomberg's Italian EUR Govvie Bond YAS - * Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class YAS_BTPS { - - private static BondComponent TSYBond ( - final JulianDate dtEffective, - final JulianDate dtMaturity, - final int iFreq, - final String strDayCount, - final String strCurrency, - final double dblCoupon) - throws Exception - { - return BondBuilder.CreateSimpleFixed ( - "BTPS " + FormatUtil.FormatDouble (dblCoupon, 1, 2, 100.) + " " + dtMaturity, - strCurrency, - "", - dblCoupon, - iFreq, - strDayCount, - dtEffective, - dtMaturity, - null, - null - ); - } - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Sample demonstrating building of rates curve from cash/future/swaps - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static MergedDiscountForwardCurve BuildRatesCurveFromInstruments ( - final JulianDate dtStart, - final String[] astrCashTenor, - final double[] adblCashRate, - final String[] astrIRSTenor, - final double[] adblIRSRate, - final double dblBump, - final String strCurrency) - throws Exception - { - int iNumDCInstruments = astrCashTenor.length + adblIRSRate.length; - int aiDate[] = new int[iNumDCInstruments]; - double adblRate[] = new double[iNumDCInstruments]; - String astrCalibMeasure[] = new String[iNumDCInstruments]; - double adblCompCalibValue[] = new double[iNumDCInstruments]; - CalibratableComponent aCompCalib[] = new CalibratableComponent[iNumDCInstruments]; - - // Cash Calibration - - JulianDate dtCashEffective = dtStart.addBusDays ( - 1, - strCurrency - ); - - for (int i = 0; i < astrCashTenor.length; ++i) { - astrCalibMeasure[i] = "Rate"; - adblRate[i] = java.lang.Double.NaN; - adblCompCalibValue[i] = adblCashRate[i] + dblBump; - - aCompCalib[i] = SingleStreamComponentBuilder.Deposit ( - dtCashEffective, - new JulianDate (aiDate[i] = dtCashEffective.addTenor (astrCashTenor[i]).julian()), - ForwardLabel.Create ( - strCurrency, - astrCashTenor[i] - ) - ); - } - - // IRS Calibration - - JulianDate dtIRSEffective = dtStart.addBusDays (2, strCurrency); - - for (int i = 0; i < astrIRSTenor.length; ++i) { - astrCalibMeasure[i + astrCashTenor.length] = "Rate"; - adblRate[i + astrCashTenor.length] = java.lang.Double.NaN; - adblCompCalibValue[i + astrCashTenor.length] = adblIRSRate[i] + dblBump; - - aiDate[i + astrCashTenor.length] = dtIRSEffective.addTenor (astrIRSTenor[i]).julian(); - - aCompCalib[i + astrCashTenor.length] = OTCIRS ( - dtIRSEffective, - strCurrency, - astrIRSTenor[i], - 0. - ); - } - - /* - * Build the IR curve from the components, their calibration measures, and their calibration quotes. - */ - - return ScenarioDiscountCurveBuilder.NonlinearBuild ( - dtStart, - strCurrency, - aCompCalib, - adblCompCalibValue, - astrCalibMeasure, - null - ); - } - - private static final MergedDiscountForwardCurve FundingCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrCashTenor = new String[] {"3M"}; - double[] adblCashRate = new double[] {0.00276}; - String[] astrIRSTenor = new String[] { "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", - "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y"}; - double[] adblIRSRate = new double[] {0.00367, 0.00533, 0.00843, 0.01238, 0.01609, 0.01926, 0.02191, - 0.02406, 0.02588, 0.02741, 0.02870, 0.02982, 0.03208, 0.03372, 0.03445, 0.03484, 0.03501, 0.03484}; - - return BuildRatesCurveFromInstruments ( - dtSpot, - astrCashTenor, - adblCashRate, - astrIRSTenor, - adblIRSRate, - 0., - strCurrency - ); - } - - private static final void TSYMetrics ( - final BondComponent tsyBond, - final double dblNotional, - final JulianDate dtSettle, - final CurveSurfaceQuoteContainer mktParams, - final double dblCleanPrice) - throws Exception - { - double dblAccrued = tsyBond.accrued ( - dtSettle.julian(), - null - ); - - double dblYield = tsyBond.yieldFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblModifiedDuration = tsyBond.modifiedDurationFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblRisk = tsyBond.yield01FromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblConvexity = tsyBond.convexityFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - JulianDate dtPreviousCouponDate = tsyBond.previousCouponDate (dtSettle); - - System.out.println(); - - System.out.println ("\t\t" + tsyBond.name()); - - System.out.println ("\tPrice : " + FormatUtil.FormatDouble (dblCleanPrice, 1, 4, 100.)); - - System.out.println ("\tYield : " + FormatUtil.FormatDouble (dblYield, 1, 4, 100.) + "%"); - - System.out.println ("\tSettle : " + dtSettle); - - System.out.println(); - - System.out.println ("\tModified Duration : " + FormatUtil.FormatDouble (dblModifiedDuration, 1, 4, 10000.)); - - System.out.println ("\tRisk : " + FormatUtil.FormatDouble (dblRisk, 1, 4, 10000.)); - - System.out.println ("\tConvexity : " + FormatUtil.FormatDouble (dblConvexity * dblNotional, 1, 4, 1.)); - - System.out.println ("\tDV01 : " + FormatUtil.FormatDouble (dblRisk * dblNotional, 1, 0, 1.)); - - System.out.println(); - - System.out.println ("\tPrevious Coupon Date : " + dtPreviousCouponDate); - - System.out.println ("\tFace : " + FormatUtil.FormatDouble (dblNotional, 1, 2, 1.)); - - System.out.println ("\tPrincipal : " + FormatUtil.FormatDouble (dblCleanPrice * dblNotional, 1, 2, 1.)); - - System.out.println ("\tAccrued : " + FormatUtil.FormatDouble (dblAccrued * dblNotional, 1, 2, 1.)); - - System.out.println ("\tTotal : " + FormatUtil.FormatDouble ((dblCleanPrice + dblAccrued) * dblNotional, 1, 2, 1.)); - - if (null != dtPreviousCouponDate) - System.out.println ("\tAccrual Days : " + (dtSettle.julian() - dtPreviousCouponDate.julian())); - } - - public static final void main ( - final String astrArgs[]) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2015, - DateUtil.MAY, - 5 - ); - - JulianDate dtEffective = DateUtil.CreateFromYMD ( - 2013, - DateUtil.AUGUST, - 25 - ); - - JulianDate dtMaturity = DateUtil.CreateFromYMD ( - 2024, - DateUtil.MARCH, - 1 - ); - - int iFreq = 2; - String strDayCount = "DCAct_Act_UST"; - String strCurrency = "EUR"; - double dblCoupon = 0.045; - double dblNotional = 1000000.; - double dblCleanPrice = 1.2562; - - BondComponent tsyBond = TSYBond ( - dtEffective, - dtMaturity, - iFreq, - strDayCount, - strCurrency, - dblCoupon - ); - - System.out.println(); - - System.out.println ("\tEffective : " + tsyBond.effectiveDate()); - - System.out.println ("\tMaturity : " + tsyBond.maturityDate()); - - System.out.println(); - - MergedDiscountForwardCurve dc = FundingCurve ( - dtSpot, - strCurrency - ); - - TSYMetrics ( - tsyBond, - dblNotional, - dtSpot, - MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ), - dblCleanPrice - ); - - System.out.println ("\n\tCashflow\n\t--------"); - - for (CompositePeriod p : tsyBond.couponPeriods()) - System.out.println ("\t\t" + - DateUtil.YYYYMMDD (p.startDate()) + " | " + - DateUtil.YYYYMMDD (p.endDate()) + " | " + - DateUtil.YYYYMMDD (p.payDate()) + " | " + - FormatUtil.FormatDouble (p.couponDCF(), 1, 4, 1.) + " ||" - ); - } -} diff --git a/org/drip/sample/treasury/YAS_CAN.java b/org/drip/sample/treasury/YAS_CAN.java deleted file mode 100644 index 4d58e82..0000000 --- a/org/drip/sample/treasury/YAS_CAN.java +++ /dev/null @@ -1,391 +0,0 @@ - -package org.drip.sample.treasury; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.creator.*; -import org.drip.product.credit.BondComponent; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * YAS_CAN contains the sample demonstrating the replication of Bloomberg's Canadian Govvie CAD Bond YAS - * Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class YAS_CAN { - - private static BondComponent TSYBond ( - final JulianDate dtEffective, - final JulianDate dtMaturity, - final int iFreq, - final String strDayCount, - final String strCurrency, - final double dblCoupon) - throws Exception - { - return BondBuilder.CreateSimpleFixed ( - "CAN " + FormatUtil.FormatDouble (dblCoupon, 1, 2, 100.) + " " + dtMaturity, - strCurrency, - "", - dblCoupon, - iFreq, - strDayCount, - dtEffective, - dtMaturity, - null, - null - ); - } - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Sample demonstrating building of rates curve from cash/future/swaps - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static MergedDiscountForwardCurve BuildRatesCurveFromInstruments ( - final JulianDate dtStart, - final String[] astrCashTenor, - final double[] adblCashRate, - final String[] astrIRSTenor, - final double[] adblIRSRate, - final double dblBump, - final String strCurrency) - throws Exception - { - int iNumDCInstruments = astrCashTenor.length + adblIRSRate.length; - int aiDate[] = new int[iNumDCInstruments]; - double adblRate[] = new double[iNumDCInstruments]; - String astrCalibMeasure[] = new String[iNumDCInstruments]; - double adblCompCalibValue[] = new double[iNumDCInstruments]; - CalibratableComponent aCompCalib[] = new CalibratableComponent[iNumDCInstruments]; - - // Cash Calibration - - JulianDate dtCashEffective = dtStart.addBusDays ( - 1, - strCurrency - ); - - for (int i = 0; i < astrCashTenor.length; ++i) { - astrCalibMeasure[i] = "Rate"; - adblRate[i] = java.lang.Double.NaN; - adblCompCalibValue[i] = adblCashRate[i] + dblBump; - - aCompCalib[i] = SingleStreamComponentBuilder.Deposit ( - dtCashEffective, - new JulianDate (aiDate[i] = dtCashEffective.addTenor (astrCashTenor[i]).julian()), - ForwardLabel.Create ( - strCurrency, - astrCashTenor[i] - ) - ); - } - - // IRS Calibration - - JulianDate dtIRSEffective = dtStart.addBusDays (2, strCurrency); - - for (int i = 0; i < astrIRSTenor.length; ++i) { - astrCalibMeasure[i + astrCashTenor.length] = "Rate"; - adblRate[i + astrCashTenor.length] = java.lang.Double.NaN; - adblCompCalibValue[i + astrCashTenor.length] = adblIRSRate[i] + dblBump; - - aiDate[i + astrCashTenor.length] = dtIRSEffective.addTenor (astrIRSTenor[i]).julian(); - - aCompCalib[i + astrCashTenor.length] = OTCIRS ( - dtIRSEffective, - strCurrency, - astrIRSTenor[i], - 0. - ); - } - - /* - * Build the IR curve from the components, their calibration measures, and their calibration quotes. - */ - - return ScenarioDiscountCurveBuilder.NonlinearBuild ( - dtStart, - strCurrency, - aCompCalib, - adblCompCalibValue, - astrCalibMeasure, - null - ); - } - - private static final MergedDiscountForwardCurve FundingCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrCashTenor = new String[] {"3M"}; - double[] adblCashRate = new double[] {0.00276}; - String[] astrIRSTenor = new String[] { "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", - "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y"}; - double[] adblIRSRate = new double[] {0.00367, 0.00533, 0.00843, 0.01238, 0.01609, 0.01926, 0.02191, - 0.02406, 0.02588, 0.02741, 0.02870, 0.02982, 0.03208, 0.03372, 0.03445, 0.03484, 0.03501, 0.03484}; - - return BuildRatesCurveFromInstruments ( - dtSpot, - astrCashTenor, - adblCashRate, - astrIRSTenor, - adblIRSRate, - 0., - strCurrency - ); - } - - private static final void TSYMetrics ( - final BondComponent tsyBond, - final double dblNotional, - final JulianDate dtSettle, - final CurveSurfaceQuoteContainer mktParams, - final double dblCleanPrice) - throws Exception - { - double dblAccrued = tsyBond.accrued ( - dtSettle.julian(), - null - ); - - double dblYield = tsyBond.yieldFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblModifiedDuration = tsyBond.modifiedDurationFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblRisk = tsyBond.yield01FromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblConvexity = tsyBond.convexityFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - JulianDate dtPreviousCouponDate = tsyBond.previousCouponDate (dtSettle); - - System.out.println(); - - System.out.println ("\t\t" + tsyBond.name()); - - System.out.println ("\tPrice : " + FormatUtil.FormatDouble (dblCleanPrice, 1, 4, 100.)); - - System.out.println ("\tYield : " + FormatUtil.FormatDouble (dblYield, 1, 4, 100.) + "%"); - - System.out.println ("\tSettle : " + dtSettle); - - System.out.println(); - - System.out.println ("\tModified Duration : " + FormatUtil.FormatDouble (dblModifiedDuration, 1, 4, 10000.)); - - System.out.println ("\tRisk : " + FormatUtil.FormatDouble (dblRisk, 1, 4, 10000.)); - - System.out.println ("\tConvexity : " + FormatUtil.FormatDouble (dblConvexity * dblNotional, 1, 4, 1.)); - - System.out.println ("\tDV01 : " + FormatUtil.FormatDouble (dblRisk * dblNotional, 1, 0, 1.)); - - System.out.println(); - - System.out.println ("\tPrevious Coupon Date : " + dtPreviousCouponDate); - - System.out.println ("\tFace : " + FormatUtil.FormatDouble (dblNotional, 1, 2, 1.)); - - System.out.println ("\tPrincipal : " + FormatUtil.FormatDouble (dblCleanPrice * dblNotional, 1, 2, 1.)); - - System.out.println ("\tAccrued : " + FormatUtil.FormatDouble (dblAccrued * dblNotional, 1, 2, 1.)); - - System.out.println ("\tTotal : " + FormatUtil.FormatDouble ((dblCleanPrice + dblAccrued) * dblNotional, 1, 2, 1.)); - - System.out.println ("\tAccrual Days : " + (dtSettle.julian() - dtPreviousCouponDate.julian())); - } - - public static final void main ( - final String astrArgs[]) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2015, - DateUtil.MAY, - 1 - ); - - JulianDate dtEffective = DateUtil.CreateFromYMD ( - 2012, - DateUtil.JULY, - 30 - ); - - JulianDate dtMaturity = DateUtil.CreateFromYMD ( - 2023, - DateUtil.JUNE, - 1 - ); - - int iFreq = 2; - String strDayCount = "DCAct_Act_UST"; - String strCurrency = "CAD"; - double dblCoupon = 0.015; - double dblNotional = 1000000.; - double dblCleanPrice = 1.002; - - BondComponent tsyBond = TSYBond ( - dtEffective, - dtMaturity, - iFreq, - strDayCount, - strCurrency, - dblCoupon - ); - - System.out.println(); - - System.out.println ("\tEffective : " + tsyBond.effectiveDate()); - - System.out.println ("\tMaturity : " + tsyBond.maturityDate()); - - System.out.println(); - - MergedDiscountForwardCurve dc = FundingCurve ( - dtSpot, - strCurrency - ); - - TSYMetrics ( - tsyBond, - dblNotional, - dtSpot, - MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ), - dblCleanPrice - ); - - System.out.println ("\n\tCashflow\n\t--------"); - - for (CompositePeriod p : tsyBond.couponPeriods()) - System.out.println ("\t\t" + - DateUtil.YYYYMMDD (p.startDate()) + " | " + - DateUtil.YYYYMMDD (p.endDate()) + " | " + - DateUtil.YYYYMMDD (p.payDate()) + " | " + - FormatUtil.FormatDouble (p.couponDCF(), 1, 4, 1.) + " ||" - ); - } -} diff --git a/org/drip/sample/treasury/YAS_DBR.java b/org/drip/sample/treasury/YAS_DBR.java deleted file mode 100644 index e8b4848..0000000 --- a/org/drip/sample/treasury/YAS_DBR.java +++ /dev/null @@ -1,382 +0,0 @@ - -package org.drip.sample.treasury; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.creator.*; -import org.drip.product.credit.BondComponent; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * YAS_DBR contains the sample demonstrating the replication of Bloomberg's Deutsche EUR BUND YAS - * Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class YAS_DBR { - - private static BondComponent TSYBond ( - final JulianDate dtEffective, - final JulianDate dtMaturity, - final int iFreq, - final String strCurrency, - final double dblCoupon) - throws Exception - { - return BondBuilder.CreateSimpleFixed ( - "DBR_" + dtMaturity, - strCurrency, - "", - dblCoupon, - iFreq, - "DCAct_Act_UST", - dtEffective, - dtMaturity, - null, - null - ); - } - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Sample demonstrating building of rates curve from cash/future/swaps - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static MergedDiscountForwardCurve BuildRatesCurveFromInstruments ( - final JulianDate dtStart, - final String[] astrCashTenor, - final double[] adblCashRate, - final String[] astrIRSTenor, - final double[] adblIRSRate, - final double dblBump, - final String strCurrency) - throws Exception - { - int iNumDCInstruments = astrCashTenor.length + adblIRSRate.length; - int aiDate[] = new int[iNumDCInstruments]; - double adblRate[] = new double[iNumDCInstruments]; - String astrCalibMeasure[] = new String[iNumDCInstruments]; - double adblCompCalibValue[] = new double[iNumDCInstruments]; - CalibratableComponent aCompCalib[] = new CalibratableComponent[iNumDCInstruments]; - - // Cash Calibration - - JulianDate dtCashEffective = dtStart.addBusDays ( - 1, - strCurrency - ); - - for (int i = 0; i < astrCashTenor.length; ++i) { - astrCalibMeasure[i] = "Rate"; - adblRate[i] = java.lang.Double.NaN; - adblCompCalibValue[i] = adblCashRate[i] + dblBump; - - aCompCalib[i] = SingleStreamComponentBuilder.Deposit ( - dtCashEffective, - new JulianDate (aiDate[i] = dtCashEffective.addTenor (astrCashTenor[i]).julian()), - ForwardLabel.Create ( - strCurrency, - astrCashTenor[i] - ) - ); - } - - // IRS Calibration - - JulianDate dtIRSEffective = dtStart.addBusDays (2, strCurrency); - - for (int i = 0; i < astrIRSTenor.length; ++i) { - astrCalibMeasure[i + astrCashTenor.length] = "Rate"; - adblRate[i + astrCashTenor.length] = java.lang.Double.NaN; - adblCompCalibValue[i + astrCashTenor.length] = adblIRSRate[i] + dblBump; - - aiDate[i + astrCashTenor.length] = dtIRSEffective.addTenor (astrIRSTenor[i]).julian(); - - aCompCalib[i + astrCashTenor.length] = OTCIRS ( - dtIRSEffective, - strCurrency, - astrIRSTenor[i], - 0. - ); - } - - /* - * Build the IR curve from the components, their calibration measures, and their calibration quotes. - */ - - return ScenarioDiscountCurveBuilder.NonlinearBuild ( - dtStart, - strCurrency, - aCompCalib, - adblCompCalibValue, - astrCalibMeasure, - null - ); - } - - private static final MergedDiscountForwardCurve FundingCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrCashTenor = new String[] {"3M"}; - double[] adblCashRate = new double[] {0.00276}; - String[] astrIRSTenor = new String[] { "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", - "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y"}; - double[] adblIRSRate = new double[] {0.00367, 0.00533, 0.00843, 0.01238, 0.01609, 0.01926, 0.02191, - 0.02406, 0.02588, 0.02741, 0.02870, 0.02982, 0.03208, 0.03372, 0.03445, 0.03484, 0.03501, 0.03484}; - - return BuildRatesCurveFromInstruments ( - dtSpot, - astrCashTenor, - adblCashRate, - astrIRSTenor, - adblIRSRate, - 0., - strCurrency - ); - } - - private static final void TSYMetrics ( - final BondComponent tsyBond, - final double dblNotional, - final JulianDate dtSettle, - final CurveSurfaceQuoteContainer mktParams, - final double dblCleanPrice) - throws Exception - { - double dblAccrued = tsyBond.accrued ( - dtSettle.julian(), - null - ); - - double dblYield = tsyBond.yieldFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblModifiedDuration = tsyBond.modifiedDurationFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblRisk = tsyBond.yield01FromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblConvexity = tsyBond.convexityFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - // double dblPreviousCouponDate = tsyBond.previousCouponRate (dtSettle, mktParams); - - System.out.println(); - - System.out.println ("\tPrice : " + FormatUtil.FormatDouble (dblCleanPrice, 1, 4, 100.)); - - System.out.println ("\tYield : " + FormatUtil.FormatDouble (dblYield, 1, 4, 100.) + "%"); - - System.out.println(); - - System.out.println ("\tModified Duration : " + FormatUtil.FormatDouble (dblModifiedDuration, 1, 4, 10000.)); - - System.out.println ("\tRisk : " + FormatUtil.FormatDouble (dblRisk, 1, 4, 10000.)); - - System.out.println ("\tConvexity : " + FormatUtil.FormatDouble (dblConvexity * dblNotional, 1, 4, 1.)); - - System.out.println ("\tDV01 : " + FormatUtil.FormatDouble (dblRisk * dblNotional, 1, 0, 1.)); - - System.out.println(); - - // System.out.println ("\tPrevious Coupon Date : " + new JulianDate (dblPreviousCouponDate)); - - System.out.println ("\tFace : " + FormatUtil.FormatDouble (dblNotional, 1, 2, 1.)); - - System.out.println ("\tPrincipal : " + FormatUtil.FormatDouble (dblCleanPrice * dblNotional, 1, 2, 1.)); - - System.out.println ("\tAccrued : " + FormatUtil.FormatDouble (dblAccrued * dblNotional, 1, 2, 1.)); - - // System.out.println ("\tAccrual Days : " + (dtSettle.julian() - dblPreviousCouponDate)); - } - - public static final void main ( - final String astrArgs[]) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2015, - DateUtil.MAY, - 5 - ); - - JulianDate dtEffective = DateUtil.CreateFromYMD ( - 2015, - DateUtil.FEBRUARY, - 15 - ); - - JulianDate dtMaturity = DateUtil.CreateFromYMD ( - 2024, - DateUtil.FEBRUARY, - 15 - ); - - int iFreq = 1; - String strCurrency = "EUR"; - double dblCoupon = 0.0175; - double dblNotional = 1000000.; - double dblCleanPrice = 1.13; - - BondComponent tsyBond = TSYBond ( - dtEffective, - dtMaturity, - iFreq, - strCurrency, - dblCoupon - ); - - System.out.println(); - - System.out.println ("\tEffective : " + tsyBond.effectiveDate()); - - System.out.println ("\tMaturity : " + tsyBond.maturityDate()); - - System.out.println(); - - MergedDiscountForwardCurve dc = FundingCurve ( - dtSpot, - strCurrency - ); - - TSYMetrics ( - tsyBond, - dblNotional, - dtSpot, - MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ), - dblCleanPrice - ); - - System.out.println ("\n\tCashflow\n\t--------"); - - for (CompositePeriod p : tsyBond.couponPeriods()) - System.out.println ("\t\t" + - DateUtil.YYYYMMDD (p.startDate()) + " | " + - DateUtil.YYYYMMDD (p.endDate()) + " | " + - DateUtil.YYYYMMDD (p.payDate()) + " | " + - FormatUtil.FormatDouble (p.couponDCF(), 1, 4, 1.) + " ||" - ); - } -} diff --git a/org/drip/sample/treasury/YAS_FRTR.java b/org/drip/sample/treasury/YAS_FRTR.java deleted file mode 100644 index de55e6c..0000000 --- a/org/drip/sample/treasury/YAS_FRTR.java +++ /dev/null @@ -1,392 +0,0 @@ - -package org.drip.sample.treasury; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.creator.*; -import org.drip.product.credit.BondComponent; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * YAS_FRTR contains the sample demonstrating the replication of Bloomberg's French Govvie EUR YAS - * Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class YAS_FRTR{ - - private static BondComponent TSYBond ( - final JulianDate dtEffective, - final JulianDate dtMaturity, - final int iFreq, - final String strDayCount, - final String strCurrency, - final double dblCoupon) - throws Exception - { - return BondBuilder.CreateSimpleFixed ( - "FRTR " + FormatUtil.FormatDouble (dblCoupon, 1, 2, 100.) + " " + dtMaturity, - strCurrency, - "", - dblCoupon, - iFreq, - strDayCount, - dtEffective, - dtMaturity, - null, - null - ); - } - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Sample demonstrating building of rates curve from cash/future/swaps - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static MergedDiscountForwardCurve BuildRatesCurveFromInstruments ( - final JulianDate dtStart, - final String[] astrCashTenor, - final double[] adblCashRate, - final String[] astrIRSTenor, - final double[] adblIRSRate, - final double dblBump, - final String strCurrency) - throws Exception - { - int iNumDCInstruments = astrCashTenor.length + adblIRSRate.length; - int aiDate[] = new int[iNumDCInstruments]; - double adblRate[] = new double[iNumDCInstruments]; - String astrCalibMeasure[] = new String[iNumDCInstruments]; - double adblCompCalibValue[] = new double[iNumDCInstruments]; - CalibratableComponent aCompCalib[] = new CalibratableComponent[iNumDCInstruments]; - - // Cash Calibration - - JulianDate dtCashEffective = dtStart.addBusDays ( - 1, - strCurrency - ); - - for (int i = 0; i < astrCashTenor.length; ++i) { - astrCalibMeasure[i] = "Rate"; - adblRate[i] = java.lang.Double.NaN; - adblCompCalibValue[i] = adblCashRate[i] + dblBump; - - aCompCalib[i] = SingleStreamComponentBuilder.Deposit ( - dtCashEffective, - new JulianDate (aiDate[i] = dtCashEffective.addTenor (astrCashTenor[i]).julian()), - ForwardLabel.Create ( - strCurrency, - astrCashTenor[i] - ) - ); - } - - // IRS Calibration - - JulianDate dtIRSEffective = dtStart.addBusDays (2, strCurrency); - - for (int i = 0; i < astrIRSTenor.length; ++i) { - astrCalibMeasure[i + astrCashTenor.length] = "Rate"; - adblRate[i + astrCashTenor.length] = java.lang.Double.NaN; - adblCompCalibValue[i + astrCashTenor.length] = adblIRSRate[i] + dblBump; - - aiDate[i + astrCashTenor.length] = dtIRSEffective.addTenor (astrIRSTenor[i]).julian(); - - aCompCalib[i + astrCashTenor.length] = OTCIRS ( - dtIRSEffective, - strCurrency, - astrIRSTenor[i], - 0. - ); - } - - /* - * Build the IR curve from the components, their calibration measures, and their calibration quotes. - */ - - return ScenarioDiscountCurveBuilder.NonlinearBuild ( - dtStart, - strCurrency, - aCompCalib, - adblCompCalibValue, - astrCalibMeasure, - null - ); - } - - private static final MergedDiscountForwardCurve FundingCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrCashTenor = new String[] {"3M"}; - double[] adblCashRate = new double[] {0.00276}; - String[] astrIRSTenor = new String[] { "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", - "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y"}; - double[] adblIRSRate = new double[] {0.00367, 0.00533, 0.00843, 0.01238, 0.01609, 0.01926, 0.02191, - 0.02406, 0.02588, 0.02741, 0.02870, 0.02982, 0.03208, 0.03372, 0.03445, 0.03484, 0.03501, 0.03484}; - - return BuildRatesCurveFromInstruments ( - dtSpot, - astrCashTenor, - adblCashRate, - astrIRSTenor, - adblIRSRate, - 0., - strCurrency - ); - } - - private static final void TSYMetrics ( - final BondComponent tsyBond, - final double dblNotional, - final JulianDate dtSettle, - final CurveSurfaceQuoteContainer mktParams, - final double dblCleanPrice) - throws Exception - { - double dblAccrued = tsyBond.accrued ( - dtSettle.julian(), - null - ); - - double dblYield = tsyBond.yieldFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblModifiedDuration = tsyBond.modifiedDurationFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblRisk = tsyBond.yield01FromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblConvexity = tsyBond.convexityFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - JulianDate dtPreviousCouponDate = tsyBond.previousCouponDate (dtSettle); - - System.out.println(); - - System.out.println ("\t\t" + tsyBond.name()); - - System.out.println ("\tPrice : " + FormatUtil.FormatDouble (dblCleanPrice, 1, 4, 100.)); - - System.out.println ("\tYield : " + FormatUtil.FormatDouble (dblYield, 1, 4, 100.) + "%"); - - System.out.println ("\tSettle : " + dtSettle); - - System.out.println(); - - System.out.println ("\tModified Duration : " + FormatUtil.FormatDouble (dblModifiedDuration, 1, 4, 10000.)); - - System.out.println ("\tRisk : " + FormatUtil.FormatDouble (dblRisk, 1, 4, 10000.)); - - System.out.println ("\tConvexity : " + FormatUtil.FormatDouble (dblConvexity * dblNotional, 1, 4, 1.)); - - System.out.println ("\tDV01 : " + FormatUtil.FormatDouble (dblRisk * dblNotional, 1, 0, 1.)); - - System.out.println(); - - System.out.println ("\tPrevious Coupon Date : " + dtPreviousCouponDate); - - System.out.println ("\tFace : " + FormatUtil.FormatDouble (dblNotional, 1, 2, 1.)); - - System.out.println ("\tPrincipal : " + FormatUtil.FormatDouble (dblCleanPrice * dblNotional, 1, 2, 1.)); - - System.out.println ("\tAccrued : " + FormatUtil.FormatDouble (dblAccrued * dblNotional, 1, 2, 1.)); - - System.out.println ("\tTotal : " + FormatUtil.FormatDouble ((dblCleanPrice + dblAccrued) * dblNotional, 1, 2, 1.)); - - if (null != dtPreviousCouponDate) - System.out.println ("\tAccrual Days : " + (dtSettle.julian() - dtPreviousCouponDate.julian())); - } - - public static final void main ( - final String astrArgs[]) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2015, - DateUtil.MAY, - 1 - ); - - JulianDate dtEffective = DateUtil.CreateFromYMD ( - 2013, - DateUtil.OCTOBER, - 31 - ); - - JulianDate dtMaturity = DateUtil.CreateFromYMD ( - 2024, - DateUtil.MAY, - 25 - ); - - int iFreq = 1; - String strDayCount = "DCAct_Act_UST"; - String strCurrency = "EUR"; - double dblCoupon = 0.0225; - double dblNotional = 1000000.; - double dblCleanPrice = 1.152; - - BondComponent tsyBond = TSYBond ( - dtEffective, - dtMaturity, - iFreq, - strDayCount, - strCurrency, - dblCoupon - ); - - System.out.println(); - - System.out.println ("\tEffective : " + tsyBond.effectiveDate()); - - System.out.println ("\tMaturity : " + tsyBond.maturityDate()); - - System.out.println(); - - MergedDiscountForwardCurve dc = FundingCurve ( - dtSpot, - strCurrency - ); - - TSYMetrics ( - tsyBond, - dblNotional, - dtSpot, - MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ), - dblCleanPrice - ); - - System.out.println ("\n\tCashflow\n\t--------"); - - for (CompositePeriod p : tsyBond.couponPeriods()) - System.out.println ("\t\t" + - DateUtil.YYYYMMDD (p.startDate()) + " | " + - DateUtil.YYYYMMDD (p.endDate()) + " | " + - DateUtil.YYYYMMDD (p.payDate()) + " | " + - FormatUtil.FormatDouble (p.couponDCF(), 1, 4, 1.) + " ||" - ); - } -} diff --git a/org/drip/sample/treasury/YAS_GGB.java b/org/drip/sample/treasury/YAS_GGB.java deleted file mode 100644 index e892c90..0000000 --- a/org/drip/sample/treasury/YAS_GGB.java +++ /dev/null @@ -1,391 +0,0 @@ - -package org.drip.sample.treasury; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.creator.*; -import org.drip.product.credit.BondComponent; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * YAS_GGB contains the sample demonstrating the replication of Bloomberg's Greek Govvie EUR Bond YAS - * Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class YAS_GGB { - - private static BondComponent TSYBond ( - final JulianDate dtEffective, - final JulianDate dtMaturity, - final int iFreq, - final String strDayCount, - final String strCurrency, - final double dblCoupon) - throws Exception - { - return BondBuilder.CreateSimpleFixed ( - "GGB " + FormatUtil.FormatDouble (dblCoupon, 1, 2, 100.) + " " + dtMaturity, - strCurrency, - "", - dblCoupon, - iFreq, - strDayCount, - dtEffective, - dtMaturity, - null, - null - ); - } - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Sample demonstrating building of rates curve from cash/future/swaps - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static MergedDiscountForwardCurve BuildRatesCurveFromInstruments ( - final JulianDate dtStart, - final String[] astrCashTenor, - final double[] adblCashRate, - final String[] astrIRSTenor, - final double[] adblIRSRate, - final double dblBump, - final String strCurrency) - throws Exception - { - int iNumDCInstruments = astrCashTenor.length + adblIRSRate.length; - int aiDate[] = new int[iNumDCInstruments]; - double adblRate[] = new double[iNumDCInstruments]; - String astrCalibMeasure[] = new String[iNumDCInstruments]; - double adblCompCalibValue[] = new double[iNumDCInstruments]; - CalibratableComponent aCompCalib[] = new CalibratableComponent[iNumDCInstruments]; - - // Cash Calibration - - JulianDate dtCashEffective = dtStart.addBusDays ( - 1, - strCurrency - ); - - for (int i = 0; i < astrCashTenor.length; ++i) { - astrCalibMeasure[i] = "Rate"; - adblRate[i] = java.lang.Double.NaN; - adblCompCalibValue[i] = adblCashRate[i] + dblBump; - - aCompCalib[i] = SingleStreamComponentBuilder.Deposit ( - dtCashEffective, - new JulianDate (aiDate[i] = dtCashEffective.addTenor (astrCashTenor[i]).julian()), - ForwardLabel.Create ( - strCurrency, - astrCashTenor[i] - ) - ); - } - - // IRS Calibration - - JulianDate dtIRSEffective = dtStart.addBusDays (2, strCurrency); - - for (int i = 0; i < astrIRSTenor.length; ++i) { - astrCalibMeasure[i + astrCashTenor.length] = "Rate"; - adblRate[i + astrCashTenor.length] = java.lang.Double.NaN; - adblCompCalibValue[i + astrCashTenor.length] = adblIRSRate[i] + dblBump; - - aiDate[i + astrCashTenor.length] = dtIRSEffective.addTenor (astrIRSTenor[i]).julian(); - - aCompCalib[i + astrCashTenor.length] = OTCIRS ( - dtIRSEffective, - strCurrency, - astrIRSTenor[i], - 0. - ); - } - - /* - * Build the IR curve from the components, their calibration measures, and their calibration quotes. - */ - - return ScenarioDiscountCurveBuilder.NonlinearBuild ( - dtStart, - strCurrency, - aCompCalib, - adblCompCalibValue, - astrCalibMeasure, - null - ); - } - - private static final MergedDiscountForwardCurve FundingCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrCashTenor = new String[] {"3M"}; - double[] adblCashRate = new double[] {0.00276}; - String[] astrIRSTenor = new String[] { "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", - "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y"}; - double[] adblIRSRate = new double[] {0.00367, 0.00533, 0.00843, 0.01238, 0.01609, 0.01926, 0.02191, - 0.02406, 0.02588, 0.02741, 0.02870, 0.02982, 0.03208, 0.03372, 0.03445, 0.03484, 0.03501, 0.03484}; - - return BuildRatesCurveFromInstruments ( - dtSpot, - astrCashTenor, - adblCashRate, - astrIRSTenor, - adblIRSRate, - 0., - strCurrency - ); - } - - private static final void TSYMetrics ( - final BondComponent tsyBond, - final double dblNotional, - final JulianDate dtSettle, - final CurveSurfaceQuoteContainer mktParams, - final double dblCleanPrice) - throws Exception - { - double dblAccrued = tsyBond.accrued ( - dtSettle.julian(), - null - ); - - double dblYield = tsyBond.yieldFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblModifiedDuration = tsyBond.modifiedDurationFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblRisk = tsyBond.yield01FromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblConvexity = tsyBond.convexityFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - JulianDate dtPreviousCouponDate = tsyBond.previousCouponDate (dtSettle); - - System.out.println(); - - System.out.println ("\t\t" + tsyBond.name()); - - System.out.println ("\tPrice : " + FormatUtil.FormatDouble (dblCleanPrice, 1, 4, 100.)); - - System.out.println ("\tYield : " + FormatUtil.FormatDouble (dblYield, 1, 4, 100.) + "%"); - - System.out.println ("\tSettle : " + dtSettle); - - System.out.println(); - - System.out.println ("\tModified Duration : " + FormatUtil.FormatDouble (dblModifiedDuration, 1, 4, 10000.)); - - System.out.println ("\tRisk : " + FormatUtil.FormatDouble (dblRisk, 1, 4, 10000.)); - - System.out.println ("\tConvexity : " + FormatUtil.FormatDouble (dblConvexity * dblNotional, 1, 4, 1.)); - - System.out.println ("\tDV01 : " + FormatUtil.FormatDouble (dblRisk * dblNotional, 1, 0, 1.)); - - System.out.println(); - - System.out.println ("\tPrevious Coupon Date : " + dtPreviousCouponDate); - - System.out.println ("\tFace : " + FormatUtil.FormatDouble (dblNotional, 1, 2, 1.)); - - System.out.println ("\tPrincipal : " + FormatUtil.FormatDouble (dblCleanPrice * dblNotional, 1, 2, 1.)); - - System.out.println ("\tAccrued : " + FormatUtil.FormatDouble (dblAccrued * dblNotional, 1, 2, 1.)); - - System.out.println ("\tTotal : " + FormatUtil.FormatDouble ((dblCleanPrice + dblAccrued) * dblNotional, 1, 2, 1.)); - - System.out.println ("\tAccrual Days : " + FormatUtil.FormatDouble (dtSettle.julian() - dtPreviousCouponDate.julian(), 1, 0, 1.)); - } - - public static final void main ( - final String astrArgs[]) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2015, - DateUtil.MAY, - 5 - ); - - JulianDate dtEffective = DateUtil.CreateFromYMD ( - 2014, - DateUtil.JULY, - 17 - ); - - JulianDate dtMaturity = DateUtil.CreateFromYMD ( - 2017, - DateUtil.JULY, - 17 - ); - - int iFreq = 1; - String strDayCount = "DCAct_Act_UST"; - String strCurrency = "EUR"; - double dblCoupon = 0.03375; - double dblNotional = 1000000.; - double dblCleanPrice = 0.7578; - - BondComponent tsyBond = TSYBond ( - dtEffective, - dtMaturity, - iFreq, - strDayCount, - strCurrency, - dblCoupon - ); - - System.out.println(); - - System.out.println ("\tEffective : " + tsyBond.effectiveDate()); - - System.out.println ("\tMaturity : " + tsyBond.maturityDate()); - - System.out.println(); - - MergedDiscountForwardCurve dc = FundingCurve ( - dtSpot, - strCurrency - ); - - TSYMetrics ( - tsyBond, - dblNotional, - dtSpot, - MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ), - dblCleanPrice - ); - - System.out.println ("\n\tCashflow\n\t--------"); - - for (CompositePeriod p : tsyBond.couponPeriods()) - System.out.println ("\t\t" + - DateUtil.YYYYMMDD (p.startDate()) + " | " + - DateUtil.YYYYMMDD (p.endDate()) + " | " + - DateUtil.YYYYMMDD (p.payDate()) + " | " + - FormatUtil.FormatDouble (p.couponDCF(), 1, 4, 1.) + " ||" - ); - } -} diff --git a/org/drip/sample/treasury/YAS_GILT.java b/org/drip/sample/treasury/YAS_GILT.java deleted file mode 100644 index 3f26328..0000000 --- a/org/drip/sample/treasury/YAS_GILT.java +++ /dev/null @@ -1,383 +0,0 @@ - -package org.drip.sample.treasury; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.creator.*; -import org.drip.product.credit.BondComponent; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * YAS_GILT contains the sample demonstrating the replication of Bloomberg's GILT YAS functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class YAS_GILT { - - private static BondComponent TSYBond ( - final JulianDate dtEffective, - final JulianDate dtMaturity, - final int iFreq, - final String strCurrency, - final double dblCoupon) - throws Exception - { - return BondBuilder.CreateSimpleFixed ( - "GILT " + dtMaturity, - strCurrency, - "", - dblCoupon, - iFreq, - "DCAct_Act_UST", - dtEffective, - dtMaturity, - null, - null - ); - } - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Sample demonstrating building of rates curve from cash/future/swaps - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static MergedDiscountForwardCurve BuildRatesCurveFromInstruments ( - final JulianDate dtStart, - final String[] astrCashTenor, - final double[] adblCashRate, - final String[] astrIRSTenor, - final double[] adblIRSRate, - final double dblBump, - final String strCurrency) - throws Exception - { - int iNumDCInstruments = astrCashTenor.length + adblIRSRate.length; - int aiDate[] = new int[iNumDCInstruments]; - double adblRate[] = new double[iNumDCInstruments]; - String astrCalibMeasure[] = new String[iNumDCInstruments]; - double adblCompCalibValue[] = new double[iNumDCInstruments]; - CalibratableComponent aCompCalib[] = new CalibratableComponent[iNumDCInstruments]; - - // Cash Calibration - - JulianDate dtCashEffective = dtStart.addBusDays ( - 1, - strCurrency - ); - - for (int i = 0; i < astrCashTenor.length; ++i) { - astrCalibMeasure[i] = "Rate"; - adblRate[i] = java.lang.Double.NaN; - adblCompCalibValue[i] = adblCashRate[i] + dblBump; - - aCompCalib[i] = SingleStreamComponentBuilder.Deposit ( - dtCashEffective, - new JulianDate (aiDate[i] = dtCashEffective.addTenor (astrCashTenor[i]).julian()), - ForwardLabel.Create ( - strCurrency, - astrCashTenor[i] - ) - ); - } - - // IRS Calibration - - JulianDate dtIRSEffective = dtStart.addBusDays (2, strCurrency); - - for (int i = 0; i < astrIRSTenor.length; ++i) { - astrCalibMeasure[i + astrCashTenor.length] = "Rate"; - adblRate[i + astrCashTenor.length] = java.lang.Double.NaN; - adblCompCalibValue[i + astrCashTenor.length] = adblIRSRate[i] + dblBump; - - aiDate[i + astrCashTenor.length] = dtIRSEffective.addTenor (astrIRSTenor[i]).julian(); - - aCompCalib[i + astrCashTenor.length] = OTCIRS ( - dtIRSEffective, - strCurrency, - astrIRSTenor[i], - 0. - ); - } - - /* - * Build the IR curve from the components, their calibration measures, and their calibration quotes. - */ - - return ScenarioDiscountCurveBuilder.NonlinearBuild ( - dtStart, - strCurrency, - aCompCalib, - adblCompCalibValue, - astrCalibMeasure, - null - ); - } - - private static final MergedDiscountForwardCurve FundingCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrCashTenor = new String[] {"3M"}; - double[] adblCashRate = new double[] {0.00276}; - String[] astrIRSTenor = new String[] { "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", - "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y"}; - double[] adblIRSRate = new double[] {0.00367, 0.00533, 0.00843, 0.01238, 0.01609, 0.01926, 0.02191, - 0.02406, 0.02588, 0.02741, 0.02870, 0.02982, 0.03208, 0.03372, 0.03445, 0.03484, 0.03501, 0.03484}; - - return BuildRatesCurveFromInstruments ( - dtSpot, - astrCashTenor, - adblCashRate, - astrIRSTenor, - adblIRSRate, - 0., - strCurrency - ); - } - - private static final void TSYMetrics ( - final BondComponent tsyBond, - final double dblNotional, - final JulianDate dtSettle, - final CurveSurfaceQuoteContainer mktParams, - final double dblCleanPrice) - throws Exception - { - double dblAccrued = tsyBond.accrued ( - dtSettle.julian(), - null - ); - - double dblYield = tsyBond.yieldFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblModifiedDuration = tsyBond.modifiedDurationFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblRisk = tsyBond.yield01FromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblConvexity = tsyBond.convexityFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - // double dblPreviousCouponDate = tsyBond.previousCouponRate (dtSettle, mktParams); - - System.out.println(); - - System.out.println ("\tPrice : " + FormatUtil.FormatDouble (dblCleanPrice, 1, 4, 100.)); - - System.out.println ("\tYield : " + FormatUtil.FormatDouble (dblYield, 1, 4, 100.) + "%"); - - System.out.println(); - - System.out.println ("\tModified Duration : " + FormatUtil.FormatDouble (dblModifiedDuration, 1, 4, 10000.)); - - System.out.println ("\tRisk : " + FormatUtil.FormatDouble (dblRisk, 1, 4, 10000.)); - - System.out.println ("\tConvexity : " + FormatUtil.FormatDouble (dblConvexity * dblNotional, 1, 4, 1.)); - - System.out.println ("\tDV01 : " + FormatUtil.FormatDouble (dblRisk * dblNotional, 1, 0, 1.)); - - System.out.println(); - - // System.out.println ("\tPrevious Coupon Date : " + new JulianDate (dblPreviousCouponDate)); - - System.out.println ("\tFace : " + FormatUtil.FormatDouble (dblNotional, 1, 2, 1.)); - - System.out.println ("\tPrincipal : " + FormatUtil.FormatDouble (dblCleanPrice * dblNotional, 1, 2, 1.)); - - System.out.println ("\tAccrued : " + FormatUtil.FormatDouble (dblAccrued * dblNotional, 1, 2, 1.)); - - System.out.println ("\tTotal : " + FormatUtil.FormatDouble ((dblCleanPrice + dblAccrued) * dblNotional, 1, 2, 1.)); - - // System.out.println ("\tAccrual Days : " + (dtSettle.julian() - dblPreviousCouponDate)); - } - - public static final void main ( - final String astrArgs[]) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2015, - DateUtil.SEPTEMBER, - 8 - ); - - JulianDate dtEffective = DateUtil.CreateFromYMD ( - 2001, - DateUtil.SEPTEMBER, - 27 - ); - - JulianDate dtMaturity = DateUtil.CreateFromYMD ( - 2025, - DateUtil.MARCH, - 7 - ); - - int iFreq = 2; - String strCurrency = "GBP"; - double dblCoupon = 0.05; - double dblNotional = 1000000.; - double dblCleanPrice = 1.28; - - BondComponent tsyBond = TSYBond ( - dtEffective, - dtMaturity, - iFreq, - strCurrency, - dblCoupon - ); - - System.out.println(); - - System.out.println ("\tEffective : " + tsyBond.effectiveDate()); - - System.out.println ("\tMaturity : " + tsyBond.maturityDate()); - - System.out.println(); - - MergedDiscountForwardCurve dc = FundingCurve ( - dtSpot, - strCurrency - ); - - TSYMetrics ( - tsyBond, - dblNotional, - dtSpot, - MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ), - dblCleanPrice - ); - - System.out.println ("\n\tCashflow\n\t--------"); - - for (CompositePeriod p : tsyBond.couponPeriods()) - System.out.println ("\t\t" + - DateUtil.YYYYMMDD (p.startDate()) + " | " + - DateUtil.YYYYMMDD (p.endDate()) + " | " + - DateUtil.YYYYMMDD (p.payDate()) + " | " + - FormatUtil.FormatDouble (p.couponDCF(), 1, 4, 1.) + " ||" - ); - } -} diff --git a/org/drip/sample/treasury/YAS_JGB.java b/org/drip/sample/treasury/YAS_JGB.java deleted file mode 100644 index cf3936b..0000000 --- a/org/drip/sample/treasury/YAS_JGB.java +++ /dev/null @@ -1,391 +0,0 @@ - -package org.drip.sample.treasury; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.creator.*; -import org.drip.product.credit.BondComponent; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * YAS_JGB contains the sample demonstrating the replication of Bloomberg's Japanese JGB JPY Bond YAS - * Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class YAS_JGB { - - private static BondComponent TSYBond ( - final JulianDate dtEffective, - final JulianDate dtMaturity, - final int iFreq, - final String strDayCount, - final String strCurrency, - final double dblCoupon) - throws Exception - { - return BondBuilder.CreateSimpleFixed ( - "JGB " + FormatUtil.FormatDouble (dblCoupon, 1, 2, 100.) + " " + dtMaturity, - strCurrency, - "", - dblCoupon, - iFreq, - strDayCount, - dtEffective, - dtMaturity, - null, - null - ); - } - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Sample demonstrating building of rates curve from cash/future/swaps - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static MergedDiscountForwardCurve BuildRatesCurveFromInstruments ( - final JulianDate dtStart, - final String[] astrCashTenor, - final double[] adblCashRate, - final String[] astrIRSTenor, - final double[] adblIRSRate, - final double dblBump, - final String strCurrency) - throws Exception - { - int iNumDCInstruments = astrCashTenor.length + adblIRSRate.length; - int aiDate[] = new int[iNumDCInstruments]; - double adblRate[] = new double[iNumDCInstruments]; - String astrCalibMeasure[] = new String[iNumDCInstruments]; - double adblCompCalibValue[] = new double[iNumDCInstruments]; - CalibratableComponent aCompCalib[] = new CalibratableComponent[iNumDCInstruments]; - - // Cash Calibration - - JulianDate dtCashEffective = dtStart.addBusDays ( - 1, - strCurrency - ); - - for (int i = 0; i < astrCashTenor.length; ++i) { - astrCalibMeasure[i] = "Rate"; - adblRate[i] = java.lang.Double.NaN; - adblCompCalibValue[i] = adblCashRate[i] + dblBump; - - aCompCalib[i] = SingleStreamComponentBuilder.Deposit ( - dtCashEffective, - new JulianDate (aiDate[i] = dtCashEffective.addTenor (astrCashTenor[i]).julian()), - ForwardLabel.Create ( - strCurrency, - astrCashTenor[i] - ) - ); - } - - // IRS Calibration - - JulianDate dtIRSEffective = dtStart.addBusDays (2, strCurrency); - - for (int i = 0; i < astrIRSTenor.length; ++i) { - astrCalibMeasure[i + astrCashTenor.length] = "Rate"; - adblRate[i + astrCashTenor.length] = java.lang.Double.NaN; - adblCompCalibValue[i + astrCashTenor.length] = adblIRSRate[i] + dblBump; - - aiDate[i + astrCashTenor.length] = dtIRSEffective.addTenor (astrIRSTenor[i]).julian(); - - aCompCalib[i + astrCashTenor.length] = OTCIRS ( - dtIRSEffective, - strCurrency, - astrIRSTenor[i], - 0. - ); - } - - /* - * Build the IR curve from the components, their calibration measures, and their calibration quotes. - */ - - return ScenarioDiscountCurveBuilder.NonlinearBuild ( - dtStart, - strCurrency, - aCompCalib, - adblCompCalibValue, - astrCalibMeasure, - null - ); - } - - private static final MergedDiscountForwardCurve FundingCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrCashTenor = new String[] {"3M"}; - double[] adblCashRate = new double[] {0.00276}; - String[] astrIRSTenor = new String[] { "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", - "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y"}; - double[] adblIRSRate = new double[] {0.00367, 0.00533, 0.00843, 0.01238, 0.01609, 0.01926, 0.02191, - 0.02406, 0.02588, 0.02741, 0.02870, 0.02982, 0.03208, 0.03372, 0.03445, 0.03484, 0.03501, 0.03484}; - - return BuildRatesCurveFromInstruments ( - dtSpot, - astrCashTenor, - adblCashRate, - astrIRSTenor, - adblIRSRate, - 0., - strCurrency - ); - } - - private static final void TSYMetrics ( - final BondComponent tsyBond, - final double dblNotional, - final JulianDate dtSettle, - final CurveSurfaceQuoteContainer mktParams, - final double dblCleanPrice) - throws Exception - { - double dblAccrued = tsyBond.accrued ( - dtSettle.julian(), - null - ); - - double dblYield = tsyBond.yieldFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblModifiedDuration = tsyBond.modifiedDurationFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblRisk = tsyBond.yield01FromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblConvexity = tsyBond.convexityFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - JulianDate dtPreviousCouponDate = tsyBond.previousCouponDate (dtSettle); - - System.out.println(); - - System.out.println ("\t\t" + tsyBond.name()); - - System.out.println ("\tPrice : " + FormatUtil.FormatDouble (dblCleanPrice, 1, 4, 100.)); - - System.out.println ("\tYield : " + FormatUtil.FormatDouble (dblYield, 1, 4, 100.) + "%"); - - System.out.println ("\tSettle : " + dtSettle); - - System.out.println(); - - System.out.println ("\tModified Duration : " + FormatUtil.FormatDouble (dblModifiedDuration, 1, 4, 10000.)); - - System.out.println ("\tRisk : " + FormatUtil.FormatDouble (dblRisk, 1, 4, 10000.)); - - System.out.println ("\tConvexity : " + FormatUtil.FormatDouble (dblConvexity * dblNotional, 1, 4, 1.)); - - System.out.println ("\tDV01 : " + FormatUtil.FormatDouble (dblRisk * dblNotional, 1, 0, 1.)); - - System.out.println(); - - System.out.println ("\tPrevious Coupon Date : " + dtPreviousCouponDate); - - System.out.println ("\tFace : " + FormatUtil.FormatDouble (dblNotional, 1, 2, 1.)); - - System.out.println ("\tPrincipal : " + FormatUtil.FormatDouble (dblCleanPrice * dblNotional, 1, 2, 1.)); - - System.out.println ("\tAccrued : " + FormatUtil.FormatDouble (dblAccrued * dblNotional, 1, 2, 1.)); - - System.out.println ("\tTotal : " + FormatUtil.FormatDouble ((dblCleanPrice + dblAccrued) * dblNotional, 1, 2, 1.)); - - System.out.println ("\tAccrual Days : " + (dtSettle.julian() - dtPreviousCouponDate.julian())); - } - - public static final void main ( - final String astrArgs[]) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2015, - DateUtil.MAY, - 1 - ); - - JulianDate dtEffective = DateUtil.CreateFromYMD ( - 2012, - DateUtil.JUNE, - 20 - ); - - JulianDate dtMaturity = DateUtil.CreateFromYMD ( - 2022, - DateUtil.JUNE, - 20 - ); - - int iFreq = 2; - String strDayCount = "NL/365"; - String strCurrency = "JPY"; - double dblCoupon = 0.009; - double dblNotional = 1000000.; - double dblCleanPrice = 1.052; - - BondComponent tsyBond = TSYBond ( - dtEffective, - dtMaturity, - iFreq, - strDayCount, - strCurrency, - dblCoupon - ); - - System.out.println(); - - System.out.println ("\tEffective : " + tsyBond.effectiveDate()); - - System.out.println ("\tMaturity : " + tsyBond.maturityDate()); - - System.out.println(); - - MergedDiscountForwardCurve dc = FundingCurve ( - dtSpot, - strCurrency - ); - - TSYMetrics ( - tsyBond, - dblNotional, - dtSpot, - MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ), - dblCleanPrice - ); - - System.out.println ("\n\tCashflow\n\t--------"); - - for (CompositePeriod p : tsyBond.couponPeriods()) - System.out.println ("\t\t" + - DateUtil.YYYYMMDD (p.startDate()) + " | " + - DateUtil.YYYYMMDD (p.endDate()) + " | " + - DateUtil.YYYYMMDD (p.payDate()) + " | " + - FormatUtil.FormatDouble (p.couponDCF(), 1, 4, 1.) + " ||" - ); - } -} diff --git a/org/drip/sample/treasury/YAS_MBONO.java b/org/drip/sample/treasury/YAS_MBONO.java deleted file mode 100644 index 902d95a..0000000 --- a/org/drip/sample/treasury/YAS_MBONO.java +++ /dev/null @@ -1,378 +0,0 @@ - -package org.drip.sample.treasury; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.creator.*; -import org.drip.product.credit.BondComponent; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * YAS_MBONO contains the sample demonstrating the replication of Bloomberg's Mexican MBONO MXN Bond YAS - * Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class YAS_MBONO { - - private static BondComponent TSYBond ( - final JulianDate dtEffective, - final JulianDate dtMaturity, - final int iFreq, - final String strDayCount, - final String strCurrency, - final double dblCoupon) - throws Exception - { - return BondBuilder.CreateSimpleFixed ( - "MBONO " + FormatUtil.FormatDouble (dblCoupon, 1, 2, 100.) + " " + dtMaturity, - strCurrency, - "", - dblCoupon, - iFreq, - strDayCount, - dtEffective, - dtMaturity, - null, - null - ); - } - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Sample demonstrating building of rates curve from cash/future/swaps - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static MergedDiscountForwardCurve BuildRatesCurveFromInstruments ( - final JulianDate dtStart, - final String[] astrCashTenor, - final double[] adblCashRate, - final String[] astrIRSTenor, - final double[] adblIRSRate, - final double dblBump, - final String strCurrency) - throws Exception - { - int iNumDCInstruments = astrCashTenor.length + adblIRSRate.length; - int aiDate[] = new int[iNumDCInstruments]; - double adblRate[] = new double[iNumDCInstruments]; - String astrCalibMeasure[] = new String[iNumDCInstruments]; - double adblCompCalibValue[] = new double[iNumDCInstruments]; - CalibratableComponent aCompCalib[] = new CalibratableComponent[iNumDCInstruments]; - - // Cash Calibration - - JulianDate dtCashEffective = dtStart.addBusDays ( - 1, - strCurrency - ); - - for (int i = 0; i < astrCashTenor.length; ++i) { - astrCalibMeasure[i] = "Rate"; - adblRate[i] = java.lang.Double.NaN; - adblCompCalibValue[i] = adblCashRate[i] + dblBump; - - aCompCalib[i] = SingleStreamComponentBuilder.Deposit ( - dtCashEffective, - new JulianDate (aiDate[i] = dtCashEffective.addTenor (astrCashTenor[i]).julian()), - ForwardLabel.Create ( - strCurrency, - astrCashTenor[i] - ) - ); - } - - // IRS Calibration - - JulianDate dtIRSEffective = dtStart.addBusDays (2, strCurrency); - - for (int i = 0; i < astrIRSTenor.length; ++i) { - astrCalibMeasure[i + astrCashTenor.length] = "Rate"; - adblRate[i + astrCashTenor.length] = java.lang.Double.NaN; - adblCompCalibValue[i + astrCashTenor.length] = adblIRSRate[i] + dblBump; - - aiDate[i + astrCashTenor.length] = dtIRSEffective.addTenor (astrIRSTenor[i]).julian(); - - aCompCalib[i + astrCashTenor.length] = OTCIRS ( - dtIRSEffective, - strCurrency, - astrIRSTenor[i], - 0. - ); - } - - /* - * Build the IR curve from the components, their calibration measures, and their calibration quotes. - */ - - return ScenarioDiscountCurveBuilder.NonlinearBuild ( - dtStart, - strCurrency, - aCompCalib, - adblCompCalibValue, - astrCalibMeasure, - null - ); - } - - private static final MergedDiscountForwardCurve FundingCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrCashTenor = new String[] {"3M"}; - double[] adblCashRate = new double[] {0.00276}; - String[] astrIRSTenor = new String[] { "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", - "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y"}; - double[] adblIRSRate = new double[] {0.00367, 0.00533, 0.00843, 0.01238, 0.01609, 0.01926, 0.02191, - 0.02406, 0.02588, 0.02741, 0.02870, 0.02982, 0.03208, 0.03372, 0.03445, 0.03484, 0.03501, 0.03484}; - - return BuildRatesCurveFromInstruments ( - dtSpot, - astrCashTenor, - adblCashRate, - astrIRSTenor, - adblIRSRate, - 0., - strCurrency - ); - } - - private static final void TSYMetrics ( - final BondComponent tsyBond, - final double dblNotional, - final JulianDate dtSettle, - final CurveSurfaceQuoteContainer mktParams, - final double dblCleanPrice) - throws Exception - { - double dblAccrued = tsyBond.accrued ( - dtSettle.julian(), - null - ); - - ValuationParams valParams = ValuationParams.Spot (dtSettle.julian()); - - double dblYield = tsyBond.yieldFromPrice ( - valParams, - mktParams, - null, - dblCleanPrice - ); - - double dblModifiedDuration = tsyBond.modifiedDurationFromPrice ( - valParams, - mktParams, - null, - dblCleanPrice - ); - - double dblRisk = tsyBond.yield01FromPrice ( - valParams, - mktParams, - null, - dblCleanPrice - ); - - double dblConvexity = tsyBond.convexityFromPrice ( - valParams, - mktParams, - null, - dblCleanPrice - ); - - JulianDate dtPreviousCouponDate = tsyBond.previousCouponDate (dtSettle); - - System.out.println(); - - System.out.println ("\t\t" + tsyBond.name()); - - System.out.println ("\tPrice : " + FormatUtil.FormatDouble (dblCleanPrice, 1, 4, 100.)); - - System.out.println ("\tYield : " + FormatUtil.FormatDouble (dblYield, 1, 4, 100.) + "%"); - - System.out.println ("\tSettle : " + dtSettle); - - System.out.println(); - - System.out.println ("\tModified Duration : " + FormatUtil.FormatDouble (dblModifiedDuration, 1, 4, 10000.)); - - System.out.println ("\tRisk : " + FormatUtil.FormatDouble (dblRisk, 1, 4, 10000.)); - - System.out.println ("\tConvexity : " + FormatUtil.FormatDouble (dblConvexity * dblNotional, 1, 4, 1.)); - - System.out.println ("\tDV01 : " + FormatUtil.FormatDouble (dblRisk * dblNotional, 1, 0, 1.)); - - System.out.println(); - - System.out.println ("\tPrevious Coupon Date : " + dtPreviousCouponDate); - - System.out.println ("\tFace : " + FormatUtil.FormatDouble (dblNotional, 1, 2, 1.)); - - System.out.println ("\tPrincipal : " + FormatUtil.FormatDouble (dblCleanPrice * dblNotional, 1, 2, 1.)); - - System.out.println ("\tAccruedDCF : " + FormatUtil.FormatDouble (dblAccrued, 1, 6, 1.)); - - System.out.println ("\tAccrued : " + FormatUtil.FormatDouble (dblAccrued * dblNotional, 1, 2, 1.)); - - System.out.println ("\tTotal : " + FormatUtil.FormatDouble ((dblCleanPrice + dblAccrued) * dblNotional, 1, 2, 1.)); - - System.out.println ("\tAccrual Days : " + (dtSettle.julian() - dtPreviousCouponDate.julian())); - } - - public static final void main ( - final String astrArgs[]) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2016, - DateUtil.MARCH, - 30 - ); - - JulianDate dtEffective = DateUtil.CreateFromYMD ( - 2011, - DateUtil.NOVEMBER, - 20 - ); - - JulianDate dtMaturity = DateUtil.CreateFromYMD ( - 2036, - DateUtil.NOVEMBER, - 20 - ); - - int iFreq = 2; - String strDayCount = "Act/364"; - String strCurrency = "MXN"; - double dblCoupon = 0.10; - double dblNotional = 100000000.; - double dblCleanPrice = 1.35213; - - BondComponent tsyBond = TSYBond ( - dtEffective, - dtMaturity, - iFreq, - strDayCount, - strCurrency, - dblCoupon - ); - - System.out.println(); - - System.out.println ("\tEffective : " + tsyBond.effectiveDate()); - - System.out.println ("\tMaturity : " + tsyBond.maturityDate()); - - System.out.println(); - - MergedDiscountForwardCurve dc = FundingCurve ( - dtSpot, - strCurrency - ); - - TSYMetrics ( - tsyBond, - dblNotional, - dtSpot, - MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ), - dblCleanPrice - ); - - System.out.println ("\n\tCashflow\n\t--------"); - - for (CompositePeriod p : tsyBond.couponPeriods()) - System.out.println ("\t\t" + - DateUtil.YYYYMMDD (p.startDate()) + " | " + - DateUtil.YYYYMMDD (p.endDate()) + " | " + - DateUtil.YYYYMMDD (p.payDate()) + " | " + - FormatUtil.FormatDouble (p.couponDCF(), 1, 4, 1.) + " ||" - ); - } -} diff --git a/org/drip/sample/treasury/YAS_SPGB.java b/org/drip/sample/treasury/YAS_SPGB.java deleted file mode 100644 index de1bedc..0000000 --- a/org/drip/sample/treasury/YAS_SPGB.java +++ /dev/null @@ -1,391 +0,0 @@ - -package org.drip.sample.treasury; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.creator.*; -import org.drip.product.credit.BondComponent; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * YAS_SPGB contains the sample demonstrating the replication of Bloomberg's Spanish Govvie EUR Bond YAS - * Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class YAS_SPGB { - - private static BondComponent TSYBond ( - final JulianDate dtEffective, - final JulianDate dtMaturity, - final int iFreq, - final String strDayCount, - final String strCurrency, - final double dblCoupon) - throws Exception - { - return BondBuilder.CreateSimpleFixed ( - "GGB " + FormatUtil.FormatDouble (dblCoupon, 1, 2, 100.) + " " + dtMaturity, - strCurrency, - "", - dblCoupon, - iFreq, - strDayCount, - dtEffective, - dtMaturity, - null, - null - ); - } - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Sample demonstrating building of rates curve from cash/future/swaps - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static MergedDiscountForwardCurve BuildRatesCurveFromInstruments ( - final JulianDate dtStart, - final String[] astrCashTenor, - final double[] adblCashRate, - final String[] astrIRSTenor, - final double[] adblIRSRate, - final double dblBump, - final String strCurrency) - throws Exception - { - int iNumDCInstruments = astrCashTenor.length + adblIRSRate.length; - int aiDate[] = new int[iNumDCInstruments]; - double adblRate[] = new double[iNumDCInstruments]; - String astrCalibMeasure[] = new String[iNumDCInstruments]; - double adblCompCalibValue[] = new double[iNumDCInstruments]; - CalibratableComponent aCompCalib[] = new CalibratableComponent[iNumDCInstruments]; - - // Cash Calibration - - JulianDate dtCashEffective = dtStart.addBusDays ( - 1, - strCurrency - ); - - for (int i = 0; i < astrCashTenor.length; ++i) { - astrCalibMeasure[i] = "Rate"; - adblRate[i] = java.lang.Double.NaN; - adblCompCalibValue[i] = adblCashRate[i] + dblBump; - - aCompCalib[i] = SingleStreamComponentBuilder.Deposit ( - dtCashEffective, - new JulianDate (aiDate[i] = dtCashEffective.addTenor (astrCashTenor[i]).julian()), - ForwardLabel.Create ( - strCurrency, - astrCashTenor[i] - ) - ); - } - - // IRS Calibration - - JulianDate dtIRSEffective = dtStart.addBusDays (2, strCurrency); - - for (int i = 0; i < astrIRSTenor.length; ++i) { - astrCalibMeasure[i + astrCashTenor.length] = "Rate"; - adblRate[i + astrCashTenor.length] = java.lang.Double.NaN; - adblCompCalibValue[i + astrCashTenor.length] = adblIRSRate[i] + dblBump; - - aiDate[i + astrCashTenor.length] = dtIRSEffective.addTenor (astrIRSTenor[i]).julian(); - - aCompCalib[i + astrCashTenor.length] = OTCIRS ( - dtIRSEffective, - strCurrency, - astrIRSTenor[i], - 0. - ); - } - - /* - * Build the IR curve from the components, their calibration measures, and their calibration quotes. - */ - - return ScenarioDiscountCurveBuilder.NonlinearBuild ( - dtStart, - strCurrency, - aCompCalib, - adblCompCalibValue, - astrCalibMeasure, - null - ); - } - - private static final MergedDiscountForwardCurve FundingCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrCashTenor = new String[] {"3M"}; - double[] adblCashRate = new double[] {0.00276}; - String[] astrIRSTenor = new String[] { "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", - "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y"}; - double[] adblIRSRate = new double[] {0.00367, 0.00533, 0.00843, 0.01238, 0.01609, 0.01926, 0.02191, - 0.02406, 0.02588, 0.02741, 0.02870, 0.02982, 0.03208, 0.03372, 0.03445, 0.03484, 0.03501, 0.03484}; - - return BuildRatesCurveFromInstruments ( - dtSpot, - astrCashTenor, - adblCashRate, - astrIRSTenor, - adblIRSRate, - 0., - strCurrency - ); - } - - private static final void TSYMetrics ( - final BondComponent tsyBond, - final double dblNotional, - final JulianDate dtSettle, - final CurveSurfaceQuoteContainer mktParams, - final double dblCleanPrice) - throws Exception - { - double dblAccrued = tsyBond.accrued ( - dtSettle.julian(), - null - ); - - double dblYield = tsyBond.yieldFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblModifiedDuration = tsyBond.modifiedDurationFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblRisk = tsyBond.yield01FromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblConvexity = tsyBond.convexityFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - JulianDate dtPreviousCouponDate = tsyBond.previousCouponDate (dtSettle); - - System.out.println(); - - System.out.println ("\t\t" + tsyBond.name()); - - System.out.println ("\tPrice : " + FormatUtil.FormatDouble (dblCleanPrice, 1, 4, 100.)); - - System.out.println ("\tYield : " + FormatUtil.FormatDouble (dblYield, 1, 4, 100.) + "%"); - - System.out.println ("\tSettle : " + dtSettle); - - System.out.println(); - - System.out.println ("\tModified Duration : " + FormatUtil.FormatDouble (dblModifiedDuration, 1, 4, 10000.)); - - System.out.println ("\tRisk : " + FormatUtil.FormatDouble (dblRisk, 1, 4, 10000.)); - - System.out.println ("\tConvexity : " + FormatUtil.FormatDouble (dblConvexity * dblNotional, 1, 4, 1.)); - - System.out.println ("\tDV01 : " + FormatUtil.FormatDouble (dblRisk * dblNotional, 1, 0, 1.)); - - System.out.println(); - - System.out.println ("\tPrevious Coupon Date : " + dtPreviousCouponDate); - - System.out.println ("\tFace : " + FormatUtil.FormatDouble (dblNotional, 1, 2, 1.)); - - System.out.println ("\tPrincipal : " + FormatUtil.FormatDouble (dblCleanPrice * dblNotional, 1, 2, 1.)); - - System.out.println ("\tAccrued : " + FormatUtil.FormatDouble (dblAccrued * dblNotional, 1, 2, 1.)); - - System.out.println ("\tTotal : " + FormatUtil.FormatDouble ((dblCleanPrice + dblAccrued) * dblNotional, 1, 2, 1.)); - - System.out.println ("\tAccrual Days : " + FormatUtil.FormatDouble (dtSettle.julian() - dtPreviousCouponDate.julian(), 1, 0, 1.)); - } - - public static final void main ( - final String astrArgs[]) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2015, - DateUtil.MAY, - 5 - ); - - JulianDate dtEffective = DateUtil.CreateFromYMD ( - 2015, - DateUtil.JANUARY, - 31 - ); - - JulianDate dtMaturity = DateUtil.CreateFromYMD ( - 2020, - DateUtil.JANUARY, - 31 - ); - - int iFreq = 1; - String strDayCount = "DCAct_Act_UST"; - String strCurrency = "EUR"; - double dblCoupon = 0.014; - double dblNotional = 1000000.; - double dblCleanPrice = 1.03775; - - BondComponent tsyBond = TSYBond ( - dtEffective, - dtMaturity, - iFreq, - strDayCount, - strCurrency, - dblCoupon - ); - - System.out.println(); - - System.out.println ("\tEffective : " + tsyBond.effectiveDate()); - - System.out.println ("\tMaturity : " + tsyBond.maturityDate()); - - System.out.println(); - - MergedDiscountForwardCurve dc = FundingCurve ( - dtSpot, - strCurrency - ); - - TSYMetrics ( - tsyBond, - dblNotional, - dtSpot, - MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ), - dblCleanPrice - ); - - System.out.println ("\n\tCashflow\n\t--------"); - - for (CompositePeriod p : tsyBond.couponPeriods()) - System.out.println ("\t\t" + - DateUtil.YYYYMMDD (p.startDate()) + " | " + - DateUtil.YYYYMMDD (p.endDate()) + " | " + - DateUtil.YYYYMMDD (p.payDate()) + " | " + - FormatUtil.FormatDouble (p.couponDCF(), 1, 4, 1.) + " ||" - ); - } -} diff --git a/org/drip/sample/treasury/YAS_UST.java b/org/drip/sample/treasury/YAS_UST.java deleted file mode 100644 index a683e2f..0000000 --- a/org/drip/sample/treasury/YAS_UST.java +++ /dev/null @@ -1,348 +0,0 @@ - -package org.drip.sample.treasury; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.market.otc.*; -import org.drip.param.creator.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.creator.*; -import org.drip.product.credit.BondComponent; -import org.drip.product.definition.CalibratableComponent; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.ScenarioDiscountCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * YAS_UST contains the sample demonstrating the replication of Bloomberg's UST YAS functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class YAS_UST { - - private static BondComponent TSYBond ( - final JulianDate dtEffective, - final String strMaturityTenor, - final String strCurrency, - final double dblCoupon) - throws Exception - { - return BondBuilder.CreateSimpleFixed ( - "UST_" + strMaturityTenor, - strCurrency, - "", - dblCoupon, - 2, - "DCAct_Act_UST", - dtEffective, - dtEffective.addTenor (strMaturityTenor), - null, - null - ); - } - - private static final FixFloatComponent OTCIRS ( - final JulianDate dtSpot, - final String strCurrency, - final String strMaturityTenor, - final double dblCoupon) - { - FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction ( - strCurrency, - "ALL", - strMaturityTenor, - "MAIN" - ); - - return ffConv.createFixFloatComponent ( - dtSpot, - strMaturityTenor, - dblCoupon, - 0., - 1. - ); - } - - /* - * Sample demonstrating building of rates curve from cash/future/swaps - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static MergedDiscountForwardCurve BuildRatesCurveFromInstruments ( - final JulianDate dtStart, - final String[] astrCashTenor, - final double[] adblCashRate, - final String[] astrIRSTenor, - final double[] adblIRSRate, - final double dblBump, - final String strCurrency) - throws Exception - { - int iNumDCInstruments = astrCashTenor.length + adblIRSRate.length; - int aiDate[] = new int[iNumDCInstruments]; - double adblRate[] = new double[iNumDCInstruments]; - String astrCalibMeasure[] = new String[iNumDCInstruments]; - double adblCompCalibValue[] = new double[iNumDCInstruments]; - CalibratableComponent aCompCalib[] = new CalibratableComponent[iNumDCInstruments]; - - // Cash Calibration - - JulianDate dtCashEffective = dtStart.addBusDays ( - 1, - strCurrency - ); - - for (int i = 0; i < astrCashTenor.length; ++i) { - astrCalibMeasure[i] = "Rate"; - adblRate[i] = java.lang.Double.NaN; - adblCompCalibValue[i] = adblCashRate[i] + dblBump; - - aCompCalib[i] = SingleStreamComponentBuilder.Deposit ( - dtCashEffective, - new JulianDate (aiDate[i] = dtCashEffective.addTenor (astrCashTenor[i]).julian()), - ForwardLabel.Create ( - strCurrency, - astrCashTenor[i] - ) - ); - } - - // IRS Calibration - - JulianDate dtIRSEffective = dtStart.addBusDays (2, strCurrency); - - for (int i = 0; i < astrIRSTenor.length; ++i) { - astrCalibMeasure[i + astrCashTenor.length] = "Rate"; - adblRate[i + astrCashTenor.length] = java.lang.Double.NaN; - adblCompCalibValue[i + astrCashTenor.length] = adblIRSRate[i] + dblBump; - - aiDate[i + astrCashTenor.length] = dtIRSEffective.addTenor (astrIRSTenor[i]).julian(); - - aCompCalib[i + astrCashTenor.length] = OTCIRS ( - dtIRSEffective, - strCurrency, - astrIRSTenor[i], - 0. - ); - } - - /* - * Build the IR curve from the components, their calibration measures, and their calibration quotes. - */ - - return ScenarioDiscountCurveBuilder.NonlinearBuild ( - dtStart, - strCurrency, - aCompCalib, - adblCompCalibValue, - astrCalibMeasure, - null - ); - } - - private static final MergedDiscountForwardCurve FundingCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrCashTenor = new String[] {"3M"}; - double[] adblCashRate = new double[] {0.00276}; - String[] astrIRSTenor = new String[] { "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", - "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y"}; - double[] adblIRSRate = new double[] {0.00367, 0.00533, 0.00843, 0.01238, 0.01609, 0.01926, 0.02191, - 0.02406, 0.02588, 0.02741, 0.02870, 0.02982, 0.03208, 0.03372, 0.03445, 0.03484, 0.03501, 0.03484}; - - return BuildRatesCurveFromInstruments ( - dtSpot, - astrCashTenor, - adblCashRate, - astrIRSTenor, - adblIRSRate, - 0., - strCurrency - ); - } - - private static final void TSYMetrics ( - final BondComponent tsyBond, - final double dblNotional, - final JulianDate dtSettle, - final CurveSurfaceQuoteContainer mktParams, - final double dblCleanPrice) - throws Exception - { - double dblAccrued = tsyBond.accrued ( - dtSettle.julian(), - null - ); - - double dblYield = tsyBond.yieldFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblModifiedDuration = tsyBond.modifiedDurationFromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - double dblRisk = tsyBond.yield01FromPrice ( - new ValuationParams ( - dtSettle, - dtSettle, - tsyBond.currency() - ), - mktParams, - null, - dblCleanPrice - ); - - System.out.println(); - - System.out.println ("\tYield : " + FormatUtil.FormatDouble (dblYield, 1, 3, 100.) + "%"); - - System.out.println ("\tModified Duration : " + FormatUtil.FormatDouble (dblModifiedDuration, 1, 3, 10000.)); - - System.out.println ("\tRisk : " + FormatUtil.FormatDouble (dblRisk, 1, 3, 10000.)); - - System.out.println(); - - System.out.println ("\tFace : " + FormatUtil.FormatDouble (dblNotional, 1, 2, 1.)); - - System.out.println ("\tPrincipal : " + FormatUtil.FormatDouble (dblCleanPrice * dblNotional, 1, 2, 1.)); - - System.out.println ("\tAccrued : " + FormatUtil.FormatDouble (dblAccrued * dblNotional, 1, 2, 1.)); - } - - public static final void main ( - final String astrArgs[]) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2015, - DateUtil.JULY, - 1 - ); - - JulianDate dtEffective = DateUtil.CreateFromYMD ( - 2014, - DateUtil.DECEMBER, - 31 - ); - - String strMaturityTenor = "7Y"; - String strCurrency = "USD"; - double dblCoupon = 0.02125; - double dblNotional = 1000000.; - double dblCleanPrice = 1.02; - - BondComponent tsyBond = TSYBond ( - dtEffective, - strMaturityTenor, - strCurrency, - dblCoupon - ); - - System.out.println(); - - System.out.println ("\tEffective : " + tsyBond.effectiveDate()); - - System.out.println ("\tMaturity : " + tsyBond.maturityDate()); - - System.out.println(); - - MergedDiscountForwardCurve dc = FundingCurve ( - dtSpot, - strCurrency - ); - - TSYMetrics ( - tsyBond, - dblNotional, - dtSpot, - MarketParamsBuilder.Create ( - dc, - null, - null, - null, - null, - null, - null - ), - dblCleanPrice - ); - - System.out.println ("\n\tCashflow\n\t--------"); - - for (CompositePeriod p : tsyBond.couponPeriods()) - System.out.println ("\t\t" + - DateUtil.YYYYMMDD (p.startDate()) + " | " + - DateUtil.YYYYMMDD (p.endDate()) + " | " + - DateUtil.YYYYMMDD (p.payDate()) + " | " + - FormatUtil.FormatDouble (p.couponDCF(), 1, 4, 1.) + " ||" - ); - } -} diff --git a/org/drip/sample/treasuryfeed/AGBReconstitutor.java b/org/drip/sample/treasuryfeed/AGBReconstitutor.java deleted file mode 100644 index bbd4ff0..0000000 --- a/org/drip/sample/treasuryfeed/AGBReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.treasuryfeed; - -import org.drip.feed.transformer.GovvieTreasuryMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AGBReconstitutor demonstrates the Cleansing and Re-constitution of the AGB Yield Marks obtained from - * Historical Yield Curve Prints. - * - * @author Lakshmi Krishnamurthy - */ - -public class AGBReconstitutor { - - public static final void main ( - final String[] astrArgs) - { - EnvManager.InitEnv (""); - - String strTreasuryType = "AGB"; - String strMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryYieldMarks\\" + strTreasuryType + "BenchmarksFormatted.csv"; - - GovvieTreasuryMarksReconstitutor.RegularizeBenchmarkMarks ( - strMarksLocation, - strTreasuryType - ); - } -} diff --git a/org/drip/sample/treasuryfeed/CANReconstitutor.java b/org/drip/sample/treasuryfeed/CANReconstitutor.java deleted file mode 100644 index 1decb95..0000000 --- a/org/drip/sample/treasuryfeed/CANReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.treasuryfeed; - -import org.drip.feed.transformer.GovvieTreasuryMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CANReconstitutor demonstrates the Cleansing and Re-constitution of the CAN Yield Marks obtained from - * Historical Yield Curve Prints. - * - * @author Lakshmi Krishnamurthy - */ - -public class CANReconstitutor { - - public static final void main ( - final String[] astrArgs) - { - EnvManager.InitEnv (""); - - String strTreasuryType = "CAN"; - String strMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryYieldMarks\\" + strTreasuryType + "BenchmarksFormatted.csv"; - - GovvieTreasuryMarksReconstitutor.RegularizeBenchmarkMarks ( - strMarksLocation, - strTreasuryType - ); - } -} diff --git a/org/drip/sample/treasuryfeed/DBRReconstitutor.java b/org/drip/sample/treasuryfeed/DBRReconstitutor.java deleted file mode 100644 index 3944cf6..0000000 --- a/org/drip/sample/treasuryfeed/DBRReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.treasuryfeed; - -import org.drip.feed.transformer.GovvieTreasuryMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DBRReconstitutor demonstrates the Cleansing and Re-constitution of the DBR Yield Marks obtained from - * Historical Yield Curve Prints. - * - * @author Lakshmi Krishnamurthy - */ - -public class DBRReconstitutor { - - public static final void main ( - final String[] astrArgs) - { - EnvManager.InitEnv (""); - - String strTreasuryType = "DBR"; - String strMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryYieldMarks\\" + strTreasuryType + "BenchmarksFormatted.csv"; - - GovvieTreasuryMarksReconstitutor.RegularizeBenchmarkMarks ( - strMarksLocation, - strTreasuryType - ); - } -} diff --git a/org/drip/sample/treasuryfeed/DGBReconstitutor.java b/org/drip/sample/treasuryfeed/DGBReconstitutor.java deleted file mode 100644 index eba7d95..0000000 --- a/org/drip/sample/treasuryfeed/DGBReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.treasuryfeed; - -import org.drip.feed.transformer.GovvieTreasuryMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DGBReconstitutor demonstrates the Cleansing and Re-constitution of the DGB Yield Marks obtained from - * Historical Yield Curve Prints. - * - * @author Lakshmi Krishnamurthy - */ - -public class DGBReconstitutor { - - public static final void main ( - final String[] astrArgs) - { - EnvManager.InitEnv (""); - - String strTreasuryType = "DGB"; - String strMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryYieldMarks\\" + strTreasuryType + "BenchmarksFormatted.csv"; - - GovvieTreasuryMarksReconstitutor.RegularizeBenchmarkMarks ( - strMarksLocation, - strTreasuryType - ); - } -} diff --git a/org/drip/sample/treasuryfeed/GILTReconstitutor.java b/org/drip/sample/treasuryfeed/GILTReconstitutor.java deleted file mode 100644 index 49f74c3..0000000 --- a/org/drip/sample/treasuryfeed/GILTReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.treasuryfeed; - -import org.drip.feed.transformer.GovvieTreasuryMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * GILTReconstitutor demonstrates the Cleansing and Re-constitution of the GILT Yield Marks obtained from - * Historical Yield Curve Prints. - * - * @author Lakshmi Krishnamurthy - */ - -public class GILTReconstitutor { - - public static final void main ( - final String[] astrArgs) - { - EnvManager.InitEnv (""); - - String strTreasuryType = "GILT"; - String strMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryYieldMarks\\" + strTreasuryType + "BenchmarksFormatted.csv"; - - GovvieTreasuryMarksReconstitutor.RegularizeBenchmarkMarks ( - strMarksLocation, - strTreasuryType - ); - } -} diff --git a/org/drip/sample/treasuryfeed/GSWISSReconstitutor.java b/org/drip/sample/treasuryfeed/GSWISSReconstitutor.java deleted file mode 100644 index 1fc6281..0000000 --- a/org/drip/sample/treasuryfeed/GSWISSReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.treasuryfeed; - -import org.drip.feed.transformer.GovvieTreasuryMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * GSWISSReconstitutor demonstrates the Cleansing and Re-constitution of the GSWISS Yield Marks obtained from - * Historical Yield Curve Prints. - * - * @author Lakshmi Krishnamurthy - */ - -public class GSWISSReconstitutor { - - public static final void main ( - final String[] astrArgs) - { - EnvManager.InitEnv (""); - - String strTreasuryType = "GSWISS"; - String strMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryYieldMarks\\" + strTreasuryType + "BenchmarksFormatted.csv"; - - GovvieTreasuryMarksReconstitutor.RegularizeBenchmarkMarks ( - strMarksLocation, - strTreasuryType - ); - } -} diff --git a/org/drip/sample/treasuryfeed/JGBReconstitutor.java b/org/drip/sample/treasuryfeed/JGBReconstitutor.java deleted file mode 100644 index 51dabfc..0000000 --- a/org/drip/sample/treasuryfeed/JGBReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.treasuryfeed; - -import org.drip.feed.transformer.GovvieTreasuryMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * JGBReconstitutor demonstrates the Cleansing and Re-constitution of the JGB Yield Marks obtained from - * Historical Yield Curve Prints. - * - * @author Lakshmi Krishnamurthy - */ - -public class JGBReconstitutor { - - public static final void main ( - final String[] astrArgs) - { - EnvManager.InitEnv (""); - - String strTreasuryType = "JGB"; - String strMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryYieldMarks\\" + strTreasuryType + "BenchmarksFormatted.csv"; - - GovvieTreasuryMarksReconstitutor.RegularizeBenchmarkMarks ( - strMarksLocation, - strTreasuryType - ); - } -} diff --git a/org/drip/sample/treasuryfeed/NGBReconstitutor.java b/org/drip/sample/treasuryfeed/NGBReconstitutor.java deleted file mode 100644 index 7c3a5b8..0000000 --- a/org/drip/sample/treasuryfeed/NGBReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.treasuryfeed; - -import org.drip.feed.transformer.GovvieTreasuryMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NGBReconstitutor demonstrates the Cleansing and Re-constitution of the NGB Yield Marks obtained from - * Historical Yield Curve Prints. - * - * @author Lakshmi Krishnamurthy - */ - -public class NGBReconstitutor { - - public static final void main ( - final String[] astrArgs) - { - EnvManager.InitEnv (""); - - String strTreasuryType = "NGB"; - String strMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryYieldMarks\\" + strTreasuryType + "BenchmarksFormatted.csv"; - - GovvieTreasuryMarksReconstitutor.RegularizeBenchmarkMarks ( - strMarksLocation, - strTreasuryType - ); - } -} diff --git a/org/drip/sample/treasuryfeed/NZGBReconstitutor.java b/org/drip/sample/treasuryfeed/NZGBReconstitutor.java deleted file mode 100644 index 2eba073..0000000 --- a/org/drip/sample/treasuryfeed/NZGBReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.treasuryfeed; - -import org.drip.feed.transformer.GovvieTreasuryMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NZGBReconstitutor demonstrates the Cleansing and Re-constitution of the NZGB Yield Marks obtained from - * Historical Yield Curve Prints. - * - * @author Lakshmi Krishnamurthy - */ - -public class NZGBReconstitutor { - - public static final void main ( - final String[] astrArgs) - { - EnvManager.InitEnv (""); - - String strTreasuryType = "NZGB"; - String strMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryYieldMarks\\" + strTreasuryType + "BenchmarksFormatted.csv"; - - GovvieTreasuryMarksReconstitutor.RegularizeBenchmarkMarks ( - strMarksLocation, - strTreasuryType - ); - } -} diff --git a/org/drip/sample/treasuryfeed/SGBReconstitutor.java b/org/drip/sample/treasuryfeed/SGBReconstitutor.java deleted file mode 100644 index ece3434..0000000 --- a/org/drip/sample/treasuryfeed/SGBReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.treasuryfeed; - -import org.drip.feed.transformer.GovvieTreasuryMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * SGBReconstitutor demonstrates the Cleansing and Re-constitution of the SGB Yield Marks obtained from - * Historical Yield Curve Prints. - * - * @author Lakshmi Krishnamurthy - */ - -public class SGBReconstitutor { - - public static final void main ( - final String[] astrArgs) - { - EnvManager.InitEnv (""); - - String strTreasuryType = "SGB"; - String strMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryYieldMarks\\" + strTreasuryType + "BenchmarksFormatted.csv"; - - GovvieTreasuryMarksReconstitutor.RegularizeBenchmarkMarks ( - strMarksLocation, - strTreasuryType - ); - } -} diff --git a/org/drip/sample/treasuryfeed/USTReconstitutor.java b/org/drip/sample/treasuryfeed/USTReconstitutor.java deleted file mode 100644 index 0ce720c..0000000 --- a/org/drip/sample/treasuryfeed/USTReconstitutor.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.sample.treasuryfeed; - -import org.drip.feed.transformer.GovvieTreasuryMarksReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * USTReconstitutor demonstrates the Cleansing and Re-constitution of the UST Yield Marks obtained from - * Historical Yield Curve Prints. - * - * @author Lakshmi Krishnamurthy - */ - -public class USTReconstitutor { - - public static final void main ( - final String[] astrArgs) - { - EnvManager.InitEnv (""); - - String strTreasuryType = "UST"; - String strMarksLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryYieldMarks\\" + strTreasuryType + "BenchmarksFormatted.csv"; - - GovvieTreasuryMarksReconstitutor.RegularizeBenchmarkMarks ( - strMarksLocation, - strTreasuryType - ); - } -} diff --git a/org/drip/sample/treasuryfutures/ContractDefinitions.java b/org/drip/sample/treasuryfutures/ContractDefinitions.java deleted file mode 100644 index 63fac66..0000000 --- a/org/drip/sample/treasuryfutures/ContractDefinitions.java +++ /dev/null @@ -1,160 +0,0 @@ - -package org.drip.sample.treasuryfutures; - -import org.drip.market.exchange.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ContractDefinitions contains all the pre-fixed Definitions of Exchange-traded Treasury Futures Contracts. - * - * @author Lakshmi Krishnamurthy - */ - -public class ContractDefinitions { - - private static final void DisplayContractDefinition ( - final String strFuturesCode) - throws Exception - { - TreasuryFuturesContract tfc = TreasuryFuturesContractContainer.TreasuryFuturesContract (strFuturesCode); - - System.out.println ( - "\t| " + strFuturesCode - + " | " + tfc.id() - + " | " + tfc.code() - + " | " + tfc.tenor() - + " | " + tfc.type() + " ||" - ); - } - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - System.out.println ("\n\t|------------------------------||"); - - System.out.println ("\t| TREASURY FUTURES CONTRACT ||"); - - System.out.println ("\t| -------- ------- -------- ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| L -> R: ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| Futures Code ||"); - - System.out.println ("\t| Futures ID ||"); - - System.out.println ("\t| Treasury Code ||"); - - System.out.println ("\t| Futures Tenor ||"); - - System.out.println ("\t| Treasury Type ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t|------------------------------||"); - - DisplayContractDefinition ("G1"); - - DisplayContractDefinition ("CN1"); - - DisplayContractDefinition ("DGB"); - - DisplayContractDefinition ("DU1"); - - DisplayContractDefinition ("FV1"); - - DisplayContractDefinition ("IK1"); - - DisplayContractDefinition ("JB1"); - - DisplayContractDefinition ("OE1"); - - DisplayContractDefinition ("RX1"); - - DisplayContractDefinition ("TU1"); - - DisplayContractDefinition ("TY1"); - - DisplayContractDefinition ("UB1"); - - DisplayContractDefinition ("US1"); - - DisplayContractDefinition ("WB1"); - - DisplayContractDefinition ("WN1"); - - DisplayContractDefinition ("XM1"); - - DisplayContractDefinition ("YM1"); - - DisplayContractDefinition ("BOBL"); - - DisplayContractDefinition ("BUND"); - - DisplayContractDefinition ("BUXL"); - - DisplayContractDefinition ("FBB1"); - - DisplayContractDefinition ("OAT1"); - - DisplayContractDefinition ("ULTRA"); - - DisplayContractDefinition ("GSWISS"); - - DisplayContractDefinition ("SCHATZ"); - - System.out.println ("\t|------------------------------||"); - } -} diff --git a/org/drip/sample/treasuryfutures/ContractEligibilitySettlementDefinitions.java b/org/drip/sample/treasuryfutures/ContractEligibilitySettlementDefinitions.java deleted file mode 100644 index cc40141..0000000 --- a/org/drip/sample/treasuryfutures/ContractEligibilitySettlementDefinitions.java +++ /dev/null @@ -1,128 +0,0 @@ - -package org.drip.sample.treasuryfutures; - -import org.drip.market.exchange.TreasuryFuturesConventionContainer; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ContractEligibilitySettlementDefinitions contains all the pre-fixed Definitions of the Bond Futures - * Contracts. - * - * @author Lakshmi Krishnamurthy - */ - -public class ContractEligibilitySettlementDefinitions { - - private static final void DisplayBondFuturesInfo ( - String strCurrency, - String strUnderlierType, - String strUnderlierSubtype, - String strMaturityTenor) - { - System.out.println ("--------------------------------------------------------------------------------------------------------\n"); - - System.out.println ("\t" + - TreasuryFuturesConventionContainer.FromJurisdictionTypeMaturity ( - strCurrency, - strUnderlierType, - strUnderlierSubtype, - strMaturityTenor - ) - ); - } - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - System.out.println(); - - DisplayBondFuturesInfo ("AUD", "BANK", "BILLS", "3M"); - - DisplayBondFuturesInfo ("AUD", "TREASURY", "BOND", "3Y"); - - DisplayBondFuturesInfo ("AUD", "TREASURY", "BOND", "10Y"); - - DisplayBondFuturesInfo ("EUR", "EURO", "SCHATZ", "2Y"); - - DisplayBondFuturesInfo ("EUR", "EURO", "BOBL", "5Y"); - - DisplayBondFuturesInfo ("EUR", "EURO", "BUND", "10Y"); - - DisplayBondFuturesInfo ("EUR", "EURO", "BUXL", "30Y"); - - DisplayBondFuturesInfo ("EUR", "TREASURY", "BONO", "10Y"); - - DisplayBondFuturesInfo ("GBP", "SHORT", "GILT", "2Y"); - - DisplayBondFuturesInfo ("GBP", "MEDIUM", "GILT", "5Y"); - - DisplayBondFuturesInfo ("GBP", "LONG", "GILT", "10Y"); - - DisplayBondFuturesInfo ("JPY", "TREASURY", "JGB", "5Y"); - - DisplayBondFuturesInfo ("JPY", "TREASURY", "JGB", "10Y"); - - DisplayBondFuturesInfo ("USD", "TREASURY", "NOTE", "2Y"); - - DisplayBondFuturesInfo ("USD", "TREASURY", "NOTE", "3Y"); - - DisplayBondFuturesInfo ("USD", "TREASURY", "NOTE", "5Y"); - - DisplayBondFuturesInfo ("USD", "TREASURY", "NOTE", "10Y"); - - DisplayBondFuturesInfo ("USD", "TREASURY", "BOND", "30Y"); - - DisplayBondFuturesInfo ("USD", "TREASURY", "BOND", "ULTRA"); - - System.out.println ("--------------------------------------------------------------------------------------------------------\n"); - } -} diff --git a/org/drip/sample/treasuryfutures/ExchangeTradedOptionDefinitions.java b/org/drip/sample/treasuryfutures/ExchangeTradedOptionDefinitions.java deleted file mode 100644 index 2dd32ca..0000000 --- a/org/drip/sample/treasuryfutures/ExchangeTradedOptionDefinitions.java +++ /dev/null @@ -1,102 +0,0 @@ - -package org.drip.sample.treasuryfutures; - -import org.drip.market.exchange.TreasuryFuturesOptionContainer; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ExchangeTradedOptionDefinitions contains all the pre-fixed Definitions of Exchange-traded Options on Bond - * Futures Contracts. - * - * @author Lakshmi Krishnamurthy - */ - -public class ExchangeTradedOptionDefinitions { - - private static final void DisplayFuturesOptionInfo ( - String strContractName) - { - System.out.println ("--------------------------------------------------------------------------------------------------------"); - - System.out.println ( - TreasuryFuturesOptionContainer.FromContract ( - strContractName - ) - ); - } - - public static final void main ( - final String[] args) - { - EnvManager.InitEnv (""); - - DisplayFuturesOptionInfo ("USD-TREASURY-BOND-ULTRA"); - - DisplayFuturesOptionInfo ("USD-TREASURY-BOND-30Y"); - - DisplayFuturesOptionInfo ("USD-TREASURY-NOTE-10Y"); - - DisplayFuturesOptionInfo ("USD-TREASURY-NOTE-5Y"); - - DisplayFuturesOptionInfo ("USD-TREASURY-NOTE-2Y"); - - DisplayFuturesOptionInfo ("EUR-EURO-BUXL-30Y"); - - DisplayFuturesOptionInfo ("EUR-EURO-BUND-10Y"); - - DisplayFuturesOptionInfo ("EUR-EURO-BOBL-5Y"); - - DisplayFuturesOptionInfo ("EUR-EURO-SCHATZ-2Y"); - - DisplayFuturesOptionInfo ("EUR-TREASURY-BONO-10Y"); - - System.out.println ("--------------------------------------------------------------------------------------------------------"); - } -} diff --git a/org/drip/sample/treasuryfutures/ExpiryDeliveryTradingDates.java b/org/drip/sample/treasuryfutures/ExpiryDeliveryTradingDates.java deleted file mode 100644 index 2410c47..0000000 --- a/org/drip/sample/treasuryfutures/ExpiryDeliveryTradingDates.java +++ /dev/null @@ -1,149 +0,0 @@ - -package org.drip.sample.treasuryfutures; - -import org.drip.analytics.date.*; -import org.drip.market.exchange.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ExpiryDeliveryTradingDates illustrates Generation of Event Dates from the Expiry Month/Year of the Bond - * Futures Contracts. - * - * @author Lakshmi Krishnamurthy - */ - -public class ExpiryDeliveryTradingDates { - - private static final void DisplayEventDateInfo ( - String strCurrency, - String strUnderlierType, - String strUnderlierSubtype, - String strMaturityTenor, - JulianDate dtSettle) - throws Exception - { - TreasuryFuturesConvention bfc = TreasuryFuturesConventionContainer.FromJurisdictionTypeMaturity ( - strCurrency, - strUnderlierType, - strUnderlierSubtype, - strMaturityTenor - ); - - System.out.println ("\t| " + - bfc.eventDates ( - DateUtil.Year (dtSettle.julian()), - DateUtil.Month (dtSettle.julian()) - ) + " | [" + - strCurrency + "-" + - strUnderlierType + "-" + - strUnderlierSubtype + "-" + - strMaturityTenor + "]" - ); - } - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - System.out.println(); - - java.lang.String strForwardTenor = "3M"; - - JulianDate dtToday = DateUtil.Today().addTenor (strForwardTenor); - - System.out.println ("\t|------------------------------------------------------------------------------------------------|"); - - System.out.println ("\t| EXPIRY | DELIV START | DELIV END | DELIV NOTICE | LAST TRADE | FUTURE |"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------|"); - - DisplayEventDateInfo ("AUD", "BANK", "BILLS", "3M", dtToday); - - DisplayEventDateInfo ("AUD", "TREASURY", "BOND", "3Y", dtToday); - - DisplayEventDateInfo ("AUD", "TREASURY", "BOND", "10Y", dtToday); - - DisplayEventDateInfo ("EUR", "EURO", "SCHATZ", "2Y", dtToday); - - DisplayEventDateInfo ("EUR", "EURO", "BOBL", "5Y", dtToday); - - DisplayEventDateInfo ("EUR", "EURO", "BUND", "10Y", dtToday); - - DisplayEventDateInfo ("EUR", "EURO", "BUXL", "30Y", dtToday); - - DisplayEventDateInfo ("EUR", "TREASURY", "BONO", "10Y", dtToday); - - DisplayEventDateInfo ("GBP", "SHORT", "GILT", "2Y", dtToday); - - DisplayEventDateInfo ("GBP", "MEDIUM", "GILT", "5Y", dtToday); - - DisplayEventDateInfo ("GBP", "LONG", "GILT", "10Y", dtToday); - - DisplayEventDateInfo ("JPY", "TREASURY", "JGB", "5Y", dtToday); - - DisplayEventDateInfo ("JPY", "TREASURY", "JGB", "10Y", dtToday); - - DisplayEventDateInfo ("USD", "TREASURY", "NOTE", "2Y", dtToday); - - DisplayEventDateInfo ("USD", "TREASURY", "NOTE", "3Y", dtToday); - - DisplayEventDateInfo ("USD", "TREASURY", "NOTE", "5Y", dtToday); - - DisplayEventDateInfo ("USD", "TREASURY", "NOTE", "10Y", dtToday); - - DisplayEventDateInfo ("USD", "TREASURY", "BOND", "30Y", dtToday); - - DisplayEventDateInfo ("USD", "TREASURY", "BOND", "ULTRA", dtToday); - - System.out.println ("\t|------------------------------------------------------------------------------------------------|\n"); - } -} diff --git a/org/drip/sample/treasuryfutures/UST02Y.java b/org/drip/sample/treasuryfutures/UST02Y.java deleted file mode 100644 index 9d247cc..0000000 --- a/org/drip/sample/treasuryfutures/UST02Y.java +++ /dev/null @@ -1,906 +0,0 @@ - -package org.drip.sample.treasuryfutures; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.analytics.daycount.Convention; -import org.drip.analytics.output.BondRVMeasures; -import org.drip.param.creator.MarketParamsBuilder; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.quote.*; -import org.drip.param.valuation.*; -import org.drip.product.credit.*; -import org.drip.product.definition.*; -import org.drip.product.govvie.TreasuryFutures; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; -import org.drip.state.creator.ScenarioRepoCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.govvie.GovvieCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * UST02Y demonstrates the Details behind the Implementation and the Pricing of the 2Y TU1 UST Futures - * Contract. - * - * @author Lakshmi Krishnamurthy - */ - -public class UST02Y { - - private static final MergedDiscountForwardCurve FundingCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrDepositMaturityTenor = new String[] { - "2D", - "1W", - "1M", - "2M", - "3M" - }; - - double[] adblDepositQuote = new double[] { - 0.00195, // 2D - 0.00176, // 1W - 0.00301, // 1M - 0.00401, // 2M - 0.00492 // 3M - }; - - double[] adblFuturesQuote = new double[] { - 0.00609, - 0.00687 - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.00762, // 1Y - 0.01055, // 2Y - 0.01300, // 3Y - 0.01495, // 4Y - 0.01651, // 5Y - 0.01787, // 6Y - 0.01904, // 7Y - 0.02005, // 8Y - 0.02090, // 9Y - 0.02166, // 10Y - 0.02231, // 11Y - 0.02289, // 12Y - 0.02414, // 15Y - 0.02570, // 20Y - 0.02594, // 25Y - 0.02627, // 30Y - 0.02648, // 40Y - 0.02632 // 50Y - }; - - MergedDiscountForwardCurve dcFunding = LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - adblFuturesQuote, - "ForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate" - ); - - Component[] aDepositComp = OTCInstrumentBuilder.FundingDeposit ( - dtSpot, - strCurrency, - astrDepositMaturityTenor - ); - - Component[] aFuturesComp = ExchangeInstrumentBuilder.ForwardRateFuturesPack ( - dtSpot, - adblFuturesQuote.length, - strCurrency - ); - - Component[] aFixFloatComp = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - astrFixFloatMaturityTenor, - "MAIN", - 0. - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - System.out.println ("\n\n\t|------------------------------------||"); - - System.out.println ("\t| DEPOSIT INPUT vs. CALC ||"); - - System.out.println ("\t|------------------------------------||"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t| [" + aDepositComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aDepositComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|------------------------------------||"); - - System.out.println ("\n\t|------------------------------------||"); - - System.out.println ("\t| FUTURES INPUT vs. CALC ||"); - - System.out.println ("\t|------------------------------------||"); - - for (int i = 0; i < aFuturesComp.length; ++i) - System.out.println ("\t| [" + aFuturesComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFuturesComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFuturesQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|------------------------------------||"); - - System.out.println ("\n\t|-----------------------------------------------|| "); - - System.out.println ("\t| FIX-FLOAT INPUTS vs CALIB ||"); - - System.out.println ("\t|-----------------------------------------------|| "); - - for (int i = 0; i < aFixFloatComp.length; ++i) - System.out.println ("\t| [" + aFixFloatComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "CalibSwapRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFixFloatQuote[i], 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "FairPremium" - ), 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-----------------------------------------------|| \n"); - - return dcFunding; - } - - private static final void OnTheRunQuote ( - final CurveSurfaceQuoteContainer csqc, - final String[] astrOnTheRunCode, - final double[] adblYield) - throws Exception - { - for (int i = 0; i < astrOnTheRunCode.length; ++i) { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Yield", - new MultiSided ( - "mid", - adblYield[i] - ), - true - ); - - csqc.setProductQuote ( - astrOnTheRunCode[i], - pmmq - ); - } - } - - private static final void FuturesQuote ( - final CurveSurfaceQuoteContainer csqc, - final TreasuryFutures bf, - final double dblFuturesPrice) - throws Exception - { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Price", - new MultiSided ( - "mid", - dblFuturesPrice - ), - true - ); - - csqc.setProductQuote ( - bf.name(), - pmmq - ); - } - - private static final void RepoCurves ( - final JulianDate dtSpot, - final CurveSurfaceQuoteContainer csqc, - final Bond[] aBond, - final double[] adblRepoRate) - throws Exception - { - for (int i = 0; i < aBond.length; ++i) { - csqc.setRepoState ( - ScenarioRepoCurveBuilder.FlatRateRepoCurve ( - dtSpot, - aBond[i], - adblRepoRate[i] - ) - ); - } - } - - private static final GovvieCurve TreasuryCurve ( - final JulianDate dtSpot, - final String strCode, - final double[] adblCoupon, - final double[] adblYield) - throws Exception - { - JulianDate[] adtEffective = new JulianDate[] { - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot - }; - - JulianDate[] adtMaturity = new JulianDate[] { - dtSpot.addTenor ("1Y"), - dtSpot.addTenor ("2Y"), - dtSpot.addTenor ("3Y"), - dtSpot.addTenor ("5Y"), - dtSpot.addTenor ("7Y"), - dtSpot.addTenor ("10Y"), - dtSpot.addTenor ("30Y") - }; - - GovvieCurve gc = LatentMarketStateBuilder.ShapePreservingGovvieCurve ( - strCode, - dtSpot, - adtEffective, - adtMaturity, - adblCoupon, - adblYield, - "Yield" - ); - - BondComponent[] aComp = TreasuryBuilder.FromCode ( - strCode, - adtEffective, - adtMaturity, - adblCoupon - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - "USD" - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setGovvieState (gc); - - System.out.println ("\n\t|--------------------------------------------||"); - - System.out.println ("\t| TREASURY INPUT vs CALIB YIELD ||"); - - System.out.println ("\t|--------------------------------------------||"); - - for (int i = 0; i < aComp.length; ++i) - System.out.println ("\t| " + aComp[i].name() + " | " + - FormatUtil.FormatDouble (adblYield[i], 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (aComp[i].yieldFromPrice ( - valParams, - null, - null, - aComp[i].maturityDate().julian(), - 1., - aComp[i].priceFromYield ( - valParams, - null, - null, - gc.yield (aComp[i].maturityDate().julian()) - ) - ), 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t|--------------------------------------------||"); - - return gc; - } - - private static final void AccumulateBondMarketQuote ( - final CurveSurfaceQuoteContainer csqc, - final Bond[] aBond, - final double[] adblCleanPrice) - throws Exception - { - for (int i = 0; i < aBond.length; ++i) { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Price", - new MultiSided ( - "mid", - adblCleanPrice[i] - ), - true - ); - - csqc.setProductQuote ( - aBond[i].name(), - pmmq - ); - } - } - - /* - * Print the Bond RV Measures - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final boolean PrintRVMeasures ( - final String strPrefix, - final BondRVMeasures rv) - throws Exception - { - if (null == rv) return false; - - System.out.println (strPrefix + "ASW : " + FormatUtil.FormatDouble (rv.asw(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Bond Basis : " + FormatUtil.FormatDouble (rv.bondBasis(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Convexity : " + FormatUtil.FormatDouble (rv.convexity(), 1, 4, 1000000.)); - - System.out.println (strPrefix + "Discount Margin : " + FormatUtil.FormatDouble (rv.discountMargin(), 2, 0, 10000.)); - - System.out.println (strPrefix + "G Spread : " + FormatUtil.FormatDouble (rv.gSpread(), 2, 0, 10000.)); - - System.out.println (strPrefix + "I Spread : " + FormatUtil.FormatDouble (rv.iSpread(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Macaulay Duration : " + FormatUtil.FormatDouble (rv.macaulayDuration(), 1, 4, 1.)); - - System.out.println (strPrefix + "Modified Duration : " + FormatUtil.FormatDouble (rv.modifiedDuration(), 1, 4, 10000.)); - - System.out.println (strPrefix + "Price : " + FormatUtil.FormatDouble (rv.price(), 2, 4, 100.)); - - System.out.println (strPrefix + "Workout Date : " + new JulianDate (rv.wi().date())); - - System.out.println (strPrefix + "Workout Factor : " + FormatUtil.FormatDouble (rv.wi().factor(), 2, 4, 1.)); - - System.out.println (strPrefix + "Workout Type : " + rv.wi().type()); - - System.out.println (strPrefix + "Workout Yield : " + FormatUtil.FormatDouble (rv.wi().yield(), 1, 4, 100.) + "%"); - - System.out.println (strPrefix + "Yield01 : " + FormatUtil.FormatDouble (rv.yield01(), 1, 4, 10000.)); - - System.out.println (strPrefix + "Yield Basis : " + FormatUtil.FormatDouble (rv.bondBasis(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Yield Spread : " + FormatUtil.FormatDouble (rv.bondBasis(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Z Spread : " + FormatUtil.FormatDouble (rv.zSpread(), 2, 0, 10000.)); - - return true; - } - - private static final void BondRVMeasuresSample ( - final BondComponent bond, - final JulianDate dtSpot, - final CurveSurfaceQuoteContainer csqc, - final double dblPrice) - throws Exception - { - - ValuationParams valParams = ValuationParams.Spot ( - dtSpot, - 0, - "", - Convention.DATE_ROLL_ACTUAL - ); - - /* - * Compute the work-out date given the price. - */ - - WorkoutInfo wi = bond.exerciseYieldFromPrice ( - valParams, - csqc, - null, - dblPrice - ); - - /* - * Compute the base RV measures to the work-out date. - */ - - org.drip.analytics.output.BondRVMeasures rvm = bond.standardMeasures ( - valParams, - null, - csqc, - null, - wi, - dblPrice - ); - - System.out.println ("\t|---------------------------------------------||\n"); - - PrintRVMeasures ("\t|\t", rvm); - - Map mapOutput = bond.value ( - valParams, - null, - csqc, - null - ); - - System.out.println ("\t|---------------------------------------------||\n"); - - System.out.println ("\n\t|--------------------------------------------------------------------------||"); - - System.out.println ("\t| CTD Full Bond Measures ||"); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t|\t" + me.getKey() + " => " + me.getValue()); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - } - - private static final void ComputeFuturesMeasures ( - final TreasuryFutures bf, - final JulianDate dtSpot, - final CurveSurfaceQuoteContainer csqc, - final double[] adblCleanPrice) - throws Exception - { - ValuationParams valParams = ValuationParams.Spot ( - dtSpot, - 0, - "", - Convention.DATE_ROLL_ACTUAL - ); - - AccumulateBondMarketQuote ( - csqc, - bf.basket(), - adblCleanPrice - ); - - Map mapOutput = bf.value ( - valParams, - null, - csqc, - null - ); - - System.out.println ("\n\t|--------------------------------------------------------------------------||"); - - System.out.println ("\t| Bond Futures Measures ||"); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t|\t" + me.getKey() + " => " + me.getValue()); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ); - - String strCurrency = "USD"; - String strTreasuryCode = "UST"; - - MergedDiscountForwardCurve dcFunding = FundingCurve ( - dtSpot, - strCurrency - ); - - double[] adblTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - GovvieCurve gc = TreasuryCurve ( - dtSpot, - strTreasuryCode, - adblTreasuryCoupon, - adblTreasuryYield - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - csqc.setGovvieState (gc); - - OnTheRunQuote ( - csqc, - new String[] { - "01YON", - "02YON", - "03YON", - "05YON", - "07YON", - "10YON", - "30YON" - }, - adblTreasuryYield - ); - - Bond ust912828UE = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.DECEMBER, - 31 - ), - DateUtil.CreateFromYMD ( - 2017, - DateUtil.DECEMBER, - 31 - ), - 0.00750 - ); - - Bond ust912828G7 = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.DECEMBER, - 15 - ), - DateUtil.CreateFromYMD ( - 2017, - DateUtil.DECEMBER, - 15 - ), - 0.01000 - ); - - Bond ust912828UA = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.NOVEMBER, - 30 - ), - DateUtil.CreateFromYMD ( - 2017, - DateUtil.NOVEMBER, - 30 - ), - 0.00625 - ); - - Bond ust912828G2 = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.NOVEMBER, - 15 - ), - DateUtil.CreateFromYMD ( - 2017, - DateUtil.NOVEMBER, - 15 - ), - 0.00875 - ); - - Bond ust912828TW = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.OCTOBER, - 31 - ), - DateUtil.CreateFromYMD ( - 2017, - DateUtil.OCTOBER, - 31 - ), - 0.00750 - ); - - Bond ust912828F5 = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.OCTOBER, - 15 - ), - DateUtil.CreateFromYMD ( - 2017, - DateUtil.OCTOBER, - 17 - ), - 0.00875 - ); - - Bond ust912828TS = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.SEPTEMBER, - 30 - ), - DateUtil.CreateFromYMD ( - 2017, - DateUtil.SEPTEMBER, - 30 - ), - 0.00625 - ); - - Bond ust912828D9 = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.SEPTEMBER, - 15 - ), - DateUtil.CreateFromYMD ( - 2017, - DateUtil.SEPTEMBER, - 15 - ), - 0.01000 - ); - - Bond[] aBond = new Bond[] { - ust912828UE, - ust912828G7, - ust912828UA, - ust912828G2, - ust912828TW, - ust912828F5, - ust912828TS, - ust912828D9 - }; - - double dblContractSize = 200000.; - double dblFuturesPrice = 1.0808594; - - TreasuryFutures tu1 = new TreasuryFutures ( - aBond, - new double[] { - 0.9024, // 912828UE - 0.9071, // 912828G7 - 0.9040, // 912828UA - 0.9085, // 912828G2 - 0.9101, // 912828TW - 0.9122, // 912828F5 - 0.9119, // 912828TS - 0.9181, // 912828D9 - }, - null - ); - - double[] adblRepoRate = new double[] { - 0.00800, - 0.00825, - 0.00850, - 0.00875, - 0.00900, - 0.00925, - 0.00950, - 0.01000 - }; - - RepoCurves ( - dtSpot, - csqc, - aBond, - adblRepoRate - ); - - tu1.setExpiry ( - DateUtil.CreateFromYMD ( - 2016, - DateUtil.FEBRUARY, - 15 - ) - ); - - double[] adblCleanPrice = new double[] { - 0.9956250, - 1.0009375, - 0.9937500, - 0.9990625, - 0.9975000, - 1.0000000, - 0.9953125, - 1.0025000 - }; - - FuturesQuote ( - csqc, - tu1, - dblFuturesPrice - ); - - Bond bondCTD = tu1.cheapestToDeliverYield ( - dtSpot.julian(), - adblCleanPrice - ).bond(); - - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| Bond #1: " + ust912828UE.name() + " ||"); - - System.out.println ("\t| Bond #2: " + ust912828G7.name() + " ||"); - - System.out.println ("\t| Bond #3: " + ust912828UA.name() + " ||"); - - System.out.println ("\t| Bond #4: " + ust912828G2.name() + " ||"); - - System.out.println ("\t| Bond #5: " + ust912828TW.name() + " ||"); - - System.out.println ("\t| Bond #6: " + ust912828F5.name() + " ||"); - - System.out.println ("\t| Bond #7: " + ust912828TS.name() + " ||"); - - System.out.println ("\t| Bond #8: " + ust912828D9.name() + " ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\t| Cheapest to Deliver: " + bondCTD.name() + " ||"); - - BondRVMeasuresSample ( - (BondComponent) bondCTD, - dtSpot, - csqc, - 1.0025000 - ); - - ComputeFuturesMeasures ( - tu1, - dtSpot, - csqc, - adblCleanPrice - ); - - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| Futures Price : " + FormatUtil.FormatDouble (dblFuturesPrice, 2, 5, 100.) + " ||"); - - System.out.println ("\t| Contract Size : " + FormatUtil.FormatDouble (dblContractSize, 1, 2, 1.) + " ||"); - - System.out.println ("\t| Contract Value : " + FormatUtil.FormatDouble (dblContractSize * dblFuturesPrice, 1, 2, 1.) + " ||"); - - System.out.println ("\t|---------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/treasuryfutures/UST05Y.java b/org/drip/sample/treasuryfutures/UST05Y.java deleted file mode 100644 index 543d00b..0000000 --- a/org/drip/sample/treasuryfutures/UST05Y.java +++ /dev/null @@ -1,925 +0,0 @@ - -package org.drip.sample.treasuryfutures; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.analytics.daycount.Convention; -import org.drip.analytics.output.BondRVMeasures; -import org.drip.param.creator.MarketParamsBuilder; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.quote.*; -import org.drip.param.valuation.*; -import org.drip.product.credit.*; -import org.drip.product.definition.*; -import org.drip.product.govvie.TreasuryFutures; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; -import org.drip.state.creator.ScenarioRepoCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.govvie.GovvieCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * UST05Y demonstrates the Details behind the Implementation and the Pricing of the 5Y FV1 UST Futures - * Contract. - * - * @author Lakshmi Krishnamurthy - */ - -public class UST05Y { - - private static final MergedDiscountForwardCurve FundingCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrDepositMaturityTenor = new String[] { - "2D", - "1W", - "1M", - "2M", - "3M" - }; - - double[] adblDepositQuote = new double[] { - 0.00195, // 2D - 0.00176, // 1W - 0.00301, // 1M - 0.00401, // 2M - 0.00492 // 3M - }; - - double[] adblFuturesQuote = new double[] { - 0.00609, - 0.00687 - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.00762, // 1Y - 0.01055, // 2Y - 0.01300, // 3Y - 0.01495, // 4Y - 0.01651, // 5Y - 0.01787, // 6Y - 0.01904, // 7Y - 0.02005, // 8Y - 0.02090, // 9Y - 0.02166, // 10Y - 0.02231, // 11Y - 0.02289, // 12Y - 0.02414, // 15Y - 0.02570, // 20Y - 0.02594, // 25Y - 0.02627, // 30Y - 0.02648, // 40Y - 0.02632 // 50Y - }; - - MergedDiscountForwardCurve dcFunding = LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - adblFuturesQuote, - "ForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate" - ); - - Component[] aDepositComp = OTCInstrumentBuilder.FundingDeposit ( - dtSpot, - strCurrency, - astrDepositMaturityTenor - ); - - Component[] aFuturesComp = ExchangeInstrumentBuilder.ForwardRateFuturesPack ( - dtSpot, - adblFuturesQuote.length, - strCurrency - ); - - Component[] aFixFloatComp = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - astrFixFloatMaturityTenor, - "MAIN", - 0. - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - System.out.println ("\n\n\t|------------------------------------||"); - - System.out.println ("\t| DEPOSIT INPUT vs. CALC ||"); - - System.out.println ("\t|------------------------------------||"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t| [" + aDepositComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aDepositComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|------------------------------------||"); - - System.out.println ("\n\t|------------------------------------||"); - - System.out.println ("\t| FUTURES INPUT vs. CALC ||"); - - System.out.println ("\t|------------------------------------||"); - - for (int i = 0; i < aFuturesComp.length; ++i) - System.out.println ("\t| [" + aFuturesComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFuturesComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFuturesQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|------------------------------------||"); - - System.out.println ("\n\t|-----------------------------------------------|| "); - - System.out.println ("\t| FIX-FLOAT INPUTS vs CALIB ||"); - - System.out.println ("\t|-----------------------------------------------|| "); - - for (int i = 0; i < aFixFloatComp.length; ++i) - System.out.println ("\t| [" + aFixFloatComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "CalibSwapRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFixFloatQuote[i], 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "FairPremium" - ), 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-----------------------------------------------|| \n"); - - return dcFunding; - } - - private static final void OnTheRunQuote ( - final CurveSurfaceQuoteContainer csqc, - final String[] astrOnTheRunCode, - final double[] adblYield) - throws Exception - { - for (int i = 0; i < astrOnTheRunCode.length; ++i) { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Yield", - new MultiSided ( - "mid", - adblYield[i] - ), - true - ); - - csqc.setProductQuote ( - astrOnTheRunCode[i], - pmmq - ); - } - } - - private static final void FuturesQuote ( - final CurveSurfaceQuoteContainer csqc, - final TreasuryFutures bf, - final double dblFuturesPrice) - throws Exception - { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Price", - new MultiSided ( - "mid", - dblFuturesPrice - ), - true - ); - - csqc.setProductQuote ( - bf.name(), - pmmq - ); - } - - private static final void RepoCurves ( - final JulianDate dtSpot, - final CurveSurfaceQuoteContainer csqc, - final Bond[] aBond, - final double[] adblRepoRate) - throws Exception - { - for (int i = 0; i < aBond.length; ++i) - csqc.setRepoState ( - ScenarioRepoCurveBuilder.FlatRateRepoCurve ( - dtSpot, - aBond[i], - adblRepoRate[i] - ) - ); - } - - private static final GovvieCurve TreasuryCurve ( - final JulianDate dtSpot, - final String strCode, - final double[] adblCoupon, - final double[] adblYield) - throws Exception - { - JulianDate[] adtEffective = new JulianDate[] { - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot - }; - - JulianDate[] adtMaturity = new JulianDate[] { - dtSpot.addTenor ("1Y"), - dtSpot.addTenor ("2Y"), - dtSpot.addTenor ("3Y"), - dtSpot.addTenor ("5Y"), - dtSpot.addTenor ("7Y"), - dtSpot.addTenor ("10Y"), - dtSpot.addTenor ("30Y") - }; - - GovvieCurve gc = LatentMarketStateBuilder.ShapePreservingGovvieCurve ( - strCode, - dtSpot, - adtEffective, - adtMaturity, - adblCoupon, - adblYield, - "Yield" - ); - - BondComponent[] aComp = TreasuryBuilder.FromCode ( - strCode, - adtEffective, - adtMaturity, - adblCoupon - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - "USD" - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setGovvieState (gc); - - System.out.println ("\n\t|--------------------------------------------||"); - - System.out.println ("\t| TREASURY INPUT vs CALIB YIELD ||"); - - System.out.println ("\t|--------------------------------------------||"); - - for (int i = 0; i < aComp.length; ++i) - System.out.println ("\t| " + aComp[i].name() + " | " + - FormatUtil.FormatDouble (adblYield[i], 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (aComp[i].yieldFromPrice ( - valParams, - null, - null, - aComp[i].maturityDate().julian(), - 1., - aComp[i].priceFromYield ( - valParams, - null, - null, - gc.yield (aComp[i].maturityDate().julian()) - ) - ), 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t|--------------------------------------------||"); - - return gc; - } - - private static final void AccumulateBondMarketQuote ( - final CurveSurfaceQuoteContainer csqc, - final Bond[] aBond, - final double[] adblCleanPrice) - throws Exception - { - for (int i = 0; i < aBond.length; ++i) { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Price", - new MultiSided ( - "mid", - adblCleanPrice[i] - ), - true - ); - - csqc.setProductQuote ( - aBond[i].name(), - pmmq - ); - } - } - - /* - * Print the Bond RV Measures - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final boolean PrintRVMeasures ( - final String strPrefix, - final BondRVMeasures rv) - throws Exception - { - if (null == rv) return false; - - System.out.println (strPrefix + "ASW : " + FormatUtil.FormatDouble (rv.asw(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Bond Basis : " + FormatUtil.FormatDouble (rv.bondBasis(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Convexity : " + FormatUtil.FormatDouble (rv.convexity(), 1, 4, 1000000.)); - - System.out.println (strPrefix + "Discount Margin : " + FormatUtil.FormatDouble (rv.discountMargin(), 2, 0, 10000.)); - - System.out.println (strPrefix + "G Spread : " + FormatUtil.FormatDouble (rv.gSpread(), 2, 0, 10000.)); - - System.out.println (strPrefix + "I Spread : " + FormatUtil.FormatDouble (rv.iSpread(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Macaulay Duration : " + FormatUtil.FormatDouble (rv.macaulayDuration(), 1, 4, 1.)); - - System.out.println (strPrefix + "Modified Duration : " + FormatUtil.FormatDouble (rv.modifiedDuration(), 1, 4, 10000.)); - - System.out.println (strPrefix + "Price : " + FormatUtil.FormatDouble (rv.price(), 2, 4, 100.)); - - System.out.println (strPrefix + "Workout Date : " + new JulianDate (rv.wi().date())); - - System.out.println (strPrefix + "Workout Factor : " + FormatUtil.FormatDouble (rv.wi().factor(), 2, 4, 1.)); - - System.out.println (strPrefix + "Workout Type : " + rv.wi().type()); - - System.out.println (strPrefix + "Workout Yield : " + FormatUtil.FormatDouble (rv.wi().yield(), 1, 4, 100.) + "%"); - - System.out.println (strPrefix + "Yield01 : " + FormatUtil.FormatDouble (rv.yield01(), 1, 4, 10000.)); - - System.out.println (strPrefix + "Yield Basis : " + FormatUtil.FormatDouble (rv.bondBasis(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Yield Spread : " + FormatUtil.FormatDouble (rv.bondBasis(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Z Spread : " + FormatUtil.FormatDouble (rv.zSpread(), 2, 0, 10000.)); - - return true; - } - - private static final void BondRVMeasuresSample ( - final BondComponent bond, - final JulianDate dtSpot, - final CurveSurfaceQuoteContainer csqc, - final double dblPrice) - throws Exception - { - - ValuationParams valParams = ValuationParams.Spot ( - dtSpot, - 0, - "", - Convention.DATE_ROLL_ACTUAL - ); - - /* - * Compute the work-out date given the price. - */ - - WorkoutInfo wi = bond.exerciseYieldFromPrice ( - valParams, - csqc, - null, - dblPrice - ); - - /* - * Compute the base RV measures to the work-out date. - */ - - org.drip.analytics.output.BondRVMeasures rvm = bond.standardMeasures ( - valParams, - null, - csqc, - null, - wi, - dblPrice - ); - - System.out.println ("\t|---------------------------------------------||\n"); - - PrintRVMeasures ("\t|\t", rvm); - - Map mapOutput = bond.value ( - valParams, - null, - csqc, - null - ); - - System.out.println ("\t|---------------------------------------------||\n"); - - System.out.println ("\n\t|--------------------------------------------------------------------------||"); - - System.out.println ("\t| CTD Full Bond Measures ||"); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t|\t" + me.getKey() + " => " + me.getValue()); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - } - - private static final void ComputeFuturesMeasures ( - final TreasuryFutures bf, - final JulianDate dtSpot, - final CurveSurfaceQuoteContainer csqc, - final double[] adblCleanPrice) - throws Exception - { - ValuationParams valParams = ValuationParams.Spot ( - dtSpot, - 0, - "", - Convention.DATE_ROLL_ACTUAL - ); - - AccumulateBondMarketQuote ( - csqc, - bf.basket(), - adblCleanPrice - ); - - Map mapOutput = bf.value ( - valParams, - null, - csqc, - null - ); - - System.out.println ("\n\t|--------------------------------------------------------------------------||"); - - System.out.println ("\t| Bond Futures Measures ||"); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t|\t" + me.getKey() + " => " + me.getValue()); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ); - - String strCurrency = "USD"; - String strTreasuryCode = "UST"; - - MergedDiscountForwardCurve dcFunding = FundingCurve ( - dtSpot, - strCurrency - ); - - double[] adblTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - GovvieCurve gc = TreasuryCurve ( - dtSpot, - strTreasuryCode, - adblTreasuryCoupon, - adblTreasuryYield - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - csqc.setGovvieState (gc); - - OnTheRunQuote ( - csqc, - new String[] { - "01YON", - "02YON", - "03YON", - "05YON", - "07YON", - "10YON", - "30YON" - }, - adblTreasuryYield - ); - - Bond ust912828J5 = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.FEBRUARY, - 28 - ), - DateUtil.CreateFromYMD ( - 2020, - DateUtil.FEBRUARY, - 29 - ), - 0.01375 - ); - - Bond ust912828J8 = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.MARCH, - 31 - ), - DateUtil.CreateFromYMD ( - 2020, - DateUtil.MARCH, - 31 - ), - 0.01375 - ); - - Bond ust912828K5 = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.APRIL, - 30 - ), - DateUtil.CreateFromYMD ( - 2020, - DateUtil.APRIL, - 30 - ), - 0.01375 - ); - - Bond ust912828XE = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.MAY, - 31 - ), - DateUtil.CreateFromYMD ( - 2020, - DateUtil.MAY, - 31 - ), - 0.01500 - ); - - Bond ust912828XH = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.JUNE, - 30 - ), - DateUtil.CreateFromYMD ( - 2020, - DateUtil.JUNE, - 30 - ), - 0.01625 - ); - - Bond ust912828XM = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.JULY, - 31 - ), - DateUtil.CreateFromYMD ( - 2020, - DateUtil.JULY, - 31 - ), - 0.01625 - ); - - Bond ust912828L3 = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.AUGUST, - 31 - ), - DateUtil.CreateFromYMD ( - 2020, - DateUtil.AUGUST, - 31 - ), - 0.01375 - ); - - Bond ust912828L6 = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.SEPTEMBER, - 30 - ), - DateUtil.CreateFromYMD ( - 2020, - DateUtil.SEPTEMBER, - 30 - ), - 0.01375 - ); - - Bond ust912828L9 = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.OCTOBER, - 31 - ), - DateUtil.CreateFromYMD ( - 2020, - DateUtil.OCTOBER, - 31 - ), - 0.01375 - ); - - double dblContractSize = 100000.; - double dblFuturesPrice = 1.1900000; - - Bond[] aBond = new Bond[] { - ust912828J5, - ust912828J8, - ust912828K5, - ust912828XE, - ust912828XH, - ust912828XM, - ust912828L3, - ust912828L6, - ust912828L9 - }; - - TreasuryFutures ust5YFutures = new TreasuryFutures ( - aBond, - new double[] { - 0.8317, // 912828J5 - 0.8287, // 912828J8 - 0.8258, // 912828K5 - 0.8276, // 912828XE - 0.8297, // 912828XH - 0.8269, // 912828XM - 0.8141, // 912828L3 - 0.8113, // 912828L6 - 0.8084 // 912828L9 - }, - null - ); - - double[] adblRepoRate = new double[] { - 0.00800, - 0.00825, - 0.00850, - 0.00875, - 0.00900, - 0.00925, - 0.00950, - 0.00975, - 0.01000 - }; - - RepoCurves ( - dtSpot, - csqc, - aBond, - adblRepoRate - ); - - ust5YFutures.setExpiry ( - DateUtil.CreateFromYMD ( - 2016, - DateUtil.FEBRUARY, - 15 - ) - ); - - double[] adblCleanPrice = new double[] { - 0.9909375, - 0.9900000, - 0.9890625, - 0.9943750, - 0.9984375, - 0.9978125, - 0.9862500, - 0.9850000, - 0.9853125 - }; - - FuturesQuote ( - csqc, - ust5YFutures, - dblFuturesPrice - ); - - Bond bondCTD = ust5YFutures.cheapestToDeliverYield ( - dtSpot.julian(), - adblCleanPrice - ).bond(); - - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| Bond #1: " + ust912828J5.name() + " ||"); - - System.out.println ("\t| Bond #2: " + ust912828J8.name() + " ||"); - - System.out.println ("\t| Bond #3: " + ust912828K5.name() + " ||"); - - System.out.println ("\t| Bond #4: " + ust912828XE.name() + " ||"); - - System.out.println ("\t| Bond #5: " + ust912828XH.name() + " ||"); - - System.out.println ("\t| Bond #6: " + ust912828XM.name() + " ||"); - - System.out.println ("\t| Bond #7: " + ust912828L3.name() + " ||"); - - System.out.println ("\t| Bond #8: " + ust912828L6.name() + " ||"); - - System.out.println ("\t| Bond #9: " + ust912828L9.name() + " ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\t| Cheapest to Deliver: " + bondCTD.name() + " ||"); - - BondRVMeasuresSample ( - (BondComponent) bondCTD, - dtSpot, - csqc, - 0.9909375 - ); - - ComputeFuturesMeasures ( - ust5YFutures, - dtSpot, - csqc, - adblCleanPrice - ); - - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| Futures Price : " + FormatUtil.FormatDouble (dblFuturesPrice, 2, 5, 100.) + " ||"); - - System.out.println ("\t| Contract Size : " + FormatUtil.FormatDouble (dblContractSize, 1, 2, 1.) + " ||"); - - System.out.println ("\t| Contract Value : " + FormatUtil.FormatDouble (dblContractSize * dblFuturesPrice, 1, 2, 1.) + " ||"); - - System.out.println ("\t|---------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/treasuryfutures/UST10Y.java b/org/drip/sample/treasuryfutures/UST10Y.java deleted file mode 100644 index 21eec93..0000000 --- a/org/drip/sample/treasuryfutures/UST10Y.java +++ /dev/null @@ -1,1125 +0,0 @@ - -package org.drip.sample.treasuryfutures; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.analytics.daycount.Convention; -import org.drip.analytics.output.BondRVMeasures; -import org.drip.param.creator.MarketParamsBuilder; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.quote.*; -import org.drip.param.valuation.*; -import org.drip.product.credit.*; -import org.drip.product.definition.*; -import org.drip.product.govvie.TreasuryFutures; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; -import org.drip.state.creator.ScenarioRepoCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.govvie.GovvieCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * UST10Y demonstrates the Details behind the Implementation and the Pricing of the 10Y TY1 UST Futures - * Contract. - * - * @author Lakshmi Krishnamurthy - */ - -public class UST10Y { - - private static final MergedDiscountForwardCurve FundingCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrDepositMaturityTenor = new String[] { - "2D", - "1W", - "1M", - "2M", - "3M" - }; - - double[] adblDepositQuote = new double[] { - 0.00195, // 2D - 0.00176, // 1W - 0.00301, // 1M - 0.00401, // 2M - 0.00492 // 3M - }; - - double[] adblFuturesQuote = new double[] { - 0.00609, - 0.00687 - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.00762, // 1Y - 0.01055, // 2Y - 0.01300, // 3Y - 0.01495, // 4Y - 0.01651, // 5Y - 0.01787, // 6Y - 0.01904, // 7Y - 0.02005, // 8Y - 0.02090, // 9Y - 0.02166, // 10Y - 0.02231, // 11Y - 0.02289, // 12Y - 0.02414, // 15Y - 0.02570, // 20Y - 0.02594, // 25Y - 0.02627, // 30Y - 0.02648, // 40Y - 0.02632 // 50Y - }; - - MergedDiscountForwardCurve dcFunding = LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - adblFuturesQuote, - "ForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate" - ); - - Component[] aDepositComp = OTCInstrumentBuilder.FundingDeposit ( - dtSpot, - strCurrency, - astrDepositMaturityTenor - ); - - Component[] aFuturesComp = ExchangeInstrumentBuilder.ForwardRateFuturesPack ( - dtSpot, - adblFuturesQuote.length, - strCurrency - ); - - Component[] aFixFloatComp = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - astrFixFloatMaturityTenor, - "MAIN", - 0. - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - System.out.println ("\n\n\t|------------------------------------||"); - - System.out.println ("\t| DEPOSIT INPUT vs. CALC ||"); - - System.out.println ("\t|------------------------------------||"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t| [" + aDepositComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aDepositComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|------------------------------------||"); - - System.out.println ("\n\t|------------------------------------||"); - - System.out.println ("\t| FUTURES INPUT vs. CALC ||"); - - System.out.println ("\t|------------------------------------||"); - - for (int i = 0; i < aFuturesComp.length; ++i) - System.out.println ("\t| [" + aFuturesComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFuturesComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFuturesQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|------------------------------------||"); - - System.out.println ("\n\t|-----------------------------------------------|| "); - - System.out.println ("\t| FIX-FLOAT INPUTS vs CALIB ||"); - - System.out.println ("\t|-----------------------------------------------|| "); - - for (int i = 0; i < aFixFloatComp.length; ++i) - System.out.println ("\t| [" + aFixFloatComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "CalibSwapRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFixFloatQuote[i], 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "FairPremium" - ), 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-----------------------------------------------|| \n"); - - return dcFunding; - } - - private static final void OnTheRunQuote ( - final CurveSurfaceQuoteContainer csqc, - final String[] astrOnTheRunCode, - final double[] adblYield) - throws Exception - { - for (int i = 0; i < astrOnTheRunCode.length; ++i) { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Yield", - new MultiSided ( - "mid", - adblYield[i] - ), - true - ); - - csqc.setProductQuote ( - astrOnTheRunCode[i], - pmmq - ); - } - } - - private static final void FuturesQuote ( - final CurveSurfaceQuoteContainer csqc, - final TreasuryFutures bf, - final double dblFuturesPrice) - throws Exception - { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Price", - new MultiSided ( - "mid", - dblFuturesPrice - ), - true - ); - - csqc.setProductQuote ( - bf.name(), - pmmq - ); - } - - private static final void RepoCurves ( - final JulianDate dtSpot, - final CurveSurfaceQuoteContainer csqc, - final Bond[] aBond, - final double[] adblRepoRate) - throws Exception - { - for (int i = 0; i < aBond.length; ++i) - csqc.setRepoState ( - ScenarioRepoCurveBuilder.FlatRateRepoCurve ( - dtSpot, - aBond[i], - adblRepoRate[i] - ) - ); - } - - private static final GovvieCurve TreasuryCurve ( - final JulianDate dtSpot, - final String strCode, - final double[] adblCoupon, - final double[] adblYield) - throws Exception - { - JulianDate[] adtEffective = new JulianDate[] { - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot - }; - - JulianDate[] adtMaturity = new JulianDate[] { - dtSpot.addTenor ("1Y"), - dtSpot.addTenor ("2Y"), - dtSpot.addTenor ("3Y"), - dtSpot.addTenor ("5Y"), - dtSpot.addTenor ("7Y"), - dtSpot.addTenor ("10Y"), - dtSpot.addTenor ("30Y") - }; - - GovvieCurve gc = LatentMarketStateBuilder.ShapePreservingGovvieCurve ( - strCode, - dtSpot, - adtEffective, - adtMaturity, - adblCoupon, - adblYield, - "Yield" - ); - - BondComponent[] aComp = TreasuryBuilder.FromCode ( - strCode, - adtEffective, - adtMaturity, - adblCoupon - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - "USD" - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setGovvieState (gc); - - System.out.println ("\n\t|--------------------------------------------||"); - - System.out.println ("\t| TREASURY INPUT vs CALIB YIELD ||"); - - System.out.println ("\t|--------------------------------------------||"); - - for (int i = 0; i < aComp.length; ++i) - System.out.println ("\t| " + aComp[i].name() + " | " + - FormatUtil.FormatDouble (adblYield[i], 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (aComp[i].yieldFromPrice ( - valParams, - null, - null, - aComp[i].maturityDate().julian(), - 1., - aComp[i].priceFromYield ( - valParams, - null, - null, - gc.yield (aComp[i].maturityDate().julian()) - ) - ), 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t|--------------------------------------------||"); - - return gc; - } - - private static final void AccumulateBondMarketQuote ( - final CurveSurfaceQuoteContainer csqc, - final Bond[] aBond, - final double[] adblCleanPrice) - throws Exception - { - for (int i = 0; i < aBond.length; ++i) { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Price", - new MultiSided ( - "mid", - adblCleanPrice[i] - ), - true - ); - - csqc.setProductQuote ( - aBond[i].name(), - pmmq - ); - } - } - - /* - * Print the Bond RV Measures - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final boolean PrintRVMeasures ( - final String strPrefix, - final BondRVMeasures rv) - throws Exception - { - if (null == rv) return false; - - System.out.println (strPrefix + "ASW : " + FormatUtil.FormatDouble (rv.asw(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Bond Basis : " + FormatUtil.FormatDouble (rv.bondBasis(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Convexity : " + FormatUtil.FormatDouble (rv.convexity(), 1, 4, 1000000.)); - - System.out.println (strPrefix + "Discount Margin : " + FormatUtil.FormatDouble (rv.discountMargin(), 2, 0, 10000.)); - - System.out.println (strPrefix + "G Spread : " + FormatUtil.FormatDouble (rv.gSpread(), 2, 0, 10000.)); - - System.out.println (strPrefix + "I Spread : " + FormatUtil.FormatDouble (rv.iSpread(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Macaulay Duration : " + FormatUtil.FormatDouble (rv.macaulayDuration(), 1, 4, 1.)); - - System.out.println (strPrefix + "Modified Duration : " + FormatUtil.FormatDouble (rv.modifiedDuration(), 1, 4, 10000.)); - - System.out.println (strPrefix + "Price : " + FormatUtil.FormatDouble (rv.price(), 2, 4, 100.)); - - System.out.println (strPrefix + "Workout Date : " + new JulianDate (rv.wi().date())); - - System.out.println (strPrefix + "Workout Factor : " + FormatUtil.FormatDouble (rv.wi().factor(), 2, 4, 1.)); - - System.out.println (strPrefix + "Workout Type : " + rv.wi().type()); - - System.out.println (strPrefix + "Workout Yield : " + FormatUtil.FormatDouble (rv.wi().yield(), 1, 4, 100.) + "%"); - - System.out.println (strPrefix + "Yield01 : " + FormatUtil.FormatDouble (rv.yield01(), 1, 4, 10000.)); - - System.out.println (strPrefix + "Yield Basis : " + FormatUtil.FormatDouble (rv.bondBasis(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Yield Spread : " + FormatUtil.FormatDouble (rv.bondBasis(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Z Spread : " + FormatUtil.FormatDouble (rv.zSpread(), 2, 0, 10000.)); - - return true; - } - - private static final void BondRVMeasuresSample ( - final BondComponent bond, - final JulianDate dtSpot, - final CurveSurfaceQuoteContainer csqc, - final double dblPrice) - throws Exception - { - - ValuationParams valParams = ValuationParams.Spot ( - dtSpot, - 0, - "", - Convention.DATE_ROLL_ACTUAL - ); - - /* - * Compute the work-out date given the price. - */ - - WorkoutInfo wi = bond.exerciseYieldFromPrice ( - valParams, - csqc, - null, - dblPrice - ); - - /* - * Compute the base RV measures to the work-out date. - */ - - org.drip.analytics.output.BondRVMeasures rvm = bond.standardMeasures ( - valParams, - null, - csqc, - null, - wi, - dblPrice - ); - - System.out.println ("\t|---------------------------------------------||\n"); - - PrintRVMeasures ("\t|\t", rvm); - - Map mapOutput = bond.value ( - valParams, - null, - csqc, - null - ); - - System.out.println ("\t|---------------------------------------------||\n"); - - System.out.println ("\n\t|--------------------------------------------------------------------------||"); - - System.out.println ("\t| CTD Full Bond Measures ||"); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t|\t" + me.getKey() + " => " + me.getValue()); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - } - - private static final void ComputeFuturesMeasures ( - final TreasuryFutures bf, - final JulianDate dtSpot, - final CurveSurfaceQuoteContainer csqc, - final double[] adblCleanPrice) - throws Exception - { - ValuationParams valParams = ValuationParams.Spot ( - dtSpot, - 0, - "", - Convention.DATE_ROLL_ACTUAL - ); - - AccumulateBondMarketQuote ( - csqc, - bf.basket(), - adblCleanPrice - ); - - Map mapOutput = bf.value ( - valParams, - null, - csqc, - null - ); - - System.out.println ("\n\t|--------------------------------------------------------------------------||"); - - System.out.println ("\t| Bond Futures Measures ||"); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t|\t" + me.getKey() + " => " + me.getValue()); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ); - - String strCurrency = "USD"; - String strTreasuryCode = "UST"; - - MergedDiscountForwardCurve dcFunding = FundingCurve ( - dtSpot, - strCurrency - ); - - double[] adblTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - GovvieCurve gc = TreasuryCurve ( - dtSpot, - strTreasuryCode, - adblTreasuryCoupon, - adblTreasuryYield - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - csqc.setGovvieState (gc); - - OnTheRunQuote ( - csqc, - new String[] { - "01YON", - "02YON", - "03YON", - "05YON", - "07YON", - "10YON", - "30YON" - }, - adblTreasuryYield - ); - - Bond ust912828XG = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.JUNE, - 30 - ), - DateUtil.CreateFromYMD ( - 2022, - DateUtil.JUNE, - 30 - ), - 0.02125 - ); - - Bond ust912828L2 = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.AUGUST, - 31 - ), - DateUtil.CreateFromYMD ( - 2022, - DateUtil.AUGUST, - 31 - ), - 0.01875 - ); - - Bond ust912828XQ = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.JULY, - 31 - ), - DateUtil.CreateFromYMD ( - 2022, - DateUtil.JULY, - 31 - ), - 0.02000 - ); - - Bond ust912828TJ = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.AUGUST, - 15 - ), - DateUtil.CreateFromYMD ( - 2022, - DateUtil.AUGUST, - 15 - ), - 0.01625 - ); - - Bond ust912828M4 = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.OCTOBER, - 31 - ), - DateUtil.CreateFromYMD ( - 2022, - DateUtil.OCTOBER, - 31 - ), - 0.01875 - ); - - Bond ust912828L5 = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.SEPTEMBER, - 30 - ), - DateUtil.CreateFromYMD ( - 2022, - DateUtil.SEPTEMBER, - 30 - ), - 0.01875 - ); - - Bond ust912828TY = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.NOVEMBER, - 15 - ), - DateUtil.CreateFromYMD ( - 2022, - DateUtil.NOVEMBER, - 15 - ), - 0.01625 - ); - - Bond ust912828UN = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.FEBRUARY, - 15 - ), - DateUtil.CreateFromYMD ( - 2023, - DateUtil.FEBRUARY, - 15 - ), - 0.02000 - ); - - Bond ust912828VB = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.MAY, - 15 - ), - DateUtil.CreateFromYMD ( - 2023, - DateUtil.MAY, - 15 - ), - 0.01750 - ); - - Bond ust912828VS = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.AUGUST, - 15 - ), - DateUtil.CreateFromYMD ( - 2023, - DateUtil.AUGUST, - 15 - ), - 0.02500 - ); - - Bond ust912828WE = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.NOVEMBER, - 15 - ), - DateUtil.CreateFromYMD ( - 2023, - DateUtil.NOVEMBER, - 15 - ), - 0.02750 - ); - - Bond ust912828B6 = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.FEBRUARY, - 15 - ), - DateUtil.CreateFromYMD ( - 2024, - DateUtil.FEBRUARY, - 15 - ), - 0.02750 - ); - - Bond ust912828WJ = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.MAY, - 15 - ), - DateUtil.CreateFromYMD ( - 2024, - DateUtil.MAY, - 15 - ), - 0.02500 - ); - - Bond ust912828D5 = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.AUGUST, - 15 - ), - DateUtil.CreateFromYMD ( - 2024, - DateUtil.AUGUST, - 15 - ), - 0.02375 - ); - - Bond ust912828G3 = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.NOVEMBER, - 15 - ), - DateUtil.CreateFromYMD ( - 2024, - DateUtil.NOVEMBER, - 15 - ), - 0.02250 - ); - - Bond ust912828J2 = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.FEBRUARY, - 15 - ), - DateUtil.CreateFromYMD ( - 2025, - DateUtil.FEBRUARY, - 15 - ), - 0.02000 - ); - - Bond ust912828XB = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.MAY, - 15 - ), - DateUtil.CreateFromYMD ( - 2025, - DateUtil.MAY, - 15 - ), - 0.02125 - ); - - Bond ust912828K7 = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.AUGUST, - 15 - ), - DateUtil.CreateFromYMD ( - 2025, - DateUtil.AUGUST, - 15 - ), - 0.02000 - ); - - Bond ust912828M5 = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.NOVEMBER, - 15 - ), - DateUtil.CreateFromYMD ( - 2025, - DateUtil.NOVEMBER, - 15 - ), - 0.02125 - ); - - double dblContractSize = 100000.; - double dblFuturesPrice = 1.26578125; - - Bond[] aBond = new Bond[] { - ust912828XG, - ust912828L2, - ust912828XQ, - ust912828TJ, - ust912828M4, - ust912828L5, - ust912828TY, - ust912828UN, - ust912828VB, - ust912828VS, - ust912828WE, - ust912828B6, - ust912828WJ, - ust912828D5, - ust912828G3, - ust912828J2, - ust912828XB, - ust912828K7, - ust912828M5 - }; - - TreasuryFutures tu1 = new TreasuryFutures ( - aBond, - new double[] { - 0.7939, // 912828XG - 0.7807, // 912828L2 - 0.7873, // 912828XQ - 0.7674, // 912828TJ - 0.7738, // 912828M4 - 0.7669, // 912828L5 - 0.7600, // 912828TY - 0.7741, // 912828UN - 0.7531, // 912828VB - 0.7911, // 912828VS - 0.8009, // 912828WE - 0.7959, // 912828B6 - 0.7748, // 912828WJ - 0.7614, // 912828D5 - 0.7475, // 912828G3 - 0.7249, // 912828J2 - 0.7279, // 912828XB - 0.7135, // 912828K7 - 0.7262 // 912828M5 - }, - null - ); - - double[] adblRepoRate = new double[] { - 0.00800, - 0.00825, - 0.00850, - 0.00875, - 0.00900, - 0.00925, - 0.00950, - 0.00975, - 0.01000, - 0.01025, - 0.01050, - 0.01075, - 0.01100, - 0.01125, - 0.01150, - 0.01175, - 0.01200, - 0.01225, - 0.01250 - }; - - RepoCurves ( - dtSpot, - csqc, - aBond, - adblRepoRate - ); - - tu1.setExpiry ( - DateUtil.CreateFromYMD ( - 2016, - DateUtil.FEBRUARY, - 15 - ) - ); - - double[] adblCleanPrice = new double[] { - 1.0071875, - 0.9903125, - 0.9990625, - 0.9756250, - 0.9893750, - 0.9818750, - 0.9734375, - 0.9968750, - 0.9756250, - 1.0281250, - 1.0459375, - 1.0443750, - 1.0231250, - 1.0128125, - 0.9996875, - 0.9768750, - 0.9865625, - 0.9750000, - 0.9978125 - }; - - FuturesQuote ( - csqc, - tu1, - dblFuturesPrice - ); - - Bond bondCTD = tu1.cheapestToDeliverYield ( - dtSpot.julian(), - adblCleanPrice - ).bond(); - - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| Bond # 1: " + ust912828XG.name() + " ||"); - - System.out.println ("\t| Bond # 2: " + ust912828L2.name() + " ||"); - - System.out.println ("\t| Bond # 3: " + ust912828XQ.name() + " ||"); - - System.out.println ("\t| Bond # 4: " + ust912828TJ.name() + " ||"); - - System.out.println ("\t| Bond # 5: " + ust912828M4.name() + " ||"); - - System.out.println ("\t| Bond # 6: " + ust912828L5.name() + " ||"); - - System.out.println ("\t| Bond # 7: " + ust912828TY.name() + " ||"); - - System.out.println ("\t| Bond # 8: " + ust912828UN.name() + " ||"); - - System.out.println ("\t| Bond # 9: " + ust912828VB.name() + " ||"); - - System.out.println ("\t| Bond #10: " + ust912828VS.name() + " ||"); - - System.out.println ("\t| Bond #11: " + ust912828WE.name() + " ||"); - - System.out.println ("\t| Bond #12: " + ust912828B6.name() + " ||"); - - System.out.println ("\t| Bond #13: " + ust912828WJ.name() + " ||"); - - System.out.println ("\t| Bond #14: " + ust912828D5.name() + " ||"); - - System.out.println ("\t| Bond #15: " + ust912828G3.name() + " ||"); - - System.out.println ("\t| Bond #16: " + ust912828J2.name() + " ||"); - - System.out.println ("\t| Bond #17: " + ust912828XB.name() + " ||"); - - System.out.println ("\t| Bond #18: " + ust912828K7.name() + " ||"); - - System.out.println ("\t| Bond #19: " + ust912828M5.name() + " ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\t| Cheapest to Deliver: " + bondCTD.name() + " ||"); - - BondRVMeasuresSample ( - (BondComponent) bondCTD, - dtSpot, - csqc, - 1.0071875 - ); - - ComputeFuturesMeasures ( - tu1, - dtSpot, - csqc, - adblCleanPrice - ); - - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| Futures Price : " + FormatUtil.FormatDouble (dblFuturesPrice, 2, 5, 100.) + " ||"); - - System.out.println ("\t| Contract Size : " + FormatUtil.FormatDouble (dblContractSize, 1, 2, 1.) + " ||"); - - System.out.println ("\t| Contract Value : " + FormatUtil.FormatDouble (dblContractSize * dblFuturesPrice, 1, 2, 1.) + " ||"); - - System.out.println ("\t|---------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/treasuryfutures/UST30Y.java b/org/drip/sample/treasuryfutures/UST30Y.java deleted file mode 100644 index e425f41..0000000 --- a/org/drip/sample/treasuryfutures/UST30Y.java +++ /dev/null @@ -1,1005 +0,0 @@ - -package org.drip.sample.treasuryfutures; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.analytics.daycount.Convention; -import org.drip.analytics.output.BondRVMeasures; -import org.drip.param.creator.MarketParamsBuilder; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.quote.*; -import org.drip.param.valuation.*; -import org.drip.product.credit.*; -import org.drip.product.definition.*; -import org.drip.product.govvie.TreasuryFutures; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; -import org.drip.state.creator.ScenarioRepoCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.govvie.GovvieCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * UST30Y demonstrates the Details behind the Implementation and the Pricing of the 30Y LONG BOND US1 UST - * Futures Contract. - * - * @author Lakshmi Krishnamurthy - */ - -public class UST30Y { - - private static final MergedDiscountForwardCurve FundingCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrDepositMaturityTenor = new String[] { - "2D", - "1W", - "1M", - "2M", - "3M" - }; - - double[] adblDepositQuote = new double[] { - 0.00195, // 2D - 0.00176, // 1W - 0.00301, // 1M - 0.00401, // 2M - 0.00492 // 3M - }; - - double[] adblFuturesQuote = new double[] { - 0.00609, - 0.00687 - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.00762, // 1Y - 0.01055, // 2Y - 0.01300, // 3Y - 0.01495, // 4Y - 0.01651, // 5Y - 0.01787, // 6Y - 0.01904, // 7Y - 0.02005, // 8Y - 0.02090, // 9Y - 0.02166, // 10Y - 0.02231, // 11Y - 0.02289, // 12Y - 0.02414, // 15Y - 0.02570, // 20Y - 0.02594, // 25Y - 0.02627, // 30Y - 0.02648, // 40Y - 0.02632 // 50Y - }; - - MergedDiscountForwardCurve dcFunding = LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - adblFuturesQuote, - "ForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate" - ); - - Component[] aDepositComp = OTCInstrumentBuilder.FundingDeposit ( - dtSpot, - strCurrency, - astrDepositMaturityTenor - ); - - Component[] aFuturesComp = ExchangeInstrumentBuilder.ForwardRateFuturesPack ( - dtSpot, - adblFuturesQuote.length, - strCurrency - ); - - Component[] aFixFloatComp = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - astrFixFloatMaturityTenor, - "MAIN", - 0. - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - System.out.println ("\n\n\t|------------------------------------||"); - - System.out.println ("\t| DEPOSIT INPUT vs. CALC ||"); - - System.out.println ("\t|------------------------------------||"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t| [" + aDepositComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aDepositComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|------------------------------------||"); - - System.out.println ("\n\t|------------------------------------||"); - - System.out.println ("\t| FUTURES INPUT vs. CALC ||"); - - System.out.println ("\t|------------------------------------||"); - - for (int i = 0; i < aFuturesComp.length; ++i) - System.out.println ("\t| [" + aFuturesComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFuturesComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFuturesQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|------------------------------------||"); - - System.out.println ("\n\t|-----------------------------------------------|| "); - - System.out.println ("\t| FIX-FLOAT INPUTS vs CALIB ||"); - - System.out.println ("\t|-----------------------------------------------|| "); - - for (int i = 0; i < aFixFloatComp.length; ++i) - System.out.println ("\t| [" + aFixFloatComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "CalibSwapRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFixFloatQuote[i], 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "FairPremium" - ), 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-----------------------------------------------|| \n"); - - return dcFunding; - } - - private static final void OnTheRunQuote ( - final CurveSurfaceQuoteContainer csqc, - final String[] astrOnTheRunCode, - final double[] adblYield) - throws Exception - { - for (int i = 0; i < astrOnTheRunCode.length; ++i) { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Yield", - new MultiSided ( - "mid", - adblYield[i] - ), - true - ); - - csqc.setProductQuote ( - astrOnTheRunCode[i], - pmmq - ); - } - } - - private static final void FuturesQuote ( - final CurveSurfaceQuoteContainer csqc, - final TreasuryFutures bf, - final double dblFuturesPrice) - throws Exception - { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Price", - new MultiSided ( - "mid", - dblFuturesPrice - ), - true - ); - - csqc.setProductQuote ( - bf.name(), - pmmq - ); - } - - private static final void RepoCurves ( - final JulianDate dtSpot, - final CurveSurfaceQuoteContainer csqc, - final Bond[] aBond, - final double[] adblRepoRate) - throws Exception - { - for (int i = 0; i < aBond.length; ++i) - csqc.setRepoState ( - ScenarioRepoCurveBuilder.FlatRateRepoCurve ( - dtSpot, - aBond[i], - adblRepoRate[i] - ) - ); - } - - private static final GovvieCurve TreasuryCurve ( - final JulianDate dtSpot, - final String strCode, - final double[] adblCoupon, - final double[] adblYield) - throws Exception - { - JulianDate[] adtEffective = new JulianDate[] { - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot - }; - - JulianDate[] adtMaturity = new JulianDate[] { - dtSpot.addTenor ("1Y"), - dtSpot.addTenor ("2Y"), - dtSpot.addTenor ("3Y"), - dtSpot.addTenor ("5Y"), - dtSpot.addTenor ("7Y"), - dtSpot.addTenor ("10Y"), - dtSpot.addTenor ("30Y") - }; - - GovvieCurve gc = LatentMarketStateBuilder.ShapePreservingGovvieCurve ( - strCode, - dtSpot, - adtEffective, - adtMaturity, - adblCoupon, - adblYield, - "Yield" - ); - - BondComponent[] aComp = TreasuryBuilder.FromCode ( - strCode, - adtEffective, - adtMaturity, - adblCoupon - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - "USD" - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setGovvieState (gc); - - System.out.println ("\n\t|--------------------------------------------||"); - - System.out.println ("\t| TREASURY INPUT vs CALIB YIELD ||"); - - System.out.println ("\t|--------------------------------------------||"); - - for (int i = 0; i < aComp.length; ++i) - System.out.println ("\t| " + aComp[i].name() + " | " + - FormatUtil.FormatDouble (adblYield[i], 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (aComp[i].yieldFromPrice ( - valParams, - null, - null, - aComp[i].maturityDate().julian(), - 1., - aComp[i].priceFromYield ( - valParams, - null, - null, - gc.yield (aComp[i].maturityDate().julian()) - ) - ), 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t|--------------------------------------------||"); - - return gc; - } - - private static final void AccumulateBondMarketQuote ( - final CurveSurfaceQuoteContainer csqc, - final Bond[] aBond, - final double[] adblCleanPrice) - throws Exception - { - for (int i = 0; i < aBond.length; ++i) { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Price", - new MultiSided ( - "mid", - adblCleanPrice[i] - ), - true - ); - - csqc.setProductQuote ( - aBond[i].name(), - pmmq - ); - } - } - - /* - * Print the Bond RV Measures - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final boolean PrintRVMeasures ( - final String strPrefix, - final BondRVMeasures rv) - throws Exception - { - if (null == rv) return false; - - System.out.println (strPrefix + "ASW : " + FormatUtil.FormatDouble (rv.asw(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Bond Basis : " + FormatUtil.FormatDouble (rv.bondBasis(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Convexity : " + FormatUtil.FormatDouble (rv.convexity(), 1, 4, 1000000.)); - - System.out.println (strPrefix + "Discount Margin : " + FormatUtil.FormatDouble (rv.discountMargin(), 2, 0, 10000.)); - - System.out.println (strPrefix + "G Spread : " + FormatUtil.FormatDouble (rv.gSpread(), 2, 0, 10000.)); - - System.out.println (strPrefix + "I Spread : " + FormatUtil.FormatDouble (rv.iSpread(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Macaulay Duration : " + FormatUtil.FormatDouble (rv.macaulayDuration(), 1, 4, 1.)); - - System.out.println (strPrefix + "Modified Duration : " + FormatUtil.FormatDouble (rv.modifiedDuration(), 1, 4, 10000.)); - - System.out.println (strPrefix + "Price : " + FormatUtil.FormatDouble (rv.price(), 2, 4, 100.)); - - System.out.println (strPrefix + "Workout Date : " + new JulianDate (rv.wi().date())); - - System.out.println (strPrefix + "Workout Factor : " + FormatUtil.FormatDouble (rv.wi().factor(), 2, 4, 1.)); - - System.out.println (strPrefix + "Workout Type : " + rv.wi().type()); - - System.out.println (strPrefix + "Workout Yield : " + FormatUtil.FormatDouble (rv.wi().yield(), 1, 4, 100.) + "%"); - - System.out.println (strPrefix + "Yield01 : " + FormatUtil.FormatDouble (rv.yield01(), 1, 4, 10000.)); - - System.out.println (strPrefix + "Yield Basis : " + FormatUtil.FormatDouble (rv.bondBasis(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Yield Spread : " + FormatUtil.FormatDouble (rv.bondBasis(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Z Spread : " + FormatUtil.FormatDouble (rv.zSpread(), 2, 0, 10000.)); - - return true; - } - - private static final void BondRVMeasuresSample ( - final BondComponent bond, - final JulianDate dtSpot, - final CurveSurfaceQuoteContainer csqc, - final double dblPrice) - throws Exception - { - - ValuationParams valParams = ValuationParams.Spot ( - dtSpot, - 0, - "", - Convention.DATE_ROLL_ACTUAL - ); - - /* - * Compute the work-out date given the price. - */ - - WorkoutInfo wi = bond.exerciseYieldFromPrice ( - valParams, - csqc, - null, - dblPrice - ); - - /* - * Compute the base RV measures to the work-out date. - */ - - org.drip.analytics.output.BondRVMeasures rvm = bond.standardMeasures ( - valParams, - null, - csqc, - null, - wi, - dblPrice - ); - - System.out.println ("\t|---------------------------------------------||\n"); - - PrintRVMeasures ("\t|\t", rvm); - - Map mapOutput = bond.value ( - valParams, - null, - csqc, - null - ); - - System.out.println ("\t|---------------------------------------------||\n"); - - System.out.println ("\n\t|--------------------------------------------------------------------------||"); - - System.out.println ("\t| CTD Full Bond Measures ||"); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t|\t" + me.getKey() + " => " + me.getValue()); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - } - - private static final void ComputeFuturesMeasures ( - final TreasuryFutures bf, - final JulianDate dtSpot, - final CurveSurfaceQuoteContainer csqc, - final double[] adblCleanPrice) - throws Exception - { - ValuationParams valParams = ValuationParams.Spot ( - dtSpot, - 0, - "", - Convention.DATE_ROLL_ACTUAL - ); - - AccumulateBondMarketQuote ( - csqc, - bf.basket(), - adblCleanPrice - ); - - Map mapOutput = bf.value ( - valParams, - null, - csqc, - null - ); - - System.out.println ("\n\t|--------------------------------------------------------------------------||"); - - System.out.println ("\t| Bond Futures Measures ||"); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t|\t" + me.getKey() + " => " + me.getValue()); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ); - - String strCurrency = "USD"; - String strTreasuryCode = "UST"; - - MergedDiscountForwardCurve dcFunding = FundingCurve ( - dtSpot, - strCurrency - ); - - double[] adblTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - GovvieCurve gc = TreasuryCurve ( - dtSpot, - strTreasuryCode, - adblTreasuryCoupon, - adblTreasuryYield - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - csqc.setGovvieState (gc); - - OnTheRunQuote ( - csqc, - new String[] { - "01YON", - "02YON", - "03YON", - "05YON", - "07YON", - "10YON", - "30YON" - }, - adblTreasuryYield - ); - - Bond ust912810FT = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.FEBRUARY, - 15 - ), - DateUtil.CreateFromYMD ( - 2036, - DateUtil.FEBRUARY, - 15 - ), - 0.04500 - ); - - Bond ust912810PU = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.MAY, - 15 - ), - DateUtil.CreateFromYMD ( - 2037, - DateUtil.MAY, - 15 - ), - 0.05000 - ); - - Bond ust912810PT = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.FEBRUARY, - 15 - ), - DateUtil.CreateFromYMD ( - 2037, - DateUtil.FEBRUARY, - 15 - ), - 0.04750 - ); - - Bond ust912810PX = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.MAY, - 15 - ), - DateUtil.CreateFromYMD ( - 2038, - DateUtil.MAY, - 15 - ), - 0.04500 - ); - - Bond ust912810PW = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.FEBRUARY, - 15 - ), - DateUtil.CreateFromYMD ( - 2038, - DateUtil.FEBRUARY, - 15 - ), - 0.04375 - ); - - Bond ust912810QC = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.AUGUST, - 15 - ), - DateUtil.CreateFromYMD ( - 2039, - DateUtil.AUGUST, - 15 - ), - 0.04500 - ); - - Bond ust912810QE = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.FEBRUARY, - 15 - ), - DateUtil.CreateFromYMD ( - 2040, - DateUtil.FEBRUARY, - 15 - ), - 0.04625 - ); - - Bond ust912810QB = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.MAY, - 15 - ), - DateUtil.CreateFromYMD ( - 2039, - DateUtil.MAY, - 15 - ), - 0.04250 - ); - - Bond ust912810QD = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.NOVEMBER, - 15 - ), - DateUtil.CreateFromYMD ( - 2039, - DateUtil.NOVEMBER, - 15 - ), - 0.04375 - ); - - Bond ust912810QH = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.MAY, - 15 - ), - DateUtil.CreateFromYMD ( - 2040, - DateUtil.MAY, - 15 - ), - 0.04375 - ); - - Bond ust912810QL = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.NOVEMBER, - 15 - ), - DateUtil.CreateFromYMD ( - 2040, - DateUtil.NOVEMBER, - 15 - ), - 0.04250 - ); - - Bond ust912810QK = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.AUGUST, - 15 - ), - DateUtil.CreateFromYMD ( - 2040, - DateUtil.AUGUST, - 15 - ), - 0.03875 - ); - - Bond ust912810QA = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.FEBRUARY, - 15 - ), - DateUtil.CreateFromYMD ( - 2039, - DateUtil.FEBRUARY, - 15 - ), - 0.03500 - ); - - double dblContractSize = 100000.; - double dblFuturesPrice = 1.5375000; - - Bond[] aBond = new Bond[] { - ust912810FT, - ust912810PU, - ust912810PT, - ust912810PX, - ust912810PW, - ust912810QC, - ust912810QE, - ust912810QB, - ust912810QD, - ust912810QH, - ust912810QL, - ust912810QK, - ust912810QA - }; - - TreasuryFutures tu1 = new TreasuryFutures ( - aBond, - new double[] { - 0.8266, // 912810FT - 0.8807, // 912810PU - 0.8519, // 912810PT - 0.8170, // 912810PX - 0.8029, // 912810PW - 0.8123, // 912810QC - 0.8263, // 912810QE - 0.7820, // 912810QB - 0.7956, // 912810QD - 0.7939, // 912810QH - 0.7758, // 912810QL - 0.7290, // 912810QK - 0.6903, // 912810QA - }, - null - ); - - double[] adblRepoRate = new double[] { - 0.00800, - 0.00825, - 0.00850, - 0.00875, - 0.00900, - 0.00925, - 0.00950, - 0.00975, - 0.01000, - 0.01025, - 0.01050, - 0.01075, - 0.01100 - }; - - RepoCurves ( - dtSpot, - csqc, - aBond, - adblRepoRate - ); - - tu1.setExpiry ( - DateUtil.CreateFromYMD ( - 2016, - DateUtil.FEBRUARY, - 15 - ) - ); - - double[] adblCleanPrice = new double[] { - 1.2765625, - 1.3643750, - 1.3203125, - 1.2775000, - 1.2556250, - 1.2731250, - 1.2956250, - 1.2287500, - 1.2506250, - 1.2506250, - 1.2281250, - 1.1603125, - 1.1009375 - }; - - FuturesQuote ( - csqc, - tu1, - dblFuturesPrice - ); - - Bond bondCTD = tu1.cheapestToDeliverYield ( - dtSpot.julian(), - adblCleanPrice - ).bond(); - - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| Bond # 1: " + ust912810FT.name() + " ||"); - - System.out.println ("\t| Bond # 2: " + ust912810PU.name() + " ||"); - - System.out.println ("\t| Bond # 3: " + ust912810PT.name() + " ||"); - - System.out.println ("\t| Bond # 4: " + ust912810PX.name() + " ||"); - - System.out.println ("\t| Bond # 5: " + ust912810PW.name() + " ||"); - - System.out.println ("\t| Bond # 6: " + ust912810QC.name() + " ||"); - - System.out.println ("\t| Bond # 7: " + ust912810QE.name() + " ||"); - - System.out.println ("\t| Bond # 8: " + ust912810QB.name() + " ||"); - - System.out.println ("\t| Bond # 9: " + ust912810QD.name() + " ||"); - - System.out.println ("\t| Bond #10: " + ust912810QH.name() + " ||"); - - System.out.println ("\t| Bond #11: " + ust912810QL.name() + " ||"); - - System.out.println ("\t| Bond #12: " + ust912810QK.name() + " ||"); - - System.out.println ("\t| Bond #13: " + ust912810QA.name() + " ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\t| Cheapest to Deliver: " + bondCTD.name() + " ||"); - - BondRVMeasuresSample ( - (BondComponent) bondCTD, - dtSpot, - csqc, - 1.2765625 - ); - - ComputeFuturesMeasures ( - tu1, - dtSpot, - csqc, - adblCleanPrice - ); - - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| Futures Price : " + FormatUtil.FormatDouble (dblFuturesPrice, 2, 5, 100.) + " ||"); - - System.out.println ("\t| Contract Size : " + FormatUtil.FormatDouble (dblContractSize, 1, 2, 1.) + " ||"); - - System.out.println ("\t| Contract Value : " + FormatUtil.FormatDouble (dblContractSize * dblFuturesPrice, 1, 2, 1.) + " ||"); - - System.out.println ("\t|---------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/treasuryfutures/USTULTRA.java b/org/drip/sample/treasuryfutures/USTULTRA.java deleted file mode 100644 index 9591bc2..0000000 --- a/org/drip/sample/treasuryfutures/USTULTRA.java +++ /dev/null @@ -1,1145 +0,0 @@ - -package org.drip.sample.treasuryfutures; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.analytics.daycount.Convention; -import org.drip.analytics.output.BondRVMeasures; -import org.drip.param.creator.MarketParamsBuilder; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.quote.*; -import org.drip.param.valuation.*; -import org.drip.product.credit.*; -import org.drip.product.definition.*; -import org.drip.product.govvie.TreasuryFutures; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; -import org.drip.state.creator.ScenarioRepoCurveBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.govvie.GovvieCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * USTULTRA demonstrates the Details behind the Implementation and the Pricing of the ULTRA LONG WN1 UST - * Futures Contract. - * - * @author Lakshmi Krishnamurthy - */ - -public class USTULTRA { - - private static final MergedDiscountForwardCurve FundingCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrDepositMaturityTenor = new String[] { - "2D", - "1W", - "1M", - "2M", - "3M" - }; - - double[] adblDepositQuote = new double[] { - 0.00195, // 2D - 0.00176, // 1W - 0.00301, // 1M - 0.00401, // 2M - 0.00492 // 3M - }; - - double[] adblFuturesQuote = new double[] { - 0.00609, - 0.00687 - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.00762, // 1Y - 0.01055, // 2Y - 0.01300, // 3Y - 0.01495, // 4Y - 0.01651, // 5Y - 0.01787, // 6Y - 0.01904, // 7Y - 0.02005, // 8Y - 0.02090, // 9Y - 0.02166, // 10Y - 0.02231, // 11Y - 0.02289, // 12Y - 0.02414, // 15Y - 0.02570, // 20Y - 0.02594, // 25Y - 0.02627, // 30Y - 0.02648, // 40Y - 0.02632 // 50Y - }; - - MergedDiscountForwardCurve dcFunding = LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - adblFuturesQuote, - "ForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate" - ); - - Component[] aDepositComp = OTCInstrumentBuilder.FundingDeposit ( - dtSpot, - strCurrency, - astrDepositMaturityTenor - ); - - Component[] aFuturesComp = ExchangeInstrumentBuilder.ForwardRateFuturesPack ( - dtSpot, - adblFuturesQuote.length, - strCurrency - ); - - Component[] aFixFloatComp = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - astrFixFloatMaturityTenor, - "MAIN", - 0. - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - System.out.println ("\n\n\t|------------------------------------||"); - - System.out.println ("\t| DEPOSIT INPUT vs. CALC ||"); - - System.out.println ("\t|------------------------------------||"); - - for (int i = 0; i < aDepositComp.length; ++i) - System.out.println ("\t| [" + aDepositComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aDepositComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|------------------------------------||"); - - System.out.println ("\n\t|------------------------------------||"); - - System.out.println ("\t| FUTURES INPUT vs. CALC ||"); - - System.out.println ("\t|------------------------------------||"); - - for (int i = 0; i < aFuturesComp.length; ++i) - System.out.println ("\t| [" + aFuturesComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFuturesComp[i].measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFuturesQuote[i], 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|------------------------------------||"); - - System.out.println ("\n\t|-----------------------------------------------|| "); - - System.out.println ("\t| FIX-FLOAT INPUTS vs CALIB ||"); - - System.out.println ("\t|-----------------------------------------------|| "); - - for (int i = 0; i < aFixFloatComp.length; ++i) - System.out.println ("\t| [" + aFixFloatComp[i].maturityDate() + "] =" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "CalibSwapRate" - ), 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (adblFixFloatQuote[i], 1, 6, 1.) + " |" + - FormatUtil.FormatDouble (aFixFloatComp[i].measureValue ( - valParams, - null, - csqc, - null, - "FairPremium" - ), 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-----------------------------------------------|| \n"); - - return dcFunding; - } - - private static final void OnTheRunQuote ( - final CurveSurfaceQuoteContainer csqc, - final String[] astrOnTheRunCode, - final double[] adblYield) - throws Exception - { - for (int i = 0; i < astrOnTheRunCode.length; ++i) { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Yield", - new MultiSided ( - "mid", - adblYield[i] - ), - true - ); - - csqc.setProductQuote ( - astrOnTheRunCode[i], - pmmq - ); - } - } - - private static final void FuturesQuote ( - final CurveSurfaceQuoteContainer csqc, - final TreasuryFutures bf, - final double dblFuturesPrice) - throws Exception - { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Price", - new MultiSided ( - "mid", - dblFuturesPrice - ), - true - ); - - csqc.setProductQuote ( - bf.name(), - pmmq - ); - } - - private static final void RepoCurves ( - final JulianDate dtSpot, - final CurveSurfaceQuoteContainer csqc, - final Bond[] aBond, - final double[] adblRepoRate) - throws Exception - { - for (int i = 0; i < aBond.length; ++i) - csqc.setRepoState ( - ScenarioRepoCurveBuilder.FlatRateRepoCurve ( - dtSpot, - aBond[i], - adblRepoRate[i] - ) - ); - } - - private static final GovvieCurve TreasuryCurve ( - final JulianDate dtSpot, - final String strCode, - final double[] adblCoupon, - final double[] adblYield) - throws Exception - { - JulianDate[] adtEffective = new JulianDate[] { - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot, - dtSpot - }; - - JulianDate[] adtMaturity = new JulianDate[] { - dtSpot.addTenor ("1Y"), - dtSpot.addTenor ("2Y"), - dtSpot.addTenor ("3Y"), - dtSpot.addTenor ("5Y"), - dtSpot.addTenor ("7Y"), - dtSpot.addTenor ("10Y"), - dtSpot.addTenor ("30Y") - }; - - GovvieCurve gc = LatentMarketStateBuilder.ShapePreservingGovvieCurve ( - strCode, - dtSpot, - adtEffective, - adtMaturity, - adblCoupon, - adblYield, - "Yield" - ); - - BondComponent[] aComp = TreasuryBuilder.FromCode ( - strCode, - adtEffective, - adtMaturity, - adblCoupon - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - "USD" - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setGovvieState (gc); - - System.out.println ("\n\t|--------------------------------------------||"); - - System.out.println ("\t| TREASURY INPUT vs CALIB YIELD ||"); - - System.out.println ("\t|--------------------------------------------||"); - - for (int i = 0; i < aComp.length; ++i) - System.out.println ("\t| " + aComp[i].name() + " | " + - FormatUtil.FormatDouble (adblYield[i], 2, 2, 100.) + "% | " + - FormatUtil.FormatDouble (aComp[i].yieldFromPrice ( - valParams, - null, - null, - aComp[i].maturityDate().julian(), - 1., - aComp[i].priceFromYield ( - valParams, - null, - null, - gc.yield (aComp[i].maturityDate().julian()) - ) - ), 2, 2, 100.) + "% ||" - ); - - System.out.println ("\t|--------------------------------------------||"); - - return gc; - } - - private static final void AccumulateBondMarketQuote ( - final CurveSurfaceQuoteContainer csqc, - final Bond[] aBond, - final double[] adblCleanPrice) - throws Exception - { - for (int i = 0; i < aBond.length; ++i) { - ProductMultiMeasure pmmq = new ProductMultiMeasure(); - - pmmq.addQuote ( - "Price", - new MultiSided ( - "mid", - adblCleanPrice[i] - ), - true - ); - - csqc.setProductQuote ( - aBond[i].name(), - pmmq - ); - } - } - - /* - * Print the Bond RV Measures - * - * USE WITH CARE: This sample ignores errors and does not handle exceptions. - */ - - private static final boolean PrintRVMeasures ( - final String strPrefix, - final BondRVMeasures rv) - throws Exception - { - if (null == rv) return false; - - System.out.println (strPrefix + "ASW : " + FormatUtil.FormatDouble (rv.asw(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Bond Basis : " + FormatUtil.FormatDouble (rv.bondBasis(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Convexity : " + FormatUtil.FormatDouble (rv.convexity(), 1, 4, 1000000.)); - - System.out.println (strPrefix + "Discount Margin : " + FormatUtil.FormatDouble (rv.discountMargin(), 2, 0, 10000.)); - - System.out.println (strPrefix + "G Spread : " + FormatUtil.FormatDouble (rv.gSpread(), 2, 0, 10000.)); - - System.out.println (strPrefix + "I Spread : " + FormatUtil.FormatDouble (rv.iSpread(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Macaulay Duration : " + FormatUtil.FormatDouble (rv.macaulayDuration(), 1, 4, 1.)); - - System.out.println (strPrefix + "Modified Duration : " + FormatUtil.FormatDouble (rv.modifiedDuration(), 1, 4, 10000.)); - - System.out.println (strPrefix + "Price : " + FormatUtil.FormatDouble (rv.price(), 2, 4, 100.)); - - System.out.println (strPrefix + "Workout Date : " + new JulianDate (rv.wi().date())); - - System.out.println (strPrefix + "Workout Factor : " + FormatUtil.FormatDouble (rv.wi().factor(), 2, 4, 1.)); - - System.out.println (strPrefix + "Workout Type : " + rv.wi().type()); - - System.out.println (strPrefix + "Workout Yield : " + FormatUtil.FormatDouble (rv.wi().yield(), 1, 4, 100.) + "%"); - - System.out.println (strPrefix + "Yield01 : " + FormatUtil.FormatDouble (rv.yield01(), 1, 4, 10000.)); - - System.out.println (strPrefix + "Yield Basis : " + FormatUtil.FormatDouble (rv.bondBasis(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Yield Spread : " + FormatUtil.FormatDouble (rv.bondBasis(), 2, 0, 10000.)); - - System.out.println (strPrefix + "Z Spread : " + FormatUtil.FormatDouble (rv.zSpread(), 2, 0, 10000.)); - - return true; - } - - private static final void BondRVMeasuresSample ( - final BondComponent bond, - final JulianDate dtSpot, - final CurveSurfaceQuoteContainer csqc, - final double dblPrice) - throws Exception - { - - ValuationParams valParams = ValuationParams.Spot ( - dtSpot, - 0, - "", - Convention.DATE_ROLL_ACTUAL - ); - - /* - * Compute the work-out date given the price. - */ - - WorkoutInfo wi = bond.exerciseYieldFromPrice ( - valParams, - csqc, - null, - dblPrice - ); - - /* - * Compute the base RV measures to the work-out date. - */ - - org.drip.analytics.output.BondRVMeasures rvm = bond.standardMeasures ( - valParams, - null, - csqc, - null, - wi, - dblPrice - ); - - System.out.println ("\t|---------------------------------------------||\n"); - - PrintRVMeasures ("\t|\t", rvm); - - Map mapOutput = bond.value ( - valParams, - null, - csqc, - null - ); - - System.out.println ("\t|---------------------------------------------||\n"); - - System.out.println ("\n\t|--------------------------------------------------------------------------||"); - - System.out.println ("\t| CTD Full Bond Measures ||"); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t|\t" + me.getKey() + " => " + me.getValue()); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - } - - private static final void ComputeFuturesMeasures ( - final TreasuryFutures bf, - final JulianDate dtSpot, - final CurveSurfaceQuoteContainer csqc, - final double[] adblCleanPrice) - throws Exception - { - ValuationParams valParams = ValuationParams.Spot ( - dtSpot, - 0, - "", - Convention.DATE_ROLL_ACTUAL - ); - - AccumulateBondMarketQuote ( - csqc, - bf.basket(), - adblCleanPrice - ); - - Map mapOutput = bf.value ( - valParams, - null, - csqc, - null - ); - - System.out.println ("\n\t|--------------------------------------------------------------------------||"); - - System.out.println ("\t| Bond Futures Measures ||"); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t|\t" + me.getKey() + " => " + me.getValue()); - - System.out.println ("\t|--------------------------------------------------------------------------||"); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ); - - String strCurrency = "USD"; - String strTreasuryCode = "UST"; - - MergedDiscountForwardCurve dcFunding = FundingCurve ( - dtSpot, - strCurrency - ); - - double[] adblTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - GovvieCurve gc = TreasuryCurve ( - dtSpot, - strTreasuryCode, - adblTreasuryCoupon, - adblTreasuryYield - ); - - CurveSurfaceQuoteContainer csqc = MarketParamsBuilder.Create ( - dcFunding, - null, - null, - null, - null, - null, - null - ); - - csqc.setGovvieState (gc); - - OnTheRunQuote ( - csqc, - new String[] { - "01YON", - "02YON", - "03YON", - "05YON", - "07YON", - "10YON", - "30YON" - }, - adblTreasuryYield - ); - - Bond ust912810QN = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.FEBRUARY, - 15 - ), - DateUtil.CreateFromYMD ( - 2041, - DateUtil.FEBRUARY, - 15 - ), - 0.04750 - ); - - Bond ust912810QQ = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.MAY, - 15 - ), - DateUtil.CreateFromYMD ( - 2041, - DateUtil.MAY, - 15 - ), - 0.04375 - ); - - Bond ust912810QS = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.AUGUST, - 15 - ), - DateUtil.CreateFromYMD ( - 2041, - DateUtil.AUGUST, - 15 - ), - 0.03750 - ); - - Bond ust912810RC = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.AUGUST, - 15 - ), - DateUtil.CreateFromYMD ( - 2043, - DateUtil.AUGUST, - 15 - ), - 0.03625 - ); - - Bond ust912810RD = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.NOVEMBER, - 15 - ), - DateUtil.CreateFromYMD ( - 2043, - DateUtil.NOVEMBER, - 15 - ), - 0.03750 - ); - - Bond ust912810QT = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.NOVEMBER, - 15 - ), - DateUtil.CreateFromYMD ( - 2041, - DateUtil.NOVEMBER, - 15 - ), - 0.03125 - ); - - Bond ust912810QU = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.FEBRUARY, - 15 - ), - DateUtil.CreateFromYMD ( - 2043, - DateUtil.FEBRUARY, - 15 - ), - 0.03125 - ); - - Bond ust912810RE = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.FEBRUARY, - 15 - ), - DateUtil.CreateFromYMD ( - 2044, - DateUtil.FEBRUARY, - 15 - ), - 0.03625 - ); - - Bond ust912810QZ = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.FEBRUARY, - 15 - ), - DateUtil.CreateFromYMD ( - 2043, - DateUtil.FEBRUARY, - 15 - ), - 0.03125 - ); - - Bond ust912810QW = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.MAY, - 15 - ), - DateUtil.CreateFromYMD ( - 2042, - DateUtil.MAY, - 15 - ), - 0.03000 - ); - - Bond ust912810RG = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.MAY, - 15 - ), - DateUtil.CreateFromYMD ( - 2044, - DateUtil.MAY, - 15 - ), - 0.03625 - ); - - Bond ust912810QX = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.AUGUST, - 15 - ), - DateUtil.CreateFromYMD ( - 2042, - DateUtil.AUGUST, - 15 - ), - 0.02375 - ); - - Bond ust912810RB = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.MAY, - 15 - ), - DateUtil.CreateFromYMD ( - 2043, - DateUtil.MAY, - 15 - ), - 0.02875 - ); - - Bond ust912810QY = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.NOVEMBER, - 15 - ), - DateUtil.CreateFromYMD ( - 2042, - DateUtil.NOVEMBER, - 15 - ), - 0.02750 - ); - - Bond ust912810RH = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.AUGUST, - 15 - ), - DateUtil.CreateFromYMD ( - 2044, - DateUtil.AUGUST, - 15 - ), - 0.03125 - ); - - Bond ust912810RJ = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.NOVEMBER, - 15 - ), - DateUtil.CreateFromYMD ( - 2044, - DateUtil.NOVEMBER, - 15 - ), - 0.03000 - ); - - Bond ust912810RM = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.MAY, - 15 - ), - DateUtil.CreateFromYMD ( - 2045, - DateUtil.MAY, - 15 - ), - 0.03000 - ); - - Bond ust912810RP = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.NOVEMBER, - 15 - ), - DateUtil.CreateFromYMD ( - 2045, - DateUtil.NOVEMBER, - 15 - ), - 0.03000 - ); - - Bond ust912810RN = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.AUGUST, - 15 - ), - DateUtil.CreateFromYMD ( - 2045, - DateUtil.AUGUST, - 15 - ), - 0.02875 - ); - - Bond ust912810RK = TreasuryBuilder.UST ( - DateUtil.CreateFromYMD ( - 2014, - DateUtil.FEBRUARY, - 15 - ), - DateUtil.CreateFromYMD ( - 2045, - DateUtil.FEBRUARY, - 15 - ), - 0.02500 - ); - - double dblContractSize = 100000.; - double dblFuturesPrice = 1.56687500; - - Bond[] aBond = new Bond[] { - ust912810QN, - ust912810QQ, - ust912810QS, - ust912810RC, - ust912810RD, - ust912810QT, - ust912810QU, - ust912810RE, - ust912810QZ, - ust912810QW, - ust912810RG, - ust912810QX, - ust912810RB, - ust912810QY, - ust912810RH, - ust912810RJ, - ust912810RM, - ust912810RP, - ust912810RN, - ust912810RK - }; - - TreasuryFutures tu1 = new TreasuryFutures ( - aBond, - new double[] { - 0.8392, // 912810QN - 0.7900, // 912810QQ - 0.7080, // 912810QS - 0.6821, // 912810RC - 0.6976, // 912810RD - 0.6253, // 912810QT - 0.6239, // 912810QU - 0.6798, // 912810RE - 0.6179, // 912810QZ - 0.6059, // 912810QW - 0.6448, // 912810RG - 0.5714, // 912810QX - 0.5831, // 912810RB - 0.5697, // 912810QY - 0.6097, // 912810RH - 0.5913, // 912810RJ - 0.5887, // 912810RM - 0.5861, // 912810RP - 0.5702, // 912810RN - 0.5217, // 912810RK - }, - null - ); - - double[] adblRepoRate = new double[] { - 0.00800, - 0.00825, - 0.00850, - 0.00875, - 0.00900, - 0.00925, - 0.00950, - 0.00975, - 0.01000, - 0.01025, - 0.01050, - 0.01075, - 0.01100, - 0.01125, - 0.01150, - 0.01175, - 0.01200, - 0.01225, - 0.01250, - 0.01275 - }; - - RepoCurves ( - dtSpot, - csqc, - aBond, - adblRepoRate - ); - - tu1.setExpiry ( - DateUtil.CreateFromYMD ( - 2016, - DateUtil.FEBRUARY, - 15 - ) - ); - - double[] adblCleanPrice = new double[] { - 1.3200000, - 1.2540625, - 1.1412500, - 1.1193750, - 1.1450000, - 1.0262500, - 1.0256250, - 1.1184375, - 1.0181250, - 0.9990625, - 1.0659375, - 0.9481250, - 0.9681250, - 0.9459375, - 1.0153125, - 0.9896875, - 0.9890625, - 0.9918750, - 0.9656250, - 0.8909375 - }; - - FuturesQuote ( - csqc, - tu1, - dblFuturesPrice - ); - - Bond bondCTD = tu1.cheapestToDeliverYield ( - dtSpot.julian(), - adblCleanPrice - ).bond(); - - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| Bond # 1: " + ust912810QN.name() + " ||"); - - System.out.println ("\t| Bond # 2: " + ust912810QQ.name() + " ||"); - - System.out.println ("\t| Bond # 3: " + ust912810QS.name() + " ||"); - - System.out.println ("\t| Bond # 4: " + ust912810RC.name() + " ||"); - - System.out.println ("\t| Bond # 5: " + ust912810RD.name() + " ||"); - - System.out.println ("\t| Bond # 6: " + ust912810QT.name() + " ||"); - - System.out.println ("\t| Bond # 7: " + ust912810QU.name() + " ||"); - - System.out.println ("\t| Bond # 8: " + ust912810RE.name() + " ||"); - - System.out.println ("\t| Bond # 9: " + ust912810QZ.name() + " ||"); - - System.out.println ("\t| Bond #10: " + ust912810QW.name() + " ||"); - - System.out.println ("\t| Bond #11: " + ust912810RG.name() + " ||"); - - System.out.println ("\t| Bond #12: " + ust912810QX.name() + " ||"); - - System.out.println ("\t| Bond #13: " + ust912810RB.name() + " ||"); - - System.out.println ("\t| Bond #14: " + ust912810QY.name() + " ||"); - - System.out.println ("\t| Bond #15: " + ust912810RH.name() + " ||"); - - System.out.println ("\t| Bond #16: " + ust912810RJ.name() + " ||"); - - System.out.println ("\t| Bond #17: " + ust912810RM.name() + " ||"); - - System.out.println ("\t| Bond #18: " + ust912810RP.name() + " ||"); - - System.out.println ("\t| Bond #19: " + ust912810RN.name() + " ||"); - - System.out.println ("\t| Bond #20: " + ust912810RK.name() + " ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\t| Cheapest to Deliver: " + bondCTD.name() + " ||"); - - BondRVMeasuresSample ( - (BondComponent) bondCTD, - dtSpot, - csqc, - 1.3200000 - ); - - ComputeFuturesMeasures ( - tu1, - dtSpot, - csqc, - adblCleanPrice - ); - - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| Futures Price : " + FormatUtil.FormatDouble (dblFuturesPrice, 2, 5, 100.) + " ||"); - - System.out.println ("\t| Contract Size : " + FormatUtil.FormatDouble (dblContractSize, 1, 2, 1.) + " ||"); - - System.out.println ("\t| Contract Value : " + FormatUtil.FormatDouble (dblContractSize * dblFuturesPrice, 1, 2, 1.) + " ||"); - - System.out.println ("\t|---------------------------------------------||\n"); - } -} diff --git a/org/drip/sample/treasuryfuturesapi/CN1.java b/org/drip/sample/treasuryfuturesapi/CN1.java deleted file mode 100644 index 284de7a..0000000 --- a/org/drip/sample/treasuryfuturesapi/CN1.java +++ /dev/null @@ -1,273 +0,0 @@ - -package org.drip.sample.treasuryfuturesapi; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CN1 demonstrates the Invocation and Examination of the CN1 10Y CAN Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class CN1 { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int[] aiFuturesComponentTreasuryEffectiveDate = new int[] { - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2014, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2014, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2014, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2014, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2014, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2014, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - int[] aiFuturesComponentTreasuryMaturityDate = new int[] { - DateUtil.CreateFromYMD (2020, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2020, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2020, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2020, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2020, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2020, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2020, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2020, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2020, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - double[] adblFuturesComponentTreasuryCoupon = new double[] { - 0.01375, // 912828J5 - 0.01375, // 912828J8 - 0.01375, // 912828K5 - 0.01500, // 912828XE - 0.01625, // 912828XH - 0.01625, // 912828XM - 0.01375, // 912828L3 - 0.01375, // 912828L6 - 0.01375 // 912828L9 - }; - - double[] adblFuturesComponentConversionFactor = new double[] { - 0.8317, // 912828J5 - 0.8287, // 912828J8 - 0.8258, // 912828K5 - 0.8276, // 912828XE - 0.8297, // 912828XH - 0.8269, // 912828XM - 0.8141, // 912828L3 - 0.8113, // 912828L6 - 0.8084 // 912828L9 - }; - - int iSpotDate = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ).julian(); - - String[] astrFundingCurveDepositTenor = new String[] { - "2D", - "1W", - "1M", - "2M", - "3M" - }; - - double[] adblFundingCurveDepositQuote = new double[] { - 0.00195, // 2D - 0.00176, // 1W - 0.00301, // 1M - 0.00401, // 2M - 0.00492 // 3M - }; - - String strFundingCurveDepositMeasure = "ForwardRate"; - - double[] adblFundingCurveFuturesQuote = new double[] { - 0.00609, - 0.00687 - }; - - String strFundingCurveFuturesMeasure = "ForwardRate"; - - String[] astrFundingCurveFixFloatTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFundingCurveFixFloatQuote = new double[] { - 0.00762, // 1Y - 0.01055, // 2Y - 0.01300, // 3Y - 0.01495, // 4Y - 0.01651, // 5Y - 0.01787, // 6Y - 0.01904, // 7Y - 0.02005, // 8Y - 0.02090, // 9Y - 0.02166, // 10Y - 0.02231, // 11Y - 0.02289, // 12Y - 0.02414, // 15Y - 0.02570, // 20Y - 0.02594, // 25Y - 0.02627, // 30Y - 0.02648, // 40Y - 0.02632 // 50Y - }; - - String strFundingFixFloatMeasure = "SwapRate"; - - int[] aiGovvieCurveTreasuryEffectiveDate = new int[] { - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate - }; - - int[] aiGovvieCurveTreasuryMaturityDate = new int[] { - new JulianDate (iSpotDate).addTenor ("1Y").julian(), - new JulianDate (iSpotDate).addTenor ("2Y").julian(), - new JulianDate (iSpotDate).addTenor ("3Y").julian(), - new JulianDate (iSpotDate).addTenor ("5Y").julian(), - new JulianDate (iSpotDate).addTenor ("7Y").julian(), - new JulianDate (iSpotDate).addTenor ("10Y").julian(), - new JulianDate (iSpotDate).addTenor ("30Y").julian() - }; - - double[] adblGovvieCurveTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblGovvieCurveTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - String strGovvieCurveTreasuryMeasure = "Yield"; - - double[] adblFuturesComponentTreasuryPrice = new double[] { - 0.99909375, // 912828J5 - 0.99900000, // 912828J8 - 0.99890625, // 912828K5 - 0.99943750, // 912828XE - 0.99984375, // 912828XH - 0.99978125, // 912828XM - 0.99862500, // 912828L3 - 0.99850000, // 912828L6 - 0.99853125 // 912828L9 - }; - - Map mapTreasuryFutures = TreasuryFuturesAPI.ValuationMetrics ( - "CN1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - astrFundingCurveDepositTenor, - adblFundingCurveDepositQuote, - strFundingCurveDepositMeasure, - adblFundingCurveFuturesQuote, - strFundingCurveFuturesMeasure, - astrFundingCurveFixFloatTenor, - adblFundingCurveFixFloatQuote, - strFundingFixFloatMeasure, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice - ); - - for (Map.Entry me : mapTreasuryFutures.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/treasuryfuturesapi/DU1.java b/org/drip/sample/treasuryfuturesapi/DU1.java deleted file mode 100644 index 3475405..0000000 --- a/org/drip/sample/treasuryfuturesapi/DU1.java +++ /dev/null @@ -1,273 +0,0 @@ - -package org.drip.sample.treasuryfuturesapi; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DU1 demonstrates the Invocation and Examination of the DU1 2Y SCHATZ DBR Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class DU1 { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int[] aiFuturesComponentTreasuryEffectiveDate = new int[] { - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2014, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2014, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2014, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2014, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2014, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2014, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - int[] aiFuturesComponentTreasuryMaturityDate = new int[] { - DateUtil.CreateFromYMD (2020, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2020, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2020, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2020, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2020, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2020, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2020, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2020, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2020, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - double[] adblFuturesComponentTreasuryCoupon = new double[] { - 0.01375, // 912828J5 - 0.01375, // 912828J8 - 0.01375, // 912828K5 - 0.01500, // 912828XE - 0.01625, // 912828XH - 0.01625, // 912828XM - 0.01375, // 912828L3 - 0.01375, // 912828L6 - 0.01375 // 912828L9 - }; - - double[] adblFuturesComponentConversionFactor = new double[] { - 0.8317, // 912828J5 - 0.8287, // 912828J8 - 0.8258, // 912828K5 - 0.8276, // 912828XE - 0.8297, // 912828XH - 0.8269, // 912828XM - 0.8141, // 912828L3 - 0.8113, // 912828L6 - 0.8084 // 912828L9 - }; - - int iSpotDate = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ).julian(); - - String[] astrFundingCurveDepositTenor = new String[] { - "2D", - "1W", - "1M", - "2M", - "3M" - }; - - double[] adblFundingCurveDepositQuote = new double[] { - 0.00195, // 2D - 0.00176, // 1W - 0.00301, // 1M - 0.00401, // 2M - 0.00492 // 3M - }; - - String strFundingCurveDepositMeasure = "ForwardRate"; - - double[] adblFundingCurveFuturesQuote = new double[] { - 0.00609, - 0.00687 - }; - - String strFundingCurveFuturesMeasure = "ForwardRate"; - - String[] astrFundingCurveFixFloatTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFundingCurveFixFloatQuote = new double[] { - 0.00762, // 1Y - 0.01055, // 2Y - 0.01300, // 3Y - 0.01495, // 4Y - 0.01651, // 5Y - 0.01787, // 6Y - 0.01904, // 7Y - 0.02005, // 8Y - 0.02090, // 9Y - 0.02166, // 10Y - 0.02231, // 11Y - 0.02289, // 12Y - 0.02414, // 15Y - 0.02570, // 20Y - 0.02594, // 25Y - 0.02627, // 30Y - 0.02648, // 40Y - 0.02632 // 50Y - }; - - String strFundingFixFloatMeasure = "SwapRate"; - - int[] aiGovvieCurveTreasuryEffectiveDate = new int[] { - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate - }; - - int[] aiGovvieCurveTreasuryMaturityDate = new int[] { - new JulianDate (iSpotDate).addTenor ("1Y").julian(), - new JulianDate (iSpotDate).addTenor ("2Y").julian(), - new JulianDate (iSpotDate).addTenor ("3Y").julian(), - new JulianDate (iSpotDate).addTenor ("5Y").julian(), - new JulianDate (iSpotDate).addTenor ("7Y").julian(), - new JulianDate (iSpotDate).addTenor ("10Y").julian(), - new JulianDate (iSpotDate).addTenor ("30Y").julian() - }; - - double[] adblGovvieCurveTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblGovvieCurveTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - String strGovvieCurveTreasuryMeasure = "Yield"; - - double[] adblFuturesComponentTreasuryPrice = new double[] { - 0.99909375, // 912828J5 - 0.99900000, // 912828J8 - 0.99890625, // 912828K5 - 0.99943750, // 912828XE - 0.99984375, // 912828XH - 0.99978125, // 912828XM - 0.99862500, // 912828L3 - 0.99850000, // 912828L6 - 0.99853125 // 912828L9 - }; - - Map mapTreasuryFutures = TreasuryFuturesAPI.ValuationMetrics ( - "DU1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - astrFundingCurveDepositTenor, - adblFundingCurveDepositQuote, - strFundingCurveDepositMeasure, - adblFundingCurveFuturesQuote, - strFundingCurveFuturesMeasure, - astrFundingCurveFixFloatTenor, - adblFundingCurveFixFloatQuote, - strFundingFixFloatMeasure, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice - ); - - for (Map.Entry me : mapTreasuryFutures.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/treasuryfuturesapi/FBB1.java b/org/drip/sample/treasuryfuturesapi/FBB1.java deleted file mode 100644 index db2fa15..0000000 --- a/org/drip/sample/treasuryfuturesapi/FBB1.java +++ /dev/null @@ -1,273 +0,0 @@ - -package org.drip.sample.treasuryfuturesapi; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FBB1 demonstrates the Invocation and Examination of the FBB1 10Y SPGB Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class FBB1 { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int[] aiFuturesComponentTreasuryEffectiveDate = new int[] { - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2014, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2014, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2014, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2014, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2014, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2014, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - int[] aiFuturesComponentTreasuryMaturityDate = new int[] { - DateUtil.CreateFromYMD (2020, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2020, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2020, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2020, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2020, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2020, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2020, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2020, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2020, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - double[] adblFuturesComponentTreasuryCoupon = new double[] { - 0.01375, // 912828J5 - 0.01375, // 912828J8 - 0.01375, // 912828K5 - 0.01500, // 912828XE - 0.01625, // 912828XH - 0.01625, // 912828XM - 0.01375, // 912828L3 - 0.01375, // 912828L6 - 0.01375 // 912828L9 - }; - - double[] adblFuturesComponentConversionFactor = new double[] { - 0.8317, // 912828J5 - 0.8287, // 912828J8 - 0.8258, // 912828K5 - 0.8276, // 912828XE - 0.8297, // 912828XH - 0.8269, // 912828XM - 0.8141, // 912828L3 - 0.8113, // 912828L6 - 0.8084 // 912828L9 - }; - - int iSpotDate = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ).julian(); - - String[] astrFundingCurveDepositTenor = new String[] { - "2D", - "1W", - "1M", - "2M", - "3M" - }; - - double[] adblFundingCurveDepositQuote = new double[] { - 0.00195, // 2D - 0.00176, // 1W - 0.00301, // 1M - 0.00401, // 2M - 0.00492 // 3M - }; - - String strFundingCurveDepositMeasure = "ForwardRate"; - - double[] adblFundingCurveFuturesQuote = new double[] { - 0.00609, - 0.00687 - }; - - String strFundingCurveFuturesMeasure = "ForwardRate"; - - String[] astrFundingCurveFixFloatTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFundingCurveFixFloatQuote = new double[] { - 0.00762, // 1Y - 0.01055, // 2Y - 0.01300, // 3Y - 0.01495, // 4Y - 0.01651, // 5Y - 0.01787, // 6Y - 0.01904, // 7Y - 0.02005, // 8Y - 0.02090, // 9Y - 0.02166, // 10Y - 0.02231, // 11Y - 0.02289, // 12Y - 0.02414, // 15Y - 0.02570, // 20Y - 0.02594, // 25Y - 0.02627, // 30Y - 0.02648, // 40Y - 0.02632 // 50Y - }; - - String strFundingFixFloatMeasure = "SwapRate"; - - int[] aiGovvieCurveTreasuryEffectiveDate = new int[] { - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate - }; - - int[] aiGovvieCurveTreasuryMaturityDate = new int[] { - new JulianDate (iSpotDate).addTenor ("1Y").julian(), - new JulianDate (iSpotDate).addTenor ("2Y").julian(), - new JulianDate (iSpotDate).addTenor ("3Y").julian(), - new JulianDate (iSpotDate).addTenor ("5Y").julian(), - new JulianDate (iSpotDate).addTenor ("7Y").julian(), - new JulianDate (iSpotDate).addTenor ("10Y").julian(), - new JulianDate (iSpotDate).addTenor ("30Y").julian() - }; - - double[] adblGovvieCurveTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblGovvieCurveTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - String strGovvieCurveTreasuryMeasure = "Yield"; - - double[] adblFuturesComponentTreasuryPrice = new double[] { - 0.99909375, // 912828J5 - 0.99900000, // 912828J8 - 0.99890625, // 912828K5 - 0.99943750, // 912828XE - 0.99984375, // 912828XH - 0.99978125, // 912828XM - 0.99862500, // 912828L3 - 0.99850000, // 912828L6 - 0.99853125 // 912828L9 - }; - - Map mapTreasuryFutures = TreasuryFuturesAPI.ValuationMetrics ( - "FBB1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - astrFundingCurveDepositTenor, - adblFundingCurveDepositQuote, - strFundingCurveDepositMeasure, - adblFundingCurveFuturesQuote, - strFundingCurveFuturesMeasure, - astrFundingCurveFixFloatTenor, - adblFundingCurveFixFloatQuote, - strFundingFixFloatMeasure, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice - ); - - for (Map.Entry me : mapTreasuryFutures.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/treasuryfuturesapi/FV1.java b/org/drip/sample/treasuryfuturesapi/FV1.java deleted file mode 100644 index a0fc718..0000000 --- a/org/drip/sample/treasuryfuturesapi/FV1.java +++ /dev/null @@ -1,274 +0,0 @@ - -package org.drip.sample.treasuryfuturesapi; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FV1 demonstrates the Invocation and Examination of the FV1 5Y UST Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class FV1 { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int[] aiFuturesComponentTreasuryEffectiveDate = new int[] { - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2014, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2014, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2014, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2014, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2014, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2014, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - int[] aiFuturesComponentTreasuryMaturityDate = new int[] { - DateUtil.CreateFromYMD (2020, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2020, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2020, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2020, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2020, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2020, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2020, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2020, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2020, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - double[] adblFuturesComponentTreasuryCoupon = new double[] { - 0.01375, // 912828J5 - 0.01375, // 912828J8 - 0.01375, // 912828K5 - 0.01500, // 912828XE - 0.01625, // 912828XH - 0.01625, // 912828XM - 0.01375, // 912828L3 - 0.01375, // 912828L6 - 0.01375 // 912828L9 - }; - - double[] adblFuturesComponentConversionFactor = new double[] { - 0.8317, // 912828J5 - 0.8287, // 912828J8 - 0.8258, // 912828K5 - 0.8276, // 912828XE - 0.8297, // 912828XH - 0.8269, // 912828XM - 0.8141, // 912828L3 - 0.8113, // 912828L6 - 0.8084 // 912828L9 - }; - - int iSpotDate = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ).julian(); - - String[] astrFundingCurveDepositTenor = new String[] { - "2D", - "1W", - "1M", - "2M", - "3M" - }; - - double[] adblFundingCurveDepositQuote = new double[] { - 0.00195, // 2D - 0.00176, // 1W - 0.00301, // 1M - 0.00401, // 2M - 0.00492 // 3M - }; - - String strFundingCurveDepositMeasure = "ForwardRate"; - - double[] adblFundingCurveFuturesQuote = new double[] { - 0.00609, - 0.00687 - }; - - String strFundingCurveFuturesMeasure = "ForwardRate"; - - String[] astrFundingCurveFixFloatTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFundingCurveFixFloatQuote = new double[] { - 0.00762, // 1Y - 0.01055, // 2Y - 0.01300, // 3Y - 0.01495, // 4Y - 0.01651, // 5Y - 0.01787, // 6Y - 0.01904, // 7Y - 0.02005, // 8Y - 0.02090, // 9Y - 0.02166, // 10Y - 0.02231, // 11Y - 0.02289, // 12Y - 0.02414, // 15Y - 0.02570, // 20Y - 0.02594, // 25Y - 0.02627, // 30Y - 0.02648, // 40Y - 0.02632 // 50Y - }; - - String strFundingFixFloatMeasure = "SwapRate"; - - int[] aiGovvieCurveTreasuryEffectiveDate = new int[] { - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate - }; - - int[] aiGovvieCurveTreasuryMaturityDate = new int[] { - new JulianDate (iSpotDate).addTenor ("1Y").julian(), - new JulianDate (iSpotDate).addTenor ("2Y").julian(), - new JulianDate (iSpotDate).addTenor ("3Y").julian(), - new JulianDate (iSpotDate).addTenor ("5Y").julian(), - new JulianDate (iSpotDate).addTenor ("7Y").julian(), - new JulianDate (iSpotDate).addTenor ("10Y").julian(), - new JulianDate (iSpotDate).addTenor ("30Y").julian() - }; - - double[] adblGovvieCurveTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblGovvieCurveTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - String strGovvieCurveTreasuryMeasure = "Yield"; - - double[] adblFuturesComponentTreasuryPrice = new double[] { - 0.99909375, // 912828J5 - 0.99900000, // 912828J8 - 0.99890625, // 912828K5 - 0.99943750, // 912828XE - 0.99984375, // 912828XH - 0.99978125, // 912828XM - 0.99862500, // 912828L3 - 0.99850000, // 912828L6 - 0.99853125 // 912828L9 - }; - - Map mapTreasuryFutures = TreasuryFuturesAPI.ValuationMetrics ( - "FV1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - astrFundingCurveDepositTenor, - adblFundingCurveDepositQuote, - strFundingCurveDepositMeasure, - adblFundingCurveFuturesQuote, - strFundingCurveFuturesMeasure, - astrFundingCurveFixFloatTenor, - adblFundingCurveFixFloatQuote, - strFundingFixFloatMeasure, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice - ); - - for (Map.Entry me : mapTreasuryFutures.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/treasuryfuturesapi/G1.java b/org/drip/sample/treasuryfuturesapi/G1.java deleted file mode 100644 index 053c52f..0000000 --- a/org/drip/sample/treasuryfuturesapi/G1.java +++ /dev/null @@ -1,273 +0,0 @@ - -package org.drip.sample.treasuryfuturesapi; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * G1 demonstrates the Invocation and Examination of the G1 10Y GILT Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class G1 { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int[] aiFuturesComponentTreasuryEffectiveDate = new int[] { - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2014, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2014, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2014, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2014, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2014, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2014, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - int[] aiFuturesComponentTreasuryMaturityDate = new int[] { - DateUtil.CreateFromYMD (2020, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2020, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2020, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2020, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2020, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2020, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2020, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2020, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2020, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - double[] adblFuturesComponentTreasuryCoupon = new double[] { - 0.01375, // 912828J5 - 0.01375, // 912828J8 - 0.01375, // 912828K5 - 0.01500, // 912828XE - 0.01625, // 912828XH - 0.01625, // 912828XM - 0.01375, // 912828L3 - 0.01375, // 912828L6 - 0.01375 // 912828L9 - }; - - double[] adblFuturesComponentConversionFactor = new double[] { - 0.8317, // 912828J5 - 0.8287, // 912828J8 - 0.8258, // 912828K5 - 0.8276, // 912828XE - 0.8297, // 912828XH - 0.8269, // 912828XM - 0.8141, // 912828L3 - 0.8113, // 912828L6 - 0.8084 // 912828L9 - }; - - int iSpotDate = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ).julian(); - - String[] astrFundingCurveDepositTenor = new String[] { - "2D", - "1W", - "1M", - "2M", - "3M" - }; - - double[] adblFundingCurveDepositQuote = new double[] { - 0.00195, // 2D - 0.00176, // 1W - 0.00301, // 1M - 0.00401, // 2M - 0.00492 // 3M - }; - - String strFundingCurveDepositMeasure = "ForwardRate"; - - double[] adblFundingCurveFuturesQuote = new double[] { - 0.00609, - 0.00687 - }; - - String strFundingCurveFuturesMeasure = "ForwardRate"; - - String[] astrFundingCurveFixFloatTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFundingCurveFixFloatQuote = new double[] { - 0.00762, // 1Y - 0.01055, // 2Y - 0.01300, // 3Y - 0.01495, // 4Y - 0.01651, // 5Y - 0.01787, // 6Y - 0.01904, // 7Y - 0.02005, // 8Y - 0.02090, // 9Y - 0.02166, // 10Y - 0.02231, // 11Y - 0.02289, // 12Y - 0.02414, // 15Y - 0.02570, // 20Y - 0.02594, // 25Y - 0.02627, // 30Y - 0.02648, // 40Y - 0.02632 // 50Y - }; - - String strFundingFixFloatMeasure = "SwapRate"; - - int[] aiGovvieCurveTreasuryEffectiveDate = new int[] { - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate - }; - - int[] aiGovvieCurveTreasuryMaturityDate = new int[] { - new JulianDate (iSpotDate).addTenor ("1Y").julian(), - new JulianDate (iSpotDate).addTenor ("2Y").julian(), - new JulianDate (iSpotDate).addTenor ("3Y").julian(), - new JulianDate (iSpotDate).addTenor ("5Y").julian(), - new JulianDate (iSpotDate).addTenor ("7Y").julian(), - new JulianDate (iSpotDate).addTenor ("10Y").julian(), - new JulianDate (iSpotDate).addTenor ("30Y").julian() - }; - - double[] adblGovvieCurveTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblGovvieCurveTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - String strGovvieCurveTreasuryMeasure = "Yield"; - - double[] adblFuturesComponentTreasuryPrice = new double[] { - 0.99909375, // 912828J5 - 0.99900000, // 912828J8 - 0.99890625, // 912828K5 - 0.99943750, // 912828XE - 0.99984375, // 912828XH - 0.99978125, // 912828XM - 0.99862500, // 912828L3 - 0.99850000, // 912828L6 - 0.99853125 // 912828L9 - }; - - Map mapTreasuryFutures = TreasuryFuturesAPI.ValuationMetrics ( - "G1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - astrFundingCurveDepositTenor, - adblFundingCurveDepositQuote, - strFundingCurveDepositMeasure, - adblFundingCurveFuturesQuote, - strFundingCurveFuturesMeasure, - astrFundingCurveFixFloatTenor, - adblFundingCurveFixFloatQuote, - strFundingFixFloatMeasure, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice - ); - - for (Map.Entry me : mapTreasuryFutures.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/treasuryfuturesapi/IK1.java b/org/drip/sample/treasuryfuturesapi/IK1.java deleted file mode 100644 index 1afbd53..0000000 --- a/org/drip/sample/treasuryfuturesapi/IK1.java +++ /dev/null @@ -1,273 +0,0 @@ - -package org.drip.sample.treasuryfuturesapi; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * IK1 demonstrates the Invocation and Examination of the IK1 10Y BTPS Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class IK1 { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int[] aiFuturesComponentTreasuryEffectiveDate = new int[] { - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2014, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2014, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2014, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2014, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2014, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2014, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - int[] aiFuturesComponentTreasuryMaturityDate = new int[] { - DateUtil.CreateFromYMD (2020, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2020, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2020, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2020, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2020, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2020, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2020, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2020, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2020, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - double[] adblFuturesComponentTreasuryCoupon = new double[] { - 0.01375, // 912828J5 - 0.01375, // 912828J8 - 0.01375, // 912828K5 - 0.01500, // 912828XE - 0.01625, // 912828XH - 0.01625, // 912828XM - 0.01375, // 912828L3 - 0.01375, // 912828L6 - 0.01375 // 912828L9 - }; - - double[] adblFuturesComponentConversionFactor = new double[] { - 0.8317, // 912828J5 - 0.8287, // 912828J8 - 0.8258, // 912828K5 - 0.8276, // 912828XE - 0.8297, // 912828XH - 0.8269, // 912828XM - 0.8141, // 912828L3 - 0.8113, // 912828L6 - 0.8084 // 912828L9 - }; - - int iSpotDate = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ).julian(); - - String[] astrFundingCurveDepositTenor = new String[] { - "2D", - "1W", - "1M", - "2M", - "3M" - }; - - double[] adblFundingCurveDepositQuote = new double[] { - 0.00195, // 2D - 0.00176, // 1W - 0.00301, // 1M - 0.00401, // 2M - 0.00492 // 3M - }; - - String strFundingCurveDepositMeasure = "ForwardRate"; - - double[] adblFundingCurveFuturesQuote = new double[] { - 0.00609, - 0.00687 - }; - - String strFundingCurveFuturesMeasure = "ForwardRate"; - - String[] astrFundingCurveFixFloatTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFundingCurveFixFloatQuote = new double[] { - 0.00762, // 1Y - 0.01055, // 2Y - 0.01300, // 3Y - 0.01495, // 4Y - 0.01651, // 5Y - 0.01787, // 6Y - 0.01904, // 7Y - 0.02005, // 8Y - 0.02090, // 9Y - 0.02166, // 10Y - 0.02231, // 11Y - 0.02289, // 12Y - 0.02414, // 15Y - 0.02570, // 20Y - 0.02594, // 25Y - 0.02627, // 30Y - 0.02648, // 40Y - 0.02632 // 50Y - }; - - String strFundingFixFloatMeasure = "SwapRate"; - - int[] aiGovvieCurveTreasuryEffectiveDate = new int[] { - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate - }; - - int[] aiGovvieCurveTreasuryMaturityDate = new int[] { - new JulianDate (iSpotDate).addTenor ("1Y").julian(), - new JulianDate (iSpotDate).addTenor ("2Y").julian(), - new JulianDate (iSpotDate).addTenor ("3Y").julian(), - new JulianDate (iSpotDate).addTenor ("5Y").julian(), - new JulianDate (iSpotDate).addTenor ("7Y").julian(), - new JulianDate (iSpotDate).addTenor ("10Y").julian(), - new JulianDate (iSpotDate).addTenor ("30Y").julian() - }; - - double[] adblGovvieCurveTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblGovvieCurveTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - String strGovvieCurveTreasuryMeasure = "Yield"; - - double[] adblFuturesComponentTreasuryPrice = new double[] { - 0.99909375, // 912828J5 - 0.99900000, // 912828J8 - 0.99890625, // 912828K5 - 0.99943750, // 912828XE - 0.99984375, // 912828XH - 0.99978125, // 912828XM - 0.99862500, // 912828L3 - 0.99850000, // 912828L6 - 0.99853125 // 912828L9 - }; - - Map mapTreasuryFutures = TreasuryFuturesAPI.ValuationMetrics ( - "IK1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - astrFundingCurveDepositTenor, - adblFundingCurveDepositQuote, - strFundingCurveDepositMeasure, - adblFundingCurveFuturesQuote, - strFundingCurveFuturesMeasure, - astrFundingCurveFixFloatTenor, - adblFundingCurveFixFloatQuote, - strFundingFixFloatMeasure, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice - ); - - for (Map.Entry me : mapTreasuryFutures.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/treasuryfuturesapi/JB1.java b/org/drip/sample/treasuryfuturesapi/JB1.java deleted file mode 100644 index bb28b43..0000000 --- a/org/drip/sample/treasuryfuturesapi/JB1.java +++ /dev/null @@ -1,273 +0,0 @@ - -package org.drip.sample.treasuryfuturesapi; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * JB1 demonstrates the Invocation and Examination of the JB1 10Y JGB Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class JB1 { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int[] aiFuturesComponentTreasuryEffectiveDate = new int[] { - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2014, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2014, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2014, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2014, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2014, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2014, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - int[] adblFuturesComponentTreasuryMaturity = new int[] { - DateUtil.CreateFromYMD (2020, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2020, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2020, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2020, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2020, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2020, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2020, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2020, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2020, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - double[] adblFuturesComponentTreasuryCoupon = new double[] { - 0.01375, // 912828J5 - 0.01375, // 912828J8 - 0.01375, // 912828K5 - 0.01500, // 912828XE - 0.01625, // 912828XH - 0.01625, // 912828XM - 0.01375, // 912828L3 - 0.01375, // 912828L6 - 0.01375 // 912828L9 - }; - - double[] adblFuturesComponentConversionFactor = new double[] { - 0.8317, // 912828J5 - 0.8287, // 912828J8 - 0.8258, // 912828K5 - 0.8276, // 912828XE - 0.8297, // 912828XH - 0.8269, // 912828XM - 0.8141, // 912828L3 - 0.8113, // 912828L6 - 0.8084 // 912828L9 - }; - - int iSpotDate = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ).julian(); - - String[] astrFundingCurveDepositTenor = new String[] { - "2D", - "1W", - "1M", - "2M", - "3M" - }; - - double[] adblFundingCurveDepositQuote = new double[] { - 0.00195, // 2D - 0.00176, // 1W - 0.00301, // 1M - 0.00401, // 2M - 0.00492 // 3M - }; - - String strFundingCurveDepositMeasure = "ForwardRate"; - - double[] adblFundingCurveFuturesQuote = new double[] { - 0.00609, - 0.00687 - }; - - String strFundingCurveFuturesMeasure = "ForwardRate"; - - String[] astrFundingCurveFixFloatTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFundingCurveFixFloatQuote = new double[] { - 0.00762, // 1Y - 0.01055, // 2Y - 0.01300, // 3Y - 0.01495, // 4Y - 0.01651, // 5Y - 0.01787, // 6Y - 0.01904, // 7Y - 0.02005, // 8Y - 0.02090, // 9Y - 0.02166, // 10Y - 0.02231, // 11Y - 0.02289, // 12Y - 0.02414, // 15Y - 0.02570, // 20Y - 0.02594, // 25Y - 0.02627, // 30Y - 0.02648, // 40Y - 0.02632 // 50Y - }; - - String strFundingFixFloatMeasure = "SwapRate"; - - int[] aiGovvieCurveTreasuryEffectiveDae = new int[] { - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate - }; - - int[] aiGovvieCurveTreasuryMaturityDate = new int[] { - new JulianDate (iSpotDate).addTenor ("1Y").julian(), - new JulianDate (iSpotDate).addTenor ("2Y").julian(), - new JulianDate (iSpotDate).addTenor ("3Y").julian(), - new JulianDate (iSpotDate).addTenor ("5Y").julian(), - new JulianDate (iSpotDate).addTenor ("7Y").julian(), - new JulianDate (iSpotDate).addTenor ("10Y").julian(), - new JulianDate (iSpotDate).addTenor ("30Y").julian() - }; - - double[] adblGovvieCurveTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblGovvieCurveTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - String strGovvieCurveTreasuryMeasure = "Yield"; - - double[] adblFuturesComponentTreasuryPrice = new double[] { - 0.99909375, // 912828J5 - 0.99900000, // 912828J8 - 0.99890625, // 912828K5 - 0.99943750, // 912828XE - 0.99984375, // 912828XH - 0.99978125, // 912828XM - 0.99862500, // 912828L3 - 0.99850000, // 912828L6 - 0.99853125 // 912828L9 - }; - - Map mapTreasuryFutures = TreasuryFuturesAPI.ValuationMetrics ( - "JB1", - aiFuturesComponentTreasuryEffectiveDate, - adblFuturesComponentTreasuryMaturity, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - astrFundingCurveDepositTenor, - adblFundingCurveDepositQuote, - strFundingCurveDepositMeasure, - adblFundingCurveFuturesQuote, - strFundingCurveFuturesMeasure, - astrFundingCurveFixFloatTenor, - adblFundingCurveFixFloatQuote, - strFundingFixFloatMeasure, - aiGovvieCurveTreasuryEffectiveDae, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice - ); - - for (Map.Entry me : mapTreasuryFutures.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/treasuryfuturesapi/KeyRateDuration.java b/org/drip/sample/treasuryfuturesapi/KeyRateDuration.java deleted file mode 100644 index f967a2f..0000000 --- a/org/drip/sample/treasuryfuturesapi/KeyRateDuration.java +++ /dev/null @@ -1,510 +0,0 @@ - -package org.drip.sample.treasuryfuturesapi; - -import java.util.*; - -import org.drip.analytics.date.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * KeyRateDuration demonstrates the Invocation and Examination of the Key Rate Duration Computation for the - * specified Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class KeyRateDuration { - - private static void ComputeKeyRateDuration ( - final String strFuturesCode, - final int[] aiFuturesComponentTreasuryEffectiveDate, - final int[] aiFuturesComponentTreasuryMaturityDate, - final double[] adblFuturesComponentTreasuryCoupon, - final double[] adblFuturesComponentConversionFactor, - final int iSpotDate, - final int[] aiGovvieCurveTreasuryEffectiveDate, - final int[] aiGovvieCurveTreasuryMaturityDate, - final double[] adblGovvieCurveTreasuryCoupon, - final double[] adblGovvieCurveTreasuryYield, - final String strGovvieCurveTreasuryMeasure, - final double[] adblFuturesComponentTreasuryPrice, - final boolean bHeader, - final boolean bTrailer) - throws Exception - { - Map mapKeyRateDuration = TreasuryFuturesAPI.KeyRateDuration ( - strFuturesCode, - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice - ); - - if (bHeader) { - System.out.println ("\n\t|------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.print ("\t| CODE |"); - - Set setstrKey = mapKeyRateDuration.keySet(); - - for (String strKey : setstrKey) - System.out.print (" " + strKey + " |"); - - System.out.println ("|"); - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------||"); - } - - System.out.print ("\t| " + strFuturesCode + " |"); - - for (Map.Entry me : mapKeyRateDuration.entrySet()) - System.out.print (" " + FormatUtil.FormatDouble (-1. * me.getValue(), 1, 5, 1.) + " |"); - - System.out.println ("|"); - - if (bTrailer) - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------||\n"); - } - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int[] aiFuturesComponentTreasuryEffectiveDate = new int[] { - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2014, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2014, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2014, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2014, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2014, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2014, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - int[] aiFuturesComponentTreasuryMaturityDate = new int[] { - DateUtil.CreateFromYMD (2020, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2020, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2020, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2020, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2020, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2020, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2020, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2020, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2020, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - double[] adblFuturesComponentTreasuryCoupon = new double[] { - 0.01375, // 912828J5 - 0.01375, // 912828J8 - 0.01375, // 912828K5 - 0.01500, // 912828XE - 0.01625, // 912828XH - 0.01625, // 912828XM - 0.01375, // 912828L3 - 0.01375, // 912828L6 - 0.01375 // 912828L9 - }; - - double[] adblFuturesComponentConversionFactor = new double[] { - 0.8317, // 912828J5 - 0.8287, // 912828J8 - 0.8258, // 912828K5 - 0.8276, // 912828XE - 0.8297, // 912828XH - 0.8269, // 912828XM - 0.8141, // 912828L3 - 0.8113, // 912828L6 - 0.8084 // 912828L9 - }; - - int iSpotDate = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ).julian(); - - int[] aiGovvieCurveTreasuryEffectiveDate = new int[] { - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate - }; - - int[] aiGovvieCurveTreasuryMaturityDate = new int[] { - new JulianDate (iSpotDate).addTenor ("1Y").julian(), - new JulianDate (iSpotDate).addTenor ("2Y").julian(), - new JulianDate (iSpotDate).addTenor ("3Y").julian(), - new JulianDate (iSpotDate).addTenor ("5Y").julian(), - new JulianDate (iSpotDate).addTenor ("7Y").julian(), - new JulianDate (iSpotDate).addTenor ("10Y").julian(), - new JulianDate (iSpotDate).addTenor ("30Y").julian() - }; - - double[] adblGovvieCurveTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblGovvieCurveTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - String strGovvieCurveTreasuryMeasure = "Yield"; - - double[] adblFuturesComponentTreasuryPrice = new double[] { - 0.99909375, // 912828J5 - 0.99900000, // 912828J8 - 0.99890625, // 912828K5 - 0.99943750, // 912828XE - 0.99984375, // 912828XH - 0.99978125, // 912828XM - 0.99862500, // 912828L3 - 0.99850000, // 912828L6 - 0.99853125 // 912828L9 - }; - - ComputeKeyRateDuration ( - "CN1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice, - true, - false - ); - - ComputeKeyRateDuration ( - "DU1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice, - false, - false - ); - - /* ComputeKeyRateDuration ( - "FBB1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice, - false, - false - ); */ - - ComputeKeyRateDuration ( - "FV1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice, - false, - false - ); - - ComputeKeyRateDuration ( - "G1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice, - false, - false - ); - - /* ComputeKeyRateDuration ( - "IK1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice, - false, - false - ); */ - - ComputeKeyRateDuration ( - "JB1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice, - false, - false - ); - - /* ComputeKeyRateDuration ( - "OAT1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice, - false, - false - ); */ - - ComputeKeyRateDuration ( - "OE1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice, - false, - false - ); - - ComputeKeyRateDuration ( - "RX1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice, - false, - false - ); - - ComputeKeyRateDuration ( - "TU1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice, - false, - false - ); - - ComputeKeyRateDuration ( - "TY1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice, - false, - false - ); - - ComputeKeyRateDuration ( - "UB1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice, - false, - false - ); - - ComputeKeyRateDuration ( - "ULTRA", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice, - false, - false - ); - - ComputeKeyRateDuration ( - "US1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice, - false, - false - ); - - ComputeKeyRateDuration ( - "YM1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice, - false, - true - ); - } -} diff --git a/org/drip/sample/treasuryfuturesapi/OAT1.java b/org/drip/sample/treasuryfuturesapi/OAT1.java deleted file mode 100644 index dfc731b..0000000 --- a/org/drip/sample/treasuryfuturesapi/OAT1.java +++ /dev/null @@ -1,273 +0,0 @@ - -package org.drip.sample.treasuryfuturesapi; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OAT1 demonstrates the Invocation and Examination of the OAT1 10Y FRTR Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class OAT1 { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int[] aiFuturesComponentTreasuryEffectiveDate = new int[] { - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2014, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2014, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2014, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2014, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2014, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2014, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - int[] adblFuturesComponentTreasuryMaturity = new int[] { - DateUtil.CreateFromYMD (2020, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2020, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2020, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2020, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2020, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2020, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2020, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2020, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2020, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - double[] adblFuturesComponentTreasuryCoupon = new double[] { - 0.01375, // 912828J5 - 0.01375, // 912828J8 - 0.01375, // 912828K5 - 0.01500, // 912828XE - 0.01625, // 912828XH - 0.01625, // 912828XM - 0.01375, // 912828L3 - 0.01375, // 912828L6 - 0.01375 // 912828L9 - }; - - double[] adblFuturesComponentConversionFactor = new double[] { - 0.8317, // 912828J5 - 0.8287, // 912828J8 - 0.8258, // 912828K5 - 0.8276, // 912828XE - 0.8297, // 912828XH - 0.8269, // 912828XM - 0.8141, // 912828L3 - 0.8113, // 912828L6 - 0.8084 // 912828L9 - }; - - int iSpotDate = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ).julian(); - - String[] astrFundingCurveDepositTenor = new String[] { - "2D", - "1W", - "1M", - "2M", - "3M" - }; - - double[] adblFundingCurveDepositQuote = new double[] { - 0.00195, // 2D - 0.00176, // 1W - 0.00301, // 1M - 0.00401, // 2M - 0.00492 // 3M - }; - - String strFundingCurveDepositMeasure = "ForwardRate"; - - double[] adblFundingCurveFuturesQuote = new double[] { - 0.00609, - 0.00687 - }; - - String strFundingCurveFuturesMeasure = "ForwardRate"; - - String[] astrFundingCurveFixFloatTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFundingCurveFixFloatQuote = new double[] { - 0.00762, // 1Y - 0.01055, // 2Y - 0.01300, // 3Y - 0.01495, // 4Y - 0.01651, // 5Y - 0.01787, // 6Y - 0.01904, // 7Y - 0.02005, // 8Y - 0.02090, // 9Y - 0.02166, // 10Y - 0.02231, // 11Y - 0.02289, // 12Y - 0.02414, // 15Y - 0.02570, // 20Y - 0.02594, // 25Y - 0.02627, // 30Y - 0.02648, // 40Y - 0.02632 // 50Y - }; - - String strFundingFixFloatMeasure = "SwapRate"; - - int[] aiGovvieCurveTreasuryEffectiveDate = new int[] { - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate - }; - - int[] aiGovvieCurveTreasuryMaturityDate = new int[] { - new JulianDate (iSpotDate).addTenor ("1Y").julian(), - new JulianDate (iSpotDate).addTenor ("2Y").julian(), - new JulianDate (iSpotDate).addTenor ("3Y").julian(), - new JulianDate (iSpotDate).addTenor ("5Y").julian(), - new JulianDate (iSpotDate).addTenor ("7Y").julian(), - new JulianDate (iSpotDate).addTenor ("10Y").julian(), - new JulianDate (iSpotDate).addTenor ("30Y").julian() - }; - - double[] adblGovvieCurveTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblGovvieCurveTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - String strGovvieCurveTreasuryMeasure = "Yield"; - - double[] adblFuturesComponentTreasuryPrice = new double[] { - 0.99909375, // 912828J5 - 0.99900000, // 912828J8 - 0.99890625, // 912828K5 - 0.99943750, // 912828XE - 0.99984375, // 912828XH - 0.99978125, // 912828XM - 0.99862500, // 912828L3 - 0.99850000, // 912828L6 - 0.99853125 // 912828L9 - }; - - Map mapTreasuryFutures = TreasuryFuturesAPI.ValuationMetrics ( - "OAT1", - aiFuturesComponentTreasuryEffectiveDate, - adblFuturesComponentTreasuryMaturity, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - astrFundingCurveDepositTenor, - adblFundingCurveDepositQuote, - strFundingCurveDepositMeasure, - adblFundingCurveFuturesQuote, - strFundingCurveFuturesMeasure, - astrFundingCurveFixFloatTenor, - adblFundingCurveFixFloatQuote, - strFundingFixFloatMeasure, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice - ); - - for (Map.Entry me : mapTreasuryFutures.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/treasuryfuturesapi/OE1.java b/org/drip/sample/treasuryfuturesapi/OE1.java deleted file mode 100644 index da73543..0000000 --- a/org/drip/sample/treasuryfuturesapi/OE1.java +++ /dev/null @@ -1,273 +0,0 @@ - -package org.drip.sample.treasuryfuturesapi; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OE1 demonstrates the Invocation and Examination of the OE1 5Y DBR BOBL Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class OE1 { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int[] aiFuturesComponentTreasuryEffectiveDate = new int[] { - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2014, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2014, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2014, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2014, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2014, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2014, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - int[] aiFuturesComponentTreasuryMaturityDate = new int[] { - DateUtil.CreateFromYMD (2020, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2020, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2020, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2020, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2020, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2020, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2020, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2020, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2020, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - double[] adblFuturesComponentTreasuryCoupon = new double[] { - 0.01375, // 912828J5 - 0.01375, // 912828J8 - 0.01375, // 912828K5 - 0.01500, // 912828XE - 0.01625, // 912828XH - 0.01625, // 912828XM - 0.01375, // 912828L3 - 0.01375, // 912828L6 - 0.01375 // 912828L9 - }; - - double[] adblFuturesComponentConversionFactor = new double[] { - 0.8317, // 912828J5 - 0.8287, // 912828J8 - 0.8258, // 912828K5 - 0.8276, // 912828XE - 0.8297, // 912828XH - 0.8269, // 912828XM - 0.8141, // 912828L3 - 0.8113, // 912828L6 - 0.8084 // 912828L9 - }; - - int iSpotDate = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ).julian(); - - String[] astrFundingCurveDepositTenor = new String[] { - "2D", - "1W", - "1M", - "2M", - "3M" - }; - - double[] adblFundingCurveDepositQuote = new double[] { - 0.00195, // 2D - 0.00176, // 1W - 0.00301, // 1M - 0.00401, // 2M - 0.00492 // 3M - }; - - String strFundingCurveDepositMeasure = "ForwardRate"; - - double[] adblFundingCurveFuturesQuote = new double[] { - 0.00609, - 0.00687 - }; - - String strFundingCurveFuturesMeasure = "ForwardRate"; - - String[] astrFundingCurveFixFloatTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFundingCurveFixFloatQuote = new double[] { - 0.00762, // 1Y - 0.01055, // 2Y - 0.01300, // 3Y - 0.01495, // 4Y - 0.01651, // 5Y - 0.01787, // 6Y - 0.01904, // 7Y - 0.02005, // 8Y - 0.02090, // 9Y - 0.02166, // 10Y - 0.02231, // 11Y - 0.02289, // 12Y - 0.02414, // 15Y - 0.02570, // 20Y - 0.02594, // 25Y - 0.02627, // 30Y - 0.02648, // 40Y - 0.02632 // 50Y - }; - - String strFundingFixFloatMeasure = "SwapRate"; - - int[] aiGovvieCurveTreasuryEffectiveDate = new int[] { - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate - }; - - int[] aiGovvieCurveTreasuryMaturityDate = new int[] { - new JulianDate (iSpotDate).addTenor ("1Y").julian(), - new JulianDate (iSpotDate).addTenor ("2Y").julian(), - new JulianDate (iSpotDate).addTenor ("3Y").julian(), - new JulianDate (iSpotDate).addTenor ("5Y").julian(), - new JulianDate (iSpotDate).addTenor ("7Y").julian(), - new JulianDate (iSpotDate).addTenor ("10Y").julian(), - new JulianDate (iSpotDate).addTenor ("30Y").julian() - }; - - double[] adblGovvieCurveTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblGovvieCurveTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - String strGovvieCurveTreasuryMeasure = "Yield"; - - double[] adblFuturesComponentTreasuryPrice = new double[] { - 0.99909375, // 912828J5 - 0.99900000, // 912828J8 - 0.99890625, // 912828K5 - 0.99943750, // 912828XE - 0.99984375, // 912828XH - 0.99978125, // 912828XM - 0.99862500, // 912828L3 - 0.99850000, // 912828L6 - 0.99853125 // 912828L9 - }; - - Map mapTreasuryFutures = TreasuryFuturesAPI.ValuationMetrics ( - "OE1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - astrFundingCurveDepositTenor, - adblFundingCurveDepositQuote, - strFundingCurveDepositMeasure, - adblFundingCurveFuturesQuote, - strFundingCurveFuturesMeasure, - astrFundingCurveFixFloatTenor, - adblFundingCurveFixFloatQuote, - strFundingFixFloatMeasure, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice - ); - - for (Map.Entry me : mapTreasuryFutures.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/treasuryfuturesapi/RX1.java b/org/drip/sample/treasuryfuturesapi/RX1.java deleted file mode 100644 index b495ab4..0000000 --- a/org/drip/sample/treasuryfuturesapi/RX1.java +++ /dev/null @@ -1,273 +0,0 @@ - -package org.drip.sample.treasuryfuturesapi; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * RX1 demonstrates the Invocation and Examination of the RX1 10Y DBR BUND Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class RX1 { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int[] aiFuturesComponentTreasuryEffectiveDate = new int[] { - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2014, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2014, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2014, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2014, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2014, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2014, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - int[] aiFuturesComponentTreasuryMaturityDate = new int[] { - DateUtil.CreateFromYMD (2020, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2020, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2020, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2020, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2020, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2020, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2020, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2020, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2020, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - double[] adblFuturesComponentTreasuryCoupon = new double[] { - 0.01375, // 912828J5 - 0.01375, // 912828J8 - 0.01375, // 912828K5 - 0.01500, // 912828XE - 0.01625, // 912828XH - 0.01625, // 912828XM - 0.01375, // 912828L3 - 0.01375, // 912828L6 - 0.01375 // 912828L9 - }; - - double[] adblFuturesComponentConversionFactor = new double[] { - 0.8317, // 912828J5 - 0.8287, // 912828J8 - 0.8258, // 912828K5 - 0.8276, // 912828XE - 0.8297, // 912828XH - 0.8269, // 912828XM - 0.8141, // 912828L3 - 0.8113, // 912828L6 - 0.8084 // 912828L9 - }; - - int iSpotDate = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ).julian(); - - String[] astrFundingCurveDepositTenor = new String[] { - "2D", - "1W", - "1M", - "2M", - "3M" - }; - - double[] adblFundingCurveDepositQuote = new double[] { - 0.00195, // 2D - 0.00176, // 1W - 0.00301, // 1M - 0.00401, // 2M - 0.00492 // 3M - }; - - String strFundingCurveDepositMeasure = "ForwardRate"; - - double[] adblFundingCurveFuturesQuote = new double[] { - 0.00609, - 0.00687 - }; - - String strFundingCurveFuturesMeasure = "ForwardRate"; - - String[] astrFundingCurveFixFloatTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFundingCurveFixFloatQuote = new double[] { - 0.00762, // 1Y - 0.01055, // 2Y - 0.01300, // 3Y - 0.01495, // 4Y - 0.01651, // 5Y - 0.01787, // 6Y - 0.01904, // 7Y - 0.02005, // 8Y - 0.02090, // 9Y - 0.02166, // 10Y - 0.02231, // 11Y - 0.02289, // 12Y - 0.02414, // 15Y - 0.02570, // 20Y - 0.02594, // 25Y - 0.02627, // 30Y - 0.02648, // 40Y - 0.02632 // 50Y - }; - - String strFundingFixFloatMeasure = "SwapRate"; - - int[] aiGovvieCurveTreasuryEffectiveDate = new int[] { - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate - }; - - int[] aiGovvieCurveTreasuryMaturityDate = new int[] { - new JulianDate (iSpotDate).addTenor ("1Y").julian(), - new JulianDate (iSpotDate).addTenor ("2Y").julian(), - new JulianDate (iSpotDate).addTenor ("3Y").julian(), - new JulianDate (iSpotDate).addTenor ("5Y").julian(), - new JulianDate (iSpotDate).addTenor ("7Y").julian(), - new JulianDate (iSpotDate).addTenor ("10Y").julian(), - new JulianDate (iSpotDate).addTenor ("30Y").julian() - }; - - double[] adblGovvieCurveTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblGovvieCurveTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - String strGovvieCurveTreasuryMeasure = "Yield"; - - double[] adblFuturesComponentTreasuryPrice = new double[] { - 0.99909375, // 912828J5 - 0.99900000, // 912828J8 - 0.99890625, // 912828K5 - 0.99943750, // 912828XE - 0.99984375, // 912828XH - 0.99978125, // 912828XM - 0.99862500, // 912828L3 - 0.99850000, // 912828L6 - 0.99853125 // 912828L9 - }; - - Map mapTreasuryFutures = TreasuryFuturesAPI.ValuationMetrics ( - "RX1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - astrFundingCurveDepositTenor, - adblFundingCurveDepositQuote, - strFundingCurveDepositMeasure, - adblFundingCurveFuturesQuote, - strFundingCurveFuturesMeasure, - astrFundingCurveFixFloatTenor, - adblFundingCurveFixFloatQuote, - strFundingFixFloatMeasure, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice - ); - - for (Map.Entry me : mapTreasuryFutures.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/treasuryfuturesapi/TU1.java b/org/drip/sample/treasuryfuturesapi/TU1.java deleted file mode 100644 index 91ab54e..0000000 --- a/org/drip/sample/treasuryfuturesapi/TU1.java +++ /dev/null @@ -1,273 +0,0 @@ - -package org.drip.sample.treasuryfuturesapi; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TU1 demonstrates the Invocation and Examination of the TU1 2Y UST Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class TU1 { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int[] aiFuturesComponentTreasuryEffectiveDate = new int[] { - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2014, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2014, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2014, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2014, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2014, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2014, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - int[] aiFuturesComponentTreasuryMaturityDate = new int[] { - DateUtil.CreateFromYMD (2020, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2020, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2020, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2020, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2020, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2020, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2020, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2020, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2020, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - double[] adblFuturesComponentTreasuryCoupon = new double[] { - 0.01375, // 912828J5 - 0.01375, // 912828J8 - 0.01375, // 912828K5 - 0.01500, // 912828XE - 0.01625, // 912828XH - 0.01625, // 912828XM - 0.01375, // 912828L3 - 0.01375, // 912828L6 - 0.01375 // 912828L9 - }; - - double[] adblFuturesComponentConversionFactor = new double[] { - 0.8317, // 912828J5 - 0.8287, // 912828J8 - 0.8258, // 912828K5 - 0.8276, // 912828XE - 0.8297, // 912828XH - 0.8269, // 912828XM - 0.8141, // 912828L3 - 0.8113, // 912828L6 - 0.8084 // 912828L9 - }; - - int iSpotDate = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ).julian(); - - String[] astrFundingCurveDepositTenor = new String[] { - "2D", - "1W", - "1M", - "2M", - "3M" - }; - - double[] adblFundingCurveDepositQuote = new double[] { - 0.00195, // 2D - 0.00176, // 1W - 0.00301, // 1M - 0.00401, // 2M - 0.00492 // 3M - }; - - String strFundingCurveDepositMeasure = "ForwardRate"; - - double[] adblFundingCurveFuturesQuote = new double[] { - 0.00609, - 0.00687 - }; - - String strFundingCurveFuturesMeasure = "ForwardRate"; - - String[] astrFundingCurveFixFloatTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFundingCurveFixFloatQuote = new double[] { - 0.00762, // 1Y - 0.01055, // 2Y - 0.01300, // 3Y - 0.01495, // 4Y - 0.01651, // 5Y - 0.01787, // 6Y - 0.01904, // 7Y - 0.02005, // 8Y - 0.02090, // 9Y - 0.02166, // 10Y - 0.02231, // 11Y - 0.02289, // 12Y - 0.02414, // 15Y - 0.02570, // 20Y - 0.02594, // 25Y - 0.02627, // 30Y - 0.02648, // 40Y - 0.02632 // 50Y - }; - - String strFundingFixFloatMeasure = "SwapRate"; - - int[] aiGovvieCurveTreasuryEffectiveDate = new int[] { - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate - }; - - int[] aiGovvieCurveTreasuryMaturityDate = new int[] { - new JulianDate (iSpotDate).addTenor ("1Y").julian(), - new JulianDate (iSpotDate).addTenor ("2Y").julian(), - new JulianDate (iSpotDate).addTenor ("3Y").julian(), - new JulianDate (iSpotDate).addTenor ("5Y").julian(), - new JulianDate (iSpotDate).addTenor ("7Y").julian(), - new JulianDate (iSpotDate).addTenor ("10Y").julian(), - new JulianDate (iSpotDate).addTenor ("30Y").julian() - }; - - double[] adblGovvieCurveTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblGovvieCurveTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - String strGovvieCurveTreasuryMeasure = "Yield"; - - double[] adblFuturesComponentTreasuryPrice = new double[] { - 0.99909375, // 912828J5 - 0.99900000, // 912828J8 - 0.99890625, // 912828K5 - 0.99943750, // 912828XE - 0.99984375, // 912828XH - 0.99978125, // 912828XM - 0.99862500, // 912828L3 - 0.99850000, // 912828L6 - 0.99853125 // 912828L9 - }; - - Map mapTreasuryFutures = TreasuryFuturesAPI.ValuationMetrics ( - "TU1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - astrFundingCurveDepositTenor, - adblFundingCurveDepositQuote, - strFundingCurveDepositMeasure, - adblFundingCurveFuturesQuote, - strFundingCurveFuturesMeasure, - astrFundingCurveFixFloatTenor, - adblFundingCurveFixFloatQuote, - strFundingFixFloatMeasure, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice - ); - - for (Map.Entry me : mapTreasuryFutures.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/treasuryfuturesapi/TY1.java b/org/drip/sample/treasuryfuturesapi/TY1.java deleted file mode 100644 index 432a889..0000000 --- a/org/drip/sample/treasuryfuturesapi/TY1.java +++ /dev/null @@ -1,273 +0,0 @@ - -package org.drip.sample.treasuryfuturesapi; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TY1 demonstrates the Invocation and Examination of the TY1 10Y UST Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class TY1 { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int[] aiFuturesComponentTreasuryEffectiveDate = new int[] { - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2014, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2014, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2014, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2014, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2014, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2014, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - int[] aiFuturesComponentTreasuryMaturityDate = new int[] { - DateUtil.CreateFromYMD (2020, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2020, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2020, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2020, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2020, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2020, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2020, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2020, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2020, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - double[] adblFuturesComponentTreasuryCoupon = new double[] { - 0.01375, // 912828J5 - 0.01375, // 912828J8 - 0.01375, // 912828K5 - 0.01500, // 912828XE - 0.01625, // 912828XH - 0.01625, // 912828XM - 0.01375, // 912828L3 - 0.01375, // 912828L6 - 0.01375 // 912828L9 - }; - - double[] adblFuturesComponentConversionFactor = new double[] { - 0.8317, // 912828J5 - 0.8287, // 912828J8 - 0.8258, // 912828K5 - 0.8276, // 912828XE - 0.8297, // 912828XH - 0.8269, // 912828XM - 0.8141, // 912828L3 - 0.8113, // 912828L6 - 0.8084 // 912828L9 - }; - - int iSpotDate = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ).julian(); - - String[] astrFundingCurveDepositTenor = new String[] { - "2D", - "1W", - "1M", - "2M", - "3M" - }; - - double[] adblFundingCurveDepositQuote = new double[] { - 0.00195, // 2D - 0.00176, // 1W - 0.00301, // 1M - 0.00401, // 2M - 0.00492 // 3M - }; - - String strFundingCurveDepositMeasure = "ForwardRate"; - - double[] adblFundingCurveFuturesQuote = new double[] { - 0.00609, - 0.00687 - }; - - String strFundingCurveFuturesMeasure = "ForwardRate"; - - String[] astrFundingCurveFixFloatTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFundingCurveFixFloatQuote = new double[] { - 0.00762, // 1Y - 0.01055, // 2Y - 0.01300, // 3Y - 0.01495, // 4Y - 0.01651, // 5Y - 0.01787, // 6Y - 0.01904, // 7Y - 0.02005, // 8Y - 0.02090, // 9Y - 0.02166, // 10Y - 0.02231, // 11Y - 0.02289, // 12Y - 0.02414, // 15Y - 0.02570, // 20Y - 0.02594, // 25Y - 0.02627, // 30Y - 0.02648, // 40Y - 0.02632 // 50Y - }; - - String strFundingFixFloatMeasure = "SwapRate"; - - int[] aiGovvieCurveTreasuryEffectiveDate = new int[] { - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate - }; - - int[] aiGovvieCurveTreasuryMaturityDate = new int[] { - new JulianDate (iSpotDate).addTenor ("1Y").julian(), - new JulianDate (iSpotDate).addTenor ("2Y").julian(), - new JulianDate (iSpotDate).addTenor ("3Y").julian(), - new JulianDate (iSpotDate).addTenor ("5Y").julian(), - new JulianDate (iSpotDate).addTenor ("7Y").julian(), - new JulianDate (iSpotDate).addTenor ("10Y").julian(), - new JulianDate (iSpotDate).addTenor ("30Y").julian() - }; - - double[] adblGovvieCurveTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblGovvieCurveTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - String strGovvieCurveTreasuryMeasure = "Yield"; - - double[] adblFuturesComponentTreasuryPrice = new double[] { - 0.99909375, // 912828J5 - 0.99900000, // 912828J8 - 0.99890625, // 912828K5 - 0.99943750, // 912828XE - 0.99984375, // 912828XH - 0.99978125, // 912828XM - 0.99862500, // 912828L3 - 0.99850000, // 912828L6 - 0.99853125 // 912828L9 - }; - - Map mapTreasuryFutures = TreasuryFuturesAPI.ValuationMetrics ( - "TY1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - astrFundingCurveDepositTenor, - adblFundingCurveDepositQuote, - strFundingCurveDepositMeasure, - adblFundingCurveFuturesQuote, - strFundingCurveFuturesMeasure, - astrFundingCurveFixFloatTenor, - adblFundingCurveFixFloatQuote, - strFundingFixFloatMeasure, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice - ); - - for (Map.Entry me : mapTreasuryFutures.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/treasuryfuturesapi/UB1.java b/org/drip/sample/treasuryfuturesapi/UB1.java deleted file mode 100644 index cb06e8e..0000000 --- a/org/drip/sample/treasuryfuturesapi/UB1.java +++ /dev/null @@ -1,273 +0,0 @@ - -package org.drip.sample.treasuryfuturesapi; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * UB1 demonstrates the Invocation and Examination of the UB1 30Y DBR BUXL Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class UB1 { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int[] aiFuturesComponentTreasuryEffectiveDate = new int[] { - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2014, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2014, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2014, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2014, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2014, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2014, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - int[] aiFuturesComponentTreasuryMaturityDate = new int[] { - DateUtil.CreateFromYMD (2020, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2020, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2020, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2020, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2020, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2020, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2020, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2020, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2020, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - double[] adblFuturesComponentTreasuryCoupon = new double[] { - 0.01375, // 912828J5 - 0.01375, // 912828J8 - 0.01375, // 912828K5 - 0.01500, // 912828XE - 0.01625, // 912828XH - 0.01625, // 912828XM - 0.01375, // 912828L3 - 0.01375, // 912828L6 - 0.01375 // 912828L9 - }; - - double[] adblFuturesComponentConversionFactor = new double[] { - 0.8317, // 912828J5 - 0.8287, // 912828J8 - 0.8258, // 912828K5 - 0.8276, // 912828XE - 0.8297, // 912828XH - 0.8269, // 912828XM - 0.8141, // 912828L3 - 0.8113, // 912828L6 - 0.8084 // 912828L9 - }; - - int iSpotDate = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ).julian(); - - String[] astrFundingCurveDepositTenor = new String[] { - "2D", - "1W", - "1M", - "2M", - "3M" - }; - - double[] adblFundingCurveDepositQuote = new double[] { - 0.00195, // 2D - 0.00176, // 1W - 0.00301, // 1M - 0.00401, // 2M - 0.00492 // 3M - }; - - String strFundingCurveDepositMeasure = "ForwardRate"; - - double[] adblFundingCurveFuturesQuote = new double[] { - 0.00609, - 0.00687 - }; - - String strFundingCurveFuturesMeasure = "ForwardRate"; - - String[] astrFundingCurveFixFloatTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFundingCurveFixFloatQuote = new double[] { - 0.00762, // 1Y - 0.01055, // 2Y - 0.01300, // 3Y - 0.01495, // 4Y - 0.01651, // 5Y - 0.01787, // 6Y - 0.01904, // 7Y - 0.02005, // 8Y - 0.02090, // 9Y - 0.02166, // 10Y - 0.02231, // 11Y - 0.02289, // 12Y - 0.02414, // 15Y - 0.02570, // 20Y - 0.02594, // 25Y - 0.02627, // 30Y - 0.02648, // 40Y - 0.02632 // 50Y - }; - - String strFundingFixFloatMeasure = "SwapRate"; - - int[] aiGovvieCurveTreasuryEffectiveDate = new int[] { - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate - }; - - int[] aiGovvieCurveTreasuryMaturityDate = new int[] { - new JulianDate (iSpotDate).addTenor ("1Y").julian(), - new JulianDate (iSpotDate).addTenor ("2Y").julian(), - new JulianDate (iSpotDate).addTenor ("3Y").julian(), - new JulianDate (iSpotDate).addTenor ("5Y").julian(), - new JulianDate (iSpotDate).addTenor ("7Y").julian(), - new JulianDate (iSpotDate).addTenor ("10Y").julian(), - new JulianDate (iSpotDate).addTenor ("30Y").julian() - }; - - double[] adblGovvieCurveTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblGovvieCurveTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - String strGovvieCurveTreasuryMeasure = "Yield"; - - double[] adblFuturesComponentTreasuryPrice = new double[] { - 0.99909375, // 912828J5 - 0.99900000, // 912828J8 - 0.99890625, // 912828K5 - 0.99943750, // 912828XE - 0.99984375, // 912828XH - 0.99978125, // 912828XM - 0.99862500, // 912828L3 - 0.99850000, // 912828L6 - 0.99853125 // 912828L9 - }; - - Map mapTreasuryFutures = TreasuryFuturesAPI.ValuationMetrics ( - "UB1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - astrFundingCurveDepositTenor, - adblFundingCurveDepositQuote, - strFundingCurveDepositMeasure, - adblFundingCurveFuturesQuote, - strFundingCurveFuturesMeasure, - astrFundingCurveFixFloatTenor, - adblFundingCurveFixFloatQuote, - strFundingFixFloatMeasure, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice - ); - - for (Map.Entry me : mapTreasuryFutures.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/treasuryfuturesapi/ULTRA.java b/org/drip/sample/treasuryfuturesapi/ULTRA.java deleted file mode 100644 index 4025d9c..0000000 --- a/org/drip/sample/treasuryfuturesapi/ULTRA.java +++ /dev/null @@ -1,273 +0,0 @@ - -package org.drip.sample.treasuryfuturesapi; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ULTRA demonstrates the Invocation and Examination of the ULTRA 30Y UST Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class ULTRA { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int[] aiFuturesComponentTreasuryEffectiveDate = new int[] { - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2014, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2014, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2014, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2014, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2014, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2014, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - int[] aiFuturesComponentTreasuryMaturityDate = new int[] { - DateUtil.CreateFromYMD (2020, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2020, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2020, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2020, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2020, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2020, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2020, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2020, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2020, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - double[] adblFuturesComponentTreasuryCoupon = new double[] { - 0.01375, // 912828J5 - 0.01375, // 912828J8 - 0.01375, // 912828K5 - 0.01500, // 912828XE - 0.01625, // 912828XH - 0.01625, // 912828XM - 0.01375, // 912828L3 - 0.01375, // 912828L6 - 0.01375 // 912828L9 - }; - - double[] adblFuturesComponentConversionFactor = new double[] { - 0.8317, // 912828J5 - 0.8287, // 912828J8 - 0.8258, // 912828K5 - 0.8276, // 912828XE - 0.8297, // 912828XH - 0.8269, // 912828XM - 0.8141, // 912828L3 - 0.8113, // 912828L6 - 0.8084 // 912828L9 - }; - - int iSpotDate = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ).julian(); - - String[] astrFundingCurveDepositTenor = new String[] { - "2D", - "1W", - "1M", - "2M", - "3M" - }; - - double[] adblFundingCurveDepositQuote = new double[] { - 0.00195, // 2D - 0.00176, // 1W - 0.00301, // 1M - 0.00401, // 2M - 0.00492 // 3M - }; - - String strFundingCurveDepositMeasure = "ForwardRate"; - - double[] adblFundingCurveFuturesQuote = new double[] { - 0.00609, - 0.00687 - }; - - String strFundingCurveFuturesMeasure = "ForwardRate"; - - String[] astrFundingCurveFixFloatTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFundingCurveFixFloatQuote = new double[] { - 0.00762, // 1Y - 0.01055, // 2Y - 0.01300, // 3Y - 0.01495, // 4Y - 0.01651, // 5Y - 0.01787, // 6Y - 0.01904, // 7Y - 0.02005, // 8Y - 0.02090, // 9Y - 0.02166, // 10Y - 0.02231, // 11Y - 0.02289, // 12Y - 0.02414, // 15Y - 0.02570, // 20Y - 0.02594, // 25Y - 0.02627, // 30Y - 0.02648, // 40Y - 0.02632 // 50Y - }; - - String strFundingFixFloatMeasure = "SwapRate"; - - int[] aiGovvieCurveTreasuryEffectiveDate = new int[] { - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate - }; - - int[] aiGovvieCurveTreasuryMaturityDate = new int[] { - new JulianDate (iSpotDate).addTenor ("1Y").julian(), - new JulianDate (iSpotDate).addTenor ("2Y").julian(), - new JulianDate (iSpotDate).addTenor ("3Y").julian(), - new JulianDate (iSpotDate).addTenor ("5Y").julian(), - new JulianDate (iSpotDate).addTenor ("7Y").julian(), - new JulianDate (iSpotDate).addTenor ("10Y").julian(), - new JulianDate (iSpotDate).addTenor ("30Y").julian() - }; - - double[] adblGovvieCurveTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblGovvieCurveTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - String strGovvieCurveTreasuryMeasure = "Yield"; - - double[] adblFuturesComponentTreasuryPrice = new double[] { - 0.99909375, // 912828J5 - 0.99900000, // 912828J8 - 0.99890625, // 912828K5 - 0.99943750, // 912828XE - 0.99984375, // 912828XH - 0.99978125, // 912828XM - 0.99862500, // 912828L3 - 0.99850000, // 912828L6 - 0.99853125 // 912828L9 - }; - - Map mapTreasuryFutures = TreasuryFuturesAPI.ValuationMetrics ( - "ULTRA", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - astrFundingCurveDepositTenor, - adblFundingCurveDepositQuote, - strFundingCurveDepositMeasure, - adblFundingCurveFuturesQuote, - strFundingCurveFuturesMeasure, - astrFundingCurveFixFloatTenor, - adblFundingCurveFixFloatQuote, - strFundingFixFloatMeasure, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice - ); - - for (Map.Entry me : mapTreasuryFutures.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/treasuryfuturesapi/US1.java b/org/drip/sample/treasuryfuturesapi/US1.java deleted file mode 100644 index 9cb9b5b..0000000 --- a/org/drip/sample/treasuryfuturesapi/US1.java +++ /dev/null @@ -1,273 +0,0 @@ - -package org.drip.sample.treasuryfuturesapi; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * US1 demonstrates the Invocation and Examination of the US1 20Y UST Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class US1 { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int[] aiFuturesComponentTreasuryEffectiveDate = new int[] { - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2014, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2014, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2014, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2014, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2014, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2014, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - int[] aiFuturesComponentTreasuryMaturityDate = new int[] { - DateUtil.CreateFromYMD (2020, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2020, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2020, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2020, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2020, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2020, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2020, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2020, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2020, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - double[] adblFuturesComponentTreasuryCoupon = new double[] { - 0.01375, // 912828J5 - 0.01375, // 912828J8 - 0.01375, // 912828K5 - 0.01500, // 912828XE - 0.01625, // 912828XH - 0.01625, // 912828XM - 0.01375, // 912828L3 - 0.01375, // 912828L6 - 0.01375 // 912828L9 - }; - - double[] adblFuturesComponentConversionFactor = new double[] { - 0.8317, // 912828J5 - 0.8287, // 912828J8 - 0.8258, // 912828K5 - 0.8276, // 912828XE - 0.8297, // 912828XH - 0.8269, // 912828XM - 0.8141, // 912828L3 - 0.8113, // 912828L6 - 0.8084 // 912828L9 - }; - - int iSpotDate = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ).julian(); - - String[] astrFundingCurveDepositTenor = new String[] { - "2D", - "1W", - "1M", - "2M", - "3M" - }; - - double[] adblFundingCurveDepositQuote = new double[] { - 0.00195, // 2D - 0.00176, // 1W - 0.00301, // 1M - 0.00401, // 2M - 0.00492 // 3M - }; - - String strFundingCurveDepositMeasure = "ForwardRate"; - - double[] adblFundingCurveFuturesQuote = new double[] { - 0.00609, - 0.00687 - }; - - String strFundingCurveFuturesMeasure = "ForwardRate"; - - String[] astrFundingCurveFixFloatTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFundingCurveFixFloatQuote = new double[] { - 0.00762, // 1Y - 0.01055, // 2Y - 0.01300, // 3Y - 0.01495, // 4Y - 0.01651, // 5Y - 0.01787, // 6Y - 0.01904, // 7Y - 0.02005, // 8Y - 0.02090, // 9Y - 0.02166, // 10Y - 0.02231, // 11Y - 0.02289, // 12Y - 0.02414, // 15Y - 0.02570, // 20Y - 0.02594, // 25Y - 0.02627, // 30Y - 0.02648, // 40Y - 0.02632 // 50Y - }; - - String strFundingFixFloatMeasure = "SwapRate"; - - int[] aiGovvieCurveTreasuryEffectiveDate = new int[] { - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate - }; - - int[] aiGovvieCurveTreasuryMaturityDate = new int[] { - new JulianDate (iSpotDate).addTenor ("1Y").julian(), - new JulianDate (iSpotDate).addTenor ("2Y").julian(), - new JulianDate (iSpotDate).addTenor ("3Y").julian(), - new JulianDate (iSpotDate).addTenor ("5Y").julian(), - new JulianDate (iSpotDate).addTenor ("7Y").julian(), - new JulianDate (iSpotDate).addTenor ("10Y").julian(), - new JulianDate (iSpotDate).addTenor ("30Y").julian() - }; - - double[] adblGovvieCurveTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblGovvieCurveTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - String strGovvieCurveTreasuryMeasure = "Yield"; - - double[] adblFuturesComponentTreasuryPrice = new double[] { - 0.99909375, // 912828J5 - 0.99900000, // 912828J8 - 0.99890625, // 912828K5 - 0.99943750, // 912828XE - 0.99984375, // 912828XH - 0.99978125, // 912828XM - 0.99862500, // 912828L3 - 0.99850000, // 912828L6 - 0.99853125 // 912828L9 - }; - - Map mapTreasuryFutures = TreasuryFuturesAPI.ValuationMetrics ( - "US1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - astrFundingCurveDepositTenor, - adblFundingCurveDepositQuote, - strFundingCurveDepositMeasure, - adblFundingCurveFuturesQuote, - strFundingCurveFuturesMeasure, - astrFundingCurveFixFloatTenor, - adblFundingCurveFixFloatQuote, - strFundingFixFloatMeasure, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice - ); - - for (Map.Entry me : mapTreasuryFutures.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/treasuryfuturesapi/YM1.java b/org/drip/sample/treasuryfuturesapi/YM1.java deleted file mode 100644 index 0ee9f9a..0000000 --- a/org/drip/sample/treasuryfuturesapi/YM1.java +++ /dev/null @@ -1,291 +0,0 @@ - -package org.drip.sample.treasuryfuturesapi; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * YM1 demonstrates the Invocation and Examination of the YM1 3Y AGB Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class YM1 { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int[] aiFuturesComponentTreasuryEffectiveDate = new int[] { - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2014, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2014, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2014, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2014, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2014, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2014, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - int[] aiFuturesComponentTreasuryMaturityDate = new int[] { - DateUtil.CreateFromYMD (2020, DateUtil.FEBRUARY, 28).julian(), // 912828J5 - DateUtil.CreateFromYMD (2020, DateUtil.MARCH, 31).julian(), // 912828J8 - DateUtil.CreateFromYMD (2020, DateUtil.APRIL, 30).julian(), // 912828K5 - DateUtil.CreateFromYMD (2020, DateUtil.MAY, 31).julian(), // 912828XE - DateUtil.CreateFromYMD (2020, DateUtil.JUNE, 30).julian(), // 912828XH - DateUtil.CreateFromYMD (2020, DateUtil.JULY, 31).julian(), // 912828XM - DateUtil.CreateFromYMD (2020, DateUtil.AUGUST, 31).julian(), // 912828L3 - DateUtil.CreateFromYMD (2020, DateUtil.SEPTEMBER, 30).julian(), // 912828L6 - DateUtil.CreateFromYMD (2020, DateUtil.OCTOBER, 31).julian() // 912828L9 - }; - - double[] adblFuturesComponentTreasuryCoupon = new double[] { - 0.01375, // 912828J5 - 0.01375, // 912828J8 - 0.01375, // 912828K5 - 0.01500, // 912828XE - 0.01625, // 912828XH - 0.01625, // 912828XM - 0.01375, // 912828L3 - 0.01375, // 912828L6 - 0.01375 // 912828L9 - }; - - double[] adblFuturesComponentConversionFactor = new double[] { - 0.8317, // 912828J5 - 0.8287, // 912828J8 - 0.8258, // 912828K5 - 0.8276, // 912828XE - 0.8297, // 912828XH - 0.8269, // 912828XM - 0.8141, // 912828L3 - 0.8113, // 912828L6 - 0.8084 // 912828L9 - }; - - int iSpotDate = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ).julian(); - - String[] astrFundingCurveDepositTenor = new String[] { - "2D", - "1W", - "1M", - "2M", - "3M" - }; - - double[] adblFundingCurveDepositQuote = new double[] { - 0.00195, // 2D - 0.00176, // 1W - 0.00301, // 1M - 0.00401, // 2M - 0.00492 // 3M - }; - - String strFundingCurveDepositMeasure = "ForwardRate"; - - double[] adblFundingCurveFuturesQuote = new double[] { - 0.00609, - 0.00687 - }; - - String strFundingCurveFuturesMeasure = "ForwardRate"; - - String[] astrFundingCurveFixFloatTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFundingCurveFixFloatQuote = new double[] { - 0.00762, // 1Y - 0.01055, // 2Y - 0.01300, // 3Y - 0.01495, // 4Y - 0.01651, // 5Y - 0.01787, // 6Y - 0.01904, // 7Y - 0.02005, // 8Y - 0.02090, // 9Y - 0.02166, // 10Y - 0.02231, // 11Y - 0.02289, // 12Y - 0.02414, // 15Y - 0.02570, // 20Y - 0.02594, // 25Y - 0.02627, // 30Y - 0.02648, // 40Y - 0.02632 // 50Y - }; - - String strFundingFixFloatMeasure = "SwapRate"; - - int[] aiGovvieCurveTreasuryEffectiveDate = new int[] { - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate, - iSpotDate - }; - - int[] aiGovvieCurveTreasuryMaturityDate = new int[] { - new JulianDate (iSpotDate).addTenor ("1Y").julian(), - new JulianDate (iSpotDate).addTenor ("2Y").julian(), - new JulianDate (iSpotDate).addTenor ("3Y").julian(), - new JulianDate (iSpotDate).addTenor ("5Y").julian(), - new JulianDate (iSpotDate).addTenor ("7Y").julian(), - new JulianDate (iSpotDate).addTenor ("10Y").julian(), - new JulianDate (iSpotDate).addTenor ("30Y").julian() - }; - - double[] adblGovvieCurveTreasuryCoupon = new double[] { - 0.0100, - 0.0100, - 0.0125, - 0.0150, - 0.0200, - 0.0225, - 0.0300 - }; - - double[] adblGovvieCurveTreasuryYield = new double[] { - 0.00692, - 0.00945, - 0.01257, - 0.01678, - 0.02025, - 0.02235, - 0.02972 - }; - - String strGovvieCurveTreasuryMeasure = "Yield"; - - double[] adblFuturesComponentTreasuryPrice = new double[] { - 0.99909375, // 912828J5 - 0.99900000, // 912828J8 - 0.99890625, // 912828K5 - 0.99943750, // 912828XE - 0.99984375, // 912828XH - 0.99978125, // 912828XM - 0.99862500, // 912828L3 - 0.99850000, // 912828L6 - 0.99853125 // 912828L9 - }; - - Map mapTreasuryFutures = TreasuryFuturesAPI.ValuationMetrics ( - "YM1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - astrFundingCurveDepositTenor, - adblFundingCurveDepositQuote, - strFundingCurveDepositMeasure, - adblFundingCurveFuturesQuote, - strFundingCurveFuturesMeasure, - astrFundingCurveFixFloatTenor, - adblFundingCurveFixFloatQuote, - strFundingFixFloatMeasure, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice - ); - - for (Map.Entry me : mapTreasuryFutures.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - - Map mapKeyRateDuration = TreasuryFuturesAPI.KeyRateDuration ( - "YM1", - aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, - iSpotDate, - aiGovvieCurveTreasuryEffectiveDate, - aiGovvieCurveTreasuryMaturityDate, - adblGovvieCurveTreasuryCoupon, - adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - adblFuturesComponentTreasuryPrice - ); - - for (Map.Entry me : mapKeyRateDuration.entrySet()) - System.out.println ("\t" + me.getKey() + " => " + me.getValue()); - } -} diff --git a/org/drip/sample/treasuryfuturesfeed/CN1ClosesReconstitutor.java b/org/drip/sample/treasuryfuturesfeed/CN1ClosesReconstitutor.java deleted file mode 100644 index 2f554e1..0000000 --- a/org/drip/sample/treasuryfuturesfeed/CN1ClosesReconstitutor.java +++ /dev/null @@ -1,87 +0,0 @@ - -package org.drip.sample.treasuryfuturesfeed; - -import org.drip.feed.transformer.TreasuryFuturesClosesReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CN1ClosesReconstitutor Cleanses, Transforms, and Re-constitutes the Formated CN1 Closes Feed. - * - * @author Lakshmi Krishnamurthy - */ - -public class CN1ClosesReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iConversionFactorIndex = 1; - int iCleanPriceIndex = 14; - int iCTDCouponIndex = 12; - int iEffectiveDateIndex = 7; - int iMaturityDateIndex = 9; - int iExpiryProxyIndex = 13; - String strFeedLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryFutures\\CN1_ClosesFormatted.csv"; - - TreasuryFuturesClosesReconstitutor.RegularizeCloses ( - strFeedLocation, - iSpotDateIndex, - iConversionFactorIndex, - iCleanPriceIndex, - iCTDCouponIndex, - iEffectiveDateIndex, - iMaturityDateIndex, - iExpiryProxyIndex - ); - } -} diff --git a/org/drip/sample/treasuryfuturesfeed/DU1ClosesReconstitutor.java b/org/drip/sample/treasuryfuturesfeed/DU1ClosesReconstitutor.java deleted file mode 100644 index 8c0c98b..0000000 --- a/org/drip/sample/treasuryfuturesfeed/DU1ClosesReconstitutor.java +++ /dev/null @@ -1,87 +0,0 @@ - -package org.drip.sample.treasuryfuturesfeed; - -import org.drip.feed.transformer.TreasuryFuturesClosesReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DU1ClosesReconstitutor Cleanses, Transforms, and Re-constitutes the Formated DU1 Closes Feed. - * - * @author Lakshmi Krishnamurthy - */ - -public class DU1ClosesReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iConversionFactorIndex = 1; - int iCleanPriceIndex = 14; - int iCTDCouponIndex = 7; - int iEffectiveDateIndex = 12; - int iMaturityDateIndex = 8; - int iExpiryProxyIndex = 13; - String strFeedLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryFutures\\DU1_ClosesFormatted.csv"; - - TreasuryFuturesClosesReconstitutor.RegularizeCloses ( - strFeedLocation, - iSpotDateIndex, - iConversionFactorIndex, - iCleanPriceIndex, - iCTDCouponIndex, - iEffectiveDateIndex, - iMaturityDateIndex, - iExpiryProxyIndex - ); - } -} diff --git a/org/drip/sample/treasuryfuturesfeed/FBB1ClosesReconstitutor.java b/org/drip/sample/treasuryfuturesfeed/FBB1ClosesReconstitutor.java deleted file mode 100644 index 7040633..0000000 --- a/org/drip/sample/treasuryfuturesfeed/FBB1ClosesReconstitutor.java +++ /dev/null @@ -1,87 +0,0 @@ - -package org.drip.sample.treasuryfuturesfeed; - -import org.drip.feed.transformer.TreasuryFuturesClosesReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FBB1ClosesReconstitutor Cleanses, Transforms, and Re-constitutes the Formated FBB1 Closes Feed. - * - * @author Lakshmi Krishnamurthy - */ - -public class FBB1ClosesReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iConversionFactorIndex = 1; - int iCleanPriceIndex = 14; - int iCTDCouponIndex = 7; - int iEffectiveDateIndex = 11; - int iMaturityDateIndex = 12; - int iExpiryProxyIndex = 13; - String strFeedLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryFutures\\FBB1_ClosesFormatted.csv"; - - TreasuryFuturesClosesReconstitutor.RegularizeCloses ( - strFeedLocation, - iSpotDateIndex, - iConversionFactorIndex, - iCleanPriceIndex, - iCTDCouponIndex, - iEffectiveDateIndex, - iMaturityDateIndex, - iExpiryProxyIndex - ); - } -} diff --git a/org/drip/sample/treasuryfuturesfeed/FV1ClosesReconstitutor.java b/org/drip/sample/treasuryfuturesfeed/FV1ClosesReconstitutor.java deleted file mode 100644 index e513056..0000000 --- a/org/drip/sample/treasuryfuturesfeed/FV1ClosesReconstitutor.java +++ /dev/null @@ -1,71 +0,0 @@ - -package org.drip.sample.treasuryfuturesfeed; - -import org.drip.feed.transformer.TreasuryFuturesClosesReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FV1ClosesReconstitutor Cleanses, Transforms, and Re-constitutes the Formated FV1 Closes Feed. - * - * @author Lakshmi Krishnamurthy - */ - -public class FV1ClosesReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strFeedLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryFutures\\FV1_ClosesFormatted.csv"; - - TreasuryFuturesClosesReconstitutor.USTRegularizeCloses (strFeedLocation); - } -} diff --git a/org/drip/sample/treasuryfuturesfeed/IK1ClosesReconstitutor.java b/org/drip/sample/treasuryfuturesfeed/IK1ClosesReconstitutor.java deleted file mode 100644 index cc81d2f..0000000 --- a/org/drip/sample/treasuryfuturesfeed/IK1ClosesReconstitutor.java +++ /dev/null @@ -1,87 +0,0 @@ - -package org.drip.sample.treasuryfuturesfeed; - -import org.drip.feed.transformer.TreasuryFuturesClosesReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * IK1ClosesReconstitutor Cleanses, Transforms, and Re-constitutes the Formated IK1 Closes Feed. - * - * @author Lakshmi Krishnamurthy - */ - -public class IK1ClosesReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iConversionFactorIndex = 1; - int iCleanPriceIndex = 4; - int iCTDCouponIndex = 12; - int iEffectiveDateIndex = 11; - int iMaturityDateIndex = 8; - int iExpiryProxyIndex = 13; - String strFeedLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryFutures\\IK1_ClosesFormatted.csv"; - - TreasuryFuturesClosesReconstitutor.RegularizeCloses ( - strFeedLocation, - iSpotDateIndex, - iConversionFactorIndex, - iCleanPriceIndex, - iCTDCouponIndex, - iEffectiveDateIndex, - iMaturityDateIndex, - iExpiryProxyIndex - ); - } -} diff --git a/org/drip/sample/treasuryfuturesfeed/JB1ClosesReconstitutor.java b/org/drip/sample/treasuryfuturesfeed/JB1ClosesReconstitutor.java deleted file mode 100644 index 4349201..0000000 --- a/org/drip/sample/treasuryfuturesfeed/JB1ClosesReconstitutor.java +++ /dev/null @@ -1,87 +0,0 @@ - -package org.drip.sample.treasuryfuturesfeed; - -import org.drip.feed.transformer.TreasuryFuturesClosesReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * JB1ClosesReconstitutor Cleanses, Transforms, and Re-constitutes the Formated JB1 Closes Feed. - * - * @author Lakshmi Krishnamurthy - */ - -public class JB1ClosesReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iConversionFactorIndex = 1; - int iCleanPriceIndex = 14; - int iCTDCouponIndex = 7; - int iEffectiveDateIndex = 12; - int iMaturityDateIndex = 8; - int iExpiryProxyIndex = 13; - String strFeedLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryFutures\\JB1_ClosesFormatted.csv"; - - TreasuryFuturesClosesReconstitutor.RegularizeCloses ( - strFeedLocation, - iSpotDateIndex, - iConversionFactorIndex, - iCleanPriceIndex, - iCTDCouponIndex, - iEffectiveDateIndex, - iMaturityDateIndex, - iExpiryProxyIndex - ); - } -} diff --git a/org/drip/sample/treasuryfuturesfeed/OAT1ClosesReconstitutor.java b/org/drip/sample/treasuryfuturesfeed/OAT1ClosesReconstitutor.java deleted file mode 100644 index 648918b..0000000 --- a/org/drip/sample/treasuryfuturesfeed/OAT1ClosesReconstitutor.java +++ /dev/null @@ -1,87 +0,0 @@ - -package org.drip.sample.treasuryfuturesfeed; - -import org.drip.feed.transformer.TreasuryFuturesClosesReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OAT1ClosesReconstitutor Cleanses, Transforms, and Re-constitutes the Formated OAT1 Closes Feed. - * - * @author Lakshmi Krishnamurthy - */ - -public class OAT1ClosesReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iConversionFactorIndex = 1; - int iCleanPriceIndex = 14; - int iCTDCouponIndex = 12; - int iEffectiveDateIndex = 11; - int iMaturityDateIndex = 9; - int iExpiryProxyIndex = 13; - String strFeedLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryFutures\\OAT1_ClosesFormatted.csv"; - - TreasuryFuturesClosesReconstitutor.RegularizeCloses ( - strFeedLocation, - iSpotDateIndex, - iConversionFactorIndex, - iCleanPriceIndex, - iCTDCouponIndex, - iEffectiveDateIndex, - iMaturityDateIndex, - iExpiryProxyIndex - ); - } -} diff --git a/org/drip/sample/treasuryfuturesfeed/OE1ClosesReconstitutor.java b/org/drip/sample/treasuryfuturesfeed/OE1ClosesReconstitutor.java deleted file mode 100644 index 0964106..0000000 --- a/org/drip/sample/treasuryfuturesfeed/OE1ClosesReconstitutor.java +++ /dev/null @@ -1,87 +0,0 @@ - -package org.drip.sample.treasuryfuturesfeed; - -import org.drip.feed.transformer.TreasuryFuturesClosesReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OE1ClosesReconstitutor Cleanses, Transforms, and Re-constitutes the Formated OE1 Closes Feed. - * - * @author Lakshmi Krishnamurthy - */ - -public class OE1ClosesReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iConversionFactorIndex = 1; - int iCleanPriceIndex = 14; - int iCTDCouponIndex = 7; - int iEffectiveDateIndex = 9; - int iMaturityDateIndex = 8; - int iExpiryProxyIndex = 13; - String strFeedLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryFutures\\OE1_ClosesFormatted.csv"; - - TreasuryFuturesClosesReconstitutor.RegularizeCloses ( - strFeedLocation, - iSpotDateIndex, - iConversionFactorIndex, - iCleanPriceIndex, - iCTDCouponIndex, - iEffectiveDateIndex, - iMaturityDateIndex, - iExpiryProxyIndex - ); - } -} diff --git a/org/drip/sample/treasuryfuturesfeed/RX1ClosesReconstitutor.java b/org/drip/sample/treasuryfuturesfeed/RX1ClosesReconstitutor.java deleted file mode 100644 index 113d06e..0000000 --- a/org/drip/sample/treasuryfuturesfeed/RX1ClosesReconstitutor.java +++ /dev/null @@ -1,87 +0,0 @@ - -package org.drip.sample.treasuryfuturesfeed; - -import org.drip.feed.transformer.TreasuryFuturesClosesReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * RX1ClosesReconstitutor Cleanses, Transforms, and Re-constitutes the Formated RX1 Closes Feed. - * - * @author Lakshmi Krishnamurthy - */ - -public class RX1ClosesReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iConversionFactorIndex = 1; - int iCleanPriceIndex = 14; - int iCTDCouponIndex = 7; - int iEffectiveDateIndex = 9; - int iMaturityDateIndex = 8; - int iExpiryProxyIndex = 13; - String strFeedLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryFutures\\RX1_ClosesFormatted.csv"; - - TreasuryFuturesClosesReconstitutor.RegularizeCloses ( - strFeedLocation, - iSpotDateIndex, - iConversionFactorIndex, - iCleanPriceIndex, - iCTDCouponIndex, - iEffectiveDateIndex, - iMaturityDateIndex, - iExpiryProxyIndex - ); - } -} diff --git a/org/drip/sample/treasuryfuturesfeed/TU1ClosesReconstitutor.java b/org/drip/sample/treasuryfuturesfeed/TU1ClosesReconstitutor.java deleted file mode 100644 index 3221082..0000000 --- a/org/drip/sample/treasuryfuturesfeed/TU1ClosesReconstitutor.java +++ /dev/null @@ -1,71 +0,0 @@ - -package org.drip.sample.treasuryfuturesfeed; - -import org.drip.feed.transformer.TreasuryFuturesClosesReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TU1ClosesReconstitutor Cleanses, Transforms, and Re-constitutes the Formated TU1 Closes Feed. - * - * @author Lakshmi Krishnamurthy - */ - -public class TU1ClosesReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strFeedLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryFutures\\TU1_ClosesFormatted.csv"; - - TreasuryFuturesClosesReconstitutor.USTRegularizeCloses (strFeedLocation); - } -} diff --git a/org/drip/sample/treasuryfuturesfeed/TY1ClosesReconstitutor.java b/org/drip/sample/treasuryfuturesfeed/TY1ClosesReconstitutor.java deleted file mode 100644 index 9aa6039..0000000 --- a/org/drip/sample/treasuryfuturesfeed/TY1ClosesReconstitutor.java +++ /dev/null @@ -1,71 +0,0 @@ - -package org.drip.sample.treasuryfuturesfeed; - -import org.drip.feed.transformer.TreasuryFuturesClosesReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TY1ClosesReconstitutor Cleanses, Transforms, and Re-constitutes the Formated TY1 Closes Feed. - * - * @author Lakshmi Krishnamurthy - */ - -public class TY1ClosesReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strFeedLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryFutures\\TY1_ClosesFormatted.csv"; - - TreasuryFuturesClosesReconstitutor.USTRegularizeCloses (strFeedLocation); - } -} diff --git a/org/drip/sample/treasuryfuturesfeed/UB1ClosesReconstitutor.java b/org/drip/sample/treasuryfuturesfeed/UB1ClosesReconstitutor.java deleted file mode 100644 index 42d65d7..0000000 --- a/org/drip/sample/treasuryfuturesfeed/UB1ClosesReconstitutor.java +++ /dev/null @@ -1,87 +0,0 @@ - -package org.drip.sample.treasuryfuturesfeed; - -import org.drip.feed.transformer.TreasuryFuturesClosesReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * UB1ClosesReconstitutor Cleanses, Transforms, and Re-constitutes the Formated UB1 Closes Feed. - * - * @author Lakshmi Krishnamurthy - */ - -public class UB1ClosesReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - int iSpotDateIndex = 0; - int iConversionFactorIndex = 1; - int iCleanPriceIndex = 14; - int iCTDCouponIndex = 7; - int iEffectiveDateIndex = 9; - int iMaturityDateIndex = 8; - int iExpiryProxyIndex = 13; - String strFeedLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryFutures\\UB1_ClosesFormatted.csv"; - - TreasuryFuturesClosesReconstitutor.RegularizeCloses ( - strFeedLocation, - iSpotDateIndex, - iConversionFactorIndex, - iCleanPriceIndex, - iCTDCouponIndex, - iEffectiveDateIndex, - iMaturityDateIndex, - iExpiryProxyIndex - ); - } -} diff --git a/org/drip/sample/treasuryfuturesfeed/US1ClosesReconstitutor.java b/org/drip/sample/treasuryfuturesfeed/US1ClosesReconstitutor.java deleted file mode 100644 index d03f28a..0000000 --- a/org/drip/sample/treasuryfuturesfeed/US1ClosesReconstitutor.java +++ /dev/null @@ -1,71 +0,0 @@ - -package org.drip.sample.treasuryfuturesfeed; - -import org.drip.feed.transformer.TreasuryFuturesClosesReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * US1ClosesReconstitutor Cleanses, Transforms, and Re-constitutes the Formated US1 Closes Feed. - * - * @author Lakshmi Krishnamurthy - */ - -public class US1ClosesReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strFeedLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryFutures\\US1_ClosesFormatted.csv"; - - TreasuryFuturesClosesReconstitutor.USTRegularizeCloses (strFeedLocation); - } -} diff --git a/org/drip/sample/treasuryfuturesfeed/WN1ClosesReconstitutor.java b/org/drip/sample/treasuryfuturesfeed/WN1ClosesReconstitutor.java deleted file mode 100644 index 26d7c29..0000000 --- a/org/drip/sample/treasuryfuturesfeed/WN1ClosesReconstitutor.java +++ /dev/null @@ -1,71 +0,0 @@ - -package org.drip.sample.treasuryfuturesfeed; - -import org.drip.feed.transformer.TreasuryFuturesClosesReconstitutor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * WN1ClosesReconstitutor Cleanses, Transforms, and Re-constitutes the Formated WN1 Closes Feed. - * - * @author Lakshmi Krishnamurthy - */ - -public class WN1ClosesReconstitutor { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strFeedLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TreasuryFutures\\WN1_ClosesFormatted.csv"; - - TreasuryFuturesClosesReconstitutor.USTRegularizeCloses (strFeedLocation); - } -} diff --git a/org/drip/sample/treasuryfuturespnl/CN1Attribution.java b/org/drip/sample/treasuryfuturespnl/CN1Attribution.java deleted file mode 100644 index f8d8899..0000000 --- a/org/drip/sample/treasuryfuturespnl/CN1Attribution.java +++ /dev/null @@ -1,127 +0,0 @@ - -package org.drip.sample.treasuryfuturespnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CN1Attribution demonstrates the Invocation of the Historical PnL Horizon PnL Attribution analysis for the - * CN1 Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class CN1Attribution { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\CN1ClosesReconstitutor.csv"; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblConversionFactor = csvGrid.doubleArrayAtColumn (1); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - List lsPCC = TreasuryFuturesAPI.HorizonChangeAttribution ( - "CAN", - adtEffective, - adtMaturity, - adblCoupon, - adtExpiry, - adtSpot, - adblCleanPrice, - adblConversionFactor - ); - - System.out.println ("FirstDate, SecondDate, ExpiryDate, CTD Bond, Expiry Clean Price, Conversion Factor, 1D Gross PnL, 1D Market PnL, 1D Roll-down PnL, 1D Accrual PnL, 1D Explained PnL, 1D Unexplianed PnL"); - - for (PositionChangeComponents pcc : lsPCC) { - TreasuryFuturesMarketSnap tfpms = (TreasuryFuturesMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - tfpms.expiryDate() + ", " + - tfpms.ctdName() + ", " + - FormatUtil.FormatDouble (tfpms.expiryCleanPrice(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (tfpms.conversionFactor(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 2, 2, 10000.) - ); - } - } -} diff --git a/org/drip/sample/treasuryfuturespnl/DU1Attribution.java b/org/drip/sample/treasuryfuturespnl/DU1Attribution.java deleted file mode 100644 index 46c4b06..0000000 --- a/org/drip/sample/treasuryfuturespnl/DU1Attribution.java +++ /dev/null @@ -1,127 +0,0 @@ - -package org.drip.sample.treasuryfuturespnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DU1Attribution demonstrates the Invocation of the Historical PnL Horizon PnL Attribution analysis for the - * DU1 Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class DU1Attribution { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\DU1ClosesReconstitutor.csv"; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblConversionFactor = csvGrid.doubleArrayAtColumn (1); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - List lsPCC = TreasuryFuturesAPI.HorizonChangeAttribution ( - "DBR", - adtEffective, - adtMaturity, - adblCoupon, - adtExpiry, - adtSpot, - adblCleanPrice, - adblConversionFactor - ); - - System.out.println ("FirstDate, SecondDate, ExpiryDate, CTD Bond, Expiry Clean Price, Conversion Factor, 1D Gross PnL, 1D Market PnL, 1D Roll-down PnL, 1D Accrual PnL, 1D Explained PnL, 1D Unexplianed PnL"); - - for (PositionChangeComponents pcc : lsPCC) { - TreasuryFuturesMarketSnap tfpms = (TreasuryFuturesMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - tfpms.expiryDate() + ", " + - tfpms.ctdName() + ", " + - FormatUtil.FormatDouble (tfpms.expiryCleanPrice(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (tfpms.conversionFactor(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 2, 2, 10000.) - ); - } - } -} diff --git a/org/drip/sample/treasuryfuturespnl/FBB1Attribution.java b/org/drip/sample/treasuryfuturespnl/FBB1Attribution.java deleted file mode 100644 index b6fea23..0000000 --- a/org/drip/sample/treasuryfuturespnl/FBB1Attribution.java +++ /dev/null @@ -1,127 +0,0 @@ - -package org.drip.sample.treasuryfuturespnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FBB1Attribution demonstrates the Invocation of the Historical PnL Horizon PnL Attribution analysis for the - * FBB1 Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class FBB1Attribution { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\FBB1ClosesReconstitutor.csv"; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblConversionFactor = csvGrid.doubleArrayAtColumn (1); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - List lsPCC = TreasuryFuturesAPI.HorizonChangeAttribution ( - "SPGB", - adtEffective, - adtMaturity, - adblCoupon, - adtExpiry, - adtSpot, - adblCleanPrice, - adblConversionFactor - ); - - System.out.println ("FirstDate, SecondDate, ExpiryDate, CTD Bond, Expiry Clean Price, Conversion Factor, 1D Gross PnL, 1D Market PnL, 1D Roll-down PnL, 1D Accrual PnL, 1D Explained PnL, 1D Unexplianed PnL"); - - for (PositionChangeComponents pcc : lsPCC) { - TreasuryFuturesMarketSnap tfpms = (TreasuryFuturesMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - tfpms.expiryDate() + ", " + - tfpms.ctdName() + ", " + - FormatUtil.FormatDouble (tfpms.expiryCleanPrice(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (tfpms.conversionFactor(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 2, 2, 10000.) - ); - } - } -} diff --git a/org/drip/sample/treasuryfuturespnl/FV1Attribution.java b/org/drip/sample/treasuryfuturespnl/FV1Attribution.java deleted file mode 100644 index d8b936a..0000000 --- a/org/drip/sample/treasuryfuturespnl/FV1Attribution.java +++ /dev/null @@ -1,127 +0,0 @@ - -package org.drip.sample.treasuryfuturespnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FV1Attribution demonstrates the Invocation of the Historical PnL Horizon PnL Attribution analysis for the - * FV1 Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class FV1Attribution { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\FV1ClosesReconstitutor.csv"; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblConversionFactor = csvGrid.doubleArrayAtColumn (1); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - List lsPCC = TreasuryFuturesAPI.HorizonChangeAttribution ( - "UST", - adtEffective, - adtMaturity, - adblCoupon, - adtExpiry, - adtSpot, - adblCleanPrice, - adblConversionFactor - ); - - System.out.println ("FirstDate, SecondDate, ExpiryDate, CTD Bond, Expiry Clean Price, Conversion Factor, 1D Gross PnL, 1D Market PnL, 1D Roll-down PnL, 1D Accrual PnL, 1D Explained PnL, 1D Unexplianed PnL"); - - for (PositionChangeComponents pcc : lsPCC) { - TreasuryFuturesMarketSnap tfpms = (TreasuryFuturesMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - tfpms.expiryDate() + ", " + - tfpms.ctdName() + ", " + - FormatUtil.FormatDouble (tfpms.expiryCleanPrice(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (tfpms.conversionFactor(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 2, 2, 10000.) - ); - } - } -} diff --git a/org/drip/sample/treasuryfuturespnl/IK1Attribution.java b/org/drip/sample/treasuryfuturespnl/IK1Attribution.java deleted file mode 100644 index 2234ab6..0000000 --- a/org/drip/sample/treasuryfuturespnl/IK1Attribution.java +++ /dev/null @@ -1,127 +0,0 @@ - -package org.drip.sample.treasuryfuturespnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * IK1Attribution demonstrates the Invocation of the Historical PnL Horizon PnL Attribution analysis for the - * IK1 Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class IK1Attribution { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\IK1ClosesReconstitutor.csv"; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblConversionFactor = csvGrid.doubleArrayAtColumn (1); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - List lsPCC = TreasuryFuturesAPI.HorizonChangeAttribution ( - "BTPS", - adtEffective, - adtMaturity, - adblCoupon, - adtExpiry, - adtSpot, - adblCleanPrice, - adblConversionFactor - ); - - System.out.println ("FirstDate, SecondDate, ExpiryDate, CTD Bond, Expiry Clean Price, Conversion Factor, 1D Gross PnL, 1D Market PnL, 1D Roll-down PnL, 1D Accrual PnL, 1D Explained PnL, 1D Unexplianed PnL"); - - for (PositionChangeComponents pcc : lsPCC) { - TreasuryFuturesMarketSnap tfpms = (TreasuryFuturesMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - tfpms.expiryDate() + ", " + - tfpms.ctdName() + ", " + - FormatUtil.FormatDouble (tfpms.expiryCleanPrice(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (tfpms.conversionFactor(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 2, 2, 10000.) - ); - } - } -} diff --git a/org/drip/sample/treasuryfuturespnl/JB1Attribution.java b/org/drip/sample/treasuryfuturespnl/JB1Attribution.java deleted file mode 100644 index 884b7fd..0000000 --- a/org/drip/sample/treasuryfuturespnl/JB1Attribution.java +++ /dev/null @@ -1,127 +0,0 @@ - -package org.drip.sample.treasuryfuturespnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * JB1Attribution demonstrates the Invocation of the Historical PnL Horizon PnL Attribution analysis for the - * JB1 Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class JB1Attribution { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\JB1ClosesReconstitutor.csv"; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblConversionFactor = csvGrid.doubleArrayAtColumn (1); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - List lsPCC = TreasuryFuturesAPI.HorizonChangeAttribution ( - "JGB", - adtEffective, - adtMaturity, - adblCoupon, - adtExpiry, - adtSpot, - adblCleanPrice, - adblConversionFactor - ); - - System.out.println ("FirstDate, SecondDate, ExpiryDate, CTD Bond, Expiry Clean Price, Conversion Factor, 1D Gross PnL, 1D Market PnL, 1D Roll-down PnL, 1D Accrual PnL, 1D Explained PnL, 1D Unexplianed PnL"); - - for (PositionChangeComponents pcc : lsPCC) { - TreasuryFuturesMarketSnap tfpms = (TreasuryFuturesMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - tfpms.expiryDate() + ", " + - tfpms.ctdName() + ", " + - FormatUtil.FormatDouble (tfpms.expiryCleanPrice(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (tfpms.conversionFactor(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 2, 2, 10000.) - ); - } - } -} diff --git a/org/drip/sample/treasuryfuturespnl/OAT1Attribution.java b/org/drip/sample/treasuryfuturespnl/OAT1Attribution.java deleted file mode 100644 index fef4fbe..0000000 --- a/org/drip/sample/treasuryfuturespnl/OAT1Attribution.java +++ /dev/null @@ -1,127 +0,0 @@ - -package org.drip.sample.treasuryfuturespnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OAT1Attribution demonstrates the Invocation of the Historical PnL Horizon PnL Attribution analysis for the - * OAT1 Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class OAT1Attribution { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\OAT1ClosesReconstitutor.csv"; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblConversionFactor = csvGrid.doubleArrayAtColumn (1); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - List lsPCC = TreasuryFuturesAPI.HorizonChangeAttribution ( - "FRTR", - adtEffective, - adtMaturity, - adblCoupon, - adtExpiry, - adtSpot, - adblCleanPrice, - adblConversionFactor - ); - - System.out.println ("FirstDate, SecondDate, ExpiryDate, CTD Bond, Expiry Clean Price, Conversion Factor, 1D Gross PnL, 1D Market PnL, 1D Roll-down PnL, 1D Accrual PnL, 1D Explained PnL, 1D Unexplianed PnL"); - - for (PositionChangeComponents pcc : lsPCC) { - TreasuryFuturesMarketSnap tfpms = (TreasuryFuturesMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - tfpms.expiryDate() + ", " + - tfpms.ctdName() + ", " + - FormatUtil.FormatDouble (tfpms.expiryCleanPrice(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (tfpms.conversionFactor(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 2, 2, 10000.) - ); - } - } -} diff --git a/org/drip/sample/treasuryfuturespnl/OE1Attribution.java b/org/drip/sample/treasuryfuturespnl/OE1Attribution.java deleted file mode 100644 index 57b6bf5..0000000 --- a/org/drip/sample/treasuryfuturespnl/OE1Attribution.java +++ /dev/null @@ -1,127 +0,0 @@ - -package org.drip.sample.treasuryfuturespnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OE1Attribution demonstrates the Invocation of the Historical PnL Horizon PnL Attribution analysis for the - * OE1 Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class OE1Attribution { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\OE1ClosesReconstitutor.csv"; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblConversionFactor = csvGrid.doubleArrayAtColumn (1); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - List lsPCC = TreasuryFuturesAPI.HorizonChangeAttribution ( - "DBR", - adtEffective, - adtMaturity, - adblCoupon, - adtExpiry, - adtSpot, - adblCleanPrice, - adblConversionFactor - ); - - System.out.println ("FirstDate, SecondDate, ExpiryDate, CTD Bond, Expiry Clean Price, Conversion Factor, 1D Gross PnL, 1D Market PnL, 1D Roll-down PnL, 1D Accrual PnL, 1D Explained PnL, 1D Unexplianed PnL"); - - for (PositionChangeComponents pcc : lsPCC) { - TreasuryFuturesMarketSnap tfpms = (TreasuryFuturesMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - tfpms.expiryDate() + ", " + - tfpms.ctdName() + ", " + - FormatUtil.FormatDouble (tfpms.expiryCleanPrice(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (tfpms.conversionFactor(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 2, 2, 10000.) - ); - } - } -} diff --git a/org/drip/sample/treasuryfuturespnl/RX1Attribution.java b/org/drip/sample/treasuryfuturespnl/RX1Attribution.java deleted file mode 100644 index 56c408e..0000000 --- a/org/drip/sample/treasuryfuturespnl/RX1Attribution.java +++ /dev/null @@ -1,127 +0,0 @@ - -package org.drip.sample.treasuryfuturespnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * RX1Attribution demonstrates the Invocation of the Historical PnL Horizon PnL Attribution analysis for the - * RX1 Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class RX1Attribution { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\RX1ClosesReconstitutor.csv"; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblConversionFactor = csvGrid.doubleArrayAtColumn (1); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - List lsPCC = TreasuryFuturesAPI.HorizonChangeAttribution ( - "DBR", - adtEffective, - adtMaturity, - adblCoupon, - adtExpiry, - adtSpot, - adblCleanPrice, - adblConversionFactor - ); - - System.out.println ("FirstDate, SecondDate, ExpiryDate, CTD Bond, Expiry Clean Price, Conversion Factor, 1D Gross PnL, 1D Market PnL, 1D Roll-down PnL, 1D Accrual PnL, 1D Explained PnL, 1D Unexplianed PnL"); - - for (PositionChangeComponents pcc : lsPCC) { - TreasuryFuturesMarketSnap tfpms = (TreasuryFuturesMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - tfpms.expiryDate() + ", " + - tfpms.ctdName() + ", " + - FormatUtil.FormatDouble (tfpms.expiryCleanPrice(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (tfpms.conversionFactor(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 2, 2, 10000.) - ); - } - } -} diff --git a/org/drip/sample/treasuryfuturespnl/TU1Attribution.java b/org/drip/sample/treasuryfuturespnl/TU1Attribution.java deleted file mode 100644 index 7c14170..0000000 --- a/org/drip/sample/treasuryfuturespnl/TU1Attribution.java +++ /dev/null @@ -1,127 +0,0 @@ - -package org.drip.sample.treasuryfuturespnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TU1Attribution demonstrates the Invocation of the Historical PnL Horizon PnL Attribution analysis for the - * TU1 Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class TU1Attribution { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\TU1ClosesReconstitutor.csv"; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblConversionFactor = csvGrid.doubleArrayAtColumn (1); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - List lsPCC = TreasuryFuturesAPI.HorizonChangeAttribution ( - "UST", - adtEffective, - adtMaturity, - adblCoupon, - adtExpiry, - adtSpot, - adblCleanPrice, - adblConversionFactor - ); - - System.out.println ("FirstDate, SecondDate, ExpiryDate, CTD Bond, Expiry Clean Price, Conversion Factor, 1D Gross PnL, 1D Market PnL, 1D Roll-down PnL, 1D Accrual PnL, 1D Explained PnL, 1D Unexplianed PnL"); - - for (PositionChangeComponents pcc : lsPCC) { - TreasuryFuturesMarketSnap tfpms = (TreasuryFuturesMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - tfpms.expiryDate() + ", " + - tfpms.ctdName() + ", " + - FormatUtil.FormatDouble (tfpms.expiryCleanPrice(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (tfpms.conversionFactor(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 2, 2, 10000.) - ); - } - } -} diff --git a/org/drip/sample/treasuryfuturespnl/TY1Attribution.java b/org/drip/sample/treasuryfuturespnl/TY1Attribution.java deleted file mode 100644 index 0214400..0000000 --- a/org/drip/sample/treasuryfuturespnl/TY1Attribution.java +++ /dev/null @@ -1,127 +0,0 @@ - -package org.drip.sample.treasuryfuturespnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TY1Attribution demonstrates the Invocation of the Historical PnL Horizon PnL Attribution analysis for the - * TY1 Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class TY1Attribution { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\TY1ClosesReconstitutor.csv"; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblConversionFactor = csvGrid.doubleArrayAtColumn (1); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - List lsPCC = TreasuryFuturesAPI.HorizonChangeAttribution ( - "UST", - adtEffective, - adtMaturity, - adblCoupon, - adtExpiry, - adtSpot, - adblCleanPrice, - adblConversionFactor - ); - - System.out.println ("FirstDate, SecondDate, ExpiryDate, CTD Bond, Expiry Clean Price, Conversion Factor, 1D Gross PnL, 1D Market PnL, 1D Roll-down PnL, 1D Accrual PnL, 1D Explained PnL, 1D Unexplianed PnL"); - - for (PositionChangeComponents pcc : lsPCC) { - TreasuryFuturesMarketSnap tfpms = (TreasuryFuturesMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - tfpms.expiryDate() + ", " + - tfpms.ctdName() + ", " + - FormatUtil.FormatDouble (tfpms.expiryCleanPrice(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (tfpms.conversionFactor(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 2, 2, 10000.) - ); - } - } -} diff --git a/org/drip/sample/treasuryfuturespnl/UB1Attribution.java b/org/drip/sample/treasuryfuturespnl/UB1Attribution.java deleted file mode 100644 index 87215ff..0000000 --- a/org/drip/sample/treasuryfuturespnl/UB1Attribution.java +++ /dev/null @@ -1,127 +0,0 @@ - -package org.drip.sample.treasuryfuturespnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * UB1Attribution demonstrates the Invocation of the Historical PnL Horizon PnL Attribution analysis for the - * UB1 Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class UB1Attribution { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\UB1ClosesReconstitutor.csv"; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblConversionFactor = csvGrid.doubleArrayAtColumn (1); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - List lsPCC = TreasuryFuturesAPI.HorizonChangeAttribution ( - "DBR", - adtEffective, - adtMaturity, - adblCoupon, - adtExpiry, - adtSpot, - adblCleanPrice, - adblConversionFactor - ); - - System.out.println ("FirstDate, SecondDate, ExpiryDate, CTD Bond, Expiry Clean Price, Conversion Factor, 1D Gross PnL, 1D Market PnL, 1D Roll-down PnL, 1D Accrual PnL, 1D Explained PnL, 1D Unexplianed PnL"); - - for (PositionChangeComponents pcc : lsPCC) { - TreasuryFuturesMarketSnap tfpms = (TreasuryFuturesMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - tfpms.expiryDate() + ", " + - tfpms.ctdName() + ", " + - FormatUtil.FormatDouble (tfpms.expiryCleanPrice(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (tfpms.conversionFactor(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 2, 2, 10000.) - ); - } - } -} diff --git a/org/drip/sample/treasuryfuturespnl/US1Attribution.java b/org/drip/sample/treasuryfuturespnl/US1Attribution.java deleted file mode 100644 index 23d4ae9..0000000 --- a/org/drip/sample/treasuryfuturespnl/US1Attribution.java +++ /dev/null @@ -1,127 +0,0 @@ - -package org.drip.sample.treasuryfuturespnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * USV1Attribution demonstrates the Invocation of the Historical PnL Horizon PnL Attribution analysis for the - * US1 Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class US1Attribution { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\US1ClosesReconstitutor.csv"; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblConversionFactor = csvGrid.doubleArrayAtColumn (1); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - List lsPCC = TreasuryFuturesAPI.HorizonChangeAttribution ( - "UST", - adtEffective, - adtMaturity, - adblCoupon, - adtExpiry, - adtSpot, - adblCleanPrice, - adblConversionFactor - ); - - System.out.println ("FirstDate, SecondDate, ExpiryDate, CTD Bond, Expiry Clean Price, Conversion Factor, 1D Gross PnL, 1D Market PnL, 1D Roll-down PnL, 1D Accrual PnL, 1D Explained PnL, 1D Unexplianed PnL"); - - for (PositionChangeComponents pcc : lsPCC) { - TreasuryFuturesMarketSnap tfpms = (TreasuryFuturesMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - tfpms.expiryDate() + ", " + - tfpms.ctdName() + ", " + - FormatUtil.FormatDouble (tfpms.expiryCleanPrice(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (tfpms.conversionFactor(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 2, 2, 10000.) - ); - } - } -} diff --git a/org/drip/sample/treasuryfuturespnl/WN1Attribution.java b/org/drip/sample/treasuryfuturespnl/WN1Attribution.java deleted file mode 100644 index 0a518db..0000000 --- a/org/drip/sample/treasuryfuturespnl/WN1Attribution.java +++ /dev/null @@ -1,127 +0,0 @@ - -package org.drip.sample.treasuryfuturespnl; - -import java.util.List; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.attribution.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * WN1Attribution demonstrates the Invocation of the Historical PnL Horizon PnL Attribution analysis for the - * WN1 Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class WN1Attribution { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\WN1ClosesReconstitutor.csv"; - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblConversionFactor = csvGrid.doubleArrayAtColumn (1); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - List lsPCC = TreasuryFuturesAPI.HorizonChangeAttribution ( - "UST", - adtEffective, - adtMaturity, - adblCoupon, - adtExpiry, - adtSpot, - adblCleanPrice, - adblConversionFactor - ); - - System.out.println ("FirstDate, SecondDate, ExpiryDate, CTD Bond, Expiry Clean Price, Conversion Factor, 1D Gross PnL, 1D Market PnL, 1D Roll-down PnL, 1D Accrual PnL, 1D Explained PnL, 1D Unexplianed PnL"); - - for (PositionChangeComponents pcc : lsPCC) { - TreasuryFuturesMarketSnap tfpms = (TreasuryFuturesMarketSnap) pcc.pmsSecond(); - - System.out.println ( - pcc.firstDate() + ", " + - pcc.secondDate() + ", " + - tfpms.expiryDate() + ", " + - tfpms.ctdName() + ", " + - FormatUtil.FormatDouble (tfpms.expiryCleanPrice(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (tfpms.conversionFactor(), 1, 5, 1.) + ", " + - FormatUtil.FormatDouble (pcc.grossChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRealizationChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.marketRollDownChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.accrualChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.explainedChange(), 2, 2, 10000.) + ", " + - FormatUtil.FormatDouble (pcc.unexplainedChange(), 2, 2, 10000.) - ); - } - } -} diff --git a/org/drip/sample/treasuryfuturesrisk/CN1KeyRateDuration.java b/org/drip/sample/treasuryfuturesrisk/CN1KeyRateDuration.java deleted file mode 100644 index a396e29..0000000 --- a/org/drip/sample/treasuryfuturesrisk/CN1KeyRateDuration.java +++ /dev/null @@ -1,234 +0,0 @@ - -package org.drip.sample.treasuryfuturesrisk; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.sensitivity.TenorDurationNodeMetrics; -import org.drip.market.exchange.TreasuryFuturesContractContainer; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CN1KeyRateDuration demonstrates the Computation of the Key Rate Duration for the CN1 Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class CN1KeyRateDuration { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strFuturesCode = "CN1"; - - String strTreasuryCode = TreasuryFuturesContractContainer.TreasuryFuturesContract (strFuturesCode).code(); - - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\" + strTreasuryCode + - "BenchmarksReconstituted.csv"; - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\" + - strFuturesCode + "ClosesReconstitutor.csv"; - - CSVGrid csvGridTreasuryMark = CSVParser.StringGrid ( - strTreasuryMarkLocation, - true - ); - - JulianDate[] adtTreasuryMark = csvGridTreasuryMark.dateArrayAtColumn (0); - - double[] adblYield02Y = csvGridTreasuryMark.doubleArrayAtColumn (1); - - double[] adblYield03Y = csvGridTreasuryMark.doubleArrayAtColumn (2); - - double[] adblYield04Y = csvGridTreasuryMark.doubleArrayAtColumn (3); - - double[] adblYield05Y = csvGridTreasuryMark.doubleArrayAtColumn (4); - - double[] adblYield07Y = csvGridTreasuryMark.doubleArrayAtColumn (5); - - double[] adblYield10Y = csvGridTreasuryMark.doubleArrayAtColumn (6); - - double[] adblYield20Y = csvGridTreasuryMark.doubleArrayAtColumn (7); - - double[] adblYield30Y = csvGridTreasuryMark.doubleArrayAtColumn (8); - - Map mapTreasuryMark02Y = new TreeMap(); - - Map mapTreasuryMark03Y = new TreeMap(); - - Map mapTreasuryMark04Y = new TreeMap(); - - Map mapTreasuryMark05Y = new TreeMap(); - - Map mapTreasuryMark07Y = new TreeMap(); - - Map mapTreasuryMark10Y = new TreeMap(); - - Map mapTreasuryMark20Y = new TreeMap(); - - Map mapTreasuryMark30Y = new TreeMap(); - - for (int i = 0; i < adtTreasuryMark.length; ++i) { - mapTreasuryMark02Y.put (adtTreasuryMark[i], adblYield02Y[i]); - - mapTreasuryMark03Y.put (adtTreasuryMark[i], adblYield03Y[i]); - - mapTreasuryMark04Y.put (adtTreasuryMark[i], adblYield04Y[i]); - - mapTreasuryMark05Y.put (adtTreasuryMark[i], adblYield05Y[i]); - - mapTreasuryMark07Y.put (adtTreasuryMark[i], adblYield07Y[i]); - - mapTreasuryMark10Y.put (adtTreasuryMark[i], adblYield10Y[i]); - - mapTreasuryMark20Y.put (adtTreasuryMark[i], adblYield20Y[i]); - - mapTreasuryMark30Y.put (adtTreasuryMark[i], adblYield30Y[i]); - } - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - int iNumCompute = adtSpot.length; - JulianDate[] adtEffectiveCompute = new JulianDate[iNumCompute]; - JulianDate[] adtMaturityCompute = new JulianDate[iNumCompute]; - double[] adblCouponCompute = new double[iNumCompute]; - JulianDate[] adtExpiryCompute = new JulianDate[iNumCompute]; - JulianDate[] adtSpotCompute = new JulianDate[iNumCompute]; - double[] adblCleanPriceCompute = new double[iNumCompute]; - double[][] aadblComputeYield = new double[iNumCompute][8]; - String[] astrBenchmarkTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - for (int i = 0; i < iNumCompute; ++i) { - adtEffectiveCompute[i] = adtEffective[i]; - adtMaturityCompute[i] = adtMaturity[i]; - adblCouponCompute[i] = adblCoupon[i]; - adtExpiryCompute[i] = adtExpiry[i]; - adtSpotCompute[i] = adtSpot[i]; - adblCleanPriceCompute[i] = adblCleanPrice[i]; - - aadblComputeYield[i][0] = mapTreasuryMark02Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][1] = mapTreasuryMark03Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][2] = mapTreasuryMark04Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][3] = mapTreasuryMark05Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][4] = mapTreasuryMark07Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][5] = mapTreasuryMark10Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][6] = mapTreasuryMark20Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][7] = mapTreasuryMark30Y.get (adtSpotCompute[i]); - } - - List lsTDNM = TreasuryFuturesAPI.HorizonKeyRateDuration ( - strTreasuryCode, - adtEffectiveCompute, - adtMaturityCompute, - adblCouponCompute, - adtExpiryCompute, - adtSpotCompute, - adblCleanPriceCompute, - astrBenchmarkTenor, - aadblComputeYield - ); - - System.out.println ("SpotDate,ExpiryDate,CTDName,SpotCTDCleanPrice,ExpiryCTDCleanPrice,SpotGSpread,ExpiryGSpread,SpotYield,ExpiryYield,Parallel,2Y,3Y,4Y,5Y,7Y,10Y,20Y,30Y"); - - for (TenorDurationNodeMetrics tdnm : lsTDNM) { - String strTDNM = - tdnm.dateSnap() + "," + - tdnm.date ("ExpiryDate") + "," + - tdnm.c1 ("CTDName") + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ParallelKRD"), 1, 4, 1.); - - for (Map.Entry meTDNM : tdnm.krdMap().entrySet()) - strTDNM += "," + FormatUtil.FormatDouble (meTDNM.getValue(), 1, 4, 1.); - - System.out.println (strTDNM); - } - } -} diff --git a/org/drip/sample/treasuryfuturesrisk/DU1KeyRateDuration.java b/org/drip/sample/treasuryfuturesrisk/DU1KeyRateDuration.java deleted file mode 100644 index e3f8021..0000000 --- a/org/drip/sample/treasuryfuturesrisk/DU1KeyRateDuration.java +++ /dev/null @@ -1,240 +0,0 @@ - -package org.drip.sample.treasuryfuturesrisk; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.sensitivity.TenorDurationNodeMetrics; -import org.drip.market.exchange.*; -import org.drip.market.issue.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DU1KeyRateDuration demonstrates the Computation of the Key Rate Duration for the DU1 Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class DU1KeyRateDuration { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strFuturesCode = "DU1"; - - TreasuryFuturesContract tfc = TreasuryFuturesContractContainer.TreasuryFuturesContract (strFuturesCode); - - String strTreasuryCode = tfc.code(); - - TreasurySetting ts = TreasurySettingContainer.TreasurySetting (strTreasuryCode); - - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\" + - TreasurySettingContainer.CurrencyBenchmarkCode (ts.currency()) + - "BenchmarksReconstituted.csv"; - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\" + - strFuturesCode + "ClosesReconstitutor.csv"; - - CSVGrid csvGridTreasuryMark = CSVParser.StringGrid ( - strTreasuryMarkLocation, - true - ); - - JulianDate[] adtTreasuryMark = csvGridTreasuryMark.dateArrayAtColumn (0); - - double[] adblYield02Y = csvGridTreasuryMark.doubleArrayAtColumn (1); - - double[] adblYield03Y = csvGridTreasuryMark.doubleArrayAtColumn (2); - - double[] adblYield04Y = csvGridTreasuryMark.doubleArrayAtColumn (3); - - double[] adblYield05Y = csvGridTreasuryMark.doubleArrayAtColumn (4); - - double[] adblYield07Y = csvGridTreasuryMark.doubleArrayAtColumn (5); - - double[] adblYield10Y = csvGridTreasuryMark.doubleArrayAtColumn (6); - - double[] adblYield20Y = csvGridTreasuryMark.doubleArrayAtColumn (7); - - double[] adblYield30Y = csvGridTreasuryMark.doubleArrayAtColumn (8); - - Map mapTreasuryMark02Y = new TreeMap(); - - Map mapTreasuryMark03Y = new TreeMap(); - - Map mapTreasuryMark04Y = new TreeMap(); - - Map mapTreasuryMark05Y = new TreeMap(); - - Map mapTreasuryMark07Y = new TreeMap(); - - Map mapTreasuryMark10Y = new TreeMap(); - - Map mapTreasuryMark20Y = new TreeMap(); - - Map mapTreasuryMark30Y = new TreeMap(); - - for (int i = 0; i < adtTreasuryMark.length; ++i) { - mapTreasuryMark02Y.put (adtTreasuryMark[i], adblYield02Y[i]); - - mapTreasuryMark03Y.put (adtTreasuryMark[i], adblYield03Y[i]); - - mapTreasuryMark04Y.put (adtTreasuryMark[i], adblYield04Y[i]); - - mapTreasuryMark05Y.put (adtTreasuryMark[i], adblYield05Y[i]); - - mapTreasuryMark07Y.put (adtTreasuryMark[i], adblYield07Y[i]); - - mapTreasuryMark10Y.put (adtTreasuryMark[i], adblYield10Y[i]); - - mapTreasuryMark20Y.put (adtTreasuryMark[i], adblYield20Y[i]); - - mapTreasuryMark30Y.put (adtTreasuryMark[i], adblYield30Y[i]); - } - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - int iNumCompute = adtSpot.length; - JulianDate[] adtEffectiveCompute = new JulianDate[iNumCompute]; - JulianDate[] adtMaturityCompute = new JulianDate[iNumCompute]; - double[] adblCouponCompute = new double[iNumCompute]; - JulianDate[] adtExpiryCompute = new JulianDate[iNumCompute]; - JulianDate[] adtSpotCompute = new JulianDate[iNumCompute]; - double[] adblCleanPriceCompute = new double[iNumCompute]; - double[][] aadblComputeYield = new double[iNumCompute][8]; - String[] astrBenchmarkTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - for (int i = 0; i < iNumCompute; ++i) { - adtEffectiveCompute[i] = adtEffective[i]; - adtMaturityCompute[i] = adtMaturity[i]; - adblCouponCompute[i] = adblCoupon[i]; - adtExpiryCompute[i] = adtExpiry[i]; - adtSpotCompute[i] = adtSpot[i]; - adblCleanPriceCompute[i] = adblCleanPrice[i]; - - aadblComputeYield[i][0] = mapTreasuryMark02Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][1] = mapTreasuryMark03Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][2] = mapTreasuryMark04Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][3] = mapTreasuryMark05Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][4] = mapTreasuryMark07Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][5] = mapTreasuryMark10Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][6] = mapTreasuryMark20Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][7] = mapTreasuryMark30Y.get (adtSpotCompute[i]); - } - - List lsTDNM = TreasuryFuturesAPI.HorizonKeyRateDuration ( - strTreasuryCode, - adtEffectiveCompute, - adtMaturityCompute, - adblCouponCompute, - adtExpiryCompute, - adtSpotCompute, - adblCleanPriceCompute, - astrBenchmarkTenor, - aadblComputeYield - ); - - System.out.println ("SpotDate,ExpiryDate,CTDName,SpotCTDCleanPrice,ExpiryCTDCleanPrice,SpotGSpread,ExpiryGSpread,SpotYield,ExpiryYield,Parallel,2Y,3Y,4Y,5Y,7Y,10Y,20Y,30Y"); - - for (TenorDurationNodeMetrics tdnm : lsTDNM) { - String strTDNM = - tdnm.dateSnap() + "," + - tdnm.date ("ExpiryDate") + "," + - tdnm.c1 ("CTDName") + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ParallelKRD"), 1, 4, 1.); - - for (Map.Entry meTDNM : tdnm.krdMap().entrySet()) - strTDNM += "," + FormatUtil.FormatDouble (meTDNM.getValue(), 1, 4, 1.); - - System.out.println (strTDNM); - } - } -} diff --git a/org/drip/sample/treasuryfuturesrisk/FBB1KeyRateDuration.java b/org/drip/sample/treasuryfuturesrisk/FBB1KeyRateDuration.java deleted file mode 100644 index 89012df..0000000 --- a/org/drip/sample/treasuryfuturesrisk/FBB1KeyRateDuration.java +++ /dev/null @@ -1,240 +0,0 @@ - -package org.drip.sample.treasuryfuturesrisk; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.sensitivity.TenorDurationNodeMetrics; -import org.drip.market.exchange.*; -import org.drip.market.issue.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FBB1KeyRateDuration demonstrates the Computation of the Key Rate Duration for the FBB1 Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class FBB1KeyRateDuration { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strFuturesCode = "FBB1"; - - TreasuryFuturesContract tfc = TreasuryFuturesContractContainer.TreasuryFuturesContract (strFuturesCode); - - String strTreasuryCode = tfc.code(); - - TreasurySetting ts = TreasurySettingContainer.TreasurySetting (strTreasuryCode); - - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\" + - TreasurySettingContainer.CurrencyBenchmarkCode (ts.currency()) + - "BenchmarksReconstituted.csv"; - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\" + - strFuturesCode + "ClosesReconstitutor.csv"; - - CSVGrid csvGridTreasuryMark = CSVParser.StringGrid ( - strTreasuryMarkLocation, - true - ); - - JulianDate[] adtTreasuryMark = csvGridTreasuryMark.dateArrayAtColumn (0); - - double[] adblYield02Y = csvGridTreasuryMark.doubleArrayAtColumn (1); - - double[] adblYield03Y = csvGridTreasuryMark.doubleArrayAtColumn (2); - - double[] adblYield04Y = csvGridTreasuryMark.doubleArrayAtColumn (3); - - double[] adblYield05Y = csvGridTreasuryMark.doubleArrayAtColumn (4); - - double[] adblYield07Y = csvGridTreasuryMark.doubleArrayAtColumn (5); - - double[] adblYield10Y = csvGridTreasuryMark.doubleArrayAtColumn (6); - - double[] adblYield20Y = csvGridTreasuryMark.doubleArrayAtColumn (7); - - double[] adblYield30Y = csvGridTreasuryMark.doubleArrayAtColumn (8); - - Map mapTreasuryMark02Y = new TreeMap(); - - Map mapTreasuryMark03Y = new TreeMap(); - - Map mapTreasuryMark04Y = new TreeMap(); - - Map mapTreasuryMark05Y = new TreeMap(); - - Map mapTreasuryMark07Y = new TreeMap(); - - Map mapTreasuryMark10Y = new TreeMap(); - - Map mapTreasuryMark20Y = new TreeMap(); - - Map mapTreasuryMark30Y = new TreeMap(); - - for (int i = 0; i < adtTreasuryMark.length; ++i) { - mapTreasuryMark02Y.put (adtTreasuryMark[i], adblYield02Y[i]); - - mapTreasuryMark03Y.put (adtTreasuryMark[i], adblYield03Y[i]); - - mapTreasuryMark04Y.put (adtTreasuryMark[i], adblYield04Y[i]); - - mapTreasuryMark05Y.put (adtTreasuryMark[i], adblYield05Y[i]); - - mapTreasuryMark07Y.put (adtTreasuryMark[i], adblYield07Y[i]); - - mapTreasuryMark10Y.put (adtTreasuryMark[i], adblYield10Y[i]); - - mapTreasuryMark20Y.put (adtTreasuryMark[i], adblYield20Y[i]); - - mapTreasuryMark30Y.put (adtTreasuryMark[i], adblYield30Y[i]); - } - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - int iNumCompute = adtSpot.length; - JulianDate[] adtEffectiveCompute = new JulianDate[iNumCompute]; - JulianDate[] adtMaturityCompute = new JulianDate[iNumCompute]; - double[] adblCouponCompute = new double[iNumCompute]; - JulianDate[] adtExpiryCompute = new JulianDate[iNumCompute]; - JulianDate[] adtSpotCompute = new JulianDate[iNumCompute]; - double[] adblCleanPriceCompute = new double[iNumCompute]; - double[][] aadblComputeYield = new double[iNumCompute][8]; - String[] astrBenchmarkTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - for (int i = 0; i < iNumCompute; ++i) { - adtEffectiveCompute[i] = adtEffective[i]; - adtMaturityCompute[i] = adtMaturity[i]; - adblCouponCompute[i] = adblCoupon[i]; - adtExpiryCompute[i] = adtExpiry[i]; - adtSpotCompute[i] = adtSpot[i]; - adblCleanPriceCompute[i] = adblCleanPrice[i]; - - aadblComputeYield[i][0] = mapTreasuryMark02Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][1] = mapTreasuryMark03Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][2] = mapTreasuryMark04Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][3] = mapTreasuryMark05Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][4] = mapTreasuryMark07Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][5] = mapTreasuryMark10Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][6] = mapTreasuryMark20Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][7] = mapTreasuryMark30Y.get (adtSpotCompute[i]); - } - - List lsTDNM = TreasuryFuturesAPI.HorizonKeyRateDuration ( - strTreasuryCode, - adtEffectiveCompute, - adtMaturityCompute, - adblCouponCompute, - adtExpiryCompute, - adtSpotCompute, - adblCleanPriceCompute, - astrBenchmarkTenor, - aadblComputeYield - ); - - System.out.println ("SpotDate,ExpiryDate,CTDName,SpotCTDCleanPrice,ExpiryCTDCleanPrice,SpotGSpread,ExpiryGSpread,SpotYield,ExpiryYield,Parallel,2Y,3Y,4Y,5Y,7Y,10Y,20Y,30Y"); - - for (TenorDurationNodeMetrics tdnm : lsTDNM) { - String strTDNM = - tdnm.dateSnap() + "," + - tdnm.date ("ExpiryDate") + "," + - tdnm.c1 ("CTDName") + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ParallelKRD"), 1, 4, 1.); - - for (Map.Entry meTDNM : tdnm.krdMap().entrySet()) - strTDNM += "," + FormatUtil.FormatDouble (meTDNM.getValue(), 1, 4, 1.); - - System.out.println (strTDNM); - } - } -} diff --git a/org/drip/sample/treasuryfuturesrisk/FV1KeyRateDuration.java b/org/drip/sample/treasuryfuturesrisk/FV1KeyRateDuration.java deleted file mode 100644 index e6e9c74..0000000 --- a/org/drip/sample/treasuryfuturesrisk/FV1KeyRateDuration.java +++ /dev/null @@ -1,234 +0,0 @@ - -package org.drip.sample.treasuryfuturesrisk; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.sensitivity.TenorDurationNodeMetrics; -import org.drip.market.exchange.TreasuryFuturesContractContainer; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FV1KeyRateDuration demonstrates the Computation of the Key Rate Duration for the FV1 Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class FV1KeyRateDuration { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strFuturesCode = "FV1"; - - String strTreasuryCode = TreasuryFuturesContractContainer.TreasuryFuturesContract (strFuturesCode).code(); - - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\" + strTreasuryCode + - "BenchmarksReconstituted.csv"; - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\" + - strFuturesCode + "ClosesReconstitutor.csv"; - - CSVGrid csvGridTreasuryMark = CSVParser.StringGrid ( - strTreasuryMarkLocation, - true - ); - - JulianDate[] adtTreasuryMark = csvGridTreasuryMark.dateArrayAtColumn (0); - - double[] adblYield02Y = csvGridTreasuryMark.doubleArrayAtColumn (1); - - double[] adblYield03Y = csvGridTreasuryMark.doubleArrayAtColumn (2); - - double[] adblYield04Y = csvGridTreasuryMark.doubleArrayAtColumn (3); - - double[] adblYield05Y = csvGridTreasuryMark.doubleArrayAtColumn (4); - - double[] adblYield07Y = csvGridTreasuryMark.doubleArrayAtColumn (5); - - double[] adblYield10Y = csvGridTreasuryMark.doubleArrayAtColumn (6); - - double[] adblYield20Y = csvGridTreasuryMark.doubleArrayAtColumn (7); - - double[] adblYield30Y = csvGridTreasuryMark.doubleArrayAtColumn (8); - - Map mapTreasuryMark02Y = new TreeMap(); - - Map mapTreasuryMark03Y = new TreeMap(); - - Map mapTreasuryMark04Y = new TreeMap(); - - Map mapTreasuryMark05Y = new TreeMap(); - - Map mapTreasuryMark07Y = new TreeMap(); - - Map mapTreasuryMark10Y = new TreeMap(); - - Map mapTreasuryMark20Y = new TreeMap(); - - Map mapTreasuryMark30Y = new TreeMap(); - - for (int i = 0; i < adtTreasuryMark.length; ++i) { - mapTreasuryMark02Y.put (adtTreasuryMark[i], adblYield02Y[i]); - - mapTreasuryMark03Y.put (adtTreasuryMark[i], adblYield03Y[i]); - - mapTreasuryMark04Y.put (adtTreasuryMark[i], adblYield04Y[i]); - - mapTreasuryMark05Y.put (adtTreasuryMark[i], adblYield05Y[i]); - - mapTreasuryMark07Y.put (adtTreasuryMark[i], adblYield07Y[i]); - - mapTreasuryMark10Y.put (adtTreasuryMark[i], adblYield10Y[i]); - - mapTreasuryMark20Y.put (adtTreasuryMark[i], adblYield20Y[i]); - - mapTreasuryMark30Y.put (adtTreasuryMark[i], adblYield30Y[i]); - } - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - int iNumCompute = adtSpot.length; - JulianDate[] adtEffectiveCompute = new JulianDate[iNumCompute]; - JulianDate[] adtMaturityCompute = new JulianDate[iNumCompute]; - double[] adblCouponCompute = new double[iNumCompute]; - JulianDate[] adtExpiryCompute = new JulianDate[iNumCompute]; - JulianDate[] adtSpotCompute = new JulianDate[iNumCompute]; - double[] adblCleanPriceCompute = new double[iNumCompute]; - double[][] aadblComputeYield = new double[iNumCompute][8]; - String[] astrBenchmarkTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - for (int i = 0; i < iNumCompute; ++i) { - adtEffectiveCompute[i] = adtEffective[i]; - adtMaturityCompute[i] = adtMaturity[i]; - adblCouponCompute[i] = adblCoupon[i]; - adtExpiryCompute[i] = adtExpiry[i]; - adtSpotCompute[i] = adtSpot[i]; - adblCleanPriceCompute[i] = adblCleanPrice[i]; - - aadblComputeYield[i][0] = mapTreasuryMark02Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][1] = mapTreasuryMark03Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][2] = mapTreasuryMark04Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][3] = mapTreasuryMark05Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][4] = mapTreasuryMark07Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][5] = mapTreasuryMark10Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][6] = mapTreasuryMark20Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][7] = mapTreasuryMark30Y.get (adtSpotCompute[i]); - } - - List lsTDNM = TreasuryFuturesAPI.HorizonKeyRateDuration ( - strTreasuryCode, - adtEffectiveCompute, - adtMaturityCompute, - adblCouponCompute, - adtExpiryCompute, - adtSpotCompute, - adblCleanPriceCompute, - astrBenchmarkTenor, - aadblComputeYield - ); - - System.out.println ("SpotDate,ExpiryDate,CTDName,SpotCTDCleanPrice,ExpiryCTDCleanPrice,SpotGSpread,ExpiryGSpread,SpotYield,ExpiryYield,Parallel,2Y,3Y,4Y,5Y,7Y,10Y,20Y,30Y"); - - for (TenorDurationNodeMetrics tdnm : lsTDNM) { - String strTDNM = - tdnm.dateSnap() + "," + - tdnm.date ("ExpiryDate") + "," + - tdnm.c1 ("CTDName") + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ParallelKRD"), 1, 4, 1.); - - for (Map.Entry meTDNM : tdnm.krdMap().entrySet()) - strTDNM += "," + FormatUtil.FormatDouble (meTDNM.getValue(), 1, 4, 1.); - - System.out.println (strTDNM); - } - } -} diff --git a/org/drip/sample/treasuryfuturesrisk/IK1KeyRateDuration.java b/org/drip/sample/treasuryfuturesrisk/IK1KeyRateDuration.java deleted file mode 100644 index c7786e1..0000000 --- a/org/drip/sample/treasuryfuturesrisk/IK1KeyRateDuration.java +++ /dev/null @@ -1,239 +0,0 @@ - -package org.drip.sample.treasuryfuturesrisk; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.sensitivity.TenorDurationNodeMetrics; -import org.drip.market.exchange.*; -import org.drip.market.issue.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * IK1KeyRateDuration demonstrates the Computation of the Key Rate Duration for the IK1 Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class IK1KeyRateDuration { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strFuturesCode = "IK1"; - - TreasuryFuturesContract tfc = TreasuryFuturesContractContainer.TreasuryFuturesContract (strFuturesCode); - - String strTreasuryCode = tfc.code(); - - TreasurySetting ts = TreasurySettingContainer.TreasurySetting (strTreasuryCode); - - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\" + - TreasurySettingContainer.CurrencyBenchmarkCode (ts.currency()) + "BenchmarksReconstituted.csv"; - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\" + - strFuturesCode + "ClosesReconstitutor.csv"; - - CSVGrid csvGridTreasuryMark = CSVParser.StringGrid ( - strTreasuryMarkLocation, - true - ); - - JulianDate[] adtTreasuryMark = csvGridTreasuryMark.dateArrayAtColumn (0); - - double[] adblYield02Y = csvGridTreasuryMark.doubleArrayAtColumn (1); - - double[] adblYield03Y = csvGridTreasuryMark.doubleArrayAtColumn (2); - - double[] adblYield04Y = csvGridTreasuryMark.doubleArrayAtColumn (3); - - double[] adblYield05Y = csvGridTreasuryMark.doubleArrayAtColumn (4); - - double[] adblYield07Y = csvGridTreasuryMark.doubleArrayAtColumn (5); - - double[] adblYield10Y = csvGridTreasuryMark.doubleArrayAtColumn (6); - - double[] adblYield20Y = csvGridTreasuryMark.doubleArrayAtColumn (7); - - double[] adblYield30Y = csvGridTreasuryMark.doubleArrayAtColumn (8); - - Map mapTreasuryMark02Y = new TreeMap(); - - Map mapTreasuryMark03Y = new TreeMap(); - - Map mapTreasuryMark04Y = new TreeMap(); - - Map mapTreasuryMark05Y = new TreeMap(); - - Map mapTreasuryMark07Y = new TreeMap(); - - Map mapTreasuryMark10Y = new TreeMap(); - - Map mapTreasuryMark20Y = new TreeMap(); - - Map mapTreasuryMark30Y = new TreeMap(); - - for (int i = 0; i < adtTreasuryMark.length; ++i) { - mapTreasuryMark02Y.put (adtTreasuryMark[i], adblYield02Y[i]); - - mapTreasuryMark03Y.put (adtTreasuryMark[i], adblYield03Y[i]); - - mapTreasuryMark04Y.put (adtTreasuryMark[i], adblYield04Y[i]); - - mapTreasuryMark05Y.put (adtTreasuryMark[i], adblYield05Y[i]); - - mapTreasuryMark07Y.put (adtTreasuryMark[i], adblYield07Y[i]); - - mapTreasuryMark10Y.put (adtTreasuryMark[i], adblYield10Y[i]); - - mapTreasuryMark20Y.put (adtTreasuryMark[i], adblYield20Y[i]); - - mapTreasuryMark30Y.put (adtTreasuryMark[i], adblYield30Y[i]); - } - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - int iNumCompute = adtSpot.length; - JulianDate[] adtEffectiveCompute = new JulianDate[iNumCompute]; - JulianDate[] adtMaturityCompute = new JulianDate[iNumCompute]; - double[] adblCouponCompute = new double[iNumCompute]; - JulianDate[] adtExpiryCompute = new JulianDate[iNumCompute]; - JulianDate[] adtSpotCompute = new JulianDate[iNumCompute]; - double[] adblCleanPriceCompute = new double[iNumCompute]; - double[][] aadblComputeYield = new double[iNumCompute][8]; - String[] astrBenchmarkTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - for (int i = 0; i < iNumCompute; ++i) { - adtEffectiveCompute[i] = adtEffective[i]; - adtMaturityCompute[i] = adtMaturity[i]; - adblCouponCompute[i] = adblCoupon[i]; - adtExpiryCompute[i] = adtExpiry[i]; - adtSpotCompute[i] = adtSpot[i]; - adblCleanPriceCompute[i] = adblCleanPrice[i]; - - aadblComputeYield[i][0] = mapTreasuryMark02Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][1] = mapTreasuryMark03Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][2] = mapTreasuryMark04Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][3] = mapTreasuryMark05Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][4] = mapTreasuryMark07Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][5] = mapTreasuryMark10Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][6] = mapTreasuryMark20Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][7] = mapTreasuryMark30Y.get (adtSpotCompute[i]); - } - - List lsTDNM = TreasuryFuturesAPI.HorizonKeyRateDuration ( - strTreasuryCode, - adtEffectiveCompute, - adtMaturityCompute, - adblCouponCompute, - adtExpiryCompute, - adtSpotCompute, - adblCleanPriceCompute, - astrBenchmarkTenor, - aadblComputeYield - ); - - System.out.println ("SpotDate,ExpiryDate,CTDName,SpotCTDCleanPrice,ExpiryCTDCleanPrice,SpotGSpread,ExpiryGSpread,SpotYield,ExpiryYield,Parallel,2Y,3Y,4Y,5Y,7Y,10Y,20Y,30Y"); - - for (TenorDurationNodeMetrics tdnm : lsTDNM) { - String strTDNM = - tdnm.dateSnap() + "," + - tdnm.date ("ExpiryDate") + "," + - tdnm.c1 ("CTDName") + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ParallelKRD"), 1, 4, 1.); - - for (Map.Entry meTDNM : tdnm.krdMap().entrySet()) - strTDNM += "," + FormatUtil.FormatDouble (meTDNM.getValue(), 1, 4, 1.); - - System.out.println (strTDNM); - } - } -} diff --git a/org/drip/sample/treasuryfuturesrisk/JB1KeyRateDuration.java b/org/drip/sample/treasuryfuturesrisk/JB1KeyRateDuration.java deleted file mode 100644 index 1928061..0000000 --- a/org/drip/sample/treasuryfuturesrisk/JB1KeyRateDuration.java +++ /dev/null @@ -1,239 +0,0 @@ - -package org.drip.sample.treasuryfuturesrisk; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.sensitivity.TenorDurationNodeMetrics; -import org.drip.market.exchange.*; -import org.drip.market.issue.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * JB1KeyRateDuration demonstrates the Computation of the Key Rate Duration for the JB1 Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class JB1KeyRateDuration { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strFuturesCode = "JB1"; - - TreasuryFuturesContract tfc = TreasuryFuturesContractContainer.TreasuryFuturesContract (strFuturesCode); - - String strTreasuryCode = tfc.code(); - - TreasurySetting ts = TreasurySettingContainer.TreasurySetting (strTreasuryCode); - - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\" + - TreasurySettingContainer.CurrencyBenchmarkCode (ts.currency()) + "BenchmarksReconstituted.csv"; - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\" + - strFuturesCode + "ClosesReconstitutor.csv"; - - CSVGrid csvGridTreasuryMark = CSVParser.StringGrid ( - strTreasuryMarkLocation, - true - ); - - JulianDate[] adtTreasuryMark = csvGridTreasuryMark.dateArrayAtColumn (0); - - double[] adblYield02Y = csvGridTreasuryMark.doubleArrayAtColumn (1); - - double[] adblYield03Y = csvGridTreasuryMark.doubleArrayAtColumn (2); - - double[] adblYield04Y = csvGridTreasuryMark.doubleArrayAtColumn (3); - - double[] adblYield05Y = csvGridTreasuryMark.doubleArrayAtColumn (4); - - double[] adblYield07Y = csvGridTreasuryMark.doubleArrayAtColumn (5); - - double[] adblYield10Y = csvGridTreasuryMark.doubleArrayAtColumn (6); - - double[] adblYield20Y = csvGridTreasuryMark.doubleArrayAtColumn (7); - - double[] adblYield30Y = csvGridTreasuryMark.doubleArrayAtColumn (8); - - Map mapTreasuryMark02Y = new TreeMap(); - - Map mapTreasuryMark03Y = new TreeMap(); - - Map mapTreasuryMark04Y = new TreeMap(); - - Map mapTreasuryMark05Y = new TreeMap(); - - Map mapTreasuryMark07Y = new TreeMap(); - - Map mapTreasuryMark10Y = new TreeMap(); - - Map mapTreasuryMark20Y = new TreeMap(); - - Map mapTreasuryMark30Y = new TreeMap(); - - for (int i = 0; i < adtTreasuryMark.length; ++i) { - mapTreasuryMark02Y.put (adtTreasuryMark[i], adblYield02Y[i]); - - mapTreasuryMark03Y.put (adtTreasuryMark[i], adblYield03Y[i]); - - mapTreasuryMark04Y.put (adtTreasuryMark[i], adblYield04Y[i]); - - mapTreasuryMark05Y.put (adtTreasuryMark[i], adblYield05Y[i]); - - mapTreasuryMark07Y.put (adtTreasuryMark[i], adblYield07Y[i]); - - mapTreasuryMark10Y.put (adtTreasuryMark[i], adblYield10Y[i]); - - mapTreasuryMark20Y.put (adtTreasuryMark[i], adblYield20Y[i]); - - mapTreasuryMark30Y.put (adtTreasuryMark[i], adblYield30Y[i]); - } - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - int iNumCompute = adtSpot.length; - JulianDate[] adtEffectiveCompute = new JulianDate[iNumCompute]; - JulianDate[] adtMaturityCompute = new JulianDate[iNumCompute]; - double[] adblCouponCompute = new double[iNumCompute]; - JulianDate[] adtExpiryCompute = new JulianDate[iNumCompute]; - JulianDate[] adtSpotCompute = new JulianDate[iNumCompute]; - double[] adblCleanPriceCompute = new double[iNumCompute]; - double[][] aadblComputeYield = new double[iNumCompute][8]; - String[] astrBenchmarkTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - for (int i = 0; i < iNumCompute; ++i) { - adtEffectiveCompute[i] = adtEffective[i]; - adtMaturityCompute[i] = adtMaturity[i]; - adblCouponCompute[i] = adblCoupon[i]; - adtExpiryCompute[i] = adtExpiry[i]; - adtSpotCompute[i] = adtSpot[i]; - adblCleanPriceCompute[i] = adblCleanPrice[i]; - - aadblComputeYield[i][0] = mapTreasuryMark02Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][1] = mapTreasuryMark03Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][2] = mapTreasuryMark04Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][3] = mapTreasuryMark05Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][4] = mapTreasuryMark07Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][5] = mapTreasuryMark10Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][6] = mapTreasuryMark20Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][7] = mapTreasuryMark30Y.get (adtSpotCompute[i]); - } - - List lsTDNM = TreasuryFuturesAPI.HorizonKeyRateDuration ( - strTreasuryCode, - adtEffectiveCompute, - adtMaturityCompute, - adblCouponCompute, - adtExpiryCompute, - adtSpotCompute, - adblCleanPriceCompute, - astrBenchmarkTenor, - aadblComputeYield - ); - - System.out.println ("SpotDate,ExpiryDate,CTDName,SpotCTDCleanPrice,ExpiryCTDCleanPrice,SpotGSpread,ExpiryGSpread,SpotYield,ExpiryYield,Parallel,2Y,3Y,4Y,5Y,7Y,10Y,20Y,30Y"); - - for (TenorDurationNodeMetrics tdnm : lsTDNM) { - String strTDNM = - tdnm.dateSnap() + "," + - tdnm.date ("ExpiryDate") + "," + - tdnm.c1 ("CTDName") + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ParallelKRD"), 1, 4, 1.); - - for (Map.Entry meTDNM : tdnm.krdMap().entrySet()) - strTDNM += "," + FormatUtil.FormatDouble (meTDNM.getValue(), 1, 4, 1.); - - System.out.println (strTDNM); - } - } -} diff --git a/org/drip/sample/treasuryfuturesrisk/OAT1KeyRateDuration.java b/org/drip/sample/treasuryfuturesrisk/OAT1KeyRateDuration.java deleted file mode 100644 index 2188843..0000000 --- a/org/drip/sample/treasuryfuturesrisk/OAT1KeyRateDuration.java +++ /dev/null @@ -1,239 +0,0 @@ - -package org.drip.sample.treasuryfuturesrisk; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.sensitivity.TenorDurationNodeMetrics; -import org.drip.market.exchange.*; -import org.drip.market.issue.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OAT1KeyRateDuration demonstrates the Computation of the Key Rate Duration for the OAT1 Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class OAT1KeyRateDuration { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strFuturesCode = "OAT1"; - - TreasuryFuturesContract tfc = TreasuryFuturesContractContainer.TreasuryFuturesContract (strFuturesCode); - - String strTreasuryCode = tfc.code(); - - TreasurySetting ts = TreasurySettingContainer.TreasurySetting (strTreasuryCode); - - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\" + - TreasurySettingContainer.CurrencyBenchmarkCode (ts.currency()) + "BenchmarksReconstituted.csv"; - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\" + - strFuturesCode + "ClosesReconstitutor.csv"; - - CSVGrid csvGridTreasuryMark = CSVParser.StringGrid ( - strTreasuryMarkLocation, - true - ); - - JulianDate[] adtTreasuryMark = csvGridTreasuryMark.dateArrayAtColumn (0); - - double[] adblYield02Y = csvGridTreasuryMark.doubleArrayAtColumn (1); - - double[] adblYield03Y = csvGridTreasuryMark.doubleArrayAtColumn (2); - - double[] adblYield04Y = csvGridTreasuryMark.doubleArrayAtColumn (3); - - double[] adblYield05Y = csvGridTreasuryMark.doubleArrayAtColumn (4); - - double[] adblYield07Y = csvGridTreasuryMark.doubleArrayAtColumn (5); - - double[] adblYield10Y = csvGridTreasuryMark.doubleArrayAtColumn (6); - - double[] adblYield20Y = csvGridTreasuryMark.doubleArrayAtColumn (7); - - double[] adblYield30Y = csvGridTreasuryMark.doubleArrayAtColumn (8); - - Map mapTreasuryMark02Y = new TreeMap(); - - Map mapTreasuryMark03Y = new TreeMap(); - - Map mapTreasuryMark04Y = new TreeMap(); - - Map mapTreasuryMark05Y = new TreeMap(); - - Map mapTreasuryMark07Y = new TreeMap(); - - Map mapTreasuryMark10Y = new TreeMap(); - - Map mapTreasuryMark20Y = new TreeMap(); - - Map mapTreasuryMark30Y = new TreeMap(); - - for (int i = 0; i < adtTreasuryMark.length; ++i) { - mapTreasuryMark02Y.put (adtTreasuryMark[i], adblYield02Y[i]); - - mapTreasuryMark03Y.put (adtTreasuryMark[i], adblYield03Y[i]); - - mapTreasuryMark04Y.put (adtTreasuryMark[i], adblYield04Y[i]); - - mapTreasuryMark05Y.put (adtTreasuryMark[i], adblYield05Y[i]); - - mapTreasuryMark07Y.put (adtTreasuryMark[i], adblYield07Y[i]); - - mapTreasuryMark10Y.put (adtTreasuryMark[i], adblYield10Y[i]); - - mapTreasuryMark20Y.put (adtTreasuryMark[i], adblYield20Y[i]); - - mapTreasuryMark30Y.put (adtTreasuryMark[i], adblYield30Y[i]); - } - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - int iNumCompute = adtSpot.length; - JulianDate[] adtEffectiveCompute = new JulianDate[iNumCompute]; - JulianDate[] adtMaturityCompute = new JulianDate[iNumCompute]; - double[] adblCouponCompute = new double[iNumCompute]; - JulianDate[] adtExpiryCompute = new JulianDate[iNumCompute]; - JulianDate[] adtSpotCompute = new JulianDate[iNumCompute]; - double[] adblCleanPriceCompute = new double[iNumCompute]; - double[][] aadblComputeYield = new double[iNumCompute][8]; - String[] astrBenchmarkTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - for (int i = 0; i < iNumCompute; ++i) { - adtEffectiveCompute[i] = adtEffective[i]; - adtMaturityCompute[i] = adtMaturity[i]; - adblCouponCompute[i] = adblCoupon[i]; - adtExpiryCompute[i] = adtExpiry[i]; - adtSpotCompute[i] = adtSpot[i]; - adblCleanPriceCompute[i] = adblCleanPrice[i]; - - aadblComputeYield[i][0] = mapTreasuryMark02Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][1] = mapTreasuryMark03Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][2] = mapTreasuryMark04Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][3] = mapTreasuryMark05Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][4] = mapTreasuryMark07Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][5] = mapTreasuryMark10Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][6] = mapTreasuryMark20Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][7] = mapTreasuryMark30Y.get (adtSpotCompute[i]); - } - - List lsTDNM = TreasuryFuturesAPI.HorizonKeyRateDuration ( - strTreasuryCode, - adtEffectiveCompute, - adtMaturityCompute, - adblCouponCompute, - adtExpiryCompute, - adtSpotCompute, - adblCleanPriceCompute, - astrBenchmarkTenor, - aadblComputeYield - ); - - System.out.println ("SpotDate,ExpiryDate,CTDName,SpotCTDCleanPrice,ExpiryCTDCleanPrice,SpotGSpread,ExpiryGSpread,SpotYield,ExpiryYield,Parallel,2Y,3Y,4Y,5Y,7Y,10Y,20Y,30Y"); - - for (TenorDurationNodeMetrics tdnm : lsTDNM) { - String strTDNM = - tdnm.dateSnap() + "," + - tdnm.date ("ExpiryDate") + "," + - tdnm.c1 ("CTDName") + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ParallelKRD"), 1, 4, 1.); - - for (Map.Entry meTDNM : tdnm.krdMap().entrySet()) - strTDNM += "," + FormatUtil.FormatDouble (meTDNM.getValue(), 1, 4, 1.); - - System.out.println (strTDNM); - } - } -} diff --git a/org/drip/sample/treasuryfuturesrisk/OE1KeyRateDuration.java b/org/drip/sample/treasuryfuturesrisk/OE1KeyRateDuration.java deleted file mode 100644 index f7da674..0000000 --- a/org/drip/sample/treasuryfuturesrisk/OE1KeyRateDuration.java +++ /dev/null @@ -1,239 +0,0 @@ - -package org.drip.sample.treasuryfuturesrisk; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.sensitivity.TenorDurationNodeMetrics; -import org.drip.market.exchange.*; -import org.drip.market.issue.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OE1KeyRateDuration demonstrates the Computation of the Key Rate Duration for the OE1 Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class OE1KeyRateDuration { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strFuturesCode = "OE1"; - - TreasuryFuturesContract tfc = TreasuryFuturesContractContainer.TreasuryFuturesContract (strFuturesCode); - - String strTreasuryCode = tfc.code(); - - TreasurySetting ts = TreasurySettingContainer.TreasurySetting (strTreasuryCode); - - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\" + - TreasurySettingContainer.CurrencyBenchmarkCode (ts.currency()) + "BenchmarksReconstituted.csv"; - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\" + - strFuturesCode + "ClosesReconstitutor.csv"; - - CSVGrid csvGridTreasuryMark = CSVParser.StringGrid ( - strTreasuryMarkLocation, - true - ); - - JulianDate[] adtTreasuryMark = csvGridTreasuryMark.dateArrayAtColumn (0); - - double[] adblYield02Y = csvGridTreasuryMark.doubleArrayAtColumn (1); - - double[] adblYield03Y = csvGridTreasuryMark.doubleArrayAtColumn (2); - - double[] adblYield04Y = csvGridTreasuryMark.doubleArrayAtColumn (3); - - double[] adblYield05Y = csvGridTreasuryMark.doubleArrayAtColumn (4); - - double[] adblYield07Y = csvGridTreasuryMark.doubleArrayAtColumn (5); - - double[] adblYield10Y = csvGridTreasuryMark.doubleArrayAtColumn (6); - - double[] adblYield20Y = csvGridTreasuryMark.doubleArrayAtColumn (7); - - double[] adblYield30Y = csvGridTreasuryMark.doubleArrayAtColumn (8); - - Map mapTreasuryMark02Y = new TreeMap(); - - Map mapTreasuryMark03Y = new TreeMap(); - - Map mapTreasuryMark04Y = new TreeMap(); - - Map mapTreasuryMark05Y = new TreeMap(); - - Map mapTreasuryMark07Y = new TreeMap(); - - Map mapTreasuryMark10Y = new TreeMap(); - - Map mapTreasuryMark20Y = new TreeMap(); - - Map mapTreasuryMark30Y = new TreeMap(); - - for (int i = 0; i < adtTreasuryMark.length; ++i) { - mapTreasuryMark02Y.put (adtTreasuryMark[i], adblYield02Y[i]); - - mapTreasuryMark03Y.put (adtTreasuryMark[i], adblYield03Y[i]); - - mapTreasuryMark04Y.put (adtTreasuryMark[i], adblYield04Y[i]); - - mapTreasuryMark05Y.put (adtTreasuryMark[i], adblYield05Y[i]); - - mapTreasuryMark07Y.put (adtTreasuryMark[i], adblYield07Y[i]); - - mapTreasuryMark10Y.put (adtTreasuryMark[i], adblYield10Y[i]); - - mapTreasuryMark20Y.put (adtTreasuryMark[i], adblYield20Y[i]); - - mapTreasuryMark30Y.put (adtTreasuryMark[i], adblYield30Y[i]); - } - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - int iNumCompute = adtSpot.length; - JulianDate[] adtEffectiveCompute = new JulianDate[iNumCompute]; - JulianDate[] adtMaturityCompute = new JulianDate[iNumCompute]; - double[] adblCouponCompute = new double[iNumCompute]; - JulianDate[] adtExpiryCompute = new JulianDate[iNumCompute]; - JulianDate[] adtSpotCompute = new JulianDate[iNumCompute]; - double[] adblCleanPriceCompute = new double[iNumCompute]; - double[][] aadblComputeYield = new double[iNumCompute][8]; - String[] astrBenchmarkTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - for (int i = 0; i < iNumCompute; ++i) { - adtEffectiveCompute[i] = adtEffective[i]; - adtMaturityCompute[i] = adtMaturity[i]; - adblCouponCompute[i] = adblCoupon[i]; - adtExpiryCompute[i] = adtExpiry[i]; - adtSpotCompute[i] = adtSpot[i]; - adblCleanPriceCompute[i] = adblCleanPrice[i]; - - aadblComputeYield[i][0] = mapTreasuryMark02Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][1] = mapTreasuryMark03Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][2] = mapTreasuryMark04Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][3] = mapTreasuryMark05Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][4] = mapTreasuryMark07Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][5] = mapTreasuryMark10Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][6] = mapTreasuryMark20Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][7] = mapTreasuryMark30Y.get (adtSpotCompute[i]); - } - - List lsTDNM = TreasuryFuturesAPI.HorizonKeyRateDuration ( - strTreasuryCode, - adtEffectiveCompute, - adtMaturityCompute, - adblCouponCompute, - adtExpiryCompute, - adtSpotCompute, - adblCleanPriceCompute, - astrBenchmarkTenor, - aadblComputeYield - ); - - System.out.println ("SpotDate,ExpiryDate,CTDName,SpotCTDCleanPrice,ExpiryCTDCleanPrice,SpotGSpread,ExpiryGSpread,SpotYield,ExpiryYield,Parallel,2Y,3Y,4Y,5Y,7Y,10Y,20Y,30Y"); - - for (TenorDurationNodeMetrics tdnm : lsTDNM) { - String strTDNM = - tdnm.dateSnap() + "," + - tdnm.date ("ExpiryDate") + "," + - tdnm.c1 ("CTDName") + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ParallelKRD"), 1, 4, 1.); - - for (Map.Entry meTDNM : tdnm.krdMap().entrySet()) - strTDNM += "," + FormatUtil.FormatDouble (meTDNM.getValue(), 1, 4, 1.); - - System.out.println (strTDNM); - } - } -} diff --git a/org/drip/sample/treasuryfuturesrisk/RX1KeyRateDuration.java b/org/drip/sample/treasuryfuturesrisk/RX1KeyRateDuration.java deleted file mode 100644 index 27a5ba5..0000000 --- a/org/drip/sample/treasuryfuturesrisk/RX1KeyRateDuration.java +++ /dev/null @@ -1,239 +0,0 @@ - -package org.drip.sample.treasuryfuturesrisk; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.sensitivity.TenorDurationNodeMetrics; -import org.drip.market.exchange.*; -import org.drip.market.issue.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * RX1KeyRateDuration demonstrates the Computation of the Key Rate Duration for the RX1 Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class RX1KeyRateDuration { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strFuturesCode = "RX1"; - - TreasuryFuturesContract tfc = TreasuryFuturesContractContainer.TreasuryFuturesContract (strFuturesCode); - - String strTreasuryCode = tfc.code(); - - TreasurySetting ts = TreasurySettingContainer.TreasurySetting (strTreasuryCode); - - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\" + - TreasurySettingContainer.CurrencyBenchmarkCode (ts.currency()) + "BenchmarksReconstituted.csv"; - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\" + - strFuturesCode + "ClosesReconstitutor.csv"; - - CSVGrid csvGridTreasuryMark = CSVParser.StringGrid ( - strTreasuryMarkLocation, - true - ); - - JulianDate[] adtTreasuryMark = csvGridTreasuryMark.dateArrayAtColumn (0); - - double[] adblYield02Y = csvGridTreasuryMark.doubleArrayAtColumn (1); - - double[] adblYield03Y = csvGridTreasuryMark.doubleArrayAtColumn (2); - - double[] adblYield04Y = csvGridTreasuryMark.doubleArrayAtColumn (3); - - double[] adblYield05Y = csvGridTreasuryMark.doubleArrayAtColumn (4); - - double[] adblYield07Y = csvGridTreasuryMark.doubleArrayAtColumn (5); - - double[] adblYield10Y = csvGridTreasuryMark.doubleArrayAtColumn (6); - - double[] adblYield20Y = csvGridTreasuryMark.doubleArrayAtColumn (7); - - double[] adblYield30Y = csvGridTreasuryMark.doubleArrayAtColumn (8); - - Map mapTreasuryMark02Y = new TreeMap(); - - Map mapTreasuryMark03Y = new TreeMap(); - - Map mapTreasuryMark04Y = new TreeMap(); - - Map mapTreasuryMark05Y = new TreeMap(); - - Map mapTreasuryMark07Y = new TreeMap(); - - Map mapTreasuryMark10Y = new TreeMap(); - - Map mapTreasuryMark20Y = new TreeMap(); - - Map mapTreasuryMark30Y = new TreeMap(); - - for (int i = 0; i < adtTreasuryMark.length; ++i) { - mapTreasuryMark02Y.put (adtTreasuryMark[i], adblYield02Y[i]); - - mapTreasuryMark03Y.put (adtTreasuryMark[i], adblYield03Y[i]); - - mapTreasuryMark04Y.put (adtTreasuryMark[i], adblYield04Y[i]); - - mapTreasuryMark05Y.put (adtTreasuryMark[i], adblYield05Y[i]); - - mapTreasuryMark07Y.put (adtTreasuryMark[i], adblYield07Y[i]); - - mapTreasuryMark10Y.put (adtTreasuryMark[i], adblYield10Y[i]); - - mapTreasuryMark20Y.put (adtTreasuryMark[i], adblYield20Y[i]); - - mapTreasuryMark30Y.put (adtTreasuryMark[i], adblYield30Y[i]); - } - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - int iNumCompute = adtSpot.length; - JulianDate[] adtEffectiveCompute = new JulianDate[iNumCompute]; - JulianDate[] adtMaturityCompute = new JulianDate[iNumCompute]; - double[] adblCouponCompute = new double[iNumCompute]; - JulianDate[] adtExpiryCompute = new JulianDate[iNumCompute]; - JulianDate[] adtSpotCompute = new JulianDate[iNumCompute]; - double[] adblCleanPriceCompute = new double[iNumCompute]; - double[][] aadblComputeYield = new double[iNumCompute][8]; - String[] astrBenchmarkTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - for (int i = 0; i < iNumCompute; ++i) { - adtEffectiveCompute[i] = adtEffective[i]; - adtMaturityCompute[i] = adtMaturity[i]; - adblCouponCompute[i] = adblCoupon[i]; - adtExpiryCompute[i] = adtExpiry[i]; - adtSpotCompute[i] = adtSpot[i]; - adblCleanPriceCompute[i] = adblCleanPrice[i]; - - aadblComputeYield[i][0] = mapTreasuryMark02Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][1] = mapTreasuryMark03Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][2] = mapTreasuryMark04Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][3] = mapTreasuryMark05Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][4] = mapTreasuryMark07Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][5] = mapTreasuryMark10Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][6] = mapTreasuryMark20Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][7] = mapTreasuryMark30Y.get (adtSpotCompute[i]); - } - - List lsTDNM = TreasuryFuturesAPI.HorizonKeyRateDuration ( - strTreasuryCode, - adtEffectiveCompute, - adtMaturityCompute, - adblCouponCompute, - adtExpiryCompute, - adtSpotCompute, - adblCleanPriceCompute, - astrBenchmarkTenor, - aadblComputeYield - ); - - System.out.println ("SpotDate,ExpiryDate,CTDName,SpotCTDCleanPrice,ExpiryCTDCleanPrice,SpotGSpread,ExpiryGSpread,SpotYield,ExpiryYield,Parallel,2Y,3Y,4Y,5Y,7Y,10Y,20Y,30Y"); - - for (TenorDurationNodeMetrics tdnm : lsTDNM) { - String strTDNM = - tdnm.dateSnap() + "," + - tdnm.date ("ExpiryDate") + "," + - tdnm.c1 ("CTDName") + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ParallelKRD"), 1, 4, 1.); - - for (Map.Entry meTDNM : tdnm.krdMap().entrySet()) - strTDNM += "," + FormatUtil.FormatDouble (meTDNM.getValue(), 1, 4, 1.); - - System.out.println (strTDNM); - } - } -} diff --git a/org/drip/sample/treasuryfuturesrisk/TU1KeyRateDuration.java b/org/drip/sample/treasuryfuturesrisk/TU1KeyRateDuration.java deleted file mode 100644 index c1d98a4..0000000 --- a/org/drip/sample/treasuryfuturesrisk/TU1KeyRateDuration.java +++ /dev/null @@ -1,234 +0,0 @@ - -package org.drip.sample.treasuryfuturesrisk; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.sensitivity.TenorDurationNodeMetrics; -import org.drip.market.exchange.TreasuryFuturesContractContainer; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TU1KeyRateDuration demonstrates the Computation of the Key Rate Duration for the TU1 Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class TU1KeyRateDuration { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strFuturesCode = "TU1"; - - String strTreasuryCode = TreasuryFuturesContractContainer.TreasuryFuturesContract (strFuturesCode).code(); - - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\" + strTreasuryCode + - "BenchmarksReconstituted.csv"; - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\" + - strFuturesCode + "ClosesReconstitutor.csv"; - - CSVGrid csvGridTreasuryMark = CSVParser.StringGrid ( - strTreasuryMarkLocation, - true - ); - - JulianDate[] adtTreasuryMark = csvGridTreasuryMark.dateArrayAtColumn (0); - - double[] adblYield02Y = csvGridTreasuryMark.doubleArrayAtColumn (1); - - double[] adblYield03Y = csvGridTreasuryMark.doubleArrayAtColumn (2); - - double[] adblYield04Y = csvGridTreasuryMark.doubleArrayAtColumn (3); - - double[] adblYield05Y = csvGridTreasuryMark.doubleArrayAtColumn (4); - - double[] adblYield07Y = csvGridTreasuryMark.doubleArrayAtColumn (5); - - double[] adblYield10Y = csvGridTreasuryMark.doubleArrayAtColumn (6); - - double[] adblYield20Y = csvGridTreasuryMark.doubleArrayAtColumn (7); - - double[] adblYield30Y = csvGridTreasuryMark.doubleArrayAtColumn (8); - - Map mapTreasuryMark02Y = new TreeMap(); - - Map mapTreasuryMark03Y = new TreeMap(); - - Map mapTreasuryMark04Y = new TreeMap(); - - Map mapTreasuryMark05Y = new TreeMap(); - - Map mapTreasuryMark07Y = new TreeMap(); - - Map mapTreasuryMark10Y = new TreeMap(); - - Map mapTreasuryMark20Y = new TreeMap(); - - Map mapTreasuryMark30Y = new TreeMap(); - - for (int i = 0; i < adtTreasuryMark.length; ++i) { - mapTreasuryMark02Y.put (adtTreasuryMark[i], adblYield02Y[i]); - - mapTreasuryMark03Y.put (adtTreasuryMark[i], adblYield03Y[i]); - - mapTreasuryMark04Y.put (adtTreasuryMark[i], adblYield04Y[i]); - - mapTreasuryMark05Y.put (adtTreasuryMark[i], adblYield05Y[i]); - - mapTreasuryMark07Y.put (adtTreasuryMark[i], adblYield07Y[i]); - - mapTreasuryMark10Y.put (adtTreasuryMark[i], adblYield10Y[i]); - - mapTreasuryMark20Y.put (adtTreasuryMark[i], adblYield20Y[i]); - - mapTreasuryMark30Y.put (adtTreasuryMark[i], adblYield30Y[i]); - } - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - int iNumCompute = adtSpot.length; - JulianDate[] adtEffectiveCompute = new JulianDate[iNumCompute]; - JulianDate[] adtMaturityCompute = new JulianDate[iNumCompute]; - double[] adblCouponCompute = new double[iNumCompute]; - JulianDate[] adtExpiryCompute = new JulianDate[iNumCompute]; - JulianDate[] adtSpotCompute = new JulianDate[iNumCompute]; - double[] adblCleanPriceCompute = new double[iNumCompute]; - double[][] aadblComputeYield = new double[iNumCompute][8]; - String[] astrBenchmarkTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - for (int i = 0; i < iNumCompute; ++i) { - adtEffectiveCompute[i] = adtEffective[i]; - adtMaturityCompute[i] = adtMaturity[i]; - adblCouponCompute[i] = adblCoupon[i]; - adtExpiryCompute[i] = adtExpiry[i]; - adtSpotCompute[i] = adtSpot[i]; - adblCleanPriceCompute[i] = adblCleanPrice[i]; - - aadblComputeYield[i][0] = mapTreasuryMark02Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][1] = mapTreasuryMark03Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][2] = mapTreasuryMark04Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][3] = mapTreasuryMark05Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][4] = mapTreasuryMark07Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][5] = mapTreasuryMark10Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][6] = mapTreasuryMark20Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][7] = mapTreasuryMark30Y.get (adtSpotCompute[i]); - } - - List lsTDNM = TreasuryFuturesAPI.HorizonKeyRateDuration ( - strTreasuryCode, - adtEffectiveCompute, - adtMaturityCompute, - adblCouponCompute, - adtExpiryCompute, - adtSpotCompute, - adblCleanPriceCompute, - astrBenchmarkTenor, - aadblComputeYield - ); - - System.out.println ("SpotDate,ExpiryDate,CTDName,SpotCTDCleanPrice,ExpiryCTDCleanPrice,SpotGSpread,ExpiryGSpread,SpotYield,ExpiryYield,Parallel,2Y,3Y,4Y,5Y,7Y,10Y,20Y,30Y"); - - for (TenorDurationNodeMetrics tdnm : lsTDNM) { - String strTDNM = - tdnm.dateSnap() + "," + - tdnm.date ("ExpiryDate") + "," + - tdnm.c1 ("CTDName") + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ParallelKRD"), 1, 4, 1.); - - for (Map.Entry meTDNM : tdnm.krdMap().entrySet()) - strTDNM += "," + FormatUtil.FormatDouble (meTDNM.getValue(), 1, 4, 1.); - - System.out.println (strTDNM); - } - } -} diff --git a/org/drip/sample/treasuryfuturesrisk/TY1KeyRateDuration.java b/org/drip/sample/treasuryfuturesrisk/TY1KeyRateDuration.java deleted file mode 100644 index c1cfdd5..0000000 --- a/org/drip/sample/treasuryfuturesrisk/TY1KeyRateDuration.java +++ /dev/null @@ -1,234 +0,0 @@ - -package org.drip.sample.treasuryfuturesrisk; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.sensitivity.TenorDurationNodeMetrics; -import org.drip.market.exchange.TreasuryFuturesContractContainer; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TY1KeyRateDuration demonstrates the Computation of the Key Rate Duration for the TY1 Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class TY1KeyRateDuration { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strFuturesCode = "TY1"; - - String strTreasuryCode = TreasuryFuturesContractContainer.TreasuryFuturesContract (strFuturesCode).code(); - - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\" + strTreasuryCode + - "BenchmarksReconstituted.csv"; - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\" + - strFuturesCode + "ClosesReconstitutor.csv"; - - CSVGrid csvGridTreasuryMark = CSVParser.StringGrid ( - strTreasuryMarkLocation, - true - ); - - JulianDate[] adtTreasuryMark = csvGridTreasuryMark.dateArrayAtColumn (0); - - double[] adblYield02Y = csvGridTreasuryMark.doubleArrayAtColumn (1); - - double[] adblYield03Y = csvGridTreasuryMark.doubleArrayAtColumn (2); - - double[] adblYield04Y = csvGridTreasuryMark.doubleArrayAtColumn (3); - - double[] adblYield05Y = csvGridTreasuryMark.doubleArrayAtColumn (4); - - double[] adblYield07Y = csvGridTreasuryMark.doubleArrayAtColumn (5); - - double[] adblYield10Y = csvGridTreasuryMark.doubleArrayAtColumn (6); - - double[] adblYield20Y = csvGridTreasuryMark.doubleArrayAtColumn (7); - - double[] adblYield30Y = csvGridTreasuryMark.doubleArrayAtColumn (8); - - Map mapTreasuryMark02Y = new TreeMap(); - - Map mapTreasuryMark03Y = new TreeMap(); - - Map mapTreasuryMark04Y = new TreeMap(); - - Map mapTreasuryMark05Y = new TreeMap(); - - Map mapTreasuryMark07Y = new TreeMap(); - - Map mapTreasuryMark10Y = new TreeMap(); - - Map mapTreasuryMark20Y = new TreeMap(); - - Map mapTreasuryMark30Y = new TreeMap(); - - for (int i = 0; i < adtTreasuryMark.length; ++i) { - mapTreasuryMark02Y.put (adtTreasuryMark[i], adblYield02Y[i]); - - mapTreasuryMark03Y.put (adtTreasuryMark[i], adblYield03Y[i]); - - mapTreasuryMark04Y.put (adtTreasuryMark[i], adblYield04Y[i]); - - mapTreasuryMark05Y.put (adtTreasuryMark[i], adblYield05Y[i]); - - mapTreasuryMark07Y.put (adtTreasuryMark[i], adblYield07Y[i]); - - mapTreasuryMark10Y.put (adtTreasuryMark[i], adblYield10Y[i]); - - mapTreasuryMark20Y.put (adtTreasuryMark[i], adblYield20Y[i]); - - mapTreasuryMark30Y.put (adtTreasuryMark[i], adblYield30Y[i]); - } - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - int iNumCompute = adtSpot.length; - JulianDate[] adtEffectiveCompute = new JulianDate[iNumCompute]; - JulianDate[] adtMaturityCompute = new JulianDate[iNumCompute]; - double[] adblCouponCompute = new double[iNumCompute]; - JulianDate[] adtExpiryCompute = new JulianDate[iNumCompute]; - JulianDate[] adtSpotCompute = new JulianDate[iNumCompute]; - double[] adblCleanPriceCompute = new double[iNumCompute]; - double[][] aadblComputeYield = new double[iNumCompute][8]; - String[] astrBenchmarkTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - for (int i = 0; i < iNumCompute; ++i) { - adtEffectiveCompute[i] = adtEffective[i]; - adtMaturityCompute[i] = adtMaturity[i]; - adblCouponCompute[i] = adblCoupon[i]; - adtExpiryCompute[i] = adtExpiry[i]; - adtSpotCompute[i] = adtSpot[i]; - adblCleanPriceCompute[i] = adblCleanPrice[i]; - - aadblComputeYield[i][0] = mapTreasuryMark02Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][1] = mapTreasuryMark03Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][2] = mapTreasuryMark04Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][3] = mapTreasuryMark05Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][4] = mapTreasuryMark07Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][5] = mapTreasuryMark10Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][6] = mapTreasuryMark20Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][7] = mapTreasuryMark30Y.get (adtSpotCompute[i]); - } - - List lsTDNM = TreasuryFuturesAPI.HorizonKeyRateDuration ( - strTreasuryCode, - adtEffectiveCompute, - adtMaturityCompute, - adblCouponCompute, - adtExpiryCompute, - adtSpotCompute, - adblCleanPriceCompute, - astrBenchmarkTenor, - aadblComputeYield - ); - - System.out.println ("SpotDate,ExpiryDate,CTDName,SpotCTDCleanPrice,ExpiryCTDCleanPrice,SpotGSpread,ExpiryGSpread,SpotYield,ExpiryYield,Parallel,2Y,3Y,4Y,5Y,7Y,10Y,20Y,30Y"); - - for (TenorDurationNodeMetrics tdnm : lsTDNM) { - String strTDNM = - tdnm.dateSnap() + "," + - tdnm.date ("ExpiryDate") + "," + - tdnm.c1 ("CTDName") + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ParallelKRD"), 1, 4, 1.); - - for (Map.Entry meTDNM : tdnm.krdMap().entrySet()) - strTDNM += "," + FormatUtil.FormatDouble (meTDNM.getValue(), 1, 4, 1.); - - System.out.println (strTDNM); - } - } -} diff --git a/org/drip/sample/treasuryfuturesrisk/UB1KeyRateDuration.java b/org/drip/sample/treasuryfuturesrisk/UB1KeyRateDuration.java deleted file mode 100644 index 82d0451..0000000 --- a/org/drip/sample/treasuryfuturesrisk/UB1KeyRateDuration.java +++ /dev/null @@ -1,239 +0,0 @@ - -package org.drip.sample.treasuryfuturesrisk; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.sensitivity.TenorDurationNodeMetrics; -import org.drip.market.exchange.*; -import org.drip.market.issue.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * UB1KeyRateDuration demonstrates the Computation of the Key Rate Duration for the UB1 Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class UB1KeyRateDuration { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strFuturesCode = "UB1"; - - TreasuryFuturesContract tfc = TreasuryFuturesContractContainer.TreasuryFuturesContract (strFuturesCode); - - String strTreasuryCode = tfc.code(); - - TreasurySetting ts = TreasurySettingContainer.TreasurySetting (strTreasuryCode); - - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\" + - TreasurySettingContainer.CurrencyBenchmarkCode (ts.currency()) + "BenchmarksReconstituted.csv"; - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\" + - strFuturesCode + "ClosesReconstitutor.csv"; - - CSVGrid csvGridTreasuryMark = CSVParser.StringGrid ( - strTreasuryMarkLocation, - true - ); - - JulianDate[] adtTreasuryMark = csvGridTreasuryMark.dateArrayAtColumn (0); - - double[] adblYield02Y = csvGridTreasuryMark.doubleArrayAtColumn (1); - - double[] adblYield03Y = csvGridTreasuryMark.doubleArrayAtColumn (2); - - double[] adblYield04Y = csvGridTreasuryMark.doubleArrayAtColumn (3); - - double[] adblYield05Y = csvGridTreasuryMark.doubleArrayAtColumn (4); - - double[] adblYield07Y = csvGridTreasuryMark.doubleArrayAtColumn (5); - - double[] adblYield10Y = csvGridTreasuryMark.doubleArrayAtColumn (6); - - double[] adblYield20Y = csvGridTreasuryMark.doubleArrayAtColumn (7); - - double[] adblYield30Y = csvGridTreasuryMark.doubleArrayAtColumn (8); - - Map mapTreasuryMark02Y = new TreeMap(); - - Map mapTreasuryMark03Y = new TreeMap(); - - Map mapTreasuryMark04Y = new TreeMap(); - - Map mapTreasuryMark05Y = new TreeMap(); - - Map mapTreasuryMark07Y = new TreeMap(); - - Map mapTreasuryMark10Y = new TreeMap(); - - Map mapTreasuryMark20Y = new TreeMap(); - - Map mapTreasuryMark30Y = new TreeMap(); - - for (int i = 0; i < adtTreasuryMark.length; ++i) { - mapTreasuryMark02Y.put (adtTreasuryMark[i], adblYield02Y[i]); - - mapTreasuryMark03Y.put (adtTreasuryMark[i], adblYield03Y[i]); - - mapTreasuryMark04Y.put (adtTreasuryMark[i], adblYield04Y[i]); - - mapTreasuryMark05Y.put (adtTreasuryMark[i], adblYield05Y[i]); - - mapTreasuryMark07Y.put (adtTreasuryMark[i], adblYield07Y[i]); - - mapTreasuryMark10Y.put (adtTreasuryMark[i], adblYield10Y[i]); - - mapTreasuryMark20Y.put (adtTreasuryMark[i], adblYield20Y[i]); - - mapTreasuryMark30Y.put (adtTreasuryMark[i], adblYield30Y[i]); - } - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - int iNumCompute = adtSpot.length; - JulianDate[] adtEffectiveCompute = new JulianDate[iNumCompute]; - JulianDate[] adtMaturityCompute = new JulianDate[iNumCompute]; - double[] adblCouponCompute = new double[iNumCompute]; - JulianDate[] adtExpiryCompute = new JulianDate[iNumCompute]; - JulianDate[] adtSpotCompute = new JulianDate[iNumCompute]; - double[] adblCleanPriceCompute = new double[iNumCompute]; - double[][] aadblComputeYield = new double[iNumCompute][8]; - String[] astrBenchmarkTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - for (int i = 0; i < iNumCompute; ++i) { - adtEffectiveCompute[i] = adtEffective[i]; - adtMaturityCompute[i] = adtMaturity[i]; - adblCouponCompute[i] = adblCoupon[i]; - adtExpiryCompute[i] = adtExpiry[i]; - adtSpotCompute[i] = adtSpot[i]; - adblCleanPriceCompute[i] = adblCleanPrice[i]; - - aadblComputeYield[i][0] = mapTreasuryMark02Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][1] = mapTreasuryMark03Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][2] = mapTreasuryMark04Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][3] = mapTreasuryMark05Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][4] = mapTreasuryMark07Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][5] = mapTreasuryMark10Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][6] = mapTreasuryMark20Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][7] = mapTreasuryMark30Y.get (adtSpotCompute[i]); - } - - List lsTDNM = TreasuryFuturesAPI.HorizonKeyRateDuration ( - strTreasuryCode, - adtEffectiveCompute, - adtMaturityCompute, - adblCouponCompute, - adtExpiryCompute, - adtSpotCompute, - adblCleanPriceCompute, - astrBenchmarkTenor, - aadblComputeYield - ); - - System.out.println ("SpotDate,ExpiryDate,CTDName,SpotCTDCleanPrice,ExpiryCTDCleanPrice,SpotGSpread,ExpiryGSpread,SpotYield,ExpiryYield,Parallel,2Y,3Y,4Y,5Y,7Y,10Y,20Y,30Y"); - - for (TenorDurationNodeMetrics tdnm : lsTDNM) { - String strTDNM = - tdnm.dateSnap() + "," + - tdnm.date ("ExpiryDate") + "," + - tdnm.c1 ("CTDName") + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ParallelKRD"), 1, 4, 1.); - - for (Map.Entry meTDNM : tdnm.krdMap().entrySet()) - strTDNM += "," + FormatUtil.FormatDouble (meTDNM.getValue(), 1, 4, 1.); - - System.out.println (strTDNM); - } - } -} diff --git a/org/drip/sample/treasuryfuturesrisk/US1KeyRateDuration.java b/org/drip/sample/treasuryfuturesrisk/US1KeyRateDuration.java deleted file mode 100644 index d4c5daf..0000000 --- a/org/drip/sample/treasuryfuturesrisk/US1KeyRateDuration.java +++ /dev/null @@ -1,234 +0,0 @@ - -package org.drip.sample.treasuryfuturesrisk; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.sensitivity.TenorDurationNodeMetrics; -import org.drip.market.exchange.TreasuryFuturesContractContainer; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * US1KeyRateDuration demonstrates the Computation of the Key Rate Duration for the US1 Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class US1KeyRateDuration { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strFuturesCode = "US1"; - - String strTreasuryCode = TreasuryFuturesContractContainer.TreasuryFuturesContract (strFuturesCode).code(); - - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\" + strTreasuryCode + - "BenchmarksReconstituted.csv"; - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\" + - strFuturesCode + "ClosesReconstitutor.csv"; - - CSVGrid csvGridTreasuryMark = CSVParser.StringGrid ( - strTreasuryMarkLocation, - true - ); - - JulianDate[] adtTreasuryMark = csvGridTreasuryMark.dateArrayAtColumn (0); - - double[] adblYield02Y = csvGridTreasuryMark.doubleArrayAtColumn (1); - - double[] adblYield03Y = csvGridTreasuryMark.doubleArrayAtColumn (2); - - double[] adblYield04Y = csvGridTreasuryMark.doubleArrayAtColumn (3); - - double[] adblYield05Y = csvGridTreasuryMark.doubleArrayAtColumn (4); - - double[] adblYield07Y = csvGridTreasuryMark.doubleArrayAtColumn (5); - - double[] adblYield10Y = csvGridTreasuryMark.doubleArrayAtColumn (6); - - double[] adblYield20Y = csvGridTreasuryMark.doubleArrayAtColumn (7); - - double[] adblYield30Y = csvGridTreasuryMark.doubleArrayAtColumn (8); - - Map mapTreasuryMark02Y = new TreeMap(); - - Map mapTreasuryMark03Y = new TreeMap(); - - Map mapTreasuryMark04Y = new TreeMap(); - - Map mapTreasuryMark05Y = new TreeMap(); - - Map mapTreasuryMark07Y = new TreeMap(); - - Map mapTreasuryMark10Y = new TreeMap(); - - Map mapTreasuryMark20Y = new TreeMap(); - - Map mapTreasuryMark30Y = new TreeMap(); - - for (int i = 0; i < adtTreasuryMark.length; ++i) { - mapTreasuryMark02Y.put (adtTreasuryMark[i], adblYield02Y[i]); - - mapTreasuryMark03Y.put (adtTreasuryMark[i], adblYield03Y[i]); - - mapTreasuryMark04Y.put (adtTreasuryMark[i], adblYield04Y[i]); - - mapTreasuryMark05Y.put (adtTreasuryMark[i], adblYield05Y[i]); - - mapTreasuryMark07Y.put (adtTreasuryMark[i], adblYield07Y[i]); - - mapTreasuryMark10Y.put (adtTreasuryMark[i], adblYield10Y[i]); - - mapTreasuryMark20Y.put (adtTreasuryMark[i], adblYield20Y[i]); - - mapTreasuryMark30Y.put (adtTreasuryMark[i], adblYield30Y[i]); - } - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - int iNumCompute = adtSpot.length; - JulianDate[] adtEffectiveCompute = new JulianDate[iNumCompute]; - JulianDate[] adtMaturityCompute = new JulianDate[iNumCompute]; - double[] adblCouponCompute = new double[iNumCompute]; - JulianDate[] adtExpiryCompute = new JulianDate[iNumCompute]; - JulianDate[] adtSpotCompute = new JulianDate[iNumCompute]; - double[] adblCleanPriceCompute = new double[iNumCompute]; - double[][] aadblComputeYield = new double[iNumCompute][8]; - String[] astrBenchmarkTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - for (int i = 0; i < iNumCompute; ++i) { - adtEffectiveCompute[i] = adtEffective[i]; - adtMaturityCompute[i] = adtMaturity[i]; - adblCouponCompute[i] = adblCoupon[i]; - adtExpiryCompute[i] = adtExpiry[i]; - adtSpotCompute[i] = adtSpot[i]; - adblCleanPriceCompute[i] = adblCleanPrice[i]; - - aadblComputeYield[i][0] = mapTreasuryMark02Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][1] = mapTreasuryMark03Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][2] = mapTreasuryMark04Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][3] = mapTreasuryMark05Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][4] = mapTreasuryMark07Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][5] = mapTreasuryMark10Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][6] = mapTreasuryMark20Y.get (adtSpotCompute[i]); - - aadblComputeYield[i][7] = mapTreasuryMark30Y.get (adtSpotCompute[i]); - } - - List lsTDNM = TreasuryFuturesAPI.HorizonKeyRateDuration ( - strTreasuryCode, - adtEffectiveCompute, - adtMaturityCompute, - adblCouponCompute, - adtExpiryCompute, - adtSpotCompute, - adblCleanPriceCompute, - astrBenchmarkTenor, - aadblComputeYield - ); - - System.out.println ("SpotDate,ExpiryDate,CTDName,SpotCTDCleanPrice,ExpiryCTDCleanPrice,SpotGSpread,ExpiryGSpread,SpotYield,ExpiryYield,Parallel,2Y,3Y,4Y,5Y,7Y,10Y,20Y,30Y"); - - for (TenorDurationNodeMetrics tdnm : lsTDNM) { - String strTDNM = - tdnm.dateSnap() + "," + - tdnm.date ("ExpiryDate") + "," + - tdnm.c1 ("CTDName") + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ParallelKRD"), 1, 4, 1.); - - for (Map.Entry meTDNM : tdnm.krdMap().entrySet()) - strTDNM += "," + FormatUtil.FormatDouble (meTDNM.getValue(), 1, 4, 1.); - - System.out.println (strTDNM); - } - } -} diff --git a/org/drip/sample/treasuryfuturesrisk/WN1KeyRateDuration.java b/org/drip/sample/treasuryfuturesrisk/WN1KeyRateDuration.java deleted file mode 100644 index a88fa7b..0000000 --- a/org/drip/sample/treasuryfuturesrisk/WN1KeyRateDuration.java +++ /dev/null @@ -1,221 +0,0 @@ - -package org.drip.sample.treasuryfuturesrisk; - -import java.util.*; - -import org.drip.analytics.date.JulianDate; -import org.drip.feed.loader.*; -import org.drip.historical.sensitivity.TenorDurationNodeMetrics; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.product.TreasuryFuturesAPI; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * WN1KeyRateDuration demonstrates the Computation of the Key Rate Duration for the WN1 Treasury Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class WN1KeyRateDuration { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strTreasuryCode = "WN1"; - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\USTBenchmarksReconstituted.csv"; - String strPrintLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryFuturesCloses\\" + - strTreasuryCode + "ClosesReconstitutor.csv"; - - CSVGrid csvGridTreasuryMark = CSVParser.StringGrid ( - strTreasuryMarkLocation, - true - ); - - JulianDate[] adtTreasuryMark = csvGridTreasuryMark.dateArrayAtColumn (0); - - double[] adblYieldUST02Y = csvGridTreasuryMark.doubleArrayAtColumn (1); - - double[] adblYieldUST03Y = csvGridTreasuryMark.doubleArrayAtColumn (2); - - double[] adblYieldUST04Y = csvGridTreasuryMark.doubleArrayAtColumn (3); - - double[] adblYieldUST05Y = csvGridTreasuryMark.doubleArrayAtColumn (4); - - double[] adblYieldUST07Y = csvGridTreasuryMark.doubleArrayAtColumn (5); - - double[] adblYieldUST10Y = csvGridTreasuryMark.doubleArrayAtColumn (6); - - double[] adblYieldUST20Y = csvGridTreasuryMark.doubleArrayAtColumn (7); - - double[] adblYieldUST30Y = csvGridTreasuryMark.doubleArrayAtColumn (8); - - Map mapTreasuryMark02Y = new TreeMap(); - - Map mapTreasuryMark03Y = new TreeMap(); - - Map mapTreasuryMark04Y = new TreeMap(); - - Map mapTreasuryMark05Y = new TreeMap(); - - Map mapTreasuryMark07Y = new TreeMap(); - - Map mapTreasuryMark10Y = new TreeMap(); - - Map mapTreasuryMark20Y = new TreeMap(); - - Map mapTreasuryMark30Y = new TreeMap(); - - for (int i = 0; i < adtTreasuryMark.length; ++i) { - mapTreasuryMark02Y.put (adtTreasuryMark[i], adblYieldUST02Y[i]); - - mapTreasuryMark03Y.put (adtTreasuryMark[i], adblYieldUST03Y[i]); - - mapTreasuryMark04Y.put (adtTreasuryMark[i], adblYieldUST04Y[i]); - - mapTreasuryMark05Y.put (adtTreasuryMark[i], adblYieldUST05Y[i]); - - mapTreasuryMark07Y.put (adtTreasuryMark[i], adblYieldUST07Y[i]); - - mapTreasuryMark10Y.put (adtTreasuryMark[i], adblYieldUST10Y[i]); - - mapTreasuryMark20Y.put (adtTreasuryMark[i], adblYieldUST20Y[i]); - - mapTreasuryMark30Y.put (adtTreasuryMark[i], adblYieldUST30Y[i]); - } - - CSVGrid csvGrid = CSVParser.StringGrid ( - strPrintLocation, - true - ); - - JulianDate[] adtSpot = csvGrid.dateArrayAtColumn (0); - - double[] adblCleanPrice = csvGrid.doubleArrayAtColumn (2); - - double[] adblCoupon = csvGrid.doubleArrayAtColumn (3); - - JulianDate[] adtEffective = csvGrid.dateArrayAtColumn (4); - - JulianDate[] adtMaturity = csvGrid.dateArrayAtColumn (5); - - JulianDate[] adtExpiry = csvGrid.dateArrayAtColumn (6); - - int iNumCompute = adtSpot.length; - JulianDate[] adtEffectiveCompute = new JulianDate[iNumCompute]; - JulianDate[] adtMaturityCompute = new JulianDate[iNumCompute]; - double[] adblCouponCompute = new double[iNumCompute]; - JulianDate[] adtExpiryCompute = new JulianDate[iNumCompute]; - JulianDate[] adtSpotCompute = new JulianDate[iNumCompute]; - double[] adblCleanPriceCompute = new double[iNumCompute]; - double[][] aadblUSTComputeYield = new double[iNumCompute][8]; - String[] astrBenchmarkTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - for (int i = 0; i < iNumCompute; ++i) { - adtEffectiveCompute[i] = adtEffective[i]; - adtMaturityCompute[i] = adtMaturity[i]; - adblCouponCompute[i] = adblCoupon[i]; - adtExpiryCompute[i] = adtExpiry[i]; - adtSpotCompute[i] = adtSpot[i]; - adblCleanPriceCompute[i] = adblCleanPrice[i]; - aadblUSTComputeYield[i][0] = adblYieldUST02Y[i]; - aadblUSTComputeYield[i][1] = adblYieldUST03Y[i]; - aadblUSTComputeYield[i][2] = adblYieldUST04Y[i]; - aadblUSTComputeYield[i][3] = adblYieldUST05Y[i]; - aadblUSTComputeYield[i][4] = adblYieldUST07Y[i]; - aadblUSTComputeYield[i][5] = adblYieldUST10Y[i]; - aadblUSTComputeYield[i][6] = adblYieldUST20Y[i]; - aadblUSTComputeYield[i][7] = adblYieldUST30Y[i]; - } - - List lsTDNM = TreasuryFuturesAPI.HorizonKeyRateDuration ( - "UST", - adtEffectiveCompute, - adtMaturityCompute, - adblCouponCompute, - adtExpiryCompute, - adtSpotCompute, - adblCleanPriceCompute, - astrBenchmarkTenor, - aadblUSTComputeYield - ); - - System.out.println ("SpotDate,ExpiryDate,CTDName,SpotCTDCleanPrice,ExpiryCTDCleanPrice,SpotGSpread,ExpiryGSpread,SpotYield,ExpiryYield,Parallel,2Y,3Y,4Y,5Y,7Y,10Y,20Y,30Y"); - - for (TenorDurationNodeMetrics tdnm : lsTDNM) { - String strTDNM = - tdnm.dateSnap() + "," + - tdnm.date ("ExpiryDate") + "," + - tdnm.c1 ("CTDName") + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryCTDCleanPrice"), 1, 5, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryGSpread"), 1, 1, 10000.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("SpotYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ExpiryYield"), 1, 4, 100.) + "," + - FormatUtil.FormatDouble (tdnm.r1 ("ParallelKRD"), 1, 4, 1.); - - for (Map.Entry meTDNM : tdnm.krdMap().entrySet()) - strTDNM += "," + FormatUtil.FormatDouble (meTDNM.getValue(), 1, 4, 1.); - - System.out.println (strTDNM); - } - } -} diff --git a/org/drip/sample/treasurypnl/AGBBenchmarkAttribution.java b/org/drip/sample/treasurypnl/AGBBenchmarkAttribution.java deleted file mode 100644 index 6aa75c9..0000000 --- a/org/drip/sample/treasurypnl/AGBBenchmarkAttribution.java +++ /dev/null @@ -1,134 +0,0 @@ - -package org.drip.sample.treasurypnl; - -import org.drip.feed.metric.TreasuryBondPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * AGBBenchmarkAttribution demonstrates the Computation of the PnL Time Series Metrics for the AGB Benchmark - * Bond Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class AGBBenchmarkAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strTreasuryCode = "AGB"; - - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\" + strTreasuryCode + - "BenchmarksReconstituted.csv"; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrGovvieTreasuryTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - int[] aiGovvieTreasuryColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - TreasuryBondPnLAttributor.TenorHorizonExplainComponents ( - astrMaturityTenor, - strTreasuryCode, - aiHorizonGap, - strTreasuryMarkLocation, - astrGovvieTreasuryTenor, - aiGovvieTreasuryColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/treasurypnl/CANBenchmarkAttribution.java b/org/drip/sample/treasurypnl/CANBenchmarkAttribution.java deleted file mode 100644 index 6667407..0000000 --- a/org/drip/sample/treasurypnl/CANBenchmarkAttribution.java +++ /dev/null @@ -1,134 +0,0 @@ - -package org.drip.sample.treasurypnl; - -import org.drip.feed.metric.TreasuryBondPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CANBenchmarkAttribution demonstrates the Computation of the PnL Time Series Metrics for the CAN Benchmark - * Bond Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class CANBenchmarkAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strTreasuryCode = "CAN"; - - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\" + strTreasuryCode + - "BenchmarksReconstituted.csv"; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrGovvieTreasuryTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - int[] aiGovvieTreasuryColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - TreasuryBondPnLAttributor.TenorHorizonExplainComponents ( - astrMaturityTenor, - strTreasuryCode, - aiHorizonGap, - strTreasuryMarkLocation, - astrGovvieTreasuryTenor, - aiGovvieTreasuryColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/treasurypnl/DBRBenchmarkAttribution.java b/org/drip/sample/treasurypnl/DBRBenchmarkAttribution.java deleted file mode 100644 index 3051605..0000000 --- a/org/drip/sample/treasurypnl/DBRBenchmarkAttribution.java +++ /dev/null @@ -1,134 +0,0 @@ - -package org.drip.sample.treasurypnl; - -import org.drip.feed.metric.TreasuryBondPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DBRBenchmarkAttribution demonstrates the Computation of the PnL Time Series Metrics for the DBR Benchmark - * Bond Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class DBRBenchmarkAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strTreasuryCode = "DBR"; - - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\" + strTreasuryCode + - "BenchmarksReconstituted.csv"; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrGovvieTreasuryTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - int[] aiGovvieTreasuryColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - TreasuryBondPnLAttributor.TenorHorizonExplainComponents ( - astrMaturityTenor, - strTreasuryCode, - aiHorizonGap, - strTreasuryMarkLocation, - astrGovvieTreasuryTenor, - aiGovvieTreasuryColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/treasurypnl/DGBBenchmarkAttribution.java b/org/drip/sample/treasurypnl/DGBBenchmarkAttribution.java deleted file mode 100644 index 7bc4605..0000000 --- a/org/drip/sample/treasurypnl/DGBBenchmarkAttribution.java +++ /dev/null @@ -1,134 +0,0 @@ - -package org.drip.sample.treasurypnl; - -import org.drip.feed.metric.TreasuryBondPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DGBBenchmarkAttribution demonstrates the Computation of the PnL Time Series Metrics for the DGB Benchmark - * Bond Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class DGBBenchmarkAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strTreasuryCode = "DGB"; - - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\" + strTreasuryCode + - "BenchmarksReconstituted.csv"; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrGovvieTreasuryTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - int[] aiGovvieTreasuryColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - TreasuryBondPnLAttributor.TenorHorizonExplainComponents ( - astrMaturityTenor, - strTreasuryCode, - aiHorizonGap, - strTreasuryMarkLocation, - astrGovvieTreasuryTenor, - aiGovvieTreasuryColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/treasurypnl/GILTBenchmarkAttribution.java b/org/drip/sample/treasurypnl/GILTBenchmarkAttribution.java deleted file mode 100644 index 8c622a9..0000000 --- a/org/drip/sample/treasurypnl/GILTBenchmarkAttribution.java +++ /dev/null @@ -1,134 +0,0 @@ - -package org.drip.sample.treasurypnl; - -import org.drip.feed.metric.TreasuryBondPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * GILTBenchmarkAttribution demonstrates the Computation of the PnL Time Series Metrics for the GILT - * Benchmark Bond Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class GILTBenchmarkAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strTreasuryCode = "GILT"; - - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\" + strTreasuryCode + - "BenchmarksReconstituted.csv"; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrGovvieTreasuryTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - int[] aiGovvieTreasuryColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - TreasuryBondPnLAttributor.TenorHorizonExplainComponents ( - astrMaturityTenor, - strTreasuryCode, - aiHorizonGap, - strTreasuryMarkLocation, - astrGovvieTreasuryTenor, - aiGovvieTreasuryColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/treasurypnl/GSWISSBenchmarkAttribution.java b/org/drip/sample/treasurypnl/GSWISSBenchmarkAttribution.java deleted file mode 100644 index ce48ae5..0000000 --- a/org/drip/sample/treasurypnl/GSWISSBenchmarkAttribution.java +++ /dev/null @@ -1,134 +0,0 @@ - -package org.drip.sample.treasurypnl; - -import org.drip.feed.metric.TreasuryBondPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * GSWISSBenchmarkAttribution demonstrates the Computation of the PnL Time Series Metrics for the GSWISS - * Benchmark Bond Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class GSWISSBenchmarkAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strTreasuryCode = "GSWISS"; - - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\" + strTreasuryCode + - "BenchmarksReconstituted.csv"; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrGovvieTreasuryTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - int[] aiGovvieTreasuryColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - TreasuryBondPnLAttributor.TenorHorizonExplainComponents ( - astrMaturityTenor, - strTreasuryCode, - aiHorizonGap, - strTreasuryMarkLocation, - astrGovvieTreasuryTenor, - aiGovvieTreasuryColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/treasurypnl/JGBBenchmarkAttribution.java b/org/drip/sample/treasurypnl/JGBBenchmarkAttribution.java deleted file mode 100644 index ac5dcad..0000000 --- a/org/drip/sample/treasurypnl/JGBBenchmarkAttribution.java +++ /dev/null @@ -1,134 +0,0 @@ - -package org.drip.sample.treasurypnl; - -import org.drip.feed.metric.TreasuryBondPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * JGBBenchmarkAttribution demonstrates the Computation of the PnL Time Series Metrics for the JGB Benchmark - * Bond Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class JGBBenchmarkAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strTreasuryCode = "JGB"; - - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\" + strTreasuryCode + - "BenchmarksReconstituted.csv"; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrGovvieTreasuryTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - int[] aiGovvieTreasuryColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - TreasuryBondPnLAttributor.TenorHorizonExplainComponents ( - astrMaturityTenor, - strTreasuryCode, - aiHorizonGap, - strTreasuryMarkLocation, - astrGovvieTreasuryTenor, - aiGovvieTreasuryColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/treasurypnl/NGBBenchmarkAttribution.java b/org/drip/sample/treasurypnl/NGBBenchmarkAttribution.java deleted file mode 100644 index 0212326..0000000 --- a/org/drip/sample/treasurypnl/NGBBenchmarkAttribution.java +++ /dev/null @@ -1,134 +0,0 @@ - -package org.drip.sample.treasurypnl; - -import org.drip.feed.metric.TreasuryBondPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NGBBenchmarkAttribution demonstrates the Computation of the PnL Time Series Metrics for the NGB Benchmark - * Bond Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class NGBBenchmarkAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strTreasuryCode = "NGB"; - - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\" + strTreasuryCode + - "BenchmarksReconstituted.csv"; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrGovvieTreasuryTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - int[] aiGovvieTreasuryColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - TreasuryBondPnLAttributor.TenorHorizonExplainComponents ( - astrMaturityTenor, - strTreasuryCode, - aiHorizonGap, - strTreasuryMarkLocation, - astrGovvieTreasuryTenor, - aiGovvieTreasuryColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/treasurypnl/NZGBBenchmarkAttribution.java b/org/drip/sample/treasurypnl/NZGBBenchmarkAttribution.java deleted file mode 100644 index 6f38410..0000000 --- a/org/drip/sample/treasurypnl/NZGBBenchmarkAttribution.java +++ /dev/null @@ -1,134 +0,0 @@ - -package org.drip.sample.treasurypnl; - -import org.drip.feed.metric.TreasuryBondPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * NZGBBenchmarkAttribution demonstrates the Computation of the PnL Time Series Metrics for the NZGB - * Benchmark Bond Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class NZGBBenchmarkAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strTreasuryCode = "NZGB"; - - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\" + strTreasuryCode + - "BenchmarksReconstituted.csv"; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrGovvieTreasuryTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - int[] aiGovvieTreasuryColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - TreasuryBondPnLAttributor.TenorHorizonExplainComponents ( - astrMaturityTenor, - strTreasuryCode, - aiHorizonGap, - strTreasuryMarkLocation, - astrGovvieTreasuryTenor, - aiGovvieTreasuryColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/treasurypnl/SGBBenchmarkAttribution.java b/org/drip/sample/treasurypnl/SGBBenchmarkAttribution.java deleted file mode 100644 index f0eb627..0000000 --- a/org/drip/sample/treasurypnl/SGBBenchmarkAttribution.java +++ /dev/null @@ -1,134 +0,0 @@ - -package org.drip.sample.treasurypnl; - -import org.drip.feed.metric.TreasuryBondPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * SGBBenchmarkAttribution demonstrates the Computation of the PnL Time Series Metrics for the SGB Benchmark - * Bond Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class SGBBenchmarkAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strTreasuryCode = "SGB"; - - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\" + strTreasuryCode + - "BenchmarksReconstituted.csv"; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrGovvieTreasuryTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - int[] aiGovvieTreasuryColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - TreasuryBondPnLAttributor.TenorHorizonExplainComponents ( - astrMaturityTenor, - strTreasuryCode, - aiHorizonGap, - strTreasuryMarkLocation, - astrGovvieTreasuryTenor, - aiGovvieTreasuryColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/treasurypnl/USTBenchmarkAttribution.java b/org/drip/sample/treasurypnl/USTBenchmarkAttribution.java deleted file mode 100644 index b69c293..0000000 --- a/org/drip/sample/treasurypnl/USTBenchmarkAttribution.java +++ /dev/null @@ -1,134 +0,0 @@ - -package org.drip.sample.treasurypnl; - -import org.drip.feed.metric.TreasuryBondPnLAttributor; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * USTBenchmarkAttribution demonstrates the Computation of the PnL Time Series Metrics for the UST Benchmark - * Bond Series. - * - * @author Lakshmi Krishnamurthy - */ - -public class USTBenchmarkAttribution { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strTreasuryCode = "UST"; - - String strTreasuryMarkLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\TreasuryYieldMarks\\" + strTreasuryCode + - "BenchmarksReconstituted.csv"; - - String[] astrMaturityTenor = new String[] { - "1Y", - "2Y", - "3Y", - "4Y", - "5Y", - "6Y", - "7Y", - "8Y", - "9Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y" - }; - - int[] aiHorizonGap = new int[] { - 1, - // 22, - // 67 - }; - - String[] astrGovvieTreasuryTenor = new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y", - "20Y", - "30Y" - }; - - int[] aiGovvieTreasuryColumn = new int[] { - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8 - }; - - String[] astrRollDownHorizonMap = new String[] { - "1M", - "3M" - }; - - TreasuryBondPnLAttributor.TenorHorizonExplainComponents ( - astrMaturityTenor, - strTreasuryCode, - aiHorizonGap, - strTreasuryMarkLocation, - astrGovvieTreasuryTenor, - aiGovvieTreasuryColumn, - astrRollDownHorizonMap - ); - } -} diff --git a/org/drip/sample/trend/BayesianDriftTrajectoryDependence.java b/org/drip/sample/trend/BayesianDriftTrajectoryDependence.java deleted file mode 100644 index b3c999c..0000000 --- a/org/drip/sample/trend/BayesianDriftTrajectoryDependence.java +++ /dev/null @@ -1,263 +0,0 @@ - -package org.drip.sample.trend; - -import org.drip.execution.bayesian.ConditionalPriceDistribution; -import org.drip.execution.bayesian.PriorConditionalCombiner; -import org.drip.execution.bayesian.PriorDriftDistribution; -import org.drip.execution.cost.LinearTemporaryImpact; -import org.drip.execution.impact.ParticipationRateLinear; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * BayesianDriftTrajectoryDependence demonstrates the Dependence of the Trading Trajectory achieved from - * using an Optimal Trajectory for a Price Process as a Function of the Bayesian Drift Parameters. The - * References are: - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets 1 - * 1-50. - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Brunnermeier, L. K., and L. H. Pedersen (2005): Predatory Trading, Journal of Finance 60 (4) 1825-1863. - * - * - Almgren, R., and J. Lorenz (2006): Bayesian Adaptive Trading with a Daily Cycle, Journal of Trading 1 - * (4) 38-46. - * - * - Kissell, R., and R. Malamut (2007): Algorithmic Decision Making Framework, Journal of Trading 1 (1) - * 12-21. - * - * @author Lakshmi Krishnamurthy - */ - -public class BayesianDriftTrajectoryDependence { - - static final void RunScenario ( - final double dblAlphaBar, - final double dblNu, - final double dblSigma, - final double dblT, - final ParticipationRateLinear prlTemporary) - throws Exception - { - PriorDriftDistribution pdd = new PriorDriftDistribution ( - dblAlphaBar, - dblNu - ); - - double dblTimeWidth = 0.5 * dblT; - - double[] adblAlpha = pdd.realizedDrift (2); - - ConditionalPriceDistribution cpd0 = new ConditionalPriceDistribution ( - adblAlpha[0], - dblSigma, - 1.0 * dblTimeWidth - ); - - double dblPriceSwing0 = cpd0.priceVolatilitySwing(); - - double dblRealizedPriceChange0 = adblAlpha[0] * dblTimeWidth + dblPriceSwing0; - - PriorConditionalCombiner pcc0 = new PriorConditionalCombiner ( - pdd, - cpd0 - ); - - LinearTemporaryImpact lti0 = LinearTemporaryImpact.Unconstrained ( - 1.0 * dblTimeWidth, - dblT, - 1., - pcc0, - dblRealizedPriceChange0, - prlTemporary - ); - - double dblInstantanenousTradeRate0 = lti0.instantaneousTradeRate(); - - double dblX0 = 1. - dblInstantanenousTradeRate0 * dblTimeWidth; - - ConditionalPriceDistribution cpd1 = new ConditionalPriceDistribution ( - adblAlpha[1], - dblSigma, - 2.0 * dblTimeWidth - ); - - double dblPriceSwing1 = cpd1.priceVolatilitySwing(); - - double dblRealizedPriceChange1 = adblAlpha[1] * dblTimeWidth + dblPriceSwing1; - - PriorConditionalCombiner pcc1 = new PriorConditionalCombiner ( - pdd, - cpd1 - ); - - LinearTemporaryImpact lti1 = LinearTemporaryImpact.Unconstrained ( - 1.0 * dblTimeWidth, - dblT, - dblX0, - pcc1, - dblRealizedPriceChange1, - prlTemporary - ); - - double dblInstantanenousTradeRate1 = lti1.instantaneousTradeRate(); - - double dblX1 = 1. - dblInstantanenousTradeRate1 * dblTimeWidth; - - System.out.println ( - "\t|[" + - FormatUtil.FormatDouble (dblAlphaBar, 1, 1, 1.) + "," + - FormatUtil.FormatDouble (dblNu, 1, 1, 1.) + "," + - FormatUtil.FormatDouble (dblSigma, 1, 1, 1.) + "] => " + - FormatUtil.FormatDouble (dblX0, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblX1, 1, 3, 1.) + " || " + - FormatUtil.FormatDouble (dblInstantanenousTradeRate0, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblInstantanenousTradeRate1, 1, 3, 1.) + " || " + - FormatUtil.FormatDouble (lti0.driftExpectationEstimate(), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (lti1.driftExpectationEstimate(), 1, 3, 1.) + " || " + - FormatUtil.FormatDouble (lti0.driftVolatilityEstimate(), 3, 0, 100.) + "% | " + - FormatUtil.FormatDouble (lti1.driftVolatilityEstimate(), 3, 0, 100.) + "% || " - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblT = 1.; - double dblEta = 0.07; - - double[] adblNu = new double[] { - 0.5, - 1.0, - 2.0 - }; - - double[] adblSigma = new double[] { - 0.5, - 1.7, - 2.9 - }; - - double[] adblAlphaBar = new double[] { - 0.2, - 0.7, - 1.2 - }; - - ParticipationRateLinear prlTemporary = ParticipationRateLinear.SlopeOnly (dblEta); - - System.out.println(); - - System.out.println ("\t|-------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| BAYESIAN GAIN INPUT DRIFT DISTRIBUTION DEPENDENCE ||"); - - System.out.println ("\t|-------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| Inputs L -> R: ||"); - - System.out.println ("\t| - Alpha Bar ||"); - - System.out.println ("\t| - Sigma ||"); - - System.out.println ("\t| - Nu ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t|-------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| Outputs L -> R: ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| - Phase #1 Outstanding Holdings ||"); - - System.out.println ("\t| - Phase #2 Outstanding Holdings ||"); - - System.out.println ("\t| - Phase #1 Instantaneous Trade Rate ||"); - - System.out.println ("\t| - Phase #2 Instantaneous Trade Rate ||"); - - System.out.println ("\t| - Phase #1 Drift Expectation Estimate ||"); - - System.out.println ("\t| - Phase #2 Drift Expectation Estimate ||"); - - System.out.println ("\t| - Phase #1 Drift Volatility Estimate ||"); - - System.out.println ("\t| - Phase #2 Drift Volatility Estimate ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t|-------------------------------------------------------------------------------------------||"); - - for (double dblAlphaBar : adblAlphaBar) { - for (double dblNu : adblNu) { - for (double dblSigma : adblSigma) - RunScenario ( - dblAlphaBar, - dblNu, - dblSigma, - dblT, - prlTemporary - ); - } - } - - System.out.println ("\t|-------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/trend/BayesianDriftTransactionDependence.java b/org/drip/sample/trend/BayesianDriftTransactionDependence.java deleted file mode 100644 index 1c3ff76..0000000 --- a/org/drip/sample/trend/BayesianDriftTransactionDependence.java +++ /dev/null @@ -1,254 +0,0 @@ - -package org.drip.sample.trend; - -import org.drip.execution.bayesian.*; -import org.drip.execution.cost.LinearTemporaryImpact; -import org.drip.execution.impact.ParticipationRateLinear; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * BayesianDriftTransactionDependence demonstrates the Gains achieved from using an Optimal Trajectory for a - * Price Process as a Function of the Bayesian Drift Parameters. The References are: - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets 1 - * 1-50. - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Brunnermeier, L. K., and L. H. Pedersen (2005): Predatory Trading, Journal of Finance 60 (4) 1825-1863. - * - * - Almgren, R., and J. Lorenz (2006): Bayesian Adaptive Trading with a Daily Cycle, Journal of Trading 1 - * (4) 38-46. - * - * - Kissell, R., and R. Malamut (2007): Algorithmic Decision Making Framework, Journal of Trading 1 (1) - * 12-21. - * - * @author Lakshmi Krishnamurthy - */ - -public class BayesianDriftTransactionDependence { - - static final void RunScenario ( - final double dblAlphaBar, - final double dblNu, - final double dblSigma, - final double dblT, - final ParticipationRateLinear prlTemporary) - throws Exception - { - PriorDriftDistribution pdd = new PriorDriftDistribution ( - dblAlphaBar, - dblNu - ); - - double dblTimeWidth = 0.5 * dblT; - - double[] adblAlpha = pdd.realizedDrift (2); - - ConditionalPriceDistribution cpd0 = new ConditionalPriceDistribution ( - adblAlpha[0], - dblSigma, - 1.0 * dblTimeWidth - ); - - double dblPriceSwing0 = cpd0.priceVolatilitySwing(); - - double dblRealizedPriceChange0 = adblAlpha[0] * dblTimeWidth + dblPriceSwing0; - - PriorConditionalCombiner pcc0 = new PriorConditionalCombiner ( - pdd, - cpd0 - ); - - LinearTemporaryImpact lti0 = LinearTemporaryImpact.Unconstrained ( - 1.0 * dblTimeWidth, - dblT, - 1., - pcc0, - dblRealizedPriceChange0, - prlTemporary - ); - - double dblX0 = 1. - lti0.instantaneousTradeRate() * dblTimeWidth; - - ConditionalPriceDistribution cpd1 = new ConditionalPriceDistribution ( - adblAlpha[1], - dblSigma, - 2.0 * dblTimeWidth - ); - - double dblPriceSwing1 = cpd1.priceVolatilitySwing(); - - double dblRealizedPriceChange1 = adblAlpha[1] * dblTimeWidth + dblPriceSwing1; - - PriorConditionalCombiner pcc1 = new PriorConditionalCombiner ( - pdd, - cpd1 - ); - - LinearTemporaryImpact lti1 = LinearTemporaryImpact.Unconstrained ( - 1.0 * dblTimeWidth, - dblT, - dblX0, - pcc1, - dblRealizedPriceChange1, - prlTemporary - ); - - System.out.println ( - "\t|[" + - FormatUtil.FormatDouble (dblAlphaBar, 1, 1, 1.) + "," + - FormatUtil.FormatDouble (dblNu, 1, 1, 1.) + "," + - FormatUtil.FormatDouble (dblSigma, 1, 1, 1.) + "] => " + - FormatUtil.FormatDouble (lti0.trajectory().transactionCostExpectation(), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (lti0.trajectory().transactionCostVariance(), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (lti0.staticTransactionCost(), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (lti0.transactionCostGain(), 1, 3, 1.) + " || " + - FormatUtil.FormatDouble (lti1.trajectory().transactionCostExpectation(), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (lti1.trajectory().transactionCostVariance(), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (lti1.staticTransactionCost(), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (lti1.transactionCostGain(), 1, 3, 1.) + " ||" - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - double dblT = 1.; - double dblEta = 0.07; - - double[] adblNu = new double[] { - 0.5, - 1.0, - 2.0 - }; - - double[] adblSigma = new double[] { - 0.5, - 1.7, - 2.9 - }; - - double[] adblAlphaBar = new double[] { - 0.2, - 0.7, - 1.2 - }; - - ParticipationRateLinear prlTemporary = ParticipationRateLinear.SlopeOnly (dblEta); - - System.out.println(); - - System.out.println ("\t|-------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| BAYESIAN GAIN INPUT DRIFT DISTRIBUTION DEPENDENCE ||"); - - System.out.println ("\t|-------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| Inputs L -> R: ||"); - - System.out.println ("\t| - Alpha Bar ||"); - - System.out.println ("\t| - Sigma ||"); - - System.out.println ("\t| - Nu ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t|-------------------------------------------------------------------------------------------||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| Outputs L -> R: ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t| - Phase #1 Transaction Cost Expectation ||"); - - System.out.println ("\t| - Phase #1 Transaction Cost Variance ||"); - - System.out.println ("\t| - Phase #1 Static Transaction Cost ||"); - - System.out.println ("\t| - Phase #1 Transaction Cost Gain ||"); - - System.out.println ("\t| - Phase #2 Transaction Cost Expectation ||"); - - System.out.println ("\t| - Phase #2 Transaction Cost Variance ||"); - - System.out.println ("\t| - Phase #2 Static Transaction Cost ||"); - - System.out.println ("\t| - Phase #2 Transaction Cost Gain ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t|-------------------------------------------------------------------------------------------||"); - - for (double dblAlphaBar : adblAlphaBar) { - for (double dblNu : adblNu) { - for (double dblSigma : adblSigma) - RunScenario ( - dblAlphaBar, - dblNu, - dblSigma, - dblT, - prlTemporary - ); - } - } - - System.out.println ("\t|-------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/trend/BayesianGain.java b/org/drip/sample/trend/BayesianGain.java deleted file mode 100644 index 631bf98..0000000 --- a/org/drip/sample/trend/BayesianGain.java +++ /dev/null @@ -1,178 +0,0 @@ - -package org.drip.sample.trend; - -import org.drip.execution.bayesian.*; -import org.drip.execution.cost.*; -import org.drip.execution.impact.ParticipationRateLinear; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * BayesianGain demonstrates the Gains achieved from using an Optimal Trajectory for a Price Process with - * Bayesian Drift, Arithmetic Volatility, and Linear Temporary Market Impact across a Set of Drifts. The - * References are: - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets 1 - * 1-50. - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Brunnermeier, L. K., and L. H. Pedersen (2005): Predatory Trading, Journal of Finance 60 (4) 1825-1863. - * - * - Almgren, R., and J. Lorenz (2006): Bayesian Adaptive Trading with a Daily Cycle, Journal of Trading 1 - * (4) 38-46. - * - * - Kissell, R., and R. Malamut (2007): Algorithmic Decision Making Framework, Journal of Trading 1 (1) - * 12-21. - * - * @author Lakshmi Krishnamurthy - */ - -public class BayesianGain { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iN = 50; - double dblT = 1.; - double dblX0 = 1.; - double dblNu = 1.; - double dblEta = 0.07; - double dblSigma = 1.5; - double dblAlphaBar = 0.7; - - double dblTime = 0.; - double dblTimeWidth = dblT / iN; - double dblXUnconstrained = dblX0; - - ParticipationRateLinear prlTemporary = ParticipationRateLinear.SlopeOnly (dblEta); - - PriorDriftDistribution pdd = new PriorDriftDistribution ( - dblAlphaBar, - dblNu - ); - - double[] adblAlpha = pdd.realizedDrift (iN); - - System.out.println(); - - System.out.println ("\t|-----------------------------------------------------------------------||"); - - System.out.println ("\t| L -> R ||"); - - System.out.println ("\t|-----------------------------------------------------------------------||"); - - System.out.println ("\t| - Time ||"); - - System.out.println ("\t| - Realized Drift ||"); - - System.out.println ("\t| - Realized Price Change ||"); - - System.out.println ("\t| - Estimated Drift ||"); - - System.out.println ("\t| - Unconstrained Trade Rate ||"); - - System.out.println ("\t| - Unconstrained Holdings ||"); - - System.out.println ("\t| - Transaction Cost ||"); - - System.out.println ("\t| - Transaction Cost Gain ||"); - - System.out.println ("\t|-----------------------------------------------------------------------||"); - - for (int i = 0; i < iN - 1; ++i) { - dblTime = dblTime + dblTimeWidth; - - ConditionalPriceDistribution cpd = new ConditionalPriceDistribution ( - adblAlpha[i], - dblSigma, - dblTime - ); - - double dblPriceSwing = cpd.priceVolatilitySwing(); - - double dblRealizedPriceChange = adblAlpha[i] * dblTimeWidth + dblPriceSwing; - - PriorConditionalCombiner pcc = new PriorConditionalCombiner ( - pdd, - cpd - ); - - LinearTemporaryImpact lti = LinearTemporaryImpact.Unconstrained ( - dblTime, - dblT, - dblXUnconstrained, - pcc, - dblRealizedPriceChange, - prlTemporary - ); - - double dblUnconstrainedInstantaneousTradeRate = lti.instantaneousTradeRate(); - - dblXUnconstrained = dblXUnconstrained - dblUnconstrainedInstantaneousTradeRate * dblTimeWidth; - - System.out.println ( - "\t| " + FormatUtil.FormatDouble (dblTime, 1, 2, 1.) + " => " + - FormatUtil.FormatDouble (adblAlpha[i], 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblRealizedPriceChange, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (lti.driftExpectationEstimate(), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblUnconstrainedInstantaneousTradeRate, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblXUnconstrained, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (lti.staticTransactionCost(), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (lti.transactionCostGain(), 1, 3, 1.) + " ||" - ); - } - - System.out.println ("\t|-----------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/trend/BayesianPriceProcess.java b/org/drip/sample/trend/BayesianPriceProcess.java deleted file mode 100644 index e560f8e..0000000 --- a/org/drip/sample/trend/BayesianPriceProcess.java +++ /dev/null @@ -1,157 +0,0 @@ - -package org.drip.sample.trend; - -import org.drip.execution.bayesian.*; -import org.drip.measure.gaussian.R1UnivariateNormal; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * BayesianPriceProcess demonstrates the Evolution Process for an Asset Price with a Uncertain (Bayesian) - * Drift. The References are: - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets 1 - * 1-50. - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Brunnermeier, L. K., and L. H. Pedersen (2005): Predatory Trading, Journal of Finance 60 (4) 1825-1863. - * - * - Almgren, R., and J. Lorenz (2006): Bayesian Adaptive Trading with a Daily Cycle, Journal of Trading 1 - * (4) 38-46. - * - * - Kissell, R., and R. Malamut (2007): Algorithmic Decision Making Framework, Journal of Trading 1 (1) - * 12-21. - * - * @author Lakshmi Krishnamurthy - */ - -public class BayesianPriceProcess { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iN = 25; - double dblT = 1.0; - double dblNu = 1.0; - double dblS0 = 100.; - double dblSigma = 1.5; - double dblAlphaBar = 0.7; - - double dblTime = 0.; - double dblPrice = dblS0; - double dblTimeWidth = dblT / iN; - - PriorDriftDistribution pdd = new PriorDriftDistribution ( - dblAlphaBar, - dblNu - ); - - double[] adblAlpha = pdd.realizedDrift (iN); - - System.out.println(); - - System.out.println ("\t|--------------------------------------------------||"); - - System.out.println ("\t| L -> R ||"); - - System.out.println ("\t|--------------------------------------------------||"); - - System.out.println ("\t| - Time ||"); - - System.out.println ("\t| - Realized Drift ||"); - - System.out.println ("\t| - Realized Price Volatility Swing ||"); - - System.out.println ("\t| - Realized Price ||"); - - System.out.println ("\t| - MAP Drift Estimate ||"); - - System.out.println ("\t| - Posterior Drift Volatility ||"); - - System.out.println ("\t|--------------------------------------------------||"); - - for (int i = 0; i < iN; ++i) { - dblTime = dblTime + dblTimeWidth; - - ConditionalPriceDistribution cpd = new ConditionalPriceDistribution ( - adblAlpha[i], - dblSigma, - dblTime - ); - - double dblPriceSwing = cpd.priceVolatilitySwing(); - - double dblRealizedPriceChange = adblAlpha[i] * dblTimeWidth + dblPriceSwing; - dblPrice = dblPrice + dblRealizedPriceChange; - - PriorConditionalCombiner pcc = new PriorConditionalCombiner ( - pdd, - cpd - ); - - R1UnivariateNormal r1unPosterior = pcc.posteriorDriftDistribution (dblRealizedPriceChange); - - System.out.println ( - "\t| " + FormatUtil.FormatDouble (dblTime, 1, 2, 1.) + " => " + - FormatUtil.FormatDouble (adblAlpha[i], 1, 2, 1.) + " | " + - FormatUtil.FormatDouble (dblPriceSwing, 1, 2, 1.) + " | " + - FormatUtil.FormatDouble (dblPrice, 3, 2, 1.) + " | " + - FormatUtil.FormatDouble (r1unPosterior.mean(), 1, 2, 1.) + " | " + - FormatUtil.FormatDouble (Math.sqrt (r1unPosterior.variance()), 1, 2, 1.) + " ||" - ); - } - - System.out.println ("\t|--------------------------------------------------||"); - } -} diff --git a/org/drip/sample/trend/FixedDriftTrajectoryComparator.java b/org/drip/sample/trend/FixedDriftTrajectoryComparator.java deleted file mode 100644 index 7dd254a..0000000 --- a/org/drip/sample/trend/FixedDriftTrajectoryComparator.java +++ /dev/null @@ -1,193 +0,0 @@ - -package org.drip.sample.trend; - -import org.drip.execution.bayesian.*; -import org.drip.execution.cost.*; -import org.drip.execution.impact.ParticipationRateLinear; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FixedDriftTrajectoryComparator demonstrates the Optimal Trajectory for a Price Process with Bayes' Drift, - * Arithmetic Volatility, and Linear Temporary Market Impact. The References are: - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets 1 - * 1-50. - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Brunnermeier, L. K., and L. H. Pedersen (2005): Predatory Trading, Journal of Finance 60 (4) 1825-1863. - * - * - Almgren, R., and J. Lorenz (2006): Bayesian Adaptive Trading with a Daily Cycle, Journal of Trading 1 - * (4) 38-46. - * - * - Kissell, R., and R. Malamut (2007): Algorithmic Decision Making Framework, Journal of Trading 1 (1) - * 12-21. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixedDriftTrajectoryComparator { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iN = 50; - double dblT = 1.; - double dblX0 = 1.; - double dblNu = 1.; - double dblEta = 0.07; - double dblSigma = 1.5; - double dblAlphaBar = 0.7; - - double dblTime = 0.; - double dblXConstrained = dblX0; - double dblTimeWidth = dblT / iN; - double dblXUnconstrained = dblX0; - - ParticipationRateLinear prlTemporary = ParticipationRateLinear.SlopeOnly (dblEta); - - PriorDriftDistribution pdd = new PriorDriftDistribution ( - dblAlphaBar, - dblNu - ); - - double[] adblAlpha = pdd.realizedDrift (iN); - - System.out.println(); - - System.out.println ("\t|-----------------------------------------------------------------------||"); - - System.out.println ("\t| L -> R ||"); - - System.out.println ("\t|-----------------------------------------------------------------------||"); - - System.out.println ("\t| - Time ||"); - - System.out.println ("\t| - Trade Start Time ||"); - - System.out.println ("\t| - Trade Finish Time ||"); - - System.out.println ("\t| - Critical Trade Rate ||"); - - System.out.println ("\t| - Constrained Trade Rate ||"); - - System.out.println ("\t| - Unconstrained Trade Rate ||"); - - System.out.println ("\t| - Constrained Holdings ||"); - - System.out.println ("\t| - Unconstrained Holdings ||"); - - System.out.println ("\t|-----------------------------------------------------------------------||"); - - for (int i = 0; i < iN - 1; ++i) { - dblTime = dblTime + dblTimeWidth; - - ConditionalPriceDistribution cpd = new ConditionalPriceDistribution ( - adblAlpha[i], - dblSigma, - dblTime - ); - - double dblPriceSwing = cpd.priceVolatilitySwing(); - - double dblRealizedPriceChange = adblAlpha[i] * dblTimeWidth + dblPriceSwing; - - PriorConditionalCombiner pcc = new PriorConditionalCombiner ( - pdd, - cpd - ); - - ConstrainedLinearTemporaryImpact clti = ConstrainedLinearTemporaryImpact.Standard ( - 0., - dblT, - dblXConstrained, - pcc, - dblRealizedPriceChange, - prlTemporary - ); - - double dblConstrainedInstantaneousTradeRate = clti.instantaneousTradeRate(); - - dblXConstrained = dblXConstrained - dblConstrainedInstantaneousTradeRate * dblTimeWidth; - - if (0 > dblXConstrained) dblXConstrained = 0.; - - LinearTemporaryImpact lti = LinearTemporaryImpact.Unconstrained ( - dblTime, - dblT, - dblXUnconstrained, - pcc, - dblRealizedPriceChange, - prlTemporary - ); - - double dblUnconstrainedInstantaneousTradeRate = lti.instantaneousTradeRate(); - - dblXUnconstrained = dblXUnconstrained - dblUnconstrainedInstantaneousTradeRate * dblTimeWidth; - - System.out.println ( - "\t| " + FormatUtil.FormatDouble (dblTime, 1, 2, 1.) + " => " + - FormatUtil.FormatDouble (clti.tradeStartTime(), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (clti.tradeFinishTime(), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (clti.criticalDrift(), 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblConstrainedInstantaneousTradeRate, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblUnconstrainedInstantaneousTradeRate, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblXConstrained, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblXUnconstrained, 1, 3, 1.) + " ||" - ); - } - - System.out.println ("\t|-----------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/trend/VariableDriftTrajectoryComparator.java b/org/drip/sample/trend/VariableDriftTrajectoryComparator.java deleted file mode 100644 index c645677..0000000 --- a/org/drip/sample/trend/VariableDriftTrajectoryComparator.java +++ /dev/null @@ -1,273 +0,0 @@ - -package org.drip.sample.trend; - -import org.drip.execution.bayesian.*; -import org.drip.execution.cost.*; -import org.drip.execution.impact.ParticipationRateLinear; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * VariableDriftTrajectoryComparator demonstrates the Optimal Trajectory for a Price Process with Bayesian - * Drift, Arithmetic Volatility, and Linear Temporary Market Impact across a Set of Drifts. The References - * are: - * - * - Bertsimas, D., and A. W. Lo (1998): Optimal Control of Execution Costs, Journal of Financial Markets 1 - * 1-50. - * - * - Almgren, R., and N. Chriss (2000): Optimal Execution of Portfolio Transactions, Journal of Risk 3 (2) - * 5-39. - * - * - Brunnermeier, L. K., and L. H. Pedersen (2005): Predatory Trading, Journal of Finance 60 (4) 1825-1863. - * - * - Almgren, R., and J. Lorenz (2006): Bayesian Adaptive Trading with a Daily Cycle, Journal of Trading 1 - * (4) 38-46. - * - * - Kissell, R., and R. Malamut (2007): Algorithmic Decision Making Framework, Journal of Trading 1 (1) - * 12-21. - * - * @author Lakshmi Krishnamurthy - */ - -public class VariableDriftTrajectoryComparator { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iN = 50; - double dblT = 1.; - double dblX0 = 1.; - double dblNu = 1.; - double dblEta = 0.07; - double dblSigma = 1.5; - double dblAlphaBarLow = 0.0; - double dblAlphaBarMid = 0.7; - double dblAlphaBarHigh = 1.5; - - double dblTime = 0.; - double dblTimeWidth = dblT / iN; - double dblXUnconstrained = dblX0; - double dblXConstrainedLow = dblX0; - double dblXConstrainedMid = dblX0; - double dblXConstrainedHigh = dblX0; - - ParticipationRateLinear prlTemporary = ParticipationRateLinear.SlopeOnly (dblEta); - - PriorDriftDistribution pddLow = new PriorDriftDistribution ( - dblAlphaBarLow, - dblNu - ); - - PriorDriftDistribution pddMid = new PriorDriftDistribution ( - dblAlphaBarMid, - dblNu - ); - - PriorDriftDistribution pddHigh = new PriorDriftDistribution ( - dblAlphaBarHigh, - dblNu - ); - - double[] adblAlphaLow = pddLow.realizedDrift (iN); - - double[] adblAlphaMid = pddMid.realizedDrift (iN); - - double[] adblAlphaHigh = pddHigh.realizedDrift (iN); - - System.out.println(); - - System.out.println ("\t|--------------------------------------------------------------------------------||"); - - System.out.println ("\t| L -> R ||"); - - System.out.println ("\t|--------------------------------------------------------------------------------||"); - - System.out.println ("\t| - Time ||"); - - System.out.println ("\t| - Constrained Trade Rate Low Drift ||"); - - System.out.println ("\t| - Constrained Trade Rate Mid Drift ||"); - - System.out.println ("\t| - Constrained Trade Rate High Drift ||"); - - System.out.println ("\t| - Unconstrained Trade Rate ||"); - - System.out.println ("\t| - Constrained Holdings Low Drift ||"); - - System.out.println ("\t| - Constrained Holdings Mid Drift ||"); - - System.out.println ("\t| - Constrained Holdings High Drift ||"); - - System.out.println ("\t| - Unconstrained Holdings ||"); - - System.out.println ("\t|--------------------------------------------------------------------------------||"); - - for (int i = 0; i < iN - 1; ++i) { - dblTime = dblTime + dblTimeWidth; - - ConditionalPriceDistribution cpdLow = new ConditionalPriceDistribution ( - adblAlphaLow[i], - dblSigma, - dblTime - ); - - ConditionalPriceDistribution cpdMid = new ConditionalPriceDistribution ( - adblAlphaMid[i], - dblSigma, - dblTime - ); - - ConditionalPriceDistribution cpdHigh = new ConditionalPriceDistribution ( - adblAlphaHigh[i], - dblSigma, - dblTime - ); - - double dblPriceSwingLow = cpdLow.priceVolatilitySwing(); - - double dblPriceSwingMid = cpdMid.priceVolatilitySwing(); - - double dblPriceSwingHigh = cpdHigh.priceVolatilitySwing(); - - double dblRealizedPriceChangeLow = adblAlphaLow[i] * dblTimeWidth + dblPriceSwingLow; - double dblRealizedPriceChangeMid = adblAlphaMid[i] * dblTimeWidth + dblPriceSwingMid; - double dblRealizedPriceChangeHigh = adblAlphaHigh[i] * dblTimeWidth + dblPriceSwingHigh; - - PriorConditionalCombiner pccLow = new PriorConditionalCombiner ( - pddLow, - cpdLow - ); - - PriorConditionalCombiner pccMid = new PriorConditionalCombiner ( - pddMid, - cpdMid - ); - - PriorConditionalCombiner pccHigh = new PriorConditionalCombiner ( - pddHigh, - cpdHigh - ); - - ConstrainedLinearTemporaryImpact cltiLow = ConstrainedLinearTemporaryImpact.Standard ( - 0., - dblT, - dblXConstrainedLow, - pccLow, - dblRealizedPriceChangeLow, - prlTemporary - ); - - ConstrainedLinearTemporaryImpact cltiMid = ConstrainedLinearTemporaryImpact.Standard ( - 0., - dblT, - dblXConstrainedMid, - pccMid, - dblRealizedPriceChangeMid, - prlTemporary - ); - - ConstrainedLinearTemporaryImpact cltiHigh = ConstrainedLinearTemporaryImpact.Standard ( - 0., - dblT, - dblXConstrainedHigh, - pccHigh, - dblRealizedPriceChangeHigh, - prlTemporary - ); - - double dblConstrainedInstantaneousTradeRateLow = cltiLow.instantaneousTradeRate(); - - dblXConstrainedLow = dblXConstrainedLow - dblConstrainedInstantaneousTradeRateLow * dblTimeWidth; - - if (0 > dblXConstrainedLow) dblXConstrainedLow = 0.; - - double dblConstrainedInstantaneousTradeRateMid = cltiMid.instantaneousTradeRate(); - - dblXConstrainedMid = dblXConstrainedMid - dblConstrainedInstantaneousTradeRateMid * dblTimeWidth; - - if (0 > dblXConstrainedMid) dblXConstrainedMid = 0.; - - double dblConstrainedInstantaneousTradeRateHigh = cltiHigh.instantaneousTradeRate(); - - dblXConstrainedHigh = dblXConstrainedHigh - dblConstrainedInstantaneousTradeRateHigh * dblTimeWidth; - - if (0 > dblXConstrainedHigh) dblXConstrainedHigh = 0.; - - LinearTemporaryImpact lti = LinearTemporaryImpact.Unconstrained ( - dblTime, - dblT, - dblXUnconstrained, - pccMid, - dblRealizedPriceChangeMid, - prlTemporary - ); - - double dblUnconstrainedInstantaneousTradeRate = lti.instantaneousTradeRate(); - - dblXUnconstrained = dblXUnconstrained - dblUnconstrainedInstantaneousTradeRate * dblTimeWidth; - - System.out.println ( - "\t| " + FormatUtil.FormatDouble (dblTime, 1, 2, 1.) + " => " + - FormatUtil.FormatDouble (dblConstrainedInstantaneousTradeRateLow, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblConstrainedInstantaneousTradeRateMid, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblConstrainedInstantaneousTradeRateHigh, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblUnconstrainedInstantaneousTradeRate, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblXConstrainedLow, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblXConstrainedMid, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblXConstrainedHigh, 1, 3, 1.) + " | " + - FormatUtil.FormatDouble (dblXUnconstrained, 1, 3, 1.) + " ||" - ); - } - - System.out.println ("\t|--------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/sample/xccy/OTCCrossCurrencyDefinitions.java b/org/drip/sample/xccy/OTCCrossCurrencyDefinitions.java deleted file mode 100644 index b4ab617..0000000 --- a/org/drip/sample/xccy/OTCCrossCurrencyDefinitions.java +++ /dev/null @@ -1,115 +0,0 @@ - -package org.drip.sample.xccy; - -import org.drip.market.otc.*; -import org.drip.service.env.EnvManager; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * OTCFloatFloatDefinitions contains all the pre-fixed Definitions of the OTC Cross-Currency Float-Float Swap - * Contracts. - * - * @author Lakshmi Krishnamurthy - */ - -public class OTCCrossCurrencyDefinitions { - public static final void main ( - String[] args) - { - EnvManager.InitEnv (""); - - System.out.println ("\n\t--------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t\tL -> R:"); - - System.out.println ("\t\t\tReference Currency"); - - System.out.println ("\t\t\tReference Tenor"); - - System.out.println ("\t\t\tQuote Basis on Reference"); - - System.out.println ("\t\t\tDerived Currency"); - - System.out.println ("\t\t\tDerived Tenor"); - - System.out.println ("\t\t\tQuote Basis on Derived"); - - System.out.println ("\t\t\tFixing Setting Type"); - - System.out.println ("\t\t\tSpot Lag in Business Days"); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------"); - - System.out.println ("\t\t" + CrossFloatConventionContainer.ConventionFromJurisdiction ("AUD")); - - System.out.println ("\t\t" + CrossFloatConventionContainer.ConventionFromJurisdiction ("CAD")); - - System.out.println ("\t\t" + CrossFloatConventionContainer.ConventionFromJurisdiction ("CHF")); - - System.out.println ("\t\t" + CrossFloatConventionContainer.ConventionFromJurisdiction ("CLP")); - - System.out.println ("\t\t" + CrossFloatConventionContainer.ConventionFromJurisdiction ("DKK")); - - System.out.println ("\t\t" + CrossFloatConventionContainer.ConventionFromJurisdiction ("EUR")); - - System.out.println ("\t\t" + CrossFloatConventionContainer.ConventionFromJurisdiction ("GBP")); - - System.out.println ("\t\t" + CrossFloatConventionContainer.ConventionFromJurisdiction ("JPY")); - - System.out.println ("\t\t" + CrossFloatConventionContainer.ConventionFromJurisdiction ("MXN")); - - System.out.println ("\t\t" + CrossFloatConventionContainer.ConventionFromJurisdiction ("NOK")); - - System.out.println ("\t\t" + CrossFloatConventionContainer.ConventionFromJurisdiction ("PLN")); - - System.out.println ("\t\t" + CrossFloatConventionContainer.ConventionFromJurisdiction ("SEK")); - - System.out.println ("\t--------------------------------------------------------------------------------------------------------"); - } -} diff --git a/org/drip/sample/xccy/OTCCrossCurrencySwaps.java b/org/drip/sample/xccy/OTCCrossCurrencySwaps.java deleted file mode 100644 index 5a4a117..0000000 --- a/org/drip/sample/xccy/OTCCrossCurrencySwaps.java +++ /dev/null @@ -1,323 +0,0 @@ - -package org.drip.sample.xccy; - -import org.drip.analytics.date.*; -import org.drip.analytics.support.CaseInsensitiveTreeMap; -import org.drip.function.r1tor1.FlatUnivariate; -import org.drip.market.otc.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.*; -import org.drip.product.params.CurrencyPair; -import org.drip.product.rates.FloatFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.state.creator.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * OTCCrossCurrencySwaps demonstrates the Construction and Valuation of the Cross-Currency Floating Swap of - * OTC contracts. - * - * @author Lakshmi Krishnamurthy - */ - -public class OTCCrossCurrencySwaps { - - private static final FloatFloatComponent OTCCrossCurrencyFloatFloat ( - final String strReferenceCurrency, - final String strDerivedCurrency, - final JulianDate dtSpot, - final String strMaturityTenor, - final double dblBasis, - final double dblDerivedNotionalScaler) - { - CrossFloatSwapConvention ccfc = CrossFloatConventionContainer.ConventionFromJurisdiction ( - strReferenceCurrency, - strDerivedCurrency - ); - - return ccfc.createFloatFloatComponent ( - dtSpot, - strMaturityTenor, - dblBasis, - 1., - -1. * dblDerivedNotionalScaler - ); - } - - private static final void OTCCrossCurrencyRun ( - final JulianDate dtSpot, - final String strReferenceCurrency, - final String strDerivedCurrency, - final String strMaturityTenor, - final double dblBasis, - final double dblReferenceDerivedFXRate) - throws Exception - { - double dblReferenceFundingRate = 0.02; - double dblDerived3MForwardRate = 0.02; - - double dblReferenceFundingVol = 0.3; - double dblDerivedForward3MVol = 0.3; - double dblReferenceDerivedFXVol = 0.3; - - double dblDerived3MReferenceDerivedFXCorr = 0.1; - double dblReferenceFundingDerived3MCorr = 0.1; - double dblReferenceFundingReferenceDerivedFXCorr = 0.1; - - MergedDiscountForwardCurve dcReferenceFunding = ScenarioDiscountCurveBuilder.ExponentiallyCompoundedFlatRate ( - dtSpot, - strReferenceCurrency, - dblReferenceFundingRate - ); - - ForwardLabel friDerived3M = ForwardLabel.Create ( - strDerivedCurrency, - "3M" - ); - - ForwardCurve fcDerived3M = ScenarioForwardCurveBuilder.FlatForwardForwardCurve ( - dtSpot, - friDerived3M, - dblDerived3MForwardRate - ); - - CurrencyPair cp = CurrencyPair.FromCode ( - strReferenceCurrency + "/" + strDerivedCurrency - ); - - FXLabel fxLabel = FXLabel.Standard (cp); - - FundingLabel fundingLabelReference = org.drip.state.identifier.FundingLabel.Standard ( - strReferenceCurrency - ); - - CurveSurfaceQuoteContainer mktParams = new CurveSurfaceQuoteContainer(); - - mktParams.setForwardState ( - fcDerived3M - ); - - mktParams.setFundingState ( - dcReferenceFunding - ); - - mktParams.setFXState ( - ScenarioFXCurveBuilder.CubicPolynomialCurve ( - "FX::" + cp.code(), - dtSpot, - cp, - new String[] {"10Y"}, - new double[] {dblReferenceDerivedFXRate}, - dblReferenceDerivedFXRate - ) - ); - - mktParams.setForwardVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtSpot.julian(), - VolatilityLabel.Standard (friDerived3M), - strDerivedCurrency, - dblDerivedForward3MVol - ) - ); - - mktParams.setFundingVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtSpot.julian(), - VolatilityLabel.Standard (fundingLabelReference), - strReferenceCurrency, - dblReferenceFundingVol - ) - ); - - mktParams.setFXVolatility ( - ScenarioDeterministicVolatilityBuilder.FlatForward ( - dtSpot.julian(), - VolatilityLabel.Standard (fxLabel), - strDerivedCurrency, - dblReferenceDerivedFXVol - ) - ); - - mktParams.setForwardFundingCorrelation ( - friDerived3M, - fundingLabelReference, - new FlatUnivariate ( - dblReferenceFundingDerived3MCorr - ) - ); - - mktParams.setForwardFXCorrelation ( - friDerived3M, - fxLabel, - new FlatUnivariate ( - dblDerived3MReferenceDerivedFXCorr - ) - ); - - mktParams.setFundingFXCorrelation ( - fundingLabelReference, - fxLabel, - new FlatUnivariate ( - dblReferenceFundingReferenceDerivedFXCorr - ) - ); - - FloatFloatComponent xccySwap = OTCCrossCurrencyFloatFloat ( - strReferenceCurrency, - strDerivedCurrency, - dtSpot, - strMaturityTenor, - dblBasis, - 1. / dblReferenceDerivedFXRate - ); - - xccySwap.setPrimaryCode ( - strDerivedCurrency + "_" + strReferenceCurrency + "_OTC::FLOATFLOAT::" + strMaturityTenor - ); - - mktParams.setFixing ( - xccySwap.effectiveDate(), - fxLabel, - dblReferenceDerivedFXRate - ); - - ValuationParams valParams = new ValuationParams ( - dtSpot, - dtSpot, - strReferenceCurrency + "," + strDerivedCurrency - ); - - CaseInsensitiveTreeMap mapXCcyOutput = xccySwap.value ( - valParams, - null, - mktParams, - null - ); - - System.out.println ( - "\t| " + xccySwap.name() + " [" + xccySwap.effectiveDate() + " -> " + xccySwap.maturityDate() + "] => " + - FormatUtil.FormatDouble (mapXCcyOutput.get ("Price"), 1, 2, 1.) + " | " + - FormatUtil.FormatDouble (mapXCcyOutput.get ("DerivedParBasisSpread"), 1, 2, 1.) + " | " + - FormatUtil.FormatDouble (mapXCcyOutput.get ("ReferenceParBasisSpread"), 1, 2, 1.) + " | " + - FormatUtil.FormatDouble (mapXCcyOutput.get ("DerivedCleanDV01"), 1, 2, 10000.) + " | " + - FormatUtil.FormatDouble (mapXCcyOutput.get ("ReferenceCleanDV01"), 1, 2, 10000.) + " |" - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - System.out.println ("\t---------------------------------------------------------"); - - System.out.println ("\t\tCROSS-CURRENCY FLOAT-FLOAT COMPONENT RUNS"); - - System.out.println ("\t---------------------------------------------------------"); - - System.out.println ("\tL -> R:"); - - System.out.println ("\t\tCross Currency Swap Name"); - - System.out.println ("\t\tFloat-Float Effective"); - - System.out.println ("\t\tFloat-Float Maturity"); - - System.out.println ("\t\tPrice"); - - System.out.println ("\t\tDerived Stream Par Basis Spread"); - - System.out.println ("\t\tReference Stream Par Basis Spread"); - - System.out.println ("\t\tAnnualized Derived Stream Duration"); - - System.out.println ("\t\tAnnualized Reference Stream Duration"); - - System.out.println ("\t------------------------------------------------------------------------------------------------------------------"); - - OTCCrossCurrencyRun (dtSpot, "USD", "AUD", "2Y", 0.0003, 0.7769); - - OTCCrossCurrencyRun (dtSpot, "USD", "CAD", "2Y", 0.0003, 0.7861); - - OTCCrossCurrencyRun (dtSpot, "USD", "CHF", "2Y", 0.0003, 1.0811); - - OTCCrossCurrencyRun (dtSpot, "USD", "CLP", "2Y", 0.0003, 0.0016); - - OTCCrossCurrencyRun (dtSpot, "USD", "DKK", "2Y", 0.0003, 0.1517); - - OTCCrossCurrencyRun (dtSpot, "USD", "EUR", "2Y", 0.0003, 1.1294); - - OTCCrossCurrencyRun (dtSpot, "USD", "GBP", "2Y", 0.0003, 1.5004); - - OTCCrossCurrencyRun (dtSpot, "USD", "JPY", "2Y", 0.0003, 0.0085); - - OTCCrossCurrencyRun (dtSpot, "USD", "MXN", "2Y", 0.0003, 0.0666); - - OTCCrossCurrencyRun (dtSpot, "USD", "NOK", "2Y", 0.0003, 0.1288); - - OTCCrossCurrencyRun (dtSpot, "USD", "PLN", "2Y", 0.0003, 0.2701); - - OTCCrossCurrencyRun (dtSpot, "USD", "SEK", "2Y", 0.0003, 0.1211); - - System.out.println ("\t------------------------------------------------------------------------------------------------------------------"); - } -} diff --git a/org/drip/sample/xva/CollateralizedCollateralGroup.java b/org/drip/sample/xva/CollateralizedCollateralGroup.java deleted file mode 100644 index e6a78df..0000000 --- a/org/drip/sample/xva/CollateralizedCollateralGroup.java +++ /dev/null @@ -1,380 +0,0 @@ - -package org.drip.sample.xva; - -import org.drip.analytics.date.*; -import org.drip.measure.continuousmarginal.BrokenDateBridgeLinearT; -import org.drip.measure.discretemarginal.SequenceGenerator; -import org.drip.measure.dynamics.DiffusionEvaluatorLinear; -import org.drip.measure.process.DiffusionEvolver; -import org.drip.measure.realization.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.xva.settings.*; -import org.drip.xva.trajectory.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CollateralizedCollateralGroup illustrates the Sample Run of a Single Partially Collateralized Collateral - * Group under Non-Zero Bank/Counter Party Threshold with several Fix-Float Swaps. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CollateralizedCollateralGroup { - - private static final double[] ATMSwapRateOffsetRealization ( - final DiffusionEvolver deSwapATMSwapRateOffset, - final double dblATMSwapRateOffsetStart, - final int iNumStep, - final double dblTime, - final double dblTimeWidth) - throws Exception - { - JumpDiffusionEdge[] aJDEATMSwapRateOffset = deSwapATMSwapRateOffset.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblATMSwapRateOffsetStart, - 0., - false - ), - UnitRandom.Diffusion (SequenceGenerator.Gaussian (iNumStep)), - dblTimeWidth - ); - - double[] adblATMSwapRateOffsetRealization = new double[aJDEATMSwapRateOffset.length]; - - for (int i = 0; i < aJDEATMSwapRateOffset.length; ++i) - adblATMSwapRateOffsetRealization[i] = aJDEATMSwapRateOffset[i].finish(); - - return adblATMSwapRateOffsetRealization; - } - - private static final double[] SwapPortfolioValueRealization ( - final DiffusionEvolver deATMSwapRateOffset, - final double dblATMSwapRateOffsetStart, - final int iNumStep, - final double dblTime, - final double dblTimeWidth, - final int iNumSwap) - throws Exception - { - double[] adblSwapPortfolioValueRealization = new double[iNumStep]; - - for (int i = 0; i < iNumStep; ++i) - adblSwapPortfolioValueRealization[i] = 0.; - - for (int i = 0; i < iNumSwap; ++i) { - double[] adblSwapValueRealization = ATMSwapRateOffsetRealization ( - deATMSwapRateOffset, - dblATMSwapRateOffsetStart, - iNumStep, - dblTime, - dblTimeWidth - ); - - for (int j = 0; j < iNumStep; ++j) - adblSwapPortfolioValueRealization[j] += dblTime * (iNumStep - j) * adblSwapValueRealization[j]; - } - - return adblSwapPortfolioValueRealization; - } - - private static final double[][] SwapPortfolioValueRealization ( - final DiffusionEvolver deSwap, - final double dblSwapValueStart, - final int iNumStep, - final double dblTime, - final double dblTimeWidth, - final int iNumSwap, - final int iNumSimulation) - throws Exception - { - double[][] aadblSwapPortfolioValueRealization = new double[iNumSimulation][]; - - for (int i = 0; i < iNumSimulation; ++i) - aadblSwapPortfolioValueRealization[i] = SwapPortfolioValueRealization ( - deSwap, - dblSwapValueStart, - iNumStep, - dblTime, - dblTimeWidth, - iNumSwap - ); - - return aadblSwapPortfolioValueRealization; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iNumStep = 10; - int iNumSwap = 10; - double dblTime = 5.; - int iNumSimulation = 1000; - double dblATMSwapRateOffsetStart = 0.; - double dblATMSwapRateOffsetDrift = 0.0; - double dblATMSwapRateOffsetVolatility = 0.25; - double dblCSADrift = 0.01; - double dblBankHazardRate = 0.015; - double dblBankRecoveryRate = 0.40; - double dblCounterPartyHazardRate = 0.030; - double dblCounterPartyRecoveryRate = 0.30; - double dblBankThreshold = -0.1; - double dblCounterPartyThreshold = 0.1; - - JulianDate dtSpot = DateUtil.Today(); - - double dblTimeWidth = dblTime / iNumStep; - double[] adblCSA = new double[iNumStep]; - double[] adblBankSurvival = new double[iNumStep]; - double[] adblBankRecovery = new double[iNumStep]; - JulianDate[] adtVertex = new JulianDate[iNumStep]; - double[] adblBankFundingSpread = new double[iNumStep]; - double[] adblCounterPartySurvival = new double[iNumStep]; - double[] adblCounterPartyRecovery = new double[iNumStep]; - CollateralGroupPath[] aCGP = new CollateralGroupPath[iNumSimulation]; - double dblBankFundingSpread = dblBankHazardRate / (1. - dblBankRecoveryRate); - CollateralGroupVertex[][] aaCGV = new CollateralGroupVertex[iNumSimulation][iNumStep]; - - CollateralGroupSpecification cgs = CollateralGroupSpecification.FixedThreshold ( - "FIXEDTHRESHOLD", - dblCounterPartyThreshold, - dblBankThreshold - ); - - CounterPartyGroupSpecification cpgs = CounterPartyGroupSpecification.Standard ("CPGROUP"); - - DiffusionEvolver deSwapATMSwapRateOffset = new DiffusionEvolver ( - DiffusionEvaluatorLinear.Standard ( - dblATMSwapRateOffsetDrift, - dblATMSwapRateOffsetVolatility - ) - ); - - double[][] aadblSwapPortfolioValueRealization = SwapPortfolioValueRealization ( - deSwapATMSwapRateOffset, - dblATMSwapRateOffsetStart, - iNumStep, - dblTime, - dblTimeWidth, - iNumSwap, - iNumSimulation - ); - - for (int i = 0; i < iNumStep; ++i) { - adblBankRecovery[i] = dblBankRecoveryRate; - adblBankFundingSpread[i] = dblBankFundingSpread; - adblCounterPartyRecovery[i] = dblCounterPartyRecoveryRate; - - adtVertex[i] = dtSpot.addMonths (((int) dblTime) * 12 * (i + 1) / iNumStep); - - adblCSA[i] = Math.exp (0.5 * dblCSADrift * (i + 1)); - - adblBankSurvival[i] = Math.exp (-0.5 * dblBankHazardRate * (i + 1)); - - adblCounterPartySurvival[i] = Math.exp (-0.5 * dblCounterPartyHazardRate * (i + 1)); - } - - for (int j = 0; j < iNumSimulation; ++j) { - JulianDate dtStart = dtSpot; - double dblValueStart = dblTime * dblATMSwapRateOffsetStart; - - for (int i = 0; i < iNumStep; ++i) { - JulianDate dtEnd = adtVertex[i]; - double dblValueEnd = dblTimeWidth * (iNumStep - i) * aadblSwapPortfolioValueRealization[j][i]; - - CollateralAmountEstimator cae = new CollateralAmountEstimator ( - cgs, - cpgs, - new BrokenDateBridgeLinearT ( - dtStart.julian(), - dtEnd.julian(), - dblValueStart, - dblValueEnd - ), - Double.NaN - ); - - aaCGV[j][i] = new CollateralGroupVertex ( - adtVertex[i], - new CollateralGroupVertexExposure ( - dblValueEnd, - 0., - cae.postingRequirement (dtEnd) - ), - new CollateralGroupVertexNumeraire ( - adblCSA[i], - adblBankSurvival[i], - adblBankRecovery[i], - adblBankFundingSpread[i], - adblCounterPartySurvival[i], - adblCounterPartyRecovery[i] - ) - ); - - dtStart = dtEnd; - dblValueStart = dblValueEnd; - } - } - - for (int j = 0; j < iNumSimulation; ++j) { - CollateralGroupEdge[] aCGE = new CollateralGroupEdge[iNumStep - 1]; - - for (int i = 1; i < iNumStep; ++i) - aCGE[i - 1] = new CollateralGroupEdge ( - aaCGV[j][i - 1], - aaCGV[j][i] - ); - - aCGP[j] = new CollateralGroupPath (aCGE); - } - - NettingGroupPathAggregator ngpa = NettingGroupPathAggregator.Standard (aCGP); - - JulianDate[] adtVertexNode = ngpa.vertexes(); - - System.out.println(); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - String strDump = "\t| DATE =>" ; - - for (int i = 0; i < adtVertexNode.length; ++i) - strDump = strDump + " " + adtVertexNode[i] + " |"; - - System.out.println (strDump); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - double[] adblEE = ngpa.collateralizedExposure(); - - strDump = "\t| EXPOSURE => " + FormatUtil.FormatDouble (dblTime * dblATMSwapRateOffsetStart, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEPE = ngpa.collateralizedPositiveExposure(); - - strDump = "\t| POSITIVE EXPOSURE => " + FormatUtil.FormatDouble (dblTime * dblATMSwapRateOffsetStart, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEPE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEPE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblENE = ngpa.collateralizedNegativeExposure(); - - strDump = "\t| NEGATIVE EXPOSURE => " + FormatUtil.FormatDouble (0., 1, 4, 1.) + " |"; - - for (int j = 0; j < adblENE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblENE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEEPV = ngpa.collateralizedExposurePV(); - - strDump = "\t| EXPOSURE PV => " + FormatUtil.FormatDouble (dblTime * dblATMSwapRateOffsetStart, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEPEPV = ngpa.collateralizedPositiveExposurePV(); - - strDump = "\t| POSITIVE EXPOSURE PV => " + FormatUtil.FormatDouble (dblTime * dblATMSwapRateOffsetStart, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEPEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEPEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblENEPV = ngpa.collateralizedNegativeExposurePV(); - - strDump = "\t| NEGATIVE EXPOSURE PV => " + FormatUtil.FormatDouble (0., 1, 4, 1.) + " |"; - - for (int j = 0; j < adblENEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblENEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - System.out.println(); - - System.out.println ("\t||----------------||"); - - System.out.println ("\t|| CVA => " + FormatUtil.FormatDouble (ngpa.cva(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|| DVA => " + FormatUtil.FormatDouble (ngpa.dva(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|| FVA => " + FormatUtil.FormatDouble (ngpa.fca(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t||----------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/xva/CollateralizedCollateralGroupCorrelated.java b/org/drip/sample/xva/CollateralizedCollateralGroupCorrelated.java deleted file mode 100644 index f3142c4..0000000 --- a/org/drip/sample/xva/CollateralizedCollateralGroupCorrelated.java +++ /dev/null @@ -1,468 +0,0 @@ - -package org.drip.sample.xva; - -import org.drip.analytics.date.*; -import org.drip.measure.continuousmarginal.BrokenDateBridgeLinearT; -import org.drip.measure.discretemarginal.SequenceGenerator; -import org.drip.measure.dynamics.*; -import org.drip.measure.process.DiffusionEvolver; -import org.drip.measure.realization.*; -import org.drip.quant.common.FormatUtil; -import org.drip.quant.linearalgebra.Matrix; -import org.drip.service.env.EnvManager; -import org.drip.xva.settings.*; -import org.drip.xva.trajectory.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CollateralizedCollateralGroupCorrelated illustrates the Sample Run of a Single Partially Collateralized - * Collateral Group under Non-Zero Bank/Counter Party Threshold with several Fix-Float Swaps, and with built - * in Factor Correlations across the Numeraires. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CollateralizedCollateralGroupCorrelated { - - private static final double[] ATMSwapRateOffsetRealization ( - final DiffusionEvolver deATMSwapRateOffset, - final double dblATMSwapRateOffsetStart, - final int iNumStep, - final double[] adblRandom, - final double dblTime, - final double dblTimeWidth) - throws Exception - { - JumpDiffusionEdge[] aJDEATMSwapRateOffset = deATMSwapRateOffset.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblATMSwapRateOffsetStart, - 0., - false - ), - UnitRandom.Diffusion (adblRandom), - dblTimeWidth - ); - - double[] adblATMSwapRateOffsetRealization = new double[aJDEATMSwapRateOffset.length]; - - for (int i = 0; i < aJDEATMSwapRateOffset.length; ++i) - adblATMSwapRateOffsetRealization[i] = aJDEATMSwapRateOffset[i].finish(); - - return adblATMSwapRateOffsetRealization; - } - - private static final double[] SwapPortfolioValueRealization ( - final DiffusionEvolver deATMSwapRateOffset, - final double dblATMSwapRateOffsetStart, - final int iNumStep, - final double[] adblRandom, - final double dblTime, - final double dblTimeWidth, - final int iNumSwap) - throws Exception - { - double[] adblSwapPortfolioValueRealization = new double[iNumStep]; - - for (int i = 0; i < iNumStep; ++i) - adblSwapPortfolioValueRealization[i] = 0.; - - for (int i = 0; i < iNumSwap; ++i) { - double[] adblATMSwapRateOffsetRealization = ATMSwapRateOffsetRealization ( - deATMSwapRateOffset, - dblATMSwapRateOffsetStart, - iNumStep, - adblRandom, - dblTime, - dblTimeWidth - ); - - for (int j = 0; j < iNumStep; ++j) - adblSwapPortfolioValueRealization[j] += dblTimeWidth * (iNumStep - j) * adblATMSwapRateOffsetRealization[j]; - } - - return adblSwapPortfolioValueRealization; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iNumStep = 10; - int iNumSwap = 10; - double dblTime = 5.; - int iNumSimulation = 1000; - double dblATMSwapRateOffsetDrift = 0.0; - double dblATMSwapRateOffsetVolatility = 0.25; - double dblATMSwapRateOffsetInitial = 0.; - double dblCSADrift = 0.01; - double dblCSAVolatility = 0.05; - double dblCSAInitial = 1.; - double dblBankHazardRateDrift = 0.002; - double dblBankHazardRateVolatility = 0.20; - double dblBankHazardRateInitial = 0.015; - double dblBankRecoveryRateDrift = 0.002; - double dblBankRecoveryRateVolatility = 0.02; - double dblBankRecoveryRateInitial = 0.40; - double dblCounterPartyHazardRateDrift = 0.002; - double dblCounterPartyHazardRateVolatility = 0.30; - double dblCounterPartyHazardRateInitial = 0.030; - double dblCounterPartyRecoveryRateDrift = 0.002; - double dblCounterPartyRecoveryRateVolatility = 0.02; - double dblCounterPartyRecoveryRateInitial = 0.30; - double dblBankFundingSpreadDrift = 0.00002; - double dblBankFundingSpreadVolatility = 0.002; - double dblBankThreshold = -0.1; - double dblCounterPartyThreshold = 0.1; - - double[][] aadblCorrelation = new double[][] { - {1.00, 0.03, 0.07, 0.04, 0.05, 0.08, 0.00}, // PORTFOLIO - {0.03, 1.00, 0.26, 0.33, 0.21, 0.35, 0.13}, // CSA - {0.07, 0.26, 1.00, 0.45, -0.17, 0.07, 0.77}, // BANK HAZARD - {0.04, 0.33, 0.45, 1.00, -0.22, -0.54, 0.58}, // COUNTER PARTY HAZARD - {0.05, 0.21, -0.17, -0.22, 1.00, 0.47, -0.23}, // BANK RECOVERY - {0.08, 0.35, 0.07, -0.54, 0.47, 1.00, 0.01}, // COUNTER PARTY RECOVERY - {0.00, 0.13, 0.77, 0.58, -0.23, 0.01, 1.00} // BANK FUNDING SPREAD - }; - - JulianDate dtSpot = DateUtil.Today(); - - double dblTimeWidth = dblTime / iNumStep; - JulianDate[] adtVertex = new JulianDate[iNumStep]; - double[][] aadblPortfolioValue = new double[iNumSimulation][iNumStep]; - double[][] aadblCollateralBalance = new double[iNumSimulation][iNumStep]; - double dblBankFundingSpreadInitial = dblBankHazardRateInitial / (1. - dblBankRecoveryRateInitial); - CollateralGroupVertexNumeraire[][] aaCGVN = new CollateralGroupVertexNumeraire[iNumSimulation][iNumStep]; - - CollateralGroupSpecification cgs = CollateralGroupSpecification.FixedThreshold ( - "FIXEDTHRESHOLD", - dblCounterPartyThreshold, - dblBankThreshold - ); - - CounterPartyGroupSpecification cpgs = CounterPartyGroupSpecification.Standard ("CPGROUP"); - - for (int j = 0; j < iNumStep; ++j) - adtVertex[j] = dtSpot.addMonths (6 * j + 6); - - DiffusionEvolver deATMSwapRateOffset = new DiffusionEvolver ( - DiffusionEvaluatorLinear.Standard ( - dblATMSwapRateOffsetDrift, - dblATMSwapRateOffsetVolatility - ) - ); - - DiffusionEvolver deCSA = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblCSADrift, - dblCSAVolatility - ) - ); - - DiffusionEvolver deBankHazardRate = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblBankHazardRateDrift, - dblBankHazardRateVolatility - ) - ); - - DiffusionEvolver deCounterPartyHazardRate = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblCounterPartyHazardRateDrift, - dblCounterPartyHazardRateVolatility - ) - ); - - DiffusionEvolver deBankRecoveryRate = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblBankRecoveryRateDrift, - dblBankRecoveryRateVolatility - ) - ); - - DiffusionEvolver deCounterPartyRecoveryRate = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblCounterPartyRecoveryRateDrift, - dblCounterPartyRecoveryRateVolatility - ) - ); - - DiffusionEvolver deBankFundingSpread = new DiffusionEvolver ( - DiffusionEvaluatorLinear.Standard ( - dblBankFundingSpreadDrift, - dblBankFundingSpreadVolatility - ) - ); - - for (int i = 0; i < iNumSimulation; ++i) { - double[][] aadblNumeraire = Matrix.Transpose ( - SequenceGenerator.GaussianJoint ( - iNumStep, - aadblCorrelation - ) - ); - - aadblPortfolioValue[i] = SwapPortfolioValueRealization ( - deATMSwapRateOffset, - dblATMSwapRateOffsetInitial, - iNumStep, - aadblNumeraire[0], - dblTime, - dblTimeWidth, - iNumSwap - ); - - JumpDiffusionEdge[] aJDECSA = deCSA.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblCSAInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[1]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDEBankHazardRate = deBankHazardRate.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblBankHazardRateInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[2]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDECounterPartyHazardRate = deCounterPartyHazardRate.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblCounterPartyHazardRateInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[3]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDEBankRecoveryRate = deBankRecoveryRate.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblBankRecoveryRateInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[4]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDECounterPartyRecoveryRate = deCounterPartyRecoveryRate.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblCounterPartyRecoveryRateInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[5]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDEBankFundingSpread = deBankFundingSpread.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblBankFundingSpreadInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[6]), - dblTimeWidth - ); - - JulianDate dtStart = dtSpot; - double dblValueStart = dblTime * dblATMSwapRateOffsetInitial; - - for (int j = 0; j < iNumStep; ++j) { - JulianDate dtEnd = adtVertex[j]; - double dblValueEnd = aadblPortfolioValue[i][j]; - - aaCGVN[i][j] = new CollateralGroupVertexNumeraire ( - aJDECSA[j].finish(), - Math.exp (-0.5 * aJDEBankHazardRate[j].finish() * (j + 1)), - aJDEBankRecoveryRate[j].finish(), - aJDEBankFundingSpread[j].finish(), - Math.exp (-0.5 * aJDECounterPartyHazardRate[j].finish() * (j + 1)), - aJDECounterPartyRecoveryRate[j].finish() - ); - - CollateralAmountEstimator cae = new CollateralAmountEstimator ( - cgs, - cpgs, - new BrokenDateBridgeLinearT ( - dtStart.julian(), - dtEnd.julian(), - dblValueStart, - dblValueEnd - ), - Double.NaN - ); - - aadblCollateralBalance[i][j] = cae.postingRequirement (dtEnd); - - dblValueStart = dblValueEnd; - dtStart = dtEnd; - } - } - - NettingGroupPathAggregator ngpa = NettingGroupPathAggregator.Standard ( - adtVertex, - aadblPortfolioValue, - aadblCollateralBalance, - aaCGVN - ); - - JulianDate[] adtVertexNode = ngpa.vertexes(); - - System.out.println(); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - String strDump = "\t| DATE =>" ; - - for (int i = 0; i < adtVertexNode.length; ++i) - strDump = strDump + " " + adtVertexNode[i] + " |"; - - System.out.println (strDump); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - double[] adblEE = ngpa.collateralizedExposure(); - - strDump = "\t| EXPOSURE => " + FormatUtil.FormatDouble (dblTime * dblATMSwapRateOffsetInitial, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEPE = ngpa.collateralizedPositiveExposure(); - - strDump = "\t| POSITIVE EXPOSURE => " + FormatUtil.FormatDouble (dblTime * dblATMSwapRateOffsetInitial, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEPE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEPE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblENE = ngpa.collateralizedNegativeExposure(); - - strDump = "\t| NEGATIVE EXPOSURE => " + FormatUtil.FormatDouble (0., 1, 4, 1.) + " |"; - - for (int j = 0; j < adblENE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblENE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEEPV = ngpa.collateralizedExposurePV(); - - strDump = "\t| EXPOSURE PV => " + FormatUtil.FormatDouble (dblTime * dblATMSwapRateOffsetInitial, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEPEPV = ngpa.collateralizedPositiveExposurePV(); - - strDump = "\t| POSITIVE EXPOSURE PV => " + FormatUtil.FormatDouble (dblTime * dblATMSwapRateOffsetInitial, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEPEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEPEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblENEPV = ngpa.collateralizedNegativeExposurePV(); - - strDump = "\t| NEGATIVE EXPOSURE PV => " + FormatUtil.FormatDouble (0., 1, 4, 1.) + " |"; - - for (int j = 0; j < adblENEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblENEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - System.out.println(); - - System.out.println ("\t||----------------||"); - - System.out.println ("\t|| CVA => " + FormatUtil.FormatDouble (ngpa.cva(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|| DVA => " + FormatUtil.FormatDouble (ngpa.dva(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|| FVA => " + FormatUtil.FormatDouble (ngpa.fca(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t||----------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/xva/PortfolioCollateralEstimate.java b/org/drip/sample/xva/PortfolioCollateralEstimate.java deleted file mode 100644 index 502441a..0000000 --- a/org/drip/sample/xva/PortfolioCollateralEstimate.java +++ /dev/null @@ -1,203 +0,0 @@ - -package org.drip.sample.xva; - -import org.drip.analytics.date.*; -import org.drip.measure.continuousmarginal.BrokenDateBridgeLinearT; -import org.drip.measure.discretemarginal.SequenceGenerator; -import org.drip.measure.dynamics.DiffusionEvaluatorLinear; -import org.drip.measure.process.DiffusionEvolver; -import org.drip.measure.realization.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.xva.settings.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * PortfolioCollateralEstimate illustrates the Estimation of the Collateral Amount on a Single Trade Collateral - * Portfolio. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class PortfolioCollateralEstimate { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iNumStep = 40; - double dblTime = 10.; - double dblPortfolioDrift = 0.0; - double dblPortfolioVolatility = 0.15; - double dblPortfolioValueStart = 0.; - double dblBankThreshold = -0.1; - double dblCounterPartyThreshold = 0.1; - - JulianDate dtSpot = DateUtil.Today(); - - JulianDate dtStart = dtSpot; - double dblTimeWidth = dblTime / iNumStep; - - CollateralGroupSpecification cgs = CollateralGroupSpecification.FixedThreshold ( - "FIXEDTHRESHOLD", - dblCounterPartyThreshold, - dblBankThreshold - ); - - CounterPartyGroupSpecification cpgs = CounterPartyGroupSpecification.Standard ("CPGROUP"); - - DiffusionEvolver dePortfolio = new DiffusionEvolver ( - DiffusionEvaluatorLinear.Standard ( - dblPortfolioDrift, - dblPortfolioVolatility - ) - ); - - JumpDiffusionEdge[] aJDESwapRate = dePortfolio.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblPortfolioValueStart, - 0., - false - ), - UnitRandom.Diffusion (SequenceGenerator.Gaussian (iNumStep)), - dblTimeWidth - ); - - System.out.println(); - - System.out.println ("\t||--------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| COLLATERAL AMOUNT ESTIMATION OUTPUT METRICS ||"); - - System.out.println ("\t||--------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t|| L -> R: ||"); - - System.out.println ("\t|| - Forward Date ||"); - - System.out.println ("\t|| - Forward Value ||"); - - System.out.println ("\t|| - Bank Margin Date ||"); - - System.out.println ("\t|| - Counter Party Margin Date ||"); - - System.out.println ("\t|| - Bank Window Margin Value ||"); - - System.out.println ("\t|| - Counter Party Window Margin Value ||"); - - System.out.println ("\t|| - Bank Collateral Threshold ||"); - - System.out.println ("\t|| - Counter Party Collateral Threshold ||"); - - System.out.println ("\t|| - Bank Posting Requirement ||"); - - System.out.println ("\t|| - Counter Party Posting Requirement ||"); - - System.out.println ("\t|| - Gross Posting Requirement ||"); - - System.out.println ("\t||--------------------------------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < iNumStep; ++i) { - JulianDate dtEnd = dtStart.addMonths (3); - - double dblPortfolioValueFinish = 0.25 * (iNumStep - i) * aJDESwapRate[i].finish(); - - CollateralAmountEstimator cae = new CollateralAmountEstimator ( - cgs, - cpgs, - new BrokenDateBridgeLinearT ( - dtStart.julian(), - dtEnd.julian(), - dblPortfolioValueStart, - dblPortfolioValueFinish - ), - Double.NaN - ); - - CollateralAmountEstimatorOutput caeo = cae.output (dtEnd); - - System.out.println ( - "\t|| " + - dtEnd + " => " + - FormatUtil.FormatDouble (dblPortfolioValueFinish, 1, 4, 1.) + " | " + - caeo.bankMarginDate() + " | " + - caeo.counterPartyMarginDate() + " | " + - FormatUtil.FormatDouble (caeo.bankWindowMarginValue(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (caeo.counterPartyWindowMarginValue(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (caeo.bankCollateralThreshold(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (caeo.counterPartyCollateralThreshold(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (caeo.bankPostingRequirement(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (caeo.counterPartyPostingRequirement(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (caeo.postingRequirement(), 1, 4, 1.) + " ||" - ); - - dtStart = dtEnd; - dblPortfolioValueStart = dblPortfolioValueFinish; - } - - System.out.println ("\t||--------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/xva/UncollateralizedCollateralGroup.java b/org/drip/sample/xva/UncollateralizedCollateralGroup.java deleted file mode 100644 index d1d6317..0000000 --- a/org/drip/sample/xva/UncollateralizedCollateralGroup.java +++ /dev/null @@ -1,344 +0,0 @@ - -package org.drip.sample.xva; - -import org.drip.analytics.date.*; -import org.drip.measure.discretemarginal.SequenceGenerator; -import org.drip.measure.dynamics.DiffusionEvaluatorLinear; -import org.drip.measure.process.DiffusionEvolver; -import org.drip.measure.realization.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.xva.trajectory.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * UncollateralizedCollateralGroup illustrates the Sample Run of a Single Uncollateralized Collateral Group - * with several Fix-Float Swaps. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class UncollateralizedCollateralGroup { - - private static final double[] ATMSwapRateOffsetRealization ( - final DiffusionEvolver deATMSwapRateOffset, - final double dblATMSwapRateOffsetStart, - final int iNumStep, - final double dblTime, - final double dblTimeWidth) - throws Exception - { - JumpDiffusionEdge[] aJDEATMSwapRateOffset = deATMSwapRateOffset.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblATMSwapRateOffsetStart, - 0., - false - ), - UnitRandom.Diffusion (SequenceGenerator.Gaussian (iNumStep)), - dblTimeWidth - ); - - double[] adblATMSwapRateOffsetRealization = new double[aJDEATMSwapRateOffset.length]; - - for (int i = 0; i < aJDEATMSwapRateOffset.length; ++i) - adblATMSwapRateOffsetRealization[i] = aJDEATMSwapRateOffset[i].finish(); - - return adblATMSwapRateOffsetRealization; - } - - private static final double[] SwapPortfolioValueRealization ( - final DiffusionEvolver deATMSwapRate, - final double dblATMSwapRateStart, - final int iNumStep, - final double dblTime, - final double dblTimeWidth, - final int iNumSwap) - throws Exception - { - double[] adblSwapPortfolioValueRealization = new double[iNumStep]; - - for (int i = 0; i < iNumStep; ++i) - adblSwapPortfolioValueRealization[i] = 0.; - - for (int i = 0; i < iNumSwap; ++i) { - double[] adblATMSwapRateOffsetRealization = ATMSwapRateOffsetRealization ( - deATMSwapRate, - dblATMSwapRateStart, - iNumStep, - dblTime, - dblTimeWidth - ); - - for (int j = 0; j < iNumStep; ++j) - adblSwapPortfolioValueRealization[j] += dblTimeWidth * (iNumStep - j) * adblATMSwapRateOffsetRealization[j]; - } - - return adblSwapPortfolioValueRealization; - } - - private static final double[][] SwapPortfolioValueRealization ( - final DiffusionEvolver deATMSwapRate, - final double dblSwapPortfolioValueStart, - final int iNumStep, - final double dblTime, - final double dblTimeWidth, - final int iNumSwap, - final int iNumSimulation) - throws Exception - { - double[][] aadblSwapPortfolioValueRealization = new double[iNumSimulation][]; - - for (int i = 0; i < iNumSimulation; ++i) - aadblSwapPortfolioValueRealization[i] = SwapPortfolioValueRealization ( - deATMSwapRate, - dblSwapPortfolioValueStart, - iNumStep, - dblTime, - dblTimeWidth, - iNumSwap - ); - - return aadblSwapPortfolioValueRealization; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iNumStep = 10; - int iNumSwap = 10; - double dblTime = 10.; - int iNumSimulation = 10000; - double dblATMSwapRateStart = 0.; - double dblATMSwapRateDrift = 0.0; - double dblATMSwapRateVolatility = 0.25; - double dblCSADrift = 0.01; - double dblBankHazardRate = 0.015; - double dblBankRecoveryRate = 0.40; - double dblCounterPartyHazardRate = 0.030; - double dblCounterPartyRecoveryRate = 0.30; - - JulianDate dtSpot = DateUtil.Today(); - - double dblTimeWidth = dblTime / iNumStep; - double[] adblCSA = new double[iNumStep]; - double[] adblBankSurvival = new double[iNumStep]; - double[] adblBankRecovery = new double[iNumStep]; - JulianDate[] adtVertex = new JulianDate[iNumStep]; - double[] adblBankFundingSpread = new double[iNumStep]; - double[] adblCounterPartySurvival = new double[iNumStep]; - double[] adblCounterPartyRecovery = new double[iNumStep]; - CollateralGroupPath[] aCGP = new CollateralGroupPath[iNumSimulation]; - double dblBankFundingSpread = dblBankHazardRate / (1. - dblBankRecoveryRate); - CollateralGroupVertex[][] aaCGV = new CollateralGroupVertex[iNumSimulation][iNumStep]; - - double[][] aadblSwapPortfolioValueRealization = SwapPortfolioValueRealization ( - new DiffusionEvolver ( - DiffusionEvaluatorLinear.Standard ( - dblATMSwapRateDrift, - dblATMSwapRateVolatility - ) - ), - dblATMSwapRateStart, - iNumStep, - dblTime, - dblTimeWidth, - iNumSwap, - iNumSimulation - ); - - for (int i = 0; i < iNumStep; ++i) { - adblBankRecovery[i] = dblBankRecoveryRate; - adblBankFundingSpread[i] = dblBankFundingSpread; - adblCounterPartyRecovery[i] = dblCounterPartyRecoveryRate; - - adtVertex[i] = dtSpot.addMonths (6 * i + 6); - - adblCSA[i] = Math.exp (0.5 * dblCSADrift * (i + 1)); - - adblBankSurvival[i] = Math.exp (-0.5 * dblBankHazardRate * (i + 1)); - - adblCounterPartySurvival[i] = Math.exp (-0.5 * dblCounterPartyHazardRate * (i + 1)); - } - - for (int i = 0; i < iNumStep; ++i) { - for (int j = 0; j < iNumSimulation; ++j) - aaCGV[j][i] = new CollateralGroupVertex ( - adtVertex[i], - new CollateralGroupVertexExposure ( - aadblSwapPortfolioValueRealization[j][i], - 0., - 0. - ), - new CollateralGroupVertexNumeraire ( - adblCSA[i], - adblBankSurvival[i], - adblBankRecovery[i], - adblBankFundingSpread[i], - adblCounterPartySurvival[i], - adblCounterPartyRecovery[i] - ) - ); - } - - for (int j = 0; j < iNumSimulation; ++j) { - CollateralGroupEdge[] aCGE = new CollateralGroupEdge[iNumStep - 1]; - - for (int i = 1; i < iNumStep; ++i) - aCGE[i - 1] = new CollateralGroupEdge ( - aaCGV[j][i - 1], - aaCGV[j][i] - ); - - aCGP[j] = new CollateralGroupPath (aCGE); - } - - NettingGroupPathAggregator ngpa = NettingGroupPathAggregator.Standard (aCGP); - - JulianDate[] adtVertexNode = ngpa.vertexes(); - - System.out.println(); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - String strDump = "\t| DATE =>" ; - - for (int i = 0; i < adtVertexNode.length; ++i) - strDump = strDump + " " + adtVertexNode[i] + " |"; - - System.out.println (strDump); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - double[] adblEE = ngpa.collateralizedExposure(); - - strDump = "\t| EXPOSURE => " + FormatUtil.FormatDouble (dblTime * dblATMSwapRateStart, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEPE = ngpa.collateralizedPositiveExposure(); - - strDump = "\t| POSITIVE EXPOSURE => " + FormatUtil.FormatDouble (dblTime * dblATMSwapRateStart, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEPE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEPE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblENE = ngpa.collateralizedNegativeExposure(); - - strDump = "\t| NEGATIVE EXPOSURE => " + FormatUtil.FormatDouble (0., 1, 4, 1.) + " |"; - - for (int j = 0; j < adblENE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblENE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEEPV = ngpa.collateralizedExposurePV(); - - strDump = "\t| EXPOSURE PV => " + FormatUtil.FormatDouble (dblTime * dblATMSwapRateStart, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEPEPV = ngpa.collateralizedPositiveExposurePV(); - - strDump = "\t| POSITIVE EXPOSURE PV => " + FormatUtil.FormatDouble (dblTime * dblATMSwapRateStart, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEPEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEPEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblENEPV = ngpa.collateralizedNegativeExposurePV(); - - strDump = "\t| NEGATIVE EXPOSURE PV => " + FormatUtil.FormatDouble (0., 1, 4, 1.) + " |"; - - for (int j = 0; j < adblENEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblENEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - System.out.println(); - - System.out.println ("\t||----------------||"); - - System.out.println ("\t|| CVA => " + FormatUtil.FormatDouble (ngpa.cva(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|| DVA => " + FormatUtil.FormatDouble (ngpa.dva(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|| FVA => " + FormatUtil.FormatDouble (ngpa.fca(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t||----------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/xva/UncollateralizedCollateralGroupCorrelated.java b/org/drip/sample/xva/UncollateralizedCollateralGroupCorrelated.java deleted file mode 100644 index 89994ce..0000000 --- a/org/drip/sample/xva/UncollateralizedCollateralGroupCorrelated.java +++ /dev/null @@ -1,435 +0,0 @@ - -package org.drip.sample.xva; - -import org.drip.analytics.date.*; -import org.drip.measure.discretemarginal.SequenceGenerator; -import org.drip.measure.dynamics.*; -import org.drip.measure.process.DiffusionEvolver; -import org.drip.measure.realization.*; -import org.drip.quant.common.FormatUtil; -import org.drip.quant.linearalgebra.Matrix; -import org.drip.service.env.EnvManager; -import org.drip.xva.trajectory.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * UncollateralizedCollateralGroupCorrelated illustrates the Sample Run of a Single Uncollateralized - * Collateral Group with several Fix-Float Swaps, and with built in Factor Correlations across the - * Numeraires. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class UncollateralizedCollateralGroupCorrelated { - - private static final double[] ATMSwapRateOffsetRealization ( - final DiffusionEvolver deATMSwapRateOffset, - final double dblATMSwapRateOffsetStart, - final int iNumStep, - final double[] adblRandom, - final double dblTime, - final double dblTimeWidth) - throws Exception - { - JumpDiffusionEdge[] aJDEATMSwapRateOffset = deATMSwapRateOffset.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblATMSwapRateOffsetStart, - 0., - false - ), - UnitRandom.Diffusion (adblRandom), - dblTimeWidth - ); - - double[] adblATMSwapRateOffsetRealization = new double[aJDEATMSwapRateOffset.length]; - - for (int i = 0; i < aJDEATMSwapRateOffset.length; ++i) - adblATMSwapRateOffsetRealization[i] = aJDEATMSwapRateOffset[i].finish(); - - return adblATMSwapRateOffsetRealization; - } - - private static final double[] SwapPortfolioValueRealization ( - final DiffusionEvolver deATMSwapRateOffset, - final double dblATMSwapRateOffsetStart, - final int iNumStep, - final double[] adblRandom, - final double dblTime, - final double dblTimeWidth, - final int iNumSwap) - throws Exception - { - double[] adblSwapPortfolioValueRealization = new double[iNumStep]; - - for (int i = 0; i < iNumStep; ++i) - adblSwapPortfolioValueRealization[i] = 0.; - - for (int i = 0; i < iNumSwap; ++i) { - double[] adblATMSwapRateOffsetRealization = ATMSwapRateOffsetRealization ( - deATMSwapRateOffset, - dblATMSwapRateOffsetStart, - iNumStep, - adblRandom, - dblTime, - dblTimeWidth - ); - - for (int j = 0; j < iNumStep; ++j) - adblSwapPortfolioValueRealization[j] += dblTimeWidth * (iNumStep - j) * adblATMSwapRateOffsetRealization[j]; - } - - return adblSwapPortfolioValueRealization; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iNumStep = 10; - int iNumSwap = 10; - double dblTime = 5.; - int iNumSimulation = 50000; - double dblATMSwapRateOffsetDrift = 0.0; - double dblATMSwapRateOffsetVolatility = 0.25; - double dblATMSwapRateOffsetStart = 0.; - double dblCSADrift = 0.01; - double dblCSAVolatility = 0.05; - double dblCSAInitial = 1.; - double dblBankHazardRateDrift = 0.002; - double dblBankHazardRateVolatility = 0.20; - double dblBankHazardRateInitial = 0.015; - double dblBankRecoveryRateDrift = 0.002; - double dblBankRecoveryRateVolatility = 0.02; - double dblBankRecoveryRateInitial = 0.40; - double dblCounterPartyHazardRateDrift = 0.002; - double dblCounterPartyHazardRateVolatility = 0.30; - double dblCounterPartyHazardRateInitial = 0.030; - double dblCounterPartyRecoveryRateDrift = 0.002; - double dblCounterPartyRecoveryRateVolatility = 0.02; - double dblCounterPartyRecoveryRateInitial = 0.30; - double dblBankFundingSpreadDrift = 0.00002; - double dblBankFundingSpreadVolatility = 0.002; - - double[][] aadblCorrelation = new double[][] { - {1.00, 0.03, 0.07, 0.04, 0.05, 0.08, 0.00}, // PORTFOLIO - {0.03, 1.00, 0.26, 0.33, 0.21, 0.35, 0.13}, // CSA - {0.07, 0.26, 1.00, 0.45, -0.17, 0.07, 0.77}, // BANK HAZARD - {0.04, 0.33, 0.45, 1.00, -0.22, -0.54, 0.58}, // COUNTER PARTY HAZARD - {0.05, 0.21, -0.17, -0.22, 1.00, 0.47, -0.23}, // BANK RECOVERY - {0.08, 0.35, 0.07, -0.54, 0.47, 1.00, 0.01}, // COUNTER PARTY RECOVERY - {0.00, 0.13, 0.77, 0.58, -0.23, 0.01, 1.00} // BANK FUNDING SPREAD - }; - - JulianDate dtSpot = DateUtil.Today(); - - double dblTimeWidth = dblTime / iNumStep; - JulianDate[] adtVertex = new JulianDate[iNumStep]; - double[][] aadblPortfolioValue = new double[iNumSimulation][iNumStep]; - double[][] aadblCollateralBalance = new double[iNumSimulation][iNumStep]; - double dblBankFundingSpreadInitial = dblBankHazardRateInitial / (1. - dblBankRecoveryRateInitial); - CollateralGroupVertexNumeraire[][] aaCGVN = new CollateralGroupVertexNumeraire[iNumSimulation][iNumStep]; - - for (int j = 0; j < iNumStep; ++j) - adtVertex[j] = dtSpot.addMonths (6 * j + 6); - - DiffusionEvolver deATMSwapRateOffset = new DiffusionEvolver ( - DiffusionEvaluatorLinear.Standard ( - dblATMSwapRateOffsetDrift, - dblATMSwapRateOffsetVolatility - ) - ); - - DiffusionEvolver deCSA = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblCSADrift, - dblCSAVolatility - ) - ); - - DiffusionEvolver deBankHazardRate = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblBankHazardRateDrift, - dblBankHazardRateVolatility - ) - ); - - DiffusionEvolver deCounterPartyHazardRate = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblCounterPartyHazardRateDrift, - dblCounterPartyHazardRateVolatility - ) - ); - - DiffusionEvolver deBankRecoveryRate = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblBankRecoveryRateDrift, - dblBankRecoveryRateVolatility - ) - ); - - DiffusionEvolver deCounterPartyRecoveryRate = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblCounterPartyRecoveryRateDrift, - dblCounterPartyRecoveryRateVolatility - ) - ); - - DiffusionEvolver deBankFundingSpread = new DiffusionEvolver ( - DiffusionEvaluatorLinear.Standard ( - dblBankFundingSpreadDrift, - dblBankFundingSpreadVolatility - ) - ); - - for (int i = 0; i < iNumSimulation; ++i) { - double[][] aadblNumeraire = Matrix.Transpose ( - SequenceGenerator.GaussianJoint ( - iNumStep, - aadblCorrelation - ) - ); - - aadblPortfolioValue[i] = SwapPortfolioValueRealization ( - deATMSwapRateOffset, - dblATMSwapRateOffsetStart, - iNumStep, - aadblNumeraire[0], - dblTime, - dblTimeWidth, - iNumSwap - ); - - JumpDiffusionEdge[] aJDECSA = deCSA.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblCSAInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[1]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDEBankHazardRate = deBankHazardRate.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblBankHazardRateInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[2]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDECounterPartyHazardRate = deCounterPartyHazardRate.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblCounterPartyHazardRateInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[3]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDEBankRecoveryRate = deBankRecoveryRate.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblBankRecoveryRateInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[4]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDECounterPartyRecoveryRate = deCounterPartyRecoveryRate.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblCounterPartyRecoveryRateInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[5]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDEBankFundingSpread = deBankFundingSpread.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblBankFundingSpreadInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[6]), - dblTimeWidth - ); - - for (int j = 0; j < iNumStep; ++j) { - aaCGVN[i][j] = new CollateralGroupVertexNumeraire ( - aJDECSA[j].finish(), - Math.exp (-0.5 * aJDEBankHazardRate[j].finish() * (j + 1)), - aJDEBankRecoveryRate[j].finish(), - aJDEBankFundingSpread[j].finish(), - Math.exp (-0.5 * aJDECounterPartyHazardRate[j].finish() * (j + 1)), - aJDECounterPartyRecoveryRate[j].finish() - ); - - aadblCollateralBalance[i][j] = 0.; - } - } - - NettingGroupPathAggregator ngpa = NettingGroupPathAggregator.Standard ( - adtVertex, - aadblPortfolioValue, - aadblCollateralBalance, - aaCGVN - ); - - JulianDate[] adtVertexNode = ngpa.vertexes(); - - System.out.println(); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - String strDump = "\t| DATE =>" ; - - for (int i = 0; i < adtVertexNode.length; ++i) - strDump = strDump + " " + adtVertexNode[i] + " |"; - - System.out.println (strDump); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - double[] adblEE = ngpa.collateralizedExposure(); - - strDump = "\t| EXPOSURE => " + FormatUtil.FormatDouble (dblTime * dblATMSwapRateOffsetStart, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEPE = ngpa.collateralizedPositiveExposure(); - - strDump = "\t| POSITIVE EXPOSURE => " + FormatUtil.FormatDouble (dblTime * dblATMSwapRateOffsetStart, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEPE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEPE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblENE = ngpa.collateralizedNegativeExposure(); - - strDump = "\t| NEGATIVE EXPOSURE => " + FormatUtil.FormatDouble (0., 1, 4, 1.) + " |"; - - for (int j = 0; j < adblENE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblENE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEEPV = ngpa.collateralizedExposurePV(); - - strDump = "\t| EXPOSURE PV => " + FormatUtil.FormatDouble (dblTime * dblATMSwapRateOffsetStart, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEPEPV = ngpa.collateralizedPositiveExposurePV(); - - strDump = "\t| POSITIVE EXPOSURE PV => " + FormatUtil.FormatDouble (dblTime * dblATMSwapRateOffsetStart, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEPEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEPEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblENEPV = ngpa.collateralizedNegativeExposurePV(); - - strDump = "\t| NEGATIVE EXPOSURE PV => " + FormatUtil.FormatDouble (0., 1, 4, 1.) + " |"; - - for (int j = 0; j < adblENEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblENEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - System.out.println(); - - System.out.println ("\t||----------------||"); - - System.out.println ("\t|| CVA => " + FormatUtil.FormatDouble (ngpa.cva(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|| DVA => " + FormatUtil.FormatDouble (ngpa.dva(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|| FVA => " + FormatUtil.FormatDouble (ngpa.fca(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t||----------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/xva/ZeroThresholdCollateralGroup.java b/org/drip/sample/xva/ZeroThresholdCollateralGroup.java deleted file mode 100644 index 6f00490..0000000 --- a/org/drip/sample/xva/ZeroThresholdCollateralGroup.java +++ /dev/null @@ -1,378 +0,0 @@ - -package org.drip.sample.xva; - -import org.drip.analytics.date.*; -import org.drip.measure.continuousmarginal.BrokenDateBridgeLinearT; -import org.drip.measure.discretemarginal.SequenceGenerator; -import org.drip.measure.dynamics.DiffusionEvaluatorLinear; -import org.drip.measure.process.DiffusionEvolver; -import org.drip.measure.realization.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.xva.settings.*; -import org.drip.xva.trajectory.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * ZeroThresholdCollateralGroup illustrates the Sample Run of a Single Partially Collateralized Collateral - * Group under Zero Bank/Counter Party Threshold with several Fix-Float Swaps. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class ZeroThresholdCollateralGroup { - - private static final double[] ATMSwapRateOffsetRealization ( - final DiffusionEvolver deATMSwapRateOffset, - final double dblATMSwapRateOffsetStart, - final int iNumStep, - final double dblTime, - final double dblTimeWidth) - throws Exception - { - JumpDiffusionEdge[] aJDEATMSwapRateOffset = deATMSwapRateOffset.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblATMSwapRateOffsetStart, - 0., - false - ), - UnitRandom.Diffusion (SequenceGenerator.Gaussian (iNumStep)), - dblTimeWidth - ); - - double[] adblATMSwapRateOffsetRealization = new double[aJDEATMSwapRateOffset.length]; - - for (int i = 0; i < aJDEATMSwapRateOffset.length; ++i) - adblATMSwapRateOffsetRealization[i] = aJDEATMSwapRateOffset[i].finish(); - - return adblATMSwapRateOffsetRealization; - } - - private static final double[] SwapPortfolioValueRealization ( - final DiffusionEvolver deATMSwapRateOffset, - final double dblATMSwapRateOffsetStart, - final int iNumStep, - final double dblTime, - final double dblTimeWidth, - final int iNumSwap) - throws Exception - { - double[] adblSwapPortfolioValueRealization = new double[iNumStep]; - - for (int i = 0; i < iNumStep; ++i) - adblSwapPortfolioValueRealization[i] = 0.; - - for (int i = 0; i < iNumSwap; ++i) { - double[] adblATMSwapRateOffsetRealization = ATMSwapRateOffsetRealization ( - deATMSwapRateOffset, - dblATMSwapRateOffsetStart, - iNumStep, - dblTime, - dblTimeWidth - ); - - for (int j = 0; j < iNumStep; ++j) - adblSwapPortfolioValueRealization[j] += dblTimeWidth * (iNumStep - j) * adblATMSwapRateOffsetRealization[j]; - } - - return adblSwapPortfolioValueRealization; - } - - private static final double[][] SwapPortfolioValueRealization ( - final DiffusionEvolver deSwap, - final double dblSwapValueStart, - final int iNumStep, - final double dblTime, - final double dblTimeWidth, - final int iNumSwap, - final int iNumSimulation) - throws Exception - { - double[][] aadblSwapPortfolioValueRealization = new double[iNumSimulation][]; - - for (int i = 0; i < iNumSimulation; ++i) - aadblSwapPortfolioValueRealization[i] = SwapPortfolioValueRealization ( - deSwap, - dblSwapValueStart, - iNumStep, - dblTime, - dblTimeWidth, - iNumSwap - ); - - return aadblSwapPortfolioValueRealization; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iNumStep = 10; - int iNumSwap = 10; - double dblTime = 5.; - int iNumSimulation = 1000; - double dblATMSwapRateOffsetStart = 0.; - double dblATMSwapRateOffsetDrift = 0.0; - double dblATMSwapRateOffsetVolatility = 0.25; - double dblCSADrift = 0.01; - double dblBankHazardRate = 0.015; - double dblBankRecoveryRate = 0.40; - double dblCounterPartyHazardRate = 0.030; - double dblCounterPartyRecoveryRate = 0.30; - - JulianDate dtSpot = DateUtil.Today(); - - double dblTimeWidth = dblTime / iNumStep; - double[] adblCSA = new double[iNumStep]; - double[] adblBankSurvival = new double[iNumStep]; - double[] adblBankRecovery = new double[iNumStep]; - JulianDate[] adtVertex = new JulianDate[iNumStep]; - double[] adblBankFundingSpread = new double[iNumStep]; - double[] adblCounterPartySurvival = new double[iNumStep]; - double[] adblCounterPartyRecovery = new double[iNumStep]; - CollateralGroupPath[] aCGP = new CollateralGroupPath[iNumSimulation]; - double dblBankFundingSpread = dblBankHazardRate / (1. - dblBankRecoveryRate); - CollateralGroupVertex[][] aaCGV = new CollateralGroupVertex[iNumSimulation][iNumStep]; - - CollateralGroupSpecification cgs = CollateralGroupSpecification.FixedThreshold ( - "FIXEDTHRESHOLD", - 0., - 0. - ); - - CounterPartyGroupSpecification cpgs = CounterPartyGroupSpecification.Standard ("CPGROUP"); - - DiffusionEvolver deATMSwapRateOffset = new DiffusionEvolver ( - DiffusionEvaluatorLinear.Standard ( - dblATMSwapRateOffsetDrift, - dblATMSwapRateOffsetVolatility - ) - ); - - double[][] aadblSwapPortfolioValueRealization = SwapPortfolioValueRealization ( - deATMSwapRateOffset, - dblATMSwapRateOffsetStart, - iNumStep, - dblTime, - dblTimeWidth, - iNumSwap, - iNumSimulation - ); - - for (int i = 0; i < iNumStep; ++i) { - adblBankRecovery[i] = dblBankRecoveryRate; - adblBankFundingSpread[i] = dblBankFundingSpread; - adblCounterPartyRecovery[i] = dblCounterPartyRecoveryRate; - - adtVertex[i] = dtSpot.addMonths (((int) dblTime) * 12 * (i + 1) / iNumStep); - - adblCSA[i] = Math.exp (0.5 * dblCSADrift * (i + 1)); - - adblBankSurvival[i] = Math.exp (-0.5 * dblBankHazardRate * (i + 1)); - - adblCounterPartySurvival[i] = Math.exp (-0.5 * dblCounterPartyHazardRate * (i + 1)); - } - - for (int j = 0; j < iNumSimulation; ++j) { - JulianDate dtStart = dtSpot; - double dblValueStart = dblTime * dblATMSwapRateOffsetStart; - - for (int i = 0; i < iNumStep; ++i) { - JulianDate dtEnd = adtVertex[i]; - double dblValueEnd = dblTimeWidth * (iNumStep - i) * aadblSwapPortfolioValueRealization[j][i]; - - CollateralAmountEstimator cae = new CollateralAmountEstimator ( - cgs, - cpgs, - new BrokenDateBridgeLinearT ( - dtStart.julian(), - dtEnd.julian(), - dblValueStart, - dblValueEnd - ), - Double.NaN - ); - - aaCGV[j][i] = new CollateralGroupVertex ( - adtVertex[i], - new CollateralGroupVertexExposure ( - dblValueEnd, - 0., - cae.postingRequirement (dtEnd) - ), - new CollateralGroupVertexNumeraire ( - adblCSA[i], - adblBankSurvival[i], - adblBankRecovery[i], - adblBankFundingSpread[i], - adblCounterPartySurvival[i], - adblCounterPartyRecovery[i] - ) - ); - - dtStart = dtEnd; - dblValueStart = dblValueEnd; - } - } - - for (int j = 0; j < iNumSimulation; ++j) { - CollateralGroupEdge[] aCGE = new CollateralGroupEdge[iNumStep - 1]; - - for (int i = 1; i < iNumStep; ++i) - aCGE[i - 1] = new CollateralGroupEdge ( - aaCGV[j][i - 1], - aaCGV[j][i] - ); - - aCGP[j] = new CollateralGroupPath (aCGE); - } - - NettingGroupPathAggregator ngpa = NettingGroupPathAggregator.Standard (aCGP); - - JulianDate[] adtVertexNode = ngpa.vertexes(); - - System.out.println(); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - String strDump = "\t| DATE =>" ; - - for (int i = 0; i < adtVertexNode.length; ++i) - strDump = strDump + " " + adtVertexNode[i] + " |"; - - System.out.println (strDump); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - double[] adblEE = ngpa.collateralizedExposure(); - - strDump = "\t| EXPOSURE => " + FormatUtil.FormatDouble (dblTime * dblATMSwapRateOffsetStart, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEPE = ngpa.collateralizedPositiveExposure(); - - strDump = "\t| POSITIVE EXPOSURE => " + FormatUtil.FormatDouble (dblTime * dblATMSwapRateOffsetStart, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEPE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEPE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblENE = ngpa.collateralizedNegativeExposure(); - - strDump = "\t| NEGATIVE EXPOSURE => " + FormatUtil.FormatDouble (0., 1, 4, 1.) + " |"; - - for (int j = 0; j < adblENE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblENE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEEPV = ngpa.collateralizedExposurePV(); - - strDump = "\t| EXPOSURE PV => " + FormatUtil.FormatDouble (dblTime * dblATMSwapRateOffsetStart, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEPEPV = ngpa.collateralizedPositiveExposurePV(); - - strDump = "\t| POSITIVE EXPOSURE PV => " + FormatUtil.FormatDouble (dblTime * dblATMSwapRateOffsetStart, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEPEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEPEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblENEPV = ngpa.collateralizedNegativeExposurePV(); - - strDump = "\t| NEGATIVE EXPOSURE PV => " + FormatUtil.FormatDouble (0., 1, 4, 1.) + " |"; - - for (int j = 0; j < adblENEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblENEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - System.out.println(); - - System.out.println ("\t||----------------||"); - - System.out.println ("\t|| CVA => " + FormatUtil.FormatDouble (ngpa.cva(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|| DVA => " + FormatUtil.FormatDouble (ngpa.dva(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|| FVA => " + FormatUtil.FormatDouble (ngpa.fca(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t||----------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sample/xva/ZeroThresholdCollateralGroupCorrelated.java b/org/drip/sample/xva/ZeroThresholdCollateralGroupCorrelated.java deleted file mode 100644 index 6b4a314..0000000 --- a/org/drip/sample/xva/ZeroThresholdCollateralGroupCorrelated.java +++ /dev/null @@ -1,466 +0,0 @@ - -package org.drip.sample.xva; - -import org.drip.analytics.date.*; -import org.drip.measure.continuousmarginal.BrokenDateBridgeLinearT; -import org.drip.measure.discretemarginal.SequenceGenerator; -import org.drip.measure.dynamics.*; -import org.drip.measure.process.DiffusionEvolver; -import org.drip.measure.realization.*; -import org.drip.quant.common.FormatUtil; -import org.drip.quant.linearalgebra.Matrix; -import org.drip.service.env.EnvManager; -import org.drip.xva.settings.*; -import org.drip.xva.trajectory.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * ZeroThresholdCollateralGroupCorrelated illustrates the Sample Run of a Single Partially Collateralized - * Collateral Group under Zero Bank/Counter Party Threshold with several Fix-Float Swaps, and with built in - * Factor Correlations across the Numeraires. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class ZeroThresholdCollateralGroupCorrelated { - - private static final double[] ATMSwapRateOffsetRealization ( - final DiffusionEvolver deATMSwapRateOffset, - final double dblATMSwapRateOffsetStart, - final int iNumStep, - final double[] adblRandom, - final double dblTime, - final double dblTimeWidth) - throws Exception - { - JumpDiffusionEdge[] aJDEATMSwapRateOffset = deATMSwapRateOffset.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblATMSwapRateOffsetStart, - 0., - false - ), - UnitRandom.Diffusion (adblRandom), - dblTimeWidth - ); - - double[] adblATMSwapRateOffsetRealization = new double[aJDEATMSwapRateOffset.length]; - - for (int i = 0; i < aJDEATMSwapRateOffset.length; ++i) - adblATMSwapRateOffsetRealization[i] = aJDEATMSwapRateOffset[i].finish(); - - return adblATMSwapRateOffsetRealization; - } - - private static final double[] SwapPortfolioValueRealization ( - final DiffusionEvolver deATMSwapRateOffset, - final double dblATMSwapRateOffsetStart, - final int iNumStep, - final double[] adblRandom, - final double dblTime, - final double dblTimeWidth, - final int iNumSwap) - throws Exception - { - double[] adblSwapPortfolioValueRealization = new double[iNumStep]; - - for (int i = 0; i < iNumStep; ++i) - adblSwapPortfolioValueRealization[i] = 0.; - - for (int i = 0; i < iNumSwap; ++i) { - double[] adblATMSwapRateOffsetRealization = ATMSwapRateOffsetRealization ( - deATMSwapRateOffset, - dblATMSwapRateOffsetStart, - iNumStep, - adblRandom, - dblTime, - dblTimeWidth - ); - - for (int j = 0; j < iNumStep; ++j) - adblSwapPortfolioValueRealization[j] += dblTimeWidth * (iNumStep - j)* adblATMSwapRateOffsetRealization[j]; - } - - return adblSwapPortfolioValueRealization; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - int iNumStep = 10; - int iNumSwap = 10; - double dblTime = 10.; - int iNumSimulation = 1000; - double dblATMSwapRateOffsetDrift = 0.0; - double dblATMSwapRateOffsetVolatility = 0.25; - double dblATMSwapRateOffsetInitial = 0.; - double dblCSADrift = 0.01; - double dblCSAVolatility = 0.05; - double dblCSAInitial = 1.; - double dblBankHazardRateDrift = 0.002; - double dblBankHazardRateVolatility = 0.20; - double dblBankHazardRateInitial = 0.015; - double dblBankRecoveryRateDrift = 0.002; - double dblBankRecoveryRateVolatility = 0.02; - double dblBankRecoveryRateInitial = 0.40; - double dblCounterPartyHazardRateDrift = 0.002; - double dblCounterPartyHazardRateVolatility = 0.30; - double dblCounterPartyHazardRateInitial = 0.030; - double dblCounterPartyRecoveryRateDrift = 0.002; - double dblCounterPartyRecoveryRateVolatility = 0.02; - double dblCounterPartyRecoveryRateInitial = 0.30; - double dblBankFundingSpreadDrift = 0.00002; - double dblBankFundingSpreadVolatility = 0.002; - - double[][] aadblCorrelation = new double[][] { - {1.00, 0.03, 0.07, 0.04, 0.05, 0.08, 0.00}, // PORTFOLIO - {0.03, 1.00, 0.26, 0.33, 0.21, 0.35, 0.13}, // CSA - {0.07, 0.26, 1.00, 0.45, -0.17, 0.07, 0.77}, // BANK HAZARD - {0.04, 0.33, 0.45, 1.00, -0.22, -0.54, 0.58}, // COUNTER PARTY HAZARD - {0.05, 0.21, -0.17, -0.22, 1.00, 0.47, -0.23}, // BANK RECOVERY - {0.08, 0.35, 0.07, -0.54, 0.47, 1.00, 0.01}, // COUNTER PARTY RECOVERY - {0.00, 0.13, 0.77, 0.58, -0.23, 0.01, 1.00} // BANK FUNDING SPREAD - }; - - JulianDate dtSpot = DateUtil.Today(); - - double dblTimeWidth = dblTime / iNumStep; - JulianDate[] adtVertex = new JulianDate[iNumStep]; - double[][] aadblPortfolioValue = new double[iNumSimulation][iNumStep]; - double[][] aadblCollateralBalance = new double[iNumSimulation][iNumStep]; - double dblBankFundingSpreadInitial = dblBankHazardRateInitial / (1. - dblBankRecoveryRateInitial); - CollateralGroupVertexNumeraire[][] aaCGVN = new CollateralGroupVertexNumeraire[iNumSimulation][iNumStep]; - - CollateralGroupSpecification cgs = CollateralGroupSpecification.FixedThreshold ( - "FIXEDTHRESHOLD", - 0., - 0. - ); - - CounterPartyGroupSpecification cpgs = CounterPartyGroupSpecification.Standard ("CPGROUP"); - - for (int j = 0; j < iNumStep; ++j) - adtVertex[j] = dtSpot.addMonths (6 * j + 6); - - DiffusionEvolver deATMSwapRateOffset = new DiffusionEvolver ( - DiffusionEvaluatorLinear.Standard ( - dblATMSwapRateOffsetDrift, - dblATMSwapRateOffsetVolatility - ) - ); - - DiffusionEvolver deCSA = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblCSADrift, - dblCSAVolatility - ) - ); - - DiffusionEvolver deBankHazardRate = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblBankHazardRateDrift, - dblBankHazardRateVolatility - ) - ); - - DiffusionEvolver deCounterPartyHazardRate = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblCounterPartyHazardRateDrift, - dblCounterPartyHazardRateVolatility - ) - ); - - DiffusionEvolver deBankRecoveryRate = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblBankRecoveryRateDrift, - dblBankRecoveryRateVolatility - ) - ); - - DiffusionEvolver deCounterPartyRecoveryRate = new DiffusionEvolver ( - DiffusionEvaluatorLogarithmic.Standard ( - dblCounterPartyRecoveryRateDrift, - dblCounterPartyRecoveryRateVolatility - ) - ); - - DiffusionEvolver deBankFundingSpread = new DiffusionEvolver ( - DiffusionEvaluatorLinear.Standard ( - dblBankFundingSpreadDrift, - dblBankFundingSpreadVolatility - ) - ); - - for (int i = 0; i < iNumSimulation; ++i) { - double[][] aadblNumeraire = Matrix.Transpose ( - SequenceGenerator.GaussianJoint ( - iNumStep, - aadblCorrelation - ) - ); - - aadblPortfolioValue[i] = SwapPortfolioValueRealization ( - deATMSwapRateOffset, - dblATMSwapRateOffsetInitial, - iNumStep, - aadblNumeraire[0], - dblTime, - dblTimeWidth, - iNumSwap - ); - - JumpDiffusionEdge[] aJDECSA = deCSA.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblCSAInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[1]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDEBankHazardRate = deBankHazardRate.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblBankHazardRateInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[2]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDECounterPartyHazardRate = deCounterPartyHazardRate.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblCounterPartyHazardRateInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[3]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDEBankRecoveryRate = deBankRecoveryRate.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblBankRecoveryRateInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[4]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDECounterPartyRecoveryRate = deCounterPartyRecoveryRate.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblCounterPartyRecoveryRateInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[5]), - dblTimeWidth - ); - - JumpDiffusionEdge[] aJDEBankFundingSpread = deBankFundingSpread.incrementSequence ( - new JumpDiffusionVertex ( - dblTime, - dblBankFundingSpreadInitial, - 0., - false - ), - UnitRandom.Diffusion (aadblNumeraire[6]), - dblTimeWidth - ); - - JulianDate dtStart = dtSpot; - double dblValueStart = dblTime * dblATMSwapRateOffsetInitial; - - for (int j = 0; j < iNumStep; ++j) { - JulianDate dtEnd = adtVertex[j]; - double dblValueEnd = aadblPortfolioValue[i][j]; - - aaCGVN[i][j] = new CollateralGroupVertexNumeraire ( - aJDECSA[j].finish(), - Math.exp (-0.5 * aJDEBankHazardRate[j].finish() * (j + 1)), - aJDEBankRecoveryRate[j].finish(), - aJDEBankFundingSpread[j].finish(), - Math.exp (-0.5 * aJDECounterPartyHazardRate[j].finish() * (j + 1)), - aJDECounterPartyRecoveryRate[j].finish() - ); - - CollateralAmountEstimator cae = new CollateralAmountEstimator ( - cgs, - cpgs, - new BrokenDateBridgeLinearT ( - dtStart.julian(), - dtEnd.julian(), - dblValueStart, - dblValueEnd - ), - Double.NaN - ); - - aadblCollateralBalance[i][j] = cae.postingRequirement (dtEnd); - - dblValueStart = dblValueEnd; - dtStart = dtEnd; - } - } - - NettingGroupPathAggregator ngpa = NettingGroupPathAggregator.Standard ( - adtVertex, - aadblPortfolioValue, - aadblCollateralBalance, - aaCGVN - ); - - JulianDate[] adtVertexNode = ngpa.vertexes(); - - System.out.println(); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - String strDump = "\t| DATE =>" ; - - for (int i = 0; i < adtVertexNode.length; ++i) - strDump = strDump + " " + adtVertexNode[i] + " |"; - - System.out.println (strDump); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - double[] adblEE = ngpa.collateralizedExposure(); - - strDump = "\t| EXPOSURE => " + FormatUtil.FormatDouble (dblTime * dblATMSwapRateOffsetInitial, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEPE = ngpa.collateralizedPositiveExposure(); - - strDump = "\t| POSITIVE EXPOSURE => " + FormatUtil.FormatDouble (dblTime * dblATMSwapRateOffsetInitial, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEPE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEPE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblENE = ngpa.collateralizedNegativeExposure(); - - strDump = "\t| NEGATIVE EXPOSURE => " + FormatUtil.FormatDouble (0., 1, 4, 1.) + " |"; - - for (int j = 0; j < adblENE.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblENE[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEEPV = ngpa.collateralizedExposurePV(); - - strDump = "\t| EXPOSURE PV => " + FormatUtil.FormatDouble (dblTime * dblATMSwapRateOffsetInitial, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblEPEPV = ngpa.collateralizedPositiveExposurePV(); - - strDump = "\t| POSITIVE EXPOSURE PV => " + FormatUtil.FormatDouble (dblTime * dblATMSwapRateOffsetInitial, 1, 4, 1.) + " |"; - - for (int j = 0; j < adblEPEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblEPEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - double[] adblENEPV = ngpa.collateralizedNegativeExposurePV(); - - strDump = "\t| NEGATIVE EXPOSURE PV => " + FormatUtil.FormatDouble (0., 1, 4, 1.) + " |"; - - for (int j = 0; j < adblENEPV.length; ++j) - strDump = strDump + " " + FormatUtil.FormatDouble (adblENEPV[j], 1, 4, 1.) + " |"; - - System.out.println (strDump); - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|"); - - System.out.println(); - - System.out.println ("\t||----------------||"); - - System.out.println ("\t|| CVA => " + FormatUtil.FormatDouble (ngpa.cva(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|| DVA => " + FormatUtil.FormatDouble (ngpa.dva(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t|| FVA => " + FormatUtil.FormatDouble (ngpa.fca(), 2, 2, 100.) + "% ||"); - - System.out.println ("\t||----------------||"); - - System.out.println(); - } -} diff --git a/org/drip/sequence/custom/BinPacking.java b/org/drip/sequence/custom/BinPacking.java deleted file mode 100644 index b6a0069..0000000 --- a/org/drip/sequence/custom/BinPacking.java +++ /dev/null @@ -1,114 +0,0 @@ - -package org.drip.sequence.custom; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BinPacking contains Variance Bounds of the critical measures of the standard operations research bin - * packing problem. - * - * @author Lakshmi Krishnamurthy - */ - -public class BinPacking { - - private static final boolean UpdateBin ( - java.util.Map mapBin, - final double dblVariate) - { - for (java.util.Map.Entry meBin : mapBin.entrySet()) { - double dblBinCapacity = meBin.getValue(); - - if (dblBinCapacity > dblVariate) { - meBin.setValue (dblBinCapacity - dblVariate); - - return true; - } - } - - return false; - } - - public static final org.drip.sequence.functional.BoundedMultivariateRandom MinimumNumberOfBins() - { - org.drip.sequence.functional.BoundedMultivariateRandom funcMinBins = new - org.drip.sequence.functional.BoundedMultivariateRandom() { - @Override public int dimension() - { - return org.drip.function.definition.RdToR1.DIMENSION_NOT_FIXED; - } - - @Override public double evaluate ( - final double[] adblVariate) - throws java.lang.Exception - { - java.util.Map mapBin = new - java.util.HashMap(); - - int iLastEntry = -1; - int iNumVariate = adblVariate.length; - - for (int i = 0; i < iNumVariate; ++i) { - if (0 == i || !UpdateBin (mapBin, adblVariate[i])) - mapBin.put (++iLastEntry, 1. - adblVariate[i]); - } - - return mapBin.size(); - } - - @Override public double targetVariateVarianceBound ( - final int iTargetVariateIndex) - throws java.lang.Exception - { - return 1.; - } - }; - - return funcMinBins; - } -} diff --git a/org/drip/sequence/custom/GlivenkoCantelliFunctionSupremum.java b/org/drip/sequence/custom/GlivenkoCantelliFunctionSupremum.java deleted file mode 100644 index 59f1ae5..0000000 --- a/org/drip/sequence/custom/GlivenkoCantelliFunctionSupremum.java +++ /dev/null @@ -1,160 +0,0 @@ - -package org.drip.sequence.custom; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * GlivenkoCantelliFunctionSupremum contains the Implementation of the Supremum Class Objective Function - * dependent on Multivariate Random Variables where the Multivariate Function is a Linear Combination of Bounded - * Univariate Functions acting on each Random Variate. - * - * @author Lakshmi Krishnamurthy - */ - -public class GlivenkoCantelliFunctionSupremum extends org.drip.sequence.functional.MultivariateRandom - implements org.drip.sequence.functional.SeparableMultivariateRandom { - private double[] _adblWeight = null; - private org.drip.sequence.functional.FunctionSupremumUnivariateRandom _fsur = null; - - /** - * Construct an Instance of GlivenkoCantelliFunctionSupremum from the Sample - * - * @param fsur The Supremum Univariate Random Function - * @param iNumSample Number of Empirical Samples - * - * @return The GlivenkoCantelliFunctionSupremum Instance - */ - - public static final GlivenkoCantelliFunctionSupremum Create ( - final org.drip.sequence.functional.FunctionSupremumUnivariateRandom fsur, - final int iNumSample) - { - try { - return new GlivenkoCantelliFunctionSupremum (fsur, - org.drip.analytics.support.Helper.NormalizedEqualWeightedArray (iNumSample)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * GlivenkoCantelliFunctionSupremum Constructor - * - * @param fsur The Supremum Univariate Random Function - * @param adblWeight Array of Variable Weights - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public GlivenkoCantelliFunctionSupremum ( - final org.drip.sequence.functional.FunctionSupremumUnivariateRandom fsur, - final double[] adblWeight) - throws java.lang.Exception - { - if (null == (_adblWeight = adblWeight) || 0 == _adblWeight.length || null == (_fsur = fsur)) - throw new java.lang.Exception ("GlivenkoCantelliFunctionSupremum ctr: Invalid Inputs"); - } - - /** - * Retrieve the Supremum Univariate Random Function - * - * @return The Supremum Univariate Random Function - */ - - public org.drip.sequence.functional.FunctionSupremumUnivariateRandom separableUnivariateRandom() - { - return _fsur; - } - - /** - * Retrieve the Weights - * - * @return The Weights - */ - - public double[] weights() - { - return _adblWeight; - } - - @Override public int dimension() - { - return org.drip.function.definition.RdToR1.DIMENSION_NOT_FIXED; - } - - @Override public double evaluate ( - final double[] adblVariate) - throws java.lang.Exception - { - double dblValue = 0.; - int iNumVariate = adblVariate.length; - - if (_adblWeight.length < iNumVariate) - throw new java.lang.Exception ("GlivenkoCantelliFunctionSupremum::evaluate => Invalid Inputs"); - - for (int i = 0; i < iNumVariate; ++i) - dblValue += _adblWeight[i] * _fsur.evaluate (adblVariate[i]); - - return dblValue; - } - - @Override public double targetVariateVariance ( - final int iTargetVariateIndex) - throws java.lang.Exception - { - org.drip.sequence.metrics.SingleSequenceAgnosticMetrics ssam = _fsur.sequenceMetrics(); - - if (null == ssam) - throw new java.lang.Exception - ("GlivenkoCantelliFunctionSupremum::targetVariateVariance => Cannot calculate Target Variate Metrics"); - - return _adblWeight[iTargetVariateIndex] * ssam.empiricalVariance(); - } -} diff --git a/org/drip/sequence/custom/GlivenkoCantelliUniformDeviation.java b/org/drip/sequence/custom/GlivenkoCantelliUniformDeviation.java deleted file mode 100644 index 3ecdccc..0000000 --- a/org/drip/sequence/custom/GlivenkoCantelliUniformDeviation.java +++ /dev/null @@ -1,167 +0,0 @@ - -package org.drip.sequence.custom; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * GlivenkoCantelliUniformDeviation contains the Implementation of the Bounded Objective Function dependent - * on Multivariate Random Variables where the Multivariate Function is a Linear Combination of Bounded - * Univariate Functions acting on each Random Variate. - * - * @author Lakshmi Krishnamurthy - */ - -public class GlivenkoCantelliUniformDeviation extends org.drip.sequence.functional.BoundedMultivariateRandom - implements org.drip.sequence.functional.SeparableMultivariateRandom { - private double[] _adblWeight = null; - private org.drip.sequence.functional.BoundedIdempotentUnivariateRandom _biur = null; - - /** - * GlivenkoCantelliUniformDeviation Constructor - * - * @param biur The Bounded Idempotent Univariate Random Function - * @param iNumSample Number of Empirical Samples - * - * @return The GlivenkoCantelliUniformDeviation Instance - */ - - public static final GlivenkoCantelliUniformDeviation Create ( - final org.drip.sequence.functional.BoundedIdempotentUnivariateRandom biur, - final int iNumSample) - { - try { - return new GlivenkoCantelliUniformDeviation (biur, - org.drip.analytics.support.Helper.NormalizedEqualWeightedArray (iNumSample)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * GlivenkoCantelliUniformDeviation Constructor - * - * @param biur The Bounded Idempotent Univariate Random Function - * @param adblWeight Array of Variable Weights - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public GlivenkoCantelliUniformDeviation ( - final org.drip.sequence.functional.BoundedIdempotentUnivariateRandom biur, - final double[] adblWeight) - throws java.lang.Exception - { - if (null == (_adblWeight = adblWeight) || 0 == _adblWeight.length || null == (_biur = biur)) - throw new java.lang.Exception ("GlivenkoCantelliUniformDeviation ctr: Invalid Inputs"); - } - - /** - * Retrieve the Separable Bounded Idempotent Univariate Random Function - * - * @return The Separable Bounded Idempotent Univariate Random Function - */ - - public org.drip.sequence.functional.BoundedIdempotentUnivariateRandom separableUnivariateRandom() - { - return _biur; - } - - /** - * Retrieve the Weights - * - * @return The Weights - */ - - public double[] weights() - { - return _adblWeight; - } - - @Override public int dimension() - { - return org.drip.function.definition.RdToR1.DIMENSION_NOT_FIXED; - } - - @Override public double evaluate ( - final double[] adblVariate) - throws java.lang.Exception - { - double dblValue = 0.; - int iNumVariate = adblVariate.length; - - if (_adblWeight.length < iNumVariate) - throw new java.lang.Exception ("GlivenkoCantelliUniformDeviation::evaluate => Invalid Inputs"); - - for (int i = 0; i < iNumVariate; ++i) - dblValue += _adblWeight[i] * _biur.evaluate (adblVariate[i]); - - return dblValue; - } - - @Override public double targetVariateVarianceBound ( - final int iTargetVariateIndex) - throws java.lang.Exception - { - return _adblWeight[iTargetVariateIndex] * _biur.agnosticVarianceBound(); - } - - @Override public double targetVariateVariance ( - final int iTargetVariateIndex) - throws java.lang.Exception - { - org.drip.sequence.metrics.SingleSequenceAgnosticMetrics ssam = _biur.sequenceMetrics(); - - if (null == ssam) - throw new java.lang.Exception - ("GlivenkoCantelliUniformDeviation::targetVariateVariance => Cannot calculate Target Variate Metrics"); - - return _adblWeight[iTargetVariateIndex] * ssam.empiricalVariance(); - } -} diff --git a/org/drip/sequence/custom/KernelDensityEstimationL1.java b/org/drip/sequence/custom/KernelDensityEstimationL1.java deleted file mode 100644 index 5893c3b..0000000 --- a/org/drip/sequence/custom/KernelDensityEstimationL1.java +++ /dev/null @@ -1,162 +0,0 @@ - -package org.drip.sequence.custom; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * KernelDensityEstimationL1 implements the L1 Error Scheme Estimation for a Multivariate Kernel Density - * Estimator with Focus on establishing targeted Variate-Specific and Agnostic Bounds. - * - * @author Lakshmi Krishnamurthy - */ - -public class KernelDensityEstimationL1 extends org.drip.sequence.functional.BoundedMultivariateRandom { - private int _iSampleSize = -1; - private double _dblSmoothingParameter = java.lang.Double.NaN; - private org.drip.function.definition.R1ToR1 _auKernel = null; - private org.drip.function.definition.R1ToR1 _auResponse = null; - - /** - * KernelDensityEstimationL1 Constructor - * - * @param auKernel The Kernel Function - * @param dblSmoothingParameter The Smoothing Parameter - * @param iSampleSize The Sample Size - * @param auResponse The Response Function - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public KernelDensityEstimationL1 ( - final org.drip.function.definition.R1ToR1 auKernel, - final double dblSmoothingParameter, - final int iSampleSize, - final org.drip.function.definition.R1ToR1 auResponse) - throws java.lang.Exception - { - if (null == (_auKernel = auKernel) || !org.drip.quant.common.NumberUtil.IsValid - (_dblSmoothingParameter = dblSmoothingParameter) || 0 >= (_iSampleSize = iSampleSize) || null == - (_auResponse = auResponse)) - throw new java.lang.Exception ("KernelDensityEstimationL1 Constructor => Invalid Inputs!"); - } - - /** - * Retrieve the Kernel Function - * - * @return The Kernel Function - */ - - public org.drip.function.definition.R1ToR1 kernelFunction() - { - return _auKernel; - } - - /** - * Retrieve the Smoothing Parameter - * - * @return The Smoothing Parameter - */ - - public double smoothingParameter() - { - return _dblSmoothingParameter; - } - - /** - * Retrieve the Sample Size - * - * @return The Sample Size - */ - - public int sampleSize() - { - return _iSampleSize; - } - - /** - * Retrieve the Response Function - * - * @return The Response Function - */ - - public org.drip.function.definition.R1ToR1 responseFunction() - { - return _auResponse; - } - - @Override public int dimension() - { - return org.drip.function.definition.RdToR1.DIMENSION_NOT_FIXED; - } - - @Override public double evaluate ( - final double[] adblVariate) - throws java.lang.Exception - { - double dblMinVariate = org.drip.quant.common.NumberUtil.Minimum (adblVariate); - - double dblMaxVariate = org.drip.quant.common.NumberUtil.Maximum (adblVariate); - - double dblKernelIntegral = 0.; - int iNumVariate = adblVariate.length; - - for (int i = 0; i < iNumVariate; ++i) - dblKernelIntegral += _auKernel.integrate ((dblMinVariate - adblVariate[i]) / - _dblSmoothingParameter, (dblMaxVariate - adblVariate[i]) / _dblSmoothingParameter); - - return dblKernelIntegral / (_iSampleSize * _dblSmoothingParameter) - _auResponse.integrate - (dblMinVariate, dblMaxVariate); - } - - @Override public double targetVariateVarianceBound ( - final int iTargetVariateIndex) - throws java.lang.Exception - { - return 4. / (_iSampleSize * _iSampleSize); - } -} diff --git a/org/drip/sequence/custom/LongestCommonSubsequence.java b/org/drip/sequence/custom/LongestCommonSubsequence.java deleted file mode 100644 index 2d368b3..0000000 --- a/org/drip/sequence/custom/LongestCommonSubsequence.java +++ /dev/null @@ -1,142 +0,0 @@ - -package org.drip.sequence.custom; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * LongestCommonSubsequence contains Variance Bounds on the Critical Measures of the Longest Common - * Subsequence between two Strings. - * - * @author Lakshmi Krishnamurthy - */ - -public class LongestCommonSubsequence extends org.drip.sequence.functional.BoundedMultivariateRandom { - - /** - * Lower Bound of the Conjecture of the Expected Value of the LCS Length - * - * @param adblVariate Array of Input Variates - * - * @return Lower Bound of the Conjecture of the Expected Value of the LCS Length - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double expectationConjectureLowerBound ( - final double[] adblVariate) - throws java.lang.Exception - { - if (null == adblVariate) - throw new java.lang.Exception - ("LongestCommonSubsequence::expectationConjectureLowerBound => Invalid Inputs"); - - return 0.37898; - } - - /** - * Upper Bound of the Conjecture of the Expected Value of the LCS Length - * - * @param adblVariate Array of Input Variates - * - * @return Upper Bound of the Conjecture of the Expected Value of the LCS Length - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double expectationConjectureUpperBound ( - final double[] adblVariate) - throws java.lang.Exception - { - if (null == adblVariate) - throw new java.lang.Exception - ("LongestCommonSubsequence::expectationConjectureUpperBound => Invalid Inputs"); - - return 0.418815; - } - - /** - * Conjecture of the Expected Value of the LCS Length - * - * @param adblVariate Array of Input Variates - * - * @return Conjecture of the Expected Value of the LCS Length - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double expectationConjecture ( - final double[] adblVariate) - throws java.lang.Exception - { - if (null == adblVariate) - throw new java.lang.Exception - ("LongestCommonSubsequence::expectationConjecture => Invalid Inputs"); - - return adblVariate.length / (1. + java.lang.Math.sqrt (2.)); - } - - @Override public int dimension() - { - return org.drip.function.definition.RdToR1.DIMENSION_NOT_FIXED; - } - - @Override public double evaluate ( - final double[] adblVariate) - throws java.lang.Exception - { - return 0.25 * (expectationConjectureLowerBound (adblVariate) + expectationConjectureUpperBound - (adblVariate)) + 0.5 * expectationConjecture (adblVariate); - } - - @Override public double targetVariateVarianceBound ( - final int iTargetVariateIndex) - throws java.lang.Exception - { - return 1.0; - } -} diff --git a/org/drip/sequence/custom/OrientedPercolationFirstPassage.java b/org/drip/sequence/custom/OrientedPercolationFirstPassage.java deleted file mode 100644 index 4b97a30..0000000 --- a/org/drip/sequence/custom/OrientedPercolationFirstPassage.java +++ /dev/null @@ -1,121 +0,0 @@ - -package org.drip.sequence.custom; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * OrientedPercolationFirstPassage contains Variance Bounds on the Critical Measures of the Standard Problem - * of First Passage Time in Oriented Percolation. - * - * @author Lakshmi Krishnamurthy - */ - -public class OrientedPercolationFirstPassage extends org.drip.sequence.functional.BoundedMultivariateRandom { - private double _dblMaxLength = java.lang.Double.NaN; - private double _dblEdgeWeightVariance = java.lang.Double.NaN; - - /** - * OrientedPercolationFirstPassage Constructor - * - * @param dblEdgeWeightVariance Variance of Edge Weight - * @param dblMaxLength Length of the Maximal Path - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public OrientedPercolationFirstPassage ( - final double dblEdgeWeightVariance, - final double dblMaxLength) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblEdgeWeightVariance = dblEdgeWeightVariance) || - !org.drip.quant.common.NumberUtil.IsValid (_dblMaxLength = dblMaxLength)) - throw new java.lang.Exception ("OrientedPercolationFirstPassage ctr => Invalid Inputs"); - } - - /** - * Retrieve the Edge Width Variance - * - * @return The Edge Width Variance - */ - - public double edgeWeightVariance() - { - return _dblEdgeWeightVariance; - } - - /** - * Retrieve the Length of the Maximal Path - * - * @return Length of the Maximal Path - */ - - public double maxLength() - { - return _dblMaxLength; - } - - @Override public int dimension() - { - return org.drip.function.definition.RdToR1.DIMENSION_NOT_FIXED; - } - - @Override public double evaluate ( - final double[] adblVariate) - throws java.lang.Exception - { - return _dblMaxLength; - } - - @Override public double targetVariateVarianceBound ( - final int iTargetVariateIndex) - throws java.lang.Exception - { - return _dblMaxLength * _dblEdgeWeightVariance; - } -} diff --git a/org/drip/sequence/functional/BinaryIdempotentUnivariateRandom.java b/org/drip/sequence/functional/BinaryIdempotentUnivariateRandom.java deleted file mode 100644 index 1ed9bd1..0000000 --- a/org/drip/sequence/functional/BinaryIdempotentUnivariateRandom.java +++ /dev/null @@ -1,101 +0,0 @@ - -package org.drip.sequence.functional; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BinaryIdempotentUnivariateRandom contains the Implementation of the Objective Function dependent on - * Binary Idempotent Univariate Random Variable. - * - * @author Lakshmi Krishnamurthy - */ - -public class BinaryIdempotentUnivariateRandom extends - org.drip.sequence.functional.BoundedIdempotentUnivariateRandom { - private double _dblPositiveProbability = java.lang.Double.NaN; - - /** - * BinaryIdempotentUnivariateRandom Constructor - * - * @param dblOffset The Idempotent Offset - * @param dist The Underlying Distribution - * @param dblVariateBound The Variate Bound - * @param dblPositiveProbability Probability of reaching 1 - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BinaryIdempotentUnivariateRandom ( - final double dblOffset, - final org.drip.measure.continuousmarginal.R1 dist, - final double dblVariateBound, - final double dblPositiveProbability) - throws java.lang.Exception - { - super (dblOffset, dist, dblVariateBound); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblPositiveProbability = dblPositiveProbability)) - throw new java.lang.Exception ("BinaryIdempotentUnivariateRandom ctr => Invalid Inputs"); - } - - /** - * Retrieve the Probability of reaching 1 - * - * @return The Probability of reaching 1 - */ - - public double positiveProbability() - { - return _dblPositiveProbability; - } - - @Override public double agnosticVarianceBound() - { - return super.agnosticVarianceBound() * _dblPositiveProbability * (1. - _dblPositiveProbability); - } -} diff --git a/org/drip/sequence/functional/BoundedIdempotentUnivariateRandom.java b/org/drip/sequence/functional/BoundedIdempotentUnivariateRandom.java deleted file mode 100644 index ab925fd..0000000 --- a/org/drip/sequence/functional/BoundedIdempotentUnivariateRandom.java +++ /dev/null @@ -1,105 +0,0 @@ - -package org.drip.sequence.functional; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BoundedIdempotentUnivariateRandom contains the Implementation of the Objective Function dependent on - * Bounded Idempotent Univariate Random Variable. - * - * @author Lakshmi Krishnamurthy - */ - -public class BoundedIdempotentUnivariateRandom extends - org.drip.sequence.functional.IdempotentUnivariateRandom { - private double _dblVariateBound = java.lang.Double.NaN; - - /** - * BoundedIdempotentUnivariateRandom Constructor - * - * @param dblOffset The Idempotent Offset - * @param dist The Underlying Distribution - * @param dblVariateBound The Variate Bound - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BoundedIdempotentUnivariateRandom ( - final double dblOffset, - final org.drip.measure.continuousmarginal.R1 dist, - final double dblVariateBound) - throws java.lang.Exception - { - super (dblOffset, dist); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblVariateBound = dblVariateBound)) - throw new java.lang.Exception ("BoundedIdempotentUnivariateRandom ctr => Invalid Inputs"); - } - - /** - * Retrieve the Underlying Variate Bound - * - * @return The Underlying Variate Bound - */ - - public double variateBound() - { - return _dblVariateBound; - } - - /** - * Retrieve the Maximal Agnostic Variance Bound Over the Variate Range - * - * @return The Maximal Agnostic Bound over the Variate Range - */ - - public double agnosticVarianceBound() - { - return _dblVariateBound * _dblVariateBound; - } -} diff --git a/org/drip/sequence/functional/BoundedMultivariateRandom.java b/org/drip/sequence/functional/BoundedMultivariateRandom.java deleted file mode 100644 index 7751e24..0000000 --- a/org/drip/sequence/functional/BoundedMultivariateRandom.java +++ /dev/null @@ -1,74 +0,0 @@ - -package org.drip.sequence.functional; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BoundedMultivariateRandom contains the Implementation of the Bounded Objective Function dependent on - * Multivariate Random Variables. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class BoundedMultivariateRandom extends - org.drip.sequence.functional.MultivariateRandom { - - /** - * Retrieve the Maximal Agnostic Variance Bound over the Non-target Variate Space for the Target Variate - * - * @param iTargetVariateIndex The Index corresponding to the Variate on which the Bound is sought - * - * @return The Maximal Agnostic Bound over the Non-target Variate Space for the Target Variate - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public abstract double targetVariateVarianceBound ( - final int iTargetVariateIndex) - throws java.lang.Exception; -} diff --git a/org/drip/sequence/functional/EfronSteinMetrics.java b/org/drip/sequence/functional/EfronSteinMetrics.java deleted file mode 100644 index aef6f9f..0000000 --- a/org/drip/sequence/functional/EfronSteinMetrics.java +++ /dev/null @@ -1,474 +0,0 @@ - -package org.drip.sequence.functional; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * EfronSteinMetrics contains the Variance-based non-exponential Sample Distribution/Bounding Metrics and - * Agnostic Bounds related to the Functional Transformation of the specified Sequence. - * - * @author Lakshmi Krishnamurthy - */ - -public class EfronSteinMetrics { - private org.drip.sequence.functional.MultivariateRandom _func = null; - private org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] _aSSAM = null; - - private double[] demotedSequence ( - final double[] adblSequence, - final int iDemoteIndex) - { - int iSequenceLength = adblSequence.length; - double[] adblDemotedSequence = new double[iSequenceLength - 1]; - - for (int i = 0; i < iSequenceLength; ++i) { - if (i < iDemoteIndex) - adblDemotedSequence[i] = adblSequence[i]; - else if (i > iDemoteIndex) - adblDemotedSequence[i - 1] = adblSequence[i]; - } - - return adblDemotedSequence; - } - - /** - * EfronSteinMetrics Constructor - * - * @param func Multivariate Objective Function - * @param aSSAM Array of the individual Single Sequence Metrics - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public EfronSteinMetrics ( - final org.drip.sequence.functional.MultivariateRandom func, - final org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] aSSAM) - throws java.lang.Exception - { - if (null == (_func = func) || null == (_aSSAM = aSSAM)) - throw new java.lang.Exception ("EfronSteinMetrics ctr: Invalid Inputs"); - - int iNumVariable = _aSSAM.length; - - if (0 == iNumVariable) - throw new java.lang.Exception ("EfronSteinMetrics ctr: Invalid Inputs"); - - int iSequenceLength = _aSSAM[0].sequence().length; - - for (int i = 1; i < iNumVariable; ++i) { - if (null == _aSSAM[i] || _aSSAM[i].sequence().length != iSequenceLength) - throw new java.lang.Exception ("EfronSteinMetrics ctr: Invalid Inputs"); - } - } - - /** - * Retrieve the Multivariate Objective Function - * - * @return The Multivariate Objective Function Instance - */ - - public org.drip.function.definition.RdToR1 function() - { - return _func; - } - - /** - * Retrieve the Array of the Single Sequence Agnostic Metrics - * - * @return The Array of the Single Sequence Agnostic Metrics - */ - - public org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] sequenceMetrics() - { - return _aSSAM; - } - - /** - * Extract the Full Variate Array Sequence - * - * @param aSSAM Array of the individual Single Sequence Metrics - * - * @return The Full Variate Array Sequence - */ - - public double[][] variateSequence ( - final org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] aSSAM) - { - int iNumVariate = _aSSAM.length; - - if (null == aSSAM || aSSAM.length != iNumVariate) return null; - - int iSequenceSize = aSSAM[0].sequence().length; - - double[][] aadblVariateSequence = new double[iSequenceSize][iNumVariate]; - - for (int iVariateIndex = 0; iVariateIndex < iNumVariate; ++iVariateIndex) { - double[] adblVariate = aSSAM[iVariateIndex].sequence(); - - for (int iSequenceIndex = 0; iSequenceIndex < iSequenceSize; ++iSequenceIndex) - aadblVariateSequence[iSequenceIndex][iVariateIndex] = adblVariate[iSequenceIndex]; - } - - return aadblVariateSequence; - } - - /** - * Compute the Function Sequence Agnostic Metrics associated with the Variance of each Variate - * - * @return The Array of the Associated Sequence Metrics - */ - - public org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] variateFunctionVarianceMetrics() - { - int iNumVariate = _aSSAM.length; - org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] aSSAM = new - org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[iNumVariate]; - - for (int i = 0; i < iNumVariate; ++i) { - if (null == (aSSAM[i] = _func.unconditionalTargetVariateMetrics (_aSSAM, i))) return null; - } - - return aSSAM; - } - - /** - * Compute the Function Sequence Agnostic Metrics associated with the Variance of each Variate Using the - * Supplied Ghost Variate Sequence - * - * @param aSSAMGhost Array of the Ghost Single Sequence Metrics - * - * @return The Array of the Associated Sequence Metrics - */ - - public org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] ghostVariateVarianceMetrics ( - final org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] aSSAMGhost) - { - if (null == aSSAMGhost) return null; - - int iNumVariate = _aSSAM.length; - org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] aSSAM = new - org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[iNumVariate]; - - for (int i = 0; i < iNumVariate; ++i) { - if (null == aSSAMGhost[i] || null == (aSSAM[i] = _func.ghostTargetVariateMetrics (_aSSAM, i, - aSSAMGhost[i].sequence()))) - return null; - } - - return aSSAM; - } - - /** - * Compute the Function Sequence Agnostic Metrics associated with each Variate using the specified Ghost - * Symmetric Variable Copy - * - * @param aSSAMGhost Array of the Ghost Single Sequence Metrics - * - * @return The Array of the Associated Sequence Metrics - */ - - public org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] symmetrizedDifferenceSequenceMetrics ( - final org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] aSSAMGhost) - { - double[][] aadblSequenceVariate = variateSequence (_aSSAM); - - double[][] aadblGhostSequenceVariate = variateSequence (aSSAMGhost); - - if (null == aadblGhostSequenceVariate || aadblSequenceVariate.length != - aadblGhostSequenceVariate.length || aadblSequenceVariate[0].length != - aadblGhostSequenceVariate[0].length) - return null; - - int iSequenceSize = _aSSAM[0].sequence().length; - - int iNumVariate = _aSSAM.length; - org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] aSSAMFunction = new - org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[iNumVariate]; - - try { - for (int iVariateIndex = 0; iVariateIndex < iNumVariate; ++iVariateIndex) { - double[] adblSymmetrizedFunctionDifference = new double[iSequenceSize]; - - for (int iSequenceIndex = 0; iSequenceIndex < iSequenceSize; ++iSequenceIndex) { - double[] adblVariate = aadblSequenceVariate[iSequenceIndex]; - - adblSymmetrizedFunctionDifference[iSequenceIndex] = _func.evaluate (adblVariate); - - double dblVariateOrig = adblVariate[iVariateIndex]; - adblVariate[iVariateIndex] = aadblGhostSequenceVariate[iSequenceIndex][iVariateIndex]; - - adblSymmetrizedFunctionDifference[iSequenceIndex] -= _func.evaluate (adblVariate); - - adblVariate[iVariateIndex] = dblVariateOrig; - } - - aSSAMFunction[iVariateIndex] = new org.drip.sequence.metrics.SingleSequenceAgnosticMetrics - (adblSymmetrizedFunctionDifference, null); - } - - return aSSAMFunction; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Function Sequence Agnostic Metrics associated with each Variate around the Pivot Point - * provided by the Pivot Function - * - * @param funcPivot The Pivot Function - * - * @return The Array of the Associated Sequence Metrics - */ - - public org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] pivotedDifferenceSequenceMetrics ( - final org.drip.sequence.functional.MultivariateRandom funcPivot) - { - if (null == funcPivot) return null; - - double[][] aadblSequenceVariate = variateSequence (_aSSAM); - - int iSequenceSize = _aSSAM[0].sequence().length; - - int iNumVariate = _aSSAM.length; - org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] aSSAMFunction = new - org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[iNumVariate]; - - try { - for (int iVariateIndex = 0; iVariateIndex < iNumVariate; ++iVariateIndex) { - double[] adblSymmetrizedFunctionDifference = new double[iSequenceSize]; - - for (int iSequenceIndex = 0; iSequenceIndex < iSequenceSize; ++iSequenceIndex) { - double[] adblVariate = aadblSequenceVariate[iSequenceIndex]; - - adblSymmetrizedFunctionDifference[iSequenceIndex] = _func.evaluate (adblVariate) - - funcPivot.evaluate (demotedSequence (adblVariate, iVariateIndex)); - } - - aSSAMFunction[iVariateIndex] = new org.drip.sequence.metrics.SingleSequenceAgnosticMetrics - (adblSymmetrizedFunctionDifference, null); - } - - return aSSAMFunction; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Multivariate Variance Upper Bound using the Martingale Differences Method - * - * @return The Multivariate Variance Upper Bound using the Martingale Differences Method - * - * @throws java.lang.Exception Thrown if the Upper Bound cannot be calculated - */ - - public double martingaleVarianceUpperBound() - throws java.lang.Exception - { - int iNumVariate = _aSSAM.length; - double dblVarianceUpperBound = 0.; - - org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] aSSAM = variateFunctionVarianceMetrics(); - - if (null == aSSAM || iNumVariate != aSSAM.length) - throw new java.lang.Exception - ("EfronSteinMetrics::martingaleVarianceUpperBound => Cannot compute Univariate Variance Metrics"); - - for (int i = 0; i < iNumVariate; ++i) - dblVarianceUpperBound += aSSAM[i].empiricalExpectation(); - - return dblVarianceUpperBound; - } - - /** - * Compute the Variance Upper Bound using the Ghost Variables - * - * @param aSSAMGhost Array of the Ghost Single Sequence Metrics - * - * @return The Variance Upper Bound using the Ghost Variables - * - * @throws java.lang.Exception Thrown if the Upper Bound cannot be calculated - */ - - public double ghostVarianceUpperBound ( - final org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] aSSAMGhost) - throws java.lang.Exception - { - int iNumVariate = _aSSAM.length; - double dblVarianceUpperBound = 0.; - - org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] aSSAM = ghostVariateVarianceMetrics - (aSSAMGhost); - - if (null == aSSAM || iNumVariate != aSSAM.length) - throw new java.lang.Exception - ("EfronSteinMetrics::ghostVarianceUpperBound => Cannot compute Target Ghost Variance Metrics"); - - for (int i = 0; i < iNumVariate; ++i) - dblVarianceUpperBound += aSSAM[i].empiricalExpectation(); - - return dblVarianceUpperBound; - } - - /** - * Compute the Efron-Stein-Steele Variance Upper Bound using the Ghost Variables - * - * @param aSSAMGhost Array of the Ghost Single Sequence Metrics - * - * @return The Efron-Stein-Steele Variance Upper Bound using the Ghost Variables - * - * @throws java.lang.Exception Thrown if the Upper Bound cannot be calculated - */ - - public double efronSteinSteeleBound ( - final org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] aSSAMGhost) - throws java.lang.Exception - { - int iNumVariate = _aSSAM.length; - double dblVarianceUpperBound = 0.; - - org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] aSSAM = - symmetrizedDifferenceSequenceMetrics (aSSAMGhost); - - if (null == aSSAM || iNumVariate != aSSAM.length) - throw new java.lang.Exception - ("EfronSteinMetrics::efronSteinSteeleBound => Cannot compute Symmetrized Difference Metrics"); - - for (int i = 0; i < iNumVariate; ++i) - dblVarianceUpperBound += aSSAM[i].empiricalRawMoment (2, false); - - return 0.5 * dblVarianceUpperBound; - } - - /** - * Compute the Function Variance Upper Bound using the supplied Multivariate Pivoting Function - * - * @param funcPivot The Custom Multivariate Pivoting Function - * - * @return The Function Variance Upper Bound using the supplied Multivariate Pivot Function - * - * @throws java.lang.Exception Thrown if the Variance Upper Bound cannot be calculated - */ - - public double pivotVarianceUpperBound ( - final org.drip.sequence.functional.MultivariateRandom funcPivot) - throws java.lang.Exception - { - int iNumVariate = _aSSAM.length; - double dblVarianceUpperBound = 0.; - - org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] aSSAM = pivotedDifferenceSequenceMetrics - (funcPivot); - - if (null == aSSAM || iNumVariate != aSSAM.length) - throw new java.lang.Exception - ("EfronSteinMetrics::pivotVarianceUpperBound => Cannot compute Pivoted Difference Metrics"); - - for (int i = 0; i < iNumVariate; ++i) - dblVarianceUpperBound += aSSAM[i].empiricalRawMoment (2, false); - - return 0.5 * dblVarianceUpperBound; - } - - /** - * Compute the Multivariate Variance Upper Bound using the Bounded Differences Support - * - * @return The Multivariate Variance Upper Bound using the Bounded Differences Support - * - * @throws java.lang.Exception Thrown if the Upper Bound cannot be calculated - */ - - public double boundedVarianceUpperBound() - throws java.lang.Exception - { - if (!(_func instanceof org.drip.sequence.functional.BoundedMultivariateRandom)) - throw new java.lang.Exception - ("EfronSteinMetrics::boundedVarianceUpperBound => Invalid Bounded Metrics"); - - int iNumVariate = _aSSAM.length; - double dblVarianceUpperBound = 0.; - org.drip.sequence.functional.BoundedMultivariateRandom boundedFunc = - (org.drip.sequence.functional.BoundedMultivariateRandom) _func; - - for (int i = 0; i < iNumVariate; ++i) - dblVarianceUpperBound += boundedFunc.targetVariateVarianceBound (i); - - return 0.5 * dblVarianceUpperBound; - } - - /** - * Compute the Multivariate Variance Upper Bound using the Separable Variance Bound - * - * @return The Multivariate Variance Upper Bound using the Separable Variance Bound - * - * @throws java.lang.Exception Thrown if the Upper Bound cannot be calculated - */ - - public double separableVarianceUpperBound() - throws java.lang.Exception - { - if (!(_func instanceof org.drip.sequence.functional.SeparableMultivariateRandom)) - throw new java.lang.Exception - ("EfronSteinMetrics::separableVarianceUpperBound => Invalid Bounded Metrics"); - - int iNumVariate = _aSSAM.length; - double dblVarianceUpperBound = 0.; - org.drip.sequence.functional.SeparableMultivariateRandom separableFunc = - (org.drip.sequence.functional.SeparableMultivariateRandom) _func; - - for (int i = 0; i < iNumVariate; ++i) - dblVarianceUpperBound += separableFunc.targetVariateVariance (i); - - return 0.5 * dblVarianceUpperBound; - } -} diff --git a/org/drip/sequence/functional/FlatMultivariateRandom.java b/org/drip/sequence/functional/FlatMultivariateRandom.java deleted file mode 100644 index 486955c..0000000 --- a/org/drip/sequence/functional/FlatMultivariateRandom.java +++ /dev/null @@ -1,99 +0,0 @@ - -package org.drip.sequence.functional; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FlatMultivariateRandom contains the Implementation of the Flat Objective Function dependent on - * Multivariate Random Variables. - * - * @author Lakshmi Krishnamurthy - */ - -public class FlatMultivariateRandom extends org.drip.sequence.functional.MultivariateRandom { - private double _dblFlatValue = java.lang.Double.NaN; - - /** - * FlatMultivariateRandom Constructor - * - * @param dblFlatValue The Flat Value - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public FlatMultivariateRandom ( - final double dblFlatValue) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblFlatValue = dblFlatValue)) - throw new java.lang.Exception ("FlatMultivariateRandom ctr: Invalid Inputs"); - } - - /** - * Retrieve the Flat Value - * - * @return The Flat Value - */ - - public double flatValue() - { - return _dblFlatValue; - } - - @Override public int dimension() - { - return org.drip.function.definition.RdToR1.DIMENSION_NOT_FIXED; - } - - @Override public double evaluate ( - final double[] adblVariate) - throws java.lang.Exception - { - return _dblFlatValue; - } -} diff --git a/org/drip/sequence/functional/FunctionSupremumUnivariateRandom.java b/org/drip/sequence/functional/FunctionSupremumUnivariateRandom.java deleted file mode 100644 index febfb51..0000000 --- a/org/drip/sequence/functional/FunctionSupremumUnivariateRandom.java +++ /dev/null @@ -1,160 +0,0 @@ - -package org.drip.sequence.functional; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FunctionSupremumUnivariateRandom contains the Implementation of the FunctionClassSupremum Objective - * Function dependent on Univariate Random Variable. - * - * @author Lakshmi Krishnamurthy - */ - -public class FunctionSupremumUnivariateRandom extends org.drip.function.r1tor1.FunctionClassSupremum -{ - private org.drip.measure.continuousmarginal.R1 _dist = null; - - /** - * FunctionSupremumUnivariateRandom Constructor - * - * @param aAUClass Array of Functions in the Class - * @param dist The Underlying Distribution - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public FunctionSupremumUnivariateRandom ( - final org.drip.function.definition.R1ToR1[] aAUClass, - final org.drip.measure.continuousmarginal.R1 dist) - throws java.lang.Exception - { - super (aAUClass); - - _dist = dist; - } - - /** - * Generate the Function Metrics for the specified Variate Sequence and its corresponding Weight - * - * @param adblVariateSequence The specified Variate Sequence - * @param adblVariateWeight The specified Variate Weight - * - * @return The Function Sequence Metrics - */ - - public org.drip.sequence.metrics.SingleSequenceAgnosticMetrics sequenceMetrics ( - final double[] adblVariateSequence, - final double[] adblVariateWeight) - { - if (null == adblVariateSequence || null == adblVariateWeight) return null; - - int iNumVariate = adblVariateSequence.length; - double[] adblFunctionSequence = new double[iNumVariate]; - - if (0 == iNumVariate || iNumVariate != adblVariateWeight.length) return null; - - try { - for (int i = 0; i < iNumVariate; ++i) - adblFunctionSequence[i] = adblVariateWeight[i] * evaluate (adblVariateSequence[i]); - - return new org.drip.sequence.metrics.SingleSequenceAgnosticMetrics (adblFunctionSequence, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Function Metrics for the specified Variate Sequence - * - * @param adblVariateSequence The specified Variate Sequence - * - * @return The Function Sequence Metrics - */ - - public org.drip.sequence.metrics.SingleSequenceAgnosticMetrics sequenceMetrics ( - final double[] adblVariateSequence) - { - if (null == adblVariateSequence) return null; - - int iNumVariate = adblVariateSequence.length; - double[] adblVariateWeight = new double[iNumVariate]; - - for (int i = 0; i < iNumVariate; ++i) - adblVariateWeight[i] = 1.; - - return sequenceMetrics (adblVariateSequence, adblVariateWeight); - } - - /** - * Generate the Function Metrics using the Underlying Variate Distribution - * - * @return The Function Sequence Metrics - */ - - public org.drip.sequence.metrics.SingleSequenceAgnosticMetrics sequenceMetrics() - { - if (null == _dist) return null; - - org.drip.quant.common.Array2D a2DHistogram = _dist.histogram(); - - return null == a2DHistogram ? null : sequenceMetrics (a2DHistogram.x(), a2DHistogram.y()); - } - - /** - * Retrieve the Underlying Distribution - * - * @return The Underlying Distribution - */ - - public org.drip.measure.continuousmarginal.R1 underlyingDistribution() - { - return _dist; - } -} diff --git a/org/drip/sequence/functional/IdempotentUnivariateRandom.java b/org/drip/sequence/functional/IdempotentUnivariateRandom.java deleted file mode 100644 index 4932455..0000000 --- a/org/drip/sequence/functional/IdempotentUnivariateRandom.java +++ /dev/null @@ -1,159 +0,0 @@ - -package org.drip.sequence.functional; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * IdempotentUnivariateRandom contains the Implementation of the OffsetIdempotent Objective Function - * dependent on Univariate Random Variable. - * - * @author Lakshmi Krishnamurthy - */ - -public class IdempotentUnivariateRandom extends org.drip.function.r1tor1.OffsetIdempotent { - private org.drip.measure.continuousmarginal.R1 _dist = null; - - /** - * IdempotentUnivariateRandom Constructor - * - * @param dblOffset The Idempotent Offset - * @param dist The Underlying Distribution - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public IdempotentUnivariateRandom ( - final double dblOffset, - final org.drip.measure.continuousmarginal.R1 dist) - throws java.lang.Exception - { - super (dblOffset); - - _dist = dist; - } - - /** - * Generate the Function Metrics for the specified Variate Sequence and its corresponding Weight - * - * @param adblVariateSequence The specified Variate Sequence - * @param adblVariateWeight The specified Variate Weight - * - * @return The Function Sequence Metrics - */ - - public org.drip.sequence.metrics.SingleSequenceAgnosticMetrics sequenceMetrics ( - final double[] adblVariateSequence, - final double[] adblVariateWeight) - { - if (null == adblVariateSequence || null == adblVariateWeight) return null; - - int iNumVariate = adblVariateSequence.length; - double[] adblFunctionSequence = new double[iNumVariate]; - - if (0 == iNumVariate || iNumVariate != adblVariateWeight.length) return null; - - try { - for (int i = 0; i < iNumVariate; ++i) - adblFunctionSequence[i] = adblVariateWeight[i] * evaluate (adblVariateSequence[i]); - - return new org.drip.sequence.metrics.SingleSequenceAgnosticMetrics (adblFunctionSequence, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Function Metrics for the specified Variate Sequence - * - * @param adblVariateSequence The specified Variate Sequence - * - * @return The Function Sequence Metrics - */ - - public org.drip.sequence.metrics.SingleSequenceAgnosticMetrics sequenceMetrics ( - final double[] adblVariateSequence) - { - if (null == adblVariateSequence) return null; - - int iNumVariate = adblVariateSequence.length; - double[] adblVariateWeight = new double[iNumVariate]; - - for (int i = 0; i < iNumVariate; ++i) - adblVariateWeight[i] = 1.; - - return sequenceMetrics (adblVariateSequence, adblVariateWeight); - } - - /** - * Generate the Function Metrics using the Underlying Variate Distribution - * - * @return The Function Sequence Metrics - */ - - public org.drip.sequence.metrics.SingleSequenceAgnosticMetrics sequenceMetrics() - { - if (null == _dist) return null; - - org.drip.quant.common.Array2D a2DHistogram = _dist.histogram(); - - return null == a2DHistogram ? null : sequenceMetrics (a2DHistogram.x(), a2DHistogram.y()); - } - - /** - * Retrieve the Underlying Distribution - * - * @return The Underlying Distribution - */ - - public org.drip.measure.continuousmarginal.R1 underlyingDistribution() - { - return _dist; - } -} diff --git a/org/drip/sequence/functional/MultivariateRandom.java b/org/drip/sequence/functional/MultivariateRandom.java deleted file mode 100644 index 9de2b21..0000000 --- a/org/drip/sequence/functional/MultivariateRandom.java +++ /dev/null @@ -1,314 +0,0 @@ - -package org.drip.sequence.functional; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * MultivariateRandom contains the implementation of the objective Function dependent on Multivariate Random - * Variables. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class MultivariateRandom extends org.drip.function.definition.RdToR1 { - - protected MultivariateRandom() - { - super (null); - } - - /** - * Compute the Target Variate Function Metrics conditional on the specified Input Non-Target Variate - * Parameter Sequence Off of the Target Variate Ghost Sample Sequence - * - * @param adblNonTargetVariate The Non-Target Variate Parameters - * @param iTargetVariateIndex Target Variate Index - * @param adblTargetVariateGhostSample Target Variate Ghost Sample - * - * @return The Variate-specific Function Metrics - */ - - public org.drip.sequence.metrics.SingleSequenceAgnosticMetrics ghostTargetVariateMetrics ( - final double[] adblNonTargetVariate, - final int iTargetVariateIndex, - final double[] adblTargetVariateGhostSample) - { - if (!org.drip.function.definition.RdToR1.ValidateInput (adblNonTargetVariate) || - null == adblTargetVariateGhostSample) - return null; - - int iNumNonTargetVariate = adblNonTargetVariate.length; - int iNumTargetVariateSample = adblTargetVariateGhostSample.length; - - if (0 > iTargetVariateIndex || iTargetVariateIndex > iNumNonTargetVariate || 0 == - iNumTargetVariateSample) - return null; - - double[] adblFunctionArgs = new double[iNumNonTargetVariate + 1]; - double[] adblFunctionSequence = new double[iNumTargetVariateSample]; - - for (int i = 0; i < iNumNonTargetVariate; ++i) { - if (i < iTargetVariateIndex) - adblFunctionArgs[i] = adblNonTargetVariate[i]; - else if (i >= iTargetVariateIndex) - adblFunctionArgs[i + 1] = adblNonTargetVariate[i]; - } - - try { - for (int i = 0; i < iNumTargetVariateSample; ++i) { - adblFunctionArgs[iTargetVariateIndex] = adblTargetVariateGhostSample[i]; - - adblFunctionSequence[i] = evaluate (adblFunctionArgs); - } - - return new org.drip.sequence.metrics.SingleSequenceAgnosticMetrics (adblFunctionSequence, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Target Variate Function Metrics conditional on the specified Input Non-Target Variate - * Parameter Sequence Off of the Target Variate Ghost Sample Sequence - * - * @param aSSAM Array of Variate Sequence Metrics - * @param aiNonTargetVariateSequenceIndex Array of Non-Target Variate Sequence Indexes - * @param iTargetVariateIndex Target Variate Index - * @param adblTargetVariateGhostSample Target Variate Ghost Sample - * - * @return The Variate-specific Function Metrics - */ - - public org.drip.sequence.metrics.SingleSequenceAgnosticMetrics ghostTargetVariateMetrics ( - final org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] aSSAM, - final int[] aiNonTargetVariateSequenceIndex, - final int iTargetVariateIndex, - final double[] adblTargetVariateGhostSample) - { - if (null == aSSAM || null == aiNonTargetVariateSequenceIndex || 0 > iTargetVariateIndex) return null; - - int iNumNonTargetVariate = aSSAM.length - 1; - double[] adblNonTargetVariate = new double[iNumNonTargetVariate]; - - if (0 >= iNumNonTargetVariate || iNumNonTargetVariate != aiNonTargetVariateSequenceIndex.length || - iTargetVariateIndex > iNumNonTargetVariate) - return null; - - for (int i = 0; i < iNumNonTargetVariate; ++i) - adblNonTargetVariate[i] = aSSAM[i < iTargetVariateIndex ? i : i + - 1].sequence()[aiNonTargetVariateSequenceIndex[i]]; - - return ghostTargetVariateMetrics (adblNonTargetVariate, iTargetVariateIndex, - adblTargetVariateGhostSample); - } - - /** - * Compute the Target Variate Function Metrics over the full Non-target Variate Empirical Distribution - * Off of the Target Variate Ghost Sample Sequence - * - * @param aSSAM Array of Variate Sequence Metrics - * @param iTargetVariateIndex Target Variate Index - * @param adblTargetVariateGhostSample Target Variate Ghost Sample - * - * @return The Variate-specific Function Metrics - */ - - public org.drip.sequence.metrics.SingleSequenceAgnosticMetrics ghostTargetVariateMetrics ( - final org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] aSSAM, - final int iTargetVariateIndex, - final double[] adblTargetVariateGhostSample) - { - if (null == aSSAM || 0 > iTargetVariateIndex) return null; - - int iTargetVariateVarianceIndex = 0; - int iNumNonTargetVariate = aSSAM.length - 1; - - if (0 >= iNumNonTargetVariate) return null; - - org.drip.spaces.iterator.SequenceIndexIterator sii = - org.drip.spaces.iterator.SequenceIndexIterator.Standard (iNumNonTargetVariate, - aSSAM[0].sequence().length); - - if (null == sii) return null; - - double[] adblTargetVariateVariance = new double[sii.size()]; - - int[] aiNonTargetVariateSequenceIndex = sii.first(); - - while (null != aiNonTargetVariateSequenceIndex && aiNonTargetVariateSequenceIndex.length == - iNumNonTargetVariate) { - org.drip.sequence.metrics.SingleSequenceAgnosticMetrics ssamGhostConditional = - ghostTargetVariateMetrics (aSSAM, aiNonTargetVariateSequenceIndex, iTargetVariateIndex, - adblTargetVariateGhostSample); - - if (null == ssamGhostConditional) return null; - - adblTargetVariateVariance[iTargetVariateVarianceIndex++] = - ssamGhostConditional.empiricalVariance(); - - aiNonTargetVariateSequenceIndex = sii.next(); - } - - try { - return new org.drip.sequence.metrics.SingleSequenceAgnosticMetrics (adblTargetVariateVariance, - null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Target Variate Function Metrics Conditional on the specified Input Non-Target Variate - * Parameter Sequence - * - * @param adblNonTargetVariate The Non-Target Variate Parameters - * @param iTargetVariateIndex Target Variate Index - * @param ssamTarget Target Variate Metrics - * - * @return The Variate-specific Function Metrics - */ - - public org.drip.sequence.metrics.SingleSequenceAgnosticMetrics conditionalTargetVariateMetrics ( - final double[] adblNonTargetVariate, - final int iTargetVariateIndex, - final org.drip.sequence.metrics.SingleSequenceAgnosticMetrics ssamTarget) - { - return null == ssamTarget ? null : ghostTargetVariateMetrics (adblNonTargetVariate, - iTargetVariateIndex, ssamTarget.sequence()); - } - - /** - * Compute the Target Variate Function Metrics Conditional on the specified Input Non-target Variate - * Parameter Sequence - * - * @param aSSAM Array of Variate Sequence Metrics - * @param aiNonTargetVariateSequenceIndex Array of Non-Target Variate Sequence Indexes - * @param iTargetVariateIndex Target Variate Index - * - * @return The Variate-specific Function Metrics - */ - - public org.drip.sequence.metrics.SingleSequenceAgnosticMetrics conditionalTargetVariateMetrics ( - final org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] aSSAM, - final int[] aiNonTargetVariateSequenceIndex, - final int iTargetVariateIndex) - { - if (null == aSSAM || null == aiNonTargetVariateSequenceIndex || 0 > iTargetVariateIndex) return null; - - int iNumNonTargetVariate = aSSAM.length - 1; - double[] adblNonTargetVariate = new double[iNumNonTargetVariate]; - - if (0 >= iNumNonTargetVariate || iNumNonTargetVariate != aiNonTargetVariateSequenceIndex.length || - iTargetVariateIndex > iNumNonTargetVariate) - return null; - - for (int i = 0; i < iNumNonTargetVariate; ++i) - adblNonTargetVariate[i] = aSSAM[i < iTargetVariateIndex ? i : i + - 1].sequence()[aiNonTargetVariateSequenceIndex[i]]; - - return conditionalTargetVariateMetrics (adblNonTargetVariate, iTargetVariateIndex, - aSSAM[iTargetVariateIndex]); - } - - /** - * Compute the Target Variate Function Metrics over the full Non-target Variate Empirical Distribution - * - * @param aSSAM Array of Variate Sequence Metrics - * @param iTargetVariateIndex Target Variate Index - * - * @return The Variate-specific Function Metrics - */ - - public org.drip.sequence.metrics.SingleSequenceAgnosticMetrics unconditionalTargetVariateMetrics ( - final org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] aSSAM, - final int iTargetVariateIndex) - { - if (null == aSSAM || 0 > iTargetVariateIndex) return null; - - int iTargetVariateVarianceIndex = 0; - int iNumNonTargetVariate = aSSAM.length - 1; - - if (0 >= iNumNonTargetVariate) return null; - - org.drip.spaces.iterator.SequenceIndexIterator sii = - org.drip.spaces.iterator.SequenceIndexIterator.Standard (iNumNonTargetVariate, - aSSAM[0].sequence().length); - - if (null == sii) return null; - - double[] adblTargetVariateVariance = new double[sii.size()]; - - int[] aiNonTargetVariateSequenceIndex = sii.first(); - - while (null != aiNonTargetVariateSequenceIndex && aiNonTargetVariateSequenceIndex.length == - iNumNonTargetVariate) { - org.drip.sequence.metrics.SingleSequenceAgnosticMetrics ssamConditional = - conditionalTargetVariateMetrics (aSSAM, aiNonTargetVariateSequenceIndex, - iTargetVariateIndex); - - if (null == ssamConditional) return null; - - adblTargetVariateVariance[iTargetVariateVarianceIndex++] = ssamConditional.empiricalVariance(); - - aiNonTargetVariateSequenceIndex = sii.next(); - } - - try { - return new org.drip.sequence.metrics.SingleSequenceAgnosticMetrics (adblTargetVariateVariance, - null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/sequence/functional/SeparableMultivariateRandom.java b/org/drip/sequence/functional/SeparableMultivariateRandom.java deleted file mode 100644 index 006abf5..0000000 --- a/org/drip/sequence/functional/SeparableMultivariateRandom.java +++ /dev/null @@ -1,74 +0,0 @@ - -package org.drip.sequence.functional; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * SeparableMultivariateRandom exposes the Variance of the Objective Function dependent on Multivariate - * Random Variables where the Multivariate Function is a Linear Combination of Bounded Univariate Functions - * acting on each Random Variate. - * - * @author Lakshmi Krishnamurthy - */ - -public interface SeparableMultivariateRandom { - - /** - * Compute the Variance associated with the Target Variate Function - * - * @param iTargetVariateIndex The Target Variate Index - * - * @return Variance associated with the Target Variate Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public abstract double targetVariateVariance ( - final int iTargetVariateIndex) - throws java.lang.Exception; -} diff --git a/org/drip/sequence/metrics/BoundedSequenceAgnosticMetrics.java b/org/drip/sequence/metrics/BoundedSequenceAgnosticMetrics.java deleted file mode 100644 index 43f8b8d..0000000 --- a/org/drip/sequence/metrics/BoundedSequenceAgnosticMetrics.java +++ /dev/null @@ -1,196 +0,0 @@ - -package org.drip.sequence.metrics; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BoundedSequenceAgnosticMetrics contains the Sample Distribution Metrics and Agnostic Bounds related to the - * specified Bounded Sequence. - * - * @author Lakshmi Krishnamurthy - */ - -public class BoundedSequenceAgnosticMetrics extends - org.drip.sequence.metrics.SingleSequenceAgnosticMetrics { - private double _dblSupport = java.lang.Double.NaN; - - /** - * BoundedSequenceAgnosticMetrics Constructor - * - * @param adblSequence The Random Sequence - * @param distPopulation The Population Distribution - * @param dblSupport The Support of the Underlying Random Variable - * - * @throws java.lang.Exception Thrown if BoundedSequenceAgnosticMetrics cannot be constructed - */ - - public BoundedSequenceAgnosticMetrics ( - final double[] adblSequence, - final org.drip.measure.continuousmarginal.R1 distPopulation, - final double dblSupport) - throws java.lang.Exception - { - super (adblSequence, distPopulation); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblSupport = dblSupport) || 0. >= _dblSupport) - throw new java.lang.Exception ("BoundedSequenceAgnosticMetrics ctr: Invalid Inputs"); - } - - /** - * Retrieve the Random Sequence Support - * - * @return The Support Underlying the Random Sequence - */ - - public double support() - { - return _dblSupport; - } - - /** - * Estimate Mean Departure Bounds of the Average using the Chernoff-Hoeffding Bound - * - * @param dblLevel The Level at which the Departure is sought - * - * @return The Mean Departure Bounds - */ - - public org.drip.sequence.metrics.PivotedDepartureBounds chernoffHoeffdingAverageBounds ( - final double dblLevel) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblLevel) || dblLevel <= 0) return null; - - double dblBound = java.lang.Math.exp (-2. * sequence().length * dblLevel * dblLevel / (_dblSupport * - _dblSupport)); - - dblBound = dblBound < 1. ? dblBound : 1.; - - try { - return new org.drip.sequence.metrics.PivotedDepartureBounds - (org.drip.sequence.metrics.PivotedDepartureBounds.PIVOT_ANCHOR_TYPE_MEAN, - java.lang.Double.NaN, dblBound, dblBound); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Estimate Mean Departure Bounds of the Average using the Bennett Inequality Bounds - * - * @param dblLevel The Level at which the Departure is sought - * - * @return The Mean Departure Bounds - */ - - public org.drip.sequence.metrics.PivotedDepartureBounds bennettAverageBounds ( - final double dblLevel) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblLevel) || dblLevel <= 0.) return null; - - double dblPopulationVariance = populationVariance(); - - double dblVariance = (org.drip.quant.common.NumberUtil.IsValid (dblPopulationVariance) ? - dblPopulationVariance : empiricalVariance()); - - double dblBennettFactor = _dblSupport * dblLevel / dblVariance; - - dblBennettFactor = (1. + dblBennettFactor) * java.lang.Math.log (1. + dblBennettFactor) - - dblBennettFactor; - - double dblBound = java.lang.Math.exp (-1. * sequence().length * dblVariance * dblBennettFactor / - (_dblSupport * _dblSupport)); - - dblBound = dblBound < 1. ? dblBound : 1.; - - try { - return new org.drip.sequence.metrics.PivotedDepartureBounds - (org.drip.sequence.metrics.PivotedDepartureBounds.PIVOT_ANCHOR_TYPE_MEAN, - java.lang.Double.NaN, dblBound, dblBound); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Estimate Mean Departure Bounds of the Average using the Bernstein Inequality Bounds - * - * @param dblLevel The Level at which the Departure is sought - * - * @return The Mean Departure Bounds - */ - - public org.drip.sequence.metrics.PivotedDepartureBounds bernsteinAverageBounds ( - final double dblLevel) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblLevel) || dblLevel <= 0.) return null; - - double dblPopulationVariance = populationVariance(); - - double dblVariance = (org.drip.quant.common.NumberUtil.IsValid (dblPopulationVariance) ? - dblPopulationVariance : empiricalVariance()); - - double dblBound = java.lang.Math.exp (-1. * sequence().length * dblLevel * dblLevel / (2. * - dblVariance + (2. * _dblSupport * dblLevel / 3.))); - - dblBound = dblBound < 1. ? dblBound : 1.; - - try { - return new org.drip.sequence.metrics.PivotedDepartureBounds - (org.drip.sequence.metrics.PivotedDepartureBounds.PIVOT_ANCHOR_TYPE_MEAN, - java.lang.Double.NaN, dblBound, dblBound); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/sequence/metrics/DualSequenceAgnosticMetrics.java b/org/drip/sequence/metrics/DualSequenceAgnosticMetrics.java deleted file mode 100644 index cf2f78b..0000000 --- a/org/drip/sequence/metrics/DualSequenceAgnosticMetrics.java +++ /dev/null @@ -1,106 +0,0 @@ - -package org.drip.sequence.metrics; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * DualSequenceAgnosticMetrics contains the Joint Distribution Metrics and Agnostic Bounds related to the - * specified Sequence Pair. - * - * @author Lakshmi Krishnamurthy - */ - -public class DualSequenceAgnosticMetrics { - private org.drip.sequence.metrics.SingleSequenceAgnosticMetrics _ssam1 = null; - private org.drip.sequence.metrics.SingleSequenceAgnosticMetrics _ssam2 = null; - - /** - * DualSequenceAgnosticMetrics Constructor - * - * @param ssam1 First Sequence Metrics - * @param ssam2 Second Sequence Metrics - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public DualSequenceAgnosticMetrics ( - final org.drip.sequence.metrics.SingleSequenceAgnosticMetrics ssam1, - final org.drip.sequence.metrics.SingleSequenceAgnosticMetrics ssam2) - throws java.lang.Exception - { - if (null == (_ssam1 = ssam1) || null == (_ssam2 = ssam2) || _ssam1.sequence().length != - _ssam2.sequence().length) - throw new java.lang.Exception ("DualSequenceAgnosticMetrics ctr: Invalid Inputs"); - } - - /** - * Retrieve the Array of the Component Single Sequences - * - * @return The Array of the Component Single Sequences - */ - - public org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] components() - { - return new org.drip.sequence.metrics.SingleSequenceAgnosticMetrics[] {_ssam1, _ssam2}; - } - - /** - * Retrieve the Cauchy-Schwarz Joint Expectation Bound - * - * @return The Cauchy-Schwarz Joint Expectation Bound - * - * @throws java.lang.Exception Thrown if the Cauchy-Schwarz Joint Expectation Bound cannot be computed - */ - - public double cauchySchwarzAbsoluteBound() - throws java.lang.Exception - { - return java.lang.Math.sqrt (_ssam1.empiricalRawMoment (2, true) * _ssam2.empiricalRawMoment (2, - true)); - } -} diff --git a/org/drip/sequence/metrics/IntegerSequenceAgnosticMetrics.java b/org/drip/sequence/metrics/IntegerSequenceAgnosticMetrics.java deleted file mode 100644 index 7e50eed..0000000 --- a/org/drip/sequence/metrics/IntegerSequenceAgnosticMetrics.java +++ /dev/null @@ -1,118 +0,0 @@ - -package org.drip.sequence.metrics; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * IntegerSequenceAgnosticMetrics contains the Sample Distribution Metrics and Agnostic Bounds related to the - * specified Integer Sequence. - * - * @author Lakshmi Krishnamurthy - */ - -public class IntegerSequenceAgnosticMetrics extends - org.drip.sequence.metrics.SingleSequenceAgnosticMetrics { - - /** - * Build out the Sequence and their Metrics - * - * @param adblSequence Array of Sequence Entries - * @param distPopulation The True Underlying Generator Distribution of the Population - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public IntegerSequenceAgnosticMetrics ( - final double[] adblSequence, - final org.drip.measure.continuousmarginal.R1 distPopulation) - throws java.lang.Exception - { - super (adblSequence, distPopulation); - - if (!isPositive()) - throw new java.lang.Exception - ("IntegerSequenceAgnosticMetrics ctr => Series should be non-Negative!"); - } - - /** - * Retrieve the Upper Bound on Probability of X gt 0 - * - * @return The Upper Bound on Probability of X gt 0 - */ - - public double probGreaterThanZeroUpperBound() - { - double dblPopulationMean = populationMean(); - - double dblProb = org.drip.quant.common.NumberUtil.IsValid (dblPopulationMean) ? dblPopulationMean : - empiricalExpectation(); - - return dblProb > 1. ? 1 : dblProb; - } - - /** - * Retrieve the Upper Bound on Probability of X = 0 - * - * @return The Upper Bound on Probability of X = 0 - */ - - public double probEqualToZeroUpperBound() - { - double dblPopulationMean = populationMean(); - - double dblMean = org.drip.quant.common.NumberUtil.IsValid (dblPopulationMean) ? dblPopulationMean : - empiricalExpectation(); - - double dblPopulationVariance = populationVariance(); - - double dblVariance = org.drip.quant.common.NumberUtil.IsValid (dblPopulationVariance) ? - dblPopulationVariance : empiricalVariance(); - - return dblVariance / (dblMean * dblMean + dblVariance); - } -} diff --git a/org/drip/sequence/metrics/PivotedDepartureBounds.java b/org/drip/sequence/metrics/PivotedDepartureBounds.java deleted file mode 100644 index 9ac6d17..0000000 --- a/org/drip/sequence/metrics/PivotedDepartureBounds.java +++ /dev/null @@ -1,155 +0,0 @@ - -package org.drip.sequence.metrics; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * PivotedDepartureBounds holds the Lower/Upper Probability Bounds in regards to the Specified Pivot-Centered - * Sequence. - * - * @author Lakshmi Krishnamurthy - */ - -public class PivotedDepartureBounds { - - /** - * PIVOT ANCHOR TYPE - ZERO - */ - - public static final int PIVOT_ANCHOR_TYPE_ZERO = 1; - - /** - * PIVOT ANCHOR TYPE - MEAN - */ - - public static final int PIVOT_ANCHOR_TYPE_MEAN = 2; - - /** - * PIVOT ANCHOR TYPE - CUSTOM - */ - - public static final int PIVOT_ANCHOR_TYPE_CUSTOM = 4; - - private int _iPivotAnchorType = -1; - private double _dblLower = java.lang.Double.NaN; - private double _dblUpper = java.lang.Double.NaN; - private double _dblCustomPivotAnchor = java.lang.Double.NaN; - - /** - * PivotedDepartureBounds Constructor - * - * @param iPivotAnchorType The Type of the Pivot Anchor - * @param dblCustomPivotAnchor The Custom Pivot Anchor - * @param dblLower Lower Bound - * @param dblUpper Upper Bound - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public PivotedDepartureBounds ( - final int iPivotAnchorType, - final double dblCustomPivotAnchor, - final double dblLower, - final double dblUpper) - throws java.lang.Exception - { - _dblLower = dblLower; - _dblUpper = dblUpper; - _iPivotAnchorType = iPivotAnchorType; - _dblCustomPivotAnchor = dblCustomPivotAnchor; - - if ((!org.drip.quant.common.NumberUtil.IsValid (_dblLower) && - !org.drip.quant.common.NumberUtil.IsValid (_dblUpper)) || (PIVOT_ANCHOR_TYPE_CUSTOM == - _iPivotAnchorType && !org.drip.quant.common.NumberUtil.IsValid (_dblCustomPivotAnchor))) - throw new java.lang.Exception ("PivotedDepartureBounds ctr: Invalid Inputs"); - } - - /** - * Retrieve the Lower Probability Bound - * - * @return The Lower Probability Bound - */ - - public double lower() - { - return _dblLower; - } - - /** - * Retrieve the Upper Probability Bound - * - * @return The Upper Probability Bound - */ - - public double upper() - { - return _dblUpper; - } - - /** - * Retrieve the Pivot Anchor Type - * - * @return The Pivot Anchor Type - */ - - public int pivotAnchorType() - { - return _iPivotAnchorType; - } - - /** - * Retrieve the Custom Pivot Anchor - * - * @return The Custom Pivot Anchor - */ - - public double customPivotAnchor() - { - return _dblCustomPivotAnchor; - } -} diff --git a/org/drip/sequence/metrics/PoissonSequenceAgnosticMetrics.java b/org/drip/sequence/metrics/PoissonSequenceAgnosticMetrics.java deleted file mode 100644 index 61ae580..0000000 --- a/org/drip/sequence/metrics/PoissonSequenceAgnosticMetrics.java +++ /dev/null @@ -1,122 +0,0 @@ - -package org.drip.sequence.metrics; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * PoissonSequenceAgnosticMetrics contains the Sample Distribution Metrics and Agnostic Bounds related to the - * specified Poisson Sequence. - * - * @author Lakshmi Krishnamurthy - */ - -public class PoissonSequenceAgnosticMetrics extends org.drip.sequence.metrics.SingleSequenceAgnosticMetrics { - private double _dblPopulationMean = java.lang.Double.NaN; - - /** - * PoissonSequenceAgnosticMetrics Constructor - * - * @param adblSequence The Random Sequence - * @param dblPopulationMean The Mean of the Underlying Distribution - * - * @throws java.lang.Exception Thrown if PoissonSequenceAgnosticMetrics cannot be constructed - */ - - public PoissonSequenceAgnosticMetrics ( - final double[] adblSequence, - final double dblPopulationMean) - throws java.lang.Exception - { - super (adblSequence, null); - - _dblPopulationMean = dblPopulationMean; - } - - /** - * Retrieve the Mean of the Underlying Distribution - * - * @return The Mean of the Underlying Distribution - */ - - public double populationMean() - { - return _dblPopulationMean; - } - - /** - * Compute the Chernoff-Stirling Upper Bound - * - * @param dblLevel The Level at which the Bound is sought - * - * @return The Chernoff-Stirling Upper Bound - * - * @throws java.lang.Exception Thrown if the Chernoff-Stirling Upper Bound cannot be computed - */ - - public double chernoffStirlingUpperBound ( - final double dblLevel) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblLevel)) - throw new java.lang.Exception - ("PoissonSequenceAgnosticMetrics::chernoffStirlingUpperBound => Invalid Inputs"); - - int iNumEntry = sequence().length; - - double dblPopulationMean = org.drip.quant.common.NumberUtil.IsValid (_dblPopulationMean) ? - _dblPopulationMean : empiricalExpectation(); - - double dblBound = (java.lang.Math.pow (dblPopulationMean / dblLevel, iNumEntry * dblLevel) * - java.lang.Math.exp (iNumEntry * (dblLevel - dblPopulationMean) - (1. / (12. * iNumEntry * - dblLevel + 1.)))) / java.lang.Math.sqrt (2. * java.lang.Math.PI * iNumEntry * dblLevel); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblBound)) return 0.; - - return dblBound > 1. ? 1. : dblBound; - } -} diff --git a/org/drip/sequence/metrics/SingleSequenceAgnosticMetrics.java b/org/drip/sequence/metrics/SingleSequenceAgnosticMetrics.java deleted file mode 100644 index bac0ae9..0000000 --- a/org/drip/sequence/metrics/SingleSequenceAgnosticMetrics.java +++ /dev/null @@ -1,520 +0,0 @@ - -package org.drip.sequence.metrics; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * SingleSequenceAgnosticMetrics contains the Sample Distribution Metrics and Agnostic Bounds related to the - * specified Sequence. - * - * @author Lakshmi Krishnamurthy - */ - -public class SingleSequenceAgnosticMetrics { - private boolean _bIsPositive = true; - private double[] _adblSequence = null; - private double _dblEmpiricalVariance = java.lang.Double.NaN; - private double _dblEmpiricalExpectation = java.lang.Double.NaN; - private org.drip.measure.continuousmarginal.R1 _distPopulation = null; - - /** - * Build out the Sequence and their Metrics - * - * @param adblSequence Array of Sequence Entries - * @param distPopulation The True Underlying Generator Distribution of the Population - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public SingleSequenceAgnosticMetrics ( - final double[] adblSequence, - final org.drip.measure.continuousmarginal.R1 distPopulation) - throws java.lang.Exception - { - if (null == (_adblSequence = adblSequence)) - throw new java.lang.Exception ("SingleSequenceAgnosticMetrics ctr: Invalid Inputs"); - - _dblEmpiricalExpectation = 0.; - _distPopulation = distPopulation; - int iNumEntry = _adblSequence.length; - - if (0 == iNumEntry) - throw new java.lang.Exception ("SingleSequenceAgnosticMetrics ctr: Invalid Inputs"); - - for (int i = 0; i < iNumEntry; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (_adblSequence[i])) - throw new java.lang.Exception ("SingleSequenceAgnosticMetrics ctr: Invalid Inputs"); - - _dblEmpiricalExpectation += _adblSequence[i]; - - if (_adblSequence[i] < 0.) _bIsPositive = false; - } - - _dblEmpiricalVariance = 0.; - _dblEmpiricalExpectation /= iNumEntry; - - for (int i = 0; i < iNumEntry; ++i) - _dblEmpiricalVariance += (_adblSequence[i] - _dblEmpiricalExpectation) * (_adblSequence[i] - - _dblEmpiricalExpectation); - - _dblEmpiricalVariance /= iNumEntry; - } - - /** - * Compute the Specified Central Moment of the Sample Sequence - * - * @param iMoment The Moment - * @param bAbsolute TRUE - The Moment sought is on the Absolute Value - * - * @return The Specified Central Moment of the Sample Sequence - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public double empiricalCentralMoment ( - final int iMoment, - final boolean bAbsolute) - throws java.lang.Exception - { - if (0 >= iMoment) - throw new java.lang.Exception - ("SingleSequenceAgnosticMetrics::empiricalCentralMoment => Invalid Moment"); - - double dblMoment = 0.; - int iNumEntry = _adblSequence.length; - - for (int i = 0; i < iNumEntry; ++i) { - double dblDeparture = _adblSequence[i] - _dblEmpiricalExpectation; - - dblMoment += java.lang.Math.pow (bAbsolute ? java.lang.Math.abs (dblDeparture) : dblDeparture, - iMoment); - } - - return dblMoment / iNumEntry; - } - - /** - * Compute the Specified Raw Moment of the Sample Sequence - * - * @param iMoment The Moment - * @param bAbsolute TRUE - The Moment sought is on the Absolute Value - * - * @return The Specified Raw Moment of the Sample Sequence - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public double empiricalRawMoment ( - final int iMoment, - final boolean bAbsolute) - throws java.lang.Exception - { - if (0 >= iMoment) - throw new java.lang.Exception - ("SingleSequenceAgnosticMetrics::empiricalRawMoment => Invalid Moment"); - - double dblMoment = 0.; - int iNumEntry = _adblSequence.length; - - for (int i = 0; i < iNumEntry; ++i) - dblMoment += java.lang.Math.pow (bAbsolute ? java.lang.Math.abs (_adblSequence[i]) : - _adblSequence[i], iMoment); - - return dblMoment / iNumEntry; - } - - /** - * Compute the Specified Anchor Moment of the Sample Sequence - * - * @param iMoment The Moment - * @param dblAnchor The Anchor Pivot off of which the Moment is calculated - * @param bAbsolute TRUE - The Moment sought is on the Absolute Value - * - * @return The Specified Anchor Moment of the Sample Sequence - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public double empiricalAnchorMoment ( - final int iMoment, - final double dblAnchor, - final boolean bAbsolute) - throws java.lang.Exception - { - if (0 >= iMoment || !org.drip.quant.common.NumberUtil.IsValid (dblAnchor)) - throw new java.lang.Exception - ("SingleSequenceAgnosticMetrics::empiricalAnchorMoment => Invalid Inputs"); - - double dblMoment = 0.; - int iNumEntry = _adblSequence.length; - - for (int i = 0; i < iNumEntry; ++i) { - double dblPivotShift = _adblSequence[i] - dblAnchor; - - dblMoment += java.lang.Math.pow (bAbsolute ? java.lang.Math.abs (dblPivotShift) : dblPivotShift, - iMoment); - } - - return dblMoment / iNumEntry; - } - - /** - * Generate the Metrics for the Univariate Function Sequence - * - * @param au The Univariate Function - * - * @return Metrics for the Univariate Function Sequence - */ - - public SingleSequenceAgnosticMetrics functionSequenceMetrics ( - final org.drip.function.definition.R1ToR1 au) - { - if (null == au) return null; - - int iNumEntry = _adblSequence.length; - double[] adblFunctionMetrics = new double[iNumEntry]; - - try { - for (int i = 0; i < iNumEntry; ++i) - adblFunctionMetrics[i] = au.evaluate (_adblSequence[i]); - - return new SingleSequenceAgnosticMetrics (adblFunctionMetrics, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Population Distribution - * - * @return The Population Distribution - */ - - public org.drip.measure.continuousmarginal.R1 populationDistribution() - { - return _distPopulation; - } - - /** - * Retrieve the Sample Expectation - * - * @return The Sample Expectation - */ - - public double empiricalExpectation() - { - return _dblEmpiricalExpectation; - } - - /** - * Retrieve the Population Mean - * - * @return The Population Mean - */ - - public double populationMean() - { - return null == _distPopulation ? java.lang.Double.NaN : _distPopulation.mean(); - } - - /** - * Retrieve the Sample Variance - * - * @return The Sample Variance - */ - - public double empiricalVariance() - { - return _dblEmpiricalVariance; - } - - /** - * Retrieve the Population Variance - * - * @return The Population Variance - */ - - public double populationVariance() - { - return null == _distPopulation ? java.lang.Double.NaN : _distPopulation.variance(); - } - - /** - * Retrieve the Sequence Positiveness Flag - * - * @return TRUE - The Sequence is Positiveness - */ - - public boolean isPositive() - { - return _bIsPositive; - } - - /** - * Retrieve the Input Sequence - * - * @return The Input Sequence - */ - - public double[] sequence() - { - return _adblSequence; - } - - /** - * Retrieve the Markov Upper Limiting Probability Bound for the Specified Level: - * - P (X gte t) lte E[f(X)] / f(t) - * - * @param dblLevel The Specified Level - * @param auNonDecreasing The Non-decreasing Bounding Transformer Function - * - * @return The Markov Upper Limiting Probability Bound for the Specified Level - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public double markovUpperProbabilityBound ( - final double dblLevel, - final org.drip.function.definition.R1ToR1 auNonDecreasing) - throws java.lang.Exception - { - if (!isPositive() || !org.drip.quant.common.NumberUtil.IsValid (dblLevel) || dblLevel <= 0.) - throw new java.lang.Exception - ("SingleSequenceAgnosticMetrics::markovUpperProbabilityBound => Invalid Inputs"); - - double dblPopulationMean = populationMean(); - - double dblUpperProbabilityBound = (org.drip.quant.common.NumberUtil.IsValid (dblPopulationMean) ? - dblPopulationMean : _dblEmpiricalExpectation) / dblLevel; - - if (null != auNonDecreasing) { - SingleSequenceAgnosticMetrics smFunction = functionSequenceMetrics (auNonDecreasing); - - if (null == smFunction) - throw new java.lang.Exception - ("SingleSequenceAgnosticMetrics::markovUpperProbabilityBound => Cannot generate Function Sequence Metrics"); - - dblUpperProbabilityBound = smFunction.empiricalExpectation() / auNonDecreasing.evaluate - (dblLevel); - } - - return dblUpperProbabilityBound < 1. ? dblUpperProbabilityBound : 1.; - } - - /** - * Retrieve the Mean Departure Bounds Using the Chebyshev's Inequality - * - * @param dblLevel The Level at which the Departure is sought - * - * @return The Mean Departure Bounds Instance - */ - - public org.drip.sequence.metrics.PivotedDepartureBounds chebyshevBound ( - final double dblLevel) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblLevel) || dblLevel <= 0.) return null; - - double dblPopulationVariance = populationVariance(); - - double dblMeanDepartureBound = (org.drip.quant.common.NumberUtil.IsValid (dblPopulationVariance) ? - dblPopulationVariance : _dblEmpiricalVariance) / (dblLevel * dblLevel); - - dblMeanDepartureBound = dblMeanDepartureBound < 1. ? dblMeanDepartureBound : 1.; - - try { - return new org.drip.sequence.metrics.PivotedDepartureBounds - (org.drip.sequence.metrics.PivotedDepartureBounds.PIVOT_ANCHOR_TYPE_MEAN, java.lang.Double.NaN, - dblMeanDepartureBound, dblMeanDepartureBound); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Mean Departure Bounds Using the Central Moment Bounding Inequality - * - * @param dblLevel The Level at which the Departure is sought - * @param iMoment The Moment Bound sought - * - * @return The Mean Departure Bounds Instance - */ - - public org.drip.sequence.metrics.PivotedDepartureBounds centralMomentBound ( - final double dblLevel, - final int iMoment) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblLevel) || dblLevel <= 0.) return null; - - try { - double dblMeanDepartureBound = empiricalCentralMoment (iMoment, true) / java.lang.Math.pow - (dblLevel, iMoment); - - dblMeanDepartureBound = dblMeanDepartureBound < 1. ? dblMeanDepartureBound : 1.; - - return new org.drip.sequence.metrics.PivotedDepartureBounds - (org.drip.sequence.metrics.PivotedDepartureBounds.PIVOT_ANCHOR_TYPE_MEAN, java.lang.Double.NaN, - dblMeanDepartureBound, dblMeanDepartureBound); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Mean Departure Bounds Using the Chebyshev-Cantelli Inequality - * - * @param dblLevel The Level at which the Departure is sought - * - * @return The Mean Departure Bounds - */ - - public org.drip.sequence.metrics.PivotedDepartureBounds chebyshevCantelliBound ( - final double dblLevel) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblLevel) || dblLevel <= 0.) return null; - - double dblPopulationVariance = populationVariance(); - - double dblVariance = (org.drip.quant.common.NumberUtil.IsValid (dblPopulationVariance) ? - dblPopulationVariance : _dblEmpiricalVariance); - - try { - return new org.drip.sequence.metrics.PivotedDepartureBounds - (org.drip.sequence.metrics.PivotedDepartureBounds.PIVOT_ANCHOR_TYPE_MEAN, java.lang.Double.NaN, - java.lang.Double.NaN, dblVariance / (dblVariance + dblLevel * dblLevel)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Chebyshev's Association Joint Expectation Bound - * - * @param au1 Function 1 Operating On Sequence 1 - * @param bNonDecreasing1 TRUE - Function 1 is non-decreasing - * @param au2 Function 2 Operating On Sequence 2 - * @param bNonDecreasing2 TRUE - Function 2 is non-decreasing - * - * @return The Chebyshev's Association Joint Expectation Bound - */ - - public org.drip.sequence.metrics.PivotedDepartureBounds chebyshevAssociationBound ( - final org.drip.function.definition.R1ToR1 au1, - final boolean bNonDecreasing1, - final org.drip.function.definition.R1ToR1 au2, - final boolean bNonDecreasing2) - { - if (null == au1 || null == au2) return null; - - double dblBound = functionSequenceMetrics (au1).empiricalExpectation() * functionSequenceMetrics - (au2).empiricalExpectation(); - - dblBound = dblBound < 1. ? dblBound : 1.; - - if (bNonDecreasing1 == bNonDecreasing2) { - try { - return new org.drip.sequence.metrics.PivotedDepartureBounds - (org.drip.sequence.metrics.PivotedDepartureBounds.PIVOT_ANCHOR_TYPE_CUSTOM, 0., - dblBound, java.lang.Double.NaN); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - try { - return new org.drip.sequence.metrics.PivotedDepartureBounds - (org.drip.sequence.metrics.PivotedDepartureBounds.PIVOT_ANCHOR_TYPE_CUSTOM, 0., - java.lang.Double.NaN, dblBound); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Estimate Mean Departure Bounds of the Average using the Weak Law of Large Numbers - * - * @param dblLevel The Level at which the Departure is sought - * - * @return The Mean Departure Bounds - */ - - public org.drip.sequence.metrics.PivotedDepartureBounds weakLawAverageBounds ( - final double dblLevel) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblLevel) || dblLevel <= 0.) return null; - - double dblPopulationVariance = populationVariance(); - - double dblVariance = (org.drip.quant.common.NumberUtil.IsValid (dblPopulationVariance) ? - dblPopulationVariance : _dblEmpiricalVariance); - - double dblBound = dblVariance / (_adblSequence.length * dblLevel * dblLevel); - dblBound = dblBound < 1. ? dblBound : 1.; - - try { - return new org.drip.sequence.metrics.PivotedDepartureBounds - (org.drip.sequence.metrics.PivotedDepartureBounds.PIVOT_ANCHOR_TYPE_MEAN, - java.lang.Double.NaN, dblBound, dblBound); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/sequence/metrics/UnitSequenceAgnosticMetrics.java b/org/drip/sequence/metrics/UnitSequenceAgnosticMetrics.java deleted file mode 100644 index f4c49eb..0000000 --- a/org/drip/sequence/metrics/UnitSequenceAgnosticMetrics.java +++ /dev/null @@ -1,199 +0,0 @@ - -package org.drip.sequence.metrics; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * UnitSequenceAgnosticMetrics contains the Sample Distribution Metrics and Agnostic Bounds related to the - * specified Bounded [0, 1] Sequence. - * - * @author Lakshmi Krishnamurthy - */ - -public class UnitSequenceAgnosticMetrics extends org.drip.sequence.metrics.BoundedSequenceAgnosticMetrics -{ - private double _dblPopulationMean = java.lang.Double.NaN; - - /** - * UnitSequenceAgnosticMetrics Constructor - * - * @param adblSequence The Random Sequence - * @param dblPopulationMean The Mean of the Underlying Distribution - * - * @throws java.lang.Exception Thrown if UnitSequenceAgnosticMetrics cannot be constructed - */ - - public UnitSequenceAgnosticMetrics ( - final double[] adblSequence, - final double dblPopulationMean) - throws java.lang.Exception - { - super (adblSequence, null, 1.); - - _dblPopulationMean = dblPopulationMean; - } - - /** - * Retrieve the Mean of the Underlying Distribution - * - * @return The Mean of the Underlying Distribution - */ - - public double populationMean() - { - return _dblPopulationMean; - } - - /** - * Compute the Chernoff Binomial Upper Bound - * - * @param dblLevel The Level at which the Bound is sought - * - * @return The Chernoff Binomial Upper Bound - * - * @throws java.lang.Exception Thrown if the Chernoff Binomial Upper Bound cannot be computed - */ - - public double chernoffBinomialUpperBound ( - final double dblLevel) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblLevel) || 1. < dblLevel) - throw new java.lang.Exception - ("UnitSequenceAgnosticMetrics::chernoffBinomialUpperBound => Invalid Inputs"); - - int iNumEntry = sequence().length; - - double dblPopulationMean = org.drip.quant.common.NumberUtil.IsValid (_dblPopulationMean) ? - _dblPopulationMean : empiricalExpectation(); - - double dblBound = java.lang.Math.pow (dblPopulationMean / dblLevel, iNumEntry * dblLevel) * - java.lang.Math.pow ((1. - dblPopulationMean) / (1. - dblLevel), iNumEntry * (1. - dblLevel)); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblBound)) return 0.; - - return dblBound > 1. ? 1. : dblBound; - } - - /** - * Compute the Chernoff-Poisson Binomial Upper Bound - * - * @param dblLevel The Level at which the Bound is sought - * - * @return The Chernoff-Poisson Binomial Upper Bound - * - * @throws java.lang.Exception Thrown if the Chernoff-Poisson Binomial Upper Bound cannot be computed - */ - - public double chernoffPoissonUpperBound ( - final double dblLevel) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblLevel) || 1. < dblLevel) - throw new java.lang.Exception - ("UnitSequenceAgnosticMetrics::ChernoffBinomialUpperBound => Invalid Inputs"); - - int iNumEntry = sequence().length; - - double dblPopulationMean = org.drip.quant.common.NumberUtil.IsValid (_dblPopulationMean) ? - _dblPopulationMean : empiricalExpectation(); - - double dblBound = java.lang.Math.pow (dblPopulationMean / dblLevel, iNumEntry * dblLevel) * - java.lang.Math.exp (iNumEntry * (dblLevel - dblPopulationMean)); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblBound)) return 0.; - - return dblBound > 1. ? 1. : dblBound; - } - - /** - * Compute the Karp/Hagerup/Rub Pivot Departure Bounds outlined below: - * - * - Karp, R. M. (1988): Probabilistic Analysis of Algorithms, University of California, Berkeley. - * - Hagerup, T., and C. Rub (1990): A Guided Tour of Chernoff Bounds, Information Processing Letters, - * 33:305-308. - * - * @param dblLevel The Level at which the Bound is sought - * - * @return The Karp/Hagerup/Rub Pivot Departure Bounds - */ - - public org.drip.sequence.metrics.PivotedDepartureBounds karpHagerupRubBounds ( - final double dblLevel) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblLevel) || 1. < dblLevel) return null; - - int iNumEntry = sequence().length; - - double dblPopulationMean = org.drip.quant.common.NumberUtil.IsValid (_dblPopulationMean) ? - _dblPopulationMean : empiricalExpectation(); - - double dblScaledLevel = dblLevel / dblPopulationMean; - - double dblLowerBound = java.lang.Math.exp (-0.5 * dblPopulationMean * iNumEntry * dblScaledLevel * - dblScaledLevel); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblLowerBound)) dblLowerBound = 0.; - - double dblUpperBound = java.lang.Math.exp (-1. * dblPopulationMean * iNumEntry * (1. + - dblScaledLevel) * java.lang.Math.log (1. + dblScaledLevel) - dblScaledLevel); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblUpperBound)) dblUpperBound = 0.; - - try { - return new org.drip.sequence.metrics.PivotedDepartureBounds - (org.drip.sequence.metrics.PivotedDepartureBounds.PIVOT_ANCHOR_TYPE_MEAN, - java.lang.Double.NaN, dblLowerBound > 1. ? 1. : dblLowerBound, dblUpperBound > 1. ? 1. : - dblUpperBound); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/sequence/random/Binary.java b/org/drip/sequence/random/Binary.java deleted file mode 100644 index a9809a0..0000000 --- a/org/drip/sequence/random/Binary.java +++ /dev/null @@ -1,96 +0,0 @@ - -package org.drip.sequence.random; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * Binary implements the Standard {0, 1}-valued Binary Random Number Generator. - * - * @author Lakshmi Krishnamurthy - */ - -public class Binary extends org.drip.sequence.random.Bounded { - private double _dblPositiveProbability = java.lang.Double.NaN; - - private java.util.Random _rng = new java.util.Random(); - - /** - * Binary Distribution Constructor - * - * @param dblPositiveProbability Probability of Generating ONE - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public Binary ( - final double dblPositiveProbability) - throws java.lang.Exception - { - super (0.,1.); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblPositiveProbability = dblPositiveProbability) || 0. - > _dblPositiveProbability || 1. < _dblPositiveProbability) - throw new java.lang.Exception ("BoundedUniform ctr: Invalid Inputs!"); - } - - /** - * Retrieve the Positive Instance Probability - * - * @return The Positive Instance Probability - */ - - public double positiveProbability() - { - return _dblPositiveProbability; - } - - @Override public double random() - { - return _rng.nextDouble() < _dblPositiveProbability ? 0. : 1.; - } -} diff --git a/org/drip/sequence/random/Bounded.java b/org/drip/sequence/random/Bounded.java deleted file mode 100644 index 5bad6fa..0000000 --- a/org/drip/sequence/random/Bounded.java +++ /dev/null @@ -1,112 +0,0 @@ - -package org.drip.sequence.random; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * Bounded implements the Bounded Random Univariate Generator with a Lower and an upper Bound. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class Bounded extends org.drip.sequence.random.UnivariateSequenceGenerator { - private double _dblLowerBound = java.lang.Double.NaN; - private double _dblUpperBound = java.lang.Double.NaN; - - protected Bounded ( - final double dblLowerBound, - final double dblUpperBound) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblLowerBound = dblLowerBound) || - !org.drip.quant.common.NumberUtil.IsValid (_dblUpperBound = dblUpperBound) || dblUpperBound <= - dblLowerBound) - throw new java.lang.Exception ("Bounded ctr: Invalid Inputs!"); - } - - /** - * Retrieve the Lower Bound - * - * @return The Lower Bound - */ - - public double lowerBound() - { - return _dblLowerBound; - } - - /** - * Retrieve the Upper Bound - * - * @return The Upper Bound - */ - - public double upperBound() - { - return _dblUpperBound; - } - - @Override public org.drip.sequence.metrics.SingleSequenceAgnosticMetrics sequence ( - final int iNumEntry, - final org.drip.measure.continuousmarginal.R1 distPopulation) - { - double[] adblSequence = new double[iNumEntry]; - - for (int i = 0; i < iNumEntry; ++i) - adblSequence[i] = random(); - - try { - return new org.drip.sequence.metrics.UnitSequenceAgnosticMetrics (adblSequence, null == - distPopulation ? java.lang.Double.NaN : distPopulation.mean()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/sequence/random/BoundedGaussian.java b/org/drip/sequence/random/BoundedGaussian.java deleted file mode 100644 index 74a9aed..0000000 --- a/org/drip/sequence/random/BoundedGaussian.java +++ /dev/null @@ -1,97 +0,0 @@ - -package org.drip.sequence.random; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BoundedGaussian implements the Bounded Gaussian Distribution, with a Gaussian Distribution between a lower - * and an upper Bound. - * - * @author Lakshmi Krishnamurthy - */ - -public class BoundedGaussian extends org.drip.sequence.random.BoxMullerGaussian { - private double _dblLowerBound = java.lang.Double.NaN; - private double _dblUpperBound = java.lang.Double.NaN; - - /** - * BoundedGaussian Constructor - * - * @param dblMean The Mean - * @param dblVariance The Variance - * @param dblLowerBound The Lower Bound - * @param dblUpperBound The Upper Bound - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BoundedGaussian ( - final double dblMean, - final double dblVariance, - final double dblLowerBound, - final double dblUpperBound) - throws java.lang.Exception - { - super (dblMean, dblVariance); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblLowerBound = dblLowerBound) || - !org.drip.quant.common.NumberUtil.IsValid (_dblUpperBound = dblUpperBound) || dblUpperBound <= - dblLowerBound) - throw new java.lang.Exception ("BoundedGaussian ctr: Invalid Inputs"); - } - - @Override public double random() - { - double dblGaussian = super.random(); - - while (dblGaussian < _dblLowerBound || dblGaussian > _dblUpperBound) - dblGaussian = super.random(); - - return dblGaussian; - } -} diff --git a/org/drip/sequence/random/BoundedUniform.java b/org/drip/sequence/random/BoundedUniform.java deleted file mode 100644 index ac3172d..0000000 --- a/org/drip/sequence/random/BoundedUniform.java +++ /dev/null @@ -1,84 +0,0 @@ - -package org.drip.sequence.random; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BoundedUniform implements the Bounded Uniform Distribution, with a Uniform Distribution between a lower - * and an upper Bound. - * - * @author Lakshmi Krishnamurthy - */ - -public class BoundedUniform extends org.drip.sequence.random.Bounded { - private java.util.Random _rng = new java.util.Random(); - - /** - * BoundedUniform Distribution Constructor - * - * @param dblLowerBound The Lower Bound - * @param dblUpperBound The Upper Bound - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public BoundedUniform ( - final double dblLowerBound, - final double dblUpperBound) - throws java.lang.Exception - { - super (dblLowerBound, dblUpperBound); - } - - @Override public double random() - { - double dblLowerBound = lowerBound(); - - return dblLowerBound + _rng.nextDouble() * (upperBound() - dblLowerBound); - } -} diff --git a/org/drip/sequence/random/BoundedUniformInteger.java b/org/drip/sequence/random/BoundedUniformInteger.java deleted file mode 100644 index 88585ea..0000000 --- a/org/drip/sequence/random/BoundedUniformInteger.java +++ /dev/null @@ -1,126 +0,0 @@ - -package org.drip.sequence.random; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BoundedUniformInteger implements the Bounded Uniform Distribution, with a Uniform Integer being generated - * between a lower and an upper Bound. - * - * @author Lakshmi Krishnamurthy - */ - -public class BoundedUniformInteger extends org.drip.sequence.random.UnivariateSequenceGenerator { - private int _iStart = -1; - private int _iFinish = -1; - - private java.util.Random _rng = new java.util.Random(); - - /** - * BoundedUniformInteger Distribution Constructor - * - * @param iStart The Lower Bound - * @param iFinish The Upper Bound - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public BoundedUniformInteger ( - final int iStart, - final int iFinish) - throws java.lang.Exception - { - if ((_iFinish = iFinish) <= (_iStart = iStart)) - throw new java.lang.Exception ("BoundedUniformInteger constructor: Invalid inputs"); - } - - /** - * Retrieve the Start - * - * @return The Start - */ - - public int start() - { - return _iStart; - } - - /** - * Retrieve the Finish - * - * @return The Finish - */ - - public int finish() - { - return _iFinish; - } - - @Override public double random() - { - return (int) (_iStart + _rng.nextDouble() * (_iFinish - _iStart) + 0.5); - } - - @Override public org.drip.sequence.metrics.SingleSequenceAgnosticMetrics sequence ( - final int iNumEntry, - final org.drip.measure.continuousmarginal.R1 distPopulation) - { - double[] adblSequence = new double[iNumEntry]; - - for (int i = 0; i < iNumEntry; ++i) - adblSequence[i] = random(); - - try { - return new org.drip.sequence.metrics.IntegerSequenceAgnosticMetrics (adblSequence, distPopulation); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/sequence/random/BoxMullerGaussian.java b/org/drip/sequence/random/BoxMullerGaussian.java deleted file mode 100644 index 59d2339..0000000 --- a/org/drip/sequence/random/BoxMullerGaussian.java +++ /dev/null @@ -1,112 +0,0 @@ - -package org.drip.sequence.random; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BoxMullerGaussian implements the Univariate Gaussian Random Number Generator. - * - * @author Lakshmi Krishnamurthy - */ - -public class BoxMullerGaussian extends org.drip.sequence.random.UnivariateSequenceGenerator { - private double _dblMean = java.lang.Double.NaN; - private double _dblSigma = java.lang.Double.NaN; - private double _dblVariance = java.lang.Double.NaN; - - private java.util.Random _rng = new java.util.Random(); - - /** - * BoxMullerGaussian Constructor - * - * @param dblMean The Mean - * @param dblVariance The Variance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BoxMullerGaussian ( - final double dblMean, - final double dblVariance) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblMean = dblMean) || - !org.drip.quant.common.NumberUtil.IsValid (_dblVariance = dblVariance) || _dblVariance <= 0.) - throw new java.lang.Exception ("BoxMullerGaussian ctr: Invalid Inputs"); - - _dblSigma = java.lang.Math.sqrt (_dblVariance); - } - - /** - * Retrieve the Mean of the Box-Muller Gaussian - * - * @return Mean of the Box-Muller Gaussian - */ - - public double mean() - { - return _dblMean; - } - - /** - * Retrieve the Variance of the Box-Muller Gaussian - * - * @return Variance of the Box-Muller Gaussian - */ - - public double variance() - { - return _dblVariance; - } - - @Override public double random() - { - return _dblMean + _dblSigma * java.lang.Math.sqrt (-2. * java.lang.Math.log (_rng.nextDouble())) * - java.lang.Math.cos (2. * java.lang.Math.PI * _rng.nextDouble()); - } -} diff --git a/org/drip/sequence/random/MultivariateSequenceGenerator.java b/org/drip/sequence/random/MultivariateSequenceGenerator.java deleted file mode 100644 index f905944..0000000 --- a/org/drip/sequence/random/MultivariateSequenceGenerator.java +++ /dev/null @@ -1,167 +0,0 @@ - -package org.drip.sequence.random; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * MultivariateSequenceGenerator implements the Multivariate Random Sequence Generator Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class MultivariateSequenceGenerator { - private double[][] _aadblCholesky = null; - private double[][] _aadblCorrelation = null; - private org.drip.sequence.random.UnivariateSequenceGenerator[] _aUSG = null; - - /** - * MultivariateSequenceGenerator Constructor - * - * @param aUSG Array of Univariate Sequence Generators - * @param aadblCorrelation The Correlation Matrix - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public MultivariateSequenceGenerator ( - final org.drip.sequence.random.UnivariateSequenceGenerator[] aUSG, - final double[][] aadblCorrelation) - throws java.lang.Exception - { - if (null == (_aUSG = aUSG) || null == (_aadblCorrelation = aadblCorrelation)) - throw new java.lang.Exception ("MultivariateSequenceGenerator ctr: Invalid Inputs"); - - _aadblCholesky = org.drip.quant.linearalgebra.Matrix.CholeskyBanachiewiczFactorization - (aadblCorrelation); - - int iNumVariate = aUSG.length; - - if (null == _aadblCholesky || null == _aadblCholesky[0] || iNumVariate != _aadblCholesky.length || - iNumVariate != _aadblCholesky[0].length) - throw new java.lang.Exception ("MultivariateSequenceGenerator ctr: Invalid Inputs"); - - for (int i = 0; i < iNumVariate; ++i) { - if (null == _aUSG[i]) - throw new java.lang.Exception ("MultivariateSequenceGenerator ctr: Invalid Inputs"); - - for (int j = 0; j < iNumVariate; ++j) { - if (!org.drip.quant.common.NumberUtil.IsValid (_aadblCorrelation[i][j])) - throw new java.lang.Exception ("MultivariateSequenceGenerator ctr: Invalid Inputs"); - } - } - } - - /** - * Retrieve the Array of Univariate Sequence Generators - * - * @return Array of Univariate Sequence Generators - */ - - public org.drip.sequence.random.UnivariateSequenceGenerator[] usg() - { - return _aUSG; - } - - /** - * Retrieve the Correlation Matrix - * - * @return The Correlation Matrix - */ - - public double[][] correlation() - { - return _aadblCorrelation; - } - - /** - * Retrieve the Cholesky Factorial - * - * @return The Cholesky Factorial - */ - - public double[][] cholesky() - { - return _aadblCholesky; - } - - /** - * Retrieve the Number of Variates - * - * @return The Number of Variates - */ - - public int numVariate() - { - return _aUSG.length; - } - - /** - * Generate the Set of Multivariate Random Numbers according to the specified rule - * - * @return The Set of Multivariate Random Numbers - */ - - public double[] random() - { - int iNumVariate = _aUSG.length; - double[] adblRandom = new double[iNumVariate]; - double[] adblUncorrelatedRandom = new double[iNumVariate]; - - for (int i = 0; i < iNumVariate; ++i) - adblUncorrelatedRandom[i] = _aUSG[i].random(); - - for (int i = 0; i < iNumVariate; ++i) { - adblRandom[i] = 0.; - - for (int j = 0; j < iNumVariate; ++j) - adblRandom[i] += _aadblCholesky[i][j] * adblUncorrelatedRandom[j]; - } - - return adblRandom; - } -} diff --git a/org/drip/sequence/random/Poisson.java b/org/drip/sequence/random/Poisson.java deleted file mode 100644 index 27afcaa3..0000000 --- a/org/drip/sequence/random/Poisson.java +++ /dev/null @@ -1,124 +0,0 @@ - -package org.drip.sequence.random; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * Poisson implements the Poisson Random Number Generator. - * - * @author Lakshmi Krishnamurthy - */ - -public class Poisson extends org.drip.sequence.random.UnivariateSequenceGenerator { - private double _dblLambda = java.lang.Double.NaN; - private double _dblExponentialLambda = java.lang.Double.NaN; - - /** - * Construct a Poisson Random Number Generator - * - * @param dblLambda Lambda - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public Poisson ( - final double dblLambda) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblLambda = dblLambda) || 0. >= _dblLambda) - throw new java.lang.Exception ("Poisson constructor: Invalid inputs"); - - _dblExponentialLambda = java.lang.Math.exp (-1. * _dblLambda); - } - - /** - * Retrieve Lambda - * - * @return Lambda - */ - - public double lambda() - { - return _dblLambda; - } - - @Override public double random() - { - int i = 0; - double dblPoissonProduct = 1.; - - java.util.Random r = new java.util.Random(); - - while (dblPoissonProduct > _dblExponentialLambda) { - ++i; - - dblPoissonProduct *= r.nextDouble(); - } - - return i; - } - - @Override public org.drip.sequence.metrics.SingleSequenceAgnosticMetrics sequence ( - final int iNumEntry, - final org.drip.measure.continuousmarginal.R1 distPopulation) - { - double[] adblSequence = new double[iNumEntry]; - - for (int i = 0; i < iNumEntry; ++i) - adblSequence[i] = random(); - - try { - return new org.drip.sequence.metrics.PoissonSequenceAgnosticMetrics (adblSequence, null == - distPopulation ? java.lang.Double.NaN : distPopulation.mean()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/sequence/random/PrincipalFactorSequenceGenerator.java b/org/drip/sequence/random/PrincipalFactorSequenceGenerator.java deleted file mode 100644 index 5154496..0000000 --- a/org/drip/sequence/random/PrincipalFactorSequenceGenerator.java +++ /dev/null @@ -1,165 +0,0 @@ - -package org.drip.sequence.random; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * PrincipalFactorSequenceGenerator implements the Principal Factors Based Multivariate Random Sequence - * Generator Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public class PrincipalFactorSequenceGenerator extends org.drip.sequence.random.MultivariateSequenceGenerator -{ - private double[][] _aadblFactor = null; - private double[] _adblFactorWeight = null; - - /** - * PrincipalFactorSequenceGenerator Constructor - * - * @param aUSG Array of Univariate Sequence Generators - * @param aadblCorrelation The Correlation Matrix - * @param iNumFactor Number of Factors - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public PrincipalFactorSequenceGenerator ( - final org.drip.sequence.random.UnivariateSequenceGenerator[] aUSG, - final double[][] aadblCorrelation, - final int iNumFactor) - throws java.lang.Exception - { - super (aUSG, aadblCorrelation); - - int iNumVariate = aUSG.length; - - if (0 >= iNumFactor || iNumFactor > iNumVariate) - throw new java.lang.Exception ("PrincipalFactorSequenceGenerator ctr: Invalid Inputs"); - - org.drip.quant.eigen.QREigenComponentExtractor qrece = new - org.drip.quant.eigen.QREigenComponentExtractor (80, 0.00001); - - org.drip.quant.eigen.EigenComponent[] aEC = qrece.orderedComponents (aadblCorrelation); - - if (null == aEC || 0 == aEC.length) - throw new java.lang.Exception ("PrincipalFactorSequenceGenerator ctr: Invalid Inputs"); - - double dblNormalizer = 0.; - _adblFactorWeight = new double[iNumFactor]; - _aadblFactor = new double[iNumFactor][iNumVariate]; - - for (int i = 0; i < iNumFactor; ++i) { - for (int j = 0; j < iNumVariate; ++j) - _aadblFactor[i] = aEC[i].eigenvector(); - - _adblFactorWeight[i] = aEC[i].eigenvalue(); - - dblNormalizer += _adblFactorWeight[i] * _adblFactorWeight[i]; - } - - dblNormalizer = java.lang.Math.sqrt (dblNormalizer); - - for (int i = 0; i < iNumFactor; ++i) - _adblFactorWeight[i] /= dblNormalizer; - } - - /** - * Retrieve the Number of Factors - * - * @return The Number of Factors - */ - - public int numFactor() - { - return _adblFactorWeight.length; - } - - /** - * Retrieve the Principal Component Factor Array - * - * @return The Principal Component Factor Array - */ - - public double[][] factors() - { - return _aadblFactor; - } - - /** - * Retrieve the Array of Factor Weights - * - * @return The Array of Factor Weights - */ - - public double[] factorWeight() - { - return _adblFactorWeight; - } - - @Override public double[] random() - { - double[] adblBaseRandom = super.random(); - - int iNumVariate = _aadblFactor[0].length; - int iNumFactor = _adblFactorWeight.length; - double[] adblRandom = new double[iNumFactor]; - - if (iNumFactor == iNumVariate) return adblBaseRandom; - - for (int i = 0; i < iNumFactor; ++i) { - adblRandom[i] = 0.; - - for (int j = 0; j < iNumVariate; ++j) - adblRandom[i] += _aadblFactor[i][j] * adblBaseRandom[j]; - } - - return adblRandom; - } -} diff --git a/org/drip/sequence/random/UnivariateSequenceGenerator.java b/org/drip/sequence/random/UnivariateSequenceGenerator.java deleted file mode 100644 index d13c497..0000000 --- a/org/drip/sequence/random/UnivariateSequenceGenerator.java +++ /dev/null @@ -1,110 +0,0 @@ - -package org.drip.sequence.random; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * UnivariateSequenceGenerator implements the Univariate Random Sequence Generator Functionality. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class UnivariateSequenceGenerator { - - /** - * Generate a Random Number according to the specified rule - * - * @return The Random Number - */ - - public abstract double random(); - - /** - * Generate a Random Sequence - * - * @param iNumEntry Number of Entries in the Sequence - * - * @return The Random Sequence - */ - - public double[] sequence ( - final int iNumEntry) - { - if (0 >= iNumEntry) return null; - - double[] adblSequence = new double[iNumEntry]; - - for (int i = 0; i < iNumEntry; ++i) - adblSequence[i] = random(); - - return adblSequence; - } - - /** - * Generate a Random Sequence along with its Metrics - * - * @param iNumEntry Number of Entries in the Sequence - * @param distPopulation The True Underlying Generator Distribution of the Population - * - * @return The Random Sequence (along with its Metrics) - */ - - public org.drip.sequence.metrics.SingleSequenceAgnosticMetrics sequence ( - final int iNumEntry, - final org.drip.measure.continuousmarginal.R1 distPopulation) - { - try { - return new org.drip.sequence.metrics.SingleSequenceAgnosticMetrics (sequence (iNumEntry), - distPopulation); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/service/api/CDXCOB.java b/org/drip/service/api/CDXCOB.java deleted file mode 100644 index 0cbc59d..0000000 --- a/org/drip/service/api/CDXCOB.java +++ /dev/null @@ -1,114 +0,0 @@ - -package org.drip.service.api; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * CDXCOB contains the Name and the COB Price for a given CDX. - * - * @author Lakshmi Krishnamurthy - */ - -public class CDXCOB { - private java.lang.String _strCDXName = ""; - private double _dblPrice = java.lang.Double.NaN; - - /** - * CDXCOB constructor - * - * @param strCDXName The CDX Name - * @param dblPrice The COB Price - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public CDXCOB ( - final java.lang.String strCDXName, - final double dblPrice) - throws java.lang.Exception - { - if (null == (_strCDXName = strCDXName) || _strCDXName.isEmpty() || - !org.drip.quant.common.NumberUtil.IsValid (_dblPrice = dblPrice)) - throw new java.lang.Exception ("CDXCOB ctr: Invalid Inputs"); - } - - /** - * The CDX Name - * - * @return The CDX Name - */ - - public java.lang.String name() - { - return _strCDXName; - } - - /** - * The COB Price - * - * @return The COB Price - */ - - public double price() - { - return _dblPrice; - } - - /** - * Display the CDXCOB Content - * - * @return The CDXCOB Content - */ - - public java.lang.String display() - { - return _strCDXName + " => " + _dblPrice; - } -} diff --git a/org/drip/service/api/DateDiscountCurvePair.java b/org/drip/service/api/DateDiscountCurvePair.java deleted file mode 100644 index 3f34682..0000000 --- a/org/drip/service/api/DateDiscountCurvePair.java +++ /dev/null @@ -1,118 +0,0 @@ - -package org.drip.service.api; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * DateDiscountCurvePair contains the COB/Discount Curve Pair, and the corresponding computed outputs. - * - * @author Lakshmi Krishnamurthy - */ - -public class DateDiscountCurvePair { - private org.drip.analytics.date.JulianDate _dt = null; - private org.drip.state.discount.MergedDiscountForwardCurve _dc = null; - private java.util.List _lsstrDump = null; - - /** - * DateDiscountCurvePair constructor - * - * @param dt The COB - * @param dc The COB Discount Curve - * @param lsstrDump List of Output String Dump - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public DateDiscountCurvePair ( - final org.drip.analytics.date.JulianDate dt, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final java.util.List lsstrDump) - throws java.lang.Exception - { - if (null == (_dt = dt)) throw new java.lang.Exception ("DateDiscountCurvePair ctr: Invalid Inputs"); - - _dc = dc; - _lsstrDump = lsstrDump; - } - - /** - * Retrieve the COB - * - * @return The COB - */ - - public org.drip.analytics.date.JulianDate date() - { - return _dt; - } - - /** - * Retrieve the Discount Curve - * - * @return The Discount Curve - */ - - public org.drip.state.discount.MergedDiscountForwardCurve dc() - { - return _dc; - } - - /** - * Retrieve the Output Dump - * - * @return The Output Dump - */ - - public java.util.List output() - { - return _lsstrDump; - } -} diff --git a/org/drip/service/api/DiscountCurveInputInstrument.java b/org/drip/service/api/DiscountCurveInputInstrument.java deleted file mode 100644 index 19d5a59..0000000 --- a/org/drip/service/api/DiscountCurveInputInstrument.java +++ /dev/null @@ -1,260 +0,0 @@ - -package org.drip.service.api; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * DiscountCuveInputInstrument contains the input instruments and their quotes. - * - * @author Lakshmi Krishnamurthy - */ - -public class DiscountCurveInputInstrument { - private org.drip.analytics.date.JulianDate _dt = null; - private java.util.List _lsCashQuote = null; - private java.util.List _lsCashTenor = null; - private java.util.List _lsSwapQuote = null; - private java.util.List _lsSwapTenor = null; - private java.util.List _lsFutureQuote = null; - private java.util.List _lsFutureTenor = null; - - /** - * DiscountCurveInputInstrument constructor - * - * @param dt Curve Epoch Date - * @param lsCashTenor List of Cash Tenors - * @param lsCashQuote List of Cash Quotes - * @param lsFutureTenor List of Future Tenors - * @param lsFutureQuote List of Future Quotes - * @param lsSwapTenor List of Swap Tenors - * @param lsSwapQuote List of Swap Quotes - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public DiscountCurveInputInstrument ( - final org.drip.analytics.date.JulianDate dt, - final java.util.List lsCashTenor, - final java.util.List lsCashQuote, - final java.util.List lsFutureTenor, - final java.util.List lsFutureQuote, - final java.util.List lsSwapTenor, - final java.util.List lsSwapQuote) - throws java.lang.Exception - { - if (null == (_dt = dt)) - throw new java.lang.Exception ("DiscountCurveInputInstrument ctr: Invalid Inputs"); - - int iNumCashQuote = null == (_lsCashQuote = lsCashQuote) ? 0 : _lsCashQuote.size(); - - int iNumCashTenor = null == (_lsCashTenor = lsCashTenor) ? 0 : _lsCashTenor.size(); - - int iNumFutureQuote = null == (_lsFutureQuote = lsFutureQuote) ? 0 : _lsFutureQuote.size(); - - int iNumFutureTenor = null == (_lsFutureTenor = lsFutureTenor) ? 0 : _lsFutureTenor.size(); - - int iNumSwapQuote = null == (_lsSwapQuote = lsSwapQuote) ? 0 : _lsSwapQuote.size(); - - int iNumSwapTenor = null == (_lsSwapTenor = lsSwapTenor) ? 0 : _lsSwapTenor.size(); - - if (iNumCashQuote != iNumCashTenor || iNumFutureQuote != iNumFutureTenor || iNumSwapQuote != - iNumSwapTenor || (0 == iNumCashTenor && 0 == iNumFutureTenor && 0 == iNumSwapTenor)) - throw new java.lang.Exception ("DiscountCurveInputInstrument ctr: Invalid Inputs"); - } - - /** - * Retrieve the Curve Epoch Date - * - * @return The Curve Epoch Date - */ - - public org.drip.analytics.date.JulianDate date() - { - return _dt; - } - - /** - * Retrieve the Array of Cash Quotes - * - * @return The Array of Cash Quotes - */ - - public double[] cashQuote() - { - if (null == _lsCashQuote) return null; - - int iNumQuote = _lsCashQuote.size(); - - if (0 == iNumQuote) return null; - - int i = 0; - double[] adblQuote = new double[iNumQuote]; - - for (double dblQuote : _lsCashQuote) - adblQuote[i++] = dblQuote; - - return adblQuote; - } - - /** - * Retrieve the Array of Cash Tenors - * - * @return The Array of Cash Tenors - */ - - public java.lang.String[] cashTenor() - { - if (null == _lsCashTenor) return null; - - int iNumTenor = _lsCashTenor.size(); - - if (0 == iNumTenor) return null; - - int i = 0; - java.lang.String[] astrTenor = new java.lang.String[iNumTenor]; - - for (java.lang.String strTenor : _lsCashTenor) - astrTenor[i++] = strTenor; - - return astrTenor; - } - - /** - * Retrieve the Array of Future Quotes - * - * @return The Array of Future Quotes - */ - - public double[] futureQuote() - { - if (null == _lsFutureQuote) return null; - - int iNumQuote = _lsFutureQuote.size(); - - if (0 == iNumQuote) return null; - - int i = 0; - double[] adblQuote = new double[iNumQuote]; - - for (double dblQuote : _lsFutureQuote) - adblQuote[i++] = dblQuote; - - return adblQuote; - } - - /** - * Retrieve the Array of Future Tenors - * - * @return The Array of Future Tenors - */ - - public java.lang.String[] futureTenor() - { - if (null == _lsFutureTenor) return null; - - int iNumTenor = _lsFutureTenor.size(); - - if (0 == iNumTenor) return null; - - int i = 0; - java.lang.String[] astrTenor = new java.lang.String[iNumTenor]; - - for (java.lang.String strTenor : _lsFutureTenor) - astrTenor[i++] = strTenor; - - return astrTenor; - } - - /** - * Retrieve the Array of Swap Quotes - * - * @return The Array of Swap Quotes - */ - - public double[] swapQuote() - { - if (null == _lsSwapQuote) return null; - - int iNumQuote = _lsSwapQuote.size(); - - if (0 == iNumQuote) return null; - - int i = 0; - double[] adblQuote = new double[iNumQuote]; - - for (double dblQuote : _lsSwapQuote) - adblQuote[i++] = dblQuote; - - return adblQuote; - } - - /** - * Retrieve the Array of Swap Tenors - * - * @return The Array of Swap Tenors - */ - - public java.lang.String[] swapTenor() - { - if (null == _lsSwapTenor) return null; - - int iNumTenor = _lsSwapTenor.size(); - - if (0 == iNumTenor) return null; - - int i = 0; - java.lang.String[] astrTenor = new java.lang.String[iNumTenor]; - - for (java.lang.String strTenor : _lsSwapTenor) - astrTenor[i++] = strTenor; - - return astrTenor; - } -} diff --git a/org/drip/service/api/FixFloatFundingInstrument.java b/org/drip/service/api/FixFloatFundingInstrument.java deleted file mode 100644 index 28d8cd8..0000000 --- a/org/drip/service/api/FixFloatFundingInstrument.java +++ /dev/null @@ -1,157 +0,0 @@ - -package org.drip.service.api; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * - * This file is part of DRIP, a free-software/open-source library for fixed income analysts and developers - - * http://www.credit-trader.org/Begin.html - * - * 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. - * - * 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. - */ - -/** - * FixFloatFundingInstrument contains the Fix Float Instrument Inputs for the Funding Curve Construction - * Purposes. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixFloatFundingInstrument { - private int _iLatentStateType = -1; - private double[] _adblQuote = null; - private java.lang.String _strCurrency = ""; - private java.lang.String[] _astrMaturityTenor = null; - private org.drip.state.discount.DiscountCurve _dc = null; - private org.drip.analytics.date.JulianDate _dtSpot = null; - - /** - * FixFloatFundingInstrument Constructor - * - * @param dtSpot Spot Date - * @param strCurrency Currency - * @param astrMaturityTenor Array of the Maturity Tenors - * @param adblQuote Array of Quotes - * @param iLatentStateType Latent State Type - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public FixFloatFundingInstrument ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strCurrency, - final java.lang.String[] astrMaturityTenor, - final double[] adblQuote, - final int iLatentStateType) - throws java.lang.Exception - { - if (null == (_dc = org.drip.service.template.LatentMarketStateBuilder.FundingCurve (_dtSpot = dtSpot, - _strCurrency = strCurrency, null, null, "ForwardRate", null, "ForwardRate", _astrMaturityTenor = - astrMaturityTenor, _adblQuote = adblQuote, "SwapRate", _iLatentStateType = - iLatentStateType))) - throw new java.lang.Exception ("FixFloatFundingInstrument Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Spot Date - * - * @return The Spot Date - */ - - public org.drip.analytics.date.JulianDate spotDate() - { - return _dtSpot; - } - - /** - * Retrieve the Currency - * - * @return The Currency - */ - - public java.lang.String currency() - { - return _strCurrency; - } - - /** - * Retrieve the Latent State Type - * - * @return The Latent State Type - */ - - public int latentStateType() - { - return _iLatentStateType; - } - - /** - * Retrieve the Array of the Maturity Tenors - * - * @return Array of Maturity Tenors - */ - - public java.lang.String[] maturityTenors() - { - return _astrMaturityTenor; - } - - /** - * Retrieve the Array of Quotes - * - * @return Array of Quotes - */ - - public double[] quotes() - { - return _adblQuote; - } - - /** - * Retrieve the Funding State - * - * @return The Funding State Instance - */ - - public org.drip.state.discount.DiscountCurve fundingState() - { - return _dc; - } -} diff --git a/org/drip/service/api/ForwardRates.java b/org/drip/service/api/ForwardRates.java deleted file mode 100644 index a4179c5..0000000 --- a/org/drip/service/api/ForwardRates.java +++ /dev/null @@ -1,125 +0,0 @@ - -package org.drip.service.api; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * ForwardRates contains the array of the forward rates. - * - * @author Lakshmi Krishnamurthy - */ - -public class ForwardRates { - private java.util.List _lsForward = new java.util.ArrayList(); - - /** - * Empty ForwardRates constructor - */ - - public ForwardRates() - { - } - - /** - * Add a Forward Rate to the List - * - * @param dblForward The Forward Rate to be added - * - * @return TRUE - Successfully added - */ - - public boolean addForward ( - final double dblForward) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblForward)) return false; - - _lsForward.add (dblForward); - - return true; - } - - /** - * Convert the List of Forwards to an Array - * - * @return The Array of Forwards - */ - - public double[] toArray() - { - if (0 == _lsForward.size()) return null; - - int i = 0; - - double[] adblForward = new double[_lsForward.size()]; - - for (double dbl : _lsForward) - adblForward[i++] = dbl; - - return adblForward; - } - - @Override public java.lang.String toString() - { - java.lang.StringBuffer sb = new java.lang.StringBuffer(); - - boolean bStart = true; - - for (double dbl : toArray()) { - if (bStart) - bStart = false; - else - sb.append (","); - - sb.append (dbl); - } - - return sb.toString(); - } -} diff --git a/org/drip/service/api/InstrMetric.java b/org/drip/service/api/InstrMetric.java deleted file mode 100644 index f5b3aac..0000000 --- a/org/drip/service/api/InstrMetric.java +++ /dev/null @@ -1,144 +0,0 @@ - -package org.drip.service.api; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * InstrMetric contains the fields that hold the result of the PnL metric calculations. - * - * @author Lakshmi Krishnamurthy - */ - -public class InstrMetric { - private org.drip.service.api.ForwardRates _fwdMetric = null; - private org.drip.service.api.ProductDailyPnL _pnlMetric = null; - - /** - * InstrMetric constructor - * - * @param fwdMetric The Forward Rates Metric - * @param pnlMetric The Daily Carry/Roll PnL Metric - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public InstrMetric ( - final org.drip.service.api.ForwardRates fwdMetric, - final org.drip.service.api.ProductDailyPnL pnlMetric) - throws java.lang.Exception - { - if (null == (_fwdMetric = fwdMetric) || null == (_pnlMetric = pnlMetric)) - throw new java.lang.Exception ("InstrMetric ctr: Invalid Inputs"); - } - - /** - * Retrieve the Forward Metric - * - * @return The Forward Metric - */ - - public org.drip.service.api.ForwardRates fwdMetric() - { - return _fwdMetric; - } - - /** - * Retrieve the PnL Metric - * - * @return The PnL Metric - */ - - public org.drip.service.api.ProductDailyPnL pnlMetric() - { - return _pnlMetric; - } - - /** - * Reduce the PnL/forward metrics to an array - * - * @return The Array containing the PnL/forward metrics - */ - - public double[] toArray() - { - double[] adblPnLMetric = _pnlMetric.toArray(); - - double[] adblFwdMetric = _fwdMetric.toArray(); - - int i = 0; - double[] adblInstrMetric = new double[adblFwdMetric.length + adblPnLMetric.length]; - - for (double dbl : adblPnLMetric) - adblInstrMetric[i++] = dbl; - - for (double dbl : adblFwdMetric) - adblInstrMetric[i++] = dbl; - - return adblInstrMetric; - } - - @Override public java.lang.String toString() - { - java.lang.StringBuffer sb = new java.lang.StringBuffer(); - - boolean bStart = true; - - for (double dbl : toArray()) { - if (bStart) - bStart = false; - else - sb.append (","); - - sb.append (dbl); - } - - return sb.toString(); - } -} diff --git a/org/drip/service/api/ProductDailyPnL.java b/org/drip/service/api/ProductDailyPnL.java deleted file mode 100644 index 8a3909e..0000000 --- a/org/drip/service/api/ProductDailyPnL.java +++ /dev/null @@ -1,881 +0,0 @@ - -package org.drip.service.api; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * ProductDailyPnL contains the following daily measures computed: - * - 1D Carry, Roll Down, Curve Shift, and Full Return PnL - * - 3D Carry and Roll Down PnL - * - 3M Carry and Roll Down PnL - * - Current DV01 - * - * @author Lakshmi Krishnamurthy - */ - -public class ProductDailyPnL { - private int _i1DFixedAccrualDays = 0; - private int _i1DFloatingAccrualDays = 0; - private double _dblDV01 = java.lang.Double.NaN; - private double _dbl1DCarryPnL = java.lang.Double.NaN; - private double _dbl1MCarryPnL = java.lang.Double.NaN; - private double _dbl3MCarryPnL = java.lang.Double.NaN; - private double _dbl1DFixedDCF = java.lang.Double.NaN; - private double _dbl1MFixedDCF = java.lang.Double.NaN; - private double _dbl3MFixedDCF = java.lang.Double.NaN; - private double _dbl1DCleanPnL = java.lang.Double.NaN; - private double _dbl1DDirtyPnL = java.lang.Double.NaN; - private double _dbl1DTotalPnL = java.lang.Double.NaN; - private double _dbl1DTimeRollPnL = java.lang.Double.NaN; - private double _dbl1DFloatingDCF = java.lang.Double.NaN; - private double _dbl1MFloatingDCF = java.lang.Double.NaN; - private double _dbl3MFloatingDCF = java.lang.Double.NaN; - private double _dblCleanFixedDV01 = java.lang.Double.NaN; - private double _dblCleanFloatDV01 = java.lang.Double.NaN; - private double _dblDV01WithFixing = java.lang.Double.NaN; - private double _dbl1DCurveShiftPnL = java.lang.Double.NaN; - private double _dblPeriodFixedRate = java.lang.Double.NaN; - private double _dblBaselineSwapRate = java.lang.Double.NaN; - private double _dbl1DTimeRollSwapRate = java.lang.Double.NaN; - private double _dbl1DCleanPnLWithFixing = java.lang.Double.NaN; - private double _dbl1DDirtyPnLWithFixing = java.lang.Double.NaN; - private double _dbl1DTotalPnLWithFixing = java.lang.Double.NaN; - private double _dbl1DCurveShiftSwapRate = java.lang.Double.NaN; - private double _dblPeriodFloatingRateUsed = java.lang.Double.NaN; - private double _dblPeriodCurveFloatingRate = java.lang.Double.NaN; - private double _dbl1DMaturityRollUpSwapRate = java.lang.Double.NaN; - private double _dblCleanFloatDV01WithFixing = java.lang.Double.NaN; - private double _dblPeriodProductFloatingRate = java.lang.Double.NaN; - private double _dbl1DMaturityRollDownSwapRate = java.lang.Double.NaN; - private double _dbl1MMaturityRollDownSwapRate = java.lang.Double.NaN; - private double _dbl3MMaturityRollDownSwapRate = java.lang.Double.NaN; - private double _dbl1DMaturityRollUpSwapRatePnL = java.lang.Double.NaN; - private double _dbl1DMaturityRollUpFairPremium = java.lang.Double.NaN; - private double _dbl1DMaturityRollDownSwapRatePnL = java.lang.Double.NaN; - private double _dbl1MMaturityRollDownSwapRatePnL = java.lang.Double.NaN; - private double _dbl3MMaturityRollDownSwapRatePnL = java.lang.Double.NaN; - private double _dbl1DMaturityRollUpFairPremiumPnL = java.lang.Double.NaN; - private double _dbl1DMaturityRollUpFairPremiumWithFixing = java.lang.Double.NaN; - private double _dbl1DMaturityRollUpFairPremiumWithFixingPnL = java.lang.Double.NaN; - - /** - * ProductDailyPnL constructor - * - * @param dbl1DTotalPnL 1D Total PnL - * @param dbl1DCleanPnL 1D Clean PnL - * @param dbl1DDirtyPnL 1D Dirty PnL - * @param dbl1DTotalPnLWithFixing 1D Total PnL With Fixing - * @param dbl1DCleanPnLWithFixing 1D Clean PnL With Fixing - * @param dbl1DDirtyPnLWithFixing 1D Dirty PnL With Fixing - * @param dbl1DCarryPnL 1D Carry PnL - * @param dbl1DTimeRollPnL 1D Time Roll PnL - * @param dbl1DMaturityRollDownSwapRatePnL 1D Curve Maturity Roll Down implied Par Swap rate PnL - * @param dbl1DMaturityRollUpSwapRatePnL 1D Curve Maturity Roll Up implied Par Swap rate PnL - * @param dbl1DMaturityRollUpFairPremiumPnL 1D Curve Maturity Roll Up implied Fair Premium PnL - * @param dbl1DMaturityRollUpFairPremiumWithFixingPnL 1D Curve Maturity Roll Up implied Fair Premium With - * Fixing PnL - * @param dbl1DCurveShiftPnL 1D Curve Shift PnL - * @param dbl1MCarryPnL 1M Carry PnL - * @param dbl1MMaturityRollDownSwapRatePnL 1M Curve Maturity Roll Down implied Par Swap rate PnL - * @param dbl3MCarryPnL 3M Carry PnL - * @param dbl3MMaturityRollDownSwapRatePnL 3M Curve Maturity Roll Down implied Par Swap rate PnL - * @param dblDV01 DV01 - * @param dblDV01WithFixing DV01 With Fixing - * @param dblCleanFixedDV01 Clean Fixed DV01 - * @param dblCleanFloatDV01 Clean Float DV01 - * @param dblCleanFloatDV01WithFixing Clean Float DV01 With Fixing - * @param dblBaselineSwapRate Baseline Par Swap Rate - * @param dbl1DTimeRollSwapRate 1D Curve Time Roll implied Par Swap rate - * @param dbl1DMaturityRollDownSwapRate 1D Curve Maturity Roll Down Implied Par Swap rate - * @param dbl1MMaturityRollDownSwapRate 1M Curve Maturity Roll Down implied Par Swap rate - * @param dbl3MMaturityRollDownSwapRate 3M Curve Maturity Roll Down implied Par Swap rate - * @param dbl1DMaturityRollUpSwapRate 1D Curve Maturity Roll Up Implied Par Swap rate - * @param dbl1DMaturityRollUpFairPremium 1D Curve Maturity Roll Up Implied Fair Premium - * @param dbl1DMaturityRollUpFairPremiumWithFixing 1D Curve Maturity Roll Up Implied Fair Premium With - * Fixing - * @param dbl1DCurveShiftSwapRate 1D Day-to-Day Curve Shift implied Par Swap rate - * @param dblPeriodFixedRate The Period Fixed Rate - * @param dblPeriodCurveFloatingRate The Period Curve Floating Rate - * @param dblPeriodProductFloatingRate The Period Product Floating Rate - * @param dblPeriodFloatingRateUsed The Period Floating Rate Used - * @param i1DFixedAccrualDays 1D Fixed Accrual Days - * @param i1DFloatingAccrualDays 1D Floating Accrual Days - * @param dbl1DFixedDCF 1D Fixed Coupon DCF - * @param dbl1DFloatingDCF 1D Floating Coupon DCF - * @param dbl1MFixedDCF 1M Fixed Coupon DCF - * @param dbl1MFloatingDCF 1M Floating Coupon DCF - * @param dbl3MFixedDCF 3M Fixed Coupon DCF - * @param dbl3MFloatingDCF 3M Floating Coupon DCF - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public ProductDailyPnL ( - final double dbl1DTotalPnL, - final double dbl1DCleanPnL, - final double dbl1DDirtyPnL, - final double dbl1DTotalPnLWithFixing, - final double dbl1DCleanPnLWithFixing, - final double dbl1DDirtyPnLWithFixing, - final double dbl1DCarryPnL, - final double dbl1DTimeRollPnL, - final double dbl1DMaturityRollDownSwapRatePnL, - final double dbl1DMaturityRollUpSwapRatePnL, - final double dbl1DMaturityRollUpFairPremiumPnL, - final double dbl1DMaturityRollUpFairPremiumWithFixingPnL, - final double dbl1DCurveShiftPnL, - final double dbl1MCarryPnL, - final double dbl1MMaturityRollDownSwapRatePnL, - final double dbl3MCarryPnL, - final double dbl3MMaturityRollDownSwapRatePnL, - final double dblDV01, - final double dblDV01WithFixing, - final double dblCleanFixedDV01, - final double dblCleanFloatDV01, - final double dblCleanFloatDV01WithFixing, - final double dblBaselineSwapRate, - final double dbl1DTimeRollSwapRate, - final double dbl1DMaturityRollDownSwapRate, - final double dbl1MMaturityRollDownSwapRate, - final double dbl3MMaturityRollDownSwapRate, - final double dbl1DMaturityRollUpSwapRate, - final double dbl1DMaturityRollUpFairPremium, - final double dbl1DMaturityRollUpFairPremiumWithFixing, - final double dbl1DCurveShiftSwapRate, - final double dblPeriodFixedRate, - final double dblPeriodCurveFloatingRate, - final double dblPeriodProductFloatingRate, - final double dblPeriodFloatingRateUsed, - final int i1DFixedAccrualDays, - final int i1DFloatingAccrualDays, - final double dbl1DFixedDCF, - final double dbl1DFloatingDCF, - final double dbl1MFixedDCF, - final double dbl1MFloatingDCF, - final double dbl3MFixedDCF, - final double dbl3MFloatingDCF) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dbl1DTotalPnL = dbl1DTotalPnL) || - !org.drip.quant.common.NumberUtil.IsValid (_dbl1DCleanPnL = dbl1DCleanPnL) || - !org.drip.quant.common.NumberUtil.IsValid (_dbl1DDirtyPnL = dbl1DDirtyPnL) || - !org.drip.quant.common.NumberUtil.IsValid (_dbl1DTotalPnLWithFixing = - dbl1DTotalPnLWithFixing) || !org.drip.quant.common.NumberUtil.IsValid - (_dbl1DCleanPnLWithFixing = dbl1DCleanPnLWithFixing) || - !org.drip.quant.common.NumberUtil.IsValid (_dbl1DDirtyPnLWithFixing = - dbl1DDirtyPnLWithFixing) || !org.drip.quant.common.NumberUtil.IsValid - (_dbl1DCarryPnL = dbl1DCarryPnL) || - !org.drip.quant.common.NumberUtil.IsValid (_dbl1DTimeRollPnL = - dbl1DTimeRollPnL) || - !org.drip.quant.common.NumberUtil.IsValid - (_dbl1DMaturityRollDownSwapRatePnL = - dbl1DMaturityRollDownSwapRatePnL) || - !org.drip.quant.common.NumberUtil.IsValid - (_dbl1DMaturityRollUpSwapRatePnL = - dbl1DMaturityRollUpSwapRatePnL) || - !org.drip.quant.common.NumberUtil.IsValid (_dbl1DMaturityRollUpFairPremiumPnL = - dbl1DMaturityRollUpFairPremiumPnL) || !org.drip.quant.common.NumberUtil.IsValid - (_dbl1DMaturityRollUpFairPremiumWithFixingPnL = - dbl1DMaturityRollUpFairPremiumWithFixingPnL) || - !org.drip.quant.common.NumberUtil.IsValid (_dbl1DCurveShiftPnL = - dbl1DCurveShiftPnL) || !org.drip.quant.common.NumberUtil.IsValid - (_dbl1MCarryPnL = dbl1MCarryPnL) || - !org.drip.quant.common.NumberUtil.IsValid - (_dbl1MMaturityRollDownSwapRatePnL = - dbl1MMaturityRollDownSwapRatePnL) || - !org.drip.quant.common.NumberUtil.IsValid (_dbl3MCarryPnL - = dbl3MCarryPnL) || - !org.drip.quant.common.NumberUtil.IsValid - (_dbl3MMaturityRollDownSwapRatePnL = - dbl3MMaturityRollDownSwapRatePnL) || - !org.drip.quant.common.NumberUtil.IsValid - (_dblDV01 = dblDV01) || !org.drip.quant.common.NumberUtil.IsValid (_dblDV01WithFixing = - dblDV01WithFixing) || !org.drip.quant.common.NumberUtil.IsValid (_dblCleanFixedDV01 = - dblCleanFixedDV01) || !org.drip.quant.common.NumberUtil.IsValid (_dblCleanFloatDV01 = - dblCleanFloatDV01) || !org.drip.quant.common.NumberUtil.IsValid - (_dblCleanFloatDV01WithFixing = dblCleanFloatDV01WithFixing) || - !org.drip.quant.common.NumberUtil.IsValid (_dblBaselineSwapRate = - dblBaselineSwapRate) || !org.drip.quant.common.NumberUtil.IsValid - (_dbl1DTimeRollSwapRate = dbl1DTimeRollSwapRate) || - !org.drip.quant.common.NumberUtil.IsValid - (_dbl1DMaturityRollDownSwapRate = - dbl1DMaturityRollDownSwapRate) || - !org.drip.quant.common.NumberUtil.IsValid - (_dbl1MMaturityRollDownSwapRate = - dbl1MMaturityRollDownSwapRate) || - !org.drip.quant.common.NumberUtil.IsValid - (_dbl3MMaturityRollDownSwapRate = - dbl3MMaturityRollDownSwapRate) || - !org.drip.quant.common.NumberUtil.IsValid (_dbl1DMaturityRollUpSwapRate = - dbl1DMaturityRollUpSwapRate) || !org.drip.quant.common.NumberUtil.IsValid - (_dbl1DMaturityRollUpFairPremium = dbl1DMaturityRollUpFairPremium) || - !org.drip.quant.common.NumberUtil.IsValid (_dbl1DMaturityRollUpFairPremiumWithFixing - = dbl1DMaturityRollUpFairPremiumWithFixing) || - !org.drip.quant.common.NumberUtil.IsValid (_dbl1DCurveShiftSwapRate = - dbl1DCurveShiftSwapRate) || !org.drip.quant.common.NumberUtil.IsValid - (_dblPeriodFixedRate = dblPeriodFixedRate) || - !org.drip.quant.common.NumberUtil.IsValid - (_dblPeriodCurveFloatingRate = dblPeriodCurveFloatingRate) || - !org.drip.quant.common.NumberUtil.IsValid - (_dblPeriodProductFloatingRate = - dblPeriodProductFloatingRate) || - !org.drip.quant.common.NumberUtil.IsValid - (_dblPeriodFloatingRateUsed = - dblPeriodFloatingRateUsed) || - !org.drip.quant.common.NumberUtil.IsValid - (_dbl1DFixedDCF = dbl1DFixedDCF) || !org.drip.quant.common.NumberUtil.IsValid (_dbl1DFloatingDCF - = dbl1DFloatingDCF) || !org.drip.quant.common.NumberUtil.IsValid (_dbl1MFixedDCF = - dbl1MFixedDCF) || !org.drip.quant.common.NumberUtil.IsValid (_dbl1MFloatingDCF = - dbl1MFloatingDCF) || !org.drip.quant.common.NumberUtil.IsValid (_dbl3MFixedDCF = - dbl3MFixedDCF) || !org.drip.quant.common.NumberUtil.IsValid (_dbl3MFloatingDCF = - dbl3MFloatingDCF)) - throw new java.lang.Exception ("ProductDailyPnL ctr: Invalid Inputs!"); - - _i1DFixedAccrualDays = i1DFixedAccrualDays; - _i1DFloatingAccrualDays = i1DFloatingAccrualDays; - } - - /** - * Retrieve the 1D Clean PnL - * - * @return The 1D Clean PnL - */ - - public double clean1DPnL() - { - return _dbl1DCleanPnL; - } - - /** - * Retrieve the 1D Dirty PnL - * - * @return The 1D Dirty PnL - */ - - public double dirty1DPnL() - { - return _dbl1DDirtyPnL; - } - - /** - * Retrieve the 1D Total PnL - * - * @return The 1D Total PnL - */ - - public double total1DPnL() - { - return _dbl1DTotalPnL; - } - - /** - * Retrieve the 1D Clean PnL With Fixing - * - * @return The 1D Clean PnL With Fixing - */ - - public double clean1DPnLWithFixing() - { - return _dbl1DCleanPnLWithFixing; - } - - /** - * Retrieve the 1D Dirty PnL With Fixing - * - * @return The 1D Dirty PnL With Fixing - */ - - public double dirty1DPnLWithFixing() - { - return _dbl1DDirtyPnLWithFixing; - } - - /** - * Retrieve the 1D Total PnL With Fixing - * - * @return The 1D Total PnL With Fixing - */ - - public double total1DPnLWithFixing() - { - return _dbl1DTotalPnLWithFixing; - } - - /** - * Retrieve the 1D Carry PnL - * - * @return The 1D Carry PnL - */ - - public double carry1DPnL() - { - return _dbl1DCarryPnL; - } - - /** - * Retrieve the 1D Time Roll PnL - * - * @return The 1D Time Roll PnL - */ - - public double timeRoll1DPnL() - { - return _dbl1DTimeRollPnL; - } - - /** - * Retrieve the 1D Maturity Roll Down Swap Rate PnL - * - * @return The 1D Maturity Roll Down Swap Rate PnL - */ - - public double maturityRollDownSwapRate1DPnL() - { - return _dbl1DMaturityRollDownSwapRatePnL; - } - - /** - * Retrieve the 1D Maturity Roll Up Swap Rate PnL - * - * @return The 1D Maturity Roll Up Swap Rate PnL - */ - - public double maturityRollUpSwapRate1DPnL() - { - return _dbl1DMaturityRollUpSwapRatePnL; - } - - /** - * Retrieve the 1D Maturity Roll Up Fair Premium PnL - * - * @return The 1D Maturity Roll Up Fair Premium PnL - */ - - public double maturityRollUpFairPremium1DPnL() - { - return _dbl1DMaturityRollUpFairPremiumPnL; - } - - /** - * Retrieve the 1D Maturity Roll Up Fair Premium With Fixing PnL - * - * @return The 1D Maturity Roll Up Fair Premium With Fixing PnL - */ - - public double maturityRollUpFairPremiumWithFixing1DPnL() - { - return _dbl1DMaturityRollUpFairPremiumWithFixingPnL; - } - - /** - * Retrieve the 1D Curve Shift PnL - * - * @return The 1D Curve Shift PnL - */ - - public double curveShift1DPnL() - { - return _dbl1DCurveShiftPnL; - } - - /** - * Retrieve the 1M Carry PnL - * - * @return The 1M Carry PnL - */ - - public double carry1MPnL() - { - return _dbl1MCarryPnL; - } - - /** - * Retrieve the 1M Maturity Roll Down Swap Rate PnL - * - * @return The 1M Maturity Roll Down Swap Rate PnL - */ - - public double maturityRollDownSwapRate1MPnL() - { - return _dbl1MMaturityRollDownSwapRatePnL; - } - - /** - * Retrieve the 3M Carry PnL - * - * @return The 3M Carry PnL - */ - - public double carry3MPnL() - { - return _dbl3MCarryPnL; - } - - /** - * Retrieve the 3M Maturity Roll Down Swap Rate PnL - * - * @return The 3M Maturity Roll Down Swap Rate PnL - */ - - public double maturityRollDownSwapRate3MPnL() - { - return _dbl3MMaturityRollDownSwapRatePnL; - } - - /** - * Retrieve the DV01 - * - * @return The DV01 - */ - - public double DV01() - { - return _dblDV01; - } - - /** - * Retrieve the DV01 With Fixing - * - * @return The DV01 With Fixing - */ - - public double DV01WithFixing() - { - return _dblDV01WithFixing; - } - - /** - * Retrieve the Clean Fixed DV01 - * - * @return The Clean Fixed DV01 - */ - - public double cleanFixedDV01() - { - return _dblCleanFixedDV01; - } - - /** - * Retrieve the Clean Float DV01 - * - * @return The Clean Float DV01 - */ - - public double cleanFloatDV01() - { - return _dblCleanFloatDV01; - } - - /** - * Retrieve the Clean Float DV01 With Fixing - * - * @return The Clean Float DV01 With Fixing - */ - - public double cleanFloatDV01WithFixing() - { - return _dblCleanFloatDV01WithFixing; - } - - /** - * Retrieve the Baseline Swap Rate - * - * @return The Baseline Swap Rate - */ - - public double baselineSwapRate() - { - return _dblBaselineSwapRate; - } - - /** - * Retrieve the 1D Time Roll Swap Rate - * - * @return The 1D Time Roll Swap Rate - */ - - public double timeRollSwapRate1D() - { - return _dbl1DTimeRollSwapRate; - } - - /** - * Retrieve the 1D Maturity Roll Down Swap Rate - * - * @return The 1D Maturity Roll Down Swap Rate - */ - - public double maturityRollDownSwapRate1D() - { - return _dbl1DMaturityRollDownSwapRate; - } - - /** - * Retrieve the 1M Maturity Roll Down Swap Rate - * - * @return The 1M Maturity Roll Down Swap Rate - */ - - public double maturityRollDownSwapRate1M() - { - return _dbl1MMaturityRollDownSwapRate; - } - - /** - * Retrieve the 3M Maturity Roll Down Swap Rate - * - * @return The 3M Maturity Roll Down Swap Rate - */ - - public double maturityRollDownSwapRate3M() - { - return _dbl3MMaturityRollDownSwapRate; - } - - /** - * Retrieve the 1D Maturity Roll Up Swap Rate - * - * @return The 1D Maturity Roll Up Swap Rate - */ - - public double maturityRollUpSwapRate1D() - { - return _dbl1DMaturityRollUpSwapRate; - } - - /** - * Retrieve the 1D Maturity Roll Up Fair Premium - * - * @return The 1D Maturity Roll Up Fair Premium - */ - - public double maturityRollUpFairPremium1D() - { - return _dbl1DMaturityRollUpFairPremium; - } - - /** - * Retrieve the 1D Maturity Roll Up Fair Premium With Fixing - * - * @return The 1D Maturity Roll Up Fair Premium With Fixing - */ - - public double maturityRollUpFairPremiumWithFixing1D() - { - return _dbl1DMaturityRollUpFairPremiumWithFixing; - } - - /** - * Retrieve the 1D Curve Shift Swap Rate - * - * @return The 1D Curve Shift Swap Rate - */ - - public double curveShiftSwapRate1D() - { - return _dbl1DCurveShiftSwapRate; - } - - /** - * Retrieve the Period Fixed Rate - * - * @return The Period Fixed Rate - */ - - public double periodFixedRate() - { - return _dblPeriodFixedRate; - } - - /** - * Retrieve the Period Curve Floating Rate - * - * @return The Period Curve Floating Rate - */ - - public double periodCurveFloatingRate() - { - return _dblPeriodCurveFloatingRate; - } - - /** - * Retrieve the Period Product Floating Rate - * - * @return The Period Product Floating Rate - */ - - public double periodProductFloatingRate() - { - return _dblPeriodProductFloatingRate; - } - - /** - * Retrieve the Period Floating Rate Used - * - * @return The Period Floating Rate Used - */ - - public double periodFloatingRateUsed() - { - return _dblPeriodFloatingRateUsed; - } - - /** - * Retrieve the 1D Fixed Accrual Period - * - * @return The 1D Fixed Accrual Period - */ - - public int fixed1DAccrualDays() - { - return _i1DFixedAccrualDays; - } - - /** - * Retrieve the 1D Floating Accrual Period - * - * @return The 1D Floating Accrual Period - */ - - public int floating1DAccrualDays() - { - return _i1DFloatingAccrualDays; - } - - /** - * Retrieve the Period 1D Fixed DCF - * - * @return The Period 1D Fixed DCF - */ - - public double fixed1DDCF() - { - return _dbl1DFixedDCF; - } - - /** - * Retrieve the Period 1D Floating DCF - * - * @return The Period 1D Floating DCF - */ - - public double floating1DDCF() - { - return _dbl1DFloatingDCF; - } - - /** - * Retrieve the Period 1M Fixed DCF - * - * @return The Period 1M Fixed DCF - */ - - public double fixed1MDCF() - { - return _dbl1MFixedDCF; - } - - /** - * Retrieve the Period 1M Floating DCF - * - * @return The Period 1M Floating DCF - */ - - public double floating1MDCF() - { - return _dbl1MFloatingDCF; - } - - /** - * Retrieve the Period 3M Fixed DCF - * - * @return The Period 3M Fixed DCF - */ - - public double fixed3MDCF() - { - return _dbl3MFixedDCF; - } - - /** - * Retrieve the Period 3M Floating DCF - * - * @return The Period 3M Floating DCF - */ - - public double floating3MDCF() - { - return _dbl3MFloatingDCF; - } - - /** - * Retrieve the Array of Metrics - * - * @return The Array of Metrics - */ - - public double[] toArray() - { - java.util.List lsPnLMetric = new java.util.ArrayList(); - - lsPnLMetric.add (_dbl1DTotalPnL); - - lsPnLMetric.add (_dbl1DCleanPnL); - - lsPnLMetric.add (_dbl1DDirtyPnL); - - lsPnLMetric.add (_dbl1DTotalPnLWithFixing); - - lsPnLMetric.add (_dbl1DCleanPnLWithFixing); - - lsPnLMetric.add (_dbl1DDirtyPnLWithFixing); - - lsPnLMetric.add (_dbl1DCarryPnL); - - lsPnLMetric.add (_dbl1DTimeRollPnL); - - lsPnLMetric.add (_dbl1DMaturityRollDownSwapRatePnL); - - lsPnLMetric.add (_dbl1DMaturityRollUpSwapRatePnL); - - lsPnLMetric.add (_dbl1DMaturityRollUpFairPremiumPnL); - - lsPnLMetric.add (_dbl1DMaturityRollUpFairPremiumWithFixingPnL); - - lsPnLMetric.add (_dbl1DCurveShiftPnL); - - lsPnLMetric.add (_dbl1MCarryPnL); - - lsPnLMetric.add (_dbl1MMaturityRollDownSwapRatePnL); - - lsPnLMetric.add (_dbl3MCarryPnL); - - lsPnLMetric.add (_dbl3MMaturityRollDownSwapRatePnL); - - lsPnLMetric.add (_dblDV01); - - lsPnLMetric.add (_dblDV01WithFixing); - - lsPnLMetric.add (_dblCleanFixedDV01); - - lsPnLMetric.add (_dblCleanFloatDV01); - - lsPnLMetric.add (_dblCleanFloatDV01WithFixing); - - lsPnLMetric.add (_dblBaselineSwapRate); - - lsPnLMetric.add (_dbl1DTimeRollSwapRate); - - lsPnLMetric.add (_dbl1DMaturityRollDownSwapRate); - - lsPnLMetric.add (_dbl1MMaturityRollDownSwapRate); - - lsPnLMetric.add (_dbl3MMaturityRollDownSwapRate); - - lsPnLMetric.add (_dbl1DMaturityRollUpSwapRate); - - lsPnLMetric.add (_dbl1DMaturityRollUpFairPremium); - - lsPnLMetric.add (_dbl1DMaturityRollUpFairPremiumWithFixing); - - lsPnLMetric.add (_dbl1DCurveShiftSwapRate); - - lsPnLMetric.add (_dblPeriodFixedRate); - - lsPnLMetric.add (_dblPeriodCurveFloatingRate); - - lsPnLMetric.add (_dblPeriodProductFloatingRate); - - lsPnLMetric.add (_dblPeriodFloatingRateUsed); - - lsPnLMetric.add ((double) _i1DFixedAccrualDays); - - lsPnLMetric.add ((double) _i1DFloatingAccrualDays); - - lsPnLMetric.add (_dbl1DFixedDCF); - - lsPnLMetric.add (_dbl1DFloatingDCF); - - lsPnLMetric.add (_dbl1MFixedDCF); - - lsPnLMetric.add (_dbl1MFloatingDCF); - - lsPnLMetric.add (_dbl3MFixedDCF); - - lsPnLMetric.add (_dbl3MFloatingDCF); - - int i = 0; - - double[] adblSPCA = new double[lsPnLMetric.size()]; - - for (double dbl : lsPnLMetric) - adblSPCA[i++] = dbl; - - return adblSPCA; - } - - @Override public java.lang.String toString() - { - java.lang.StringBuffer sb = new java.lang.StringBuffer(); - - boolean bStart = true; - - for (double dbl : toArray()) { - if (bStart) - bStart = false; - else - sb.append (","); - - sb.append (dbl); - } - - return sb.toString(); - } -} diff --git a/org/drip/service/engine/ComputeClient.java b/org/drip/service/engine/ComputeClient.java deleted file mode 100644 index e0c5e3b..0000000 --- a/org/drip/service/engine/ComputeClient.java +++ /dev/null @@ -1,270 +0,0 @@ - -package org.drip.service.engine; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ComputeClient contains the Functionality behind the DRIP API Compute Service Client. - * - * @author Lakshmi Krishnamurthy - */ - -public class ComputeClient { - private int _iComputeServerPort = -1; - private java.lang.String _strComputeServerHost = ""; - private java.net.Socket _socketComputeServer = null; - - /** - * Construct Standard LocalHost-based Instance of the ComputeClient - * - * @return The Standard LocalHost-based Instance of the ComputeClient - */ - - public static final ComputeClient Standard() - { - try { - ComputeClient cc = new ComputeClient ("127.0.0.1", - org.drip.service.engine.ComputeServer.DRIP_COMPUTE_ENGINE_PORT); - - return cc.initialize() ? cc : null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * ComputeClient Constructor - * - * @param strComputeServerHost The Compute Server Host - * @param iComputeServerPort The Compute Server Port - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ComputeClient ( - final java.lang.String strComputeServerHost, - final int iComputeServerPort) - throws java.lang.Exception - { - if (null == (_strComputeServerHost = strComputeServerHost) || 0 >= (_iComputeServerPort = - iComputeServerPort)) - throw new java.lang.Exception ("ComputeClient Constructor => Invalid Inputs!"); - } - - /** - * Retrieve the Compute Server Host - * - * @return The Compute Server Host - */ - - public java.lang.String computeServerHost() - { - return _strComputeServerHost; - } - - /** - * Retrieve the Compute Server Port - * - * @return The Compute Server Port - */ - - public int computeServerPort() - { - return _iComputeServerPort; - } - - /** - * Establish a Connection to the Compute Server Engine - * - * @return TRUE - Connection to the Compute Server Engine Established - */ - - public boolean initialize() - { - try { - _socketComputeServer = new java.net.Socket (_strComputeServerHost, _iComputeServerPort); - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - /** - * Invoke a Request on the Compute Server and Retrieve the Response - * - * @param jsonRequest The Input JSON Request - * - * @return The Processed JSON Response - */ - - public org.drip.json.simple.JSONObject invoke ( - final org.drip.json.simple.JSONObject jsonRequest) - { - if (!org.drip.service.engine.RequestResponseDecorator.AffixRequestHeaders (jsonRequest)) return null; - - try { - java.io.PrintWriter pw = new java.io.PrintWriter (_socketComputeServer.getOutputStream(), true); - - pw.write (jsonRequest.toJSONString() + "\n"); - - pw.flush(); - - java.lang.Object objResponse = org.drip.json.simple.JSONValue.parse (new java.io.BufferedReader - (new java.io.InputStreamReader (_socketComputeServer.getInputStream())).readLine()); - - return null == objResponse || !(objResponse instanceof org.drip.json.simple.JSONObject) ? null : - (org.drip.json.simple.JSONObject) objResponse; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @SuppressWarnings ("unchecked") public static final void main ( - final java.lang.String[] astrArgs) - throws java.lang.Exception - { - org.drip.service.env.EnvManager.InitEnv (""); - - String[] astrAssetName = new String[] { - "TOK", - "EWJ", - "HYG", - "LQD", - "EMD", - "GSG", - "BWX" - }; - - double[] adblAssetExpectedReturns = new double[] { - 0.008355, - 0.007207, - 0.006279, - 0.002466, - 0.004472, - 0.006821, - 0.001570 - }; - - double[][] aadblAssetReturnsCovariance = new double[][] { - {0.002733, 0.002083, 0.001593, 0.000488, 0.001172, 0.002312, 0.000710}, - {0.002083, 0.002768, 0.001302, 0.000457, 0.001105, 0.001647, 0.000563}, - {0.001593, 0.001302, 0.001463, 0.000639, 0.001050, 0.001110, 0.000519}, - {0.000488, 0.000457, 0.000639, 0.000608, 0.000663, 0.000042, 0.000370}, - {0.001172, 0.001105, 0.001050, 0.000663, 0.001389, 0.000825, 0.000661}, - {0.002312, 0.001647, 0.001110, 0.000042, 0.000825, 0.005211, 0.000749}, - {0.000710, 0.000563, 0.000519, 0.000370, 0.000661, 0.000749, 0.000703} - }; - - double[] adblAssetLowerBound = new double[] { - 0.05, - 0.05, - 0.05, - 0.10, - 0.05, - 0.05, - 0.03 - }; - - double[] adblAssetUpperBound = new double[] { - 0.40, - 0.40, - 0.30, - 0.60, - 0.35, - 0.15, - 0.50 - }; - - double[][] aadblBound = new double[adblAssetExpectedReturns.length][2]; - - for (int i = 0; i < adblAssetExpectedReturns.length; ++i) { - aadblBound[i][0] = adblAssetLowerBound[i]; - aadblBound[i][1] = adblAssetUpperBound[i]; - } - - org.drip.json.simple.JSONObject jsonParameters = new org.drip.json.simple.JSONObject(); - - jsonParameters.put ("AssetSet", org.drip.json.parser.Converter.Array (astrAssetName)); - - jsonParameters.put ("AssetExpectedReturns", org.drip.json.parser.Converter.Array - (adblAssetExpectedReturns)); - - jsonParameters.put ("AssetReturnsCovariance", org.drip.json.parser.Converter.Array - (aadblAssetReturnsCovariance)); - - for (int i = 0; i < adblAssetExpectedReturns.length; ++i) { - jsonParameters.put (astrAssetName[i] + "::LowerBound", aadblBound[i][0]); - - jsonParameters.put (astrAssetName[i] + "::UpperBound", aadblBound[i][1]); - } - - org.drip.json.simple.JSONObject jsonRequest = new org.drip.json.simple.JSONObject(); - - jsonRequest.put ("API", "PORTFOLIOALLOCATION::BUDGETCONSTRAINEDMEANVARIANCE"); - - jsonRequest.put ("Parameters", jsonParameters); - - System.out.println ("\n\t|---------------- JSON REQUEST -----------------|\n"); - - System.out.println (jsonRequest.toJSONString()); - - ComputeClient cc = Standard(); - - org.drip.json.simple.JSONObject jsonResponse = cc.invoke (jsonRequest); - - System.out.println ("\n\t|---------------- JSON RESPONSE ----------------|\n"); - - System.out.println (jsonResponse.toJSONString()); - } -} diff --git a/org/drip/service/engine/ComputeServer.java b/org/drip/service/engine/ComputeServer.java deleted file mode 100644 index 55b15a0..0000000 --- a/org/drip/service/engine/ComputeServer.java +++ /dev/null @@ -1,183 +0,0 @@ - -package org.drip.service.engine; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ComputeServer contains the Functionality behind the DRIP API Compute Service Engine. - * - * @author Lakshmi Krishnamurthy - */ - -public class ComputeServer { - - /** - * The DRIP compute Service Engine Port - */ - - public static final int DRIP_COMPUTE_ENGINE_PORT = 9090; - - private int _iListenerPort = -1; - private java.net.ServerSocket _socketListener = null; - - /** - * Create a Standard Instance of the ComputeServer - * - * @return The Standard ComputeServer Instance - */ - - public static final ComputeServer Standard() - { - try { - ComputeServer cs = new ComputeServer (DRIP_COMPUTE_ENGINE_PORT); - - return cs.initialize() ? cs : null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * ComputServer Constructor - * - * @param iListenerPort The Listener Port - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ComputeServer ( - final int iListenerPort) - throws java.lang.Exception - { - if (0 >= (_iListenerPort = iListenerPort)) - throw new java.lang.Exception ("ComputeServer Constructor => Invalid Inputs"); - } - - /** - * Initialize the Compute Server Engine Listener Setup - * - * @return TRUE - The Compute Server Engine Listener Setup - */ - - public boolean initialize() - { - try { - _socketListener = new java.net.ServerSocket (_iListenerPort); - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - /** - * Spin on the Listener Loop - * - * @return FALSE - Spinning Terminated - */ - - public boolean spin() - { - while (true) { - try { - java.net.Socket s = _socketListener.accept(); - - if (null == s) return false; - - java.lang.String strJSONRequest = new java.io.BufferedReader (new java.io.InputStreamReader - (s.getInputStream())).readLine(); - - System.out.println (strJSONRequest); - - java.lang.Object objRequest = org.drip.json.simple.JSONValue.parse (strJSONRequest); - - if (null == objRequest || !(objRequest instanceof org.drip.json.simple.JSONObject)) - return false; - - org.drip.json.simple.JSONObject jsonRequest = (org.drip.json.simple.JSONObject) objRequest; - - java.lang.Object objResponse = org.drip.json.simple.JSONValue.parse - (org.drip.service.json.KeyHoleSkeleton.Thunker (strJSONRequest)); - - if (null == objResponse) return false; - - org.drip.json.simple.JSONObject jsonResponse = (org.drip.json.simple.JSONObject) objResponse; - - if (!org.drip.service.engine.RequestResponseDecorator.AffixResponseHeaders (jsonResponse, - jsonRequest)) - return false; - - System.out.println ("\n\n" + jsonResponse.toJSONString()); - - java.io.PrintWriter pw = new java.io.PrintWriter (s.getOutputStream(), true); - - pw.write (jsonResponse.toJSONString() + "\n"); - - pw.flush(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - } - - public static final void main ( - final java.lang.String[] astrArgs) - throws java.lang.Exception - { - org.drip.service.env.EnvManager.InitEnv (""); - - ComputeServer cs = ComputeServer.Standard(); - - cs.spin(); - } -} diff --git a/org/drip/service/engine/RequestResponseDecorator.java b/org/drip/service/engine/RequestResponseDecorator.java deleted file mode 100644 index d400593..0000000 --- a/org/drip/service/engine/RequestResponseDecorator.java +++ /dev/null @@ -1,110 +0,0 @@ - -package org.drip.service.engine; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * RequestResponseDecorator contains the Functionality behind the DRIP API Compute Service Engine Request and - * Response Header Fields Affixing/Decoration. - * - * @author Lakshmi Krishnamurthy - */ - -public class RequestResponseDecorator { - - /** - * Affix the Headers on the JSON Request - * - * @param jsonRequest The JSON Request - * - * @return TRUE - The Headers successfully affixed - */ - - @SuppressWarnings ("unchecked") public static final boolean AffixRequestHeaders ( - final org.drip.json.simple.JSONObject jsonRequest) - { - if (null == jsonRequest) return false; - - jsonRequest.put ("APITYPE", "REQUEST"); - - jsonRequest.put ("REQUESTTIMESTAMP", new java.util.Date().toString()); - - jsonRequest.put ("REQUESTID", org.drip.quant.common.StringUtil.GUID()); - - return true; - } - - /** - * Affix the Headers on the JSON Response - * - * @param jsonResponse The JSON Response - * @param jsonRequest The JSON Request - * - * @return TRUE - The Headers successfully affixed - */ - - @SuppressWarnings ("unchecked") public static final boolean AffixResponseHeaders ( - final org.drip.json.simple.JSONObject jsonResponse, - final org.drip.json.simple.JSONObject jsonRequest) - { - if (null == jsonResponse || null == jsonRequest) return false; - - jsonResponse.put ("APITYPE", "RESPONSE"); - - jsonResponse.put ("REQUESTTIMESTAMP", org.drip.json.parser.Converter.StringEntry - (jsonRequest, "REQUESTTIMESTAMP")); - - jsonResponse.put ("REQUESTID", org.drip.json.parser.Converter.StringEntry (jsonRequest, - "REQUESTID")); - - jsonResponse.put ("RESPONSETIMESTAMP", new java.util.Date().toString()); - - jsonResponse.put ("RESPONSEID", org.drip.quant.common.StringUtil.GUID()); - - return true; - } -} diff --git a/org/drip/service/env/CacheManager.java b/org/drip/service/env/CacheManager.java deleted file mode 100644 index 9a7c7ff..0000000 --- a/org/drip/service/env/CacheManager.java +++ /dev/null @@ -1,144 +0,0 @@ - -package org.drip.service.env; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CacheManager implements the DRIP Cache Management Functionality, and contains the Functions to Add, - * Delete, Retrieve, and Time out a Key-Value Pair along the lines of memcached. - * - * @author Lakshmi Krishnamurthy - */ - -public class CacheManager { - private static final boolean s_bLog = true; - private static java.util.concurrent.ConcurrentHashMap s_mapCache = - null; - - private static final java.util.concurrent.ScheduledExecutorService _ses = - java.util.concurrent.Executors.newScheduledThreadPool (1); - - /** - * Initialize the Cache Manager - * - * @return TRUE - The Cache Manager successfully initialized - */ - - public static final boolean Init() - { - s_mapCache = new java.util.concurrent.ConcurrentHashMap(); - - return true; - } - - /** - * The Put Method adds a Key/Value Pair to the In-Memory KV Store - * - * @param strKey The Key - * @param strValue The Value - * @param lSecondsToExpiry The Time to Expiry of the Key/Value Pair - * - * @return Return Value from the Underlying HashMap.put - */ - - public static final java.lang.String Put ( - final java.lang.String strKey, - final java.lang.String strValue, - final long lSecondsToExpiry) - { - if (null == strKey || strKey.isEmpty() || null == strValue || strValue.isEmpty()) return null; - - if (0 < lSecondsToExpiry) { - java.lang.Runnable timedTask = new java.lang.Runnable() { - @Override public void run() { - if (s_bLog) - System.out.println ("\t\t[" + new java.util.Date() + "] Removing " + strKey + - " from Thread " + java.lang.Thread.currentThread()); - - if (s_mapCache.contains (strKey)) s_mapCache.remove (strKey); - } - }; - - _ses.schedule (timedTask, lSecondsToExpiry, java.util.concurrent.TimeUnit.SECONDS); - } - - return s_mapCache.put (strKey, strValue); - } - - /** - * The Contains Method checks the Presence of the specified Key - * - * @param strKey The Key - * - * @return Return Value from the Underlying HashMap.contains - */ - - public static final boolean Contains ( - final java.lang.String strKey) - { - if (null == strKey || strKey.isEmpty()) return false; - - return s_mapCache.contains (strKey); - } - - /** - * The Get Method retrieves the Value given the Key - * - * @param strKey The Key - * - * @return Return Value from the Underlying HashMap.get - */ - - public static final java.lang.String Get ( - final java.lang.String strKey) - { - if (null == strKey || strKey.isEmpty()) return null; - - return s_mapCache.get (strKey); - } -} diff --git a/org/drip/service/env/EnvManager.java b/org/drip/service/env/EnvManager.java deleted file mode 100644 index 7277cf6..0000000 --- a/org/drip/service/env/EnvManager.java +++ /dev/null @@ -1,199 +0,0 @@ - -package org.drip.service.env; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * EnvManager sets the environment/connection parameters, and populates the market parameters for the given - * EOD. - * - * @author Lakshmi Krishnamurthy - */ - -public class EnvManager { - /** - * Initialize the logger, the database connections, the day count parameters, and day count objects. - * - * @param strConfig String representing the full path of the configuration file - * - * @return SQL Statement representing the initialized object. - */ - - public static final java.sql.Statement InitEnv ( - final java.lang.String strConfig) - { - org.drip.analytics.support.Logger.Init (strConfig); - - if (!org.drip.service.env.CacheManager.Init()) { - System.out.println ("EnvManager::InitEnv => Cannot Initialize Cache Manager!"); - - return null; - } - - if (!org.drip.analytics.daycount.Convention.Init (strConfig)) { - System.out.println ("EnvManager::InitEnv => Cannot Initialize Day Count Conventions!"); - - return null; - } - - if (!org.drip.service.env.StandardCDXManager.InitStandardCDXSeries()) { - System.out.println ("EnvManager::InitEnv => Cannot Initialize standard CDX Indexes!"); - - return null; - } - - if (!org.drip.market.definition.OvernightIndexContainer.Init()) { - System.out.println ("EnvManager::InitEnv => Cannot Initialize Overnight Indexes!"); - - return null; - } - - if (!org.drip.market.definition.IBORIndexContainer.Init()) { - System.out.println ("EnvManager::InitEnv => Cannot Initialize IBOR Indexes!"); - - return null; - } - - if (!org.drip.market.exchange.ShortTermFuturesContainer.Init()) { - System.out.println ("EnvManager::InitEnv => Cannot Initialize Short Term Futures!"); - - return null; - } - - if (!org.drip.market.exchange.FuturesOptionsContainer.Init()) { - System.out.println ("EnvManager::InitEnv => Cannot Initialize Short Term Futures Options!"); - - return null; - } - - if (!org.drip.market.otc.IBORFixedFloatContainer.Init()) { - System.out.println - ("EnvManager::InitEnv => Cannot Initialize IBOR Fix-Float Convention Settings!"); - - return null; - } - - if (!org.drip.market.otc.IBORFloatFloatContainer.Init()) { - System.out.println - ("EnvManager::InitEnv => Cannot Initialize IBOR Float-Float Convention Settings!"); - - return null; - } - - if (!org.drip.market.otc.OvernightFixedFloatContainer.Init()) { - System.out.println - ("EnvManager::InitEnv => Cannot Initialize Overnight Fix-Float Convention Settings!"); - - return null; - } - - if (!org.drip.market.exchange.DeliverableSwapFuturesContainer.Init()) { - System.out.println ("EnvManager::InitEnv => Cannot Initialize Deliverable Swap Futures Settings!"); - - return null; - } - - if (!org.drip.market.otc.CrossFloatConventionContainer.Init()) { - System.out.println - ("EnvManager::InitEnv => Cannot Initialize Cross-Currency Float-Float Convention Settings!"); - - return null; - } - - if (!org.drip.market.otc.SwapOptionSettlementContainer.Init()) { - System.out.println - ("EnvManager::InitEnv => Cannot Initialize the Swap Option Settlement Conventions!"); - - return null; - } - - if (!org.drip.market.otc.CreditIndexConventionContainer.Init()) { - System.out.println ("EnvManager::InitEnv => Cannot Initialize the Credit Index Conventions!"); - - return null; - } - - if (!org.drip.market.exchange.TreasuryFuturesConventionContainer.Init()) { - System.out.println - ("EnvManager::InitEnv => Cannot Initialize the Bond Futures Convention Conventions!"); - - return null; - } - - if (!org.drip.market.exchange.TreasuryFuturesOptionContainer.Init()) { - System.out.println - ("EnvManager::InitEnv => Cannot Initialize the Bond Futures Option Conventions!"); - - return null; - } - - if (!org.drip.market.definition.FXSettingContainer.Init()) { - System.out.println ("EnvManager::InitEnv => Cannot Initialize the FX Conventions!"); - - return null; - } - - if (!org.drip.market.issue.TreasurySettingContainer.Init()) { - System.out.println ("EnvManager::InitEnv => Cannot Initialize the Treasury Settings!"); - - return null; - } - - if (!org.drip.market.exchange.TreasuryFuturesContractContainer.Init()) { - System.out.println ("EnvManager::InitEnv => Cannot Initialize the Treasury Futures Contract!"); - - return null; - } - - return org.drip.param.config.ConfigLoader.OracleInit (strConfig); - } -} diff --git a/org/drip/service/env/StandardCDXManager.java b/org/drip/service/env/StandardCDXManager.java deleted file mode 100644 index c1630ff..0000000 --- a/org/drip/service/env/StandardCDXManager.java +++ /dev/null @@ -1,974 +0,0 @@ - -package org.drip.service.env; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * StandardCDXManager implements the creation and the static details of the all the NA, EU, SovX, EMEA, and - * ASIA standardized CDS indices. It exposes the following functionality: - * - Retrieve the full set of pre-set/pre-loaded CDX names/descriptions. - * - Retrieve all the CDX's given an index name. - * - Get the index, index series, and the effective/maturity dates for a given CDX. - * - Get all the on-the-runs for an index, date, and tenor. - * - Retrieve the full basket product corresponding to NA/EU/ASIA IG/HY/EM and other available standard CDX. - * - Build a custom CDX product. - * - * @author Lakshmi Krishnamurthy - */ - -public class StandardCDXManager { - private static org.drip.analytics.support.CaseInsensitiveTreeMap - _mapStandardCDX = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private static org.drip.analytics.support.CaseInsensitiveTreeMap - _mapStandardCDXParams = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - private static - org.drip.analytics.support.CaseInsensitiveTreeMap> _mmIndexFirstCouponSeries = new - org.drip.analytics.support.CaseInsensitiveTreeMap>(); - - private static org.drip.analytics.support.CaseInsensitiveTreeMap> _mmIndexSeriesFirstCoupon = new - org.drip.analytics.support.CaseInsensitiveTreeMap>(); - - private static final boolean SetupStandardCDXParams() - { - try { - _mapStandardCDXParams.put ("CDX.NA.IG", new org.drip.product.params.StandardCDXParams (125, - "USD", 0.01)); - - _mapStandardCDXParams.put ("CDX.NA.HY", new org.drip.product.params.StandardCDXParams (100, - "USD", 0.05)); - - _mapStandardCDXParams.put ("CDX.NA.HVOL", new org.drip.product.params.StandardCDXParams (30, - "USD", 0.01)); - - _mapStandardCDXParams.put ("CDX.NA.HIVOL", new org.drip.product.params.StandardCDXParams (30, - "USD", 0.01)); - - _mapStandardCDXParams.put ("CDX.NA.XO", new org.drip.product.params.StandardCDXParams (35, "USD", - 0.034)); - - _mapStandardCDXParams.put ("CDX.NA.HY.BB", new org.drip.product.params.StandardCDXParams (40, - "USD", 0.05)); - - _mapStandardCDXParams.put ("CDX.NA.HY.B", new org.drip.product.params.StandardCDXParams (37, - "USD", 0.05)); - - _mapStandardCDXParams.put ("ITRX.EU.IG", new org.drip.product.params.StandardCDXParams (125, - "EUR", 0.01)); - - _mapStandardCDXParams.put ("ITRAXX.EU.IG", new org.drip.product.params.StandardCDXParams (125, - "EUR", 0.01)); - - _mapStandardCDXParams.put ("ITRX.EU.HVOL", new org.drip.product.params.StandardCDXParams (30, - "EUR", 0.01)); - - _mapStandardCDXParams.put ("ITRAXX.EU.HVOL", new org.drip.product.params.StandardCDXParams (30, - "EUR", 0.01)); - - _mapStandardCDXParams.put ("ITRX.EU.XO", new org.drip.product.params.StandardCDXParams (50, - "EUR", 0.05)); - - _mapStandardCDXParams.put ("ITRAXX.EU.XO", new org.drip.product.params.StandardCDXParams (50, - "EUR", 0.05)); - - _mapStandardCDXParams.put ("ITRX.EU.NONFIN", new org.drip.product.params.StandardCDXParams (50, - "EUR", 0.05)); - - _mapStandardCDXParams.put ("ITRAXX.EU.NONFIN", new org.drip.product.params.StandardCDXParams (50, - "EUR", 0.05)); - - _mapStandardCDXParams.put ("ITRX.EU.FINSNR", new org.drip.product.params.StandardCDXParams (20, - "EUR", 0.01)); - - _mapStandardCDXParams.put ("ITRAXX.EU.FINSNR", new org.drip.product.params.StandardCDXParams (20, - "EUR", 0.01)); - - _mapStandardCDXParams.put ("ITRX.EU.FINSUB", new org.drip.product.params.StandardCDXParams (20, - "EUR", 0.01)); - - _mapStandardCDXParams.put ("ITRAXX.EU.FINSUB", new org.drip.product.params.StandardCDXParams (20, - "EUR", 0.01)); - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - private static final boolean UpdateIndexMaps ( - final java.util.Map mapDateSeries, - final java.util.Map mapSeriesDate, - final org.drip.analytics.date.JulianDate dt, - final int iSeries) - { - mapDateSeries.put (dt, iSeries); - - mapSeriesDate.put (iSeries, dt); - - return true; - } - - private static final boolean PresetNA_IG_HY_HVOL_HYBB_HYBSeries() - { - java.util.Map mapDateSeries = new - java.util.TreeMap(); - - java.util.Map mapSeriesDate = new - java.util.TreeMap(); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2014, 6, 20), 22); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2013, 12, 20), 21); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2013, 6, 20), 20); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2012, 12, 20), 19); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2012, 6, 20), 18); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2011, 12, 20), 17); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2011, 6, 20), 16); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2010, 12, 20), 15); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2010, 6, 20), 14); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2009, 12, 20), 13); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2009, 6, 20), 12); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2008, 12, 20), 11); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2008, 6, 20), 10); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2007, 12, 20), 9); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2007, 6, 20), 8); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2006, 12, 20), 7); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2006, 6, 20), 6); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2005, 12, 20), 5); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2005, 6, 20), 4); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2004, 12, 20), 3); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2004, 6, 20), 2); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2003, 12, 20), 1); - - _mmIndexFirstCouponSeries.put ("CDX.NA.IG", mapDateSeries); - - _mmIndexSeriesFirstCoupon.put ("CDX.NA.IG", mapSeriesDate); - - _mmIndexFirstCouponSeries.put ("CDX.NA.HY", mapDateSeries); - - _mmIndexSeriesFirstCoupon.put ("CDX.NA.HY", mapSeriesDate); - - _mmIndexFirstCouponSeries.put ("CDX.NA.HVOL", mapDateSeries); - - _mmIndexSeriesFirstCoupon.put ("CDX.NA.HVOL", mapSeriesDate); - - _mmIndexFirstCouponSeries.put ("CDX.NA.HIVOL", mapDateSeries); - - _mmIndexSeriesFirstCoupon.put ("CDX.NA.HIVOL", mapSeriesDate); - - _mmIndexFirstCouponSeries.put ("CDX.NA.HY.B", mapDateSeries); - - _mmIndexSeriesFirstCoupon.put ("CDX.NA.HY.B", mapSeriesDate); - - _mmIndexFirstCouponSeries.put ("CDX.NA.HY.BB", mapDateSeries); - - _mmIndexSeriesFirstCoupon.put ("CDX.NA.HY.BB", mapSeriesDate); - - return true; - } - - private static final boolean PresetNAXOSeries() - { - java.util.Map mapDateSeries = new - java.util.TreeMap(); - - java.util.Map mapSeriesDate = new - java.util.TreeMap(); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2014, 6, 20), 16); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2013, 12, 20), 15); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2013, 6, 20), 14); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2012, 12, 20), 13); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2012, 6, 20), 12); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2011, 12, 20), 11); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2011, 6, 20), 10); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2010, 12, 20), 9); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2010, 6, 20), 8); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2009, 12, 20), 7); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2009, 6, 20), 6); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2008, 12, 20), 5); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2008, 6, 20), 4); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2007, 12, 20), 3); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2007, 6, 20), 2); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2006, 12, 20), 1); - - _mmIndexFirstCouponSeries.put ("CDX.NA.XO", mapDateSeries); - - _mmIndexSeriesFirstCoupon.put ("CDX.NA.XO", mapSeriesDate); - - return true; - } - - private static final boolean PresetEMSeries() - { - java.util.Map mapDateSeries = new - java.util.TreeMap(); - - java.util.Map mapSeriesDate = new - java.util.TreeMap(); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2014, 6, 20), 21); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2013, 12, 20), 20); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2013, 6, 20), 19); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2012, 12, 20), 18); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2012, 6, 20), 17); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2011, 12, 20), 16); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2011, 6, 20), 15); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2010, 12, 20), 14); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2010, 6, 20), 13); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2009, 12, 20), 12); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2009, 6, 20), 11); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2008, 12, 20), 10); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2008, 6, 20), 9); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2007, 12, 20), 8); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2007, 6, 20), 7); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2006, 12, 20), 6); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2006, 6, 20), 5); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2005, 12, 20), 4); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2005, 6, 20), 3); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2004, 12, 20), 2); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2004, 6, 20), 1); - - _mmIndexFirstCouponSeries.put ("CDX.EM", mapDateSeries); - - _mmIndexSeriesFirstCoupon.put ("CDX.EM", mapSeriesDate); - - return true; - } - - private static final boolean PresetEUSeries() - { - java.util.Map mapDateSeries = new - java.util.TreeMap(); - - java.util.Map mapSeriesDate = new - java.util.TreeMap(); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2014, 6, 20), 20); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2013, 12, 20), 19); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2013, 6, 20), 18); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2012, 12, 20), 17); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2012, 6, 20), 16); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2011, 12, 20), 15); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2011, 6, 20), 14); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2010, 12, 20), 13); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2010, 6, 20), 12); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2009, 12, 20), 11); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2009, 6, 20), 10); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2008, 12, 20), 9); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2008, 6, 20), 8); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2007, 12, 20), 7); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2007, 6, 20), 6); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2006, 12, 20), 5); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2006, 6, 20), 4); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2005, 12, 20), 3); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2005, 6, 20), 2); - - UpdateIndexMaps (mapDateSeries, mapSeriesDate, org.drip.analytics.date.DateUtil.CreateFromYMD - (2004, 12, 20), 1); - - _mmIndexFirstCouponSeries.put ("ITRX.EU.IG", mapDateSeries); - - _mmIndexSeriesFirstCoupon.put ("ITRX.EU.IG", mapSeriesDate); - - _mmIndexFirstCouponSeries.put ("ITRX.EU.HVOL", mapDateSeries); - - _mmIndexSeriesFirstCoupon.put ("ITRX.EU.HVOL", mapSeriesDate); - - _mmIndexFirstCouponSeries.put ("ITRX.EU.HIVOL", mapDateSeries); - - _mmIndexSeriesFirstCoupon.put ("ITRX.EU.HIVOL", mapSeriesDate); - - _mmIndexFirstCouponSeries.put ("ITRX.EU.XO", mapDateSeries); - - _mmIndexSeriesFirstCoupon.put ("ITRX.EU.XO", mapSeriesDate); - - _mmIndexFirstCouponSeries.put ("ITRX.EU.FINSNR", mapDateSeries); - - _mmIndexSeriesFirstCoupon.put ("ITRX.EU.FINSNR", mapSeriesDate); - - _mmIndexFirstCouponSeries.put ("ITRX.EU.FINSUB", mapDateSeries); - - _mmIndexSeriesFirstCoupon.put ("ITRX.EU.FINSUB", mapSeriesDate); - - _mmIndexFirstCouponSeries.put ("ITRX.EU.NONFIN", mapDateSeries); - - _mmIndexSeriesFirstCoupon.put ("ITRX.EU.NONFIN", mapSeriesDate); - - return true; - } - - public static final boolean InitStandardCDXSeries() - { - if (!PresetNA_IG_HY_HVOL_HYBB_HYBSeries()) { - System.out.println ("Cannot initialize NA_IG_HY_HVOL_HYBB_HYB"); - - return false; - } - - if (!PresetNAXOSeries()) { - System.out.println ("Cannot initialize NA_XO"); - - return false; - } - - if (!PresetEMSeries()) { - System.out.println ("Cannot initialize EM"); - - return false; - } - - if (!PresetEUSeries()) { - System.out.println ("Cannot initialize EU"); - - return false; - } - - if (!SetupStandardCDXParams()) { - System.out.println ("Cannot setup standard CDX Params!"); - - return false; - } - - return org.drip.product.creator.CDXRefDataHolder.InitFullCDXRefDataSet(); - } - - private static final org.drip.product.definition.BasketProduct ConstructCDX ( - final java.lang.String strTenor, - final org.drip.analytics.date.JulianDate dtFirstCoupon, - final double dblCoupon, - final java.lang.String strIR, - final int iNumComponents, - final java.lang.String strCDXName) - { - java.lang.String[] astrCC = new java.lang.String[iNumComponents]; - - for (int i = 0; i < iNumComponents; ++i) - astrCC[i] = "CC" + (i + 1); - - return org.drip.product.creator.CDSBasketBuilder.MakeCDX (dtFirstCoupon.subtractTenor ("3M"), - dtFirstCoupon.addTenor (strTenor), dblCoupon, strIR, astrCC, strCDXName); - } - - private static final org.drip.product.definition.BasketProduct ConstructCDXEM ( - final java.lang.String strTenor, - final org.drip.analytics.date.JulianDate dtFirstCoupon, - final java.lang.String strCDXName) - { - return org.drip.product.creator.CDSBasketBuilder.MakeCDX (dtFirstCoupon.subtractTenor ("3M"), - dtFirstCoupon.addTenor (strTenor), 0.05, "USD", new java.lang.String[] {"ARG", "VEN", "BRA", - "MAL", "COL", "HUN", "IND", "PAN", "PER", "SAF", "PHI", "TUR", "RUS", "UKR", "MEX"}, new - double[] {0.06, 0.08, 0.13, 0.04, 0.08, 0.03, 0.05, 0.03, 0.05, 0.03, 0.06, 0.11, 0.13, - 0.03, 0.09}, strCDXName); - } - - private static final org.drip.product.definition.BasketProduct MakePresetStandardCDX ( - final java.lang.String strIndex, - final int iSeries, - final java.lang.String strTenor) - { - if (null == strIndex || strIndex.isEmpty() || null == strTenor || strTenor.isEmpty()) return null; - - org.drip.product.params.CDXIdentifier cdxID = null; - - try { - cdxID = new org.drip.product.params.CDXIdentifier (iSeries, 1, strIndex, strTenor); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - if (null == cdxID) return null; - - java.lang.String strCDXCode = cdxID.getCode(); - - if (null == strCDXCode || strCDXCode.isEmpty()) return null; - - org.drip.product.definition.BasketProduct cdx = _mapStandardCDX.get (strCDXCode); - - if (null != cdx) return cdx; - - java.util.Map mapSeriesFirstCoupon = - _mmIndexSeriesFirstCoupon.get (strIndex); - - if (null == mapSeriesFirstCoupon) return null; - - org.drip.analytics.date.JulianDate dtFirstCoupon = mapSeriesFirstCoupon.get (iSeries); - - if (null == dtFirstCoupon) return null; - - if ("CDX.EM".equalsIgnoreCase (strIndex)) - cdx = ConstructCDXEM (strTenor, dtFirstCoupon, strCDXCode); - else { - org.drip.product.params.StandardCDXParams cdxParams = _mapStandardCDXParams.get (strIndex); - - if (null != cdxParams) - cdx = ConstructCDX (strTenor, dtFirstCoupon, cdxParams._dblCoupon, cdxParams._strCurrency, - cdxParams._iNumComponents, strCDXCode); - } - - _mapStandardCDX.put (strCDXCode, cdx); - - return cdx; - } - - private static final org.drip.product.definition.BasketProduct MakePreLoadedStandardCDX ( - final java.lang.String strIndex, - final int iSeries, - final java.lang.String strTenor) - { - if (null == strIndex || strIndex.isEmpty() || null == strTenor || strTenor.isEmpty()) return null; - - org.drip.product.params.CDXIdentifier cdxID = null; - - try { - cdxID = new org.drip.product.params.CDXIdentifier (iSeries, 1, strIndex, strTenor); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - if (null == cdxID) return null; - - java.lang.String strCDXCode = cdxID.getCode(); - - if (null == strCDXCode || strCDXCode.isEmpty()) return null; - - org.drip.product.params.CDXRefDataParams cdxrdb = - org.drip.product.creator.CDXRefDataHolder._mapCDXRefData.get (strCDXCode); - - if (null == cdxrdb) return null; - - java.lang.String[] astrCC = new java.lang.String[cdxrdb._iOriginalComponentCount]; - - for (int i = 0; i < cdxrdb._iOriginalComponentCount; ++i) - astrCC[i] = "CC" + (i + 1); - - return org.drip.product.creator.CDSBasketBuilder.MakeCDX (cdxrdb._dtMaturity.subtractTenor - (cdxrdb._iIndexLifeSpan + "Y"), cdxrdb._dtMaturity, cdxrdb._dblCoupon, cdxrdb._strCurrency, - astrCC, cdxrdb._strIndexClass + "." + cdxrdb._strIndexGroupName + "." + - cdxrdb._iIndexLifeSpan + "Y." + cdxrdb._iIndexSeries + "." + cdxrdb._iIndexVersion); - } - - private static final org.drip.product.definition.BasketProduct GetPresetOnTheRun ( - final java.lang.String strIndex, - final org.drip.analytics.date.JulianDate dt, - final java.lang.String strTenor) - { - if (null == dt || null == strIndex || strIndex.isEmpty() || null == strTenor || strTenor.isEmpty()) - return null; - - java.util.Map mapFirstCouponSeries = - _mmIndexFirstCouponSeries.get (strIndex); - - org.drip.analytics.date.JulianDate dtFirstCoupon = dt.nextCreditIMM (3); - - if (null == dtFirstCoupon || null == mapFirstCouponSeries) return null; - - if (null == mapFirstCouponSeries.get (dtFirstCoupon)) - dtFirstCoupon = dtFirstCoupon.nextCreditIMM (3); - - if (null == dtFirstCoupon || null == mapFirstCouponSeries.get (dtFirstCoupon)) return null; - - return MakePresetStandardCDX (strIndex, mapFirstCouponSeries.get (dtFirstCoupon), strTenor); - } - - private static final org.drip.product.definition.BasketProduct GetPreLoadedOnTheRun ( - final java.lang.String strIndex, - final org.drip.analytics.date.JulianDate dt, - final java.lang.String strTenor) - { - if (null == dt || null == strIndex || strIndex.isEmpty() || null == strTenor || strTenor.isEmpty()) - return null; - - java.util.Map mapFirstCouponSeries = - org.drip.product.creator.CDXRefDataHolder._mmCDXRDBFirstCouponSeries.get (strIndex); - - org.drip.analytics.date.JulianDate dtFirstCoupon = dt.nextCreditIMM (3); - - if (null == dtFirstCoupon || null == mapFirstCouponSeries) return null; - - if (null == mapFirstCouponSeries.get (dtFirstCoupon)) - dtFirstCoupon = dtFirstCoupon.nextCreditIMM (3); - - if (null == dtFirstCoupon || null == mapFirstCouponSeries.get (dtFirstCoupon)) return null; - - return MakePreLoadedStandardCDX (strIndex, mapFirstCouponSeries.get (dtFirstCoupon), strTenor); - } - - private static final boolean DumpIndexDetails ( - final java.lang.String strCDXCoverageFile) - { - if (null == strCDXCoverageFile || strCDXCoverageFile.isEmpty()) return false; - - java.io.BufferedWriter bw = null; - - try { - bw = new java.io.BufferedWriter (new java.io.FileWriter (strCDXCoverageFile)); - - bw.write ("\n , Index Name, Description, Issue Date, Maturity Date, Frequency, Coupon\n"); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - try { - bw.close(); - } catch (java.lang.Exception e1) { - e1.printStackTrace(); - } - - return false; - } - - for (java.util.Map.Entry meCDXRefData : - org.drip.product.creator.CDXRefDataHolder._mapCDXRefData.entrySet()) { - org.drip.product.params.CDXRefDataParams cdxrdb = meCDXRefData.getValue(); - - if (null == cdxrdb) continue; - - java.lang.String strIndexDetails = " , " + meCDXRefData.getKey() + ", " + cdxrdb._strIndexName + - ", " + cdxrdb._dtIssue + ", " + cdxrdb._dtMaturity + ", " + cdxrdb._iFrequency + ", " + (int) - (10000. * cdxrdb._dblCoupon) + "\n"; - - try { - bw.write (strIndexDetails); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - try { - bw.close(); - } catch (java.lang.Exception e1) { - e1.printStackTrace(); - } - } - } - - try { - bw.close(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return true; - } - - /** - * Create a standard CDX from the index code, the index series, and the tenor. - * - * @param strIndex The Index Code (CDX.NA.IG, CDX.NA.HY, etc) - * @param iSeries Index Series Number - * @param strTenor The specific tenor - typical common ones are 3Y, 5Y, 7Y, and 10Y - * - * @return The CDX Basket Product - */ - - public static final org.drip.product.definition.BasketProduct MakeStandardCDX ( - final java.lang.String strIndex, - final int iSeries, - final java.lang.String strTenor) - { - org.drip.product.definition.BasketProduct bpCDX = MakePresetStandardCDX (strIndex, iSeries, - strTenor); - - if (null != bpCDX) return bpCDX; - - return MakePreLoadedStandardCDX (strIndex, iSeries, strTenor); - } - - /** - * Retrieve the on-the-run for the index and tenor corresponding to the specified date - * - * @param strIndex CDX/ITRAXX index - * @param dt Specified date - * @param strTenor Tenor - * - * @return CDX/ITRAXX Basket Product - */ - - public static final org.drip.product.definition.BasketProduct GetOnTheRun ( - final java.lang.String strIndex, - final org.drip.analytics.date.JulianDate dt, - final java.lang.String strTenor) - { - org.drip.product.definition.BasketProduct bpCDX = GetPresetOnTheRun (strIndex, dt, strTenor); - - if (null != bpCDX) return bpCDX; - - return GetPreLoadedOnTheRun (strIndex, dt, strTenor); - } - - /** - * Retrieve a set of all the pre-set CDX index names - * - * @return Set of the pre-set CDX index names - */ - - public static final java.util.Set GetPresetIndexNames() - { - return _mmIndexFirstCouponSeries.keySet(); - } - - /** - * Retrieve a set of all the pre-loaded CDX index names - * - * @return Set of the pre-loaded CDX index names - */ - - public static final java.util.Set GetPreLoadedIndexNames() - { - return org.drip.product.creator.CDXRefDataHolder._mmCDXRDBFirstCouponSeries.keySet(); - } - - /** - * Retrieve the comprehensive set of pre-set and pre-loaded CDX index names - * - * @return Set of the pre-set and the pre-loaded CDX index names - */ - - public static final java.util.Set GetCDXNames() - { - java.util.Set setstrIndex = new java.util.HashSet(); - - setstrIndex.addAll (GetPreLoadedIndexNames()); - - setstrIndex.addAll (GetPresetIndexNames()); - - return setstrIndex; - } - - /** - * Return the full set of pre-set CDX series/first coupon date pairs for the given CDX - * - * @param strCDXName CDX Name - * - * @return Map of the CDX series/first coupon dates - */ - - public static final java.util.Map - GetPresetCDXSeriesMap ( - final java.lang.String strCDXName) - { - if (null == strCDXName || strCDXName.isEmpty()) return null; - - return _mmIndexFirstCouponSeries.get (strCDXName); - } - - /** - * Return the full set of pre-loaded CDX series/first coupon date pairs for the given CDX - * - * @param strCDXName CDX Name - * - * @return Map of the CDX series/first coupon dates - */ - - public static final java.util.Map - GetPreLoadedCDXSeriesMap ( - final java.lang.String strCDXName) - { - if (null == strCDXName || strCDXName.isEmpty()) return null; - - return org.drip.product.creator.CDXRefDataHolder._mmCDXRDBFirstCouponSeries.get (strCDXName); - } - - /** - * Return the full set of CDX series/first coupon date pairs for the given CDX - * - * @param strCDXName CDX Name - * - * @return Map of the CDX series/first coupon dates - */ - - public static final java.util.Map GetCDXSeriesMap( - final java.lang.String strCDXName) - { - if (null == strCDXName || strCDXName.isEmpty()) return null; - - java.util.Map mapFirstCouponSeries = new - java.util.HashMap(); - - java.util.Map mapPresetFirstCouponSeries = - GetPresetCDXSeriesMap (strCDXName); - - if (null != mapPresetFirstCouponSeries) mapFirstCouponSeries.putAll (mapPresetFirstCouponSeries); - - java.util.Map mapPreLoadedFirstCouponSeries = - GetPreLoadedCDXSeriesMap (strCDXName); - - if (null != mapPreLoadedFirstCouponSeries) - mapFirstCouponSeries.putAll (mapPreLoadedFirstCouponSeries); - - return mapFirstCouponSeries; - } - - /** - * Retrieve the name/description map for all the pre-set CDS indices - * - * @return Name/description map for all the pre-set CDS indices - */ - - public static final org.drip.analytics.support.CaseInsensitiveTreeMap - GetPresetCDXDescriptions() - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapCDXDescr = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry meCDXRefData : - _mapStandardCDXParams.entrySet()) - mapCDXDescr.put (meCDXRefData.getKey(), meCDXRefData.getKey()); - - return mapCDXDescr; - } - - /** - * Retrieve the name/description map for all the pre-loaded CDS indices - * - * @return Name/description map for all the pre-loaded CDS indices - */ - - public static final org.drip.analytics.support.CaseInsensitiveTreeMap - GetPreLoadedCDXDescriptions() - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapCDXDescr = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry meCDXRefData : - org.drip.product.creator.CDXRefDataHolder._mapCDXRefData.entrySet()) - mapCDXDescr.put (meCDXRefData.getKey(), meCDXRefData.getValue()._strIndexName); - - return mapCDXDescr; - } - - /** - * Retrieve the name/description map for all the CDS indices - * - * @return Name/description map for all the CDS indices - */ - - public static final org.drip.analytics.support.CaseInsensitiveTreeMap - GetCDXDescriptions() - { - org.drip.analytics.support.CaseInsensitiveTreeMap mapCDXDescr = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapCDXDescr.putAll (GetPreLoadedCDXDescriptions()); - - mapCDXDescr.putAll (GetPresetCDXDescriptions()); - - return mapCDXDescr; - } - - public static final void main ( - final java.lang.String[] astrArgs) - throws java.lang.Exception - { - if (!InitStandardCDXSeries()) System.out.println ("Cannot initialize InitStandardCDXSeries!"); - - DumpIndexDetails ("C:\\CreditAnalytics\\docs\\CDXCoverage.csv"); - } -} diff --git a/org/drip/service/json/CreditDefaultSwapProcessor.java b/org/drip/service/json/CreditDefaultSwapProcessor.java deleted file mode 100644 index 8f8552b..0000000 --- a/org/drip/service/json/CreditDefaultSwapProcessor.java +++ /dev/null @@ -1,188 +0,0 @@ - -package org.drip.service.json; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CreditDefaultSwapProcessor Sets Up and Executes a JSON Based In/Out Credit Default Swap Valuation - * Processor. - * - * @author Lakshmi Krishnamurthy - */ - -public class CreditDefaultSwapProcessor { - - /** - * JSON Based in/out Credit Default Swap Curve Metrics Thunker - * - * @param jsonParameter JSON Credit Default Swap Request Parameters - * - * @return JSON Credit Default Swap Curve Metrics Response - */ - - @SuppressWarnings ("unchecked") static final org.drip.json.simple.JSONObject CurveMetrics ( - final org.drip.json.simple.JSONObject jsonParameter) - { - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = - org.drip.service.json.LatentStateProcessor.FundingCurve (jsonParameter); - - org.drip.state.credit.CreditCurve ccSurvivalRecovery = - org.drip.service.json.LatentStateProcessor.CreditCurve (jsonParameter, dcFunding); - - if (null == ccSurvivalRecovery) return null; - - org.drip.param.market.CurveSurfaceQuoteContainer csqc = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - if (!csqc.setFundingState (dcFunding) || !csqc.setCreditState (ccSurvivalRecovery)) return null; - - org.drip.analytics.date.JulianDate dtSpot = dcFunding.epoch(); - - org.drip.product.definition.CreditDefaultSwap cds = null; - - try { - cds = org.drip.service.template.OTCInstrumentBuilder.CDS (dtSpot, - org.drip.json.parser.Converter.StringEntry (jsonParameter, "CDSMaturity"), - org.drip.json.parser.Converter.DoubleEntry (jsonParameter, "CDSCoupon"), - dcFunding.currency(), ((org.drip.state.identifier.CreditLabel) - (ccSurvivalRecovery.label())).referenceEntity()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (null == cds) return null; - - java.util.Map mapResult = cds.value - (org.drip.param.valuation.ValuationParams.Spot (dtSpot.julian()), null, csqc, null); - - if (null == mapResult) return null; - - org.drip.json.simple.JSONObject jsonResponse = new org.drip.json.simple.JSONObject(); - - for (java.util.Map.Entry me : mapResult.entrySet()) - jsonResponse.put (me.getKey(), me.getValue()); - - org.drip.json.simple.JSONArray jsonCouponFlowArray = new org.drip.json.simple.JSONArray(); - - for (org.drip.analytics.cashflow.CompositePeriod cp : cds.couponPeriods()) { - org.drip.json.simple.JSONObject jsonCouponFlow = new org.drip.json.simple.JSONObject(); - - try { - jsonCouponFlow.put ("StartDate", new org.drip.analytics.date.JulianDate - (cp.startDate()).toString()); - - jsonCouponFlow.put ("EndDate", new org.drip.analytics.date.JulianDate - (cp.endDate()).toString()); - - jsonCouponFlow.put ("PayDate", new org.drip.analytics.date.JulianDate - (cp.payDate()).toString()); - - jsonCouponFlow.put ("CouponDCF", cp.couponDCF()); - - jsonCouponFlow.put ("PayDiscountFactor", cp.df (csqc)); - - jsonCouponFlow.put ("SurvivalProbability", cp.survival (csqc)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - jsonCouponFlow.put ("BaseNotional", cp.baseNotional()); - - jsonCouponFlow.put ("Tenor", cp.tenor()); - - jsonCouponFlow.put ("FundingLabel", cp.fundingLabel().fullyQualifiedName()); - - jsonCouponFlow.put ("CreditLabel", cp.creditLabel().fullyQualifiedName()); - - jsonCouponFlow.put ("ReferenceRate", cp.couponMetrics (dtSpot.julian(), csqc).rate()); - - jsonCouponFlowArray.add (jsonCouponFlow); - } - - jsonResponse.put ("CouponFlow", jsonCouponFlowArray); - - org.drip.json.simple.JSONArray jsonLossFlowArray = new org.drip.json.simple.JSONArray(); - - for (org.drip.analytics.cashflow.LossQuadratureMetrics lqm : cds.lossFlow (dtSpot, csqc)) { - org.drip.json.simple.JSONObject jsonLossFlow = new org.drip.json.simple.JSONObject(); - - try { - jsonLossFlow.put ("StartDate", new org.drip.analytics.date.JulianDate - (lqm.startDate()).toString()); - - jsonLossFlow.put ("EndDate", new org.drip.analytics.date.JulianDate - (lqm.endDate()).toString()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - jsonLossFlow.put ("StartSurvival", lqm.startSurvival()); - - jsonLossFlow.put ("EndSurvival", lqm.endSurvival()); - - jsonLossFlow.put ("EffectiveNotional", lqm.effectiveNotional()); - - jsonLossFlow.put ("EffectiveRecovery", lqm.effectiveRecovery()); - - jsonLossFlow.put ("EffectiveAccrual", lqm.accrualDCF()); - - jsonLossFlow.put ("EffectiveDF", lqm.effectiveDF()); - - jsonLossFlowArray.add (jsonLossFlow); - } - - jsonResponse.put ("LossFlow", jsonLossFlowArray); - - return jsonResponse; - } -} diff --git a/org/drip/service/json/DateProcessor.java b/org/drip/service/json/DateProcessor.java deleted file mode 100644 index c779e29..0000000 --- a/org/drip/service/json/DateProcessor.java +++ /dev/null @@ -1,168 +0,0 @@ - -package org.drip.service.json; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DateProcessor Sets Up and Executes a JSON Based In/Out Date Related Service. - * - * @author Lakshmi Krishnamurthy - */ - -public class DateProcessor { - - /** - * JSON Based in/out Date Holiday Check Thunker - * - * @param jsonParameter JSON Date Request Parameters - * - * @return JSON Date Holiday Check Response - */ - - @SuppressWarnings ("unchecked") static final org.drip.json.simple.JSONObject IsHoliday ( - final org.drip.json.simple.JSONObject jsonParameter) - { - org.drip.analytics.date.JulianDate dt = org.drip.json.parser.Converter.DateEntry (jsonParameter, - "Date"); - - if (null == dt) return null; - - boolean bIsHoliday = false; - - try { - bIsHoliday = org.drip.analytics.daycount.Convention.IsHoliday (dt.julian(), - org.drip.json.parser.Converter.StringEntry (jsonParameter, "Calendar")); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.json.simple.JSONObject jsonResponse = new org.drip.json.simple.JSONObject(); - - jsonResponse.put ("IsHoliday", bIsHoliday); - - return jsonResponse; - } - - /** - * JSON Based in/out Date Adjustment Thunker - * - * @param jsonParameter JSON Date Request Parameters - * - * @return JSON Date Adjustment Response - */ - - @SuppressWarnings ("unchecked") static final org.drip.json.simple.JSONObject AdjustBusinessDays ( - final org.drip.json.simple.JSONObject jsonParameter) - { - org.drip.analytics.date.JulianDate dt = org.drip.json.parser.Converter.DateEntry (jsonParameter, - "Date"); - - if (null == dt) return null; - - java.lang.String strCalendar = org.drip.json.parser.Converter.StringEntry (jsonParameter, - "Calendar"); - - int iDaysToAdjust = 0; - - try { - iDaysToAdjust = org.drip.json.parser.Converter.IntegerEntry (jsonParameter, "DaysToAdjust"); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.analytics.date.JulianDate dtOut = dt.addBusDays (iDaysToAdjust, strCalendar); - - if (null == dtOut) return null; - - org.drip.json.simple.JSONObject jsonResponse = new org.drip.json.simple.JSONObject(); - - jsonResponse.put ("DateOut", dtOut.toString()); - - return jsonResponse; - } - - /** - * JSON Based in/out Date Offset Thunker - * - * @param jsonParameter JSON Date Request Parameters - * - * @return JSON Date Offset Response - */ - - @SuppressWarnings ("unchecked") static final org.drip.json.simple.JSONObject AddDays ( - final org.drip.json.simple.JSONObject jsonParameter) - { - org.drip.analytics.date.JulianDate dt = org.drip.json.parser.Converter.DateEntry (jsonParameter, - "Date"); - - if (null == dt) return null; - - int iDaysToAdd = 0; - - try { - iDaysToAdd = org.drip.json.parser.Converter.IntegerEntry (jsonParameter, "DaysToAdd"); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.analytics.date.JulianDate dtOut = dt.addDays (iDaysToAdd); - - if (null == dtOut) return null; - - org.drip.json.simple.JSONObject jsonResponse = new org.drip.json.simple.JSONObject(); - - jsonResponse.put ("DateOut", dtOut.toString()); - - return jsonResponse; - } -} diff --git a/org/drip/service/json/DepositProcessor.java b/org/drip/service/json/DepositProcessor.java deleted file mode 100644 index 915dece..0000000 --- a/org/drip/service/json/DepositProcessor.java +++ /dev/null @@ -1,141 +0,0 @@ - -package org.drip.service.json; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * DepositProcessor Sets Up and Executes a JSON Based In/Out Deposit Valuation Processor. - * - * @author Lakshmi Krishnamurthy - */ - -public class DepositProcessor { - - /** - * JSON Based in/out Deposit Curve Metrics Thunker - * - * @param jsonParameter JSON Deposit Request Parameters - * - * @return JSON Funding Deposit Curve Metrics Response - */ - - @SuppressWarnings ("unchecked") static final org.drip.json.simple.JSONObject CurveMetrics ( - final org.drip.json.simple.JSONObject jsonParameter) - { - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = - org.drip.service.json.LatentStateProcessor.FundingCurve (jsonParameter); - - if (null == dcFunding) return null; - - org.drip.param.market.CurveSurfaceQuoteContainer csqc = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - if (!csqc.setFundingState (dcFunding)) return null; - - org.drip.analytics.date.JulianDate dtSpot = dcFunding.epoch(); - - org.drip.product.rates.SingleStreamComponent deposit = - org.drip.service.template.OTCInstrumentBuilder.FundingDeposit (dtSpot, dcFunding.currency(), - org.drip.json.parser.Converter.StringEntry (jsonParameter, "DepositMaturity")); - - if (null == deposit) return null; - - java.util.Map mapResult = deposit.value - (org.drip.param.valuation.ValuationParams.Spot (dtSpot.julian()), null, csqc, null); - - if (null == mapResult) return null; - - org.drip.json.simple.JSONObject jsonResponse = new org.drip.json.simple.JSONObject(); - - for (java.util.Map.Entry me : mapResult.entrySet()) - jsonResponse.put (me.getKey(), me.getValue()); - - org.drip.json.simple.JSONArray jsonCashFlowArray = new org.drip.json.simple.JSONArray(); - - for (org.drip.analytics.cashflow.CompositePeriod cp : deposit.couponPeriods()) { - org.drip.json.simple.JSONObject jsonCashFlow = new org.drip.json.simple.JSONObject(); - - try { - jsonCashFlow.put ("StartDate", new org.drip.analytics.date.JulianDate - (cp.startDate()).toString()); - - jsonCashFlow.put ("EndDate", new org.drip.analytics.date.JulianDate - (cp.endDate()).toString()); - - jsonCashFlow.put ("PayDate", new org.drip.analytics.date.JulianDate - (cp.payDate()).toString()); - - jsonCashFlow.put ("FixingDate", new org.drip.analytics.date.JulianDate - (cp.fxFixingDate()).toString()); - - jsonCashFlow.put ("CouponDCF", cp.couponDCF()); - - jsonCashFlow.put ("PayDiscountFactor", cp.df (csqc)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - jsonCashFlow.put ("BaseNotional", cp.baseNotional()); - - jsonCashFlow.put ("Tenor", cp.tenor()); - - jsonCashFlow.put ("FundingLabel", cp.fundingLabel().fullyQualifiedName()); - - jsonCashFlow.put ("ForwardLabel", cp.forwardLabel().fullyQualifiedName()); - - jsonCashFlow.put ("ReferenceRate", cp.couponMetrics (dtSpot.julian(), csqc).rate()); - - jsonCashFlowArray.add (jsonCashFlow); - } - - jsonResponse.put ("FloatingCashFlow", jsonCashFlowArray); - - return jsonResponse; - } -} diff --git a/org/drip/service/json/FixFloatProcessor.java b/org/drip/service/json/FixFloatProcessor.java deleted file mode 100644 index cb2141d..0000000 --- a/org/drip/service/json/FixFloatProcessor.java +++ /dev/null @@ -1,190 +0,0 @@ - -package org.drip.service.json; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FixFloatProcessor Sets Up and Executes a JSON Based In/Out Fix Float Swap Valuation Processor. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixFloatProcessor { - - /** - * JSON Based in/out Funding Fix Float Curve Metrics Thunker - * - * @param jsonParameter JSON Funding Fix Float Request Parameters - * - * @return JSON Funding Fix Float Curve Metrics Response - */ - - @SuppressWarnings ("unchecked") static final org.drip.json.simple.JSONObject CurveMetrics ( - final org.drip.json.simple.JSONObject jsonParameter) - { - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = - org.drip.service.json.LatentStateProcessor.FundingCurve (jsonParameter); - - if (null == dcFunding) return null; - - org.drip.param.market.CurveSurfaceQuoteContainer csqc = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - if (!csqc.setFundingState (dcFunding)) return null; - - org.drip.analytics.date.JulianDate dtSpot = dcFunding.epoch(); - - org.drip.product.rates.FixFloatComponent irs = null; - - try { - irs = org.drip.service.template.OTCInstrumentBuilder.FixFloatStandard (dtSpot, - dcFunding.currency(), "ALL", org.drip.json.parser.Converter.StringEntry (jsonParameter, - "FixFloatMaturity"), "MAIN", org.drip.json.parser.Converter.DoubleEntry (jsonParameter, - "FixFloatCoupon")); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (null == irs) return null; - - java.util.Map mapResult = irs.value - (org.drip.param.valuation.ValuationParams.Spot (dtSpot.julian()), null, csqc, null); - - if (null == mapResult) return null; - - org.drip.json.simple.JSONObject jsonResponse = new org.drip.json.simple.JSONObject(); - - for (java.util.Map.Entry me : mapResult.entrySet()) - jsonResponse.put (me.getKey(), me.getValue()); - - org.drip.json.simple.JSONArray jsonFixedCashFlowArray = new org.drip.json.simple.JSONArray(); - - for (org.drip.analytics.cashflow.CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) { - org.drip.json.simple.JSONObject jsonCashFlow = new org.drip.json.simple.JSONObject(); - - try { - jsonCashFlow.put ("StartDate", new org.drip.analytics.date.JulianDate - (cp.startDate()).toString()); - - jsonCashFlow.put ("EndDate", new org.drip.analytics.date.JulianDate - (cp.endDate()).toString()); - - jsonCashFlow.put ("PayDate", new org.drip.analytics.date.JulianDate - (cp.payDate()).toString()); - - jsonCashFlow.put ("FixingDate", new org.drip.analytics.date.JulianDate - (cp.fxFixingDate()).toString()); - - jsonCashFlow.put ("CouponDCF", cp.couponDCF()); - - jsonCashFlow.put ("PayDiscountFactor", cp.df (csqc)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - jsonCashFlow.put ("BaseNotional", cp.baseNotional()); - - jsonCashFlow.put ("Tenor", cp.tenor()); - - jsonCashFlow.put ("FundingLabel", cp.fundingLabel().fullyQualifiedName()); - - jsonCashFlow.put ("ReferenceRate", cp.couponMetrics (dtSpot.julian(), csqc).rate()); - - jsonFixedCashFlowArray.add (jsonCashFlow); - } - - jsonResponse.put ("FixedCashFlow", jsonFixedCashFlowArray); - - org.drip.json.simple.JSONArray jsonFloatingCashFlowArray = new org.drip.json.simple.JSONArray(); - - for (org.drip.analytics.cashflow.CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) { - org.drip.json.simple.JSONObject jsonCashFlow = new org.drip.json.simple.JSONObject(); - - try { - jsonCashFlow.put ("StartDate", new org.drip.analytics.date.JulianDate - (cp.startDate()).toString()); - - jsonCashFlow.put ("EndDate", new org.drip.analytics.date.JulianDate - (cp.endDate()).toString()); - - jsonCashFlow.put ("PayDate", new org.drip.analytics.date.JulianDate - (cp.payDate()).toString()); - - jsonCashFlow.put ("FixingDate", new org.drip.analytics.date.JulianDate - (cp.fxFixingDate()).toString()); - - jsonCashFlow.put ("CouponDCF", cp.couponDCF()); - - jsonCashFlow.put ("PayDiscountFactor", cp.df (csqc)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - jsonCashFlow.put ("BaseNotional", cp.baseNotional()); - - jsonCashFlow.put ("Tenor", cp.tenor()); - - jsonCashFlow.put ("FundingLabel", cp.fundingLabel().fullyQualifiedName()); - - jsonCashFlow.put ("ForwardLabel", cp.forwardLabel().fullyQualifiedName()); - - jsonCashFlow.put ("ReferenceRate", cp.couponMetrics (dtSpot.julian(), csqc).rate()); - - jsonFloatingCashFlowArray.add (jsonCashFlow); - } - - jsonResponse.put ("FloatingCashFlow", jsonFloatingCashFlowArray); - - return jsonResponse; - } -} diff --git a/org/drip/service/json/FixedAssetBackedProcessor.java b/org/drip/service/json/FixedAssetBackedProcessor.java deleted file mode 100644 index b0e9268..0000000 --- a/org/drip/service/json/FixedAssetBackedProcessor.java +++ /dev/null @@ -1,290 +0,0 @@ - -package org.drip.service.json; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FixedAssetBackedProcessor Sets Up and Executes a JSON Based In/Out Product Constant Payment Asset Backed - * Loan Processor. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixedAssetBackedProcessor { - - /** - * JSON Based in/out Constant Payment Asset Backed Loan Secular Metrics Thunker - * - * @param jsonParameter JSON Constant Payment Asset Backed Loan Request Parameters - * - * @return JSON Constant Payment Asset Backed Loan Secular Metrics Response - */ - - @SuppressWarnings ("unchecked") static final org.drip.json.simple.JSONObject SecularMetrics ( - final org.drip.json.simple.JSONObject jsonParameter) - { - java.lang.String strBondName = org.drip.json.parser.Converter.StringEntry (jsonParameter, "Name"); - - java.lang.String strCurrency = org.drip.json.parser.Converter.StringEntry (jsonParameter, - "Currency"); - - java.lang.String strDayCount = org.drip.json.parser.Converter.StringEntry (jsonParameter, - "DayCount"); - - org.drip.analytics.date.JulianDate dtEffective = org.drip.json.parser.Converter.DateEntry - (jsonParameter, "EffectiveDate"); - - if (null == dtEffective) return null; - - int iEffectiveDate = dtEffective.julian(); - - org.drip.analytics.date.JulianDate dtSettle = org.drip.json.parser.Converter.DateEntry - (jsonParameter, "SettleDate"); - - if (null == dtSettle) return null; - - int iSettleDate = dtSettle.julian(); - - int iNumPayment = -1; - int iPayFrequency = -1; - double dblCleanPrice = 1.; - double dblCouponRate = java.lang.Double.NaN; - double dblBondNotional = java.lang.Double.NaN; - double dblServiceFeeRate = java.lang.Double.NaN; - double dblFixedMonthlyAmount = java.lang.Double.NaN; - double dblBeginPrincipalFactor = java.lang.Double.NaN; - - try { - iNumPayment = org.drip.json.parser.Converter.IntegerEntry (jsonParameter, "NumPayment"); - - dblCouponRate = org.drip.json.parser.Converter.DoubleEntry (jsonParameter, "CouponRate"); - - iPayFrequency = org.drip.json.parser.Converter.IntegerEntry (jsonParameter, "PayFrequency"); - - dblBondNotional = org.drip.json.parser.Converter.DoubleEntry (jsonParameter, "BondNotional"); - - dblServiceFeeRate = org.drip.json.parser.Converter.DoubleEntry (jsonParameter, "ServiceFeeRate"); - - dblFixedMonthlyAmount = org.drip.json.parser.Converter.DoubleEntry (jsonParameter, - "FixedMonthlyAmount"); - - dblBeginPrincipalFactor = org.drip.json.parser.Converter.DoubleEntry (jsonParameter, - "BeginPrincipalFactor"); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.product.definition.Bond fpmb = org.drip.product.creator.ConstantPaymentBondBuilder.Standard - (strBondName, dtEffective, strCurrency, iNumPayment, strDayCount, iPayFrequency, dblCouponRate, - dblServiceFeeRate, dblFixedMonthlyAmount, dblBondNotional); - - if (null == fpmb || fpmb.maturityDate().julian() <= iSettleDate) return null; - - org.drip.json.simple.JSONObject jsonResponse = new org.drip.json.simple.JSONObject(); - - org.drip.json.simple.JSONArray jsonCouponFlowArray = new org.drip.json.simple.JSONArray(); - - for (org.drip.analytics.cashflow.CompositePeriod cp : fpmb.couponPeriods()) { - org.drip.json.simple.JSONObject jsonCouponFlow = new org.drip.json.simple.JSONObject(); - - org.drip.analytics.output.CompositePeriodCouponMetrics cpcm = cp.couponMetrics (iEffectiveDate, - null); - - if (null == cpcm) return null; - - double dblPeriodCouponRate = cpcm.rate(); - - jsonCouponFlow.put ("FeeRate", dblServiceFeeRate); - - jsonCouponFlow.put ("CouponRate", dblPeriodCouponRate); - - jsonCouponFlow.put ("PrincipalFactor", dblBeginPrincipalFactor); - - try { - double dblEndPrincipalFactor = fpmb.notional (cp.endDate()); - - double dblYieldDF = org.drip.analytics.support.Helper.Yield2DF (iPayFrequency, dblCouponRate, - org.drip.analytics.daycount.Convention.YearFraction (dtEffective.julian(), cp.endDate(), - "30/360", false, null, strCurrency)); - - jsonCouponFlow.put ("StartDate", new org.drip.analytics.date.JulianDate - (cp.startDate()).toString()); - - jsonCouponFlow.put ("EndDate", new org.drip.analytics.date.JulianDate - (cp.endDate()).toString()); - - jsonCouponFlow.put ("PayDate", new org.drip.analytics.date.JulianDate - (cp.payDate()).toString()); - - double dblCouponDCF = cp.couponDCF(); - - jsonCouponFlow.put ("AccrualDays", dblCouponDCF * 365.); - - jsonCouponFlow.put ("AccrualFraction", dblCouponDCF); - - double dblCouponAmount = dblBeginPrincipalFactor * dblPeriodCouponRate * dblCouponDCF * - dblBondNotional; - double dblFeeAmount = dblBeginPrincipalFactor * dblServiceFeeRate * dblCouponDCF * - dblBondNotional; - double dblPrincipalAmount = (dblBeginPrincipalFactor - dblEndPrincipalFactor) * - dblBondNotional; - double dblTotalAmount = dblPrincipalAmount + dblCouponAmount; - dblBeginPrincipalFactor = dblEndPrincipalFactor; - double dblBeginNotional = dblBeginPrincipalFactor * dblBondNotional; - - jsonCouponFlow.put ("BeginPrincipal", dblBeginNotional); - - jsonCouponFlow.put ("Notional", dblBeginNotional); - - jsonCouponFlow.put ("EndPrincipal", dblEndPrincipalFactor * dblBondNotional); - - jsonCouponFlow.put ("PrincipalAmount", dblPrincipalAmount); - - jsonCouponFlow.put ("CouponAmount", dblCouponAmount); - - jsonCouponFlow.put ("TotalAmount", dblTotalAmount); - - jsonCouponFlow.put ("DiscountFactor", dblYieldDF); - - jsonCouponFlow.put ("FeeAmount", dblFeeAmount); - - jsonCouponFlow.put ("SurvivalFactor", 1.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - jsonCouponFlowArray.add (jsonCouponFlow); - } - - jsonResponse.put ("CouponFlow", jsonCouponFlowArray); - - jsonResponse.put ("CleanPrice", 100. * dblCleanPrice); - - jsonResponse.put ("Face", dblBondNotional); - - org.drip.analytics.date.JulianDate dtPreviousCouponDate = fpmb.previousCouponDate (dtSettle); - - if (null != dtPreviousCouponDate) { - jsonResponse.put ("AccrualDays", dtPreviousCouponDate.julian() - iSettleDate); - - jsonResponse.put ("PreviousCouponDate", dtPreviousCouponDate.toString()); - } - - org.drip.param.valuation.ValuationParams valParams = org.drip.param.valuation.ValuationParams.Spot - (iSettleDate); - - try { - double dblAccruedAmount = fpmb.accrued (iSettleDate, null) * dblBondNotional; - - double dblCurrentPrincipal = fpmb.notional (dtPreviousCouponDate.julian()) * dblBondNotional; - - double dblRisk = fpmb.yield01FromPrice (valParams, null, null, dblCleanPrice); - - jsonResponse.put ("Accrued", dblAccruedAmount); - - jsonResponse.put ("Convexity", fpmb.convexityFromPrice (valParams, null, null, dblCleanPrice)); - - jsonResponse.put ("CurrentPrincipal", dblCurrentPrincipal); - - jsonResponse.put ("DV01", dblRisk * dblBondNotional); - - jsonResponse.put ("ModifiedDuration", fpmb.modifiedDurationFromPrice (valParams, null, null, - dblCleanPrice)); - - jsonResponse.put ("Notional", dblBondNotional); - - jsonResponse.put ("NPV", dblCurrentPrincipal + dblAccruedAmount); - - jsonResponse.put ("Risk", dblRisk); - - jsonResponse.put ("SettleDate", dtSettle.toString()); - - jsonResponse.put ("Total", dblCurrentPrincipal + dblAccruedAmount); - - jsonResponse.put ("Yield", fpmb.yieldFromPrice (valParams, null, null, dblCleanPrice)); - - jsonResponse.put ("Yield01", dblRisk); - - jsonResponse.put ("Y01", dblRisk); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = - org.drip.service.json.LatentStateProcessor.FundingCurve (jsonParameter); - - if (null == dcFunding) return jsonResponse; - - org.drip.param.market.CurveSurfaceQuoteContainer csqc = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - if (!csqc.setFundingState (dcFunding)) return jsonResponse; - - try { - jsonResponse.put ("DiscountedPrice", fpmb.priceFromDiscountMargin (valParams, csqc, null, 0.)); - } catch (java.lang.Exception e) { - } - - if (!csqc.setCreditState (org.drip.service.json.LatentStateProcessor.CreditCurve (jsonParameter, - dcFunding))) - return jsonResponse; - - try { - jsonResponse.put ("DiscountedCreditPrice", fpmb.priceFromCreditBasis (valParams, csqc, null, - 0.)); - } catch (java.lang.Exception e) { - } - - return jsonResponse; - } -} diff --git a/org/drip/service/json/ForwardRateFuturesProcessor.java b/org/drip/service/json/ForwardRateFuturesProcessor.java deleted file mode 100644 index c5dfcca..0000000 --- a/org/drip/service/json/ForwardRateFuturesProcessor.java +++ /dev/null @@ -1,143 +0,0 @@ - -package org.drip.service.json; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ForwardRateFuturesProcessor Sets Up and Executes a JSON Based In/Out Forward Rate Futures Valuation - * Processor. - * - * @author Lakshmi Krishnamurthy - */ - -public class ForwardRateFuturesProcessor { - - /** - * JSON Based in/out Funding Futures Curve Metrics Thunker - * - * @param jsonParameter JSON Funding Futures Request Parameters - * - * @return JSON Funding Futures Curve Metrics Response - */ - - @SuppressWarnings ("unchecked") static final org.drip.json.simple.JSONObject CurveMetrics ( - final org.drip.json.simple.JSONObject jsonParameter) - { - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = - org.drip.service.json.LatentStateProcessor.FundingCurve (jsonParameter); - - if (null == dcFunding) return null; - - org.drip.param.market.CurveSurfaceQuoteContainer csqc = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - if (!csqc.setFundingState (dcFunding)) return null; - - org.drip.analytics.date.JulianDate dtSpot = dcFunding.epoch(); - - org.drip.product.rates.SingleStreamComponent futures = - org.drip.service.template.ExchangeInstrumentBuilder.ForwardRateFutures (dtSpot.addTenor - (org.drip.json.parser.Converter.StringEntry (jsonParameter, "FuturesEffectiveTenor")), - dcFunding.currency()); - - if (null == futures) return null; - - java.util.Map mapResult = futures.value - (org.drip.param.valuation.ValuationParams.Spot (dtSpot.julian()), null, csqc, null); - - if (null == mapResult) return null; - - org.drip.json.simple.JSONObject jsonResponse = new org.drip.json.simple.JSONObject(); - - for (java.util.Map.Entry me : mapResult.entrySet()) - jsonResponse.put (me.getKey(), me.getValue()); - - org.drip.json.simple.JSONArray jsonCashFlowArray = new org.drip.json.simple.JSONArray(); - - for (org.drip.analytics.cashflow.CompositePeriod cp : futures.couponPeriods()) { - org.drip.json.simple.JSONObject jsonCashFlow = new org.drip.json.simple.JSONObject(); - - try { - jsonCashFlow.put ("StartDate", new org.drip.analytics.date.JulianDate - (cp.startDate()).toString()); - - jsonCashFlow.put ("EndDate", new org.drip.analytics.date.JulianDate - (cp.endDate()).toString()); - - jsonCashFlow.put ("PayDate", new org.drip.analytics.date.JulianDate - (cp.payDate()).toString()); - - jsonCashFlow.put ("FixingDate", new org.drip.analytics.date.JulianDate - (cp.fxFixingDate()).toString()); - - jsonCashFlow.put ("CouponDCF", cp.couponDCF()); - - jsonCashFlow.put ("PayDiscountFactor", cp.df (csqc)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - jsonCashFlow.put ("BaseNotional", cp.baseNotional()); - - jsonCashFlow.put ("Tenor", cp.tenor()); - - jsonCashFlow.put ("FundingLabel", cp.fundingLabel().fullyQualifiedName()); - - jsonCashFlow.put ("ForwardLabel", cp.forwardLabel().fullyQualifiedName()); - - jsonCashFlow.put ("ReferenceRate", cp.couponMetrics (dtSpot.julian(), csqc).rate()); - - jsonCashFlowArray.add (jsonCashFlow); - } - - jsonResponse.put ("FloatingCashFlow", jsonCashFlowArray); - - return jsonResponse; - } -} diff --git a/org/drip/service/json/KeyHoleSkeleton.java b/org/drip/service/json/KeyHoleSkeleton.java deleted file mode 100644 index 5b7754d..0000000 --- a/org/drip/service/json/KeyHoleSkeleton.java +++ /dev/null @@ -1,165 +0,0 @@ - -package org.drip.service.json; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * KeyHoleSkeleton forwards the JSON Request to the Appropriate Processor and retrieves the Response JSON. - * - * @author Lakshmi Krishnamurthy - */ - -public class KeyHoleSkeleton { - - /** - * JSON Based in/out Generic Thunker - * - * @param jsonInput JSON Request - * - * @return JSON Response - */ - - public static final org.drip.json.simple.JSONObject Thunker ( - final org.drip.json.simple.JSONObject jsonInput) - { - if (null == jsonInput || !jsonInput.containsKey ("API") || !jsonInput.containsKey ("Parameters")) - return null; - - java.lang.Object objAPIName = jsonInput.get ("API"); - - if (!(objAPIName instanceof java.lang.String)) return null; - - java.lang.String strAPIName = (java.lang.String) objAPIName; - - org.drip.service.env.EnvManager.InitEnv (""); - - java.lang.Object objParameter = jsonInput.get ("Parameters"); - - if (null == objParameter) return null; - - org.drip.json.simple.JSONObject jsonParameter = (org.drip.json.simple.JSONObject) - org.drip.json.simple.JSONValue.parse (objParameter.toString()); - - if ("DATE::ISHOLIDAY".equalsIgnoreCase (strAPIName)) - return org.drip.service.json.DateProcessor.IsHoliday (jsonParameter); - - if ("DATE::ADDDAYS".equalsIgnoreCase (strAPIName)) - return org.drip.service.json.DateProcessor.AddDays (jsonParameter); - - if ("DATE::ADJUSTBUSINESSDAYS".equalsIgnoreCase (strAPIName)) - return org.drip.service.json.DateProcessor.AdjustBusinessDays (jsonParameter); - - if ("FUNDINGSTATE".equalsIgnoreCase (strAPIName)) - return org.drip.service.json.LatentStateProcessor.FundingCurveThunker (jsonParameter); - - if ("CREDITSTATE".equalsIgnoreCase (strAPIName)) - return org.drip.service.json.LatentStateProcessor.CreditCurveThunker (jsonParameter); - - if ("DEPOSIT::SECULARMETRICS".equalsIgnoreCase (strAPIName)) return null; - - if ("DEPOSIT::CURVEMETRICS".equalsIgnoreCase (strAPIName)) - return org.drip.service.json.DepositProcessor.CurveMetrics (jsonParameter); - - if ("FORWARDRATEFUTURES::SECULARMETRICS".equalsIgnoreCase (strAPIName)) return null; - - if ("FORWARDRATEFUTURES::CURVEMETRICS".equalsIgnoreCase (strAPIName)) - return org.drip.service.json.ForwardRateFuturesProcessor.CurveMetrics (jsonParameter); - - if ("FIXFLOAT::SECULARMETRICS".equalsIgnoreCase (strAPIName)) - return org.drip.service.json.FixFloatProcessor.CurveMetrics (jsonParameter); - - if ("CREDITDEFAULTSWAP::SECULARMETRICS".equalsIgnoreCase (strAPIName)) return null; - - if ("CREDITDEFAULTSWAP::CURVEMETRICS".equalsIgnoreCase (strAPIName)) - return org.drip.service.json.CreditDefaultSwapProcessor.CurveMetrics (jsonParameter); - - if ("FIXEDASSETBACKED::SECULARMETRICS".equalsIgnoreCase (strAPIName)) - return org.drip.service.json.FixedAssetBackedProcessor.SecularMetrics (jsonParameter); - - if ("PORTFOLIOALLOCATION::BUDGETCONSTRAINEDMEANVARIANCE".equalsIgnoreCase (strAPIName)) - return org.drip.json.assetallocation.PortfolioConstructionProcessor.BudgetConstrainedAllocator - (jsonParameter); - - if ("PORTFOLIOALLOCATION::RETURNSCONSTRAINEDMEANVARIANCE".equalsIgnoreCase (strAPIName)) - return org.drip.json.assetallocation.PortfolioConstructionProcessor.ReturnsConstrainedAllocator - (jsonParameter); - - if ("PREPAYASSETBACKED::SECULARMETRICS".equalsIgnoreCase (strAPIName)) - return org.drip.service.json.PrepayAssetBackedProcessor.SecularMetrics (jsonParameter); - - if ("TREASURYBOND::SECULARMETRICS".equalsIgnoreCase (strAPIName)) - return org.drip.service.json.TreasuryBondProcessor.SecularMetrics (jsonParameter); - - if ("BLACKLITTERMAN::BAYESIANMETRICS".equalsIgnoreCase (strAPIName)) - return org.drip.json.assetallocation.BlackLittermanProcessor.Estimate (jsonParameter); - - return null; - } - - /** - * JSON String Based in/out Generic Thunker - * - * @param strJSONRequest JSON String Request - * - * @return JSON String Response - */ - - public static final java.lang.String Thunker ( - final java.lang.String strJSONRequest) - { - if (null == strJSONRequest || strJSONRequest.isEmpty()) return null; - - java.lang.Object objInput = org.drip.json.simple.JSONValue.parse (strJSONRequest); - - if (null == objInput || !(objInput instanceof org.drip.json.simple.JSONObject)) return null; - - org.drip.json.simple.JSONObject jsonResponse = Thunker ((org.drip.json.simple.JSONObject) objInput); - - return null == jsonResponse ? null : jsonResponse.toJSONString(); - } -} diff --git a/org/drip/service/json/LatentStateProcessor.java b/org/drip/service/json/LatentStateProcessor.java deleted file mode 100644 index d0457e8..0000000 --- a/org/drip/service/json/LatentStateProcessor.java +++ /dev/null @@ -1,315 +0,0 @@ - -package org.drip.service.json; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * LatentStateProcessor Sets Up and Executes a JSON Based In/Out Curve Processor. - * - * @author Lakshmi Krishnamurthy - */ - -public class LatentStateProcessor { - - static final org.drip.state.discount.MergedDiscountForwardCurve FundingCurve ( - final org.drip.json.simple.JSONObject jsonParameter) - { - org.drip.analytics.date.JulianDate dtSpot = org.drip.json.parser.Converter.DateEntry (jsonParameter, - "SpotDate"); - - java.lang.String strCurrency = org.drip.json.parser.Converter.StringEntry (jsonParameter, - "Currency"); - - java.lang.String[] astrDepositMaturityTenor = org.drip.json.parser.Converter.StringArrayEntry - (jsonParameter, "DepositTenor"); - - double[] adblDepositQuote = org.drip.json.parser.Converter.DoubleArrayEntry (jsonParameter, - "DepositQuote"); - - double[] adblFuturesQuote = org.drip.json.parser.Converter.DoubleArrayEntry (jsonParameter, - "FuturesQuote"); - - java.lang.String[] astrFixFloatMaturityTenor = org.drip.json.parser.Converter.StringArrayEntry - (jsonParameter, "FixFloatTenor"); - - double[] adblFixFloatQuote = org.drip.json.parser.Converter.DoubleArrayEntry (jsonParameter, - "FixFloatQuote"); - - return org.drip.service.template.LatentMarketStateBuilder.SmoothFundingCurve (dtSpot, strCurrency, - astrDepositMaturityTenor, adblDepositQuote, "ForwardRate", adblFuturesQuote, "ForwardRate", - astrFixFloatMaturityTenor, adblFixFloatQuote, "SwapRate"); - } - - static final org.drip.state.credit.CreditCurve CreditCurve ( - final org.drip.json.simple.JSONObject jsonParameter, - final org.drip.state.discount.MergedDiscountForwardCurve dcFunding) - { - if (null == dcFunding) return null; - - java.lang.String strReferenceEntity = org.drip.json.parser.Converter.StringEntry (jsonParameter, - "ReferenceEntity"); - - java.lang.String[] astrCDSMaturityTenor = org.drip.json.parser.Converter.StringArrayEntry - (jsonParameter, "CDSTenor"); - - double[] adblCDSQuote = org.drip.json.parser.Converter.DoubleArrayEntry (jsonParameter, "CDSQuote"); - - return org.drip.service.template.LatentMarketStateBuilder.CreditCurve (dcFunding.epoch(), - strReferenceEntity, astrCDSMaturityTenor, adblCDSQuote, adblCDSQuote, "FairPremium", dcFunding); - } - - /** - * JSON Based in/out Funding Curve Sample - * - * @param jsonParameter JSON Funding Curve Request Parameters - * - * @return JSON Funding Curve Response - */ - - @SuppressWarnings ("unchecked") static final org.drip.json.simple.JSONObject FundingCurveThunker ( - final org.drip.json.simple.JSONObject jsonParameter) - { - org.drip.analytics.date.JulianDate dtSpot = org.drip.json.parser.Converter.DateEntry (jsonParameter, - "SpotDate"); - - java.lang.String strCurrency = org.drip.json.parser.Converter.StringEntry (jsonParameter, - "Currency"); - - java.lang.String[] astrDepositMaturityTenor = org.drip.json.parser.Converter.StringArrayEntry - (jsonParameter, "DepositTenor"); - - double[] adblDepositQuote = org.drip.json.parser.Converter.DoubleArrayEntry (jsonParameter, - "DepositQuote"); - - double[] adblFuturesQuote = org.drip.json.parser.Converter.DoubleArrayEntry (jsonParameter, - "FuturesQuote"); - - java.lang.String[] astrFixFloatMaturityTenor = org.drip.json.parser.Converter.StringArrayEntry - (jsonParameter, "FixFloatTenor"); - - double[] adblFixFloatQuote = org.drip.json.parser.Converter.DoubleArrayEntry (jsonParameter, - "FixFloatQuote"); - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = - org.drip.service.template.LatentMarketStateBuilder.SmoothFundingCurve (dtSpot, strCurrency, - astrDepositMaturityTenor, adblDepositQuote, "ForwardRate", adblFuturesQuote, "ForwardRate", - astrFixFloatMaturityTenor, adblFixFloatQuote, "SwapRate"); - - if (null == dcFunding) return null; - - int iNumDeposit = null == adblDepositQuote ? 0 : adblDepositQuote.length; - int iNumFutures = null == adblFuturesQuote ? 0 : adblFuturesQuote.length; - int iNumFixFloat = null == adblFixFloatQuote ? 0 : adblFixFloatQuote.length; - - org.drip.json.simple.JSONArray jsonDepositArray = new org.drip.json.simple.JSONArray(); - - for (int i = 0; i < iNumDeposit; ++i) { - org.drip.json.simple.JSONObject jsonDeposit = new org.drip.json.simple.JSONObject(); - - jsonDeposit.put ("InstrumentType", "DEPOSIT"); - - jsonDeposit.put ("MaturityTenor", astrDepositMaturityTenor[i]); - - jsonDeposit.put ("InstrumentQuote", adblDepositQuote[i]); - - jsonDeposit.put ("CalibrationMeasure", "ForwardRate"); - - try { - jsonDeposit.put ("DiscountFactor", dcFunding.df (astrDepositMaturityTenor[i])); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - jsonDepositArray.add (i, jsonDeposit); - } - - org.drip.json.simple.JSONArray jsonFuturesArray = new org.drip.json.simple.JSONArray(); - - for (int i = 0; i < iNumFutures; ++i) { - org.drip.json.simple.JSONObject jsonFutures = new org.drip.json.simple.JSONObject(); - - jsonFutures.put ("InstrumentType", "FUTURES"); - - jsonFutures.put ("InstrumentQuote", adblFuturesQuote[i]); - - jsonFutures.put ("CalibrationMeasure", "ForwardRate"); - - try { - jsonFutures.put ("DiscountFactor", dcFunding.df ((3 + 3 * i) + "M")); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - jsonFuturesArray.add (i, jsonFutures); - } - - org.drip.json.simple.JSONArray jsonFixFloatArray = new org.drip.json.simple.JSONArray(); - - for (int i = 0; i < iNumFixFloat; ++i) { - org.drip.json.simple.JSONObject jsonFixFloat = new org.drip.json.simple.JSONObject(); - - jsonFixFloat.put ("InstrumentType", "FIXFLOAT"); - - jsonFixFloat.put ("MaturityTenor", astrFixFloatMaturityTenor[i]); - - jsonFixFloat.put ("InstrumentQuote", adblFixFloatQuote[i]); - - jsonFixFloat.put ("CalibrationMeasure", "SwapRate"); - - try { - jsonFixFloat.put ("DiscountFactor", dcFunding.df (astrFixFloatMaturityTenor[i])); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - jsonFixFloatArray.add (i, jsonFixFloat); - } - - org.drip.json.simple.JSONObject jsonResponse = new org.drip.json.simple.JSONObject(); - - jsonResponse.put ("SpotDate", dtSpot.toString()); - - jsonResponse.put ("Currency", strCurrency); - - jsonResponse.put ("FundingLabel", dcFunding.label().fullyQualifiedName()); - - jsonResponse.put ("DepositMetrics", jsonDepositArray); - - jsonResponse.put ("FuturesMetrics", jsonFuturesArray); - - jsonResponse.put ("FixFloatMetrics", jsonFixFloatArray); - - return jsonResponse; - } - - /** - * JSON Based in/out Credit Curve Sample - * - * @param jsonParameter JSON Credit Curve Request Parameters - * - * @return JSON Credit Curve Response - */ - - @SuppressWarnings ("unchecked") static final org.drip.json.simple.JSONObject CreditCurveThunker ( - final org.drip.json.simple.JSONObject jsonParameter) - { - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = FundingCurve (jsonParameter); - - if (null == dcFunding) return null; - - java.lang.String strReferenceEntity = org.drip.json.parser.Converter.StringEntry (jsonParameter, - "ReferenceEntity"); - - java.lang.String[] astrCDSMaturityTenor = org.drip.json.parser.Converter.StringArrayEntry - (jsonParameter, "CDSTenor"); - - double[] adblCDSQuote = org.drip.json.parser.Converter.DoubleArrayEntry (jsonParameter, "CDSQuote"); - - org.drip.analytics.date.JulianDate dtSpot = dcFunding.epoch(); - - org.drip.state.credit.CreditCurve ccSurvivalRecovery = - org.drip.service.template.LatentMarketStateBuilder.CreditCurve (dtSpot, strReferenceEntity, - astrCDSMaturityTenor, adblCDSQuote, adblCDSQuote, "FairPremium", dcFunding); - - if (null == ccSurvivalRecovery) return null; - - int iNumCDS = null == adblCDSQuote ? 0 : adblCDSQuote.length; - - String strLatentStateLabel = ccSurvivalRecovery.label().fullyQualifiedName(); - - org.drip.json.simple.JSONArray jsonCDSArray = new org.drip.json.simple.JSONArray(); - - for (int i = 0; i < iNumCDS; ++i) { - org.drip.json.simple.JSONObject jsonCDS = new org.drip.json.simple.JSONObject(); - - jsonCDS.put ("ReferenceEntity", strLatentStateLabel); - - jsonCDS.put ("InstrumentType", "CDS"); - - jsonCDS.put ("MaturityTenor", astrCDSMaturityTenor[i]); - - jsonCDS.put ("InstrumentQuote", adblCDSQuote[i]); - - jsonCDS.put ("CalibrationMeasure", "FairPremium"); - - try { - jsonCDS.put ("SurvivalProbability", ccSurvivalRecovery.survival (astrCDSMaturityTenor[i])); - - jsonCDS.put ("Recovery", ccSurvivalRecovery.recovery (astrCDSMaturityTenor[i])); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - jsonCDSArray.add (i, jsonCDS); - } - - org.drip.json.simple.JSONObject jsonResponse = new org.drip.json.simple.JSONObject(); - - jsonResponse.put ("SpotDate", dtSpot.toString()); - - jsonResponse.put ("Currency", dcFunding.currency()); - - jsonResponse.put ("ReferenceEntity", strReferenceEntity); - - jsonResponse.put ("CreditLabel", strLatentStateLabel); - - jsonResponse.put ("FundingLabel", dcFunding.label().fullyQualifiedName()); - - jsonResponse.put ("CDSMetrics", jsonCDSArray); - - return jsonResponse; - } -} diff --git a/org/drip/service/json/PrepayAssetBackedProcessor.java b/org/drip/service/json/PrepayAssetBackedProcessor.java deleted file mode 100644 index c4b1fd0..0000000 --- a/org/drip/service/json/PrepayAssetBackedProcessor.java +++ /dev/null @@ -1,294 +0,0 @@ - -package org.drip.service.json; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * PrepayAssetBackedProcessor Sets Up and Executes a JSON Based In/Out Product Pre-payable Asset Backed Loan - * Processor. - * - * @author Lakshmi Krishnamurthy - */ - -public class PrepayAssetBackedProcessor { - - /** - * JSON Based in/out Pre-Payable Asset Backed Loan Secular Metrics Thunker - * - * @param jsonParameter JSON Pre-Payable Asset Backed Loan Request Parameters - * - * @return JSON Pre-Payable Asset Backed Loan Secular Metrics Response - */ - - @SuppressWarnings ("unchecked") static final org.drip.json.simple.JSONObject SecularMetrics ( - final org.drip.json.simple.JSONObject jsonParameter) - { - java.lang.String strBondName = org.drip.json.parser.Converter.StringEntry (jsonParameter, "Name"); - - java.lang.String strCurrency = org.drip.json.parser.Converter.StringEntry (jsonParameter, - "Currency"); - - java.lang.String strDayCount = org.drip.json.parser.Converter.StringEntry (jsonParameter, - "DayCount"); - - org.drip.analytics.date.JulianDate dtEffective = org.drip.json.parser.Converter.DateEntry - (jsonParameter, "EffectiveDate"); - - if (null == dtEffective) return null; - - int iEffectiveDate = dtEffective.julian(); - - org.drip.analytics.date.JulianDate dtSettle = org.drip.json.parser.Converter.DateEntry - (jsonParameter, "SettleDate"); - - if (null == dtSettle) return null; - - int iSettleDate = dtSettle.julian(); - - int iNumPayment = -1; - int iPayFrequency = -1; - double dblCleanPrice = 1.; - double dblCPR = java.lang.Double.NaN; - double dblCouponRate = java.lang.Double.NaN; - double dblBondNotional = java.lang.Double.NaN; - double dblServiceFeeRate = java.lang.Double.NaN; - double dblFixedMonthlyAmount = java.lang.Double.NaN; - double dblBeginPrincipalFactor = java.lang.Double.NaN; - - try { - dblCPR = org.drip.json.parser.Converter.DoubleEntry (jsonParameter, "CPR"); - - iNumPayment = org.drip.json.parser.Converter.IntegerEntry (jsonParameter, "NumPayment"); - - dblCouponRate = org.drip.json.parser.Converter.DoubleEntry (jsonParameter, "CouponRate"); - - iPayFrequency = org.drip.json.parser.Converter.IntegerEntry (jsonParameter, "PayFrequency"); - - dblBondNotional = org.drip.json.parser.Converter.DoubleEntry (jsonParameter, "BondNotional"); - - dblServiceFeeRate = org.drip.json.parser.Converter.DoubleEntry (jsonParameter, "ServiceFeeRate"); - - dblFixedMonthlyAmount = org.drip.json.parser.Converter.DoubleEntry (jsonParameter, - "FixedMonthlyAmount"); - - dblBeginPrincipalFactor = org.drip.json.parser.Converter.DoubleEntry (jsonParameter, - "BeginPrincipalFactor"); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.product.definition.Bond fpmb = org.drip.product.creator.ConstantPaymentBondBuilder.Prepay - (strBondName, dtEffective, strCurrency, iNumPayment, strDayCount, iPayFrequency, dblCouponRate, - dblServiceFeeRate, dblCPR, dblFixedMonthlyAmount, dblBondNotional); - - if (null == fpmb || fpmb.maturityDate().julian() <= iSettleDate) return null; - - org.drip.json.simple.JSONObject jsonResponse = new org.drip.json.simple.JSONObject(); - - org.drip.json.simple.JSONArray jsonCouponFlowArray = new org.drip.json.simple.JSONArray(); - - for (org.drip.analytics.cashflow.CompositePeriod cp : fpmb.couponPeriods()) { - org.drip.json.simple.JSONObject jsonCouponFlow = new org.drip.json.simple.JSONObject(); - - org.drip.analytics.output.CompositePeriodCouponMetrics cpcm = cp.couponMetrics (iEffectiveDate, - null); - - if (null == cpcm) return null; - - double dblPeriodCouponRate = cpcm.rate(); - - jsonCouponFlow.put ("FeeRate", dblServiceFeeRate); - - jsonCouponFlow.put ("CouponRate", dblPeriodCouponRate); - - jsonCouponFlow.put ("PrincipalFactor", dblBeginPrincipalFactor); - - try { - double dblEndPrincipalFactor = fpmb.notional (cp.endDate()); - - double dblYieldDF = org.drip.analytics.support.Helper.Yield2DF (iPayFrequency, dblCouponRate, - org.drip.analytics.daycount.Convention.YearFraction (dtEffective.julian(), cp.endDate(), - "30/360", false, null, strCurrency)); - - jsonCouponFlow.put ("StartDate", new org.drip.analytics.date.JulianDate - (cp.startDate()).toString()); - - jsonCouponFlow.put ("EndDate", new org.drip.analytics.date.JulianDate - (cp.endDate()).toString()); - - jsonCouponFlow.put ("PayDate", new org.drip.analytics.date.JulianDate - (cp.payDate()).toString()); - - double dblCouponDCF = cp.couponDCF(); - - jsonCouponFlow.put ("AccrualDays", dblCouponDCF * 365.); - - jsonCouponFlow.put ("AccrualFraction", dblCouponDCF); - - double dblCouponAmount = dblBeginPrincipalFactor * dblPeriodCouponRate * dblCouponDCF * - dblBondNotional; - double dblFeeAmount = dblBeginPrincipalFactor * dblServiceFeeRate * dblCouponDCF * - dblBondNotional; - double dblPrincipalAmount = (dblBeginPrincipalFactor - dblEndPrincipalFactor) * - dblBondNotional; - double dblTotalAmount = dblPrincipalAmount + dblCouponAmount; - dblBeginPrincipalFactor = dblEndPrincipalFactor; - double dblBeginNotional = dblBeginPrincipalFactor * dblBondNotional; - - jsonCouponFlow.put ("BeginPrincipal", dblBeginNotional); - - jsonCouponFlow.put ("Notional", dblBeginNotional); - - jsonCouponFlow.put ("EndPrincipal", dblEndPrincipalFactor * dblBondNotional); - - jsonCouponFlow.put ("PrincipalAmount", dblPrincipalAmount); - - jsonCouponFlow.put ("CouponAmount", dblCouponAmount); - - jsonCouponFlow.put ("TotalAmount", dblTotalAmount); - - jsonCouponFlow.put ("DiscountFactor", dblYieldDF); - - jsonCouponFlow.put ("FeeAmount", dblFeeAmount); - - jsonCouponFlow.put ("SurvivalFactor", 1.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - jsonCouponFlowArray.add (jsonCouponFlow); - } - - jsonResponse.put ("CouponFlow", jsonCouponFlowArray); - - jsonResponse.put ("CleanPrice", 100. * dblCleanPrice); - - jsonResponse.put ("Face", dblBondNotional); - - org.drip.analytics.date.JulianDate dtPreviousCouponDate = fpmb.previousCouponDate (dtSettle); - - if (null != dtPreviousCouponDate) { - jsonResponse.put ("AccrualDays", dtPreviousCouponDate.julian() - iSettleDate); - - jsonResponse.put ("PreviousCouponDate", dtPreviousCouponDate.toString()); - } - - org.drip.param.valuation.ValuationParams valParams = org.drip.param.valuation.ValuationParams.Spot - (iSettleDate); - - try { - double dblAccruedAmount = fpmb.accrued (iSettleDate, null) * dblBondNotional; - - double dblCurrentPrincipal = fpmb.notional (dtPreviousCouponDate.julian()) * dblBondNotional; - - double dblRisk = fpmb.yield01FromPrice (valParams, null, null, dblCleanPrice); - - jsonResponse.put ("Accrued", dblAccruedAmount); - - jsonResponse.put ("Convexity", fpmb.convexityFromPrice (valParams, null, null, dblCleanPrice)); - - jsonResponse.put ("CurrentPrincipal", dblCurrentPrincipal); - - jsonResponse.put ("DV01", dblRisk * dblBondNotional); - - jsonResponse.put ("ModifiedDuration", fpmb.modifiedDurationFromPrice (valParams, null, null, - dblCleanPrice)); - - jsonResponse.put ("Notional", dblBondNotional); - - jsonResponse.put ("NPV", dblCurrentPrincipal + dblAccruedAmount); - - jsonResponse.put ("Risk", dblRisk); - - jsonResponse.put ("SettleDate", dtSettle.toString()); - - jsonResponse.put ("Total", dblCurrentPrincipal + dblAccruedAmount); - - jsonResponse.put ("Yield", fpmb.yieldFromPrice (valParams, null, null, dblCleanPrice)); - - jsonResponse.put ("Yield01", dblRisk); - - jsonResponse.put ("Y01", dblRisk); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = - org.drip.service.json.LatentStateProcessor.FundingCurve (jsonParameter); - - if (null == dcFunding) return jsonResponse; - - org.drip.param.market.CurveSurfaceQuoteContainer csqc = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - if (!csqc.setFundingState (dcFunding)) return jsonResponse; - - try { - jsonResponse.put ("DiscountedPrice", fpmb.priceFromDiscountMargin (valParams, csqc, null, 0.)); - } catch (java.lang.Exception e) { - } - - if (!csqc.setCreditState (org.drip.service.json.LatentStateProcessor.CreditCurve (jsonParameter, - dcFunding))) - return jsonResponse; - - try { - jsonResponse.put ("DiscountedCreditPrice", fpmb.priceFromCreditBasis (valParams, csqc, null, - 0.)); - } catch (java.lang.Exception e) { - } - - return jsonResponse; - } - -} diff --git a/org/drip/service/json/TreasuryBondProcessor.java b/org/drip/service/json/TreasuryBondProcessor.java deleted file mode 100644 index 8eaa4d8..0000000 --- a/org/drip/service/json/TreasuryBondProcessor.java +++ /dev/null @@ -1,223 +0,0 @@ - -package org.drip.service.json; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * - * This file is part of DRIP, a free-software/open-source library for fixed income analysts and developers - - * http://www.credit-trader.org/Begin.html - * - * DRIP is a free, full featured, fixed income rates, credit, and FX analytics library with a focus towards - * pricing/valuation, risk, and market making. - * - * 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. - */ - -/** - * TreasuryBondProcessor Sets Up and Executes a JSON Based In/Out Processing Service for Treasury Bonds. - * - * @author Lakshmi Krishnamurthy - */ - -public class TreasuryBondProcessor { - - /** - * JSON Based in/out Treasury Bond Secular Metrics Thunker - * - * @param jsonParameter JSON Treasury Bond Request Parameters - * - * @return JSON Treasury Bond Secular Metrics Response - */ - - @SuppressWarnings ("unchecked") static final org.drip.json.simple.JSONObject SecularMetrics ( - final org.drip.json.simple.JSONObject jsonParameter) - { - java.lang.String strTreasuryCode = org.drip.json.parser.Converter.StringEntry (jsonParameter, - "TreasuryCode"); - - org.drip.analytics.date.JulianDate dtEffective = org.drip.json.parser.Converter.DateEntry - (jsonParameter, "EffectiveDate"); - - if (null == dtEffective) return null; - - int iEffectiveDate = dtEffective.julian(); - - org.drip.analytics.date.JulianDate dtMaturity = org.drip.json.parser.Converter.DateEntry - (jsonParameter, "MaturityDate"); - - if (null == dtMaturity) return null; - - org.drip.analytics.date.JulianDate dtSettle = org.drip.json.parser.Converter.DateEntry - (jsonParameter, "SettleDate"); - - if (null == dtSettle) return null; - - int iSettleDate = dtSettle.julian(); - - double dblYield = java.lang.Double.NaN; - double dblCoupon = java.lang.Double.NaN; - double dblNotional = java.lang.Double.NaN; - double dblCleanPrice = java.lang.Double.NaN; - - try { - dblCoupon = org.drip.json.parser.Converter.DoubleEntry (jsonParameter, "Coupon"); - - dblNotional = org.drip.json.parser.Converter.DoubleEntry (jsonParameter, "Notional"); - - dblCleanPrice = org.drip.json.parser.Converter.DoubleEntry (jsonParameter, "CleanPrice"); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.market.issue.TreasurySetting ts = - org.drip.market.issue.TreasurySettingContainer.TreasurySetting (strTreasuryCode); - - if (null == ts) return null; - - int iFrequency = ts.frequency(); - - java.lang.String strDayCount = ts.dayCount(); - - org.drip.product.definition.Bond tsy = org.drip.product.creator.BondBuilder.Treasury (ts.code(), - dtEffective, dtMaturity, ts.currency(), dblCoupon, iFrequency, strDayCount); - - if (null == tsy || tsy.maturityDate().julian() <= iSettleDate) return null; - - java.lang.String strCurrency = tsy.payCurrency(); - - org.drip.param.valuation.ValuationParams valParams = org.drip.param.valuation.ValuationParams.Spot - (iSettleDate); - - try { - dblYield = tsy.yield01FromPrice (valParams, null, null, dblCleanPrice); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.json.simple.JSONObject jsonResponse = new org.drip.json.simple.JSONObject(); - - org.drip.json.simple.JSONArray jsonCouponFlowArray = new org.drip.json.simple.JSONArray(); - - for (org.drip.analytics.cashflow.CompositePeriod cp : tsy.couponPeriods()) { - org.drip.json.simple.JSONObject jsonCouponFlow = new org.drip.json.simple.JSONObject(); - - org.drip.analytics.output.CompositePeriodCouponMetrics cpcm = cp.couponMetrics (iEffectiveDate, - null); - - if (null == cpcm) return null; - - double dblPeriodCouponRate = cpcm.rate(); - - jsonCouponFlow.put ("CouponRate", dblPeriodCouponRate); - - try { - int iPeriodStartDate = cp.startDate(); - - int iPeriodEndDate = cp.endDate(); - - double dblYieldDF = org.drip.analytics.support.Helper.Yield2DF (iFrequency, dblYield, - org.drip.analytics.daycount.Convention.YearFraction (iEffectiveDate, iPeriodEndDate, - strDayCount, false, null, strCurrency)); - - jsonCouponFlow.put ("StartDate", new org.drip.analytics.date.JulianDate - (iPeriodStartDate).toString()); - - jsonCouponFlow.put ("EndDate", new org.drip.analytics.date.JulianDate - (iPeriodEndDate).toString()); - - jsonCouponFlow.put ("PayDate", new org.drip.analytics.date.JulianDate - (cp.payDate()).toString()); - - double dblCouponDCF = cp.couponDCF(); - - jsonCouponFlow.put ("AccrualDays", org.drip.analytics.daycount.Convention.DaysAccrued - (iPeriodStartDate, iPeriodEndDate, strDayCount, false, null, strCurrency)); - - jsonCouponFlow.put ("AccrualFraction", dblCouponDCF); - - double dblCouponAmount = dblPeriodCouponRate * dblCouponDCF * dblNotional; - - jsonCouponFlow.put ("CouponAmount", dblCouponAmount); - - jsonCouponFlow.put ("YieldDF", dblYieldDF); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - jsonCouponFlowArray.add (jsonCouponFlow); - } - - jsonResponse.put ("CouponFlow", jsonCouponFlowArray); - - jsonResponse.put ("CleanPrice", 100. * dblCleanPrice); - - jsonResponse.put ("Face", dblNotional); - - org.drip.analytics.date.JulianDate dtPreviousCouponDate = tsy.previousCouponDate (dtSettle); - - if (null != dtPreviousCouponDate) { - jsonResponse.put ("AccrualDays", iSettleDate - dtPreviousCouponDate.julian()); - - jsonResponse.put ("PreviousCouponDate", dtPreviousCouponDate.toString()); - } - - try { - double dblAccruedAmount = tsy.accrued (iSettleDate, null) * dblNotional; - - double dblCurrentPrincipal = tsy.notional (dtPreviousCouponDate.julian()) * dblNotional; - - double dblRisk = tsy.yield01FromPrice (valParams, null, null, dblCleanPrice); - - jsonResponse.put ("Accrued", dblAccruedAmount); - - jsonResponse.put ("Convexity", tsy.convexityFromPrice (valParams, null, null, dblCleanPrice)); - - jsonResponse.put ("CurrentPrincipal", dblCurrentPrincipal); - - jsonResponse.put ("DV01", dblRisk * dblNotional); - - jsonResponse.put ("ModifiedDuration", tsy.modifiedDurationFromPrice (valParams, null, null, - dblCleanPrice)); - - jsonResponse.put ("Notional", dblNotional); - - jsonResponse.put ("NPV", dblCurrentPrincipal + dblAccruedAmount); - - jsonResponse.put ("Risk", dblRisk); - - jsonResponse.put ("SettleDate", dtSettle.toString()); - - jsonResponse.put ("Total", dblCurrentPrincipal + dblAccruedAmount); - - jsonResponse.put ("Yield", tsy.yieldFromPrice (valParams, null, null, dblCleanPrice)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return jsonResponse; - } -} diff --git a/org/drip/service/product/CreditIndexAPI.java b/org/drip/service/product/CreditIndexAPI.java deleted file mode 100644 index 5abd079..0000000 --- a/org/drip/service/product/CreditIndexAPI.java +++ /dev/null @@ -1,359 +0,0 @@ - -package org.drip.service.product; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CreditIndexAPI contains the Functionality associated with the Horizon Analysis of the CDS Index. - * - * @author Lakshmi Krishnamurthy - */ - -public class CreditIndexAPI { - - static class ParCDS { - double _dblFairPremium = java.lang.Double.NaN; - double _dblFixedCoupon = java.lang.Double.NaN; - org.drip.product.definition.CreditDefaultSwap _cds = null; - - ParCDS ( - final org.drip.product.definition.CreditDefaultSwap cds, - final double dblFixedCoupon, - final double dblFairPremium) - { - _cds = cds; - _dblFixedCoupon = dblFixedCoupon; - _dblFairPremium = dblFairPremium; - } - - double fairPremium() - { - return _dblFairPremium; - } - - double fixedCoupon() - { - return _dblFixedCoupon; - } - - org.drip.product.definition.CreditDefaultSwap cds() - { - return _cds; - } - }; - - private static final ParCDS HorizonCreditIndex ( - final org.drip.state.discount.DiscountCurve dc, - final org.drip.state.credit.CreditCurve cc, - final java.lang.String strFullCreditIndexName) - { - org.drip.market.otc.CreditIndexConvention cic = - org.drip.market.otc.CreditIndexConventionContainer.ConventionFromFullName - (strFullCreditIndexName); - - if (null == cic) return null; - - org.drip.product.definition.CreditDefaultSwap cdsIndex = cic.indexCDS(); - - if (null == cdsIndex) return null; - - org.drip.param.market.CurveSurfaceQuoteContainer csqc = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - if (!csqc.setFundingState ((org.drip.state.discount.MergedDiscountForwardCurve) dc) || - !csqc.setCreditState (cc)) - return null; - - try { - return new ParCDS (cdsIndex, cic.fixedCoupon(), 0.0001 * cdsIndex.measureValue - (org.drip.param.valuation.ValuationParams.Spot (dc.epoch().julian()), null, csqc, null, - "FairPremium")); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private static final org.drip.historical.attribution.CDSMarketSnap MarketValuationSnap ( - final org.drip.product.definition.CreditDefaultSwap cds, - final org.drip.state.discount.DiscountCurve dc, - final org.drip.state.credit.CreditCurve cc, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final double dblRollDownFairPremium) - { - if (!csqc.setFundingState ((org.drip.state.discount.MergedDiscountForwardCurve) dc) || - !csqc.setCreditState (cc)) - return null; - - org.drip.analytics.date.JulianDate dt = dc.epoch(); - - java.util.Map mapCDS = cds.value - (org.drip.param.valuation.ValuationParams.Spot (dt.julian()), null, csqc, null); - - if (null == mapCDS || !mapCDS.containsKey ("Accrued") || !mapCDS.containsKey ("CleanDV01") || - !mapCDS.containsKey ("CleanPV") || !mapCDS.containsKey ("CleanCouponPV") || !mapCDS.containsKey - ("CumulativeCouponAmount") || !mapCDS.containsKey ("FairPremium") || !mapCDS.containsKey - ("LossPV")) - return null; - - double dblCleanPV = mapCDS.get ("CleanPV"); - - double dblFairPremium = 0.0001 * mapCDS.get ("FairPremium"); - - org.drip.analytics.date.JulianDate dtEffective = cds.effectiveDate(); - - double dblFairPremiumSensitivity = 10000. * mapCDS.get ("CleanDV01"); - - try { - org.drip.historical.attribution.CDSMarketSnap cdsms = new - org.drip.historical.attribution.CDSMarketSnap (dt, dblCleanPV); - - return cdsms.setEffectiveDate (dtEffective) && cdsms.setMaturityDate (cds.maturityDate()) && - cdsms.setCleanDV01 (dblFairPremiumSensitivity) && cdsms.setCurrentFairPremium - (dblFairPremium) && cdsms.setRollDownFairPremium (dblRollDownFairPremium) && - cdsms.setAccrued (mapCDS.get ("Accrued")) && cdsms.setCumulativeCouponAmount - (mapCDS.get ("CumulativeCouponAmount")) && cdsms.setCreditLabel - (cds.creditLabel().fullyQualifiedName()) && cdsms.setRecoveryRate - (cds.recovery (dtEffective.julian(), cc)) && cdsms.setCouponPV - (mapCDS.get ("CleanCouponPV")) && cdsms.setLossPV (mapCDS.get - ("LossPV")) && cdsms.setFairPremiumMarketFactor (dblFairPremium, - -1. * dblFairPremiumSensitivity, dblRollDownFairPremium) ? - cdsms : null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private static final double RollDownFairPremium ( - final org.drip.product.definition.CreditDefaultSwap cds, - final int iSpotDate, - final org.drip.state.discount.DiscountCurve dcPrevious, - final org.drip.state.credit.CreditCurve ccPrevious, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc) - throws java.lang.Exception - { - if (!csqc.setFundingState ((org.drip.state.discount.MergedDiscountForwardCurve) dcPrevious) || - !csqc.setCreditState (ccPrevious)) - throw new java.lang.Exception ("CreditIndexAPI::RollDownFairPremium => Invalid Inputs"); - - java.util.Map mapCDS = cds.value - (org.drip.param.valuation.ValuationParams.Spot (iSpotDate), null, csqc, null); - - if (null == mapCDS || !mapCDS.containsKey ("FairPremium")) - throw new java.lang.Exception ("CreditIndexAPI::RollDownFairPremium => Invalid Inputs"); - - return 0.0001 * mapCDS.get ("FairPremium"); - } - - /** - * Generate the CDS Horizon Change Attribution - * - * @param dcFirst The First Discount Curve - * @param ccFirst The First Credit Curve - * @param dcSecond The Second Discount Curve - * @param ccSecond The Second Credit Curve - * @param strFullCreditIndexName The Full Credit Index Name - * - * @return The CDS Horizon Change Attribution - */ - - public static final org.drip.historical.attribution.PositionChangeComponents HorizonChangeAttribution ( - final org.drip.state.discount.DiscountCurve dcFirst, - final org.drip.state.credit.CreditCurve ccFirst, - final org.drip.state.discount.DiscountCurve dcSecond, - final org.drip.state.credit.CreditCurve ccSecond, - final java.lang.String strFullCreditIndexName) - { - if (null == dcFirst || null == ccFirst || null == dcSecond || null == ccSecond) return null; - - int iFirstDate = dcFirst.epoch().julian(); - - int iSecondDate = dcSecond.epoch().julian(); - - java.lang.String strCurrency = dcSecond.currency(); - - if (!strCurrency.equalsIgnoreCase (dcFirst.currency()) || iFirstDate >= iSecondDate || - ccFirst.epoch().julian() != iFirstDate || ccSecond.epoch().julian() != iSecondDate) - return null; - - ParCDS parCDS = HorizonCreditIndex (dcFirst, ccFirst, strFullCreditIndexName); - - if (null == parCDS) return null; - - org.drip.product.definition.CreditDefaultSwap cds = parCDS.cds(); - - if (null == cds) return null; - - double dblFixedCoupon = parCDS.fixedCoupon(); - - double dblInitialFairPremium = parCDS.fairPremium(); - - org.drip.param.market.CurveSurfaceQuoteContainer csqc = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - double dblRollDownFairPremium = java.lang.Double.NaN; - - try { - dblRollDownFairPremium = RollDownFairPremium (cds, iSecondDate, dcFirst, ccFirst, csqc); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (!org.drip.quant.common.NumberUtil.IsValid (dblRollDownFairPremium)) return null; - - org.drip.historical.attribution.CDSMarketSnap cdsmsFirst = MarketValuationSnap (cds, dcFirst, - ccFirst, csqc, dblRollDownFairPremium); - - if (null == cdsmsFirst || !cdsmsFirst.setInitialFairPremium (dblInitialFairPremium) || - !cdsmsFirst.setFixedCoupon (dblFixedCoupon)) - return null; - - org.drip.historical.attribution.CDSMarketSnap cdsmsSecond = MarketValuationSnap (cds, dcSecond, - ccSecond, csqc, dblRollDownFairPremium); - - if (null == cdsmsSecond || !cdsmsSecond.setInitialFairPremium (dblInitialFairPremium) || - !cdsmsSecond.setFixedCoupon (dblFixedCoupon)) - return null; - - try { - return new org.drip.historical.attribution.PositionChangeComponents (false, cdsmsFirst, - cdsmsSecond, cdsmsSecond.cumulativeCouponAmount() - cdsmsFirst.cumulativeCouponAmount(), - null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Funding/Credit Curve Horizon Metrics - * - * @param adtSpot Array of Spot - * @param iHorizonGap The Horizon Gap - * @param astrFundingFixingMaturityTenor Array of Funding Fixing Maturity Tenors - * @param aadblFundingFixingQuote Double Array of Funding Fixing Swap Rates - * @param astrFullCreditIndexName Array of the Full Credit Index Names - * @param adblCreditIndexQuotedSpread Array of the Quoted Spreads - * - * @return The Funding/Credit Curve Horizon Metrics - */ - - public static final java.util.List - HorizonChangeAttribution ( - final org.drip.analytics.date.JulianDate[] adtSpot, - final int iHorizonGap, - final java.lang.String[] astrFundingFixingMaturityTenor, - final double[][] aadblFundingFixingQuote, - final java.lang.String[] astrFullCreditIndexName, - final double[] adblCreditIndexQuotedSpread) - { - if (null == adtSpot || 0 >= iHorizonGap || null == astrFundingFixingMaturityTenor || null == - aadblFundingFixingQuote || null == astrFullCreditIndexName || null == - adblCreditIndexQuotedSpread) - return null; - - int iNumClose = adtSpot.length; - int iNumFundingInstrument = astrFundingFixingMaturityTenor.length; - - java.util.List lsPCC = new - java.util.ArrayList(); - - for (int i = iHorizonGap; i < iNumClose; ++i) { - int iNumSecondFundingQuote = null == aadblFundingFixingQuote[i] ? 0 : - aadblFundingFixingQuote[i].length; - int iNumFirstFundingQuote = null == aadblFundingFixingQuote[i - iHorizonGap] ? 0 : - aadblFundingFixingQuote[i - iHorizonGap].length; - - if (0 == iNumFirstFundingQuote || iNumFirstFundingQuote != iNumFundingInstrument || 0 == - iNumSecondFundingQuote || iNumSecondFundingQuote != iNumFundingInstrument) - continue; - - org.drip.market.otc.CreditIndexConvention cic = - org.drip.market.otc.CreditIndexConventionContainer.ConventionFromFullName - (astrFullCreditIndexName[i]); - - if (null == cic) return null; - - java.lang.String strCurrency = cic.currency(); - - org.drip.product.definition.CreditDefaultSwap cdsIndex = cic.indexCDS(); - - org.drip.state.discount.MergedDiscountForwardCurve dcFundingFixingFirst = - org.drip.service.template.LatentMarketStateBuilder.FundingCurve (adtSpot[i - iHorizonGap], - strCurrency, null, null, "ForwardRate", null, "ForwardRate", - astrFundingFixingMaturityTenor, aadblFundingFixingQuote[i - iHorizonGap], "SwapRate", - org.drip.service.template.LatentMarketStateBuilder.SHAPE_PRESERVING); - - org.drip.state.credit.CreditCurve ccFirst = - org.drip.service.template.LatentMarketStateBuilder.CreditCurve (adtSpot[i - iHorizonGap], new - org.drip.product.definition.CreditDefaultSwap[] {cdsIndex}, new double[] - {adblCreditIndexQuotedSpread[i - iHorizonGap]}, "FairPremium", dcFundingFixingFirst); - - org.drip.state.discount.MergedDiscountForwardCurve dcFundingFixingSecond = - org.drip.service.template.LatentMarketStateBuilder.FundingCurve (adtSpot[i], strCurrency, - null, null, "ForwardRate", null, "ForwardRate", astrFundingFixingMaturityTenor, - aadblFundingFixingQuote[i], "SwapRate", - org.drip.service.template.LatentMarketStateBuilder.SHAPE_PRESERVING); - - org.drip.state.credit.CreditCurve ccSecond = - org.drip.service.template.LatentMarketStateBuilder.CreditCurve (adtSpot[i], new - org.drip.product.definition.CreditDefaultSwap[] {cdsIndex}, new double[] - {adblCreditIndexQuotedSpread[i]}, "FairPremium", dcFundingFixingSecond); - - lsPCC.add (HorizonChangeAttribution (dcFundingFixingFirst, ccFirst, dcFundingFixingSecond, - ccSecond, astrFullCreditIndexName[i])); - } - - return lsPCC; - } -} diff --git a/org/drip/service/product/FixFloatAPI.java b/org/drip/service/product/FixFloatAPI.java deleted file mode 100644 index 1156b49..0000000 --- a/org/drip/service/product/FixFloatAPI.java +++ /dev/null @@ -1,289 +0,0 @@ - -package org.drip.service.product; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FixFloatAPI contains the Functionality associated with the Horizon Analysis of the Fix Float Swap. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixFloatAPI { - - /** - * Compute the Horizon Change Attribution Details for the Specified Fix-Float Swap - * - * @param dcFirst First Day Discount Curve - * @param dcSecond Second Date Discount Curve - * @param mapRollDownDiscountCurve Map of the Roll Down Discount Curve - * @param strMaturityTenor Fix Float Swap Maturity Tenor - * - * @return The Horizon Change Attribution Instance - */ - - public static final org.drip.historical.attribution.PositionChangeComponents HorizonChangeAttribution ( - final org.drip.state.discount.MergedDiscountForwardCurve dcFirst, - final org.drip.state.discount.MergedDiscountForwardCurve dcSecond, - final - org.drip.analytics.support.CaseInsensitiveHashMap - mapRollDownDiscountCurve, - final java.lang.String strMaturityTenor) - { - if (null == mapRollDownDiscountCurve || 0 == mapRollDownDiscountCurve.size()) return null; - - org.drip.market.otc.FixedFloatSwapConvention ffsc = - org.drip.market.otc.IBORFixedFloatContainer.ConventionFromJurisdiction (dcFirst.currency(), - "ALL", strMaturityTenor, "MAIN"); - - if (null == ffsc) return null; - - int iSettleLag = ffsc.spotLag(); - - org.drip.analytics.date.JulianDate dtFirst = dcFirst.epoch(); - - org.drip.product.rates.FixFloatComponent ffc = ffsc.createFixFloatComponent (dtFirst, - strMaturityTenor, 0., 0., 1.); - - if (null == ffc) return null; - - org.drip.param.market.CurveSurfaceQuoteContainer csqcFirst = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - if (!csqcFirst.setFundingState (dcFirst)) return null; - - org.drip.param.market.CurveSurfaceQuoteContainer csqcSecond = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - if (!csqcSecond.setFundingState (dcSecond)) return null; - - org.drip.analytics.support.CaseInsensitiveHashMap - mapCSQCRollDown = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - for (java.lang.String strRollDownTenor : mapRollDownDiscountCurve.keySet()) { - org.drip.param.market.CurveSurfaceQuoteContainer csqcRollDown = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - org.drip.state.discount.MergedDiscountForwardCurve dcRollDown = mapRollDownDiscountCurve.get - (strRollDownTenor); - - if (null == dcRollDown || !csqcRollDown.setFundingState (dcRollDown)) return null; - - mapCSQCRollDown.put (strRollDownTenor, csqcRollDown); - } - - try { - double dblSwapRate = ffc.measureValue (org.drip.param.valuation.ValuationParams.Spot - (dtFirst.addBusDays (iSettleLag, ffc.payCurrency()).julian()), null, csqcFirst, null, - "SwapRate"); - - return org.drip.historical.engine.HorizonChangeExplainExecutor.GenerateAttribution (new - org.drip.historical.engine.FixFloatExplainProcessor (ffsc.createFixFloatComponent (dtFirst, - strMaturityTenor, dblSwapRate, 0., 1.), iSettleLag, "SwapRate", dblSwapRate, dtFirst, - dcSecond.epoch(), csqcFirst, csqcSecond, mapCSQCRollDown)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Funding Curve Horizon Metrics - * - * @param dtFirst The First Date - * @param dtSecond The Second Date - * @param astrFundingDepositInstrumentTenor Array of Funding Curve Deposit Instrument Maturity Tenors - * @param adblFirstFundingDepositInstrument Array of First Date Funding Curve Deposit Instrument Quotes - * @param adblSecondFundingDepositInstrument Array of Second Date Funding Curve Deposit Instrument Quotes - * @param astrFundingFixFloatTenor Array of Funding Curve Fix Float Instrument Maturity Tenors - * @param adblFirstFundingFixFloat Array of First Date Funding Curve Fix Float Swap Rates - * @param adblSecondFundingFixFloat Array of Second Date Funding Curve Fix Float Swap Rates - * @param strCurrency Funding Currency - * @param strMaturityTenor Maturity Tenor - * @param astrRollDownHorizon Array of the Roll Down Horizon Tenors - * @param iLatentStateType Latent State Type - * - * @return The Funding Curve Horizon Metrics - */ - - public static final org.drip.historical.attribution.PositionChangeComponents HorizonChangeAttribution ( - final org.drip.analytics.date.JulianDate dtFirst, - final org.drip.analytics.date.JulianDate dtSecond, - final java.lang.String[] astrFundingDepositInstrumentTenor, - final double[] adblFirstFundingDepositInstrument, - final double[] adblSecondFundingDepositInstrument, - final java.lang.String[] astrFundingFixFloatTenor, - final double[] adblFirstFundingFixFloat, - final double[] adblSecondFundingFixFloat, - final java.lang.String strCurrency, - final java.lang.String strMaturityTenor, - final java.lang.String[] astrRollDownHorizon, - final int iLatentStateType) - { - if (null == dtFirst || null == dtSecond || dtFirst.julian() >= dtSecond.julian()) return null; - - int iNumFundingDepositInstrument = null == astrFundingDepositInstrumentTenor ? 0 : - astrFundingDepositInstrumentTenor.length; - int iNumFirstFundingDepositInstrument = null == adblFirstFundingDepositInstrument ? 0 : - adblFirstFundingDepositInstrument.length; - int iNumSecondFundingDepositInstrument = null == adblSecondFundingDepositInstrument ? 0 : - adblSecondFundingDepositInstrument.length; - int iNumFundingFixFloat = null == astrFundingFixFloatTenor ? 0 : astrFundingFixFloatTenor.length; - int iNumFirstFundingFixFloat = null == adblFirstFundingFixFloat ? 0 : - adblFirstFundingFixFloat.length; - int iNumSecondFundingFixFloat = null == adblSecondFundingFixFloat ? 0 : - adblSecondFundingFixFloat.length; - int iNumRollDownHorizon = null == astrRollDownHorizon ? 0 : astrRollDownHorizon .length; - - org.drip.analytics.support.CaseInsensitiveHashMap - mapRollDownDiscountCurve = 0 == iNumRollDownHorizon ? null : new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - if (0 == iNumFundingDepositInstrument || iNumFundingDepositInstrument != - iNumFirstFundingDepositInstrument || iNumFundingDepositInstrument != - iNumSecondFundingDepositInstrument || 0 == iNumFundingFixFloat || iNumFundingFixFloat != - iNumFirstFundingFixFloat || iNumFundingFixFloat != iNumSecondFundingFixFloat) - return null; - - org.drip.state.discount.MergedDiscountForwardCurve dcFirst = - org.drip.service.template.LatentMarketStateBuilder.FundingCurve (dtFirst, strCurrency, - astrFundingDepositInstrumentTenor, adblFirstFundingDepositInstrument, "ForwardRate", null, - "ForwardRate", astrFundingFixFloatTenor, adblFirstFundingFixFloat, "SwapRate", - iLatentStateType); - - org.drip.state.discount.MergedDiscountForwardCurve dcSecond = - org.drip.service.template.LatentMarketStateBuilder.FundingCurve (dtSecond, strCurrency, - astrFundingDepositInstrumentTenor, adblSecondFundingDepositInstrument, "ForwardRate", null, - "ForwardRate", astrFundingFixFloatTenor, adblSecondFundingFixFloat, "SwapRate", - iLatentStateType); - - org.drip.state.discount.MergedDiscountForwardCurve dcRollDown = - org.drip.service.template.LatentMarketStateBuilder.FundingCurve (dtSecond, strCurrency, - astrFundingDepositInstrumentTenor, adblFirstFundingDepositInstrument, "ForwardRate", null, - "ForwardRate", astrFundingFixFloatTenor, adblFirstFundingFixFloat, "SwapRate", - iLatentStateType); - - if (null == dcRollDown) return null; - - mapRollDownDiscountCurve.put ("Native", dcRollDown); - - for (int j = 0; j < iNumRollDownHorizon; ++j) { - org.drip.state.discount.MergedDiscountForwardCurve dcHorizonRollDown = - org.drip.service.template.LatentMarketStateBuilder.FundingCurve (dtFirst.addTenor - (astrRollDownHorizon[j]), strCurrency, astrFundingDepositInstrumentTenor, - adblFirstFundingDepositInstrument, "ForwardRate", null, "ForwardRate", - astrFundingFixFloatTenor, adblFirstFundingFixFloat, "SwapRate", - iLatentStateType); - - if (null == dcHorizonRollDown) return null; - - mapRollDownDiscountCurve.put (astrRollDownHorizon[j], dcHorizonRollDown); - } - - return HorizonChangeAttribution (dcFirst, dcSecond, mapRollDownDiscountCurve, strMaturityTenor); - } - - /** - * Generate the Funding Curve Horizon Metrics - * - * @param adtSpot Array of Spot - * @param iHorizonGap The Horizon Gap - * @param astrFundingDepositInstrumentTenor Array of Funding Curve Deposit Instrument Maturity Tenors - * @param aadblFundingDepositInstrumentQuote Array of Funding Curve Deposit Instrument Forward Rates - * @param astrFundingFixFloatTenor Array of Funding Curve Fix Float Instrument Maturity Tenors - * @param aadblFundingFixFloatQuote Array of Funding Curve Fix Float Instrument Swap Rates - * @param strCurrency Funding Currency - * @param strMaturityTenor Maturity Tenor - * @param astrRollDownHorizon Array of the Roll Down Horizon Tenors - * @param iLatentStateType Latent State Type - * - * @return The Funding Curve Horizon Metrics - */ - - public static final java.util.List - HorizonChangeAttribution ( - final org.drip.analytics.date.JulianDate[] adtSpot, - final int iHorizonGap, - final java.lang.String[] astrFundingDepositInstrumentTenor, - final double[][] aadblFundingDepositInstrumentQuote, - final java.lang.String[] astrFundingFixFloatTenor, - final double[][] aadblFundingFixFloatQuote, - final java.lang.String strCurrency, - final java.lang.String strMaturityTenor, - final java.lang.String[] astrRollDownHorizon, - final int iLatentStateType) - { - if (null == adtSpot || 0 >= iHorizonGap || null == aadblFundingDepositInstrumentQuote || null == - aadblFundingFixFloatQuote) - return null; - - int iNumClose = adtSpot.length; - int iNumRollDownTenor = null == astrRollDownHorizon ? 0 : astrRollDownHorizon.length; - - if (0 == iNumClose || iNumClose != aadblFundingDepositInstrumentQuote.length || iNumClose != - aadblFundingFixFloatQuote.length || 0 == iNumRollDownTenor) - return null; - - java.util.List lsPCC = new - java.util.ArrayList(); - - for (int i = iHorizonGap; i < iNumClose; ++i) { - org.drip.historical.attribution.PositionChangeComponents pcc = HorizonChangeAttribution - (adtSpot[i - iHorizonGap], adtSpot[i], astrFundingDepositInstrumentTenor, - aadblFundingDepositInstrumentQuote[i - iHorizonGap], - aadblFundingDepositInstrumentQuote[i], astrFundingFixFloatTenor, - aadblFundingFixFloatQuote[i - iHorizonGap], aadblFundingFixFloatQuote[i], - strCurrency, strMaturityTenor, astrRollDownHorizon, iLatentStateType); - - if (null != pcc) lsPCC.add (pcc); - } - - return lsPCC; - } -} diff --git a/org/drip/service/product/FixedBondAPI.java b/org/drip/service/product/FixedBondAPI.java deleted file mode 100644 index 377ba65..0000000 --- a/org/drip/service/product/FixedBondAPI.java +++ /dev/null @@ -1,668 +0,0 @@ - -package org.drip.service.product; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * BondAPI demonstrates the Details behind the Pricing and the Scenario Runs behind a Generic Bond. - * - * @author Lakshmi Krishnamurthy - */ - -public class FixedBondAPI { - - /** - * Generate a Full Map Invocation of the Bond Valuation Run - * - * @param strIssuerName Bond Issuer Name - * @param iBondEffectiveDate Bond Effective Date - * @param iBondMaturityDate Bond Maturity Date - * @param dblBondCoupon Bond Coupon - * @param iBondCouponFrequency Bond Coupon Frequency - * @param strBondCouponDayCount Bond Coupon Day Count - * @param strBondCouponCurrency Bond Coupon Currency - * @param iSpotDate Spot Date - * @param astrFundingCurveDepositTenor Deposit Instruments Tenor (for Funding Curve) - * @param adblFundingCurveDepositQuote Deposit Instruments Quote (for Funding Curve) - * @param strFundingCurveDepositMeasure Deposit Instruments Measure (for Funding Curve) - * @param adblFundingCurveFuturesQuote Futures Instruments Tenor (for Funding Curve) - * @param strFundingCurveFuturesMeasure Futures Instruments Measure (for Funding Curve) - * @param astrFundingCurveFixFloatTenor Fix-Float Instruments Tenor (for Funding Curve) - * @param adblFundingCurveFixFloatQuote Fix-Float Instruments Quote (for Funding Curve) - * @param strFundingFixFloatMeasure Fix-Float Instruments Tenor (for Funding Curve) - * @param strGovvieCode Govvie Bond Code (for Treasury Curve) - * @param aiGovvieCurveTreasuryEffectiveDate Array of the Treasury Instrument Effective Date (for Treasury - * Curve) - * @param aiGovvieCurveTreasuryMaturityDate Array of the Treasury Instrument Maturity Date (for Treasury - * Curve) - * @param adblGovvieCurveTreasuryCoupon Array of the Treasury Instrument Coupon (for Treasury Curve) - * @param adblGovvieCurveTreasuryYield Array of the Treasury Instrument Yield (for Treasury Curve) - * @param strGovvieCurveTreasuryMeasure Treasury Instrument Measure (for Treasury Curve) - * @param strCreditCurveName Credit Curve Name (for Credit Curve) - * @param astrCreditCurveCDSTenor CDS Maturity Tenor (for Credit Curve) - * @param adblCreditCurveCDSCoupon Array of CDS Fixed Coupon (for Credit Curve) - * @param adblCreditCurveCDSQuote Array of CDS Market Quotes (for Credit Curve) - * @param strCreditCurveCDSMeasure CDS Calibration Measure (for Credit Curve) - * @param strBondMarketQuoteName Name of the Bond Market Quote - * @param dblBondMarketQuote Bond Market Quote Value - * - * @return The Output Measure Map - */ - - public static final java.util.Map ValuationMetrics ( - final java.lang.String strIssuerName, - final int iBondEffectiveDate, - final int iBondMaturityDate, - final double dblBondCoupon, - final int iBondCouponFrequency, - final java.lang.String strBondCouponDayCount, - final java.lang.String strBondCouponCurrency, - final int iSpotDate, - final java.lang.String[] astrFundingCurveDepositTenor, - final double[] adblFundingCurveDepositQuote, - final java.lang.String strFundingCurveDepositMeasure, - final double[] adblFundingCurveFuturesQuote, - final java.lang.String strFundingCurveFuturesMeasure, - final java.lang.String[] astrFundingCurveFixFloatTenor, - final double[] adblFundingCurveFixFloatQuote, - final java.lang.String strFundingFixFloatMeasure, - final java.lang.String strGovvieCode, - final int[] aiGovvieCurveTreasuryEffectiveDate, - final int[] aiGovvieCurveTreasuryMaturityDate, - final double[] adblGovvieCurveTreasuryCoupon, - final double[] adblGovvieCurveTreasuryYield, - final java.lang.String strGovvieCurveTreasuryMeasure, - final java.lang.String strCreditCurveName, - final java.lang.String[] astrCreditCurveCDSTenor, - final double[] adblCreditCurveCDSCoupon, - final double[] adblCreditCurveCDSQuote, - final java.lang.String strCreditCurveCDSMeasure, - final java.lang.String strBondMarketQuoteName, - final double dblBondMarketQuote) - { - org.drip.analytics.date.JulianDate dtSpot = null; - org.drip.analytics.date.JulianDate dtMaturity = null; - org.drip.analytics.date.JulianDate dtEffective = null; - org.drip.analytics.date.JulianDate[] adtGovvieCurveTreasuryMaturity = null; - org.drip.analytics.date.JulianDate[] adtGovvieCurveTreasuryEffective = null; - int iNumGovvieCurveMaturity = null == aiGovvieCurveTreasuryMaturityDate ? 0 : - aiGovvieCurveTreasuryMaturityDate.length; - int iNumGovvieCurveEffective = null == aiGovvieCurveTreasuryEffectiveDate ? 0 : - aiGovvieCurveTreasuryEffectiveDate.length; - java.lang.String[] astrTreasuryBenchmarkCode = new java.lang.String[] {"01YON", "02YON", "03YON", - "05YON", "07YON", "10YON", "30YON"}; - int iNumTreasuryBenchmark = astrTreasuryBenchmarkCode.length; - - if (0 != iNumGovvieCurveMaturity) - adtGovvieCurveTreasuryMaturity = new org.drip.analytics.date.JulianDate[iNumGovvieCurveMaturity]; - - if (0 != iNumGovvieCurveEffective) - adtGovvieCurveTreasuryEffective = new - org.drip.analytics.date.JulianDate[iNumGovvieCurveEffective]; - - org.drip.param.market.CurveSurfaceQuoteContainer csqc = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - try { - dtSpot = new org.drip.analytics.date.JulianDate (iSpotDate); - - dtMaturity = new org.drip.analytics.date.JulianDate (iBondMaturityDate); - - dtEffective = new org.drip.analytics.date.JulianDate (iBondEffectiveDate); - - for (int i = 0; i < iNumGovvieCurveMaturity; ++i) - adtGovvieCurveTreasuryMaturity[i] = new org.drip.analytics.date.JulianDate - (aiGovvieCurveTreasuryMaturityDate[i]); - - for (int i = 0; i < iNumGovvieCurveEffective; ++i) - adtGovvieCurveTreasuryEffective[i] = new org.drip.analytics.date.JulianDate - (aiGovvieCurveTreasuryEffectiveDate[i]); - - if (null != adblGovvieCurveTreasuryYield && adblGovvieCurveTreasuryYield.length == - iNumTreasuryBenchmark) { - for (int i = 0; i < iNumTreasuryBenchmark; ++i) { - org.drip.param.quote.ProductMultiMeasure pmm = new - org.drip.param.quote.ProductMultiMeasure(); - - pmm.addQuote ("Yield", new org.drip.param.quote.MultiSided ("mid", - adblGovvieCurveTreasuryYield[i]), true); - - if (!csqc.setProductQuote (astrTreasuryBenchmarkCode[i], pmm)) return null; - } - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.product.credit.BondComponent bond = org.drip.product.creator.BondBuilder.CreateSimpleFixed - (strIssuerName + " " + org.drip.quant.common.FormatUtil.FormatDouble (dblBondCoupon, 1, 4, 100.) - + " " + dtMaturity, strBondCouponCurrency, strIssuerName, dblBondCoupon, - iBondCouponFrequency, strBondCouponDayCount, dtEffective, dtMaturity, null, null); - - if (null == bond) return null; - - org.drip.param.quote.ProductMultiMeasure pmm = new org.drip.param.quote.ProductMultiMeasure(); - - try { - pmm.addQuote (strBondMarketQuoteName, new org.drip.param.quote.MultiSided ("mid", - dblBondMarketQuote), true); - } catch (java.lang.Exception e) { - } - - csqc.setProductQuote (bond.name(), pmm); - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = - org.drip.service.template.LatentMarketStateBuilder.SmoothFundingCurve (dtSpot, - strBondCouponCurrency, astrFundingCurveDepositTenor, adblFundingCurveDepositQuote, - strFundingCurveDepositMeasure, adblFundingCurveFuturesQuote, - strFundingCurveFuturesMeasure, astrFundingCurveFixFloatTenor, - adblFundingCurveFixFloatQuote, strFundingFixFloatMeasure); - - csqc.setFundingState (dcFunding); - - csqc.setGovvieState (org.drip.service.template.LatentMarketStateBuilder.ShapePreservingGovvieCurve - (strGovvieCode, dtSpot, adtGovvieCurveTreasuryEffective, adtGovvieCurveTreasuryMaturity, - adblGovvieCurveTreasuryCoupon, adblGovvieCurveTreasuryYield, strGovvieCurveTreasuryMeasure)); - - csqc.setCreditState (org.drip.service.template.LatentMarketStateBuilder.CreditCurve (dtSpot, - strCreditCurveName, astrCreditCurveCDSTenor, adblCreditCurveCDSCoupon, adblCreditCurveCDSQuote, - strCreditCurveCDSMeasure, dcFunding)); - - return bond.value (org.drip.param.valuation.ValuationParams.Spot (iSpotDate), null, csqc, null); - } - - /** - * Generate the Treasury Curve Tenor Key Rate Sensitivity/Duration - * - * @param strIssuerName Bond Issuer Name - * @param iBondEffectiveDate Bond Effective Date - * @param iBondMaturityDate Bond Maturity Date - * @param dblBondCoupon Bond Coupon - * @param iBondCouponFrequency Bond Coupon Frequency - * @param strBondCouponDayCount Bond Coupon Day Count - * @param strBondCouponCurrency Bond Coupon Currency - * @param iSpotDate Spot Date - * @param strGovvieCode Govvie Bond Code (for Treasury Curve) - * @param aiGovvieCurveTreasuryEffectiveDate Array of the Treasury Instrument Effective Date (for Treasury - * Curve) - * @param aiGovvieCurveTreasuryMaturityDate Array of the Treasury Instrument Maturity Date (for Treasury - * Curve) - * @param adblGovvieCurveTreasuryCoupon Array of the Treasury Instrument Coupon (for Treasury Curve) - * @param adblGovvieCurveTreasuryYield Array of the Treasury Instrument Yield (for Treasury Curve) - * @param strGovvieCurveTreasuryMeasure Treasury Instrument Measure (for Govvie Curve) - * @param dblBondMarketCleanPrice Bond Market Clean Price - * - * @return The Treasury Curve Tenor Sensitivity/Duration - */ - - public static final java.util.Map KeyRateDuration ( - final java.lang.String strIssuerName, - final int iBondEffectiveDate, - final int iBondMaturityDate, - final double dblBondCoupon, - final int iBondCouponFrequency, - final java.lang.String strBondCouponDayCount, - final java.lang.String strBondCouponCurrency, - final int iSpotDate, - final java.lang.String strGovvieCode, - final int[] aiGovvieCurveTreasuryEffectiveDate, - final int[] aiGovvieCurveTreasuryMaturityDate, - final double[] adblGovvieCurveTreasuryCoupon, - final double[] adblGovvieCurveTreasuryYield, - final java.lang.String strGovvieCurveTreasuryMeasure, - final double dblBondMarketCleanPrice) - { - double dblBaselineOAS = java.lang.Double.NaN; - org.drip.analytics.date.JulianDate dtSpot = null; - org.drip.analytics.date.JulianDate dtMaturity = null; - org.drip.analytics.date.JulianDate dtEffective = null; - org.drip.analytics.date.JulianDate[] adtGovvieCurveTreasuryMaturity = null; - org.drip.analytics.date.JulianDate[] adtGovvieCurveTreasuryEffective = null; - int iNumGovvieCurveMaturity = null == aiGovvieCurveTreasuryMaturityDate ? 0 : - aiGovvieCurveTreasuryMaturityDate.length; - int iNumGovvieCurveEffective = null == aiGovvieCurveTreasuryEffectiveDate ? 0 : - aiGovvieCurveTreasuryEffectiveDate.length; - java.lang.String[] astrTreasuryBenchmarkCode = new java.lang.String[] {"01YON", "02YON", "03YON", - "05YON", "07YON", "10YON", "30YON"}; - int iNumTreasuryBenchmark = astrTreasuryBenchmarkCode.length; - - if (0 != iNumGovvieCurveMaturity) - adtGovvieCurveTreasuryMaturity = new org.drip.analytics.date.JulianDate[iNumGovvieCurveMaturity]; - - if (0 != iNumGovvieCurveEffective) - adtGovvieCurveTreasuryEffective = new - org.drip.analytics.date.JulianDate[iNumGovvieCurveEffective]; - - org.drip.param.market.CurveSurfaceQuoteContainer csqc = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - try { - dtSpot = new org.drip.analytics.date.JulianDate (iSpotDate); - - dtMaturity = new org.drip.analytics.date.JulianDate (iBondMaturityDate); - - dtEffective = new org.drip.analytics.date.JulianDate (iBondEffectiveDate); - - for (int i = 0; i < iNumGovvieCurveMaturity; ++i) - adtGovvieCurveTreasuryMaturity[i] = new org.drip.analytics.date.JulianDate - (aiGovvieCurveTreasuryMaturityDate[i]); - - for (int i = 0; i < iNumGovvieCurveEffective; ++i) - adtGovvieCurveTreasuryEffective[i] = new org.drip.analytics.date.JulianDate - (aiGovvieCurveTreasuryEffectiveDate[i]); - - if (null != adblGovvieCurveTreasuryYield && adblGovvieCurveTreasuryYield.length == - iNumTreasuryBenchmark) { - for (int i = 0; i < iNumTreasuryBenchmark; ++i) { - org.drip.param.quote.ProductMultiMeasure pmm = new - org.drip.param.quote.ProductMultiMeasure(); - - pmm.addQuote ("Yield", new org.drip.param.quote.MultiSided ("mid", - adblGovvieCurveTreasuryYield[i]), true); - - if (!csqc.setProductQuote (astrTreasuryBenchmarkCode[i], pmm)) return null; - } - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.product.credit.BondComponent bond = org.drip.product.creator.BondBuilder.CreateSimpleFixed - (strIssuerName + " " + org.drip.quant.common.FormatUtil.FormatDouble (dblBondCoupon, 1, 4, 100.) - + " " + dtMaturity, strBondCouponCurrency, strIssuerName, dblBondCoupon, - iBondCouponFrequency, strBondCouponDayCount, dtEffective, dtMaturity, null, null); - - if (null == bond) return null; - - org.drip.param.quote.ProductMultiMeasure pmm = new org.drip.param.quote.ProductMultiMeasure(); - - try { - pmm.addQuote ("Price", new org.drip.param.quote.MultiSided ("mid", dblBondMarketCleanPrice), - true); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - csqc.setProductQuote (bond.name(), pmm); - - org.drip.state.govvie.GovvieCurve gc = - org.drip.service.template.LatentMarketStateBuilder.ShapePreservingGovvieCurve (strGovvieCode, - dtSpot, adtGovvieCurveTreasuryEffective, adtGovvieCurveTreasuryMaturity, - adblGovvieCurveTreasuryCoupon, adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure); - - csqc.setGovvieState (gc); - - org.drip.param.valuation.ValuationParams valParams = org.drip.param.valuation.ValuationParams.Spot - (iSpotDate); - - try { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBaselineOAS = bond.oasFromPrice (valParams, - csqc, null, dblBondMarketCleanPrice))) - return null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapTenorGovvieCurve = org.drip.service.template.LatentMarketStateBuilder.BumpedGovvieCurve - (strGovvieCode, dtSpot, adtGovvieCurveTreasuryEffective, adtGovvieCurveTreasuryMaturity, - adblGovvieCurveTreasuryCoupon, adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - org.drip.service.template.LatentMarketStateBuilder.SHAPE_PRESERVING, 0.0001, - false); - - if (null == mapTenorGovvieCurve || iNumTreasuryBenchmark > mapTenorGovvieCurve.size()) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapKeyRateDuration = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry me : - mapTenorGovvieCurve.entrySet()) { - java.lang.String strKey = me.getKey(); - - if (!strKey.contains ("tsy")) continue; - - if (!csqc.setGovvieState (me.getValue())) return null; - - try { - mapKeyRateDuration.put (strKey, 10000. * (bond.priceFromOAS (valParams, csqc, null, - dblBaselineOAS) - dblBondMarketCleanPrice) / dblBondMarketCleanPrice); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return mapKeyRateDuration; - } - - /** - * Returns Attribution for the Specified Bond Instance - * - * @param strIssuerName Bond Issuer Name - * @param iBondEffectiveDate Bond Effective Date - * @param iBondMaturityDate Bond Maturity Date - * @param dblBondCoupon Bond Coupon - * @param iBondCouponFrequency Bond Coupon Frequency - * @param strBondCouponDayCount Bond Coupon Day Count - * @param strBondCouponCurrency Bond Coupon Currency - * @param adtSpot Array of Spot Dates - * @param adblCleanPrice Array of Closing Clean Prices - * - * @return List of the Position Change Components - */ - - public static final java.util.List - HorizonChangeAttribution ( - final java.lang.String strIssuerName, - final int iBondEffectiveDate, - final int iBondMaturityDate, - final double dblBondCoupon, - final int iBondCouponFrequency, - final java.lang.String strBondCouponDayCount, - final java.lang.String strBondCouponCurrency, - final org.drip.analytics.date.JulianDate[] adtSpot, - final double[] adblCleanPrice) - { - org.drip.analytics.date.JulianDate dtMaturity = null; - org.drip.analytics.date.JulianDate dtEffective = null; - - try { - dtMaturity = new org.drip.analytics.date.JulianDate (iBondMaturityDate); - - dtEffective = new org.drip.analytics.date.JulianDate (iBondEffectiveDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.product.credit.BondComponent bond = org.drip.product.creator.BondBuilder.CreateSimpleFixed - (strIssuerName + " " + org.drip.quant.common.FormatUtil.FormatDouble (dblBondCoupon, 1, 4, 100.) - + " " + dtMaturity, strBondCouponCurrency, strIssuerName, dblBondCoupon, - iBondCouponFrequency, strBondCouponDayCount, dtEffective, dtMaturity, null, null); - - if (null == bond || null == adtSpot || null == adblCleanPrice) return null; - - int iNumCloses = adtSpot.length; - int[] aiSpotDate = new int[iNumCloses]; - double[] adblYield = new double[iNumCloses]; - double[] adblDirtyPrice = new double[iNumCloses]; - double[] adblModifiedDuration = new double[iNumCloses]; - - if (1 >= iNumCloses || iNumCloses != adblCleanPrice.length) return null; - - for (int i = 0; i < iNumCloses; ++i) { - org.drip.param.valuation.ValuationParams valParamsSpot = - org.drip.param.valuation.ValuationParams.Spot (aiSpotDate[i] = adtSpot[i].julian()); - - try { - if (!org.drip.quant.common.NumberUtil.IsValid (adblYield[i] = bond.yieldFromPrice - (valParamsSpot, null, null, adblCleanPrice[i]))) - return null; - - if (!org.drip.quant.common.NumberUtil.IsValid (adblModifiedDuration[i] = - bond.modifiedDurationFromPrice (valParamsSpot, null, null, adblCleanPrice[i]))) - return null; - - if (!org.drip.quant.common.NumberUtil.IsValid (adblDirtyPrice[i] = adblCleanPrice[i] + - bond.accrued (aiSpotDate[i], null))) - return null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - java.util.List lsPCC = new - java.util.ArrayList(); - - for (int i = 1; i < iNumCloses; ++i) { - try { - org.drip.historical.attribution.BondMarketSnap bpms1 = new - org.drip.historical.attribution.BondMarketSnap (adtSpot[i - 1], - adblCleanPrice[i - 1]); - - if (!bpms1.setYieldMarketFactor (adblYield[i - 1], -1. * adblDirtyPrice[i - 1] * - adblModifiedDuration[i - 1], 0.)) - return null; - - org.drip.historical.attribution.BondMarketSnap bpms2 = new - org.drip.historical.attribution.BondMarketSnap (adtSpot[i], adblCleanPrice[i]); - - if (!bpms2.setYieldMarketFactor (adblYield[i], -1. * adblDirtyPrice[i] * - adblModifiedDuration[i], 0.)) - return null; - - lsPCC.add (new org.drip.historical.attribution.PositionChangeComponents (false, bpms1, bpms2, - org.drip.analytics.daycount.Convention.YearFraction (aiSpotDate[i - 1], - aiSpotDate[i], strBondCouponDayCount, false, null, strBondCouponCurrency), null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return lsPCC; - } - - /** - * Generate the Relative Value Metrics for the Specified Bond - * - * @param strIssuerName Bond Issuer Name - * @param iBondEffectiveDate Bond Effective Date - * @param iBondMaturityDate Bond Maturity Date - * @param dblBondCoupon Bond Coupon - * @param iBondCouponFrequency Bond Coupon Frequency - * @param strBondCouponDayCount Bond Coupon Day Count - * @param strBondCouponCurrency Bond Coupon Currency - * @param iSpotDate Spot Date - * @param astrFundingCurveDepositTenor Deposit Instruments Tenor (for Funding Curve) - * @param adblFundingCurveDepositQuote Deposit Instruments Quote (for Funding Curve) - * @param strFundingCurveDepositMeasure Deposit Instruments Measure (for Funding Curve) - * @param adblFundingCurveFuturesQuote Futures Instruments Tenor (for Funding Curve) - * @param strFundingCurveFuturesMeasure Futures Instruments Measure (for Funding Curve) - * @param astrFundingCurveFixFloatTenor Fix-Float Instruments Tenor (for Funding Curve) - * @param adblFundingCurveFixFloatQuote Fix-Float Instruments Quote (for Funding Curve) - * @param strFundingFixFloatMeasure Fix-Float Instruments Tenor (for Funding Curve) - * @param strGovvieCode Govvie Bond Code (for Treasury Curve) - * @param aiGovvieCurveTreasuryEffectiveDate Array of the Treasury Instrument Effective Date (for Treasury - * Curve) - * @param aiGovvieCurveTreasuryMaturityDate Array of the Treasury Instrument Maturity Date (for Treasury - * Curve) - * @param adblGovvieCurveTreasuryCoupon Array of the Treasury Instrument Coupon (for Treasury Curve) - * @param adblGovvieCurveTreasuryYield Array of the Treasury Instrument Yield (for Treasury Curve) - * @param strGovvieCurveTreasuryMeasure Treasury Instrument Measure (for Treasury Curve) - * @param strCreditCurveName Credit Curve Name (for Credit Curve) - * @param astrCreditCurveCDSTenor CDS Maturity Tenor (for Credit Curve) - * @param adblCreditCurveCDSCoupon Array of CDS Fixed Coupon (for Credit Curve) - * @param adblCreditCurveCDSQuote Array of CDS Market Quotes (for Credit Curve) - * @param strCreditCurveCDSMeasure CDS Calibration Measure (for Credit Curve) - * @param dblBondMarketCleanPrice Bond Market Clean Price - * - * @return The Relative Value Metrics - */ - - public static final org.drip.analytics.output.BondRVMeasures RelativeValueMetrics ( - final java.lang.String strIssuerName, - final int iBondEffectiveDate, - final int iBondMaturityDate, - final double dblBondCoupon, - final int iBondCouponFrequency, - final java.lang.String strBondCouponDayCount, - final java.lang.String strBondCouponCurrency, - final int iSpotDate, - final java.lang.String[] astrFundingCurveDepositTenor, - final double[] adblFundingCurveDepositQuote, - final java.lang.String strFundingCurveDepositMeasure, - final double[] adblFundingCurveFuturesQuote, - final java.lang.String strFundingCurveFuturesMeasure, - final java.lang.String[] astrFundingCurveFixFloatTenor, - final double[] adblFundingCurveFixFloatQuote, - final java.lang.String strFundingFixFloatMeasure, - final java.lang.String strGovvieCode, - final int[] aiGovvieCurveTreasuryEffectiveDate, - final int[] aiGovvieCurveTreasuryMaturityDate, - final double[] adblGovvieCurveTreasuryCoupon, - final double[] adblGovvieCurveTreasuryYield, - final java.lang.String strGovvieCurveTreasuryMeasure, - final java.lang.String strCreditCurveName, - final java.lang.String[] astrCreditCurveCDSTenor, - final double[] adblCreditCurveCDSCoupon, - final double[] adblCreditCurveCDSQuote, - final java.lang.String strCreditCurveCDSMeasure, - final double dblBondMarketCleanPrice) - { - org.drip.analytics.date.JulianDate dtSpot = null; - org.drip.analytics.date.JulianDate dtMaturity = null; - org.drip.analytics.date.JulianDate dtEffective = null; - org.drip.analytics.date.JulianDate[] adtGovvieCurveTreasuryMaturity = null; - org.drip.analytics.date.JulianDate[] adtGovvieCurveTreasuryEffective = null; - int iNumGovvieCurveMaturity = null == aiGovvieCurveTreasuryMaturityDate ? 0 : - aiGovvieCurveTreasuryMaturityDate.length; - int iNumGovvieCurveEffective = null == aiGovvieCurveTreasuryEffectiveDate ? 0 : - aiGovvieCurveTreasuryEffectiveDate.length; - java.lang.String[] astrTreasuryBenchmarkCode = new java.lang.String[] {"01YON", "02YON", "03YON", - "05YON", "07YON", "10YON", "30YON"}; - int iNumTreasuryBenchmark = astrTreasuryBenchmarkCode.length; - - if (0 != iNumGovvieCurveMaturity) - adtGovvieCurveTreasuryMaturity = new org.drip.analytics.date.JulianDate[iNumGovvieCurveMaturity]; - - if (0 != iNumGovvieCurveEffective) - adtGovvieCurveTreasuryEffective = new - org.drip.analytics.date.JulianDate[iNumGovvieCurveEffective]; - - org.drip.param.market.CurveSurfaceQuoteContainer csqc = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - try { - dtSpot = new org.drip.analytics.date.JulianDate (iSpotDate); - - dtMaturity = new org.drip.analytics.date.JulianDate (iBondMaturityDate); - - dtEffective = new org.drip.analytics.date.JulianDate (iBondEffectiveDate); - - for (int i = 0; i < iNumGovvieCurveMaturity; ++i) - adtGovvieCurveTreasuryMaturity[i] = new org.drip.analytics.date.JulianDate - (aiGovvieCurveTreasuryMaturityDate[i]); - - for (int i = 0; i < iNumGovvieCurveEffective; ++i) - adtGovvieCurveTreasuryEffective[i] = new org.drip.analytics.date.JulianDate - (aiGovvieCurveTreasuryEffectiveDate[i]); - - if (null != adblGovvieCurveTreasuryYield && adblGovvieCurveTreasuryYield.length == - iNumTreasuryBenchmark) { - for (int i = 0; i < iNumTreasuryBenchmark; ++i) { - org.drip.param.quote.ProductMultiMeasure pmm = new - org.drip.param.quote.ProductMultiMeasure(); - - pmm.addQuote ("Yield", new org.drip.param.quote.MultiSided ("mid", - adblGovvieCurveTreasuryYield[i]), true); - - if (!csqc.setProductQuote (astrTreasuryBenchmarkCode[i], pmm)) return null; - } - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.product.credit.BondComponent bond = org.drip.product.creator.BondBuilder.CreateSimpleFixed - (strIssuerName + " " + org.drip.quant.common.FormatUtil.FormatDouble (dblBondCoupon, 1, 4, 100.) - + " " + dtMaturity, strBondCouponCurrency, strIssuerName, dblBondCoupon, - iBondCouponFrequency, strBondCouponDayCount, dtEffective, dtMaturity, null, null); - - if (null == bond) return null; - - org.drip.param.quote.ProductMultiMeasure pmm = new org.drip.param.quote.ProductMultiMeasure(); - - try { - pmm.addQuote ("Price", new org.drip.param.quote.MultiSided ("mid", dblBondMarketCleanPrice), - true); - } catch (java.lang.Exception e) { - } - - csqc.setProductQuote (bond.name(), pmm); - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = - org.drip.service.template.LatentMarketStateBuilder.SmoothFundingCurve (dtSpot, - strBondCouponCurrency, astrFundingCurveDepositTenor, adblFundingCurveDepositQuote, - strFundingCurveDepositMeasure, adblFundingCurveFuturesQuote, - strFundingCurveFuturesMeasure, astrFundingCurveFixFloatTenor, - adblFundingCurveFixFloatQuote, strFundingFixFloatMeasure); - - csqc.setFundingState (dcFunding); - - csqc.setGovvieState (org.drip.service.template.LatentMarketStateBuilder.ShapePreservingGovvieCurve - (strGovvieCode, dtSpot, adtGovvieCurveTreasuryEffective, adtGovvieCurveTreasuryMaturity, - adblGovvieCurveTreasuryCoupon, adblGovvieCurveTreasuryYield, strGovvieCurveTreasuryMeasure)); - - csqc.setCreditState (org.drip.service.template.LatentMarketStateBuilder.CreditCurve (dtSpot, - strCreditCurveName, astrCreditCurveCDSTenor, adblCreditCurveCDSCoupon, adblCreditCurveCDSQuote, - strCreditCurveCDSMeasure, dcFunding)); - - org.drip.param.valuation.ValuationParams valParams = org.drip.param.valuation.ValuationParams.Spot - (iSpotDate); - - return bond.standardMeasures (valParams, null, csqc, null, bond.exerciseYieldFromPrice (valParams, - csqc, null, dblBondMarketCleanPrice), dblBondMarketCleanPrice); - } -} diff --git a/org/drip/service/product/FundingFuturesAPI.java b/org/drip/service/product/FundingFuturesAPI.java deleted file mode 100644 index c55216d..0000000 --- a/org/drip/service/product/FundingFuturesAPI.java +++ /dev/null @@ -1,193 +0,0 @@ - -package org.drip.service.product; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FundingFuturesAPI contains the Functionality associated with the Horizon Analysis of the Funding Futures. - * - * @author Lakshmi Krishnamurthy - */ - -public class FundingFuturesAPI { - - /** - * Generate the Funding Futures Horizon Metrics - * - * @param dtPrevious Previous Date - * @param dtSpot Spot Date - * @param dtExpiry Expiry Date - * @param dblPreviousQuote Previous Funding Futures Rates - * @param dblSpotQuote Spot Funding Futures Rates - * @param strCurrency Funding Currency - * - * @return The Funding Futures Horizon Metrics - */ - - public static final org.drip.historical.attribution.PositionChangeComponents HorizonMetrics ( - final org.drip.analytics.date.JulianDate dtPrevious, - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.analytics.date.JulianDate dtExpiry, - final double dblPreviousQuote, - final double dblSpotQuote, - final java.lang.String strCurrency) - { - org.drip.product.rates.SingleStreamComponent sscFutures = - org.drip.service.template.ExchangeInstrumentBuilder.ForwardRateFutures (dtExpiry.addMonths (3), - strCurrency); - - if (null == sscFutures) return null; - - org.drip.analytics.cashflow.ComposableUnitPeriod cup = sscFutures.couponPeriods().get - (0).periods().get (0); - - org.drip.param.market.CurveSurfaceQuoteContainer csqc = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - if (!csqc.setFundingState - (org.drip.state.creator.ScenarioDiscountCurveBuilder.DiscretelyCompoundedFlatRate (dtPrevious, - strCurrency, dblPreviousQuote, cup.couponDC(), cup.freq()))) - return null; - - java.util.Map mapPreviousMeasures = sscFutures.value - (org.drip.param.valuation.ValuationParams.Spot (dtPrevious.julian()), null, csqc, null); - - if (null == mapPreviousMeasures || !mapPreviousMeasures.containsKey ("DV01") || - !mapPreviousMeasures.containsKey ("ForwardRate") || !mapPreviousMeasures.containsKey ("PV")) - return null; - - double dblPreviousDV01 = 10000. * mapPreviousMeasures.get ("DV01"); - - double dblPreviousForwardRate = mapPreviousMeasures.get ("ForwardRate"); - - if (!csqc.setFundingState - (org.drip.state.creator.ScenarioDiscountCurveBuilder.DiscretelyCompoundedFlatRate (dtSpot, - strCurrency, dblSpotQuote, cup.couponDC(), cup.freq()))) - return null; - - java.util.Map mapSpotMeasures = sscFutures.value - (org.drip.param.valuation.ValuationParams.Spot (dtSpot.julian()), null, csqc, null); - - if (null == mapSpotMeasures || !mapSpotMeasures.containsKey ("DV01") || !mapSpotMeasures.containsKey - ("ForwardRate") || !mapSpotMeasures.containsKey ("PV")) - return null; - - double dblSpotDV01 = 10000. * mapSpotMeasures.get ("DV01"); - - double dblSpotForwardRate = mapSpotMeasures.get ("ForwardRate"); - - try { - org.drip.historical.attribution.PositionMarketSnap pmsPrevious = new - org.drip.historical.attribution.PositionMarketSnap (dtPrevious, mapPreviousMeasures.get - ("PV")); - - if (!pmsPrevious.addManifestMeasureSnap ("ForwardRate", dblPreviousForwardRate, dblPreviousDV01, - dblPreviousForwardRate) || !pmsPrevious.setR1 ("DV01", dblPreviousDV01) || !pmsPrevious.setR1 - ("ForwardRate", dblPreviousForwardRate) || !pmsPrevious.setC1 ("FloaterLabel", - sscFutures.forwardLabel().get ("DERIVED").fullyQualifiedName())) - return null; - - org.drip.historical.attribution.PositionMarketSnap pmsSpot = new - org.drip.historical.attribution.PositionMarketSnap (dtSpot, mapSpotMeasures.get ("PV")); - - if (!pmsSpot.addManifestMeasureSnap ("ForwardRate", dblSpotForwardRate, dblSpotDV01, - dblSpotForwardRate) || !pmsSpot.setR1 ("DV01", dblSpotDV01) || !pmsSpot.setR1 ("ForwardRate", - dblSpotForwardRate) || !pmsSpot.setC1 ("FloaterLabel", sscFutures.forwardLabel().get - ("DERIVED").fullyQualifiedName())) - return null; - - return new org.drip.historical.attribution.PositionChangeComponents (false, pmsPrevious, pmsSpot, - 0., null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Funding Futures Horizon Metrics - * - * @param adt Array of Closing Dates - * @param adtExpiry Array of Expiry Dates - * @param adblFuturesQuote Array of Closing Futures Quotes - * @param strCurrency Funding Currency - * - * @return The Funding Futures Horizon Metrics - */ - - public static final java.util.List - HorizonChangeAttribution ( - final org.drip.analytics.date.JulianDate[] adt, - final org.drip.analytics.date.JulianDate[] adtExpiry, - final double[] adblFuturesQuote, - final java.lang.String strCurrency) - { - if (null == adt || null == adtExpiry || null == adblFuturesQuote) return null; - - int iNumClose = adt.length; - - if (0 == iNumClose || iNumClose != adtExpiry.length || iNumClose != adblFuturesQuote.length) - return null; - - java.util.List lsPCC = new - java.util.ArrayList(); - - for (int i = 1; i < iNumClose; ++i) { - if (adtExpiry[i - 1].julian() != adtExpiry[i].julian()) continue; - - org.drip.historical.attribution.PositionChangeComponents pcc = HorizonMetrics (adt[i - 1], - adt[i], adtExpiry[i], adblFuturesQuote[i - 1], adblFuturesQuote[i], strCurrency); - - if (null == pcc) continue; - - lsPCC.add (pcc); - } - - return lsPCC; - } -} diff --git a/org/drip/service/product/OvernightIndexSwapAPI.java b/org/drip/service/product/OvernightIndexSwapAPI.java deleted file mode 100644 index da231cf..0000000 --- a/org/drip/service/product/OvernightIndexSwapAPI.java +++ /dev/null @@ -1,107 +0,0 @@ - -package org.drip.service.product; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OvernightIndexSwapAPI exposes the Pricing and the Scenario Runs for an Overnight Index Swap. - * - * @author Lakshmi Krishnamurthy - */ - -public class OvernightIndexSwapAPI { - - /** - * Generate Full Set of Metrics for the Specified OIS - * - * @param strOISCurrency OIS Currency - * @param strOISTenor OIS Tenor - * @param dblOISCoupon OIS Coupon - * @param iSpotDate Spot Date - * @param astrOvernightCurveDepositTenor Overnight Curve Calibration Deposit Tenor - * @param adblOvernightCurveDepositQuote Overnight Tenor Calibration Deposit Quote - * @param astrOvernightCurveOISTenor Overnight Curve Calibration OIS Tenor - * @param adblOvernightCurveOISQuote Overnight Curve Calibration OIS Quote - * @param bFund TRUE - Floater Based off of Fund - * - * @return Map of Valuation Metrics - */ - - public static final java.util.Map ValuationMetrics ( - final java.lang.String strOISCurrency, - final java.lang.String strOISTenor, - final double dblOISCoupon, - final int iSpotDate, - final java.lang.String[] astrOvernightCurveDepositTenor, - final double[] adblOvernightCurveDepositQuote, - final java.lang.String[] astrOvernightCurveOISTenor, - final double[] adblOvernightCurveOISQuote, - final boolean bFund) - { - org.drip.service.env.EnvManager.InitEnv (""); - - org.drip.analytics.date.JulianDate dtSpot = new org.drip.analytics.date.JulianDate (iSpotDate); - - org.drip.state.discount.MergedDiscountForwardCurve dcOvernight = - org.drip.service.template.LatentMarketStateBuilder.SmoothOvernightCurve (dtSpot, strOISCurrency, - astrOvernightCurveDepositTenor, adblOvernightCurveDepositQuote, "Rate", - astrOvernightCurveOISTenor, adblOvernightCurveOISQuote, "SwapRate", null, null, null, - "SwapRate", null, null, "SwapRate"); - - if (null == dcOvernight) return null; - - org.drip.product.rates.FixFloatComponent oisFixFloat = - org.drip.service.template.OTCInstrumentBuilder.OISFixFloat (dtSpot, strOISCurrency, strOISTenor, - dblOISCoupon, bFund); - - org.drip.param.market.CurveSurfaceQuoteContainer csqc = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - return csqc.setFundingState (dcOvernight) ? oisFixFloat.value - (org.drip.param.valuation.ValuationParams.Spot (iSpotDate), null, csqc, null) : null; - } -} diff --git a/org/drip/service/product/TreasuryAPI.java b/org/drip/service/product/TreasuryAPI.java deleted file mode 100644 index d12cffe..0000000 --- a/org/drip/service/product/TreasuryAPI.java +++ /dev/null @@ -1,287 +0,0 @@ - -package org.drip.service.product; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * TreasuryAPI demonstrates the Details behind the Pricing and the Scenario Runs behind a Treasury Bond. - * - * @author Lakshmi Krishnamurthy - */ - -public class TreasuryAPI { - - /** - * Compute the Horizon Change Attribution Details for the Specified Treasury Bond - * - * @param gcFirst First Day Govvie Curve - * @param gcSecond Second Date Govvie Curve - * @param mapRollDownGovvieCurve Map of the Roll Down Govvie Curves - * @param strMaturityTenor Treasury Bond Maturity Tenor - * @param strCode Treasury Bond Code - * - * @return The Horizon Change Attribution Instance - */ - - public static final org.drip.historical.attribution.PositionChangeComponents HorizonChangeAttribution ( - final org.drip.state.govvie.GovvieCurve gcFirst, - final org.drip.state.govvie.GovvieCurve gcSecond, - final org.drip.analytics.support.CaseInsensitiveHashMap - mapRollDownGovvieCurve, - final java.lang.String strMaturityTenor, - final java.lang.String strCode) - { - if (null == gcFirst || null == mapRollDownGovvieCurve || 0 == mapRollDownGovvieCurve.size()) - return null; - - double dblFirstGovvieCurveYield = java.lang.Double.NaN; - - try { - dblFirstGovvieCurveYield = gcFirst.yield (strMaturityTenor); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.analytics.date.JulianDate dtFirst = gcFirst.epoch(); - - org.drip.param.market.CurveSurfaceQuoteContainer csqcFirst = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - if (!csqcFirst.setGovvieState (gcFirst)) return null; - - org.drip.param.market.CurveSurfaceQuoteContainer csqcSecond = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - if (!csqcSecond.setGovvieState (gcSecond)) return null; - - org.drip.analytics.support.CaseInsensitiveHashMap - mapCSQCRollDown = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - for (java.lang.String strRollDownTenor : mapRollDownGovvieCurve.keySet()) { - org.drip.param.market.CurveSurfaceQuoteContainer csqcRollDown = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - org.drip.state.govvie.GovvieCurve gcRollDown = mapRollDownGovvieCurve.get (strRollDownTenor); - - if (null == gcRollDown || !csqcRollDown.setGovvieState (gcRollDown)) return null; - - mapCSQCRollDown.put (strRollDownTenor, csqcRollDown); - } - - try { - return org.drip.historical.engine.HorizonChangeExplainExecutor.GenerateAttribution (new - org.drip.historical.engine.TreasuryBondExplainProcessor - (org.drip.service.template.TreasuryBuilder.FromCode (strCode, dtFirst, dtFirst.addTenor - (strMaturityTenor), dblFirstGovvieCurveYield), "Yield", dblFirstGovvieCurveYield, - dtFirst, gcSecond.epoch(), csqcFirst, csqcSecond, mapCSQCRollDown)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Govvie Curve Horizon Metrics - * - * @param dtFirst The First Date - * @param dtSecond The Second Date - * @param astrGovvieTreasuryInstrumentTenor Array of Govvie Curve Treasury Instrument Maturity Tenors - * @param adblFirstGovvieTreasuryInstrument Array of First Date Govvie Curve Treasury Instrument Quotes - * @param adblSecondGovvieTreasuryInstrument Array of Second Date Govvie Curve Treasury Instrument Quotes - * @param strMaturityTenor Treasury Bond Maturity Tenor - * @param strCode Treasury Bond Code - * @param astrRollDownHorizon Array of the Roll Down Horizon Tenors - * @param iLatentStateType Latent State Type - * - * @return The Govvie Curve Horizon Metrics - */ - - public static final org.drip.historical.attribution.PositionChangeComponents HorizonChangeAttribution ( - final org.drip.analytics.date.JulianDate dtFirst, - final org.drip.analytics.date.JulianDate dtSecond, - final java.lang.String[] astrGovvieTreasuryInstrumentTenor, - final double[] adblFirstGovvieTreasuryInstrument, - final double[] adblSecondGovvieTreasuryInstrument, - final java.lang.String strMaturityTenor, - final java.lang.String strCode, - final java.lang.String[] astrRollDownHorizon, - final int iLatentStateType) - { - if (null == dtFirst || null == dtSecond || dtFirst.julian() >= dtSecond.julian()) return null; - - int iNumGovvieTreasuryInstrument = null == astrGovvieTreasuryInstrumentTenor ? 0 : - astrGovvieTreasuryInstrumentTenor.length; - int iNumFirstGovvieTreasuryInstrument = null == adblFirstGovvieTreasuryInstrument ? 0 : - adblFirstGovvieTreasuryInstrument.length; - int iNumSecondGovvieTreasuryInstrument = null == adblSecondGovvieTreasuryInstrument ? 0 : - adblSecondGovvieTreasuryInstrument.length; - int iNumRollDownHorizon = null == astrRollDownHorizon ? 0 : astrRollDownHorizon .length; - org.drip.analytics.date.JulianDate[] adtFirstEffective = new - org.drip.analytics.date.JulianDate[iNumGovvieTreasuryInstrument]; - org.drip.analytics.date.JulianDate[] adtFirstMaturity = new - org.drip.analytics.date.JulianDate[iNumGovvieTreasuryInstrument]; - org.drip.analytics.date.JulianDate[] adtSecondEffective = new - org.drip.analytics.date.JulianDate[iNumGovvieTreasuryInstrument]; - org.drip.analytics.date.JulianDate[] adtSecondMaturity = new - org.drip.analytics.date.JulianDate[iNumGovvieTreasuryInstrument]; - org.drip.analytics.date.JulianDate[] adtRollDownEffective = new - org.drip.analytics.date.JulianDate[iNumGovvieTreasuryInstrument]; - org.drip.analytics.date.JulianDate[] adtRollDownMaturity = new - org.drip.analytics.date.JulianDate[iNumGovvieTreasuryInstrument]; - - org.drip.analytics.support.CaseInsensitiveHashMap - mapRollDownGovvieCurve = 0 == iNumRollDownHorizon ? null : new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - if (0 == iNumGovvieTreasuryInstrument || iNumGovvieTreasuryInstrument != - iNumFirstGovvieTreasuryInstrument || iNumGovvieTreasuryInstrument != - iNumSecondGovvieTreasuryInstrument) - return null; - - for (int i = 0; i < iNumGovvieTreasuryInstrument; ++i) { - adtFirstMaturity[i] = (adtFirstEffective[i] = dtFirst).addTenor - (astrGovvieTreasuryInstrumentTenor[i]); - - adtSecondMaturity[i] = (adtSecondEffective[i] = dtSecond).addTenor - (astrGovvieTreasuryInstrumentTenor[i]); - } - - org.drip.state.govvie.GovvieCurve gcFirst = - org.drip.service.template.LatentMarketStateBuilder.GovvieCurve (strCode, dtFirst, - adtFirstEffective, adtFirstMaturity, adblFirstGovvieTreasuryInstrument, - adblFirstGovvieTreasuryInstrument, "Yield", iLatentStateType); - - org.drip.state.govvie.GovvieCurve gcSecond = - org.drip.service.template.LatentMarketStateBuilder.GovvieCurve (strCode, dtSecond, - adtSecondEffective, adtSecondMaturity, adblSecondGovvieTreasuryInstrument, - adblSecondGovvieTreasuryInstrument, "Yield", iLatentStateType); - - org.drip.state.govvie.GovvieCurve gcRollDown = - org.drip.service.template.LatentMarketStateBuilder.GovvieCurve (strCode, dtSecond, - adtSecondEffective, adtSecondMaturity, adblFirstGovvieTreasuryInstrument, - adblFirstGovvieTreasuryInstrument, "Yield", iLatentStateType); - - if (null == gcRollDown) return null; - - mapRollDownGovvieCurve.put ("Native", gcRollDown); - - for (int j = 0; j < iNumRollDownHorizon; ++j) { - org.drip.analytics.date.JulianDate dtRollDown = dtFirst.addTenor (astrRollDownHorizon[j]); - - for (int i = 0; i < iNumGovvieTreasuryInstrument; ++i) - adtRollDownMaturity[i] = (adtRollDownEffective[i] = dtRollDown).addTenor - (astrGovvieTreasuryInstrumentTenor[i]); - - org.drip.state.govvie.GovvieCurve gcHorizonRollDown = - org.drip.service.template.LatentMarketStateBuilder.GovvieCurve (strCode, dtRollDown, - adtRollDownEffective, adtRollDownMaturity, adblFirstGovvieTreasuryInstrument, - adblFirstGovvieTreasuryInstrument, "Yield", iLatentStateType); - - if (null == gcHorizonRollDown) return null; - - mapRollDownGovvieCurve.put (astrRollDownHorizon[j], gcHorizonRollDown); - } - - return HorizonChangeAttribution (gcFirst, gcSecond, mapRollDownGovvieCurve, strMaturityTenor, - strCode); - } - - /** - * Generate the Govvie Curve Horizon Metrics - * - * @param adtSpot Array of the Spot Dates - * @param iHorizonGap The Horizon Gap - * @param astrGovvieTreasuryInstrumentTenor Array of Govvie Curve Treasury Instrument Maturity Tenors - * @param aadblGovvieTreasuryInstrumentQuote Array of Govvie Curve Treasury Instrument Quotes - * @param strMaturityTenor Treasury Bond Maturity Tenor - * @param strCode Treasury Bond Code - * @param astrRollDownHorizon Array of the Roll Down Horizon Tenors - * @param iLatentStateType Latent State Type - * - * @return The Govvie Curve Horizon Metrics - */ - - public static final java.util.List - HorizonChangeAttribution ( - final org.drip.analytics.date.JulianDate[] adtSpot, - final int iHorizonGap, - final java.lang.String[] astrGovvieTreasuryInstrumentTenor, - final double[][] aadblGovvieTreasuryInstrumentQuote, - final java.lang.String strMaturityTenor, - final java.lang.String strCode, - final java.lang.String[] astrRollDownHorizon, - final int iLatentStateType) - { - if (null == adtSpot || 0 >= iHorizonGap || null == aadblGovvieTreasuryInstrumentQuote) return null; - - int iNumClose = adtSpot.length; - int iNumRollDownTenor = null == astrRollDownHorizon ? 0 : astrRollDownHorizon.length; - - if (0 == iNumClose || iNumClose != aadblGovvieTreasuryInstrumentQuote.length || 0 == - iNumRollDownTenor) - return null; - - java.util.List lsPCC = new - java.util.ArrayList(); - - for (int i = iHorizonGap; i < iNumClose; ++i) { - org.drip.historical.attribution.PositionChangeComponents pcc = HorizonChangeAttribution - (adtSpot[i - iHorizonGap], adtSpot[i], astrGovvieTreasuryInstrumentTenor, - aadblGovvieTreasuryInstrumentQuote[i - iHorizonGap], - aadblGovvieTreasuryInstrumentQuote[i], strMaturityTenor, strCode, - astrRollDownHorizon, iLatentStateType); - - if (null != pcc) lsPCC.add (pcc); - } - - return lsPCC; - } -} diff --git a/org/drip/service/product/TreasuryFuturesAPI.java b/org/drip/service/product/TreasuryFuturesAPI.java deleted file mode 100644 index 62aa268..0000000 --- a/org/drip/service/product/TreasuryFuturesAPI.java +++ /dev/null @@ -1,688 +0,0 @@ - -package org.drip.service.product; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * TreasuryFuturesAPI demonstrates the Details behind the Pricing and the Scenario Runs behind a Treasury - * Futures Contract. - * - * @author Lakshmi Krishnamurthy - */ - -public class TreasuryFuturesAPI { - - /** - * Generate a Full Map Invocation of the Treasury Futures Run Use Case - * - * @param strFuturesCode The Treasury Futures Code - * @param aiFuturesComponentTreasuryEffectiveDate Array of the Treasury Futures Component Effective Date - * @param aiFuturesComponentTreasuryMaturityDate Array of the Treasury Futures Component Maturity Date - * @param adblFuturesComponentTreasuryCoupon Array of the Treasury Futures Component Coupon - * @param adblFuturesComponentConversionFactor Array of the Treasury Futures Component Conversion Factor - * @param iSpotDate Spot Date - * @param astrFundingCurveDepositTenor Deposit Instruments Tenor (for Funding Curve) - * @param adblFundingCurveDepositQuote Deposit Instruments Quote (for Funding Curve) - * @param strFundingCurveDepositMeasure Deposit Instruments Measure (for Funding Curve) - * @param adblFundingCurveFuturesQuote Futures Instruments Tenor (for Funding Curve) - * @param strFundingCurveFuturesMeasure Futures Instruments Measure (for Funding Curve) - * @param astrFundingCurveFixFloatTenor Fix-Float Instruments Tenor (for Funding Curve) - * @param adblFundingCurveFixFloatQuote Fix-Float Instruments Quote (for Funding Curve) - * @param strFundingFixFloatMeasure Fix-Float Instruments Tenor (for Funding Curve) - * @param aiGovvieCurveTreasuryEffectiveDate Array of the Treasury Instrument Effective Date (for Treasury - * Curve) - * @param aiGovvieCurveTreasuryMaturityDate Array of the Treasury Instrument Maturity Date (for Treasury - * Curve) - * @param adblGovvieCurveTreasuryCoupon Array of the Treasury Instrument Coupon (for Treasury Curve) - * @param adblGovvieCurveTreasuryYield Array of the Treasury Instrument Yield (for Treasury Curve) - * @param strGovvieCurveTreasuryMeasure Treasury Instrument Measure (for Govvie Curve) - * @param adblFuturesComponentTreasuryPrice Array of the Treasury Futures Component Clean Prices - * - * @return The Output Measure Map - */ - - public static final java.util.Map ValuationMetrics ( - final java.lang.String strFuturesCode, - final int[] aiFuturesComponentTreasuryEffectiveDate, - final int[] aiFuturesComponentTreasuryMaturityDate, - final double[] adblFuturesComponentTreasuryCoupon, - final double[] adblFuturesComponentConversionFactor, - final int iSpotDate, - final java.lang.String[] astrFundingCurveDepositTenor, - final double[] adblFundingCurveDepositQuote, - final java.lang.String strFundingCurveDepositMeasure, - final double[] adblFundingCurveFuturesQuote, - final java.lang.String strFundingCurveFuturesMeasure, - final java.lang.String[] astrFundingCurveFixFloatTenor, - final double[] adblFundingCurveFixFloatQuote, - final java.lang.String strFundingFixFloatMeasure, - final int[] aiGovvieCurveTreasuryEffectiveDate, - final int[] aiGovvieCurveTreasuryMaturityDate, - final double[] adblGovvieCurveTreasuryCoupon, - final double[] adblGovvieCurveTreasuryYield, - final java.lang.String strGovvieCurveTreasuryMeasure, - final double[] adblFuturesComponentTreasuryPrice) - { - org.drip.analytics.date.JulianDate dtSpot = null; - org.drip.analytics.date.JulianDate[] adtGovvieCurveTreasuryMaturity = null; - org.drip.analytics.date.JulianDate[] adtGovvieCurveTreasuryEffective = null; - int iNumGovvieCurveMaturity = null == aiGovvieCurveTreasuryMaturityDate ? 0 : - aiGovvieCurveTreasuryMaturityDate.length; - int iNumGovvieCurveEffective = null == aiGovvieCurveTreasuryEffectiveDate ? 0 : - aiGovvieCurveTreasuryEffectiveDate.length; - java.lang.String[] astrTreasuryBenchmarkCode = new java.lang.String[] {"01YON", "02YON", "03YON", - "05YON", "07YON", "10YON", "30YON"}; - int iNumTreasuryBenchmark = astrTreasuryBenchmarkCode.length; - - if (null == adblFuturesComponentTreasuryPrice) return null; - - if (0 != iNumGovvieCurveMaturity) - adtGovvieCurveTreasuryMaturity = new org.drip.analytics.date.JulianDate[iNumGovvieCurveMaturity]; - - if (0 != iNumGovvieCurveEffective) - adtGovvieCurveTreasuryEffective = new - org.drip.analytics.date.JulianDate[iNumGovvieCurveEffective]; - - org.drip.param.market.CurveSurfaceQuoteContainer csqc = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - try { - dtSpot = new org.drip.analytics.date.JulianDate (iSpotDate); - - for (int i = 0; i < iNumGovvieCurveMaturity; ++i) - adtGovvieCurveTreasuryMaturity[i] = new org.drip.analytics.date.JulianDate - (aiGovvieCurveTreasuryMaturityDate[i]); - - for (int i = 0; i < iNumGovvieCurveEffective; ++i) - adtGovvieCurveTreasuryEffective[i] = new org.drip.analytics.date.JulianDate - (aiGovvieCurveTreasuryEffectiveDate[i]); - - if (null != adblGovvieCurveTreasuryYield && adblGovvieCurveTreasuryYield.length == - iNumTreasuryBenchmark) { - for (int i = 0; i < iNumTreasuryBenchmark; ++i) { - org.drip.param.quote.ProductMultiMeasure pmm = new - org.drip.param.quote.ProductMultiMeasure(); - - pmm.addQuote ("Yield", new org.drip.param.quote.MultiSided ("mid", - adblGovvieCurveTreasuryYield[i]), true); - - if (!csqc.setProductQuote (astrTreasuryBenchmarkCode[i], pmm)) return null; - } - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.product.govvie.TreasuryFutures tsyFut = - org.drip.service.template.ExchangeInstrumentBuilder.TreasuryFutures (dtSpot, strFuturesCode, - aiFuturesComponentTreasuryEffectiveDate, aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, adblFuturesComponentConversionFactor); - - if (null == tsyFut) return null; - - org.drip.product.definition.Bond[] aBond = tsyFut.basket(); - - int iNumFuturesComponent = adblFuturesComponentTreasuryPrice.length; - - for (int i = 0; i < iNumFuturesComponent; ++i) { - org.drip.param.quote.ProductMultiMeasure pmm = new org.drip.param.quote.ProductMultiMeasure(); - - try { - pmm.addQuote ("Price", new org.drip.param.quote.MultiSided ("mid", - adblFuturesComponentTreasuryPrice[i]), true); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - csqc.setProductQuote (aBond[i].name(), pmm); - } - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = - org.drip.service.template.LatentMarketStateBuilder.SmoothFundingCurve (dtSpot, - aBond[0].currency(), astrFundingCurveDepositTenor, adblFundingCurveDepositQuote, - strFundingCurveDepositMeasure, adblFundingCurveFuturesQuote, - strFundingCurveFuturesMeasure, astrFundingCurveFixFloatTenor, - adblFundingCurveFixFloatQuote, strFundingFixFloatMeasure); - - csqc.setFundingState (dcFunding); - - org.drip.state.govvie.GovvieCurve gc = - org.drip.service.template.LatentMarketStateBuilder.ShapePreservingGovvieCurve (tsyFut.type(), - dtSpot, adtGovvieCurveTreasuryEffective, adtGovvieCurveTreasuryMaturity, - adblGovvieCurveTreasuryCoupon, adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure); - - csqc.setGovvieState (gc); - - return tsyFut.value (org.drip.param.valuation.ValuationParams.Spot (dtSpot.julian()), null, csqc, - null); - } - - /** - * Generate the Treasury Curve Tenor Key Rate Sensitivity/Duration - * - * @param strFuturesCode The Treasury Futures Code - * @param aiFuturesComponentTreasuryEffectiveDate Array of the Treasury Futures Component Effective Date - * @param aiFuturesComponentTreasuryMaturityDate Array of the Treasury Futures Component Maturity Date - * @param adblFuturesComponentTreasuryCoupon Array of the Treasury Futures Component Coupon - * @param adblFuturesComponentConversionFactor Array of the Treasury Futures Component Conversion Factor - * @param iSpotDate Spot Date - * @param aiGovvieCurveTreasuryEffectiveDate Array of the Treasury Instrument Effective Date (for Treasury - * Curve) - * @param aiGovvieCurveTreasuryMaturityDate Array of the Treasury Instrument Maturity Date (for Treasury - * Curve) - * @param adblGovvieCurveTreasuryCoupon Array of the Treasury Instrument Coupon (for Treasury Curve) - * @param adblGovvieCurveTreasuryYield Array of the Treasury Instrument Yield (for Treasury Curve) - * @param strGovvieCurveTreasuryMeasure Treasury Instrument Measure (for Govvie Curve) - * @param adblFuturesComponentTreasuryPrice Array of the Treasury Futures Component Clean Prices - * - * @return The Treasury Curve Tenor Sensitivity/Duration - */ - - public static final java.util.Map KeyRateDuration ( - final java.lang.String strFuturesCode, - final int[] aiFuturesComponentTreasuryEffectiveDate, - final int[] aiFuturesComponentTreasuryMaturityDate, - final double[] adblFuturesComponentTreasuryCoupon, - final double[] adblFuturesComponentConversionFactor, - final int iSpotDate, - final int[] aiGovvieCurveTreasuryEffectiveDate, - final int[] aiGovvieCurveTreasuryMaturityDate, - final double[] adblGovvieCurveTreasuryCoupon, - final double[] adblGovvieCurveTreasuryYield, - final java.lang.String strGovvieCurveTreasuryMeasure, - final double[] adblFuturesComponentTreasuryPrice) - { - double dblBaselineCTDOAS = java.lang.Double.NaN; - org.drip.analytics.date.JulianDate dtSpot = null; - org.drip.analytics.date.JulianDate[] adtGovvieCurveTreasuryMaturity = null; - org.drip.analytics.date.JulianDate[] adtGovvieCurveTreasuryEffective = null; - int iNumGovvieCurveMaturity = null == aiGovvieCurveTreasuryMaturityDate ? 0 : - aiGovvieCurveTreasuryMaturityDate.length; - int iNumGovvieCurveEffective = null == aiGovvieCurveTreasuryEffectiveDate ? 0 : - aiGovvieCurveTreasuryEffectiveDate.length; - java.lang.String[] astrTreasuryBenchmarkCode = new java.lang.String[] {"01YON", "02YON", "03YON", - "05YON", "07YON", "10YON", "30YON"}; - int iNumTreasuryBenchmark = astrTreasuryBenchmarkCode.length; - int iNumFuturesComponent = null == adblFuturesComponentTreasuryPrice ? 0 : - adblFuturesComponentTreasuryPrice.length; - - if (0 == iNumFuturesComponent) return null; - - if (0 != iNumGovvieCurveMaturity) - adtGovvieCurveTreasuryMaturity = new org.drip.analytics.date.JulianDate[iNumGovvieCurveMaturity]; - - if (0 != iNumGovvieCurveEffective) - adtGovvieCurveTreasuryEffective = new - org.drip.analytics.date.JulianDate[iNumGovvieCurveEffective]; - - org.drip.param.market.CurveSurfaceQuoteContainer csqc = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - try { - dtSpot = new org.drip.analytics.date.JulianDate (iSpotDate); - - for (int i = 0; i < iNumGovvieCurveMaturity; ++i) - adtGovvieCurveTreasuryMaturity[i] = new org.drip.analytics.date.JulianDate - (aiGovvieCurveTreasuryMaturityDate[i]); - - for (int i = 0; i < iNumGovvieCurveEffective; ++i) - adtGovvieCurveTreasuryEffective[i] = new org.drip.analytics.date.JulianDate - (aiGovvieCurveTreasuryEffectiveDate[i]); - - if (null != adblGovvieCurveTreasuryYield && adblGovvieCurveTreasuryYield.length == - iNumTreasuryBenchmark) { - for (int i = 0; i < iNumTreasuryBenchmark; ++i) { - org.drip.param.quote.ProductMultiMeasure pmm = new - org.drip.param.quote.ProductMultiMeasure(); - - pmm.addQuote ("Yield", new org.drip.param.quote.MultiSided ("mid", - adblGovvieCurveTreasuryYield[i]), true); - - if (!csqc.setProductQuote (astrTreasuryBenchmarkCode[i], pmm)) return null; - } - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.product.govvie.TreasuryFutures tsyFut = - org.drip.service.template.ExchangeInstrumentBuilder.TreasuryFutures (dtSpot, strFuturesCode, - aiFuturesComponentTreasuryEffectiveDate, aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, adblFuturesComponentConversionFactor); - - if (null == tsyFut) return null; - - org.drip.product.definition.Bond[] aBond = tsyFut.basket(); - - for (int i = 0; i < iNumFuturesComponent; ++i) { - org.drip.param.quote.ProductMultiMeasure pmm = new org.drip.param.quote.ProductMultiMeasure(); - - try { - pmm.addQuote ("Price", new org.drip.param.quote.MultiSided ("mid", - adblFuturesComponentTreasuryPrice[i]), true); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (!csqc.setProductQuote (aBond[i].name(), pmm)) return null; - } - - java.lang.String strTreasuryType = tsyFut.type(); - - if (!csqc.setGovvieState - (org.drip.service.template.LatentMarketStateBuilder.ShapePreservingGovvieCurve (strTreasuryType, - dtSpot, adtGovvieCurveTreasuryEffective, adtGovvieCurveTreasuryMaturity, - adblGovvieCurveTreasuryCoupon, adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure))) - return null; - - org.drip.product.params.CTDEntry ctdEntry = tsyFut.cheapestToDeliverYield (iSpotDate, - adblFuturesComponentTreasuryPrice); - - if (null == ctdEntry) return null; - - org.drip.product.definition.Bond bondCTD = ctdEntry.bond(); - - if (null == bondCTD) return null; - - double dblCTDExpiryPrice = ctdEntry.forwardPrice(); - - org.drip.param.valuation.ValuationParams valParamsExpiry = - org.drip.param.valuation.ValuationParams.Spot (tsyFut.expiry().julian()); - - try { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBaselineCTDOAS = bondCTD.oasFromPrice - (valParamsExpiry, csqc, null, dblCTDExpiryPrice))) - return null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapTenorGovvieCurve = org.drip.service.template.LatentMarketStateBuilder.BumpedGovvieCurve - (strTreasuryType, dtSpot, adtGovvieCurveTreasuryEffective, adtGovvieCurveTreasuryMaturity, - adblGovvieCurveTreasuryCoupon, adblGovvieCurveTreasuryYield, - strGovvieCurveTreasuryMeasure, - org.drip.service.template.LatentMarketStateBuilder.SHAPE_PRESERVING, 0.0001, - false); - - if (null == mapTenorGovvieCurve || iNumTreasuryBenchmark > mapTenorGovvieCurve.size()) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapKeyRateDuration = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (java.util.Map.Entry me : - mapTenorGovvieCurve.entrySet()) { - java.lang.String strKey = me.getKey(); - - if (!strKey.contains ("tsy")) continue; - - if (!csqc.setGovvieState (me.getValue())) return null; - - org.drip.product.params.CTDEntry tenorCTDEntry = tsyFut.cheapestToDeliverYield (iSpotDate, - adblFuturesComponentTreasuryPrice); - - if (null == tenorCTDEntry) return null; - - org.drip.product.definition.Bond tenorBondCTD = tenorCTDEntry.bond(); - - if (null == tenorBondCTD) return null; - - try { - mapKeyRateDuration.put (strKey, 10000. * (tenorBondCTD.priceFromOAS (valParamsExpiry, csqc, - null, dblBaselineCTDOAS) - dblCTDExpiryPrice) / dblCTDExpiryPrice); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return mapKeyRateDuration; - } - - /** - * Returns Attribution for the Treasury Futures - * - * @param strTreasuryCode The Treasury Code - * @param adtEffective Array of Effective Dates - * @param adtMaturity Array of Maturity Dates - * @param adblCoupon Array of Coupons - * @param adtExpiry Array of Futures Expiry Dates - * @param adtSpot Array of Spot Dates - * @param adblCleanPrice Array of Closing Clean Prices - * @param adblConversionFactor Array of the Conversion Factor - * - * @return List of the Position Change Components - */ - - public static final java.util.List - HorizonChangeAttribution ( - final java.lang.String strTreasuryCode, - final org.drip.analytics.date.JulianDate[] adtEffective, - final org.drip.analytics.date.JulianDate[] adtMaturity, - final double[] adblCoupon, - final org.drip.analytics.date.JulianDate[] adtExpiry, - final org.drip.analytics.date.JulianDate[] adtSpot, - final double[] adblCleanPrice, - final double[] adblConversionFactor) - { - org.drip.product.credit.BondComponent[] aTreasury = - org.drip.service.template.TreasuryBuilder.FromCode (strTreasuryCode, adtEffective, adtMaturity, - adblCoupon); - - if (null == aTreasury || null == adtExpiry || null == adtSpot || null == adblCleanPrice || null == - adblConversionFactor) - return null; - - int iNumCloses = adtSpot.length; - int[] aiExpiryDate = new int[iNumCloses]; - double[] adblYield = new double[iNumCloses]; - double[] adblForwardAccrued = new double[iNumCloses]; - double[] adblForwardCleanPrice = new double[iNumCloses]; - double[] adblForwardModifiedDuration = new double[iNumCloses]; - - if (1 >= iNumCloses || iNumCloses != aTreasury.length || iNumCloses != adblCleanPrice.length || - iNumCloses != adtExpiry.length || iNumCloses != adblConversionFactor.length) - return null; - - java.util.List lsPCC = new - java.util.ArrayList(); - - for (int i = 0; i < iNumCloses; ++i) { - if (null == aTreasury[i]) return null; - - org.drip.param.valuation.ValuationParams valParamsSpot = - org.drip.param.valuation.ValuationParams.Spot (adtSpot[i].julian()); - - org.drip.param.valuation.ValuationParams valParamsExpiry = - org.drip.param.valuation.ValuationParams.Spot (aiExpiryDate[i] = adtExpiry[i].julian()); - - try { - adblForwardAccrued[i] = aTreasury[i].accrued (aiExpiryDate[i], null); - - adblYield[i] = aTreasury[i].yieldFromPrice (valParamsSpot, null, null, adblCleanPrice[i]); - - adblForwardCleanPrice[i] = aTreasury[i].priceFromYield (valParamsExpiry, null, null, - adblYield[i]); - - adblForwardModifiedDuration[i] = aTreasury[i].modifiedDurationFromPrice (valParamsExpiry, - null, null, adblForwardCleanPrice[i]) * 10000.; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - } - - for (int i = 1; i < iNumCloses; ++i) { - if (adblConversionFactor[i] != adblConversionFactor[i - 1]) continue; - - java.lang.String strCurrentBondName = aTreasury[i].name(); - - java.lang.String strPreviousBondName = aTreasury[i - 1].name(); - - double dblScaledPrice1 = (adblForwardCleanPrice[i - 1] + adblForwardAccrued[i - 1]) / - adblConversionFactor[i - 1]; - double dblScaledPrice2 = (adblForwardCleanPrice[i] + adblForwardAccrued[i]) / - adblConversionFactor[i]; - - try { - org.drip.historical.attribution.TreasuryFuturesMarketSnap tfpms1 = new - org.drip.historical.attribution.TreasuryFuturesMarketSnap (adtSpot[i - 1], - dblScaledPrice1); - - if (!tfpms1.setYieldMarketFactor (adblYield[i - 1], -1. * dblScaledPrice1 * - adblForwardModifiedDuration[i - 1], 0.) || !tfpms1.setExpiryDate (adtExpiry[i - 1]) || - !tfpms1.setCTDName (strPreviousBondName) || !tfpms1.setCleanExpiryPrice - (adblForwardCleanPrice[i - 1]) || !tfpms1.setConversionFactor - (adblConversionFactor[i - 1])) - return null; - - org.drip.historical.attribution.TreasuryFuturesMarketSnap tfpms2 = new - org.drip.historical.attribution.TreasuryFuturesMarketSnap (adtSpot[i], - dblScaledPrice2); - - if (!tfpms2.setYieldMarketFactor (adblYield[i], -1. * dblScaledPrice2 * - adblForwardModifiedDuration[i], 0.) || !tfpms2.setExpiryDate (adtExpiry[i]) || - !tfpms2.setCTDName (strCurrentBondName) || !tfpms2.setCleanExpiryPrice - (adblForwardCleanPrice[i]) || !tfpms2.setConversionFactor - (adblConversionFactor[i])) - return null; - - org.drip.historical.attribution.PositionChangeComponents pcc = new - org.drip.historical.attribution.PositionChangeComponents (false, tfpms1, tfpms2, 0., - null); - - lsPCC.add (pcc); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - } - - return lsPCC; - } - - /** - * Generate the Horizon Treasury Curve Tenor Key Rate Sensitivity/Duration - * - * @param strTreasuryType The Treasury Type - * @param adtEffective Array of Effective Dates - * @param adtMaturity Array of Maturity Dates - * @param adblCoupon Array of Coupons - * @param adtExpiry Array of Futures Expiry Dates - * @param adtSpot Array of Spot Dates - * @param adblCleanPrice Array of Closing Clean Prices - * @param astrBenchmarkTenor Array of Benchmark Tenors - * @param aadblGovvieCurveTreasuryYield Array of the Treasury Instrument Yield (for Treasury Curve) - * - * @return The Treasury Curve Tenor Sensitivity/Duration - */ - - public static final java.util.List - HorizonKeyRateDuration ( - final java.lang.String strTreasuryType, - final org.drip.analytics.date.JulianDate[] adtEffective, - final org.drip.analytics.date.JulianDate[] adtMaturity, - final double[] adblCoupon, - final org.drip.analytics.date.JulianDate[] adtExpiry, - final org.drip.analytics.date.JulianDate[] adtSpot, - final double[] adblCleanPrice, - final java.lang.String[] astrBenchmarkTenor, - final double[][] aadblGovvieCurveTreasuryYield) - { - if (null == adtSpot || null == astrBenchmarkTenor || null == aadblGovvieCurveTreasuryYield || null == - aadblGovvieCurveTreasuryYield[0]) - return null; - - double dblExpiryCleanPrice = java.lang.Double.NaN; - double dblExpiryGSpread = java.lang.Double.NaN; - int iNumBenchmark = astrBenchmarkTenor.length; - double dblExpiryYield = java.lang.Double.NaN; - double dblSpotGSpread = java.lang.Double.NaN; - double dblSpotYield = java.lang.Double.NaN; - int iNumCloses = adtSpot.length; - - if (0 >= iNumCloses || iNumCloses != aadblGovvieCurveTreasuryYield.length) return null; - - java.util.List lsTDNM = new - java.util.ArrayList(); - - for (int i = 0; i < iNumCloses; ++i) { - if (null == aadblGovvieCurveTreasuryYield[i] || iNumBenchmark != - aadblGovvieCurveTreasuryYield[i].length) - return null; - - org.drip.analytics.date.JulianDate[] adtGovvieCurveTreasuryEffective = new - org.drip.analytics.date.JulianDate[iNumBenchmark]; - org.drip.analytics.date.JulianDate[] adtGovvieCurveTreasuryMaturity = new - org.drip.analytics.date.JulianDate[iNumBenchmark]; - org.drip.historical.sensitivity.TenorDurationNodeMetrics tdnm = null; - double dblParallelKRD = 0.; - - for (int j = 0; j < iNumBenchmark; ++j) { - adtGovvieCurveTreasuryEffective[j] = adtSpot[i]; - - adtGovvieCurveTreasuryMaturity[j] = adtSpot[i].addTenor (astrBenchmarkTenor[j]); - } - - org.drip.state.govvie.GovvieCurve gc = - org.drip.service.template.LatentMarketStateBuilder.ShapePreservingGovvieCurve - (strTreasuryType, adtSpot[i], adtGovvieCurveTreasuryEffective, - adtGovvieCurveTreasuryMaturity, aadblGovvieCurveTreasuryYield[i], - aadblGovvieCurveTreasuryYield[i], "Yield"); - - org.drip.param.market.CurveSurfaceQuoteContainer csqc = new - org.drip.param.market.CurveSurfaceQuoteContainer(); - - if (!csqc.setGovvieState (gc)) continue; - - org.drip.param.valuation.ValuationParams valParamsSpot = - org.drip.param.valuation.ValuationParams.Spot (adtSpot[i].julian()); - - org.drip.param.valuation.ValuationParams valParamsExpiry = - org.drip.param.valuation.ValuationParams.Spot (adtExpiry[i].julian()); - - org.drip.product.credit.BondComponent bondCTD = - org.drip.service.template.TreasuryBuilder.FromCode (strTreasuryType, adtEffective[i], - adtMaturity[i], adblCoupon[i]); - - if (null == bondCTD) continue; - - try { - dblSpotGSpread = bondCTD.gSpreadFromPrice (valParamsSpot, csqc, null, adblCleanPrice[i]); - - dblSpotYield = bondCTD.yieldFromPrice (valParamsSpot, csqc, null, adblCleanPrice[i]); - - dblExpiryCleanPrice = bondCTD.priceFromGSpread (valParamsExpiry, csqc, null, dblSpotGSpread); - - dblExpiryGSpread = bondCTD.gSpreadFromPrice (valParamsExpiry, csqc, null, - dblExpiryCleanPrice); - - dblExpiryYield = bondCTD.yieldFromPrice (valParamsExpiry, csqc, null, dblExpiryCleanPrice); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - continue; - } - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapTenorGovvieCurve = org.drip.service.template.LatentMarketStateBuilder.BumpedGovvieCurve - (strTreasuryType, adtSpot[i], adtGovvieCurveTreasuryEffective, - adtGovvieCurveTreasuryMaturity, aadblGovvieCurveTreasuryYield[i], - aadblGovvieCurveTreasuryYield[i], "Yield", - org.drip.service.template.LatentMarketStateBuilder.SHAPE_PRESERVING, 0.0001, - false); - - if (null == mapTenorGovvieCurve || iNumBenchmark > mapTenorGovvieCurve.size()) continue; - - try { - tdnm = new org.drip.historical.sensitivity.TenorDurationNodeMetrics (adtSpot[i]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - tdnm.setR1 ("SpotGSpread", dblSpotGSpread); - - tdnm.setR1 ("ExpiryGSpread", dblExpiryGSpread); - - tdnm.setR1 ("SpotYield", dblSpotYield); - - tdnm.setR1 ("ExpiryYield", dblExpiryYield); - - tdnm.setDate ("ExpiryDate", adtExpiry[i]); - - tdnm.setC1 ("CTDName", bondCTD.name()); - - tdnm.setR1 ("SpotCTDCleanPrice", adblCleanPrice[i]); - - tdnm.setR1 ("ExpiryCTDCleanPrice", dblExpiryCleanPrice); - - for (java.util.Map.Entry me : - mapTenorGovvieCurve.entrySet()) { - java.lang.String strKey = me.getKey(); - - if (!strKey.contains ("tsy")) continue; - - if (!csqc.setGovvieState (me.getValue())) return null; - - double dblTenorKRD = java.lang.Double.NaN; - - try { - dblTenorKRD = -10000. * (bondCTD.priceFromGSpread (valParamsExpiry, csqc, null, - dblSpotGSpread) - dblExpiryCleanPrice) / dblExpiryCleanPrice; - - if (!tdnm.addKRDNode (strKey, dblTenorKRD)) continue; - - dblParallelKRD += dblTenorKRD; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - tdnm.setR1 ("ParallelKRD", dblParallelKRD); - - lsTDNM.add (tdnm); - } - - return lsTDNM; - } -} diff --git a/org/drip/service/state/CreditCurveAPI.java b/org/drip/service/state/CreditCurveAPI.java deleted file mode 100644 index 19daabb..0000000 --- a/org/drip/service/state/CreditCurveAPI.java +++ /dev/null @@ -1,215 +0,0 @@ - -package org.drip.service.state; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * CreditCurveAPI computes the Metrics associated the Credit Curve State. - * - * @author Lakshmi Krishnamurthy - */ - -public class CreditCurveAPI { - - /** - * Generate the Horizon Metrics for the Specified Inputs - * - * @param dtSpot The Spot Date - * @param astrFundingFixingMaturityTenor Array of the Funding Fixing Curve Calibration Instrument Tenors - * @param adblFundingFixingQuote Array of the Funding Fixing Curve Calibration Instrument Quotes - * @param strFullCreditIndexName The Full Credit Index Name - * @param dblCreditIndexQuotedSpread The Credit Index Quoted Spread - * @param astrForTenor Array of the "For" Tenors - * - * @return Map of the Dated Credit Curve Metrics - */ - - public static final org.drip.historical.state.CreditCurveMetrics DailyMetrics ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String[] astrFundingFixingMaturityTenor, - final double[] adblFundingFixingQuote, - final java.lang.String strFullCreditIndexName, - final double dblCreditIndexQuotedSpread, - final java.lang.String[] astrForTenor) - { - if (null == dtSpot || null == astrFundingFixingMaturityTenor || null == adblFundingFixingQuote || - null == astrForTenor) - return null; - - int iNumForTenor = astrForTenor.length; - int iNumFundingFixingInstrument = astrFundingFixingMaturityTenor.length; - - if (0 == iNumFundingFixingInstrument || iNumFundingFixingInstrument != adblFundingFixingQuote.length - || 0 == iNumForTenor) - return null; - - org.drip.market.otc.CreditIndexConvention cic = - org.drip.market.otc.CreditIndexConventionContainer.ConventionFromFullName - (strFullCreditIndexName); - - if (null == cic) return null; - - org.drip.state.discount.MergedDiscountForwardCurve dcFundingFixing = - org.drip.service.template.LatentMarketStateBuilder.FundingCurve (dtSpot, cic.currency(), null, - null, "ForwardRate", null, "ForwardRate", astrFundingFixingMaturityTenor, - adblFundingFixingQuote, "SwapRate", - org.drip.service.template.LatentMarketStateBuilder.SHAPE_PRESERVING); - - if (null == dcFundingFixing) return null; - - org.drip.state.credit.CreditCurve cc = org.drip.service.template.LatentMarketStateBuilder.CreditCurve - (dtSpot, new org.drip.product.definition.CreditDefaultSwap[] {cic.indexCDS()}, new double[] - {dblCreditIndexQuotedSpread}, "FairPremium", dcFundingFixing); - - if (null == cc) return null; - - try { - org.drip.historical.state.CreditCurveMetrics ccm = new - org.drip.historical.state.CreditCurveMetrics (dtSpot); - - for (int j = 0; j < iNumForTenor; ++j) { - org.drip.analytics.date.JulianDate dtFor = dtSpot.addTenor (astrForTenor[j]); - - if (null == dtFor || !ccm.addSurvivalProbability (dtFor, cc.survival (dtFor)) || - !ccm.addRecoveryRate (dtFor, cc.recovery (dtFor))) - continue; - } - - return ccm; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Horizon Metrics for the Specified Inputs - * - * @param adtSpot Array of Horizon Dates - * @param astrFundingFixingMaturityTenor Array of the Funding Fixing Curve Calibration Instrument Tenors - * @param aadblFundingFixingQuote Array of the Funding Fixing Curve Calibration Instrument Quotes - * @param astrFullCreditIndexName Array of the Full Credit Index Names - * @param adblCreditIndexQuotedSpread Array of the Credit Index Quoted Spreads - * @param astrForTenor Array of the "For" Tenors - * - * @return Map of the Dated Credit Curve Metrics - */ - - public static final java.util.TreeMap HorizonMetrics ( - final org.drip.analytics.date.JulianDate[] adtSpot, - final java.lang.String[] astrFundingFixingMaturityTenor, - final double[][] aadblFundingFixingQuote, - final java.lang.String[] astrFullCreditIndexName, - final double[] adblCreditIndexQuotedSpread, - final java.lang.String[] astrForTenor) - { - if (null == adtSpot || null == astrFundingFixingMaturityTenor || null == aadblFundingFixingQuote || - null == astrFullCreditIndexName || null == adblCreditIndexQuotedSpread || null == astrForTenor) - return null; - - int iNumSpot = adtSpot.length; - int iNumForTenor = astrForTenor.length; - int iNumFundingFixingInstrument = astrFundingFixingMaturityTenor.length; - - if (0 == iNumSpot || iNumSpot != aadblFundingFixingQuote.length || iNumSpot != - astrFullCreditIndexName.length || iNumSpot != adblCreditIndexQuotedSpread.length || 0 == - iNumFundingFixingInstrument || 0 == iNumForTenor) - return null; - - java.util.TreeMap - mapCCM = new java.util.TreeMap(); - - for (int i = 0; i < iNumSpot; ++i) { - org.drip.market.otc.CreditIndexConvention cic = - org.drip.market.otc.CreditIndexConventionContainer.ConventionFromFullName - (astrFullCreditIndexName[i]); - - if (null == cic) continue; - - org.drip.state.discount.MergedDiscountForwardCurve dcFundingFixing = - org.drip.service.template.LatentMarketStateBuilder.FundingCurve (adtSpot[i], cic.currency(), - null, null, "ForwardRate", null, "ForwardRate", astrFundingFixingMaturityTenor, - aadblFundingFixingQuote[i], "SwapRate", - org.drip.service.template.LatentMarketStateBuilder.SHAPE_PRESERVING); - - if (null == dcFundingFixing) continue; - - org.drip.state.credit.CreditCurve cc = - org.drip.service.template.LatentMarketStateBuilder.CreditCurve (adtSpot[i], new - org.drip.product.definition.CreditDefaultSwap[] {cic.indexCDS()}, new double[] - {adblCreditIndexQuotedSpread[i]}, "FairPremium", dcFundingFixing); - - if (null == cc) continue; - - try { - org.drip.historical.state.CreditCurveMetrics ccm = new - org.drip.historical.state.CreditCurveMetrics (adtSpot[i]); - - for (int j = 0; j < iNumForTenor; ++j) { - org.drip.analytics.date.JulianDate dtFor = adtSpot[i].addTenor (astrForTenor[j]); - - if (null == dtFor) continue; - - if (!ccm.addSurvivalProbability (dtFor, cc.survival (dtFor)) || !ccm.addRecoveryRate - (dtFor, cc.recovery (dtFor))) - continue; - } - - mapCCM.put (adtSpot[i], ccm); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - continue; - } - } - - return mapCCM; - } -} diff --git a/org/drip/service/state/FundingCurveAPI.java b/org/drip/service/state/FundingCurveAPI.java deleted file mode 100644 index adbe494..0000000 --- a/org/drip/service/state/FundingCurveAPI.java +++ /dev/null @@ -1,272 +0,0 @@ - -package org.drip.service.state; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FundingCurveAPI computes the Metrics associated the Funding Curve State. - * - * @author Lakshmi Krishnamurthy - */ - -public class FundingCurveAPI { - - /** - * Generate the Funding Curve Daily Metrics - * - * @param dtSpot The Spot Date - * @param astrFixFloatMaturityTenor Array of Fix Float Maturity Tenors - * @param adblFixFloatQuote Array of Fix Float Swap Rates - * @param astrInTenor Array of "In" Tenors - * @param astrForTenor Array of "For" Tenors - * @param strCurrency Funding Currency - * @param iLatentStateType Latent State Type - * - * @return The Funding Curve Daily Metrics - */ - - public static final org.drip.historical.state.FundingCurveMetrics DailyMetrics ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String[] astrFixFloatMaturityTenor, - final double[] adblFixFloatQuote, - final java.lang.String[] astrInTenor, - final java.lang.String[] astrForTenor, - final java.lang.String strCurrency, - final int iLatentStateType) - { - if (null == dtSpot || null == astrFixFloatMaturityTenor || null == adblFixFloatQuote || null == - astrInTenor || null == astrForTenor) - return null; - - int iNumInTenor = astrInTenor.length; - int iNumForTenor = astrForTenor.length; - int iNumFixFloatQuote = adblFixFloatQuote.length; - double[] adblForTenorDCF = new double[iNumForTenor]; - int iNumCalibrationInstrument = astrFixFloatMaturityTenor.length; - - if (0 == iNumCalibrationInstrument || iNumFixFloatQuote != iNumCalibrationInstrument || 0 == - iNumInTenor || 0 == iNumForTenor) - return null; - - for (int i = 0; i < iNumForTenor; ++i) { - try { - adblForTenorDCF[i] = org.drip.analytics.support.Helper.TenorToYearFraction (astrForTenor[i]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = - org.drip.service.template.LatentMarketStateBuilder.FundingCurve (dtSpot, strCurrency, null, null, - "ForwardRate", null, "ForwardRate", astrFixFloatMaturityTenor, adblFixFloatQuote, "SwapRate", - iLatentStateType); - - if (null == dcFunding) return null; - - try { - org.drip.historical.state.FundingCurveMetrics fcm = new - org.drip.historical.state.FundingCurveMetrics (dtSpot); - - for (java.lang.String strInTenor : astrInTenor) { - org.drip.analytics.date.JulianDate dtIn = dtSpot.addTenor (strInTenor); - - for (int j = 0; j < iNumForTenor; ++j) { - if (!fcm.addNativeForwardRate (strInTenor, astrForTenor[j], java.lang.Math.pow - (dcFunding.df (dtIn) / dcFunding.df (dtIn.addTenor (astrForTenor[j])), 1. / - adblForTenorDCF[j]) - 1.)) - continue; - } - } - - return fcm; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Funding Curve Horizon Metrics - * - * @param adtSpot Array of Spot - * @param astrFixFloatMaturityTenor Array of Fix Float Maturity Tenors - * @param aadblFixFloatQuote Array of Fix Float Swap Rates - * @param astrInTenor Array of "In" Tenors - * @param astrForTenor Array of "For" Tenors - * @param strCurrency Funding Currency - * @param iLatentStateType Latent State Type - * - * @return The Funding Curve Horizon Metrics - */ - - public static final java.util.Map HorizonMetrics ( - final org.drip.analytics.date.JulianDate[] adtSpot, - final java.lang.String[] astrFixFloatMaturityTenor, - final double[][] aadblFixFloatQuote, - final java.lang.String[] astrInTenor, - final java.lang.String[] astrForTenor, - final java.lang.String strCurrency, - final int iLatentStateType) - { - if (null == adtSpot || null == astrFixFloatMaturityTenor || null == aadblFixFloatQuote || null == - astrInTenor || null == astrForTenor) - return null; - - int iNumClose = adtSpot.length; - int iNumInTenor = astrInTenor.length; - int iNumForTenor = astrForTenor.length; - double[] adblForTenorDCF = new double[iNumForTenor]; - int iNumCalibrationInstrument = astrFixFloatMaturityTenor.length; - - if (0 == iNumClose || 0 == iNumCalibrationInstrument || 0 == iNumInTenor || 0 == iNumForTenor) - return null; - - for (int i = 0; i < iNumForTenor; ++i) { - try { - adblForTenorDCF[i] = org.drip.analytics.support.Helper.TenorToYearFraction (astrForTenor[i]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - java.util.Map - mapFCM = new java.util.TreeMap(); - - for (int i = 0; i < iNumClose; ++i) { - org.drip.historical.state.FundingCurveMetrics fcm = null; - int iNumFixFloatQuote = null == aadblFixFloatQuote[i] ? 0 : aadblFixFloatQuote[i].length; - - if (0 == iNumFixFloatQuote || iNumFixFloatQuote != iNumCalibrationInstrument) continue; - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = - org.drip.service.template.LatentMarketStateBuilder.FundingCurve (adtSpot[i], strCurrency, - null, null, "ForwardRate", null, "ForwardRate", astrFixFloatMaturityTenor, - aadblFixFloatQuote[i], "SwapRate", iLatentStateType); - - if (null == dcFunding) continue; - - try { - fcm = new org.drip.historical.state.FundingCurveMetrics (adtSpot[i]); - - for (java.lang.String strInTenor : astrInTenor) { - org.drip.analytics.date.JulianDate dtIn = adtSpot[i].addTenor (strInTenor); - - for (int j = 0; j < iNumForTenor; ++j) { - if (!fcm.addNativeForwardRate (strInTenor, astrForTenor[j], java.lang.Math.pow - (dcFunding.df (dtIn) / dcFunding.df (dtIn.addTenor (astrForTenor[j])), 1. / - adblForTenorDCF[j]) - 1.)) - continue; - } - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - continue; - } - - mapFCM.put (adtSpot[i], fcm); - } - - return mapFCM; - } - - /** - * Generate the Funding Curve Map - * - * @param adtSpot Array of Spot - * @param astrFixFloatMaturityTenor Array of Fix Float Maturity Tenors - * @param aadblFixFloatQuote Array of Fix Float Swap Rates - * @param strCurrency Funding Currency - * @param iLatentStateType Latent State Type - * - * @return The Funding Curve Map - */ - - public static final java.util.Map HistoricalMap ( - final org.drip.analytics.date.JulianDate[] adtSpot, - final java.lang.String[] astrFixFloatMaturityTenor, - final double[][] aadblFixFloatQuote, - final java.lang.String strCurrency, - final int iLatentStateType) - { - if (null == adtSpot || null == astrFixFloatMaturityTenor || null == aadblFixFloatQuote) return null; - - int iNumClose = adtSpot.length; - int iNumCalibrationInstrument = astrFixFloatMaturityTenor.length; - - if (0 == iNumClose || 0 == iNumCalibrationInstrument) return null; - - java.util.Map - mapFundingCurve = new java.util.TreeMap(); - - for (int i = 0; i < iNumClose; ++i) { - int iNumFixFloatQuote = null == aadblFixFloatQuote[i] ? 0 : aadblFixFloatQuote[i].length; - - if (0 == iNumFixFloatQuote || iNumFixFloatQuote != iNumCalibrationInstrument) continue; - - org.drip.state.discount.MergedDiscountForwardCurve dcFunding = - org.drip.service.template.LatentMarketStateBuilder.FundingCurve (adtSpot[i], strCurrency, - null, null, "ForwardRate", null, "ForwardRate", astrFixFloatMaturityTenor, - aadblFixFloatQuote[i], "SwapRate", iLatentStateType); - - if (null == dcFunding) continue; - - mapFundingCurve.put (adtSpot[i], dcFunding); - } - - return mapFundingCurve; - } -} diff --git a/org/drip/service/state/OvernightCurveAPI.java b/org/drip/service/state/OvernightCurveAPI.java deleted file mode 100644 index a49fd39..0000000 --- a/org/drip/service/state/OvernightCurveAPI.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.service.state; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * OvernightCurveAPI computes the Metrics associated the Overnight Curve State. - * - * @author Lakshmi Krishnamurthy - */ - -public class OvernightCurveAPI { - - /** - * Generate the Overnight Curve Horizon Metrics for the Specified Date - * - * @param dtSpot The Spot Date - * @param astrOvernightCurveOISTenor Array of Overnight Curve Fix Float OIS Maturity Tenors - * @param adblOvernightCurveOISQuote Array of Overnight Curve OIS Rates - * @param astrInTenor Array of "In" Tenors - * @param astrForTenor Array of "For" Tenors - * @param strCurrency Overnight Currency - * @param iLatentStateType Latent State Type - * - * @return The Overnight Curve Horizon Metrics - */ - - public static final org.drip.historical.state.FundingCurveMetrics DailyMetrics ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String[] astrOvernightCurveOISTenor, - final double[] adblOvernightCurveOISQuote, - final java.lang.String[] astrInTenor, - final java.lang.String[] astrForTenor, - final java.lang.String strCurrency, - final int iLatentStateType) - { - if (null == dtSpot || null == astrOvernightCurveOISTenor || null == adblOvernightCurveOISQuote || - null == astrInTenor || null == astrForTenor) - return null; - - int iNumInTenor = astrInTenor.length; - int iNumForTenor = astrForTenor.length; - double[] adblForTenorDCF = new double[iNumForTenor]; - int iNumCalibrationInstrument = astrOvernightCurveOISTenor.length; - int iNumOISQuote = null == adblOvernightCurveOISQuote ? 0 : adblOvernightCurveOISQuote.length; - - if (0 == iNumCalibrationInstrument || 0 == iNumInTenor || 0 == iNumForTenor || iNumOISQuote != - iNumCalibrationInstrument) - return null; - - for (int i = 0; i < iNumForTenor; ++i) { - try { - adblForTenorDCF[i] = org.drip.analytics.support.Helper.TenorToYearFraction (astrForTenor[i]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - org.drip.state.discount.MergedDiscountForwardCurve dcOvernight = - org.drip.service.template.LatentMarketStateBuilder.OvernightCurve (dtSpot, strCurrency, null, - null, "Rate", astrOvernightCurveOISTenor, adblOvernightCurveOISQuote, "SwapRate", null, null, - null, "SwapRate", null, null, "SwapRate", iLatentStateType); - - if (null == dcOvernight) return null; - - try { - org.drip.historical.state.FundingCurveMetrics fcm = new - org.drip.historical.state.FundingCurveMetrics (dtSpot); - - for (java.lang.String strInTenor : astrInTenor) { - org.drip.analytics.date.JulianDate dtIn = dtSpot.addTenor (strInTenor); - - for (int j = 0; j < iNumForTenor; ++j) { - if (!fcm.addNativeForwardRate (strInTenor, astrForTenor[j], java.lang.Math.pow - (dcOvernight.df (dtIn) / dcOvernight.df (dtIn.addTenor (astrForTenor[j])), 1. / - adblForTenorDCF[j]) - 1.)) - return null; - } - } - - return fcm; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Overnight Curve Horizon Metrics For an Array of Closing Dates - * - * @param adtSpot Array of Spot - * @param astrOvernightCurveOISTenor Array of Overnight Curve Fix Float OIS Maturity Tenors - * @param aadblOvernightCurveOISQuote Array of Overnight Curve OIS Rates - * @param astrInTenor Array of "In" Tenors - * @param astrForTenor Array of "For" Tenors - * @param strCurrency Overnight Currency - * @param iLatentStateType Latent State Type - * - * @return The Overnight Curve Horizon Metrics - */ - - public static final java.util.Map HorizonMetrics ( - final org.drip.analytics.date.JulianDate[] adtSpot, - final java.lang.String[] astrOvernightCurveOISTenor, - final double[][] aadblOvernightCurveOISQuote, - final java.lang.String[] astrInTenor, - final java.lang.String[] astrForTenor, - final java.lang.String strCurrency, - final int iLatentStateType) - { - if (null == adtSpot || null == astrOvernightCurveOISTenor || null == aadblOvernightCurveOISQuote || - null == astrInTenor || null == astrForTenor) - return null; - - int iNumClose = adtSpot.length; - int iNumInTenor = astrInTenor.length; - int iNumForTenor = astrForTenor.length; - double[] adblForTenorDCF = new double[iNumForTenor]; - int iNumCalibrationInstrument = astrOvernightCurveOISTenor.length; - - if (0 == iNumClose || 0 == iNumCalibrationInstrument || 0 == iNumInTenor || 0 == iNumForTenor) - return null; - - for (int i = 0; i < iNumForTenor; ++i) { - try { - adblForTenorDCF[i] = org.drip.analytics.support.Helper.TenorToYearFraction (astrForTenor[i]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - java.util.Map - mapFCM = new java.util.TreeMap(); - - for (int i = 0; i < iNumClose; ++i) { - org.drip.historical.state.FundingCurveMetrics fcm = null; - int iNumOISQuote = null == aadblOvernightCurveOISQuote[i] ? 0 : - aadblOvernightCurveOISQuote[i].length; - - if (0 == iNumOISQuote || iNumOISQuote != iNumCalibrationInstrument) continue; - - org.drip.state.discount.MergedDiscountForwardCurve dcOvernight = - org.drip.service.template.LatentMarketStateBuilder.OvernightCurve (adtSpot[i], strCurrency, - null, null, "Rate", astrOvernightCurveOISTenor, aadblOvernightCurveOISQuote[i], - "SwapRate", null, null, null, "SwapRate", null, null, "SwapRate", iLatentStateType); - - if (null == dcOvernight) continue; - - try { - fcm = new org.drip.historical.state.FundingCurveMetrics (adtSpot[i]); - - for (java.lang.String strInTenor : astrInTenor) { - org.drip.analytics.date.JulianDate dtIn = adtSpot[i].addTenor (strInTenor); - - for (int j = 0; j < iNumForTenor; ++j) { - if (!fcm.addNativeForwardRate (strInTenor, astrForTenor[j], java.lang.Math.pow - (dcOvernight.df (dtIn) / dcOvernight.df (dtIn.addTenor (astrForTenor[j])), 1. / - adblForTenorDCF[j]) - 1.)) - continue; - } - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - continue; - } - - mapFCM.put (adtSpot[i], fcm); - } - - return mapFCM; - } -} diff --git a/org/drip/service/template/ExchangeInstrumentBuilder.java b/org/drip/service/template/ExchangeInstrumentBuilder.java deleted file mode 100644 index c656721..0000000 --- a/org/drip/service/template/ExchangeInstrumentBuilder.java +++ /dev/null @@ -1,371 +0,0 @@ - -package org.drip.service.template; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ExchangeInstrumentBuilder contains static Helper API to facilitate Construction of Exchange-traded - * Instruments. - * - * @author Lakshmi Krishnamurthy - */ - -public class ExchangeInstrumentBuilder { - - /** - * Generate a Forward Rate Futures Contract corresponding to the Spot Date - * - * @param dtSpot Spot date specifying the contract issue - * @param strCurrency Contract Currency - * - * @return Forward Rate Futures Component - */ - - public static org.drip.product.rates.SingleStreamComponent ForwardRateFutures ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strCurrency) - { - if (null == dtSpot) return null; - - org.drip.product.rates.SingleStreamComponent[] aFutures = - org.drip.product.creator.SingleStreamComponentBuilder.ForwardRateFuturesPack (dtSpot.addBusDays - (0, strCurrency), 1, strCurrency); - - return null == aFutures || 1 != aFutures.length ? null : aFutures[0]; - } - - /** - * Generate a Forward Rate Futures Pack corresponding to the Spot Date and the Specified Number of - * Contracts - * - * @param dtSpot Spot date specifying the contract issue - * @param iNumContract Number of contracts - * @param strCurrency Contract currency - * - * @return Array containing the Forward Rate Futures Pack - */ - - public static org.drip.product.rates.SingleStreamComponent[] ForwardRateFuturesPack ( - final org.drip.analytics.date.JulianDate dtSpot, - final int iNumContract, - final java.lang.String strCurrency) - { - return null == dtSpot ? null : - org.drip.product.creator.SingleStreamComponentBuilder.ForwardRateFuturesPack (dtSpot.addBusDays - (0, strCurrency), iNumContract, strCurrency); - } - - /** - * Generate an Instance of Treasury Futures given the Inputs - * - * @param dtSpot The Futures Spot Date - * @param strCode The Treasury Code - * @param adtEffective Array of Effective Dates - * @param adtMaturity Array of Maturity Dates - * @param adblCoupon Array of Coupons - * @param adblConversionFactor The Bond Conversion Factor - * @param strUnderlierType The Underlier Type, e.g., TREASURY - * @param strUnderlierSubtype The Futures Underlier Sub-type, i.e., BONDS - * @param strMaturityTenor The Futures Maturity Tenor - * - * @return The Treasury Futures Instance - */ - - public static org.drip.product.govvie.TreasuryFutures TreasuryFutures ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strCode, - final org.drip.analytics.date.JulianDate[] adtEffective, - final org.drip.analytics.date.JulianDate[] adtMaturity, - final double[] adblCoupon, - final double[] adblConversionFactor, - final java.lang.String strUnderlierType, - final java.lang.String strUnderlierSubtype, - final java.lang.String strMaturityTenor) - { - if (null == dtSpot) return null; - - try { - org.drip.product.govvie.TreasuryFutures tsyFutures = new org.drip.product.govvie.TreasuryFutures - (org.drip.service.template.TreasuryBuilder.FromCode (strCode, adtEffective, adtMaturity, - adblCoupon), adblConversionFactor, null); - - java.lang.String strCurrency = tsyFutures.basket()[0].currency(); - - if (!tsyFutures.setExpiry (dtSpot.addBusDays (0, strCurrency).nextBondFuturesIMM (3, - strCurrency))) - return null; - - tsyFutures.setType (strCode); - - org.drip.market.exchange.TreasuryFuturesConvention bfc = - org.drip.market.exchange.TreasuryFuturesConventionContainer.FromJurisdictionTypeMaturity - (strCurrency, strUnderlierType, strUnderlierSubtype, strMaturityTenor); - - if (null == bfc) return tsyFutures; - - double dblBasketNotional = bfc.basketNotional(); - - double dblMinimumPriceMovement = bfc.minimumPriceMovement(); - - tsyFutures.setNotionalValue (dblBasketNotional); - - tsyFutures.setMinimumPriceMovement (dblMinimumPriceMovement); - - tsyFutures.setTickValue (dblBasketNotional * dblMinimumPriceMovement); - - org.drip.market.exchange.TreasuryFuturesEligibility bfe = bfc.eligibility(); - - if (null != bfe) { - tsyFutures.setMaximumMaturity (bfe.maturityCeiling()); - - tsyFutures.setMinimumMaturity (bfe.maturityFloor()); - } - - org.drip.market.exchange.TreasuryFuturesSettle bfs = bfc.settle(); - - if (null != bfs) { - tsyFutures.setReferenceCoupon (bfs.currentReferenceYield()); - - tsyFutures.setLastTradingDayLag (bfs.expiryLastTradingLag()); - - tsyFutures.setDeliveryMonths (bfs.deliveryMonths()); - } - - return tsyFutures; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Treasury Futures Instance - * - * @param dtSpot The Spot Date Instance - * @param strFuturesCode The Treasury Futures Code - * @param aiFuturesComponentTreasuryEffectiveDate Array of the Treasury Futures Component Effective Date - * @param aiFuturesComponentTreasuryMaturityDate Array of the Treasury Futures Component Maturity Date - * @param adblFuturesComponentTreasuryCoupon Array of the Treasury Futures Component Coupon - * @param adblFuturesComponentConversionFactor Array of the Treasury Futures Component Conversion Factor - * @param strFuturesComponentUnderlierSubtype Treasury Futures Component Underlier SubType (BILL/BOND) - * @param strFuturesReferenceMaturityTenor Treasury Futures Component Reference Maturity Tenor - * - * @return The Treasury Futures Instance - */ - - public static final org.drip.product.govvie.TreasuryFutures TreasuryFutures ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strFuturesCode, - final int[] aiFuturesComponentTreasuryEffectiveDate, - final int[] aiFuturesComponentTreasuryMaturityDate, - final double[] adblFuturesComponentTreasuryCoupon, - final double[] adblFuturesComponentConversionFactor, - final java.lang.String strFuturesComponentUnderlierSubtype, - final java.lang.String strFuturesReferenceMaturityTenor) - { - if (null == dtSpot || null == aiFuturesComponentTreasuryMaturityDate || null == - aiFuturesComponentTreasuryEffectiveDate) - return null; - - int iNumFuturesComponentMaturity = aiFuturesComponentTreasuryMaturityDate.length; - int iNumFuturesComponentEffective = aiFuturesComponentTreasuryEffectiveDate.length; - org.drip.analytics.date.JulianDate[] adtFuturesComponentTreasuryMaturity = null; - org.drip.analytics.date.JulianDate[] adtFuturesComponentTreasuryEffective = null; - - if (0 != iNumFuturesComponentMaturity) - adtFuturesComponentTreasuryMaturity = new - org.drip.analytics.date.JulianDate[iNumFuturesComponentMaturity]; - - if (0 != iNumFuturesComponentEffective) - adtFuturesComponentTreasuryEffective = new - org.drip.analytics.date.JulianDate[iNumFuturesComponentEffective]; - - try { - for (int i = 0; i < iNumFuturesComponentMaturity; ++i) - adtFuturesComponentTreasuryMaturity[i] = new org.drip.analytics.date.JulianDate - (aiFuturesComponentTreasuryMaturityDate[i]); - - for (int i = 0; i < iNumFuturesComponentEffective; ++i) - adtFuturesComponentTreasuryEffective[i] = new org.drip.analytics.date.JulianDate - (aiFuturesComponentTreasuryEffectiveDate[i]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return TreasuryFutures (dtSpot, strFuturesCode, adtFuturesComponentTreasuryEffective, - adtFuturesComponentTreasuryMaturity, adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, "TREASURY", strFuturesComponentUnderlierSubtype, - strFuturesReferenceMaturityTenor); - } - - /** - * Generate the Treasury Futures Instance - * - * @param dtSpot The Spot Date Instance - * @param strFuturesCode The Treasury Futures Code - * @param aiFuturesComponentTreasuryEffectiveDate Array of the Treasury Futures Component Effective Date - * @param aiFuturesComponentTreasuryMaturityDate Array of the Treasury Futures Component Maturity Date - * @param adblFuturesComponentTreasuryCoupon Array of the Treasury Futures Component Coupon - * @param adblFuturesComponentConversionFactor Array of the Treasury Futures Component Conversion Factor - * - * @return The Treasury Futures Instance - */ - - public static final org.drip.product.govvie.TreasuryFutures TreasuryFutures ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strFuturesCode, - final int[] aiFuturesComponentTreasuryEffectiveDate, - final int[] aiFuturesComponentTreasuryMaturityDate, - final double[] adblFuturesComponentTreasuryCoupon, - final double[] adblFuturesComponentConversionFactor) - { - /* if (null == strFuturesCode) return null; - - if ("CN1".equalsIgnoreCase (strFuturesCode)) - return TreasuryFutures (dtSpot, "CAN", aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, "NOTE", "10Y"); - - if ("DU1".equalsIgnoreCase (strFuturesCode) || "SCHATZ".equalsIgnoreCase (strFuturesCode)) - return TreasuryFutures (dtSpot, "DBR", aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, "NOTE", "2Y"); - - if ("FBB1".equalsIgnoreCase (strFuturesCode)) - return TreasuryFutures (dtSpot, "SPGB", aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, "NOTE", "10Y"); - - if ("FV1".equalsIgnoreCase (strFuturesCode)) - return TreasuryFutures (dtSpot, "UST", aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, "NOTE", "5Y"); - - if ("G1".equalsIgnoreCase (strFuturesCode)) - return TreasuryFutures (dtSpot, "GILT", aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, "NOTE", "10Y"); - - if ("IK1".equalsIgnoreCase (strFuturesCode)) - return TreasuryFutures (dtSpot, "BTPS", aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, "NOTE", "10Y"); - - if ("JB1".equalsIgnoreCase (strFuturesCode)) - return TreasuryFutures (dtSpot, "JGB", aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, "NOTE", "10Y"); - - if ("OAT1".equalsIgnoreCase (strFuturesCode)) - return TreasuryFutures (dtSpot, "FRTR", aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, "NOTE", "10Y"); - - if ("OE1".equalsIgnoreCase (strFuturesCode) || "BOBL".equalsIgnoreCase (strFuturesCode)) - return TreasuryFutures (dtSpot, "DBR", aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, "NOTE", "5Y"); - - if ("RX1".equalsIgnoreCase (strFuturesCode) || "BUND".equalsIgnoreCase (strFuturesCode)) - return TreasuryFutures (dtSpot, "DBR", aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, "NOTE", "10Y"); - - if ("TU1".equalsIgnoreCase (strFuturesCode)) - return TreasuryFutures (dtSpot, "UST", aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, "NOTE", "2Y"); - - if ("TY1".equalsIgnoreCase (strFuturesCode)) - return TreasuryFutures (dtSpot, "UST", aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, "NOTE", "10Y"); - - if ("UB1".equalsIgnoreCase (strFuturesCode) || "BUXL".equalsIgnoreCase (strFuturesCode)) - return TreasuryFutures (dtSpot, "DBR", aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, "NOTE", "30Y"); - - if ("ULTRA".equalsIgnoreCase (strFuturesCode)) - return TreasuryFutures (dtSpot, "UST", aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, "NOTE", "30Y"); - - if ("US1".equalsIgnoreCase (strFuturesCode)) - return TreasuryFutures (dtSpot, "UST", aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, "NOTE", "20Y"); - - if ("WB1".equalsIgnoreCase (strFuturesCode)) - return TreasuryFutures (dtSpot, "GILT", aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, "NOTE", "2Y"); - - if ("XM1".equalsIgnoreCase (strFuturesCode)) - return TreasuryFutures (dtSpot, "AGB", aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, "NOTE", "10Y"); - - if ("YM1".equalsIgnoreCase (strFuturesCode)) - return TreasuryFutures (dtSpot, "AGB", aiFuturesComponentTreasuryEffectiveDate, - aiFuturesComponentTreasuryMaturityDate, adblFuturesComponentTreasuryCoupon, - adblFuturesComponentConversionFactor, "NOTE", "3Y"); */ - - org.drip.market.exchange.TreasuryFuturesContract tfc = - org.drip.market.exchange.TreasuryFuturesContractContainer.TreasuryFuturesContract - (strFuturesCode); - - return null == tfc ? null : TreasuryFutures (dtSpot, tfc.code(), - aiFuturesComponentTreasuryEffectiveDate, aiFuturesComponentTreasuryMaturityDate, - adblFuturesComponentTreasuryCoupon, adblFuturesComponentConversionFactor, tfc.type(), - tfc.tenor()); - } -} diff --git a/org/drip/service/template/LatentMarketStateBuilder.java b/org/drip/service/template/LatentMarketStateBuilder.java deleted file mode 100644 index b1cd34c..0000000 --- a/org/drip/service/template/LatentMarketStateBuilder.java +++ /dev/null @@ -1,2278 +0,0 @@ - -package org.drip.service.template; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * LatentMarketStateBuilder contains static Helper API to facilitate Construction of the Latent Market States - * as Curves/Surfaces. - * - * @author Lakshmi Krishnamurthy - */ - -public class LatentMarketStateBuilder { - - /** - * Shape Preserving Latent State - */ - - public static final int SHAPE_PRESERVING = 0; - - /** - * Smoothened Latent State - */ - - public static final int SMOOTH = 1; - - /** - * Construct a Funding Curve Based off of the Input Exchange/OTC Market Instruments Using the specified - * Spline - * - * @param dtSpot The Spot Date - * @param strCurrency Currency - * @param astrDepositMaturityTenor Array of Deposit Maturity Tenors - * @param adblDepositQuote Array of Deposit Quotes - * @param strDepositMeasure Deposit Calibration Measure - * @param adblFuturesQuote Array of Futures Quotes - * @param strFuturesMeasure Futures Calibration Measure - * @param astrFixFloatMaturityTenor Array of Fix Float Swap Maturity Tenors - * @param adblFixFloatQuote Array of Fix Float Swap Quotes - * @param strFixFloatMeasure Fix Float Calibration Measure - * @param scbc Segment Custom Builder Control - * - * @return The Funding Curve Instance - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve FundingCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strCurrency, - final java.lang.String[] astrDepositMaturityTenor, - final double[] adblDepositQuote, - final java.lang.String strDepositMeasure, - final double[] adblFuturesQuote, - final java.lang.String strFuturesMeasure, - final java.lang.String[] astrFixFloatMaturityTenor, - final double[] adblFixFloatQuote, - final java.lang.String strFixFloatMeasure, - final org.drip.spline.params.SegmentCustomBuilderControl scbc) - { - if (null == dtSpot || null == strCurrency || strCurrency.isEmpty()) return null; - - org.drip.analytics.date.JulianDate dtEffective = dtSpot.addBusDays (0, strCurrency); - - org.drip.state.inference.LatentStateStretchSpec lsssDeposit = null; - org.drip.state.inference.LatentStateStretchSpec lsssFutures = null; - org.drip.state.inference.LatentStateStretchSpec lsssFixFloat = null; - int iNumFuturesComp = null == adblFuturesQuote ? 0 : adblFuturesQuote.length; - int iNumDepositQuote = null == adblDepositQuote ? 0 : adblDepositQuote.length; - int iNumFixFloatQuote = null == adblFixFloatQuote ? 0 : adblFixFloatQuote.length; - int iNumDepositComp = null == astrDepositMaturityTenor ? 0 : astrDepositMaturityTenor.length; - int iNumFixFloatComp = null == astrFixFloatMaturityTenor ? 0 : astrFixFloatMaturityTenor.length; - - if (iNumDepositQuote != iNumDepositComp || iNumFixFloatQuote != iNumFixFloatComp) return null; - - if (0 != iNumDepositComp) - lsssDeposit = org.drip.state.estimator.LatentStateStretchBuilder.ForwardFundingStretchSpec - ("DEPOSIT", org.drip.service.template.OTCInstrumentBuilder.FundingDeposit (dtEffective, - strCurrency, astrDepositMaturityTenor), strDepositMeasure, adblDepositQuote); - - if (0 != iNumFuturesComp) - lsssFutures = org.drip.state.estimator.LatentStateStretchBuilder.ForwardFundingStretchSpec - ("FUTURES", org.drip.service.template.ExchangeInstrumentBuilder.ForwardRateFuturesPack - (dtEffective, iNumFuturesComp, strCurrency), strFuturesMeasure, adblFuturesQuote); - - if (0 != iNumFixFloatComp) - lsssFixFloat = org.drip.state.estimator.LatentStateStretchBuilder.ForwardFundingStretchSpec - ("FIXFLOAT", org.drip.service.template.OTCInstrumentBuilder.FixFloatStandard (dtEffective, - strCurrency, "ALL", astrFixFloatMaturityTenor, "MAIN", 0.), strFixFloatMeasure, - adblFixFloatQuote); - - try { - org.drip.state.inference.LinearLatentStateCalibrator lcc = new - org.drip.state.inference.LinearLatentStateCalibrator (scbc, - org.drip.spline.stretch.BoundarySettings.NaturalStandard(), - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE, null, null); - - return org.drip.state.creator.ScenarioDiscountCurveBuilder.ShapePreservingDFBuild (strCurrency, - lcc, new org.drip.state.inference.LatentStateStretchSpec[] {lsssDeposit, lsssFutures, - lsssFixFloat}, org.drip.param.valuation.ValuationParams.Spot (dtSpot.julian()), null, - null, null, 1.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Shape Preserving Funding Curve Based off of the Input Exchange/OTC Market Instruments - * - * @param dtSpot The Spot Date - * @param strCurrency Currency - * @param astrDepositMaturityTenor Array of Deposit Maturity Tenors - * @param adblDepositQuote Array of Deposit Quotes - * @param strDepositMeasure Deposit Calibration Measure - * @param adblFuturesQuote Array of Futures Quotes - * @param strFuturesMeasure Futures Calibration Measure - * @param astrFixFloatMaturityTenor Array of Fix Float Swap Maturity Tenors - * @param adblFixFloatQuote Array of Fix Float Swap Quotes - * @param strFixFloatMeasure Fix Float Calibration Measure - * - * @return The Funding Curve Instance - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve ShapePreservingFundingCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strCurrency, - final java.lang.String[] astrDepositMaturityTenor, - final double[] adblDepositQuote, - final java.lang.String strDepositMeasure, - final double[] adblFuturesQuote, - final java.lang.String strFuturesMeasure, - final java.lang.String[] astrFixFloatMaturityTenor, - final double[] adblFixFloatQuote, - final java.lang.String strFixFloatMeasure) - { - try { - return FundingCurve (dtSpot, strCurrency, astrDepositMaturityTenor, adblDepositQuote, - strDepositMeasure, adblFuturesQuote, strFuturesMeasure, astrFixFloatMaturityTenor, - adblFixFloatQuote, strFixFloatMeasure, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (2), - org.drip.spline.params.SegmentInelasticDesignControl.Create (0, 2), new - org.drip.spline.params.ResponseScalingShapeControl (true, new - org.drip.function.r1tor1.QuadraticRationalShapeControl (0.)), - null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Smooth Funding Curve Based off of the Input Exchange/OTC Market Instruments - * - * @param dtSpot The Spot Date - * @param strCurrency Currency - * @param astrDepositMaturityTenor Array of Deposit Maturity Tenors - * @param adblDepositQuote Array of Deposit Quotes - * @param strDepositMeasure Deposit Calibration Measure - * @param adblFuturesQuote Array of Futures Quotes - * @param strFuturesMeasure Futures Calibration Measure - * @param astrFixFloatMaturityTenor Array of Fix Float Swap Maturity Tenors - * @param adblFixFloatQuote Array of Fix Float Swap Quotes - * @param strFixFloatMeasure Fix Float Calibration Measure - * - * @return The Funding Curve Instance - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve SmoothFundingCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strCurrency, - final java.lang.String[] astrDepositMaturityTenor, - final double[] adblDepositQuote, - final java.lang.String strDepositMeasure, - final double[] adblFuturesQuote, - final java.lang.String strFuturesMeasure, - final java.lang.String[] astrFixFloatMaturityTenor, - final double[] adblFixFloatQuote, - final java.lang.String strFixFloatMeasure) - { - try { - return FundingCurve (dtSpot, strCurrency, astrDepositMaturityTenor, adblDepositQuote, - strDepositMeasure, adblFuturesQuote, strFuturesMeasure, astrFixFloatMaturityTenor, - adblFixFloatQuote, strFixFloatMeasure, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (4), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), new - org.drip.spline.params.ResponseScalingShapeControl (true, new - org.drip.function.r1tor1.QuadraticRationalShapeControl (0.)), - null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Funding Curve Based off of the Input Exchange/OTC Market Instruments - * - * @param dtSpot The Spot Date - * @param strCurrency Currency - * @param astrDepositMaturityTenor Array of Deposit Maturity Tenors - * @param adblDepositQuote Array of Deposit Quotes - * @param strDepositMeasure Deposit Calibration Measure - * @param adblFuturesQuote Array of Futures Quotes - * @param strFuturesMeasure Futures Calibration Measure - * @param astrFixFloatMaturityTenor Array of Fix Float Swap Maturity Tenors - * @param adblFixFloatQuote Array of Fix Float Swap Quotes - * @param strFixFloatMeasure Fix Float Calibration Measure - * @param iLatentStateType SHAPE_PRESERVING/SMOOTH - * - * @return The Funding Curve Instance - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve FundingCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strCurrency, - final java.lang.String[] astrDepositMaturityTenor, - final double[] adblDepositQuote, - final java.lang.String strDepositMeasure, - final double[] adblFuturesQuote, - final java.lang.String strFuturesMeasure, - final java.lang.String[] astrFixFloatMaturityTenor, - final double[] adblFixFloatQuote, - final java.lang.String strFixFloatMeasure, - final int iLatentStateType) - { - if (SHAPE_PRESERVING == iLatentStateType) - return ShapePreservingFundingCurve (dtSpot, strCurrency, astrDepositMaturityTenor, adblDepositQuote, - strDepositMeasure, adblFuturesQuote, strFuturesMeasure, astrFixFloatMaturityTenor, - adblFixFloatQuote, strFixFloatMeasure); - - if (SMOOTH == iLatentStateType) - return SmoothFundingCurve (dtSpot, strCurrency, astrDepositMaturityTenor, adblDepositQuote, - strDepositMeasure, adblFuturesQuote, strFuturesMeasure, astrFixFloatMaturityTenor, - adblFixFloatQuote, strFixFloatMeasure); - - return null; - } - - /** - * Construct a Instance of the Forward Curve off of Exchange/OTC Market Instruments - * - * @param dtSpot Spot Date - * @param forwardLabel Forward Label - * @param astrDepositMaturityTenor Array of Deposit Maturity Tenors - * @param adblDepositQuote Array of the Deposit Instrument Quotes - * @param strDepositMeasure The Deposit Instrument Calibration Measure - * @param astrFRAMaturityTenor Array of FRA Maturity Tenors - * @param adblFRAQuote Array of the FRA Instrument Quotes - * @param strFRAMeasure The FRA Instrument Calibration Measure - * @param astrFixFloatMaturityTenor Array of Fix-Float Maturity Tenors - * @param adblFixFloatQuote Array of the Fix-Float Quotes - * @param strFixFloatMeasure The Fix-Float Calibration Measure - * @param astrFloatFloatMaturityTenor Array of Float-Float Maturity Tenors - * @param adblFloatFloatQuote Array of the Float-Float Quotes - * @param strFloatFloatMeasure The Float-Float Calibration Measure - * @param astrSyntheticFloatFloatMaturityTenor Array of Synthetic Float-Float Maturity Tenors - * @param adblSyntheticFloatFloatQuote Array of the Synthetic Float-Float Quotes - * @param strSyntheticFloatFloatMeasure The Synthetic Float-Float Calibration Measure - * @param dc The Base Discount Curve - * @param fcReference The Reference Forward Curve - * @param scbc Segment Custom Builder Control Parameters - * - * @return Instance of the Forward Curve - */ - - public static final org.drip.state.forward.ForwardCurve ForwardCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final java.lang.String[] astrDepositMaturityTenor, - final double[] adblDepositQuote, - final java.lang.String strDepositMeasure, - final java.lang.String[] astrFRAMaturityTenor, - final double[] adblFRAQuote, - final java.lang.String strFRAMeasure, - final java.lang.String[] astrFixFloatMaturityTenor, - final double[] adblFixFloatQuote, - final java.lang.String strFixFloatMeasure, - final java.lang.String[] astrFloatFloatMaturityTenor, - final double[] adblFloatFloatQuote, - final java.lang.String strFloatFloatMeasure, - final java.lang.String[] astrSyntheticFloatFloatMaturityTenor, - final double[] adblSyntheticFloatFloatQuote, - final java.lang.String strSyntheticFloatFloatMeasure, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.state.forward.ForwardCurve fcReference, - final org.drip.spline.params.SegmentCustomBuilderControl scbc) - { - if (null == dtSpot || null == forwardLabel || null == dc) return null; - - java.lang.String strCurrency = forwardLabel.currency(); - - org.drip.analytics.date.JulianDate dtEffective = dtSpot.addBusDays (0, strCurrency); - - org.drip.state.inference.LatentStateStretchSpec lsssFRA = null; - org.drip.state.inference.LinearLatentStateCalibrator lcc = null; - int iNumFRAQuote = null == adblFRAQuote ? 0 : adblFRAQuote.length; - org.drip.state.inference.LatentStateStretchSpec lsssDeposit = null; - org.drip.state.inference.LatentStateStretchSpec lsssFixFloat = null; - org.drip.state.inference.LatentStateStretchSpec lsssFloatFloat = null; - int iNumDepositQuote = null == adblDepositQuote ? 0 : adblDepositQuote.length; - org.drip.state.inference.LatentStateStretchSpec lsssSyntheticFloatFloat = null; - int iNumFRAComp = null == astrFRAMaturityTenor ? 0 : astrFRAMaturityTenor.length; - int iNumFixFloatQuote = null == adblFixFloatQuote ? 0 : adblFixFloatQuote.length; - int iNumFloatFloatQuote = null == adblFloatFloatQuote ? 0 : adblFloatFloatQuote.length; - int iNumDepositComp = null == astrDepositMaturityTenor ? 0 : astrDepositMaturityTenor.length; - int iNumFixFloatComp = null == astrFixFloatMaturityTenor ? 0 : astrFixFloatMaturityTenor.length; - int iNumFloatFloatComp = null == astrFloatFloatMaturityTenor ? 0 : - astrFloatFloatMaturityTenor.length; - int iNumSyntheticFloatFloatQuote = null == adblSyntheticFloatFloatQuote ? 0 : - adblSyntheticFloatFloatQuote.length; - int iNumSyntheticFloatFloatComp = null == astrSyntheticFloatFloatMaturityTenor ? 0 : - astrSyntheticFloatFloatMaturityTenor.length; - - if (iNumDepositQuote != iNumDepositComp || iNumFRAQuote != iNumFRAComp || iNumFixFloatQuote != - iNumFixFloatComp || iNumFloatFloatQuote != iNumFloatFloatComp || iNumSyntheticFloatFloatQuote != - iNumSyntheticFloatFloatComp) - return null; - - if (0 != iNumDepositComp) - lsssDeposit = org.drip.state.estimator.LatentStateStretchBuilder.ForwardStretchSpec ("DEPOSIT", - org.drip.service.template.OTCInstrumentBuilder.ForwardRateDeposit (dtEffective, - astrDepositMaturityTenor, forwardLabel), strDepositMeasure, adblDepositQuote); - - if (0 != iNumFRAComp) - lsssFRA = org.drip.state.estimator.LatentStateStretchBuilder.ForwardStretchSpec ("FRA", - org.drip.service.template.OTCInstrumentBuilder.FRAStandard (dtEffective, forwardLabel, - astrFRAMaturityTenor, adblFRAQuote), strFRAMeasure, adblFRAQuote); - - if (0 != iNumFixFloatComp) - lsssFixFloat = org.drip.state.estimator.LatentStateStretchBuilder.ForwardStretchSpec ("FIXFLOAT", - org.drip.service.template.OTCInstrumentBuilder.FixFloatCustom (dtEffective, forwardLabel, - astrFixFloatMaturityTenor), strFixFloatMeasure, adblFixFloatQuote); - - if (0 != iNumFloatFloatComp) - lsssFloatFloat = org.drip.state.estimator.LatentStateStretchBuilder.ForwardStretchSpec - ("FLOATFLOAT", org.drip.service.template.OTCInstrumentBuilder.FloatFloat (dtEffective, - strCurrency, forwardLabel.tenor(), astrFloatFloatMaturityTenor, 0.), - strFloatFloatMeasure, adblFloatFloatQuote); - - if (0 != iNumSyntheticFloatFloatComp) - lsssSyntheticFloatFloat = org.drip.state.estimator.LatentStateStretchBuilder.ForwardStretchSpec - ("SYNTHETICFLOATFLOAT", org.drip.service.template.OTCInstrumentBuilder.FloatFloat - (dtEffective, strCurrency, forwardLabel.tenor(), astrSyntheticFloatFloatMaturityTenor, - 0.), strSyntheticFloatFloatMeasure, adblSyntheticFloatFloatQuote); - - org.drip.state.inference.LatentStateStretchSpec[] aStretchSpec = new - org.drip.state.inference.LatentStateStretchSpec[] {lsssDeposit, lsssFRA, lsssFixFloat, - lsssFloatFloat, lsssSyntheticFloatFloat}; - - try { - lcc = new org.drip.state.inference.LinearLatentStateCalibrator (scbc, - org.drip.spline.stretch.BoundarySettings.NaturalStandard(), - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE, null, null); - - return org.drip.state.creator.ScenarioForwardCurveBuilder.ShapePreservingForwardCurve (lcc, - aStretchSpec, forwardLabel, org.drip.param.valuation.ValuationParams.Spot - (dtEffective.julian()), null, org.drip.param.creator.MarketParamsBuilder.Create (dc, - fcReference, null, null, null, null, null, null), null, 0 == iNumDepositComp ? - adblFRAQuote[0] : adblDepositQuote[0]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Instance of the Shape Preserving Forward Curve off of Exchange/OTC Market Instruments - * - * @param dtSpot Spot Date - * @param forwardLabel Forward Label - * @param astrDepositMaturityTenor Array of Deposit Maturity Tenors - * @param adblDepositQuote Array of the Deposit Instrument Quotes - * @param strDepositMeasure The Deposit Instrument Calibration Measure - * @param astrFRAMaturityTenor Array of FRA Maturity Tenors - * @param adblFRAQuote Array of the FRA Instrument Quotes - * @param strFRAMeasure The FRA Instrument Calibration Measure - * @param astrFixFloatMaturityTenor Array of Fix-Float Maturity Tenors - * @param adblFixFloatQuote Array of the Fix-Float Quotes - * @param strFixFloatMeasure The Fix-Float Calibration Measure - * @param astrFloatFloatMaturityTenor Array of Float-Float Maturity Tenors - * @param adblFloatFloatQuote Array of the Float-Float Quotes - * @param strFloatFloatMeasure The Float-Float Calibration Measure - * @param astrSyntheticFloatFloatMaturityTenor Array of Synthetic Float-Float Maturity Tenors - * @param adblSyntheticFloatFloatQuote Array of the Synthetic Float-Float Quotes - * @param strSyntheticFloatFloatMeasure The Synthetic Float-Float Calibration Measure - * @param dc The Base Discount Curve - * @param fcReference The Reference Forward Curve - * - * @return Instance of the Forward Curve - */ - - public static final org.drip.state.forward.ForwardCurve ShapePreservingForwardCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final java.lang.String[] astrDepositMaturityTenor, - final double[] adblDepositQuote, - final java.lang.String strDepositMeasure, - final java.lang.String[] astrFRAMaturityTenor, - final double[] adblFRAQuote, - final java.lang.String strFRAMeasure, - final java.lang.String[] astrFixFloatMaturityTenor, - final double[] adblFixFloatQuote, - final java.lang.String strFixFloatMeasure, - final java.lang.String[] astrFloatFloatMaturityTenor, - final double[] adblFloatFloatQuote, - final java.lang.String strFloatFloatMeasure, - final java.lang.String[] astrSyntheticFloatFloatMaturityTenor, - final double[] adblSyntheticFloatFloatQuote, - final java.lang.String strSyntheticFloatFloatMeasure, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.state.forward.ForwardCurve fcReference) - { - try { - return ForwardCurve (dtSpot, forwardLabel, astrDepositMaturityTenor, adblDepositQuote, - strDepositMeasure, astrFRAMaturityTenor, adblFRAQuote, strFRAMeasure, - astrFixFloatMaturityTenor, adblFixFloatQuote, strFixFloatMeasure, - astrFloatFloatMaturityTenor, adblFloatFloatQuote, strFloatFloatMeasure, - astrSyntheticFloatFloatMaturityTenor, adblSyntheticFloatFloatQuote, - strSyntheticFloatFloatMeasure, dc, fcReference, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new org.drip.spline.basis.PolynomialFunctionSetParams (2), - org.drip.spline.params.SegmentInelasticDesignControl.Create (0, 2), new - org.drip.spline.params.ResponseScalingShapeControl (true, new - org.drip.function.r1tor1.QuadraticRationalShapeControl (0.)), null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Instance of Smooth Forward Curve off of Exchange/OTC Market Instruments - * - * @param dtSpot Spot Date - * @param forwardLabel Forward Label - * @param astrDepositMaturityTenor Array of Deposit Maturity Tenors - * @param adblDepositQuote Array of the Deposit Instrument Quotes - * @param strDepositMeasure The Deposit Instrument Calibration Measure - * @param astrFRAMaturityTenor Array of FRA Maturity Tenors - * @param adblFRAQuote Array of the FRA Instrument Quotes - * @param strFRAMeasure The FRA Instrument Calibration Measure - * @param astrFixFloatMaturityTenor Array of Fix-Float Maturity Tenors - * @param adblFixFloatQuote Array of the Fix-Float Quotes - * @param strFixFloatMeasure The Fix-Float Calibration Measure - * @param astrFloatFloatMaturityTenor Array of Float-Float Maturity Tenors - * @param adblFloatFloatQuote Array of the Float-Float Quotes - * @param strFloatFloatMeasure The Float-Float Calibration Measure - * @param astrSyntheticFloatFloatMaturityTenor Array of Synthetic Float-Float Maturity Tenors - * @param adblSyntheticFloatFloatQuote Array of the Synthetic Float-Float Quotes - * @param strSyntheticFloatFloatMeasure The Synthetic Float-Float Calibration Measure - * @param dc The Base Discount Curve - * @param fcReference The Reference Forward Curve - * - * @return Instance of the Forward Curve - */ - - public static final org.drip.state.forward.ForwardCurve SmoothForwardCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final java.lang.String[] astrDepositMaturityTenor, - final double[] adblDepositQuote, - final java.lang.String strDepositMeasure, - final java.lang.String[] astrFRAMaturityTenor, - final double[] adblFRAQuote, - final java.lang.String strFRAMeasure, - final java.lang.String[] astrFixFloatMaturityTenor, - final double[] adblFixFloatQuote, - final java.lang.String strFixFloatMeasure, - final java.lang.String[] astrFloatFloatMaturityTenor, - final double[] adblFloatFloatQuote, - final java.lang.String strFloatFloatMeasure, - final java.lang.String[] astrSyntheticFloatFloatMaturityTenor, - final double[] adblSyntheticFloatFloatQuote, - final java.lang.String strSyntheticFloatFloatMeasure, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.state.forward.ForwardCurve fcReference) - { - try { - return ForwardCurve (dtSpot, forwardLabel, astrDepositMaturityTenor, adblDepositQuote, - strDepositMeasure, astrFRAMaturityTenor, adblFRAQuote, strFRAMeasure, - astrFixFloatMaturityTenor, adblFixFloatQuote, strFixFloatMeasure, - astrFloatFloatMaturityTenor, adblFloatFloatQuote, strFloatFloatMeasure, - astrSyntheticFloatFloatMaturityTenor, adblSyntheticFloatFloatQuote, - strSyntheticFloatFloatMeasure, dc, fcReference, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new org.drip.spline.basis.PolynomialFunctionSetParams (4), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), new - org.drip.spline.params.ResponseScalingShapeControl (true, new - org.drip.function.r1tor1.QuadraticRationalShapeControl (0.)), null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Instance of the Smooth/Shape Preserving Forward Curve off of Exchange/OTC Market - * Instruments - * - * @param dtSpot Spot Date - * @param forwardLabel Forward Label - * @param astrDepositMaturityTenor Array of Deposit Maturity Tenors - * @param adblDepositQuote Array of the Deposit Instrument Quotes - * @param strDepositMeasure The Deposit Instrument Calibration Measure - * @param astrFRAMaturityTenor Array of FRA Maturity Tenors - * @param adblFRAQuote Array of the FRA Instrument Quotes - * @param strFRAMeasure The FRA Instrument Calibration Measure - * @param astrFixFloatMaturityTenor Array of Fix-Float Maturity Tenors - * @param adblFixFloatQuote Array of the Fix-Float Quotes - * @param strFixFloatMeasure The Fix-Float Calibration Measure - * @param astrFloatFloatMaturityTenor Array of Float-Float Maturity Tenors - * @param adblFloatFloatQuote Array of the Float-Float Quotes - * @param strFloatFloatMeasure The Float-Float Calibration Measure - * @param astrSyntheticFloatFloatMaturityTenor Array of Synthetic Float-Float Maturity Tenors - * @param adblSyntheticFloatFloatQuote Array of the Synthetic Float-Float Quotes - * @param strSyntheticFloatFloatMeasure The Synthetic Float-Float Calibration Measure - * @param dc The Base Discount Curve - * @param fcReference The Reference Forward Curve - * @param iLatentStateType SHAPE_PRESERVING/SMOOTH - * - * @return Instance of the Forward Curve - */ - - public static final org.drip.state.forward.ForwardCurve ForwardCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final java.lang.String[] astrDepositMaturityTenor, - final double[] adblDepositQuote, - final java.lang.String strDepositMeasure, - final java.lang.String[] astrFRAMaturityTenor, - final double[] adblFRAQuote, - final java.lang.String strFRAMeasure, - final java.lang.String[] astrFixFloatMaturityTenor, - final double[] adblFixFloatQuote, - final java.lang.String strFixFloatMeasure, - final java.lang.String[] astrFloatFloatMaturityTenor, - final double[] adblFloatFloatQuote, - final java.lang.String strFloatFloatMeasure, - final java.lang.String[] astrSyntheticFloatFloatMaturityTenor, - final double[] adblSyntheticFloatFloatQuote, - final java.lang.String strSyntheticFloatFloatMeasure, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.state.forward.ForwardCurve fcReference, - final int iLatentStateType) - { - if (SHAPE_PRESERVING == iLatentStateType) - return ShapePreservingForwardCurve (dtSpot, forwardLabel, astrDepositMaturityTenor, - adblDepositQuote, strDepositMeasure, astrFRAMaturityTenor, adblFRAQuote, strFRAMeasure, - astrFixFloatMaturityTenor, adblFixFloatQuote, strFixFloatMeasure, - astrFloatFloatMaturityTenor, adblFloatFloatQuote, strFloatFloatMeasure, - astrSyntheticFloatFloatMaturityTenor, adblSyntheticFloatFloatQuote, - strSyntheticFloatFloatMeasure, dc, fcReference); - - if (SMOOTH == iLatentStateType) - return SmoothForwardCurve (dtSpot, forwardLabel, astrDepositMaturityTenor, adblDepositQuote, - strDepositMeasure, astrFRAMaturityTenor, adblFRAQuote, strFRAMeasure, - astrFixFloatMaturityTenor, adblFixFloatQuote, strFixFloatMeasure, - astrFloatFloatMaturityTenor, adblFloatFloatQuote, strFloatFloatMeasure, - astrSyntheticFloatFloatMaturityTenor, adblSyntheticFloatFloatQuote, - strSyntheticFloatFloatMeasure, dc, fcReference); - - return null; - } - - /** - * Construct an Overnight Curve from Overnight Exchange/OTC Market Instruments - * - * @param dtSpot Spot Date - * @param strCurrency Currency - * @param astrDepositMaturityTenor Array of Deposit Maturity Tenors - * @param adblDepositQuote Array of Deposit Quotes - * @param strDepositMeasure Deposit Measure - * @param astrShortEndOISMaturityTenor Array of Short End OIS Maturity Tenors - * @param adblShortEndOISQuote Array of Short End OIS Quotes - * @param strShortEndOISMeasure Short End OIS Measure - * @param astrOISFuturesEffectiveTenor Array of OIS Futures Effective Tenors - * @param astrOISFuturesMaturityTenor Array of OIS Futures Maturity Tenors - * @param adblOISFuturesQuote Array of OIS Futures Quotes - * @param strOISFuturesMeasure OIS Futures Measure - * @param astrLongEndOISMaturityTenor Array of Long End OIS Maturity Tenors - * @param adblLongEndOISQuote Array of Long End OIS Quotes - * @param strLongEndOISMeasure Long End OIS Measure - * @param scbc Segment Custom Builder Control - * - * @return Overnight Curve from Overnight OTC Instruments - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve OvernightCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final String strCurrency, - final java.lang.String[] astrDepositMaturityTenor, - final double[] adblDepositQuote, - final java.lang.String strDepositMeasure, - final java.lang.String[] astrShortEndOISMaturityTenor, - final double[] adblShortEndOISQuote, - final java.lang.String strShortEndOISMeasure, - final java.lang.String[] astrOISFuturesEffectiveTenor, - final java.lang.String[] astrOISFuturesMaturityTenor, - final double[] adblOISFuturesQuote, - final java.lang.String strOISFuturesMeasure, - final java.lang.String[] astrLongEndOISMaturityTenor, - final double[] adblLongEndOISQuote, - final java.lang.String strLongEndOISMeasure, - final org.drip.spline.params.SegmentCustomBuilderControl scbc) - { - if (null == dtSpot) return null; - - org.drip.state.inference.LatentStateStretchSpec lsssDeposit = null; - org.drip.state.inference.LatentStateStretchSpec lsssOISFutures = null; - org.drip.state.inference.LatentStateStretchSpec lsssLongEndOIS = null; - org.drip.state.inference.LatentStateStretchSpec lsssShortEndOIS = null; - int iNumDepositQuote = null == adblDepositQuote ? 0 : adblDepositQuote.length; - int iNumOISFuturesQuote = null == adblOISFuturesQuote ? 0 : adblOISFuturesQuote.length; - int iNumLongEndOISQuote = null == adblLongEndOISQuote ? 0 : adblLongEndOISQuote.length; - int iNumShortEndOISQuote = null == adblShortEndOISQuote ? 0 : adblShortEndOISQuote.length; - int iNumDepositComp = null == astrDepositMaturityTenor ? 0 : astrDepositMaturityTenor.length; - int iNumOISFuturesComp = null == astrOISFuturesMaturityTenor ? 0 : - astrOISFuturesMaturityTenor.length; - int iNumOISFuturesComp2 = null == astrOISFuturesEffectiveTenor ? 0 : - astrOISFuturesEffectiveTenor.length; - int iNumLongEndOISComp = null == astrLongEndOISMaturityTenor ? 0 : - astrLongEndOISMaturityTenor.length; - int iNumShortEndOISComp = null == astrShortEndOISMaturityTenor ? 0 : - astrShortEndOISMaturityTenor.length; - - if (iNumDepositQuote != iNumDepositComp || iNumShortEndOISQuote != iNumShortEndOISComp || - iNumOISFuturesQuote != iNumOISFuturesComp || iNumOISFuturesComp2 != iNumOISFuturesComp || - iNumLongEndOISQuote != iNumLongEndOISComp) - return null; - - org.drip.analytics.date.JulianDate dtEffective = dtSpot.addBusDays (0, strCurrency); - - if (0 != iNumDepositComp) - lsssDeposit = org.drip.state.estimator.LatentStateStretchBuilder.ForwardFundingStretchSpec - ("DEPOSIT", org.drip.service.template.OTCInstrumentBuilder.OvernightDeposit (dtEffective, - strCurrency, astrDepositMaturityTenor), strDepositMeasure, adblDepositQuote); - - if (0 != iNumShortEndOISComp) - lsssShortEndOIS = org.drip.state.estimator.LatentStateStretchBuilder.ForwardFundingStretchSpec - ("SHORTENDOIS", org.drip.service.template.OTCInstrumentBuilder.OISFixFloat (dtEffective, - strCurrency, astrShortEndOISMaturityTenor, adblShortEndOISQuote, false), - strShortEndOISMeasure, adblShortEndOISQuote); - - if (0 != iNumOISFuturesComp) - lsssOISFutures = org.drip.state.estimator.LatentStateStretchBuilder.ForwardFundingStretchSpec - ("OISFUTURES", org.drip.service.template.OTCInstrumentBuilder.OISFixFloatFutures - (dtEffective, strCurrency, astrOISFuturesEffectiveTenor, astrOISFuturesMaturityTenor, - adblOISFuturesQuote, false), strOISFuturesMeasure, adblOISFuturesQuote); - - if (0 != iNumLongEndOISComp) - lsssLongEndOIS = org.drip.state.estimator.LatentStateStretchBuilder.ForwardFundingStretchSpec - ("LONGENDOIS", org.drip.service.template.OTCInstrumentBuilder.OISFixFloat (dtEffective, - strCurrency, astrLongEndOISMaturityTenor, adblLongEndOISQuote, false), - strLongEndOISMeasure, adblLongEndOISQuote); - - try { - org.drip.state.inference.LinearLatentStateCalibrator lcc = new - org.drip.state.inference.LinearLatentStateCalibrator (scbc, - org.drip.spline.stretch.BoundarySettings.NaturalStandard(), - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE, null, null); - - return org.drip.state.creator.ScenarioDiscountCurveBuilder.ShapePreservingDFBuild (strCurrency, - lcc, new org.drip.state.inference.LatentStateStretchSpec[] {lsssDeposit, lsssShortEndOIS, - lsssOISFutures, lsssLongEndOIS}, org.drip.param.valuation.ValuationParams.Spot - (dtEffective.julian()), null, null, null, 1.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Shape Preserving Overnight Curve from Overnight Exchange/OTC Market Instruments - * - * @param dtSpot Spot Date - * @param strCurrency Currency - * @param astrDepositMaturityTenor Array of Deposit Maturity Tenors - * @param adblDepositQuote Array of Deposit Quotes - * @param strDepositMeasure Deposit Measure - * @param astrShortEndOISMaturityTenor Array of Short End OIS Maturity Tenors - * @param adblShortEndOISQuote Array of Short End OIS Quotes - * @param strShortEndOISMeasure Short End OIS Measure - * @param astrOISFuturesEffectiveTenor Array of OIS Futures Effective Tenors - * @param astrOISFuturesMaturityTenor Array of OIS Futures Maturity Tenors - * @param adblOISFuturesQuote Array of OIS Futures Quotes - * @param strOISFuturesMeasure OIS Futures Measure - * @param astrLongEndOISMaturityTenor Array of Long End OIS Maturity Tenors - * @param adblLongEndOISQuote Array of Long End OIS Quotes - * @param strLongEndOISMeasure Long End OIS Measure - * - * @return Overnight Curve from Overnight OTC Instruments - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve ShapePreservingOvernightCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final String strCurrency, - final java.lang.String[] astrDepositMaturityTenor, - final double[] adblDepositQuote, - final java.lang.String strDepositMeasure, - final java.lang.String[] astrShortEndOISMaturityTenor, - final double[] adblShortEndOISQuote, - final java.lang.String strShortEndOISMeasure, - final java.lang.String[] astrOISFuturesEffectiveTenor, - final java.lang.String[] astrOISFuturesMaturityTenor, - final double[] adblOISFuturesQuote, - final java.lang.String strOISFuturesMeasure, - final java.lang.String[] astrLongEndOISMaturityTenor, - final double[] adblLongEndOISQuote, - final java.lang.String strLongEndOISMeasure) - { - try { - return OvernightCurve (dtSpot, strCurrency, astrDepositMaturityTenor, adblDepositQuote, - strDepositMeasure, astrShortEndOISMaturityTenor, adblShortEndOISQuote, strShortEndOISMeasure, - astrOISFuturesEffectiveTenor, astrOISFuturesMaturityTenor, adblOISFuturesQuote, - strOISFuturesMeasure, astrLongEndOISMaturityTenor, adblLongEndOISQuote, - strLongEndOISMeasure, new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new org.drip.spline.basis.PolynomialFunctionSetParams (2), - org.drip.spline.params.SegmentInelasticDesignControl.Create (0, 2), - new org.drip.spline.params.ResponseScalingShapeControl (true, new - org.drip.function.r1tor1.QuadraticRationalShapeControl (0.)), - null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Smooth Overnight Curve from Overnight Exchange/OTC Market Instruments - * - * @param dtSpot Spot Date - * @param strCurrency Currency - * @param astrDepositMaturityTenor Array of Deposit Maturity Tenors - * @param adblDepositQuote Array of Deposit Quotes - * @param strDepositMeasure Deposit Measure - * @param astrShortEndOISMaturityTenor Array of Short End OIS Maturity Tenors - * @param adblShortEndOISQuote Array of Short End OIS Quotes - * @param strShortEndOISMeasure Short End OIS Measure - * @param astrOISFuturesEffectiveTenor Array of OIS Futures Effective Tenors - * @param astrOISFuturesMaturityTenor Array of OIS Futures Maturity Tenors - * @param adblOISFuturesQuote Array of OIS Futures Quotes - * @param strOISFuturesMeasure OIS Futures Measure - * @param astrLongEndOISMaturityTenor Array of Long End OIS Maturity Tenors - * @param adblLongEndOISQuote Array of Long End OIS Quotes - * @param strLongEndOISMeasure Long End OIS Measure - * - * @return Overnight Curve from Overnight OTC Instruments - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve SmoothOvernightCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final String strCurrency, - final java.lang.String[] astrDepositMaturityTenor, - final double[] adblDepositQuote, - final java.lang.String strDepositMeasure, - final java.lang.String[] astrShortEndOISMaturityTenor, - final double[] adblShortEndOISQuote, - final java.lang.String strShortEndOISMeasure, - final java.lang.String[] astrOISFuturesEffectiveTenor, - final java.lang.String[] astrOISFuturesMaturityTenor, - final double[] adblOISFuturesQuote, - final java.lang.String strOISFuturesMeasure, - final java.lang.String[] astrLongEndOISMaturityTenor, - final double[] adblLongEndOISQuote, - final java.lang.String strLongEndOISMeasure) - { - try { - return OvernightCurve (dtSpot, strCurrency, astrDepositMaturityTenor, adblDepositQuote, - strDepositMeasure, astrShortEndOISMaturityTenor, adblShortEndOISQuote, strShortEndOISMeasure, - astrOISFuturesEffectiveTenor, astrOISFuturesMaturityTenor, adblOISFuturesQuote, - strOISFuturesMeasure, astrLongEndOISMaturityTenor, adblLongEndOISQuote, - strLongEndOISMeasure, new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, - new org.drip.spline.basis.PolynomialFunctionSetParams (4), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), - new org.drip.spline.params.ResponseScalingShapeControl (true, new - org.drip.function.r1tor1.QuadraticRationalShapeControl (0.)), - null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an Overnight Curve from Overnight Exchange/OTC Market Instruments - * - * @param dtSpot Spot Date - * @param strCurrency Currency - * @param astrDepositMaturityTenor Array of Deposit Maturity Tenors - * @param adblDepositQuote Array of Deposit Quotes - * @param strDepositMeasure Deposit Measure - * @param astrShortEndOISMaturityTenor Array of Short End OIS Maturity Tenors - * @param adblShortEndOISQuote Array of Short End OIS Quotes - * @param strShortEndOISMeasure Short End OIS Measure - * @param astrOISFuturesEffectiveTenor Array of OIS Futures Effective Tenors - * @param astrOISFuturesMaturityTenor Array of OIS Futures Maturity Tenors - * @param adblOISFuturesQuote Array of OIS Futures Quotes - * @param strOISFuturesMeasure OIS Futures Measure - * @param astrLongEndOISMaturityTenor Array of Long End OIS Maturity Tenors - * @param adblLongEndOISQuote Array of Long End OIS Quotes - * @param strLongEndOISMeasure Long End OIS Measure - * @param iLatentStateType SHAPE PRESERVING/SMOOTH - * - * @return Overnight Curve from Overnight OTC Instruments - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve OvernightCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final String strCurrency, - final java.lang.String[] astrDepositMaturityTenor, - final double[] adblDepositQuote, - final java.lang.String strDepositMeasure, - final java.lang.String[] astrShortEndOISMaturityTenor, - final double[] adblShortEndOISQuote, - final java.lang.String strShortEndOISMeasure, - final java.lang.String[] astrOISFuturesEffectiveTenor, - final java.lang.String[] astrOISFuturesMaturityTenor, - final double[] adblOISFuturesQuote, - final java.lang.String strOISFuturesMeasure, - final java.lang.String[] astrLongEndOISMaturityTenor, - final double[] adblLongEndOISQuote, - final java.lang.String strLongEndOISMeasure, - final int iLatentStateType) - { - if (SHAPE_PRESERVING == iLatentStateType) - return ShapePreservingOvernightCurve (dtSpot, strCurrency, astrDepositMaturityTenor, - adblDepositQuote, strDepositMeasure, astrShortEndOISMaturityTenor, adblShortEndOISQuote, - strShortEndOISMeasure, astrOISFuturesEffectiveTenor, astrOISFuturesMaturityTenor, - adblOISFuturesQuote, strOISFuturesMeasure, astrLongEndOISMaturityTenor, - adblLongEndOISQuote, strLongEndOISMeasure); - - if (SMOOTH == iLatentStateType) - return SmoothOvernightCurve (dtSpot, strCurrency, astrDepositMaturityTenor, adblDepositQuote, - strDepositMeasure, astrShortEndOISMaturityTenor, adblShortEndOISQuote, strShortEndOISMeasure, - astrOISFuturesEffectiveTenor, astrOISFuturesMaturityTenor, adblOISFuturesQuote, - strOISFuturesMeasure, astrLongEndOISMaturityTenor, adblLongEndOISQuote, - strLongEndOISMeasure); - - return null; - } - - /** - * Construct a Credit Curve from Overnight Exchange/OTC Market Instruments - * - * @param dtSpot Spot Date - * @param strCredit Credit Curve - * @param astrMaturityTenor Maturity Tenor - * @param adblCoupon Coupon Array - * @param adblQuote Array of Market Quotes - * @param strMeasure Calibration Measure - * @param dc Discount Curve - * - * @return The Credit Curve Instance - */ - - public static final org.drip.state.credit.CreditCurve CreditCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strCredit, - final java.lang.String[] astrMaturityTenor, - final double[] adblCoupon, - final double[] adblQuote, - final java.lang.String strMeasure, - final org.drip.state.discount.MergedDiscountForwardCurve dc) - { - if (null == dtSpot || null == dc) return null; - - java.lang.String strCurrency = dc.currency(); - - org.drip.analytics.date.JulianDate dtEffective = dtSpot.addBusDays (0, strCurrency); - - org.drip.product.definition.CreditDefaultSwap[] aCDS = - org.drip.service.template.OTCInstrumentBuilder.CDS (dtEffective, astrMaturityTenor, adblCoupon, - strCurrency, strCredit); - - if (null == aCDS) return null; - - int iNumCDS = aCDS.length; - java.lang.String[] astrMeasure = new java.lang.String[iNumCDS]; - - if (0 == iNumCDS) return null; - - for (int i = 0; i < iNumCDS; ++i) - astrMeasure[i] = strMeasure; - - return org.drip.state.creator.ScenarioCreditCurveBuilder.Custom (strCredit, dtEffective, aCDS, dc, - adblQuote, astrMeasure, "CAD".equalsIgnoreCase (strCurrency) || "EUR".equalsIgnoreCase - (strCurrency) || "GBP".equalsIgnoreCase (strCurrency) || "HKD".equalsIgnoreCase (strCurrency) - || "USD".equalsIgnoreCase (strCurrency) ? 0.40 : 0.25, "QuotedSpread".equals - (strMeasure)); - } - - /** - * Construct a Credit Curve from the specified Calibration CDS Instruments - * - * @param dtSpot Spot Date - * @param aCDS Array of the Calibration CDS Instruments - * @param adblQuote Array of Market Quotes - * @param strMeasure Calibration Measure - * @param dc Discount Curve - * - * @return The Credit Curve Instance - */ - - public static final org.drip.state.credit.CreditCurve CreditCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.product.definition.CreditDefaultSwap[] aCDS, - final double[] adblQuote, - final java.lang.String strMeasure, - final org.drip.state.discount.MergedDiscountForwardCurve dc) - { - if (null == dtSpot || null == dc) return null; - - java.lang.String strCurrency = dc.currency(); - - if (null == aCDS) return null; - - int iNumCDS = aCDS.length; - java.lang.String[] astrMeasure = new java.lang.String[iNumCDS]; - - if (0 == iNumCDS) return null; - - for (int i = 0; i < iNumCDS; ++i) - astrMeasure[i] = strMeasure; - - return org.drip.state.creator.ScenarioCreditCurveBuilder.Custom - (aCDS[0].creditLabel().referenceEntity(), dtSpot, aCDS, dc, adblQuote, astrMeasure, - "CAD".equalsIgnoreCase (strCurrency) || "EUR".equalsIgnoreCase (strCurrency) || - "GBP".equalsIgnoreCase (strCurrency) || "HKD".equalsIgnoreCase (strCurrency) || - "USD".equalsIgnoreCase (strCurrency) ? 0.40 : 0.25, "QuotedSpread".equals - (strMeasure)); - } - - /** - * Construct a Govvie Curve from the Treasury Instruments - * - * @param strCode Treasury Code - * @param dtSpot Spot Date - * @param adtEffective Array of Effective Dates - * @param adtMaturity Array of Maturity Dates - * @param adblCoupon Array of Coupons - * @param adblQuote Array of Market Quotes - * @param strMeasure Calibration Measure - * @param scbc Segment Custom Builder Control Parameters - * - * @return The Govvie Curve Instance - */ - - public static final org.drip.state.govvie.GovvieCurve GovvieCurve ( - final java.lang.String strCode, - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.analytics.date.JulianDate[] adtEffective, - final org.drip.analytics.date.JulianDate[] adtMaturity, - final double[] adblCoupon, - final double[] adblQuote, - final java.lang.String strMeasure, - final org.drip.spline.params.SegmentCustomBuilderControl scbc) - { - org.drip.product.credit.BondComponent[] aTreasury = - org.drip.service.template.TreasuryBuilder.FromCode (strCode, adtEffective, adtMaturity, - adblCoupon); - - if (null == aTreasury) return null; - - int iNumTreasury = aTreasury.length; - int[] aiDate = new int[iNumTreasury]; - - if (0 == iNumTreasury || adblQuote.length != iNumTreasury) return null; - - for (int i = 0; i < iNumTreasury; ++i) - aiDate[i] = adtMaturity[i].julian(); - - java.lang.String strCurrency = aTreasury[0].currency(); - - java.lang.String strBenchmarkTreasuryCode = - org.drip.market.issue.TreasurySettingContainer.CurrencyBenchmarkCode (strCurrency); - - /* return null == strBenchmarkTreasuryCode || strBenchmarkTreasuryCode.isEmpty() ? null : - org.drip.state.creator.ScenarioGovvieCurveBuilder.CustomSplineCurve (strBenchmarkTreasuryCode, - dtSpot.addBusDays (0, strCurrency), strBenchmarkTreasuryCode, strCurrency, aiDate, adblQuote, - scbc); */ - - return null == strBenchmarkTreasuryCode || strBenchmarkTreasuryCode.isEmpty() ? null : - org.drip.state.creator.ScenarioGovvieCurveBuilder.CustomSplineCurve (strBenchmarkTreasuryCode, - dtSpot, strBenchmarkTreasuryCode, strCurrency, aiDate, adblQuote, scbc); - } - - /** - * Construct a Shape Preserving Govvie Curve from the Treasury Instruments - * - * @param strCode Treasury Code - * @param dtSpot Spot Date - * @param adtEffective Array of Effective Dates - * @param adtMaturity Array of Maturity Dates - * @param adblCoupon Array of Coupons - * @param adblQuote Array of Market Quotes - * @param strMeasure Calibration Measure - * - * @return The Govvie Curve Instance - */ - - public static final org.drip.state.govvie.GovvieCurve ShapePreservingGovvieCurve ( - final java.lang.String strCode, - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.analytics.date.JulianDate[] adtEffective, - final org.drip.analytics.date.JulianDate[] adtMaturity, - final double[] adblCoupon, - final double[] adblQuote, - final java.lang.String strMeasure) - { - try { - return GovvieCurve (strCode, dtSpot, adtEffective, adtMaturity, adblCoupon, adblQuote, - strMeasure, new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (2), - org.drip.spline.params.SegmentInelasticDesignControl.Create (0, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Smooth Govvie Curve from the Treasury Instruments - * - * @param strCode Treasury Code - * @param dtSpot Spot Date - * @param adtEffective Array of Effective Dates - * @param adtMaturity Array of Maturity Dates - * @param adblCoupon Array of Coupons - * @param adblQuote Array of Market Quotes - * @param strMeasure Calibration Measure - * - * @return The Govvie Curve Instance - */ - - public static final org.drip.state.govvie.GovvieCurve SmoothGovvieCurve ( - final java.lang.String strCode, - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.analytics.date.JulianDate[] adtEffective, - final org.drip.analytics.date.JulianDate[] adtMaturity, - final double[] adblCoupon, - final double[] adblQuote, - final java.lang.String strMeasure) - { - try { - return GovvieCurve (strCode, dtSpot, adtEffective, adtMaturity, adblCoupon, adblQuote, - strMeasure, new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (4), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Govvie Curve from the Treasury Instruments - * - * @param strCode Treasury Code - * @param dtSpot Spot Date - * @param adtEffective Array of Effective Dates - * @param adtMaturity Array of Maturity Dates - * @param adblCoupon Array of Coupons - * @param adblQuote Array of Market Quotes - * @param strMeasure Calibration Measure - * @param iLatentStateType SHAPE PRESERVING/SMOOTH - * - * @return The Govvie Curve Instance - */ - - public static final org.drip.state.govvie.GovvieCurve GovvieCurve ( - final java.lang.String strCode, - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.analytics.date.JulianDate[] adtEffective, - final org.drip.analytics.date.JulianDate[] adtMaturity, - final double[] adblCoupon, - final double[] adblQuote, - final java.lang.String strMeasure, - final int iLatentStateType) - { - if (SHAPE_PRESERVING == iLatentStateType) - return ShapePreservingGovvieCurve (strCode, dtSpot, adtEffective, adtMaturity, adblCoupon, - adblQuote, strMeasure); - - if (SMOOTH == iLatentStateType) - return SmoothGovvieCurve (strCode, dtSpot, adtEffective, adtMaturity, adblCoupon, adblQuote, - strMeasure); - - return null; - } - - /** - * Construct an FX Curve from the FX Forward Instruments - * - * @param dtSpot Spot Date - * @param cp The FX Currency Pair - * @param astrMaturityTenor Array of Maturity Tenors - * @param adblQuote Array of FX Forwards - * @param strMeasure Calibration Measure - * @param dblFXSpot FX Spot - * @param scbc Segment Custom Builder Builder Parameters - * - * @return The FX Curve Instance - */ - - public static final org.drip.state.fx.FXCurve FXCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.product.params.CurrencyPair cp, - final java.lang.String[] astrMaturityTenor, - final double[] adblQuote, - final java.lang.String strMeasure, - final double dblFXSpot, - final org.drip.spline.params.SegmentCustomBuilderControl scbc) - { - if (null == dtSpot || null == cp) return null; - - org.drip.analytics.date.JulianDate dtEffective = dtSpot.addBusDays (0, cp.denomCcy()); - - org.drip.product.fx.FXForwardComponent[] aFXFC = - org.drip.service.template.OTCInstrumentBuilder.FXForward (dtEffective, cp, astrMaturityTenor); - - if (null == aFXFC) return null; - - int iNumFXFC = aFXFC.length; - - if (0 == iNumFXFC || adblQuote.length != iNumFXFC) return null; - - return org.drip.state.creator.ScenarioFXCurveBuilder.ShapePreservingFXCurve ( cp.code(), cp, - org.drip.param.valuation.ValuationParams.Spot (dtEffective.julian()), null, null, null, aFXFC, - strMeasure, adblQuote, dblFXSpot, scbc); - } - - /** - * Construct a Shape Preserving FX Curve from the FX Forward Instruments - * - * @param dtSpot Spot Date - * @param cp The FX Currency Pair - * @param astrMaturityTenor Array of Maturity Tenors - * @param adblQuote Array of FX Forwards - * @param strMeasure Calibration Measure - * @param dblFXSpot FX Spot - * - * @return The FX Curve Instance - */ - - public static final org.drip.state.fx.FXCurve ShapePreservingFXCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.product.params.CurrencyPair cp, - final java.lang.String[] astrMaturityTenor, - final double[] adblQuote, - final java.lang.String strMeasure, - final double dblFXSpot) - { - try { - return FXCurve (dtSpot, cp, astrMaturityTenor, adblQuote, strMeasure, dblFXSpot, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (2), - org.drip.spline.params.SegmentInelasticDesignControl.Create (0, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Smooth FX Curve from the FX Forward Instruments - * - * @param dtSpot Spot Date - * @param cp The FX Currency Pair - * @param astrMaturityTenor Array of Maturity Tenors - * @param adblQuote Array of FX Forwards - * @param strMeasure Calibration Measure - * @param dblFXSpot FX Spot - * - * @return The FX Curve Instance - */ - - public static final org.drip.state.fx.FXCurve SmoothFXCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.product.params.CurrencyPair cp, - final java.lang.String[] astrMaturityTenor, - final double[] adblQuote, - final java.lang.String strMeasure, - final double dblFXSpot) - { - try { - return FXCurve (dtSpot, cp, astrMaturityTenor, adblQuote, strMeasure, dblFXSpot, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (4), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an FX Curve from the FX Forward Instruments - * - * @param dtSpot Spot Date - * @param cp The FX Currency Pair - * @param astrMaturityTenor Array of Maturity Tenors - * @param adblQuote Array of FX Forwards - * @param strMeasure Calibration Measure - * @param dblFXSpot FX Spot - * @param iLatentStateType SHAPE PRESERVING/SMOOTH - * - * @return The FX Curve Instance - */ - - public static final org.drip.state.fx.FXCurve FXCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.product.params.CurrencyPair cp, - final java.lang.String[] astrMaturityTenor, - final double[] adblQuote, - final java.lang.String strMeasure, - final double dblFXSpot, - final int iLatentStateType) - { - if (SHAPE_PRESERVING == iLatentStateType) - return ShapePreservingFXCurve (dtSpot, cp, astrMaturityTenor, adblQuote, strMeasure, dblFXSpot); - - if (SMOOTH == iLatentStateType) - return SmoothFXCurve (dtSpot, cp, astrMaturityTenor, adblQuote, strMeasure, dblFXSpot); - - return null; - } - - /** - * Forward Rate Volatility Latent State Construction from Cap/Floor Instruments - * - * @param dtSpot Spot Date - * @param forwardLabel Forward Label - * @param bIsCap TRUE - Create and Use Array of Caps - * @param astrMaturityTenor Array of Cap/floor Maturities - * @param adblStrike Array of Cap/Floor Strikes - * @param adblQuote Array of Cap/Floor Quotes - * @param strMeasure Calibration Measure - * @param dc Discount Curve Instance - * @param fc Forward Curve Instance - * - * @return Instance of the Forward Rate Volatility Curve - */ - - public static final org.drip.state.volatility.VolatilityCurve ForwardRateVolatilityCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final boolean bIsCap, - final java.lang.String[] astrMaturityTenor, - final double[] adblStrike, - final double[] adblQuote, - final java.lang.String strMeasure, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.state.forward.ForwardCurve fc) - { - if (null == dtSpot || null == astrMaturityTenor || null == dc) return null; - - org.drip.analytics.date.JulianDate dtEffective = dtSpot.addBusDays (0, dc.currency()); - - int iNumComp = astrMaturityTenor.length; - java.lang.String[] astrCalibMeasure = new java.lang.String[iNumComp]; - - if (0 == iNumComp) return null; - - for (int i = 0; i < iNumComp; ++i) - astrCalibMeasure[i] = strMeasure; - - return org.drip.state.creator.ScenarioLocalVolatilityBuilder.NonlinearBuild - (forwardLabel.fullyQualifiedName() + "::VOL", dtEffective, forwardLabel, - org.drip.service.template.OTCInstrumentBuilder.CapFloor (dtEffective, forwardLabel, - astrMaturityTenor, adblStrike, bIsCap), adblQuote, astrCalibMeasure, dc, fc, null); - } - - /** - * Construct a Map of Tenor Bumped Funding Curve Based off of the Input Exchange/OTC Market Instruments - * - * @param dtSpot The Spot Date - * @param strCurrency Currency - * @param astrDepositMaturityTenor Array of Deposit Maturity Tenors - * @param adblDepositQuote Array of Deposit Quotes - * @param strDepositMeasure Deposit Calibration Measure - * @param adblFuturesQuote Array of Futures Quotes - * @param strFuturesMeasure Futures Calibration Measure - * @param astrFixFloatMaturityTenor Array of Fix Float Swap Maturity Tenors - * @param adblFixFloatQuote Array of Fix Float Swap Quotes - * @param strFixFloatMeasure Fix Float Calibration Measure - * @param iLatentStateType SHAPE_PRESERVING/SMOOTH - * @param dblBump The Tenor Node Bump Amount - * @param bIsProportional TRUE - The Bump Applied is Proportional - * - * @return The Tenor Bumped Funding Curve Map - */ - - public static final - org.drip.analytics.support.CaseInsensitiveTreeMap - BumpedFundingCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strCurrency, - final java.lang.String[] astrDepositMaturityTenor, - final double[] adblDepositQuote, - final java.lang.String strDepositMeasure, - final double[] adblFuturesQuote, - final java.lang.String strFuturesMeasure, - final java.lang.String[] astrFixFloatMaturityTenor, - final double[] adblFixFloatQuote, - final java.lang.String strFixFloatMeasure, - final int iLatentStateType, - final double dblBump, - final boolean bIsProportional) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBump)) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapBumpedCurve = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - try { - org.drip.param.definition.ManifestMeasureTweak mmtFLAT = new - org.drip.param.definition.ManifestMeasureTweak - (org.drip.param.definition.ManifestMeasureTweak.FLAT, bIsProportional, dblBump); - - if (null != adblDepositQuote) { - int iNumDeposit = adblDepositQuote.length; - - for (int i = 0; i < iNumDeposit; ++i) { - org.drip.state.discount.MergedDiscountForwardCurve dcDepositQuoteBumped = FundingCurve - (dtSpot, strCurrency, astrDepositMaturityTenor, - org.drip.analytics.support.Helper.TweakManifestMeasure (adblDepositQuote, new - org.drip.param.definition.ManifestMeasureTweak (i, bIsProportional, - dblBump)), strDepositMeasure, adblFuturesQuote, strFuturesMeasure, - astrFixFloatMaturityTenor, adblFixFloatQuote, strFixFloatMeasure, - iLatentStateType); - - if (null != dcDepositQuoteBumped) - mapBumpedCurve.put ("DEPOSIT::" + astrDepositMaturityTenor[i], - dcDepositQuoteBumped); - } - } - - double[] adblDepositParallelBump = org.drip.analytics.support.Helper.TweakManifestMeasure - (adblDepositQuote, mmtFLAT); - - org.drip.state.discount.MergedDiscountForwardCurve dcDepositQuoteBumped = FundingCurve (dtSpot, - strCurrency, astrDepositMaturityTenor, adblDepositParallelBump, strDepositMeasure, - adblFuturesQuote, strFuturesMeasure, astrFixFloatMaturityTenor, adblFixFloatQuote, - strFixFloatMeasure, iLatentStateType); - - if (null != dcDepositQuoteBumped) mapBumpedCurve.put ("DEPOSIT::PLL", dcDepositQuoteBumped); - - if (null != adblFuturesQuote) { - int iNumFutures = adblFuturesQuote.length; - - for (int i = 0; i < iNumFutures; ++i) { - org.drip.state.discount.MergedDiscountForwardCurve dcFuturesQuoteBumped = FundingCurve - (dtSpot, strCurrency, astrDepositMaturityTenor, adblDepositQuote, strDepositMeasure, - org.drip.analytics.support.Helper.TweakManifestMeasure (adblFuturesQuote, new - org.drip.param.definition.ManifestMeasureTweak (i, bIsProportional, dblBump)), - strFuturesMeasure, astrFixFloatMaturityTenor, adblFixFloatQuote, - strFixFloatMeasure, iLatentStateType); - - if (null != dcFuturesQuoteBumped) mapBumpedCurve.put ("FUTURES::" + i, dcFuturesQuoteBumped); - } - } - - double[] adblFuturesParallelBump = org.drip.analytics.support.Helper.TweakManifestMeasure - (adblFuturesQuote, mmtFLAT); - - org.drip.state.discount.MergedDiscountForwardCurve dcFuturesQuoteBumped = FundingCurve (dtSpot, - strCurrency, astrDepositMaturityTenor, adblDepositQuote, strDepositMeasure, - adblFuturesParallelBump, strFuturesMeasure, astrFixFloatMaturityTenor, adblFixFloatQuote, - strFixFloatMeasure, iLatentStateType); - - if (null != dcFuturesQuoteBumped) mapBumpedCurve.put ("FUTURES::P", dcFuturesQuoteBumped); - - if (null != adblFixFloatQuote) { - int iNumFixFloat = adblFixFloatQuote.length; - - for (int i = 0; i < iNumFixFloat; ++i) { - org.drip.state.discount.MergedDiscountForwardCurve dcFixFloatQuoteBumped = FundingCurve - (dtSpot, strCurrency, astrDepositMaturityTenor, adblDepositQuote, strDepositMeasure, - adblFuturesQuote, strFuturesMeasure, astrFixFloatMaturityTenor, - org.drip.analytics.support.Helper.TweakManifestMeasure (adblFixFloatQuote, - new org.drip.param.definition.ManifestMeasureTweak (i, bIsProportional, - dblBump)), strFixFloatMeasure, iLatentStateType); - - if (null != dcFixFloatQuoteBumped) - mapBumpedCurve.put ("FIXFLOAT::" + astrFixFloatMaturityTenor[i], - dcFixFloatQuoteBumped); - } - - double[] adblFixFloatParallelBump = org.drip.analytics.support.Helper.TweakManifestMeasure - (adblFixFloatQuote, mmtFLAT); - - org.drip.state.discount.MergedDiscountForwardCurve dcFixFloatQuoteBumped = FundingCurve - (dtSpot, strCurrency, astrDepositMaturityTenor, adblDepositQuote, strDepositMeasure, - adblFuturesQuote, strFuturesMeasure, astrFixFloatMaturityTenor, - adblFixFloatParallelBump, strFixFloatMeasure, iLatentStateType); - - if (null != dcFixFloatQuoteBumped) - mapBumpedCurve.put ("FIXFLOAT::PLL", dcFixFloatQuoteBumped); - - org.drip.state.discount.MergedDiscountForwardCurve dcFundingBase = FundingCurve (dtSpot, - strCurrency, astrDepositMaturityTenor, adblDepositQuote, strDepositMeasure, - adblFuturesQuote, strFuturesMeasure, astrFixFloatMaturityTenor, adblFixFloatQuote, - strFixFloatMeasure, iLatentStateType); - - if (null != dcFundingBase) mapBumpedCurve.put ("BASE", dcFundingBase); - - org.drip.state.discount.MergedDiscountForwardCurve dcFundingBumped = FundingCurve (dtSpot, - strCurrency, astrDepositMaturityTenor, adblDepositParallelBump, strDepositMeasure, - adblFuturesParallelBump, strFuturesMeasure, astrFixFloatMaturityTenor, - adblFixFloatParallelBump, strFixFloatMeasure, iLatentStateType); - - if (null != dcFundingBumped) mapBumpedCurve.put ("BUMP", dcFundingBumped); - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return mapBumpedCurve; - } - - /** - * Construct a Map of Tenor Bumped Forward Curve Based off of the Input Exchange/OTC Market Instruments - * - * @param dtSpot Spot Date - * @param forwardLabel Forward Label - * @param astrDepositMaturityTenor Array of Deposit Maturity Tenors - * @param adblDepositQuote Array of the Deposit Instrument Quotes - * @param strDepositMeasure The Deposit Instrument Calibration Measure - * @param astrFRAMaturityTenor Array of FRA Maturity Tenors - * @param adblFRAQuote Array of the FRA Instrument Quotes - * @param strFRAMeasure The FRA Instrument Calibration Measure - * @param astrFixFloatMaturityTenor Array of Fix-Float Maturity Tenors - * @param adblFixFloatQuote Array of the Fix-Float Quotes - * @param strFixFloatMeasure The Fix-Float Calibration Measure - * @param astrFloatFloatMaturityTenor Array of Float-Float Maturity Tenors - * @param adblFloatFloatQuote Array of the Float-Float Quotes - * @param strFloatFloatMeasure The Float-Float Calibration Measure - * @param astrSyntheticFloatFloatMaturityTenor Array of Synthetic Float-Float Maturity Tenors - * @param adblSyntheticFloatFloatQuote Array of the Synthetic Float-Float Quotes - * @param strSyntheticFloatFloatMeasure The Synthetic Float-Float Calibration Measure - * @param dc The Base Discount Curve - * @param fcReference The Reference Forward Curve - * @param iLatentStateType SHAPE_PRESERVING/SMOOTH - * @param dblBump The Tenor Node Bump Amount - * @param bIsProportional TRUE - The Bump Applied is Proportional - * - * @return The Tenor Bumped Forward Curve Map - */ - - public static final - org.drip.analytics.support.CaseInsensitiveTreeMap - BumpedForwardCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final java.lang.String[] astrDepositMaturityTenor, - final double[] adblDepositQuote, - final java.lang.String strDepositMeasure, - final java.lang.String[] astrFRAMaturityTenor, - final double[] adblFRAQuote, - final java.lang.String strFRAMeasure, - final java.lang.String[] astrFixFloatMaturityTenor, - final double[] adblFixFloatQuote, - final java.lang.String strFixFloatMeasure, - final java.lang.String[] astrFloatFloatMaturityTenor, - final double[] adblFloatFloatQuote, - final java.lang.String strFloatFloatMeasure, - final java.lang.String[] astrSyntheticFloatFloatMaturityTenor, - final double[] adblSyntheticFloatFloatQuote, - final java.lang.String strSyntheticFloatFloatMeasure, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.state.forward.ForwardCurve fcReference, - final int iLatentStateType, - final double dblBump, - final boolean bIsProportional) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBump)) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapBumpedCurve = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - try { - org.drip.param.definition.ManifestMeasureTweak mmtFLAT = new - org.drip.param.definition.ManifestMeasureTweak - (org.drip.param.definition.ManifestMeasureTweak.FLAT, bIsProportional, dblBump); - - if (null != adblDepositQuote) { - int iNumDeposit = adblDepositQuote.length; - - for (int i = 0; i < iNumDeposit; ++i) { - org.drip.state.forward.ForwardCurve fcDepositQuoteBumped = ForwardCurve (dtSpot, - forwardLabel, astrDepositMaturityTenor, - org.drip.analytics.support.Helper.TweakManifestMeasure (adblDepositQuote, new - org.drip.param.definition.ManifestMeasureTweak (i, bIsProportional, - dblBump)), strDepositMeasure, astrFRAMaturityTenor, adblFRAQuote, - strFRAMeasure, astrFixFloatMaturityTenor, adblFixFloatQuote, - strFixFloatMeasure, astrFloatFloatMaturityTenor, - adblFloatFloatQuote, strFloatFloatMeasure, - astrSyntheticFloatFloatMaturityTenor, - adblSyntheticFloatFloatQuote, - strSyntheticFloatFloatMeasure, dc, fcReference, - iLatentStateType); - - if (null != fcDepositQuoteBumped) - mapBumpedCurve.put ("DEPOSIT::" + astrDepositMaturityTenor[i], - fcDepositQuoteBumped); - } - } - - double[] adblDepositParallelBump = org.drip.analytics.support.Helper.TweakManifestMeasure - (adblDepositQuote, mmtFLAT); - - org.drip.state.forward.ForwardCurve fcDepositQuoteBumped = ForwardCurve (dtSpot, forwardLabel, - astrDepositMaturityTenor, adblDepositParallelBump, strDepositMeasure, astrFRAMaturityTenor, - adblFRAQuote, strFRAMeasure, astrFixFloatMaturityTenor, adblFixFloatQuote, - strFixFloatMeasure, astrFloatFloatMaturityTenor, adblFloatFloatQuote, - strFloatFloatMeasure, astrSyntheticFloatFloatMaturityTenor, - adblSyntheticFloatFloatQuote, strSyntheticFloatFloatMeasure, dc, - fcReference, iLatentStateType); - - if (null != fcDepositQuoteBumped) mapBumpedCurve.put ("DEPOSIT::PLL", fcDepositQuoteBumped); - - if (null != adblFRAQuote) { - int iNumFRA = adblFRAQuote.length; - - for (int i = 0; i < iNumFRA; ++i) { - org.drip.state.forward.ForwardCurve fcFRAQuoteBumped = ForwardCurve (dtSpot, - forwardLabel, astrDepositMaturityTenor, adblDepositQuote, strDepositMeasure, - astrFRAMaturityTenor, org.drip.analytics.support.Helper.TweakManifestMeasure - (adblFRAQuote, new org.drip.param.definition.ManifestMeasureTweak (i, - bIsProportional, dblBump)), strFRAMeasure, astrFixFloatMaturityTenor, - adblFixFloatQuote, strFixFloatMeasure, astrFloatFloatMaturityTenor, - adblFloatFloatQuote, strFloatFloatMeasure, - astrSyntheticFloatFloatMaturityTenor, - adblSyntheticFloatFloatQuote, - strSyntheticFloatFloatMeasure, dc, fcReference, - iLatentStateType); - - if (null != fcFRAQuoteBumped) - mapBumpedCurve.put ("FRA::" + astrFRAMaturityTenor[i], fcFRAQuoteBumped); - } - } - - double[] adblFRAParallelBump = org.drip.analytics.support.Helper.TweakManifestMeasure - (adblFRAQuote, mmtFLAT); - - org.drip.state.forward.ForwardCurve fcFRAQuoteBumped = ForwardCurve (dtSpot, forwardLabel, - astrDepositMaturityTenor, adblDepositQuote, strDepositMeasure, astrFRAMaturityTenor, - adblFRAParallelBump, strFRAMeasure, astrFixFloatMaturityTenor, adblFixFloatQuote, - strFixFloatMeasure, astrFloatFloatMaturityTenor, adblFloatFloatQuote, - strFloatFloatMeasure, astrSyntheticFloatFloatMaturityTenor, - adblSyntheticFloatFloatQuote, strSyntheticFloatFloatMeasure, dc, - fcReference, iLatentStateType); - - if (null != fcFRAQuoteBumped) mapBumpedCurve.put ("FRA::PLL", fcFRAQuoteBumped); - - if (null != adblFixFloatQuote) { - int iNumFixFloat = adblFixFloatQuote.length; - - for (int i = 0; i < iNumFixFloat; ++i) { - org.drip.state.forward.ForwardCurve fcFixFloatQuoteBumped = ForwardCurve (dtSpot, - forwardLabel, astrDepositMaturityTenor, adblDepositQuote, strDepositMeasure, - astrFRAMaturityTenor, adblFRAQuote, strFRAMeasure, astrFixFloatMaturityTenor, - org.drip.analytics.support.Helper.TweakManifestMeasure (adblFixFloatQuote, - new org.drip.param.definition.ManifestMeasureTweak (i, bIsProportional, - dblBump)), strFixFloatMeasure, astrFloatFloatMaturityTenor, - adblFloatFloatQuote, strFloatFloatMeasure, - astrSyntheticFloatFloatMaturityTenor, - adblSyntheticFloatFloatQuote, - strSyntheticFloatFloatMeasure, dc, fcReference, - iLatentStateType); - - if (null != fcFixFloatQuoteBumped) - mapBumpedCurve.put ("FIXFLOAT::" + astrFixFloatMaturityTenor[i], - fcFixFloatQuoteBumped); - } - } - - double[] adblFixFloatParallelBump = org.drip.analytics.support.Helper.TweakManifestMeasure - (adblFixFloatQuote, mmtFLAT); - - org.drip.state.forward.ForwardCurve fcFixFloatQuoteBumped = ForwardCurve (dtSpot, forwardLabel, - astrDepositMaturityTenor, adblDepositQuote, strDepositMeasure, astrFRAMaturityTenor, - adblFRAQuote, strFRAMeasure, astrFixFloatMaturityTenor, adblFixFloatParallelBump, - strFixFloatMeasure, astrFloatFloatMaturityTenor, adblFloatFloatQuote, - strFloatFloatMeasure, astrSyntheticFloatFloatMaturityTenor, - adblSyntheticFloatFloatQuote, strSyntheticFloatFloatMeasure, dc, - fcReference, iLatentStateType); - - if (null != fcFixFloatQuoteBumped) mapBumpedCurve.put ("FIXFLOAT::PLL", fcFixFloatQuoteBumped); - - if (null != adblFloatFloatQuote) { - int iNumFloatFloat = adblFloatFloatQuote.length; - - for (int i = 0; i < iNumFloatFloat; ++i) { - org.drip.state.forward.ForwardCurve fcFloatFloatQuoteBumped = ForwardCurve (dtSpot, - forwardLabel, astrDepositMaturityTenor, adblDepositQuote, strDepositMeasure, - astrFRAMaturityTenor, adblFRAQuote, strFRAMeasure, astrFixFloatMaturityTenor, - adblFRAQuote, strFixFloatMeasure, astrFloatFloatMaturityTenor, - org.drip.analytics.support.Helper.TweakManifestMeasure - (adblFloatFloatQuote, new - org.drip.param.definition.ManifestMeasureTweak (i, - bIsProportional, dblBump)), strFloatFloatMeasure, - astrSyntheticFloatFloatMaturityTenor, - adblSyntheticFloatFloatQuote, - strSyntheticFloatFloatMeasure, dc, fcReference, - iLatentStateType); - - if (null != fcFloatFloatQuoteBumped) - mapBumpedCurve.put ("FLOATFLOAT::" + astrFloatFloatMaturityTenor[i], - fcFloatFloatQuoteBumped); - } - } - - double[] adblFloatFloatParallelBump = org.drip.analytics.support.Helper.TweakManifestMeasure - (adblFloatFloatQuote, mmtFLAT); - - org.drip.state.forward.ForwardCurve fcFloatFloatQuoteBumped = ForwardCurve (dtSpot, forwardLabel, - astrDepositMaturityTenor, adblDepositQuote, strDepositMeasure, astrFRAMaturityTenor, - adblFRAQuote, strFRAMeasure, astrFixFloatMaturityTenor, adblFixFloatQuote, - strFixFloatMeasure, astrFloatFloatMaturityTenor, adblFloatFloatParallelBump, - strFloatFloatMeasure, astrSyntheticFloatFloatMaturityTenor, - adblSyntheticFloatFloatQuote, strSyntheticFloatFloatMeasure, dc, - fcReference, iLatentStateType); - - if (null != fcFloatFloatQuoteBumped) - mapBumpedCurve.put ("FLOATFLOAT::PLL", fcFloatFloatQuoteBumped); - - if (null != adblSyntheticFloatFloatQuote) { - int iNumSyntheticFloatFloat = adblSyntheticFloatFloatQuote.length; - - for (int i = 0; i < iNumSyntheticFloatFloat; ++i) { - org.drip.state.forward.ForwardCurve fcSyntheticFloatFloatQuoteBumped = ForwardCurve - (dtSpot, forwardLabel, astrDepositMaturityTenor, adblDepositQuote, strDepositMeasure, - astrFRAMaturityTenor, adblFRAQuote, strFRAMeasure, astrFixFloatMaturityTenor, - adblFixFloatQuote, strFixFloatMeasure, astrFloatFloatMaturityTenor, - adblFloatFloatQuote, strFloatFloatMeasure, - astrSyntheticFloatFloatMaturityTenor, - org.drip.analytics.support.Helper.TweakManifestMeasure - (adblSyntheticFloatFloatQuote, new - org.drip.param.definition.ManifestMeasureTweak (i, - bIsProportional, dblBump)), - strSyntheticFloatFloatMeasure, dc, fcReference, - iLatentStateType); - - if (null != fcSyntheticFloatFloatQuoteBumped) - mapBumpedCurve.put ("SYNTHETICFLOATFLOAT::" + - astrSyntheticFloatFloatMaturityTenor[i], fcSyntheticFloatFloatQuoteBumped); - } - } - - double[] adblSyntheticFloatFloatParallelBump = - org.drip.analytics.support.Helper.TweakManifestMeasure (adblSyntheticFloatFloatQuote, - mmtFLAT); - - org.drip.state.forward.ForwardCurve fcSyntheticFloatFloatQuoteBumped = ForwardCurve (dtSpot, - forwardLabel, astrDepositMaturityTenor, adblDepositQuote, strDepositMeasure, - astrFRAMaturityTenor, adblFRAQuote, strFRAMeasure, astrFixFloatMaturityTenor, - adblFixFloatQuote, strFixFloatMeasure, astrFloatFloatMaturityTenor, - adblFloatFloatQuote, strFloatFloatMeasure, astrSyntheticFloatFloatMaturityTenor, - adblSyntheticFloatFloatParallelBump, strSyntheticFloatFloatMeasure, dc, - fcReference, iLatentStateType); - - if (null != fcSyntheticFloatFloatQuoteBumped) - mapBumpedCurve.put ("SYNTHETICFLOATFLOAT::PLL", fcSyntheticFloatFloatQuoteBumped); - - org.drip.state.forward.ForwardCurve fcQuoteBase = ForwardCurve (dtSpot, forwardLabel, - astrDepositMaturityTenor, adblDepositQuote, strDepositMeasure, astrFRAMaturityTenor, - adblFRAQuote, strFRAMeasure, astrFixFloatMaturityTenor, adblFixFloatQuote, - strFixFloatMeasure, astrFloatFloatMaturityTenor, adblFloatFloatQuote, - strFloatFloatMeasure, astrSyntheticFloatFloatMaturityTenor, - adblSyntheticFloatFloatQuote, strSyntheticFloatFloatMeasure, dc, - fcReference, iLatentStateType); - - if (null != fcQuoteBase) mapBumpedCurve.put ("BASE", fcQuoteBase); - - org.drip.state.forward.ForwardCurve fcQuoteBump = ForwardCurve (dtSpot, forwardLabel, - astrDepositMaturityTenor, adblDepositParallelBump, strDepositMeasure, astrFRAMaturityTenor, - adblFRAParallelBump, strFRAMeasure, astrFixFloatMaturityTenor, adblFixFloatParallelBump, - strFixFloatMeasure, astrFloatFloatMaturityTenor, adblFloatFloatParallelBump, - strFloatFloatMeasure, astrSyntheticFloatFloatMaturityTenor, - adblSyntheticFloatFloatParallelBump, strSyntheticFloatFloatMeasure, dc, - fcReference, iLatentStateType); - - if (null != fcQuoteBump) mapBumpedCurve.put ("BUMP", fcQuoteBump); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return mapBumpedCurve; - } - - /** - * Construct a Map of Tenor + Parallel Bumped Overnight Curves - * - * @param dtSpot Spot Date - * @param strCurrency Currency - * @param astrDepositMaturityTenor Array of Deposit Maturity Tenors - * @param adblDepositQuote Array of Deposit Quotes - * @param strDepositMeasure Deposit Measure - * @param astrShortEndOISMaturityTenor Array of Short End OIS Maturity Tenors - * @param adblShortEndOISQuote Array of Short End OIS Quotes - * @param strShortEndOISMeasure Short End OIS Measure - * @param astrOISFuturesEffectiveTenor Array of OIS Futures Effective Tenors - * @param astrOISFuturesMaturityTenor Array of OIS Futures Maturity Tenors - * @param adblOISFuturesQuote Array of OIS Futures Quotes - * @param strOISFuturesMeasure OIS Futures Measure - * @param astrLongEndOISMaturityTenor Array of Long End OIS Maturity Tenors - * @param adblLongEndOISQuote Array of Long End OIS Quotes - * @param strLongEndOISMeasure Long End OIS Measure - * @param iLatentStateType SHAPE PRESERVING/SMOOTH - * @param dblBump The Tenor Node Bump Amount - * @param bIsProportional TRUE - The Bump Applied is Proportional - * - * @return Map of Overnight Curves - */ - - public static final - org.drip.analytics.support.CaseInsensitiveTreeMap - BumpedOvernightCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final String strCurrency, - final java.lang.String[] astrDepositMaturityTenor, - final double[] adblDepositQuote, - final java.lang.String strDepositMeasure, - final java.lang.String[] astrShortEndOISMaturityTenor, - final double[] adblShortEndOISQuote, - final java.lang.String strShortEndOISMeasure, - final java.lang.String[] astrOISFuturesEffectiveTenor, - final java.lang.String[] astrOISFuturesMaturityTenor, - final double[] adblOISFuturesQuote, - final java.lang.String strOISFuturesMeasure, - final java.lang.String[] astrLongEndOISMaturityTenor, - final double[] adblLongEndOISQuote, - final java.lang.String strLongEndOISMeasure, - final int iLatentStateType, - final double dblBump, - final boolean bIsProportional) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBump)) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapBumpedCurve = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - try { - org.drip.param.definition.ManifestMeasureTweak mmtFLAT = new - org.drip.param.definition.ManifestMeasureTweak - (org.drip.param.definition.ManifestMeasureTweak.FLAT, bIsProportional, dblBump); - - if (null != adblDepositQuote) { - int iNumDeposit = adblDepositQuote.length; - - for (int i = 0; i < iNumDeposit; ++i) { - org.drip.state.discount.MergedDiscountForwardCurve dcOvernightDepositBumped = - OvernightCurve (dtSpot, strCurrency, astrDepositMaturityTenor, - org.drip.analytics.support.Helper.TweakManifestMeasure (adblDepositQuote, new - org.drip.param.definition.ManifestMeasureTweak (i, bIsProportional, - dblBump)), strDepositMeasure, astrShortEndOISMaturityTenor, - adblShortEndOISQuote, strShortEndOISMeasure, - astrOISFuturesEffectiveTenor, astrOISFuturesMaturityTenor, - adblOISFuturesQuote, strOISFuturesMeasure, - astrLongEndOISMaturityTenor, adblLongEndOISQuote, - strLongEndOISMeasure, iLatentStateType); - - if (null != dcOvernightDepositBumped) - mapBumpedCurve.put ("DEPOSIT::" + astrDepositMaturityTenor[i], - dcOvernightDepositBumped); - } - } - - double[] adblDepositParallelBump = org.drip.analytics.support.Helper.TweakManifestMeasure - (adblDepositQuote, mmtFLAT); - - org.drip.state.discount.MergedDiscountForwardCurve dcOvernightDepositBumped = OvernightCurve - (dtSpot, strCurrency, astrDepositMaturityTenor, adblDepositParallelBump, strDepositMeasure, - astrShortEndOISMaturityTenor, adblShortEndOISQuote, strShortEndOISMeasure, - astrOISFuturesEffectiveTenor, astrOISFuturesMaturityTenor, adblOISFuturesQuote, - strOISFuturesMeasure, astrLongEndOISMaturityTenor, adblLongEndOISQuote, - strLongEndOISMeasure, iLatentStateType); - - if (null != dcOvernightDepositBumped) - mapBumpedCurve.put ("DEPOSIT::PLL", dcOvernightDepositBumped); - - if (null != adblShortEndOISQuote) { - int iNumShortEndOIS = adblShortEndOISQuote.length; - - for (int i = 0; i < iNumShortEndOIS; ++i) { - org.drip.state.discount.MergedDiscountForwardCurve dcOvernightShortEndOISBumped = - OvernightCurve (dtSpot, strCurrency, astrDepositMaturityTenor, adblDepositQuote, - strDepositMeasure, astrShortEndOISMaturityTenor, - org.drip.analytics.support.Helper.TweakManifestMeasure (adblShortEndOISQuote, - new org.drip.param.definition.ManifestMeasureTweak (i, bIsProportional, - dblBump)), strShortEndOISMeasure, astrOISFuturesEffectiveTenor, - astrOISFuturesMaturityTenor, adblOISFuturesQuote, - strOISFuturesMeasure, astrLongEndOISMaturityTenor, - adblLongEndOISQuote, strLongEndOISMeasure, - iLatentStateType); - - if (null != dcOvernightShortEndOISBumped) - mapBumpedCurve.put ("SHORTENDOIS::" + astrShortEndOISMaturityTenor[i], - dcOvernightShortEndOISBumped); - } - } - - double[] adblShortEndOISParallelBump = org.drip.analytics.support.Helper.TweakManifestMeasure - (adblShortEndOISQuote, mmtFLAT); - - org.drip.state.discount.MergedDiscountForwardCurve dcOvernightShortEndOISBumped = OvernightCurve - (dtSpot, strCurrency, astrDepositMaturityTenor, adblDepositQuote, strDepositMeasure, - astrShortEndOISMaturityTenor, adblShortEndOISParallelBump, strShortEndOISMeasure, - astrOISFuturesEffectiveTenor, astrOISFuturesMaturityTenor, - adblOISFuturesQuote, strOISFuturesMeasure, astrLongEndOISMaturityTenor, - adblLongEndOISQuote, strLongEndOISMeasure, iLatentStateType); - - if (null != dcOvernightShortEndOISBumped) - mapBumpedCurve.put ("SHORTENDOIS::PLL", dcOvernightShortEndOISBumped); - - if (null != adblOISFuturesQuote) { - int iNumOISFutures = adblOISFuturesQuote.length; - - for (int i = 0; i < iNumOISFutures; ++i) { - org.drip.state.discount.MergedDiscountForwardCurve dcOvernightOISFuturesBumped = - OvernightCurve (dtSpot, strCurrency, astrDepositMaturityTenor, adblDepositQuote, - strDepositMeasure, astrShortEndOISMaturityTenor, adblShortEndOISQuote, - strShortEndOISMeasure, astrOISFuturesEffectiveTenor, - astrOISFuturesMaturityTenor, - org.drip.analytics.support.Helper.TweakManifestMeasure - (adblOISFuturesQuote, new - org.drip.param.definition.ManifestMeasureTweak (i, - bIsProportional, dblBump)), strOISFuturesMeasure, - astrLongEndOISMaturityTenor, adblLongEndOISQuote, - strLongEndOISMeasure, iLatentStateType); - - if (null != dcOvernightOISFuturesBumped) - mapBumpedCurve.put ("OISFUTURES::" + astrOISFuturesEffectiveTenor[i] + " x " + - astrOISFuturesMaturityTenor[i], dcOvernightOISFuturesBumped); - } - } - - double[] adblOISFuturesParallelBump = org.drip.analytics.support.Helper.TweakManifestMeasure - (adblOISFuturesQuote, mmtFLAT); - - org.drip.state.discount.MergedDiscountForwardCurve dcOvernightOISFuturesBumped = OvernightCurve - (dtSpot, strCurrency, astrDepositMaturityTenor, adblDepositQuote, strDepositMeasure, - astrShortEndOISMaturityTenor, adblShortEndOISQuote, strShortEndOISMeasure, - astrOISFuturesEffectiveTenor, astrOISFuturesMaturityTenor, - adblOISFuturesParallelBump, strOISFuturesMeasure, astrLongEndOISMaturityTenor, - adblLongEndOISQuote, strLongEndOISMeasure, iLatentStateType); - - if (null != dcOvernightOISFuturesBumped) - mapBumpedCurve.put ("OISFUTURES::PARALLEL", dcOvernightOISFuturesBumped); - - if (null != adblLongEndOISQuote) { - int iNumLongEndOIS = adblLongEndOISQuote.length; - - for (int i = 0; i < iNumLongEndOIS; ++i) { - org.drip.state.discount.MergedDiscountForwardCurve dcOvernightLongEndOISBumped = - OvernightCurve (dtSpot, strCurrency, astrDepositMaturityTenor, adblDepositQuote, - strDepositMeasure, astrShortEndOISMaturityTenor, adblShortEndOISQuote, - strShortEndOISMeasure, astrOISFuturesEffectiveTenor, - astrOISFuturesMaturityTenor, adblOISFuturesQuote, strOISFuturesMeasure, - astrLongEndOISMaturityTenor, - org.drip.analytics.support.Helper.TweakManifestMeasure - (adblLongEndOISQuote, new - org.drip.param.definition.ManifestMeasureTweak (i, - bIsProportional, dblBump)), strLongEndOISMeasure, - iLatentStateType); - - if (null != dcOvernightLongEndOISBumped) - mapBumpedCurve.put ("LONGENDOIS::" + astrLongEndOISMaturityTenor[i], - dcOvernightLongEndOISBumped); - } - } - - double[] adblLongEndOISParallelBump = org.drip.analytics.support.Helper.TweakManifestMeasure - (adblLongEndOISQuote, mmtFLAT); - - org.drip.state.discount.MergedDiscountForwardCurve dcOvernightLongEndOISBumped = OvernightCurve - (dtSpot, strCurrency, astrDepositMaturityTenor, adblDepositQuote, strDepositMeasure, - astrShortEndOISMaturityTenor, adblShortEndOISQuote, strShortEndOISMeasure, - astrOISFuturesEffectiveTenor, astrOISFuturesMaturityTenor, adblOISFuturesQuote, - strOISFuturesMeasure, astrLongEndOISMaturityTenor, adblLongEndOISParallelBump, - strLongEndOISMeasure, iLatentStateType); - - if (null != dcOvernightLongEndOISBumped) - mapBumpedCurve.put ("LONGENDOIS::PLL", dcOvernightLongEndOISBumped); - - org.drip.state.discount.MergedDiscountForwardCurve dcOvernightBase = OvernightCurve (dtSpot, - strCurrency, astrDepositMaturityTenor, adblDepositQuote, strDepositMeasure, - astrShortEndOISMaturityTenor, adblShortEndOISQuote, strShortEndOISMeasure, - astrOISFuturesEffectiveTenor, astrOISFuturesMaturityTenor, adblOISFuturesQuote, - strOISFuturesMeasure, astrLongEndOISMaturityTenor, adblLongEndOISQuote, - strLongEndOISMeasure, iLatentStateType); - - if (null != dcOvernightBase) mapBumpedCurve.put ("BASE", dcOvernightBase); - - org.drip.state.discount.MergedDiscountForwardCurve dcOvernightBump = OvernightCurve (dtSpot, - strCurrency, astrDepositMaturityTenor, adblDepositParallelBump, strDepositMeasure, - astrShortEndOISMaturityTenor, adblShortEndOISParallelBump, strShortEndOISMeasure, - astrOISFuturesEffectiveTenor, astrOISFuturesMaturityTenor, - adblOISFuturesParallelBump, strOISFuturesMeasure, astrLongEndOISMaturityTenor, - adblLongEndOISParallelBump, strLongEndOISMeasure, iLatentStateType); - - if (null != dcOvernightBump) mapBumpedCurve.put ("BUMP", dcOvernightBump); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return mapBumpedCurve; - } - - /** - * Construct a Tenor + Parallel Map of Bumped Credit Curves from Overnight Exchange/OTC Market Instruments - * - * @param dtSpot Spot Date - * @param strCredit Credit Curve - * @param astrMaturityTenor Maturity Tenor - * @param adblCoupon Coupon Array - * @param adblQuote Array of Market Quotes - * @param strMeasure Calibration Measure - * @param dc Discount Curve - * @param dblBump The Tenor Node Bump Amount - * @param bIsProportional TRUE - The Bump Applied is Proportional - * - * @return Map of Bumped Credit Curves - */ - - public static final org.drip.analytics.support.CaseInsensitiveTreeMap - BumpedCreditCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strCredit, - final java.lang.String[] astrMaturityTenor, - final double[] adblCoupon, - final double[] adblQuote, - final java.lang.String strMeasure, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final double dblBump, - final boolean bIsProportional) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBump)) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapBumpedCurve = - new org.drip.analytics.support.CaseInsensitiveTreeMap(); - - if (null != adblQuote) { - int iNumComp = adblQuote.length; - - for (int i = 0; i < iNumComp; ++i) { - try { - org.drip.state.credit.CreditCurve ccBumped = CreditCurve (dtSpot, strCredit, - astrMaturityTenor, adblCoupon, org.drip.analytics.support.Helper.TweakManifestMeasure - (adblQuote, new org.drip.param.definition.ManifestMeasureTweak (i, - bIsProportional, dblBump)), strMeasure, dc); - - if (null != ccBumped) mapBumpedCurve.put ("CDS::" + astrMaturityTenor[i], ccBumped); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - } - } - - try { - org.drip.state.credit.CreditCurve ccBase = CreditCurve (dtSpot, strCredit, astrMaturityTenor, - adblCoupon, adblQuote, strMeasure, dc); - - if (null != ccBase) mapBumpedCurve.put ("BASE", ccBase); - - org.drip.state.credit.CreditCurve ccBumped = CreditCurve (dtSpot, strCredit, astrMaturityTenor, - adblCoupon, org.drip.analytics.support.Helper.TweakManifestMeasure (adblQuote, new - org.drip.param.definition.ManifestMeasureTweak - (org.drip.param.definition.ManifestMeasureTweak.FLAT, bIsProportional, dblBump)), - strMeasure, dc); - - if (null != ccBumped) mapBumpedCurve.put ("BUMP", ccBumped); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return mapBumpedCurve; - } - - /** - * Construct a Tenor + Parallel Map of Govvie Curves from the Treasury Instruments - * - * @param strCode The Govvie Code - * @param dtSpot Spot Date - * @param adtEffective Array of Effective Dates - * @param adtMaturity Array of Maturity Dates - * @param adblCoupon Array of Coupons - * @param adblQuote Array of Market Quotes - * @param strMeasure Calibration Measure - * @param iLatentStateType SHAPE PRESERVING/SMOOTH - * @param dblBump The Tenor Node Bump Amount - * @param bIsProportional TRUE - The Bump Applied is Proportional - * - * @return Map of Govvie Curve Instance - */ - - public static final org.drip.analytics.support.CaseInsensitiveTreeMap - BumpedGovvieCurve ( - final java.lang.String strCode, - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.analytics.date.JulianDate[] adtEffective, - final org.drip.analytics.date.JulianDate[] adtMaturity, - final double[] adblCoupon, - final double[] adblQuote, - final java.lang.String strMeasure, - final int iLatentStateType, - final double dblBump, - final boolean bIsProportional) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBump)) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapBumpedCurve = - new org.drip.analytics.support.CaseInsensitiveTreeMap(); - - if (null != adblQuote) { - int iNumComp = adblQuote.length; - - for (int i = 0; i < iNumComp; ++i) { - try { - org.drip.state.govvie.GovvieCurve gcBumped = GovvieCurve (strCode, dtSpot, adtEffective, - adtMaturity, adblCoupon, org.drip.analytics.support.Helper.TweakManifestMeasure - (adblQuote, new org.drip.param.definition.ManifestMeasureTweak (i, - bIsProportional, dblBump)), strMeasure, iLatentStateType); - - if (null != gcBumped) mapBumpedCurve.put ("TSY::" + adtMaturity[i], gcBumped); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - } - } - - try { - org.drip.state.govvie.GovvieCurve gcBase = GovvieCurve (strCode, dtSpot, adtEffective, - adtMaturity, adblCoupon, adblQuote, strMeasure, iLatentStateType); - - if (null != gcBase) mapBumpedCurve.put ("BASE", gcBase); - - org.drip.state.govvie.GovvieCurve gcBumped = GovvieCurve (strCode, dtSpot, adtEffective, - adtMaturity, adblCoupon, org.drip.analytics.support.Helper.TweakManifestMeasure (adblQuote, - new org.drip.param.definition.ManifestMeasureTweak - (org.drip.param.definition.ManifestMeasureTweak.FLAT, bIsProportional, dblBump)), - strMeasure, iLatentStateType); - - if (null != gcBumped) mapBumpedCurve.put ("BUMP", gcBumped); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return mapBumpedCurve; - } - - /** - * Construct a Tenor + Parallel Map of FX Curve from the FX Instruments - * - * @param dtSpot Spot Date - * @param cp The FX Currency Pair - * @param astrMaturityTenor Array of Maturity Tenors - * @param adblQuote Array of FX Forwards - * @param strMeasure Calibration Measure - * @param dblFXSpot FX Spot - * @param iLatentStateType SHAPE PRESERVING/SMOOTH - * @param dblBump The Tenor Node Bump Amount - * @param bIsProportional TRUE - The Bump Applied is Proportional - * - * @return Map of FX Curve Instance - */ - - public static final org.drip.analytics.support.CaseInsensitiveTreeMap - BumpedFXCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.product.params.CurrencyPair cp, - final java.lang.String[] astrMaturityTenor, - final double[] adblQuote, - final java.lang.String strMeasure, - final double dblFXSpot, - final int iLatentStateType, - final double dblBump, - final boolean bIsProportional) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBump)) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap mapBumpedCurve = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - if (null != adblQuote) { - int iNumComp = adblQuote.length; - - for (int i = 0; i < iNumComp; ++i) { - try { - org.drip.state.fx.FXCurve fxCurveBumped = FXCurve (dtSpot, cp, astrMaturityTenor, - org.drip.analytics.support.Helper.TweakManifestMeasure (adblQuote, new - org.drip.param.definition.ManifestMeasureTweak (i, bIsProportional, dblBump)), - strMeasure, dblFXSpot, iLatentStateType); - - if (null != fxCurveBumped) - mapBumpedCurve.put ("FXFWD::" + astrMaturityTenor[i], fxCurveBumped); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - } - } - - try { - org.drip.state.fx.FXCurve fxCurveBase = FXCurve (dtSpot, cp, astrMaturityTenor, adblQuote, - strMeasure, dblFXSpot, iLatentStateType); - - if (null != fxCurveBase) mapBumpedCurve.put ("BASE", fxCurveBase); - - org.drip.state.fx.FXCurve fxCurveBump = FXCurve (dtSpot, cp, astrMaturityTenor, - org.drip.analytics.support.Helper.TweakManifestMeasure (adblQuote, new - org.drip.param.definition.ManifestMeasureTweak - (org.drip.param.definition.ManifestMeasureTweak.FLAT, bIsProportional, dblBump)), - strMeasure, dblFXSpot, iLatentStateType); - - if (null != fxCurveBump) mapBumpedCurve.put ("BUMP", fxCurveBump); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return mapBumpedCurve; - } - - /** - * Construct a Tenor + Parallel Forward Volatility Latent State Construction from Cap/Floor Instruments - * - * @param dtSpot Spot Date - * @param forwardLabel Forward Label - * @param bIsCap TRUE - Create and Use Array of Caps - * @param astrMaturityTenor Array of Cap/floor Maturities - * @param adblStrike Array of Cap/Floor Strikes - * @param adblQuote Array of Cap/Floor Quotes - * @param strMeasure Calibration Measure - * @param dc Discount Curve Instance - * @param fc Forward Curve Instance - * @param dblBump The Tenor Node Bump Amount - * @param bIsProportional TRUE - The Bump Applied is Proportional - * - * @return Map of Forward Volatility Curve Instance - */ - - public static final - org.drip.analytics.support.CaseInsensitiveTreeMap - BumpedForwardVolatilityCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final boolean bIsCap, - final java.lang.String[] astrMaturityTenor, - final double[] adblStrike, - final double[] adblQuote, - final java.lang.String strMeasure, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.state.forward.ForwardCurve fc, - final double dblBump, - final boolean bIsProportional) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBump)) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapBumpedCurve = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - if (null != adblQuote) { - int iNumComp = adblQuote.length; - - for (int i = 0; i < iNumComp; ++i) { - try { - org.drip.state.volatility.VolatilityCurve forwardVolatilityCurveBumped = - ForwardRateVolatilityCurve (dtSpot, forwardLabel, bIsCap, astrMaturityTenor, - adblStrike, org.drip.analytics.support.Helper.TweakManifestMeasure (adblQuote, - new org.drip.param.definition.ManifestMeasureTweak (i, bIsProportional, - dblBump)), strMeasure, dc, fc); - - if (null != forwardVolatilityCurveBumped) - mapBumpedCurve.put ("CAPFLOOR::" + astrMaturityTenor[i], - forwardVolatilityCurveBumped); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - } - } - - try { - org.drip.state.volatility.VolatilityCurve forwardVolatilityCurveBase = ForwardRateVolatilityCurve - (dtSpot, forwardLabel, bIsCap, astrMaturityTenor, adblStrike, adblQuote, strMeasure, dc, fc); - - if (null != forwardVolatilityCurveBase) mapBumpedCurve.put ("BASE", forwardVolatilityCurveBase); - - org.drip.state.volatility.VolatilityCurve forwardVolatilityCurveBumped = - ForwardRateVolatilityCurve (dtSpot, forwardLabel, bIsCap, astrMaturityTenor, adblStrike, - org.drip.analytics.support.Helper.TweakManifestMeasure (adblQuote, new - org.drip.param.definition.ManifestMeasureTweak - (org.drip.param.definition.ManifestMeasureTweak.FLAT, bIsProportional, dblBump)), - strMeasure, dc, fc); - - if (null != forwardVolatilityCurveBumped) - mapBumpedCurve.put ("BUMP", forwardVolatilityCurveBumped); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return mapBumpedCurve; - } -} diff --git a/org/drip/service/template/OTCInstrumentBuilder.java b/org/drip/service/template/OTCInstrumentBuilder.java deleted file mode 100644 index c879dae..0000000 --- a/org/drip/service/template/OTCInstrumentBuilder.java +++ /dev/null @@ -1,938 +0,0 @@ - -package org.drip.service.template; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * OTCInstrumentBuilder contains static Helper API to facilitate Construction of OTC Instruments. - * - * @author Lakshmi Krishnamurthy - */ - -public class OTCInstrumentBuilder { - - /** - * Construct an OTC Funding Deposit Instrument from the Spot Date and the Maturity Tenor - * - * @param dtSpot The Spot Date - * @param strCurrency Currency - * @param strMaturityTenor The Maturity Tenor - * - * @return Funding Deposit Instrument Instance from the Spot Date and the corresponding Maturity Tenor - */ - - public static final org.drip.product.rates.SingleStreamComponent FundingDeposit ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strCurrency, - final java.lang.String strMaturityTenor) - { - if (null == dtSpot || null == strCurrency || strCurrency.isEmpty() || null == strMaturityTenor || - strMaturityTenor.isEmpty()) - return null; - - org.drip.market.otc.FixedFloatSwapConvention ffsc = - org.drip.market.otc.IBORFixedFloatContainer.ConventionFromJurisdiction (strCurrency, "ALL", - strMaturityTenor, "MAIN"); - - if (null == ffsc) return null; - - org.drip.state.identifier.ForwardLabel forwardLabel = ffsc.floatStreamConvention().floaterIndex(); - - org.drip.analytics.date.JulianDate dtEffective = dtSpot.addBusDays (0, strCurrency); - - try { - java.lang.String strFloaterTenor = forwardLabel.tenor(); - - org.drip.analytics.date.JulianDate dtMaturity = strMaturityTenor.contains ("D") ? new - org.drip.analytics.date.JulianDate (org.drip.analytics.daycount.Convention.AddBusinessDays - (dtEffective.julian(), org.drip.analytics.support.Helper.TenorToDays (strMaturityTenor), - strCurrency)) : dtEffective.addTenorAndAdjust (strMaturityTenor, strCurrency); - - return new org.drip.product.rates.SingleStreamComponent ("DEPOSIT_" + strMaturityTenor, new - org.drip.product.rates.Stream - (org.drip.analytics.support.CompositePeriodBuilder.FloatingCompositeUnit - (org.drip.analytics.support.CompositePeriodBuilder.EdgePair (dtEffective, - dtMaturity), new org.drip.param.period.CompositePeriodSetting - (org.drip.analytics.support.Helper.TenorToFreq (strFloaterTenor), - strFloaterTenor, strCurrency, null, 1., null, null, null, null), new - org.drip.param.period.ComposableFloatingUnitSetting (strFloaterTenor, - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, org.drip.state.identifier.ForwardLabel.Create (strCurrency, strFloaterTenor), - org.drip.analytics.support.CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, 0.))), - null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an OTC Forward Deposit Instrument from Spot Date and the Maturity Tenor - * - * @param dtSpot The Spot Date - * @param strMaturityTenor The Maturity Tenor - * @param forwardLabel The Forward Label - * - * @return Forward Deposit Instrument Instance from the Spot Date and the corresponding Maturity Tenor - */ - - public static final org.drip.product.rates.SingleStreamComponent ForwardRateDeposit ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strMaturityTenor, - final org.drip.state.identifier.ForwardLabel forwardLabel) - { - if (null == dtSpot || null == forwardLabel) return null; - - java.lang.String strCalendar = forwardLabel.currency(); - - org.drip.analytics.date.JulianDate dtEffective = dtSpot.addBusDays (0, strCalendar); - - return org.drip.product.creator.SingleStreamComponentBuilder.Deposit (dtEffective, - dtEffective.addTenor (strMaturityTenor), forwardLabel); - } - - /** - * Construct an OTC Overnight Deposit Instrument from the Spot Date and the Maturity Tenor - * - * @param dtSpot The Spot Date - * @param strCurrency Currency - * @param strMaturityTenor The Maturity Tenor - * - * @return Overnight Deposit Instrument Instance from the Spot Date and the corresponding Maturity Tenor - */ - - public static final org.drip.product.rates.SingleStreamComponent OvernightDeposit ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strCurrency, - final java.lang.String strMaturityTenor) - { - if (null == dtSpot) return null; - - org.drip.state.identifier.OvernightLabel overnightLabel = - org.drip.state.identifier.OvernightLabel.Create (strCurrency); - - if (null == overnightLabel) return null; - - org.drip.analytics.date.JulianDate dtEffective = dtSpot.addBusDays (0, strCurrency); - - return null == dtEffective ? null : org.drip.product.creator.SingleStreamComponentBuilder.Deposit - (dtEffective, dtEffective.addTenorAndAdjust (strMaturityTenor, strCurrency),overnightLabel); - } - - /** - * Create a Standard FRA from the Spot Date, the Forward Label, and the Strike - * - * @param dtSpot Spot Date - * @param forwardLabel The Forward Label - * @param strMaturityTenor Maturity Tenor - * @param dblStrike Futures Strike - * - * @return The Standard FRA Instance - */ - - public static final org.drip.product.fra.FRAStandardComponent FRAStandard ( - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final java.lang.String strMaturityTenor, - final double dblStrike) - { - return null == dtSpot || null == forwardLabel ? null : - org.drip.product.creator.SingleStreamComponentBuilder.FRAStandard (dtSpot.addBusDays (0, - forwardLabel.currency()).addTenor (strMaturityTenor), forwardLabel, dblStrike); - } - - /** - * Construct an OTC Standard Fix Float Swap using the specified Input Parameters - * - * @param dtSpot The Spot Date - * @param strCurrency The OTC Currency - * @param strLocation Location - * @param strMaturityTenor Maturity Tenor - * @param strIndex Index - * @param dblCoupon Coupon - * - * @return The OTC Standard Fix Float Swap constructed using the specified Input Parameters - */ - - public static final org.drip.product.rates.FixFloatComponent FixFloatStandard ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strCurrency, - final java.lang.String strLocation, - final java.lang.String strMaturityTenor, - final java.lang.String strIndex, - final double dblCoupon) - { - if (null == dtSpot) return null; - - org.drip.market.otc.FixedFloatSwapConvention ffsc = - org.drip.market.otc.IBORFixedFloatContainer.ConventionFromJurisdiction (strCurrency, strLocation, - strMaturityTenor, strIndex); - - return null == ffsc ? null : ffsc.createFixFloatComponent (dtSpot.addBusDays (0, strCurrency), - strMaturityTenor, dblCoupon, 0., 1.); - } - - /** - * Construct a Standard Fix Float Swap Instances - * - * @param dtSpot The Spot Date - * @param forwardLabel The Forward Label - * @param strMaturityTenor Maturity Tenor - * - * @return A Standard Fix Float Swap Instances - */ - - public static final org.drip.product.rates.FixFloatComponent FixFloatCustom ( - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final java.lang.String strMaturityTenor) - { - if (null == dtSpot || null == forwardLabel) return null; - - java.lang.String strCurrency = forwardLabel.currency(); - - java.lang.String strForwardTenor = forwardLabel.tenor(); - - int iTenorInMonths = new java.lang.Integer (strForwardTenor.split ("M")[0]); - - org.drip.analytics.date.JulianDate dtEffective = dtSpot.addBusDays (0, strCurrency).addDays (2); - - org.drip.market.otc.FixedFloatSwapConvention ffsc = - org.drip.market.otc.IBORFixedFloatContainer.ConventionFromJurisdiction (strCurrency, "ALL", - strMaturityTenor, "MAIN"); - - if (null == ffsc) return null; - - try { - org.drip.param.period.ComposableFloatingUnitSetting cfusFloating = new - org.drip.param.period.ComposableFloatingUnitSetting (strForwardTenor, - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, null, - forwardLabel, - org.drip.analytics.support.CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0.); - - org.drip.param.period.CompositePeriodSetting cpsFloating = new - org.drip.param.period.CompositePeriodSetting (12 / iTenorInMonths, strForwardTenor, - strCurrency, null, -1., null, null, null, null); - - org.drip.product.rates.Stream floatingStream = new org.drip.product.rates.Stream - (org.drip.analytics.support.CompositePeriodBuilder.FloatingCompositeUnit - (org.drip.analytics.support.CompositePeriodBuilder.RegularEdgeDates (dtEffective, - strForwardTenor, strMaturityTenor, null), cpsFloating, cfusFloating)); - - org.drip.product.rates.Stream fixedStream = ffsc.fixedStreamConvention().createStream - (dtEffective, strMaturityTenor, 0., 1.); - - org.drip.product.rates.FixFloatComponent ffc = new org.drip.product.rates.FixFloatComponent - (fixedStream, floatingStream, null); - - ffc.setPrimaryCode ("FixFloat:" + strMaturityTenor); - - return ffc; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an Instance of OTC OIS Fix Float Swap - * - * @param dtSpot Spot Date - * @param strCurrency Currency - * @param strMaturityTenor The OIS Maturity Tenor - * @param dblCoupon The Fixed Coupon Rate - * @param bFund TRUE - Floater Based off of Fund - * - * @return Instance of OIS Fix Float Swap - */ - - public static final org.drip.product.rates.FixFloatComponent OISFixFloat ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strCurrency, - final java.lang.String strMaturityTenor, - final double dblCoupon, - final boolean bFund) - { - if (null == dtSpot) return null; - - org.drip.market.otc.FixedFloatSwapConvention ffsc = bFund ? - org.drip.market.otc.OvernightFixedFloatContainer.FundConventionFromJurisdiction (strCurrency) : - org.drip.market.otc.OvernightFixedFloatContainer.IndexConventionFromJurisdiction (strCurrency, - strMaturityTenor); - - return null == ffsc ? null : ffsc.createFixFloatComponent (dtSpot.addBusDays (0, strCurrency), - strMaturityTenor, dblCoupon, 0., 1.); - } - - /** - * Construct an OTC Float-Float Swap Instance - * - * @param dtSpot Spot Date - * @param strCurrency Currency - * @param strDerivedTenor Tenor of the Derived Leg - * @param strMaturityTenor Maturity Tenor of the Float-Float Swap - * @param dblBasis The Float-Float Swap Basis - * - * @return The OTC Float-Float Swap Instance - */ - - public static final org.drip.product.rates.FloatFloatComponent FloatFloat ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strCurrency, - final java.lang.String strDerivedTenor, - final java.lang.String strMaturityTenor, - final double dblBasis) - { - if (null == dtSpot) return null; - - org.drip.market.otc.FloatFloatSwapConvention ffsc = - org.drip.market.otc.IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - return null == ffsc ? null : ffsc.createFloatFloatComponent (dtSpot.addBusDays (0, strCurrency), - strDerivedTenor, strMaturityTenor, dblBasis, 1.); - } - - /** - * Create an Instance of the OTC CDS. - * - * @param dtSpot The Spot Date - * @param strMaturityTenor Maturity Tenor - * @param dblCoupon Coupon - * @param strCurrency Currency - * @param strCredit Credit Curve - * - * @return The OTC CDS Instance - */ - - public static final org.drip.product.definition.CreditDefaultSwap CDS ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strMaturityTenor, - final double dblCoupon, - final java.lang.String strCurrency, - final java.lang.String strCredit) - { - if (null == dtSpot || null == strCurrency) return null; - - org.drip.analytics.date.JulianDate dtFirstCoupon = dtSpot.addBusDays (0, strCurrency).nextCreditIMM - (3); - - return null == dtFirstCoupon ? null : org.drip.product.creator.CDSBuilder.CreateCDS - (dtFirstCoupon.subtractTenor ("3M"), dtFirstCoupon.addTenor (strMaturityTenor), dblCoupon, - strCurrency, "CAD".equalsIgnoreCase (strCurrency) || "EUR".equalsIgnoreCase (strCurrency) || - "GBP".equalsIgnoreCase (strCurrency) || "HKD".equalsIgnoreCase (strCurrency) || - "USD".equalsIgnoreCase (strCurrency) ? 0.40 : 0.25, strCredit, strCurrency, true); - } - - /** - * Create an OTC FX Forward Component - * - * @param dtSpot Spot Date - * @param ccyPair Currency Pair - * @param strMaturityTenor Maturity Tenor - * - * @return The OTC FX Forward Component Instance - */ - - public static final org.drip.product.fx.FXForwardComponent FXForward ( - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.product.params.CurrencyPair ccyPair, - final java.lang.String strMaturityTenor) - { - if (null == dtSpot || null == ccyPair) return null; - - org.drip.analytics.date.JulianDate dtEffective = dtSpot.addBusDays (0, ccyPair.denomCcy()); - - try { - return new org.drip.product.fx.FXForwardComponent ("FXFWD::" + ccyPair.code() + "::" + - strMaturityTenor, ccyPair, dtEffective.julian(), dtEffective.addTenor - (strMaturityTenor).julian(), 1., null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an Array of OTC Funding Deposit Instruments from their corresponding Maturity Tenors - * - * @param dtSpot Spot Date - * @param strCurrency Currency - * @param astrMaturityTenor Array of Maturity Tenors - * - * @return Array of OTC Funding Deposit Instruments from their corresponding Maturity Tenors - */ - - public static final org.drip.product.rates.SingleStreamComponent[] FundingDeposit ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strCurrency, - final java.lang.String[] astrMaturityTenor) - { - if (null == astrMaturityTenor) return null; - - int iNumDeposit = astrMaturityTenor.length; - org.drip.product.rates.SingleStreamComponent[] aSSCDeposit = new - org.drip.product.rates.SingleStreamComponent[iNumDeposit]; - - if (0 == iNumDeposit) return null; - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - if (null == (aSSCDeposit[i] = FundingDeposit (dtSpot, strCurrency, astrMaturityTenor[i]))) - return null; - - aSSCDeposit[i].setPrimaryCode (astrMaturityTenor[i]); - } - - return aSSCDeposit; - } - - /** - * Construct an Array of OTC Forward Deposit Instruments from the corresponding Maturity Tenors - * - * @param dtSpot Spot Date - * @param astrMaturityTenor Array of Maturity Tenors - * @param forwardLabel The Forward Label - * - * @return Forward Deposit Instrument Instance from the corresponding Maturity Tenor - */ - - public static final org.drip.product.rates.SingleStreamComponent[] ForwardRateDeposit ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String[] astrMaturityTenor, - final org.drip.state.identifier.ForwardLabel forwardLabel) - { - if (null == astrMaturityTenor) return null; - - int iNumDeposit = astrMaturityTenor.length; - org.drip.product.rates.SingleStreamComponent[] aSSCDeposit = new - org.drip.product.rates.SingleStreamComponent[iNumDeposit]; - - if (0 == iNumDeposit) return null; - - for (int i = 0; i < astrMaturityTenor.length; ++i) { - if (null == (aSSCDeposit[i] = ForwardRateDeposit (dtSpot, astrMaturityTenor[i], forwardLabel))) - return null; - - aSSCDeposit[i].setPrimaryCode (astrMaturityTenor[i]); - } - - return aSSCDeposit; - } - - /** - * Construct an Array of OTC Overnight Deposit Instrument from their Maturity Tenors - * - * @param dtSpot Spot Date - * @param strCurrency Currency - * @param astrMaturityTenor Array of Maturity Tenor - * - * @return Array of Overnight Deposit Instrument from their Maturity Tenors - */ - - public static final org.drip.product.rates.SingleStreamComponent[] OvernightDeposit ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strCurrency, - final java.lang.String[] astrMaturityTenor) - { - if (null == astrMaturityTenor) return null; - - int iNumDeposit = astrMaturityTenor.length; - org.drip.product.rates.SingleStreamComponent[] aSSCDeposit = new - org.drip.product.rates.SingleStreamComponent[iNumDeposit]; - - if (0 == iNumDeposit) return null; - - for (int i = 0; i < iNumDeposit; ++i) { - if (null == (aSSCDeposit[i] = OvernightDeposit (dtSpot, strCurrency, astrMaturityTenor[i]))) - return null; - } - return aSSCDeposit; - } - - /** - * Create an Array of Standard FRAs from the Spot Date, the Forward Label, and the Strike - * - * @param dtSpot Spot Date - * @param forwardLabel The Forward Label - * @param astrMaturityTenor Array of Maturity Tenors - * @param adblFRAStrike Array of FRA Strikes - * - * @return Array of Standard FRA Instances - */ - - public static final org.drip.product.fra.FRAStandardComponent[] FRAStandard ( - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final java.lang.String[] astrMaturityTenor, - final double[] adblFRAStrike) - { - if (null == astrMaturityTenor || null == adblFRAStrike) return null; - - int iNumFRA = astrMaturityTenor.length; - org.drip.product.fra.FRAStandardComponent[] aFRA = new - org.drip.product.fra.FRAStandardComponent[iNumFRA]; - - if (0 == iNumFRA || iNumFRA != adblFRAStrike.length) return null; - - for (int i = 0; i < iNumFRA; ++i) { - if (null == (aFRA[i] = FRAStandard (dtSpot, forwardLabel, astrMaturityTenor[i], - adblFRAStrike[i]))) - return null; - } - - return aFRA; - } - - /** - * Construct an Array of OTC Fix Float Swaps using the specified Input Parameters - * - * @param dtSpot The Spot Date - * @param strCurrency The OTC Currency - * @param strLocation Location - * @param astrMaturityTenor Array of Maturity Tenors - * @param strIndex Index - * @param dblCoupon Coupon - * - * @return The Array of OTC Fix Float Swaps - */ - - public static final org.drip.product.rates.FixFloatComponent[] FixFloatStandard ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strCurrency, - final java.lang.String strLocation, - final java.lang.String[] astrMaturityTenor, - final java.lang.String strIndex, - final double dblCoupon) - { - if (null == astrMaturityTenor) return null; - - int iNumFixFloat = astrMaturityTenor.length; - org.drip.product.rates.FixFloatComponent[] aFFC = new - org.drip.product.rates.FixFloatComponent[iNumFixFloat]; - - if (0 == iNumFixFloat) return null; - - for (int i = 0; i < iNumFixFloat; ++i) { - if (null == (aFFC[i] = FixFloatStandard (dtSpot, strCurrency, strLocation, astrMaturityTenor[i], - strIndex, 0.))) - return null; - } - - return aFFC; - } - - /** - * Construct an Array of Custom Fix Float Swap Instances - * - * @param dtSpot The Spot Date - * @param forwardLabel The Forward Label - * @param astrMaturityTenor Array of Maturity Tenors - * - * @return Array of Custom Fix Float Swap Instances - */ - - public static final org.drip.product.rates.FixFloatComponent[] FixFloatCustom ( - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final java.lang.String[] astrMaturityTenor) - { - if (null == dtSpot || null == forwardLabel || null == astrMaturityTenor) return null; - - int iNumComp = astrMaturityTenor.length; - org.drip.param.period.CompositePeriodSetting cpsFloating = null; - org.drip.param.period.ComposableFloatingUnitSetting cfusFloating = null; - org.drip.product.rates.FixFloatComponent[] aFFC = new - org.drip.product.rates.FixFloatComponent[iNumComp]; - - if (0 == iNumComp) return null; - - java.lang.String strCurrency = forwardLabel.currency(); - - java.lang.String strForwardTenor = forwardLabel.tenor(); - - int iTenorInMonths = new java.lang.Integer (strForwardTenor.split ("M")[0]); - - org.drip.analytics.date.JulianDate dtEffective = dtSpot.addBusDays (0, strCurrency).addDays (2); - - try { - cfusFloating = new org.drip.param.period.ComposableFloatingUnitSetting (strForwardTenor, - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, null, - forwardLabel, - org.drip.analytics.support.CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, 0.); - - cpsFloating = new org.drip.param.period.CompositePeriodSetting (12 / iTenorInMonths, - strForwardTenor, strCurrency, null, -1., null, null, null, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int i = 0; i < iNumComp; ++i) { - org.drip.market.otc.FixedFloatSwapConvention ffsc = - org.drip.market.otc.IBORFixedFloatContainer.ConventionFromJurisdiction (strCurrency, "ALL", - astrMaturityTenor[i], "MAIN"); - - if (null == ffsc) return null; - - try { - org.drip.product.rates.Stream floatingStream = new org.drip.product.rates.Stream - (org.drip.analytics.support.CompositePeriodBuilder.FloatingCompositeUnit - (org.drip.analytics.support.CompositePeriodBuilder.RegularEdgeDates (dtEffective, - strForwardTenor, astrMaturityTenor[i], null), cpsFloating, cfusFloating)); - - org.drip.product.rates.Stream fixedStream = ffsc.fixedStreamConvention().createStream - (dtEffective, astrMaturityTenor[i], 0., 1.); - - aFFC[i] = new org.drip.product.rates.FixFloatComponent (fixedStream, floatingStream, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - aFFC[i].setPrimaryCode ("FixFloat:" + astrMaturityTenor[i]); - } - - return aFFC; - } - - /** - * Construct an Array of OTC Fix Float OIS Instances - * - * @param dtSpot Spot Date - * @param strCurrency Currency - * @param astrMaturityTenor Array of OIS Maturity Tenors - * @param adblCoupon OIS Fixed Rate Coupon - * @param bFund TRUE - Floater Based off of Fund - * - * @return Array of Fix Float OIS Instances - */ - - public static final org.drip.product.rates.FixFloatComponent[] OISFixFloat ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strCurrency, - final java.lang.String[] astrMaturityTenor, - final double[] adblCoupon, - final boolean bFund) - { - if (null == astrMaturityTenor) return null; - - int iNumOIS = astrMaturityTenor.length; - org.drip.product.rates.FixFloatComponent[] aFixFloatOIS = new - org.drip.product.rates.FixFloatComponent[iNumOIS]; - - if (0 == iNumOIS) return null; - - for (int i = 0; i < iNumOIS; ++i) { - if (null == (aFixFloatOIS[i] = OISFixFloat (dtSpot, strCurrency, astrMaturityTenor[i], - adblCoupon[i], bFund))) - return null; - } - - return aFixFloatOIS; - } - - /** - * Construct an Array of OTC OIS Fix-Float Futures - * - * @param dtSpot Spot Date - * @param strCurrency Currency - * @param astrEffectiveTenor Array of Effective Tenors - * @param astrMaturityTenor Array of Maturity Tenors - * @param adblCoupon Array of Coupons - * @param bFund TRUE - Floater Based off of Fund - * - * @return Array of OIS Fix-Float Futures - */ - - public static final org.drip.product.rates.FixFloatComponent[] OISFixFloatFutures ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strCurrency, - final java.lang.String[] astrEffectiveTenor, - final java.lang.String[] astrMaturityTenor, - final double[] adblCoupon, - final boolean bFund) - { - if (null == dtSpot || null == astrEffectiveTenor || null == astrMaturityTenor || null == adblCoupon) - return null; - - int iNumOISFutures = astrEffectiveTenor.length; - org.drip.product.rates.FixFloatComponent[] aOISFutures = new - org.drip.product.rates.FixFloatComponent[iNumOISFutures]; - - if (0 == iNumOISFutures || iNumOISFutures != astrMaturityTenor.length || iNumOISFutures != - adblCoupon.length) - return null; - - for (int i = 0; i < iNumOISFutures; ++i) { - if (null == (aOISFutures[i] = OISFixFloat (dtSpot.addTenor (astrEffectiveTenor[i]), strCurrency, - astrMaturityTenor[i], adblCoupon[i], bFund))) - return null; - } - - return aOISFutures; - } - - /** - * Construct an Array of OTC Float-Float Swap Instances - * - * @param dtSpot Spot Date - * @param strCurrency Currency - * @param strDerivedTenor Tenor of the Derived Leg - * @param astrMaturityTenor Array of the Float-Float Swap Maturity Tenors - * @param dblBasis The Float-Float Swap Basis - * - * @return Array of OTC Float-Float Swap Instances - */ - - public static final org.drip.product.rates.FloatFloatComponent[] FloatFloat ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String strCurrency, - final java.lang.String strDerivedTenor, - final java.lang.String[] astrMaturityTenor, - final double dblBasis) - { - if (null == astrMaturityTenor) return null; - - org.drip.market.otc.FloatFloatSwapConvention ffsc = - org.drip.market.otc.IBORFloatFloatContainer.ConventionFromJurisdiction (strCurrency); - - int iNumFFC = astrMaturityTenor.length; - org.drip.product.rates.FloatFloatComponent[] aFFC = new - org.drip.product.rates.FloatFloatComponent[iNumFFC]; - - if (null == ffsc || 0 == iNumFFC) return null; - - for (int i = 0; i < iNumFFC; ++i) { - if (null == (aFFC[i] = ffsc.createFloatFloatComponent (dtSpot, strDerivedTenor, - astrMaturityTenor[i], dblBasis, 1.))) - return null; - } - - return aFFC; - } - - /** - * Create an Array of the OTC CDS Instance. - * - * @param dtSpot Spot Date - * @param astrMaturityTenor Array of Maturity Tenors - * @param adblCoupon Array of Coupon - * @param strCurrency Currency - * @param strCredit Credit Curve - * - * @return Array of OTC CDS Instances - */ - - public static final org.drip.product.definition.CreditDefaultSwap[] CDS ( - final org.drip.analytics.date.JulianDate dtSpot, - final java.lang.String[] astrMaturityTenor, - final double[] adblCoupon, - final java.lang.String strCurrency, - final java.lang.String strCredit) - { - if (null == dtSpot || null == strCurrency || null == astrMaturityTenor || null == adblCoupon) - return null; - - int iNumCDS = astrMaturityTenor.length; - java.lang.String strCalendar = strCurrency; - org.drip.product.definition.CreditDefaultSwap[] aCDS = new - org.drip.product.definition.CreditDefaultSwap[iNumCDS]; - - if (0 == iNumCDS || iNumCDS != adblCoupon.length) return null; - - org.drip.analytics.date.JulianDate dtFirstCoupon = dtSpot.addBusDays (0, strCalendar).nextCreditIMM - (3); - - if (null == dtFirstCoupon) return null; - - org.drip.analytics.date.JulianDate dtEffective = dtFirstCoupon.subtractTenor ("3M"); - - if (null == dtEffective) return null; - - double dblRecovery = "CAD".equalsIgnoreCase (strCurrency) || "EUR".equalsIgnoreCase (strCurrency) || - "GBP".equalsIgnoreCase (strCurrency) || "HKD".equalsIgnoreCase (strCurrency) || - "USD".equalsIgnoreCase (strCurrency) ? 0.40 : 0.25; - - for (int i = 0; i < iNumCDS; ++i) - aCDS[i] = org.drip.product.creator.CDSBuilder.CreateCDS (dtEffective, dtFirstCoupon.addTenor - (astrMaturityTenor[i]), adblCoupon[i], strCurrency, dblRecovery, strCredit, strCalendar, - true); - - return aCDS; - } - - /** - * Create an Array of OTC FX Forward Components - * - * @param dtSpot Spot Date - * @param ccyPair Currency Pair - * @param astrMaturityTenor Array of Maturity Tenors - * - * @return Array of OTC FX Forward Component Instances - */ - - public static final org.drip.product.fx.FXForwardComponent[] FXForward ( - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.product.params.CurrencyPair ccyPair, - final java.lang.String[] astrMaturityTenor) - { - if (null == astrMaturityTenor) return null; - - int iNumFXComp = astrMaturityTenor.length; - org.drip.product.fx.FXForwardComponent[] aFXFC = new - org.drip.product.fx.FXForwardComponent[iNumFXComp]; - - if (0 == iNumFXComp) return null; - - for (int i = 0; i < iNumFXComp; ++i) - aFXFC[i] = FXForward (dtSpot, ccyPair, astrMaturityTenor[i]); - - return aFXFC; - } - - /** - * Construct an Instance of the Standard OTC FRA Cap/Floor - * - * @param dtSpot Spot Date - * @param forwardLabel The Forward Label - * @param strMaturityTenor Cap/Floor Maturity Tenor - * @param dblStrike Cap/Floor Strike - * @param bIsCap TRUE - Contract is a Cap - * - * @return The Cap/Floor Instance - */ - - public static final org.drip.product.fra.FRAStandardCapFloor CapFloor ( - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final java.lang.String strMaturityTenor, - final double dblStrike, - final boolean bIsCap) - { - if (null == dtSpot || null == forwardLabel) return null; - - java.lang.String strForwardTenor = forwardLabel.tenor(); - - java.lang.String strCurrency = forwardLabel.currency(); - - java.lang.String strCalendar = strCurrency; - - org.drip.analytics.date.JulianDate dtEffective = dtSpot.addBusDays (0, strCalendar); - - try { - org.drip.param.period.ComposableFloatingUnitSetting cfus = new - org.drip.param.period.ComposableFloatingUnitSetting (strForwardTenor, - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, null, - forwardLabel, - org.drip.analytics.support.CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0.); - - org.drip.param.period.CompositePeriodSetting cps = new - org.drip.param.period.CompositePeriodSetting - (org.drip.analytics.support.Helper.TenorToFreq (strForwardTenor), - strForwardTenor, strCurrency, null, 1., null, null, null, null); - - org.drip.product.rates.Stream floatStream = new org.drip.product.rates.Stream - (org.drip.analytics.support.CompositePeriodBuilder.FloatingCompositeUnit - (org.drip.analytics.support.CompositePeriodBuilder.RegularEdgeDates - (dtEffective.julian(), strForwardTenor, strMaturityTenor, null), cps, cfus)); - - return new org.drip.product.fra.FRAStandardCapFloor (forwardLabel.fullyQualifiedName() + (bIsCap - ? "::CAP" : "::FLOOR"), floatStream, "ParForward", bIsCap, dblStrike, new - org.drip.product.params.LastTradingDateSetting - (org.drip.product.params.LastTradingDateSetting.MID_CURVE_OPTION_QUARTERLY, "", - java.lang.Integer.MIN_VALUE), null, new - org.drip.pricer.option.BlackScholesAlgorithm()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an Instance of the Standard OTC FRA Cap/Floor - * - * @param dtSpot Spot Date - * @param forwardLabel The Forward Label - * @param astrMaturityTenor Array of Cap/Floor Maturity Tenors - * @param adblStrike Array of Cap/Floor Strikes - * @param bIsCap TRUE - Contract is a Cap - * - * @return The Cap/Floor Instance - */ - - public static final org.drip.product.fra.FRAStandardCapFloor[] CapFloor ( - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.state.identifier.ForwardLabel forwardLabel, - final java.lang.String[] astrMaturityTenor, - final double[] adblStrike, - final boolean bIsCap) - { - if (null == astrMaturityTenor || null == adblStrike) return null; - - int iNumCapFloor = astrMaturityTenor.length; - org.drip.product.fra.FRAStandardCapFloor[] aFRACapFloor = new - org.drip.product.fra.FRAStandardCapFloor[iNumCapFloor]; - - if (0 == iNumCapFloor || iNumCapFloor != adblStrike.length) return null; - - for (int i = 0; i < iNumCapFloor; ++i) { - if (null == (aFRACapFloor[i] = org.drip.service.template.OTCInstrumentBuilder.CapFloor (dtSpot, - forwardLabel, astrMaturityTenor[i], adblStrike[i], bIsCap))) - return null; - } - - return aFRACapFloor; - } -} diff --git a/org/drip/service/template/TreasuryBuilder.java b/org/drip/service/template/TreasuryBuilder.java deleted file mode 100644 index 5a437a1..0000000 --- a/org/drip/service/template/TreasuryBuilder.java +++ /dev/null @@ -1,358 +0,0 @@ - -package org.drip.service.template; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * Treasury Builder contains Static Helper API to facilitate Construction of the Sovereign Treasury Bonds. - * - * @author Lakshmi Krishnamurthy - */ - -public class TreasuryBuilder { - - /** - * Construct an Instance of the Australian Treasury AUD AGB Bond - * - * @param dtEffective Effective Date - * @param dtMaturity Maturity Date - * @param dblCoupon Coupon - * - * @return Instance of the Australian Treasury AUD AGB Bond - */ - - public static final org.drip.product.govvie.TreasuryComponent AGB ( - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity, - final double dblCoupon) - { - org.drip.market.issue.TreasurySetting ts = - org.drip.market.issue.TreasurySettingContainer.TreasurySetting ("AGB"); - - return null == ts ? null : org.drip.product.creator.BondBuilder.Treasury (ts.code(), dtEffective, - dtMaturity, ts.currency(), dblCoupon, ts.frequency(), ts.dayCount()); - } - - /** - * Construct an Instance of the Italian Treasury EUR BTPS Bond - * - * @param dtEffective Effective Date - * @param dtMaturity Maturity Date - * @param dblCoupon Coupon - * - * @return Instance of the Italian Treasury EUR BTPS Bond - */ - - public static final org.drip.product.govvie.TreasuryComponent BTPS ( - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity, - final double dblCoupon) - { - org.drip.market.issue.TreasurySetting ts = - org.drip.market.issue.TreasurySettingContainer.TreasurySetting ("BTPS"); - - return null == ts ? null : org.drip.product.creator.BondBuilder.Treasury (ts.code(), dtEffective, - dtMaturity, ts.currency(), dblCoupon, ts.frequency(), ts.dayCount()); - } - - /** - * Construct an Instance of the Canadian Government CAD CAN Bond - * - * @param dtEffective Effective Date - * @param dtMaturity Maturity Date - * @param dblCoupon Coupon - * - * @return Instance of the Canadian Government CAD CAN Bond - */ - - public static final org.drip.product.govvie.TreasuryComponent CAN ( - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity, - final double dblCoupon) - { - org.drip.market.issue.TreasurySetting ts = - org.drip.market.issue.TreasurySettingContainer.TreasurySetting ("CAN"); - - return null == ts ? null : org.drip.product.creator.BondBuilder.Treasury (ts.code(), dtEffective, - dtMaturity, ts.currency(), dblCoupon, ts.frequency(), ts.dayCount()); - } - - /** - * Construct an Instance of the German Treasury EUR DBR Bond - * - * @param dtEffective Effective Date - * @param dtMaturity Maturity Date - * @param dblCoupon Coupon - * - * @return Instance of the German Treasury EUR DBR Bond - */ - - public static final org.drip.product.govvie.TreasuryComponent DBR ( - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity, - final double dblCoupon) - { - org.drip.market.issue.TreasurySetting ts = - org.drip.market.issue.TreasurySettingContainer.TreasurySetting ("DBR"); - - return null == ts ? null : org.drip.product.creator.BondBuilder.Treasury (ts.code(), dtEffective, - dtMaturity, ts.currency(), dblCoupon, ts.frequency(), ts.dayCount()); - } - - /** - * Construct an Instance of the French Treasury EUR FRTR Bond - * - * @param dtEffective Effective Date - * @param dtMaturity Maturity Date - * @param dblCoupon Coupon - * - * @return Instance of the French Treasury EUR FRTR Bond - */ - - public static final org.drip.product.govvie.TreasuryComponent FRTR ( - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity, - final double dblCoupon) - { - org.drip.market.issue.TreasurySetting ts = - org.drip.market.issue.TreasurySettingContainer.TreasurySetting ("FRTR"); - - return null == ts ? null : org.drip.product.creator.BondBuilder.Treasury (ts.code(), dtEffective, - dtMaturity, ts.currency(), dblCoupon, ts.frequency(), ts.dayCount()); - } - - /** - * Construct an Instance of the Greek Treasury EUR GGB Bond - * - * @param dtEffective Effective Date - * @param dtMaturity Maturity Date - * @param dblCoupon Coupon - * - * @return Instance of the Greek Treasury EUR GGB Bond - */ - - public static final org.drip.product.govvie.TreasuryComponent GGB ( - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity, - final double dblCoupon) - { - org.drip.market.issue.TreasurySetting ts = - org.drip.market.issue.TreasurySettingContainer.TreasurySetting ("GGB"); - - return null == ts ? null : org.drip.product.creator.BondBuilder.Treasury (ts.code(), dtEffective, - dtMaturity, ts.currency(), dblCoupon, ts.frequency(), ts.dayCount()); - } - - /** - * Construct an Instance of the UK Treasury GBP GILT Bond - * - * @param dtEffective Effective Date - * @param dtMaturity Maturity Date - * @param dblCoupon Coupon - * - * @return Instance of the UK Treasury GBP GILT Bond - */ - - public static final org.drip.product.govvie.TreasuryComponent GILT ( - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity, - final double dblCoupon) - { - org.drip.market.issue.TreasurySetting ts = - org.drip.market.issue.TreasurySettingContainer.TreasurySetting ("GILT"); - - return null == ts ? null : org.drip.product.creator.BondBuilder.Treasury (ts.code(), dtEffective, - dtMaturity, ts.currency(), dblCoupon, ts.frequency(), ts.dayCount()); - } - - /** - * Construct an Instance of the Japanese Treasury JPY JGB Bond - * - * @param dtEffective Effective Date - * @param dtMaturity Maturity Date - * @param dblCoupon Coupon - * - * @return Instance of the Japanese Treasury JPY JGB Bond - */ - - public static final org.drip.product.govvie.TreasuryComponent JGB ( - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity, - final double dblCoupon) - { - org.drip.market.issue.TreasurySetting ts = - org.drip.market.issue.TreasurySettingContainer.TreasurySetting ("JGB"); - - return null == ts ? null : org.drip.product.creator.BondBuilder.Treasury (ts.code(), dtEffective, - dtMaturity, ts.currency(), dblCoupon, ts.frequency(), ts.dayCount()); - } - - /** - * Construct an Instance of the Mexican Treasury MXN MBONO Bond - * - * @param dtEffective Effective Date - * @param dtMaturity Maturity Date - * @param dblCoupon Coupon - * - * @return Instance of the Mexican Treasury MXN MBONO Bond - */ - - public static final org.drip.product.govvie.TreasuryComponent MBONO ( - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity, - final double dblCoupon) - { - org.drip.market.issue.TreasurySetting ts = - org.drip.market.issue.TreasurySettingContainer.TreasurySetting ("MBONO"); - - return null == ts ? null : org.drip.product.creator.BondBuilder.Treasury (ts.code(), dtEffective, - dtMaturity, ts.currency(), dblCoupon, ts.frequency(), ts.dayCount()); - } - - /** - * Construct an Instance of the Spanish Treasury EUR SPGB Bond - * - * @param dtEffective Effective Date - * @param dtMaturity Maturity Date - * @param dblCoupon Coupon - * - * @return Instance of the Spanish Treasury EUR SPGB Bond - */ - - public static final org.drip.product.govvie.TreasuryComponent SPGB ( - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity, - final double dblCoupon) - { - org.drip.market.issue.TreasurySetting ts = - org.drip.market.issue.TreasurySettingContainer.TreasurySetting ("SPGB"); - - return null == ts ? null : org.drip.product.creator.BondBuilder.Treasury (ts.code(), dtEffective, - dtMaturity, ts.currency(), dblCoupon, ts.frequency(), ts.dayCount()); - } - - /** - * Construct an Instance of the US Treasury USD UST Bond - * - * @param dtEffective Effective Date - * @param dtMaturity Maturity Date - * @param dblCoupon Coupon - * - * @return Instance of the US Treasury USD UST Bond - */ - - public static final org.drip.product.govvie.TreasuryComponent UST ( - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity, - final double dblCoupon) - { - org.drip.market.issue.TreasurySetting ts = - org.drip.market.issue.TreasurySettingContainer.TreasurySetting ("UST"); - - return null == ts ? null : org.drip.product.creator.BondBuilder.Treasury (ts.code(), dtEffective, - dtMaturity, ts.currency(), dblCoupon, ts.frequency(), ts.dayCount()); - } - - /** - * Construct an Instance of the Treasury Bond From the Code - * - * @param strCode The Treasury Code - * @param dtEffective Effective Date - * @param dtMaturity Maturity Date - * @param dblCoupon Coupon - * - * @return Instance of the Treasury Bond From the Code - */ - - public static final org.drip.product.govvie.TreasuryComponent FromCode ( - final java.lang.String strCode, - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtMaturity, - final double dblCoupon) - { - org.drip.market.issue.TreasurySetting ts = - org.drip.market.issue.TreasurySettingContainer.TreasurySetting (strCode); - - return null == ts ? null : org.drip.product.creator.BondBuilder.Treasury (ts.code(), dtEffective, - dtMaturity, ts.currency(), dblCoupon, ts.frequency(), ts.dayCount()); - } - - /** - * Construct an Array of the Treasury Instances from the Code - * - * @param strCode The Treasury Code - * @param adtEffective Array of Effective Dates - * @param adtMaturity Array of Maturity Dates - * @param adblCoupon Array of Coupons - * - * @return Array of the Treasury Instances from the Code - */ - - public static final org.drip.product.govvie.TreasuryComponent[] FromCode ( - final java.lang.String strCode, - final org.drip.analytics.date.JulianDate[] adtEffective, - final org.drip.analytics.date.JulianDate[] adtMaturity, - final double[] adblCoupon) - { - if (null == adtEffective || null == adtMaturity || null == adblCoupon) return null; - - int iNumTreasury = adtEffective.length; - org.drip.product.govvie.TreasuryComponent[] aTreasury = new - org.drip.product.govvie.TreasuryComponent[iNumTreasury]; - - if (0 == iNumTreasury || iNumTreasury != adtMaturity.length || iNumTreasury != adblCoupon.length) - return null; - - for (int i = 0; i < iNumTreasury; ++i) { - if (null == (aTreasury[i] = FromCode (strCode, adtEffective[i], adtMaturity[i], adblCoupon[i]))) - return null; - } - - return aTreasury; - } -} diff --git a/org/drip/spaces/big/BigC1Array.java b/org/drip/spaces/big/BigC1Array.java deleted file mode 100644 index b23854c..0000000 --- a/org/drip/spaces/big/BigC1Array.java +++ /dev/null @@ -1,130 +0,0 @@ - -package org.drip.spaces.big; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BigC1Array contains the Functionality to Process and Manipulate the Character Array backing the Big - * String. - * - * @author Lakshmi Krishnamurthy - */ - -public class BigC1Array { - private int _iLength = -1; - private char[] _ach = null; - - private int WrapIndex ( - final int iIndex) - { - if (iIndex >= _iLength) return iIndex - _iLength; - - if (iIndex < 0) return iIndex + _iLength; - - return iIndex; - } - - /** - * BigC1Array Constructor - * - * @param ach Character Array - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BigC1Array ( - final char[] ach) - throws java.lang.Exception - { - if (null == (_ach = ach) || 0 == (_iLength = _ach.length)) - throw new java.lang.Exception ("BigC1Array ctr => Invalid Inputs"); - } - - /** - * Retrieve the Character Array - * - * @return The Character Array - */ - - public char[] charArray() - { - return _ach; - } - - /** - * Translate the String at around the Pivot Index using the String Block - * - * @param iPivotIndex The Pivot Index - * @param iBlockSize The Block Size - * - * @return TRUE - The Translation succeeded - */ - - public boolean translateAtPivot ( - final int iPivotIndex, - final int iBlockSize) - { - if (0 >= iPivotIndex || 0 >= iBlockSize) return false; - - int iLength = _ach.length; - char[] achTemp = new char[iBlockSize]; - - if (iPivotIndex >= iLength || iBlockSize >= iLength - iPivotIndex - 1) return false; - - for (int i = iPivotIndex - iBlockSize; i < iPivotIndex; ++i) - achTemp[i - iPivotIndex + iBlockSize] = _ach[i]; - - for (int i = 0; i < iLength - iBlockSize; ++i) - _ach[WrapIndex (iPivotIndex - iBlockSize + i)] = _ach[WrapIndex (iPivotIndex + i)]; - - for (int i = 0; i < iBlockSize; ++i) - _ach[WrapIndex (iPivotIndex - 2 * iBlockSize + i)] = achTemp[i]; - - return true; - } -} diff --git a/org/drip/spaces/big/BigR1Array.java b/org/drip/spaces/big/BigR1Array.java deleted file mode 100644 index fa69652..0000000 --- a/org/drip/spaces/big/BigR1Array.java +++ /dev/null @@ -1,378 +0,0 @@ - -package org.drip.spaces.big; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BigR1Array contains an Implementation of a variety of in-place Sorting Algorithms for Big Double - * Arrays. - * - * - C A R Hoare's Quick Sort - * - J von Neumann's Merge Sort - * - R W Floyd's Heap Sort - * - Insertion Sort - * - * @author Lakshmi Krishnamurthy - */ - -public class BigR1Array { - private int _iLength = -1; - private double[] _adblA = null; - - private void swapLocations ( - final int i1, - final int i2) - { - double dblTemp = _adblA[i1]; - _adblA[i1] = _adblA[i2]; - _adblA[i2] = dblTemp; - } - - private int dropOffIndex ( - final int iPickupIndex) - { - for (int i = 0; i < iPickupIndex; ++i) { - if (_adblA[i] > _adblA[iPickupIndex]) return i; - } - - return iPickupIndex; - } - - /** - * BigR1Array Constructor - * - * @param adblA The Array to be Sorted - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BigR1Array ( - final double[] adblA) - throws java.lang.Exception - { - if (null == (_adblA = adblA) || 0 == (_iLength = _adblA.length)) - throw new java.lang.Exception ("BigR1Array Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Array Contents - * - * @return The Array Contents - */ - - public double[] array() - { - return _adblA; - } - - /** - * Transfer all Elements from the Pickup Index to the Drop Off Index, and contiguously Shift the - * Intermediate Array - * - * @param iPickupIndex The Pickup Index - * @param iDropOffIndex The Drop off Index - * - * @return TRUE - Successfully transferred the Pickup to the Drop off Locations and the related - * Translations - */ - - public boolean transfer ( - final int iPickupIndex, - final int iDropOffIndex) - { - if (iPickupIndex < 0 || iPickupIndex >= _iLength || iDropOffIndex < 0 || iDropOffIndex >= _iLength) - return false; - - if (iPickupIndex == iDropOffIndex) return true; - - double dblTemp = _adblA[iPickupIndex]; - - if (iPickupIndex > iDropOffIndex) { - for (int i = iPickupIndex; i > iDropOffIndex; --i) - _adblA[i] = _adblA[i - 1]; - } else { - for (int i = iPickupIndex; i > iDropOffIndex; ++i) - _adblA[i] = _adblA[i + 1]; - } - - _adblA[iDropOffIndex] = dblTemp; - return true; - } - - /** - * Sort the Specified Range in the Array using Quick Sort - * - * @param iLow Lower Index of the Range (Inclusive) - * @param iHigh Upper Index of the Range (Inclusive) - * - * @return TRUE - The Range has been successfully sorted - */ - - public boolean quickSort ( - final int iLow, - final int iHigh) - { - if (iLow < 0 || iLow >= iHigh || iLow >= _iLength) return false; - - int iLeft = iLow; - int iRight = iHigh; - double dblPivot = _adblA[(iLow + iHigh) / 2]; - - while (iLeft <= iRight) { - while (_adblA[iLeft] < dblPivot) ++iLeft; - - while (_adblA[iRight] > dblPivot) --iRight; - - if (iLeft <= iRight) { - swapLocations (iLeft, iRight); - - ++iLeft; - --iRight; - } - } - - if (iLow < iRight && !quickSort (iLow, iRight)) return false; - - if (iLeft < iHigh && !quickSort (iLeft, iHigh)) return false; - - return true; - } - - /** - * Sort the Full Array using Quick Sort - * - * @return TRUE - The Full Array has been successfully sorted - */ - - public boolean quickSort() - { - return quickSort (0, _iLength - 1); - } - - /** - * Merge the Sorted Sub Array Pair - * - * @param i1Start The Left Starting Index (Inclusive) - * @param i1End The Left Ending Index (Inclusive) - * @param i2Start The Right Starting Index (Inclusive) - * @param i2End The Right End Index (Inclusive) - * - * @return TRUE - Successfully Merged the Sorted Array Pair and Re-assigned Back to the Master - */ - - public boolean mergeSort ( - final int i1Start, - final int i1End, - final int i2Start, - final int i2End) - { - if (i1Start >= _iLength || i1Start > i1End || i2Start > i2End || i1End >= i2Start) return false; - - if (i1Start == i1End && i2Start == i2End) { - if (_adblA[i1Start] > _adblA[i2Start]) swapLocations (i1Start, i2Start); - } else { - if (i1Start == i1End) { - int i2Mid = (i2Start + i2End) / 2; - - if (!mergeSort (i2Start, i2Mid, i2Mid + 1, i2End)) return false; - } - } - - int i = 0; - int i1 = i1Start; - int i2 = i2Start; - double[] adblMerged = new double[i1End - i1Start + i2End - i2Start + 2]; - - while (i1 <= i1End && i2 <= i2End) { - if (_adblA[i1] < _adblA[i2]) - adblMerged[i++] = _adblA[i1++]; - else if (_adblA[i1] > _adblA[i2]) - adblMerged[i++] = _adblA[i2++]; - else { - adblMerged[i++] = _adblA[i1++]; - adblMerged[i++] = _adblA[i2++]; - } - } - - while (i1 <= i1End) - adblMerged[i++] = _adblA[i1++]; - - while (i2 <= i2End) - adblMerged[i++] = _adblA[i2++]; - - i = 0; - - for (int j = i1Start; j <= i1End; ++j) - _adblA[j] = adblMerged[i++]; - - for (int j = i2Start; j <= i2End; ++j) - _adblA[j] = adblMerged[i++]; - - return true; - } - - /** - * Contiguous Stretch Merge Sort - * - * @param iStart The Master Starting Index (Inclusive) - * @param iEnd The Master Ending Index (Inclusive) - * - * @return TRUE - Successfully Merged the Sorted Array Stretch and Re-assigned Back to the Master - */ - - public boolean mergeSort ( - final int iStart, - final int iEnd) - { - if (iStart < 0 || iStart > iEnd || iStart >= _iLength) return false; - - if (iStart == iEnd) return true; - - if (iStart == iEnd - 1) { - if (_adblA[iStart] > _adblA[iEnd]) swapLocations (iStart, iEnd); - - return true; - } - - double[] adblMerged = new double[iEnd - iStart + 1]; - int iMid = (iStart + iEnd) / 2; - int iRightStart = iMid + 1; - int iRight = iRightStart; - int iLeftStart = iStart; - int iLeft = iLeftStart; - int iRightEnd = iEnd; - int iLeftEnd = iMid; - int i = 0; - - if (!mergeSort (iLeftStart, iLeftEnd) || !mergeSort (iRightStart, iRightEnd)) return false; - - while (iLeft <= iLeftEnd && iRight <= iRightEnd) { - if (_adblA[iLeft] < _adblA[iRight]) - adblMerged[i++] = _adblA[iLeft++]; - else if (_adblA[iLeft] > _adblA[iRight]) - adblMerged[i++] = _adblA[iRight++]; - else { - adblMerged[i++] = _adblA[iLeft++]; - adblMerged[i++] = _adblA[iRight++]; - } - } - - while (iLeft <= iLeftEnd) - adblMerged[i++] = _adblA[iLeft++]; - - while (iRight <= iRightEnd) - adblMerged[i++] = _adblA[iRight++]; - - i = 0; - - for (int j = iLeftStart; j <= iLeftEnd; ++j) - _adblA[j] = adblMerged[i++]; - - for (int j = iRightStart; j <= iRightEnd; ++j) - _adblA[j] = adblMerged[i++]; - - return true; - } - - /** - * In-place Big Array Merge Sort - * - * @return TRUE - Successfully Merged the Big Double Array and Re-assigned Back to the Master - */ - - public boolean mergeSort() - { - return mergeSort (0, _iLength - 1); - } - - /** - * Heap Sort the Big Array - * - * @return TRUE - Successfully Merged the Big Double Array and Re-assigned Back to the Master - */ - - public boolean heapSort() - { - org.drip.spaces.big.BinaryTree bt = null; - - try { - bt = new org.drip.spaces.big.BinaryTree (_adblA[0], null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - for (int i = 1; i < _iLength; ++i) { - if (null == bt.insert (_adblA[i])) return false; - } - - try { - return _iLength == bt.ascendingNodeArray (_adblA, 0); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - /** - * Insertion Sort the Big Array - * - * @return TRUE - Successfully Merged the Big Double Array and Re-assigned Back to the Master - */ - - public boolean insertionSort() - { - for (int iPickupIndex = 1; iPickupIndex < _iLength; ++iPickupIndex) { - if (!transfer (iPickupIndex, dropOffIndex (iPickupIndex))) return false; - } - - return true; - } -} diff --git a/org/drip/spaces/big/BigR2Array.java b/org/drip/spaces/big/BigR2Array.java deleted file mode 100644 index eaed36b..0000000 --- a/org/drip/spaces/big/BigR2Array.java +++ /dev/null @@ -1,201 +0,0 @@ - -package org.drip.spaces.big; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BigR2Array contains an Implementation Navigation and Processing Algorithms for Big Double R^2 Arrays. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class BigR2Array { - private int _iXLength = -1; - private int _iYLength = -1; - private double[][] _aadblR2 = null; - - /** - * BigR2Array Constructor - * - * @param aadblR2 2D Big Array Inputs - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BigR2Array ( - final double[][] aadblR2) - throws java.lang.Exception - { - if (null == (_aadblR2 = aadblR2)) - throw new java.lang.Exception ("BigR2Array Constructor => Invalid Inputs"); - - if (0 == (_iXLength = _aadblR2.length) || 0 == (_iYLength = _aadblR2[0].length)) - throw new java.lang.Exception ("BigR2Array Constructor => Invalid Inputs"); - } - - /** - * Compute the Path Response Associated with all the Nodes in the Path up to the Current One. - * - * @param iX The Current X Node - * @param iY The Current Y Node - * @param dblPriorPathResponse The Path Product Associated with the Given Prior Navigation Sequence - * - * @return The Path Response - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - abstract public double pathResponse ( - final int iX, - final int iY, - final double dblPriorPathResponse) - throws java.lang.Exception; - - /** - * Compute the Maximum Response Associated with all the Left/Right Adjacent Paths starting from the Top - * Left Node. - * - * @return The Maximum Response Associated with all the Left/Right Adjacent Paths starting from the - * Current Node - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - abstract public double maxPathResponse() - throws java.lang.Exception; - - /** - * Retrieve the Length of the X R^1 Array - * - * @return The Length of the X R^1 Array - */ - - public int xLength() - { - return _iXLength; - } - - /** - * Retrieve the Length of the Y R^1 Array - * - * @return The Length of the Y R^1 Array - */ - - public int yLength() - { - return _iYLength; - } - - /** - * Retrieve the R^2 Instance Array - * - * @return The R^2 Instance Array - */ - - public double[][] instance() - { - return _aadblR2; - } - - /** - * Validate the Specified Index Pair. - * - * @param iX The Current X Node - * @param iY The Current Y Node - * - * @return TRUE - The Index Pair is Valid - */ - - public boolean validateIndex ( - final int iX, - final int iY) - { - return iX < 0 || iX >= _iXLength || iY < 0 || iY >= _iYLength ? false : true; - } - - /** - * Compute the Maximum Response Associated with all the Left/Right Adjacent Paths starting from the - * Current Node. - * - * @param iX The Current X Node - * @param iY The Current Y Node - * @param dblPriorPathResponse The Path Response Associated with the Given Prior Navigation Sequence - * - * @return The Maximum Response Associated with all the Left/Right Adjacent Paths starting from the - * Current Node - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public double maxPathResponse ( - final int iX, - final int iY, - final double dblPriorPathResponse) - throws java.lang.Exception - { - double dblCurrentPathResponse = pathResponse (iX, iY, dblPriorPathResponse); - - if (iY == _iYLength - 1 && iX == _iXLength - 1) return dblCurrentPathResponse; - - double dblXShiftMaxPathResponse = java.lang.Double.NaN; - double dblYShiftMaxPathResponse = java.lang.Double.NaN; - - if (iX < _iXLength - 1) - dblXShiftMaxPathResponse = maxPathResponse (iX + 1, iY, dblCurrentPathResponse); - - if (iY < _iYLength - 1) - dblYShiftMaxPathResponse = maxPathResponse (iX, iY + 1, dblCurrentPathResponse); - - if (iY == _iYLength - 1) return dblXShiftMaxPathResponse; - - if (iX == _iXLength - 1) return dblYShiftMaxPathResponse; - - return dblXShiftMaxPathResponse > dblYShiftMaxPathResponse ? dblXShiftMaxPathResponse : - dblYShiftMaxPathResponse; - } -} diff --git a/org/drip/spaces/big/BinaryTree.java b/org/drip/spaces/big/BinaryTree.java deleted file mode 100644 index 98eeea2..0000000 --- a/org/drip/spaces/big/BinaryTree.java +++ /dev/null @@ -1,342 +0,0 @@ - -package org.drip.spaces.big; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BinaryTree contains an Implementation of the Left/Right Binary Tree. - * - * @author Lakshmi Krishnamurthy - */ - -public class BinaryTree { - private int _iCount = 1; - private BinaryTree _btParent = null; - private BinaryTree _btLeftChild = null; - private BinaryTree _btRightChild = null; - private double _dblNode = java.lang.Double.NaN; - - /** - * BinaryTree Constructor - * - * @param dblNode The Node Value - * @param btParent The BinaryTree Parent - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public BinaryTree ( - final double dblNode, - final BinaryTree btParent) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblNode = dblNode)) - throw new java.lang.Exception ("BinaryTree ctr => Invalid Inputs"); - - _iCount = 1; - _btParent = btParent; - } - - /** - * Retrieve the BinaryTree Node Value - * - * @return The BinaryTree Node Value - */ - - public double node() - { - return _dblNode; - } - - /** - * Retrieve the Parent BinaryTree Instance - * - * @return The Parent BinaryTree Instance - */ - - public BinaryTree parent() - { - return _btParent; - } - - /** - * Retrieve the Left Child BinaryTree Instance - * - * @return The Left Child BinaryTree Instance - */ - - public BinaryTree leftChild() - { - return _btLeftChild; - } - - /** - * Retrieve the Right Child BinaryTree Instance - * - * @return The Right Child BinaryTree Instance - */ - - public BinaryTree rightChild() - { - return _btRightChild; - } - - /** - * Retrieve the Node Instance Count - * - * @return The Node Instance Count - */ - - public int count() - { - return _iCount; - } - - /** - * Insert a Node into the Tree - * - * @param dblNode The Node to be inserted - * - * @return The Inserted Node - */ - - public BinaryTree insert ( - final double dblNode) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblNode)) return null; - - if (_dblNode == dblNode) { - ++_iCount; - return this; - } - - try { - if (dblNode < _dblNode) - return null == _btLeftChild ? _btLeftChild = new BinaryTree (dblNode, this) : - _btLeftChild.insert (dblNode); - - return null == _btRightChild ? _btRightChild = new BinaryTree (dblNode, this) : - _btRightChild.insert (dblNode); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Left Most Child - * - * @return The Left Most Child BinaryTree Instance - */ - - public BinaryTree leftMostChild() - { - BinaryTree btParent = this; - - BinaryTree btLeftChild = leftChild(); - - while (null != btLeftChild) { - btParent = btLeftChild; - - btLeftChild = btParent.leftChild(); - } - - return btParent; - } - - /** - * Retrieve the Right Most Child - * - * @return The Right Most Child BinaryTree Instance - */ - - public BinaryTree rightMostChild() - { - BinaryTree btParent = this; - - BinaryTree btRightChild = rightChild(); - - while (null != btRightChild) { - btParent = btRightChild; - - btRightChild = btParent.rightChild(); - } - - return btParent; - } - - /** - * Build a Consolidated Ascending List of all the Constituent Nodes - * - * @param lsNode The Node List - * - * @return TRUE - The Ascending Node List Successfully Built - */ - - public boolean ascendingNodeList ( - final java.util.List lsNode) - { - if (null == lsNode) return false; - - if (null != _btLeftChild && !_btLeftChild.ascendingNodeList (lsNode)) return false; - - lsNode.add (_dblNode); - - if (null != _btRightChild && !_btRightChild.ascendingNodeList (lsNode)) return false; - - return true; - } - - /** - * Build a Consolidated Ascending List of all the Constituent Nodes - * - * @return The Node List - */ - - public java.util.List ascendingNodeList() - { - java.util.List lsNode = new java.util.ArrayList(); - - return ascendingNodeList (lsNode) ? lsNode : null; - } - - /** - * Build a Consolidated Ascending Array of all the Constituent Nodes - * - * @param adblNode The Node Array - * @param iUpdateStartIndex The Update Start Index - * - * @return TRUE - The Ascending Node Array Successfully Built - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public int ascendingNodeArray ( - final double[] adblNode, - final int iUpdateStartIndex) - throws java.lang.Exception - { - if (null == adblNode || 0 == adblNode.length) - throw new java.lang.Exception ("BinaryTree::ascendingNodeArray => Invalid Inputs"); - - int iIndexToUpdate = null == _btLeftChild ? iUpdateStartIndex : _btLeftChild.ascendingNodeArray - (adblNode, iUpdateStartIndex); - - if (iIndexToUpdate >= adblNode.length) - throw new java.lang.Exception ("BinaryTree::ascendingNodeArray => Invalid Inputs"); - - adblNode[iIndexToUpdate++] = _dblNode; - - return null == _btRightChild ? iIndexToUpdate : _btRightChild.ascendingNodeArray (adblNode, - iIndexToUpdate); - } - - /** - * Build a Consolidated Descending List of all the Constituent Nodes - * - * @param lsNode The Node List - * - * @return TRUE - The Descending Node List Successfully Built - */ - - public boolean descendingNodeList ( - final java.util.List lsNode) - { - if (null == lsNode) return false; - - if (null != _btRightChild && !_btRightChild.descendingNodeList (lsNode)) return false; - - lsNode.add (_dblNode); - - if (null != _btLeftChild && !_btLeftChild.descendingNodeList (lsNode)) return false; - - return true; - } - - /** - * Build a Consolidated Descending Array of all the Constituent Nodes - * - * @param adblNode The Node Array - * @param iIndexToUpdate The Index To Update - * - * @return TRUE - The Descending Node Array Successfully Built - */ - - public boolean descendingNodeArray ( - final double[] adblNode, - final int iIndexToUpdate) - { - if (null == adblNode || 0 == adblNode.length) return false; - - if (null != _btLeftChild && !_btLeftChild.descendingNodeArray (adblNode, iIndexToUpdate)) - return false; - - if (iIndexToUpdate >= adblNode.length) return false; - - adblNode[iIndexToUpdate] = _dblNode; - - if (null != _btRightChild && !_btRightChild.descendingNodeArray (adblNode, iIndexToUpdate + 1)) - return false; - - return true; - } - - /** - * Build a Consolidated Descending List of all the Constituent Nodes - * - * @return The Node List - */ - - public java.util.List descendingNodeList() - { - java.util.List lsNode = new java.util.ArrayList(); - - return descendingNodeList (lsNode) ? lsNode : null; - } -} diff --git a/org/drip/spaces/big/SubMatrixSetExtractor.java b/org/drip/spaces/big/SubMatrixSetExtractor.java deleted file mode 100644 index 14decd7..0000000 --- a/org/drip/spaces/big/SubMatrixSetExtractor.java +++ /dev/null @@ -1,219 +0,0 @@ - -package org.drip.spaces.big; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * SubMatrixSetExtractor contains the Functionality to extract the Set of the Sub-matrices contained inside - * of the given Matrix. - * - * @author Lakshmi Krishnamurthy - */ - -public class SubMatrixSetExtractor { - - /** - * Compute the Aggregate Composite Value of the Supplied Matrix - * - * @param aadbl The Input Matrix - * - * @return The Aggregate Composite Value - * - * @throws java.lang.Exception Thrown if the Aggregate Composite Value cannot be compouted - */ - - public static final double CompositeValue ( - final double[][] aadbl) - throws java.lang.Exception - { - if (null == aadbl) - throw new java.lang.Exception ("SubMatrixSetExtractor::CompositeValue => Invalid Inputs"); - - int iSize = aadbl.length; - double dblCompositeValue = 0.; - - if (0 == iSize || 0 == aadbl[0].length) - throw new java.lang.Exception ("SubMatrixSetExtractor::CompositeValue => Invalid Inputs"); - - for (int i = 0; i < iSize; ++i) { - for (int j = 0; j < iSize; ++j) { - if (!org.drip.quant.common.NumberUtil.IsValid (aadbl[i][j])) - throw new java.lang.Exception - ("SubMatrixSetExtractor::CompositeValue => Invalid Inputs"); - - dblCompositeValue += aadbl[i][j]; - } - } - - return dblCompositeValue; - } - - /** - * Generate the List of all the sub-matrices contained within a specified Square Matrix starting from the - * given Row and Column - * - * @param aadblMaster The Master Square Matrix - * @param iStartRow The Starting Row - * @param iStartColumn The Starting Column - * - * @return The List of all the sub-matrices - */ - - public static final java.util.List SquareSubMatrixList ( - final double[][] aadblMaster, - final int iStartRow, - final int iStartColumn) - { - if (null == aadblMaster) return null; - - int iMasterSize = aadblMaster.length; - int iMaxSubMatrixSize = iMasterSize - (iStartColumn > iStartRow ? iStartColumn : iStartRow); - - if (0 == iMasterSize || 0 == aadblMaster[0].length || 0 == iMaxSubMatrixSize) return null; - - java.util.List lsSubMatrix = new java.util.ArrayList(); - - for (int iSubMatrixSize = 1; iSubMatrixSize <= iMaxSubMatrixSize; ++iSubMatrixSize) { - double[][] aadblSubMatrix = new double[iSubMatrixSize][iSubMatrixSize]; - - for (int i = iStartRow; i < iStartRow + iSubMatrixSize; ++i) { - for (int j = iStartColumn; j < iStartColumn + iSubMatrixSize; ++j) - aadblSubMatrix[i - iStartRow][j - iStartColumn] = aadblMaster[i][j]; - } - - lsSubMatrix.add (aadblSubMatrix); - } - - return lsSubMatrix; - } - - /** - * Compute the Maximum Composite Value of all the sub-matrices contained within a specified Square Matrix - * starting from the given Row and Column - * - * @param aadblMaster The Master Square Matrix - * @param iStartRow The Starting Row - * @param iStartColumn The Starting Column - * - * @return The List of all the sub-matrices - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final double MaxCompositeSubMatrix ( - final double[][] aadblMaster, - final int iStartRow, - final int iStartColumn) - throws java.lang.Exception - { - java.util.List lsSubMatrix = SquareSubMatrixList (aadblMaster, iStartRow, iStartColumn); - - if (null == lsSubMatrix || 0 == lsSubMatrix.size()) - throw new java.lang.Exception ("SubMatrixSetExtractor::MaxCompositeSubMatrix => Invalid Inputs"); - - double dblMaxCompositeSubMatrix = java.lang.Double.NEGATIVE_INFINITY; - - for (double[][] aadblSubMatrix : lsSubMatrix) { - double dblCompositeSubMatrix = CompositeValue (aadblSubMatrix); - - if (dblMaxCompositeSubMatrix < dblCompositeSubMatrix) - dblMaxCompositeSubMatrix = dblCompositeSubMatrix; - } - - return dblMaxCompositeSubMatrix; - } - - /** - * Use the "Lean" Method to compute the Maximum Composite Value of all the sub-matrices contained within - * a specified Square Matrix starting from the given Row and Column - * - * @param aadblMaster The Master Square Matrix - * @param iStartRow The Starting Row - * @param iStartColumn The Starting Column - * - * @return The List of all the sub-matrices - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final double LeanMaxCompositeSubMatrix ( - final double[][] aadblMaster, - final int iStartRow, - final int iStartColumn) - throws java.lang.Exception - { - if (null == aadblMaster) - throw new java.lang.Exception - ("SubMatrixSetExtractor::LeanMaxCompositeSubMatrix => Invalid Inputs"); - - double dblCompositeSubMatrix = 0.; - int iMasterSize = aadblMaster.length; - double dblMaxCompositeSubMatrix = java.lang.Double.NEGATIVE_INFINITY; - int iMaxSubMatrixSize = iMasterSize - (iStartColumn > iStartRow ? iStartColumn : iStartRow); - - if (0 == iMasterSize || 0 == aadblMaster[0].length || 0 == iMaxSubMatrixSize) - throw new java.lang.Exception - ("SubMatrixSetExtractor::LeanMaxCompositeSubMatrix => Invalid Inputs"); - - for (int iSubMatrixSize = 1; iSubMatrixSize <= iMaxSubMatrixSize; ++iSubMatrixSize) { - for (int iRow = iStartRow; iRow < iStartRow + iSubMatrixSize - 2; ++iRow) - dblCompositeSubMatrix += aadblMaster[iRow][iStartColumn + iSubMatrixSize - 2]; - - for (int iColumn = iStartColumn; iColumn < iStartColumn + iSubMatrixSize - 2; ++iColumn) - dblCompositeSubMatrix += aadblMaster[iStartRow + iSubMatrixSize - 2][iColumn]; - - dblCompositeSubMatrix += - aadblMaster[iStartRow + iSubMatrixSize - 1][iStartColumn + iSubMatrixSize - 1]; - - if (dblMaxCompositeSubMatrix < dblCompositeSubMatrix) - dblMaxCompositeSubMatrix = dblCompositeSubMatrix; - } - - return dblMaxCompositeSubMatrix; - } -} diff --git a/org/drip/spaces/big/SubStringSetExtractor.java b/org/drip/spaces/big/SubStringSetExtractor.java deleted file mode 100644 index 980e183..0000000 --- a/org/drip/spaces/big/SubStringSetExtractor.java +++ /dev/null @@ -1,168 +0,0 @@ - -package org.drip.spaces.big; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * SubStringSetExtractor contains the Functionality to extract the Full Suite of the Sub-strings contained - * inside of the given String. - * - * @author Lakshmi Krishnamurthy - */ - -public class SubStringSetExtractor { - - /** - * Locate the String Set of the Target Size using a Receeding Permutation Scan - * - * @param strMaster The Master String - * @param iTargetStringSize The Target String Size - * - * @return The List of the Target String - */ - - public static final java.util.List ReceedingPermutationScan ( - final java.lang.String strMaster, - final int iTargetStringSize) - { - int[] aiMax = new int[iTargetStringSize]; - org.drip.spaces.iterator.RdExhaustiveStateSpaceScan mdIter = null; - - int iMasterStringSize = strMaster.length(); - - for (int i = 0; i < iTargetStringSize; ++i) - aiMax[i] = iMasterStringSize; - - try { - mdIter = new org.drip.spaces.iterator.RdExhaustiveStateSpaceScan (aiMax, false); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - java.util.List lsTarget = new java.util.ArrayList(); - - int[] aiIndex = mdIter.stateIndexCursor(); - - while (null != aiIndex) { - lsTarget.add (org.drip.spaces.iterator.IterationHelper.ComposeFromIndex (strMaster, aiIndex)); - - aiIndex = mdIter.nextStateIndexCursor(); - } - - return lsTarget; - } - - /** - * Locate the String Set of the Target Size using an Exhaustive Permutation Scan - * - * @param strMaster The Master String - * @param iTargetStringSize The Target String Size - * - * @return The List of the Target String - */ - - public static final java.util.List ExhaustivePermutationScan ( - final java.lang.String strMaster, - final int iTargetStringSize) - { - int[] aiMax = new int[iTargetStringSize]; - org.drip.spaces.iterator.RdExhaustiveStateSpaceScan mdIter = null; - - int iMasterStringSize = strMaster.length(); - - for (int i = 0; i < iTargetStringSize; ++i) - aiMax[i] = iMasterStringSize; - - try { - mdIter = new org.drip.spaces.iterator.RdExhaustiveStateSpaceScan (aiMax, false); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - java.util.List lsTarget = new java.util.ArrayList(); - - int[] aiIndex = mdIter.stateIndexCursor(); - - while (null != aiIndex) { - if (!org.drip.spaces.iterator.IterationHelper.CheckForRepeatingIndex (aiIndex)) - lsTarget.add (org.drip.spaces.iterator.IterationHelper.ComposeFromIndex (strMaster, - aiIndex)); - - aiIndex = mdIter.nextStateIndexCursor(); - } - - return lsTarget; - } - - /** - * Extract all the Contiguous Strings available inside the specified Master String - * - * @param strMaster The Master String - * - * @return The Full Set of Contiguous Strings - */ - - public static final java.util.List Contiguous ( - final java.lang.String strMaster) - { - if (null == strMaster) return null; - - int iMasterStringLength = strMaster.length(); - - java.util.List lsTarget = new java.util.ArrayList(); - - if (0 == iMasterStringLength) return lsTarget; - - for (int iStartIndex = 0; iStartIndex < iMasterStringLength; ++iStartIndex) { - for (int iFinishIndex = iStartIndex + 1; iFinishIndex <= iMasterStringLength; ++iFinishIndex) - lsTarget.add (strMaster.substring (iStartIndex, iFinishIndex)); - } - - return lsTarget; - } -} diff --git a/org/drip/spaces/cover/CarlStephaniNormedBounds.java b/org/drip/spaces/cover/CarlStephaniNormedBounds.java deleted file mode 100644 index f0c2479..0000000 --- a/org/drip/spaces/cover/CarlStephaniNormedBounds.java +++ /dev/null @@ -1,124 +0,0 @@ - -package org.drip.spaces.cover; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CarlStephaniNormedBounds contains the Normed Bounds that result from the Convolution Product of 2 Normed - * R^x To Normed R^x Function Spaces. - * - * The References are: - * - * 1) Carl, B. (1985): Inequalities of the Bernstein-Jackson type and the Degree of Compactness of Operators - * in Banach Spaces, Annals of the Fourier Institute 35 (3) 79-118. - * - * 2) Carl, B., and I. Stephani (1990): Entropy, Compactness, and the Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * 3) Williamson, R. C., A. J. Smola, and B. Scholkopf (2000): Entropy Numbers of Linear Function Classes, - * in: Proceedings of the 13th Annual Conference on Computational Learning Theory, ACM New York. - * - * @author Lakshmi Krishnamurthy - */ - -public class CarlStephaniNormedBounds { - private double _dblEntropyBoundNormA = java.lang.Double.NaN; - private double _dblEntropyBoundNormB = java.lang.Double.NaN; - - /** - * CarlStephaniNormedBounds Constructor - * - * @param dblEntropyBoundNormA The Entropy Bound using the Function Class Norm A - * @param dblEntropyBoundNormB The Entropy Bound using the Function Class Norm B - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CarlStephaniNormedBounds ( - final double dblEntropyBoundNormA, - final double dblEntropyBoundNormB) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblEntropyBoundNormA = dblEntropyBoundNormA) || - !org.drip.quant.common.NumberUtil.IsValid (_dblEntropyBoundNormB = dblEntropyBoundNormB)) - throw new java.lang.Exception ("CarlStephaniNormedBounds Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Entropy Bound using the Function Class Norm A - * - * @return The Entropy Bound using the Function Class Norm A - */ - - public double entropyBoundNormA() - { - return _dblEntropyBoundNormA; - } - - /** - * Retrieve the Entropy Bound using the Function Class Norm B - * - * @return The Entropy Bound using the Function Class Norm B - */ - - public double entropyBoundNormB() - { - return _dblEntropyBoundNormB; - } - - /** - * Retrieve the Minimum Upper Entropy Bound - * - * @return The Minimum Upper Entropy Bound - */ - - public double minimumUpperBound() - { - return _dblEntropyBoundNormA < _dblEntropyBoundNormB ? _dblEntropyBoundNormA : _dblEntropyBoundNormB; - } -} diff --git a/org/drip/spaces/cover/CarlStephaniProductBounds.java b/org/drip/spaces/cover/CarlStephaniProductBounds.java deleted file mode 100644 index f0e507f..0000000 --- a/org/drip/spaces/cover/CarlStephaniProductBounds.java +++ /dev/null @@ -1,334 +0,0 @@ - -package org.drip.spaces.cover; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CarlStephaniProductBounds implements the Bounds that result from the Convolution Product Product of 2 - * Normed R^x To Normed R^x Function Spaces. - * - * The References are: - * - * 1) Carl, B. (1985): Inequalities of the Bernstein-Jackson type and the Degree of Compactness of Operators - * in Banach Spaces, Annals of the Fourier Institute 35 (3) 79-118. - * - * 2) Carl, B., and I. Stephani (1990): Entropy, Compactness, and the Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * 3) Williamson, R. C., A. J. Smola, and B. Scholkopf (2000): Entropy Numbers of Linear Function Classes, - * in: Proceedings of the 13th Annual Conference on Computational Learning Theory, ACM New York. - * - * @author Lakshmi Krishnamurthy - */ - -public class CarlStephaniProductBounds { - private org.drip.spaces.functionclass.NormedRxToNormedRxFinite _funcClassRxRxA = null; - private org.drip.spaces.functionclass.NormedRxToNormedRxFinite _funcClassRxRxB = null; - - /** - * CarlStephaniProductBounds Constructor - * - * @param funcClassRxRxA Function Class A - * @param funcClassRxRxB Function Class B - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CarlStephaniProductBounds ( - final org.drip.spaces.functionclass.NormedRxToNormedRxFinite funcClassRxRxA, - final org.drip.spaces.functionclass.NormedRxToNormedRxFinite funcClassRxRxB) - throws java.lang.Exception - { - if (null == (_funcClassRxRxA = funcClassRxRxA) || null == (_funcClassRxRxB = funcClassRxRxB)) - throw new java.lang.Exception ("CarlStephaniProductBounds ctr: Invalid Inputs"); - } - - /** - * Retrieve the Function Class A - * - * @return The Function Class A - */ - - public org.drip.spaces.functionclass.NormedRxToNormedRxFinite funcClassA() - { - return _funcClassRxRxA; - } - - /** - * Retrieve the Function Class B - * - * @return The Function Class B - */ - - public org.drip.spaces.functionclass.NormedRxToNormedRxFinite funcClassB() - { - return _funcClassRxRxB; - } - - /** - * Compute the Upper Bound for the Entropy Number of the Operator Population Metric Covering Number - * Convolution Product Product across both the Function Classes - * - * @param iEntropyNumberIndexA Entropy Number Index for Class A - * @param iEntropyNumberIndexB Entropy Number Index for Class B - * - * @return The Upper Bound for the Entropy Number of the Operator Population Metric Covering Number - * Convolution Product Product across both the Function Classes - * - * @throws java.lang.Exception Thrown if the Convolution Product Product Population Metric Entropy Number cannot be - * Computed - */ - - public double populationMetricEntropyNumber ( - final int iEntropyNumberIndexA, - final int iEntropyNumberIndexB) - throws java.lang.Exception - { - return org.drip.spaces.cover.CoveringBoundsHelper.CarlStephaniProductBound - (_funcClassRxRxA.populationMetricCoveringBounds(), - _funcClassRxRxB.populationMetricCoveringBounds(), iEntropyNumberIndexA, - iEntropyNumberIndexB); - } - - /** - * Compute the Upper Bound for the Entropy Number of the Operator Population Supremum Covering Number - * Convolution Product across both the Function Classes - * - * @param iEntropyNumberIndexA Entropy Number Index for Class A - * @param iEntropyNumberIndexB Entropy Number Index for Class B - * - * @return The Upper Bound for the Entropy Number of the Operator Population Supremum Covering Number - * Convolution Product across both the Function Classes - * - * @throws java.lang.Exception Thrown if the Convolution Product Population Supremum Dyadic Entropy cannot be - * Computed - */ - - public double populationSupremumEntropyNumber ( - final int iEntropyNumberIndexA, - final int iEntropyNumberIndexB) - throws java.lang.Exception - { - return org.drip.spaces.cover.CoveringBoundsHelper.CarlStephaniProductBound - (_funcClassRxRxA.populationSupremumCoveringBounds(), - _funcClassRxRxB.populationSupremumCoveringBounds(), iEntropyNumberIndexA, - iEntropyNumberIndexB); - } - - /** - * Compute the Upper Bound for the Entropy Number of the Operator Sample Metric Covering Number - * Convolution Product across both the Function Classes - * - * @param gvviA The Validated Input Vector Space Instance for Class A - * @param gvviB The Validated Input Vector Space Instance for Class B - * @param iEntropyNumberIndexA Entropy Number Index for Class A - * @param iEntropyNumberIndexB Entropy Number Index for Class B - * - * @return The Upper Bound for the Entropy Number of the Operator Sample Metric Covering Number - * Convolution Product across both the Function Classes - * - * @throws java.lang.Exception Thrown if the Convolution Product Sample Metric Entropy Number cannot be - * Computed - */ - - public double sampleMetricEntropyNumber ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvviA, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviB, - final int iEntropyNumberIndexA, - final int iEntropyNumberIndexB) - throws java.lang.Exception - { - return org.drip.spaces.cover.CoveringBoundsHelper.CarlStephaniProductBound - (_funcClassRxRxA.sampleMetricCoveringBounds (gvviA), - _funcClassRxRxB.sampleMetricCoveringBounds (gvviB), iEntropyNumberIndexA, - iEntropyNumberIndexB); - } - - /** - * Compute the Upper Bound for the Entropy Number of the Operator Sample Supremum Covering Number - * Convolution Product across both the Function Classes - * - * @param gvviA The Validated Input Vector Space Instance for Class A - * @param gvviB The Validated Input Vector Space Instance for Class B - * @param iEntropyNumberIndexA Entropy Number Index for Class A - * @param iEntropyNumberIndexB Entropy Number Index for Class B - * - * @return The Upper Bound for the Entropy Number of the Operator Sample Supremum Covering Number - * Convolution Product across both the Function Classes - * - * @throws java.lang.Exception Thrown if the Convolution Product Sample Supremum Entropy Number cannot be - * Computed - */ - - public double sampleSupremumEntropyNumber ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvviA, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviB, - final int iEntropyNumberIndexA, - final int iEntropyNumberIndexB) - throws java.lang.Exception - { - return org.drip.spaces.cover.CoveringBoundsHelper.CarlStephaniProductBound - (_funcClassRxRxA.sampleSupremumCoveringBounds (gvviA), - _funcClassRxRxB.sampleSupremumCoveringBounds (gvviB), iEntropyNumberIndexA, - iEntropyNumberIndexB); - } - - /** - * Compute the Normed Upper Entropy Convolution Product Bound across the Function Classes - * - * @param mocbA The Maurey Operator Covering Bounds for Class A - * @param mocbB The Maurey Operator Covering Bounds for Class B - * @param iEntropyNumberIndex Entropy Number Index for either Class - * @param bUseSupremumNorm TRUE/FALSE - Use the Supremum/Metric Bound as the Operator Function Class - * - * @return The Normed Upper Entropy Convolution Product Bound across the Function Classes - */ - - public org.drip.spaces.cover.CarlStephaniNormedBounds normedEntropyUpperBound ( - final org.drip.spaces.cover.MaureyOperatorCoveringBounds mocbA, - final org.drip.spaces.cover.MaureyOperatorCoveringBounds mocbB, - final int iEntropyNumberIndex, - final boolean bUseSupremumNorm) - { - try { - return org.drip.spaces.cover.CoveringBoundsHelper.CarlStephaniProductNorm (mocbA, mocbB, - bUseSupremumNorm ? _funcClassRxRxA.operatorPopulationSupremumNorm() : - _funcClassRxRxA.operatorPopulationMetricNorm(), bUseSupremumNorm ? - _funcClassRxRxB.operatorPopulationSupremumNorm() : - _funcClassRxRxB.operatorPopulationMetricNorm(), iEntropyNumberIndex); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Population Supremum Carl-Stephani Entropy Number Upper Bound using either the - * Metric/Supremum Population Norm - * - * @param iEntropyNumberIndex Entropy Number Index for either Class - * @param bUseSupremumNorm TRUE/FALSE - Use the Supremum/Metric Bound as the Operator Function Class - * - * @return The Population Supremum Carl-Stephani Entropy Number Upper Bound using either the - * Metric/Supremum Population Norm - */ - - public org.drip.spaces.cover.CarlStephaniNormedBounds populationSupremumEntropyNorm ( - final int iEntropyNumberIndex, - final boolean bUseSupremumNorm) - { - return normedEntropyUpperBound (_funcClassRxRxA.populationSupremumCoveringBounds(), - _funcClassRxRxB.populationSupremumCoveringBounds(), iEntropyNumberIndex, bUseSupremumNorm); - } - - /** - * Compute the Population Metric Carl-Stephani Entropy Number Upper Bound using either the - * Metric/Supremum Population Norm - * - * @param iEntropyNumberIndex Entropy Number Index for either Class - * @param bUseSupremumNorm TRUE/FALSE - Use the Supremum/Metric Bound as the Operator Function Class - * - * @return The Population Metric Carl-Stephani Entropy Number Upper Bound using either the - * Metric/Supremum Population Norm - */ - - public org.drip.spaces.cover.CarlStephaniNormedBounds populationMetricEntropyNorm ( - final int iEntropyNumberIndex, - final boolean bUseSupremumNorm) - { - return normedEntropyUpperBound (_funcClassRxRxA.populationMetricCoveringBounds(), - _funcClassRxRxB.populationMetricCoveringBounds(), iEntropyNumberIndex, bUseSupremumNorm); - } - - /** - * Compute the Sample Supremum Carl-Stephani Entropy Number Upper Bound using either the Metric/Supremum - * Population Norm - * - * @param gvviA The Validated Input Vector Space Instance for Class A - * @param gvviB The Validated Input Vector Space Instance for Class B - * @param iEntropyNumberIndex Entropy Number Index for either Class - * @param bUseSupremumNorm TRUE/FALSE - Use the Supremum/Metric Bound as the Operator Function Class - * - * @return The Sample Supremum Carl-Stephani Entropy Number Upper Bound using either the Metric/Supremum - * Population Norm - */ - - public org.drip.spaces.cover.CarlStephaniNormedBounds sampleSupremumEntropyNorm ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvviA, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviB, - final int iEntropyNumberIndex, - final boolean bUseSupremumNorm) - { - return normedEntropyUpperBound (_funcClassRxRxA.sampleSupremumCoveringBounds (gvviA), - _funcClassRxRxB.sampleSupremumCoveringBounds (gvviB), iEntropyNumberIndex, bUseSupremumNorm); - } - - /** - * Compute the Sample Metric Carl-Stephani Entropy Number Upper Bound using either the Metric/Supremum - * Population Norm - * - * @param gvviA The Validated Input Vector Space Instance for Class A - * @param gvviB The Validated Input Vector Space Instance for Class B - * @param iEntropyNumberIndex Entropy Number Index for either Class - * @param bUseSupremumNorm TRUE/FALSE - Use the Supremum/Metric Bound as the Operator Function Class - * - * @return The Sample Metric Carl-Stephani Entropy Number Upper Bound using either the Metric/Supremum - * Population Norm - */ - - public org.drip.spaces.cover.CarlStephaniNormedBounds sampleMetricEntropyNorm ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvviA, - final org.drip.spaces.instance.GeneralizedValidatedVector gvviB, - final int iEntropyNumberIndex, - final boolean bUseSupremumNorm) - { - return normedEntropyUpperBound (_funcClassRxRxA.sampleMetricCoveringBounds (gvviA), - _funcClassRxRxB.sampleMetricCoveringBounds (gvviB), iEntropyNumberIndex, bUseSupremumNorm); - } -} diff --git a/org/drip/spaces/cover/CoveringBoundsHelper.java b/org/drip/spaces/cover/CoveringBoundsHelper.java deleted file mode 100644 index 201ef11..0000000 --- a/org/drip/spaces/cover/CoveringBoundsHelper.java +++ /dev/null @@ -1,154 +0,0 @@ - -package org.drip.spaces.cover; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CoveringBoundsHelper contains the assortment of Utilities used in the Computation of Upper Bounds for - * Normed Single Function Spaces and Function Space Products. - * - * The References are: - * - * 1) Carl, B. (1985): Inequalities of the Bernstein-Jackson type and the Degree of Compactness of Operators - * in Banach Spaces, Annals of the Fourier Institute 35 (3) 79-118. - * - * 2) Carl, B., and I. Stephani (1990): Entropy, Compactness, and the Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * 3) Williamson, R. C., A. J. Smola, and B. Scholkopf (2000): Entropy Numbers of Linear Function Classes, - * in: Proceedings of the 13th Annual Conference on Computational Learning Theory, ACM New York. - * - * @author Lakshmi Krishnamurthy - */ - -public class CoveringBoundsHelper { - - /** - * Compute the Dyadic Entropy Number from the nth Entropy Number - * - * @param dblLogNEntropyNumber Log of the nth Entropy Number - * - * @return The Dyadic Entropy Number - * - * @throws java.lang.Exception Thrown if the Dyadic Entropy Number cannot be calculated - */ - - public static final double DyadicEntropyNumber ( - final double dblLogNEntropyNumber) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblLogNEntropyNumber)) - throw new java.lang.Exception ("CoveringBoundsHelper::DyadicEntropyNumber => Invalid Inputs"); - - return 1. + (dblLogNEntropyNumber / java.lang.Math.log (2.)); - } - - /** - * Compute the Upper Bound for the Entropy Number of the Operator Custom Covering Number Metric Product - * across both the Function Classes - * - * @param mocbA The Maurey Operator Covering Bounds for Class A - * @param mocbB The Maurey Operator Covering Bounds for Class B - * @param iEntropyNumberIndexA Entropy Number Index for Class A - * @param iEntropyNumberIndexB Entropy Number Index for Class B - * - * @return The Upper Bound for the Entropy Number of the Operator Custom Covering Number Metric Product - * across both the Function Classes - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public static final double CarlStephaniProductBound ( - final org.drip.spaces.cover.MaureyOperatorCoveringBounds mocbA, - final org.drip.spaces.cover.MaureyOperatorCoveringBounds mocbB, - final int iEntropyNumberIndexA, - final int iEntropyNumberIndexB) - throws java.lang.Exception - { - if (null == mocbA || null == mocbB) - throw new java.lang.Exception - ("CoveringBoundsHelper::CarlStephaniProductBound => Invalid Maurey Bounds for the Function Class"); - - return mocbA.entropyNumberUpperBound (iEntropyNumberIndexA) * mocbB.entropyNumberUpperBound - (iEntropyNumberIndexB); - } - - /** - * Compute the Upper Bound for the Entropy Number of the Operator Custom Covering Number Metric Product - * across both the Function Classes using the Function Class Norm - * - * @param mocbA The Maurey Operator Covering Bounds for Class A - * @param mocbB The Maurey Operator Covering Bounds for Class B - * @param dblNormA The Function Class A Norm - * @param dblNormB The Function Class B Norm - * @param iEntropyNumberIndex Entropy Number Index for either Class - * - * @return The Upper Bound for the Entropy Number of the Operator Custom Covering Number Metric - * Product across both the Function Classes using the Function Norm - */ - - public static final org.drip.spaces.cover.CarlStephaniNormedBounds CarlStephaniProductNorm ( - final org.drip.spaces.cover.MaureyOperatorCoveringBounds mocbA, - final org.drip.spaces.cover.MaureyOperatorCoveringBounds mocbB, - final double dblNormA, - final double dblNormB, - final int iEntropyNumberIndex) - { - if (null == mocbA || null == mocbB) return null; - - try { - return new org.drip.spaces.cover.CarlStephaniNormedBounds (mocbA.entropyNumberUpperBound - (iEntropyNumberIndex) * dblNormB, mocbB.entropyNumberUpperBound (iEntropyNumberIndex) * - dblNormA); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/spaces/cover/FunctionClassCoveringBounds.java b/org/drip/spaces/cover/FunctionClassCoveringBounds.java deleted file mode 100644 index d6fa4c2..0000000 --- a/org/drip/spaces/cover/FunctionClassCoveringBounds.java +++ /dev/null @@ -1,93 +0,0 @@ - -package org.drip.spaces.cover; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FunctionClassCoveringBounds implements the estimate Lower/Upper Bounds and/or Absolute Values of the - * Covering Number for the Function Class. The Main References are: - * - * 1) Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * 2) Bartlett, P. L., S. R. Kulkarni, and S. E. Posner (1997): Covering Numbers for Real-valued Function - * Classes, IEEE Transactions on Information Theory 43 (5) 1721-1724. - * - * @author Lakshmi Krishnamurthy - */ - -public interface FunctionClassCoveringBounds { - - /** - * Log of the Lower Bound of the Function Covering Number - * - * @param dblCover The Size of the Cover - * - * @return Log of the Lower Bound of the Function Covering Number - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public abstract double logLowerBound ( - final double dblCover) - throws java.lang.Exception; - - /** - * Log of the Upper Bound of the Function Covering Number - * - * @param dblCover The Size of the Cover - * - * @return Log of the Upper Bound of the Function Covering Number - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public abstract double logUpperBound ( - final double dblCover) - throws java.lang.Exception; -} diff --git a/org/drip/spaces/cover/L1R1CoveringBounds.java b/org/drip/spaces/cover/L1R1CoveringBounds.java deleted file mode 100644 index b85cefc..0000000 --- a/org/drip/spaces/cover/L1R1CoveringBounds.java +++ /dev/null @@ -1,167 +0,0 @@ - -package org.drip.spaces.cover; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * L1R1CoveringBounds implements the Lower/Upper Bounds for the Class of Non-decreasing R^1 To L1 R^1 - * Functions that are: - * - Absolutely Bounded - * - Have Bounded Variation. - * - * The References are: - * - * 1) L. Birge (1987): Estimating a Density Under Order Restrictions: Non-asymptotic Minimax Risk, Annals of - * Statistics 15 995-1012. - * - * 2) P. L. Bartlett, S. R. Kulkarni, and S. E. Posner (1997): Covering Numbers for Real-valued Function - * Classes, IEEE Transactions on Information Theory 43 (5) 1721-1724. - * - * @author Lakshmi Krishnamurthy - */ - -public class L1R1CoveringBounds implements org.drip.spaces.cover.FunctionClassCoveringBounds { - private double _dblBound = java.lang.Double.NaN; - private double _dblSupport = java.lang.Double.NaN; - private double _dblVariation = java.lang.Double.NaN; - - /** - * L1R1CoveringBounds Constructor - * - * @param dblSupport The Ordinate Support - * @param dblVariation The Function Variation - * @param dblBound The Function Bound - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public L1R1CoveringBounds ( - final double dblSupport, - final double dblVariation, - final double dblBound) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblSupport = dblSupport) || 0. >= _dblSupport || - !org.drip.quant.common.NumberUtil.IsValid (_dblVariation = dblVariation) || 0. >= _dblVariation) - throw new java.lang.Exception ("L1R1CoveringBounds ctr: Invalid Inputs"); - - if (org.drip.quant.common.NumberUtil.IsValid (_dblBound = dblBound) && _dblBound <= 0.5 * - _dblVariation) - throw new java.lang.Exception ("L1R1CoveringBounds ctr: Invalid Inputs"); - } - - /** - * Retrieve the Ordinate Support - * - * @return The Ordinate Support - */ - - public double support() - { - return _dblSupport; - } - - /** - * Retrieve the Function Variation - * - * @return The Function Variation - */ - - public double variation() - { - return _dblVariation; - } - - /** - * Retrieve the Function Bound - * - * @return The Function Bound - */ - - public double bound() - { - return _dblBound; - } - - @Override public double logLowerBound ( - final double dblCover) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCover) || 0. == dblCover) - throw new java.lang.Exception ("L1R1CoveringBounds::logLowerBound => Invalid Inputs"); - - double dblVariationCoverScale = dblCover / (_dblSupport * _dblVariation); - double dblVariationLogLowerBound = 1. / (54. * dblVariationCoverScale); - - if (1. < 12. * dblVariationCoverScale) - throw new java.lang.Exception ("L1R1CoveringBounds::logLowerBound => Invalid Inputs"); - - return !org.drip.quant.common.NumberUtil.IsValid (_dblBound) ? dblVariationLogLowerBound : 1. + - dblVariationLogLowerBound * java.lang.Math.log (2.) + java.lang.Math.log (_dblSupport * _dblBound - / (6. * dblCover)); - } - - @Override public double logUpperBound ( - final double dblCover) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCover)) - throw new java.lang.Exception ("L1R1CoveringBounds::logUpperBound => Invalid Inputs"); - - double dblVariationCoverScale = dblCover / (_dblSupport * _dblVariation); - - if (1. < 12. * dblVariationCoverScale) - throw new java.lang.Exception ("L1R1CoveringBounds::logUpperBound => Invalid Inputs"); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblBound)) - return java.lang.Math.log (2.) * 12. / dblVariationCoverScale; - - return java.lang.Math.log (2.) * 18. / dblVariationCoverScale + 3. * _dblSupport * (2. * _dblBound - - _dblVariation) / (8. * dblCover); - } -} diff --git a/org/drip/spaces/cover/MaureyOperatorCoveringBounds.java b/org/drip/spaces/cover/MaureyOperatorCoveringBounds.java deleted file mode 100644 index 6506005..0000000 --- a/org/drip/spaces/cover/MaureyOperatorCoveringBounds.java +++ /dev/null @@ -1,214 +0,0 @@ - -package org.drip.spaces.cover; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * - * This file is part of DRIP, a free-software/open-source library for fixed income analysts and developers - - * http://www.credit-trader.org/Begin.html - * - * DRIP is a free, full featured, fixed income rates, credit, and FX analytics library with a focus towards - * pricing/valuation, risk, and market making. - * - * 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. - */ - -/** - * MaureyOperatorCoveringBounds implements the estimate the Upper Bounds and/or Absolute Values of the - * Covering Number for the Hilbert R^d To Supremum R^d Operator Class. The Main References are: - * - * 1) Carl, B. (1985): Inequalities of the Bernstein-Jackson type and the Degree of Compactness of Operators - * in Banach Spaces, Annals of the Fourier Institute 35 (3) 79-118. - * - * 2) Carl, B., and I. Stephani (1990): Entropy, Compactness, and the Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * 3) Williamson, R. C., A. J. Smola, and B. Scholkopf (2000): Entropy Numbers of Linear Function Classes, - * in: Proceedings of the 13th Annual Conference on Computational Learning Theory, ACM New York. - * - * @author Lakshmi Krishnamurthy - */ - -public class MaureyOperatorCoveringBounds { - - /** - * Maurey Constant - from the Hilbert - Supremum Identity Map Estimate - */ - - public static final double HILBERT_SUPREMUM_IDENTITY_CONSTANT = 1.86; - - /** - * Maurey Constant - from the Williamson-Smola-Scholkopf Estimate - */ - - public static final double WILLIAMSON_SMOLA_SCHOLKOPF_CONSTANT = 103.; - - private int _iSupremumDimension = -1; - private double _dblOperatorNorm = java.lang.Double.NaN; - private double _dblMaureyConstant = java.lang.Double.NaN; - - /** - * Construct an Instance Hilbert To Supremum Identity Map based Maurey Operator Covering Bounds - * - * @param iSupremumDimension The Operator Supremum Output Space Dimension - * @param dblOperatorNorm The Operator Norm of Interest - * - * @return The Instance Hilbert To Supremum Identity Map based Maurey Operator Covering Bounds - */ - - public static final MaureyOperatorCoveringBounds HilbertSupremumIdentityMap ( - final int iSupremumDimension, - final double dblOperatorNorm) - { - try { - return new MaureyOperatorCoveringBounds (HILBERT_SUPREMUM_IDENTITY_CONSTANT, - iSupremumDimension, dblOperatorNorm); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an Instance of the Maurey Operator Covering Bounds based upon the Williamson, Smola, and - * Scholkopf Estimate - * - * @param iSupremumDimension The Operator Supremum Output Space Dimension - * @param dblOperatorNorm The Operator Norm of Interest - * - * @return Maurey Operator Covering Bounds based upon the Williamson, Smola, and Scholkopf Estimate - */ - - public static final MaureyOperatorCoveringBounds WilliamsonSmolaScholkopfEstimate ( - final int iSupremumDimension, - final double dblOperatorNorm) - { - try { - return new MaureyOperatorCoveringBounds (WILLIAMSON_SMOLA_SCHOLKOPF_CONSTANT, - iSupremumDimension, dblOperatorNorm); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * MaureyOperatorCoveringBounds Constructor - * - * @param dblMaureyConstant The Maurey Constant - * @param iSupremumDimension The Operator Supremum Output Space Dimension - * @param dblOperatorNorm The Operator Norm of Interest - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public MaureyOperatorCoveringBounds ( - final double dblMaureyConstant, - final int iSupremumDimension, - final double dblOperatorNorm) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblMaureyConstant = dblMaureyConstant) || 0 >= - (_iSupremumDimension = iSupremumDimension) || !org.drip.quant.common.NumberUtil.IsValid - (_dblOperatorNorm = dblOperatorNorm)) - throw new java.lang.Exception ("MaureyOperatorCoveringBounds ctr => Invalid Inputs"); - } - - /** - * Retrieve the Maurey Constant - * - * @return The Maurey Constant - */ - - public double maureyConstant() - { - return _dblMaureyConstant; - } - - /** - * Retrieve the Supremum Dimension - * - * @return The Supremum Dimension - */ - - public int supremumDimension() - { - return _iSupremumDimension; - } - - /** - * Retrieve the Operator Norm of Interest - * - * @return The Operator Norm of Interest - */ - - public double operatorNorm() - { - return _dblOperatorNorm; - } - - /** - * Compute the Upper Bound for the Dyadic Entropy Number - * - * @param iEntropyNumberIndex The Entropy Number Index - * - * @return The Upper Bound for the DyadicEntropy Number - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double dyadicEntropyUpperBound ( - final int iEntropyNumberIndex) - throws java.lang.Exception - { - if (0 >= iEntropyNumberIndex) - throw new java.lang.Exception - ("MaureyOperatorCoveringBounds::dyadicEntropyUpperBound => Invalid Inputs"); - - return _dblMaureyConstant * _dblOperatorNorm * java.lang.Math.sqrt ((java.lang.Math.log (1. + - (((double) _iSupremumDimension) / ((double) iEntropyNumberIndex))) / iEntropyNumberIndex)); - } - - /** - * Compute the Upper Bound for the Entropy Number - * - * @param iEntropyNumberIndex The Entropy Number Index - * - * @return The Upper Bound for the Entropy Number - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double entropyNumberUpperBound ( - final int iEntropyNumberIndex) - throws java.lang.Exception - { - if (0 >= iEntropyNumberIndex) - throw new java.lang.Exception - ("MaureyOperatorCoveringBounds::entropyNumberUpperBound => Invalid Inputs"); - - double dblLogNPlus1 = 1. + java.lang.Math.log (iEntropyNumberIndex); - - return _dblMaureyConstant * _dblOperatorNorm * java.lang.Math.sqrt ((1. + (((double) - _iSupremumDimension) / dblLogNPlus1)) / dblLogNPlus1); - } -} diff --git a/org/drip/spaces/cover/OperatorClassCoveringBounds.java b/org/drip/spaces/cover/OperatorClassCoveringBounds.java deleted file mode 100644 index 87c36d8..0000000 --- a/org/drip/spaces/cover/OperatorClassCoveringBounds.java +++ /dev/null @@ -1,116 +0,0 @@ - -package org.drip.spaces.cover; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * OperatorClassCoveringBounds implements the estimate Lower/Upper Bounds and/or Absolute Values of the - * Covering Number for the Operator Class. The Main References are: - * - * 1) Guo, Y., P. L. Bartlett, J. Shawe-Taylor, and R. C. Williamson (1999): Covering Numbers for Support - * Vector Machines, in: Proceedings of the 12th Annual Conference of Computational Learning Theory, ACM, - * New York, 267-277. - * - * @author Lakshmi Krishnamurthy - */ - -/** - * @author Spooky - * - */ -public interface OperatorClassCoveringBounds { - - /** - * Lower Bound of the Operator Entropy Number - * - * @return Lower Bound of the Operator Entropy Number - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public abstract double entropyNumberLowerBound() - throws java.lang.Exception; - - /** - * Upper Bound of the Operator Entropy Number - * - * @return Upper Bound of the Operator Entropy Number - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public abstract double entropyNumberUpperBound() - throws java.lang.Exception; - - /** - * Compute the Entropy Number Index of the Operator - * - * @return The Entropy Number Index of the Operator - */ - - public abstract int entropyNumberIndex(); - - /** - * Compute the Metric Norm of the Operator - * - * @return The Metric Norm of the Operator - * - * @throws java.lang.Exception Thrown if the Metric Norm cannot be computed - */ - - public abstract double norm() - throws java.lang.Exception; - - /** - * Compute the Entropy Number Asymptotic Behavior - * - * @return the Entropy Number Asymptote Instance - */ - - public abstract org.drip.learning.bound.DiagonalOperatorCoveringBound entropyNumberAsymptote(); -} diff --git a/org/drip/spaces/cover/ScaleSensitiveCoveringBounds.java b/org/drip/spaces/cover/ScaleSensitiveCoveringBounds.java deleted file mode 100644 index 823a7a8..0000000 --- a/org/drip/spaces/cover/ScaleSensitiveCoveringBounds.java +++ /dev/null @@ -1,213 +0,0 @@ - -package org.drip.spaces.cover; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ScaleSensitiveCoveringBounds implements the Lower/Upper Bounds for the General Class of Functions in terms - * of their scale-sensitive dimensions (i.e., the fat shattering coefficients). - * - * The References are: - * - * 1) D. Pollard (1984): Convergence of Stochastic Processes, Springer, New York. - * - * 2) N. Alon, S. Ben-David, N. Cesa-Bianchi, and D. Haussler (1993): Scale-sensitive Dimensions, Uniform- - * Convergence, and Learnability, Proceedings of the ACM Symposium on the Foundations of Computer - * Science. - * - * 3) P. L. Bartlett, S. R. Kulkarni, and S. E. Posner (1997): Covering Numbers for Real-valued Function - * Classes, IEEE Transactions on Information Theory 43 (5) 1721-1724. - * - * @author Lakshmi Krishnamurthy - */ - -public class ScaleSensitiveCoveringBounds implements org.drip.spaces.cover.FunctionClassCoveringBounds { - private int _iSampleSize = -1; - private org.drip.function.definition.R1ToR1 _r1r1FatShatter = null; - - /** - * ScaleSensitiveCoveringBounds Constructor - * - * @param r1r1FatShatter The Cover Fat Shattering Coefficient Function - * @param iSampleSize Sample Size - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ScaleSensitiveCoveringBounds ( - final org.drip.function.definition.R1ToR1 r1r1FatShatter, - final int iSampleSize) - throws java.lang.Exception - { - if (null == (_r1r1FatShatter = r1r1FatShatter) || 0 >= (_iSampleSize = iSampleSize)) - throw new java.lang.Exception ("ScaleSensitiveCoveringBounds ctr: Invalid Inputs"); - } - - /** - * Retrieve the Fat Shattering Coefficient Function - * - * @return The Fat Shattering Coefficient Function - */ - - public org.drip.function.definition.R1ToR1 fatShatteringFunction() - { - return _r1r1FatShatter; - } - - /** - * Retrieve the Sample Size - * - * @return The Sample Size - */ - - public int sampleSize() - { - return _iSampleSize; - } - - /** - * Compute the Minimum Sample Size required to Estimate the Cardinality corresponding to the Specified - * Cover - * - * @param dblCover The Cover - * - * @return The Minimum Sample Size - * - * @throws java.lang.Exception Thrown if the Minimum Sample Size Cannot be computed - */ - - public double sampleSizeLowerBound ( - final double dblCover) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCover) || 0. == dblCover) - throw new java.lang.Exception - ("ScaleSensitiveCoveringBounds::sampleSizeLowerBound => Invalid Inputs"); - - double dblLog2 = java.lang.Math.log (2.); - - return 2. * _r1r1FatShatter.evaluate (0.25 * dblCover) * java.lang.Math.log (64. * java.lang.Math.E * - java.lang.Math.E / (dblCover * dblLog2)) / dblLog2; - } - - /** - * Compute the Cardinality for the Subset T (|x) that possesses the Specified Cover for the Restriction - * of the Input Function Class Family F (|x). - * - * @param dblCover The Specified Cover - * - * @return The Restricted Subset Cardinality - * - * @throws java.lang.Exception Thrown if the Restricted Subset Cardinality cannot be computed - */ - - public double restrictedSubsetCardinality ( - final double dblCover) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCover) || 0. == dblCover) - throw new java.lang.Exception - ("ScaleSensitiveCoveringBounds::restrictedSubsetCardinality => Invalid Inputs"); - - double dblLog2 = java.lang.Math.log (2.); - - double dblFatShatteringCoefficient = _r1r1FatShatter.evaluate (0.25 * dblCover); - - if (_iSampleSize < 2. * dblFatShatteringCoefficient * java.lang.Math.log (64. * java.lang.Math.E * - java.lang.Math.E / (dblCover * dblLog2)) / dblLog2) - throw new java.lang.Exception - ("ScaleSensitiveCoveringBounds::restrictedSubsetCardinality => Invalid Inputs"); - - return 6. * dblFatShatteringCoefficient * java.lang.Math.log (16. / dblCover) * java.lang.Math.log - (32. * java.lang.Math.E * _iSampleSize / (dblFatShatteringCoefficient * dblCover)) / dblLog2 + - dblLog2; - } - - /** - * Compute the Log of the Weight Loading Coefficient for the Maximum Cover Term in: - * - * {Probability that the Empirical Error .gt. Cover} .lte. 4 * exp (-m * Cover^2 / 128) * - * [[Max Covering Number Over the Specified Sample]] - * - * Reference is: - * - * - D. Haussler (1995): Sphere Packing Numbers for Subsets of the Boolean n-Cube with Bounded - * Vapnik-Chervonenkis Dimension, Journal of the COmbinatorial Theory A 69 (2) 217. - * - * @param dblCover The Specified Cover - * - * @return Log of the Weight Loading Coefficient for the Maximum Cover Term - * - * @throws java.lang.Exception Thrown if the Log of the Weight Loading Coefficient cannot be computed - */ - - public double upperProbabilityBoundWeight ( - final double dblCover) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCover) || 0. == dblCover) - throw new java.lang.Exception - ("ScaleSensitiveCoveringBounds::upperProbabilityBoundWeight => Invalid Inputs"); - - return java.lang.Math.log (4.) - (dblCover * dblCover * _iSampleSize / 128.); - } - - @Override public double logLowerBound ( - final double dblCover) - throws java.lang.Exception - { - return restrictedSubsetCardinality (dblCover); - } - - @Override public double logUpperBound ( - final double dblCover) - throws java.lang.Exception - { - return _r1r1FatShatter.evaluate (4. * dblCover) / 32.; - } -} diff --git a/org/drip/spaces/functionclass/HilbertRxToSupremumRdFinite.java b/org/drip/spaces/functionclass/HilbertRxToSupremumRdFinite.java deleted file mode 100644 index db3d3d5..0000000 --- a/org/drip/spaces/functionclass/HilbertRxToSupremumRdFinite.java +++ /dev/null @@ -1,91 +0,0 @@ - -package org.drip.spaces.functionclass; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * HilbertRxToSupremumRdFinite implements the Class F with f E f : Hilbert R^x To Supremum R^d Space of - * Finite Functions. - * - * The References are: - * - * 1) Carl, B. (1985): Inequalities of the Bernstein-Jackson type and the Degree of Compactness of Operators - * in Banach Spaces, Annals of the Fourier Institute 35 (3) 79-118. - * - * 2) Carl, B., and I. Stephani (1990): Entropy, Compactness, and the Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * 3) Williamson, R. C., A. J. Smola, and B. Scholkopf (2000): Entropy Numbers of Linear Function Classes, - * in: Proceedings of the 13th Annual Conference on Computational Learning Theory, ACM New York. - * - * @author Lakshmi Krishnamurthy - */ - -public class HilbertRxToSupremumRdFinite extends org.drip.spaces.functionclass.NormedRxToNormedRdFinite { - - /** - * HilbertRxToSupremumRdFinite Constructor - * - * @param dblMaureyConstant Maurey Constant - * @param aHilbertRxToSupremumRd Array of the Hilbert R^x To Supremum R^d Spaces - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public HilbertRxToSupremumRdFinite ( - final double dblMaureyConstant, - final org.drip.spaces.rxtord.NormedRxToNormedRd[] aHilbertRxToSupremumRd) - throws java.lang.Exception - { - super (dblMaureyConstant, aHilbertRxToSupremumRd); - - if (2 != aHilbertRxToSupremumRd[0].inputMetricVectorSpace().pNorm() || java.lang.Integer.MAX_VALUE != - aHilbertRxToSupremumRd[0].outputMetricVectorSpace().pNorm()) - throw new java.lang.Exception ("HilbertRxToSupremumRdFinite ctr: Invalid Inputs"); - } -} diff --git a/org/drip/spaces/functionclass/NormedR1ToL1R1Finite.java b/org/drip/spaces/functionclass/NormedR1ToL1R1Finite.java deleted file mode 100644 index bca5616..0000000 --- a/org/drip/spaces/functionclass/NormedR1ToL1R1Finite.java +++ /dev/null @@ -1,185 +0,0 @@ - -package org.drip.spaces.functionclass; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * NormedR1ToL1R1Finite implements the Class f E F : Normed R^1 To L1 R^1 Spaces of Finite Functions. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class NormedR1ToL1R1Finite extends org.drip.spaces.functionclass.NormedR1ToNormedR1Finite { - - /** - * Create Bounded R^1 To Bounded L1 R^1 Function Class for the specified Bounded Class of Finite - * Functions - * - * @param dblMaureyConstant Maurey Constant - * @param aR1ToR1 The Bounded R^1 To Bounded R^1 Function Set - * @param dblPredictorSupport The Set Predictor Support - * @param dblResponseBound The Set Response Bound - * - * @return The Bounded R^1 To Bounded R^1 Function Class for the specified Function Set - */ - - public static final NormedR1ToL1R1Finite BoundedPredictorBoundedResponse ( - final double dblMaureyConstant, - final org.drip.function.definition.R1ToR1[] aR1ToR1, - final double dblPredictorSupport, - final double dblResponseBound) - { - if (null == aR1ToR1) return null; - - int iNumFunction = aR1ToR1.length; - org.drip.spaces.rxtor1.NormedR1ToNormedR1[] aR1ToR1FunctionSpace = new - org.drip.spaces.rxtor1.NormedR1ToNormedR1[iNumFunction]; - - if (0 == iNumFunction) return null; - - try { - org.drip.spaces.metric.R1Continuous r1ContinuousInput = new org.drip.spaces.metric.R1Continuous - (-0.5 * dblPredictorSupport, 0.5 * dblPredictorSupport, null, 1); - - org.drip.spaces.metric.R1Continuous r1ContinuousOutput = new org.drip.spaces.metric.R1Continuous - (-0.5 * dblResponseBound, 0.5 * dblResponseBound, null, 1); - - for (int i = 0; i < iNumFunction; ++i) - aR1ToR1FunctionSpace[i] = new org.drip.spaces.rxtor1.NormedR1ContinuousToR1Continuous - (r1ContinuousInput, r1ContinuousOutput, aR1ToR1[i]); - - return new NormedR1ToL1R1Finite (dblMaureyConstant, aR1ToR1FunctionSpace); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - protected NormedR1ToL1R1Finite ( - final double dblMaureyConstant, - final org.drip.spaces.rxtor1.NormedR1ToNormedR1[] aR1ToR1FunctionSpace) - throws java.lang.Exception - { - super (dblMaureyConstant, aR1ToR1FunctionSpace); - } - - @Override public org.drip.spaces.cover.FunctionClassCoveringBounds agnosticCoveringNumberBounds() - { - org.drip.spaces.rxtor1.NormedR1ToNormedR1[] aNormedR1ToNormedR1 = - (org.drip.spaces.rxtor1.NormedR1ToNormedR1[]) functionSpaces(); - - int iNumFunction = aNormedR1ToNormedR1.length; - double dblResponseLowerBound = java.lang.Double.NaN; - double dblResponseUpperBound = java.lang.Double.NaN; - double dblPredictorLowerBound = java.lang.Double.NaN; - double dblPredictorUpperBound = java.lang.Double.NaN; - - for (int i = 0; i < iNumFunction; ++i) { - org.drip.spaces.rxtor1.NormedR1ToNormedR1 r1Tor1 = aNormedR1ToNormedR1[i]; - - org.drip.spaces.metric.R1Normed runsInput = r1Tor1.inputMetricVectorSpace(); - - org.drip.spaces.metric.R1Normed runsOutput = r1Tor1.outputMetricVectorSpace(); - - if (!runsInput.isPredictorBounded() || !runsOutput.isPredictorBounded()) return null; - - double dblResponseLeftBound = runsOutput.leftEdge(); - - double dblPredictorLeftBound = runsInput.leftEdge(); - - double dblResponseRightBound = runsOutput.rightEdge(); - - double dblPredictorRightBound = runsInput.rightEdge(); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorLowerBound)) - dblPredictorLowerBound = dblPredictorLeftBound; - else { - if (dblPredictorLowerBound > dblPredictorLeftBound) - dblPredictorLowerBound = dblPredictorLeftBound; - } - - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorUpperBound)) - dblPredictorUpperBound = dblPredictorRightBound; - else { - if (dblPredictorUpperBound < dblPredictorRightBound) - dblPredictorUpperBound = dblPredictorRightBound; - } - - if (!org.drip.quant.common.NumberUtil.IsValid (dblResponseLowerBound)) - dblResponseLowerBound = dblResponseLeftBound; - else { - if (dblResponseLowerBound > dblResponseLeftBound) - dblResponseLowerBound = dblResponseLeftBound; - } - - if (!org.drip.quant.common.NumberUtil.IsValid (dblResponseUpperBound)) - dblResponseUpperBound = dblResponseRightBound; - else { - if (dblResponseUpperBound < dblResponseRightBound) - dblResponseUpperBound = dblResponseRightBound; - } - } - - double dblVariation = dblResponseUpperBound - dblResponseLowerBound; - - try { - return new org.drip.spaces.cover.L1R1CoveringBounds (dblPredictorUpperBound - - dblPredictorLowerBound, dblVariation, dblVariation); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/spaces/functionclass/NormedR1ToNormedR1Finite.java b/org/drip/spaces/functionclass/NormedR1ToNormedR1Finite.java deleted file mode 100644 index 1bec88b..0000000 --- a/org/drip/spaces/functionclass/NormedR1ToNormedR1Finite.java +++ /dev/null @@ -1,109 +0,0 @@ - -package org.drip.spaces.functionclass; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * NormedR1ToNormedR1Finite implements the Class F of f : Normed R^1 To Normed R^1 Spaces of Finite - * Functions. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class NormedR1ToNormedR1Finite extends org.drip.spaces.functionclass.NormedRxToNormedR1Finite { - - /** - * NormedR1ToNormedR1Finite Finite Function Class Constructor - * - * @param dblMaureyConstant The Maurey Constant - * @param aNormedR1ToNormedR1 Array of the Function Spaces - * - * @throws java.lang.Exception Thrown if NormedR1ToNormedR1 Class Instance cannot be created - */ - - public NormedR1ToNormedR1Finite ( - final double dblMaureyConstant, - final org.drip.spaces.rxtor1.NormedR1ToNormedR1[] aNormedR1ToNormedR1) - throws java.lang.Exception - { - super (dblMaureyConstant, aNormedR1ToNormedR1); - - for (int i = 0; i < aNormedR1ToNormedR1.length; ++i) { - if (null == aNormedR1ToNormedR1[i]) - throw new java.lang.Exception ("NormedR1ToNormedR1Finite ctr: Invalid Input Function"); - } - } - - /** - * Retrieve the Finite Class of R^1 To R^1 Functions - * - * @return The Finite Class of R^1 To R^1 Functions - */ - - public org.drip.function.definition.R1ToR1[] functionR1ToR1Set() - { - org.drip.spaces.rxtor1.NormedR1ToNormedR1[] aNormedR1ToNormedR1 = - (org.drip.spaces.rxtor1.NormedR1ToNormedR1[]) functionSpaces(); - - if (null == aNormedR1ToNormedR1) return null; - - int iNumFunction = aNormedR1ToNormedR1.length; - org.drip.function.definition.R1ToR1[] aR1ToR1 = new - org.drip.function.definition.R1ToR1[iNumFunction]; - - for (int i = 0; i < iNumFunction; ++i) - aR1ToR1[i] = aNormedR1ToNormedR1[i].function(); - - return aR1ToR1; - } -} diff --git a/org/drip/spaces/functionclass/NormedRdToNormedR1Finite.java b/org/drip/spaces/functionclass/NormedRdToNormedR1Finite.java deleted file mode 100644 index 534aa48..0000000 --- a/org/drip/spaces/functionclass/NormedRdToNormedR1Finite.java +++ /dev/null @@ -1,109 +0,0 @@ - -package org.drip.spaces.functionclass; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * NormedRdToNormedR1Finite implements the Class F of f : Normed R^d To Normed R^1 Spaces of Finite - * Functions. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class NormedRdToNormedR1Finite extends org.drip.spaces.functionclass.NormedRxToNormedR1Finite { - - /** - * NormedRdToNormedR1Finite Function Class Constructor - * - * @param dblMaureyConstant The Maurey Constant - * @param aNormedRdToNormedR1 Array of the Function Spaces - * - * @throws java.lang.Exception Thrown if NormedRdToNormedR1Class Instance cannot be created - */ - - public NormedRdToNormedR1Finite ( - final double dblMaureyConstant, - final org.drip.spaces.rxtor1.NormedRdToNormedR1[] aNormedRdToNormedR1) - throws java.lang.Exception - { - super (dblMaureyConstant, aNormedRdToNormedR1); - - for (int i = 0; i < aNormedRdToNormedR1.length; ++i) { - if (null == aNormedRdToNormedR1[i]) - throw new java.lang.Exception ("NormedRdToNormedR1Finite ctr: Invalid Input Function"); - } - } - - /** - * Retrieve the Finite Class of R^d To R^1 Functions - * - * @return The Finite Class of R^d To R^1 Functions - */ - - public org.drip.function.definition.RdToR1[] functionRdToR1Set() - { - org.drip.spaces.rxtor1.NormedRdToNormedR1[] aNormedRdToNormedR1 = - (org.drip.spaces.rxtor1.NormedRdToNormedR1[]) functionSpaces(); - - if (null == aNormedRdToNormedR1) return null; - - int iNumFunction = aNormedRdToNormedR1.length; - org.drip.function.definition.RdToR1[] aRdToR1 = new - org.drip.function.definition.RdToR1[iNumFunction]; - - for (int i = 0; i < iNumFunction; ++i) - aRdToR1[i] = aNormedRdToNormedR1[i].function(); - - return aRdToR1; - } -} diff --git a/org/drip/spaces/functionclass/NormedRxToNormedR1Finite.java b/org/drip/spaces/functionclass/NormedRxToNormedR1Finite.java deleted file mode 100644 index a70a86f..0000000 --- a/org/drip/spaces/functionclass/NormedRxToNormedR1Finite.java +++ /dev/null @@ -1,406 +0,0 @@ - -package org.drip.spaces.functionclass; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * NormedRxToNormedR1Finite implements the Class F with f E f : Normed R^x To Normed R^1 Space of Finite - * Functions. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class NormedRxToNormedR1Finite extends org.drip.spaces.functionclass.NormedRxToNormedRxFinite { - private org.drip.spaces.rxtor1.NormedRxToNormedR1[] _aNormedRxToNormedR1 = null; - - protected NormedRxToNormedR1Finite ( - final double dblMaureyConstant, - final org.drip.spaces.rxtor1.NormedRxToNormedR1[] aNormedRxToNormedR1) - throws java.lang.Exception - { - super (dblMaureyConstant); - - int iClassSize = null == (_aNormedRxToNormedR1 = aNormedRxToNormedR1) ? 0 : - _aNormedRxToNormedR1.length; - - if (null != _aNormedRxToNormedR1 && 0 == iClassSize) - throw new java.lang.Exception ("NormedRxToNormedR1Finite ctr: Invalid Inputs"); - - for (int i = 0; i < iClassSize; ++i) { - if (null == _aNormedRxToNormedR1[i]) - throw new java.lang.Exception ("NormedRxToNormedR1Finite ctr: Invalid Inputs"); - } - } - - @Override public org.drip.spaces.cover.FunctionClassCoveringBounds agnosticCoveringNumberBounds() - { - return null; - } - - @Override public org.drip.spaces.metric.GeneralizedMetricVectorSpace inputMetricVectorSpace() - { - return null == _aNormedRxToNormedR1 ? null : _aNormedRxToNormedR1[0].inputMetricVectorSpace(); - } - - @Override public org.drip.spaces.metric.R1Normed outputMetricVectorSpace() - { - return null == _aNormedRxToNormedR1 ? null : _aNormedRxToNormedR1[0].outputMetricVectorSpace(); - } - - /** - * Retrieve the Array of Function Spaces in the Class - * - * @return The Array of Function Spaces in the Class - */ - - public org.drip.spaces.rxtor1.NormedRxToNormedR1[] functionSpaces() - { - return _aNormedRxToNormedR1; - } - - /** - * Estimate for the Function Class Population Covering Number - * - * @param dblCover The Size of the Cover - * - * @return Function Class Population Covering Number Estimate - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double populationCoveringNumber ( - final double dblCover) - throws java.lang.Exception - { - if (null == _aNormedRxToNormedR1) - throw new java.lang.Exception - ("NormedRxToNormedR1Finite::populationCoveringNumber => Finite Function Set Unspecified"); - - int iFunctionSpaceSize = _aNormedRxToNormedR1.length; - - double dblPopulationCoveringNumber = _aNormedRxToNormedR1[0].populationCoveringNumber (dblCover); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblPopulationCoveringNumber)) - throw new java.lang.Exception - ("NormedRxToNormedR1Finite::populationCoveringNumber => Cannot Compute Population Covering Number"); - - for (int i = 1; i < iFunctionSpaceSize; ++i) { - double dblFunctionPopulationCoveringNumber = _aNormedRxToNormedR1[i].populationCoveringNumber - (dblCover); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblFunctionPopulationCoveringNumber)) - throw new java.lang.Exception - ("NormedRxToNormedR1Finite::populationCoveringNumber => Cannot Compute Population Covering Number"); - - if (dblPopulationCoveringNumber < dblFunctionPopulationCoveringNumber) - dblPopulationCoveringNumber = dblFunctionPopulationCoveringNumber; - } - - return dblPopulationCoveringNumber; - } - - /** - * Estimate for the Function Class Population Supremum Covering Number - * - * @param dblCover The Size of the Cover - * - * @return Function Class Population Supremum Covering Number Estimate - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double populationSupremumCoveringNumber ( - final double dblCover) - throws java.lang.Exception - { - if (null == _aNormedRxToNormedR1) - throw new java.lang.Exception - ("NormedRxToNormedR1Finite::populationSupremumCoveringNumber => Finite Function Set Unspecified"); - - int iFunctionSpaceSize = _aNormedRxToNormedR1.length; - - double dblPopulationSupremumCoveringNumber = _aNormedRxToNormedR1[0].populationSupremumCoveringNumber - (dblCover); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblPopulationSupremumCoveringNumber)) - throw new java.lang.Exception - ("NormedRxToNormedR1Finite::populationSupremumCoveringNumber => Cannot Compute Population Supremum Covering Number"); - - for (int i = 1; i < iFunctionSpaceSize; ++i) { - double dblFunctionPopulationSupremumCoveringNumber = - _aNormedRxToNormedR1[i].populationSupremumCoveringNumber (dblCover); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblFunctionPopulationSupremumCoveringNumber)) - throw new java.lang.Exception - ("NormedRxToNormedR1Finite::populationSupremumCoveringNumber => Cannot Compute Population Supremum Covering Number"); - - if (dblPopulationSupremumCoveringNumber < dblFunctionPopulationSupremumCoveringNumber) - dblPopulationSupremumCoveringNumber = dblFunctionPopulationSupremumCoveringNumber; - } - - return dblPopulationSupremumCoveringNumber; - } - - /** - * Estimate for the Scale-Sensitive Sample Covering Number for the specified Cover Size - * - * @param gvvi The Validated Instance Vector Sequence - * @param dblCover The Size of the Cover - * - * @return The Scale-Sensitive Sample Covering Number for the specified Cover Size - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double sampleCoveringNumber ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi, - final double dblCover) - throws java.lang.Exception - { - if (null == _aNormedRxToNormedR1) - throw new java.lang.Exception - ("NormedRxToNormedR1Finite::sampleCoveringNumber => Finite Function Set Unspecified"); - - int iFunctionSpaceSize = _aNormedRxToNormedR1.length; - - double dblSampleCoveringNumber = _aNormedRxToNormedR1[0].sampleCoveringNumber (gvvi, dblCover); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblSampleCoveringNumber)) - throw new java.lang.Exception - ("NormedRxToNormedR1Finite::sampleCoveringNumber => Cannot Compute Sample Covering Number"); - - for (int i = 1; i < iFunctionSpaceSize; ++i) { - double dblFunctionSampleCoveringNumber = _aNormedRxToNormedR1[i].sampleCoveringNumber (gvvi, - dblCover); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblFunctionSampleCoveringNumber)) - throw new java.lang.Exception - ("NormedRxToNormedR1Finite::sampleCoveringNumber => Cannot Compute Sample Covering Number"); - - if (dblSampleCoveringNumber < dblFunctionSampleCoveringNumber) - dblSampleCoveringNumber = dblFunctionSampleCoveringNumber; - } - - return dblSampleCoveringNumber; - } - - /** - * Estimate for the Scale-Sensitive Sample Supremum Covering Number for the specified Cover Size - * - * @param gvvi The Validated Instance Vector Sequence - * @param dblCover The Size of the Cover - * - * @return The Scale-Sensitive Sample Supremum Covering Number for the specified Cover Size - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double sampleSupremumCoveringNumber ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi, - final double dblCover) - throws java.lang.Exception - { - if (null == _aNormedRxToNormedR1) - throw new java.lang.Exception - ("NormedRxToNormedR1Finite::sampleSupremumCoveringNumber => Finite Function Set Unspecified"); - - int iFunctionSpaceSize = _aNormedRxToNormedR1.length; - - double dblSampleSupremumCoveringNumber = _aNormedRxToNormedR1[0].sampleSupremumCoveringNumber (gvvi, - dblCover); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblSampleSupremumCoveringNumber)) - throw new java.lang.Exception - ("NormedRxToNormedR1Finite::sampleSupremumCoveringNumber => Cannot Compute Sample Supremum Covering Number"); - - for (int i = 1; i < iFunctionSpaceSize; ++i) { - double dblFunctionSampleSupremumCoveringNumber = - _aNormedRxToNormedR1[i].sampleSupremumCoveringNumber (gvvi, dblCover); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblFunctionSampleSupremumCoveringNumber)) - throw new java.lang.Exception - ("NormedRxToNormedR1Finite::sampleSupremumCoveringNumber => Cannot Compute Sample Supremum Covering Number"); - - if (dblSampleSupremumCoveringNumber < dblFunctionSampleSupremumCoveringNumber) - dblSampleSupremumCoveringNumber = dblFunctionSampleSupremumCoveringNumber; - } - - return dblSampleSupremumCoveringNumber; - } - - @Override public double operatorPopulationMetricNorm() - throws java.lang.Exception - { - if (null == _aNormedRxToNormedR1) - throw new java.lang.Exception - ("NormedRxToNormedR1Finite::operatorPopulationMetricNorm => Finite Function Set Unspecified"); - - int iNumFunction = _aNormedRxToNormedR1.length; - - double dblOperatorPopulationMetricNorm = _aNormedRxToNormedR1[0].populationMetricNorm(); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblOperatorPopulationMetricNorm)) - throw new java.lang.Exception - ("NormedRxToNormedR1Finite::operatorPopulationMetricNorm => Cannot compute Population Metric Norm for Function #" - + 0); - - for (int i = 1; i < iNumFunction; ++i) { - double dblPopulationMetricNorm = _aNormedRxToNormedR1[i].populationMetricNorm(); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblPopulationMetricNorm)) - throw new java.lang.Exception - ("NormedRxToNormedR1Finite::operatorPopulationMetricNorm => Cannot compute Population Metric Norm for Function #" - + i); - - if (dblOperatorPopulationMetricNorm > dblPopulationMetricNorm) - dblOperatorPopulationMetricNorm = dblPopulationMetricNorm; - } - - return dblOperatorPopulationMetricNorm; - } - - @Override public double operatorPopulationSupremumNorm() - throws java.lang.Exception - { - if (null == _aNormedRxToNormedR1) - throw new java.lang.Exception - ("NormedRxToNormedR1Finite::operatorPopulationSupremumNorm => Finite Function Set Unspecified"); - - int iNumFunction = _aNormedRxToNormedR1.length; - - double dblOperatorPopulationSupremumNorm = _aNormedRxToNormedR1[0].populationESS(); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblOperatorPopulationSupremumNorm)) - throw new java.lang.Exception - ("NormedRxToNormedR1Finite::operatorPopulationSupremumNorm => Cannot compute Population Supremum Norm for Function #" - + 0); - - for (int i = 1; i < iNumFunction; ++i) { - double dblPopulationSupremumNorm = _aNormedRxToNormedR1[i].populationESS(); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblPopulationSupremumNorm)) - throw new java.lang.Exception - ("NormedRxToNormedR1Finite::operatorPopulationSupremumNorm => Cannot compute Population Supremum Norm for Function #" - + i); - - if (dblOperatorPopulationSupremumNorm > dblPopulationSupremumNorm) - dblOperatorPopulationSupremumNorm = dblPopulationSupremumNorm; - } - - return dblOperatorPopulationSupremumNorm; - } - - @Override public double operatorSampleMetricNorm ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi) - throws java.lang.Exception - { - if (null == _aNormedRxToNormedR1) - throw new java.lang.Exception - ("NormedRxToNormedR1Finite::operatorSampleMetricNorm => Finite Function Set Unspecified"); - - int iNumFunction = _aNormedRxToNormedR1.length; - - double dblOperatorSampleMetricNorm = _aNormedRxToNormedR1[0].sampleMetricNorm (gvvi); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblOperatorSampleMetricNorm)) - throw new java.lang.Exception - ("NormedRxToNormedR1Finite::operatorSampleMetricNorm => Cannot compute Sample Metric Norm for Function #" - + 0); - - for (int i = 1; i < iNumFunction; ++i) { - double dblSampleMetricNorm = _aNormedRxToNormedR1[i].sampleMetricNorm (gvvi); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblSampleMetricNorm)) - throw new java.lang.Exception - ("NormedRxToNormedR1Finite::operatorSampleMetricNorm => Cannot compute Sample Metric Norm for Function #" - + i); - - if (dblOperatorSampleMetricNorm > dblSampleMetricNorm) - dblOperatorSampleMetricNorm = dblSampleMetricNorm; - } - - return dblOperatorSampleMetricNorm; - } - - @Override public double operatorSampleSupremumNorm ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi) - throws java.lang.Exception - { - if (null == _aNormedRxToNormedR1) - throw new java.lang.Exception - ("NormedRxToNormedR1Finite::operatorSampleSupremumNorm => Finite Function Set Unspecified"); - - int iNumFunction = _aNormedRxToNormedR1.length; - - double dblOperatorSampleSupremumNorm = _aNormedRxToNormedR1[0].sampleSupremumNorm (gvvi); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblOperatorSampleSupremumNorm)) - throw new java.lang.Exception - ("NormedRxToNormedR1Finite::operatorSampleSupremumNorm => Cannot compute Sample Supremum Norm for Function #" - + 0); - - for (int i = 1; i < iNumFunction; ++i) { - double dblSampleSupremumNorm = _aNormedRxToNormedR1[i].sampleSupremumNorm (gvvi); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblSampleSupremumNorm)) - throw new java.lang.Exception - ("NormedRxToNormedR1Finite::operatorSampleSupremumNorm => Cannot compute Sample Supremum Norm for Function #" - + i); - - if (dblOperatorSampleSupremumNorm > dblSampleSupremumNorm) - dblOperatorSampleSupremumNorm = dblSampleSupremumNorm; - } - - return dblOperatorSampleSupremumNorm; - } -} diff --git a/org/drip/spaces/functionclass/NormedRxToNormedRdFinite.java b/org/drip/spaces/functionclass/NormedRxToNormedRdFinite.java deleted file mode 100644 index 9f56d76..0000000 --- a/org/drip/spaces/functionclass/NormedRxToNormedRdFinite.java +++ /dev/null @@ -1,626 +0,0 @@ - -package org.drip.spaces.functionclass; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * NormedRxToNormedRdFinite implements the Class F with f E f : Normed R^x To Normed R^d Space of Finite - * Functions. - * - * The References are: - * - * 1) Carl, B. (1985): Inequalities of the Bernstein-Jackson type and the Degree of Compactness of Operators - * in Banach Spaces, Annals of the Fourier Institute 35 (3) 79-118. - * - * 2) Carl, B., and I. Stephani (1990): Entropy, Compactness, and the Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * 3) Williamson, R. C., A. J. Smola, and B. Scholkopf (2000): Entropy Numbers of Linear Function Classes, - * in: Proceedings of the 13th Annual Conference on Computational Learning Theory, ACM New York. - * - * @author Lakshmi Krishnamurthy - */ - -public class NormedRxToNormedRdFinite extends org.drip.spaces.functionclass.NormedRxToNormedRxFinite { - private org.drip.spaces.rxtord.NormedRxToNormedRd[] _aNormedRxToNormedRd = null; - - /** - * NormedRxToNormedRdFinite Constructor - * - * @param dblMaureyConstant Maurey Constant - * @param aNormedRxToNormedRd Array of the Normed R^x To Normed R^d Spaces - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public NormedRxToNormedRdFinite ( - final double dblMaureyConstant, - final org.drip.spaces.rxtord.NormedRxToNormedRd[] aNormedRxToNormedRd) - throws java.lang.Exception - { - super (dblMaureyConstant); - - int iClassSize = null == (_aNormedRxToNormedRd = aNormedRxToNormedRd) ? 0 : - _aNormedRxToNormedRd.length; - - if (null != _aNormedRxToNormedRd && 0 == iClassSize) - throw new java.lang.Exception ("NormedRxToNormedRdFinite ctr: Invalid Inputs"); - - for (int i = 0; i < iClassSize; ++i) { - if (null == _aNormedRxToNormedRd[i]) - throw new java.lang.Exception ("NormedRxToNormedRdFinite ctr: Invalid Inputs"); - } - } - - @Override public org.drip.spaces.cover.FunctionClassCoveringBounds agnosticCoveringNumberBounds() - { - return null; - } - - @Override public org.drip.spaces.metric.GeneralizedMetricVectorSpace inputMetricVectorSpace() - { - return null == _aNormedRxToNormedRd ? null : _aNormedRxToNormedRd[0].inputMetricVectorSpace(); - } - - @Override public org.drip.spaces.metric.RdNormed outputMetricVectorSpace() - { - return null == _aNormedRxToNormedRd ? null : _aNormedRxToNormedRd[0].outputMetricVectorSpace(); - } - - /** - * Retrieve the Array of Function Spaces in the Class - * - * @return The Array of Function Spaces in the Class - */ - - public org.drip.spaces.rxtord.NormedRxToNormedRd[] functionSpaces() - { - return _aNormedRxToNormedRd; - } - - /** - * Estimate for the Function Class Population Covering Number Array, one for each dimension - * - * @param adblCover The Size of the Cover Array - * - * @return Function Class Population Covering Number Estimate Array, one for each dimension - */ - - public double[] populationCoveringNumber ( - final double[] adblCover) - { - if (null == _aNormedRxToNormedRd || null == adblCover) return null; - - int iFunctionSpaceSize = _aNormedRxToNormedRd.length; - - if (iFunctionSpaceSize != adblCover.length) return null; - - double[] adblPopulationCoveringNumber = _aNormedRxToNormedRd[0].populationCoveringNumber - (adblCover[0]); - - if (!org.drip.quant.common.NumberUtil.IsValid (adblPopulationCoveringNumber)) return null; - - for (int i = 1; i < iFunctionSpaceSize; ++i) { - double[] adblFunctionPopulationCoveringNumber = _aNormedRxToNormedRd[i].populationCoveringNumber - (adblCover[i]); - - if (!org.drip.quant.common.NumberUtil.IsValid (adblFunctionPopulationCoveringNumber)) - return null; - - int iDimension = adblFunctionPopulationCoveringNumber.length; - - for (int j = 0; j < iDimension; ++j) { - if (adblPopulationCoveringNumber[j] < adblFunctionPopulationCoveringNumber[j]) - adblPopulationCoveringNumber[j] = adblFunctionPopulationCoveringNumber[j]; - } - } - - return adblPopulationCoveringNumber; - } - - /** - * Estimate for the Function Class Population Covering Number Array, one for each dimension - * - * @param dblCover The Cover - * - * @return Function Class Population Covering Number Estimate Array, one for each dimension - */ - - public double[] populationCoveringNumber ( - final double dblCover) - { - int iDimension = outputMetricVectorSpace().dimension(); - - double[] adblCover = new double[iDimension]; - - for (int i = 0; i < iDimension; ++i) - adblCover[i] = dblCover; - - return populationCoveringNumber (adblCover); - } - - /** - * Estimate for the Function Class Population Supremum Covering Number Array, one for each dimension - * - * @param adblCover The Size of the Cover Array - * - * @return Function Class Population Supremum Covering Number Estimate Array, one for each dimension - */ - - public double[] populationSupremumCoveringNumber ( - final double[] adblCover) - { - if (null == _aNormedRxToNormedRd || null == adblCover) return null; - - int iFunctionSpaceSize = _aNormedRxToNormedRd.length; - - if (iFunctionSpaceSize != adblCover.length) return null; - - double[] adblPopulationSupremumCoveringNumber = - _aNormedRxToNormedRd[0].populationSupremumCoveringNumber (adblCover[0]); - - if (!org.drip.quant.common.NumberUtil.IsValid (adblPopulationSupremumCoveringNumber)) return null; - - for (int i = 1; i < iFunctionSpaceSize; ++i) { - double[] adblFunctionPopulationSupremumCoveringNumber = - _aNormedRxToNormedRd[i].populationSupremumCoveringNumber (adblCover[i]); - - if (!org.drip.quant.common.NumberUtil.IsValid (adblFunctionPopulationSupremumCoveringNumber)) - return null; - - int iDimension = adblFunctionPopulationSupremumCoveringNumber.length; - - for (int j = 0; j < iDimension; ++j) { - if (adblPopulationSupremumCoveringNumber[j] < - adblFunctionPopulationSupremumCoveringNumber[j]) - adblPopulationSupremumCoveringNumber[j] = - adblFunctionPopulationSupremumCoveringNumber[j]; - } - } - - return adblPopulationSupremumCoveringNumber; - } - - /** - * Estimate for the Function Class Population Supremum Covering Number Array, one for each dimension - * - * @param dblCover The Cover - * - * @return Function Class Population Covering Supremum Number Estimate Array, one for each dimension - */ - - public double[] populationSupremumCoveringNumber ( - final double dblCover) - { - int iDimension = outputMetricVectorSpace().dimension(); - - double[] adblCover = new double[iDimension]; - - for (int i = 0; i < iDimension; ++i) - adblCover[i] = dblCover; - - return populationSupremumCoveringNumber (adblCover); - } - - /** - * Estimate for the Scale-Sensitive Sample Covering Number Array for the specified Cover Size - * - * @param gvvi The Validated Instance Vector Sequence - * @param adblCover The Size of the Cover Array - * - * @return The Scale-Sensitive Sample Covering Number Array for the specified Cover Size - */ - - public double[] sampleCoveringNumber ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi, - final double[] adblCover) - { - if (null == _aNormedRxToNormedRd || null == adblCover) return null; - - int iFunctionSpaceSize = _aNormedRxToNormedRd.length; - - if (iFunctionSpaceSize != adblCover.length) return null; - - double[] adblSampleCoveringNumber = _aNormedRxToNormedRd[0].sampleCoveringNumber (gvvi, - adblCover[0]); - - if (!org.drip.quant.common.NumberUtil.IsValid (adblSampleCoveringNumber)) return null; - - for (int i = 1; i < iFunctionSpaceSize; ++i) { - double[] adblFunctionSampleCoveringNumber = _aNormedRxToNormedRd[i].sampleCoveringNumber (gvvi, - adblCover[i]); - - if (!org.drip.quant.common.NumberUtil.IsValid (adblFunctionSampleCoveringNumber)) return null; - - int iDimension = adblFunctionSampleCoveringNumber.length; - - for (int j = 0; j < iDimension; ++j) { - if (adblSampleCoveringNumber[j] < adblFunctionSampleCoveringNumber[j]) - adblSampleCoveringNumber[j] = adblFunctionSampleCoveringNumber[j]; - } - } - - return adblSampleCoveringNumber; - } - - /** - * Estimate for the Scale-Sensitive Sample Covering Number Array for the specified Cover Size - * - * @param gvvi The Validated Instance Vector Sequence - * @param dblCover The Size of the Cover Array - * - * @return The Scale-Sensitive Sample Covering Number Array for the specified Cover Size - */ - - public double[] sampleCoveringNumber ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi, - final double dblCover) - { - int iDimension = outputMetricVectorSpace().dimension(); - - double[] adblCover = new double[iDimension]; - - for (int i = 0; i < iDimension; ++i) - adblCover[i] = dblCover; - - return sampleCoveringNumber (gvvi, adblCover); - } - - /** - * Estimate for the Scale-Sensitive Sample Supremum Covering Number for the specified Cover Size - * - * @param gvvi The Validated Instance Vector Sequence - * @param adblCover The Size of the Cover Array - * - * @return The Scale-Sensitive Sample Supremum Covering Number for the specified Cover Size - */ - - public double[] sampleSupremumCoveringNumber ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi, - final double[] adblCover) - { - if (null == _aNormedRxToNormedRd || null == adblCover) return null; - - int iFunctionSpaceSize = _aNormedRxToNormedRd.length; - - if (iFunctionSpaceSize != adblCover.length) return null; - - double[] adblSampleSupremumCoveringNumber = _aNormedRxToNormedRd[0].sampleSupremumCoveringNumber - (gvvi, adblCover[0]); - - if (!org.drip.quant.common.NumberUtil.IsValid (adblSampleSupremumCoveringNumber)) return null; - - for (int i = 1; i < iFunctionSpaceSize; ++i) { - double[] adblFunctionSampleSupremumCoveringNumber = - _aNormedRxToNormedRd[i].sampleSupremumCoveringNumber (gvvi, adblCover[i]); - - if (!org.drip.quant.common.NumberUtil.IsValid (adblFunctionSampleSupremumCoveringNumber)) - return null; - - int iDimension = adblFunctionSampleSupremumCoveringNumber.length; - - for (int j = 0; j < iDimension; ++j) { - if (adblSampleSupremumCoveringNumber[j] < adblFunctionSampleSupremumCoveringNumber[j]) - adblSampleSupremumCoveringNumber[j] = adblFunctionSampleSupremumCoveringNumber[j]; - } - } - - return adblSampleSupremumCoveringNumber; - } - - /** - * Estimate for the Scale-Sensitive Sample Supremum Covering Number for the specified Cover Size - * - * @param gvvi The Validated Instance Vector Sequence - * @param dblCover The Cover - * - * @return The Scale-Sensitive Sample Supremum Covering Number for the specified Cover Size - */ - - public double[] sampleSupremumCoveringNumber ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi, - final double dblCover) - { - int iDimension = outputMetricVectorSpace().dimension(); - - double[] adblCover = new double[iDimension]; - - for (int i = 0; i < iDimension; ++i) - adblCover[i] = dblCover; - - return sampleSupremumCoveringNumber (gvvi, adblCover); - } - - /** - * Compute the Population R^d Metric Norm - * - * @return The Population R^d Metric Norm - */ - - public double[] populationRdMetricNorm() - { - if (null == _aNormedRxToNormedRd) return null; - - int iNumFunction = _aNormedRxToNormedRd.length; - - double[] adblPopulationRdMetricNorm = _aNormedRxToNormedRd[0].populationMetricNorm(); - - if (!org.drip.quant.common.NumberUtil.IsValid (adblPopulationRdMetricNorm)) return null; - - for (int i = 1; i < iNumFunction; ++i) { - double[] adblPopulationMetricNorm = _aNormedRxToNormedRd[i].populationMetricNorm(); - - if (!org.drip.quant.common.NumberUtil.IsValid (adblPopulationMetricNorm)) return null; - - int iDimension = adblPopulationMetricNorm.length; - - for (int j = 0; j < iDimension; ++j) { - if (adblPopulationRdMetricNorm[j] < adblPopulationMetricNorm[j]) - adblPopulationRdMetricNorm[j] = adblPopulationMetricNorm[j]; - } - } - - return adblPopulationRdMetricNorm; - } - - /** - * Compute the Population R^d Supremum Norm - * - * @return The Population R^d Supremum Norm - */ - - public double[] populationRdSupremumNorm() - { - if (null == _aNormedRxToNormedRd) return null; - - int iNumFunction = _aNormedRxToNormedRd.length; - - double[] adblPopulationRdSupremumNorm = _aNormedRxToNormedRd[0].populationESS(); - - if (!org.drip.quant.common.NumberUtil.IsValid (adblPopulationRdSupremumNorm)) return null; - - for (int i = 1; i < iNumFunction; ++i) { - double[] adblPopulationSupremumNorm = _aNormedRxToNormedRd[i].populationESS(); - - if (!org.drip.quant.common.NumberUtil.IsValid (adblPopulationSupremumNorm)) return null; - - int iDimension = adblPopulationSupremumNorm.length; - - for (int j = 0; j < iDimension; ++j) { - if (adblPopulationRdSupremumNorm[j] < adblPopulationSupremumNorm[j]) - adblPopulationRdSupremumNorm[j] = adblPopulationSupremumNorm[j]; - } - } - - return adblPopulationRdSupremumNorm; - } - - /** - * Compute the Sample R^d Metric Norm - * - * @param gvvi The Validated Vector Space Instance - * - * @return The Sample R^d Metric Norm - */ - - public double[] sampleRdMetricNorm ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi) - { - if (null == _aNormedRxToNormedRd) return null; - - int iNumFunction = _aNormedRxToNormedRd.length; - - double[] adblSampleRdMetricNorm = _aNormedRxToNormedRd[0].sampleMetricNorm (gvvi); - - if (!org.drip.quant.common.NumberUtil.IsValid (adblSampleRdMetricNorm)) return null; - - for (int i = 1; i < iNumFunction; ++i) { - double[] adblSampleMetricNorm = _aNormedRxToNormedRd[i].sampleMetricNorm (gvvi); - - if (!org.drip.quant.common.NumberUtil.IsValid (adblSampleMetricNorm)) return null; - - int iDimension = adblSampleMetricNorm.length; - - for (int j = 0; j < iDimension; ++j) { - if (adblSampleRdMetricNorm[j] < adblSampleMetricNorm[j]) - adblSampleRdMetricNorm[j] = adblSampleMetricNorm[j]; - } - } - - return adblSampleRdMetricNorm; - } - - /** - * Compute the Sample R^d Supremum Norm - * - * @param gvvi The Validated Vector Space Instance - * - * @return The Sample R^d Supremum Norm - */ - - public double[] sampleRdSupremumNorm ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi) - { - if (null == _aNormedRxToNormedRd) return null; - - int iNumFunction = _aNormedRxToNormedRd.length; - - double[] adblSampleRdSupremumNorm = _aNormedRxToNormedRd[0].sampleSupremumNorm (gvvi); - - if (!org.drip.quant.common.NumberUtil.IsValid (adblSampleRdSupremumNorm)) return null; - - for (int i = 1; i < iNumFunction; ++i) { - double[] adblSampleSupremumNorm = _aNormedRxToNormedRd[i].sampleSupremumNorm (gvvi); - - if (!org.drip.quant.common.NumberUtil.IsValid (adblSampleSupremumNorm)) return null; - - int iDimension = adblSampleSupremumNorm.length; - - for (int j = 0; j < iDimension; ++j) { - if (adblSampleRdSupremumNorm[j] < adblSampleSupremumNorm[j]) - adblSampleRdSupremumNorm[j] = adblSampleSupremumNorm[j]; - } - } - - return adblSampleRdSupremumNorm; - } - - @Override public double operatorPopulationMetricNorm() - throws java.lang.Exception - { - double[] adblPopulationMetricNorm = populationRdMetricNorm(); - - if (null == adblPopulationMetricNorm) - throw new java.lang.Exception - ("NormedRxToNormedRdFinite::operatorPopulationMetricNorm => Invalid Inputs"); - - int iDimension = adblPopulationMetricNorm.length; - double dblOperatorPopulationMetricNorm = java.lang.Double.NaN; - - if (0 == iDimension) - throw new java.lang.Exception - ("NormedRxToNormedRdFinite::operatorPopulationMetricNorm => Invalid Inputs"); - - for (int j = 0; j < iDimension; ++j) { - if (0 == j) - dblOperatorPopulationMetricNorm = adblPopulationMetricNorm[j]; - else { - if (dblOperatorPopulationMetricNorm < adblPopulationMetricNorm[j]) - dblOperatorPopulationMetricNorm = adblPopulationMetricNorm[j]; - } - } - - return dblOperatorPopulationMetricNorm; - } - - @Override public double operatorPopulationSupremumNorm() - throws java.lang.Exception - { - double[] adblPopulationSupremumNorm = populationRdSupremumNorm(); - - if (null == adblPopulationSupremumNorm) - throw new java.lang.Exception - ("NormedRxToNormedRdFinite::operatorPopulationSupremumNorm => Invalid Inputs"); - - int iDimension = adblPopulationSupremumNorm.length; - double dblOperatorPopulationSupremumNorm = java.lang.Double.NaN; - - if (0 == iDimension) - throw new java.lang.Exception - ("NormedRxToNormedRdFinite::operatorPopulationSupremumNorm => Invalid Inputs"); - - for (int j = 0; j < iDimension; ++j) { - if (0 == j) - dblOperatorPopulationSupremumNorm = adblPopulationSupremumNorm[j]; - else { - if (dblOperatorPopulationSupremumNorm < adblPopulationSupremumNorm[j]) - dblOperatorPopulationSupremumNorm = adblPopulationSupremumNorm[j]; - } - } - - return dblOperatorPopulationSupremumNorm; - } - - @Override public double operatorSampleMetricNorm ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi) - throws java.lang.Exception - { - double[] adblSampleMetricNorm = sampleRdMetricNorm (gvvi); - - if (null == adblSampleMetricNorm) - throw new java.lang.Exception - ("NormedRxToNormedRdFinite::operatorSampleMetricNorm => Invalid Inputs"); - - int iDimension = adblSampleMetricNorm.length; - double dblOperatorSampleMetricNorm = java.lang.Double.NaN; - - if (0 == iDimension) - throw new java.lang.Exception - ("NormedRxToNormedRdFinite::operatorSampleMetricNorm => Invalid Inputs"); - - for (int j = 0; j < iDimension; ++j) { - if (0 == j) - dblOperatorSampleMetricNorm = adblSampleMetricNorm[j]; - else { - if (dblOperatorSampleMetricNorm < adblSampleMetricNorm[j]) - dblOperatorSampleMetricNorm = adblSampleMetricNorm[j]; - } - } - - return dblOperatorSampleMetricNorm; - } - - @Override public double operatorSampleSupremumNorm ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi) - throws java.lang.Exception - { - double[] adblSampleSupremumNorm = sampleRdSupremumNorm (gvvi); - - if (null == adblSampleSupremumNorm) - throw new java.lang.Exception - ("NormedRxToNormedRdFinite::operatorSampleSupremumNorm => Invalid Inputs"); - - int iDimension = adblSampleSupremumNorm.length; - double dblOperatorSampleSupremumNorm = java.lang.Double.NaN; - - if (0 == iDimension) - throw new java.lang.Exception - ("NormedRxToNormedRdFinite::operatorSampleSupremumNorm => Invalid Inputs"); - - for (int j = 0; j < iDimension; ++j) { - if (0 == j) - dblOperatorSampleSupremumNorm = adblSampleSupremumNorm[j]; - else { - if (dblOperatorSampleSupremumNorm < adblSampleSupremumNorm[j]) - dblOperatorSampleSupremumNorm = adblSampleSupremumNorm[j]; - } - } - - return dblOperatorSampleSupremumNorm; - } -} diff --git a/org/drip/spaces/functionclass/NormedRxToNormedRxFinite.java b/org/drip/spaces/functionclass/NormedRxToNormedRxFinite.java deleted file mode 100644 index 12bf2fe..0000000 --- a/org/drip/spaces/functionclass/NormedRxToNormedRxFinite.java +++ /dev/null @@ -1,311 +0,0 @@ - -package org.drip.spaces.functionclass; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * NormedRxToNormedRxFinite exposes the Space of Functions that are a Transform from the Normed R^x To Normed - * R^x Spaces. - * - * The References are: - * - * 1) Carl, B. (1985): Inequalities of the Bernstein-Jackson type and the Degree of Compactness of Operators - * in Banach Spaces, Annals of the Fourier Institute 35 (3) 79-118. - * - * 2) Carl, B., and I. Stephani (1990): Entropy, Compactness, and the Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * 3) Williamson, R. C., A. J. Smola, and B. Scholkopf (2000): Entropy Numbers of Linear Function Classes, - * in: Proceedings of the 13th Annual Conference on Computational Learning Theory, ACM New York. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class NormedRxToNormedRxFinite { - private double _dblMaureyConstant = java.lang.Double.NaN; - - protected NormedRxToNormedRxFinite ( - final double dblMaureyConstant) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblMaureyConstant = dblMaureyConstant) || 0. >= - _dblMaureyConstant) - throw new java.lang.Exception ("NormedRxToNormedRxFinite ctr => Invalid Inputs"); - } - - /** - * Retrieve the Input Vector Space - * - * @return The Input Vector Space - */ - - public abstract org.drip.spaces.metric.GeneralizedMetricVectorSpace inputMetricVectorSpace(); - - /** - * Retrieve the Output Vector Space - * - * @return The Output Vector Space - */ - - public abstract org.drip.spaces.metric.GeneralizedMetricVectorSpace outputMetricVectorSpace(); - - /** - * Compute the Operator Population Metric Norm - * - * @return The Operator Population Metric Norm - * - * @throws java.lang.Exception Thrown if the Operator Norm cannot be computed - */ - - public abstract double operatorPopulationMetricNorm() - throws java.lang.Exception; - - /** - * Compute the Operator Population Supremum Norm - * - * @return The Operator Population Supremum Norm - * - * @throws java.lang.Exception Thrown if the Operator Population Supremum Norm cannot be computed - */ - - public abstract double operatorPopulationSupremumNorm() - throws java.lang.Exception; - - /** - * Compute the Operator Sample Metric Norm - * - * @param gvvi The Validated Vector Space Instance - * - * @return The Operator Sample Metric Norm - * - * @throws java.lang.Exception Thrown if the Operator Norm cannot be computed - */ - - public abstract double operatorSampleMetricNorm ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi) - throws java.lang.Exception; - - /** - * Compute the Operator Sample Supremum Norm - * - * @param gvvi The Validated Vector Space Instance - * - * @return The Operator Sample Supremum Norm - * - * @throws java.lang.Exception Thrown if the Operator Sample Supremum Norm cannot be computed - */ - - public abstract double operatorSampleSupremumNorm ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi) - throws java.lang.Exception; - - /** - * Retrieve the Agnostic Covering Number Upper/Lower Bounds for the Function Class - * - * @return The Agnostic Covering Number Upper/Lower Bounds for the Function Class - */ - - public abstract org.drip.spaces.cover.FunctionClassCoveringBounds agnosticCoveringNumberBounds(); - - /** - * Retrieve the Maurey Constant - * - * @return The Maurey Constant - */ - - public double maureyConstant() - { - return _dblMaureyConstant; - } - - /** - * Retrieve the Scale-Sensitive Covering Number Upper/Lower Bounds given the Specified Sample for the - * Function Class - * - * @param gvvi The Validated Instance Vector Sequence - * @param funcR1ToR1FatShatter The Cover Fat Shattering Coefficient R^1 To R^1 - * - * @return The Scale-Sensitive Covering Number Upper/Lower Bounds given the Specified Sample for the - * Function Class - */ - - public org.drip.spaces.cover.FunctionClassCoveringBounds scaleSensitiveCoveringBounds ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi, - final org.drip.function.definition.R1ToR1 funcR1ToR1FatShatter) - { - if (null == gvvi || null == funcR1ToR1FatShatter) return null; - - int iSampleSize = -1; - - if (gvvi instanceof org.drip.spaces.instance.ValidatedR1) { - double[] adblInstance = ((org.drip.spaces.instance.ValidatedR1) gvvi).instance(); - - if (null == adblInstance) return null; - - iSampleSize = adblInstance.length; - } else if (gvvi instanceof org.drip.spaces.instance.ValidatedRd) { - double[][] aadblInstance = ((org.drip.spaces.instance.ValidatedRd) gvvi).instance(); - - if (null == aadblInstance) return null; - - iSampleSize = aadblInstance.length; - } - - try { - return new org.drip.spaces.cover.ScaleSensitiveCoveringBounds (funcR1ToR1FatShatter, - iSampleSize); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Output Dimension - * - * @return The Output Dimension - * - * @throws java.lang.Exception Thrown if the Output Dimension is Invalid - */ - - public int outputDimension() - throws java.lang.Exception - { - org.drip.spaces.metric.GeneralizedMetricVectorSpace gmvsOutput = outputMetricVectorSpace(); - - if (!(gmvsOutput instanceof org.drip.spaces.metric.R1Continuous) && !(gmvsOutput instanceof - org.drip.spaces.metric.RdContinuousBanach)) - throw new java.lang.Exception ("NormedRxToNormedRxFinite::dimension => Invalid Inputs"); - - return gmvsOutput instanceof org.drip.spaces.metric.R1Continuous ? 1 : - ((org.drip.spaces.metric.RdContinuousBanach) gmvsOutput).dimension(); - } - - /** - * Compute the Maurey Covering Number Upper Bounds for Operator Population Metric Norm - * - * @return The Maurey Operator Covering Number Upper Bounds Instance Corresponding to the Operator - * Population Metric Norm - */ - - public org.drip.spaces.cover.MaureyOperatorCoveringBounds populationMetricCoveringBounds() - { - try { - return new org.drip.spaces.cover.MaureyOperatorCoveringBounds (_dblMaureyConstant, - outputDimension(), operatorPopulationMetricNorm()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Maurey Covering Number Upper Bounds for Operator Population Supremum Norm - * - * @return The Maurey Operator Covering Number Upper Bounds Instance Corresponding to the Operator - * Population Supremum Norm - */ - - public org.drip.spaces.cover.MaureyOperatorCoveringBounds populationSupremumCoveringBounds() - { - try { - return new org.drip.spaces.cover.MaureyOperatorCoveringBounds (_dblMaureyConstant, - outputDimension(), operatorPopulationSupremumNorm()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Maurey Covering Number Upper Bounds for Operator Sample Metric Norm - * - * @param gvvi The Validated Vector Space Instance - * - * @return The Maurey Operator Covering Number Upper Bounds Instance Corresponding to the Operator Sample - * Metric Norm - */ - - public org.drip.spaces.cover.MaureyOperatorCoveringBounds sampleMetricCoveringBounds ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi) - { - try { - return new org.drip.spaces.cover.MaureyOperatorCoveringBounds (_dblMaureyConstant, - outputDimension(), operatorSampleMetricNorm (gvvi)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the Maurey Covering Number Upper Bounds for Operator Sample Supremum Norm - * - * @param gvvi The Validated Vector Space Instance - * - * @return The Maurey Operator Covering Number Upper Bounds Instance Corresponding to the Operator Sample - * Supremum Norm - */ - - public org.drip.spaces.cover.MaureyOperatorCoveringBounds sampleSupremumCoveringBounds ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi) - { - try { - return new org.drip.spaces.cover.MaureyOperatorCoveringBounds (_dblMaureyConstant, - outputDimension(), operatorSampleSupremumNorm (gvvi)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/spaces/instance/GeneralizedValidatedVector.java b/org/drip/spaces/instance/GeneralizedValidatedVector.java deleted file mode 100644 index d7e7613..0000000 --- a/org/drip/spaces/instance/GeneralizedValidatedVector.java +++ /dev/null @@ -1,80 +0,0 @@ - -package org.drip.spaces.instance; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ValidatedVectorInstance holds the Validated Vector Variate Instance Sequence and the Corresponding - * Generalized Vector Space Type. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public interface GeneralizedValidatedVector { - - /** - * Retrieve the Generalized Tensor Space Type - * - * @return The Generalized Tensor Space Type - */ - - public abstract org.drip.spaces.tensor.GeneralizedVector tensorSpaceType(); - - /** - * Retrieve the Sample Size - * - * @return The Sample Size - */ - - public abstract int sampleSize(); -} diff --git a/org/drip/spaces/instance/ValidatedR1.java b/org/drip/spaces/instance/ValidatedR1.java deleted file mode 100644 index 5b52544..0000000 --- a/org/drip/spaces/instance/ValidatedR1.java +++ /dev/null @@ -1,105 +0,0 @@ - -package org.drip.spaces.instance; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ValidatedR1 holds the Validated R^1 Vector Instance Sequence and the Corresponding Generalized Vector - * Space Type. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class ValidatedR1 implements org.drip.spaces.instance.GeneralizedValidatedVector { - private double[] _adblInstance = null; - private org.drip.spaces.tensor.R1GeneralizedVector _gvR1 = null; - - /** - * ValidatedR1 Constructor - * - * @param gvR1 The R^1 Tensor Space Type - * @param adblInstance The Data Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ValidatedR1 ( - final org.drip.spaces.tensor.R1GeneralizedVector gvR1, - final double[] adblInstance) - throws java.lang.Exception - { - if (null == (_gvR1 = gvR1) || null == (_adblInstance = adblInstance) || 0 == _adblInstance.length) - throw new java.lang.Exception ("ValidatedR1 ctr: Invalid Inputs"); - } - - @Override public org.drip.spaces.tensor.R1GeneralizedVector tensorSpaceType() - { - return _gvR1; - } - - /** - * Retrieve the Instance Sequence - * - * @return The Instance Sequence - */ - - public double[] instance() - { - return _adblInstance; - } - - @Override public int sampleSize() - { - return _adblInstance.length; - } -} diff --git a/org/drip/spaces/instance/ValidatedR1Combinatorial.java b/org/drip/spaces/instance/ValidatedR1Combinatorial.java deleted file mode 100644 index 894da44..0000000 --- a/org/drip/spaces/instance/ValidatedR1Combinatorial.java +++ /dev/null @@ -1,86 +0,0 @@ - -package org.drip.spaces.instance; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ValidatedR1Combinatorial holds the Validated R^1 Combinatorial Vector Instance Sequence and the - * Corresponding Generalized Vector Space Type. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class ValidatedR1Combinatorial extends org.drip.spaces.instance.ValidatedR1 { - - /** - * ValidatedR1Combinatorial Constructor - * - * @param cvR1 The Combinatorial R^1 Tensor Space Type - * @param adblInstance The Data Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ValidatedR1Combinatorial ( - final org.drip.spaces.tensor.R1CombinatorialVector cvR1, - final double[] adblInstance) - throws java.lang.Exception - { - super (cvR1, adblInstance); - } - - @Override public org.drip.spaces.tensor.R1CombinatorialVector tensorSpaceType() - { - return (org.drip.spaces.tensor.R1CombinatorialVector) super.tensorSpaceType(); - } -} diff --git a/org/drip/spaces/instance/ValidatedR1Continuous.java b/org/drip/spaces/instance/ValidatedR1Continuous.java deleted file mode 100644 index 915c580..0000000 --- a/org/drip/spaces/instance/ValidatedR1Continuous.java +++ /dev/null @@ -1,86 +0,0 @@ - -package org.drip.spaces.instance; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ValidatedR1Continuous holds the Validated R^1 Continuous Vector Instance Sequence and the Corresponding - * Generalized Vector Space Type. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class ValidatedR1Continuous extends org.drip.spaces.instance.ValidatedR1 { - - /** - * ValidatedR1Continuous Constructor - * - * @param cvR1 The Continuous R^1 Tensor Space Type - * @param adblInstance The Data Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ValidatedR1Continuous ( - final org.drip.spaces.tensor.R1ContinuousVector cvR1, - final double[] adblInstance) - throws java.lang.Exception - { - super (cvR1, adblInstance); - } - - @Override public org.drip.spaces.tensor.R1ContinuousVector tensorSpaceType() - { - return (org.drip.spaces.tensor.R1ContinuousVector) super.tensorSpaceType(); - } -} diff --git a/org/drip/spaces/instance/ValidatedRd.java b/org/drip/spaces/instance/ValidatedRd.java deleted file mode 100644 index 0337590..0000000 --- a/org/drip/spaces/instance/ValidatedRd.java +++ /dev/null @@ -1,105 +0,0 @@ - -package org.drip.spaces.instance; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ValidatedRd holds the Validated R^d Vector Instance Sequence and the Corresponding Generalized Vector - * Space Type. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class ValidatedRd implements org.drip.spaces.instance.GeneralizedValidatedVector { - private double[][] _aadblInstance = null; - private org.drip.spaces.tensor.RdGeneralizedVector _gvRd = null; - - /** - * ValidatedRd Constructor - * - * @param gvRd The R^d Tensor Space Type - * @param aadblInstance The Data Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ValidatedRd ( - final org.drip.spaces.tensor.RdGeneralizedVector gvRd, - final double[][] aadblInstance) - throws java.lang.Exception - { - if (null == (_gvRd = gvRd) || null == (_aadblInstance = aadblInstance) || 0 == _aadblInstance.length) - throw new java.lang.Exception ("ValidatedRd ctr: Invalid Inputs"); - } - - @Override public org.drip.spaces.tensor.RdGeneralizedVector tensorSpaceType() - { - return _gvRd; - } - - /** - * Retrieve the Instance Sequence - * - * @return The Instance Sequence - */ - - public double[][] instance() - { - return _aadblInstance; - } - - @Override public int sampleSize() - { - return _aadblInstance.length; - } -} diff --git a/org/drip/spaces/instance/ValidatedRdCombinatorial.java b/org/drip/spaces/instance/ValidatedRdCombinatorial.java deleted file mode 100644 index d18b4df..0000000 --- a/org/drip/spaces/instance/ValidatedRdCombinatorial.java +++ /dev/null @@ -1,86 +0,0 @@ - -package org.drip.spaces.instance; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ValidatedRdCombinatorial holds the Validated R^d R^d Vector Instance Sequence and the Corresponding - * Generalized Vector Space Type. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class ValidatedRdCombinatorial extends org.drip.spaces.instance.ValidatedRd { - - /** - * ValidatedRdCombinatorial Constructor - * - * @param cvRd The Combinatorial R^d Tensor Space Type - * @param aadblInstance The Data Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ValidatedRdCombinatorial ( - final org.drip.spaces.tensor.RdCombinatorialVector cvRd, - final double[][] aadblInstance) - throws java.lang.Exception - { - super (cvRd, aadblInstance); - } - - @Override public org.drip.spaces.tensor.RdCombinatorialVector tensorSpaceType() - { - return (org.drip.spaces.tensor.RdCombinatorialVector) super.tensorSpaceType(); - } -} diff --git a/org/drip/spaces/instance/ValidatedRdContinuous.java b/org/drip/spaces/instance/ValidatedRdContinuous.java deleted file mode 100644 index d2fc2f2..0000000 --- a/org/drip/spaces/instance/ValidatedRdContinuous.java +++ /dev/null @@ -1,86 +0,0 @@ - -package org.drip.spaces.instance; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ValidatedRdContinuous holds the Validated R^d Continuous Vector Instance Sequence and the Corresponding - * Generalized Vector Space Type. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class ValidatedRdContinuous extends org.drip.spaces.instance.ValidatedRd { - - /** - * ValidatedRdContinuous Constructor - * - * @param cvRd The Continuous R^d Tensor Space Type - * @param aadblInstance The Data Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ValidatedRdContinuous ( - final org.drip.spaces.tensor.RdContinuousVector cvRd, - final double[][] aadblInstance) - throws java.lang.Exception - { - super (cvRd, aadblInstance); - } - - @Override public org.drip.spaces.tensor.RdContinuousVector tensorSpaceType() - { - return (org.drip.spaces.tensor.RdContinuousVector) super.tensorSpaceType(); - } -} diff --git a/org/drip/spaces/iterator/IterationHelper.java b/org/drip/spaces/iterator/IterationHelper.java deleted file mode 100644 index 00ef418..0000000 --- a/org/drip/spaces/iterator/IterationHelper.java +++ /dev/null @@ -1,134 +0,0 @@ - -package org.drip.spaces.iterator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * IterationHelper contains the Functionality that helps perform Checked Multidimensional Iterative Scans. - * - * @author Lakshmi Krishnamurthy - */ - -public class IterationHelper { - - /** - * Scan through the Integer Array looking for a repeating Index - * - * @param ai The Index Array - * - * @return TRUE - A Repeating Index exists - */ - - public static final boolean CheckForRepeatingIndex ( - final int[] ai) - { - if (null == ai) return false; - - int iCursorLength = ai.length; - - if (1 >= iCursorLength) return false; - - for (int i = 0; i < iCursorLength; ++i) { - for (int j = i + 1; j < iCursorLength; ++j) { - if (ai[i] == ai[j]) return true; - } - } - - return false; - } - - /** - * Display the Contents of the Index Array - * - * @param strPrefix The Dump Prefix - * @param ai The Index Array - */ - - public static final void DumpIndexArray ( - final java.lang.String strPrefix, - final int[] ai) - { - if (null == ai) return; - - int iNumIndex = ai.length; - java.lang.String strIndexArray = strPrefix; - - if (0 >= iNumIndex) return; - - for (int i = 0; i < iNumIndex; ++i) - strIndexArray += (0 == i ? "[" : ",") + ai[i]; - - System.out.println (strIndexArray + "]"); - } - - /** - * Compose a String constructed from the specified Array Index - * - * @param strMaster The Master String - * @param aiIndex The Index Array - * - * @return The Composed String - */ - - public static final java.lang.String ComposeFromIndex ( - final java.lang.String strMaster, - final int[] aiIndex) - { - if (null == aiIndex) return null; - - int iNumIndex = aiIndex.length; - java.lang.String strOffOfIndex = ""; - - if (0 >= iNumIndex) return null; - - for (int i = 0; i < iNumIndex; ++i) - strOffOfIndex += strMaster.charAt (aiIndex[i]); - - return strOffOfIndex; - } -} diff --git a/org/drip/spaces/iterator/RdExhaustiveStateSpaceScan.java b/org/drip/spaces/iterator/RdExhaustiveStateSpaceScan.java deleted file mode 100644 index 28a8d01..0000000 --- a/org/drip/spaces/iterator/RdExhaustiveStateSpaceScan.java +++ /dev/null @@ -1,114 +0,0 @@ - -package org.drip.spaces.iterator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RdExhaustiveStateSpaceScan contains the Functionality to iterate exhaustively through the R^d Space. - * - * @author Lakshmi Krishnamurthy - */ - -public class RdExhaustiveStateSpaceScan extends org.drip.spaces.iterator.RdSpanningStateSpaceScan { - - /** - * RdExhaustiveStateSpaceScan Constructor - * - * @param aiTerminalStateIndex Upper Array Bounds for each Dimension - * @param bCyclicalScan TRUE - Cycle Post a Full Scan - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public RdExhaustiveStateSpaceScan ( - final int[] aiTerminalStateIndex, - final boolean bCyclicalScan) - throws java.lang.Exception - { - super (aiTerminalStateIndex, bCyclicalScan); - } - - @Override public int[] resetStateIndexCursor() - { - int iDimension = dimension(); - - int[] aiStateIndexCursor = stateIndexCursor(); - - for (int i = 0; i < iDimension; ++i) - aiStateIndexCursor[i] = 0; - - return setStateIndexCursor (aiStateIndexCursor) ? aiStateIndexCursor : null; - } - - @Override public int[] nextStateIndexCursor() - { - int iDimension = dimension(); - - int iStateIndexToUpdate = -1; - - int[] aiStateIndexCursor = stateIndexCursor(); - - int[] aiTerminalStateIndex = terminalStateIndex(); - - for (int i = iDimension - 1; i >= 0; --i) { - if (aiStateIndexCursor[i] != aiTerminalStateIndex[i] - 1) { - iStateIndexToUpdate = i; - break; - } - } - - if (-1 == iStateIndexToUpdate) return cyclicalScan() ? resetStateIndexCursor() : null; - - aiStateIndexCursor[iStateIndexToUpdate] = aiStateIndexCursor[iStateIndexToUpdate] + 1; - - for (int i = iStateIndexToUpdate + 1; i < iDimension; ++i) - aiStateIndexCursor[i] = 0; - - return setStateIndexCursor (aiStateIndexCursor) ? aiStateIndexCursor : null; - } -} diff --git a/org/drip/spaces/iterator/RdReceedingStateSpaceScan.java b/org/drip/spaces/iterator/RdReceedingStateSpaceScan.java deleted file mode 100644 index 0b9f30d..0000000 --- a/org/drip/spaces/iterator/RdReceedingStateSpaceScan.java +++ /dev/null @@ -1,124 +0,0 @@ - -package org.drip.spaces.iterator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RdReceedingStateSpaceScan is the Abstract Iterator Class that contains the Functionality to conduct a - * Receeding Scan through a R^d Space. - * - * @author Lakshmi Krishnamurthy - */ - -public class RdReceedingStateSpaceScan extends org.drip.spaces.iterator.RdSpanningStateSpaceScan { - - /** - * RdReceedingStateSpaceScan Constructor - * - * @param aiTerminalStateIndex Upper Array Bounds for each Dimension - * @param bCyclicalScan TRUE - Cycle Post a Full Scan - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public RdReceedingStateSpaceScan ( - final int[] aiTerminalStateIndex, - final boolean bCyclicalScan) - throws java.lang.Exception - { - super (aiTerminalStateIndex, bCyclicalScan); - - if (null == resetStateIndexCursor()) - throw new java.lang.Exception ("RdReceedingStateSpaceScan ctr => Invalid Inputs"); - } - - @Override public int[] resetStateIndexCursor() - { - int[] aiStateIndexCursor = stateIndexCursor(); - - int iDimension = dimension(); - - for (int i = 0; i < iDimension; ++i) - aiStateIndexCursor[i] = 0 == i ? 0 : aiStateIndexCursor[i - 1] + 1; - - return setStateIndexCursor (aiStateIndexCursor) ? aiStateIndexCursor : null; - } - - @Override public int[] nextStateIndexCursor() - { - int iDimension = dimension(); - - int iStateIndexToUpdate = -1; - - int[] aiStateIndexCursor = stateIndexCursor(); - - int[] aiTerminalStateIndex = terminalStateIndex(); - - for (int i = iDimension - 1; i >= 0; --i) { - if (aiStateIndexCursor[i] != aiTerminalStateIndex[i] - 1) { - iStateIndexToUpdate = i; - break; - } - } - - if (-1 == iStateIndexToUpdate) return cyclicalScan() ? resetStateIndexCursor() : null; - - aiStateIndexCursor[iStateIndexToUpdate] = aiStateIndexCursor[iStateIndexToUpdate] + 1; - - for (int i = iStateIndexToUpdate + 1; i < iDimension; ++i) { - int iSequentialDimensionIndex = aiStateIndexCursor[i - 1] + 1; - - if (iSequentialDimensionIndex >= aiTerminalStateIndex[i] - 1) - return cyclicalScan() ? resetStateIndexCursor() : null; - - aiStateIndexCursor[i] = iSequentialDimensionIndex; - } - - return aiStateIndexCursor; - } -} diff --git a/org/drip/spaces/iterator/RdSpanningCombinatorialIterator.java b/org/drip/spaces/iterator/RdSpanningCombinatorialIterator.java deleted file mode 100644 index 4d92538..0000000 --- a/org/drip/spaces/iterator/RdSpanningCombinatorialIterator.java +++ /dev/null @@ -1,168 +0,0 @@ - -package org.drip.spaces.iterator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RdSpanningCombinatorialIterator contains the Functionality to conduct a Spanning Iteration through an R^d - * Combinatorial Space. - * - * @author Lakshmi Krishnamurthy - */ - -public class RdSpanningCombinatorialIterator extends - org.drip.spaces.iterator.RdExhaustiveStateSpaceScan { - private org.drip.spaces.tensor.R1CombinatorialVector[] _aR1CV = null; - - /** - * Retrieve the RdSpanningCombinatorialIterator Instance associated with the Underlying Vector Space - * - * @param aR1CV Array of R^1 Combinatorial Vectors - * - * @return The RdSpanningCombinatorialIterator Instance associated with the Underlying Vector Space - */ - - public static final RdSpanningCombinatorialIterator Standard ( - final org.drip.spaces.tensor.R1CombinatorialVector[] aR1CV) - { - if (null == aR1CV) return null; - - int iDimension = aR1CV.length; - int[] aiMax = new int[iDimension]; - - if (0 == iDimension) return null; - - for (int i = 0; i < iDimension; ++i) - aiMax[i] = (int) aR1CV[i].cardinality().number(); - - try { - return new RdSpanningCombinatorialIterator (aR1CV, aiMax); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * RdSpanningCombinatorialIterator Constructor - * - * @param aR1CV Array of the R^1 Combinatorial Vectors - * @param aiMax The Array of Dimension Maximum - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public RdSpanningCombinatorialIterator ( - final org.drip.spaces.tensor.R1CombinatorialVector[] aR1CV, - final int[] aiMax) - throws java.lang.Exception - { - super (aiMax, false); - - if (null == (_aR1CV = aR1CV) || _aR1CV.length != aiMax.length) - throw new java.lang.Exception ("RdCombinatorialIterator ctr: Invalid Inputs"); - } - - /** - * Retrieve the Array of the R^1 Combinatorial Vectors - * - * @return The Array of the R^1 Combinatorial Vectors - */ - - public org.drip.spaces.tensor.R1CombinatorialVector[] r1() - { - return _aR1CV; - } - - /** - * Convert the Vector Space Index Array to the Variate Array - * - * @param aiIndex Vector Space Index Array - * - * @return Variate Array - */ - - public double[] vectorSpaceIndexToVariate ( - final int[] aiIndex) - { - if (null == aiIndex) return null; - - int iDimension = _aR1CV.length; - double[] adblVariate = new double[iDimension]; - - if (iDimension != aiIndex.length) return null; - - for (int i = 0; i < iDimension; ++i) - adblVariate[i] = _aR1CV[i].elementSpace().get (aiIndex[i]); - - return adblVariate; - } - - /** - * Retrieve the Cursor Variate Array - * - * @return The Cursor Variate Array - */ - - public double[] cursorVariates() - { - return vectorSpaceIndexToVariate (stateIndexCursor()); - } - - /** - * Retrieve the Subsequent Variate Array - * - * @return The Subsequent Variate Array - */ - - public double[] nextVariates() - { - return vectorSpaceIndexToVariate (nextStateIndexCursor()); - } -} diff --git a/org/drip/spaces/iterator/RdSpanningStateSpaceScan.java b/org/drip/spaces/iterator/RdSpanningStateSpaceScan.java deleted file mode 100644 index dec1cfd..0000000 --- a/org/drip/spaces/iterator/RdSpanningStateSpaceScan.java +++ /dev/null @@ -1,156 +0,0 @@ - -package org.drip.spaces.iterator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RdSpanningStateSpaceScan is the Abstract Iterator Class that contains the Functionality to perform a - * Spanning Iterative Scan through an R^d State Space. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class RdSpanningStateSpaceScan { - private boolean _bCyclicalScan = false; - private int[] _aiStateIndexCursor = null; - private int[] _aiTerminalStateIndex = null; - - protected RdSpanningStateSpaceScan ( - final int[] aiTerminalStateIndex, - final boolean bCyclicalScan) - throws java.lang.Exception - { - if (null == aiTerminalStateIndex) - throw new java.lang.Exception ("RdSpanningStateSpaceScan ctr: Invalid Input"); - - int iDimension = aiTerminalStateIndex.length; - _aiTerminalStateIndex = new int[iDimension]; - _aiStateIndexCursor = new int[iDimension]; - _bCyclicalScan = bCyclicalScan; - - if (0 == iDimension) - throw new java.lang.Exception ("RdSpanningStateSpaceScan ctr: Invalid Input"); - - for (int i = 0; i < iDimension; ++i) { - if (0 >= (_aiTerminalStateIndex[i] = aiTerminalStateIndex[i])) - throw new java.lang.Exception ("RdSpanningStateSpaceScan ctr: Invalid Input"); - - _aiStateIndexCursor[i] = 0; - } - } - - protected boolean setStateIndexCursor ( - final int[] aiStateIndexCursor) - { - if (null == _aiStateIndexCursor || _aiStateIndexCursor.length != _aiTerminalStateIndex.length) - return false; - - _aiStateIndexCursor = aiStateIndexCursor; - return true; - } - - /** - * Retrieve the Array of the Terminal State Indexes - * - * @return The Array of the Terminal State Indexes - */ - - public int[] terminalStateIndex() - { - return _aiTerminalStateIndex; - } - - /** - * Retrieve the Dimension - * - * @return The Dimension - */ - - public int dimension() - { - return _aiTerminalStateIndex.length; - } - - /** - * Retrieve the State Index Cursor - * - * @return The State Index Cursor - */ - - public int[] stateIndexCursor() - { - return _aiStateIndexCursor; - } - - /** - * Retrieve the Cyclical Scan Flag - * - * @return The Cyclical Scan Flag - */ - - public boolean cyclicalScan() - { - return _bCyclicalScan; - } - - /** - * Reset and retrieve the State Index Cursor - * - * @return The Reset State Index Cursor - */ - - public abstract int[] resetStateIndexCursor(); - - /** - * Move to the Subsequent Index Cursor - * - * @return The Subsequent Index Cursor - */ - - public abstract int[] nextStateIndexCursor(); -} diff --git a/org/drip/spaces/iterator/SequenceIndexIterator.java b/org/drip/spaces/iterator/SequenceIndexIterator.java deleted file mode 100644 index 9e4e529..0000000 --- a/org/drip/spaces/iterator/SequenceIndexIterator.java +++ /dev/null @@ -1,185 +0,0 @@ - -package org.drip.spaces.iterator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * SequenceIndexIterator contains the Functionality to iterate through a List of Sequence Indexes. - * - * @author Lakshmi Krishnamurthy - */ - -public class SequenceIndexIterator { - private int[] _aiMax = null; - private int _iIndexCursor = -1; - private boolean _bCycle = false; - private int _iSequenceCursor = -1; - - /** - * Create a Standard Sequence/Index Iterator - * - * @param iNumSequence Number Variable Sequences - * @param iNumIndex Number of Indexes per Variable Sequence - * - * @return The Sequence/Index Iterator Instance - */ - - public static final SequenceIndexIterator Standard ( - final int iNumSequence, - final int iNumIndex) - { - if (0 >= iNumSequence || 0 >= iNumIndex) return null; - - int[] aiMax = new int[iNumSequence]; - - for (int i = 0; i < iNumSequence; ++i) - aiMax[i] = iNumIndex - 1; - - try { - return new SequenceIndexIterator (aiMax, false); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private int[] setFromCursor() - { - int iNumSequence = _aiMax.length; - int[] aiCurrent = new int[iNumSequence]; - - for (int i = 0; i < iNumSequence; ++i) { - if (i < _iSequenceCursor) - aiCurrent[i] = _aiMax[i]; - else if (i > _iSequenceCursor) - aiCurrent[i] = 0; - else - aiCurrent[i] = _iIndexCursor; - } - - return aiCurrent; - } - - /** - * IndexIterator Constructor - * - * @param aiMax Maximum Entries per Index - * @param bCycle TRUE - Cycle around the Index Entries - * - * @throws java.lang.Exception Thrown if Inputs are incalid - */ - - public SequenceIndexIterator ( - final int[] aiMax, - final boolean bCycle) - throws java.lang.Exception - { - if (null == (_aiMax = aiMax)) - throw new java.lang.Exception ("SequenceIndexIterator ctr => Invalid Inputs"); - - _bCycle = bCycle; - _iIndexCursor = 0; - _iSequenceCursor = 0; - int iNumSequence = _aiMax.length; - - if (0 == iNumSequence) throw new java.lang.Exception ("SequenceIndexIterator ctr => Invalid Inputs"); - - for (int i = 0; i < iNumSequence; ++i) { - if (0 > _aiMax[i]) throw new java.lang.Exception ("SequenceIndexIterator ctr => Invalid Inputs"); - } - } - - /** - * Retrieve the First Cursor - * - * @return The First Cursor - */ - - public int[] first() - { - _iIndexCursor = 0; - _iSequenceCursor = 0; - - return setFromCursor(); - } - - /** - * Retrieve the Next Cursor - * - * @return The Next Cursor - */ - - public int[] next() - { - if (++_iIndexCursor <= _aiMax[_iSequenceCursor]) return setFromCursor(); - - _iIndexCursor = 0; - - if (++_iSequenceCursor < _aiMax.length) return setFromCursor(); - - return _bCycle ? first() : null; - } - - /** - * Retrieve the Size of the Iterator - * - * @return Size of the Iterator - */ - - public int size() - { - int iSize = 0; - int iNumSequence = _aiMax.length; - - for (int i = 0; i < iNumSequence; ++i) - iSize += _aiMax[i] + 1; - - return iSize; - } -} diff --git a/org/drip/spaces/metric/GeneralizedMetricVectorSpace.java b/org/drip/spaces/metric/GeneralizedMetricVectorSpace.java deleted file mode 100644 index e22a309..0000000 --- a/org/drip/spaces/metric/GeneralizedMetricVectorSpace.java +++ /dev/null @@ -1,77 +0,0 @@ - -package org.drip.spaces.metric; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * GeneralizedMetricVectorSpace exposes the basic Properties of the General Normed Metric Vector Space. - * - * @author Lakshmi Krishnamurthy - */ - -public interface GeneralizedMetricVectorSpace extends org.drip.spaces.tensor.GeneralizedVector { - - /** - * Retrieve the P-Norm Index of the Metric Space - * - * @return The P-Norm Index of the Metric Space - */ - - public abstract int pNorm(); - - /** - * Retrieve the Population Metric Norm - * - * @return The Population Metric Norm - * - * @throws java.lang.Exception The Population Metric Norm cannot be computed - */ - - public abstract double populationMetricNorm() - throws java.lang.Exception; -} diff --git a/org/drip/spaces/metric/R1Combinatorial.java b/org/drip/spaces/metric/R1Combinatorial.java deleted file mode 100644 index ac60a62..0000000 --- a/org/drip/spaces/metric/R1Combinatorial.java +++ /dev/null @@ -1,223 +0,0 @@ - -package org.drip.spaces.metric; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * R1Combinatorial implements the Normed, Bounded/Unbounded Combinatorial l^p R^1 Spaces. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class R1Combinatorial extends org.drip.spaces.tensor.R1CombinatorialVector implements - org.drip.spaces.metric.R1Normed { - private int _iPNorm = -1; - private org.drip.measure.continuousmarginal.R1 _distR1 = null; - - /** - * Construct the Standard l^p R^1 Combinatorial Space Instance - * - * @param lsElementSpace The List Space of Elements - * @param distR1 The R^1 Borel Sigma Measure - * @param iPNorm The p-norm of the Space - * - * @return The Standard l^p R^1 Combinatorial Space Instance - */ - - public static final R1Combinatorial Standard ( - final java.util.List lsElementSpace, - final org.drip.measure.continuousmarginal.R1 distR1, - final int iPNorm) - { - try { - return new R1Combinatorial (lsElementSpace, distR1, iPNorm); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct the Supremum (i.e., l^Infinity) R^1 Combinatorial Space Instance - * - * @param lsElementSpace The List Space of Elements - * @param distR1 The R^1 Borel Sigma Measure - * - * @return The Supremum (i.e., l^Infinity) R^1 Combinatorial Space Instance - */ - - public static final R1Combinatorial Supremum ( - final java.util.List lsElementSpace, - final org.drip.measure.continuousmarginal.R1 distR1) - { - try { - return new R1Combinatorial (lsElementSpace, distR1, java.lang.Integer.MAX_VALUE); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * R1Combinatorial Space Constructor - * - * @param lsElementSpace The List Space of Elements - * @param distR1 The R^1 Borel Sigma Measure - * @param iPNorm The p-norm of the Space - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public R1Combinatorial ( - final java.util.List lsElementSpace, - final org.drip.measure.continuousmarginal.R1 distR1, - final int iPNorm) - throws java.lang.Exception - { - super (lsElementSpace); - - if (0 > (_iPNorm = iPNorm)) - throw new java.lang.Exception ("R1Combinatorial Constructor: Invalid p-norm"); - - _distR1 = distR1; - } - - @Override public int pNorm() - { - return _iPNorm; - } - - @Override public org.drip.measure.continuousmarginal.R1 borelSigmaMeasure() - { - return _distR1; - } - - @Override public double sampleMetricNorm ( - final double dblX) - throws java.lang.Exception - { - if (!validateInstance (dblX)) - throw new java.lang.Exception ("R1Combinatorial::sampleMetricNorm => Invalid Inputs"); - - return java.lang.Math.abs (dblX); - } - - @Override public double populationMode() - throws java.lang.Exception - { - if (null == _distR1) - throw new java.lang.Exception ("R1Combinatorial::populationMode => Invalid Inputs"); - - double dblMode = java.lang.Double.NaN; - double dblModeProbability = java.lang.Double.NaN; - - for (double dblElement : elementSpace()) { - if (!org.drip.quant.common.NumberUtil.IsValid (dblMode)) - dblModeProbability = _distR1.density (dblMode = dblElement); - else { - double dblElementProbability = _distR1.density (dblElement); - - if (dblElementProbability > dblModeProbability) { - dblMode = dblElement; - dblModeProbability = dblElementProbability; - } - } - } - - return dblMode; - } - - @Override public double populationMetricNorm() - throws java.lang.Exception - { - if (null == _distR1) - throw new java.lang.Exception ("R1Combinatorial::populationMetricNorm => Invalid Inputs"); - - double dblNorm = 0.; - double dblNormalizer = 0.; - - for (double dblElement : elementSpace()) { - double dblElementProbability = _distR1.density (dblElement); - - dblNormalizer += dblElementProbability; - - dblNorm += sampleMetricNorm (dblElement) * dblElementProbability; - } - - return dblNorm / dblNormalizer; - } - - @Override public double borelMeasureSpaceExpectation ( - final org.drip.function.definition.R1ToR1 funcR1ToR1) - throws java.lang.Exception - { - if (null == funcR1ToR1 || null == _distR1) - throw new java.lang.Exception - ("R1Combinatorial::borelMeasureSpaceExpectation => Invalid Inputs"); - - double dblNormalizer = 0.; - double dblBorelMeasureSpaceExpectation = 0.; - - for (double dblElement : elementSpace()) { - double dblElementProbability = _distR1.density (dblElement); - - dblNormalizer += dblElementProbability; - - dblBorelMeasureSpaceExpectation += funcR1ToR1.evaluate (dblElement) * dblElementProbability; - } - - return dblBorelMeasureSpaceExpectation / dblNormalizer; - } -} diff --git a/org/drip/spaces/metric/R1CombinatorialBall.java b/org/drip/spaces/metric/R1CombinatorialBall.java deleted file mode 100644 index 510ac18..0000000 --- a/org/drip/spaces/metric/R1CombinatorialBall.java +++ /dev/null @@ -1,136 +0,0 @@ - -package org.drip.spaces.metric; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * R1CombinatorialBall extends the Combinatorial R^1 Banach Space by enforcing the Closed Bounded Metric. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class R1CombinatorialBall extends org.drip.spaces.metric.R1Combinatorial { - private double _dblNormRadius = java.lang.Double.NaN; - - /** - * Construct a R1CombinatorialBall Instance of Unit Radius - * - * @param lsElementSpace The List Space of Elements - * @param distR1 The R^1 Borel Sigma Measure - * @param iPNorm The p-norm of the Space - * - * @return ContinuousRealUnidimensionalBall Instance of Unit Radius - */ - - public static final R1CombinatorialBall ClosedUnit ( - final java.util.List lsElementSpace, - final org.drip.measure.continuousmarginal.R1 distR1, - final int iPNorm) - { - try { - return new R1CombinatorialBall (lsElementSpace, distR1, iPNorm, 1.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * R1CombinatorialBall Constructor - * - * @param lsElementSpace The List Space of Elements - * @param distR1 The R^1 Borel Sigma Measure - * @param iPNorm The p-norm of the Space - * @param dblNormRadius Radius Norm of the Unit Ball - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public R1CombinatorialBall ( - final java.util.List lsElementSpace, - final org.drip.measure.continuousmarginal.R1 distR1, - final int iPNorm, - final double dblNormRadius) - throws java.lang.Exception - { - super (lsElementSpace, distR1, iPNorm); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblNormRadius = dblNormRadius) || 0. >= - _dblNormRadius) - throw new java.lang.Exception ("R1CombinatorialBall Constructor: Invalid Inputs"); - } - - /** - * Retrieve the Radius Norm - * - * @return The Radius Norm - */ - - public double normRadius() - { - return _dblNormRadius; - } - - @Override public boolean validateInstance ( - final double dblInstance) - { - try { - return super.validateInstance (dblInstance) && _dblNormRadius <= sampleMetricNorm (dblInstance); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } -} diff --git a/org/drip/spaces/metric/R1Continuous.java b/org/drip/spaces/metric/R1Continuous.java deleted file mode 100644 index 817a5de..0000000 --- a/org/drip/spaces/metric/R1Continuous.java +++ /dev/null @@ -1,223 +0,0 @@ - -package org.drip.spaces.metric; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * R1Continuous implements the Normed, Bounded/Unbounded Continuous l^p R^1 Spaces. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class R1Continuous extends org.drip.spaces.tensor.R1ContinuousVector implements - org.drip.spaces.metric.R1Normed { - private int _iPNorm = -1; - private org.drip.measure.continuousmarginal.R1 _distR1 = null; - - /** - * Construct the Standard l^p R^1 Continuous Space Instance - * - * @param dblLeftEdge The Left Edge - * @param dblRightEdge The Right Edge - * @param distR1 The R^1 Borel Sigma Measure - * @param iPNorm The p-norm of the Space - * - * @return The Standard l^p R^1 Continuous Space Instance - */ - - public static final R1Continuous Standard ( - final double dblLeftEdge, - final double dblRightEdge, - final org.drip.measure.continuousmarginal.R1 distR1, - final int iPNorm) - { - try { - return new R1Continuous (dblLeftEdge, dblRightEdge, distR1, iPNorm); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct the Supremum (i.e., l^Infinity) R^1 Continuous Space Instance - * - * @param dblLeftEdge The Left Edge - * @param dblRightEdge The Right Edge - * @param distR1 The R^1 Borel Sigma Measure - * - * @return The Supremum (i.e., l^Infinity) R^1 Continuous Space Instance - */ - - public static final R1Continuous Supremum ( - final double dblLeftEdge, - final double dblRightEdge, - final org.drip.measure.continuousmarginal.R1 distR1) - { - try { - return new R1Continuous (dblLeftEdge, dblRightEdge, distR1, java.lang.Integer.MAX_VALUE); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * R1Continuous Space Constructor - * - * @param dblLeftEdge The Left Edge - * @param dblRightEdge The Right Edge - * @param distR1 The R^1 Borel Sigma Measure - * @param iPNorm The p-norm of the Space - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public R1Continuous ( - final double dblLeftEdge, - final double dblRightEdge, - final org.drip.measure.continuousmarginal.R1 distR1, - final int iPNorm) - throws java.lang.Exception - { - super (dblLeftEdge, dblRightEdge); - - if (0 > (_iPNorm = iPNorm)) - throw new java.lang.Exception ("R1Continuous Constructor: Invalid p-norm"); - - _distR1 = distR1; - } - - @Override public int pNorm() - { - return _iPNorm; - } - - @Override public org.drip.measure.continuousmarginal.R1 borelSigmaMeasure() - { - return _distR1; - } - - @Override public double sampleMetricNorm ( - final double dblX) - throws java.lang.Exception - { - if (!validateInstance (dblX)) - throw new java.lang.Exception ("R1Continuous::sampleMetricNorm => Invalid Inputs"); - - return java.lang.Math.abs (dblX); - } - - @Override public double populationMode() - throws java.lang.Exception - { - if (null == _distR1) - throw new java.lang.Exception ("R1Continuous::populationMode => Invalid Inputs"); - - org.drip.function.definition.R1ToR1 funcR1ToR1 = new org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - return _distR1.density (dblX); - } - }; - - org.drip.function.definition.VariateOutputPair vopMode = funcR1ToR1.maxima (leftEdge(), rightEdge()); - - if (null == vopMode) - throw new java.lang.Exception ("R1Continuous::populationMode => Cannot compute VOP Mode"); - - return vopMode.variates()[0]; - } - - @Override public double populationMetricNorm() - throws java.lang.Exception - { - if (null == _distR1) - throw new java.lang.Exception ("R1Continuous::populationMetricNorm => Invalid Inputs"); - - org.drip.function.definition.R1ToR1 funcR1ToR1 = new org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - return sampleMetricNorm (dblX) * _distR1.density (dblX); - } - }; - - return funcR1ToR1.integrate (leftEdge(), rightEdge()); - } - - @Override public double borelMeasureSpaceExpectation ( - final org.drip.function.definition.R1ToR1 funcR1ToR1) - throws java.lang.Exception - { - if (null == funcR1ToR1 || null == _distR1) - throw new java.lang.Exception ("R1Continuous::borelMeasureSpaceExpectation => Invalid Inputs"); - - org.drip.function.definition.R1ToR1 funcDensityR1ToR1 = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - return funcR1ToR1.evaluate (dblX) * _distR1.density (dblX); - } - }; - - return funcDensityR1ToR1.integrate (leftEdge(), rightEdge()); - } -} diff --git a/org/drip/spaces/metric/R1ContinuousBall.java b/org/drip/spaces/metric/R1ContinuousBall.java deleted file mode 100644 index 977015d..0000000 --- a/org/drip/spaces/metric/R1ContinuousBall.java +++ /dev/null @@ -1,140 +0,0 @@ - -package org.drip.spaces.metric; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * R1ContinuousBall extends the Continuous R^1 Banach Space by enforcing the Closed Bounded Metric. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class R1ContinuousBall extends org.drip.spaces.metric.R1Continuous { - private double _dblNormRadius = java.lang.Double.NaN; - - /** - * Construct a R1ContinuousBall Instance of Unit Radius - * - * @param dblLeftEdge The Left Edge - * @param dblRightEdge The Right Edge - * @param distR1 The R^1 Borel Sigma Measure - * @param iPNorm The p-norm of the Space - * - * @return R1ContinuousBall Instance of Unit Radius - */ - - public static final R1ContinuousBall ClosedUnit ( - final double dblLeftEdge, - final double dblRightEdge, - final org.drip.measure.continuousmarginal.R1 distR1, - final int iPNorm) - { - try { - return new R1ContinuousBall (dblLeftEdge, dblRightEdge, distR1, iPNorm, 1.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * R1ContinuousBall Constructor - * - * @param dblLeftEdge The Left Edge - * @param dblRightEdge The Right Edge - * @param distR1 The R^1 Borel Sigma Measure - * @param iPNorm The p-norm of the Space - * @param dblNormRadius Radius Norm of the Unit Ball - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public R1ContinuousBall ( - final double dblLeftEdge, - final double dblRightEdge, - final org.drip.measure.continuousmarginal.R1 distR1, - final int iPNorm, - final double dblNormRadius) - throws java.lang.Exception - { - super (dblLeftEdge, dblRightEdge, distR1, iPNorm); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblNormRadius = dblNormRadius) || 0. >= - _dblNormRadius) - throw new java.lang.Exception ("R1ContinuousBall Constructor: Invalid Inputs"); - } - - /** - * Retrieve the Radius Norm - * - * @return The Radius Norm - */ - - public double normRadius() - { - return _dblNormRadius; - } - - @Override public boolean validateInstance ( - final double dblInstance) - { - try { - return super.validateInstance (dblInstance) && _dblNormRadius <= sampleMetricNorm (dblInstance); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } -} diff --git a/org/drip/spaces/metric/R1Normed.java b/org/drip/spaces/metric/R1Normed.java deleted file mode 100644 index 941d5b4..0000000 --- a/org/drip/spaces/metric/R1Normed.java +++ /dev/null @@ -1,111 +0,0 @@ - -package org.drip.spaces.metric; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * R1Normed Abstract Class implements the Normed, Bounded/Unbounded Continuous/Combinatorial l^p R^1 Spaces. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public interface R1Normed extends org.drip.spaces.metric.GeneralizedMetricVectorSpace, - org.drip.spaces.tensor.R1GeneralizedVector { - - /** - * Retrieve the Borel Sigma R^1 Probability Measure - * - * @return The Borel Sigma R^1 Probability Measure - */ - - public abstract org.drip.measure.continuousmarginal.R1 borelSigmaMeasure(); - - /** - * Compute the Metric Norm of the Sample - * - * @param dblX The Sample - * - * @return The Metric Norm of the Sample - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public abstract double sampleMetricNorm ( - final double dblX) - throws java.lang.Exception; - - /** - * Retrieve the Population Mode - * - * @return The Population Mode - * - * @throws java.lang.Exception Thrown if the Population Mode cannot be calculated - */ - - public double populationMode() - throws java.lang.Exception; - - /** - * Compute the Borel Measure Expectation for the specified R^1 To R^1 Function over the full Input Space - * - * @param funcR1ToR1 R^1 To R^1 Function Instance - * - * @return The Borel Measure Expectation for the specified R^1 To R^1 Function over the full Input Space - * - * @throws java.lang.Exception Thrown if the Population Mode cannot be calculated - */ - - public double borelMeasureSpaceExpectation ( - final org.drip.function.definition.R1ToR1 funcR1ToR1) - throws java.lang.Exception; -} diff --git a/org/drip/spaces/metric/RdCombinatorialBall.java b/org/drip/spaces/metric/RdCombinatorialBall.java deleted file mode 100644 index 9467452..0000000 --- a/org/drip/spaces/metric/RdCombinatorialBall.java +++ /dev/null @@ -1,137 +0,0 @@ - -package org.drip.spaces.metric; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RdCombinatorialBall extends the Combinatorial R^d Banach Space by enforcing the Closed Bounded Metric. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class RdCombinatorialBall extends org.drip.spaces.metric.RdCombinatorialBanach { - private double _dblNormRadius = java.lang.Double.NaN; - - /** - * Construct a RdCombinatorialBall Instance of Unit Radius - * - * @param aR1CV Array of Combinatorial R^d Vector Spaces - * @param distRd The R^d Borel Sigma Measure - * @param iPNorm The p-norm of the Space - * - * @return RdCombinatorialBall Instance of Unit Radius - */ - - public static final RdCombinatorialBall ClosedUnit ( - final org.drip.spaces.tensor.R1CombinatorialVector[] aR1CV, - final org.drip.measure.continuousmarginal.Rd distRd, - final int iPNorm) - { - try { - return new RdCombinatorialBall (aR1CV, distRd, iPNorm, 1.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * RdCombinatorialBall Constructor - * - * @param aR1CV Array of Combinatorial R^d Vector Spaces - * @param distRd The R^d Borel Sigma Measure - * @param iPNorm The p-norm of the Space - * @param dblNormRadius Radius Norm of the Unit Ball - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public RdCombinatorialBall ( - final org.drip.spaces.tensor.R1CombinatorialVector[] aR1CV, - final org.drip.measure.continuousmarginal.Rd distRd, - final int iPNorm, - final double dblNormRadius) - throws java.lang.Exception - { - super (aR1CV, distRd, iPNorm); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblNormRadius = dblNormRadius) || 0. >= - _dblNormRadius) - throw new java.lang.Exception ("RdCombinatorialBall Constructor: Invalid Inputs"); - } - - /** - * Retrieve the Radius Norm - * - * @return The Radius Norm - */ - - public double normRadius() - { - return _dblNormRadius; - } - - @Override public boolean validateInstance ( - final double[] adblInstance) - { - try { - return super.validateInstance (adblInstance) && _dblNormRadius <= sampleMetricNorm - (adblInstance); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } -} diff --git a/org/drip/spaces/metric/RdCombinatorialBanach.java b/org/drip/spaces/metric/RdCombinatorialBanach.java deleted file mode 100644 index 70096ad..0000000 --- a/org/drip/spaces/metric/RdCombinatorialBanach.java +++ /dev/null @@ -1,243 +0,0 @@ - -package org.drip.spaces.metric; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RdCombinatorialBanach implements the Bounded/Unbounded Combinatorial l^p R^d Spaces. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class RdCombinatorialBanach extends org.drip.spaces.tensor.RdCombinatorialVector implements - org.drip.spaces.metric.RdNormed { - private int _iPNorm = -1; - private org.drip.measure.continuousmarginal.Rd _distRd = null; - - /** - * RdCombinatorialBanach Space Constructor - * - * @param aR1CV Array of Combinatorial R^1 Vector Spaces - * @param distRd The R^d Borel Sigma Measure - * @param iPNorm The p-norm of the Space - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public RdCombinatorialBanach ( - final org.drip.spaces.tensor.R1CombinatorialVector[] aR1CV, - final org.drip.measure.continuousmarginal.Rd distRd, - final int iPNorm) - throws java.lang.Exception - { - super (aR1CV); - - if (0 > (_iPNorm = iPNorm)) - throw new java.lang.Exception ("RdCombinatorialBanach Constructor: Invalid p-norm"); - - _distRd = distRd; - } - - @Override public int pNorm() - { - return _iPNorm; - } - - @Override public org.drip.measure.continuousmarginal.Rd borelSigmaMeasure() - { - return _distRd; - } - - @Override public double sampleSupremumNorm ( - final double[] adblX) - throws java.lang.Exception - { - if (!validateInstance (adblX)) - throw new java.lang.Exception ("RdCombinatorialBanach::sampleSupremumNorm => Invalid Inputs"); - - int iDimension = adblX.length; - - double dblNorm = java.lang.Math.abs (adblX[0]); - - for (int i = 1; i < iDimension; ++i) { - double dblAbsoluteX = java.lang.Math.abs (adblX[i]); - - dblNorm = dblNorm > dblAbsoluteX ? dblNorm : dblAbsoluteX; - } - - return dblNorm; - } - - @Override public double sampleMetricNorm ( - final double[] adblX) - throws java.lang.Exception - { - if (!validateInstance (adblX)) - throw new java.lang.Exception ("RdCombinatorialBanach::sampleMetricNorm => Invalid Inputs"); - - if (java.lang.Integer.MAX_VALUE == _iPNorm) return sampleSupremumNorm (adblX); - - double dblNorm = 0.; - int iDimension = adblX.length; - - for (int i = 0; i < iDimension; ++i) - dblNorm += java.lang.Math.pow (java.lang.Math.abs (adblX[i]), _iPNorm); - - return java.lang.Math.pow (dblNorm, 1. / _iPNorm); - } - - @Override public double[] populationMode() - { - if (null == _distRd) return null; - - org.drip.spaces.iterator.RdSpanningCombinatorialIterator crmi = iterator(); - - double[] adblVariate = crmi.cursorVariates(); - - int iDimension = adblVariate.length; - double dblModeProbabilityDensity = 0.; - double[] adblModeVariate = new double[iDimension]; - double dblProbabilityDensity = java.lang.Double.NaN; - - while (null != adblVariate) { - try { - dblProbabilityDensity = _distRd.density (adblVariate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (dblProbabilityDensity > dblModeProbabilityDensity) { - for (int i = 0; i < iDimension; ++i) - adblModeVariate[i] = adblVariate[i]; - - dblModeProbabilityDensity = dblProbabilityDensity; - } - - adblVariate = crmi.nextVariates(); - } - - return adblModeVariate; - } - - @Override public double populationSupremumNorm() - throws java.lang.Exception - { - if (null == _distRd) - throw new java.lang.Exception - ("RdCombinatorialBanach::populationSupremumNorm => Invalid Inputs"); - - return sampleSupremumNorm (populationMode()); - } - - @Override public double populationMetricNorm() - throws java.lang.Exception - { - if (java.lang.Integer.MAX_VALUE == _iPNorm) return sampleSupremumNorm (populationMode()); - - if (null == _distRd) - throw new java.lang.Exception - ("RdCombinatorialBanach::populationMetricNorm => No Multivariate Distribution"); - - org.drip.spaces.iterator.RdSpanningCombinatorialIterator crmi = iterator(); - - double[] adblVariate = crmi.cursorVariates(); - - double dblNormalizer = 0.; - double dblPopulationMetricNorm = 0.; - int iDimension = adblVariate.length; - - while (null != adblVariate) { - double dblProbabilityDensity = _distRd.density (adblVariate); - - dblNormalizer += dblProbabilityDensity; - - for (int i = 0; i < iDimension; ++i) - dblPopulationMetricNorm += dblProbabilityDensity * java.lang.Math.pow (java.lang.Math.abs - (adblVariate[i]), _iPNorm); - - adblVariate = crmi.nextVariates(); - } - - return java.lang.Math.pow (dblPopulationMetricNorm / dblNormalizer, 1. / _iPNorm); - } - - @Override public double borelMeasureSpaceExpectation ( - final org.drip.function.definition.RdToR1 funcRdToR1) - throws java.lang.Exception - { - if (null == _distRd || null == funcRdToR1) - throw new java.lang.Exception - ("RdCombinatorialBanach::borelMeasureSpaceExpectation => Invalid Inputs"); - - org.drip.spaces.iterator.RdSpanningCombinatorialIterator crmi = iterator(); - - double[] adblVariate = crmi.cursorVariates(); - - double dblBorelMeasureSpaceExpectation = 0.; - double dblNormalizer = 0.; - - while (null != adblVariate) { - double dblProbabilityDensity = _distRd.density (adblVariate); - - dblNormalizer += dblProbabilityDensity; - - dblBorelMeasureSpaceExpectation += dblProbabilityDensity * funcRdToR1.evaluate (adblVariate); - - adblVariate = crmi.nextVariates(); - } - - return dblBorelMeasureSpaceExpectation / dblNormalizer; - } -} diff --git a/org/drip/spaces/metric/RdCombinatorialHilbert.java b/org/drip/spaces/metric/RdCombinatorialHilbert.java deleted file mode 100644 index bdd3057..0000000 --- a/org/drip/spaces/metric/RdCombinatorialHilbert.java +++ /dev/null @@ -1,99 +0,0 @@ - -package org.drip.spaces.metric; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RdCombinatorialHilbert implements the Bounded/Unbounded, Combinatorial l^2 R^d Spaces. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class RdCombinatorialHilbert extends org.drip.spaces.metric.RdCombinatorialBanach { - - /** - * RdCombinatorialHilbert Space Constructor - * - * @param aR1CV Array of Combinatorial R^1 Vector Spaces - * @param distRd The R^d Borel Sigma Measure - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public RdCombinatorialHilbert ( - final org.drip.spaces.tensor.R1CombinatorialVector[] aR1CV, - final org.drip.measure.continuousmarginal.Rd distRd) - throws java.lang.Exception - { - super (aR1CV, distRd, 2); - } - - @Override public double sampleMetricNorm ( - final double[] adblX) - throws java.lang.Exception - { - if (!validateInstance (adblX)) - throw new java.lang.Exception ("RdCombinatorialHilbert::sampleMetricNorm => Invalid Inputs"); - - double dblNorm = 0.; - int iDimension = adblX.length; - - for (int i = 0; i < iDimension; ++i) { - double dblAbsoluteX = java.lang.Math.abs (adblX[i]); - - dblNorm += dblAbsoluteX * dblAbsoluteX; - } - - return dblNorm; - } -} diff --git a/org/drip/spaces/metric/RdContinuousBall.java b/org/drip/spaces/metric/RdContinuousBall.java deleted file mode 100644 index 0d707ae..0000000 --- a/org/drip/spaces/metric/RdContinuousBall.java +++ /dev/null @@ -1,137 +0,0 @@ - -package org.drip.spaces.metric; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RdContinuousBall extends the Continuous R^d Banach Space by enforcing the Closed Bounded Metric. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class RdContinuousBall extends org.drip.spaces.metric.RdContinuousBanach { - private double _dblNormRadius = java.lang.Double.NaN; - - /** - * Construct a Unit Radius RdContinuousBall Instance - * - * @param aR1CV Array of Continuous R^1 Vector Spaces - * @param distRd The R^d Borel Sigma Measure - * @param iPNorm The p-norm of the Space - * - * @return Unit Radius RdContinuousBall Instance - */ - - public static final RdContinuousBall ClosedUnit ( - final org.drip.spaces.tensor.R1ContinuousVector[] aR1CV, - final org.drip.measure.continuousmarginal.Rd distRd, - final int iPNorm) - { - try { - return new RdContinuousBall (aR1CV, distRd, iPNorm, 1.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * RdContinuousBall Constructor - * - * @param aR1CV Array of Continuous R^1 Vector Spaces - * @param distRd The R^d Borel Sigma Measure - * @param iPNorm The p-norm of the Space - * @param dblNormRadius Radius Norm of the Unit Ball - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public RdContinuousBall ( - final org.drip.spaces.tensor.R1ContinuousVector[] aR1CV, - final org.drip.measure.continuousmarginal.Rd distRd, - final int iPNorm, - final double dblNormRadius) - throws java.lang.Exception - { - super (aR1CV, distRd, iPNorm); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblNormRadius = dblNormRadius) || 0. >= - _dblNormRadius) - throw new java.lang.Exception ("RdContinuousBall Constructor: Invalid Inputs"); - } - - /** - * Retrieve the Radius Norm - * - * @return The Radius Norm - */ - - public double normRadius() - { - return _dblNormRadius; - } - - @Override public boolean validateInstance ( - final double[] adblInstance) - { - try { - return super.validateInstance (adblInstance) && _dblNormRadius <= sampleMetricNorm - (adblInstance); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } -} diff --git a/org/drip/spaces/metric/RdContinuousBanach.java b/org/drip/spaces/metric/RdContinuousBanach.java deleted file mode 100644 index a0907c0..0000000 --- a/org/drip/spaces/metric/RdContinuousBanach.java +++ /dev/null @@ -1,277 +0,0 @@ - -package org.drip.spaces.metric; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RdContinuousBanach implements the Normed, Bounded/Unbounded Continuous l^p R^d Spaces. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class RdContinuousBanach extends org.drip.spaces.tensor.RdContinuousVector implements - org.drip.spaces.metric.RdNormed { - private int _iPNorm = -1; - private org.drip.measure.continuousmarginal.Rd _distRd = null; - - /** - * Construct the Standard l^p R^d Continuous Banach Space Instance - * - * @param iDimension The Space Dimension - * @param distRd The R^d Borel Sigma Measure - * @param iPNorm The p-norm of the Space - * - * @return The Standard l^p R^d Continuous Banach Space Instance - */ - - public static final RdContinuousBanach StandardBanach ( - final int iDimension, - final org.drip.measure.continuousmarginal.Rd distRd, - final int iPNorm) - { - try { - return 0 >= iDimension ? null : new RdContinuousBanach (new - org.drip.spaces.tensor.R1ContinuousVector[iDimension], distRd, iPNorm); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct the Supremum (i.e., l^Infinity) R^d Continuous Banach Space Instance - * - * @param iDimension The Space Dimension - * @param distRd The R^d Borel Sigma Measure - * - * @return The Supremum (i.e., l^Infinity) R^d Continuous Banach Space Instance - */ - - public static final RdContinuousBanach SupremumBanach ( - final int iDimension, - final org.drip.measure.continuousmarginal.Rd distRd) - { - try { - return 0 >= iDimension ? null : new RdContinuousBanach (new - org.drip.spaces.tensor.R1ContinuousVector[iDimension], distRd, java.lang.Integer.MAX_VALUE); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * RdContinuousBanach Space Constructor - * - * @param aR1CV Array of R^1 Continuous Vector - * @param distRd The R^d Borel Sigma Measure - * @param iPNorm The p-norm of the Space - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public RdContinuousBanach ( - final org.drip.spaces.tensor.R1ContinuousVector[] aR1CV, - final org.drip.measure.continuousmarginal.Rd distRd, - final int iPNorm) - throws java.lang.Exception - { - super (aR1CV); - - if (0 > (_iPNorm = iPNorm)) - throw new java.lang.Exception ("RdContinuousBanach Constructor: Invalid p-norm"); - - _distRd = distRd; - } - - @Override public int pNorm() - { - return _iPNorm; - } - - @Override public org.drip.measure.continuousmarginal.Rd borelSigmaMeasure() - { - return _distRd; - } - - @Override public double sampleSupremumNorm ( - final double[] adblX) - throws java.lang.Exception - { - if (!validateInstance (adblX)) - throw new java.lang.Exception ("RdContinuousBanach::sampleSupremumNorm => Invalid Inputs"); - - int iDimension = adblX.length; - - double dblNorm = java.lang.Math.abs (adblX[0]); - - for (int i = 1; i < iDimension; ++i) { - double dblAbsoluteX = java.lang.Math.abs (adblX[i]); - - dblNorm = dblNorm > dblAbsoluteX ? dblNorm : dblAbsoluteX; - } - - return dblNorm; - } - - @Override public double sampleMetricNorm ( - final double[] adblX) - throws java.lang.Exception - { - if (!validateInstance (adblX)) - throw new java.lang.Exception ("RdContinuousBanach::sampleMetricNorm => Invalid Inputs"); - - if (java.lang.Integer.MAX_VALUE == _iPNorm) return sampleSupremumNorm (adblX); - - double dblNorm = 0.; - int iDimension = adblX.length; - - for (int i = 0; i < iDimension; ++i) - dblNorm += java.lang.Math.pow (java.lang.Math.abs (adblX[i]), _iPNorm); - - return java.lang.Math.pow (dblNorm, 1. / _iPNorm); - } - - @Override public double[] populationMode() - { - if (null == _distRd) return null; - - org.drip.function.definition.RdToR1 funcRdToR1 = new org.drip.function.definition.RdToR1 (null) { - @Override public int dimension() - { - return org.drip.function.definition.RdToR1.DIMENSION_NOT_FIXED; - } - - @Override public double evaluate ( - final double[] adblX) - throws java.lang.Exception - { - return _distRd.density (adblX); - } - }; - - org.drip.function.definition.VariateOutputPair vopMode = funcRdToR1.maxima (leftDimensionEdge(), - rightDimensionEdge()); - - return null == vopMode ? null : vopMode.variates(); - } - - @Override public double populationSupremumNorm() - throws java.lang.Exception - { - if (null == _distRd) - throw new java.lang.Exception ("RdContinuousBanach::populationSupremumNorm => Invalid Inputs"); - - return sampleSupremumNorm (populationMode()); - } - - @Override public double populationMetricNorm() - throws java.lang.Exception - { - if (null == _distRd) - throw new java.lang.Exception ("RdContinuousBanach::populationMetricNorm => Invalid Inputs"); - - if (java.lang.Integer.MAX_VALUE == _iPNorm) return sampleSupremumNorm (populationMode()); - - org.drip.function.definition.RdToR1 funcRdToR1 = new org.drip.function.definition.RdToR1 (null) { - @Override public int dimension() - { - return org.drip.function.definition.RdToR1.DIMENSION_NOT_FIXED; - } - - @Override public double evaluate ( - final double[] adblX) - throws java.lang.Exception - { - double dblNorm = 0.; - int iDimension = adblX.length; - - for (int i = 0; i < iDimension; ++i) - dblNorm += java.lang.Math.pow (java.lang.Math.abs (adblX[i]), _iPNorm); - - return dblNorm * _distRd.density (adblX); - } - }; - - return java.lang.Math.pow (funcRdToR1.integrate (leftDimensionEdge(), rightDimensionEdge()), 1. / - _iPNorm); - } - - @Override public double borelMeasureSpaceExpectation ( - final org.drip.function.definition.RdToR1 funcRdToR1) - throws java.lang.Exception - { - if (null == _distRd || null == funcRdToR1) - throw new java.lang.Exception - ("RdContinuousBanach::borelMeasureSpaceExpectation => Invalid Inputs"); - - org.drip.function.definition.RdToR1 funcDensityRdToR1 = new org.drip.function.definition.RdToR1 - (null) { - @Override public int dimension() - { - return org.drip.function.definition.RdToR1.DIMENSION_NOT_FIXED; - } - - @Override public double evaluate ( - final double[] adblX) - throws java.lang.Exception - { - return funcRdToR1.evaluate (adblX) * _distRd.density (adblX); - } - }; - - return funcDensityRdToR1.integrate (leftDimensionEdge(), rightDimensionEdge()); - } -} diff --git a/org/drip/spaces/metric/RdContinuousHilbert.java b/org/drip/spaces/metric/RdContinuousHilbert.java deleted file mode 100644 index 47df8c2..0000000 --- a/org/drip/spaces/metric/RdContinuousHilbert.java +++ /dev/null @@ -1,122 +0,0 @@ - -package org.drip.spaces.metric; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RdContinuousHilbert implements the Bounded/Unbounded, Continuous l^2 R^d Spaces. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class RdContinuousHilbert extends org.drip.spaces.metric.RdContinuousBanach { - - /** - * Construct the Standard l^2 R^d Hilbert Space Instance - * - * @param iDimension The Space Dimension - * @param distRd The R^d Borel Sigma Measure - * - * @return The Standard l^2 R^d Hilbert Space Instance - */ - - public static final RdContinuousHilbert StandardHilbert ( - final int iDimension, - final org.drip.measure.continuousmarginal.Rd distRd) - { - try { - return 0 >= iDimension ? null : new RdContinuousHilbert (new - org.drip.spaces.tensor.R1ContinuousVector[iDimension], distRd); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * RdContinuousHilbert Space Constructor - * - * @param aR1CV Array of R^1 Continuous Vector Spaces - * @param distRd The Multivariate Borel Sigma Measure - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public RdContinuousHilbert ( - final org.drip.spaces.tensor.R1ContinuousVector[] aR1CV, - final org.drip.measure.continuousmarginal.Rd distRd) - throws java.lang.Exception - { - super (aR1CV, distRd, 2); - } - - @Override public double sampleMetricNorm ( - final double[] adblX) - throws java.lang.Exception - { - if (!validateInstance (adblX)) - throw new java.lang.Exception ("RdContinuousHilbert::sampleMetricNorm => Invalid Inputs"); - - double dblNorm = 0.; - int iDimension = adblX.length; - - for (int i = 0; i < iDimension; ++i) { - double dblAbsoluteX = java.lang.Math.abs (adblX[i]); - - dblNorm += dblAbsoluteX * dblAbsoluteX; - } - - return dblNorm; - } -} diff --git a/org/drip/spaces/metric/RdNormed.java b/org/drip/spaces/metric/RdNormed.java deleted file mode 100644 index 4a96a96..0000000 --- a/org/drip/spaces/metric/RdNormed.java +++ /dev/null @@ -1,133 +0,0 @@ - -package org.drip.spaces.metric; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RdNormed Abstract Class implements the Normed, Bounded/Unbounded Continuous/Combinatorial l^p R^d Spaces. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public interface RdNormed extends org.drip.spaces.metric.GeneralizedMetricVectorSpace, - org.drip.spaces.tensor.RdGeneralizedVector { - - /** - * Retrieve the Borel Sigma R^d Probability Measure - * - * @return The Borel Sigma R^d Probability Measure - */ - - public abstract org.drip.measure.continuousmarginal.Rd borelSigmaMeasure(); - - /** - * Compute the Supremum Norm of the Sample - * - * @param adblX The Sample - * - * @return The Supremum Norm of the Sample - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public abstract double sampleSupremumNorm ( - final double[] adblX) - throws java.lang.Exception; - - /** - * Compute the Metric Norm of the Sample - * - * @param adblX The Sample - * - * @return The Metric Norm of the Sample - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public abstract double sampleMetricNorm ( - final double[] adblX) - throws java.lang.Exception; - - /** - * Retrieve the Population Mode - * - * @return The Population Mode - */ - - public abstract double[] populationMode(); - - /** - * Compute the Population Supremum Norm of the Sample - * - * @return The Population Supremum Norm of the Sample - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public abstract double populationSupremumNorm() - throws java.lang.Exception; - - /** - * Compute the Borel Measure Expectation for the specified R^d To R^1 Function over the full Input Space - * - * @param funcRdToR1 R^d To R^1 Function - * - * @return The Borel Measure Expectation for the specified R^d To R^1 Function over the full Input Space - * - * @throws java.lang.Exception Thrown if the Population Mode cannot be calculated - */ - - public double borelMeasureSpaceExpectation ( - final org.drip.function.definition.RdToR1 funcRdToR1) - throws java.lang.Exception; -} diff --git a/org/drip/spaces/rxtor1/NormedR1CombinatorialToR1Continuous.java b/org/drip/spaces/rxtor1/NormedR1CombinatorialToR1Continuous.java deleted file mode 100644 index 5829fc0..0000000 --- a/org/drip/spaces/rxtor1/NormedR1CombinatorialToR1Continuous.java +++ /dev/null @@ -1,118 +0,0 @@ - -package org.drip.spaces.rxtor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * NormedR1CombinatorialToR1Continuous implements the f : Validated Normed R^1 Combinatorial To Validated - * Normed R^1 Continuous Function Spaces. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class NormedR1CombinatorialToR1Continuous extends org.drip.spaces.rxtor1.NormedR1ToNormedR1 { - - /** - * NormedR1CombinatorialToR1Continuous Function Space Constructor - * - * @param r1CombinatorialInput The Combinatorial R^1 Input Metric Vector Space - * @param r1ContinuousOutput The Continuous R^1 Output Metric Vector Space - * @param funcR1ToR1 The R1ToR1 Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public NormedR1CombinatorialToR1Continuous ( - final org.drip.spaces.metric.R1Combinatorial r1CombinatorialInput, - final org.drip.spaces.metric.R1Continuous r1ContinuousOutput, - final org.drip.function.definition.R1ToR1 funcR1ToR1) - throws java.lang.Exception - { - super (r1CombinatorialInput, r1ContinuousOutput, funcR1ToR1); - } - - @Override public double populationMetricNorm() - throws java.lang.Exception - { - int iPNorm = outputMetricVectorSpace().pNorm(); - - if (java.lang.Integer.MAX_VALUE == iPNorm) return populationSupremumMetricNorm(); - - org.drip.spaces.metric.R1Combinatorial r1Combinatorial = (org.drip.spaces.metric.R1Combinatorial) - inputMetricVectorSpace(); - - org.drip.function.definition.R1ToR1 funcR1ToR1 = function(); - - org.drip.measure.continuousmarginal.R1 distR1 = r1Combinatorial.borelSigmaMeasure(); - - if (null == distR1 || null == funcR1ToR1) - throw new java.lang.Exception - ("NormedR1CombinatorialToR1Continuous::populationMetricNorm => Cannot compute Population Norm"); - - java.util.List lsElem = r1Combinatorial.elementSpace(); - - double dblPopulationMetricNorm = 0.; - double dblNormalizer = 0.; - - for (double dblElement : lsElem) { - double dblProbabilityDensity = distR1.density (dblElement); - - dblNormalizer += dblProbabilityDensity; - - dblPopulationMetricNorm += dblProbabilityDensity * java.lang.Math.pow (java.lang.Math.abs - (funcR1ToR1.evaluate (dblElement)), iPNorm); - } - - return java.lang.Math.pow (dblPopulationMetricNorm / dblNormalizer, 1. / iPNorm); - } -} diff --git a/org/drip/spaces/rxtor1/NormedR1ContinuousToR1Continuous.java b/org/drip/spaces/rxtor1/NormedR1ContinuousToR1Continuous.java deleted file mode 100644 index 364207d..0000000 --- a/org/drip/spaces/rxtor1/NormedR1ContinuousToR1Continuous.java +++ /dev/null @@ -1,121 +0,0 @@ - -package org.drip.spaces.rxtor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * NormedR1ContinuousToR1Continuous implements the f : Validated Normed R^1 Continuous To Validated Normed - * R^1 Continuous Function Spaces. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class NormedR1ContinuousToR1Continuous extends org.drip.spaces.rxtor1.NormedR1ToNormedR1 { - - /** - * NormedR1ContinuousToR1Continuous Function Space Constructor - * - * @param r1ContinuousInput The R^1 Input Metric Vector Space - * @param r1ContinuousOutput The R^1 Output Metric Vector Space - * @param funcR1ToR1 The R^1 To R^1 Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public NormedR1ContinuousToR1Continuous ( - final org.drip.spaces.metric.R1Continuous r1ContinuousInput, - final org.drip.spaces.metric.R1Continuous r1ContinuousOutput, - final org.drip.function.definition.R1ToR1 funcR1ToR1) - throws java.lang.Exception - { - super (r1ContinuousInput, r1ContinuousOutput, funcR1ToR1); - } - - @Override public double populationMetricNorm() - throws java.lang.Exception - { - final int iPNorm = outputMetricVectorSpace().pNorm(); - - if (java.lang.Integer.MAX_VALUE == iPNorm) return populationSupremumMetricNorm(); - - org.drip.spaces.tensor.R1GeneralizedVector gvR1Input = inputMetricVectorSpace(); - - org.drip.spaces.metric.R1Continuous r1Continuous = (org.drip.spaces.metric.R1Continuous) gvR1Input; - - final org.drip.function.definition.R1ToR1 funcR1ToR1 = function(); - - final org.drip.measure.continuousmarginal.R1 distR1 = r1Continuous.borelSigmaMeasure(); - - if (null == distR1 || null == funcR1ToR1) - throw new java.lang.Exception - ("NormedR1ContinuousToR1Continuous::populationMetricNorm => Invalid Inputs"); - - org.drip.function.definition.R1ToR1 funcDensityR1ToR1 = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - return java.lang.Math.pow (java.lang.Math.abs (funcR1ToR1.evaluate (dblX)), iPNorm) * - distR1.density (dblX); - } - }; - - double dblLeftEdge = r1Continuous.leftEdge(); - - double dblRightEdge = r1Continuous.rightEdge(); - - return java.lang.Math.pow (funcDensityR1ToR1.integrate (dblLeftEdge, dblRightEdge) / - distR1.incremental (dblLeftEdge, dblRightEdge), 1. / iPNorm); - } -} diff --git a/org/drip/spaces/rxtor1/NormedR1ToNormedR1.java b/org/drip/spaces/rxtor1/NormedR1ToNormedR1.java deleted file mode 100644 index bbe9699..0000000 --- a/org/drip/spaces/rxtor1/NormedR1ToNormedR1.java +++ /dev/null @@ -1,154 +0,0 @@ - -package org.drip.spaces.rxtor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * NormedR1ToNormedR1 is the Abstract Class underlying the f : Validated Normed R^1 To Validated Normed R^1 - * Function Spaces. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class NormedR1ToNormedR1 extends org.drip.spaces.rxtor1.NormedRxToNormedR1 { - private org.drip.spaces.metric.R1Normed _r1Input = null; - private org.drip.spaces.metric.R1Normed _r1Output = null; - private org.drip.function.definition.R1ToR1 _funcR1ToR1 = null; - - protected NormedR1ToNormedR1 ( - final org.drip.spaces.metric.R1Normed r1Input, - final org.drip.spaces.metric.R1Normed r1Output, - final org.drip.function.definition.R1ToR1 funcR1ToR1) - throws java.lang.Exception - { - if (null == (_r1Input = r1Input) || null == (_r1Output = r1Output)) - throw new java.lang.Exception ("NormedR1ToNormedR1 ctr: Invalid Inputs"); - - _funcR1ToR1 = funcR1ToR1; - } - - /** - * Retrieve the Underlying R1ToR1 Function - * - * @return The Underlying R1ToR1 Function - */ - - public org.drip.function.definition.R1ToR1 function() - { - return _funcR1ToR1; - } - - @Override public double sampleSupremumNorm ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi) - throws java.lang.Exception - { - if (null == _funcR1ToR1 || null == gvvi || !gvvi.tensorSpaceType().match (_r1Input)) - throw new java.lang.Exception ("NormedR1ToNormedR1::sampleSupremumNorm => Invalid Input"); - - double[] adblInstance = ((org.drip.spaces.instance.ValidatedR1) gvvi).instance(); - - int iNumSample = adblInstance.length; - - double dblSupremumNorm = java.lang.Math.abs (_funcR1ToR1.evaluate (adblInstance[0])); - - for (int i = 1; i < iNumSample; ++i) { - double dblResponse = java.lang.Math.abs (_funcR1ToR1.evaluate (adblInstance[i])); - - if (dblResponse > dblSupremumNorm) dblSupremumNorm = dblResponse; - } - - return dblSupremumNorm; - } - - @Override public double sampleMetricNorm ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi) - throws java.lang.Exception - { - int iPNorm = _r1Output.pNorm(); - - if (java.lang.Integer.MAX_VALUE == iPNorm) return sampleSupremumNorm (gvvi); - - if (null == _funcR1ToR1 || null == gvvi || !gvvi.tensorSpaceType().match (_r1Input)) - throw new java.lang.Exception ("NormedR1ToNormedR1::sampleMetricNorm => Invalid Input"); - - double[] adblInstance = ((org.drip.spaces.instance.ValidatedR1) gvvi).instance(); - - double dblNorm = 0.; - int iNumSample = adblInstance.length; - - for (int i = 0; i < iNumSample; ++i) - dblNorm += java.lang.Math.pow (java.lang.Math.abs (_funcR1ToR1.evaluate (adblInstance[i])), - iPNorm); - - return java.lang.Math.pow (dblNorm, 1. / iPNorm); - } - - @Override public double populationESS() - throws java.lang.Exception - { - if (null == _funcR1ToR1) - throw new java.lang.Exception ("NormedR1ToNormedR1::populationESS => Invalid Input"); - - return _funcR1ToR1.evaluate (_r1Input.populationMode()); - } - - @Override public org.drip.spaces.metric.R1Normed outputMetricVectorSpace() - { - return _r1Output; - } - - @Override public org.drip.spaces.metric.R1Normed inputMetricVectorSpace() - { - return _r1Input; - } -} diff --git a/org/drip/spaces/rxtor1/NormedRdCombinatorialToR1Continuous.java b/org/drip/spaces/rxtor1/NormedRdCombinatorialToR1Continuous.java deleted file mode 100644 index e907528..0000000 --- a/org/drip/spaces/rxtor1/NormedRdCombinatorialToR1Continuous.java +++ /dev/null @@ -1,122 +0,0 @@ - -package org.drip.spaces.rxtor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * NormedRdCombinatorialToR1Continuous implements the f : Validated Normed R^d Combinatorial To Validated - * Normed R^1 Continuous Function Spaces. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class NormedRdCombinatorialToR1Continuous extends org.drip.spaces.rxtor1.NormedRdToNormedR1 { - - /** - * NormedRdCombinatorialToR1Continuous Function Space Constructor - * - * @param rdCombinatorialInput The Combinatorial R^d Input Metric Vector Space - * @param r1ContinuousOutput The Continuous R^1 Output Metric Vector Space - * @param funcRdToR1 The R^d To R^1 Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public NormedRdCombinatorialToR1Continuous ( - final org.drip.spaces.metric.RdCombinatorialBanach rdCombinatorialInput, - final org.drip.spaces.metric.R1Continuous r1ContinuousOutput, - final org.drip.function.definition.RdToR1 funcRdToR1) - throws java.lang.Exception - { - super (rdCombinatorialInput, r1ContinuousOutput, funcRdToR1); - } - - @Override public double populationMetricNorm() - throws java.lang.Exception - { - int iPNorm = outputMetricVectorSpace().pNorm(); - - if (java.lang.Integer.MAX_VALUE == iPNorm) return populationSupremumMetricNorm(); - - org.drip.spaces.metric.RdCombinatorialBanach rdCombinatorialInput = - (org.drip.spaces.metric.RdCombinatorialBanach) inputMetricVectorSpace(); - - org.drip.measure.continuousmarginal.Rd distRd = rdCombinatorialInput.borelSigmaMeasure(); - - org.drip.function.definition.RdToR1 funcRdToR1 = function(); - - if (null == distRd || null == funcRdToR1) - throw new java.lang.Exception - ("NormedRdCombinatorialToR1Continuous::populationMetricNorm => No Multivariate Distribution/Function"); - - org.drip.spaces.iterator.RdSpanningCombinatorialIterator ciRd = rdCombinatorialInput.iterator(); - - double[] adblVariate = ciRd.cursorVariates(); - - double dblPopulationMetricNorm = 0.; - double dblNormalizer = 0.; - - while (null != adblVariate) { - double dblProbabilityDensity = distRd.density (adblVariate); - - dblNormalizer += dblProbabilityDensity; - - dblPopulationMetricNorm += dblProbabilityDensity * java.lang.Math.pow (java.lang.Math.abs - (funcRdToR1.evaluate (adblVariate)), iPNorm); - - adblVariate = ciRd.nextVariates(); - } - - return java.lang.Math.pow (dblPopulationMetricNorm / dblNormalizer, 1. / iPNorm); - } -} diff --git a/org/drip/spaces/rxtor1/NormedRdContinuousToR1Continuous.java b/org/drip/spaces/rxtor1/NormedRdContinuousToR1Continuous.java deleted file mode 100644 index 51a7eb8..0000000 --- a/org/drip/spaces/rxtor1/NormedRdContinuousToR1Continuous.java +++ /dev/null @@ -1,125 +0,0 @@ - -package org.drip.spaces.rxtor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * NormedRdContinuousToR1Continuous implements the f : Validated Normed R^d Continuous To Validated Normed - * R^1 Continuous Function Spaces. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class NormedRdContinuousToR1Continuous extends org.drip.spaces.rxtor1.NormedRdToNormedR1 { - - /** - * NormedRdContinuousToR1Continuous Function Space Constructor - * - * @param rdContinuousInput The Continuous R^d Input Banach Metric Vector Space - * @param r1ContinuousOutput The Continuous R^1 Output Metric Vector Space - * @param funcRdToR1 The R^d To R^1 Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public NormedRdContinuousToR1Continuous ( - final org.drip.spaces.metric.RdContinuousBanach rdContinuousInput, - final org.drip.spaces.metric.R1Continuous r1ContinuousOutput, - final org.drip.function.definition.RdToR1 funcRdToR1) - throws java.lang.Exception - { - super (rdContinuousInput, r1ContinuousOutput, funcRdToR1); - } - - @Override public double populationMetricNorm() - throws java.lang.Exception - { - final int iPNorm = outputMetricVectorSpace().pNorm(); - - if (java.lang.Integer.MAX_VALUE == iPNorm) return populationSupremumMetricNorm(); - - org.drip.spaces.metric.RdContinuousBanach rdContinuousInput = - (org.drip.spaces.metric.RdContinuousBanach) inputMetricVectorSpace(); - - final org.drip.measure.continuousmarginal.Rd distRd = rdContinuousInput.borelSigmaMeasure(); - - final org.drip.function.definition.RdToR1 funcRdToR1 = function(); - - if (null == distRd || null == funcRdToR1) - throw new java.lang.Exception - ("NormedRdContinuousToR1Continuous::populationMetricNorm => Measure/Function not specified"); - - org.drip.function.definition.RdToR1 am = new - org.drip.function.definition.RdToR1 (null) { - @Override public int dimension() - { - return org.drip.function.definition.RdToR1.DIMENSION_NOT_FIXED; - } - - @Override public double evaluate ( - final double[] adblX) - throws java.lang.Exception - { - return java.lang.Math.pow (java.lang.Math.abs (funcRdToR1.evaluate (adblX)), iPNorm) * - distRd.density (adblX); - } - }; - - double[] adblLeft = rdContinuousInput.leftDimensionEdge(); - - double[] adblRight = rdContinuousInput.rightDimensionEdge(); - - return java.lang.Math.pow (am.integrate (adblLeft, adblRight) / distRd.incremental(adblLeft, - adblRight), 1. / iPNorm); - } -} diff --git a/org/drip/spaces/rxtor1/NormedRdToNormedR1.java b/org/drip/spaces/rxtor1/NormedRdToNormedR1.java deleted file mode 100644 index 2910c74..0000000 --- a/org/drip/spaces/rxtor1/NormedRdToNormedR1.java +++ /dev/null @@ -1,154 +0,0 @@ - -package org.drip.spaces.rxtor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * NormedRdToNormedR1 is the Abstract Class underlying the f : Validated Normed R^d To Validated Normed R^1 - * Function Spaces. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class NormedRdToNormedR1 extends org.drip.spaces.rxtor1.NormedRxToNormedR1 { - private org.drip.spaces.metric.RdNormed _rdInput = null; - private org.drip.spaces.metric.R1Normed _r1Output = null; - private org.drip.function.definition.RdToR1 _funcRdToR1 = null; - - protected NormedRdToNormedR1 ( - final org.drip.spaces.metric.RdNormed rdInput, - final org.drip.spaces.metric.R1Normed r1Output, - final org.drip.function.definition.RdToR1 funcRdToR1) - throws java.lang.Exception - { - if (null == (_rdInput = rdInput) || null == (_r1Output = r1Output)) - throw new java.lang.Exception ("NormedRdToNormedR1 ctr: Invalid Inputs"); - - _funcRdToR1 = funcRdToR1; - } - - /** - * Retrieve the Underlying RdToR1 Function - * - * @return The Underlying RdToR1 Function - */ - - public org.drip.function.definition.RdToR1 function() - { - return _funcRdToR1; - } - - @Override public double sampleSupremumNorm ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi) - throws java.lang.Exception - { - if (null == _funcRdToR1 || null == gvvi || !gvvi.tensorSpaceType().match (_rdInput)) - throw new java.lang.Exception ("NormedRdToNormedR1::sampleSupremumNorm => Invalid Input"); - - double[][] aadblInstance = ((org.drip.spaces.instance.ValidatedRd) gvvi).instance(); - - int iNumSample = aadblInstance.length; - - double dblSupremumNorm = java.lang.Math.abs (_funcRdToR1.evaluate (aadblInstance[0])); - - for (int i = 1; i < iNumSample; ++i) { - double dblResponse = java.lang.Math.abs (_funcRdToR1.evaluate (aadblInstance[i])); - - if (dblResponse > dblSupremumNorm) dblSupremumNorm = dblResponse; - } - - return dblSupremumNorm; - } - - @Override public double sampleMetricNorm ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi) - throws java.lang.Exception - { - int iPNorm = _r1Output.pNorm(); - - if (java.lang.Integer.MAX_VALUE == iPNorm) return sampleSupremumNorm (gvvi); - - if (null == _funcRdToR1 || null == gvvi || !gvvi.tensorSpaceType().match (_rdInput)) - throw new java.lang.Exception ("NormedRdToNormedR1::sampleMetricNorm => Invalid Input"); - - double[][] aadblInstance = ((org.drip.spaces.instance.ValidatedRd) gvvi).instance(); - - int iNumSample = aadblInstance.length; - double dblNorm = 0.; - - for (int i = 0; i < iNumSample; ++i) - dblNorm += java.lang.Math.pow (java.lang.Math.abs (_funcRdToR1.evaluate (aadblInstance[i])), - iPNorm); - - return java.lang.Math.pow (dblNorm, 1. / iPNorm); - } - - @Override public double populationESS() - throws java.lang.Exception - { - if (null == _funcRdToR1) - throw new java.lang.Exception ("NormedRdToNormedR1::populationESS => Invalid Input"); - - return _funcRdToR1.evaluate (_rdInput.populationMode()); - } - - @Override public org.drip.spaces.metric.RdNormed inputMetricVectorSpace() - { - return _rdInput; - } - - @Override public org.drip.spaces.metric.R1Normed outputMetricVectorSpace() - { - return _r1Output; - } -} diff --git a/org/drip/spaces/rxtor1/NormedRxToNormedR1.java b/org/drip/spaces/rxtor1/NormedRxToNormedR1.java deleted file mode 100644 index 991c5a1..0000000 --- a/org/drip/spaces/rxtor1/NormedRxToNormedR1.java +++ /dev/null @@ -1,230 +0,0 @@ - -package org.drip.spaces.rxtor1; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * NormedRxToNormedR1 is the Abstract Class that exposes f : Normed R^x (x .gte. 1) To Normed R^1 Function - * Space. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class NormedRxToNormedR1 { - - /** - * Retrieve the Input Metric Vector Space - * - * @return The Input Metric Vector Space - */ - - public abstract org.drip.spaces.metric.GeneralizedMetricVectorSpace inputMetricVectorSpace(); - - /** - * Retrieve the Output Metric Vector Space - * - * @return The Output Metric Vector Space - */ - - public abstract org.drip.spaces.metric.R1Normed outputMetricVectorSpace(); - - /** - * Retrieve the Sample Supremum Norm - * - * @param gvvi The Validated Vector Space Instance - * - * @return The Sample Supremum Norm - * - * @throws java.lang.Exception Thrown if the Supremum Norm cannot be computed - */ - - public abstract double sampleSupremumNorm ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi) - throws java.lang.Exception; - - /** - * Retrieve the Sample Metric Norm - * - * @param gvvi The Validated Vector Space Instance - * - * @return The Sample Metric Norm - * - * @throws java.lang.Exception Thrown if the Sample Metric Norm cannot be computed - */ - - public abstract double sampleMetricNorm ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi) - throws java.lang.Exception; - - /** - * Retrieve the Sample Covering Number - * - * @param gvvi The Validated Vector Space Instance - * @param dblCover The Cover - * - * @return The Sample Covering Number - * - * @throws java.lang.Exception Thrown if the Sample Covering Number cannot be computed - */ - - public double sampleCoveringNumber ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi, - final double dblCover) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCover) || 0. >= dblCover) - throw new java.lang.Exception ("NormedRxToNormedR1::sampleCoveringNumber => Invalid Inputs"); - - return sampleMetricNorm (gvvi) / dblCover; - } - - /** - * Retrieve the Sample Supremum Covering Number - * - * @param gvvi The Validated Vector Space Instance - * @param dblCover The Cover - * - * @return The Sample Supremum Covering Number - * - * @throws java.lang.Exception Thrown if the Sample Covering Number cannot be computed - */ - - public double sampleSupremumCoveringNumber ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi, - final double dblCover) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCover) || 0. >= dblCover) - throw new java.lang.Exception - ("NormedRxToNormedR1::sampleSupremumCoveringNumber => Invalid Inputs"); - - return sampleSupremumNorm (gvvi) / dblCover; - } - - /** - * Retrieve the Population ESS (Essential Spectrum) - * - * @return The Population ESS (Essential Spectrum) - * - * @throws java.lang.Exception Thrown if the Population ESS (Essential Spectrum) cannot be computed - */ - - public abstract double populationESS() - throws java.lang.Exception; - - /** - * Retrieve the Population Metric Norm - * - * @return The Population Metric Norm - * - * @throws java.lang.Exception Thrown if the Population Metric Norm cannot be computed - */ - - public abstract double populationMetricNorm() - throws java.lang.Exception; - - /** - * Retrieve the Population Supremum Metric Norm - * - * @return The Population Supremum Metric Norm - * - * @throws java.lang.Exception Thrown if the Population Supremum Metric Norm cannot be computed - */ - - public double populationSupremumMetricNorm() - throws java.lang.Exception - { - return populationESS(); - } - - /** - * Retrieve the Population Covering Number - * - * @param dblCover The Cover - * - * @return The Population Covering Number - * - * @throws java.lang.Exception Thrown if the Population Covering Number cannot be computed - */ - - public double populationCoveringNumber ( - final double dblCover) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCover) || 0. >= dblCover) - throw new java.lang.Exception ("NormedRxToNormedR1::populationCoveringNumber => Invalid Inputs"); - - return populationMetricNorm() / dblCover; - } - - /** - * Retrieve the Population Supremum Covering Number - * - * @param dblCover The Cover - * - * @return The Population Supremum Covering Number - * - * @throws java.lang.Exception Thrown if the Population Supremum Covering Number cannot be computed - */ - - public double populationSupremumCoveringNumber ( - final double dblCover) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCover) || 0. >= dblCover) - throw new java.lang.Exception - ("NormedRxToNormedR1::populationSupremumCoveringNumber => Invalid Inputs"); - - return populationSupremumMetricNorm() / dblCover; - } -} diff --git a/org/drip/spaces/rxtord/NormedR1CombinatorialToRdContinuous.java b/org/drip/spaces/rxtord/NormedR1CombinatorialToRdContinuous.java deleted file mode 100644 index e4e856b..0000000 --- a/org/drip/spaces/rxtord/NormedR1CombinatorialToRdContinuous.java +++ /dev/null @@ -1,139 +0,0 @@ - -package org.drip.spaces.rxtord; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * NormedRdCombinatorialToRdContinuous implements the f : Validated Normed R^d Combinatorial To Normed - * Validated R^d Continuous Function Spaces. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class NormedR1CombinatorialToRdContinuous extends org.drip.spaces.rxtord.NormedR1ToNormedRd { - - /** - * NormedR1CombinatorialToRdContinuous Function Space Constructor - * - * @param r1CombinatorialInput The Combinatorial R^1 Input Metric Vector Space - * @param rdContinuousInput The Continuous R^d Output Metric Vector Space - * @param funcR1ToRd The R1ToRd Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public NormedR1CombinatorialToRdContinuous ( - final org.drip.spaces.metric.R1Combinatorial r1CombinatorialInput, - final org.drip.spaces.metric.RdContinuousBanach rdContinuousInput, - final org.drip.function.definition.R1ToRd funcR1ToRd) - throws java.lang.Exception - { - super (r1CombinatorialInput, rdContinuousInput, funcR1ToRd); - } - - @Override public double[] populationMetricNorm() - { - int iPNorm = outputMetricVectorSpace().pNorm(); - - if (java.lang.Integer.MAX_VALUE == iPNorm) return populationSupremumNorm(); - - org.drip.spaces.metric.R1Combinatorial r1CombinatorialInput = - (org.drip.spaces.metric.R1Combinatorial) inputMetricVectorSpace(); - - org.drip.measure.continuousmarginal.R1 distR1 = r1CombinatorialInput.borelSigmaMeasure(); - - java.util.List lsElem = r1CombinatorialInput.elementSpace(); - - org.drip.function.definition.R1ToRd funcR1ToRd = function(); - - if (null == distR1 || null == funcR1ToRd) return null; - - double dblProbabilityDensity = java.lang.Double.NaN; - double[] adblPopulationMetricNorm = null; - int iOutputDimension = -1; - double dblNormalizer = 0.; - - for (double dblElement : lsElem) { - try { - dblProbabilityDensity = distR1.density (dblElement); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - double[] adblValue = funcR1ToRd.evaluate (dblElement); - - if (null == adblValue || 0 == (iOutputDimension = adblValue.length)) return null; - - dblNormalizer += dblProbabilityDensity; - - if (null == adblPopulationMetricNorm) { - adblPopulationMetricNorm = new double[iOutputDimension]; - - for (int i = 0; i < iOutputDimension; ++i) - adblPopulationMetricNorm[i] = 0; - } - - for (int i = 0; i < iOutputDimension; ++i) - adblPopulationMetricNorm[i] += dblProbabilityDensity * java.lang.Math.pow (java.lang.Math.abs - (adblValue[i]), iPNorm); - } - - for (int i = 0; i < iOutputDimension; ++i) - adblPopulationMetricNorm[i] += java.lang.Math.pow (adblPopulationMetricNorm[i] / dblNormalizer, - 1. / iPNorm); - - return adblPopulationMetricNorm; - } -} diff --git a/org/drip/spaces/rxtord/NormedR1ContinuousToRdContinuous.java b/org/drip/spaces/rxtord/NormedR1ContinuousToRdContinuous.java deleted file mode 100644 index 05cfe41..0000000 --- a/org/drip/spaces/rxtord/NormedR1ContinuousToRdContinuous.java +++ /dev/null @@ -1,143 +0,0 @@ - -package org.drip.spaces.rxtord; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * NormedRdContinuousToRdContinuous implements the f : Normed, Validated R^d Continuous To Normed, Validated - * R^d Continuous Function Spaces. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class NormedR1ContinuousToRdContinuous extends org.drip.spaces.rxtord.NormedR1ToNormedRd { - - /** - * NormedR1ContinuousToRdContinuous Function Space Constructor - * - * @param r1ContinuousInput The R^1 Input Metric Vector Space - * @param rdContinuousOutput The R^d Output Metric Vector Space - * @param funcR1ToRd The R1ToRd Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public NormedR1ContinuousToRdContinuous ( - final org.drip.spaces.metric.R1Continuous r1ContinuousInput, - final org.drip.spaces.metric.RdContinuousBanach rdContinuousOutput, - final org.drip.function.definition.R1ToRd funcR1ToRd) - throws java.lang.Exception - { - super (r1ContinuousInput, rdContinuousOutput, funcR1ToRd); - } - - @Override public double[] populationMetricNorm() - { - final int iPNorm = outputMetricVectorSpace().pNorm(); - - if (java.lang.Integer.MAX_VALUE == iPNorm) return populationSupremumNorm(); - - org.drip.spaces.metric.R1Combinatorial r1ContinuousInput = (org.drip.spaces.metric.R1Combinatorial) - inputMetricVectorSpace(); - - final org.drip.measure.continuousmarginal.R1 distR1 = r1ContinuousInput.borelSigmaMeasure(); - - final org.drip.function.definition.R1ToRd funcR1ToRd = function(); - - if (null == distR1 || null == funcR1ToRd) return null; - - org.drip.function.definition.R1ToRd funcR1ToRdPointNorm = new org.drip.function.definition.R1ToRd - (null) { - @Override public double[] evaluate ( - final double dblX) - { - double[] adblNorm = funcR1ToRd.evaluate (dblX); - - if (null == adblNorm) return null; - - int iOutputDimension = adblNorm.length; - double dblProbabilityDensity = java.lang.Double.NaN; - - if (0 == iOutputDimension) return null; - - try { - dblProbabilityDensity = distR1.density (dblX); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int j = 0; j < iOutputDimension; ++j) - adblNorm[j] = dblProbabilityDensity * java.lang.Math.pow (java.lang.Math.abs - (adblNorm[j]), iPNorm); - - return adblNorm; - } - }; - - double[] adblPopulationRdMetricNorm = funcR1ToRdPointNorm.integrate (r1ContinuousInput.leftEdge(), - r1ContinuousInput.rightEdge()); - - if (null == adblPopulationRdMetricNorm) return null; - - int iOutputDimension = adblPopulationRdMetricNorm.length; - - if (0 == iOutputDimension) return null; - - for (int i = 0; i < iOutputDimension; ++i) - adblPopulationRdMetricNorm[i] = java.lang.Math.pow (adblPopulationRdMetricNorm[i], 1. / iPNorm); - - return adblPopulationRdMetricNorm; - } -} diff --git a/org/drip/spaces/rxtord/NormedR1ToNormedRd.java b/org/drip/spaces/rxtord/NormedR1ToNormedRd.java deleted file mode 100644 index aaf870a..0000000 --- a/org/drip/spaces/rxtord/NormedR1ToNormedRd.java +++ /dev/null @@ -1,189 +0,0 @@ - -package org.drip.spaces.rxtord; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * NormedR1ToNormedRd is the abstract class underlying the f : Validated Normed R^1 To Validated Normed R^d - * Function Spaces. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class NormedR1ToNormedRd extends org.drip.spaces.rxtord.NormedRxToNormedRd { - private org.drip.spaces.metric.R1Normed _r1Input = null; - private org.drip.spaces.metric.RdNormed _rdOutput = null; - private org.drip.function.definition.R1ToRd _funcR1ToRd = null; - - protected NormedR1ToNormedRd ( - final org.drip.spaces.metric.R1Normed r1Input, - final org.drip.spaces.metric.RdNormed rdOutput, - final org.drip.function.definition.R1ToRd funcR1ToRd) - throws java.lang.Exception - { - if (null == (_r1Input = r1Input) || null == (_rdOutput = rdOutput)) - throw new java.lang.Exception ("NormedR1ToNormedRd ctr: Invalid Inputs"); - - _funcR1ToRd = funcR1ToRd; - } - - @Override public org.drip.spaces.metric.R1Normed inputMetricVectorSpace() - { - return _r1Input; - } - - @Override public org.drip.spaces.metric.RdNormed outputMetricVectorSpace() - { - return _rdOutput; - } - - /** - * Retrieve the Underlying R1ToRd Function - * - * @return The Underlying R1ToR1 Function - */ - - public org.drip.function.definition.R1ToRd function() - { - return _funcR1ToRd; - } - - @Override public double[] sampleSupremumNorm ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi) - { - if (null == _funcR1ToRd || null == gvvi || !gvvi.tensorSpaceType().match (_r1Input) || !(gvvi - instanceof org.drip.spaces.instance.ValidatedR1)) - return null; - - org.drip.spaces.instance.ValidatedR1 vr1 = (org.drip.spaces.instance.ValidatedR1) gvvi; - - double[] adblInstance = vr1.instance(); - - int iNumSample = adblInstance.length; - - int iOutputDimension = _rdOutput.dimension(); - - double[] adblSupremumNorm = _funcR1ToRd.evaluate (adblInstance[0]); - - if (null == adblSupremumNorm || iOutputDimension != adblSupremumNorm.length || - !org.drip.quant.common.NumberUtil.IsValid (adblSupremumNorm)) - return null; - - for (int i = 0; i < iOutputDimension; ++i) - adblSupremumNorm[i] = java.lang.Math.abs (adblSupremumNorm[i]); - - for (int i = 1; i < iNumSample; ++i) { - double[] adblSampleNorm = _funcR1ToRd.evaluate (adblInstance[i]); - - if (null == adblSampleNorm || iOutputDimension != adblSampleNorm.length) return null; - - for (int j = 0; j < iOutputDimension; ++j) { - if (!org.drip.quant.common.NumberUtil.IsValid (adblSampleNorm[j])) return null; - - if (adblSampleNorm[j] > adblSupremumNorm[j]) adblSupremumNorm[j] = adblSampleNorm[j]; - } - } - - return adblSupremumNorm; - } - - @Override public double[] sampleMetricNorm ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi) - { - int iPNorm = outputMetricVectorSpace().pNorm(); - - if (java.lang.Integer.MAX_VALUE == iPNorm) sampleSupremumNorm (gvvi); - - if (null == _funcR1ToRd || null == gvvi || !gvvi.tensorSpaceType().match (_r1Input) || !(gvvi - instanceof org.drip.spaces.instance.ValidatedR1)) - return null; - - int iOutputDimension = _rdOutput.dimension(); - - double[] adblInstance = ((org.drip.spaces.instance.ValidatedR1) gvvi).instance(); - - double[] adblMetricNorm = new double[iOutputDimension]; - int iNumSample = adblInstance.length; - - for (int i = 0; i < iNumSample; ++i) - adblMetricNorm[i] = 0.; - - for (int i = 0; i < iNumSample; ++i) { - double[] adblPointValue = _funcR1ToRd.evaluate (adblInstance[i]); - - if (null == adblPointValue || iOutputDimension != adblPointValue.length) return null; - - for (int j = 0; j < iOutputDimension; ++j) { - if (!org.drip.quant.common.NumberUtil.IsValid (adblPointValue[j])) return null; - - adblMetricNorm[j] += java.lang.Math.pow (java.lang.Math.abs (adblPointValue[j]), iPNorm); - } - } - - for (int i = 0; i < iNumSample; ++i) - adblMetricNorm[i] = java.lang.Math.pow (adblMetricNorm[i], 1. / iPNorm); - - return adblMetricNorm; - } - - @Override public double[] populationESS() - { - try { - return null == _funcR1ToRd ? null : _funcR1ToRd.evaluate (_r1Input.populationMode()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/spaces/rxtord/NormedRdCombinatorialToRdContinuous.java b/org/drip/spaces/rxtord/NormedRdCombinatorialToRdContinuous.java deleted file mode 100644 index 3dc0f6a..0000000 --- a/org/drip/spaces/rxtord/NormedRdCombinatorialToRdContinuous.java +++ /dev/null @@ -1,143 +0,0 @@ - -package org.drip.spaces.rxtord; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * NormedRdCombinatorialToRdContinuous implements the f : Validated R^d Combinatorial To Validated R^d - * Continuous Normed Function Spaces. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class NormedRdCombinatorialToRdContinuous extends org.drip.spaces.rxtord.NormedRdToNormedRd { - - /** - * NormedRdCombinatorialToRdContinuous Function Space Constructor - * - * @param rdCombinatorialInput The Combinatorial R^d Input Metric Vector Space - * @param rdContinuousOutput The Continuous R^d Output Metric Vector Space - * @param funcRdToRd The RdToRd Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public NormedRdCombinatorialToRdContinuous ( - final org.drip.spaces.metric.RdCombinatorialBanach rdCombinatorialInput, - final org.drip.spaces.metric.RdContinuousBanach rdContinuousOutput, - final org.drip.function.definition.RdToRd funcRdToRd) - throws java.lang.Exception - { - super (rdCombinatorialInput, rdContinuousOutput, funcRdToRd); - } - - @Override public double[] populationMetricNorm() - { - int iPNorm = outputMetricVectorSpace().pNorm(); - - if (java.lang.Integer.MAX_VALUE == iPNorm) return populationSupremumNorm(); - - org.drip.spaces.metric.RdCombinatorialBanach rdCombinatorialInput = - (org.drip.spaces.metric.RdCombinatorialBanach) inputMetricVectorSpace(); - - org.drip.measure.continuousmarginal.Rd distRd = rdCombinatorialInput.borelSigmaMeasure(); - - org.drip.spaces.iterator.RdSpanningCombinatorialIterator ciRd = rdCombinatorialInput.iterator(); - - org.drip.function.definition.RdToRd funcRdToRd = function(); - - if (null == distRd || null == funcRdToRd) return null; - - double[] adblVariate = ciRd.cursorVariates(); - - double dblProbabilityDensity = java.lang.Double.NaN; - double[] adblPopulationMetricNorm = null; - int iOutputDimension = -1; - double dblNormalizer = 0.; - - while (null != adblVariate) { - try { - dblProbabilityDensity = distRd.density (adblVariate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - double[] adblValue = funcRdToRd.evaluate (adblVariate); - - if (null == adblValue || 0 == (iOutputDimension = adblValue.length)) return null; - - dblNormalizer += dblProbabilityDensity; - - if (null == adblPopulationMetricNorm) { - adblPopulationMetricNorm = new double[iOutputDimension]; - - for (int i = 0; i < iOutputDimension; ++i) - adblPopulationMetricNorm[i] = 0; - } - - for (int i = 0; i < iOutputDimension; ++i) - adblPopulationMetricNorm[i] += dblProbabilityDensity * java.lang.Math.pow (java.lang.Math.abs - (adblValue[i]), iPNorm); - - adblVariate = ciRd.nextVariates(); - } - - for (int i = 0; i < iOutputDimension; ++i) - adblPopulationMetricNorm[i] += java.lang.Math.pow (adblPopulationMetricNorm[i] / dblNormalizer, - 1. / iPNorm); - - return adblPopulationMetricNorm; - } -} diff --git a/org/drip/spaces/rxtord/NormedRdContinuousToRdContinuous.java b/org/drip/spaces/rxtord/NormedRdContinuousToRdContinuous.java deleted file mode 100644 index 9e0028d..0000000 --- a/org/drip/spaces/rxtord/NormedRdContinuousToRdContinuous.java +++ /dev/null @@ -1,141 +0,0 @@ - -package org.drip.spaces.rxtord; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * NormedRdContinuousToRdContinuous implements the f : Validated R^d Continuous To Validated R^d Continuous - * Normed Function Spaces. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class NormedRdContinuousToRdContinuous extends org.drip.spaces.rxtord.NormedRdToNormedRd { - - /** - * NormedRdContinuousToRdContinuous Function Space Constructor - * - * @param rdContinuousInput The Continuous R^d Input Metric Vector Space - * @param rdContinuousOutput The Continuous R^d Output Metric Vector Space - * @param funcRdToRd The RdToRd Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public NormedRdContinuousToRdContinuous ( - final org.drip.spaces.metric.RdContinuousBanach rdContinuousInput, - final org.drip.spaces.metric.RdContinuousBanach rdContinuousOutput, - final org.drip.function.definition.RdToRd funcRdToRd) - throws java.lang.Exception - { - super (rdContinuousInput, rdContinuousOutput, funcRdToRd); - } - - @Override public double[] populationMetricNorm() - { - org.drip.spaces.metric.RdContinuousBanach rdContinuousInput = - (org.drip.spaces.metric.RdContinuousBanach) inputMetricVectorSpace(); - - final org.drip.measure.continuousmarginal.Rd multiDist = rdContinuousInput.borelSigmaMeasure(); - - final org.drip.function.definition.RdToRd funcRdToRd = function(); - - if (null == multiDist || null == funcRdToRd) return null; - - final int iPNorm = outputMetricVectorSpace().pNorm(); - - org.drip.function.definition.RdToRd funcRdToRdPointNorm = new org.drip.function.definition.RdToRd - (null) { - @Override public double[] evaluate ( - final double[] adblX) - { - double[] adblNorm = funcRdToRd.evaluate (adblX); - - if (null == adblNorm) return null; - - int iOutputDimension = adblNorm.length; - double dblProbabilityDensity = java.lang.Double.NaN; - - if (0 == iOutputDimension) return null; - - try { - dblProbabilityDensity = multiDist.density (adblX); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int j = 0; j < iOutputDimension; ++j) - adblNorm[j] = dblProbabilityDensity * java.lang.Math.pow (java.lang.Math.abs - (adblNorm[j]), iPNorm); - - return adblNorm; - } - }; - - double[] adblPopulationRdMetricNorm = funcRdToRdPointNorm.integrate - (rdContinuousInput.leftDimensionEdge(), rdContinuousInput.rightDimensionEdge()); - - if (null == adblPopulationRdMetricNorm) return null; - - int iOutputDimension = adblPopulationRdMetricNorm.length; - - if (0 == iOutputDimension) return null; - - for (int i = 0; i < iOutputDimension; ++i) - adblPopulationRdMetricNorm[i] = java.lang.Math.pow (adblPopulationRdMetricNorm[i], 1. / iPNorm); - - return adblPopulationRdMetricNorm; - } -} diff --git a/org/drip/spaces/rxtord/NormedRdToNormedRd.java b/org/drip/spaces/rxtord/NormedRdToNormedRd.java deleted file mode 100644 index 754e22b..0000000 --- a/org/drip/spaces/rxtord/NormedRdToNormedRd.java +++ /dev/null @@ -1,210 +0,0 @@ - -package org.drip.spaces.rxtord; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * NormedRdToNormedRd is the abstract class underlying the f : Normed, Validated R^d To Normed, Validated R^d - * Function Spaces. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class NormedRdToNormedRd extends org.drip.spaces.rxtord.NormedRxToNormedRd { - private org.drip.spaces.metric.RdNormed _rdInput = null; - private org.drip.spaces.metric.RdNormed _rdOutput = null; - private org.drip.function.definition.RdToRd _funcRdToRd = null; - - protected NormedRdToNormedRd ( - final org.drip.spaces.metric.RdNormed rdInput, - final org.drip.spaces.metric.RdNormed rdOutput, - final org.drip.function.definition.RdToRd funcRdToRd) - throws java.lang.Exception - { - if (null == (_rdInput = rdInput) || null == (_rdOutput = rdOutput)) - throw new java.lang.Exception ("NormedRdToNormedRd ctr: Invalid Inputs"); - - _funcRdToRd = funcRdToRd; - } - - /** - * Retrieve the Underlying RdToRd Function - * - * @return The Underlying RdToRd Function - */ - - public org.drip.function.definition.RdToRd function() - { - return _funcRdToRd; - } - - /** - * Retrieve the Population R^d ESS (Essential Spectrum) Array - * - * @return The Population R^d ESS (Essential Spectrum) Array - */ - - public double[] populationRdESS() - { - return _funcRdToRd.evaluate (_rdInput.populationMode()); - } - - /** - * Retrieve the Population R^d Supremum Norm - * - * @return The Population R^d Supremum Norm - */ - - public double[] populationRdSupremumNorm() - { - return populationRdESS(); - } - - @Override public org.drip.spaces.metric.RdNormed inputMetricVectorSpace() - { - return _rdInput; - } - - @Override public org.drip.spaces.metric.RdNormed outputMetricVectorSpace() - { - return _rdOutput; - } - - @Override public double[] sampleSupremumNorm ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi) - { - if (null == _funcRdToRd || null == gvvi || !gvvi.tensorSpaceType().match (_rdInput) || ! (gvvi - instanceof org.drip.spaces.instance.ValidatedRd)) - return null; - - org.drip.spaces.instance.ValidatedRd vrdInstance = (org.drip.spaces.instance.ValidatedRd) gvvi; - - double[][] aadblInstance = vrdInstance.instance(); - - int iNumSample = aadblInstance.length; - - int iOutputDimension = _rdOutput.dimension(); - - double[] adblSupremumNorm = _funcRdToRd.evaluate (aadblInstance[0]); - - if (null == adblSupremumNorm || iOutputDimension != adblSupremumNorm.length || - !org.drip.quant.common.NumberUtil.IsValid (adblSupremumNorm)) - return null; - - for (int i = 0; i < iOutputDimension; ++i) - adblSupremumNorm[i] = java.lang.Math.abs (adblSupremumNorm[i]); - - for (int i = 1; i < iNumSample; ++i) { - double[] adblSampleNorm = _funcRdToRd.evaluate (aadblInstance[i]); - - if (null == adblSampleNorm || iOutputDimension != adblSampleNorm.length) return null; - - for (int j = 0; j < iOutputDimension; ++j) { - if (!org.drip.quant.common.NumberUtil.IsValid (adblSampleNorm[j])) return null; - - if (adblSampleNorm[j] > adblSupremumNorm[j]) adblSupremumNorm[j] = adblSampleNorm[j]; - } - } - - return adblSupremumNorm; - } - - @Override public double[] sampleMetricNorm ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi) - { - int iPNorm = outputMetricVectorSpace().pNorm(); - - if (java.lang.Integer.MAX_VALUE == iPNorm) return sampleSupremumNorm (gvvi); - - if (null == _funcRdToRd || null == gvvi || !gvvi.tensorSpaceType().match (_rdInput) || ! (gvvi - instanceof org.drip.spaces.instance.ValidatedRd)) - return null; - - int iOutputDimension = _rdOutput.dimension(); - - double[][] aadblInstance = ((org.drip.spaces.instance.ValidatedRd) gvvi).instance(); - - double[] adblMetricNorm = new double[iOutputDimension]; - int iNumSample = aadblInstance.length; - - for (int i = 0; i < iNumSample; ++i) - adblMetricNorm[i] = 0.; - - for (int i = 0; i < iNumSample; ++i) { - double[] adblPointValue = _funcRdToRd.evaluate (aadblInstance[i]); - - if (null == adblPointValue || iOutputDimension != adblPointValue.length) return null; - - for (int j = 0; j < iOutputDimension; ++j) { - if (!org.drip.quant.common.NumberUtil.IsValid (adblPointValue[j])) return null; - - adblMetricNorm[j] += java.lang.Math.pow (java.lang.Math.abs (adblPointValue[j]), iPNorm); - } - } - - for (int i = 0; i < iNumSample; ++i) - adblMetricNorm[i] = java.lang.Math.pow (adblMetricNorm[i], 1. / iPNorm); - - return adblMetricNorm; - } - - @Override public double[] populationESS() - { - return _funcRdToRd.evaluate (_rdInput.populationMode()); - } - - @Override public double[] populationSupremumNorm() - { - return populationESS(); - } -} diff --git a/org/drip/spaces/rxtord/NormedRxToNormedRd.java b/org/drip/spaces/rxtord/NormedRxToNormedRd.java deleted file mode 100644 index dfe7541..0000000 --- a/org/drip/spaces/rxtord/NormedRxToNormedRd.java +++ /dev/null @@ -1,253 +0,0 @@ - -package org.drip.spaces.rxtord; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * NormedRxToNormedRd is the abstract Class that exposes f : Normed R^x (x .gte. 1) To Normed R^d Function - * Space. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class NormedRxToNormedRd { - - /** - * Retrieve the Input Metric Vector Space - * - * @return The Input Metric Vector Space - */ - - public abstract org.drip.spaces.metric.GeneralizedMetricVectorSpace inputMetricVectorSpace(); - - /** - * Retrieve the Output Metric Vector Space - * - * @return The Output Metric Vector Space - */ - - public abstract org.drip.spaces.metric.RdNormed outputMetricVectorSpace(); - - /** - * Retrieve the Sample Supremum Norm Array - * - * @param gvvi The Validated Vector Space Instance - * - * @return The Sample Supremum Norm Array - */ - - public abstract double[] sampleSupremumNorm ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi); - - /** - * Retrieve the Sample Metric Norm Array - * - * @param gvvi The Validated Vector Space Instance - * - * @return The Sample Metric Norm Array - */ - - public abstract double[] sampleMetricNorm ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi); - - /** - * Retrieve the Sample Covering Number Array - * - * @param gvvi The Validated Vector Space Instance - * @param dblCover The Cover - * - * @return The Sample Covering Number Array - */ - - public double[] sampleCoveringNumber ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi, - final double dblCover) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCover) || 0. >= dblCover) return null; - - double[] adblSampleMetricNorm = sampleMetricNorm (gvvi); - - if (null == adblSampleMetricNorm) return null; - - int iOutputDimensionality = adblSampleMetricNorm.length; - double[] adblSampleCoveringNumber = new double[iOutputDimensionality]; - - if (0 == iOutputDimensionality) return null; - - double dblCoverBallVolume = java.lang.Math.pow (dblCover, outputMetricVectorSpace().pNorm()); - - for (int i = 0; i < iOutputDimensionality; ++i) - adblSampleCoveringNumber[i] = adblSampleMetricNorm[i] / dblCoverBallVolume; - - return adblSampleCoveringNumber; - } - - /** - * Retrieve the Sample Supremum Covering Number Array - * - * @param gvvi The Validated Vector Space Instance - * @param dblCover The Cover - * - * @return The Sample Supremum Covering Number Array - */ - - public double[] sampleSupremumCoveringNumber ( - final org.drip.spaces.instance.GeneralizedValidatedVector gvvi, - final double dblCover) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCover) || 0. >= dblCover) return null; - - double[] adblSampleSupremumNorm = sampleSupremumNorm (gvvi); - - if (null == adblSampleSupremumNorm) return null; - - int iOutputDimensionality = adblSampleSupremumNorm.length; - double[] adblSampleSupremumCoveringNumber = new double[iOutputDimensionality]; - - if (0 == iOutputDimensionality) return null; - - double dblCoverBallVolume = java.lang.Math.pow (dblCover, outputMetricVectorSpace().pNorm()); - - for (int i = 0; i < iOutputDimensionality; ++i) - adblSampleSupremumCoveringNumber[i] = adblSampleSupremumNorm[i] / dblCoverBallVolume; - - return adblSampleSupremumCoveringNumber; - } - - /** - * Retrieve the Population ESS (Essential Spectrum) Array - * - * @return The Population ESS (Essential Spectrum) Array - */ - - public abstract double[] populationESS(); - - /** - * Retrieve the Population Metric Norm Array - * - * @return The Population Metric Norm Array - */ - - public abstract double[] populationMetricNorm(); - - /** - * Retrieve the Population Supremum Norm Array - * - * @return The Population Supremum Norm Array - */ - - public double[] populationSupremumNorm() - { - return populationMetricNorm(); - } - - /** - * Retrieve the Population Covering Number Array - * - * @param dblCover The Cover - * - * @return The Population Covering Number Array - */ - - public double[] populationCoveringNumber ( - final double dblCover) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCover) || 0. >= dblCover) return null; - - double[] adblPopulationMetricNorm = populationMetricNorm(); - - if (null == adblPopulationMetricNorm) return null; - - int iOutputDimensionality = adblPopulationMetricNorm.length; - double[] adblPopulationCoveringNumber = new double[iOutputDimensionality]; - - if (0 == iOutputDimensionality) return null; - - double dblCoverBallVolume = java.lang.Math.pow (dblCover, outputMetricVectorSpace().pNorm()); - - for (int i = 0; i < iOutputDimensionality; ++i) - adblPopulationCoveringNumber[i] = adblPopulationMetricNorm[i] / dblCoverBallVolume; - - return adblPopulationCoveringNumber; - } - - /** - * Retrieve the Population Supremum Covering Number Array - * - * @param dblCover The Cover - * - * @return The Population Supremum Covering Number Array - */ - - public double[] populationSupremumCoveringNumber ( - final double dblCover) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCover) || 0. >= dblCover) return null; - - double[] adblPopulationSupremumNorm = populationSupremumNorm(); - - if (null == adblPopulationSupremumNorm) return null; - - int iOutputDimensionality = adblPopulationSupremumNorm.length; - double[] adblPopulationSupremumCoveringNumber = new double[iOutputDimensionality]; - - if (0 == iOutputDimensionality) return null; - - double dblCoverBallVolume = java.lang.Math.pow (dblCover, outputMetricVectorSpace().pNorm()); - - for (int i = 0; i < iOutputDimensionality; ++i) - adblPopulationSupremumCoveringNumber[i] = adblPopulationSupremumNorm[i] / dblCoverBallVolume; - - return adblPopulationSupremumCoveringNumber; - } -} diff --git a/org/drip/spaces/tensor/BinaryBooleanVector.java b/org/drip/spaces/tensor/BinaryBooleanVector.java deleted file mode 100644 index 4bd80ad..0000000 --- a/org/drip/spaces/tensor/BinaryBooleanVector.java +++ /dev/null @@ -1,100 +0,0 @@ - -package org.drip.spaces.tensor; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BinaryBooleanVector implements the normed/non-normed Binary/Boolean Combinatorial Vector Spaces. - * - * @author Lakshmi Krishnamurthy - */ - -public class BinaryBooleanVector extends org.drip.spaces.tensor.R1CombinatorialVector { - - /** - * Binary/Boolean Space "UP" - */ - - public static final short BBV_UP = (short) +1; - - /** - * Binary/Boolean Space "DOWN" - */ - - public static final short BBV_DOWN = (short) -1; - - /** - * Construct the Standard Binary Boolean Vector Space - * - * @return The Standard Binary Boolean Vector Space - */ - - public static final BinaryBooleanVector Standard() - { - java.util.List lsElementSpace = new java.util.ArrayList(); - - lsElementSpace.add ((double) BBV_UP); - - lsElementSpace.add ((double) BBV_DOWN); - - try { - return new BinaryBooleanVector (lsElementSpace); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private BinaryBooleanVector ( - final java.util.List lsElementSpace) - throws java.lang.Exception - { - super (lsElementSpace); - } -} diff --git a/org/drip/spaces/tensor/Cardinality.java b/org/drip/spaces/tensor/Cardinality.java deleted file mode 100644 index 049c304..0000000 --- a/org/drip/spaces/tensor/Cardinality.java +++ /dev/null @@ -1,188 +0,0 @@ - -package org.drip.spaces.tensor; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * Cardinality contains the Type and the Measure of the Cardinality of the given Vector Space. - * - * @author Lakshmi Krishnamurthy - */ - -public class Cardinality { - - /** - * Cardinality Type - Countably Finite - */ - - public static final int CARD_COUNTABLY_FINITE = 1; - - /** - * Cardinality Type - Countably Infinite - */ - - public static final int CARD_COUNTABLY_INFINITE = 2; - - /** - * Cardinality Type - Uncountably Infinite - */ - - public static final int CARD_UNCOUNTABLY_INFINITE = 3; - - private int _iType = -1; - private double _dblNumber = java.lang.Double.NaN; - - /** - * Countably Finite Cardinality - * - * @param dblNumber The Cardinality Number - * - * @return The Cardinality Instance - */ - - public static final Cardinality CountablyFinite ( - final double dblNumber) - { - try { - return new Cardinality (CARD_COUNTABLY_FINITE, dblNumber); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Countably Infinite Cardinality - * - * @return The Cardinality Instance - */ - - public static final Cardinality CountablyInfinite() - { - try { - return new Cardinality (CARD_COUNTABLY_INFINITE, java.lang.Double.POSITIVE_INFINITY); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Uncountably Infinite Cardinality - * - * @return The Cardinality Instance - */ - - public static final Cardinality UncountablyInfinite() - { - try { - return new Cardinality (CARD_UNCOUNTABLY_INFINITE, java.lang.Double.POSITIVE_INFINITY); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Cardinality Constructor - * - * @param iType Cardinality Type - * @param dblNumber Cardinality Number - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public Cardinality ( - final int iType, - final double dblNumber) - throws java.lang.Exception - { - if ((CARD_COUNTABLY_FINITE != (_iType = iType) && CARD_COUNTABLY_INFINITE != _iType && - CARD_UNCOUNTABLY_INFINITE != _iType) || java.lang.Double.isNaN (_dblNumber = dblNumber)) - throw new java.lang.Exception ("Cardinality ctr => Invalid Inputs"); - } - - /** - * Retrieve the Cardinality Type - * - * @return The Cardinality Type - */ - - public int type() - { - return _iType; - } - - /** - * Retrieve the Cardinality Number - * - * @return The Cardinality Number - */ - - public double number() - { - return _dblNumber; - } - - /** - * Indicate if the Current Instance matches the "Other" Cardinality Instance - * - * @param cardOther The "Other" Cardinality Instance - * - * @return TRUE - The Instances Match - */ - - public boolean match ( - final Cardinality cardOther) - { - return null != cardOther && cardOther.type() == _iType && cardOther.number() == _dblNumber; - } -} diff --git a/org/drip/spaces/tensor/GeneralizedVector.java b/org/drip/spaces/tensor/GeneralizedVector.java deleted file mode 100644 index 522e536..0000000 --- a/org/drip/spaces/tensor/GeneralizedVector.java +++ /dev/null @@ -1,123 +0,0 @@ - -package org.drip.spaces.tensor; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * GeneralizedVector exposes the basic Properties of the General Vector Space. - * - * @author Lakshmi Krishnamurthy - */ - -public interface GeneralizedVector { - - /** - * Retrieve the Left Edge - * - * @return The Left Edge - */ - - public abstract double leftEdge(); - - /** - * Retrieve the Right Edge - * - * @return The Right Edge - */ - - public abstract double rightEdge(); - - /** - * Retrieve the Cardinality of the Vector Space - * - * @return Cardinality of the Vector Space - */ - - public abstract org.drip.spaces.tensor.Cardinality cardinality(); - - /** - * Compare against the "Other" Generalized Vector Space - * - * @param gvsOther The "Other" Generalized Vector Space - * - * @return TRUE - The "Other" Generalized Vector Space matches this - */ - - public abstract boolean match ( - final org.drip.spaces.tensor.GeneralizedVector gvsOther); - - /** - * Indicate if the "Other" Generalized Vector Space is a Subset of "this" - * - * @param gvsOther The "Other" Generalized Vector Space - * - * @return TRUE - The "Other" Generalized Vector Space is a Subset of this - */ - - public abstract boolean subset ( - final org.drip.spaces.tensor.GeneralizedVector gvsOther); - - /** - * Indicate if the Predictor Variate Space is bounded from the Left and the Right - * - * @return The Predictor Variate Space is bounded from the Left and the Right - */ - - public abstract boolean isPredictorBounded(); - - /** - * Retrieve the "Hyper" Volume of the Vector Space - * - * @return The "Hyper" Volume of the Vector Space - * - * @throws java.lang.Exception Thrown if the Hyper Volume cannot be computed - */ - - public abstract double hyperVolume() - throws java.lang.Exception; -} diff --git a/org/drip/spaces/tensor/R1CombinatorialVector.java b/org/drip/spaces/tensor/R1CombinatorialVector.java deleted file mode 100644 index b05ad30..0000000 --- a/org/drip/spaces/tensor/R1CombinatorialVector.java +++ /dev/null @@ -1,183 +0,0 @@ - -package org.drip.spaces.tensor; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * R1CombinatorialVector exposes the normed/non-normed Discrete Spaces with R^1 Combinatorial Vector - * Elements. - * - * @author Lakshmi Krishnamurthy - */ - -public class R1CombinatorialVector implements org.drip.spaces.tensor.R1GeneralizedVector { - private java.util.List _lsElementSpace = new java.util.ArrayList(); - - /** - * R1CombinatorialVector Constructor - * - * @param lsElementSpace The List Space of Elements - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public R1CombinatorialVector ( - final java.util.List lsElementSpace) - throws java.lang.Exception - { - if (null == (_lsElementSpace = lsElementSpace) || 0 == _lsElementSpace.size()) - throw new java.lang.Exception ("R1CombinatorialVector ctr: Invalid Inputs"); - } - - /** - * Retrieve the Full Candidate List of Elements - * - * @return The Full Candidate List of Elements - */ - - public java.util.List elementSpace() - { - return _lsElementSpace; - } - - @Override public double leftEdge() - { - double dblLeftEdge = java.lang.Double.NaN; - - for (double dblElement : _lsElementSpace) { - if (java.lang.Double.NEGATIVE_INFINITY == dblElement) return dblElement; - - if (!org.drip.quant.common.NumberUtil.IsValid (dblLeftEdge)) - dblLeftEdge = dblElement; - else { - if (dblLeftEdge > dblElement) dblLeftEdge = dblElement; - } - } - - return dblLeftEdge; - } - - @Override public double rightEdge() - { - double dblRightEdge = java.lang.Double.NaN; - - for (double dblElement : _lsElementSpace) { - if (java.lang.Double.POSITIVE_INFINITY == dblElement) return dblElement; - - if (!org.drip.quant.common.NumberUtil.IsValid (dblRightEdge)) - dblRightEdge = dblElement; - else { - if (dblRightEdge < dblElement) dblRightEdge = dblElement; - } - } - - return dblRightEdge; - } - - @Override public boolean validateInstance ( - final double dblX) - { - return _lsElementSpace.contains (dblX); - } - - @Override public org.drip.spaces.tensor.Cardinality cardinality() - { - return org.drip.spaces.tensor.Cardinality.CountablyFinite (_lsElementSpace.size()); - } - - @Override public boolean match ( - final org.drip.spaces.tensor.GeneralizedVector gvOther) - { - if (null == gvOther || !(gvOther instanceof R1CombinatorialVector)) return false; - - R1CombinatorialVector r1cvOther = (R1CombinatorialVector) gvOther; - - if (!cardinality().match (r1cvOther.cardinality())) return false; - - java.util.List lsElementSpaceOther = r1cvOther.elementSpace(); - - for (double dblElement : _lsElementSpace) { - if (!lsElementSpaceOther.contains (dblElement)) return false; - } - - return true; - } - - @Override public boolean subset ( - final org.drip.spaces.tensor.GeneralizedVector gvOther) - { - if (null == gvOther || !(gvOther instanceof R1CombinatorialVector)) return false; - - R1CombinatorialVector r1cvOther = (R1CombinatorialVector) gvOther; - - if (cardinality().number() < r1cvOther.cardinality().number()) return false; - - java.util.List lsElementSpaceOther = r1cvOther.elementSpace(); - - for (double dblElement : _lsElementSpace) { - if (!lsElementSpaceOther.contains (dblElement)) return false; - } - - return true; - } - - @Override public boolean isPredictorBounded() - { - return leftEdge() != java.lang.Double.NEGATIVE_INFINITY && rightEdge() != - java.lang.Double.POSITIVE_INFINITY; - } - - @Override public double hyperVolume() - throws java.lang.Exception - { - if (!isPredictorBounded()) - throw new java.lang.Exception ("R1CombinatorialVector::hyperVolume => Space not Bounded"); - - return rightEdge() - leftEdge(); - } -} diff --git a/org/drip/spaces/tensor/R1ContinuousVector.java b/org/drip/spaces/tensor/R1ContinuousVector.java deleted file mode 100644 index 4679b7c..0000000 --- a/org/drip/spaces/tensor/R1ContinuousVector.java +++ /dev/null @@ -1,160 +0,0 @@ - -package org.drip.spaces.tensor; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * R1ContinuousVector exposes the Normed/non-normed, Bounded/Unbounded Continuous R^1 Vector Spaces with - * Real-valued Elements. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class R1ContinuousVector implements org.drip.spaces.tensor.R1GeneralizedVector { - private double _dblLeftEdge = java.lang.Double.NaN; - private double _dblRightEdge = java.lang.Double.NaN; - - /** - * Create the Standard R^1 Continuous Vector Space - * - * @return The Standard R^1 Continuous Vector Space - */ - - public static final R1ContinuousVector Standard() - { - try { - return new R1ContinuousVector (java.lang.Double.NEGATIVE_INFINITY, - java.lang.Double.POSITIVE_INFINITY); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * R1ContinuousVector Constructor - * - * @param dblLeftEdge The Left Edge - * @param dblRightEdge The Right Edge - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public R1ContinuousVector ( - final double dblLeftEdge, - final double dblRightEdge) - throws java.lang.Exception - { - if (!java.lang.Double.isNaN (_dblLeftEdge = dblLeftEdge) || !java.lang.Double.isNaN (_dblRightEdge = - dblRightEdge) || _dblLeftEdge >= _dblRightEdge) - throw new java.lang.Exception ("R1ContinuousVector ctr: Invalid Inputs"); - } - - @Override public double leftEdge() - { - return _dblLeftEdge; - } - - @Override public double rightEdge() - { - return _dblRightEdge; - } - - @Override public boolean validateInstance ( - final double dblInstance) - { - return java.lang.Double.isNaN (dblInstance) && dblInstance >= _dblLeftEdge && dblInstance <= - _dblRightEdge; - } - - @Override public org.drip.spaces.tensor.Cardinality cardinality() - { - return org.drip.spaces.tensor.Cardinality.UncountablyInfinite(); - } - - @Override public boolean match ( - final org.drip.spaces.tensor.GeneralizedVector gvOther) - { - if (null == gvOther || !(gvOther instanceof R1ContinuousVector)) return false; - - R1ContinuousVector r1cvOther = (R1ContinuousVector) gvOther; - - return r1cvOther.leftEdge() == _dblLeftEdge && r1cvOther.rightEdge() == _dblRightEdge; - } - - @Override public boolean subset ( - final org.drip.spaces.tensor.GeneralizedVector gvOther) - { - if (null == gvOther || !(gvOther instanceof R1ContinuousVector)) return false; - - R1ContinuousVector r1cvOther = (R1ContinuousVector) gvOther; - - return r1cvOther.leftEdge() >= _dblLeftEdge && r1cvOther.rightEdge() <= _dblRightEdge; - } - - @Override public boolean isPredictorBounded() - { - return leftEdge() != java.lang.Double.NEGATIVE_INFINITY && rightEdge() != - java.lang.Double.POSITIVE_INFINITY; - } - - @Override public double hyperVolume() - throws java.lang.Exception - { - if (!isPredictorBounded()) - throw new java.lang.Exception ("R1ContinuousVector::hyperVolume => Space not Bounded"); - - return _dblRightEdge - _dblLeftEdge; - } -} diff --git a/org/drip/spaces/tensor/R1GeneralizedVector.java b/org/drip/spaces/tensor/R1GeneralizedVector.java deleted file mode 100644 index c0aa030..0000000 --- a/org/drip/spaces/tensor/R1GeneralizedVector.java +++ /dev/null @@ -1,69 +0,0 @@ - -package org.drip.spaces.tensor; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * R1GeneralizedVector exposes the basic Properties of the General R^1 Vector Space. - * - * @author Lakshmi Krishnamurthy - */ - -public interface R1GeneralizedVector extends org.drip.spaces.tensor.GeneralizedVector { - - /** - * Validate the Input Instance Ordinate - * - * @param dblInstance The Input Instance Ordinate - * - * @return TRUE - Instance Ordinate is a Valid Entry in the Space - */ - - public abstract boolean validateInstance ( - final double dblInstance); -} diff --git a/org/drip/spaces/tensor/RdAggregate.java b/org/drip/spaces/tensor/RdAggregate.java deleted file mode 100644 index 80e0f8f..0000000 --- a/org/drip/spaces/tensor/RdAggregate.java +++ /dev/null @@ -1,148 +0,0 @@ - -package org.drip.spaces.tensor; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RdAggregate exposes the basic Properties of the R^d as a Sectional Super-position of R^1 Vector Spaces. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class RdAggregate implements org.drip.spaces.tensor.RdGeneralizedVector { - private org.drip.spaces.tensor.R1GeneralizedVector[] _aR1GV = null; - - protected RdAggregate ( - final org.drip.spaces.tensor.R1GeneralizedVector[] aR1GV) - throws java.lang.Exception - { - if (null == (_aR1GV = aR1GV)) throw new java.lang.Exception ("RdAggregate ctr: Invalid Inputs"); - - int iDimension = _aR1GV.length; - - if (0 == iDimension) throw new java.lang.Exception ("RdAggregate ctr: Invalid Inputs"); - - for (int i = 0; i < iDimension; ++i) { - if (null == _aR1GV[i]) throw new java.lang.Exception ("RdAggregate ctr: Invalid Inputs"); - } - } - - @Override public int dimension() - { - return _aR1GV.length; - } - - @Override public org.drip.spaces.tensor.R1GeneralizedVector[] vectorSpaces() - { - return _aR1GV; - } - - @Override public boolean validateInstance ( - final double[] adblInstance) - { - if (null == adblInstance) return false; - - int iDimension = _aR1GV.length; - - if (adblInstance.length != iDimension) return false; - - for (int i = 0; i < iDimension; ++i) { - if (!_aR1GV[i].validateInstance (adblInstance[i])) return false; - } - - return true; - } - - @Override public boolean match ( - final org.drip.spaces.tensor.GeneralizedVector gvOther) - { - if (null == gvOther || !(gvOther instanceof RdAggregate)) return false; - - RdAggregate rdaOther = (RdAggregate) gvOther; - - int iDimensionOther = rdaOther.dimension(); - - if (iDimensionOther != dimension()) return false; - - org.drip.spaces.tensor.R1GeneralizedVector[] aR1GVOther = rdaOther.vectorSpaces(); - - for (int i = 0; i < iDimensionOther; ++i) { - if (!aR1GVOther[i].match (_aR1GV[i])) return false; - } - - return true; - } - - @Override public boolean subset ( - final org.drip.spaces.tensor.GeneralizedVector gvOther) - { - if (null == gvOther || !(gvOther instanceof RdAggregate)) return false; - - int iDimensionOther = _aR1GV.length; - RdAggregate rdaOther = (RdAggregate) gvOther; - - org.drip.spaces.tensor.R1GeneralizedVector[] aR1GVOther = rdaOther.vectorSpaces(); - - for (int i = 0; i < iDimensionOther; ++i) { - if (!aR1GVOther[i].match (_aR1GV[i])) return false; - } - - return true; - } - - @Override public boolean isPredictorBounded() - { - int iDimension = _aR1GV.length; - - for (int i = 0; i < iDimension; ++i) { - if (!_aR1GV[i].isPredictorBounded()) return false; - } - - return true; - } -} diff --git a/org/drip/spaces/tensor/RdCombinatorialVector.java b/org/drip/spaces/tensor/RdCombinatorialVector.java deleted file mode 100644 index b1a3db5..0000000 --- a/org/drip/spaces/tensor/RdCombinatorialVector.java +++ /dev/null @@ -1,181 +0,0 @@ - -package org.drip.spaces.tensor; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RdCombinatorialVector exposes the Normed/Non-normed Discrete Spaces with R^d Combinatorial Vector - * Elements. - * - * @author Lakshmi Krishnamurthy - */ - -public class RdCombinatorialVector extends org.drip.spaces.tensor.RdAggregate { - - /** - * RdCombinatorialVector Constructor - * - * @param aR1CV Array of the Underlying R^1 Combinatorial Vector Spaces - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public RdCombinatorialVector ( - final org.drip.spaces.tensor.R1CombinatorialVector[] aR1CV) - throws java.lang.Exception - { - super (aR1CV); - } - - @Override public org.drip.spaces.tensor.Cardinality cardinality() - { - org.drip.spaces.tensor.R1GeneralizedVector[] aR1GV = vectorSpaces(); - - int iDimension = aR1GV.length; - double dblCardinalNumber = 1.; - - for (int i = 0; i < iDimension; ++i) - dblCardinalNumber *= ((org.drip.spaces.tensor.R1CombinatorialVector) - aR1GV[i]).cardinality().number(); - - return org.drip.spaces.tensor.Cardinality.CountablyFinite (dblCardinalNumber); - } - - /** - * Retrieve the Multidimensional Iterator associated with the Underlying Vector Space - * - * @return The Multidimensional Iterator associated with the Underlying Vector Space - */ - - public org.drip.spaces.iterator.RdSpanningCombinatorialIterator iterator() - { - org.drip.spaces.tensor.R1GeneralizedVector[] aR1GV = vectorSpaces(); - - int iDimension = aR1GV.length; - org.drip.spaces.tensor.R1CombinatorialVector[] aR1CV = new - org.drip.spaces.tensor.R1CombinatorialVector[iDimension]; - - for (int i = 0; i < iDimension; ++i) - aR1CV[i] = (org.drip.spaces.tensor.R1CombinatorialVector) aR1GV[i]; - - return org.drip.spaces.iterator.RdSpanningCombinatorialIterator.Standard (aR1CV); - } - - @Override public double[] leftDimensionEdge() - { - org.drip.spaces.tensor.R1GeneralizedVector[] aR1GV = vectorSpaces(); - - int iDimension = aR1GV.length; - double[] adblLeftEdge = new double[iDimension]; - - for (int i = 0; i < iDimension; ++i) - adblLeftEdge[i] = ((org.drip.spaces.tensor.R1ContinuousVector) aR1GV[i]).leftEdge(); - - return adblLeftEdge; - } - - @Override public double[] rightDimensionEdge() - { - org.drip.spaces.tensor.R1GeneralizedVector[] aR1GV = vectorSpaces(); - - int iDimension = aR1GV.length; - double[] adblRightEdge = new double[iDimension]; - - for (int i = 0; i < iDimension; ++i) - adblRightEdge[i] = ((org.drip.spaces.tensor.R1ContinuousVector) aR1GV[i]).rightEdge(); - - return adblRightEdge; - } - - @Override public double leftEdge() - { - double[] adblLeftEdge = leftDimensionEdge(); - - int iDimension = adblLeftEdge.length; - double dblLeftEdge = adblLeftEdge[0]; - - for (int i = 1; i < iDimension; ++i) { - if (dblLeftEdge > adblLeftEdge[i]) dblLeftEdge = adblLeftEdge[i]; - } - - return dblLeftEdge; - } - - @Override public double rightEdge() - { - double[] adblRightEdge = rightDimensionEdge(); - - int iDimension = adblRightEdge.length; - double dblRightEdge = adblRightEdge[0]; - - for (int i = 1; i < iDimension; ++i) { - if (dblRightEdge < adblRightEdge[i]) dblRightEdge = adblRightEdge[i]; - } - - return dblRightEdge; - } - - @Override public double hyperVolume() - throws java.lang.Exception - { - if (!isPredictorBounded()) - throw new java.lang.Exception ("RdCombinatorialVector::hyperVolume => Space not Bounded"); - - double[] adblLeftEdge = leftDimensionEdge(); - - double dblHyperVolume = 1.; - int iDimension = adblLeftEdge.length; - - double[] adblRightEdge = rightDimensionEdge(); - - for (int i = 0; i < iDimension; ++i) - dblHyperVolume *= (adblRightEdge[i] - adblLeftEdge[i]); - - return dblHyperVolume; - } -} diff --git a/org/drip/spaces/tensor/RdContinuousVector.java b/org/drip/spaces/tensor/RdContinuousVector.java deleted file mode 100644 index 5108532..0000000 --- a/org/drip/spaces/tensor/RdContinuousVector.java +++ /dev/null @@ -1,177 +0,0 @@ - -package org.drip.spaces.tensor; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RdContinuousVector implements the Normed/non-normed, Bounded/Unbounded Continuous R^d Vector Spaces. - * - * The Reference we've used is: - * - * - Carl, B., and I. Stephani (1990): Entropy, Compactness, and Approximation of Operators, Cambridge - * University Press, Cambridge UK. - * - * @author Lakshmi Krishnamurthy - */ - -public class RdContinuousVector extends org.drip.spaces.tensor.RdAggregate { - - /** - * Construct the RdContinuousVector Instance - * - * @param iDimension The Space Dimension - * - * @return The RdContinuousVector Instance - */ - - public static final RdContinuousVector Standard ( - final int iDimension) - { - try { - return 0 >= iDimension ? null : new RdContinuousVector (new - org.drip.spaces.tensor.R1ContinuousVector[iDimension]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * RdContinuousVector Constructor - * - * @param aR1CV Array of the Continuous R^1 Vector Spaces - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public RdContinuousVector ( - final org.drip.spaces.tensor.R1ContinuousVector[] aR1CV) - throws java.lang.Exception - { - super (aR1CV); - } - - @Override public double[] leftDimensionEdge() - { - org.drip.spaces.tensor.R1GeneralizedVector[] aR1GV = vectorSpaces(); - - int iDimension = aR1GV.length; - double[] adblLeftEdge = new double[iDimension]; - - for (int i = 0; i < iDimension; ++i) - adblLeftEdge[i] = ((org.drip.spaces.tensor.R1ContinuousVector) aR1GV[i]).leftEdge(); - - return adblLeftEdge; - } - - @Override public double[] rightDimensionEdge() - { - org.drip.spaces.tensor.R1GeneralizedVector[] aR1GV = vectorSpaces(); - - int iDimension = aR1GV.length; - double[] adblRightEdge = new double[iDimension]; - - for (int i = 0; i < iDimension; ++i) - adblRightEdge[i] = ((org.drip.spaces.tensor.R1ContinuousVector) aR1GV[i]).rightEdge(); - - return adblRightEdge; - } - - @Override public org.drip.spaces.tensor.Cardinality cardinality() - { - return org.drip.spaces.tensor.Cardinality.UncountablyInfinite(); - } - - @Override public double leftEdge() - { - double[] adblLeftEdge = leftDimensionEdge(); - - int iDimension = adblLeftEdge.length; - double dblLeftEdge = adblLeftEdge[0]; - - for (int i = 1; i < iDimension; ++i) { - if (dblLeftEdge > adblLeftEdge[i]) dblLeftEdge = adblLeftEdge[i]; - } - - return dblLeftEdge; - } - - @Override public double rightEdge() - { - double[] adblRightEdge = rightDimensionEdge(); - - int iDimension = adblRightEdge.length; - double dblRightEdge = adblRightEdge[0]; - - for (int i = 1; i < iDimension; ++i) { - if (dblRightEdge < adblRightEdge[i]) dblRightEdge = adblRightEdge[i]; - } - - return dblRightEdge; - } - - @Override public double hyperVolume() - throws java.lang.Exception - { - if (!isPredictorBounded()) - throw new java.lang.Exception ("ContinuousVectorRd::hyperVolume => Space not Bounded"); - - double[] adblLeftEdge = leftDimensionEdge(); - - double dblHyperVolume = 1.; - int iDimension = adblLeftEdge.length; - - double[] adblRightEdge = rightDimensionEdge(); - - for (int i = 0; i < iDimension; ++i) - dblHyperVolume *= (adblRightEdge[i] - adblLeftEdge[i]); - - return dblHyperVolume; - } -} diff --git a/org/drip/spaces/tensor/RdGeneralizedVector.java b/org/drip/spaces/tensor/RdGeneralizedVector.java deleted file mode 100644 index 25841df..0000000 --- a/org/drip/spaces/tensor/RdGeneralizedVector.java +++ /dev/null @@ -1,102 +0,0 @@ - -package org.drip.spaces.tensor; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RdGeneralizedVector exposes the basic Properties of the Generalized R^d Vector Space. - * - * @author Lakshmi Krishnamurthy - */ - -public interface RdGeneralizedVector extends org.drip.spaces.tensor.GeneralizedVector -{ - - /** - * Retrieve the Dimension of the Space - * - * @return The Dimension of the Space - */ - - public abstract int dimension(); - - /** - * Retrieve the Array of the Underlying R^1 Vector Spaces - * - * @return The Array of the Underlying R^1 Vector Spaces - */ - - public abstract org.drip.spaces.tensor.R1GeneralizedVector[] vectorSpaces(); - - /** - * Validate the Input Instance - * - * @param adblInstance The Input Instance - * - * @return TRUE - Instance is a Valid Entry in the Space - */ - - public abstract boolean validateInstance ( - final double[] adblInstance); - - /** - * Retrieve the Array of the Variate Left Edges - * - * @return The Array of the Variate Left Edges - */ - - public abstract double[] leftDimensionEdge(); - - /** - * Retrieve the Array of the Variate Right Edges - * - * @return The Array of the Variate Right Edges - */ - - public abstract double[] rightDimensionEdge(); -} diff --git a/org/drip/spline/basis/BSplineSequenceParams.java b/org/drip/spline/basis/BSplineSequenceParams.java deleted file mode 100644 index 58d095a..0000000 --- a/org/drip/spline/basis/BSplineSequenceParams.java +++ /dev/null @@ -1,175 +0,0 @@ - -package org.drip.spline.basis; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * This class implements the parameter set for constructing the B Spline Sequence. It provides functionality - * to: - * - Retrieve the B Spline Order - * - Retrieve the Number of Basis Functions - * - Retrieve the Processed Basis Derivative Order - * - Retrieve the Basis Hat Type - * - Retrieve the Shape Control Type - * - Retrieve the Tension - * - Retrieve the Array of Predictor Ordinates - * - * @author Lakshmi Krishnamurthy - */ - -public class BSplineSequenceParams { - private int _iNumBasis = -1; - private int _iBSplineOrder = -1; - private int _iProcBasisDerivOrder = -1; - private java.lang.String _strHatType = ""; - private double _dblTension = java.lang.Double.NaN; - private java.lang.String _strShapeControlType = ""; - - public BSplineSequenceParams ( - final java.lang.String strHatType, - final java.lang.String strShapeControlType, - final int iNumBasis, - final int iBSplineOrder, - final double dblTension, - final int iProcBasisDerivOrder) - throws java.lang.Exception - { - _iNumBasis = iNumBasis; - _strHatType = strHatType; - _dblTension = dblTension; - _iBSplineOrder = iBSplineOrder; - _strShapeControlType = strShapeControlType; - _iProcBasisDerivOrder = iProcBasisDerivOrder; - } - - /** - * Retrieve the B Spline Order - * - * @return The B Spline Order - */ - - public int bSplineOrder() - { - return _iBSplineOrder; - } - - /** - * Retrieve the Number of Basis Functions - * - * @return The Number of Basis Functions - */ - - public int numBasis() - { - return _iNumBasis; - } - - /** - * Retrieve the Processed Basis Derivative Order - * - * @return The Processed Basis Derivative Order - */ - - public int procBasisDerivOrder() - { - return _iProcBasisDerivOrder; - } - - /** - * Retrieve the Basis Hat Type - * - * @return The Basis Hat Type - */ - - public java.lang.String hat() - { - return _strHatType; - } - - /** - * Retrieve the Shape Control Type - * - * @return The Shape Control Type - */ - - public java.lang.String shapeControl() - { - return _strShapeControlType; - } - - /** - * Retrieve the Tension - * - * @return The Tension - */ - - public double tension() - { - return _dblTension; - } - - /** - * Retrieve the Array of Predictor Ordinates - * - * @return The Array of Predictor Ordinates - */ - - public double[] predictorOrdinates() - { - int iNumPredictorOrdinate = _iBSplineOrder + _iNumBasis; - double[] adblPredictorOrdinate = new double[iNumPredictorOrdinate]; - double dblPredictorOrdinateIncrement = 1. / (_iBSplineOrder + _iNumBasis - 1); - - for (int i = 0; i < iNumPredictorOrdinate; ++i) - adblPredictorOrdinate[i] = dblPredictorOrdinateIncrement * i; - - return adblPredictorOrdinate; - } -} diff --git a/org/drip/spline/basis/ExponentialMixtureSetParams.java b/org/drip/spline/basis/ExponentialMixtureSetParams.java deleted file mode 100644 index 0477bff..0000000 --- a/org/drip/spline/basis/ExponentialMixtureSetParams.java +++ /dev/null @@ -1,98 +0,0 @@ - -package org.drip.spline.basis; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * ExponentialMixtureSetParams implements per-segment parameters for the exponential mixture basis set - - * the array of the exponential tension parameters, one per each entity in the mixture. - * - * @author Lakshmi Krishnamurthy - */ - -public class ExponentialMixtureSetParams implements org.drip.spline.basis.FunctionSetBuilderParams { - private double[] _adblTension = null; - - /** - * ExponentialMixtureSetParams constructor - * - * @param adblTension Array of the Tension Parameters - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ExponentialMixtureSetParams ( - final double[] adblTension) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_adblTension = adblTension)) - throw new java.lang.Exception ("ExponentialMixtureSetParams ctr: Invalid Inputs"); - } - - /** - * Get the Indexed Exponential Tension Entry - * - * @param iIndex The Index - * - * @return The Indexed Exponential Tension Entry - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double tension ( - final int iIndex) - throws java.lang.Exception - { - if (iIndex >= _adblTension.length) - throw new java.lang.Exception ("ExponentialMixtureSetParams::tension => Invalid Index"); - - return _adblTension[iIndex]; - } -} diff --git a/org/drip/spline/basis/ExponentialRationalSetParams.java b/org/drip/spline/basis/ExponentialRationalSetParams.java deleted file mode 100644 index 620f1d8..0000000 --- a/org/drip/spline/basis/ExponentialRationalSetParams.java +++ /dev/null @@ -1,104 +0,0 @@ - -package org.drip.spline.basis; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * ExponentialRationalSetParams implements per-segment parameters for the exponential rational basis set - * - the exponential tension and the rational tension parameters. - * - * @author Lakshmi Krishnamurthy - */ - -public class ExponentialRationalSetParams implements org.drip.spline.basis.FunctionSetBuilderParams { - private double _dblRationalTension = java.lang.Double.NaN; - private double _dblExponentialTension = java.lang.Double.NaN; - - /** - * ExponentialRationalSetParams constructor - * - * @param dblExponentialTension Segment Tension - * @param dblRationalTension Segment Tension - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ExponentialRationalSetParams ( - final double dblExponentialTension, - final double dblRationalTension) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblExponentialTension = dblExponentialTension) || - !org.drip.quant.common.NumberUtil.IsValid (_dblRationalTension = dblRationalTension)) - throw new java.lang.Exception ("ExponentialRationalSetParams ctr: Invalid Inputs"); - } - - /** - * Get the Exponential Tension - * - * @return The Exponential Tension - */ - - public double exponentialTension() - { - return _dblExponentialTension; - } - - /** - * Get the Rational Tension - * - * @return The Rational Tension - */ - - public double rationalTension() - { - return _dblRationalTension; - } -} diff --git a/org/drip/spline/basis/ExponentialTensionSetParams.java b/org/drip/spline/basis/ExponentialTensionSetParams.java deleted file mode 100644 index dc12aed..0000000 --- a/org/drip/spline/basis/ExponentialTensionSetParams.java +++ /dev/null @@ -1,89 +0,0 @@ - -package org.drip.spline.basis; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * ExponentialTensionSetParams implements per-segment parameters for the exponential tension basis set - - * currently it only contains the tension parameter. - * - * @author Lakshmi Krishnamurthy - */ - -public class ExponentialTensionSetParams implements org.drip.spline.basis.FunctionSetBuilderParams { - private double _dblTension = java.lang.Double.NaN; - - /** - * ExponentialTensionSetParams constructor - * - * @param dblTension Segment Tension - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ExponentialTensionSetParams ( - final double dblTension) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblTension = dblTension)) - throw new java.lang.Exception ("ExponentialTensionSetParams ctr: Invalid Inputs"); - } - - /** - * Get the Segment Tension - * - * @return The Segment Tension - */ - - public double tension() - { - return _dblTension; - } -} diff --git a/org/drip/spline/basis/FunctionSet.java b/org/drip/spline/basis/FunctionSet.java deleted file mode 100644 index 150c4c4..0000000 --- a/org/drip/spline/basis/FunctionSet.java +++ /dev/null @@ -1,102 +0,0 @@ - -package org.drip.spline.basis; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * This class implements the basis spline function set. - * - * @author Lakshmi Krishnamurthy - */ - -public class FunctionSet { - private org.drip.function.definition.R1ToR1[] _aAUResponseBasis = null; - - /** - * @param aAUResponseBasis Array of the Basis Function Set - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public FunctionSet ( - final org.drip.function.definition.R1ToR1[] aAUResponseBasis) - throws java.lang.Exception - { - if (null == (_aAUResponseBasis = aAUResponseBasis) || 0 == _aAUResponseBasis.length) - throw new java.lang.Exception ("FunctionSet ctr: Invalid Inputs!"); - } - - /** - * Retrieve the Number of Basis Functions - * - * @return Number of Basis Functions - */ - - public int numBasis() - { - return _aAUResponseBasis.length; - } - - /** - * Retrieve the Basis Function identified by the specified Index - * - * @param iBasisIndex The Basis Function Index - * - * @return The Basis Function identified by the specified Index - */ - - public org.drip.function.definition.R1ToR1 indexedBasisFunction ( - final int iBasisIndex) - { - if (iBasisIndex >= numBasis()) return null; - - return _aAUResponseBasis[iBasisIndex]; - } -} diff --git a/org/drip/spline/basis/FunctionSetBuilder.java b/org/drip/spline/basis/FunctionSetBuilder.java deleted file mode 100644 index 908d29c..0000000 --- a/org/drip/spline/basis/FunctionSetBuilder.java +++ /dev/null @@ -1,382 +0,0 @@ - -package org.drip.spline.basis; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * This class implements the basis set and spline builder for the following types of splines: - * - * - Exponential basis tension splines - * - Hyperbolic basis tension splines - * - Polynomial basis splines - * - Bernstein Polynomial basis splines - * - Kaklis Pandelis basis tension splines - * - * This elastic coefficients for the segment using Ck basis splines inside [0,...,1) - Globally - * [x_0,...,x_1) are extracted for: - * - * y = Estimator (Ck, x) * ShapeControl (x) - * - * where x is the normalized ordinate mapped as - * - * x becomes (x - x_i-1) / (x_i - x_i-1) - * - * The inverse quadratic/rational spline is a typical shape controller spline used. - * - * @author Lakshmi Krishnamurthy - */ - -public class FunctionSetBuilder { - - /** - * This function implements the elastic coefficients for the segment using tension exponential basis - * splines inside - [0,...,1) - Globally [x_0,...,x_1). The segment equation is - * - * y = A + B * x + C * exp (Tension * x / (x_i - x_i-1)) + D * exp (-Tension * x / (x_i - x_i-1)) - * - * where x is the normalized ordinate mapped as - * - * x .gte. (x - x_i-1) / (x_i - x_i-1) - * - * @param etsp Exponential Tension Basis set Builder Parameters - * - * @return Exponential Tension Basis Functions - */ - - public static final org.drip.spline.basis.FunctionSet ExponentialTensionBasisSet ( - final org.drip.spline.basis.ExponentialTensionSetParams etsp) - { - if (null == etsp) return null; - - double dblTension = etsp.tension(); - - try { - return new org.drip.spline.basis.FunctionSet (new org.drip.function.definition.R1ToR1[] - {new org.drip.function.r1tor1.Polynomial (0), new org.drip.function.r1tor1.Polynomial (1), - new org.drip.function.r1tor1.ExponentialTension (java.lang.Math.E, dblTension), new - org.drip.function.r1tor1.ExponentialTension (java.lang.Math.E, -dblTension)}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * This function implements the elastic coefficients for the segment using tension hyperbolic basis - * splines inside - [0,...,1) - Globally [x_0,...,x_1). The segment equation is - * - * y = A + B * x + C * sinh (Tension * x / (x_i - x_i-1)) + D * cosh (Tension * x / (x_i - x_i-1)) - * - * where x is the normalized ordinate mapped as - * - * x .ge. (x - x_i-1) / (x_i - x_i-1) - * - * @param etsp Exponential Tension Basis set Builder Parameters - * - * @return Hyperbolic Tension Basis Set - */ - - public static final org.drip.spline.basis.FunctionSet HyperbolicTensionBasisSet ( - final org.drip.spline.basis.ExponentialTensionSetParams etsp) - { - if (null == etsp) return null; - - double dblTension = etsp.tension(); - - try { - return new org.drip.spline.basis.FunctionSet (new org.drip.function.definition.R1ToR1[] - {new org.drip.function.r1tor1.Polynomial (0), new org.drip.function.r1tor1.Polynomial (1), - new org.drip.function.r1tor1.HyperbolicTension - (org.drip.function.r1tor1.HyperbolicTension.COSH, dblTension), new - org.drip.function.r1tor1.HyperbolicTension - (org.drip.function.r1tor1.HyperbolicTension.SINH, dblTension)}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * This function implements the elastic coefficients for the segment using polynomial basis splines - * inside [0,...,1) - Globally [x_0,...,x_1): - * - * y = Sum (A_i*x^i) i = 0,...,n (0 and n inclusive) - * - * where x is the normalized ordinate mapped as - * - * x .gte. (x - x_i-1) / (x_i - x_i-1) - * - * @param pfsp Polynomial Basis set Builder Parameters - * - * @return The Polynomial Basis Spline Set - */ - - public static final org.drip.spline.basis.FunctionSet PolynomialBasisSet ( - final org.drip.spline.basis.PolynomialFunctionSetParams pfsp) - { - if (null == pfsp) return null; - - int iNumBasis = pfsp.numBasis(); - - org.drip.function.definition.R1ToR1[] aAU = new - org.drip.function.definition.R1ToR1[iNumBasis]; - - try { - for (int i = 0; i < iNumBasis; ++i) - aAU[i] = new org.drip.function.r1tor1.Polynomial (i); - - return new org.drip.spline.basis.FunctionSet (aAU); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * This function implements the elastic coefficients for the segment using Bernstein polynomial basis - * splines inside - [0,...,1) - Globally [x_0,...,x_1): - * - * y = Sum (A_i*B^i(x)) i = 0,...,n (0 and n inclusive) - * - * where x is the normalized ordinate mapped as - * - * x .gte. (x - x_i-1) / (x_i - x_i-1) - * - * and B^i(x) is the Bernstein basis polynomial of order i. - * - * @param pfsp Polynomial Basis set Builder Parameters - * - * @return The Bernstein polynomial basis - */ - - public static final org.drip.spline.basis.FunctionSet BernsteinPolynomialBasisSet ( - final org.drip.spline.basis.PolynomialFunctionSetParams pfsp) - { - if (null == pfsp) return null; - - int iNumBasis = pfsp.numBasis(); - - org.drip.function.definition.R1ToR1[] aAU = new - org.drip.function.definition.R1ToR1[iNumBasis]; - - try { - for (int i = 0; i < iNumBasis; ++i) - aAU[i] = new org.drip.function.r1tor1.BernsteinPolynomial (i, iNumBasis - 1 - i); - - return new org.drip.spline.basis.FunctionSet (aAU); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct KaklisPandelis from the polynomial tension basis function set - * - * y = A * (1-x) + B * x + C * x * (1-x)^m + D * x^m * (1-x) - * - * @param kpsp Kaklis Pandelis Basis set Builder Parameters - * - * @return The KaklisPandelis Basis Set - */ - - public static final org.drip.spline.basis.FunctionSet KaklisPandelisBasisSet ( - final org.drip.spline.basis.KaklisPandelisSetParams kpsp) - { - if (null == kpsp) return null; - - try { - org.drip.function.definition.R1ToR1 auLinearPoly = new org.drip.function.r1tor1.Polynomial - (1); - - org.drip.function.definition.R1ToR1 auReflectedLinearPoly = new - org.drip.function.r1tor1.UnivariateReflection (auLinearPoly); - - org.drip.function.definition.R1ToR1 auKaklisPandelisPolynomial = new - org.drip.function.r1tor1.Polynomial (kpsp.polynomialTensionDegree()); - - return new org.drip.spline.basis.FunctionSet (new org.drip.function.definition.R1ToR1[] - {auReflectedLinearPoly, auLinearPoly, new org.drip.function.r1tor1.UnivariateConvolution - (auLinearPoly, new org.drip.function.r1tor1.UnivariateReflection - (auKaklisPandelisPolynomial)), new org.drip.function.r1tor1.UnivariateConvolution - (auKaklisPandelisPolynomial, auReflectedLinearPoly)}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct the Exponential Rational Basis Set - * - * y = A + B / (1+x) + C * exp(-x) + D * exp(-x) / (1+x) - * - * @param ersp Exponential Rational Basis set Parameters - * - * @return The Exponential Rational Basis Set - */ - - public static final org.drip.spline.basis.FunctionSet ExponentialRationalBasisSet ( - final org.drip.spline.basis.ExponentialRationalSetParams ersp) - { - if (null == ersp) return null; - - try { - org.drip.function.definition.R1ToR1 auLinearPoly = new org.drip.function.r1tor1.Polynomial - (0); - - org.drip.function.definition.R1ToR1 auLRSC = new - org.drip.function.r1tor1.LinearRationalShapeControl (ersp.rationalTension()); - - org.drip.function.definition.R1ToR1 auET = new - org.drip.function.r1tor1.ExponentialTension (java.lang.Math.E, -ersp.exponentialTension()); - - org.drip.function.definition.R1ToR1 auLRET = new - org.drip.function.r1tor1.LinearRationalTensionExponential (-ersp.exponentialTension(), - ersp.rationalTension()); - - return new org.drip.spline.basis.FunctionSet (new org.drip.function.definition.R1ToR1[] - {auLinearPoly, auLRSC, auET, auLRET}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct the Exponential Mixture Basis Set - * - * y = A + B * exp(-l_1 * x) + C * exp(-l_2 * x) + D * exp(-l_3 * x) - * - * @param emsp Exponential Mixture Basis set Parameters - * - * @return The Exponential Mixture Basis Set - */ - - public static final org.drip.spline.basis.FunctionSet ExponentialMixtureBasisSet ( - final org.drip.spline.basis.ExponentialMixtureSetParams emsp) - { - if (null == emsp) return null; - - try { - org.drip.function.definition.R1ToR1 auLinearPoly = new - org.drip.function.r1tor1.Polynomial (0); - - org.drip.function.definition.R1ToR1 auExp1 = new - org.drip.function.r1tor1.ExponentialTension (java.lang.Math.E, -emsp.tension (0)); - - org.drip.function.definition.R1ToR1 auExp2 = new - org.drip.function.r1tor1.ExponentialTension (java.lang.Math.E, -emsp.tension (1)); - - org.drip.function.definition.R1ToR1 auExp3 = new - org.drip.function.r1tor1.ExponentialTension (java.lang.Math.E, -emsp.tension (2)); - - return new org.drip.spline.basis.FunctionSet (new org.drip.function.definition.R1ToR1[] - {auLinearPoly, auExp1, auExp2, auExp3}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct the BSpline Basis Function Set - * - * @param bssp BSpline Basis Set Parameters - * - * @return The BSpline Basis Function Set - */ - - public static final org.drip.spline.basis.FunctionSet BSplineBasisSet ( - final org.drip.spline.basis.BSplineSequenceParams bssp) - { - if (null == bssp) return null; - - org.drip.spline.bspline.SegmentBasisFunction[] aSBF = - org.drip.spline.bspline.SegmentBasisFunctionGenerator.MonicSequence (bssp.hat(), - bssp.shapeControl(), bssp.predictorOrdinates(), bssp.procBasisDerivOrder(), bssp.tension()); - - if (null == aSBF || bssp.numBasis() >= aSBF.length) return null; - - int iBSplineOrder = bssp.bSplineOrder(); - - try { - return new org.drip.spline.bspline.SegmentBasisFunctionSet (bssp.numBasis(), bssp.tension(), 2 == - iBSplineOrder ? aSBF : org.drip.spline.bspline.SegmentBasisFunctionGenerator.MulticSequence - (iBSplineOrder, aSBF)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - public static final void main ( - final java.lang.String[] astrArgs) - throws java.lang.Exception - { - org.drip.spline.basis.BSplineSequenceParams bssp = new org.drip.spline.basis.BSplineSequenceParams - (org.drip.spline.bspline.BasisHatPairGenerator.RAW_TENSION_HYPERBOLIC, - org.drip.spline.bspline.BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_LINEAR, 2, 4, 1., -1); - - org.drip.quant.common.NumberUtil.Print1DArray ("BSSP", bssp.predictorOrdinates(), false); - - org.drip.spline.basis.FunctionSet fsBSS = BSplineBasisSet (bssp); - - System.out.println ("fsBSS Size = " + fsBSS.numBasis()); - } -} diff --git a/org/drip/spline/basis/FunctionSetBuilderParams.java b/org/drip/spline/basis/FunctionSetBuilderParams.java deleted file mode 100644 index 190313e..0000000 --- a/org/drip/spline/basis/FunctionSetBuilderParams.java +++ /dev/null @@ -1,61 +0,0 @@ - -package org.drip.spline.basis; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * FunctionSetBuilderParams is an empty stub class whose derived implementations hold the per-segment basis - * set parameters. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract interface FunctionSetBuilderParams { -} diff --git a/org/drip/spline/basis/KaklisPandelisSetParams.java b/org/drip/spline/basis/KaklisPandelisSetParams.java deleted file mode 100644 index 1a32b78..0000000 --- a/org/drip/spline/basis/KaklisPandelisSetParams.java +++ /dev/null @@ -1,89 +0,0 @@ - -package org.drip.spline.basis; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * KaklisPandelisSetParams implements per-segment parameters for the Kaklis Pandelis basis set - - * currently it only holds the polynomial tension degree. - * - * @author Lakshmi Krishnamurthy - */ - -public class KaklisPandelisSetParams implements org.drip.spline.basis.FunctionSetBuilderParams { - private int _iPolynomialTensionDegree = -1; - - /** - * KaklisPandelisSetParams constructor - * - * @param iPolynomialTensionDegree Segment Polynomial Tension Degree - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public KaklisPandelisSetParams ( - final int iPolynomialTensionDegree) - throws java.lang.Exception - { - if (0 >= (_iPolynomialTensionDegree = iPolynomialTensionDegree)) - throw new java.lang.Exception ("KaklisPandelisSetParams ctr: Invalid Inputs"); - } - - /** - * Get the Segment Polynomial Tension Degree - * - * @return The Segment Polynomial Tension Degree - */ - - public int polynomialTensionDegree() - { - return _iPolynomialTensionDegree; - } -} diff --git a/org/drip/spline/basis/PolynomialFunctionSetParams.java b/org/drip/spline/basis/PolynomialFunctionSetParams.java deleted file mode 100644 index 9b16fc6..0000000 --- a/org/drip/spline/basis/PolynomialFunctionSetParams.java +++ /dev/null @@ -1,89 +0,0 @@ - -package org.drip.spline.basis; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * PolynomialFunctionSetParams implements per-segment basis set parameters for the polynomial basis spline - - * currently it holds the number of basis functions. - * - * @author Lakshmi Krishnamurthy - */ - -public class PolynomialFunctionSetParams implements org.drip.spline.basis.FunctionSetBuilderParams { - private int _iNumBasis = -1; - - /** - * PolynomialFunctionSetParams constructor - * - * @param iNumBasis Number of Spline Basis Functions in the Set - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public PolynomialFunctionSetParams ( - final int iNumBasis) - throws java.lang.Exception - { - if (0 >= (_iNumBasis = iNumBasis)) - throw new java.lang.Exception ("PolynomialFunctionSetParams ctr: Invalid Inputs"); - } - - /** - * Get the Number of Spline Basis Functions in the Set - * - * @return The Number of Spline Basis Functions in the Set - */ - - public int numBasis() - { - return _iNumBasis; - } -} diff --git a/org/drip/spline/bspline/BasisHatPairGenerator.java b/org/drip/spline/bspline/BasisHatPairGenerator.java deleted file mode 100644 index 392dd4e..0000000 --- a/org/drip/spline/bspline/BasisHatPairGenerator.java +++ /dev/null @@ -1,227 +0,0 @@ - -package org.drip.spline.bspline; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * BasisHatPairGenerator implements the generation functionality behind the hat basis function pair. It - * provides the following functionality: - * - Generate the array of the Hyperbolic Phy and Psy Hat Function Pair. - * - Generate the array of the Hyperbolic Phy and Psy Hat Function Pair From their Raw Counterparts. - * - Generate the array of the Cubic Rational Phy and Psy Hat Function Pair From their Raw Counterparts. - * - Generate the array of the Custom Phy and Psy Hat Function Pair From their Raw Counterparts. - * - * @author Lakshmi Krishnamurthy - */ - -public class BasisHatPairGenerator { - - /** - * Raw Tension Hyperbolic B Spline Basis Hat Phy and Psy - */ - - public static final java.lang.String RAW_TENSION_HYPERBOLIC = "RAW_TENSION_HYPERBOLIC"; - - /** - * Processed Tension Hyperbolic B Spline Basis Hat Phy and Psy - */ - - public static final java.lang.String PROCESSED_TENSION_HYPERBOLIC = "PROCESSED_TENSION_HYPERBOLIC"; - - /** - * Processed Cubic Rational B Spline Basis Hat Phy and Psy - */ - - public static final java.lang.String PROCESSED_CUBIC_RATIONAL = "PROCESSED_CUBIC_RATIONAL"; - - /** - * Generate the array of the Hyperbolic Phy and Psy Hat Function Pair - * - * @param dblPredictorOrdinateLeading The Leading Predictor Ordinate - * @param dblPredictorOrdinateFollowing The Following Predictor Ordinate - * @param dblPredictorOrdinateTrailing The Trailing Predictor Ordinate - * @param dblTension Tension - * - * @return The array of Hyperbolic Phy and Psy Hat Function Pair - */ - - public static final org.drip.spline.bspline.TensionBasisHat[] HyperbolicTensionHatPair ( - final double dblPredictorOrdinateLeading, - final double dblPredictorOrdinateFollowing, - final double dblPredictorOrdinateTrailing, - final double dblTension) - { - try { - return new org.drip.spline.bspline.TensionBasisHat[] {new - org.drip.spline.bspline.ExponentialTensionLeftHat (dblPredictorOrdinateLeading, - dblPredictorOrdinateFollowing, dblTension), new - org.drip.spline.bspline.ExponentialTensionRightHat (dblPredictorOrdinateFollowing, - dblPredictorOrdinateTrailing, dblTension)}; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the array of the Hyperbolic Phy and Psy Hat Function Pair From their Raw Counterparts - * - * @param dblPredictorOrdinateLeading The Leading Predictor Ordinate - * @param dblPredictorOrdinateFollowing The Following Predictor Ordinate - * @param dblPredictorOrdinateTrailing The Trailing Predictor Ordinate - * @param iDerivOrder The Derivative Order - * @param dblTension Tension - * - * @return The array of Hyperbolic Phy and Psy Hat Function Pair - */ - - public static final org.drip.spline.bspline.TensionBasisHat[] ProcessedHyperbolicTensionHatPair ( - final double dblPredictorOrdinateLeading, - final double dblPredictorOrdinateFollowing, - final double dblPredictorOrdinateTrailing, - final int iDerivOrder, - final double dblTension) - { - try { - return new org.drip.spline.bspline.TensionBasisHat[] {new - org.drip.spline.bspline.TensionProcessedBasisHat (new - org.drip.spline.bspline.ExponentialTensionLeftRaw (dblPredictorOrdinateLeading, - dblPredictorOrdinateFollowing, dblTension), iDerivOrder), new - org.drip.spline.bspline.TensionProcessedBasisHat (new - org.drip.spline.bspline.ExponentialTensionRightRaw - (dblPredictorOrdinateFollowing, dblPredictorOrdinateTrailing, - dblTension), iDerivOrder)}; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the array of the Cubic Rational Phy and Psy Hat Function Pair From their Raw Counterparts - * - * @param strShapeControlType Type of the Shape Controller to be used - NONE, LINEAR/QUADRATIC Rational - * @param dblPredictorOrdinateLeading The Leading Predictor Ordinate - * @param dblPredictorOrdinateFollowing The Following Predictor Ordinate - * @param dblPredictorOrdinateTrailing The Trailing Predictor Ordinate - * @param iDerivOrder The Derivative Order - * @param dblTension Tension - * - * @return The array of Cubic Rational Phy and Psy Hat Function Pair - */ - - public static final org.drip.spline.bspline.TensionBasisHat[] ProcessedCubicRationalHatPair ( - final java.lang.String strShapeControlType, - final double dblPredictorOrdinateLeading, - final double dblPredictorOrdinateFollowing, - final double dblPredictorOrdinateTrailing, - final int iDerivOrder, - final double dblTension) - { - try { - return new org.drip.spline.bspline.TensionBasisHat[] {new - org.drip.spline.bspline.TensionProcessedBasisHat (new - org.drip.spline.bspline.CubicRationalLeftRaw (dblPredictorOrdinateLeading, - dblPredictorOrdinateFollowing, strShapeControlType, dblTension), iDerivOrder), new - org.drip.spline.bspline.TensionProcessedBasisHat (new - org.drip.spline.bspline.CubicRationalRightRaw (dblPredictorOrdinateFollowing, - dblPredictorOrdinateTrailing, strShapeControlType, dblTension), - iDerivOrder)}; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the array of the Cubic Rational Phy and Psy Hat Function Pair From their Raw Counterparts - * - * @param strHatType The Primitive Hat Type - * @param strShapeControlType Type of the Shape Controller to be used - NONE, LINEAR/QUADRATIC Rational - * @param dblPredictorOrdinateLeading The Leading Predictor Ordinate - * @param dblPredictorOrdinateFollowing The Following Predictor Ordinate - * @param dblPredictorOrdinateTrailing The Trailing Predictor Ordinate - * @param iDerivOrder The Derivative Order - * @param dblTension Tension - * - * @return The array of Cubic Rational Phy and Psy Hat Function Pair - */ - - public static final org.drip.spline.bspline.TensionBasisHat[] GenerateHatPair ( - final java.lang.String strHatType, - final java.lang.String strShapeControlType, - final double dblPredictorOrdinateLeading, - final double dblPredictorOrdinateFollowing, - final double dblPredictorOrdinateTrailing, - final int iDerivOrder, - final double dblTension) - { - if (null == strHatType || (!RAW_TENSION_HYPERBOLIC.equalsIgnoreCase (strHatType) && - !PROCESSED_TENSION_HYPERBOLIC.equalsIgnoreCase (strHatType) && - !PROCESSED_CUBIC_RATIONAL.equalsIgnoreCase (strHatType))) - return null; - - if (org.drip.spline.bspline.BasisHatPairGenerator.RAW_TENSION_HYPERBOLIC.equalsIgnoreCase - (strHatType)) - return HyperbolicTensionHatPair (dblPredictorOrdinateLeading, dblPredictorOrdinateFollowing, - dblPredictorOrdinateTrailing, dblTension); - - if (org.drip.spline.bspline.BasisHatPairGenerator.PROCESSED_TENSION_HYPERBOLIC.equalsIgnoreCase - (strHatType)) - return ProcessedHyperbolicTensionHatPair (dblPredictorOrdinateLeading, - dblPredictorOrdinateFollowing, dblPredictorOrdinateTrailing, iDerivOrder, dblTension); - - return ProcessedCubicRationalHatPair (strShapeControlType, dblPredictorOrdinateLeading, - dblPredictorOrdinateFollowing, dblPredictorOrdinateTrailing, iDerivOrder, dblTension); - } -} diff --git a/org/drip/spline/bspline/BasisHatShapeControl.java b/org/drip/spline/bspline/BasisHatShapeControl.java deleted file mode 100644 index 104b87d..0000000 --- a/org/drip/spline/bspline/BasisHatShapeControl.java +++ /dev/null @@ -1,128 +0,0 @@ - -package org.drip.spline.bspline; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * BasisHatShapeControl implements the shape control function for the hat basis set as laid out in the - * framework outlined in Koch and Lyche (1989), Koch and Lyche (1993), and Kvasov (2000) Papers. - * - * Currently BasisHatShapeControl implements the following shape control customizers: - * - Cubic Polynomial with Rational Linear Shape Controller. - * - Cubic Polynomial with Rational Quadratic Shape Controller. - * - Cubic Polynomial with Rational Exponential Shape Controller. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class BasisHatShapeControl extends org.drip.spline.bspline.TensionBasisHat { - - /** - * Cubic Polynomial with Rational Linear Shape Controller - */ - - public static final java.lang.String SHAPE_CONTROL_RATIONAL_LINEAR = - "SHAPE_CONTROL_RATIONAL_LINEAR"; - - /** - * Cubic Polynomial with Rational Quadratic Shape Controller - */ - - public static final java.lang.String SHAPE_CONTROL_RATIONAL_QUADRATIC = - "SHAPE_CONTROL_RATIONAL_QUADRATIC"; - - /** - * Cubic Polynomial with Rational Exponential Shape Controller - */ - - public static final java.lang.String SHAPE_CONTROL_RATIONAL_EXPONENTIAL = - "SHAPE_CONTROL_RATIONAL_EXPONENTIAL"; - - private java.lang.String _strShapeControlType = ""; - - /** - * BasisHatShapeControl constructor - * - * @param dblLeftPredictorOrdinate The Left Predictor Ordinate - * @param dblRightPredictorOrdinate The Right Predictor Ordinate - * @param strShapeControlType Type of the Shape Controller to be used - LINEAR/QUADRATIC/EXPONENTIAL - * Rational - * @param dblTension Tension of the Tension Hat Function - * - * @throws java.lang.Exception Thrown if the input is invalid - */ - - public BasisHatShapeControl ( - final double dblLeftPredictorOrdinate, - final double dblRightPredictorOrdinate, - final java.lang.String strShapeControlType, - final double dblTension) - throws java.lang.Exception - { - super (dblLeftPredictorOrdinate, dblRightPredictorOrdinate, dblTension); - - if (null == (_strShapeControlType = strShapeControlType) || - (!SHAPE_CONTROL_RATIONAL_LINEAR.equalsIgnoreCase (_strShapeControlType) && - !SHAPE_CONTROL_RATIONAL_QUADRATIC.equalsIgnoreCase (_strShapeControlType) && - !SHAPE_CONTROL_RATIONAL_EXPONENTIAL.equalsIgnoreCase (_strShapeControlType))) - throw new java.lang.Exception ("BasisHatShapeControl ctr: Invalid Inputs"); - } - - /** - * Retrieve the Type of the Shape Controller - * - * @return The Type of the Shape Controller - */ - - public java.lang.String shapeControlType() - { - return _strShapeControlType; - } -} diff --git a/org/drip/spline/bspline/CubicRationalLeftRaw.java b/org/drip/spline/bspline/CubicRationalLeftRaw.java deleted file mode 100644 index d7e8c48..0000000 --- a/org/drip/spline/bspline/CubicRationalLeftRaw.java +++ /dev/null @@ -1,152 +0,0 @@ - -package org.drip.spline.bspline; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * CubicRationalLeftRaw implements the TensionBasisHat interface in accordance with the raw left cubic - * rational hat basis function laid out in the basic framework outlined in Koch and Lyche (1989), Koch and - * Lyche (1993), and Kvasov (2000) Papers. - * - * @author Lakshmi Krishnamurthy - */ - -public class CubicRationalLeftRaw extends org.drip.spline.bspline.TensionBasisHat { - private org.drip.spline.bspline.LeftHatShapeControl _lhsc = null; - - /** - * CubicRationalLeftRaw constructor - * - * @param dblLeftPredictorOrdinate The Left Predictor Ordinate - * @param dblRightPredictorOrdinate The Right Predictor Ordinate - * @param strShapeControlType Type of the Shape Controller to be used - NONE, LINEAR/QUADRATIC Rational - * @param dblTension Tension of the Tension Hat Function - * - * @throws java.lang.Exception Thrown if the input is invalid - */ - - public CubicRationalLeftRaw ( - final double dblLeftPredictorOrdinate, - final double dblRightPredictorOrdinate, - final java.lang.String strShapeControlType, - final double dblTension) - throws java.lang.Exception - { - super (dblLeftPredictorOrdinate, dblRightPredictorOrdinate, dblTension); - - _lhsc = new org.drip.spline.bspline.LeftHatShapeControl (dblLeftPredictorOrdinate, - dblRightPredictorOrdinate, strShapeControlType, dblTension); - } - - @Override public double evaluate ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - if (!in (dblPredictorOrdinate)) return 0.; - - double dblCubicValue = (dblPredictorOrdinate - left()) * (dblPredictorOrdinate - left()) * - (dblPredictorOrdinate - left()); - - return 0. == tension() ? dblCubicValue / 6. : dblCubicValue * _lhsc.evaluate (dblPredictorOrdinate); - } - - @Override public double derivative ( - final double dblPredictorOrdinate, - final int iOrder) - throws java.lang.Exception - { - if (0 >= iOrder) - throw new java.lang.Exception ("CubicRationalLeftRaw::derivative => Invalid Inputs"); - - if (!in (dblPredictorOrdinate)) return 0.; - - if (0. != tension()) return super.derivative (dblPredictorOrdinate, iOrder); - - double dblGap = dblPredictorOrdinate - left(); - - if (1 == iOrder) return 0.5 * dblGap * dblGap; - - if (2 == iOrder) return dblGap; - - return 3 == iOrder ? 1. : 0.; - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || !org.drip.quant.common.NumberUtil.IsValid - (dblEnd)) - throw new java.lang.Exception ("CubicRationalLeftRaw::integrate => Invalid Inputs"); - - if (dblEnd >= dblBegin) return 0.; - - double dblBoundedBegin = org.drip.quant.common.NumberUtil.Bound (dblBegin, left(), right()); - - double dblBoundedEnd = org.drip.quant.common.NumberUtil.Bound (dblEnd, left(), right()); - - if (0. != tension()) return super.integrate (dblBoundedBegin, dblBoundedEnd); - - double dblBeginGap = dblBoundedBegin - left(); - - double dblEndGap = dblBoundedEnd - left(); - - return 0.25 * (dblEndGap * dblEndGap * dblEndGap * dblEndGap - dblBeginGap * dblBeginGap * - dblBeginGap * dblBeginGap); - } - - @Override public double normalizer() - { - double dblWidth = right() - left(); - - return 0.25 * dblWidth * dblWidth * dblWidth * dblWidth; - } -} diff --git a/org/drip/spline/bspline/CubicRationalRightRaw.java b/org/drip/spline/bspline/CubicRationalRightRaw.java deleted file mode 100644 index 046f1e3..0000000 --- a/org/drip/spline/bspline/CubicRationalRightRaw.java +++ /dev/null @@ -1,152 +0,0 @@ - -package org.drip.spline.bspline; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * CubicRationalRightRaw implements the TensionBasisHat interface in accordance with the raw right cubic - * rational hat basis function laid out in the basic framework outlined in Koch and Lyche (1989), Koch and - * Lyche (1993), and Kvasov (2000) Papers. - * - * @author Lakshmi Krishnamurthy - */ - -public class CubicRationalRightRaw extends org.drip.spline.bspline.TensionBasisHat { - private org.drip.spline.bspline.RightHatShapeControl _rhsc = null; - - /** - * CubicRationalRightRaw constructor - * - * @param dblLeftPredictorOrdinate The Left Predictor Ordinate - * @param dblRightPredictorOrdinate The Right Predictor Ordinate - * @param strShapeControlType Type of the Shape Controller to be used - NONE, LINEAR/QUADRATIC Rational - * @param dblTension Tension of the Tension Hat Function - * - * @throws java.lang.Exception Thrown if the input is invalid - */ - - public CubicRationalRightRaw ( - final double dblLeftPredictorOrdinate, - final double dblRightPredictorOrdinate, - final java.lang.String strShapeControlType, - final double dblTension) - throws java.lang.Exception - { - super (dblLeftPredictorOrdinate, dblRightPredictorOrdinate, dblTension); - - _rhsc = new org.drip.spline.bspline.RightHatShapeControl (dblLeftPredictorOrdinate, - dblRightPredictorOrdinate, strShapeControlType, dblTension); - } - - @Override public double evaluate ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - if (!in (dblPredictorOrdinate)) return 0.; - - double dblCubicValue = (right() - dblPredictorOrdinate) * (right() - dblPredictorOrdinate) * - (right() - dblPredictorOrdinate); - - return 0. == tension() ? dblCubicValue / 6. : dblCubicValue * _rhsc.evaluate (dblPredictorOrdinate); - } - - @Override public double derivative ( - final double dblPredictorOrdinate, - final int iOrder) - throws java.lang.Exception - { - if (0 > iOrder) - throw new java.lang.Exception ("CubicRationalRightRaw::derivative => Invalid Inputs"); - - if (!in (dblPredictorOrdinate)) return 0.; - - if (0. != tension()) return super.derivative (dblPredictorOrdinate, iOrder); - - double dblGap = right() - dblPredictorOrdinate; - - if (1 == iOrder) return -0.5 * dblGap * dblGap; - - if (2 == iOrder) return dblGap; - - return 3 == iOrder ? -1. : 0.; - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || !org.drip.quant.common.NumberUtil.IsValid - (dblEnd)) - throw new java.lang.Exception ("CubicRationalRightRaw::integrate => Invalid Inputs"); - - if (dblEnd >= dblBegin) return 0.; - - double dblBoundedBegin = org.drip.quant.common.NumberUtil.Bound (dblBegin, left(), right()); - - double dblBoundedEnd = org.drip.quant.common.NumberUtil.Bound (dblEnd, left(), right()); - - if (0. != tension()) return super.integrate (dblBoundedBegin, dblBoundedEnd); - - double dblBeginGap = right() - dblBoundedBegin; - - double dblEndGap = right() - dblBoundedEnd; - - return -0.25 * (dblEndGap * dblEndGap * dblEndGap * dblEndGap - dblBeginGap * dblBeginGap * - dblBeginGap * dblBeginGap); - } - - @Override public double normalizer() - { - double dblWidth = right() - left(); - - return 0.25 * dblWidth * dblWidth * dblWidth * dblWidth; - } -} diff --git a/org/drip/spline/bspline/ExponentialTensionLeftHat.java b/org/drip/spline/bspline/ExponentialTensionLeftHat.java deleted file mode 100644 index 248fb29..0000000 --- a/org/drip/spline/bspline/ExponentialTensionLeftHat.java +++ /dev/null @@ -1,132 +0,0 @@ - -package org.drip.spline.bspline; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * ExponentialTensionLeftHat implements the TensionBasisHat interface in accordance with the left exponential - * hat basis function laid out in the basic framework outlined in Koch and Lyche (1989), Koch and Lyche - * (1993), and Kvasov (2000) Papers. - * - * @author Lakshmi Krishnamurthy - */ - -public class ExponentialTensionLeftHat extends org.drip.spline.bspline.TensionBasisHat { - - /** - * ExponentialTensionLeftHat constructor - * - * @param dblLeftPredictorOrdinate The Left Predictor Ordinate - * @param dblRightPredictorOrdinate The Right Predictor Ordinate - * @param dblTension Tension of the Tension Hat Function - * - * @throws java.lang.Exception Thrown if the input is invalid - */ - - public ExponentialTensionLeftHat ( - final double dblLeftPredictorOrdinate, - final double dblRightPredictorOrdinate, - final double dblTension) - throws java.lang.Exception - { - super (dblLeftPredictorOrdinate, dblRightPredictorOrdinate, dblTension); - } - - @Override public double evaluate ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - if (!in (dblPredictorOrdinate)) return 0.; - - return java.lang.Math.sinh (tension() * (dblPredictorOrdinate - left())) * normalizer(); - } - - @Override public double derivative ( - final double dblPredictorOrdinate, - final int iOrder) - throws java.lang.Exception - { - if (0 > iOrder) - throw new java.lang.Exception ("ExponentialTensionLeftHat::derivative => Invalid Inputs"); - - if (!in (dblPredictorOrdinate)) return 0.; - - return java.lang.Math.pow (tension(), iOrder) * (0 == iOrder % 2 ? java.lang.Math.sinh (tension() * - (dblPredictorOrdinate - left())) : java.lang.Math.cosh (tension() * (dblPredictorOrdinate - - left()))) / normalizer(); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || !org.drip.quant.common.NumberUtil.IsValid - (dblEnd)) - throw new java.lang.Exception ("ExponentialTensionLeftHat::integrate => Invalid Inputs"); - - double dblBoundedBegin = org.drip.quant.common.NumberUtil.Bound (dblBegin, left(), right()); - - double dblBoundedEnd = org.drip.quant.common.NumberUtil.Bound (dblEnd, left(), right()); - - if (dblBoundedBegin >= dblBoundedEnd) return 0.; - - if (0. == tension()) return dblBoundedEnd - dblBoundedBegin; - - return (java.lang.Math.cosh (tension() * (dblBoundedEnd - left())) - java.lang.Math.cosh (tension() * - (dblBoundedBegin - left()))) * normalizer() / tension(); - } - - @Override public double normalizer() - throws java.lang.Exception - { - return (java.lang.Math.cosh (tension() * (right() - left())) - 1.) / tension(); - } -} diff --git a/org/drip/spline/bspline/ExponentialTensionLeftRaw.java b/org/drip/spline/bspline/ExponentialTensionLeftRaw.java deleted file mode 100644 index 052572b..0000000 --- a/org/drip/spline/bspline/ExponentialTensionLeftRaw.java +++ /dev/null @@ -1,146 +0,0 @@ - -package org.drip.spline.bspline; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * ExponentialTensionLeftRaw implements the TensionBasisHat interface in accordance with the raw left - * exponential hat basis function laid out in the basic framework outlined in Koch and Lyche (1989), Koch - * and Lyche (1993), and Kvasov (2000) Papers. - * - * @author Lakshmi Krishnamurthy - */ - -public class ExponentialTensionLeftRaw extends org.drip.spline.bspline.TensionBasisHat { - - /** - * ExponentialTensionLeftRaw constructor - * - * @param dblLeftPredictorOrdinate The Left Predictor Ordinate - * @param dblRightPredictorOrdinate The Right Predictor Ordinate - * @param dblTension Tension of the Tension Hat Function - * - * @throws java.lang.Exception Thrown if the input is invalid - */ - - public ExponentialTensionLeftRaw ( - final double dblLeftPredictorOrdinate, - final double dblRightPredictorOrdinate, - final double dblTension) - throws java.lang.Exception - { - super (dblLeftPredictorOrdinate, dblRightPredictorOrdinate, dblTension); - } - - @Override public double evaluate ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - if (!in (dblPredictorOrdinate)) return 0.; - - double dblAdjPredictorOrdinate = tension() * (dblPredictorOrdinate - left()); - - return (java.lang.Math.sinh (dblAdjPredictorOrdinate) - dblAdjPredictorOrdinate) / (tension() * - tension() * java.lang.Math.sinh (tension() * (right() - left()))); - } - - @Override public double derivative ( - final double dblPredictorOrdinate, - final int iOrder) - throws java.lang.Exception - { - if (0 > iOrder) - throw new java.lang.Exception ("ExponentialTensionLeftRaw::derivative => Invalid Inputs"); - - if (!in (dblPredictorOrdinate)) return 0.; - - double dblWidth = right() - left(); - - if (1 == iOrder) - return (java.lang.Math.cosh (tension() * (dblPredictorOrdinate - left())) - 1.) / (tension() * - java.lang.Math.sinh (tension() * dblWidth)); - - return java.lang.Math.pow (tension(), iOrder - 2) * (0 == iOrder % 2 ? java.lang.Math.sinh (tension() - * (dblPredictorOrdinate - left())) : java.lang.Math.cosh (tension() * (dblPredictorOrdinate - - left()))) / java.lang.Math.sinh (tension() * dblWidth); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || !org.drip.quant.common.NumberUtil.IsValid - (dblEnd)) - throw new java.lang.Exception ("ExponentialTensionLeftRaw::integrate => Invalid Inputs"); - - double dblBoundedBegin = org.drip.quant.common.NumberUtil.Bound (dblBegin, left(), right()); - - double dblBoundedEnd = org.drip.quant.common.NumberUtil.Bound (dblEnd, left(), right()); - - if (dblBoundedBegin >= dblBoundedEnd) return 0.; - - if (0. == tension()) return dblBoundedEnd - dblBoundedBegin; - - return (java.lang.Math.cosh (dblBoundedEnd - left()) - java.lang.Math.cosh (dblBoundedBegin - - left()) - 0.5 * tension() * tension() * (((dblBoundedEnd - left()) * (dblBoundedEnd - left())) - - ((dblBoundedBegin - left()) * (dblBoundedBegin - left())))) / (tension() * tension() * - tension() * java.lang.Math.sinh (tension() * (right() - left()))); - } - - @Override public double normalizer() - throws java.lang.Exception - { - double dblWidth = right() - left(); - - return (java.lang.Math.cosh (dblWidth) - 1. - 0.5 * tension() * tension() * dblWidth * dblWidth) / - (tension() * tension() * tension() * java.lang.Math.sinh (tension() * dblWidth)); - } -} diff --git a/org/drip/spline/bspline/ExponentialTensionRightHat.java b/org/drip/spline/bspline/ExponentialTensionRightHat.java deleted file mode 100644 index 394384c..0000000 --- a/org/drip/spline/bspline/ExponentialTensionRightHat.java +++ /dev/null @@ -1,132 +0,0 @@ - -package org.drip.spline.bspline; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * ExponentialTensionRightHat implements the TensionBasisHat interface in accordance with the right - * exponential hat basis function laid out in the basic framework outlined in Koch and Lyche (1989), Koch - * and Lyche (1993), and Kvasov (2000) Papers. - * - * @author Lakshmi Krishnamurthy - */ - -public class ExponentialTensionRightHat extends org.drip.spline.bspline.TensionBasisHat { - - /** - * ExponentialTensionRightHat constructor - * - * @param dblLeftPredictorOrdinate The Left Predictor Ordinate - * @param dblRightPredictorOrdinate The Right Predictor Ordinate - * @param dblTension Tension of the Tension Hat Function - * - * @throws java.lang.Exception Thrown if the input is invalid - */ - - public ExponentialTensionRightHat ( - final double dblLeftPredictorOrdinate, - final double dblRightPredictorOrdinate, - final double dblTension) - throws java.lang.Exception - { - super (dblLeftPredictorOrdinate, dblRightPredictorOrdinate, dblTension); - } - - @Override public double evaluate ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - if (!in (dblPredictorOrdinate)) return 0.; - - return java.lang.Math.sinh (tension() * (right() - dblPredictorOrdinate)) * normalizer(); - } - - @Override public double derivative ( - final double dblPredictorOrdinate, - final int iOrder) - throws java.lang.Exception - { - if (0 > iOrder) - throw new java.lang.Exception ("ExponentialTensionRightHat::derivative => Invalid Inputs"); - - if (!in (dblPredictorOrdinate)) return 0.; - - return java.lang.Math.pow (-1. * tension(), iOrder) * (0 == iOrder % 2 ? java.lang.Math.sinh - (tension() * (right() - dblPredictorOrdinate)) : java.lang.Math.cosh (tension() * (right() - - dblPredictorOrdinate))) / normalizer(); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || !org.drip.quant.common.NumberUtil.IsValid - (dblEnd)) - throw new java.lang.Exception ("ExponentialTensionRightHat::integrate => Invalid Inputs"); - - double dblBoundedBegin = org.drip.quant.common.NumberUtil.Bound (dblBegin, left(), right()); - - double dblBoundedEnd = org.drip.quant.common.NumberUtil.Bound (dblEnd, left(), right()); - - if (dblBoundedBegin >= dblBoundedEnd) return 0.; - - if (0. == tension()) return dblBoundedEnd - dblBoundedBegin; - - return -1. * (java.lang.Math.cosh (tension() * (right() - dblBoundedEnd)) - java.lang.Math.cosh - (tension() * (right() - dblBoundedBegin))) * normalizer() / tension(); - } - - @Override public double normalizer() - throws java.lang.Exception - { - return (java.lang.Math.cosh (tension() * (right() - left())) - 1.) / tension(); - } -} diff --git a/org/drip/spline/bspline/ExponentialTensionRightRaw.java b/org/drip/spline/bspline/ExponentialTensionRightRaw.java deleted file mode 100644 index baa12d8..0000000 --- a/org/drip/spline/bspline/ExponentialTensionRightRaw.java +++ /dev/null @@ -1,152 +0,0 @@ - -package org.drip.spline.bspline; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * ExponentialTensionRightRaw implements the TensionBasisHat interface in accordance with the raw right - * exponential hat basis function laid out in the basic framework outlined in Koch and Lyche (1989), Koch - * and Lyche (1993), and Kvasov (2000) Papers. - * - * @author Lakshmi Krishnamurthy - */ - -public class ExponentialTensionRightRaw extends org.drip.spline.bspline.TensionBasisHat { - - /** - * ExponentialTensionRightRaw constructor - * - * @param dblLeftPredictorOrdinate The Left Predictor Ordinate - * @param dblRightPredictorOrdinate The Right Predictor Ordinate - * @param dblTension Tension of the Tension Hat Function - * - * @throws java.lang.Exception Thrown if the input is invalid - */ - - public ExponentialTensionRightRaw ( - final double dblLeftPredictorOrdinate, - final double dblRightPredictorOrdinate, - final double dblTension) - throws java.lang.Exception - { - super (dblLeftPredictorOrdinate, dblRightPredictorOrdinate, dblTension); - } - - @Override public double evaluate ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - if (!in (dblPredictorOrdinate)) return 0.; - - double dblAdjPredictorOrdinate = tension() * (right() - dblPredictorOrdinate); - - return (java.lang.Math.sinh (dblAdjPredictorOrdinate) - dblAdjPredictorOrdinate) / (tension() * - tension() * java.lang.Math.sinh (tension() * (right() - left()))); - } - - @Override public double derivative ( - final double dblPredictorOrdinate, - final int iOrder) - throws java.lang.Exception - { - if (0 > iOrder) - throw new java.lang.Exception ("ExponentialTensionRightRaw::derivative => Invalid Inputs"); - - if (!in (dblPredictorOrdinate)) return 0.; - - double dblWidth = right() - left(); - - if (1 == iOrder) - return (1. - java.lang.Math.cosh (tension() * (right() - dblPredictorOrdinate))) / (tension() * - java.lang.Math.sinh (tension() * dblWidth)); - - return java.lang.Math.pow (-tension(), iOrder - 2) * (0 == iOrder % 2 ? java.lang.Math.sinh - (tension() * (right() - dblPredictorOrdinate)) : java.lang.Math.cosh (tension() * (right() - - dblPredictorOrdinate))) / java.lang.Math.sinh (tension() * dblWidth); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || !org.drip.quant.common.NumberUtil.IsValid - (dblEnd)) - throw new java.lang.Exception ("ExponentialTensionRightRaw::integrate => Invalid Inputs"); - - double dblBoundedBegin = org.drip.quant.common.NumberUtil.Bound (dblBegin, left(), right()); - - double dblBoundedEnd = org.drip.quant.common.NumberUtil.Bound (dblEnd, left(), right()); - - if (dblBoundedBegin >= dblBoundedEnd) return 0.; - - if (0. == tension()) return dblBoundedEnd - dblBoundedBegin; - - double dblBoundedBeginRightGap = right() - dblBoundedBegin; - - double dblBoundedEndRightGap = right() - dblBoundedEnd; - - return (0.5 * tension() * tension() * (dblBoundedEndRightGap * dblBoundedEndRightGap - - dblBoundedBeginRightGap * dblBoundedBeginRightGap) + java.lang.Math.cosh (tension() * - dblBoundedBeginRightGap) - java.lang.Math.cosh (tension() * dblBoundedEndRightGap)) / - (tension() * tension() * tension() * java.lang.Math.sinh (tension() * (right() - - left()))); - } - - @Override public double normalizer() - throws java.lang.Exception - { - double dblWidth = right() - left(); - - return (-0.5 * tension() * tension() * dblWidth * dblWidth + java.lang.Math.cosh (tension() * - dblWidth) - 1.) / (tension() * tension() * tension() * java.lang.Math.sinh (tension() * - dblWidth)); - } -} diff --git a/org/drip/spline/bspline/LeftHatShapeControl.java b/org/drip/spline/bspline/LeftHatShapeControl.java deleted file mode 100644 index d802fc9..0000000 --- a/org/drip/spline/bspline/LeftHatShapeControl.java +++ /dev/null @@ -1,182 +0,0 @@ - -package org.drip.spline.bspline; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * LeftHatShapeControl implements the BasisHatShapeControl interface for the left hat basis set as laid out - * in the basic framework outlined in Koch and Lyche (1989), Koch and Lyche (1993), and Kvasov (2000) - * Papers. - * - * @author Lakshmi Krishnamurthy - */ - -public class LeftHatShapeControl extends org.drip.spline.bspline.BasisHatShapeControl { - - /** - * LeftHatShapeControl constructor - * - * @param dblLeftPredictorOrdinate The Left Predictor Ordinate - * @param dblRightPredictorOrdinate The Right Predictor Ordinate - * @param strShapeControlType Type of the Shape Controller to be used - NONE, LINEAR/QUADRATIC Rational - * @param dblTension Tension of the Tension Hat Function - * - * @throws java.lang.Exception Thrown if the input is invalid - */ - - public LeftHatShapeControl ( - final double dblLeftPredictorOrdinate, - final double dblRightPredictorOrdinate, - final java.lang.String strShapeControlType, - final double dblTension) - throws java.lang.Exception - { - super (dblLeftPredictorOrdinate, dblRightPredictorOrdinate, strShapeControlType, dblTension); - } - - @Override public double evaluate ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - if (!in (dblPredictorOrdinate)) return 0.; - - double dblWidth = right() - left(); - - double dblScale = 1. / (dblWidth * (6. + 6. * tension() * dblWidth + 2. * tension() * dblWidth * - dblWidth)); - - if (SHAPE_CONTROL_RATIONAL_LINEAR.equalsIgnoreCase (shapeControlType())) - return dblScale / (1. + tension() * (right() - dblPredictorOrdinate)); - - if (SHAPE_CONTROL_RATIONAL_QUADRATIC.equalsIgnoreCase (shapeControlType())) - return dblScale / (1. + tension() * (right() - dblPredictorOrdinate) * (dblPredictorOrdinate - - left()) / dblWidth); - - return (java.lang.Math.exp (-tension() * (right() - dblPredictorOrdinate))) / (dblWidth * (6. + 6. * - tension() * dblWidth + tension() * dblWidth * dblWidth)); - } - - @Override public double derivative ( - final double dblPredictorOrdinate, - final int iOrder) - throws java.lang.Exception - { - if (0 >= iOrder) throw new java.lang.Exception ("LeftHatShapeControl::derivative => Invalid Inputs"); - - if (!in (dblPredictorOrdinate) || 0. == tension()) return 0.; - - double dblWidth = right() - left(); - - double dblScale = 1. / (dblWidth * (6. + 6. * tension() * dblWidth + 2. * tension() * dblWidth * - dblWidth)); - - if (SHAPE_CONTROL_RATIONAL_LINEAR.equalsIgnoreCase (shapeControlType())) - return dblScale * org.drip.quant.common.NumberUtil.Factorial (iOrder) * java.lang.Math.pow - (tension(), iOrder) * java.lang.Math.pow (1. + tension() * (right() - dblPredictorOrdinate), - -iOrder - 1); - - if (SHAPE_CONTROL_RATIONAL_EXPONENTIAL.equalsIgnoreCase (shapeControlType())) - return (java.lang.Math.pow (tension(), iOrder) * java.lang.Math.exp (-tension() * (right() - - dblPredictorOrdinate))) / (dblWidth * (6. + 6. * tension() * dblWidth + tension() * dblWidth - * dblWidth)); - - return super.derivative (dblPredictorOrdinate, iOrder); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || !org.drip.quant.common.NumberUtil.IsValid - (dblEnd)) - throw new java.lang.Exception ("LeftHatShapeControl::integrate => Invalid Inputs"); - - double dblBoundedBegin = org.drip.quant.common.NumberUtil.Bound (dblBegin, left(), right()); - - double dblBoundedEnd = org.drip.quant.common.NumberUtil.Bound (dblEnd, left(), right()); - - if (dblBoundedBegin >= dblBoundedEnd) return 0.; - - if (0. == tension()) return dblBoundedEnd - dblBoundedBegin; - - double dblWidth = right() - left(); - - if (SHAPE_CONTROL_RATIONAL_LINEAR.equalsIgnoreCase (shapeControlType())) - return (java.lang.Math.log ((1. + tension() * (right() - dblBoundedBegin)) / (1. + tension() * - (right() - dblBoundedEnd)))) / tension() / (dblWidth * (6. + 6. * tension() * dblWidth + 2. * - tension() * dblWidth * dblWidth)); - - if (SHAPE_CONTROL_RATIONAL_EXPONENTIAL.equalsIgnoreCase (shapeControlType())) - return (java.lang.Math.exp (tension() * (dblBoundedEnd - right())) - java.lang.Math.exp - (tension() * (dblBoundedBegin - right()))) / tension() / (dblWidth * (6. + 6. * tension() * - dblWidth + tension() * dblWidth * dblWidth)); - - return super.integrate (dblBoundedBegin, dblBoundedEnd); - } - - @Override public double normalizer() - throws java.lang.Exception - { - double dblWidth = right() - left(); - - if (0. == tension()) return dblWidth; - - if (SHAPE_CONTROL_RATIONAL_LINEAR.equalsIgnoreCase (shapeControlType())) - return (java.lang.Math.log ((1. + tension() * dblWidth))) / tension() / (dblWidth * (6. + 6. * - tension() * dblWidth + 2. * tension() * dblWidth * dblWidth)); - - if (SHAPE_CONTROL_RATIONAL_EXPONENTIAL.equalsIgnoreCase (shapeControlType())) - return (1. - java.lang.Math.exp (tension() * dblWidth)) / tension() / (dblWidth * (6. + 6. * - tension() * dblWidth + tension() * dblWidth * dblWidth)); - - return super.integrate (left(), right()); - } -} diff --git a/org/drip/spline/bspline/RightHatShapeControl.java b/org/drip/spline/bspline/RightHatShapeControl.java deleted file mode 100644 index b8f57d2..0000000 --- a/org/drip/spline/bspline/RightHatShapeControl.java +++ /dev/null @@ -1,180 +0,0 @@ - -package org.drip.spline.bspline; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * RightHatShapeControl implements the BasisHatShapeControl interface for the right hat basis set as laid out - * in the basic framework outlined in Koch and Lyche (1989), Koch and Lyche (1993), and Kvasov (2000) - * Papers. - * - * @author Lakshmi Krishnamurthy - */ - -public class RightHatShapeControl extends org.drip.spline.bspline.BasisHatShapeControl { - - /** - * RightHatShapeControl constructor - * - * @param dblLeftPredictorOrdinate The Left Predictor Ordinate - * @param dblRightPredictorOrdinate The Right Predictor Ordinate - * @param strShapeControlType Type of the Shape Controller to be used - NONE, LINEAR/QUADRATIC Rational - * @param dblTension Tension of the Tension Hat Function - * - * @throws java.lang.Exception Thrown if the input is invalid - */ - - public RightHatShapeControl ( - final double dblLeftPredictorOrdinate, - final double dblRightPredictorOrdinate, - final java.lang.String strShapeControlType, - final double dblTension) - throws java.lang.Exception - { - super (dblLeftPredictorOrdinate, dblRightPredictorOrdinate, strShapeControlType, dblTension); - } - - @Override public double evaluate ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - if (!in (dblPredictorOrdinate)) return 0.; - - double dblWidth = right() - left(); - - double dblScale = 1. / (dblWidth * (6. + 6. * tension() * dblWidth + 2. * tension() * dblWidth * - dblWidth)); - - if (SHAPE_CONTROL_RATIONAL_LINEAR.equalsIgnoreCase (shapeControlType())) - return dblScale / (1. + tension() * (dblPredictorOrdinate - left())); - - if (SHAPE_CONTROL_RATIONAL_QUADRATIC.equalsIgnoreCase (shapeControlType())) - return dblScale / (1. + tension() * (right() - dblPredictorOrdinate) * (dblPredictorOrdinate - - left()) / dblWidth); - - return (java.lang.Math.exp (-tension() * (dblPredictorOrdinate - left()))) / (dblWidth * (6. + 6. * - tension() * dblWidth + tension() * dblWidth * dblWidth)); - } - - @Override public double derivative ( - final double dblPredictorOrdinate, - final int iOrder) - throws java.lang.Exception - { - if (0 >= iOrder) - throw new java.lang.Exception ("RightHatShapeControl::derivative => Invalid Inputs"); - - if (!in (dblPredictorOrdinate) || 0. == tension()) return 0.; - - double dblWidth = right() - left(); - - if (SHAPE_CONTROL_RATIONAL_LINEAR.equalsIgnoreCase (shapeControlType())) - return (org.drip.quant.common.NumberUtil.Factorial (iOrder) * java.lang.Math.pow (-tension(), - iOrder) * java.lang.Math.pow (1. + tension() * (dblPredictorOrdinate - left()), -iOrder - 1)) - / (dblWidth * (6. + 6. * tension() * dblWidth + 2. * tension() * dblWidth * dblWidth)); - - if (SHAPE_CONTROL_RATIONAL_EXPONENTIAL.equalsIgnoreCase (shapeControlType())) - return (java.lang.Math.pow (-tension(), iOrder) * java.lang.Math.exp (-tension() * - (dblPredictorOrdinate - left()))) / (dblWidth * (6. + 6. * tension() * dblWidth + tension() * - dblWidth * dblWidth)); - - return super.derivative (dblPredictorOrdinate, iOrder); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || !org.drip.quant.common.NumberUtil.IsValid - (dblEnd)) - throw new java.lang.Exception ("RightHatShapeControl::integrate => Invalid Inputs"); - - double dblBoundedBegin = org.drip.quant.common.NumberUtil.Bound (dblBegin, left(), right()); - - double dblBoundedEnd = org.drip.quant.common.NumberUtil.Bound (dblEnd, left(), right()); - - if (dblBoundedBegin >= dblBoundedEnd) return 0.; - - if (0. == tension()) return dblBoundedEnd - dblBoundedBegin; - - double dblWidth = right() - left(); - - if (SHAPE_CONTROL_RATIONAL_LINEAR.equalsIgnoreCase (shapeControlType())) - return (java.lang.Math.log ((1. + tension() * (dblBoundedEnd - left())) / (1. + tension() * - (dblBoundedBegin - left())))) / tension() / (dblWidth * (6. + 6. * tension() * dblWidth + 2. - * tension() * dblWidth * dblWidth)); - - if (SHAPE_CONTROL_RATIONAL_EXPONENTIAL.equalsIgnoreCase (shapeControlType())) - return (java.lang.Math.exp (-tension() * (dblBoundedBegin - left())) - java.lang.Math.exp - (-tension() * (dblBoundedEnd - left()))) / tension() / (dblWidth * (6. + 6. * tension() * - dblWidth + tension() * dblWidth * dblWidth)); - - return super.integrate (dblBoundedBegin, dblBoundedEnd); - } - - @Override public double normalizer() - throws java.lang.Exception - { - double dblWidth = right() - left(); - - if (0. == tension()) return dblWidth; - - if (SHAPE_CONTROL_RATIONAL_LINEAR.equalsIgnoreCase (shapeControlType())) - return (java.lang.Math.log ((1. + tension() * dblWidth))) / tension() / (dblWidth * (6. + 6. * - tension() * dblWidth + 2. * tension() * dblWidth * dblWidth)); - - if (SHAPE_CONTROL_RATIONAL_EXPONENTIAL.equalsIgnoreCase (shapeControlType())) - return (1. - java.lang.Math.exp (-tension() * dblWidth)) / tension() / (dblWidth * (6. + 6. * - tension() * dblWidth + tension() * dblWidth * dblWidth)); - - return super.integrate (left(), right()); - } -} diff --git a/org/drip/spline/bspline/SegmentBasisFunction.java b/org/drip/spline/bspline/SegmentBasisFunction.java deleted file mode 100644 index 9c3f1d4..0000000 --- a/org/drip/spline/bspline/SegmentBasisFunction.java +++ /dev/null @@ -1,159 +0,0 @@ - -package org.drip.spline.bspline; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * SegmentBasisFunction is the abstract class over which the local ordered envelope functions for the B Splines - * are implemented. It exposes the following stubs: - * - Retrieve the Order of the B Spline. - * - Retrieve the Leading Predictor Ordinate. - * - Retrieve the Following Predictor Ordinate. - * - Retrieve the Trailing Predictor Ordinate. - * - Compute the complete Envelope Integrand - this will serve as the Envelope Normalizer. - * - Evaluate the Cumulative Normalized Integrand up to the given ordinate. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class SegmentBasisFunction extends org.drip.function.definition.R1ToR1 { - private int _iBSplineOrder = -1; - private double _dblLeadingPredictorOrdinate = java.lang.Double.NaN; - private double _dblTrailingPredictorOrdinate = java.lang.Double.NaN; - private double _dblFollowingPredictorOrdinate = java.lang.Double.NaN; - - protected SegmentBasisFunction ( - final int iBSplineOrder, - final double dblLeadingPredictorOrdinate, - final double dblFollowingPredictorOrdinate, - final double dblTrailingPredictorOrdinate) - throws java.lang.Exception - { - super (null); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblLeadingPredictorOrdinate = - dblLeadingPredictorOrdinate) || !org.drip.quant.common.NumberUtil.IsValid - (_dblFollowingPredictorOrdinate = dblFollowingPredictorOrdinate) || - !org.drip.quant.common.NumberUtil.IsValid (_dblTrailingPredictorOrdinate = - dblTrailingPredictorOrdinate) || _dblLeadingPredictorOrdinate >= - _dblFollowingPredictorOrdinate || _dblFollowingPredictorOrdinate >= - _dblTrailingPredictorOrdinate || 2 > (_iBSplineOrder = iBSplineOrder)) - throw new java.lang.Exception ("SegmentBasisFunction ctr: Invalid Inputs"); - } - - /** - * Retrieve the Order of the B Spline - * - * @return The Order of the B Spline - */ - - public int bSplineOrder() - { - return _iBSplineOrder; - } - - /** - * Retrieve the Leading Predictor Ordinate - * - * @return The Leading Predictor Ordinate - */ - - public double leading() - { - return _dblLeadingPredictorOrdinate; - } - - /** - * Retrieve the Following Predictor Ordinate - * - * @return The Following Predictor Ordinate - */ - - public double following() - { - return _dblFollowingPredictorOrdinate; - } - - /** - * Retrieve the Trailing Predictor Ordinate - * - * @return The Trailing Predictor Ordinate - */ - - public double trailing() - { - return _dblTrailingPredictorOrdinate; - } - - /** - * Compute the complete Envelope Integrand - this will serve as the Envelope Normalizer. - * - * @return The Complete Envelope Integrand. - * - * @throws java.lang.Exception Thrown if the Complete Envelope Integrand cannot be calculated. - */ - - public abstract double normalizer() - throws java.lang.Exception; - - /** - * Evaluate the Cumulative Normalized Integrand up to the given ordinate - * - * @param dblPredictorOrdinate The Predictor Ordinate - * - * @return The Cumulative Normalized Integrand up to the given ordinate - * - * @throws java.lang.Exception Thrown if input is invalid - */ - - public abstract double normalizedCumulative ( - final double dblPredictorOrdinate) - throws java.lang.Exception; -} diff --git a/org/drip/spline/bspline/SegmentBasisFunctionGenerator.java b/org/drip/spline/bspline/SegmentBasisFunctionGenerator.java deleted file mode 100644 index 7a760bb..0000000 --- a/org/drip/spline/bspline/SegmentBasisFunctionGenerator.java +++ /dev/null @@ -1,181 +0,0 @@ - -package org.drip.spline.bspline; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * SegmentBasisFunctionGenerator generates B Spline Functions of different order. It provides the following - * functionality: - * - Create a Tension Monic B Spline Basis Function. - * - Construct a Sequence of Monic Basis Functions. - * - Create a sequence of B Splines of the specified order from the given inputs. - * - * @author Lakshmi Krishnamurthy - */ - -public class SegmentBasisFunctionGenerator { - - /** - * Create a Tension Monic B Spline Basis Function - * - * @param strHatType The Primitive Hat Type - * @param strShapeControlType Type of the Shape Controller to be used - NONE, LINEAR/QUADRATIC Rational - * @param adblPredictorOrdinate Array of Predictor Ordinates - * @param iDerivOrder The Derivative Order - * @param dblTension Tension - * - * @return The Tension Monic B Spline Basis Function Instance - */ - - public static final org.drip.spline.bspline.SegmentBasisFunction Monic ( - final java.lang.String strHatType, - final java.lang.String strShapeControlType, - final double[] adblPredictorOrdinate, - final int iDerivOrder, - final double dblTension) - { - org.drip.spline.bspline.TensionBasisHat[] aTBH = - org.drip.spline.bspline.BasisHatPairGenerator.GenerateHatPair (strHatType, strShapeControlType, - adblPredictorOrdinate[0], adblPredictorOrdinate[1], adblPredictorOrdinate[2], iDerivOrder, - dblTension); - - if (null == aTBH || 2 != aTBH.length) return null; - - try { - return new org.drip.spline.bspline.SegmentMonicBasisFunction (aTBH[0], aTBH[1]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Sequence of Monic Basis Functions - * - * @param strHatType The Primitive Hat Type - * @param strShapeControlType Type of the Shape Controller to be used - NONE, LINEAR/QUADRATIC Rational - * @param adblPredictorOrdinate Array of Predictor Ordinates - * @param iDerivOrder The Derivative Order - * @param dblTension Tension - * - * @return Sequence of Tension Monic B Spline Basis Functions - */ - - public static final org.drip.spline.bspline.SegmentBasisFunction[] MonicSequence ( - final java.lang.String strHatType, - final java.lang.String strShapeControlType, - final double[] adblPredictorOrdinate, - final int iDerivOrder, - final double dblTension) - { - if (null == adblPredictorOrdinate) return null; - - int iNumMonic = adblPredictorOrdinate.length - 2; - org.drip.spline.bspline.SegmentBasisFunction[] aSBFMonic = new - org.drip.spline.bspline.SegmentBasisFunction[iNumMonic]; - - if (0 >= iNumMonic) return null; - - for (int i = 0; i < iNumMonic; ++i) { - TensionBasisHat[] aTBH = BasisHatPairGenerator.GenerateHatPair (strHatType, strShapeControlType, - adblPredictorOrdinate[i], adblPredictorOrdinate[i + 1], adblPredictorOrdinate[i + 2], - iDerivOrder, dblTension); - - if (null == aTBH || 2 != aTBH.length) return null; - - try { - aSBFMonic[i] = new org.drip.spline.bspline.SegmentMonicBasisFunction (aTBH[0], aTBH[1]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return aSBFMonic; - } - - /** - * Create a sequence of B Splines of the specified order from the given inputs. - * - * @param iTargetBSplineOrder Desired B Spline Order - * @param aSBFPrev Array of Segment Basis Functions - * - * @return The sequence of B Splines of the specified order. - */ - - public static final org.drip.spline.bspline.SegmentBasisFunction[] MulticSequence ( - final int iTargetBSplineOrder, - final org.drip.spline.bspline.SegmentBasisFunction[] aSBFPrev) - { - if (2 >= iTargetBSplineOrder || null == aSBFPrev) return null; - - int iNumSBF = aSBFPrev.length - 1; - org.drip.spline.bspline.SegmentBasisFunction[] aSBF = new - org.drip.spline.bspline.SegmentBasisFunction[iNumSBF]; - - if (1 > iNumSBF) return null; - - for (int i = 0; i < iNumSBF; ++i) { - try { - aSBF[i] = new org.drip.spline.bspline.SegmentMulticBasisFunction (aSBFPrev[i], - aSBFPrev[i + 1]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return iTargetBSplineOrder == aSBF[0].bSplineOrder() ? aSBF : MulticSequence (iTargetBSplineOrder, - aSBF); - } -} diff --git a/org/drip/spline/bspline/SegmentBasisFunctionSet.java b/org/drip/spline/bspline/SegmentBasisFunctionSet.java deleted file mode 100644 index 6d2f2b2..0000000 --- a/org/drip/spline/bspline/SegmentBasisFunctionSet.java +++ /dev/null @@ -1,121 +0,0 @@ - -package org.drip.spline.bspline; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * SegmentBasisFunctionSet class implements per-segment function set for B Splines and tension splines. - * Derived implementations expose explicit targeted basis functions. - * - * @author Lakshmi Krishnamurthy - */ - -public class SegmentBasisFunctionSet extends org.drip.spline.basis.FunctionSet { - protected double _dblTension = java.lang.Double.NaN; - - private static final org.drip.function.definition.R1ToR1[] responseBasis ( - final int iNumBasisToUse, - final org.drip.function.definition.R1ToR1[] aAUHat) - { - if (null == aAUHat || iNumBasisToUse > aAUHat.length) return null; - - try { - org.drip.function.definition.R1ToR1[] aAU = new - org.drip.function.definition.R1ToR1[iNumBasisToUse + 2]; - - aAU[0] = new org.drip.function.r1tor1.Polynomial (0); - - aAU[1] = new org.drip.function.r1tor1.UnivariateReflection (new - org.drip.function.r1tor1.Polynomial (1)); - - for (int i = 0; i < iNumBasisToUse; ++i) - aAU[2 + i] = aAUHat[i]; - - return aAU; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * SegmentBasisFunctionSet constructor - * - * @param iNumBasisToUse Number of Basis in the Hat Basis Set to Use - * @param dblTension Tension Parameter - * @param aAUHat The Hat Representation Function Set - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public SegmentBasisFunctionSet ( - final int iNumBasisToUse, - final double dblTension, - final org.drip.function.definition.R1ToR1[] aAUHat) - throws java.lang.Exception - { - super (responseBasis (iNumBasisToUse, aAUHat)); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblTension = dblTension)) - throw new java.lang.Exception ("SegmentBasisFunctionSet ctr: Invalid Inputs!"); - } - - /** - * Retrieve the Tension Parameter - * - * @return The Tension Parameter - */ - - public double tension() - { - return _dblTension; - } -} diff --git a/org/drip/spline/bspline/SegmentMonicBasisFunction.java b/org/drip/spline/bspline/SegmentMonicBasisFunction.java deleted file mode 100644 index e853b67..0000000 --- a/org/drip/spline/bspline/SegmentMonicBasisFunction.java +++ /dev/null @@ -1,180 +0,0 @@ - -package org.drip.spline.bspline; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * SegmentMonicBasisFunction implements the local monic B Spline that envelopes the predictor ordinates, and - * the corresponding set of ordinates/basis functions. SegmentMonicBasisFunction uses the left/right - * TensionBasisHat instances to achieve its implementation goals. - * - * @author Lakshmi Krishnamurthy - */ - -public class SegmentMonicBasisFunction extends org.drip.spline.bspline.SegmentBasisFunction { - private org.drip.spline.bspline.TensionBasisHat _tbhLeft = null; - private org.drip.spline.bspline.TensionBasisHat _tbhRight = null; - - /** - * SegmentMonicBasisFunction constructor - * - * @param tbhLeft Left Tension Basis Hat Function - * @param tbhRight Right Tension Basis Hat Function - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public SegmentMonicBasisFunction ( - final org.drip.spline.bspline.TensionBasisHat tbhLeft, - final org.drip.spline.bspline.TensionBasisHat tbhRight) - throws java.lang.Exception - { - super (2, tbhLeft.left(), tbhRight.left(), tbhRight.right()); - - if (null == (_tbhLeft = tbhLeft) || null == (_tbhRight = tbhRight)) - throw new java.lang.Exception ("SegmentMonicBasisFunction ctr: Invalid Inputs"); - } - - @Override public double evaluate ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorOrdinate)) - throw new java.lang.Exception ("SegmentMonicBasisFunction::evaluate => Invalid Inputs"); - - if (dblPredictorOrdinate < leading() || dblPredictorOrdinate > trailing()) return 0.; - - return dblPredictorOrdinate < following() ? _tbhLeft.evaluate (dblPredictorOrdinate) : - _tbhRight.evaluate (dblPredictorOrdinate); - } - - @Override public double derivative ( - final double dblPredictorOrdinate, - final int iOrder) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorOrdinate)) - throw new java.lang.Exception ("SegmentMonicBasisFunction::derivative => Invalid Inputs"); - - if (dblPredictorOrdinate < leading() || dblPredictorOrdinate > trailing()) return 0.; - - return dblPredictorOrdinate < following() ? _tbhLeft.derivative (dblPredictorOrdinate, iOrder) : - _tbhRight.derivative (dblPredictorOrdinate, iOrder); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || !org.drip.quant.common.NumberUtil.IsValid - (dblEnd)) - throw new java.lang.Exception ("SegmentMonicBasisFunction::integrate => Invalid Inputs"); - - if (dblBegin >= dblEnd) return 0.; - - if (dblBegin <= leading()) { - if (dblEnd <= leading()) return 0.; - - if (dblEnd <= following()) return _tbhLeft.integrate (leading(), dblEnd); - - if (dblEnd <= trailing()) - return _tbhLeft.integrate (leading(), following()) + _tbhRight.integrate (following(), - dblEnd); - - return _tbhLeft.integrate (leading(), following()) + _tbhRight.integrate (following(), - trailing()); - } - - if (dblBegin <= following()) { - if (dblEnd <= following()) return _tbhLeft.integrate (dblBegin, dblEnd); - - if (dblEnd <= trailing()) - return _tbhLeft.integrate (dblBegin, following()) + _tbhRight.integrate (following(), - dblEnd); - - return _tbhLeft.integrate (dblBegin, following()) + _tbhRight.integrate (following(), - trailing()); - } - - if (dblBegin <= trailing()) { - if (dblEnd <= trailing()) return _tbhRight.integrate (following(), dblEnd); - - return _tbhRight.integrate (following(), trailing()); - } - - return 0.; - } - - @Override public double normalizer() - throws java.lang.Exception - { - return _tbhLeft.integrate (leading(), following()) + _tbhRight.integrate (following(), trailing()); - } - - @Override public double normalizedCumulative ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorOrdinate)) - throw new java.lang.Exception - ("SegmentMonicBasisFunction::normalizedCumulative => Invalid Inputs"); - - if (dblPredictorOrdinate <= leading()) return 0.; - - if (dblPredictorOrdinate >= trailing()) return 1.; - - if (dblPredictorOrdinate <= following()) - return _tbhLeft.integrate (leading(), dblPredictorOrdinate) / normalizer(); - - return (_tbhLeft.integrate (leading(), following()) + _tbhRight.integrate (following(), - dblPredictorOrdinate)) / normalizer(); - } -} diff --git a/org/drip/spline/bspline/SegmentMulticBasisFunction.java b/org/drip/spline/bspline/SegmentMulticBasisFunction.java deleted file mode 100644 index cc2ced4..0000000 --- a/org/drip/spline/bspline/SegmentMulticBasisFunction.java +++ /dev/null @@ -1,126 +0,0 @@ - -package org.drip.spline.bspline; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * SegmentMulticBasisFunction implements the local quadratic B Spline that envelopes the predictor ordinates, - * and the corresponding set of ordinates/basis functions. SegmentMulticBasisFunction uses the left/right - * SegmentBasisFunction instances to achieve its implementation goals. - * - * @author Lakshmi Krishnamurthy - */ - -public class SegmentMulticBasisFunction extends org.drip.spline.bspline.SegmentBasisFunction { - private org.drip.spline.bspline.SegmentBasisFunction _oeLeft = null; - private org.drip.spline.bspline.SegmentBasisFunction _oeRight = null; - - /** - * SegmentMulticBasisFunction constructor - * - * @param oeLeft Left Ordered Envelope Spline Function - * @param oeRight Right Ordered Envelope Spline Function - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public SegmentMulticBasisFunction ( - final org.drip.spline.bspline.SegmentBasisFunction oeLeft, - final org.drip.spline.bspline.SegmentBasisFunction oeRight) - throws java.lang.Exception - { - super (oeLeft.bSplineOrder() + 1, oeLeft.leading(), oeRight.leading(), oeRight.trailing()); - - if ((_oeLeft = oeLeft).bSplineOrder() != (_oeRight = oeRight).bSplineOrder()) - throw new java.lang.Exception ("SegmentMulticBasisFunction ctr: Invalid Inputs"); - } - - @Override public double evaluate ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorOrdinate)) - throw new java.lang.Exception ("SegmentMulticBasisFunction::evaluate => Invalid Inputs"); - - if (dblPredictorOrdinate < leading() || dblPredictorOrdinate > trailing()) return 0.; - - return _oeLeft.normalizedCumulative (dblPredictorOrdinate) - _oeRight.normalizedCumulative - (dblPredictorOrdinate); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - return org.drip.quant.calculus.R1ToR1Integrator.Simpson (this, dblBegin, dblEnd); - } - - @Override public double normalizer() - throws java.lang.Exception - { - return integrate (leading(), trailing()); - } - - @Override public double normalizedCumulative ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorOrdinate)) - throw new java.lang.Exception - ("SegmentMulticBasisFunction::normalizedCumulative => Invalid Inputs"); - - if (dblPredictorOrdinate < leading()) return 0.; - - if (dblPredictorOrdinate > trailing()) return 1.; - - return integrate (leading(), dblPredictorOrdinate) / normalizer(); - } -} diff --git a/org/drip/spline/bspline/TensionBasisHat.java b/org/drip/spline/bspline/TensionBasisHat.java deleted file mode 100644 index 8f7590d..0000000 --- a/org/drip/spline/bspline/TensionBasisHat.java +++ /dev/null @@ -1,144 +0,0 @@ - -package org.drip.spline.bspline; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * TensionBasisHat implements the common basis hat function that form the basis for all B Splines. It - * contains the left/right ordinates, the tension, and the normalizer. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class TensionBasisHat extends org.drip.function.definition.R1ToR1 { - private double _dblTension = java.lang.Double.NaN; - private double _dblLeftPredictorOrdinate = java.lang.Double.NaN; - private double _dblRightPredictorOrdinate = java.lang.Double.NaN; - - protected TensionBasisHat ( - final double dblLeftPredictorOrdinate, - final double dblRightPredictorOrdinate, - final double dblTension) - throws java.lang.Exception - { - super (null); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblLeftPredictorOrdinate = dblLeftPredictorOrdinate) - || !org.drip.quant.common.NumberUtil.IsValid (_dblRightPredictorOrdinate = - dblRightPredictorOrdinate) || !org.drip.quant.common.NumberUtil.IsValid (_dblTension = - dblTension)) - throw new java.lang.Exception ("TensionBasisHat ctr: Invalid Inputs"); - } - - /** - * Identifies if the ordinate is local to the range - * - * @param dblPredictorOrdinate The Predictor Ordinate - * - * @return TRUE - The Ordinate is local to the Specified Range - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public boolean in ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorOrdinate)) - throw new java.lang.Exception ("TensionBasisHat::in => Invalid Input"); - - return dblPredictorOrdinate >= _dblLeftPredictorOrdinate && dblPredictorOrdinate <= - _dblRightPredictorOrdinate; - } - - /** - * Retrieve the Left Predictor Ordinate - * - * @return The Left Predictor Ordinate - */ - - public double left() - { - return _dblLeftPredictorOrdinate; - } - - /** - * Retrieve the Right Predictor Ordinate - * - * @return The Right Predictor Ordinate - */ - - public double right() - { - return _dblRightPredictorOrdinate; - } - - /** - * Retrieve the Tension - * - * @return The Tension - */ - - public double tension() - { - return _dblTension; - } - - /** - * Compute the Normalizer - * - * @return The Normalizer - * - * @throws java.lang.Exception Thrown if the Normalizer cannot be computed - */ - - public abstract double normalizer() - throws java.lang.Exception; -} diff --git a/org/drip/spline/bspline/TensionProcessedBasisHat.java b/org/drip/spline/bspline/TensionProcessedBasisHat.java deleted file mode 100644 index 563b19d..0000000 --- a/org/drip/spline/bspline/TensionProcessedBasisHat.java +++ /dev/null @@ -1,133 +0,0 @@ - -package org.drip.spline.bspline; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * TensionProcessedBasisHat implements the processed hat basis function of the form laid out in the basic - * framework outlined in Koch and Lyche (1989), Koch and Lyche (1993), and Kvasov (2000) Papers. - * - * @author Lakshmi Krishnamurthy - */ - -public class TensionProcessedBasisHat extends org.drip.spline.bspline.TensionBasisHat { - private int _iDerivOrder = -1; - private org.drip.spline.bspline.TensionBasisHat _tbhRaw = null; - - /** - * TensionProcessedBasisHat constructor - * - * @param tbhRaw The Raw TBH - * @param iDerivOrder Derivative Order off of the Raw TBH - * - * @throws java.lang.Exception Thrown if the input is invalid - */ - - public TensionProcessedBasisHat ( - final org.drip.spline.bspline.TensionBasisHat tbhRaw, - final int iDerivOrder) - throws java.lang.Exception - { - super (tbhRaw.left(), tbhRaw.right(), tbhRaw.tension()); - - if (null == (_tbhRaw = tbhRaw) || 0 >= (_iDerivOrder = iDerivOrder)) - throw new java.lang.Exception ("TensionProcessedBasisHat ctr: Invalid Input"); - } - - @Override public double evaluate ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - return in (dblPredictorOrdinate) ? _tbhRaw.derivative (dblPredictorOrdinate, _iDerivOrder) : 0.; - } - - @Override public double derivative ( - final double dblPredictorOrdinate, - final int iOrder) - throws java.lang.Exception - { - if (0 > iOrder) - throw new java.lang.Exception ("TensionProcessedBasisHat::derivative => Invalid Inputs"); - - if (!in (dblPredictorOrdinate)) return 0.; - - return _tbhRaw.derivative (dblPredictorOrdinate, iOrder + _iDerivOrder); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || !org.drip.quant.common.NumberUtil.IsValid - (dblEnd)) - throw new java.lang.Exception ("TensionProcessedBasisHat::integrate => Invalid Inputs"); - - double dblBoundedBegin = org.drip.quant.common.NumberUtil.Bound (dblBegin, left(), right()); - - double dblBoundedEnd = org.drip.quant.common.NumberUtil.Bound (dblEnd, left(), right()); - - if (dblBoundedBegin >= dblBoundedEnd) return 0.; - - if (1 == _iDerivOrder) return _tbhRaw.evaluate (dblBoundedEnd) - _tbhRaw.evaluate (dblBoundedBegin); - - return _tbhRaw.derivative (dblBoundedEnd, _iDerivOrder - 1) - _tbhRaw.derivative (dblBoundedBegin, - _iDerivOrder - 1); - } - - @Override public double normalizer() - throws java.lang.Exception - { - if (1 == _iDerivOrder) return _tbhRaw.evaluate (right()) - _tbhRaw.evaluate (left()); - - return _tbhRaw.derivative (right(), _iDerivOrder - 1) - _tbhRaw.derivative (left(), _iDerivOrder - - 1); - } -} diff --git a/org/drip/spline/grid/AggregatedSpan.java b/org/drip/spline/grid/AggregatedSpan.java deleted file mode 100644 index 91cf8a5..0000000 --- a/org/drip/spline/grid/AggregatedSpan.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.spline.grid; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * AggregatedSpan implements the Span interface. Here response from an array of spans whose responses are - * aggregated by their weights. - * - * @author Lakshmi Krishnamurthy - */ - -public class AggregatedSpan implements org.drip.spline.grid.Span { - private java.util.List _lsWeight = null; - private java.util.List _lsSpan = null; - - /** - * AggregatedSpan Constructor - * - * @param lsSpan List of Spans - * @param lsWeight List of Weights - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public AggregatedSpan ( - final java.util.List lsSpan, - final java.util.List lsWeight) - throws java.lang.Exception - { - if (null == (_lsSpan = lsSpan) || null == (_lsWeight = lsWeight)) - throw new java.lang.Exception ("AggregatedSpan ctr: Invalid Inputs"); - - int iNumSpan = _lsSpan.size(); - - if (0 == iNumSpan || iNumSpan != _lsWeight.size()) - throw new java.lang.Exception ("AggregatedSpan ctr: Invalid Inputs"); - - for (org.drip.spline.grid.Span span : _lsSpan) { - if (null == span) throw new java.lang.Exception ("AggregatedSpan ctr: Invalid Inputs"); - } - } - - @Override public boolean addStretch ( - final org.drip.spline.stretch.MultiSegmentSequence mss) - { - return false; - } - - @Override public org.drip.spline.stretch.MultiSegmentSequence getContainingStretch ( - final double dblPredictorOrdinate) - { - for (org.drip.spline.grid.Span span : _lsSpan) { - org.drip.spline.stretch.MultiSegmentSequence mss = span.getContainingStretch - (dblPredictorOrdinate); - - if (null != mss) return mss; - } - - return null; - } - - @Override public org.drip.spline.stretch.MultiSegmentSequence getStretch ( - final java.lang.String strName) - { - if (null == strName || strName.isEmpty()) return null; - - for (org.drip.spline.grid.Span span : _lsSpan) { - org.drip.spline.stretch.MultiSegmentSequence mss = span.getStretch (strName); - - if (null != mss) return mss; - } - - return null; - } - - @Override public double left() - throws java.lang.Exception - { - return _lsSpan.get (0).left(); - } - - @Override public double right() - throws java.lang.Exception - { - return _lsSpan.get (_lsSpan.size() - 1).right(); - } - - @Override public double calcResponseValue ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - int i = 0; - double dblResponseValue = 0.; - - for (org.drip.spline.grid.Span span : _lsSpan) - dblResponseValue += span.calcResponseValue (dblPredictorOrdinate) * _lsWeight.get (i++); - - return dblResponseValue; - } - - @Override public double calcResponseValueDerivative ( - final double dblPredictorOrdinate, - final int iOrder) - throws java.lang.Exception - { - int i = 0; - double dblResponseValueDerivative = 0.; - - for (org.drip.spline.grid.Span span : _lsSpan) - dblResponseValueDerivative += span.calcResponseValueDerivative (dblPredictorOrdinate,iOrder) * - _lsWeight.get (i++); - - return dblResponseValueDerivative; - } - - @Override public boolean isMergeState ( - final double dblPredictorOrdinate, - final org.drip.state.identifier.LatentStateLabel lsl) - { - for (org.drip.spline.grid.Span span : _lsSpan) { - if (span.isMergeState (dblPredictorOrdinate, lsl)) return true; - } - - return false; - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDResponseDManifestMeasure ( - final java.lang.String strManifestMeasure, - final double dblPredictorOrdinate, - final int iOrder) - { - int i = 0; - org.drip.quant.calculus.WengertJacobian wjAggregate = null; - - for (org.drip.spline.grid.Span span : _lsSpan) { - org.drip.quant.calculus.WengertJacobian wj = span.jackDResponseDManifestMeasure - (strManifestMeasure, dblPredictorOrdinate, iOrder); - - if (null == wj) return null; - - if (null == wjAggregate) { - if (!(wjAggregate = wj).scale (_lsWeight.get (i++))) return null; - } else { - if (!wjAggregate.cumulativeMerge (wj, _lsWeight.get (i++))) return null; - } - } - - return wjAggregate; - } - - @Override public boolean in ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - for (org.drip.spline.grid.Span span : _lsSpan) { - if (span.in (dblPredictorOrdinate)) return true; - } - - return false; - } - - @Override public java.lang.String displayString() - { - int i = 0; - - java.lang.StringBuffer sb = new java.lang.StringBuffer(); - - for (org.drip.spline.grid.Span span : _lsSpan) - sb.append (span.displayString() + " | " + _lsWeight.get (i++)); - - return sb.toString(); - } -} diff --git a/org/drip/spline/grid/OverlappingStretchSpan.java b/org/drip/spline/grid/OverlappingStretchSpan.java deleted file mode 100644 index 0549286..0000000 --- a/org/drip/spline/grid/OverlappingStretchSpan.java +++ /dev/null @@ -1,284 +0,0 @@ - -package org.drip.spline.grid; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * OverlappingStretchSpan implements the Span interface, and the collection functionality of overlapping - * Stretches. In addition to providing a custom implementation of all the Span interface stubs, it also - * converts the Overlapping Stretch Span to a non-overlapping Stretch Span. Overlapping Stretches are - * clipped from the Left. - * - * @author Lakshmi Krishnamurthy - */ - -public class OverlappingStretchSpan implements org.drip.spline.grid.Span { - private java.util.List _lsMSS = new - java.util.ArrayList(); - - /** - * OverlappingStretchSpan constructor - * - * @param mss The Initial Stretch in the Span - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public OverlappingStretchSpan ( - final org.drip.spline.stretch.MultiSegmentSequence mss) - throws java.lang.Exception - { - if (null == mss) throw new java.lang.Exception ("OverlappingStretchSpan ctr: Invalid Inputs"); - - _lsMSS.add (mss); - } - - @Override public boolean addStretch ( - final org.drip.spline.stretch.MultiSegmentSequence mss) - { - if (null == mss) return false; - - _lsMSS.add (mss); - - return true; - } - - @Override public org.drip.spline.stretch.MultiSegmentSequence getContainingStretch ( - final double dblPredictorOrdinate) - { - if (null == _lsMSS || 0 == _lsMSS.size()) return null; - - for (org.drip.spline.stretch.MultiSegmentSequence mss : _lsMSS) { - try { - if (mss.in (dblPredictorOrdinate)) return mss; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return null; - } - - @Override public org.drip.spline.stretch.MultiSegmentSequence getStretch ( - final java.lang.String strName) - { - if (null == strName) return null; - - for (org.drip.spline.stretch.MultiSegmentSequence mss : _lsMSS) { - if (strName.equalsIgnoreCase (mss.name())) return mss; - } - - return null; - } - - @Override public double left() - throws java.lang.Exception - { - if (0 == _lsMSS.size()) - throw new java.lang.Exception ("OverlappingStretchSpan::left => No valid Stretches found"); - - return _lsMSS.get (0).getLeftPredictorOrdinateEdge(); - } - - @Override public double right() - throws java.lang.Exception - { - if (0 == _lsMSS.size()) - throw new java.lang.Exception ("OverlappingStretchSpan::right => No valid Stretches found"); - - return _lsMSS.get (_lsMSS.size() - 1).getRightPredictorOrdinateEdge(); - } - - @Override public double calcResponseValue ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - for (org.drip.spline.stretch.MultiSegmentSequence mss : _lsMSS) { - if (mss.in (dblPredictorOrdinate)) return mss.responseValue (dblPredictorOrdinate); - } - - throw new java.lang.Exception ("OverlappingStretchSpan::calcResponseValue => Cannot Calculate!"); - } - - @Override public double calcResponseValueDerivative ( - final double dblPredictorOrdinate, - final int iOrder) - throws java.lang.Exception - { - for (org.drip.spline.stretch.MultiSegmentSequence mss : _lsMSS) { - if (mss.in (dblPredictorOrdinate)) - return mss.responseValueDerivative (dblPredictorOrdinate, iOrder); - } - - throw new java.lang.Exception - ("OverlappingStretchSpan::calcResponseValueDerivative => Cannot Calculate!"); - } - - @Override public boolean isMergeState ( - final double dblPredictorOrdinate, - final org.drip.state.identifier.LatentStateLabel lsl) - { - try { - for (org.drip.spline.stretch.MultiSegmentSequence mss : _lsMSS) { - if (mss.in (dblPredictorOrdinate)) { - org.drip.state.representation.MergeSubStretchManager msm = mss.msm(); - - return null == msm ? false : msm.partOfMergeState (dblPredictorOrdinate, lsl); - } - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDResponseDManifestMeasure ( - final java.lang.String strManifestMeasure, - final double dblPredictorOrdinate, - final int iOrder) - { - if (0 == _lsMSS.size()) return null; - - java.util.List lsWJ = new - java.util.ArrayList(); - - boolean bPredictorOrdinateCovered = false; - - for (org.drip.spline.stretch.MultiSegmentSequence mss : _lsMSS) { - if (null == mss) continue; - - try { - org.drip.quant.calculus.WengertJacobian wj = null; - - if (!bPredictorOrdinateCovered && mss.in (dblPredictorOrdinate)) { - wj = mss.jackDResponseDManifestMeasure (strManifestMeasure, dblPredictorOrdinate, - iOrder); - - bPredictorOrdinateCovered = true; - } else - wj = new org.drip.quant.calculus.WengertJacobian (1, mss.segments().length); - - if (null != wj) lsWJ.add (wj); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return org.drip.quant.common.CollectionUtil.AppendWengert (lsWJ); - } - - @Override public boolean in ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - for (org.drip.spline.stretch.MultiSegmentSequence mss : _lsMSS) { - if (mss.in (dblPredictorOrdinate)) return true; - } - - return false; - } - - /** - * Convert the Overlapping Stretch Span to a non-overlapping Stretch Span. Overlapping Stretches are - * clipped from the Left. - * - * @return The Non-overlapping Stretch Span Instance - */ - - public org.drip.spline.grid.Span toNonOverlapping() - { - if (0 == _lsMSS.size()) return null; - - org.drip.spline.grid.OverlappingStretchSpan oss = null; - org.drip.spline.stretch.MultiSegmentSequence mssPrev = null; - - for (org.drip.spline.stretch.MultiSegmentSequence mss : _lsMSS) { - if (null == mss) continue; - - if (null == oss) { - try { - oss = new org.drip.spline.grid.OverlappingStretchSpan (mssPrev = mss); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } else { - double dblPrevRightPredictorOrdinateEdge = mssPrev.getRightPredictorOrdinateEdge(); - - double dblCurrentLeftPredictorOrdinateEdge = mss.getLeftPredictorOrdinateEdge(); - - if (dblCurrentLeftPredictorOrdinateEdge >= dblPrevRightPredictorOrdinateEdge) - oss.addStretch (mss); - else - oss.addStretch (mss.clipLeft (mss.name(), dblPrevRightPredictorOrdinateEdge)); - } - } - - return oss; - } - - @Override public java.lang.String displayString() - { - java.lang.StringBuffer sb = new java.lang.StringBuffer(); - - for (org.drip.spline.stretch.MultiSegmentSequence mss : _lsMSS) - sb.append (mss.name() + " | " + new org.drip.analytics.date.JulianDate ((int) - mss.getLeftPredictorOrdinateEdge()) + " => " + new org.drip.analytics.date.JulianDate ((int) - mss.getRightPredictorOrdinateEdge()) + "\n"); - - return sb.toString(); - } -} diff --git a/org/drip/spline/grid/Span.java b/org/drip/spline/grid/Span.java deleted file mode 100644 index 13f32ef..0000000 --- a/org/drip/spline/grid/Span.java +++ /dev/null @@ -1,204 +0,0 @@ - -package org.drip.spline.grid; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * Span is the interface that exposes the functionality behind the collection of Stretches that may be - * overlapping or non-overlapping. It exposes the following stubs: - * - Retrieve the Left/Right Span Edge. - * - Indicate if the specified Label is part of the Merge State at the specified Predictor Ordinate. - * - Compute the Response from the containing Stretches. - * - Add a Stretch to the Span. - * - Retrieve the first Stretch that contains the Predictor Ordinate. - * - Retrieve the Stretch by Name. - * - Calculate the Response Derivative to the Quote at the specified Ordinate. - * - Display the Span Edge Coordinates. - * - * @author Lakshmi Krishnamurthy - */ - -public interface Span { - - /** - * Retrieve the Left Span Edge - * - * @return The Left Span Edge - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public abstract double left() - throws java.lang.Exception; - - /** - * Retrieve the Right Span Edge - * - * @return The Left Span Edge - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public abstract double right() - throws java.lang.Exception; - - /** - * Indicate if the specified Label is part of the Merge State at the specified Predictor Ordinate - * - * @param dblPredictorOrdinate The Predictor Ordinate - * @param lsl Merge State Label - * - * @return TRUE - The specified Label is part of the Merge State at the specified Predictor Ordinate - */ - - public abstract boolean isMergeState ( - final double dblPredictorOrdinate, - final org.drip.state.identifier.LatentStateLabel lsl); - - /** - * Compute the Response from the containing Stretches - * - * @param dblPredictorOrdinate The Predictor Ordinate - * - * @return The Response - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public abstract double calcResponseValue ( - final double dblPredictorOrdinate) - throws java.lang.Exception; - - /** - * Compute the Response Value Derivative from the containing Stretches - * - * @param dblPredictorOrdinate The Predictor Ordinate - * @param iOrder Order of the Derivative to be calculated - * - * @return The Response Value Derivative - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public abstract double calcResponseValueDerivative ( - final double dblPredictorOrdinate, - final int iOrder) - throws java.lang.Exception; - - /** - * Add a Stretch to the Span - * - * @param mss Stretch to be added - * - * @return TRUE - Stretch added successfully - */ - - public abstract boolean addStretch ( - final org.drip.spline.stretch.MultiSegmentSequence mss); - - /** - * Retrieve the first Stretch that contains the Predictor Ordinate - * - * @param dblPredictorOrdinate The Predictor Ordinate - * - * @return The containing Stretch - */ - - public abstract org.drip.spline.stretch.MultiSegmentSequence getContainingStretch ( - final double dblPredictorOrdinate); - - /** - * Retrieve the Stretch by Name - * - * @param strName The Stretch Name - * - * @return The Stretch - */ - - public abstract org.drip.spline.stretch.MultiSegmentSequence getStretch ( - final java.lang.String strName); - - /** - * Calculate the Response Derivative to the Manifest Measure at the specified Ordinate - * - * @param strManifestMeasure Manifest Measure whose Sensitivity is sought - * @param dblPredictorOrdinate Predictor Ordinate - * @param iOrder Order of Derivative desired - * - * @return Jacobian of the Response Derivative to the Manifest Measure at the Ordinate - */ - - public abstract org.drip.quant.calculus.WengertJacobian jackDResponseDManifestMeasure ( - final java.lang.String strManifestMeasure, - final double dblPredictorOrdinate, - final int iOrder); - - /** - * Check if the Predictor Ordinate is in the Stretch Range - * - * @param dblPredictorOrdinate Predictor Ordinate - * - * @return TRUE - Predictor Ordinate is in the Range - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public abstract boolean in ( - final double dblPredictorOrdinate) - throws java.lang.Exception; - - /** - * Display the Span Edge Coordinates - * - * @return The Edge Coordinates String - */ - - public java.lang.String displayString(); -} diff --git a/org/drip/spline/multidimensional/WireSurfacePiecewiseConstant.java b/org/drip/spline/multidimensional/WireSurfacePiecewiseConstant.java deleted file mode 100644 index 6c18044..0000000 --- a/org/drip/spline/multidimensional/WireSurfacePiecewiseConstant.java +++ /dev/null @@ -1,204 +0,0 @@ - -package org.drip.spline.multidimensional; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * WireSurfacePiecewiseConstant implements the piecewise Constant version of the 2D Spline Response Surface. - * It synthesizes this from an array of 1D Span Instances, each of which is referred to as wire spline in - * this case. - * - * @author Lakshmi Krishnamurthy - */ - -public class WireSurfacePiecewiseConstant { - private double[] _adblX = null; - private double[] _adblY = null; - private double[][] _aadblResponse = null; - - /** - * WireSurfacePiecewiseConstant Constructor - * - * @param adblX Array of the X Ordinates - * @param adblY Array of the Y Ordinates - * @param aadblResponse Double Array of the Responses corresponding to {X, Y} - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public WireSurfacePiecewiseConstant ( - final double[] adblX, - final double[] adblY, - final double[][] aadblResponse) - throws java.lang.Exception - { - if (null == (_adblX = adblX) || null == (_adblY = adblY)) - throw new java.lang.Exception ("WireSurfacePiecewiseConstant ctr: Invalid Inputs"); - - int iXLength = _adblX.length; - int iYLength = _adblY.length; - - if (0 == iXLength || 0 == iYLength || null == (_aadblResponse = aadblResponse) || iXLength != - _aadblResponse.length || iYLength != _aadblResponse[0].length) - throw new java.lang.Exception ("WireSurfacePiecewiseConstant ctr: Invalid Inputs"); - } - - /** - * Enclosing X Index - * - * @param dblX The X Ordinate - * - * @return The Corresponding Index - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public int enclosingXIndex ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception - ("WireSurfacePiecewiseConstant::enclosingXIndex => Invalid Inputs"); - - if (dblX < _adblX[0]) return java.lang.Integer.MIN_VALUE; - - int iTerminalXIndex = _adblX.length - 1; - - if (dblX > _adblX[iTerminalXIndex]) return java.lang.Integer.MAX_VALUE; - - for (int i = 1; i <= iTerminalXIndex; ++i) { - if (dblX >= _adblX[i - 1] && dblX >= _adblX[i]) return i; - } - - throw new java.lang.Exception ("WireSurfacePiecewiseConstant::enclosingXIndex => Invalid Inputs"); - } - - /** - * Enclosing Y Index - * - * @param dblY The Y Ordinate - * - * @return The Corresponding Index - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public int enclosingYIndex ( - final double dblY) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblY)) - throw new java.lang.Exception - ("WireSurfacePiecewiseConstant::enclosingYIndex => Invalid Inputs"); - - if (dblY < _adblY[0]) return java.lang.Integer.MIN_VALUE; - - int iTerminalYIndex = _adblY.length - 1; - - if (dblY > _adblY[iTerminalYIndex]) return java.lang.Integer.MAX_VALUE; - - for (int i = 1; i <= iTerminalYIndex; ++i) { - if (dblY >= _adblY[i - 1] && dblY >= _adblY[i]) return i; - } - - throw new java.lang.Exception ("WireSurfacePiecewiseConstant::enclosingXIndex => Invalid Inputs"); - } - - /** - * Compute the Bivariate Surface Response Value - * - * @param dblX X - * @param dblY Y - * - * @return The Bivariate Surface Response Value - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public double responseValue ( - final double dblX, - final double dblY) - throws java.lang.Exception - { - int iTerminalXIndex = _adblX.length - 1; - int iTerminalYIndex = _adblY.length - 1; - - int iEnclosingXIndex = enclosingXIndex (dblX); - - int iEnclosingYIndex = enclosingYIndex (dblY); - - if (java.lang.Integer.MIN_VALUE == iEnclosingXIndex) - iEnclosingXIndex = 0; - else if (java.lang.Integer.MAX_VALUE == iEnclosingXIndex) - iEnclosingXIndex = iTerminalXIndex; - else { - for (int i = 1; i <= iTerminalXIndex; ++i) { - if (dblX >= _adblX[i - 1] && dblX >= _adblX[i]) { - iEnclosingXIndex = i; - break; - } - } - } - - if (java.lang.Integer.MIN_VALUE == iEnclosingYIndex) - iEnclosingYIndex = 0; - else if (java.lang.Integer.MAX_VALUE == iEnclosingYIndex) - iEnclosingYIndex = iTerminalYIndex; - else { - for (int i = 1; i <= iTerminalYIndex; ++i) { - if (dblY >= _adblY[i - 1] && dblY >= _adblY[i]) { - iEnclosingYIndex = i; - break; - } - } - } - - return _aadblResponse[iEnclosingXIndex][iEnclosingYIndex]; - } -} diff --git a/org/drip/spline/multidimensional/WireSurfaceStretch.java b/org/drip/spline/multidimensional/WireSurfaceStretch.java deleted file mode 100644 index 3e6e56b..0000000 --- a/org/drip/spline/multidimensional/WireSurfaceStretch.java +++ /dev/null @@ -1,281 +0,0 @@ - -package org.drip.spline.multidimensional; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * WireSurfaceStretch implements a 2D spline surface stretch. It synthesizes this from an array of 1D Span - * instances, each of which is referred to as wire spline in this case. - * - * @author Lakshmi Krishnamurthy - */ - -public class WireSurfaceStretch { - private org.drip.spline.params.SegmentCustomBuilderControl _scbc = null; - private java.util.TreeMap _mapWireSpan = null; - - /** - * WireSurfaceStretch Constructor - * - * @param strName Name - * @param scbc Segment Custom Builder Control Parameters - * @param mapWireSpan X-mapped Array of Y Basis Spline Wire Spans - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public WireSurfaceStretch ( - final java.lang.String strName, - final org.drip.spline.params.SegmentCustomBuilderControl scbc, - final java.util.TreeMap mapWireSpan) - throws java.lang.Exception - { - if (null == (_mapWireSpan = mapWireSpan) || 0 == _mapWireSpan.size() || null == (_scbc = scbc)) - throw new java.lang.Exception ("WireSurfaceStretch ctr: Invalid Inputs"); - } - - /** - * Compute the Bivariate Surface Response Value - * - * @param dblX X - * @param dblY Y - * - * @return The Bivariate Surface Response Value - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public double responseValue ( - final double dblX, - final double dblY) - throws java.lang.Exception - { - int iSize = _mapWireSpan.size(); - - int i = 0; - double[] adblX = new double[iSize]; - double[] adblZ = new double[iSize]; - org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC = new - org.drip.spline.params.SegmentCustomBuilderControl[iSize - 1]; - - for (java.util.Map.Entry me : _mapWireSpan.entrySet()) { - if (null == me) - throw new java.lang.Exception ("WireSurfaceStretch::responseValue => Invalid Wire Span Map"); - - if (0 != i) aSCBC[i - 1] = _scbc; - - adblX[i] = me.getKey(); - - org.drip.spline.grid.Span wireSpan = me.getValue(); - - if (null == wireSpan) - throw new java.lang.Exception ("WireSurfaceStretch::responseValue => Invalid Wire Span Map"); - - double dblLeftY = wireSpan.left(); - - double dblRightY = wireSpan.right(); - - if (dblY <= dblLeftY) - adblZ[i++] = wireSpan.calcResponseValue (dblLeftY); - else if (dblY >= dblRightY) - adblZ[i++] = wireSpan.calcResponseValue (dblRightY); - else - adblZ[i++] = wireSpan.calcResponseValue (dblY); - } - - org.drip.spline.stretch.MultiSegmentSequence mss = - org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - ("org.drip.spline.multidimensional.WireSurfaceStretch@" + - org.drip.quant.common.StringUtil.GUID(), adblX, adblZ, aSCBC, null, - org.drip.spline.stretch.BoundarySettings.NaturalStandard(), - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE); - - if (null == mss) - throw new java.lang.Exception ("WireSurfaceStretch::responseValue => Cannot extract MSS"); - - double dblLeftX = mss.getLeftPredictorOrdinateEdge(); - - if (dblX <= dblLeftX) return mss.responseValue (dblLeftX); - - double dblRightX = mss.getRightPredictorOrdinateEdge(); - - if (dblX >= dblRightX) return mss.responseValue (dblRightX); - - return mss.responseValue (dblX); - } - - /** - * Retrieve the Surface Span Stretch that corresponds to the given Y Anchor - * - * @param dblYAnchor Y Anchor - * - * @return The Surface Span Stretch Instance - */ - - public org.drip.spline.grid.Span wireSpanYAnchor ( - final double dblYAnchor) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblYAnchor)) return null; - - int iSize = _mapWireSpan.size(); - - int i = 0; - double[] adblX = new double[iSize]; - double[] adblZ = new double[iSize]; - org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC = new - org.drip.spline.params.SegmentCustomBuilderControl[iSize - 1]; - - for (java.util.Map.Entry me : _mapWireSpan.entrySet()) { - if (null == me) return null; - - if (0 != i) aSCBC[i - 1] = _scbc; - - adblX[i] = me.getKey(); - - org.drip.spline.grid.Span wireSpan = me.getValue(); - - if (null == wireSpan) return null; - - try { - double dblLeftY = wireSpan.left(); - - double dblRightY = wireSpan.right(); - - if (dblYAnchor <= dblLeftY) - adblZ[i++] = wireSpan.calcResponseValue (dblLeftY); - else if (dblYAnchor >= dblRightY) - adblZ[i++] = wireSpan.calcResponseValue (dblRightY); - else - adblZ[i++] = wireSpan.calcResponseValue (dblYAnchor); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - try { - return new org.drip.spline.grid.OverlappingStretchSpan - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - ("org.drip.spline.multidimensional.WireSurfaceStretch@" + - org.drip.quant.common.StringUtil.GUID(), adblX, adblZ, aSCBC, null, - org.drip.spline.stretch.BoundarySettings.NaturalStandard(), - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Surface Span Stretch that corresponds to the given X Anchor - * - * @param dblXAnchor X Anchor - * - * @return The Surface Span Stretch Instance - */ - - public org.drip.spline.grid.Span wireSpanXAnchor ( - final double dblXAnchor) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblXAnchor)) return null; - - org.drip.spline.grid.Span spanPrev = null; - org.drip.spline.grid.Span spanCurrent = null; - double dblXAnchorPrev = java.lang.Double.NaN; - double dblXAnchorCurrent = java.lang.Double.NaN; - - for (java.util.Map.Entry me : _mapWireSpan.entrySet()) { - if (null == me) return null; - - dblXAnchorCurrent = me.getKey(); - - spanCurrent = me.getValue(); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblXAnchorPrev)) { - if (dblXAnchor <= (dblXAnchorPrev = dblXAnchorCurrent)) return spanCurrent; - - spanPrev = spanCurrent; - continue; - } - - if (dblXAnchor > dblXAnchorPrev && dblXAnchor <= dblXAnchorCurrent) { - double dblLeftWeight = (dblXAnchorCurrent - dblXAnchor) / (dblXAnchorCurrent - - dblXAnchorPrev); - - java.util.List lsWeight = new java.util.ArrayList(); - - java.util.List lsSpan = new - java.util.ArrayList(); - - lsSpan.add (spanPrev); - - lsSpan.add (spanCurrent); - - lsWeight.add (dblLeftWeight); - - lsWeight.add (1. - dblLeftWeight); - - try { - return new org.drip.spline.grid.AggregatedSpan (lsSpan, lsWeight); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - spanPrev = spanCurrent; - dblXAnchorPrev = dblXAnchorCurrent; - } - - return spanCurrent; - } -} diff --git a/org/drip/spline/params/PreceedingManifestSensitivityControl.java b/org/drip/spline/params/PreceedingManifestSensitivityControl.java deleted file mode 100644 index 9829c1b..0000000 --- a/org/drip/spline/params/PreceedingManifestSensitivityControl.java +++ /dev/null @@ -1,120 +0,0 @@ - -package org.drip.spline.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * PreceedingManifestSensitivityControl provides the control parameters that determine the behavior of - * non-local manifest sensitivity. - * - * @author Lakshmi Krishnamurthy - */ - -public class PreceedingManifestSensitivityControl { - private boolean _bImpactFade = false; - private int _iCkDBasisCoeffDPreceedingManifest = 0; - private org.drip.spline.segment.BasisEvaluator _be = null; - - /** - * PreceedingManifestSensitivityControl constructor - * - * @param bImpactFade TRUE - Fade the Manifest Sensitivity Impact; FALSE - Retain it - * @param iCkDBasisCoeffDPreceedingManifest Ck of DBasisCoeffDPreceedingManifest - * @param be Basis Evaluator Instance - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public PreceedingManifestSensitivityControl ( - final boolean bImpactFade, - final int iCkDBasisCoeffDPreceedingManifest, - final org.drip.spline.segment.BasisEvaluator be) - throws java.lang.Exception - { - if (0 > (_iCkDBasisCoeffDPreceedingManifest = iCkDBasisCoeffDPreceedingManifest)) - throw new java.lang.Exception ("PreceedingManifestSensitivityControl ctr: Invalid Inputs"); - - _be = be; - _bImpactFade = bImpactFade; - } - - /** - * Retrieve the Ck of DBasisCoeffDPreceedingManifest - * - * @return Ck of DBasisCoeffDPreceedingManifest - */ - - public int Ck() - { - return _iCkDBasisCoeffDPreceedingManifest; - } - - /** - * Retrieve the Basis Evaluator Instance - * - * @return The Basis Evaluator Instance - */ - - public org.drip.spline.segment.BasisEvaluator basisEvaluator() - { - return _be; - } - - /** - * Retrieve the Preceeding Manifest Measure Impact Flag - * - * @return The Preceeding Manifest Measure Impact Flag - */ - - public boolean impactFade() - { - return _bImpactFade; - } -} diff --git a/org/drip/spline/params/ResponseScalingShapeControl.java b/org/drip/spline/params/ResponseScalingShapeControl.java deleted file mode 100644 index 7ea2aa2..0000000 --- a/org/drip/spline/params/ResponseScalingShapeControl.java +++ /dev/null @@ -1,106 +0,0 @@ - -package org.drip.spline.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * ResponseScalingShapeControl implements the segment level basis functions proportional adjustment to - * achieve the desired shape behavior of the response. In addition to the actual shape controller function, - * it interprets whether the control is applied on a local or global predicate ordinate basis. - * - * @author Lakshmi Krishnamurthy - */ - -public class ResponseScalingShapeControl { - private boolean _bIsLocal = false; - private org.drip.function.definition.R1ToR1 _auShapeControl = null; - - /** - * ResponseScalingShapeControl constructor - * - * @param bIsLocal TRUE - Shape Control is applied on a local segment basis - * @param auShapeControl - Univariate Shape Controller Function - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public ResponseScalingShapeControl ( - final boolean bIsLocal, - final org.drip.function.definition.R1ToR1 auShapeControl) - throws java.lang.Exception - { - if (null == (_auShapeControl = auShapeControl)) - throw new java.lang.Exception ("ResponseScalingShapeControl ctr: Invalid Inputs"); - - _bIsLocal = bIsLocal; - } - - /** - * Indicate if the Control is applied on a Local or a Global Predicate Ordinate Basis - * - * @return TRUE - Control is applied on a Local Predicate Ordinate Basis - */ - - public boolean isLocal() - { - return _bIsLocal; - } - - /** - * Retrieve the Shape Control Univariate Function - * - * @return The Shape Control Univariate Function - */ - - public org.drip.function.definition.R1ToR1 shapeController() - { - return _auShapeControl; - } -} diff --git a/org/drip/spline/params/ResponseValueSensitivityConstraint.java b/org/drip/spline/params/ResponseValueSensitivityConstraint.java deleted file mode 100644 index 12ff8d0..0000000 --- a/org/drip/spline/params/ResponseValueSensitivityConstraint.java +++ /dev/null @@ -1,140 +0,0 @@ - -package org.drip.spline.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * SegmentResponseValueConstraint holds the SegmentBasisFlexureConstraint instances for the Base Calibration - * and one for each Manifest Measure Sensitivity. - * - * @author Lakshmi Krishnamurthy - */ - -public class ResponseValueSensitivityConstraint { - private org.drip.spline.params.SegmentResponseValueConstraint _srvcBase = null; - - private - org.drip.analytics.support.CaseInsensitiveHashMap - _mapSRVCManifestMeasure = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - /** - * ResponseValueSensitivityConstraint constructor - * - * @param srvcBase The Base Calibration Instance of SRVC - * - * @throws java.lang.Exception Thrown if Inputs are Invalid - */ - - public ResponseValueSensitivityConstraint ( - final org.drip.spline.params.SegmentResponseValueConstraint srvcBase) - throws java.lang.Exception - { - if (null == (_srvcBase = srvcBase)) - throw new java.lang.Exception ("ResponseValueSensitivityConstraint ctr: Invalid Inputs"); - } - - /** - * Add the SRVC Instance corresponding to the specified Manifest Measure - * - * @param strManifestMeasure The Manifest Measure - * @param srvc The SRVC Instance - * - * @return TRUE - The SRVC Instance was successfully added - */ - - public boolean addManifestMeasureSensitivity ( - final java.lang.String strManifestMeasure, - final org.drip.spline.params.SegmentResponseValueConstraint srvc) - { - if (null == strManifestMeasure || strManifestMeasure.isEmpty() || null == srvc) return false; - - _mapSRVCManifestMeasure.put (strManifestMeasure, srvc); - - return true; - } - - /** - * Retrieve the base SRVC Instance - * - * @return The Base SRVC Instance - */ - - public org.drip.spline.params.SegmentResponseValueConstraint base() - { - return _srvcBase; - } - - /** - * Retrieve the SRVC Instance Specified by the Manifest Measure - * - * @param strManifestMeasure The Manifest Measure - * - * @return The SRVC Instance Specified by the Manifest Measure - */ - - public org.drip.spline.params.SegmentResponseValueConstraint manifestMeasureSensitivity ( - final java.lang.String strManifestMeasure) - { - return null != strManifestMeasure && _mapSRVCManifestMeasure.containsKey (strManifestMeasure) ? - _mapSRVCManifestMeasure.get (strManifestMeasure) : null; - } - - /** - * Return the Set of Available Manifest Measures (if any) - * - * @return The Set of Available Manifest Measures - */ - - public java.util.Set manifestMeasures() - { - return _mapSRVCManifestMeasure.keySet(); - } -} diff --git a/org/drip/spline/params/SegmentBasisFlexureConstraint.java b/org/drip/spline/params/SegmentBasisFlexureConstraint.java deleted file mode 100644 index a8929e5..0000000 --- a/org/drip/spline/params/SegmentBasisFlexureConstraint.java +++ /dev/null @@ -1,116 +0,0 @@ - -package org.drip.spline.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * SegmentBasisFlexureConstraint holds the set of fields needed to characterize a single local linear - * Constraint, expressed linearly as a combination of the local Predictor Ordinates and their corresponding - * Response Basis Function Realizations. Constraints are expressed as - * - * C := Sigma_(i,j) [W_i * B_i(x_j)] = V where - * - * x_j - The Predictor Ordinate at Node j - * B_i - The Coefficient for the Response Basis Function i - * W_i - Weight applied for the Response Basis Function i - * V - Value of the Constraint - * - * SegmentBasisFlexureConstraint can be viewed as the localized basis function transpose of - * SegmentResponseValueConstraint. - * - * @author Lakshmi Krishnamurthy - */ - -public class SegmentBasisFlexureConstraint { - private double[] _adblResponseBasisCoeffWeight = null; - private double _dblConstraintValue = java.lang.Double.NaN; - - /** - * SegmentBasisFlexureConstraint constructor - * - * @param adblResponseBasisCoeffWeight The Weight for each of the Coefficients in the Basis Function Set - * @param dblConstraintValue The Constraint Value - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public SegmentBasisFlexureConstraint ( - double[] adblResponseBasisCoeffWeight, - double dblConstraintValue) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblConstraintValue = dblConstraintValue) || null == - (_adblResponseBasisCoeffWeight = adblResponseBasisCoeffWeight) || 0 == - _adblResponseBasisCoeffWeight.length) - throw new java.lang.Exception ("SegmentBasisFlexureConstraint ctr: Invalid Inputs"); - } - - /** - * Retrieve the Array of the Response Basis Coefficient Weights - * - * @return The Array of the Response Basis Coefficient Weights - */ - - public double[] responseBasisCoeffWeights() - { - return _adblResponseBasisCoeffWeight; - } - - /** - * Retrieve the Constraint Value - * - * @return The Constraint Value - */ - - public double contraintValue() - { - return _dblConstraintValue; - } -} diff --git a/org/drip/spline/params/SegmentBestFitResponse.java b/org/drip/spline/params/SegmentBestFitResponse.java deleted file mode 100644 index 92bdf9d..0000000 --- a/org/drip/spline/params/SegmentBestFitResponse.java +++ /dev/null @@ -1,259 +0,0 @@ - -package org.drip.spline.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * SegmentBestFitResponse implements basis per-segment Fitness Penalty Parameter Set. Currently it contains - * the Best Fit Penalty Weight Grid Matrix and the corresponding Segment Local Predictor Ordinate/Response - * Match Pair. - * - * @author Lakshmi Krishnamurthy - */ - -public class SegmentBestFitResponse { - private double[] _adblWeight = null; - private double[] _adblResponse = null; - private double[] _adblPredictorOrdinate = null; - - /** - * Construct the SegmentBestFitResponse Instance from the given Inputs - * - * @param adblPredictorOrdinate Array of Predictor Ordinates - * @param adblResponseValue Array of Response Values - * @param adblWeight Array of Weights - * - * @return Instance of SegmentBestFitResponse - */ - - public static final SegmentBestFitResponse Create ( - final double[] adblPredictorOrdinate, - final double[] adblResponseValue, - final double[] adblWeight) - { - SegmentBestFitResponse frp = null; - - try { - frp = new SegmentBestFitResponse (adblWeight, adblResponseValue, adblPredictorOrdinate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return frp.normalizeWeights() ? frp : null; - } - - /** - * Construct the SegmentBestFitResponse Instance from the given Predictor Ordinate/Response Pairs, using - * Uniform Weightings. - * - * @param adblPredictorOrdinate Array of Predictor Ordinates - * @param adblResponseValue Array of Response Values - * - * @return Instance of SegmentBestFitResponse - */ - - public static final SegmentBestFitResponse Create ( - final double[] adblPredictorOrdinate, - final double[] adblResponseValue) - { - if (!org.drip.quant.common.NumberUtil.IsValid (adblPredictorOrdinate)) return null; - - int iNumWeight = adblPredictorOrdinate.length; - double[] adblWeight = new double[iNumWeight]; - - for (int i = 0; i < iNumWeight; ++i) - adblWeight[i] = 1.; - - return Create (adblPredictorOrdinate, adblResponseValue, adblWeight); - } - - private SegmentBestFitResponse ( - final double[] adblWeight, - final double[] adblResponse, - final double[] adblPredictorOrdinate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_adblWeight = adblWeight) || - !org.drip.quant.common.NumberUtil.IsValid (_adblResponse = adblResponse) || - !org.drip.quant.common.NumberUtil.IsValid (_adblPredictorOrdinate = adblPredictorOrdinate)) - throw new java.lang.Exception ("SegmentBestFitResponse ctr: Invalid Inputs"); - - int iNumPointsToFit = _adblWeight.length; - - if (0 == iNumPointsToFit || _adblResponse.length != iNumPointsToFit || - _adblPredictorOrdinate.length != iNumPointsToFit) - throw new java.lang.Exception ("SegmentBestFitResponse ctr: Invalid Inputs"); - } - - private boolean normalizeWeights() - { - double dblCumulativeWeight = 0.; - int iNumPointsToFit = _adblWeight.length; - - for (int i = 0; i < iNumPointsToFit; ++i) { - if (_adblWeight[i] < 0.) return false; - - dblCumulativeWeight += _adblWeight[i]; - } - - if (0. >= dblCumulativeWeight) return false; - - for (int i = 0; i < iNumPointsToFit; ++i) - _adblWeight[i] /= dblCumulativeWeight; - - return true; - } - - /** - * Retrieve the Array of the Fitness Weights - * - * @return The Array of the Fitness Weights - */ - - public double[] weight() - { - return _adblWeight; - } - - /** - * Retrieve the Indexed Fitness Weight Element - * - * @param iIndex The Element Index - * - * @return The Indexed Fitness Weight Element - * - * @throws java.lang.Exception Thrown if the Index is Invalid - */ - - public double weight ( - final int iIndex) - throws java.lang.Exception - { - if (iIndex >= numPoint()) - throw new java.lang.Exception ("SegmentBestFitResponse::weight => Invalid Index"); - - return _adblWeight[iIndex]; - } - - /** - * Retrieve the Array of Predictor Ordinates - * - * @return The Array of Predictor Ordinates - */ - - public double[] predictorOrdinate() - { - return _adblPredictorOrdinate; - } - - /** - * Retrieve the Indexed Predictor Ordinate Element - * - * @param iIndex The Element Index - * - * @return The Indexed Predictor Ordinate Element - * - * @throws java.lang.Exception Thrown if the Index is Invalid - */ - - public double predictorOrdinate ( - final int iIndex) - throws java.lang.Exception - { - if (iIndex >= numPoint()) - throw new java.lang.Exception ("SegmentBestFitResponse::predictorOrdinate => Invalid Index"); - - return _adblPredictorOrdinate[iIndex]; - } - - /** - * Retrieve the Array of Responses - * - * @return The Array of Responses - */ - - public double[] response() - { - return _adblResponse; - } - - /** - * Retrieve the Indexed Response Element - * - * @param iIndex The Element Index - * - * @return The Indexed Response Element - * - * @throws java.lang.Exception Thrown if the Index is Invalid - */ - - public double response ( - final int iIndex) - throws java.lang.Exception - { - if (iIndex >= numPoint()) - throw new java.lang.Exception ("SegmentBestFitResponse::response => Invalid Index"); - - return _adblResponse[iIndex]; - } - - /** - * Retrieve the Number of Fitness Points - * - * @return The Number of Fitness Points - */ - - public int numPoint() - { - return null == _adblResponse ? 0 : _adblResponse.length; - } -} diff --git a/org/drip/spline/params/SegmentCustomBuilderControl.java b/org/drip/spline/params/SegmentCustomBuilderControl.java deleted file mode 100644 index 46f366a..0000000 --- a/org/drip/spline/params/SegmentCustomBuilderControl.java +++ /dev/null @@ -1,148 +0,0 @@ - -package org.drip.spline.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * SegmentCustomBuilderControl holds the parameters the guide the creation/behavior of the segment. It holds the - * segment elastic/inelastic parameters and the named basis function set. - * - * @author Lakshmi Krishnamurthy - */ - -public class SegmentCustomBuilderControl { - private java.lang.String _strBasisSpline = ""; - private org.drip.spline.basis.FunctionSetBuilderParams _fsbp = null; - private org.drip.spline.params.ResponseScalingShapeControl _rssc = null; - private org.drip.spline.params.SegmentInelasticDesignControl _sdic = null; - private org.drip.spline.params.PreceedingManifestSensitivityControl _pmsc = null; - - /** - * SegmentCustomBuilderControl constructor - * - * @param strBasisSpline Named Segment Basis Spline - * @param fsbp Segment Basis Set Construction Parameters - * @param sdic Segment Design Inelastic Parameters - * @param rssc Segment Shape Controller - * @param pmsc Preceeding Manifest Sensitivity Control Parameters - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public SegmentCustomBuilderControl ( - final java.lang.String strBasisSpline, - final org.drip.spline.basis.FunctionSetBuilderParams fsbp, - final org.drip.spline.params.SegmentInelasticDesignControl sdic, - final org.drip.spline.params.ResponseScalingShapeControl rssc, - final org.drip.spline.params.PreceedingManifestSensitivityControl pmsc) - throws java.lang.Exception - { - if (null == (_strBasisSpline = strBasisSpline) || null == (_fsbp = fsbp) || null == (_sdic = sdic)) - throw new java.lang.Exception ("SegmentCustomBuilderControl ctr => Invalid Inputs"); - - _pmsc = pmsc; - _rssc = rssc; - } - - /** - * Retrieve the Basis Spline Name - * - * @return The Basis Spline Name - */ - - public java.lang.String basisSpline() - { - return _strBasisSpline; - } - - /** - * Retrieve the Basis Set Parameters - * - * @return The Basis Set Parameters - */ - - public org.drip.spline.basis.FunctionSetBuilderParams basisSetParams() - { - return _fsbp; - } - - /** - * Retrieve the Segment Inelastic Parameters - * - * @return The Segment Inelastic Parameters - */ - - public org.drip.spline.params.SegmentInelasticDesignControl inelasticParams() - { - return _sdic; - } - - /** - * Retrieve the Segment Shape Controller - * - * @return The Segment Shape Controller - */ - - public org.drip.spline.params.ResponseScalingShapeControl shapeController() - { - return _rssc; - } - - /** - * Retrieve the Preceeding Manifest Sensitivity Control Parameters - * - * @return The Preceeding Manifest Sensitivity Control Parameters - */ - - public org.drip.spline.params.PreceedingManifestSensitivityControl preceedingManifestSensitivityControl() - { - return _pmsc; - } -} diff --git a/org/drip/spline/params/SegmentFlexurePenaltyControl.java b/org/drip/spline/params/SegmentFlexurePenaltyControl.java deleted file mode 100644 index 38a46be..0000000 --- a/org/drip/spline/params/SegmentFlexurePenaltyControl.java +++ /dev/null @@ -1,106 +0,0 @@ - -package org.drip.spline.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * SegmentFlexurePenaltyControl implements basis per-segment Flexure Penalty Parameter Set. Currently it - * contains the Flexure Penalty Derivative Order and the Roughness Coefficient Amplitude. - * - * Flexure Penalty Control may be used to implement Segment Curvature Control and/or Segment Length Control. - * - * @author Lakshmi Krishnamurthy - */ - -public class SegmentFlexurePenaltyControl { - private int _iDerivativeOrder = -1; - private double _dblAmplitude = java.lang.Double.NaN; - - /** - * SegmentFlexurePenaltyControl constructor - * - * @param iDerivativeOrder Roughness Penalty Derivative Order - * @param dblAmplitude Roughness Curvature Penalty Amplitude - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public SegmentFlexurePenaltyControl ( - final int iDerivativeOrder, - final double dblAmplitude) - throws java.lang.Exception - { - if (0 >= (_iDerivativeOrder = iDerivativeOrder) || !org.drip.quant.common.NumberUtil.IsValid - (_dblAmplitude = dblAmplitude)) - throw new java.lang.Exception ("SegmentFlexurePenaltyControl ctr: Invalid Inputs"); - } - - /** - * Retrieve the Derivative Order - * - * @return The Derivative Order - */ - - public int derivativeOrder() - { - return _iDerivativeOrder; - } - - /** - * Retrieve the Roughness Curvature Penalty Amplitude - * - * @return The Roughness Curvature Penalty Amplitude - */ - - public double amplitude() - { - return _dblAmplitude; - } -} diff --git a/org/drip/spline/params/SegmentInelasticDesignControl.java b/org/drip/spline/params/SegmentInelasticDesignControl.java deleted file mode 100644 index e9a9faf..0000000 --- a/org/drip/spline/params/SegmentInelasticDesignControl.java +++ /dev/null @@ -1,166 +0,0 @@ - -package org.drip.spline.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * SegmentInelasticDesignControl implements basis per-segment inelastic parameter set. It exports the - * following functionality: - * - Retrieve the Continuity Order. - * - Retrieve the Length Penalty and the Curvature Penalty Parameters. - * - Create the C2 Inelastic Design Parameters. - * - Create the Inelastic Design Parameters for the desired Ck Criterion and the Roughness Penalty Order. - * - * @author Lakshmi Krishnamurthy - */ - -public class SegmentInelasticDesignControl { - private int _iCk = -1; - private org.drip.spline.params.SegmentFlexurePenaltyControl _sfpcLength = null; - private org.drip.spline.params.SegmentFlexurePenaltyControl _sfpcCurvature = null; - - /** - * Create the C2 Inelastic Design Params - * - * @return SegmentInelasticDesignControl instance - */ - - public static final SegmentInelasticDesignControl MakeC2DesignInelasticControl() - { - try { - return new SegmentInelasticDesignControl (2, null, new - org.drip.spline.params.SegmentFlexurePenaltyControl (2, 1.)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create the Inelastic Design Parameters for the desired Ck Criterion and the Roughness Penalty Order - * - * @param iCk Continuity Order - * @param iCurvaturePenaltyDerivativeOrder Curvature Penalty Derivative Order - * - * @return SegmentInelasticDesignControl instance - */ - - public static final SegmentInelasticDesignControl Create ( - final int iCk, - final int iCurvaturePenaltyDerivativeOrder) - { - try { - return new SegmentInelasticDesignControl (iCk, null, new - org.drip.spline.params.SegmentFlexurePenaltyControl (iCurvaturePenaltyDerivativeOrder, 1.)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Constructor for the Segment Inelastic Design Parameters given the desired Ck, the Segment Length and - * the Roughness Penalty Order - * - * @param iCk Continuity Order - * @param sfpcLength Segment Length Penalty - * @param sfpcCurvature Segment Curvature Penalty - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public SegmentInelasticDesignControl ( - final int iCk, - final org.drip.spline.params.SegmentFlexurePenaltyControl sfpcLength, - final org.drip.spline.params.SegmentFlexurePenaltyControl sfpcCurvature) - throws java.lang.Exception - { - if (0 > (_iCk = iCk)) - throw new java.lang.Exception ("SegmentInelasticDesignControl ctr: Invalid Inputs"); - - _sfpcLength = sfpcLength; - _sfpcCurvature = sfpcCurvature; - } - - /** - * Retrieve the Continuity Order - * - * @return The Continuity Order - */ - - public int Ck() - { - return _iCk; - } - - /** - * Retrieve the Length Penalty Parameters - * - * @return The Length Penalty Parameters - */ - - public org.drip.spline.params.SegmentFlexurePenaltyControl lengthPenaltyControl() - { - return _sfpcLength; - } - - /** - * Retrieve the Curvature Penalty Parameters - * - * @return The Curvature Penalty Parameters - */ - - public org.drip.spline.params.SegmentFlexurePenaltyControl curvaturePenaltyControl() - { - return _sfpcCurvature; - } -} diff --git a/org/drip/spline/params/SegmentPredictorResponseDerivative.java b/org/drip/spline/params/SegmentPredictorResponseDerivative.java deleted file mode 100644 index 6919d5b..0000000 --- a/org/drip/spline/params/SegmentPredictorResponseDerivative.java +++ /dev/null @@ -1,170 +0,0 @@ - -package org.drip.spline.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * SegmentPredictorResponseDerivative contains the segment local parameters used for the segment calibration. It - * holds the edge Y value and the derivatives. - * - * It exposes the following functions: - * - Retrieve the Response Value as well as the DResponseDPredictorOrdinate Array. - * - Aggregate the 2 Predictor Ordinate Response Derivatives by applying the Cardinal Tension Weight. - * - * @author Lakshmi Krishnamurthy - */ - -public class SegmentPredictorResponseDerivative { - private double _dblResponseValue = java.lang.Double.NaN; - private double[] _adblDResponseDPredictorOrdinate = null; - - /** - * Aggregate the 2 Predictor Ordinate Response Derivatives by applying the Cardinal Tension Weight - * - * @param sprdA Predictor Ordinate Response Derivative A - * @param sprdB Predictor Ordinate Response Derivative B - * @param dblCardinalTension Cardinal Tension - * - * @return The Aggregated Predictor Ordinate Response Derivatives - */ - - public static final SegmentPredictorResponseDerivative CardinalEdgeAggregate ( - final org.drip.spline.params.SegmentPredictorResponseDerivative sprdA, - final org.drip.spline.params.SegmentPredictorResponseDerivative sprdB, - final double dblCardinalTension) - { - if (null == sprdA || null == sprdB || !org.drip.quant.common.NumberUtil.IsValid (dblCardinalTension)) - return null; - - int iNumDeriv = 0; - - double[] adblEdgeDResponseDPredictorOrdinateA = sprdA.getDResponseDPredictorOrdinate(); - - double[] adblEdgeDResponseDPredictorOrdinateB = sprdB.getDResponseDPredictorOrdinate(); - - if ((null != adblEdgeDResponseDPredictorOrdinateA && null == adblEdgeDResponseDPredictorOrdinateB) || - (null == adblEdgeDResponseDPredictorOrdinateA && null != adblEdgeDResponseDPredictorOrdinateB) || - (null != adblEdgeDResponseDPredictorOrdinateA && null != adblEdgeDResponseDPredictorOrdinateB - && (iNumDeriv = adblEdgeDResponseDPredictorOrdinateA.length) != - adblEdgeDResponseDPredictorOrdinateB.length)) - return null; - - double dblAggregatedEdgeResponseValue = 0.5 * (1. - dblCardinalTension) * (sprdA.responseValue() + - sprdB.responseValue()); - - if (null == adblEdgeDResponseDPredictorOrdinateA || null == adblEdgeDResponseDPredictorOrdinateB || 0 - == iNumDeriv) { - try { - return new SegmentPredictorResponseDerivative (dblAggregatedEdgeResponseValue, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - double[] adblEdgeDResponseDPredictorOrdinate = new double[iNumDeriv]; - - for (int i = 0; i < iNumDeriv; ++i) - adblEdgeDResponseDPredictorOrdinate[i] = 0.5 * (1. - dblCardinalTension) * - (adblEdgeDResponseDPredictorOrdinateA[i] + adblEdgeDResponseDPredictorOrdinateB[i]); - - try { - return new SegmentPredictorResponseDerivative (dblAggregatedEdgeResponseValue, - adblEdgeDResponseDPredictorOrdinate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * SegmentPredictorResponseDerivative constructor - * - * @param dblResponseValue Edge Response Value - * @param adblDResponseDPredictorOrdinate Array of ordered Edge Derivatives - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public SegmentPredictorResponseDerivative ( - final double dblResponseValue, - final double[] adblDResponseDPredictorOrdinate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblResponseValue = dblResponseValue)) - throw new java.lang.Exception ("SegmentPredictorResponseDerivative ctr: Invalid Inputs!"); - - _adblDResponseDPredictorOrdinate = adblDResponseDPredictorOrdinate; - } - - /** - * Retrieve the Response Value - * - * @return The Response Value - */ - - public double responseValue() - { - return _dblResponseValue; - } - - /** - * Retrieve the DResponseDPredictorOrdinate Array - * - * @return DResponseDPredictorOrdinate Array - */ - - public double[] getDResponseDPredictorOrdinate() - { - return _adblDResponseDPredictorOrdinate; - } -} diff --git a/org/drip/spline/params/SegmentResponseConstraintSet.java b/org/drip/spline/params/SegmentResponseConstraintSet.java deleted file mode 100644 index 7bdea7b..0000000 --- a/org/drip/spline/params/SegmentResponseConstraintSet.java +++ /dev/null @@ -1,128 +0,0 @@ - -package org.drip.spline.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * SegmentResponseConstraintSet holds the set of SegmentResponseValueConstraint (Base + One/more - * Sensitivities) for the given Segment. It exposes functions to add/retrieve the base RVC as well as - * additional RVC sensitivities. - * - * @author Lakshmi Krishnamurthy - */ - -public class SegmentResponseConstraintSet { - private org.drip.spline.params.SegmentResponseValueConstraint _srvcBase = null; - private org.drip.spline.params.SegmentResponseValueConstraint _srvcSensitivity = null; - - /** - * Empty SegmentResponseConstraintSet Constructor - */ - - public SegmentResponseConstraintSet() - { - } - - /** - * Add the Base Segment Response Value Constraint - * - * @param srvcBase The Base Segment Response Value Constraint - * - * @return TRUE - The Base Segment Response Value Constraint Successfully Set - */ - - public boolean addBase ( - final org.drip.spline.params.SegmentResponseValueConstraint srvcBase) - { - if (null == srvcBase) return false; - - _srvcBase = srvcBase; - return true; - } - - /** - * Add the Base Segment Response Value Constraint Sensitivity - * - * @param srvcSensitivity The Base Segment Response Value Constraint Sensitivity - * - * @return TRUE - The Base Segment Response Value Constraint Sensitivity Successfully Set - */ - - public boolean addSensitivity ( - final org.drip.spline.params.SegmentResponseValueConstraint srvcSensitivity) - { - if (null == srvcSensitivity) return false; - - _srvcSensitivity = srvcSensitivity; - return true; - } - - /** - * Retrieve the Base Segment Response Value Constraint - * - * @return The Base Segment Response Value Constraint - */ - - public org.drip.spline.params.SegmentResponseValueConstraint getBase() - { - return _srvcBase; - } - - /** - * Retrieve the Base Segment Response Value Constraint Sensitivity - * - * @return The Base Segment Response Value Constraint Sensitivity - */ - - public org.drip.spline.params.SegmentResponseValueConstraint getSensitivity() - { - return _srvcSensitivity; - } -} diff --git a/org/drip/spline/params/SegmentResponseValueConstraint.java b/org/drip/spline/params/SegmentResponseValueConstraint.java deleted file mode 100644 index 053c661..0000000 --- a/org/drip/spline/params/SegmentResponseValueConstraint.java +++ /dev/null @@ -1,268 +0,0 @@ - -package org.drip.spline.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * SegmentResponseValueConstraint holds the following set of fields that characterize a single global - * linear constraint between the predictor and the response variables within a single segment, expressed - * linearly across the constituent nodes. Constraints are expressed as - * - * C = Sigma_j [W_j * y_j] = V where - * - * x_j - Predictor j - * y_j - Response j - * W_j - Weight at ordinate j - * V - Value of the Constraint - * - * SegmentResponseValueConstraint exports the following functionality: - * - Retrieve the Array of Predictor Ordinates. - * - Retrieve the Array of Response Weights at each Predictor Ordinate. - * - Retrieve the Constraint Value. - * - Convert the Segment Constraint onto Local Predictor Ordinates, the corresponding Response Basis - * Function, and the Shape Controller Realizations. - * - Get the Position of the Predictor Knot relative to the Constraints. - * - Generate a SegmentResponseValueConstraint instance from the given predictor/response pair. - * - * SegmentResponseValueConstraint can be viewed as the global response point value transform of - * SegmentBasisFlexureConstraint. - * - * @author Lakshmi Krishnamurthy - */ - -public class SegmentResponseValueConstraint { - - /** - * Indicator specifying that the knot is to the left of the constraint ordinates - */ - - public static final int LEFT_OF_CONSTRAINT = 1; - - /** - * Indicator specifying that the knot is to the right of the constraint ordinates - */ - - public static final int RIGHT_OF_CONSTRAINT = 2; - - /** - * Indicator specifying that the knot splits the constraint ordinates - */ - - public static final int SPLITS_CONSTRAINT = 4; - - private double[] _adblPredictorOrdinate = null; - private double[] _adblResponseValueWeight = null; - private double _dblWeightedResponseValueConstraint = java.lang.Double.NaN; - - /** - * Generate a SegmentResponseValueConstraint instance from the given predictor/response pair. - * - * @param dblPredictorOrdinate The Predictor Ordinate - * @param dblResponseValue The Response Value - * - * @return The SegmentResponseValueConstraint instance - */ - - public static final SegmentResponseValueConstraint FromPredictorResponsePair ( - final double dblPredictorOrdinate, - final double dblResponseValue) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorOrdinate) || - !org.drip.quant.common.NumberUtil.IsValid (dblResponseValue)) - return null; - - try { - return new SegmentResponseValueConstraint (new double[] {dblPredictorOrdinate}, new double[] - {1.}, dblResponseValue); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * SegmentResponseValueConstraint constructor - * - * @param adblPredictorOrdinate The Array of Global Predictor Ordinates - * @param adblResponseValueWeight The Array of the Weights to be applied to the Response at each - * Predictor Ordinate - * @param dblWeightedResponseValueConstraint The Value of the Weighted Response Value Constraint - * - * @throws java.lang.Exception Throws if the Inputs are Invalid - */ - - public SegmentResponseValueConstraint ( - final double[] adblPredictorOrdinate, - final double[] adblResponseValueWeight, - final double dblWeightedResponseValueConstraint) - throws java.lang.Exception - { - if (null == (_adblPredictorOrdinate = adblPredictorOrdinate) || null == (_adblResponseValueWeight = - adblResponseValueWeight) || !org.drip.quant.common.NumberUtil.IsValid - (_dblWeightedResponseValueConstraint = dblWeightedResponseValueConstraint)) - throw new java.lang.Exception ("SegmentResponseValueConstraint ctr: Invalid Inputs"); - - int iNumPredictorOrdinate = adblPredictorOrdinate.length; - - if (0 == iNumPredictorOrdinate || _adblResponseValueWeight.length != iNumPredictorOrdinate) - throw new java.lang.Exception ("SegmentResponseValueConstraint ctr: Invalid Inputs"); - } - - /** - * Retrieve the Array of Predictor Ordinates - * - * @return The Array of Predictor Ordinates - */ - - public double[] predictorOrdinates() - { - return _adblPredictorOrdinate; - } - - /** - * Retrieve the Array of Response Weights at each Predictor Ordinate - * - * @return The Array of Response Weights at each Predictor Ordinate - */ - - public double[] responseWeights() - { - return _adblResponseValueWeight; - } - - /** - * Retrieve the Constraint Value - * - * @return The Constraint Value - */ - - public double constraintValue() - { - return _dblWeightedResponseValueConstraint; - } - - public void display ( - final java.lang.String strComment) - { - for (int i = 0; i < _adblPredictorOrdinate.length; ++i) - System.out.println ("\t\t" + strComment + " - " + new org.drip.analytics.date.JulianDate ((int) - _adblPredictorOrdinate[i]) + " => " + _adblResponseValueWeight[i]); - - System.out.println ("\tConstraint: " + _dblWeightedResponseValueConstraint); - } - - /** - * Convert the Segment Constraint onto Local Predictor Ordinates, the corresponding Response Basis - * Function, and the Shape Controller Realizations - * - * @param lbe The Local Basis Evaluator - * @param ics Inelastics transformer to convert coordinate space to Local from Global - * - * @return The Segment Basis Function Constraint - */ - - public org.drip.spline.params.SegmentBasisFlexureConstraint responseIndexedBasisConstraint ( - final org.drip.spline.segment.BasisEvaluator lbe, - final org.drip.spline.segment.LatentStateInelastic ics) - { - if (null == lbe || null == ics) return null; - - int iNumResponseBasis = lbe.numBasis(); - - int iNumPredictorOrdinate = _adblPredictorOrdinate.length; - double[] adblResponseBasisWeight = new double[iNumResponseBasis]; - - if (0 == iNumResponseBasis) return null; - - try { - for (int i = 0; i < iNumResponseBasis; ++i) { - adblResponseBasisWeight[i] = 0.; - - for (int j = 0; j < iNumPredictorOrdinate; ++j) - adblResponseBasisWeight[i] += _adblResponseValueWeight[j] * - lbe.shapedBasisFunctionResponse (_adblPredictorOrdinate[j], i); - } - - return new org.drip.spline.params.SegmentBasisFlexureConstraint (adblResponseBasisWeight, - _dblWeightedResponseValueConstraint); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Get the Position of the Predictor Knot relative to the Constraints - * - * @param dblPredictorKnot The Predictor Knot Ordinate - * - * @return Indicator specifying whether the Knot is Left of the constraints, Right of the Constraints, or - * splits the Constraints - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public int knotPosition ( - final double dblPredictorKnot) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorKnot)) - throw new java.lang.Exception ("SegmentResponseValueConstraint::knotPosition => Invalid Inputs"); - - if (dblPredictorKnot < _adblPredictorOrdinate[0]) return LEFT_OF_CONSTRAINT; - - if (dblPredictorKnot > _adblPredictorOrdinate[_adblPredictorOrdinate.length - 1]) - return RIGHT_OF_CONSTRAINT; - - return SPLITS_CONSTRAINT; - } -} diff --git a/org/drip/spline/params/SegmentStateCalibrationInputs.java b/org/drip/spline/params/SegmentStateCalibrationInputs.java deleted file mode 100644 index 56d6cee..0000000 --- a/org/drip/spline/params/SegmentStateCalibrationInputs.java +++ /dev/null @@ -1,180 +0,0 @@ - -package org.drip.spline.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * SegmentStateCalibrationInputs implements basis per-segment Calibration Parameter Input Set. It exposes the - * following functionality: - * - Retrieve the Array of the Calibration Predictor Ordinates. - * - Retrieve the Array of the Calibration Response Values. - * - Retrieve the Array of the Left/Right Edge Derivatives. - * - Retrieve the Segment Best Fit Response. - * - Retrieve the Array of Segment Basis Flexure Constraints. - * - * @author Lakshmi Krishnamurthy - */ - -public class SegmentStateCalibrationInputs { - private double[] _adblResponseValue = null; - private double[] _adblLeftEdgeDeriv = null; - private double[] _adblRightEdgeDeriv = null; - private double[] _adblPredictorOrdinate = null; - private org.drip.spline.params.SegmentBestFitResponse _sbfr = null; - private org.drip.spline.params.SegmentBasisFlexureConstraint[] _aSBFC = null; - - /** - * SegmentStateCalibrationInputs Constructor - * - * @param adblPredictorOrdinate Array of Predictor Ordinates - * @param adblResponseValue Array of Response Values - * @param adblLeftEdgeDeriv Array of the Left Edge Derivatives - * @param adblRightEdgeDeriv Array of the Right Edge Derivatives - * @param aSBFC Array of the Segment Basis Flexure Constraints - * @param sbfr Segment Basis Fit Response - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public SegmentStateCalibrationInputs ( - final double[] adblPredictorOrdinate, - final double[] adblResponseValue, - final double[] adblLeftEdgeDeriv, - final double[] adblRightEdgeDeriv, - final org.drip.spline.params.SegmentBasisFlexureConstraint[] aSBFC, - final org.drip.spline.params.SegmentBestFitResponse sbfr) - throws java.lang.Exception - { - _sbfr = sbfr; - int iNumSBFC = null == (_aSBFC = aSBFC) ? 0 : _aSBFC.length; - int iNumLeftEdgeDeriv = null == (_adblLeftEdgeDeriv = adblLeftEdgeDeriv) ? 0 : - _adblLeftEdgeDeriv.length; - int iNumResponseValue = null == (_adblResponseValue = adblResponseValue) ? 0 : - _adblResponseValue.length; - int iNumRightEdgeDeriv = null == (_adblRightEdgeDeriv = adblRightEdgeDeriv) ? 0 : - _adblRightEdgeDeriv.length; - int iNumPredictorOrdinate = null == (_adblPredictorOrdinate = adblPredictorOrdinate) ? 0 : - _adblPredictorOrdinate.length; - - if (null == _sbfr && null == _aSBFC && null == _adblPredictorOrdinate && null == _adblResponseValue - && null == _adblLeftEdgeDeriv && null == _adblRightEdgeDeriv) - throw new java.lang.Exception ("SegmentStateCalibrationInputs ctr: Invalid Inputs"); - - if (iNumPredictorOrdinate != iNumResponseValue || (null == _sbfr && 0 == iNumSBFC && 0 == - iNumPredictorOrdinate && 0 == iNumLeftEdgeDeriv && 0 == iNumRightEdgeDeriv)) - throw new java.lang.Exception ("SegmentStateCalibrationInputs ctr: Invalid Inputs"); - } - - /** - * Retrieve the Array of the Calibration Predictor Ordinates - * - * @return The Array of the Calibration Predictor Ordinates - */ - - public double[] predictorOrdinates() - { - return _adblPredictorOrdinate; - } - - /** - * Retrieve the Array of the Calibration Response Values - * - * @return The Array of the Calibration Response Values - */ - - public double[] responseValues() - { - return _adblResponseValue; - } - - /** - * Retrieve the Array of the Left Edge Derivatives - * - * @return The Array of the Left Edge Derivatives - */ - - public double[] leftEdgeDeriv() - { - return _adblLeftEdgeDeriv; - } - - /** - * Retrieve the Array of the Right Edge Derivatives - * - * @return The Array of the Right Edge Derivatives - */ - - public double[] rightEdgeDeriv() - { - return _adblRightEdgeDeriv; - } - - /** - * Retrieve the Segment Best Fit Response - * - * @return The Segment Best Fit Response - */ - - public org.drip.spline.params.SegmentBestFitResponse bestFitResponse() - { - return _sbfr; - } - - /** - * Retrieve the Array of Segment Basis Flexure Constraints - * - * @return The Array of Segment Basis Flexure Constraints - */ - - public org.drip.spline.params.SegmentBasisFlexureConstraint[] flexureConstraint() - { - return _aSBFC; - } -} diff --git a/org/drip/spline/params/StretchBestFitResponse.java b/org/drip/spline/params/StretchBestFitResponse.java deleted file mode 100644 index 507407c..0000000 --- a/org/drip/spline/params/StretchBestFitResponse.java +++ /dev/null @@ -1,346 +0,0 @@ - -package org.drip.spline.params; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * StretchBestFitResponse implements basis per-Stretch Fitness Penalty Parameter Set. Currently it contains - * the Best Fit Penalty Weight Grid Matrix and the corresponding Local Predictor Ordinate/Response Match - * Pair. - * - * StretchBestFitResponse exports the following methods: - * - Retrieve the Array of the Fitness Weights. - * - Retrieve the Indexed Fitness Weight Element. - * - Retrieve the Array of Predictor Ordinates. - * - Retrieve the Indexed Predictor Ordinate Element. - * - Retrieve the Array of Responses. - * - Retrieve the Indexed Response Element. - * - Retrieve the Number of Fitness Points. - * - Generate the Segment Local Best Fit Weighted Response contained within the specified Segment. - * - Construct the StretchBestFitResponse Instance from the given Inputs. - * - Construct the StretchBestFitResponse Instance from the given Predictor Ordinate/Response Pairs, using - * Uniform Weightings. - * - * @author Lakshmi Krishnamurthy - */ - -public class StretchBestFitResponse { - private double[] _adblWeight = null; - private double[] _adblResponse = null; - private double[] _adblPredictorOrdinate = null; - - /** - * Construct the StretchBestFitResponse Instance from the given Inputs - * - * @param adblPredictorOrdinate Array of Predictor Ordinates - * @param adblResponseValue Array of Response Values - * @param adblWeight Array of Weights - * - * @return Instance of StretchBestFitResponse - */ - - public static final StretchBestFitResponse Create ( - final double[] adblPredictorOrdinate, - final double[] adblResponseValue, - final double[] adblWeight) - { - StretchBestFitResponse frp = null; - - try { - frp = new StretchBestFitResponse (adblWeight, adblResponseValue, adblPredictorOrdinate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return frp.normalizeWeights() ? frp : null; - } - - /** - * Construct the StretchBestFitResponse Instance from the given Inputs - * - * @param aiPredictorOrdinate Array of Predictor Ordinates - * @param adblResponseValue Array of Response Values - * @param adblWeight Array of Weights - * - * @return Instance of StretchBestFitResponse - */ - - public static final StretchBestFitResponse Create ( - final int[] aiPredictorOrdinate, - final double[] adblResponseValue, - final double[] adblWeight) - { - if (null == aiPredictorOrdinate) return null; - - int iNumPredictorOrdinate = aiPredictorOrdinate.length; - double[] adblPredictorOrdinate = new double[iNumPredictorOrdinate]; - - if (0 == iNumPredictorOrdinate) return null; - - for (int i = 0; i < iNumPredictorOrdinate; ++i) - adblPredictorOrdinate[i] = aiPredictorOrdinate[i]; - - return Create (adblPredictorOrdinate, adblResponseValue, adblWeight); - } - - /** - * Construct the StretchBestFitResponse Instance from the given Predictor Ordinate/Response Pairs, using - * Uniform Weightings. - * - * @param adblPredictorOrdinate Array of Predictor Ordinates - * @param adblResponseValue Array of Response Values - * - * @return Instance of StretchBestFitResponse - */ - - public static final StretchBestFitResponse Create ( - final double[] adblPredictorOrdinate, - final double[] adblResponseValue) - { - if (!org.drip.quant.common.NumberUtil.IsValid (adblPredictorOrdinate)) return null; - - int iNumWeight = adblPredictorOrdinate.length; - double[] adblWeight = new double[iNumWeight]; - - for (int i = 0; i < iNumWeight; ++i) - adblWeight[i] = 1.; - - return Create (adblPredictorOrdinate, adblResponseValue, adblWeight); - } - - private StretchBestFitResponse ( - final double[] adblWeight, - final double[] adblResponse, - final double[] adblPredictorOrdinate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_adblWeight = adblWeight) || - !org.drip.quant.common.NumberUtil.IsValid (_adblResponse = adblResponse) || - !org.drip.quant.common.NumberUtil.IsValid (_adblPredictorOrdinate = adblPredictorOrdinate)) - throw new java.lang.Exception ("StretchBestFitResponse ctr: Invalid Inputs"); - - int iNumPointsToFit = _adblWeight.length; - - if (0 == iNumPointsToFit || _adblResponse.length != iNumPointsToFit || _adblPredictorOrdinate.length - != iNumPointsToFit) - throw new java.lang.Exception ("StretchBestFitResponse ctr: Invalid Inputs"); - } - - private boolean normalizeWeights() - { - double dblCumulativeWeight = 0.; - int iNumPointsToFit = _adblWeight.length; - - for (int i = 0; i < iNumPointsToFit; ++i) { - if (_adblWeight[i] < 0.) return false; - - dblCumulativeWeight += _adblWeight[i]; - } - - if (0. >= dblCumulativeWeight) return false; - - for (int i = 0; i < iNumPointsToFit; ++i) - _adblWeight[i] /= dblCumulativeWeight; - - return true; - } - - /** - * Retrieve the Array of the Fitness Weights - * - * @return The Array of the Fitness Weights - */ - - public double[] weight() - { - return _adblWeight; - } - - /** - * Retrieve the Indexed Fitness Weight Element - * - * @param iIndex The Element Index - * - * @return The Indexed Fitness Weight Element - * - * @throws java.lang.Exception Thrown if the Index is Invalid - */ - - public double weight ( - final int iIndex) - throws java.lang.Exception - { - if (iIndex >= numPoint()) - throw new java.lang.Exception ("StretchBestFitResponse::weight => Invalid Index"); - - return _adblWeight[iIndex]; - } - - /** - * Retrieve the Array of Predictor Ordinates - * - * @return The Array of Predictor Ordinates - */ - - public double[] predictorOrdinate() - { - return _adblPredictorOrdinate; - } - - /** - * Retrieve the Indexed Predictor Ordinate Element - * - * @param iIndex The Element Index - * - * @return The Indexed Predictor Ordinate Element - * - * @throws java.lang.Exception Thrown if the Index is Invalid - */ - - public double predictorOrdinate ( - final int iIndex) - throws java.lang.Exception - { - if (iIndex >= numPoint()) - throw new java.lang.Exception ("StretchBestFitResponse::predictorOrdinate => Invalid Index"); - - return _adblPredictorOrdinate[iIndex]; - } - - /** - * Retrieve the Array of Responses - * - * @return The Array of Responses - */ - - public double[] response() - { - return _adblResponse; - } - - /** - * Retrieve the Indexed Response Element - * - * @param iIndex The Element Index - * - * @return The Indexed Response Element - * - * @throws java.lang.Exception Thrown if the Index is Invalid - */ - - public double response ( - final int iIndex) - throws java.lang.Exception - { - if (iIndex >= numPoint()) - throw new java.lang.Exception ("StretchBestFitResponse::response => Invalid Index"); - - return _adblResponse[iIndex]; - } - - /** - * Retrieve the Number of Fitness Points - * - * @return The Number of Fitness Points - */ - - public int numPoint() - { - return null == _adblResponse ? 0 : _adblResponse.length; - } - - /** - * Generate the Segment Local Best Fit Weighted Response contained within the specified Segment - * - * @param ics The Inelastics Instance to be used for the Localization - * - * @return The Segment Local Best Fit Weighted Response - */ - - public SegmentBestFitResponse sizeToSegment ( - final org.drip.spline.segment.LatentStateInelastic ics) - { - if (null == ics) return null; - - int iNumPoint = numPoint(); - - java.util.List lsIndex = new java.util.ArrayList(); - - for (int i = 0; i < iNumPoint; ++i) { - try { - if (ics.in (_adblPredictorOrdinate[i])) lsIndex.add (i); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - int iNumLocalPoint = lsIndex.size(); - - if (0 == iNumLocalPoint) return null; - - int iIndex = 0; - double[] adblWeight = new double[iNumLocalPoint]; - double[] adblResponse = new double[iNumLocalPoint]; - double[] adblPredictor = new double[iNumLocalPoint]; - - for (int i : lsIndex) { - adblWeight[iIndex] = _adblWeight[i]; - adblResponse[iIndex] = _adblResponse[i]; - adblPredictor[iIndex++] = _adblPredictorOrdinate[i]; - } - - return org.drip.spline.params.SegmentBestFitResponse.Create (adblPredictor, adblResponse, - adblWeight); - } -} diff --git a/org/drip/spline/pchip/AkimaLocalC1Generator.java b/org/drip/spline/pchip/AkimaLocalC1Generator.java deleted file mode 100644 index 0831b56..0000000 --- a/org/drip/spline/pchip/AkimaLocalC1Generator.java +++ /dev/null @@ -1,198 +0,0 @@ - -package org.drip.spline.pchip; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * AkimaLocalC1Generator generates the local control C1 Slope using the Akima Cubic Algorithm: - * - * Akima (1970): A New Method of Interpolation and Smooth Curve Fitting based on Local Procedures, - * Journal of the Association for the Computing Machinery 17 (4), 589-602. - * - * @author Lakshmi Krishnamurthy - */ - -public class AkimaLocalC1Generator { - private double[] _adblResponseValue = null; - private double[] _adblPredictorOrdinate = null; - private double[] _adblExtendedResponseValue = null; - private double[] _adblExtendedPredictorOrdinate = null; - - /** - * Construct an Instance of AkimaLocalC1Generator from the Array of the supplied Predictor Ordinates - * and the Response Values - * - * @param adblPredictorOrdinate Array of the Predictor Ordinates - * @param adblResponseValue Array of the Response Values - * - * @return Instance of AkimaLocalC1Generator - */ - - public static final AkimaLocalC1Generator Create ( - final double[] adblPredictorOrdinate, - final double[] adblResponseValue) - { - AkimaLocalC1Generator alcr = null; - - try { - alcr = new AkimaLocalC1Generator (adblPredictorOrdinate, adblResponseValue); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return alcr.extendPredictorOrdinate() && alcr.extendResponseValue() ? alcr : null; - } - - private AkimaLocalC1Generator ( - final double[] adblPredictorOrdinate, - final double[] adblResponseValue) - throws java.lang.Exception - { - if (null == (_adblPredictorOrdinate = adblPredictorOrdinate) || null == (_adblResponseValue = - adblResponseValue)) - throw new java.lang.Exception ("AkimaLocalC1Generator ctr: Invalid Inputs"); - - int iNumPredictorOrdinate = _adblPredictorOrdinate.length; - - if (2 >= iNumPredictorOrdinate || iNumPredictorOrdinate != _adblResponseValue.length) - throw new java.lang.Exception ("AkimaLocalC1Generator ctr: Invalid Inputs"); - } - - private boolean extendPredictorOrdinate() - { - int iNumPredictorOrdinate = _adblPredictorOrdinate.length; - int iNumExtendedPredictorOrdinate = iNumPredictorOrdinate + 4; - _adblExtendedPredictorOrdinate = new double[iNumExtendedPredictorOrdinate]; - - for (int i = 0; i < iNumExtendedPredictorOrdinate; ++i) { - if (2 <= i && iNumExtendedPredictorOrdinate - 3 >= i) - _adblExtendedPredictorOrdinate[i] = _adblPredictorOrdinate[i - 2]; - } - - double dblSkippedLeftPredictorWidth = _adblPredictorOrdinate[2] - _adblPredictorOrdinate[0]; - _adblExtendedPredictorOrdinate[0] = _adblPredictorOrdinate[0] - dblSkippedLeftPredictorWidth; - _adblExtendedPredictorOrdinate[1] = _adblPredictorOrdinate[1] - dblSkippedLeftPredictorWidth; - double dblSkippedRightPredictorWidth = _adblPredictorOrdinate[iNumPredictorOrdinate - 1] - - _adblPredictorOrdinate[iNumPredictorOrdinate - 3]; - _adblExtendedPredictorOrdinate[iNumExtendedPredictorOrdinate - 2] = - _adblPredictorOrdinate[iNumPredictorOrdinate - 2] + dblSkippedRightPredictorWidth; - _adblExtendedPredictorOrdinate[iNumExtendedPredictorOrdinate - 1] = - _adblPredictorOrdinate[iNumPredictorOrdinate - 1] + dblSkippedRightPredictorWidth; - return true; - } - - private boolean setExtendedResponseValue ( - final int i, - final boolean bRight) - { - if (bRight) { - _adblExtendedResponseValue[i] = 2. * (_adblExtendedResponseValue[i - 1] - - _adblExtendedResponseValue[i - 2]) / (_adblExtendedPredictorOrdinate[i - 1] - - _adblExtendedPredictorOrdinate[i - 2]) - ((_adblExtendedResponseValue[i - 2] - - _adblExtendedResponseValue[i - 3]) / (_adblExtendedPredictorOrdinate[i - 2] - - _adblExtendedPredictorOrdinate[i - 3])); - _adblExtendedResponseValue[i] = _adblExtendedResponseValue[i] * (_adblExtendedResponseValue[i] - - _adblExtendedResponseValue[i - 1]) + _adblExtendedResponseValue[i - 1]; - } else { - _adblExtendedResponseValue[i] = 2. * (_adblExtendedResponseValue[i + 2] - - _adblExtendedResponseValue[i + 1]) / (_adblExtendedPredictorOrdinate[i + 2] - - _adblExtendedPredictorOrdinate[i + 1]) - ((_adblExtendedResponseValue[i + 3] - - _adblExtendedResponseValue[i + 2]) / (_adblExtendedPredictorOrdinate[i + 3] - - _adblExtendedPredictorOrdinate[i + 2])); - _adblExtendedResponseValue[i] = _adblExtendedResponseValue[i + 1] - _adblExtendedResponseValue[i] - * (_adblExtendedResponseValue[i + 1] - _adblExtendedResponseValue[i]); - } - - return true; - } - - private boolean extendResponseValue() - { - int iNumResponseValue = _adblResponseValue.length; - int iNumExtendedResponseValue = iNumResponseValue + 4; - _adblExtendedResponseValue = new double[iNumExtendedResponseValue]; - - for (int i = 0; i < iNumExtendedResponseValue; ++i) { - if (2 <= i && iNumExtendedResponseValue - 3 >= i) - _adblExtendedResponseValue[i] = _adblResponseValue[i - 2]; - } - - return setExtendedResponseValue (1, false) && setExtendedResponseValue (0, false) && - setExtendedResponseValue (iNumExtendedResponseValue - 2, true) && setExtendedResponseValue - (iNumExtendedResponseValue - 1, true) ? true : false; - } - - public double[] C1() - { - int iNumPredictorOrdinate = _adblPredictorOrdinate.length; - double[] adblC1 = new double[iNumPredictorOrdinate]; - double[] adblExtendedSlope = new double[iNumPredictorOrdinate + 3]; - - for (int i = 0; i < iNumPredictorOrdinate + 3; ++i) - adblExtendedSlope[i] = (_adblExtendedResponseValue[i + 1] - _adblExtendedResponseValue[i]) / - (_adblExtendedPredictorOrdinate[i + 1] - _adblExtendedPredictorOrdinate[i]); - - for (int i = 0; i < iNumPredictorOrdinate; ++i) { - double dblSlope10 = java.lang.Math.abs (adblExtendedSlope[i + 1] - adblExtendedSlope[i]); - - double dblSlope32 = java.lang.Math.abs (adblExtendedSlope[i + 3] - adblExtendedSlope[i + 2]); - - if (0. == dblSlope10 && 0. == dblSlope32) - adblC1[i] = 0.5 * (adblExtendedSlope[i + 1] + adblExtendedSlope[i + 2]); - else - adblC1[i] = (dblSlope32 * adblExtendedSlope[i + 1] + dblSlope10 * adblExtendedSlope[i + 2]) / - (dblSlope10 + dblSlope32); - } - - return adblC1; - } -} diff --git a/org/drip/spline/pchip/LocalControlStretchBuilder.java b/org/drip/spline/pchip/LocalControlStretchBuilder.java deleted file mode 100644 index 2364505..0000000 --- a/org/drip/spline/pchip/LocalControlStretchBuilder.java +++ /dev/null @@ -1,515 +0,0 @@ - -package org.drip.spline.pchip; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * LocalControlStretchBuilder exports Stretch creation/calibration methods to generate customized basis - * splines, with customized segment behavior using the segment control. It provides the following - * local-control functionality: - * - Create a Stretch off of Hermite Splines from the specified the Predictor Ordinates, the Response - * Values, the Custom Slopes, and the Segment Builder Parameters. - * - Create Hermite/Bessel C1 Cubic Spline Stretch. - * - Create Hyman (1983) Monotone Preserving Stretch. - * - Create Hyman (1989) enhancement to the Hyman (1983) Monotone Preserving Stretch. - * - Create the Harmonic Monotone Preserving Stretch. - * - Create the Van Leer Limiter Stretch. - * - Create the Huynh Le Floch Limiter Stretch. - * - Generate the local control C1 Slope using the Akima Cubic Algorithm. - * - Generate the local control C1 Slope using the Hagan-West Monotone Convex Algorithm. - * - * @author Lakshmi Krishnamurthy - */ - -public class LocalControlStretchBuilder { - - /** - * Create a Stretch off of Hermite Splines from the specified the Predictor Ordinates, the Response - * Values, the Custom Slopes, and the Segment Builder Parameters. - * - * @param strName Stretch Name - * @param adblPredictorOrdinate Array of Predictor Ordinates - * @param adblResponseValue Array of Response Values - * @param adblCustomSlope Array of Custom Slopes - * @param aSCBC Array of Segment Builder Parameters - * @param sbfr Stretch Fitness Weighted Response - * @param iSetupMode Calibration Set up Mode NATURAL | FINANCIAL | FLOATING | NOTAKNOT - * - * @return The Instance of the Hermite Spline Stretch - */ - - public static final org.drip.spline.stretch.MultiSegmentSequence CustomSlopeHermiteSpline ( - final java.lang.String strName, - final double[] adblPredictorOrdinate, - final double[] adblResponseValue, - final double[] adblCustomSlope, - final org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final int iSetupMode) - { - org.drip.spline.stretch.MultiSegmentSequence msr = - org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateUncalibratedStretchEstimator (strName, - adblPredictorOrdinate, aSCBC); - - if (null == msr || null == adblResponseValue || null == adblCustomSlope) return null; - - int iNumResponseValue = adblResponseValue.length; - org.drip.spline.params.SegmentPredictorResponseDerivative[] aSPRDLeft = new - org.drip.spline.params.SegmentPredictorResponseDerivative[iNumResponseValue - 1]; - org.drip.spline.params.SegmentPredictorResponseDerivative[] aSPRDRight = new - org.drip.spline.params.SegmentPredictorResponseDerivative[iNumResponseValue - 1]; - - if (1 >= iNumResponseValue || adblPredictorOrdinate.length != iNumResponseValue || - adblCustomSlope.length != iNumResponseValue) - return null; - - for (int i = 0; i < iNumResponseValue; ++i) { - org.drip.spline.params.SegmentPredictorResponseDerivative sprd = null; - - try { - sprd = new org.drip.spline.params.SegmentPredictorResponseDerivative (adblResponseValue[i], - new double[] {adblCustomSlope[i]}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (0 == i) - aSPRDLeft[i] = sprd; - else if (iNumResponseValue - 1 == i) - aSPRDRight[i - 1] = sprd; - else { - aSPRDLeft[i] = sprd; - aSPRDRight[i - 1] = sprd; - } - } - - return msr.setupHermite (aSPRDLeft, aSPRDRight, null, sbfr, iSetupMode) ? msr : null; - } - - /** - * Create a Stretch off of Hermite Splines from the specified the Predictor Ordinates, the Response - * Values, the Custom Slopes, and the Segment Builder Parameters. - * - * @param strName Stretch Name - * @param aiPredictorOrdinate Array of Predictor Ordinates - * @param adblResponseValue Array of Response Values - * @param adblCustomSlope Array of Custom Slopes - * @param aSCBC Array of Segment Builder Parameters - * @param sbfr Stretch Fitness Weighted Response - * @param iSetupMode Calibration Set up Mode NATURAL | FINANCIAL | FLOATING | NOTAKNOT - * - * @return The Instance of the Hermite Spline Stretch - */ - - public static final org.drip.spline.stretch.MultiSegmentSequence CustomSlopeHermiteSpline ( - final java.lang.String strName, - final int[] aiPredictorOrdinate, - final double[] adblResponseValue, - final double[] adblCustomSlope, - final org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final int iSetupMode) - { - if (null == aiPredictorOrdinate) return null; - - int iNumPredictorOrdinate = aiPredictorOrdinate.length; - double[] adblPredictorOrdinate = new double[iNumPredictorOrdinate]; - - if (0 == iNumPredictorOrdinate) return null; - - for (int i = 0; i < iNumPredictorOrdinate; ++i) - adblPredictorOrdinate[i] = aiPredictorOrdinate[i]; - - return CustomSlopeHermiteSpline (strName, adblPredictorOrdinate, adblResponseValue, adblCustomSlope, - aSCBC, sbfr, iSetupMode); - } - - /** - * Create Hermite/Bessel C1 Cubic Spline Stretch - * - * @param strName Stretch Name - * @param adblPredictorOrdinate Array of Predictor Ordinates - * @param adblResponseValue Array of Response Values - * @param aSCBC Array of Segment Builder Parameters - * @param sbfr Stretch Fitness Weighted Response - * @param iSetupMode Segment Setup Mode - * @param bEliminateSpuriousExtrema TRUE - Eliminate Spurious Extrema - * @param bApplyMonotoneFilter TRUE - Apply Monotone Filter - * - * @return Hermite/Bessel C1 Cubic Spline Stretch - */ - - public static final org.drip.spline.stretch.MultiSegmentSequence CreateBesselCubicSplineStretch ( - final java.lang.String strName, - final double[] adblPredictorOrdinate, - final double[] adblResponseValue, - final org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final int iSetupMode, - final boolean bEliminateSpuriousExtrema, - final boolean bApplyMonotoneFilter) - { - org.drip.spline.pchip.LocalMonotoneCkGenerator lmcg = - org.drip.spline.pchip.LocalMonotoneCkGenerator.Create (adblPredictorOrdinate, adblResponseValue, - org.drip.spline.pchip.LocalMonotoneCkGenerator.C1_BESSEL, bEliminateSpuriousExtrema, - bApplyMonotoneFilter); - - return null == lmcg ? null : CustomSlopeHermiteSpline (strName, adblPredictorOrdinate, - adblResponseValue, lmcg.C1(), aSCBC, sbfr, iSetupMode); - } - - /** - * Create Hyman (1983) Monotone Preserving Stretch. The reference is: - * - * Hyman (1983) Accurate Monotonicity Preserving Cubic Interpolation - - * SIAM J on Numerical Analysis 4 (4), 645-654. - * - * @param strName Stretch Name - * @param adblPredictorOrdinate Array of Predictor Ordinates - * @param adblResponseValue Array of Response Values - * @param aSCBC Array of Segment Builder Parameters - * @param sbfr Stretch Fitness Weighted Response - * @param iSetupMode Segment Setup Mode - * @param bEliminateSpuriousExtrema TRUE - Eliminate Spurious Extrema - * @param bApplyMonotoneFilter TRUE - Apply Monotone Filter - * - * @return Hyman (1983) Monotone Preserving Stretch - */ - - public static final org.drip.spline.stretch.MultiSegmentSequence CreateHyman83MonotoneStretch ( - final java.lang.String strName, - final double[] adblPredictorOrdinate, - final double[] adblResponseValue, - final org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final int iSetupMode, - final boolean bEliminateSpuriousExtrema, - final boolean bApplyMonotoneFilter) - { - org.drip.spline.pchip.LocalMonotoneCkGenerator lmcg = - org.drip.spline.pchip.LocalMonotoneCkGenerator.Create (adblPredictorOrdinate, adblResponseValue, - org.drip.spline.pchip.LocalMonotoneCkGenerator.C1_HYMAN83, bEliminateSpuriousExtrema, - bApplyMonotoneFilter); - - return null == lmcg ? null : CustomSlopeHermiteSpline (strName, adblPredictorOrdinate, - adblResponseValue, lmcg.C1(), aSCBC, sbfr, iSetupMode); - } - - /** - * Create Hyman (1989) enhancement to the Hyman (1983) Monotone Preserving Stretch. The reference is: - * - * Doherty, Edelman, and Hyman (1989) Non-negative, monotonic, or convexity preserving cubic and quintic - * Hermite interpolation - Mathematics of Computation 52 (186), 471-494. - * - * @param strName Stretch Name - * @param adblPredictorOrdinate Array of Predictor Ordinates - * @param adblResponseValue Array of Response Values - * @param aSCBC Array of Segment Builder Parameters - * @param sbfr Stretch Fitness Weighted Response - * @param iSetupMode Segment Setup Mode - * @param bEliminateSpuriousExtrema TRUE - Eliminate Spurious Extrema - * @param bApplyMonotoneFilter TRUE - Apply Monotone Filter - * - * @return Hyman (1989) Monotone Preserving Stretch - */ - - public static final org.drip.spline.stretch.MultiSegmentSequence CreateHyman89MonotoneStretch ( - final java.lang.String strName, - final double[] adblPredictorOrdinate, - final double[] adblResponseValue, - final org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final int iSetupMode, - final boolean bEliminateSpuriousExtrema, - final boolean bApplyMonotoneFilter) - { - org.drip.spline.pchip.LocalMonotoneCkGenerator lmcg = - org.drip.spline.pchip.LocalMonotoneCkGenerator.Create (adblPredictorOrdinate, adblResponseValue, - org.drip.spline.pchip.LocalMonotoneCkGenerator.C1_HYMAN89, bEliminateSpuriousExtrema, - bApplyMonotoneFilter); - - return null == lmcg ? null : CustomSlopeHermiteSpline (strName, adblPredictorOrdinate, - adblResponseValue, lmcg.C1(), aSCBC, sbfr, iSetupMode); - } - - /** - * Create the Harmonic Monotone Preserving Stretch. The reference is: - * - * Fritcsh and Butland (1984) A Method for constructing local monotonic piece-wise cubic interpolants - - * SIAM J on Scientific and Statistical Computing 5, 300-304. - * - * @param strName Stretch Name - * @param adblPredictorOrdinate Array of Predictor Ordinates - * @param adblResponseValue Array of Response Values - * @param aSCBC Array of Segment Builder Parameters - * @param sbfr Stretch Fitness Weighted Response - * @param iSetupMode Segment Setup Mode - * @param bEliminateSpuriousExtrema TRUE - Eliminate Spurious Extrema - * @param bApplyMonotoneFilter TRUE - Apply Monotone Filter - * - * @return Harmonic Monotone Preserving Stretch - */ - - public static final org.drip.spline.stretch.MultiSegmentSequence CreateHarmonicMonotoneStretch ( - final java.lang.String strName, - final double[] adblPredictorOrdinate, - final double[] adblResponseValue, - final org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final int iSetupMode, - final boolean bEliminateSpuriousExtrema, - final boolean bApplyMonotoneFilter) - { - org.drip.spline.pchip.LocalMonotoneCkGenerator lmcg = - org.drip.spline.pchip.LocalMonotoneCkGenerator.Create (adblPredictorOrdinate, adblResponseValue, - org.drip.spline.pchip.LocalMonotoneCkGenerator.C1_HARMONIC, bEliminateSpuriousExtrema, - bApplyMonotoneFilter); - - return null == lmcg ? null : CustomSlopeHermiteSpline (strName, adblPredictorOrdinate, - adblResponseValue, lmcg.C1(), aSCBC, sbfr, iSetupMode); - } - - /** - * Create the Van Leer Limiter Stretch. The reference is: - * - * Van Leer (1974) Towards the Ultimate Conservative Difference Scheme. II - Monotonicity and - * Conservation combined in a Second-Order Scheme, Journal of Computational Physics 14 (4), 361-370. - * - * @param strName Stretch Name - * @param adblPredictorOrdinate Array of Predictor Ordinates - * @param adblResponseValue Array of Response Values - * @param aSCBC Array of Segment Builder Parameters - * @param sbfr Stretch Fitness Weighted Response - * @param iSetupMode Segment Setup Mode - * @param bEliminateSpuriousExtrema TRUE - Eliminate Spurious Extrema - * @param bApplyMonotoneFilter TRUE - Apply Monotone Filter - * - * @return The Van Leer Limiter Stretch - */ - - public static final org.drip.spline.stretch.MultiSegmentSequence CreateVanLeerLimiterStretch ( - final java.lang.String strName, - final double[] adblPredictorOrdinate, - final double[] adblResponseValue, - final org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final int iSetupMode, - final boolean bEliminateSpuriousExtrema, - final boolean bApplyMonotoneFilter) - { - org.drip.spline.pchip.LocalMonotoneCkGenerator lmcg = - org.drip.spline.pchip.LocalMonotoneCkGenerator.Create (adblPredictorOrdinate, adblResponseValue, - org.drip.spline.pchip.LocalMonotoneCkGenerator.C1_VAN_LEER, bEliminateSpuriousExtrema, - bApplyMonotoneFilter); - - return null == lmcg ? null : CustomSlopeHermiteSpline (strName, adblPredictorOrdinate, - adblResponseValue, lmcg.C1(), aSCBC, sbfr, iSetupMode); - } - - /** - * Create the Kruger Stretch. The reference is: - * - * Kruger (2002) Constrained Cubic Spline Interpolations for Chemical Engineering Application, - * http://www.korf.co.uk/spline.pdf - * - * @param strName Stretch Name - * @param adblPredictorOrdinate Array of Predictor Ordinates - * @param adblResponseValue Array of Response Values - * @param aSCBC Array of Segment Builder Parameters - * @param sbfr Stretch Fitness Weighted Response - * @param iSetupMode Segment Setup Mode - * @param bEliminateSpuriousExtrema TRUE - Eliminate Spurious Extrema - * @param bApplyMonotoneFilter TRUE - Apply Monotone Filter - * - * @return The Kruger Stretch - */ - - public static final org.drip.spline.stretch.MultiSegmentSequence CreateKrugerStretch ( - final java.lang.String strName, - final double[] adblPredictorOrdinate, - final double[] adblResponseValue, - final org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final int iSetupMode, - final boolean bEliminateSpuriousExtrema, - final boolean bApplyMonotoneFilter) - { - org.drip.spline.pchip.LocalMonotoneCkGenerator lmcg = - org.drip.spline.pchip.LocalMonotoneCkGenerator.Create (adblPredictorOrdinate, adblResponseValue, - org.drip.spline.pchip.LocalMonotoneCkGenerator.C1_KRUGER, bEliminateSpuriousExtrema, - bApplyMonotoneFilter); - - return null == lmcg ? null : CustomSlopeHermiteSpline (strName, adblPredictorOrdinate, - adblResponseValue, lmcg.C1(), aSCBC, sbfr, iSetupMode); - } - - /** - * Create the Huynh Le Floch Limiter Stretch. The reference is: - * - * Huynh (1993) Accurate Monotone Cubic Interpolation, SIAM J on Numerical Analysis 30 (1), 57-100. - * - * @param strName Stretch Name - * @param adblPredictorOrdinate Array of Predictor Ordinates - * @param adblResponseValue Array of Response Values - * @param aSCBC Array of Segment Builder Parameters - * @param sbfr Stretch Fitness Weighted Response - * @param iSetupMode Segment Setup Mode - * @param bEliminateSpuriousExtrema TRUE - Eliminate Spurious Extrema - * @param bApplyMonotoneFilter TRUE - Apply Monotone Filter - * - * @return The Huynh Le Floch Limiter Stretch - */ - - public static final org.drip.spline.stretch.MultiSegmentSequence CreateHuynhLeFlochLimiterStretch ( - final java.lang.String strName, - final double[] adblPredictorOrdinate, - final double[] adblResponseValue, - final org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final int iSetupMode, - final boolean bEliminateSpuriousExtrema, - final boolean bApplyMonotoneFilter) - { - org.drip.spline.pchip.LocalMonotoneCkGenerator lmcg = - org.drip.spline.pchip.LocalMonotoneCkGenerator.Create (adblPredictorOrdinate, adblResponseValue, - org.drip.spline.pchip.LocalMonotoneCkGenerator.C1_KRUGER, bEliminateSpuriousExtrema, - bApplyMonotoneFilter); - - return null == lmcg ? null : CustomSlopeHermiteSpline (strName, adblPredictorOrdinate, - adblResponseValue, lmcg.C1(), aSCBC, sbfr, iSetupMode); - } - - /** - * Generate the local control C1 Slope using the Akima Cubic Algorithm. The reference is: - * - * Akima (1970): A New Method of Interpolation and Smooth Curve Fitting based on Local Procedures, - * Journal of the Association for the Computing Machinery 17 (4), 589-602. - * - * @param strName Stretch Name - * @param adblPredictorOrdinate Array of Predictor Ordinates - * @param adblResponseValue Array of Response Values - * @param aSCBC Array of Segment Builder Parameters - * @param sbfr Stretch Fitness Weighted Response - * @param iSetupMode Segment Setup Mode - * @param bEliminateSpuriousExtrema TRUE - Eliminate Spurious Extrema - * @param bApplyMonotoneFilter TRUE - Apply Monotone Filter - * - * @return The Akima Local Control Stretch Instance - */ - - public static final org.drip.spline.stretch.MultiSegmentSequence CreateAkimaStretch ( - final java.lang.String strName, - final double[] adblPredictorOrdinate, - final double[] adblResponseValue, - final org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final int iSetupMode, - final boolean bEliminateSpuriousExtrema, - final boolean bApplyMonotoneFilter) - { - org.drip.spline.pchip.LocalMonotoneCkGenerator lmcg = - org.drip.spline.pchip.LocalMonotoneCkGenerator.Create (adblPredictorOrdinate, adblResponseValue, - org.drip.spline.pchip.LocalMonotoneCkGenerator.C1_AKIMA, bEliminateSpuriousExtrema, - bApplyMonotoneFilter); - - return null == lmcg ? null : CustomSlopeHermiteSpline (strName, adblPredictorOrdinate, - adblResponseValue, lmcg.C1(), aSCBC, sbfr, iSetupMode); - } - - /** - * Generate the local control C1 Slope using the Hagan-West Monotone Convex Algorithm. The references - * are: - * - * Hagan, P., and G. West (2006): Interpolation Methods for Curve Construction, Applied Mathematical - * Finance 13 (2): 89-129. - * - * Hagan, P., and G. West (2008): Methods for Curve a Yield Curve, Wilmott Magazine: 70-81. - * - * @param strName Stretch Name - * @param adblPredictorOrdinate Array of Predictor Ordinates - * @param adblObservation Array of Observations - * @param aSCBC Array of Segment Builder Parameters - * @param sbfr Stretch Fitness Weighted Response - * @param iSetupMode Segment Setup Mode - * @param bLinearNodeInference Apply Linear Node Inference from Observations - * @param bEliminateSpuriousExtrema TRUE - Eliminate Spurious Extrema - * @param bApplyMonotoneFilter TRUE - Apply Monotone Filter - * - * @return The Monotone-Convex Local Control Stretch Instance - */ - - public static final org.drip.spline.stretch.MultiSegmentSequence CreateMonotoneConvexStretch ( - final java.lang.String strName, - final double[] adblPredictorOrdinate, - final double[] adblObservation, - final org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final int iSetupMode, - final boolean bLinearNodeInference, - final boolean bEliminateSpuriousExtrema, - final boolean bApplyMonotoneFilter) - { - org.drip.spline.pchip.MonotoneConvexHaganWest mchw = - org.drip.spline.pchip.MonotoneConvexHaganWest.Create (adblPredictorOrdinate, adblObservation, - bLinearNodeInference); - - if (null == mchw) return null; - - org.drip.spline.pchip.LocalMonotoneCkGenerator lmcg = - org.drip.spline.pchip.LocalMonotoneCkGenerator.Create (mchw.predictorOrdinates(), - mchw.responseValues(), org.drip.spline.pchip.LocalMonotoneCkGenerator.C1_MONOTONE_CONVEX, - bEliminateSpuriousExtrema, bApplyMonotoneFilter); - - return null == lmcg ? null : CustomSlopeHermiteSpline (strName, mchw.predictorOrdinates(), - mchw.responseValues(), lmcg.C1(), aSCBC, sbfr, iSetupMode); - } -} diff --git a/org/drip/spline/pchip/LocalMonotoneCkGenerator.java b/org/drip/spline/pchip/LocalMonotoneCkGenerator.java deleted file mode 100644 index 69e9c86..0000000 --- a/org/drip/spline/pchip/LocalMonotoneCkGenerator.java +++ /dev/null @@ -1,900 +0,0 @@ - -package org.drip.spline.pchip; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * LocalMonotoneCkGenerator generates customized Local Stretch by trading off Ck for local control. This - * class implements the following variants: Akima, Bessel, Harmonic, Hyman83, Hyman89, Kruger, Monotone - * Convex, as well as the Van Leer and the Huynh/LeFloch limiters. - * - * It also provides the following custom control on the resulting C1: - * - Eliminate the Spurious Extrema in the Input C1 Entry. - * - Apply the Monotone Filter in the Input C1 Entry. - * - Generate a Vanilla C1 Array from the specified Array of Predictor Ordinates and the Response Values. - * - Verify if the given Quintic Polynomial is Monotone using the Hyman89 Algorithm, and generate it if - * necessary. - * - * @author Lakshmi Krishnamurthy - */ - -public class LocalMonotoneCkGenerator { - - /** - * C1 Type: Vanilla - */ - - public static final java.lang.String C1_VANILLA = "C1_VANILLA"; - - /** - * C1 Type: Akima - */ - - public static final java.lang.String C1_AKIMA = "C1_AKIMA"; - - /** - * C1 Type: Bessel - */ - - public static final java.lang.String C1_BESSEL = "C1_BESSEL"; - - /** - * C1 Type: Harmonic - */ - - public static final java.lang.String C1_HARMONIC = "C1_HARMONIC"; - - /** - * C1 Type: Huynh - Le Floch Limiter - */ - - public static final java.lang.String C1_HUYNH_LE_FLOCH = "C1_HUYNH_LE_FLOCH"; - - /** - * C1 Type: Hyman83 - */ - - public static final java.lang.String C1_HYMAN83 = "C1_HYMAN83"; - - /** - * C1 Type: Hyman89 - */ - - public static final java.lang.String C1_HYMAN89 = "C1_HYMAN89"; - - /** - * C1 Type: Kruger - */ - - public static final java.lang.String C1_KRUGER = "C1_KRUGER"; - - /** - * C1 Type: Monotone Convex - */ - - public static final java.lang.String C1_MONOTONE_CONVEX = "C1_MONOTONE_CONVEX"; - - /** - * C1 Type: Van Leer Limiter - */ - - public static final java.lang.String C1_VAN_LEER = "C1_VAN_LEER"; - - private double[] _adblC1 = null; - private double[] _adblResponseValue = null; - private double[] _adblPredictorOrdinate = null; - - /** - * Eliminate the Spurious Extrema in the Input C1 Entry - * - * @param adblC1 The C1 Array in which the Spurious Extrema is to be eliminated - * @param adblLinearC1 Array of the Linear C1 Entries - * - * @return The C1 Array with the Spurious Extrema eliminated - */ - - public static final double[] EliminateSpuriousExtrema ( - final double[] adblC1, - final double[] adblLinearC1) - { - if (null == adblC1 || null == adblLinearC1) return null; - - int iNumEntries = adblC1.length; - double[] adblUpdatedC1 = new double[iNumEntries]; - adblUpdatedC1[0] = adblC1[0]; - adblUpdatedC1[iNumEntries - 1] = adblC1[iNumEntries - 1]; - - if (1 >= iNumEntries || iNumEntries != adblLinearC1.length + 1) return null; - - for (int i = 1; i < iNumEntries - 1; ++i) - adblUpdatedC1[i] = 0. < adblLinearC1[i] ? java.lang.Math.min (java.lang.Math.max (0., adblC1[i]), - java.lang.Math.min (adblLinearC1[i], adblLinearC1[i - 1])) : java.lang.Math.max - (java.lang.Math.min (0., adblC1[i]), java.lang.Math.max (adblLinearC1[i], - adblLinearC1[i - 1])); - - return adblUpdatedC1; - } - - /** - * Apply the Monotone Filter in the Input C1 Entry - * - * @param adblC1 The C1 Array in which the Monotone Filter is to be applied - * @param adblLinearC1 Array of the Linear C1 Entries - * - * @return The C1 Array with the Monotone Filter applied - */ - - public static final double[] ApplyMonotoneFilter ( - final double[] adblC1, - final double[] adblLinearC1) - { - if (null == adblC1 || null == adblLinearC1) return null; - - int iNumEntries = adblC1.length; - double[] adblUpdatedC1 = new double[iNumEntries]; - adblUpdatedC1[0] = adblC1[0]; - - if (1 >= iNumEntries || iNumEntries != adblLinearC1.length + 1) return null; - - for (int i = 0; i < iNumEntries; ++i) { - if (0 == i) { - if (adblC1[0] * adblLinearC1[0] > 0. && adblLinearC1[0] * adblLinearC1[1] > 0. && - java.lang.Math.abs (adblC1[0]) < 3. * java.lang.Math.abs (adblLinearC1[0])) - adblUpdatedC1[0] = 3. * adblLinearC1[0]; - else if (adblC1[0] * adblLinearC1[0] <= 0.) - adblUpdatedC1[0] = 0.; - } else if (iNumEntries == i) { - if (adblC1[i] * adblLinearC1[i - 1] > 0. && adblLinearC1[i - 1] * adblLinearC1[i - 2] > 0. && - java.lang.Math.abs (adblC1[i]) < 3. * java.lang.Math.abs (adblLinearC1[i - 1])) - adblUpdatedC1[i] = 3. * adblLinearC1[i - 1]; - else if (adblC1[i] * adblLinearC1[i - 1] <= 0.) - adblUpdatedC1[i] = 0.; - } else - adblUpdatedC1[i] = adblC1[i]; - } - - return adblUpdatedC1; - } - - /** - * Generate a Vanilla C1 Array from the specified Array of Predictor Ordinates and the Response Values - * - * @param adblPredictorOrdinate The Predictor Ordinate Array - * @param adblResponseValue The Response Value Array - * - * @return The C1 Array - */ - - public static final double[] LinearC1 ( - final double[] adblPredictorOrdinate, - final double[] adblResponseValue) - { - int iNumSegment = adblResponseValue.length - 1; - double[] adblLinearC1 = new double[iNumSegment]; - - for (int i = 0; i < iNumSegment; ++i) - adblLinearC1[i] = (adblResponseValue[i + 1] - adblResponseValue[i]) / - (adblPredictorOrdinate[i + 1] - adblPredictorOrdinate[i]); - - return adblLinearC1; - } - - /** - * Generate a Bessel C1 Array from the specified Array of Predictor Ordinates and the Response Values - * - * @param adblPredictorOrdinate The Predictor Ordinate Array - * @param adblResponseValue The Response Value Array - * - * @return The C1 Array - */ - - public static final double[] BesselC1 ( - final double[] adblPredictorOrdinate, - final double[] adblResponseValue) - { - int iNumResponse = adblResponseValue.length; - double[] adblBesselC1 = new double[iNumResponse]; - - for (int i = 0; i < iNumResponse; ++i) { - if (0 == i) { - adblBesselC1[i] = (adblPredictorOrdinate[2] + adblPredictorOrdinate[1] - 2. * - adblPredictorOrdinate[0]) * (adblResponseValue[1] - adblResponseValue[0]) / - (adblPredictorOrdinate[1] - adblPredictorOrdinate[0]); - adblBesselC1[i] -= (adblPredictorOrdinate[1] - adblPredictorOrdinate[0]) * - (adblResponseValue[2] - adblResponseValue[1]) / (adblPredictorOrdinate[2] - - adblPredictorOrdinate[1]); - adblBesselC1[i] /= (adblPredictorOrdinate[2] - adblPredictorOrdinate[0]); - } else if (iNumResponse - 1 == i) { - adblBesselC1[i] = (adblPredictorOrdinate[iNumResponse - 1] - - adblPredictorOrdinate[iNumResponse - 2]) * (adblResponseValue[iNumResponse - 2] - - adblResponseValue[iNumResponse - 3]) / (adblPredictorOrdinate[iNumResponse - 2] - - adblPredictorOrdinate[iNumResponse - 3]); - adblBesselC1[i] -= (2. * adblPredictorOrdinate[iNumResponse - 1] - - adblPredictorOrdinate[iNumResponse - 2] - adblPredictorOrdinate[iNumResponse - 3]) * - (adblResponseValue[iNumResponse - 1] - adblResponseValue[iNumResponse - 2]) / - (adblPredictorOrdinate[iNumResponse - 1] - - adblPredictorOrdinate[iNumResponse - 2]); - adblBesselC1[i] /= (adblPredictorOrdinate[iNumResponse - 1] - - adblPredictorOrdinate[iNumResponse - 3]); - } else { - adblBesselC1[i] = (adblPredictorOrdinate[i + 1] - adblPredictorOrdinate[i]) * - (adblResponseValue[i] - adblResponseValue[i - 1]) / (adblPredictorOrdinate[i] - - adblPredictorOrdinate[i - 1]); - adblBesselC1[i] += (adblPredictorOrdinate[i] - adblPredictorOrdinate[i - 1]) * - (adblResponseValue[i + 1] - adblResponseValue[i]) / (adblPredictorOrdinate[i + 1] - - adblPredictorOrdinate[i]); - adblBesselC1[i] /= (adblPredictorOrdinate[iNumResponse - 1] - - adblPredictorOrdinate[iNumResponse - 3]); - } - } - - return adblBesselC1; - } - - /** - * Generate a Hyman83 C1 Array from the specified Array of Predictor Ordinates and the Response Values - * - * Hyman (1983) Accurate Monotonicity Preserving Cubic Interpolation - - * SIAM J on Numerical Analysis 4 (4), 645-654. - * - * @param adblPredictorOrdinate The Predictor Ordinate Array - * @param adblResponseValue The Response Value Array - * - * @return The C1 Array - */ - - public static final double[] Hyman83C1 ( - final double[] adblPredictorOrdinate, - final double[] adblResponseValue) - { - int iNumResponse = adblResponseValue.length; - double dblLinearSlopePrev = java.lang.Double.NaN; - double[] adblHyman83C1 = new double[iNumResponse]; - - for (int i = 0; i < iNumResponse; ++i) { - adblHyman83C1[i] = 0.; - double dblLinearSlope = iNumResponse - 1 != i ? (adblResponseValue[i + 1] - adblResponseValue[i]) - / (adblPredictorOrdinate[i + 1] - adblPredictorOrdinate[i]) : java.lang.Double.NaN; - - if (0 != i && iNumResponse - 1 != i) { - double dblMonotoneIndicator = dblLinearSlopePrev * dblLinearSlope; - - if (0. <= dblMonotoneIndicator) - adblHyman83C1[i] = 3. * dblMonotoneIndicator / (java.lang.Math.max (dblLinearSlope, - dblLinearSlopePrev) + 2. * java.lang.Math.min (dblLinearSlope, dblLinearSlopePrev)); - } - - dblLinearSlopePrev = dblLinearSlope; - } - - return adblHyman83C1; - } - - /** - * Generate a Hyman89 C1 Array from the specified Array of Predictor Ordinates and the Response Values - * - * Doherty, Edelman, and Hyman (1989) Non-negative, monotonic, or convexity preserving cubic and quintic - * Hermite interpolation - Mathematics of Computation 52 (186), 471-494. - * - * @param adblPredictorOrdinate The Predictor Ordinate Array - * @param adblResponseValue The Response Value Array - * - * @return The C1 Array - */ - - public static final double[] Hyman89C1 ( - final double[] adblPredictorOrdinate, - final double[] adblResponseValue) - { - int iNumResponse = adblResponseValue.length; - double[] adblHyman89C1 = new double[iNumResponse]; - - double[] adblNodeC1 = LinearC1 (adblPredictorOrdinate, adblResponseValue); - - double[] adblBesselC1 = BesselC1 (adblPredictorOrdinate, adblResponseValue); - - for (int i = 0; i < iNumResponse; ++i) { - if (i < 2 || i >= iNumResponse - 2) - adblHyman89C1[i] = adblBesselC1[i]; - else { - double dMuMinus = (adblNodeC1[i - 1] * (2. * (adblPredictorOrdinate[i] - - adblPredictorOrdinate[i - 1]) + adblPredictorOrdinate[i - 1] - - adblPredictorOrdinate[i - 2]) - adblNodeC1[i - 2] * (adblPredictorOrdinate[i] - - adblPredictorOrdinate[i - 1])) / (adblPredictorOrdinate[i] - - adblPredictorOrdinate[i - 2]); - double dMu0 = (adblNodeC1[i - 1] * (adblPredictorOrdinate[i + 1] - adblPredictorOrdinate[i]) - + adblNodeC1[i] * (adblPredictorOrdinate[i] - adblPredictorOrdinate[i - 1])) / - (adblPredictorOrdinate[i + 1] - adblPredictorOrdinate[i - 1]); - double dMuPlus = (adblNodeC1[i] * (2. * (adblPredictorOrdinate[i + 1] - - adblPredictorOrdinate[i]) + adblPredictorOrdinate[i + 2] - adblPredictorOrdinate[i + 1]) - - adblNodeC1[i + 1] * (adblPredictorOrdinate[i + 1] - adblPredictorOrdinate[i])) / - (adblPredictorOrdinate[i + 2] - adblPredictorOrdinate[i]); - - try { - double dblM = 3 * org.drip.quant.common.NumberUtil.Minimum (new double[] - {java.lang.Math.abs (adblNodeC1[i - 1]), java.lang.Math.abs (adblNodeC1[i]), - java.lang.Math.abs (dMu0), java.lang.Math.abs (dMuPlus)}); - - if (!org.drip.quant.common.NumberUtil.SameSign (new double[] {dMu0, dMuMinus, - adblNodeC1[i - 1] - adblNodeC1[i - 2], adblNodeC1[i] - adblNodeC1[i - 1]})) - dblM = java.lang.Math.max (dblM, 1.5 * java.lang.Math.min (java.lang.Math.abs (dMu0), - java.lang.Math.abs (dMuMinus))); - else if (!org.drip.quant.common.NumberUtil.SameSign (new double[] {-dMu0, -dMuPlus, - adblNodeC1[i] - adblNodeC1[i - 1], adblNodeC1[i + 1] - adblNodeC1[i]})) - dblM = java.lang.Math.max (dblM, 1.5 * java.lang.Math.min (java.lang.Math.abs (dMu0), - java.lang.Math.abs (dMuPlus))); - - adblHyman89C1[i] = 0.; - - if (adblBesselC1[i] * dMu0 > 0.) - adblHyman89C1[i] = adblBesselC1[i] / java.lang.Math.abs (adblBesselC1[i]) * - java.lang.Math.min (java.lang.Math.abs (adblBesselC1[i]), dblM); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - } - - return adblHyman89C1; - } - - /** - * Generate a Harmonic C1 Array from the specified Array of Predictor Ordinates and the Response Values - * - * Fritcsh and Butland (1984) A Method for constructing local monotonic piece-wise cubic interpolants - - * SIAM J on Scientific and Statistical Computing 5, 300-304. - * - * @param adblPredictorOrdinate The Predictor Ordinate Array - * @param adblResponseValue The Response Value Array - * - * @return The C1 Array - */ - - public static final double[] HarmonicC1 ( - final double[] adblPredictorOrdinate, - final double[] adblResponseValue) - { - int iNumResponse = adblResponseValue.length; - double[] adblHarmonicC1 = new double[iNumResponse]; - - double[] adblLinearC1 = LinearC1 (adblPredictorOrdinate, adblResponseValue); - - for (int i = 0; i < iNumResponse; ++i) { - if (0 == i) { - adblHarmonicC1[i] = (adblPredictorOrdinate[2] + adblPredictorOrdinate[1] - 2. * - adblPredictorOrdinate[0]) * adblLinearC1[0] / (adblPredictorOrdinate[2] - - adblPredictorOrdinate[0]); - adblHarmonicC1[i] -= (adblPredictorOrdinate[1] - adblPredictorOrdinate[0]) * adblLinearC1[1] - / (adblPredictorOrdinate[2] - adblPredictorOrdinate[0]); - } else if (iNumResponse - 1 == i) { - adblHarmonicC1[i] = -(adblPredictorOrdinate[i] - adblPredictorOrdinate[i - 1]) * - adblLinearC1[i - 2] / (adblPredictorOrdinate[i] - adblPredictorOrdinate[i - 2]); - adblHarmonicC1[i] += (2. * adblPredictorOrdinate[i] - adblPredictorOrdinate[i - 1] - - adblPredictorOrdinate[i - 2]) * adblLinearC1[i - 1] / (adblPredictorOrdinate[i] - - adblPredictorOrdinate[i - 2]); - } else { - if (adblLinearC1[i - 1] * adblLinearC1[i] <= 0.) - adblHarmonicC1[i] = 0.; - else { - adblHarmonicC1[i] = (adblPredictorOrdinate[i] - adblPredictorOrdinate[i - 1] + 2. * - (adblPredictorOrdinate[i + 1] - adblPredictorOrdinate[i])) / (3. * - (adblPredictorOrdinate[i + 1] - adblPredictorOrdinate[i])) / adblLinearC1[i - 1]; - adblHarmonicC1[i] += (adblPredictorOrdinate[i + 1] - adblPredictorOrdinate[i] + 2. * - (adblPredictorOrdinate[i] - adblPredictorOrdinate[i - 1])) / (3. * - (adblPredictorOrdinate[i + 1] - adblPredictorOrdinate[i])) / adblLinearC1[i]; - adblHarmonicC1[i] = 1. / adblHarmonicC1[i]; - } - } - } - - return adblHarmonicC1; - } - - /** - * Generate a Van Leer Limiter C1 Array from the specified Array of Predictor Ordinates and the Response - * Values. - * - * Van Leer (1974) Towards the Ultimate Conservative Difference Scheme. II - Monotonicity and - * Conservation combined in a Second-Order Scheme, Journal of Computational Physics 14 (4), 361-370. - * - * @param adblPredictorOrdinate The Predictor Ordinate Array - * @param adblResponseValue The Response Value Array - * - * @return The C1 Array - */ - - public static final double[] VanLeerLimiterC1 ( - final double[] adblPredictorOrdinate, - final double[] adblResponseValue) - { - int iNumResponse = adblResponseValue.length; - double[] dblVanLeerLimiterC1 = new double[iNumResponse]; - - double[] adblNodeC1 = LinearC1 (adblPredictorOrdinate, adblResponseValue); - - for (int i = 0; i < iNumResponse; ++i) { - if (0 == i) { - dblVanLeerLimiterC1[i] = (adblPredictorOrdinate[2] + adblPredictorOrdinate[1] - 2. * - adblPredictorOrdinate[0]) * adblNodeC1[0] / (adblPredictorOrdinate[2] - - adblPredictorOrdinate[0]); - dblVanLeerLimiterC1[i] -= (adblPredictorOrdinate[1] - adblPredictorOrdinate[0]) * - adblNodeC1[1] / (adblPredictorOrdinate[2] - adblPredictorOrdinate[0]); - } else if (iNumResponse - 1 == i) { - dblVanLeerLimiterC1[i] = -(adblPredictorOrdinate[i] - adblPredictorOrdinate[i - 1]) * - adblNodeC1[i - 2] / (adblPredictorOrdinate[i] - adblPredictorOrdinate[i - 2]); - dblVanLeerLimiterC1[i] += (2. * adblPredictorOrdinate[i] - adblPredictorOrdinate[i - 1] - - adblPredictorOrdinate[i - 2]) * adblNodeC1[i - 1] / (adblPredictorOrdinate[i] - - adblPredictorOrdinate[i - 2]); - } else { - if (0. != adblNodeC1[i - 1]) { - double dblR = adblNodeC1[i] / adblNodeC1[i - 1]; - - double dblRAbsolute = java.lang.Math.abs (dblR); - - dblVanLeerLimiterC1[i] = adblNodeC1[i] * (dblR + dblRAbsolute) / (1. + dblRAbsolute); - } else if (0. >= adblNodeC1[i]) - dblVanLeerLimiterC1[i] = 0.; - else if (0. < adblNodeC1[i]) - dblVanLeerLimiterC1[i] = 2. * adblNodeC1[i]; - } - } - - return dblVanLeerLimiterC1; - } - - /** - * Generate a Huynh Le Floch Limiter C1 Array from the specified Array of Predictor Ordinates and the - * Response Values. - * - * Huynh (1993) Accurate Monotone Cubic Interpolation, SIAM J on Numerical Analysis 30 (1), 57-100. - * - * @param adblPredictorOrdinate The Predictor Ordinate Array - * @param adblResponseValue The Response Value Array - * - * @return The C1 Array - */ - - public static final double[] HuynhLeFlochLimiterC1 ( - final double[] adblPredictorOrdinate, - final double[] adblResponseValue) - { - int iNumResponse = adblResponseValue.length; - double[] adblHuynhLeFlochLimiterC1 = new double[iNumResponse]; - - double[] adblNodeC1 = LinearC1 (adblPredictorOrdinate, adblResponseValue); - - for (int i = 0; i < iNumResponse; ++i) { - if (0 == i) { - adblHuynhLeFlochLimiterC1[i] = (adblPredictorOrdinate[2] + adblPredictorOrdinate[1] - 2. * - adblPredictorOrdinate[0]) * adblNodeC1[0] / (adblPredictorOrdinate[2] - - adblPredictorOrdinate[0]); - adblHuynhLeFlochLimiterC1[i] -= (adblPredictorOrdinate[1] - adblPredictorOrdinate[0]) * - adblNodeC1[1] / (adblPredictorOrdinate[2] - adblPredictorOrdinate[0]); - } else if (iNumResponse - 1 == i) { - adblHuynhLeFlochLimiterC1[i] = -(adblPredictorOrdinate[i] - adblPredictorOrdinate[i - 1]) * - adblNodeC1[i - 2] / (adblPredictorOrdinate[i] - adblPredictorOrdinate[i - 2]); - adblHuynhLeFlochLimiterC1[i] += (2. * adblPredictorOrdinate[i] - adblPredictorOrdinate[i - 1] - - adblPredictorOrdinate[i - 2]) * adblNodeC1[i - 1] / (adblPredictorOrdinate[i] - - adblPredictorOrdinate[i - 2]); - } else { - double dblMonotoneIndicator = adblNodeC1[i] * adblNodeC1[i - 1]; - - if (0. < dblMonotoneIndicator) - adblHuynhLeFlochLimiterC1[i] = 3. * dblMonotoneIndicator * (adblNodeC1[i] + - adblNodeC1[i - 1]) / (adblNodeC1[i] * adblNodeC1[i] + adblNodeC1[i - 1] * - adblNodeC1[i - 1] * 4. * dblMonotoneIndicator); - else - adblHuynhLeFlochLimiterC1[i] = 0.; - } - } - - return adblHuynhLeFlochLimiterC1; - } - - /** - * Generate a Kruger C1 Array from the specified Array of Predictor Ordinates and the Response Values. - * - * Kruger (2002) Constrained Cubic Spline Interpolations for Chemical Engineering Application, - * http://www.korf.co.uk/spline.pdf - * - * @param adblPredictorOrdinate The Predictor Ordinate Array - * @param adblResponseValue The Response Value Array - * - * @return The C1 Array - */ - - public static final double[] KrugerC1 ( - final double[] adblPredictorOrdinate, - final double[] adblResponseValue) - { - int iNumResponse = adblResponseValue.length; - double[] adblKrugerSlope = new double[iNumResponse]; - - double[] adblSlopeC1 = LinearC1 (adblPredictorOrdinate, adblResponseValue); - - if (null == adblSlopeC1 || adblSlopeC1.length != iNumResponse - 1) return null; - - for (int i = 0; i < iNumResponse; ++i) { - if (0 != i && iNumResponse - 1 != i) { - if (adblSlopeC1[i - 1] * adblSlopeC1[i] <= 0.) - adblKrugerSlope[i] = 0.; - else - adblKrugerSlope[i] = 2. / ((1. / adblSlopeC1[i - 1]) + (1. / adblSlopeC1[i])); - } - } - - adblKrugerSlope[0] = 3.5 * adblSlopeC1[0] - 0.5 * adblKrugerSlope[1]; - adblKrugerSlope[iNumResponse - 1] = 3.5 * adblSlopeC1[iNumResponse - 2] - 0.5 * - adblKrugerSlope[iNumResponse - 2]; - return adblKrugerSlope; - } - - /** - * Generate a Akima C1 Array from the specified Array of Predictor Ordinates and the Response Values. - * - * Akima (1970): A New Method of Interpolation and Smooth Curve Fitting based on Local Procedures, - * Journal of the Association for the Computing Machinery 17 (4), 589-602. - * - * @param adblPredictorOrdinate The Predictor Ordinate Array - * @param adblResponseValue The Response Value Array - * - * @return The C1 Array - */ - - public static final double[] AkimaC1 ( - final double[] adblPredictorOrdinate, - final double[] adblResponseValue) - { - org.drip.spline.pchip.AkimaLocalC1Generator alcr = - org.drip.spline.pchip.AkimaLocalC1Generator.Create (adblPredictorOrdinate, adblResponseValue); - - return null == alcr ? null : alcr.C1(); - } - - /** - * Verify if the given Quintic Polynomial is Monotone using the Hyman89 Algorithm - * - * Doherty, Edelman, and Hyman (1989) Non-negative, monotonic, or convexity preserving cubic and quintic - * Hermite interpolation - Mathematics of Computation 52 (186), 471-494. - * - * @param adblPredictorOrdinate Array of Predictor Ordinates - * @param adblResponseValue Array of Response Values - * @param adblFirstDerivative Array of First Derivatives - * @param adblSecondDerivative Array of Second Derivatives - * - * @return TRUE - The given Quintic Polynomial is Monotone - * - * @throws java.lang.Exception Thrown if the Monotonicity cannot be determined - */ - - public static final boolean VerifyHyman89QuinticMonotonicity ( - final double[] adblPredictorOrdinate, - final double[] adblResponseValue, - final double[] adblFirstDerivative, - final double[] adblSecondDerivative) - throws java.lang.Exception - { - if (null == adblPredictorOrdinate || null == adblResponseValue || null == adblFirstDerivative || null - == adblSecondDerivative) - throw new java.lang.Exception - ("LocalMonotoneCkGenerator::VerifyHyman89QuinticMonotonicity => Invalid Inputs"); - - int iNumPredictor = adblPredictorOrdinate.length; - - if (1 >= iNumPredictor || iNumPredictor != adblResponseValue.length || iNumPredictor != - adblResponseValue.length || iNumPredictor != adblResponseValue.length) - throw new java.lang.Exception - ("LocalMonotoneCkGenerator::VerifyHyman89QuinticMonotonicity => Invalid Inputs"); - - for (int i = 1; i < iNumPredictor - 1; ++i) { - double dblAbsoluteResponseValue = java.lang.Math.abs (adblResponseValue[i]); - - double dblResponseValueSign = adblResponseValue[i] > 0. ? 1. : -1.; - double dblHMinus = (adblPredictorOrdinate[i] - adblPredictorOrdinate[i - 1]); - double dblHPlus = (adblPredictorOrdinate[i + 1] - adblPredictorOrdinate[i]); - - if (-5. * dblAbsoluteResponseValue / dblHPlus > dblResponseValueSign * adblFirstDerivative[i] || - 5. * dblAbsoluteResponseValue / dblHMinus < dblResponseValueSign * adblFirstDerivative[i]) - return false; - - if (dblResponseValueSign * adblSecondDerivative[i] < dblResponseValueSign * java.lang.Math.max - (8. * adblFirstDerivative[i] / dblHMinus - 20. * adblResponseValue[i] / dblHMinus / - dblHMinus, -8. * adblFirstDerivative[i] / dblHPlus - 20. * adblResponseValue[i] / - dblHPlus / dblHPlus)) - return false; - } - - return true; - } - - /** - * Generate C1 Slope Quintic Polynomial is Monotone using the Hyman89 Algorithm - * - * Doherty, Edelman, and Hyman (1989) Non-negative, monotonic, or convexity preserving cubic and quintic - * Hermite interpolation - Mathematics of Computation 52 (186), 471-494. - * - * @param adblPredictorOrdinate Array of Predictor Ordinates - * @param adblResponseValue Array of Response Values - * @param adblFirstDerivative Array of First Derivatives - * @param adblSecondDerivative Array of Second Derivatives - * - * @return The C1 Slope Quintic Stretch - */ - - public static final double[] Hyman89QuinticMonotoneC1 ( - final double[] adblPredictorOrdinate, - final double[] adblResponseValue, - final double[] adblFirstDerivative, - final double[] adblSecondDerivative) - { - if (null == adblPredictorOrdinate || null == adblResponseValue || null == adblFirstDerivative || null - == adblSecondDerivative) - return null; - - int iNumPredictor = adblPredictorOrdinate.length; - - if (1 >= iNumPredictor || iNumPredictor != adblResponseValue.length || iNumPredictor != - adblResponseValue.length || iNumPredictor != adblResponseValue.length) - return null; - - double[] adblAdjFirstDerivative = new double[iNumPredictor]; - - double[] adblNodeC1 = LinearC1 (adblPredictorOrdinate, adblResponseValue); - - double[] adblBesselC1 = BesselC1 (adblPredictorOrdinate, adblResponseValue); - - for (int i = 0; i < iNumPredictor; ++i) { - if (i < 2 || i >= iNumPredictor - 2) - adblAdjFirstDerivative[i] = adblBesselC1[i]; - else { - double dblSign = 0.; - double dblHMinus = (adblPredictorOrdinate[i] - adblPredictorOrdinate[i - 1]); - double dblHPlus = (adblPredictorOrdinate[i + 1] - adblPredictorOrdinate[i]); - - if (adblFirstDerivative[i - 1] * adblFirstDerivative[i] < 0.) - dblSign = adblResponseValue[i] > 0. ? 1. : -1.; - - double dblMinSlope = java.lang.Math.min (java.lang.Math.abs (adblFirstDerivative[i - 1]), - java.lang.Math.abs (adblFirstDerivative[i])); - - if (dblSign >= 0.) - adblAdjFirstDerivative[i] = java.lang.Math.min (java.lang.Math.max (0., - adblFirstDerivative[i]), 5. * dblMinSlope); - else - adblAdjFirstDerivative[i] = java.lang.Math.max (java.lang.Math.min (0., - adblFirstDerivative[i]), -5. * dblMinSlope); - - double dblA = java.lang.Math.max (0., adblAdjFirstDerivative[i] / adblNodeC1[i - 1]); - - double dblB = java.lang.Math.max (0., adblAdjFirstDerivative[i + 1] / adblNodeC1[i]); - - double dblDPlus = adblAdjFirstDerivative[i] * adblNodeC1[i] > 0. ? adblAdjFirstDerivative[i] - : 0.; - double dblDMinus = adblAdjFirstDerivative[i] * adblNodeC1[i - 1] > 0. ? - adblAdjFirstDerivative[i] : 0.; - double dblALeft = (-7.9 * dblDPlus - 0.26 * dblDPlus * dblB) / dblHPlus; - double dblARight = ((20. - 2. * dblB) * adblNodeC1[i] - 8. * dblDPlus - 0.48 * dblDPlus * - dblB) / dblHPlus; - double dblBLeft = ((2. * dblA - 20.) * adblNodeC1[i - 1] + 8. * dblDMinus - 0.48 * dblDMinus - * dblA) / dblHMinus; - double dblBRight = (7.9 * dblDMinus + 0.26 * dblDMinus * dblA) / dblHMinus; - - if (dblARight <= dblBLeft || dblALeft >= dblBRight) { - double dblDenom = ((8. + 0.48 * dblB) / dblHPlus) + ((8. + 0.48 * dblA) / dblHMinus); - adblAdjFirstDerivative[i] = (20. - 2. * dblB) * adblNodeC1[i] / dblHPlus; - adblAdjFirstDerivative[i] += (20. - 2. * dblA) * adblNodeC1[i - 1] / dblHMinus; - adblAdjFirstDerivative[i] /= dblDenom; - } - } - } - - return adblAdjFirstDerivative; - } - - /** - * Generate the Local Control Stretch in accordance with the desired Customization Parameters - * - * @param adblPredictorOrdinate The Predictor Ordinate Array - * @param adblResponseValue The Response Value Array - * @param strGeneratorType The C1 Generator Type - * @param bEliminateSpuriousExtrema TRUE - Eliminate Spurious Extrema - * @param bApplyMonotoneFilter TRUE - Apply Monotone Filter - * - * @return Instance of the Local Control Stretch - */ - - public static final LocalMonotoneCkGenerator Create ( - final double[] adblPredictorOrdinate, - final double[] adblResponseValue, - final java.lang.String strGeneratorType, - final boolean bEliminateSpuriousExtrema, - final boolean bApplyMonotoneFilter) - { - try { - LocalMonotoneCkGenerator lcr = new LocalMonotoneCkGenerator (adblPredictorOrdinate, - adblResponseValue); - - if (!lcr.generateC1 (strGeneratorType)) return null; - - if (bEliminateSpuriousExtrema && !lcr.eliminateSpuriousExtrema()) return null; - - if (bApplyMonotoneFilter) { - if (!lcr.applyMonotoneFilter()) return null; - } - - return lcr; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Local Control Stretch in accordance with the desired Customization Parameters - * - * @param aiPredictorOrdinate The Predictor Ordinate Array - * @param adblResponseValue The Response Value Array - * @param strGeneratorType The C1 Generator Type - * @param bEliminateSpuriousExtrema TRUE - Eliminate Spurious Extrema - * @param bApplyMonotoneFilter TRUE - Apply Monotone Filter - * - * @return Instance of the Local Control Stretch - */ - - public static final LocalMonotoneCkGenerator Create ( - final int[] aiPredictorOrdinate, - final double[] adblResponseValue, - final java.lang.String strGeneratorType, - final boolean bEliminateSpuriousExtrema, - final boolean bApplyMonotoneFilter) - { - if (null == aiPredictorOrdinate) return null; - - int iNumPredictorOrdinate = aiPredictorOrdinate.length; - double[] adblPredictorOrdinate = new double[iNumPredictorOrdinate]; - - if (0 == iNumPredictorOrdinate) return null; - - for (int i = 0; i < iNumPredictorOrdinate; ++i) - adblPredictorOrdinate[i] = aiPredictorOrdinate[i]; - - return Create (adblPredictorOrdinate, adblResponseValue, strGeneratorType, bEliminateSpuriousExtrema, - bApplyMonotoneFilter); - } - - private LocalMonotoneCkGenerator ( - final double[] adblPredictorOrdinate, - final double[] adblResponseValue) - throws java.lang.Exception - { - if (null == (_adblPredictorOrdinate = adblPredictorOrdinate) || null == (_adblResponseValue = - adblResponseValue)) - throw new java.lang.Exception ("LocalMonotoneCkGenerator ctr: Invalid Inputs!"); - - int iSize = _adblPredictorOrdinate.length; - - if (0 == iSize || iSize != _adblResponseValue.length) - throw new java.lang.Exception ("LocalMonotoneCkGenerator ctr: Invalid Inputs!"); - } - - private boolean generateC1 ( - final java.lang.String strGeneratorType) - { - if (null == strGeneratorType || strGeneratorType.isEmpty()) return false; - - if (C1_AKIMA.equalsIgnoreCase (strGeneratorType)) - return null != (_adblC1 = AkimaC1 (_adblPredictorOrdinate, _adblResponseValue)) && 0 != - _adblC1.length; - - if (C1_BESSEL.equalsIgnoreCase (strGeneratorType)) - return null != (_adblC1 = BesselC1 (_adblPredictorOrdinate, _adblResponseValue)) && 0 != - _adblC1.length; - - if (C1_HARMONIC.equalsIgnoreCase (strGeneratorType)) - return null != (_adblC1 = HarmonicC1 (_adblPredictorOrdinate, _adblResponseValue)) && 0 != - _adblC1.length; - - if (C1_HUYNH_LE_FLOCH.equalsIgnoreCase (strGeneratorType)) - return null != (_adblC1 = HuynhLeFlochLimiterC1 (_adblPredictorOrdinate, _adblResponseValue)) && - 0 != _adblC1.length; - - if (C1_HYMAN83.equalsIgnoreCase (strGeneratorType)) - return null != (_adblC1 = Hyman83C1 (_adblPredictorOrdinate, _adblResponseValue)) && 0 != - _adblC1.length; - - if (C1_HYMAN89.equalsIgnoreCase (strGeneratorType)) - return null != (_adblC1 = Hyman89C1 (_adblPredictorOrdinate, _adblResponseValue)) && 0 != - _adblC1.length; - - if (C1_KRUGER.equalsIgnoreCase (strGeneratorType)) - return null != (_adblC1 = KrugerC1 (_adblPredictorOrdinate, _adblResponseValue)) && 0 != - _adblC1.length; - - if (C1_MONOTONE_CONVEX.equalsIgnoreCase (strGeneratorType)) - return null != (_adblC1 = BesselC1 (_adblPredictorOrdinate, _adblResponseValue)) && 0 != - _adblC1.length; - - if (C1_VANILLA.equalsIgnoreCase (strGeneratorType)) - return null != (_adblC1 = LinearC1 (_adblPredictorOrdinate, _adblResponseValue)) && 0 != - _adblC1.length; - - if (C1_VAN_LEER.equalsIgnoreCase (strGeneratorType)) - return null != (_adblC1 = VanLeerLimiterC1 (_adblPredictorOrdinate, _adblResponseValue)) && 0 != - _adblC1.length; - - return false; - } - - private boolean eliminateSpuriousExtrema() - { - return null != (_adblC1 = EliminateSpuriousExtrema (_adblC1, LinearC1 (_adblPredictorOrdinate, - _adblResponseValue))) && 0 != _adblC1.length; - } - - private boolean applyMonotoneFilter() - { - return null != (_adblC1 = ApplyMonotoneFilter (_adblC1, LinearC1 (_adblPredictorOrdinate, - _adblResponseValue))) && 0 != _adblC1.length; - } - - /** - * Retrieve the C1 Array - * - * @return The C1 Array - */ - - public double[] C1() - { - return _adblC1; - } -} diff --git a/org/drip/spline/pchip/MinimalQuadraticHaganWest.java b/org/drip/spline/pchip/MinimalQuadraticHaganWest.java deleted file mode 100644 index 5133f48..0000000 --- a/org/drip/spline/pchip/MinimalQuadraticHaganWest.java +++ /dev/null @@ -1,292 +0,0 @@ - -package org.drip.spline.pchip; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * This class implements the regime using the Hagan and West (2006) Minimal Quadratic Estimator. - * - * @author Lakshmi Krishnamurthy - */ - -public class MinimalQuadraticHaganWest { - private double[] _adblA = null; - private double[] _adblB = null; - private double[] _adblC = null; - private double[] _adblObservation = null; - private double[] _adblPredictorOrdinate = null; - private double _dblWeight = java.lang.Double.NaN; - - /** - * Create an instance of MinimalQuadraticHaganWest - * - * @param adblPredictorOrdinate Array of Predictor Ordinates - * @param adblObservation Array of Observations - * @param dblWeight Relative Weights applied across the first and the second derivatives - * - * @return Instance of MinimalQuadraticHaganWest - */ - - public static final MinimalQuadraticHaganWest Create ( - final double[] adblPredictorOrdinate, - final double[] adblObservation, - final double dblWeight) - { - MinimalQuadraticHaganWest mchw = null; - - try { - mchw = new MinimalQuadraticHaganWest (adblPredictorOrdinate, adblObservation, dblWeight); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return mchw.setupCoefficients() ? mchw : null; - } - - private MinimalQuadraticHaganWest ( - final double[] adblPredictorOrdinate, - final double[] adblObservation, - final double dblWeight) - throws java.lang.Exception - { - if (null == (_adblObservation = adblObservation) || null == (_adblPredictorOrdinate = - adblPredictorOrdinate) || !org.drip.quant.common.NumberUtil.IsValid (_dblWeight = dblWeight)) - throw new java.lang.Exception ("MinimalQuadraticHaganWest ctr: Invalid Inputs!"); - - int iNumObservation = _adblObservation.length; - - if (1 >= iNumObservation || iNumObservation + 1 != _adblPredictorOrdinate.length) - throw new java.lang.Exception ("MinimalQuadraticHaganWest ctr: Invalid Inputs!"); - } - - private boolean setupCoefficients() - { - int iNumObservation = _adblObservation.length; - _adblA = new double[iNumObservation]; - _adblB = new double[iNumObservation]; - _adblC = new double[iNumObservation]; - double[] adblH = new double[iNumObservation]; - double[] adblRHS = new double[3 * iNumObservation]; - double[][] aadblCoeffMatrix = new double[3 * iNumObservation][3 * iNumObservation]; - - for (int i = 0; i < 3 * iNumObservation; ++i) { - adblRHS[i] = 0.; - - for (int j = 0; j < 3 * iNumObservation; ++j) - aadblCoeffMatrix[i][j] = 0.; - } - - for (int i = 0; i < iNumObservation; ++i) - adblH[i] = _adblPredictorOrdinate[i + 1] - _adblPredictorOrdinate[i]; - - /* - * Setting up the coefficient linear constraint equation set - * - * - Left index => Equation Index - * - Right Index => Coefficient Index - */ - - /* - * Set up the conserved quantities; Laid out as: - * A_i + (H_i / 2.) * B_i + (H_i * H_i / 3.) * C_i = Observation_i - */ - - for (int iEq = 0; iEq < iNumObservation; ++iEq) { - int iSegmentIndex = iEq; - adblRHS[iEq] = _adblObservation[iEq]; // Z_i - aadblCoeffMatrix[iEq][3 * iSegmentIndex] = 1.; // A_i - aadblCoeffMatrix[iEq][3 * iSegmentIndex + 1] = 0.5 * adblH[iSegmentIndex]; // B_i - aadblCoeffMatrix[iEq][3 * iSegmentIndex + 2] = adblH[iSegmentIndex] * adblH[iSegmentIndex] / 3.; // C_i - } - - /* - * Set up the continuity constraints; Laid out as: - * A_i + H_i * B_i + (H_i * H_i) * C_i - A_i+1 = 0. - */ - - for (int iEq = iNumObservation; iEq < 2 * iNumObservation - 1; ++iEq) { - adblRHS[iEq] = 0.; - int iSegmentIndex = iEq - iNumObservation; - aadblCoeffMatrix[iEq][3 * iSegmentIndex] = 1.; // A_i - aadblCoeffMatrix[iEq][3 * iSegmentIndex + 1] = adblH[iSegmentIndex]; // B_i - aadblCoeffMatrix[iEq][3 * iSegmentIndex + 2] = adblH[iSegmentIndex] * adblH[iSegmentIndex]; // C_i - aadblCoeffMatrix[iEq][3 * iSegmentIndex + 3] = -1.; // A_i+1 - } - - /* - * Set up the derivative penalty minimizer; Laid out as: - * w * B_i + (2. * H_i) * C_i - w * B_i+1 = 0. - */ - - for (int iEq = 2 * iNumObservation - 1; iEq < 3 * iNumObservation - 2; ++iEq) { - adblRHS[iEq] = 0.; - int iSegmentIndex = iEq - 2 * iNumObservation + 1; - aadblCoeffMatrix[iEq][3 * iSegmentIndex + 1] = _dblWeight; // B_i - aadblCoeffMatrix[iEq][3 * iSegmentIndex + 2] = 2. * adblH[iSegmentIndex]; // C_i - aadblCoeffMatrix[iEq][3 * iSegmentIndex + 4] = -1. * _dblWeight; // B_i+1 - } - - /* - * Left Boundary Condition: Starting Left Slope is zero, i.e., B_0 = 0. - */ - - adblRHS[3 * iNumObservation - 2] = 0.; - aadblCoeffMatrix[3 * iNumObservation - 2][1] = 1.; - - /* - * Right Boundary Condition: Final First Derivative is zero, i.e., B_n-1 = 0. - */ - - adblRHS[3 * iNumObservation - 1] = 0.; - aadblCoeffMatrix[3 * iNumObservation - 1][3 * iNumObservation - 2] = 1.; - - org.drip.quant.linearalgebra.LinearizationOutput lssGaussianElimination = - org.drip.quant.linearalgebra.LinearSystemSolver.SolveUsingGaussianElimination (aadblCoeffMatrix, - adblRHS); - - if (null == lssGaussianElimination) return false; - - double[] adblCoeff = lssGaussianElimination.getTransformedRHS(); - - if (null == adblCoeff || 3 * iNumObservation != adblCoeff.length) return false; - - int iSegment = 0; - - for (int i = 0; i < 3 * iNumObservation; ++i) { - if (0 == i % 3) - _adblA[iSegment] = adblCoeff[i]; - else if (1 == i % 3) - _adblB[iSegment] = adblCoeff[i]; - else if (2 == i % 3) { - _adblC[iSegment] = adblCoeff[i]; - ++iSegment; - } - } - - return true; - } - - private int containingIndex ( - final double dblPredictorOrdinate, - final boolean bIncludeLeft, - final boolean bIncludeRight) - throws java.lang.Exception - { - int iNumSegment = _adblA.length; - - for (int i = 0 ; i < iNumSegment; ++i) { - boolean bLeftValid = bIncludeLeft ? _adblPredictorOrdinate[i] <= dblPredictorOrdinate : - _adblPredictorOrdinate[i] < dblPredictorOrdinate; - - boolean bRightValid = bIncludeRight ? _adblPredictorOrdinate[i + 1] >= dblPredictorOrdinate : - _adblPredictorOrdinate[i + 1] > dblPredictorOrdinate; - - if (bLeftValid && bRightValid) return i; - } - - throw new java.lang.Exception - ("MinimalQuadraticHaganWest::containingIndex => Cannot locate Containing Index"); - } - - /** - * Calculate the Response Value given the Predictor Ordinate - * - * @param dblPredictorOrdinate The Predictor Ordinate - * - * @return The Response Value - * - * @throws java.lang.Exception Thrown if the input is invalid - */ - - public double responseValue ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - int i = containingIndex (dblPredictorOrdinate, true, true); - - return _adblA[i] + _adblB[i] * (dblPredictorOrdinate - _adblPredictorOrdinate[i]) + _adblC[i] * - (dblPredictorOrdinate - _adblPredictorOrdinate[i]) * (dblPredictorOrdinate - - _adblPredictorOrdinate[i]); - } - - public double[] calcConservedConstraint() - { - int iNumObservation = _adblObservation.length; - double[] adblConservedConstraint = new double[iNumObservation]; - - for (int i = 0; i < iNumObservation; ++i) - adblConservedConstraint[i] = _adblA[i] + _adblB[i] * 0.5 + _adblC[i] / 3.; - - return adblConservedConstraint; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - double[] adblTime = new double[] {0., 1.0, 2.0}; - double[] adblForwardRate = new double[] {0.02, 0.026}; - - MinimalQuadraticHaganWest mqhw = MinimalQuadraticHaganWest.Create (adblTime, adblForwardRate, 0.5); - - double[] adblConservedConstraint = mqhw.calcConservedConstraint(); - - for (int i = 0; i < adblConservedConstraint.length; ++i) - System.out.println ("Conserved Constraint[" + i + "] => " + - org.drip.quant.common.FormatUtil.FormatDouble (adblConservedConstraint[i], 1, 6, 1.)); - - for (double dblTime = adblTime[0]; dblTime <= adblTime[adblTime.length - 1]; dblTime += 0.25) - System.out.println ("Response[" + org.drip.quant.common.FormatUtil.FormatDouble (dblTime, 2, 2, - 1.) + "] = " + org.drip.quant.common.FormatUtil.FormatDouble (mqhw.responseValue (dblTime), 1, - 6, 1.)); - } -} diff --git a/org/drip/spline/pchip/MonotoneConvexHaganWest.java b/org/drip/spline/pchip/MonotoneConvexHaganWest.java deleted file mode 100644 index 6524b09..0000000 --- a/org/drip/spline/pchip/MonotoneConvexHaganWest.java +++ /dev/null @@ -1,598 +0,0 @@ - -package org.drip.spline.pchip; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * This class implements the regime using the Hagan and West (2006) Estimator. It provides the following - * functionality: - * - Static Method to Create an instance of MonotoneConvexHaganWest. - * - Ensure that the estimated regime is monotone an convex. - * - If need be, enforce positivity and/or apply amelioration. - * - Apply segment-by-segment range bounds as needed. - * - Retrieve predictor ordinates/response values. - * - * @author Lakshmi Krishnamurthy - */ - -public class MonotoneConvexHaganWest extends org.drip.function.definition.R1ToR1 { - private double[] _adblObservation = null; - private double[] _adblResponseValue = null; - private boolean _bLinearNodeInference = true; - private double[] _adblPredictorOrdinate = null; - private double[] _adblResponseZScoreLeft = null; - private double[] _adblResponseZScoreRight = null; - private org.drip.function.definition.R1ToR1[] _aAU = null; - - class Case1Univariate extends org.drip.function.definition.R1ToR1 { - private double _dblResponseZScoreLeft = java.lang.Double.NaN; - private double _dblResponseZScoreRight = java.lang.Double.NaN; - private double _dblPredictorOrdinateLeft = java.lang.Double.NaN; - private double _dblPredictorOrdinateRight = java.lang.Double.NaN; - - Case1Univariate ( - final double dblPredictorOrdinateLeft, - final double dblPredictorOrdinateRight, - final double dblResponseZScoreLeft, - final double dblResponseZScoreRight) - { - super (null); - - _dblResponseZScoreLeft = dblResponseZScoreLeft; - _dblResponseZScoreRight = dblResponseZScoreRight; - _dblPredictorOrdinateLeft = dblPredictorOrdinateLeft; - _dblPredictorOrdinateRight = dblPredictorOrdinateRight; - } - - @Override public double evaluate ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorOrdinate) || dblPredictorOrdinate < - _dblPredictorOrdinateLeft || dblPredictorOrdinate > _dblPredictorOrdinateRight) - throw new java.lang.Exception ("Case1Univariate::evaluate => Invalid Inputs"); - - double dblX = (dblPredictorOrdinate - _dblPredictorOrdinateLeft) / (_dblPredictorOrdinateRight - - _dblPredictorOrdinateLeft); - return _dblResponseZScoreLeft * (1. - 4. * dblX + 3. * dblX * dblX) + _dblResponseZScoreRight * - (-2. * dblX + 3. * dblX * dblX); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - return org.drip.quant.calculus.R1ToR1Integrator.Boole (this, dblBegin, dblEnd); - } - } - - class Case2Univariate extends org.drip.function.definition.R1ToR1 { - private double _dblEta = java.lang.Double.NaN; - private double _dblResponseZScoreLeft = java.lang.Double.NaN; - private double _dblResponseZScoreRight = java.lang.Double.NaN; - private double _dblPredictorOrdinateLeft = java.lang.Double.NaN; - private double _dblPredictorOrdinateRight = java.lang.Double.NaN; - - Case2Univariate ( - final double dblPredictorOrdinateLeft, - final double dblPredictorOrdinateRight, - final double dblResponseZScoreLeft, - final double dblResponseZScoreRight) - { - super (null); - - _dblResponseZScoreLeft = dblResponseZScoreLeft; - _dblResponseZScoreRight = dblResponseZScoreRight; - _dblPredictorOrdinateLeft = dblPredictorOrdinateLeft; - _dblPredictorOrdinateRight = dblPredictorOrdinateRight; - _dblEta = _dblResponseZScoreLeft != _dblResponseZScoreRight ? (_dblResponseZScoreRight + 2. * - _dblResponseZScoreLeft) / (_dblResponseZScoreRight - _dblResponseZScoreLeft) : 0.; - } - - @Override public double evaluate ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorOrdinate) || dblPredictorOrdinate < - _dblPredictorOrdinateLeft || dblPredictorOrdinate > _dblPredictorOrdinateRight) - throw new java.lang.Exception ("Case2Univariate::evaluate => Invalid Inputs"); - - if (_dblResponseZScoreLeft == _dblResponseZScoreRight) return _dblResponseZScoreRight; - - double dblX = (dblPredictorOrdinate - _dblPredictorOrdinateLeft) / (_dblPredictorOrdinateRight - - _dblPredictorOrdinateLeft); - return dblX <= _dblEta ? _dblResponseZScoreLeft : _dblResponseZScoreLeft + - (_dblResponseZScoreRight - _dblResponseZScoreLeft) * (dblX - _dblEta) * (dblX - _dblEta) / - (1. - _dblEta) / (1. - _dblEta); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - return org.drip.quant.calculus.R1ToR1Integrator.Boole (this, dblBegin, dblEnd); - } - } - - class Case3Univariate extends org.drip.function.definition.R1ToR1 { - private double _dblEta = java.lang.Double.NaN; - private double _dblResponseZScoreLeft = java.lang.Double.NaN; - private double _dblResponseZScoreRight = java.lang.Double.NaN; - private double _dblPredictorOrdinateLeft = java.lang.Double.NaN; - private double _dblPredictorOrdinateRight = java.lang.Double.NaN; - - Case3Univariate ( - final double dblPredictorOrdinateLeft, - final double dblPredictorOrdinateRight, - final double dblResponseZScoreLeft, - final double dblResponseZScoreRight) - { - super (null); - - _dblResponseZScoreLeft = dblResponseZScoreLeft; - _dblResponseZScoreRight = dblResponseZScoreRight; - _dblPredictorOrdinateLeft = dblPredictorOrdinateLeft; - _dblPredictorOrdinateRight = dblPredictorOrdinateRight; - _dblEta = _dblResponseZScoreLeft != _dblResponseZScoreRight ? 3. * _dblResponseZScoreRight / - (_dblResponseZScoreRight - _dblResponseZScoreLeft) : 0.; - } - - @Override public double evaluate ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorOrdinate) || dblPredictorOrdinate < - _dblPredictorOrdinateLeft || dblPredictorOrdinate > _dblPredictorOrdinateRight) - throw new java.lang.Exception ("Case3Univariate::evaluate => Invalid Inputs"); - - if (_dblResponseZScoreLeft == _dblResponseZScoreRight) return _dblResponseZScoreRight; - - double dblX = (dblPredictorOrdinate - _dblPredictorOrdinateLeft) / (_dblPredictorOrdinateRight - - _dblPredictorOrdinateLeft); - return dblX < _dblEta ? _dblResponseZScoreLeft + (_dblResponseZScoreLeft - - _dblResponseZScoreRight) * (_dblEta - dblX) * (_dblEta - dblX) / _dblEta / _dblEta : - _dblResponseZScoreRight; - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - return org.drip.quant.calculus.R1ToR1Integrator.Boole (this, dblBegin, dblEnd); - } - } - - class Case4Univariate extends org.drip.function.definition.R1ToR1 { - private double _dblA = java.lang.Double.NaN; - private double _dblEta = java.lang.Double.NaN; - private double _dblResponseZScoreLeft = java.lang.Double.NaN; - private double _dblResponseZScoreRight = java.lang.Double.NaN; - private double _dblPredictorOrdinateLeft = java.lang.Double.NaN; - private double _dblPredictorOrdinateRight = java.lang.Double.NaN; - - Case4Univariate ( - final double dblPredictorOrdinateLeft, - final double dblPredictorOrdinateRight, - final double dblResponseZScoreLeft, - final double dblResponseZScoreRight) - { - super (null); - - _dblResponseZScoreLeft = dblResponseZScoreLeft; - _dblResponseZScoreRight = dblResponseZScoreRight; - _dblPredictorOrdinateLeft = dblPredictorOrdinateLeft; - _dblPredictorOrdinateRight = dblPredictorOrdinateRight; - - if (_dblResponseZScoreLeft != _dblResponseZScoreRight) { - _dblEta = _dblResponseZScoreRight / (_dblResponseZScoreRight - _dblResponseZScoreLeft); - _dblA = -1. * _dblResponseZScoreLeft * _dblResponseZScoreRight / (_dblResponseZScoreRight - - _dblResponseZScoreLeft); - } else { - _dblA = 0.; - _dblEta = 0.; - } - } - - @Override public double evaluate ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorOrdinate) || dblPredictorOrdinate < - _dblPredictorOrdinateLeft || dblPredictorOrdinate > _dblPredictorOrdinateRight) - throw new java.lang.Exception ("Case4Univariate::evaluate => Invalid Inputs"); - - if (_dblResponseZScoreLeft == _dblResponseZScoreRight) return _dblResponseZScoreRight; - - double dblX = (dblPredictorOrdinate - _dblPredictorOrdinateLeft) / (_dblPredictorOrdinateRight - - _dblPredictorOrdinateLeft); - return dblX < _dblEta ? _dblA + (_dblResponseZScoreLeft - _dblA) * (_dblEta - dblX) * (_dblEta - - dblX) / _dblEta / _dblEta : _dblA + (_dblResponseZScoreRight - _dblA) * (dblX - _dblEta) * - (dblX - _dblEta) / (1. - _dblEta) / (1. - _dblEta); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - return org.drip.quant.calculus.R1ToR1Integrator.Boole (this, dblBegin, dblEnd); - } - } - - /** - * Create an instance of MonotoneConvexHaganWest - * - * @param adblPredictorOrdinate Array of Predictor Ordinates - * @param adblObservation Array of Observations - * @param bLinearNodeInference Apply Linear Node Inference from Observations - * - * @return Instance of MonotoneConvexHaganWest - */ - - public static final MonotoneConvexHaganWest Create ( - final double[] adblPredictorOrdinate, - final double[] adblObservation, - final boolean bLinearNodeInference) - { - MonotoneConvexHaganWest mchw = null; - - try { - mchw = new MonotoneConvexHaganWest (adblPredictorOrdinate, adblObservation, - bLinearNodeInference); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return mchw.inferResponseValues() && mchw.inferResponseZScores() && mchw.generateUnivariate() ? mchw - : null; - } - - private MonotoneConvexHaganWest ( - final double[] adblPredictorOrdinate, - final double[] adblObservation, - final boolean bLinearNodeInference) - throws java.lang.Exception - { - super (null); - - if (null == (_adblObservation = adblObservation) || null == (_adblPredictorOrdinate = - adblPredictorOrdinate)) - throw new java.lang.Exception ("MonotoneConvexHaganWest ctr: Invalid Inputs!"); - - _bLinearNodeInference = bLinearNodeInference; - int iNumObservation = _adblObservation.length; - - if (1 >= iNumObservation || iNumObservation + 1 != _adblPredictorOrdinate.length) - throw new java.lang.Exception ("MonotoneConvexHaganWest ctr: Invalid Inputs!"); - } - - private boolean inferResponseValues() - { - int iNumPredictorOrdinate = _adblPredictorOrdinate.length; - _adblResponseValue = new double[iNumPredictorOrdinate]; - - for (int i = 1; i < iNumPredictorOrdinate - 1; ++i) { - if (_bLinearNodeInference) - _adblResponseValue[i] = (_adblPredictorOrdinate[i] - _adblPredictorOrdinate[i - 1]) / - (_adblPredictorOrdinate[i + 1] - _adblPredictorOrdinate[i - 1]) * _adblObservation[i] + - (_adblPredictorOrdinate[i + 1] - _adblPredictorOrdinate[i]) / - (_adblPredictorOrdinate[i + 1] - _adblPredictorOrdinate[i - 1]) * - _adblObservation[i - 1]; - else { - _adblResponseValue[i] = 0.; - - if (_adblObservation[i - 1] * _adblObservation[i] > 0.) { - _adblResponseValue[i] = (_adblPredictorOrdinate[i] - _adblPredictorOrdinate[i - 1] + 2. * - (_adblPredictorOrdinate[i + 1] - _adblPredictorOrdinate[i])) / (3. * - (_adblPredictorOrdinate[i + 1] - _adblPredictorOrdinate[i])) / - _adblObservation[i - 1]; - _adblResponseValue[i] += (_adblPredictorOrdinate[i + 1] - _adblPredictorOrdinate[i] + 2. - * (_adblPredictorOrdinate[i] - _adblPredictorOrdinate[i - 1])) / (3. * - (_adblPredictorOrdinate[i + 1] - _adblPredictorOrdinate[i])) / - _adblObservation[i]; - _adblResponseValue[i] = 1. / _adblResponseValue[i]; - } - } - } - - _adblResponseValue[0] = _adblObservation[0] - 0.5 * (_adblResponseValue[1] - _adblObservation[0]); - _adblResponseValue[iNumPredictorOrdinate - 1] = _adblObservation[iNumPredictorOrdinate - 2] - 0.5 * - (_adblResponseValue[iNumPredictorOrdinate - 2] - _adblObservation[iNumPredictorOrdinate - 2]); - return true; - } - - private boolean inferResponseZScores() - { - int iNumSegment = _adblPredictorOrdinate.length - 1; - _adblResponseZScoreLeft = new double[iNumSegment]; - _adblResponseZScoreRight = new double[iNumSegment]; - - for (int i = 0; i < iNumSegment; ++i) { - _adblResponseZScoreLeft[i] = _adblResponseValue[i] - _adblObservation[i]; - _adblResponseZScoreRight[i] = _adblResponseValue[i + 1] - _adblObservation[i]; - } - - return true; - } - - private boolean generateUnivariate() - { - int iNumSegment = _adblPredictorOrdinate.length - 1; - _aAU = new org.drip.function.definition.R1ToR1[iNumSegment]; - - for (int i = 0; i < iNumSegment; ++i) { - if ((_adblResponseZScoreLeft[i] > 0. && -0.5 * _adblResponseZScoreLeft[i] >= - _adblResponseZScoreRight[i] && _adblResponseZScoreRight[i] >= -2. * - _adblResponseZScoreLeft[i]) || (_adblResponseZScoreLeft[i] < 0. && -0.5 * - _adblResponseZScoreLeft[i] <= _adblResponseZScoreRight[i] && - _adblResponseZScoreRight[i] <= -2. * _adblResponseZScoreLeft[i])) - _aAU[i] = new Case1Univariate (_adblPredictorOrdinate[i], _adblPredictorOrdinate[i + 1], - _adblResponseZScoreLeft[i], _adblResponseZScoreRight[i]); - else if ((_adblResponseZScoreLeft[i] < 0. && _adblResponseZScoreRight[i] > -2. * - _adblResponseZScoreLeft[i]) || (_adblResponseZScoreLeft[i] > 0. && - _adblResponseZScoreRight[i] < -2. * _adblResponseZScoreLeft[i])) - _aAU[i] = new Case2Univariate (_adblPredictorOrdinate[i], _adblPredictorOrdinate[i + 1], - _adblResponseZScoreLeft[i], _adblResponseZScoreRight[i]); - else if ((_adblResponseZScoreLeft[i] > 0. && _adblResponseZScoreRight[i] > -0.5 * - _adblResponseZScoreLeft[i]) || (_adblResponseZScoreLeft[i] < 0. && - _adblResponseZScoreRight[i] < -0.5 * _adblResponseZScoreLeft[i])) - _aAU[i] = new Case3Univariate (_adblPredictorOrdinate[i], _adblPredictorOrdinate[i + 1], - _adblResponseZScoreLeft[i], _adblResponseZScoreRight[i]); - else if ((_adblResponseZScoreLeft[i] >= 0. && _adblResponseZScoreRight[i] >= 0.) || - (_adblResponseZScoreLeft[i] <= 0. && _adblResponseZScoreRight[i] <= 0.)) - _aAU[i] = new Case4Univariate (_adblPredictorOrdinate[i], _adblPredictorOrdinate[i + 1], - _adblResponseZScoreLeft[i], _adblResponseZScoreRight[i]); - } - - return true; - } - - private boolean ameliorate ( - final double[] adblResponseLeftMin, - final double[] adblResponseLeftMax, - final double[] adblResponseRightMin, - final double[] adblResponseRightMax) - { - int iNumObservation = _adblObservation.length; - - if (iNumObservation != adblResponseLeftMin.length || iNumObservation != adblResponseLeftMax.length || - iNumObservation != adblResponseRightMin.length || iNumObservation != adblResponseRightMax.length) - return false; - - for (int i = 0; i < iNumObservation; ++i) { - if (_adblResponseValue[i] < java.lang.Math.max (adblResponseLeftMin[i], adblResponseRightMin[i]) - || _adblResponseValue[i] > java.lang.Math.min (adblResponseLeftMax[i], - adblResponseRightMax[i])) { - if (_adblResponseValue[i] < java.lang.Math.max (adblResponseLeftMin[i], - adblResponseRightMin[i])) - _adblResponseValue[i] = java.lang.Math.max (adblResponseLeftMin[i], - adblResponseRightMin[i]); - else if (_adblResponseValue[i] > java.lang.Math.min (adblResponseLeftMax[i], - adblResponseRightMax[i])) - _adblResponseValue[i] = java.lang.Math.min (adblResponseLeftMax[i], - adblResponseRightMax[i]); - } else { - if (_adblResponseValue[i] < java.lang.Math.min (adblResponseLeftMax[i], - adblResponseRightMax[i])) - _adblResponseValue[i] = java.lang.Math.min (adblResponseLeftMax[i], - adblResponseRightMax[i]); - else if (_adblResponseValue[i] > java.lang.Math.max (adblResponseLeftMin[i], - adblResponseRightMin[i])) - _adblResponseValue[i] = java.lang.Math.max (adblResponseLeftMin[i], - adblResponseRightMin[i]); - } - } - - if (java.lang.Math.abs (_adblResponseValue[0] - _adblObservation[0]) > 0.5 * java.lang.Math.abs - (_adblResponseValue[1] - _adblObservation[0])) - _adblResponseValue[0] = _adblObservation[1] - 0.5 * (_adblResponseValue[1] - - _adblObservation[0]); - - if (java.lang.Math.abs (_adblResponseValue[iNumObservation] - _adblObservation[iNumObservation - 1]) - > 0.5 * java.lang.Math.abs (_adblResponseValue[iNumObservation - 1] - - _adblObservation[iNumObservation - 1])) - _adblResponseValue[iNumObservation] = _adblObservation[iNumObservation - 1] - 0.5 * - (_adblObservation[iNumObservation - 1] - _adblResponseValue[iNumObservation - 1]); - - return inferResponseZScores() && generateUnivariate(); - } - - private int containingIndex ( - final double dblPredictorOrdinate, - final boolean bIncludeLeft, - final boolean bIncludeRight) - throws java.lang.Exception - { - int iNumSegment = _aAU.length; - - for (int i = 0 ; i < iNumSegment; ++i) { - boolean bLeftValid = bIncludeLeft ? _adblPredictorOrdinate[i] <= dblPredictorOrdinate : - _adblPredictorOrdinate[i] < dblPredictorOrdinate; - - boolean bRightValid = bIncludeRight ? _adblPredictorOrdinate[i + 1] >= dblPredictorOrdinate : - _adblPredictorOrdinate[i + 1] > dblPredictorOrdinate; - - if (bLeftValid && bRightValid) return i; - } - - throw new java.lang.Exception - ("MonotoneConvexHaganWest::containingIndex => Cannot locate Containing Index"); - } - - @Override public double evaluate ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - int iContainingIndex = containingIndex (dblPredictorOrdinate, true, true); - - return _aAU[iContainingIndex].evaluate (dblPredictorOrdinate) + _adblObservation[iContainingIndex]; - } - - /** - * Enforce the Positivity of the Inferred Response Values - * - * @return TRUE - Positivity Enforcement is successful - */ - - public boolean enforcePositivity() - { - try { - _adblResponseValue[0] = org.drip.quant.common.NumberUtil.Bound (_adblResponseValue[0], 0., 2. * - _adblObservation[0]); - - int iNumObservation = _adblObservation.length; - - for (int i = 1; i < iNumObservation; ++i) - _adblResponseValue[i] = org.drip.quant.common.NumberUtil.Bound (_adblResponseValue[i], 0., 2. - * java.lang.Math.min (_adblObservation[i - 1], _adblObservation[i])); - - _adblResponseValue[iNumObservation] = org.drip.quant.common.NumberUtil.Bound - (_adblResponseValue[iNumObservation], 0., 2. * _adblObservation[iNumObservation - 1]); - - return inferResponseZScores() && generateUnivariate(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - /** - * Create an Ameliorated Instance of the Current Instance - * - * @param adblResponseLeftMin Response Left Floor - * @param adblResponseLeftMax Response Left Ceiling - * @param adblResponseRightMin Response Right Floor - * @param adblResponseRightMax Response Right Ceiling - * @param bEnforcePositivity TRUE - Enforce Positivity - * - * @return The Ameliorated Version of the Current Instance - */ - - public MonotoneConvexHaganWest generateAmelioratedInstance ( - final double[] adblResponseLeftMin, - final double[] adblResponseLeftMax, - final double[] adblResponseRightMin, - final double[] adblResponseRightMax, - final boolean bEnforcePositivity) - { - if (null == adblResponseLeftMin || null == adblResponseLeftMax | null == adblResponseRightMin || null - == adblResponseRightMax) - return null; - - int iNumAmelioratedObservation = _adblObservation.length + 2; - int iNumAmelioratedPredicatorOrdinate = _adblPredictorOrdinate.length + 2; - double[] adblAmelioratedObservation = new double[iNumAmelioratedObservation]; - double[] adblAmelioratedPredictorOrdinate = new double[iNumAmelioratedPredicatorOrdinate]; - - for (int i = 0; i < iNumAmelioratedPredicatorOrdinate; ++i) { - if (0 == i) - adblAmelioratedPredictorOrdinate[0] = -1. * _adblPredictorOrdinate[1]; - else if (iNumAmelioratedPredicatorOrdinate - 1 == i) - adblAmelioratedPredictorOrdinate[i] = 2. * _adblPredictorOrdinate[i - 1] - - _adblPredictorOrdinate[i - 2]; - else - adblAmelioratedPredictorOrdinate[i] = _adblPredictorOrdinate[i - 1]; - } - - for (int i = 0; i < iNumAmelioratedObservation; ++i) { - if (0 == i) - adblAmelioratedObservation[0] = _adblObservation[0] - (_adblPredictorOrdinate[1] - - _adblPredictorOrdinate[0]) * (_adblObservation[1] - _adblObservation[0]) / - (_adblPredictorOrdinate[2] - _adblPredictorOrdinate[0]); - else if (iNumAmelioratedPredicatorOrdinate - 1 == i) - adblAmelioratedObservation[i] = _adblObservation[i - 1] - (_adblPredictorOrdinate[i - 1] - - _adblPredictorOrdinate[i - 2]) * (_adblObservation[i - 1] - _adblObservation[i - 2]) / - (_adblPredictorOrdinate[i - 1] - _adblPredictorOrdinate[i - 3]); - else - adblAmelioratedObservation[i] = _adblObservation[i - 1]; - } - - MonotoneConvexHaganWest mchwAmeliorated = Create (adblAmelioratedPredictorOrdinate, - adblAmelioratedObservation, _bLinearNodeInference); - - if (null == mchwAmeliorated || mchwAmeliorated.ameliorate (adblResponseLeftMin, adblResponseLeftMax, - adblResponseRightMin, adblResponseRightMax)) - return null; - - if (bEnforcePositivity) { - if (!mchwAmeliorated.enforcePositivity()) return null; - } - - return mchwAmeliorated; - } - - /** - * Retrieve the Array of Predictor Ordinates - * - * @return The Array of Predictor Ordinates - */ - - public double[] predictorOrdinates() - { - return _adblPredictorOrdinate; - } - - /** - * Retrieve the Array of Response Values - * - * @return The Array of Response Values - */ - - public double[] responseValues() - { - return _adblResponseValue; - } -} diff --git a/org/drip/spline/segment/BasisEvaluator.java b/org/drip/spline/segment/BasisEvaluator.java deleted file mode 100644 index ddb273d..0000000 --- a/org/drip/spline/segment/BasisEvaluator.java +++ /dev/null @@ -1,203 +0,0 @@ - -package org.drip.spline.segment; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * This Interface implements the Segment's Basis Evaluator Functions. It exports the following functions: - * - Retrieve the number of Segment's Basis Functions. - * - Set the Inelastics that provides the enveloping Context the Basis Evaluation. - * - Clone/Replicate the current Basis Evaluator Instance. - * - Compute the Response Value of the indexed Basis Function at the specified Predictor Ordinate. - * - Compute the Basis Function Value at the specified Predictor Ordinate. - * - Compute the Response Value at the specified Predictor Ordinate. - * - Compute the Ordered Derivative of the Response Value off of the indexed Basis Function at the - * specified Predictor Ordinate. - * - Compute the Ordered Derivative of the Response Value off of the Basis Function Set at the specified - * Predictor Ordinate. - * - Compute the Response Value Derivative at the specified Predictor Ordinate. - * - * @author Lakshmi Krishnamurthy - */ - -public interface BasisEvaluator { - - /** - * Retrieve the number of Segment's Basis Functions - * - * @return The Number of Segment's Basis Functions - */ - - public abstract int numBasis(); - - /** - * Set the Inelastics that provides the enveloping Context the Basis Evaluation - * - * @param ics The Inelastic Settings - * - * @return TRUE - The inelastics has been set - */ - - public abstract boolean setContainingInelastics ( - final org.drip.spline.segment.LatentStateInelastic ics); - - /** - * Clone/Replicate the current Basis Evaluator Instance - * - * @return TRUE - The Replicated Basis Evaluator Instance - */ - - public abstract BasisEvaluator replicate(); - - /** - * Compute the Response Value of the indexed Basis Function at the specified Predictor Ordinate - * - * @param dblPredictorOrdinate The specified Predictor Ordinate - * @param iBasisFunctionIndex Index representing the Basis Function in the Basis Function Set - * - * @return The Response Value of the indexed Basis Function at the specified Predictor Ordinate - * - * @throws java.lang.Exception Thrown if the Ordered Derivative cannot be computed - */ - - public abstract double shapedBasisFunctionResponse ( - final double dblPredictorOrdinate, - final int iBasisFunctionIndex) - throws java.lang.Exception; - - /** - * Compute the Basis Function Value at the specified Predictor Ordinate - * - * @param adblResponseBasisCoeff Array of the Response Basis Coefficients - * @param dblPredictorOrdinate The specified Predictor Ordinate - * - * @return The Basis Function Value - * - * @throws java.lang.Exception Thrown if the Basis Function Value cannot be computed - */ - - public abstract double unshapedResponseValue ( - final double[] adblResponseBasisCoeff, - final double dblPredictorOrdinate) - throws java.lang.Exception; - - /** - * Compute the Response Value at the specified Predictor Ordinate - * - * @param adblResponseBasisCoeff Array of the Response Basis Coefficients - * @param dblPredictorOrdinate The specified Predictor Ordinate - * - * @return The Response Value - * - * @throws java.lang.Exception Thrown if the Basis Function Value cannot be computed - */ - - public abstract double responseValue ( - final double[] adblResponseBasisCoeff, - final double dblPredictorOrdinate) - throws java.lang.Exception; - - /** - * Compute the Ordered Derivative of the Response Value off of the indexed Basis Function at the - * specified Predictor Ordinate - * - * @param dblPredictorOrdinate The specified Predictor Ordinate - * @param iOrder Order of the Derivative - * @param iBasisFunctionIndex Index representing the Basis Function in the Basis Function Set - * - * @return The Ordered Derivative of the Response Value off of the Indexed Basis Function - * - * @throws java.lang.Exception Thrown if the Ordered Derivative cannot be computed - */ - - public abstract double shapedBasisFunctionDerivative ( - final double dblPredictorOrdinate, - final int iOrder, - final int iBasisFunctionIndex) - throws java.lang.Exception; - - /** - * Compute the Ordered Derivative of the Response Value off of the Basis Function Set at the specified - * Predictor Ordinate - * - * @param adblResponseBasisCoeff Array of the Response Basis Coefficients - * @param dblPredictorOrdinate The specified Predictor Ordinate - * @param iOrder Order of the Derivative - * - * @return The Ordered Derivative of the Response Value off of the Basis Function Set - * - * @throws java.lang.Exception Thrown if the Ordered Derivative of the Basis Function Set cannot be - * computed - */ - - public abstract double unshapedBasisFunctionDerivative ( - final double[] adblResponseBasisCoeff, - final double dblPredictorOrdinate, - final int iOrder) - throws java.lang.Exception; - - /** - * Compute the Response Value Derivative at the specified Predictor Ordinate - * - * @param adblResponseBasisCoeff Array of the Response Basis Coefficients - * @param dblPredictorOrdinate The specified Predictor Ordinate - * @param iOrder Order of the Derivative - * - * @return The Response Value Derivative - * - * @throws java.lang.Exception Thrown if the Response Value Derivative cannot be computed - */ - - public abstract double responseValueDerivative ( - final double[] adblResponseBasisCoeff, - final double dblPredictorOrdinate, - final int iOrder) - throws java.lang.Exception; -} diff --git a/org/drip/spline/segment/BestFitFlexurePenalizer.java b/org/drip/spline/segment/BestFitFlexurePenalizer.java deleted file mode 100644 index 5362e82..0000000 --- a/org/drip/spline/segment/BestFitFlexurePenalizer.java +++ /dev/null @@ -1,270 +0,0 @@ - -package org.drip.spline.segment; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * This Class implements the Segment's Best Fit, Curvature, and Length Penalizers. It provides the - * following functionality: - * - Compute the Cross-Curvature Penalty for the given Basis Pair. - * - Compute the Cross-Length Penalty for the given Basis Pair. - * - Compute the Best Fit Cross-Product Penalty for the given Basis Pair. - * - Compute the Basis Pair Penalty Coefficient for the Best Fit and the Curvature Penalties. - * - Compute the Penalty Constraint for the Basis Pair. - * - * @author Lakshmi Krishnamurthy - */ - -public class BestFitFlexurePenalizer { - private org.drip.spline.segment.BasisEvaluator _lbe = null; - private org.drip.spline.segment.LatentStateInelastic _ics = null; - private org.drip.spline.params.SegmentBestFitResponse _sbfr = null; - private org.drip.spline.params.SegmentFlexurePenaltyControl _sfpcLength = null; - private org.drip.spline.params.SegmentFlexurePenaltyControl _sfpcCurvature = null; - - /** - * BestFitFlexurePenalizer constructor - * - * @param ics Segment Inelastics - * @param sfpcCurvature Curvature Penalty Parameters - * @param sfpcLength Length Penalty Parameters - * @param sbfr Best Fit Weighted Response - * @param lbe The Local Basis Evaluator - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BestFitFlexurePenalizer ( - final org.drip.spline.segment.LatentStateInelastic ics, - final org.drip.spline.params.SegmentFlexurePenaltyControl sfpcCurvature, - final org.drip.spline.params.SegmentFlexurePenaltyControl sfpcLength, - final org.drip.spline.params.SegmentBestFitResponse sbfr, - final org.drip.spline.segment.BasisEvaluator lbe) - throws java.lang.Exception - { - if (null == (_lbe = lbe) || null == (_ics = ics)) - throw new java.lang.Exception ("BestFitFlexurePenalizer ctr: Invalid Inputs"); - - _sbfr = sbfr; - _sfpcLength = sfpcLength; - _sfpcCurvature = sfpcCurvature; - } - - /** - * Compute the Cross-Curvature Penalty for the given Basis Pair - * - * @param iBasisIndexI I Basis Index (I is the Summation Index) - * @param iBasisIndexR R Basis Index (R is the Separator Index) - * - * @return The Cross-Curvature Penalty for the given Basis Pair - * - * @throws java.lang.Exception Thrown if the Cross-Curvature Penalty cannot be computed - */ - - public double basisPairCurvaturePenalty ( - final int iBasisIndexI, - final int iBasisIndexR) - throws java.lang.Exception - { - if (null == _sfpcCurvature) return 0.; - - org.drip.function.definition.R1ToR1 au = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblVariate) - throws Exception - { - int iOrder = _sfpcCurvature.derivativeOrder(); - - return _lbe.shapedBasisFunctionDerivative (dblVariate, iOrder, iBasisIndexI) * - _lbe.shapedBasisFunctionDerivative (dblVariate, iOrder, iBasisIndexR); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - return org.drip.quant.calculus.R1ToR1Integrator.Boole (this, dblBegin, dblEnd); - } - }; - - return _sfpcCurvature.amplitude() * au.integrate (_ics.left(), _ics.right()); - } - - /** - * Compute the Cross-Length Penalty for the given Basis Pair - * - * @param iBasisIndexI I Basis Index (I is the Summation Index) - * @param iBasisIndexR R Basis Index (R is the Separator Index) - * - * @return The Cross-Length Penalty for the given Basis Pair - * - * @throws java.lang.Exception Thrown if the Cross-Length Penalty cannot be computed - */ - - public double basisPairLengthPenalty ( - final int iBasisIndexI, - final int iBasisIndexR) - throws java.lang.Exception - { - if (null == _sfpcLength) return 0.; - - org.drip.function.definition.R1ToR1 au = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblVariate) - throws Exception - { - int iOrder = _sfpcLength.derivativeOrder(); - - return _lbe.shapedBasisFunctionDerivative (dblVariate, iOrder, iBasisIndexI) * - _lbe.shapedBasisFunctionDerivative (dblVariate, iOrder, iBasisIndexR); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - return org.drip.quant.calculus.R1ToR1Integrator.Boole (this, dblBegin, dblEnd); - } - }; - - return _sfpcLength.amplitude() * au.integrate (_ics.left(), _ics.right()); - } - - /** - * Compute the Best Fit Cross-Product Penalty for the given Basis Pair - * - * @param iBasisIndexI I Basis Index (I is the Summation Index) - * @param iBasisIndexR R Basis Index (R is the Separator Index) - * - * @return The Best Fit Cross-Product Penalty for the given Basis Pair - * - * @throws java.lang.Exception Thrown if the Best Fit Cross-Product Penalty cannot be computed - */ - - public double basisBestFitPenalty ( - final int iBasisIndexI, - final int iBasisIndexR) - throws java.lang.Exception - { - if (null == _sbfr) return 0.; - - int iNumPoint = _sbfr.numPoint(); - - if (0 == iNumPoint) return 0.; - - double dblBasisPairFitnessPenalty = 0.; - - for (int i = 0; i < iNumPoint; ++i) { - double dblPredictorOrdinate = _sbfr.predictorOrdinate (i); - - dblBasisPairFitnessPenalty += _sbfr.weight (i) * _lbe.shapedBasisFunctionResponse - (dblPredictorOrdinate, iBasisIndexI) * _lbe.shapedBasisFunctionResponse - (dblPredictorOrdinate, iBasisIndexR); - } - - return dblBasisPairFitnessPenalty / iNumPoint; - } - - /** - * Compute the Basis Pair Penalty Coefficient for the Best Fit and the Curvature Penalties - * - * @param iBasisIndexI I Basis Index (I is the Summation Index) - * @param iBasisIndexR R Basis Index (R is the Separator Index) - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - * - * @return The Basis Pair Penalty Coefficient for the Fitness and the Curvature Penalties - */ - - public double basisPairConstraintCoefficient ( - final int iBasisIndexI, - final int iBasisIndexR) - throws java.lang.Exception - { - return basisPairCurvaturePenalty (iBasisIndexI, iBasisIndexR) + basisPairLengthPenalty (iBasisIndexI, - iBasisIndexR) + basisBestFitPenalty (iBasisIndexI, iBasisIndexR); - } - - /** - * Compute the Penalty Constraint for the Basis Pair - * - * @param iBasisIndexR R Basis Index (R is the Separator Index) - * - * @return Penalty Constraint for the Basis Pair - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public double basisPairPenaltyConstraint ( - final int iBasisIndexR) - throws java.lang.Exception - { - if (null == _sbfr) return 0.; - - int iNumPoint = _sbfr.numPoint(); - - if (0 == iNumPoint) return 0.; - - double dblBasisPairPenaltyConstraint = 0.; - - for (int i = 0; i < iNumPoint; ++i) { - double dblPredictorOrdinate = _sbfr.predictorOrdinate (i); - - dblBasisPairPenaltyConstraint += _sbfr.weight (i) * _lbe.shapedBasisFunctionResponse - (dblPredictorOrdinate, iBasisIndexR) * _sbfr.response (i); - } - - return dblBasisPairPenaltyConstraint / iNumPoint; - } -} diff --git a/org/drip/spline/segment/LatentStateInelastic.java b/org/drip/spline/segment/LatentStateInelastic.java deleted file mode 100644 index 583cf16..0000000 --- a/org/drip/spline/segment/LatentStateInelastic.java +++ /dev/null @@ -1,201 +0,0 @@ - -package org.drip.spline.segment; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * This class contains the spline segment in-elastic fields - in this case the start/end ranges. It exports - * the following functions: - * - Retrieve the Segment Left/Right Predictor Ordinate - * - Find out if the Predictor Ordinate is inside the segment - inclusive of left/right. - * - Get the Width of the Predictor Ordinate in this Segment - * - Transform the Predictor Ordinate to the Local Segment Predictor Ordinate - * - Transform the Local Predictor Ordinate to the Segment Ordinate - * - * @author Lakshmi Krishnamurthy - */ - -public class LatentStateInelastic implements java.lang.Comparable { - private double _dblPredictorOrdinateLeft = java.lang.Double.NaN; - private double _dblPredictorOrdinateRight = java.lang.Double.NaN; - - /** - * LatentStateInelastic constructor - * - * @param dblPredictorOrdinateLeft Segment Predictor Ordinate Left - * @param dblPredictorOrdinateRight Segment Predictor Ordinate Right - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public LatentStateInelastic ( - final double dblPredictorOrdinateLeft, - final double dblPredictorOrdinateRight) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblPredictorOrdinateLeft = dblPredictorOrdinateLeft) - || !org.drip.quant.common.NumberUtil.IsValid (_dblPredictorOrdinateRight = - dblPredictorOrdinateRight) || _dblPredictorOrdinateLeft >= _dblPredictorOrdinateRight) - throw new java.lang.Exception ("LatentStateInelastic ctr: Invalid inputs!"); - } - - /** - * Retrieve the Segment Left Predictor Ordinate - * - * @return Segment Left Predictor Ordinate - */ - - public double left() - { - return _dblPredictorOrdinateLeft; - } - - /** - * Retrieve the Segment Right Predictor Ordinate - * - * @return Segment Right Predictor Ordinate - */ - - public double right() - { - return _dblPredictorOrdinateRight; - } - - /** - * Find out if the Predictor Ordinate is inside the segment - inclusive of left/right. - * - * @param dblPredictorOrdinate Predictor Ordinate - * - * @return TRUE - Predictor Ordinate is inside the segment - * - * @throws java.lang.Exception Thrown if the input is invalid - */ - - public boolean in ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorOrdinate)) - throw new java.lang.Exception ("LatentStateInelastic::in => Invalid Inputs"); - - return _dblPredictorOrdinateLeft <= dblPredictorOrdinate && _dblPredictorOrdinateRight >= - dblPredictorOrdinate; - } - - /** - * Get the Width of the Predictor Ordinate in this Segment - * - * @return Segment Width - */ - - public double width() - { - return _dblPredictorOrdinateRight - _dblPredictorOrdinateLeft; - } - - /** - * Transform the Predictor Ordinate to the Local Segment Predictor Ordinate - * - * @param dblPredictorOrdinate The Global Predictor Ordinate - * - * @return Local Segment Predictor Ordinate - * - * @throws java.lang.Exception Thrown if the input is invalid - */ - - public double localize ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - if (!in (dblPredictorOrdinate)) - throw new java.lang.Exception ("LatentStateInelastic::localize: Invalid inputs!"); - - return (dblPredictorOrdinate - _dblPredictorOrdinateLeft) / (_dblPredictorOrdinateRight - - _dblPredictorOrdinateLeft); - } - - /** - * Transform the Local Predictor Ordinate to the Segment Ordinate - * - * @param dblLocalPredictorOrdinate The Local Segment Predictor Ordinate - * - * @return The Segment Ordinate - * - * @throws java.lang.Exception Thrown if the input is invalid - */ - - public double delocalize ( - final double dblLocalPredictorOrdinate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblLocalPredictorOrdinate)) - throw new java.lang.Exception ("LatentStateInelastic::delocalize => Invalid Inputs"); - - return _dblPredictorOrdinateLeft + dblLocalPredictorOrdinate * (_dblPredictorOrdinateRight - - _dblPredictorOrdinateLeft); - } - - @Override public int hashCode() - { - long lBits = java.lang.Double.doubleToLongBits ((int) _dblPredictorOrdinateLeft); - - return (int) (lBits ^ (lBits >>> 32)); - } - - @Override public int compareTo ( - final org.drip.spline.segment.LatentStateInelastic ieOther) - { - if (_dblPredictorOrdinateLeft > ieOther._dblPredictorOrdinateLeft) return 1; - - if (_dblPredictorOrdinateLeft < ieOther._dblPredictorOrdinateLeft) return -1; - - return 0; - } -} diff --git a/org/drip/spline/segment/LatentStateManifestSensitivity.java b/org/drip/spline/segment/LatentStateManifestSensitivity.java deleted file mode 100644 index 2881e96..0000000 --- a/org/drip/spline/segment/LatentStateManifestSensitivity.java +++ /dev/null @@ -1,202 +0,0 @@ - -package org.drip.spline.segment; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * LatentStateManifestSensitivity contains the Manifest Sensitivity generation control parameters and the - * Manifest Sensitivity outputs related to the given Segment. - * - * @author Lakshmi Krishnamurthy - */ - -public class LatentStateManifestSensitivity { - private double[] _adblDBasisCoeffDLocalManifest = null; - private double[] _adblDBasisCoeffDPreceedingManifest = null; - private double _dblDResponseDPreceedingManifest = java.lang.Double.NaN; - private org.drip.spline.params.PreceedingManifestSensitivityControl _pmsc = null; - - /** - * LatentStateManifestSensitivity constructor - * - * @param pmsc The Preceeding Manifest Measure Sensitivity Control Parameters - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public LatentStateManifestSensitivity ( - final org.drip.spline.params.PreceedingManifestSensitivityControl pmsc) - throws java.lang.Exception - { - if (null == (_pmsc = pmsc)) - _pmsc = new org.drip.spline.params.PreceedingManifestSensitivityControl (true, 0, null); - } - - /** - * Set the Array containing the Sensitivities of the Basis Coefficients to the Local Manifest Measure - * - * @param adblDBasisCoeffDLocalManifest The Array containing the Sensitivities of the Basis Coefficients - * to the Local Manifest Measure - * - * @return TRUE - Basis Coefficient Manifest Measure Sensitivity Array Entries successfully set - */ - - public boolean setDBasisCoeffDLocalManifest ( - final double[] adblDBasisCoeffDLocalManifest) - { - if (null == adblDBasisCoeffDLocalManifest) return false; - - int iNumCoeff = adblDBasisCoeffDLocalManifest.length; - _adblDBasisCoeffDLocalManifest = new double[iNumCoeff]; - - if (0 == iNumCoeff) return false; - - for (int i = 0; i < iNumCoeff; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (_adblDBasisCoeffDLocalManifest[i] = - adblDBasisCoeffDLocalManifest[i])) - return false; - } - - return true; - } - - /** - * Get the Array containing the Sensitivities of the Basis Coefficients to the Local Manifest Measure - * - * @return The Array containing the Sensitivities of the Basis Coefficients to the Local Manifest Measure - */ - - public double[] getDBasisCoeffDLocalManifest() - { - return _adblDBasisCoeffDLocalManifest; - } - - /** - * Set the Array containing the Sensitivities of the Basis Coefficients to the Preceeding Manifest - * Measure - * - * @param adblDBasisCoeffDPreceedingManifest The Array containing the Sensitivities of the Basis - * Coefficients to the Preceeding Manifest Measure - * - * @return TRUE - Array Entries successfully set - */ - - public boolean setDBasisCoeffDPreceedingManifest ( - final double[] adblDBasisCoeffDPreceedingManifest) - { - if (null == adblDBasisCoeffDPreceedingManifest) return false; - - int iNumCoeff = adblDBasisCoeffDPreceedingManifest.length; - _adblDBasisCoeffDPreceedingManifest= new double[iNumCoeff]; - - if (0 == iNumCoeff) return false; - - for (int i = 0; i < iNumCoeff; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (_adblDBasisCoeffDPreceedingManifest[i] = - adblDBasisCoeffDPreceedingManifest[i])) - return false; - } - - return true; - } - - /** - * Get the Array containing the Sensitivities of the Basis Coefficients to the Preceeding Manifest - * Measure - * - * @return The Array containing the Sensitivities of the Basis Coefficients to the Preceeding Manifest - * Measure - */ - - public double[] getDBasisCoeffDPreceedingManifest() - { - return _adblDBasisCoeffDPreceedingManifest; - } - - /** - * Set the Sensitivity of the Segment Response to the Preceeding Manifest Measure - * - * @param dblDResponseDPreceedingManifest Sensitivity of the Segment Response to the Preceeding Manifest - * Measure - * - * @return TRUE - Sensitivity of the Segment Response to the Preceeding Manifest Measure successfully - * set - */ - - public boolean setDResponseDPreceedingManifest ( - final double dblDResponseDPreceedingManifest) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblDResponseDPreceedingManifest)) return false; - - _dblDResponseDPreceedingManifest = dblDResponseDPreceedingManifest; - return true; - } - - /** - * Get the Sensitivity of the Segment Response to the Preceeding Manifest Measure - * - * @return The Sensitivity of the Segment Response to the Preceeding Manifest Measure - */ - - public double getDResponseDPreceedingManifest() - { - return _dblDResponseDPreceedingManifest; - } - - /** - * Get the Preceeding Manifest Measure Sensitivity Control Parameters - * - * @return The Preceeding Manifest Measure Sensitivity Control Parameters - */ - - public org.drip.spline.params.PreceedingManifestSensitivityControl getPMSC() - { - return _pmsc; - } -} diff --git a/org/drip/spline/segment/LatentStateResponseModel.java b/org/drip/spline/segment/LatentStateResponseModel.java deleted file mode 100644 index a52a60b..0000000 --- a/org/drip/spline/segment/LatentStateResponseModel.java +++ /dev/null @@ -1,1683 +0,0 @@ - -package org.drip.spline.segment; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * LatentStateResponseModel implements the single segment basis calibration and inference functionality. It - * exports the following functionality: - * - Build the LatentStateResponseModel instance from the Basis Function/Shape Controller Set. - * - Build the LatentStateResponseModel instance from the Basis Evaluator Set. - * - Retrieve the Number of Parameters, Basis Evaluator, Array of the Response Basis Coefficients, and - * Segment Design Inelastic Control. - * - Calibrate the Segment State from the Calibration Parameter Set. - * - Sensitivity Calibrator: Calibrate the Segment Manifest Jacobian from the Calibration Parameter Set. - * - Calibrate the coefficients from the prior Predictor/Response Segment, the Constraint, and fitness - * Weights - * - Calibrate the coefficients from the prior Segment and the Response Value at the Right Predictor - * Ordinate. - * - Calibrate the Coefficients from the Edge Response Values and the Left Edge Response Slope. - * - Calibrate the coefficients from the Left Edge Response Value Constraint, the Left Edge Response Value - * Slope, and the Right Edge Response Value Constraint. - * - Retrieve the Segment Curvature, Length, and the Best Fit DPE. - * - Calculate the Response Value and its Derivative at the given Predictor Ordinate. - * - Calculate the Ordered Derivative of the Coefficient to the Manifest. - * - Calculate the Jacobian of the Segment's Response Basis Function Coefficients to the Edge Inputs. - * - Calculate the Jacobian of the Response to the Edge Inputs at the given Predictor Ordinate. - * - Calculate the Jacobian of the Response to the Basis Coefficients at the given Predictor Ordinate. - * - Calibrate the segment and calculate the Jacobian of the Segment's Response Basis Function Coefficients - * to the Edge Parameters. - * - Calibrate the Coefficients from the Edge Response Values and the Left Edge Response Value Slope and - * calculate the Jacobian of the Segment's Response Basis Function Coefficients to the Edge Parameters. - * - Calibrate the coefficients from the prior Segment and the Response Value at the Right Predictor - * Ordinate and calculate the Jacobian of the Segment's Response Basis Function Coefficients to the Edge - * Parameters. - * - Indicate whether the given segment is monotone. If monotone, may optionally indicate the nature of the - * extrema contained inside (maxima/minima/infection). - * - Clip the part of the Segment to the Right of the specified Predictor Ordinate. Retain all other - * constraints the same. - * - Clip the part of the Segment to the Left of the specified Predictor Ordinate. Retain all other - * constraints the same. - * - Display the string representation for diagnostic purposes. - * - * @author Lakshmi Krishnamurthy - */ - -public class LatentStateResponseModel extends org.drip.spline.segment.LatentStateInelastic { - - /** - * LEFT NODE VALUE PARAMETER INDEX - */ - - public static final int LEFT_NODE_VALUE_PARAMETER_INDEX = 0; - - /** - * RIGHT NODE VALUE PARAMETER INDEX - */ - - public static final int RIGHT_NODE_VALUE_PARAMETER_INDEX = 1; - - private double[] _adblResponseBasisCoeff = null; - private org.drip.spline.segment.BasisEvaluator _be = null; - private double[][] _aadblDResponseBasisCoeffDConstraint = null; - private org.drip.spline.params.SegmentInelasticDesignControl _sidc = null; - private org.drip.quant.calculus.WengertJacobian _wjDBasisCoeffDEdgeValue = null; - - private - org.drip.analytics.support.CaseInsensitiveHashMap - _mapLSMS = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - /** - * Build the LatentStateResponseModel instance from the Basis Function/Shape Controller Set - * - * @param dblLeftPredictorOrdinate Left Predictor Ordinate - * @param dblRightPredictorOrdinate Right Predictor Ordinate - * @param fs Response Basis Function Set - * @param rssc Shape Controller - * @param sidc Segment Inelastic Design Parameters - * - * @return Instance of LatentStateResponseModel - */ - - public static final org.drip.spline.segment.LatentStateResponseModel Create ( - final double dblLeftPredictorOrdinate, - final double dblRightPredictorOrdinate, - final org.drip.spline.basis.FunctionSet fs, - final org.drip.spline.params.ResponseScalingShapeControl rssc, - final org.drip.spline.params.SegmentInelasticDesignControl sidc) - { - try { - org.drip.spline.segment.SegmentBasisEvaluator sbe = new - org.drip.spline.segment.SegmentBasisEvaluator (fs, rssc); - - org.drip.spline.segment.LatentStateResponseModel lsrm = new - org.drip.spline.segment.LatentStateResponseModel (dblLeftPredictorOrdinate, - dblRightPredictorOrdinate, sbe, sidc); - - return sbe.setContainingInelastics (lsrm) ? lsrm : null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Build the LatentStateResponseModel instance from the Basis Evaluator Set - * - * @param dblLeftPredictorOrdinate Left Predictor Ordinate - * @param dblRightPredictorOrdinate Right Predictor Ordinate - * @param be Basis Evaluator - * @param sidc Segment Inelastic Design Parameters - * - * @return Instance of LatentStateResponseModel - */ - - public static final org.drip.spline.segment.LatentStateResponseModel Create ( - final double dblLeftPredictorOrdinate, - final double dblRightPredictorOrdinate, - final org.drip.spline.segment.BasisEvaluator be, - final org.drip.spline.params.SegmentInelasticDesignControl sidc) - { - try { - org.drip.spline.segment.LatentStateResponseModel lsrm = new - org.drip.spline.segment.LatentStateResponseModel (dblLeftPredictorOrdinate, - dblRightPredictorOrdinate, be, sidc); - - return be.setContainingInelastics (lsrm) ? lsrm : null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private LatentStateResponseModel ( - final double dblLeftPredictorOrdinate, - final double dblRightPredictorOrdinate, - final org.drip.spline.segment.BasisEvaluator be, - final org.drip.spline.params.SegmentInelasticDesignControl sidc) - throws java.lang.Exception - { - super (dblLeftPredictorOrdinate, dblRightPredictorOrdinate); - - if (null == (_be = be) || null == (_sidc = sidc)) - throw new java.lang.Exception ("LatentStateResponseModel ctr: Invalid Basis Functions!"); - - int iNumBasis = _be.numBasis(); - - _adblResponseBasisCoeff = new double[iNumBasis]; - - if (0 >= iNumBasis || _sidc.Ck() > iNumBasis - 2) - throw new java.lang.Exception ("LatentStateResponseModel ctr: Invalid inputs!"); - } - - private double[] DResponseDBasisCoeff ( - final double dblPredictorOrdinate, - final int iOrder) - { - if (0 == iOrder) return null; - - int iNumBasis = _be.numBasis(); - - double[] adblDResponseDBasisCoeff = new double[iNumBasis]; - - for (int i = 0; i < iNumBasis; ++i) { - try { - adblDResponseDBasisCoeff[i] = 1 == iOrder ? _be.shapedBasisFunctionResponse - (dblPredictorOrdinate, i) : 0.; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return adblDResponseDBasisCoeff; - } - - private double[] transmissionCk ( - final double dblPredictorOrdinate, - final org.drip.spline.segment.LatentStateResponseModel csPreceeding, - final int iCk) - { - double[] adblDeriv = new double[iCk]; - - for (int i = 0; i < iCk; ++i) { - try { - adblDeriv[i] = csPreceeding.calcResponseValueDerivative (dblPredictorOrdinate, i + 1); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return adblDeriv; - } - - private org.drip.spline.segment.LatentStateManifestSensitivity manifestSensitivity ( - final java.lang.String strManifestMeasure) - { - return null == strManifestMeasure || strManifestMeasure.isEmpty() || !_mapLSMS.containsKey - (strManifestMeasure) ? null : _mapLSMS.get (strManifestMeasure); - } - - private double[] CkDBasisCoeffDPreceedingManifestMeasure ( - final java.lang.String strManifestMeasure) - { - org.drip.spline.segment.LatentStateManifestSensitivity lsms = manifestSensitivity - (strManifestMeasure); - - if (null == lsms) return null; - - int iCk = lsms.getPMSC().Ck(); - - if (0 == iCk) return null; - - double[] adblDBasisCoeffDPreceedingManifestTail = new double[iCk]; - - for (int i = 0; i < iCk; ++i) - adblDBasisCoeffDPreceedingManifestTail[i] = 0.; - - return adblDBasisCoeffDPreceedingManifestTail; - } - - /** - * Set the Preceeding Manifest Sensitivity Control Parameters for the specified Manifest Measure - * - * @param strManifestMeasure The Manifest Measure - * @param pmsc The Preceeding Manifest Sensitivity Control Instance - * - * @return TRUE - Named Preceeding Manifest Sensitivity Control Instance Successfully Set - */ - - public boolean setPreceedingManifestSensitivityControl ( - final java.lang.String strManifestMeasure, - final org.drip.spline.params.PreceedingManifestSensitivityControl pmsc) - { - if (null == strManifestMeasure || strManifestMeasure.isEmpty()) return false; - - try { - _mapLSMS.put (strManifestMeasure, new org.drip.spline.segment.LatentStateManifestSensitivity - (pmsc)); - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - /** - * Retrieve the Number of Parameters - * - * @return The Number of Parameters - */ - - public int numParameters() - { - return _sidc.Ck() + 2; - } - - /** - * Retrieve the Basis Evaluator - * - * @return The Basis Evaluator - */ - - public org.drip.spline.segment.BasisEvaluator basisEvaluator() - { - return _be; - } - - /** - * Retrieve the Array of Response Basis Coefficients - * - * @return The Array of Response Basis Coefficients - */ - - public double[] responseBasisCoefficient() - { - return _adblResponseBasisCoeff; - } - - /** - * Retrieve the Segment Inelastic Design Control - * - * @return The Segment Inelastic Design Control - */ - - public org.drip.spline.params.SegmentInelasticDesignControl designControl() - { - return _sidc; - } - - /** - * Main Calibrator: Calibrate the Segment State from the Calibration Parameter Set - * - * @param ssciState The Segment State Calibration Inputs Set - * - * @return TRUE - Calibration Successful - */ - - public boolean calibrateState ( - final org.drip.spline.params.SegmentStateCalibrationInputs ssciState) - { - if (null == ssciState) return false; - - double[] adblPredictorOrdinate = ssciState.predictorOrdinates(); - - double[] adblResponseValue = ssciState.responseValues(); - - double[] adblLeftEdgeDeriv = ssciState.leftEdgeDeriv(); - - double[] adblRightEdgeDeriv = ssciState.rightEdgeDeriv(); - - org.drip.spline.params.SegmentBestFitResponse sbfr = ssciState.bestFitResponse(); - - org.drip.spline.params.SegmentBasisFlexureConstraint[] aSBFC = ssciState.flexureConstraint(); - - int iNumConstraint = 0; - int iNumResponseBasisCoeff = _adblResponseBasisCoeff.length; - int iNumLeftDeriv = null == adblLeftEdgeDeriv ? 0 : adblLeftEdgeDeriv.length; - int iNumRightDeriv = null == adblRightEdgeDeriv ? 0 : adblRightEdgeDeriv.length; - double[] adblPredictorResponseConstraintValue = new double[iNumResponseBasisCoeff]; - int iNumPredictorOrdinate = null == adblPredictorOrdinate ? 0 : adblPredictorOrdinate.length; - double[][] aadblResponseBasisCoeffConstraint = new - double[iNumResponseBasisCoeff][iNumResponseBasisCoeff]; - - if (null != aSBFC) { - int iNumPotentialConstraint = aSBFC.length; - - for (int i = 0; i < iNumPotentialConstraint; ++i) { - if (null != aSBFC[i]) ++iNumConstraint; - } - } - - if (iNumResponseBasisCoeff < iNumPredictorOrdinate + iNumLeftDeriv + iNumRightDeriv + iNumConstraint) - return false; - - try { - org.drip.spline.segment.BestFitFlexurePenalizer bffp = new - org.drip.spline.segment.BestFitFlexurePenalizer (this, _sidc.curvaturePenaltyControl(), - _sidc.lengthPenaltyControl(), sbfr, _be); - - for (int j = 0; j < iNumResponseBasisCoeff; ++j) { - if (j < iNumPredictorOrdinate) - adblPredictorResponseConstraintValue[j] = adblResponseValue[j]; - else if (j < iNumPredictorOrdinate + iNumConstraint) - adblPredictorResponseConstraintValue[j] = aSBFC[j - - iNumPredictorOrdinate].contraintValue(); - else if (j < iNumPredictorOrdinate + iNumConstraint + iNumLeftDeriv) - adblPredictorResponseConstraintValue[j] = adblLeftEdgeDeriv[j - iNumPredictorOrdinate - - iNumConstraint]; - else if (j < iNumPredictorOrdinate + iNumConstraint + iNumLeftDeriv + iNumRightDeriv) - adblPredictorResponseConstraintValue[j] = adblRightEdgeDeriv[j - iNumPredictorOrdinate - - iNumConstraint - iNumLeftDeriv]; - else - adblPredictorResponseConstraintValue[j] = bffp.basisPairPenaltyConstraint (j); - } - - for (int i = 0; i < iNumResponseBasisCoeff; ++i) { - for (int l = 0; l < iNumResponseBasisCoeff; ++l) { - double[] adblCalibBasisConstraintWeight = null; - - if (0 != iNumConstraint && (l >= iNumPredictorOrdinate && l < iNumPredictorOrdinate + - iNumConstraint)) - adblCalibBasisConstraintWeight = aSBFC[l - - iNumPredictorOrdinate].responseBasisCoeffWeights(); - - if (l < iNumPredictorOrdinate) - aadblResponseBasisCoeffConstraint[l][i] = _be.shapedBasisFunctionResponse - (adblPredictorOrdinate[l], i); - else if (l < iNumPredictorOrdinate + iNumConstraint) - aadblResponseBasisCoeffConstraint[l][i] = adblCalibBasisConstraintWeight[i]; - else if (l < iNumPredictorOrdinate + iNumConstraint + iNumLeftDeriv) - aadblResponseBasisCoeffConstraint[l][i] = _be.shapedBasisFunctionDerivative (left(), - l - iNumPredictorOrdinate - iNumConstraint + 1, i); - else if (l < iNumPredictorOrdinate + iNumConstraint + iNumLeftDeriv + iNumRightDeriv) - aadblResponseBasisCoeffConstraint[l][i] = _be.shapedBasisFunctionDerivative - (right(), l - iNumPredictorOrdinate - iNumConstraint - iNumLeftDeriv + 1, i); - else - aadblResponseBasisCoeffConstraint[l][i] = bffp.basisPairConstraintCoefficient (i, l); - } - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - org.drip.quant.linearalgebra.LinearizationOutput lo = - org.drip.quant.linearalgebra.LinearSystemSolver.SolveUsingMatrixInversion - (aadblResponseBasisCoeffConstraint, adblPredictorResponseConstraintValue); - - if (null == lo) return false; - - double[] adblCalibResponseBasisCoeff = lo.getTransformedRHS(); - - if (null == adblCalibResponseBasisCoeff || adblCalibResponseBasisCoeff.length != - iNumResponseBasisCoeff || null == (_aadblDResponseBasisCoeffDConstraint = - lo.getTransformedMatrix()) || _aadblDResponseBasisCoeffDConstraint.length != - iNumResponseBasisCoeff || _aadblDResponseBasisCoeffDConstraint[0].length != - iNumResponseBasisCoeff) - return false; - - for (int i = 0; i < iNumResponseBasisCoeff; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (_adblResponseBasisCoeff[i] = - adblCalibResponseBasisCoeff[i])) - return false; - } - - return true; - } - - /** - * Sensitivity Calibrator: Calibrate the Segment Manifest Measure Jacobian from the Calibration Inputs - * - * @param ssciManifestSensitivity The Segment Manifest Calibration Sensitivity Inputs - * @param aSBFCState Array of Segment State Basis Flexure Constraints - * - * @return The Manifest Sensitivity Coefficients - */ - - public double[] calibrateManifestJacobian ( - final org.drip.spline.params.SegmentStateCalibrationInputs ssciManifestSensitivity, - final org.drip.spline.params.SegmentBasisFlexureConstraint[] aSBFCState) - { - if (null == ssciManifestSensitivity) return null; - - double[] adblPredictorOrdinate = ssciManifestSensitivity.predictorOrdinates(); - - double[] adblResponseValueManifestSensitivity = ssciManifestSensitivity.responseValues(); - - double[] adblLeftEdgeDerivManifestSensitivity = ssciManifestSensitivity.leftEdgeDeriv(); - - double[] adblRightEdgeDerivManifestSensitivity = ssciManifestSensitivity.rightEdgeDeriv(); - - org.drip.spline.params.SegmentBestFitResponse sbfrManifestSensitivity = - ssciManifestSensitivity.bestFitResponse(); - - org.drip.spline.params.SegmentBasisFlexureConstraint[] aSBFCManifestSensitivity = - ssciManifestSensitivity.flexureConstraint(); - - int iNumConstraint = 0; - int iNumResponseBasisCoeff = _adblResponseBasisCoeff.length; - int iNumPredictorOrdinate = null == adblPredictorOrdinate ? 0 : adblPredictorOrdinate.length; - double[] adblPredictorResponseManifestSensitivityConstraint = new double[iNumResponseBasisCoeff]; - int iNumLeftDerivManifestSensitivity = null == adblLeftEdgeDerivManifestSensitivity ? 0 : - adblLeftEdgeDerivManifestSensitivity.length; - int iNumRightDerivManifestSensitivity = null == adblRightEdgeDerivManifestSensitivity ? 0 : - adblRightEdgeDerivManifestSensitivity.length; - double[][] aadblResponseCoeffConstraintManifestSensitivity = new - double[iNumResponseBasisCoeff][iNumResponseBasisCoeff]; - - if (null != aSBFCState) { - int iNumPotentialConstraint = aSBFCState.length; - - for (int i = 0; i < iNumPotentialConstraint; ++i) { - if (null != aSBFCState[i]) ++iNumConstraint; - } - } - - if (iNumResponseBasisCoeff < iNumPredictorOrdinate + iNumLeftDerivManifestSensitivity + - iNumRightDerivManifestSensitivity + iNumConstraint) - return null; - - try { - org.drip.spline.segment.BestFitFlexurePenalizer bffpManifestSensitivity = new - org.drip.spline.segment.BestFitFlexurePenalizer (this, null == _sidc ? null : - _sidc.curvaturePenaltyControl(), null == _sidc ? null : _sidc.lengthPenaltyControl(), - sbfrManifestSensitivity, _be); - - for (int j = 0; j < iNumResponseBasisCoeff; ++j) { - if (j < iNumPredictorOrdinate) - adblPredictorResponseManifestSensitivityConstraint[j] = - adblResponseValueManifestSensitivity[j]; - else if (j < iNumPredictorOrdinate + iNumConstraint) { - adblPredictorResponseManifestSensitivityConstraint[j] = 0.; - org.drip.spline.params.SegmentBasisFlexureConstraint sbfcManifestSensitivity = - aSBFCManifestSensitivity[j - iNumPredictorOrdinate]; - - if (null != sbfcManifestSensitivity) { - adblPredictorResponseManifestSensitivityConstraint[j] = - sbfcManifestSensitivity.contraintValue(); - - double[] adblCalibConstraintWeightManifestSensitivity = - sbfcManifestSensitivity.responseBasisCoeffWeights(); - - for (int i = 0; i < iNumResponseBasisCoeff; ++i) - adblPredictorResponseManifestSensitivityConstraint[j] -= - _adblResponseBasisCoeff[i] * adblCalibConstraintWeightManifestSensitivity[i]; - } - } else if (j < iNumPredictorOrdinate + iNumConstraint + iNumLeftDerivManifestSensitivity) - adblPredictorResponseManifestSensitivityConstraint[j] = - adblLeftEdgeDerivManifestSensitivity[j - iNumPredictorOrdinate - iNumConstraint]; - else if (j < iNumPredictorOrdinate + iNumConstraint + iNumLeftDerivManifestSensitivity + - iNumRightDerivManifestSensitivity) - adblPredictorResponseManifestSensitivityConstraint[j] = - adblRightEdgeDerivManifestSensitivity[j - iNumPredictorOrdinate - iNumConstraint - - iNumLeftDerivManifestSensitivity]; - else - adblPredictorResponseManifestSensitivityConstraint[j] = - bffpManifestSensitivity.basisPairPenaltyConstraint (j); - } - - for (int i = 0; i < iNumResponseBasisCoeff; ++i) { - for (int l = 0; l < iNumResponseBasisCoeff; ++l) { - double[] adblCalibBasisConstraintWeight = null; - - if (0 != iNumConstraint && (l >= iNumPredictorOrdinate && l < iNumPredictorOrdinate + - iNumConstraint)) - adblCalibBasisConstraintWeight = aSBFCState[l - - iNumPredictorOrdinate].responseBasisCoeffWeights(); - - if (l < iNumPredictorOrdinate) - aadblResponseCoeffConstraintManifestSensitivity[l][i] = - _be.shapedBasisFunctionResponse (adblPredictorOrdinate[l], i); - else if (l < iNumPredictorOrdinate + iNumConstraint) - aadblResponseCoeffConstraintManifestSensitivity[l][i] = - adblCalibBasisConstraintWeight[i]; - else if (l < iNumPredictorOrdinate + iNumConstraint + iNumLeftDerivManifestSensitivity) - aadblResponseCoeffConstraintManifestSensitivity[l][i] = - _be.shapedBasisFunctionDerivative (left(), l - iNumPredictorOrdinate - - iNumConstraint + 1, i); - else if (l < iNumPredictorOrdinate + iNumConstraint + iNumLeftDerivManifestSensitivity + - iNumRightDerivManifestSensitivity) - aadblResponseCoeffConstraintManifestSensitivity[l][i] = - _be.shapedBasisFunctionDerivative (right(), l - iNumPredictorOrdinate - - iNumConstraint - iNumLeftDerivManifestSensitivity + 1, i); - else - aadblResponseCoeffConstraintManifestSensitivity[l][i] = - bffpManifestSensitivity.basisPairConstraintCoefficient (i, l); - } - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.quant.linearalgebra.LinearizationOutput lo = - org.drip.quant.linearalgebra.LinearSystemSolver.SolveUsingMatrixInversion - (aadblResponseCoeffConstraintManifestSensitivity, - adblPredictorResponseManifestSensitivityConstraint); - - return null == lo ? null : lo.getTransformedRHS(); - } - - /** - * Sensitivity Calibrator: Calibrate the Segment Local Manifest Jacobian from the Calibration Parameter - * Set - * - * @param strManifestMeasure Latent State Manifest Measure - * @param ssciManifestSensitivity The Segment Manifest Calibration Parameter Sensitivity - * @param aSBFCState Array of Segment State Basis Flexure Constraints - * - * @return TRUE - Local Manifest Sensitivity Calibration Successful - */ - - public boolean calibrateLocalManifestJacobian ( - final java.lang.String strManifestMeasure, - final org.drip.spline.params.SegmentStateCalibrationInputs ssciManifestSensitivity, - final org.drip.spline.params.SegmentBasisFlexureConstraint[] aSBFCState) - { - org.drip.spline.segment.LatentStateManifestSensitivity lsms = manifestSensitivity - (strManifestMeasure); - - if (null == lsms) return false; - - double[] adblDBasisCoeffDLocalManifest = calibrateManifestJacobian (ssciManifestSensitivity, - aSBFCState); - - return null == adblDBasisCoeffDLocalManifest || adblDBasisCoeffDLocalManifest.length != - _adblResponseBasisCoeff.length ? false : lsms.setDBasisCoeffDLocalManifest - (adblDBasisCoeffDLocalManifest); - } - - /** - * Sensitivity Calibrator: Calibrate the Segment Preceeding Manifest Jacobian from the Calibration - * Parameter Set - * - * @param strManifestMeasure Latent State Manifest - * @param ssciPreceedingManifestSensitivity The Segment Preceeding Manifest Calibration Parameter - * Sensitivity - * - * @return TRUE - Preceeding Manifest Sensitivity Calibration Successful - */ - - public boolean calibratePreceedingManifestJacobian ( - final java.lang.String strManifestMeasure, - final org.drip.spline.params.SegmentStateCalibrationInputs ssciPreceedingManifestSensitivity) - { - org.drip.spline.segment.LatentStateManifestSensitivity lsms = manifestSensitivity - (strManifestMeasure); - - if (null == lsms) return false; - - double[] adblDBasisCoeffDPreceedingManifest = calibrateManifestJacobian - (ssciPreceedingManifestSensitivity, null); - - return null == adblDBasisCoeffDPreceedingManifest || adblDBasisCoeffDPreceedingManifest.length != - _adblResponseBasisCoeff.length ? false : lsms.setDBasisCoeffDPreceedingManifest - (adblDBasisCoeffDPreceedingManifest); - } - - /** - * Calibrate the coefficients from the prior Predictor/Response Segment, the Constraint, and fitness - * Weights - * - * @param csPreceeding Preceeding Predictor/Response Segment - * @param srvcState The Segment State Response Value Constraint - * @param sbfrState Segment's Best Fit Weighted State Response Values - * - * @return TRUE - If the calibration succeeds - */ - - public boolean calibrate ( - final org.drip.spline.segment.LatentStateResponseModel csPreceeding, - final org.drip.spline.params.SegmentResponseValueConstraint srvcState, - final org.drip.spline.params.SegmentBestFitResponse sbfrState) - { - int iCk = _sidc.Ck(); - - org.drip.spline.params.SegmentBasisFlexureConstraint[] aSBFCState = null == srvcState ? null : new - org.drip.spline.params.SegmentBasisFlexureConstraint[] {srvcState.responseIndexedBasisConstraint - (_be, this)}; - - double[] adblManifestJacobianDerivAtLeftOrdinate = null; - - if (0 != iCk) { - adblManifestJacobianDerivAtLeftOrdinate = new double[iCk]; - - for (int i = 0; i < iCk; ++i) - adblManifestJacobianDerivAtLeftOrdinate[i] = 0.; - } - - if (null == csPreceeding) { - try { - double[] adblStateDerivAtLeftOrdinate = null; - - if (0 != iCk) { - adblStateDerivAtLeftOrdinate = new double[iCk]; - - for (int i = 0; i < iCk; ++i) - adblStateDerivAtLeftOrdinate[i] = _be.responseValueDerivative - (_adblResponseBasisCoeff, left(), i); - } - - return calibrateState (new org.drip.spline.params.SegmentStateCalibrationInputs (new double[] - {left()}, new double[] {_be.responseValue (_adblResponseBasisCoeff, left())}, - adblStateDerivAtLeftOrdinate, null, aSBFCState, sbfrState)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - try { - return calibrateState (new org.drip.spline.params.SegmentStateCalibrationInputs (new double[] - {left()}, new double[] {csPreceeding.responseValue (left())}, 0 == iCk ? null : - transmissionCk (left(), csPreceeding, iCk), null, aSBFCState, sbfrState)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - /** - * Calibrate the coefficients from the prior Segment and the Response Value at the Right Predictor - * Ordinate - * - * @param csPreceeding Preceeding Predictor/Response Segment - * @param dblRightStateValue Response Value at the Right Predictor Ordinate - * @param sbfrState Segment's Best Fit Weighted Response Values - * - * @return TRUE - If the calibration succeeds - */ - - public boolean calibrate ( - final LatentStateResponseModel csPreceeding, - final double dblRightStateValue, - final org.drip.spline.params.SegmentBestFitResponse sbfrState) - { - if (null == csPreceeding) return false; - - int iCk = _sidc.Ck(); - - try { - return calibrateState (new org.drip.spline.params.SegmentStateCalibrationInputs (new double[] - {left(), right()}, new double[] {csPreceeding.responseValue (left()), dblRightStateValue}, 0 - != iCk ? csPreceeding.transmissionCk (left(), this, iCk) : null, null, null, sbfrState)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - /** - * Calibrate the Coefficients from the Edge Response Values and the Left Edge Response Slope - * - * @param dblLeftValue Left Edge Response Value - * @param dblLeftSlope Left Edge Response Slope - * @param dblRightValue Right Edge Response Value - * @param sbfrState Segment's Best Fit Weighted Response Values - * - * @return TRUE - The Calibration Succeeded - */ - - public boolean calibrate ( - final double dblLeftValue, - final double dblLeftSlope, - final double dblRightValue, - final org.drip.spline.params.SegmentBestFitResponse sbfrState) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblLeftValue) || - !org.drip.quant.common.NumberUtil.IsValid (dblLeftSlope) || - !org.drip.quant.common.NumberUtil.IsValid (dblRightValue)) - return false; - - try { - return calibrateState (new org.drip.spline.params.SegmentStateCalibrationInputs (new double[] - {left(), right()}, new double[] {dblLeftValue, dblRightValue}, - org.drip.quant.common.CollectionUtil.DerivArrayFromSlope (numParameters() - 2, - dblLeftSlope), null, null, sbfrState)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - /** - * Calibrate the coefficients from the Left Edge Response Value Constraint, the Left Edge Response Value - * Slope, and the Right Edge Response Value Constraint - * - * @param wrvcStateLeft Left Edge Response Value Constraint - * @param dblLeftSlope Left Edge Response Value Slope - * @param wrvcStateRight Right Edge Response Value Constraint - * @param sbfrState Segment's Best Fit Weighted Response - * - * @return TRUE - If the calibration succeeds - */ - - public boolean calibrate ( - final org.drip.spline.params.SegmentResponseValueConstraint wrvcStateLeft, - final double dblLeftSlope, - final org.drip.spline.params.SegmentResponseValueConstraint wrvcStateRight, - final org.drip.spline.params.SegmentBestFitResponse sbfrState) - { - org.drip.spline.params.SegmentBasisFlexureConstraint[] aSBFCState = null; - - try { - if (null != wrvcStateLeft || null != wrvcStateRight) - aSBFCState = new org.drip.spline.params.SegmentBasisFlexureConstraint[] {null == - wrvcStateLeft ? null : wrvcStateLeft.responseIndexedBasisConstraint (_be, this), null == - wrvcStateRight ? null : wrvcStateRight.responseIndexedBasisConstraint (_be, this)}; - - return calibrateState (new org.drip.spline.params.SegmentStateCalibrationInputs (null, null, - org.drip.quant.common.CollectionUtil.DerivArrayFromSlope (numParameters() - 2, dblLeftSlope), - null, aSBFCState, sbfrState)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - /** - * Compute the Local and the Preceeding Manifest Measure Sensitivity Coefficients from the Preceeding - * Segment, the Local Response Value, the Local Response Value Manifest Measure Sensitivity, and the - * Local Best Fit Response Sensitivity - * - * @param csPreceeding Preceeding Predictor/Response Segment - * @param strManifestMeasure Manifest Measure whose Sensitivity is sought - * @param srvcState The Segment State Response Value Constraint - * @param srvcManifestSensitivity The Segment State Response Value Constraint Manifest Sensitivity - * @param sbfrManifestSensitivity Segment's Best Fit Weighted State Response Value Manifest Sensitivity - * - * @return TRUE - If the calibration succeeds - */ - - public boolean manifestMeasureSensitivity ( - final org.drip.spline.segment.LatentStateResponseModel csPreceeding, - final java.lang.String strManifestMeasure, - final org.drip.spline.params.SegmentResponseValueConstraint srvcState, - final org.drip.spline.params.SegmentResponseValueConstraint srvcManifestSensitivity, - final org.drip.spline.params.SegmentBestFitResponse sbfrManifestSensitivity) - { - if (null == srvcState && null != srvcManifestSensitivity) return false; - - org.drip.spline.params.SegmentBasisFlexureConstraint[] aSBFCState = null == srvcState ? null : new - org.drip.spline.params.SegmentBasisFlexureConstraint[] {srvcState.responseIndexedBasisConstraint - (_be, this)}; - - org.drip.spline.params.SegmentBasisFlexureConstraint[] aSBFCManifestSensitivity = null == - srvcManifestSensitivity ? null : new org.drip.spline.params.SegmentBasisFlexureConstraint[] - {srvcManifestSensitivity.responseIndexedBasisConstraint (_be, this)}; - - double[] adblManifestJacobianDerivAtLeftOrdinate = null; - - int iCk = _sidc.Ck(); - - if (0 != iCk) { - adblManifestJacobianDerivAtLeftOrdinate = new double[iCk]; - - for (int i = 0; i < iCk; ++i) - adblManifestJacobianDerivAtLeftOrdinate[i] = 0.; - } - - if (null == csPreceeding) return false; - - try { - if (null == aSBFCManifestSensitivity) return true; - - if (!calibrateLocalManifestJacobian (strManifestMeasure, new - org.drip.spline.params.SegmentStateCalibrationInputs (new double[] {left()}, new double[] - {0.}, adblManifestJacobianDerivAtLeftOrdinate, null, aSBFCManifestSensitivity, - sbfrManifestSensitivity), aSBFCState)) - return false; - - org.drip.spline.segment.LatentStateManifestSensitivity lsms = manifestSensitivity - (strManifestMeasure); - - if (null == lsms) return true; - - return lsms.getPMSC().impactFade() ? calibratePreceedingManifestJacobian (strManifestMeasure, new - org.drip.spline.params.SegmentStateCalibrationInputs (new double[] {left(), right()}, new - double[] {csPreceeding.calcDResponseDManifest (strManifestMeasure, left(), 1), 0.}, null, - CkDBasisCoeffDPreceedingManifestMeasure (strManifestMeasure), null, null)) : - lsms.setDResponseDPreceedingManifest (csPreceeding.calcDResponseDManifest - (strManifestMeasure, left(), 1)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - /** - * Compute the Local and the Preceeding Manifest Measure Sensitivity Coefficients from the Preceeding - * Segments, the Local Response Value Sensitivity at the Right Predictor Ordinate, and the Local Best - * Fit Response Sensitivity - * - * @param csPreceeding Preceeding Predictor/Response Segment - * @param strManifestMeasure Manifest Measure whose Sensitivity is sought - * @param dblRightStateManifestSensitivity Response Value Manifest Sensitivity at the Right Predictor - * Ordinate - * @param sbfrManifestSensitivity Segment's Best Fit Weighted Response Value Manifest Sensitivity - * - * @return TRUE - If the calibration succeeds - */ - - public boolean manifestMeasureSensitivity ( - final LatentStateResponseModel csPreceeding, - final java.lang.String strManifestMeasure, - final double dblRightStateManifestSensitivity, - final org.drip.spline.params.SegmentBestFitResponse sbfrManifestSensitivity) - { - if (null == csPreceeding) return false; - - int iCk = _sidc.Ck(); - - try { - double[] adblManifestJacobianDerivAtLeftOrdinate = null; - - if (0 != iCk) { - adblManifestJacobianDerivAtLeftOrdinate = new double[iCk]; - - for (int i = 0; i < iCk; ++i) - adblManifestJacobianDerivAtLeftOrdinate[i] = 0.; - } - - if (!org.drip.quant.common.NumberUtil.IsValid (dblRightStateManifestSensitivity)) return true; - - if (!calibrateLocalManifestJacobian (strManifestMeasure, new - org.drip.spline.params.SegmentStateCalibrationInputs (new double[] {left(), right()}, new - double[] {0., dblRightStateManifestSensitivity}, 0 != iCk ? - adblManifestJacobianDerivAtLeftOrdinate : null, null, null, sbfrManifestSensitivity), - null)) - return false; - - org.drip.spline.segment.LatentStateManifestSensitivity lsms = manifestSensitivity - (strManifestMeasure); - - if (null == lsms) return true; - - return lsms.getPMSC().impactFade() ? calibratePreceedingManifestJacobian (strManifestMeasure, new - org.drip.spline.params.SegmentStateCalibrationInputs (new double[] {left(), right()}, new - double[] {csPreceeding.calcDResponseDManifest (strManifestMeasure, left(), 1), 0.}, null, - CkDBasisCoeffDPreceedingManifestMeasure (strManifestMeasure), null, null)) : - lsms.setDResponseDPreceedingManifest (csPreceeding.calcDResponseDManifest - (strManifestMeasure, left(), 1)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - /** - * Compute the Local and the Preceeding Manifest Measure Sensitivity Coefficients from the Local - * Response Value Sensitivity at the Left/Right Predictor Ordinate, the Local Left Response Value - * Sensitivity Slope, and the Local Best Fit Response Sensitivity. - * - * @param strManifestMeasure Manifest Measure whose Sensitivity is sought - * @param dblLeftManifestSensitivity Left Edge Response Value Manifest Sensitivity - * @param dblLeftSlopeManifestSensitivity Left Edge Response Slope Manifest Sensitivity - * @param dblRightManifestSensitivity Right Edge Response Value Manifest Sensitivity - * @param sbfrManifestSensitivity Segment's Best Fit Weighted Response Values Manifest Sensitivity - * - * @return TRUE - The Calibration Succeeded - */ - - public boolean manifestMeasureSensitivity ( - final java.lang.String strManifestMeasure, - final double dblLeftManifestSensitivity, - final double dblLeftSlopeManifestSensitivity, - final double dblRightManifestSensitivity, - final org.drip.spline.params.SegmentBestFitResponse sbfrManifestSensitivity) - { - try { - return org.drip.quant.common.NumberUtil.IsValid (dblLeftManifestSensitivity) && - org.drip.quant.common.NumberUtil.IsValid (dblLeftSlopeManifestSensitivity) && - org.drip.quant.common.NumberUtil.IsValid (dblRightManifestSensitivity) ? - calibrateLocalManifestJacobian (strManifestMeasure, new - org.drip.spline.params.SegmentStateCalibrationInputs (new double[] {left(), - right()}, new double[] {dblLeftManifestSensitivity, - dblRightManifestSensitivity}, - org.drip.quant.common.CollectionUtil.DerivArrayFromSlope - (numParameters() - 2, dblLeftSlopeManifestSensitivity), null, - null, sbfrManifestSensitivity), null) : true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - /** - * Compute the Local and the Preceeding Manifest Measure Sensitivity Coefficients from the Local - * Response Value/Sensitivity Constraints at the Left/Right Predictor Ordinate, the Local Left - * Response Value Sensitivity Slope, and the Local Best Fit Response Sensitivity - * - * @param strManifestMeasure Manifest Measure whose Sensitivity is sought - * @param wrvcStateLeft Left Edge Response Value Constraint - * @param wrvcStateRight Right Edge Response Value Constraint - * @param dblLeftSlopeManifestSensitivity Left Edge Response Value Slope Manifest Sensitivity - * @param wrvcStateLeftManifestSensitivity Left Edge Response Value Constraint Manifest Sensitivity - * @param wrvcStateRightManifestSensitivity Right Edge Response Value Constraint Manifest Sensitivity - * @param sbfrManifestSensitivity Segment's Best Fit Weighted Response Manifest Sensitivity - * - * @return TRUE - If the calibration succeeds - */ - - public boolean manifestMeasureSensitivity ( - final java.lang.String strManifestMeasure, - final org.drip.spline.params.SegmentResponseValueConstraint wrvcStateLeft, - final org.drip.spline.params.SegmentResponseValueConstraint wrvcStateRight, - final double dblLeftSlopeManifestSensitivity, - final org.drip.spline.params.SegmentResponseValueConstraint wrvcStateLeftManifestSensitivity, - final org.drip.spline.params.SegmentResponseValueConstraint wrvcStateRightManifestSensitivity, - final org.drip.spline.params.SegmentBestFitResponse sbfrManifestSensitivity) - { - org.drip.spline.params.SegmentBasisFlexureConstraint[] aSBFCState = null; - org.drip.spline.params.SegmentBasisFlexureConstraint[] aSBFCManifestSensitivity = null; - - try { - if (null != wrvcStateLeft || null != wrvcStateRight) - aSBFCState = new org.drip.spline.params.SegmentBasisFlexureConstraint[] {null == - wrvcStateLeft ? null : wrvcStateLeft.responseIndexedBasisConstraint (_be, this), null == - wrvcStateRight ? null : wrvcStateRight.responseIndexedBasisConstraint (_be, this)}; - - if (null != wrvcStateLeftManifestSensitivity || null != wrvcStateRightManifestSensitivity) - aSBFCManifestSensitivity = new org.drip.spline.params.SegmentBasisFlexureConstraint[] {null - == wrvcStateLeftManifestSensitivity ? null : - wrvcStateLeftManifestSensitivity.responseIndexedBasisConstraint (_be, this), null == - wrvcStateRightManifestSensitivity ? null : - wrvcStateRightManifestSensitivity.responseIndexedBasisConstraint (_be, - this)}; - - return null == aSBFCManifestSensitivity ? true : calibrateLocalManifestJacobian - (strManifestMeasure, new org.drip.spline.params.SegmentStateCalibrationInputs (null, null, - org.drip.quant.common.CollectionUtil.DerivArrayFromSlope (numParameters() - 2, - dblLeftSlopeManifestSensitivity), null, aSBFCManifestSensitivity, - sbfrManifestSensitivity), aSBFCState); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - /** - * Retrieve the Segment Curvature DPE - * - * @return The Segment Curvature DPE - * - * @throws java.lang.Exception Thrown if the Segment Curvature DPE cannot be computed - */ - - public double curvatureDPE() - throws java.lang.Exception - { - double dblDPE = 0.; - - int iNumBasis = _be.numBasis(); - - org.drip.spline.params.SegmentFlexurePenaltyControl sfpc = _sidc.curvaturePenaltyControl(); - - if (null == sfpc) sfpc = new org.drip.spline.params.SegmentFlexurePenaltyControl (2, 1.); - - org.drip.spline.segment.BestFitFlexurePenalizer bffp = new - org.drip.spline.segment.BestFitFlexurePenalizer (this, sfpc, null, null, _be); - - for (int i = 0; i < iNumBasis; ++i) { - for (int j = 0; j < iNumBasis; ++j) - dblDPE += _adblResponseBasisCoeff[i] * _adblResponseBasisCoeff[j] * - bffp.basisPairCurvaturePenalty (i, j); - } - - return sfpc.amplitude() * dblDPE; - } - - /** - * Retrieve the Segment Length DPE - * - * @return The Segment Length DPE - * - * @throws java.lang.Exception Thrown if the Segment Length DPE cannot be computed - */ - - public double lengthDPE() - throws java.lang.Exception - { - double dblDPE = 0.; - - int iNumBasis = _be.numBasis(); - - org.drip.spline.params.SegmentFlexurePenaltyControl sfpcLength = _sidc.lengthPenaltyControl(); - - if (null == sfpcLength) sfpcLength = new org.drip.spline.params.SegmentFlexurePenaltyControl (1, 1.); - - org.drip.spline.segment.BestFitFlexurePenalizer bffp = new - org.drip.spline.segment.BestFitFlexurePenalizer (this, null, sfpcLength, null, _be); - - for (int i = 0; i < iNumBasis; ++i) { - for (int j = 0; j < iNumBasis; ++j) - dblDPE += _adblResponseBasisCoeff[i] * _adblResponseBasisCoeff[j] * - bffp.basisPairLengthPenalty (i, j); - } - - return sfpcLength.amplitude() * dblDPE; - } - - /** - * Retrieve the Segment Best Fit DPE - * - * @param sbfr The Segment's Best Fit Response Inputs - * - * @return The Segment Best Fit DPE - * - * @throws java.lang.Exception Thrown if the Segment Best Fit DPE cannot be computed - */ - - public double bestFitDPE ( - final org.drip.spline.params.SegmentBestFitResponse sbfr) - throws java.lang.Exception - { - if (null == sbfr) return 0.; - - double dblDPE = 0.; - - int iNumBasis = _be.numBasis(); - - org.drip.spline.segment.BestFitFlexurePenalizer bffp = new - org.drip.spline.segment.BestFitFlexurePenalizer (this, null, null, sbfr, _be); - - for (int i = 0; i < iNumBasis; ++i) { - for (int j = 0; j < iNumBasis; ++j) - dblDPE += _adblResponseBasisCoeff[i] * _adblResponseBasisCoeff[j] * bffp.basisBestFitPenalty - (i, j); - } - - return dblDPE; - } - - /** - * Calculate the Response Value at the given Predictor Ordinate - * - * @param dblPredictorOrdinate Predictor Ordinate - * - * @return The Response Value - * - * @throws java.lang.Exception Thrown if the calculation did not succeed - */ - - public double responseValue ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - return _be.responseValue (_adblResponseBasisCoeff, dblPredictorOrdinate); - } - - /** - * Calculate the Ordered Response Value Derivative at the Predictor Ordinate - * - * @param dblPredictorOrdinate Predictor Ordinate at which the ordered Response Derivative is to be - * calculated - * @param iOrder Derivative Order - * - * @throws java.lang.Exception Thrown if the Ordered Response Value Derivative cannot be calculated - * - * @return Retrieve the Ordered Response Value Derivative - */ - - public double calcResponseValueDerivative ( - final double dblPredictorOrdinate, - final int iOrder) - throws java.lang.Exception - { - return 0 == iOrder ? responseValue (dblPredictorOrdinate) : _be.responseValueDerivative - (_adblResponseBasisCoeff, dblPredictorOrdinate, iOrder); - } - - /** - * Calculate the Ordered Derivative of the Response to the Manifest - * - * @param strManifestMeasure Manifest Measure whose Sensitivity is sought - * @param dblPredictorOrdinate Predictor Ordinate at which the ordered Derivative of the Response to the - * Manifest is to be calculated - * @param iOrder Derivative Order - * - * @throws java.lang.Exception Thrown if the Ordered Derivative of the Response to the Manifest cannot be - * calculated - * - * @return Retrieve the Ordered Derivative of the Response to the Manifest - */ - - public double calcDResponseDManifest ( - final java.lang.String strManifestMeasure, - final double dblPredictorOrdinate, - final int iOrder) - throws java.lang.Exception - { - if (0 == iOrder) - throw new java.lang.Exception - ("LatentStateResponseModel::calcDResponseDManifest => Invalid Inputs"); - - org.drip.spline.segment.LatentStateManifestSensitivity lsms = manifestSensitivity - (strManifestMeasure); - - if (null == lsms) - throw new java.lang.Exception - ("LatentStateResponseModel::calcDResponseDManifest => Invalid Inputs"); - - return _be.responseValue (lsms.getDBasisCoeffDLocalManifest(), dblPredictorOrdinate); - } - - /** - * Calculate the Ordered Derivative of the Response to the Preceeding Manifest - * - * @param strManifestMeasure Manifest Measure whose Sensitivity is sought - * @param dblPredictorOrdinate Predictor Ordinate at which the ordered Derivative of the Response to the - * Manifest is to be calculated - * @param iOrder Derivative Order - * - * @throws java.lang.Exception Thrown if the Ordered Derivative of the Response to the Manifest cannot be - * calculated - * - * @return Retrieve the Ordered Derivative of the Response to the Preceeding Manifest - */ - - public double calcDResponseDPreceedingManifest ( - final java.lang.String strManifestMeasure, - final double dblPredictorOrdinate, - final int iOrder) - throws java.lang.Exception - { - if (0 == iOrder) - throw new java.lang.Exception - ("LatentStateResponseModel::calcDResponseDPreceedingManifest => Invalid Inputs"); - - org.drip.spline.segment.LatentStateManifestSensitivity lsms = manifestSensitivity - (strManifestMeasure); - - if (null == lsms) - throw new java.lang.Exception - ("LatentStateResponseModel::calcDResponseDPreceedingManifest => Cannot locate state Manifest sensitivity"); - - org.drip.spline.params.PreceedingManifestSensitivityControl pqsc = lsms.getPMSC(); - - double dblDResponseDPreceedingManifest = lsms.getDResponseDPreceedingManifest(); - - if (!pqsc.impactFade()) - return org.drip.quant.common.NumberUtil.IsValid (dblDResponseDPreceedingManifest) ? - dblDResponseDPreceedingManifest : 0.; - - org.drip.spline.segment.BasisEvaluator be = pqsc.basisEvaluator(); - - double[] adblDBasisCoeffDPreceedingManifest = lsms.getDBasisCoeffDPreceedingManifest(); - - return null == adblDBasisCoeffDPreceedingManifest ? 0. : (null == be ? _be : be).responseValue - (adblDBasisCoeffDPreceedingManifest, dblPredictorOrdinate); - } - - /** - * Retrieve the Manifest Measure Preceeding Manifest Impact Flag - * - * @param strManifestMeasure Manifest Measure whose Sensitivity is sought - * - * @return The Manifest Measure Preceeding Manifest Impact Flag - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public boolean impactFade ( - final java.lang.String strManifestMeasure) - throws java.lang.Exception - { - org.drip.spline.segment.LatentStateManifestSensitivity lsms = manifestSensitivity - (strManifestMeasure); - - if (null == lsms) - throw new java.lang.Exception - ("LatentStateResponseModel::impactFade => Cannot locate state Manifest sensitivity"); - - return lsms.getPMSC().impactFade(); - } - - /** - * Calculate the Jacobian of the Segment's Response Basis Function Coefficients to the Edge Inputs - * - * @return The Jacobian of the Segment's Response Basis Function Coefficients to the Edge Inputs - */ - - public org.drip.quant.calculus.WengertJacobian jackDCoeffDEdgeInputs() - { - if (null != _wjDBasisCoeffDEdgeValue) return _wjDBasisCoeffDEdgeValue; - - int iNumResponseBasisCoeff = _be.numBasis(); - - try { - _wjDBasisCoeffDEdgeValue = new org.drip.quant.calculus.WengertJacobian (iNumResponseBasisCoeff, - iNumResponseBasisCoeff); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return _wjDBasisCoeffDEdgeValue = null; - } - - for (int i = 0; i < iNumResponseBasisCoeff; ++i) { - if (!_wjDBasisCoeffDEdgeValue.setWengert (i, _adblResponseBasisCoeff[i])) - return _wjDBasisCoeffDEdgeValue = null; - } - - if (null == _aadblDResponseBasisCoeffDConstraint) return null; - - int iSize = _aadblDResponseBasisCoeffDConstraint.length; - - for (int i = 0; i < iSize; ++i) { - for (int j = 0; j < iSize; ++j) { - if (!_wjDBasisCoeffDEdgeValue.accumulatePartialFirstDerivative (i, j, - _aadblDResponseBasisCoeffDConstraint[i][j])) - return null; - } - } - - return _wjDBasisCoeffDEdgeValue; - } - - /** - * Calculate the Jacobian of the Response to the Edge Inputs at the given Predictor Ordinate - * - * @param dblPredictorOrdinate The Predictor Ordinate - * @param iOrder Order of the Derivative Desired - * - * @return The Jacobian of the Response to the Edge Inputs at the given Predictor Ordinate - */ - - public org.drip.quant.calculus.WengertJacobian jackDResponseDEdgeInput ( - final double dblPredictorOrdinate, - final int iOrder) - { - try { - int iNumResponseBasisCoeff = _be.numBasis(); - - org.drip.quant.calculus.WengertJacobian wjDResponseDEdgeParams = null; - double[][] aadblDBasisCoeffDEdgeParams = new - double[iNumResponseBasisCoeff][iNumResponseBasisCoeff]; - - double[] adblDResponseDBasisCoeff = DResponseDBasisCoeff (dblPredictorOrdinate, iOrder); - - if (null == adblDResponseDBasisCoeff || iNumResponseBasisCoeff != - adblDResponseDBasisCoeff.length) - return null; - - org.drip.quant.calculus.WengertJacobian wjDBasisCoeffDEdgeParams = (null == - _wjDBasisCoeffDEdgeValue) ? jackDCoeffDEdgeInputs() : _wjDBasisCoeffDEdgeValue; - - for (int i = 0; i < iNumResponseBasisCoeff; ++i) { - for (int j = 0; j < iNumResponseBasisCoeff; ++j) - aadblDBasisCoeffDEdgeParams[j][i] = wjDBasisCoeffDEdgeParams.firstDerivative (j, i); - } - - if (!(wjDResponseDEdgeParams = new org.drip.quant.calculus.WengertJacobian (1, - iNumResponseBasisCoeff)).setWengert (0, responseValue (dblPredictorOrdinate))) - return null; - - for (int i = 0; i < iNumResponseBasisCoeff; ++i) { - for (int j = 0; j < iNumResponseBasisCoeff; ++j) { - if (!wjDResponseDEdgeParams.accumulatePartialFirstDerivative (0, i, - adblDResponseDBasisCoeff[j] * aadblDBasisCoeffDEdgeParams[j][i])) - return null; - } - } - - return wjDResponseDEdgeParams; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Calculate the Jacobian of the Response to the Basis Coefficients at the given Predictor Ordinate - * - * @param dblPredictorOrdinate The Predictor Ordinate - * @param iOrder Order of the Derivative Desired - * - * @return The Jacobian of the Response to the Basis Coefficients at the given Predictor Ordinate - */ - - public org.drip.quant.calculus.WengertJacobian jackDResponseDBasisCoeff ( - final double dblPredictorOrdinate, - final int iOrder) - { - try { - int iNumResponseBasisCoeff = _be.numBasis(); - - double[] adblBasisDResponseDBasisCoeff = DResponseDBasisCoeff (dblPredictorOrdinate, iOrder); - - if (null == adblBasisDResponseDBasisCoeff || iNumResponseBasisCoeff != - adblBasisDResponseDBasisCoeff.length) - return null; - - org.drip.quant.calculus.WengertJacobian wjDResponseDBasisCoeff = new - org.drip.quant.calculus.WengertJacobian (1, iNumResponseBasisCoeff); - - for (int i = 0; i < iNumResponseBasisCoeff; ++i) { - if (!wjDResponseDBasisCoeff.accumulatePartialFirstDerivative (0, i, - adblBasisDResponseDBasisCoeff[i])) - return null; - } - - return wjDResponseDBasisCoeff; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Calibrate the segment and calculate the Jacobian of the Segment's Response Basis Function Coefficients - * to the Edge Parameters - * - * @param adblPredictorOrdinate Array of Predictor Ordinates - * @param adblResponseValue Array of Response Values - * @param adblLeftEdgeDeriv Array of Left Edge Derivatives - * @param adblRightEdgeDeriv Array of Right Edge Derivatives - * @param aSBFC Array of Segment Flexure Constraints, expressed as Basis Coefficients - * @param sbfr Segment Best Fit Response Instance - * - * @return The Jacobian of the Segment's Response Basis Function Coefficients to the Edge Parameters - */ - - public org.drip.quant.calculus.WengertJacobian jackDCoeffDEdgeParams ( - final double[] adblPredictorOrdinate, - final double[] adblResponseValue, - final double[] adblLeftEdgeDeriv, - final double[] adblRightEdgeDeriv, - final org.drip.spline.params.SegmentBasisFlexureConstraint[] aSBFC, - final org.drip.spline.params.SegmentBestFitResponse sbfr) - { - try { - return calibrateState (new org.drip.spline.params.SegmentStateCalibrationInputs - (adblPredictorOrdinate, adblResponseValue, adblLeftEdgeDeriv, adblRightEdgeDeriv, aSBFC, - sbfr)) ? jackDCoeffDEdgeInputs() : null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Calibrate the Coefficients from the Edge Response Values and the Left Edge Response Value Slope and - * calculate the Jacobian of the Segment's Response Basis Function Coefficients to the Edge Parameters - * - * @param dblLeftValue Left Edge Response Value - * @param dblLeftSlope Left Edge Response Slope - * @param dblRightValue Right Edge Response Value - * @param sbfrState Segment's Best Fit Weighted Response Values - * - * @return The Jacobian of the Segment's Response Basis Function Coefficients to the Edge Parameters - */ - - public org.drip.quant.calculus.WengertJacobian jackDCoeffDEdgeParams ( - final double dblLeftValue, - final double dblLeftSlope, - final double dblRightValue, - final org.drip.spline.params.SegmentBestFitResponse sbfrState) - { - return calibrate (dblLeftValue, dblLeftSlope, dblRightValue, sbfrState) ? jackDCoeffDEdgeInputs() : - null; - } - - /** - * Calibrate the coefficients from the prior Segment and the Response Value at the Right Predictor - * Ordinate and calculate the Jacobian of the Segment's Response Basis Function Coefficients to the Edge - * Parameters - * - * @param csPreceeding Previous Predictor/Response Segment - * @param strManifestMeasure Manifest Measure whose Sensitivity is sought - * @param dblRightStateValue Response Value at the Right Predictor Ordinate - * @param sbfrState Segment's Best Fit Weighted Response Values - * @param dblRightStateManifestSensitivity Response Value Manifest Sensitivity at the Right Predictor - * Ordinate - * @param sbfrManifestSensitivity Segment's Best Fit Weighted Response Value Manifest Sensitivity - * - * @return The Jacobian - */ - - public org.drip.quant.calculus.WengertJacobian jackDCoeffDEdgeParams ( - final LatentStateResponseModel csPreceeding, - final java.lang.String strManifestMeasure, - final double dblRightStateValue, - final org.drip.spline.params.SegmentBestFitResponse sbfrState, - final double dblRightStateManifestSensitivity, - final org.drip.spline.params.SegmentBestFitResponse sbfrManifestSensitivity) - { - return !calibrate (csPreceeding, dblRightStateValue, sbfrState) || !manifestMeasureSensitivity - (csPreceeding, strManifestMeasure, dblRightStateManifestSensitivity, sbfrManifestSensitivity) ? - null : jackDCoeffDEdgeInputs(); - } - - /** - * Indicate whether the given segment is monotone. If monotone, may optionally indicate the nature of - * the extrema contained inside (maxima/minima/infection). - * - * @return The monotone Type - */ - - public org.drip.spline.segment.Monotonocity monotoneType() - { - if (1 >= _sidc.Ck()) { - try { - return new org.drip.spline.segment.Monotonocity - (org.drip.spline.segment.Monotonocity.MONOTONIC); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - org.drip.function.definition.R1ToR1 ofDeriv = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - return _be.responseValueDerivative (_adblResponseBasisCoeff, dblX, 1); - } - - @Override public org.drip.quant.calculus.Differential differential ( - final double dblX, - final double dblOFBase, - final int iOrder) - { - try { - double dblVariateInfinitesimal = _dc.getVariateInfinitesimal (dblX); - - return new org.drip.quant.calculus.Differential (dblVariateInfinitesimal, - _be.responseValueDerivative (_adblResponseBasisCoeff, dblX, iOrder) * - dblVariateInfinitesimal); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - return org.drip.quant.calculus.R1ToR1Integrator.Boole (this, dblBegin, dblEnd); - } - }; - - try { - org.drip.function.r1tor1solver.FixedPointFinderOutput fpop = new - org.drip.function.r1tor1solver.FixedPointFinderBrent (0., ofDeriv, false).findRoot - (org.drip.function.r1tor1solver.InitializationHeuristics.FromHardSearchEdges (0., 1.)); - - if (null == fpop || !fpop.containsRoot()) - return new org.drip.spline.segment.Monotonocity - (org.drip.spline.segment.Monotonocity.MONOTONIC); - - double dblExtremum = fpop.getRoot(); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblExtremum) || dblExtremum <= 0. || dblExtremum - >= 1.) - return new org.drip.spline.segment.Monotonocity - (org.drip.spline.segment.Monotonocity.MONOTONIC); - - double dbl2ndDeriv = _be.responseValueDerivative (_adblResponseBasisCoeff, dblExtremum, 2); - - if (0. > dbl2ndDeriv) - return new org.drip.spline.segment.Monotonocity - (org.drip.spline.segment.Monotonocity.MAXIMA); - - if (0. < dbl2ndDeriv) - return new org.drip.spline.segment.Monotonocity - (org.drip.spline.segment.Monotonocity.MINIMA); - - if (0. == dbl2ndDeriv) - return new org.drip.spline.segment.Monotonocity - (org.drip.spline.segment.Monotonocity.INFLECTION); - - return new org.drip.spline.segment.Monotonocity - (org.drip.spline.segment.Monotonocity.NON_MONOTONIC); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - try { - return new org.drip.spline.segment.Monotonocity (org.drip.spline.segment.Monotonocity.MONOTONIC); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Clip the part of the Segment to the Right of the specified Predictor Ordinate. Retain all other - * constraints the same. - * - * @param dblPredictorOrdinate The Predictor Ordinate - * - * @return The Clipped Segment - */ - - public LatentStateResponseModel clipLeftOfPredictorOrdinate ( - final double dblPredictorOrdinate) - { - try { - LatentStateResponseModel csLeftSnipped = LatentStateResponseModel.Create (dblPredictorOrdinate, - right(), _be.replicate(), _sidc); - - int iCk = _sidc.Ck(); - - double[] adblCalibLeftEdgeDeriv = 0 != iCk ? csLeftSnipped.transmissionCk (dblPredictorOrdinate, - this, iCk) : null; - - return csLeftSnipped.calibrateState (new org.drip.spline.params.SegmentStateCalibrationInputs - (new double[] {dblPredictorOrdinate, right()}, new double[] {responseValue - (dblPredictorOrdinate), responseValue (right())}, adblCalibLeftEdgeDeriv, null, null, - null)) ? csLeftSnipped : null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Clip the part of the Segment to the Right of the specified Predictor Ordinate. Retain all other - * constraints the same. - * - * @param dblPredictorOrdinate The Predictor Ordinate - * - * @return The Clipped Segment - */ - - public LatentStateResponseModel clipRightOfPredictorOrdinate ( - final double dblPredictorOrdinate) - { - try { - LatentStateResponseModel csRightSnipped = LatentStateResponseModel.Create (left(), - dblPredictorOrdinate, _be.replicate(), _sidc); - - int iCk = _sidc.Ck(); - - return csRightSnipped.calibrateState (new org.drip.spline.params.SegmentStateCalibrationInputs - (new double[] {left(), dblPredictorOrdinate}, new double[] {responseValue (left()), - responseValue (dblPredictorOrdinate)}, 0 != iCk ? csRightSnipped.transmissionCk (left(), - this, iCk) : null, null, null, null)) ? csRightSnipped : null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Display the string representation for diagnostic purposes - * - * @return The string representation - */ - - public java.lang.String displayString() - { - java.lang.StringBuffer sb = new java.lang.StringBuffer(); - - sb.append ("\t\t\t[" + left() + " => " + right() + "\n"); - - for (int i = 0; i < _adblResponseBasisCoeff.length; ++i) { - if (0 != i) sb.append (" | "); - - sb.append (_adblResponseBasisCoeff[i] + "\n"); - } - - return sb.toString(); - } -} diff --git a/org/drip/spline/segment/Monotonocity.java b/org/drip/spline/segment/Monotonocity.java deleted file mode 100644 index 7870382..0000000 --- a/org/drip/spline/segment/Monotonocity.java +++ /dev/null @@ -1,137 +0,0 @@ - -package org.drip.spline.segment; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * This class contains the monotonicity details related to the given segment. Indicates whether the segment - * is monotonic, and if not, whether it contains a maximum, a minimum, or an inflection. - * - * @author Lakshmi Krishnamurthy - */ - -public class Monotonocity { - - /** - * MONOTONIC - */ - - public static final int MONOTONIC = 2; - - /** - * NON-MONOTONIC - */ - - public static final int NON_MONOTONIC = 4; - - /** - * NON MONOTONE - MINIMA - */ - - public static final int MINIMA = 5; - - /** - * NON MONOTONE - MAXIMA - */ - - public static final int MAXIMA = 6; - - /** - * NON MONOTONE - INFLECTION - */ - - public static final int INFLECTION = 7; - - private int _iMonotoneType = -1; - - /** - * Monotonocity constructor - * - * @param iMonotoneType One of the valid monotone types - * - * @throws java.lang.Exception Thrown if the input monotone type is invalid - */ - - public Monotonocity ( - final int iMonotoneType) - throws java.lang.Exception - { - if (org.drip.spline.segment.Monotonocity.MONOTONIC != (_iMonotoneType = iMonotoneType) && - org.drip.spline.segment.Monotonocity.NON_MONOTONIC != _iMonotoneType && - org.drip.spline.segment.Monotonocity.MINIMA != _iMonotoneType && - org.drip.spline.segment.Monotonocity.MAXIMA != _iMonotoneType && - org.drip.spline.segment.Monotonocity.INFLECTION != _iMonotoneType) - throw new java.lang.Exception ("Monotonocity ctr: Unknown monotone type " + _iMonotoneType); - } - - /** - * Retrieve the Monotone Type - * - * @return The Monotone Type - */ - - public int type() - { - return _iMonotoneType; - } - - @Override public java.lang.String toString() - { - if (org.drip.spline.segment.Monotonocity.NON_MONOTONIC == _iMonotoneType) return "NON_MONOTONIC"; - - if (org.drip.spline.segment.Monotonocity.MONOTONIC == _iMonotoneType) return "MONOTONIC "; - - if (org.drip.spline.segment.Monotonocity.MINIMA == _iMonotoneType) return "MINIMA "; - - if (org.drip.spline.segment.Monotonocity.MAXIMA == _iMonotoneType) return "MAXIMA "; - - return "INFLECTION "; - } -} diff --git a/org/drip/spline/segment/SegmentBasisEvaluator.java b/org/drip/spline/segment/SegmentBasisEvaluator.java deleted file mode 100644 index 84eb752..0000000 --- a/org/drip/spline/segment/SegmentBasisEvaluator.java +++ /dev/null @@ -1,271 +0,0 @@ - -package org.drip.spline.segment; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * This Class implements the BasisEvaluator interface for the given set of the Segment Basis Evaluator - * Functions. - * - * @author Lakshmi Krishnamurthy - */ - -public class SegmentBasisEvaluator implements org.drip.spline.segment.BasisEvaluator { - private org.drip.spline.basis.FunctionSet _fs = null; - private org.drip.spline.segment.LatentStateInelastic _ics = null; - private org.drip.spline.params.ResponseScalingShapeControl _rssc = null; - - /** - * SegmentBasisEvaluator constructor - * - * @param fs The Function Set Instance the contains the Basis Function Set - * @param rssc The Segment Wide Shape Controller - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public SegmentBasisEvaluator ( - final org.drip.spline.basis.FunctionSet fs, - final org.drip.spline.params.ResponseScalingShapeControl rssc) - throws java.lang.Exception - { - if (null == (_fs = fs)) throw new java.lang.Exception ("SegmentBasisEvaluator ctr: Invalid Inputs"); - - _rssc = rssc; - } - - @Override public int numBasis() - { - return _fs.numBasis(); - } - - @Override public boolean setContainingInelastics ( - final org.drip.spline.segment.LatentStateInelastic ics) - { - _ics = ics; - return true; - } - - @Override public org.drip.spline.segment.BasisEvaluator replicate() - { - try { - return new SegmentBasisEvaluator (_fs, _rssc); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public double shapedBasisFunctionResponse ( - final double dblPredictorOrdinate, - final int iBasisFunctionIndex) - throws java.lang.Exception - { - double dblX = null == _ics ? dblPredictorOrdinate : _ics.localize (dblPredictorOrdinate); - - double dblResponseValue = _fs.indexedBasisFunction (iBasisFunctionIndex).evaluate (dblX); - - return dblResponseValue * (null == _rssc ? 1. : _rssc.shapeController().evaluate (_rssc.isLocal() && - null != _ics ? _ics.localize (dblPredictorOrdinate) : dblPredictorOrdinate)); - } - - @Override public double unshapedResponseValue ( - final double[] adblResponseBasisCoeff, - final double dblPredictorOrdinate) - throws java.lang.Exception - { - double dblResponse = 0.; - - int iNumBasis = numBasis(); - - for (int i = 0; i < iNumBasis; ++i) { - dblResponse += adblResponseBasisCoeff[i] * _fs.indexedBasisFunction (i).evaluate (null == _ics ? - dblPredictorOrdinate : _ics.localize (dblPredictorOrdinate)); - } - - return dblResponse; - } - - @Override public double responseValue ( - final double[] adblResponseBasisCoeff, - final double dblPredictorOrdinate) - throws java.lang.Exception - { - if (null == _rssc) return unshapedResponseValue (adblResponseBasisCoeff, dblPredictorOrdinate); - - return unshapedResponseValue (adblResponseBasisCoeff, dblPredictorOrdinate) * - _rssc.shapeController().evaluate (_rssc.isLocal() && null != _ics ? _ics.localize - (dblPredictorOrdinate) : dblPredictorOrdinate); - } - - @Override public double shapedBasisFunctionDerivative ( - final double dblPredictorOrdinate, - final int iOrder, - final int iBasisFunctionIndex) - throws java.lang.Exception - { - double dblX = null == _ics ? dblPredictorOrdinate : _ics.localize (dblPredictorOrdinate); - - if (null == _rssc) return _fs.indexedBasisFunction (iBasisFunctionIndex).derivative (dblX, iOrder); - - double dblShapeControllerPredictorOrdinate = _rssc.isLocal() && null != _ics ? dblX : - dblPredictorOrdinate; - - double dblResponseDerivative = 0.; - - for (int i = 0; i <= iOrder; ++i) { - double dblBasisFunctionDeriv = 0 == i ? _fs.indexedBasisFunction (iBasisFunctionIndex).evaluate - (dblX) : _fs.indexedBasisFunction (iBasisFunctionIndex).derivative (dblX, i); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblBasisFunctionDeriv)) - throw new java.lang.Exception - ("SegmentBasisEvaluator::shapedBasisFunctionDerivative => Cannot compute Basis Function Derivative"); - - double dblShapeControlDeriv = iOrder == i ? _rssc.shapeController().evaluate - (dblShapeControllerPredictorOrdinate) : _rssc.shapeController().derivative - (dblShapeControllerPredictorOrdinate, iOrder - i); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblShapeControlDeriv)) - throw new java.lang.Exception - ("SegmentBasisEvaluator::shapedBasisFunctionDerivative => Cannot compute Shape Control Derivative"); - - double dblBasisFunctionDerivScale = 1.; - double dblShapeControllerDerivScale = 1.; - - if (null != _ics) { - for (int j = 0; j < i; ++j) - dblBasisFunctionDerivScale /= _ics.width(); - } - - if (_rssc.isLocal() && null != _ics) { - for (int j = 0; j < iOrder - i; ++j) - dblShapeControllerDerivScale /= _ics.width(); - } - - dblResponseDerivative += (org.drip.quant.common.NumberUtil.NCK (iOrder, i) * - dblBasisFunctionDeriv * dblBasisFunctionDerivScale * dblShapeControllerDerivScale * - dblShapeControlDeriv); - } - - return dblResponseDerivative; - } - - @Override public double unshapedBasisFunctionDerivative ( - final double[] adblResponseBasisCoeff, - final double dblPredictorOrdinate, - final int iOrder) - throws java.lang.Exception - { - double dblDerivative = 0.; - - int iNumBasis = numBasis(); - - double dblX = null == _ics ? dblPredictorOrdinate : _ics.localize (dblPredictorOrdinate); - - for (int i = 0; i < iNumBasis; ++i) - dblDerivative += adblResponseBasisCoeff[i] * _fs.indexedBasisFunction (i).derivative (dblX, - iOrder); - - return dblDerivative; - } - - @Override public double responseValueDerivative ( - final double[] adblResponseBasisCoeff, - final double dblPredictorOrdinate, - final int iOrder) - throws java.lang.Exception - { - if (null == _rssc) - return unshapedBasisFunctionDerivative (adblResponseBasisCoeff, dblPredictorOrdinate, iOrder); - - double dblShapeControllerPredictorOrdinate = _rssc.isLocal() && null != _ics ? _ics.localize - (dblPredictorOrdinate) : dblPredictorOrdinate; - - double dblResponseDerivative = 0.; - - for (int i = 0; i <= iOrder; ++i) { - double dblBasisFunctionDeriv = 0 == i ? unshapedResponseValue (adblResponseBasisCoeff, - dblPredictorOrdinate) : unshapedBasisFunctionDerivative (adblResponseBasisCoeff, - dblPredictorOrdinate, i); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblBasisFunctionDeriv)) - throw new java.lang.Exception - ("SegmentBasisEvaluator::responseValueDerivative => Cannot compute Basis Function Derivative"); - - double dblShapeControlDeriv = iOrder == i ? _rssc.shapeController().evaluate - (dblShapeControllerPredictorOrdinate) : _rssc.shapeController().derivative - (dblShapeControllerPredictorOrdinate, iOrder - i); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblShapeControlDeriv)) - throw new java.lang.Exception - ("SegmentBasisEvaluator::responseValueDerivative => Cannot compute Shape Control Derivative"); - - double dblBasisFunctionDerivScale = 1.; - double dblShapeControllerDerivScale = 1.; - - if (null != _ics) { - for (int j = 0; j < i; ++j) - dblBasisFunctionDerivScale /= _ics.width(); - } - - if (_rssc.isLocal() && null != _ics) { - for (int j = 0; j < iOrder - i; ++j) - dblShapeControllerDerivScale /= _ics.width(); - } - - dblResponseDerivative += (org.drip.quant.common.NumberUtil.NCK (iOrder, i) * - dblBasisFunctionDeriv * dblBasisFunctionDerivScale * dblShapeControllerDerivScale * - dblShapeControlDeriv); - } - - return dblResponseDerivative; - } -} diff --git a/org/drip/spline/stretch/BoundarySettings.java b/org/drip/spline/stretch/BoundarySettings.java deleted file mode 100644 index 275468d..0000000 --- a/org/drip/spline/stretch/BoundarySettings.java +++ /dev/null @@ -1,223 +0,0 @@ - -package org.drip.spline.stretch; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * This class implements the Boundary Settings that determine the full extent of description of the regime's - * State. It exports functions that: - * - Specify the type of the boundary condition (NATURAL/FLOATING/IS-A-KNOT) - * - Boundary COndition specific additional parameters (e.g., Derivative Orders and Matches) - * - Static methods that help construct standard boundary settings - * - * @author Lakshmi Krishnamurthy - */ - -public class BoundarySettings { - - /** - * Calibration Boundary Condition: Floating Boundary Condition - */ - - public static final int BOUNDARY_CONDITION_FLOATING = 1; - - /** - * Calibration Boundary Condition: Natural Boundary Condition - */ - - public static final int BOUNDARY_CONDITION_NATURAL = 2; - - /** - * Calibration Boundary Condition: Financial Boundary Condition - */ - - public static final int BOUNDARY_CONDITION_FINANCIAL = 4; - - /** - * Calibration Boundary Condition: Not-A-Knot Boundary Condition - */ - - public static final int BOUNDARY_CONDITION_NOT_A_KNOT = 8; - - private int _iLeftDerivOrder = -1; - private int _iRightDerivOrder = -1; - private int _iBoundaryConditionType = -1; - - /** - * Return the Instance of the Standard Natural Boundary Condition - * - * @return Instance of the Standard Natural Boundary Condition - */ - - public static final BoundarySettings NaturalStandard() - { - try { - return new BoundarySettings (-1, 2, BOUNDARY_CONDITION_NATURAL); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Return the Instance of the Standard Floating Boundary Condition - * - * @return Instance of the Standard Floating Boundary Condition - */ - - public static final BoundarySettings FloatingStandard() - { - try { - return new BoundarySettings (-1, -1, BOUNDARY_CONDITION_FLOATING); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Return the Instance of the Standard Financial Boundary Condition - * - * @return Instance of the Standard Financial Boundary Condition - */ - - public static final BoundarySettings FinancialStandard() - { - try { - return new BoundarySettings (-1, 1, BOUNDARY_CONDITION_FINANCIAL); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Return the Instance of the Standard Not-A-Knot Boundary Condition - * - * @param iLeftDerivOrder Order of the Left Derivative - * @param iRightDerivOrder Order of the Right Derivative - * - * @return Instance of the Standard Not-A-Knot Boundary Condition - */ - - public static final BoundarySettings NotAKnotStandard ( - final int iLeftDerivOrder, - final int iRightDerivOrder) - { - try { - return new BoundarySettings (iLeftDerivOrder, iRightDerivOrder, BOUNDARY_CONDITION_NOT_A_KNOT); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * BoundarySettings constructor - * - * @param iLeftDerivOrder Order of the Left Derivative - * @param iRightDerivOrder Order of the Right Derivative - * @param iBoundaryConditionType Type of the Boundary Condition - NATURAL/FINANCIAL/NOT_A_KNOT - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public BoundarySettings ( - final int iLeftDerivOrder, - final int iRightDerivOrder, - final int iBoundaryConditionType) - throws java.lang.Exception - { - if (BOUNDARY_CONDITION_FLOATING != (_iBoundaryConditionType = iBoundaryConditionType) && - BOUNDARY_CONDITION_NATURAL != _iBoundaryConditionType && BOUNDARY_CONDITION_FINANCIAL != - _iBoundaryConditionType && BOUNDARY_CONDITION_NOT_A_KNOT != _iBoundaryConditionType) - throw new java.lang.Exception ("BoundarySettings ct: Invalid Inputs"); - - _iLeftDerivOrder = iLeftDerivOrder; - _iRightDerivOrder = iRightDerivOrder; - } - - /** - * Retrieve the Order of the Left Derivative - * - * @return The Order of the Left Derivative - */ - - public int leftDerivOrder() - { - return _iLeftDerivOrder; - } - - /** - * Retrieve the Order of the Right Derivative - * - * @return The Order of the Right Derivative - */ - - public int rightDerivOrder() - { - return _iRightDerivOrder; - } - - /** - * Retrieve the Type of the Boundary Condition - * - * @return The Type of the Boundary Condition - */ - - public int boundaryCondition() - { - return _iBoundaryConditionType; - } -} diff --git a/org/drip/spline/stretch/CalibratableMultiSegmentSequence.java b/org/drip/spline/stretch/CalibratableMultiSegmentSequence.java deleted file mode 100644 index 69b38e9..0000000 --- a/org/drip/spline/stretch/CalibratableMultiSegmentSequence.java +++ /dev/null @@ -1,867 +0,0 @@ - -package org.drip.spline.stretch; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * CalibratableMultiSegmentSequence implements the MultiSegmentSequence span that spans multiple segments. It - * holds the ordered segment sequence, segment sequence builder, the segment control parameters, and, if - * available, the spanning Jacobian. It provides a variety of customization for the segment construction and - * state r4epresentation control. - * - * @author Lakshmi Krishnamurthy - */ - -public class CalibratableMultiSegmentSequence extends org.drip.function.definition.R1ToR1 implements - org.drip.spline.stretch.MultiSegmentSequence { - private static final int MAXIMA_PREDICTOR_ORDINATE_NODE = 1; - private static final int MINIMA_PREDICTOR_ORDINATE_NODE = 2; - private static final int MONOTONE_PREDICTOR_ORDINATE_NODE = 4; - - private java.lang.String _strName = ""; - private org.drip.spline.stretch.SegmentSequenceBuilder _ssb = null; - private org.drip.spline.segment.LatentStateResponseModel[] _aLSRM = null; - private org.drip.spline.params.SegmentCustomBuilderControl[] _aSCBC = null; - private org.drip.quant.calculus.WengertJacobian _wjDCoeffDEdgeParams = null; - - private boolean setDCoeffDEdgeParams ( - final int iNodeIndex, - final org.drip.quant.calculus.WengertJacobian wjDCoeffDEdgeParams) - { - if (null == wjDCoeffDEdgeParams) return false; - - int iParameterIndex = 0 == iNodeIndex ? 0 : 2; - - if (!_wjDCoeffDEdgeParams.accumulatePartialFirstDerivative (0, iNodeIndex, - wjDCoeffDEdgeParams.firstDerivative (0, iParameterIndex))) - return false; - - if (!_wjDCoeffDEdgeParams.accumulatePartialFirstDerivative (1, iNodeIndex, - wjDCoeffDEdgeParams.firstDerivative (1, iParameterIndex))) - return false; - - if (!_wjDCoeffDEdgeParams.accumulatePartialFirstDerivative (2, iNodeIndex, - wjDCoeffDEdgeParams.firstDerivative (2, iParameterIndex))) - return false; - - return _wjDCoeffDEdgeParams.accumulatePartialFirstDerivative (3, iNodeIndex, - wjDCoeffDEdgeParams.firstDerivative (3, iParameterIndex)); - } - - private final org.drip.quant.calculus.WengertJacobian setDResponseDEdgeResponse ( - final int iNodeIndex, - final org.drip.quant.calculus.WengertJacobian wjDResponseDEdgeParams) - { - if (null == wjDResponseDEdgeParams) return null; - - int iNumSegment = _aLSRM.length; - org.drip.quant.calculus.WengertJacobian wjDResponseDEdgeResponse = null; - - try { - wjDResponseDEdgeResponse = new org.drip.quant.calculus.WengertJacobian (1, iNumSegment + 1); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int i = 0; i <= iNumSegment; ++i) { - if (i == iNodeIndex) { - if (!wjDResponseDEdgeResponse.accumulatePartialFirstDerivative (0, i, - wjDResponseDEdgeParams.firstDerivative (0, - org.drip.spline.segment.LatentStateResponseModel.LEFT_NODE_VALUE_PARAMETER_INDEX)) || - !wjDResponseDEdgeResponse.accumulatePartialFirstDerivative (0, i + 1, - wjDResponseDEdgeParams.firstDerivative (0, - org.drip.spline.segment.LatentStateResponseModel.RIGHT_NODE_VALUE_PARAMETER_INDEX))) - return null; - } - } - - return wjDResponseDEdgeResponse; - } - - /** - * CalibratableMultiSegmentSequence constructor - Construct a sequence of Basis Spline Segments - * - * @param strName Name of the Stretch - * @param aCS Array of Segments - * @param aSCBC Array of Segment Builder Parameters - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public CalibratableMultiSegmentSequence ( - final java.lang.String strName, - final org.drip.spline.segment.LatentStateResponseModel[] aCS, - final org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC) - throws java.lang.Exception - { - super (null); - - if (null == aCS || null == aSCBC || null == (_strName = strName) || _strName.isEmpty()) - throw new java.lang.Exception ("CalibratableMultiSegmentSequence ctr => Invalid inputs!"); - - int iNumSegment = aCS.length; - _aLSRM = new org.drip.spline.segment.LatentStateResponseModel[iNumSegment]; - _aSCBC = new org.drip.spline.params.SegmentCustomBuilderControl[iNumSegment]; - - if (0 == iNumSegment || iNumSegment != aSCBC.length) - throw new java.lang.Exception ("CalibratableMultiSegmentSequence ctr => Invalid inputs!"); - - for (int i = 0; i < iNumSegment; ++i) { - if (null == (_aLSRM[i] = aCS[i]) || null == (_aSCBC[i] = aSCBC[i])) - throw new java.lang.Exception ("CalibratableMultiSegmentSequence ctr => Invalid inputs!"); - } - } - - @Override public java.lang.String name() - { - return _strName; - } - - @Override public org.drip.spline.segment.LatentStateResponseModel[] segments() - { - return _aLSRM; - } - - @Override public org.drip.spline.params.SegmentCustomBuilderControl[] segmentBuilderControl() - { - return _aSCBC; - } - - @Override public boolean setup ( - final org.drip.spline.stretch.SegmentSequenceBuilder ssb, - final int iCalibrationDetail) - { - if (null == (_ssb = ssb) || !_ssb.setStretch (this)) return false; - - if (org.drip.spline.stretch.BoundarySettings.BOUNDARY_CONDITION_FLOATING == - _ssb.getCalibrationBoundaryCondition().boundaryCondition()) { - if (!_ssb.calibStartingSegment (0.) || !_ssb.calibSegmentSequence (1) || - !_ssb.manifestMeasureSensitivity (0.)) - return false; - } else if (0 != (org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE & iCalibrationDetail)) { - org.drip.function.r1tor1solver.FixedPointFinderOutput fpop = null; - - if (null == fpop || !fpop.containsRoot()) { - try { - fpop = new org.drip.function.r1tor1solver.FixedPointFinderZheng (0., this, - true).findRoot(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - if (null == fpop || !org.drip.quant.common.NumberUtil.IsValid (fpop.getRoot()) || - !_ssb.manifestMeasureSensitivity (0.)) { - System.out.println ("FPOP: " + fpop); - - return false; - } - } - - if (0 != (org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE_JACOBIAN & iCalibrationDetail)) { - int iNumSegment = _aLSRM.length; - - try { - if (null == (_wjDCoeffDEdgeParams = new org.drip.quant.calculus.WengertJacobian - (_aLSRM[0].basisEvaluator().numBasis(), iNumSegment + 1))) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - org.drip.quant.calculus.WengertJacobian wjHead = _aLSRM[0].jackDCoeffDEdgeInputs(); - - if (!setDCoeffDEdgeParams (0, wjHead) || !setDCoeffDEdgeParams (1, wjHead)) return false; - - for (int i = 1; i < iNumSegment; ++i) { - if (!setDCoeffDEdgeParams (i + 1, _aLSRM[i].jackDCoeffDEdgeInputs())) return false; - } - } - - return true; - } - - @Override public boolean setup ( - final org.drip.spline.params.SegmentResponseValueConstraint srvcLeading, - final org.drip.spline.params.SegmentResponseValueConstraint[] aSRVC, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final org.drip.spline.stretch.BoundarySettings bs, - final int iCalibrationDetail) - { - try { - return setup (new org.drip.spline.stretch.CkSegmentSequenceBuilder (srvcLeading, aSRVC, sbfr, - bs), iCalibrationDetail); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - @Override public boolean setup ( - final double dblLeftStretchResponseValue, - final org.drip.spline.params.SegmentResponseValueConstraint[] aSRVC, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final org.drip.spline.stretch.BoundarySettings bs, - final int iCalibrationDetail) - { - return setup (org.drip.spline.params.SegmentResponseValueConstraint.FromPredictorResponsePair - (getLeftPredictorOrdinateEdge(), dblLeftStretchResponseValue), aSRVC, sbfr, bs, - iCalibrationDetail); - } - - @Override public boolean setup ( - final double dblLeftStretchResponseValue, - final double[] adblSegmentRightResponseValue, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final org.drip.spline.stretch.BoundarySettings bs, - final int iCalibrationDetail) - { - int iNumSegment = _aLSRM.length; - org.drip.spline.params.SegmentResponseValueConstraint[] aSRVCRight = new - org.drip.spline.params.SegmentResponseValueConstraint[iNumSegment]; - - if (0 == iNumSegment || iNumSegment != adblSegmentRightResponseValue.length) return false; - - try { - for (int i = 0; i < iNumSegment; ++i) - aSRVCRight[i] = new org.drip.spline.params.SegmentResponseValueConstraint (new double[] - {_aLSRM[i].right()}, new double[] {1.}, adblSegmentRightResponseValue[i]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - return setup (dblLeftStretchResponseValue, aSRVCRight, sbfr, bs, iCalibrationDetail); - } - - @Override public boolean setupHermite ( - final org.drip.spline.params.SegmentPredictorResponseDerivative[] aSPRDLeft, - final org.drip.spline.params.SegmentPredictorResponseDerivative[] aSPRDRight, - final org.drip.spline.params.SegmentResponseValueConstraint[][] aaSRVC, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final int iSetupMode) - { - if (null == aSPRDLeft || null == aSPRDRight) return false; - - int iNumSegment = _aLSRM.length; - - if (iNumSegment != aSPRDLeft.length || iNumSegment != aSPRDRight.length || (null != aaSRVC && - iNumSegment != aaSRVC.length)) - return false; - - for (int i = 0; i < iNumSegment; ++i) { - try { - int iNumSegmentConstraint = 0; - org.drip.spline.params.SegmentBasisFlexureConstraint[] aSBFC = null; - - if (null != aaSRVC && null != aaSRVC[i]) { - aSBFC = new org.drip.spline.params.SegmentBasisFlexureConstraint[iNumSegmentConstraint = - aaSRVC[i].length]; - - for (int j = 0; i < iNumSegmentConstraint; ++j) - aSBFC[j] = null == aaSRVC[i][j] ? null : aaSRVC[i][j].responseIndexedBasisConstraint - (_aLSRM[i].basisEvaluator(), _aLSRM[i]); - } - - if (0 != (org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE & iSetupMode) && - !_aLSRM[i].calibrateState (new org.drip.spline.params.SegmentStateCalibrationInputs (new - double[] {_aLSRM[i].left(), _aLSRM[i].right()}, new double[] - {aSPRDLeft[i].responseValue(), aSPRDRight[i].responseValue()}, - aSPRDLeft[i].getDResponseDPredictorOrdinate(), - aSPRDRight[i].getDResponseDPredictorOrdinate(), aSBFC, null == sbfr ? - null : sbfr.sizeToSegment (_aLSRM[i])))) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - if (0 != (org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE_JACOBIAN & iSetupMode)) { - try { - if (null == (_wjDCoeffDEdgeParams = new org.drip.quant.calculus.WengertJacobian - (_aLSRM[0].basisEvaluator().numBasis(), iNumSegment + 1))) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - org.drip.quant.calculus.WengertJacobian wjDCoeffDEdgeParamsHead = - _aLSRM[0].jackDCoeffDEdgeInputs(); - - if (!setDCoeffDEdgeParams (0, wjDCoeffDEdgeParamsHead) || !setDCoeffDEdgeParams (1, - wjDCoeffDEdgeParamsHead)) - return false; - - for (int i = 1; i < iNumSegment; ++i) { - if (!setDCoeffDEdgeParams (i + 1, _aLSRM[i].jackDCoeffDEdgeInputs())) return false; - } - } - - return true; - } - - @Override public double evaluate ( - final double dblLeftSlope) - throws java.lang.Exception - { - if (null == _ssb || !_ssb.calibStartingSegment (dblLeftSlope) || !_ssb.calibSegmentSequence (1)) - throw new java.lang.Exception - ("CalibratableMultiSegmentSequence::evaluate => cannot set up segments!"); - - org.drip.spline.stretch.BoundarySettings bs = _ssb.getCalibrationBoundaryCondition(); - - int iBC = bs.boundaryCondition(); - - if (org.drip.spline.stretch.BoundarySettings.BOUNDARY_CONDITION_NATURAL == iBC) - return calcRightEdgeDerivative (bs.rightDerivOrder()); - - if (org.drip.spline.stretch.BoundarySettings.BOUNDARY_CONDITION_FINANCIAL == iBC) - return calcRightEdgeDerivative (bs.rightDerivOrder()); - - if (org.drip.spline.stretch.BoundarySettings.BOUNDARY_CONDITION_NOT_A_KNOT == iBC) - return calcRightEdgeDerivative (bs.rightDerivOrder()) - calcLeftEdgeDerivative - (bs.leftDerivOrder()); - - throw new java.lang.Exception ("CalibratableMultiSegmentSequence::evaluate => Boundary Condition " + - iBC + " unknown"); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || !org.drip.quant.common.NumberUtil.IsValid - (dblEnd)) - throw new java.lang.Exception ("CalibratableMultiSegmentSequence::integrate => Invalid Inputs"); - - return org.drip.quant.calculus.R1ToR1Integrator.Boole (this, dblBegin, dblEnd); - } - - @Override public boolean setLeftNode ( - final double dblStretchLeftResponse, - final double dblStretchLeftResponseSlope, - final double dblStretchRightResponse, - final org.drip.spline.params.StretchBestFitResponse sbfr) - { - return _aLSRM[0].calibrate - (org.drip.spline.params.SegmentResponseValueConstraint.FromPredictorResponsePair - (getLeftPredictorOrdinateEdge(), dblStretchLeftResponse), dblStretchLeftResponseSlope, - org.drip.spline.params.SegmentResponseValueConstraint.FromPredictorResponsePair - (getRightPredictorOrdinateEdge(), dblStretchRightResponse), null == sbfr ? null : - sbfr.sizeToSegment (_aLSRM[0])); - } - - @Override public double responseValue ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - return _aLSRM[containingIndex (dblPredictorOrdinate, true, true)].responseValue - (dblPredictorOrdinate); - } - - @Override public double responseValueDerivative ( - final double dblPredictorOrdinate, - final int iOrder) - throws java.lang.Exception - { - return _aLSRM[containingIndex (dblPredictorOrdinate, true, true)].calcResponseValueDerivative - (dblPredictorOrdinate, iOrder); - } - - @Override public org.drip.spline.params.SegmentPredictorResponseDerivative calcSPRD ( - final double dblPredictorOrdinate) - { - int iIndex = -1; - - try { - iIndex = containingIndex (dblPredictorOrdinate, true, true); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - int iCk = _aSCBC[iIndex].inelasticParams().Ck(); - - double adblDeriv[] = new double[iCk]; - - try { - for (int i = 0; i < iCk; ++i) - adblDeriv[i] = _aLSRM[iIndex].calcResponseValueDerivative (dblPredictorOrdinate, i); - - return new org.drip.spline.params.SegmentPredictorResponseDerivative - (_aLSRM[iIndex].responseValue (dblPredictorOrdinate), adblDeriv); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDResponseDCalibrationInput ( - final double dblPredictorOrdinate, - final int iOrder) - { - int iIndex = -1; - - try { - iIndex = containingIndex (dblPredictorOrdinate, true, true); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return setDResponseDEdgeResponse (iIndex, _aLSRM[iIndex].jackDResponseDEdgeInput - (dblPredictorOrdinate, iOrder)); - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDResponseDManifestMeasure ( - final java.lang.String strManifestMeasure, - final double dblPredictorOrdinate, - final int iOrder) - { - int iPriorImpactFadeIndex = 0; - int iNumSegment = _aLSRM.length; - - try { - int iIndex = containingIndex (dblPredictorOrdinate, true, true); - - boolean bContainingSegmentImpactFade = _aLSRM[iIndex].impactFade (strManifestMeasure); - - if (!bContainingSegmentImpactFade && 0 != iIndex) { - for (int i = iIndex - 1; i >= 0; --i) { - if (_aLSRM[i].impactFade (strManifestMeasure)) { - iPriorImpactFadeIndex = i; - break; - } - } - } - - org.drip.quant.calculus.WengertJacobian wjDResponseDManifestMeasure = new - org.drip.quant.calculus.WengertJacobian (1, iNumSegment); - - for (int i = 0; i < iNumSegment; ++i) { - double dblDResponseDManifestMeasurei = 0.; - - if (i == iIndex) - dblDResponseDManifestMeasurei = _aLSRM[i].calcDResponseDManifest (strManifestMeasure, - dblPredictorOrdinate, iOrder); - else if (i == iIndex - 1) - dblDResponseDManifestMeasurei = _aLSRM[i + 1].calcDResponseDPreceedingManifest - (strManifestMeasure, dblPredictorOrdinate, iOrder); - else if (!bContainingSegmentImpactFade && i >= iPriorImpactFadeIndex && i < iIndex - 1) - dblDResponseDManifestMeasurei = _aLSRM[i].calcDResponseDManifest (strManifestMeasure, - _aLSRM[i].right(), iOrder); - - if (!wjDResponseDManifestMeasure.accumulatePartialFirstDerivative (0, i, - dblDResponseDManifestMeasurei)) - return null; - } - - return wjDResponseDManifestMeasure; - } catch (java.lang.Exception e) { - // e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.spline.segment.Monotonocity monotoneType ( - final double dblPredictorOrdinate) - { - int iIndex = -1; - - try { - iIndex = containingIndex (dblPredictorOrdinate, true, true); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return _aLSRM[iIndex].monotoneType(); - } - - @Override public boolean isLocallyMonotone() - throws java.lang.Exception - { - int iNumSegment = _aLSRM.length; - - for (int i = 0; i < iNumSegment; ++i) { - org.drip.spline.segment.Monotonocity mono = null; - - try { - mono = _aLSRM[i].monotoneType(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - if (null == mono || org.drip.spline.segment.Monotonocity.MONOTONIC != mono.type()) return false; - } - - return true; - } - - @Override public boolean isCoMonotone ( - final double[] adblMeasuredResponse) - throws java.lang.Exception - { - int iNumSegment = _aLSRM.length; - int[] aiMonotoneType = new int[iNumSegment]; - int[] aiNodeMiniMax = new int[iNumSegment + 1]; - - if (null == adblMeasuredResponse || adblMeasuredResponse.length != iNumSegment + 1) - throw new java.lang.Exception - ("CalibratableMultiSegmentSequence::isCoMonotone => Data input inconsistent with the segment"); - - for (int i = 0; i < iNumSegment + 1; ++i) { - if (0 == i || iNumSegment == i) - aiNodeMiniMax[i] = MONOTONE_PREDICTOR_ORDINATE_NODE; - else { - if (adblMeasuredResponse[i - 1] < adblMeasuredResponse[i] && adblMeasuredResponse[i + 1] < - adblMeasuredResponse[i]) - aiNodeMiniMax[i] = MAXIMA_PREDICTOR_ORDINATE_NODE; - else if (adblMeasuredResponse[i - 1] > adblMeasuredResponse[i] && adblMeasuredResponse[i + 1] - > adblMeasuredResponse[i]) - aiNodeMiniMax[i] = MINIMA_PREDICTOR_ORDINATE_NODE; - else - aiNodeMiniMax[i] = MONOTONE_PREDICTOR_ORDINATE_NODE; - } - - if (i < iNumSegment) { - org.drip.spline.segment.Monotonocity mono = _aLSRM[i].monotoneType(); - - if (null != mono) aiMonotoneType[i] = mono.type(); - } - } - - for (int i = 1; i < iNumSegment; ++i) { - if (MAXIMA_PREDICTOR_ORDINATE_NODE == aiNodeMiniMax[i]) { - if (org.drip.spline.segment.Monotonocity.MAXIMA != aiMonotoneType[i] && - org.drip.spline.segment.Monotonocity.MAXIMA != aiMonotoneType[i - 1]) - return false; - } else if (MINIMA_PREDICTOR_ORDINATE_NODE == aiNodeMiniMax[i]) { - if (org.drip.spline.segment.Monotonocity.MINIMA != aiMonotoneType[i] && - org.drip.spline.segment.Monotonocity.MINIMA != aiMonotoneType[i - 1]) - return false; - } - } - - return true; - } - - @Override public boolean isKnot ( - final double dblPredictorOrdinate) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorOrdinate)) return false; - - int iNumSegment = _aLSRM.length; - - for (int i = 0; i < iNumSegment; ++i) { - if (dblPredictorOrdinate == _aLSRM[i].left()) return false; - } - - return dblPredictorOrdinate == _aLSRM[iNumSegment - 1].left(); - } - - @Override public double calcLeftEdgeDerivative ( - final int iOrder) - throws java.lang.Exception - { - org.drip.spline.segment.LatentStateResponseModel lsrm = _aLSRM[0]; - - return lsrm.calcResponseValueDerivative (lsrm.left(), iOrder); - } - - @Override public double calcRightEdgeDerivative ( - final int iOrder) - throws java.lang.Exception - { - org.drip.spline.segment.LatentStateResponseModel lsrm = _aLSRM[_aLSRM.length - 1]; - - return lsrm.calcResponseValueDerivative (lsrm.right(), iOrder); - } - - @Override public boolean resetNode ( - final int iPredictorOrdinateIndex, - final double dblResponseReset) - { - if (0 == iPredictorOrdinateIndex || 1 == iPredictorOrdinateIndex || _aLSRM.length < - iPredictorOrdinateIndex || !org.drip.quant.common.NumberUtil.IsValid (dblResponseReset)) - return false; - - return _aLSRM[iPredictorOrdinateIndex - 1].calibrate (_aLSRM[iPredictorOrdinateIndex - 2], - dblResponseReset, null); - } - - @Override public boolean resetNode ( - final int iPredictorOrdinateIndex, - final org.drip.spline.params.SegmentResponseValueConstraint srvcReset) - { - if (0 == iPredictorOrdinateIndex || 1 == iPredictorOrdinateIndex || _aLSRM.length < - iPredictorOrdinateIndex || null == srvcReset) - return false; - - return _aLSRM[iPredictorOrdinateIndex - 1].calibrate (_aLSRM[iPredictorOrdinateIndex - 2], srvcReset, - null); - } - - @Override public org.drip.function.definition.R1ToR1 toAU() - { - org.drip.function.definition.R1ToR1 au = new - org.drip.function.definition.R1ToR1 (null) - { - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - return responseValue (dblVariate); - } - - @Override public double derivative ( - final double dblVariate, - final int iOrder) - throws java.lang.Exception - { - return responseValueDerivative (dblVariate, iOrder); - } - }; - - return au; - } - - @Override public boolean in ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorOrdinate)) - throw new java.lang.Exception ("CalibratableMultiSegmentSequence::in => Invalid inputs"); - - return dblPredictorOrdinate >= getLeftPredictorOrdinateEdge() && dblPredictorOrdinate <= - getRightPredictorOrdinateEdge(); - } - - @Override public double getLeftPredictorOrdinateEdge() - { - return _aLSRM[0].left(); - } - - @Override public double getRightPredictorOrdinateEdge() - { - return _aLSRM[_aLSRM.length - 1].right(); - } - - @Override public int containingIndex ( - final double dblPredictorOrdinate, - final boolean bIncludeLeft, - final boolean bIncludeRight) - throws java.lang.Exception - { - if (!in (dblPredictorOrdinate)) - throw new java.lang.Exception - ("CalibratableMultiSegmentSequence::containingIndex => Predictor Ordinate not in the Stretch Range"); - - int iNumSegment = _aLSRM.length; - - for (int i = 0 ; i < iNumSegment; ++i) { - boolean bLeftValid = bIncludeLeft ? _aLSRM[i].left() <= dblPredictorOrdinate : _aLSRM[i].left() < - dblPredictorOrdinate; - - boolean bRightValid = bIncludeRight ? _aLSRM[i].right() >= dblPredictorOrdinate : - _aLSRM[i].right() > dblPredictorOrdinate; - - if (bLeftValid && bRightValid) return i; - } - - throw new java.lang.Exception - ("CalibratableMultiSegmentSequence::containingIndex => Cannot locate Containing Index"); - } - - @Override public CalibratableMultiSegmentSequence clipLeft ( - final java.lang.String strName, - final double dblPredictorOrdinate) - { - int iNumSegment = _aLSRM.length; - int iContainingPredictorOrdinateIndex = 0; - - try { - iContainingPredictorOrdinateIndex = containingIndex (dblPredictorOrdinate, true, false); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - int iNumClippedSegment = iNumSegment - iContainingPredictorOrdinateIndex; - org.drip.spline.segment.LatentStateResponseModel[] aCS = new - org.drip.spline.segment.LatentStateResponseModel[iNumClippedSegment]; - org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC = new - org.drip.spline.params.SegmentCustomBuilderControl[iNumClippedSegment]; - - for (int i = 0; i < iNumClippedSegment; ++i) { - if (null == (aCS[i] = 0 == i ? - _aLSRM[iContainingPredictorOrdinateIndex].clipLeftOfPredictorOrdinate (dblPredictorOrdinate) - : _aLSRM[i + iContainingPredictorOrdinateIndex])) - return null; - - aSCBC[i] = _aSCBC[i + iContainingPredictorOrdinateIndex]; - } - - try { - return new CalibratableMultiSegmentSequence (strName, aCS, aSCBC); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public CalibratableMultiSegmentSequence clipRight ( - final java.lang.String strName, - final double dblPredictorOrdinate) - { - int iContainingPredictorOrdinateIndex = 0; - - try { - iContainingPredictorOrdinateIndex = containingIndex (dblPredictorOrdinate, false, true); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.spline.segment.LatentStateResponseModel[] aCS = new - org.drip.spline.segment.LatentStateResponseModel[iContainingPredictorOrdinateIndex + 1]; - org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC = new - org.drip.spline.params.SegmentCustomBuilderControl[iContainingPredictorOrdinateIndex + 1]; - - for (int i = 0; i <= iContainingPredictorOrdinateIndex; ++i) { - if (null == (aCS[i] = iContainingPredictorOrdinateIndex == i ? - _aLSRM[iContainingPredictorOrdinateIndex].clipRightOfPredictorOrdinate (dblPredictorOrdinate) - : _aLSRM[i])) - return null; - - aSCBC[i] = _aSCBC[i]; - } - - try { - return new CalibratableMultiSegmentSequence (strName, aCS, aSCBC); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public double curvatureDPE() - throws java.lang.Exception - { - double dblDPE = 0.; - - for (org.drip.spline.segment.LatentStateResponseModel lsrm : _aLSRM) - dblDPE += lsrm.curvatureDPE(); - - return dblDPE; - } - - @Override public double lengthDPE() - throws java.lang.Exception - { - double dblDPE = 0.; - - for (org.drip.spline.segment.LatentStateResponseModel lsrm : _aLSRM) - dblDPE += lsrm.lengthDPE(); - - return dblDPE; - } - - @Override public double bestFitDPE ( - final org.drip.spline.params.StretchBestFitResponse rbfr) - throws java.lang.Exception - { - if (null == rbfr) return 0.; - - double dblDPE = 0.; - - for (org.drip.spline.segment.LatentStateResponseModel lsrm : _aLSRM) - dblDPE += lsrm.bestFitDPE (rbfr.sizeToSegment (lsrm)); - - return dblDPE; - } - - @Override public org.drip.state.representation.MergeSubStretchManager msm() - { - return null; - } - - @Override public java.lang.String displayString() - { - java.lang.StringBuffer sb = new java.lang.StringBuffer(); - - for (int i = 0; i < _aLSRM.length; ++i) - sb.append (_aLSRM[i].displayString() + " \n"); - - return sb.toString(); - } -} diff --git a/org/drip/spline/stretch/CkSegmentSequenceBuilder.java b/org/drip/spline/stretch/CkSegmentSequenceBuilder.java deleted file mode 100644 index 6faa0d8..0000000 --- a/org/drip/spline/stretch/CkSegmentSequenceBuilder.java +++ /dev/null @@ -1,146 +0,0 @@ - -package org.drip.spline.stretch; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * CkSegmentSequenceBuilder implements the SegmentSequenceBuilder interface to customize segment sequence - * construction. Customization is applied at several levels: - * - Segment Calibration Boundary Setting/Segment Best Fit Response Settings - * - Segment Response Value Constraints for the starting and the subsequent Segments - * - * @author Lakshmi Krishnamurthy - */ - -public class CkSegmentSequenceBuilder implements org.drip.spline.stretch.SegmentSequenceBuilder { - private org.drip.spline.stretch.BoundarySettings _bs = null; - private org.drip.spline.stretch.MultiSegmentSequence _mss = null; - private org.drip.spline.params.StretchBestFitResponse _rbfr = null; - private org.drip.spline.params.SegmentResponseValueConstraint[] _aSRVC = null; - private org.drip.spline.params.SegmentResponseValueConstraint _srvcLeading = null; - - /** - * CkSegmentSequenceBuilder constructor - * - * @param srvcLeading Leading Segment Response Value Constraint - * @param aSRVC Array of Segment Response Value Constraints - * @param rbfr Sequence Best Fit Weighted Response - * @param bs The Calibration Boundary Condition - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public CkSegmentSequenceBuilder ( - final org.drip.spline.params.SegmentResponseValueConstraint srvcLeading, - final org.drip.spline.params.SegmentResponseValueConstraint[] aSRVC, - final org.drip.spline.params.StretchBestFitResponse rbfr, - final org.drip.spline.stretch.BoundarySettings bs) - throws java.lang.Exception - { - _rbfr = rbfr; - _aSRVC = aSRVC; - _srvcLeading = srvcLeading; - - if (null == _srvcLeading && (null == _aSRVC || 0 == _aSRVC.length) && null == _rbfr) - throw new java.lang.Exception ("CkSegmentSequenceBuilder ctr: Invalid inputs!"); - - if (null == (_bs = bs)) - throw new java.lang.Exception ("CkSegmentSequenceBuilder ctr: Invalid inputs!"); - } - - @Override public boolean setStretch ( - final org.drip.spline.stretch.MultiSegmentSequence mss) - { - if (null == mss) return false; - - _mss = mss; - return true; - } - - @Override public org.drip.spline.stretch.BoundarySettings getCalibrationBoundaryCondition() - { - return _bs; - } - - @Override public boolean calibStartingSegment ( - final double dblLeftSlope) - { - if (null == _mss) return false; - - org.drip.spline.segment.LatentStateResponseModel[] aCS = _mss.segments(); - - return null != aCS && 0 < aCS.length && aCS[0].calibrate (_srvcLeading, dblLeftSlope, null == _aSRVC - ? null : _aSRVC[0], null == _rbfr ? null : _rbfr.sizeToSegment (aCS[0])); - } - - @Override public boolean calibSegmentSequence ( - final int iStartingSegment) - { - if (null == _mss) return false; - - org.drip.spline.segment.LatentStateResponseModel[] aCS = _mss.segments(); - - int iNumSegment = aCS.length; - - for (int iSegment = iStartingSegment; iSegment < iNumSegment; ++iSegment) { - if (!aCS[iSegment].calibrate (0 == iSegment ? null : aCS[iSegment - 1], null == _aSRVC ? null : - _aSRVC[iSegment], null == _rbfr ? null : _rbfr.sizeToSegment (aCS[iSegment]))) - return false; - } - - return true; - } - - @Override public boolean manifestMeasureSensitivity ( - final double dblLeftSlopeSensitivity) - { - return true; - } -} diff --git a/org/drip/spline/stretch/MultiSegmentSequence.java b/org/drip/spline/stretch/MultiSegmentSequence.java deleted file mode 100644 index 0a869af..0000000 --- a/org/drip/spline/stretch/MultiSegmentSequence.java +++ /dev/null @@ -1,357 +0,0 @@ - -package org.drip.spline.stretch; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * MultiSegmentSequence is the interface that exposes functionality that spans multiple segments. Its derived - * instances hold the ordered segment sequence, the segment control parameters, and, if available, the - * spanning Jacobian. MultiSegmentSequence exports the following group of functionality: - * - Retrieve the Segments and their Builder Parameters. - * - Compute the monotonicity details - segment/Stretch level monotonicity, co-monotonicity, local - * monotonicity. - * - Check if the Predictor Ordinate is in the Stretch Range, and return the segment index in that case. - * - Set up (i.e., calibrate) the individual Segments in the Stretch by specifying one/or more of the node - * parameters and Target Constraints. - * - Set up (i.e., calibrate) the individual Segment in the Stretch to the Target Segment Edge Values and - * Constraints. This is also called the Hermite setup - where the segment boundaries are entirely - * locally set. - * - Generate a new Stretch by clipping all the Segments to the Left/Right of the specified Predictor - * Ordinate. Smoothness Constraints will be maintained. - * - Retrieve the Span Curvature/Length, and the Best Fit DPE's. - * - Retrieve the Merge Stretch Manager. - * - Display the Segments. - * - * @author Lakshmi Krishnamurthy - */ - -public interface MultiSegmentSequence extends org.drip.spline.stretch.SingleSegmentSequence { - - /** - * Calibration Detail: Calibrate the Stretch as part of the set up - */ - - public static final int CALIBRATE = 1; - - /** - * Calibration Detail: Calibrate the Stretch AND compute Jacobian as part of the set up - */ - - public static final int CALIBRATE_JACOBIAN = 2; - - /** - * Retrieve the Stretch Name - * - * @return The Stretch Name - */ - - public abstract java.lang.String name(); - - /** - * Retrieve the Segment Builder Parameters - * - * @return The Segment Builder Parameters - */ - - public abstract org.drip.spline.params.SegmentCustomBuilderControl[] segmentBuilderControl(); - - /** - * Retrieve the Stretch Segments - * - * @return The Stretch Segments - */ - - public abstract org.drip.spline.segment.LatentStateResponseModel[] segments(); - - /** - * Set up (i.e., calibrate) the individual Segment in the Stretch to the Target Segment Edge Values and - * Constraints. This is also called the Hermite setup - where the segment boundaries are entirely - * locally set. - * - * @param aSPRDLeft Array of Left Segment Edge Values - * @param aSPRDRight Array of Right Segment Edge Values - * @param aaSRVC Double Array of Constraints - Outer Index corresponds to Segment Index, and the Inner - * Index to Constraint Array within each Segment - * @param sbfr Stretch Fitness Weighted Response - * @param iSetupMode Set up Mode (i.e., set up ITEP only, or fully calibrate the Stretch, or calibrate - * Stretch plus compute Jacobian) - * - * @return TRUE - Set up was successful - */ - - public abstract boolean setupHermite ( - final org.drip.spline.params.SegmentPredictorResponseDerivative[] aSPRDLeft, - final org.drip.spline.params.SegmentPredictorResponseDerivative[] aSPRDRight, - final org.drip.spline.params.SegmentResponseValueConstraint[][] aaSRVC, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final int iSetupMode); - - /** - * Set the Slope at the left Edge of the Stretch - * - * @param dblStretchLeftResponse Response Value at the Left Edge of the Stretch - * @param dblStretchLeftResponseSlope Response Slope Value at the Left Edge of the Stretch - * @param dblStretchRightResponse Response Value at the Right Edge of the Stretch - * @param sbfr Stretch Fitness Weighted Response - * - * @return TRUE - Left slope successfully set - */ - - public abstract boolean setLeftNode ( - final double dblStretchLeftResponse, - final double dblStretchLeftResponseSlope, - final double dblStretchRightResponse, - final org.drip.spline.params.StretchBestFitResponse sbfr); - - /** - * Calculate the SPRD at the specified Predictor Ordinate - * - * @param dblPredictorOrdinate The Predictor Ordinate - * - * @return The Computed SPRD - */ - - public abstract org.drip.spline.params.SegmentPredictorResponseDerivative calcSPRD ( - final double dblPredictorOrdinate); - - /** - * Calculate the Derivative of the requested order at the Left Edge of the Stretch - * - * @param iOrder Order of the Derivative - * - * @return The Derivative of the requested order at the Left Edge of the Stretch - * - * @throws java.lang.Exception Thrown if the Derivative cannot be calculated - */ - - public abstract double calcLeftEdgeDerivative ( - final int iOrder) - throws java.lang.Exception; - - /** - * Calculate the Derivative of the requested order at the right Edge of the Stretch - * - * @param iOrder Order of the Derivative - * - * @return The Derivative of the requested order at the right Edge of the Stretch - * - * @throws java.lang.Exception Thrown if the Derivative cannot be calculated - */ - - public abstract double calcRightEdgeDerivative ( - final int iOrder) - throws java.lang.Exception; - - /** - * Check if the Predictor Ordinate is in the Stretch Range - * - * @param dblPredictorOrdinate Predictor Ordinate - * - * @return TRUE - Predictor Ordinate is in the Range - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public abstract boolean in ( - final double dblPredictorOrdinate) - throws java.lang.Exception; - - /** - * Return the Index for the Segment containing specified Predictor Ordinate - * - * @param dblPredictorOrdinate Predictor Ordinate - * @param bIncludeLeft TRUE - Less than or equal to the Left Predictor Ordinate - * @param bIncludeRight TRUE - Less than or equal to the Right Predictor Ordinate - * - * @return Index for the Segment containing specified Predictor Ordinate - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public int containingIndex ( - final double dblPredictorOrdinate, - final boolean bIncludeLeft, - final boolean bIncludeRight) - throws java.lang.Exception; - - /** - * Set up (i.e., calibrate) the individual Segments in the Stretch to the Stretch Edge, the Target - * Constraints, and the custom segment sequence builder. - * - * @param ssb The Segment Sequence Builder Instance - * @param iCalibrationDetail The Calibration Detail - * - * @return TRUE - Set up was successful - */ - - public abstract boolean setup ( - final org.drip.spline.stretch.SegmentSequenceBuilder ssb, - final int iCalibrationDetail); - - /** - * Set up (i.e., calibrate) the individual Segments in the Stretch to the Stretch Left Edge and the Target - * Constraints. - * - * @param srvcLeading Stretch Left-most Segment Response Value Constraint - * @param aSRVC Array of Segment Response Value Constraints - * @param sbfr Stretch Fitness Weighted Response - * @param bs The Calibration Boundary Condition - * @param iCalibrationDetail The Calibration Detail - * - * @return TRUE - Set up was successful - */ - - public abstract boolean setup ( - final org.drip.spline.params.SegmentResponseValueConstraint srvcLeading, - final org.drip.spline.params.SegmentResponseValueConstraint[] aSRVC, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final org.drip.spline.stretch.BoundarySettings bs, - final int iCalibrationDetail); - - /** - * Set up (i.e., calibrate) the individual Segments in the Stretch to the Stretch Left Edge Response and - * the Target Constraints. - * - * @param dblStretchLeftResponseValue Stretch Left-most Response Value - * @param aSRVC Array of Segment Response Value Constraints - * @param sbfr Stretch Best Fit Weighted Response Values - * @param bs The Calibration Boundary Condition - * @param iCalibrationDetail The Calibration Detail - * - * @return TRUE - Set up was successful - */ - - public abstract boolean setup ( - final double dblStretchLeftResponseValue, - final org.drip.spline.params.SegmentResponseValueConstraint[] aSRVC, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final org.drip.spline.stretch.BoundarySettings bs, - final int iCalibrationDetail); - - /** - * Generate a new Stretch by clipping all the Segments to the Left of the specified Predictor Ordinate. - * Smoothness Constraints will be maintained. - * - * @param strName Name of the Clipped Stretch - * @param dblPredictorOrdinate Predictor Ordinate Left of which the Clipping is to be applied - * - * @return The Clipped Stretch - */ - - public abstract MultiSegmentSequence clipLeft ( - final java.lang.String strName, - final double dblPredictorOrdinate); - - /** - * Generate a new Stretch by clipping all the Segments to the Right of the specified Predictor Ordinate. - * Smoothness Constraints will be maintained. - * - * @param strName Name of the Clipped Stretch - * @param dblPredictorOrdinate Predictor Ordinate Right of which the Clipping is to be applied - * - * @return The Clipped Stretch - */ - - public abstract MultiSegmentSequence clipRight ( - final java.lang.String strName, - final double dblPredictorOrdinate); - - /** - * Retrieve the Span Curvature DPE - * - * @return The Span Curvature DPE - * - * @throws java.lang.Exception Thrown if the Span Curvature DPE cannot be computed - */ - - public abstract double curvatureDPE() - throws java.lang.Exception; - - /** - * Retrieve the Span Length DPE - * - * @return The Span Length DPE - * - * @throws java.lang.Exception Thrown if the Span Length DPE cannot be computed - */ - - public abstract double lengthDPE() - throws java.lang.Exception; - - /** - * Retrieve the Stretch Best Fit DPE - * - * @param sbfr Stretch Best Fit Weighted Response Values - * - * @return The Stretch Best Fit DPE - * - * @throws java.lang.Exception Thrown if the Stretch Best Fit DPE cannot be computed - */ - - public abstract double bestFitDPE ( - final org.drip.spline.params.StretchBestFitResponse sbfr) - throws java.lang.Exception; - - /** - * Retrieve the Merge Stretch Manager if it exists. - * - * @return The Merge Stretch Manager - */ - - public org.drip.state.representation.MergeSubStretchManager msm(); - - /** - * Display the Segments - * - * @return The Segements String - */ - - public abstract java.lang.String displayString(); -} diff --git a/org/drip/spline/stretch/MultiSegmentSequenceBuilder.java b/org/drip/spline/stretch/MultiSegmentSequenceBuilder.java deleted file mode 100644 index a9201e2..0000000 --- a/org/drip/spline/stretch/MultiSegmentSequenceBuilder.java +++ /dev/null @@ -1,512 +0,0 @@ - -package org.drip.spline.stretch; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * MultiSegmentSequenceBuilder exports Stretch creation/calibration methods to generate customized basis - * splines, with customized segment behavior using the segment control. It exports the following - * method of Stretch Creation: - * - Create an uncalibrated Stretch instance over the specified Predictor Ordinate Array using the specified - * Basis Spline Parameters for the Segment. - * - Create a calibrated Stretch Instance over the specified array of Predictor Ordinates and Response - * Values using the specified Basis Splines. - * - Create a calibrated Stretch Instance over the specified Predictor Ordinates, Response Values, and their - * Constraints, using the specified Segment Builder Parameters. - * - Create a Calibrated Stretch Instance from the Array of Predictor Ordinates and a flat Response Value. - * - Create a Regression Spline Instance over the specified array of Predictor Ordinate Knot Points and the - * Set of the Points to be Best Fit. - * - * @author Lakshmi Krishnamurthy - */ - -public class MultiSegmentSequenceBuilder { - - /** - * Polynomial Spline - */ - - public static final java.lang.String BASIS_SPLINE_POLYNOMIAL = "Polynomial"; - - /** - * Bernstein Polynomial Spline - */ - - public static final java.lang.String BASIS_SPLINE_BERNSTEIN_POLYNOMIAL = "BernsteinPolynomial"; - - /** - * Hyperbolic Tension Spline - */ - - public static final java.lang.String BASIS_SPLINE_HYPERBOLIC_TENSION = "HyperbolicTension"; - - /** - * Exponential Tension Spline - */ - - public static final java.lang.String BASIS_SPLINE_EXPONENTIAL_TENSION = "ExponentialTension"; - - /** - * Kaklis Pandelis Spline - */ - - public static final java.lang.String BASIS_SPLINE_KAKLIS_PANDELIS = "KaklisPandelis"; - - /** - * Exponential Rational Basis Spline - */ - - public static final java.lang.String BASIS_SPLINE_EXPONENTIAL_RATIONAL = "ExponentialRational"; - - /** - * Exponential Mixture Basis Spline - */ - - public static final java.lang.String BASIS_SPLINE_EXPONENTIAL_MIXTURE = "ExponentialMixture"; - - /** - * Koch-Lyche-Kvasov Exponential Tension Spline - */ - - public static final java.lang.String BASIS_SPLINE_KLK_EXPONENTIAL_TENSION = "KLKExponentialTension"; - - /** - * Koch-Lyche-Kvasov Hyperbolic Tension Spline - */ - - public static final java.lang.String BASIS_SPLINE_KLK_HYPERBOLIC_TENSION = "KLKHyperbolicTension"; - - /** - * Koch-Lyche-Kvasov Rational Linear Tension Spline - */ - - public static final java.lang.String BASIS_SPLINE_KLK_RATIONAL_LINEAR_TENSION = - "KLKRationalLinearTension"; - - /** - * Koch-Lyche-Kvasov Rational Quadratic Tension Spline - */ - - public static final java.lang.String BASIS_SPLINE_KLK_RATIONAL_QUADRATIC_TENSION = - "KLKRationalQuadraticTension"; - - /** - * Create an uncalibrated Stretch instance over the specified Predictor Ordinate Array using the - * specified Basis Spline Parameters for the Segment. - * - * @param adblPredictorOrdinate Predictor Ordinate Array - * @param aSCBC Array of Segment Builder Parameters - * - * @return Stretch instance - */ - - public static final org.drip.spline.segment.LatentStateResponseModel[] CreateSegmentSet ( - final double[] adblPredictorOrdinate, - final org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC) - { - if (null == adblPredictorOrdinate || null == aSCBC) return null; - - int iNumSegment = adblPredictorOrdinate.length - 1; - - if (1 > iNumSegment || iNumSegment != aSCBC.length) return null; - - org.drip.spline.segment.LatentStateResponseModel[] aCS = new - org.drip.spline.segment.LatentStateResponseModel[iNumSegment]; - - for (int i = 0; i < iNumSegment; ++i) { - if (null == aSCBC[i]) return null; - - java.lang.String strBasisSpline = aSCBC[i].basisSpline(); - - if (null == strBasisSpline || (!BASIS_SPLINE_POLYNOMIAL.equalsIgnoreCase (strBasisSpline) && - !BASIS_SPLINE_BERNSTEIN_POLYNOMIAL.equalsIgnoreCase (strBasisSpline) && - !BASIS_SPLINE_HYPERBOLIC_TENSION.equalsIgnoreCase (strBasisSpline) && - !BASIS_SPLINE_EXPONENTIAL_TENSION.equalsIgnoreCase (strBasisSpline) && - !BASIS_SPLINE_KAKLIS_PANDELIS.equalsIgnoreCase (strBasisSpline) && - !BASIS_SPLINE_EXPONENTIAL_RATIONAL.equalsIgnoreCase (strBasisSpline) && - !BASIS_SPLINE_EXPONENTIAL_MIXTURE.equalsIgnoreCase (strBasisSpline) && - !BASIS_SPLINE_KLK_EXPONENTIAL_TENSION.equalsIgnoreCase - (strBasisSpline) && - !BASIS_SPLINE_KLK_HYPERBOLIC_TENSION.equalsIgnoreCase - (strBasisSpline) && - !BASIS_SPLINE_KLK_RATIONAL_LINEAR_TENSION.equalsIgnoreCase - (strBasisSpline) && !BASIS_SPLINE_KLK_RATIONAL_QUADRATIC_TENSION.equalsIgnoreCase - (strBasisSpline))) - return null; - - if (BASIS_SPLINE_POLYNOMIAL.equalsIgnoreCase (strBasisSpline)) { - if (null == (aCS[i] = org.drip.spline.segment.LatentStateResponseModel.Create - (adblPredictorOrdinate[i], adblPredictorOrdinate[i + 1], - org.drip.spline.basis.FunctionSetBuilder.PolynomialBasisSet - ((org.drip.spline.basis.PolynomialFunctionSetParams) aSCBC[i].basisSetParams()), - aSCBC[i].shapeController(), aSCBC[i].inelasticParams()))) - return null; - } else if (BASIS_SPLINE_BERNSTEIN_POLYNOMIAL.equalsIgnoreCase (strBasisSpline)) { - if (null == (aCS[i] = org.drip.spline.segment.LatentStateResponseModel.Create - (adblPredictorOrdinate[i], adblPredictorOrdinate[i + 1], - org.drip.spline.basis.FunctionSetBuilder.BernsteinPolynomialBasisSet - ((org.drip.spline.basis.PolynomialFunctionSetParams) aSCBC[i].basisSetParams()), - aSCBC[i].shapeController(), aSCBC[i].inelasticParams()))) - return null; - } else if (BASIS_SPLINE_HYPERBOLIC_TENSION.equalsIgnoreCase (strBasisSpline)) { - if (null == (aCS[i] = org.drip.spline.segment.LatentStateResponseModel.Create - (adblPredictorOrdinate[i], adblPredictorOrdinate[i + 1], - org.drip.spline.basis.FunctionSetBuilder.HyperbolicTensionBasisSet - ((org.drip.spline.basis.ExponentialTensionSetParams) aSCBC[i].basisSetParams()), - aSCBC[i].shapeController(), aSCBC[i].inelasticParams()))) - return null; - } else if (BASIS_SPLINE_EXPONENTIAL_TENSION.equalsIgnoreCase (strBasisSpline)) { - if (null == (aCS[i] = org.drip.spline.segment.LatentStateResponseModel.Create - (adblPredictorOrdinate[i], adblPredictorOrdinate[i + 1], - org.drip.spline.basis.FunctionSetBuilder.ExponentialTensionBasisSet - ((org.drip.spline.basis.ExponentialTensionSetParams) aSCBC[i].basisSetParams()), - aSCBC[i].shapeController(), aSCBC[i].inelasticParams()))) - return null; - } else if (BASIS_SPLINE_KAKLIS_PANDELIS.equalsIgnoreCase (strBasisSpline)) { - if (null == (aCS[i] = org.drip.spline.segment.LatentStateResponseModel.Create - (adblPredictorOrdinate[i], adblPredictorOrdinate[i + 1], - org.drip.spline.basis.FunctionSetBuilder.KaklisPandelisBasisSet - ((org.drip.spline.basis.KaklisPandelisSetParams) aSCBC[i].basisSetParams()), - aSCBC[i].shapeController(), aSCBC[i].inelasticParams()))) - return null; - } else if (BASIS_SPLINE_EXPONENTIAL_RATIONAL.equalsIgnoreCase (strBasisSpline)) { - if (null == (aCS[i] = org.drip.spline.segment.LatentStateResponseModel.Create - (adblPredictorOrdinate[i], adblPredictorOrdinate[i + 1], - org.drip.spline.basis.FunctionSetBuilder.ExponentialRationalBasisSet - ((org.drip.spline.basis.ExponentialRationalSetParams) aSCBC[i].basisSetParams()), - aSCBC[i].shapeController(), aSCBC[i].inelasticParams()))) - return null; - } else if (BASIS_SPLINE_EXPONENTIAL_MIXTURE.equalsIgnoreCase (strBasisSpline)) { - if (null == (aCS[i] = org.drip.spline.segment.LatentStateResponseModel.Create - (adblPredictorOrdinate[i], adblPredictorOrdinate[i + 1], - org.drip.spline.basis.FunctionSetBuilder.ExponentialMixtureBasisSet - ((org.drip.spline.basis.ExponentialMixtureSetParams) aSCBC[i].basisSetParams()), - aSCBC[i].shapeController(), aSCBC[i].inelasticParams()))) - return null; - } else if (BASIS_SPLINE_KLK_EXPONENTIAL_TENSION.equalsIgnoreCase (strBasisSpline)) { - if (null == (aCS[i] = org.drip.spline.segment.LatentStateResponseModel.Create - (adblPredictorOrdinate[i], adblPredictorOrdinate[i + 1], - org.drip.spline.tension.KochLycheKvasovFamily.FromExponentialPrimitive - ((org.drip.spline.basis.ExponentialTensionSetParams) aSCBC[i].basisSetParams()), - aSCBC[i].shapeController(), aSCBC[i].inelasticParams()))) - return null; - } else if (BASIS_SPLINE_KLK_HYPERBOLIC_TENSION.equalsIgnoreCase (strBasisSpline)) { - if (null == (aCS[i] = org.drip.spline.segment.LatentStateResponseModel.Create - (adblPredictorOrdinate[i], adblPredictorOrdinate[i + 1], - org.drip.spline.tension.KochLycheKvasovFamily.FromHyperbolicPrimitive - ((org.drip.spline.basis.ExponentialTensionSetParams) aSCBC[i].basisSetParams()), - aSCBC[i].shapeController(), aSCBC[i].inelasticParams()))) - return null; - } else if (BASIS_SPLINE_KLK_RATIONAL_LINEAR_TENSION.equalsIgnoreCase (strBasisSpline)) { - if (null == (aCS[i] = org.drip.spline.segment.LatentStateResponseModel.Create - (adblPredictorOrdinate[i], adblPredictorOrdinate[i + 1], - org.drip.spline.tension.KochLycheKvasovFamily.FromRationalLinearPrimitive - ((org.drip.spline.basis.ExponentialTensionSetParams) aSCBC[i].basisSetParams()), - aSCBC[i].shapeController(), aSCBC[i].inelasticParams()))) - return null; - } else if (BASIS_SPLINE_KLK_RATIONAL_QUADRATIC_TENSION.equalsIgnoreCase (strBasisSpline)) { - if (null == (aCS[i] = org.drip.spline.segment.LatentStateResponseModel.Create - (adblPredictorOrdinate[i], adblPredictorOrdinate[i + 1], - org.drip.spline.tension.KochLycheKvasovFamily.FromRationalQuadraticPrimitive - ((org.drip.spline.basis.ExponentialTensionSetParams) aSCBC[i].basisSetParams()), - aSCBC[i].shapeController(), aSCBC[i].inelasticParams()))) - return null; - } - } - - return aCS; - } - - /** - * Create an uncalibrated Stretch instance over the specified Predictor Ordinate Array using the specified - * Basis Spline Parameters for the Segment. - * - * @param strName Name of the Stretch - * @param adblPredictorOrdinate Predictor Ordinate Array - * @param aSCBC Array of Segment Builder Parameters - * - * @return Stretch instance - */ - - public static final org.drip.spline.stretch.MultiSegmentSequence CreateUncalibratedStretchEstimator ( - final java.lang.String strName, - final double[] adblPredictorOrdinate, - final org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC) - { - try { - return new org.drip.spline.stretch.CalibratableMultiSegmentSequence (strName, CreateSegmentSet - (adblPredictorOrdinate, aSCBC), aSCBC); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create a calibrated Stretch Instance over the specified array of Predictor Ordinates and Response - * Values using the specified Basis Splines. - * - * @param strName Name of the Stretch - * @param adblPredictorOrdinate Predictor Ordinate Array - * @param adblResponseValue Response Value Array - * @param aSCBC Array of Segment Builder Parameters - * @param rbfr Stretch Fitness Weighted Response - * @param bs The Calibration Boundary Condition - * @param iCalibrationDetail The Calibration Detail - * - * @return Stretch instance - */ - - public static final org.drip.spline.stretch.MultiSegmentSequence CreateCalibratedStretchEstimator ( - final java.lang.String strName, - final double[] adblPredictorOrdinate, - final double[] adblResponseValue, - final org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC, - final org.drip.spline.params.StretchBestFitResponse rbfr, - final org.drip.spline.stretch.BoundarySettings bs, - final int iCalibrationDetail) - { - org.drip.spline.stretch.MultiSegmentSequence mss = CreateUncalibratedStretchEstimator (strName, - adblPredictorOrdinate, aSCBC); - - if (null == mss || null == adblResponseValue) return null; - - int iNumRightNode = adblResponseValue.length - 1; - double[] adblResponseValueRight = new double[iNumRightNode]; - - if (0 == iNumRightNode) return null; - - for (int i = 0; i < iNumRightNode; ++i) - adblResponseValueRight[i] = adblResponseValue[i + 1]; - - return mss.setup (adblResponseValue[0], adblResponseValueRight, rbfr, bs, iCalibrationDetail) ? mss : - null; - } - - /** - * Create a calibrated Stretch Instance over the specified array of Predictor Ordinates and Response - * Values using the specified Basis Splines. - * - * @param strName Name of the Stretch - * @param aiPredictorOrdinate Predictor Ordinate Array - * @param adblResponseValue Response Value Array - * @param aSCBC Array of Segment Builder Parameters - * @param rbfr Stretch Fitness Weighted Response - * @param bs The Calibration Boundary Condition - * @param iCalibrationDetail The Calibration Detail - * - * @return Stretch instance - */ - - public static final org.drip.spline.stretch.MultiSegmentSequence CreateCalibratedStretchEstimator ( - final java.lang.String strName, - final int[] aiPredictorOrdinate, - final double[] adblResponseValue, - final org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC, - final org.drip.spline.params.StretchBestFitResponse rbfr, - final org.drip.spline.stretch.BoundarySettings bs, - final int iCalibrationDetail) - { - if (null == aiPredictorOrdinate) return null; - - int iNumPredictorOrdinate = aiPredictorOrdinate.length; - double[] adblPredictorOrdinate = new double[iNumPredictorOrdinate]; - - if (0 == iNumPredictorOrdinate) return null; - - for (int i = 0; i < iNumPredictorOrdinate; ++i) - adblPredictorOrdinate[i] = aiPredictorOrdinate[i]; - - return CreateCalibratedStretchEstimator (strName, adblPredictorOrdinate, adblResponseValue, aSCBC, - rbfr, bs, iCalibrationDetail); - } - - /** - * Create a calibrated Stretch Instance over the specified Predictor Ordinates, Response Values, and their - * Constraints, using the specified Segment Builder Parameters. - * - * @param strName Name of the Stretch - * @param adblPredictorOrdinate Predictor Ordinate Array - * @param dblStretchLeftResponseValue Left-most Y Point - * @param aSRVC Array of Response Value Constraints - One per Segment - * @param aSCBC Array of Segment Builder Parameters - One per Segment - * @param rbfr Stretch Fitness Weighted Response - * @param bs The Calibration Boundary Condition - * @param iCalibrationDetail The Calibration Detail - * - * @return Stretch Instance - */ - - public static final org.drip.spline.stretch.MultiSegmentSequence CreateCalibratedStretchEstimator ( - final java.lang.String strName, - final double[] adblPredictorOrdinate, - final double dblStretchLeftResponseValue, - final org.drip.spline.params.SegmentResponseValueConstraint[] aSRVC, - final org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC, - final org.drip.spline.params.StretchBestFitResponse rbfr, - final org.drip.spline.stretch.BoundarySettings bs, - final int iCalibrationDetail) - { - org.drip.spline.stretch.MultiSegmentSequence mss = CreateUncalibratedStretchEstimator (strName, - adblPredictorOrdinate, aSCBC); - - return null == mss ? null : mss.setup (dblStretchLeftResponseValue, aSRVC, rbfr, bs, - iCalibrationDetail) ? mss : null; - } - - /** - * Create a calibrated Stretch Instance over the specified Predictor Ordinates and the Response Value - * Constraints, with the Segment Builder Parameters. - * - * @param strName Name of the Stretch - * @param adblPredictorOrdinate Predictor Ordinate Array - * @param srvcStretchLeft Stretch Left Constraint - * @param aSRVC Array of Segment Constraints - One per Segment - * @param aSCBC Array of Segment Builder Parameters - One per Segment - * @param sbfr Stretch Fitness Weighted Response - * @param bs The Calibration Boundary Condition - * @param iCalibrationDetail The Calibration Detail - * - * @return Stretch Instance - */ - - public static final org.drip.spline.stretch.MultiSegmentSequence CreateCalibratedStretchEstimator ( - final java.lang.String strName, - final double[] adblPredictorOrdinate, - final org.drip.spline.params.SegmentResponseValueConstraint srvcStretchLeft, - final org.drip.spline.params.SegmentResponseValueConstraint[] aSRVC, - final org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final org.drip.spline.stretch.BoundarySettings bs, - final int iCalibrationDetail) - { - org.drip.spline.stretch.MultiSegmentSequence mss = CreateUncalibratedStretchEstimator (strName, - adblPredictorOrdinate, aSCBC); - - return null == mss ? null : mss.setup (srvcStretchLeft, aSRVC, sbfr, bs, iCalibrationDetail) ? mss : - null; - } - - /** - * Create a Calibrated Stretch Instance from the Array of Predictor Ordinates and a flat Response Value - * - * @param strName Name of the Stretch - * @param adblPredictorOrdinate Predictor Ordinate Array - * @param dblResponseValue Response Value - * @param scbc Segment Builder Parameters - One per Segment - * @param sbfr Stretch Fitness Weighted Response - * @param bs The Calibration Boundary Condition - * @param iCalibrationDetail The Calibration Detail - * - * @return Stretch Instance - */ - - public static final org.drip.spline.stretch.MultiSegmentSequence CreateCalibratedStretchEstimator ( - final java.lang.String strName, - final double[] adblPredictorOrdinate, - final double dblResponseValue, - final org.drip.spline.params.SegmentCustomBuilderControl scbc, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final org.drip.spline.stretch.BoundarySettings bs, - final int iCalibrationDetail) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblResponseValue) || null == adblPredictorOrdinate || - null == scbc) - return null; - - int iNumPredictorOrdinate = adblPredictorOrdinate.length; - - if (1 >= iNumPredictorOrdinate) return null; - - double[] adblResponseValue = new double[iNumPredictorOrdinate]; - org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC = new - org.drip.spline.params.SegmentCustomBuilderControl[iNumPredictorOrdinate - 1]; - - for (int i = 0; i < iNumPredictorOrdinate; ++i) { - adblResponseValue[i] = dblResponseValue; - - if (0 != i) aSCBC[i - 1] = scbc; - } - - return CreateCalibratedStretchEstimator (strName, adblPredictorOrdinate, adblResponseValue, aSCBC, - sbfr, bs, iCalibrationDetail); - } - - /** - * Create a Regression Spline Instance over the specified array of Predictor Ordinate Knot Points and the - * Set of the Points to be Best Fit. - * - * @param strName Name of the Stretch - * @param adblKnotPredictorOrdinate Array of the Predictor Ordinate Knots - * @param aSCBC Array of Segment Builder Parameters - * @param sbfr Stretch Fitness Weighted Response - * @param bs The Calibration Boundary Condition - * @param iCalibrationDetail The Calibration Detail - * - * @return Stretch instance - */ - - public static final org.drip.spline.stretch.MultiSegmentSequence CreateRegressionSplineEstimator ( - final java.lang.String strName, - final double[] adblKnotPredictorOrdinate, - final org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final org.drip.spline.stretch.BoundarySettings bs, - final int iCalibrationDetail) - { - org.drip.spline.stretch.MultiSegmentSequence mss = CreateUncalibratedStretchEstimator (strName, - adblKnotPredictorOrdinate, aSCBC); - - if (null == mss) return null; - - return mss.setup (null, null, sbfr, bs, iCalibrationDetail) ? mss : null; - } -} diff --git a/org/drip/spline/stretch/MultiSegmentSequenceModifier.java b/org/drip/spline/stretch/MultiSegmentSequenceModifier.java deleted file mode 100644 index 05945a7..0000000 --- a/org/drip/spline/stretch/MultiSegmentSequenceModifier.java +++ /dev/null @@ -1,362 +0,0 @@ - -package org.drip.spline.stretch; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * MultiSegmentSequenceModifier exports Stretch modification/alteration methods to generate customized basis - * splines, with customized segment behavior using the segment control. It exposes the following stretch - * modification methods: - * - Insert the specified Predictor Ordinate Knot into the specified Stretch, using the specified Response - * Value. - * - Append a Segment to the Right of the Specified Stretch using the Supplied Constraint. - * - Insert the Predictor Ordinate Knot into the specified Stretch. - * - Insert a Cardinal Knot into the specified Stretch at the specified Predictor Ordinate Location. - * - Insert a Catmull-Rom Knot into the specified Stretch at the specified Predictor Ordinate Location. - * - * @author Lakshmi Krishnamurthy - */ - -public class MultiSegmentSequenceModifier { - - /** - * Insert the specified Predictor Ordinate Knot into the specified Stretch, using the specified Response - * Value - * - * @param mssIn Input Stretch - * @param dblPredictorOrdinate Predictor Ordinate Knot - * @param dblResponseValue Response Value - * @param bs The Calibration Boundary Condition - * @param iCalibrationDetail The Calibration Detail - * - * @return The Stretch with the Knot inserted - */ - - public static final org.drip.spline.stretch.MultiSegmentSequence InsertKnot ( - final org.drip.spline.stretch.MultiSegmentSequence mssIn, - final double dblPredictorOrdinate, - final double dblResponseValue, - final org.drip.spline.stretch.BoundarySettings bs, - final int iCalibrationDetail) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorOrdinate) || - !org.drip.quant.common.NumberUtil.IsValid (dblResponseValue) || null == mssIn || mssIn.isKnot - (dblPredictorOrdinate)) - return null; - - org.drip.spline.segment.LatentStateResponseModel[] aCS = mssIn.segments(); - - int iNewIndex = 0; - int iNumSegmentIn = aCS.length; - double[] adblResponseValue = new double[iNumSegmentIn + 2]; - double[] adblPredictorOrdinate = new double[iNumSegmentIn + 2]; - org.drip.spline.params.SegmentCustomBuilderControl[] aSCBCOut = new - org.drip.spline.params.SegmentCustomBuilderControl[iNumSegmentIn + 1]; - - org.drip.spline.params.SegmentCustomBuilderControl[] aSCBCIn = mssIn.segmentBuilderControl(); - - if (dblPredictorOrdinate < aCS[0].left()) { - adblPredictorOrdinate[iNewIndex] = dblPredictorOrdinate; - adblResponseValue[iNewIndex] = dblResponseValue; - aSCBCOut[iNewIndex++] = aSCBCIn[0]; - } - - for (int i = 0; i < iNumSegmentIn; ++i) { - aSCBCOut[iNewIndex] = aSCBCIn[i]; - - adblPredictorOrdinate[iNewIndex] = aCS[i].left(); - - try { - adblResponseValue[iNewIndex++] = mssIn.responseValue (aCS[i].left()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (dblPredictorOrdinate > aCS[i].left() && dblPredictorOrdinate < aCS[i].right()) { - adblPredictorOrdinate[iNewIndex] = dblPredictorOrdinate; - adblResponseValue[iNewIndex] = dblResponseValue; - aSCBCOut[iNewIndex++] = aSCBCIn[i]; - } - } - - adblPredictorOrdinate[iNewIndex] = aCS[iNumSegmentIn - 1].right(); - - try { - adblResponseValue[iNewIndex++] = mssIn.responseValue (aCS[iNumSegmentIn - 1].right()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (dblPredictorOrdinate > aCS[iNumSegmentIn - 1].right()) { - adblResponseValue[iNewIndex] = dblResponseValue; - adblPredictorOrdinate[iNewIndex] = dblPredictorOrdinate; - aSCBCOut[aSCBCOut.length - 1] = aSCBCIn[aSCBCIn.length - 1]; - } - - return org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - (mssIn.name(), adblPredictorOrdinate, adblResponseValue, aSCBCOut, null, bs, iCalibrationDetail); - } - - /** - * Append a Segment to the Right of the Specified Stretch using the Supplied Constraint - * - * @param mssIn Input Stretch - * @param dblPredictorOrdinateAppendRight The Predictor Ordinate at the Right Edge of the Segment to be - * appended - * @param srvc The Segment Response Value Constraint - * @param scbc Segment Builder Parameters - * @param bs The Calibration Boundary Condition - * @param iCalibrationDetail The Calibration Detail - * - * @return The Stretch with the Segment Appended - */ - - public static final org.drip.spline.stretch.MultiSegmentSequence AppendSegment ( - final org.drip.spline.stretch.MultiSegmentSequence mssIn, - final double dblPredictorOrdinateAppendRight, - final org.drip.spline.params.SegmentResponseValueConstraint srvc, - final org.drip.spline.params.SegmentCustomBuilderControl scbc, - final org.drip.spline.stretch.BoundarySettings bs, - final int iCalibrationDetail) - { - if (null == mssIn || null == srvc || null == scbc || !org.drip.quant.common.NumberUtil.IsValid - (dblPredictorOrdinateAppendRight)) - return null; - - double dblStretchPredictorOrdinateRight = mssIn.getRightPredictorOrdinateEdge(); - - double[] adblConstraintOrdinate = srvc.predictorOrdinates(); - - for (int i = 0; i < adblConstraintOrdinate.length; ++i) { - if (adblConstraintOrdinate[i] <= dblStretchPredictorOrdinateRight) return null; - } - - org.drip.spline.segment.LatentStateResponseModel[] aCS = mssIn.segments(); - - org.drip.spline.params.SegmentCustomBuilderControl[] aSCBCIn = mssIn.segmentBuilderControl(); - - int iNumSegmentIn = aCS.length; - double dblStretchResponseValueLeft = java.lang.Double.NaN; - double[] adblPredictorOrdinateOut = new double[iNumSegmentIn + 2]; - org.drip.spline.params.SegmentCustomBuilderControl[] aSCBCOut = new - org.drip.spline.params.SegmentCustomBuilderControl[iNumSegmentIn + 1]; - org.drip.spline.params.SegmentResponseValueConstraint[] aSRVCOut = new - org.drip.spline.params.SegmentResponseValueConstraint[iNumSegmentIn + 1]; - - try { - dblStretchResponseValueLeft = mssIn.responseValue (mssIn.getLeftPredictorOrdinateEdge()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int i = 0; i < iNumSegmentIn; ++i) { - aSCBCOut[i] = aSCBCIn[i]; - - adblPredictorOrdinateOut[i] = aCS[i].left(); - - double dblPredictorOrdinateRight = aCS[i].right(); - - try { - aSRVCOut[i] = new org.drip.spline.params.SegmentResponseValueConstraint (new double[] - {dblPredictorOrdinateRight}, new double[] {1.}, mssIn.responseValue - (dblPredictorOrdinateRight)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - aSRVCOut[iNumSegmentIn] = srvc; - aSCBCOut[iNumSegmentIn] = scbc; - adblPredictorOrdinateOut[iNumSegmentIn + 1] = dblPredictorOrdinateAppendRight; - - adblPredictorOrdinateOut[iNumSegmentIn] = aCS[iNumSegmentIn - 1].right(); - - return org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - (mssIn.name(), adblPredictorOrdinateOut, dblStretchResponseValueLeft, aSRVCOut, aSCBCOut, null, - bs, iCalibrationDetail); - } - - /** - * Insert the Predictor Ordinate Knot into the specified Stretch - * - * @param mssIn Input Stretch - * @param dblPredictorOrdinate Knot Predictor Ordinate - * @param sprdLeftSegmentRightEdge Response Values for the Right Edge of the Left Segment - * @param sprdRightSegmentLeftEdge Response Values for the Left Edge of the Right segment - * - * @return The Stretch with the Predictor Ordinate Knot inserted - */ - - public static final org.drip.spline.stretch.MultiSegmentSequence InsertKnot ( - final org.drip.spline.stretch.MultiSegmentSequence mssIn, - final double dblPredictorOrdinate, - final org.drip.spline.params.SegmentPredictorResponseDerivative sprdLeftSegmentRightEdge, - final org.drip.spline.params.SegmentPredictorResponseDerivative sprdRightSegmentLeftEdge) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorOrdinate) || null == mssIn || - mssIn.isKnot (dblPredictorOrdinate) || null == sprdLeftSegmentRightEdge || null == - sprdRightSegmentLeftEdge) - return null; - - org.drip.spline.segment.LatentStateResponseModel[] aCSIn = mssIn.segments(); - - int iOutSegmentIndex = 1; - int iNumSegmentIn = aCSIn.length; - double[] adblPredictorOrdinateOut = new double[iNumSegmentIn + 2]; - org.drip.spline.params.SegmentPredictorResponseDerivative[] aSPRDOutLeft = new - org.drip.spline.params.SegmentPredictorResponseDerivative[iNumSegmentIn + 1]; - org.drip.spline.params.SegmentPredictorResponseDerivative[] aSPRDOutRight = new - org.drip.spline.params.SegmentPredictorResponseDerivative[iNumSegmentIn + 1]; - org.drip.spline.params.SegmentCustomBuilderControl[] aSCBCOut = new - org.drip.spline.params.SegmentCustomBuilderControl[iNumSegmentIn + 1]; - - if (dblPredictorOrdinate < aCSIn[0].left() || dblPredictorOrdinate > - aCSIn[iNumSegmentIn - 1].right()) - return null; - - adblPredictorOrdinateOut[0] = aCSIn[0].left(); - - org.drip.spline.params.SegmentCustomBuilderControl[] aSCBCIn = mssIn.segmentBuilderControl(); - - for (int i = 0; i < iNumSegmentIn; ++i) { - aSCBCOut[iOutSegmentIndex - 1] = aSCBCIn[i]; - - aSPRDOutLeft[iOutSegmentIndex - 1] = mssIn.calcSPRD (aCSIn[i].left()); - - if (dblPredictorOrdinate > aCSIn[i].left() && dblPredictorOrdinate < aCSIn[i].right()) { - aSPRDOutRight[iOutSegmentIndex - 1] = sprdLeftSegmentRightEdge; - adblPredictorOrdinateOut[iOutSegmentIndex++] = dblPredictorOrdinate; - aSCBCOut[iOutSegmentIndex - 1] = aSCBCIn[i]; - aSPRDOutLeft[iOutSegmentIndex - 1] = sprdRightSegmentLeftEdge; - } - - aSPRDOutRight[iOutSegmentIndex - 1] = mssIn.calcSPRD (aCSIn[i].right()); - - adblPredictorOrdinateOut[iOutSegmentIndex++] = aCSIn[i].right(); - } - - org.drip.spline.stretch.MultiSegmentSequence mssOut = - org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateUncalibratedStretchEstimator - (mssIn.name(), adblPredictorOrdinateOut, aSCBCOut); - - if (null == mssOut) return null; - - return mssOut.setupHermite (aSPRDOutLeft, aSPRDOutRight, null, null, - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE) ? mssOut : null; - } - - /** - * Insert a Cardinal Knot into the specified Stretch at the specified Predictor Ordinate Location - * - * @param mssIn Input Stretch - * @param dblPredictorOrdinate Knot Predictor Ordinate - * @param dblCardinalTension Cardinal Tension Parameter - * - * @return The Stretch with the Knot inserted - */ - - public static final org.drip.spline.stretch.MultiSegmentSequence InsertCardinalKnot ( - final org.drip.spline.stretch.MultiSegmentSequence mssIn, - final double dblPredictorOrdinate, - final double dblCardinalTension) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorOrdinate) || - !org.drip.quant.common.NumberUtil.IsValid (dblCardinalTension) || null == mssIn || mssIn.isKnot - (dblPredictorOrdinate)) - return null; - - org.drip.spline.segment.LatentStateResponseModel[] aCSIn = mssIn.segments(); - - int iOutSegmentIndex = 0; - int iNumSegmentIn = aCSIn.length; - - if (dblPredictorOrdinate < aCSIn[0].left() || dblPredictorOrdinate > - aCSIn[iNumSegmentIn - 1].right()) - return null; - - for (; iOutSegmentIndex < iNumSegmentIn; ++iOutSegmentIndex) { - if (dblPredictorOrdinate > aCSIn[iOutSegmentIndex].left() && dblPredictorOrdinate < - aCSIn[iOutSegmentIndex].right()) - break; - } - - org.drip.spline.params.SegmentPredictorResponseDerivative sprdCardinalOut = - org.drip.spline.params.SegmentPredictorResponseDerivative.CardinalEdgeAggregate - (mssIn.calcSPRD (aCSIn[iOutSegmentIndex].left()), mssIn.calcSPRD - (aCSIn[iOutSegmentIndex].right()), dblCardinalTension); - - return null == sprdCardinalOut ? null : InsertKnot (mssIn, dblPredictorOrdinate, sprdCardinalOut, - sprdCardinalOut); - } - - /** - * Insert a Catmull-Rom Knot into the specified Stretch at the specified Predictor Ordinate Location - * - * @param mssIn Input Stretch - * @param dblPredictorOrdinate Knot Predictor Ordinate - * - * @return The Stretch with the Knot inserted - */ - - public static final org.drip.spline.stretch.MultiSegmentSequence InsertCatmullRomKnot ( - final org.drip.spline.stretch.MultiSegmentSequence mssIn, - final double dblPredictorOrdinate) - { - return InsertCardinalKnot (mssIn, dblPredictorOrdinate, 0.); - } -} diff --git a/org/drip/spline/stretch/SegmentSequenceBuilder.java b/org/drip/spline/stretch/SegmentSequenceBuilder.java deleted file mode 100644 index 9134ac7..0000000 --- a/org/drip/spline/stretch/SegmentSequenceBuilder.java +++ /dev/null @@ -1,117 +0,0 @@ - -package org.drip.spline.stretch; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * SegmentSequenceBuilder is the interface that contains the stubs required for the construction of the - * segment stretch. It exposes the following functions: - * - Set the Stretch whose Segments are to be calibrated - * - Retrieve the Calibration Boundary Condition - * - Calibrate the Starting Segment using the LeftSlope - * - Calibrate the Segment Sequence in the Stretch - * - * @author Lakshmi Krishnamurthy - */ - -public interface SegmentSequenceBuilder { - - /** - * Set the Stretch whose Segments are to be calibrated - * - * @param mss The Stretch that needs to be calibrated - * - * @return TRUE - Stretch successfully set - */ - - public abstract boolean setStretch ( - final org.drip.spline.stretch.MultiSegmentSequence mss); - - /** - * Retrieve the Calibration Boundary Condition - * - * @return The Calibration Boundary Condition - */ - - public abstract org.drip.spline.stretch.BoundarySettings getCalibrationBoundaryCondition(); - - /** - * Calibrate the Starting Segment using the LeftSlope - * - * @param dblLeftSlope The Slope - * - * @return TRUE - The Segment was successfully set up. - */ - - public abstract boolean calibStartingSegment ( - final double dblLeftSlope); - - /** - * Calibrate the Segment Sequence in the Stretch - * - * @param iStartingSegment The Starting Segment in the Sequence - * - * @return TRUE - The Segment Sequence successfully calibrated - */ - - public abstract boolean calibSegmentSequence ( - final int iStartingSegment); - - /** - * Compute the Stretch Manifest Measure Sensitivity Sequence - * - * @param dblLeftSlopeSensitivity The Leading Segment Left Slope Sensitivity - * - * @return TRUE - The Stretch Manifest Measure Sensitivity Sequence successfully computed - */ - - public boolean manifestMeasureSensitivity ( - final double dblLeftSlopeSensitivity); -} diff --git a/org/drip/spline/stretch/SingleSegmentLagrangePolynomial.java b/org/drip/spline/stretch/SingleSegmentLagrangePolynomial.java deleted file mode 100644 index 39f367c..0000000 --- a/org/drip/spline/stretch/SingleSegmentLagrangePolynomial.java +++ /dev/null @@ -1,512 +0,0 @@ - -package org.drip.spline.stretch; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * SingleSegmentLagrangePolynomial implements the SingleSegmentSequence Stretch interface using the Lagrange - * Polynomial Estimator. As such it provides a perfect fit that travels through all the predictor/response - * pairs causing Runge's instability. - * - * @author Lakshmi Krishnamurthy - */ - -public class SingleSegmentLagrangePolynomial implements org.drip.spline.stretch.SingleSegmentSequence { - private static final double DIFF_SCALE = 1.0e-06; - private static final int MAXIMA_PREDICTOR_ORDINATE_NODE = 1; - private static final int MINIMA_PREDICTOR_ORDINATE_NODE = 2; - private static final int MONOTONE_PREDICTOR_ORDINATE_NODE = 4; - - private double[] _adblResponseValue = null; - private double[] _adblPredictorOrdinate = null; - - private static final double CalcAbsoluteMin ( - final double[] adblY) - throws java.lang.Exception - { - if (null == adblY) - throw new java.lang.Exception - ("SingleSegmentLagrangePolynomial::CalcAbsoluteMin => Invalid Inputs"); - - int iNumPoints = adblY.length; - - if (1 >= iNumPoints) - throw new java.lang.Exception - ("SingleSegmentLagrangePolynomial::CalcAbsoluteMin => Invalid Inputs"); - - double dblMin = java.lang.Math.abs (adblY[0]); - - for (int i = 0; i < iNumPoints; ++i) { - double dblValue = java.lang.Math.abs (adblY[i]); - - dblMin = dblMin > dblValue ? dblValue : dblMin; - } - - return dblMin; - } - - private static final double CalcMinDifference ( - final double[] adblY) - throws java.lang.Exception - { - if (null == adblY) - throw new java.lang.Exception - ("SingleSegmentLagrangePolynomial::CalcMinDifference => Invalid Inputs"); - - int iNumPoints = adblY.length; - - if (1 >= iNumPoints) - throw new java.lang.Exception - ("SingleSegmentLagrangePolynomial::CalcMinDifference => Invalid Inputs"); - - double dblMinDiff = java.lang.Math.abs (adblY[0] - adblY[1]); - - for (int i = 0; i < iNumPoints; ++i) { - for (int j = i + 1; j < iNumPoints; ++j) { - double dblDiff = java.lang.Math.abs (adblY[i] - adblY[j]); - - dblMinDiff = dblMinDiff > dblDiff ? dblDiff : dblMinDiff; - } - } - - return dblMinDiff; - } - - private static final double EstimateBumpDelta ( - final double[] adblY) - throws java.lang.Exception - { - double dblBumpDelta = CalcMinDifference (adblY); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblBumpDelta) || 0. == dblBumpDelta) - dblBumpDelta = CalcAbsoluteMin (adblY); - - return 0. == dblBumpDelta ? DIFF_SCALE : dblBumpDelta * DIFF_SCALE; - } - - /** - * SingleSegmentLagrangePolynomial constructor - * - * @param adblPredictorOrdinate Array of Predictor Ordinates - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public SingleSegmentLagrangePolynomial ( - final double[] adblPredictorOrdinate) - throws java.lang.Exception - { - if (null == (_adblPredictorOrdinate = adblPredictorOrdinate)) - throw new java.lang.Exception ("SingleSegmentLagrangePolynomial ctr: Invalid Inputs"); - - int iNumPredictorOrdinate = _adblPredictorOrdinate.length; - - if (1 >= iNumPredictorOrdinate) - throw new java.lang.Exception ("SingleSegmentLagrangePolynomial ctr: Invalid Inputs"); - - for (int i = 0; i < iNumPredictorOrdinate; ++i) { - for (int j = i + 1; j < iNumPredictorOrdinate; ++j) { - if (_adblPredictorOrdinate[i] == _adblPredictorOrdinate[j]) - throw new java.lang.Exception ("SingleSegmentLagrangePolynomial ctr: Invalid Inputs"); - } - } - } - - @Override public boolean setup ( - final double dblYLeading, - final double[] adblResponseValue, - final org.drip.spline.params.StretchBestFitResponse rbfr, - final org.drip.spline.stretch.BoundarySettings bs, - final int iCalibrationDetail) - { - return null != (_adblResponseValue = adblResponseValue) && _adblResponseValue.length == - _adblPredictorOrdinate.length; - } - - @Override public double responseValue ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorOrdinate)) - throw new java.lang.Exception - ("SingleSegmentLagrangePolynomial::responseValue => Invalid inputs!"); - - int iNumPredictorOrdinate = _adblPredictorOrdinate.length; - - if (_adblPredictorOrdinate[0] > dblPredictorOrdinate || - _adblPredictorOrdinate[iNumPredictorOrdinate - 1] < dblPredictorOrdinate) - throw new java.lang.Exception - ("SingleSegmentLagrangePolynomial::responseValue => Input out of range!"); - - double dblResponse = 0; - - for (int i = 0; i < iNumPredictorOrdinate; ++i) { - double dblResponsePredictorOrdinateContribution = _adblResponseValue[i]; - - for (int j = 0; j < iNumPredictorOrdinate; ++j) { - if (i != j) - dblResponsePredictorOrdinateContribution = dblResponsePredictorOrdinateContribution * - (dblPredictorOrdinate - _adblPredictorOrdinate[j]) / (_adblPredictorOrdinate[i] - - _adblPredictorOrdinate[j]); - } - - dblResponse += dblResponsePredictorOrdinateContribution; - } - - return dblResponse; - } - - @Override public double responseValueDerivative ( - final double dblPredictorOrdinate, - final int iOrder) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorOrdinate) || 0 >= iOrder) - throw new java.lang.Exception - ("SingleSegmentLagrangePolynomial::responseValueDerivative => Invalid inputs!"); - - org.drip.function.definition.R1ToR1 au = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - double dblX) - throws java.lang.Exception - { - return responseValue (dblX); - } - }; - - return au.derivative (dblPredictorOrdinate, iOrder); - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDResponseDCalibrationInput ( - final double dblPredictorOrdinate, - final int iOrder) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorOrdinate)) return null; - - int iNumPredictorOrdinate = _adblPredictorOrdinate.length; - double dblInputResponseSensitivityShift = java.lang.Double.NaN; - double dblResponseWithUnadjustedResponseInput = java.lang.Double.NaN; - org.drip.quant.calculus.WengertJacobian wjDResponseDResponseInput = null; - - if (_adblPredictorOrdinate[0] > dblPredictorOrdinate || - _adblPredictorOrdinate[iNumPredictorOrdinate - 1] < dblPredictorOrdinate) - return null; - - try { - if (!org.drip.quant.common.NumberUtil.IsValid (dblInputResponseSensitivityShift = - EstimateBumpDelta (_adblResponseValue)) || !org.drip.quant.common.NumberUtil.IsValid - (dblResponseWithUnadjustedResponseInput = responseValue (dblPredictorOrdinate))) - return null; - - wjDResponseDResponseInput = new org.drip.quant.calculus.WengertJacobian (1, - iNumPredictorOrdinate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int i = 0; i < iNumPredictorOrdinate; ++i) { - double[] adblSensitivityShiftedInputResponse = new double[iNumPredictorOrdinate]; - - for (int j = 0; j < iNumPredictorOrdinate; ++j) - adblSensitivityShiftedInputResponse[j] = i == j ? _adblResponseValue[j] + - dblInputResponseSensitivityShift : _adblResponseValue[j]; - - try { - SingleSegmentLagrangePolynomial lps = new SingleSegmentLagrangePolynomial - (_adblPredictorOrdinate); - - if (!lps.setup (adblSensitivityShiftedInputResponse[0], adblSensitivityShiftedInputResponse, - null, org.drip.spline.stretch.BoundarySettings.FloatingStandard(), - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE) || - !wjDResponseDResponseInput.accumulatePartialFirstDerivative (0, i, - (lps.responseValue (dblPredictorOrdinate) - - dblResponseWithUnadjustedResponseInput) / - dblInputResponseSensitivityShift)) - return null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return wjDResponseDResponseInput; - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDResponseDManifestMeasure ( - final java.lang.String strManifestMeasure, - final double dblPredictorOrdinate, - final int iOrder) - { - return null; - } - - @Override public org.drip.spline.segment.Monotonocity monotoneType ( - final double dblPredictorOrdinate) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorOrdinate)) return null; - - int iNumPredictorOrdinate = _adblPredictorOrdinate.length; - - if (_adblPredictorOrdinate[0] > dblPredictorOrdinate || - _adblPredictorOrdinate[iNumPredictorOrdinate - 1] < dblPredictorOrdinate) - return null; - - if (2 == iNumPredictorOrdinate) { - try { - return new org.drip.spline.segment.Monotonocity - (org.drip.spline.segment.Monotonocity.MONOTONIC); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - org.drip.function.definition.R1ToR1 auDeriv = new - org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - double dblDeltaX = CalcMinDifference (_adblPredictorOrdinate) * DIFF_SCALE; - - return (responseValue (dblX + dblDeltaX) - responseValue (dblX)) / dblDeltaX; - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - return org.drip.quant.calculus.R1ToR1Integrator.Boole (this, dblBegin, dblEnd); - } - }; - - try { - org.drip.function.r1tor1solver.FixedPointFinderOutput fpop = new - org.drip.function.r1tor1solver.FixedPointFinderBrent (0., auDeriv, true).findRoot - (org.drip.function.r1tor1solver.InitializationHeuristics.FromHardSearchEdges (0., 1.)); - - if (null == fpop || !fpop.containsRoot()) - return new org.drip.spline.segment.Monotonocity - (org.drip.spline.segment.Monotonocity.MONOTONIC); - - double dblExtremum = fpop.getRoot(); - - if (!org.drip.quant.common.NumberUtil.IsValid (dblExtremum) || dblExtremum <= 0. || dblExtremum - >= 1.) - return new org.drip.spline.segment.Monotonocity - (org.drip.spline.segment.Monotonocity.MONOTONIC); - - double dblDeltaX = CalcMinDifference (_adblPredictorOrdinate) * DIFF_SCALE; - - double dbl2ndDeriv = responseValue (dblExtremum + dblDeltaX) + responseValue (dblExtremum - - dblDeltaX) - 2. * responseValue (dblPredictorOrdinate); - - if (0. > dbl2ndDeriv) - return new org.drip.spline.segment.Monotonocity - (org.drip.spline.segment.Monotonocity.MAXIMA); - - if (0. < dbl2ndDeriv) - return new org.drip.spline.segment.Monotonocity - (org.drip.spline.segment.Monotonocity.MINIMA); - - if (0. == dbl2ndDeriv) - return new org.drip.spline.segment.Monotonocity - (org.drip.spline.segment.Monotonocity.INFLECTION); - - return new org.drip.spline.segment.Monotonocity - (org.drip.spline.segment.Monotonocity.NON_MONOTONIC); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - try { - return new org.drip.spline.segment.Monotonocity - (org.drip.spline.segment.Monotonocity.MONOTONIC); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public boolean isLocallyMonotone() - throws java.lang.Exception - { - org.drip.spline.segment.Monotonocity sm = monotoneType (0.5 * (_adblPredictorOrdinate[0] + - _adblPredictorOrdinate[_adblPredictorOrdinate.length - 1])); - - return null != sm && org.drip.spline.segment.Monotonocity.MONOTONIC == sm.type(); - } - - @Override public boolean isCoMonotone ( - final double[] adblMeasuredResponse) - throws java.lang.Exception - { - if (null == adblMeasuredResponse) return false; - - int iNumMeasuredResponse = adblMeasuredResponse.length; - - if (2 >= iNumMeasuredResponse) return false; - - int[] aiNodeMiniMax = new int[iNumMeasuredResponse]; - int[] aiMonotoneType = new int[iNumMeasuredResponse]; - - for (int i = 0; i < iNumMeasuredResponse; ++i) { - if (0 == i || iNumMeasuredResponse - 1 == i) - aiNodeMiniMax[i] = 0; - else { - if (adblMeasuredResponse[i - 1] < adblMeasuredResponse[i] && adblMeasuredResponse[i + 1] < - adblMeasuredResponse[i]) - aiNodeMiniMax[i] = MAXIMA_PREDICTOR_ORDINATE_NODE; - else if (adblMeasuredResponse[i - 1] > adblMeasuredResponse[i] && adblMeasuredResponse[i + 1] - > adblMeasuredResponse[i]) - aiNodeMiniMax[i] = MINIMA_PREDICTOR_ORDINATE_NODE; - else - aiNodeMiniMax[i] = MONOTONE_PREDICTOR_ORDINATE_NODE; - } - - org.drip.spline.segment.Monotonocity sm = monotoneType (adblMeasuredResponse[i]); - - aiMonotoneType[i] = null != sm ? sm.type() : - org.drip.spline.segment.Monotonocity.NON_MONOTONIC; - } - - for (int i = 1; i < iNumMeasuredResponse - 1; ++i) { - if (MAXIMA_PREDICTOR_ORDINATE_NODE == aiNodeMiniMax[i]) { - if (org.drip.spline.segment.Monotonocity.MAXIMA != aiMonotoneType[i] && - org.drip.spline.segment.Monotonocity.MAXIMA != aiMonotoneType[i - 1]) - return false; - } else if (MINIMA_PREDICTOR_ORDINATE_NODE == aiNodeMiniMax[i]) { - if (org.drip.spline.segment.Monotonocity.MINIMA != aiMonotoneType[i] && - org.drip.spline.segment.Monotonocity.MINIMA != aiMonotoneType[i - 1]) - return false; - } - } - - return true; - } - - @Override public boolean isKnot ( - final double dblPredictorOrdinate) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorOrdinate)) return false; - - int iNumPredictorOrdinate = _adblPredictorOrdinate.length; - - if (_adblPredictorOrdinate[0] > dblPredictorOrdinate || - _adblPredictorOrdinate[iNumPredictorOrdinate - 1] < dblPredictorOrdinate) - return false; - - for (int i = 0; i < iNumPredictorOrdinate; ++i) { - if (dblPredictorOrdinate == _adblPredictorOrdinate[i]) return true; - } - - return false; - } - - @Override public boolean resetNode ( - final int iPredictorOrdinateNodeIndex, - final double dblResetResponse) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblResetResponse)) return false; - - if (iPredictorOrdinateNodeIndex > _adblPredictorOrdinate.length) return false; - - _adblResponseValue[iPredictorOrdinateNodeIndex] = dblResetResponse; - return true; - } - - @Override public boolean resetNode ( - final int iPredictorOrdinateNodeIndex, - final org.drip.spline.params.SegmentResponseValueConstraint sprcReset) - { - return false; - } - - @Override public org.drip.function.definition.R1ToR1 toAU() - { - org.drip.function.definition.R1ToR1 au = new - org.drip.function.definition.R1ToR1 (null) - { - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - return responseValue (dblVariate); - } - - @Override public double derivative ( - final double dblVariate, - final int iOrder) - throws java.lang.Exception - { - return responseValueDerivative (dblVariate, iOrder); - } - }; - - return au; - } - - @Override public double getLeftPredictorOrdinateEdge() - { - return _adblPredictorOrdinate[0]; - } - - @Override public double getRightPredictorOrdinateEdge() - { - return _adblPredictorOrdinate[_adblPredictorOrdinate.length - 1]; - } -} diff --git a/org/drip/spline/stretch/SingleSegmentSequence.java b/org/drip/spline/stretch/SingleSegmentSequence.java deleted file mode 100644 index f4ee553..0000000 --- a/org/drip/spline/stretch/SingleSegmentSequence.java +++ /dev/null @@ -1,245 +0,0 @@ - -package org.drip.spline.stretch; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * SingleSegmentSequence is the interface that exposes functionality that spans multiple segments. Its - * derived instances hold the ordered segment sequence, the segment control parameters, and, if available, - * the spanning Jacobian. SingleSegmentSequence exports the following group of functionality: - * - Construct adjoining segment sequences in accordance with the segment control parameters - * - Calibrate according to a varied set of (i.e., NATURAL/FINANCIAL) boundary conditions - * - Estimate both the value, the ordered derivatives, and the Jacobian (quote/coefficient) at the given - * ordinate - * - Compute the monotonicity details - segment/Stretch level monotonicity, co-monotonicity, local - * monotonicity. - * - Predictor Ordinate Details - identify the left/right predictor ordinate edges, and whether the given - * predictor ordinate is a knot - * - * @author Lakshmi Krishnamurthy - */ - -public interface SingleSegmentSequence { - - /** - * Set up (i.e., calibrate) the individual Segments in the Stretch to the Response Values corresponding - * to each Segment Predictor right Ordinate. - * - * @param dblStretchLeadingResponse Stretch Left-most Response - * @param adblSegmentRightEdgeResponse Array of Segment Right Edge Responses - * @param sbfr Stretch Fitness Weighted Response - * @param bs The Calibration Boundary Condition - * @param iCalibrationDetail The Calibration Detail - * - * @return TRUE - Set up was successful - */ - - public abstract boolean setup ( - final double dblStretchLeadingResponse, - final double[] adblSegmentRightEdgeResponse, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final org.drip.spline.stretch.BoundarySettings bs, - final int iCalibrationDetail); - - /** - * Calculate the Response Value at the given Predictor Ordinate - * - * @param dblPredictorOrdinate Predictor Ordinate - * - * @return The Response Value - * - * @throws java.lang.Exception Thrown if the Response Value cannot be calculated - */ - - public abstract double responseValue ( - final double dblPredictorOrdinate) - throws java.lang.Exception; - - /** - * Calculate the Response Value Derivative at the given Predictor Ordinate for the specified order - * - * @param dblPredictorOrdinate Predictor Ordinate - * @param iOrder Order the Derivative - * - * @return The Response Value - * - * @throws java.lang.Exception Thrown if the Response Value Derivative cannot be calculated - */ - - public abstract double responseValueDerivative ( - final double dblPredictorOrdinate, - final int iOrder) - throws java.lang.Exception; - - /** - * Calculate the Response Derivative to the Calibration Inputs at the specified Ordinate - * - * @param dblPredictorOrdinate Predictor Ordinate - * @param iOrder Order of Derivative desired - * - * @return Jacobian of the Response Derivative to the Calibration Inputs at the Ordinate - */ - - public abstract org.drip.quant.calculus.WengertJacobian jackDResponseDCalibrationInput ( - final double dblPredictorOrdinate, - final int iOrder); - - /** - * Calculate the Response Derivative to the Manifest Measure at the specified Ordinate - * - * @param strManifestMeasure Manifest Measure whose Sensitivity is sought - * @param dblPredictorOrdinate Predictor Ordinate - * @param iOrder Order of Derivative desired - * - * @return Jacobian of the Response Derivative to the Quote at the Ordinate - */ - - public abstract org.drip.quant.calculus.WengertJacobian jackDResponseDManifestMeasure ( - final java.lang.String strManifestMeasure, - final double dblPredictorOrdinate, - final int iOrder); - - /** - * Identify the Monotone Type for the Segment underlying the given Predictor Ordinate - * - * @param dblPredictorOrdinate Predictor Ordinate - * - * @return Segment Monotone Type - */ - - public abstract org.drip.spline.segment.Monotonocity monotoneType ( - final double dblPredictorOrdinate); - - /** - * Indicate if all the comprising Segments are Monotone - * - * @return TRUE - Fully locally monotonic - * - * @throws java.lang.Exception Thrown if the Segment Monotone Type could not be estimated - */ - - public abstract boolean isLocallyMonotone() - throws java.lang.Exception; - - /** - * Verify whether the Stretch mini-max Behavior matches the Measurement - * - * @param adblMeasuredResponse The Array of Measured Responses - * - * @return TRUE - Stretch is co-monotonic with the measured Responses - * - * @throws java.lang.Exception Thrown if the Segment Monotone Type could not be estimated - */ - - public abstract boolean isCoMonotone ( - final double[] adblMeasuredResponse) - throws java.lang.Exception; - - /** - * Is the given Predictor Ordinate a Knot Location - * - * @param dblPredictorOrdinate Predictor Ordinate - * - * @return TRUE - Given Predictor Ordinate corresponds to a Knot - */ - - public abstract boolean isKnot ( - final double dblPredictorOrdinate); - - /** - * Reset the Predictor Ordinate Node Index with the given Response - * - * @param iPredictorOrdinateNodeIndex The Predictor Ordinate Node Index whose Response is to be reset - * @param dblResetResponse The Response to reset - * - * @return TRUE - Reset succeeded - */ - - public abstract boolean resetNode ( - final int iPredictorOrdinateNodeIndex, - final double dblResetResponse); - - /** - * Reset the Predictor Ordinate Node Index with the given Segment Constraint - * - * @param iNodeIndex The Predictor Ordinate Node Index whose Response is to be reset - * @param srvcReset The Segment Constraint - * - * @return TRUE - Reset succeeded - */ - - public abstract boolean resetNode ( - final int iNodeIndex, - final org.drip.spline.params.SegmentResponseValueConstraint srvcReset); - - /** - * Return the Left Predictor Ordinate Edge - * - * @return The Left Predictor Ordinate Edge - */ - - public abstract double getLeftPredictorOrdinateEdge(); - - /** - * Return the Right Predictor Ordinate Edge - * - * @return The Right Predictor Ordinate Edge - */ - - public abstract double getRightPredictorOrdinateEdge(); - - /** - * Convert the Segment Sequence into an AbstractUnivariate Instance - * - * @return The AbstractUnivariate Instance - */ - - public abstract org.drip.function.definition.R1ToR1 toAU(); -} diff --git a/org/drip/spline/tension/KLKHyperbolicTensionPhy.java b/org/drip/spline/tension/KLKHyperbolicTensionPhy.java deleted file mode 100644 index 14c2fcf..0000000 --- a/org/drip/spline/tension/KLKHyperbolicTensionPhy.java +++ /dev/null @@ -1,148 +0,0 @@ - -package org.drip.spline.tension; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * KLKHyperbolicTensionPhy implements the basic framework and the family of C2 Tension Splines outlined in - * Koch and Lyche (1989), Koch and Lyche (1993), and Kvasov (2000) Papers. - * - * KLKHyperbolicTensionPsy implements the custom evaluator, differentiator, and integrator for the KLK - * Tension Phy Functions outlined in the publications above. - * - * @author Lakshmi Krishnamurthy - */ - -public class KLKHyperbolicTensionPhy extends org.drip.function.definition.R1ToR1 { - private double _dblTension = java.lang.Double.NaN; - - /** - * KLKHyperbolicTensionPhy constructor - * - * @param dblTension Tension of the HyperbolicTension Function - * - * @throws java.lang.Exception Thrown if the input is invalid - */ - - public KLKHyperbolicTensionPhy ( - final double dblTension) - throws java.lang.Exception - { - super (null); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblTension = dblTension)) - throw new java.lang.Exception ("KLKHyperbolicTensionPhy ctr: Invalid Inputs"); - } - - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate)) - throw new java.lang.Exception ("KLKHyperbolicTensionPhy::evaluate => Invalid Inputs"); - - return java.lang.Math.sinh (_dblTension * dblVariate) / java.lang.Math.sinh (_dblTension); - } - - @Override public double derivative ( - final double dblVariate, - final int iOrder) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate) || 0 > iOrder) - throw new java.lang.Exception ("KLKHyperbolicTensionPhy::derivative => Invalid Inputs"); - - return java.lang.Math.pow (_dblTension, iOrder) * java.lang.Math.sinh (_dblTension * dblVariate) / - java.lang.Math.sinh (_dblTension); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || !org.drip.quant.common.NumberUtil.IsValid - (dblEnd)) - throw new java.lang.Exception ("HyperbolicTension::integrate => Invalid Inputs"); - - return (java.lang.Math.cosh (_dblTension * dblEnd) - java.lang.Math.cosh (_dblTension * dblBegin)) / - (_dblTension * java.lang.Math.sinh (_dblTension)); - } - - /** - * Retrieve the Tension Parameter - * - * @return Tension Parameter - */ - - public double getTension() - { - return _dblTension; - } - - public static final void main ( - final java.lang.String[] astrArgs) - throws java.lang.Exception - { - KLKHyperbolicTensionPhy khtp = new KLKHyperbolicTensionPhy (2.); - - System.out.println ("KLKHyperbolicTensionPhy[0.0] = " + khtp.evaluate (0.0)); - - System.out.println ("KLKHyperbolicTensionPhy[0.5] = " + khtp.evaluate (0.5)); - - System.out.println ("KLKHyperbolicTensionPhy[1.0] = " + khtp.evaluate (1.0)); - - System.out.println ("KLKHyperbolicTensionPhyDeriv[0.0] = " + khtp.derivative (0.0, 2)); - - System.out.println ("KLKHyperbolicTensionPhyDeriv[0.5] = " + khtp.derivative (0.5, 2)); - - System.out.println ("KLKHyperbolicTensionPhyDeriv[1.0] = " + khtp.derivative (1.0, 2)); - } -} diff --git a/org/drip/spline/tension/KLKHyperbolicTensionPsy.java b/org/drip/spline/tension/KLKHyperbolicTensionPsy.java deleted file mode 100644 index c7e504a..0000000 --- a/org/drip/spline/tension/KLKHyperbolicTensionPsy.java +++ /dev/null @@ -1,148 +0,0 @@ - -package org.drip.spline.tension; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * KLKHyperbolicTensionPsy implements the basic framework and the family of C2 Tension Splines outlined in - * Koch and Lyche (1989), Koch and Lyche (1993), and Kvasov (2000) Papers. - * - * KLKHyperbolicTensionPsy implements the custom evaluator, differentiator, and integrator for the KLK - * Tension Psy Functions outlined in the publications above. - * - * @author Lakshmi Krishnamurthy - */ - -public class KLKHyperbolicTensionPsy extends org.drip.function.definition.R1ToR1 { - private double _dblTension = java.lang.Double.NaN; - - /** - * KLKHyperbolicTensionPsy constructor - * - * @param dblTension Tension of the HyperbolicTension Function - * - * @throws java.lang.Exception Thrown if the input is invalid - */ - - public KLKHyperbolicTensionPsy ( - final double dblTension) - throws java.lang.Exception - { - super (null); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblTension = dblTension)) - throw new java.lang.Exception ("KLKHyperbolicTensionPsy ctr: Invalid Inputs"); - } - - @Override public double evaluate ( - final double dblVariate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate)) - throw new java.lang.Exception ("KLKHyperbolicTensionPsy::evaluate => Invalid Inputs"); - - return java.lang.Math.sinh (_dblTension * (1. - dblVariate)) / java.lang.Math.sinh (_dblTension); - } - - @Override public double derivative ( - final double dblVariate, - final int iOrder) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblVariate) || 0 > iOrder) - throw new java.lang.Exception ("KLKHyperbolicTensionPsy::derivative => Invalid Inputs"); - - return java.lang.Math.pow (-_dblTension, iOrder) * java.lang.Math.sinh (_dblTension * (1. - - dblVariate)) / java.lang.Math.sinh (_dblTension); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || !org.drip.quant.common.NumberUtil.IsValid - (dblEnd)) - throw new java.lang.Exception ("KLKHyperbolicTensionPsy::integrate => Invalid Inputs"); - - return -1. * (java.lang.Math.cosh (_dblTension * (1. - dblEnd)) - java.lang.Math.cosh (_dblTension * - (1. - dblBegin))) / (_dblTension * java.lang.Math.sinh (_dblTension)); - } - - /** - * Retrieve the Tension Parameter - * - * @return Tension Parameter - */ - - public double getTension() - { - return _dblTension; - } - - public static final void main ( - final java.lang.String[] astrArgs) - throws java.lang.Exception - { - KLKHyperbolicTensionPsy khtp = new KLKHyperbolicTensionPsy (2.); - - System.out.println ("KLKHyperbolicTensionPsy[0.0] = " + khtp.evaluate (0.0)); - - System.out.println ("KLKHyperbolicTensionPsy[0.5] = " + khtp.evaluate (0.5)); - - System.out.println ("KLKHyperbolicTensionPsy[1.0] = " + khtp.evaluate (1.0)); - - System.out.println ("KLKHyperbolicTensionPsyDeriv[0.0] = " + khtp.derivative (0.0, 2)); - - System.out.println ("KLKHyperbolicTensionPsyDeriv[0.5] = " + khtp.derivative (0.5, 2)); - - System.out.println ("KLKHyperbolicTensionPsyDeriv[1.0] = " + khtp.derivative (1.0, 2)); - } -} diff --git a/org/drip/spline/tension/KochLycheKvasovBasis.java b/org/drip/spline/tension/KochLycheKvasovBasis.java deleted file mode 100644 index ba06e9e..0000000 --- a/org/drip/spline/tension/KochLycheKvasovBasis.java +++ /dev/null @@ -1,107 +0,0 @@ - -package org.drip.spline.tension; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * This class implements the basic framework and the family of C2 Tension Splines outlined in Koch and Lyche - * (1989), Koch and Lyche (1993), and Kvasov (2000) Papers. - * - * Currently, this class exposes functions to create monic and quadratic tension B Spline Basis Function Set. - * - * @author Lakshmi Krishnamurthy - */ - -public class KochLycheKvasovBasis { - - /** - * Generate the Monic BSpline Basis Function Set - * - * @param dblTension The Tension Parameter - * - * @return The Monic BSpline Basis Function Set - */ - - public static final org.drip.function.definition.R1ToR1[] GenerateMonicBSplineSet ( - final double dblTension) - { - try { - return new org.drip.function.definition.R1ToR1[] {new - org.drip.spline.tension.KLKHyperbolicTensionPhy (dblTension), new - org.drip.spline.tension.KLKHyperbolicTensionPsy (dblTension)}; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Quadratic BSpline Basis Function Set - * - * @param dblTension The Tension Parameter - * - * @return The Quadratic BSpline Basis Function Set - */ - - public static final org.drip.function.definition.R1ToR1[] GenerateQuadraticBSplineSet ( - final double dblTension) - { - try { - return new org.drip.function.definition.R1ToR1[] {new - org.drip.spline.tension.KLKHyperbolicTensionPhy (dblTension), new - org.drip.spline.tension.KLKHyperbolicTensionPsy (dblTension)}; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/spline/tension/KochLycheKvasovFamily.java b/org/drip/spline/tension/KochLycheKvasovFamily.java deleted file mode 100644 index 9457c16..0000000 --- a/org/drip/spline/tension/KochLycheKvasovFamily.java +++ /dev/null @@ -1,594 +0,0 @@ - -package org.drip.spline.tension; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * This class implements the basic framework and the family of C2 Tension Splines outlined in Koch and Lyche - * (1989), Koch and Lyche (1993), and Kvasov (2000) Papers. - * - * Functions exposed here implement the Basis Function Set from: - * - Hyperbolic Hat Primitive Set - * - Cubic Polynomial Numerator and Linear Rational Denominator - * - Cubic Polynomial Numerator and Quadratic Rational Denominator - * - Cubic Polynomial Numerator and Exponential Denominator - * - * @author Lakshmi Krishnamurthy - */ - -public class KochLycheKvasovFamily { - - /** - * Implement the Basis Function Set from the Hyperbolic Hat Primitive Set - * - * @param etsp The Tension Function Set Parameters - * - * @return Instance of the Basis Function Set - */ - - public static final org.drip.spline.basis.FunctionSet FromHyperbolicPrimitive ( - final org.drip.spline.basis.ExponentialTensionSetParams etsp) - { - if (null == etsp) return null; - - org.drip.function.definition.R1ToR1 auPhy = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception - ("KLKF::FromHyperbolicPrimitive.Phy::evaluate => Invalid Inputs!"); - - double dblTension = etsp.tension(); - - return (java.lang.Math.sinh (dblTension * dblX) - dblTension * dblX) / (dblTension * - dblTension * java.lang.Math.sinh (dblTension)); - } - - @Override public double derivative ( - final double dblX, - final int iOrder) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception - ("KLKF::FromHyperbolicPrimitive.Phy::derivative => Invalid Inputs!"); - - double dblTension = etsp.tension(); - - if (1 == iOrder) - return (java.lang.Math.cosh (dblTension * dblX) - 1.) / (dblTension * java.lang.Math.sinh - (dblTension)); - - if (2 == iOrder) - return java.lang.Math.sinh (dblTension * dblX) / java.lang.Math.sinh (dblTension); - - return derivative (dblX, iOrder); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || - !org.drip.quant.common.NumberUtil.IsValid (dblEnd)) - throw new java.lang.Exception - ("KLKF::FromHyperbolicPrimitive.Phy::integrate => Invalid Inputs"); - - double dblTension = etsp.tension(); - - return (java.lang.Math.cosh (dblTension * dblEnd) - java.lang.Math.cosh (dblTension * - dblBegin) - 0.5 * dblTension * (dblEnd * dblEnd - dblBegin * dblBegin)) / (dblTension * - dblTension * dblTension * java.lang.Math.sinh (dblTension)); - } - }; - - org.drip.function.definition.R1ToR1 auPsy = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception - ("KLKF.Psy::FromHyperbolicPrimitive::evaluate => Invalid Inputs!"); - - double dblTension = etsp.tension(); - - return (java.lang.Math.sinh (dblTension * (1. - dblX)) - dblTension * (1. - dblX)) / - (dblTension * dblTension * java.lang.Math.sinh (dblTension)); - } - - @Override public double derivative ( - final double dblX, - final int iOrder) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception - ("KLKF::FromHyperbolicPrimitive.Psy::derivative => Invalid Inputs!"); - - double dblTension = etsp.tension(); - - if (1 == iOrder) - return (1. - java.lang.Math.cosh (dblTension * (1. - dblX))) / (dblTension * - java.lang.Math.cosh (dblTension)); - - if (2 == iOrder) - return java.lang.Math.sinh (dblTension * (1. - dblX)) / java.lang.Math.sinh (dblTension); - - return derivative (dblX, iOrder); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblBegin) || - !org.drip.quant.common.NumberUtil.IsValid (dblEnd)) - throw new java.lang.Exception - ("KLKF::FromHyperbolicPrimitive.Psy::integrate => Invalid Inputs"); - - double dblTension = etsp.tension(); - - return -1. * (java.lang.Math.sinh (dblTension * (1. - dblEnd)) - java.lang.Math.sinh - (dblTension * (1. - dblBegin)) - 0.5 * dblTension * ((1. - dblEnd) * (1. - dblEnd) - (1. - - dblBegin) * (1. - dblBegin))) / (dblTension * dblTension * dblTension * - java.lang.Math.sinh (dblTension)); - } - }; - - try { - return new org.drip.spline.bspline.SegmentBasisFunctionSet (2, etsp.tension(), new - org.drip.function.definition.R1ToR1[] {auPhy, auPsy}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Implement the Basis Function Set from the Cubic Polynomial Numerator and Linear Rational Denominator - * - * @param etsp The Tension Function Set Parameters - * - * @return Instance of the Basis Function Set - */ - - public static final org.drip.spline.basis.FunctionSet FromRationalLinearPrimitive ( - final org.drip.spline.basis.ExponentialTensionSetParams etsp) - { - if (null == etsp) return null; - - org.drip.function.definition.R1ToR1 auPhy = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception - ("KLKF::FromRationalLinearPrimitive.Phy::evaluate => Invalid Inputs!"); - - double dblTension = etsp.tension(); - - return dblX * dblX * dblX / (1. + dblTension * (1. - dblX)) / (6. + 8. * dblTension); - } - - @Override public double derivative ( - final double dblX, - final int iOrder) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception - ("KLKF::FromRationalLinearPrimitive.Phy::derivative => Invalid Inputs!"); - - double dblTension = etsp.tension(); - - if (1 == iOrder) { - double dblDLDX = -1. * dblTension; - double dblL = 1. + dblTension * (1. - dblX); - - return 1. / (dblL * dblL * (6. + 8. * dblTension)) * (3. * dblL * dblX * dblX - dblDLDX * - dblX * dblX * dblX); - } - - if (2 == iOrder) { - double dblD2LDX2 = 0.; - double dblDLDX = -1. * dblTension; - double dblL = 1. + dblTension * (1. - dblX); - - return 1. / (dblL * dblL * (6. + 8. * dblTension)) * (6. * dblL * dblX - dblD2LDX2 * dblX - * dblX * dblX) - 2. / (dblL * dblL * dblL * (6. + 8. * dblTension)) * - (3. * dblL * dblX * dblX - dblDLDX * dblX * dblX * dblX); - } - - return derivative (dblX, iOrder); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - return org.drip.quant.calculus.R1ToR1Integrator.Boole (this, dblBegin, dblEnd); - } - }; - - org.drip.function.definition.R1ToR1 auPsy = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception - ("KLKF::FromRationalLinearPrimitive.Psy::evaluate => Invalid Inputs!"); - - double dblTension = etsp.tension(); - - return (1. - dblX) * (1. - dblX) * (1. - dblX) / (1. + dblTension * dblX) / (6. + 8. * - dblTension); - } - - @Override public double derivative ( - final double dblX, - final int iOrder) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception - ("KLKF::FromRationalLinearPrimitive.Psy::derivative => Invalid Inputs!"); - - double dblTension = etsp.tension(); - - if (1 == iOrder) { - double dblDLDX = dblTension; - double dblL = 1. + dblTension * dblX; - - return -1. / (dblL * dblL * (6. + 8. * dblTension)) * (3. * dblL * (1. - dblX) * - (1. - dblX) + dblDLDX * (1. - dblX) * (1. - dblX) * (1. - dblX)); - } - - if (2 == iOrder) { - double dblD2LDX2 = 0.; - double dblDLDX = dblTension; - double dblL = 1. + dblTension * dblX; - - return 1. / (dblL * dblL * (6. + 8. * dblTension)) * (6. * dblL * (1. - dblX) - dblD2LDX2 - * (1. - dblX) * (1. - dblX) * (1. - dblX)) - 2. / (dblL * dblL * dblL * - (6. + 8. * dblTension)) * (3. * dblL * (1. - dblX) * (1. - dblX) + dblDLDX * - (1. - dblX) * (1. - dblX) * (1. - dblX)); - } - - return derivative (dblX, iOrder); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - return org.drip.quant.calculus.R1ToR1Integrator.Boole (this, dblBegin, dblEnd); - } - }; - - try { - return new org.drip.spline.bspline.SegmentBasisFunctionSet (2, etsp.tension(), new - org.drip.function.definition.R1ToR1[] {auPhy, auPsy}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Implement the Basis Function Set from the Cubic Polynomial Numerator and Quadratic Rational - * Denominator - * - * @param etsp The Tension Function Set Parameters - * - * @return Instance of the Basis Function Set - */ - - public static final org.drip.spline.basis.FunctionSet FromRationalQuadraticPrimitive ( - final org.drip.spline.basis.ExponentialTensionSetParams etsp) - { - if (null == etsp) return null; - - org.drip.function.definition.R1ToR1 auPhy = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception - ("KLKF::FromRationalQuadraticPrimitive.Phy::evaluate => Invalid Inputs!"); - - double dblTension = etsp.tension(); - - return dblX * dblX * dblX / (1. + dblTension * dblX * (1. - dblX)) / (6. + 8. * dblTension); - } - - @Override public double derivative ( - final double dblX, - final int iOrder) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception - ("KLKF::FromRationalQuadraticPrimitive.Phy::derivative => Invalid Inputs!"); - - double dblTension = etsp.tension(); - - if (1 == iOrder) { - double dblDLDX = dblTension * (1. - 2. * dblX); - double dblL = 1. + dblTension * dblX * (1. - dblX); - - return 1. / (dblL * dblL * (6. + 8. * dblTension)) * (3. * dblL * dblX * dblX - dblDLDX * - dblX * dblX * dblX); - } - - if (2 == iOrder) { - double dblD2LDX2 = -2. * dblTension; - double dblDLDX = dblTension * (1. - 2. * dblX); - double dblL = 1. + dblTension * dblX * (1. - dblX); - - return 1. / (dblL * dblL * (6. + 8. * dblTension)) * (6. * dblL * dblX - dblD2LDX2 * dblX - * dblX * dblX) - 2. / (dblL * dblL * dblL * (6. + 8. * dblTension)) * - (3. * dblL * dblX * dblX - dblDLDX * dblX * dblX * dblX); - } - - return derivative (dblX, iOrder); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - return org.drip.quant.calculus.R1ToR1Integrator.Boole (this, dblBegin, dblEnd); - } - }; - - org.drip.function.definition.R1ToR1 auPsy = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception - ("KLKF::FromRationalQuadraticPrimitive.Psy::evaluate => Invalid Inputs!"); - - double dblTension = etsp.tension(); - - return (1. - dblX) * (1. - dblX) * (1. - dblX) / (1. + dblTension * dblX * (1. - dblX)) / (6. - + 8. * dblTension); - } - - @Override public double derivative ( - final double dblX, - final int iOrder) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception - ("KLKF::FromRationalQuadraticPrimitive.Psy::derivative => Invalid Inputs!"); - - double dblTension = etsp.tension(); - - if (1 == iOrder) { - double dblDLDX = dblTension * (1. - 2. * dblX); - double dblL = 1. + dblTension * dblX * (1. - dblX); - - return -1. / (dblL * dblL * (6. + 8. * dblTension)) * (3. * dblL * (1. - dblX) * - (1. - dblX) + dblDLDX * (1. - dblX) * (1. - dblX) * (1. - dblX)); - } - - if (2 == iOrder) { - double dblD2LDX2 = -2. * dblTension * dblX; - double dblDLDX = dblTension * (1. - 2. * dblX); - double dblL = 1. + dblTension * dblX * (1. - dblX); - - return 1. / (dblL * dblL * (6. + 8. * dblTension)) * (6. * dblL * (1. - dblX) - dblD2LDX2 - * (1. - dblX) * (1. - dblX) * (1. - dblX)) - 2. / (dblL * dblL * dblL * - (6. + 8. * dblTension)) * (3. * dblL * (1. - dblX) * (1. - dblX) + dblDLDX * - (1. - dblX) * (1. - dblX) * (1. - dblX)); - } - - return derivative (dblX, iOrder); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - return org.drip.quant.calculus.R1ToR1Integrator.Boole (this, dblBegin, dblEnd); - } - }; - - try { - return new org.drip.spline.bspline.SegmentBasisFunctionSet (2, etsp.tension(), new - org.drip.function.definition.R1ToR1[] {auPhy, auPsy}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Implement the Basis Function Set from the Cubic Polynomial Numerator and Exponential Denominator - * - * @param etsp The Tension Function Set Parameters - * - * @return Instance of the Basis Function Set - */ - - public static final org.drip.spline.basis.FunctionSet FromExponentialPrimitive ( - final org.drip.spline.basis.ExponentialTensionSetParams etsp) - { - if (null == etsp) return null; - - org.drip.function.definition.R1ToR1 auPhy = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception - ("KLKF::FromExponentialPrimitive.Phy::evaluate => Invalid Inputs!"); - - double dblTension = etsp.tension(); - - return dblX * dblX * dblX * java.lang.Math.exp (-1. * dblTension * (1. - dblX)) / (6. + 7. * - dblTension); - } - - @Override public double derivative ( - final double dblX, - final int iOrder) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception - ("KLKF::FromExponentialPrimitive.Phy::derivative => Invalid Inputs!"); - - double dblTension = etsp.tension(); - - if (1 == iOrder) - return (3. + dblTension * dblX) / (6. + 7. * dblTension) * dblX * dblX * - java.lang.Math.exp (-1. * dblTension * (1. - dblX)); - - if (2 == iOrder) - return (dblTension * dblTension * dblX * dblX + 6. * dblTension * dblX + 6.) / (6. + 7. * - dblTension) * dblX * java.lang.Math.exp (-1. * dblTension * (1. - dblX)); - - return derivative (dblX, iOrder); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - return org.drip.quant.calculus.R1ToR1Integrator.Boole (this, dblBegin, dblEnd); - } - }; - - org.drip.function.definition.R1ToR1 auPsy = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - final double dblX) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception - ("KLKF::FromExponentialPrimitive.Psy::evaluate => Invalid Inputs!"); - - double dblTension = etsp.tension(); - - return (1. - dblX) * (1. - dblX) * (1. - dblX) * java.lang.Math.exp (-1. * dblTension * dblX) - / (6. + 7. * dblTension); - } - - @Override public double derivative ( - final double dblX, - final int iOrder) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblX)) - throw new java.lang.Exception - ("KLKF::FromExponentialPrimitive.Psy::derivative => Invalid Inputs!"); - - double dblTension = etsp.tension(); - - if (1 == iOrder) - return -1. * (3. + dblTension * (1. - dblX)) / (6. + 7. * dblTension) * (1. - dblX) * - (1. - dblX) * java.lang.Math.exp (-1. * dblTension * dblX); - - if (2 == iOrder) - return (dblTension * dblTension * (1. - dblX) * (1. - dblX) + 6. * dblTension * - (1. - dblX) + 6.) / (6. + 7. * dblTension) * (1. - dblX) * java.lang.Math.exp (-1. * - dblTension * dblX); - - return derivative (dblX, iOrder); - } - - @Override public double integrate ( - final double dblBegin, - final double dblEnd) - throws java.lang.Exception - { - return org.drip.quant.calculus.R1ToR1Integrator.Boole (this, dblBegin, dblEnd); - } - }; - - try { - return new org.drip.spline.bspline.SegmentBasisFunctionSet (2, etsp.tension(), new - org.drip.function.definition.R1ToR1[] {auPhy, auPsy}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/state/basis/BasisCurve.java b/org/drip/state/basis/BasisCurve.java deleted file mode 100644 index 15ea7d6..0000000 --- a/org/drip/state/basis/BasisCurve.java +++ /dev/null @@ -1,250 +0,0 @@ - -package org.drip.state.basis; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * BasisCurve is the Stub for the Basis between a Pair of Forward Curves. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class BasisCurve implements org.drip.state.basis.BasisEstimator, - org.drip.analytics.definition.Curve { - - /** - * Basis Latent State - */ - - public static final java.lang.String LATENT_STATE_BASIS = "LATENT_STATE_BASIS"; - - /** - * Basis Latent State Quantification Metric - Discount Factor - */ - - public static final java.lang.String QUANTIFICATION_METRIC_FORWARD_RATE = - "QUANTIFICATION_METRIC_FORWARD_RATE"; - - private boolean _bBasisOnReference = false; - private int _iEpochDate = java.lang.Integer.MIN_VALUE; - private org.drip.state.identifier.ForwardLabel _friDerived = null; - private org.drip.state.identifier.ForwardLabel _friReference = null; - - protected BasisCurve ( - final int iEpochDate, - final org.drip.state.identifier.ForwardLabel friReference, - final org.drip.state.identifier.ForwardLabel friDerived, - final boolean bBasisOnReference) - throws java.lang.Exception - { - if (null == (_friDerived = friDerived) || null == (_friReference = friReference)) - throw new java.lang.Exception ("BasisCurve ctr: Invalid Inputs"); - - _iEpochDate = iEpochDate; - _bBasisOnReference = bBasisOnReference; - } - - @Override public org.drip.state.identifier.LatentStateLabel label() - { - return org.drip.state.identifier.CustomLabel.Standard (_bBasisOnReference ? - _friReference.fullyQualifiedName() + "::" + _friDerived.fullyQualifiedName() : - _friDerived.fullyQualifiedName() + "::" + _friReference.fullyQualifiedName()); - } - - @Override public java.lang.String currency() - { - return _bBasisOnReference ? _friReference.currency() : _friDerived.currency(); - } - - @Override public org.drip.analytics.date.JulianDate epoch() - { - try { - return new org.drip.analytics.date.JulianDate (_iEpochDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.state.identifier.ForwardLabel referenceIndex() - { - return _friReference; - } - - @Override public org.drip.state.identifier.ForwardLabel derivedIndex() - { - return _friDerived; - } - - @Override public double basis ( - final org.drip.analytics.date.JulianDate dt) - throws java.lang.Exception - { - if (null == dt) throw new java.lang.Exception ("BasisCurve::basis got null for date"); - - return basis (dt.julian()); - } - - @Override public double basis ( - final java.lang.String strTenor) - throws java.lang.Exception - { - if (null == strTenor || strTenor.isEmpty()) - throw new java.lang.Exception ("BasisCurve::basis got bad tenor"); - - return basis (epoch().addTenor (strTenor)); - } - - @Override public boolean setCCIS ( - final org.drip.analytics.input.CurveConstructionInputSet ccis) - { - return true; - } - - @Override public org.drip.product.definition.CalibratableComponent[] calibComp() - { - return null; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap manifestMeasure ( - final java.lang.String strInstr) - { - return null; - } - - @Override public org.drip.state.representation.LatentState parallelShiftManifestMeasure ( - final java.lang.String strManifestMeasure, - final double dblShift) - { - return null; - } - - @Override public org.drip.state.representation.LatentState shiftManifestMeasure ( - final int iSpanIndex, - final java.lang.String strManifestMeasure, - final double dblShift) - { - return null; - } - - @Override public org.drip.state.representation.LatentState customTweakManifestMeasure ( - final java.lang.String strManifestMeasure, - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - return null; - } - - @Override public org.drip.state.representation.LatentState parallelShiftQuantificationMetric ( - final double dblShift) - { - return null; - } - - @Override public org.drip.state.representation.LatentState customTweakQuantificationMetric ( - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - return null; - } - - /** - * Retrieve the Manifest Measure Jacobian of the Forward Rate to the given date - * - * @param strManifestMeasure Manifest Measure - * @param dblDate Date - * - * @return The Manifest Measure Jacobian of the Forward Rate to the given date - */ - - public abstract org.drip.quant.calculus.WengertJacobian jackDForwardDManifestMeasure ( - final java.lang.String strManifestMeasure, - final int dblDate); - - /** - * Retrieve the Manifest Measure Jacobian of the Forward Rate to the given date - * - * @param strManifestMeasure Manifest Measure - * @param dt Date - * - * @return The Manifest Measure Jacobian of the Forward Rate to the given date - */ - - public org.drip.quant.calculus.WengertJacobian jackDForwardDManifestMeasure ( - final java.lang.String strManifestMeasure, - final org.drip.analytics.date.JulianDate dt) - { - if (null == dt) return null; - - return jackDForwardDManifestMeasure (strManifestMeasure, dt.julian()); - } - - /** - * Retrieve the Manifest Measure Jacobian of the Forward Rate to the date implied by the given Tenor - * - * @param strManifestMeasure Manifest Measure - * @param strTenor Tenor - * - * @return The Manifest Measure Jacobian of the Forward Rate to the date implied by the given Tenor - */ - - public org.drip.quant.calculus.WengertJacobian jackDForwardDManifestMeasure ( - final java.lang.String strManifestMeasure, - final java.lang.String strTenor) - { - if (null == strTenor || strTenor.isEmpty()) return null; - - try { - return jackDForwardDManifestMeasure (strManifestMeasure, epoch().addTenor (strTenor)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/state/basis/BasisEstimator.java b/org/drip/state/basis/BasisEstimator.java deleted file mode 100644 index 19ddfa1..0000000 --- a/org/drip/state/basis/BasisEstimator.java +++ /dev/null @@ -1,117 +0,0 @@ - -package org.drip.state.basis; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * BasisEstimator is the interface that exposes the calculation of the Basis between any two latent states. - * - * @author Lakshmi Krishnamurthy - */ - -public interface BasisEstimator { - - /** - * Retrieve the Reference Index - * - * @return The Reference Index - */ - - public abstract org.drip.state.identifier.ForwardLabel referenceIndex(); - - /** - * Retrieve the Derived Index - * - * @return The Derived Index - */ - - public abstract org.drip.state.identifier.ForwardLabel derivedIndex(); - - /** - * Calculate the Basis to the given Date - * - * @param iDate Date - * - * @return The Basis - * - * @throws java.lang.Exception Thrown if the Basis cannot be calculated - */ - - public abstract double basis ( - final int iDate) - throws java.lang.Exception; - - /** - * Calculate the Basis to the given Date - * - * @param dt Date - * - * @return The Basis - * - * @throws java.lang.Exception Thrown if the Basis cannot be calculated - */ - - public abstract double basis ( - final org.drip.analytics.date.JulianDate dt) - throws java.lang.Exception; - - /** - * Calculate the Basis to the given Tenor - * - * @param strTenor The Tenor - * - * @return The Basis - * - * @throws java.lang.Exception Thrown if the Basis cannot be calculated - */ - - public abstract double basis ( - final java.lang.String strTenor) - throws java.lang.Exception; -} diff --git a/org/drip/state/boot/CreditCurveScenario.java b/org/drip/state/boot/CreditCurveScenario.java deleted file mode 100644 index 92c0aad..0000000 --- a/org/drip/state/boot/CreditCurveScenario.java +++ /dev/null @@ -1,296 +0,0 @@ - -package org.drip.state.boot; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * CreditCurveScenario uses the hazard rate calibration instruments along with the component calibrator to - * produce scenario hazard rate curves. - * - * CreditCurveScenario typically first constructs the actual curve calibrator instance to localize the - * intelligence around curve construction. It then uses this curve calibrator instance to build individual - * curves or the sequence of node bumped scenario curves. The curves in the set may be an array, or - * tenor-keyed. - * - * @author Lakshmi Krishnamurthy - */ - -public class CreditCurveScenario { - static class TranslatedQuoteMeasure { - java.lang.String _strMeasure = ""; - double _dblQuote = java.lang.Double.NaN; - - TranslatedQuoteMeasure ( - final java.lang.String strMeasure, - final double dblQuote) - { - _dblQuote = dblQuote; - _strMeasure = strMeasure; - } - } - - private static final TranslatedQuoteMeasure TranslateQuoteMeasure ( - final org.drip.product.definition.CalibratableComponent comp, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.state.credit.CreditCurve cc, - final java.lang.String strMeasure, - final double dblQuote) - { - if (!(comp instanceof org.drip.product.definition.CreditDefaultSwap) || - (!"FlatSpread".equalsIgnoreCase (strMeasure) && !"QuotedSpread".equalsIgnoreCase (strMeasure))) - return new TranslatedQuoteMeasure (strMeasure, dblQuote); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapQSMeasures = - ((org.drip.product.definition.CreditDefaultSwap) comp).valueFromQuotedSpread (valParams, - pricerParams, org.drip.param.creator.MarketParamsBuilder.Credit (dc, cc), null, - 0.01, dblQuote); - - return new TranslatedQuoteMeasure ("Upfront", null == mapQSMeasures ? null : mapQSMeasures.get - ("Upfront")); - } - - /** - * Calibrate a Credit Curve - * - * @param strName Credit Curve name - * @param valParams ValuationParams - * @param aCalibInst Array of Calibration Instruments - * @param adblCalibQuote Array of component quotes - * @param astrCalibMeasure Array of the calibration measures - * @param dblRecovery Component recovery - * @param bFlat Flat Calibration (True), or real bootstrapping (false) - * @param dc Base Discount Curve - * @param gc Govvie Curve - * @param lsfc Latent State Fixings Container - * @param vcp Valuation Customization Parameters - * - * @return CreditCurve Instance - */ - - public static final org.drip.state.credit.CreditCurve Standard ( - final java.lang.String strName, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.product.definition.CalibratableComponent[] aCalibInst, - final double[] adblCalibQuote, - final java.lang.String[] astrCalibMeasure, - final double dblRecovery, - final boolean bFlat, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.state.govvie.GovvieCurve gc, - final org.drip.param.market.LatentStateFixingsContainer lsfc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == valParams || null == aCalibInst || null == adblCalibQuote || null == astrCalibMeasure || - null == dc) - return null; - - int iNumComp = aCalibInst.length; - int aiDate[] = new int[iNumComp]; - double adblHazardRate[] = new double[iNumComp]; - - if (0 == iNumComp || adblCalibQuote.length != iNumComp || astrCalibMeasure.length != iNumComp) - return null; - - for (int i = 0; i < iNumComp; ++i) { - adblHazardRate[i] = java.lang.Double.NaN; - - aiDate[i] = aCalibInst[i].maturityDate().julian(); - } - - org.drip.state.credit.ExplicitBootCreditCurve ebcc = - org.drip.state.creator.ScenarioCreditCurveBuilder.Hazard (new org.drip.analytics.date.JulianDate - (valParams.valueDate()), strName, dc.currency(), aiDate, adblHazardRate, dblRecovery); - - org.drip.param.pricer.CreditPricerParams pricerParams = new org.drip.param.pricer.CreditPricerParams - (7, null, false, org.drip.param.pricer.CreditPricerParams.PERIOD_DISCRETIZATION_DAY_STEP); - - for (int i = 0; i < iNumComp; ++i) { - TranslatedQuoteMeasure tqm = TranslateQuoteMeasure (aCalibInst[i], valParams, pricerParams, dc, - ebcc, astrCalibMeasure[i], adblCalibQuote[i]); - - if (null == tqm) return null; - - if (!org.drip.state.nonlinear.NonlinearCurveBuilder.CreditCurve (valParams, aCalibInst[i], - tqm._dblQuote, tqm._strMeasure, bFlat, i, ebcc, dc, gc, pricerParams, lsfc, vcp)) - return null; - } - - ebcc.setInstrCalibInputs (valParams, bFlat, dc, gc, pricerParams, aCalibInst, adblCalibQuote, - astrCalibMeasure, lsfc, vcp); - - return ebcc; - } - - /** - * Create an array of tenor bumped credit curves - * - * @param strName Credit Curve Name - * @param valParams ValuationParams - * @param aCalibInst Array of Calibration Instruments - * @param adblCalibQuote Array of component quotes - * @param astrCalibMeasure Array of the calibration measures - * @param dblRecovery Component recovery - * @param bFlat Flat Calibration (True), or real bootstrapping (false) - * @param dblBump Amount of bump applied to the tenor - * @param dc Base Discount Curve - * @param gc Govvie Curve - * @param lsfc Latent State Fixings Container - * @param vcp Valuation Customization Parameters - * - * @return Array of CreditCurves - */ - - public static final org.drip.state.credit.CreditCurve[] Tenor ( - final java.lang.String strName, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.product.definition.CalibratableComponent[] aCalibInst, - final double[] adblCalibQuote, - final java.lang.String[] astrCalibMeasure, - final double dblRecovery, - final boolean bFlat, - final double dblBump, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.state.govvie.GovvieCurve gc, - final org.drip.param.market.LatentStateFixingsContainer lsfc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == valParams || null == aCalibInst || null == adblCalibQuote || null == astrCalibMeasure || - null == dc) - return null; - - int iNumComp = aCalibInst.length; - org.drip.state.credit.CreditCurve[] aCreditCurve = new org.drip.state.credit.CreditCurve[iNumComp]; - - if (0 == iNumComp || adblCalibQuote.length != iNumComp || astrCalibMeasure.length != iNumComp) - return null; - - for (int i = 0; i < iNumComp; ++i) { - double[] adblTenorQuote = new double [iNumComp]; - - for (int j = 0; j < iNumComp; ++j) - adblTenorQuote[j] += (j == i ? dblBump : 0.); - - if (null == (aCreditCurve[i] = Standard (strName, valParams, aCalibInst, adblTenorQuote, - astrCalibMeasure, dblRecovery, bFlat, dc, gc, lsfc, vcp))) - return null; - } - - return aCreditCurve; - } - - /** - * Create an tenor named map of tenor bumped credit curves - * - * @param strName Credit Curve name - * @param valParams ValuationParams - * @param aCalibInst Array of Calibration Instruments - * @param adblCalibQuote Array of component quotes - * @param astrCalibMeasure Array of the calibration measures - * @param dblRecovery Component recovery - * @param bFlat Flat Calibration (True), or real bootstrapping (false) - * @param dblBump Amount of bump applied to the tenor - * @param dc Base Discount Curve - * @param gc Govvie Curve - * @param lsfc Latent State Fixings Container - * @param vcp Valuation Customization Parameters - * - * @return Tenor named map of tenor bumped credit curves - */ - - public static final org.drip.analytics.support.CaseInsensitiveTreeMap - TenorMap ( - final java.lang.String strName, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.product.definition.CalibratableComponent[] aCalibInst, - final double[] adblCalibQuote, - final java.lang.String[] astrCalibMeasure, - final double dblRecovery, - final boolean bFlat, - final double dblBump, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.state.govvie.GovvieCurve gc, - final org.drip.param.market.LatentStateFixingsContainer lsfc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == valParams || null == aCalibInst || null == adblCalibQuote || null == astrCalibMeasure || - null == dc) - return null; - - int iNumComp = aCalibInst.length; - - if (0 == iNumComp || adblCalibQuote.length != iNumComp || astrCalibMeasure.length != iNumComp) - return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapTenorCreditCurve = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (int i = 0; i < iNumComp; ++i) { - org.drip.state.credit.CreditCurve cc = null; - double[] adblTenorQuote = new double[iNumComp]; - - for (int j = 0; j < iNumComp; ++j) - adblTenorQuote[j] = adblCalibQuote[j] + (j == i ? dblBump : 0.); - - if (null == (cc = Standard (strName, valParams, aCalibInst, adblTenorQuote, astrCalibMeasure, - dblRecovery, bFlat, dc, gc, lsfc, vcp))) - return null; - - mapTenorCreditCurve.put (org.drip.analytics.date.DateUtil.YYYYMMDD - (aCalibInst[i].maturityDate().julian()), cc); - } - - return mapTenorCreditCurve; - } -} diff --git a/org/drip/state/boot/DiscountCurveScenario.java b/org/drip/state/boot/DiscountCurveScenario.java deleted file mode 100644 index b3dad9f..0000000 --- a/org/drip/state/boot/DiscountCurveScenario.java +++ /dev/null @@ -1,228 +0,0 @@ - -package org.drip.state.boot; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * DiscountCurveScenario uses the interest rate calibration instruments along with the component calibrator - * to produce scenario interest rate curves. - * - * DiscountCurveScenario typically first constructs the actual curve calibrator instance to localize the - * intelligence around curve construction. It then uses this curve calibrator instance to build individual - * curves or the sequence of node bumped scenario curves. The curves in the set may be an array, or - * tenor-keyed. - * - * @author Lakshmi Krishnamurthy - */ - -public class DiscountCurveScenario { - - /** - * Calibrate a discount curve - * - * @param valParams ValuationParams - * @param aCalibInst Array of Calibratable Components - * @param adblCalibQuote Array of component quotes - * @param astrCalibMeasure Array of the calibration measures - * @param dblBump Quote bump - * @param gc Govvie Curve - * @param lsfc Latent State Fixings Container - * @param vcp Valuation Customization Parameters - * - * @return DiscountCurve Instance - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve Standard ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.product.definition.CalibratableComponent[] aCalibInst, - final double[] adblCalibQuote, - final java.lang.String[] astrCalibMeasure, - final double dblBump, - final org.drip.state.govvie.GovvieCurve gc, - final org.drip.param.market.LatentStateFixingsContainer lsfc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == valParams || null == aCalibInst || null == adblCalibQuote || null == astrCalibMeasure) - return null; - - int iNumComp = aCalibInst.length; - int aiDate[] = new int[iNumComp]; - double adblRate[] = new double[iNumComp]; - - if (0 == iNumComp || adblCalibQuote.length != iNumComp || astrCalibMeasure.length != iNumComp) - return null; - - java.lang.String strCurrency = aCalibInst[0].payCurrency(); - - for (int i = 0; i < iNumComp; ++i) { - if (null == aCalibInst[i] || !strCurrency.equalsIgnoreCase (aCalibInst[i].payCurrency())) - return null; - - adblRate[i] = 0.02; - - aiDate[i] = aCalibInst[i].maturityDate().julian(); - } - - org.drip.state.discount.ExplicitBootDiscountCurve ebdc = - org.drip.state.creator.ScenarioDiscountCurveBuilder.PiecewiseForward (new - org.drip.analytics.date.JulianDate (valParams.valueDate()), strCurrency, aiDate, adblRate); - - if (!org.drip.state.nonlinear.NonlinearCurveBuilder.DiscountCurve (valParams, aCalibInst, - adblCalibQuote, astrCalibMeasure, dblBump, false, ebdc, gc, lsfc, vcp)) - return null; - - ebdc.setCCIS (org.drip.analytics.input.BootCurveConstructionInput.Create (valParams, vcp, aCalibInst, - adblCalibQuote, astrCalibMeasure, lsfc)); - - return ebdc; - } - - /** - * Calibrate an array of tenor bumped discount curves - * - * @param valParams Valuation Parameters - * @param aCalibInst Array of Calibratable Components - * @param adblCalibQuote Array of component quotes - * @param astrCalibMeasure Array of the calibration measures - * @param dblBump Quote bump - * @param gc Govvie Curve - * @param lsfc Latent State Fixings Container - * @param vcp Valuation Customization Parameters - * - * @return Array of tenor bumped discount curves - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve[] Tenor ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.product.definition.CalibratableComponent[] aCalibInst, - final double[] adblCalibQuote, - final java.lang.String[] astrCalibMeasure, - final double dblBump, - final org.drip.state.govvie.GovvieCurve gc, - final org.drip.param.market.LatentStateFixingsContainer lsfc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == aCalibInst || !org.drip.quant.common.NumberUtil.IsValid (dblBump)) return null; - - int iNumComp = aCalibInst.length; - org.drip.state.discount.MergedDiscountForwardCurve[] aDiscountCurve = new - org.drip.state.discount.MergedDiscountForwardCurve[iNumComp]; - - if (0 == iNumComp || adblCalibQuote.length != iNumComp || astrCalibMeasure.length != iNumComp) - return null; - - for (int i = 0; i < iNumComp; ++i) { - double[] adblTenorQuote = new double [iNumComp]; - - for (int j = 0; j < iNumComp; ++j) - adblTenorQuote[j] = adblCalibQuote[j] + (j == i ? dblBump : 0.); - - if (null == (aDiscountCurve[i] = Standard (valParams, aCalibInst, adblTenorQuote, - astrCalibMeasure, 0., gc, lsfc, vcp))) - return null; - } - - return aDiscountCurve; - } - - /** - * Calibrate a tenor map of tenor bumped discount curves - * - * @param valParams ValuationParams - * @param aCalibInst Array of Calibratable Components - * @param adblCalibQuote Array of component quotes - * @param astrCalibMeasure Array of the calibration measures - * @param dblBump Quote bump - * @param gc Govvie Curve - * @param lsfc Latent State Fixings Container - * @param vcp Valuation Customization Parameters - * - * @return Tenor map of tenor bumped discount curves - */ - - public static final - org.drip.analytics.support.CaseInsensitiveTreeMap TenorMap ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.product.definition.CalibratableComponent[] aCalibInst, - final double[] adblCalibQuote, - final java.lang.String[] astrCalibMeasure, - final double dblBump, - final org.drip.state.govvie.GovvieCurve gc, - final org.drip.param.market.LatentStateFixingsContainer lsfc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == aCalibInst || null == adblCalibQuote || !org.drip.quant.common.NumberUtil.IsValid - (dblBump)) - return null; - - int iNumComp = aCalibInst.length; - - if (0 == iNumComp || adblCalibQuote.length != iNumComp) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapTenorDiscountCurve = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (int i = 0; i < iNumComp; ++i) { - double[] adblTenorQuote = new double [iNumComp]; - - for (int j = 0; j < iNumComp; ++j) - adblTenorQuote[j] = adblCalibQuote[j] + (j == i ? dblBump : 0.); - - mapTenorDiscountCurve.put (org.drip.analytics.date.DateUtil.YYYYMMDD - (aCalibInst[i].maturityDate().julian()), Standard (valParams, aCalibInst, adblTenorQuote, - astrCalibMeasure, 0., gc, lsfc, vcp)); - } - - return mapTenorDiscountCurve; - } -} diff --git a/org/drip/state/boot/VolatilityCurveScenario.java b/org/drip/state/boot/VolatilityCurveScenario.java deleted file mode 100644 index dc3f022..0000000 --- a/org/drip/state/boot/VolatilityCurveScenario.java +++ /dev/null @@ -1,252 +0,0 @@ - -package org.drip.state.boot; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * VolatilityCurveScenario uses the Volatility calibration instruments along with the component calibrator to - * produce scenario Volatility curves. - * - * @author Lakshmi Krishnamurthy - */ - -public class VolatilityCurveScenario { - - /** - * Calibrate a Volatility Curve - * - * @param strName Volatility Curve name - * @param valParams ValuationParams - * @param lslUnderlying Underlying Latent State Label - * @param aFRACapFloor Array of the FRA Cap Floor Instruments - * @param adblCalibQuote Array of component quotes - * @param astrCalibMeasure Array of the calibration measures - * @param bFlat Flat Calibration (True), or real bootstrapping (false) - * @param dc Discount Curve - * @param fc Forward Curve - * @param lsfc Latent State Fixings Container - * @param vcp Valuation Customization Parameters - * - * @return VolatilityCurve Instance - */ - - public static final org.drip.state.volatility.VolatilityCurve Standard ( - final java.lang.String strName, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.identifier.LatentStateLabel lslUnderlying, - final org.drip.product.fra.FRAStandardCapFloor[] aFRACapFloor, - final double[] adblCalibQuote, - final java.lang.String[] astrCalibMeasure, - final boolean bFlat, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.state.forward.ForwardCurve fc, - final org.drip.param.market.LatentStateFixingsContainer lsfc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == valParams || null == aFRACapFloor || null == adblCalibQuote || null == astrCalibMeasure - || null == dc) - return null; - - int iNumComp = aFRACapFloor.length; - int aiPillarDate[] = new int[iNumComp]; - double adblVolatility[] = new double[iNumComp]; - org.drip.state.volatility.ExplicitBootVolatilityCurve ebvc = null; - - if (0 == iNumComp || adblCalibQuote.length != iNumComp || astrCalibMeasure.length != iNumComp) - return null; - - for (int i = 0; i < iNumComp; ++i) { - if (null == aFRACapFloor[i]) return null; - - adblVolatility[i] = 0.001; - - aiPillarDate[i] = aFRACapFloor[i].stream().maturity().julian(); - } - - try { - ebvc = new org.drip.state.nonlinear.FlatForwardVolatilityCurve (dc.epoch().julian(), - org.drip.state.identifier.VolatilityLabel.Standard (lslUnderlying), dc.currency(), - aiPillarDate, adblVolatility); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int i = 0; i < iNumComp; ++i) { - try { - org.drip.state.nonlinear.NonlinearCurveBuilder.VolatilityCurveNode (valParams, - aFRACapFloor[i], adblCalibQuote[i], astrCalibMeasure[i], bFlat, i, ebvc, dc, fc, lsfc, - vcp); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return ebvc; - } - - /** - * Create an array of tenor bumped Volatility curves - * - * @param strName Volatility Curve Name - * @param valParams ValuationParams - * @param lslUnderlying Underlying Latent State Label - * @param aFRACapFloor Array of the FRA Cap Floor Instruments - * @param adblCalibQuote Array of component quotes - * @param astrCalibMeasure Array of the calibration measures - * @param bFlat Flat Calibration (True), or real bootstrapping (false) - * @param dblBump Amount of bump applied to the tenor - * @param dc Base Discount Curve - * @param fc Forward Curve - * @param lsfc Latent State Fixings Container - * @param vcp Valuation Customization Parameters - * - * @return Array of Volatility Curves - */ - - public static final org.drip.state.volatility.VolatilityCurve[] Tenor ( - final java.lang.String strName, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.identifier.LatentStateLabel lslUnderlying, - final org.drip.product.fra.FRAStandardCapFloor[] aFRACapFloor, - final double[] adblCalibQuote, - final java.lang.String[] astrCalibMeasure, - final boolean bFlat, - final double dblBump, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.state.forward.ForwardCurve fc, - final org.drip.param.market.LatentStateFixingsContainer lsfc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == aFRACapFloor || !org.drip.quant.common.NumberUtil.IsValid (dblBump)) return null; - - int iNumComp = aFRACapFloor.length; - org.drip.state.volatility.VolatilityCurve[] aVolatilityCurve = new - org.drip.state.volatility.VolatilityCurve[iNumComp]; - - if (0 == iNumComp) return null; - - for (int i = 0; i < iNumComp; ++i) { - double[] adblTenorQuote = new double [iNumComp]; - - for (int j = 0; j < iNumComp; ++j) - adblTenorQuote[j] += (j == i ? dblBump : 0.); - - if (null == (aVolatilityCurve[i] = Standard (strName, valParams, lslUnderlying, aFRACapFloor, - adblTenorQuote, astrCalibMeasure, bFlat, dc, fc, lsfc, vcp))) - return null; - } - - return aVolatilityCurve; - } - - /** - * Create an tenor named map of tenor bumped Volatility curves - * - * @param strName Volatility Curve name - * @param valParams ValuationParams - * @param lslUnderlying Underlying Latent State Label - * @param aFRACapFloor Array of the FRA Cap Floor Instruments - * @param adblCalibQuote Array of component quotes - * @param astrCalibMeasure Array of the calibration measures - * @param bFlat Flat Calibration (True), or real bootstrapping (false) - * @param dblBump Amount of bump applied to the tenor - * @param dc Base Discount Curve - * @param fc Forward Curve - * @param lsfc Latent State Fixings Container - * @param vcp Valuation Customization Parameters - * - * @return Tenor named map of tenor bumped Volatility curves - */ - - public org.drip.analytics.support.CaseInsensitiveTreeMap - TenorMap ( - final java.lang.String strName, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.identifier.LatentStateLabel lslUnderlying, - final org.drip.product.fra.FRAStandardCapFloor[] aFRACapFloor, - final double[] adblCalibQuote, - final java.lang.String[] astrCalibMeasure, - final boolean bFlat, - final double dblBump, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.state.forward.ForwardCurve fc, - final org.drip.param.market.LatentStateFixingsContainer lsfc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == aFRACapFloor || !org.drip.quant.common.NumberUtil.IsValid (dblBump)) return null; - - int iNumComp = aFRACapFloor.length; - - if (0 == iNumComp) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapTenorVolatilityCurve = new - org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (int i = 0; i < iNumComp; ++i) { - double[] adblTenorQuote = new double[iNumComp]; - org.drip.state.volatility.VolatilityCurve volCurve = null; - - for (int j = 0; j < iNumComp; ++j) - adblTenorQuote[j] = adblCalibQuote[j] + (j == i ? dblBump : 0.); - - if (null == (volCurve = Standard (strName, valParams, lslUnderlying, aFRACapFloor, adblTenorQuote, - astrCalibMeasure, bFlat, dc, fc, lsfc, vcp))) - return null; - - mapTenorVolatilityCurve.put (org.drip.analytics.date.DateUtil.YYYYMMDD - (aFRACapFloor[i].maturityDate().julian()), volCurve); - } - - return mapTenorVolatilityCurve; - } -} diff --git a/org/drip/state/creator/ScenarioBasisCurveBuilder.java b/org/drip/state/creator/ScenarioBasisCurveBuilder.java deleted file mode 100644 index e64d72c..0000000 --- a/org/drip/state/creator/ScenarioBasisCurveBuilder.java +++ /dev/null @@ -1,351 +0,0 @@ - -package org.drip.state.creator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ScenarioBasisCurveBuilder implements the construction of the scenario basis curve using the input - * instruments and their quotes. - * - * @author Lakshmi Krishnamurthy - */ - -public class ScenarioBasisCurveBuilder { - - /** - * Create an Instance of the Custom Splined Basis Curve - * - * @param strName Curve Name - * @param dtSpot The Spot Date - * @param friReference Reference Leg FRI - * @param friDerived Derived Leg FRI - * @param bBasisOnReference TRUE - The Basis Quote is on the Reference Leg - * @param astrTenor Array of the Tenors - * @param adblBasis Array of the Basis Spreads - * @param scbc The Segment Custom Builder Control - * - * @return The Instance of the Basis Curve - */ - - public static final org.drip.state.basis.BasisCurve CustomSplineBasisCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.state.identifier.ForwardLabel friReference, - final org.drip.state.identifier.ForwardLabel friDerived, - final boolean bBasisOnReference, - final java.lang.String[] astrTenor, - final double[] adblBasis, - final org.drip.spline.params.SegmentCustomBuilderControl scbc) - { - if (null == strName || null == dtSpot || strName.isEmpty() || null == astrTenor || null == adblBasis) - return null; - - int iNumTenor = astrTenor.length; - int[] aiBasisPredictorOrdinate = new int[iNumTenor + 1]; - double[] adblBasisResponseValue = new double[iNumTenor + 1]; - org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC = new - org.drip.spline.params.SegmentCustomBuilderControl[iNumTenor]; - - if (0 == iNumTenor || iNumTenor != adblBasis.length) return null; - - for (int i = 0; i <= iNumTenor; ++i) { - if (0 != i) { - java.lang.String strTenor = astrTenor[i - 1]; - - if (null == strTenor || strTenor.isEmpty()) return null; - - org.drip.analytics.date.JulianDate dtMaturity = dtSpot.addTenor (strTenor); - - if (null == dtMaturity) return null; - - aiBasisPredictorOrdinate[i] = dtMaturity.julian(); - } else - aiBasisPredictorOrdinate[i] = dtSpot.julian(); - - adblBasisResponseValue[i] = 0 == i ? adblBasis[0] : adblBasis[i - 1]; - - if (0 != i) aSCBC[i - 1] = scbc; - } - - try { - return new org.drip.state.curve.BasisSplineBasisCurve (friReference, friDerived, - bBasisOnReference, new org.drip.spline.grid.OverlappingStretchSpan - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - (strName, aiBasisPredictorOrdinate, adblBasisResponseValue, aSCBC, null, - org.drip.spline.stretch.BoundarySettings.NaturalStandard(), - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the Cubic Polynomial Splined Basis Curve - * - * @param strName Curve Name - * @param dtStart The Tenor Start Date - * @param friReference Reference Leg FRI - * @param friDerived Derived Leg FRI - * @param bBasisOnReference TRUE - The Basis Quote is on the Reference Leg - * @param astrTenor Array of the Tenors - * @param adblBasis Array of the Basis Spreads - * - * @return The Instance of the Basis Curve - */ - - public static final org.drip.state.basis.BasisCurve CubicPolynomialBasisCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final org.drip.state.identifier.ForwardLabel friReference, - final org.drip.state.identifier.ForwardLabel friDerived, - final boolean bBasisOnReference, - final java.lang.String[] astrTenor, - final double[] adblBasis) - { - try { - return CustomSplineBasisCurve (strName, dtStart, friReference, friDerived, bBasisOnReference, - astrTenor, adblBasis, new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (4), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the Quartic Polynomial Splined Basis Curve - * - * @param strName Curve Name - * @param dtStart The Tenor Start Date - * @param friReference Reference Leg FRI - * @param friDerived Derived Leg FRI - * @param bBasisOnReference TRUE - The Basis Quote is on the Reference Leg - * @param astrTenor Array of the Tenors - * @param adblBasis Array of the Basis Spreads - * - * @return The Instance of the Basis Curve - */ - - public static final org.drip.state.basis.BasisCurve QuarticPolynomialBasisCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final org.drip.state.identifier.ForwardLabel friReference, - final org.drip.state.identifier.ForwardLabel friDerived, - final boolean bBasisOnReference, - final java.lang.String[] astrTenor, - final double[] adblBasis) - { - try { - return CustomSplineBasisCurve (strName, dtStart, friReference, friDerived, bBasisOnReference, - astrTenor, adblBasis, new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (5), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the Kaklis-Pandelis Splined Basis Curve - * - * @param strName Curve Name - * @param dtStart The Tenor Start Date - * @param friReference Reference Leg FRI - * @param friDerived Derived Leg FRI - * @param bBasisOnReference TRUE - The Basis Quote is on the Reference Leg - * @param astrTenor Array of the Tenors - * @param adblBasis Array of the Basis Spreads - * - * @return The Instance of the Basis Curve - */ - - public static final org.drip.state.basis.BasisCurve KaklisPandelisBasisCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final org.drip.state.identifier.ForwardLabel friReference, - final org.drip.state.identifier.ForwardLabel friDerived, - final boolean bBasisOnReference, - final java.lang.String[] astrTenor, - final double[] adblBasis) - { - try { - return CustomSplineBasisCurve (strName, dtStart, friReference, friDerived, bBasisOnReference, - astrTenor, adblBasis, new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KAKLIS_PANDELIS, - new org.drip.spline.basis.KaklisPandelisSetParams (2), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the KLK Hyperbolic Splined Basis Curve - * - * @param strName Curve Name - * @param dtStart The Tenor Start Date - * @param friReference Reference Leg FRI - * @param friDerived Derived Leg FRI - * @param bBasisOnReference TRUE - The Basis Quote is on the Reference Leg - * @param astrTenor Array of the Tenors - * @param adblBasis Array of the Basis Spreads - * @param dblTension The Tension Parameter - * - * @return The Instance of the Basis Curve - */ - - public static final org.drip.state.basis.BasisCurve KLKHyperbolicBasisCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final org.drip.state.identifier.ForwardLabel friReference, - final org.drip.state.identifier.ForwardLabel friDerived, - final boolean bBasisOnReference, - final java.lang.String[] astrTenor, - final double[] adblBasis, - final double dblTension) - { - try { - return CustomSplineBasisCurve (strName, dtStart, friReference, friDerived, bBasisOnReference, - astrTenor, adblBasis, new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the KLK Rational Linear Splined Basis Curve - * - * @param strName Curve Name - * @param dtStart The Tenor Start Date - * @param friReference Reference Leg FRI - * @param friDerived Derived Leg FRI - * @param bBasisOnReference TRUE - The Basis Quote is on the Reference Leg - * @param astrTenor Array of the Tenors - * @param adblBasis Array of the Basis Spreads - * @param dblTension The Tension Parameter - * - * @return The Instance of the Basis Curve - */ - - public static final org.drip.state.basis.BasisCurve KLKRationalLinearBasisCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final org.drip.state.identifier.ForwardLabel friReference, - final org.drip.state.identifier.ForwardLabel friDerived, - final boolean bBasisOnReference, - final java.lang.String[] astrTenor, - final double[] adblBasis, - final double dblTension) - { - try { - return CustomSplineBasisCurve (strName, dtStart, friReference, friDerived, bBasisOnReference, - astrTenor, adblBasis, new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_RATIONAL_LINEAR_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the KLK Rational Quadratic Splined Basis Curve - * - * @param strName Curve Name - * @param dtStart The Tenor Start Date - * @param friReference Reference Leg FRI - * @param friDerived Derived Leg FRI - * @param bBasisOnReference TRUE - The Basis Quote is on the Reference Leg - * @param astrTenor Array of the Tenors - * @param adblBasis Array of the Basis Spreads - * @param dblTension The Tension Parameter - * - * @return The Instance of the Basis Curve - */ - - public static final org.drip.state.basis.BasisCurve KLKRationalQuadraticBasisCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final org.drip.state.identifier.ForwardLabel friReference, - final org.drip.state.identifier.ForwardLabel friDerived, - final boolean bBasisOnReference, - final java.lang.String[] astrTenor, - final double[] adblBasis, - final double dblTension) - { - try { - return CustomSplineBasisCurve (strName, dtStart, friReference, friDerived, bBasisOnReference, - astrTenor, adblBasis, new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_RATIONAL_QUADRATIC_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/state/creator/ScenarioCreditCurveBuilder.java b/org/drip/state/creator/ScenarioCreditCurveBuilder.java deleted file mode 100644 index 7f00d91..0000000 --- a/org/drip/state/creator/ScenarioCreditCurveBuilder.java +++ /dev/null @@ -1,360 +0,0 @@ - -package org.drip.state.creator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * ScenarioCreditCurveBuilder implements the construction of the custom Scenario based credit curves. - * - * @author Lakshmi Krishnamurthy - */ - -public class ScenarioCreditCurveBuilder { - - /** - * Create CreditScenarioCurve from the array of calibration instruments - * - * @param aCalibInst Array of calibration instruments - * - * @return CreditScenarioCurve object - */ - - public static final org.drip.param.market.CreditCurveScenarioContainer CreateCCSC ( - final org.drip.product.definition.CalibratableComponent[] aCalibInst) - { - try { - return new org.drip.param.market.CreditCurveScenarioContainer (aCalibInst, 0.0001, 0.01); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Calibrate the base credit curve from the input credit instruments, measures, and the quotes - * - * @param strName Credit Curve Name - * @param dtSpot Spot Date - * @param aCalibInst Array of calibration instruments - * @param dc Discount Curve - * @param adblCalibQuote Array of Instrument Quotes - * @param astrCalibMeasure Array of calibration Measures - * @param dblRecovery Recovery Rate - * @param bFlat Whether the Calibration is based off of a flat spread - * - * @return The cooked Credit Curve - */ - - public static final org.drip.state.credit.CreditCurve Custom ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.product.definition.CalibratableComponent[] aCalibInst, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final double[] adblCalibQuote, - final java.lang.String[] astrCalibMeasure, - final double dblRecovery, - final boolean bFlat) - { - return null == dtSpot ? null : org.drip.state.boot.CreditCurveScenario.Standard (strName, - org.drip.param.valuation.ValuationParams.Spot (dtSpot.julian()), aCalibInst, adblCalibQuote, - astrCalibMeasure, dblRecovery, bFlat, dc, null, null, null); - } - - /** - * Create a CreditCurve instance from a single node hazard rate - * - * @param iStartDate Curve epoch date - * @param strName Credit Curve Name - * @param strCurrency Currency - * @param dblHazardRate Curve hazard rate - * @param dblRecovery Curve recovery - * - * @return CreditCurve instance - */ - - public static final org.drip.state.credit.ExplicitBootCreditCurve FlatHazard ( - final int iStartDate, - final java.lang.String strName, - final java.lang.String strCurrency, - final double dblHazardRate, - final double dblRecovery) - { - try { - return new org.drip.state.nonlinear.ForwardHazardCreditCurve (iStartDate, - org.drip.state.identifier.CreditLabel.Standard (strName), strCurrency, new double[] - {dblHazardRate}, new int[] {iStartDate}, new double[] {dblRecovery}, new int[] - {iStartDate}, java.lang.Integer.MIN_VALUE); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create a CreditCurve Instance from the Input Array of Survival Probabilities - * - * @param iStartDate Start Date - * @param strName Credit Curve Name - * @param strCurrency Currency - * @param aiSurvivalDate Array of Dates - * @param adblSurvivalProbability Array of Survival Probabilities - * @param dblRecovery Recovery Rate - * - * @return The CreditCurve Instance - */ - - public static final org.drip.state.credit.ExplicitBootCreditCurve Survival ( - final int iStartDate, - final java.lang.String strName, - final java.lang.String strCurrency, - final int[] aiSurvivalDate, - final double[] adblSurvivalProbability, - final double dblRecovery) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblRecovery)) return null; - - try { - double dblSurvivalBegin = 1.; - int iPeriodBegin = iStartDate; - double[] adblHazard = new double[adblSurvivalProbability.length]; - double[] adblRecovery = new double[1]; - int[] aiRecoveryDate = new int[1]; - adblRecovery[0] = dblRecovery; - aiRecoveryDate[0] = iStartDate; - - for (int i = 0; i < adblSurvivalProbability.length; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (adblSurvivalProbability[i]) || - aiSurvivalDate[i] <= iPeriodBegin || dblSurvivalBegin <= adblSurvivalProbability[i]) - return null; - - adblHazard[i] = 365.25 / (aiSurvivalDate[i] - iPeriodBegin) * java.lang.Math.log - (dblSurvivalBegin / adblSurvivalProbability[i]); - - iPeriodBegin = aiSurvivalDate[i]; - dblSurvivalBegin = adblSurvivalProbability[i]; - } - - return new org.drip.state.nonlinear.ForwardHazardCreditCurve (iStartDate, - org.drip.state.identifier.CreditLabel.Standard (strName), strCurrency, adblHazard, - aiSurvivalDate, adblRecovery, aiRecoveryDate, java.lang.Integer.MIN_VALUE); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create a CreditCurve Instance from the Input Array of Survival Probabilities - * - * @param iStartDate Start Date - * @param strName Credit Curve Name - * @param strCurrency Currency - * @param astrSurvivalTenor Array of Survival Tenors - * @param adblSurvivalProbability Array of Survival Probabilities - * @param dblRecovery Recovery Rate - * - * @return The CreditCurve Instance - */ - - public static final org.drip.state.credit.ExplicitBootCreditCurve Survival ( - final int iStartDate, - final java.lang.String strName, - final java.lang.String strCurrency, - final java.lang.String[] astrSurvivalTenor, - final double[] adblSurvivalProbability, - final double dblRecovery) - { - if (null == astrSurvivalTenor) return null; - - org.drip.analytics.date.JulianDate dtStart = new org.drip.analytics.date.JulianDate (iStartDate); - - int iNumSurvivalTenor = astrSurvivalTenor.length; - int[] aiSurvivalDate = new int[iNumSurvivalTenor]; - - for (int i = 0; i < iNumSurvivalTenor; ++i) { - org.drip.analytics.date.JulianDate dtTenor = dtStart.addTenor (astrSurvivalTenor[i]); - - if (null == dtTenor) return null; - - aiSurvivalDate[i] = dtTenor.julian(); - } - - return Survival (iStartDate, strName, strCurrency, aiSurvivalDate, adblSurvivalProbability, - dblRecovery); - } - - /** - * Create an instance of the CreditCurve object from a solitary hazard rate node - * - * @param iStartDate The Curve epoch date - * @param strName Credit Curve Name - * @param strCurrency Currency - * @param dblHazardRate The solo hazard rate - * @param iHazardDate Date - * @param dblRecovery Recovery - * - * @return CreditCurve instance - */ - - public static final org.drip.state.credit.ExplicitBootCreditCurve Hazard ( - final int iStartDate, - final java.lang.String strName, - final java.lang.String strCurrency, - final double dblHazardRate, - final int iHazardDate, - final double dblRecovery) - { - if (!org.drip.quant.common.NumberUtil.IsValid (iStartDate) || - !org.drip.quant.common.NumberUtil.IsValid (dblHazardRate) || - !org.drip.quant.common.NumberUtil.IsValid (dblRecovery)) - return null; - - double[] adblHazard = new double[1]; - double[] adblRecovery = new double[1]; - int[] aiHazardDate = new int[1]; - int[] aiRecoveryDate = new int[1]; - adblHazard[0] = dblHazardRate; - adblRecovery[0] = dblRecovery; - aiHazardDate[0] = iHazardDate; - aiRecoveryDate[0] = iStartDate; - - try { - return new org.drip.state.nonlinear.ForwardHazardCreditCurve (iStartDate, - org.drip.state.identifier.CreditLabel.Standard (strName), strCurrency, adblHazard, - aiHazardDate, adblRecovery, aiRecoveryDate, java.lang.Integer.MIN_VALUE); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create a credit curve from an array of dates and hazard rates - * - * @param dtStart Curve epoch date - * @param strName Credit Curve Name - * @param strCurrency Currency - * @param aiDate Array of dates - * @param adblHazardRate Array of hazard rates - * @param dblRecovery Recovery - * - * @return CreditCurve instance - */ - - public static final org.drip.state.credit.ExplicitBootCreditCurve Hazard ( - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strName, - final java.lang.String strCurrency, - final int[] aiDate, - final double[] adblHazardRate, - final double dblRecovery) - { - if (null == dtStart || null == adblHazardRate || null == aiDate || adblHazardRate.length != - aiDate.length || !org.drip.quant.common.NumberUtil.IsValid (dblRecovery)) - return null; - - try { - double[] adblRecovery = new double[1]; - int[] aiRecoveryDate = new int[1]; - adblRecovery[0] = dblRecovery; - - aiRecoveryDate[0] = dtStart.julian(); - - return new org.drip.state.nonlinear.ForwardHazardCreditCurve (dtStart.julian(), - org.drip.state.identifier.CreditLabel.Standard (strName), strCurrency, adblHazardRate, - aiDate, adblRecovery, aiRecoveryDate, java.lang.Integer.MIN_VALUE); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create a credit curve from hazard rate and recovery rate term structures - * - * @param iStartDate Curve Epoch date - * @param strName Credit Curve Name - * @param strCurrency Currency - * @param adblHazardRate Matched array of hazard rates - * @param aiHazardDate Matched array of hazard dates - * @param adblRecoveryRate Matched array of recovery rates - * @param aiRecoveryDate Matched array of recovery dates - * @param iSpecificDefaultDate (Optional) Specific Default Date - * - * @return CreditCurve instance - */ - - public static final org.drip.state.credit.ExplicitBootCreditCurve Hazard ( - final int iStartDate, - final java.lang.String strName, - final java.lang.String strCurrency, - final double[] adblHazardRate, - final int[] aiHazardDate, - final double[] adblRecoveryRate, - final int[] aiRecoveryDate, - final int iSpecificDefaultDate) - { - try { - return new org.drip.state.nonlinear.ForwardHazardCreditCurve (iStartDate, - org.drip.state.identifier.CreditLabel.Standard (strName), strCurrency, adblHazardRate, - aiHazardDate, adblRecoveryRate, aiRecoveryDate, iSpecificDefaultDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/state/creator/ScenarioDeterministicVolatilityBuilder.java b/org/drip/state/creator/ScenarioDeterministicVolatilityBuilder.java deleted file mode 100644 index 84dbfef..0000000 --- a/org/drip/state/creator/ScenarioDeterministicVolatilityBuilder.java +++ /dev/null @@ -1,404 +0,0 @@ - -package org.drip.state.creator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ScenarioDeterministicVolatilityBuilder implements the construction of the basis spline deterministic - * volatility term structure using the input instruments and their quotes. - * - * @author Lakshmi Krishnamurthy - */ - -public class ScenarioDeterministicVolatilityBuilder { - - /** - * Construct the Deterministic Volatility Term Structure Instance using the specified Custom Spline - * - * @param strName Name of the the Term Structure Instance - * @param dtStart The Start Date - * @param strCurrency Currency - * @param aiDate Array of Dates - * @param adblImpliedVolatility Array of Implied Volatility Nodes - * @param scbc Segment Custom Builder Parameters - * - * @return Instance of the Term Structure - */ - - public static final org.drip.state.volatility.VolatilityCurve CustomSplineTermStructure ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final int[] aiDate, - final double[] adblImpliedVolatility, - final org.drip.spline.params.SegmentCustomBuilderControl scbc) - { - if (null == strName || strName.isEmpty() || null == dtStart || null == aiDate || null == - adblImpliedVolatility || null == scbc) - return null; - - int iNumDate = aiDate.length; - org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC = new - org.drip.spline.params.SegmentCustomBuilderControl[iNumDate - 1]; - - if (0 == iNumDate || iNumDate != adblImpliedVolatility.length) return null; - - for (int i = 0; i < iNumDate - 1; ++i) - aSCBC[i] = scbc; - - try { - return new org.drip.state.curve.BasisSplineDeterministicVolatility (dtStart.julian(), - org.drip.state.identifier.CustomLabel.Standard (strName), strCurrency, new - org.drip.spline.grid.OverlappingStretchSpan - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - (strName, aiDate, adblImpliedVolatility, aSCBC, null, - org.drip.spline.stretch.BoundarySettings.NaturalStandard(), - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct the Deterministic Volatility Term Structure Instance based off of a Cubic Polynomial Spline - * - * @param strName Name of the the Term Structure Instance - * @param dtStart The Start Date - * @param strCurrency Currency - * @param astrTenor Array of Tenors - * @param adblImpliedVolatility Array of Implied Volatility Nodes - * - * @return The Deterministic Volatility Term Structure Instance based off of a Cubic Polynomial Spline - */ - - public static final org.drip.state.volatility.VolatilityCurve CubicPolynomialTermStructure ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final java.lang.String[] astrTenor, - final double[] adblImpliedVolatility) - { - if (null == dtStart || null == astrTenor) return null; - - int iNumTenor = astrTenor.length; - int[] aiDate = new int[iNumTenor]; - - if (0 == iNumTenor) return null; - - for (int i = 0; i < iNumTenor; ++i) - aiDate[i] = dtStart.addTenor (astrTenor[i]).julian(); - - try { - return CustomSplineTermStructure (strName, dtStart, strCurrency, aiDate, adblImpliedVolatility, - new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (4), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct the Deterministic Volatility Term Structure Instance based off of a Quartic Polynomial - * `Spline - * - * @param strName Name of the the Term Structure Instance - * @param dtStart The Start Date - * @param strCurrency Currency - * @param astrTenor Array of Tenors - * @param adblImpliedVolatility Array of Implied Volatility Nodes - * - * @return The Deterministic Volatility Term Structure Instance based off of a Quartic Polynomial Spline - */ - - public static final org.drip.state.volatility.VolatilityCurve QuarticPolynomialTermStructure - (final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final java.lang.String[] astrTenor, - final double[] adblImpliedVolatility) - { - if (null == dtStart || null == astrTenor) return null; - - int iNumTenor = astrTenor.length; - int[] aiDate = new int[iNumTenor]; - - if (0 == iNumTenor) return null; - - for (int i = 0; i < iNumTenor; ++i) - aiDate[i] = dtStart.addTenor (astrTenor[i]).julian(); - - try { - return CustomSplineTermStructure (strName, dtStart, strCurrency, aiDate, adblImpliedVolatility, - new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (5), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct the Deterministic Volatility Term Structure Instance based off of a Kaklis-Pandelis - * Polynomial Tension Spline - * - * @param strName Name of the the Term Structure Instance - * @param dtStart The Start Date - * @param strCurrency Currency - * @param astrTenor Array of Tenors - * @param adblImpliedVolatility Array of Implied Volatility Nodes - * - * @return The Deterministic Volatility Term Structure Instance based off of a Kaklis-Pandelis Polynomial - * Tension Spline - */ - - public static final org.drip.state.volatility.VolatilityCurve KaklisPandelisTermStructure ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final java.lang.String[] astrTenor, - final double[] adblImpliedVolatility) - { - if (null == dtStart || null == astrTenor) return null; - - int iNumTenor = astrTenor.length; - int[] aiDate = new int[iNumTenor]; - - if (0 == iNumTenor) return null; - - for (int i = 0; i < iNumTenor; ++i) - aiDate[i] = dtStart.addTenor (astrTenor[i]).julian(); - - try { - return CustomSplineTermStructure (strName, dtStart, strCurrency, aiDate, adblImpliedVolatility, - new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KAKLIS_PANDELIS, new - org.drip.spline.basis.KaklisPandelisSetParams (2), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct the Deterministic Volatility Term Structure Instance based off of a KLK Hyperbolic Tension - * Spline - * - * @param strName Name of the the Term Structure Instance - * @param dtStart The Start Date - * @param strCurrency Currency - * @param astrTenor Array of Tenors - * @param adblImpliedVolatility Array of Implied Volatility Nodes - * @param dblTension Tension - * - * @return The Deterministic Volatility Term Structure Instance based off of a KLK Hyperbolic Tension - * Spline - */ - - public static final org.drip.state.volatility.VolatilityCurve KLKHyperbolicTermStructure ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final java.lang.String[] astrTenor, - final double[] adblImpliedVolatility, - final double dblTension) - { - if (null == dtStart || null == astrTenor) return null; - - int iNumTenor = astrTenor.length; - int[] aiDate = new int[iNumTenor]; - - if (0 == iNumTenor) return null; - - for (int i = 0; i < iNumTenor; ++i) - aiDate[i] = dtStart.addTenor (astrTenor[i]).julian(); - - try { - return CustomSplineTermStructure (strName, dtStart, strCurrency, aiDate, adblImpliedVolatility, - new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct the Deterministic Volatility Term Structure Instance based off of a KLK Rational Linear - * Tension Spline - * - * @param strName Name of the the Term Structure Instance - * @param dtStart The Start Date - * @param strCurrency Currency - * @param astrTenor Array of Tenors - * @param adblImpliedVolatility Array of Implied Volatility Nodes - * @param dblTension Tension - * - * @return The Deterministic Volatility Term Structure Instance based off of a KLK Rational Linear - * Tension Spline - */ - - public static final org.drip.state.volatility.VolatilityCurve KLKRationalLinearTermStructure ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final java.lang.String[] astrTenor, - final double[] adblImpliedVolatility, - final double dblTension) - { - if (null == dtStart || null == astrTenor) return null; - - int iNumTenor = astrTenor.length; - int[] aiDate = new int[iNumTenor]; - - if (0 == iNumTenor) return null; - - for (int i = 0; i < iNumTenor; ++i) - aiDate[i] = dtStart.addTenor (astrTenor[i]).julian(); - - try { - return CustomSplineTermStructure (strName, dtStart, strCurrency, aiDate, adblImpliedVolatility, - new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_RATIONAL_LINEAR_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct the Deterministic Volatility Term Structure Instance based off of a KLK Rational Quadratic - * Tension Spline - * - * @param strName Name of the the Term Structure Instance - * @param dtStart The Start Date - * @param strCurrency Currency - * @param astrTenor Array of Tenors - * @param adblImpliedVolatility Array of Implied Volatility Nodes - * @param dblTension Tension - * - * @return The Deterministic Volatility Term Structure Instance based off of a KLK Rational Quadratic - * Tension Spline - */ - - public static final org.drip.state.volatility.VolatilityCurve - KLKRationalQuadraticTermStructure ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final java.lang.String[] astrTenor, - final double[] adblImpliedVolatility, - final double dblTension) - { - if (null == dtStart || null == astrTenor) return null; - - int iNumTenor = astrTenor.length; - int[] aiDate = new int[iNumTenor]; - - if (0 == iNumTenor) return null; - - for (int i = 0; i < iNumTenor; ++i) - aiDate[i] = dtStart.addTenor (astrTenor[i]).julian(); - - try { - return CustomSplineTermStructure (strName, dtStart, strCurrency, aiDate, adblImpliedVolatility, - new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_RATIONAL_QUADRATIC_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct the Flat Constant Forward Volatility Forward Curve - * - * @param iEpochDate Epoch Date - * @param label Forward Volatility Label - * @param strCurrency Currency - * @param dblFlatVolatility Flat Volatility - * - * @return The Volatility Curve Instance - */ - - public static final org.drip.state.volatility.VolatilityCurve FlatForward ( - final int iEpochDate, - final org.drip.state.identifier.VolatilityLabel label, - final java.lang.String strCurrency, - final double dblFlatVolatility) - { - try { - return new org.drip.state.nonlinear.FlatForwardVolatilityCurve (iEpochDate, label, strCurrency, - new int[] {iEpochDate}, new double[] {dblFlatVolatility}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/state/creator/ScenarioDiscountCurveBuilder.java b/org/drip/state/creator/ScenarioDiscountCurveBuilder.java deleted file mode 100644 index 0f5fe62..0000000 --- a/org/drip/state/creator/ScenarioDiscountCurveBuilder.java +++ /dev/null @@ -1,1362 +0,0 @@ - -package org.drip.state.creator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * ScenarioDiscountCurveBuilder implements the the construction of the scenario discount curve using the input - * discount curve instruments, and a wide variety of custom builds. It implements the following - * functionality: - * - Non-linear Custom Discount Curve - * - Shape Preserving Discount Curve Builds - Standard Cubic Polynomial/Cubic KLK Hyperbolic Tension, and - * other Custom Builds - * - Smoothing Local/Control Custom Build - DC/Forward/Zero Rate LSQM's - * - "Industry Standard Methodologies" - DENSE/DUALDENSE/CUSTOMDENSE and Hagan-West Forward Interpolator - * Schemes - * - * @author Lakshmi Krishnamurthy - */ - -public class ScenarioDiscountCurveBuilder { - static class CompQuote { - double _dblQuote = java.lang.Double.NaN; - org.drip.product.definition.CalibratableComponent _comp = null; - - CompQuote ( - final org.drip.product.definition.CalibratableComponent comp, - final double dblQuote) - { - _comp = comp; - _dblQuote = dblQuote; - } - } - - private static final boolean s_bBlog = false; - - private static final CompQuote[] CompQuote ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final java.lang.String strCurrency, - final org.drip.analytics.date.JulianDate dtEffective, - final org.drip.analytics.date.JulianDate dtInitialMaturity, - final org.drip.analytics.date.JulianDate dtTerminalMaturity, - final java.lang.String strTenor, - final boolean bIsIRS) - { - java.util.List lsCalibQuote = new java.util.ArrayList(); - - java.util.List lsCompDENSE = new - java.util.ArrayList(); - - org.drip.analytics.date.JulianDate dtMaturity = dtInitialMaturity; - - while (dtMaturity.julian() <= dtTerminalMaturity.julian()) { - try { - org.drip.product.definition.CalibratableComponent comp = null; - - if (bIsIRS) { - java.lang.String strMaturityTenor = ((int) ((dtMaturity.julian() - dtEffective.julian()) - * 12 / 365.25)) + "M"; - - org.drip.market.otc.FixedFloatSwapConvention ffConv = - org.drip.market.otc.IBORFixedFloatContainer.ConventionFromJurisdiction (strCurrency, - "ALL", strMaturityTenor, "MAIN"); - - if (null == ffConv) return null; - - comp = ffConv.createFixFloatComponent (dtEffective, strMaturityTenor, 0., 0., 1.); - } else { - org.drip.param.period.ComposableFloatingUnitSetting cfusDeposit = new - org.drip.param.period.ComposableFloatingUnitSetting ("3M", - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE, - null, org.drip.state.identifier.ForwardLabel.Standard (strCurrency + "-3M"), - org.drip.analytics.support.CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE, - 0.); - - org.drip.param.period.CompositePeriodSetting cpsDeposit = new - org.drip.param.period.CompositePeriodSetting (4, "3M", strCurrency, null, 1., null, - null, null, null); - - comp = new org.drip.product.rates.SingleStreamComponent ("DEPOSIT_" + dtMaturity, new - org.drip.product.rates.Stream - (org.drip.analytics.support.CompositePeriodBuilder.FloatingCompositeUnit - (org.drip.analytics.support.CompositePeriodBuilder.EdgePair (dtEffective, - dtMaturity), cpsDeposit, cfusDeposit)), null); - } - - lsCompDENSE.add (comp); - - lsCalibQuote.add (comp.measureValue (valParams, null, csqs, null, "Rate")); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (null == (dtMaturity = dtMaturity.addTenorAndAdjust (strTenor, strCurrency))) return null; - } - - int iNumDENSEComp = lsCompDENSE.size(); - - if (0 == iNumDENSEComp) return null; - - CompQuote[] aCQ = new CompQuote[iNumDENSEComp]; - - for (int i = 0; i < iNumDENSEComp; ++i) - aCQ[i] = new CompQuote (lsCompDENSE.get (i), lsCalibQuote.get (i)); - - return aCQ; - } - - /** - * Create an DiscountCurveScenarioContainer Instance from the currency and the array of the calibration - * instruments - * - * @param strCurrency Currency - * @param aCalibInst Array of the calibration instruments - * - * @return The DiscountCurveScenarioContainer instance - */ - - public static final org.drip.param.market.DiscountCurveScenarioContainer FromIRCSG ( - final java.lang.String strCurrency, - final org.drip.product.definition.CalibratableComponent[] aCalibInst) - { - try { - return new org.drip.param.market.DiscountCurveScenarioContainer (aCalibInst); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create Discount Curve from the Calibration Instruments - * - * @param dt Valuation Date - * @param strCurrency Currency - * @param aCalibInst Input Calibration Instruments - * @param adblCalibQuote Input Calibration Quotes - * @param astrCalibMeasure Input Calibration Measures - * @param lsfc Latent State Fixings Container - * - * @return The Calibrated Discount Curve - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve NonlinearBuild ( - final org.drip.analytics.date.JulianDate dt, - final java.lang.String strCurrency, - final org.drip.product.definition.CalibratableComponent[] aCalibInst, - final double[] adblCalibQuote, - final java.lang.String[] astrCalibMeasure, - final org.drip.param.market.LatentStateFixingsContainer lsfc) - { - return null == dt ? null : org.drip.state.boot.DiscountCurveScenario.Standard - (org.drip.param.valuation.ValuationParams.Spot (dt.julian()), aCalibInst, adblCalibQuote, - astrCalibMeasure, 0., null, lsfc, null); - } - - /** - * Build the Shape Preserving Discount Curve using the Custom Parameters - * - * @param strCurrency Currency - * @param llsc The Linear Latent State Calibrator Instance - * @param aStretchSpec Array of the Instrument Representation Stretches - * @param valParam Valuation Parameters - * @param pricerParam Pricer Parameters - * @param csqs Market Parameters - * @param quotingParam Quoting Parameters - * @param dblEpochResponse The Starting Response Value - * - * @return Instance of the Shape Preserving Discount Curve - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve ShapePreservingDFBuild ( - final java.lang.String strCurrency, - final org.drip.state.inference.LinearLatentStateCalibrator llsc, - final org.drip.state.inference.LatentStateStretchSpec[] aStretchSpec, - final org.drip.param.valuation.ValuationParams valParam, - final org.drip.param.pricer.CreditPricerParams pricerParam, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParam, - final double dblEpochResponse) - { - if (null == llsc) return null; - - try { - org.drip.spline.grid.Span spanDF = llsc.calibrateSpan (aStretchSpec, dblEpochResponse, valParam, - pricerParam, quotingParam, csqs); - - if (null == spanDF) return null; - - org.drip.state.curve.DiscountFactorDiscountCurve dcdf = new - org.drip.state.curve.DiscountFactorDiscountCurve (strCurrency, spanDF); - - return dcdf.setCCIS (new org.drip.analytics.input.LatentStateShapePreservingCCIS (llsc, - aStretchSpec, valParam, pricerParam, quotingParam, csqs)) ? dcdf : null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Build a Globally Smoothed Instance of the Discount Curve using the Custom Parameters - * - * @param dcShapePreserver Instance of the Shape Preserving Discount Curve - * @param llsc The Linear Latent State Calibrator Instance - * @param gccp Global Smoothing Curve Control Parameters - * @param valParam Valuation Parameters - * @param pricerParam Pricer Parameters - * @param csqs Market Parameters - * @param quotingParam Quoting Parameters - * - * @return Globally Smoothed Instance of the Discount Curve - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve SmoothingGlobalControlBuild ( - final org.drip.state.discount.MergedDiscountForwardCurve dcShapePreserver, - final org.drip.state.inference.LinearLatentStateCalibrator llsc, - final org.drip.state.estimator.GlobalControlCurveParams gccp, - final org.drip.param.valuation.ValuationParams valParam, - final org.drip.param.pricer.CreditPricerParams pricerParam, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParam) - { - if (null == dcShapePreserver) return null; - - if (null == gccp) return dcShapePreserver; - - java.lang.String strSmootheningQM = gccp.smootheningQuantificationMetric(); - - java.util.Map mapQMTruth = dcShapePreserver.canonicalTruthness - (strSmootheningQM); - - if (null == mapQMTruth) return null; - - int iTruthSize = mapQMTruth.size(); - - if (0 == iTruthSize) return null; - - java.util.Set> esQMTruth = - mapQMTruth.entrySet(); - - if (null == esQMTruth || 0 == esQMTruth.size()) return null; - - java.lang.String strName = dcShapePreserver.label().fullyQualifiedName(); - - int i = 0; - int[] aiDate = new int[iTruthSize]; - double[] adblQM = new double[iTruthSize]; - org.drip.spline.params.SegmentCustomBuilderControl[] aPRBP = new - org.drip.spline.params.SegmentCustomBuilderControl[iTruthSize - 1]; - - for (java.util.Map.Entry meQMTruth : esQMTruth) { - if (null == meQMTruth) return null; - - if (0 != i) aPRBP[i - 1] = gccp.defaultSegmentBuilderControl(); - - aiDate[i] = meQMTruth.getKey(); - - adblQM[i++] = meQMTruth.getValue(); - - if (s_bBlog) - System.out.println ("\t\t" + new org.drip.analytics.date.JulianDate (meQMTruth.getKey()) + - " = " + meQMTruth.getValue()); - } - - try { - org.drip.spline.stretch.MultiSegmentSequence stretch = - org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - (strName + "_STRETCH", aiDate, adblQM, aPRBP, gccp.bestFitWeightedResponse(), - gccp.calibrationBoundaryCondition(), gccp.calibrationDetail()); - - org.drip.state.discount.MergedDiscountForwardCurve dcMultiPass = null; - - if (org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR.equalsIgnoreCase - (strSmootheningQM)) - dcMultiPass = new org.drip.state.curve.DiscountFactorDiscountCurve (strName, new - org.drip.spline.grid.OverlappingStretchSpan (stretch)); - else if - (org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE.equalsIgnoreCase - (strSmootheningQM)) - dcMultiPass = new org.drip.state.curve.ZeroRateDiscountCurve (strName, new - org.drip.spline.grid.OverlappingStretchSpan (stretch)); - - return dcMultiPass; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Build a Locally Smoothed Instance of the Discount Curve using the Custom Parameters - * - * @param dcShapePreserver Instance of the Shape Preserving Discount Curve - * @param llsc The Linear Latent State Calibrator Instance - * @param lccp Local Smoothing Curve Control Parameters - * @param valParam Valuation Parameters - * @param pricerParam Pricer Parameters - * @param csqs Market Parameters - * @param quotingParam Quoting Parameters - * - * @return Locally Smoothed Instance of the Discount Curve - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve SmoothingLocalControlBuild ( - final org.drip.state.discount.MergedDiscountForwardCurve dcShapePreserver, - final org.drip.state.inference.LinearLatentStateCalibrator llsc, - final org.drip.state.estimator.LocalControlCurveParams lccp, - final org.drip.param.valuation.ValuationParams valParam, - final org.drip.param.pricer.CreditPricerParams pricerParam, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParam) - { - if (null == dcShapePreserver) return null; - - if (null == lccp) return dcShapePreserver; - - java.lang.String strSmootheningQM = lccp.smootheningQuantificationMetric(); - - java.util.Map mapQMTruth = dcShapePreserver.canonicalTruthness - (strSmootheningQM); - - if (null == mapQMTruth) return null; - - int iTruthSize = mapQMTruth.size(); - - if (0 == iTruthSize) return null; - - java.util.Set> esQMTruth = - mapQMTruth.entrySet(); - - if (null == esQMTruth || 0 == esQMTruth.size()) return null; - - java.lang.String strName = dcShapePreserver.label().fullyQualifiedName(); - - int i = 0; - int[] aiDate = new int[iTruthSize]; - double[] adblQM = new double[iTruthSize]; - org.drip.spline.params.SegmentCustomBuilderControl[] aPRBP = new - org.drip.spline.params.SegmentCustomBuilderControl[iTruthSize - 1]; - - for (java.util.Map.Entry meQMTruth : esQMTruth) { - if (null == meQMTruth) return null; - - if (0 != i) aPRBP[i - 1] = lccp.defaultSegmentBuilderControl(); - - aiDate[i] = meQMTruth.getKey(); - - adblQM[i++] = meQMTruth.getValue(); - - if (s_bBlog) - System.out.println ("\t\t" + new org.drip.analytics.date.JulianDate (meQMTruth.getKey()) + - " = " + meQMTruth.getValue()); - } - - try { - org.drip.spline.pchip.LocalMonotoneCkGenerator lcr = - org.drip.spline.pchip.LocalMonotoneCkGenerator.Create (aiDate, adblQM, - lccp.C1GeneratorScheme(), lccp.eliminateSpuriousExtrema(), lccp.applyMonotoneFilter()); - - if (null == lcr) return null; - - org.drip.spline.stretch.MultiSegmentSequence stretch = - org.drip.spline.pchip.LocalControlStretchBuilder.CustomSlopeHermiteSpline (strName + - "_STRETCH", aiDate, adblQM, lcr.C1(), aPRBP, lccp.bestFitWeightedResponse(), - lccp.calibrationDetail()); - - org.drip.state.discount.MergedDiscountForwardCurve dcMultiPass = null; - - if (org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR.equalsIgnoreCase - (strSmootheningQM)) - dcMultiPass = new org.drip.state.curve.DiscountFactorDiscountCurve (strName, new - org.drip.spline.grid.OverlappingStretchSpan (stretch)); - else if - (org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE.equalsIgnoreCase - (strSmootheningQM)) - dcMultiPass = new org.drip.state.curve.ZeroRateDiscountCurve (strName, new - org.drip.spline.grid.OverlappingStretchSpan (stretch)); - - return dcMultiPass; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an instance of the Shape Preserver of the desired basis type, using the specified basis set - * builder parameters. - * - * @param strName Curve Name - * @param valParams Valuation Parameters - * @param pricerParam Pricer Parameters - * @param csqs Market Parameters - * @param quotingParam Quoting Parameters - * @param strBasisType The Basis Type - * @param fsbp The Function Set Basis Parameters - * @param aCalibComp1 Array of Calibration Components #1 - * @param adblQuote1 Array of Calibration Quotes #1 - * @param astrManifestMeasure1 Array of Manifest Measures for component Array #1 - * @param aCalibComp2 Array of Calibration Components #2 - * @param adblQuote2 Array of Calibration Quotes #2 - * @param astrManifestMeasure2 Array of Manifest Measures for component Array #2 - * @param dblEpochResponse The Stretch Start DF - * @param bZeroSmooth TRUE - Turn on the Zero Rate Smoothing - * - * @return Instance of the Shape Preserver of the desired basis type - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve DFRateShapePreserver ( - final java.lang.String strName, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParam, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParam, - final java.lang.String strBasisType, - final org.drip.spline.basis.FunctionSetBuilderParams fsbp, - final org.drip.product.definition.CalibratableComponent[] aCalibComp1, - final double[] adblQuote1, - final java.lang.String[] astrManifestMeasure1, - final org.drip.product.definition.CalibratableComponent[] aCalibComp2, - final double[] adblQuote2, - final java.lang.String[] astrManifestMeasure2, - final double dblEpochResponse, - final boolean bZeroSmooth) - { - if (null == strName || strName.isEmpty() || null == strBasisType || strBasisType.isEmpty() || null == - valParams || null == fsbp) - return null; - - int iNumQuote1 = null == adblQuote1 ? 0 : adblQuote1.length; - int iNumQuote2 = null == adblQuote2 ? 0 : adblQuote2.length; - int iNumComp1 = null == aCalibComp1 ? 0 : aCalibComp1.length; - int iNumComp2 = null == aCalibComp2 ? 0 : aCalibComp2.length; - org.drip.state.estimator.LocalControlCurveParams lccp = null; - org.drip.state.inference.LinearLatentStateCalibrator llsc = null; - org.drip.state.inference.LatentStateStretchSpec stretchSpec1 = null; - org.drip.state.inference.LatentStateStretchSpec stretchSpec2 = null; - org.drip.state.representation.LatentStateSpecification[] aLSS = null; - org.drip.state.inference.LatentStateStretchSpec[] aStretchSpec = null; - org.drip.state.representation.LatentStateSpecification lssFunding = null; - org.drip.state.discount.MergedDiscountForwardCurve dcShapePreserving = null; - int iNumManifestMeasures1 = null == astrManifestMeasure1 ? 0 : astrManifestMeasure1.length; - int iNumManifestMeasures2 = null == astrManifestMeasure2 ? 0 : astrManifestMeasure2.length; - org.drip.analytics.support.CaseInsensitiveTreeMap - mapForwardLabel = null; - - if ((0 == iNumComp1 && 0 == iNumComp2) || iNumComp1 != iNumQuote1 || iNumComp2 != iNumQuote2 || - iNumComp1 != iNumManifestMeasures1 || iNumComp2 != iNumManifestMeasures2) - return null; - - java.lang.String strCurrency = (0 == iNumComp1 ? aCalibComp2 : aCalibComp1)[0].payCurrency(); - - try { - lssFunding = new org.drip.state.representation.LatentStateSpecification - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_FUNDING, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR, - org.drip.state.identifier.FundingLabel.Standard (strCurrency)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (0 != iNumComp1) mapForwardLabel = aCalibComp1[0].forwardLabel(); - - if (null == mapForwardLabel && 0 != iNumComp2) mapForwardLabel = aCalibComp2[0].forwardLabel(); - - if (null == mapForwardLabel || 0 == mapForwardLabel.size()) - aLSS = new org.drip.state.representation.LatentStateSpecification[] {lssFunding}; - else { - try { - aLSS = new org.drip.state.representation.LatentStateSpecification[] {lssFunding, new - org.drip.state.representation.LatentStateSpecification - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_FORWARD, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_FORWARD_RATE, - mapForwardLabel.get ("DERIVED"))}; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - if (0 != iNumComp1) { - org.drip.state.inference.LatentStateSegmentSpec[] aSegmentSpec = new - org.drip.state.inference.LatentStateSegmentSpec[iNumComp1]; - - try { - for (int i = 0; i < iNumComp1; ++i) { - org.drip.product.calib.ProductQuoteSet pqs = aCalibComp1[i].calibQuoteSet (aLSS); - - if (null == pqs || !pqs.set (astrManifestMeasure1[i], adblQuote1[i])) return null; - - aSegmentSpec[i] = new org.drip.state.inference.LatentStateSegmentSpec (aCalibComp1[i], - pqs); - } - - stretchSpec1 = new org.drip.state.inference.LatentStateStretchSpec (strName + "_COMP1", - aSegmentSpec); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - if (0 != iNumComp2) { - org.drip.state.inference.LatentStateSegmentSpec[] aSegmentSpec = new - org.drip.state.inference.LatentStateSegmentSpec[iNumComp2]; - - try { - for (int i = 0; i < iNumComp2; ++i) { - org.drip.product.calib.ProductQuoteSet pqs = aCalibComp2[i].calibQuoteSet (aLSS); - - if (null == pqs || !pqs.set (astrManifestMeasure2[i], adblQuote2[i])) return null; - - aSegmentSpec[i] = new org.drip.state.inference.LatentStateSegmentSpec (aCalibComp2[i], - pqs); - } - - stretchSpec2 = new org.drip.state.inference.LatentStateStretchSpec (strName + "_COMP2", - aSegmentSpec); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - if (null == stretchSpec1 && null == stretchSpec2) return null; - - if (null == stretchSpec1) - aStretchSpec = new org.drip.state.inference.LatentStateStretchSpec[] {stretchSpec2}; - else if (null == stretchSpec2) - aStretchSpec = new org.drip.state.inference.LatentStateStretchSpec[] {stretchSpec1}; - else - aStretchSpec = new org.drip.state.inference.LatentStateStretchSpec[] {stretchSpec1, - stretchSpec2}; - - try { - llsc = new org.drip.state.inference.LinearLatentStateCalibrator (new - org.drip.spline.params.SegmentCustomBuilderControl (strBasisType, fsbp, - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), new - org.drip.spline.params.ResponseScalingShapeControl (true, new - org.drip.function.r1tor1.QuadraticRationalShapeControl (0.)), null), - org.drip.spline.stretch.BoundarySettings.NaturalStandard(), - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE, null, null); - - dcShapePreserving = ShapePreservingDFBuild (strCurrency, llsc, aStretchSpec, valParams, - pricerParam, csqs, quotingParam, dblEpochResponse); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (!bZeroSmooth) return dcShapePreserving; - - try { - lccp = new org.drip.state.estimator.LocalControlCurveParams - (org.drip.spline.pchip.LocalMonotoneCkGenerator.C1_HYMAN83, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (4), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), new - org.drip.spline.params.ResponseScalingShapeControl (true, new - org.drip.function.r1tor1.QuadraticRationalShapeControl (0.)), - null), - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE, - null, null, true, true); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return SmoothingLocalControlBuild (dcShapePreserving, llsc, lccp, valParams, null, null, null); - } - - /** - * Construct an instance of the Shape Preserver of the KLK Hyperbolic Tension Type, using the specified - * basis set builder parameters. - * - * @param strName Curve Name - * @param valParams Valuation Parameters - * @param aCalibComp1 Array of Calibration Components #1 - * @param adblQuote1 Array of Calibration Quotes #1 - * @param astrManifestMeasure1 Array of Manifest Measures for component Array #1 - * @param aCalibComp2 Array of Calibration Components #2 - * @param adblQuote2 Array of Calibration Quotes #2 - * @param astrManifestMeasure2 Array of Manifest Measures for component Array #2 - * @param bZeroSmooth TRUE - Turn on the Zero Rate Smoothing - * - * @return Instance of the Shape Preserver of the desired basis type - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve CubicKLKHyperbolicDFRateShapePreserver ( - final java.lang.String strName, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.product.definition.CalibratableComponent[] aCalibComp1, - final double[] adblQuote1, - final java.lang.String[] astrManifestMeasure1, - final org.drip.product.definition.CalibratableComponent[] aCalibComp2, - final double[] adblQuote2, - final java.lang.String[] astrManifestMeasure2, - final boolean bZeroSmooth) - { - try { - return DFRateShapePreserver (strName, valParams, null, null, null, - org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, new - org.drip.spline.basis.ExponentialTensionSetParams (1.), aCalibComp1, adblQuote1, - astrManifestMeasure1, aCalibComp2, adblQuote2, astrManifestMeasure2, 1., - bZeroSmooth); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an instance of the Shape Preserver of the Cubic Polynomial Type, using the specified - * basis set builder parameters. - * - * @param strName Curve Name - * @param valParams Valuation Parameters - * @param aCalibComp1 Array of Calibration Components #1 - * @param adblQuote1 Array of Calibration Quotes #1 - * @param astrManifestMeasure1 Array of Manifest Measures for component Array #1 - * @param aCalibComp2 Array of Calibration Components #2 - * @param adblQuote2 Array of Calibration Quotes #2 - * @param astrManifestMeasure2 Array of Manifest Measures for component Array #2 - * @param bZeroSmooth TRUE - Turn on the Zero Rate Smoothing - * - * @return Instance of the Shape Preserver of the desired basis type - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve CubicPolyDFRateShapePreserver ( - final java.lang.String strName, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.product.definition.CalibratableComponent[] aCalibComp1, - final double[] adblQuote1, - final java.lang.String[] astrManifestMeasure1, - final org.drip.product.definition.CalibratableComponent[] aCalibComp2, - final double[] adblQuote2, - final java.lang.String[] astrManifestMeasure2, - final boolean bZeroSmooth) - { - try { - return DFRateShapePreserver (strName, valParams, null, null, null, - org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (4), aCalibComp1, adblQuote1, - astrManifestMeasure1, aCalibComp2, adblQuote2, astrManifestMeasure2, 1., - bZeroSmooth); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Customizable DENSE Curve Creation Methodology - the references are: - * - * - Sankar, L. (1997): OFUTS – An Alternative Yield Curve Interpolator F. A. S. T. Research - * Documentation Bear Sterns. - * - * - Nahum, E. (2004): Changes to Yield Curve Construction – Linear Stripping of the Short End of the - * Curve F. A. S. T. Research Documentation Bear Sterns. - * - * - Kinlay, J., and X. Bai (2009): Yield Curve Construction Models – Tools and Techniques - * (http://www.jonathankinlay.com/Articles/Yield Curve Construction Models.pdf) - * - * @param strName The Curve Name - * @param valParams Valuation Parameters - * @param aCalibComp1 Array of Stretch #1 Calibration Components - * @param adblQuote1 Array of Stretch #1 Calibration Quotes - * @param strTenor1 Stretch #1 Instrument set re-construction Tenor - * @param astrManifestMeasure1 Array of Manifest Measures for component Array #1 - * @param aCalibComp2 Array of Stretch #2 Calibration Components - * @param adblQuote2 Array of Stretch #2 Calibration Quotes - * @param strTenor2 Stretch #2 Instrument set re-construction Tenor - * @param astrManifestMeasure2 Array of Manifest Measures for component Array #2 - * @param tldf The Turns List - * - * @return The Customized DENSE Curve. - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve CustomDENSE ( - final java.lang.String strName, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.product.definition.CalibratableComponent[] aCalibComp1, - final double[] adblQuote1, - final java.lang.String strTenor1, - final java.lang.String[] astrManifestMeasure1, - final org.drip.product.definition.CalibratableComponent[] aCalibComp2, - final double[] adblQuote2, - final java.lang.String strTenor2, - final java.lang.String[] astrManifestMeasure2, - final org.drip.state.discount.TurnListDiscountFactor tldf) - { - org.drip.state.discount.MergedDiscountForwardCurve dcShapePreserver = CubicKLKHyperbolicDFRateShapePreserver - (strName, valParams, aCalibComp1, adblQuote1, astrManifestMeasure1, aCalibComp2, adblQuote2, - astrManifestMeasure2, false); - - if (null == dcShapePreserver || (null != tldf && !dcShapePreserver.setTurns (tldf))) return null; - - org.drip.param.market.CurveSurfaceQuoteContainer csqs = org.drip.param.creator.MarketParamsBuilder.Create - (dcShapePreserver, null, null, null, null, null, null); - - if (null == csqs) return null; - - CompQuote[] aCQ1 = null; - - java.lang.String strCurrency = aCalibComp1[0].payCurrency(); - - if (null == strTenor1 || strTenor1.isEmpty()) { - if (null != aCalibComp1) { - int iNumComp1 = aCalibComp1.length; - - if (0 != iNumComp1) { - aCQ1 = new CompQuote[iNumComp1]; - - for (int i = 0; i < iNumComp1; ++i) - aCQ1[i] = new CompQuote (aCalibComp1[i], adblQuote1[i]); - } - } - } else - aCQ1 = CompQuote (valParams, csqs, strCurrency, aCalibComp1[0].effectiveDate(), - aCalibComp1[0].maturityDate(), aCalibComp1[aCalibComp1.length - 1].maturityDate(), strTenor1, - false); - - if (null == strTenor2 || strTenor2.isEmpty()) return dcShapePreserver; - - CompQuote[] aCQ2 = CompQuote (valParams, csqs, strCurrency, aCalibComp2[0].effectiveDate(), - aCalibComp2[0].maturityDate(), aCalibComp2[aCalibComp2.length - 1].maturityDate(), strTenor2, - true); - - int iNumDENSEComp1 = null == aCQ1 ? 0 : aCQ1.length; - int iNumDENSEComp2 = null == aCQ2 ? 0 : aCQ2.length; - int iTotalNumDENSEComp = iNumDENSEComp1 + iNumDENSEComp2; - - if (0 == iTotalNumDENSEComp) return null; - - double[] adblCalibQuote = new double[iTotalNumDENSEComp]; - java.lang.String[] astrCalibMeasure = new java.lang.String[iTotalNumDENSEComp]; - org.drip.product.definition.CalibratableComponent[] aCalibComp = new - org.drip.product.definition.CalibratableComponent[iTotalNumDENSEComp]; - - for (int i = 0; i < iNumDENSEComp1; ++i) { - astrCalibMeasure[i] = "Rate"; - aCalibComp[i] = aCQ1[i]._comp; - adblCalibQuote[i] = aCQ1[i]._dblQuote; - } - - for (int i = iNumDENSEComp1; i < iTotalNumDENSEComp; ++i) { - astrCalibMeasure[i] = "Rate"; - aCalibComp[i] = aCQ2[i - iNumDENSEComp1]._comp; - adblCalibQuote[i] = aCQ2[i - iNumDENSEComp1]._dblQuote; - } - - try { - return ScenarioDiscountCurveBuilder.NonlinearBuild (new org.drip.analytics.date.JulianDate - (valParams.valueDate()), strCurrency, aCalibComp, adblCalibQuote, astrCalibMeasure, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * The Standard DENSE Curve Creation Methodology - this uses no re-construction set for the short term, - * and uses 3M dense re-construction for the Swap Set. The references are: - * - * - Sankar, L. (1997): OFUTS – An Alternative Yield Curve Interpolator F. A. S. T. Research - * Documentation Bear Sterns. - * - * - Nahum, E. (2004): Changes to Yield Curve Construction – Linear Stripping of the Short End of the - * Curve F. A. S. T. Research Documentation Bear Sterns. - * - * - Kinlay, J., and X. Bai (2009): Yield Curve Construction Models – Tools and Techniques - * (http://www.jonathankinlay.com/Articles/Yield Curve Construction Models.pdf) - * - * @param strName The Curve Name - * @param valParams Valuation Parameters - * @param aCalibComp1 Array of Stretch #1 Calibration Components - * @param adblQuote1 Array of Stretch #1 Calibration Quotes - * @param astrManifestMeasure1 Array of Manifest Measures for component Array #1 - * @param aCalibComp2 Array of Stretch #2 Calibration Components - * @param adblQuote2 Array of Stretch #2 Calibration Quotes - * @param astrManifestMeasure2 Array of Manifest Measures for component Array #2 - * @param tldf The Turns List - * - * @return The Customized DENSE Curve. - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve DENSE ( - final java.lang.String strName, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.product.definition.CalibratableComponent[] aCalibComp1, - final double[] adblQuote1, - final java.lang.String[] astrManifestMeasure1, - final org.drip.product.definition.CalibratableComponent[] aCalibComp2, - final double[] adblQuote2, - final java.lang.String[] astrManifestMeasure2, - final org.drip.state.discount.TurnListDiscountFactor tldf) - { - return CustomDENSE (strName, valParams, aCalibComp1, adblQuote1, null, astrManifestMeasure1, - aCalibComp2, adblQuote2, "3M", astrManifestMeasure2, tldf); - } - - /** - * The DUAL DENSE Curve Creation Methodology - this uses configurable re-construction set for the short - * term, and another configurable re-construction for the Swap Set. 1D re-construction tenor for the - * short end will result in CDF (Constant Daily Forward) Discount Curve. The references are: - * - * - Sankar, L. (1997): OFUTS – An Alternative Yield Curve Interpolator F. A. S. T. Research - * Documentation Bear Sterns. - * - * - Nahum, E. (2004): Changes to Yield Curve Construction – Linear Stripping of the Short End of the - * Curve F. A. S. T. Research Documentation Bear Sterns. - * - * - Kinlay, J., and X. Bai (2009): Yield Curve Construction Models – Tools and Techniques - * (http://www.jonathankinlay.com/Articles/Yield Curve Construction Models.pdf) - * - * @param strName The Curve Name - * @param valParams Valuation Parameters - * @param aCalibComp1 Array of Stretch #1 Calibration Components - * @param adblQuote1 Array of Stretch #1 Calibration Quotes - * @param strTenor1 Stretch #1 Instrument set re-construction Tenor - * @param astrManifestMeasure1 Array of Manifest Measures for component Array #1 - * @param aCalibComp2 Array of Stretch #2 Calibration Components - * @param adblQuote2 Array of Stretch #2 Calibration Quotes - * @param strTenor2 Stretch #2 Instrument set re-construction Tenor - * @param astrManifestMeasure2 Array of Manifest Measures for component Array #2 - * @param tldf The Turns List - * - * @return The Customized DENSE Curve. - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve DUALDENSE ( - final java.lang.String strName, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.product.definition.CalibratableComponent[] aCalibComp1, - final double[] adblQuote1, - final java.lang.String strTenor1, - final java.lang.String[] astrManifestMeasure1, - final org.drip.product.definition.CalibratableComponent[] aCalibComp2, - final double[] adblQuote2, - final java.lang.String strTenor2, - final java.lang.String[] astrManifestMeasure2, - final org.drip.state.discount.TurnListDiscountFactor tldf) - { - return CustomDENSE (strName, valParams, aCalibComp1, adblQuote1, strTenor1, astrManifestMeasure1, - aCalibComp2, adblQuote2, strTenor2, astrManifestMeasure2, tldf); - } - - /** - * Create an Instance of the Custom Splined Discount Curve - * - * @param strName Curve Name - * @param dtStart Tenor Start Date - * @param strCurrency The Currency - * @param aiDate Array of Dates - * @param adblDF Array of Discount Factors - * @param scbc The Segment Custom Builder Control - * - * @return The Instance of the Basis Curve - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve CustomSplineDiscountCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final int[] aiDate, - final double[] adblDF, - final org.drip.spline.params.SegmentCustomBuilderControl scbc) - { - if (null == strName || strName.isEmpty() || null == aiDate || null == dtStart) return null; - - int iNumDate = aiDate.length; - - if (0 == iNumDate) return null; - - double[] adblResponseValue = new double[iNumDate + 1]; - double[] adblPredictorOrdinate = new double[iNumDate + 1]; - org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC = new - org.drip.spline.params.SegmentCustomBuilderControl[iNumDate]; - - for (int i = 0; i <= iNumDate; ++i) { - adblPredictorOrdinate[i] = 0 == i ? dtStart.julian() : aiDate[i - 1]; - - adblResponseValue[i] = 0 == i ? 1. : adblDF[i - 1]; - - if (0 != i) aSCBC[i - 1] = scbc; - } - - try { - return new org.drip.state.curve.DiscountFactorDiscountCurve (strCurrency, new - org.drip.spline.grid.OverlappingStretchSpan - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - (strName, adblPredictorOrdinate, adblResponseValue, aSCBC, null, - org.drip.spline.stretch.BoundarySettings.NaturalStandard(), - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the Cubic Polynomial Splined DF Discount Curve - * - * @param strName Curve Name - * @param dtStart Tenor Start Date - * @param strCurrency The Currency - * @param aiDate Array of Dates - * @param adblDF Array of Discount Factors - * - * @return The Instance of the Discount Curve - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve CubicPolynomialDiscountCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final int[] aiDate, - final double[] adblDF) - { - try { - return CustomSplineDiscountCurve (strName, dtStart, strCurrency, aiDate, adblDF, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (4), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the Quartic Polynomial Splined DF Discount Curve - * - * @param strName Curve Name - * @param dtStart Tenor Start Date - * @param strCurrency The Currency - * @param aiDate Array of Dates - * @param adblDF Array of Discount Factors - * - * @return The Instance of the Discount Curve - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve QuarticPolynomialDiscountCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final int[] aiDate, - final double[] adblDF) - { - try { - return CustomSplineDiscountCurve (strName, dtStart, strCurrency, aiDate, adblDF, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (5), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the Kaklis-Pandelis Splined DF Discount Curve - * - * @param strName Curve Name - * @param dtStart Tenor Start Date - * @param strCurrency The Currency - * @param aiDate Array of Dates - * @param adblDF Array of Discount Factors - * - * @return The Instance of the Discount Curve - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve KaklisPandelisDiscountCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final int[] aiDate, - final double[] adblDF) - { - try { - return CustomSplineDiscountCurve (strName, dtStart, strCurrency, aiDate, adblDF, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KAKLIS_PANDELIS, new - org.drip.spline.basis.KaklisPandelisSetParams (2), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the KLK Hyperbolic Splined DF Discount Curve - * - * @param strName Curve Name - * @param dtStart Tenor Start Date - * @param strCurrency The Currency - * @param aiDate Array of Dates - * @param adblDF Array of Discount Factors - * @param dblTension The Tension Parameter - * - * @return The Instance of the Discount Curve - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve KLKHyperbolicDiscountCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final int[] aiDate, - final double[] adblDF, - final double dblTension) - { - try { - return CustomSplineDiscountCurve (strName, dtStart, strCurrency, aiDate, adblDF, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the KLK Exponential Splined DF Discount Curve - * - * @param strName Curve Name - * @param dtStart Tenor Start Date - * @param strCurrency The Currency - * @param aiDate Array of Dates - * @param adblDF Array of Discount Factors - * @param dblTension The Tension Parameter - * - * @return The Instance of the Discount Curve - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve KLKExponentialDiscountCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final int[] aiDate, - final double[] adblDF, - final double dblTension) - { - try { - return CustomSplineDiscountCurve (strName, dtStart, strCurrency, aiDate, adblDF, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_EXPONENTIAL_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the KLK Linear Rational Splined DF Discount Curve - * - * @param strName Curve Name - * @param dtStart Tenor Start Date - * @param strCurrency The Currency - * @param aiDate Array of Dates - * @param adblDF Array of Discount Factors - * @param dblTension The Tension Parameter - * - * @return The Instance of the Discount Curve - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve KLKRationalLinearDiscountCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final int[] aiDate, - final double[] adblDF, - final double dblTension) - { - try { - return CustomSplineDiscountCurve (strName, dtStart, strCurrency, aiDate, adblDF, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_RATIONAL_LINEAR_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the KLK Quadratic Rational Splined DF Discount Curve - * - * @param strName Curve Name - * @param dtStart Tenor Start Date - * @param strCurrency The Currency - * @param aiDate Array of Dates - * @param adblDF Array of Discount Factors - * @param dblTension The Tension Parameter - * - * @return The Instance of the Discount Curve - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve KLKRationalQuadraticDiscountCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final int[] aiDate, - final double[] adblDF, - final double dblTension) - { - try { - return CustomSplineDiscountCurve (strName, dtStart, strCurrency, aiDate, adblDF, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_RATIONAL_QUADRATIC_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Build a Discount Curve from an array of discount factors - * - * @param dtStart Start Date - * @param strCurrency Currency - * @param aiDate Array of dates - * @param adblDF array of discount factors - * - * @return Discount Curve - */ - - public static final org.drip.state.discount.MergedDiscountForwardCurve BuildFromDF ( - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final int aiDate[], - final double adblDF[]) - { - if (null == aiDate || 0 == aiDate.length || null == adblDF || aiDate.length != adblDF.length || - null == dtStart || null == strCurrency || strCurrency.isEmpty()) - return null; - - double dblDFBegin = 1.; - double[] adblRate = new double[aiDate.length]; - - double dblPeriodBegin = dtStart.julian(); - - for (int i = 0; i < aiDate.length; ++i) { - if (aiDate[i] <= dblPeriodBegin) return null; - - adblRate[i] = 365.25 / (aiDate[i] - dblPeriodBegin) * java.lang.Math.log (dblDFBegin / - adblDF[i]); - - dblDFBegin = adblDF[i]; - dblPeriodBegin = aiDate[i]; - } - - try { - return new org.drip.state.nonlinear.FlatForwardDiscountCurve (dtStart, strCurrency, aiDate, - adblRate, false, "", -1); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create a Discount Curve from the Exponentially Compounded Flat Rate - * - * @param dtStart Start Date - * @param strCurrency Currency - * @param dblRate Rate - * - * @return Discount Curve - */ - - public static final org.drip.state.discount.ExplicitBootDiscountCurve ExponentiallyCompoundedFlatRate ( - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final double dblRate) - { - if (null == dtStart) return null; - - try { - return new org.drip.state.nonlinear.FlatForwardDiscountCurve (dtStart, strCurrency, new int[] - {dtStart.julian()}, new double[] {dblRate}, false, "", -1); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create a Discount Curve from the Discretely Compounded Flat Rate - * - * @param dtStart Start Date - * @param strCurrency Currency - * @param dblRate Rate - * @param strCompoundingDayCount Day Count Convention to be used for Discrete Compounding - * @param iCompoundingFreq Frequency to be used for Discrete Compounding - * - * @return Discount Curve - */ - - public static final org.drip.state.discount.ExplicitBootDiscountCurve DiscretelyCompoundedFlatRate ( - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final double dblRate, - final java.lang.String strCompoundingDayCount, - final int iCompoundingFreq) - { - if (null == dtStart) return null; - - try { - return new org.drip.state.nonlinear.FlatForwardDiscountCurve (dtStart, strCurrency, new int[] - {dtStart.julian()}, new double[] {dblRate}, true, strCompoundingDayCount, iCompoundingFreq); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create a Discount Curve from the Flat Yield - * - * @param dtStart Start Date - * @param strCurrency Currency - * @param dblYield Yield - * @param strCompoundingDayCount Day Count Convention to be used for Discrete Compounding - * @param iCompoundingFreq Frequency to be used for Discrete Compounding - * - * @return The Discount Curve Instance - */ - - public static final org.drip.state.discount.ExplicitBootDiscountCurve CreateFromFlatYield ( - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final double dblYield, - final java.lang.String strCompoundingDayCount, - final int iCompoundingFreq) - { - if (null == dtStart || !org.drip.quant.common.NumberUtil.IsValid (dblYield)) return null; - - try { - return new org.drip.state.nonlinear.FlatForwardDiscountCurve (dtStart, strCurrency, new int[] - {dtStart.julian()}, new double[] {dblYield}, true, strCompoundingDayCount, iCompoundingFreq); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create a discount curve from an array of dates/rates - * - * @param dtStart Start Date - * @param strCurrency Currency - * @param aiDate array of dates - * @param adblRate array of rates - * - * @return Creates the discount curve - */ - - public static final org.drip.state.discount.ExplicitBootDiscountCurve PiecewiseForward ( - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final int[] aiDate, - final double[] adblRate) - { - try { - return new org.drip.state.nonlinear.FlatForwardDiscountCurve (dtStart, strCurrency, aiDate, - adblRate, false, "", -1); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/state/creator/ScenarioFXCurveBuilder.java b/org/drip/state/creator/ScenarioFXCurveBuilder.java deleted file mode 100644 index b0638a0..0000000 --- a/org/drip/state/creator/ScenarioFXCurveBuilder.java +++ /dev/null @@ -1,607 +0,0 @@ - -package org.drip.state.creator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ScenarioFXCurveBuilder implements the construction of the scenario FX Curve using the input FX Curve - * instruments. - * - * @author Lakshmi Krishnamurthy - */ - -public class ScenarioFXCurveBuilder { - - /** - * Build the Shape Preserving FX Curve using the Custom Parameters - * - * @param llsc The Linear Latent State Calibrator Instance - * @param aStretchSpec Array of the Latent State Stretches - * @param cp The FX Currency Pair - * @param valParams Valuation Parameters - * @param pricerParams Pricer Parameters - * @param csqs Market Parameters - * @param vcp Quoting Parameters - * @param dblEpochResponse The Starting Response Value - * - * @return Instance of the Shape Preserving Discount Curve - */ - - public static final org.drip.state.fx.FXCurve ShapePreservingFXCurve ( - final org.drip.state.inference.LinearLatentStateCalibrator llsc, - final org.drip.state.inference.LatentStateStretchSpec[] aStretchSpec, - final org.drip.product.params.CurrencyPair cp, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblEpochResponse) - { - if (null == llsc) return null; - - try { - org.drip.state.fx.FXCurve fxCurve = new org.drip.state.curve.BasisSplineFXForward (cp, - llsc.calibrateSpan (aStretchSpec, dblEpochResponse, valParams, pricerParams, vcp, csqs)); - - return fxCurve.setCCIS (new org.drip.analytics.input.LatentStateShapePreservingCCIS (llsc, - aStretchSpec, valParams, pricerParams, vcp, csqs)) ? fxCurve : null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an instance of the Shape Preserver of the desired basis type, using the specified basis set - * builder parameters. - * - * @param strName Curve Name - * @param cp The FX Currency Pair - * @param valParams Valuation Parameters - * @param pricerParams Pricer Parameters - * @param csqs Market Parameters - * @param vcp Quoting Parameters - * @param aCalibComp Array of Calibration Components - * @param strManifestMeasure The Calibration Manifest Measure - * @param adblQuote Array of Calibration Quotes - * @param dblEpochResponse The Stretch Start DF - * @param scbc Segment Custom Builder Control Parameters - * - * @return Instance of the Shape Preserver of the desired basis type - */ - - public static final org.drip.state.fx.FXCurve ShapePreservingFXCurve ( - final java.lang.String strName, - final org.drip.product.params.CurrencyPair cp, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.product.definition.CalibratableComponent[] aCalibComp, - final java.lang.String strManifestMeasure, - final double[] adblQuote, - final double dblEpochResponse, - final org.drip.spline.params.SegmentCustomBuilderControl scbc) - { - if (null == strName || strName.isEmpty() || null == valParams || null == scbc || null == - strManifestMeasure || strManifestMeasure.isEmpty()) - return null; - - int iNumQuote = null == adblQuote ? 0 : adblQuote.length; - int iNumComp = null == aCalibComp ? 0 : aCalibComp.length; - - if (0 == iNumComp || iNumComp != iNumQuote) return null; - - try { - org.drip.state.identifier.FXLabel fxLabel = null; - - if (aCalibComp[0] instanceof org.drip.product.rates.DualStreamComponent) - fxLabel = ((org.drip.product.rates.DualStreamComponent) - aCalibComp[0]).derivedStream().fxLabel(); - else { - org.drip.analytics.support.CaseInsensitiveTreeMap - mapFXLabel = aCalibComp[0].fxLabel(); - - if (null != mapFXLabel && 0 != mapFXLabel.size()) fxLabel = mapFXLabel.get ("DERIVED"); - } - - org.drip.state.representation.LatentStateSpecification[] aLSS = new - org.drip.state.representation.LatentStateSpecification[] {new - org.drip.state.representation.LatentStateSpecification - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_FX, - org.drip.analytics.definition.LatentStateStatic.FX_QM_FORWARD_OUTRIGHT, - fxLabel)}; - - org.drip.state.inference.LatentStateSegmentSpec[] aSegmentSpec = new - org.drip.state.inference.LatentStateSegmentSpec[iNumComp]; - - for (int i = 0; i < iNumComp; ++i) { - org.drip.product.calib.ProductQuoteSet pqs = aCalibComp[i].calibQuoteSet (aLSS); - - if (null == pqs || !pqs.set (strManifestMeasure, adblQuote[i])) return null; - - aSegmentSpec[i] = new org.drip.state.inference.LatentStateSegmentSpec (aCalibComp[i], pqs); - } - - org.drip.state.inference.LatentStateStretchSpec[] aStretchSpec = new - org.drip.state.inference.LatentStateStretchSpec[] {new - org.drip.state.inference.LatentStateStretchSpec (strName, aSegmentSpec)}; - - org.drip.state.inference.LinearLatentStateCalibrator llsc = new - org.drip.state.inference.LinearLatentStateCalibrator (scbc, - org.drip.spline.stretch.BoundarySettings.FinancialStandard(), - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE, null, null); - - return ShapePreservingFXCurve (llsc, aStretchSpec, cp, valParams, pricerParams, csqs, vcp, - dblEpochResponse); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an instance of the Shape Preserver of the desired basis type, using the specified basis set - * builder parameters. - * - * @param strName Curve Name - * @param cp The FX Currency Pair - * @param valParams Valuation Parameters - * @param pricerParams Pricer Parameters - * @param csqs Market Parameters - * @param vcp Quoting Parameters - * @param strBasisType The Basis Type - * @param fsbp The Function Set Basis Parameters - * @param aCalibComp Array of Calibration Components - * @param strManifestMeasure The Calibration Manifest Measure - * @param adblQuote Array of Calibration Quotes - * @param dblEpochResponse The Stretch Start DF - * - * @return Instance of the Shape Preserver of the desired basis type - */ - - public static final org.drip.state.fx.FXCurve ShapePreservingFXCurve ( - final java.lang.String strName, - final org.drip.product.params.CurrencyPair cp, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final java.lang.String strBasisType, - final org.drip.spline.basis.FunctionSetBuilderParams fsbp, - final org.drip.product.definition.CalibratableComponent[] aCalibComp, - final java.lang.String strManifestMeasure, - final double[] adblQuote, - final double dblEpochResponse) - { - if (null == strName || strName.isEmpty() || null == strBasisType || strBasisType.isEmpty() || null == - valParams || null == fsbp || null == strManifestMeasure || strManifestMeasure.isEmpty()) - return null; - - int iNumQuote = null == adblQuote ? 0 : adblQuote.length; - int iNumComp = null == aCalibComp ? 0 : aCalibComp.length; - - if (0 == iNumComp || iNumComp != iNumQuote) return null; - - try { - org.drip.state.identifier.FXLabel fxLabel = null; - - if (aCalibComp[0] instanceof org.drip.product.rates.DualStreamComponent) - fxLabel = ((org.drip.product.rates.DualStreamComponent) - aCalibComp[0]).derivedStream().fxLabel(); - else { - org.drip.analytics.support.CaseInsensitiveTreeMap - mapFXLabel = aCalibComp[0].fxLabel(); - - if (null != mapFXLabel && 0 != mapFXLabel.size()) fxLabel = mapFXLabel.get ("DERIVED"); - } - - org.drip.state.representation.LatentStateSpecification[] aLSS = new - org.drip.state.representation.LatentStateSpecification[] {new - org.drip.state.representation.LatentStateSpecification - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_FX, - org.drip.analytics.definition.LatentStateStatic.FX_QM_FORWARD_OUTRIGHT, - fxLabel)}; - - org.drip.state.inference.LatentStateSegmentSpec[] aSegmentSpec = new - org.drip.state.inference.LatentStateSegmentSpec[iNumComp]; - - for (int i = 0; i < iNumComp; ++i) { - org.drip.product.calib.ProductQuoteSet pqs = aCalibComp[i].calibQuoteSet (aLSS); - - if (null == pqs || !pqs.set (strManifestMeasure, adblQuote[i])) return null; - - aSegmentSpec[i] = new org.drip.state.inference.LatentStateSegmentSpec (aCalibComp[i], pqs); - } - - org.drip.state.inference.LatentStateStretchSpec[] aStretchSpec = new - org.drip.state.inference.LatentStateStretchSpec[] {new - org.drip.state.inference.LatentStateStretchSpec (strName, aSegmentSpec)}; - - org.drip.state.inference.LinearLatentStateCalibrator llsc = new - org.drip.state.inference.LinearLatentStateCalibrator (new - org.drip.spline.params.SegmentCustomBuilderControl (strBasisType, fsbp, - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), new - org.drip.spline.params.ResponseScalingShapeControl (true, new - org.drip.function.r1tor1.QuadraticRationalShapeControl (0.)), null), - org.drip.spline.stretch.BoundarySettings.FinancialStandard(), - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE, null, null); - - return ShapePreservingFXCurve (llsc, aStretchSpec, cp, valParams, pricerParams, csqs, vcp, - dblEpochResponse); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an Instance of the Shape Preserver of the Cubic Polynomial Type, using the Specified Basis - * Set Builder Parameters. - * - * @param strName Curve Name - * @param cp The FX Currency Pair - * @param iSpotDate Spot Date - * @param aComp Array of Calibration Components - * @param adblQuote Array of Calibration Quotes - * @param strManifestMeasure The Calibration Manifest Measure - * @param dblFXSpot The FX Spot - * - * @return Instance of the Shape Preserver of the Cubic Polynomial Type - */ - - public static final org.drip.state.fx.FXCurve CubicPolyShapePreserver ( - final java.lang.String strName, - final org.drip.product.params.CurrencyPair cp, - final int iSpotDate, - final org.drip.product.definition.CalibratableComponent[] aComp, - final double[] adblQuote, - final java.lang.String strManifestMeasure, - final double dblFXSpot) - { - try { - return ShapePreservingFXCurve (strName, cp, org.drip.param.valuation.ValuationParams.Spot - (iSpotDate), null, null, null, - org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (4), aComp, strManifestMeasure, - adblQuote, dblFXSpot); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the Custom Splined FX Forward Curve - * - * @param strName Curve Name - * @param dtStart The Tenor Start Date - * @param cp The Currency Pair - * @param astrTenor Array of the Tenors - * @param adblFXForward Array of the FX Forwards - * @param scbc The Segment Custom Builder Control - * @param dblFXSpot FX Spot - * - * @return The Instance of the FX Forward Curve - */ - - public static final org.drip.state.fx.FXCurve CustomSplineCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final org.drip.product.params.CurrencyPair cp, - final java.lang.String[] astrTenor, - final double[] adblFXForward, - final org.drip.spline.params.SegmentCustomBuilderControl scbc, - final double dblFXSpot) - { - if (null == strName || strName.isEmpty() || null == astrTenor || null == dtStart || - !org.drip.quant.common.NumberUtil.IsValid (dblFXSpot)) - return null; - - int iNumTenor = astrTenor.length; - - if (0 == iNumTenor) return null; - - int[] aiBasisPredictorOrdinate = new int[iNumTenor + 1]; - double[] adblBasisResponseValue = new double[iNumTenor + 1]; - org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC = new - org.drip.spline.params.SegmentCustomBuilderControl[iNumTenor]; - - for (int i = 0; i <= iNumTenor; ++i) { - if (0 != i) { - java.lang.String strTenor = astrTenor[i - 1]; - - if (null == strTenor || strTenor.isEmpty()) return null; - - org.drip.analytics.date.JulianDate dtMaturity = dtStart.addTenor (strTenor); - - if (null == dtMaturity) return null; - - aiBasisPredictorOrdinate[i] = dtMaturity.julian(); - } else - aiBasisPredictorOrdinate[i] = dtStart.julian(); - - adblBasisResponseValue[i] = 0 == i ? dblFXSpot : adblFXForward[i - 1]; - - if (0 != i) aSCBC[i - 1] = scbc; - } - - try { - return new org.drip.state.curve.BasisSplineFXForward (cp, new - org.drip.spline.grid.OverlappingStretchSpan - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - (strName, aiBasisPredictorOrdinate, adblBasisResponseValue, aSCBC, null, - org.drip.spline.stretch.BoundarySettings.NaturalStandard(), - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the Cubic Polynomial Splined FX Forward Curve - * - * @param strName Curve Name - * @param dtStart The Tenor Start Date - * @param cp The Currency Pair - * @param astrTenor Array of the Tenors - * @param adblFXForward Array of the FX Forwards - * @param dblFXSpot FX Spot - * - * @return The Instance of the FX Forward Curve - */ - - public static final org.drip.state.fx.FXCurve CubicPolynomialCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final org.drip.product.params.CurrencyPair cp, - final java.lang.String[] astrTenor, - final double[] adblFXForward, - final double dblFXSpot) - { - try { - return CustomSplineCurve (strName, dtStart, cp, astrTenor, adblFXForward, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (4), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null), - dblFXSpot); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the Quartic Polynomial Splined FX Forward Curve - * - * @param strName Curve Name - * @param dtStart The Tenor Start Date - * @param cp The Currency Pair - * @param astrTenor Array of the Tenors - * @param adblFXForward Array of the FX Forwards - * @param dblFXSpot FX Spot - * - * @return The Instance of the FX Forward Curve - */ - - public static final org.drip.state.fx.FXCurve QuarticPolynomialCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final org.drip.product.params.CurrencyPair cp, - final java.lang.String[] astrTenor, - final double[] adblFXForward, - final double dblFXSpot) - { - try { - return CustomSplineCurve (strName, dtStart, cp, astrTenor, adblFXForward, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (5), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null), - dblFXSpot); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the Kaklis-Pandelis Splined FX Forward Curve - * - * @param strName Curve Name - * @param dtStart The Tenor Start Date - * @param cp The Currency Pair - * @param astrTenor Array of the Tenors - * @param adblFXForward Array of the FX Forwards - * @param dblFXSpot FX Spot - * - * @return The Instance of the FX Forward Curve - */ - - public static final org.drip.state.fx.FXCurve KaklisPandelisCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final org.drip.product.params.CurrencyPair cp, - final java.lang.String[] astrTenor, - final double[] adblFXForward, - final double dblFXSpot) - { - try { - return CustomSplineCurve (strName, dtStart, cp, astrTenor, adblFXForward, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KAKLIS_PANDELIS, new - org.drip.spline.basis.KaklisPandelisSetParams (2), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null), - dblFXSpot); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the KLK Hyperbolic Splined FX Forward Curve - * - * @param strName Curve Name - * @param dtStart The Tenor Start Date - * @param cp The Currency Pair - * @param astrTenor Array of the Tenors - * @param adblFXForward Array of the FX Forwards - * @param dblFXSpot FX Spot - * @param dblTension The Tension Parameter - * - * @return The Instance of the FX Forward Curve - */ - - public static final org.drip.state.fx.FXCurve KLKHyperbolicCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final org.drip.product.params.CurrencyPair cp, - final java.lang.String[] astrTenor, - final double[] adblFXForward, - final double dblFXSpot, - final double dblTension) - { - try { - return CustomSplineCurve (strName, dtStart, cp, astrTenor, adblFXForward, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null), - dblFXSpot); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the KLK Rational Linear Splined FX Forward Curve - * - * @param strName Curve Name - * @param dtStart The Tenor Start Date - * @param cp The Currency Pair - * @param astrTenor Array of the Tenors - * @param adblFXForward Array of the FX Forwards - * @param dblFXSpot FX Spot - * @param dblTension The Tension Parameter - * - * @return The Instance of the FX Forward Curve - */ - - public static final org.drip.state.fx.FXCurve KLKRationalLinearCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final org.drip.product.params.CurrencyPair cp, - final java.lang.String[] astrTenor, - final double[] adblFXForward, - final double dblFXSpot, - final double dblTension) - { - try { - return CustomSplineCurve (strName, dtStart, cp, astrTenor, adblFXForward, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_RATIONAL_LINEAR_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null), - dblFXSpot); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the KLK Rational Quadratic Splined FX Forward Curve - * - * @param strName Curve Name - * @param dtStart The Tenor Start Date - * @param cp The Currency Pair - * @param astrTenor Array of the Tenors - * @param adblFXForward Array of the FX Forwards - * @param dblFXSpot FX Spot - * @param dblTension The Tension Parameter - * - * @return The Instance of the FX Forward Curve - */ - - public static final org.drip.state.fx.FXCurve KLKRationalQuadraticCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final org.drip.product.params.CurrencyPair cp, - final java.lang.String[] astrTenor, - final double[] adblFXForward, - final double dblFXSpot, - final double dblTension) - { - try { - return CustomSplineCurve (strName, dtStart, cp, astrTenor, adblFXForward, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_RATIONAL_QUADRATIC_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null), - dblFXSpot); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/state/creator/ScenarioForwardCurveBuilder.java b/org/drip/state/creator/ScenarioForwardCurveBuilder.java deleted file mode 100644 index 7282a29..0000000 --- a/org/drip/state/creator/ScenarioForwardCurveBuilder.java +++ /dev/null @@ -1,231 +0,0 @@ - -package org.drip.state.creator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * ScenarioForwardCurveBuilder implements the the construction of the scenario Forward curve using the input - * discount curve instruments, and a wide variety of custom builds. It implements the following - * functionality: - * - Non-linear Custom Discount Curve - * - Shape Preserving Discount Curve Builds - Standard Cubic Polynomial/Cubic KLK Hyperbolic Tension, and - * other Custom Builds - * - Smoothing Local/Control Custom Build - DC/Forward/Zero Rate LSQM's - * - "Industry Standard Methodologies" - DENSE/DUALDENSE/CUSTOMDENSE and Hagan-West Forward Interpolator - * Schemes - * - * @author Lakshmi Krishnamurthy - */ - -public class ScenarioForwardCurveBuilder { - - /** - * Build the Shape Preserving Forward Curve using the Custom Parameters - * - * @param llsc The Linear Latent State Calibrator Instance - * @param aStretchSpec Array of the Latent State Stretches - * @param fri The Floating Rate Index - * @param valParam Valuation Parameters - * @param pricerParam Pricer Parameters - * @param csqs Market Parameters - * @param quotingParam Quoting Parameters - * @param dblEpochResponse The Starting Response Value - * - * @return Instance of the Shape Preserving Discount Curve - */ - - public static final org.drip.state.forward.ForwardCurve ShapePreservingForwardCurve ( - final org.drip.state.inference.LinearLatentStateCalibrator llsc, - final org.drip.state.inference.LatentStateStretchSpec[] aStretchSpec, - final org.drip.state.identifier.ForwardLabel fri, - final org.drip.param.valuation.ValuationParams valParam, - final org.drip.param.pricer.CreditPricerParams pricerParam, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParam, - final double dblEpochResponse) - { - if (null == llsc) return null; - - try { - org.drip.state.forward.ForwardCurve fc = new org.drip.state.curve.BasisSplineForwardRate (fri, - llsc.calibrateSpan (aStretchSpec, dblEpochResponse, valParam, pricerParam, quotingParam, - csqs)); - - return fc.setCCIS (new org.drip.analytics.input.LatentStateShapePreservingCCIS (llsc, - aStretchSpec, valParam, pricerParam, quotingParam, csqs)) ? fc : null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an instance of the Shape Preserver of the desired basis type, using the specified basis set - * builder parameters. - * - * @param strName Curve Name - * @param fri The Floating Rate Index - * @param valParams Valuation Parameters - * @param pricerParam Pricer Parameters - * @param csqs Market Parameters - * @param quotingParam Quoting Parameters - * @param strBasisType The Basis Type - * @param fsbp The Function Set Basis Parameters - * @param aCalibComp Array of Calibration Components - * @param strManifestMeasure The Calibration Manifest Measure - * @param adblQuote Array of Calibration Quotes - * @param dblEpochResponse The Stretch Start DF - * - * @return Instance of the Shape Preserver of the desired basis type - */ - - public static final org.drip.state.forward.ForwardCurve ShapePreservingForwardCurve ( - final java.lang.String strName, - final org.drip.state.identifier.ForwardLabel fri, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParam, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams quotingParam, - final java.lang.String strBasisType, - final org.drip.spline.basis.FunctionSetBuilderParams fsbp, - final org.drip.product.definition.CalibratableComponent[] aCalibComp, - final java.lang.String strManifestMeasure, - final double[] adblQuote, - final double dblEpochResponse) - { - if (null == strName || strName.isEmpty() || null == strBasisType || strBasisType.isEmpty() || null == - valParams || null == fsbp || null == strManifestMeasure || strManifestMeasure.isEmpty()) - return null; - - int iNumQuote = null == adblQuote ? 0 : adblQuote.length; - int iNumComp = null == aCalibComp ? 0 : aCalibComp.length; - - if (0 == iNumComp || iNumComp != iNumQuote) return null; - - try { - org.drip.state.identifier.ForwardLabel forwardLabel = null; - - if (aCalibComp[0] instanceof org.drip.product.rates.DualStreamComponent) - forwardLabel = ((org.drip.product.rates.DualStreamComponent) - aCalibComp[0]).derivedStream().forwardLabel(); - else { - org.drip.analytics.support.CaseInsensitiveTreeMap - mapForwardLabel = aCalibComp[0].forwardLabel(); - - if (null != mapForwardLabel && 0 != mapForwardLabel.size()) - forwardLabel = mapForwardLabel.get (0); - } - - org.drip.state.representation.LatentStateSpecification[] aLSS = new - org.drip.state.representation.LatentStateSpecification[] {new - org.drip.state.representation.LatentStateSpecification - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_FORWARD, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_FORWARD_RATE, - forwardLabel)}; - - org.drip.state.inference.LatentStateSegmentSpec[] aSegmentSpec = new - org.drip.state.inference.LatentStateSegmentSpec[iNumComp]; - - for (int i = 0; i < iNumComp; ++i) { - org.drip.product.calib.ProductQuoteSet pqs = aCalibComp[i].calibQuoteSet (aLSS); - - if (null == pqs || !pqs.set (strManifestMeasure, adblQuote[i])) return null; - - aSegmentSpec[i] = new org.drip.state.inference.LatentStateSegmentSpec (aCalibComp[i], pqs); - } - - org.drip.state.inference.LatentStateStretchSpec[] aStretchSpec = new - org.drip.state.inference.LatentStateStretchSpec[] {new - org.drip.state.inference.LatentStateStretchSpec (strName, aSegmentSpec)}; - - org.drip.state.inference.LinearLatentStateCalibrator llsc = new - org.drip.state.inference.LinearLatentStateCalibrator (new - org.drip.spline.params.SegmentCustomBuilderControl (strBasisType, fsbp, - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), new - org.drip.spline.params.ResponseScalingShapeControl (true, new - org.drip.function.r1tor1.QuadraticRationalShapeControl (0.)), null), - org.drip.spline.stretch.BoundarySettings.FinancialStandard(), - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE, null, null); - - return ShapePreservingForwardCurve (llsc, aStretchSpec, fri, valParams, pricerParam, csqs, - quotingParam, dblEpochResponse); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an Instance of the Flat Forward Rate Forward Curve - * - * @param dtStart The Forward Curve Start Date - * @param fri The Floating Rate Index - * @param dblFlatForwardRate The Flat Forward Rate - * - * @return Instance of the Flat Forward Rate Forward Curve - */ - - public static final org.drip.state.forward.ForwardCurve FlatForwardForwardCurve ( - final org.drip.analytics.date.JulianDate dtStart, - final org.drip.state.identifier.ForwardLabel fri, - final double dblFlatForwardRate) - { - try { - return new org.drip.state.nonlinear.FlatForwardForwardCurve (dtStart, fri, dblFlatForwardRate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/state/creator/ScenarioGovvieCurveBuilder.java b/org/drip/state/creator/ScenarioGovvieCurveBuilder.java deleted file mode 100644 index 040e727..0000000 --- a/org/drip/state/creator/ScenarioGovvieCurveBuilder.java +++ /dev/null @@ -1,619 +0,0 @@ - -package org.drip.state.creator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ScenarioGovvieCurveBuilder implements the Construction of the Scenario Govvie Curve using the Input Govvie - * Curve Instruments. - * - * @author Lakshmi Krishnamurthy - */ - -public class ScenarioGovvieCurveBuilder { - - /** - * Build the Shape Preserving Govvie Curve using the Custom Parameters - * - * @param llsc The Linear Latent State Calibrator Instance - * @param aStretchSpec Array of the Latent State Stretches - * @param strTreasuryCode Treasury Code - * @param strCurrency Currency - * @param valParams Valuation Parameters - * @param pricerParams Pricer Parameters - * @param csqc Market Parameters - * @param vcp Valuation Customization Parameters - * @param dblEpochResponse The Starting Response Value - * - * @return Instance of the Shape Preserving Discount Curve - */ - - public static final org.drip.state.govvie.GovvieCurve ShapePreservingGovvieCurve ( - final org.drip.state.inference.LinearLatentStateCalibrator llsc, - final org.drip.state.inference.LatentStateStretchSpec[] aStretchSpec, - final java.lang.String strTreasuryCode, - final java.lang.String strCurrency, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final double dblEpochResponse) - { - if (null == llsc) return null; - - try { - org.drip.state.govvie.GovvieCurve govvieCurve = new org.drip.state.curve.BasisSplineGovvieYield - (strTreasuryCode, strCurrency, llsc.calibrateSpan (aStretchSpec, dblEpochResponse, valParams, - pricerParams, vcp, csqc)); - - return govvieCurve.setCCIS (new org.drip.analytics.input.LatentStateShapePreservingCCIS (llsc, - aStretchSpec, valParams, pricerParams, vcp, csqc)) ? govvieCurve : null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an Instance of the Shape Preserver of the desired Basis Spline Type, using the specified - * Basis Spline Set Builder Parameters. - * - * @param strName Curve Name - * @param strTreasuryCode Treasury Code - * @param strCurrency Currency - * @param valParams Valuation Parameters - * @param pricerParams Pricer Parameters - * @param csqc Market Parameters - * @param vcp Valuation Customization Parameters - * @param strBasisType The Basis Type - * @param fsbp The Function Set Basis Parameters - * @param sdic Segment Design In-elastic Control - * @param aCalibComp Array of Calibration Components - * @param strManifestMeasure The Calibration Manifest Measure - * @param adblQuote Array of Calibration Quotes - * - * @return Instance of the Shape Preserver of the Desired Basis Type - */ - - public static final org.drip.state.govvie.GovvieCurve ShapePreservingGovvieCurve ( - final java.lang.String strName, - final java.lang.String strTreasuryCode, - final java.lang.String strCurrency, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqc, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final java.lang.String strBasisType, - final org.drip.spline.basis.FunctionSetBuilderParams fsbp, - final org.drip.spline.params.SegmentInelasticDesignControl sdic, - final org.drip.product.definition.CalibratableComponent[] aCalibComp, - final java.lang.String strManifestMeasure, - final double[] adblQuote) - { - if (null == strName || strName.isEmpty() || null == strBasisType || strBasisType.isEmpty() || null == - valParams || null == fsbp || null == strManifestMeasure || strManifestMeasure.isEmpty()) - return null; - - int iNumQuote = null == adblQuote ? 0 : adblQuote.length; - int iNumComp = null == aCalibComp ? 0 : aCalibComp.length; - - if (0 == iNumComp || iNumComp != iNumQuote) return null; - - org.drip.state.identifier.GovvieLabel govvieLabel = aCalibComp[0].govvieLabel(); - - try { - org.drip.state.representation.LatentStateSpecification[] aLSS = new - org.drip.state.representation.LatentStateSpecification[] {new - org.drip.state.representation.LatentStateSpecification - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_GOVVIE, - org.drip.analytics.definition.LatentStateStatic.GOVVIE_QM_YIELD, govvieLabel)}; - - org.drip.state.inference.LatentStateSegmentSpec[] aSegmentSpec = new - org.drip.state.inference.LatentStateSegmentSpec[iNumComp]; - - for (int i = 0; i < iNumComp; ++i) { - org.drip.product.calib.ProductQuoteSet pqs = aCalibComp[i].calibQuoteSet (aLSS); - - if (null == pqs || !pqs.set (strManifestMeasure, adblQuote[i])) return null; - - aSegmentSpec[i] = new org.drip.state.inference.LatentStateSegmentSpec (aCalibComp[i], pqs); - } - - org.drip.state.inference.LatentStateStretchSpec[] aStretchSpec = new - org.drip.state.inference.LatentStateStretchSpec[] {new - org.drip.state.inference.LatentStateStretchSpec (strName, aSegmentSpec)}; - - org.drip.state.inference.LinearLatentStateCalibrator llsc = new - org.drip.state.inference.LinearLatentStateCalibrator (new - org.drip.spline.params.SegmentCustomBuilderControl (strBasisType, fsbp, sdic, new - org.drip.spline.params.ResponseScalingShapeControl (true, new - org.drip.function.r1tor1.QuadraticRationalShapeControl (0.)), null), - org.drip.spline.stretch.BoundarySettings.FinancialStandard(), - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE, null, null); - - return ShapePreservingGovvieCurve (llsc, aStretchSpec, strTreasuryCode, strCurrency, valParams, - pricerParams, csqc, vcp, adblQuote[0]); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an Instance of the Shape Preserver of the Linear Polynomial Type, using the Specified Basis - * Set Builder Parameters. - * - * @param strName Curve Name - * @param strTreasuryCode Treasury Code - * @param strCurrency Currency - * @param iSpotDate Spot Date - * @param aComp Array of Calibration Components - * @param adblQuote Array of Calibration Quotes - * @param strManifestMeasure The Calibration Manifest Measure - * - * @return Instance of the Shape Preserver of the Cubic Polynomial Type - */ - - public static final org.drip.state.govvie.GovvieCurve LinearPolyShapePreserver ( - final java.lang.String strName, - final java.lang.String strTreasuryCode, - final java.lang.String strCurrency, - final int iSpotDate, - final org.drip.product.definition.CalibratableComponent[] aComp, - final double[] adblQuote, - final java.lang.String strManifestMeasure) - { - try { - return ShapePreservingGovvieCurve (strName, strTreasuryCode, strCurrency, - org.drip.param.valuation.ValuationParams.Spot (iSpotDate), null, null, null, - org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (2), - org.drip.spline.params.SegmentInelasticDesignControl.Create (0, 2), aComp, - strManifestMeasure, adblQuote); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an Instance of the Shape Preserver of the Cubic Polynomial Type, using the Specified Basis - * Set Builder Parameters. - * - * @param strName Curve Name - * @param strTreasuryCode Treasury Code - * @param strCurrency Currency - * @param iSpotDate Spot Date - * @param aComp Array of Calibration Components - * @param adblQuote Array of Calibration Quotes - * @param strManifestMeasure The Calibration Manifest Measure - * - * @return Instance of the Shape Preserver of the Cubic Polynomial Type - */ - - public static final org.drip.state.govvie.GovvieCurve CubicPolyShapePreserver ( - final java.lang.String strName, - final java.lang.String strTreasuryCode, - final java.lang.String strCurrency, - final int iSpotDate, - final org.drip.product.definition.CalibratableComponent[] aComp, - final double[] adblQuote, - final java.lang.String strManifestMeasure) - { - try { - return ShapePreservingGovvieCurve (strName, strTreasuryCode, strCurrency, - org.drip.param.valuation.ValuationParams.Spot (iSpotDate), null, null, null, - org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (4), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), aComp, - strManifestMeasure, adblQuote); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the Custom Splined Govvie Yield Curve - * - * @param strName Curve Name - * @param dtStart The Tenor Start Date - * @param strTreasuryCode Treasury Code - * @param strCurrency Currency - * @param aiMaturityDate Array of the Maturity Dates - * @param adblYield Array of the Yields - * @param scbc The Segment Custom Builder Control - * - * @return The Instance of the Govvie Yield Curve - */ - - public static final org.drip.state.govvie.GovvieCurve CustomSplineCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strTreasuryCode, - final java.lang.String strCurrency, - final int[] aiMaturityDate, - final double[] adblYield, - final org.drip.spline.params.SegmentCustomBuilderControl scbc) - { - if (null == strName || strName.isEmpty() || null == dtStart || null == aiMaturityDate || null == - adblYield) - return null; - - int iNumTreasury = aiMaturityDate.length; - int[] aiPredictorOrdinate = new int[iNumTreasury + 1]; - double[] adblResponseValue = new double[iNumTreasury + 1]; - org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC = new - org.drip.spline.params.SegmentCustomBuilderControl[iNumTreasury]; - - if (0 == iNumTreasury || iNumTreasury != adblYield.length) return null; - - for (int i = 0; i <= iNumTreasury; ++i) { - aiPredictorOrdinate[i] = 0 == i ? dtStart.julian() : aiMaturityDate[i - 1]; - - adblResponseValue[i] = 0 == i ? adblYield[0] : adblYield[i - 1]; - - if (0 != i) aSCBC[i - 1] = scbc; - } - - try { - return new org.drip.state.curve.BasisSplineGovvieYield (strTreasuryCode, strCurrency, new - org.drip.spline.grid.OverlappingStretchSpan - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - (strName, aiPredictorOrdinate, adblResponseValue, aSCBC, null, - org.drip.spline.stretch.BoundarySettings.NaturalStandard(), - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the Linear Polynomial Splined Govvie Yield Curve - * - * @param strName Curve Name - * @param dtStart The Tenor Start Date - * @param strTreasuryCode Treasury Code - * @param strCurrency Currency - * @param aiMaturityDate Array of the Maturity Dates - * @param adblYield Array of the Govvie Yields - * - * @return The Instance of the Govvie Yield Curve - */ - - /* public static final org.drip.state.govvie.GovvieCurve LinearPolynomialCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strTreasuryCode, - final java.lang.String strCurrency, - final int[] aiMaturityDate, - final double[] adblYield) - { - try { - return CustomSplineCurve (strName, dtStart, strTreasuryCode, strCurrency, aiMaturityDate, - adblYield, new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (2), - org.drip.spline.params.SegmentInelasticDesignControl.Create (0, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } */ - - /** - * Create an Instance of the Cubic Polynomial Splined Govvie Yield Curve - * - * @param strName Curve Name - * @param dtStart The Tenor Start Date - * @param strTreasuryCode Treasury Code - * @param strCurrency Currency - * @param aiMaturityDate Array of the Maturity Dates - * @param adblYield Array of the Govvie Yields - * - * @return The Instance of the Govvie Yield Curve - */ - - public static final org.drip.state.govvie.GovvieCurve CubicPolynomialCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strTreasuryCode, - final java.lang.String strCurrency, - final int[] aiMaturityDate, - final double[] adblYield) - { - try { - return CustomSplineCurve (strName, dtStart, strTreasuryCode, strCurrency, aiMaturityDate, - adblYield, new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (4), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the Quartic Polynomial Splined Govvie Yield Curve - * - * @param strName Curve Name - * @param dtStart The Tenor Start Date - * @param strTreasuryCode Treasury Code - * @param strCurrency Currency - * @param aiMaturityDate Array of the Maturity Dates - * @param adblYield Array of the Yields - * - * @return The Instance of the Govvie Yield Curve - */ - - public static final org.drip.state.govvie.GovvieCurve QuarticPolynomialCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strTreasuryCode, - final java.lang.String strCurrency, - final int[] aiMaturityDate, - final double[] adblYield) - { - try { - return CustomSplineCurve (strName, dtStart, strTreasuryCode, strCurrency, aiMaturityDate, - adblYield, new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (5), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the Kaklis-Pandelis Splined Govvie Yield Curve - * - * @param strName Curve Name - * @param dtStart The Tenor Start Date - * @param strTreasuryCode Treasury Code - * @param strCurrency Currency - * @param aiMaturityDate Array of the Maturity Dates - * @param adblYield Array of the Yields - * - * @return The Instance of the Govvie Yield Curve - */ - - public static final org.drip.state.govvie.GovvieCurve KaklisPandelisCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strTreasuryCode, - final java.lang.String strCurrency, - final int[] aiMaturityDate, - final double[] adblYield) - { - try { - return CustomSplineCurve (strName, dtStart, strTreasuryCode, strCurrency, aiMaturityDate, - adblYield, new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KAKLIS_PANDELIS, new - org.drip.spline.basis.KaklisPandelisSetParams (2), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the KLK Hyperbolic Splined Govvie Yield Curve - * - * @param strName Curve Name - * @param dtStart The Tenor Start Date - * @param strTreasuryCode Treasury Code - * @param strCurrency Currency - * @param aiMaturityDate Array of the Maturity Dates - * @param adblYield Array of the Yields - * @param dblTension The Tension Parameter - * - * @return The Instance of the Govvie Yield Curve - */ - - public static final org.drip.state.govvie.GovvieCurve KLKHyperbolicCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strTreasuryCode, - final java.lang.String strCurrency, - final int[] aiMaturityDate, - final double[] adblYield, - final double dblTension) - { - try { - return CustomSplineCurve (strName, dtStart, strTreasuryCode, strCurrency, aiMaturityDate, - adblYield, new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the KLK Rational Linear Splined Govvie Yield Curve - * - * @param strName Curve Name - * @param dtStart The Tenor Start Date - * @param strTreasuryCode Treasury Code - * @param strCurrency Currency - * @param aiMaturityDate Array of the Maturity Dates - * @param adblYield Array of the Yields - * @param dblTension The Tension Parameter - * - * @return The Instance of the Govvie Yield Curve - */ - - public static final org.drip.state.govvie.GovvieCurve KLKRationalLinearCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strTreasuryCode, - final java.lang.String strCurrency, - final int[] aiMaturityDate, - final double[] adblYield, - final double dblTension) - { - try { - return CustomSplineCurve (strName, dtStart, strTreasuryCode, strCurrency, aiMaturityDate, - adblYield, new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_RATIONAL_LINEAR_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the KLK Rational Quadratic Splined Govvie Yield Curve - * - * @param strName Curve Name - * @param dtStart The Tenor Start Date - * @param strTreasuryCode Treasury Code - * @param strCurrency Currency - * @param aiMaturityDate Array of the Maturity Dates - * @param adblYield Array of the Yields - * @param dblTension The Tension Parameter - * - * @return The Instance of the Govvie Yield Curve - */ - - public static final org.drip.state.govvie.GovvieCurve KLKRationalQuadraticCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strTreasuryCode, - final java.lang.String strCurrency, - final int[] aiMaturityDate, - final double[] adblYield, - final double dblTension) - { - try { - return CustomSplineCurve (strName, dtStart, strTreasuryCode, strCurrency, aiMaturityDate, - adblYield, new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_RATIONAL_QUADRATIC_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Govvie Curve from an Array of Dates and Yields - * - * @param iEpochDate Epoch Date - * @param strTreasuryCode Treasury Code - * @param strCurrency Currency - * @param aiDate Array of Dates - * @param adblYield Array of Yields - * - * @return The Govvie Curve Instance - */ - - public static final org.drip.state.govvie.GovvieCurve DateYield ( - final int iEpochDate, - final java.lang.String strTreasuryCode, - final java.lang.String strCurrency, - final int[] aiDate, - final double[] adblYield) - { - try { - return new org.drip.state.nonlinear.FlatYieldGovvieCurve (iEpochDate, strTreasuryCode, - strCurrency, aiDate, adblYield); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Govvie Curve from the Specified Date and Yield - * - * @param iEpochDate Epoch Date - * @param strTreasuryCode Treasury Code - * @param strCurrency Currency - * @param dblYield Yield - * - * @return The Govvie Curve Instance - */ - - public static final org.drip.state.govvie.GovvieCurve ConstantYield ( - final int iEpochDate, - final java.lang.String strTreasuryCode, - final java.lang.String strCurrency, - final double dblYield) { - try { - return new org.drip.state.nonlinear.FlatYieldGovvieCurve (iEpochDate, strTreasuryCode, - strCurrency, new int[] {iEpochDate}, new double[] {dblYield}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/state/creator/ScenarioLocalVolatilityBuilder.java b/org/drip/state/creator/ScenarioLocalVolatilityBuilder.java deleted file mode 100644 index 2be78e8..0000000 --- a/org/drip/state/creator/ScenarioLocalVolatilityBuilder.java +++ /dev/null @@ -1,219 +0,0 @@ - -package org.drip.state.creator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ScenarioLocalVolatilityBuilder implements the construction of the Local Volatility surface using the input - * option instruments, their Call Prices, and a wide variety of custom build schemes. - * - * @author Lakshmi Krishnamurthy - */ - -public class ScenarioLocalVolatilityBuilder { - - /** - * Create a Volatility Curve from the Calibration Instruments - * - * @param strName Volatility Curve name - * @param dtSpot Spot Date - * @param lslUnderlying Underlying Latent State Label - * @param aFRACapFloor Array of the FRA Cap Floor Instruments - * @param adblCalibQuote Input Calibration Quotes - * @param astrCalibMeasure Input Calibration Measures - * @param dc Base Discount Curve - * @param fc Forward Curve - * @param lsfc Latent State Fixings Container - * - * @return The Calibrated Volatility Curve - */ - - public static final org.drip.state.volatility.VolatilityCurve NonlinearBuild ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.state.identifier.LatentStateLabel lslUnderlying, - final org.drip.product.fra.FRAStandardCapFloor[] aFRACapFloor, - final double[] adblCalibQuote, - final java.lang.String[] astrCalibMeasure, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.state.forward.ForwardCurve fc, - final org.drip.param.market.LatentStateFixingsContainer lsfc) - { - return null == dtSpot ? null : org.drip.state.boot.VolatilityCurveScenario.Standard (strName, - org.drip.param.valuation.ValuationParams.Spot (dtSpot.julian()), lslUnderlying, aFRACapFloor, - adblCalibQuote, astrCalibMeasure, false, dc, fc, lsfc, null); - } - - /** - * Build an Instance of the Volatility Surface using custom wire span and surface splines - * - * @param strName Name of the Volatility Surface - * @param dtStart Start/Epoch Julian Date - * @param strCurrency Currency - * @param dblRiskFreeRate Risk Free Discounting Rate - * @param adblStrike Array of Strikes - * @param adblMaturity Array of Maturities - * @param aadblCallPrice Double Array of the Call Prices - * @param scbcWireSpan The Wire Span Segment Customizer - * @param scbcSurface The Surface Segment Customizer - * - * @return Instance of the Market Node Surface - */ - - public static final org.drip.analytics.definition.MarketSurface CustomSplineWireSurface ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final double dblRiskFreeRate, - final double[] adblStrike, - final double[] adblMaturity, - final double[][] aadblCallPrice, - final org.drip.spline.params.SegmentCustomBuilderControl scbcWireSpan, - final org.drip.spline.params.SegmentCustomBuilderControl scbcSurface) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblRiskFreeRate)) return null; - - org.drip.analytics.definition.MarketSurface msCallPrice = - org.drip.state.creator.ScenarioMarketSurfaceBuilder.CustomSplineWireSurface (strName + - "_CALL_PRICE_SURFACE", dtStart, strCurrency, adblStrike, adblMaturity, aadblCallPrice, - scbcWireSpan, scbcSurface); - - if (null == msCallPrice) return null; - - int iNumStrike = adblStrike.length; - int iNumMaturity = adblMaturity.length; - double[][] aadblLocalVolatility = new double[iNumStrike][iNumMaturity]; - org.drip.analytics.definition.NodeStructure[] aTSMaturityAnchor = new - org.drip.analytics.definition.NodeStructure[iNumMaturity]; - - for (int j = 0; j < iNumMaturity; ++j) { - if (null == (aTSMaturityAnchor[j] = msCallPrice.yAnchorTermStructure (adblMaturity[j]))) - return null; - } - - for (int i = 0; i < iNumStrike; ++i) { - org.drip.analytics.definition.NodeStructure tsStrikeAnchor = msCallPrice.xAnchorTermStructure - (adblStrike[i]); - - if (null == tsStrikeAnchor) return null; - - for (int j = 0; j < iNumMaturity; ++j) { - try { - aadblLocalVolatility[i][j] = java.lang.Math.sqrt ((tsStrikeAnchor.nodeDerivative ((int) - adblMaturity[j], 1) + dblRiskFreeRate * adblStrike[i] * - aTSMaturityAnchor[j].nodeDerivative ((int) adblStrike[i], 1)) / (adblStrike[i] * - adblStrike[i] * aTSMaturityAnchor[j].nodeDerivative ((int) adblStrike[i], - 2))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - } - - return org.drip.state.creator.ScenarioMarketSurfaceBuilder.CustomSplineWireSurface (strName, dtStart, - strCurrency, adblStrike, adblMaturity, aadblLocalVolatility, scbcWireSpan, scbcSurface); - } - - /** - * Construct a Scenario Market Surface off of cubic polynomial wire spline and cubic polynomial surface - * Spline. - * - * @param strName Name of the Volatility Surface - * @param dtStart Start/Epoch Julian Date - * @param strCurrency Currency - * @param dblRiskFreeRate Risk Free Discounting Rate - * @param adblStrike Array of Strikes - * @param astrTenor Array of Maturity Tenors - * @param aadblNode Double Array of the Surface Nodes - * - * @return Instance of the Market Node Surface - */ - - public static final org.drip.analytics.definition.MarketSurface CubicPolynomialWireSurface ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final double dblRiskFreeRate, - final double[] adblStrike, - final java.lang.String[] astrTenor, - final double[][] aadblNode) - { - if (null == astrTenor) return null; - - int iNumTenor = astrTenor.length; - double[] adblMaturity = new double[iNumTenor]; - org.drip.spline.params.SegmentCustomBuilderControl scbcSurface = null; - org.drip.spline.params.SegmentCustomBuilderControl scbcWireSpan = null; - - if (0 == iNumTenor) return null; - - for (int i = 0; i < iNumTenor; ++i) - adblMaturity[i] = dtStart.addTenor (astrTenor[i]).julian(); - - try { - scbcWireSpan = new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (4), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null); - - scbcSurface = new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (4), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return CustomSplineWireSurface (strName, dtStart, strCurrency, dblRiskFreeRate, adblStrike, - adblMaturity, aadblNode, scbcWireSpan, scbcSurface); - } -} diff --git a/org/drip/state/creator/ScenarioMarketSurfaceBuilder.java b/org/drip/state/creator/ScenarioMarketSurfaceBuilder.java deleted file mode 100644 index 8c9f822..0000000 --- a/org/drip/state/creator/ScenarioMarketSurfaceBuilder.java +++ /dev/null @@ -1,599 +0,0 @@ - -package org.drip.state.creator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ScenarioMarketSurfaceBuilder implements the construction of the scenario market Node surface using the - * input option instruments, their quotes, and a wide variety of custom builds - * - * @author Lakshmi Krishnamurthy - */ - -public class ScenarioMarketSurfaceBuilder { - - /** - * Build an Instance of the Market Node Surface using Custom Wire Span and Surface Splines. - * - * @param strName Name of the Volatility Surface - * @param dtStart Start/Epoch Julian Date - * @param strCurrency Currency - * @param adblX Array of X Ordinates - * @param adblY Array of Y Ordinates - * @param aadblNode Double Array of the Surface Nodes - * @param scbcWireSpan The Wire Span Segment Customizer - * @param scbcSurface The Surface Segment Customizer - * - * @return Instance of the Market Node Surface - */ - - public static final org.drip.analytics.definition.MarketSurface CustomSplineWireSurface ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final double[] adblX, - final double[] adblY, - final double[][] aadblNode, - final org.drip.spline.params.SegmentCustomBuilderControl scbcWireSpan, - final org.drip.spline.params.SegmentCustomBuilderControl scbcSurface) - { - if (null == dtStart || null == strName || strName.isEmpty() || null == strCurrency || - strCurrency.isEmpty() || null == adblX || null == adblY || null == aadblNode || null == - scbcWireSpan || null == scbcSurface) - return null; - - int iNumX = adblX.length; - int iNumMaturity = adblY.length; - int iNumOuterNode = aadblNode.length; - - if (0 == iNumX || 0 == iNumMaturity || iNumX != iNumOuterNode) return null; - - for (int i = 0; i < iNumX; ++i) { - double[] adblInner = aadblNode[i]; - - if (null == adblInner || iNumMaturity != adblInner.length) return null; - } - - org.drip.spline.params.SegmentCustomBuilderControl[] aSCBCWireSpan = new - org.drip.spline.params.SegmentCustomBuilderControl[iNumX - 1]; - - for (int i = 0; i < iNumX - 1; ++i) - aSCBCWireSpan[i] = scbcWireSpan; - - java.util.TreeMap mapWireSpan = new - java.util.TreeMap(); - - for (int i = 0; i < iNumX; ++i) { - org.drip.spline.stretch.MultiSegmentSequence mssWire = - org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - ("Stretch@" + strName + "@" + org.drip.quant.common.StringUtil.GUID(), adblY, - aadblNode[i], aSCBCWireSpan, null, - org.drip.spline.stretch.BoundarySettings.NaturalStandard(), - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE); - - if (null == mssWire) return null; - - try { - mapWireSpan.put (adblX[i], new org.drip.spline.grid.OverlappingStretchSpan (mssWire)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - try { - return new org.drip.state.curve.BasisSplineMarketSurface (dtStart.julian(), - org.drip.state.identifier.CustomLabel.Standard (strName), strCurrency, new - org.drip.spline.multidimensional.WireSurfaceStretch ("WireSurfaceStretch@" + strName + - "@" + org.drip.quant.common.StringUtil.GUID(), scbcSurface, mapWireSpan)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Scenario Market Surface off of Cubic Polynomial Wire Spline and Cubic Polynomial Surface - * Spline. - * - * @param strName Name of the Volatility Surface - * @param dtStart Start/Epoch Julian Date - * @param strCurrency Currency - * @param adblX Array of X Ordinates - * @param astrTenor Array of Maturity Tenors - * @param aadblNode Double Array of the Surface Nodes - * - * @return Instance of the Market Node Surface - */ - - public static final org.drip.analytics.definition.MarketSurface CubicPolynomialWireSurface ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final double[] adblX, - final java.lang.String[] astrTenor, - final double[][] aadblNode) - { - if (null == astrTenor) return null; - - int iNumTenor = astrTenor.length; - double[] adblY = new double[iNumTenor]; - org.drip.spline.params.SegmentCustomBuilderControl scbcSurface = null; - org.drip.spline.params.SegmentCustomBuilderControl scbcWireSpan = null; - - if (0 == iNumTenor) return null; - - for (int i = 0; i < iNumTenor; ++i) - adblY[i] = dtStart.addTenor (astrTenor[i]).julian(); - - try { - scbcWireSpan = new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (4), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null); - - scbcSurface = new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (4), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return CustomSplineWireSurface (strName, dtStart, strCurrency, adblX, adblY, aadblNode, scbcWireSpan, - scbcSurface); - } - - /** - * Construct a Scenario Market Surface off of Quartic Polynomial Wire Spline and Quartic Polynomial - * Surface Spline. - * - * @param strName Name of the Volatility Surface - * @param dtStart Start/Epoch Julian Date - * @param strCurrency Currency - * @param adblX Array of X Ordinates - * @param astrTenor Array of Maturity Tenors - * @param aadblNode Double Array of the Surface Nodes - * - * @return Instance of the Market Node Surface - */ - - public static final org.drip.analytics.definition.MarketSurface QuarticPolynomialWireSurface ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final double[] adblX, - final java.lang.String[] astrTenor, - final double[][] aadblNode) - { - if (null == astrTenor) return null; - - int iNumTenor = astrTenor.length; - double[] adblY = new double[iNumTenor]; - org.drip.spline.params.SegmentCustomBuilderControl scbcSurface = null; - org.drip.spline.params.SegmentCustomBuilderControl scbcWireSpan = null; - - if (0 == iNumTenor) return null; - - for (int i = 0; i < iNumTenor; ++i) - adblY[i] = dtStart.addTenor (astrTenor[i]).julian(); - - try { - scbcWireSpan = new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (5), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null); - - scbcSurface = new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (5), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return CustomSplineWireSurface (strName, dtStart, strCurrency, adblX, adblY, aadblNode, scbcWireSpan, - scbcSurface); - } - - /** - * Construct a Scenario Market Surface off of Kaklis-Pandelis Wire Spline and Kaklis-Pandelis Surface - * Spline. - * - * @param strName Name of the Volatility Surface - * @param dtStart Start/Epoch Julian Date - * @param strCurrency Currency - * @param adblX Array of X Ordinates - * @param astrTenor Array of Maturity Tenors - * @param aadblNode Double Array of the Surface Nodes - * - * @return Instance of the Market Node Surface - */ - - public static final org.drip.analytics.definition.MarketSurface KaklisPandelisWireSurface ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final double[] adblX, - final java.lang.String[] astrTenor, - final double[][] aadblNode) - { - if (null == astrTenor) return null; - - int iNumTenor = astrTenor.length; - double[] adblY = new double[iNumTenor]; - org.drip.spline.params.SegmentCustomBuilderControl scbcSurface = null; - org.drip.spline.params.SegmentCustomBuilderControl scbcWireSpan = null; - - if (0 == iNumTenor) return null; - - for (int i = 0; i < iNumTenor; ++i) - adblY[i] = dtStart.addTenor (astrTenor[i]).julian(); - - try { - scbcWireSpan = new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KAKLIS_PANDELIS, new - org.drip.spline.basis.KaklisPandelisSetParams (2), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null); - - scbcSurface = new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KAKLIS_PANDELIS, new - org.drip.spline.basis.KaklisPandelisSetParams (2), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return CustomSplineWireSurface (strName, dtStart, strCurrency, adblX, adblY, aadblNode, scbcWireSpan, - scbcSurface); - } - - /** - * Construct a Scenario Market Surface off of KLK Hyperbolic Wire Spline and KLK Hyperbolic Surface - * Spline. - * - * @param strName Name of the Volatility Surface - * @param dtStart Start/Epoch Julian Date - * @param strCurrency Currency - * @param adblX Array of X Ordinates - * @param astrTenor Array of Maturity Tenors - * @param aadblNode Double Array of the Surface Nodes - * @param dblTension The Tension Parameter - * - * @return Instance of the Market Node Surface - */ - - public static final org.drip.analytics.definition.MarketSurface KLKHyperbolicWireSurface ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final double[] adblX, - final java.lang.String[] astrTenor, - final double[][] aadblNode, - final double dblTension) - { - if (null == astrTenor) return null; - - int iNumTenor = astrTenor.length; - double[] adblY = new double[iNumTenor]; - org.drip.spline.params.SegmentCustomBuilderControl scbcSurface = null; - org.drip.spline.params.SegmentCustomBuilderControl scbcWireSpan = null; - - if (0 == iNumTenor) return null; - - for (int i = 0; i < iNumTenor; ++i) - adblY[i] = dtStart.addTenor (astrTenor[i]).julian(); - - try { - scbcWireSpan = new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, new - org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null); - - scbcSurface = new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, new - org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return CustomSplineWireSurface (strName, dtStart, strCurrency, adblX, adblY, aadblNode, scbcWireSpan, - scbcSurface); - } - - /** - * Construct a Scenario Market Surface off of KLK Rational Linear Wire Spline and KLK Rational Linear - * Surface Spline. - * - * @param strName Name of the Volatility Surface - * @param dtStart Start/Epoch Julian Date - * @param strCurrency Currency - * @param adblX Array of X Ordinates - * @param astrTenor Array of Maturity Tenors - * @param aadblNode Double Array of the Surface Nodes - * @param dblTension The Tension Parameter - * - * @return Instance of the Market Node Surface - */ - - public static final org.drip.analytics.definition.MarketSurface KLKRationalLinearWireSurface ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final double[] adblX, - final java.lang.String[] astrTenor, - final double[][] aadblNode, - final double dblTension) - { - if (null == astrTenor) return null; - - int iNumTenor = astrTenor.length; - double[] adblY = new double[iNumTenor]; - org.drip.spline.params.SegmentCustomBuilderControl scbcSurface = null; - org.drip.spline.params.SegmentCustomBuilderControl scbcWireSpan = null; - - if (0 == iNumTenor) return null; - - for (int i = 0; i < iNumTenor; ++i) - adblY[i] = dtStart.addTenor (astrTenor[i]).julian(); - - try { - scbcWireSpan = new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_RATIONAL_LINEAR_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null); - - scbcSurface = new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_RATIONAL_LINEAR_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return CustomSplineWireSurface (strName, dtStart, strCurrency, adblX, adblY, aadblNode, scbcWireSpan, - scbcSurface); - } - - /** - * Construct a Scenario Market Surface off of KLK Rational Quadratic Wire Spline and KLK Rational - * Quadratic Surface Spline. - * - * @param strName Name of the Volatility Surface - * @param dtStart Start/Epoch Julian Date - * @param strCurrency Currency - * @param adblX Array of X Ordinates - * @param astrTenor Array of Maturity Tenors - * @param aadblNode Double Array of the Surface Nodes - * @param dblTension The Tension Parameter - * - * @return Instance of the Market Node Surface - */ - - public static final org.drip.analytics.definition.MarketSurface KLKRationalQuadraticWireSurface ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final double[] adblX, - final java.lang.String[] astrTenor, - final double[][] aadblNode, - final double dblTension) - { - if (null == astrTenor) return null; - - int iNumTenor = astrTenor.length; - double[] adblY = new double[iNumTenor]; - org.drip.spline.params.SegmentCustomBuilderControl scbcSurface = null; - org.drip.spline.params.SegmentCustomBuilderControl scbcWireSpan = null; - - if (0 == iNumTenor) return null; - - for (int i = 0; i < iNumTenor; ++i) - adblY[i] = dtStart.addTenor (astrTenor[i]).julian(); - - try { - scbcWireSpan = new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_RATIONAL_QUADRATIC_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null); - - scbcSurface = new org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_RATIONAL_QUADRATIC_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - return CustomSplineWireSurface (strName, dtStart, strCurrency, adblX, adblY, aadblNode, scbcWireSpan, - scbcSurface); - } - - /** - * Construct a Scenario Market Surface off of Custom Wire Spline and Custom Surface Spline. - * - * @param strName Name of the Volatility Surface - * @param dtStart Start/Epoch Julian Date - * @param strCurrency Currency - * @param adblX Array of X Ordinates - * @param astrTenor Array of Maturity Tenors - * @param aadblNode Double Array of the Surface Nodes - * @param scbcWireSpan The Wire Span Segment Customizer - * @param scbcSurface The Surface Segment Customizer - * - * @return Instance of the Market Node Surface - */ - - public static final org.drip.analytics.definition.MarketSurface CustomWireSurface ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final double[] adblX, - final java.lang.String[] astrTenor, - final double[][] aadblNode, - final org.drip.spline.params.SegmentCustomBuilderControl scbcWireSpan, - final org.drip.spline.params.SegmentCustomBuilderControl scbcSurface) - { - if (null == astrTenor) return null; - - int iNumTenor = astrTenor.length; - double[] adblY = new double[iNumTenor]; - - if (0 == iNumTenor) return null; - - for (int i = 0; i < iNumTenor; ++i) - adblY[i] = dtStart.addTenor (astrTenor[i]).julian(); - - return CustomSplineWireSurface (strName, dtStart, strCurrency, adblX, adblY, aadblNode, scbcWireSpan, - scbcSurface); - } - - /** - * Create a Price/Volatility Market Surface Based off of a Single Run using the Heston 1993 Model - * - * @param strName Surface Name - * @param dtStart Epoch/Start Date - * @param strCurrency Currency - * @param dblRiskFreeRate Risk-Free Rate - * @param dblUnderlier The Underlier - * @param bIsForward TRUE - The Underlier represents the Forward, FALSE - it represents Spot - * @param dblInitialVolatility Initial Volatility - * @param adblStrike Array of Strikes - * @param astrTenor Array of Maturity Tenors - * @param fphp The Heston Stochastic Volatility Generation Parameters - * @param bPriceSurface TRUE - Generate the Price Surface; FALSE - Generate the Vol Surface - * @param scbcWireSpan The Wire Span Segment Customizer - * @param scbcSurface The Surface Segment Customizer - * - * @return Instance of the Market Node Surface - */ - - public static final org.drip.analytics.definition.MarketSurface HestonRunMarketSurface ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final double dblRiskFreeRate, - final double dblUnderlier, - final boolean bIsForward, - final double dblInitialVolatility, - final double[] adblStrike, - final java.lang.String[] astrTenor, - final org.drip.param.pricer.HestonOptionPricerParams fphp, - final boolean bPriceSurface, - final org.drip.spline.params.SegmentCustomBuilderControl scbcWireSpan, - final org.drip.spline.params.SegmentCustomBuilderControl scbcSurface) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblRiskFreeRate) || - !org.drip.quant.common.NumberUtil.IsValid (dblUnderlier) || - !org.drip.quant.common.NumberUtil.IsValid (dblInitialVolatility) || null == adblStrike || - null == astrTenor || null == fphp) - return null; - - int iStrike = 0; - int iNumTenor = astrTenor.length; - int iNumStrike = adblStrike.length; - double[][] aadblImpliedNode = new double[iNumStrike][iNumTenor]; - org.drip.pricer.option.HestonStochasticVolatilityAlgorithm hsva = null; - - try { - hsva = new org.drip.pricer.option.HestonStochasticVolatilityAlgorithm (fphp); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (0 == iNumTenor || 0 == iNumStrike) return null; - - for (double dblStrike : adblStrike) { - int iTenor = 0; - - for (java.lang.String strTenor : astrTenor) { - try { - double dblTimeToExpiry = org.drip.analytics.support.Helper.TenorToYearFraction - (strTenor); - - org.drip.pricer.option.Greeks callGreeks = hsva.greeks (dblStrike, dblTimeToExpiry, - dblRiskFreeRate, dblUnderlier, false, bIsForward, dblInitialVolatility); - - if (null == callGreeks) return null; - - aadblImpliedNode[iStrike][iTenor++] = bPriceSurface ? callGreeks.price() : new - org.drip.pricer.option.BlackScholesAlgorithm().impliedVolatilityFromPrice - (dblStrike, dblTimeToExpiry, dblRiskFreeRate, dblUnderlier, false, false, - callGreeks.price()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - ++iStrike; - } - - return CustomWireSurface (strName, dtStart, strCurrency, adblStrike, astrTenor, aadblImpliedNode, - scbcWireSpan, scbcSurface); - } -} diff --git a/org/drip/state/creator/ScenarioRepoCurveBuilder.java b/org/drip/state/creator/ScenarioRepoCurveBuilder.java deleted file mode 100644 index 48c0169..0000000 --- a/org/drip/state/creator/ScenarioRepoCurveBuilder.java +++ /dev/null @@ -1,340 +0,0 @@ - -package org.drip.state.creator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ScenarioRepoCurveBuilder implements the Construction of the Scenario Repo Curve using the Input - * Instruments and their Quotes. - * - * @author Lakshmi Krishnamurthy - */ - -public class ScenarioRepoCurveBuilder { - - /** - * Create an Instance of the Custom Splined Repo Curve - * - * @param strName Curve Name - * @param dtSpot The Spot Date - * @param comp The Underlying Repo Component - * @param aiDate Array of the Dates - * @param adblRepo Array of the Repo Rates - * @param scbc The Segment Custom Builder Control - * - * @return The Instance of the Custom Splined Repo Curve - */ - - public static final org.drip.state.repo.RepoCurve CustomSplineRepoCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.product.definition.Component comp, - final int[] aiDate, - final double[] adblRepo, - final org.drip.spline.params.SegmentCustomBuilderControl scbc) - { - if (null == strName || null == dtSpot || strName.isEmpty() || null == aiDate || null == adblRepo) - return null; - - int iNumInstrument = aiDate.length; - int[] aiBasisPredictorOrdinate = new int[iNumInstrument + 1]; - double[] adblBasisResponseValue = new double[iNumInstrument + 1]; - org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC = new - org.drip.spline.params.SegmentCustomBuilderControl[iNumInstrument]; - - if (0 == iNumInstrument || iNumInstrument != adblRepo.length) return null; - - for (int i = 0; i <= iNumInstrument; ++i) { - aiBasisPredictorOrdinate[i] = 0 == i ? dtSpot.julian() : aiDate[i - 1]; - - adblBasisResponseValue[i] = 0 == i ? adblRepo[0] : adblRepo[i - 1]; - - if (0 != i) aSCBC[i - 1] = scbc; - } - - try { - return new org.drip.state.curve.BasisSplineRepoCurve (comp, new - org.drip.spline.grid.OverlappingStretchSpan - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - (strName, aiBasisPredictorOrdinate, adblBasisResponseValue, aSCBC, null, - org.drip.spline.stretch.BoundarySettings.NaturalStandard(), - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the Cubic Polynomial Splined Repo Curve - * - * @param strName Curve Name - * @param dtSpot The Spot Date - * @param comp The Underlying Repo Component - * @param aiDate Array of the Dates - * @param adblRepo Array of the Repo Rates - * - * @return The Instance of the Basis Curve - */ - - public static final org.drip.state.repo.RepoCurve CubicPolynomialRepoCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.product.definition.Component comp, - final int[] aiDate, - final double[] adblRepo) - { - try { - return CustomSplineRepoCurve (strName, dtSpot, comp, aiDate, adblRepo, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (4), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the Quartic Polynomial Splined Repo Curve - * - * @param strName Curve Name - * @param dtSpot The Spot Date - * @param comp The Underlying Repo Component - * @param aiDate Array of the Dates - * @param adblRepo Array of the Repo Rates - * - * @return The Instance of the Splined Repo Curve - */ - - public static final org.drip.state.repo.RepoCurve QuarticPolynomialRepoCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.product.definition.Component comp, - final int[] aiDate, - final double[] adblRepo) - { - try { - return CustomSplineRepoCurve (strName, dtSpot, comp, aiDate, adblRepo, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (5), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the Kaklis-Pandelis Splined Repo Curve - * - * @param strName Curve Name - * @param dtSpot The Spot Date - * @param comp The Underlying Repo Component - * @param aiDate Array of the Dates - * @param adblRepo Array of the Repo Rates - * - * @return The Instance of the Splined Repo Curve - */ - - public static final org.drip.state.repo.RepoCurve KaklisPandelisRepoCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.product.definition.Component comp, - final int[] aiDate, - final double[] adblRepo) - { - try { - return CustomSplineRepoCurve (strName, dtSpot, comp, aiDate, adblRepo, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KAKLIS_PANDELIS, new - org.drip.spline.basis.KaklisPandelisSetParams (2), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the KLK Hyperbolic Splined Repo Curve - * - * @param strName Curve Name - * @param dtSpot The Spot Date - * @param comp The Underlying Repo Component - * @param aiDate Array of the Dates - * @param adblRepo Array of the Repo Rates - * @param dblTension The Tension Parameter - * - * @return The Instance of the Splined Repo Curve - */ - - public static final org.drip.state.repo.RepoCurve KLKHyperbolicRepoCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.product.definition.Component comp, - final int[] aiDate, - final double[] adblRepo, - final double dblTension) - { - try { - return CustomSplineRepoCurve (strName, dtSpot, comp, aiDate, adblRepo, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the KLK Rational Linear Splined Repo Curve - * - * @param strName Curve Name - * @param dtSpot The Spot Date - * @param comp The Underlying Repo Component - * @param aiDate Array of the Dates - * @param adblRepo Array of the Repo Rates - * @param dblTension The Tension Parameter - * - * @return The Instance of the Repo Curve - */ - - public static final org.drip.state.repo.RepoCurve KLKRationalLinearRepoCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.product.definition.Component comp, - final int[] aiDate, - final double[] adblRepo, - final double dblTension) - { - try { - return CustomSplineRepoCurve (strName, dtSpot, comp, aiDate, adblRepo, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_RATIONAL_LINEAR_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create an Instance of the KLK Rational Quadratic Splined Repo Curve - * - * @param strName Curve Name - * @param dtSpot The Spot Date - * @param comp The Underlying Repo Component - * @param aiDate Array of the Dates - * @param adblRepo Array of the Repo Rates - * @param dblTension The Tension Parameter - * - * @return The Instance of the Repo Curve - */ - - public static final org.drip.state.repo.RepoCurve KLKRationalQuadraticRepoCurve ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.product.definition.Component comp, - final int[] aiDate, - final double[] adblRepo, - final double dblTension) - { - try { - return CustomSplineRepoCurve (strName, dtSpot, comp, aiDate, adblRepo, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_RATIONAL_QUADRATIC_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Repo Curve using the Flat Repo Rate - * - * @param dtSpot Spot Date - * @param comp Repo Component - * @param dblRepoRate The Flat Repo Rate - * - * @return The Flat Repo Rate Curve - */ - - public static final org.drip.state.repo.RepoCurve FlatRateRepoCurve ( - final org.drip.analytics.date.JulianDate dtSpot, - final org.drip.product.definition.Component comp, - final double dblRepoRate) - { - if (null == dtSpot) return null; - - int iEpochDate = dtSpot.julian(); - - try { - return new org.drip.state.nonlinear.FlatForwardRepoCurve (iEpochDate, comp, new int[] - {iEpochDate}, new double[] {dblRepoRate}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/state/creator/ScenarioTermStructureBuilder.java b/org/drip/state/creator/ScenarioTermStructureBuilder.java deleted file mode 100644 index 67e1d2f..0000000 --- a/org/drip/state/creator/ScenarioTermStructureBuilder.java +++ /dev/null @@ -1,367 +0,0 @@ - -package org.drip.state.creator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ScenarioTermStructureBuilder implements the construction of the basis spline term structure using the - * input instruments and their quotes. - * - * @author Lakshmi Krishnamurthy - */ - -public class ScenarioTermStructureBuilder { - - /** - * Construct a Term Structure Instance using the specified Custom Spline - * - * @param strName Name of the the Term Structure Instance - * @param dtStart The Start Date - * @param strCurrency Currency - * @param adblDate Array of Dates - * @param adblNode Array of Term Structure Nodes - * @param scbc Segment Custom Builder Parameters - * - * @return Instance of the Term Structure - */ - - public static final org.drip.analytics.definition.NodeStructure CustomSplineTermStructure ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final double[] adblDate, - final double[] adblNode, - final org.drip.spline.params.SegmentCustomBuilderControl scbc) - { - if (null == strName || strName.isEmpty() || null == dtStart || null == adblDate || null == adblNode - || null == scbc) - return null; - - int iNumDate = adblDate.length; - org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC = new - org.drip.spline.params.SegmentCustomBuilderControl[iNumDate - 1]; - - if (0 == iNumDate || iNumDate != adblNode.length) return null; - - for (int i = 0; i < iNumDate - 1; ++i) - aSCBC[i] = scbc; - - try { - return new org.drip.state.curve.BasisSplineTermStructure (dtStart.julian(), - org.drip.state.identifier.CustomLabel.Standard (strName), strCurrency, new - org.drip.spline.grid.OverlappingStretchSpan - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - (strName, adblDate, adblNode, aSCBC, null, - org.drip.spline.stretch.BoundarySettings.NaturalStandard(), - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE))); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Term Structure Instance based off of a Cubic Polynomial Spline - * - * @param strName Name of the the Term Structure Instance - * @param dtStart The Start Date - * @param strCurrency Currency - * @param astrTenor Array of Tenors - * @param adblNode Array of Term Structure Nodes - * - * @return The Term Structure Instance based off of a Cubic Polynomial Spline - */ - - public static final org.drip.analytics.definition.NodeStructure CubicPolynomialTermStructure ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final java.lang.String[] astrTenor, - final double[] adblNode) - { - if (null == dtStart || null == astrTenor) return null; - - int iNumTenor = astrTenor.length; - double[] adblDate = new double[iNumTenor]; - - if (0 == iNumTenor) return null; - - for (int i = 0; i < iNumTenor; ++i) - adblDate[i] = dtStart.addTenor (astrTenor[i]).julian(); - - try { - return CustomSplineTermStructure (strName, dtStart, strCurrency, adblDate, adblNode, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (4), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Term Structure Instance based off of a Quartic Polynomial Spline - * - * @param strName Name of the the Term Structure Instance - * @param dtStart The Start Date - * @param strCurrency Currency - * @param astrTenor Array of Tenors - * @param adblNode Array of Term Structure Nodes - * - * @return The Term Structure Instance based off of a Quartic Polynomial Spline - */ - - public static final org.drip.analytics.definition.NodeStructure QuarticPolynomialTermStructure ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final java.lang.String[] astrTenor, - final double[] adblNode) - { - if (null == dtStart || null == astrTenor) return null; - - int iNumTenor = astrTenor.length; - double[] adblDate = new double[iNumTenor]; - - if (0 == iNumTenor) return null; - - for (int i = 0; i < iNumTenor; ++i) - adblDate[i] = dtStart.addTenor (astrTenor[i]).julian(); - - try { - return CustomSplineTermStructure (strName, dtStart, strCurrency, adblDate, adblNode, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (5), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Term Structure Instance based off of a Kaklis-Pandelis Polynomial Tension Spline - * - * @param strName Name of the the Term Structure Instance - * @param dtStart The Start Date - * @param strCurrency Currency - * @param astrTenor Array of Tenors - * @param adblNode Array of Term Structure Nodes - * - * @return The Term Structure Instance based off of a Kaklis-Pandelis Polynomial Tension Spline - */ - - public static final org.drip.analytics.definition.NodeStructure KaklisPandelisTermStructure ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final java.lang.String[] astrTenor, - final double[] adblNode) - { - if (null == dtStart || null == astrTenor) return null; - - int iNumTenor = astrTenor.length; - double[] adblDate = new double[iNumTenor]; - - if (0 == iNumTenor) return null; - - for (int i = 0; i < iNumTenor; ++i) - adblDate[i] = dtStart.addTenor (astrTenor[i]).julian(); - - try { - return CustomSplineTermStructure (strName, dtStart, strCurrency, adblDate, adblNode, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KAKLIS_PANDELIS, new - org.drip.spline.basis.KaklisPandelisSetParams (2), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Term Structure Instance based off of a KLK Hyperbolic Tension Spline - * - * @param strName Name of the the Term Structure Instance - * @param dtStart The Start Date - * @param strCurrency Currency - * @param astrTenor Array of Tenors - * @param adblNode Array of Term Structure Nodes - * @param dblTension Tension - * - * @return The Term Structure Instance based off of a KLK Hyperbolic Tension Spline - */ - - public static final org.drip.analytics.definition.NodeStructure KLKHyperbolicTermStructure ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final java.lang.String[] astrTenor, - final double[] adblNode, - final double dblTension) - { - if (null == dtStart || null == astrTenor) return null; - - int iNumTenor = astrTenor.length; - double[] adblDate = new double[iNumTenor]; - - if (0 == iNumTenor) return null; - - for (int i = 0; i < iNumTenor; ++i) - adblDate[i] = dtStart.addTenor (astrTenor[i]).julian(); - - try { - return CustomSplineTermStructure (strName, dtStart, strCurrency, adblDate, adblNode, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Term Structure Instance based off of a KLK Rational Linear Tension Spline - * - * @param strName Name of the the Term Structure Instance - * @param dtStart The Start Date - * @param strCurrency Currency - * @param astrTenor Array of Tenors - * @param adblNode Array of Term Structure Nodes - * @param dblTension Tension - * - * @return The Term Structure Instance based off of a KLK Rational Linear Tension Spline - */ - - public static final org.drip.analytics.definition.NodeStructure KLKRationalLinearTermStructure ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final java.lang.String[] astrTenor, - final double[] adblNode, - final double dblTension) - { - if (null == dtStart || null == astrTenor) return null; - - int iNumTenor = astrTenor.length; - double[] adblDate = new double[iNumTenor]; - - if (0 == iNumTenor) return null; - - for (int i = 0; i < iNumTenor; ++i) - adblDate[i] = dtStart.addTenor (astrTenor[i]).julian(); - - try { - return CustomSplineTermStructure (strName, dtStart, strCurrency, adblDate, adblNode, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_RATIONAL_LINEAR_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Term Structure Instance based off of a KLK Rational Quadratic Tension Spline - * - * @param strName Name of the the Term Structure Instance - * @param dtStart The Start Date - * @param strCurrency Currency - * @param astrTenor Array of Tenors - * @param adblNode Array of Term Structure Nodes - * @param dblTension Tension - * - * @return The Term Structure Instance based off of a KLK Rational Quadratic Tension Spline - */ - - public static final org.drip.analytics.definition.NodeStructure KLKRationalQuadraticTermStructure ( - final java.lang.String strName, - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final java.lang.String[] astrTenor, - final double[] adblNode, - final double dblTension) - { - if (null == dtStart || null == astrTenor) return null; - - int iNumTenor = astrTenor.length; - double[] adblDate = new double[iNumTenor]; - - if (0 == iNumTenor) return null; - - for (int i = 0; i < iNumTenor; ++i) - adblDate[i] = dtStart.addTenor (astrTenor[i]).julian(); - - try { - return CustomSplineTermStructure (strName, dtStart, strCurrency, adblDate, adblNode, new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_RATIONAL_QUADRATIC_TENSION, - new org.drip.spline.basis.ExponentialTensionSetParams (dblTension), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/state/credit/CreditCurve.java b/org/drip/state/credit/CreditCurve.java deleted file mode 100644 index 4cbbb33..0000000 --- a/org/drip/state/credit/CreditCurve.java +++ /dev/null @@ -1,572 +0,0 @@ - -package org.drip.state.credit; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * CreditCurve is the stub for the survival curve functionality. It extends the Curve object by exposing the - * following functions: - * - Set of curve and market identifiers - * - Recovery to a specific date/tenor, and effective recovery between a date interval - * - Hazard Rate to a specific date/tenor, and effective hazard rate between a date interval - * - Survival to a specific date/tenor, and effective survival between a date interval - * - Set/unset date of specific default - * - Generate scenario curves from the base credit curve (flat/parallel/custom) - * - Set/unset the Curve Construction Inputs, Latent State, and the Manifest Metrics - * - Serialization/De-serialization to and from Byte Arrays - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class CreditCurve implements org.drip.analytics.definition.Curve { - private static final int NUM_DF_QUADRATURES = 5; - - protected java.lang.String _strCurrency = ""; - protected int _iEpochDate = java.lang.Integer.MIN_VALUE; - protected org.drip.state.identifier.CreditLabel _label = null; - protected int _iSpecificDefaultDate = java.lang.Integer.MIN_VALUE; - - /* - * Manifest Measure Inputs that go into building the Curve Span - */ - - protected boolean _bFlat = false; - protected double[] _adblCalibQuote = null; - protected java.lang.String[] _astrCalibMeasure = null; - protected org.drip.state.govvie.GovvieCurve _gc = null; - protected org.drip.state.discount.MergedDiscountForwardCurve _dc = null; - protected org.drip.param.valuation.ValuationParams _valParam = null; - protected org.drip.param.pricer.CreditPricerParams _pricerParam = null; - protected org.drip.param.market.LatentStateFixingsContainer _lsfc = null; - protected org.drip.product.definition.CalibratableComponent[] _aCalibInst = null; - protected org.drip.param.valuation.ValuationCustomizationParams _quotingParams = null; - protected org.drip.analytics.support.CaseInsensitiveTreeMap _mapMeasure = null; - protected org.drip.analytics.support.CaseInsensitiveTreeMap> - _mapQuote = null; - - protected CreditCurve ( - final int iEpochDate, - final org.drip.state.identifier.CreditLabel label, - final java.lang.String strCurrency) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_iEpochDate = iEpochDate) || null == (_label = - label) || null == (_strCurrency = strCurrency) || _strCurrency.isEmpty()) - throw new java.lang.Exception ("CreditCurve ctr: Invalid Inputs"); - } - - @Override public org.drip.state.identifier.LatentStateLabel label() - { - return _label; - } - - @Override public java.lang.String currency() - { - return _strCurrency; - } - - @Override public org.drip.analytics.date.JulianDate epoch() - { - try { - return new org.drip.analytics.date.JulianDate (_iEpochDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Set the Specific Default Date - * - * @param iSpecificDefaultDate Date of Specific Default - * - * @return TRUE if successful - */ - - public boolean setSpecificDefault ( - final int iSpecificDefaultDate) - { - _iSpecificDefaultDate = iSpecificDefaultDate; - return true; - } - - /** - * Remove the Specific Default Date - * - * @return TRUE if successful - */ - - public boolean unsetSpecificDefault() - { - _iSpecificDefaultDate = java.lang.Integer.MIN_VALUE; - return true; - } - - /** - * Calculate the survival to the given date - * - * @param iDate Date - * - * @return Survival Probability - * - * @throws java.lang.Exception Thrown if the survival probability cannot be calculated - */ - - public abstract double survival ( - final int iDate) - throws java.lang.Exception; - - /** - * Calculate the survival to the given date - * - * @param dt Date - * - * @return Survival Probability - * - * @throws java.lang.Exception Thrown if the survival probability cannot be calculated - */ - - public double survival ( - final org.drip.analytics.date.JulianDate dt) - throws java.lang.Exception - { - if (null == dt) throw new java.lang.Exception ("CreditCurve::survival => Invalid Date"); - - return survival (dt.julian()); - } - - /** - * Calculate the survival to the given tenor - * - * @param strTenor Tenor - * - * @return Survival Probability - * - * @throws java.lang.Exception Thrown if the survival probability cannot be calculated - */ - - public double survival ( - final java.lang.String strTenor) - throws java.lang.Exception - { - if (null == strTenor || strTenor.isEmpty()) - throw new java.lang.Exception ("CreditCurve::survival => Bad tenor"); - - return survival (new org.drip.analytics.date.JulianDate (_iEpochDate).addTenor (strTenor)); - } - - /** - * Calculate the time-weighted survival between a pair of 2 dates - * - * @param iDate1 First Date - * @param iDate2 Second Date - * - * @return Survival Probability - * - * @throws java.lang.Exception Thrown if the survival probability cannot be calculated - */ - - public double effectiveSurvival ( - final int iDate1, - final int iDate2) - throws java.lang.Exception - { - if (iDate1 == iDate2) return survival (iDate1); - - int iNumQuadratures = 0; - double dblEffectiveSurvival = 0.; - int iQuadratureWidth = (iDate2 - iDate1) / NUM_DF_QUADRATURES; - - for (int iDate = iDate1; iDate <= iDate2; iDate += iQuadratureWidth) { - ++iNumQuadratures; - - dblEffectiveSurvival += (survival (iDate) + survival (iDate + iQuadratureWidth)); - } - - return dblEffectiveSurvival / (2. * iNumQuadratures); - } - - /** - * Calculate the time-weighted survival between a pair of 2 dates - * - * @param dt1 First Date - * @param dt2 Second Date - * - * @return Survival Probability - * - * @throws java.lang.Exception Thrown if the survival probability cannot be calculated - */ - - public double effectiveSurvival ( - final org.drip.analytics.date.JulianDate dt1, - final org.drip.analytics.date.JulianDate dt2) - throws java.lang.Exception - { - if (null == dt1 || null == dt2) - throw new java.lang.Exception ("CreditCurve::effectiveSurvival => Invalid date"); - - return effectiveSurvival (dt1.julian(), dt2.julian()); - } - - /** - * Calculate the time-weighted survival between a pair of 2 tenors - * - * @param strTenor1 First tenor - * @param strTenor2 Second tenor - * - * @return Survival Probability - * - * @throws java.lang.Exception Thrown if the survival probability cannot be calculated - */ - - public double effectiveSurvival ( - final java.lang.String strTenor1, - final java.lang.String strTenor2) - throws java.lang.Exception - { - if (null == strTenor1 || strTenor1.isEmpty() || null == strTenor2 || strTenor2.isEmpty()) - throw new java.lang.Exception ("CreditCurve::effectiveSurvival => bad tenor"); - - return effectiveSurvival (new org.drip.analytics.date.JulianDate (_iEpochDate).addTenor - (strTenor1), new org.drip.analytics.date.JulianDate (_iEpochDate).addTenor (strTenor2)); - } - - /** - * Calculate the recovery rate to the given date - * - * @param iDate Date - * - * @return Recovery Rate - * - * @throws java.lang.Exception Thrown if the Recovery rate cannot be calculated - */ - - public abstract double recovery ( - final int iDate) - throws java.lang.Exception; - - /** - * Calculate the recovery rate to the given date - * - * @param dt Date - * - * @return Recovery Rate - * - * @throws java.lang.Exception Thrown if the Recovery rate cannot be calculated - */ - - public double recovery ( - final org.drip.analytics.date.JulianDate dt) - throws java.lang.Exception - { - if (null == dt) throw new java.lang.Exception ("CreditCurve::recovery => Invalid Date"); - - return recovery (dt.julian()); - } - - /** - * Calculate the recovery rate to the given tenor - * - * @param strTenor Tenor - * - * @return Recovery Rate - * - * @throws java.lang.Exception Thrown if the Recovery rate cannot be calculated - */ - - public double recovery ( - final java.lang.String strTenor) - throws java.lang.Exception - { - if (null == strTenor || strTenor.isEmpty()) - throw new java.lang.Exception ("CreditCurve::recovery => Invalid Tenor"); - - return recovery (new org.drip.analytics.date.JulianDate (_iEpochDate).addTenor (strTenor)); - } - - /** - * Calculate the time-weighted recovery between a pair of dates - * - * @param iDate1 First Date - * @param iDate2 Second Date - * - * @return Time-weighted recovery - * - * @throws java.lang.Exception Thrown if the recovery cannot be calculated - */ - - public double effectiveRecovery ( - final int iDate1, - final int iDate2) - throws java.lang.Exception - { - if (iDate1 == iDate2) return recovery (iDate1); - - int iNumQuadratures = 0; - double dblEffectiveRecovery = 0.; - int iQuadratureWidth = (iDate2 - iDate1) / NUM_DF_QUADRATURES; - - if (0 == iQuadratureWidth) iQuadratureWidth = 1; - - for (int iDate = iDate1; iDate <= iDate2; iDate += iQuadratureWidth) { - ++iNumQuadratures; - - dblEffectiveRecovery += (recovery (iDate) + recovery (iDate + iQuadratureWidth)); - } - - return dblEffectiveRecovery / (2. * iNumQuadratures); - } - - /** - * Calculate the time-weighted recovery between a pair of dates - * - * @param dt1 First Date - * @param dt2 Second Date - * - * @return Time-weighted recovery - * - * @throws java.lang.Exception Thrown if the recovery cannot be calculated - */ - - public double effectiveRecovery ( - final org.drip.analytics.date.JulianDate dt1, - final org.drip.analytics.date.JulianDate dt2) - throws java.lang.Exception - { - if (null == dt1 || null == dt2) - throw new java.lang.Exception ("CreditCurve::effectiveRecovery => Invalid date"); - - return effectiveRecovery (dt1.julian(), dt2.julian()); - } - - /** - * Calculate the time-weighted recovery between a pair of tenors - * - * @param strTenor1 First Tenor - * @param strTenor2 Second Tenor - * - * @return Time-weighted recovery - * - * @throws java.lang.Exception Thrown if the recovery cannot be calculated - */ - - public double effectiveRecovery ( - final java.lang.String strTenor1, - final java.lang.String strTenor2) - throws java.lang.Exception - { - if (null == strTenor1 || strTenor1.isEmpty() || null == strTenor2 || strTenor2.isEmpty()) - throw new java.lang.Exception ("CreditCurve::effectiveRecovery => Invalid tenor"); - - return effectiveRecovery (new org.drip.analytics.date.JulianDate (_iEpochDate).addTenor - (strTenor1), new org.drip.analytics.date.JulianDate (_iEpochDate).addTenor (strTenor2)); - } - - /** - * Calculate the hazard rate between a pair of forward dates - * - * @param dt1 First Date - * @param dt2 Second Date - * - * @return Hazard Rate - * - * @throws java.lang.Exception Thrown if the hazard rate cannot be calculated - */ - - public double hazard ( - final org.drip.analytics.date.JulianDate dt1, - final org.drip.analytics.date.JulianDate dt2) - throws java.lang.Exception - { - if (null == dt1 || null == dt2) - throw new java.lang.Exception ("CreditCurve::hazard => Invalid dates"); - - if (dt1.julian() < _iEpochDate || dt2.julian() < _iEpochDate) return 0.; - - return 365.25 / (dt2.julian() - dt1.julian()) * java.lang.Math.log (survival (dt1) / survival (dt2)); - } - - /** - * Calculate the hazard rate to the given date - * - * @param dt Date - * - * @return Hazard Rate - * - * @throws java.lang.Exception Thrown if the hazard rate cannot be calculated - */ - - public double hazard ( - final org.drip.analytics.date.JulianDate dt) - throws java.lang.Exception - { - return hazard (dt, new org.drip.analytics.date.JulianDate (_iEpochDate)); - } - - /** - * Calculate the hazard rate to the given tenor - * - * @param strTenor Tenor - * - * @return Hazard Rate - * - * @throws java.lang.Exception Thrown if the hazard rate cannot be calculated - */ - - public double hazard ( - final java.lang.String strTenor) - throws java.lang.Exception - { - if (null == strTenor || strTenor.isEmpty()) - throw new java.lang.Exception ("CreditCurve::hazard => Bad Tenor"); - - return hazard (new org.drip.analytics.date.JulianDate (_iEpochDate).addTenor (strTenor)); - } - - /** - * Create a flat hazard curve from the inputs - * - * @param dblFlatNodeValue Flat hazard node value - * @param bSingleNode Uses a single node for Calibration (True) - * @param dblRecovery (Optional) Recovery to be used in creation of the flat curve - * - * @return New CreditCurve instance - */ - - public abstract CreditCurve flatCurve ( - final double dblFlatNodeValue, - final boolean bSingleNode, - final double dblRecovery); - - /** - * Set the calibration inputs for the CreditCurve - * - * @param valParam ValuationParams - * @param bFlat Flat calibration desired (True) - * @param dc Base Discount Curve - * @param gc Govvie Curve - * @param pricerParam PricerParams - * @param aCalibInst Array of calibration instruments - * @param adblCalibQuote Array of calibration quotes - * @param astrCalibMeasure Array of calibration measures - * @param lsfc Latent State Fixings Container - * @param quotingParams Quoting Parameters - */ - - public void setInstrCalibInputs ( - final org.drip.param.valuation.ValuationParams valParam, - final boolean bFlat, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.state.govvie.GovvieCurve gc, - final org.drip.param.pricer.CreditPricerParams pricerParam, - final org.drip.product.definition.CalibratableComponent[] aCalibInst, - final double[] adblCalibQuote, - final java.lang.String[] astrCalibMeasure, - final org.drip.param.market.LatentStateFixingsContainer lsfc, - final org.drip.param.valuation.ValuationCustomizationParams quotingParams) - { - _dc = dc; - _gc = gc; - _lsfc = lsfc; - _bFlat = bFlat; - _valParam = valParam; - _aCalibInst = aCalibInst; - _pricerParam = pricerParam; - _quotingParams = quotingParams; - _adblCalibQuote = adblCalibQuote; - _astrCalibMeasure = astrCalibMeasure; - - _mapQuote = new - org.drip.analytics.support.CaseInsensitiveTreeMap>(); - - _mapMeasure = new org.drip.analytics.support.CaseInsensitiveTreeMap(); - - for (int i = 0; i < aCalibInst.length; ++i) { - _mapMeasure.put (_aCalibInst[i].primaryCode(), astrCalibMeasure[i]); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapManifestMeasureCalibQuote - = new org.drip.analytics.support.CaseInsensitiveTreeMap(); - - mapManifestMeasureCalibQuote.put (_astrCalibMeasure[i], adblCalibQuote[i]); - - _mapQuote.put (_aCalibInst[i].primaryCode(), mapManifestMeasureCalibQuote); - - java.lang.String[] astrSecCode = _aCalibInst[i].secondaryCode(); - - if (null != astrSecCode) { - for (int j = 0; j < astrSecCode.length; ++j) - _mapQuote.put (astrSecCode[j], mapManifestMeasureCalibQuote); - } - } - } - - @Override public boolean setCCIS ( - final org.drip.analytics.input.CurveConstructionInputSet ccis) - { - return false; - } - - @Override public org.drip.product.definition.CalibratableComponent[] calibComp() - { - return _aCalibInst; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap manifestMeasure ( - final java.lang.String strInstr) - { - if (null == _mapQuote || 0 == _mapQuote.size() || null == strInstr || strInstr.isEmpty() || - !_mapQuote.containsKey (strInstr)) - return null; - - return _mapQuote.get (strInstr); - } -} diff --git a/org/drip/state/credit/ExplicitBootCreditCurve.java b/org/drip/state/credit/ExplicitBootCreditCurve.java deleted file mode 100644 index 5be1e31..0000000 --- a/org/drip/state/credit/ExplicitBootCreditCurve.java +++ /dev/null @@ -1,71 +0,0 @@ - -package org.drip.state.credit; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * ExplicitBootCreditCurve exposes the functionality associated with the bootstrapped Credit Curve. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class ExplicitBootCreditCurve extends org.drip.state.credit.CreditCurve implements - org.drip.analytics.definition.ExplicitBootCurve { - - protected ExplicitBootCreditCurve ( - final int iEpochDate, - final org.drip.state.identifier.CreditLabel label, - final java.lang.String strCurrency) - throws java.lang.Exception - { - super (iEpochDate, label, strCurrency); - } -} diff --git a/org/drip/state/curve/BasisSplineBasisCurve.java b/org/drip/state/curve/BasisSplineBasisCurve.java deleted file mode 100644 index 6b26eab..0000000 --- a/org/drip/state/curve/BasisSplineBasisCurve.java +++ /dev/null @@ -1,107 +0,0 @@ - -package org.drip.state.curve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * BasisSplineBasisCurve manages the Basis Latent State, using the Basis as the State Response - * Representation. It exports the following functionality: - * - Calculate implied forward rate / implied forward rate Jacobian - * - * @author Lakshmi Krishnamurthy - */ - -public class BasisSplineBasisCurve extends org.drip.state.basis.BasisCurve { - private org.drip.spline.grid.Span _span = null; - - /** - * BasisSplineBasisCurve constructor - * - * @param friReference The Reference Leg FRI - * @param friDerived The Derived Leg FRI - * @param bBasisOnReference TRUE - Is the Quoted Basis On the Reference Leg/Derived Leg - * @param span The Span over which the Basis Representation is valid - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BasisSplineBasisCurve ( - final org.drip.state.identifier.ForwardLabel friReference, - final org.drip.state.identifier.ForwardLabel friDerived, - final boolean bBasisOnReference, - final org.drip.spline.grid.Span span) - throws java.lang.Exception - { - super ((int) span.left(), friReference, friDerived, bBasisOnReference); - - _span = span; - } - - @Override public double basis ( - final int iDate) - throws java.lang.Exception - { - double dblSpanLeft = _span.left(); - - if (iDate <= dblSpanLeft) return _span.calcResponseValue (dblSpanLeft); - - double dblSpanRight = _span.right(); - - if (iDate >= dblSpanRight) return _span.calcResponseValue (dblSpanRight); - - return _span.calcResponseValue (iDate); - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDForwardDManifestMeasure ( - final java.lang.String strManifestMeasure, - final int iDate) - { - return _span.jackDResponseDManifestMeasure (strManifestMeasure, iDate, 1); - } -} diff --git a/org/drip/state/curve/BasisSplineDeterministicVolatility.java b/org/drip/state/curve/BasisSplineDeterministicVolatility.java deleted file mode 100644 index a1f85ae..0000000 --- a/org/drip/state/curve/BasisSplineDeterministicVolatility.java +++ /dev/null @@ -1,139 +0,0 @@ - -package org.drip.state.curve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * BasisSplineDeterministicVolatility extends the BasisSplineTermStructure for the specific case of the - * Implementation of the Deterministic Volatility Term Structure. - * - * @author Lakshmi Krishnamurthy - */ - -public class BasisSplineDeterministicVolatility extends org.drip.state.volatility.VolatilityCurve { - private org.drip.spline.grid.Span _spanImpliedVolatility = null; - - /** - * BasisSplineDeterministicVolatility Constructor - * - * @param iEpochDate The Epoch Date - * @param label Latent State Label - * @param strCurrency The Currency - * @param spanImpliedVolatility The Implied Volatility Span - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BasisSplineDeterministicVolatility ( - final int iEpochDate, - final org.drip.state.identifier.CustomLabel label, - final java.lang.String strCurrency, - final org.drip.spline.grid.Span spanImpliedVolatility) - throws java.lang.Exception - { - super (iEpochDate, label, strCurrency); - - if (null == (_spanImpliedVolatility = spanImpliedVolatility)) - throw new java.lang.Exception ("BasisSplineDeterministicVolatility ctr: Invalid Inputs"); - } - - @Override public double impliedVol ( - final int iDate) - throws java.lang.Exception - { - double dblSpanLeft = _spanImpliedVolatility.left(); - - if (dblSpanLeft >= iDate) return _spanImpliedVolatility.calcResponseValue (dblSpanLeft); - - double dblSpanRight = _spanImpliedVolatility.right(); - - if (dblSpanRight <= iDate) return _spanImpliedVolatility.calcResponseValue (dblSpanRight); - - return _spanImpliedVolatility.calcResponseValue (iDate); - } - - @Override public double node ( - final int iDate) - throws java.lang.Exception - { - double dblImpliedVol = impliedVol (iDate); - - return java.lang.Math.sqrt (dblImpliedVol * dblImpliedVol + 2. * dblImpliedVol * (iDate - - epoch().julian()) / 365.25 * _spanImpliedVolatility.calcResponseValueDerivative (iDate, 1)); - } - - @Override public double vol ( - final int iDate) - throws java.lang.Exception - { - return node (iDate); - } - - @Override public double nodeDerivative ( - final int iDate, - final int iOrder) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (iDate)) - throw new java.lang.Exception - ("BasisSplineDeterministicVolatility::nodeDerivative => Invalid Inputs"); - - org.drip.function.definition.R1ToR1 au = new org.drip.function.definition.R1ToR1 - (null) { - @Override public double evaluate ( - double dblX) - throws java.lang.Exception - { - return node ((int) dblX); - } - }; - - return au.derivative (iDate, iOrder); - } -} diff --git a/org/drip/state/curve/BasisSplineFXForward.java b/org/drip/state/curve/BasisSplineFXForward.java deleted file mode 100644 index 0883834..0000000 --- a/org/drip/state/curve/BasisSplineFXForward.java +++ /dev/null @@ -1,275 +0,0 @@ - -package org.drip.state.curve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * BasisSplineFXForward manages the Basis Latent State, using the Basis as the State Response - * Representation. - * - * @author Lakshmi Krishnamurthy - */ - -public class BasisSplineFXForward extends org.drip.state.fx.FXCurve { - private org.drip.spline.grid.Span _span = null; - private double _dblFXSpot = java.lang.Double.NaN; - - private double nodeBasis ( - final int iNodeDate, - final org.drip.param.valuation.ValuationParams valParam, - final org.drip.state.discount.MergedDiscountForwardCurve dcNum, - final org.drip.state.discount.MergedDiscountForwardCurve dcDenom, - final boolean bBasisOnDenom) - throws java.lang.Exception - { - return new org.drip.product.fx.FXForwardComponent ("FXFWD_" + - org.drip.quant.common.StringUtil.GUID(), currencyPair(), epoch().julian(), iNodeDate, 1., - null).discountCurveBasis (valParam, dcNum, dcDenom, _dblFXSpot, fx (iNodeDate), - bBasisOnDenom); - } - - /** - * BasisSplineFXForward constructor - * - * @param cp The Currency Pair - * @param span The Span over which the Basis Representation is valid - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BasisSplineFXForward ( - final org.drip.product.params.CurrencyPair cp, - final org.drip.spline.grid.Span span) - throws java.lang.Exception - { - super ((int) span.left(), cp); - - _span = span; - - _dblFXSpot = _span.calcResponseValue (_span.left()); - } - - @Override public double fx ( - final int iDate) - throws java.lang.Exception - { - double dblSpanLeft = _span.left(); - - if (iDate <= dblSpanLeft) return _span.calcResponseValue (dblSpanLeft); - - double dblSpanRight = _span.right(); - - if (iDate >= dblSpanRight) return _span.calcResponseValue (dblSpanRight); - - return _span.calcResponseValue (iDate); - } - - /** - * Retrieve the FX Spot - * - * @return The FX Spot - */ - - public double fxSpot() - { - return _dblFXSpot; - } - - @Override public double[] zeroBasis ( - final int[] aiDateNode, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.discount.MergedDiscountForwardCurve dcNum, - final org.drip.state.discount.MergedDiscountForwardCurve dcDenom, - final boolean bBasisOnDenom) - { - if (null == aiDateNode) return null; - - int iNumBasis = aiDateNode.length; - double[] adblBasis = new double[iNumBasis]; - - if (0 == iNumBasis) return null; - - for (int i = 0; i < iNumBasis; ++i) { - try { - adblBasis[i] = nodeBasis (aiDateNode[i], valParams, dcNum, dcDenom, bBasisOnDenom); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return adblBasis; - } - - @Override public double[] bootstrapBasis ( - final int[] aiDateNode, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.discount.MergedDiscountForwardCurve dcNum, - final org.drip.state.discount.MergedDiscountForwardCurve dcDenom, - final boolean bBasisOnDenom) - { - if (null == aiDateNode) return null; - - int iNumBasis = aiDateNode.length; - double[] adblBasis = new double[iNumBasis]; - org.drip.state.discount.MergedDiscountForwardCurve dcBasis = bBasisOnDenom ? dcDenom : dcNum; - - if (0 == iNumBasis || null == dcBasis) return null; - - for (int i = 0; i < iNumBasis; ++i) { - try { - if (bBasisOnDenom) - adblBasis[i] = nodeBasis (aiDateNode[i], valParams, dcNum, dcBasis, true); - else - adblBasis[i] = nodeBasis (aiDateNode[i], valParams, dcBasis, dcDenom, false); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return adblBasis; - } - - @Override public double[] impliedNodeRates ( - final int[] aiDateNode, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.discount.MergedDiscountForwardCurve dcNum, - final org.drip.state.discount.MergedDiscountForwardCurve dcDenom, - final boolean bBasisOnDenom) - { - if (null == aiDateNode) return null; - - int iNumBasis = aiDateNode.length; - double[] adblImpliedNodeRate = new double[iNumBasis]; - - if (0 == iNumBasis) return null; - - for (int i = 0; i < iNumBasis; ++i) { - try { - double dblBaseImpliedRate = java.lang.Double.NaN; - - if (bBasisOnDenom) - dblBaseImpliedRate = dcNum.zero (aiDateNode[i]); - else - dblBaseImpliedRate = dcDenom.zero (aiDateNode[i]); - - adblImpliedNodeRate[i] = dblBaseImpliedRate + nodeBasis (i, valParams, dcNum, dcDenom, - bBasisOnDenom); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - } - - return adblImpliedNodeRate; - } - - @Override public org.drip.state.discount.MergedDiscountForwardCurve bootstrapBasisDC ( - final int[] aiDateNode, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.discount.MergedDiscountForwardCurve dcNum, - final org.drip.state.discount.MergedDiscountForwardCurve dcDenom, - final boolean bBasisOnDenom) - { - double[] adblImpliedRate = impliedNodeRates (aiDateNode, valParams, dcNum, dcDenom, bBasisOnDenom); - - if (null == adblImpliedRate) return null; - - int iNumDF = adblImpliedRate.length; - double[] adblDF = new double[iNumDF]; - org.drip.state.discount.MergedDiscountForwardCurve dc = bBasisOnDenom ? dcDenom : dcNum; - - if (0 == iNumDF) return null; - - int iSpotDate = valParams.valueDate(); - - java.lang.String strCurrency = dc.currency(); - - for (int i = 0; i < iNumDF; ++i) - adblDF[i] = java.lang.Math.exp (-1. * adblImpliedRate[i] * (aiDateNode[i] - iSpotDate) / - 365.25); - - try { - return org.drip.state.creator.ScenarioDiscountCurveBuilder.CubicPolynomialDiscountCurve - (strCurrency + "::BASIS", new org.drip.analytics.date.JulianDate (iSpotDate), strCurrency, - aiDateNode, adblDF); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public double rate ( - final int[] aiDateNode, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.discount.MergedDiscountForwardCurve dcNum, - final org.drip.state.discount.MergedDiscountForwardCurve dcDenom, - final int iDate, - final boolean bBasisOnDenom) - throws java.lang.Exception - { - org.drip.state.discount.MergedDiscountForwardCurve dcImplied = bootstrapBasisDC (aiDateNode, valParams, dcNum, - dcDenom, bBasisOnDenom); - - if (null == dcImplied) - throw new java.lang.Exception ("BasisSplineFXForward::rate: Cannot imply basis DC!"); - - return dcImplied.zero (iDate); - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDForwardDManifestMeasure ( - final java.lang.String strManifestMeasure, - final int iDate) - { - return _span.jackDResponseDManifestMeasure (strManifestMeasure, iDate, 1); - } -} diff --git a/org/drip/state/curve/BasisSplineForwardRate.java b/org/drip/state/curve/BasisSplineForwardRate.java deleted file mode 100644 index 59bcdba..0000000 --- a/org/drip/state/curve/BasisSplineForwardRate.java +++ /dev/null @@ -1,105 +0,0 @@ - -package org.drip.state.curve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * BasisSplineForwardRate manages the Forward Latent State, using the Forward Rate as the State Response - * Representation. It exports the following functionality: - * - Calculate implied forward rate / implied forward rate Jacobian - * - Serialize into and de-serialize out of byte arrays - * - * @author Lakshmi Krishnamurthy - */ - -public class BasisSplineForwardRate extends org.drip.state.forward.ForwardCurve { - private org.drip.spline.grid.Span _span = null; - - /** - * BasisSplineForwardRate constructor - * - * @param fri The Floating Rate Index - * @param span The Span over which the Forward Rate Representation is valid - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BasisSplineForwardRate ( - final org.drip.state.identifier.ForwardLabel fri, - final org.drip.spline.grid.OverlappingStretchSpan span) - throws java.lang.Exception - { - super ((int) span.left(), fri); - - _span = span; - } - - @Override public double forward ( - final int iDate) - throws java.lang.Exception - { - double dblSpanLeft = _span.left(); - - if (iDate <= dblSpanLeft) return _span.calcResponseValue (dblSpanLeft); - - double dblSpanRight = _span.right(); - - if (iDate >= dblSpanRight) return _span.calcResponseValue (dblSpanRight); - - return _span.calcResponseValue (iDate); - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDForwardDManifestMeasure ( - final java.lang.String strManifestMeasure, - final int iDate) - { - return _span.jackDResponseDManifestMeasure (strManifestMeasure, iDate, 1); - } -} diff --git a/org/drip/state/curve/BasisSplineGovvieYield.java b/org/drip/state/curve/BasisSplineGovvieYield.java deleted file mode 100644 index 0d1b558..0000000 --- a/org/drip/state/curve/BasisSplineGovvieYield.java +++ /dev/null @@ -1,104 +0,0 @@ - -package org.drip.state.curve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * BasisSplineGovvieYield manages the Basis Spline Latent State, using the Basis as the State Response - * Representation, for the Govvie Curve with Yield Quantification Metric. - * - * @author Lakshmi Krishnamurthy - */ - -public class BasisSplineGovvieYield extends org.drip.state.govvie.GovvieCurve { - private org.drip.spline.grid.Span _span = null; - - /** - * BasisSplineGovvieYield Constructor - * - * @param strTreasuryCode Treasury Code - * @param strCurrency Currency - * @param span Govvie Curve Span - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BasisSplineGovvieYield ( - final java.lang.String strTreasuryCode, - final java.lang.String strCurrency, - final org.drip.spline.grid.Span span) - throws java.lang.Exception - { - super ((int) span.left(), strTreasuryCode, strCurrency); - - _span = span; - } - - @Override public double yield ( - final int iDate) - throws java.lang.Exception - { - double dblSpanLeft = _span.left(); - - if (iDate <= dblSpanLeft) return _span.calcResponseValue (dblSpanLeft); - - double dblSpanRight = _span.right(); - - if (iDate >= dblSpanRight) return _span.calcResponseValue (dblSpanRight); - - return _span.calcResponseValue (iDate); - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDForwardDManifestMeasure ( - final java.lang.String strManifestMeasure, - final int iDate) - { - return _span.jackDResponseDManifestMeasure (strManifestMeasure, iDate, 1); - } -} diff --git a/org/drip/state/curve/BasisSplineMarketSurface.java b/org/drip/state/curve/BasisSplineMarketSurface.java deleted file mode 100644 index 263ad7a..0000000 --- a/org/drip/state/curve/BasisSplineMarketSurface.java +++ /dev/null @@ -1,120 +0,0 @@ - -package org.drip.state.curve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * BasisSplineMarketSurface implements the Market surface that holds the latent state's Dynamics parameters. - * - * @author Lakshmi Krishnamurthy - */ - -public class BasisSplineMarketSurface extends org.drip.analytics.definition.MarketSurface { - private org.drip.spline.multidimensional.WireSurfaceStretch _wss = null; - - /** - * BasisSplineMarketSurface Constructor - * - * @param iEpochDate The Starting Date - * @param label The Spline Market Surface Latent State Label - * @param strCurrency The Currency - * @param wss Wire Surface Stretch Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BasisSplineMarketSurface ( - final int iEpochDate, - final org.drip.state.identifier.CustomLabel label, - final java.lang.String strCurrency, - final org.drip.spline.multidimensional.WireSurfaceStretch wss) - throws java.lang.Exception - { - super (iEpochDate, label, strCurrency); - - _wss = wss; - } - - @Override public double node ( - final double dblStrike, - final double dblDate) - throws java.lang.Exception - { - return _wss.responseValue (dblStrike, dblDate); - } - - @Override public org.drip.analytics.definition.NodeStructure xAnchorTermStructure ( - final double dblStrikeAnchor) - { - try { - return new BasisSplineTermStructure (epoch().julian(), - org.drip.state.identifier.CustomLabel.Standard (label() + "_" + dblStrikeAnchor), - currency(), _wss.wireSpanXAnchor (dblStrikeAnchor)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.analytics.definition.NodeStructure yAnchorTermStructure ( - final double dblMaturityDateAnchor) - { - try { - return new BasisSplineTermStructure (epoch().julian(), - org.drip.state.identifier.CustomLabel.Standard (label() + "_" + new - org.drip.analytics.date.JulianDate ((int) dblMaturityDateAnchor)), currency(), - _wss.wireSpanYAnchor (dblMaturityDateAnchor)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/state/curve/BasisSplineRepoCurve.java b/org/drip/state/curve/BasisSplineRepoCurve.java deleted file mode 100644 index 0e9abac..0000000 --- a/org/drip/state/curve/BasisSplineRepoCurve.java +++ /dev/null @@ -1,92 +0,0 @@ - -package org.drip.state.curve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * BasisSplineRepoCurve manages the Basis Latent State, using the Repo as the State Response Representation. - * - * @author Lakshmi Krishnamurthy - */ - -public class BasisSplineRepoCurve extends org.drip.state.repo.RepoCurve { - private org.drip.spline.grid.Span _span = null; - - /** - * BasisSplineRepoCurve constructor - * - * @param comp The Underlying Repo Component - * @param span The Span over which the Basis Representation is valid - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BasisSplineRepoCurve ( - final org.drip.product.definition.Component comp, - final org.drip.spline.grid.Span span) - throws java.lang.Exception - { - super ((int) span.left(), comp); - - _span = span; - } - - @Override public double repo ( - final int iDate) - throws java.lang.Exception - { - if (iDate < _span.left() || iDate >= component().maturityDate().julian()) - throw new java.lang.Exception ("BasisSplineRepoCurve::repo => Invalid Input"); - - double dblSpanRight = _span.right(); - - if (iDate >= dblSpanRight) return _span.calcResponseValue (dblSpanRight); - - return _span.calcResponseValue (iDate); - } -} diff --git a/org/drip/state/curve/BasisSplineTermStructure.java b/org/drip/state/curve/BasisSplineTermStructure.java deleted file mode 100644 index 9dfee6e..0000000 --- a/org/drip/state/curve/BasisSplineTermStructure.java +++ /dev/null @@ -1,120 +0,0 @@ - -package org.drip.state.curve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * BasisSplineTermStructure implements the TermStructure Interface - if holds the latent state's Term - * Structure Parameters. - * - * @author Lakshmi Krishnamurthy - */ - -public class BasisSplineTermStructure extends org.drip.analytics.definition.NodeStructure { - private org.drip.spline.grid.Span _span = null; - - /** - * BasisSplineTermStructure Constructor - * - * @param iEpochDate The Epoch Date - * @param label Term Structure Latent State Label - * @param strCurrency The Currency - * @param span The Latent State Span - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BasisSplineTermStructure ( - final int iEpochDate, - final org.drip.state.identifier.CustomLabel label, - final java.lang.String strCurrency, - final org.drip.spline.grid.Span span) - throws java.lang.Exception - { - super (iEpochDate, label, strCurrency); - - _span = span; - } - - @Override public double node ( - final int iPredictorOrdinate) - throws java.lang.Exception - { - double dblSpanLeft = _span.left(); - - if (dblSpanLeft >= iPredictorOrdinate) return _span.calcResponseValue (dblSpanLeft); - - double dblSpanRight = _span.right(); - - if (dblSpanRight <= iPredictorOrdinate) return _span.calcResponseValue (dblSpanRight); - - return _span.calcResponseValue (iPredictorOrdinate); - } - - @Override public double nodeDerivative ( - final int iPredictorOrdinate, - final int iOrder) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (iPredictorOrdinate)) - throw new java.lang.Exception ("BasisSplineTermStructure::nodeDerivative => Invalid Inputs"); - - double dblSpanLeft = _span.left(); - - if (dblSpanLeft >= iPredictorOrdinate) - return _span.calcResponseValueDerivative (dblSpanLeft, iOrder); - - double dblSpanRight = _span.right(); - - if (dblSpanRight <= iPredictorOrdinate) - return _span.calcResponseValueDerivative (dblSpanRight, iOrder); - - return _span.calcResponseValueDerivative (iPredictorOrdinate, iOrder); - } -} diff --git a/org/drip/state/curve/DerivedZeroRate.java b/org/drip/state/curve/DerivedZeroRate.java deleted file mode 100644 index 97c1d0e..0000000 --- a/org/drip/state/curve/DerivedZeroRate.java +++ /dev/null @@ -1,621 +0,0 @@ - -package org.drip.state.curve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * DerivedZeroRate implements the delegated ZeroCurve functionality. Beyond discount factor/zero rate - * computation at specific cash pay nodes, all other functions are delegated to the embedded discount curve. - * - * @author Lakshmi Krishnamurthy - */ - -public class DerivedZeroRate extends org.drip.state.discount.ZeroCurve { - private static final int NUM_DF_QUADRATURES = 5; - - private org.drip.state.discount.DiscountCurve _dc = null; - private org.drip.spline.stretch.MultiSegmentSequence _mssDF = null; - private org.drip.spline.stretch.MultiSegmentSequence _mssZeroRate = null; - - private static final boolean EntryFromDiscountCurve ( - final org.drip.state.discount.DiscountCurve dc, - final int iDate, - final int iFreq, - final double dblYearFraction, - final double dblShift, - final java.util.Map mapDF, - final java.util.Map mapZeroRate) - { - try { - // System.out.println ("\tDF: " + dc.df (iDate) + " | " + dblYearFraction); - - double dblZeroRate = org.drip.analytics.support.Helper.DF2Yield (iFreq, dc.df (iDate), - dblYearFraction) + dblShift; - - // System.out.println ("\t\tDF: " + dc.df (iDate) + " | " + dblYearFraction + " | " + dblZeroRate); - - mapDF.put (iDate, org.drip.analytics.support.Helper.Yield2DF (iFreq, dblZeroRate, - dblYearFraction)); - - // System.out.println ("\tDone"); - - mapZeroRate.put (iDate, dblZeroRate); - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - private static final boolean EntryFromYield ( - final int iDate, - final int iFreq, - final double dblYearFraction, - final double dblShiftedYield, - final java.util.Map mapDF, - final java.util.Map mapZeroRate) - { - try { - mapDF.put (iDate, org.drip.analytics.support.Helper.Yield2DF (iFreq, dblShiftedYield, - dblYearFraction)); - - mapZeroRate.put (iDate, dblShiftedYield); - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - /** - * Construct an Instance from the Discount Curve and the related Parameters - * - * @param iFreqZC Zero Curve Frequency - * @param strDCZC Zero Curve Day Count - * @param strCalendarZC Zero Curve Calendar - * @param bApplyEOMAdjZC Zero Coupon EOM Adjustment Flag - * @param lsCouponPeriod List of Bond coupon periods - * @param iWorkoutDate Work-out Date - * @param iValueDate Value Date - * @param iCashPayDate Cash-Pay Date - * @param dc Underlying Discount Curve - * @param dblZCBump DC Bump - * @param vcp Valuation Customization Parameters - * @param scbc Segment Custom Builder Control Parameters - * - * @return The Derived Zero Rate Instance - */ - - public static final DerivedZeroRate FromDiscountCurve ( - final int iFreqZC, - final java.lang.String strDCZC, - final java.lang.String strCalendarZC, - final boolean bApplyEOMAdjZC, - final java.util.List lsCouponPeriod, - final int iWorkoutDate, - final int iValueDate, - final int iCashPayDate, - final org.drip.state.discount.DiscountCurve dc, - final double dblZCBump, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.spline.params.SegmentCustomBuilderControl scbc) - { - if (null == lsCouponPeriod || 2 > lsCouponPeriod.size() || null == dc || - !org.drip.quant.common.NumberUtil.IsValid (dblZCBump) || null == scbc) - return null; - - int iFreq = 0 == iFreqZC ? 2 : iFreqZC; - boolean bApplyCpnEOMAdj = bApplyEOMAdjZC; - java.lang.String strCalendar = strCalendarZC; - - java.lang.String strDC = null == strDCZC || strDCZC.isEmpty() ? "30/360" : strDCZC; - - if (null != vcp) { - strDC = vcp.yieldDayCount(); - - iFreq = vcp.yieldFreq(); - - bApplyCpnEOMAdj = vcp.applyYieldEOMAdj(); - - strCalendar = vcp.yieldCalendar(); - } - - java.util.Map mapDF = new java.util.TreeMap(); - - java.util.Map mapZeroRate = new - java.util.TreeMap(); - - mapDF.put (iValueDate, 1.); - - mapZeroRate.put (iValueDate, 0.); - - for (org.drip.analytics.cashflow.CompositePeriod period : lsCouponPeriod) { - int iPeriodPayDate = period.payDate(); - - if (iValueDate >= iPeriodPayDate) continue; - - int iPeriodStartDate = period.startDate(); - - int iPeriodEndDate = period.endDate(); - - // System.out.println ("\t" + iPeriodStartDate + " -> " + iPeriodEndDate); - - try { - /* System.out.println ("\t" + iValueDate + ": " + - org.drip.analytics.daycount.Convention.YearFraction (iValueDate, iPeriodPayDate, strDC, - bApplyCpnEOMAdj, new org.drip.analytics.daycount.ActActDCParams (iFreq, - iPeriodEndDate - iPeriodStartDate), strCalendar)); */ - - if (!EntryFromDiscountCurve (dc, iPeriodPayDate, iFreq, - org.drip.analytics.daycount.Convention.YearFraction (iValueDate, iPeriodPayDate, strDC, - bApplyCpnEOMAdj, new org.drip.analytics.daycount.ActActDCParams (iFreq, - iPeriodEndDate - iPeriodStartDate), strCalendar), dblZCBump, mapDF, - mapZeroRate)) - return null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - org.drip.analytics.daycount.ActActDCParams aap = - org.drip.analytics.daycount.ActActDCParams.FromFrequency (iFreq); - - try { - if (!EntryFromDiscountCurve (dc, iWorkoutDate, iFreq, - org.drip.analytics.daycount.Convention.YearFraction (iValueDate, iWorkoutDate, strDC, - bApplyCpnEOMAdj, aap, strCalendar), dblZCBump, mapDF, mapZeroRate)) - return null; - - if (iValueDate != iCashPayDate) { - if (!EntryFromDiscountCurve (dc, iCashPayDate, iFreq, - org.drip.analytics.daycount.Convention.YearFraction (iValueDate, iCashPayDate, strDC, - bApplyCpnEOMAdj, aap, strCalendar), dblZCBump, mapDF, mapZeroRate)) - return null; - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - int iNumNode = mapDF.size(); - - int iNode = 0; - double[] adblDF = new double[iNumNode]; - double[] aiDate = new double[iNumNode]; - double[] adblZeroRate = new double[iNumNode]; - - for (java.util.Map.Entry me : mapDF.entrySet()) { - adblDF[iNode] = me.getValue(); - - aiDate[iNode] = me.getKey(); - - adblZeroRate[iNode++] = mapZeroRate.get (me.getKey()); - } - - org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC = new - org.drip.spline.params.SegmentCustomBuilderControl[adblDF.length - 1]; - - for (int i = 0; i < adblDF.length - 1; ++i) - aSCBC[i] = scbc; - - org.drip.spline.stretch.BoundarySettings bsNatural = - org.drip.spline.stretch.BoundarySettings.NaturalStandard(); - - try{ - return new DerivedZeroRate (dc, - org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - ("DF_STRETCH", aiDate, adblDF, aSCBC, null, bsNatural, - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE), - org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - ("ZERO_RATE_STRETCH", aiDate, adblZeroRate, aSCBC, null, bsNatural, - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an Instance from the Govvie Curve and the related Parameters - * - * @param iFreqZC Zero Curve Frequency - * @param strDCZC Zero Curve Day Count - * @param strCalendarZC Zero Curve Calendar - * @param bApplyEOMAdjZC Zero Coupon EOM Adjustment Flag - * @param lsCouponPeriod List of bond coupon periods - * @param iWorkoutDate Work-out Date - * @param iValueDate Value Date - * @param iCashPayDate Cash-Pay Date - * @param gc Underlying Govvie Curve - * @param dblZCBump DC Bump - * @param vcp Valuation Customization Parameters - * @param scbc Segment Custom Builder Control Parameters - * - * @return The Derived Zero Rate Instance - */ - - public static final DerivedZeroRate FromGovvieCurve ( - final int iFreqZC, - final java.lang.String strDCZC, - final java.lang.String strCalendarZC, - final boolean bApplyEOMAdjZC, - final java.util.List lsCouponPeriod, - final int iWorkoutDate, - final int iValueDate, - final int iCashPayDate, - final org.drip.state.govvie.GovvieCurve gc, - final double dblZCBump, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.spline.params.SegmentCustomBuilderControl scbc) - { - if (null == lsCouponPeriod || 2 > lsCouponPeriod.size() || null == gc || - !org.drip.quant.common.NumberUtil.IsValid (dblZCBump) || null == scbc) - return null; - - int iFreq = 0 == iFreqZC ? 2 : iFreqZC; - boolean bApplyCpnEOMAdj = bApplyEOMAdjZC; - java.lang.String strCalendar = strCalendarZC; - double dblShiftedYield = java.lang.Double.NaN; - - try { - dblShiftedYield = gc.yield (iWorkoutDate) + dblZCBump; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - java.lang.String strDC = null == strDCZC || strDCZC.isEmpty() ? "30/360" : strDCZC; - - if (null != vcp) { - strDC = vcp.yieldDayCount(); - - iFreq = vcp.yieldFreq(); - - bApplyCpnEOMAdj = vcp.applyYieldEOMAdj(); - - strCalendar = vcp.yieldCalendar(); - } - - java.util.Map mapDF = new java.util.TreeMap(); - - java.util.Map mapZeroRate = new - java.util.TreeMap(); - - mapDF.put (iValueDate, 1.); - - mapZeroRate.put (iValueDate, 0.); - - for (org.drip.analytics.cashflow.CompositePeriod period : lsCouponPeriod) { - int iPeriodPayDate = period.payDate(); - - if (iValueDate >= iPeriodPayDate) continue; - - int iPeriodStartDate = period.startDate(); - - int iPeriodEndDate = period.endDate(); - - try { - if (!EntryFromYield (iPeriodPayDate, iFreq, - org.drip.analytics.daycount.Convention.YearFraction (iValueDate, iPeriodPayDate, strDC, - bApplyCpnEOMAdj, new org.drip.analytics.daycount.ActActDCParams (iFreq, - iPeriodEndDate - iPeriodStartDate), strCalendar), dblShiftedYield, mapDF, - mapZeroRate)) - return null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - org.drip.analytics.daycount.ActActDCParams aap = - org.drip.analytics.daycount.ActActDCParams.FromFrequency (iFreq); - - try { - if (!EntryFromYield (iWorkoutDate, iFreq, org.drip.analytics.daycount.Convention.YearFraction - (iValueDate, iWorkoutDate, strDC, bApplyCpnEOMAdj, aap, strCalendar), dblShiftedYield, mapDF, - mapZeroRate)) - return null; - - if (iCashPayDate != iValueDate) { - if (!EntryFromYield (iCashPayDate, iFreq, org.drip.analytics.daycount.Convention.YearFraction - (iValueDate, iCashPayDate, strDC, bApplyCpnEOMAdj, aap, strCalendar), dblShiftedYield, - mapDF, mapZeroRate)) - return null; - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - int iNumNode = mapDF.size(); - - int iNode = 0; - double[] adblDF = new double[iNumNode]; - double[] aiDate = new double[iNumNode]; - double[] adblZeroRate = new double[iNumNode]; - - for (java.util.Map.Entry me : mapDF.entrySet()) { - adblDF[iNode] = me.getValue(); - - aiDate[iNode] = me.getKey(); - - adblZeroRate[iNode++] = mapZeroRate.get (me.getKey()); - } - - org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC = new - org.drip.spline.params.SegmentCustomBuilderControl[adblDF.length - 1]; - - for (int i = 0; i < adblDF.length - 1; ++i) - aSCBC[i] = scbc; - - org.drip.spline.stretch.BoundarySettings bsNatural = - org.drip.spline.stretch.BoundarySettings.NaturalStandard(); - - try { - return new DerivedZeroRate (gc, - org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - ("DF_STRETCH", aiDate, adblDF, aSCBC, null, bsNatural, - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE), - org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - ("ZERO_RATE_STRETCH", aiDate, adblZeroRate, aSCBC, null, bsNatural, - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an Instance from the Input Curve and the related Parameters - * - * @param iFreq Zero Curve Frequency - * @param strDayCount Zero Curve Day Count - * @param strCalendar Zero Curve Calendar - * @param bApplyEOMAdj Zero Coupon EOM Adjustment Flag - * @param lsCouponPeriod List of bond coupon periods - * @param iWorkoutDate Work-out Date - * @param iValueDate Value Date - * @param iCashPayDate Cash-Pay Date - * @param dc Underlying Discount Curve - * @param dblBump DC Bump - * @param vcp Valuation Customization Parameters - * @param scbc Segment Custom Builder Control Parameters - * - * @return The Derived Zero Rate Instance - */ - - public static final DerivedZeroRate FromBaseCurve ( - final int iFreq, - final java.lang.String strDayCount, - final java.lang.String strCalendar, - final boolean bApplyEOMAdj, - final java.util.List lsCouponPeriod, - final int iWorkoutDate, - final int iValueDate, - final int iCashPayDate, - final org.drip.state.discount.DiscountCurve dc, - final double dblBump, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.spline.params.SegmentCustomBuilderControl scbc) - { - if (null == dc) return null; - - return dc instanceof org.drip.state.govvie.GovvieCurve ? FromGovvieCurve (iFreq, strDayCount, - strCalendar, bApplyEOMAdj, lsCouponPeriod, iWorkoutDate, iValueDate, iCashPayDate, - (org.drip.state.govvie.GovvieCurve) dc, dblBump, vcp, scbc) : FromDiscountCurve (iFreq, - strDayCount, strCalendar, bApplyEOMAdj, lsCouponPeriod, iWorkoutDate, iValueDate, - iCashPayDate, dc, dblBump, vcp, scbc); - } - - private DerivedZeroRate ( - final org.drip.state.discount.DiscountCurve dc, - final org.drip.spline.stretch.MultiSegmentSequence mssDF, - final org.drip.spline.stretch.MultiSegmentSequence mssZeroRate) - throws java.lang.Exception - { - super (dc.epoch().julian(), dc.currency()); - - if (null == (_mssDF = mssDF) || null == (_mssZeroRate = mssZeroRate)) - throw new java.lang.Exception ("DerivedZeroRate Constructor: Invalid Inputs"); - - _dc = dc; - } - - @Override public double df ( - final int iDate) - throws java.lang.Exception - { - if (iDate <= epoch().julian()) return 1.; - - return _mssDF.responseValue (iDate); - } - - @Override public double df ( - final java.lang.String strTenor) - throws java.lang.Exception - { - return df (epoch().addTenor (strTenor)); - } - - @Override public double zeroRate ( - final int iDate) - throws java.lang.Exception - { - if (iDate <= epoch().julian()) return 1.; - - return _mssZeroRate.responseValue (iDate); - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap manifestMeasure ( - final java.lang.String strInstr) - { - return _dc.manifestMeasure (strInstr); - } - - @Override public org.drip.product.definition.CalibratableComponent[] calibComp() - { - return _dc.calibComp(); - } - - @Override public org.drip.state.identifier.LatentStateLabel label() - { - return _dc.label(); - } - - @Override public org.drip.analytics.definition.Curve parallelShiftManifestMeasure ( - final java.lang.String strManifestMeasure, - final double dblShift) - { - return null; - } - - @Override public org.drip.analytics.definition.Curve shiftManifestMeasure ( - final int iSpanIndex, - final java.lang.String strManifestMeasure, - final double dblShift) - { - return null; - } - - @Override public org.drip.analytics.definition.Curve customTweakManifestMeasure ( - final java.lang.String strManifestMeasure, - final org.drip.param.definition.ManifestMeasureTweak mmtp) - { - return null; - } - - @Override public boolean setCCIS ( - final org.drip.analytics.input.CurveConstructionInputSet ccis) - { - return _dc.setCCIS (ccis); - } - - @Override public org.drip.state.representation.LatentState parallelShiftQuantificationMetric ( - final double dblShift) - { - return _dc.parallelShiftQuantificationMetric (dblShift); - } - - @Override public org.drip.state.representation.LatentState customTweakQuantificationMetric ( - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - return _dc.customTweakQuantificationMetric (rvtp); - } - - @Override public double df ( - final org.drip.analytics.date.JulianDate dt) - throws java.lang.Exception - { - if (null == dt) throw new java.lang.Exception ("DerivedZeroRate::df => Invalid Inputs"); - - return df (dt.julian()); - } - - @Override public double effectiveDF ( - final int iDate1, - final int iDate2) - throws java.lang.Exception - { - if (iDate1 == iDate2) return df (iDate1); - - int iNumQuadratures = 0; - double dblEffectiveDF = 0.; - int iQuadratureWidth = (iDate2 - iDate1) / NUM_DF_QUADRATURES; - - if (0 == iQuadratureWidth) iQuadratureWidth = 1; - - for (int iDate = iDate1; iDate <= iDate2; iDate += iQuadratureWidth) { - ++iNumQuadratures; - - dblEffectiveDF += (df (iDate) + df (iDate + iQuadratureWidth)); - } - - return dblEffectiveDF / (2. * iNumQuadratures); - } - - @Override public double effectiveDF ( - final org.drip.analytics.date.JulianDate dt1, - final org.drip.analytics.date.JulianDate dt2) - throws java.lang.Exception - { - if (null == dt1 || null == dt2) - throw new java.lang.Exception ("DerivedZeroRate::effectiveDF => Got null for date"); - - return effectiveDF (dt1.julian(), dt2.julian()); - } - - @Override public double effectiveDF ( - final java.lang.String strTenor1, - final java.lang.String strTenor2) - throws java.lang.Exception - { - if (null == strTenor1 || strTenor1.isEmpty() || null == strTenor2 || strTenor2.isEmpty()) - throw new java.lang.Exception ("DerivedZeroRate::effectiveDF => Got bad tenor"); - - org.drip.analytics.date.JulianDate dtStart = epoch(); - - return effectiveDF (dtStart.addTenor (strTenor1), dtStart.addTenor (strTenor2)); - } -} diff --git a/org/drip/state/curve/DeterministicCollateralChoiceDiscountCurve.java b/org/drip/state/curve/DeterministicCollateralChoiceDiscountCurve.java deleted file mode 100644 index 9ed4235..0000000 --- a/org/drip/state/curve/DeterministicCollateralChoiceDiscountCurve.java +++ /dev/null @@ -1,229 +0,0 @@ - -package org.drip.state.curve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * DeterministicCollateralChoiceDiscountCurve implements the Dynamically Switchable Collateral Choice - * Discount Curve among the choice of provided "deterministic" collateral curves. - * - * @author Lakshmi Krishnamurthy - */ - -public class DeterministicCollateralChoiceDiscountCurve extends org.drip.state.discount.MergedDiscountForwardCurve { - private int _iDiscreteCollateralizationIncrement = -1; - private org.drip.state.discount.MergedDiscountForwardCurve _dcDomesticCollateralized = null; - private org.drip.state.curve.ForeignCollateralizedDiscountCurve[] _aFCDC = null; - - /** - * DeterministicCollateralChoiceDiscountCurve constructor - * - * @param dcDomesticCollateralized The Domestic Collateralized Curve - * @param aFCDC Array of The Foreign Collateralized Curves - * @param iDiscreteCollateralizationIncrement The Discrete Collateralization Increment - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public DeterministicCollateralChoiceDiscountCurve ( - final org.drip.state.discount.MergedDiscountForwardCurve dcDomesticCollateralized, - final org.drip.state.curve.ForeignCollateralizedDiscountCurve[] aFCDC, - final int iDiscreteCollateralizationIncrement) - throws java.lang.Exception - { - super (dcDomesticCollateralized.epoch().julian(), dcDomesticCollateralized.currency(), null); - - if (0 >= (_iDiscreteCollateralizationIncrement = iDiscreteCollateralizationIncrement)) - throw new java.lang.Exception - ("DeterministicCollateralChoiceDiscountCurve ctr: Invalid Collateralization Increment!"); - - _aFCDC = aFCDC; - _dcDomesticCollateralized = dcDomesticCollateralized; - } - - @Override public double df ( - final int iDate) - throws java.lang.Exception - { - if (null == _aFCDC) return _dcDomesticCollateralized.df (iDate); - - int iNumCollateralizer = _aFCDC.length; - - if (0 == iNumCollateralizer) return _dcDomesticCollateralized.df (iDate); - - if (iDate <= _iEpochDate) return 1.; - - double dblDF = 1.; - int iWorkoutDate = _iEpochDate; - - while (java.lang.Math.abs (iDate - iWorkoutDate) > _iDiscreteCollateralizationIncrement) { - int iWorkoutEndDate = iWorkoutDate + _iDiscreteCollateralizationIncrement; - - double dblDFIncrement = _dcDomesticCollateralized.df (iWorkoutEndDate) / - _dcDomesticCollateralized.df (iWorkoutDate); - - for (int i = 0; i < iNumCollateralizer; ++i) { - double dblCollateralizerDFIncrement = _aFCDC[i].df (iWorkoutEndDate) / _aFCDC[i].df - (iWorkoutDate); - - if (dblCollateralizerDFIncrement < dblDFIncrement) - dblDFIncrement = dblCollateralizerDFIncrement; - } - - dblDF *= dblDFIncrement; - iWorkoutDate = iWorkoutEndDate; - } - - if (iDate > iWorkoutDate) { - double dblDFIncrement = _dcDomesticCollateralized.df (iDate) / _dcDomesticCollateralized.df - (iWorkoutDate); - - for (int i = 0; i < iNumCollateralizer; ++i) { - double dblCollateralizerDFIncrement = _aFCDC[i].df (iDate) / _aFCDC[i].df (iWorkoutDate); - - if (dblCollateralizerDFIncrement < dblDFIncrement) - dblDFIncrement = dblCollateralizerDFIncrement; - } - - dblDF *= dblDFIncrement; - } - - return dblDF; - } - - @Override public double forward ( - final int iDate1, - final int iDate2) - throws java.lang.Exception - { - if (iDate1 < _iEpochDate || iDate2 < _iEpochDate) return 0.; - - return 365.25 / (iDate2 - iDate1) * java.lang.Math.log (df (iDate1) / df (iDate2)); - } - - @Override public double zero ( - final int iDate) - throws java.lang.Exception - { - if (iDate < _iEpochDate) return 0.; - - return -365.25 / (iDate - _iEpochDate) * java.lang.Math.log (df (iDate)); - } - - @Override public org.drip.state.forward.ForwardRateEstimator forwardRateEstimator ( - final int iDate, - final org.drip.state.identifier.ForwardLabel fri) - { - return null; - } - - @Override public java.lang.String latentStateQuantificationMetric() - { - return null; - } - - @Override public DiscountFactorDiscountCurve parallelShiftManifestMeasure ( - final java.lang.String strManifestMeasure, - final double dblShift) - { - return null; - } - - @Override public DiscountFactorDiscountCurve shiftManifestMeasure ( - final int iSpanIndex, - final java.lang.String strManifestMeasure, - final double dblShift) - { - return null; - } - - @Override public org.drip.state.discount.MergedDiscountForwardCurve customTweakManifestMeasure ( - final java.lang.String strManifestMeasure, - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - return null; - } - - @Override public DiscountFactorDiscountCurve parallelShiftQuantificationMetric ( - final double dblShift) - { - return null; - } - - @Override public org.drip.analytics.definition.Curve customTweakQuantificationMetric ( - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - return null; - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDDFDManifestMeasure ( - final int iDate, - final java.lang.String strManifestMeasure) - { - return null; - } - - @Override public boolean setCCIS ( - final org.drip.analytics.input.CurveConstructionInputSet ccis) - { - return false; - } - - @Override public org.drip.product.definition.CalibratableComponent[] calibComp() - { - return null; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap manifestMeasure ( - final java.lang.String strInstr) - { - return null; - } -} diff --git a/org/drip/state/curve/DiscountFactorDiscountCurve.java b/org/drip/state/curve/DiscountFactorDiscountCurve.java deleted file mode 100644 index 2c11d44..0000000 --- a/org/drip/state/curve/DiscountFactorDiscountCurve.java +++ /dev/null @@ -1,290 +0,0 @@ - -package org.drip.state.curve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * DiscountFactorDiscountCurve manages the Discounting Latent State, using the Discount Factor as the State - * Response Representation. It exports the following functionality: - * - Compute the discount factor, forward rate, or the zero rate from the Discount Factor Latent State - * - Create a ForwardRateEstimator instance for the given Index - * - Retrieve Array of the Calibration Components - * - Retrieve the Curve Construction Input Set - * - Compute the Jacobian of the Discount Factor Latent State to the input Quote - * - Synthesize scenario Latent State by parallel shifting/custom tweaking the quantification metric - * - Synthesize scenario Latent State by parallel/custom shifting/custom tweaking the manifest measure - * - Serialize into and de-serialize out of byte array - * - * @author Lakshmi Krishnamurthy - */ - -public class DiscountFactorDiscountCurve extends org.drip.state.discount.MergedDiscountForwardCurve { - private org.drip.spline.grid.Span _span = null; - private double _dblRightFlatForwardRate = java.lang.Double.NaN; - - private DiscountFactorDiscountCurve shiftManifestMeasure ( - final double[] adblShiftedManifestMeasure) - { - return null; - } - - /** - * DiscountFactorDiscountCurve constructor - * - * @param strCurrency Currency - * @param span The Span Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public DiscountFactorDiscountCurve ( - final java.lang.String strCurrency, - final org.drip.spline.grid.Span span) - throws java.lang.Exception - { - super ((int) span.left(), strCurrency, null); - - _dblRightFlatForwardRate = -365.25 * java.lang.Math.log ((_span = span).calcResponseValue - (_span.right())) / (_span.right() - _span.left()); - } - - @Override public double df ( - final int iDate) - throws java.lang.Exception - { - int iEpochDate = epoch().julian(); - - if (iDate <= iEpochDate) return 1.; - - return (iDate <= _span.right() ? _span.calcResponseValue (iDate) : java.lang.Math.exp (-1. * - _dblRightFlatForwardRate * (iDate - iEpochDate) / 365.25)) * turnAdjust (iEpochDate, iDate); - } - - @Override public double forward ( - final int iDate1, - final int iDate2) - throws java.lang.Exception - { - int iEpochDate = epoch().julian(); - - if (iDate1 < iEpochDate || iDate2 < iEpochDate) return 0.; - - return 365.25 / (iDate2 - iDate1) * java.lang.Math.log (df (iDate1) / df (iDate2)); - } - - @Override public double zero ( - final int iDate) - throws java.lang.Exception - { - int iEpochDate = epoch().julian(); - - if (iDate < iEpochDate) return 0.; - - return -365.25 / (iDate - iEpochDate) * java.lang.Math.log (df (iDate)); - } - - @Override public org.drip.state.forward.ForwardRateEstimator forwardRateEstimator ( - final int iDate, - final org.drip.state.identifier.ForwardLabel fri) - { - if (null == _span || !_span.isMergeState (iDate, fri)) return null; - - return new org.drip.state.forward.ForwardRateEstimator() { - @Override public org.drip.state.identifier.ForwardLabel index() - { - return fri; - } - - @Override public java.lang.String tenor() - { - return fri.tenor(); - } - - @Override public double forward ( - final org.drip.analytics.date.JulianDate dt) - throws java.lang.Exception - { - if (null == dt) - throw new java.lang.Exception - ("DiscountFactorDiscountCurve::ForwardEstimator::forward => Invalid Inputs!"); - - java.lang.String strTenor = fri.tenor(); - - return libor (dt.subtractTenor (strTenor).julian(), strTenor); - } - - @Override public double forward ( - final int iDate) - throws java.lang.Exception - { - return forward (new org.drip.analytics.date.JulianDate (iDate)); - } - - @Override public double forward ( - final java.lang.String strTenor) - throws java.lang.Exception - { - if (null == strTenor || strTenor.isEmpty()) - throw new java.lang.Exception - ("DiscountFactorDiscountCurve::ForwardEstimator::forward => Invalid Inputs!"); - - return forward (epoch().addTenor (strTenor)); - } - }; - } - - @Override public java.lang.String latentStateQuantificationMetric() - { - return org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR; - } - - @Override public DiscountFactorDiscountCurve parallelShiftManifestMeasure ( - final java.lang.String strManifestMeasure, - final double dblShift) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblShift)) return null; - - org.drip.product.definition.CalibratableComponent[] aCC = calibComp(); - - if (null == aCC) return null; - - int iNumComp = aCC.length; - double[] adblShiftedManifestMeasure = new double[iNumComp]; - - for (int i = 0; i < iNumComp; ++i) - adblShiftedManifestMeasure[i] += dblShift; - - return shiftManifestMeasure (adblShiftedManifestMeasure); - } - - @Override public DiscountFactorDiscountCurve shiftManifestMeasure ( - final int iSpanIndex, - final java.lang.String strManifestMeasure, - final double dblShift) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblShift)) return null; - - org.drip.product.definition.CalibratableComponent[] aCC = calibComp(); - - if (null == aCC) return null; - - int iNumComp = aCC.length; - double[] adblShiftedManifestMeasure = new double[iNumComp]; - - if (iSpanIndex >= iNumComp) return null; - - for (int i = 0; i < iNumComp; ++i) - adblShiftedManifestMeasure[i] += (i == iSpanIndex ? dblShift : 0.); - - return shiftManifestMeasure (adblShiftedManifestMeasure); - } - - @Override public org.drip.state.discount.MergedDiscountForwardCurve customTweakManifestMeasure ( - final java.lang.String strManifestMeasure, - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - if (null == rvtp) return null; - - org.drip.product.definition.CalibratableComponent[] aCC = calibComp(); - - if (null == aCC) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap> - mapQuote = _ccis.quoteMap(); - - int iNumComp = aCC.length; - double[] adblQuote = new double[iNumComp]; - - for (int i = 0; i < iNumComp; ++i) - adblQuote[i] = mapQuote.get (aCC[i].primaryCode()).get (strManifestMeasure); - - double[] adblShiftedManifestMeasure = org.drip.analytics.support.Helper.TweakManifestMeasure - (adblQuote, rvtp); - - return shiftManifestMeasure (adblShiftedManifestMeasure); - } - - @Override public DiscountFactorDiscountCurve parallelShiftQuantificationMetric ( - final double dblShift) - { - return null; - } - - @Override public org.drip.analytics.definition.Curve customTweakQuantificationMetric ( - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - return null; - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDDFDManifestMeasure ( - final int iDate, - final java.lang.String strManifestMeasure) - { - return null == _span ? null : _span.jackDResponseDManifestMeasure (strManifestMeasure, iDate, 1); - } - - @Override public org.drip.product.definition.CalibratableComponent[] calibComp() - { - return null == _ccis ? null : _ccis.components(); - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap manifestMeasure ( - final java.lang.String strInstrumentCode) - { - if (null == _ccis) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap> - mapQuote = _ccis.quoteMap(); - - if (null == mapQuote || !mapQuote.containsKey (strInstrumentCode)) return null; - - return mapQuote.get (strInstrumentCode); - } -} diff --git a/org/drip/state/curve/ForeignCollateralizedDiscountCurve.java b/org/drip/state/curve/ForeignCollateralizedDiscountCurve.java deleted file mode 100644 index 42fecec..0000000 --- a/org/drip/state/curve/ForeignCollateralizedDiscountCurve.java +++ /dev/null @@ -1,211 +0,0 @@ - -package org.drip.state.curve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * ForeignCollateralizedDiscountCurve computes the discount factor corresponding to one unit of domestic - * currency collateralized by a foreign collateral. - * - * @author Lakshmi Krishnamurthy - */ - -public class ForeignCollateralizedDiscountCurve extends org.drip.state.discount.ExplicitBootDiscountCurve { - private java.lang.String _strCurrency = null; - private org.drip.state.fx.FXCurve _fxForward = null; - private org.drip.state.volatility.VolatilityCurve _vcFX = null; - private org.drip.state.discount.MergedDiscountForwardCurve _dcCollateralForeign = null; - private org.drip.state.volatility.VolatilityCurve _vcCollateralForeign = null; - private org.drip.function.definition.R1ToR1 _r1r1CollateralForeignFXCorrelation = null; - - /** - * ForeignCollateralizedDiscountCurve constructor - * - * @param strCurrency The Currency - * @param dcCollateralForeign The Collateralized Foreign Discount Curve - * @param fxForward The FX Forward Curve - * @param vcCollateralForeign The Foreign Collateral Volatility Curve - * @param vcFX The FX Volatility Curve - * @param r1r1CollateralForeignFXCorrelation The FX Foreign Collateral Correlation Curve - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public ForeignCollateralizedDiscountCurve ( - final java.lang.String strCurrency, - final org.drip.state.discount.MergedDiscountForwardCurve dcCollateralForeign, - final org.drip.state.fx.FXCurve fxForward, - final org.drip.state.volatility.VolatilityCurve vcCollateralForeign, - final org.drip.state.volatility.VolatilityCurve vcFX, - final org.drip.function.definition.R1ToR1 r1r1CollateralForeignFXCorrelation) - throws java.lang.Exception - { - super (dcCollateralForeign.epoch().julian(), strCurrency); - - if (null == (_strCurrency = strCurrency) || _strCurrency.isEmpty() || null == (_vcCollateralForeign = - vcCollateralForeign) || null == (_vcFX = vcFX) || null == (_r1r1CollateralForeignFXCorrelation = - r1r1CollateralForeignFXCorrelation) || null == (_dcCollateralForeign = dcCollateralForeign) - || null == (_fxForward = fxForward)) - throw new java.lang.Exception ("ForeignCollateralizedDiscountCurve ctr: Invalid Inputs"); - } - - @Override public double df ( - final int iDate) - throws java.lang.Exception - { - return iDate <= _iEpochDate ? 1. : _dcCollateralForeign.df (iDate) * _fxForward.fx (iDate) * - java.lang.Math.exp (-1. * org.drip.analytics.support.OptionHelper.IntegratedCrossVolQuanto - (_vcFX, _vcCollateralForeign, _r1r1CollateralForeignFXCorrelation, _iEpochDate, iDate)); - } - - @Override public double forward ( - final int iDate1, - final int iDate2) - throws java.lang.Exception - { - if (iDate1 < _iEpochDate || iDate2 < _iEpochDate) return 0.; - - return 365.25 / (iDate2 - iDate1) * java.lang.Math.log (df (iDate1) / df (iDate2)); - } - - @Override public double zero ( - final int iDate) - throws java.lang.Exception - { - if (iDate < _iEpochDate) return 0.; - - return -365.25 / (iDate - _iEpochDate) * java.lang.Math.log (df (iDate)); - } - - @Override public org.drip.state.forward.ForwardRateEstimator forwardRateEstimator ( - final int iDate, - final org.drip.state.identifier.ForwardLabel fri) - { - return null; - } - - @Override public java.util.Map canonicalTruthness ( - final java.lang.String strLatentQuantificationMetric) - { - return null; - } - - @Override public org.drip.state.nonlinear.FlatForwardDiscountCurve parallelShiftManifestMeasure ( - final java.lang.String strManifestMeasure, - final double dblShift) - { - return null; - } - - @Override public org.drip.state.nonlinear.FlatForwardDiscountCurve shiftManifestMeasure ( - final int iSpanIndex, - final java.lang.String strManifestMeasure, - final double dblShift) - { - return null; - } - - @Override public org.drip.state.discount.ExplicitBootDiscountCurve customTweakManifestMeasure ( - final java.lang.String strManifestMeasure, - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - return null; - } - - @Override public org.drip.state.nonlinear.FlatForwardDiscountCurve parallelShiftQuantificationMetric ( - final double dblShift) - { - return null; - } - - @Override public org.drip.analytics.definition.Curve customTweakQuantificationMetric ( - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - return null; - } - - @Override public org.drip.state.nonlinear.FlatForwardDiscountCurve createBasisRateShiftedCurve ( - final int[] aiDate, - final double[] adblBasis) - { - return null; - } - - @Override public java.lang.String latentStateQuantificationMetric() - { - return org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE; - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDDFDManifestMeasure ( - final int iDate, - final java.lang.String strManifestMeasure) - { - return null; - } - - @Override public boolean setNodeValue ( - final int iNodeIndex, - final double dblValue) - { - return true; - } - - @Override public boolean bumpNodeValue ( - final int iNodeIndex, - final double dblValue) - { - return true; - } - - @Override public boolean setFlatValue ( - final double dblValue) - { - return true; - } -} diff --git a/org/drip/state/curve/ZeroRateDiscountCurve.java b/org/drip/state/curve/ZeroRateDiscountCurve.java deleted file mode 100644 index c8f99af..0000000 --- a/org/drip/state/curve/ZeroRateDiscountCurve.java +++ /dev/null @@ -1,240 +0,0 @@ - -package org.drip.state.curve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * ZeroRateDiscountCurve manages the Discounting Latent State, using the Zero Rate as the State - * Response Representation. It exports the following functionality: - * - Compute the discount factor, forward rate, or the zero rate from the Zero Rate Latent State - * - Create a ForwardRateEstimator instance for the given Index - * - Retrieve Array of the Calibration Components - * - Retrieve the Curve Construction Input Set - * - Compute the Jacobian of the Discount Factor Latent State to the input Quote - * - Synthesize scenario Latent State by parallel shifting/custom tweaking the quantification metric - * - Synthesize scenario Latent State by parallel/custom shifting/custom tweaking the manifest measure - * - Serialize into and de-serialize out of byte array - * - * @author Lakshmi Krishnamurthy - */ - -public class ZeroRateDiscountCurve extends org.drip.state.discount.MergedDiscountForwardCurve { - private org.drip.spline.grid.Span _span = null; - private double _dblRightFlatForwardRate = java.lang.Double.NaN; - private org.drip.analytics.input.CurveConstructionInputSet _ccis = null; - - private ZeroRateDiscountCurve shiftManifestMeasure ( - final double[] adblShiftedManifestMeasure) - { - return null; - } - - /** - * ZeroRateDiscountCurve constructor - * - * @param strCurrency Currency - * @param span The Span Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ZeroRateDiscountCurve ( - final java.lang.String strCurrency, - final org.drip.spline.grid.Span span) - throws java.lang.Exception - { - super ((int) span.left(), strCurrency, null); - - _dblRightFlatForwardRate = (_span = span).calcResponseValue (_span.right()); - } - - @Override public double df ( - final int iDate) - throws java.lang.Exception - { - int iStartDate = epoch().julian(); - - if (iDate <= iStartDate) return 1.; - - return (java.lang.Math.exp (-1. * zero (iDate) * (iDate - iStartDate) / 365.25)) * turnAdjust - (iStartDate, iDate); - } - - public double forward ( - final int iDate1, - final int iDate2) - throws java.lang.Exception - { - int iStartDate = epoch().julian(); - - if (iDate1 < iStartDate || iDate2 < iStartDate) return 0.; - - return 365.25 / (iDate2 - iDate1) * java.lang.Math.log (df (iDate1) / df (iDate2)); - } - - @Override public double zero ( - final int iDate) - throws java.lang.Exception - { - if (iDate <= _span.left()) return 1.; - - return iDate <= _span.right() ? _span.calcResponseValue (iDate) : _dblRightFlatForwardRate; - } - - @Override public org.drip.state.forward.ForwardRateEstimator forwardRateEstimator ( - final int iDate, - final org.drip.state.identifier.ForwardLabel fri) - { - return null; - } - - @Override public java.lang.String latentStateQuantificationMetric() - { - return org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE; - } - - @Override public ZeroRateDiscountCurve parallelShiftManifestMeasure ( - final java.lang.String strManifestMeasure, - final double dblShift) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblShift)) return null; - - org.drip.product.definition.CalibratableComponent[] aCC = calibComp(); - - if (null == aCC) return null; - - int iNumComp = aCC.length; - double[] adblShiftedManifestMeasure = new double[iNumComp]; - - for (int i = 0; i < iNumComp; ++i) - adblShiftedManifestMeasure[i] += dblShift; - - return shiftManifestMeasure (adblShiftedManifestMeasure); - } - - @Override public ZeroRateDiscountCurve shiftManifestMeasure ( - final int iSpanIndex, - final java.lang.String strManifestMeasure, - final double dblShift) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblShift)) return null; - - org.drip.product.definition.CalibratableComponent[] aCC = calibComp(); - - if (null == aCC) return null; - - int iNumComp = aCC.length; - double[] adblShiftedManifestMeasure = new double[iNumComp]; - - if (iSpanIndex >= iNumComp) return null; - - for (int i = 0; i < iNumComp; ++i) - adblShiftedManifestMeasure[i] += (i == iSpanIndex ? dblShift : 0.); - - return shiftManifestMeasure (adblShiftedManifestMeasure); - } - - @Override public org.drip.state.discount.MergedDiscountForwardCurve customTweakManifestMeasure ( - final java.lang.String strManifestMeasure, - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - if (null == rvtp) return null; - - org.drip.product.definition.CalibratableComponent[] aCC = calibComp(); - - if (null == aCC) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap> - mapQuote = _ccis.quoteMap(); - - if (null == mapQuote || 0 == mapQuote.size()) return null; - - int iNumComp = aCC.length; - double[] adblQuote = new double[iNumComp]; - - for (int i = 0; i < iNumComp; ++i) - adblQuote[i] = mapQuote.get (aCC[i].primaryCode()).get (strManifestMeasure); - - double[] adblShiftedManifestMeasure = org.drip.analytics.support.Helper.TweakManifestMeasure - (adblQuote, rvtp); - - return shiftManifestMeasure (adblShiftedManifestMeasure); - } - - @Override public ZeroRateDiscountCurve parallelShiftQuantificationMetric ( - final double dblShift) - { - return null; - } - - @Override public org.drip.analytics.definition.Curve customTweakQuantificationMetric ( - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - return null; - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDDFDManifestMeasure ( - final int iDate, - final java.lang.String strManifestMeasure) - { - return null; - } - - @Override public org.drip.product.definition.CalibratableComponent[] calibComp() - { - return null == _ccis ? null : _ccis.components(); - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap manifestMeasure ( - final java.lang.String strInstrumentCode) - { - return null; - } -} diff --git a/org/drip/state/discount/DiscountCurve.java b/org/drip/state/discount/DiscountCurve.java deleted file mode 100644 index 50cc0df..0000000 --- a/org/drip/state/discount/DiscountCurve.java +++ /dev/null @@ -1,62 +0,0 @@ - -package org.drip.state.discount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * DiscountCurve Interface combines the Interfaces of Latent State Curve Representation and Discount Factor - * Estimator. - * - * @author Lakshmi Krishnamurthy - */ - -public interface DiscountCurve extends org.drip.analytics.definition.Curve, - org.drip.state.discount.DiscountFactorEstimator { -} diff --git a/org/drip/state/discount/DiscountFactorEstimator.java b/org/drip/state/discount/DiscountFactorEstimator.java deleted file mode 100644 index 1aaa607..0000000 --- a/org/drip/state/discount/DiscountFactorEstimator.java +++ /dev/null @@ -1,166 +0,0 @@ - -package org.drip.state.discount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * DiscountFactorEstimator is the interface that exposes the calculation of the Discount Factor for a - * specific Sovereign/Jurisdiction Span. It exposes the following functionality: - * - * - Curve Epoch Date - * - Discount Factor Target/Effective Variants - to Specified Julian Dates and/or Tenors - * - Forward Rate Target/Effective Variants - to Specified Julian Dates and/or Tenors - * - Zero Rate Target/Effective Variants - to Specified Julian Dates and/or Tenors - * - LIBOR Rate and LIBOR01 Target/Effective Variants - to Specified Julian Dates and/or Tenors - * - Curve Implied Arbitrary Measure Estimates - * - * @author Lakshmi Krishnamurthy - */ - -public interface DiscountFactorEstimator { - - /** - * Retrieve the Starting (Epoch) Date - * - * @return The Starting Date - */ - - public abstract org.drip.analytics.date.JulianDate epoch(); - - /** - * Calculate the Discount Factor to the given Date - * - * @param iDate Date - * - * @return Discount Factor - * - * @throws java.lang.Exception Thrown if the Discount Factor cannot be calculated - */ - - public abstract double df ( - final int iDate) - throws java.lang.Exception; - - /** - * Calculate the discount factor to the given date - * - * @param dt Date - * - * @return Discount factor - * - * @throws java.lang.Exception Thrown if the discount factor cannot be calculated - */ - - public abstract double df ( - final org.drip.analytics.date.JulianDate dt) - throws java.lang.Exception; - - /** - * Calculate the Discount Factor to the given Tenor - * - * @param strTenor Tenor - * - * @return Discount factor - * - * @throws java.lang.Exception Thrown if the Discount Factor cannot be calculated - */ - - public abstract double df ( - final java.lang.String strTenor) - throws java.lang.Exception; - - /** - * Compute the time-weighted discount factor between 2 dates - * - * @param iDate1 First Date - * @param iDate2 Second Date - * - * @return Discount Factor - * - * @throws java.lang.Exception Thrown if the discount factor cannot be calculated - */ - - public abstract double effectiveDF ( - final int iDate1, - final int iDate2) - throws java.lang.Exception; - - /** - * Compute the time-weighted discount factor between 2 dates - * - * @param dt1 First Date - * @param dt2 Second Date - * - * @return Discount Factor - * - * @throws java.lang.Exception Thrown if the discount factor cannot be calculated - */ - - public abstract double effectiveDF ( - final org.drip.analytics.date.JulianDate dt1, - final org.drip.analytics.date.JulianDate dt2) - throws java.lang.Exception; - - /** - * Compute the time-weighted discount factor between 2 tenors - * - * @param strTenor1 First Date - * @param strTenor2 Second Date - * - * @return Discount Factor - * - * @throws java.lang.Exception Thrown if the discount factor cannot be calculated - */ - - public abstract double effectiveDF ( - final java.lang.String strTenor1, - final java.lang.String strTenor2) - throws java.lang.Exception; -} diff --git a/org/drip/state/discount/ExplicitBootDiscountCurve.java b/org/drip/state/discount/ExplicitBootDiscountCurve.java deleted file mode 100644 index 60e0794..0000000 --- a/org/drip/state/discount/ExplicitBootDiscountCurve.java +++ /dev/null @@ -1,112 +0,0 @@ - -package org.drip.state.discount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * ExplicitBootDiscountCurve exposes the functionality associated with the bootstrapped Discount Curve. - * - Generate a curve shifted using targeted basis at specific nodes. - * - Generate scenario tweaked Latent State from the base forward curve corresponding to mode adjusted - * (flat/parallel/custom) manifest measure/quantification metric. - * - Retrieve array of latent state manifest measure, instrument quantification metric, and the array of - * calibration components. - * - Set/retrieve curve construction input instrument sets. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class ExplicitBootDiscountCurve extends org.drip.state.discount.MergedDiscountForwardCurve implements - org.drip.analytics.definition.ExplicitBootCurve { - - protected ExplicitBootDiscountCurve ( - final int iEpochDate, - final java.lang.String strCurrency) - throws java.lang.Exception - { - super (iEpochDate, strCurrency, null); - } - - /** - * Create a shifted curve from an array of basis shifts - * - * @param aiDate Array of dates - * @param adblBasis Array of basis - * - * @return Discount Curve - */ - - public abstract ExplicitBootDiscountCurve createBasisRateShiftedCurve ( - final int[] aiDate, - final double[] adblBasis); - - @Override public boolean setCCIS ( - final org.drip.analytics.input.CurveConstructionInputSet ccis) - { - return null != (_ccis = ccis); - } - - @Override public org.drip.product.definition.CalibratableComponent[] calibComp() - { - return null == _ccis ? null : _ccis.components(); - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap manifestMeasure ( - final java.lang.String strInstrumentCode) - { - if (null == _ccis) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap> - mapQuote = _ccis.quoteMap(); - - if (null == mapQuote || !mapQuote.containsKey (strInstrumentCode)) return null; - - return mapQuote.get (strInstrumentCode); - } -} diff --git a/org/drip/state/discount/MergedDiscountForwardCurve.java b/org/drip/state/discount/MergedDiscountForwardCurve.java deleted file mode 100644 index 954b976..0000000 --- a/org/drip/state/discount/MergedDiscountForwardCurve.java +++ /dev/null @@ -1,987 +0,0 @@ - -package org.drip.state.discount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * MergedDiscountForwardCurve is the Stub for the Merged Discount and Forward Curve Functionality. It extends - * the both the Curve and the DiscountFactorEstimator instances by implementing their functions, and - * exposing the following: - * - Forward Rate to a specific date/tenor, and effective rate between a date interval. - * - Discount Factor to a specific date/tenor, and effective discount factor between a date interval. - * - Zero Rate to a specific date/tenor. - * - Value Jacobian for Forward rate, discount factor, and zero rate. - * - Cross Jacobian between each of Forward rate, discount factor, and zero rate. - * - Quote Jacobian to Forward rate, discount factor, and zero rate. - * - QM (DF/Zero/Forward) to Quote Jacobian. - * - Latent State Quantification Metric, and the canonical truthness transformations. - * - Implied/embedded ForwardRateEstimator - * - Turns - set/unset/adjust. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class MergedDiscountForwardCurve implements org.drip.state.discount.DiscountCurve { - private static final int NUM_DF_QUADRATURES = 5; - - protected java.lang.String _strCurrency = ""; - protected int _iEpochDate = java.lang.Integer.MIN_VALUE; - protected org.drip.state.discount.TurnListDiscountFactor _tldf = null; - protected org.drip.analytics.input.CurveConstructionInputSet _ccis = null; - - protected MergedDiscountForwardCurve ( - final int iEpochDate, - final java.lang.String strCurrency, - final org.drip.state.discount.TurnListDiscountFactor tldf) - throws java.lang.Exception - { - if (null == (_strCurrency = strCurrency) || _strCurrency.isEmpty() || - !org.drip.quant.common.NumberUtil.IsValid (_iEpochDate = iEpochDate)) - throw new java.lang.Exception ("MergedDiscountForwardCurve ctr: Invalid Inputs"); - - _tldf = tldf; - } - - @Override public org.drip.state.identifier.LatentStateLabel label() - { - return org.drip.state.identifier.FundingLabel.Standard (_strCurrency); - } - - @Override public java.lang.String currency() - { - return _strCurrency; - } - - @Override public org.drip.analytics.date.JulianDate epoch() - { - try { - return new org.drip.analytics.date.JulianDate (_iEpochDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Set the Discount Curve Turns' - * - * @param tldf Turn List Discount Factor - * - * @return TRUE - Valid Turn List Discount Factor Set - */ - - public boolean setTurns ( - final org.drip.state.discount.TurnListDiscountFactor tldf) - { - return null != (_tldf = tldf); - } - - /** - * Apply the Turns' DF Adjustment - * - * @param iStartDate Turn Start Date - * @param iFinishDate Turn Finish Date - * - * @return Turns' DF Adjustment - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public double turnAdjust ( - final int iStartDate, - final int iFinishDate) - throws java.lang.Exception - { - return null == _tldf ? 1. : _tldf.turnAdjust (iStartDate, iFinishDate); - } - - /** - * Apply the Turns' DF Adjustment - * - * @param iFinishDate Turn Finish Date - * - * @return Turns' DF Adjustment - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - protected double turnAdjust ( - final int iFinishDate) - throws java.lang.Exception - { - return turnAdjust (epoch().julian(), iFinishDate); - } - - /** - * Construct the Native Forward Curve for the given Tenor from the Discount Curve - * - * @param strTenor The Tenor - * - * @return The Tenor-Native Forward Curve - */ - - public org.drip.state.forward.ForwardCurve nativeForwardCurve ( - final java.lang.String strTenor) - { - if (null == strTenor || strTenor.isEmpty()) return null; - - try { - org.drip.state.forward.ForwardCurve fcNative = new org.drip.state.forward.ForwardCurve - (epoch().julian(), org.drip.state.identifier.ForwardLabel.Standard (_strCurrency + "-" + - strTenor)) { - @Override public double forward ( - final int iDate) - throws java.lang.Exception - { - return forward (new org.drip.analytics.date.JulianDate (iDate)); - } - - @Override public double forward ( - final org.drip.analytics.date.JulianDate dt) - throws java.lang.Exception - { - if (null == dt) - throw new java.lang.Exception - ("MergedDiscountForwardCurve::nativeForwardCurve => Invalid Input"); - - return libor (dt.subtractTenor (strTenor).julian(), strTenor); - } - - @Override public double forward ( - final java.lang.String strTenor) - throws java.lang.Exception - { - if (null == strTenor || strTenor.isEmpty()) - throw new java.lang.Exception - ("MergedDiscountForwardCurve::nativeForwardCurve => Invalid Input"); - - return forward (epoch().addTenor (strTenor)); - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDForwardDManifestMeasure ( - final java.lang.String strManifestMeasure, - final int iDate) - { - return null; - } - }; - - return fcNative; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public double df ( - final org.drip.analytics.date.JulianDate dt) - throws java.lang.Exception - { - if (null == dt) throw new java.lang.Exception ("MergedDiscountForwardCurve::df got null for date"); - - return df (dt.julian()); - } - - @Override public double df ( - final java.lang.String strTenor) - throws java.lang.Exception - { - if (null == strTenor || strTenor.isEmpty()) - throw new java.lang.Exception ("MergedDiscountForwardCurve::df got bad tenor"); - - return df (epoch().addTenor (strTenor)); - } - - @Override public double effectiveDF ( - final int iDate1, - final int iDate2) - throws java.lang.Exception - { - if (iDate1 == iDate2) return df (iDate1); - - int iNumQuadratures = 0; - double dblEffectiveDF = 0.; - int iQuadratureWidth = (iDate2 - iDate1) / NUM_DF_QUADRATURES; - - if (0 == iQuadratureWidth) iQuadratureWidth = 1; - - for (int iDate = iDate1; iDate <= iDate2; iDate += iQuadratureWidth) { - ++iNumQuadratures; - - dblEffectiveDF += (df (iDate) + df (iDate + iQuadratureWidth)); - } - - return dblEffectiveDF / (2. * iNumQuadratures); - } - - @Override public double effectiveDF ( - final org.drip.analytics.date.JulianDate dt1, - final org.drip.analytics.date.JulianDate dt2) - throws java.lang.Exception - { - if (null == dt1 || null == dt2) - throw new java.lang.Exception ("MergedDiscountForwardCurve::effectiveDF => Got null for date"); - - return effectiveDF (dt1.julian(), dt2.julian()); - } - - @Override public double effectiveDF ( - final java.lang.String strTenor1, - final java.lang.String strTenor2) - throws java.lang.Exception - { - if (null == strTenor1 || strTenor1.isEmpty() || null == strTenor2 || strTenor2.isEmpty()) - throw new java.lang.Exception ("MergedDiscountForwardCurve::effectiveDF => Got bad tenor"); - - org.drip.analytics.date.JulianDate dtStart = epoch(); - - return effectiveDF (dtStart.addTenor (strTenor1), dtStart.addTenor (strTenor2)); - } - - /** - * Compute the Forward Rate between two Dates - * - * @param iDate1 First Date - * @param iDate2 Second Date - * - * @return The Forward Rate - * - * @throws java.lang.Exception Thrown if the Forward Rate cannot be calculated - */ - - public abstract double forward ( - final int iDate1, - final int iDate2) - throws java.lang.Exception; - - /** - * Compute the Forward Rate between two Tenors - * - * @param strTenor1 Tenor Start - * @param strTenor2 Tenor End - * - * @return The Forward Rate - * - * @throws java.lang.Exception Thrown if the Forward Rate cannot be calculated - */ - - public double forward ( - final java.lang.String strTenor1, - final java.lang.String strTenor2) - throws java.lang.Exception - { - if (null == strTenor1 || strTenor1.isEmpty() || null == strTenor2 || strTenor2.isEmpty()) - throw new java.lang.Exception ("MergedDiscountForwardCurve::forward => Invalid Date"); - - org.drip.analytics.date.JulianDate dtStart = epoch(); - - return forward (dtStart.addTenor (strTenor1).julian(), dtStart.addTenor (strTenor2).julian()); - } - - /** - * Calculate the implied rate to the given date - * - * @param iDate Date - * - * @return Implied rate - * - * @throws java.lang.Exception Thrown if the discount factor cannot be calculated - */ - - public abstract double zero ( - final int iDate) - throws java.lang.Exception; - - /** - * Calculate the implied rate to the given tenor - * - * @param strTenor Tenor - * - * @return Implied rate - * - * @throws java.lang.Exception Thrown if the discount factor cannot be calculated - */ - - public double zero ( - final java.lang.String strTenor) - throws java.lang.Exception - { - if (null == strTenor || strTenor.isEmpty()) - throw new java.lang.Exception ("MergedDiscountForwardCurve::zero => Invalid date"); - - org.drip.analytics.date.JulianDate dtStart = epoch(); - - return forward (dtStart.julian(), dtStart.addTenor (strTenor).julian()); - } - - /** - * Compute the LIBOR between 2 dates given the Day Count - * - * @param iDate1 First Date - * @param iDate2 Second Date - * @param dblDCF Day Count Fraction - * - * @return LIBOR - * - * @throws java.lang.Exception Thrown if the discount factor cannot be calculated - */ - - public double libor ( - final int iDate1, - final int iDate2, - final double dblDCF) - throws java.lang.Exception - { - if (iDate1 == iDate2 || !org.drip.quant.common.NumberUtil.IsValid (dblDCF) || 0. == dblDCF) - throw new java.lang.Exception ("MergedDiscountForwardCurve::libor => Invalid input dates"); - - return ((df (iDate1) / df (iDate2)) - 1.) / dblDCF; - } - - /** - * Compute the LIBOR between 2 dates - * - * @param iDate1 First Date - * @param iDate2 Second Date - * - * @return LIBOR - * - * @throws java.lang.Exception Thrown if the discount factor cannot be calculated - */ - - public double libor ( - final int iDate1, - final int iDate2) - throws java.lang.Exception - { - if (iDate1 == iDate2) - throw new java.lang.Exception ("MergedDiscountForwardCurve::libor => Invalid input dates"); - - return libor (iDate1, iDate2, org.drip.analytics.daycount.Convention.YearFraction (iDate1, iDate2, - "Act/360", false, null, "")); - } - - /** - * Calculate the LIBOR to the given tenor at the specified date - * - * @param iStartDate Start Date - * @param strTenor Tenor - * - * @return LIBOR - * - * @throws java.lang.Exception Thrown if LIBOR cannot be calculated - */ - - public double libor ( - final int iStartDate, - final java.lang.String strTenor) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (iStartDate) || null == strTenor || strTenor.isEmpty()) - throw new java.lang.Exception ("MergedDiscountForwardCurve::libor => Invalid Inputs"); - - return libor (iStartDate, new org.drip.analytics.date.JulianDate (iStartDate).addTenor - (strTenor).julian()); - } - - /** - * Calculate the LIBOR to the given tenor at the specified Julian Date - * - * @param dt Julian Date - * @param strTenor Tenor - * - * @return LIBOR - * - * @throws java.lang.Exception Thrown if LIBOR cannot be calculated - */ - - public double libor ( - final org.drip.analytics.date.JulianDate dt, - final java.lang.String strTenor) - throws java.lang.Exception - { - if (null == dt) - throw new java.lang.Exception ("MergedDiscountForwardCurve::libor => Invalid Inputs"); - - return libor (dt.julian(), strTenor); - } - - /** - * Calculate the DV01 of the Par Swap that Matures at the given date - * - * @param iDate Date - * - * @return DV01 of the Par Swap that Matures at the given date - * - * @throws java.lang.Exception Thrown if DV01 cannot be calculated - */ - - public double parSwapDV01 ( - final int iDate) - throws java.lang.Exception - { - java.lang.String strCurrency = currency(); - - org.drip.analytics.date.JulianDate dtStart = epoch().addDays (2); - - org.drip.param.period.UnitCouponAccrualSetting ucasFixed = new - org.drip.param.period.UnitCouponAccrualSetting (2, "Act/360", false, "Act/360", false, - strCurrency, true, - org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC); - - org.drip.param.period.ComposableFixedUnitSetting cfusFixed = new - org.drip.param.period.ComposableFixedUnitSetting ("6M", - org.drip.analytics.support.CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR, null, 0., 0., - strCurrency); - - org.drip.param.period.CompositePeriodSetting cpsFixed = new - org.drip.param.period.CompositePeriodSetting (2, "6M", strCurrency, null, 1., null, null, null, - null); - - java.util.List lsFixedStreamEdgeDate = - org.drip.analytics.support.CompositePeriodBuilder.BackwardEdgeDates (dtStart, new - org.drip.analytics.date.JulianDate (iDate), "6M", null, - org.drip.analytics.support.CompositePeriodBuilder.SHORT_STUB); - - org.drip.product.rates.Stream fixedStream = new org.drip.product.rates.Stream - (org.drip.analytics.support.CompositePeriodBuilder.FixedCompositeUnit (lsFixedStreamEdgeDate, - cpsFixed, ucasFixed, cfusFixed)); - - org.drip.param.market.CurveSurfaceQuoteContainer csqs = - org.drip.param.creator.MarketParamsBuilder.Create (this, null, null, null, null, null, null, - null); - - java.util.Map mapFixStream = fixedStream.value - (org.drip.param.valuation.ValuationParams.Spot (dtStart, 0, "", - org.drip.analytics.daycount.Convention.DATE_ROLL_ACTUAL), null, csqs, null); - - return mapFixStream.get ("DV01"); - } - - /** - * Estimate the manifest measure value for the given date - * - * @param strManifestMeasure The Manifest Measure to be Estimated - * @param iDate Date - * - * @return The estimated calibrated measure value - * - * @throws java.lang.Exception Thrown if the estimated manifest measure cannot be computed - */ - - public double estimateManifestMeasure ( - final java.lang.String strManifestMeasure, - final int iDate) - throws java.lang.Exception - { - if (null == strManifestMeasure || strManifestMeasure.isEmpty()) - throw new java.lang.Exception - ("MergedDiscountForwardCurve::estimateManifestMeasure => Invalid input"); - - org.drip.product.definition.CalibratableComponent[] aCalibComp = calibComp(); - - if (null == aCalibComp) - throw new java.lang.Exception - ("MergedDiscountForwardCurve::estimateManifestMeasure => Calib Components not available"); - - int iNumComponent = aCalibComp.length; - - if (0 == iNumComponent) - throw new java.lang.Exception - ("MergedDiscountForwardCurve::estimateManifestMeasure => Calib Components not available"); - - java.util.List lsDate = new java.util.ArrayList(); - - java.util.List lsQuote = new java.util.ArrayList(); - - for (int i = 0; i < iNumComponent; ++i) { - if (null == aCalibComp[i]) - throw new java.lang.Exception - ("MergedDiscountForwardCurve::estimateManifestMeasure => Cannot locate a component"); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapManifestMeasure = - manifestMeasure (aCalibComp[i].primaryCode()); - - if (mapManifestMeasure.containsKey (strManifestMeasure)) { - lsDate.add (aCalibComp[i].maturityDate().julian()); - - lsQuote.add (mapManifestMeasure.get (strManifestMeasure)); - } - } - - int iNumEstimationComponent = lsDate.size(); - - if (0 == iNumEstimationComponent) - throw new java.lang.Exception - ("MergedDiscountForwardCurve::estimateManifestMeasure => Estimation Components not available"); - - int[] aiDate = new int[iNumEstimationComponent]; - double[] adblQuote = new double[iNumEstimationComponent]; - org.drip.spline.params.SegmentCustomBuilderControl[] aSBP = new - org.drip.spline.params.SegmentCustomBuilderControl[iNumEstimationComponent - 1]; - - if (1 == iNumEstimationComponent) return lsQuote.get (0); - - org.drip.spline.params.SegmentCustomBuilderControl sbp = new - org.drip.spline.params.SegmentCustomBuilderControl - (org.drip.spline.stretch.MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new - org.drip.spline.basis.PolynomialFunctionSetParams (4), - org.drip.spline.params.SegmentInelasticDesignControl.Create (2, 2), null, null); - - for (int i = 0; i < iNumEstimationComponent; ++i) { - if (0 != i) aSBP[i - 1] = sbp; - - aiDate[i] = lsDate.get (i); - - adblQuote[i] = lsQuote.get (i); - } - - org.drip.spline.stretch.MultiSegmentSequence regime = - org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateCalibratedStretchEstimator - ("DISC_CURVE_REGIME", aiDate, adblQuote, aSBP, null, - org.drip.spline.stretch.BoundarySettings.NaturalStandard(), - org.drip.spline.stretch.MultiSegmentSequence.CALIBRATE); - - if (null == regime) - throw new java.lang.Exception - ("MergedDiscountForwardCurve::estimateManifestMeasure => Cannot create Spline Stretch"); - - double dblRegimeLeftExtreme = regime.getLeftPredictorOrdinateEdge(); - - if (iDate <= dblRegimeLeftExtreme) return regime.responseValue (dblRegimeLeftExtreme); - - double dblRegimeRightExtreme = regime.getRightPredictorOrdinateEdge(); - - if (iDate >= dblRegimeRightExtreme) return regime.responseValue (dblRegimeRightExtreme); - - return regime.responseValue (iDate); - } - - @Override public boolean setCCIS ( - final org.drip.analytics.input.CurveConstructionInputSet ccis) - { - if (null == ccis) return false; - - _ccis = ccis; - return true; - } - - /** - * Retrieve the Forward Curve that might be implied by the Latent State of this Discount Curve Instance - * corresponding to the specified Floating Rate Index - * - * @param iDate The Date - * @param fri The Floating Rate Index - * - * @return The Forward Curve Implied by the Discount Curve Latent State - */ - - public abstract org.drip.state.forward.ForwardRateEstimator forwardRateEstimator ( - final int iDate, - final org.drip.state.identifier.ForwardLabel fri); - - /** - * Retrieve the Latent State Quantification Metric - * - * @return The Latent State Quantification Metric - */ - - public abstract java.lang.String latentStateQuantificationMetric(); - - /** - * Retrieve the Manifest Measure Jacobian of the Discount Factor to the given date - * - * @param iDate Date - * @param strManifestMeasure Manifest Measure - * - * @return The Manifest Measure Jacobian of the Discount Factor to the given date - */ - - public abstract org.drip.quant.calculus.WengertJacobian jackDDFDManifestMeasure ( - final int iDate, - final java.lang.String strManifestMeasure); - - /** - * Retrieve the Manifest Measure Jacobian of the Discount Factor to the given date - * - * @param dt Date - * @param strManifestMeasure Manifest Measure - * - * @return The Manifest Measure Jacobian of the Discount Factor to the given date - */ - - public org.drip.quant.calculus.WengertJacobian jackDDFDManifestMeasure ( - final org.drip.analytics.date.JulianDate dt, - final java.lang.String strManifestMeasure) - { - if (null == dt) return null; - - return jackDDFDManifestMeasure (dt.julian(), strManifestMeasure); - } - - /** - * Retrieve the Manifest Measure Jacobian of the Discount Factor to the date implied by the given Tenor - * - * @param strTenor Tenor - * @param strManifestMeasure Manifest Measure - * - * @return The Manifest Measure Jacobian of the Discount Factor to the date implied by the given Tenor - */ - - public org.drip.quant.calculus.WengertJacobian jackDDFDManifestMeasure ( - final java.lang.String strTenor, - final java.lang.String strManifestMeasure) - { - if (null == strTenor || strTenor.isEmpty()) return null; - - try { - return jackDDFDManifestMeasure (epoch().addTenor (strTenor), strManifestMeasure); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Calculate the Jacobian of PV at the given date to the Manifest Measure of each component in the - * calibration set to the DF - * - * @param iDate Date for which the Jacobian is needed - * - * @return The Jacobian - */ - - public org.drip.quant.calculus.WengertJacobian compJackDPVDManifestMeasure ( - final int iDate) - { - if (!org.drip.quant.common.NumberUtil.IsValid (iDate)) return null; - - org.drip.product.definition.CalibratableComponent[] aCalibComp = calibComp(); - - if (null == aCalibComp || 0 == aCalibComp.length) return null; - - int iNumParameters = 0; - int iNumComponents = aCalibComp.length; - org.drip.quant.calculus.WengertJacobian wjCompPVDF = null; - - org.drip.param.valuation.ValuationParams valParams = org.drip.param.valuation.ValuationParams.Spot - (iDate); - - org.drip.param.market.CurveSurfaceQuoteContainer csqs = - org.drip.param.creator.MarketParamsBuilder.Create (this, null, null, null, null, null, - null, null == _ccis ? null : _ccis.fixing()); - - for (int i = 0; i < iNumComponents; ++i) { - org.drip.quant.calculus.WengertJacobian wjCompDDirtyPVDManifestMeasure = - aCalibComp[i].jackDDirtyPVDManifestMeasure (valParams, null, csqs, null); - - if (null == wjCompDDirtyPVDManifestMeasure) return null; - - iNumParameters = wjCompDDirtyPVDManifestMeasure.numParameters(); - - if (null == wjCompPVDF) { - try { - wjCompPVDF = new org.drip.quant.calculus.WengertJacobian (iNumComponents, - iNumParameters); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - for (int k = 0; k < iNumParameters; ++k) { - if (!wjCompPVDF.accumulatePartialFirstDerivative (i, k, - wjCompDDirtyPVDManifestMeasure.firstDerivative (0, k))) - return null; - } - } - - return wjCompPVDF; - } - - /** - * Calculate the Jacobian of PV at the given date to the Manifest Measure of each component in the - * calibration set to the DF - * - * @param dt Date for which the Jacobian is needed - * - * @return The Jacobian - */ - - public org.drip.quant.calculus.WengertJacobian compJackDPVDManifestMeasure ( - final org.drip.analytics.date.JulianDate dt) - { - return null == dt ? null : compJackDPVDManifestMeasure (dt.julian()); - } - - /** - * Retrieve the Jacobian of the Forward Rate to the Manifest Measure between the given dates - * - * @param iDate1 Date 1 - * @param iDate2 Date 2 - * @param strManifestMeasure Manifest Measure - * @param dblElapsedYear The Elapsed Year (in the appropriate Day Count) between dates 1 and 2 - * - * @return The Jacobian - */ - - public org.drip.quant.calculus.WengertJacobian jackDForwardDManifestMeasure ( - final int iDate1, - final int iDate2, - final java.lang.String strManifestMeasure, - final double dblElapsedYear) - { - if (iDate1 == iDate2) return null; - - org.drip.quant.calculus.WengertJacobian wjDDFDManifestMeasureDate1 = jackDDFDManifestMeasure - (iDate1, strManifestMeasure); - - if (null == wjDDFDManifestMeasureDate1) return null; - - int iNumQuote = wjDDFDManifestMeasureDate1.numParameters(); - - if (0 == iNumQuote) return null; - - org.drip.quant.calculus.WengertJacobian wjDDFDManifestMeasureDate2 = jackDDFDManifestMeasure - (iDate2, strManifestMeasure); - - if (null == wjDDFDManifestMeasureDate2 || iNumQuote != wjDDFDManifestMeasureDate2.numParameters()) - return null; - - double dblDF1 = java.lang.Double.NaN; - double dblDF2 = java.lang.Double.NaN; - org.drip.quant.calculus.WengertJacobian wjDForwardDManifestMeasure = null; - - try { - dblDF1 = df (iDate1); - - dblDF2 = df (iDate2); - - wjDForwardDManifestMeasure = new org.drip.quant.calculus.WengertJacobian (1, iNumQuote); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - double dblDForwardDManifestMeasure1iScale = 1. / dblDF2; - double dblDForwardDManifestMeasure2iScale = dblDF1 / (dblDF2 * dblDF2); - double dblInverseAnnualizedTenorLength = 1. / dblElapsedYear; - - for (int i = 0; i < iNumQuote; ++i) { - double dblDForwardDQManifestMeasurei = ((wjDDFDManifestMeasureDate1.firstDerivative (0, i) * - dblDForwardDManifestMeasure1iScale) - (wjDDFDManifestMeasureDate2.firstDerivative (0, i) * - dblDForwardDManifestMeasure2iScale)) * dblInverseAnnualizedTenorLength; - - if (!wjDForwardDManifestMeasure.accumulatePartialFirstDerivative (0, i, - dblDForwardDQManifestMeasurei)) - return null; - } - - return wjDForwardDManifestMeasure; - } - - /** - * Retrieve the Jacobian of the Forward Rate to the Manifest Measure between the given dates - * - * @param dt1 Julian Date 1 - * @param dt2 Julian Date 2 - * @param strManifestMeasure Manifest Measure - * @param dblElapsedYear The Elapsed Year (in the appropriate Day Count) between dates 1 and 2 - * - * @return The Jacobian - */ - - public org.drip.quant.calculus.WengertJacobian jackDForwardDManifestMeasure ( - final org.drip.analytics.date.JulianDate dt1, - final org.drip.analytics.date.JulianDate dt2, - final java.lang.String strManifestMeasure, - final double dblElapsedYear) - { - if (null == dt1 || null == dt2) return null; - - return jackDForwardDManifestMeasure (dt1.julian(), dt2.julian(), strManifestMeasure, dblElapsedYear); - } - - /** - * Retrieve the Jacobian of the Forward Rate to the Manifest Measure at the given date - * - * @param dt Given Julian Date - * @param strTenor Tenor - * @param strManifestMeasure Manifest Measure - * @param dblElapsedYear The Elapsed Year (in the appropriate Day Count) implied by the Tenor - * - * @return The Jacobian - */ - - public org.drip.quant.calculus.WengertJacobian jackDForwardDManifestMeasure ( - final org.drip.analytics.date.JulianDate dt, - final java.lang.String strTenor, - final java.lang.String strManifestMeasure, - final double dblElapsedYear) - { - if (null == dt || null == strTenor || strTenor.isEmpty()) return null; - - return jackDForwardDManifestMeasure (dt.julian(), dt.addTenor (strTenor).julian(), - strManifestMeasure, dblElapsedYear); - } - - /** - * Retrieve the Jacobian for the Zero Rate to the given date - * - * @param iDate Date - * @param strManifestMeasure Manifest Measure - * - * @return The Jacobian - */ - - public org.drip.quant.calculus.WengertJacobian zeroRateJack ( - final int iDate, - final java.lang.String strManifestMeasure) - { - int iEpochDate = epoch().julian(); - - return jackDForwardDManifestMeasure (iEpochDate, iDate, strManifestMeasure, 1. * (iDate - iEpochDate) / - 365.25); - } - - /** - * Retrieve the Jacobian for the Zero Rate to the given date - * - * @param dt Julian Date - * @param strManifestMeasure Manifest Measure - * - * @return The Jacobian - */ - - public org.drip.quant.calculus.WengertJacobian zeroRateJack ( - final org.drip.analytics.date.JulianDate dt, - final java.lang.String strManifestMeasure) - { - return null == dt? null : zeroRateJack (dt.julian(), strManifestMeasure); - } - - /** - * Convert the inferred Formulation Constraint into a "Truthness" Entity - * - * @param strLatentStateQuantificationMetric Latent State Quantification Metric - * - * @return Map of the Truthness Entities - */ - - public java.util.Map canonicalTruthness ( - final java.lang.String strLatentStateQuantificationMetric) - { - if (null == strLatentStateQuantificationMetric || - (!org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE.equalsIgnoreCase - (strLatentStateQuantificationMetric) && ! - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR.equalsIgnoreCase - (strLatentStateQuantificationMetric))) - return null; - - org.drip.product.definition.CalibratableComponent[] aCC = calibComp(); - - if (null == aCC) return null; - - int iNumComp = aCC.length; - boolean bFirstCashFlow = true; - - if (0 == iNumComp) return null; - - java.util.Map mapCanonicalTruthness = new - java.util.TreeMap(); - - if (org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR.equalsIgnoreCase - (strLatentStateQuantificationMetric)) - mapCanonicalTruthness.put (_iEpochDate, 1.); - - for (org.drip.product.definition.CalibratableComponent cc : aCC) { - if (null == cc) continue; - - java.util.List lsCouponPeriod = cc.couponPeriods(); - - if (null == lsCouponPeriod || 0 == lsCouponPeriod.size()) continue; - - for (org.drip.analytics.cashflow.CompositePeriod cpnPeriod : lsCouponPeriod) { - if (null == cpnPeriod) continue; - - int iPeriodPayDate = cpnPeriod.payDate(); - - if (iPeriodPayDate >= _iEpochDate) { - try { - if (org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR.equalsIgnoreCase - (strLatentStateQuantificationMetric)) - mapCanonicalTruthness.put (iPeriodPayDate, df (iPeriodPayDate)); - else if (org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE.equalsIgnoreCase - (strLatentStateQuantificationMetric)) { - if (bFirstCashFlow) { - bFirstCashFlow = false; - - mapCanonicalTruthness.put (_iEpochDate, zero (iPeriodPayDate)); - } - - mapCanonicalTruthness.put (iPeriodPayDate, zero (iPeriodPayDate)); - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - } - } - - return mapCanonicalTruthness; - } -} diff --git a/org/drip/state/discount/TurnListDiscountFactor.java b/org/drip/state/discount/TurnListDiscountFactor.java deleted file mode 100644 index 75afd84..0000000 --- a/org/drip/state/discount/TurnListDiscountFactor.java +++ /dev/null @@ -1,127 +0,0 @@ - -package org.drip.state.discount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * TurnListDiscountFactor implements the discounting based off of the turns list. Its functions add a turn - * instance to the current set, and concurrently apply the discount factor inside the range to each relevant - * turn. - * - * @author Lakshmi Krishnamurthy - */ - -public class TurnListDiscountFactor { - private java.util.List _lsTurn = null; - - /** - * Empty TurnListDiscountFactor constructor - */ - - public TurnListDiscountFactor() - { - } - - /** - * Add a Turn Instance to the Discount Curve - * - * @param turn The Turn Instance to be added - * - * @return TRUE - Successfully added - */ - - public boolean addTurn ( - final org.drip.analytics.definition.Turn turn) - { - if (null == turn) return false; - - if (null == _lsTurn) _lsTurn = new java.util.ArrayList(); - - _lsTurn.add (turn); - - return true; - } - - /** - * Apply the Turns' DF Adjustment - * - * @param iStartDate Turn Start Date - * @param iFinishDate Turn Finish Date - * - * @return Turns' DF Adjustment - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public double turnAdjust ( - final int iStartDate, - final int iFinishDate) - throws java.lang.Exception - { - if (null == _lsTurn || 0 == _lsTurn.size()) return 1.; - - if (iStartDate >= iFinishDate) return 1.; - - double dblTurnAdjust = 1.; - - for (org.drip.analytics.definition.Turn turn : _lsTurn) { - if (null == turn || iStartDate >= turn.finishDate() || iFinishDate <= turn.startDate()) continue; - - int iEffectiveStart = turn.startDate() > iStartDate ? turn.startDate() : iStartDate; - - int iEffectiveFinish = turn.finishDate() < iFinishDate ? turn.finishDate() : iFinishDate; - - dblTurnAdjust *= java.lang.Math.exp (turn.spread() * (iEffectiveStart - iEffectiveFinish) / - 365.25); - } - - return dblTurnAdjust; - } -} diff --git a/org/drip/state/discount/ZeroCurve.java b/org/drip/state/discount/ZeroCurve.java deleted file mode 100644 index 27062f6..0000000 --- a/org/drip/state/discount/ZeroCurve.java +++ /dev/null @@ -1,100 +0,0 @@ - -package org.drip.state.discount; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 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. - */ - -/** - * ZeroCurve exposes the node set containing the zero curve node points. In addition to the discount curve - * functionality that it automatically provides by extension, it provides the functionality to calculate the - * zero rate. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class ZeroCurve implements org.drip.state.discount.DiscountCurve { - private int _iEpochDate = -1; - private java.lang.String _strCurrency = ""; - - protected ZeroCurve ( - final int iEpochDate, - final java.lang.String strCurrency) - throws java.lang.Exception - { - if (null == (_strCurrency = strCurrency) || _strCurrency.isEmpty()) - throw new java.lang.Exception ("ZeroCurve Constructor => Invalid Inputs!"); - - _iEpochDate = iEpochDate; - } - - @Override public org.drip.analytics.date.JulianDate epoch() - { - return new org.drip.analytics.date.JulianDate (_iEpochDate); - } - - @Override public java.lang.String currency() - { - return _strCurrency; - } - - /** - * Retrieve the zero rate corresponding to the given date - * - * @param iDate Date for which the zero rate is requested - * - * @return Zero Rate - * - * @throws java.lang.Exception Thrown if the date is not represented in the map - */ - - public abstract double zeroRate ( - final int iDate) - throws java.lang.Exception; -} diff --git a/org/drip/state/estimator/CurveStretch.java b/org/drip/state/estimator/CurveStretch.java deleted file mode 100644 index 485d335..0000000 --- a/org/drip/state/estimator/CurveStretch.java +++ /dev/null @@ -1,167 +0,0 @@ - -package org.drip.state.estimator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * CurveStretch expands the regular Multi-Segment Stretch to aid the calibration of Boot-strapped - * Instruments. - * - * In particular, CurveStretch implements the following functions that are used at different stages of - * curve construction sequence: - * - Mark the Range of the "built" Segments - * - Clear the built range mark to signal the start of a fresh calibration run - * - Indicate if the specified Predictor Ordinate is inside the "Built" Range - * - Retrieve the MergeSubStretchManager - * - * @author Lakshmi Krishnamurthy - */ - -public class CurveStretch extends org.drip.spline.stretch.CalibratableMultiSegmentSequence { - private double _dblBuiltPredictorOrdinateRight = java.lang.Double.NaN; - private org.drip.state.representation.MergeSubStretchManager _msm = null; - - /** - * CurveStretch constructor - Construct a sequence of Basis Spline Segments - * - * @param strName Name of the Stretch - * @param aCS Array of Segments - * @param aSCBC Array of Segment Builder Parameters - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public CurveStretch ( - final java.lang.String strName, - final org.drip.spline.segment.LatentStateResponseModel[] aCS, - final org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC) - throws java.lang.Exception - { - super (strName, aCS, aSCBC); - - _dblBuiltPredictorOrdinateRight = getLeftPredictorOrdinateEdge(); - } - - /** - * Mark the Range of the "built" Segments, and set the set of Merge Latent States - * - * @param iSegment The Current Segment Range Built - * @param setLSL Set of the merging Latent State Labels - * - * @return TRUE - Range successfully marked as "built" - */ - - public boolean markSegmentBuilt ( - final int iSegment, - final java.util.Set setLSL) - { - org.drip.spline.segment.LatentStateResponseModel[] aCS = segments(); - - if (iSegment >= aCS.length) return false; - - _dblBuiltPredictorOrdinateRight = aCS[iSegment].right(); - - if (null == setLSL || 0 == setLSL.size()) return true; - - if (null == _msm) _msm = new org.drip.state.representation.MergeSubStretchManager(); - - for (org.drip.state.identifier.LatentStateLabel lsl : setLSL) { - try { - if (!_msm.addMergeStretch (new org.drip.state.representation.LatentStateMergeSubStretch - (aCS[iSegment].left(), aCS[iSegment].right(), lsl))) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - } - - return true; - } - - /** - * Clear the built range mark to signal the start of a fresh calibration run - * - * @return TRUE - Built Range successfully cleared - */ - - public boolean clearBuiltRange() - { - _dblBuiltPredictorOrdinateRight = getLeftPredictorOrdinateEdge(); - - _msm = null; - return true; - } - - /** - * Indicate if the specified Predictor Ordinate is inside the "Built" Range - * - * @param dblPredictorOrdinate The Predictor Ordinate - * - * @return TRUE - The specified Predictor Ordinate is inside the "Built" Range - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public boolean inBuiltRange ( - final double dblPredictorOrdinate) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictorOrdinate)) - throw new java.lang.Exception ("CurveStretch.inBuiltRange => Invalid Inputs"); - - return dblPredictorOrdinate >= getLeftPredictorOrdinateEdge() && dblPredictorOrdinate <= - _dblBuiltPredictorOrdinateRight; - } - - @Override public org.drip.state.representation.MergeSubStretchManager msm() - { - return _msm; - } -} diff --git a/org/drip/state/estimator/GlobalControlCurveParams.java b/org/drip/state/estimator/GlobalControlCurveParams.java deleted file mode 100644 index 5cd8bf6..0000000 --- a/org/drip/state/estimator/GlobalControlCurveParams.java +++ /dev/null @@ -1,104 +0,0 @@ - -package org.drip.state.estimator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * GlobalControlCurveParams enhances the SmoothingCurveStretchParams to produce globally customized curve - * smoothing. - * - * Currently, GlobalControlCurveParams uses custom boundary setting and spline details to implement the - * global smoothing pass. - * - * @author Lakshmi Krishnamurthy - */ - -public class GlobalControlCurveParams extends org.drip.state.estimator.SmoothingCurveStretchParams { - private org.drip.spline.stretch.BoundarySettings _bs = null; - - /** - * GlobalControlCurveParams constructor - * - * @param strSmootheningQuantificationMetric Curve Smoothening Quantification Metric - * @param prbp Segment Builder Parameters - * @param bs The Calibration Boundary Condition - * @param iCalibrationDetail The Calibration Detail - * @param sbfr Curve Fitness Weighted Response - * @param sbfrSensitivity Curve Fitness Weighted Response Sensitivity - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public GlobalControlCurveParams ( - final java.lang.String strSmootheningQuantificationMetric, - final org.drip.spline.params.SegmentCustomBuilderControl prbp, - final org.drip.spline.stretch.BoundarySettings bs, - final int iCalibrationDetail, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final org.drip.spline.params.StretchBestFitResponse sbfrSensitivity) - throws java.lang.Exception - { - super (strSmootheningQuantificationMetric, prbp, iCalibrationDetail, sbfr, sbfrSensitivity); - - if (null == (_bs = bs)) - throw new java.lang.Exception ("GlobalControlCurveParams ctr: Invalid Inputs"); - } - - /** - * Retrieve the Calibration Boundary Condition - * - * @return The Calibration Boundary Condition - */ - - public org.drip.spline.stretch.BoundarySettings calibrationBoundaryCondition() - { - return _bs; - } -} diff --git a/org/drip/state/estimator/LatentStateStretchBuilder.java b/org/drip/state/estimator/LatentStateStretchBuilder.java deleted file mode 100644 index 68b03e9..0000000 --- a/org/drip/state/estimator/LatentStateStretchBuilder.java +++ /dev/null @@ -1,512 +0,0 @@ - -package org.drip.state.estimator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * LatentStateStretchBuilder contains the Functionality to construct the Curve Latent State Stretch for the - * different Latent States. - * - * @author Lakshmi Krishnamurthy - */ - -public class LatentStateStretchBuilder { - - /** - * Construct a Forward Latent State Stretch Spec Instance - * - * @param strName Stretch Name - * @param aCalibComp Array of Calibration Components - * @param astrCalibMeasure Array of the Calibration Measures - * @param adblCalibQuote Array of the Calibration Quotes - * - * @return Forward Latent State Stretch Spec Instance - */ - - public static final org.drip.state.inference.LatentStateStretchSpec ForwardStretchSpec ( - final java.lang.String strName, - final org.drip.product.definition.CalibratableComponent[] aCalibComp, - final java.lang.String[] astrCalibMeasure, - final double[] adblCalibQuote) - { - if (null == aCalibComp || null == astrCalibMeasure || null == adblCalibQuote) return null; - - int iNumComp = aCalibComp.length; - org.drip.state.inference.LatentStateSegmentSpec[] aLSSS = new - org.drip.state.inference.LatentStateSegmentSpec[iNumComp]; - - if (0 == iNumComp || iNumComp != astrCalibMeasure.length || iNumComp != adblCalibQuote.length) - return null; - - try { - for (int i = 0; i < iNumComp; ++i) { - if (null == aCalibComp[i] || null == astrCalibMeasure[i] || astrCalibMeasure[i].isEmpty() || - !org.drip.quant.common.NumberUtil.IsValid (adblCalibQuote[i])) - return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapForwardLabel = aCalibComp[i].forwardLabel(); - - if (null == mapForwardLabel || 0 == mapForwardLabel.size()) return null; - - org.drip.product.calib.ProductQuoteSet pqs = aCalibComp[i].calibQuoteSet (new - org.drip.state.representation.LatentStateSpecification[] {new - org.drip.state.representation.LatentStateSpecification - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_FORWARD, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_FORWARD_RATE, - mapForwardLabel.get ("DERIVED"))}); - - if (null == pqs || !pqs.set (astrCalibMeasure[i], adblCalibQuote[i])) return null; - - aLSSS[i] = new org.drip.state.inference.LatentStateSegmentSpec (aCalibComp[i], pqs); - } - - return new org.drip.state.inference.LatentStateStretchSpec (strName, aLSSS); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Merged Forward-Funding Latent State Stretch Spec Instance - * - * @param strName Stretch Name - * @param aCalibComp Array of Calibration Components - * @param astrCalibMeasure Array of the Calibration Measures - * @param adblCalibQuote Array of the Calibration Quotes - * - * @return Merged Forward-Funding Latent State Stretch Spec Instance - */ - - public static final org.drip.state.inference.LatentStateStretchSpec ForwardFundingStretchSpec ( - final java.lang.String strName, - final org.drip.product.definition.CalibratableComponent[] aCalibComp, - final java.lang.String[] astrCalibMeasure, - final double[] adblCalibQuote) - { - if (null == aCalibComp || null == astrCalibMeasure || null == adblCalibQuote) return null; - - int iNumComp = aCalibComp.length; - org.drip.state.inference.LatentStateSegmentSpec[] aLSSS = new - org.drip.state.inference.LatentStateSegmentSpec[iNumComp]; - - if (0 == iNumComp || iNumComp != astrCalibMeasure.length || iNumComp != adblCalibQuote.length) - return null; - - try { - for (int i = 0; i < iNumComp; ++i) { - if (null == aCalibComp[i] || null == astrCalibMeasure[i] || astrCalibMeasure[i].isEmpty() || - !org.drip.quant.common.NumberUtil.IsValid (adblCalibQuote[i])) - return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapForwardLabel = aCalibComp[i].forwardLabel(); - - if (null == mapForwardLabel || 0 == mapForwardLabel.size()) return null; - - org.drip.product.calib.ProductQuoteSet pqs = aCalibComp[i].calibQuoteSet (new - org.drip.state.representation.LatentStateSpecification[] {new - org.drip.state.representation.LatentStateSpecification - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_FUNDING, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR, - org.drip.state.identifier.FundingLabel.Standard (aCalibComp[i].payCurrency())), new - org.drip.state.representation.LatentStateSpecification - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_FORWARD, - org.drip.analytics.definition.LatentStateStatic.FORWARD_QM_FORWARD_RATE, - mapForwardLabel.get ("DERIVED"))}); - - if (null == pqs || !pqs.set (astrCalibMeasure[i], adblCalibQuote[i])) return null; - - aLSSS[i] = new org.drip.state.inference.LatentStateSegmentSpec (aCalibComp[i], pqs); - } - - return new org.drip.state.inference.LatentStateStretchSpec (strName, aLSSS); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Funding Latent State Stretch Spec Instance - * - * @param strName Stretch Name - * @param aCalibComp Array of Calibration Components - * @param astrCalibMeasure Array of the Calibration Measures - * @param adblCalibQuote Array of the Calibration Quotes - * - * @return Funding Latent State Stretch Spec Instance - */ - - public static final org.drip.state.inference.LatentStateStretchSpec FundingStretchSpec ( - final java.lang.String strName, - final org.drip.product.definition.CalibratableComponent[] aCalibComp, - final java.lang.String[] astrCalibMeasure, - final double[] adblCalibQuote) - { - if (null == aCalibComp || null == astrCalibMeasure || null == adblCalibQuote) return null; - - int iNumComp = aCalibComp.length; - org.drip.state.inference.LatentStateSegmentSpec[] aLSSS = new - org.drip.state.inference.LatentStateSegmentSpec[iNumComp]; - - if (0 == iNumComp || iNumComp != astrCalibMeasure.length || iNumComp != adblCalibQuote.length) - return null; - - try { - for (int i = 0; i < iNumComp; ++i) { - if (null == aCalibComp[i] || null == astrCalibMeasure[i] || astrCalibMeasure[i].isEmpty() || - !org.drip.quant.common.NumberUtil.IsValid (adblCalibQuote[i])) - return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapForwardLabel = aCalibComp[i].forwardLabel(); - - if (null == mapForwardLabel || 0 == mapForwardLabel.size()) return null; - - org.drip.product.calib.ProductQuoteSet pqs = aCalibComp[i].calibQuoteSet (new - org.drip.state.representation.LatentStateSpecification[] {new - org.drip.state.representation.LatentStateSpecification - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_FUNDING, - org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_DISCOUNT_FACTOR, - org.drip.state.identifier.FundingLabel.Standard - (aCalibComp[i].payCurrency()))}); - - if (null == pqs || !pqs.set (astrCalibMeasure[i], adblCalibQuote[i])) return null; - - aLSSS[i] = new org.drip.state.inference.LatentStateSegmentSpec (aCalibComp[i], pqs); - } - - return new org.drip.state.inference.LatentStateStretchSpec (strName, aLSSS); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Forward Latent State Stretch Spec Instance - * - * @param strName Stretch Name - * @param aCalibComp Array of Calibration Components - * @param strCalibMeasure The Calibration Measure - * @param adblCalibQuote Array of the Calibration Quotes - * - * @return Forward Latent State Stretch Spec Instance - */ - - public static final org.drip.state.inference.LatentStateStretchSpec ForwardStretchSpec ( - final java.lang.String strName, - final org.drip.product.definition.CalibratableComponent[] aCalibComp, - final java.lang.String strCalibMeasure, - final double[] adblCalibQuote) - { - if (null == strCalibMeasure || strCalibMeasure.isEmpty() || null == adblCalibQuote) return null; - - int iNumComp = adblCalibQuote.length; - java.lang.String[] astrCalibMeasure = new java.lang.String[iNumComp]; - - for (int i = 0; i < iNumComp; ++i) - astrCalibMeasure[i] = strCalibMeasure; - - return ForwardStretchSpec (strName, aCalibComp, astrCalibMeasure, adblCalibQuote); - } - - /** - * Construct a Merged Forward-Funding Latent State Stretch Spec Instance - * - * @param strName Stretch Name - * @param aCalibComp Array of Calibration Components - * @param strCalibMeasure The Calibration Measure - * @param adblCalibQuote Array of the Calibration Quotes - * - * @return Merged Forward-Funding Latent State Stretch Spec Instance - */ - - public static final org.drip.state.inference.LatentStateStretchSpec ForwardFundingStretchSpec ( - final java.lang.String strName, - final org.drip.product.definition.CalibratableComponent[] aCalibComp, - final java.lang.String strCalibMeasure, - final double[] adblCalibQuote) - { - if (null == strCalibMeasure || strCalibMeasure.isEmpty() || null == adblCalibQuote) return null; - - int iNumComp = adblCalibQuote.length; - java.lang.String[] astrCalibMeasure = new java.lang.String[iNumComp]; - - for (int i = 0; i < iNumComp; ++i) - astrCalibMeasure[i] = strCalibMeasure; - - return ForwardFundingStretchSpec (strName, aCalibComp, astrCalibMeasure, adblCalibQuote); - } - - /** - * Construct a Funding Latent State Stretch Spec Instance - * - * @param strName Stretch Name - * @param aCalibComp Array of Calibration Components - * @param strCalibMeasure The Calibration Measure - * @param adblCalibQuote Array of the Calibration Quotes - * - * @return Funding Latent State Stretch Spec Instance - */ - - public static final org.drip.state.inference.LatentStateStretchSpec FundingStretchSpec ( - final java.lang.String strName, - final org.drip.product.definition.CalibratableComponent[] aCalibComp, - final java.lang.String strCalibMeasure, - final double[] adblCalibQuote) - { - if (null == strCalibMeasure || strCalibMeasure.isEmpty() || null == adblCalibQuote) return null; - - int iNumComp = adblCalibQuote.length; - java.lang.String[] astrCalibMeasure = new java.lang.String[iNumComp]; - - for (int i = 0; i < iNumComp; ++i) - astrCalibMeasure[i] = strCalibMeasure; - - return FundingStretchSpec (strName, aCalibComp, astrCalibMeasure, adblCalibQuote); - } - - /** - * Construct an instance of LatentStateStretchSpec for the Construction of the Forward Curve from the - * specified Inputs - * - * @param strName Stretch Name - * @param aCCSP Array of Calibration Cross Currency Swap Pair Instances - * @param valParams The Valuation Parameters - * @param mktParams The Basket Market Parameters to imply the Market Quote Measure - * @param adblBasis Array of the Basis on either the Reference Component or the Derived Component - * @param bBasisOnDerivedComponent TRUE - Apply the Basis on the Derived Component - * @param bBasisOnDerivedStream TRUE - Apply the Basis on the Derived Stream (FALSE - Reference Stream) - * - * @return Instance of LatentStateStretchSpec - */ - - public static final org.drip.state.inference.LatentStateStretchSpec ComponentPairForwardStretch ( - final java.lang.String strName, - final org.drip.product.fx.ComponentPair[] aCCSP, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer mktParams, - final double[] adblBasis, - final boolean bBasisOnDerivedComponent, - final boolean bBasisOnDerivedStream) - { - if (null == aCCSP || null == mktParams || null == adblBasis) return null; - - int iNumCCSP = aCCSP.length; - - if (0 == iNumCCSP || adblBasis.length != iNumCCSP) return null; - - org.drip.state.inference.LatentStateSegmentSpec[] aSegmentSpec = new - org.drip.state.inference.LatentStateSegmentSpec[iNumCCSP]; - - for (int i = 0; i < iNumCCSP; ++i) { - if (null == aCCSP[i]) return null; - - try { - if (null == (aSegmentSpec[i] = aCCSP[i].derivedForwardSpec (valParams, mktParams, - adblBasis[i], bBasisOnDerivedComponent, bBasisOnDerivedStream))) - return null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - try { - return new org.drip.state.inference.LatentStateStretchSpec (strName, aSegmentSpec); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an instance of LatentStateStretchSpec for the Construction of the Discount Curve from the - * specified Inputs - * - * @param strName Stretch Name - * @param aCCSP Array of Calibration Cross Currency Swap Pair Instances - * @param valParams The Valuation Parameters - * @param mktParams The Basket Market Parameters to imply the Market Quote Measure - * @param adblReferenceComponentBasis Array of the Reference Component Reference Leg Basis Spread - * @param adblSwapRate Array of the IRS Calibration Swap Rates - * @param bBasisOnDerivedLeg TRUE - Apply the Basis on the Derived Leg (FALSE - Reference Leg) - * - * @return Instance of LatentStateStretchSpec - */ - - public static final org.drip.state.inference.LatentStateStretchSpec ComponentPairDiscountStretch ( - final java.lang.String strName, - final org.drip.product.fx.ComponentPair[] aCCSP, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.market.CurveSurfaceQuoteContainer mktParams, - final double[] adblReferenceComponentBasis, - final double[] adblSwapRate, - final boolean bBasisOnDerivedLeg) - { - if (null == aCCSP || null == mktParams || null == adblReferenceComponentBasis || null == - adblSwapRate) - return null; - - int iNumCCSP = aCCSP.length; - - if (0 == iNumCCSP || adblReferenceComponentBasis.length != iNumCCSP || adblSwapRate.length != - iNumCCSP) - return null; - - org.drip.state.inference.LatentStateSegmentSpec[] aSegmentSpec = new - org.drip.state.inference.LatentStateSegmentSpec[iNumCCSP]; - - for (int i = 0; i < iNumCCSP; ++i) { - if (null == (aSegmentSpec[i] = aCCSP[i].derivedFundingForwardSpec (valParams, mktParams, - adblReferenceComponentBasis[i], bBasisOnDerivedLeg, adblSwapRate[i]))) - return null; - } - - try { - return new org.drip.state.inference.LatentStateStretchSpec (strName, aSegmentSpec); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a FX Latent State Stretch Spec Instance - * - * @param strName Stretch Name - * @param aCalibComp Array of Calibration Components - * @param astrCalibMeasure Array of the Calibration Measures - * @param adblCalibQuote Array of the Calibration Quotes - * - * @return FX Latent State Stretch Spec Instance - */ - - public static final org.drip.state.inference.LatentStateStretchSpec FXStretchSpec ( - final java.lang.String strName, - final org.drip.product.definition.CalibratableComponent[] aCalibComp, - final java.lang.String[] astrCalibMeasure, - final double[] adblCalibQuote) - { - if (null == aCalibComp || null == astrCalibMeasure || null == adblCalibQuote) return null; - - int iNumComp = aCalibComp.length; - org.drip.state.inference.LatentStateSegmentSpec[] aLSSS = new - org.drip.state.inference.LatentStateSegmentSpec[iNumComp]; - - if (0 == iNumComp || iNumComp != astrCalibMeasure.length || iNumComp != adblCalibQuote.length) - return null; - - try { - for (int i = 0; i < iNumComp; ++i) { - if (null == aCalibComp[i] || null == astrCalibMeasure[i] || astrCalibMeasure[i].isEmpty() || - !org.drip.quant.common.NumberUtil.IsValid (adblCalibQuote[i])) - return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap - mapFXLabel = aCalibComp[i].fxLabel(); - - if (null == mapFXLabel || 0 == mapFXLabel.size()) return null; - - org.drip.product.calib.ProductQuoteSet pqs = aCalibComp[i].calibQuoteSet (new - org.drip.state.representation.LatentStateSpecification[] {new - org.drip.state.representation.LatentStateSpecification - (org.drip.analytics.definition.LatentStateStatic.LATENT_STATE_FX, - org.drip.analytics.definition.LatentStateStatic.FX_QM_FORWARD_OUTRIGHT, - mapFXLabel.get ("DERIVED"))}); - - if (null == pqs || !pqs.set (astrCalibMeasure[i], adblCalibQuote[i])) return null; - - aLSSS[i] = new org.drip.state.inference.LatentStateSegmentSpec (aCalibComp[i], pqs); - } - - return new org.drip.state.inference.LatentStateStretchSpec (strName, aLSSS); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a FX Latent State Stretch Spec Instance - * - * @param strName Stretch Name - * @param aCalibComp Array of Calibration Components - * @param strCalibMeasure The Calibration Measure - * @param adblCalibQuote Array of the Calibration Quotes - * - * @return FX Latent State Stretch Spec Instance - */ - - public static final org.drip.state.inference.LatentStateStretchSpec FXStretchSpec ( - final java.lang.String strName, - final org.drip.product.definition.CalibratableComponent[] aCalibComp, - final java.lang.String strCalibMeasure, - final double[] adblCalibQuote) - { - if (null == strCalibMeasure || strCalibMeasure.isEmpty() || null == adblCalibQuote) return null; - - int iNumComp = adblCalibQuote.length; - java.lang.String[] astrCalibMeasure = new java.lang.String[iNumComp]; - - for (int i = 0; i < iNumComp; ++i) - astrCalibMeasure[i] = strCalibMeasure; - - return FXStretchSpec (strName, aCalibComp, astrCalibMeasure, adblCalibQuote); - } -} diff --git a/org/drip/state/estimator/LocalControlCurveParams.java b/org/drip/state/estimator/LocalControlCurveParams.java deleted file mode 100644 index 1e85254..0000000 --- a/org/drip/state/estimator/LocalControlCurveParams.java +++ /dev/null @@ -1,137 +0,0 @@ - -package org.drip.state.estimator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * LocalControlCurveParams enhances the SmoothingCurveStretchParams to produce locally customized curve - * smoothing. - * - * Flags implemented by LocalControlCurveParams control the following: - * - The C1 generator scheme to be used - * - Whether to eliminate spurious extrema, - * - Whether or not to apply monotone filtering - * - * @author Lakshmi Krishnamurthy - */ - -public class LocalControlCurveParams extends org.drip.state.estimator.SmoothingCurveStretchParams { - private boolean _bApplyMonotoneFilter = false; - private boolean _bEliminateSpuriousExtrema = false; - private java.lang.String _strC1GeneratorScheme = ""; - - /** - * LocalControlCurveParams constructor - * - * @param strC1GeneratorScheme C1 Generator Stretch - * @param strSmootheningQuantificationMetric Curve Smoothening Quantification Metric - * @param scbc Segment Builder Parameters - * @param iCalibrationDetail The Calibration Detail - * @param sbfr Curve Fitness Weighted Response - * @param sbfrSensitivity Curve Fitness Weighted Response Sensitivity - * @param bEliminateSpuriousExtrema TRUE - Eliminate Spurious Extrema - * @param bApplyMonotoneFilter TRUE - Apply Monotone Filter - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public LocalControlCurveParams ( - final java.lang.String strC1GeneratorScheme, - final java.lang.String strSmootheningQuantificationMetric, - final org.drip.spline.params.SegmentCustomBuilderControl scbc, - final int iCalibrationDetail, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final org.drip.spline.params.StretchBestFitResponse sbfrSensitivity, - final boolean bEliminateSpuriousExtrema, - final boolean bApplyMonotoneFilter) - throws java.lang.Exception - { - super (strSmootheningQuantificationMetric, scbc, iCalibrationDetail, sbfr, sbfrSensitivity); - - if (null == (_strC1GeneratorScheme = strC1GeneratorScheme)) - throw new java.lang.Exception ("LocalControlCurveParams ctr: Invalid Inputs!"); - - _bApplyMonotoneFilter = bApplyMonotoneFilter; - _bEliminateSpuriousExtrema = bEliminateSpuriousExtrema; - } - - /** - * Retrieve the Apply Monotone Filter Flag - * - * @return The Apply Monotone Filter Flag - */ - - public boolean applyMonotoneFilter() - { - return _bApplyMonotoneFilter; - } - - /** - * Retrieve the Eliminate Spurious Extrema Flag - * - * @return The Eliminate Spurious Extrema Flag - */ - - public boolean eliminateSpuriousExtrema() - { - return _bEliminateSpuriousExtrema; - } - - /** - * Retrieve the C1 Generator Scheme - * - * @return The C1 Generator Scheme - */ - - public java.lang.String C1GeneratorScheme() - { - return _strC1GeneratorScheme; - } -} diff --git a/org/drip/state/estimator/PredictorResponseRelationSetup.java b/org/drip/state/estimator/PredictorResponseRelationSetup.java deleted file mode 100644 index a7e585e..0000000 --- a/org/drip/state/estimator/PredictorResponseRelationSetup.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.state.estimator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * PredictorResponseRelationSetup holds the Linearized Constraints (and, optionally, their quote - * sensitivities) necessary needed for the Linear Calibration. Linearized Constraints are expressed as - * - * Sum_i[Predictor Weight_i * Function (Response_i)] = Constraint Value - * - * where Function can either be univariate function, or weighted spline basis set. - * - * To this end, it implements the following functionality: - * - Update/Retrieve Predictor/Response Weights and their Quote Sensitivities - * - Update/Retrieve Predictor/Response Constraint Values and their Quote Sensitivities - * - Display the contents of PredictorResponseRelationSetup - * - * @author Lakshmi Krishnamurthy - */ - -public class PredictorResponseRelationSetup { - private double _dblValue = 0.; - - private java.util.TreeMap _mapPredictorResponseWeight = new - java.util.TreeMap(); - - /** - * Empty PredictorResponseRelationSetup constructor - */ - - public PredictorResponseRelationSetup() - { - } - - /** - * Update the Constraint Value - * - * @param dblValue The Constraint Value Update Increment - * - * @return TRUE - This Update Succeeded - */ - - public boolean updateValue ( - final double dblValue) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblValue)) return false; - - _dblValue += dblValue; - return true; - } - - /** - * Add a Predictor/Response Weight entry to the Linearized Constraint - * - * @param dblPredictor The Predictor Node - * @param dblResponseWeight The Response Weight at the Node - * - * @return TRUE - Successfully added - */ - - public boolean addPredictorResponseWeight ( - final double dblPredictor, - final double dblResponseWeight) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblPredictor) || - !org.drip.quant.common.NumberUtil.IsValid (dblResponseWeight)) - return false; - - double dblResponseWeightPrior = _mapPredictorResponseWeight.containsKey (dblPredictor) ? - _mapPredictorResponseWeight.get (dblPredictor) : 0.; - - _mapPredictorResponseWeight.put (dblPredictor, dblResponseWeight + dblResponseWeightPrior); - - return true; - } - - /** - * Retrieve the Constraint Value - * - * @return The Constraint Value - */ - - public double getValue() - { - return _dblValue; - } - - /** - * Retrieve the Predictor To-From Response Weight Map - * - * @return The Predictor To-From Response Weight Map - */ - - public java.util.TreeMap getPredictorResponseWeight() - { - return _mapPredictorResponseWeight; - } - - /** - * Absorb the "Other" PRRS onto the current one - * - * @param prrsOther The "Other" PRRS - * - * @return TRUE - At least one Entry was absorbed - */ - - public boolean absorb ( - final PredictorResponseRelationSetup prrsOther) - { - if (null == prrsOther || !updateValue (prrsOther.getValue())) return false; - - java.util.TreeMap mapPRWOther = - prrsOther.getPredictorResponseWeight(); - - if (null == mapPRWOther || 0 == mapPRWOther.size()) return true; - - for (java.util.Map.Entry me : mapPRWOther.entrySet()) { - if (null != me && !addPredictorResponseWeight (me.getKey(), me.getValue())) return false; - } - - return true; - } -} diff --git a/org/drip/state/estimator/PredictorResponseWeightConstraint.java b/org/drip/state/estimator/PredictorResponseWeightConstraint.java deleted file mode 100644 index f454c5a..0000000 --- a/org/drip/state/estimator/PredictorResponseWeightConstraint.java +++ /dev/null @@ -1,342 +0,0 @@ - -package org.drip.state.estimator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * PredictorResponseWeightConstraint holds the Linearized Constraints (and, optionally, their quote - * sensitivities) necessary needed for the Linear Calibration. Linearized Constraints are expressed as - * - * Sum_i[Predictor Weight_i * Function (Response_i)] = Constraint Value - * - * where Function can either be univariate function, or weighted spline basis set. - * - * To this end, it implements the following functionality: - * - Update/Retrieve Predictor/Response Weights and their Quote Sensitivities - * - Update/Retrieve Predictor/Response Constraint Values and their Quote Sensitivities - * - Display the contents of PredictorResponseWeightConstraint - * - * @author Lakshmi Krishnamurthy - */ - -public class PredictorResponseWeightConstraint { - private java.util.HashSet _setLSL = null; - - private org.drip.state.estimator.PredictorResponseRelationSetup _prrsCalib = new - org.drip.state.estimator.PredictorResponseRelationSetup(); - - private org.drip.analytics.support.CaseInsensitiveHashMap - _mapPRRSSens = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - private org.drip.state.estimator.PredictorResponseRelationSetup getPRRS ( - final java.lang.String strManifestMeasure) - { - if (null == strManifestMeasure || strManifestMeasure.isEmpty()) return null; - - if (!_mapPRRSSens.containsKey (strManifestMeasure)) - _mapPRRSSens.put (strManifestMeasure, new - org.drip.state.estimator.PredictorResponseRelationSetup()); - - return _mapPRRSSens.get (strManifestMeasure); - } - - /** - * Empty PredictorResponseWeightConstraint constructor - */ - - public PredictorResponseWeightConstraint() - { - } - - /** - * Add a Predictor/Response Weight entry to the Linearized Constraint - * - * @param dblPredictor The Predictor Node - * @param dblResponseWeight The Response Weight at the Node - * - * @return TRUE - Successfully added - */ - - public boolean addPredictorResponseWeight ( - final double dblPredictor, - final double dblResponseWeight) - { - return _prrsCalib.addPredictorResponseWeight (dblPredictor, dblResponseWeight); - } - - /** - * Add a Predictor/Response Weight entry to the Linearized Constraint - * - * @param strManifestMeasure The Manifest Measure - * @param dblPredictor The Predictor Node - * @param dblDResponseWeightDManifestMeasure The Response Weight-to-Manifest Measure Sensitivity at the - * Node - * - * @return TRUE - Successfully added - */ - - public boolean addDResponseWeightDManifestMeasure ( - final java.lang.String strManifestMeasure, - final double dblPredictor, - final double dblDResponseWeightDManifestMeasure) - { - return getPRRS (strManifestMeasure).addPredictorResponseWeight (dblPredictor, - dblDResponseWeightDManifestMeasure); - } - - /** - * Update the Constraint Value - * - * @param dblValue The Constraint Value Update Increment - * - * @return TRUE - This Update Succeeded - */ - - public boolean updateValue ( - final double dblValue) - { - return _prrsCalib.updateValue (dblValue); - } - - /** - * Update the Constraint Value Sensitivity - * - * @param strManifestMeasure The Manifest Measure - * @param dblDValueDManifestMeasure The Constraint Value Sensitivity Update Increment - * - * @return TRUE - This Sensitivity Update Succeeded - */ - - public boolean updateDValueDManifestMeasure ( - final java.lang.String strManifestMeasure, - final double dblDValueDManifestMeasure) - { - return getPRRS (strManifestMeasure).updateValue (dblDValueDManifestMeasure); - } - - /** - * Retrieve the Constraint Value - * - * @return The Constraint Value - */ - - public double getValue() - { - return _prrsCalib.getValue(); - } - - /** - * Retrieve the Constraint Value Sensitivity - * - * @param strManifestMeasure The Manifest Measure - * - * @return The Constraint Value Sensitivity - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public double getDValueDManifestMeasure ( - final java.lang.String strManifestMeasure) - throws java.lang.Exception - { - if (!_mapPRRSSens.containsKey (strManifestMeasure)) - throw new java.lang.Exception - ("PredictorResponseWeightConstraint::getDValueDManifestMeasure => Cannot locate manifest measure " - + strManifestMeasure); - - return _mapPRRSSens.get (strManifestMeasure).getValue(); - } - - /** - * Add a Merging Latent State Label - * - * @param lslMerge The Merging Latent State Label - * - * @return TRUE - The Latent State Label Successfully Added - */ - - public boolean addMergeLabel ( - final org.drip.state.identifier.LatentStateLabel lslMerge) - { - if (null == lslMerge) return false; - - if (null == _setLSL) _setLSL = new java.util.HashSet(); - - _setLSL.add (lslMerge); - - return true; - } - - /** - * Return the Set of Merged Latent State Labels - * - * @return The Set of Merged Latent State Labels - */ - - public java.util.Set mergeLabelSet() - { - return _setLSL; - } - - /** - * Retrieve the Predictor To-From Response Weight Map - * - * @return The Predictor To-From Response Weight Map - */ - - public java.util.TreeMap getPredictorResponseWeight() - { - return _prrsCalib.getPredictorResponseWeight(); - } - - /** - * Retrieve the Predictor To-From Response Weight Sensitivity Map - * - * @param strManifestMeasure The Manifest Measure - * - * @return The Predictor To-From Response Weight Sensitivity Map - */ - - public java.util.TreeMap getDResponseWeightDManifestMeasure ( - final java.lang.String strManifestMeasure) - { - return !_mapPRRSSens.containsKey (strManifestMeasure) ? null : _mapPRRSSens.get - (strManifestMeasure).getPredictorResponseWeight(); - } - - /** - * "Absorb" the other PRWC Instance into the Current One - * - * @param prwcOther The "Other" PRWC Instance - * - * @return TRUE - At least one entry of the "Other" was absorbed - */ - - public boolean absorb ( - final PredictorResponseWeightConstraint prwcOther) - { - if (null == prwcOther || !_prrsCalib.absorb (prwcOther._prrsCalib)) return false; - - if (0 == prwcOther._mapPRRSSens.size()) return true; - - if (0 != _mapPRRSSens.size()) { - for (java.util.Map.Entry - me : _mapPRRSSens.entrySet()) { - java.lang.String strKey = me.getKey(); - - if (prwcOther._mapPRRSSens.containsKey (strKey)) - me.getValue().absorb (prwcOther._mapPRRSSens.get (strKey)); - } - } - - for (java.util.Map.Entry - me : prwcOther._mapPRRSSens.entrySet()) { - java.lang.String strKey = me.getKey(); - - if (!_mapPRRSSens.containsKey (strKey)) _mapPRRSSens.put (strKey, me.getValue()); - } - - java.util.Set lsLSL = prwcOther.mergeLabelSet(); - - if (null == lsLSL || 0 == lsLSL.size()) return true; - - for (org.drip.state.identifier.LatentStateLabel lsl : lsLSL) { - if (!addMergeLabel (lsl)) return false; - } - - return true; - } - - /** - * Return the Set of Available Sensitivities (if any) - * - * @return The Set of Available Sensitivities - */ - - public java.util.Set sensitivityKeys() - { - return _mapPRRSSens.keySet(); - } - - /** - * Display the Constraints and the corresponding Weights - * - * @param strComment The Prefix Comment - */ - - public void displayString ( - final java.lang.String strComment) - { - java.util.Map mapPRW = _prrsCalib.getPredictorResponseWeight(); - - if (null != mapPRW && 0 != mapPRW.size()) { - for (java.util.Map.Entry me : mapPRW.entrySet()) { - double dblDate = me.getKey(); - - System.out.println ("\t\t" + strComment + " - " + new org.drip.analytics.date.JulianDate - ((int) dblDate) + " => " + me.getValue()); - } - } - - System.out.println ("\t" + strComment + " Constraint: " + _prrsCalib.getValue()); - - if (null != _setLSL) { - java.lang.String strLabels = "\t" + strComment + " Labels:"; - - for (org.drip.state.identifier.LatentStateLabel lsl : _setLSL) - strLabels += " " + lsl.fullyQualifiedName(); - - System.out.println (strLabels); - } - - System.out.flush(); - } -} diff --git a/org/drip/state/estimator/SmoothingCurveStretchParams.java b/org/drip/state/estimator/SmoothingCurveStretchParams.java deleted file mode 100644 index 5526b47..0000000 --- a/org/drip/state/estimator/SmoothingCurveStretchParams.java +++ /dev/null @@ -1,194 +0,0 @@ - -package org.drip.state.estimator; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * SmoothingCurveStretchParams contains the Parameters needed to hold the Stretch. It provides functionality - * to: - * - The Stretch Best fit Response and the corresponding Quote Sensitivity - * - The Calibration Detail and the Curve Smoothening Quantification Metric - * - The Segment Builder Parameters - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class SmoothingCurveStretchParams { - private int _iCalibrationDetail = -1; - private java.lang.String _strSmootheningQuantificationMetric = ""; - private org.drip.spline.params.StretchBestFitResponse _sbfr = null; - private org.drip.spline.params.StretchBestFitResponse _sbfrSensitivity = null; - - private - org.drip.analytics.support.CaseInsensitiveHashMap - _mapSCBC = new - org.drip.analytics.support.CaseInsensitiveHashMap(); - - /** - * SmoothingCurveStretchParams constructor - * - * @param strSmootheningQuantificationMetric Curve Smoothening Quantification Metric - * @param scbcDefault Default Segment Builder Parameters - * @param iCalibrationDetail The Calibration Detail - * @param sbfr Stretch Fitness Weighted Response - * @param sbfrSensitivity Stretch Fitness Weighted Response Sensitivity - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public SmoothingCurveStretchParams ( - final java.lang.String strSmootheningQuantificationMetric, - final org.drip.spline.params.SegmentCustomBuilderControl scbcDefault, - final int iCalibrationDetail, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final org.drip.spline.params.StretchBestFitResponse sbfrSensitivity) - throws java.lang.Exception - { - if (null == scbcDefault) - throw new java.lang.Exception ("SmoothingCurveStretchParams ctr: Invalid Inputs"); - - _sbfr = sbfr; - _sbfrSensitivity = sbfrSensitivity; - _iCalibrationDetail = iCalibrationDetail; - _strSmootheningQuantificationMetric = strSmootheningQuantificationMetric; - - _mapSCBC.put ("default", scbcDefault); - } - - /** - * Set the Stretch's Segment Builder Control - * - * @param strStretchName Name of the Stretch for which the Segment Builder Parameters need to be set - * @param scbc The Segment Builder Parameters - * - * @return TRUE - The Segment Builder Control Parameters have been successfully set - */ - - public boolean setStretchSegmentBuilderControl ( - final java.lang.String strStretchName, - final org.drip.spline.params.SegmentCustomBuilderControl scbc) - { - if (null == strStretchName || strStretchName.isEmpty() || null == scbc) return false; - - _mapSCBC.put (strStretchName, scbc); - - return true; - } - - /** - * Retrieve the Curve Smoothening Quantification Metric - * - * @return The Curve Smoothening Quantification Metric - */ - - public java.lang.String smootheningQuantificationMetric() - { - return _strSmootheningQuantificationMetric; - } - - /** - * Retrieve the Calibration Detail - * - * @return The Calibration Detail - */ - - public int calibrationDetail() - { - return _iCalibrationDetail; - } - - /** - * Retrieve the Default Segment Builder Parameters - * - * @return The Default Segment Builder Parameters - */ - - public org.drip.spline.params.SegmentCustomBuilderControl defaultSegmentBuilderControl() - { - return _mapSCBC.get ("default"); - } - - /** - * Retrieve the Segment Builder Parameters - * - * @param strStretchName Name of the Stretch for which the Segment Builder Parameters are requested - * - * @return The Segment Builder Parameters - */ - - public org.drip.spline.params.SegmentCustomBuilderControl segmentBuilderControl ( - final java.lang.String strStretchName) - { - return _mapSCBC.containsKey (strStretchName) ? _mapSCBC.get (strStretchName) : _mapSCBC.get - ("default"); - } - - /** - * Retrieve the Best Fit Weighted Response - * - * @return The Best Fit Weighted Response - */ - - public org.drip.spline.params.StretchBestFitResponse bestFitWeightedResponse() - { - return _sbfr; - } - - /** - * Retrieve the Best Fit Weighted Response Sensitivity - * - * @return The Best Fit Weighted Response Sensitivity - */ - - public org.drip.spline.params.StretchBestFitResponse bestFitWeightedResponseSensitivity() - { - return _sbfrSensitivity; - } -} diff --git a/org/drip/state/forward/ForwardCurve.java b/org/drip/state/forward/ForwardCurve.java deleted file mode 100644 index 5dcea94..0000000 --- a/org/drip/state/forward/ForwardCurve.java +++ /dev/null @@ -1,239 +0,0 @@ - -package org.drip.state.forward; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * ForwardCurve is the stub for the forward curve functionality. It extends the Curve object by exposing the - * following functions: - * - The name/epoch of the forward rate instance. - * - The index/currency/tenor associated with the forward rate instance. - * - Forward Rate to a specific date/tenor. - * - Generate scenario tweaked Latent State from the base forward curve corresponding to mode adjusted - * (flat/parallel/custom) manifest measure/quantification metric. - * - Retrieve array of latent state manifest measure, instrument quantification metric, and the array of - * calibration components. - * - Set/retrieve curve construction input instrument sets. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class ForwardCurve implements org.drip.state.forward.ForwardRateEstimator, - org.drip.analytics.definition.Curve { - - private int _iEpochDate = java.lang.Integer.MIN_VALUE; - private org.drip.state.identifier.ForwardLabel _fri = null; - - protected ForwardCurve ( - final int iEpochDate, - final org.drip.state.identifier.ForwardLabel fri) - throws java.lang.Exception - { - if (null == (_fri = fri)) throw new java.lang.Exception ("ForwardCurve ctr: Invalid Inputs"); - - _iEpochDate = iEpochDate; - } - - @Override public org.drip.state.identifier.LatentStateLabel label() - { - return _fri; - } - - @Override public java.lang.String currency() - { - return _fri.currency(); - } - - @Override public org.drip.analytics.date.JulianDate epoch() - { - try { - return new org.drip.analytics.date.JulianDate (_iEpochDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public java.lang.String tenor() - { - return _fri.tenor(); - } - - @Override public org.drip.state.identifier.ForwardLabel index() - { - return _fri; - } - - @Override public double forward ( - final org.drip.analytics.date.JulianDate dt) - throws java.lang.Exception - { - if (null == dt) throw new java.lang.Exception ("ForwardRate::forward got null for date"); - - return forward (dt.julian()); - } - - @Override public double forward ( - final java.lang.String strTenor) - throws java.lang.Exception - { - if (null == strTenor || strTenor.isEmpty()) - throw new java.lang.Exception ("ForwardRate::forward got bad tenor"); - - return forward (epoch().addTenor (strTenor)); - } - - @Override public boolean setCCIS ( - final org.drip.analytics.input.CurveConstructionInputSet ccis) - { - return true; - } - - @Override public org.drip.product.definition.CalibratableComponent[] calibComp() - { - return null; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap manifestMeasure ( - final java.lang.String strInstrumentCode) - { - return null; - } - - @Override public org.drip.state.representation.LatentState parallelShiftManifestMeasure ( - final java.lang.String strManifestMeasure, - final double dblShift) - { - return null; - } - - @Override public org.drip.state.representation.LatentState shiftManifestMeasure ( - final int iSpanIndex, - final java.lang.String strManifestMeasure, - final double dblShift) - { - return null; - } - - @Override public org.drip.state.representation.LatentState customTweakManifestMeasure ( - final java.lang.String strManifestMeasure, - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - return null; - } - - @Override public org.drip.state.representation.LatentState parallelShiftQuantificationMetric ( - final double dblShift) - { - return null; - } - - @Override public org.drip.state.representation.LatentState customTweakQuantificationMetric ( - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - return null; - } - - /** - * Retrieve the Manifest Measure Jacobian of the Forward Rate to the given date - * - * @param strManifestMeasure Manifest Measure - * @param dblDate Date - * - * @return The Manifest Measure Jacobian of the Forward Rate to the given date - */ - - public abstract org.drip.quant.calculus.WengertJacobian jackDForwardDManifestMeasure ( - final java.lang.String strManifestMeasure, - final int dblDate); - - /** - * Retrieve the Manifest Measure Jacobian of the Forward Rate to the given date - * - * @param strManifestMeasure Manifest Measure - * @param dt Date - * - * @return The Manifest Measure Jacobian of the Forward Rate to the given date - */ - - public org.drip.quant.calculus.WengertJacobian jackDForwardDManifestMeasure ( - final java.lang.String strManifestMeasure, - final org.drip.analytics.date.JulianDate dt) - { - if (null == dt) return null; - - return jackDForwardDManifestMeasure (strManifestMeasure, dt.julian()); - } - - /** - * Retrieve the Manifest Measure Jacobian of the Forward Rate to the date implied by the given Tenor - * - * @param strManifestMeasure Manifest Measure - * @param strTenor Tenor - * - * @return The Manifest Measure Jacobian of the Forward Rate to the date implied by the given Tenor - */ - - public org.drip.quant.calculus.WengertJacobian jackDForwardDManifestMeasure ( - final java.lang.String strManifestMeasure, - final java.lang.String strTenor) - { - if (null == strTenor || strTenor.isEmpty()) return null; - - try { - return jackDForwardDManifestMeasure (strManifestMeasure, epoch().addTenor (strTenor)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/state/forward/ForwardRateEstimator.java b/org/drip/state/forward/ForwardRateEstimator.java deleted file mode 100644 index 7452855..0000000 --- a/org/drip/state/forward/ForwardRateEstimator.java +++ /dev/null @@ -1,120 +0,0 @@ - -package org.drip.state.forward; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * ForwardRateEstimator is the interface that exposes the calculation of the Forward Rate for a specific - * Index. It exposes methods to compute forward rates to a given date/tenor, extract the forward rate index - * and the Tenor. - * - * @author Lakshmi Krishnamurthy - */ - -public interface ForwardRateEstimator { - - /** - * Retrieve the Forward Rate Index - * - * @return The Forward Rate Index - */ - - public abstract org.drip.state.identifier.ForwardLabel index(); - - /** - * Retrieve the Forward Rate Tenor - * - * @return The Forward Rate Tenor - */ - - public abstract java.lang.String tenor(); - - /** - * Calculate the Forward Rate to the given Date - * - * @param iDate Date - * - * @return The Forward Rate - * - * @throws java.lang.Exception Thrown if the Forward Rate cannot be calculated - */ - - public abstract double forward ( - final int iDate) - throws java.lang.Exception; - - /** - * Calculate the Forward Rate to the given date - * - * @param dt Date - * - * @return The Forward Rate - * - * @throws java.lang.Exception Thrown if the Forward Rate cannot be calculated - */ - - public abstract double forward ( - final org.drip.analytics.date.JulianDate dt) - throws java.lang.Exception; - - /** - * Calculate the Forward Rate to the tenor implied by the given date - * - * @param strTenor The Tenor - * - * @return The Forward Rate - * - * @throws java.lang.Exception Thrown if the Forward Rate cannot be calculated - */ - - public abstract double forward ( - final java.lang.String strTenor) - throws java.lang.Exception; -} diff --git a/org/drip/state/fx/ExplicitBootFXCurve.java b/org/drip/state/fx/ExplicitBootFXCurve.java deleted file mode 100644 index 3c449be..0000000 --- a/org/drip/state/fx/ExplicitBootFXCurve.java +++ /dev/null @@ -1,67 +0,0 @@ - -package org.drip.state.fx; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ExplicitBootFXCurve exposes the functionality associated with the bootstrapped FX Curve. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class ExplicitBootFXCurve extends org.drip.state.fx.FXCurve implements - org.drip.analytics.definition.ExplicitBootCurve { - - protected ExplicitBootFXCurve ( - final int iEpochDate, - final org.drip.product.params.CurrencyPair cp) - throws java.lang.Exception - { - super (iEpochDate, cp); - } -} diff --git a/org/drip/state/fx/FXCurve.java b/org/drip/state/fx/FXCurve.java deleted file mode 100644 index 721e03c..0000000 --- a/org/drip/state/fx/FXCurve.java +++ /dev/null @@ -1,356 +0,0 @@ - -package org.drip.state.fx; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FXCurve is the Stub for the FX Curve for the specified Currency Pair. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class FXCurve implements org.drip.analytics.definition.Curve { - private org.drip.product.params.CurrencyPair _cp = null; - - protected int _iEpochDate = java.lang.Integer.MIN_VALUE; - - protected FXCurve ( - final int iEpochDate, - final org.drip.product.params.CurrencyPair cp) - throws java.lang.Exception - { - if (null == (_cp = cp)) throw new java.lang.Exception ("FXCurve ctr: Invalid Inputs"); - - _iEpochDate = iEpochDate; - } - - /** - * Calculate the FX Forward to the given Date - * - * @param iDate Date - * - * @return The FX Forward - * - * @throws java.lang.Exception Thrown if the FX Forward cannot be calculated - */ - - public abstract double fx ( - final int iDate) - throws java.lang.Exception; - - /** - * Calculate the set of Zero basis given the input discount curves - * - * @param aiDateNode Array of Date Nodes - * @param valParams Valuation Parameters - * @param dcNum Discount Curve Numerator - * @param dcDenom Discount Curve Denominator - * @param bBasisOnDenom True if the basis is calculated on the denominator discount curve - * - * @return Array of the computed basis - */ - - public abstract double[] zeroBasis ( - final int[] aiDateNode, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.discount.MergedDiscountForwardCurve dcNum, - final org.drip.state.discount.MergedDiscountForwardCurve dcDenom, - final boolean bBasisOnDenom); - - /** - * Bootstrap the basis to the discount curve inputs - * - * @param aiDateNode Array of Date Nodes - * @param valParams Valuation Parameters - * @param dcNum Discount Curve Numerator - * @param dcDenom Discount Curve Denominator - * @param bBasisOnDenom True if the basis is calculated on the denominator discount curve - * - * @return Array of the computed basis - */ - - public abstract double[] bootstrapBasis ( - final int[] aiDateNode, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.discount.MergedDiscountForwardCurve dcNum, - final org.drip.state.discount.MergedDiscountForwardCurve dcDenom, - final boolean bBasisOnDenom); - - /** - * Bootstrap the discount curve from the discount curve inputs - * - * @param aiDateNode Array of Date Nodes - * @param valParams Valuation Parameters - * @param dcNum Discount Curve Numerator - * @param dcDenom Discount Curve Denominator - * @param bBasisOnDenom True if the basis is calculated on the denominator discount curve - * - * @return Array of the computed basis - */ - - public abstract org.drip.state.discount.MergedDiscountForwardCurve bootstrapBasisDC ( - final int[] aiDateNode, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.discount.MergedDiscountForwardCurve dcNum, - final org.drip.state.discount.MergedDiscountForwardCurve dcDenom, - final boolean bBasisOnDenom); - - /** - * Calculate the rates implied by the discount curve inputs - * - * @param aiDateNode Array of Date Nodes - * @param valParams Valuation Parameters - * @param dcNum Discount Curve Numerator - * @param dcDenom Discount Curve Denominator - * @param bBasisOnDenom True if the basis is calculated on the denominator discount curve - * - * @return Array of the computed implied rates - */ - - public abstract double[] impliedNodeRates ( - final int[] aiDateNode, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.discount.MergedDiscountForwardCurve dcNum, - final org.drip.state.discount.MergedDiscountForwardCurve dcDenom, - final boolean bBasisOnDenom); - - /** - * Calculate the rate implied by the discount curve inputs to a specified date - * - * @param aiDateNode Array of Date Nodes - * @param valParams ValuationParams - * @param dcNum Discount Curve Numerator - * @param dcDenom Discount Curve Denominator - * @param iDate Date to which the implied rate is sought - * @param bBasisOnDenom True if the implied rate is calculated on the denominator discount curve - * - * @return Implied rate - * - * @throws java.lang.Exception Thrown if the implied rate cannot be calculated - */ - - public abstract double rate ( - final int[] aiDateNode, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.discount.MergedDiscountForwardCurve dcNum, - final org.drip.state.discount.MergedDiscountForwardCurve dcDenom, - final int iDate, - final boolean bBasisOnDenom) - throws java.lang.Exception; - - @Override public org.drip.state.identifier.LatentStateLabel label() - { - return org.drip.state.identifier.FXLabel.Standard (_cp); - } - - @Override public java.lang.String currency() - { - return _cp.quoteCcy(); - } - - @Override public org.drip.analytics.date.JulianDate epoch() - { - return new org.drip.analytics.date.JulianDate (_iEpochDate); - } - - /** - * Return the CurrencyPair - * - * @return CurrencyPair - */ - - public org.drip.product.params.CurrencyPair currencyPair() - { - return _cp; - } - - /** - * Calculate the FX Forward to the given date - * - * @param dt Date - * - * @return The FX Forward - * - * @throws java.lang.Exception Thrown if the FX Forward cannot be calculated - */ - - public double fx ( - final org.drip.analytics.date.JulianDate dt) - throws java.lang.Exception - { - if (null == dt) throw new java.lang.Exception ("FXCurve::fx got null for date"); - - return fx (dt.julian()); - } - - /** - * Calculate the FX Forward to the given date - * - * @param strTenor The Tenor - * - * @return The FX Forward - * - * @throws java.lang.Exception Thrown if the FX Forward cannot be calculated - */ - - public double fx ( - final java.lang.String strTenor) - throws java.lang.Exception - { - if (null == strTenor || strTenor.isEmpty()) - throw new java.lang.Exception ("FXCurve::fx got bad tenor"); - - return fx (epoch().addTenor (strTenor)); - } - - @Override public boolean setCCIS ( - final org.drip.analytics.input.CurveConstructionInputSet ccis) - { - return true; - } - - @Override public org.drip.product.definition.CalibratableComponent[] calibComp() - { - return null; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap manifestMeasure ( - final java.lang.String strInstr) - { - return null; - } - - @Override public org.drip.state.representation.LatentState parallelShiftManifestMeasure ( - final java.lang.String strManifestMeasure, - final double dblShift) - { - return null; - } - - @Override public org.drip.state.representation.LatentState shiftManifestMeasure ( - final int iSpanIndex, - final java.lang.String strManifestMeasure, - final double dblShift) - { - return null; - } - - @Override public org.drip.state.representation.LatentState customTweakManifestMeasure ( - final java.lang.String strManifestMeasure, - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - return null; - } - - @Override public org.drip.state.representation.LatentState parallelShiftQuantificationMetric ( - final double dblShift) - { - return null; - } - - @Override public org.drip.state.representation.LatentState customTweakQuantificationMetric ( - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - return null; - } - - /** - * Retrieve the Manifest Measure Jacobian of the Forward Rate to the given date - * - * @param strManifestMeasure Manifest Measure - * @param iDate Date - * - * @return The Manifest Measure Jacobian of the Forward Rate to the given date - */ - - public abstract org.drip.quant.calculus.WengertJacobian jackDForwardDManifestMeasure ( - final java.lang.String strManifestMeasure, - final int iDate); - - /** - * Retrieve the Manifest Measure Jacobian of the Forward Rate to the given date - * - * @param strManifestMeasure Manifest Measure - * @param dt Date - * - * @return The Manifest Measure Jacobian of the Forward Rate to the given date - */ - - public org.drip.quant.calculus.WengertJacobian jackDForwardDManifestMeasure ( - final java.lang.String strManifestMeasure, - final org.drip.analytics.date.JulianDate dt) - { - if (null == dt) return null; - - return jackDForwardDManifestMeasure (strManifestMeasure, dt.julian()); - } - - /** - * Retrieve the Manifest Measure Jacobian of the Forward Rate to the date implied by the given Tenor - * - * @param strManifestMeasure Manifest Measure - * @param strTenor Tenor - * - * @return The Manifest Measure Jacobian of the Forward Rate to the date implied by the given Tenor - */ - - public org.drip.quant.calculus.WengertJacobian jackDForwardDManifestMeasure ( - final java.lang.String strManifestMeasure, - final java.lang.String strTenor) - { - if (null == strTenor || strTenor.isEmpty()) return null; - - try { - return jackDForwardDManifestMeasure (strManifestMeasure, epoch().addTenor (strTenor)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/state/govvie/ExplicitBootGovvieCurve.java b/org/drip/state/govvie/ExplicitBootGovvieCurve.java deleted file mode 100644 index d33e4dc..0000000 --- a/org/drip/state/govvie/ExplicitBootGovvieCurve.java +++ /dev/null @@ -1,91 +0,0 @@ - -package org.drip.state.govvie; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * ExplicitBootGovvieCurve exposes the Functionality associated with the bootstrapped Govvie Curve. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class ExplicitBootGovvieCurve extends org.drip.state.govvie.GovvieCurve implements - org.drip.analytics.definition.ExplicitBootCurve { - - protected ExplicitBootGovvieCurve ( - final int iEpochDate, - final java.lang.String strTreasuryCode, - final java.lang.String strCurrency) - throws java.lang.Exception - { - super (iEpochDate, strTreasuryCode, strCurrency); - } - - @Override public boolean setCCIS ( - final org.drip.analytics.input.CurveConstructionInputSet ccis) - { - return null != (_ccis = ccis); - } - - @Override public org.drip.product.definition.CalibratableComponent[] calibComp() - { - return null == _ccis ? null : _ccis.components(); - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap manifestMeasure ( - final java.lang.String strInstrumentCode) - { - if (null == _ccis) return null; - - org.drip.analytics.support.CaseInsensitiveTreeMap> - mapQuote = _ccis.quoteMap(); - - if (null == mapQuote || !mapQuote.containsKey (strInstrumentCode)) return null; - - return mapQuote.get (strInstrumentCode); - } -} diff --git a/org/drip/state/govvie/GovvieCurve.java b/org/drip/state/govvie/GovvieCurve.java deleted file mode 100644 index 0e3e4d0..0000000 --- a/org/drip/state/govvie/GovvieCurve.java +++ /dev/null @@ -1,318 +0,0 @@ - -package org.drip.state.govvie; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FXCurve is the Stub for the FX Curve for the specified Currency Pair. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class GovvieCurve implements org.drip.state.discount.DiscountCurve, - org.drip.state.govvie.YieldEstimator { - private static final int NUM_DF_QUADRATURES = 5; - - private int _iFreq = 2; - private java.lang.String _strCurrency = ""; - private java.lang.String _strTreasuryCode = ""; - private java.lang.String _strDayCount = "DCAct_Act_UST"; - - protected int _iEpochDate = java.lang.Integer.MIN_VALUE; - protected org.drip.analytics.input.CurveConstructionInputSet _ccis = null; - - protected GovvieCurve ( - final int iEpochDate, - final java.lang.String strTreasuryCode, - final java.lang.String strCurrency) - throws java.lang.Exception - { - if (null == (_strTreasuryCode = strTreasuryCode) || _strTreasuryCode.isEmpty() || null == - (_strCurrency = strCurrency) || _strCurrency.isEmpty()) - throw new java.lang.Exception ("GovvieCurve ctr: Invalid Inputs"); - - _iEpochDate = iEpochDate; - } - - @Override public org.drip.analytics.date.JulianDate epoch() - { - return new org.drip.analytics.date.JulianDate (_iEpochDate); - } - - @Override public java.lang.String currency() - { - return _strCurrency; - } - - @Override public org.drip.state.identifier.LatentStateLabel label() - { - return org.drip.state.identifier.GovvieLabel.Standard (_strTreasuryCode); - } - - @Override public double yield ( - final org.drip.analytics.date.JulianDate dt) - throws java.lang.Exception - { - if (null == dt) throw new java.lang.Exception ("GovvieCurve::yield => Invalid Inputs"); - - return yield (dt.julian()); - } - - @Override public double yield ( - final java.lang.String strTenor) - throws java.lang.Exception - { - return yield (epoch().addTenor (strTenor)); - } - - @Override public double df ( - final int iDate) - throws java.lang.Exception - { - return org.drip.analytics.support.Helper.Yield2DF (_iFreq, yield (iDate), - org.drip.analytics.daycount.Convention.YearFraction (_iEpochDate, iDate, _strDayCount, false, - org.drip.analytics.daycount.ActActDCParams.FromFrequency (_iFreq), _strCurrency)); - } - - @Override public double df ( - final org.drip.analytics.date.JulianDate dt) - throws java.lang.Exception - { - if (null == dt) throw new java.lang.Exception ("GovvieCurve::df => Invalid Inputs"); - - return df (dt.julian()); - } - - @Override public double df ( - final java.lang.String strTenor) - throws java.lang.Exception - { - return df (new org.drip.analytics.date.JulianDate (_iEpochDate).addTenor (strTenor)); - } - - @Override public double effectiveDF ( - final int iDate1, - final int iDate2) - throws java.lang.Exception - { - if (iDate1 == iDate2) return df (iDate1); - - int iNumQuadratures = 0; - double dblEffectiveDF = 0.; - int iQuadratureWidth = (iDate2 - iDate1) / NUM_DF_QUADRATURES; - - if (0 == iQuadratureWidth) iQuadratureWidth = 1; - - for (int iDate = iDate1; iDate <= iDate2; iDate += iQuadratureWidth) { - ++iNumQuadratures; - - dblEffectiveDF += (df (iDate) + df (iDate + iQuadratureWidth)); - } - - return dblEffectiveDF / (2. * iNumQuadratures); - } - - @Override public double effectiveDF ( - final org.drip.analytics.date.JulianDate dt1, - final org.drip.analytics.date.JulianDate dt2) - throws java.lang.Exception - { - if (null == dt1 || null == dt2) - throw new java.lang.Exception ("GovvieCurve::effectiveDF => Got null for date"); - - return effectiveDF (dt1.julian(), dt2.julian()); - } - - @Override public double effectiveDF ( - final java.lang.String strTenor1, - final java.lang.String strTenor2) - throws java.lang.Exception - { - if (null == strTenor1 || strTenor1.isEmpty() || null == strTenor2 || strTenor2.isEmpty()) - throw new java.lang.Exception ("GovvieCurve::effectiveDF => Got bad tenor"); - - org.drip.analytics.date.JulianDate dtStart = epoch(); - - return effectiveDF (dtStart.addTenor (strTenor1), dtStart.addTenor (strTenor2)); - } - - @Override public double yieldDF ( - final int iDate, - final double dblDCF) - throws java.lang.Exception - { - return org.drip.analytics.support.Helper.Yield2DF (_iFreq, yield (iDate), dblDCF); - } - - @Override public boolean setCCIS ( - final org.drip.analytics.input.CurveConstructionInputSet ccis) - { - return true; - } - - @Override public org.drip.product.definition.CalibratableComponent[] calibComp() - { - return null; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap manifestMeasure ( - final java.lang.String strInstr) - { - return null; - } - - @Override public org.drip.state.representation.LatentState parallelShiftManifestMeasure ( - final java.lang.String strManifestMeasure, - final double dblShift) - { - return null; - } - - @Override public org.drip.state.representation.LatentState shiftManifestMeasure ( - final int iSpanIndex, - final java.lang.String strManifestMeasure, - final double dblShift) - { - return null; - } - - @Override public org.drip.state.representation.LatentState customTweakManifestMeasure ( - final java.lang.String strManifestMeasure, - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - return null; - } - - @Override public org.drip.state.representation.LatentState parallelShiftQuantificationMetric ( - final double dblShift) - { - return null; - } - - @Override public org.drip.state.representation.LatentState customTweakQuantificationMetric ( - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - return null; - } - - /** - * Retrieve the Yield Frequency - * - * @return The Yield Frequency - */ - - public int freq() - { - return _iFreq; - } - - /** - * Retrieve the Yield Day Count - * - * @return The Yield Day Count - */ - - public java.lang.String dayCount() - { - return _strDayCount; - } - - /** - * Retrieve the Manifest Measure Jacobian of the Forward Rate to the given date - * - * @param strManifestMeasure Manifest Measure - * @param iDate Date - * - * @return The Manifest Measure Jacobian of the Forward Rate to the given date - */ - - public abstract org.drip.quant.calculus.WengertJacobian jackDForwardDManifestMeasure ( - final java.lang.String strManifestMeasure, - final int iDate); - - /** - * Retrieve the Manifest Measure Jacobian of the Forward Rate to the given date - * - * @param strManifestMeasure Manifest Measure - * @param dt Date - * - * @return The Manifest Measure Jacobian of the Forward Rate to the given date - */ - - public org.drip.quant.calculus.WengertJacobian jackDForwardDManifestMeasure ( - final java.lang.String strManifestMeasure, - final org.drip.analytics.date.JulianDate dt) - { - if (null == dt) return null; - - return jackDForwardDManifestMeasure (strManifestMeasure, dt.julian()); - } - - /** - * Retrieve the Manifest Measure Jacobian of the Forward Rate to the date implied by the given Tenor - * - * @param strManifestMeasure Manifest Measure - * @param strTenor Tenor - * - * @return The Manifest Measure Jacobian of the Forward Rate to the date implied by the given Tenor - */ - - public org.drip.quant.calculus.WengertJacobian jackDForwardDManifestMeasure ( - final java.lang.String strManifestMeasure, - final java.lang.String strTenor) - { - if (null == strTenor || strTenor.isEmpty()) return null; - - try { - return jackDForwardDManifestMeasure (strManifestMeasure, epoch().addTenor (strTenor)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/state/govvie/YieldEstimator.java b/org/drip/state/govvie/YieldEstimator.java deleted file mode 100644 index 951c80e..0000000 --- a/org/drip/state/govvie/YieldEstimator.java +++ /dev/null @@ -1,118 +0,0 @@ - -package org.drip.state.govvie; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * YieldEstimator is the Interface that exposes the Computation of the Yield of a specified Issue. - * - * @author Lakshmi Krishnamurthy - */ - -public interface YieldEstimator { - - /** - * Calculate the Yield to the given Date - * - * @param iDate Date - * - * @return The Yield - * - * @throws java.lang.Exception Thrown if the Yield cannot be calculated - */ - - public abstract double yield ( - final int iDate) - throws java.lang.Exception; - - /** - * Calculate the Yield to the given Date - * - * @param dt Date - * - * @return The Yield - * - * @throws java.lang.Exception Thrown if the Yield cannot be calculated - */ - - public abstract double yield ( - final org.drip.analytics.date.JulianDate dt) - throws java.lang.Exception; - - /** - * Calculate the Yield to the Tenor implied by the given Date - * - * @param strTenor The Tenor - * - * @return The Yield - * - * @throws java.lang.Exception Thrown if the Yield cannot be calculated - */ - - public abstract double yield ( - final java.lang.String strTenor) - throws java.lang.Exception; - - /** - * Calculate the Discount Factor to the given Date Using the specified DCF - * - * @param iDate Date - * @param dblDCF The Day Count Fraction - * - * @return Discount Factor - * - * @throws java.lang.Exception Thrown if the Discount Factor cannot be calculated - */ - - public abstract double yieldDF ( - final int iDate, - final double dblDCF) - throws java.lang.Exception; -} diff --git a/org/drip/state/identifier/CollateralLabel.java b/org/drip/state/identifier/CollateralLabel.java deleted file mode 100644 index 06af5ee..0000000 --- a/org/drip/state/identifier/CollateralLabel.java +++ /dev/null @@ -1,109 +0,0 @@ - -package org.drip.state.identifier; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * CollateralLabel contains the Identifier Parameters referencing the Latent State of the named Collateral - * Discount Curve. Currently it only contains the collateral currency. - * - * @author Lakshmi Krishnamurthy - */ - -public class CollateralLabel implements org.drip.state.identifier.LatentStateLabel { - private java.lang.String _strCurrency = ""; - - /** - * Make a Standard Collateral Label from the Collateral Currency - * - * @param strCurrency The Collateral Currency - * - * @return The Collateral Label - */ - - public static final CollateralLabel Standard ( - final java.lang.String strCurrency) - { - try { - return new CollateralLabel (strCurrency); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * CollateralLabel constructor - * - * @param strCurrency Collateral Currency - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - private CollateralLabel ( - final java.lang.String strCurrency) - throws java.lang.Exception - { - if (null == (_strCurrency = strCurrency) || _strCurrency.isEmpty()) - throw new java.lang.Exception ("CollateralLabel ctr: Invalid Inputs"); - } - - @Override public java.lang.String fullyQualifiedName() - { - return _strCurrency; - } - - @Override public boolean match ( - final org.drip.state.identifier.LatentStateLabel lslOther) - { - return null == lslOther || !(lslOther instanceof org.drip.state.identifier.CollateralLabel) ? false : - _strCurrency.equalsIgnoreCase (lslOther.fullyQualifiedName()); - } -} diff --git a/org/drip/state/identifier/CreditLabel.java b/org/drip/state/identifier/CreditLabel.java deleted file mode 100644 index a7486b8..0000000 --- a/org/drip/state/identifier/CreditLabel.java +++ /dev/null @@ -1,120 +0,0 @@ - -package org.drip.state.identifier; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * CreditLabel contains the Identifier Parameters referencing the Latent State of the named Credit Curve. - * Currently it only contains the Reference Entity Name. - * - * @author Lakshmi Krishnamurthy - */ - -public class CreditLabel implements org.drip.state.identifier.LatentStateLabel { - private java.lang.String _strReferenceEntity = ""; - - /** - * Make a Standard Credit Label from the Reference Entity Name - * - * @param strReferenceEntity The Reference Entity Name - * - * @return The Credit Label - */ - - public static final CreditLabel Standard ( - final java.lang.String strReferenceEntity) - { - try { - return new CreditLabel (strReferenceEntity); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * CreditLabel constructor - * - * @param strReferenceEntity The Reference Entity Name - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public CreditLabel ( - final java.lang.String strReferenceEntity) - throws java.lang.Exception - { - if (null == (_strReferenceEntity = strReferenceEntity) || _strReferenceEntity.isEmpty()) - throw new java.lang.Exception ("CreditLabel ctr: Invalid Inputs"); - } - - @Override public java.lang.String fullyQualifiedName() - { - return _strReferenceEntity; - } - - @Override public boolean match ( - final org.drip.state.identifier.LatentStateLabel lslOther) - { - return null == lslOther || !(lslOther instanceof org.drip.state.identifier.CreditLabel) ? false : - _strReferenceEntity.equalsIgnoreCase (lslOther.fullyQualifiedName()); - } - - /** - * Retrieve the Reference Entity - * - * @return The Reference Entity - */ - - public java.lang.String referenceEntity() - { - return _strReferenceEntity; - } -} diff --git a/org/drip/state/identifier/CustomLabel.java b/org/drip/state/identifier/CustomLabel.java deleted file mode 100644 index 79c61e6..0000000 --- a/org/drip/state/identifier/CustomLabel.java +++ /dev/null @@ -1,109 +0,0 @@ - -package org.drip.state.identifier; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * CustomLabel contains the Identifier Parameters referencing the Latent State of the named Custom Metric. - * Currently it only contains the Arbitrarily Assigned Label. - * - * @author Lakshmi Krishnamurthy - */ - -public class CustomLabel implements org.drip.state.identifier.LatentStateLabel { - private java.lang.String _strCustomMetricLabel = ""; - - /** - * Make a Standard Custom Metric Label Instance - * - * @param strCustomMetricLabel The Custom Metric Label - * - * @return The Custom Label Instance - */ - - public static final CustomLabel Standard ( - final java.lang.String strCustomMetricLabel) - { - try { - return new CustomLabel (strCustomMetricLabel); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * CustomLabel constructor - * - * @param strCustomMetricLabel The Custom Metric Label - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - private CustomLabel ( - final java.lang.String strCustomMetricLabel) - throws java.lang.Exception - { - if (null == (_strCustomMetricLabel = strCustomMetricLabel) || _strCustomMetricLabel.isEmpty()) - throw new java.lang.Exception ("CustomLabel ctr: Invalid Inputs"); - } - - @Override public java.lang.String fullyQualifiedName() - { - return _strCustomMetricLabel; - } - - @Override public boolean match ( - final org.drip.state.identifier.LatentStateLabel lslOther) - { - return null == lslOther || !(lslOther instanceof org.drip.state.identifier.CustomLabel) ? false - : _strCustomMetricLabel.equalsIgnoreCase (lslOther.fullyQualifiedName()); - } -} diff --git a/org/drip/state/identifier/EquityLabel.java b/org/drip/state/identifier/EquityLabel.java deleted file mode 100644 index 74b543f..0000000 --- a/org/drip/state/identifier/EquityLabel.java +++ /dev/null @@ -1,109 +0,0 @@ - -package org.drip.state.identifier; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * EquityLabel contains the Identifier Parameters referencing the Latent State of the named Equity Curve. - * Currently it only contains the Reference Entity Name. - * - * @author Lakshmi Krishnamurthy - */ - -public class EquityLabel implements org.drip.state.identifier.LatentStateLabel { - private java.lang.String _strReferenceEntity = ""; - - /** - * Make a Standard Equity Label from the Reference Entity Name - * - * @param strReferenceEntity The Reference Entity Name - * - * @return The Equity Label - */ - - public static final EquityLabel Standard ( - final java.lang.String strReferenceEntity) - { - try { - return new EquityLabel (strReferenceEntity); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * EquityLabel constructor - * - * @param strReferenceEntity The Reference Entity Name - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - private EquityLabel ( - final java.lang.String strReferenceEntity) - throws java.lang.Exception - { - if (null == (_strReferenceEntity = strReferenceEntity) || _strReferenceEntity.isEmpty()) - throw new java.lang.Exception ("EquityLabel ctr: Invalid Inputs"); - } - - @Override public java.lang.String fullyQualifiedName() - { - return _strReferenceEntity; - } - - @Override public boolean match ( - final org.drip.state.identifier.LatentStateLabel lslOther) - { - return null == lslOther || !(lslOther instanceof org.drip.state.identifier.CreditLabel) ? false : - _strReferenceEntity.equalsIgnoreCase (lslOther.fullyQualifiedName()); - } -} diff --git a/org/drip/state/identifier/FXLabel.java b/org/drip/state/identifier/FXLabel.java deleted file mode 100644 index 759d8b4..0000000 --- a/org/drip/state/identifier/FXLabel.java +++ /dev/null @@ -1,156 +0,0 @@ - -package org.drip.state.identifier; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FXLabel contains the Identifier Parameters referencing the Latent State of the named FX Curve. Currently - * it only contains the FX Code. - * - * @author Lakshmi Krishnamurthy - */ - -public class FXLabel implements org.drip.state.identifier.LatentStateLabel { - private org.drip.product.params.CurrencyPair _cp = null; - - /** - * Make a Standard FX Label from the Currency Pair Instance - * - * @param cp The Currency Pair Instance - * - * @return The FX Label - */ - - public static final FXLabel Standard ( - final org.drip.product.params.CurrencyPair cp) - { - try { - return new FXLabel (cp); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Make a Standard FX Label from the Currency Pair Code - * - * @param strCode The FX Code - * - * @return The FX Label - */ - - public static final FXLabel Standard ( - final java.lang.String strCode) - { - try { - return new FXLabel (org.drip.product.params.CurrencyPair.FromCode (strCode)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * FXLabel constructor - * - * @param cp The Currency Pair - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - private FXLabel ( - final org.drip.product.params.CurrencyPair cp) - throws java.lang.Exception - { - if (null == (_cp = cp)) throw new java.lang.Exception ("FXLabel ctr: Invalid Inputs"); - } - - @Override public java.lang.String fullyQualifiedName() - { - return _cp.code(); - } - - @Override public boolean match ( - final org.drip.state.identifier.LatentStateLabel lslOther) - { - return null == lslOther || !(lslOther instanceof org.drip.state.identifier.FXLabel) ? false : - _cp.code().equalsIgnoreCase (lslOther.fullyQualifiedName()); - } - - /** - * Delegate the Inverse FX Label - * - * @return The Inverse FX Label - */ - - public FXLabel inverse() - { - try { - return new FXLabel (org.drip.product.params.CurrencyPair.FromCode (_cp.inverseCode())); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Retrieve the Currency Pair Instance - * - * @return The Underlying Currency Pair Instance - */ - - public org.drip.product.params.CurrencyPair currencyPair() - { - return _cp; - } -} diff --git a/org/drip/state/identifier/ForwardLabel.java b/org/drip/state/identifier/ForwardLabel.java deleted file mode 100644 index 6f3d5b7..0000000 --- a/org/drip/state/identifier/ForwardLabel.java +++ /dev/null @@ -1,234 +0,0 @@ - -package org.drip.state.identifier; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * ForwardLabel contains the Index Parameters referencing a payment on a Forward Index. It provides the - * following functionality: - * - Indicate if the Index is an Overnight Index - * - Retrieve Index, Tenor, Currency, and Fully Qualified Name. - * - * @author Lakshmi Krishnamurthy - */ - -public class ForwardLabel implements org.drip.state.identifier.LatentStateLabel { - private java.lang.String _strTenor = ""; - private org.drip.market.definition.FloaterIndex _floaterIndex = null; - - /** - * Construct a ForwardLabel from the corresponding Fully Qualified Name - * - * @param strFullyQualifiedName The Fully Qualified Name - * - * @return ForwardLabel Instance - */ - - public static final ForwardLabel Standard ( - final java.lang.String strFullyQualifiedName) - { - if (null == strFullyQualifiedName || strFullyQualifiedName.isEmpty()) return null; - - java.lang.String[] astr = strFullyQualifiedName.split ("-"); - - if (null == astr || 2 != astr.length) return null; - - java.lang.String strTenor = astr[1]; - java.lang.String strCurrency = astr[0]; - - org.drip.market.definition.FloaterIndex floaterIndex = "ON".equalsIgnoreCase (strTenor) || - "1D".equalsIgnoreCase (strTenor) ? - org.drip.market.definition.OvernightIndexContainer.IndexFromJurisdiction (strCurrency) : - org.drip.market.definition.IBORIndexContainer.IndexFromJurisdiction (strCurrency); - - try { - return new ForwardLabel (floaterIndex, strTenor); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a ForwardLabel from the tenor and the index - * - * @param floaterIndex The Floater Index Details - * @param strTenor Tenor - * - * @return ForwardLabel Instance - */ - - public static final ForwardLabel Create ( - final org.drip.market.definition.FloaterIndex floaterIndex, - final java.lang.String strTenor) - { - try { - return new ForwardLabel (floaterIndex, strTenor); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create from the Currency and the Tenor - * - * @param strCurrency Currency - * @param strTenor Tenor - * - * @return ForwardLabel Instance - */ - - public static final ForwardLabel Create ( - final java.lang.String strCurrency, - final java.lang.String strTenor) - { - return Standard (strCurrency + "-" + strTenor); - } - - protected ForwardLabel ( - final org.drip.market.definition.FloaterIndex floaterIndex, - final java.lang.String strTenor) - throws java.lang.Exception - { - if (null == (_floaterIndex = floaterIndex) || null == (_strTenor = strTenor) || _strTenor.isEmpty()) - throw new java.lang.Exception ("ForwardLabel ctr: Invalid Inputs"); - } - - /** - * Retrieve the Currency - * - * @return The Currency - */ - - public java.lang.String currency() - { - return _floaterIndex.currency(); - } - - /** - * Retrieve the Family - * - * @return The Family - */ - - public java.lang.String family() - { - return _floaterIndex.family(); - } - - /** - * Retrieve the Tenor - * - * @return The Tenor - */ - - public java.lang.String tenor() - { - return _strTenor; - } - - /** - * Indicate if the Index is an Overnight Index - * - * @return TRUE - Overnight Index - */ - - public boolean overnight() - { - return "ON".equalsIgnoreCase (_strTenor) || "1D".equalsIgnoreCase (_strTenor); - } - - /** - * Retrieve the Floater Index - * - * @return The Floater Index - */ - - public org.drip.market.definition.FloaterIndex floaterIndex() - { - return _floaterIndex; - } - - /** - * Retrieve a Unit Coupon Accrual Setting - * - * @return Unit Coupon Accrual Setting - */ - - public org.drip.param.period.UnitCouponAccrualSetting ucas() - { - java.lang.String strDayCount = _floaterIndex.dayCount(); - - try { - return new org.drip.param.period.UnitCouponAccrualSetting (overnight() ? 360 : - org.drip.analytics.support.Helper.TenorToFreq (_strTenor), strDayCount, false, strDayCount, - false, _floaterIndex.currency(), false, _floaterIndex.accrualCompoundingRule()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public java.lang.String fullyQualifiedName() - { - return _floaterIndex.currency() + "-" + _floaterIndex.family() + "-" + _strTenor; - } - - @Override public boolean match ( - final org.drip.state.identifier.LatentStateLabel lslOther) - { - return null == lslOther || !(lslOther instanceof org.drip.state.identifier.ForwardLabel) ? false : - fullyQualifiedName().equalsIgnoreCase (lslOther.fullyQualifiedName()); - } -} diff --git a/org/drip/state/identifier/FundingLabel.java b/org/drip/state/identifier/FundingLabel.java deleted file mode 100644 index b0f9f91..0000000 --- a/org/drip/state/identifier/FundingLabel.java +++ /dev/null @@ -1,101 +0,0 @@ - -package org.drip.state.identifier; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * FundingLabel contains the Identifier Parameters referencing the Latent State of the named Funding Discount - * Curve. Currently it only contains the funding currency. - * - * @author Lakshmi Krishnamurthy - */ - -public class FundingLabel implements org.drip.state.identifier.LatentStateLabel { - private java.lang.String _strCurrency = ""; - - /** - * Make a Standard Funding Label from the Funding Currency - * - * @param strCurrency The Funding Currency - * - * @return The Funding Label - */ - - public static final FundingLabel Standard ( - final java.lang.String strCurrency) - { - try { - return new FundingLabel (strCurrency); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private FundingLabel ( - final java.lang.String strCurrency) - throws java.lang.Exception - { - if (null == (_strCurrency = strCurrency) || _strCurrency.isEmpty()) - throw new java.lang.Exception ("FundingLabel ctr: Invalid Inputs"); - } - - @Override public java.lang.String fullyQualifiedName() - { - return _strCurrency; - } - - @Override public boolean match ( - final org.drip.state.identifier.LatentStateLabel lslOther) - { - return null == lslOther || !(lslOther instanceof org.drip.state.identifier.FundingLabel) ? false : - _strCurrency.equalsIgnoreCase (lslOther.fullyQualifiedName()); - } -} diff --git a/org/drip/state/identifier/GovvieLabel.java b/org/drip/state/identifier/GovvieLabel.java deleted file mode 100644 index eaeae28..0000000 --- a/org/drip/state/identifier/GovvieLabel.java +++ /dev/null @@ -1,120 +0,0 @@ - -package org.drip.state.identifier; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * GovvieLabel contains the Identifier Parameters referencing the Latent State of the named Sovereign Curve. - * Currently it only contains the Sovereign Name. - * - * @author Lakshmi Krishnamurthy - */ - -public class GovvieLabel implements org.drip.state.identifier.LatentStateLabel { - private java.lang.String _strTreasuryCode = ""; - - /** - * Make a Standard Govvie Label from the Treasury Code - * - * @param strTreasuryCode The Treasury Code - * - * @return The Govvie Label - */ - - public static final GovvieLabel Standard ( - final java.lang.String strTreasuryCode) - { - try { - return new GovvieLabel (strTreasuryCode); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * GovvieLabel constructor - * - * @param strTreasuryCode The Treasury Code - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - private GovvieLabel ( - final java.lang.String strTreasuryCode) - throws java.lang.Exception - { - if (null == (_strTreasuryCode = strTreasuryCode) || _strTreasuryCode.isEmpty()) - throw new java.lang.Exception ("GovvieLabel ctr: Invalid Inputs"); - } - - @Override public java.lang.String fullyQualifiedName() - { - return _strTreasuryCode; - } - - @Override public boolean match ( - final org.drip.state.identifier.LatentStateLabel lslOther) - { - return null == lslOther || !(lslOther instanceof org.drip.state.identifier.GovvieLabel) ? false : - _strTreasuryCode.equalsIgnoreCase (lslOther.fullyQualifiedName()); - } - - /** - * Retrieve the Treasury Code - * - * @return The Treasury Code - */ - - public java.lang.String treasuryCode() - { - return _strTreasuryCode; - } -} diff --git a/org/drip/state/identifier/LatentStateLabel.java b/org/drip/state/identifier/LatentStateLabel.java deleted file mode 100644 index 705af04..0000000 --- a/org/drip/state/identifier/LatentStateLabel.java +++ /dev/null @@ -1,80 +0,0 @@ - -package org.drip.state.identifier; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * LatentStateLabel is the interface that contains the labels inside the sub-stretch of the alternate state. - * The functionality its derivations implement provide fully qualified label names and their matches. - * - * @author Lakshmi Krishnamurthy - */ - -public interface LatentStateLabel { - - /** - * Retrieve the Fully Qualified Name - * - * @return The Fully Qualified Name - */ - - public abstract java.lang.String fullyQualifiedName(); - - /** - * Indicate whether this Label matches the supplied. - * - * @param lslOther The Supplied Label - * - * @return TRUE - The Supplied Label matches this. - */ - - public abstract boolean match ( - final LatentStateLabel lslOther); -} diff --git a/org/drip/state/identifier/OvernightLabel.java b/org/drip/state/identifier/OvernightLabel.java deleted file mode 100644 index 40abaa0..0000000 --- a/org/drip/state/identifier/OvernightLabel.java +++ /dev/null @@ -1,206 +0,0 @@ - -package org.drip.state.identifier; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * OvernightLabel contains the Index Parameters referencing an Overnight Index. It provides the functionality - * to Retrieve Index, Tenor, Currency, and Fully Qualified Name. - * - * @author Lakshmi Krishnamurthy - */ - -public class OvernightLabel extends org.drip.state.identifier.ForwardLabel { - private org.drip.market.definition.OvernightIndex _overnightIndex = null; - - /** - * Construct an OvernightLabel from the Jurisdiction - * - * @param strCurrency The Currency - * - * @return The OvernightLabel Instance - */ - - public static final OvernightLabel Create ( - final java.lang.String strCurrency) - { - try { - return new OvernightLabel - (org.drip.market.definition.OvernightIndexContainer.IndexFromJurisdiction (strCurrency)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct an OvernightLabel from the Index - * - * @param overnightIndex The Overnight Index Details - * - * @return The OvernightLabel Instance - */ - - public static final OvernightLabel Create ( - final org.drip.market.definition.OvernightIndex overnightIndex) - { - try { - return new OvernightLabel (overnightIndex); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * OvernightLabel Constructor - * - * @param overnightIndex The Overnight Index Details - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - private OvernightLabel ( - final org.drip.market.definition.OvernightIndex overnightIndex) - throws java.lang.Exception - { - super (overnightIndex, "ON"); - - if (null == (_overnightIndex = overnightIndex)) - throw new java.lang.Exception ("OvernightLabel ctr: Invalid Inputs"); - } - - /** - * Retrieve the Currency - * - * @return The Currency - */ - - public java.lang.String currency() - { - return _overnightIndex.currency(); - } - - /** - * Retrieve the Family - * - * @return The Family - */ - - public java.lang.String family() - { - return _overnightIndex.family(); - } - - /** - * Retrieve the Tenor - * - * @return The Tenor - */ - - public java.lang.String tenor() - { - return "ON"; - } - - /** - * Indicate if the Index is an Overnight Index - * - * @return TRUE - Overnight Index - */ - - public boolean overnight() - { - return true; - } - - /** - * Retrieve the Overnight Index - * - * @return The Overnight Index - */ - - public org.drip.market.definition.OvernightIndex overnightIndex() - { - return _overnightIndex; - } - - /** - * Retrieve a Unit Coupon Accrual Setting - * - * @return Unit Coupon Accrual Setting - */ - - public org.drip.param.period.UnitCouponAccrualSetting ucas() - { - java.lang.String strDayCount = _overnightIndex.dayCount(); - - try { - return new org.drip.param.period.UnitCouponAccrualSetting (360, strDayCount, false, strDayCount, - false, _overnightIndex.currency(), false, _overnightIndex.accrualCompoundingRule()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public java.lang.String fullyQualifiedName() - { - return _overnightIndex.currency() + "-" + _overnightIndex.family() + "-ON"; - } - - @Override public boolean match ( - final org.drip.state.identifier.LatentStateLabel lslOther) - { - return null == lslOther || !(lslOther instanceof org.drip.state.identifier.OvernightLabel) ? false : - fullyQualifiedName().equalsIgnoreCase (lslOther.fullyQualifiedName()); - } -} diff --git a/org/drip/state/identifier/PaydownLabel.java b/org/drip/state/identifier/PaydownLabel.java deleted file mode 100644 index f230f9c..0000000 --- a/org/drip/state/identifier/PaydownLabel.java +++ /dev/null @@ -1,109 +0,0 @@ - -package org.drip.state.identifier; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * PaydownLabel contains the Identifier Parameters referencing the Latent State of the named Paydown Curve. - * Currently it only contains the Reference Entity Name. - * - * @author Lakshmi Krishnamurthy - */ - -public class PaydownLabel implements org.drip.state.identifier.LatentStateLabel { - private java.lang.String _strReferenceEntity = ""; - - /** - * Make a Standard Pay-down Label from the Reference Entity Name - * - * @param strReferenceEntity The Reference Entity Name - * - * @return The Pay-down Label - */ - - public static final PaydownLabel Standard ( - final java.lang.String strReferenceEntity) - { - try { - return new PaydownLabel (strReferenceEntity); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * PaydownLabel constructor - * - * @param strReferenceEntity The Reference Entity Name - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - private PaydownLabel ( - final java.lang.String strReferenceEntity) - throws java.lang.Exception - { - if (null == (_strReferenceEntity = strReferenceEntity) || _strReferenceEntity.isEmpty()) - throw new java.lang.Exception ("PaydownLabel ctr: Invalid Inputs"); - } - - @Override public java.lang.String fullyQualifiedName() - { - return _strReferenceEntity; - } - - @Override public boolean match ( - final org.drip.state.identifier.LatentStateLabel lslOther) - { - return null == lslOther || !(lslOther instanceof org.drip.state.identifier.CreditLabel) ? false : - _strReferenceEntity.equalsIgnoreCase (lslOther.fullyQualifiedName()); - } -} diff --git a/org/drip/state/identifier/RatingLabel.java b/org/drip/state/identifier/RatingLabel.java deleted file mode 100644 index c44055f..0000000 --- a/org/drip/state/identifier/RatingLabel.java +++ /dev/null @@ -1,138 +0,0 @@ - -package org.drip.state.identifier; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * RatingLabel contains the Identifier Parameters referencing the Label corresponding to the Credit Rating - * Latent State. Currently it holds the Ratings Agency Name and the Rated Code. - * - * @author Lakshmi Krishnamurthy - */ - -public class RatingLabel implements org.drip.state.identifier.LatentStateLabel { - private java.lang.String _strCode = ""; - private java.lang.String _strAgency = ""; - - /** - * Make a Standard Rating Label from the Rating Agency and the Rated Code. - * - * @param strAgency The Rating Agency - * @param strCode The Rated Code - * - * @return The Rating Label - */ - - public static final RatingLabel Standard ( - final java.lang.String strAgency, - final java.lang.String strCode) - { - try { - return new RatingLabel (strAgency, strCode); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * RatingsLabel constructor - * - * @param strAgency The Ratings Agency - * @param strCode The Rated Code - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public RatingLabel ( - final java.lang.String strAgency, - final java.lang.String strCode) - throws java.lang.Exception - { - if (null == (_strAgency = strAgency) || _strAgency.isEmpty() || null == (_strCode = strCode) || - _strCode.isEmpty()) - throw new java.lang.Exception ("RatingLabel ctr: Invalid Inputs"); - } - - @Override public java.lang.String fullyQualifiedName() - { - return _strAgency + "::" + _strCode; - } - - @Override public boolean match ( - final org.drip.state.identifier.LatentStateLabel lslOther) - { - if (null == lslOther || !(lslOther instanceof org.drip.state.identifier.RatingLabel)) return false; - - org.drip.state.identifier.RatingLabel rlOther = (org.drip.state.identifier.RatingLabel) lslOther; - - return _strAgency.equalsIgnoreCase (rlOther.agency()) && _strCode.equalsIgnoreCase (rlOther.code()); - } - - /** - * Retrieve the Ratings Agency - * - * @return The Ratings Agency - */ - - public java.lang.String agency() - { - return _strAgency; - } - - /** - * Retrieve the Rated Code - * - * @return The Rated Code - */ - - public java.lang.String code() - { - return _strCode; - } -} diff --git a/org/drip/state/identifier/RecoveryLabel.java b/org/drip/state/identifier/RecoveryLabel.java deleted file mode 100644 index f63798e..0000000 --- a/org/drip/state/identifier/RecoveryLabel.java +++ /dev/null @@ -1,109 +0,0 @@ - -package org.drip.state.identifier; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * RecoveryLabel contains the Identifier Parameters referencing the Latent State of the named Recovery Curve. - * Currently it only contains the Reference Entity Name. - * - * @author Lakshmi Krishnamurthy - */ - -public class RecoveryLabel implements org.drip.state.identifier.LatentStateLabel { - private java.lang.String _strReferenceEntity = ""; - - /** - * Make a Standard Recovery Label from the Reference Entity Name - * - * @param strReferenceEntity The Reference Entity Name - * - * @return The Recovery Label - */ - - public static final RecoveryLabel Standard ( - final java.lang.String strReferenceEntity) - { - try { - return new RecoveryLabel (strReferenceEntity); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * RecoveryLabel constructor - * - * @param strReferenceEntity The Reference Entity Name - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - private RecoveryLabel ( - final java.lang.String strReferenceEntity) - throws java.lang.Exception - { - if (null == (_strReferenceEntity = strReferenceEntity) || _strReferenceEntity.isEmpty()) - throw new java.lang.Exception ("RecoveryLabel ctr: Invalid Inputs"); - } - - @Override public java.lang.String fullyQualifiedName() - { - return _strReferenceEntity; - } - - @Override public boolean match ( - final org.drip.state.identifier.LatentStateLabel lslOther) - { - return null == lslOther || !(lslOther instanceof org.drip.state.identifier.CreditLabel) ? false : - _strReferenceEntity.equalsIgnoreCase (lslOther.fullyQualifiedName()); - } -} diff --git a/org/drip/state/identifier/RepoLabel.java b/org/drip/state/identifier/RepoLabel.java deleted file mode 100644 index 091dd84..0000000 --- a/org/drip/state/identifier/RepoLabel.java +++ /dev/null @@ -1,108 +0,0 @@ - -package org.drip.state.identifier; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RepoLabel contains the Identifier Parameters referencing the Latent State of the named Repo Curve. It - * holds the Name of the Repo'able Product. - * - * @author Lakshmi Krishnamurthy - */ - -public class RepoLabel implements org.drip.state.identifier.LatentStateLabel { - private java.lang.String _strCode = ""; - - /** - * Make a Standard Repo Label from the Product Code - * - * @param strCode The Repo'able Product Code - * - * @return The Repo Label - */ - - public static final RepoLabel Standard ( - final java.lang.String strCode) - { - try { - return new RepoLabel (strCode); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * RepoLabel constructor - * - * @param strCode The Repo'able Product Code - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public RepoLabel ( - final java.lang.String strCode) - throws java.lang.Exception - { - if (null == (_strCode = strCode) || _strCode.isEmpty()) - throw new java.lang.Exception ("RepoLabel ctr: Invalid Inputs"); - } - - @Override public java.lang.String fullyQualifiedName() - { - return _strCode; - } - - @Override public boolean match ( - final org.drip.state.identifier.LatentStateLabel lslOther) - { - return null == lslOther || !(lslOther instanceof org.drip.state.identifier.RepoLabel) ? false : - _strCode.equalsIgnoreCase (lslOther.fullyQualifiedName()); - } -} diff --git a/org/drip/state/identifier/VolatilityLabel.java b/org/drip/state/identifier/VolatilityLabel.java deleted file mode 100644 index c0b5317..0000000 --- a/org/drip/state/identifier/VolatilityLabel.java +++ /dev/null @@ -1,120 +0,0 @@ - -package org.drip.state.identifier; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * VolatilityLabel contains the Identifier Parameters referencing the Latent State of the named Volatility - * Curve. Currently it only contains the label of the underlying Latent State. - * - * @author Lakshmi Krishnamurthy - */ - -public class VolatilityLabel implements org.drip.state.identifier.LatentStateLabel { - private org.drip.state.identifier.LatentStateLabel _lslUnderlyingState = null; - - /** - * Make a Standard Volatility Latent State Label from the Underlying Latent State Label - * - * @param lslUnderlyingState Underlying Latent State Label - * - * @return The Volatility Label - */ - - public static final VolatilityLabel Standard ( - final org.drip.state.identifier.LatentStateLabel lslUnderlyingState) - { - try { - return new VolatilityLabel (lslUnderlyingState); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * VolatilityLabel constructor - * - * @param lslUnderlyingState Underlying Latent State Label - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public VolatilityLabel ( - final org.drip.state.identifier.LatentStateLabel lslUnderlyingState) - throws java.lang.Exception - { - if (null == (_lslUnderlyingState = lslUnderlyingState)) - throw new java.lang.Exception ("VolatilityLabel ctr: Invalid Inputs"); - } - - /** - * Retrieve the Latent State Underlying the Volatility Latent State - * - * @return The Latent State Underlying the Volatility Latent State - */ - - public org.drip.state.identifier.LatentStateLabel underlyingLatentState() - { - return _lslUnderlyingState; - } - - @Override public java.lang.String fullyQualifiedName() - { - return _lslUnderlyingState.fullyQualifiedName(); - } - - @Override public boolean match ( - final org.drip.state.identifier.LatentStateLabel lslOther) - { - return null == lslOther || !(lslOther instanceof org.drip.state.identifier.VolatilityLabel) ? false : - underlyingLatentState().match (((org.drip.state.identifier.VolatilityLabel) - lslOther).underlyingLatentState()); - } -} diff --git a/org/drip/state/inference/LatentStateSegmentSpec.java b/org/drip/state/inference/LatentStateSegmentSpec.java deleted file mode 100644 index 9dc0311..0000000 --- a/org/drip/state/inference/LatentStateSegmentSpec.java +++ /dev/null @@ -1,102 +0,0 @@ - -package org.drip.state.inference; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * LatentStateSegmentSpec carries the calibration instrument and the manifest measure set used in calibrating - * the segment. - * - * @author Lakshmi Krishnamurthy - */ - -public class LatentStateSegmentSpec { - private org.drip.product.calib.ProductQuoteSet _pqs = null; - private org.drip.product.definition.CalibratableComponent _cfic = null; - - /** - * LatentStateSegmentSpec constructor - * - * @param cfic The Calibratable Fixed Income Component - * @param pqs The Product Manifest Measure Quote Set Instance - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public LatentStateSegmentSpec ( - final org.drip.product.definition.CalibratableComponent cfic, - final org.drip.product.calib.ProductQuoteSet pqs) - throws java.lang.Exception - { - if (null == (_cfic = cfic) || null == (_pqs = pqs)) - throw new java.lang.Exception ("LatentStateSegmentSpec ctr: Invalid Inputs"); - } - - /** - * Retrieve the Calibration Component - * - * @return The Calibration Component - */ - - public org.drip.product.definition.CalibratableComponent component() - { - return _cfic; - } - - /** - * Retrieve the Calibration Manifest Measure Quote Set - * - * @return The Calibration Manifest Measure Quote Set - */ - - public org.drip.product.calib.ProductQuoteSet manifestMeasures() - { - return _pqs; - } -} diff --git a/org/drip/state/inference/LatentStateSequenceBuilder.java b/org/drip/state/inference/LatentStateSequenceBuilder.java deleted file mode 100644 index c910166..0000000 --- a/org/drip/state/inference/LatentStateSequenceBuilder.java +++ /dev/null @@ -1,427 +0,0 @@ - -package org.drip.state.inference; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * LatentStateSequenceBuilder holds the logic behind building the bootstrap segments contained in the given - * Stretch. - * - * It extends SegmentSequenceBuilder by implementing/customizing the calibration of the starting as well as - * the subsequent segments. - * - * @author Lakshmi Krishnamurthy - */ - -public class LatentStateSequenceBuilder implements org.drip.spline.stretch.SegmentSequenceBuilder { - private org.drip.spline.grid.Span _span = null; - private double _dblEpochResponse = java.lang.Double.NaN; - private org.drip.spline.stretch.BoundarySettings _bs = null; - private org.drip.state.estimator.CurveStretch _stretch = null; - private org.drip.param.pricer.CreditPricerParams _pricerParams = null; - private org.drip.param.market.CurveSurfaceQuoteContainer _csqs = null; - private org.drip.param.valuation.ValuationParams _valParams = null; - private org.drip.spline.params.StretchBestFitResponse _sbfr = null; - private org.drip.param.valuation.ValuationCustomizationParams _vcp = null; - private org.drip.state.inference.LatentStateStretchSpec _stretchSpec = null; - private org.drip.spline.params.StretchBestFitResponse _sbfrQuoteSensitivity = null; - private - org.drip.analytics.support.CaseInsensitiveHashMap - _mapPMSC = null; - - private java.util.Map - _mapRVSC = new - java.util.HashMap(); - - private org.drip.spline.params.PreceedingManifestSensitivityControl getPMSC ( - final java.lang.String strManifestMeasure) - { - return _mapPMSC.containsKey (strManifestMeasure) ? _mapPMSC.get (strManifestMeasure) : null; - } - - private org.drip.spline.params.SegmentResponseValueConstraint segmentCalibResponseConstraint ( - final org.drip.state.estimator.PredictorResponseWeightConstraint prwc) - { - java.util.TreeMap mapPredictorLSQMLoading = - prwc.getPredictorResponseWeight(); - - if (null == mapPredictorLSQMLoading || 0 == mapPredictorLSQMLoading.size()) return null; - - java.util.Set> esPredictorLSQMLoading = - mapPredictorLSQMLoading.entrySet(); - - if (null == esPredictorLSQMLoading || 0 == esPredictorLSQMLoading.size()) return null; - - double dblConstraint = 0.; - - java.util.List lsPredictor = new java.util.ArrayList(); - - java.util.List lsResponseLSQMLoading = new java.util.ArrayList(); - - for (java.util.Map.Entry me : esPredictorLSQMLoading) { - if (null == me) return null; - - double dblPredictorDate = me.getKey(); - - try { - if (null != _span && _span.in (dblPredictorDate)) - dblConstraint -= _span.calcResponseValue (dblPredictorDate) * me.getValue(); - else if (_stretch.inBuiltRange (dblPredictorDate)) - dblConstraint -= _stretch.responseValue (dblPredictorDate) * me.getValue(); - else { - lsPredictor.add (dblPredictorDate); - - lsResponseLSQMLoading.add (me.getValue()); - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - int iSize = lsPredictor.size(); - - double[] adblPredictor = new double[iSize]; - double[] adblResponseLSQMLoading = new double[iSize]; - - for (int i = 0; i < iSize; ++i) { - adblPredictor[i] = lsPredictor.get (i); - - adblResponseLSQMLoading[i] = lsResponseLSQMLoading.get (i); - } - - try { - return new org.drip.spline.params.SegmentResponseValueConstraint (adblPredictor, - adblResponseLSQMLoading, (prwc.getValue()) + dblConstraint); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private org.drip.spline.params.SegmentResponseValueConstraint segmentSensResponseConstraint ( - final org.drip.state.estimator.PredictorResponseWeightConstraint prwc, - final java.lang.String strManifestMeasure) - { - java.util.TreeMap mapPredictorSensLoading = - prwc.getDResponseWeightDManifestMeasure (strManifestMeasure); - - if (null == mapPredictorSensLoading || 0 == mapPredictorSensLoading.size()) return null; - - java.util.Set> esPredictorSensLoading = - mapPredictorSensLoading.entrySet(); - - if (null == esPredictorSensLoading || 0 == esPredictorSensLoading.size()) return null; - - double dblSensLoadingConstraint = 0.; - - java.util.List lsPredictor = new java.util.ArrayList(); - - java.util.List lsSensLoading = new java.util.ArrayList(); - - for (java.util.Map.Entry me : esPredictorSensLoading) { - if (null == me) return null; - - double dblPredictorDate = me.getKey(); - - try { - if (null != _span && _span.in (dblPredictorDate)) - dblSensLoadingConstraint -= _span.calcResponseValue (dblPredictorDate) * me.getValue(); - else if (_stretch.inBuiltRange (dblPredictorDate)) - dblSensLoadingConstraint -= _stretch.responseValue (dblPredictorDate) * me.getValue(); - else { - lsPredictor.add (dblPredictorDate); - - lsSensLoading.add (me.getValue()); - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - int iSize = lsPredictor.size(); - - double[] adblPredictor = new double[iSize]; - double[] adblSensLoading = new double[iSize]; - - for (int i = 0; i < iSize; ++i) { - adblPredictor[i] = lsPredictor.get (i); - - adblSensLoading[i] = lsSensLoading.get (i); - } - - try { - return new org.drip.spline.params.SegmentResponseValueConstraint (adblPredictor, adblSensLoading, - prwc.getDValueDManifestMeasure (strManifestMeasure) + dblSensLoadingConstraint); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - private boolean generateSegmentConstraintSet ( - final double dblSegmentRight, - final org.drip.state.estimator.PredictorResponseWeightConstraint prwc) - { - org.drip.spline.params.SegmentResponseValueConstraint srvcBase = segmentCalibResponseConstraint - (prwc); - - if (null == srvcBase) return false; - - org.drip.spline.params.ResponseValueSensitivityConstraint rvsc = null; - - try { - rvsc = new org.drip.spline.params.ResponseValueSensitivityConstraint (srvcBase); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - - java.util.Set setstrSensitivity = prwc.sensitivityKeys(); - - if (null == setstrSensitivity || 0 == setstrSensitivity.size()) { - _mapRVSC.put (dblSegmentRight, rvsc); - - return true; - } - - for (java.lang.String strManifestMeasure : setstrSensitivity) { - org.drip.spline.params.SegmentResponseValueConstraint srvcSensitivity = - segmentSensResponseConstraint (prwc, strManifestMeasure); - - if (null == srvcSensitivity || !rvsc.addManifestMeasureSensitivity (strManifestMeasure, - srvcSensitivity)) - continue; - } - - _mapRVSC.put (dblSegmentRight, rvsc); - - return true; - } - - /** - * LatentStateSequenceBuilder constructor - * - * @param dblEpochResponse Segment Sequence Left-most Response Value - * @param stretchSpec The Latent State Stretch Specification - * @param valParams Valuation Parameter - * @param pricerParams Pricer Parameter - * @param csqs The Market Parameter Set - * @param vcp Valuation Customization Parameters - * @param span The Containing Span this Stretch will become a part of - * @param sbfr Stretch Fitness Weighted Response - * @param mapPMSC Map of Preceeding Manifest Sensitivity Control Parameters - * @param sbfrQuoteSensitivity Stretch Fitness Weighted Response Quote Sensitivity - * @param bs The Calibration Boundary Condition - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public LatentStateSequenceBuilder ( - final double dblEpochResponse, - final org.drip.state.inference.LatentStateStretchSpec stretchSpec, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.spline.grid.Span span, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final - org.drip.analytics.support.CaseInsensitiveHashMap - mapPMSC, - final org.drip.spline.params.StretchBestFitResponse sbfrQuoteSensitivity, - final org.drip.spline.stretch.BoundarySettings bs) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblEpochResponse = dblEpochResponse) || null == - (_stretchSpec = stretchSpec) || null == (_valParams = valParams) || null == (_bs = bs) || null == - (_mapPMSC = mapPMSC)) - throw new java.lang.Exception ("LatentStateSequenceBuilder ctr: Invalid Inputs"); - - _vcp = vcp; - _csqs = csqs; - _sbfr = sbfr; - _span = span; - _pricerParams = pricerParams; - _sbfrQuoteSensitivity = sbfrQuoteSensitivity; - } - - @Override public boolean setStretch ( - final org.drip.spline.stretch.MultiSegmentSequence mss) - { - if (null == mss || !(mss instanceof org.drip.state.estimator.CurveStretch)) return false; - - _stretch = (org.drip.state.estimator.CurveStretch) mss; - - org.drip.spline.segment.LatentStateResponseModel[] aLSRM = _stretch.segments(); - - if (null == aLSRM || aLSRM.length != _stretchSpec.segmentSpec().length) return false; - - return true; - } - - @Override public org.drip.spline.stretch.BoundarySettings getCalibrationBoundaryCondition() - { - return _bs; - } - - @Override public boolean calibStartingSegment ( - final double dblLeftSlope) - { - if (null == _stretch || !_stretch.clearBuiltRange()) return false; - - org.drip.product.definition.CalibratableComponent cfic = - _stretchSpec.segmentSpec()[0].component(); - - if (null == cfic) return false; - - org.drip.spline.segment.LatentStateResponseModel[] aLSRM = _stretch.segments(); - - if (null == aLSRM || 0 == aLSRM.length) return false; - - org.drip.state.estimator.PredictorResponseWeightConstraint prwc = cfic.calibPRWC (_valParams, - _pricerParams, _csqs, _vcp, _stretchSpec.segmentSpec()[0].manifestMeasures()); - - double dblSegmentRight = aLSRM[0].right(); - - if (null == prwc || !generateSegmentConstraintSet (dblSegmentRight, prwc)) return false; - - org.drip.spline.params.SegmentResponseValueConstraint rvcLeading = - org.drip.spline.params.SegmentResponseValueConstraint.FromPredictorResponsePair - (_valParams.valueDate(), _dblEpochResponse); - - if (null == rvcLeading) return false; - - return aLSRM[0].calibrate (rvcLeading, dblLeftSlope, _mapRVSC.get (dblSegmentRight).base(), null == - _sbfr ? null : _sbfr.sizeToSegment (aLSRM[0])) && _stretch.markSegmentBuilt (0, - prwc.mergeLabelSet()); - } - - @Override public boolean calibSegmentSequence ( - final int iStartingSegment) - { - org.drip.spline.segment.LatentStateResponseModel[] aLSRM = _stretch.segments(); - - org.drip.state.inference.LatentStateSegmentSpec[] aLSSS = _stretchSpec.segmentSpec(); - - int iNumSegment = aLSRM.length; - - if (null == aLSSS || aLSSS.length != iNumSegment) return false; - - for (int iSegment = iStartingSegment; iSegment < iNumSegment; ++iSegment) { - org.drip.product.definition.CalibratableComponent cfic = aLSSS[iSegment].component(); - - if (null == cfic) return false; - - org.drip.state.estimator.PredictorResponseWeightConstraint prwc = cfic.calibPRWC (_valParams, - _pricerParams, _csqs, _vcp, aLSSS[iSegment].manifestMeasures()); - - double dblSegmentRight = aLSRM[iSegment].right(); - - if (null == prwc || !generateSegmentConstraintSet (dblSegmentRight, prwc)) return false; - - if (!aLSRM[iSegment].calibrate (0 == iSegment ? null : aLSRM[iSegment - 1], _mapRVSC.get - (dblSegmentRight).base(), null == _sbfr ? null : _sbfr.sizeToSegment (aLSRM[iSegment])) || - !_stretch.markSegmentBuilt (iSegment, prwc.mergeLabelSet())) - return false; - } - - return true; - } - - @Override public boolean manifestMeasureSensitivity ( - final double dblLeftSlopeSensitivity) - { - org.drip.spline.segment.LatentStateResponseModel[] aLSRM = _stretch.segments(); - - int iNumSegment = aLSRM.length; - - for (int iSegment = 0; iSegment < iNumSegment; ++iSegment) { - double dblSegmentRight = aLSRM[iSegment].right(); - - org.drip.spline.params.ResponseValueSensitivityConstraint rvsc = _mapRVSC.get (dblSegmentRight); - - java.util.Set setstrManifestMeasures = rvsc.manifestMeasures(); - - if (null == setstrManifestMeasures || 0 == setstrManifestMeasures.size()) return false; - - for (java.lang.String strManifestMeasure : setstrManifestMeasures) { - if (!aLSRM[iSegment].setPreceedingManifestSensitivityControl (strManifestMeasure, getPMSC - (strManifestMeasure))) - return false; - - if (0 == iSegment) { - if (!aLSRM[0].manifestMeasureSensitivity (strManifestMeasure, - org.drip.spline.params.SegmentResponseValueConstraint.FromPredictorResponsePair - (_valParams.valueDate(), _dblEpochResponse), rvsc.base(), - dblLeftSlopeSensitivity, - org.drip.spline.params.SegmentResponseValueConstraint.FromPredictorResponsePair - (_valParams.valueDate(), 0.), rvsc.manifestMeasureSensitivity (strManifestMeasure), - null == _sbfrQuoteSensitivity ? null : _sbfrQuoteSensitivity.sizeToSegment - (aLSRM[0]))) - return false; - } else { - if (!aLSRM[iSegment].manifestMeasureSensitivity (aLSRM[iSegment - 1], strManifestMeasure, - rvsc.base(), rvsc.manifestMeasureSensitivity (strManifestMeasure), null == - _sbfrQuoteSensitivity ? null : _sbfrQuoteSensitivity.sizeToSegment - (aLSRM[iSegment]))) - return false; - } - } - } - - return true; - } -} diff --git a/org/drip/state/inference/LatentStateStretchSpec.java b/org/drip/state/inference/LatentStateStretchSpec.java deleted file mode 100644 index 41185ab..0000000 --- a/org/drip/state/inference/LatentStateStretchSpec.java +++ /dev/null @@ -1,103 +0,0 @@ - -package org.drip.state.inference; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * LatentStateStretchSpec carries the Latent State Segment Sequence corresponding to the calibratable - * Stretch. - * - * @author Lakshmi Krishnamurthy - */ - -public class LatentStateStretchSpec { - private java.lang.String _strName = ""; - private org.drip.state.inference.LatentStateSegmentSpec[] _aLSSS = null; - - /** - * LatentStateStretchSpec constructor - * - * @param strName Stretch Name - * @param aLSSS The Latent State Segment Product/Manifest Measure Sequence contained in the Stretch - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public LatentStateStretchSpec ( - final java.lang.String strName, - final org.drip.state.inference.LatentStateSegmentSpec[] aLSSS) - throws java.lang.Exception - { - if (null == (_strName = strName) || _strName.isEmpty() || null == (_aLSSS = aLSSS) || 0 == - _aLSSS.length) - throw new java.lang.Exception ("LatentStateStretchSpec ctr: Invalid Inputs"); - } - - /** - * Retrieve the name of the LatentStateStretchSpec Instance - * - * @return Name of the LatentStateStretchSpec Instance - */ - - public java.lang.String name() - { - return _strName; - } - - /** - * Retrieve the Array of the Latent State Segment Product/Manifest Measure Sequence - * - * @return The Array of the Latent State Segment Product/Manifest Measure Sequence - */ - - public org.drip.state.inference.LatentStateSegmentSpec[] segmentSpec() - { - return _aLSSS; - } -} diff --git a/org/drip/state/inference/LinearLatentStateCalibrator.java b/org/drip/state/inference/LinearLatentStateCalibrator.java deleted file mode 100644 index b398840..0000000 --- a/org/drip/state/inference/LinearLatentStateCalibrator.java +++ /dev/null @@ -1,166 +0,0 @@ - -package org.drip.state.inference; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * LinearLatentStateCalibrator calibrates/constructs the Latent State Stretch/Span from the calibration - * instrument details. The span construction may be customized using specific settings provided in - * GlobalControlCurveParams. - * - * @author Lakshmi Krishnamurthy - */ - -public class LinearLatentStateCalibrator extends org.drip.state.estimator.GlobalControlCurveParams { - - /** - * LinearLatentStateCalibrator constructor - * - * @param scbc Segment Builder Control Parameters - * @param bs The Calibration Boundary Condition - * @param iCalibrationDetail The Calibration Detail - * @param sbfr Curve Fitness Weighted Response - * @param sbfrSensitivity Curve Fitness Weighted Response Sensitivity - * - * @throws java.lang.Exception Thrown if the inputs are invalid - */ - - public LinearLatentStateCalibrator ( - final org.drip.spline.params.SegmentCustomBuilderControl scbc, - final org.drip.spline.stretch.BoundarySettings bs, - final int iCalibrationDetail, - final org.drip.spline.params.StretchBestFitResponse sbfr, - final org.drip.spline.params.StretchBestFitResponse sbfrSensitivity) - throws java.lang.Exception - { - super ("", scbc, bs, iCalibrationDetail, sbfr, sbfrSensitivity); - } - - /** - * Calibrate the Span from the Instruments in the Stretches and their Details. - * - * @param aStretchSpec The Stretch Sequence constituting the Span - * @param dblEpochResponse Segment Sequence Left-most Response Value - * @param valParams Valuation Parameter - * @param pricerParams Pricer Parameter - * @param vcp The Valuation Customization Parameters - * @param csqs The Market Parameters Surface and Quote - * - * @return Instance of the Latent State Span - */ - - public org.drip.spline.grid.OverlappingStretchSpan calibrateSpan ( - final org.drip.state.inference.LatentStateStretchSpec[] aStretchSpec, - final double dblEpochResponse, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.valuation.ValuationCustomizationParams vcp, - final org.drip.param.market.CurveSurfaceQuoteContainer csqs) - { - if (null == aStretchSpec || null == valParams) return null; - - int iNumStretch = aStretchSpec.length; - org.drip.spline.grid.OverlappingStretchSpan oss = null; - - if (0 == iNumStretch) return null; - - for (org.drip.state.inference.LatentStateStretchSpec stretchSpec : aStretchSpec) { - if (null == stretchSpec) continue; - - org.drip.state.inference.LatentStateSegmentSpec[] aSegmentSpec = stretchSpec.segmentSpec(); - - int iNumCalibComp = aSegmentSpec.length; - org.drip.state.estimator.CurveStretch cs = null; - double[] adblPredictorOrdinate = new double[iNumCalibComp + 1]; - org.drip.spline.params.SegmentCustomBuilderControl[] aSCBC = new - org.drip.spline.params.SegmentCustomBuilderControl[iNumCalibComp]; - - for (int i = 0; i <= iNumCalibComp; ++i) { - adblPredictorOrdinate[i] = 0 == i ? valParams.valueDate() : - aSegmentSpec[i - 1].component().maturityDate().julian(); - - if (i != iNumCalibComp) aSCBC[i] = segmentBuilderControl (stretchSpec.name()); - } - - try { - cs = new org.drip.state.estimator.CurveStretch (stretchSpec.name(), - org.drip.spline.stretch.MultiSegmentSequenceBuilder.CreateSegmentSet - (adblPredictorOrdinate, aSCBC), aSCBC); - - if (!cs.setup (new org.drip.state.inference.LatentStateSequenceBuilder (dblEpochResponse, - stretchSpec, valParams, pricerParams, csqs, vcp, oss, bestFitWeightedResponse(), new - org.drip.analytics.support.CaseInsensitiveHashMap(), - bestFitWeightedResponseSensitivity(), calibrationBoundaryCondition()), - calibrationDetail())) { - System.out.println ("\tMSS Setup Failed!"); - - return null; - } - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (null == oss) { - try { - oss = new org.drip.spline.grid.OverlappingStretchSpan (cs); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } else { - if (!oss.addStretch (cs)) return null; - } - } - - return oss; - } -} diff --git a/org/drip/state/nonlinear/FlatForwardDiscountCurve.java b/org/drip/state/nonlinear/FlatForwardDiscountCurve.java deleted file mode 100644 index 13b4556..0000000 --- a/org/drip/state/nonlinear/FlatForwardDiscountCurve.java +++ /dev/null @@ -1,467 +0,0 @@ - -package org.drip.state.nonlinear; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * FlatForwardDiscountCurve manages the Discounting Latent State, using the Forward Rate as the State - * Response Representation. It exports the following functionality: - * - Boot Methods - Set/Bump Specific Node Quantification Metric, or Set Flat Value - * - Boot Calibration - Initialize Run, Compute Calibration Metric - * - Compute the discount factor, forward rate, or the zero rate from the Forward Rate Latent State - * - Create a ForwardRateEstimator instance for the given Index - * - Retrieve Array of the Calibration Components - * - Retrieve the Curve Construction Input Set - * - Compute the Jacobian of the Discount Factor Latent State to the input Quote - * - Synthesize scenario Latent State by parallel shifting/custom tweaking the quantification metric - * - Synthesize scenario Latent State by parallel/custom shifting/custom tweaking the manifest measure - * - * @author Lakshmi Krishnamurthy - */ - -public class FlatForwardDiscountCurve extends org.drip.state.discount.ExplicitBootDiscountCurve { - private int _aiDate[] = null; - private int _iCompoundingFreq = -1; - private double _adblForwardRate[] = null; - private boolean _bDiscreteCompounding = false; - private java.lang.String _strCompoundingDayCount = ""; - - private double yearFract ( - final int iStartDate, - final int iEndDate) - throws java.lang.Exception - { - return _bDiscreteCompounding ? org.drip.analytics.daycount.Convention.YearFraction (iStartDate, - iEndDate, _strCompoundingDayCount, false, null, currency()) : 1. * (iEndDate - iStartDate) / - 365.25; - } - - private FlatForwardDiscountCurve shiftManifestMeasure ( - final double[] adblShift) - { - if (!org.drip.quant.common.NumberUtil.IsValid (adblShift) || null == _ccis) return null; - - org.drip.product.definition.CalibratableComponent[] aCalibInst = _ccis.components(); - - org.drip.param.valuation.ValuationParams valParam = _ccis.valuationParameter(); - - org.drip.param.valuation.ValuationCustomizationParams quotingParam = _ccis.quotingParameter(); - - org.drip.analytics.support.CaseInsensitiveTreeMap> - mapQuote = _ccis.quoteMap(); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapMeasures = - _ccis.measures(); - - org.drip.param.market.LatentStateFixingsContainer lsfc = _ccis.fixing(); - - int iNumComp = aCalibInst.length; - - if (adblShift.length != iNumComp) return null; - - try { - FlatForwardDiscountCurve ffdc = new FlatForwardDiscountCurve (new - org.drip.analytics.date.JulianDate (_iEpochDate), _strCurrency, _aiDate, _adblForwardRate, - _bDiscreteCompounding, _strCompoundingDayCount, _iCompoundingFreq); - - for (int i = 0; i < iNumComp; ++i) { - java.lang.String strInstrumentCode = aCalibInst[i].primaryCode(); - - org.drip.analytics.support.CaseInsensitiveTreeMap mapInstrumentQuote = - mapQuote.get (aCalibInst[i].primaryCode()); - - java.lang.String strCalibMeasure = mapMeasures.get (strInstrumentCode)[0]; - - if (null == mapInstrumentQuote || !mapInstrumentQuote.containsKey (strCalibMeasure)) - return null; - - org.drip.state.nonlinear.NonlinearCurveBuilder.DiscountCurveNode (valParam, aCalibInst[i], - mapInstrumentQuote.get (strCalibMeasure) + adblShift[i], strCalibMeasure, false, i, ffdc, - null, lsfc, quotingParam); - } - - return ffdc.setCCIS (new org.drip.analytics.input.BootCurveConstructionInput (valParam, - quotingParam, aCalibInst, mapQuote, mapMeasures, lsfc)) ? ffdc : null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Boot-strap a constant forward discount curve from an array of dates and discount rates - * - * @param dtStart Epoch Date - * @param strCurrency Currency - * @param aiDate Array of Dates - * @param adblForwardRate Array of Forward Rates - * @param bDiscreteCompounding TRUE - Compounding is Discrete - * @param strCompoundingDayCount Day Count Convention to be used for Discrete Compounding - * @param iCompoundingFreq Frequency to be used for Discrete Compounding - * - * @throws java.lang.Exception Thrown if the curve cannot be created - */ - - public FlatForwardDiscountCurve ( - final org.drip.analytics.date.JulianDate dtStart, - final java.lang.String strCurrency, - final int[] aiDate, - final double[] adblForwardRate, - final boolean bDiscreteCompounding, - final java.lang.String strCompoundingDayCount, - final int iCompoundingFreq) - throws java.lang.Exception - { - super (dtStart.julian(), strCurrency); - - if (null == aiDate || null == adblForwardRate) - throw new java.lang.Exception ("FlatForwardDiscountCurve ctr: Invalid inputs"); - - int iNumDate = aiDate.length; - - if (0 == iNumDate || iNumDate != adblForwardRate.length) - throw new java.lang.Exception ("FlatForwardDiscountCurve ctr: Invalid inputs"); - - _aiDate = new int[iNumDate]; - _iCompoundingFreq = iCompoundingFreq; - _adblForwardRate = new double[iNumDate]; - _bDiscreteCompounding = bDiscreteCompounding; - _strCompoundingDayCount = strCompoundingDayCount; - - for (int i = 0; i < iNumDate; ++i) { - _aiDate[i] = aiDate[i]; - _adblForwardRate[i] = adblForwardRate[i]; - } - } - - protected FlatForwardDiscountCurve ( - final FlatForwardDiscountCurve dc) - throws java.lang.Exception - { - super (dc.epoch().julian(), dc.currency()); - - _aiDate = dc._aiDate; - _strCurrency = dc._strCurrency; - _iEpochDate = dc._iEpochDate; - _adblForwardRate = dc._adblForwardRate; - _iCompoundingFreq = dc._iCompoundingFreq; - _bDiscreteCompounding = dc._bDiscreteCompounding; - _strCompoundingDayCount = dc._strCompoundingDayCount; - } - - @Override public double df ( - final int iDate) - throws java.lang.Exception - { - if (iDate <= _iEpochDate) return 1.; - - int i = 0; - double dblDF = 1.; - double dblExpArg = 0.; - int iStartDate = _iEpochDate; - int iNumDate = _aiDate.length; - - while (i < iNumDate && (int) iDate >= (int) _aiDate[i]) { - if (_bDiscreteCompounding) - dblDF *= java.lang.Math.pow (1. + (_adblForwardRate[i] / _iCompoundingFreq), -1. * yearFract - (iStartDate, _aiDate[i]) * _iCompoundingFreq); - else - dblExpArg -= _adblForwardRate[i] * yearFract (iStartDate, _aiDate[i]); - - iStartDate = _aiDate[i++]; - } - - if (i >= iNumDate) i = iNumDate - 1; - - if (_bDiscreteCompounding) - dblDF *= java.lang.Math.pow (1. + (_adblForwardRate[i] / _iCompoundingFreq), -1. * yearFract - (iStartDate, iDate) * _iCompoundingFreq); - else - dblExpArg -= _adblForwardRate[i] * yearFract (iStartDate, iDate); - - return (_bDiscreteCompounding ? dblDF : java.lang.Math.exp (dblExpArg)) * turnAdjust (_iEpochDate, - iDate); - } - - @Override public double forward ( - final int iDate1, - final int iDate2) - throws java.lang.Exception - { - int iStartDate = epoch().julian(); - - if (iDate1 < iStartDate || iDate2 < iStartDate) return 0.; - - return 365.25 / (iDate2 - iDate1) * java.lang.Math.log (df (iDate1) / df (iDate2)); - } - - @Override public double zero ( - final int iDate) - throws java.lang.Exception - { - double iStartDate = epoch().julian(); - - if (iDate < iStartDate) return 0.; - - return -365.25 / (iDate - iStartDate) * java.lang.Math.log (df (iDate)); - } - - @Override public org.drip.state.forward.ForwardRateEstimator forwardRateEstimator ( - final int iDate, - final org.drip.state.identifier.ForwardLabel fri) - { - return null; - } - - @Override public java.util.Map canonicalTruthness ( - final java.lang.String strLatentQuantificationMetric) - { - return null; - } - - @Override public FlatForwardDiscountCurve parallelShiftManifestMeasure ( - final java.lang.String strManifestMeasure, - final double dblShift) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblShift) || null == _ccis) return null; - - org.drip.product.definition.CalibratableComponent[] aCalibInst = _ccis.components(); - - int iNumComp = aCalibInst.length; - double[] adblShift = new double[iNumComp]; - - for (int i = 0; i < iNumComp; ++i) - adblShift[i] = dblShift; - - return shiftManifestMeasure (adblShift); - } - - @Override public FlatForwardDiscountCurve shiftManifestMeasure ( - final int iSpanIndex, - final java.lang.String strManifestMeasure, - final double dblShift) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblShift) || null == _ccis) return null; - - org.drip.product.definition.CalibratableComponent[] aCalibInst = _ccis.components(); - - int iNumComp = aCalibInst.length; - double[] adblShift = new double[iNumComp]; - - if (iSpanIndex >= iNumComp) return null; - - for (int i = 0; i < iNumComp; ++i) - adblShift[i] = i == iSpanIndex ? dblShift : 0.; - - return shiftManifestMeasure (adblShift); - } - - @Override public org.drip.state.discount.ExplicitBootDiscountCurve customTweakManifestMeasure ( - final java.lang.String strManifestMeasure, - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - return shiftManifestMeasure (org.drip.analytics.support.Helper.TweakManifestMeasure - (_adblForwardRate, rvtp)); - } - - @Override public FlatForwardDiscountCurve parallelShiftQuantificationMetric ( - final double dblShift) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblShift)) return null; - - int iNumDate = _adblForwardRate.length; - double[] adblForwardRate = new double[iNumDate]; - - for (int i = 0; i < iNumDate; ++i) - adblForwardRate[i] = _adblForwardRate[i] + dblShift; - - try { - return new FlatForwardDiscountCurve (new org.drip.analytics.date.JulianDate (_iEpochDate), - _strCurrency, _aiDate, adblForwardRate, _bDiscreteCompounding, _strCompoundingDayCount, - _iCompoundingFreq); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.analytics.definition.Curve customTweakQuantificationMetric ( - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - try { - return new FlatForwardDiscountCurve (new org.drip.analytics.date.JulianDate (_iEpochDate), - _strCurrency, _aiDate, org.drip.analytics.support.Helper.TweakManifestMeasure - (_adblForwardRate, rvtp), _bDiscreteCompounding, _strCompoundingDayCount, - _iCompoundingFreq); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public FlatForwardDiscountCurve createBasisRateShiftedCurve ( - final int[] aiDate, - final double[] adblBasis) - { - if (null == aiDate || null == adblBasis) return null; - - int iNumDate = aiDate.length; - - if (0 == iNumDate || iNumDate != adblBasis.length) return null; - - double[] adblShiftedRate = new double[iNumDate]; - - try { - for (int i = 0; i < aiDate.length; ++i) - adblShiftedRate[i] = zero (aiDate[i]) + adblBasis[i]; - - return new FlatForwardDiscountCurve (new org.drip.analytics.date.JulianDate (_iEpochDate), - _strCurrency, aiDate, adblShiftedRate, _bDiscreteCompounding, _strCompoundingDayCount, - _iCompoundingFreq); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public java.lang.String latentStateQuantificationMetric() - { - return org.drip.analytics.definition.LatentStateStatic.DISCOUNT_QM_ZERO_RATE; - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDDFDManifestMeasure ( - final int iDate, - final java.lang.String strManifestMeasure) - { - if (!org.drip.quant.common.NumberUtil.IsValid (iDate)) return null; - - int i = 0; - double dblDF = java.lang.Double.NaN; - double iStartDate = _iEpochDate; - org.drip.quant.calculus.WengertJacobian wj = null; - - try { - wj = new org.drip.quant.calculus.WengertJacobian (1, _adblForwardRate.length); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - if (iDate <= _iEpochDate) { - if (!wj.setWengert (0, 0.)) return null; - - return wj; - } - - try { - if (!wj.setWengert (0, dblDF = df (iDate))) return null; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - while (i < _adblForwardRate.length && (int) iDate >= (int) _aiDate[i]) { - if (!wj.accumulatePartialFirstDerivative (0, i, dblDF * (iStartDate - _aiDate[i]) / 365.25)) - return null; - - iStartDate = _aiDate[i++]; - } - - if (i >= _adblForwardRate.length) i = _adblForwardRate.length - 1; - - return wj.accumulatePartialFirstDerivative (0, i, dblDF * (iStartDate - iDate) / 365.25) ? wj : - null; - } - - @Override public boolean setNodeValue ( - final int iNodeIndex, - final double dblValue) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblValue) || iNodeIndex > _adblForwardRate.length) - return false; - - for (int i = iNodeIndex; i < _adblForwardRate.length; ++i) - _adblForwardRate[i] = dblValue; - - return true; - } - - @Override public boolean bumpNodeValue ( - final int iNodeIndex, - final double dblValue) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblValue) || iNodeIndex > _adblForwardRate.length) - return false; - - for (int i = iNodeIndex; i < _adblForwardRate.length; ++i) - _adblForwardRate[i] += dblValue; - - return true; - } - - @Override public boolean setFlatValue ( - final double dblValue) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblValue)) return false; - - for (int i = 0; i < _adblForwardRate.length; ++i) - _adblForwardRate[i] = dblValue; - - return true; - } -} diff --git a/org/drip/state/nonlinear/FlatForwardFXCurve.java b/org/drip/state/nonlinear/FlatForwardFXCurve.java deleted file mode 100644 index f848e5d..0000000 --- a/org/drip/state/nonlinear/FlatForwardFXCurve.java +++ /dev/null @@ -1,326 +0,0 @@ - -package org.drip.state.nonlinear; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FlatForwardVolatilityCurve manages the Volatility Latent State, using the Forward Volatility as the State - * Response Representation. - * - * @author Lakshmi Krishnamurthy - */ - -public class FlatForwardFXCurve extends org.drip.state.fx.ExplicitBootFXCurve { - private int[] _aiPillarDate = null; - private double[] _adblFXForward = null; - private double _dblFXSpot = java.lang.Double.NaN; - - private double nodeBasis ( - final int iNodeDate, - final org.drip.param.valuation.ValuationParams valParam, - final org.drip.state.discount.MergedDiscountForwardCurve dcNum, - final org.drip.state.discount.MergedDiscountForwardCurve dcDenom, - final boolean bBasisOnDenom) - throws java.lang.Exception - { - return new org.drip.product.fx.FXForwardComponent ("FXFWD_" + - org.drip.quant.common.StringUtil.GUID(), currencyPair(), epoch().julian(), iNodeDate, 1., - null).discountCurveBasis (valParam, dcNum, dcDenom, _dblFXSpot, fx (iNodeDate), - bBasisOnDenom); - } - - /** - * FlatForwardVolatilityCurve Constructor - * - * @param iEpochDate Epoch Date - * @param cp Currency Pair - * @param dblFXSpot FX Spot - * @param aiPillarDate Array of the Pillar Dates - * @param adblFXForward Array of the corresponding FX Forward Nodes - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public FlatForwardFXCurve ( - final int iEpochDate, - final org.drip.product.params.CurrencyPair cp, - final double dblFXSpot, - final int[] aiPillarDate, - final double[] adblFXForward) - throws java.lang.Exception - { - super (iEpochDate, cp); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblFXSpot = dblFXSpot) || null == (_aiPillarDate = - aiPillarDate) || null == (_adblFXForward = adblFXForward) || _aiPillarDate.length != - _adblFXForward.length) - throw new java.lang.Exception ("FlatForwardFXCurve ctr => Invalid Inputs"); - - int iNumPillar = _aiPillarDate.length; - - for (int i = 0; i < iNumPillar; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (_adblFXForward[i])) - throw new java.lang.Exception ("FlatForwardFXCurve ctr => Invalid Inputs"); - } - } - - @Override public double fx ( - final int iDate) - throws java.lang.Exception - { - if (iDate <= _iEpochDate) return _adblFXForward[0]; - - int iNumPillar = _adblFXForward.length; - - for (int i = 1; i < iNumPillar; ++i) { - if (_aiPillarDate[i - 1] <= iDate && _aiPillarDate[i] > iDate) return _adblFXForward[i]; - } - - return _adblFXForward[iNumPillar - 1]; - } - - /** - * Retrieve the FX Spot - * - * @return The FX Spot - */ - - public double fxSpot() - { - return _dblFXSpot; - } - - @Override public double[] zeroBasis ( - final int[] aiDateNode, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.discount.MergedDiscountForwardCurve dcNum, - final org.drip.state.discount.MergedDiscountForwardCurve dcDenom, - final boolean bBasisOnDenom) - { - if (null == aiDateNode) return null; - - int iNumBasis = aiDateNode.length; - double[] adblBasis = new double[iNumBasis]; - - if (0 == iNumBasis) return null; - - for (int i = 0; i < iNumBasis; ++i) { - try { - adblBasis[i] = nodeBasis (aiDateNode[i], valParams, dcNum, dcDenom, bBasisOnDenom); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return adblBasis; - } - - @Override public double[] impliedNodeRates ( - final int[] aiDateNode, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.discount.MergedDiscountForwardCurve dcNum, - final org.drip.state.discount.MergedDiscountForwardCurve dcDenom, - final boolean bBasisOnDenom) - { - if (null == aiDateNode) return null; - - int iNumBasis = aiDateNode.length; - double[] adblImpliedNodeRate = new double[iNumBasis]; - - if (0 == iNumBasis) return null; - - for (int i = 0; i < iNumBasis; ++i) { - try { - double dblBaseImpliedRate = java.lang.Double.NaN; - - if (bBasisOnDenom) - dblBaseImpliedRate = dcNum.zero (aiDateNode[i]); - else - dblBaseImpliedRate = dcDenom.zero (aiDateNode[i]); - - adblImpliedNodeRate[i] = dblBaseImpliedRate + nodeBasis (i, valParams, dcNum, dcDenom, - bBasisOnDenom); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - } - - return adblImpliedNodeRate; - } - - @Override public double[] bootstrapBasis ( - final int[] aiDateNode, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.discount.MergedDiscountForwardCurve dcNum, - final org.drip.state.discount.MergedDiscountForwardCurve dcDenom, - final boolean bBasisOnDenom) - { - if (null == aiDateNode) return null; - - int iNumBasis = aiDateNode.length; - double[] adblBasis = new double[iNumBasis]; - org.drip.state.discount.MergedDiscountForwardCurve dcBasis = bBasisOnDenom ? dcDenom : dcNum; - - if (0 == iNumBasis || null == dcBasis) return null; - - for (int i = 0; i < iNumBasis; ++i) { - try { - if (bBasisOnDenom) - adblBasis[i] = nodeBasis (aiDateNode[i], valParams, dcNum, dcBasis, true); - else - adblBasis[i] = nodeBasis (aiDateNode[i], valParams, dcBasis, dcDenom, false); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - return adblBasis; - } - - @Override public org.drip.state.discount.MergedDiscountForwardCurve bootstrapBasisDC ( - final int[] aiDateNode, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.discount.MergedDiscountForwardCurve dcNum, - final org.drip.state.discount.MergedDiscountForwardCurve dcDenom, - final boolean bBasisOnDenom) - { - double[] adblImpliedRate = impliedNodeRates (aiDateNode, valParams, dcNum, dcDenom, bBasisOnDenom); - - if (null == adblImpliedRate) return null; - - int iNumDF = adblImpliedRate.length; - double[] adblDF = new double[iNumDF]; - org.drip.state.discount.MergedDiscountForwardCurve dc = bBasisOnDenom ? dcDenom : dcNum; - - if (0 == iNumDF) return null; - - int iSpotDate = valParams.valueDate(); - - java.lang.String strCurrency = dc.currency(); - - for (int i = 0; i < iNumDF; ++i) - adblDF[i] = java.lang.Math.exp (-1. * adblImpliedRate[i] * (aiDateNode[i] - iSpotDate) / - 365.25); - - try { - return org.drip.state.creator.ScenarioDiscountCurveBuilder.CubicPolynomialDiscountCurve - (strCurrency + "::BASIS", new org.drip.analytics.date.JulianDate (iSpotDate), strCurrency, - aiDateNode, adblDF); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public double rate ( - final int[] aiDateNode, - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.state.discount.MergedDiscountForwardCurve dcNum, - final org.drip.state.discount.MergedDiscountForwardCurve dcDenom, - final int iDate, - final boolean bBasisOnDenom) - throws java.lang.Exception - { - org.drip.state.discount.MergedDiscountForwardCurve dcImplied = bootstrapBasisDC (aiDateNode, valParams, dcNum, - dcDenom, bBasisOnDenom); - - if (null == dcImplied) - throw new java.lang.Exception ("BasisSplineFXForward::rate: Cannot imply basis DC!"); - - return dcImplied.zero (iDate); - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDForwardDManifestMeasure ( - final java.lang.String strManifestMeasure, - final int iDate) - { - return null; - } - - @Override public boolean setNodeValue ( - final int iNodeIndex, - final double dblValue) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblValue) || iNodeIndex > _adblFXForward.length) - return false; - - for (int i = iNodeIndex; i < _adblFXForward.length; ++i) - _adblFXForward[i] = dblValue; - - return true; - } - - @Override public boolean bumpNodeValue ( - final int iNodeIndex, - final double dblValue) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblValue) || iNodeIndex > _adblFXForward.length) - return false; - - for (int i = iNodeIndex; i < _adblFXForward.length; ++i) - _adblFXForward[i] += dblValue; - - return true; - } - - @Override public boolean setFlatValue ( - final double dblValue) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblValue)) return false; - - for (int i = 0; i < _adblFXForward.length; ++i) - _adblFXForward[i] = dblValue; - - return true; - } -} diff --git a/org/drip/state/nonlinear/FlatForwardForwardCurve.java b/org/drip/state/nonlinear/FlatForwardForwardCurve.java deleted file mode 100644 index 08744eb..0000000 --- a/org/drip/state/nonlinear/FlatForwardForwardCurve.java +++ /dev/null @@ -1,97 +0,0 @@ - -package org.drip.state.nonlinear; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * FlatForwardForwardCurve contains an implementation of the flat forward rate forward curve. - * - * @author Lakshmi Krishnamurthy - */ - -public class FlatForwardForwardCurve extends org.drip.state.forward.ForwardCurve { - private double _dblFlatForwardRate = java.lang.Double.NaN; - - /** - * FlatForwardForwardCurve constructor - * - * @param dtEpoch The Forward Curve Epoch Date - * @param fri The Floating Rate Index - * @param dblFlatForwardRate The Flat FOrward Rate - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public FlatForwardForwardCurve ( - final org.drip.analytics.date.JulianDate dtEpoch, - final org.drip.state.identifier.ForwardLabel fri, - final double dblFlatForwardRate) - throws java.lang.Exception - { - super (dtEpoch.julian(), fri); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblFlatForwardRate = dblFlatForwardRate)) - throw new java.lang.Exception ("FlatForwardForwardCurve ctr: Invalid Inputs"); - } - - @Override public double forward ( - final int iDate) - throws java.lang.Exception - { - return _dblFlatForwardRate; - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDForwardDManifestMeasure ( - final java.lang.String strManifestMeasure, - final int iDate) - { - return null; - } -} diff --git a/org/drip/state/nonlinear/FlatForwardRepoCurve.java b/org/drip/state/nonlinear/FlatForwardRepoCurve.java deleted file mode 100644 index 9209be6..0000000 --- a/org/drip/state/nonlinear/FlatForwardRepoCurve.java +++ /dev/null @@ -1,150 +0,0 @@ - -package org.drip.state.nonlinear; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FlatForwardRepoCurve manages the Repo Latent State, using the Forward Repo Rate as the State Response - * Representation. - * - * @author Lakshmi Krishnamurthy - */ - -public class FlatForwardRepoCurve extends org.drip.state.repo.ExplicitBootRepoCurve { - private int[] _aiPillarDate = null; - private double[] _adblRepoForward = null; - - /** - * FlatForwardRepoCurve Constructor - * - * @param iEpochDate Epoch Date - * @param comp The Repo Component - * @param aiPillarDate Array of Pillar Dates - * @param adblRepoForward Array of Repo Forward Rates - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public FlatForwardRepoCurve ( - final int iEpochDate, - final org.drip.product.definition.Component comp, - final int[] aiPillarDate, - final double[] adblRepoForward) - throws java.lang.Exception - { - super (iEpochDate, comp); - - if (null == (_aiPillarDate = aiPillarDate) || null == (_adblRepoForward = adblRepoForward) || - _aiPillarDate.length != _adblRepoForward.length) - throw new java.lang.Exception ("FlatForwardRepoCurve ctr => Invalid Inputs"); - - int iNumPillar = _aiPillarDate.length; - - for (int i = 0; i < iNumPillar; ++i) { - if (!org.drip.quant.common.NumberUtil.IsValid (_aiPillarDate[i]) || - !org.drip.quant.common.NumberUtil.IsValid (_adblRepoForward[i])) - throw new java.lang.Exception ("FlatForwardRepoCurve ctr => Invalid Inputs"); - } - } - - @Override public double repo ( - final int iDate) - throws java.lang.Exception - { - if (iDate >= component().maturityDate().julian()) - throw new java.lang.Exception ("FlatForwardRepoCurve::repo => Invalid Input"); - - if (iDate <= epoch().julian()) return _adblRepoForward[0]; - - int iNumPillar = _adblRepoForward.length; - - for (int i = 1; i < iNumPillar; ++i) { - if (_aiPillarDate[i - 1] <= iDate && _aiPillarDate[i] > iDate) - return _adblRepoForward[i]; - } - - return _adblRepoForward[iNumPillar - 1]; - } - - @Override public boolean setNodeValue ( - final int iNodeIndex, - final double dblValue) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblValue) || iNodeIndex > _adblRepoForward.length) - return false; - - for (int i = iNodeIndex; i < _adblRepoForward.length; ++i) - _adblRepoForward[i] = dblValue; - - return true; - } - - @Override public boolean bumpNodeValue ( - final int iNodeIndex, - final double dblValue) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblValue) || iNodeIndex > _adblRepoForward.length) - return false; - - for (int i = iNodeIndex; i < _adblRepoForward.length; ++i) - _adblRepoForward[i] += dblValue; - - return true; - } - - @Override public boolean setFlatValue ( - final double dblValue) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblValue)) return false; - - for (int i = 0; i < _adblRepoForward.length; ++i) - _adblRepoForward[i] = dblValue; - - return true; - } -} diff --git a/org/drip/state/nonlinear/FlatForwardVolatilityCurve.java b/org/drip/state/nonlinear/FlatForwardVolatilityCurve.java deleted file mode 100644 index ee5771b..0000000 --- a/org/drip/state/nonlinear/FlatForwardVolatilityCurve.java +++ /dev/null @@ -1,179 +0,0 @@ - -package org.drip.state.nonlinear; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FlatForwardVolatilityCurve manages the Volatility Latent State, using the Forward Volatility as the State - * Response Representation. - * - * @author Lakshmi Krishnamurthy - */ - -public class FlatForwardVolatilityCurve extends org.drip.state.volatility.ExplicitBootVolatilityCurve { - private int[] _aiPillarDate = null; - private double[] _adblImpliedVolatility = null; - - /** - * FlatForwardVolatilityCurve Constructor - * - * @param iEpochDate Epoch Date - * @param label Volatility Label - * @param strCurrency Currency - * @param aiPillarDate Array of the Pillar Dates - * @param adblImpliedVolatility Array of the corresponding Implied Volatility Nodes - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public FlatForwardVolatilityCurve ( - final int iEpochDate, - final org.drip.state.identifier.VolatilityLabel label, - final java.lang.String strCurrency, - final int[] aiPillarDate, - final double[] adblImpliedVolatility) - throws java.lang.Exception - { - super (iEpochDate, label, strCurrency); - - if (null == (_aiPillarDate = aiPillarDate) || null == (_adblImpliedVolatility = - adblImpliedVolatility)) - throw new java.lang.Exception ("FlatForwardVolatilityCurve ctr => Invalid Inputs"); - - int iNumPillar = _aiPillarDate.length; - - if (0 == iNumPillar || iNumPillar != _adblImpliedVolatility.length) - throw new java.lang.Exception ("FlatForwardVolatilityCurve ctr => Invalid Inputs"); - } - - @Override public double impliedVol ( - final int iDate) - throws java.lang.Exception - { - if (iDate <= _aiPillarDate[0]) return _adblImpliedVolatility[0]; - - int iNumPillar = _adblImpliedVolatility.length; - - for (int i = 1; i < iNumPillar; ++i) { - if (_aiPillarDate[i - 1] <= iDate && _aiPillarDate[i] >= iDate) - return _adblImpliedVolatility[i]; - } - - return _adblImpliedVolatility[iNumPillar - 1]; - } - - @Override public double node ( - final int iDate) - throws java.lang.Exception - { - return 0.; - } - - @Override public double vol ( - final int iDate) - throws java.lang.Exception - { - return node (iDate); - } - - @Override public double nodeDerivative ( - final int iDate, - final int iOrder) - throws java.lang.Exception - { - org.drip.function.definition.R1ToR1 au = new org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - double dblX) - throws java.lang.Exception - { - return node ((int) dblX); - } - }; - - return au.derivative (iDate, iOrder); - } - - @Override public boolean setNodeValue ( - final int iNodeIndex, - final double dblValue) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblValue) || iNodeIndex > - _adblImpliedVolatility.length) - return false; - - for (int i = iNodeIndex; i < _adblImpliedVolatility.length; ++i) - _adblImpliedVolatility[i] = dblValue; - - return true; - } - - @Override public boolean bumpNodeValue ( - final int iNodeIndex, - final double dblValue) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblValue) || iNodeIndex > - _adblImpliedVolatility.length) - return false; - - for (int i = iNodeIndex; i < _adblImpliedVolatility.length; ++i) - _adblImpliedVolatility[i] += dblValue; - - return true; - } - - @Override public boolean setFlatValue ( - final double dblValue) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblValue)) return false; - - for (int i = 0; i < _adblImpliedVolatility.length; ++i) - _adblImpliedVolatility[i] = dblValue; - - return true; - } -} diff --git a/org/drip/state/nonlinear/FlatYieldGovvieCurve.java b/org/drip/state/nonlinear/FlatYieldGovvieCurve.java deleted file mode 100644 index 9e2efb2..0000000 --- a/org/drip/state/nonlinear/FlatYieldGovvieCurve.java +++ /dev/null @@ -1,158 +0,0 @@ - -package org.drip.state.nonlinear; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 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. - */ - -/** - * FlatYieldGovvieCurve manages the Govvie Latent State, using the Flat Yield as the State Response - * Representation. - * - * @author Lakshmi Krishnamurthy - */ - -public class FlatYieldGovvieCurve extends org.drip.state.govvie.ExplicitBootGovvieCurve { - private int[] _aiDate = null; - private double[] _adblYield = null; - - /** - * Construct a Govvie curve from an array of dates and Yields - * - * @param iEpochDate Epoch Date - * @param strTreasuryCode Treasury Code - * @param strCurrency Currency - * @param aiDate Array of Dates - * @param adblYield Array of Yields - * - * @throws java.lang.Exception Thrown if the curve cannot be created - */ - - public FlatYieldGovvieCurve ( - final int iEpochDate, - final java.lang.String strTreasuryCode, - final java.lang.String strCurrency, - final int[] aiDate, - final double[] adblYield) - throws java.lang.Exception - { - super (iEpochDate, strTreasuryCode, strCurrency); - - if (null == (_aiDate = aiDate) || null == (_adblYield = adblYield)) - throw new java.lang.Exception ("FlatYieldGovvieCurve Constructor => Invalid Inputs!"); - - int iNumNode = _aiDate.length; - - if (0 == iNumNode || iNumNode != _adblYield.length) - throw new java.lang.Exception ("FlatYieldGovvieCurve Constructor => Invalid Inputs!"); - } - - @Override public double yield ( - final int iDate) - throws java.lang.Exception - { - if (iDate <= _iEpochDate) return _adblYield[0]; - - int iNumDate = _aiDate.length; - - for (int i = 1; i < iNumDate; ++i) { - if (iDate > _aiDate[i - 1] && iDate <= _aiDate[i]) return _adblYield[i]; - } - - return _adblYield[iNumDate - 1]; - } - - @Override public boolean setNodeValue ( - final int iNodeIndex, - final double dblValue) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblValue)) return false; - - int iNumDate = _aiDate.length; - - if (iNodeIndex > iNumDate) return false; - - for (int i = iNodeIndex; i < iNumDate; ++i) - _adblYield[i] = dblValue; - - return true; - } - - @Override public boolean bumpNodeValue ( - final int iNodeIndex, - final double dblValue) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblValue)) return false; - - int iNumDate = _aiDate.length; - - if (iNodeIndex > iNumDate) return false; - - for (int i = iNodeIndex; i < iNumDate; ++i) - _adblYield[i] += dblValue; - - return true; - } - - @Override public boolean setFlatValue ( - final double dblValue) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblValue)) return false; - - int iNumDate = _aiDate.length; - - for (int i = 0; i < iNumDate; ++i) - _adblYield[i] = dblValue; - - return true; - } - - @Override public org.drip.quant.calculus.WengertJacobian jackDForwardDManifestMeasure ( - final java.lang.String strManifestMeasure, - final int iDate) - { - return null; - } -} diff --git a/org/drip/state/nonlinear/ForwardHazardCreditCurve.java b/org/drip/state/nonlinear/ForwardHazardCreditCurve.java deleted file mode 100644 index 0c9a6ed..0000000 --- a/org/drip/state/nonlinear/ForwardHazardCreditCurve.java +++ /dev/null @@ -1,485 +0,0 @@ - -package org.drip.state.nonlinear; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * ForwardHazardCreditCurve manages the Survival Latent State, using the Hazard Rate as the State Response - * Representation. It exports the following functionality: - * - Boot Methods - Set/Bump Specific Node Quantification Metric, or Set Flat Value - * - Boot Calibration - Initialize Run, Compute Calibration Metric - * - Compute the survival probability, recovery rate, or the hazard rate from the Hazard Rate Latent State - * - Retrieve Array of the Calibration Components - * - Retrieve the Curve Construction Input Set - * - Synthesize scenario Latent State by parallel shifting/custom tweaking the quantification metric - * - Synthesize scenario Latent State by parallel/custom shifting/custom tweaking the manifest measure - * - * @author Lakshmi Krishnamurthy - */ - -public class ForwardHazardCreditCurve extends org.drip.state.credit.ExplicitBootCreditCurve { - private int[] _aiHazardDate = null; - private int[] _aiRecoveryDate = null; - private double[] _adblHazardRate = null; - private double[] _adblRecoveryRate = null; - - private org.drip.state.credit.CreditCurve createFromBaseMMTP ( - final org.drip.param.definition.ManifestMeasureTweak mmtp) - { - double[] adblHazardBumped = org.drip.analytics.support.Helper.TweakManifestMeasure - (_adblHazardRate, mmtp); - - if (null == adblHazardBumped || _adblHazardRate.length != adblHazardBumped.length) return null; - - try { - return new ForwardHazardCreditCurve (_iEpochDate, _label, _strCurrency, adblHazardBumped, - _aiHazardDate, _adblRecoveryRate, _aiRecoveryDate, _iSpecificDefaultDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Create a credit curve from hazard rate and recovery rate term structures - * - * @param iStartDate Curve Epoch date - * @param label Credit Curve Label - * @param strCurrency Currency - * @param adblHazardRate Matched array of hazard rates - * @param aiHazardDate Matched array of hazard dates - * @param adblRecoveryRate Matched array of recovery rates - * @param aiRecoveryDate Matched array of recovery dates - * @param iSpecificDefaultDate (Optional) Specific Default Date - * - * @throws java.lang.Exception Thrown if inputs are invalid - */ - - public ForwardHazardCreditCurve ( - final int iStartDate, - final org.drip.state.identifier.CreditLabel label, - final java.lang.String strCurrency, - final double adblHazardRate[], - final int aiHazardDate[], - final double[] adblRecoveryRate, - final int[] aiRecoveryDate, - final int iSpecificDefaultDate) - throws java.lang.Exception - { - super (iStartDate, label, strCurrency); - - if (null == adblHazardRate || 0 == adblHazardRate.length || null == aiHazardDate || 0 == - aiHazardDate.length || adblHazardRate.length != aiHazardDate.length || null == - adblRecoveryRate || 0 == adblRecoveryRate.length || null == aiRecoveryDate || 0 == - aiRecoveryDate.length || adblRecoveryRate.length != aiRecoveryDate.length) - throw new java.lang.Exception ("ForwardHazardCreditCurve ctr: Invalid Params!"); - - _iSpecificDefaultDate = iSpecificDefaultDate; - _adblHazardRate = new double[adblHazardRate.length]; - _adblRecoveryRate = new double[adblRecoveryRate.length]; - _aiHazardDate = new int[aiHazardDate.length]; - _aiRecoveryDate = new int[aiRecoveryDate.length]; - - for (int i = 0; i < adblHazardRate.length; ++i) - _adblHazardRate[i] = adblHazardRate[i]; - - for (int i = 0; i < _aiHazardDate.length; ++i) - _aiHazardDate[i] = aiHazardDate[i]; - - for (int i = 0; i < adblRecoveryRate.length; ++i) - _adblRecoveryRate[i] = adblRecoveryRate[i]; - - for (int i = 0; i < aiRecoveryDate.length; ++i) - _aiRecoveryDate[i] = aiRecoveryDate[i]; - } - - @Override public double survival ( - final int iDate) - throws java.lang.Exception - { - if (iDate <= _iEpochDate) return 1.; - - if (java.lang.Integer.MIN_VALUE != _iSpecificDefaultDate && iDate >= _iSpecificDefaultDate) - return 0.; - - int i = 0; - double dblExpArg = 0.; - int iStartDate = _iEpochDate; - - while (i < _adblHazardRate.length && iDate > _aiHazardDate[i]) { - dblExpArg -= _adblHazardRate[i] * (_aiHazardDate[i] - iStartDate); - iStartDate = _aiHazardDate[i++]; - } - - if (i >= _adblHazardRate.length) i = _adblHazardRate.length - 1; - - dblExpArg -= _adblHazardRate[i] * (iDate - iStartDate); - - return java.lang.Math.exp (dblExpArg / 365.25); - } - - @Override public double recovery ( - final int iDate) - throws java.lang.Exception - { - for (int i = 0; i < _aiRecoveryDate.length; ++i) { - if (iDate < _aiRecoveryDate[i]) return _adblRecoveryRate[i]; - } - - return _adblRecoveryRate[_aiRecoveryDate.length - 1]; - } - - @Override public ForwardHazardCreditCurve parallelShiftQuantificationMetric ( - final double dblShift) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblShift)) return null; - - double[] adblHazard = new double[_adblHazardRate.length]; - - for (int i = 0; i < _adblHazardRate.length; ++i) - adblHazard[i] = _adblHazardRate[i] + dblShift; - - try { - return new ForwardHazardCreditCurve (_iEpochDate, _label, _strCurrency, adblHazard, - _aiHazardDate, _adblRecoveryRate, _aiRecoveryDate, _iSpecificDefaultDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - @Override public org.drip.analytics.definition.Curve customTweakQuantificationMetric ( - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - return null; - } - - @Override public ForwardHazardCreditCurve parallelShiftManifestMeasure ( - final java.lang.String strManifestMeasure, - final double dblShift) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblShift)) return null; - - if (null == _valParam || null == _aCalibInst || 0 == _aCalibInst.length || null == _adblCalibQuote || - 0 == _adblCalibQuote.length || null == _astrCalibMeasure || 0 == _astrCalibMeasure.length || - _astrCalibMeasure.length != _adblCalibQuote.length || _adblCalibQuote.length != - _aCalibInst.length) - return parallelShiftQuantificationMetric (dblShift); - - ForwardHazardCreditCurve cc = null; - double[] adblCalibQuote = new double[_adblCalibQuote.length]; - - try { - cc = new ForwardHazardCreditCurve (_iEpochDate, _label, _strCurrency, _adblHazardRate, - _aiHazardDate, _adblRecoveryRate, _aiRecoveryDate, _iSpecificDefaultDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int i = 0; i < _adblCalibQuote.length; ++i) { - try { - org.drip.state.nonlinear.NonlinearCurveBuilder.CreditCurve (_valParam, _aCalibInst[i], - adblCalibQuote[i] = _adblCalibQuote[i] + dblShift, _astrCalibMeasure[i], _bFlat, i, cc, - _dc, _gc, _pricerParam, _lsfc, _quotingParams); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - cc.setInstrCalibInputs (_valParam, _bFlat, _dc, _gc, _pricerParam, _aCalibInst, adblCalibQuote, - _astrCalibMeasure, _lsfc, _quotingParams); - - return cc; - } - - @Override public ForwardHazardCreditCurve shiftManifestMeasure ( - final int iSpanIndex, - final java.lang.String strManifestMeasure, - final double dblShift) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblShift)) return null; - - if (null == _valParam || null == _aCalibInst || 0 == _aCalibInst.length || null == _adblCalibQuote || - 0 == _adblCalibQuote.length || null == _astrCalibMeasure || 0 == _astrCalibMeasure.length || - _astrCalibMeasure.length != _adblCalibQuote.length || _adblCalibQuote.length != - _aCalibInst.length) - return parallelShiftQuantificationMetric (dblShift); - - ForwardHazardCreditCurve cc = null; - double[] adblCalibQuote = new double[_adblCalibQuote.length]; - - if (iSpanIndex >= _adblCalibQuote.length) return null; - - try { - cc = new ForwardHazardCreditCurve (_iEpochDate, _label, _strCurrency, _adblHazardRate, - _aiHazardDate, _adblRecoveryRate, _aiRecoveryDate, _iSpecificDefaultDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int i = 0; i < _adblCalibQuote.length; ++i) { - try { - org.drip.state.nonlinear.NonlinearCurveBuilder.CreditCurve (_valParam, _aCalibInst[i], - adblCalibQuote[i] = _adblCalibQuote[i] + (i == iSpanIndex ? dblShift : 0.), - _astrCalibMeasure[i], _bFlat, i, cc, _dc, _gc, _pricerParam, _lsfc, - _quotingParams); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - cc.setInstrCalibInputs (_valParam, _bFlat, _dc, _gc, _pricerParam, _aCalibInst, adblCalibQuote, - _astrCalibMeasure, _lsfc, _quotingParams); - - return cc; - } - - @Override public org.drip.state.credit.CreditCurve flatCurve ( - final double dblFlatNodeValue, - final boolean bSingleNode, - final double dblRecovery) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblFlatNodeValue) || 0. >= dblFlatNodeValue || null == - _valParam || null == _aCalibInst || 0 == _aCalibInst.length || null == _adblCalibQuote || 0 == - _adblCalibQuote.length || null == _astrCalibMeasure || 0 == _astrCalibMeasure.length || - _astrCalibMeasure.length != _adblCalibQuote.length || _adblCalibQuote.length != - _aCalibInst.length) - return null; - - org.drip.state.credit.ExplicitBootCreditCurve cc = null; - - try { - if (bSingleNode) - cc = org.drip.state.creator.ScenarioCreditCurveBuilder.Hazard (_iEpochDate, - _label.fullyQualifiedName(), _strCurrency, _adblHazardRate[0], _aiHazardDate[0], - !org.drip.quant.common.NumberUtil.IsValid (dblRecovery) ? _adblRecoveryRate[0] : - dblRecovery); - else - cc = new ForwardHazardCreditCurve (_iEpochDate, _label, _strCurrency, _adblHazardRate, - _aiHazardDate, _adblRecoveryRate, _aiRecoveryDate, _iSpecificDefaultDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int i = 0; i < _adblCalibQuote.length; ++i) { - try { - org.drip.state.nonlinear.NonlinearCurveBuilder.CreditCurve (_valParam, _aCalibInst[i], - dblFlatNodeValue, _astrCalibMeasure[i], true, i, cc, _dc, _gc, _pricerParam, _lsfc, - _quotingParams); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - if (bSingleNode) - cc.setInstrCalibInputs (_valParam, true, _dc, _gc, _pricerParam, new - org.drip.product.definition.CalibratableComponent[] {_aCalibInst[0]}, new double[] - {dblFlatNodeValue}, _astrCalibMeasure, _lsfc, _quotingParams); - else { - double[] adblCalibValue = new double[_adblCalibQuote.length]; - - for (int i = 0; i < _adblCalibQuote.length; ++i) - adblCalibValue[i] = dblFlatNodeValue; - - cc.setInstrCalibInputs (_valParam, true, _dc, _gc, _pricerParam, _aCalibInst, adblCalibValue, - _astrCalibMeasure, _lsfc, _quotingParams); - } - - return cc; - } - - @Override public org.drip.state.credit.CreditCurve customTweakManifestMeasure ( - final java.lang.String strManifestMeasure, - final org.drip.param.definition.ManifestMeasureTweak mmtp) - { - if (null == mmtp) return null; - - if (!(mmtp instanceof org.drip.param.definition.CreditManifestMeasureTweak)) - return createFromBaseMMTP (mmtp); - - org.drip.param.definition.CreditManifestMeasureTweak cmmt = - (org.drip.param.definition.CreditManifestMeasureTweak) mmtp; - - if (org.drip.param.definition.CreditManifestMeasureTweak.CREDIT_TWEAK_NODE_PARAM_RECOVERY.equalsIgnoreCase - (cmmt.paramType())) { - double[] adblRecoveryRateBumped = null; - - if (null == (adblRecoveryRateBumped = - org.drip.analytics.support.Helper.TweakManifestMeasure (_adblRecoveryRate, cmmt)) || - adblRecoveryRateBumped.length != _adblRecoveryRate.length) - return null; - - try { - return new ForwardHazardCreditCurve (_iEpochDate, _label, _strCurrency, _adblHazardRate, - _aiHazardDate, adblRecoveryRateBumped, _aiRecoveryDate, _iSpecificDefaultDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - } else if - (org.drip.param.definition.CreditManifestMeasureTweak.CREDIT_TWEAK_NODE_PARAM_QUOTE.equalsIgnoreCase - (cmmt.paramType())) { - if (org.drip.param.definition.CreditManifestMeasureTweak.CREDIT_TWEAK_NODE_MEASURE_HAZARD.equalsIgnoreCase - (cmmt.measureType())) { - double[] adblHazardBumped = null; - - if (null == (adblHazardBumped = - org.drip.analytics.support.Helper.TweakManifestMeasure (_adblHazardRate, cmmt)) - || adblHazardBumped.length != _adblHazardRate.length) - return null; - - try { - return new ForwardHazardCreditCurve (_iEpochDate, _label, _strCurrency, - adblHazardBumped, _aiHazardDate, _adblRecoveryRate, _aiRecoveryDate, - _iSpecificDefaultDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - } else if - (org.drip.param.definition.CreditManifestMeasureTweak.CREDIT_TWEAK_NODE_MEASURE_QUOTE.equalsIgnoreCase - (cmmt.measureType())) { - double[] adblQuoteBumped = null; - - if (null == (adblQuoteBumped = - org.drip.analytics.support.Helper.TweakManifestMeasure (_adblHazardRate, cmmt)) - || adblQuoteBumped.length != _adblHazardRate.length) - return null; - - org.drip.state.credit.ExplicitBootCreditCurve cc = null; - - try { - if (cmmt.singleNodeCalib()) - cc = org.drip.state.creator.ScenarioCreditCurveBuilder.Hazard (_iEpochDate, - _strCurrency, _label.fullyQualifiedName(), _adblHazardRate[0], - _aiHazardDate[0], _adblRecoveryRate[0]); - else - cc = new ForwardHazardCreditCurve (_iEpochDate, _label, _strCurrency, - _adblHazardRate, _aiHazardDate, _adblRecoveryRate, _aiRecoveryDate, - _iSpecificDefaultDate); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - for (int i = 0; i < adblQuoteBumped.length; ++i) { - try { - org.drip.state.nonlinear.NonlinearCurveBuilder.CreditCurve (_valParam, - _aCalibInst[i], adblQuoteBumped[i], _astrCalibMeasure[i], _bFlat, i, cc, _dc, - _gc, _pricerParam, _lsfc, _quotingParams); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - } - - cc.setInstrCalibInputs (_valParam, _bFlat, _dc, _gc, _pricerParam, _aCalibInst, - adblQuoteBumped, _astrCalibMeasure, _lsfc, _quotingParams); - - return cc; - } - } - - return null; - } - - @Override public boolean setNodeValue ( - final int iNodeIndex, - final double dblValue) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblValue) || iNodeIndex > _adblHazardRate.length) - return false; - - for (int i = iNodeIndex; i < _adblHazardRate.length; ++i) - _adblHazardRate[i] = dblValue; - - return true; - } - - @Override public boolean bumpNodeValue ( - final int iNodeIndex, - final double dblValue) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblValue) || iNodeIndex > _adblHazardRate.length) - return false; - - for (int i = iNodeIndex; i < _adblHazardRate.length; ++i) - _adblHazardRate[i] += dblValue; - - return true; - } - - @Override public boolean setFlatValue ( - final double dblValue) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblValue)) return false; - - for (int i = 0; i < _adblHazardRate.length; ++i) - _adblHazardRate[i] = dblValue; - - return true; - } -} diff --git a/org/drip/state/nonlinear/NonlinearCurveBuilder.java b/org/drip/state/nonlinear/NonlinearCurveBuilder.java deleted file mode 100644 index 50fe4f2..0000000 --- a/org/drip/state/nonlinear/NonlinearCurveBuilder.java +++ /dev/null @@ -1,441 +0,0 @@ - -package org.drip.state.nonlinear; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 Lakshmi Krishnamurthy - * Copyright (C) 2012 Lakshmi Krishnamurthy - * Copyright (C) 2011 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. - */ - -/** - * NonlinearCurveBuilder calibrates the discount and credit/hazard curves from the components and their - * quotes. - * - * NonlinearCurveCalibrator employs a set of techniques for achieving this calibration. - * - It bootstraps the nodes in sequence to calibrate the curve. - * - In conjunction with splining estimation techniques, it may also be used to perform dual sweep - * calibration. The inner sweep achieves the calibration of the segment spline parameters, while the - * outer sweep calibrates iteratively for the targeted boundary conditions. - * - It may also be used to custom calibrate a single Interest Rate/Hazard Rate Node from the corresponding - * Component - * - * CurveCalibrator bootstraps/cooks both discount curves and credit curves. - * - * @author Lakshmi Krishnamurthy - */ - -public class NonlinearCurveBuilder { - - private static final boolean SetNode ( - final org.drip.analytics.definition.ExplicitBootCurve ebc, - final int iNodeIndex, - final boolean bFlat, - final double dblValue) - { - return bFlat ? ebc.setFlatValue (dblValue) : ebc.setNodeValue (iNodeIndex, dblValue); - } - - static class CreditCurveCalibrator extends org.drip.function.definition.R1ToR1 { - private boolean _bFlat = false; - private int _iCurveSegmentIndex = -1; - private java.lang.String _strCalibMeasure = ""; - private double _dblCalibValue = java.lang.Double.NaN; - private org.drip.state.govvie.GovvieCurve _gc = null; - private org.drip.state.discount.MergedDiscountForwardCurve _dc = null; - private org.drip.product.definition.Component _calibComp = null; - private org.drip.param.valuation.ValuationParams _valParams = null; - private org.drip.state.credit.ExplicitBootCreditCurve _ebcc = null; - private org.drip.param.pricer.CreditPricerParams _pricerParams = null; - private org.drip.param.market.LatentStateFixingsContainer _lsfc = null; - private org.drip.param.valuation.ValuationCustomizationParams _vcp = null; - - CreditCurveCalibrator ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.product.definition.Component calibComp, - final double dblCalibValue, - final java.lang.String strCalibMeasure, - final boolean bFlat, - final int iCurveSegmentIndex, - final org.drip.state.credit.ExplicitBootCreditCurve ebcc, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.state.govvie.GovvieCurve gc, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.LatentStateFixingsContainer lsfc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - throws java.lang.Exception - { - super (null); - - _dc = dc; - _gc = gc; - _vcp = vcp; - _ebcc = ebcc; - _lsfc = lsfc; - _bFlat = bFlat; - _calibComp = calibComp; - _valParams = valParams; - _dblCalibValue = dblCalibValue; - _strCalibMeasure = strCalibMeasure; - _iCurveSegmentIndex = iCurveSegmentIndex; - - _pricerParams = new org.drip.param.pricer.CreditPricerParams (pricerParams.unitSize(), new - org.drip.param.definition.CalibrationParams (strCalibMeasure, 0, null), - pricerParams.survivalToPayDate(), pricerParams.discretizationScheme()); - } - - @Override public double evaluate ( - final double dblRate) - throws java.lang.Exception - { - if (!SetNode (_ebcc, _iCurveSegmentIndex, _bFlat, dblRate)) - throw new java.lang.Exception - ("NonlinearCurveBuilder::CreditCurveCalibrator::evaluate => Cannot set Rate = " + dblRate - + " for node " + _iCurveSegmentIndex); - - return _dblCalibValue - _calibComp.measureValue (_valParams, _pricerParams, - org.drip.param.creator.MarketParamsBuilder.Create (_dc, _gc, _ebcc, null, null, null, _lsfc), - _vcp, _strCalibMeasure); - } - } - - /** - * Calibrate a single Hazard Rate Node from the corresponding Component - * - * @param valParams Calibration Valuation Parameters - * @param calibComp The Calibration Component - * @param dblCalibValue The Value to be Calibrated to - * @param strCalibMeasure The Calibration Measure - * @param bFlat TRUE - Calibrate a Flat Curve across all Tenors - * @param iCurveSegmentIndex The Curve Segment Index - * @param ebcc The Credit Curve to be calibrated - * @param dc The discount curve to be bootstrapped - * @param gc The Govvie Curve - * @param pricerParams Input Pricer Parameters - * @param lsfc The Latent State Fixings Container - * @param vcp Valuation Customization Parameters - * - * @return The successfully calibrated State Hazard Rate Point - */ - - public static final boolean CreditCurve ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.product.definition.Component calibComp, - final double dblCalibValue, - final java.lang.String strCalibMeasure, - final boolean bFlat, - final int iCurveSegmentIndex, - final org.drip.state.credit.ExplicitBootCreditCurve ebcc, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.state.govvie.GovvieCurve gc, - final org.drip.param.pricer.CreditPricerParams pricerParams, - final org.drip.param.market.LatentStateFixingsContainer lsfc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - try { - org.drip.function.r1tor1solver.FixedPointFinderOutput rfop = new - org.drip.function.r1tor1solver.FixedPointFinderZheng (0., new CreditCurveCalibrator - (valParams, calibComp, dblCalibValue, strCalibMeasure, bFlat, iCurveSegmentIndex, ebcc, - dc, gc, pricerParams, lsfc, vcp), true).findRoot(); - - return null != rfop && rfop.containsRoot(); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - /** - * Calibrate a Single Discount Curve Segment from the corresponding Component - * - * @param valParams Calibration Valuation Parameters - * @param comp The Calibration Component - * @param dblCalibValue The Value to be Calibrated to - * @param strCalibMeasure The Calibration Measure - * @param bFlat TRUE - Calibrate a Flat Curve across all Tenors - * @param iCurveSegmentIndex The Curve Segment Index - * @param ebdc The discount curve to be bootstrapped - * @param gc The Govvie Curve - * @param lsfc Latent State Fixings Container - * @param vcp Valuation Customization Parameters - * - * @return The successfully calibrated State IR Point - * - * @throws java.lang.Exception Thrown if the Bootstrapping is unsuccessful - */ - - public static final double DiscountCurveNode ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.product.definition.Component comp, - final double dblCalibValue, - final java.lang.String strCalibMeasure, - final boolean bFlat, - final int iCurveSegmentIndex, - final org.drip.state.discount.ExplicitBootDiscountCurve ebdc, - final org.drip.state.govvie.GovvieCurve gc, - final org.drip.param.market.LatentStateFixingsContainer lsfc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - throws java.lang.Exception - { - if (null == comp) - throw new java.lang.Exception ("NonlinearCurveBuilder::DiscountCurveNode => Invalid inputs!"); - - org.drip.function.definition.R1ToR1 ofIRNode = new org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblValue) - throws java.lang.Exception - { - if (!SetNode (ebdc, iCurveSegmentIndex, bFlat, dblValue)) - throw new java.lang.Exception - ("NonlinearCurveBuilder::DiscountCurveNode => Cannot set Value = " + dblValue + - " for node " + iCurveSegmentIndex); - - return dblCalibValue - comp.measureValue (valParams, new - org.drip.param.pricer.CreditPricerParams (1, new - org.drip.param.definition.CalibrationParams (strCalibMeasure, 0, null), true, 0), - org.drip.param.creator.MarketParamsBuilder.Create (ebdc, gc, null, null, null, - null, lsfc), vcp, strCalibMeasure); - } - }; - - org.drip.function.r1tor1solver.FixedPointFinderOutput rfop = new - org.drip.function.r1tor1solver.FixedPointFinderBrent (0., ofIRNode, true).findRoot(); - - if (null == rfop || !rfop.containsRoot()) - throw new java.lang.Exception - ("NonlinearCurveBuilder::DiscountCurveNode => Cannot calibrate IR segment for node #" + - iCurveSegmentIndex); - - return rfop.getRoot(); - } - - /** - * Boot-strap a Discount Curve from the set of calibration components - * - * @param valParams Calibration Valuation Parameters - * @param aCalibComp Array of the calibration components - * @param adblCalibValue Array of Calibration Values - * @param astrCalibMeasure Array of Calibration Measures - * @param dblBump Amount to bump the Quotes by - * @param bFlat TRUE - Calibrate a Flat Curve across all Tenors - * @param ebdc The discount curve to be bootstrapped - * @param gc The Govvie Curve - * @param lsfc Latent State Fixings Container - * @param vcp Valuation Customization Parameters - * - * @return TRUE - Bootstrapping was successful - */ - - public static final boolean DiscountCurve ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.product.definition.Component[] aCalibComp, - final double[] adblCalibValue, - final java.lang.String[] astrCalibMeasure, - final double dblBump, - final boolean bFlat, - final org.drip.state.discount.ExplicitBootDiscountCurve ebdc, - final org.drip.state.govvie.GovvieCurve gc, - final org.drip.param.market.LatentStateFixingsContainer lsfc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == adblCalibValue || null == aCalibComp || null == astrCalibMeasure || - !org.drip.quant.common.NumberUtil.IsValid (dblBump)) - return false; - - int iNumCalibComp = aCalibComp.length; - - if (0 == iNumCalibComp || adblCalibValue.length != iNumCalibComp || astrCalibMeasure.length != - iNumCalibComp) - return false; - - for (int i = 0; i < iNumCalibComp; ++i) { - try { - if (!org.drip.quant.common.NumberUtil.IsValid (DiscountCurveNode (valParams, aCalibComp[i], - adblCalibValue[i] + dblBump, astrCalibMeasure[i], bFlat, i, ebdc, gc, lsfc, vcp))) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } - - /** - * Calibrate a Single Volatility Curve Segment from the corresponding Component - * - * @param valParams Calibration Valuation Parameters - * @param comp The Calibration Component - * @param dblCalibValue The Value to be Calibrated to - * @param strCalibMeasure The Calibration Measure - * @param bFlat TRUE - Calibrate a Flat Curve across all Tenors - * @param iCurveSegmentIndex The Curve Segment Index - * @param ebvc The Volatility Curve to be bootstrapped - * @param dc The Discount Curve - * @param fc The Forward Curve - * @param lsfc Latent State Fixings Container - * @param vcp Valuation Customization Parameters - * - * @return The successfully calibrated State IR Point - * - * @throws java.lang.Exception Thrown if the Bootstrapping is unsuccessful - */ - - public static final double VolatilityCurveNode ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.product.definition.Component comp, - final double dblCalibValue, - final java.lang.String strCalibMeasure, - final boolean bFlat, - final int iCurveSegmentIndex, - final org.drip.state.volatility.ExplicitBootVolatilityCurve ebvc, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.state.forward.ForwardCurve fc, - final org.drip.param.market.LatentStateFixingsContainer lsfc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - throws java.lang.Exception - { - if (null == comp) - throw new java.lang.Exception ("NonlinearCurveBuilder::VolatilityCurveNode => Invalid inputs!"); - - org.drip.function.definition.R1ToR1 r1r1VolMetric = new org.drip.function.definition.R1ToR1 (null) { - @Override public double evaluate ( - final double dblValue) - throws java.lang.Exception - { - if (!SetNode (ebvc, iCurveSegmentIndex, bFlat, dblValue)) - throw new java.lang.Exception - ("NonlinearCurveBuilder::VolatilityCurveNode => Cannot set Value = " + dblValue + - " for node " + iCurveSegmentIndex); - - org.drip.param.market.CurveSurfaceQuoteContainer csqs = - org.drip.param.creator.MarketParamsBuilder.Create (dc, null, null, null, null, null, - lsfc); - - if (null == csqs || !csqs.setForwardState (fc) || !csqs.setForwardVolatility (ebvc)) - throw new java.lang.Exception - ("NonlinearCurveBuilder::VolatilityCurveNode => Cannot set Value = " + dblValue + - " for node " + iCurveSegmentIndex); - - return dblCalibValue - comp.measureValue (valParams, new - org.drip.param.pricer.CreditPricerParams (1, new - org.drip.param.definition.CalibrationParams (strCalibMeasure, 0, null), true, 0), - csqs, vcp, strCalibMeasure); - } - }; - - org.drip.function.r1tor1solver.FixedPointFinderOutput fpfo = (new - org.drip.function.r1tor1solver.FixedPointFinderBrent (0., r1r1VolMetric, true)).findRoot - (org.drip.function.r1tor1solver.InitializationHeuristics.FromHardSearchEdges (0.00001, 5.)); - - if (null == fpfo || !fpfo.containsRoot()) - throw new java.lang.Exception - ("NonlinearCurveBuilder::VolatilityCurveNode => Cannot calibrate segment for node #" + - iCurveSegmentIndex + " => " + dblCalibValue); - - return fpfo.getRoot(); - } - - /** - * Boot-strap a Volatility Curve from the set of calibration components - * - * @param valParams Calibration Valuation Parameters - * @param aCalibComp Array of the calibration components - * @param adblCalibValue Array of Calibration Values - * @param astrCalibMeasure Array of Calibration Measures - * @param dblBump Amount to bump the Quotes by - * @param bFlat TRUE - Calibrate a Flat Curve across all Tenors - * @param ebvc The Volatility Curve to be bootstrapped - * @param dc The Discount Curve - * @param fc The Forward Curve - * @param lsfc Latent State Fixings Container - * @param vcp Valuation Customization Parameters - * - * @return TRUE - Bootstrapping was successful - */ - - public static final boolean VolatilityCurve ( - final org.drip.param.valuation.ValuationParams valParams, - final org.drip.product.definition.Component[] aCalibComp, - final double[] adblCalibValue, - final java.lang.String[] astrCalibMeasure, - final double dblBump, - final boolean bFlat, - final org.drip.state.volatility.ExplicitBootVolatilityCurve ebvc, - final org.drip.state.discount.MergedDiscountForwardCurve dc, - final org.drip.state.forward.ForwardCurve fc, - final org.drip.param.market.LatentStateFixingsContainer lsfc, - final org.drip.param.valuation.ValuationCustomizationParams vcp) - { - if (null == adblCalibValue || null == aCalibComp || null == astrCalibMeasure || - !org.drip.quant.common.NumberUtil.IsValid (dblBump)) - return false; - - int iNumCalibComp = aCalibComp.length; - - if (0 == iNumCalibComp || adblCalibValue.length != iNumCalibComp || astrCalibMeasure.length != - iNumCalibComp) - return false; - - for (int i = 0; i < iNumCalibComp; ++i) { - try { - if (!org.drip.quant.common.NumberUtil.IsValid (VolatilityCurveNode (valParams, aCalibComp[i], - adblCalibValue[i] + dblBump, astrCalibMeasure[i], bFlat, i, ebvc, dc, fc, lsfc, vcp))) - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return false; - } - } - - return true; - } -} diff --git a/org/drip/state/repo/ExplicitBootRepoCurve.java b/org/drip/state/repo/ExplicitBootRepoCurve.java deleted file mode 100644 index c8f91e0..0000000 --- a/org/drip/state/repo/ExplicitBootRepoCurve.java +++ /dev/null @@ -1,67 +0,0 @@ - -package org.drip.state.repo; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ExplicitBootRepoCurve exposes the functionality associated with the bootstrapped Repo Curve. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class ExplicitBootRepoCurve extends org.drip.state.repo.RepoCurve implements - org.drip.analytics.definition.ExplicitBootCurve { - - protected ExplicitBootRepoCurve ( - final int iEpochDate, - final org.drip.product.definition.Component comp) - throws java.lang.Exception - { - super (iEpochDate, comp); - } -} diff --git a/org/drip/state/repo/RepoCurve.java b/org/drip/state/repo/RepoCurve.java deleted file mode 100644 index 457b398..0000000 --- a/org/drip/state/repo/RepoCurve.java +++ /dev/null @@ -1,175 +0,0 @@ - -package org.drip.state.repo; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RepoCurve is the Stub for the Re-purchase Rate between applicable to the Specified Entity. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class RepoCurve implements org.drip.state.repo.RepoEstimator, - org.drip.analytics.definition.Curve { - - /** - * Repo Latent State - */ - - public static final java.lang.String LATENT_STATE_REPO = "LATENT_STATE_REPO"; - - /** - * Basis Latent State Quantification Metric - Discount Factor - */ - - public static final java.lang.String QUANTIFICATION_METRIC_REPO_RATE = - "QUANTIFICATION_METRIC_REPO_RATE"; - - private int _iEpochDate = java.lang.Integer.MIN_VALUE; - private org.drip.product.definition.Component _comp = null; - - protected RepoCurve ( - final int iEpochDate, - final org.drip.product.definition.Component comp) - throws java.lang.Exception - { - if (null == (_comp = comp)) throw new java.lang.Exception ("RepoCurve ctr: Invalid Inputs"); - - _iEpochDate = iEpochDate; - } - - @Override public org.drip.analytics.date.JulianDate epoch() - { - return new org.drip.analytics.date.JulianDate (_iEpochDate); - } - - @Override public org.drip.product.definition.Component component() - { - return _comp; - } - - @Override public org.drip.state.identifier.LatentStateLabel label() - { - return org.drip.state.identifier.RepoLabel.Standard (_comp.name()); - } - - @Override public java.lang.String currency() - { - return _comp.payCurrency(); - } - - @Override public double repo ( - final org.drip.analytics.date.JulianDate dt) - throws java.lang.Exception - { - if (null == dt) throw new java.lang.Exception ("RepoCurve::repo got null for date"); - - return repo (dt.julian()); - } - - @Override public double repo ( - final java.lang.String strTenor) - throws java.lang.Exception - { - if (null == strTenor || strTenor.isEmpty()) - throw new java.lang.Exception ("RepoCurve::repo got bad tenor"); - - return repo (epoch().addTenor (strTenor)); - } - - @Override public boolean setCCIS ( - final org.drip.analytics.input.CurveConstructionInputSet ccis) - { - return true; - } - - @Override public org.drip.product.definition.CalibratableComponent[] calibComp() - { - return null; - } - - @Override public org.drip.analytics.support.CaseInsensitiveTreeMap manifestMeasure ( - final java.lang.String strInstr) - { - return null; - } - - @Override public org.drip.state.representation.LatentState parallelShiftManifestMeasure ( - final java.lang.String strManifestMeasure, - final double dblShift) - { - return null; - } - - @Override public org.drip.state.representation.LatentState shiftManifestMeasure ( - final int iSpanIndex, - final java.lang.String strManifestMeasure, - final double dblShift) - { - return null; - } - - @Override public org.drip.state.representation.LatentState customTweakManifestMeasure ( - final java.lang.String strManifestMeasure, - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - return null; - } - - @Override public org.drip.state.representation.LatentState parallelShiftQuantificationMetric ( - final double dblShift) - { - return null; - } - - @Override public org.drip.state.representation.LatentState customTweakQuantificationMetric ( - final org.drip.param.definition.ManifestMeasureTweak rvtp) - { - return null; - } -} diff --git a/org/drip/state/repo/RepoEstimator.java b/org/drip/state/repo/RepoEstimator.java deleted file mode 100644 index d70704d..0000000 --- a/org/drip/state/repo/RepoEstimator.java +++ /dev/null @@ -1,108 +0,0 @@ - -package org.drip.state.repo; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * RepoEstimator is the interface that exposes the calculation of the Repo Rate for a specified Entity. - * - * @author Lakshmi Krishnamurthy - */ - -public interface RepoEstimator { - - /** - * Retrieve the Repo-able Component - * - * @return The Repo-able component - */ - - public abstract org.drip.product.definition.Component component(); - - /** - * Calculate the Repo Rate to the given Date - * - * @param iDate Date - * - * @return The Repo Rate - * - * @throws java.lang.Exception Thrown if the Repo Rate cannot be calculated - */ - - public abstract double repo ( - final int iDate) - throws java.lang.Exception; - - /** - * Calculate the Repo Rate to the given Date - * - * @param dt Date - * - * @return The Repo Rate - * - * @throws java.lang.Exception Thrown if the Repo Rate cannot be calculated - */ - - public abstract double repo ( - final org.drip.analytics.date.JulianDate dt) - throws java.lang.Exception; - - /** - * Calculate the Repo Rate to the given Tenor - * - * @param strTenor The Tenor - * - * @return The Repo Rate - * - * @throws java.lang.Exception Thrown if the Repo Rate cannot be calculated - */ - - public abstract double repo ( - final java.lang.String strTenor) - throws java.lang.Exception; -} diff --git a/org/drip/state/representation/LatentState.java b/org/drip/state/representation/LatentState.java deleted file mode 100644 index a677567..0000000 --- a/org/drip/state/representation/LatentState.java +++ /dev/null @@ -1,127 +0,0 @@ - -package org.drip.state.representation; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * LatentState exposes the functionality to manipulate the hidden Variable's Latent State. Specifically it - * exports functions to: - * - Produce node shifted, parallel shifted, and custom manifest-measure tweaked variants of the Latent - * State - * - Produce parallel shifted and custom quantification metric tweaked variants of the Latent State - * - * @author Lakshmi Krishnamurthy - */ - -public interface LatentState { - - /** - * Create a LatentState Instance from the Manifest Measure Parallel Shift - * - * @param strManifestMeasure The Specified Manifest Measure - * @param dblShift Parallel shift of the Manifest Measure - * - * @return New LatentState Instance corresponding to the Parallel Shifted Manifest Measure - */ - - public abstract LatentState parallelShiftManifestMeasure ( - final java.lang.String strManifestMeasure, - final double dblShift); - - /** - * Create a LatentState Instance from the Shift of the Specified Manifest Measure - * - * @param iSpanIndex Index into the Span that identifies the Instrument - * @param strManifestMeasure The Specified Manifest Measure - * @param dblShift Shift of the Manifest Measure - * - * @return New LatentState Instance corresponding to the Shift of the Specified Manifest Measure - */ - - public abstract LatentState shiftManifestMeasure ( - final int iSpanIndex, - final java.lang.String strManifestMeasure, - final double dblShift); - - /** - * Create a LatentState Instance from the Manifest Measure Tweak Parameters - * - * @param strManifestMeasure The Specified Manifest Measure - * @param rvtp Manifest Measure Tweak Parameters - * - * @return New LatentState Instance corresponding to the Tweaked Manifest Measure - */ - - public abstract LatentState customTweakManifestMeasure ( - final java.lang.String strManifestMeasure, - final org.drip.param.definition.ManifestMeasureTweak rvtp); - - /** - * Create a LatentState Instance from the Quantification Metric Parallel Shift - * - * @param dblShift Parallel shift of the Quantification Metric - * - * @return New LatentState Instance corresponding to the Parallel Shifted Quantification Metric - */ - - public abstract LatentState parallelShiftQuantificationMetric ( - final double dblShift); - - /** - * Create a LatentState Instance from the Quantification Metric Tweak Parameters - * - * @param rvtp Quantification Metric Tweak Parameters - * - * @return New LatentState Instance corresponding to the Tweaked Quantification Metric - */ - - public abstract LatentState customTweakQuantificationMetric ( - final org.drip.param.definition.ManifestMeasureTweak rvtp); -} diff --git a/org/drip/state/representation/LatentStateMergeSubStretch.java b/org/drip/state/representation/LatentStateMergeSubStretch.java deleted file mode 100644 index e66517a..0000000 --- a/org/drip/state/representation/LatentStateMergeSubStretch.java +++ /dev/null @@ -1,225 +0,0 @@ - -package org.drip.state.representation; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * LatentStateMergeSubStretch implements merged stretch that is common to multiple latent states. It is - * identified by the start/end date predictor ordinates, and the Latent State Label. Its methods provide the - * following functionality: - * - Identify if the specified predictor ordinate belongs to the sub stretch - * - Shift that sub stretch start/end - * - Identify if the this overlaps the supplied sub stretch, and coalesce them if possible - * - Retrieve the label, start, and end - * - * @author Lakshmi Krishnamurthy - */ - -public class LatentStateMergeSubStretch { - private double _dblEndDate = java.lang.Double.NaN; - private double _dblStartDate = java.lang.Double.NaN; - private org.drip.state.identifier.LatentStateLabel _lsl = null; - - /** - * LatentStateMergeSubStretch constructor - * - * @param dblStartDate Merge Stretch Start Date - * @param dblEndDate Merge Stretch End Date - * @param lsl The Latent State Label - * - * @throws java.lang.Exception Thrown if Inputs are invalid - */ - - public LatentStateMergeSubStretch ( - final double dblStartDate, - final double dblEndDate, - final org.drip.state.identifier.LatentStateLabel lsl) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblStartDate = dblStartDate) || - !org.drip.quant.common.NumberUtil.IsValid (_dblEndDate = dblEndDate) || _dblStartDate >= - _dblEndDate || null == (_lsl = lsl)) - throw new java.lang.Exception ("LatentStateMergeSubStretch ctr: Invalid Inputs"); - } - - /** - * Retrieve the Merge Stretch Start Date - * - * @return The Merge Stretch Start Date - */ - - public double start() - { - return _dblStartDate; - } - - /** - * Shift/Adjust the Start Date - * - * @param dblNewStartDate The new Date to be Shifted to - * - * @return TRUE - Start Date successfully shifted - */ - - public boolean shiftStart ( - final double dblNewStartDate) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblNewStartDate)) return false; - - _dblStartDate = dblNewStartDate; - return true; - } - - /** - * Retrieve the Merge Stretch End Date - * - * @return The Merge Stretch End Date - */ - - public double end() - { - return _dblEndDate; - } - - /** - * Shift/Adjust the End Date - * - * @param dblNewEndDate The new Date to be Shifted to - * - * @return TRUE - End Date successfully shifted - */ - - public boolean shiftEnd ( - final double dblNewEndDate) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblNewEndDate)) return false; - - _dblEndDate = dblNewEndDate; - return true; - } - - /** - * Retrieve the Latent State Label - * - * @return The Latent State Label - */ - - public org.drip.state.identifier.LatentStateLabel label() - { - return _lsl; - } - - /** - * Indicate whether Specified Merge Stretch's Label matches with the current one - * - * @param lsmsOther The Supplied Merge Stretch - * - * @return TRUE - Merge Stretches Index Match - */ - - public boolean indexMatch ( - final LatentStateMergeSubStretch lsmsOther) - { - return null != _lsl && null != lsmsOther && lsmsOther.label().match (label()); - } - - /** - * Indicate whether the specified Date is "inside" the Stretch Range. - * - * @param dblDate Date whose "inside"ness is asked for - * - * @return TRUE - Date is Inside - */ - - public boolean in ( - final double dblDate) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblDate)) return false; - - return dblDate >= _dblStartDate && dblDate <= _dblEndDate; - } - - /** - * Identify if the Supplied Merge Stretch overlaps with the provided one. - * - * @param lsmlOther The Supplied Merge Stretch - * - * @return TRUE - Merge Stretches Overlap - */ - - public boolean overlap ( - final LatentStateMergeSubStretch lsmlOther) - { - return null == lsmlOther || lsmlOther.start() >= end() || lsmlOther.end() <= start() ? false : true; - } - - /** - * Coalesce the supplied Merge Stretch with the current one (if possible) to create a new Merge Stretch - * - * @param lsmlOther The Supplied Merge Stretch - * - * @return The Coalesced Merge Stretch - */ - - public LatentStateMergeSubStretch coalesce ( - final LatentStateMergeSubStretch lsmlOther) - { - if (!overlap (lsmlOther) || !indexMatch (lsmlOther)) return null; - - try { - return new LatentStateMergeSubStretch (start() < lsmlOther.start() ? start() : - lsmlOther.start(), end() > lsmlOther.end() ? end() : lsmlOther.end(), label()); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/state/representation/LatentStateSpecification.java b/org/drip/state/representation/LatentStateSpecification.java deleted file mode 100644 index b025aa4..0000000 --- a/org/drip/state/representation/LatentStateSpecification.java +++ /dev/null @@ -1,148 +0,0 @@ - -package org.drip.state.representation; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * LatentStateSpecification holds the fields necessary to specify a complete Latent State. It includes the - * Latent State Type, the Latent State Label, and the Latent State Quantification metric. - * - * @author Lakshmi Krishnamurthy - */ - -public class LatentStateSpecification { - private java.lang.String _strLatentState = ""; - private org.drip.state.identifier.LatentStateLabel _label = null; - private java.lang.String _strLatentStateQuantificationMetric = ""; - - /** - * LatentStateSpecification constructor - * - * @param strLatentState The Latent State - * @param strLatentStateQuantificationMetric The Latent State Quantification Metric - * @param label The Specific Latent State Label - * - * @throws java.lang.Exception Thrown if the Inputs are invalid - */ - - public LatentStateSpecification ( - final java.lang.String strLatentState, - final java.lang.String strLatentStateQuantificationMetric, - final org.drip.state.identifier.LatentStateLabel label) - throws java.lang.Exception - { - if (null == (_strLatentState = strLatentState) || _strLatentState.isEmpty() || null == - (_strLatentStateQuantificationMetric = strLatentStateQuantificationMetric) || - _strLatentStateQuantificationMetric.isEmpty() || null == (_label = label)) - throw new java.lang.Exception ("LatentStateSpecification ctr: Invalid Inputs"); - } - - /** - * Retrieve the Latent State - * - * @return The Latent State - */ - - public java.lang.String latentState() - { - return _strLatentState; - } - - /** - * Retrieve the Latent State Label - * - * @return The Latent State Label - */ - - public org.drip.state.identifier.LatentStateLabel label() - { - return _label; - } - - /** - * Retrieve the Latent State Quantification Metric - * - * @return The Latent State Quantification Metric - */ - - public java.lang.String latentStateQuantificationMetric() - { - return _strLatentStateQuantificationMetric; - } - - /** - * Does the Specified Latent State Specification Instance match the current one? - * - * @param lssOther The "Other" Latent State Specification Instance - * - * @return TRUE - Matches the Specified Latent State Specification Instance - */ - - public boolean match ( - final LatentStateSpecification lssOther) - { - return null == lssOther ? false : _strLatentState.equalsIgnoreCase (lssOther.latentState()) && - _strLatentStateQuantificationMetric.equalsIgnoreCase (lssOther.latentStateQuantificationMetric()) - && _label.match (lssOther.label()); - } - - /** - * Display the Latent State Details - * - * @param strComment The Comment Prefix - */ - - public void displayString ( - final java.lang.String strComment) - { - System.out.println ("\t[LatentStateSpecification]: " + _strLatentState + " | " + - _strLatentStateQuantificationMetric + " | " + _label.fullyQualifiedName()); - } -} diff --git a/org/drip/state/representation/MergeSubStretchManager.java b/org/drip/state/representation/MergeSubStretchManager.java deleted file mode 100644 index 93758b9..0000000 --- a/org/drip/state/representation/MergeSubStretchManager.java +++ /dev/null @@ -1,127 +0,0 @@ - -package org.drip.state.representation; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 Lakshmi Krishnamurthy - * Copyright (C) 2013 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. - */ - -/** - * MergeSubStretchManager manages the different discount-forward merge stretches. It provides functionality - * to create, expand, or contract the merge stretches. - * - * @author Lakshmi Krishnamurthy - */ - -public class MergeSubStretchManager { - private java.util.List _lsLSMS = null; - - /** - * Empty MergeSubStretchManager constructor - */ - - public MergeSubStretchManager() - { - _lsLSMS = new java.util.ArrayList(); - } - - /** - * Indicates whether the specified Latent State Label is Part of the Merge Stretch - * - * @param dblDate The Date Node - * @param lsl The Latent State Label - * - * @return TRUE - The specified Latent State Label is Part of the Merge Stretch - */ - - public boolean partOfMergeState ( - final double dblDate, - final org.drip.state.identifier.LatentStateLabel lsl) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblDate) || null == lsl || null == _lsLSMS) - return false; - - for (org.drip.state.representation.LatentStateMergeSubStretch lsms : _lsLSMS) { - if (null != lsms && lsms.in (dblDate) && lsms.label().match (lsl)) return true; - } - - return false; - } - - /** - * Add the Specified Merge Stretch - * - * @param lsms The Merge Stretch - * - * @return TRUE - Successfully added - */ - - public boolean addMergeStretch ( - final org.drip.state.representation.LatentStateMergeSubStretch lsms) - { - if (null == lsms) return false; - - for (org.drip.state.representation.LatentStateMergeSubStretch lsmsConstituent : _lsLSMS) { - if (null == lsmsConstituent) continue; - - org.drip.state.representation.LatentStateMergeSubStretch lsmsCoalesced = lsmsConstituent.coalesce - (lsms); - - if (null == lsmsCoalesced) continue; - - _lsLSMS.remove (lsmsConstituent); - - _lsLSMS.add (lsmsCoalesced); - - return true; - } - - _lsLSMS.add (lsms); - - return true; - } -} diff --git a/org/drip/state/volatility/ExplicitBootVolatilityCurve.java b/org/drip/state/volatility/ExplicitBootVolatilityCurve.java deleted file mode 100644 index 449c017..0000000 --- a/org/drip/state/volatility/ExplicitBootVolatilityCurve.java +++ /dev/null @@ -1,68 +0,0 @@ - -package org.drip.state.volatility; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ExplicitBootVolatilityCurve exposes the functionality associated with the bootstrapped Volatility Curve. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class ExplicitBootVolatilityCurve extends org.drip.state.volatility.VolatilityCurve - implements org.drip.analytics.definition.ExplicitBootCurve { - - protected ExplicitBootVolatilityCurve ( - final int iEpochDate, - final org.drip.state.identifier.VolatilityLabel label, - final java.lang.String strCurrency) - throws java.lang.Exception - { - super (iEpochDate, label, strCurrency); - } -} diff --git a/org/drip/state/volatility/VolatilityCurve.java b/org/drip/state/volatility/VolatilityCurve.java deleted file mode 100644 index 6cdc8d2..0000000 --- a/org/drip/state/volatility/VolatilityCurve.java +++ /dev/null @@ -1,136 +0,0 @@ - -package org.drip.state.volatility; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 Lakshmi Krishnamurthy - * Copyright (C) 2014 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. - */ - -/** - * VolatilityCurve exposes the Stub that implements the Latent State's Deterministic Volatility Term - * Structure Curve - by Construction, this is expected to be non-local. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class VolatilityCurve extends org.drip.analytics.definition.NodeStructure { - - protected VolatilityCurve ( - final int iEpochDate, - final org.drip.state.identifier.LatentStateLabel label, - final java.lang.String strCurrency) - throws java.lang.Exception - { - super (iEpochDate, label, strCurrency); - } - - /** - * Compute the Deterministic Implied Volatility at the Date Node from the Volatility Term Structure - * - * @param iDate The Date Node - * - * @return The Deterministic Implied Volatility at the Date Node from the Volatility Term Structure - * - * @throws java.lang.Exception Thrown if the Deterministic Implied Volatility cannot be computed - */ - - public abstract double impliedVol ( - final int iDate) - throws java.lang.Exception; - - /** - * Compute the Deterministic Implied Volatility at the Date Node from the Volatility Term Structure - * - * @param dt The Date Node - * - * @return The Deterministic Implied Volatility at the Date Node from the Volatility Term Structure - * - * @throws java.lang.Exception Thrown if the Deterministic Implied Volatility cannot be computed - */ - - public double impliedVol ( - final org.drip.analytics.date.JulianDate dt) - throws java.lang.Exception - { - if (null == dt) throw new java.lang.Exception ("VolatilityCurve::impliedVol => Invalid Inputs!"); - - return impliedVol (dt.julian()); - } - - /** - * Compute the Deterministic Implied Volatility at the Tenor from the Volatility Term Structure - * - * @param strTenor The Date Node - * - * @return The Deterministic Implied Volatility at the Tenor from the Volatility Term Structure - * - * @throws java.lang.Exception Thrown if the Deterministic Implied Volatility cannot be computed - */ - - public double impliedVol ( - final java.lang.String strTenor) - throws java.lang.Exception - { - if (null == strTenor || strTenor.isEmpty()) - throw new java.lang.Exception ("VolatilityCurve::impliedVol => Invalid Inputs!"); - - return impliedVol (epoch().addTenor (strTenor).julian()); - } - - /** - * Compute the Deterministic Implied Volatility at the Date Node from the Volatility Term Structure - * - * @param iDate The Date Node - * - * @return The Deterministic Implied Volatility at the Date Node from the Volatility Term Structure - * - * @throws java.lang.Exception Thrown if the Deterministic Implied Volatility cannot be computed - */ - - public abstract double vol ( - final int iDate) - throws java.lang.Exception; -} diff --git a/org/drip/template/forwardratefutures/AUDBBSW3M.java b/org/drip/template/forwardratefutures/AUDBBSW3M.java deleted file mode 100644 index 2c2d716..0000000 --- a/org/drip/template/forwardratefutures/AUDBBSW3M.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.template.forwardratefutures; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.definition.Component; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * AUDBBSW3M contains a Templated Pricing of the LIBOR 3M AUD Futures Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class AUDBBSW3M { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "AUD"; - - Component futures = ExchangeInstrumentBuilder.ForwardRateFutures ( - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = futures.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Cash Flow Details ||"); - - System.out.println ("\t\t| ----------------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : futures.couponPeriods()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/forwardratefutures/CADCDOR3M.java b/org/drip/template/forwardratefutures/CADCDOR3M.java deleted file mode 100644 index dae0ce9..0000000 --- a/org/drip/template/forwardratefutures/CADCDOR3M.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.template.forwardratefutures; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.definition.Component; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CADCDOR3M contains a Templated Pricing of the CDOR 3M CAD Futures Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class CADCDOR3M { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "CAD"; - - Component futures = ExchangeInstrumentBuilder.ForwardRateFutures ( - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = futures.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Cash Flow Details ||"); - - System.out.println ("\t\t| ----------------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : futures.couponPeriods()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/forwardratefutures/CHFLIBOR3M.java b/org/drip/template/forwardratefutures/CHFLIBOR3M.java deleted file mode 100644 index e48dac8..0000000 --- a/org/drip/template/forwardratefutures/CHFLIBOR3M.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.template.forwardratefutures; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.definition.Component; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CHFLIBOR3M contains a Templated Pricing of the LIBOR 3M CHF Futures Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class CHFLIBOR3M { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "CHF"; - - Component futures = ExchangeInstrumentBuilder.ForwardRateFutures ( - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = futures.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Cash Flow Details ||"); - - System.out.println ("\t\t| ----------------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : futures.couponPeriods()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/forwardratefutures/EURIBOR3M.java b/org/drip/template/forwardratefutures/EURIBOR3M.java deleted file mode 100644 index 29a8241..0000000 --- a/org/drip/template/forwardratefutures/EURIBOR3M.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.template.forwardratefutures; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.definition.Component; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * EURIBOR3M contains a Templated Pricing of the 3M EURIBOR EUR Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class EURIBOR3M { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "EUR"; - - Component futures = ExchangeInstrumentBuilder.ForwardRateFutures ( - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = futures.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|-------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Cash Flow Details ||"); - - System.out.println ("\t\t| ----------------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|-------------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : futures.couponPeriods()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|-------------------------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/forwardratefutures/EuroDollar.java b/org/drip/template/forwardratefutures/EuroDollar.java deleted file mode 100644 index dcf76b0..0000000 --- a/org/drip/template/forwardratefutures/EuroDollar.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.template.forwardratefutures; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.definition.Component; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * EuroDollar contains a Templated Pricing of the EuroDollar (i.e, LIBOR 3M USD Futures) Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class EuroDollar { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "USD"; - - Component futures = ExchangeInstrumentBuilder.ForwardRateFutures ( - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "02D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = futures.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Cash Flow Details ||"); - - System.out.println ("\t\t| ----------------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : futures.couponPeriods()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/forwardratefutures/GBPLIBOR3M.java b/org/drip/template/forwardratefutures/GBPLIBOR3M.java deleted file mode 100644 index 2e31ba6..0000000 --- a/org/drip/template/forwardratefutures/GBPLIBOR3M.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.template.forwardratefutures; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.definition.Component; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * GBPLIBOR3M contains a Templated Pricing of the 3M LIBOR GBP Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class GBPLIBOR3M { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "GBP"; - - Component futures = ExchangeInstrumentBuilder.ForwardRateFutures ( - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = futures.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Cash Flow Details ||"); - - System.out.println ("\t\t| ----------------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : futures.couponPeriods()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/forwardratefutures/JPYLIBOR3M.java b/org/drip/template/forwardratefutures/JPYLIBOR3M.java deleted file mode 100644 index f98ccf2..0000000 --- a/org/drip/template/forwardratefutures/JPYLIBOR3M.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.template.forwardratefutures; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.definition.Component; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * JPYLIBOR3M contains a Templated Pricing of the LIBOR 3M JPY Futures Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class JPYLIBOR3M { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "JPY"; - - Component futures = ExchangeInstrumentBuilder.ForwardRateFutures ( - dtSpot, - strCurrency - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = futures.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Cash Flow Details ||"); - - System.out.println ("\t\t| ----------------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : futures.couponPeriods()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/irs/AUD.java b/org/drip/template/irs/AUD.java deleted file mode 100644 index d7aff3c..0000000 --- a/org/drip/template/irs/AUD.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.template.irs; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * AUD contains a Templated Pricing of the OTC Fix-Float AUD IRS Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class AUD { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "AUD"; - String strMaturityTenor = "5Y"; - - FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - strMaturityTenor, - "MAIN", - 0.0206 - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Fixed Stream Cash Flow Details ||"); - - System.out.println ("\t\t| ----- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/irs/CAD.java b/org/drip/template/irs/CAD.java deleted file mode 100644 index ef6c107..0000000 --- a/org/drip/template/irs/CAD.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.template.irs; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CAD contains a Templated Pricing of the OTC Fix-Float CAD IRS Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class CAD { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "CAD"; - String strMaturityTenor = "5Y"; - - FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - strMaturityTenor, - "MAIN", - 0.0206 - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Fixed Stream Cash Flow Details ||"); - - System.out.println ("\t\t| ----- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/irs/CHF.java b/org/drip/template/irs/CHF.java deleted file mode 100644 index 999d174..0000000 --- a/org/drip/template/irs/CHF.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.template.irs; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CHF contains a Templated Pricing of the OTC Fix-Float CHF IRS Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class CHF { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "CHF"; - String strMaturityTenor = "5Y"; - - FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - strMaturityTenor, - "MAIN", - 0.0206 - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Fixed Stream Cash Flow Details ||"); - - System.out.println ("\t\t| ----- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/irs/CNY.java b/org/drip/template/irs/CNY.java deleted file mode 100644 index 4b01885..0000000 --- a/org/drip/template/irs/CNY.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.template.irs; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * CNY contains a Templated Pricing of the OTC Fix-Float CNY IRS Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class CNY { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "CNY"; - String strMaturityTenor = "5Y"; - - FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - strMaturityTenor, - "MAIN", - 0.0206 - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Fixed Stream Cash Flow Details ||"); - - System.out.println ("\t\t| ----- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/irs/DKK.java b/org/drip/template/irs/DKK.java deleted file mode 100644 index c597ecd..0000000 --- a/org/drip/template/irs/DKK.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.template.irs; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * DKK contains a Templated Pricing of the OTC Fix-Float DKK IRS Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class DKK { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "DKK"; - String strMaturityTenor = "5Y"; - - FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - strMaturityTenor, - "MAIN", - 0.0206 - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Fixed Stream Cash Flow Details ||"); - - System.out.println ("\t\t| ----- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/irs/EUR.java b/org/drip/template/irs/EUR.java deleted file mode 100644 index 237f38f..0000000 --- a/org/drip/template/irs/EUR.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.template.irs; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * EUR contains a Templated Pricing of the OTC Fix-Float EUR IRS Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class EUR { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "EUR"; - String strMaturityTenor = "5Y"; - - FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - strMaturityTenor, - "MAIN", - 0.0206 - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|-------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|-------------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|-------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Fixed Stream Cash Flow Details ||"); - - System.out.println ("\t\t| ----- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/irs/GBP.java b/org/drip/template/irs/GBP.java deleted file mode 100644 index bd3f033..0000000 --- a/org/drip/template/irs/GBP.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.template.irs; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * GBP contains a Templated Pricing of the OTC Fix-Float GBP IRS Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class GBP { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "GBP"; - String strMaturityTenor = "5Y"; - - FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - strMaturityTenor, - "MAIN", - 0.0206 - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Fixed Stream Cash Flow Details ||"); - - System.out.println ("\t\t| ----- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/irs/HKD.java b/org/drip/template/irs/HKD.java deleted file mode 100644 index 532e960..0000000 --- a/org/drip/template/irs/HKD.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.template.irs; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * HKD contains a Templated Pricing of the OTC Fix-Float HKD IRS Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class HKD { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "HKD"; - String strMaturityTenor = "5Y"; - - FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - strMaturityTenor, - "MAIN", - 0.0206 - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Fixed Stream Cash Flow Details ||"); - - System.out.println ("\t\t| ----- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/irs/INR.java b/org/drip/template/irs/INR.java deleted file mode 100644 index 65f1334..0000000 --- a/org/drip/template/irs/INR.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.template.irs; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * INR contains a Templated Pricing of the OTC Fix-Float INR IRS Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class INR { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "INR"; - String strMaturityTenor = "5Y"; - - FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - strMaturityTenor, - "MAIN", - 0.0206 - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Fixed Stream Cash Flow Details ||"); - - System.out.println ("\t\t| ----- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/irs/JPYLIBOR.java b/org/drip/template/irs/JPYLIBOR.java deleted file mode 100644 index bdb6223..0000000 --- a/org/drip/template/irs/JPYLIBOR.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.template.irs; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * JPYLIBOR contains a Templated Pricing of the OTC Fix-LIBOR Float JPY IRS Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class JPYLIBOR { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "JPY"; - String strMaturityTenor = "5Y"; - - FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - strMaturityTenor, - "MAIN", - 0.0206 - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Fixed Stream Cash Flow Details ||"); - - System.out.println ("\t\t| ----- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/irs/JPYTIBOR.java b/org/drip/template/irs/JPYTIBOR.java deleted file mode 100644 index 5805996..0000000 --- a/org/drip/template/irs/JPYTIBOR.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.template.irs; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * JPY TIBOR contains a Templated Pricing of the OTC Fix-TIBOR Float JPY IRS Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class JPYTIBOR { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "JPY"; - String strMaturityTenor = "5Y"; - - FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - strMaturityTenor, - "TIBOR", - 0.0206 - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Fixed Stream Cash Flow Details ||"); - - System.out.println ("\t\t| ----- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/irs/NOK.java b/org/drip/template/irs/NOK.java deleted file mode 100644 index 6f4a63f..0000000 --- a/org/drip/template/irs/NOK.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.template.irs; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * NOK contains a Templated Pricing of the OTC Fix-Float NOK IRS Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class NOK { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "NOK"; - String strMaturityTenor = "5Y"; - - FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - strMaturityTenor, - "MAIN", - 0.0206 - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Fixed Stream Cash Flow Details ||"); - - System.out.println ("\t\t| ----- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/irs/NZD.java b/org/drip/template/irs/NZD.java deleted file mode 100644 index 920b81b..0000000 --- a/org/drip/template/irs/NZD.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.template.irs; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * NZD contains a Templated Pricing of the OTC Fix-Float NZD IRS Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class NZD { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "NZD"; - String strMaturityTenor = "5Y"; - - FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - strMaturityTenor, - "MAIN", - 0.0206 - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|---------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|---------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|---------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Fixed Stream Cash Flow Details ||"); - - System.out.println ("\t\t| ----- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/irs/PLN.java b/org/drip/template/irs/PLN.java deleted file mode 100644 index 8ac0f59..0000000 --- a/org/drip/template/irs/PLN.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.template.irs; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * PLN contains a Templated Pricing of the OTC Fix-Float PLN IRS Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class PLN { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "PLN"; - String strMaturityTenor = "5Y"; - - FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - strMaturityTenor, - "MAIN", - 0.0206 - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Fixed Stream Cash Flow Details ||"); - - System.out.println ("\t\t| ----- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/irs/SEK.java b/org/drip/template/irs/SEK.java deleted file mode 100644 index 21dc363..0000000 --- a/org/drip/template/irs/SEK.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.template.irs; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * SEK contains a Templated Pricing of the OTC Fix-Float SEK IRS Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class SEK { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "SEK"; - String strMaturityTenor = "5Y"; - - FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - strMaturityTenor, - "MAIN", - 0.0206 - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|------------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Fixed Stream Cash Flow Details ||"); - - System.out.println ("\t\t| ----- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/irs/SGD.java b/org/drip/template/irs/SGD.java deleted file mode 100644 index 1c04856..0000000 --- a/org/drip/template/irs/SGD.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.template.irs; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * SGD contains a Templated Pricing of the OTC Fix-Float SGD IRS Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class SGD { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "SGD"; - String strMaturityTenor = "5Y"; - - FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - strMaturityTenor, - "MAIN", - 0.0206 - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Fixed Stream Cash Flow Details ||"); - - System.out.println ("\t\t| ----- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/irs/USD.java b/org/drip/template/irs/USD.java deleted file mode 100644 index b926272..0000000 --- a/org/drip/template/irs/USD.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.template.irs; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * USD contains a Templated Pricing of the OTC Fix-Float USD IRS Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class USD { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "USD"; - String strMaturityTenor = "5Y"; - - FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - strMaturityTenor, - "MAIN", - 0.0206 - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "02D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Fixed Stream Cash Flow Details ||"); - - System.out.println ("\t\t| ----- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/irs/ZAR.java b/org/drip/template/irs/ZAR.java deleted file mode 100644 index 2bf1e35..0000000 --- a/org/drip/template/irs/ZAR.java +++ /dev/null @@ -1,220 +0,0 @@ - -package org.drip.template.irs; - -import java.util.Map; - -import org.drip.analytics.cashflow.CompositePeriod; -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.rates.FixFloatComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ZAR contains a Templated Pricing of the OTC Fix-Float ZAR IRS Instrument. - * - * @author Lakshmi Krishnamurthy - */ - -public class ZAR { - - public static final void main ( - final String[] args) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today(); - - String strCurrency = "ZAR"; - String strMaturityTenor = "5Y"; - - FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - strMaturityTenor, - "MAIN", - 0.0206 - ); - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState ( - LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, - "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, - "ForwardRate", - new String[] { - "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" - }, - new double[] { - 0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409 - }, - "SwapRate" - ) - ); - - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), - null, - csqc, - null - ); - - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); - - System.out.println ("\t |------------------------------||"); - - System.out.println ("\n\n\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Forward Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.forwardLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\t\t| Fixed Stream Cash Flow Details ||"); - - System.out.println ("\t\t| ----- ------ ---- ---- ------- ||"); - - System.out.println ("\t\t| Start Date ||"); - - System.out.println ("\t\t| End Date ||"); - - System.out.println ("\t\t| Pay Date ||"); - - System.out.println ("\t\t| FX Fixing Date ||"); - - System.out.println ("\t\t| Base Notional ||"); - - System.out.println ("\t\t| Period DCF ||"); - - System.out.println ("\t\t| Tenor ||"); - - System.out.println ("\t\t| Funding Label ||"); - - System.out.println ("\t\t| Pay Discount Factor ||"); - - System.out.println ("\t\t| Coupon Rate ||"); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) - System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/state/DerivedForwardState.java b/org/drip/template/state/DerivedForwardState.java deleted file mode 100644 index db2d497..0000000 --- a/org/drip/template/state/DerivedForwardState.java +++ /dev/null @@ -1,522 +0,0 @@ - -package org.drip.template.state; - -import org.drip.analytics.date.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.LatentMarketStateBuilder; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * DerivedForwardState sets up the Calibration of the Derived Forward Latent State and examine the Emitted - * Metrics. - * - * @author Lakshmi Krishnamurthy - */ - -public class DerivedForwardState { - - private static final MergedDiscountForwardCurve OvernightCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrDepositMaturityTenor = new String[] { - "1D", - "2D", - "3D" - }; - - double[] adblDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - String[] astrShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - String[] astrOISFuturesEffectiveTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - String[] astrOISFuturesMaturityTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - double[] adblOISFuturesQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - String[] astrLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - return LatentMarketStateBuilder.SmoothOvernightCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "Rate", - astrShortEndOISMaturityTenor, - adblShortEndOISQuote, - "SwapRate", - astrOISFuturesEffectiveTenor, - astrOISFuturesMaturityTenor, - adblOISFuturesQuote, - "SwapRate", - astrLongEndOISMaturityTenor, - adblLongEndOISQuote, - "SwapRate" - ); - } - - private static final ForwardCurve Reference ( - final JulianDate dtSpot, - final MergedDiscountForwardCurve dcOvernight, - final String strReferenceForwardTenor) - throws Exception - { - ForwardLabel forwardLabel = ForwardLabel.Create ( - dcOvernight.currency(), - strReferenceForwardTenor - ); - - String[] astrDepositMaturityTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - double[] adblDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - String[] astrFRAMaturityTenor = new String[] { - "00D", - "01M", - "02M", - "03M", - "04M", - "05M", - "06M", - "07M", - "08M", - "09M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - double[] adblFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - return LatentMarketStateBuilder.SmoothForwardCurve ( - dtSpot, - forwardLabel, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - astrFRAMaturityTenor, - adblFRAQuote, - "ParForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - dcOvernight, - null - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strCurrency = "EUR"; - String strDerivedForwardTenor = "3M"; - String strReferenceForwardTenor = "6M"; - - JulianDate dtSpot = DateUtil.Today(); - - MergedDiscountForwardCurve dcOvernight = OvernightCurve ( - dtSpot, - strCurrency - ); - - ForwardCurve fcReference = Reference ( - dtSpot, - dcOvernight, - strReferenceForwardTenor - ); - - ForwardLabel forwardLabel = ForwardLabel.Create ( - strCurrency, - strDerivedForwardTenor - ); - - String[] astrDepositMaturityTenor = new String[] { - "2W", - "3W", - "1M", - "2M" - }; - - double[] adblDepositQuote = new double[] { - 0.001865, // 2W - 0.001969, // 3W - 0.001951, // 1M - 0.001874 // 2M - }; - - String[] astrFRAMaturityTenor = new String[] { - "00D", - "01M", - "03M", - "06M", - "09M", - "12M", - "15M", - "18M", - "21M" - }; - - double[] adblFRAQuote = new double[] { - 0.001790, // 0D - 0.001775, // 1M - 0.001274, // 3M - 0.001222, // 6M - 0.001269, // 9M - 0.001565, // 12M - 0.001961, // 15M - 0.002556, // 18M - 0.003101 // 21M - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.002850, // 3Y - 0.004370, // 4Y - 0.006230, // 5Y - 0.008170, // 6Y - 0.010000, // 7Y - 0.011710, // 8Y - 0.013240, // 9Y - 0.014590, // 10Y - 0.016920, // 12Y - 0.019330, // 15Y - 0.020990, // 20Y - 0.021560, // 25Y - 0.021860 // 30Y - }; - - String[] astrSyntheticFloatFloatMaturityTenor = new String[] { - "35Y", - "40Y", - "50Y", - "60Y" - }; - - double[] adblSyntheticFloatFloatQuote = new double[] { - 0.00065, // 35Y - 0.00060, // 40Y - 0.00054, // 50Y - 0.00050 // 60Y - }; - - ForwardCurve fcDerived = LatentMarketStateBuilder.SmoothForwardCurve ( - dtSpot, - forwardLabel, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - astrFRAMaturityTenor, - adblFRAQuote, - "ParForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - astrSyntheticFloatFloatMaturityTenor, - adblSyntheticFloatFloatQuote, - "DerivedParBasisSpread", - dcOvernight, - fcReference - ); - - String strLatentStateLabel = fcDerived.label().fullyQualifiedName(); - - System.out.println ("\n\n\t||-------------------------------------------------------------------------||"); - - for (int i = 0; i < adblDepositQuote.length; ++i) - System.out.println ( - "\t|| " + strLatentStateLabel + - " | DEPOSIT | " + astrDepositMaturityTenor[i] + " | " + - FormatUtil.FormatDouble (adblDepositQuote[i], 1, 4, 100.) + - "% | Forward Rate | " + - FormatUtil.FormatDouble (fcDerived.forward (astrDepositMaturityTenor[i]), 1, 4, 100.) + - "% ||" - ); - - System.out.println ("\t||-------------------------------------------------------------------------||"); - - System.out.println ("\n\n\t||--------------------------------------------------------------------------||"); - - for (int i = 0; i < adblFRAQuote.length; ++i) - System.out.println ( - "\t|| " + strLatentStateLabel + - " | FRA | " + astrFRAMaturityTenor[i] + " | " + - FormatUtil.FormatDouble (adblFRAQuote[i], 1, 4, 100.) + - "% | Par Forward Rate | " + - FormatUtil.FormatDouble (fcDerived.forward (dtSpot.addTenor (astrFRAMaturityTenor[i]).addTenor (strDerivedForwardTenor)), 1, 4, 100.) + - "% ||" - ); - - System.out.println ("\t||--------------------------------------------------------------------------||"); - - System.out.println ("\n\n\t||-------------------------------------------------------------------------||"); - - for (int i = 0; i < adblFixFloatQuote.length; ++i) - System.out.println ( - "\t|| " + strLatentStateLabel + - " | FIX FLOAT | " + astrFixFloatMaturityTenor[i] + " | " + - FormatUtil.FormatDouble (adblFixFloatQuote[i], 1, 4, 100.) + - "% | Swap Rate | " + - FormatUtil.FormatDouble (fcDerived.forward (astrFixFloatMaturityTenor[i]), 1, 4, 100.) + - "% ||" - ); - - System.out.println ("\t||-------------------------------------------------------------------------||"); - - System.out.println ("\n\n\t||----------------------------------------------------------------------------------------------------||"); - - for (int i = 0; i < adblSyntheticFloatFloatQuote.length; ++i) - System.out.println ( - "\t|| " + strLatentStateLabel + - " | SYNTHETIC FLOAT FLOAT | " + astrSyntheticFloatFloatMaturityTenor[i] + " | " + - FormatUtil.FormatDouble (adblSyntheticFloatFloatQuote[i], 1, 2, 10000.) + - " bp | Derived Par Basis Spread | " + - FormatUtil.FormatDouble (fcDerived.forward (astrSyntheticFloatFloatMaturityTenor[i]), 1, 4, 100.) + - "% ||" - ); - - System.out.println ("\t||----------------------------------------------------------------------------------------------------||\n"); - } -} diff --git a/org/drip/template/state/FXState.java b/org/drip/template/state/FXState.java deleted file mode 100644 index f884c72..0000000 --- a/org/drip/template/state/FXState.java +++ /dev/null @@ -1,139 +0,0 @@ - -package org.drip.template.state; - -import org.drip.analytics.date.*; -import org.drip.product.params.CurrencyPair; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.LatentMarketStateBuilder; -import org.drip.state.fx.FXCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FXState sets up the Calibration and the Construction of the FX Latent State and examine the Emitted - * Metrics. - * - * @author Lakshmi Krishnamurthy - */ - -public class FXState { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - CurrencyPair cp = new CurrencyPair ( - "EUR", - "USD", - "USD", - 10000. - ); - - JulianDate dtSpot = DateUtil.Today().addBusDays ( - 0, - cp.denomCcy() - ); - - double dblFXSpot = 1.1013; - - String[] astrMaturityTenor = new String[] { - "1D", - "2D", - "3D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "6M", - "9M" - }; - - double[] adblFXForward = new double[] { - 1.1011, // "1D" - 1.1007, // "2D" - 1.0999, // "3D" - 1.0976, // "1W" - 1.0942, // "2W" - 1.0904, // "3W" - 1.0913, // "1M" - 1.0980, // "2M" - 1.1088, // "3M" - 1.1115, // "6M" - 1.1011 // "9M" - }; - - FXCurve fxfc = LatentMarketStateBuilder.SmoothFXCurve ( - dtSpot, - cp, - astrMaturityTenor, - adblFXForward, - "Outright", - dblFXSpot - ); - - String strLatentStateLabel = fxfc.label().fullyQualifiedName(); - - System.out.println ("\n\n\t||--------------------------------------------------------------||"); - - for (int i = 0; i < adblFXForward.length; ++i) - System.out.println ( - "\t|| " + strLatentStateLabel + " | FX FORWARD | " + - astrMaturityTenor[i] + " | " + FormatUtil.FormatDouble (adblFXForward[i], 1, 4, 1.) + - " | Outright | " + - FormatUtil.FormatDouble (fxfc.fx (astrMaturityTenor[i]), 1, 4, 1.) + - " ||" - ); - - System.out.println ("\t||--------------------------------------------------------------||\n"); - } -} diff --git a/org/drip/template/state/ForwardVolatilityState.java b/org/drip/template/state/ForwardVolatilityState.java deleted file mode 100644 index 6e78ba1..0000000 --- a/org/drip/template/state/ForwardVolatilityState.java +++ /dev/null @@ -1,183 +0,0 @@ - -package org.drip.template.state; - -import org.drip.analytics.date.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.LatentMarketStateBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.identifier.ForwardLabel; -import org.drip.state.volatility.VolatilityCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ForwardVolatilityState sets up the Calibration and the Construction of the Volatility Latent State for the - * Forward Latent State and examine the Emitted Metrics. - * - * @author Lakshmi Krishnamurthy - */ - -public class ForwardVolatilityState { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strFRATenor = "3M"; - String strCurrency = "GBP"; - - JulianDate dtSpot = DateUtil.Today().addBusDays ( - 0, - strCurrency - ); - - ForwardLabel forwardLabel = ForwardLabel.Create ( - strCurrency, - strFRATenor - ); - - MergedDiscountForwardCurve dcFunding = LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "30D", - "60D", - "91D", - "182D", - "273D" - }, - new double[] { - 0.0668750, // 30D - 0.0675000, // 60D - 0.0678125, // 91D - 0.0712500, // 182D - 0.0750000 // 273D - }, - "ForwardRate", - null, - "ForwardRate", - new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y" - }, - new double[] { - 0.08265, // 2Y - 0.08550, // 3Y - 0.08655, // 4Y - 0.08770, // 5Y - 0.08910, // 7Y - 0.08920 // 10Y - }, - "SwapRate" - ); - - String[] astrMaturityTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "07Y", - "10Y" - }; - - double[] adblStrike = new double[] { - 0.0788, // "1Y", - 0.0839, // "2Y", - 0.0864, // "3Y", - 0.0869, // "4Y", - 0.0879, // "5Y", - 0.0890, // "7Y", - 0.0889 // "10Y" - }; - - double[] adblPrice = new double[] { - 0.0017, // "1Y", - 0.0132, // "2Y", - 0.0234, // "3Y", - 0.0343, // "4Y", - 0.0471, // "5Y", - 0.0728, // "7Y" - 0.1075 // "10Y" - }; - - VolatilityCurve vcForward = LatentMarketStateBuilder.ForwardRateVolatilityCurve ( - dtSpot, - forwardLabel, - true, - astrMaturityTenor, - adblStrike, - adblPrice, - "Price", - dcFunding, - dcFunding.nativeForwardCurve (strFRATenor) - ); - - String strLatentStateLabel = vcForward.label().fullyQualifiedName(); - - System.out.println ("\n\n\t||-----------------------------------------------------------------------------||"); - - for (int i = 0; i < astrMaturityTenor.length; ++i) - System.out.println ( - "\t|| " + strLatentStateLabel + " | CAP PRICE | " + - astrMaturityTenor[i] + " | " + FormatUtil.FormatDouble (adblPrice[i], 1, 4, 1.) + - " | Forward Implied Vol | " + - FormatUtil.FormatDouble (vcForward.impliedVol (astrMaturityTenor[i]), 2, 2, 100.) + - "% ||" - ); - - System.out.println ("\t||-----------------------------------------------------------------------------||\n"); - } -} diff --git a/org/drip/template/state/FundingState.java b/org/drip/template/state/FundingState.java deleted file mode 100644 index 67c48ef..0000000 --- a/org/drip/template/state/FundingState.java +++ /dev/null @@ -1,199 +0,0 @@ - -package org.drip.template.state; - -import org.drip.analytics.date.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.LatentMarketStateBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FundingState sets up the Calibration of the Funding Latent State and examine the Emitted Metrics. - * - * @author Lakshmi Krishnamurthy - */ - -public class FundingState { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - - JulianDate dtSpot = DateUtil.Today().addBusDays ( - 0, - strCurrency - ); - - String[] astrDepositMaturityTenor = new String[] { - "01D", - "04D", - "07D", - "14D", - "30D", - "60D" - }; - - double[] adblDepositQuote = new double[] { - 0.0013, // 1D - 0.0017, // 2D - 0.0017, // 7D - 0.0018, // 14D - 0.0020, // 30D - 0.0023 // 60D - }; - - double[] adblFuturesQuote = new double[] { - 0.0027, - 0.0032, - 0.0041, - 0.0054, - 0.0077, - 0.0104, - 0.0134, - 0.0160 - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.0166, // 4Y - 0.0206, // 5Y - 0.0241, // 6Y - 0.0269, // 7Y - 0.0292, // 8Y - 0.0311, // 9Y - 0.0326, // 10Y - 0.0340, // 11Y - 0.0351, // 12Y - 0.0375, // 15Y - 0.0393, // 20Y - 0.0402, // 25Y - 0.0407, // 30Y - 0.0409, // 40Y - 0.0409 // 50Y - }; - - MergedDiscountForwardCurve dcFunding = LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - adblFuturesQuote, - "ForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate" - ); - - String strLatentStateLabel = dcFunding.label().fullyQualifiedName(); - - System.out.println ("\n\n\t||---------------------------------------------------------------||"); - - for (int i = 0; i < adblDepositQuote.length; ++i) - System.out.println ( - "\t|| " + strLatentStateLabel + - " | DEPOSIT | " + astrDepositMaturityTenor[i] + " | " + - FormatUtil.FormatDouble (adblDepositQuote[i], 1, 4, 1.) + - " | Forward Rate | " + - FormatUtil.FormatDouble (dcFunding.df (astrDepositMaturityTenor[i]), 1, 6, 1.) + - " ||" - ); - - System.out.println ("\t||---------------------------------------------------------------||"); - - System.out.println ("\n\n\t||--------------------------------------------------------||"); - - for (int i = 0; i < adblFuturesQuote.length; ++i) - System.out.println ( - "\t|| " + strLatentStateLabel + " | FUTURES | " + - FormatUtil.FormatDouble (adblFuturesQuote[i], 1, 4, 1.) + - " | Forward Rate | " + - FormatUtil.FormatDouble (dcFunding.df ((3 + 3 * i) + "M"), 1, 6, 1.) + - " ||" - ); - - System.out.println ("\t||--------------------------------------------------------||"); - - System.out.println ("\n\n\t||--------------------------------------------------------------||"); - - for (int i = 0; i < adblFixFloatQuote.length; ++i) - System.out.println ( - "\t|| " + strLatentStateLabel + - " | FIX FLOAT | " + astrFixFloatMaturityTenor[i] + " | " + - FormatUtil.FormatDouble (adblFixFloatQuote[i], 1, 4, 1.) + - " | Swap Rate | " + - FormatUtil.FormatDouble (dcFunding.df (astrFixFloatMaturityTenor[i]), 1, 6, 1.) + - " ||" - ); - - System.out.println ("\t||--------------------------------------------------------------||\n"); - } -} diff --git a/org/drip/template/state/GovvieState.java b/org/drip/template/state/GovvieState.java deleted file mode 100644 index a684ab2..0000000 --- a/org/drip/template/state/GovvieState.java +++ /dev/null @@ -1,138 +0,0 @@ - -package org.drip.template.state; - -import org.drip.analytics.date.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.LatentMarketStateBuilder; -import org.drip.state.govvie.GovvieCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * GovvieState sets up the Calibration and the Construction of the Govvie Latent State and examine the - * Emitted Metrics. - * - * @author Lakshmi Krishnamurthy - */ - -public class GovvieState { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today().addBusDays ( - 0, - "USD" - ); - - String strCode = "UST"; - - JulianDate[] adtEffective = new JulianDate[] { - DateUtil.CreateFromYMD (2010, DateUtil.SEPTEMBER, 21), - DateUtil.CreateFromYMD (2009, DateUtil.JULY, 14), - DateUtil.CreateFromYMD (2011, DateUtil.MARCH, 8), - DateUtil.CreateFromYMD (2010, DateUtil.AUGUST, 25), - DateUtil.CreateFromYMD (2010, DateUtil.DECEMBER, 3) - }; - - JulianDate[] adtMaturity = new JulianDate[] { - dtSpot.addTenor ("2Y"), - dtSpot.addTenor ("4Y"), - dtSpot.addTenor ("5Y"), - dtSpot.addTenor ("7Y"), - dtSpot.addTenor ("10Y") - }; - - double[] adblCoupon = new double[] { - 0.0200, - 0.0250, - 0.0300, - 0.0325, - 0.0375 - }; - - double[] adblYield = new double[] { - 0.0200, - 0.0250, - 0.0300, - 0.0325, - 0.0375 - }; - - GovvieCurve gc = LatentMarketStateBuilder.ShapePreservingGovvieCurve ( - strCode, - dtSpot, - adtEffective, - adtMaturity, - adblCoupon, - adblYield, - "Yield" - ); - - String strLatentStateLabel = gc.label().fullyQualifiedName(); - - System.out.println ("\n\n\t||---------------------------------------------------------------------------------------||"); - - for (int i = 0; i < adtEffective.length; ++i) - System.out.println ( - "\t|| " + strLatentStateLabel + " | TREASURY | " + - adtMaturity[i] + " | " + FormatUtil.FormatDouble (adblYield[i], 1, 2, 100.) + - "% | Yield | " + - FormatUtil.FormatDouble (gc.yield (adtMaturity[i]), 1, 2, 100.) + - "% | Discount Factor | " + - FormatUtil.FormatDouble (gc.df (adtMaturity[i]), 1, 4, 1.) + - " ||" - ); - - System.out.println ("\t||---------------------------------------------------------------------------------------||\n"); - } -} diff --git a/org/drip/template/state/OvernightState.java b/org/drip/template/state/OvernightState.java deleted file mode 100644 index ff2d51c..0000000 --- a/org/drip/template/state/OvernightState.java +++ /dev/null @@ -1,244 +0,0 @@ - -package org.drip.template.state; - -import org.drip.analytics.date.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.LatentMarketStateBuilder; -import org.drip.state.discount.MergedDiscountForwardCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * OvernightState sets up the Calibration and the Construction of the Overnight Latent State and examine the - * Emitted Metrics. - * - * @author Lakshmi Krishnamurthy - */ - -public class OvernightState { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "EUR"; - - JulianDate dtSpot = DateUtil.Today(); - - String[] astrDepositMaturityTenor = new String[] { - "1D", - "2D", - "3D" - }; - - double[] adblDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - String[] astrShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - String[] astrOISFuturesEffectiveTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - String[] astrOISFuturesMaturityTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - double[] adblOISFuturesQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - String[] astrLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - MergedDiscountForwardCurve dcOvernight = LatentMarketStateBuilder.SmoothOvernightCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "Rate", - astrShortEndOISMaturityTenor, - adblShortEndOISQuote, - "SwapRate", - astrOISFuturesEffectiveTenor, - astrOISFuturesMaturityTenor, - adblOISFuturesQuote, - "SwapRate", - astrLongEndOISMaturityTenor, - adblLongEndOISQuote, - "SwapRate" - ); - - String strLatentStateLabel = dcOvernight.label().fullyQualifiedName(); - - System.out.println ("\n\n\t||------------------------------------------------------------------||"); - - for (int i = 0; i < adblDepositQuote.length; ++i) - System.out.println ( - "\t|| " + strLatentStateLabel + - " | DEPOSIT | " + astrDepositMaturityTenor[i] + " | " + - FormatUtil.FormatDouble (adblDepositQuote[i], 1, 4, 1.) + - " | Forward Rate | " + - FormatUtil.FormatDouble (dcOvernight.df (astrDepositMaturityTenor[i]), 1, 10, 1.) + - " ||" - ); - - System.out.println ("\t||------------------------------------------------------------------||"); - - System.out.println ("\n\n\t||------------------------------------------------------------------||"); - - for (int i = 0; i < adblShortEndOISQuote.length; ++i) - System.out.println ( - "\t|| " + strLatentStateLabel + " | SHORT END OIS | " + - astrShortEndOISMaturityTenor[i] + " | " + FormatUtil.FormatDouble (adblShortEndOISQuote[i], 1, 5, 1.) + - " | Swap Rate | " + - FormatUtil.FormatDouble (dcOvernight.df (astrShortEndOISMaturityTenor[i]), 1, 6, 1.) + - " ||" - ); - - System.out.println ("\t||------------------------------------------------------------------||"); - - System.out.println ("\n\n\t||---------------------------------------------------------------------||"); - - for (int i = 0; i < adblOISFuturesQuote.length; ++i) - System.out.println ( - "\t|| " + strLatentStateLabel + " | OIS FUTURES | " + - FormatUtil.FormatDouble (adblOISFuturesQuote[i], 1, 6, 1.) + - " | " + astrOISFuturesEffectiveTenor[i] + " x " + astrOISFuturesMaturityTenor[i] + - " | Swap Rate | " + - FormatUtil.FormatDouble ( - dcOvernight.df (dtSpot.addTenor (astrOISFuturesEffectiveTenor[i]).addTenor (astrOISFuturesMaturityTenor[i]) - ), 1, 6, 1.) + - " ||" - ); - - System.out.println ("\t||---------------------------------------------------------------------||"); - - System.out.println ("\n\n\t||---------------------------------------------------------------||"); - - for (int i = 0; i < adblLongEndOISQuote.length; ++i) - System.out.println ( - "\t|| " + strLatentStateLabel + " | LONG END OIS | " + - astrLongEndOISMaturityTenor[i] + " | " + FormatUtil.FormatDouble (adblLongEndOISQuote[i], 1, 5, 1.) + - " | Swap Rate | " + - FormatUtil.FormatDouble (dcOvernight.df (astrLongEndOISMaturityTenor[i]), 1, 4, 1.) + - " ||" - ); - - System.out.println ("\t||---------------------------------------------------------------||\n"); - } -} diff --git a/org/drip/template/state/ReferenceForwardState.java b/org/drip/template/state/ReferenceForwardState.java deleted file mode 100644 index 7c5b35a..0000000 --- a/org/drip/template/state/ReferenceForwardState.java +++ /dev/null @@ -1,385 +0,0 @@ - -package org.drip.template.state; - -import org.drip.analytics.date.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.LatentMarketStateBuilder; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ReferenceForwardState sets up the Calibration of the Reference Forward Latent State and examine the - * Emitted Metrics. - * - * @author Lakshmi Krishnamurthy - */ - -public class ReferenceForwardState { - - private static final MergedDiscountForwardCurve OvernightCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrDepositMaturityTenor = new String[] { - "1D", - "2D", - "3D" - }; - - double[] adblDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - String[] astrShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - String[] astrOISFuturesEffectiveTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - String[] astrOISFuturesMaturityTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - double[] adblOISFuturesQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - String[] astrLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - return LatentMarketStateBuilder.SmoothOvernightCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "Rate", - astrShortEndOISMaturityTenor, - adblShortEndOISQuote, - "SwapRate", - astrOISFuturesEffectiveTenor, - astrOISFuturesMaturityTenor, - adblOISFuturesQuote, - "SwapRate", - astrLongEndOISMaturityTenor, - adblLongEndOISQuote, - "SwapRate" - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strCurrency = "GBP"; - String strForwardTenor = "6M"; - - JulianDate dtSpot = DateUtil.Today(); - - MergedDiscountForwardCurve dcOvernight = OvernightCurve ( - dtSpot, - strCurrency - ); - - ForwardLabel forwardLabel = ForwardLabel.Create ( - strCurrency, - strForwardTenor - ); - - String[] astrDepositMaturityTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - double[] adblDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - String[] astrFRAExerciseTenor = new String[] { - "00D", - "01M", - "02M", - "03M", - "04M", - "05M", - "06M", - "07M", - "08M", - "09M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - double[] adblFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - ForwardCurve fcReference = LatentMarketStateBuilder.SmoothForwardCurve ( - dtSpot, - forwardLabel, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - astrFRAExerciseTenor, - adblFRAQuote, - "ParForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - dcOvernight, - null - ); - - String strLatentStateLabel = fcReference.label().fullyQualifiedName(); - - System.out.println ("\n\n\t||-------------------------------------------------------------------------||"); - - for (int i = 0; i < adblDepositQuote.length; ++i) - System.out.println ( - "\t|| " + strLatentStateLabel + - " | DEPOSIT | " + astrDepositMaturityTenor[i] + " | " + - FormatUtil.FormatDouble (adblDepositQuote[i], 1, 4, 100.) + - "% | Forward Rate | " + - FormatUtil.FormatDouble (fcReference.forward (astrDepositMaturityTenor[i]), 1, 4, 100.) + - "% ||" - ); - - System.out.println ("\t||-------------------------------------------------------------------------||"); - - System.out.println ("\n\n\t||--------------------------------------------------------------------------||"); - - for (int i = 0; i < adblFRAQuote.length; ++i) - System.out.println ( - "\t|| " + strLatentStateLabel + - " | FRA | " + astrFRAExerciseTenor[i] + " | " + - FormatUtil.FormatDouble (adblFRAQuote[i], 1, 4, 100.) + - "% | Par Forward Rate | " + - FormatUtil.FormatDouble (fcReference.forward (dtSpot.addTenor (astrFRAExerciseTenor[i]).addTenor (strForwardTenor)), 1, 4, 100.) + - "% ||" - ); - - System.out.println ("\t||--------------------------------------------------------------------------||"); - - System.out.println ("\n\n\t||-------------------------------------------------------------------------||"); - - for (int i = 0; i < adblFixFloatQuote.length; ++i) - System.out.println ( - "\t|| " + strLatentStateLabel + - " | FIX FLOAT | " + astrFixFloatMaturityTenor[i] + " | " + - FormatUtil.FormatDouble (adblFixFloatQuote[i], 1, 4, 100.) + - "% | Swap Rate | " + - FormatUtil.FormatDouble (fcReference.forward (astrFixFloatMaturityTenor[i]), 1, 4, 100.) + - "% ||" - ); - - System.out.println ("\t||-------------------------------------------------------------------------||"); - } -} diff --git a/org/drip/template/state/SurvivalRecoveryState.java b/org/drip/template/state/SurvivalRecoveryState.java deleted file mode 100644 index 76eefa2..0000000 --- a/org/drip/template/state/SurvivalRecoveryState.java +++ /dev/null @@ -1,257 +0,0 @@ - -package org.drip.template.state; - -import org.drip.analytics.date.*; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.LatentMarketStateBuilder; -import org.drip.state.credit.CreditCurve; -import org.drip.state.discount.MergedDiscountForwardCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * SurvivalRecoveryState sets up the Calibration and the Construction of the Survival and the Recovery Latent - * States and examine the Emitted Metrics. - * - * @author Lakshmi Krishnamurthy - */ - -public class SurvivalRecoveryState { - - private static final MergedDiscountForwardCurve OvernightCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - EnvManager.InitEnv (""); - - String[] astrDepositMaturityTenor = new String[] { - "1D", - "2D", - "3D" - }; - - double[] adblDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - String[] astrShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - String[] astrOISFuturesEffectiveTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - String[] astrOISFuturesMaturityTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - double[] adblOISFuturesQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - String[] astrLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - return LatentMarketStateBuilder.SmoothOvernightCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "Rate", - astrShortEndOISMaturityTenor, - adblShortEndOISQuote, - "SwapRate", - astrOISFuturesEffectiveTenor, - astrOISFuturesMaturityTenor, - adblOISFuturesQuote, - "SwapRate", - astrLongEndOISMaturityTenor, - adblLongEndOISQuote, - "SwapRate" - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strCurrency = "EUR"; - - JulianDate dtSpot = DateUtil.Today(); - - /* JulianDate dtSpot = DateUtil.Today().addBusDays ( - 2, - strCurrency - ); */ - - MergedDiscountForwardCurve dcOvernight = OvernightCurve ( - dtSpot, - strCurrency - ); - - String[] astrCDSMaturityTenor = new String[] { - "06M", - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "07Y", - "10Y" - }; - - double[] adblCDSParSpread = new double[] { - 60., // 6M - 68., // 1Y - 88., // 2Y - 102., // 3Y - 121., // 4Y - 138., // 5Y - 168., // 7Y - 188. // 10Y - }; - - CreditCurve cc = LatentMarketStateBuilder.CreditCurve ( - dtSpot, - "QTX", - astrCDSMaturityTenor, - adblCDSParSpread, - adblCDSParSpread, - "FairPremium", - dcOvernight - ); - - String strLatentStateLabel = cc.label().fullyQualifiedName(); - - System.out.println ("\n\n\t||----------------------------------------------------------||"); - - for (int i = 0; i < adblCDSParSpread.length; ++i) - System.out.println ( - "\t|| " + strLatentStateLabel + - " | CDS | " + astrCDSMaturityTenor[i] + " | " + - FormatUtil.FormatDouble (adblCDSParSpread[i], 3, 1, 1.) + - " | Fair Premium | " + - FormatUtil.FormatDouble (cc.survival (astrCDSMaturityTenor[i]), 1, 6, 1.) + - " ||" - ); - - System.out.println ("\t||----------------------------------------------------------||\n"); - } -} diff --git a/org/drip/template/statebump/DerivedForwardStateShifted.java b/org/drip/template/statebump/DerivedForwardStateShifted.java deleted file mode 100644 index 9a2db6a..0000000 --- a/org/drip/template/statebump/DerivedForwardStateShifted.java +++ /dev/null @@ -1,734 +0,0 @@ - -package org.drip.template.statebump; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.definition.Component; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * DerivedForwardStateShifted demonstrates the Generation of Tenor-bumped Derived Forward State. - * - * @author Lakshmi Krishnamurthy - */ - -public class DerivedForwardStateShifted { - - private static final MergedDiscountForwardCurve OvernightCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrDepositMaturityTenor = new String[] { - "1D", - "2D", - "3D" - }; - - double[] adblDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - String[] astrShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - String[] astrOISFuturesEffectiveTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - String[] astrOISFuturesMaturityTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - double[] adblOISFuturesQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - String[] astrLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - return LatentMarketStateBuilder.SmoothOvernightCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "Rate", - astrShortEndOISMaturityTenor, - adblShortEndOISQuote, - "SwapRate", - astrOISFuturesEffectiveTenor, - astrOISFuturesMaturityTenor, - adblOISFuturesQuote, - "SwapRate", - astrLongEndOISMaturityTenor, - adblLongEndOISQuote, - "SwapRate" - ); - } - - private static final ForwardCurve Reference ( - final JulianDate dtSpot, - final MergedDiscountForwardCurve dcOvernight, - final String strReferenceForwardTenor) - throws Exception - { - ForwardLabel forwardLabel = ForwardLabel.Create ( - dcOvernight.currency(), - strReferenceForwardTenor - ); - - String[] astrDepositMaturityTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - double[] adblDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - String[] astrFRAMaturityTenor = new String[] { - "00D", - "01M", - "02M", - "03M", - "04M", - "05M", - "06M", - "07M", - "08M", - "09M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - double[] adblFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - return LatentMarketStateBuilder.SmoothForwardCurve ( - dtSpot, - forwardLabel, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - astrFRAMaturityTenor, - adblFRAQuote, - "ParForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - dcOvernight, - null - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strCurrency = "GBP"; - String strDerivedForwardTenor = "3M"; - String strReferenceForwardTenor = "6M"; - double dblBump = 0.0001; - boolean bIsProportional = false; - - JulianDate dtSpot = DateUtil.Today(); - - MergedDiscountForwardCurve dcOvernight = OvernightCurve ( - dtSpot, - strCurrency - ); - - ForwardCurve fcReference = Reference ( - dtSpot, - dcOvernight, - strReferenceForwardTenor - ); - - ForwardLabel forwardLabel = ForwardLabel.Create ( - strCurrency, - strDerivedForwardTenor - ); - - String[] astrDepositMaturityTenor = new String[] { - "2W", - "3W", - "1M", - "2M" - }; - - double[] adblDepositQuote = new double[] { - 0.001865, // 2W - 0.001969, // 3W - 0.001951, // 1M - 0.001874 // 2M - }; - - String[] astrFRAMaturityTenor = new String[] { - "00D", - "01M", - "03M", - "06M", - "09M", - "12M", - "15M", - "18M", - "21M" - }; - - double[] adblFRAQuote = new double[] { - 0.001790, // 0D - 0.001775, // 1M - 0.001274, // 3M - 0.001222, // 6M - 0.001269, // 9M - 0.001565, // 12M - 0.001961, // 15M - 0.002556, // 18M - 0.003101 // 21M - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.002850, // 3Y - 0.004370, // 4Y - 0.006230, // 5Y - 0.008170, // 6Y - 0.010000, // 7Y - 0.011710, // 8Y - 0.013240, // 9Y - 0.014590, // 10Y - 0.016920, // 12Y - 0.019330, // 15Y - 0.020990, // 20Y - 0.021560, // 25Y - 0.021860 // 30Y - }; - - String[] astrSyntheticFloatFloatMaturityTenor = new String[] { - "35Y", - "40Y", - "50Y", - "60Y" - }; - - double[] adblSyntheticFloatFloatQuote = new double[] { - 0.00065, // 35Y - 0.00060, // 40Y - 0.00054, // 50Y - 0.00050 // 60Y - }; - - Map mapDerivedForwardCurve = LatentMarketStateBuilder.BumpedForwardCurve ( - dtSpot, - forwardLabel, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - astrFRAMaturityTenor, - adblFRAQuote, - "ParForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - astrSyntheticFloatFloatMaturityTenor, - adblSyntheticFloatFloatQuote, - "DerivedParBasisSpread", - dcOvernight, - fcReference, - LatentMarketStateBuilder.SMOOTH, - dblBump, - bIsProportional - ); - - Component[] aDepositComp = OTCInstrumentBuilder.ForwardRateDeposit ( - dtSpot, - astrDepositMaturityTenor, - forwardLabel - ); - - Component[] aFRAComp = OTCInstrumentBuilder.FRAStandard ( - dtSpot, - forwardLabel, - astrFRAMaturityTenor, - adblFRAQuote - ); - - Component[] aFixFloatComp = OTCInstrumentBuilder.FixFloatCustom ( - dtSpot, - forwardLabel, - astrFixFloatMaturityTenor - ); - - Component[] aSyntheticFloatFloatComp = OTCInstrumentBuilder.FloatFloat ( - dtSpot, - strCurrency, - strDerivedForwardTenor, - astrSyntheticFloatFloatMaturityTenor, - 0. - ); - - ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); - - System.out.println ("\n\t|--------------------------------------------------------------||"); - - for (Map.Entry meForward : mapDerivedForwardCurve.entrySet()) { - String strKey = meForward.getKey(); - - if (!strKey.startsWith ("deposit")) continue; - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState (dcOvernight); - - csqc.setForwardState (fcReference); - - csqc.setForwardState (meForward.getValue()); - - System.out.print ("\t| [" + meForward.getKey() + "] => "); - - for (Component comp : aDepositComp) - System.out.print (FormatUtil.FormatDouble ( - comp.measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |" - ); - - System.out.print ("|\n"); - } - - System.out.println ("\t|--------------------------------------------------------------||"); - - System.out.println ("\n\t|---------------------------------------------------------------------------------------||"); - - for (Map.Entry meForward : mapDerivedForwardCurve.entrySet()) { - String strKey = meForward.getKey(); - - if (!strKey.startsWith ("fra")) continue; - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState (dcOvernight); - - csqc.setForwardState (fcReference); - - csqc.setForwardState (meForward.getValue()); - - System.out.print ("\t| [" + meForward.getKey() + "] => "); - - for (Component comp : aFRAComp) - System.out.print (FormatUtil.FormatDouble ( - comp.measureValue ( - valParams, - null, - csqc, - null, - "ParForwardRate" - ), 1, 4, 1.) + " |" - ); - - System.out.print ("|\n"); - } - - System.out.println ("\t|---------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|----------------------------------------------------------------------------------------------------------------------------||"); - - for (Map.Entry meForward : mapDerivedForwardCurve.entrySet()) { - String strKey = meForward.getKey(); - - if (!strKey.startsWith ("fixfloat")) continue; - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState (dcOvernight); - - csqc.setForwardState (fcReference); - - csqc.setForwardState (meForward.getValue()); - - System.out.print ("\t| [" + meForward.getKey() + "] => "); - - for (Component comp : aFixFloatComp) - System.out.print (FormatUtil.FormatDouble ( - comp.measureValue ( - valParams, - null, - csqc, - null, - "SwapRate" - ), 1, 4, 1.) + " |" - ); - - System.out.print ("|\n"); - } - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|-----------------------------------------------------------||"); - - for (Map.Entry meForward : mapDerivedForwardCurve.entrySet()) { - String strKey = meForward.getKey(); - - if (!strKey.startsWith ("syntheticfloatfloat")) continue; - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState (dcOvernight); - - csqc.setForwardState (fcReference); - - csqc.setForwardState (meForward.getValue()); - - System.out.print ("\t| [" + meForward.getKey() + "] => "); - - for (Component comp : aSyntheticFloatFloatComp) - System.out.print (FormatUtil.FormatDouble ( - comp.measureValue ( - valParams, - null, - csqc, - null, - "DerivedParBasisSpread" - ), 1, 4, 1.) + " |" - ); - - System.out.print ("|\n"); - } - - System.out.println ("\t|-----------------------------------------------------------||"); - - System.out.println ("\n\t|-----------------------------------------------------||"); - - CurveSurfaceQuoteContainer csqcBase = new CurveSurfaceQuoteContainer(); - - csqcBase.setFundingState (dcOvernight); - - csqcBase.setForwardState (fcReference); - - csqcBase.setForwardState (mapDerivedForwardCurve.get ("Base")); - - CurveSurfaceQuoteContainer csqcBump = new CurveSurfaceQuoteContainer(); - - csqcBump.setFundingState (dcOvernight); - - csqcBump.setForwardState (fcReference); - - csqcBump.setForwardState (mapDerivedForwardCurve.get ("Bump")); - - for (Component comp : aDepositComp) - System.out.println ( - "\t| FORWARD RATE => " + - comp.maturityDate() + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBase, - null, - "ForwardRate" - ), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBump, - null, - "ForwardRate" - ), 1, 6, 1.) + " ||" - ); - - for (Component comp : aFRAComp) - System.out.println ( - "\t| FORWARD RATE => " + - comp.maturityDate() + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBase, - null, - "ParForwardRate" - ), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBase, - null, - "ParForwardRate" - ), 1, 6, 1.) + " ||" - ); - - for (Component comp : aFixFloatComp) - System.out.println ( - "\t| SWAP RATE => " + - comp.maturityDate() + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBase, - null, - "SwapRate" - ), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBump, - null, - "SwapRate" - ), 1, 6, 1.) + " ||" - ); - - for (Component comp : aSyntheticFloatFloatComp) - System.out.println ( - "\t| DERIVED BASIS => " + - comp.maturityDate() + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBase, - null, - "DerivedParBasisSpread" - ), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBump, - null, - "DerivedParBasisSpread" - ), 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-----------------------------------------------------||"); - } -} diff --git a/org/drip/template/statebump/FXStateShifted.java b/org/drip/template/statebump/FXStateShifted.java deleted file mode 100644 index 116d797..0000000 --- a/org/drip/template/statebump/FXStateShifted.java +++ /dev/null @@ -1,202 +0,0 @@ - -package org.drip.template.statebump; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.definition.Component; -import org.drip.product.fx.FXForwardComponent; -import org.drip.product.params.CurrencyPair; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; -import org.drip.state.fx.FXCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FXStateShifted demonstrates the Generation and the Usage of Tenor Bumped FX Curves. - * - * @author Lakshmi Krishnamurthy - */ - -public class FXStateShifted { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - CurrencyPair cp = new CurrencyPair ( - "EUR", - "USD", - "USD", - 10000. - ); - - JulianDate dtSpot = DateUtil.Today().addBusDays ( - 0, - cp.denomCcy() - ); - - double dblFXSpot = 1.1013; - double dblBump = 0.0001; - boolean bIsBumpProportional = false; - - String[] astrMaturityTenor = new String[] { - "1D", - "2D", - "3D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "6M", - "9M" - }; - - double[] adblFXForward = new double[] { - 1.1011, // "1D" - 1.1007, // "2D" - 1.0999, // "3D" - 1.0976, // "1W" - 1.0942, // "2W" - 1.0904, // "3W" - 1.0913, // "1M" - 1.0980, // "2M" - 1.1088, // "3M" - 1.1115, // "6M" - 1.1011 // "9M" - }; - - Map mapBumpedFXCurve = LatentMarketStateBuilder.BumpedFXCurve ( - dtSpot, - cp, - astrMaturityTenor, - adblFXForward, - "Outright", - dblFXSpot, - LatentMarketStateBuilder.SMOOTH, - dblBump, - bIsBumpProportional - ); - - FXForwardComponent[] aFXFC = OTCInstrumentBuilder.FXForward ( - dtSpot, - cp, - astrMaturityTenor - ); - - System.out.println ("\n\t|-------------------------------------------------------------------------------------------------------------------||"); - - ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); - - for (Map.Entry meFX : mapBumpedFXCurve.entrySet()) { - String strKey = meFX.getKey(); - - if (!strKey.startsWith ("fxfwd")) continue; - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFXState (meFX.getValue()); - - System.out.print ("\t| [" + meFX.getKey() + "] => "); - - for (Component comp : aFXFC) - System.out.print (FormatUtil.FormatDouble ( - comp.measureValue ( - valParams, - null, - csqc, - null, - "Outright" - ), 1, 4, 1.) + " |"); - - System.out.print ("|\n"); - } - - System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|---------------------------------------------||"); - - CurveSurfaceQuoteContainer csqcBase = new CurveSurfaceQuoteContainer(); - - csqcBase.setFXState (mapBumpedFXCurve.get ("Base")); - - CurveSurfaceQuoteContainer csqcBump = new CurveSurfaceQuoteContainer(); - - csqcBump.setFXState (mapBumpedFXCurve.get ("Bump")); - - for (Component comp : aFXFC) - System.out.println ( - "\t| OUTRIGHT => " + - comp.maturityDate() + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBase, - null, - "Outright" - ), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBump, - null, - "Outright" - ), 1, 4, 1.) + " ||" - ); - - System.out.println ("\t|---------------------------------------------||"); - } -} diff --git a/org/drip/template/statebump/ForwardVolatilityStateShifted.java b/org/drip/template/statebump/ForwardVolatilityStateShifted.java deleted file mode 100644 index 1283527..0000000 --- a/org/drip/template/statebump/ForwardVolatilityStateShifted.java +++ /dev/null @@ -1,259 +0,0 @@ - -package org.drip.template.statebump; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.definition.Component; -import org.drip.product.fra.FRAStandardCapFloor; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; -import org.drip.state.discount.MergedDiscountForwardCurve; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; -import org.drip.state.volatility.VolatilityCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ForwardVolatilityStateShifted demonstrates the Generation and the Usage of Tenor Bumped Forward Volatility - * Curves. - * - * @author Lakshmi Krishnamurthy - */ - -public class ForwardVolatilityStateShifted { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strFRATenor = "3M"; - String strCurrency = "GBP"; - double dblBump = 0.0000001; - boolean bIsBumpProportional = false; - - JulianDate dtSpot = DateUtil.Today(); - - ForwardLabel forwardLabel = ForwardLabel.Create ( - strCurrency, - strFRATenor - ); - - MergedDiscountForwardCurve dcFunding = LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "30D", - "60D", - "91D", - "182D", - "273D" - }, - new double[] { - 0.0668750, // 30D - 0.0675000, // 60D - 0.0678125, // 91D - 0.0712500, // 182D - 0.0750000 // 273D - }, - "ForwardRate", - null, - "ForwardRate", - new String[] { - "2Y", - "3Y", - "4Y", - "5Y", - "7Y", - "10Y" - }, - new double[] { - 0.08265, // 2Y - 0.08550, // 3Y - 0.08655, // 4Y - 0.08770, // 5Y - 0.08910, // 7Y - 0.08920 // 10Y - }, - "SwapRate" - ); - - String[] astrMaturityTenor = new String[] { - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "07Y", - "10Y" - }; - - double[] adblStrike = new double[] { - 0.0788, // "1Y", - 0.0839, // "2Y", - 0.0864, // "3Y", - 0.0869, // "4Y", - 0.0879, // "5Y", - 0.0890, // "7Y", - 0.0889 // "10Y" - }; - - double[] adblPrice = new double[] { - 0.0017, // "1Y", - 0.0132, // "2Y", - 0.0234, // "3Y", - 0.0343, // "4Y", - 0.0471, // "5Y", - 0.0778, // "7Y" - 0.1125 // "10Y" - }; - - ForwardCurve fc = dcFunding.nativeForwardCurve (strFRATenor); - - Map bumpedForwardVolatilityCurve = LatentMarketStateBuilder.BumpedForwardVolatilityCurve ( - dtSpot, - forwardLabel, - true, - astrMaturityTenor, - adblStrike, - adblPrice, - "Price", - dcFunding, - fc, - dblBump, - bIsBumpProportional - ); - - FRAStandardCapFloor[] aFRACapFloor = OTCInstrumentBuilder.CapFloor ( - dtSpot, - forwardLabel, - astrMaturityTenor, - adblStrike, - true - ); - - System.out.println ("\n\t|---------------------------------------------------------------------------------------------------------------||"); - - ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); - - for (Map.Entry meForwardVolatility : bumpedForwardVolatilityCurve.entrySet()) { - String strKey = meForwardVolatility.getKey(); - - if (!strKey.startsWith ("capfloor")) continue; - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState (dcFunding); - - csqc.setForwardState (fc); - - csqc.setForwardVolatility (meForwardVolatility.getValue()); - - System.out.print ("\t| [" + meForwardVolatility.getKey() + "] => "); - - for (Component comp : aFRACapFloor) - System.out.print (FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqc, - null, - "Price" - ), 1, 8, 1.) + " |"); - - System.out.print ("|\n"); - } - - System.out.println ("\t|---------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|-------------------------------------------------||"); - - CurveSurfaceQuoteContainer csqcBase = new CurveSurfaceQuoteContainer(); - - csqcBase.setFundingState (dcFunding); - - csqcBase.setForwardState (fc); - - csqcBase.setForwardVolatility (bumpedForwardVolatilityCurve.get ("Base")); - - CurveSurfaceQuoteContainer csqcBump = new CurveSurfaceQuoteContainer(); - - csqcBump.setFundingState (dcFunding); - - csqcBump.setForwardState (fc); - - csqcBump.setForwardVolatility (bumpedForwardVolatilityCurve.get ("Bump")); - - for (Component comp : aFRACapFloor) - System.out.println ( - "\t| PRICE => " + - comp.maturityDate() + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBase, - null, - "Price" - ), 1, 8, 1.) + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBump, - null, - "Price" - ), 1, 8, 1.) + " ||" - ); - - System.out.println ("\t|-------------------------------------------------||"); - } -} diff --git a/org/drip/template/statebump/FundingStateShifted.java b/org/drip/template/statebump/FundingStateShifted.java deleted file mode 100644 index 4c404df..0000000 --- a/org/drip/template/statebump/FundingStateShifted.java +++ /dev/null @@ -1,342 +0,0 @@ - -package org.drip.template.statebump; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.definition.Component; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; -import org.drip.state.discount.MergedDiscountForwardCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FundingStateShifted generates a Sequence of Tenor Bumped Funding Curves. - * - * @author Lakshmi Krishnamurthy - */ - -public class FundingStateShifted { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "USD"; - double dblBump = 0.0001; - boolean bIsBumpProportional = false; - - JulianDate dtSpot = DateUtil.Today(); - - String[] astrDepositMaturityTenor = new String[] { - "01D", - "02D", - "07D", - "14D", - "30D", - "60D" - }; - - double[] adblDepositQuote = new double[] { - 0.0013, // 1D - 0.0017, // 2D - 0.0017, // 7D - 0.0018, // 14D - 0.0020, // 30D - 0.0023 // 60D - }; - - double[] adblFuturesQuote = new double[] { - 0.0027, - 0.0032, - 0.0041, - 0.0054, - 0.0077, - 0.0104, - 0.0134, - 0.0160 - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "40Y", - "50Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.0166, // 4Y - 0.0206, // 5Y - 0.0241, // 6Y - 0.0269, // 7Y - 0.0292, // 8Y - 0.0311, // 9Y - 0.0326, // 10Y - 0.0340, // 11Y - 0.0351, // 12Y - 0.0375, // 15Y - 0.0393, // 20Y - 0.0402, // 25Y - 0.0407, // 30Y - 0.0409, // 40Y - 0.0409 // 50Y - }; - - Map mapFundingCurve = LatentMarketStateBuilder.BumpedFundingCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - adblFuturesQuote, - "ForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate", - LatentMarketStateBuilder.SMOOTH, - dblBump, - bIsBumpProportional - ); - - Component[] aDepositComp = OTCInstrumentBuilder.FundingDeposit ( - dtSpot, - strCurrency, - astrDepositMaturityTenor - ); - - Component[] aFuturesComp = ExchangeInstrumentBuilder.ForwardRateFuturesPack ( - dtSpot, - adblFuturesQuote.length, - strCurrency - ); - - Component[] aFixFloatComp = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, - "ALL", - astrFixFloatMaturityTenor, - "MAIN", - 0. - ); - - ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); - - System.out.println ("\n\t|-------------------------------------------------------------------------||"); - - for (Map.Entry meFunding : mapFundingCurve.entrySet()) { - String strKey = meFunding.getKey(); - - if (!strKey.startsWith ("deposit")) continue; - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState (meFunding.getValue()); - - System.out.print ("\t| [" + meFunding.getKey() + "] => "); - - for (Component comp : aDepositComp) - System.out.print (FormatUtil.FormatDouble ( - comp.measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 4, 1.) + " |"); - - System.out.print ("|\n"); - } - - System.out.println ("\t|-------------------------------------------------------------------------||"); - - System.out.println ("\n\t|-----------------------------------------------------------------------------------------||"); - - for (Map.Entry meFunding : mapFundingCurve.entrySet()) { - String strKey = meFunding.getKey(); - - if (!strKey.startsWith ("futures")) continue; - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState (meFunding.getValue()); - - System.out.print ("\t| [" + meFunding.getKey() + "] => "); - - for (Component comp : aFuturesComp) - System.out.print (FormatUtil.FormatDouble ( - comp.measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 4, 1.) + " |"); - - System.out.print ("|\n"); - } - - System.out.println ("\t|-----------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|--------------------------------------------------------------------------------------------------------------------------------------------||"); - - for (Map.Entry meFunding : mapFundingCurve.entrySet()) { - String strKey = meFunding.getKey(); - - if (!strKey.startsWith ("fixfloat")) continue; - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState (meFunding.getValue()); - - System.out.print ("\t| [" + meFunding.getKey() + "] => "); - - for (Component comp : aFixFloatComp) - System.out.print (FormatUtil.FormatDouble ( - comp.measureValue ( - valParams, - null, - csqc, - null, - "SwapRate" - ), 1, 4, 1.) + " |"); - - System.out.print ("|\n"); - } - - System.out.println ("\t|--------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|-----------------------------------------------------||"); - - CurveSurfaceQuoteContainer csqcBase = new CurveSurfaceQuoteContainer(); - - csqcBase.setFundingState (mapFundingCurve.get ("Base")); - - CurveSurfaceQuoteContainer csqcBump = new CurveSurfaceQuoteContainer(); - - csqcBump.setFundingState (mapFundingCurve.get ("Bump")); - - for (Component comp : aDepositComp) - System.out.println ( - "\t| FORWARD RATE => " + - comp.maturityDate() + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBase, - null, - "ForwardRate" - ), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBump, - null, - "ForwardRate" - ), 1, 6, 1.) + " ||" - ); - - for (Component comp : aFuturesComp) - System.out.println ( - "\t| FORWARD RATE => " + - comp.maturityDate() + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBase, - null, - "ForwardRate" - ), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBump, - null, - "ForwardRate" - ), 1, 6, 1.) + " ||" - ); - - for (Component comp : aFixFloatComp) - System.out.println ( - "\t| SWAP RATE => " + - comp.maturityDate() + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBase, - null, - "SwapRate" - ), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBump, - null, - "SwapRate" - ), 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-----------------------------------------------------||"); - } -} diff --git a/org/drip/template/statebump/GovvieStateShifted.java b/org/drip/template/statebump/GovvieStateShifted.java deleted file mode 100644 index 859f994..0000000 --- a/org/drip/template/statebump/GovvieStateShifted.java +++ /dev/null @@ -1,211 +0,0 @@ - -package org.drip.template.statebump; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.credit.BondComponent; -import org.drip.product.govvie.TreasuryComponent; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; -import org.drip.state.govvie.GovvieCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * GovvieStateShifted demonstrates the Construction and Usage of Tenor Bumped Govvie Curves. - * - * @author Lakshmi Krishnamurthy - */ - -public class GovvieStateShifted { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.Today().addBusDays ( - 0, - "USD" - ); - - String strCode = "UST"; - double dblBump = 0.0001; - boolean bIsBumpProportional = false; - - JulianDate[] adtEffective = new JulianDate[] { - DateUtil.CreateFromYMD (2010, DateUtil.SEPTEMBER, 21), - DateUtil.CreateFromYMD (2009, DateUtil.JULY, 14), - DateUtil.CreateFromYMD (2011, DateUtil.MARCH, 8), - DateUtil.CreateFromYMD (2010, DateUtil.AUGUST, 25), - DateUtil.CreateFromYMD (2010, DateUtil.DECEMBER, 3) - }; - - JulianDate[] adtMaturity = new JulianDate[] { - dtSpot.addTenor ("2Y"), - dtSpot.addTenor ("4Y"), - dtSpot.addTenor ("5Y"), - dtSpot.addTenor ("7Y"), - dtSpot.addTenor ("10Y") - }; - - double[] adblCoupon = new double[] { - 0.0200, - 0.0250, - 0.0300, - 0.0325, - 0.0375 - }; - - double[] adblYield = new double[] { - 0.0200, - 0.0250, - 0.0300, - 0.0325, - 0.0375 - }; - - Map mapBumpedGovvieCurve = LatentMarketStateBuilder.BumpedGovvieCurve ( - strCode, - dtSpot, - adtEffective, - adtMaturity, - adblCoupon, - adblYield, - "Yield", - LatentMarketStateBuilder.SHAPE_PRESERVING, - dblBump, - bIsBumpProportional - ); - - TreasuryComponent[] aTreasury = TreasuryBuilder.FromCode ( - strCode, - adtEffective, - adtMaturity, - adblCoupon - ); - - ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); - - System.out.println ("\n\t|-------------------------------------------------------------------||"); - - for (Map.Entry meGovvie : mapBumpedGovvieCurve.entrySet()) { - String strKey = meGovvie.getKey(); - - if (!strKey.startsWith ("tsy")) continue; - - System.out.print ("\t| [" + meGovvie.getKey() + "] => "); - - GovvieCurve gc = meGovvie.getValue(); - - for (BondComponent treasury : aTreasury) - System.out.print (FormatUtil.FormatDouble (treasury.yieldFromPrice ( - valParams, - null, - null, - treasury.maturityDate().julian(), - 1., - treasury.priceFromYield ( - valParams, - null, - null, - gc.yield (treasury.maturityDate().julian()) - ) - ), 1, 4, 1.) + " |" - ); - - System.out.print ("|\n"); - } - - System.out.println ("\t|-------------------------------------------------------------------||"); - - System.out.println ("\n\t|-------------------------------------||"); - - GovvieCurve gcBase = mapBumpedGovvieCurve.get ("Base"); - - GovvieCurve gcBump = mapBumpedGovvieCurve.get ("Bump"); - - for (TreasuryComponent treasury : aTreasury) - System.out.println ( - "\t| YIELD => " + - treasury.maturityDate() + " |" + - FormatUtil.FormatDouble (treasury.yieldFromPrice ( - valParams, - null, - null, - treasury.maturityDate().julian(), - 1., - treasury.priceFromYield ( - valParams, - null, - null, - gcBase.yield (treasury.maturityDate().julian()) - ) - ), 1, 2, 100.) + "% |" + - FormatUtil.FormatDouble (treasury.yieldFromPrice ( - valParams, - null, - null, - treasury.maturityDate().julian(), - 1., - treasury.priceFromYield ( - valParams, - null, - null, - gcBump.yield (treasury.maturityDate().julian()) - ) - ), 1, 2, 100.) + "% ||" - ); - - System.out.println ("\t|-------------------------------------||"); - } -} diff --git a/org/drip/template/statebump/OvernightStateShifted.java b/org/drip/template/statebump/OvernightStateShifted.java deleted file mode 100644 index dd07f5a..0000000 --- a/org/drip/template/statebump/OvernightStateShifted.java +++ /dev/null @@ -1,432 +0,0 @@ - -package org.drip.template.statebump; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.definition.Component; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; -import org.drip.state.discount.MergedDiscountForwardCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * OvernightStateShifted demonstrates the Generation of the Tenor Bumped Overnight Curves. - * - * @author Lakshmi Krishnamurthy - */ - -public class OvernightStateShifted { - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - String strCurrency = "EUR"; - double dblBump = 0.0001; - boolean bIsBumpProportional = false; - - JulianDate dtSpot = DateUtil.Today(); - - String[] astrDepositMaturityTenor = new String[] { - "01D", - "02D", - "03D" - }; - - double[] adblDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - String[] astrShortEndOISMaturityTenor = new String[] { - "01W", - "02W", - "03W", - "01M" - }; - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - String[] astrOISFuturesEffectiveTenor = new String[] { - "01M", - "02M", - "03M", - "04M", - "05M" - }; - - String[] astrOISFuturesMaturityTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - double[] adblOISFuturesQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - String[] astrLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - Map bumpedOvernightCurve = LatentMarketStateBuilder.BumpedOvernightCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - astrShortEndOISMaturityTenor, - adblShortEndOISQuote, - "SwapRate", - astrOISFuturesEffectiveTenor, - astrOISFuturesMaturityTenor, - adblOISFuturesQuote, - "SwapRate", - astrLongEndOISMaturityTenor, - adblLongEndOISQuote, - "SwapRate", - LatentMarketStateBuilder.SMOOTH, - dblBump, - bIsBumpProportional - ); - - Component[] aDepositComp = OTCInstrumentBuilder.OvernightDeposit ( - dtSpot, - strCurrency, - astrDepositMaturityTenor - ); - - Component[] aShortEndOISComp = OTCInstrumentBuilder.OISFixFloat ( - dtSpot, - strCurrency, - astrShortEndOISMaturityTenor, - adblShortEndOISQuote, - false - ); - - Component[] aOISFuturesComp = OTCInstrumentBuilder.OISFixFloatFutures ( - dtSpot, - strCurrency, - astrOISFuturesEffectiveTenor, - astrOISFuturesMaturityTenor, - adblOISFuturesQuote, - false - ); - - Component[] aLongEndOISComp = OTCInstrumentBuilder.OISFixFloat ( - dtSpot, - strCurrency, - astrLongEndOISMaturityTenor, - adblLongEndOISQuote, - false - ); - - System.out.println ("\n\t|----------------------------------------------||"); - - ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); - - for (Map.Entry meFunding : bumpedOvernightCurve.entrySet()) { - String strKey = meFunding.getKey(); - - if (!strKey.startsWith ("deposit")) continue; - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState (meFunding.getValue()); - - System.out.print ("\t| [" + meFunding.getKey() + "] => "); - - for (Component comp : aDepositComp) - System.out.print (FormatUtil.FormatDouble ( - comp.measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 4, 1.) + " |"); - - System.out.print ("|\n"); - } - - System.out.println ("\t|----------------------------------------------||"); - - System.out.println ("\n\t|---------------------------------------------------------------||"); - - for (Map.Entry meFunding : bumpedOvernightCurve.entrySet()) { - String strKey = meFunding.getKey(); - - if (!strKey.startsWith ("shortendois")) continue; - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState (meFunding.getValue()); - - System.out.print ("\t| [" + meFunding.getKey() + "] => "); - - for (Component comp : aShortEndOISComp) - System.out.print (FormatUtil.FormatDouble ( - comp.measureValue ( - valParams, - null, - csqc, - null, - "SwapRate" - ), 1, 4, 1.) + " |"); - - System.out.print ("|\n"); - } - - System.out.println ("\t|---------------------------------------------------------------||"); - - System.out.println ("\n\t|-----------------------------------------------------------------------------||"); - - for (Map.Entry meFunding : bumpedOvernightCurve.entrySet()) { - String strKey = meFunding.getKey(); - - if (!strKey.startsWith ("oisfutures")) continue; - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState (meFunding.getValue()); - - System.out.print ("\t| [" + meFunding.getKey() + "] => "); - - for (Component comp : aOISFuturesComp) - System.out.print (FormatUtil.FormatDouble ( - comp.measureValue ( - valParams, - null, - csqc, - null, - "SwapRate" - ), 1, 4, 1.) + " |"); - - System.out.print ("|\n"); - } - - System.out.println ("\t|-----------------------------------------------------------------------------||"); - - System.out.println ("\n\t|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - for (Map.Entry meFunding : bumpedOvernightCurve.entrySet()) { - String strKey = meFunding.getKey(); - - if (!strKey.startsWith ("longendois")) continue; - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState (meFunding.getValue()); - - System.out.print ("\t| [" + meFunding.getKey() + "] => "); - - for (Component comp : aLongEndOISComp) - System.out.print (FormatUtil.FormatDouble ( - comp.measureValue ( - valParams, - null, - csqc, - null, - "SwapRate" - ), 1, 4, 1.) + " |"); - - System.out.print ("|\n"); - } - - System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|-----------------------------------------------------||"); - - CurveSurfaceQuoteContainer csqcBase = new CurveSurfaceQuoteContainer(); - - csqcBase.setFundingState (bumpedOvernightCurve.get ("Base")); - - CurveSurfaceQuoteContainer csqcBump = new CurveSurfaceQuoteContainer(); - - csqcBump.setFundingState (bumpedOvernightCurve.get ("Bump")); - - for (Component comp : aDepositComp) - System.out.println ( - "\t| FORWARD RATE => " + - comp.maturityDate() + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBase, - null, - "ForwardRate" - ), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBump, - null, - "ForwardRate" - ), 1, 6, 1.) + " ||" - ); - - for (Component comp : aShortEndOISComp) - System.out.println ( - "\t| SWAP RATE => " + - comp.maturityDate() + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBase, - null, - "SwapRate" - ), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBump, - null, - "SwapRate" - ), 1, 6, 1.) + " ||" - ); - - for (Component comp : aOISFuturesComp) - System.out.println ( - "\t| SWAP RATE => " + - comp.maturityDate() + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBase, - null, - "SwapRate" - ), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBump, - null, - "SwapRate" - ), 1, 6, 1.) + " ||" - ); - - for (Component comp : aLongEndOISComp) - System.out.println ( - "\t| SWAP RATE => " + - comp.maturityDate() + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBase, - null, - "SwapRate" - ), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBump, - null, - "SwapRate" - ), 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-----------------------------------------------------||"); - } -} diff --git a/org/drip/template/statebump/ReferenceForwardStateShifted.java b/org/drip/template/statebump/ReferenceForwardStateShifted.java deleted file mode 100644 index 2e13eb6..0000000 --- a/org/drip/template/statebump/ReferenceForwardStateShifted.java +++ /dev/null @@ -1,532 +0,0 @@ - -package org.drip.template.statebump; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.definition.Component; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; -import org.drip.state.discount.*; -import org.drip.state.forward.ForwardCurve; -import org.drip.state.identifier.ForwardLabel; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * ReferenceForwardStateShifted demonstrates the Generation of the Shifted Reference Forward Curves. - * - * @author Lakshmi Krishnamurthy - */ - -public class ReferenceForwardStateShifted { - - private static final MergedDiscountForwardCurve OvernightCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrDepositMaturityTenor = new String[] { - "1D", - "2D", - "3D" - }; - - double[] adblDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - String[] astrShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - String[] astrOISFuturesEffectiveTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - String[] astrOISFuturesMaturityTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - double[] adblOISFuturesQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - String[] astrLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - return LatentMarketStateBuilder.SmoothOvernightCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "Rate", - astrShortEndOISMaturityTenor, - adblShortEndOISQuote, - "SwapRate", - astrOISFuturesEffectiveTenor, - astrOISFuturesMaturityTenor, - adblOISFuturesQuote, - "SwapRate", - astrLongEndOISMaturityTenor, - adblLongEndOISQuote, - "SwapRate" - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strCurrency = "GBP"; - String strForwardTenor = "6M"; - double dblBump = 0.0001; - boolean bIsProportional = false; - - JulianDate dtSpot = DateUtil.Today(); - - MergedDiscountForwardCurve dcOvernight = OvernightCurve ( - dtSpot, - strCurrency - ); - - ForwardLabel forwardLabel = ForwardLabel.Create ( - strCurrency, - strForwardTenor - ); - - String[] astrDepositMaturityTenor = new String[] { - "1D", - "1W", - "2W", - "3W", - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - double[] adblDepositQuote = new double[] { - 0.003565, // 1D - 0.003858, // 1W - 0.003840, // 2W - 0.003922, // 3W - 0.003869, // 1M - 0.003698, // 2M - 0.003527, // 3M - 0.003342, // 4M - 0.003225 // 5M - }; - - String[] astrFRAMaturityTenor = new String[] { - "00D", - "01M", - "02M", - "03M", - "04M", - "05M", - "06M", - "07M", - "08M", - "09M", - "10M", - "11M", - "12M", - "13M", - "14M", - "15M", - "16M", - "17M", - "18M" - }; - - double[] adblFRAQuote = new double[] { - 0.003120, // 0D - 0.002930, // 1M - 0.002720, // 2M - 0.002600, // 3M - 0.002560, // 4M - 0.002520, // 5M - 0.002480, // 6M - 0.002540, // 7M - 0.002610, // 8M - 0.002670, // 9M - 0.002790, // 10M - 0.002910, // 11M - 0.003030, // 12M - 0.003180, // 13M - 0.003350, // 14M - 0.003520, // 15M - 0.003710, // 16M - 0.003890, // 17M - 0.004090 // 18M - }; - - String[] astrFixFloatMaturityTenor = new String[] { - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y", - "35Y", - "40Y", - "50Y", - "60Y" - }; - - double[] adblFixFloatQuote = new double[] { - 0.004240, // 3Y - 0.005760, // 4Y - 0.007620, // 5Y - 0.009540, // 6Y - 0.011350, // 7Y - 0.013030, // 8Y - 0.014520, // 9Y - 0.015840, // 10Y - 0.018090, // 12Y - 0.020370, // 15Y - 0.021870, // 20Y - 0.022340, // 25Y - 0.022560, // 30Y - 0.022950, // 35Y - 0.023480, // 40Y - 0.024210, // 50Y - 0.024630 // 60Y - }; - - Map mapReferenceForwardCurve = LatentMarketStateBuilder.BumpedForwardCurve ( - dtSpot, - forwardLabel, - astrDepositMaturityTenor, - adblDepositQuote, - "ForwardRate", - astrFRAMaturityTenor, - adblFRAQuote, - "ParForwardRate", - astrFixFloatMaturityTenor, - adblFixFloatQuote, - "SwapRate", - null, - null, - "DerivedParBasisSpread", - null, - null, - "DerivedParBasisSpread", - dcOvernight, - null, - LatentMarketStateBuilder.SMOOTH, - dblBump, - bIsProportional - ); - - Component[] aDepositComp = OTCInstrumentBuilder.ForwardRateDeposit ( - dtSpot, - astrDepositMaturityTenor, - forwardLabel - ); - - Component[] aFRAComp = OTCInstrumentBuilder.FRAStandard ( - dtSpot, - forwardLabel, - astrFRAMaturityTenor, - adblFRAQuote - ); - - Component[] aFixFloatComp = OTCInstrumentBuilder.FixFloatCustom ( - dtSpot, - forwardLabel, - astrFixFloatMaturityTenor - ); - - System.out.println ("\n\t|---------------------------------------------------------------------------------------------------------------------||"); - - ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); - - for (Map.Entry meForward : mapReferenceForwardCurve.entrySet()) { - String strKey = meForward.getKey(); - - if (!strKey.startsWith ("deposit")) continue; - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState (dcOvernight); - - csqc.setForwardState (meForward.getValue()); - - System.out.print ("\t| [" + meForward.getKey() + "] => "); - - for (Component comp : aDepositComp) - System.out.print (FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqc, - null, - "ForwardRate" - ), 1, 6, 1.) + " |"); - - System.out.print ("|\n"); - } - - System.out.println ("\t|---------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - for (Map.Entry meForward : mapReferenceForwardCurve.entrySet()) { - String strKey = meForward.getKey(); - - if (!strKey.startsWith ("fra")) continue; - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState (dcOvernight); - - csqc.setForwardState (meForward.getValue()); - - System.out.print ("\t| [" + meForward.getKey() + "] => "); - - for (Component comp : aFRAComp) - System.out.print (FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqc, - null, - "ParForwardRate" - ), 1, 6, 1.) + " |"); - - System.out.print ("|\n"); - } - - System.out.println ("\t|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - for (Map.Entry meForward : mapReferenceForwardCurve.entrySet()) { - String strKey = meForward.getKey(); - - if (!strKey.startsWith ("fixfloat")) continue; - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState (dcOvernight); - - csqc.setForwardState (meForward.getValue()); - - System.out.print ("\t| [" + meForward.getKey() + "] => "); - - for (Component comp : aFixFloatComp) - System.out.print (FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqc, - null, - "SwapRate" - ), 1, 6, 1.) + " |"); - - System.out.print ("|\n"); - } - - System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------||"); - - System.out.println ("\n\t|-----------------------------------------------------||"); - - CurveSurfaceQuoteContainer csqcBase = new CurveSurfaceQuoteContainer(); - - csqcBase.setFundingState (dcOvernight); - - csqcBase.setForwardState (mapReferenceForwardCurve.get ("Base")); - - CurveSurfaceQuoteContainer csqcBump = new CurveSurfaceQuoteContainer(); - - csqcBump.setFundingState (dcOvernight); - - csqcBump.setForwardState (mapReferenceForwardCurve.get ("Bump")); - - for (Component comp : aDepositComp) - System.out.println ( - "\t| FORWARD RATE => " + - comp.maturityDate() + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBase, - null, - "ForwardRate" - ), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBump, - null, - "ForwardRate" - ), 1, 6, 1.) + " ||" - ); - - for (Component comp : aFRAComp) - System.out.println ( - "\t| FORWARD RATE => " + - comp.maturityDate() + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBase, - null, - "ParForwardRate" - ), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBump, - null, - "ParForwardRate" - ), 1, 6, 1.) + " ||" - ); - - for (Component comp : aFixFloatComp) - System.out.println ( - "\t| SWAP RATE => " + - comp.maturityDate() + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBase, - null, - "SwapRate" - ), 1, 6, 1.) + " | " + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBump, - null, - "SwapRate" - ), 1, 6, 1.) + " ||" - ); - - System.out.println ("\t|-----------------------------------------------------||"); - } -} diff --git a/org/drip/template/statebump/SurvivalRecoveryStateShifted.java b/org/drip/template/statebump/SurvivalRecoveryStateShifted.java deleted file mode 100644 index bdc679a..0000000 --- a/org/drip/template/statebump/SurvivalRecoveryStateShifted.java +++ /dev/null @@ -1,320 +0,0 @@ - -package org.drip.template.statebump; - -import java.util.Map; - -import org.drip.analytics.date.*; -import org.drip.param.market.CurveSurfaceQuoteContainer; -import org.drip.param.valuation.ValuationParams; -import org.drip.product.definition.Component; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.*; -import org.drip.state.credit.CreditCurve; -import org.drip.state.discount.MergedDiscountForwardCurve; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * SurvivalRecoveryStateShifted demonstrates the Generation of the Tenor Bumped Credit Curves. - * - * @author Lakshmi Krishnamurthy - */ - -public class SurvivalRecoveryStateShifted { - - private static final MergedDiscountForwardCurve OvernightCurve ( - final JulianDate dtSpot, - final String strCurrency) - throws Exception - { - String[] astrDepositMaturityTenor = new String[] { - "1D", - "2D", - "3D" - }; - - double[] adblDepositQuote = new double[] { - 0.0004, // 1D - 0.0004, // 2D - 0.0004 // 3D - }; - - String[] astrShortEndOISMaturityTenor = new String[] { - "1W", - "2W", - "3W", - "1M" - }; - - double[] adblShortEndOISQuote = new double[] { - 0.00070, // 1W - 0.00069, // 2W - 0.00078, // 3W - 0.00074 // 1M - }; - - String[] astrOISFuturesEffectiveTenor = new String[] { - "1M", - "2M", - "3M", - "4M", - "5M" - }; - - String[] astrOISFuturesMaturityTenor = new String[] { - "1M", - "1M", - "1M", - "1M", - "1M" - }; - - double[] adblOISFuturesQuote = new double[] { - 0.00046, // 1M x 1M - 0.00016, // 2M x 1M - -0.00007, // 3M x 1M - -0.00013, // 4M x 1M - -0.00014 // 5M x 1M - }; - - String[] astrLongEndOISMaturityTenor = new String[] { - "15M", - "18M", - "21M", - "02Y", - "03Y", - "04Y", - "05Y", - "06Y", - "07Y", - "08Y", - "09Y", - "10Y", - "11Y", - "12Y", - "15Y", - "20Y", - "25Y", - "30Y" - }; - - double[] adblLongEndOISQuote = new double[] { - 0.00002, // 15M - 0.00008, // 18M - 0.00021, // 21M - 0.00036, // 2Y - 0.00127, // 3Y - 0.00274, // 4Y - 0.00456, // 5Y - 0.00647, // 6Y - 0.00827, // 7Y - 0.00996, // 8Y - 0.01147, // 9Y - 0.01280, // 10Y - 0.01404, // 11Y - 0.01516, // 12Y - 0.01764, // 15Y - 0.01939, // 20Y - 0.02003, // 25Y - 0.02038 // 30Y - }; - - return LatentMarketStateBuilder.SmoothOvernightCurve ( - dtSpot, - strCurrency, - astrDepositMaturityTenor, - adblDepositQuote, - "Rate", - astrShortEndOISMaturityTenor, - adblShortEndOISQuote, - "SwapRate", - astrOISFuturesEffectiveTenor, - astrOISFuturesMaturityTenor, - adblOISFuturesQuote, - "SwapRate", - astrLongEndOISMaturityTenor, - adblLongEndOISQuote, - "SwapRate" - ); - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - /* - * Initialize the Credit Analytics Library - */ - - EnvManager.InitEnv (""); - - String strCurrency = "EUR"; - double dblBump = 1.0; - boolean bIsBumpProportional = false; - - JulianDate dtSpot = DateUtil.Today().addBusDays ( - 2, - strCurrency - ); - - MergedDiscountForwardCurve dcOvernight = OvernightCurve ( - dtSpot, - strCurrency - ); - - String[] astrCDSMaturityTenor = new String[] { - "06M", - "01Y", - "02Y", - "03Y", - "04Y", - "05Y", - "07Y", - "10Y" - }; - - double[] adblCDSParSpread = new double[] { - 60., // 6M - 68., // 1Y - 88., // 2Y - 102., // 3Y - 121., // 4Y - 138., // 5Y - 168., // 7Y - 188. // 10Y - }; - - Map mapBumpedCreditCurve = LatentMarketStateBuilder.BumpedCreditCurve ( - dtSpot, - "QTX", - astrCDSMaturityTenor, - adblCDSParSpread, - adblCDSParSpread, - "FairPremium", - dcOvernight, - dblBump, - bIsBumpProportional - ); - - Component[] aCDS = OTCInstrumentBuilder.CDS ( - dtSpot, - astrCDSMaturityTenor, - adblCDSParSpread, - strCurrency, - "QTX" - ); - - System.out.println ("\n\t|----------------------------------------------------------------------------||"); - - ValuationParams valParams = ValuationParams.Spot (dtSpot.julian()); - - for (Map.Entry meCredit : mapBumpedCreditCurve.entrySet()) { - String strKey = meCredit.getKey(); - - if (!strKey.startsWith ("cds")) continue; - - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); - - csqc.setFundingState (dcOvernight); - - csqc.setCreditState (meCredit.getValue()); - - System.out.print ("\t| [" + meCredit.getKey() + "] => "); - - for (Component comp : aCDS) - System.out.print (FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqc, - null, - "FairPremium" - ), 1, 1, 1.) + " |"); - - System.out.print ("|\n"); - } - - System.out.println ("\t|----------------------------------------------------------------------------||"); - - System.out.println ("\n\t|--------------------------------------------||"); - - CurveSurfaceQuoteContainer csqcBase = new CurveSurfaceQuoteContainer(); - - csqcBase.setFundingState (dcOvernight); - - csqcBase.setCreditState (mapBumpedCreditCurve.get ("Base")); - - CurveSurfaceQuoteContainer csqcBump = new CurveSurfaceQuoteContainer(); - - csqcBump.setFundingState (dcOvernight); - - csqcBump.setCreditState (mapBumpedCreditCurve.get ("Bump")); - - for (Component comp : aCDS) - System.out.println ( - "\t| FAIR PREMIUM => " + - comp.maturityDate() + " |" + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBase, - null, - "FairPremium" - ), 3, 1, 1.) + " |" + - FormatUtil.FormatDouble (comp.measureValue ( - valParams, - null, - csqcBump, - null, - "FairPremium" - ), 3, 1, 1.) + " ||" - ); - - System.out.println ("\t|--------------------------------------------||"); - } -} diff --git a/org/drip/template/ust/FV1.java b/org/drip/template/ust/FV1.java deleted file mode 100644 index 9cdc4f2..0000000 --- a/org/drip/template/ust/FV1.java +++ /dev/null @@ -1,212 +0,0 @@ - -package org.drip.template.ust; - -import org.drip.analytics.date.*; -import org.drip.product.definition.Bond; -import org.drip.product.govvie.TreasuryFutures; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.ExchangeInstrumentBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * FV1 demonstrates the Details behind the Implementation and the Pricing of the 5Y FV1 UST Futures Contract. - * - * @author Lakshmi Krishnamurthy - */ - -public class FV1 { - - private static final String DeliveryMonths ( - final TreasuryFutures tsyFutures) - { - int[] aiDeliveryMonth = tsyFutures.deliveryMonths(); - - String strDeliveryMonths = ""; - int iNumDeliveryMonth = null == aiDeliveryMonth ? 0 : aiDeliveryMonth.length; - - if (0 != iNumDeliveryMonth) { - for (int i = 0; i < iNumDeliveryMonth; ++i) { - if (0 == i) - strDeliveryMonths += "{"; - else - strDeliveryMonths += ","; - - strDeliveryMonths += DateUtil.MonthChar (aiDeliveryMonth[i]); - } - - strDeliveryMonths += "}"; - } - - return strDeliveryMonths; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ); - - TreasuryFutures fv1 = ExchangeInstrumentBuilder.TreasuryFutures ( - dtSpot, - "UST", - new org.drip.analytics.date.JulianDate[] { - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 28), // 912828J5 - DateUtil.CreateFromYMD (2014, DateUtil.MARCH, 31), // 912828J8 - DateUtil.CreateFromYMD (2014, DateUtil.APRIL, 30), // 912828K5 - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 31), // 912828XE - DateUtil.CreateFromYMD (2014, DateUtil.JUNE, 30), // 912828XH - DateUtil.CreateFromYMD (2014, DateUtil.JULY, 31), // 912828XM - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 31), // 912828L3 - DateUtil.CreateFromYMD (2014, DateUtil.SEPTEMBER, 30), // 912828L6 - DateUtil.CreateFromYMD (2014, DateUtil.OCTOBER, 31) // 912828L9 - }, - new org.drip.analytics.date.JulianDate[] { - DateUtil.CreateFromYMD (2020, DateUtil.FEBRUARY, 28), // 912828J5 - DateUtil.CreateFromYMD (2020, DateUtil.MARCH, 31), // 912828J8 - DateUtil.CreateFromYMD (2020, DateUtil.APRIL, 30), // 912828K5 - DateUtil.CreateFromYMD (2020, DateUtil.MAY, 31), // 912828XE - DateUtil.CreateFromYMD (2020, DateUtil.JUNE, 30), // 912828XH - DateUtil.CreateFromYMD (2020, DateUtil.JULY, 31), // 912828XM - DateUtil.CreateFromYMD (2020, DateUtil.AUGUST, 31), // 912828L3 - DateUtil.CreateFromYMD (2020, DateUtil.SEPTEMBER, 30), // 912828L6 - DateUtil.CreateFromYMD (2020, DateUtil.OCTOBER, 31) // 912828L9 - }, - new double[] { - 0.01375, // 912828J5 - 0.01375, // 912828J8 - 0.01375, // 912828K5 - 0.01500, // 912828XE - 0.01625, // 912828XH - 0.01625, // 912828XM - 0.01375, // 912828L3 - 0.01375, // 912828L6 - 0.01375 // 912828L9 - }, - new double[] { - 0.8317, // 912828J5 - 0.8287, // 912828J8 - 0.8258, // 912828K5 - 0.8276, // 912828XE - 0.8297, // 912828XH - 0.8269, // 912828XM - 0.8141, // 912828L3 - 0.8113, // 912828L6 - 0.8084 // 912828L9 - }, - "TREASURY", - "NOTE", - "5Y" - ); - - double dblFuturesPrice = 119.00000; - - double[] adblCleanPrice = new double[] { - 0.99909375, // 912828J5 - 0.99900000, // 912828J8 - 0.99890625, // 912828K5 - 0.99943750, // 912828XE - 0.99984375, // 912828XH - 0.99978125, // 912828XM - 0.99862500, // 912828L3 - 0.99850000, // 912828L6 - 0.99853125 // 912828L9 - }; - - Bond bondCTD = fv1.cheapestToDeliverYield ( - dtSpot.julian(), - adblCleanPrice - ).bond(); - - System.out.println ("\n\t|---------------------------------------------------------||"); - - System.out.println ("\t| Futures Type : " + fv1.type() + " ||"); - - System.out.println ("\t| Deliverable Grade : " + fv1.minimumMaturity() + " -> " + fv1.maximumMaturity() + " ||"); - - System.out.println ("\t| Reference Coupon : " + FormatUtil.FormatDouble (fv1.referenceCoupon(), 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Contract Size : " + FormatUtil.FormatDouble (fv1.notionalValue(), 1, 2, 1.) + " ||"); - - System.out.println ("\t| Tick Size : " + FormatUtil.FormatDouble (fv1.minimumPriceMovement(), 1, 6, 1.) + " ||"); - - System.out.println ("\t| Tick Value : " + FormatUtil.FormatDouble (fv1.tickValue(), 1, 2, 1.) + " ||"); - - System.out.println ("\t| Delivery Months : " + DeliveryMonths (fv1) + " ||"); - - System.out.println ("\t| Last Trading Lag : " + fv1.lastTradingDayLag() + " Business Days Prior Expiry ||"); - - System.out.println ("\t| Futures Price : " + FormatUtil.FormatDouble (dblFuturesPrice, 2, 5, 1.) + " ||"); - - System.out.println ("\t| Contract Value : " + FormatUtil.FormatDouble (0.01 * fv1.notionalValue() * dblFuturesPrice, 1, 2, 1.) + " ||"); - - System.out.println ("\t|---------------------------------------------------------||\n"); - - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| ||"); - - for (int i = 0; i < fv1.basket().length; ++i) - System.out.println ("\t|\t" + fv1.basket()[i].name() + " => " + FormatUtil.FormatDouble (adblCleanPrice[i], 2, 5, 1.) + " ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\t| Cheapest to Deliver: " + bondCTD.name() + " ||"); - - System.out.println ("\t|---------------------------------------------||"); - } -} diff --git a/org/drip/template/ust/TU1.java b/org/drip/template/ust/TU1.java deleted file mode 100644 index 4ed947d..0000000 --- a/org/drip/template/ust/TU1.java +++ /dev/null @@ -1,207 +0,0 @@ - -package org.drip.template.ust; - -import org.drip.analytics.date.*; -import org.drip.product.definition.Bond; -import org.drip.product.govvie.TreasuryFutures; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.ExchangeInstrumentBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * TU1 demonstrates the Details behind the Implementation and the Pricing of the 2Y TU1 UST Futures Contract. - * - * @author Lakshmi Krishnamurthy - */ - -public class TU1 { - - private static final String DeliveryMonths ( - final TreasuryFutures tsyFutures) - { - int[] aiDeliveryMonth = tsyFutures.deliveryMonths(); - - String strDeliveryMonths = ""; - int iNumDeliveryMonth = null == aiDeliveryMonth ? 0 : aiDeliveryMonth.length; - - if (0 != iNumDeliveryMonth) { - for (int i = 0; i < iNumDeliveryMonth; ++i) { - if (0 == i) - strDeliveryMonths += "{"; - else - strDeliveryMonths += ","; - - strDeliveryMonths += DateUtil.MonthChar (aiDeliveryMonth[i]); - } - - strDeliveryMonths += "}"; - } - - return strDeliveryMonths; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ); - - TreasuryFutures tu1 = ExchangeInstrumentBuilder.TreasuryFutures ( - dtSpot, - "UST", - new org.drip.analytics.date.JulianDate[] { - DateUtil.CreateFromYMD (2014, DateUtil.DECEMBER, 31), // 912828UE - DateUtil.CreateFromYMD (2014, DateUtil.DECEMBER, 15), // 912828G7 - DateUtil.CreateFromYMD (2014, DateUtil.NOVEMBER, 30), // 912828UA - DateUtil.CreateFromYMD (2014, DateUtil.NOVEMBER, 15), // 912828G2 - DateUtil.CreateFromYMD (2014, DateUtil.OCTOBER, 31), // 912828TW - DateUtil.CreateFromYMD (2014, DateUtil.OCTOBER, 15), // 912828F5 - DateUtil.CreateFromYMD (2014, DateUtil.SEPTEMBER, 30), // 912828TS - DateUtil.CreateFromYMD (2014, DateUtil.SEPTEMBER, 15) // 912828D9 - }, - new org.drip.analytics.date.JulianDate[] { - DateUtil.CreateFromYMD (2017, DateUtil.DECEMBER, 31), // 912828UE - DateUtil.CreateFromYMD (2017, DateUtil.DECEMBER, 15), // 912828G7 - DateUtil.CreateFromYMD (2017, DateUtil.NOVEMBER, 30), // 912828UA - DateUtil.CreateFromYMD (2017, DateUtil.NOVEMBER, 15), // 912828G2 - DateUtil.CreateFromYMD (2017, DateUtil.OCTOBER, 31), // 912828TW - DateUtil.CreateFromYMD (2017, DateUtil.OCTOBER, 15), // 912828F5 - DateUtil.CreateFromYMD (2017, DateUtil.SEPTEMBER, 30), // 912828TS - DateUtil.CreateFromYMD (2017, DateUtil.SEPTEMBER, 15) // 912828D9 - }, - new double[] { - 0.00750, // 912828UE - 0.01000, // 912828G7 - 0.00625, // 912828UA - 0.00875, // 912828G2 - 0.00750, // 912828TW - 0.00875, // 912828F5 - 0.00625, // 912828TS - 0.01000 // 912828D9 - }, - new double[] { - 0.9024, // 912828UE - 0.9071, // 912828G7 - 0.9040, // 912828UA - 0.9085, // 912828G2 - 0.9101, // 912828TW - 0.9122, // 912828F5 - 0.9119, // 912828TS - 0.9181, // 912828D9 - }, - "TREASURY", - "NOTE", - "2Y" - ); - - double dblFuturesPrice = 108.08594; - - double[] adblCleanPrice = new double[] { - 0.99956250, // 912828UE - 1.00093750, // 912828G7 - 0.99937500, // 912828UA - 0.99990625, // 912828G2 - 0.99975000, // 912828TW - 1.00000000, // 912828F5 - 0.99953125, // 912828TS - 1.00250000 // 912828D9 - }; - - Bond bondCTD = tu1.cheapestToDeliverYield ( - dtSpot.julian(), - adblCleanPrice - ).bond(); - - System.out.println ("\n\t|---------------------------------------------------------||"); - - System.out.println ("\t| Futures Type : " + tu1.type() + " ||"); - - System.out.println ("\t| Deliverable Grade : " + tu1.minimumMaturity() + " -> " + tu1.maximumMaturity() + " ||"); - - System.out.println ("\t| Reference Coupon : " + FormatUtil.FormatDouble (tu1.referenceCoupon(), 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Contract Size : " + FormatUtil.FormatDouble (tu1.notionalValue(), 1, 2, 1.) + " ||"); - - System.out.println ("\t| Tick Size : " + FormatUtil.FormatDouble (tu1.minimumPriceMovement(), 1, 6, 1.) + " ||"); - - System.out.println ("\t| Tick Value : " + FormatUtil.FormatDouble (tu1.tickValue(), 1, 2, 1.) + " ||"); - - System.out.println ("\t| Delivery Months : " + DeliveryMonths (tu1) + " ||"); - - System.out.println ("\t| Last Trading Lag : " + tu1.lastTradingDayLag() + " Business Days Prior Expiry ||"); - - System.out.println ("\t| Futures Price : " + FormatUtil.FormatDouble (dblFuturesPrice, 2, 5, 1.) + " ||"); - - System.out.println ("\t| Contract Value : " + FormatUtil.FormatDouble (0.01 * tu1.notionalValue() * dblFuturesPrice, 1, 2, 1.) + " ||"); - - System.out.println ("\t|---------------------------------------------------------||\n"); - - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| ||"); - - for (int i = 0; i < tu1.basket().length; ++i) - System.out.println ("\t|\t" + tu1.basket()[i].name() + " => " + FormatUtil.FormatDouble (adblCleanPrice[i], 2, 5, 1.) + " ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\t| Cheapest to Deliver: " + bondCTD.name() + " ||"); - - System.out.println ("\t|---------------------------------------------||"); - } -} diff --git a/org/drip/template/ust/TY1.java b/org/drip/template/ust/TY1.java deleted file mode 100644 index 77b53bc..0000000 --- a/org/drip/template/ust/TY1.java +++ /dev/null @@ -1,263 +0,0 @@ - -package org.drip.template.ust; - -import org.drip.analytics.date.*; -import org.drip.product.definition.Bond; -import org.drip.product.govvie.TreasuryFutures; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.ExchangeInstrumentBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * TY1 demonstrates the Details behind the Implementation and the Pricing of the 10Y TY1 UST Futures - * Contract. - * - * @author Lakshmi Krishnamurthy - */ - -public class TY1 { - - private static final String DeliveryMonths ( - final TreasuryFutures tsyFutures) - { - int[] aiDeliveryMonth = tsyFutures.deliveryMonths(); - - String strDeliveryMonths = ""; - int iNumDeliveryMonth = null == aiDeliveryMonth ? 0 : aiDeliveryMonth.length; - - if (0 != iNumDeliveryMonth) { - for (int i = 0; i < iNumDeliveryMonth; ++i) { - if (0 == i) - strDeliveryMonths += "{"; - else - strDeliveryMonths += ","; - - strDeliveryMonths += DateUtil.MonthChar (aiDeliveryMonth[i]); - } - - strDeliveryMonths += "}"; - } - - return strDeliveryMonths; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ); - - TreasuryFutures ty1 = ExchangeInstrumentBuilder.TreasuryFutures ( - dtSpot, - "UST", - new org.drip.analytics.date.JulianDate[] { - DateUtil.CreateFromYMD (2014, DateUtil.JUNE, 30), // 912828XG - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 31), // 912828L2 - DateUtil.CreateFromYMD (2014, DateUtil.JULY, 31), // 912828XQ - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 15), // 912828TJ - DateUtil.CreateFromYMD (2014, DateUtil.OCTOBER, 31), // 912828M4 - DateUtil.CreateFromYMD (2014, DateUtil.SEPTEMBER, 30), // 912828L5 - DateUtil.CreateFromYMD (2014, DateUtil.NOVEMBER, 15), // 912828TY - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 15), // 912828UN - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 15), // 912828VB - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 15), // 912828VS - DateUtil.CreateFromYMD (2014, DateUtil.NOVEMBER, 15), // 912828WE - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 15), // 912828B6 - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 15), // 912828WJ - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 15), // 912828D5 - DateUtil.CreateFromYMD (2014, DateUtil.NOVEMBER, 15), // 912828G3 - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 15), // 912828J2 - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 15), // 912828XB - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 15), // 912828K7 - DateUtil.CreateFromYMD (2014, DateUtil.NOVEMBER, 15) // 912828M5 - }, - new org.drip.analytics.date.JulianDate[] { - DateUtil.CreateFromYMD (2022, DateUtil.JUNE, 30), // 912828XG - DateUtil.CreateFromYMD (2022, DateUtil.AUGUST, 31), // 912828L2 - DateUtil.CreateFromYMD (2022, DateUtil.JULY, 31), // 912828XQ - DateUtil.CreateFromYMD (2022, DateUtil.AUGUST, 15), // 912828TJ - DateUtil.CreateFromYMD (2022, DateUtil.OCTOBER, 31), // 912828M4 - DateUtil.CreateFromYMD (2022, DateUtil.SEPTEMBER, 30), // 912828L5 - DateUtil.CreateFromYMD (2022, DateUtil.NOVEMBER, 15), // 912828TY - DateUtil.CreateFromYMD (2023, DateUtil.FEBRUARY, 15), // 912828UN - DateUtil.CreateFromYMD (2023, DateUtil.MAY, 15), // 912828VB - DateUtil.CreateFromYMD (2023, DateUtil.AUGUST, 15), // 912828VS - DateUtil.CreateFromYMD (2023, DateUtil.NOVEMBER, 15), // 912828WE - DateUtil.CreateFromYMD (2024, DateUtil.FEBRUARY, 15), // 912828B6 - DateUtil.CreateFromYMD (2024, DateUtil.MAY, 15), // 912828WJ - DateUtil.CreateFromYMD (2024, DateUtil.AUGUST, 15), // 912828D5 - DateUtil.CreateFromYMD (2024, DateUtil.NOVEMBER, 15), // 912828G3 - DateUtil.CreateFromYMD (2025, DateUtil.FEBRUARY, 15), // 912828J2 - DateUtil.CreateFromYMD (2025, DateUtil.MAY, 15), // 912828XB - DateUtil.CreateFromYMD (2025, DateUtil.AUGUST, 15), // 912828K7 - DateUtil.CreateFromYMD (2025, DateUtil.NOVEMBER, 15) // 912828M5 - }, - new double[] { - 0.02125, // 912828XG - 0.01875, // 912828L2 - 0.02000, // 912828XQ - 0.01625, // 912828TJ - 0.01875, // 912828M4 - 0.01875, // 912828L5 - 0.01625, // 912828TY - 0.02000, // 912828UN - 0.01750, // 912828VB - 0.02500, // 912828VS - 0.02750, // 912828WE - 0.02750, // 912828B6 - 0.02500, // 912828WJ - 0.02375, // 912828D5 - 0.02250, // 912828G3 - 0.02000, // 912828J2 - 0.02125, // 912828XB - 0.02000, // 912828K7 - 0.02125 // 912828M5 - }, - new double[] { - 0.7939, // 912828XG - 0.7807, // 912828L2 - 0.7873, // 912828XQ - 0.7674, // 912828TJ - 0.7738, // 912828M4 - 0.7669, // 912828L5 - 0.7600, // 912828TY - 0.7741, // 912828UN - 0.7531, // 912828VB - 0.7911, // 912828VS - 0.8009, // 912828WE - 0.7959, // 912828B6 - 0.7748, // 912828WJ - 0.7614, // 912828D5 - 0.7475, // 912828G3 - 0.7249, // 912828J2 - 0.7279, // 912828XB - 0.7135, // 912828K7 - 0.7262 // 912828M5 - }, - "TREASURY", - "NOTE", - "10Y" - ); - - double dblFuturesPrice = 126.578125; - - double[] adblCleanPrice = new double[] { - 1.0071875, // 912828XG - 0.9903125, // 912828L2 - 0.9990625, // 912828XQ - 0.9756250, // 912828TJ - 0.9893750, // 912828M4 - 0.9818750, // 912828L5 - 0.9734375, // 912828TY - 0.9968750, // 912828UN - 0.9756250, // 912828VB - 1.0281250, // 912828VS - 1.0459375, // 912828WE - 1.0443750, // 912828B6 - 1.0231250, // 912828WJ - 1.0128125, // 912828D5 - 0.9996875, // 912828G3 - 0.9768750, // 912828J2 - 0.9865625, // 912828XB - 0.9750000, // 912828K7 - 0.9978125 // 912828M5 - }; - - Bond bondCTD = ty1.cheapestToDeliverYield ( - dtSpot.julian(), - adblCleanPrice - ).bond(); - - System.out.println ("\n\t|---------------------------------------------------------||"); - - System.out.println ("\t| Futures Type : " + ty1.type() + " ||"); - - System.out.println ("\t| Deliverable Grade : " + ty1.minimumMaturity() + " -> " + ty1.maximumMaturity() + " ||"); - - System.out.println ("\t| Reference Coupon : " + FormatUtil.FormatDouble (ty1.referenceCoupon(), 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Contract Size : " + FormatUtil.FormatDouble (ty1.notionalValue(), 1, 2, 1.) + " ||"); - - System.out.println ("\t| Tick Size : " + FormatUtil.FormatDouble (ty1.minimumPriceMovement(), 1, 6, 1.) + " ||"); - - System.out.println ("\t| Tick Value : " + FormatUtil.FormatDouble (ty1.tickValue(), 1, 2, 1.) + " ||"); - - System.out.println ("\t| Delivery Months : " + DeliveryMonths (ty1) + " ||"); - - System.out.println ("\t| Last Trading Lag : " + ty1.lastTradingDayLag() + " Business Days Prior Expiry ||"); - - System.out.println ("\t| Futures Price : " + FormatUtil.FormatDouble (dblFuturesPrice, 2, 5, 1.) + " ||"); - - System.out.println ("\t| Contract Value : " + FormatUtil.FormatDouble (0.01 * ty1.notionalValue() * dblFuturesPrice, 1, 2, 1.) + " ||"); - - System.out.println ("\t|---------------------------------------------------------||\n"); - - System.out.println ("\n\t|---------------------------------------------||"); - - System.out.println ("\t| ||"); - - for (int i = 0; i < ty1.basket().length; ++i) - System.out.println ("\t|\t" + ty1.basket()[i].name() + " => " + FormatUtil.FormatDouble (adblCleanPrice[i], 2, 5, 1.) + " ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t|---------------------------------------------||"); - - System.out.println ("\t| Cheapest to Deliver: " + bondCTD.name() + " ||"); - - System.out.println ("\t|---------------------------------------------||"); - } -} diff --git a/org/drip/template/ust/US1.java b/org/drip/template/ust/US1.java deleted file mode 100644 index a43133e..0000000 --- a/org/drip/template/ust/US1.java +++ /dev/null @@ -1,233 +0,0 @@ - -package org.drip.template.ust; - -import org.drip.analytics.date.*; -import org.drip.product.definition.Bond; -import org.drip.product.govvie.TreasuryFutures; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.ExchangeInstrumentBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * US1 demonstrates the Details behind the Implementation and the Pricing of the 30Y US1 UST Futures - * Contract. - * - * @author Lakshmi Krishnamurthy - */ - -public class US1 { - - private static final String DeliveryMonths ( - final TreasuryFutures tsyFutures) - { - int[] aiDeliveryMonth = tsyFutures.deliveryMonths(); - - String strDeliveryMonths = ""; - int iNumDeliveryMonth = null == aiDeliveryMonth ? 0 : aiDeliveryMonth.length; - - if (0 != iNumDeliveryMonth) { - for (int i = 0; i < iNumDeliveryMonth; ++i) { - if (0 == i) - strDeliveryMonths += "{"; - else - strDeliveryMonths += ","; - - strDeliveryMonths += DateUtil.MonthChar (aiDeliveryMonth[i]); - } - - strDeliveryMonths += "}"; - } - - return strDeliveryMonths; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ); - - TreasuryFutures us1 = ExchangeInstrumentBuilder.TreasuryFutures ( - dtSpot, - "UST", - new org.drip.analytics.date.JulianDate[] { - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 15), // 912810FT - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 15), // 912810PU - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 15), // 912810PT - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 15), // 912810PX - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 15), // 912810PW - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 15), // 912810QC - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 15), // 912810QE - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 15), // 912810QB - DateUtil.CreateFromYMD (2014, DateUtil.NOVEMBER, 15), // 912810QD - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 15), // 912810QH - DateUtil.CreateFromYMD (2014, DateUtil.NOVEMBER, 15), // 912810QL - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 15), // 912810QK - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 15) // 912810QA - }, - new org.drip.analytics.date.JulianDate[] { - DateUtil.CreateFromYMD (2036, DateUtil.FEBRUARY, 15), // 912810FT - DateUtil.CreateFromYMD (2037, DateUtil.MAY, 15), // 912810PU - DateUtil.CreateFromYMD (2037, DateUtil.FEBRUARY, 15), // 912810PT - DateUtil.CreateFromYMD (2038, DateUtil.MAY, 15), // 912810PX - DateUtil.CreateFromYMD (2038, DateUtil.FEBRUARY, 15), // 912810PW - DateUtil.CreateFromYMD (2039, DateUtil.AUGUST, 15), // 912810QC - DateUtil.CreateFromYMD (2040, DateUtil.FEBRUARY, 15), // 912810QE - DateUtil.CreateFromYMD (2039, DateUtil.MAY, 15), // 912810QB - DateUtil.CreateFromYMD (2039, DateUtil.NOVEMBER, 15), // 912810QD - DateUtil.CreateFromYMD (2040, DateUtil.MAY, 15), // 912810QH - DateUtil.CreateFromYMD (2040, DateUtil.NOVEMBER, 15), // 912810QL - DateUtil.CreateFromYMD (2040, DateUtil.AUGUST, 15), // 912810QK - DateUtil.CreateFromYMD (2039, DateUtil.FEBRUARY, 15) // 912810QA - }, - new double[] { - 0.04500, // 912810FT - 0.05000, // 912810PU - 0.04750, // 912810PT - 0.04500, // 912810PX - 0.04375, // 912810PW - 0.04500, // 912810QC - 0.04625, // 912810QE - 0.04250, // 912810QB - 0.04375, // 912810QD - 0.04375, // 912810QH - 0.04250, // 912810QL - 0.03875, // 912810QK - 0.03500 // 912810QA - }, - new double[] { - 0.8266, // 912810FT - 0.8807, // 912810PU - 0.8519, // 912810PT - 0.8170, // 912810PX - 0.8029, // 912810PW - 0.8123, // 912810QC - 0.8263, // 912810QE - 0.7820, // 912810QB - 0.7956, // 912810QD - 0.7939, // 912810QH - 0.7758, // 912810QL - 0.7290, // 912810QK - 0.6903, // 912810QA - }, - "TREASURY", - "BOND", - "30Y" - ); - - double dblFuturesPrice = 153.750000; - - double[] adblCleanPrice = new double[] { - 1.2765625, // 912810FT - 1.3643750, // 912810PU - 1.3203125, // 912810PT - 1.2775000, // 912810PX - 1.2556250, // 912810PW - 1.2731250, // 912810QC - 1.2956250, // 912810QE - 1.2287500, // 912810QB - 1.2506250, // 912810QD - 1.2506250, // 912810QH - 1.2281250, // 912810QL - 1.1603125, // 912810QK - 1.1009375 // 912810QA - }; - - Bond bondCTD = us1.cheapestToDeliverYield ( - dtSpot.julian(), - adblCleanPrice - ).bond(); - - System.out.println ("\n\t|---------------------------------------------------------||"); - - System.out.println ("\t| Futures Type : " + us1.type() + " ||"); - - System.out.println ("\t| Deliverable Grade : " + us1.minimumMaturity() + " -> " + us1.maximumMaturity() + " ||"); - - System.out.println ("\t| Reference Coupon : " + FormatUtil.FormatDouble (us1.referenceCoupon(), 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Contract Size : " + FormatUtil.FormatDouble (us1.notionalValue(), 1, 2, 1.) + " ||"); - - System.out.println ("\t| Tick Size : " + FormatUtil.FormatDouble (us1.minimumPriceMovement(), 1, 6, 1.) + " ||"); - - System.out.println ("\t| Tick Value : " + FormatUtil.FormatDouble (us1.tickValue(), 1, 2, 1.) + " ||"); - - System.out.println ("\t| Delivery Months : " + DeliveryMonths (us1) + " ||"); - - System.out.println ("\t| Last Trading Lag : " + us1.lastTradingDayLag() + " Business Days Prior Expiry ||"); - - System.out.println ("\t| Futures Price : " + FormatUtil.FormatDouble (dblFuturesPrice, 2, 5, 1.) + " ||"); - - System.out.println ("\t| Contract Value : " + FormatUtil.FormatDouble (0.01 * us1.notionalValue() * dblFuturesPrice, 1, 2, 1.) + " ||"); - - System.out.println ("\t|---------------------------------------------------------||\n"); - - System.out.println ("\n\t|----------------------------------------------||"); - - System.out.println ("\t| ||"); - - for (int i = 0; i < us1.basket().length; ++i) - System.out.println ("\t|\t" + us1.basket()[i].name() + " => " + FormatUtil.FormatDouble (adblCleanPrice[i], 2, 5, 1.) + " ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t|----------------------------------------------||"); - - System.out.println ("\t| Cheapest to Deliver: " + bondCTD.name() + " ||"); - - System.out.println ("\t|----------------------------------------------||"); - } -} diff --git a/org/drip/template/ust/WN1.java b/org/drip/template/ust/WN1.java deleted file mode 100644 index a5f8a48..0000000 --- a/org/drip/template/ust/WN1.java +++ /dev/null @@ -1,268 +0,0 @@ - -package org.drip.template.ust; - -import org.drip.analytics.date.*; -import org.drip.product.definition.Bond; -import org.drip.product.govvie.TreasuryFutures; -import org.drip.quant.common.FormatUtil; -import org.drip.service.env.EnvManager; -import org.drip.service.template.ExchangeInstrumentBuilder; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 Lakshmi Krishnamurthy - * Copyright (C) 2016 Lakshmi Krishnamurthy - * Copyright (C) 2015 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. - */ - -/** - * WN1 demonstrates the Details behind the Implementation and the Pricing of the ULTRA LONG BOND WN1 UST - * Futures Contract. - * - * @author Lakshmi Krishnamurthy - */ - -public class WN1 { - - private static final String DeliveryMonths ( - final TreasuryFutures tsyFutures) - { - int[] aiDeliveryMonth = tsyFutures.deliveryMonths(); - - String strDeliveryMonths = ""; - int iNumDeliveryMonth = null == aiDeliveryMonth ? 0 : aiDeliveryMonth.length; - - if (0 != iNumDeliveryMonth) { - for (int i = 0; i < iNumDeliveryMonth; ++i) { - if (0 == i) - strDeliveryMonths += "{"; - else - strDeliveryMonths += ","; - - strDeliveryMonths += DateUtil.MonthChar (aiDeliveryMonth[i]); - } - - strDeliveryMonths += "}"; - } - - return strDeliveryMonths; - } - - public static final void main ( - final String[] astrArgs) - throws Exception - { - EnvManager.InitEnv (""); - - JulianDate dtSpot = DateUtil.CreateFromYMD ( - 2015, - DateUtil.NOVEMBER, - 18 - ); - - TreasuryFutures wn1 = ExchangeInstrumentBuilder.TreasuryFutures ( - dtSpot, - "UST", - new org.drip.analytics.date.JulianDate[] { - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 15), // 912810QN - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 15), // 912810QQ - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 15), // 912810QS - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 15), // 912810RC - DateUtil.CreateFromYMD (2014, DateUtil.NOVEMBER, 15), // 912810RD - DateUtil.CreateFromYMD (2014, DateUtil.NOVEMBER, 15), // 912810QT - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 15), // 912810QU - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 15), // 912810RE - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 15), // 912810QZ - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 15), // 912810QW - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 15), // 912810RG - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 15), // 912810QX - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 15), // 912810RB - DateUtil.CreateFromYMD (2014, DateUtil.NOVEMBER, 15), // 912810QY - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 15), // 912810RH - DateUtil.CreateFromYMD (2014, DateUtil.NOVEMBER, 15), // 912810RJ - DateUtil.CreateFromYMD (2014, DateUtil.MAY, 15), // 912810RM - DateUtil.CreateFromYMD (2014, DateUtil.NOVEMBER, 15), // 912810RP - DateUtil.CreateFromYMD (2014, DateUtil.AUGUST, 15), // 912810RN - DateUtil.CreateFromYMD (2014, DateUtil.FEBRUARY, 15) // 912810RK - }, - new org.drip.analytics.date.JulianDate[] { - DateUtil.CreateFromYMD (2041, DateUtil.FEBRUARY, 15), // 912810QN - DateUtil.CreateFromYMD (2041, DateUtil.MAY, 15), // 912810QQ - DateUtil.CreateFromYMD (2041, DateUtil.AUGUST, 15), // 912810QS - DateUtil.CreateFromYMD (2043, DateUtil.AUGUST, 15), // 912810RC - DateUtil.CreateFromYMD (2043, DateUtil.NOVEMBER, 15), // 912810RD - DateUtil.CreateFromYMD (2041, DateUtil.NOVEMBER, 15), // 912810QT - DateUtil.CreateFromYMD (2043, DateUtil.FEBRUARY, 15), // 912810QU - DateUtil.CreateFromYMD (2044, DateUtil.FEBRUARY, 15), // 912810RE - DateUtil.CreateFromYMD (2043, DateUtil.FEBRUARY, 15), // 912810QZ - DateUtil.CreateFromYMD (2042, DateUtil.MAY, 15), // 912810QW - DateUtil.CreateFromYMD (2044, DateUtil.MAY, 15), // 912810RG - DateUtil.CreateFromYMD (2042, DateUtil.AUGUST, 15), // 912810QX - DateUtil.CreateFromYMD (2043, DateUtil.MAY, 15), // 912810RB - DateUtil.CreateFromYMD (2042, DateUtil.NOVEMBER, 15), // 912810QY - DateUtil.CreateFromYMD (2044, DateUtil.AUGUST, 15), // 912810RH - DateUtil.CreateFromYMD (2044, DateUtil.NOVEMBER, 15), // 912810RJ - DateUtil.CreateFromYMD (2045, DateUtil.MAY, 15), // 912810RM - DateUtil.CreateFromYMD (2045, DateUtil.NOVEMBER, 15), // 912810RP - DateUtil.CreateFromYMD (2045, DateUtil.AUGUST, 15), // 912810RN - DateUtil.CreateFromYMD (2045, DateUtil.FEBRUARY, 15) // 912810RK - }, - new double[] { - 0.04750, // 912810QN - 0.04375, // 912810QQ - 0.03750, // 912810QS - 0.03625, // 912810RC - 0.03750, // 912810RD - 0.03125, // 912810QT - 0.03125, // 912810QU - 0.03625, // 912810RE - 0.03125, // 912810QZ - 0.03000, // 912810QW - 0.03625, // 912810RG - 0.02375, // 912810QX - 0.02875, // 912810RB - 0.02750, // 912810QY - 0.03125, // 912810RH - 0.03000, // 912810RJ - 0.03000, // 912810RM - 0.03000, // 912810RP - 0.02875, // 912810RN - 0.02500 // 912810RK - }, - new double[] { - 0.8392, // 912810QN - 0.7900, // 912810QQ - 0.7080, // 912810QS - 0.6821, // 912810RC - 0.6976, // 912810RD - 0.6253, // 912810QT - 0.6239, // 912810QU - 0.6798, // 912810RE - 0.6179, // 912810QZ - 0.6059, // 912810QW - 0.6448, // 912810RG - 0.5714, // 912810QX - 0.5831, // 912810RB - 0.5697, // 912810QY - 0.6097, // 912810RH - 0.5913, // 912810RJ - 0.5887, // 912810RM - 0.5861, // 912810RP - 0.5702, // 912810RN - 0.5217, // 912810RK - }, - "TREASURY", - "BOND", - "ULTRA" - ); - - double dblFuturesPrice = 156.687500; - - double[] adblCleanPrice = new double[] { - 1.3200000, // 912810QN - 1.2540625, // 912810QQ - 1.1412500, // 912810QS - 1.1193750, // 912810RC - 1.1450000, // 912810RD - 1.0262500, // 912810QT - 1.0256250, // 912810QU - 1.1184375, // 912810RE - 1.0181250, // 912810QZ - 0.9990625, // 912810QW - 1.0659375, // 912810RG - 0.9481250, // 912810QX - 0.9681250, // 912810RB - 0.9459375, // 912810QY - 1.0153125, // 912810RH - 0.9896875, // 912810RJ - 0.9890625, // 912810RM - 0.9918750, // 912810RP - 0.9656250, // 912810RN - 0.8909375 // 912810RK - }; - - Bond bondCTD = wn1.cheapestToDeliverYield ( - dtSpot.julian(), - adblCleanPrice - ).bond(); - - System.out.println ("\n\t|---------------------------------------------------------||"); - - System.out.println ("\t| Futures Type : " + wn1.type() + " ||"); - - System.out.println ("\t| Deliverable Grade : " + wn1.minimumMaturity() + " -> " + wn1.maximumMaturity() + " ||"); - - System.out.println ("\t| Reference Coupon : " + FormatUtil.FormatDouble (wn1.referenceCoupon(), 1, 2, 100.) + "% ||"); - - System.out.println ("\t| Contract Size : " + FormatUtil.FormatDouble (wn1.notionalValue(), 1, 2, 1.) + " ||"); - - System.out.println ("\t| Tick Size : " + FormatUtil.FormatDouble (wn1.minimumPriceMovement(), 1, 6, 1.) + " ||"); - - System.out.println ("\t| Tick Value : " + FormatUtil.FormatDouble (wn1.tickValue(), 1, 2, 1.) + " ||"); - - System.out.println ("\t| Delivery Months : " + DeliveryMonths (wn1) + " ||"); - - System.out.println ("\t| Last Trading Lag : " + wn1.lastTradingDayLag() + " Business Days Prior Expiry ||"); - - System.out.println ("\t| Futures Price : " + FormatUtil.FormatDouble (dblFuturesPrice, 2, 5, 1.) + " ||"); - - System.out.println ("\t| Contract Value : " + FormatUtil.FormatDouble (0.01 * wn1.notionalValue() * dblFuturesPrice, 1, 2, 1.) + " ||"); - - System.out.println ("\t|---------------------------------------------------------||\n"); - - System.out.println ("\n\t|----------------------------------------------||"); - - System.out.println ("\t| ||"); - - for (int i = 0; i < wn1.basket().length; ++i) - System.out.println ("\t|\t" + wn1.basket()[i].name() + " => " + FormatUtil.FormatDouble (adblCleanPrice[i], 2, 5, 1.) + " ||"); - - System.out.println ("\t| ||"); - - System.out.println ("\t|----------------------------------------------||"); - - System.out.println ("\t| Cheapest to Deliver: " + bondCTD.name() + " ||"); - - System.out.println ("\t|----------------------------------------------||"); - } -} diff --git a/org/drip/xva/collateralized/CSAInducedMeasureShift.java b/org/drip/xva/collateralized/CSAInducedMeasureShift.java deleted file mode 100644 index be740ed..0000000 --- a/org/drip/xva/collateralized/CSAInducedMeasureShift.java +++ /dev/null @@ -1,171 +0,0 @@ - -package org.drip.xva.collateralized; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CSAInducedMeasureShift computes the Shift of the Forward Terminal Distribution between the Non-CSA and the - * CSA Cases. The References are: - * - * - Antonov, A., and M. Arneguy (2009): Analytical Formulas for Pricing CMS Products in the LIBOR Market - * Model with Stochastic Volatility, https://papers.ssrn.com/sol3/Papers.cfm?abstract_id=1352606, eSSRN. - * - * - Burgard, C., and M. Kjaer (2009): Modeling and successful Management of Credit Counter-party Risk of - * Derivative Portfolios, ICBI Conference, Rome. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Johannes, M., and S. Sundaresan (2007): Pricing Collateralized Swaps, Journal of Finance 62 383-410. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CSAInducedMeasureShift { - private double _dblCSAForward = java.lang.Double.NaN; - private double _dblNoCSAForward = java.lang.Double.NaN; - private double _dblTerminalVariance = java.lang.Double.NaN; - - /** - * CSAInducedMeasureShift Constructor - * - * @param dblCSAForward The CSA Implied Forward Value - * @param dblNoCSAForward The No CSA Implied Forward Value - * @param dblTerminalVariance The Terminal Variance of the Underlying - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CSAInducedMeasureShift ( - final double dblCSAForward, - final double dblNoCSAForward, - final double dblTerminalVariance) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblCSAForward = dblCSAForward) || - !org.drip.quant.common.NumberUtil.IsValid (_dblNoCSAForward = dblNoCSAForward) || - !org.drip.quant.common.NumberUtil.IsValid (_dblTerminalVariance = dblTerminalVariance)) - throw new java.lang.Exception ("CSAInducedMeasureShift Constructor => Invalid Inputs"); - } - - /** - * Return the Value of the Forward Contract under CSA - * - * @return The Value of the Forward Contract under CSA - */ - - public double csaForward() - { - return _dblCSAForward; - } - - /** - * Return the Value of the Forward Contract under No CSA Criterion - * - * @return The Value of the Forward Contract under No CSA Criterion - */ - - public double noCSAForward() - { - return _dblNoCSAForward; - } - - /** - * Return the Terminal Variance of the Underlying - * - * @return The Terminal Variance of the Underlying - */ - - public double terminalVariance() - { - return _dblTerminalVariance; - } - - /** - * Return the Linear Strike Coefficient of the Relative Measure Differential - * - * @return The Linear Strike Coefficient of the Relative Measure Differential - */ - - public double alpha1() - { - return (_dblNoCSAForward - _dblCSAForward) / _dblTerminalVariance; - } - - /** - * Return the Constant Strike Coefficient of the Relative Measure Differential - * - * @return The Constant Strike Coefficient of the Relative Measure Differential - */ - - public double alpha0() - { - return 1. - alpha1() * _dblCSAForward; - } - - /** - * Compute the No CSA/CSA Density Re-scaling using the Antonov and Arneguy (2009) Linear Proxy Approach - * - * @param dblK The Strike at which the Density Re-scaling is Sought - * - * @return The No CSA/CSA Density Re-scaling using the Antonov and Arneguy (2009) Linear Proxy Approach - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double densityRescale ( - final double dblK) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblK)) - throw new java.lang.Exception ("CSAInducedMeasureShift::densityRescale => Invalid Inputs"); - - double dblAlpha1 = (_dblNoCSAForward - _dblCSAForward) / _dblTerminalVariance; - return 1. - dblAlpha1 * _dblCSAForward + dblAlpha1 * dblK; - } -} diff --git a/org/drip/xva/collateralized/FundingBasisEvolver.java b/org/drip/xva/collateralized/FundingBasisEvolver.java deleted file mode 100644 index 478aa51..0000000 --- a/org/drip/xva/collateralized/FundingBasisEvolver.java +++ /dev/null @@ -1,313 +0,0 @@ - -package org.drip.xva.collateralized; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * FundingBasisEvolver implements a Two Factor Stochastic Funding Model Evolver with a Log Normal Forward - * Process and a Mean Reverting Diffusion Process for the Funding Spread. The References are: - * - * - Antonov, A., and M. Arneguy (2009): Analytical Formulas for Pricing CMS Products in the LIBOR Market - * Model with Stochastic Volatility, https://papers.ssrn.com/sol3/Papers.cfm?abstract_id=1352606, eSSRN. - * - * - Burgard, C., and M. Kjaer (2009): Modeling and successful Management of Credit Counter-party Risk of - * Derivative Portfolios, ICBI Conference, Rome. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Johannes, M., and S. Sundaresan (2007): Pricing Collateralized Swaps, Journal of Finance 62 383-410. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class FundingBasisEvolver { - private double _dblCorrelation = java.lang.Double.NaN; - private org.drip.measure.dynamics.DiffusionEvaluatorLogarithmic _delUnderlying = null; - private org.drip.measure.dynamics.DiffusionEvaluatorMeanReversion _demrFundingSpread = null; - - /** - * FundingBasisEvolver Constructor - * - * @param delUnderlying The Underlying Diffusion Evaluator - * @param demrFundingSpread The Funding Spread Diffusion Evaluator - * @param dblCorrelation Correlation between the Underlying and the Funding Spread Processes - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public FundingBasisEvolver ( - final org.drip.measure.dynamics.DiffusionEvaluatorLogarithmic delUnderlying, - final org.drip.measure.dynamics.DiffusionEvaluatorMeanReversion demrFundingSpread, - final double dblCorrelation) - throws java.lang.Exception - { - if (null == (_delUnderlying = delUnderlying) || null == (_demrFundingSpread = demrFundingSpread) || - !org.drip.quant.common.NumberUtil.IsValid (_dblCorrelation = dblCorrelation) || 1. < - _dblCorrelation || -1. > _dblCorrelation) - throw new java.lang.Exception ("FundingBasisEvolver Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Underlying Diffusion Evaluator - * - * @return The Underlying Diffusion Evaluator - */ - - public org.drip.measure.dynamics.DiffusionEvaluatorLogarithmic underlyingEvaluator() - { - return _delUnderlying; - } - - /** - * Retrieve the Funding Spread Diffusion Evaluator - * - * @return The Funding Spread Diffusion Evaluator - */ - - public org.drip.measure.dynamics.DiffusionEvaluatorMeanReversion fundingSpreadEvaluator() - { - return _demrFundingSpread; - } - - /** - * Retrieve the Correlation between the Underlying and the Funding Spread Processes - * - * @return The Correlation between the Underlying and the Funding Spread Processes - */ - - public double underlyingFundingSpreadCorrelation() - { - return _dblCorrelation; - } - - /** - * Generate the CSA Forward Diffusion Process - * - * @return The CSA Forward Diffusion Process - */ - - public org.drip.measure.process.DiffusionEvolver csaForwardProcess() - { - try { - org.drip.measure.dynamics.LocalEvaluator leDrift = new org.drip.measure.dynamics.LocalEvaluator() - { - @Override public double value ( - final org.drip.measure.realization.JumpDiffusionVertex jdv) - throws java.lang.Exception - { - return 0.; - } - }; - - org.drip.measure.dynamics.LocalEvaluator leVolatility = new - org.drip.measure.dynamics.LocalEvaluator() { - @Override public double value ( - final org.drip.measure.realization.JumpDiffusionVertex jdv) - throws java.lang.Exception - { - if (null == jdv) - throw new java.lang.Exception - ("FundingBasisEvolver::CSAForwardVolatility::Evaluator::value => Invalid Inputs"); - - return jdv.value() * _delUnderlying.volatilityValue(); - } - }; - - return new org.drip.measure.process.DiffusionEvolver (new - org.drip.measure.dynamics.DiffusionEvaluator (leDrift, leVolatility)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Funding Numeraire Diffusion Process - * - * @param strTenor The Tenor of the Underlying Forward - * - * @return The Funding Numeraire Diffusion Process - */ - - public org.drip.measure.process.DiffusionEvolver fundingNumeraireProcess ( - final java.lang.String strTenor) - { - try { - double dblMeanReversionSpeed = _demrFundingSpread.meanReversionRate(); - - double dblB = org.drip.analytics.support.Helper.TenorToYearFraction (strTenor); - - if (0. != dblMeanReversionSpeed) - dblB = (1. - java.lang.Math.exp (-1. * dblMeanReversionSpeed * dblB)) / - dblMeanReversionSpeed; - - final double dblPiterbarg2010BFactor = dblB; - - org.drip.measure.dynamics.LocalEvaluator leDrift = new org.drip.measure.dynamics.LocalEvaluator() - { - @Override public double value ( - final org.drip.measure.realization.JumpDiffusionVertex jdv) - throws java.lang.Exception - { - return 0.; - } - }; - - org.drip.measure.dynamics.LocalEvaluator leVolatility = new - org.drip.measure.dynamics.LocalEvaluator() { - @Override public double value ( - final org.drip.measure.realization.JumpDiffusionVertex jdv) - throws java.lang.Exception - { - if (null == jdv) - throw new java.lang.Exception - ("FundingBasisEvolver::CSAFundingNumeraireVolatility::Evaluator::value => Invalid Inputs"); - - return -1. * jdv.value() * dblPiterbarg2010BFactor * _demrFundingSpread.volatilityValue(); - } - }; - - return new org.drip.measure.process.DiffusionEvolver (new - org.drip.measure.dynamics.DiffusionEvaluator (leDrift, leVolatility)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Funding Spread Numeraire Diffusion Process - * - * @param strTenor The Tenor of the Underlying Forward - * - * @return The Funding Spread Numeraire Diffusion Process - */ - - public org.drip.measure.process.DiffusionEvolver fundingSpreadNumeraireProcess ( - final java.lang.String strTenor) - { - try { - double dblMeanReversionSpeed = _demrFundingSpread.meanReversionRate(); - - double dblB = org.drip.analytics.support.Helper.TenorToYearFraction (strTenor); - - if (0. != dblMeanReversionSpeed) - dblB = (1. - java.lang.Math.exp (-1. * dblMeanReversionSpeed * dblB)) / - dblMeanReversionSpeed; - - final double dblPiterbarg2010BFactor = dblB; - - org.drip.measure.dynamics.LocalEvaluator leDrift = new org.drip.measure.dynamics.LocalEvaluator() - { - @Override public double value ( - final org.drip.measure.realization.JumpDiffusionVertex jdv) - throws java.lang.Exception - { - return 0.; - } - }; - - org.drip.measure.dynamics.LocalEvaluator leVolatility = new - org.drip.measure.dynamics.LocalEvaluator() { - @Override public double value ( - final org.drip.measure.realization.JumpDiffusionVertex jdv) - throws java.lang.Exception - { - if (null == jdv) - throw new java.lang.Exception - ("FundingBasisEvolver::CSAFundingSpreadNumeraireVolatility::Evaluator::value => Invalid Inputs"); - - return -1. * jdv.value() * dblPiterbarg2010BFactor * _demrFundingSpread.volatilityValue(); - } - }; - - return new org.drip.measure.process.DiffusionEvolver (new - org.drip.measure.dynamics.DiffusionEvaluator (leDrift, leVolatility)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Compute the CSA vs. No CSA Forward Ratio - * - * @param strTenor The Tenor of the Underlying Forward - * - * @return The CSA vs. No CSA Forward Ratio - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double CSANoCSARatio ( - final java.lang.String strTenor) - throws java.lang.Exception - { - double dblUnderlyingVolatility = _delUnderlying.volatilityValue(); - - double dblMeanReversionSpeed = _demrFundingSpread.meanReversionRate(); - - double dblFundingSpreadVolatility = _demrFundingSpread.volatilityValue(); - - double dblMaturity = org.drip.analytics.support.Helper.TenorToYearFraction (strTenor); - - if (0. == dblMeanReversionSpeed) - return java.lang.Math.exp (-0.5 * _dblCorrelation * dblUnderlyingVolatility * - dblFundingSpreadVolatility * dblMaturity * dblMaturity); - - double dblB = (1. - java.lang.Math.exp (-1. * dblMeanReversionSpeed * dblMaturity)) / - dblMeanReversionSpeed; - - return java.lang.Math.exp (-1. * _dblCorrelation * dblUnderlyingVolatility * - dblFundingSpreadVolatility * (dblMaturity - dblB) / dblMeanReversionSpeed); - } -} diff --git a/org/drip/xva/definition/Equity.java b/org/drip/xva/definition/Equity.java deleted file mode 100644 index 9cce9fa..0000000 --- a/org/drip/xva/definition/Equity.java +++ /dev/null @@ -1,110 +0,0 @@ - -package org.drip.xva.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * Equity describes a Trade-able Equity. 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class Equity extends org.drip.xva.definition.Tradeable { - private double _dblDividendRate = java.lang.Double.NaN; - - /** - * Equity Constructor - * - * @param eePriceNumeraire The Equity Price Numeraire - * @param dblRepoRate The Equity Repo Rate - * @param dblDividendRate The Equity Dividend Rate - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public Equity ( - final org.drip.measure.process.DiffusionEvolver dePriceNumeraire, - final double dblRepoRate, - final double dblDividendRate) - throws java.lang.Exception - { - super (dePriceNumeraire, dblRepoRate); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblDividendRate = dblDividendRate)) - throw new java.lang.Exception ("Equity Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Equity Dividend Rate - * - * @return The Equity Dividend Rate - */ - - public double dividendRate() - { - return _dblDividendRate; - } - - @Override public double cashAccumulationRate() - { - return _dblDividendRate - repoRate(); - } -} diff --git a/org/drip/xva/definition/MasterAgreementCloseOut.java b/org/drip/xva/definition/MasterAgreementCloseOut.java deleted file mode 100644 index 85eee37..0000000 --- a/org/drip/xva/definition/MasterAgreementCloseOut.java +++ /dev/null @@ -1,155 +0,0 @@ - -package org.drip.xva.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * MasterAgreementCloseOut implements the (2002) ISDA Master Agreement Close Out Scheme to be applied to the - * MTM at the Bank/Counter Party Default. 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class MasterAgreementCloseOut { - private double _dblBankRecovery = java.lang.Double.NaN; - private double _dblCounterPartyRecovery = java.lang.Double.NaN; - - /** - * MasterAgreementCloseOut Constructor - * - * @param dblBankRecovery The Bank Recovery Rate - * @param dblCounterPartyRecovery The Counter Party Recovery Rate - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public MasterAgreementCloseOut ( - final double dblBankRecovery, - final double dblCounterPartyRecovery) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblBankRecovery = dblBankRecovery) || - !org.drip.quant.common.NumberUtil.IsValid (_dblCounterPartyRecovery = dblCounterPartyRecovery)) - throw new java.lang.Exception ("MasterAgreementCloseOut Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Bank Recovery Rate - * - * @return The Bank Recovery Rate - */ - - public double bankRecovery() - { - return _dblBankRecovery; - } - - /** - * Retrieve the Counter Party Recovery Rate - * - * @return The Counter Party Recovery Rate - */ - - public double counterPartyRecovery() - { - return _dblCounterPartyRecovery; - } - - /** - * Retrieve the Close-out from the MTM on the Bank Default - * - * @param dblMTM The MTM - * - * @return The Close-out from the MTM on the Bank Default - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double bankDefault ( - final double dblMTM) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblMTM)) - throw new java.lang.Exception ("MasterAgreementCloseOut::bankDefault => Invalid Inputs"); - - return dblMTM > 0. ? dblMTM : _dblBankRecovery * dblMTM; - } - - /** - * Retrieve the Close-out from the MTM on the Counter Party Default - * - * @param dblMTM The MTM - * - * @return The Close-out from the MTM on the Counter Party Default - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double counterPartyDefault ( - final double dblMTM) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblMTM)) - throw new java.lang.Exception ("MasterAgreementCloseOut::counterPartyDefault => Invalid Inputs"); - - return dblMTM < 0. ? dblMTM : _dblCounterPartyRecovery * dblMTM; - } -} diff --git a/org/drip/xva/definition/SimpleBalanceSheet.java b/org/drip/xva/definition/SimpleBalanceSheet.java deleted file mode 100644 index 77bd80c..0000000 --- a/org/drip/xva/definition/SimpleBalanceSheet.java +++ /dev/null @@ -1,149 +0,0 @@ - -package org.drip.xva.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * SimpleBalanceSheet implements a Simple Bank Balance Sheet Model as specified in Burgard and Kjaer (2012). - * The References are: - * - * - Burgard, C., and M. Kjaer (2011): 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 (2012): In the Balance, Risk, 24 (11) 72-75. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class SimpleBalanceSheet { - private double _dblAsset = java.lang.Double.NaN; - private double _dblLiability = java.lang.Double.NaN; - - /** - * SimpleBalanceSheet Constructor - * - * @param dblAsset The Balance Sheet Asset - * @param dblLiability The Balance Sheet Liability - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public SimpleBalanceSheet ( - final double dblAsset, - final double dblLiability) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblAsset = dblAsset) || - !org.drip.quant.common.NumberUtil.IsValid (_dblLiability = dblLiability)) - throw new java.lang.Exception ("SimpleBalanceSheet Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Balance Sheet Asset - * - * @return The Balance Sheet Asset - */ - - public double asset() - { - return _dblAsset; - } - - /** - * Retrieve the Balance Sheet Liability - * - * @return The Balance Sheet Liability - */ - - public double liability() - { - return _dblLiability; - } - - /** - * Retrieve the Balance Sheet Implied Recovery - * - * @return The Balance Sheet Implied Recovery - */ - - public double impliedRecovery() - { - return _dblAsset / _dblLiability; - } - - /** - * Generate the Updated Balance Sheet resulting from a Derivative Value Infusion - * - * @param dblDerivativeValue The Derivative Value - * - * @return The Updated Balance Sheet - */ - - public SimpleBalanceSheet derivativeInfusion ( - final double dblDerivativeValue) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblDerivativeValue) || 0. > dblDerivativeValue) - return null; - - try { - return new SimpleBalanceSheet (_dblAsset + dblDerivativeValue, _dblLiability + - dblDerivativeValue); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/xva/definition/SpreadIntensity.java b/org/drip/xva/definition/SpreadIntensity.java deleted file mode 100644 index b22210c..0000000 --- a/org/drip/xva/definition/SpreadIntensity.java +++ /dev/null @@ -1,131 +0,0 @@ - -package org.drip.xva.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * SpreadIntensity holds the Funding Spreads and the Bank/Counter Party Intensities, as laid out in Burgard - * and Kjaer (2014). 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class SpreadIntensity { - private double _dblBankFundingSpread = java.lang.Double.NaN; - private double _dblBankDefaultIntensity = java.lang.Double.NaN; - private double _dblCounterPartyDefaultIntensity = java.lang.Double.NaN; - - /** - * SpreadIntensity Constructor - * - * @param dblBankFundingSpread The Bank Funding Spread - * @param dblBankDefaultIntensity The Bank Default Intensity - * @param dblCounterPartyDefaultIntensity The Counter Party Default Intensity - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public SpreadIntensity ( - final double dblBankFundingSpread, - final double dblBankDefaultIntensity, - final double dblCounterPartyDefaultIntensity) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblBankFundingSpread = dblBankFundingSpread) || - !org.drip.quant.common.NumberUtil.IsValid (_dblBankDefaultIntensity = dblBankDefaultIntensity) || - !org.drip.quant.common.NumberUtil.IsValid (_dblCounterPartyDefaultIntensity = - dblCounterPartyDefaultIntensity)) - throw new java.lang.Exception ("SpreadIntensity Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Bank Funding Spread - * - * @return The Bank Funding Spread - */ - - public double bankFundingSpread() - { - return _dblBankFundingSpread; - } - - /** - * Retrieve the Bank Default Intensity - * - * @return The Bank Default Intensity - */ - - public double bankDefaultIntensity() - { - return _dblBankDefaultIntensity; - } - - /** - * Retrieve the Counter Party Default Intensity - * - * @return The Counter Party Default Intensity - */ - - public double counterPartyDefaultIntensity() - { - return _dblCounterPartyDefaultIntensity; - } -} diff --git a/org/drip/xva/definition/Tradeable.java b/org/drip/xva/definition/Tradeable.java deleted file mode 100644 index 20471f5..0000000 --- a/org/drip/xva/definition/Tradeable.java +++ /dev/null @@ -1,126 +0,0 @@ - -package org.drip.xva.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * Tradeable holds Definitions and Parameters that specify a Trade-able Entity in XVA Terms. 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class Tradeable { - private double _dblRepoRate = java.lang.Double.NaN; - private org.drip.measure.process.DiffusionEvolver _dePriceNumeraire = null; - - /** - * Trade-able Constructor - * - * @param dePriceNumeraire The Trade-able Asset Price Numeraire Evolver - * @param dblRepoRate The Trade-able Asset Repo Rate - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public Tradeable ( - final org.drip.measure.process.DiffusionEvolver dePriceNumeraire, - final double dblRepoRate) - throws java.lang.Exception - { - if (null == (_dePriceNumeraire = dePriceNumeraire) || !org.drip.quant.common.NumberUtil.IsValid - (_dblRepoRate = dblRepoRate)) - throw new java.lang.Exception ("Tradeable Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Trade-able Asset Price Numeraire Evolver - * - * @return The Trade-able Asset Price Numeraire Evolver - */ - - public org.drip.measure.process.DiffusionEvolver priceNumeraire() - { - return _dePriceNumeraire; - } - - /** - * Retrieve the Trade-able Asset Repo Rate - * - * @return The Trade-able Asset Repo Rate - */ - - public double repoRate() - { - return _dblRepoRate; - } - - /** - * Retrieve the Trade-able Asset Cash Accumulation Rate - * - * @return The Trade-able Asset Cash Accumulation Rate - */ - - public double cashAccumulationRate() - { - return -1. * _dblRepoRate; - } -} diff --git a/org/drip/xva/definition/TwoWayRiskyUniverse.java b/org/drip/xva/definition/TwoWayRiskyUniverse.java deleted file mode 100644 index f01372c..0000000 --- a/org/drip/xva/definition/TwoWayRiskyUniverse.java +++ /dev/null @@ -1,145 +0,0 @@ - -package org.drip.xva.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * TwoWayRiskyUniverse describes the Economy with Four Traded Assets - the Default-free Zero Coupon Bond, the - * Default-able Zero Coupon Bank Bond, the Default-able Zero Coupon Counter-party, and an Asset the follows - * Brownian Motion. 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class TwoWayRiskyUniverse { - private org.drip.xva.definition.Tradeable _tAsset = null; - private org.drip.xva.definition.Tradeable _tZeroCouponBankBond = null; - private org.drip.xva.definition.Tradeable _tZeroCouponCollateralBond = null; - private org.drip.xva.definition.Tradeable _tZeroCouponCounterPartyBond = null; - - /** - * TwoWayRiskyUniverse Constructor - * - * @param tAsset The Trade-able Asset - * @param tZeroCouponCollateralBond The Zero Coupon Collateral Bond - * @param tZeroCouponBankBond The Zero Coupon Credit Risky Bank Bond - * @param tZeroCouponCounterPartyBond The Zero Coupon Credit Risky Counter Party Bond - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public TwoWayRiskyUniverse ( - final org.drip.xva.definition.Tradeable tAsset, - final org.drip.xva.definition.Tradeable tZeroCouponCollateralBond, - final org.drip.xva.definition.Tradeable tZeroCouponBankBond, - final org.drip.xva.definition.Tradeable tZeroCouponCounterPartyBond) - throws java.lang.Exception - { - if (null == (_tAsset = tAsset) || null == (_tZeroCouponCollateralBond = tZeroCouponCollateralBond) || - null == (_tZeroCouponBankBond = tZeroCouponBankBond) || null == (_tZeroCouponCounterPartyBond = - tZeroCouponCounterPartyBond)) - throw new java.lang.Exception ("TwoWayRiskyUniverse Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Asset - * - * @return The Asset - */ - - public org.drip.xva.definition.Tradeable asset() - { - return _tAsset; - } - - /** - * Retrieve the Zero Coupon Collateral Bond - * - * @return The Zero Coupon Collateral Bond - */ - - public org.drip.xva.definition.Tradeable zeroCouponCollateralBond() - { - return _tZeroCouponCollateralBond; - } - - /** - * Retrieve the Zero Coupon Credit Risky Bank Bond - * - * @return The Zero Coupon Credit Risky Bank Bond - */ - - public org.drip.xva.definition.Tradeable zeroCouponBankBond() - { - return _tZeroCouponBankBond; - } - - /** - * Retrieve the Zero Coupon Credit Risky Counter Party Bond - * - * @return The Zero Coupon Credit Risky Counter Party Bond - */ - - public org.drip.xva.definition.Tradeable zeroCouponCounterPartyBond() - { - return _tZeroCouponCounterPartyBond; - } -} diff --git a/org/drip/xva/definition/UniverseSnapshot.java b/org/drip/xva/definition/UniverseSnapshot.java deleted file mode 100644 index ef9f315..0000000 --- a/org/drip/xva/definition/UniverseSnapshot.java +++ /dev/null @@ -1,147 +0,0 @@ - -package org.drip.xva.definition; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * UniverseSnapshot holds the current Realizations of the Traded Asset Numeraires of the Reference Universe. - * 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class UniverseSnapshot { - private org.drip.measure.realization.JumpDiffusionEdge _jdeAssetNumeraire = null; - private org.drip.measure.realization.JumpDiffusionEdge _jdeZeroCouponBondBankNumeraire = null; - private org.drip.measure.realization.JumpDiffusionEdge _jdeZeroCouponBondCollateralNumeraire = null; - private org.drip.measure.realization.JumpDiffusionEdge _jdeZeroCouponBondCounterPartyNumeraire = null; - - /** - * UniverseSnapshot Constructor - * - * @param jdeAssetNumeraire The Asset Numeraire Level Realization - * @param jdeZeroCouponBondCollateralNumeraire The Zero Coupon Collateral Bond Numeraire Level - * Realization - * @param jdeZeroCouponBondBankNumeraire The Zero Coupon Bank Bond Numeraire Level Realization - * @param jdeZeroCouponBondCounterPartyNumeraire The Zero Coupon Counter Party Bond Numeraire Level - * Realization - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public UniverseSnapshot ( - final org.drip.measure.realization.JumpDiffusionEdge jdeAssetNumeraire, - final org.drip.measure.realization.JumpDiffusionEdge jdeZeroCouponBondCollateralNumeraire, - final org.drip.measure.realization.JumpDiffusionEdge jdeZeroCouponBondBankNumeraire, - final org.drip.measure.realization.JumpDiffusionEdge jdeZeroCouponBondCounterPartyNumeraire) - throws java.lang.Exception - { - if (null == (_jdeAssetNumeraire = jdeAssetNumeraire) || null == - (_jdeZeroCouponBondCollateralNumeraire = jdeZeroCouponBondCollateralNumeraire) || null == - (_jdeZeroCouponBondBankNumeraire = jdeZeroCouponBondBankNumeraire) || null == - (_jdeZeroCouponBondCounterPartyNumeraire = jdeZeroCouponBondCounterPartyNumeraire)) - throw new java.lang.Exception ("UniverseSnapshot Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Asset Numeraire Level Realization - * - * @return The Asset Numeraire Level Realization - */ - - public org.drip.measure.realization.JumpDiffusionEdge assetNumeraire() - { - return _jdeAssetNumeraire; - } - - /** - * Retrieve the Zero Coupon Collateral Bond Numeraire Level Realization - * - * @return The Zero Coupon Collateral Bond Numeraire Level Realization - */ - - public org.drip.measure.realization.JumpDiffusionEdge zeroCouponCollateralBondNumeraire() - { - return _jdeZeroCouponBondCollateralNumeraire; - } - - /** - * Retrieve the Zero Coupon Bank Bond Numeraire Level Realization - * - * @return The Zero Coupon Bank Bond Numeraire Level Realization - */ - - public org.drip.measure.realization.JumpDiffusionEdge zeroCouponBankBondNumeraire() - { - return _jdeZeroCouponBondBankNumeraire; - } - - /** - * Retrieve the Zero Coupon Counter Party Bond Numeraire Level Realization - * - * @return The Zero Coupon Counter Party Bond Numeraire Level Realization - */ - - public org.drip.measure.realization.JumpDiffusionEdge zeroCouponCounterPartyBondNumeraire() - { - return _jdeZeroCouponBondCounterPartyNumeraire; - } -} diff --git a/org/drip/xva/derivative/CashAccountRebalancer.java b/org/drip/xva/derivative/CashAccountRebalancer.java deleted file mode 100644 index 6d34a2a..0000000 --- a/org/drip/xva/derivative/CashAccountRebalancer.java +++ /dev/null @@ -1,116 +0,0 @@ - -package org.drip.xva.derivative; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CashAccountRebalancer holds the Level Cash Account Increment and the Level Derivative Value Update for a - * Trajectory that has just undergone Cash Account Re-balancing, as laid out in Burgard and Kjaer (2014). - * 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CashAccountRebalancer { - private org.drip.xva.derivative.LevelCashAccount _lca = null; - private double _dblLevelDerivativeXVAValue = java.lang.Double.NaN; - - /** - * CashAccountRebalancer Constructor - * - * @param lca The Level Cash Account Instance - * @param dblLevelDerivativeXVAValue The Level XVA Derivative Value - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CashAccountRebalancer ( - final org.drip.xva.derivative.LevelCashAccount lca, - final double dblLevelDerivativeXVAValue) - throws java.lang.Exception - { - if (null == (_lca = lca) || !org.drip.quant.common.NumberUtil.IsValid (_dblLevelDerivativeXVAValue = - dblLevelDerivativeXVAValue)) - throw new java.lang.Exception ("CashAccountRebalancer Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Level Cash Account Instance - * - * @return The Level Cash Account Instance - */ - - public org.drip.xva.derivative.LevelCashAccount cashAccount() - { - return _lca; - } - - /** - * Retrieve the Level Derivative XVA Value Increment - * - * @return The Level Derivative XVA Value Increment - */ - - public double levelDerivativeXVAValue() - { - return _dblLevelDerivativeXVAValue; - } -} diff --git a/org/drip/xva/derivative/EdgeAssetGreek.java b/org/drip/xva/derivative/EdgeAssetGreek.java deleted file mode 100644 index 6ff2381..0000000 --- a/org/drip/xva/derivative/EdgeAssetGreek.java +++ /dev/null @@ -1,147 +0,0 @@ - -package org.drip.xva.derivative; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * EdgeAssetGreek holds the Derivative XVA Value, its Delta, and its Gamma to the Asset Value. 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class EdgeAssetGreek { - private double _dblDerivativeValue = java.lang.Double.NaN; - private double _dblDerivativeXVAValue = java.lang.Double.NaN; - private double _dblDerivativeXVAValueDelta = java.lang.Double.NaN; - private double _dblDerivativeXVAValueGamma = java.lang.Double.NaN; - - /** - * EdgeAssetGreek Constructor - * - * @param dblDerivativeXVAValue The Derivative XVA Value - * @param dblDerivativeXVAValueDelta The Derivative XVA Value Delta - * @param dblDerivativeXVAValueGamma The Derivative XVA Value Gamma - * @param dblDerivativeValue The Derivative Value - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public EdgeAssetGreek ( - final double dblDerivativeXVAValue, - final double dblDerivativeXVAValueDelta, - final double dblDerivativeXVAValueGamma, - final double dblDerivativeValue) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblDerivativeXVAValue = dblDerivativeXVAValue) || - !org.drip.quant.common.NumberUtil.IsValid (_dblDerivativeXVAValueDelta = - dblDerivativeXVAValueDelta) || !org.drip.quant.common.NumberUtil.IsValid - (_dblDerivativeXVAValueGamma = dblDerivativeXVAValueGamma)) - throw new java.lang.Exception ("EdgeAssetGreek Constructor => Invalid Inputs"); - - _dblDerivativeValue = dblDerivativeValue; - } - - /** - * Retrieve the Derivative XVA Value - * - * @return The Derivative XVA Value - */ - - public double derivativeXVAValue() - { - return _dblDerivativeXVAValue; - } - - /** - * Retrieve the Derivative XVA Value Delta - * - * @return The Derivative XVA Value Delta - */ - - public double derivativeXVAValueDelta() - { - return _dblDerivativeXVAValueDelta; - } - - /** - * Retrieve the Derivative XVA Value Gamma - * - * @return The Derivative XVA Value Gamma - */ - - public double derivativeXVAValueGamma() - { - return _dblDerivativeXVAValueGamma; - } - - /** - * Retrieve the Derivative Non XVA Value - * - * @return The Derivative Non XVA Value - */ - - public double derivativeValue() - { - return _dblDerivativeValue; - } -} diff --git a/org/drip/xva/derivative/EdgeEvolutionTrajectory.java b/org/drip/xva/derivative/EdgeEvolutionTrajectory.java deleted file mode 100644 index 1cf9ce9..0000000 --- a/org/drip/xva/derivative/EdgeEvolutionTrajectory.java +++ /dev/null @@ -1,174 +0,0 @@ - -package org.drip.xva.derivative; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * EdgeEvolutionTrajectory holds the Evolution Snapshot of the Trade-able Prices, the Cash Account, the - * Replication Portfolio, and the corresponding Derivative Value, as laid out in Burgard and Kjaer (2014). - * 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class EdgeEvolutionTrajectory { - private double _dblTime = java.lang.Double.NaN; - private org.drip.xva.derivative.EdgeAssetGreek _eag = null; - private double _dblGainOnBankDefault = java.lang.Double.NaN; - private org.drip.xva.definition.UniverseSnapshot _us = null; - private double _dblGainOnCounterPartyDefault = java.lang.Double.NaN; - private org.drip.xva.derivative.EdgeReplicationPortfolio _erp = null; - - /** - * EdgeEvolutionTrajectory Constructor - * - * @param dblTime The Evolution Trajectory Edge Time - * @param us Realization of the Trade-able Asset Prices - * @param erp The Edge Replication Portfolio Snapshot - * @param eag The Edge Asset Greek Instance - * @param dblGainOnBankDefault The Counter Party Gain On Bank Default - * @param dblGainOnCounterPartyDefault The Bank Gain On Counter Party Default - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public EdgeEvolutionTrajectory ( - final double dblTime, - final org.drip.xva.definition.UniverseSnapshot us, - final org.drip.xva.derivative.EdgeReplicationPortfolio erp, - final org.drip.xva.derivative.EdgeAssetGreek eag, - final double dblGainOnBankDefault, - final double dblGainOnCounterPartyDefault) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblTime = dblTime) || null == (_us = us) || null == - (_erp = erp) || null == (_eag = eag) || !org.drip.quant.common.NumberUtil.IsValid - (_dblGainOnBankDefault = dblGainOnBankDefault) || !org.drip.quant.common.NumberUtil.IsValid - (_dblGainOnCounterPartyDefault = dblGainOnCounterPartyDefault)) - throw new java.lang.Exception ("EdgeEvolutionTrajectory Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Time Instant - * - * @return The Time Instant - */ - - public double time() - { - return _dblTime; - } - - /** - * Retrieve the Realization of the Trade-able Asset Prices - * - * @return Realization of the Trade-able Asset Prices - */ - - public org.drip.xva.definition.UniverseSnapshot tradeableAssetSnapshot() - { - return _us; - } - - /** - * Retrieve the Edge Replication Portfolio Snapshot - * - * @return The Edge Replication Portfolio Snapshot - */ - - public org.drip.xva.derivative.EdgeReplicationPortfolio replicationPortfolio() - { - return _erp; - } - - /** - * Retrieve the EdgeAssetGreek Instance - * - * @return The EdgeAssetGreek Instance - */ - - public org.drip.xva.derivative.EdgeAssetGreek edgeAssetGreek() - { - return _eag; - } - - /** - * Retrieve the Counter Party Gain On Bank Default - * - * @return The Counter Party Gain On Bank Default - */ - - public double gainOnBankDefault() - { - return _dblGainOnBankDefault; - } - - /** - * Retrieve the Bank Gain On Counter Party Default - * - * @return The Bank Gain On Counter Party Default - */ - - public double gainOnCounterPartyDefault() - { - return _dblGainOnCounterPartyDefault; - } -} diff --git a/org/drip/xva/derivative/EdgeReplicationPortfolio.java b/org/drip/xva/derivative/EdgeReplicationPortfolio.java deleted file mode 100644 index c817a3e..0000000 --- a/org/drip/xva/derivative/EdgeReplicationPortfolio.java +++ /dev/null @@ -1,167 +0,0 @@ - -package org.drip.xva.derivative; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * EdgeReplicationPortfolio contains the Dynamic Replicating Portfolio of the Pay-out using the Assets in the - * Economy, from the Bank's View Point. 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class EdgeReplicationPortfolio { - private double _dblAssetUnits = java.lang.Double.NaN; - private double _dblCashAccount = java.lang.Double.NaN; - private double _dblBankBondUnits = java.lang.Double.NaN; - private double _dblCounterPartyBondUnits = java.lang.Double.NaN; - - /** - * EdgeReplicationPortfolio Constructor - * - * @param dblAssetUnits The Number of Asset Replication Units - * @param dblBankBondUnits The Number of Bank Zero Coupon Bond Replication Units - * @param dblCounterPartyBondUnits The Number of Counter Party Zero Coupon Bond Replication Units - * @param dblCashAccount The Cash Account - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public EdgeReplicationPortfolio ( - final double dblAssetUnits, - final double dblBankBondUnits, - final double dblCounterPartyBondUnits, - final double dblCashAccount) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblAssetUnits = dblAssetUnits) || - !org.drip.quant.common.NumberUtil.IsValid (_dblBankBondUnits = dblBankBondUnits) || - !org.drip.quant.common.NumberUtil.IsValid (_dblCounterPartyBondUnits = - dblCounterPartyBondUnits) || dblCounterPartyBondUnits > 0. || - !org.drip.quant.common.NumberUtil.IsValid (_dblCashAccount = dblCashAccount)) - throw new java.lang.Exception ("EdgeReplicationPortfolio Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Number of Asset Replication Units - * - * @return The Number of Asset Replication Units - */ - - public double assetUnits() - { - return _dblAssetUnits; - } - - /** - * Retrieve the Number of Bank Zero Coupon Bond Replication Units - * - * @return The Number of Bank Zero Coupon Bond Replication Units - */ - - public double bankBondUnits() - { - return _dblBankBondUnits; - } - - /** - * Retrieve the Number of Counter Party Zero Coupon Bond Replication Units - * - * @return The Number of Counter Party Zero Coupon Bond Replication Units - */ - - public double counterPartyBondUnits() - { - return _dblCounterPartyBondUnits; - } - - /** - * Retrieve the Cash Account Amount - * - * @return The Cash Account Amount - */ - - public double cashAccount() - { - return _dblCashAccount; - } - - /** - * Compute the Market Value of the Portfolio - * - * @param us The Trade-able Asset Market Snapshot - * - * @return The Market Value of the Portfolio - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double value ( - final org.drip.xva.definition.UniverseSnapshot us) - throws java.lang.Exception - { - if (null == us) throw new java.lang.Exception ("EdgeReplicationPortfolio::value => Invalid Inputs"); - - return -1. * (_dblAssetUnits * us.assetNumeraire().finish() + _dblBankBondUnits * - us.zeroCouponBankBondNumeraire().finish() + _dblCounterPartyBondUnits * - us.zeroCouponCounterPartyBondNumeraire().finish() + _dblCashAccount); - } -} diff --git a/org/drip/xva/derivative/LevelCashAccount.java b/org/drip/xva/derivative/LevelCashAccount.java deleted file mode 100644 index 9522ef5..0000000 --- a/org/drip/xva/derivative/LevelCashAccount.java +++ /dev/null @@ -1,144 +0,0 @@ - -package org.drip.xva.derivative; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * LevelCashAccount holds the Increments of the Cash Account Components resulting from the Dynamic - * Replication Process. 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class LevelCashAccount { - private double _dblBankAccumulation = java.lang.Double.NaN; - private double _dblAssetAccumulation = java.lang.Double.NaN; - private double _dblCounterPartyAccumulation = java.lang.Double.NaN; - - /** - * LevelCashAccount Constructor - * - * @param dblAssetAccumulation The Incremental Amount added to the Cash Account coming from the Asset - * @param dblBankAccumulation The Incremental Amount added to the Cash Account coming from the Bank - * Borrowing/Funding - * @param dblCounterPartyAccumulation The Incremental Amount added to the Cash Account coming from the - * Counter Party Repo - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public LevelCashAccount ( - final double dblAssetAccumulation, - final double dblBankAccumulation, - final double dblCounterPartyAccumulation) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblAssetAccumulation = dblAssetAccumulation) || - !org.drip.quant.common.NumberUtil.IsValid (_dblBankAccumulation = dblBankAccumulation) || - !org.drip.quant.common.NumberUtil.IsValid (_dblCounterPartyAccumulation = - dblCounterPartyAccumulation)) - throw new java.lang.Exception ("LevelCashAccount Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Incremental Amount added to the Cash Account coming from the Asset - * - * @return The Incremental Amount added to the Cash Account coming from the Asset - */ - - public double assetAccumulation() - { - return _dblAssetAccumulation; - } - - /** - * Retrieve the Incremental Amount added to the Cash Account coming from Borrowing/Funding - * - * @return The Incremental Amount added to the Cash Account coming from Borrowing/Funding - */ - - public double bankAccumulation() - { - return _dblBankAccumulation; - } - - /** - * Retrieve the Incremental Amount added to the Cash Account coming from the Counter Party Repo - * - * @return The Incremental Amount added to the Cash Account coming from the Counter Party Repo - */ - - public double counterPartyAccumulation() - { - return _dblCounterPartyAccumulation; - } - - /** - * Retrieve the Cumulative Increment - * - * @return The Cumulative Increment - */ - - public double accumulation() - { - return _dblAssetAccumulation + _dblBankAccumulation + _dblCounterPartyAccumulation; - } -} diff --git a/org/drip/xva/derivative/LevelEvolutionTrajectory.java b/org/drip/xva/derivative/LevelEvolutionTrajectory.java deleted file mode 100644 index ff95120..0000000 --- a/org/drip/xva/derivative/LevelEvolutionTrajectory.java +++ /dev/null @@ -1,129 +0,0 @@ - -package org.drip.xva.derivative; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * LevelEvolutionTrajectory holds the Evolution Edges of the Trajectory, the Cash Account, and the Derivative - * Values evolved in a Dynamically Adaptive Manner, as laid out in Burgard and Kjaer (2014). 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class LevelEvolutionTrajectory { - private org.drip.xva.derivative.LevelCashAccount _lca = null; - private org.drip.xva.derivative.EdgeEvolutionTrajectory _eetStart = null; - private org.drip.xva.derivative.EdgeEvolutionTrajectory _eetFinish = null; - - /** - * LevelEvolutionTrajectory Constructor - * - * @param eetStart The Starting Evolution Trajectory Edge Instance - * @param eetFinish The Finishing Evolution Trajectory Edge Instance - * @param lca The Level Cash Account Instance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public LevelEvolutionTrajectory ( - final org.drip.xva.derivative.EdgeEvolutionTrajectory eetStart, - final org.drip.xva.derivative.EdgeEvolutionTrajectory eetFinish, - final org.drip.xva.derivative.LevelCashAccount lca) - throws java.lang.Exception - { - if (null == (_eetStart = eetStart) || null == (_eetFinish = eetFinish) || null == (_lca = lca)) - throw new java.lang.Exception ("LevelEvolutionTrajectory Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Starting Evolution Trajectory Edge Instance - * - * @return The Starting Evolution Trajectory Edge Instance - */ - - public org.drip.xva.derivative.EdgeEvolutionTrajectory edgeStart() - { - return _eetStart; - } - - /** - * Retrieve the Finishing Evolution Trajectory Edge Instance - * - * @return The Finishing Evolution Trajectory Edge Instance - */ - - public org.drip.xva.derivative.EdgeEvolutionTrajectory edgeFinish() - { - return _eetFinish; - } - - /** - * Retrieve the Level Cash Account Instance - * - * @return The Level Cash Account Instance - */ - - public org.drip.xva.derivative.LevelCashAccount cashAccount() - { - return _lca; - } -} diff --git a/org/drip/xva/derivative/TerminalPayout.java b/org/drip/xva/derivative/TerminalPayout.java deleted file mode 100644 index d1b7639..0000000 --- a/org/drip/xva/derivative/TerminalPayout.java +++ /dev/null @@ -1,114 +0,0 @@ - -package org.drip.xva.derivative; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * TerminalPayout implements the Pay-out Function on the given Asset, using its Marginal Evolution Process, - * at the specified Terminal Time Instance. 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class TerminalPayout { - private org.drip.analytics.date.JulianDate _dt = null; - private org.drip.function.definition.R1ToR1 _r1ToR1Payout = null; - - /** - * TerminalPayout Constructor - * - * @param dt The Terminal Pay Out Date - * @param r1ToR1Payout The R^1 To R^1 Pay-out Function - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public TerminalPayout ( - final org.drip.analytics.date.JulianDate dt, - final org.drip.function.definition.R1ToR1 r1ToR1Payout) - throws java.lang.Exception - { - if (null == (_dt = dt) || null == (_r1ToR1Payout = r1ToR1Payout)) - throw new java.lang.Exception ("TerminalPayout Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Terminal Pay Out Date - * - * @return The Terminal Pay Out Date - */ - - public org.drip.analytics.date.JulianDate date() - { - return _dt; - } - - /** - * Retrieve the R^1 To R^1 Pay-out Function - * - * @return The R^1 To R^1 Pay-out Function - */ - - public org.drip.function.definition.R1ToR1 function() - { - return _r1ToR1Payout; - } -} diff --git a/org/drip/xva/pde/BurgardKjaerOperator.java b/org/drip/xva/pde/BurgardKjaerOperator.java deleted file mode 100644 index 7808a0f..0000000 --- a/org/drip/xva/pde/BurgardKjaerOperator.java +++ /dev/null @@ -1,257 +0,0 @@ - -package org.drip.xva.pde; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * BurgardKjaerOperator sets up the Parabolic Differential Equation PDE based on the Ito Evolution - * Differential for the Reference Underlier Asset, as laid out in Burgard and Kjaer (2014). 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class BurgardKjaerOperator { - private org.drip.xva.settings.PDEEvolutionControl _settings = null; - private org.drip.xva.definition.TwoWayRiskyUniverse _twru = null; - private org.drip.xva.definition.MasterAgreementCloseOut _maco = null; - - /** - * BurgardKjaerOperator Constructor - * - * @param twru The Universe of Trade-able Assets - * @param maco The Master Agreement Close Out Boundary Conditions - * @param settings The XVA Control Settings - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public BurgardKjaerOperator ( - final org.drip.xva.definition.TwoWayRiskyUniverse twru, - final org.drip.xva.definition.MasterAgreementCloseOut maco, - final org.drip.xva.settings.PDEEvolutionControl settings) - throws java.lang.Exception - { - if (null == (_twru = twru) || null == (_maco = maco) || null == (_settings = settings)) - throw new java.lang.Exception ("BurgardKjaerOperator Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Universe of Trade-able Assets - * - * @return The Universe of Trade-able Assets - */ - - public org.drip.xva.definition.TwoWayRiskyUniverse universe() - { - return _twru; - } - - /** - * Retrieve the Close Out Boundary Condition - * - * @return The Close Out Boundary Condition - */ - - public org.drip.xva.definition.MasterAgreementCloseOut boundaryCondition() - { - return _maco; - } - - /** - * Retrieve the XVA Control Settings - * - * @return The XVA Control Settings - */ - - public org.drip.xva.settings.PDEEvolutionControl settings() - { - return _settings; - } - - /** - * Generate the Time Increment using the Burgard Kjaer Scheme - * - * @param si The Spread Intensity Instance - * @param eet The Edge Evolution Trajectory Instance - * - * @return The Time Increment using the Burgard Kjaer Scheme - */ - - public org.drip.xva.pde.LevelBurgardKjaerRun timeIncrementRun ( - final org.drip.xva.definition.SpreadIntensity si, - final org.drip.xva.derivative.EdgeEvolutionTrajectory eet) - { - if (null == si || null == eet) return null; - - double dblTime = eet.time(); - - org.drip.xva.definition.UniverseSnapshot us = eet.tradeableAssetSnapshot(); - - double dblBankDefaultCloseOut = eet.gainOnBankDefault(); - - double dblAssetValue = us.assetNumeraire().finish(); - - double dblAssetBump = _settings.sensitivityShiftFactor() * dblAssetValue; - - double dblDerivativeXVAValue = eet.edgeAssetGreek().derivativeXVAValue(); - - double dblBankDefaultDerivativeValue = dblDerivativeXVAValue + dblBankDefaultCloseOut; - - try { - double[] adblBumpedTheta = new org.drip.xva.pde.ParabolicDifferentialOperator - (_twru.asset()).thetaUpDown (eet, dblAssetValue, dblAssetBump); - - if (null == adblBumpedTheta || 3 != adblBumpedTheta.length) return null; - - return new org.drip.xva.pde.LevelBurgardKjaerRun ( - dblAssetBump, - -1. * adblBumpedTheta[0], - -1. * adblBumpedTheta[1], - -1. * adblBumpedTheta[2], - _twru.zeroCouponCollateralBond().priceNumeraire().evaluator().volatility().value ( - new org.drip.measure.realization.JumpDiffusionVertex ( - dblTime, - us.zeroCouponCollateralBondNumeraire().finish(), - 0., - false - ) - ) * dblDerivativeXVAValue, - si.bankFundingSpread() * ( - dblBankDefaultDerivativeValue > 0. ? dblBankDefaultDerivativeValue : 0. - ), - -1. * si.bankDefaultIntensity() * dblBankDefaultCloseOut, - -1. * si.counterPartyDefaultIntensity() * eet.gainOnCounterPartyDefault() - ); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate the Time Increment Run Attribution using the Burgard Kjaer Scheme - * - * @param si The Spread Intensity Instance - * @param eet The Edge Evolution Trajectory Instance - * - * @return The Time Increment Run Attribution using the Burgard Kjaer Scheme - */ - - public org.drip.xva.pde.LevelBurgardKjaerAttribution timeIncrementRunAttribution ( - final org.drip.xva.definition.SpreadIntensity si, - final org.drip.xva.derivative.EdgeEvolutionTrajectory eet) - { - if (null == si || null == eet) return null; - - double dblTime = eet.time(); - - double dblBankDefaultIntensity = si.bankDefaultIntensity(); - - double dblCounterPartyDefaultIntensity = si.counterPartyDefaultIntensity(); - - org.drip.xva.definition.UniverseSnapshot us = eet.tradeableAssetSnapshot(); - - double dblDerivativeXVAValue = eet.edgeAssetGreek().derivativeXVAValue(); - - double dblCloseOutMTM = org.drip.xva.settings.PDEEvolutionControl.CLOSEOUT_GREGORY_LI_TANG == - _settings.closeOutScheme() ? dblDerivativeXVAValue : dblDerivativeXVAValue; - - double dblBankExposure = dblCloseOutMTM > 0. ? dblCloseOutMTM : _maco.bankRecovery() * - dblCloseOutMTM; - - double dblAssetValue = us.assetNumeraire().finish(); - - double dblAssetBump = _settings.sensitivityShiftFactor() * dblAssetValue; - - try { - double[] adblBumpedTheta = new org.drip.xva.pde.ParabolicDifferentialOperator - (_twru.asset()).thetaUpDown (eet, dblAssetValue, dblAssetBump); - - if (null == adblBumpedTheta || 3 != adblBumpedTheta.length) return null; - - return new org.drip.xva.pde.LevelBurgardKjaerAttribution ( - dblAssetBump, - -1. * adblBumpedTheta[0], - -1. * adblBumpedTheta[1], - -1. * adblBumpedTheta[2], - _twru.zeroCouponCollateralBond().priceNumeraire().evaluator().volatility().value ( - new org.drip.measure.realization.JumpDiffusionVertex ( - dblTime, - us.zeroCouponCollateralBondNumeraire().finish(), - 0., - false - ) - ) * dblDerivativeXVAValue, - (dblBankDefaultIntensity + dblCounterPartyDefaultIntensity) * dblDerivativeXVAValue, - si.bankFundingSpread() * dblBankExposure, - -1. * dblBankDefaultIntensity * dblBankExposure, - -1. * dblCounterPartyDefaultIntensity * (dblCloseOutMTM < 0. ? dblCloseOutMTM : - _maco.counterPartyRecovery() * dblCloseOutMTM) - ); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/xva/pde/LevelBurgardKjaer.java b/org/drip/xva/pde/LevelBurgardKjaer.java deleted file mode 100644 index f182470..0000000 --- a/org/drip/xva/pde/LevelBurgardKjaer.java +++ /dev/null @@ -1,174 +0,0 @@ - -package org.drip.xva.pde; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * LevelBurgardKjaer holds the Underlier Stochastic and the Credit Risk Free Components of the XVA Derivative - * Value Growth, as laid out in Burgard and Kjaer (2014). 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public abstract class LevelBurgardKjaer { - private double _dblAssetNumeraireBump = java.lang.Double.NaN; - private double _dblDerivativeXVACollateralGrowth = java.lang.Double.NaN; - private double _dblDerivativeXVAStochasticGrowth = java.lang.Double.NaN; - private double _dblDerivativeXVAStochasticGrowthUp = java.lang.Double.NaN; - private double _dblDerivativeXVAStochasticGrowthDown = java.lang.Double.NaN; - - protected LevelBurgardKjaer ( - final double dblAssetNumeraireBump, - final double dblDerivativeXVAStochasticGrowthDown, - final double dblDerivativeXVAStochasticGrowth, - final double dblDerivativeXVAStochasticGrowthUp, - final double dblDerivativeXVACollateralGrowth) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblAssetNumeraireBump = dblAssetNumeraireBump) || - !org.drip.quant.common.NumberUtil.IsValid (_dblDerivativeXVAStochasticGrowthDown = - dblDerivativeXVAStochasticGrowthDown) || !org.drip.quant.common.NumberUtil.IsValid - (_dblDerivativeXVAStochasticGrowth = dblDerivativeXVAStochasticGrowth) || - !org.drip.quant.common.NumberUtil.IsValid (_dblDerivativeXVAStochasticGrowthUp = - dblDerivativeXVAStochasticGrowthUp) || !org.drip.quant.common.NumberUtil.IsValid - (_dblDerivativeXVACollateralGrowth = dblDerivativeXVACollateralGrowth)) - throw new java.lang.Exception ("LevelBurgardKjaer Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Asset Numeraire Bump - * - * @return The Asset Numeraire Bump - */ - - public double assetNumeraireBump() - { - return _dblAssetNumeraireBump; - } - - /** - * Retrieve the Stochastic Down Component of the Derivative XVA Value - * - * @return The Stochastic Down Component of the Derivative XVA Value - */ - - public double derivativeXVAStochasticGrowthDown() - { - return _dblDerivativeXVAStochasticGrowthDown; - } - - /** - * Retrieve the Stochastic Component of the Derivative XVA Value Growth - * - * @return The Stochastic Component of the Derivative XVA Value Growth - */ - - public double derivativeXVAStochasticGrowth() - { - return _dblDerivativeXVAStochasticGrowth; - } - - /** - * Retrieve the Stochastic Up Component of the Derivative XVA Value - * - * @return The Stochastic Up Component of the Derivative XVA Value - */ - - public double derivativeXVAStochasticGrowthUp() - { - return _dblDerivativeXVAStochasticGrowthUp; - } - - /** - * Retrieve the Collateral Component of the Derivative XVA Value Growth - * - * @return The Collateral Component of the Derivative XVA Value Growth - */ - - public double derivativeXVACollateralGrowth() - { - return _dblDerivativeXVACollateralGrowth; - } - - /** - * Compute the Gross Theta from Asset Numeraire Down - * - * @return The Gross Theta from Asset Numeraire Down - */ - - public abstract double thetaAssetNumeraireDown(); - - /** - * Compute the Gross Theta from Asset Numeraire Base - * - * @return The Gross Theta from Asset Numeraire Base - */ - - public abstract double theta(); - - /** - * Compute the Gross Theta from Asset Numeraire Up - * - * @return The Gross Theta from Asset Numeraire Up - */ - - public abstract double thetaAssetNumeraireUp(); -} diff --git a/org/drip/xva/pde/LevelBurgardKjaerAttribution.java b/org/drip/xva/pde/LevelBurgardKjaerAttribution.java deleted file mode 100644 index e5c7dc1..0000000 --- a/org/drip/xva/pde/LevelBurgardKjaerAttribution.java +++ /dev/null @@ -1,187 +0,0 @@ - -package org.drip.xva.pde; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * LevelBurgardKjaerAttribution collects the Attribution Components of the Burgard Kjaer PDE based on the - * Risk-Neutral Ito Evolution of the Derivative, as laid out in Burgard and Kjaer (2014). 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class LevelBurgardKjaerAttribution extends org.drip.xva.pde.LevelBurgardKjaer { - private double _dblDerivativeXVAFundingGrowth = java.lang.Double.NaN; - private double _dblDerivativeXVABankDefaultGrowth = java.lang.Double.NaN; - private double _dblDerivativeXVAEarlyTerminationGrowth = java.lang.Double.NaN; - private double _dblDerivativeXVACounterPartyDefaultGrowth = java.lang.Double.NaN; - - /** - * LevelBurgardKjaerAttribution Constructor - * - * @param dblAssetNumeraireBump The Bump in the Asset Numeraire Value - * @param dblDerivativeXVAStochasticGrowthDown The Stochastic Down Component of the Derivative XVA Value - * Growth - * @param dblDerivativeXVAStochasticGrowth The Stochastic Component of the Derivative XVA Value Growth - * @param dblDerivativeXVAStochasticGrowthUp The Stochastic Up Component of the Derivative XVA Value - * Growth - * @param dblDerivativeXVACollateralGrowth The Collateral Component of the Derivative XVA Value Growth - * @param dblDerivativeXVAEarlyTerminationGrowth The Early Termination Component of the Derivative XVA - * Value Growth - * @param dblDerivativeXVAFundingGrowth The Funding Component of the Derivative XVA Value Growth - * @param dblDerivativeXVABankDefaultGrowth The Bank Default Component of the Derivative Value XVA Growth - * @param dblDerivativeXVACounterPartyDefaultGrowth The Counter Party Default Component of the Derivative - * XVA Value Growth - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public LevelBurgardKjaerAttribution ( - final double dblAssetNumeraireBump, - final double dblDerivativeXVAStochasticGrowthDown, - final double dblDerivativeXVAStochasticGrowth, - final double dblDerivativeXVAStochasticGrowthUp, - final double dblDerivativeXVACollateralGrowth, - final double dblDerivativeXVAEarlyTerminationGrowth, - final double dblDerivativeXVAFundingGrowth, - final double dblDerivativeXVABankDefaultGrowth, - final double dblDerivativeXVACounterPartyDefaultGrowth) - throws java.lang.Exception - { - super (dblAssetNumeraireBump, dblDerivativeXVAStochasticGrowthDown, dblDerivativeXVAStochasticGrowth, - dblDerivativeXVAStochasticGrowthUp, dblDerivativeXVACollateralGrowth); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblDerivativeXVAEarlyTerminationGrowth = - dblDerivativeXVAEarlyTerminationGrowth) || !org.drip.quant.common.NumberUtil.IsValid - (_dblDerivativeXVAFundingGrowth = dblDerivativeXVAFundingGrowth) || - !org.drip.quant.common.NumberUtil.IsValid (_dblDerivativeXVABankDefaultGrowth = - dblDerivativeXVABankDefaultGrowth) || !org.drip.quant.common.NumberUtil.IsValid - (_dblDerivativeXVACounterPartyDefaultGrowth = - dblDerivativeXVACounterPartyDefaultGrowth)) - throw new java.lang.Exception ("LevelBurgardKjaerAttribution Constructor => Invalod Inputs"); - } - - /** - * Retrieve the Early Termination Component of the Derivative XVA Value Growth - * - * @return The Early Termination Component of the Derivative XVA Value Growth - */ - - public double derivativeXVAEarlyTerminationGrowth() - { - return _dblDerivativeXVAEarlyTerminationGrowth; - } - - /** - * Retrieve the Funding Component of the Derivative XVA Value Growth - * - * @return The Funding Component of the Derivative XVA Value Growth - */ - - public double derivativeXVAFundingGrowth() - { - return _dblDerivativeXVAFundingGrowth; - } - - /** - * Retrieve the Bank Default Component of the Derivative XVA Value Growth - * - * @return The Bank Default Component of the Derivative XVA Value Growth - */ - - public double derivativeXVABankDefaultGrowth() - { - return _dblDerivativeXVABankDefaultGrowth; - } - - /** - * Retrieve the Counter Party Default Component of the Derivative XVA Value Growth - * - * @return The Counter Party Default Component of the Derivative XVA Value Growth - */ - - public double derivativeXVACounterPartyDefaultGrowth() - { - return _dblDerivativeXVACounterPartyDefaultGrowth; - } - - @Override public double thetaAssetNumeraireDown() - { - return super.derivativeXVAStochasticGrowthDown() + super.derivativeXVACollateralGrowth() + - _dblDerivativeXVAEarlyTerminationGrowth + _dblDerivativeXVAFundingGrowth + - _dblDerivativeXVABankDefaultGrowth + _dblDerivativeXVACounterPartyDefaultGrowth; - } - - @Override public double theta() - { - return super.derivativeXVAStochasticGrowth() + super.derivativeXVACollateralGrowth() + - _dblDerivativeXVAEarlyTerminationGrowth + _dblDerivativeXVAFundingGrowth + - _dblDerivativeXVABankDefaultGrowth + _dblDerivativeXVACounterPartyDefaultGrowth; - } - - @Override public double thetaAssetNumeraireUp() - { - return super.derivativeXVAStochasticGrowthUp() + super.derivativeXVACollateralGrowth() + - _dblDerivativeXVAEarlyTerminationGrowth + _dblDerivativeXVAFundingGrowth + - _dblDerivativeXVABankDefaultGrowth + _dblDerivativeXVACounterPartyDefaultGrowth; - } -} diff --git a/org/drip/xva/pde/LevelBurgardKjaerRun.java b/org/drip/xva/pde/LevelBurgardKjaerRun.java deleted file mode 100644 index df21645..0000000 --- a/org/drip/xva/pde/LevelBurgardKjaerRun.java +++ /dev/null @@ -1,169 +0,0 @@ - -package org.drip.xva.pde; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * LevelBurgardKjaerRun collects the Results of the Burgard Kjaer PDE based on the Risk-Neutral Ito Evolution - * of the Derivative, as laid out in Burgard and Kjaer (2014). 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class LevelBurgardKjaerRun extends org.drip.xva.pde.LevelBurgardKjaer { - private double _dblDerivativeXVAFundingGrowth = java.lang.Double.NaN; - private double _dblDerivativeXVABankDefaultGrowth = java.lang.Double.NaN; - private double _dblDerivativeXVACounterPartyDefaultGrowth = java.lang.Double.NaN; - - /** - * LevelBurgardKjaerRun Constructor - * - * @param dblAssetNumeraireBump The Bump in the Asset Numeraire Value - * @param dblDerivativeXVAStochasticGrowthDown The Stochastic Down Component of the Derivative XVA Value - * Growth - * @param dblDerivativeXVAStochasticGrowth The Stochastic Component of the Derivative XVA Value Growth - * @param dblDerivativeXVAStochasticGrowthUp The Stochastic Up Component of the Derivative XVA Value - * Growth - * @param dblDerivativeXVACollateralGrowth The Collateral Component of the Derivative XVA Value Growth - * @param dblDerivativeXVAFundingGrowth The Funding Component of the Derivative XVA Value Growth - * @param dblDerivativeXVABankDefaultGrowth The Bank Default Component of the Derivative XVA Value Growth - * @param dblDerivativeXVACounterPartyDefaultGrowth The Counter Party Default Component of the Derivative - * XVA Value Growth - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public LevelBurgardKjaerRun ( - final double dblAssetNumeraireBump, - final double dblDerivativeXVAStochasticGrowthDown, - final double dblDerivativeXVAStochasticGrowth, - final double dblDerivativeXVAStochasticGrowthUp, - final double dblDerivativeXVACollateralGrowth, - final double dblDerivativeXVAFundingGrowth, - final double dblDerivativeXVABankDefaultGrowth, - final double dblDerivativeXVACounterPartyDefaultGrowth) - throws java.lang.Exception - { - super (dblAssetNumeraireBump, dblDerivativeXVAStochasticGrowthDown, dblDerivativeXVAStochasticGrowth, - dblDerivativeXVAStochasticGrowthUp, dblDerivativeXVACollateralGrowth); - - if (!org.drip.quant.common.NumberUtil.IsValid (_dblDerivativeXVAFundingGrowth = - dblDerivativeXVAFundingGrowth) || !org.drip.quant.common.NumberUtil.IsValid - (_dblDerivativeXVABankDefaultGrowth = dblDerivativeXVABankDefaultGrowth) || - !org.drip.quant.common.NumberUtil.IsValid (_dblDerivativeXVACounterPartyDefaultGrowth = - dblDerivativeXVACounterPartyDefaultGrowth)) - throw new java.lang.Exception ("LevelBurgardKjaerRun Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Funding Component of the Derivative XVA Value Growth - * - * @return The Funding Component of the Derivative XVA Value Growth - */ - - public double derivativeXVAFundingGrowth() - { - return _dblDerivativeXVAFundingGrowth; - } - - /** - * Retrieve the Bank Default Component of the Derivative XVA Value Growth - * - * @return The Bank Default Component of the Derivative XVA Value Growth - */ - - public double derivativeXVABankDefaultGrowth() - { - return _dblDerivativeXVABankDefaultGrowth; - } - - /** - * Retrieve the Counter Party Default Component of the Derivative XVA Value Growth - * - * @return The Counter Party Default Component of the Derivative XVA Value Growth - */ - - public double derivativeXVACounterPartyDefaultGrowth() - { - return _dblDerivativeXVACounterPartyDefaultGrowth; - } - - @Override public double thetaAssetNumeraireDown() - { - return super.derivativeXVAStochasticGrowthDown() + super.derivativeXVACollateralGrowth() + - _dblDerivativeXVAFundingGrowth + _dblDerivativeXVABankDefaultGrowth + - _dblDerivativeXVACounterPartyDefaultGrowth; - } - - @Override public double theta() - { - return super.derivativeXVAStochasticGrowth() + super.derivativeXVACollateralGrowth() + - _dblDerivativeXVAFundingGrowth + _dblDerivativeXVABankDefaultGrowth + - _dblDerivativeXVACounterPartyDefaultGrowth; - } - - @Override public double thetaAssetNumeraireUp() - { - return super.derivativeXVAStochasticGrowthUp() + super.derivativeXVACollateralGrowth() + - _dblDerivativeXVAFundingGrowth + _dblDerivativeXVABankDefaultGrowth + - _dblDerivativeXVACounterPartyDefaultGrowth; - } -} diff --git a/org/drip/xva/pde/ParabolicDifferentialOperator.java b/org/drip/xva/pde/ParabolicDifferentialOperator.java deleted file mode 100644 index b45bc99..0000000 --- a/org/drip/xva/pde/ParabolicDifferentialOperator.java +++ /dev/null @@ -1,175 +0,0 @@ - -package org.drip.xva.pde; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * ParabolicDifferentialOperator sets up the Parabolic Differential Equation based on the Ito Evolution - * Differential for the Reference Underlier Asset, as laid out in Burgard and Kjaer (2014). 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class ParabolicDifferentialOperator { - private org.drip.xva.definition.Tradeable _tAsset = null; - - /** - * ParabolicDifferentialOperator Constructor - * - * @param tAsset The Trade-able Asset - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public ParabolicDifferentialOperator ( - final org.drip.xva.definition.Tradeable tAsset) - throws java.lang.Exception - { - if (null == (_tAsset = tAsset)) - throw new java.lang.Exception ("ParabolicDifferentialOperator Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Reference Trade-able Asset - * - * @return The Reference Trade-able Asset - */ - - public org.drip.xva.definition.Tradeable asset() - { - return _tAsset; - } - - /** - * Compute the Theta for the Derivative from the Asset Edge Value - * - * @param eet The Derivative's EdgeEvolutionTrajectory Instance - * @param dblAsset The Asset Edge Value - * - * @return The Theta - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double theta ( - final org.drip.xva.derivative.EdgeEvolutionTrajectory eet, - final double dblAsset) - throws java.lang.Exception - { - if (null == eet || !org.drip.quant.common.NumberUtil.IsValid (dblAsset)) - throw new java.lang.Exception ("ParabolicDifferentialOperator::theta => Invalid Inputs"); - - org.drip.xva.derivative.EdgeAssetGreek eagDerivative = eet.edgeAssetGreek(); - - double dblVolatility = _tAsset.priceNumeraire().evaluator().volatility().value (new - org.drip.measure.realization.JumpDiffusionVertex (eet.time(), dblAsset, 0., false)); - - return 0.5 * dblVolatility * dblVolatility * dblAsset * dblAsset * - eagDerivative.derivativeXVAValueGamma() - _tAsset.cashAccumulationRate() * dblAsset * - eagDerivative.derivativeXVAValueDelta(); - } - - /** - * Compute the Up/Down Thetas - * - * @param eet The Derivative's EdgeEvolutionTrajectory Instance - * @param dblAsset The Asset Edge Value - * @param dblShift The Amount to Shift the Reference Underlier Numeraire By - * - * @return The Array of the Up/Down Thetas - */ - - public double[] thetaUpDown ( - final org.drip.xva.derivative.EdgeEvolutionTrajectory eet, - final double dblAsset, - final double dblShift) - { - if (null == eet || !org.drip.quant.common.NumberUtil.IsValid (dblAsset) || - !org.drip.quant.common.NumberUtil.IsValid (dblShift)) - return null; - - org.drip.xva.derivative.EdgeAssetGreek eagDerivative = eet.edgeAssetGreek(); - - double dblAssetUp = dblAsset + dblShift; - double dblAssetDown = dblAsset - dblShift; - double dblVolatility = java.lang.Double.NaN; - - try { - dblVolatility = _tAsset.priceNumeraire().evaluator().volatility().value (new - org.drip.measure.realization.JumpDiffusionVertex (eet.time(), dblAsset, 0., false)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - double dblGammaCoefficient = 0.5 * dblVolatility * dblVolatility * - eagDerivative.derivativeXVAValueGamma(); - - double dblDeltaCoefficient = -1. * _tAsset.cashAccumulationRate() * - eagDerivative.derivativeXVAValueDelta(); - - return new double[] {dblGammaCoefficient * dblAssetDown * dblAssetDown + dblDeltaCoefficient * - dblAssetDown, dblGammaCoefficient * dblAsset * dblAsset + dblDeltaCoefficient * dblAsset, - dblGammaCoefficient * dblAssetUp * dblAssetUp + dblDeltaCoefficient * dblAssetUp}; - } -} diff --git a/org/drip/xva/pde/TrajectoryEvolutionScheme.java b/org/drip/xva/pde/TrajectoryEvolutionScheme.java deleted file mode 100644 index e827e90..0000000 --- a/org/drip/xva/pde/TrajectoryEvolutionScheme.java +++ /dev/null @@ -1,389 +0,0 @@ - -package org.drip.xva.pde; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * TrajectoryEvolutionScheme holds the Evolution Edges of a Trajectory evolved in a Dynamically Adaptive - * Manner, as laid out in Burgard and Kjaer (2014). 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class TrajectoryEvolutionScheme { - private org.drip.xva.settings.PDEEvolutionControl _settings = null; - private double _dblTimeIncrement = java.lang.Double.NaN; - private org.drip.xva.definition.TwoWayRiskyUniverse _twru = null; - private org.drip.xva.definition.MasterAgreementCloseOut _maco = null; - - /** - * TrajectoryEvolutionScheme Constructor - * - * @param twru The Universe of Trade-able Assets - * @param maco The Master Agreement Close Out Boundary Conditions - * @param settings The XVA Control Settings - * @param dblTimeIncrement The Time Increment - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public TrajectoryEvolutionScheme ( - final org.drip.xva.definition.TwoWayRiskyUniverse twru, - final org.drip.xva.definition.MasterAgreementCloseOut maco, - final org.drip.xva.settings.PDEEvolutionControl settings, - final double dblTimeIncrement) - throws java.lang.Exception - { - if (null == (_twru = twru) || null == (_maco = maco) || null == (_settings = settings) || - !org.drip.quant.common.NumberUtil.IsValid (_dblTimeIncrement = dblTimeIncrement)) - throw new java.lang.Exception ("TrajectoryEvolutionScheme Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Universe of Trade-able Assets - * - * @return The Universe of Trade-able Assets - */ - - public org.drip.xva.definition.TwoWayRiskyUniverse universe() - { - return _twru; - } - - /** - * Retrieve the Close Out Boundary Condition - * - * @return The Close Out Boundary Condition - */ - - public org.drip.xva.definition.MasterAgreementCloseOut boundaryCondition() - { - return _maco; - } - - /** - * Retrieve the XVA Control Settings - * - * @return The XVA Control Settings - */ - - public org.drip.xva.settings.PDEEvolutionControl settings() - { - return _settings; - } - - /** - * Retrieve the Evolution Time Increment - * - * @return The Evolution Time Increment - */ - - public double timeIncrement() - { - return _dblTimeIncrement; - } - - /** - * Re-balance the Cash Account and generate the Derivative Value Update - * - * @param eetStart The Starting Evolution Trajectory Edge - * @param us The Universe Snap-shot - * - * @return The LevelEvolutionTrajectoryRebalanced Instance - */ - - public org.drip.xva.derivative.CashAccountRebalancer rebalanceCash ( - final org.drip.xva.derivative.EdgeEvolutionTrajectory eetStart, - final org.drip.xva.definition.UniverseSnapshot us) - { - if (null == eetStart || null == us) return null; - - org.drip.xva.derivative.EdgeReplicationPortfolio erpStart = eetStart.replicationPortfolio(); - - double dblAssetUnitsStart = erpStart.assetUnits(); - - double dblBankBondUnitsStart = erpStart.bankBondUnits(); - - double dblCounterPartyBondUnitsStart = erpStart.counterPartyBondUnits(); - - org.drip.measure.realization.JumpDiffusionEdge jdeAsset = us.assetNumeraire(); - - org.drip.measure.realization.JumpDiffusionEdge jdeBankBond = us.zeroCouponBankBondNumeraire(); - - org.drip.measure.realization.JumpDiffusionEdge jdeCounterPartyBond = - us.zeroCouponCounterPartyBondNumeraire(); - - double dblLevelAssetCash = dblAssetUnitsStart * _twru.asset().cashAccumulationRate() * - jdeAsset.finish() * _dblTimeIncrement; - - double dblLevelCounterPartyCash = dblCounterPartyBondUnitsStart * - _twru.zeroCouponCounterPartyBond().cashAccumulationRate() * jdeCounterPartyBond.finish() * - _dblTimeIncrement; - - double dblCashAccountBalance = -1. * eetStart.edgeAssetGreek().derivativeXVAValue() - - dblBankBondUnitsStart * jdeBankBond.finish(); - - double dblLevelBankCash = dblCashAccountBalance * (dblCashAccountBalance > 0. ? - _twru.zeroCouponCollateralBond().cashAccumulationRate() : - _twru.zeroCouponBankBond().cashAccumulationRate()) * _dblTimeIncrement; - - double dblLevelCashAccount = (dblLevelAssetCash + dblLevelCounterPartyCash + dblLevelBankCash) * - _dblTimeIncrement; - - double dblLevelDerivativeXVAValue = -1. * (dblAssetUnitsStart * jdeAsset.grossChange() + - dblBankBondUnitsStart * jdeBankBond.grossChange() + dblCounterPartyBondUnitsStart * - jdeCounterPartyBond.grossChange() + dblLevelCashAccount); - - try { - return new org.drip.xva.derivative.CashAccountRebalancer (new - org.drip.xva.derivative.LevelCashAccount (dblLevelAssetCash, dblLevelBankCash * - _dblTimeIncrement, dblLevelCounterPartyCash * _dblTimeIncrement), - dblLevelDerivativeXVAValue); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Re-balance AND move the Cash Account and generate the Updated Derivative Value/Replication Portfolio - * - * @param eetStart The Starting Evolution Trajectory Edge - * @param us The Universe Snap-shot - * @param eagFinish The Period End EdgeAssetGreek Instance - * - * @return The LevelEvolutionTrajectory Instance - */ - - public org.drip.xva.derivative.LevelEvolutionTrajectory move ( - final org.drip.xva.derivative.EdgeEvolutionTrajectory eetStart, - final org.drip.xva.definition.UniverseSnapshot us, - final org.drip.xva.derivative.EdgeAssetGreek eagFinish) - { - if (null == eagFinish) return null; - - org.drip.xva.derivative.CashAccountRebalancer car = rebalanceCash (eetStart, us); - - if (null == car) return null; - - org.drip.xva.derivative.LevelCashAccount lca = car.cashAccount(); - - double dblDerivativeXVAValue = eagFinish.derivativeXVAValue(); - - double dblCloseOutMTM = org.drip.xva.settings.PDEEvolutionControl.CLOSEOUT_GREGORY_LI_TANG == - _settings.closeOutScheme() ? eagFinish.derivativeValue() : dblDerivativeXVAValue; - - try { - double dblGainOnBankDefault = -1. * (dblDerivativeXVAValue - _maco.bankDefault (dblCloseOutMTM)); - - double dblBankBondUnits = dblGainOnBankDefault / us.zeroCouponBankBondNumeraire().finish(); - - double dblGainOnCounterPartyDefault = -1. * (dblDerivativeXVAValue - _maco.counterPartyDefault - (dblCloseOutMTM)); - - double dblCounterPartyBondUnits = dblGainOnCounterPartyDefault / - us.zeroCouponCounterPartyBondNumeraire().finish(); - - org.drip.xva.derivative.EdgeReplicationPortfolio erp = new - org.drip.xva.derivative.EdgeReplicationPortfolio (-1. * eagFinish.derivativeXVAValueDelta(), - dblBankBondUnits, dblCounterPartyBondUnits, eetStart.replicationPortfolio().cashAccount() - + lca.accumulation()); - - return new org.drip.xva.derivative.LevelEvolutionTrajectory (eetStart, new - org.drip.xva.derivative.EdgeEvolutionTrajectory (eetStart.time() + _dblTimeIncrement, us, - erp, eagFinish, dblGainOnBankDefault, dblGainOnCounterPartyDefault), lca); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Execute a Single Euler Time Step Walk - * - * @param si The Spread Intensity Instance - * @param us The Universe Snapshot - * @param bko The Burgard Kjaer Operator Instance - * @param eetStart The Starting EET Instance - * - * @return The LevelEvolutionTrajectory Instance - */ - - public org.drip.xva.derivative.LevelEvolutionTrajectory eulerWalk ( - final org.drip.xva.definition.SpreadIntensity si, - final org.drip.xva.definition.UniverseSnapshot us, - final org.drip.xva.pde.BurgardKjaerOperator bko, - final org.drip.xva.derivative.EdgeEvolutionTrajectory eetStart) - { - if (null == si || null == us || null == bko || null == eetStart) return null; - - org.drip.xva.derivative.EdgeAssetGreek eagStart = eetStart.edgeAssetGreek(); - - org.drip.xva.pde.LevelBurgardKjaerRun lbkr = bko.timeIncrementRun (si, eetStart); - - double dblTimeStart = eetStart.time(); - - double dblTimeWidth = timeIncrement(); - - if (null == lbkr) return null; - - double dblTheta = lbkr.theta(); - - double dblAssetNumeraireBump = lbkr.assetNumeraireBump(); - - double dblThetaAssetNumeraireUp = lbkr.thetaAssetNumeraireUp(); - - double dblThetaAssetNumeraireDown = lbkr.thetaAssetNumeraireDown(); - - double dblDerivativeXVAValueDeltaFinish = eagStart.derivativeXVAValueDelta() + 0.5 * - (dblThetaAssetNumeraireUp - dblThetaAssetNumeraireDown) * dblTimeWidth / dblAssetNumeraireBump; - - double dblGainOnBankDefaultFinish = java.lang.Double.NaN; - double dblGainOnCounterPartyDefaultFinish = java.lang.Double.NaN; - double dblDerivativeXVAValueFinish = eagStart.derivativeXVAValue() - dblTheta * dblTimeWidth; - - try { - dblGainOnBankDefaultFinish = -1. * (dblDerivativeXVAValueFinish - _maco.bankDefault - (dblDerivativeXVAValueFinish)); - - dblGainOnCounterPartyDefaultFinish = -1. * (dblDerivativeXVAValueFinish - - _maco.counterPartyDefault (dblDerivativeXVAValueFinish)); - } catch (java.lang.Exception e) { - e.printStackTrace(); - - return null; - } - - org.drip.xva.derivative.CashAccountRebalancer car = rebalanceCash (eetStart, us); - - if (null == car) return null; - - org.drip.xva.derivative.LevelCashAccount lca = car.cashAccount(); - - try { - org.drip.xva.derivative.EdgeEvolutionTrajectory eetFinish = new - org.drip.xva.derivative.EdgeEvolutionTrajectory (dblTimeStart - dblTimeWidth, us, new - org.drip.xva.derivative.EdgeReplicationPortfolio (-1. * dblDerivativeXVAValueDeltaFinish, - dblGainOnBankDefaultFinish / us.zeroCouponBankBondNumeraire().finish(), - dblGainOnCounterPartyDefaultFinish / - us.zeroCouponCounterPartyBondNumeraire().finish(), - eetStart.replicationPortfolio().cashAccount() + lca.accumulation()), new - org.drip.xva.derivative.EdgeAssetGreek (dblDerivativeXVAValueFinish, - dblDerivativeXVAValueDeltaFinish, - eagStart.derivativeXVAValueGamma() + - (dblThetaAssetNumeraireUp + dblThetaAssetNumeraireDown - - 2. * dblTheta) * dblTimeWidth / - (dblAssetNumeraireBump * dblAssetNumeraireBump), - eagStart.derivativeValue() * Math.exp (-1. * - dblTimeWidth * - _twru.zeroCouponCollateralBond().priceNumeraire().evaluator().drift().value - (new - org.drip.measure.realization.JumpDiffusionVertex - (dblTimeStart - 0.5 * dblTimeWidth, - eetStart.tradeableAssetSnapshot().zeroCouponCollateralBondNumeraire().finish(), 0., - false)))), dblGainOnBankDefaultFinish, dblGainOnCounterPartyDefaultFinish); - - return new org.drip.xva.derivative.LevelEvolutionTrajectory (eetStart, eetFinish, lca); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - - /** - * Execute a Sequential Array of Euler Time Step Walks - * - * @param si The Spread Intensity Instance - * @param aUS Array of Universe Snapshot - * @param bko The Burgard Kjaer Operator Instance - * @param eetStart The Starting EET Instance - * - * @return Array of LevelEvolutionTrajectory Instances - */ - - public org.drip.xva.derivative.LevelEvolutionTrajectory[] eulerWalk ( - final org.drip.xva.definition.SpreadIntensity si, - final org.drip.xva.definition.UniverseSnapshot[] aUS, - final org.drip.xva.pde.BurgardKjaerOperator bko, - final org.drip.xva.derivative.EdgeEvolutionTrajectory eetStart) - { - if (null == aUS) return null; - - int iNumTimeStep = aUS.length; - org.drip.xva.derivative.EdgeEvolutionTrajectory eet = eetStart; - org.drip.xva.derivative.LevelEvolutionTrajectory[] aLET = 1 >= iNumTimeStep ? null : new - org.drip.xva.derivative.LevelEvolutionTrajectory[iNumTimeStep - 1]; - - if (0 == iNumTimeStep) return null; - - for (int i = iNumTimeStep - 2; i >= 0; --i) { - if (null == (aLET[i] = eulerWalk (si, aUS[i], bko, eet))) return null; - - eet = aLET[i].edgeFinish(); - } - - return aLET; - } -} diff --git a/org/drip/xva/settings/CollateralAmountEstimator.java b/org/drip/xva/settings/CollateralAmountEstimator.java deleted file mode 100644 index 23a6755..0000000 --- a/org/drip/xva/settings/CollateralAmountEstimator.java +++ /dev/null @@ -1,356 +0,0 @@ - -package org.drip.xva.settings; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CollateralAmountEstimator estimates the Amount of Collateral that is to be Posted during a Single Run of a - * Collateral Group Valuation. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CollateralAmountEstimator { - private double _dblCurrentBalance = java.lang.Double.NaN; - private org.drip.xva.settings.CollateralGroupSpecification _cgs = null; - private org.drip.measure.continuousmarginal.BrokenDateBridge _bdb = null; - private org.drip.xva.settings.CounterPartyGroupSpecification _cpgs = null; - - /** - * CollateralAmountEstimator Constructor - * - * @param cgs The Collateral Group Specification - * @param cpgs The Counter Party Group Specification - * @param bdb The Stochastic Value Broken Date Bridge Estimator - * @param dblCurrentBalance The Current Collateral Balance - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CollateralAmountEstimator ( - final org.drip.xva.settings.CollateralGroupSpecification cgs, - final org.drip.xva.settings.CounterPartyGroupSpecification cpgs, - final org.drip.measure.continuousmarginal.BrokenDateBridge bdb, - final double dblCurrentBalance) - throws java.lang.Exception - { - if (null == (_cgs = cgs) || null == (_cpgs = cpgs) || null == (_bdb = bdb)) - throw new java.lang.Exception ("CollateralAmountEstimator Constructor => Invalid Inputs"); - - _dblCurrentBalance = dblCurrentBalance; - } - - /** - * Retrieve the Collateral Group Specification - * - * @return The Collateral Group Specification - */ - - public org.drip.xva.settings.CollateralGroupSpecification collateralGroupSpecification() - { - return _cgs; - } - - /** - * Retrieve the Counter Party Group Specification - * - * @return The Counter Party Group Specification - */ - - public org.drip.xva.settings.CounterPartyGroupSpecification counterPartyGroupSpecification() - { - return _cpgs; - } - - /** - * Retrieve the Stochastic Value Broken Date Bridge Estimator - * - * @return The Stochastic Value Broken Date Bridge Estimator - */ - - public org.drip.measure.continuousmarginal.BrokenDateBridge brokenDateBridge() - { - return _bdb; - } - - /** - * Retrieve the Current Collateral Balance - * - * @return The Current Collateral Balance - */ - - public double currentCollateralBalance() - { - return _dblCurrentBalance; - } - - /** - * Calculate the Margin Value at the Bank Default Window - * - * @param dtValue The Valuation Date - * - * @return The Margin Value at the Bank Default Window - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double bankWindowMarginValue ( - final org.drip.analytics.date.JulianDate dtValue) - throws java.lang.Exception - { - if (null == dtValue) - throw new java.lang.Exception - ("CollateralAmountEstimator::bankWindowMarginValue => Invalid Inputs"); - - org.drip.analytics.date.JulianDate dtMargin = dtValue.subtractDays (_cpgs.bankDefaultWindow()); - - if (null == dtMargin) - throw new java.lang.Exception - ("CollateralAmountEstimator::bankWindowMarginValue => Invalid Inputs"); - - return _bdb.interpolate (dtMargin.julian()); - } - - /** - * Calculate the Bank Collateral Threshold - * - * @param dtValue The Valuation Date - * - * @return The Bank Collateral Threshold - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double bankThreshold ( - final org.drip.analytics.date.JulianDate dtValue) - throws java.lang.Exception - { - org.drip.function.definition.R1ToR1 r1ToR1BankThreshold = _cgs.bankThreshold(); - - return null == r1ToR1BankThreshold ? 0. : r1ToR1BankThreshold.evaluate (dtValue.julian()); - } - - /** - * Calculate the Collateral Amount Required to be Posted by the Bank - * - * @param dtValue The Valuation Date - * - * @return The Collateral Amount Required to be Posted by the Bank - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double bankPostingRequirement ( - final org.drip.analytics.date.JulianDate dtValue) - throws java.lang.Exception - { - double dblBankPostingRequirement = bankWindowMarginValue (dtValue) - bankThreshold (dtValue); - - return 0. < dblBankPostingRequirement ? 0. : dblBankPostingRequirement; - } - - /** - * Calculate the Margin Value at the Counter Party Default Window - * - * @param dtValue The Valuation Date - * - * @return The Margin Value at the Counter Party Default Window - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double counterPartyWindowMarginValue ( - final org.drip.analytics.date.JulianDate dtValue) - throws java.lang.Exception - { - if (null == dtValue) - throw new java.lang.Exception - ("CollateralAmountEstimator::counterPartyWindowMarginValue => Invalid Inputs"); - - org.drip.analytics.date.JulianDate dtMargin = dtValue.subtractDays - (_cpgs.counterPartyDefaultWindow()); - - if (null == dtMargin) - throw new java.lang.Exception - ("CollateralAmountEstimator::counterPartyWindowMarginValue => Invalid Inputs"); - - return _bdb.interpolate (dtMargin.julian()); - } - - /** - * Calculate the Counter Party Collateral Threshold - * - * @param dtValue The Valuation Date - * - * @return The Counter Party Collateral Threshold - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double counterPartyThreshold ( - final org.drip.analytics.date.JulianDate dtValue) - throws java.lang.Exception - { - org.drip.function.definition.R1ToR1 r1ToR1CounterPartyThreshold = _cgs.counterPartyThreshold(); - - return null == r1ToR1CounterPartyThreshold ? 0. : r1ToR1CounterPartyThreshold.evaluate - (dtValue.julian()); - } - - /** - * Calculate the Collateral Amount Required to be Posted by the Counter Party - * - * @param dtValue The Valuation Date - * - * @return The Collateral Amount Required to be Posted by the Counter Party - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double counterPartyPostingRequirement ( - final org.drip.analytics.date.JulianDate dtValue) - throws java.lang.Exception - { - double dblCounterPartyPostingRequirement = counterPartyWindowMarginValue (dtValue) - - counterPartyThreshold (dtValue); - - return 0. > dblCounterPartyPostingRequirement ? 0. : dblCounterPartyPostingRequirement; - } - - /** - * Calculate the Gross Collateral Amount Required to be Posted - * - * @param dtValue The Valuation Date - * - * @return The Gross Collateral Amount Required to be Posted - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public double postingRequirement ( - final org.drip.analytics.date.JulianDate dtValue) - throws java.lang.Exception - { - return org.drip.quant.common.NumberUtil.IsValid (_dblCurrentBalance) ? _dblCurrentBalance : - bankPostingRequirement (dtValue) + counterPartyPostingRequirement (dtValue); - } - - /** - * Generate the CollateralAmountEstimatorOutput Instance - * - * @param dtValue The Valuation Date - * - * @return The CollateralAmountEstimatorOutput Instance - */ - - public org.drip.xva.settings.CollateralAmountEstimatorOutput output ( - final org.drip.analytics.date.JulianDate dtValue) - { - if (null == dtValue) return null; - - org.drip.analytics.date.JulianDate dtBankMargin = dtValue.subtractDays (_cpgs.bankDefaultWindow()); - - org.drip.analytics.date.JulianDate dtCounterPartyMargin = dtValue.subtractDays - (_cpgs.counterPartyDefaultWindow()); - - if (null == dtBankMargin || null == dtCounterPartyMargin) return null; - - org.drip.function.definition.R1ToR1 r1ToR1CounterPartyThreshold = _cgs.counterPartyThreshold(); - - org.drip.function.definition.R1ToR1 r1ToR1BankThreshold = _cgs.bankThreshold(); - - double dblValueDate = dtValue.julian(); - - try { - double dblBankWindowMarginValue = _bdb.interpolate (dtBankMargin.julian()); - - double dblCounterPartyWindowMarginValue = _bdb.interpolate (dtCounterPartyMargin.julian()); - - double dblBankThresholdValue = null == r1ToR1BankThreshold ? 0. : r1ToR1BankThreshold.evaluate - (dblValueDate); - - double dblCounterPartyThresholdValue = null == r1ToR1CounterPartyThreshold ? 0. : - r1ToR1CounterPartyThreshold.evaluate (dblValueDate); - - double dblBankPostingRequirement = dblBankWindowMarginValue - dblBankThresholdValue; - dblBankPostingRequirement = 0. < dblBankPostingRequirement ? 0. : dblBankPostingRequirement; - double dblCounterPartyPostingRequirement = dblCounterPartyWindowMarginValue - - dblCounterPartyThresholdValue; - dblCounterPartyPostingRequirement = 0. > dblCounterPartyPostingRequirement ? 0. : - dblCounterPartyPostingRequirement; - - return new org.drip.xva.settings.CollateralAmountEstimatorOutput ( - dtBankMargin, - dtCounterPartyMargin, - dblBankWindowMarginValue, - dblBankThresholdValue, - dblBankPostingRequirement, - dblCounterPartyWindowMarginValue, - dblCounterPartyThresholdValue, - dblCounterPartyPostingRequirement, - org.drip.quant.common.NumberUtil.IsValid (_dblCurrentBalance) ? _dblCurrentBalance : - dblBankPostingRequirement + dblCounterPartyPostingRequirement); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/xva/settings/CollateralAmountEstimatorOutput.java b/org/drip/xva/settings/CollateralAmountEstimatorOutput.java deleted file mode 100644 index c01e01d..0000000 --- a/org/drip/xva/settings/CollateralAmountEstimatorOutput.java +++ /dev/null @@ -1,224 +0,0 @@ - -package org.drip.xva.settings; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CollateralAmountEstimatorOutput contains the Estimation Output of the Collateral that is to be Posted - * during a Single Run of a Collateral Group Valuation. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CollateralAmountEstimatorOutput { - private double _dblPostingRequirement = java.lang.Double.NaN; - private org.drip.analytics.date.JulianDate _dtBankMargin = null; - private double _dblBankWindowMarginValue = java.lang.Double.NaN; - private double _dblBankPostingRequirement = java.lang.Double.NaN; - private double _dblBankCollateralThreshold = java.lang.Double.NaN; - private org.drip.analytics.date.JulianDate _dtCounterPartyMargin = null; - private double _dblCounterPartyWindowMarginValue = java.lang.Double.NaN; - private double _dblCounterPartyPostingRequirement = java.lang.Double.NaN; - private double _dblCounterPartyCollateralThreshold = java.lang.Double.NaN; - - /** - * CollateralAmountEstimatorOutput Constructor - * - * @param dblBankWindowMarginValue The Margin Value at the Bank Default Window - * @param dblBankCollateralThreshold The Bank Collateral Threshold - * @param dblBankPostingRequirement The Bank Collateral Posting Requirement - * @param dblCounterPartyWindowMarginValue The Margin Value at the Counter Party Default Window - * @param dblCounterPartyCollateralThreshold The Counter Party Collateral Threshold - * @param dblCounterPartyPostingRequirement The Counter Party Collateral Posting Requirement - * @param dblPostingRequirement The Total Collateral Posting Requirement - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CollateralAmountEstimatorOutput ( - final org.drip.analytics.date.JulianDate dtBankMargin, - final org.drip.analytics.date.JulianDate dtCounterPartyMargin, - final double dblBankWindowMarginValue, - final double dblBankCollateralThreshold, - final double dblBankPostingRequirement, - final double dblCounterPartyWindowMarginValue, - final double dblCounterPartyCollateralThreshold, - final double dblCounterPartyPostingRequirement, - final double dblPostingRequirement) - throws java.lang.Exception - { - if (null == (_dtBankMargin = dtBankMargin) || null == (_dtCounterPartyMargin = dtCounterPartyMargin) - || !org.drip.quant.common.NumberUtil.IsValid (_dblBankWindowMarginValue = - dblBankWindowMarginValue) || !org.drip.quant.common.NumberUtil.IsValid - (_dblBankCollateralThreshold = dblBankCollateralThreshold) || - !org.drip.quant.common.NumberUtil.IsValid (_dblBankPostingRequirement = - dblBankPostingRequirement) || !org.drip.quant.common.NumberUtil.IsValid - (_dblCounterPartyWindowMarginValue = dblCounterPartyWindowMarginValue) || - !org.drip.quant.common.NumberUtil.IsValid - (_dblCounterPartyCollateralThreshold = - dblCounterPartyCollateralThreshold) || - !org.drip.quant.common.NumberUtil.IsValid - (_dblCounterPartyPostingRequirement = - dblCounterPartyPostingRequirement) || - !org.drip.quant.common.NumberUtil.IsValid - (_dblPostingRequirement = - dblPostingRequirement)) - throw new java.lang.Exception ("CollateralAmountEstimatorOutput Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Bank Margin Date - * - * @return The Bank Margin Date - */ - - public org.drip.analytics.date.JulianDate bankMarginDate() - { - return _dtBankMargin; - } - - /** - * Retrieve the Counter Party Margin Date - * - * @return The Counter Party Margin Date - */ - - public org.drip.analytics.date.JulianDate counterPartyMarginDate() - { - return _dtCounterPartyMargin; - } - - /** - * Retrieve the Margin Value at the Bank Default Window - * - * @return The Margin Value at the Bank Default Window - */ - - public double bankWindowMarginValue() - { - return _dblBankWindowMarginValue; - } - - /** - * Retrieve the Bank Collateral Threshold - * - * @return The Bank Collateral Threshold - */ - - public double bankCollateralThreshold() - { - return _dblBankCollateralThreshold; - } - - /** - * Retrieve the Bank Posting Requirement - * - * @return The Bank Posting Requirement - */ - - public double bankPostingRequirement() - { - return _dblBankPostingRequirement; - } - - /** - * Retrieve the Margin Value at the Counter Party Default Window - * - * @return The Margin Value at the Counter Party Default Window - */ - - public double counterPartyWindowMarginValue() - { - return _dblCounterPartyWindowMarginValue; - } - - /** - * Retrieve the Counter Party Collateral Threshold - * - * @return The Counter Party Collateral Threshold - */ - - public double counterPartyCollateralThreshold() - { - return _dblCounterPartyCollateralThreshold; - } - - /** - * Retrieve the Counter Party Posting Requirement - * - * @return The Counter Party Posting Requirement - */ - - public double counterPartyPostingRequirement() - { - return _dblCounterPartyPostingRequirement; - } - - /** - * Retrieve the Total Collateral Posting Requirement - * - * @return The Total Collateral Posting Requirement - */ - - public double postingRequirement() - { - return _dblPostingRequirement; - } -} diff --git a/org/drip/xva/settings/CollateralGroupSpecification.java b/org/drip/xva/settings/CollateralGroupSpecification.java deleted file mode 100644 index b52d83e..0000000 --- a/org/drip/xva/settings/CollateralGroupSpecification.java +++ /dev/null @@ -1,237 +0,0 @@ - -package org.drip.xva.settings; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CollateralGroupSpecification contains the Specifications of a Collateral Group. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CollateralGroupSpecification { - private java.lang.String _strID = ""; - private java.lang.String _strName = ""; - private double _dblIndependentAmount = java.lang.Double.NaN; - private double _dblMinimumTransferAmount = java.lang.Double.NaN; - private org.drip.function.definition.R1ToR1 _r1ToR1BankThreshold = null; - private org.drip.function.definition.R1ToR1 _r1ToR1CounterPartyThreshold = null; - - /** - * Generate a Zero-Threshold Instance of the Named Collateral Group - * - * @param strName The Collateral Group Name - * - * @return The Zero-Threshold Instance of the Named Collateral Group - */ - - public static final CollateralGroupSpecification ZeroThreshold ( - final java.lang.String strName) - { - try { - return new CollateralGroupSpecification (org.drip.quant.common.StringUtil.GUID(), strName, null, - null, 0., 0.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Generate a Fixed-Threshold Instance of the Named Collateral Group - * - * @param strName The Collateral Group Name - * @param dblCounterPartyThreshold The Fixed Counter Party Threshold - * @param dblBankThreshold The Fixed Bank Threshold - * - * @return The Fixed-Threshold Instance of the Named Collateral Group - */ - - public static final CollateralGroupSpecification FixedThreshold ( - final java.lang.String strName, - final double dblCounterPartyThreshold, - final double dblBankThreshold) - { - if (!org.drip.quant.common.NumberUtil.IsValid (dblCounterPartyThreshold) || 0. > - dblCounterPartyThreshold || !org.drip.quant.common.NumberUtil.IsValid (dblBankThreshold) || 0. < - dblBankThreshold) - return null; - - try { - return new CollateralGroupSpecification (org.drip.quant.common.StringUtil.GUID(), strName, new - org.drip.function.r1tor1.FlatUnivariate (dblCounterPartyThreshold), new - org.drip.function.r1tor1.FlatUnivariate (dblBankThreshold), 0., 0.); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * CollateralGroupSpecification Constructor - * - * @param strID The Collateral Group ID - * @param strName The Collateral Group Name - * @param r1ToR1CounterPartyThreshold The Collateral Group Counter Party Threshold R^1 -> R^1 Function - * @param r1ToR1BankThreshold The Collateral Group Bank Threshold R^1 -> R^1 Function - * @param dblMinimumTransferAmount The Collateral Group Minimum Transfer Amount - * @param dblIndependentAmount The Collateral Group Independent Amount - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CollateralGroupSpecification ( - final java.lang.String strID, - final java.lang.String strName, - final org.drip.function.definition.R1ToR1 r1ToR1CounterPartyThreshold, - final org.drip.function.definition.R1ToR1 r1ToR1BankThreshold, - final double dblMinimumTransferAmount, - final double dblIndependentAmount) - throws java.lang.Exception - { - if (null == (_strID = strID) || _strID.isEmpty() || null == (_strName = strName) || - _strName.isEmpty() || !org.drip.quant.common.NumberUtil.IsValid (_dblMinimumTransferAmount = - dblMinimumTransferAmount) || !org.drip.quant.common.NumberUtil.IsValid (_dblIndependentAmount - = dblIndependentAmount)) - throw new java.lang.Exception ("CollateralGroupSpecification Constructor => Invalid Inputs"); - - _r1ToR1BankThreshold = r1ToR1BankThreshold; - _r1ToR1CounterPartyThreshold = r1ToR1CounterPartyThreshold; - } - - /** - * Retrieve the Collateral Group ID - * - * @return The Collateral Group ID - */ - - public java.lang.String id() - { - return _strID; - } - - /** - * Retrieve the Collateral Group Name - * - * @return The Collateral Group Name - */ - - public java.lang.String name() - { - return _strName; - } - - /** - * Retrieve the Collateral Group Counter Party Threshold R^1 -> R^1 Function - * - * @return The Collateral Group Counter Party Threshold R^1 -> R^1 Function - */ - - public org.drip.function.definition.R1ToR1 counterPartyThreshold() - { - return _r1ToR1CounterPartyThreshold; - } - - /** - * Retrieve the Collateral Group Bank Threshold R^1 -> R^1 Function - * - * @return The Collateral Group Bank Threshold R^1 -> R^1 Function - */ - - public org.drip.function.definition.R1ToR1 bankThreshold() - { - return _r1ToR1BankThreshold; - } - - /** - * Retrieve the Collateral Group Minimum Transfer Amount - * - * @return The Collateral Group Minimum Transfer Amount - */ - - public double minimumTransferAmount() - { - return _dblMinimumTransferAmount; - } - - /** - * Retrieve the Collateral Group Independent Amount - * - * @return The Collateral Group Independent Amount - */ - - public double independentAmount() - { - return _dblIndependentAmount; - } - - /** - * Retrieve the Flag specifying whether the Collateral Group is Uncollateralized - * - * @return TRUE - The Collateral Group is Uncollateralized - */ - - public boolean isUncollateralized() - { - return null == _r1ToR1CounterPartyThreshold && null == _r1ToR1BankThreshold; - } -} diff --git a/org/drip/xva/settings/CounterPartyGroupSpecification.java b/org/drip/xva/settings/CounterPartyGroupSpecification.java deleted file mode 100644 index 197ddd8..0000000 --- a/org/drip/xva/settings/CounterPartyGroupSpecification.java +++ /dev/null @@ -1,177 +0,0 @@ - -package org.drip.xva.settings; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CounterPartyGroupSpecification contains the Specifications of a Counter Party Group. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CounterPartyGroupSpecification { - private int _iBankDefaultWindow = -1; - private java.lang.String _strID = ""; - private java.lang.String _strName = ""; - private int _iCounterPartyDefaultWindow = -1; - private org.drip.xva.settings.MarginPeriodOfRisk _mpor = null; - - /** - * Construct a Standard Instance of CounterPartyGroupSpecification - * - * @param strName The Collateral Group Name - * - * @return The Standard Instance of CounterPartyGroupSpecification - */ - - public static final CounterPartyGroupSpecification Standard ( - final java.lang.String strName) - { - try { - return new CounterPartyGroupSpecification (org.drip.quant.common.StringUtil.GUID(), strName, - org.drip.xva.settings.MarginPeriodOfRisk.Standard(), 14, 14); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * CounterPartyGroup Constructor - * - * @param strID The Collateral Group ID - * @param strName The Collateral Group Name - * @param mpor The Margin Period Of Risk - * @param iCounterPartyDefaultWindow The Counter Party Default Window - * @param iBankDefaultWindow The Bank Default Window - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CounterPartyGroupSpecification ( - final java.lang.String strID, - final java.lang.String strName, - final org.drip.xva.settings.MarginPeriodOfRisk mpor, - final int iCounterPartyDefaultWindow, - final int iBankDefaultWindow) - throws java.lang.Exception - { - if (null == (_strID = strID) || _strID.isEmpty() || null == (_strName = strName) || - _strName.isEmpty() || null == (_mpor = mpor) || -1 >= (_iCounterPartyDefaultWindow = - iCounterPartyDefaultWindow) || -1 >= (_iBankDefaultWindow = iBankDefaultWindow)) - throw new java.lang.Exception ("CounterPartyGroupSpecification Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Collateral Group ID - * - * @return The Collateral Group ID - */ - - public java.lang.String id() - { - return _strID; - } - - /** - * Retrieve the Collateral Group Name - * - * @return The Collateral Group Name - */ - - public java.lang.String name() - { - return _strName; - } - - /** - * Retrieve the Margin Period Of Risk - * - * @return The Margin Period Of Risk - */ - - public org.drip.xva.settings.MarginPeriodOfRisk mpor() - { - return _mpor; - } - - /** - * Retrieve the Counter Party Default Window - * - * @return The Counter Party Default Window - */ - - public int counterPartyDefaultWindow() - { - return _iCounterPartyDefaultWindow; - } - - /** - * Retrieve the Bank Default Window - * - * @return The Bank Default Window - */ - - public int bankDefaultWindow() - { - return _iBankDefaultWindow; - } -} diff --git a/org/drip/xva/settings/MarginPeriodOfRisk.java b/org/drip/xva/settings/MarginPeriodOfRisk.java deleted file mode 100644 index 2e9d30a..0000000 --- a/org/drip/xva/settings/MarginPeriodOfRisk.java +++ /dev/null @@ -1,151 +0,0 @@ - -package org.drip.xva.settings; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * MarginPeriodOfRisk contains the Margining Information associated with the Counter Party. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class MarginPeriodOfRisk { - - /** - * MPoR Interpolation Type - LINEAR - */ - - public static final int MPOR_INTERPOLATION_LINEAR = 1; - - /** - * MPoR Interpolation Type - SQRT_T - */ - - public static final int MPOR_INTERPOLATION_SQRT_T = 2; - - /** - * MPoR Interpolation Type - BROWNIAN_BRIDGE - */ - - public static final int MPOR_INTERPOLATION_BROWNIAN_BRIDGE = 4; - - private int _iInterpolationType = -1; - private int _iMarginCallFrequency = -1; - - /** - * Construct a Standard Instance of MarginPeriodOfRisk - * - * @return The Standard Instance of MarginPeriodOfRisk - */ - - public static final MarginPeriodOfRisk Standard() - { - try { - return new MarginPeriodOfRisk (1, MPOR_INTERPOLATION_BROWNIAN_BRIDGE); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * MarginPeriodOfRisk Constructor - * - * @param iMarginCallFrequency The MPoR Margin Call Frequency - * @param iInterpolationType The MPoR Interpolation Type - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public MarginPeriodOfRisk ( - final int iMarginCallFrequency, - final int iInterpolationType) - throws java.lang.Exception - { - if (-1 >= (_iMarginCallFrequency = iMarginCallFrequency) || (MPOR_INTERPOLATION_LINEAR != - (_iInterpolationType = iInterpolationType) && MPOR_INTERPOLATION_SQRT_T != _iInterpolationType && - MPOR_INTERPOLATION_BROWNIAN_BRIDGE != _iInterpolationType)) - throw new java.lang.Exception ("MarginPeriodOfRisk Constructor => Invalid Inputs"); - } - - /** - * Retrieve the MPoR Margin Call Frequency - * - * @return The MPoR Margin Call Frequency - */ - - public int marginCallFrequency() - { - return _iMarginCallFrequency; - } - - /** - * Retrieve the MPoR Interpolation Type - * - * @return The MPoR Interpolation Type - */ - - public int interpolationType() - { - return _iInterpolationType; - } -} diff --git a/org/drip/xva/settings/NettingGroupSpecification.java b/org/drip/xva/settings/NettingGroupSpecification.java deleted file mode 100644 index be7073b..0000000 --- a/org/drip/xva/settings/NettingGroupSpecification.java +++ /dev/null @@ -1,144 +0,0 @@ - -package org.drip.xva.settings; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * NettingGroupSpecification contains the Specification of a Netting Group. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class NettingGroupSpecification { - private boolean _bContractual = true; - private boolean _bEnforceable = true; - private java.lang.String _strID = ""; - private java.lang.String _strName = ""; - - /** - * NettingGroupSpecification Constructor - * - * @param strID The Collateral Group ID - * @param strName The Collateral Group Name - * @param bContractual TRUE - The Netting is Contractual - * @param bEnforceable TRUE - The Netting is Enforceable - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public NettingGroupSpecification ( - final java.lang.String strID, - final java.lang.String strName, - final boolean bContractual, - final boolean bEnforceable) - throws java.lang.Exception - { - if (null == (_strID = strID) || _strID.isEmpty() || null == (_strName = strName) || - _strName.isEmpty()) - throw new java.lang.Exception ("NettingGroupSpecification Constructor => Invalid Inputs"); - - _bContractual = bContractual; - _bEnforceable = bEnforceable; - } - - /** - * Retrieve the Collateral Group ID - * - * @return The Collateral Group ID - */ - - public java.lang.String id() - { - return _strID; - } - - /** - * Retrieve the Collateral Group Name - * - * @return The Collateral Group Name - */ - - public java.lang.String name() - { - return _strName; - } - - /** - * Indicate if the Netting allowed is Contractual - * - * @return TRUE - The Netting allowed is Contractual - */ - - public boolean contractual() - { - return _bContractual; - } - - /** - * Indicate if the Netting is Enforceable - * - * @return TRUE - The Netting is Enforceable - */ - - public boolean enforceable() - { - return _bEnforceable; - } -} diff --git a/org/drip/xva/settings/PDEEvolutionControl.java b/org/drip/xva/settings/PDEEvolutionControl.java deleted file mode 100644 index ff42306..0000000 --- a/org/drip/xva/settings/PDEEvolutionControl.java +++ /dev/null @@ -1,130 +0,0 @@ - -package org.drip.xva.settings; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * PDEEvolutionControl is used to Customize the XVA Estimation using PDE Evolution ,e.g., determine the MTM - * Mechanism that determines the actual Termination Close Out, as laid out in Burgard and Kjaer (2014). 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. - * - * - Cesari, G., J. Aquilina, N. Charpillon, X. Filipovic, G. Lee, and L. Manda (2009): Modeling, Pricing, - * and Hedging Counter-party Credit Exposure - A Technical Guide, Springer Finance, New York. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class PDEEvolutionControl { - - /** - * Set the Close-out to the Derivative MTM according to Li and Tang (2007) or Gregory (2009) - */ - - public static final int CLOSEOUT_GREGORY_LI_TANG = 1; - - /** - * Set the Close-out to the Derivative XVA MTM according to Burgard and Kjaer (2014) - */ - - public static final int CLOSEOUT_BURGARD_KJAER = 2; - - private int _iCloseOutScheme = CLOSEOUT_GREGORY_LI_TANG; - private double _dblSensitivityShiftFactor = java.lang.Double.NaN; - - /** - * PDEEvolutionControl Constructor - * - * @param iCloseOutScheme The Close Out Scheme - * @param dblSensitivityShiftFactor The Factor needed to evaluate Sensitivity Shifts - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public PDEEvolutionControl ( - final int iCloseOutScheme, - final double dblSensitivityShiftFactor) - throws java.lang.Exception - { - if ((CLOSEOUT_GREGORY_LI_TANG != (_iCloseOutScheme = iCloseOutScheme) && CLOSEOUT_BURGARD_KJAER != - _iCloseOutScheme) || !org.drip.quant.common.NumberUtil.IsValid (_dblSensitivityShiftFactor = - dblSensitivityShiftFactor)) - throw new java.lang.Exception ("PDEEvolutionControl Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Close-out Scheme - * - * @return The Close-out Scheme - */ - - public int closeOutScheme() - { - return _iCloseOutScheme; - } - - /** - * Retrieve the Factor needed to evaluate Sensitivity Shifts - * - * @return The Factor needed to evaluate Sensitivity Shifts - */ - - public double sensitivityShiftFactor() - { - return _dblSensitivityShiftFactor; - } -} diff --git a/org/drip/xva/trajectory/CollateralGroupEdge.java b/org/drip/xva/trajectory/CollateralGroupEdge.java deleted file mode 100644 index 15ced42..0000000 --- a/org/drip/xva/trajectory/CollateralGroupEdge.java +++ /dev/null @@ -1,238 +0,0 @@ - -package org.drip.xva.trajectory; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CollateralGroupEdge holds the Edge that contains the Vertex Realizations of a Projected Path of a Single - * Simulation Run along the Granularity of a Netting Group. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CollateralGroupEdge { - private org.drip.xva.trajectory.CollateralGroupVertex _cgvHead = null; - private org.drip.xva.trajectory.CollateralGroupVertex _cgvTail = null; - - /** - * CollateralGroupEdge Constructor - * - * @param cgvHead The Head Vertex - * @param cgvTail The Tail Vertex - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CollateralGroupEdge ( - final org.drip.xva.trajectory.CollateralGroupVertex cgvHead, - final org.drip.xva.trajectory.CollateralGroupVertex cgvTail) - throws java.lang.Exception - { - if (null == (_cgvHead = cgvHead) || null == (_cgvTail = cgvTail) || _cgvHead.vertex().julian() >= - _cgvTail.vertex().julian()) - throw new java.lang.Exception ("CollateralGroupEdge Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Head Vertex - * - * @return The Head Vertex - */ - - public org.drip.xva.trajectory.CollateralGroupVertex head() - { - return _cgvHead; - } - - /** - * Retrieve the Tail Vertex - * - * @return The Tail Vertex - */ - - public org.drip.xva.trajectory.CollateralGroupVertex tail() - { - return _cgvTail; - } - - /** - * Compute the Period Edge Credit Adjustment - * - * @return The Period Edge Credit Adjustment - */ - - public double credit() - { - org.drip.xva.trajectory.CollateralGroupVertexNumeraire cgvnHead = _cgvHead.numeraire(); - - org.drip.xva.trajectory.CollateralGroupVertexNumeraire cgvnTail = _cgvTail.numeraire(); - - return 0.5 * (_cgvTail.exposure().collateralizedPositive() / cgvnTail.csa() + - _cgvHead.exposure().collateralizedPositive() / cgvnHead.csa()) * (cgvnTail.counterPartySurvival() - - cgvnHead.counterPartySurvival()) * (1. - 0.5 * (cgvnHead.counterPartyRecovery() + - cgvnTail.counterPartyRecovery())); - } - - /** - * Compute the Period Edge Debt Adjustment - * - * @return The Period Edge Debt Adjustment - */ - - public double debt() - { - org.drip.xva.trajectory.CollateralGroupVertexNumeraire cgvnHead = _cgvHead.numeraire(); - - org.drip.xva.trajectory.CollateralGroupVertexNumeraire cgvnTail = _cgvTail.numeraire(); - - return 0.5 * (_cgvTail.exposure().collateralizedNegative() / cgvnTail.csa() + - _cgvHead.exposure().collateralizedNegative() / cgvnHead.csa()) * (cgvnTail.bankSurvival() - - cgvnHead.bankSurvival()) * (1. - 0.5 * (cgvnHead.bankRecovery() + cgvnTail.bankRecovery())); - } - - /** - * Compute the Period Edge Funding Adjustment - * - * @return The Period Edge Funding Adjustment - */ - - public double funding() - { - org.drip.xva.trajectory.CollateralGroupVertexNumeraire cgvnHead = _cgvHead.numeraire(); - - org.drip.xva.trajectory.CollateralGroupVertexNumeraire cgvnTail = _cgvTail.numeraire(); - - return -0.5 * (_cgvTail.exposure().collateralizedPositive() / cgvnTail.csa() * - cgvnTail.bankFundingSpread() + _cgvHead.exposure().collateralizedPositive() / cgvnHead.csa() * - cgvnHead.bankFundingSpread()) * (_cgvTail.vertex().julian() - _cgvHead.vertex().julian()) / - 365.25; - } - - /** - * Compute the Period Edge Total Adjustment - * - * @return The Period Edge Total Adjustment - */ - - public double total() - { - return credit() + debt() + funding(); - } - - /** - * Generate the Assorted XVA Adjustment Metrics - * - * @return The Assorted XVA Adjustment Metrics - */ - - public org.drip.xva.trajectory.CollateralGroupEdgeAdjustment generate() - { - org.drip.xva.trajectory.CollateralGroupVertexNumeraire cgvnHead = _cgvHead.numeraire(); - - org.drip.xva.trajectory.CollateralGroupVertexNumeraire cgvnTail = _cgvTail.numeraire(); - - double dblEdgeBankRecovery = 0.5 * (cgvnHead.bankRecovery() + cgvnTail.bankRecovery()); - - double dblEdgeCounterPartyRecovery = 0.5 * (cgvnHead.counterPartyRecovery() + - cgvnTail.counterPartyRecovery()); - - org.drip.xva.trajectory.CollateralGroupVertexExposure cgveHead = _cgvHead.exposure(); - - org.drip.xva.trajectory.CollateralGroupVertexExposure cgveTail = _cgvTail.exposure(); - - double dblHeadCollateralizedPositiveExposure = cgveHead.collateralizedPositive(); - - double dblTailCollateralizedPositiveExposure = cgveTail.collateralizedPositive(); - - double dblHeadCollateralizedNegativeExposure = cgveHead.collateralizedNegative(); - - double dblTailCollateralizedNegativeExposure = cgveTail.collateralizedNegative(); - - double dblHeadCSA = cgvnHead.csa(); - - double dblTailCSA = cgvnTail.csa(); - - double dblHeadCollateralizedPositiveExposurePV = dblHeadCollateralizedPositiveExposure / dblHeadCSA; - double dblTailCollateralizedPositiveExposurePV = dblTailCollateralizedPositiveExposure / dblTailCSA; - double dblHeadCollateralizedNegativeExposurePV = dblHeadCollateralizedNegativeExposure / dblHeadCSA; - double dblTailCollateralizedNegativeExposurePV = dblTailCollateralizedNegativeExposure / dblTailCSA; - double dblEdgeCollateralizedPositiveExposurePV = 0.5 * (dblTailCollateralizedPositiveExposurePV + - dblHeadCollateralizedPositiveExposurePV); - double dblEdgeCollateralizedNegativeExposurePV = 0.5 * (dblTailCollateralizedNegativeExposurePV + - dblHeadCollateralizedNegativeExposurePV); - - try { - return new org.drip.xva.trajectory.CollateralGroupEdgeAdjustment ( - dblEdgeCollateralizedPositiveExposurePV * (cgvnTail.counterPartySurvival() - - cgvnHead.counterPartySurvival()) * (1. - dblEdgeCounterPartyRecovery), - dblEdgeCollateralizedNegativeExposurePV * (cgvnTail.bankSurvival() - cgvnHead.bankSurvival()) - * (1. - dblEdgeBankRecovery), - 0.5 * ( - dblTailCollateralizedPositiveExposurePV * cgvnTail.bankFundingSpread() + - dblHeadCollateralizedPositiveExposurePV * cgvnHead.bankFundingSpread() - ) * (_cgvTail.vertex().julian() - _cgvHead.vertex().julian()) / 365.25 - ); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/xva/trajectory/CollateralGroupEdgeAdjustment.java b/org/drip/xva/trajectory/CollateralGroupEdgeAdjustment.java deleted file mode 100644 index e3e36cf..0000000 --- a/org/drip/xva/trajectory/CollateralGroupEdgeAdjustment.java +++ /dev/null @@ -1,130 +0,0 @@ - -package org.drip.xva.trajectory; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CollateralGroupEdgeAdjustment holds the XVA Adjustment that result from the Vertex Realizations of a - * Projected Path of a Single Simulation Run along the Granularity of a Collateral Group. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CollateralGroupEdgeAdjustment { - private double _dblDebt = java.lang.Double.NaN; - private double _dblCredit = java.lang.Double.NaN; - private double _dblFunding = java.lang.Double.NaN; - - /** - * CollateralGroupEdgeAdjustment Constructor - * - * @param dblCredit The Path-specific Credit Value Adjustment - * @param dblDebt The Path-specific Debt Value Adjustment - * @param dblFunding The Path-specific Funding Value Adjustment - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CollateralGroupEdgeAdjustment ( - final double dblCredit, - final double dblDebt, - final double dblFunding) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblCredit = dblCredit) || - !org.drip.quant.common.NumberUtil.IsValid (_dblDebt = dblDebt) || - !org.drip.quant.common.NumberUtil.IsValid (_dblFunding = dblFunding)) - throw new java.lang.Exception ("CollateralGroupEdgeAdjustment Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Path-specific Credit Adjustment - * - * @return The Path-specific Credit Adjustment - */ - - public double credit() - { - return _dblCredit; - } - - /** - * Retrieve the Path-specific Debt Adjustment - * - * @return The Path-specific Debt Adjustment - */ - - public double debt() - { - return _dblDebt; - } - - /** - * Retrieve the Path-specific Funding Adjustment - * - * @return The Path-specific Funding Adjustment - */ - - public double funding() - { - return _dblFunding; - } -} diff --git a/org/drip/xva/trajectory/CollateralGroupPath.java b/org/drip/xva/trajectory/CollateralGroupPath.java deleted file mode 100644 index 093b84a..0000000 --- a/org/drip/xva/trajectory/CollateralGroupPath.java +++ /dev/null @@ -1,335 +0,0 @@ - -package org.drip.xva.trajectory; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CollateralGroupPath accumulates the Vertex Realizations of the Sequence in a Single Path Projection Run - * along the Granularity of a Collateral Group. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CollateralGroupPath { - private org.drip.xva.trajectory.CollateralGroupEdge[] _aCGE = null; - - /** - * CollateralGroupPath Constructor - * - * @param aCGE The Array of Netting Group Trajectory Edges - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CollateralGroupPath ( - final org.drip.xva.trajectory.CollateralGroupEdge[] aCGE) - throws java.lang.Exception - { - if (null == (_aCGE = aCGE)) - throw new java.lang.Exception ("CollateralGroupPath Constructor => Invalid Inputs"); - - int iNumEdge = _aCGE.length; - - if (1 >= iNumEdge) - throw new java.lang.Exception ("CollateralGroupPath Constructor => Invalid Inputs"); - - for (int i = 0; i < iNumEdge; ++i) { - if (null == _aCGE[i]) - throw new java.lang.Exception ("CollateralGroupPath Constructor => Invalid Inputs"); - - if (0 != i && _aCGE[i - 1].tail().vertex().julian() != _aCGE[i].head().vertex().julian()) - throw new java.lang.Exception ("CollateralGroupPath Constructor => Invalid Inputs"); - } - } - - /** - * Retrieve the Array of Netting Group Trajectory Edges - * - * @return The Array of Netting Group Trajectory Edges - */ - - public org.drip.xva.trajectory.CollateralGroupEdge[] edges() - { - return _aCGE; - } - - /** - * Retrieve the Path-wise Credit Adjustment - * - * @return The Path-wise Credit Adjustment - */ - - public double credit() - { - double dblCredit = 0.; - - for (org.drip.xva.trajectory.CollateralGroupEdge cge : _aCGE) - dblCredit += cge.credit(); - - return dblCredit; - } - - /** - * Retrieve the Path-wise Debt Adjustment - * - * @return The Path-wise Debt Adjustment - */ - - public double debt() - { - double dblDebt = 0.; - - for (org.drip.xva.trajectory.CollateralGroupEdge cge : _aCGE) - dblDebt += cge.debt(); - - return dblDebt; - } - - /** - * Retrieve the Path-wise Funding Adjustment - * - * @return The Path-wise Funding Adjustment - */ - - public double funding() - { - double dblFunding = 0.; - - for (org.drip.xva.trajectory.CollateralGroupEdge cge : _aCGE) - dblFunding += cge.funding(); - - return dblFunding; - } - - /** - * Retrieve the Path-wise Total Adjustment - * - * @return The Path-wise Total Adjustment - */ - - public double total() - { - double dblTotal = 0.; - - for (org.drip.xva.trajectory.CollateralGroupEdge cge : _aCGE) - dblTotal += cge.total(); - - return dblTotal; - } - - /** - * Retrieve the Array of Collateralized Exposures - * - * @return The Array of Collateralized Exposures - */ - - public double[] collateralizedExposure() - { - int iNumEdge = _aCGE.length; - double[] adblCollateralizedExposure = new double[iNumEdge]; - - for (int i = 0; i < iNumEdge; ++i) - adblCollateralizedExposure[i] = _aCGE[i].tail().exposure().collateralized(); - - return adblCollateralizedExposure; - } - - /** - * Retrieve the Array of Uncollateralized Exposures - * - * @return The Array of Uncollateralized Exposures - */ - - public double[] uncollateralizedExposure() - { - int iNumEdge = _aCGE.length; - double[] adblUncollateralizedExposure = new double[iNumEdge]; - - for (int i = 0; i < iNumEdge; ++i) - adblUncollateralizedExposure[i] = _aCGE[i].tail().exposure().uncollateralized(); - - return adblUncollateralizedExposure; - } - - /** - * Retrieve the Array of Collateralized Exposure PVs - * - * @return The Array of Collateralized Exposure PVs - */ - - public double[] collateralizedExposurePV() - { - int iNumEdge = _aCGE.length; - double[] adblCollateralizedExposurePV = new double[iNumEdge]; - - for (int i = 0; i < iNumEdge; ++i) { - org.drip.xva.trajectory.CollateralGroupVertex cgvTail =_aCGE[i].tail(); - - adblCollateralizedExposurePV[i] = cgvTail.exposure().collateralized() / - cgvTail.numeraire().csa(); - } - - return adblCollateralizedExposurePV; - } - - /** - * Retrieve the Array of Uncollateralized Exposure PVs - * - * @return The Array of Uncollateralized Exposure PVs - */ - - public double[] uncollateralizedExposurePV() - { - int iNumEdge = _aCGE.length; - double[] adblUncollateralizedExposurePV = new double[iNumEdge]; - - for (int i = 0; i < iNumEdge; ++i) { - org.drip.xva.trajectory.CollateralGroupVertex cgvTail =_aCGE[i].tail(); - - adblUncollateralizedExposurePV[i] = cgvTail.exposure().uncollateralized() / - cgvTail.numeraire().csa(); - } - - return adblUncollateralizedExposurePV; - } - - /** - * Retrieve the Array of Collateral Balances - * - * @return The Array of Collateral Balances - */ - - public double[] collateralBalance() - { - int iNumEdge = _aCGE.length; - double[] adblCollateralizedBalance = new double[iNumEdge]; - - for (int i = 0; i < iNumEdge; ++i) - adblCollateralizedBalance[i] = _aCGE[i].tail().exposure().collateralBalance(); - - return adblCollateralizedBalance; - } - - /** - * Retrieve the Array of Edge Adjustments - * - * @return The Array of Edge Adjustments - */ - - public org.drip.xva.trajectory.CollateralGroupEdgeAdjustment[] edgeAdjustments() - { - int iNumEdge = _aCGE.length; - org.drip.xva.trajectory.CollateralGroupEdgeAdjustment[] aCGEA = new - org.drip.xva.trajectory.CollateralGroupEdgeAdjustment[iNumEdge]; - - for (int i = 0; i < iNumEdge; ++i) - aCGEA[i] = _aCGE[i].generate(); - - return aCGEA; - } - - /** - * Construct the Group Trajectory Path Adjustment Instance - * - * @return The Group Trajectory Path Adjustment Instance - */ - - public org.drip.xva.trajectory.CollateralGroupPathAdjustment adjustment() - { - int iNumEdge = _aCGE.length; - double[] adblCollateralizedExposure = new double[iNumEdge]; - double[] adblUncollateralizedExposure = new double[iNumEdge]; - double[] adblCollateralizedExposurePV = new double[iNumEdge]; - double[] adblUncollateralizedExposurePV = new double[iNumEdge]; - org.drip.analytics.date.JulianDate[] adtVertex = new org.drip.analytics.date.JulianDate[iNumEdge]; - - for (int i = 0; i < iNumEdge; ++i) { - org.drip.xva.trajectory.CollateralGroupVertex cgvTail =_aCGE[i].tail(); - - adtVertex[i] = cgvTail.vertex(); - - double dblTailCSANumeraire = cgvTail.numeraire().csa(); - - org.drip.xva.trajectory.CollateralGroupVertexExposure cgve = cgvTail.exposure(); - - adblUncollateralizedExposure[i] = cgve.uncollateralized(); - - adblCollateralizedExposurePV[i] = (adblCollateralizedExposure[i] = cgve.collateralized()) / - dblTailCSANumeraire; - - adblUncollateralizedExposurePV[i] = (adblUncollateralizedExposure[i] = cgve.collateralized()) / - dblTailCSANumeraire; - } - - try { - return new org.drip.xva.trajectory.CollateralGroupPathAdjustment ( - adtVertex, - adblCollateralizedExposure, - adblUncollateralizedExposure, - adblCollateralizedExposurePV, - adblUncollateralizedExposurePV - ); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/org/drip/xva/trajectory/CollateralGroupPathAdjustment.java b/org/drip/xva/trajectory/CollateralGroupPathAdjustment.java deleted file mode 100644 index 6a4980c..0000000 --- a/org/drip/xva/trajectory/CollateralGroupPathAdjustment.java +++ /dev/null @@ -1,172 +0,0 @@ - -package org.drip.xva.trajectory; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CollateralGroupPathAdjustment holds the Adjustments from the Exposure Sequence in a Single Path Projection - * Run along the Granularity of a Collateral Group. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CollateralGroupPathAdjustment { - private double[] _adblCollateralizedExposure = null; - private double[] _adblUncollateralizedExposure = null; - private double[] _adblCollateralizedExposurePV = null; - private double[] _adblUncollateralizedExposurePV = null; - private org.drip.analytics.date.JulianDate[] _adtVertex = null; - - /** - * CollateralGroupPathAdjustment Constructor - * - * @param adtVertex Array of Vertex Dates - * @param adblCollateralizedExposure The Array of Collateralized Exposures - * @param adblUncollateralizedExposure The Array of Uncollateralized Exposures - * @param adblCollateralizedExposurePV The Array of Collateralized Exposure PVs - * @param adblUncollateralizedExposurePV The Array of Uncollateralized Exposure PVs - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CollateralGroupPathAdjustment ( - final org.drip.analytics.date.JulianDate[] adtVertex, - final double[] adblCollateralizedExposure, - final double[] adblUncollateralizedExposure, - final double[] adblCollateralizedExposurePV, - final double[] adblUncollateralizedExposurePV) - throws java.lang.Exception - { - if (null == (_adtVertex = adtVertex) || - null == (_adblCollateralizedExposure = adblCollateralizedExposure) || - null == (_adblUncollateralizedExposure = adblUncollateralizedExposure) || - null == (_adblCollateralizedExposurePV = adblCollateralizedExposurePV) || - null == (_adblUncollateralizedExposurePV = adblUncollateralizedExposurePV)) - throw new java.lang.Exception ("CollateralGroupPathAdjustment Constructor => Invalid Inputs"); - - int iNumEdge = _adtVertex.length; - - if (0 == iNumEdge || - iNumEdge != _adblCollateralizedExposure.length || - iNumEdge != _adblUncollateralizedExposure.length || - iNumEdge != _adblCollateralizedExposurePV.length || - iNumEdge != _adblUncollateralizedExposurePV.length || - !org.drip.quant.common.NumberUtil.IsValid (_adblCollateralizedExposure) || - !org.drip.quant.common.NumberUtil.IsValid (_adblUncollateralizedExposure) || - !org.drip.quant.common.NumberUtil.IsValid (_adblCollateralizedExposurePV) || - !org.drip.quant.common.NumberUtil.IsValid (_adblUncollateralizedExposurePV)) - throw new java.lang.Exception ("CollateralGroupPathAdjustment Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Array of Vertex Dates - * - * @return The Array of Vertex Dates - */ - - public org.drip.analytics.date.JulianDate[] vertex() - { - return _adtVertex; - } - - /** - * Retrieve the Array of Collateralized Exposures - * - * @return The Array of Collateralized Exposures - */ - - public double[] collateralizedExposure() - { - return _adblCollateralizedExposure; - } - - /** - * Retrieve the Array of Uncollateralized Exposures - * - * @return The Array of Uncollateralized Exposures - */ - - public double[] uncollateralizedExposure() - { - return _adblUncollateralizedExposure; - } - - /** - * Retrieve the Array of Collateralized Exposure PVs - * - * @return The Array of Collateralized Exposure PVs - */ - - public double[] collateralizedExposurePV() - { - return _adblCollateralizedExposurePV; - } - - /** - * Retrieve the Array of Uncollateralized Exposure PVs - * - * @return The Array of Uncollateralized Exposure PVs - */ - - public double[] uncollateralizedExposurePV() - { - return _adblUncollateralizedExposurePV; - } -} diff --git a/org/drip/xva/trajectory/CollateralGroupVertex.java b/org/drip/xva/trajectory/CollateralGroupVertex.java deleted file mode 100644 index 3966797..0000000 --- a/org/drip/xva/trajectory/CollateralGroupVertex.java +++ /dev/null @@ -1,127 +0,0 @@ - -package org.drip.xva.trajectory; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CollateralGroupVertex holds the Vertex Realizations of a Projected Path of a Single Simulation Run along - * the Granularity of a Collateral Group. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CollateralGroupVertex { - private org.drip.analytics.date.JulianDate _dtVertex = null; - private org.drip.xva.trajectory.CollateralGroupVertexExposure _cgve = null; - private org.drip.xva.trajectory.CollateralGroupVertexNumeraire _cgvn = null; - - /** - * CollateralGroupVertex Constructor - * - * @param dtVertex The Trade Trajectory Vertex Date - * @param cgve The Trade Trajectory Vertex Exposure - * @param cgvn The Trade Trajectory Vertex Numeraire - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CollateralGroupVertex ( - final org.drip.analytics.date.JulianDate dtVertex, - final org.drip.xva.trajectory.CollateralGroupVertexExposure cgve, - final org.drip.xva.trajectory.CollateralGroupVertexNumeraire cgvn) - throws java.lang.Exception - { - if (null == (_dtVertex = dtVertex) || null == (_cgve = cgve) || null == (_cgvn = cgvn)) - throw new java.lang.Exception ("CollateralGroupVertex Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Trade Trajectory Vertex Date - * - * @return The Trade Trajectory Vertex Date - */ - - public org.drip.analytics.date.JulianDate vertex() - { - return _dtVertex; - } - - /** - * Retrieve the Trade Trajectory Vertex Exposure - * - * @return The Trade Trajectory Vertex Exposure - */ - - public org.drip.xva.trajectory.CollateralGroupVertexExposure exposure() - { - return _cgve; - } - - /** - * Retrieve the Trade Trajectory Vertex Numeraire - * - * @return The Trade Trajectory Vertex Numeraire - */ - - public org.drip.xva.trajectory.CollateralGroupVertexNumeraire numeraire() - { - return _cgvn; - } -} diff --git a/org/drip/xva/trajectory/CollateralGroupVertexExposure.java b/org/drip/xva/trajectory/CollateralGroupVertexExposure.java deleted file mode 100644 index 1803cb5..0000000 --- a/org/drip/xva/trajectory/CollateralGroupVertexExposure.java +++ /dev/null @@ -1,234 +0,0 @@ - -package org.drip.xva.trajectory; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CollateralGroupVertexExposure holds the Vertex Exposure of a Projected Path of a Simulation Run of a - * Collateral Group. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CollateralGroupVertexExposure { - private double _dblForwardPV = java.lang.Double.NaN; - private double _dblRealizedCashFlow = java.lang.Double.NaN; - private double _dblCollateralBalance = java.lang.Double.NaN; - private double _dblCollateralizedNegative = java.lang.Double.NaN; - private double _dblCollateralizedPositive = java.lang.Double.NaN; - - /** - * CollateralGroupVertexExposure Constructor - * - * @param dblForwardPV The Forward PV at the Path Vertex Time Node - * @param dblRealizedCashFlow The Default Window Realized Cash-flow at the Path Vertex Time Node - * @param dblCollateralBalance The Collateral Balance at the Path Vertex Time Node - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CollateralGroupVertexExposure ( - final double dblForwardPV, - final double dblRealizedCashFlow, - final double dblCollateralBalance) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblForwardPV = dblForwardPV) || - !org.drip.quant.common.NumberUtil.IsValid (_dblCollateralBalance = dblCollateralBalance) || - !org.drip.quant.common.NumberUtil.IsValid (_dblRealizedCashFlow = dblRealizedCashFlow)) - throw new java.lang.Exception ("CollateralGroupVertexExposure Constructor => Invalid Inputs"); - - double dblNetExposure = _dblForwardPV + _dblRealizedCashFlow - _dblCollateralBalance; - _dblCollateralizedPositive = dblNetExposure > 0. ? dblNetExposure : 0.; - _dblCollateralizedNegative = dblNetExposure < 0. ? dblNetExposure : 0.; - } - - /** - * Retrieve the Forward PV at the Path Vertex Time Node - * - * @return The Forward PV at the Path Vertex Time Node - */ - - public double forwardPV() - { - return _dblForwardPV; - } - - /** - * Retrieve the Total Collateralized Exposure at the Path Vertex Time Node - * - * @return The Total Collateralized Exposure at the Path Vertex Time Node - */ - - public double collateralized() - { - return _dblForwardPV + _dblRealizedCashFlow - _dblCollateralBalance; - } - - /** - * Retrieve the Total Uncollateralized Exposure at the Path Vertex Time Node - * - * @return The Total Uncollateralized Exposure at the Path Vertex Time Node - */ - - public double uncollateralized() - { - return _dblForwardPV + _dblRealizedCashFlow; - } - - /** - * Retrieve the Exposure at the Path Vertex Time Node Net of Collateral - * - * @return The Exposure at the Path Vertex Time Node Net of Collateral - */ - - public double net() - { - return collateralized(); - } - - /** - * Retrieve the Collateralized Positive Exposure at the Path Vertex Time Node - * - * @return The Collateralized Positive Exposure at the Path Vertex Time Node - */ - - public double collateralizedPositive() - { - return _dblCollateralizedPositive; - } - - /** - * Retrieve the Uncollateralized Positive Exposure at the Path Vertex Time Node - * - * @return The Uncollateralized Positive Exposure at the Path Vertex Time Node - */ - - public double uncollateralizedPositive() - { - return _dblForwardPV > 0. ? _dblForwardPV : 0.; - } - - /** - * Retrieve the Positive Exposure at the Path Vertex Time Node - * - * @return The Positive Exposure at the Path Vertex Time Node - */ - - public double positive() - { - return collateralizedPositive(); - } - - /** - * Retrieve the Collateralized Negative Exposure at the Path Vertex Time Node - * - * @return The Collateralized Negative Exposure at the Path Vertex Time Node - */ - - public double collateralizedNegative() - { - return _dblCollateralizedNegative; - } - - /** - * Retrieve the Uncollateralized Negative Exposure at the Path Vertex Time Node - * - * @return The Uncollateralized Negative Exposure at the Path Vertex Time Node - */ - - public double uncollateralizedNegative() - { - return _dblForwardPV < 0. ? _dblForwardPV : 0.; - } - - /** - * Retrieve the Negative Exposure at the Path Vertex Time Node - * - * @return The Negative Exposure at the Path Vertex Time Node - */ - - public double negative() - { - return collateralizedNegative(); - } - - /** - * Retrieve the Collateral Balance at the Path Vertex Time Node - * - * @return The Collateral Balance at the Path Vertex Time Node - */ - - public double collateralBalance() - { - return _dblCollateralBalance; - } - - /** - * Retrieve the Default Window Realized Cash-flow at the Path Vertex Time Node - * - * @return The Default Window Realized Cash-flow at the Path Vertex Time Node - */ - - public double realizedCashFlow() - { - return _dblRealizedCashFlow; - } -} diff --git a/org/drip/xva/trajectory/CollateralGroupVertexNumeraire.java b/org/drip/xva/trajectory/CollateralGroupVertexNumeraire.java deleted file mode 100644 index 1fb7668..0000000 --- a/org/drip/xva/trajectory/CollateralGroupVertexNumeraire.java +++ /dev/null @@ -1,175 +0,0 @@ - -package org.drip.xva.trajectory; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CollateralGroupVertexNumeraire holds the Vertex Market Numeraire Realizations of a Projected Path of a - * Simulation Run along the Granularity of a Collateral Group. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CollateralGroupVertexNumeraire { - private double _dblCSA = java.lang.Double.NaN; - private double _dblBankRecovery = java.lang.Double.NaN; - private double _dblBankSurvival = java.lang.Double.NaN; - private double _dblBankFundingSpread = java.lang.Double.NaN; - private double _dblCounterPartyRecovery = java.lang.Double.NaN; - private double _dblCounterPartySurvival = java.lang.Double.NaN; - - /** - * CollateralGroupVertexNumeraire Constructor - * - * @param dblCSA The Realized CSA Numeraire - * @param dblBankSurvival The Realized Bank Survival Numeraire - * @param dblBankRecovery The Realized Bank Recovery Numeraire - * @param dblBankFundingSpread The Bank Funding Spread Numeraire - * @param dblCounterPartySurvival The Realized Counter Party Survival Numeraire - * @param dblCounterPartyRecovery The Realized Counter Party Recovery Numeraire - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CollateralGroupVertexNumeraire ( - final double dblCSA, - final double dblBankSurvival, - final double dblBankRecovery, - final double dblBankFundingSpread, - final double dblCounterPartySurvival, - final double dblCounterPartyRecovery) - throws java.lang.Exception - { - if (!org.drip.quant.common.NumberUtil.IsValid (_dblCSA = dblCSA) || - !org.drip.quant.common.NumberUtil.IsValid (_dblBankSurvival = dblBankSurvival) || - !org.drip.quant.common.NumberUtil.IsValid (_dblBankRecovery = dblBankRecovery) || - !org.drip.quant.common.NumberUtil.IsValid (_dblBankFundingSpread = dblBankFundingSpread) - || !org.drip.quant.common.NumberUtil.IsValid (_dblCounterPartySurvival = - dblCounterPartySurvival) || !org.drip.quant.common.NumberUtil.IsValid - (_dblCounterPartyRecovery = dblCounterPartyRecovery)) - throw new java.lang.Exception ("CollateralGroupVertexNumeraire Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Realized CSA Numeraire - * - * @return The Realized CSA Numeraire - */ - - public double csa() - { - return _dblCSA; - } - - /** - * Retrieve the Realized Bank Survival Numeraire - * - * @return The Realized Bank Survival Numeraire - */ - - public double bankSurvival() - { - return _dblBankSurvival; - } - - /** - * Retrieve the Realized Bank Recovery Numeraire - * - * @return The Realized Bank Recovery Numeraire - */ - - public double bankRecovery() - { - return _dblBankRecovery; - } - - /** - * Retrieve the Realized Bank Funding Spread - * - * @return The Realized Bank Funding Spread - */ - - public double bankFundingSpread() - { - return _dblBankFundingSpread; - } - - /** - * Retrieve the Realized Counter Party Survival Numeraire - * - * @return The Realized Counter Party Survival Numeraire - */ - - public double counterPartySurvival() - { - return _dblCounterPartySurvival; - } - - /** - * Retrieve the Realized Counter Party Recovery Numeraire - * - * @return The Realized Counter Party Recovery Numeraire - */ - - public double counterPartyRecovery() - { - return _dblCounterPartyRecovery; - } -} diff --git a/org/drip/xva/trajectory/CounterPartyGroupAggregator.java b/org/drip/xva/trajectory/CounterPartyGroupAggregator.java deleted file mode 100644 index ffdc4a7..0000000 --- a/org/drip/xva/trajectory/CounterPartyGroupAggregator.java +++ /dev/null @@ -1,553 +0,0 @@ - -package org.drip.xva.trajectory; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * CounterPartyGroupAggregator aggregates across Multiple Netting Groups belonging to the Counter Party. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class CounterPartyGroupAggregator { - private org.drip.xva.trajectory.NettingGroupPathAggregator[] _aNGPA = null; - - /** - * CounterPartyGroupAggregator Constructor - * - * @param aNGPA Array of Netting Group Aggregator - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public CounterPartyGroupAggregator ( - final org.drip.xva.trajectory.NettingGroupPathAggregator[] aNGPA) - throws java.lang.Exception - { - if (null == (_aNGPA = aNGPA) || 0 == _aNGPA.length) - throw new java.lang.Exception ("CounterPartyGroupAggregator Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Array of Netting Group Aggregator - * - * @return Array of Netting Group Aggregator - */ - - public org.drip.xva.trajectory.NettingGroupPathAggregator[] nettingGroups() - { - return _aNGPA; - } - - /** - * Retrieve the Array of the Vertex Dates - * - * @return The Array of the Vertex Dates - */ - - public org.drip.analytics.date.JulianDate[] vertexes() - { - return _aNGPA[0].vertexes(); - } - - /** - * Retrieve the Expected CVA - * - * @return The Expected CVA - */ - - public double cva() - { - double dblCVA = 0.; - int iNumNettingGroup = _aNGPA.length; - - for (int i = 0; i < iNumNettingGroup; ++i) - dblCVA += _aNGPA[i].cva(); - - return dblCVA; - } - - /** - * Retrieve the Expected DVA - * - * @return The Expected DVA - */ - - public double dva() - { - double dblDVA = 0.; - int iNumNettingGroup = _aNGPA.length; - - for (int i = 0; i < iNumNettingGroup; ++i) - dblDVA += _aNGPA[i].dva(); - - return dblDVA; - } - - /** - * Retrieve the Expected FCA - * - * @return The Expected FCA - */ - - public double fca() - { - double dblFCA = 0.; - int iNumNettingGroup = _aNGPA.length; - - for (int i = 0; i < iNumNettingGroup; ++i) - dblFCA += _aNGPA[i].fca(); - - return dblFCA; - } - - /** - * Retrieve the Expected Total VA - * - * @return The Expected Total VA - */ - - public double total() - { - double dblTotal = 0.; - int iNumNettingGroup = _aNGPA.length; - - for (int i = 0; i < iNumNettingGroup; ++i) - dblTotal += _aNGPA[i].total(); - - return dblTotal; - } - - /** - * Retrieve the Array of Collateralized Exposures - * - * @return The Array of Collateralized Exposures - */ - - public double[] collateralizedExposure() - { - int iNumEdge = vertexes().length - 1; - - int iNumNettingGroup = _aNGPA.length; - double[] adblCollateralizedExposure = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblCollateralizedExposure[j] = 0.; - - for (int iNettingGroupIndex = 0; iNettingGroupIndex < iNumNettingGroup; ++iNettingGroupIndex) { - double[] adblNettingGroupCollateralizedExposure = - _aNGPA[iNettingGroupIndex].collateralizedExposure(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) - adblCollateralizedExposure[iEdgeIndex] += adblNettingGroupCollateralizedExposure[iEdgeIndex]; - } - - return adblCollateralizedExposure; - } - - /** - * Retrieve the Array of Uncollateralized Exposures - * - * @return The Array of Uncollateralized Exposures - */ - - public double[] uncollateralizedExposure() - { - int iNumEdge = vertexes().length - 1; - - int iNumNettingGroup = _aNGPA.length; - double[] adblUncollateralizedExposure = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblUncollateralizedExposure[j] = 0.; - - for (int iNettingGroupIndex = 0; iNettingGroupIndex < iNumNettingGroup; ++iNettingGroupIndex) { - double[] adblNettingGroupUncollateralizedExposure = - _aNGPA[iNettingGroupIndex].uncollateralizedExposure(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) - adblUncollateralizedExposure[iEdgeIndex] += - adblNettingGroupUncollateralizedExposure[iEdgeIndex]; - } - - return adblUncollateralizedExposure; - } - - /** - * Retrieve the Array of Collateralized Exposure PV's - * - * @return The Array of Collateralized Exposure PV's - */ - - public double[] collateralizedExposurePV() - { - int iNumEdge = vertexes().length - 1; - - int iNumNettingGroup = _aNGPA.length; - double[] adblCollateralizedExposurePV = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblCollateralizedExposurePV[j] = 0.; - - for (int iNettingGroupIndex = 0; iNettingGroupIndex < iNumNettingGroup; ++iNettingGroupIndex) { - double[] adblNettingGroupCollateralizedExposurePV = - _aNGPA[iNettingGroupIndex].collateralizedExposurePV(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) - adblCollateralizedExposurePV[iEdgeIndex] += - adblNettingGroupCollateralizedExposurePV[iEdgeIndex]; - } - - return adblCollateralizedExposurePV; - } - - /** - * Retrieve the Array of Uncollateralized Exposure PV's - * - * @return The Array of Uncollateralized Exposure PV's - */ - - public double[] uncollateralizedExposurePV() - { - int iNumEdge = vertexes().length - 1; - - int iNumNettingGroup = _aNGPA.length; - double[] adblUncollateralizedExposurePV = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblUncollateralizedExposurePV[j] = 0.; - - for (int iNettingGroupIndex = 0; iNettingGroupIndex < iNumNettingGroup; ++iNettingGroupIndex) { - double[] adblNettingGroupUncollateralizedExposurePV = - _aNGPA[iNettingGroupIndex].uncollateralizedExposurePV(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) - adblUncollateralizedExposurePV[iEdgeIndex] += - adblNettingGroupUncollateralizedExposurePV[iEdgeIndex]; - } - - return adblUncollateralizedExposurePV; - } - - /** - * Retrieve the Array of Collateralized Positive Exposures - * - * @return The Array of Collateralized Positive Exposures - */ - - public double[] collateralizedPositiveExposure() - { - int iNumEdge = vertexes().length - 1; - - int iNumNettingGroup = _aNGPA.length; - double[] adblCollateralizedPositiveExposure = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblCollateralizedPositiveExposure[j] = 0.; - - for (int iNettingGroupIndex = 0; iNettingGroupIndex < iNumNettingGroup; ++iNettingGroupIndex) { - double[] adblNettingGroupCollateralizedExposure = - _aNGPA[iNettingGroupIndex].collateralizedExposure(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) { - double dblNettingGroupEdgeCollateralizedExposure = - adblNettingGroupCollateralizedExposure[iEdgeIndex]; - - if (0 < dblNettingGroupEdgeCollateralizedExposure) - adblCollateralizedPositiveExposure[iEdgeIndex] += - dblNettingGroupEdgeCollateralizedExposure; - } - } - - return adblCollateralizedPositiveExposure; - } - - /** - * Retrieve the Array of Collateralized Positive Exposure PV - * - * @return The Array of Collateralized Positive Exposure PV - */ - - public double[] collateralizedPositiveExposurePV() - { - int iNumEdge = vertexes().length - 1; - - int iNumNettingGroup = _aNGPA.length; - double[] adblCollateralizedPositiveExposurePV = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblCollateralizedPositiveExposurePV[j] = 0.; - - for (int iNettingGroupIndex = 0; iNettingGroupIndex < iNumNettingGroup; ++iNettingGroupIndex) { - double[] adblNettingGroupCollateralizedExposurePV = - _aNGPA[iNettingGroupIndex].collateralizedExposurePV(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) { - double dblNettingGroupEdgeCollateralizedExposurePV = - adblNettingGroupCollateralizedExposurePV[iEdgeIndex]; - - if (0 < dblNettingGroupEdgeCollateralizedExposurePV) - adblCollateralizedPositiveExposurePV[iEdgeIndex] += - dblNettingGroupEdgeCollateralizedExposurePV; - } - } - - return adblCollateralizedPositiveExposurePV; - } - - /** - * Retrieve the Array of Uncollateralized Positive Exposures - * - * @return The Array of Uncollateralized Positive Exposures - */ - - public double[] uncollateralizedPositiveExposure() - { - int iNumEdge = vertexes().length - 1; - - int iNumNettingGroup = _aNGPA.length; - double[] adblUncollateralizedPositiveExposure = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblUncollateralizedPositiveExposure[j] = 0.; - - for (int iNettingGroupIndex = 0; iNettingGroupIndex < iNumNettingGroup; ++iNettingGroupIndex) { - double[] adblNettingGroupUncollateralizedExposure = - _aNGPA[iNettingGroupIndex].uncollateralizedExposure(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) { - double dblNettingGroupEdgeUncollateralizedExposure = - adblNettingGroupUncollateralizedExposure[iEdgeIndex]; - - if (0 < dblNettingGroupEdgeUncollateralizedExposure) - adblUncollateralizedPositiveExposure[iEdgeIndex] += - dblNettingGroupEdgeUncollateralizedExposure; - } - } - - return adblUncollateralizedPositiveExposure; - } - - /** - * Retrieve the Array of Uncollateralized Positive Exposure PV - * - * @return The Array of Uncollateralized Positive Exposure PV - */ - - public double[] uncollateralizedPositiveExposurePV() - { - int iNumEdge = vertexes().length - 1; - - int iNumNettingGroup = _aNGPA.length; - double[] adblUncollateralizedPositiveExposurePV = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblUncollateralizedPositiveExposurePV[j] = 0.; - - for (int iNettingGroupIndex = 0; iNettingGroupIndex < iNumNettingGroup; ++iNettingGroupIndex) { - double[] adblNettingGroupUncollateralizedExposurePV = - _aNGPA[iNettingGroupIndex].uncollateralizedExposurePV(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) { - double dblNettingGroupEdgeUncollateralizedExposurePV = - adblNettingGroupUncollateralizedExposurePV[iEdgeIndex]; - - if (0 < dblNettingGroupEdgeUncollateralizedExposurePV) - adblUncollateralizedPositiveExposurePV[iEdgeIndex] += - dblNettingGroupEdgeUncollateralizedExposurePV; - } - } - - return adblUncollateralizedPositiveExposurePV; - } - - /** - * Retrieve the Array of Collateralized Negative Exposures - * - * @return The Array of Collateralized Negative Exposures - */ - - public double[] collateralizedNegativeExposure() - { - int iNumEdge = vertexes().length - 1; - - int iNumNettingGroup = _aNGPA.length; - double[] adblCollateralizedNegativeExposure = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblCollateralizedNegativeExposure[j] = 0.; - - for (int iNettingGroupIndex = 0; iNettingGroupIndex < iNumNettingGroup; ++iNettingGroupIndex) { - double[] adblNettingGroupCollateralizedExposure = - _aNGPA[iNettingGroupIndex].collateralizedExposure(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) { - double dblNettingGroupEdgeCollateralizedExposure = - adblNettingGroupCollateralizedExposure[iEdgeIndex]; - - if (0 > dblNettingGroupEdgeCollateralizedExposure) - adblCollateralizedNegativeExposure[iEdgeIndex] += - dblNettingGroupEdgeCollateralizedExposure; - } - } - - return adblCollateralizedNegativeExposure; - } - - /** - * Retrieve the Array of Collateralized Negative Exposure PV - * - * @return The Array of Collateralized Negative Exposure PV - */ - - public double[] collateralizedNegativeExposurePV() - { - int iNumEdge = vertexes().length - 1; - - int iNumNettingGroup = _aNGPA.length; - double[] adblCollateralizedNegativeExposurePV = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblCollateralizedNegativeExposurePV[j] = 0.; - - for (int iNettingGroupIndex = 0; iNettingGroupIndex < iNumNettingGroup; ++iNettingGroupIndex) { - double[] adblNettingGroupCollateralizedExposurePV = - _aNGPA[iNettingGroupIndex].collateralizedExposurePV(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) { - double dblNettingGroupEdgeCollateralizedExposurePV = - adblNettingGroupCollateralizedExposurePV[iEdgeIndex]; - - if (0 > dblNettingGroupEdgeCollateralizedExposurePV) - adblCollateralizedNegativeExposurePV[iEdgeIndex] += - dblNettingGroupEdgeCollateralizedExposurePV; - } - } - - return adblCollateralizedNegativeExposurePV; - } - - /** - * Retrieve the Array of Uncollateralized Negative Exposures - * - * @return The Array of Uncollateralized Negative Exposures - */ - - public double[] uncollateralizedNegativeExposure() - { - int iNumEdge = vertexes().length - 1; - - int iNumNettingGroup = _aNGPA.length; - double[] adblUncollateralizedNegativeExposure = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblUncollateralizedNegativeExposure[j] = 0.; - - for (int iNettingGroupIndex = 0; iNettingGroupIndex < iNumNettingGroup; ++iNettingGroupIndex) { - double[] adblNettingGroupUncollateralizedExposure = - _aNGPA[iNettingGroupIndex].uncollateralizedExposure(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) { - double dblNettingGroupEdgeUncollateralizedExposure = - adblNettingGroupUncollateralizedExposure[iEdgeIndex]; - - if (0 > dblNettingGroupEdgeUncollateralizedExposure) - adblUncollateralizedNegativeExposure[iEdgeIndex] += - dblNettingGroupEdgeUncollateralizedExposure; - } - } - - return adblUncollateralizedNegativeExposure; - } - - /** - * Retrieve the Array of Uncollateralized Negative Exposure PV - * - * @return The Array of Uncollateralized Negative Exposure PV - */ - - public double[] uncollateralizedNegativeExposurePV() - { - int iNumEdge = vertexes().length - 1; - - int iNumNettingGroup = _aNGPA.length; - double[] adblUncollateralizedNegativeExposurePV = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblUncollateralizedNegativeExposurePV[j] = 0.; - - for (int iNettingGroupIndex = 0; iNettingGroupIndex < iNumNettingGroup; ++iNettingGroupIndex) { - double[] adblNettingGroupUncollateralizedExposurePV = - _aNGPA[iNettingGroupIndex].uncollateralizedExposurePV(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) { - double dblNettingGroupEdgeUncollateralizedExposurePV = - adblNettingGroupUncollateralizedExposurePV[iEdgeIndex]; - - if (0 > dblNettingGroupEdgeUncollateralizedExposurePV) - adblUncollateralizedNegativeExposurePV[iEdgeIndex] += - dblNettingGroupEdgeUncollateralizedExposurePV; - } - } - - return adblUncollateralizedNegativeExposurePV; - } -} diff --git a/org/drip/xva/trajectory/NettingGroupPath.java b/org/drip/xva/trajectory/NettingGroupPath.java deleted file mode 100644 index 05b19d0..0000000 --- a/org/drip/xva/trajectory/NettingGroupPath.java +++ /dev/null @@ -1,320 +0,0 @@ - -package org.drip.xva.trajectory; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * NettingGroupPath rolls up the Path Realizations of the Sequence in a Single Path Projection Run over - * Multiple Collateral Groups onto a Single Netting Group. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class NettingGroupPath { - private org.drip.xva.trajectory.CollateralGroupPath[] _aCGP = null; - - /** - * Generate a "Mono" CollateralGroupDigest Instance - * - * @param cgp The "Mono" Collateral Group Path - * - * @return The "Mono" CollateralGroupDigest Instance - */ - - public static final NettingGroupPath Mono ( - final org.drip.xva.trajectory.CollateralGroupPath cgp) - { - try { - return new org.drip.xva.trajectory.NettingGroupPath (new - org.drip.xva.trajectory.CollateralGroupPath[] {cgp}); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * NettingGroupPath Constructor - * - * @param aCGP Array of the Collateral Group Trajectory Paths - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public NettingGroupPath ( - final org.drip.xva.trajectory.CollateralGroupPath[] aCGP) - throws java.lang.Exception - { - if (null == (_aCGP = aCGP) || 0 == _aCGP.length) - throw new java.lang.Exception ("NettingGroupPath Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Array of the Collateral Group Trajectory Paths - * - * @return Array of the Collateral Group Trajectory Paths - */ - - public org.drip.xva.trajectory.CollateralGroupPath[] collateralGroupTrajectoryPaths() - { - return _aCGP; - } - - /** - * Retrieve the Array of the Vertex Dates - * - * @return The Array of the Vertex Dates - */ - - public org.drip.analytics.date.JulianDate[] vertexes() - { - org.drip.xva.trajectory.CollateralGroupEdge[] aCGE = _aCGP[0].edges(); - - int iNumVertex = aCGE.length + 1; - org.drip.analytics.date.JulianDate[] adtVertex = new org.drip.analytics.date.JulianDate[iNumVertex]; - - adtVertex[0] = aCGE[0].head().vertex(); - - for (int i = 1; i < iNumVertex; ++i) - adtVertex[i] = aCGE[i - 1].tail().vertex(); - - return adtVertex; - } - - /** - * Retrieve the Expected CVA - * - * @return The Expected CVA - */ - - public double cva() - { - double dblCVASum = 0.; - int iNumCollateralGroup = _aCGP.length; - - for (int i = 0; i < iNumCollateralGroup; ++i) - dblCVASum += _aCGP[i].credit(); - - return dblCVASum / iNumCollateralGroup; - } - - /** - * Retrieve the Expected DVA - * - * @return The Expected DVA - */ - - public double dva() - { - double dblDVASum = 0.; - int iNumCollateralGroup = _aCGP.length; - - for (int i = 0; i < iNumCollateralGroup; ++i) - dblDVASum += _aCGP[i].debt(); - - return dblDVASum / iNumCollateralGroup; - } - - /** - * Retrieve the Expected FCA - * - * @return The Expected FCA - */ - - public double fca() - { - double dblFCASum = 0.; - int iNumCollateralGroup = _aCGP.length; - - for (int i = 0; i < iNumCollateralGroup; ++i) - dblFCASum += _aCGP[i].funding(); - - return dblFCASum / iNumCollateralGroup; - } - - /** - * Retrieve the Expected Total VA - * - * @return The Expected Total VA - */ - - public double total() - { - double dblTotalSum = 0.; - int iNumCollateralGroup = _aCGP.length; - - for (int i = 0; i < iNumCollateralGroup; ++i) - dblTotalSum += _aCGP[i].total(); - - return dblTotalSum / iNumCollateralGroup; - } - - /** - * Retrieve the Array of Collateralized Exposures - * - * @return The Array of Collateralized Exposures - */ - - public double[] collateralizedExposure() - { - int iNumEdge = _aCGP[0].edges().length; - - int iNumCollateralGroup = _aCGP.length; - double[] adblCollateralizedExposure = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblCollateralizedExposure[j] = 0.; - - for (int iCollateralGroupIndex = 0; iCollateralGroupIndex < iNumCollateralGroup; - ++iCollateralGroupIndex) { - double[] adblPathCollateralizedExposure = _aCGP[iCollateralGroupIndex].collateralizedExposure(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) - adblCollateralizedExposure[iEdgeIndex] += adblPathCollateralizedExposure[iEdgeIndex]; - } - - return adblCollateralizedExposure; - } - - /** - * Retrieve the Array of Uncollateralized Exposures - * - * @return The Array of Uncollateralized Exposures - */ - - public double[] uncollateralizedExposure() - { - int iNumEdge = _aCGP[0].edges().length; - - int iNumCollateralGroup = _aCGP.length; - double[] adblUncollateralizedExposure = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblUncollateralizedExposure[j] = 0.; - - for (int iCollateralGroupIndex = 0; iCollateralGroupIndex < iNumCollateralGroup; - ++iCollateralGroupIndex) { - double[] adblPathUncollateralizedExposure = - _aCGP[iCollateralGroupIndex].uncollateralizedExposure(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) - adblUncollateralizedExposure[iEdgeIndex] += adblPathUncollateralizedExposure[iEdgeIndex]; - } - - return adblUncollateralizedExposure; - } - - /** - * Retrieve the Array of Collateralized Exposure PV's - * - * @return The Array of Collateralized Exposure PV's - */ - - public double[] collateralizedExposurePV() - { - int iNumEdge = _aCGP[0].edges().length; - - int iNumCollateralGroup = _aCGP.length; - double[] adblCollateralizedExposurePV = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblCollateralizedExposurePV[j] = 0.; - - for (int iCollateralGroupIndex = 0; iCollateralGroupIndex < iNumCollateralGroup; - ++iCollateralGroupIndex) { - double[] adblPathCollateralizedExposurePV = - _aCGP[iCollateralGroupIndex].collateralizedExposurePV(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) - adblCollateralizedExposurePV[iEdgeIndex] += adblPathCollateralizedExposurePV[iEdgeIndex]; - } - - return adblCollateralizedExposurePV; - } - - /** - * Retrieve the Array of Uncollateralized Exposure PV's - * - * @return The Array of Uncollateralized Exposure PV's - */ - - public double[] uncollateralizedExposurePV() - { - int iNumEdge = _aCGP[0].edges().length; - - int iNumCollateralGroup = _aCGP.length; - double[] adblUncollateralizedExposurePV = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblUncollateralizedExposurePV[j] = 0.; - - for (int iCollateralGroupIndex = 0; iCollateralGroupIndex < iNumCollateralGroup; - ++iCollateralGroupIndex) { - double[] adblPathUncollateralizedExposurePV = - _aCGP[iCollateralGroupIndex].uncollateralizedExposurePV(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) - adblUncollateralizedExposurePV[iEdgeIndex] += adblPathUncollateralizedExposurePV[iEdgeIndex]; - } - - return adblUncollateralizedExposurePV; - } -} diff --git a/org/drip/xva/trajectory/NettingGroupPathAggregator.java b/org/drip/xva/trajectory/NettingGroupPathAggregator.java deleted file mode 100644 index 2ecb680..0000000 --- a/org/drip/xva/trajectory/NettingGroupPathAggregator.java +++ /dev/null @@ -1,695 +0,0 @@ - -package org.drip.xva.trajectory; - -/* - * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - */ - -/*! - * Copyright (C) 2017 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. - */ - -/** - * NettingGroupPathAggregator aggregates across Multiple Path Projection Runs along the Granularity of a - * Netting Group. 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. - * - * - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90. - * - * - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the - * Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing, - * Singapore. - * - * - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk - * 21 (2) 97-102. - * - * @author Lakshmi Krishnamurthy - */ - -public class NettingGroupPathAggregator { - private org.drip.xva.trajectory.NettingGroupPath[] _aNGP = null; - - /** - * Construct a Standard NettingGroupPathAggregator Instance - * - * @param adtVertex Array of the Evolution Vertex Dates - * @param aadblPortfolioValue Array of the Portfolio Path Value Realizations - * @param aadblCollateralBalance Array of Path Collateral Balances - * @param aaCGVN Array of the GroupTrajectoryVertexNumeraire Realizations - * - * @return The Standard NettingGroupPathAggregator Instance - */ - - public static final NettingGroupPathAggregator Standard ( - final org.drip.analytics.date.JulianDate[] adtVertex, - final double[][] aadblPortfolioValue, - final double[][] aadblCollateralBalance, - final org.drip.xva.trajectory.CollateralGroupVertexNumeraire[][] aaCGVN) - { - if (null == adtVertex || null == aadblPortfolioValue || null == aadblCollateralBalance || null == - aaCGVN) - return null; - - int iNumSimulation = aadblPortfolioValue.length; - - if (0 == iNumSimulation || iNumSimulation != aadblPortfolioValue.length || iNumSimulation != - aadblCollateralBalance.length || null == aadblPortfolioValue[0] || null == - aadblCollateralBalance[0] || null == aaCGVN[0]) - return null; - - int iNumTimeStep = aadblPortfolioValue[0].length; - org.drip.xva.trajectory.CollateralGroupPath[] aCGP = 0 == iNumSimulation ? null : new - org.drip.xva.trajectory.CollateralGroupPath[iNumSimulation]; - org.drip.xva.trajectory.CollateralGroupVertex[][] aaCGV = 0 == iNumSimulation || 1 >= iNumTimeStep ? - null : new org.drip.xva.trajectory.CollateralGroupVertex[iNumSimulation][iNumTimeStep]; - - if (iNumSimulation != aaCGVN.length || 1 >= iNumTimeStep || iNumTimeStep != adtVertex.length || - iNumTimeStep != aaCGVN[0].length || iNumTimeStep != aadblCollateralBalance[0].length) - return null; - - try { - for (int i = 0; i < iNumSimulation; ++i) { - for (int j = 0; j < iNumTimeStep; ++j) - aaCGV[i][j] = new org.drip.xva.trajectory.CollateralGroupVertex (adtVertex[j], new - org.drip.xva.trajectory.CollateralGroupVertexExposure (aadblPortfolioValue[i][j], 0., - aadblCollateralBalance[i][j]), aaCGVN[i][j]); - } - - for (int i = 0; i < iNumSimulation; ++i) { - org.drip.xva.trajectory.CollateralGroupEdge[] aCGE = new - org.drip.xva.trajectory.CollateralGroupEdge[iNumTimeStep - 1]; - - for (int j = 1; j < iNumTimeStep; ++j) - aCGE[j - 1] = new org.drip.xva.trajectory.CollateralGroupEdge (aaCGV[i][j - 1], - aaCGV[i][j]); - - aCGP[i] = new org.drip.xva.trajectory.CollateralGroupPath (aCGE); - } - - if (null == aCGP) return null; - - org.drip.xva.trajectory.NettingGroupPath[] aNGP = new - org.drip.xva.trajectory.NettingGroupPath[iNumSimulation]; - - for (int i = 0; i < iNumSimulation; ++i) - aNGP[i] = org.drip.xva.trajectory.NettingGroupPath.Mono (aCGP[i]); - - return new NettingGroupPathAggregator (aNGP); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Construct a Standard NettingGroupPathAggregator Instance - * - * @param adtVertex Array of the Evolution Vertex Dates - * @param aadblPortfolioValue Array of the Portfolio Path Value Realizations - * @param aadblCollateralBalance Array of Path Collateral Balances - * @param aCGVN Array of the GroupTrajectoryVertexNumeraire Realizations - * - * @return The Standard NettingGroupPathAggregator Instance - */ - - public static final NettingGroupPathAggregator Standard ( - final org.drip.analytics.date.JulianDate[] adtVertex, - final double[][] aadblPortfolioValue, - final double[][] aadblCollateralBalance, - final org.drip.xva.trajectory.CollateralGroupVertexNumeraire[] aCGVN) - { - if (null == aadblPortfolioValue) return null; - - int iNumSimulation = aadblPortfolioValue.length; - org.drip.xva.trajectory.CollateralGroupVertexNumeraire[][] aaCGVN = 0 == iNumSimulation ? null : new - org.drip.xva.trajectory.CollateralGroupVertexNumeraire[iNumSimulation][]; - - for (int i = 0; i < iNumSimulation; ++i) - aaCGVN[i] = aCGVN; - - return Standard (adtVertex, aadblPortfolioValue, aadblCollateralBalance, aaCGVN); - } - - /** - * Construct a Standard NettingGroupPathAggregator Instance - * - * @param aCGP Array of the GroupTrajectoryPath Realizations - * - * @return The Standard NettingGroupPathAggregator Instance - */ - - public static final NettingGroupPathAggregator Standard ( - final org.drip.xva.trajectory.CollateralGroupPath[] aCGP) - { - if (null == aCGP) return null; - - int iNumNettingGroupPath = aCGP.length; - org.drip.xva.trajectory.NettingGroupPath[] aNGP = 0 == iNumNettingGroupPath ? null : new - org.drip.xva.trajectory.NettingGroupPath[iNumNettingGroupPath]; - - if (0 == iNumNettingGroupPath) return null; - - for (int i = 0; i < iNumNettingGroupPath; ++i) - aNGP[i] = org.drip.xva.trajectory.NettingGroupPath.Mono (aCGP[i]); - - try { - return new NettingGroupPathAggregator (aNGP); - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return null; - } - - /** - * NettingGroupPathAggregator Constructor - * - * @param aNGP The Array of Collateral Group Digests - * - * @throws java.lang.Exception Thrown if the Inputs are Invalid - */ - - public NettingGroupPathAggregator ( - final org.drip.xva.trajectory.NettingGroupPath[] aNGP) - throws java.lang.Exception - { - if (null == (_aNGP = aNGP) || 0 == _aNGP.length) - throw new java.lang.Exception ("NettingGroupPathAggregator Constructor => Invalid Inputs"); - } - - /** - * Retrieve the Array of the Netting Group Trajectory Paths - * - * @return The Array of the Netting Group Trajectory Paths - */ - - public org.drip.xva.trajectory.NettingGroupPath[] nettingGroupTrajectoryPaths() - { - return _aNGP; - } - - /** - * Retrieve the Array of the Vertex Dates - * - * @return The Array of the Vertex Dates - */ - - public org.drip.analytics.date.JulianDate[] vertexes() - { - return _aNGP[0].vertexes(); - } - - /** - * Retrieve the Expected CVA - * - * @return The Expected CVA - */ - - public double cva() - { - double dblCVASum = 0.; - int iNumPath = _aNGP.length; - - for (int i = 0; i < iNumPath; ++i) - dblCVASum += _aNGP[i].cva(); - - return dblCVASum / iNumPath; - } - - /** - * Retrieve the Expected DVA - * - * @return The Expected DVA - */ - - public double dva() - { - double dblDVASum = 0.; - int iNumPath = _aNGP.length; - - for (int i = 0; i < iNumPath; ++i) - dblDVASum += _aNGP[i].dva(); - - return dblDVASum / iNumPath; - } - - /** - * Retrieve the Expected FCA - * - * @return The Expected FCA - */ - - public double fca() - { - double dblFCASum = 0.; - int iNumPath = _aNGP.length; - - for (int i = 0; i < iNumPath; ++i) - dblFCASum += _aNGP[i].fca(); - - return dblFCASum / iNumPath; - } - - /** - * Retrieve the Expected Total VA - * - * @return The Expected Total VA - */ - - public double total() - { - double dblTotalSum = 0.; - int iNumPath = _aNGP.length; - - for (int i = 0; i < iNumPath; ++i) - dblTotalSum += _aNGP[i].total(); - - return dblTotalSum / iNumPath; - } - - /** - * Retrieve the Array of Collateralized Exposures - * - * @return The Array of Collateralized Exposures - */ - - public double[] collateralizedExposure() - { - int iNumEdge = _aNGP[0].vertexes().length - 1; - - int iNumPath = _aNGP.length; - double[] adblCollateralizedExposure = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblCollateralizedExposure[j] = 0.; - - for (int iPathIndex = 0; iPathIndex < iNumPath; ++iPathIndex) { - double[] adblPathCollateralizedExposure = _aNGP[iPathIndex].collateralizedExposure(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) - adblCollateralizedExposure[iEdgeIndex] += adblPathCollateralizedExposure[iEdgeIndex]; - } - - for (int j = 0; j < iNumEdge; ++j) - adblCollateralizedExposure[j] /= iNumPath; - - return adblCollateralizedExposure; - } - - /** - * Retrieve the Array of Uncollateralized Exposures - * - * @return The Array of Uncollateralized Exposures - */ - - public double[] uncollateralizedExposure() - { - int iNumEdge = _aNGP[0].vertexes().length - 1; - - int iNumPath = _aNGP.length; - double[] adblUncollateralizedExposure = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblUncollateralizedExposure[j] = 0.; - - for (int iPathIndex = 0; iPathIndex < iNumPath; ++iPathIndex) { - double[] adblPathUncollateralizedExposure = _aNGP[iPathIndex].uncollateralizedExposure(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) - adblUncollateralizedExposure[iEdgeIndex] += adblPathUncollateralizedExposure[iEdgeIndex]; - } - - for (int j = 0; j < iNumEdge; ++j) - adblUncollateralizedExposure[j] /= iNumPath; - - return adblUncollateralizedExposure; - } - - /** - * Retrieve the Array of Collateralized Exposure PV's - * - * @return The Array of Collateralized Exposure PV's - */ - - public double[] collateralizedExposurePV() - { - int iNumEdge = _aNGP[0].vertexes().length - 1; - - int iNumPath = _aNGP.length; - double[] adblCollateralizedExposurePV = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblCollateralizedExposurePV[j] = 0.; - - for (int iPathIndex = 0; iPathIndex < iNumPath; ++iPathIndex) { - double[] adblPathCollateralizedExposurePV = _aNGP[iPathIndex].collateralizedExposurePV(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) - adblCollateralizedExposurePV[iEdgeIndex] += adblPathCollateralizedExposurePV[iEdgeIndex]; - } - - for (int j = 0; j < iNumEdge; ++j) - adblCollateralizedExposurePV[j] /= iNumPath; - - return adblCollateralizedExposurePV; - } - - /** - * Retrieve the Array of Uncollateralized Exposure PV's - * - * @return The Array of Uncollateralized Exposure PV's - */ - - public double[] uncollateralizedExposurePV() - { - int iNumEdge = _aNGP[0].vertexes().length - 1; - - int iNumPath = _aNGP.length; - double[] adblUncollateralizedExposurePV = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblUncollateralizedExposurePV[j] = 0.; - - for (int iPathIndex = 0; iPathIndex < iNumPath; ++iPathIndex) { - double[] adblPathUncollateralizedExposurePV = _aNGP[iPathIndex].uncollateralizedExposurePV(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) - adblUncollateralizedExposurePV[iEdgeIndex] += adblPathUncollateralizedExposurePV[iEdgeIndex]; - } - - for (int j = 0; j < iNumEdge; ++j) - adblUncollateralizedExposurePV[j] /= iNumPath; - - return adblUncollateralizedExposurePV; - } - - /** - * Retrieve the Array of Collateralized Positive Exposures - * - * @return The Array of Collateralized Positive Exposures - */ - - public double[] collateralizedPositiveExposure() - { - int iNumEdge = _aNGP[0].vertexes().length - 1; - - int iNumPath = _aNGP.length; - double[] adblCollateralizedPositiveExposure = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblCollateralizedPositiveExposure[j] = 0.; - - for (int iPathIndex = 0; iPathIndex < iNumPath; ++iPathIndex) { - double[] adblPathCollateralizedExposure = _aNGP[iPathIndex].collateralizedExposure(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) { - double dblPathEdgeCollateralizedExposure = adblPathCollateralizedExposure[iEdgeIndex]; - - if (0 < dblPathEdgeCollateralizedExposure) - adblCollateralizedPositiveExposure[iEdgeIndex] += dblPathEdgeCollateralizedExposure; - } - } - - for (int j = 0; j < iNumEdge; ++j) - adblCollateralizedPositiveExposure[j] /= iNumPath; - - return adblCollateralizedPositiveExposure; - } - - /** - * Retrieve the Array of Collateralized Positive Exposure PV - * - * @return The Array of Collateralized Positive Exposure PV - */ - - public double[] collateralizedPositiveExposurePV() - { - int iNumEdge = _aNGP[0].vertexes().length - 1; - - int iNumPath = _aNGP.length; - double[] adblCollateralizedPositiveExposurePV = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblCollateralizedPositiveExposurePV[j] = 0.; - - for (int iPathIndex = 0; iPathIndex < iNumPath; ++iPathIndex) { - double[] adblPathCollateralizedExposurePV = _aNGP[iPathIndex].collateralizedExposurePV(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) { - double dblPathEdgeCollateralizedExposurePV = adblPathCollateralizedExposurePV[iEdgeIndex]; - - if (0 < dblPathEdgeCollateralizedExposurePV) - adblCollateralizedPositiveExposurePV[iEdgeIndex] += dblPathEdgeCollateralizedExposurePV; - } - } - - for (int j = 0; j < iNumEdge; ++j) - adblCollateralizedPositiveExposurePV[j] /= iNumPath; - - return adblCollateralizedPositiveExposurePV; - } - - /** - * Retrieve the Array of Uncollateralized Positive Exposures - * - * @return The Array of Uncollateralized Positive Exposures - */ - - public double[] uncollateralizedPositiveExposure() - { - int iNumEdge = _aNGP[0].vertexes().length - 1; - - int iNumPath = _aNGP.length; - double[] adblUncollateralizedPositiveExposure = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblUncollateralizedPositiveExposure[j] = 0.; - - for (int iPathIndex = 0; iPathIndex < iNumPath; ++iPathIndex) { - double[] adblPathUncollateralizedExposure = _aNGP[iPathIndex].uncollateralizedExposure(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) { - double dblPathEdgeUncollateralizedExposure = adblPathUncollateralizedExposure[iEdgeIndex]; - - if (0 < dblPathEdgeUncollateralizedExposure) - adblUncollateralizedPositiveExposure[iEdgeIndex] += dblPathEdgeUncollateralizedExposure; - } - } - - for (int j = 0; j < iNumEdge; ++j) - adblUncollateralizedPositiveExposure[j] /= iNumPath; - - return adblUncollateralizedPositiveExposure; - } - - /** - * Retrieve the Array of Uncollateralized Positive Exposure PV - * - * @return The Array of Uncollateralized Positive Exposure PV - */ - - public double[] uncollateralizedPositiveExposurePV() - { - int iNumEdge = _aNGP[0].vertexes().length - 1; - - int iNumPath = _aNGP.length; - double[] adblUncollateralizedPositiveExposurePV = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblUncollateralizedPositiveExposurePV[j] = 0.; - - for (int iPathIndex = 0; iPathIndex < iNumPath; ++iPathIndex) { - double[] adblPathUncollateralizedExposurePV = _aNGP[iPathIndex].uncollateralizedExposurePV(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) { - double dblPathEdgeUncollateralizedExposurePV = - adblPathUncollateralizedExposurePV[iEdgeIndex]; - - if (0 < dblPathEdgeUncollateralizedExposurePV) - adblUncollateralizedPositiveExposurePV[iEdgeIndex] += - dblPathEdgeUncollateralizedExposurePV; - } - } - - for (int j = 0; j < iNumEdge; ++j) - adblUncollateralizedPositiveExposurePV[j] /= iNumPath; - - return adblUncollateralizedPositiveExposurePV; - } - - /** - * Retrieve the Array of Collateralized Negative Exposures - * - * @return The Array of Collateralized Negative Exposures - */ - - public double[] collateralizedNegativeExposure() - { - int iNumEdge = _aNGP[0].vertexes().length - 1; - - int iNumPath = _aNGP.length; - double[] adblCollateralizedNegativeExposure = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblCollateralizedNegativeExposure[j] = 0.; - - for (int iPathIndex = 0; iPathIndex < iNumPath; ++iPathIndex) { - double[] adblPathCollateralizedExposure = _aNGP[iPathIndex].collateralizedExposure(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) { - double dblPathEdgeCollateralizedExposure = adblPathCollateralizedExposure[iEdgeIndex]; - - if (0 > dblPathEdgeCollateralizedExposure) - adblCollateralizedNegativeExposure[iEdgeIndex] += dblPathEdgeCollateralizedExposure; - } - } - - for (int j = 0; j < iNumEdge; ++j) - adblCollateralizedNegativeExposure[j] /= iNumPath; - - return adblCollateralizedNegativeExposure; - } - - /** - * Retrieve the Array of Collateralized Negative Exposure PV - * - * @return The Array of Collateralized Negative Exposure PV - */ - - public double[] collateralizedNegativeExposurePV() - { - int iNumEdge = _aNGP[0].vertexes().length - 1; - - int iNumPath = _aNGP.length; - double[] adblCollateralizedNegativeExposurePV = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblCollateralizedNegativeExposurePV[j] = 0.; - - for (int iPathIndex = 0; iPathIndex < iNumPath; ++iPathIndex) { - double[] adblPathCollateralizedExposurePV = _aNGP[iPathIndex].collateralizedExposurePV(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) { - double dblPathEdgeCollateralizedExposurePV = adblPathCollateralizedExposurePV[iEdgeIndex]; - - if (0 > dblPathEdgeCollateralizedExposurePV) - adblCollateralizedNegativeExposurePV[iEdgeIndex] += dblPathEdgeCollateralizedExposurePV; - } - } - - for (int j = 0; j < iNumEdge; ++j) - adblCollateralizedNegativeExposurePV[j] /= iNumPath; - - return adblCollateralizedNegativeExposurePV; - } - - /** - * Retrieve the Array of Uncollateralized Negative Exposures - * - * @return The Array of Uncollateralized Negative Exposures - */ - - public double[] uncollateralizedNegativeExposure() - { - int iNumEdge = _aNGP[0].vertexes().length - 1; - - int iNumPath = _aNGP.length; - double[] adblUncollateralizedNegativeExposure = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblUncollateralizedNegativeExposure[j] = 0.; - - for (int iPathIndex = 0; iPathIndex < iNumPath; ++iPathIndex) { - double[] adblPathUncollateralizedExposure = _aNGP[iPathIndex].uncollateralizedExposure(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) { - double dblPathEdgeUncollateralizedExposure = adblPathUncollateralizedExposure[iEdgeIndex]; - - if (0 > dblPathEdgeUncollateralizedExposure) - adblUncollateralizedNegativeExposure[iEdgeIndex] += dblPathEdgeUncollateralizedExposure; - } - } - - for (int j = 0; j < iNumEdge; ++j) - adblUncollateralizedNegativeExposure[j] /= iNumPath; - - return adblUncollateralizedNegativeExposure; - } - - /** - * Retrieve the Array of Uncollateralized Negative Exposure PV - * - * @return The Array of Uncollateralized Negative Exposure PV - */ - - public double[] uncollateralizedNegativeExposurePV() - { - int iNumEdge = _aNGP[0].vertexes().length - 1; - - int iNumPath = _aNGP.length; - double[] adblUncollateralizedNegativeExposurePV = new double[iNumEdge]; - - for (int j = 0; j < iNumEdge; ++j) - adblUncollateralizedNegativeExposurePV[j] = 0.; - - for (int iPathIndex = 0; iPathIndex < iNumPath; ++iPathIndex) { - double[] adblPathUncollateralizedExposurePV = _aNGP[iPathIndex].uncollateralizedExposurePV(); - - for (int iEdgeIndex = 0; iEdgeIndex < iNumEdge; ++iEdgeIndex) { - double dblPathEdgeUncollateralizedExposurePV = - adblPathUncollateralizedExposurePV[iEdgeIndex]; - - if (0 > dblPathEdgeUncollateralizedExposurePV) - adblUncollateralizedNegativeExposurePV[iEdgeIndex] += - dblPathEdgeUncollateralizedExposurePV; - } - } - - for (int j = 0; j < iNumEdge; ++j) - adblUncollateralizedNegativeExposurePV[j] /= iNumPath; - - return adblUncollateralizedNegativeExposurePV; - } -} diff --git a/org/drip/zen/algorithm/AscendingSort.java b/org/drip/zen/algorithm/AscendingSort.java deleted file mode 100644 index 3f63c7f..0000000 --- a/org/drip/zen/algorithm/AscendingSort.java +++ /dev/null @@ -1,52 +0,0 @@ - -package org.drip.zen.algorithm; - -public class AscendingSort { - - static void CompareAndSwap ( - int[] numberArray, - int leftLocation, - int rightLocation) - { - int leftNumber = numberArray[leftLocation]; - int rightNumber = numberArray[rightLocation]; - - if (leftNumber > rightNumber) - { - numberArray[leftLocation] = rightNumber; - numberArray[rightLocation] = leftNumber; - } - } - - static void BubbleMaximumToRight ( - int[] numberArray, - int rightMostLocation) - { - for (int location = 0; location <= rightMostLocation; location = location + 1) - { - CompareAndSwap (numberArray, location, location + 1); - } - } - - static void BubbleSort ( - int[] numberArray) - { - for (int sweep = numberArray.length - 2; sweep >= 0; sweep = sweep - 1) - { - BubbleMaximumToRight (numberArray, sweep); - } - } - - public static void main ( - String[] input) - { - int[] unsortedNumberArray = {6, 1, 5, 7, 2, 8, 4, 3}; - - BubbleSort (unsortedNumberArray); - - for (int i = 0; i < unsortedNumberArray.length; i = i + 1) - { - System.out.println (unsortedNumberArray[i]); - } - } -} diff --git a/org/drip/zen/algorithm/MapFunction.java b/org/drip/zen/algorithm/MapFunction.java deleted file mode 100644 index c8d89b4..0000000 --- a/org/drip/zen/algorithm/MapFunction.java +++ /dev/null @@ -1,72 +0,0 @@ - -package org.drip.zen.algorithm; - -import java.util.HashMap; - -public class MapFunction { - - static String[] states = { - "CA", - "CO", - "FL", - "MA", - "MD", - "NJ", - "NY", - "PA", - "TX", - "WA" - }; - - static String[] capitals = { - "Sacramento", - "Denver", - "Tallahasseee", - "Baltimore", - "Boston", - "Trenton", - "Albany", - "Harrisburg", - "Austin", - "Seattle" - }; - - static String StateCapital (String stateCode) { - int stateIndex = -1; - - for (int i = 0; i < states.length; i = i + 1) - { - if (states[i].equalsIgnoreCase (stateCode)) - { - stateIndex = i; - break; - } - } - - String capitalCity = capitals[stateIndex]; - return capitalCity; - } - - static HashMap StateCapitalMap() - { - HashMap capitalsMap = new HashMap(); - - for (int i = 0; i < states.length; i = i + 1) - { - capitalsMap.put (states[i], capitals[i]); - } - - return capitalsMap; - } - - public static final void main (String[] input) - { - String state = "NJ"; - - System.out.println ("\t" + state + " => " + StateCapital (state)); - - HashMap mapOfStateCapitals = StateCapitalMap(); - - System.out.println ("\t" + state + " => " + mapOfStateCapitals.get (state)); - } -} diff --git a/org/drip/zen/algorithm/MergeSort.java b/org/drip/zen/algorithm/MergeSort.java deleted file mode 100644 index 4efbc53..0000000 --- a/org/drip/zen/algorithm/MergeSort.java +++ /dev/null @@ -1,114 +0,0 @@ - -package org.drip.zen.algorithm; - -public class MergeSort { - - static void SwapLocations ( - double[] numberArray, - final int location1, - final int location2) - { - double tempNumber = numberArray[location1]; - numberArray[location1] = numberArray[location2]; - numberArray[location2] = tempNumber; - } - - static void SplitAndMerge ( - double[] numberArray, - int startLocation, - int endLocation) - { - if (startLocation == endLocation - 1) - { - if (numberArray[startLocation] > numberArray[endLocation]) - SwapLocations (numberArray, startLocation, endLocation); - - return; - } - - double[] mergedNumberArray = new double[endLocation - startLocation + 1]; - int midLocation = (startLocation + endLocation) / 2; - int rightStartLocation = midLocation + 1; - int rightLocation = rightStartLocation; - int leftStartLocation = startLocation; - int leftLocation = leftStartLocation; - int rightEndLocation = endLocation; - int leftEndLocation = midLocation; - int mergedArrayLocation = 0; - - SplitAndMerge (numberArray, leftStartLocation, leftEndLocation); - - SplitAndMerge (numberArray, rightStartLocation, rightEndLocation); - - while (leftLocation <= leftEndLocation && rightLocation <= rightEndLocation) - { - if (numberArray[leftLocation] < numberArray[rightLocation]) { - mergedNumberArray[mergedArrayLocation] = numberArray[leftLocation]; - mergedArrayLocation = mergedArrayLocation + 1; - leftLocation = leftLocation + 1; - } - else if (numberArray[leftLocation] > numberArray[rightLocation]) - { - mergedNumberArray[mergedArrayLocation] = numberArray[rightLocation]; - mergedArrayLocation = mergedArrayLocation + 1; - rightLocation = rightLocation + 1; - } - else - { - mergedNumberArray[mergedArrayLocation] = numberArray[leftLocation]; - mergedNumberArray[mergedArrayLocation] = numberArray[rightLocation]; - mergedArrayLocation = mergedArrayLocation + 1; - leftLocation = leftLocation + 1; - mergedArrayLocation = mergedArrayLocation + 1; - rightLocation = rightLocation + 1; - } - } - - while (leftLocation <= leftEndLocation) - { - mergedNumberArray[mergedArrayLocation] = numberArray[leftLocation]; - mergedArrayLocation = mergedArrayLocation + 1; - leftLocation = leftLocation + 1; - } - - while (rightLocation <= rightEndLocation) - { - mergedNumberArray[mergedArrayLocation] = numberArray[rightLocation]; - mergedArrayLocation = mergedArrayLocation + 1; - rightLocation = rightLocation + 1; - } - - mergedArrayLocation = 0; - - for (int mergedArrayLeftLocation = leftStartLocation; mergedArrayLeftLocation <= leftEndLocation; mergedArrayLeftLocation = mergedArrayLeftLocation + 1) - { - numberArray[mergedArrayLeftLocation] = mergedNumberArray[mergedArrayLocation]; - mergedArrayLocation = mergedArrayLocation + 1; - } - - for (int mergedArrayRightLocation = rightStartLocation; mergedArrayRightLocation <= rightEndLocation; mergedArrayRightLocation = mergedArrayRightLocation + 1) - { - numberArray[mergedArrayRightLocation] = mergedNumberArray[mergedArrayLocation]; - mergedArrayLocation = mergedArrayLocation + 1; - } - } - - static void SplitAndMerge ( - double[] numberArray) - { - SplitAndMerge (numberArray, 0, numberArray.length - 1); - } - - public static void main ( - String[] input) - { - double[] unsortedNumberArray = {6, 1, 5, 7, 2, 8, 4, 3}; - - SplitAndMerge (unsortedNumberArray); - - for (int i = 0; i < unsortedNumberArray.length; i = i + 1) - { - System.out.println (unsortedNumberArray[i]); - } - } -} diff --git a/org/drip/zen/algorithm/Recursion.java b/org/drip/zen/algorithm/Recursion.java deleted file mode 100644 index 0149f36..0000000 --- a/org/drip/zen/algorithm/Recursion.java +++ /dev/null @@ -1,33 +0,0 @@ - -package org.drip.zen.algorithm; - -public class Recursion { - - static int RecursiveSum (int numberToSum) - { - if (numberToSum == 1) - return 1; - - return numberToSum + RecursiveSum (numberToSum - 1); - } - - static int Fibonacci (int sequenceNumber) - { - if (sequenceNumber == 0 || sequenceNumber == 1) - return 1; - - return Fibonacci (sequenceNumber - 1) + Fibonacci (sequenceNumber - 2); - } - - public static void main (String[] inputs) - { - int number = 10; - - System.out.println ("\n\tSum of first " + number + " numbers is " + RecursiveSum (number) + "\n"); - - int fibonacciSequence = 10; - - for (int i = 0; i <= fibonacciSequence; i = i + 1) - System.out.println ("\tFibonacci[" + i + "]: " + Fibonacci (i)); - } -} diff --git a/org/drip/zen/equation/MathematicalFunction.java b/org/drip/zen/equation/MathematicalFunction.java deleted file mode 100644 index 2c3509c..0000000 --- a/org/drip/zen/equation/MathematicalFunction.java +++ /dev/null @@ -1,17 +0,0 @@ - -package org.drip.zen.equation; - -public class MathematicalFunction { - - public static double QuadraticExpression (double a, double b, double c, double x) - { - double expressionValue = a * x * x + b * x + c; - return expressionValue; - } - - public static double TrigonometricExpression (double sum, double x) - { - double functionValue = Math.cos (x) + Math.sin (x) - sum; - return functionValue; - } -} diff --git a/org/drip/zen/equation/Quadratic.java b/org/drip/zen/equation/Quadratic.java deleted file mode 100644 index ec08827..0000000 --- a/org/drip/zen/equation/Quadratic.java +++ /dev/null @@ -1,50 +0,0 @@ - -package org.drip.zen.equation; - -/* - * 1) a, b, c - * 2) Constructor - * 3) Retrieve a, b, c - * 4) Find Roots - * 5) Introduce concept of NULL - */ - -public class Quadratic { - private double _a; - private double _b; - private double _c; - - public Quadratic (double a, double b, double c) - { - _a = a; - _b = b; - _c = c; - } - - public double a() - { - return _a; - } - - public double b() - { - return _b; - } - - public double c() - { - return _c; - } - - public double[] findRoots() - { - double bSquaredMinus4ac = _b * _b - 4 * _a * _c; - - if (bSquaredMinus4ac < 0) return null; - - double[] roots = new double[2]; - roots[0] = (-1. * _b + Math.sqrt (bSquaredMinus4ac)) / (2 * _a); - roots[1] = (-1. * _b - Math.sqrt (bSquaredMinus4ac)) / (2 * _a); - return roots; - } -} diff --git a/org/drip/zen/equation/Solver.java b/org/drip/zen/equation/Solver.java deleted file mode 100644 index aff93f4..0000000 --- a/org/drip/zen/equation/Solver.java +++ /dev/null @@ -1,116 +0,0 @@ - -package org.drip.zen.equation; - -/* - * 1) x^2 - 5*x - 50 = 0 - * 2) Factorize and Find out Roots - * 3) Quadratic Equation and find out Roots - * 4) Walk Through and Illustrate the Bisection Root Search Algorithm - * 5) Code Sketch - * 6) Execute and Test Results - * 7) Function Class f(x) = y - * 8) cos x + sin x = 1.2 - * 9) Execute and Test Results - * 10) Secant Method - */ - -public class Solver { - - public static double PositiveQuadraticSolution (double a, double b, double c) - { - double xLeft = 0.; - double xRight = 100.; - double closenessMatch = 0.0000001; - double xRootGuess = 0.5 * (xLeft + xRight); - - double functionValue = MathematicalFunction.QuadraticExpression (a, b, c, xRootGuess); - - while (Math.abs (functionValue) > closenessMatch) - { - if (functionValue > 0.) - { - xRight = xRootGuess; - } else if (functionValue < 0.) - { - xLeft = xRootGuess; - } - - xRootGuess = 0.5 * (xLeft + xRight); - - functionValue = MathematicalFunction.QuadraticExpression (a, b, c, xRootGuess); - } - - return xRootGuess; - } - - public static double NegativeQuadraticSolution (double a, double b, double c) - { - double xLeft = -100.; - double xRight = 0.; - double closenessMatch = 0.0000001; - double xRootGuess = 0.5 * (xLeft + xRight); - - double functionValue = MathematicalFunction.QuadraticExpression (a, b, c, xRootGuess); - - while (Math.abs (functionValue) > closenessMatch) - { - if (functionValue < 0.) - { - xRight = xRootGuess; - } else if (functionValue > 0.) - { - xLeft = xRootGuess; - } - - xRootGuess = 0.5 * (xLeft + xRight); - - functionValue = MathematicalFunction.QuadraticExpression (a, b, c, xRootGuess); - } - - return xRootGuess; - } - - public static double PositiveTrigonometricSolution (double sum) - { - double xLeft = 0.; - double xRight = 0.25 * Math.PI; - double closenessMatch = 0.0000001; - double xRootGuess = 0.5 * (xLeft + xRight); - - double functionValue = MathematicalFunction.TrigonometricExpression (sum, xRootGuess); - - while (Math.abs (functionValue) > closenessMatch) - { - if (functionValue > 0.) - { - xRight = xRootGuess; - } else if (functionValue < 0.) - { - xLeft = xRootGuess; - } - - xRootGuess = 0.5 * (xLeft + xRight); - - functionValue = MathematicalFunction.TrigonometricExpression (sum, xRootGuess); - } - - return xRootGuess; - } - - public static void main (String[] input) - { - double positiveQuadraticRoot = PositiveQuadraticSolution (1, -5, -50); - - System.out.println ("Positive Quadratic Root " + positiveQuadraticRoot); - - double negativeQuadraticRoot = NegativeQuadraticSolution (1, -5, -50); - - System.out.println ("Negative Quadratic Root " + negativeQuadraticRoot); - - double positiveTrigonometricRoot = PositiveTrigonometricSolution (1.2); - - System.out.println ("Positive Trigonometric Root (Radians) " + positiveTrigonometricRoot); - - System.out.println ("Positive Trigonometric Root (Degrees) " + positiveTrigonometricRoot * 180. / Math.PI); - } -} diff --git a/org/drip/zen/geometry/Circle2D.java b/org/drip/zen/geometry/Circle2D.java deleted file mode 100644 index 71216f3..0000000 --- a/org/drip/zen/geometry/Circle2D.java +++ /dev/null @@ -1,257 +0,0 @@ - -package org.drip.zen.geometry; - -import org.drip.zen.equation.Quadratic; - -/* - * Circle2D - * - * 1) Instance Fields - center and radius - * 2) Get the fields - * 3) Calculate Area - * 4) Calculate Perimeter - * 5) Closest Distance to a Point - * 6) Do they Overlap - * 7) Do they Touch - * 8) Distance between a Line and the Circle - * 9) Does Line intersect the Circle - * 10) Point inside Circle - * 11) Intersection Between Circle and Line - * 12) Concept of Intersection - satisfy equations of both line AND circle - * 13) Derive the Quadratic Equations - * 14) Formulate them and encode them - * 15) Solve for them - * 16) Translate Circles - 20 Match 2016 #1 - * 17) Angle Extended at Origin - 20 March 2016 #7 - * 17) Tangents to Circle - Formulation + Conception - 20 March 2016 #8 - * 18) Tangential Points - Implementation - 20 March 2016 #9 - * 19) Bring it together - 20 March 2016 #10 - */ - -public class Circle2D { - private Point2D _center; - private double _radius; - - public Circle2D (Point2D center, double radius) - { - _center = center; - _radius = radius; - } - - public Point2D getCenter() - { - return _center; - } - - public double getRadius() - { - return _radius; - } - - public double area() - { - double circleArea = Math.PI * _radius * _radius; - return circleArea; - } - - public double perimeter() - { - double circumference = 2. * Math.PI * _radius; - return circumference; - } - - public boolean overlap (Circle2D anotherCircle) - { - double centerX1 = _center.getX(); - double centerY1 = _center.getY(); - double centerX2 = anotherCircle.getCenter().getX(); - double centerY2 = anotherCircle.getCenter().getY(); - double radius1 = getRadius(); - double radius2 = anotherCircle.getRadius(); - - double distanceBetweenCenters = Math.sqrt ((centerX1 - centerX2) * (centerX1 - centerX2) + (centerY1 - centerY2) * (centerY1 - centerY2)); - - boolean circlesIntersect = false; - - if (distanceBetweenCenters < radius1 + radius2) - circlesIntersect = true; - else - circlesIntersect = false; - - return circlesIntersect; - } - - public boolean touch (Circle2D anotherCircle) - { - double centerX1 = _center.getX(); - double centerY1 = _center.getY(); - double centerX2 = anotherCircle.getCenter().getX(); - double centerY2 = anotherCircle.getCenter().getY(); - double radius1 = getRadius(); - double radius2 = anotherCircle.getRadius(); - - double distanceBetweenCenters = Math.sqrt ((centerX1 - centerX2) * (centerX1 - centerX2) + (centerY1 - centerY2) * (centerY1 - centerY2)); - - boolean circlesTouch = false; - - if (distanceBetweenCenters == radius1 + radius2) - circlesTouch = true; - else - circlesTouch = false; - - return circlesTouch; - } - - public double distanceToLine (Line2D line) - { - Line2D perpendicularLine = line.perpendicularLineAtPoint (getCenter()); - - Point2D intersectingPoint = line.intersection (perpendicularLine); - - double distance = intersectingPoint.distanceBetweenPoints (getCenter()); - - return distance; - } - - public boolean linePassesThrough (Line2D line) - { - double distanceBetweenLineAndCenter = distanceToLine (line); - - boolean linePassesThroughTheCircle = false; - - if (distanceBetweenLineAndCenter < getRadius()) - linePassesThroughTheCircle = true; - else - linePassesThroughTheCircle = false; - - return linePassesThroughTheCircle; - } - - public boolean inside (Point2D p) - { - boolean inside = false; - - double distanceFromCenter = p.distanceBetweenPoints (getCenter()); - - if (distanceFromCenter < getRadius()) - inside = true; - else - inside = false; - - return inside; - } - - public Point2D[] intersections (Line2D l) - { - double x1 = _center.getX(); - double y1 = _center.getY(); - double r = _radius; - - double m = l.slope(); - double b = l.yIntercept(); - - double quadraticA = 1 + m * m; - double quadraticB = -2 * x1 + 2 * m * b - 2 * m * y1; - double quadraticC = x1 * x1 + b * b - 2 * b * y1 + y1 * y1 - r * r; - - Quadratic quad = new Quadratic (quadraticA, quadraticB, quadraticC); - - double[] intersectionX = quad.findRoots(); - - if (null == intersectionX) return null; - - Point2D[] intersectingPoints = new Point2D[2]; - intersectingPoints[0] = new Point2D (intersectionX[0], l.YFromX (intersectionX[0])); - intersectingPoints[1] = new Point2D (intersectionX[1], l.YFromX (intersectionX[1])); - return intersectingPoints; - } - - /* - * Added 20 March 2016 - */ - - public boolean translate (double xAmount, double yAmount) - { - return _center.translate (xAmount, yAmount); - } - - public double angleAtOrigin() - { - double distanceFromCenterToOrigin = _center.distanceFromOrigin(); - - double originAngle = Math.asin (_radius / distanceFromCenterToOrigin); - - return originAngle; - } - - public Point2D[] tangentsFromOrigin() - { - double centerAngleAtOrigin = _center.angleAtOrigin() * Math.PI / 180.; - - double circleAngleAtOrigin = angleAtOrigin(); - - double tangentDistanceFromOrigin = _radius / Math.sin (centerAngleAtOrigin); - - double angleAbove = centerAngleAtOrigin + circleAngleAtOrigin; - double angleBelow = centerAngleAtOrigin - circleAngleAtOrigin; - - Point2D[] tangentPoints = new Point2D[2]; - - tangentPoints[0] = Point2D.MakeFromPolar (tangentDistanceFromOrigin, angleAbove); - - tangentPoints[1] = Point2D.MakeFromPolar (tangentDistanceFromOrigin, angleBelow); - - return tangentPoints; - } - - /* - * Done Adding 20 March 2016 - */ - - public static void main (String[] args) - { - Point2D myCenter = new Point2D (0, 0); - double myRadius = 1; - Circle2D myCircle = new Circle2D (myCenter, myRadius); - - Line2D myLine = new Line2D (1, 0); - - Point2D[] circleLineIntersections = myCircle.intersections (myLine); - - circleLineIntersections[0].printCoordinate(); - - circleLineIntersections[1].printCoordinate(); - - /* - * Added 20 March 2016 - */ - - Point2D anotherCenter = new Point2D (5, 5); - double anotherRadius = 1; - Circle2D anotherCircle = new Circle2D (anotherCenter, anotherRadius); - - Point2D[] tangentialPoints = anotherCircle.tangentsFromOrigin(); - - System.out.println(); - - System.out.println ("\tCenter Angle At Origin: " + anotherCircle._center.angleAtOrigin()); - - System.out.println ("\tCircle Angle At Origin: " + anotherCircle.angleAtOrigin()); - - System.out.println(); - - tangentialPoints[0].printCoordinate(); - - tangentialPoints[1].printCoordinate(); - - System.out.println(); - - tangentialPoints[0].printPolarCoordinate(); - - tangentialPoints[1].printPolarCoordinate(); - - /* - * Done Adding 20 March 2016 - */ - } -} diff --git a/org/drip/zen/geometry/Line2D.java b/org/drip/zen/geometry/Line2D.java deleted file mode 100644 index efc6f64..0000000 --- a/org/drip/zen/geometry/Line2D.java +++ /dev/null @@ -1,155 +0,0 @@ - -package org.drip.zen.geometry; - -/* - * 1) Slope Intercept Form - * 2) Construction from slope and intercept - * 3) Construction from 2 Points - * 4) Construction From Slope and Point - * 5) Accessors - * 6) Y from X - * 7) X From Y - * 8) Parallel Line - * 9) Perpendicular Line - * 10) Intersection Between Lines - */ - -public class Line2D { - private double _m = 0.; - private double _b = 0.; - - public Line2D (double m, double b) - { - _m = m; - _b = b; - } - - public Line2D (Point2D p1, Point2D p2) - { - double x1 = p1.getX(); - double x2 = p2.getX(); - double y1 = p1.getY(); - double y2 = p2.getY(); - - _m = (y2 - y1) / (x2 - x1); - - _b = y2 - _m * x2; - } - - public Line2D (double m, Point2D p2) - { - double x2 = p2.getX(); - double y2 = p2.getY(); - - _m = m; - _b = y2 - _m * x2; - } - - public double slope() - { - return _m; - } - - public double yIntercept() - { - return _b; - } - - public void show() - { - System.out.println ("Slope: " + _m + "; Intercept: " + _b); - } - - public double YFromX (double x) - { - double y = _m * x + _b; - return y; - } - - public double XFromY (double y) - { - double x = (y - _b) / _m; - return x; - } - - public Line2D parallelLineAtPoint (Point2D p) - { - Line2D parallelLine = new Line2D (_m, p); - - return parallelLine; - } - - public Line2D perpendicularLineAtPoint (Point2D p) - { - Line2D perpendicularLine = new Line2D (-1 / _m, p); - - return perpendicularLine; - } - - public Point2D intersection (Line2D lineOther) - { - double b1 = yIntercept(); - double b2 = lineOther.yIntercept(); - double m1 = slope(); - double m2 = lineOther.slope(); - - double xIntersection = -1 * (b2 - b1) / (m2 - m1); - double yIntersection = m1 * xIntersection + b1; - - Point2D pointIntersection = new Point2D (xIntersection, yIntersection); - - return pointIntersection; - } - - public static void main (String[] args) - { - double mySlope = 1; - double myIntercept = 2; - - Line2D myFirstLine = new Line2D (mySlope, myIntercept); - - myFirstLine.show(); - - Point2D point1 = new Point2D (1, 3); - - Point2D point2 = new Point2D (4, 6); - - Line2D mySecondLine = new Line2D (point1, point2); - - mySecondLine.show(); - - Line2D myThirdLine = new Line2D (mySlope, point2); - - myThirdLine.show(); - - double x1 = 1; - - double y1 = myThirdLine.YFromX (x1); - - System.out.println ("Y From = " + x1 + " is " + y1); - - double y2 = 1; - - double x2 = myThirdLine.XFromY (y2); - - System.out.println ("X From Y = " + y2 + " is " + x2); - - Point2D linePoint = new Point2D (6, 12); - - Line2D parallelLine = myThirdLine.parallelLineAtPoint (linePoint); - - parallelLine.show(); - - Line2D perpendicularLine = myThirdLine.parallelLineAtPoint (linePoint); - - perpendicularLine.show(); - - Line2D firstLine = new Line2D (new Point2D (0, 0), new Point2D (1, 1)); - - Line2D secondLine = new Line2D (new Point2D (1, 1), new Point2D (2, 0)); - - Point2D pIntersect = firstLine.intersection (secondLine); - - pIntersect.printCoordinate(); - } -} diff --git a/org/drip/zen/geometry/Point2D.java b/org/drip/zen/geometry/Point2D.java deleted file mode 100644 index 4019327..0000000 --- a/org/drip/zen/geometry/Point2D.java +++ /dev/null @@ -1,180 +0,0 @@ - -package org.drip.zen.geometry; - -/* - * 1) Motivation behind Class - Structure and Function - * 2) x/y fields and printing them - * 3) Invocation of the Class - Creation of the Class Instance - * 4) Adding a method - set to Origin - * 5) Add the Constructor with fields - * 6) Member Fields with an underscore - * 7) Distance from Origin - * 8) Angle with X axis at Origin - * 9) Degrees to Radians Conversion - * 10) Quadrant - * 11) Degrees to Radian with the Qudrant Assignment - * 12) Distance From Another Point - * 13) Translate the Points - 20 March 2016 #2 - * 14) Polar Coordinate Representation - 20 March 2016 #3 - * 15) Sketch the Problem Solution - 20 March 2016 #4 - * 16) Point from Polar Coordinates - 20 March 2016 #5 - * 17) Introducing the static Constructor - 20 March 2016 #6 - */ - -public class Point2D { - private double _x = -1.; - private double _y = -1.; - - /* - * Added 20 March 2016 - */ - - public static Point2D MakeFromPolar (double r, double angle) - { - double x = r * Math.cos (angle); - - double y = r * Math.sin (angle); - - Point2D p = new Point2D (x, y); - - return p; - } - - /* - * Done Adding 20 March 2016 - */ - - Point2D (double x, double y) - { - _x = x; - _y = y; - } - - public double getX() - { - return _x; - } - - public double getY() - { - return _y; - } - - void printCoordinate() - { - System.out.println ("\t[" + _x + ", " + _y + "]"); - } - - void resetToOrigin() - { - _x = 0.; - _y = 0.; - } - - double distanceFromOrigin() - { - double distance = Math.sqrt (_x * _x + _y * _y); - - return distance; - } - - double distanceBetweenPoints (Point2D anotherPoint) - { - double x1 = _x; - double y1 = _y; - double x2 = anotherPoint._x; - double y2 = anotherPoint._y; - - double distance = Math.sqrt ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); - - return distance; - } - - public double angleAtOrigin() - { - double adjustedAngleAtOrigin = 0.; - double angleAtOriginTan = _y / _x; - - double unadjustedAngleAtOrigin = Math.atan (angleAtOriginTan); - - if (_x > 0 && _y > 0) - adjustedAngleAtOrigin = unadjustedAngleAtOrigin; - else if (_x < 0 && _y > 0) - adjustedAngleAtOrigin = unadjustedAngleAtOrigin + Math.PI; - else if (_x < 0 && _y < 0) - adjustedAngleAtOrigin = unadjustedAngleAtOrigin + Math.PI; - else if (_x > 0 && _y < 0) - adjustedAngleAtOrigin = unadjustedAngleAtOrigin + 2. * Math.PI; - else if (_x > 0 && _y < 0) - adjustedAngleAtOrigin = 0.; - - return adjustedAngleAtOrigin * 180. / Math.PI; - } - - String quadrant() - { - String region; - - if (_x > 0 && _y > 0) - region = "UPPER RIGHT"; - else if (_x < 0 && _y > 0) - region = "UPPER LEFT"; - else if (_x < 0 && _y < 0) - region = "LOWER LEFT"; - else if (_x > 0 && _y < 0) - region = "LOWER RIGHT"; - else - region = "ORIGIN"; - - return region; - } - - /* - * Added 20 March 2016 - */ - - public boolean translate (double xShift, double yShift) - { - _x = _x + xShift; - _y = _y + yShift; - return true; - } - - void printPolarCoordinate() - { - System.out.println ("\t[" + distanceFromOrigin() + ", " + angleAtOrigin() + "]"); - } - - /* - * Done Adding On 20 March 2016 - */ - - public static void main (String[] args) - { - Point2D myPoint = new Point2D (2., 3.); - - myPoint.printCoordinate(); - - myPoint._x = 1; - myPoint._y = 1; - - myPoint.printCoordinate(); - - myPoint.resetToOrigin(); - - myPoint.printCoordinate(); - - System.out.println ("\tDistance From Origin: " + myPoint.distanceFromOrigin()); - - Point2D secondPoint = new Point2D (3., 4.); - - System.out.println ("\tDistance Between Points: " + myPoint.distanceBetweenPoints (secondPoint)); - - myPoint._x = 2; - myPoint._y = -2; - - System.out.println ("\tAngle at Origin: " + myPoint.angleAtOrigin()); - - System.out.println ("\tQuadrant: " + myPoint.quadrant()); - } -} diff --git a/org/drip/zen/grid/ServiceProxy.java b/org/drip/zen/grid/ServiceProxy.java deleted file mode 100644 index 66a5c9f..0000000 --- a/org/drip/zen/grid/ServiceProxy.java +++ /dev/null @@ -1,71 +0,0 @@ - -package org.drip.zen.grid; - -public class ServiceProxy { - private int _iServerPort = -1; - private java.net.Socket _socket = null; - private java.lang.String _strServerIPAddress = ""; - - public ServiceProxy ( - final java.lang.String strServerIPAddress, - final int iServerPort) - throws java.lang.Exception - { - _socket = new java.net.Socket (_strServerIPAddress = strServerIPAddress, _iServerPort = iServerPort); - - System.out.println ("[Client] => The Client connected to " + _strServerIPAddress + "/" + _iServerPort); - } - - public int serverPort() - { - return _iServerPort; - } - - public java.lang.String serverIPAddress() - { - return _strServerIPAddress; - } - - public boolean request ( - final java.lang.String strMessage) - { - try { - java.io.OutputStream outputStream = _socket.getOutputStream(); - - java.io.PrintWriter pw = new java.io.PrintWriter (outputStream, true); - - pw.write (strMessage + "\n"); - - pw.flush(); - - java.io.InputStream inputStream = _socket.getInputStream(); - - java.io.InputStreamReader inputReader = new java.io.InputStreamReader (inputStream); - - java.io.BufferedReader bufferedReader = new java.io.BufferedReader (inputReader); - - java.lang.String response = bufferedReader.readLine(); - - System.out.println ("[Client] => " + response); - - return false; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return true; - } - - public static final void main ( - final java.lang.String[] astrInput) - throws java.lang.Exception - { - String server = "127.0.0.1"; - int listenerPort = 9090; - String sampleMessage = "Hi How are you doing?"; - - ServiceProxy sc = new ServiceProxy (server, listenerPort); - - sc.request (sampleMessage); - } -} diff --git a/org/drip/zen/grid/ServiceRequest.java b/org/drip/zen/grid/ServiceRequest.java deleted file mode 100644 index 854c7c3..0000000 --- a/org/drip/zen/grid/ServiceRequest.java +++ /dev/null @@ -1,102 +0,0 @@ - -package org.drip.zen.grid; - -import java.time.Instant; -import java.util.Date; -import java.util.UUID; - -public class ServiceRequest { - private UUID _id = null; - private Date _timeStamp = null; - private String _type = ""; - private String _body = ""; - - public static ServiceRequest CreateFromString ( - String request) - { - String[] requestFields = request.split ("@"); - - return new ServiceRequest ( - UUID.fromString (requestFields[0]), - Date.from (Instant.ofEpochMilli (Long.parseLong (requestFields[1]))), - requestFields[2], - requestFields[3] - ); - } - - public static ServiceRequest Create ( - String type, - String body) - { - return new ServiceRequest ( - UUID.randomUUID(), - new Date(), - type, - body - ); - } - - public ServiceRequest ( - UUID id, - Date timeStamp, - String type, - String body) - { - _id = id; - _type = type; - _body = body; - _timeStamp = timeStamp; - } - - public UUID id() - { - return _id; - } - - public Date timeStamp() - { - return _timeStamp; - } - - public String type() - { - return _type; - } - - public String body() - { - return _body; - } - - public String display() - { - return _id.toString() + "|" + _timeStamp.toString() + "|" + _type + "|" + _body; - } - - public String toString() - { - return _id.toString() + "@" + _timeStamp.toInstant().toEpochMilli() + "@" + _type + "@" + _body; - } - - public static void main ( - String[] input) - { - String serviceType = "SSRN"; - String serviceInput = "JQP"; - - ServiceRequest sr = ServiceRequest.Create ( - serviceType, - serviceInput - ); - - System.out.println (sr.display()); - - String serviceRequestString = sr.toString(); - - System.out.println (serviceRequestString); - - ServiceRequest srUnpack = ServiceRequest.CreateFromString (serviceRequestString); - - System.out.println (srUnpack.display()); - } -} diff --git a/org/drip/zen/grid/ServiceSkeleton.java b/org/drip/zen/grid/ServiceSkeleton.java deleted file mode 100644 index 4842147..0000000 --- a/org/drip/zen/grid/ServiceSkeleton.java +++ /dev/null @@ -1,75 +0,0 @@ - -package org.drip.zen.grid; - -/* - * 1) Server Class Abstraction Purpose (notion of a State Machine) - * 2) Port Number Field / Instance Field Conventions - * 3) Constructor - * 4) Coding Conventions - * 5) "final" Keyword - * 6) Full Package Names - * 7) Exception's - Introduction and Usage - * 8) Class Instance Member Access - */ - -public class ServiceSkeleton { - private int _iListenerPort = -1; - private java.net.ServerSocket _ssListener = null; - - public ServiceSkeleton ( - final int iListenerPort) - throws java.lang.Exception - { - _ssListener = new java.net.ServerSocket (_iListenerPort = iListenerPort); - } - - public int listenerPort() - { - return _iListenerPort; - } - - public boolean processRequest() - { - try { - java.net.Socket s = _ssListener.accept(); - - System.out.println ("[Server] => Received a Connection from Client " + s); - - java.io.InputStream inputStream = s.getInputStream(); - - java.io.InputStreamReader inputReader = new java.io.InputStreamReader (inputStream); - - java.io.BufferedReader bufferedReader = new java.io.BufferedReader (inputReader); - - java.lang.String request = bufferedReader.readLine(); - - System.out.println ("[Server] => " + request); - - java.io.OutputStream outputStream = s.getOutputStream(); - - java.io.PrintWriter pw = new java.io.PrintWriter (outputStream, true); - - pw.write ("I am OK - looks like our sockets talked to each other\n"); - - pw.flush(); - - return true; - } catch (java.lang.Exception e) { - e.printStackTrace(); - } - - return false; - } - - public static void main ( - final java.lang.String[] astrInput) - throws java.lang.Exception - { - int listenerPort = 9090; - - ServiceSkeleton ss = new ServiceSkeleton (listenerPort); - - while (true) - ss.processRequest(); - } -} diff --git a/org/drip/zen/grid/SocketSample.java b/org/drip/zen/grid/SocketSample.java deleted file mode 100644 index 6be26b9..0000000 --- a/org/drip/zen/grid/SocketSample.java +++ /dev/null @@ -1,102 +0,0 @@ - -package org.drip.zen.grid; - -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.PrintWriter; -import java.net.ServerSocket; -import java.net.Socket; - -/** - * 1) Review of IP Addresses, Port Number, Ping Command, Router, Gateway/Router. - * 2) Client/Server Run Through Song and Dance - Slow Detail. - * 3) Server Startup - Bind to Port. Caveats. - * 4) Client Startup, and Connection to Server. - * 5) Server Acceptance of a Connection and ready to Process it. - * 6) Client then sends Server a Message. - * 7) Server reads it, sends Client a Response. - * 8) Both Client and Server display the Message. - * 9) Passing "Client"/"Server" Arguments into the "Main". - * 10) Running this in a Command Line. - * - * @author Spooky - */ - -public class SocketSample { - - @SuppressWarnings ("resource") static void RunServer (int listenerPort) - throws Exception - { - ServerSocket mySocketListener = new ServerSocket (listenerPort); - - System.out.println ("[Server] => The Server is listening on port " + listenerPort); - - while (true) { - Socket s = mySocketListener.accept(); - - System.out.println ("[Server] => Received a Connection from Client " + s); - - InputStream inputStream = s.getInputStream(); - - InputStreamReader inputReader = new InputStreamReader (inputStream); - - BufferedReader bufferedReader = new BufferedReader (inputReader); - - java.lang.String request = bufferedReader.readLine(); - - System.out.println ("[Server] => " + request); - - OutputStream outputStream = s.getOutputStream(); - - PrintWriter pw = new PrintWriter (outputStream, true); - - pw.write ("I am OK - looks like our sockets talked to each other\n"); - - pw.flush(); - } - } - - @SuppressWarnings ("resource") static void RunClient (String serverAddress, int serverPort, String message) - throws Exception - { - Socket clientSocket = new Socket (serverAddress, serverPort); - - System.out.println ("[Client] => The Client connected to " + serverAddress + "/" + serverPort); - - OutputStream outputStream = clientSocket.getOutputStream(); - - PrintWriter pw = new PrintWriter (outputStream, true); - - pw.write (message + "\n"); - - pw.flush(); - - InputStream inputStream = clientSocket.getInputStream(); - - InputStreamReader inputReader = new InputStreamReader (inputStream); - - BufferedReader bufferedReader = new BufferedReader (inputReader); - - java.lang.String response = bufferedReader.readLine(); - - System.out.println ("[Client] => " + response); - } - - public static final void main (String[] inputArray) - throws Exception - { - String server = "127.0.0.1"; - int listenerPort = 9090; - String sampleMessage = "Hi How are you doing?"; - - String command = inputArray[0]; - - if (command.equalsIgnoreCase ("SERVER")) - RunServer (listenerPort); - - if (command.equalsIgnoreCase ("CLIENT")) - RunClient (server, listenerPort, sampleMessage); - } -} diff --git a/org/drip/zen/juice/ArraysAndRandomNumbers.java b/org/drip/zen/juice/ArraysAndRandomNumbers.java deleted file mode 100644 index 32db635..0000000 --- a/org/drip/zen/juice/ArraysAndRandomNumbers.java +++ /dev/null @@ -1,82 +0,0 @@ - -package org.drip.zen.juice; - -/* - * 1) Concept of Random Number - * 2) Generate a Random Number between 0 and 1 - * 3) Concept of evenly distributed Random Number between Left and Right - * 4) Generate a Random Number between "Lower Bound" and "Upper Bound" - * 5) Concept of an Array - syntax and Usage - * 6) Generate an Array of bounded Random Numbers - * 7) Concept of Distribution of Buckets - */ - -public class ArraysAndRandomNumbers { - - static double RandomNumber0_1() - { - return Math.random(); - } - - static double RandomNumber (double lowerBound, double upperBound) - { - double randomNumber = lowerBound + (upperBound - lowerBound) * RandomNumber0_1(); - - return randomNumber; - } - - static double[] RandomNumberArray (double lowerBound, double upperBound, int arraySize) - { - double[] randomArray = new double[arraySize]; - - for (int counter = 0; counter < arraySize; counter = counter + 1) - { - randomArray[counter] = RandomNumber (lowerBound, upperBound); - } - - return randomArray; - } - - static int[] QuartileDistribution (double lowerBound, double upperBound, double[] randomNumberArray) - { - int numberOfBuckets = 4; - int[] quartileBuckets = new int[numberOfBuckets]; - int arraySize = randomNumberArray.length; - double bucketWidth = (upperBound - lowerBound) / numberOfBuckets; - - for (int counter = 0; counter < arraySize; counter = counter + 1) - { - double randomNumber = randomNumberArray[counter]; - - if (randomNumber >= lowerBound && randomNumber < lowerBound + bucketWidth) - quartileBuckets[0] = quartileBuckets[0] + 1; - else if (randomNumber >= lowerBound + bucketWidth && randomNumber < lowerBound + 2 * bucketWidth) - quartileBuckets[1] = quartileBuckets[1] + 1; - else if (randomNumber >= lowerBound + 2 * bucketWidth && randomNumber < lowerBound + 3 * bucketWidth) - quartileBuckets[2] = quartileBuckets[2] + 1; - else if (randomNumber >= lowerBound + 3 * bucketWidth && randomNumber <= upperBound) - quartileBuckets[3] = quartileBuckets[3] + 1; - } - - return quartileBuckets; - } - - public static void main (String[] input) - { - double myLowerBound = 0; - double myUpperBound = 100; - int myArraySize = 100000; - - double[] myRandomNumberArray = RandomNumberArray (myLowerBound, myUpperBound, myArraySize); - - int[] myQuartileBuckets = QuartileDistribution (myLowerBound, myUpperBound, myRandomNumberArray); - - System.out.println ("\tFirst Quartile : " + myQuartileBuckets[0] + " | " + (100. * myQuartileBuckets[0] / myArraySize) + "%"); - - System.out.println ("\tSecond Quartile : " + myQuartileBuckets[1] + " | " + (100. * myQuartileBuckets[1] / myArraySize) + "%"); - - System.out.println ("\tThird Quartile : " + myQuartileBuckets[2] + " | " + (100. * myQuartileBuckets[2] / myArraySize) + "%"); - - System.out.println ("\tFourth Quartile : " + myQuartileBuckets[3] + " | " + (100. * myQuartileBuckets[3] / myArraySize) + "%"); - } -} diff --git a/org/drip/zen/juice/Conditional.java b/org/drip/zen/juice/Conditional.java deleted file mode 100644 index 7007ef8..0000000 --- a/org/drip/zen/juice/Conditional.java +++ /dev/null @@ -1,119 +0,0 @@ - -package org.drip.zen.juice; - -/* - * 1) Odd/Even - * 2) Simple Vowel/Consonant Variants - * 4) Hot/Cold/Comfortable - * 5) Grades Table - */ - -public class Conditional { - - public static boolean IsOdd (int number) - { - boolean odd = false; - - if (number % 2 == 0) - odd = false; - else - odd = true; - - return odd; - } - - public static boolean IsVowel (char alphabet) - { - boolean vowel = false; - - if (alphabet == 'a' || alphabet == 'e' || alphabet == 'i' || alphabet == 'o' || alphabet == 'u') - vowel = true; - else - vowel = false; - - return vowel; - } - - public static boolean IsVowel2 (char alphabet) - { - boolean vowel = false; - - if (alphabet == 'a' || alphabet == 'e' || alphabet == 'i' || alphabet == 'o' || alphabet == 'u' || alphabet == 'A' || alphabet == 'E' || alphabet == 'I' || alphabet == 'O' || alphabet == 'U') - vowel = true; - else - vowel = false; - - return vowel; - } - - public static String HotColdComfortable (double temperature) - { - String hotColdComfortable; - - if (temperature < 55) - hotColdComfortable = "TOO COLD"; - else if (temperature > 85) - hotColdComfortable = "TOO HOT"; - else - hotColdComfortable = "JUST RIGHT"; - - return hotColdComfortable; - } - - public static String Grade (double numberGrade) - { - String letterGrade; - - if (numberGrade >= 95) - letterGrade = "A"; - else if (numberGrade >= 85 && numberGrade < 95) - letterGrade = "B"; - else if (numberGrade >= 75 && numberGrade < 85) - letterGrade = "C"; - else if (numberGrade >= 65 && numberGrade < 75) - letterGrade = "D"; - else if (numberGrade >= 55 && numberGrade < 65) - letterGrade = "E"; - else - letterGrade = "F"; - - return letterGrade; - } - - public static final void main (String[] args) - { - int firstNumber = 33; - - boolean isFirstNumberOdd = IsOdd (firstNumber); - - System.out.println ("\t" + firstNumber + " is Odd? " + isFirstNumberOdd); - - char firstAlphabet = 'o'; - - boolean isFirstAlphabetVowel = IsVowel (firstAlphabet); - - System.out.println ("\t" + firstAlphabet + " is Vowel? " + isFirstAlphabetVowel); - - char secondAlphabet = 'O'; - - boolean isSecondAlphabetVowel = IsVowel (secondAlphabet); - - System.out.println ("\tFirst Try: " + secondAlphabet + " is Vowel? " + isSecondAlphabetVowel); - - boolean isSecondAlphabetVowel2 = IsVowel2 (secondAlphabet); - - System.out.println ("\tSecond Try: " + secondAlphabet + " is Vowel? " + isSecondAlphabetVowel2); - - double temperature = 75; - - String temperatureFeeling = HotColdComfortable (temperature); - - System.out.println ("\t" + temperature + " is " + temperatureFeeling); - - double score = 93; - - String scoreGrade = Grade (score); - - System.out.println ("\tGrade for " + score + " is " + scoreGrade); - } -} diff --git a/org/drip/zen/juice/FileProcessing.java b/org/drip/zen/juice/FileProcessing.java deleted file mode 100644 index cf5abbb..0000000 --- a/org/drip/zen/juice/FileProcessing.java +++ /dev/null @@ -1,148 +0,0 @@ - -package org.drip.zen.juice; - -import java.io.BufferedReader; -import java.io.FileReader; - -/* - * 1) Number of lines in the file - * 2) Read the File into a String Array - * 3) Count the Number of Words in a Single Line - * 4) Count the Number Words across the full File - * 5) Display the File Contents - * 6) Some Notes on Error Handling - * 7) Exercise - Count the Number of Instances of Occurrence of a Word (example, Romeo) - * 8) Exercise - Find out the Line that has the most Occurrence of the given Word - */ - -public class FileProcessing { - - static int NumberOfLinesInFile (String fullFileName) - throws Exception - { - String line = ""; - int numberOfLines = 1; - boolean stopReading = false; - - BufferedReader reader = new BufferedReader (new FileReader (fullFileName)); - - while (stopReading == false) - { - line = reader.readLine(); - - if (line == null) - { - stopReading = true; - } - else - { - numberOfLines = numberOfLines + 1; - } - } - - reader.close(); - - return numberOfLines; - } - - static String[] ReadFile (String fullFileName) - throws Exception - { - int numberOfLinesToRead = NumberOfLinesInFile (fullFileName); - - String[] fileLines = new String[numberOfLinesToRead]; - - String line = ""; - int lineNumber = 0; - boolean stopReading = false; - - BufferedReader reader = new BufferedReader (new FileReader (fullFileName)); - - while (stopReading == false) - { - line = reader.readLine(); - - if (line == null) - stopReading = true; - else - { - fileLines[lineNumber] = line; - lineNumber = lineNumber + 1; - } - } - - reader.close(); - - return fileLines; - } - - static int WordCount (String singleLine) - { - if (singleLine == null) - { - return 0; - } - - int count = 1; - - for (int letterIndex = 0; letterIndex < singleLine.length(); letterIndex = letterIndex + 1) - { - char letter = singleLine.charAt (letterIndex); - - if (letter == ' ') - { - count = count + 1; - } - } - - return count; - } - - static String[] Words (String singleLine) - { - if (singleLine == null) - { - return null; - } - - String[] wordsInLine = singleLine.split (" "); - - return wordsInLine; - } - - public static final void main (String[] input) - throws Exception - { - String fileLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TextMiner\\RomeoAndJuliet.txt"; - - int fileLineCount = NumberOfLinesInFile (fileLocation); - - String[] fileContents = ReadFile (fileLocation); - - int totalWords = 0; - - for (int i = 0; i < fileLineCount; i = i + 1) - { - String currentLine = fileContents[i]; - - int numberOfWordsInCurrentLine = WordCount (currentLine); - - totalWords = totalWords + numberOfWordsInCurrentLine; - - String[] wordsInCurrentLine = Words (currentLine); - - String wordDump = ""; - - for (int j = 0; j < numberOfWordsInCurrentLine; j = j + 1) - { - wordDump = wordDump + wordsInCurrentLine[j] + ","; - } - - System.out.println (wordDump); - } - - System.out.println ("\tNumber of Lines in File: " + fileLineCount); - - System.out.println ("\tNumber of Words in File: " + totalWords); - } -} diff --git a/org/drip/zen/juice/FileProcessingMap.java b/org/drip/zen/juice/FileProcessingMap.java deleted file mode 100644 index a56f201..0000000 --- a/org/drip/zen/juice/FileProcessingMap.java +++ /dev/null @@ -1,257 +0,0 @@ - -package org.drip.zen.juice; - -import java.io.BufferedReader; -import java.io.FileReader; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Set; -import java.util.TreeMap; - -public class FileProcessingMap { - - static int NumberOfLinesInFile (String fullFileName) - throws Exception - { - String line = ""; - int numberOfLines = 1; - boolean stopReading = false; - - BufferedReader reader = new BufferedReader (new FileReader (fullFileName)); - - while (stopReading == false) { - line = reader.readLine(); - - if (line == null) { - stopReading = true; - } else { - numberOfLines = numberOfLines + 1; - } - } - - reader.close(); - - return numberOfLines; - } - - static String[] ReadFile (String fullFileName) - throws Exception - { - int numberOfLinesToRead = NumberOfLinesInFile (fullFileName); - - String[] fileLines = new String[numberOfLinesToRead]; - - String line = ""; - int lineNumber = 0; - boolean stopReading = false; - - BufferedReader reader = new BufferedReader (new FileReader (fullFileName)); - - while (stopReading == false) { - line = reader.readLine(); - - if (line == null) - stopReading = true; - else { - fileLines[lineNumber] = line; - lineNumber = lineNumber + 1; - } - } - - reader.close(); - - return fileLines; - } - - static int WordCount (String singleLine) - { - if (singleLine == null) - { - return 0; - } - - int count = 1; - - for (int letterIndex = 0; letterIndex < singleLine.length(); letterIndex = letterIndex + 1) - { - char letter = singleLine.charAt (letterIndex); - - if (letter == ' ') - { - count = count + 1; - } - } - - return count; - } - - static String[] Words (String singleLine) - { - if (singleLine == null) - { - return null; - } - - String[] wordsInLine = singleLine.split (" "); - - return wordsInLine; - } - - static void AddWordToCountMap (String singleLine, HashMap wordCountMap) - { - String[] wordArray = Words (singleLine); - - if (wordArray == null) - { - return; - } - - for (int j = 0; j < wordArray.length; j = j + 1) - { - String thisWord = wordArray[j]; - - if (wordCountMap.containsKey (thisWord)) { - int wordOccurrances = wordCountMap.get (thisWord); - - wordCountMap.put (thisWord, wordOccurrances + 1); - } else { - wordCountMap.put (thisWord, 1); - } - } - } - - static TreeMap CountToWordMap (HashMap wordToCountMap) - { - TreeMap counterToWordsMap = new TreeMap(); - - Set wordSet = wordToCountMap.keySet(); - - for (String word : wordSet) - { - counterToWordsMap.put (wordToCountMap.get (word), word); - } - - return counterToWordsMap; - } - - /* - * Begin Added 7 May 2016 - */ - - static TreeMap> CountToWordArrayMap (HashMap wordToCountMap) - { - TreeMap> counterToWordArrayMap = new TreeMap>(); - - Set wordSet = wordToCountMap.keySet(); - - for (String word : wordSet) - { - int wordCount = wordToCountMap.get (word); - - if (counterToWordArrayMap.containsKey (wordCount)) - { - Set countedWordSet = counterToWordArrayMap.get (wordCount); - - countedWordSet.add (word); - - counterToWordArrayMap.put (wordCount, countedWordSet); - } - else - { - Set countedWordSet = new HashSet(); - - countedWordSet.add (word); - - counterToWordArrayMap.put (wordCount, countedWordSet); - } - } - - return counterToWordArrayMap; - } - - /* - * End Added 7 May 2016 - */ - - public static final void main (String[] input) - throws Exception - { - String fileLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Feeds\\TextMiner\\RomeoAndJuliet.txt"; - - int fileLineCount = NumberOfLinesInFile (fileLocation); - - String[] fileContents = ReadFile (fileLocation); - - int totalWords = 0; - - HashMap wordToCountMap = new HashMap(); - - for (int i = 0; i < fileLineCount; i = i + 1) - { - String currentLine = fileContents[i]; - - int numberOfWordsInCurrentLine = WordCount (currentLine); - - totalWords = totalWords + numberOfWordsInCurrentLine; - - String[] wordsInCurrentLine = Words (currentLine); - - String wordDump = ""; - - AddWordToCountMap (currentLine, wordToCountMap); - - for (int j = 0; j < numberOfWordsInCurrentLine; j = j + 1) - { - wordDump = wordDump + wordsInCurrentLine[j] + ","; - } - - System.out.println (wordDump); - } - - System.out.println ("\tNumber of Lines in File: " + fileLineCount); - - System.out.println ("\tNumber of Words in File: " + totalWords); - - /* Set wordSet = wordToCountMap.keySet(); - - for (String word : wordSet) - { - System.out.println ("\t\t[" + word + "] => " + wordToCountMap.get (word)); - } */ - - /* - * Begin Added 7 May 2016 - */ - - TreeMap wordCounterMap = CountToWordMap (wordToCountMap); - - Set wordCounterSet = wordCounterMap.descendingKeySet(); - - for (int wordCount : wordCounterSet) - { - System.out.println ("\t\t[" + wordCount + "] => '" + wordCounterMap.get (wordCount) + "'"); - } - - TreeMap> wordCountSetMap = CountToWordArrayMap (wordToCountMap); - - Set wordSetCountSet = wordCountSetMap.descendingKeySet(); - - for (int wordSetCount : wordSetCountSet) - { - String counterLineToPrint = "\t\t[" + wordSetCount + "] =>"; - - Set countedWordSet = wordCountSetMap.get (wordSetCount); - - for (String countedWord : countedWordSet) - { - counterLineToPrint = counterLineToPrint + " '" + countedWord + "' |"; - } - - System.out.println (counterLineToPrint); - } - - /* - * End Added 7 May 2016 - */ - } -} diff --git a/org/drip/zen/juice/GeometryFunctions.java b/org/drip/zen/juice/GeometryFunctions.java deleted file mode 100644 index e5f0aae..0000000 --- a/org/drip/zen/juice/GeometryFunctions.java +++ /dev/null @@ -1,140 +0,0 @@ - -package org.drip.zen.juice; - -/* - * 1) Area of a Square - * 2) Perimeter of a Square - * 3) Area of a Rectangle - * 4) Perimeter of a Rectangle - * 5) Area of a Circle - * 6) Circumference of a Circle - * 7) Distance of a Point to Origin - * 8) Distance between 2 Points - * 9) Sum to first n Numbers - * 10) Sum from n to m Numbers - */ - -public class GeometryFunctions { - - public static final double AreaOfSquare (double length) - { - double area = length * length; - return area; - } - - public static final double PerimeterOfSquare (double length) - { - double perimeter = 2 * length; - return perimeter; - } - - public static final double AreaOfRectangle (double length, double breadth) - { - double area = length * breadth; - return area; - } - - public static final double PerimeterOfRectangle (double length, double breadth) - { - double perimeter = length + breadth; - return perimeter; - } - - public static final double AreaOfCircle (double radius) - { - double area = Math.PI * radius * radius; - return area; - } - - public static final double PerimeterOfCircle (double radius) - { - double perimeter = 2. * Math.PI * radius; - return perimeter; - } - - public static final double DistanceToOrigin (double x, double y) - { - double distance = Math.sqrt (x * x + y * y); - return distance; - } - - public static final double DistanceBetweenPoints (double x1, double y1, double x2, double y2) - { - double distance = Math.sqrt ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); - return distance; - } - - public static final double SumToN (double n) - { - double sum = n * (n + 1) / 2; - return sum; - } - - public static final double SumFromNToM (double n, double m) - { - double sumToN = SumToN (n); - double sumToM = SumToN (m); - return sumToM - sumToN; - } - - public static void main (String[] args) - { - double squareLength = 6.46; - - double squareArea = AreaOfSquare (squareLength); - double squarePerimeter = PerimeterOfSquare (squareLength); - - System.out.println ("Square Length: " + squareLength); - System.out.println ("\tArea: " + squareArea + "; Perimeter: " + squarePerimeter); - - double rectangleLength = 6.46; - double rectangleBreadth = 6.46; - - double rectangleArea = AreaOfRectangle (rectangleLength, rectangleBreadth); - double rectanglePerimeter = PerimeterOfRectangle (rectangleLength, rectangleBreadth); - - System.out.println ("Rectangle Length: " + rectangleLength + "; Breadth: " + rectangleBreadth); - System.out.println ("\tArea: " + rectangleArea + "; Perimeter: " + rectanglePerimeter); - - double circleRadius = 6.46; - - double circleArea = AreaOfCircle (circleRadius); - double circlePerimeter = PerimeterOfCircle (circleRadius); - - System.out.println ("Circle Radius: " + circleRadius); - System.out.println ("\tArea: " + circleArea + "; Perimeter: " + circlePerimeter); - - double xCoordinate = 3; - double yCoordinate = 4; - - double distanceFromOrigin = DistanceToOrigin (xCoordinate, yCoordinate); - - System.out.println ("Point: [" + xCoordinate + ", " + yCoordinate + "]"); - System.out.println ("\tDistance From Origin: " + distanceFromOrigin); - - double xCoordinate1 = 3; - double yCoordinate1 = 4; - double xCoordinate2 = 27; - double yCoordinate2 = 11; - - double distance12 = DistanceBetweenPoints (xCoordinate1, yCoordinate1, xCoordinate2, yCoordinate2); - - System.out.println ("Points: [" + xCoordinate1 + ", " + yCoordinate1 + "] AND [" + xCoordinate2 + ", " + yCoordinate2 + "]"); - System.out.println ("\tDistance Between Points: " + distance12); - - double number = 5; - - double sumOfFirstN = SumToN (number); - - System.out.println ("Number: " + number); - System.out.println ("\tSum of First Numbers: " + sumOfFirstN); - - double numberN = 5; - double numberM = 10; - - double sumBetweenNumbers = SumFromNToM (numberN, numberM); - - System.out.println ("Numbers: " + numberN + " => " + numberM); - System.out.println ("\tSum Between Numbers: " + sumBetweenNumbers); - } -} diff --git a/org/drip/zen/juice/Loops.java b/org/drip/zen/juice/Loops.java deleted file mode 100644 index 16a4671..0000000 --- a/org/drip/zen/juice/Loops.java +++ /dev/null @@ -1,177 +0,0 @@ - -package org.drip.zen.juice; - -/* - * 1) Sum Using WHILE Loop - * 2) Sum Using FOR Loop - * 3) Factorial Using WHILE Loop - * 4) Factorial Using FOR Loop - * 5) Counting the letters in a word - * 6) Counting vowels in a word - * 7) Counting consonants in a word - * 8) Counting words in a sentence - */ - -public class Loops { - - static double SumUsingWhileLoop (double firstNumber, double lastNumber) - { - double sum = 0; - double counter = firstNumber; - - while (counter <= lastNumber) - { - sum = sum + counter; - counter = counter + 1; - } - - return sum; - } - - static double SumUsingForLoop (double firstNumber, double lastNumber) - { - double sum = 0; - - for (double counter = firstNumber; counter <= lastNumber; counter = counter + 1) - { - sum = sum + counter; - } - - return sum; - } - - static double FactorialUsingWhileLoop (double lastNumber) - { - double factorial = 1; - double counter = 1; - - while (counter <= lastNumber) - { - factorial = factorial * counter; - counter = counter + 1; - } - - return factorial; - } - - static double FactorialUsingForLoop (double lastNumber) - { - double factorial = 1; - - for (double counter = 1; counter <= lastNumber; counter = counter + 1) - { - factorial = factorial * counter; - } - - return factorial; - } - - static int WordSize (String word) - { - char[] letters = word.toCharArray(); - - int size = letters.length; - return size; - } - - static int VowelCount (String word) - { - int size = WordSize (word); - - int numberOfVowels = 0; - - for (int counter = 0; counter < size; counter = counter + 1) - { - char letter = word.charAt (counter); - - if (letter == 'a' || letter == 'e' || letter == 'i' || letter == 'o' || letter == 'u') - { - numberOfVowels = numberOfVowels + 1; - } - } - - return numberOfVowels; - } - - static int ConsonantCount (String word) - { - int size = WordSize (word); - - int numberOfConsonants = 0; - - for (int counter = 0; counter < size; counter = counter + 1) - { - char letter = word.charAt (counter); - - if (letter == 'b' || letter == 'c' || letter == 'd' || letter == 'f' || letter == 'g' || letter == 'h' || letter == 'j' || - letter == 'k' || letter == 'l' || letter == 'm' || letter == 'n' || letter == 'p' || letter == 'q' || letter == 'r' || - letter == 's' || letter == 't' || letter == 'v' || letter == 'w' || letter == 'x' || letter == 'y' || letter == 'z') - { - numberOfConsonants = numberOfConsonants + 1; - } - } - - return numberOfConsonants; - } - - static int WordCount (String sentence) - { - int size = WordSize (sentence); - - int numberOfWords = 1; - - for (int counter = 0; counter < size; counter = counter + 1) - { - char letter = sentence.charAt (counter); - - if (letter == ' ') - { - numberOfWords = numberOfWords + 1; - } - } - - return numberOfWords; - } - - public static void main (String[] arguments) - { - double beginNumber = 1; - double endNumber = 10; - - double sumWithWHILEStatement = SumUsingWhileLoop (beginNumber, endNumber); - - System.out.println ("\tSum with WHILE KeyWord : " + sumWithWHILEStatement); - - double sumWithFORStatement = SumUsingForLoop (beginNumber, endNumber); - - System.out.println ("\tSum with FOR KeyWord : " + sumWithFORStatement); - - double factorialWithWHILEStatement = FactorialUsingWhileLoop (endNumber); - - System.out.println ("\tFactorial with WHILE KeyWord : " + factorialWithWHILEStatement); - - double factorialWithFORStatement = FactorialUsingForLoop (endNumber); - - System.out.println ("\tFactorial with FOR KeyWord : " + factorialWithFORStatement); - - String bigWord = "totalitarianism"; - - int bigWordSize = WordSize (bigWord); - - System.out.println ("\tSize of " + bigWord + " is " + bigWordSize); - - int vowelsInBigWord = VowelCount (bigWord); - - System.out.println ("\tNumber of Vowels in " + bigWord + " is " + vowelsInBigWord); - - int consonantsInBigWord = ConsonantCount (bigWord); - - System.out.println ("\tNumber of Consonants in " + bigWord + " is " + consonantsInBigWord); - - String bigSentence = "He who pays the piper calls the tune."; - - int wordsInBigSentence = WordCount (bigSentence); - - System.out.println ("\tNumber of Words in '" + bigSentence + "' is " + wordsInBigSentence); - } -} diff --git a/org/drip/zen/juice/PiEstimator.java b/org/drip/zen/juice/PiEstimator.java deleted file mode 100644 index 64ee2ad..0000000 --- a/org/drip/zen/juice/PiEstimator.java +++ /dev/null @@ -1,97 +0,0 @@ - -package org.drip.zen.juice; - -/* - * 1) Introduce Probability - * 2) Motivate the Lesson - * 3) Outline the Approach - * 4) Write Down the Formula - * 5) Random Numbers Between -1 and 1 - * 6) Is Inside Circle - * 7) Count of Inside Circle - * 8) Probability To PI - * 9) Generate Random Numbers - * 10) Bring them all together - */ - -public class PiEstimator { - - static double RandomNumber() - { - double random = Math.random(); - - double randomBetweenMinus1AndPlus1 = 2. * random - 1; - - return randomBetweenMinus1AndPlus1; - } - - static boolean IsPointInsideCircle (double x, double y) - { - double distanceFromOrigin = Math.sqrt (x * x + y * y); - - boolean insideCircle = false; - - if (distanceFromOrigin < 1.) - { - insideCircle = true; - } - else - { - insideCircle = false; - } - - return insideCircle; - } - - static double InsideCircleCount (double[] xArray, double[] yArray) - { - double numberInsideCircle = 0.; - int numberOfPoints = xArray.length; - - for (int counter = 0; counter < numberOfPoints; counter = counter + 1) - { - if (IsPointInsideCircle (xArray[counter], yArray[counter])) - { - numberInsideCircle = numberInsideCircle + 1; - } - } - - return numberInsideCircle; - } - - static double ProbabilityToPI (double probability) - { - double pi = 4. * probability; - return pi; - } - - public static void main (String[] input) - { - int totalNumberOfPoints = 10000000; - - double[] xPoints = new double[totalNumberOfPoints]; - double[] yPoints = new double[totalNumberOfPoints]; - - for (int pointCounter = 0; pointCounter < totalNumberOfPoints; pointCounter = pointCounter + 1) - { - xPoints[pointCounter] = RandomNumber(); - yPoints[pointCounter] = RandomNumber(); - } - - double pointsInsideCircle = InsideCircleCount (xPoints, yPoints); - - double probabilityOfPointsInsideCircle = pointsInsideCircle / totalNumberOfPoints; - - double estimatedPI = ProbabilityToPI (probabilityOfPointsInsideCircle); - - System.out.println ("\tNumber of Points Inside Square : " + totalNumberOfPoints); - - System.out.println ("\tNumber of Points Inside Circle : " + pointsInsideCircle); - - System.out.println ("\tProbability Of Points in a Circle : " + probabilityOfPointsInsideCircle); - - System.out.println ("\tEstimated PI : " + estimatedPI); - - System.out.println ("\tActual PI : " + Math.PI); - } -} diff --git a/org/drip/zen/juice/StringFunctions.java b/org/drip/zen/juice/StringFunctions.java deleted file mode 100644 index 6e4ee74..0000000 --- a/org/drip/zen/juice/StringFunctions.java +++ /dev/null @@ -1,156 +0,0 @@ - -package org.drip.zen.juice; - -/* - * 1) What we've seen so far - Functions, Conditionals, Loops - * 2) Primitive Data Types Review - * 3) More involved Objects - Strings - Collection of Letters side by side - example - * 4) Display the Letters in a String - * 5) Vowels Count - * 6) Consonant Count - * 7) Word Count - * 8) Word Containment - Describe - * 9) Word Containment - Step Through - * 10) Word Containment - Edge Cases - */ - -public class StringFunctions { - - static void DisplayLetters (String word) - { - char[] letters = word.toCharArray(); - - int wordSize = letters.length; - - for (int i = 0; i < wordSize; i = i + 1) - { - System.out.println (letters[i]); - } - } - - static int VowelCount (String word) - { - char[] letters = word.toCharArray(); - - int wordSize = letters.length; - int numberOfVowels = 0; - - for (int i = 0; i < wordSize; i = i + 1) - { - char alphabet = letters[i]; - - if (alphabet == 'a' || alphabet == 'e' || alphabet == 'i' || alphabet == 'o' || alphabet == 'u') - { - numberOfVowels = numberOfVowels + 1; - } - } - - return numberOfVowels; - } - - static int ConsonantCount (String word) - { - char[] letters = word.toCharArray(); - - int wordSize = letters.length; - int numberOfVowels = 0; - - for (int i = 0; i < wordSize; i = i + 1) - { - char alphabet = letters[i]; - - if (alphabet == 'b' || alphabet == 'c' || alphabet == 'd' || alphabet == 'f' || alphabet == 'g' || alphabet == 'h' || - alphabet == 'j' || alphabet == 'k' || alphabet == 'l' || alphabet == 'm' || alphabet == 'n' || alphabet == 'p' || - alphabet == 'q' || alphabet == 'r' || alphabet == 's' || alphabet == 't' || alphabet == 'v' || alphabet == 'w' || - alphabet == 'x' || alphabet == 'y' || alphabet == 'z') - { - numberOfVowels = numberOfVowels + 1; - } - } - - return numberOfVowels; - } - - static int WordCount (String sentence) - { - char[] letters = sentence.toCharArray(); - - int sentenceSize = letters.length; - int numberOfWords = 1; - - for (int i = 0; i < sentenceSize; i = i + 1) - { - char alphabet = letters[i]; - - if (alphabet == ' ') - { - numberOfWords = numberOfWords + 1; - } - } - - return numberOfWords; - } - - public static boolean SecondWordInFirst (String firstWord, String secondWord) - { - char[] firstWordLetters = firstWord.toCharArray(); - - int firstWordSize = firstWordLetters.length; - - char[] secondWordLetters = secondWord.toCharArray(); - - int secondWordSize = secondWordLetters.length; - - // if (firstWordSize < secondWordSize) return false; - - boolean secondInsideFirst = false; - - for (int firstWordCounter = 0; firstWordCounter <= firstWordSize - secondWordSize; firstWordCounter = firstWordCounter + 1) - { - int numberofLettersMatch = 0; - - for (int secondWordCounter = 0; secondWordCounter < secondWordSize; secondWordCounter = secondWordCounter + 1) - { - if (firstWordLetters[firstWordCounter + secondWordCounter] == secondWordLetters[secondWordCounter]) - { - numberofLettersMatch = numberofLettersMatch + 1; - } - } - - if (numberofLettersMatch == secondWordSize) - { - secondInsideFirst = true; - } - } - - return secondInsideFirst; - } - - public static void main (String[] input) - { - String myWord = "elephant"; - - DisplayLetters (myWord); - - int vowelsInWord = VowelCount (myWord); - - System.out.println ("\tNumber of Vowels in '" + myWord + "' : " + vowelsInWord); - - int consonantsInWord = ConsonantCount (myWord); - - System.out.println ("\tNumber of Consonants in '" + myWord + "': " + consonantsInWord); - - String mySentence = "he who pays the piper plays the tune"; - - int wordsInSentence = WordCount (mySentence); - - System.out.println ("\tNumber of Words in '" + mySentence + "': " + wordsInSentence); - - String myFirstWord = "bold"; - String mySecondWord = "old"; - - boolean isSecondInsideFirst = SecondWordInFirst (myFirstWord, mySecondWord); - - System.out.println ("\tIs '" + mySecondWord + "' in '" + myFirstWord + "'? " + isSecondInsideFirst); - } -} diff --git a/org/drip/zen/linearalgebra/Matrix2D.java b/org/drip/zen/linearalgebra/Matrix2D.java deleted file mode 100644 index 0a87ec2..0000000 --- a/org/drip/zen/linearalgebra/Matrix2D.java +++ /dev/null @@ -1,70 +0,0 @@ - -package org.drip.zen.linearalgebra; - -/* - * 1) Purpose, Continuity, Production Project to Show-case - * 2) Sketch out a 2D Matrix - * 3) Solve it on the Board - * 4) Review the Steps - * 5) Left/Right Construction Review => M.X = I.Y - * 6) Symbolically Work it out - * 7) Matrix2D Class Overview - * 8) Note on Naming Convention - * 9) Javadoc Generation and Review - */ - -public class Matrix2D { - private double[] _adblRHS = null; - private double[][] _aadblCoefficient = null; - - public Matrix2D ( - final double[][] aadblCoefficient, - final double[] adblRHS) - throws java.lang.Exception - { - if (null == (_aadblCoefficient = aadblCoefficient) || null == (_adblRHS = adblRHS)) - throw new java.lang.Exception ("Matrix2D Constructor => Invalid Inputs"); - } - - public double[][] coefficients() - { - return _aadblCoefficient; - } - - public double[] rhs() - { - return _adblRHS; - } - - public double[] solve() - { - double dblDeterminant = _aadblCoefficient[0][0] * _aadblCoefficient[1][1] - _aadblCoefficient[0][1] * - _aadblCoefficient[1][0]; - return new double[] {(_adblRHS[0] * _aadblCoefficient[1][1] - _adblRHS[1] * _aadblCoefficient[0][1]) / - dblDeterminant, (_adblRHS[1] * _aadblCoefficient[0][0] - _adblRHS[0] * _aadblCoefficient[1][0]) / - dblDeterminant}; - } - - public static final void main ( - final String[] input) - throws Exception - { - double[][] aadblCoefficientExample = new double[][] { - {1., 2.}, - {2., 1.} - }; - double[] adblRHSExample = new double[] { - 5., - 4. - }; - - Matrix2D m = new Matrix2D ( - aadblCoefficientExample, - adblRHSExample - ); - - double[] adblSolution = m.solve(); - - System.out.println (adblSolution[0] + " | " + adblSolution[1]); - } -} diff --git a/org/drip/zen/numbers/NumberArray.java b/org/drip/zen/numbers/NumberArray.java deleted file mode 100644 index c6c80dc..0000000 --- a/org/drip/zen/numbers/NumberArray.java +++ /dev/null @@ -1,27 +0,0 @@ - -package org.drip.zen.numbers; - -public class NumberArray { - - public static int Maximum (int[] numbers) - { - int maximum = Integer.MIN_VALUE; - - int numberOfNumbers = numbers.length; - - for (int numberArrayCounter = 0; numberArrayCounter < numberOfNumbers; numberArrayCounter = numberArrayCounter + 1) - { - if (numbers[numberArrayCounter] > maximum) - maximum = numbers[numberArrayCounter]; - } - - return maximum; - } - - public static void main (String[] args) - { - int[] myNumbers = {1, 6, 4, 9, 12, 5, 25, 17}; - - System.out.println ("\tMaximum is " + Maximum (myNumbers)); - } -} diff --git a/org/drip/zen/numbers/RandomNumberBucket.java b/org/drip/zen/numbers/RandomNumberBucket.java deleted file mode 100644 index d2af0b5..0000000 --- a/org/drip/zen/numbers/RandomNumberBucket.java +++ /dev/null @@ -1,71 +0,0 @@ - -package org.drip.zen.numbers; - -public class RandomNumberBucket { - - public static double CalculatePercentage (int count, int total) - { - double percent = 100. * (double) count / (double) total; - return percent; - } - - public static int FindBucketIndex (double number) - { - int bucketIndex = 0; - - if (number > 0 && number <= 0.2) - bucketIndex = 0; - else if (number > 0.2 && number <= 0.4) - bucketIndex = 1; - else if (number > 0.4 && number <= 0.6) - bucketIndex = 2; - else if (number > 0.6 && number <= 0.8) - bucketIndex = 3; - else if (number > 0.8 && number <= 1.0) - bucketIndex = 4; - - return bucketIndex; - } - - public static void main (String[] args) - { - int countbucket0 = 0; - int countbucket1 = 0; - int countbucket2 = 0; - int countbucket3 = 0; - int countbucket4 = 0; - - int totalTrials = 1000; - int trialNumber = 1; - - while (trialNumber <= totalTrials) - { - double randomNumber = Math.random(); - - int randomNumberBucket = FindBucketIndex (randomNumber); - - if (randomNumberBucket == 0) - countbucket0 = countbucket0 + 1; - else if (randomNumberBucket == 1) - countbucket1 = countbucket1 + 1; - else if (randomNumberBucket == 2) - countbucket2 = countbucket2 + 1; - else if (randomNumberBucket == 3) - countbucket3 = countbucket3 + 1; - else if (randomNumberBucket == 4) - countbucket4 = countbucket4 + 1; - - trialNumber = trialNumber + 1; - } - - System.out.println ("\t[" + countbucket0 + " | " + countbucket1 + " | " + countbucket2 + " | " + countbucket3 + " | " + countbucket4 + "]"); - - System.out.println ("\t[" + - CalculatePercentage (countbucket0, totalTrials) + "% | " + - CalculatePercentage (countbucket1, totalTrials) + "% | " + - CalculatePercentage (countbucket2, totalTrials) + "% | " + - CalculatePercentage (countbucket3, totalTrials) + "% | " + - CalculatePercentage (countbucket4, totalTrials) + "%]" - ); - } -} diff --git a/org/drip/zen/numbers/RandomNumberBucketArray.java b/org/drip/zen/numbers/RandomNumberBucketArray.java deleted file mode 100644 index 03a561d..0000000 --- a/org/drip/zen/numbers/RandomNumberBucketArray.java +++ /dev/null @@ -1,62 +0,0 @@ - -package org.drip.zen.numbers; - -public class RandomNumberBucketArray { - - public static double CalculatePercentage (int count, int total) - { - double percent = 100. * (double) count / (double) total; - return percent; - } - - public static int FindBucketIndex (double number, int totalBuckets) - { - int bucketIndex = 0; - double bucketWidth = 1. / totalBuckets; - - for (int i = 0; i < totalBuckets; i = i + 1) { - double bucketLeftEnd = i * bucketWidth; - double bucketRightEnd = (i + 1) * bucketWidth; - - if (number > bucketLeftEnd && number <= bucketRightEnd) - bucketIndex = i; - } - - return bucketIndex; - } - - public static void main (String[] args) - { - int numberOfBuckets = 10; - - int[] countbucket = new int[numberOfBuckets]; - - int totalTrials = 10000; - int trialNumber = 1; - - while (trialNumber <= totalTrials) - { - double randomNumber = Math.random(); - - int randomNumberBucket = FindBucketIndex (randomNumber, numberOfBuckets); - - countbucket[randomNumberBucket] = countbucket[randomNumberBucket] + 1; - - trialNumber = trialNumber + 1; - } - - String countString = "\t| "; - - for (int i = 0; i < numberOfBuckets; i = i + 1) - countString = countString + countbucket[i] + " | "; - - System.out.println (countString); - - String countPercentString = "\t| "; - - for (int i = 0; i < numberOfBuckets; i = i + 1) - countPercentString = countPercentString + CalculatePercentage (countbucket[i], totalTrials) + "% | "; - - System.out.println (countPercentString); - } -} diff --git a/org/drip/zen/text/WordProcessing.java b/org/drip/zen/text/WordProcessing.java deleted file mode 100644 index b124930..0000000 --- a/org/drip/zen/text/WordProcessing.java +++ /dev/null @@ -1,162 +0,0 @@ - -package org.drip.zen.text; - -public class WordProcessing { - - public static boolean IsVowel ( - char alphabet) - { - boolean isVowel = false; - - if (alphabet == 'a' || alphabet == 'A') - isVowel = true; - - if (alphabet == 'e' || alphabet == 'E') - isVowel = true; - - if (alphabet == 'i' || alphabet == 'I') - isVowel = true; - - if (alphabet == 'o' || alphabet == 'O') - isVowel = true; - - if (alphabet == 'u' || alphabet == 'U') - isVowel = true; - - return isVowel; - } - - public static int CountVowels ( - final String word) - { - int numberOfVowels = 0; - int alphabetCounter = 0; - - while (alphabetCounter < word.length()) - { - char wordAlphabet = word.charAt (alphabetCounter); - - if (IsVowel (wordAlphabet)) - numberOfVowels = numberOfVowels + 1; - - alphabetCounter = alphabetCounter + 1; - } - - return numberOfVowels; - } - - public static boolean ContainsWord ( - String mainWord, - String containedWord) - { - boolean contained = false; - - for (int mainCounter = 0; mainCounter < mainWord.length() - containedWord.length(); mainCounter = mainCounter + 1) - { - int numAlphabetsMatch = 0; - - for (int containedCounter = 0; containedCounter < containedWord.length(); containedCounter = containedCounter + 1) - { - if (mainWord.charAt (mainCounter + containedCounter) == containedWord.charAt (containedCounter)) - numAlphabetsMatch = numAlphabetsMatch + 1; - } - - if (numAlphabetsMatch == containedWord.length()) - contained = true; - } - - return contained; - } - - public static boolean ContainsWord2 ( - String mainWord, - String containedWord) - { - boolean contained = false; - - int mainWordSize = mainWord.length(); - - char[] mainLetters = mainWord.toCharArray(); - - int containedWordSize = containedWord.length(); - - char[] containedLetters = containedWord.toCharArray(); - - if (mainWordSize < containedWordSize) - return false; - - for (int mainCounter = 0; mainCounter < mainWordSize - containedWordSize; mainCounter = mainCounter + 1) - { - int numAlphabetsMatch = 0; - - for (int containedCounter = 0; containedCounter < containedWordSize; containedCounter = containedCounter + 1) - { - if (mainLetters[mainCounter + containedCounter] != containedLetters[containedCounter]) - break; - - numAlphabetsMatch = numAlphabetsMatch + 1; - } - - if (numAlphabetsMatch == containedWordSize) - contained = true; - } - - return contained; - } - - public static int ContainedWordCount ( - String mainWord, - String containedWord) - { - int containedWordCount = 0; - - int mainWordSize = mainWord.length(); - - char[] mainLetters = mainWord.toCharArray(); - - int containedWordSize = containedWord.length(); - - char[] containedLetters = containedWord.toCharArray(); - - if (mainWordSize < containedWordSize) - return 0; - - for (int mainCounter = 0; mainCounter < mainWordSize - containedWordSize; mainCounter = mainCounter + 1) - { - int numAlphabetsMatch = 0; - - for (int containedCounter = 0; containedCounter < containedWordSize; containedCounter = containedCounter + 1) - { - if (mainLetters[mainCounter + containedCounter] != containedLetters[containedCounter]) - break; - - numAlphabetsMatch = numAlphabetsMatch + 1; - } - - if (numAlphabetsMatch == containedWordSize) - containedWordCount = containedWordCount + 1; - } - - return containedWordCount; - } - - public static final void main ( - String[] args) - { - String myWord = "New York City, New York"; - - int vowelsInWord = CountVowels (myWord); - - System.out.println ("\tNumber of Vowels in " + myWord + " is " + vowelsInWord); - - String myContainedWord = "City"; - - System.out.println ("\tIs " + myContainedWord + " inside " + myWord + "? " + ContainsWord2 (myWord, myContainedWord)); - - myContainedWord = "new"; - - System.out.println ("\tIs " + myContainedWord + " inside " + myWord + "? " + ContainsWord2 (myWord, myContainedWord)); - - System.out.println ("\tHow many '" + myContainedWord + "' in '" + myWord + "'? " + ContainedWordCount (myWord, myContainedWord)); - } -}